xref: /netbsd-src/external/gpl2/texinfo/dist/info/infomap.h (revision 29619d2afe564e54d657b83e5a3ae89584f83720)
1*29619d2aSchristos /*	$NetBSD: infomap.h,v 1.1.1.1 2016/01/14 00:11:29 christos Exp $	*/
2*29619d2aSchristos 
3*29619d2aSchristos /* infomap.h -- description of a keymap in Info and related functions.
4*29619d2aSchristos    Id: infomap.h,v 1.3 2004/04/11 17:56:46 karl Exp
5*29619d2aSchristos 
6*29619d2aSchristos    Copyright (C) 1993, 2001, 2004 Free Software Foundation, Inc.
7*29619d2aSchristos 
8*29619d2aSchristos    This program is free software; you can redistribute it and/or modify
9*29619d2aSchristos    it under the terms of the GNU General Public License as published by
10*29619d2aSchristos    the Free Software Foundation; either version 2, or (at your option)
11*29619d2aSchristos    any later version.
12*29619d2aSchristos 
13*29619d2aSchristos    This program is distributed in the hope that it will be useful,
14*29619d2aSchristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
15*29619d2aSchristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16*29619d2aSchristos    GNU General Public License for more details.
17*29619d2aSchristos 
18*29619d2aSchristos    You should have received a copy of the GNU General Public License
19*29619d2aSchristos    along with this program; if not, write to the Free Software
20*29619d2aSchristos    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21*29619d2aSchristos 
22*29619d2aSchristos    Written by Brian Fox (bfox@ai.mit.edu). */
23*29619d2aSchristos 
24*29619d2aSchristos #ifndef INFOMAP_H
25*29619d2aSchristos #define INFOMAP_H
26*29619d2aSchristos 
27*29619d2aSchristos #include "info.h"
28*29619d2aSchristos 
29*29619d2aSchristos #define ESC '\033'
30*29619d2aSchristos #define DEL '\177'
31*29619d2aSchristos #define TAB '\011'
32*29619d2aSchristos #define RET '\r'
33*29619d2aSchristos #define LFD '\n'
34*29619d2aSchristos #define SPC ' '
35*29619d2aSchristos 
36*29619d2aSchristos #define meta_character_threshold (DEL + 1)
37*29619d2aSchristos #define control_character_threshold (SPC)
38*29619d2aSchristos 
39*29619d2aSchristos #define meta_character_bit 0x80
40*29619d2aSchristos #define control_character_bit 0x40
41*29619d2aSchristos 
42*29619d2aSchristos #define Meta_p(c) (((c) > meta_character_threshold))
43*29619d2aSchristos #define Control_p(c) ((c) < control_character_threshold)
44*29619d2aSchristos 
45*29619d2aSchristos #define Meta(c) ((c) | (meta_character_bit))
46*29619d2aSchristos #define UnMeta(c) ((c) & (~meta_character_bit))
47*29619d2aSchristos #define Control(c) ((toupper (c)) & (~control_character_bit))
48*29619d2aSchristos #define UnControl(c) (tolower ((c) | control_character_bit))
49*29619d2aSchristos 
50*29619d2aSchristos /* A keymap contains one entry for each key in the ASCII set.
51*29619d2aSchristos    Each entry consists of a type and a pointer.
52*29619d2aSchristos    FUNCTION is the address of a function to run, or the
53*29619d2aSchristos    address of a keymap to indirect through.
54*29619d2aSchristos    TYPE says which kind of thing FUNCTION is. */
55*29619d2aSchristos typedef struct keymap_entry
56*29619d2aSchristos {
57*29619d2aSchristos   char type;
58*29619d2aSchristos   InfoCommand *function;
59*29619d2aSchristos } KEYMAP_ENTRY;
60*29619d2aSchristos 
61*29619d2aSchristos typedef KEYMAP_ENTRY *Keymap;
62*29619d2aSchristos 
63*29619d2aSchristos /* The values that TYPE can have in a keymap entry. */
64*29619d2aSchristos #define ISFUNC 0
65*29619d2aSchristos #define ISKMAP 1
66*29619d2aSchristos 
67*29619d2aSchristos extern Keymap info_keymap;
68*29619d2aSchristos extern Keymap echo_area_keymap;
69*29619d2aSchristos 
70*29619d2aSchristos /* Return a new keymap which has all the uppercase letters mapped to run
71*29619d2aSchristos    the function info_do_lowercase_version (). */
72*29619d2aSchristos extern Keymap keymap_make_keymap (void);
73*29619d2aSchristos 
74*29619d2aSchristos /* Return a new keymap which is a copy of MAP. */
75*29619d2aSchristos extern Keymap keymap_copy_keymap (Keymap map, Keymap rootmap,
76*29619d2aSchristos     Keymap newroot);
77*29619d2aSchristos 
78*29619d2aSchristos /* Free MAP and it's descendents. */
79*29619d2aSchristos extern void keymap_discard_keymap (Keymap map, Keymap rootmap);
80*29619d2aSchristos 
81*29619d2aSchristos /* Initialize the info keymaps. */
82*29619d2aSchristos extern void initialize_info_keymaps (void);
83*29619d2aSchristos 
84*29619d2aSchristos #endif /* not INFOMAP_H */
85