mirror of
https://github.com/rfivet/uemacs.git
synced 2024-12-17 23:06:25 -05:00
start tagging uEMACS functions that are not compatible with view mode.
This commit is contained in:
parent
3889f1709c
commit
92c9208cd4
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
* text=auto
|
150
bind.c
150
bind.c
@ -31,14 +31,13 @@
|
|||||||
|
|
||||||
#if APROP
|
#if APROP
|
||||||
static int buildlist( char *mstring) ;
|
static int buildlist( char *mstring) ;
|
||||||
static int strinc( char *source, char *sub) ;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void cmdstr( int c, char *seq) ;
|
static void cmdstr( int c, char *seq) ;
|
||||||
static unsigned int getckey( int mflag) ;
|
static unsigned int getckey( int mflag) ;
|
||||||
static unsigned int stock( char *keyname) ;
|
static unsigned int stock( char *keyname) ;
|
||||||
static int unbindchar( unsigned c) ;
|
static int unbindchar( unsigned c) ;
|
||||||
static char *getfname( fn_t) ;
|
static const char *getfname( unsigned keycode, char *failmsg) ;
|
||||||
|
|
||||||
|
|
||||||
int help(int f, int n)
|
int help(int f, int n)
|
||||||
@ -77,10 +76,9 @@ int help(int f, int n)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int deskey(int f, int n)
|
int deskey( int f, int n) {
|
||||||
{ /* describe the command for a certain key */
|
/* describe the command for a certain key */
|
||||||
int c; /* key to describe */
|
int c; /* key to describe */
|
||||||
char *ptr; /* string pointer to scan output strings */
|
|
||||||
char outseq[NSTRING]; /* output buffer for command sequence */
|
char outseq[NSTRING]; /* output buffer for command sequence */
|
||||||
|
|
||||||
/* prompt the user to type us a key to describe */
|
/* prompt the user to type us a key to describe */
|
||||||
@ -96,12 +94,8 @@ int deskey(int f, int n)
|
|||||||
ostring(outseq);
|
ostring(outseq);
|
||||||
ostring(" ");
|
ostring(" ");
|
||||||
|
|
||||||
/* find the right ->function */
|
|
||||||
if ((ptr = getfname(getbind(c))) == NULL)
|
|
||||||
ptr = "Not Bound";
|
|
||||||
|
|
||||||
/* output the command sequence */
|
/* output the command sequence */
|
||||||
ostring(ptr);
|
ostring( getfname( c, "Not Bound")) ;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +108,7 @@ int deskey(int f, int n)
|
|||||||
int bindtokey(int f, int n)
|
int bindtokey(int f, int n)
|
||||||
{
|
{
|
||||||
unsigned int c; /* command key to bind */
|
unsigned int c; /* command key to bind */
|
||||||
fn_t kfunc; /* ptr to the requested function to bind to */
|
fnp_t kfunc; /* ptr to the requested function to bind to */
|
||||||
struct key_tab *ktp; /* pointer into the command table */
|
struct key_tab *ktp; /* pointer into the command table */
|
||||||
int found; /* matched command flag */
|
int found; /* matched command flag */
|
||||||
char outseq[80]; /* output buffer for keystroke sequence */
|
char outseq[80]; /* output buffer for keystroke sequence */
|
||||||
@ -123,7 +117,7 @@ int bindtokey(int f, int n)
|
|||||||
mlwrite(": bind-to-key ");
|
mlwrite(": bind-to-key ");
|
||||||
|
|
||||||
/* get the function name to bind it to */
|
/* get the function name to bind it to */
|
||||||
kfunc = getname();
|
kfunc = getname()->n_func ;
|
||||||
if (kfunc == NULL) {
|
if (kfunc == NULL) {
|
||||||
mlwrite("(No such function)");
|
mlwrite("(No such function)");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -266,6 +260,35 @@ static int unbindchar( unsigned c) {
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if APROP
|
||||||
|
/*
|
||||||
|
* does source include sub?
|
||||||
|
*
|
||||||
|
* char *source; string to search in
|
||||||
|
* char *sub; substring to look for
|
||||||
|
*/
|
||||||
|
static boolean strinc( const char *source, const char *sub) {
|
||||||
|
/* for each character in the source string */
|
||||||
|
for( ; *source ; source++) {
|
||||||
|
const char *nxtsp ; /* next ptr into source */
|
||||||
|
const char *tp ; /* ptr into substring */
|
||||||
|
|
||||||
|
nxtsp = source;
|
||||||
|
|
||||||
|
/* is the substring here? */
|
||||||
|
for( tp = sub ; *tp ; tp++)
|
||||||
|
if( *nxtsp++ != *tp)
|
||||||
|
break ;
|
||||||
|
|
||||||
|
/* yes, return a success */
|
||||||
|
if( *tp == 0)
|
||||||
|
return TRUE ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE ;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* 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
|
||||||
@ -299,7 +322,7 @@ static int buildlist( char *mstring) {
|
|||||||
#endif
|
#endif
|
||||||
struct window *wp; /* scanning pointer to windows */
|
struct window *wp; /* scanning pointer to windows */
|
||||||
struct key_tab *ktp; /* pointer into the command table */
|
struct key_tab *ktp; /* pointer into the command table */
|
||||||
struct name_bind *nptr; /* pointer into the name binding table */
|
const name_bind *nptr;/* pointer into the name binding table */
|
||||||
struct buffer *bp; /* buffer to put binding list into */
|
struct buffer *bp; /* buffer to put binding list into */
|
||||||
char outseq[80]; /* output buffer for keystroke sequence */
|
char outseq[80]; /* output buffer for keystroke sequence */
|
||||||
|
|
||||||
@ -339,7 +362,7 @@ static int buildlist( char *mstring) {
|
|||||||
wp->w_marko = 0;
|
wp->w_marko = 0;
|
||||||
|
|
||||||
/* build the contents of this window, inserting it line by line */
|
/* build the contents of this window, inserting it line by line */
|
||||||
for( nptr = &names[ 0] ; nptr->n_func != NULL ; nptr++) {
|
for( nptr = names ; nptr->n_func != NULL ; nptr++) {
|
||||||
int cpos ; /* current position to use in outseq */
|
int cpos ; /* current position to use in outseq */
|
||||||
|
|
||||||
#if APROP
|
#if APROP
|
||||||
@ -391,36 +414,6 @@ static int buildlist( char *mstring) {
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if APROP
|
|
||||||
|
|
||||||
/*
|
|
||||||
* does source include sub?
|
|
||||||
*
|
|
||||||
* char *source; string to search in
|
|
||||||
* char *sub; substring to look for
|
|
||||||
*/
|
|
||||||
static int strinc( char *source, char *sub) {
|
|
||||||
/* for each character in the source string */
|
|
||||||
for( ; *source ; source++) {
|
|
||||||
char *nxtsp ; /* next ptr into source */
|
|
||||||
char *tp ; /* ptr into substring */
|
|
||||||
|
|
||||||
nxtsp = source;
|
|
||||||
|
|
||||||
/* is the substring here? */
|
|
||||||
for( tp = sub ; *tp ; tp++)
|
|
||||||
if( *nxtsp++ != *tp)
|
|
||||||
break ;
|
|
||||||
|
|
||||||
/* yes, return a success */
|
|
||||||
if( *tp == 0)
|
|
||||||
return TRUE ;
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE ;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get a command key sequence from the keyboard
|
* get a command key sequence from the keyboard
|
||||||
*
|
*
|
||||||
@ -512,57 +505,25 @@ static void cmdstr( int c, char *seq) {
|
|||||||
*
|
*
|
||||||
* int c; key to find what is bound to it
|
* int c; key to find what is bound to it
|
||||||
*/
|
*/
|
||||||
fn_t getbind( unsigned c) {
|
fnp_t getbind( unsigned c) {
|
||||||
struct key_tab *ktp;
|
struct key_tab *ktp ;
|
||||||
|
|
||||||
ktp = &keytab[0]; /* Look in key table. */
|
for( ktp = keytab ; ktp->k_fp != NULL ; ktp++)
|
||||||
while (ktp->k_fp != NULL) {
|
|
||||||
if (ktp->k_code == c)
|
if (ktp->k_code == c)
|
||||||
return ktp->k_fp;
|
return ktp->k_fp ;
|
||||||
++ktp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* no such binding */
|
/* no such binding */
|
||||||
return NULL;
|
return NULL ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
static const char *getfname( unsigned keycode, char *failmsg) {
|
||||||
* getfname:
|
/* takes a key code and gets the name of the function bound to it */
|
||||||
* This function takes a ptr to function and gets the name
|
fnp_t func = getbind( keycode) ;
|
||||||
* associated with it.
|
if( func == NULL)
|
||||||
*/
|
return failmsg ;
|
||||||
static char *getfname(fn_t func)
|
|
||||||
{
|
|
||||||
struct name_bind *nptr; /* pointer into the name binding table */
|
|
||||||
|
|
||||||
/* skim through the table, looking for a match */
|
const char *found = getnamebind( func)->n_name ;
|
||||||
nptr = &names[0];
|
return *found ? found : failmsg ;
|
||||||
while (nptr->n_func != NULL) {
|
|
||||||
if (nptr->n_func == func)
|
|
||||||
return nptr->n_name;
|
|
||||||
++nptr;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* match fname to a function in the names table
|
|
||||||
* and return any match or NULL if none
|
|
||||||
*
|
|
||||||
* char *fname; name to attempt to match
|
|
||||||
*/
|
|
||||||
int (*fncmatch(char *fname)) (int, int)
|
|
||||||
{
|
|
||||||
struct name_bind *ffp; /* pointer to entry in name binding table */
|
|
||||||
|
|
||||||
/* scan through the table, returning any match */
|
|
||||||
ffp = &names[0];
|
|
||||||
while (ffp->n_func != NULL) {
|
|
||||||
if (strcmp(fname, ffp->n_name) == 0)
|
|
||||||
return ffp->n_func;
|
|
||||||
++ffp;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -618,15 +579,8 @@ static unsigned int stock( char *keyname) {
|
|||||||
/*
|
/*
|
||||||
* 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 key to get binding for
|
||||||
*/
|
*/
|
||||||
char *transbind(char *skey)
|
const char *transbind( char *skey) {
|
||||||
{
|
return getfname( stock( skey), "ERROR") ;
|
||||||
char *bindname;
|
|
||||||
|
|
||||||
bindname = getfname(getbind(stock(skey)));
|
|
||||||
if (bindname == NULL)
|
|
||||||
bindname = "ERROR";
|
|
||||||
|
|
||||||
return bindname;
|
|
||||||
}
|
}
|
||||||
|
10
bind.h
10
bind.h
@ -1,23 +1,21 @@
|
|||||||
#ifndef _BIND_H_
|
#ifndef _BIND_H_
|
||||||
#define _BIND_H_
|
#define _BIND_H_
|
||||||
|
|
||||||
|
#include "fnp_t.h"
|
||||||
|
|
||||||
#define APROP 1 /* Add code for Apropos command */
|
#define APROP 1 /* Add code for Apropos command */
|
||||||
|
|
||||||
#if APROP
|
#if APROP
|
||||||
int apro( int f, int n) ;
|
int apro( int f, int n) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Some global fuction declarations. */
|
|
||||||
typedef int (*fn_t)(int, int);
|
|
||||||
|
|
||||||
int help( int f, int n) ;
|
int help( int f, int n) ;
|
||||||
int deskey( int f, int n) ;
|
int deskey( int f, int n) ;
|
||||||
int bindtokey( int f, int n) ;
|
int bindtokey( int f, int n) ;
|
||||||
int unbindkey( int f, int n) ;
|
int unbindkey( int f, int n) ;
|
||||||
int desbind( int f, int n) ;
|
int desbind( int f, int n) ;
|
||||||
int startup( const char *fname) ;
|
int startup( const char *fname) ;
|
||||||
fn_t getbind( unsigned keycode) ;
|
fnp_t getbind( unsigned keycode) ;
|
||||||
fn_t fncmatch( char *) ;
|
const char *transbind( char *skey) ;
|
||||||
char *transbind( char *skey) ;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1283,7 +1283,7 @@ static void mlputc( unicode_t c) {
|
|||||||
*
|
*
|
||||||
* char *s; string to output
|
* char *s; string to output
|
||||||
*/
|
*/
|
||||||
void ostring( char *s) {
|
void ostring( const char *s) {
|
||||||
unsigned char c ;
|
unsigned char c ;
|
||||||
|
|
||||||
if( discmd)
|
if( discmd)
|
||||||
@ -1553,7 +1553,7 @@ void echoc( unicode_t c) {
|
|||||||
*
|
*
|
||||||
* char *s; string to output
|
* char *s; string to output
|
||||||
*/
|
*/
|
||||||
void echos( char *s) {
|
void echos( const char *s) {
|
||||||
unicode_t c ;
|
unicode_t c ;
|
||||||
|
|
||||||
if( disinp)
|
if( disinp)
|
||||||
|
@ -27,9 +27,9 @@ void movecursor( int row, int col) ;
|
|||||||
void mlerase( void) ;
|
void mlerase( void) ;
|
||||||
void vmlwrite( const char *fmt, va_list ap) ;
|
void vmlwrite( const char *fmt, va_list ap) ;
|
||||||
void mlwrite( const char *fmt, ...) ;
|
void mlwrite( const char *fmt, ...) ;
|
||||||
void ostring( char *s) ;
|
void ostring( const char *s) ;
|
||||||
void echoc( unicode_t c) ;
|
void echoc( unicode_t c) ;
|
||||||
void echos( char *s) ;
|
void echos( const char *s) ;
|
||||||
void rubout( void) ;
|
void rubout( void) ;
|
||||||
void getscreensize( int *widthp, int *heightp) ;
|
void getscreensize( int *widthp, int *heightp) ;
|
||||||
|
|
||||||
|
54
ebind.c
54
ebind.c
@ -34,19 +34,19 @@
|
|||||||
* characters of the command. This explains the funny location of the
|
* characters of the command. This explains the funny location of the
|
||||||
* control-X commands.
|
* control-X commands.
|
||||||
*/
|
*/
|
||||||
struct key_tab keytab[NBINDS] = {
|
key_tab keytab[ NBINDS] = {
|
||||||
{CONTROL | '?', backdel},
|
{CONTROL | '?', backdel},
|
||||||
{CONTROL | 'A', (fn_t) gotobol}
|
{CONTROL | 'A', (fnp_t) gotobol}
|
||||||
,
|
,
|
||||||
{CONTROL | 'B', (fn_t) backchar}
|
{CONTROL | 'B', (fnp_t) backchar}
|
||||||
,
|
,
|
||||||
{CONTROL | 'C', insspace}
|
{CONTROL | 'C', insspace}
|
||||||
,
|
,
|
||||||
{CONTROL | 'D', forwdel}
|
{CONTROL | 'D', forwdel}
|
||||||
,
|
,
|
||||||
{CONTROL | 'E', (fn_t) gotoeol}
|
{CONTROL | 'E', (fnp_t) gotoeol}
|
||||||
,
|
,
|
||||||
{CONTROL | 'F', (fn_t) forwchar}
|
{CONTROL | 'F', (fnp_t) forwchar}
|
||||||
,
|
,
|
||||||
{CONTROL | 'G', ctrlg}
|
{CONTROL | 'G', ctrlg}
|
||||||
,
|
,
|
||||||
@ -62,11 +62,11 @@ struct key_tab keytab[NBINDS] = {
|
|||||||
,
|
,
|
||||||
{CONTROL | 'M', insert_newline}
|
{CONTROL | 'M', insert_newline}
|
||||||
,
|
,
|
||||||
{CONTROL | 'N', (fn_t) forwline}
|
{CONTROL | 'N', (fnp_t) forwline}
|
||||||
,
|
,
|
||||||
{CONTROL | 'O', openline}
|
{CONTROL | 'O', openline}
|
||||||
,
|
,
|
||||||
{CONTROL | 'P', (fn_t) backline}
|
{CONTROL | 'P', (fnp_t) backline}
|
||||||
,
|
,
|
||||||
{CONTROL | 'Q', quote}
|
{CONTROL | 'Q', quote}
|
||||||
,
|
,
|
||||||
@ -74,11 +74,11 @@ struct key_tab keytab[NBINDS] = {
|
|||||||
,
|
,
|
||||||
{CONTROL | 'S', forwsearch}
|
{CONTROL | 'S', forwsearch}
|
||||||
,
|
,
|
||||||
{CONTROL | 'T', (fn_t) twiddle}
|
{CONTROL | 'T', (fnp_t) twiddle}
|
||||||
,
|
,
|
||||||
{CONTROL | 'U', unarg}
|
{CONTROL | 'U', unarg}
|
||||||
,
|
,
|
||||||
{CONTROL | 'V', (fn_t) forwpage}
|
{CONTROL | 'V', (fnp_t) forwpage}
|
||||||
,
|
,
|
||||||
{CONTROL | 'W', killregion}
|
{CONTROL | 'W', killregion}
|
||||||
,
|
,
|
||||||
@ -86,7 +86,7 @@ struct key_tab keytab[NBINDS] = {
|
|||||||
,
|
,
|
||||||
{CONTROL | 'Y', yank}
|
{CONTROL | 'Y', yank}
|
||||||
,
|
,
|
||||||
{CONTROL | 'Z', (fn_t) backpage}
|
{CONTROL | 'Z', (fnp_t) backpage}
|
||||||
,
|
,
|
||||||
{CONTROL | ']', metafn}
|
{CONTROL | ']', metafn}
|
||||||
,
|
,
|
||||||
@ -139,7 +139,7 @@ struct key_tab keytab[NBINDS] = {
|
|||||||
,
|
,
|
||||||
{CTLX | CONTROL | 'W', filewrite}
|
{CTLX | CONTROL | 'W', filewrite}
|
||||||
,
|
,
|
||||||
{CTLX | CONTROL | 'X', (fn_t) swapmark}
|
{CTLX | CONTROL | 'X', (fnp_t) swapmark}
|
||||||
,
|
,
|
||||||
{CTLX | CONTROL | 'Z', shrinkwind}
|
{CTLX | CONTROL | 'Z', shrinkwind}
|
||||||
,
|
,
|
||||||
@ -248,17 +248,17 @@ struct key_tab keytab[NBINDS] = {
|
|||||||
#endif
|
#endif
|
||||||
{META | CONTROL | 'Z', scrnextup}
|
{META | CONTROL | 'Z', scrnextup}
|
||||||
,
|
,
|
||||||
{META | ' ', (fn_t) setmark}
|
{META | ' ', (fnp_t) setmark}
|
||||||
,
|
,
|
||||||
{META | '?', help}
|
{META | '?', help}
|
||||||
,
|
,
|
||||||
{META | '!', reposition}
|
{META | '!', reposition}
|
||||||
,
|
,
|
||||||
{META | '.', (fn_t) setmark}
|
{META | '.', (fnp_t) setmark}
|
||||||
,
|
,
|
||||||
{META | '>', (fn_t) gotoeob}
|
{META | '>', (fnp_t) gotoeob}
|
||||||
,
|
,
|
||||||
{META | '<', (fn_t) gotobob}
|
{META | '<', (fnp_t) gotobob}
|
||||||
,
|
,
|
||||||
{META | '~', unmark}
|
{META | '~', unmark}
|
||||||
,
|
,
|
||||||
@ -309,7 +309,7 @@ struct key_tab keytab[NBINDS] = {
|
|||||||
#endif
|
#endif
|
||||||
{META | 'U', upperword}
|
{META | 'U', upperword}
|
||||||
,
|
,
|
||||||
{META | 'V', (fn_t) backpage}
|
{META | 'V', (fnp_t) backpage}
|
||||||
,
|
,
|
||||||
{META | 'W', copyregion}
|
{META | 'W', copyregion}
|
||||||
,
|
,
|
||||||
@ -319,33 +319,33 @@ struct key_tab keytab[NBINDS] = {
|
|||||||
,
|
,
|
||||||
|
|
||||||
#if VT220
|
#if VT220
|
||||||
{SPEC | '1', (fn_t) gotobob /* fisearch */}
|
{SPEC | '1', (fnp_t) gotobob /* fisearch */}
|
||||||
, /* VT220 keys */
|
, /* VT220 keys */
|
||||||
{SPEC | '2', yank}
|
{SPEC | '2', yank}
|
||||||
,
|
,
|
||||||
{SPEC | '3', forwdel /* killregion */}
|
{SPEC | '3', forwdel /* killregion */}
|
||||||
,
|
,
|
||||||
{SPEC | '4', (fn_t) gotoeob /* setmark */}
|
{SPEC | '4', (fnp_t) gotoeob /* setmark */}
|
||||||
,
|
,
|
||||||
{SPEC | '5', (fn_t) backpage}
|
{SPEC | '5', (fnp_t) backpage}
|
||||||
,
|
,
|
||||||
{SPEC | '6', (fn_t) forwpage}
|
{SPEC | '6', (fnp_t) forwpage}
|
||||||
,
|
,
|
||||||
{SPEC | 'A', (fn_t) backline}
|
{SPEC | 'A', (fnp_t) backline}
|
||||||
,
|
,
|
||||||
{SPEC | 'B', (fn_t) forwline}
|
{SPEC | 'B', (fnp_t) forwline}
|
||||||
,
|
,
|
||||||
{SPEC | 'C', (fn_t) forwchar}
|
{SPEC | 'C', (fnp_t) forwchar}
|
||||||
,
|
,
|
||||||
{SPEC | 'D', (fn_t) backchar}
|
{SPEC | 'D', (fnp_t) backchar}
|
||||||
,
|
,
|
||||||
{SPEC | 'c', metafn}
|
{SPEC | 'c', metafn}
|
||||||
,
|
,
|
||||||
{SPEC | 'd', (fn_t) backchar}
|
{SPEC | 'd', (fnp_t) backchar}
|
||||||
,
|
,
|
||||||
{SPEC | 'e', (fn_t) forwline}
|
{SPEC | 'e', (fnp_t) forwline}
|
||||||
,
|
,
|
||||||
{SPEC | 'f', (fn_t) gotobob}
|
{SPEC | 'f', (fnp_t) gotobob}
|
||||||
,
|
,
|
||||||
{SPEC | 'h', help}
|
{SPEC | 'h', help}
|
||||||
,
|
,
|
||||||
|
18
ebind.h
18
ebind.h
@ -1,9 +1,15 @@
|
|||||||
|
#ifndef _EBIND_H_
|
||||||
|
#define _EBIND_H_
|
||||||
|
|
||||||
|
#include "fnp_t.h"
|
||||||
|
|
||||||
/* Structure for the table of initial key bindings. */
|
/* Structure for the table of initial key bindings. */
|
||||||
struct key_tab {
|
typedef struct key_tab {
|
||||||
unsigned k_code ; /* Key code */
|
unsigned k_code ; /* Key code */
|
||||||
int (*k_fp)( int, int) ; /* Routine to handle it */
|
fnp_t k_fp ; /* Routine to handle it */
|
||||||
} ;
|
} key_tab ;
|
||||||
|
|
||||||
#define NBINDS 256 /* max # of bound keys */
|
#define NBINDS 256 /* max # of bound keys */
|
||||||
extern struct key_tab keytab[ NBINDS] ; /* key bind to functions table */
|
extern key_tab keytab[ NBINDS] ; /* key bind to functions table */
|
||||||
|
|
||||||
|
#endif
|
||||||
|
35
exec.c
35
exec.c
@ -85,22 +85,23 @@ static int macarg( char *tok, int toksz) ;
|
|||||||
/*
|
/*
|
||||||
* Execute a named command even if it is not bound.
|
* Execute a named command even if it is not bound.
|
||||||
*/
|
*/
|
||||||
int namedcmd(int f, int n)
|
int namedcmd( int f, int n) {
|
||||||
{
|
|
||||||
fn_t kfunc; /* ptr to the requexted function to bind to */
|
|
||||||
|
|
||||||
/* prompt the user to type a named command */
|
/* prompt the user to type a named command */
|
||||||
mlwrite(": ");
|
mlwrite(": ");
|
||||||
|
|
||||||
/* and now get the function name to execute */
|
/* and now get the function name to execute */
|
||||||
kfunc = getname();
|
const name_bind *nbp = getname() ;
|
||||||
|
fnp_t kfunc = nbp->n_func ;
|
||||||
if (kfunc == NULL) {
|
if (kfunc == NULL) {
|
||||||
mlwrite("(No such function)");
|
mlwrite("(No such function)");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( nbp->tag && (curbp->b_mode & MDVIEW))
|
||||||
|
return rdonly() ;
|
||||||
|
|
||||||
/* and then execute the command */
|
/* and then execute the command */
|
||||||
return kfunc(f, n);
|
return kfunc(f, n) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int docmd( char *cline) ;
|
static int docmd( char *cline) ;
|
||||||
@ -145,7 +146,6 @@ int execcmd( int f, int n) {
|
|||||||
static int docmd( char *cline) {
|
static int docmd( char *cline) {
|
||||||
int f; /* default argument flag */
|
int f; /* default argument flag */
|
||||||
int n; /* numeric repeat value */
|
int n; /* numeric repeat value */
|
||||||
fn_t fnc; /* function to execute */
|
|
||||||
int status; /* return status of function */
|
int status; /* return status of function */
|
||||||
boolean oldcle ; /* old contents of clexec flag */
|
boolean oldcle ; /* old contents of clexec flag */
|
||||||
char *oldestr; /* original exec string */
|
char *oldestr; /* original exec string */
|
||||||
@ -187,19 +187,26 @@ static int docmd( char *cline) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* and match the token to see if it exists */
|
/* and match the token to see if it exists */
|
||||||
if ((fnc = fncmatch(tkn)) == NULL) {
|
const name_bind *nbp = fncmatch( tkn) ;
|
||||||
|
fnp_t fnc = nbp->n_func ;
|
||||||
|
if( fnc == NULL) {
|
||||||
mlwrite("(No such Function)");
|
mlwrite("(No such Function)");
|
||||||
execstr = oldestr;
|
execstr = oldestr;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* save the arguments and go execute the command */
|
if( nbp->tag && (curbp->b_mode & MDVIEW))
|
||||||
oldcle = clexec; /* save old clexec flag */
|
status = rdonly() ;
|
||||||
clexec = TRUE; /* in cline execution */
|
else {
|
||||||
status = (*fnc) (f, n); /* call the function */
|
/* save the arguments and go execute the command */
|
||||||
|
oldcle = clexec; /* save old clexec flag */
|
||||||
|
clexec = TRUE; /* in cline execution */
|
||||||
|
status = fnc( f, n) ; /* call the function */
|
||||||
|
clexec = oldcle; /* restore clexec flag */
|
||||||
|
execstr = oldestr;
|
||||||
|
}
|
||||||
|
|
||||||
cmdstatus = status; /* save the status */
|
cmdstatus = status; /* save the status */
|
||||||
clexec = oldcle; /* restore clexec flag */
|
|
||||||
execstr = oldestr;
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
12
execute.c
12
execute.c
@ -210,13 +210,17 @@ static void fmatch( int ch) {
|
|||||||
*/
|
*/
|
||||||
int execute( int c, int f, int n) {
|
int execute( int c, int f, int n) {
|
||||||
int status ;
|
int status ;
|
||||||
fn_t execfunc ;
|
|
||||||
|
|
||||||
/* if the keystroke is a bound function...do it */
|
/* if the keystroke is a bound function...do it */
|
||||||
execfunc = getbind( c) ;
|
fnp_t execfunc = getbind( c) ;
|
||||||
if( execfunc != NULL) {
|
if( execfunc != NULL) {
|
||||||
thisflag = 0 ;
|
thisflag = 0 ;
|
||||||
status = execfunc( f, n) ;
|
const name_bind *nbp = getnamebind( execfunc) ;
|
||||||
|
if( nbp->tag && curbp->b_mode & MDVIEW)
|
||||||
|
status = rdonly() ;
|
||||||
|
else
|
||||||
|
status = execfunc( f, n) ;
|
||||||
|
|
||||||
lastflag = thisflag ;
|
lastflag = thisflag ;
|
||||||
return status ;
|
return status ;
|
||||||
}
|
}
|
||||||
@ -330,7 +334,7 @@ void kbd_loop( void) {
|
|||||||
newc = getcmd() ;
|
newc = getcmd() ;
|
||||||
update( FALSE) ;
|
update( FALSE) ;
|
||||||
do {
|
do {
|
||||||
fn_t execfunc ;
|
fnp_t execfunc ;
|
||||||
|
|
||||||
if( c == newc
|
if( c == newc
|
||||||
&& (execfunc = getbind( c)) != NULL
|
&& (execfunc = getbind( c)) != NULL
|
||||||
|
7
fnp_t.h
Normal file
7
fnp_t.h
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#ifndef __FNP_T_H__
|
||||||
|
#define __FNP_T_H__
|
||||||
|
|
||||||
|
/* Generic uEMACS function pointer type */
|
||||||
|
typedef int (*fnp_t)( int, int) ;
|
||||||
|
|
||||||
|
#endif
|
46
input.c
46
input.c
@ -157,17 +157,45 @@ int ectoc( int c) {
|
|||||||
return c ;
|
return c ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* match fname to a function in the names table
|
||||||
|
* and return any match or NULL if none
|
||||||
|
*
|
||||||
|
* char *fname; name to attempt to match
|
||||||
|
*/
|
||||||
|
const name_bind *fncmatch( char *fname) {
|
||||||
|
const name_bind *ffp ; /* pointer to entry in name binding table */
|
||||||
|
|
||||||
|
/* scan through the table, returning any match */
|
||||||
|
for( ffp = names ; ffp->n_func != NULL ; ffp++)
|
||||||
|
if( strcmp( fname, ffp->n_name) == 0)
|
||||||
|
break ;
|
||||||
|
|
||||||
|
return ffp ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const name_bind *getnamebind( fnp_t func) {
|
||||||
|
const name_bind *nptr ; /* pointer into the name binding table */
|
||||||
|
|
||||||
|
/* skim through the table, looking for a match */
|
||||||
|
for( nptr = names ; nptr->n_func != NULL ; nptr++)
|
||||||
|
if (nptr->n_func == func)
|
||||||
|
break ;
|
||||||
|
|
||||||
|
return nptr ;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get a command name from the command line. Command completion means
|
* get a command name from the command line. Command completion means
|
||||||
* 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.
|
||||||
*/
|
*/
|
||||||
fn_t getname(void)
|
const name_bind *getname( void) {
|
||||||
{
|
|
||||||
int cpos; /* current column on screen output */
|
int cpos; /* current column on screen output */
|
||||||
struct name_bind *ffp; /* first ptr to entry in name binding table */
|
const name_bind *ffp; /* first ptr to entry in name binding table */
|
||||||
struct name_bind *cffp; /* current ptr to entry in name binding table */
|
const name_bind *cffp; /* current ptr to entry in name binding table */
|
||||||
struct name_bind *lffp; /* last ptr to entry in name binding table */
|
const name_bind *lffp; /* last ptr to entry in name binding table */
|
||||||
char buf[NSTRING]; /* buffer to hold tentative command name */
|
char buf[NSTRING]; /* buffer to hold tentative command name */
|
||||||
|
|
||||||
/* starting at the beginning of the string buffer */
|
/* starting at the beginning of the string buffer */
|
||||||
@ -177,7 +205,7 @@ fn_t getname(void)
|
|||||||
if (clexec) {
|
if (clexec) {
|
||||||
if( TRUE != gettokval( buf, sizeof buf))
|
if( TRUE != gettokval( buf, sizeof buf))
|
||||||
return NULL;
|
return NULL;
|
||||||
return fncmatch(&buf[0]);
|
return fncmatch( buf) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* build a name string from the keyboard */
|
/* build a name string from the keyboard */
|
||||||
@ -191,7 +219,7 @@ fn_t getname(void)
|
|||||||
buf[cpos] = 0;
|
buf[cpos] = 0;
|
||||||
|
|
||||||
/* and match it off */
|
/* and match it off */
|
||||||
return fncmatch(&buf[0]);
|
return fncmatch( buf) ;
|
||||||
|
|
||||||
} else if (c == ectoc(abortc)) { /* Bell, abort */
|
} else if (c == ectoc(abortc)) { /* Bell, abort */
|
||||||
ctrlg(FALSE, 0);
|
ctrlg(FALSE, 0);
|
||||||
@ -217,7 +245,7 @@ fn_t getname(void)
|
|||||||
/* <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< */
|
/* <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< */
|
||||||
/* attempt a completion */
|
/* attempt a completion */
|
||||||
buf[cpos] = 0; /* terminate it for us */
|
buf[cpos] = 0; /* terminate it for us */
|
||||||
ffp = &names[0]; /* scan for matches */
|
ffp = names ; /* scan for matches */
|
||||||
while (ffp->n_func != NULL) {
|
while (ffp->n_func != NULL) {
|
||||||
if (strncmp(buf, ffp->n_name, strlen(buf))
|
if (strncmp(buf, ffp->n_name, strlen(buf))
|
||||||
== 0) {
|
== 0) {
|
||||||
@ -229,7 +257,7 @@ fn_t getname(void)
|
|||||||
/* no...we match, print it */
|
/* no...we match, print it */
|
||||||
echos( ffp->n_name + cpos) ;
|
echos( ffp->n_name + cpos) ;
|
||||||
TTflush();
|
TTflush();
|
||||||
return ffp->n_func;
|
return ffp ;
|
||||||
} else {
|
} else {
|
||||||
/* << << << << << << << << << << << << << << << << << */
|
/* << << << << << << << << << << << << << << << << << */
|
||||||
/* try for a partial match against the list */
|
/* try for a partial match against the list */
|
||||||
|
9
input.h
9
input.h
@ -1,7 +1,7 @@
|
|||||||
#ifndef _INPUT_H_
|
#ifndef _INPUT_H_
|
||||||
#define _INPUT_H_
|
#define _INPUT_H_
|
||||||
|
|
||||||
#include "bind.h"
|
#include "names.h"
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -26,7 +26,12 @@ int mlyesno( const char *prompt) ;
|
|||||||
int newmlarg( char **outbufref, const char *prompt, int size) ;
|
int newmlarg( char **outbufref, const char *prompt, int size) ;
|
||||||
int newmlargt( char **outbufref, const char *prompt, int size) ;
|
int newmlargt( char **outbufref, const char *prompt, int size) ;
|
||||||
int ectoc( int c) ;
|
int ectoc( int c) ;
|
||||||
fn_t getname( void) ;
|
|
||||||
|
/* Look up in names to function association table */
|
||||||
|
const name_bind *fncmatch( char *) ;
|
||||||
|
const name_bind *getname( void) ;
|
||||||
|
const name_bind *getnamebind( fnp_t func) ;
|
||||||
|
|
||||||
int tgetc( void) ;
|
int tgetc( void) ;
|
||||||
int get1key( void) ;
|
int get1key( void) ;
|
||||||
int getcmd( void) ;
|
int getcmd( void) ;
|
||||||
|
344
names.c
344
names.c
@ -8,8 +8,6 @@
|
|||||||
* function.
|
* function.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "basic.h"
|
#include "basic.h"
|
||||||
#include "bind.h"
|
#include "bind.h"
|
||||||
#include "bindable.h"
|
#include "bindable.h"
|
||||||
@ -27,209 +25,211 @@
|
|||||||
#include "window.h"
|
#include "window.h"
|
||||||
#include "word.h"
|
#include "word.h"
|
||||||
|
|
||||||
struct name_bind names[] = {
|
const name_bind names[] = {
|
||||||
{"abort-command", ctrlg},
|
{"abort-command", ctrlg, 0} ,
|
||||||
{"add-mode", setemode},
|
{"add-mode", setemode, 0} ,
|
||||||
{"add-global-mode", setgmode},
|
{"add-global-mode", setgmode, 0} ,
|
||||||
#if APROP
|
#if APROP
|
||||||
{"apropos", apro},
|
{"apropos", apro, 0} ,
|
||||||
#endif
|
#endif
|
||||||
{"backward-character", (fn_t) backchar},
|
{"backward-character", (fnp_t) backchar, 0} ,
|
||||||
{"begin-macro", ctlxlp},
|
{"begin-macro", ctlxlp, 0} ,
|
||||||
{"beginning-of-file", (fn_t) gotobob},
|
{"beginning-of-file", (fnp_t) gotobob, 0} ,
|
||||||
{"beginning-of-line", (fn_t) gotobol},
|
{"beginning-of-line", (fnp_t) gotobol, 0} ,
|
||||||
{"bind-to-key", bindtokey},
|
{"bind-to-key", bindtokey, 0} ,
|
||||||
{"buffer-position", showcpos},
|
{"buffer-position", showcpos, 0} ,
|
||||||
{"case-region-lower", lowerregion},
|
{"case-region-lower", lowerregion, 0} ,
|
||||||
{"case-region-upper", upperregion},
|
{"case-region-upper", upperregion, 0} ,
|
||||||
{"case-word-capitalize", capword},
|
{"case-word-capitalize", capword, 0} ,
|
||||||
{"case-word-lower", lowerword},
|
{"case-word-lower", lowerword, 0} ,
|
||||||
{"case-word-upper", upperword},
|
{"case-word-upper", upperword, 0} ,
|
||||||
{"change-file-name", filename},
|
{"change-file-name", filename, 0} ,
|
||||||
{"change-screen-size", newsize},
|
{"change-screen-size", newsize, 0} ,
|
||||||
{"change-screen-width", newwidth},
|
{"change-screen-width", newwidth, 0} ,
|
||||||
{"clear-and-redraw", redraw},
|
{"clear-and-redraw", redraw, 0} ,
|
||||||
{"clear-message-line", clrmes},
|
{"clear-message-line", clrmes, 0} ,
|
||||||
{"copy-region", copyregion},
|
{"copy-region", copyregion, 0} ,
|
||||||
#if WORDPRO
|
#if WORDPRO
|
||||||
{"count-words", wordcount},
|
{"count-words", wordcount, 0} ,
|
||||||
#endif
|
#endif
|
||||||
{"ctlx-prefix", cex},
|
{"ctlx-prefix", cex, 0} ,
|
||||||
{"delete-blank-lines", deblank},
|
{"delete-blank-lines", deblank, 0} ,
|
||||||
{"delete-buffer", killbuffer},
|
{"delete-buffer", killbuffer, 0} ,
|
||||||
{"delete-mode", delmode},
|
{"delete-mode", delmode, 0} ,
|
||||||
{"delete-global-mode", delgmode},
|
{"delete-global-mode", delgmode, 0} ,
|
||||||
{"delete-next-character", forwdel},
|
{"delete-next-character", forwdel, 0} ,
|
||||||
{"delete-next-word", delfword},
|
{"delete-next-word", delfword, 0} ,
|
||||||
{"delete-other-windows", onlywind},
|
{"delete-other-windows", onlywind, 0} ,
|
||||||
{"delete-previous-character", backdel},
|
{"delete-previous-character", backdel, 0} ,
|
||||||
{"delete-previous-word", delbword},
|
{"delete-previous-word", delbword, 0} ,
|
||||||
{"delete-window", delwind},
|
{"delete-window", delwind, 0} ,
|
||||||
{"describe-bindings", desbind},
|
{"describe-bindings", desbind, 0} ,
|
||||||
{"describe-key", deskey},
|
{"describe-key", deskey, 0} ,
|
||||||
#if AEDIT
|
#if AEDIT
|
||||||
{"detab-line", detab},
|
{"detab-line", detab, 0} ,
|
||||||
#endif
|
#endif
|
||||||
{"end-macro", ctlxrp},
|
{"end-macro", ctlxrp, 0} ,
|
||||||
{"end-of-file", (fn_t) gotoeob},
|
{"end-of-file", (fnp_t) gotoeob, 0} ,
|
||||||
{"end-of-line", (fn_t) gotoeol},
|
{"end-of-line", (fnp_t) gotoeol, 0} ,
|
||||||
#if AEDIT
|
#if AEDIT
|
||||||
{"entab-line", entab},
|
{"entab-line", entab, 0} ,
|
||||||
#endif
|
#endif
|
||||||
{"exchange-point-and-mark", (fn_t) swapmark},
|
{"exchange-point-and-mark", (fnp_t) swapmark, 0} ,
|
||||||
{"execute-buffer", execbuf},
|
{"execute-buffer", execbuf, 0} ,
|
||||||
{"execute-command-line", execcmd},
|
{"execute-command-line", execcmd, 0} ,
|
||||||
{"execute-file", execfile},
|
{"execute-file", execfile, 0} ,
|
||||||
{"execute-macro", ctlxe},
|
{"execute-macro", ctlxe, 0} ,
|
||||||
{"execute-macro-1", cbuf1},
|
{"execute-macro-1", cbuf1, 0} ,
|
||||||
{"execute-macro-2", cbuf2},
|
{"execute-macro-2", cbuf2, 0} ,
|
||||||
{"execute-macro-3", cbuf3},
|
{"execute-macro-3", cbuf3, 0} ,
|
||||||
{"execute-macro-4", cbuf4},
|
{"execute-macro-4", cbuf4, 0} ,
|
||||||
{"execute-macro-5", cbuf5},
|
{"execute-macro-5", cbuf5, 0} ,
|
||||||
{"execute-macro-6", cbuf6},
|
{"execute-macro-6", cbuf6, 0} ,
|
||||||
{"execute-macro-7", cbuf7},
|
{"execute-macro-7", cbuf7, 0} ,
|
||||||
{"execute-macro-8", cbuf8},
|
{"execute-macro-8", cbuf8, 0} ,
|
||||||
{"execute-macro-9", cbuf9},
|
{"execute-macro-9", cbuf9, 0} ,
|
||||||
{"execute-macro-10", cbuf10},
|
{"execute-macro-10", cbuf10, 0} ,
|
||||||
{"execute-macro-11", cbuf11},
|
{"execute-macro-11", cbuf11, 0} ,
|
||||||
{"execute-macro-12", cbuf12},
|
{"execute-macro-12", cbuf12, 0} ,
|
||||||
{"execute-macro-13", cbuf13},
|
{"execute-macro-13", cbuf13, 0} ,
|
||||||
{"execute-macro-14", cbuf14},
|
{"execute-macro-14", cbuf14, 0} ,
|
||||||
{"execute-macro-15", cbuf15},
|
{"execute-macro-15", cbuf15, 0} ,
|
||||||
{"execute-macro-16", cbuf16},
|
{"execute-macro-16", cbuf16, 0} ,
|
||||||
{"execute-macro-17", cbuf17},
|
{"execute-macro-17", cbuf17, 0} ,
|
||||||
{"execute-macro-18", cbuf18},
|
{"execute-macro-18", cbuf18, 0} ,
|
||||||
{"execute-macro-19", cbuf19},
|
{"execute-macro-19", cbuf19, 0} ,
|
||||||
{"execute-macro-20", cbuf20},
|
{"execute-macro-20", cbuf20, 0} ,
|
||||||
{"execute-macro-21", cbuf21},
|
{"execute-macro-21", cbuf21, 0} ,
|
||||||
{"execute-macro-22", cbuf22},
|
{"execute-macro-22", cbuf22, 0} ,
|
||||||
{"execute-macro-23", cbuf23},
|
{"execute-macro-23", cbuf23, 0} ,
|
||||||
{"execute-macro-24", cbuf24},
|
{"execute-macro-24", cbuf24, 0} ,
|
||||||
{"execute-macro-25", cbuf25},
|
{"execute-macro-25", cbuf25, 0} ,
|
||||||
{"execute-macro-26", cbuf26},
|
{"execute-macro-26", cbuf26, 0} ,
|
||||||
{"execute-macro-27", cbuf27},
|
{"execute-macro-27", cbuf27, 0} ,
|
||||||
{"execute-macro-28", cbuf28},
|
{"execute-macro-28", cbuf28, 0} ,
|
||||||
{"execute-macro-29", cbuf29},
|
{"execute-macro-29", cbuf29, 0} ,
|
||||||
{"execute-macro-30", cbuf30},
|
{"execute-macro-30", cbuf30, 0} ,
|
||||||
{"execute-macro-31", cbuf31},
|
{"execute-macro-31", cbuf31, 0} ,
|
||||||
{"execute-macro-32", cbuf32},
|
{"execute-macro-32", cbuf32, 0} ,
|
||||||
{"execute-macro-33", cbuf33},
|
{"execute-macro-33", cbuf33, 0} ,
|
||||||
{"execute-macro-34", cbuf34},
|
{"execute-macro-34", cbuf34, 0} ,
|
||||||
{"execute-macro-35", cbuf35},
|
{"execute-macro-35", cbuf35, 0} ,
|
||||||
{"execute-macro-36", cbuf36},
|
{"execute-macro-36", cbuf36, 0} ,
|
||||||
{"execute-macro-37", cbuf37},
|
{"execute-macro-37", cbuf37, 0} ,
|
||||||
{"execute-macro-38", cbuf38},
|
{"execute-macro-38", cbuf38, 0} ,
|
||||||
{"execute-macro-39", cbuf39},
|
{"execute-macro-39", cbuf39, 0} ,
|
||||||
{"execute-macro-40", cbuf40},
|
{"execute-macro-40", cbuf40, 0} ,
|
||||||
{"execute-named-command", namedcmd},
|
{"execute-named-command", namedcmd, 0} ,
|
||||||
#if PROC
|
#if PROC
|
||||||
{"execute-procedure", execproc},
|
{"execute-procedure", execproc, 0} ,
|
||||||
#endif
|
#endif
|
||||||
{"execute-program", execprg},
|
{"execute-program", execprg, 0} ,
|
||||||
{"exit-emacs", quit},
|
{"exit-emacs", quit, 0} ,
|
||||||
#if WORDPRO
|
#if WORDPRO
|
||||||
{"fill-paragraph", fillpara},
|
{"fill-paragraph", fillpara, 1} ,
|
||||||
#endif
|
#endif
|
||||||
{"filter-buffer", filter_buffer},
|
{"filter-buffer", filter_buffer, 0} ,
|
||||||
{"find-file", filefind},
|
{"find-file", filefind, 0} ,
|
||||||
{"forward-character", (fn_t) forwchar},
|
{"forward-character", (fnp_t) forwchar, 0} ,
|
||||||
{"goto-line", gotoline},
|
{"goto-line", gotoline, 0} ,
|
||||||
#if CFENCE
|
#if CFENCE
|
||||||
{"goto-matching-fence", getfence},
|
{"goto-matching-fence", getfence, 0} ,
|
||||||
#endif
|
#endif
|
||||||
{"grow-window", enlargewind},
|
{"grow-window", enlargewind, 0} ,
|
||||||
{"handle-tab", insert_tab},
|
{"handle-tab", insert_tab, 0} ,
|
||||||
{"hunt-forward", forwhunt},
|
{"hunt-forward", forwhunt, 0} ,
|
||||||
{"hunt-backward", backhunt},
|
{"hunt-backward", backhunt, 0} ,
|
||||||
{"help", help},
|
{"help", help, 0} ,
|
||||||
{"i-shell", spawncli},
|
{"i-shell", spawncli, 0} ,
|
||||||
#if ISRCH
|
#if ISRCH
|
||||||
{"incremental-search", fisearch},
|
{"incremental-search", fisearch, 0} ,
|
||||||
#endif
|
#endif
|
||||||
{"insert-file", insfile},
|
{"insert-file", insfile, 0} ,
|
||||||
{"insert-space", insspace},
|
{"insert-space", insspace, 0} ,
|
||||||
{"insert-string", istring},
|
{"insert-string", istring, 1} ,
|
||||||
#if WORDPRO
|
#if WORDPRO
|
||||||
#if PKCODE
|
#if PKCODE
|
||||||
{"justify-paragraph", justpara},
|
{"justify-paragraph", justpara, 1} ,
|
||||||
#endif
|
#endif
|
||||||
{"kill-paragraph", killpara},
|
{"kill-paragraph", killpara, 1} ,
|
||||||
#endif
|
#endif
|
||||||
{"kill-region", killregion},
|
{"kill-region", killregion, 0} ,
|
||||||
{"kill-to-end-of-line", killtext},
|
{"kill-to-end-of-line", killtext, 0} ,
|
||||||
{"list-buffers", listbuffers},
|
{"list-buffers", listbuffers, 0} ,
|
||||||
{"meta-prefix", metafn},
|
{"meta-prefix", metafn, 0} ,
|
||||||
{"move-window-down", mvdnwind},
|
{"move-window-down", mvdnwind, 0} ,
|
||||||
{"move-window-up", mvupwind},
|
{"move-window-up", mvupwind, 0} ,
|
||||||
{"name-buffer", namebuffer},
|
{"name-buffer", namebuffer, 0} ,
|
||||||
{"newline", insert_newline},
|
{"newline", insert_newline, 0} ,
|
||||||
{"newline-and-indent", indent},
|
{"newline-and-indent", indent, 0} ,
|
||||||
{"next-buffer", nextbuffer},
|
{"next-buffer", nextbuffer, 0} ,
|
||||||
{"next-line", (fn_t) forwline},
|
{"next-line", (fnp_t) forwline, 0} ,
|
||||||
{"next-page", (fn_t) forwpage},
|
{"next-page", (fnp_t) forwpage, 0} ,
|
||||||
#if WORDPRO
|
#if WORDPRO
|
||||||
{"next-paragraph", gotoeop},
|
{"next-paragraph", gotoeop, 0} ,
|
||||||
#endif
|
#endif
|
||||||
{"next-window", nextwind},
|
{"next-window", nextwind, 0} ,
|
||||||
{"next-word", forwword},
|
{"next-word", forwword, 0} ,
|
||||||
{"nop", nullproc},
|
{"nop", nullproc, 0} ,
|
||||||
{"open-line", openline},
|
{"open-line", openline, 0} ,
|
||||||
{"overwrite-string", ovstring},
|
{"overwrite-string", ovstring, 0} ,
|
||||||
{"pipe-command", pipecmd},
|
{"pipe-command", pipecmd, 0} ,
|
||||||
{"previous-line", (fn_t) backline},
|
{"previous-line", (fnp_t) backline, 0} ,
|
||||||
{"previous-page", (fn_t) backpage},
|
{"previous-page", (fnp_t) backpage, 0} ,
|
||||||
#if WORDPRO
|
#if WORDPRO
|
||||||
{"previous-paragraph", gotobop},
|
{"previous-paragraph", gotobop, 0} ,
|
||||||
#endif
|
#endif
|
||||||
{"previous-window", prevwind},
|
{"previous-window", prevwind, 0} ,
|
||||||
{"previous-word", backword},
|
{"previous-word", backword, 0} ,
|
||||||
{"query-replace-string", qreplace},
|
{"query-replace-string", qreplace, 0} ,
|
||||||
{"quick-exit", quickexit},
|
{"quick-exit", quickexit, 0} ,
|
||||||
{"quote-character", quote},
|
{"quote-character", quote, 0} ,
|
||||||
{"read-file", fileread},
|
{"read-file", fileread, 0} ,
|
||||||
{"redraw-display", reposition},
|
{"redraw-display", reposition, 0} ,
|
||||||
{"resize-window", resize},
|
{"resize-window", resize, 0} ,
|
||||||
{"restore-window", restwnd},
|
{"restore-window", restwnd, 0} ,
|
||||||
{"replace-string", sreplace},
|
{"replace-string", sreplace, 0} ,
|
||||||
#if ISRCH
|
#if ISRCH
|
||||||
{"reverse-incremental-search", risearch},
|
{"reverse-incremental-search", risearch, 0} ,
|
||||||
#endif
|
#endif
|
||||||
#if PROC
|
#if PROC
|
||||||
{"run", execproc},
|
{"run", execproc, 0} ,
|
||||||
#endif
|
#endif
|
||||||
{"save-file", filesave},
|
{"save-file", filesave, 0} ,
|
||||||
{"save-window", savewnd},
|
{"save-window", savewnd, 0} ,
|
||||||
{"scroll-next-up", scrnextup},
|
{"scroll-next-up", scrnextup, 0} ,
|
||||||
{"scroll-next-down", scrnextdw},
|
{"scroll-next-down", scrnextdw, 0} ,
|
||||||
{"search-forward", forwsearch},
|
{"search-forward", forwsearch, 0} ,
|
||||||
{"search-reverse", backsearch},
|
{"search-reverse", backsearch, 0} ,
|
||||||
{"select-buffer", usebuffer},
|
{"select-buffer", usebuffer, 0} ,
|
||||||
{"set", setvar},
|
{"set", setvar, 0} ,
|
||||||
{"set-fill-column", setfillcol},
|
{"set-fill-column", setfillcol, 0} ,
|
||||||
{"set-mark", (fn_t) setmark},
|
{"set-mark", (fnp_t) setmark, 0} ,
|
||||||
{"shell-command", spawn},
|
{"shell-command", spawn, 0} ,
|
||||||
{"shrink-window", shrinkwind},
|
{"shrink-window", shrinkwind, 0} ,
|
||||||
{"split-current-window", splitwind},
|
{"split-current-window", splitwind, 0} ,
|
||||||
{"store-macro", storemac},
|
{"store-macro", storemac, 0} ,
|
||||||
#if PROC
|
#if PROC
|
||||||
{"store-procedure", storeproc},
|
{"store-procedure", storeproc, 0} ,
|
||||||
#endif
|
#endif
|
||||||
#if BSD | SVR4
|
#if BSD | SVR4
|
||||||
{"suspend-emacs", bktoshell},
|
{"suspend-emacs", bktoshell, 0} ,
|
||||||
#endif
|
#endif
|
||||||
{"transpose-characters", (fn_t) twiddle},
|
{"transpose-characters", (fnp_t) twiddle, 0} ,
|
||||||
#if AEDIT
|
#if AEDIT
|
||||||
{"trim-line", trim},
|
{"trim-line", trim, 0} ,
|
||||||
#endif
|
#endif
|
||||||
{"unbind-key", unbindkey},
|
{"unbind-key", unbindkey, 0} ,
|
||||||
{"universal-argument", unarg},
|
{"universal-argument", unarg, 0} ,
|
||||||
{"unmark-buffer", unmark},
|
{"unmark-buffer", unmark, 0} ,
|
||||||
{"update-screen", upscreen},
|
{"update-screen", upscreen, 0} ,
|
||||||
{"view-file", viewfile},
|
{"view-file", viewfile, 0} ,
|
||||||
{"wrap-word", wrapword},
|
{"wrap-word", wrapword, 0} ,
|
||||||
{"write-file", filewrite},
|
{"write-file", filewrite, 0} ,
|
||||||
{"write-message", writemsg},
|
{"write-message", writemsg, 0} ,
|
||||||
{"yank", yank},
|
{"yank", yank, 0} ,
|
||||||
|
|
||||||
{"", NULL}
|
{"", NULL, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* end of names.c */
|
||||||
|
17
names.h
17
names.h
@ -1,8 +1,15 @@
|
|||||||
|
#ifndef _NAMES_H_
|
||||||
|
#define _NAMES_H_
|
||||||
|
|
||||||
|
#include "fnp_t.h"
|
||||||
|
|
||||||
/* Structure for the name binding table. */
|
/* Structure for the name binding table. */
|
||||||
struct name_bind {
|
typedef struct name_bind {
|
||||||
char *n_name; /* name of function key */
|
const char *n_name ; /* name of function key */
|
||||||
int (*n_func)(int, int); /* function name is bound to */
|
fnp_t n_func ; /* function name is bound to */
|
||||||
};
|
char tag ; /* view mode compatibility tag */
|
||||||
|
} name_bind ;
|
||||||
|
|
||||||
extern struct name_bind names[];/* name to function table */
|
extern const name_bind names[] ; /* name to function table */
|
||||||
|
|
||||||
|
#endif
|
||||||
|
15
word.c
15
word.c
@ -10,6 +10,7 @@
|
|||||||
* Modified by Petri Kutvonen
|
* Modified by Petri Kutvonen
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h> /* malloc, free */
|
#include <stdlib.h> /* malloc, free */
|
||||||
#include <string.h> /* memcpy */
|
#include <string.h> /* memcpy */
|
||||||
@ -358,8 +359,8 @@ static int parafillnjustify( int f, int n, int justify_f) {
|
|||||||
int dotflag = 0 ; /* was the last char a period? */
|
int dotflag = 0 ; /* was the last char a period? */
|
||||||
int leftmarg = 0 ; /* left marginal */
|
int leftmarg = 0 ; /* left marginal */
|
||||||
|
|
||||||
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
|
assert( !(curbp->b_mode & MDVIEW)) ;
|
||||||
return rdonly(); /* we are in read only mode */
|
|
||||||
if (fillcol == 0) { /* no fill column set */
|
if (fillcol == 0) { /* no fill column set */
|
||||||
mloutstr( "No fill column set") ;
|
mloutstr( "No fill column set") ;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -507,8 +508,6 @@ int justpara( int f, int n) {
|
|||||||
*/
|
*/
|
||||||
int killpara(int f, int n)
|
int killpara(int f, int n)
|
||||||
{
|
{
|
||||||
int status; /* returned status of functions */
|
|
||||||
|
|
||||||
while (n--) { /* for each paragraph to delete */
|
while (n--) { /* for each paragraph to delete */
|
||||||
|
|
||||||
/* mark out the end and beginning of the para to delete */
|
/* mark out the end and beginning of the para to delete */
|
||||||
@ -523,13 +522,15 @@ int killpara(int f, int n)
|
|||||||
curwp->w_doto = 0; /* force us to the beginning of line */
|
curwp->w_doto = 0; /* force us to the beginning of line */
|
||||||
|
|
||||||
/* and delete it */
|
/* and delete it */
|
||||||
if ((status = killregion(FALSE, 1)) != TRUE)
|
int status = killregion( FALSE, 1) ;
|
||||||
return status;
|
if( status != TRUE)
|
||||||
|
return status ;
|
||||||
|
|
||||||
/* and clean up the 2 extra lines */
|
/* and clean up the 2 extra lines */
|
||||||
ldelete(2L, TRUE);
|
ldelete(2L, TRUE);
|
||||||
}
|
}
|
||||||
return TRUE;
|
|
||||||
|
return TRUE ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user