6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
24 */
25
26 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
27 /* All Rights Reserved */
28
29 #ifndef AWK_H
30 #define AWK_H
31
32 #include <sys/types.h>
33 #include <ctype.h>
34 #include <stdio.h>
35 #include <stdlib.h>
36 #include <string.h>
37 #include <libintl.h>
38 #include <limits.h>
39
40 typedef double Awkfloat;
41 typedef unsigned char uchar;
42
43 #define xfree(a) { if ((a) != NULL) { free(a); a = NULL; } }
44
45 #define DEBUG
46 #ifdef DEBUG
47 /* uses have to be doubly parenthesized */
48 #define dprintf(x) if (dbg) (void) printf x
49 #else
50 #define dprintf(x)
51 #endif
52
53 extern char errbuf[200];
54 extern void error(int, char *);
55 #define ERROR (void) snprintf(errbuf, sizeof (errbuf),
56 /*CSTYLED*/
57 #define FATAL ), error(1, errbuf)
58 /*CSTYLED*/
59 #define WARNING ), error(0, errbuf)
60 /*CSTYLED*/
61 #define SYNTAX ), yyerror(errbuf)
62 /*CSTYLED*/
63 #define CONT )
64
65 extern int compile_time; /* 1 if compiling, 0 if running */
66
67 #define FLD_INCR 64
68 #define LINE_INCR 256
69
70 /* ensure that there is extra 1 byte in the buffer */
71 #define expand_buf(p, n, r) \
72 if (*(n) == 0 || (r) >= (*(n) - 1)) r_expand_buf(p, n, r)
73
74 extern uchar **FS;
75 extern uchar **RS;
76 extern uchar **ORS;
77 extern uchar **OFS;
78 extern uchar **OFMT;
79 extern Awkfloat *NR;
80 extern Awkfloat *FNR;
81 extern Awkfloat *NF;
82 extern uchar **FILENAME;
83 extern uchar **SUBSEP;
84 extern Awkfloat *RSTART;
85 extern Awkfloat *RLENGTH;
86
87 extern uchar *record;
88 extern size_t record_size;
89 extern int errorflag;
90 extern int donefld; /* 1 if record broken into fields */
91 extern int donerec; /* 1 if record is valid (no fld has changed */
92
93 extern uchar *patbeg; /* beginning of pattern matched */
94 extern int patlen; /* length. set in b.c */
95
96 /* Cell: all information about a variable or constant */
97
98 typedef struct Cell {
99 uchar ctype; /* OCELL, OBOOL, OJUMP, etc. */
100 uchar csub; /* CCON, CTEMP, CFLD, etc. */
101 uchar *nval; /* name, for variables only */
102 uchar *sval; /* string value */
103 Awkfloat fval; /* value as number */
104 unsigned tval;
105 /* type info: STR|NUM|ARR|FCN|FLD|CON|DONTFREE */
106 struct Cell *cnext; /* ptr to next if chained */
107 } Cell;
108
109 typedef struct { /* symbol table array */
110 int nelem; /* elements in table right now */
111 int size; /* size of tab */
112 Cell **tab; /* hash table pointers */
113 } Array;
114
115 #define NSYMTAB 50 /* initial size of a symbol table */
116 extern Array *symtab, *makesymtab(int);
117 extern Cell *setsymtab(uchar *, uchar *, Awkfloat, unsigned int, Array *);
118 extern Cell *lookup(uchar *, Array *);
119
120 extern Cell *recloc; /* location of input record */
121 extern Cell *nrloc; /* NR */
122 extern Cell *fnrloc; /* FNR */
123 extern Cell *nfloc; /* NF */
124 extern Cell *rstartloc; /* RSTART */
125 extern Cell *rlengthloc; /* RLENGTH */
126
127 /* Cell.tval values: */
128 #define NUM 01 /* number value is valid */
129 #define STR 02 /* string value is valid */
130 #define DONTFREE 04 /* string space is not freeable */
131 #define CON 010 /* this is a constant */
132 #define ARR 020 /* this is an array */
133 #define FCN 040 /* this is a function name */
134 #define FLD 0100 /* this is a field $1, $2, ... */
135 #define REC 0200 /* this is $0 */
136
137 #define freeable(p) (!((p)->tval & DONTFREE))
138
139 extern Awkfloat setfval(Cell *, Awkfloat), getfval(Cell *), r_getfval(Cell *);
140 extern uchar *setsval(Cell *, uchar *), *getsval(Cell *), *r_getsval(Cell *);
141 extern uchar *tostring(uchar *), *tokname(int), *qstring(uchar *, int);
142
143 #define getfval(p) \
144 (((p)->tval & (ARR|FLD|REC|NUM)) == NUM ? (p)->fval : r_getfval(p))
145 #define getsval(p) \
146 (((p)->tval & (ARR|FLD|REC|STR)) == STR ? (p)->sval : r_getsval(p))
147
148 /* function types */
149 #define FLENGTH 1
150 #define FSQRT 2
151 #define FEXP 3
152 #define FLOG 4
153 #define FINT 5
154 #define FSYSTEM 6
155 #define FRAND 7
156 #define FSRAND 8
157 #define FSIN 9
158 #define FCOS 10
159 #define FATAN 11
160 #define FTOUPPER 12
161 #define FTOLOWER 13
162
163 /* Node: parse tree is made of nodes, with Cell's at bottom */
164
165 typedef struct Node {
166 int ntype;
167 struct Node *nnext;
168 off_t lineno;
169 int nobj;
170 struct Node *narg[1];
171 /* variable: actual size set by calling malloc */
172 } Node;
173
174 #define NIL ((Node *)0)
175
176 extern Node *winner;
177 extern Node *nullstat;
178 extern Node *nullnode;
179
180 /* ctypes */
181 #define OCELL 1
182 #define OBOOL 2
183 #define OJUMP 3
184
185 /* Cell subtypes: csub */
186 #define CFREE 7
187 #define CCOPY 6
188 #define CCON 5
189 #define CTEMP 4
190 #define CNAME 3
191 #define CVAR 2
192 #define CFLD 1
193
194 /* bool subtypes */
195 #define BTRUE 11
196 #define BFALSE 12
197
198 /* jump subtypes */
199 #define JEXIT 21
200 #define JNEXT 22
201 #define JBREAK 23
202 #define JCONT 24
203 #define JRET 25
204
205 /* node types */
206 #define NVALUE 1
207 #define NSTAT 2
208 #define NEXPR 3
209 #define NFIELD 4
210
211 extern Cell *(*proctab[])(Node **, int);
212 extern Cell *nullproc(Node **, int);
213 extern int pairstack[], paircnt;
214
215 extern Node *stat1(int, Node *), *stat2(int, Node *, Node *);
216 extern Node *stat3(int, Node *, Node *, Node *);
217 extern Node *stat4(int, Node *, Node *, Node *, Node *);
218 extern Node *pa2stat(Node *, Node *, Node *);
219 extern Node *op1(int, Node *), *op2(int, Node *, Node *);
220 extern Node *op3(int, Node *, Node *, Node *);
221 extern Node *op4(int, Node *, Node *, Node *, Node *);
222 extern Node *linkum(Node *, Node *), *valtonode(Cell *, int);
223 extern Node *rectonode(void), *exptostat(Node *);
224 extern Node *makearr(Node *);
225
226 #define notlegal(n) \
227 (n <= FIRSTTOKEN || n >= LASTTOKEN || proctab[n-FIRSTTOKEN] == nullproc)
228 #define isvalue(n) ((n)->ntype == NVALUE)
229 #define isexpr(n) ((n)->ntype == NEXPR)
230 #define isjump(n) ((n)->ctype == OJUMP)
231 #define isexit(n) ((n)->csub == JEXIT)
232 #define isbreak(n) ((n)->csub == JBREAK)
233 #define iscont(n) ((n)->csub == JCONT)
234 #define isnext(n) ((n)->csub == JNEXT)
235 #define isret(n) ((n)->csub == JRET)
236 #define isstr(n) ((n)->tval & STR)
237 #define isnum(n) ((n)->tval & NUM)
238 #define isarr(n) ((n)->tval & ARR)
239 #define isfunc(n) ((n)->tval & FCN)
240 #define istrue(n) ((n)->csub == BTRUE)
241 #define istemp(n) ((n)->csub == CTEMP)
242
243 #define NCHARS (256+1)
244 #define NSTATES 32
245
246 typedef struct rrow {
247 int ltype;
248 int lval;
249 int *lfollow;
250 } rrow;
251
252 typedef struct fa {
253 uchar *restr;
254 int anchor;
255 int use;
256 uchar gototab[NSTATES][NCHARS];
257 int *posns[NSTATES];
258 uchar out[NSTATES];
259 int initstat;
260 int curstat;
261 int accept;
262 int reset;
263 struct rrow re[1];
264 } fa;
265
266 /* b.c */
267 extern fa *makedfa(uchar *, int);
268 extern int nematch(fa *, uchar *);
269 extern int match(fa *, uchar *);
270 extern int pmatch(fa *, uchar *);
271
272 /* lib.c */
273 extern int isclvar(uchar *);
274 extern int is_number(uchar *);
275 extern void setclvar(uchar *);
276 extern int readrec(uchar **, size_t *, FILE *);
277 extern void bracecheck(void);
278 extern void syminit(void);
279 extern void yyerror(char *);
280 extern void fldbld(void);
281 extern void recbld(void);
282 extern int getrec(uchar **, size_t *);
283 extern Cell *fieldadr(int);
284 extern void newfld(int);
285 extern Cell *getfld(int);
286 extern int fldidx(Cell *);
287 extern double errcheck(double, char *);
288 extern void fpecatch(int);
289 extern void init_buf(uchar **, size_t *, size_t);
290 extern void adjust_buf(uchar **, size_t);
291 extern void r_expand_buf(uchar **, size_t *, size_t);
292
293 extern int donefld;
294 extern int donerec;
295 extern uchar *record;
296 extern size_t record_size;
297
298 /* main.c */
299 extern int dbg;
300 extern uchar *cmdname;
301 extern uchar *lexprog;
302 extern int compile_time;
303 extern char radixpoint;
304
305 /* tran.c */
306 extern void syminit(void);
307 extern void arginit(int, uchar **);
308 extern void envinit(uchar **);
309 extern void freesymtab(Cell *);
310 extern void freeelem(Cell *, uchar *);
311 extern void funnyvar(Cell *, char *);
312 extern int hash(uchar *, int);
313 extern Awkfloat *ARGC;
314
315 /* run.c */
316 extern void run(Node *);
317
318 extern int paircnt;
319 extern Node *winner;
320
321 #ifndef input
322 extern int input(void);
323 #endif
324 extern int yyparse(void);
325 extern FILE *yyin;
326 extern off_t lineno;
327
328 /* proc */
329 extern Cell *nullproc(Node **, int);
330 extern Cell *program(Node **, int);
331 extern Cell *boolop(Node **, int);
332 extern Cell *relop(Node **, int);
333 extern Cell *array(Node **, int);
334 extern Cell *indirect(Node **, int);
335 extern Cell *substr(Node **, int);
336 extern Cell *sub(Node **, int);
337 extern Cell *gsub(Node **, int);
338 extern Cell *sindex(Node **, int);
339 extern Cell *a_sprintf(Node **, int);
340 extern Cell *arith(Node **, int);
341 extern Cell *incrdecr(Node **, int);
342 extern Cell *cat(Node **, int);
343 extern Cell *pastat(Node **, int);
344 extern Cell *dopa2(Node **, int);
345 extern Cell *matchop(Node **, int);
346 extern Cell *intest(Node **, int);
347 extern Cell *aprintf(Node **, int);
348 extern Cell *print(Node **, int);
349 extern Cell *closefile(Node **, int);
350 extern Cell *delete(Node **, int);
351 extern Cell *split(Node **, int);
352 extern Cell *assign(Node **, int);
353 extern Cell *condexpr(Node **, int);
354 extern Cell *ifstat(Node **, int);
355 extern Cell *whilestat(Node **, int);
356 extern Cell *forstat(Node **, int);
357 extern Cell *dostat(Node **, int);
358 extern Cell *instat(Node **, int);
359 extern Cell *jump(Node **, int);
360 extern Cell *bltin(Node **, int);
361 extern Cell *call(Node **, int);
362 extern Cell *arg(Node **, int);
363 extern Cell *getnf(Node **, int);
364 extern Cell *getaline(Node **, int);
365
366 #endif /* AWK_H */
|
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
24 */
25
26 /*
27 * Copyright (C) Lucent Technologies 1997
28 * All Rights Reserved
29 *
30 * Permission to use, copy, modify, and distribute this software and
31 * its documentation for any purpose and without fee is hereby
32 * granted, provided that the above copyright notice appear in all
33 * copies and that both that the copyright notice and this
34 * permission notice and warranty disclaimer appear in supporting
35 * documentation, and that the name Lucent Technologies or any of
36 * its entities not be used in advertising or publicity pertaining
37 * to distribution of the software without specific, written prior
38 * permission.
39 *
40 * LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
41 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
42 * IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
43 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
44 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
45 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
46 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
47 * THIS SOFTWARE.
48 */
49
50 #ifndef AWK_H
51 #define AWK_H
52
53 #include <sys/types.h>
54 #include <assert.h>
55 #include <ctype.h>
56 #include <stdio.h>
57 #include <stdlib.h>
58 #include <string.h>
59 #include <libintl.h>
60 #include <limits.h>
61
62 typedef double Awkfloat;
63 typedef unsigned char uchar;
64
65 #define xfree(a) { if ((a) != NULL) { free((void *)(a)); (a) = NULL; } }
66
67 #define DEBUG
68 #ifdef DEBUG
69 /* uses have to be doubly parenthesized */
70 #define dprintf(x) if (dbg) (void) printf x
71 #else
72 #define dprintf(x)
73 #endif
74
75 extern int compile_time; /* 1 if compiling, 0 if running */
76 extern int safe; /* 0 => unsafe, 1 => safe */
77
78 #define RECSIZE (8 * 1024) /* sets limit on records, fields, etc., etc. */
79
80 extern uchar **FS;
81 extern uchar **RS;
82 extern uchar **ORS;
83 extern uchar **OFS;
84 extern uchar **OFMT;
85 extern Awkfloat *NR;
86 extern Awkfloat *FNR;
87 extern Awkfloat *NF;
88 extern uchar **FILENAME;
89 extern uchar **SUBSEP;
90 extern Awkfloat *RSTART;
91 extern Awkfloat *RLENGTH;
92
93 extern uchar *record;
94 extern size_t record_size;
95 extern int errorflag;
96 extern int donefld; /* 1 if record broken into fields */
97 extern int donerec; /* 1 if record is valid (no fld has changed */
98
99 extern uchar *patbeg; /* beginning of pattern matched */
100 extern int patlen; /* length. set in b.c */
101
102 /* Cell: all information about a variable or constant */
103
104 typedef struct Cell {
105 uchar ctype; /* OCELL, OBOOL, OJUMP, etc. */
106 uchar csub; /* CCON, CTEMP, CFLD, etc. */
107 uchar *nval; /* name, for variables only */
108 uchar *sval; /* string value */
109 Awkfloat fval; /* value as number */
110 int tval;
111 /* type info: STR|NUM|ARR|FCN|FLD|CON|DONTFREE */
112 struct Cell *cnext; /* ptr to next if chained */
113 } Cell;
114
115 typedef struct Array { /* symbol table array */
116 int nelem; /* elements in table right now */
117 int size; /* size of tab */
118 Cell **tab; /* hash table pointers */
119 } Array;
120
121 #define NSYMTAB 50 /* initial size of a symbol table */
122 extern Array *symtab, *makesymtab(int);
123 extern Cell *setsymtab(const uchar *, const uchar *, Awkfloat,
124 unsigned int, Array *);
125 extern Cell *lookup(const uchar *, Array *);
126
127 extern Cell *recloc; /* location of input record */
128 extern Cell *nrloc; /* NR */
129 extern Cell *fnrloc; /* FNR */
130 extern Cell *nfloc; /* NF */
131 extern Cell *rstartloc; /* RSTART */
132 extern Cell *rlengthloc; /* RLENGTH */
133
134 /* Cell.tval values: */
135 #define NUM 01 /* number value is valid */
136 #define STR 02 /* string value is valid */
137 #define DONTFREE 04 /* string space is not freeable */
138 #define CON 010 /* this is a constant */
139 #define ARR 020 /* this is an array */
140 #define FCN 040 /* this is a function name */
141 #define FLD 0100 /* this is a field $1, $2, ... */
142 #define REC 0200 /* this is $0 */
143
144
145 extern Awkfloat setfval(Cell *, Awkfloat), getfval(Cell *), r_getfval(Cell *);
146 extern uchar *setsval(Cell *, const uchar *);
147 extern uchar *getsval(Cell *);
148 extern uchar *tostring(const uchar *);
149 extern uchar *tokname(int);
150 extern uchar *qstring(const uchar *, int);
151
152 /* function types */
153 #define FLENGTH 1
154 #define FSQRT 2
155 #define FEXP 3
156 #define FLOG 4
157 #define FINT 5
158 #define FSYSTEM 6
159 #define FRAND 7
160 #define FSRAND 8
161 #define FSIN 9
162 #define FCOS 10
163 #define FATAN 11
164 #define FTOUPPER 12
165 #define FTOLOWER 13
166 #define FFLUSH 14
167
168 /* Node: parse tree is made of nodes, with Cell's at bottom */
169
170 typedef struct Node {
171 int ntype;
172 struct Node *nnext;
173 off_t lineno;
174 int nobj;
175 struct Node *narg[1];
176 /* variable: actual size set by calling malloc */
177 } Node;
178
179 #define NIL ((Node *)0)
180
181 extern Node *winner;
182 extern Node *nullstat;
183 extern Node *nullnode;
184
185 /* ctypes */
186 #define OCELL 1
187 #define OBOOL 2
188 #define OJUMP 3
189
190 /* Cell subtypes: csub */
191 #define CFREE 7
192 #define CCOPY 6
193 #define CCON 5
194 #define CTEMP 4
195 #define CNAME 3
196 #define CVAR 2
197 #define CFLD 1
198 #define CUNK 0
199
200 /* bool subtypes */
201 #define BTRUE 11
202 #define BFALSE 12
203
204 /* jump subtypes */
205 #define JEXIT 21
206 #define JNEXT 22
207 #define JBREAK 23
208 #define JCONT 24
209 #define JRET 25
210 #define JNEXTFILE 26
211
212 /* node types */
213 #define NVALUE 1
214 #define NSTAT 2
215 #define NEXPR 3
216 #define NFIELD 4
217
218 extern Cell *(*proctab[])(Node **, int);
219 extern Cell *nullproc(Node **, int);
220 extern int pairstack[], paircnt;
221
222 extern int pgetc(void);
223 extern Node *stat1(int, Node *);
224 extern Node *stat2(int, Node *, Node *);
225 extern Node *stat3(int, Node *, Node *, Node *);
226 extern Node *stat4(int, Node *, Node *, Node *, Node *);
227 extern Node *pa2stat(Node *, Node *, Node *);
228 extern Node *op1(int, Node *);
229 extern Node *op2(int, Node *, Node *);
230 extern Node *op3(int, Node *, Node *, Node *);
231 extern Node *op4(int, Node *, Node *, Node *, Node *);
232 extern Node *linkum(Node *, Node *);
233 extern Node *celltonode(Cell *, int);
234 extern Node *rectonode(void), *exptostat(Node *);
235 extern Node *makearr(Node *);
236 extern Node *itonp(int);
237
238 #define notlegal(n) \
239 (n <= FIRSTTOKEN || n >= LASTTOKEN || proctab[n-FIRSTTOKEN] == nullproc)
240 #define isvalue(n) ((n)->ntype == NVALUE)
241 #define isexpr(n) ((n)->ntype == NEXPR)
242 #define isjump(n) ((n)->ctype == OJUMP)
243 #define isexit(n) ((n)->csub == JEXIT)
244 #define isbreak(n) ((n)->csub == JBREAK)
245 #define iscont(n) ((n)->csub == JCONT)
246 #define isnext(n) ((n)->csub == JNEXT || (n)->csub == JNEXTFILE)
247 #define isret(n) ((n)->csub == JRET)
248 #define isrec(n) ((n)->tval & REC)
249 #define isfld(n) ((n)->tval & FLD)
250 #define isstr(n) ((n)->tval & STR)
251 #define isnum(n) ((n)->tval & NUM)
252 #define isarr(n) ((n)->tval & ARR)
253 #define isfcn(n) ((n)->tval & FCN)
254 #define istrue(n) ((n)->csub == BTRUE)
255 #define istemp(n) ((n)->csub == CTEMP)
256 #define isargument(n) ((n)->nobj == ARG)
257 /* #define freeable(p) (!((p)->tval & DONTFREE)) */
258 #define freeable(p) (((p)->tval & (STR|DONTFREE)) == STR)
259
260 #define NCHARS (256+3) /* 256 handles 8-bit chars; 128 does 7-bit */
261 /* watch out in match(), etc. */
262 #define NSTATES 32
263
264 typedef struct rrow {
265 long ltype; /* long avoids pointer warnings on 64-bit */
266 union {
267 int i;
268 Node *np;
269 uchar *up;
270 } lval; /* because Al stores a pointer in it! */
271 int *lfollow;
272 } rrow;
273
274 typedef struct fa {
275 uchar gototab[NSTATES][NCHARS];
276 uchar out[NSTATES];
277 uchar *restr;
278 int *posns[NSTATES];
279 int anchor;
280 int use;
281 int initstat;
282 int curstat;
283 int accept;
284 int reset;
285 struct rrow re[1]; /* variable: actual size set by calling malloc */
286 } fa;
287
288 /* b.c */
289 extern fa *makedfa(const uchar *, int);
290 extern int nematch(fa *, const uchar *);
291 extern int match(fa *, const uchar *);
292 extern int pmatch(fa *, const uchar *);
293
294 /* lex.c */
295 extern void unput(int);
296 extern void unputstr(const char *);
297 extern void startreg(void);
298
299 /* lib.c */
300 extern void recinit(unsigned int);
301 extern void growfldtab(int);
302 extern int isclvar(const uchar *);
303 extern int is_number(const uchar *);
304 extern void setclvar(uchar *);
305 extern int readrec(uchar **, size_t *, FILE *);
306 extern void bracecheck(void);
307 extern void syminit(void);
308 extern void yyerror(char *);
309 extern void fldbld(void);
310 extern void recbld(void);
311 extern int getrec(uchar **, size_t *, int);
312 extern Cell *fieldadr(int);
313 extern void newfld(int);
314 extern Cell *getfld(int);
315 extern int fldidx(Cell *);
316 extern void SYNTAX(const char *, ...);
317 extern void FATAL(const char *, ...) __attribute__((__noreturn__));
318 extern void WARNING(const char *, ...);
319 extern void error(void);
320 extern double errcheck(double, const char *);
321 extern void fpecatch(int);
322 extern void nextfile(void);
323
324 extern int donefld;
325 extern int donerec;
326 extern uchar *record;
327 extern size_t record_size;
328
329 /* main.c */
330 extern int dbg;
331 extern uchar *cmdname;
332 extern uchar *lexprog;
333 extern int compile_time;
334 extern char radixpoint;
335 extern uchar *cursource(void);
336
337 /* tran.c */
338 extern void syminit(void);
339 extern void arginit(int, uchar **);
340 extern void envinit(uchar **);
341 extern void freesymtab(Cell *);
342 extern void freeelem(Cell *, const uchar *);
343 extern void funnyvar(Cell *, char *);
344 extern int hash(const uchar *, int);
345 extern Awkfloat *ARGC;
346
347 /* run.c */
348 extern int adjbuf(uchar **, size_t *, int, int, uchar **, const char *);
349 extern void run(Node *);
350
351 extern int paircnt;
352 extern Node *winner;
353
354 #ifndef input
355 extern int input(void);
356 #endif
357 extern int yyparse(void);
358 extern FILE *yyin;
359 extern off_t lineno;
360
361 /* parse.c */
362 extern int ptoi(void *);
363 extern int isarg(const uchar *);
364 extern void defn(Cell *, Node *, Node *);
365
366 /* proc */
367 extern Cell *nullproc(Node **, int);
368 extern Cell *program(Node **, int);
369 extern Cell *boolop(Node **, int);
370 extern Cell *relop(Node **, int);
371 extern Cell *array(Node **, int);
372 extern Cell *indirect(Node **, int);
373 extern Cell *substr(Node **, int);
374 extern Cell *sub(Node **, int);
375 extern Cell *gsub(Node **, int);
376 extern Cell *sindex(Node **, int);
377 extern Cell *awksprintf(Node **, int);
378 extern Cell *arith(Node **, int);
379 extern Cell *incrdecr(Node **, int);
380 extern Cell *cat(Node **, int);
381 extern Cell *pastat(Node **, int);
382 extern Cell *dopa2(Node **, int);
383 extern Cell *matchop(Node **, int);
384 extern Cell *intest(Node **, int);
385 extern Cell *awkprintf(Node **, int);
386 extern Cell *printstat(Node **, int);
387 extern Cell *closefile(Node **, int);
388 extern Cell *awkdelete(Node **, int);
389 extern Cell *split(Node **, int);
390 extern Cell *assign(Node **, int);
391 extern Cell *condexpr(Node **, int);
392 extern Cell *ifstat(Node **, int);
393 extern Cell *whilestat(Node **, int);
394 extern Cell *forstat(Node **, int);
395 extern Cell *dostat(Node **, int);
396 extern Cell *instat(Node **, int);
397 extern Cell *jump(Node **, int);
398 extern Cell *bltin(Node **, int);
399 extern Cell *call(Node **, int);
400 extern Cell *arg(Node **, int);
401 extern Cell *getnf(Node **, int);
402 extern Cell *awkgetline(Node **, int);
403
404 #endif /* AWK_H */
|