1 /* $NetBSD: infokey.h,v 1.1.1.1 2016/01/14 00:11:29 christos Exp $ */ 2 3 /* infokey.h -- Custom keystroke definition support. 4 Id: infokey.h,v 1.2 2004/04/11 17:56:45 karl Exp 5 6 Copyright (C) 1999, 2002 Free Software Foundation, Inc. 7 8 This program is free software; you can redistribute it and/or modify 9 it under the terms of the GNU General Public License as published by 10 the Free Software Foundation; either version 2, or (at your option) 11 any later version. 12 13 This program is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with this program; if not, write to the Free Software 20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 22 Written by Andrew Bettison <andrewb@zip.com.au>. 23 24 This design was derived from the "lesskey" system in less 3.4.0. by 25 Mark Nudelman. 26 27 The following terminology is confusing: 28 source file = $HOME/.infokey 29 infokey file = $HOME/.info 30 Oh, well. 31 */ 32 33 34 /* Default source file, where user writes text definitions to be 35 compiled to the infokey file. MS-DOS doesn't allow leading 36 dots in file names. */ 37 #ifdef __MSDOS__ 38 #define INFOKEY_SRCFILE "_infokey" 39 #else 40 #define INFOKEY_SRCFILE ".infokey" 41 #endif 42 43 /* Default "infokey file", where compiled user defs are kept and 44 read by Info. MS-DOS doesn't allow leading dots in file names. */ 45 #ifdef __MSDOS__ 46 #define INFOKEY_FILE "_info" 47 #else 48 #define INFOKEY_FILE ".info" 49 #endif 50 51 /* 52 Format of entire infokey file: 53 54 4 bytes magic number S 55 X bytes version string 56 1 byte '\0' terminator 57 58 any number of sections: 59 1 byte section id 60 2 bytes section length (N) 61 N bytes section definitions: format depends on section 62 63 4 bytes magic number E 64 65 Format of INFO and EA sections: 66 67 1 byte flag: 1 == suppress default key bindings 68 Repeat: 69 X bytes key sequence 70 1 byte '\0' terminator 71 1 byte action code (A_xxx) 72 73 Format of VAR section: 74 75 Repeat: 76 X bytes variable name 77 1 byte '\0' terminator 78 Y bytes value 79 1 byte '\0' terminator 80 81 */ 82 83 #define INFOKEY_NMAGIC 8 84 85 #define INFOKEY_MAGIC_S0 '\001' 86 #define INFOKEY_MAGIC_S1 'I' 87 #define INFOKEY_MAGIC_S2 'n' 88 #define INFOKEY_MAGIC_S3 'f' 89 90 #define INFOKEY_SECTION_INFO 'i' 91 #define INFOKEY_SECTION_EA 'e' 92 #define INFOKEY_SECTION_VAR 'v' 93 94 #define INFOKEY_MAGIC_E0 'A' 95 #define INFOKEY_MAGIC_E1 'l' 96 #define INFOKEY_MAGIC_E2 'f' 97 #define INFOKEY_MAGIC_E3 'n' 98 99 #define INFOKEY_RADIX 64 100 #define INFOKEY_MAX_SECTIONLEN 500 101 #define INFOKEY_MAX_DEFLEN 16 102 103 #define A_MAX_COMMAND 120 104 #define A_INVALID 121 105 106 /* Character transformations (independent of info's own) */ 107 108 #define CONTROL(c) ((c) & 0x1f) 109 #define ISCONTROL(c) (((c) & ~0x1f) == 0) 110 #define META(c) ((c) | 0x80) 111 #define UNMETA(c) ((c) & ~0x80) 112 #define ISMETA(c) (((c) & 0x80) != 0) 113 114 /* Special keys (keys which output different strings on different terminals) */ 115 116 #define SK_ESCAPE CONTROL('k') 117 #define SK_RIGHT_ARROW 1 118 #define SK_LEFT_ARROW 2 119 #define SK_UP_ARROW 3 120 #define SK_DOWN_ARROW 4 121 #define SK_PAGE_UP 5 122 #define SK_PAGE_DOWN 6 123 #define SK_HOME 7 124 #define SK_END 8 125 #define SK_DELETE 9 126 #define SK_INSERT 10 127 #define SK_CTL_LEFT_ARROW 11 128 #define SK_CTL_RIGHT_ARROW 12 129 #define SK_CTL_DELETE 13 130 #define SK_LITERAL 40 131