2021-07-22 22:47:58 -04:00
|
|
|
/* names.h -- mapping of functions to names and keys */
|
|
|
|
|
2021-07-19 03:39:00 -04:00
|
|
|
#ifndef _NAMES_H_
|
|
|
|
#define _NAMES_H_
|
|
|
|
|
2021-07-24 04:34:54 -04:00
|
|
|
#include "retcode.h"
|
|
|
|
|
|
|
|
|
2021-07-23 20:58:23 -04:00
|
|
|
/* Bindable uEMACS function pointer type and definition template */
|
|
|
|
#define BINDABLE( fname) int fname( int f, int n)
|
|
|
|
|
|
|
|
typedef BINDABLE( (*fnp_t)) ;
|
2021-07-19 03:39:00 -04:00
|
|
|
|
2021-07-22 22:47:58 -04:00
|
|
|
|
2013-05-31 01:18:10 -04:00
|
|
|
/* Structure for the name binding table. */
|
2021-07-22 22:47:58 -04:00
|
|
|
typedef struct {
|
2021-07-19 23:24:32 -04:00
|
|
|
const char *n_name ; /* name starting with one tag character */
|
2021-07-22 22:47:58 -04:00
|
|
|
fnp_t n_func ; /* function the name is bound to */
|
|
|
|
unsigned n_keycode ; /* default key assignment, 0 when none */
|
2021-07-19 03:39:00 -04:00
|
|
|
} name_bind ;
|
2013-05-31 01:18:10 -04:00
|
|
|
|
2021-07-23 20:58:23 -04:00
|
|
|
#define bind_name( p) (&( p)->n_name[ 1])
|
|
|
|
#define bind_tag( p) ( p)->n_name[ 0]
|
2021-07-19 23:24:32 -04:00
|
|
|
|
2021-07-22 22:47:58 -04:00
|
|
|
/* Structure for the key bindings table. */
|
|
|
|
typedef struct {
|
|
|
|
unsigned k_code ; /* Key code */
|
|
|
|
const name_bind *k_nbp ; /* entry in name to function map table */
|
|
|
|
} key_tab ;
|
|
|
|
|
|
|
|
|
2021-07-24 04:34:54 -04:00
|
|
|
extern const name_bind names[] ; /* name to function mapping table */
|
|
|
|
extern key_tab *keytab ; /* key bind to functions table */
|
2021-07-22 22:47:58 -04:00
|
|
|
|
|
|
|
|
2021-07-24 04:34:54 -04:00
|
|
|
boolean init_bindings( void) ;
|
|
|
|
key_tab *setkeybinding( unsigned key, const name_bind *nbp) ;
|
|
|
|
boolean delkeybinding( unsigned key) ;
|
2021-07-21 04:40:36 -04:00
|
|
|
const name_bind *fncmatch( char *name) ; /* look up by name */
|
|
|
|
|
2021-07-23 20:58:23 -04:00
|
|
|
/* bindable functions mapped to prefix keys and hooks */
|
|
|
|
BINDABLE( nullproc) ;
|
|
|
|
BINDABLE( metafn) ;
|
|
|
|
BINDABLE( cex) ;
|
|
|
|
BINDABLE( unarg) ;
|
|
|
|
|
2021-07-19 03:39:00 -04:00
|
|
|
#endif
|
2021-07-22 22:47:58 -04:00
|
|
|
|
|
|
|
/* end of names.h */
|