1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-12-18 23:36:23 -05:00

Review scope of exported variables and functions for bind, eval, file,fileio, random.

This commit is contained in:
Renaud 2015-02-16 11:39:16 +08:00
parent e556f7714b
commit e2be62323b
10 changed files with 28 additions and 29 deletions

27
bind.c
View File

@ -27,8 +27,18 @@
#include "window.h" #include "window.h"
#if APROP
static int strinc( char *source, char *sub) ;
#endif
static void cmdstr( int c, char *seq) ;
static unsigned int getckey( int mflag) ;
static unsigned int stock( char *keyname) ;
static int buildlist( int type, char *mstring) ;
static int unbindchar( int c) ;
static char *getfname( fn_t) ; static char *getfname( fn_t) ;
int help(int f, int 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
@ -223,8 +233,7 @@ int unbindkey(int f, int n)
* *
* int c; command key to unbind * int c; command key to unbind
*/ */
int unbindchar(int c) static int unbindchar( int c) {
{
struct key_tab *ktp; /* pointer into the command table */ struct key_tab *ktp; /* pointer into the command table */
struct key_tab *sktp; /* saved pointer into the command table */ struct key_tab *sktp; /* saved pointer into the command table */
int found; /* matched command flag */ int found; /* matched command flag */
@ -289,7 +298,7 @@ int apro(int f, int n)
* int type; true = full list, false = partial list * int type; true = full list, false = partial list
* char *mstring; match string if a partial list * char *mstring; match string if a partial list
*/ */
int buildlist(int type, char *mstring) static int buildlist( int type, char *mstring)
#endif #endif
{ {
struct window *wp; /* scanning pointer to windows */ struct window *wp; /* scanning pointer to windows */
@ -403,8 +412,7 @@ int buildlist(int type, char *mstring)
* char *source; string to search in * char *source; string to search in
* char *sub; substring to look for * char *sub; substring to look for
*/ */
int strinc(char *source, char *sub) static 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 */
char *tp; /* ptr into substring */ char *tp; /* ptr into substring */
@ -439,8 +447,7 @@ int strinc(char *source, char *sub)
* *
* int mflag; going for a meta sequence? * int mflag; going for a meta sequence?
*/ */
unsigned int getckey(int mflag) static unsigned int getckey( int mflag) {
{
unsigned int c; /* character fetched */ unsigned int c; /* character fetched */
char tok[NSTRING]; /* command incoming */ char tok[NSTRING]; /* command incoming */
@ -480,8 +487,7 @@ int startup( const char *fname) {
* int c; sequence to translate * int c; sequence to translate
* char *seq; destination string for sequence * char *seq; destination string for sequence
*/ */
void cmdstr(int c, char *seq) static void cmdstr( int c, char *seq) {
{
char *ptr; /* pointer into current position in sequence */ char *ptr; /* pointer into current position in sequence */
ptr = seq; ptr = seq;
@ -581,8 +587,7 @@ int (*fncmatch(char *fname)) (int, int)
* *
* 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) static unsigned int stock( char *keyname) {
{
unsigned int c; /* key sequence to return */ unsigned int c; /* key sequence to return */
/* parse it up */ /* parse it up */

6
bind.h
View File

@ -5,7 +5,6 @@
#if APROP #if APROP
int apro( int f, int n) ; int apro( int f, int n) ;
int strinc( char *source, char *sub) ;
#endif #endif
/* Some global fuction declarations. */ /* Some global fuction declarations. */
@ -15,15 +14,10 @@ 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 unbindchar( int c) ;
int desbind( int f, int n) ; int desbind( int f, int n) ;
int buildlist( int type, char *mstring) ;
unsigned int getckey( int mflag) ;
int startup( const char *fname) ; int startup( const char *fname) ;
void cmdstr( int c, char *seq) ;
fn_t getbind( int c) ; fn_t getbind( int c) ;
fn_t fncmatch( char *) ; fn_t fncmatch( char *) ;
unsigned int stock( char *keyname) ;
char *transbind( char *skey) ; char *transbind( char *skey) ;
#endif #endif

2
eval.c
View File

@ -63,7 +63,7 @@ int readfirst_f( void) {
int macbug = FALSE ; /* macro debuging flag */ int macbug = FALSE ; /* macro debuging flag */
int cmdstatus = TRUE ; /* last command status */ int cmdstatus = TRUE ; /* last command status */
int flickcode = FALSE ; /* do flicker supression? */ static int flickcode = FALSE ; /* do flicker supression? */
int rval = 0 ; /* return value of a subprocess */ int rval = 0 ; /* return value of a subprocess */

1
eval.h
View File

@ -11,7 +11,6 @@ int mdbugout( char *fmt, char *s1, char *s2, char *s3) ;
extern int macbug ; /* macro debuging flag */ extern int macbug ; /* macro debuging flag */
extern int cmdstatus ; /* last command status */ extern int cmdstatus ; /* last command status */
extern int flickcode ; /* do flicker supression? */
extern int rval ; /* return value of a subprocess */ extern int rval ; /* return value of a subprocess */
extern long envram ; /* # of bytes current in use by malloc */ extern long envram ; /* # of bytes current in use by malloc */

7
file.c
View File

@ -57,6 +57,10 @@ static const char *codename[] = {
boolean restflag = FALSE ; /* restricted use? */ boolean restflag = FALSE ; /* restricted use? */
static int ifile( const char *fname) ;
boolean resterr( void) { boolean resterr( void) {
mloutfmt( "%B(That command is RESTRICTED)") ; mloutfmt( "%B(That command is RESTRICTED)") ;
return FALSE ; return FALSE ;
@ -646,8 +650,7 @@ int filename(int f, int n)
* buffer, Called by insert file command. Return the final * buffer, Called by insert file command. Return the final
* status of the read. * status of the read.
*/ */
int ifile( const char *fname) static int ifile( const char *fname) {
{
struct line *lp0; struct line *lp0;
struct line *lp1; struct line *lp1;
struct line *lp2; struct line *lp2;

1
file.h
View File

@ -25,6 +25,5 @@ int filewrite( int f, int n) ;
int filesave( int f, int n) ; int filesave( int f, int n) ;
int writeout( const char *fn) ; int writeout( const char *fn) ;
int filename( int f, int n) ; int filename( int f, int n) ;
int ifile( const char *fname) ;
#endif #endif

View File

@ -28,7 +28,7 @@ boolean is_crypted ; /* currently encrypting? */
#endif #endif
char *fline = NULL ; /* dynamic return line */ char *fline = NULL ; /* dynamic return line */
int flen = 0 ; /* current allocated length of fline */ static int flen = 0 ; /* current allocated length of fline */
int ftype ; int ftype ;
int fcode ; /* encoding type FCODE_xxxxx */ int fcode ; /* encoding type FCODE_xxxxx */
int fpayload ; /* actual length of fline content */ int fpayload ; /* actual length of fline content */

View File

@ -31,7 +31,6 @@ extern boolean is_crypted ; /* currently encrypting? */
#endif #endif
extern char *fline ; /* dynamic return line */ extern char *fline ; /* dynamic return line */
extern int flen ; /* current allocated length of fline */
extern int ftype ; extern int ftype ;
extern int fcode ; /* encoding type */ extern int fcode ; /* encoding type */
extern int fpayload ; /* actual length of fline content */ extern int fpayload ; /* actual length of fline content */

View File

@ -48,6 +48,9 @@ int thisflag ; /* Flags, this command */
int lastflag ; /* Flags, last command */ int lastflag ; /* Flags, last command */
static int adjustmode( int kind, int global) ;
static int cinsert( void) ;
/* /*
* Set fill column to n. * Set fill column to n.
*/ */
@ -526,7 +529,7 @@ int insert_newline(int f, int n)
return TRUE; return TRUE;
} }
int cinsert(void) static int cinsert(void)
{ /* insert a newline and indentation for C */ { /* insert a newline and indentation for C */
char *cptr; /* string pointer into text to copy */ char *cptr; /* string pointer into text to copy */
int tptr; /* index to scan into line */ int tptr; /* index to scan into line */
@ -936,8 +939,7 @@ int delgmode(int f, int n)
* int kind; true = set, false = delete * int kind; true = set, false = delete
* int global; true = global flag, false = current buffer flag * int global; true = global flag, false = current buffer flag
*/ */
int adjustmode(int kind, int global) static int adjustmode( int kind, int global) {
{
int i; /* loop index */ int i; /* loop index */
int status; /* error return on input */ int status; /* error return on input */
char prompt[50]; /* string to prompt user with */ char prompt[50]; /* string to prompt user with */

View File

@ -29,7 +29,6 @@ int trim( int f, int n) ;
#endif #endif
int openline( int f, int n) ; int openline( int f, int n) ;
int insert_newline( int f, int n) ; int insert_newline( int f, int n) ;
int cinsert( void) ;
int insbrace( int n, int c) ; int insbrace( int n, int c) ;
int inspound( void) ; int inspound( void) ;
int deblank( int f, int n) ; int deblank( int f, int n) ;
@ -41,7 +40,6 @@ int setemode( int f, int n) ;
int delmode( int f, int n) ; int delmode( int f, int n) ;
int setgmode( int f, int n) ; int setgmode( int f, int n) ;
int delgmode( int f, int n) ; int delgmode( int f, int n) ;
int adjustmode( int kind, int global) ;
int getfence( int f, int n) ; int getfence( int f, int n) ;
int fmatch( int ch) ; int fmatch( int ch) ;
int istring( int f, int n) ; int istring( int f, int n) ;