165392Sbostic /****************************************************************
265392Sbostic Copyright (C) AT&T 1993
365392Sbostic All Rights Reserved
465392Sbostic 
565392Sbostic Permission to use, copy, modify, and distribute this software and
665392Sbostic its documentation for any purpose and without fee is hereby
765392Sbostic granted, provided that the above copyright notice appear in all
865392Sbostic copies and that both that the copyright notice and this
965392Sbostic permission notice and warranty disclaimer appear in supporting
1065392Sbostic documentation, and that the name of AT&T or any of its entities
1165392Sbostic not be used in advertising or publicity pertaining to
1265392Sbostic distribution of the software without specific, written prior
1365392Sbostic permission.
1465392Sbostic 
1565392Sbostic AT&T DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
1665392Sbostic INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
1765392Sbostic IN NO EVENT SHALL AT&T OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
1865392Sbostic SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1965392Sbostic WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
2065392Sbostic IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
2165392Sbostic ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
2265392Sbostic THIS SOFTWARE.
2365392Sbostic ****************************************************************/
2465392Sbostic 
2565392Sbostic extern	void	setfname(Cell *);
2665392Sbostic extern	int	constnode(Node *);
2765392Sbostic extern	uchar	*strnode(Node *);
2865392Sbostic extern	Node	*notnull(Node *);
2965392Sbostic extern	int	yyparse(void);
3065392Sbostic 
3165392Sbostic extern	int	yylex(void);
3265392Sbostic extern	void	startreg(void);
33*65396Sbostic extern	int	lex_input(void);
3465392Sbostic extern	void	unputstr(char *);
3565392Sbostic 
3665392Sbostic extern	fa	*makedfa(uchar *, int);
3765392Sbostic extern	fa	*mkdfa(uchar *, int);
3865392Sbostic extern	int	makeinit(fa *, int);
3965392Sbostic extern	void	penter(Node *);
4065392Sbostic extern	void	freetr(Node *);
4165392Sbostic extern	int	hexstr(char **);
4265392Sbostic extern	int	quoted(char **);
4365392Sbostic extern	uchar	*cclenter(uchar *);
4465392Sbostic extern	void	overflo(uchar *);
4565392Sbostic extern	void	cfoll(fa *, Node *);
4665392Sbostic extern	int	first(Node *);
4765392Sbostic extern	void	follow(Node *);
4865392Sbostic extern	int	member(int, uchar *);
4965392Sbostic extern	int	match(fa *, uchar *);
5065392Sbostic extern	int	pmatch(fa *, uchar *);
5165392Sbostic extern	int	nematch(fa *, uchar *);
5265392Sbostic extern	Node	*reparse(uchar *);
5365392Sbostic extern	Node	*regexp(void);
5465392Sbostic extern	Node	*primary(void);
5565392Sbostic extern	Node	*concat(Node *);
5665392Sbostic extern	Node	*alt(Node *);
5765392Sbostic extern	Node	*unary(Node *);
5865392Sbostic extern	int	relex(void);
5965392Sbostic extern	int	cgoto(fa *, int, int);
6065392Sbostic extern	void	freefa(fa *);
6165392Sbostic 
6265392Sbostic extern	int	main(int, uchar **);
6365392Sbostic extern	int	pgetc(void);
64*65396Sbostic extern	void	init_input_source(void);
6565392Sbostic 
6665392Sbostic extern	Node	*nodealloc(int);
6765392Sbostic extern	Node	*exptostat(Node *);
6865392Sbostic extern	Node	*node1(int, Node *);
6965392Sbostic extern	Node	*node2(int, Node *, Node *);
7065392Sbostic extern	Node	*node3(int, Node *, Node *, Node *);
7165392Sbostic extern	Node	*node4(int, Node *, Node *, Node *, Node *);
7265392Sbostic extern	Node	*stat3(int, Node *, Node *, Node *);
7365392Sbostic extern	Node	*op2(int, Node *, Node *);
7465392Sbostic extern	Node	*op1(int, Node *);
7565392Sbostic extern	Node	*stat1(int, Node *);
7665392Sbostic extern	Node	*op3(int, Node *, Node *, Node *);
7765392Sbostic extern	Node	*op4(int, Node *, Node *, Node *, Node *);
7865392Sbostic extern	Node	*stat2(int, Node *, Node *);
7965392Sbostic extern	Node	*stat4(int, Node *, Node *, Node *, Node *);
8065392Sbostic extern	Node	*valtonode(Cell *, int);
8165392Sbostic extern	Node	*rectonode(void);
8265392Sbostic extern	Node	*makearr(Node *);
8365392Sbostic extern	Node	*pa2stat(Node *, Node *, Node *);
8465392Sbostic extern	Node	*linkum(Node *, Node *);
8565392Sbostic extern	void	defn(Cell *, Node *, Node *);
8665392Sbostic extern	int	isarg(uchar *);
8765392Sbostic extern	uchar	*tokname(int);
8865392Sbostic extern	Cell *(*proctab[])(Node **, int);
8965392Sbostic 
9065392Sbostic extern	void	syminit(void);
9165392Sbostic extern	void	arginit(int, uchar **);
9265392Sbostic extern	void	envinit(uchar **);
9365392Sbostic extern	Array	*makesymtab(int);
9465392Sbostic extern	void	freesymtab(Cell *);
9565392Sbostic extern	void	freeelem(Cell *, uchar *);
9665392Sbostic extern	Cell	*setsymtab(uchar *, uchar *, double, unsigned int, Array *);
9765392Sbostic extern	int	hash(uchar *, int);
9865392Sbostic extern	void	rehash(Array *);
9965392Sbostic extern	Cell	*lookup(uchar *, Array *);
10065392Sbostic extern	double	setfval(Cell *, double);
10165392Sbostic extern	void	funnyvar(Cell *, char *);
10265392Sbostic extern	uchar	*setsval(Cell *, uchar *);
10365392Sbostic extern	double	r_getfval(Cell *);
10465392Sbostic extern	uchar	*r_getsval(Cell *);
10565392Sbostic extern	uchar	*tostring(uchar *);
10665392Sbostic extern	uchar	*qstring(uchar *, int);
10765392Sbostic 
10865392Sbostic extern	void	recinit(unsigned int);
10965392Sbostic extern	void	initgetrec(void);
11065392Sbostic extern	int	getrec(uchar *);
11165392Sbostic extern	int	readrec(uchar *buf, int bufsize, FILE *inf);
11265392Sbostic extern	uchar	*getargv(int);
11365392Sbostic extern	void	setclvar(uchar *);
11465392Sbostic extern	void	fldbld(void);
11565392Sbostic extern	void	cleanfld(int, int);
11665392Sbostic extern	void	newfld(int);
11765392Sbostic extern	int	refldbld(uchar *, uchar *);
11865392Sbostic extern	void	recbld(void);
11965392Sbostic extern	Cell	*fieldadr(int);
12065392Sbostic extern	void	yyerror(char *);
12165392Sbostic extern	void	fpecatch(int);
12265392Sbostic extern	void	bracecheck(void);
12365392Sbostic extern	void	bcheck2(int, int, int);
12465392Sbostic extern	void	error(int, char *);
12565392Sbostic extern	void	eprint(void);
12665392Sbostic extern	void	bclass(int);
12765392Sbostic extern	double	errcheck(double, uchar *);
12865392Sbostic extern	int	isclvar(uchar *);
129*65396Sbostic extern	int	is_a_number(uchar *);
13065392Sbostic 
13165392Sbostic extern	void	run(Node *);
13265392Sbostic extern	Cell	*r_execute(Node *);
13365392Sbostic extern	Cell	*program(Node **, int);
13465392Sbostic extern	Cell	*call(Node **, int);
13565392Sbostic extern	Cell	*copycell(Cell *);
13665392Sbostic extern	Cell	*arg(Node **, int);
13765392Sbostic extern	Cell	*jump(Node **, int);
13865392Sbostic extern	Cell	*getline(Node **, int);
13965392Sbostic extern	Cell	*getnf(Node **, int);
14065392Sbostic extern	Cell	*array(Node **, int);
14165392Sbostic extern	Cell	*adelete(Node **, int);
14265392Sbostic extern	Cell	*intest(Node **, int);
14365392Sbostic extern	Cell	*matchop(Node **, int);
14465392Sbostic extern	Cell	*boolop(Node **, int);
14565392Sbostic extern	Cell	*relop(Node **, int);
14665392Sbostic extern	void	tfree(Cell *);
14765392Sbostic extern	Cell	*gettemp(void);
14865392Sbostic extern	Cell	*field(Node **, int);
14965392Sbostic extern	Cell	*indirect(Node **, int);
15065392Sbostic extern	Cell	*substr(Node **, int);
15165392Sbostic extern	Cell	*sindex(Node **, int);
15265392Sbostic extern	int	format(uchar *, int, uchar *, Node *);
15365392Sbostic extern	Cell	*asprintf(Node **, int);
15465392Sbostic extern	Cell	*aprintf(Node **, int);
15565392Sbostic extern	Cell	*arith(Node **, int);
15665392Sbostic extern	double	ipow(double, int);
15765392Sbostic extern	Cell	*incrdecr(Node **, int);
15865392Sbostic extern	Cell	*assign(Node **, int);
15965392Sbostic extern	Cell	*cat(Node **, int);
16065392Sbostic extern	Cell	*pastat(Node **, int);
16165392Sbostic extern	Cell	*dopa2(Node **, int);
16265392Sbostic extern	Cell	*split(Node **, int);
16365392Sbostic extern	Cell	*condexpr(Node **, int);
16465392Sbostic extern	Cell	*ifstat(Node **, int);
16565392Sbostic extern	Cell	*whilestat(Node **, int);
16665392Sbostic extern	Cell	*dostat(Node **, int);
16765392Sbostic extern	Cell	*forstat(Node **, int);
16865392Sbostic extern	Cell	*instat(Node **, int);
16965392Sbostic extern	Cell	*bltin(Node **, int);
17065392Sbostic extern	Cell	*printstat(Node **, int);
17165392Sbostic extern	Cell	*nullproc(Node **, int);
17265392Sbostic extern	FILE	*redirect(int, Node *);
17365392Sbostic extern	FILE	*openfile(int, uchar *);
17465392Sbostic extern	uchar	*filename(FILE *);
17565392Sbostic extern	Cell	*closefile(Node **, int);
17665392Sbostic extern	void	closeall(void);
17765392Sbostic extern	Cell	*sub(Node **, int);
17865392Sbostic extern	Cell	*gsub(Node **, int);
17965392Sbostic 
18065392Sbostic extern	FILE	*popen(const char *, const char *);
18165392Sbostic extern	int	pclose(FILE *);
182