xref: /freebsd/contrib/less/lesskey.h (revision 4523eebc6c1828d4fd41d7f1ab943cf079043bc8)
1 /*
2  * Copyright (C) 1984-2026  Mark Nudelman
3  *
4  * You may distribute under the terms of either the GNU General Public
5  * License or the Less License, as specified in the README file.
6  *
7  * For more information, see the README file.
8  */
9 
10 #include "lang.h"
11 #include "xbuf.h"
12 
13 /*
14  * Format of a lesskey file:
15  *
16  *      LESSKEY_MAGIC (4 bytes)
17  *       sections...
18  *      END_LESSKEY_MAGIC (4 bytes)
19  *
20  * Each section is:
21  *
22  *      section_MAGIC (1 byte)
23  *      section_length (2 bytes)
24  *      key table (section_length bytes)
25  */
26 #define C0_LESSKEY_MAGIC        '\0'
27 #define C1_LESSKEY_MAGIC        'M'
28 #define C2_LESSKEY_MAGIC        '+'
29 #define C3_LESSKEY_MAGIC        'G'
30 
31 #define CMD_SECTION             'c'
32 #define EDIT_SECTION            'e'
33 #define VAR_SECTION             'v'
34 #define END_SECTION             'x'
35 
36 #define C0_END_LESSKEY_MAGIC    'E'
37 #define C1_END_LESSKEY_MAGIC    'n'
38 #define C2_END_LESSKEY_MAGIC    'd'
39 
40 /* */
41 #define KRADIX          64
42 
43 struct lesskey_table
44 {
45 	constant struct lesskey_cmdname *names;
46 	struct xbuffer buf;
47 	int is_var;
48 };
49 
50 struct lesskey_tables
51 {
52 	struct lesskey_table *currtable;
53 	struct lesskey_table cmdtable;
54 	struct lesskey_table edittable;
55 	struct lesskey_table vartable;
56 };
57 
58