infomap.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /* infomap.h -- description of a keymap in Info and related functions.
  2. $Id$
  3. Copyright 1993, 1999, 2001, 2002, 2004, 2007, 2013, 2014 Free Software
  4. Foundation, Inc.
  5. This program is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. Originaly written by Brian Fox. */
  16. #ifndef INFOMAP_H
  17. #define INFOMAP_H
  18. #include "info.h"
  19. #define ESC '\033'
  20. #define DEL '\177'
  21. #define TAB '\011'
  22. #define RET '\r'
  23. #define LFD '\n'
  24. #define SPC ' '
  25. #define meta_character_threshold (DEL + 1)
  26. #define control_character_threshold (SPC)
  27. #define meta_character_bit 0x80
  28. #define control_character_bit 0x40
  29. #define Meta_p(c) (((c) > meta_character_threshold))
  30. #define Control_p(c) ((c) < control_character_threshold)
  31. #define Meta(c) ((c) | (meta_character_bit))
  32. #define UnMeta(c) ((c) & (~meta_character_bit))
  33. #define Control(c) ((toupper (c)) & (~control_character_bit))
  34. #define UnControl(c) (tolower ((c) | control_character_bit))
  35. /* Structure used to map sequences of bytes to recognized keys. */
  36. typedef struct bytemap_entry
  37. {
  38. char type;
  39. int key;
  40. struct bytemap_entry *next;
  41. } BYTEMAP_ENTRY;
  42. #define BYTEMAP_NONE 0
  43. #define BYTEMAP_KEY 1
  44. #define BYTEMAP_MAP 2
  45. #define BYTEMAP_ESC 3
  46. extern BYTEMAP_ENTRY *byte_seq_to_key;
  47. typedef struct keymap_entry
  48. {
  49. char type;
  50. union
  51. {
  52. InfoCommand *function; /* The address of a function. */
  53. struct keymap_entry *keymap; /* The address of another Keymap */
  54. } value;
  55. } KEYMAP_ENTRY;
  56. /* The values that TYPE can have in a keymap entry. */
  57. #define ISFUNC 0
  58. #define ISKMAP 1
  59. /* We use Keymap for a pointer to a block of KEYMAP_SIZE KEYMAP_ENTRY's. */
  60. typedef KEYMAP_ENTRY *Keymap;
  61. extern Keymap info_keymap;
  62. extern Keymap echo_area_keymap;
  63. #define KEY_RIGHT_ARROW 256
  64. #define KEY_LEFT_ARROW 257
  65. #define KEY_UP_ARROW 258
  66. #define KEY_DOWN_ARROW 259
  67. #define KEY_PAGE_UP 260
  68. #define KEY_PAGE_DOWN 261
  69. #define KEY_HOME 262
  70. #define KEY_END 263
  71. #define KEY_DELETE 264
  72. #define KEY_INSERT 265
  73. #define KEY_CTL_LEFT_ARROW 266
  74. #define KEY_CTL_RIGHT_ARROW 267
  75. #define KEY_CTL_DELETE 268
  76. #define KEY_BACK_TAB 269
  77. #define KEY_MOUSE 270
  78. /* Add this to get the offset of the key binding with the meta key. */
  79. #define KEYMAP_META_BASE 271
  80. /* Number of entries in a Keymap: 256 entries for plain byte values plus
  81. mappings for special keys. The bindings for the key chords with meta
  82. follow. */
  83. #define KEYMAP_SIZE (KEYMAP_META_BASE * 2)
  84. #define KEYMAP_META(k) ((k) < KEYMAP_META_BASE ? (k) + KEYMAP_META_BASE : (k))
  85. /* Default "infokey file", where user defs are kept and read by
  86. Info. MS-DOS doesn't allow leading dots in file names. */
  87. #ifdef __MSDOS__
  88. #define INFOKEY_FILE "_infokey"
  89. #else
  90. #define INFOKEY_FILE ".infokey"
  91. #endif
  92. #define A_MAX_COMMAND 120
  93. #define A_INVALID 121
  94. #define CONTROL(c) ((c) & 0x1f)
  95. /* Return a new keymap which has all the uppercase letters mapped to run
  96. the function info_do_lowercase_version (). */
  97. extern Keymap keymap_make_keymap (void);
  98. /* Read init file and initialize the info keymaps. */
  99. extern void read_init_file (char *init_file);
  100. #endif /* not INFOMAP_H */