1: #define xfree(a) { if(a!=NULL) yfree(a); a=NULL;}
2: #define yfree free
3: #ifdef DEBUG
4: # define dprintf if(dbg)printf
5: #else
6: # define dprintf(x1, x2, x3, x4)
7: #endif
8: #define isnull(x) ((x) == EMPTY || (x) == NULL)
9: typedef double awkfloat;
10:
11: extern char **FS;
12: extern char **RS;
13: extern char **ORS;
14: extern char **OFS;
15: extern char **OFMT;
16: extern awkfloat *NR;
17: extern awkfloat *NF;
18: extern char **FILENAME;
19:
20: extern char record[];
21: extern char EMPTY[];
22: extern int dbg;
23: extern int lineno;
24: extern int errorflag;
25: extern int donefld; /* 1 if record broken into fields */
26: extern int donerec; /* 1 if record is valid (no fld has changed */
27:
28: typedef struct val { /* general value during processing */
29: char *nval; /* name, for variables only */
30: char *sval; /* string value */
31: awkfloat fval; /* value as number */
32: unsigned tval; /* type info */
33: struct val *nextval; /* ptr to next if chained */
34: } cell;
35: extern cell *symtab[];
36: cell *setsymtab(), *lookup(), **makesymtab();
37:
38: extern cell *recloc; /* location of input record */
39: extern cell *nrloc; /* NR */
40: extern cell *nfloc; /* NF */
41:
42: #define STR 01 /* string value is valid */
43: #define NUM 02 /* number value is valid */
44: #define FLD 04 /* FLD means don't free string space */
45: #define CON 010 /* this is a constant */
46: #define ARR 020 /* this is an array */
47:
48: awkfloat setfval(), getfval();
49: char *setsval(), *getsval();
50: char *tostring(), *tokname(), *malloc();
51: double log(), sqrt(), exp(), atof();
52:
53: /* function types */
54: #define FLENGTH 1
55: #define FSQRT 2
56: #define FEXP 3
57: #define FLOG 4
58: #define FINT 5
59:
60: typedef struct {
61: char otype;
62: char osub;
63: cell *optr;
64: } obj;
65:
66: #define BOTCH 1
67: struct nd {
68: char ntype;
69: char subtype;
70: struct nd *nnext;
71: int nobj;
72: struct nd *narg[BOTCH]; /* C won't take a zero length array */
73: };
74: typedef struct nd node;
75: extern node *winner;
76: extern node *nullstat;
77:
78: /* otypes */
79: #define OCELL 0
80: #define OEXPR 1
81: #define OBOOL 2
82: #define OJUMP 3
83:
84: /* cell subtypes */
85: #define CTEMP 4
86: #define CNAME 3
87: #define CVAR 2
88: #define CFLD 1
89: #define CCON 0
90:
91: /* bool subtypes */
92: #define BTRUE 1
93: #define BFALSE 2
94:
95: /* jump subtypes */
96: #define JEXIT 1
97: #define JNEXT 2
98: #define JBREAK 3
99: #define JCONT 4
100:
101: /* node types */
102: #define NVALUE 1
103: #define NSTAT 2
104: #define NEXPR 3
105: #define NPA2 4
106:
107: extern obj (*proctab[])();
108: extern obj true, false;
109: extern int pairstack[], paircnt;
110:
111: #define cantexec(n) (n->ntype == NVALUE)
112: #define notlegal(n) (n <= FIRSTTOKEN || n >= LASTTOKEN || proctab[n-FIRSTTOKEN]== nullproc)
113: #define isexpr(n) (n->ntype == NEXPR)
114: #define isjump(n) (n.otype == OJUMP)
115: #define isexit(n) (n.otype == OJUMP && n.osub == JEXIT)
116: #define isbreak(n) (n.otype == OJUMP && n.osub == JBREAK)
117: #define iscont(n) (n.otype == OJUMP && n.osub == JCONT)
118: #define isnext(n) (n.otype == OJUMP && n.osub == JNEXT)
119: #define isstr(n) (n.optr->tval & STR)
120: #define istrue(n) (n.otype == OBOOL && n.osub == BTRUE)
121: #define istemp(n) (n.otype == OCELL && n.osub == CTEMP)
122: #define isfld(n) (!donefld && n.osub==CFLD && n.otype==OCELL && n.optr->nval==0)
123: #define isrec(n) (donefld && n.osub==CFLD && n.otype==OCELL && n.optr->nval!=0)
124: obj nullproc();
125: obj relop();
126:
127: #define MAXSYM 16
128: #define HAT 0177 /* matches ^ in regular expr */
129: /* watch out for mach dep */
Defined functions
obj
defined in line
107; used 95 times
- in line 64,
108,
124-125(2)
- in /usr/src/cmd/awk/proctab.c line
2-26(25)
- in /usr/src/cmd/awk/run.c line
15,
22-23(2),
30-33(3),
62-64(2),
94-97(3),
105-110(3),
126-128(2),
143-145(2),
174-177(2),
208,
215-218(2),
232-234(2),
247-250(2),
286-288(2),
314,
381-383(2),
397-400(2),
440-442(2),
461-463(2),
504-506(2),
526-528(2),
541-543(2),
562-564(2),
576-578(2),
629-631(2),
645-647(2),
664-666(2),
687-690(2),
715-717(2),
740-742(2),
766-769(2),
792-796(3),
808
Defined struct's
nd
defined in line
67; used 6 times
val
defined in line
28; used 2 times
Defined typedef's
awkfloat
defined in line
9; used 21 times
- in line 16-17(2),
48-31(2)
- in /usr/src/cmd/awk/lib.c line
156
- in /usr/src/cmd/awk/run.c line
178,
303,
316,
399,
444,
464,
743,
749-753(2)
- in /usr/src/cmd/awk/tran.c line
12-13(2),
71,
122-124(2),
155-158(2)
cell
defined in line
34; used 47 times
- in line 35-40(5),
63
- in /usr/src/cmd/awk/lib.c line
19,
92,
185
- in /usr/src/cmd/awk/parse.c line
104
- in /usr/src/cmd/awk/run.c line
20-21(2),
108-113(2),
236,
579,
596,
689-697(4),
798
- in /usr/src/cmd/awk/tran.c line
5,
16-18(3),
37-58(7),
69-77(4),
85(2),
110-114(3),
123,
138,
156,
182,
206
node
defined in line
74; used 120 times
- in line 75-76(2)
- in /usr/src/cmd/awk/awk.g.y line
196-207(11)
- in /usr/src/cmd/awk/b.c line
5,
35,
42-48(6),
61-65(2),
86,
145,
177,
211-213(2),
294
- in /usr/src/cmd/awk/parse.c line
4-18(10),
24-25(3),
32-33(3),
41-42(3),
51-52(3),
62-105(23),
111-124(8),
131-132(2)
- in /usr/src/cmd/awk/run.c line
18(2),
30-37(3),
56,
62,
94,
105,
126,
143,
174,
232,
247,
286,
311,
381-384(2),
397,
440,
461,
504,
526,
541,
562,
576,
629,
645,
664,
687,
715,
740,
766-768(2),
794,
805
Defined macros
ARR
defined in line
46; used 6 times
BOTCH
defined in line
66; used 1 times
BTRUE
defined in line
92; used 2 times
CCON
defined in line
89; used 3 times
CFLD
defined in line
88; used 9 times
CNAME
defined in line
86;
never used
CON
defined in line
45; used 2 times
CTEMP
defined in line
85; used 2 times
CVAR
defined in line
87; used 2 times
FEXP
defined in line
56; used 1 times
FINT
defined in line
58; used 1 times
FLD
defined in line
44; used 23 times
FLOG
defined in line
57; used 1 times
FSQRT
defined in line
55; used 1 times
HAT
defined in line
128; used 8 times
JCONT
defined in line
99; used 2 times
JEXIT
defined in line
96; used 2 times
JNEXT
defined in line
97; used 2 times
NPA2
defined in line
105; used 2 times
NUM
defined in line
43; used 16 times
- in /usr/src/cmd/awk/lib.c line
154
- in /usr/src/cmd/awk/run.c line
21,
75-79(2),
182(2),
470,
624
- in /usr/src/cmd/awk/tran.c line
22,
31-33(2),
131,
145,
164,
172,
210
OBOOL
defined in line
81; used 3 times
OCELL
defined in line
79; used 7 times
OEXPR
defined in line
80;
never used
OJUMP
defined in line
82; used 6 times
STR
defined in line
42; used 31 times
- in line 119
- in /usr/src/cmd/awk/lib.c line
18-20(2),
97,
121,
135,
146,
178
- in /usr/src/cmd/awk/run.c line
76-78(2),
116-120(2),
393,
469,
521,
599,
618,
702
- in /usr/src/cmd/awk/tran.c line
22-30(8),
130,
146,
190,
199,
210
dprintf
defined in line
6; used 39 times
- in /usr/src/cmd/awk/b.c line
134,
278-284(3),
325,
368,
452-457(3),
464-465(2),
490-494(3)
- in /usr/src/cmd/awk/lib.c line
39-44(2),
53,
99,
177-182(3),
210
- in /usr/src/cmd/awk/main.c line
38,
59,
66
- in /usr/src/cmd/awk/run.c line
275,
598,
616
- in /usr/src/cmd/awk/tran.c line
24,
81-82(2),
95-96(2),
126,
141,
162,
177,
188,
201
isnull
defined in line
8; used 2 times
xfree
defined in line
1; used 20 times
- in /usr/src/cmd/awk/b.c line
90-95(3),
101,
135,
487
- in /usr/src/cmd/awk/lib.c line
119,
133,
145
- in /usr/src/cmd/awk/main.c line
115,
133
- in /usr/src/cmd/awk/run.c line
115,
211,
700
- in /usr/src/cmd/awk/tran.c line
61-66(3),
80,
150,
192
yfree
defined in line
2; used 2 times
Usage of this include