version 1.43, 2002/02/16 21:27:48 |
version 1.44, 2002/04/26 16:15:16 |
|
|
* argc is 3 for macro-or-builtin() and 2 for macro-or-builtin |
* argc is 3 for macro-or-builtin() and 2 for macro-or-builtin |
*/ |
*/ |
void |
void |
eval(argv, argc, td) |
eval(const char *argv[], int argc, int td) |
const char *argv[]; |
|
int argc; |
|
int td; |
|
{ |
{ |
ssize_t mark = -1; |
ssize_t mark = -1; |
|
|
|
|
* expand_builtin - evaluate built-in macros. |
* expand_builtin - evaluate built-in macros. |
*/ |
*/ |
void |
void |
expand_builtin(argv, argc, td) |
expand_builtin(const char *argv[], int argc, int td) |
const char *argv[]; |
|
int argc; |
|
int td; |
|
{ |
{ |
int c, n; |
int c, n; |
int ac; |
int ac; |
|
|
* expand_macro - user-defined macro expansion |
* expand_macro - user-defined macro expansion |
*/ |
*/ |
void |
void |
expand_macro(argv, argc) |
expand_macro(const char *argv[], int argc) |
const char *argv[]; |
|
int argc; |
|
{ |
{ |
const char *t; |
const char *t; |
const char *p; |
const char *p; |
|
|
* dodefine - install definition in the table |
* dodefine - install definition in the table |
*/ |
*/ |
void |
void |
dodefine(name, defn) |
dodefine(const char *name, const char *defn) |
const char *name; |
|
const char *defn; |
|
{ |
{ |
ndptr p; |
ndptr p; |
int n; |
int n; |
|
|
* the given name. |
* the given name. |
*/ |
*/ |
static void |
static void |
dodefn(name) |
dodefn(const char *name) |
const char *name; |
|
{ |
{ |
ndptr p; |
ndptr p; |
char *real; |
char *real; |
|
|
* lookup. |
* lookup. |
*/ |
*/ |
static void |
static void |
dopushdef(name, defn) |
dopushdef(const char *name, const char *defn) |
const char *name; |
|
const char *defn; |
|
{ |
{ |
ndptr p; |
ndptr p; |
|
|
|
|
* dump_one_def - dump the specified definition. |
* dump_one_def - dump the specified definition. |
*/ |
*/ |
static void |
static void |
dump_one_def(p) |
dump_one_def(ndptr p) |
ndptr p; |
|
{ |
{ |
char *real; |
char *real; |
|
|
|
|
* hash table is dumped. |
* hash table is dumped. |
*/ |
*/ |
static void |
static void |
dodump(argv, argc) |
dodump(const char *argv[], int argc) |
const char *argv[]; |
|
int argc; |
|
{ |
{ |
int n; |
int n; |
ndptr p; |
ndptr p; |
|
|
* dotrace - mark some macros as traced/untraced depending upon on. |
* dotrace - mark some macros as traced/untraced depending upon on. |
*/ |
*/ |
static void |
static void |
dotrace(argv, argc, on) |
dotrace(const char *argv[], int argc, int on) |
const char *argv[]; |
|
int argc; |
|
int on; |
|
{ |
{ |
int n; |
int n; |
|
|
|
|
* doifelse - select one of two alternatives - loop. |
* doifelse - select one of two alternatives - loop. |
*/ |
*/ |
static void |
static void |
doifelse(argv, argc) |
doifelse(const char *argv[], int argc) |
const char *argv[]; |
|
int argc; |
|
{ |
{ |
cycle { |
cycle { |
if (STREQ(argv[2], argv[3])) |
if (STREQ(argv[2], argv[3])) |
|
|
* doinclude - include a given file. |
* doinclude - include a given file. |
*/ |
*/ |
static int |
static int |
doincl(ifile) |
doincl(const char *ifile) |
const char *ifile; |
|
{ |
{ |
if (ilevel + 1 == MAXINP) |
if (ilevel + 1 == MAXINP) |
errx(1, "%s at line %lu: too many include files.", |
errx(1, "%s at line %lu: too many include files.", |
|
|
* macro processing. |
* macro processing. |
*/ |
*/ |
static int |
static int |
dopaste(pfile) |
dopaste(const char *pfile) |
const char *pfile; |
|
{ |
{ |
FILE *pf; |
FILE *pf; |
int c; |
int c; |
|
|
#endif |
#endif |
|
|
static void |
static void |
gnu_dochq(argv, ac) |
gnu_dochq(const char *argv[], int ac) |
const char *argv[]; |
|
int ac; |
|
{ |
{ |
/* In gnu-m4 mode, the only way to restore quotes is to have no |
/* In gnu-m4 mode, the only way to restore quotes is to have no |
* arguments at all. */ |
* arguments at all. */ |
|
|
* dochq - change quote characters |
* dochq - change quote characters |
*/ |
*/ |
static void |
static void |
dochq(argv, argc) |
dochq(const char *argv[], int argc) |
const char *argv[]; |
|
int argc; |
|
{ |
{ |
if (argc > 2) { |
if (argc > 2) { |
if (*argv[2]) |
if (*argv[2]) |
|
|
} |
} |
|
|
static void |
static void |
gnu_dochc(argv, ac) |
gnu_dochc(const char *argv[], int ac) |
const char *argv[]; |
|
int ac; |
|
{ |
{ |
/* In gnu-m4 mode, no arguments mean no comment |
/* In gnu-m4 mode, no arguments mean no comment |
* arguments at all. */ |
* arguments at all. */ |
|
|
* dochc - change comment characters |
* dochc - change comment characters |
*/ |
*/ |
static void |
static void |
dochc(argv, argc) |
dochc(const char *argv[], int argc) |
const char *argv[]; |
|
int argc; |
|
{ |
{ |
if (argc > 2) { |
if (argc > 2) { |
if (*argv[2]) |
if (*argv[2]) |
|
|
* dodivert - divert the output to a temporary file |
* dodivert - divert the output to a temporary file |
*/ |
*/ |
static void |
static void |
dodiv(n) |
dodiv(int n) |
int n; |
|
{ |
{ |
int fd; |
int fd; |
|
|
|
|
* other outputs, in numerical order. |
* other outputs, in numerical order. |
*/ |
*/ |
static void |
static void |
doundiv(argv, argc) |
doundiv(const char *argv[], int argc) |
const char *argv[]; |
|
int argc; |
|
{ |
{ |
int ind; |
int ind; |
int n; |
int n; |
|
|
* dosub - select substring |
* dosub - select substring |
*/ |
*/ |
static void |
static void |
dosub(argv, argc) |
dosub(const char *argv[], int argc) |
const char *argv[]; |
|
int argc; |
|
{ |
{ |
const char *ap, *fc, *k; |
const char *ap, *fc, *k; |
int nc; |
int nc; |
|
|
* destination string. |
* destination string. |
*/ |
*/ |
static void |
static void |
map(dest, src, from, to) |
map(char *dest, const char *src, const char *from, const char *to) |
char *dest; |
|
const char *src; |
|
const char *from; |
|
const char *to; |
|
{ |
{ |
const char *tmp; |
const char *tmp; |
unsigned char sch, dch; |
unsigned char sch, dch; |
|
|
* on the way. |
* on the way. |
*/ |
*/ |
static const char * |
static const char * |
handledash(buffer, end, src) |
handledash(char *buffer, char *end, const char *src) |
char *buffer; |
|
char *end; |
|
const char *src; |
|
{ |
{ |
char *p; |
char *p; |
|
|
|
|
*p = '\0'; |
*p = '\0'; |
return buffer; |
return buffer; |
} |
} |
|
|