xref: /csrg-svn/old/lex/once.c (revision 37803)
1*37803Sbostic /*	once.c	4.2	89/05/10	*/
214491Ssam 	/* because of external definitions, this code should occur only once */
314491Ssam # ifdef ASCII
414491Ssam int ctable[2*NCH] = {
514491Ssam   0,  1,  2,  3,  4,  5,  6,  7,  8,  9,
614491Ssam  10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
714491Ssam  20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
814491Ssam  30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
914491Ssam  40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
1014491Ssam  50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
1114491Ssam  60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
1214491Ssam  70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
1314491Ssam  80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
1414491Ssam  90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
1514491Ssam 100,101,102,103,104,105,106,107,108,109,
1614491Ssam 110,111,112,113,114,115,116,117,118,119,
1714491Ssam 120,121,122,123,124,125,126,127};
1814491Ssam # endif
1914491Ssam # ifdef EBCDIC
2014491Ssam int ctable[2*NCH] = {
2114491Ssam   0,  1,  2,  3,  4,  5,  6,  7,  8,  9,
2214491Ssam  10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
2314491Ssam  20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
2414491Ssam  30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
2514491Ssam  40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
2614491Ssam  50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
2714491Ssam  60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
2814491Ssam  70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2914491Ssam  80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
3014491Ssam  90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
3114491Ssam 100,101,102,103,104,105,106,107,108,109,
3214491Ssam 110,111,112,113,114,115,116,117,118,119,
3314491Ssam 120,121,122,123,124,125,126,127,128,129,
3414491Ssam 130,131,132,133,134,135,136,137,138,139,
3514491Ssam 140,141,142,143,144,145,146,147,148,149,
3614491Ssam 150,151,152,153,154,155,156,157,158,159,
3714491Ssam 160,161,162,163,164,165,166,167,168,169,
3814491Ssam 170,171,172,173,174,175,176,177,178,179,
3914491Ssam 180,181,182,183,184,185,186,187,188,189,
4014491Ssam 190,191,192,193,194,195,196,197,198,199,
4114491Ssam 200,201,202,203,204,205,206,207,208,209,
4214491Ssam 210,211,212,213,214,215,216,217,218,219,
4314491Ssam 220,221,222,223,224,225,226,227,228,229,
4414491Ssam 230,231,232,233,234,235,236,237,238,239,
4514491Ssam 240,241,242,243,244,245,246,247,248,249,
4614491Ssam 250,251,252,253,254,255};
4714491Ssam # endif
4814491Ssam int ZCH = NCH;
4914491Ssam FILE *fout = NULL, *errorf = {stdout};
5014491Ssam int sect = DEFSECTION;
5114491Ssam int prev = '\n';	/* previous input character */
5214491Ssam int pres = '\n';	/* present input character */
5314491Ssam int peek = '\n';	/* next input character */
5414491Ssam char *pushptr = pushc;
5514491Ssam char *slptr = slist;
5614491Ssam 
5714491Ssam # if (unix || ibm)
58*37803Sbostic char *cname = _PATH_NCFORM;
59*37803Sbostic char *ratname = _PATH_NRFORM;
6014491Ssam # endif
6114491Ssam 
6214491Ssam # ifdef gcos
6314491Ssam char *cname = "pounce/lexcform";
6414491Ssam char *ratname = "pounce/lexrform";
6514491Ssam # endif
6614491Ssam int ccount = 1;
6714491Ssam int casecount = 1;
6814491Ssam int aptr = 1;
6914491Ssam int nstates = NSTATES, maxpos = MAXPOS;
7014491Ssam int treesize = TREESIZE, ntrans = NTRANS;
7114491Ssam int yytop;
7214491Ssam int outsize = NOUTPUT;
7314491Ssam int sptr = 1;
7414491Ssam int optim = TRUE;
7514491Ssam int report = 2;
7614491Ssam int debug;		/* 1 = on */
7714491Ssam int charc;
7814491Ssam int sargc;
7914491Ssam char **sargv;
8014491Ssam char buf[520];
8114491Ssam int ratfor;		/* 1 = ratfor, 0 = C */
8214491Ssam int yyline;		/* line number of file */
8314491Ssam int eof;
8414491Ssam int lgatflg;
8514491Ssam int divflg;
8614491Ssam int funcflag;
8714491Ssam int pflag;
8814491Ssam int chset;	/* 1 = char set modified */
8914491Ssam FILE *fin, *fother;
9014491Ssam int fptr;
9114491Ssam int *name;
9214491Ssam int *left;
9314491Ssam int *right;
9414491Ssam int *parent;
9514491Ssam char *nullstr;
9614491Ssam int tptr;
9714491Ssam char pushc[TOKENSIZE];
9814491Ssam char slist[STARTSIZE];
9914491Ssam char **def, **subs, *dchar;
10014491Ssam char **sname, *schar;
10114491Ssam char *ccl;
10214491Ssam char *ccptr;
10314491Ssam char *dp, *sp;
10414491Ssam int dptr;
10514491Ssam char *bptr;		/* store input position */
10614491Ssam char *tmpstat;
10714491Ssam int count;
10814491Ssam int **foll;
10914491Ssam int *nxtpos;
11014491Ssam int *positions;
11114491Ssam int *gotof;
11214491Ssam int *nexts;
11314491Ssam char *nchar;
11414491Ssam int **state;
11514491Ssam int *sfall;		/* fallback state num */
11614491Ssam char *cpackflg;		/* true if state has been character packed */
11714491Ssam int *atable;
11814491Ssam int nptr;
11914491Ssam char symbol[NCH];
12014491Ssam char cindex[NCH];
12114491Ssam int xstate;
12214491Ssam int stnum;
12314491Ssam char match[NCH];
12414491Ssam char extra[NACTIONS];
12514491Ssam char *pchar, *pcptr;
12614491Ssam int pchlen = TOKENSIZE;
12714491Ssam  long rcount;
12814491Ssam int *verify, *advance, *stoff;
12914491Ssam int scon;
13014491Ssam char *psave;
13114491Ssam int buserr(), segviol();
132