1/* infomap.h -- description of a keymap in Info and related functions.
2   $Id: infomap.h,v 1.3 2004/04/11 17:56:46 karl Exp $
3
4   Copyright (C) 1993, 2001, 2004 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. */
53typedef struct keymap_entry
54{
55  char type;
56  InfoCommand *function;
57} KEYMAP_ENTRY;
58
59typedef KEYMAP_ENTRY *Keymap;
60
61/* The values that TYPE can have in a keymap entry. */
62#define ISFUNC 0
63#define ISKMAP 1
64
65extern Keymap info_keymap;
66extern 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 (). */
70extern Keymap keymap_make_keymap (void);
71
72/* Return a new keymap which is a copy of MAP. */
73extern Keymap keymap_copy_keymap (Keymap map, Keymap rootmap,
74    Keymap newroot);
75
76/* Free MAP and it's descendents. */
77extern void keymap_discard_keymap (Keymap map, Keymap rootmap);
78
79/* Initialize the info keymaps. */
80extern void initialize_info_keymaps (void);
81
82#endif /* not INFOMAP_H */
83