<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <HTML> <HEAD> <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9"> <TITLE> {The S-lang C Library Reference}: SLang_do_key</TITLE> <LINK HREF="cref-124.html" REL=next> <LINK HREF="cref-122.html" REL=previous> <LINK HREF="cref.html#toc123" REL=contents> </HEAD> <BODY> <A HREF="cref-124.html">Next</A> <A HREF="cref-122.html">Previous</A> <A HREF="cref.html#toc123">Contents</A> <HR> <H2><A NAME="SLang_do_key"></A> <A NAME="s123">123. <B>SLang_do_key</B></A></H2> <P> <DL> <DT><B> Synopsis </B><DD><P>Read a keysequence and return its keymap entry <DT><B> Usage </B><DD><P><CODE>SLang_Key_Type *SLang_do_key (kml, getkey)</CODE> <BLOCKQUOTE><CODE> <PRE> SLKeyMap_List_Type *kml; int (*getkey)(void); </PRE> </CODE></BLOCKQUOTE> <DT><B> Description </B><DD><P>The <CODE>SLang_do_key</CODE> function reads characters using the function specified by the <CODE>getkey</CODE> function pointer and uses the key sequence to return the appropriate entry in the keymap specified by <CODE>kml</CODE>. <P><CODE>SLang_do_key</CODE> returns <CODE>NULL</CODE> if the key sequence is not defined by the keymap, otherwise it returns a pointer to an object of type <CODE>SLang_Key_Type</CODE>, which is defined in <CODE>slang.h</CODE> as <BLOCKQUOTE><CODE> <PRE> #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; </PRE> </CODE></BLOCKQUOTE> The <CODE>type</CODE> field specifies which field of the union <CODE>f</CODE> should be used. If <CODE>type</CODE> is <CODE>SLKEY_F_INTERPRET</CODE>, then <CODE>f.s</CODE> is a string that should be passed to the interpreter for evaluation. If <CODE>type</CODE> is <CODE>SLKEY_F_INTRINSIC</CODE>, then <CODE>f.f</CODE> refers to function that should be called. Otherwise, <CODE>type</CODE> is <CODE>SLKEY_F_KEYSYM</CODE> and <CODE>f.keysym</CODE> represents the value of the keysym that is associated with the key sequence. <DT><B> See Also </B><DD><P><CODE>SLkm_define_keysym, SLkm_define_key</CODE> </DL> <P> <P> <P> <HR> <A HREF="cref-124.html">Next</A> <A HREF="cref-122.html">Previous</A> <A HREF="cref.html#toc123">Contents</A> </BODY> </HTML>