Main Page | Class List | Directories | File List | Class Members | File Members

keypad.c File Reference

#include <stdio.h>
#include <slang.h>
#include "demolib.c"

Go to the source code of this file.

Defines

#define TIMEOUT   2

Functions

static int getch (void)
int main (int argc, char **argv)


Define Documentation

#define TIMEOUT   2
 

Definition at line 10 of file keypad.c.

Referenced by getch().


Function Documentation

static int getch void   )  [static]
 

Definition at line 12 of file keypad.c.

References SLang_getkey(), SLang_input_pending(), SLang_ungetkey(), SLkp_getkey(), and TIMEOUT.

00013 {
00014    int ch;
00015    
00016    while (0 == SLang_input_pending (1000))
00017      continue;
00018    
00019    ch = SLang_getkey ();
00020  
00021    if (ch == 033)                      /* escape */
00022      {
00023         if (0 == SLang_input_pending (TIMEOUT))
00024           return 033;
00025      }
00026    
00027    SLang_ungetkey (ch);
00028    
00029    return SLkp_getkey ();
00030 }

int main int  argc,
char **  argv
 

Definition at line 33 of file keypad.c.

References demolib_exit(), demolib_init_terminal(), and getch.

Referenced by SLcurses_wdelch(), SLcurses_winsch(), and write_color_chars().

00034 {
00035    int ch;
00036 
00037    (void) argc; (void) argv;
00038 
00039    if (-1 == demolib_init_terminal (1, 0))
00040      return 1;
00041 
00042    fprintf (stderr, "This program illustrates the slkeypad facility.\n");
00043    fprintf (stderr, "Press any key ('q' quits).\n");
00044    while ('q' != (ch = getch ()))
00045      {
00046         fprintf (stderr, "Keysym: %d\r\n", ch);
00047      }
00048    
00049    demolib_exit (0);
00050    
00051    return 0;
00052 }


© sourcejam.com 2005-2008