1/****************************************************************
2Copyright (C) Lucent Technologies 1997
3All Rights Reserved
4
5Permission to use, copy, modify, and distribute this software and
6its documentation for any purpose and without fee is hereby
7granted, provided that the above copyright notice appear in all
8copies and that both that the copyright notice and this
9permission notice and warranty disclaimer appear in supporting
10documentation, and that the name Lucent Technologies or any of
11its entities not be used in advertising or publicity pertaining
12to distribution of the software without specific, written prior
13permission.
14
15LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
17IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
18SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
20IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
21ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
22THIS SOFTWARE.
23****************************************************************/
24
25extern	int	yywrap(void);
26extern	void	setfname(Cell *);
27extern	int	constnode(Node *);
28extern	char	*strnode(Node *);
29extern	Node	*notnull(Node *);
30extern	int	yyparse(void);
31
32extern	int	yylex(void);
33extern	void	startreg(void);
34extern	int	input(void);
35extern	void	unput(int);
36extern	void	unputstr(const char *);
37extern	int	yylook(void);
38extern	int	yyback(int *, int);
39extern	int	yyinput(void);
40
41extern	fa	*makedfa(const char *, int);
42extern	fa	*mkdfa(const char *, int);
43extern	int	makeinit(fa *, int);
44extern	void	penter(Node *);
45extern	void	freetr(Node *);
46extern	int	hexstr(const uschar **);
47extern	int	quoted(const uschar **);
48extern	char	*cclenter(const char *);
49extern	void	overflo(const char *) __dead;
50extern	void	cfoll(fa *, Node *);
51extern	int	first(Node *);
52extern	void	follow(Node *);
53extern	int	member(int, const char *);
54extern	int	match(fa *, const char *);
55extern	int	pmatch(fa *, const char *);
56extern	int	nematch(fa *, const char *);
57extern	int	fnematch(fa *, FILE *, uschar **, int *, int);
58extern	Node	*reparse(const char *);
59extern	Node	*regexp(void);
60extern	Node	*primary(void);
61extern	Node	*concat(Node *);
62extern	Node	*alt(Node *);
63extern	Node	*unary(Node *);
64extern	int	relex(void);
65extern	int	cgoto(fa *, int, int);
66extern	void	freefa(fa *);
67
68extern	int	pgetc(void);
69extern	char	*cursource(void);
70
71extern	Node	*nodealloc(int);
72extern	Node	*exptostat(Node *);
73extern	Node	*node1(int, Node *);
74extern	Node	*node2(int, Node *, Node *);
75extern	Node	*node3(int, Node *, Node *, Node *);
76extern	Node	*node4(int, Node *, Node *, Node *, Node *);
77extern	Node	*node5(int, Node *, Node *, Node *, Node *, Node *);
78extern	Node	*stat3(int, Node *, Node *, Node *);
79extern	Node	*op2(int, Node *, Node *);
80extern	Node	*op1(int, Node *);
81extern	Node	*stat1(int, Node *);
82extern	Node	*op3(int, Node *, Node *, Node *);
83extern	Node	*op4(int, Node *, Node *, Node *, Node *);
84extern	Node	*op5(int, Node *, Node *, Node *, Node *, Node *);
85extern	Node	*stat2(int, Node *, Node *);
86extern	Node	*stat4(int, Node *, Node *, Node *, Node *);
87extern	Node	*celltonode(Cell *, int);
88extern	Node	*rectonode(void);
89extern	Node	*makearr(Node *);
90extern	Node	*pa2stat(Node *, Node *, Node *);
91extern	Node	*linkum(Node *, Node *);
92extern	void	defn(Cell *, Node *, Node *);
93extern	int	isarg(const char *);
94extern	const char	*tokname(int);
95extern	Cell	*(*proctab[])(Node **, int);
96extern	int	ptoi(void *);
97extern	Node	*itonp(int);
98
99extern	void	syminit(void);
100extern	void	arginit(int, char **);
101extern	void	envinit(char **);
102extern	Array	*makesymtab(int);
103extern	void	freesymtab(Cell *);
104extern	void	freeelem(Cell *, const char *);
105extern	Cell	*setsymtab(const char *, const char *, double, unsigned int, Array *);
106extern	int	hash(const char *, int);
107extern	void	rehash(Array *);
108extern	Cell	*lookup(const char *, Array *);
109extern	double	setfval(Cell *, double);
110extern	void	funnyvar(Cell *, const char *);
111extern	char	*setsval(Cell *, const char *);
112extern	double	getfval(Cell *);
113extern	char	*getsval(Cell *);
114extern	char	*getpssval(Cell *);     /* for print */
115extern	char	*tostring(const char *);
116extern	char	*tostringN(const char *, size_t n);
117extern	char	*qstring(const char *, int);
118extern	Cell	*catstr(Cell *, Cell *);
119
120extern	void	recinit(unsigned int);
121extern	void	initgetrec(void);
122extern	void	makefields(int, int);
123extern	void	growfldtab(int n);
124extern	int	getrec(uschar **, int *, int);
125extern	void	nextfile(void);
126extern	int	readrec(uschar **buf, int *bufsize, FILE *inf, int newflag);
127extern	char	*getargv(int);
128extern	void	setclvar(char *);
129extern	void	fldbld(void);
130extern	void	cleanfld(int, int);
131extern	void	newfld(int);
132extern	void	setlastfld(int);
133extern	int	refldbld(const char *, const char *);
134extern	void	recbld(void);
135extern	Cell	*fieldadr(int);
136extern	void	yyerror(const char *);
137extern	void	bracecheck(void);
138extern	void	bcheck2(int, int, int);
139extern	void	SYNTAX(const char *, ...)
140    __attribute__((__format__(__printf__, 1, 2)));
141extern	void	FATAL(const char *, ...) __dead
142    __attribute__((__format__(__printf__, 1, 2)));
143extern	void	WARNING(const char *, ...)
144    __attribute__((__format__(__printf__, 1, 2)));
145extern	void	error(void);
146extern	void	eprint(void);
147extern	void	bclass(int);
148extern	double	errcheck(double, const char *);
149extern	int	isclvar(const char *);
150extern	int	is_number(const char *);
151
152extern	int	adjbuf(uschar **pb, int *sz, int min, int q, uschar **pbp, const char *what);
153extern	void	run(Node *);
154extern	Cell	*execute(Node *);
155extern	Cell	*program(Node **, int);
156extern	Cell	*call(Node **, int);
157extern	Cell	*copycell(Cell *);
158extern	Cell	*arg(Node **, int);
159extern	Cell	*jump(Node **, int);
160extern	Cell	*awkgetline(Node **, int);
161extern	Cell	*getnf(Node **, int);
162extern	Cell	*array(Node **, int);
163extern	Cell	*awkdelete(Node **, int);
164extern	Cell	*intest(Node **, int);
165extern	Cell	*matchop(Node **, int);
166extern	Cell	*boolop(Node **, int);
167extern	Cell	*relop(Node **, int);
168extern	void	tfree(Cell *);
169extern	Cell	*gettemp(void);
170extern	Cell	*field(Node **, int);
171extern	Cell	*indirect(Node **, int);
172extern	Cell	*substr(Node **, int);
173extern	Cell	*sindex(Node **, int);
174extern	int	format(char **, int *, const char *, Node *);
175extern	Cell	*awksprintf(Node **, int);
176extern	Cell	*awkprintf(Node **, int);
177extern	Cell	*arith(Node **, int);
178extern	double	ipow(double, int);
179extern	Cell	*incrdecr(Node **, int);
180extern	Cell	*assign(Node **, int);
181extern	Cell	*cat(Node **, int);
182extern	Cell	*pastat(Node **, int);
183extern	Cell	*dopa2(Node **, int);
184extern	Cell	*split(Node **, int);
185extern	Cell	*condexpr(Node **, int);
186extern	Cell	*ifstat(Node **, int);
187extern	Cell	*whilestat(Node **, int);
188extern	Cell	*dostat(Node **, int);
189extern	Cell	*forstat(Node **, int);
190extern	Cell	*instat(Node **, int);
191extern	Cell	*bltin(Node **, int);
192extern	Cell	*printstat(Node **, int);
193extern	Cell	*nullproc(Node **, int);
194extern	FILE	*redirect(int, Node *);
195extern	FILE	*openfile(int, const char *, int *);
196extern	const char	*filename(FILE *);
197extern	Cell	*closefile(Node **, int);
198extern	void	closeall(void);
199extern	Cell	*sub(Node **, int);
200extern	Cell	*gsub(Node **, int);
201extern	Cell	*gensub(Node **, int);
202
203extern	FILE	*popen(const char *, const char *);
204extern	int	pclose(FILE *);
205