version 1.16, 1999/09/14 08:30:20 |
version 1.17, 1999/09/14 08:35:16 |
|
|
int argc; |
int argc; |
char *argv[]; |
char *argv[]; |
{ |
{ |
register int c; |
int c; |
register int n; |
int n; |
char *p; |
char *p; |
register FILE *ifp; |
FILE *ifp; |
|
|
if (signal(SIGINT, SIG_IGN) != SIG_IGN) |
if (signal(SIGINT, SIG_IGN) != SIG_IGN) |
signal(SIGINT, onintr); |
signal(SIGINT, onintr); |
|
|
* macro - the work horse.. |
* macro - the work horse.. |
*/ |
*/ |
void |
void |
macro() { |
macro() |
|
{ |
char token[MAXTOK], chars[2]; |
char token[MAXTOK], chars[2]; |
register char *s; |
char *s; |
register int t, l; |
int t, l; |
register ndptr p; |
ndptr p; |
register int nlpar; |
int nlpar; |
|
|
cycle { |
cycle { |
t = gpbc(); |
t = gpbc(); |
|
|
} else if (LOOK_AHEAD(l,lquote)) { |
} else if (LOOK_AHEAD(l,lquote)) { |
nlpar++; |
nlpar++; |
s = lquote; |
s = lquote; |
} else if (l == EOF) |
} else if (l == EOF) { |
errx(1, "missing right quote"); |
if (nlpar == 1) |
else { |
errx(1, "missing right quote."); |
|
else |
|
errx(1, "missing %d right quotes.", nlpar); |
|
} else { |
chars[0] = l; |
chars[0] = l; |
chars[1] = EOS; |
chars[1] = EOS; |
s = chars; |
s = chars; |
|
|
*/ |
*/ |
ndptr |
ndptr |
inspect(tp) |
inspect(tp) |
register char *tp; |
char *tp; |
{ |
{ |
register char c; |
char c; |
register char *name = tp; |
char *name = tp; |
register char *etp = tp+MAXTOK; |
char *etp = tp+MAXTOK; |
register ndptr p; |
ndptr p; |
register unsigned long h = 0; |
unsigned long h = 0; |
|
|
while ((isalnum(c = gpbc()) || c == '_') && tp < etp) |
while ((isalnum(c = gpbc()) || c == '_') && tp < etp) |
h = (h << 5) + h + (*tp++ = c); |
h = (h << 5) + h + (*tp++ = c); |
|
|
* initkwds - initialise m4 keywords as fast as possible. |
* initkwds - initialise m4 keywords as fast as possible. |
* This very similar to install, but without certain overheads, |
* This very similar to install, but without certain overheads, |
* such as calling lookup. Malloc is not used for storing the |
* such as calling lookup. Malloc is not used for storing the |
* keyword strings, since we simply use the static pointers |
* keyword strings, since we simply use the static pointers |
* within keywrds block. |
* within keywrds block. |
*/ |
*/ |
void |
void |
initkwds() { |
initkwds() |
register int i; |
{ |
register int h; |
size_t i; |
register ndptr p; |
int h; |
|
ndptr p; |
|
|
for (i = 0; i < MAXKEYS; i++) { |
for (i = 0; i < MAXKEYS; i++) { |
h = hash(keywrds[i].knam); |
h = hash(keywrds[i].knam); |
|
|
p->type = keywrds[i].ktyp | STATIC; |
p->type = keywrds[i].ktyp | STATIC; |
} |
} |
} |
} |
|
|