1: /* awk.def 4.3 83/12/09 */
2:
3: #define hack int
4: #define AWKFLOAT float
5: #define xfree(a) { if(a!=NULL) { yfree(a); a=NULL;} }
6: #define strfree(a) { if(a!=NULL && a!=EMPTY) { yfree(a);} a=EMPTY; }
7: #define yfree free
8: #define isnull(x) ((x) == EMPTY || (x) == NULL)
9:
10: #ifdef DEBUG
11: # define dprintf if(dbg)printf
12: #else
13: # define dprintf(x1, x2, x3, x4)
14: #endif
15: typedef AWKFLOAT awkfloat;
16:
17: extern char **FS;
18: extern char **RS;
19: extern char **ORS;
20: extern char **OFS;
21: extern char **OFMT;
22: extern awkfloat *NR;
23: extern awkfloat *NF;
24: extern char **FILENAME;
25:
26: extern char record[];
27: extern char EMPTY[];
28: extern int dbg;
29: extern int lineno;
30: extern int errorflag;
31: extern int donefld; /* 1 if record broken into fields */
32: extern int donerec; /* 1 if record is valid (no fld has changed */
33:
34: typedef struct val { /* general value during processing */
35: char *nval; /* name, for variables only */
36: char *sval; /* string value */
37: awkfloat fval; /* value as number */
38: unsigned tval; /* type info */
39: struct val *nextval; /* ptr to next if chained */
40: } cell;
41: extern cell *symtab[];
42: cell *setsymtab(), *lookup(), **makesymtab();
43:
44: extern cell *recloc; /* location of input record */
45: extern cell *nrloc; /* NR */
46: extern cell *nfloc; /* NF */
47:
48: #define STR 01 /* string value is valid */
49: #define NUM 02 /* number value is valid */
50: #define FLD 04 /* FLD means don't free string space */
51: #define CON 010 /* this is a constant */
52: #define ARR 020 /* this is an array */
53:
54: awkfloat setfval(), getfval();
55: char *setsval(), *getsval();
56: char *tostring(), *tokname(), *malloc();
57: double log(), sqrt(), exp(), atof();
58:
59: /* function types */
60: #define FLENGTH 1
61: #define FSQRT 2
62: #define FEXP 3
63: #define FLOG 4
64: #define FINT 5
65:
66: typedef struct {
67: char otype;
68: char osub;
69: cell *optr;
70: } obj;
71:
72: #define BOTCH 1
73: struct nd {
74: char ntype;
75: char subtype;
76: struct nd *nnext;
77: int nobj;
78: struct nd *narg[BOTCH]; /* C won't take a zero length array */
79: };
80: typedef struct nd node;
81: extern node *winner;
82: extern node *nullstat;
83:
84: /* otypes */
85: #define OCELL 0
86: #define OEXPR 1
87: #define OBOOL 2
88: #define OJUMP 3
89:
90: /* cell subtypes */
91: #define CTEMP 4
92: #define CNAME 3
93: #define CVAR 2
94: #define CFLD 1
95: #define CCON 0
96:
97: /* bool subtypes */
98: #define BTRUE 1
99: #define BFALSE 2
100:
101: /* jump subtypes */
102: #define JEXIT 1
103: #define JNEXT 2
104: #define JBREAK 3
105: #define JCONT 4
106:
107: /* node types */
108: #define NVALUE 1
109: #define NSTAT 2
110: #define NEXPR 3
111: #define NPA2 4
112:
113: extern obj (*proctab[])();
114: extern obj true, false;
115: extern int pairstack[], paircnt;
116:
117: #define cantexec(n) (n->ntype == NVALUE)
118: #define notlegal(n) (n <= FIRSTTOKEN || n >= LASTTOKEN || proctab[n-FIRSTTOKEN]== nullproc)
119: #define isexpr(n) (n->ntype == NEXPR)
120: #define isjump(n) (n.otype == OJUMP)
121: #define isexit(n) (n.otype == OJUMP && n.osub == JEXIT)
122: #define isbreak(n) (n.otype == OJUMP && n.osub == JBREAK)
123: #define iscont(n) (n.otype == OJUMP && n.osub == JCONT)
124: #define isnext(n) (n.otype == OJUMP && n.osub == JNEXT)
125: #define isstr(n) (n.optr->tval & STR)
126: #define istrue(n) (n.otype == OBOOL && n.osub == BTRUE)
127: #define istemp(n) (n.otype == OCELL && n.osub == CTEMP)
128: #define isfld(n) (!donefld && n.osub==CFLD && n.otype==OCELL && n.optr->nval==EMPTY)
129: #define isrec(n) (donefld && n.osub==CFLD && n.otype==OCELL && n.optr->nval!=EMPTY)
130: obj nullproc();
131: obj relop();
132:
133: #define MAXSYM 50
134: #define HAT 0177 /* matches ^ in regular expr */
135: /* watch out for mach dep */
Defined functions
obj
defined in line
113; used 72 times
- in line 70,
114,
130-131(2)
- in /usr/src/bin/awk/run.c line
20,
27-28(2),
42-45(3),
74-76(2),
101-103(2),
110-113(3),
121-126(3),
142-144(2),
159-161(2),
190-193(2),
224,
231-234(2),
248-250(2),
263-266(2),
300-302(2),
328,
397-399(2),
413-416(2),
457-459(2),
478-480(2),
529-531(2),
552-554(2),
567-569(2),
588-590(2),
602-604(2),
674-676(2),
690-692(2),
709-711(2),
732-735(2),
759-761(2),
788-790(2),
814-817(2),
840-844(3),
856
Defined struct's
nd
defined in line
73; used 6 times
val
defined in line
34; used 2 times
Defined typedef's
cell
defined in line
40; used 47 times
- in line 41-46(5),
69
- in /usr/src/bin/awk/lib.c line
23,
102,
196
- in /usr/src/bin/awk/parse.c line
121
- in /usr/src/bin/awk/run.c line
25-26(2),
124-129(2),
252,
605,
621,
734-742(4),
846
- in /usr/src/bin/awk/tran.c line
9,
20-22(3),
43-48(4),
57-64(3),
75-83(4),
91(2),
116-120(3),
130,
145,
163,
188,
212
node
defined in line
80; used 119 times
- in line 81-82(2)
- in /usr/src/bin/awk/awk.g.y line
44,
200-211(11)
- in /usr/src/bin/awk/b.c line
9,
39,
46-52(6),
65-69(2),
90,
149,
181,
215-217(2),
298
- in /usr/src/bin/awk/parse.c line
8-24(10),
30-32(3),
39-41(3),
49-51(3),
60-62(3),
72-123(23),
129-138(6),
145-147(2)
- in /usr/src/bin/awk/run.c line
23(2),
42-49(3),
68,
74,
110,
121,
142,
159,
190,
248,
263,
300,
325,
397-400(2),
413,
457,
478,
529,
552,
567,
588,
602,
674,
690,
709,
732,
759,
788,
814-816(2),
842,
853
Defined macros
ARR
defined in line
52; used 6 times
BOTCH
defined in line
72; used 1 times
BTRUE
defined in line
98; used 2 times
CCON
defined in line
95; used 3 times
CFLD
defined in line
94; used 9 times
CNAME
defined in line
92;
never used
CON
defined in line
51; used 3 times
CTEMP
defined in line
91; used 2 times
CVAR
defined in line
93; used 2 times
FEXP
defined in line
62; used 1 times
FINT
defined in line
64; used 1 times
FLD
defined in line
50; used 24 times
FLOG
defined in line
63; used 1 times
FSQRT
defined in line
61; used 1 times
HAT
defined in line
134; used 8 times
NPA2
defined in line
111; used 2 times
NUM
defined in line
49; used 23 times
- in /usr/src/bin/awk/lib.c line
81-85(2),
165
- in /usr/src/bin/awk/run.c line
26,
136,
198(2),
486-493(4),
644,
661,
669
- in /usr/src/bin/awk/tran.c line
26-28(2),
37-39(2),
138,
152,
170,
178,
216
OBOOL
defined in line
87; used 3 times
OCELL
defined in line
85; used 7 times
OEXPR
defined in line
86;
never used
OJUMP
defined in line
88; used 6 times
STR
defined in line
48; used 36 times
- in line 125
- in /usr/src/bin/awk/lib.c line
22-24(2),
82-84(2),
107,
132,
146,
157,
189
- in /usr/src/bin/awk/run.c line
132-136(2),
409,
486-491(3),
547,
624,
644-646(2),
661-663(2)
- in /usr/src/bin/awk/tran.c line
26-36(9),
137,
153,
196,
205,
216
dprintf
defined in line
13; used 38 times
- in /usr/src/bin/awk/b.c line
138,
282-288(3),
329,
372,
456-461(3),
468-469(2),
494-498(3)
- in /usr/src/bin/awk/lib.c line
43-48(2),
57,
109,
188-193(3),
221
- in /usr/src/bin/awk/main.c line
49,
80-84(2)
- in /usr/src/bin/awk/run.c line
291,
623
- in /usr/src/bin/awk/tran.c line
30,
87-88(2),
101-102(2),
133,
148,
168,
183,
194,
207
hack
defined in line
3; used 5 times
isnull
defined in line
8; used 2 times
xfree
defined in line
5; used 8 times
yfree
defined in line
7; used 3 times
Usage of this include