Read a keysequence and return its keymap entry
SLang_Key_Type *SLang_do_key (kml, getkey)
SLKeyMap_List_Type *kml;
int (*getkey)(void);
The SLang_do_key
function reads characters using the function
specified by the getkey
function pointer and uses the
key sequence to return the appropriate entry in the keymap specified
by kml
.
SLang_do_key
returns NULL
if the key sequence is not
defined by the keymap, otherwise it returns a pointer to an object
of type SLang_Key_Type
, which is defined in slang.h
as
#define SLANG_MAX_KEYMAP_KEY_SEQ 14
typedef struct SLang_Key_Type
{
struct SLang_Key_Type *next;
union
{
char *s;
FVOID_STAR f;
unsigned int keysym;
}
f;
unsigned char type; /* type of function */
#define SLKEY_F_INTERPRET 0x01
#define SLKEY_F_INTRINSIC 0x02
#define SLKEY_F_KEYSYM 0x03
unsigned char str[SLANG_MAX_KEYMAP_KEY_SEQ + 1];/* key sequence */
}
SLang_Key_Type;
The type
field specifies which field of the union f
should be used. If type
is SLKEY_F_INTERPRET
, then
f.s
is a string that should be passed to the interpreter for
evaluation. If type
is SLKEY_F_INTRINSIC
, then
f.f
refers to function that should be called. Otherwise,
type
is SLKEY_F_KEYSYM
and f.keysym
represents the
value of the keysym that is associated with the key sequence.
SLkm_define_keysym, SLkm_define_key