Limit visibility of token types to eval.

This commit is contained in:
Renaud 2015-01-09 17:53:29 +08:00
parent 63776bb3f8
commit f8c405f501
3 changed files with 796 additions and 791 deletions

23
eval.c
View File

@ -34,6 +34,22 @@
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
/* Macro argument token types */
#define TKNUL 0 /* end-of-string */
#define TKARG 1 /* interactive argument */
#define TKBUF 2 /* buffer argument */
#define TKVAR 3 /* user variables */
#define TKENV 4 /* environment variables */
#define TKFUN 5 /* function.... */
#define TKDIR 6 /* directive */
#define TKLBL 7 /* line label */
#define TKLIT 8 /* numeric literal */
#define TKSTR 9 /* quoted string literal */
#define TKCMD 10 /* command name */
static int gettyp( char *token) ;
#if DEBUGM
/* vars needed for macro debugging output */
char outline[ NSTRING] ; /* global string to hold debug line text */
@ -1093,8 +1109,7 @@ char *i_to_a(int i)
*
* char *token; token to analyze
*/
int gettyp(char *token)
{
static int gettyp( char *token) {
char c; /* first char in token */
/* grab the first char (this is all we need) */
@ -1132,6 +1147,10 @@ int gettyp(char *token)
}
}
int is_it_cmd( char *token) {
return TKCMD == gettyp( token) ;
}
/*
* find the value of a token
*

16
eval.h
View File

@ -22,21 +22,7 @@ extern int flickcode ; /* do flicker supression? */
extern int rval ; /* return value of a subprocess */
extern long envram ; /* # of bytes current in use by malloc */
/* Macro argument token types */
#define TKNUL 0 /* end-of-string */
#define TKARG 1 /* interactive argument */
#define TKBUF 2 /* buffer argument */
#define TKVAR 3 /* user variables */
#define TKENV 4 /* environment variables */
#define TKFUN 5 /* function.... */
#define TKDIR 6 /* directive */
#define TKLBL 7 /* line label */
#define TKLIT 8 /* numeric literal */
#define TKSTR 9 /* quoted string literal */
#define TKCMD 10 /* command name */
int gettyp( char *token) ;
int is_it_cmd( char *token) ;
void varinit( void) ;
int setvar( int f, int n) ;

1548
exec.c

File diff suppressed because it is too large Load Diff