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