summaryrefslogtreecommitdiff
path: root/info/infomap.h
blob: 1e670693d225cd8e61f7468782851411feb59f11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/* infomap.h -- description of a keymap in Info and related functions.
   $Id: infomap.h,v 1.6 2007/07/01 21:20:30 karl Exp $

   Copyright (C) 1993, 2001, 2004, 2007 Free Software Foundation, Inc.

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.

   Written by Brian Fox (bfox@ai.mit.edu). */

#ifndef INFOMAP_H
#define INFOMAP_H

#include "info.h"

#define ESC '\033'
#define DEL '\177'
#define TAB '\011'      
#define RET '\r'
#define LFD '\n'
#define SPC ' '

#define meta_character_threshold (DEL + 1)
#define control_character_threshold (SPC)

#define meta_character_bit 0x80
#define control_character_bit 0x40

#define Meta_p(c) (((c) > meta_character_threshold))
#define Control_p(c) ((c) < control_character_threshold)

#define Meta(c) ((c) | (meta_character_bit))
#define UnMeta(c) ((c) & (~meta_character_bit))
#define Control(c) ((toupper (c)) & (~control_character_bit))
#define UnControl(c) (tolower ((c) | control_character_bit))

/* A keymap contains one entry for each key in the ASCII set.
   Each entry consists of a type and a pointer.
   FUNCTION is the address of a function to run, or the
   address of a keymap to indirect through.
   TYPE says which kind of thing FUNCTION is. */
typedef struct keymap_entry
{
  char type;
  InfoCommand *function;
} KEYMAP_ENTRY;

typedef KEYMAP_ENTRY *Keymap;

/* The values that TYPE can have in a keymap entry. */
#define ISFUNC 0
#define ISKMAP 1

extern Keymap info_keymap;
extern Keymap echo_area_keymap;

/* Return a new keymap which has all the uppercase letters mapped to run
   the function info_do_lowercase_version (). */
extern Keymap keymap_make_keymap (void);

/* Return a new keymap which is a copy of MAP. */
extern Keymap keymap_copy_keymap (Keymap map, Keymap rootmap,
    Keymap newroot);

/* Free MAP and it's descendents. */
extern void keymap_discard_keymap (Keymap map, Keymap rootmap);

/* Initialize the info keymaps. */
extern void initialize_info_keymaps (void);

#endif /* not INFOMAP_H */