version 1.4, 1997/04/07 15:59:53 |
version 1.5, 1997/08/25 16:17:09 |
|
|
|
/* $OpenBSD$ */ |
/**************************************************************** |
/**************************************************************** |
Copyright (C) AT&T and Lucent Technologies 1996 |
Copyright (C) Lucent Technologies 1997 |
All Rights Reserved |
All Rights Reserved |
|
|
Permission to use, copy, modify, and distribute this software and |
Permission to use, copy, modify, and distribute this software and |
|
|
granted, provided that the above copyright notice appear in all |
granted, provided that the above copyright notice appear in all |
copies and that both that the copyright notice and this |
copies and that both that the copyright notice and this |
permission notice and warranty disclaimer appear in supporting |
permission notice and warranty disclaimer appear in supporting |
documentation, and that the names of AT&T or Lucent Technologies |
documentation, and that the name Lucent Technologies or any of |
or any of their entities not be used in advertising or publicity |
its entities not be used in advertising or publicity pertaining |
pertaining to distribution of the software without specific, |
to distribution of the software without specific, written prior |
written prior permission. |
permission. |
|
|
AT&T AND LUCENT DISCLAIM ALL WARRANTIES WITH REGARD TO THIS |
LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, |
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND |
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. |
FITNESS. IN NO EVENT SHALL AT&T OR LUCENT OR ANY OF THEIR |
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY |
ENTITIES BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL |
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, |
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER |
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR |
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, |
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE |
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF |
USE OR PERFORMANCE OF THIS SOFTWARE. |
THIS SOFTWARE. |
****************************************************************/ |
****************************************************************/ |
|
|
typedef double Awkfloat; |
typedef double Awkfloat; |
|
|
# define dprintf(x) |
# define dprintf(x) |
#endif |
#endif |
|
|
extern char errbuf[200]; |
extern char errbuf[]; |
#define ERROR sprintf(errbuf, |
#define ERROR sprintf(errbuf, |
#define FATAL ), error(1, errbuf) |
#define FATAL ), error(1, errbuf) |
#define WARNING ), error(0, errbuf) |
#define WARNING ), error(0, errbuf) |
#define SYNTAX ), yyerror(errbuf) |
#define SYNTAX ), yyerror(errbuf) |
|
|
extern int compile_time; /* 1 if compiling, 0 if running */ |
extern int compile_time; /* 1 if compiling, 0 if running */ |
|
extern int safe; /* 0 => unsafe, 1 => safe */ |
|
|
#define RECSIZE (3 * 1024) /* sets limit on records, fields, etc., etc. */ |
#define RECSIZE (8 * 1024) /* sets limit on records, fields, etc., etc. */ |
extern int recsize; /* variable version */ |
extern int recsize; /* size of current record, orig RECSIZE */ |
|
|
extern char **FS; |
extern char **FS; |
extern char **RS; |
extern char **RS; |
|
|
|
|
extern int dbg; |
extern int dbg; |
|
|
typedef struct { |
|
char *cbuf; |
|
int clen; |
|
int cmax; |
|
} Gstring; /* a string that grows */ |
|
|
|
extern Gstring *newGstring(void); /* constructor */ |
|
extern void delGstring(Gstring *); /* destructor */ |
|
extern char *cadd(Gstring *gs, int c); /* function to grow with */ |
|
extern void caddreset(Gstring *gs); /* set cbuf empty */ |
|
extern void cunadd(Gstring *gs); /* back up one char in cbuf */ |
|
|
|
extern Gstring *gs; /* used by lex */ |
|
|
|
extern char *patbeg; /* beginning of pattern matched */ |
extern char *patbeg; /* beginning of pattern matched */ |
extern int patlen; /* length of pattern matched. set in b.c */ |
extern int patlen; /* length of pattern matched. set in b.c */ |
|
|
|
|
struct Cell *cnext; /* ptr to next if chained */ |
struct Cell *cnext; /* ptr to next if chained */ |
} Cell; |
} Cell; |
|
|
typedef struct { /* symbol table array */ |
typedef struct Array { /* symbol table array */ |
int nelem; /* elements in table right now */ |
int nelem; /* elements in table right now */ |
int size; /* size of tab */ |
int size; /* size of tab */ |
Cell **tab; /* hash table pointers */ |
Cell **tab; /* hash table pointers */ |
|
|
#define NSYMTAB 50 /* initial size of a symbol table */ |
#define NSYMTAB 50 /* initial size of a symbol table */ |
extern Array *symtab; |
extern Array *symtab; |
|
|
extern Cell *recloc; /* location of input record */ |
|
extern Cell *nrloc; /* NR */ |
extern Cell *nrloc; /* NR */ |
extern Cell *fnrloc; /* FNR */ |
extern Cell *fnrloc; /* FNR */ |
extern Cell *nfloc; /* NF */ |
extern Cell *nfloc; /* NF */ |
|
|
#define NVALUE 1 |
#define NVALUE 1 |
#define NSTAT 2 |
#define NSTAT 2 |
#define NEXPR 3 |
#define NEXPR 3 |
#define NFIELD 4 |
|
|
|
|
|
extern int pairstack[], paircnt; |
extern int pairstack[], paircnt; |
|
|
#define isnext(n) ((n)->csub == JNEXT) |
#define isnext(n) ((n)->csub == JNEXT) |
#define isnextfile(n) ((n)->csub == JNEXTFILE) |
#define isnextfile(n) ((n)->csub == JNEXTFILE) |
#define isret(n) ((n)->csub == JRET) |
#define isret(n) ((n)->csub == JRET) |
|
#define isrec(n) ((n)->tval & REC) |
|
#define isfld(n) ((n)->tval & FLD) |
#define isstr(n) ((n)->tval & STR) |
#define isstr(n) ((n)->tval & STR) |
#define isnum(n) ((n)->tval & NUM) |
#define isnum(n) ((n)->tval & NUM) |
#define isarr(n) ((n)->tval & ARR) |
#define isarr(n) ((n)->tval & ARR) |
#define isfunc(n) ((n)->tval & FCN) |
#define isfcn(n) ((n)->tval & FCN) |
#define istrue(n) ((n)->csub == BTRUE) |
#define istrue(n) ((n)->csub == BTRUE) |
#define istemp(n) ((n)->csub == CTEMP) |
#define istemp(n) ((n)->csub == CTEMP) |
#define isargument(n) ((n)->nobj == ARG) |
#define isargument(n) ((n)->nobj == ARG) |
#define freeable(p) (!((p)->tval & DONTFREE)) |
/* #define freeable(p) (!((p)->tval & DONTFREE)) */ |
|
#define freeable(p) ( ((p)->tval & (STR|DONTFREE)) == STR ) |
|
|
/* structures used by regular expression matching machinery, mostly b.c: */ |
/* structures used by regular expression matching machinery, mostly b.c: */ |
|
|