home *** CD-ROM | disk | FTP | other *** search
/ Best Objectech Shareware Selections / UNTITLED.iso / boss / word / text / 019 / keymap.h < prev    next >
C/C++ Source or Header  |  1993-01-19  |  2KB  |  57 lines

  1. /*
  2.  *  Copyright (c) 1992 John E. Davis  (davis@amy.tch.harvard.edu)
  3.  *  All Rights Reserved.
  4.  */
  5. #ifndef _JED_KEYMAP_H_
  6. #define _JED_KEYMAP_H_  
  7. /* Jed Keymap routines.
  8.     
  9.    The main problem here is how to associate a sequence of characters to a
  10.    given function in as fast a way as possible.  In addition, I require that
  11.    the procedure be memory efficient as well as allowing the user the
  12.    flexability to redefine the keys and add new keymaps.
  13.  
  14.    To do this, I define a key map to be an array of keys.  There may be many
  15.    keymaps (global, local, etc...).    A key structure is defined */
  16.    
  17. #define VOID char
  18.  
  19. /* Think about the overhead of malloc str below.  With a malloc we have
  20.    4 bytes for pointer, 8 bytes overhead + strlen(str) + 1 >= 13 */
  21. typedef struct Key_Type
  22.   {
  23.       char str[13];               /* key sequence */
  24.       VOID *f;                   /* function to invoke */
  25.       char type;               /* type of function */
  26.       struct Key_Type *next;           /* */
  27.   }
  28. Key_Type;
  29.  
  30. #define F_INTERPRET 0x01
  31. #define F_INTRINSIC 0x02
  32.  
  33.  
  34. extern Key_Type Global_Map[128];
  35. extern Key_Type *Mini_Map;
  36.  
  37. extern void init_keymaps(void);
  38. extern void define_key(char *, char *, Key_Type *);
  39. extern void undefine_key(char *, Key_Type *);
  40. extern void define_key1(char *, VOID *, char, Key_Type *);
  41. extern int digit_arg(void);
  42. extern void do_jed(void);
  43. extern void jed(void);
  44. extern int do_key(char);
  45. extern int kbd_quit(void);
  46. extern Key_Type *copy_keymap(Key_Type *);
  47. extern Key_Type *Mini_Map;
  48. extern VOID *Last_Key_Function;
  49. extern int *Repeat_Factor;
  50. extern char *find_key(int *);
  51. extern Key_Type *find_keymap(char *);
  52. extern Key_Type *create_keymap(char *);
  53. extern void use_keymap(char *);
  54. extern VOID *find_function(char *);
  55. #endif
  56.  
  57.