Next Previous Contents

126. SLang_do_key

Synopsis

Read a keysequence and return its keymap entry

Usage

SLang_Key_Type *SLang_do_key (kml, getkey)

     SLKeyMap_List_Type *kml;
     int (*getkey)(void);
Description

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

    typedef struct SLang_Key_Type
    {
       unsigned char str[13];          /* key sequence */
    #define SLKEY_F_INTERPRET   0x01
    #define SLKEY_F_INTRINSIC   0x02
    #define SLKEY_F_KEYSYM      0x03
       unsigned char type;             /* type of function */
       union
        {
          char *s;
          FVOID_STAR f;
          unsigned int keysym;
        } f;
       struct SLang_Key_Type *next;
    }
    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.
See Also

SLkm_define_keysym, SLkm_define_key


Next Previous Contents