Category : C Source Code
Archive   : TEL2307S.ZIP
Filename : KEYMAP.H

 
Output of file : KEYMAP.H contained in archive : TEL2307S.ZIP
/*
* keymap.h
* Used for Keyboard mapping things
****************************************************************************
* *
* *
* NCSA Telnet *
* by Tim Krauskopf, VT100 by Gaige Paulsen, Tek by Aaron Contorer *
* Additions by Kurt Mahan, Heeren Pathak, & Quincey Koziol *
* *
* National Center for Supercomputing Applications *
* 152 Computing Applications Building *
* 605 E. Springfield Ave. *
* Champaign, IL 61820 *
* *
****************************************************************************
* Quincey Koziol
* Defines for keyboard mapping variables
*/

#ifndef KEYMAP_H
#define KEYMAP_H

typedef struct key_node_struct { /* structure to hold nodes in the keyboard mapping linked list */
unsigned int key_code; /* the key code this node re-maps */
union {
char *key_str; /* pointer to the re-mapping string for this key */
unsigned char vt100_code; /* vt100 code generated by this key */
} key_data; /* union to hold pointer to string or vt100 code */
struct key_node_struct *next_node; /* pointer to the next node in the keyboard mapping list */
} key_node;

/* Macros to access the mapped & special flags for any key code */
/* -------------------------------------------------------------*/
/* macro to return whether a key code is mapped */
#define IS_KEY_MAPPED(x) ((key_map_flags[(int)(x/8)]&(0x0001<<(x%8)))>0)

/* macro to return whether a key code is special (i.e. kermit verb) */
#define IS_KEY_SPECIAL(x) ((key_special_flags[(int)(x/8)]&(0x0001<<(x%8)))>0)

/* macro to reset the mapped flag for a key code */
#define RESET_KEY_MAPPED(x) (key_map_flags[(int)(x/8)]=key_map_flags[(int)(x/8)]&(unsigned char)(~(0x0001<<(x%8))))

/* macro to reset the special flag for a key code */
#define RESET_KEY_SPECIAL(x) (key_special_flags[(int)(x/8)]=key_special_flags[(int)(x/8)]&(unsigned char)(~(0x0001<<(x%8))))

/* macro to set the mapped flag for a key code */
#define SET_KEY_MAPPED(x) (key_map_flags[(int)(x/8)]=key_map_flags[(int)(x/8)]|(unsigned char)(0x0001<<(x%8)))

/* macro to set the special flag for a key code */
#define SET_KEY_SPECIAL(x) (key_special_flags[(int)(x/8)]=key_special_flags[(int)(x/8)]|(unsigned char)(0x0001<<(x%8)))

/* The number of kermit verbs we recognize (listed further in the verb_table[]) */
#define NUM_KERMIT_VERBS 24

#ifdef KEYMASTER
key_node *head_key=NULL; /* head of the key node list */

/* array of unsigned chars which are really used as bits for flags to indicate */
/* that a key has been re-mapped */
unsigned char key_map_flags[1024];

/* array of unsigned chars which are really used as bits for flags to indicate */
/* that a key is a special key (i.e. used for a kermit verb) */
unsigned char key_special_flags[1024];

/* Array of Kermit verbs */
static char *verb_table[NUM_KERMIT_VERBS]={
"null","gold","pf1","pf2","pf3","pf4",
"kp0","kp1","kp2","kp3","kp4","kp5",
"kp6","kp7","kp8","kp9","kpdot","kpminus",
"kpcoma","kpenter","uparr","dnarr","lfarr","rtarr"};

static unsigned int verb_length[NUM_KERMIT_VERBS]={
4,4,3,3,3,3,
3,3,3,3,3,3,
3,3,3,3,5,7,
6,7,5,5,5,5};

static unsigned int verb_num[NUM_KERMIT_VERBS]={
0,VSF1,VSF1,VSF2,VSF3,VSF4,
VSK0,VSK1,VSK2,VSK3,VSK4,VSK5,
VSK6,VSK7,VSK8,VSK9,VSKP,VSKM,
VSKC,VSKE,VSUP,VSDN,VSLT,VSRT};

#else
extern key_node *head_key; /* head of the key node list */

/* array of unsigned chars which are really used as bits for flags to indicate */
/* that a key has been re-mapped */
extern unsigned char key_map_flags[1024];

/* array of unsigned chars which are really used as bits for flags to indicate */
/* that a key is a special key */
extern unsigned char key_special_flags[1024];
#endif

#endif /* keymap.h */



  3 Responses to “Category : C Source Code
Archive   : TEL2307S.ZIP
Filename : KEYMAP.H

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/