1 /* $OpenBSD: kbd.h,v 1.18 2006/07/27 19:59:29 deraadt Exp $ */ 2 3 /* This file is in the public domain. */ 4 5 /* 6 * kbd.h: type definitions for symbol.c and kbd.c for mg experimental 7 */ 8 9 struct map_element { 10 KCHAR k_base; /* first key in element */ 11 KCHAR k_num; /* last key in element */ 12 PF *k_funcp; /* pointer to array of pointers */ 13 /* to functions */ 14 struct keymap_s *k_prefmap; /* keymap of ONLY prefix key in */ 15 /* element */ 16 }; 17 18 /* 19 * Predefined keymaps are NOT type KEYMAP because final array needs 20 * dimension. If any changes are made to this struct, they must be reflected 21 * in all keymap declarations. 22 */ 23 24 #define KEYMAPE(NUM) { \ 25 short map_num; /* elements used */ \ 26 short map_max; /* elements allocated */\ 27 PF map_default; /* default function */ \ 28 struct map_element map_element[NUM]; /* really [e_max] */ \ 29 } 30 typedef struct keymap_s KEYMAPE(1) KEYMAP; 31 32 /* Number of map_elements to grow an overflowed keymap by */ 33 #define IMAPEXT 0 34 #define MAPGROW 3 35 #define MAPINIT (MAPGROW+1) 36 37 /* Max number of default bindings added to avoid creating new element */ 38 #define MAPELEDEF 4 39 40 struct maps_s { 41 KEYMAP *p_map; 42 const char *p_name; 43 struct maps_s *p_next; 44 }; 45 46 extern struct maps_s *maps; 47 extern struct maps_s fundamental_mode; 48 #define fundamental_map (fundamental_mode.p_map) 49 50 int dobindkey(KEYMAP *, const char *, const char *); 51 KEYMAP *name_map(const char *); 52 struct maps_s *name_mode(const char *); 53 PF doscan(KEYMAP *, int, KEYMAP **); 54 void maps_init(void); 55 int maps_add(KEYMAP *, const char *); 56 57 extern struct map_element *ele; 58 extern struct maps_s *defb_modes[]; 59