xref: /illumos-gate/usr/src/cmd/sgs/lex/common/once.h (revision 966c588f)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*67298654Sdamico  * Common Development and Distribution License (the "License").
6*67298654Sdamico  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*67298654Sdamico  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate /*	Copyright (c) 1988 AT&T	*/
277c478bd9Sstevel@tonic-gate /*	All Rights Reserved	*/
287c478bd9Sstevel@tonic-gate 
29*67298654Sdamico #ifndef	_ONCE_H
30*67298654Sdamico #define	_ONCE_H
31*67298654Sdamico 
32*67298654Sdamico #include "ldefs.h"
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate /* once.c */
357c478bd9Sstevel@tonic-gate 	/* because of external definitions, this code should occur only once */
367c478bd9Sstevel@tonic-gate int	ctable[2*NCH] = {
377c478bd9Sstevel@tonic-gate 	0,   1,   2,   3,   4,   5,   6,   7,   8,   9,
387c478bd9Sstevel@tonic-gate 	10,  11,  12,  13,  14,  15,  16,  17,  18,  19,
397c478bd9Sstevel@tonic-gate 	20,  21,  22,  23,  24,  25,  26,  27,  28,  29,
407c478bd9Sstevel@tonic-gate 	30,  31,  32,  33,  34,  35,  36,  37,  38,  39,
417c478bd9Sstevel@tonic-gate 	40,  41,  42,  43,  44,  45,  46,  47,  48,  49,
427c478bd9Sstevel@tonic-gate 	50,  51,  52,  53,  54,  55,  56,  57,  58,  59,
437c478bd9Sstevel@tonic-gate 	60,  61,  62,  63,  64,  65,  66,  67,  68,  69,
447c478bd9Sstevel@tonic-gate 	70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
457c478bd9Sstevel@tonic-gate 	80,  81,  82,  83,  84,  85,  86,  87,  88,  89,
467c478bd9Sstevel@tonic-gate 	90,  91,  92,  93,  94,  95,  96,  97,  98,  99,
477c478bd9Sstevel@tonic-gate 	100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
487c478bd9Sstevel@tonic-gate 	110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
497c478bd9Sstevel@tonic-gate 	120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
507c478bd9Sstevel@tonic-gate 	130, 131, 132, 133, 134, 135, 136, 137, 138, 139,
517c478bd9Sstevel@tonic-gate 	140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
527c478bd9Sstevel@tonic-gate 	150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
537c478bd9Sstevel@tonic-gate 	160, 161, 162, 163, 164, 165, 166, 167, 168, 169,
547c478bd9Sstevel@tonic-gate 	170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
557c478bd9Sstevel@tonic-gate 	180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
567c478bd9Sstevel@tonic-gate 	190, 191, 192, 193, 194, 195, 196, 197, 198, 199,
577c478bd9Sstevel@tonic-gate 	200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
587c478bd9Sstevel@tonic-gate 	210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
597c478bd9Sstevel@tonic-gate 	220, 221, 222, 223, 224, 225, 226, 227, 228, 229,
607c478bd9Sstevel@tonic-gate 	230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
617c478bd9Sstevel@tonic-gate 	240, 241, 242, 243, 244, 245, 246, 247, 248, 249,
627c478bd9Sstevel@tonic-gate 	250, 251, 252, 253, 254, 255
637c478bd9Sstevel@tonic-gate };
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate int	ZCH = NCH;
667c478bd9Sstevel@tonic-gate FILE	*fout = NULL, *errorf = {stderr};
677c478bd9Sstevel@tonic-gate int	sect = DEFSECTION;
687c478bd9Sstevel@tonic-gate int	prev = '\n';	/* previous input character */
697c478bd9Sstevel@tonic-gate int	pres = '\n';	/* present input character */
707c478bd9Sstevel@tonic-gate int	peek = '\n';	/* next input character */
717c478bd9Sstevel@tonic-gate CHR	*pushptr = pushc;
727c478bd9Sstevel@tonic-gate CHR	*slptr = slist;
737c478bd9Sstevel@tonic-gate 
74*67298654Sdamico #define	CNAME "/usr/share/lib/ccs/ncform"
75*67298654Sdamico #define	RATNAME "/usr/share/lib/ccs/nrform"
76*67298654Sdamico #define	EUCNAME "/usr/share/lib/ccs/nceucform"
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate int ccount = 1;
797c478bd9Sstevel@tonic-gate int casecount = 1;
807c478bd9Sstevel@tonic-gate int aptr = 1;
817c478bd9Sstevel@tonic-gate int nstates = NSTATES, maxpos = MAXPOS;
827c478bd9Sstevel@tonic-gate int treesize = TREESIZE, ntrans = NTRANS;
837c478bd9Sstevel@tonic-gate int yytop;
847c478bd9Sstevel@tonic-gate int outsize = NOUTPUT;
857c478bd9Sstevel@tonic-gate int sptr = 1;
867c478bd9Sstevel@tonic-gate int optim = TRUE;
877c478bd9Sstevel@tonic-gate int report = 2;
887c478bd9Sstevel@tonic-gate int debug;		/* 1 = on */
897c478bd9Sstevel@tonic-gate int charc;
907c478bd9Sstevel@tonic-gate char *v_stmp = "n";
917c478bd9Sstevel@tonic-gate int no_input;
927c478bd9Sstevel@tonic-gate int copy_line;
937c478bd9Sstevel@tonic-gate int n_error = 0;
947c478bd9Sstevel@tonic-gate int fatal = 1;
957c478bd9Sstevel@tonic-gate int sargc;
967c478bd9Sstevel@tonic-gate char **sargv;
977c478bd9Sstevel@tonic-gate CHR buf[BUF_SIZ];
987c478bd9Sstevel@tonic-gate int ratfor;		/* 1 = ratfor, 0 = C */
997c478bd9Sstevel@tonic-gate int yyline;		/* line number of file */
1007c478bd9Sstevel@tonic-gate int eof;
1017c478bd9Sstevel@tonic-gate int lgatflg;
1027c478bd9Sstevel@tonic-gate int divflg;
1037c478bd9Sstevel@tonic-gate int funcflag;
1047c478bd9Sstevel@tonic-gate int pflag;
1057c478bd9Sstevel@tonic-gate int chset;	/* 1 = char set modified */
1067c478bd9Sstevel@tonic-gate FILE *fin, *fother;
1077c478bd9Sstevel@tonic-gate int fptr;
1087c478bd9Sstevel@tonic-gate int *name;
1097c478bd9Sstevel@tonic-gate int *left;
1107c478bd9Sstevel@tonic-gate int *right;
1117c478bd9Sstevel@tonic-gate int *parent;
1127c478bd9Sstevel@tonic-gate Boolean *nullstr;
1137c478bd9Sstevel@tonic-gate int tptr;
1147c478bd9Sstevel@tonic-gate CHR pushc[TOKENSIZE];
1157c478bd9Sstevel@tonic-gate CHR slist[STARTSIZE];
1167c478bd9Sstevel@tonic-gate CHR **def, **subs, *dchar;
1177c478bd9Sstevel@tonic-gate /* XCU4: %x exclusive start */
1187c478bd9Sstevel@tonic-gate int *exclusive;
1197c478bd9Sstevel@tonic-gate CHR **sname, *schar;
1207c478bd9Sstevel@tonic-gate CHR *ccl;
1217c478bd9Sstevel@tonic-gate CHR *ccptr;
1227c478bd9Sstevel@tonic-gate CHR *dp, *sp;
1237c478bd9Sstevel@tonic-gate int dptr;
1247c478bd9Sstevel@tonic-gate CHR *bptr;		/* store input position */
1257c478bd9Sstevel@tonic-gate CHR *tmpstat;
1267c478bd9Sstevel@tonic-gate int count;
1277c478bd9Sstevel@tonic-gate int **foll;
1287c478bd9Sstevel@tonic-gate int *nxtpos;
1297c478bd9Sstevel@tonic-gate int *positions;
1307c478bd9Sstevel@tonic-gate int *gotof;
1317c478bd9Sstevel@tonic-gate int *nexts;
1327c478bd9Sstevel@tonic-gate CHR *nchar;
1337c478bd9Sstevel@tonic-gate int **state;
1347c478bd9Sstevel@tonic-gate int *sfall;		/* fallback state num */
1357c478bd9Sstevel@tonic-gate Boolean *cpackflg;		/* true if state has been character packed */
1367c478bd9Sstevel@tonic-gate int *atable;
1377c478bd9Sstevel@tonic-gate int nptr;
1387c478bd9Sstevel@tonic-gate Boolean symbol[MAXNCG];
1397c478bd9Sstevel@tonic-gate CHR cindex[MAXNCG];
1407c478bd9Sstevel@tonic-gate int xstate;
1417c478bd9Sstevel@tonic-gate int stnum;
1427c478bd9Sstevel@tonic-gate CHR match[MAXNCG];
1437c478bd9Sstevel@tonic-gate BYTE extra[NACTIONS];
1447c478bd9Sstevel@tonic-gate CHR *pchar, *pcptr;
1457c478bd9Sstevel@tonic-gate int pchlen = TOKENSIZE;
1467c478bd9Sstevel@tonic-gate long rcount;
1477c478bd9Sstevel@tonic-gate int *verify, *advance, *stoff;
1487c478bd9Sstevel@tonic-gate int scon;
1497c478bd9Sstevel@tonic-gate CHR *psave;
1507c478bd9Sstevel@tonic-gate 
1517c478bd9Sstevel@tonic-gate Boolean handleeuc = FALSE;
1527c478bd9Sstevel@tonic-gate Boolean widecio = FALSE;
1537c478bd9Sstevel@tonic-gate 
1547c478bd9Sstevel@tonic-gate int	isArray = 1;	/* XCU4: for %array %pointer */
155*67298654Sdamico 
156*67298654Sdamico #endif	/* _ONCE_H */
157