home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 14 / hacker14.iso / programacao / cwin / c.exe / $INSTDIR / include / readline / keymaps.h < prev    next >
Encoding:
C/C++ Source or Header  |  2003-12-15  |  3.6 KB  |  111 lines

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