home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / octa21fs.zip / octave / readline / keymaps.h < prev    next >
C/C++ Source or Header  |  2000-01-15  |  3KB  |  100 lines

  1. /* Modified by Klaus Gebhardt, October 1996 */
  2. /* keymaps.h -- Manipulation of readline keymaps. */
  3.  
  4. /* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
  5.  
  6.    This file is part of the GNU Readline Library, a library for
  7.    reading lines of text with interactive input and history editing.
  8.  
  9.    The GNU Readline Library is free software; you can redistribute it
  10.    and/or modify it under the terms of the GNU General Public License
  11.    as published by the Free Software Foundation; either version 1, or
  12.    (at your option) any later version.
  13.  
  14.    The GNU Readline Library is distributed in the hope that it will be
  15.    useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  16.    of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17.    GNU General Public License for more details.
  18.  
  19.    The GNU General Public License is often shipped with GNU software, and
  20.    is generally kept in a file called COPYING or LICENSE.  If you do not
  21.    have a copy of the license, write to the Free Software Foundation,
  22.    675 Mass Ave, Cambridge, MA 02139, USA. */
  23.  
  24. #ifndef _KEYMAPS_H_
  25. #define _KEYMAPS_H_
  26.  
  27. #if defined (READLINE_LIBRARY)
  28. #  include "chardefs.h"
  29. #else
  30. #  include <readline/chardefs.h>
  31. #endif
  32.  
  33. #if !defined (_FUNCTION_DEF)
  34. #  define _FUNCTION_DEF
  35. typedef int Function ();
  36. typedef void VFunction ();
  37. typedef char *CPFunction ();
  38. typedef char **CPPFunction ();
  39. #endif
  40.  
  41. /* A keymap contains one entry for each key in the ASCII set.
  42.    Each entry consists of a type and a pointer.
  43.    POINTER is the address of a function to run, or the
  44.    address of a keymap to indirect through.
  45.    TYPE says which kind of thing POINTER is. */
  46. typedef struct _keymap_entry {
  47.   char type;
  48.   Function *function;
  49. } KEYMAP_ENTRY;
  50.  
  51. /* This must be large enough to hold bindings for all of the characters
  52.    in a desired character set (e.g, 128 for ASCII, 256 for ISO Latin-x,
  53.    and so on). */
  54. #define KEYMAP_SIZE 256
  55.  
  56. /* I wanted to make the above structure contain a union of:
  57.    union { Function *function; struct _keymap_entry *keymap; } value;
  58.    but this made it impossible for me to create a static array.
  59.    Maybe I need C lessons. */
  60.  
  61. typedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[KEYMAP_SIZE];
  62. typedef KEYMAP_ENTRY *Keymap;
  63.  
  64. /* The values that TYPE can have in a keymap entry. */
  65. #define ISFUNC 0
  66. #define ISKMAP 1
  67. #define ISMACR 2
  68.  
  69. extern KEYMAP_ENTRY_ARRAY emacs_standard_keymap, emacs_meta_keymap, emacs_ctlx_keymap;
  70. #ifdef __EMX__
  71. extern KEYMAP_ENTRY_ARRAY emacs_emx_keymap;
  72. #endif
  73. extern KEYMAP_ENTRY_ARRAY vi_insertion_keymap, vi_movement_keymap;
  74.  
  75. /* Return a new, empty keymap.
  76.    Free it with free() when you are done. */
  77. extern Keymap rl_make_bare_keymap ();
  78.  
  79. /* Return a new keymap which is a copy of MAP. */
  80. extern Keymap rl_copy_keymap ();
  81.  
  82. /* Return a new keymap with the printing characters bound to rl_insert,
  83.    the lowercase Meta characters bound to run their equivalents, and
  84.    the Meta digits bound to produce numeric arguments. */
  85. extern Keymap rl_make_keymap ();
  86.  
  87. extern void rl_discard_keymap ();
  88.  
  89. /* Return the keymap corresponding to a given name.  Names look like
  90.    `emacs' or `emacs-meta' or `vi-insert'. */
  91. extern Keymap rl_get_keymap_by_name ();
  92.  
  93. /* Return the current keymap. */
  94. extern Keymap rl_get_keymap ();
  95.  
  96. /* Set the current keymap to MAP. */
  97. extern void rl_set_keymap ();
  98.  
  99. #endif /* _KEYMAPS_H_ */
  100.