1*0Sstevel@tonic-gate /* $RCSfile: a2p.h,v $$Revision: 4.1 $$Date: 92/08/07 18:29:09 $ 2*0Sstevel@tonic-gate * 3*0Sstevel@tonic-gate * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 4*0Sstevel@tonic-gate * 2000, 2001, 2002, by Larry Wall and others 5*0Sstevel@tonic-gate * 6*0Sstevel@tonic-gate * You may distribute under the terms of either the GNU General Public 7*0Sstevel@tonic-gate * License or the Artistic License, as specified in the README file. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * $Log: a2p.h,v $ 10*0Sstevel@tonic-gate */ 11*0Sstevel@tonic-gate 12*0Sstevel@tonic-gate #define VOIDUSED 1 13*0Sstevel@tonic-gate 14*0Sstevel@tonic-gate #ifdef WIN32 15*0Sstevel@tonic-gate #define _INC_WIN32_PERL5 /* kludge around win32 stdio layer */ 16*0Sstevel@tonic-gate #endif 17*0Sstevel@tonic-gate 18*0Sstevel@tonic-gate #ifdef VMS 19*0Sstevel@tonic-gate # include "config.h" 20*0Sstevel@tonic-gate #elif defined(NETWARE) 21*0Sstevel@tonic-gate # include "../NetWare/config.h" 22*0Sstevel@tonic-gate #else 23*0Sstevel@tonic-gate # include "../config.h" 24*0Sstevel@tonic-gate #endif 25*0Sstevel@tonic-gate 26*0Sstevel@tonic-gate #if defined(__STDC__) || defined(vax11c) || defined(_AIX) || defined(__stdc__) || defined(__cplusplus) 27*0Sstevel@tonic-gate # define STANDARD_C 1 28*0Sstevel@tonic-gate #endif 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate #ifdef WIN32 31*0Sstevel@tonic-gate #undef USE_STDIO_PTR /* XXX fast gets won't work, must investigate */ 32*0Sstevel@tonic-gate # ifndef STANDARD_C 33*0Sstevel@tonic-gate # define STANDARD_C 34*0Sstevel@tonic-gate # endif 35*0Sstevel@tonic-gate # if defined(__BORLANDC__) 36*0Sstevel@tonic-gate # pragma warn -ccc 37*0Sstevel@tonic-gate # pragma warn -rch 38*0Sstevel@tonic-gate # pragma warn -sig 39*0Sstevel@tonic-gate # pragma warn -pia 40*0Sstevel@tonic-gate # pragma warn -par 41*0Sstevel@tonic-gate # pragma warn -aus 42*0Sstevel@tonic-gate # pragma warn -use 43*0Sstevel@tonic-gate # pragma warn -csu 44*0Sstevel@tonic-gate # pragma warn -pro 45*0Sstevel@tonic-gate # elif defined(_MSC_VER) 46*0Sstevel@tonic-gate # elif defined(__MINGW32__) 47*0Sstevel@tonic-gate # endif 48*0Sstevel@tonic-gate #endif 49*0Sstevel@tonic-gate 50*0Sstevel@tonic-gate /* Use all the "standard" definitions? */ 51*0Sstevel@tonic-gate #if defined(STANDARD_C) && defined(I_STDLIB) 52*0Sstevel@tonic-gate # include <stdlib.h> 53*0Sstevel@tonic-gate #endif /* STANDARD_C */ 54*0Sstevel@tonic-gate 55*0Sstevel@tonic-gate #include <stdio.h> 56*0Sstevel@tonic-gate 57*0Sstevel@tonic-gate #ifdef I_MATH 58*0Sstevel@tonic-gate #include <math.h> 59*0Sstevel@tonic-gate #endif 60*0Sstevel@tonic-gate 61*0Sstevel@tonic-gate #ifdef I_SYS_TYPES 62*0Sstevel@tonic-gate # include <sys/types.h> 63*0Sstevel@tonic-gate #endif 64*0Sstevel@tonic-gate 65*0Sstevel@tonic-gate #ifdef USE_NEXT_CTYPE 66*0Sstevel@tonic-gate 67*0Sstevel@tonic-gate #if NX_CURRENT_COMPILER_RELEASE >= 400 68*0Sstevel@tonic-gate #include <objc/NXCType.h> 69*0Sstevel@tonic-gate #else /* NX_CURRENT_COMPILER_RELEASE < 400 */ 70*0Sstevel@tonic-gate #include <appkit/NXCType.h> 71*0Sstevel@tonic-gate #endif /* NX_CURRENT_COMPILER_RELEASE >= 400 */ 72*0Sstevel@tonic-gate 73*0Sstevel@tonic-gate #else /* !USE_NEXT_CTYPE */ 74*0Sstevel@tonic-gate #include <ctype.h> 75*0Sstevel@tonic-gate #endif /* USE_NEXT_CTYPE */ 76*0Sstevel@tonic-gate 77*0Sstevel@tonic-gate #define MEM_SIZE Size_t 78*0Sstevel@tonic-gate 79*0Sstevel@tonic-gate #ifndef STANDARD_C 80*0Sstevel@tonic-gate Malloc_t malloc (MEM_SIZE nbytes); 81*0Sstevel@tonic-gate Malloc_t calloc (MEM_SIZE elements, MEM_SIZE size); 82*0Sstevel@tonic-gate Malloc_t realloc (Malloc_t where, MEM_SIZE nbytes); 83*0Sstevel@tonic-gate Free_t free (Malloc_t where); 84*0Sstevel@tonic-gate #endif 85*0Sstevel@tonic-gate 86*0Sstevel@tonic-gate #if defined(I_STRING) || defined(__cplusplus) 87*0Sstevel@tonic-gate # include <string.h> 88*0Sstevel@tonic-gate #else 89*0Sstevel@tonic-gate # include <strings.h> 90*0Sstevel@tonic-gate #endif 91*0Sstevel@tonic-gate 92*0Sstevel@tonic-gate #if !defined(HAS_STRCHR) && defined(HAS_INDEX) && !defined(strchr) 93*0Sstevel@tonic-gate #define strchr index 94*0Sstevel@tonic-gate #define strrchr rindex 95*0Sstevel@tonic-gate #endif 96*0Sstevel@tonic-gate 97*0Sstevel@tonic-gate #ifdef I_TIME 98*0Sstevel@tonic-gate # include <time.h> 99*0Sstevel@tonic-gate #endif 100*0Sstevel@tonic-gate 101*0Sstevel@tonic-gate #ifdef I_SYS_TIME 102*0Sstevel@tonic-gate # ifdef I_SYS_TIME_KERNEL 103*0Sstevel@tonic-gate # define KERNEL 104*0Sstevel@tonic-gate # endif 105*0Sstevel@tonic-gate # include <sys/time.h> 106*0Sstevel@tonic-gate # ifdef I_SYS_TIME_KERNEL 107*0Sstevel@tonic-gate # undef KERNEL 108*0Sstevel@tonic-gate # endif 109*0Sstevel@tonic-gate #endif 110*0Sstevel@tonic-gate 111*0Sstevel@tonic-gate #ifndef MSDOS 112*0Sstevel@tonic-gate # if defined(HAS_TIMES) && defined(I_SYS_TIMES) 113*0Sstevel@tonic-gate # include <sys/times.h> 114*0Sstevel@tonic-gate # endif 115*0Sstevel@tonic-gate #endif 116*0Sstevel@tonic-gate 117*0Sstevel@tonic-gate #ifdef DOSISH 118*0Sstevel@tonic-gate # if defined(OS2) 119*0Sstevel@tonic-gate # define PTHX_UNUSED 120*0Sstevel@tonic-gate # include "../os2ish.h" 121*0Sstevel@tonic-gate # else 122*0Sstevel@tonic-gate # include "../dosish.h" 123*0Sstevel@tonic-gate # endif 124*0Sstevel@tonic-gate #else 125*0Sstevel@tonic-gate # if defined(VMS) 126*0Sstevel@tonic-gate # define NO_PERL_TYPEDEFS 127*0Sstevel@tonic-gate # include "vmsish.h" 128*0Sstevel@tonic-gate # endif 129*0Sstevel@tonic-gate #endif 130*0Sstevel@tonic-gate 131*0Sstevel@tonic-gate #ifndef STANDARD_C 132*0Sstevel@tonic-gate /* All of these are in stdlib.h or time.h for ANSI C */ 133*0Sstevel@tonic-gate Time_t time(); 134*0Sstevel@tonic-gate struct tm *gmtime(), *localtime(); 135*0Sstevel@tonic-gate #if defined(OEMVS) || defined(__OPEN_VM) 136*0Sstevel@tonic-gate char *(strchr)(), *(strrchr)(); 137*0Sstevel@tonic-gate char *(strcpy)(), *(strcat)(); 138*0Sstevel@tonic-gate #else 139*0Sstevel@tonic-gate char *strchr(), *strrchr(); 140*0Sstevel@tonic-gate char *strcpy(), *strcat(); 141*0Sstevel@tonic-gate #endif 142*0Sstevel@tonic-gate #endif /* ! STANDARD_C */ 143*0Sstevel@tonic-gate 144*0Sstevel@tonic-gate #ifdef VMS 145*0Sstevel@tonic-gate # include "handy.h" 146*0Sstevel@tonic-gate #else 147*0Sstevel@tonic-gate # include "../handy.h" 148*0Sstevel@tonic-gate #endif 149*0Sstevel@tonic-gate 150*0Sstevel@tonic-gate #undef Nullfp 151*0Sstevel@tonic-gate #define Nullfp Null(FILE*) 152*0Sstevel@tonic-gate 153*0Sstevel@tonic-gate #define Nullop 0 154*0Sstevel@tonic-gate 155*0Sstevel@tonic-gate #define OPROG 1 156*0Sstevel@tonic-gate #define OJUNK 2 157*0Sstevel@tonic-gate #define OHUNKS 3 158*0Sstevel@tonic-gate #define ORANGE 4 159*0Sstevel@tonic-gate #define OPAT 5 160*0Sstevel@tonic-gate #define OHUNK 6 161*0Sstevel@tonic-gate #define OPPAREN 7 162*0Sstevel@tonic-gate #define OPANDAND 8 163*0Sstevel@tonic-gate #define OPOROR 9 164*0Sstevel@tonic-gate #define OPNOT 10 165*0Sstevel@tonic-gate #define OCPAREN 11 166*0Sstevel@tonic-gate #define OCANDAND 12 167*0Sstevel@tonic-gate #define OCOROR 13 168*0Sstevel@tonic-gate #define OCNOT 14 169*0Sstevel@tonic-gate #define ORELOP 15 170*0Sstevel@tonic-gate #define ORPAREN 16 171*0Sstevel@tonic-gate #define OMATCHOP 17 172*0Sstevel@tonic-gate #define OMPAREN 18 173*0Sstevel@tonic-gate #define OCONCAT 19 174*0Sstevel@tonic-gate #define OASSIGN 20 175*0Sstevel@tonic-gate #define OADD 21 176*0Sstevel@tonic-gate #define OSUBTRACT 22 177*0Sstevel@tonic-gate #define OMULT 23 178*0Sstevel@tonic-gate #define ODIV 24 179*0Sstevel@tonic-gate #define OMOD 25 180*0Sstevel@tonic-gate #define OPOSTINCR 26 181*0Sstevel@tonic-gate #define OPOSTDECR 27 182*0Sstevel@tonic-gate #define OPREINCR 28 183*0Sstevel@tonic-gate #define OPREDECR 29 184*0Sstevel@tonic-gate #define OUMINUS 30 185*0Sstevel@tonic-gate #define OUPLUS 31 186*0Sstevel@tonic-gate #define OPAREN 32 187*0Sstevel@tonic-gate #define OGETLINE 33 188*0Sstevel@tonic-gate #define OSPRINTF 34 189*0Sstevel@tonic-gate #define OSUBSTR 35 190*0Sstevel@tonic-gate #define OSTRING 36 191*0Sstevel@tonic-gate #define OSPLIT 37 192*0Sstevel@tonic-gate #define OSNEWLINE 38 193*0Sstevel@tonic-gate #define OINDEX 39 194*0Sstevel@tonic-gate #define ONUM 40 195*0Sstevel@tonic-gate #define OSTR 41 196*0Sstevel@tonic-gate #define OVAR 42 197*0Sstevel@tonic-gate #define OFLD 43 198*0Sstevel@tonic-gate #define ONEWLINE 44 199*0Sstevel@tonic-gate #define OCOMMENT 45 200*0Sstevel@tonic-gate #define OCOMMA 46 201*0Sstevel@tonic-gate #define OSEMICOLON 47 202*0Sstevel@tonic-gate #define OSCOMMENT 48 203*0Sstevel@tonic-gate #define OSTATES 49 204*0Sstevel@tonic-gate #define OSTATE 50 205*0Sstevel@tonic-gate #define OPRINT 51 206*0Sstevel@tonic-gate #define OPRINTF 52 207*0Sstevel@tonic-gate #define OBREAK 53 208*0Sstevel@tonic-gate #define ONEXT 54 209*0Sstevel@tonic-gate #define OEXIT 55 210*0Sstevel@tonic-gate #define OCONTINUE 56 211*0Sstevel@tonic-gate #define OREDIR 57 212*0Sstevel@tonic-gate #define OIF 58 213*0Sstevel@tonic-gate #define OWHILE 59 214*0Sstevel@tonic-gate #define OFOR 60 215*0Sstevel@tonic-gate #define OFORIN 61 216*0Sstevel@tonic-gate #define OVFLD 62 217*0Sstevel@tonic-gate #define OBLOCK 63 218*0Sstevel@tonic-gate #define OREGEX 64 219*0Sstevel@tonic-gate #define OLENGTH 65 220*0Sstevel@tonic-gate #define OLOG 66 221*0Sstevel@tonic-gate #define OEXP 67 222*0Sstevel@tonic-gate #define OSQRT 68 223*0Sstevel@tonic-gate #define OINT 69 224*0Sstevel@tonic-gate #define ODO 70 225*0Sstevel@tonic-gate #define OPOW 71 226*0Sstevel@tonic-gate #define OSUB 72 227*0Sstevel@tonic-gate #define OGSUB 73 228*0Sstevel@tonic-gate #define OMATCH 74 229*0Sstevel@tonic-gate #define OUSERFUN 75 230*0Sstevel@tonic-gate #define OUSERDEF 76 231*0Sstevel@tonic-gate #define OCLOSE 77 232*0Sstevel@tonic-gate #define OATAN2 78 233*0Sstevel@tonic-gate #define OSIN 79 234*0Sstevel@tonic-gate #define OCOS 80 235*0Sstevel@tonic-gate #define ORAND 81 236*0Sstevel@tonic-gate #define OSRAND 82 237*0Sstevel@tonic-gate #define ODELETE 83 238*0Sstevel@tonic-gate #define OSYSTEM 84 239*0Sstevel@tonic-gate #define OCOND 85 240*0Sstevel@tonic-gate #define ORETURN 86 241*0Sstevel@tonic-gate #define ODEFINED 87 242*0Sstevel@tonic-gate #define OSTAR 88 243*0Sstevel@tonic-gate 244*0Sstevel@tonic-gate #ifdef DOINIT 245*0Sstevel@tonic-gate char *opname[] = { 246*0Sstevel@tonic-gate "0", 247*0Sstevel@tonic-gate "PROG", 248*0Sstevel@tonic-gate "JUNK", 249*0Sstevel@tonic-gate "HUNKS", 250*0Sstevel@tonic-gate "RANGE", 251*0Sstevel@tonic-gate "PAT", 252*0Sstevel@tonic-gate "HUNK", 253*0Sstevel@tonic-gate "PPAREN", 254*0Sstevel@tonic-gate "PANDAND", 255*0Sstevel@tonic-gate "POROR", 256*0Sstevel@tonic-gate "PNOT", 257*0Sstevel@tonic-gate "CPAREN", 258*0Sstevel@tonic-gate "CANDAND", 259*0Sstevel@tonic-gate "COROR", 260*0Sstevel@tonic-gate "CNOT", 261*0Sstevel@tonic-gate "RELOP", 262*0Sstevel@tonic-gate "RPAREN", 263*0Sstevel@tonic-gate "MATCHOP", 264*0Sstevel@tonic-gate "MPAREN", 265*0Sstevel@tonic-gate "CONCAT", 266*0Sstevel@tonic-gate "ASSIGN", 267*0Sstevel@tonic-gate "ADD", 268*0Sstevel@tonic-gate "SUBTRACT", 269*0Sstevel@tonic-gate "MULT", 270*0Sstevel@tonic-gate "DIV", 271*0Sstevel@tonic-gate "MOD", 272*0Sstevel@tonic-gate "POSTINCR", 273*0Sstevel@tonic-gate "POSTDECR", 274*0Sstevel@tonic-gate "PREINCR", 275*0Sstevel@tonic-gate "PREDECR", 276*0Sstevel@tonic-gate "UMINUS", 277*0Sstevel@tonic-gate "UPLUS", 278*0Sstevel@tonic-gate "PAREN", 279*0Sstevel@tonic-gate "GETLINE", 280*0Sstevel@tonic-gate "SPRINTF", 281*0Sstevel@tonic-gate "SUBSTR", 282*0Sstevel@tonic-gate "STRING", 283*0Sstevel@tonic-gate "SPLIT", 284*0Sstevel@tonic-gate "SNEWLINE", 285*0Sstevel@tonic-gate "INDEX", 286*0Sstevel@tonic-gate "NUM", 287*0Sstevel@tonic-gate "STR", 288*0Sstevel@tonic-gate "VAR", 289*0Sstevel@tonic-gate "FLD", 290*0Sstevel@tonic-gate "NEWLINE", 291*0Sstevel@tonic-gate "COMMENT", 292*0Sstevel@tonic-gate "COMMA", 293*0Sstevel@tonic-gate "SEMICOLON", 294*0Sstevel@tonic-gate "SCOMMENT", 295*0Sstevel@tonic-gate "STATES", 296*0Sstevel@tonic-gate "STATE", 297*0Sstevel@tonic-gate "PRINT", 298*0Sstevel@tonic-gate "PRINTF", 299*0Sstevel@tonic-gate "BREAK", 300*0Sstevel@tonic-gate "NEXT", 301*0Sstevel@tonic-gate "EXIT", 302*0Sstevel@tonic-gate "CONTINUE", 303*0Sstevel@tonic-gate "REDIR", 304*0Sstevel@tonic-gate "IF", 305*0Sstevel@tonic-gate "WHILE", 306*0Sstevel@tonic-gate "FOR", 307*0Sstevel@tonic-gate "FORIN", 308*0Sstevel@tonic-gate "VFLD", 309*0Sstevel@tonic-gate "BLOCK", 310*0Sstevel@tonic-gate "REGEX", 311*0Sstevel@tonic-gate "LENGTH", 312*0Sstevel@tonic-gate "LOG", 313*0Sstevel@tonic-gate "EXP", 314*0Sstevel@tonic-gate "SQRT", 315*0Sstevel@tonic-gate "INT", 316*0Sstevel@tonic-gate "DO", 317*0Sstevel@tonic-gate "POW", 318*0Sstevel@tonic-gate "SUB", 319*0Sstevel@tonic-gate "GSUB", 320*0Sstevel@tonic-gate "MATCH", 321*0Sstevel@tonic-gate "USERFUN", 322*0Sstevel@tonic-gate "USERDEF", 323*0Sstevel@tonic-gate "CLOSE", 324*0Sstevel@tonic-gate "ATAN2", 325*0Sstevel@tonic-gate "SIN", 326*0Sstevel@tonic-gate "COS", 327*0Sstevel@tonic-gate "RAND", 328*0Sstevel@tonic-gate "SRAND", 329*0Sstevel@tonic-gate "DELETE", 330*0Sstevel@tonic-gate "SYSTEM", 331*0Sstevel@tonic-gate "COND", 332*0Sstevel@tonic-gate "RETURN", 333*0Sstevel@tonic-gate "DEFINED", 334*0Sstevel@tonic-gate "STAR", 335*0Sstevel@tonic-gate "89" 336*0Sstevel@tonic-gate }; 337*0Sstevel@tonic-gate #else 338*0Sstevel@tonic-gate extern char *opname[]; 339*0Sstevel@tonic-gate #endif 340*0Sstevel@tonic-gate 341*0Sstevel@tonic-gate EXT int mop INIT(1); 342*0Sstevel@tonic-gate 343*0Sstevel@tonic-gate union u_ops { 344*0Sstevel@tonic-gate int ival; 345*0Sstevel@tonic-gate char *cval; 346*0Sstevel@tonic-gate }; 347*0Sstevel@tonic-gate #if defined(iAPX286) || defined(M_I286) || defined(I80286) /* 80286 hack */ 348*0Sstevel@tonic-gate #define OPSMAX (64000/sizeof(union u_ops)) /* approx. max segment size */ 349*0Sstevel@tonic-gate #else 350*0Sstevel@tonic-gate #define OPSMAX 50000 351*0Sstevel@tonic-gate #endif /* 80286 hack */ 352*0Sstevel@tonic-gate EXT union u_ops ops[OPSMAX]; 353*0Sstevel@tonic-gate 354*0Sstevel@tonic-gate typedef struct string STR; 355*0Sstevel@tonic-gate typedef struct htbl HASH; 356*0Sstevel@tonic-gate 357*0Sstevel@tonic-gate #include "str.h" 358*0Sstevel@tonic-gate #include "hash.h" 359*0Sstevel@tonic-gate 360*0Sstevel@tonic-gate 361*0Sstevel@tonic-gate /* A string is TRUE if not "" or "0". */ 362*0Sstevel@tonic-gate #define True(val) (tmps = (val), (*tmps && !(*tmps == '0' && !tmps[1]))) 363*0Sstevel@tonic-gate EXT char *Yes INIT("1"); 364*0Sstevel@tonic-gate EXT char *No INIT(""); 365*0Sstevel@tonic-gate 366*0Sstevel@tonic-gate #define str_true(str) (Str = (str), (Str->str_pok ? True(Str->str_ptr) : (Str->str_nok ? (Str->str_nval != 0.0) : 0 ))) 367*0Sstevel@tonic-gate 368*0Sstevel@tonic-gate #define str_peek(str) (Str = (str), (Str->str_pok ? Str->str_ptr : (Str->str_nok ? (sprintf(buf,"num(%"NVgf")",Str->str_nval),buf) : "" ))) 369*0Sstevel@tonic-gate #define str_get(str) (Str = (str), (Str->str_pok ? Str->str_ptr : str_2ptr(Str))) 370*0Sstevel@tonic-gate #define str_gnum(str) (Str = (str), (Str->str_nok ? Str->str_nval : str_2num(Str))) 371*0Sstevel@tonic-gate EXT STR *Str; 372*0Sstevel@tonic-gate 373*0Sstevel@tonic-gate #define GROWSTR(pp,lp,len) if (*(lp) < (len)) growstr(pp,lp,len) 374*0Sstevel@tonic-gate 375*0Sstevel@tonic-gate /* Prototypes for things in a2p.c */ 376*0Sstevel@tonic-gate int aryrefarg ( int arg ); 377*0Sstevel@tonic-gate int bl ( int arg, int maybe ); 378*0Sstevel@tonic-gate void dump ( int branch ); 379*0Sstevel@tonic-gate int fixfargs ( int name, int arg, int prevargs ); 380*0Sstevel@tonic-gate int fixrargs ( char *name, int arg, int prevargs ); 381*0Sstevel@tonic-gate void fixup ( STR *str ); 382*0Sstevel@tonic-gate int numary ( int arg ); 383*0Sstevel@tonic-gate int oper0 ( int type ); 384*0Sstevel@tonic-gate int oper1 ( int type, int arg1 ); 385*0Sstevel@tonic-gate int oper2 ( int type, int arg1, int arg2 ); 386*0Sstevel@tonic-gate int oper3 ( int type, int arg1, int arg2, int arg3 ); 387*0Sstevel@tonic-gate int oper4 ( int type, int arg1, int arg2, int arg3, int arg4 ); 388*0Sstevel@tonic-gate int oper5 ( int type, int arg1, int arg2, int arg3, int arg4, int arg5 ); 389*0Sstevel@tonic-gate void putlines ( STR *str ); 390*0Sstevel@tonic-gate void putone ( void ); 391*0Sstevel@tonic-gate int rememberargs ( int arg ); 392*0Sstevel@tonic-gate char * scannum ( char *s ); 393*0Sstevel@tonic-gate char * scanpat ( char *s ); 394*0Sstevel@tonic-gate int string ( char *ptr, int len ); 395*0Sstevel@tonic-gate void yyerror ( char *s ); 396*0Sstevel@tonic-gate int yylex ( void ); 397*0Sstevel@tonic-gate 398*0Sstevel@tonic-gate EXT int line INIT(0); 399*0Sstevel@tonic-gate 400*0Sstevel@tonic-gate EXT FILE *rsfp; 401*0Sstevel@tonic-gate EXT char buf[2048]; 402*0Sstevel@tonic-gate EXT char *bufptr INIT(buf); 403*0Sstevel@tonic-gate 404*0Sstevel@tonic-gate EXT STR *linestr INIT(Nullstr); 405*0Sstevel@tonic-gate 406*0Sstevel@tonic-gate EXT char tokenbuf[2048]; 407*0Sstevel@tonic-gate EXT int expectterm INIT(TRUE); 408*0Sstevel@tonic-gate 409*0Sstevel@tonic-gate #ifdef DEBUGGING 410*0Sstevel@tonic-gate EXT int debug INIT(0); 411*0Sstevel@tonic-gate EXT int dlevel INIT(0); 412*0Sstevel@tonic-gate #define YYDEBUG 1 413*0Sstevel@tonic-gate extern int yydebug; 414*0Sstevel@tonic-gate #else 415*0Sstevel@tonic-gate # ifndef YYDEBUG 416*0Sstevel@tonic-gate # define YYDEBUG 0 417*0Sstevel@tonic-gate # endif 418*0Sstevel@tonic-gate #endif 419*0Sstevel@tonic-gate 420*0Sstevel@tonic-gate EXT STR *freestrroot INIT(Nullstr); 421*0Sstevel@tonic-gate 422*0Sstevel@tonic-gate EXT STR str_no; 423*0Sstevel@tonic-gate EXT STR str_yes; 424*0Sstevel@tonic-gate 425*0Sstevel@tonic-gate EXT bool do_split INIT(FALSE); 426*0Sstevel@tonic-gate EXT bool split_to_array INIT(FALSE); 427*0Sstevel@tonic-gate EXT bool set_array_base INIT(FALSE); 428*0Sstevel@tonic-gate EXT bool saw_RS INIT(FALSE); 429*0Sstevel@tonic-gate EXT bool saw_OFS INIT(FALSE); 430*0Sstevel@tonic-gate EXT bool saw_ORS INIT(FALSE); 431*0Sstevel@tonic-gate EXT bool saw_line_op INIT(FALSE); 432*0Sstevel@tonic-gate EXT bool in_begin INIT(TRUE); 433*0Sstevel@tonic-gate EXT bool do_opens INIT(FALSE); 434*0Sstevel@tonic-gate EXT bool do_fancy_opens INIT(FALSE); 435*0Sstevel@tonic-gate EXT bool lval_field INIT(FALSE); 436*0Sstevel@tonic-gate EXT bool do_chop INIT(FALSE); 437*0Sstevel@tonic-gate EXT bool need_entire INIT(FALSE); 438*0Sstevel@tonic-gate EXT bool absmaxfld INIT(FALSE); 439*0Sstevel@tonic-gate EXT bool saw_altinput INIT(FALSE); 440*0Sstevel@tonic-gate 441*0Sstevel@tonic-gate EXT bool nomemok INIT(FALSE); 442*0Sstevel@tonic-gate 443*0Sstevel@tonic-gate EXT char const_FS INIT(0); 444*0Sstevel@tonic-gate EXT char *namelist INIT(Nullch); 445*0Sstevel@tonic-gate EXT char fswitch INIT(0); 446*0Sstevel@tonic-gate EXT bool old_awk INIT(0); 447*0Sstevel@tonic-gate 448*0Sstevel@tonic-gate EXT int saw_FS INIT(0); 449*0Sstevel@tonic-gate EXT int maxfld INIT(0); 450*0Sstevel@tonic-gate EXT int arymax INIT(0); 451*0Sstevel@tonic-gate EXT char *nameary[100]; 452*0Sstevel@tonic-gate 453*0Sstevel@tonic-gate EXT STR *opens; 454*0Sstevel@tonic-gate 455*0Sstevel@tonic-gate EXT HASH *symtab; 456*0Sstevel@tonic-gate EXT HASH *curarghash; 457*0Sstevel@tonic-gate 458*0Sstevel@tonic-gate #define P_MIN 0 459*0Sstevel@tonic-gate #define P_LISTOP 5 460*0Sstevel@tonic-gate #define P_COMMA 10 461*0Sstevel@tonic-gate #define P_ASSIGN 15 462*0Sstevel@tonic-gate #define P_COND 20 463*0Sstevel@tonic-gate #define P_DOTDOT 25 464*0Sstevel@tonic-gate #define P_OROR 30 465*0Sstevel@tonic-gate #define P_ANDAND 35 466*0Sstevel@tonic-gate #define P_OR 40 467*0Sstevel@tonic-gate #define P_AND 45 468*0Sstevel@tonic-gate #define P_EQ 50 469*0Sstevel@tonic-gate #define P_REL 55 470*0Sstevel@tonic-gate #define P_UNI 60 471*0Sstevel@tonic-gate #define P_FILETEST 65 472*0Sstevel@tonic-gate #define P_SHIFT 70 473*0Sstevel@tonic-gate #define P_ADD 75 474*0Sstevel@tonic-gate #define P_MUL 80 475*0Sstevel@tonic-gate #define P_MATCH 85 476*0Sstevel@tonic-gate #define P_UNARY 90 477*0Sstevel@tonic-gate #define P_POW 95 478*0Sstevel@tonic-gate #define P_AUTO 100 479*0Sstevel@tonic-gate #define P_MAX 999 480*0Sstevel@tonic-gate 481*0Sstevel@tonic-gate EXT int an; 482