From 8403b1d597fd574e934e52401750827cf1c00de6 Mon Sep 17 00:00:00 2001 From: Thiago Farina Date: Wed, 30 Jun 2010 00:08:45 -0300 Subject: [PATCH] uemacs: convert typedef struct KEYTAB to struct key_tab. Signed-off-by: Thiago Farina Signed-off-by: Linus Torvalds --- bind.c | 34 +++++++++++++++++----------------- ebind.h | 9 +++++++-- edef.h | 2 +- estruct.h | 18 ++++++++---------- 4 files changed, 33 insertions(+), 30 deletions(-) diff --git a/bind.c b/bind.c index 2b90175..97b4e28 100644 --- a/bind.c +++ b/bind.c @@ -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) { diff --git a/ebind.h b/ebind.h index eeb81a1..7047d02 100644 --- a/ebind.h +++ b/ebind.h @@ -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_ */ diff --git a/edef.h b/edef.h index 9f64277..e3211ee 100644 --- a/edef.h +++ b/edef.h @@ -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 */ diff --git a/estruct.h b/estruct.h index e3a9adc..333a4d9 100644 --- a/estruct.h +++ b/estruct.h @@ -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