1*14489Ssam /* ldefs.c 4.1 83/08/11 */ 2*14489Ssam 3*14489Ssam # include <stdio.h> 4*14489Ssam # define PP 1 5*14489Ssam # ifdef unix 6*14489Ssam 7*14489Ssam # define CWIDTH 7 8*14489Ssam # define CMASK 0177 9*14489Ssam # define ASCII 1 10*14489Ssam # endif 11*14489Ssam 12*14489Ssam # ifdef gcos 13*14489Ssam # define CWIDTH 9 14*14489Ssam # define CMASK 0777 15*14489Ssam # define ASCII 1 16*14489Ssam # endif 17*14489Ssam 18*14489Ssam # ifdef ibm 19*14489Ssam # define CWIDTH 8 20*14489Ssam # define CMASK 0377 21*14489Ssam # define EBCDIC 1 22*14489Ssam # endif 23*14489Ssam 24*14489Ssam # ifdef ASCII 25*14489Ssam # define NCH 128 26*14489Ssam # endif 27*14489Ssam 28*14489Ssam # ifdef EBCDIC 29*14489Ssam # define NCH 256 30*14489Ssam # endif 31*14489Ssam 32*14489Ssam 33*14489Ssam # define TOKENSIZE 1000 34*14489Ssam # define DEFSIZE 40 35*14489Ssam # define DEFCHAR 1000 36*14489Ssam # define STARTCHAR 100 37*14489Ssam # define STARTSIZE 256 38*14489Ssam # define CCLSIZE 1000 39*14489Ssam # ifdef SMALL 40*14489Ssam # define TREESIZE 600 41*14489Ssam # define NTRANS 1500 42*14489Ssam # define NSTATES 300 43*14489Ssam # define MAXPOS 1500 44*14489Ssam # define NOUTPUT 1500 45*14489Ssam # endif 46*14489Ssam 47*14489Ssam # ifndef SMALL 48*14489Ssam # define TREESIZE 1000 49*14489Ssam # define NSTATES 500 50*14489Ssam # define MAXPOS 2500 51*14489Ssam # define NTRANS 2000 52*14489Ssam # define NOUTPUT 3000 53*14489Ssam # endif 54*14489Ssam # define NACTIONS 100 55*14489Ssam # define ALITTLEEXTRA 30 56*14489Ssam 57*14489Ssam # define RCCL NCH+90 58*14489Ssam # define RNCCL NCH+91 59*14489Ssam # define RSTR NCH+92 60*14489Ssam # define RSCON NCH+93 61*14489Ssam # define RNEWE NCH+94 62*14489Ssam # define FINAL NCH+95 63*14489Ssam # define RNULLS NCH+96 64*14489Ssam # define RCAT NCH+97 65*14489Ssam # define STAR NCH+98 66*14489Ssam # define PLUS NCH+99 67*14489Ssam # define QUEST NCH+100 68*14489Ssam # define DIV NCH+101 69*14489Ssam # define BAR NCH+102 70*14489Ssam # define CARAT NCH+103 71*14489Ssam # define S1FINAL NCH+104 72*14489Ssam # define S2FINAL NCH+105 73*14489Ssam 74*14489Ssam # define DEFSECTION 1 75*14489Ssam # define RULESECTION 2 76*14489Ssam # define ENDSECTION 5 77*14489Ssam # define TRUE 1 78*14489Ssam # define FALSE 0 79*14489Ssam 80*14489Ssam # define PC 1 81*14489Ssam # define PS 1 82*14489Ssam 83*14489Ssam # ifdef DEBUG 84*14489Ssam # define LINESIZE 110 85*14489Ssam extern int yydebug; 86*14489Ssam extern int debug; /* 1 = on */ 87*14489Ssam extern int charc; 88*14489Ssam # endif 89*14489Ssam 90*14489Ssam # ifndef DEBUG 91*14489Ssam # define freturn(s) s 92*14489Ssam # endif 93*14489Ssam 94*14489Ssam extern int sargc; 95*14489Ssam extern char **sargv; 96*14489Ssam extern char buf[520]; 97*14489Ssam extern int ratfor; /* 1 = ratfor, 0 = C */ 98*14489Ssam extern int yyline; /* line number of file */ 99*14489Ssam extern int sect; 100*14489Ssam extern int eof; 101*14489Ssam extern int lgatflg; 102*14489Ssam extern int divflg; 103*14489Ssam extern int funcflag; 104*14489Ssam extern int pflag; 105*14489Ssam extern int casecount; 106*14489Ssam extern int chset; /* 1 = char set modified */ 107*14489Ssam extern FILE *fin, *fout, *fother, *errorf; 108*14489Ssam extern int fptr; 109*14489Ssam extern char *ratname, *cname; 110*14489Ssam extern int prev; /* previous input character */ 111*14489Ssam extern int pres; /* present input character */ 112*14489Ssam extern int peek; /* next input character */ 113*14489Ssam extern int *name; 114*14489Ssam extern int *left; 115*14489Ssam extern int *right; 116*14489Ssam extern int *parent; 117*14489Ssam extern char *nullstr; 118*14489Ssam extern int tptr; 119*14489Ssam extern char pushc[TOKENSIZE]; 120*14489Ssam extern char *pushptr; 121*14489Ssam extern char slist[STARTSIZE]; 122*14489Ssam extern char *slptr; 123*14489Ssam extern char **def, **subs, *dchar; 124*14489Ssam extern char **sname, *schar; 125*14489Ssam extern char *ccl; 126*14489Ssam extern char *ccptr; 127*14489Ssam extern char *dp, *sp; 128*14489Ssam extern int dptr, sptr; 129*14489Ssam extern char *bptr; /* store input position */ 130*14489Ssam extern char *tmpstat; 131*14489Ssam extern int count; 132*14489Ssam extern int **foll; 133*14489Ssam extern int *nxtpos; 134*14489Ssam extern int *positions; 135*14489Ssam extern int *gotof; 136*14489Ssam extern int *nexts; 137*14489Ssam extern char *nchar; 138*14489Ssam extern int **state; 139*14489Ssam extern int *sfall; /* fallback state num */ 140*14489Ssam extern char *cpackflg; /* true if state has been character packed */ 141*14489Ssam extern int *atable, aptr; 142*14489Ssam extern int nptr; 143*14489Ssam extern char symbol[NCH]; 144*14489Ssam extern char cindex[NCH]; 145*14489Ssam extern int xstate; 146*14489Ssam extern int stnum; 147*14489Ssam extern int ctable[]; 148*14489Ssam extern int ZCH; 149*14489Ssam extern int ccount; 150*14489Ssam extern char match[NCH]; 151*14489Ssam extern char extra[NACTIONS]; 152*14489Ssam extern char *pcptr, *pchar; 153*14489Ssam extern int pchlen; 154*14489Ssam extern int nstates, maxpos; 155*14489Ssam extern int yytop; 156*14489Ssam extern int report; 157*14489Ssam extern int ntrans, treesize, outsize; 158*14489Ssam extern long rcount; 159*14489Ssam extern int optim; 160*14489Ssam extern int *verify, *advance, *stoff; 161*14489Ssam extern int scon; 162*14489Ssam extern char *psave; 163*14489Ssam extern char *calloc(), *myalloc(); 164*14489Ssam extern int buserr(), segviol(); 165