home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / MISC / NETWORK / TEL23SRC.ZIP / INCLUDE / KEYMAP.H < prev    next >
Encoding:
C/C++ Source or Header  |  1991-06-26  |  3.6 KB  |  78 lines

  1. /*
  2. *    keymap.h
  3. *  Used for Keyboard mapping things
  4. ****************************************************************************
  5. *                                                                          *
  6. *                                                                          *
  7. *      NCSA Telnet                                                         *
  8. *      by Tim Krauskopf, VT100 by Gaige Paulsen, Tek by Aaron Contorer     *
  9. *            Additions by Kurt Mahan, Heeren Pathak, & Quincey Koziol       *
  10. *                                                                          *
  11. *      National Center for Supercomputing Applications                     *
  12. *      152 Computing Applications Building                                 *
  13. *      605 E. Springfield Ave.                                             *
  14. *      Champaign, IL  61820                                                *
  15. *                                                                          *
  16. ****************************************************************************
  17. *    Quincey Koziol
  18. *   Defines for keyboard mapping variables
  19. */
  20.  
  21. #ifndef KEYMAP_H
  22.  
  23. typedef struct key_node_struct {    /* structure to hold nodes in the keyboard mapping linked list */
  24.     unsigned int key_code;            /* the key code this node re-maps */
  25.     union {
  26.         char *key_str;                /* pointer to the re-mapping string for this key */
  27.         unsigned char vt100_code;    /* vt100 code generated by this key */
  28.       }    key_data;                    /* union to hold pointer to string or vt100 code */
  29.     struct key_node_struct *next_node;    /* pointer to the next node in the keyboard mapping list */
  30.   } key_node;
  31.  
  32. /* Macros to access the mapped & special flags for any key code */
  33. /* -------------------------------------------------------------*/
  34. /* macro to return whether a key code is mapped */
  35. #define IS_KEY_MAPPED(x)    ((key_map_flags[(int)(x/8)]&(0x0001<<(x%8)))>0)
  36.  
  37. /* macro to return whether a key code is special (i.e. kermit verb) */
  38. #define IS_KEY_SPECIAL(x)    ((key_special_flags[(int)(x/8)]&(0x0001<<(x%8)))>0)
  39.  
  40. /* macro to reset the mapped flag for a key code */
  41. #define RESET_KEY_MAPPED(x)    (key_map_flags[(int)(x/8)]=key_map_flags[(int)(x/8)]&(unsigned char)(~(0x0001<<(x%8))))
  42.  
  43. /* macro to reset the special flag for a key code */
  44. #define RESET_KEY_SPECIAL(x)    (key_special_flags[(int)(x/8)]=key_special_flags[(int)(x/8)]&(unsigned char)(~(0x0001<<(x%8))))
  45.  
  46. /* macro to set the mapped flag for a key code */
  47. #define SET_KEY_MAPPED(x)    (key_map_flags[(int)(x/8)]=key_map_flags[(int)(x/8)]|(unsigned char)(0x0001<<(x%8)))
  48.  
  49. /* macro to set the special flag for a key code */
  50. #define SET_KEY_SPECIAL(x)    (key_special_flags[(int)(x/8)]=key_special_flags[(int)(x/8)]|(unsigned char)(0x0001<<(x%8)))
  51.  
  52.  
  53. #ifdef KEYMASTER
  54. key_node *head_key=NULL;        /* head of the key node list */
  55.  
  56. /* array of unsigned chars which are really used as bits for flags to indicate */
  57. /*    that a key has been re-mapped */
  58. unsigned char key_map_flags[1024];
  59.  
  60. /* array of unsigned chars which are really used as bits for flags to indicate */
  61. /*    that a key is a special key (i.e. used for a kermit verb) */
  62. unsigned char key_special_flags[1024];
  63. #else
  64. extern key_node *head_key;        /* head of the key node list */
  65.  
  66. /* array of unsigned chars which are really used as bits for flags to indicate */
  67. /*    that a key has been re-mapped */
  68. extern unsigned char key_map_flags[1024];
  69.  
  70. /* array of unsigned chars which are really used as bits for flags to indicate */
  71. /*    that a key is a special key */
  72. extern unsigned char key_special_flags[1024];
  73. #endif
  74.  
  75. #define KEYMAP_H
  76. #endif    /* keymap.h */
  77.  
  78.