version 1.29, 2006/03/20 20:27:45 |
version 1.30, 2010/09/07 19:58:09 |
|
|
#define FORMATTYPE 44 |
#define FORMATTYPE 44 |
|
|
#define BUILTIN_MARKER "__builtin_" |
#define BUILTIN_MARKER "__builtin_" |
|
|
#define TYPEMASK 63 /* Keep bits really corresponding to a type. */ |
#define TYPEMASK 63 /* Keep bits really corresponding to a type. */ |
#define RECDEF 256 /* Pure recursive def, don't expand it */ |
#define RECDEF 256 /* Pure recursive def, don't expand it */ |
#define NOARGS 512 /* builtin needs no args */ |
#define NOARGS 512 /* builtin needs no args */ |
|
|
/* |
/* |
* m4 special characters |
* m4 special characters |
*/ |
*/ |
|
|
#define ARGFLAG '$' |
#define ARGFLAG '$' |
#define LPAREN '(' |
#define LPAREN '(' |
#define RPAREN ')' |
#define RPAREN ')' |
|
|
*/ |
*/ |
|
|
#define EOS '\0' |
#define EOS '\0' |
#define MAXINP 10 /* maximum include files */ |
#define MAXINP 10 /* maximum include files */ |
#define MAXOUT 10 /* maximum # of diversions */ |
#define MAXOUT 10 /* maximum # of diversions */ |
#define BUFSIZE 4096 /* starting size of pushback buffer */ |
#define BUFSIZE 4096 /* starting size of pushback buffer */ |
#define INITSTACKMAX 4096 /* starting size of call stack */ |
#define INITSTACKMAX 4096 /* starting size of call stack */ |
#define STRSPMAX 4096 /* starting size of string space */ |
#define STRSPMAX 4096 /* starting size of string space */ |
#define MAXTOK 512 /* maximum chars in a tokn */ |
#define MAXTOK 512 /* maximum chars in a tokn */ |
#define HASHSIZE 199 /* maximum size of hashtab */ |
#define HASHSIZE 199 /* maximum size of hashtab */ |
#define MAXCCHARS 5 /* max size of comment/quote delim */ |
#define MAXCCHARS 5 /* max size of comment/quote delim */ |
|
|
#define ALL 1 |
#define ALL 1 |
#define TOP 0 |
#define TOP 0 |
|
|
#define TRUE 1 |
#define TRUE 1 |
#define FALSE 0 |
#define FALSE 0 |
#define cycle for(;;) |
#define cycle for(;;) |
|
|
/* |
/* |
* m4 data structures |
* m4 data structures |
*/ |
*/ |
|
|
typedef struct ndblock *ndptr; |
typedef struct ndblock *ndptr; |
|
|
struct macro_definition { |
struct macro_definition { |
struct macro_definition *next; |
struct macro_definition *next; |
char *defn; /* definition.. */ |
char *defn; /* definition.. */ |
|
|
|
|
|
|
struct ndblock { /* hashtable structure */ |
struct ndblock { /* hashtable structure */ |
unsigned int builtin_type; |
unsigned int builtin_type; |
unsigned int trace_flags; |
unsigned int trace_flags; |
struct macro_definition *d; |
struct macro_definition *d; |
char name[1]; /* entry name.. */ |
char name[1]; /* entry name.. */ |
}; |
}; |
|
|
typedef union { /* stack structure */ |
typedef union { /* stack structure */ |
int sfra; /* frame entry */ |
int sfra; /* frame entry */ |
char *sstr; /* string entry */ |
char *sstr; /* string entry */ |
} stae; |
} stae; |
|
|
struct input_file { |
struct input_file { |
FILE *file; |
FILE *file; |
char *name; |
char *name; |
unsigned long lineno; |
unsigned long lineno; |
unsigned long synch_lineno; /* used for -s */ |
unsigned long synch_lineno; /* used for -s */ |
int c; |
int c; |
}; |
}; |
|
|
#define CURRENT_NAME (infile[ilevel].name) |
#define CURRENT_NAME (infile[ilevel].name) |
|
|
* pushf() - push a call frame entry onto stack |
* pushf() - push a call frame entry onto stack |
* pushs() - push a string pointer onto stack |
* pushs() - push a string pointer onto stack |
*/ |
*/ |
#define gpbc() (bp > bufbase) ? *--bp : obtain_char(infile+ilevel) |
#define gpbc() (bp > bufbase) ? *--bp : obtain_char(infile+ilevel) |
#define pushf(x) \ |
#define pushf(x) \ |
do { \ |
do { \ |
if (++sp == STACKMAX) \ |
if (++sp == STACKMAX) \ |
enlarge_stack();\ |
enlarge_stack();\ |
mstack[sp].sfra = (x); \ |
mstack[sp].sfra = (x); \ |
sstack[sp] = 0; \ |
sstack[sp] = 0; \ |
} while (0) |
} while (0) |
|
|
#define pushs(x) \ |
#define pushs(x) \ |
do { \ |
do { \ |
if (++sp == STACKMAX) \ |
if (++sp == STACKMAX) \ |
enlarge_stack();\ |
enlarge_stack();\ |
mstack[sp].sstr = (x); \ |
mstack[sp].sstr = (x); \ |
sstack[sp] = 1; \ |
sstack[sp] = 1; \ |
} while (0) |
} while (0) |
|
|
#define pushs1(x) \ |
#define pushs1(x) \ |
do { \ |
do { \ |
if (++sp == STACKMAX) \ |
if (++sp == STACKMAX) \ |
enlarge_stack();\ |
enlarge_stack();\ |
mstack[sp].sstr = (x); \ |
mstack[sp].sstr = (x); \ |
sstack[sp] = 0; \ |
sstack[sp] = 0; \ |
|
|
* +-------+ +-----+ |
* +-------+ +-----+ |
* | arg 3 ----------------------->| str | |
* | arg 3 ----------------------->| str | |
* +-------+ | . | |
* +-------+ | . | |
* | arg 2 ---PREVEP-----+ . |
* | arg 2 ---PREVEP-----+ . |
* +-------+ | |
* +-------+ | |
* . | | | |
* . | | | |
* +-------+ | +-----+ |
* +-------+ | +-----+ |
* | plev | PARLEV +-------->| str | |
* | plev | PARLEV +-------->| str | |
* +-------+ | . | |
* +-------+ | . | |
* | type | CALTYP . |
* | type | CALTYP . |
* +-------+ |
* +-------+ |
* | prcf ---PREVFP--+ |
* | prcf ---PREVFP--+ |
* +-------+ | |
* +-------+ | |
* | . | PREVSP | |
* | . | PREVSP | |
* . | |
* . | |
* +-------+ | |
* +-------+ | |
* | <----------+ |
* | <----------+ |
* +-------+ |
* +-------+ |