mirror of
https://github.com/rfivet/uemacs.git
synced 2024-12-18 07:16:23 -05:00
Yet more ANSI'fication
Bored? Me? Why do you ask?
This commit is contained in:
parent
2b3627510d
commit
de0961e007
189
bind.c
189
bind.c
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
extern int meta(), cex(), unarg(), ctrlg(); /* dummy prefix binding functions */
|
extern int meta(), cex(), unarg(), ctrlg(); /* dummy prefix binding functions */
|
||||||
|
|
||||||
help(f, n)
|
int help(int f, int n)
|
||||||
{ /* give me some help!!!!
|
{ /* give me some help!!!!
|
||||||
bring up a fake buffer and read the help file
|
bring up a fake buffer and read the help file
|
||||||
into it with view mode */
|
into it with view mode */
|
||||||
@ -55,7 +55,7 @@ help(f, n)
|
|||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
deskey(f, n)
|
int deskey(int f, int n)
|
||||||
{ /* describe the command for a certain key */
|
{ /* describe the command for a certain key */
|
||||||
register int c; /* key to describe */
|
register int c; /* key to describe */
|
||||||
register char *ptr; /* string pointer to scan output strings */
|
register char *ptr; /* string pointer to scan output strings */
|
||||||
@ -81,12 +81,13 @@ deskey(f, n)
|
|||||||
ostring(ptr);
|
ostring(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* bindtokey: add a new key to the key binding table */
|
/*
|
||||||
|
* bindtokey:
|
||||||
bindtokey(f, n)
|
* add a new key to the key binding table
|
||||||
|
*
|
||||||
int f, n; /* command arguments [IGNORED] */
|
* int f, n; command arguments [IGNORED]
|
||||||
|
*/
|
||||||
|
int bindtokey(int f, int n)
|
||||||
{
|
{
|
||||||
register unsigned int c; /* command key to bind */
|
register unsigned int c; /* command key to bind */
|
||||||
register int (*kfunc) (); /* ptr to the requested function to bind to */
|
register int (*kfunc) (); /* ptr to the requested function to bind to */
|
||||||
@ -169,12 +170,13 @@ int f, n; /* command arguments [IGNORED] */
|
|||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* unbindkey: delete a key from the key binding table */
|
/*
|
||||||
|
* unbindkey:
|
||||||
unbindkey(f, n)
|
* delete a key from the key binding table
|
||||||
|
*
|
||||||
int f, n; /* command arguments [IGNORED] */
|
* int f, n; command arguments [IGNORED]
|
||||||
|
*/
|
||||||
|
unbindkey(int f, int n)
|
||||||
{
|
{
|
||||||
register int c; /* command key to unbind */
|
register int c; /* command key to unbind */
|
||||||
char outseq[80]; /* output buffer for keystroke sequence */
|
char outseq[80]; /* output buffer for keystroke sequence */
|
||||||
@ -199,10 +201,13 @@ int f, n; /* command arguments [IGNORED] */
|
|||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
unbindchar(c)
|
|
||||||
|
|
||||||
int c; /* command key to unbind */
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* unbindchar()
|
||||||
|
*
|
||||||
|
* int c; command key to unbind
|
||||||
|
*/
|
||||||
|
int unbindchar(int c)
|
||||||
{
|
{
|
||||||
register KEYTAB *ktp; /* pointer into the command table */
|
register KEYTAB *ktp; /* pointer into the command table */
|
||||||
register KEYTAB *sktp; /* saved pointer into the command table */
|
register KEYTAB *sktp; /* saved pointer into the command table */
|
||||||
@ -239,16 +244,17 @@ int c; /* command key to unbind */
|
|||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
desbind(f, n)
|
/* describe bindings
|
||||||
/* describe bindings
|
* bring up a fake buffer and list the key bindings
|
||||||
bring up a fake buffer and list the key bindings
|
* into it with view mode
|
||||||
into it with view mode */
|
*/
|
||||||
|
int desbind(int f, int n)
|
||||||
#if APROP
|
#if APROP
|
||||||
{
|
{
|
||||||
buildlist(TRUE, "");
|
buildlist(TRUE, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
apro(f, n)
|
int apro(int f, int n)
|
||||||
{ /* Apropos (List functions that match a substring) */
|
{ /* Apropos (List functions that match a substring) */
|
||||||
char mstring[NSTRING]; /* string to match cmd names to */
|
char mstring[NSTRING]; /* string to match cmd names to */
|
||||||
int status; /* status return */
|
int status; /* status return */
|
||||||
@ -260,11 +266,13 @@ apro(f, n)
|
|||||||
return (buildlist(FALSE, mstring));
|
return (buildlist(FALSE, mstring));
|
||||||
}
|
}
|
||||||
|
|
||||||
buildlist(type, mstring)
|
/*
|
||||||
/* build a binding list (limited or full) */
|
* build a binding list (limited or full)
|
||||||
int type; /* true = full list, false = partial list */
|
*
|
||||||
char *mstring; /* match string if a partial list */
|
* int type; true = full list, false = partial list
|
||||||
|
* char *mstring; match string if a partial list
|
||||||
|
*/
|
||||||
|
int buildlist(int type, char *mstring)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
register WINDOW *wp; /* scanning pointer to windows */
|
register WINDOW *wp; /* scanning pointer to windows */
|
||||||
@ -372,11 +380,14 @@ char *mstring; /* match string if a partial list */
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if APROP
|
#if APROP
|
||||||
strinc(source, sub)
|
|
||||||
/* does source include sub? */
|
|
||||||
char *source; /* string to search in */
|
|
||||||
char *sub; /* substring to look for */
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* does source include sub?
|
||||||
|
*
|
||||||
|
* char *source; string to search in
|
||||||
|
* char *sub; substring to look for
|
||||||
|
*/
|
||||||
|
int strinc(char *source, char *sub)
|
||||||
{
|
{
|
||||||
char *sp; /* ptr into source */
|
char *sp; /* ptr into source */
|
||||||
char *nxtsp; /* next ptr into source */
|
char *nxtsp; /* next ptr into source */
|
||||||
@ -407,12 +418,12 @@ char *sub; /* substring to look for */
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* get a command key sequence from the keyboard */
|
/*
|
||||||
|
* get a command key sequence from the keyboard
|
||||||
unsigned int getckey(mflag)
|
*
|
||||||
|
* int mflag; going for a meta sequence?
|
||||||
int mflag; /* going for a meta sequence? */
|
*/
|
||||||
|
unsigned int getckey(int mflag)
|
||||||
{
|
{
|
||||||
register unsigned int c; /* character fetched */
|
register unsigned int c; /* character fetched */
|
||||||
char tok[NSTRING]; /* command incoming */
|
char tok[NSTRING]; /* command incoming */
|
||||||
@ -431,12 +442,12 @@ int mflag; /* going for a meta sequence? */
|
|||||||
return (c);
|
return (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* execute the startup file */
|
/*
|
||||||
|
* execute the startup file
|
||||||
startup(sfname)
|
*
|
||||||
|
* char *sfname; name of startup file (null if default)
|
||||||
char *sfname; /* name of startup file (null if default) */
|
*/
|
||||||
|
startup(char *sfname)
|
||||||
{
|
{
|
||||||
char *fname; /* resulting file name to execute */
|
char *fname; /* resulting file name to execute */
|
||||||
|
|
||||||
@ -454,16 +465,15 @@ char *sfname; /* name of startup file (null if default) */
|
|||||||
return (dofile(fname));
|
return (dofile(fname));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Look up the existance of a file along the normal or PATH
|
/*
|
||||||
environment variable. Look first in the HOME directory if
|
* Look up the existance of a file along the normal or PATH
|
||||||
asked and possible
|
* environment variable. Look first in the HOME directory if
|
||||||
*/
|
* asked and possible
|
||||||
|
*
|
||||||
char *flook(fname, hflag)
|
* char *fname; base file name to search for
|
||||||
|
* int hflag; Look in the HOME environment variable first?
|
||||||
char *fname; /* base file name to search for */
|
*/
|
||||||
int hflag; /* Look in the HOME environment variable first? */
|
char *flook(char *fname, int hflag)
|
||||||
|
|
||||||
{
|
{
|
||||||
register char *home; /* path to home directory */
|
register char *home; /* path to home directory */
|
||||||
register char *path; /* environmental PATH variable */
|
register char *path; /* environmental PATH variable */
|
||||||
@ -539,11 +549,13 @@ int hflag; /* Look in the HOME environment variable first? */
|
|||||||
return (NULL); /* no such luck */
|
return (NULL); /* no such luck */
|
||||||
}
|
}
|
||||||
|
|
||||||
cmdstr(c, seq)
|
/*
|
||||||
/* change a key command to a string we can print out */
|
* change a key command to a string we can print out
|
||||||
int c; /* sequence to translate */
|
*
|
||||||
char *seq; /* destination string for sequence */
|
* int c; sequence to translate
|
||||||
|
* char *seq; destination string for sequence
|
||||||
|
*/
|
||||||
|
void cmdstr(int c, char *seq)
|
||||||
{
|
{
|
||||||
char *ptr; /* pointer into current position in sequence */
|
char *ptr; /* pointer into current position in sequence */
|
||||||
|
|
||||||
@ -579,12 +591,12 @@ char *seq; /* destination string for sequence */
|
|||||||
*ptr = 0; /* terminate the string */
|
*ptr = 0; /* terminate the string */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function looks a key binding up in the binding table */
|
/*
|
||||||
|
* This function looks a key binding up in the binding table
|
||||||
int (*getbind(c)) ()
|
*
|
||||||
|
* int c; key to find what is bound to it
|
||||||
int c; /* key to find what is bound to it */
|
*/
|
||||||
|
int (*getbind(int c))(int, int)
|
||||||
{
|
{
|
||||||
register KEYTAB *ktp;
|
register KEYTAB *ktp;
|
||||||
|
|
||||||
@ -599,14 +611,12 @@ int c; /* key to find what is bound to it */
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* getfname: This function takes a ptr to function and gets the name
|
/*
|
||||||
associated with it
|
* getfname:
|
||||||
*/
|
* This function takes a ptr to function and gets the name
|
||||||
|
* associated with it
|
||||||
char *getfname(func)
|
*/
|
||||||
|
char *getfname(fn_t func)
|
||||||
int (*func) (); /* ptr to the requested function to bind to */
|
|
||||||
|
|
||||||
{
|
{
|
||||||
register NBIND *nptr; /* pointer into the name binding table */
|
register NBIND *nptr; /* pointer into the name binding table */
|
||||||
|
|
||||||
@ -620,11 +630,13 @@ int (*func) (); /* ptr to the requested function to bind to */
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int (*fncmatch(fname)) ()
|
/*
|
||||||
/* match fname to a function in the names table
|
* match fname to a function in the names table
|
||||||
and return any match or NULL if none */
|
* and return any match or NULL if none
|
||||||
char *fname; /* name to attempt to match */
|
*
|
||||||
|
* char *fname; name to attempt to match
|
||||||
|
*/
|
||||||
|
int (*fncmatch(char *fname)) (int, int)
|
||||||
{
|
{
|
||||||
register NBIND *ffp; /* pointer to entry in name binding table */
|
register NBIND *ffp; /* pointer to entry in name binding table */
|
||||||
|
|
||||||
@ -638,12 +650,13 @@ char *fname; /* name to attempt to match */
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* stock: String key name TO Command Key */
|
/*
|
||||||
|
* stock:
|
||||||
unsigned int stock(keyname)
|
* String key name TO Command Key
|
||||||
|
*
|
||||||
char *keyname; /* name of key to translate to Command key form */
|
* char *keyname; name of key to translate to Command key form
|
||||||
|
*/
|
||||||
|
unsigned int stock(char *keyname)
|
||||||
{
|
{
|
||||||
register unsigned int c; /* key sequence to return */
|
register unsigned int c; /* key sequence to return */
|
||||||
|
|
||||||
@ -688,10 +701,12 @@ char *keyname; /* name of key to translate to Command key form */
|
|||||||
return (c);
|
return (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *transbind(skey)
|
/*
|
||||||
/* string key name to binding name.... */
|
* string key name to binding name....
|
||||||
char *skey; /* name of keey to get binding for */
|
*
|
||||||
|
* char *skey; name of keey to get binding for
|
||||||
|
*/
|
||||||
|
char *transbind(char *skey)
|
||||||
{
|
{
|
||||||
char *bindname;
|
char *bindname;
|
||||||
unsigned int stock();
|
unsigned int stock();
|
||||||
|
24
edef.h
24
edef.h
@ -13,6 +13,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
typedef int (*fn_t)(int, int);
|
||||||
|
|
||||||
struct VIDEO;
|
struct VIDEO;
|
||||||
|
|
||||||
char *flook();
|
char *flook();
|
||||||
@ -506,10 +508,30 @@ extern int mlreply(char *prompt, char *buf, int nbuf);
|
|||||||
extern int mlreplyt(char *prompt, char *buf, int nbuf, int eolchar);
|
extern int mlreplyt(char *prompt, char *buf, int nbuf, int eolchar);
|
||||||
extern int ectoc(int c);
|
extern int ectoc(int c);
|
||||||
extern int ctoec(int c);
|
extern int ctoec(int c);
|
||||||
extern int (*getname(void))(void);
|
extern fn_t getname(void);
|
||||||
extern int tgetc(void);
|
extern int tgetc(void);
|
||||||
extern int get1key(void);
|
extern int get1key(void);
|
||||||
extern int getcmd(void);
|
extern int getcmd(void);
|
||||||
extern int getstring(char *prompt, char *buf, int nbuf, int eolchar);
|
extern int getstring(char *prompt, char *buf, int nbuf, int eolchar);
|
||||||
extern void outstring(char *s);
|
extern void outstring(char *s);
|
||||||
extern void ostring(char *s);
|
extern void ostring(char *s);
|
||||||
|
|
||||||
|
/* bind.c */
|
||||||
|
extern int help(int f, int n);
|
||||||
|
extern int deskey(int f, int n);
|
||||||
|
extern int bindtokey(int f, int n);
|
||||||
|
extern int unbindkey(int f, int n);
|
||||||
|
extern int unbindchar(int c);
|
||||||
|
extern int desbind(int f, int n);
|
||||||
|
extern int apro(int f, int n);
|
||||||
|
extern int buildlist(int type, char *mstring);
|
||||||
|
extern int strinc(char *source, char *sub);
|
||||||
|
extern unsigned int getckey(int mflag);
|
||||||
|
extern startup(char *sfname);
|
||||||
|
extern char *flook(char *fname, int hflag);
|
||||||
|
extern void cmdstr(int c, char *seq);
|
||||||
|
extern fn_t getbind(int c);
|
||||||
|
extern char *getfname(fn_t);
|
||||||
|
extern fn_t fncmatch(char *);
|
||||||
|
extern unsigned int stock(char *keyname);
|
||||||
|
extern char *transbind(char *skey);
|
||||||
|
2
input.c
2
input.c
@ -101,7 +101,7 @@ int ctoec(int c)
|
|||||||
* that pressing a <SPACE> will attempt to complete an unfinished command
|
* that pressing a <SPACE> will attempt to complete an unfinished command
|
||||||
* name if it is unique.
|
* name if it is unique.
|
||||||
*/
|
*/
|
||||||
int (*getname(void))(void)
|
fn_t getname(void)
|
||||||
{
|
{
|
||||||
register int cpos; /* current column on screen output */
|
register int cpos; /* current column on screen output */
|
||||||
register int c;
|
register int c;
|
||||||
|
Loading…
Reference in New Issue
Block a user