2021-07-23 02:47:58 +00:00
|
|
|
/* names.h -- mapping of functions to names and keys */
|
|
|
|
|
2021-07-19 07:39:00 +00:00
|
|
|
#ifndef _NAMES_H_
|
|
|
|
#define _NAMES_H_
|
|
|
|
|
2021-07-20 09:34:35 +00:00
|
|
|
/* Generic uEMACS function pointer type */
|
|
|
|
typedef int (*fnp_t)( int, int) ;
|
2021-07-19 07:39:00 +00:00
|
|
|
|
2021-07-23 02:47:58 +00:00
|
|
|
|
2013-05-31 05:18:10 +00:00
|
|
|
/* Structure for the name binding table. */
|
2021-07-23 02:47:58 +00:00
|
|
|
typedef struct {
|
2021-07-20 03:24:32 +00:00
|
|
|
const char *n_name ; /* name starting with one tag character */
|
2021-07-23 02:47:58 +00:00
|
|
|
fnp_t n_func ; /* function the name is bound to */
|
|
|
|
unsigned n_keycode ; /* default key assignment, 0 when none */
|
2021-07-19 07:39:00 +00:00
|
|
|
} name_bind ;
|
2013-05-31 05:18:10 +00:00
|
|
|
|
2021-07-20 03:24:32 +00:00
|
|
|
#define bind_name( p) (&(p)->n_name[ 1])
|
|
|
|
#define bind_tag( p) (p)->n_name[ 0]
|
|
|
|
|
2021-07-23 02:47:58 +00:00
|
|
|
/* Structure for the key bindings table. */
|
|
|
|
typedef struct {
|
|
|
|
unsigned k_code ; /* Key code */
|
|
|
|
fnp_t k_fp ; /* Routine to handle it */
|
|
|
|
const name_bind *k_nbp ; /* entry in name to function map table */
|
|
|
|
} key_tab ;
|
|
|
|
|
|
|
|
|
2021-07-20 09:34:35 +00:00
|
|
|
extern const name_bind names[] ; /* name to function mapping table */
|
2013-05-31 05:18:10 +00:00
|
|
|
|
2021-07-23 02:47:58 +00:00
|
|
|
/* keycode to function mapping table */
|
|
|
|
#define NBINDS 256 /* max # of bound keys */
|
|
|
|
extern key_tab keytab[ NBINDS] ; /* key bind to functions table */
|
|
|
|
|
|
|
|
|
|
|
|
void init_bindings( void) ;
|
2021-07-21 08:40:36 +00:00
|
|
|
const name_bind *fncmatch( char *name) ; /* look up by name */
|
|
|
|
|
2021-07-19 07:39:00 +00:00
|
|
|
#endif
|
2021-07-23 02:47:58 +00:00
|
|
|
|
|
|
|
/* end of names.h */
|