Back to index

tetex-bin  3.0
infokey.h
Go to the documentation of this file.
00001 /* infokey.h -- Custom keystroke definition support.
00002    $Id: infokey.h,v 1.2 2004/04/11 17:56:45 karl Exp $
00003 
00004    Copyright (C) 1999, 2002 Free Software Foundation, Inc.
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2, or (at your option)
00009    any later version.
00010 
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015 
00016    You should have received a copy of the GNU General Public License
00017    along with this program; if not, write to the Free Software
00018    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00019 
00020    Written by Andrew Bettison <andrewb@zip.com.au>.
00021 
00022    This design was derived from the "lesskey" system in less 3.4.0. by
00023    Mark Nudelman.
00024 
00025    The following terminology is confusing:
00026        source file = $HOME/.infokey
00027        infokey file = $HOME/.info
00028    Oh, well.
00029  */
00030 
00031 
00032 /* Default source file, where user writes text definitions to be
00033    compiled to the infokey file.  MS-DOS doesn't allow leading
00034    dots in file names.  */
00035 #ifdef __MSDOS__
00036 #define INFOKEY_SRCFILE            "_infokey"
00037 #else
00038 #define INFOKEY_SRCFILE            ".infokey"
00039 #endif
00040 
00041 /* Default "infokey file", where compiled user defs are kept and
00042    read by Info.  MS-DOS doesn't allow leading dots in file names.  */
00043 #ifdef __MSDOS__
00044 #define INFOKEY_FILE        "_info"
00045 #else
00046 #define INFOKEY_FILE        ".info"
00047 #endif
00048 
00049 /*
00050 Format of entire infokey file:
00051 
00052        4 bytes              magic number S
00053        X bytes              version string
00054        1 byte '\0'   terminator
00055 
00056        any number of sections:
00057               1 byte        section id
00058               2 bytes              section length (N)
00059               N bytes              section definitions: format depends on section
00060 
00061        4 bytes              magic number E
00062 
00063 Format of INFO and EA sections:
00064        
00065        1 byte        flag: 1 == suppress default key bindings
00066        Repeat:
00067               X bytes              key sequence
00068               1 byte '\0'   terminator
00069               1 byte        action code (A_xxx)
00070 
00071 Format of VAR section:
00072        
00073        Repeat:
00074               X bytes              variable name
00075               1 byte '\0'   terminator
00076               Y bytes              value
00077               1 byte '\0'   terminator
00078 
00079 */
00080 
00081 #define       INFOKEY_NMAGIC              8
00082 
00083 #define       INFOKEY_MAGIC_S0     '\001'
00084 #define       INFOKEY_MAGIC_S1     'I'
00085 #define       INFOKEY_MAGIC_S2     'n'
00086 #define       INFOKEY_MAGIC_S3     'f'
00087 
00088 #define       INFOKEY_SECTION_INFO 'i'
00089 #define       INFOKEY_SECTION_EA   'e'
00090 #define       INFOKEY_SECTION_VAR  'v'
00091 
00092 #define       INFOKEY_MAGIC_E0     'A'
00093 #define       INFOKEY_MAGIC_E1     'l'
00094 #define       INFOKEY_MAGIC_E2     'f'
00095 #define       INFOKEY_MAGIC_E3     'n'
00096 
00097 #define       INFOKEY_RADIX        64
00098 #define       INFOKEY_MAX_SECTIONLEN      500
00099 #define       INFOKEY_MAX_DEFLEN   16
00100 
00101 #define       A_MAX_COMMAND        120
00102 #define       A_INVALID            121
00103 
00104 /* Character transformations (independent of info's own) */
00105 
00106 #define       CONTROL(c)           ((c) & 0x1f)
00107 #define       ISCONTROL(c)         (((c) & ~0x1f) == 0)
00108 #define       META(c)                     ((c) | 0x80)
00109 #define       UNMETA(c)            ((c) & ~0x80)
00110 #define       ISMETA(c)            (((c) & 0x80) != 0)
00111 
00112 /* Special keys (keys which output different strings on different terminals) */
00113 
00114 #define SK_ESCAPE           CONTROL('k')
00115 #define SK_RIGHT_ARROW             1
00116 #define SK_LEFT_ARROW              2
00117 #define SK_UP_ARROW         3
00118 #define SK_DOWN_ARROW              4
00119 #define SK_PAGE_UP          5
00120 #define SK_PAGE_DOWN        6
00121 #define SK_HOME                    7
00122 #define SK_END                     8
00123 #define SK_DELETE           9
00124 #define SK_INSERT           10
00125 #define SK_CTL_LEFT_ARROW   11
00126 #define SK_CTL_RIGHT_ARROW  12
00127 #define SK_CTL_DELETE              13
00128 #define SK_LITERAL          40