1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Doxygen: rename struct key to reduce spurious links

Rename struct key to struct named_key, use more const, change the num
member from int to term_event_key_T, and put a KBD_UNDEF at the end of
the array (even though it won't be read).
This commit is contained in:
Kalle Olavi Niemitalo 2007-07-27 18:57:22 +03:00 committed by Kalle Olavi Niemitalo
parent 3fac1bc421
commit c78f59e78c

View File

@ -318,12 +318,12 @@ get_keymap_name(enum keymap_id keymap_id)
} }
struct key { struct named_key {
unsigned char *str; const unsigned char *str;
int num; term_event_key_T num;
}; };
static struct key key_table[] = { static const struct named_key key_table[] = {
{ "Enter", KBD_ENTER }, { "Enter", KBD_ENTER },
{ "Space", ' ' }, { "Space", ' ' },
{ "Backspace", KBD_BS }, { "Backspace", KBD_BS },
@ -351,13 +351,13 @@ static struct key key_table[] = {
{ "F10", KBD_F10 }, { "F10", KBD_F10 },
{ "F11", KBD_F11 }, { "F11", KBD_F11 },
{ "F12", KBD_F12 }, { "F12", KBD_F12 },
{ NULL, 0 } { NULL, KBD_UNDEF }
}; };
term_event_key_T term_event_key_T
read_key(const unsigned char *key_str) read_key(const unsigned char *key_str)
{ {
struct key *key; const struct named_key *key;
if (key_str[0] && !key_str[1]) if (key_str[0] && !key_str[1])
return key_str[0]; return key_str[0];
@ -438,8 +438,8 @@ add_keystroke_to_string(struct string *str, struct term_event_keyboard *kbd,
int escape) int escape)
{ {
unsigned char key_buffer[3] = "\\x"; unsigned char key_buffer[3] = "\\x";
unsigned char *key_string = NULL; const unsigned char *key_string = NULL;
struct key *key; const struct named_key *key;
if (kbd->key == KBD_UNDEF) return; if (kbd->key == KBD_UNDEF) return;
@ -459,7 +459,7 @@ add_keystroke_to_string(struct string *str, struct term_event_keyboard *kbd,
if (!key_string) { if (!key_string) {
key_string = key_buffer + 1; key_string = key_buffer + 1;
*key_string = (unsigned char) kbd->key; key_buffer[1] = (unsigned char) kbd->key;
if (escape && strchr("'\"\\", kbd->key)) if (escape && strchr("'\"\\", kbd->key))
key_string--; key_string--;
} }