1116742Ssam/**************************************************************** 2116904SsamCopyright (C) Lucent Technologies 1997 3186904SsamAll Rights Reserved 4116742Ssam 5116742SsamPermission to use, copy, modify, and distribute this software and 6116742Ssamits documentation for any purpose and without fee is hereby 7116742Ssamgranted, provided that the above copyright notice appear in all 8116742Ssamcopies and that both that the copyright notice and this 9116742Ssampermission notice and warranty disclaimer appear in supporting 10116742Ssamdocumentation, and that the name Lucent Technologies or any of 11116742Ssamits entities not be used in advertising or publicity pertaining 12116742Ssamto distribution of the software without specific, written prior 13116742Ssampermission. 14116742Ssam 15116904SsamLUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 16116904SsamINCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. 17116904SsamIN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY 18116904SsamSPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 19116904SsamWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER 20116904SsamIN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 21116904SsamARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 22116904SsamTHIS SOFTWARE. 23116904Ssam****************************************************************/ 24116904Ssam 25116904Ssamextern int yywrap(void); 26116742Ssamextern void setfname(Cell *); 27116742Ssamextern int constnode(Node *); 28116742Ssamextern char *strnode(Node *); 29116742Ssamextern Node *notnull(Node *); 30116742Ssamextern int yyparse(void); 31138568Ssam 32170530Ssamextern int yylex(void); 33116742Ssamextern void startreg(void); 34138568Ssamextern int input(void); 35178354Ssamextern void unput(int); 36178354Ssamextern void unputstr(const char *); 37178354Ssamextern int yylook(void); 38178354Ssamextern int yyback(int *, int); 39178354Ssamextern int yyinput(void); 40178354Ssam 41178354Ssamextern fa *makedfa(const char *, int); 42178354Ssamextern fa *mkdfa(const char *, int); 43178354Ssamextern int makeinit(fa *, int); 44178354Ssamextern void penter(Node *); 45138568Ssamextern void freetr(Node *); 46138568Ssamextern int hexstr(uschar **); 47138568Ssamextern int quoted(uschar **); 48138568Ssamextern char *cclenter(const char *); 49138568Ssamextern void overflo(const char *) __attribute__((__noreturn__)); 50138568Ssamextern void cfoll(fa *, Node *); 51138568Ssamextern int first(Node *); 52138568Ssamextern void follow(Node *); 53138568Ssamextern int member(int, const char *); 54170530Ssamextern int match(fa *, const char *); 55138568Ssamextern int pmatch(fa *, const char *); 56172211Ssamextern int nematch(fa *, const char *); 57172211Ssamextern Node *reparse(const char *); 58172211Ssamextern Node *regexp(void); 59116742Ssamextern Node *primary(void); 60116742Ssamextern Node *concat(Node *); 61116742Ssamextern Node *alt(Node *); 62170530Ssamextern Node *unary(Node *); 63138568Ssamextern int relex(void); 64116742Ssamextern int cgoto(fa *, int, int); 65138568Ssamextern void freefa(fa *); 66138568Ssam 67178354Ssamextern int pgetc(void); 68138568Ssamextern char *cursource(void); 69116742Ssam 70178354Ssamextern Node *nodealloc(int); 71178354Ssamextern Node *exptostat(Node *); 72178354Ssamextern Node *node1(int, Node *); 73178354Ssamextern Node *node2(int, Node *, Node *); 74178354Ssamextern Node *node3(int, Node *, Node *, Node *); 75178354Ssamextern Node *node4(int, Node *, Node *, Node *, Node *); 76178354Ssamextern Node *stat3(int, Node *, Node *, Node *); 77178354Ssamextern Node *op2(int, Node *, Node *); 78178354Ssamextern Node *op1(int, Node *); 79178354Ssamextern Node *stat1(int, Node *); 80178354Ssamextern Node *op3(int, Node *, Node *, Node *); 81178354Ssamextern Node *op4(int, Node *, Node *, Node *, Node *); 82178354Ssamextern Node *stat2(int, Node *, Node *); 83186904Ssamextern Node *stat4(int, Node *, Node *, Node *, Node *); 84178354Ssamextern Node *celltonode(Cell *, int); 85178354Ssamextern Node *rectonode(void); 86178354Ssamextern Node *makearr(Node *); 87178354Ssamextern Node *pa2stat(Node *, Node *, Node *); 88178354Ssamextern Node *linkum(Node *, Node *); 89178354Ssamextern void defn(Cell *, Node *, Node *); 90116742Ssamextern int isarg(const char *); 91116742Ssamextern char *tokname(int); 92116742Ssamextern Cell *(*proctab[])(Node **, int); 93116742Ssamextern int ptoi(void *); 94116742Ssamextern Node *itonp(int); 95116742Ssam 96178354Ssamextern void syminit(void); 97178354Ssamextern void arginit(int, char **); 98178354Ssamextern void envinit(char **); 99178354Ssamextern Array *makesymtab(int); 100178354Ssamextern void freesymtab(Cell *); 101178354Ssamextern void freeelem(Cell *, const char *); 102120483Ssamextern Cell *setsymtab(const char *, const char *, double, unsigned int, Array *); 103183252Ssamextern int hash(const char *, int); 104183252Ssamextern void rehash(Array *); 105183252Ssamextern Cell *lookup(const char *, Array *); 106183252Ssamextern double setfval(Cell *, double); 107183252Ssamextern void funnyvar(Cell *, const char *); 108183252Ssamextern char *setsval(Cell *, const char *); 109183252Ssamextern double getfval(Cell *); 110183252Ssamextern char *getsval(Cell *); 111183252Ssamextern char *getpssval(Cell *); /* for print */ 112183252Ssamextern char *tostring(const char *); 113183252Ssamextern char *qstring(const char *, int); 114183252Ssam 115183252Ssamextern void recinit(unsigned int); 116183255Ssamextern void initgetrec(void); 117183255Ssamextern void makefields(int, int); 118183256Ssamextern void growfldtab(int n); 119183257Ssamextern int getrec(char **, int *, int); 120183257Ssamextern void nextfile(void); 121186099Ssamextern int readrec(char **buf, int *bufsize, FILE *inf); 122183252Ssamextern char *getargv(int); 123183252Ssamextern void setclvar(char *); 124183252Ssamextern void fldbld(void); 125170530Ssamextern void cleanfld(int, int); 126170530Ssamextern void newfld(int); 127170530Ssamextern int refldbld(const char *, const char *); 128170530Ssamextern void recbld(void); 129170530Ssamextern Cell *fieldadr(int); 130170530Ssamextern void yyerror(const char *); 131170530Ssamextern void fpecatch(int); 132170530Ssamextern void bracecheck(void); 133183252Ssamextern void bcheck2(int, int, int); 134170530Ssamextern void SYNTAX(const char *, ...); 135183251Ssamextern void FATAL(const char *, ...) __attribute__((__noreturn__)); 136173273Ssamextern void WARNING(const char *, ...); 137170530Ssamextern void error(void); 138178354Ssamextern void eprint(void); 139172225Ssamextern void bclass(int); 140172225Ssamextern double errcheck(double, const char *); 141172225Ssamextern int isclvar(const char *); 142172225Ssamextern int is_number(const char *); 143170530Ssam 144138568Ssamextern int adjbuf(char **pb, int *sz, int min, int q, char **pbp, const char *what); 145138568Ssamextern void run(Node *); 146116742Ssamextern Cell *execute(Node *); 147116742Ssamextern Cell *program(Node **, int); 148170530Ssamextern Cell *call(Node **, int); 149178354Ssamextern Cell *copycell(Cell *); 150170530Ssamextern Cell *arg(Node **, int); 151116742Ssamextern Cell *jump(Node **, int); 152116742Ssamextern Cell *awkgetline(Node **, int); 153170530Ssamextern Cell *getnf(Node **, int); 154170530Ssamextern Cell *array(Node **, int); 155116742Ssamextern Cell *awkdelete(Node **, int); 156116742Ssamextern Cell *intest(Node **, int); 157138568Ssamextern Cell *matchop(Node **, int); 158170530Ssamextern Cell *boolop(Node **, int); 159178354Ssamextern Cell *relop(Node **, int); 160138568Ssamextern void tfree(Cell *); 161170530Ssamextern Cell *gettemp(void); 162170530Ssamextern Cell *field(Node **, int); 163170530Ssamextern Cell *indirect(Node **, int); 164170530Ssamextern Cell *substr(Node **, int); 165116742Ssamextern Cell *sindex(Node **, int); 166170530Ssamextern int format(char **, int *, const char *, Node *); 167170530Ssamextern Cell *awksprintf(Node **, int); 168170530Ssamextern Cell *awkprintf(Node **, int); 169178354Ssamextern Cell *arith(Node **, int); 170170530Ssamextern double ipow(double, int); 171170530Ssamextern Cell *incrdecr(Node **, int); 172170530Ssamextern Cell *assign(Node **, int); 173116742Ssamextern Cell *cat(Node **, int); 174170530Ssamextern Cell *pastat(Node **, int); 175170530Ssamextern Cell *dopa2(Node **, int); 176170530Ssamextern Cell *split(Node **, int); 177170530Ssamextern Cell *condexpr(Node **, int); 178170530Ssamextern Cell *ifstat(Node **, int); 179170530Ssamextern Cell *whilestat(Node **, int); 180170530Ssamextern Cell *dostat(Node **, int); 181170530Ssamextern Cell *forstat(Node **, int); 182170530Ssamextern Cell *instat(Node **, int); 183170530Ssamextern Cell *bltin(Node **, int); 184170530Ssamextern Cell *printstat(Node **, int); 185170530Ssamextern Cell *nullproc(Node **, int); 186116742Ssamextern FILE *redirect(int, Node *); 187138568Ssamextern FILE *openfile(int, const char *); 188138568Ssamextern const char *filename(FILE *); 189178354Ssamextern Cell *closefile(Node **, int); 190184288Ssamextern void closeall(void); 191138568Ssamextern Cell *sub(Node **, int); 192178354Ssamextern Cell *gsub(Node **, int); 193178354Ssam 194178354Ssamextern FILE *popen(const char *, const char *); 195178354Ssamextern int pclose(FILE *); 196116742Ssam