Upgrade Texinfo from 4.8 to 4.13 on the vendor branch
[dragonfly.git] / contrib / texinfo / info / infomap.h
1 /* infomap.h -- description of a keymap in Info and related functions.
2    $Id: infomap.h,v 1.6 2007/07/01 21:20:30 karl Exp $
3
4    Copyright (C) 1993, 2001, 2004, 2007 Free Software Foundation, Inc.
5
6    This program is free software: you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation, either version 3 of the License, or
9    (at your option) any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
19    Written by Brian Fox (bfox@ai.mit.edu). */
20
21 #ifndef INFOMAP_H
22 #define INFOMAP_H
23
24 #include "info.h"
25
26 #define ESC '\033'
27 #define DEL '\177'
28 #define TAB '\011'      
29 #define RET '\r'
30 #define LFD '\n'
31 #define SPC ' '
32
33 #define meta_character_threshold (DEL + 1)
34 #define control_character_threshold (SPC)
35
36 #define meta_character_bit 0x80
37 #define control_character_bit 0x40
38
39 #define Meta_p(c) (((c) > meta_character_threshold))
40 #define Control_p(c) ((c) < control_character_threshold)
41
42 #define Meta(c) ((c) | (meta_character_bit))
43 #define UnMeta(c) ((c) & (~meta_character_bit))
44 #define Control(c) ((toupper (c)) & (~control_character_bit))
45 #define UnControl(c) (tolower ((c) | control_character_bit))
46
47 /* A keymap contains one entry for each key in the ASCII set.
48    Each entry consists of a type and a pointer.
49    FUNCTION is the address of a function to run, or the
50    address of a keymap to indirect through.
51    TYPE says which kind of thing FUNCTION is. */
52 typedef struct keymap_entry
53 {
54   char type;
55   InfoCommand *function;
56 } KEYMAP_ENTRY;
57
58 typedef KEYMAP_ENTRY *Keymap;
59
60 /* The values that TYPE can have in a keymap entry. */
61 #define ISFUNC 0
62 #define ISKMAP 1
63
64 extern Keymap info_keymap;
65 extern Keymap echo_area_keymap;
66
67 /* Return a new keymap which has all the uppercase letters mapped to run
68    the function info_do_lowercase_version (). */
69 extern Keymap keymap_make_keymap (void);
70
71 /* Return a new keymap which is a copy of MAP. */
72 extern Keymap keymap_copy_keymap (Keymap map, Keymap rootmap,
73     Keymap newroot);
74
75 /* Free MAP and it's descendents. */
76 extern void keymap_discard_keymap (Keymap map, Keymap rootmap);
77
78 /* Initialize the info keymaps. */
79 extern void initialize_info_keymaps (void);
80
81 #endif /* not INFOMAP_H */