Upgrade Texinfo from 4.8 to 4.13 on the vendor branch
[dragonfly.git] / contrib / texinfo / info / infokey.h
1 /* infokey.h -- Custom keystroke definition support.
2    $Id: infokey.h,v 1.5 2007/07/01 21:20:30 karl Exp $
3
4    Copyright (C) 1999, 2002, 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 Andrew Bettison <andrewb@zip.com.au>.
20
21    This design was derived from the "lesskey" system in less 3.4.0. by
22    Mark Nudelman.
23
24    The following terminology is confusing:
25         source file = $HOME/.infokey
26         infokey file = $HOME/.info
27    Oh, well.
28  */
29
30
31 /* Default source file, where user writes text definitions to be
32    compiled to the infokey file.  MS-DOS doesn't allow leading
33    dots in file names.  */
34 #ifdef __MSDOS__
35 #define INFOKEY_SRCFILE         "_infokey"
36 #else
37 #define INFOKEY_SRCFILE         ".infokey"
38 #endif
39
40 /* Default "infokey file", where compiled user defs are kept and
41    read by Info.  MS-DOS doesn't allow leading dots in file names.  */
42 #ifdef __MSDOS__
43 #define INFOKEY_FILE            "_info"
44 #else
45 #define INFOKEY_FILE            ".info"
46 #endif
47
48 /*
49 Format of entire infokey file:
50
51         4 bytes         magic number S
52         X bytes         version string
53         1 byte '\0'     terminator
54
55         any number of sections:
56                 1 byte          section id
57                 2 bytes         section length (N)
58                 N bytes         section definitions: format depends on section
59
60         4 bytes         magic number E
61
62 Format of INFO and EA sections:
63         
64         1 byte          flag: 1 == suppress default key bindings
65         Repeat:
66                 X bytes         key sequence
67                 1 byte '\0'     terminator
68                 1 byte          action code (A_xxx)
69
70 Format of VAR section:
71         
72         Repeat:
73                 X bytes         variable name
74                 1 byte '\0'     terminator
75                 Y bytes         value
76                 1 byte '\0'     terminator
77
78 */
79
80 #define INFOKEY_NMAGIC          8
81
82 #define INFOKEY_MAGIC_S0        '\001'
83 #define INFOKEY_MAGIC_S1        'I'
84 #define INFOKEY_MAGIC_S2        'n'
85 #define INFOKEY_MAGIC_S3        'f'
86
87 #define INFOKEY_SECTION_INFO    'i'
88 #define INFOKEY_SECTION_EA      'e'
89 #define INFOKEY_SECTION_VAR     'v'
90
91 #define INFOKEY_MAGIC_E0        'A'
92 #define INFOKEY_MAGIC_E1        'l'
93 #define INFOKEY_MAGIC_E2        'f'
94 #define INFOKEY_MAGIC_E3        'n'
95
96 #define INFOKEY_RADIX           64
97 #define INFOKEY_MAX_SECTIONLEN  500
98 #define INFOKEY_MAX_DEFLEN      16
99
100 #define A_MAX_COMMAND           120
101 #define A_INVALID               121
102
103 /* Character transformations (independent of info's own) */
104
105 #define CONTROL(c)              ((c) & 0x1f)
106 #define ISCONTROL(c)            (((c) & ~0x1f) == 0)
107 #define META(c)                 ((c) | 0x80)
108 #define UNMETA(c)               ((c) & ~0x80)
109 #define ISMETA(c)               (((c) & 0x80) != 0)
110
111 /* Special keys (keys which output different strings on different terminals) */
112
113 #define SK_ESCAPE               CONTROL('k')
114 #define SK_RIGHT_ARROW          1
115 #define SK_LEFT_ARROW           2
116 #define SK_UP_ARROW             3
117 #define SK_DOWN_ARROW           4
118 #define SK_PAGE_UP              5
119 #define SK_PAGE_DOWN            6
120 #define SK_HOME                 7
121 #define SK_END                  8
122 #define SK_DELETE               9
123 #define SK_INSERT               10
124 #define SK_CTL_LEFT_ARROW       11
125 #define SK_CTL_RIGHT_ARROW      12
126 #define SK_CTL_DELETE           13
127 #define SK_LITERAL              40