Merge from vendor branch NCURSES:
[dragonfly.git] / contrib / texinfo / info / infomap.h
1 /* infomap.h -- description of a keymap in Info and related functions.
2    $Id: infomap.h,v 1.6 2001/11/16 23:16:59 karl Exp $
3
4    Copyright (C) 1993, 2001 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 Brian Fox (bfox@ai.mit.edu). */
21
22 #ifndef INFOMAP_H
23 #define INFOMAP_H
24
25 #include "info.h"
26
27 #define ESC '\033'
28 #define DEL '\177'
29 #define TAB '\011'      
30 #define RET '\r'
31 #define LFD '\n'
32 #define SPC ' '
33
34 #define meta_character_threshold (DEL + 1)
35 #define control_character_threshold (SPC)
36
37 #define meta_character_bit 0x80
38 #define control_character_bit 0x40
39
40 #define Meta_p(c) (((c) > meta_character_threshold))
41 #define Control_p(c) ((c) < control_character_threshold)
42
43 #define Meta(c) ((c) | (meta_character_bit))
44 #define UnMeta(c) ((c) & (~meta_character_bit))
45 #define Control(c) ((toupper (c)) & (~control_character_bit))
46 #define UnControl(c) (tolower ((c) | control_character_bit))
47
48 /* A keymap contains one entry for each key in the ASCII set.
49    Each entry consists of a type and a pointer.
50    FUNCTION is the address of a function to run, or the
51    address of a keymap to indirect through.
52    TYPE says which kind of thing FUNCTION is. */
53 typedef struct keymap_entry
54 {
55   char type;
56   InfoCommand *function;
57 } KEYMAP_ENTRY;
58
59 typedef KEYMAP_ENTRY *Keymap;
60
61 /* The values that TYPE can have in a keymap entry. */
62 #define ISFUNC 0
63 #define ISKMAP 1
64
65 extern Keymap info_keymap;
66 extern Keymap echo_area_keymap;
67
68 /* Return a new keymap which has all the uppercase letters mapped to run
69    the function info_do_lowercase_version (). */
70 extern Keymap keymap_make_keymap ();
71
72 /* Return a new keymap which is a copy of MAP. */
73 extern Keymap keymap_copy_keymap ();
74
75 /* Free MAP and it's descendents. */
76 extern void keymap_discard_keymap ();
77
78 /* Initialize the info keymaps. */
79 extern void initialize_info_keymaps ();
80
81 #endif /* not INFOMAP_H */