uemacs: convert typedef struct KEYTAB to struct key_tab.

Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Thiago Farina 2010-06-30 00:08:45 -03:00 committed by Linus Torvalds
parent e5e0fbd7e7
commit 8403b1d597
4 changed files with 33 additions and 30 deletions

34
bind.c
View File

@ -89,11 +89,11 @@ int deskey(int f, int n)
*/
int bindtokey(int f, int n)
{
unsigned int c; /* command key to bind */
fn_t kfunc; /* ptr to the requested function to bind to */
KEYTAB *ktp; /* pointer into the command table */
int found; /* matched command flag */
char outseq[80]; /* output buffer for keystroke sequence */
unsigned int c; /* command key to bind */
fn_t kfunc; /* ptr to the requested function to bind to */
struct key_tab *ktp; /* pointer into the command table */
int found; /* matched command flag */
char outseq[80]; /* output buffer for keystroke sequence */
/* prompt the user to type in a key to bind */
mlwrite(": bind-to-key ");
@ -208,9 +208,9 @@ int unbindkey(int f, int n)
*/
int unbindchar(int c)
{
KEYTAB *ktp; /* pointer into the command table */
KEYTAB *sktp; /* saved pointer into the command table */
int found; /* matched command flag */
struct key_tab *ktp; /* pointer into the command table */
struct key_tab *sktp; /* saved pointer into the command table */
int found; /* matched command flag */
/* search the table to see if the key exists */
ktp = &keytab[0];
@ -275,12 +275,12 @@ int apro(int f, int n)
int buildlist(int type, char *mstring)
#endif
{
window_t *wp; /* scanning pointer to windows */
KEYTAB *ktp; /* pointer into the command table */
NBIND *nptr; /* pointer into the name binding table */
struct buffer *bp; /* buffer to put binding list into */
int cpos; /* current position to use in outseq */
char outseq[80]; /* output buffer for keystroke sequence */
window_t *wp; /* scanning pointer to windows */
struct key_tab *ktp; /* pointer into the command table */
NBIND *nptr; /* pointer into the name binding table */
struct buffer *bp; /* buffer to put binding list into */
int cpos; /* current position to use in outseq */
char outseq[80]; /* output buffer for keystroke sequence */
/* split the current window to make room for the binding list */
if (splitwind(FALSE, 1) == FALSE)
@ -596,9 +596,9 @@ void cmdstr(int c, char *seq)
*/
int (*getbind(int c))(int, int)
{
KEYTAB *ktp;
struct key_tab *ktp;
ktp = &keytab[0]; /* Look in key table. */
ktp = &keytab[0]; /* Look in key table. */
while (ktp->k_fp != NULL) {
if (ktp->k_code == c)
return (ktp->k_fp);
@ -612,7 +612,7 @@ int (*getbind(int c))(int, int)
/*
* getfname:
* This function takes a ptr to function and gets the name
* associated with it
* associated with it.
*/
char *getfname(fn_t func)
{

View File

@ -1,17 +1,20 @@
/* EBIND.H
*
*
* Initial default key to function bindings
*
* Modified by Petri Kutvonen
*/
#ifndef EBIND_H_
#define EBIND_H_
/*
* Command table.
* This table is *roughly* in ASCII order, left to right across the
* characters of the command. This explains the funny location of the
* control-X commands.
*/
KEYTAB keytab[NBINDS] = {
struct key_tab keytab[NBINDS] = {
{CONTROL | 'A', gotobol}
,
{CONTROL | 'B', backchar}
@ -416,3 +419,5 @@ KEYTAB keytab[NBINDS] = {
{0, NULL}
};
#endif /* EBIND_H_ */

2
edef.h
View File

@ -32,7 +32,7 @@ extern int flickcode; /* do flicker supression? */
extern char *modename[]; /* text names of modes */
extern char *mode2name[]; /* text names of modes */
extern char modecode[]; /* letters to represent modes */
extern KEYTAB keytab[]; /* key bind to functions table */
extern struct key_tab keytab[]; /* key bind to functions table */
extern NBIND names[]; /* name to function table */
extern int gmode; /* global editor mode */
extern int gflags; /* global control flag */

View File

@ -597,18 +597,16 @@ typedef struct {
#define TTbacg (*term.t_setback)
#endif
/* structure for the table of initial key bindings */
/* Structure for the table of initial key bindings. */
struct key_tab {
short k_code; /* Key code */
int (*k_fp)(int, int); /* Routine to handle it */
};
/* Structure for the name binding table. */
typedef struct {
short k_code; /* Key code */
int (*k_fp)(int, int); /* Routine to handle it */
} KEYTAB;
/* structure for the name binding table */
typedef struct {
char *n_name; /* name of function key */
int (*n_func)(int, int);/* function name is bound to */
char *n_name; /* name of function key */
int (*n_func)(int, int); /* function name is bound to */
} NBIND;
/* The editor holds deleted text chunks in the KILL buffer. The