mirror of
https://github.com/VARCem/PDCurses.git
synced 2026-09-24 15:55:14 +00:00
Moved has_key() into the keyname module; documented it; tagged this
module correctly. Note the large penalty for linking this module.
This commit is contained in:
@@ -13,16 +13,19 @@
|
||||
|
||||
#include <curspriv.h>
|
||||
|
||||
RCSID("$Id: keyname.c,v 1.3 2007/03/16 06:33:44 wmcbrine Exp $");
|
||||
RCSID("$Id: keyname.c,v 1.4 2007/04/23 21:35:49 wmcbrine Exp $");
|
||||
|
||||
/*man-start**************************************************************
|
||||
|
||||
Name: util
|
||||
Name: keyname
|
||||
|
||||
Synopsis:
|
||||
char *keyname(int key);
|
||||
|
||||
char *key_name(wchar_t c);
|
||||
|
||||
bool has_key(int key);
|
||||
|
||||
Description:
|
||||
keyname() returns a string corresponding to the argument key.
|
||||
key may be any key returned by wgetch().
|
||||
@@ -30,9 +33,13 @@ RCSID("$Id: keyname.c,v 1.3 2007/03/16 06:33:44 wmcbrine Exp $");
|
||||
key_name() is the wide-character version. It takes a wchar_t
|
||||
parameter, but still returns a char *.
|
||||
|
||||
has_key() returns TRUE for recognized keys, FALSE otherwise.
|
||||
This function is an ncurses extension.
|
||||
|
||||
Portability X/Open BSD SYS V
|
||||
keyname Y - 3.0
|
||||
key_name Y
|
||||
has_key - - -
|
||||
|
||||
**man-end****************************************************************/
|
||||
|
||||
@@ -122,6 +129,13 @@ char *keyname(int key)
|
||||
return has_key(key) ? key_name[key - KEY_MIN] : "UNKNOWN KEY";
|
||||
}
|
||||
|
||||
bool has_key(int key)
|
||||
{
|
||||
PDC_LOG(("has_key() - called: key %d\n", key));
|
||||
|
||||
return (key >= KEY_MIN && key <= KEY_MAX);
|
||||
}
|
||||
|
||||
#ifdef PDC_WIDE
|
||||
char *key_name(wchar_t c)
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include <curspriv.h>
|
||||
|
||||
RCSID("$Id: util.c,v 1.59 2007/03/16 06:33:44 wmcbrine Exp $");
|
||||
RCSID("$Id: util.c,v 1.60 2007/04/23 21:35:49 wmcbrine Exp $");
|
||||
|
||||
/*man-start**************************************************************
|
||||
|
||||
@@ -37,8 +37,9 @@ RCSID("$Id: util.c,v 1.59 2007/03/16 06:33:44 wmcbrine Exp $");
|
||||
notation; others are passed through. wunctrl() is the wide-
|
||||
character version of the function.
|
||||
|
||||
delay_output() inserts an ms millisecond pause in output. On
|
||||
some systems, this has no effect.
|
||||
filter() and use_env() are no-ops in PDCurses.
|
||||
|
||||
delay_output() inserts an ms millisecond pause in output.
|
||||
|
||||
getcchar() works in two modes: When wch is not NULL, it reads
|
||||
the cchar_t pointed to by wcval and stores the attributes in
|
||||
@@ -51,8 +52,6 @@ RCSID("$Id: util.c,v 1.59 2007/03/16 06:33:44 wmcbrine Exp $");
|
||||
text at wch, the attributes in attr and the color pair in
|
||||
color_pair. The opts argument is unused.
|
||||
|
||||
filter() and use_env() are no-ops on PDCurses.
|
||||
|
||||
Currently, the length returned by getcchar() is always 1 or 0.
|
||||
Similarly, setcchar() will only take the first wide character
|
||||
from wch, and ignore any others that it "should" take (i.e.,
|
||||
@@ -106,13 +105,6 @@ char *unctrl(chtype c)
|
||||
return strbuf;
|
||||
}
|
||||
|
||||
bool has_key(int key)
|
||||
{
|
||||
PDC_LOG(("has_key() - called: key %d\n",key));
|
||||
|
||||
return (key >= KEY_MIN && key <= KEY_MAX);
|
||||
}
|
||||
|
||||
void filter(void)
|
||||
{
|
||||
PDC_LOG(("filter() - called\n"));
|
||||
|
||||
Reference in New Issue
Block a user