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