|
|
1.1 root 1: #include <stdio.h>
2: #include "m4.h"
3:
4:
5: /* storage params */
6: int hshsize = 199; /* hash table size (prime) */
7: int bufsize = 4096; /* pushback & arg text buffers */
8: int stksize = 100; /* call stack */
9: int toksize = 512; /* biggest word ([a-z_][a-z0-9_]*) */
10:
11:
12: /* pushback buffer */
13: char *ibuf; /* buffer */
14: char *ibuflm; /* highest buffer addr */
15: char *ip; /* current position */
16: char *ipflr; /* buffer floor */
17: char *ipstk[10]; /* stack for "ipflr"s */
18:
19:
20: /* arg collection buffer */
21: char *obuf; /* buffer */
22: char *obuflm; /* high address */
23: char *op; /* current position */
24:
25:
26: /* call stack */
27: struct call *callst; /* stack */
28: struct call *Cp = NULL; /* position */
29:
30:
31: /* token storage */
32: char *token; /* buffer */
33: char *toklm; /* high addr */
34:
35:
36: /* file name and current line storage for line sync and diagnostics */
37: char fnbuf[200]; /* holds file name strings */
38: char *fname[11] = {fnbuf}; /* file name ptr stack */
39: int fline[10]; /* current line nbr stack */
40:
41:
42: /* input file stuff for "include"s */
43: FILE *ifile[10] = {stdin}; /* stack */
44: int ifx; /* stack index */
45:
46:
47: /* stuff for output diversions */
48: FILE *cf = stdout; /* current output file */
49: FILE *ofile[11] = {stdout}; /* output file stack */
50: int ofx; /* stack index */
51:
52:
53: /* comment markers */
54: char lcom[MAXSYM+1] = "#";
55: char rcom[MAXSYM+1] = "\n";
56:
57:
58: /* quote markers */
59: char lquote[MAXSYM+1] = "`";
60: char rquote[MAXSYM+1] = "'";
61:
62:
63: /* argument ptr stack */
64: char **argstk;
65: char **astklm; /* high address */
66: char **Ap; /* current position */
67:
68:
69: /* symbol table */
70: struct nlist **hshtab; /* hash table */
71: int hshval; /* last hash val */
72:
73:
74: /* misc */
75: char *procnam; /* argv[0] */
76: char *tempname; /* used for diversion files */
77: char *Wrapstr; /* last pushback string for "m4wrap" */
78: char nullstr[] = "";
79: int C; /* see "m4.h" macros */
80: int nflag = 1; /* name flag, used for line sync code */
81: int sflag; /* line sync flag */
82: int sysrval; /* return val from syscmd */
83: int trace; /* global trace flag */
84:
85:
86: char aofmsg[] = "more than %d chars of argument text";
87: char astkof[] = "more than %d items on argument stack";
88: char badfile[] = "can't open file";
89: char nocore[] = "out of storage";
90: char pbmsg[] = "pushed back more than %d chars";
91:
92:
93: /* char map */
94: char type[] = {
95: 0, 0, 0, 0, 0, 0, 0, 0,
96: 0, SPACE, SPACE, SPACE, SPACE, SPACE, 0, 0,
97: 0, 0, 0, 0, 0, 0, 0, 0,
98: 0, 0, 0, 0, 0, 0, 0, 0,
99: SPACE, 0, 0, 0, 0, 0, 0, 0,
100: 0, 0, 0, 0, 0, 0, 0, 0,
101: DIG, DIG, DIG, DIG, DIG, DIG, DIG, DIG,
102: DIG, DIG, 0, 0, 0, 0, 0, 0,
103: 0, ALPH, ALPH, ALPH, ALPH, ALPH, ALPH, ALPH,
104: ALPH, ALPH, ALPH, ALPH, ALPH, ALPH, ALPH, ALPH,
105: ALPH, ALPH, ALPH, ALPH, ALPH, ALPH, ALPH, ALPH,
106: ALPH, ALPH, ALPH, 0, 0, 0, 0, ALPH,
107: 0, ALPH, ALPH, ALPH, ALPH, ALPH, ALPH, ALPH,
108: ALPH, ALPH, ALPH, ALPH, ALPH, ALPH, ALPH, ALPH,
109: ALPH, ALPH, ALPH, ALPH, ALPH, ALPH, ALPH, ALPH,
110: ALPH, ALPH, ALPH, 0, 0, 0, 0, 0,
111: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.