1*4538Sdamico /* 2*4538Sdamico * CDDL HEADER START 3*4538Sdamico * 4*4538Sdamico * The contents of this file are subject to the terms of the 5*4538Sdamico * Common Development and Distribution License (the "License"). 6*4538Sdamico * You may not use this file except in compliance with the License. 7*4538Sdamico * 8*4538Sdamico * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*4538Sdamico * or http://www.opensolaris.org/os/licensing. 10*4538Sdamico * See the License for the specific language governing permissions 11*4538Sdamico * and limitations under the License. 12*4538Sdamico * 13*4538Sdamico * When distributing Covered Code, include this CDDL HEADER in each 14*4538Sdamico * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*4538Sdamico * If applicable, add the following below this CDDL HEADER, with the 16*4538Sdamico * fields enclosed by brackets "[]" replaced with your own identifying 17*4538Sdamico * information: Portions Copyright [yyyy] [name of copyright owner] 18*4538Sdamico * 19*4538Sdamico * CDDL HEADER END 20*4538Sdamico */ 21*4538Sdamico /* 22*4538Sdamico * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 23*4538Sdamico * Use is subject to license terms. 24*4538Sdamico */ 25*4538Sdamico 26*4538Sdamico /* Copyright (c) 1988 AT&T */ 27*4538Sdamico /* All Rights Reserved */ 28*4538Sdamico 29*4538Sdamico #ifndef _LDEFS_H 30*4538Sdamico #define _LDEFS_H 31*4538Sdamico 32*4538Sdamico #pragma ident "%Z%%M% %I% %E% SMI" 33*4538Sdamico 34*4538Sdamico #include <stdio.h> 35*4538Sdamico #include <stdlib.h> 36*4538Sdamico 37*4538Sdamico #include <widec.h> 38*4538Sdamico #include <wctype.h> 39*4538Sdamico #include "sgs.h" 40*4538Sdamico 41*4538Sdamico #define CHR wchar_t 42*4538Sdamico #define BYTE char 43*4538Sdamico #define Boolean char 44*4538Sdamico #define LONG_WCHAR_T 1 45*4538Sdamico 46*4538Sdamico #define PP 1 47*4538Sdamico #ifdef u370 48*4538Sdamico #define CWIDTH 8 49*4538Sdamico #define CMASK 0377 50*4538Sdamico #define ASCII 1 51*4538Sdamico #else 52*4538Sdamico 53*4538Sdamico #ifdef unix 54*4538Sdamico #define CWIDTH 7 55*4538Sdamico #define CMASK 0177 56*4538Sdamico #define ASCII 1 57*4538Sdamico #endif 58*4538Sdamico 59*4538Sdamico #ifdef gcos 60*4538Sdamico #define CWIDTH 9 61*4538Sdamico #define CMASK 0777 62*4538Sdamico #define ASCII 1 63*4538Sdamico #endif 64*4538Sdamico 65*4538Sdamico #ifdef ibm 66*4538Sdamico #define CWIDTH 8 67*4538Sdamico #define CMASK 0377 68*4538Sdamico #define EBCDIC 1 69*4538Sdamico #endif 70*4538Sdamico #endif 71*4538Sdamico 72*4538Sdamico #define NCH 256 73*4538Sdamico #define TOKENSIZE 10000 74*4538Sdamico #define DEFSIZE 1000 75*4538Sdamico #define DEFCHAR 2000 76*4538Sdamico #define BUF_SIZ 2000 77*4538Sdamico #define STARTCHAR 2560 78*4538Sdamico #define STARTSIZE 256 79*4538Sdamico #define CCLSIZE 20000 80*4538Sdamico 81*4538Sdamico 82*4538Sdamico #ifdef SMALL 83*4538Sdamico #define TREESIZE 600 84*4538Sdamico #define NTRANS 1500 85*4538Sdamico #define NSTATES 300 86*4538Sdamico #define MAXPOS 1500 87*4538Sdamico #define MAXPOSSTATE 500 88*4538Sdamico #define NOUTPUT 1500 89*4538Sdamico #endif 90*4538Sdamico 91*4538Sdamico #ifndef SMALL 92*4538Sdamico #define TREESIZE 1000 93*4538Sdamico #define NSTATES 500 94*4538Sdamico #define MAXPOS 2500 95*4538Sdamico #define MAXPOSSTATE 4*1000 96*4538Sdamico #define NTRANS 2000 97*4538Sdamico #define NOUTPUT 4*3000 98*4538Sdamico #endif 99*4538Sdamico #define NACTIONS 4*1000 100*4538Sdamico #define ALITTLEEXTRA 300 101*4538Sdamico 102*4538Sdamico #define RCCL 0x4000 103*4538Sdamico #define RNCCL 0x4001 104*4538Sdamico #define RSTR 0x4002 105*4538Sdamico #define RSCON 0x4003 106*4538Sdamico /* XCU4: add RXSCON */ 107*4538Sdamico #define RXSCON 0x4011 108*4538Sdamico #define RNEWE 0x4004 109*4538Sdamico #define FINAL 0x4005 110*4538Sdamico #define RNULLS 0x4006 111*4538Sdamico #define RCAT 0x4007 112*4538Sdamico #define STAR 0x4008 113*4538Sdamico #define PLUS 0x4009 114*4538Sdamico #define QUEST 0x400a 115*4538Sdamico #define DIV 0x400b 116*4538Sdamico #define BAR 0x400c 117*4538Sdamico #define CARAT 0x400d 118*4538Sdamico #define S1FINAL 0x400e 119*4538Sdamico #define S2FINAL 0x400f 120*4538Sdamico #define DOT 0x4010 121*4538Sdamico #define ISOPERATOR(n) ((n & 0xc080) == 0x4000) 122*4538Sdamico 123*4538Sdamico /* 124*4538Sdamico * New to JLE; this is not really a node tag. 125*4538Sdamico * This is used in a string pointed to by 126*4538Sdamico * the leaf of an RCCL or RNCCL node as a 127*4538Sdamico * special prefix code that substitutes 128*4538Sdamico * the infix '-' range operator. For 129*4538Sdamico * example, a lex character class "[_0-9a-zA-Z]" 130*4538Sdamico * would be translated to the intermidiate 131*4538Sdamico * form: 132*4538Sdamico * RCCL 133*4538Sdamico * | 134*4538Sdamico * | 135*4538Sdamico * v 136*4538Sdamico * "_<RANGE>09<RANGE>a-z<RANGE>A-Z" 137*4538Sdamico */ 138*4538Sdamico #define RANGE 0x40ff 139*4538Sdamico 140*4538Sdamico #define MAXNCG 1000 141*4538Sdamico extern int ncgidtbl; 142*4538Sdamico extern int ncg; /* ncg == ncgidtbl * 2 */ 143*4538Sdamico typedef unsigned long lchar; 144*4538Sdamico extern lchar yycgidtbl[]; 145*4538Sdamico extern int yycgid(wchar_t); 146*4538Sdamico extern Boolean handleeuc; /* TRUE iff -w or -e option is specified. */ 147*4538Sdamico extern Boolean widecio; /* TRUE iff -w option is specified. */ 148*4538Sdamico 149*4538Sdamico #define DEFSECTION 1 150*4538Sdamico #define RULESECTION 2 151*4538Sdamico #define ENDSECTION 5 152*4538Sdamico 153*4538Sdamico #define PC 1 154*4538Sdamico #define PS 1 155*4538Sdamico 156*4538Sdamico #ifdef DEBUG 157*4538Sdamico #define LINESIZE 110 158*4538Sdamico extern int yydebug; 159*4538Sdamico extern int debug; /* 1 = on */ 160*4538Sdamico extern int charc; 161*4538Sdamico #endif 162*4538Sdamico 163*4538Sdamico #ifndef DEBUG 164*4538Sdamico #define freturn(s) s 165*4538Sdamico #endif 166*4538Sdamico 167*4538Sdamico 168*4538Sdamico extern int optind; 169*4538Sdamico extern int no_input; 170*4538Sdamico extern int sargc; 171*4538Sdamico extern char **sargv; 172*4538Sdamico extern char *v_stmp; 173*4538Sdamico extern char *release_string; 174*4538Sdamico extern CHR buf[]; 175*4538Sdamico extern int ratfor; /* 1 = ratfor, 0 = C */ 176*4538Sdamico extern int fatal; 177*4538Sdamico extern int n_error; 178*4538Sdamico extern int copy_line; 179*4538Sdamico extern int yyline; /* line number of file */ 180*4538Sdamico extern int sect; 181*4538Sdamico extern int eof; 182*4538Sdamico extern int lgatflg; 183*4538Sdamico extern int divflg; 184*4538Sdamico extern int funcflag; 185*4538Sdamico extern int pflag; 186*4538Sdamico extern int casecount; 187*4538Sdamico extern int chset; /* 1 = CHR set modified */ 188*4538Sdamico extern FILE *fin, *fout, *fother, *errorf; 189*4538Sdamico extern int fptr; 190*4538Sdamico extern int prev; /* previous input character */ 191*4538Sdamico extern int pres; /* present input character */ 192*4538Sdamico extern int peek; /* next input character */ 193*4538Sdamico extern int *name; 194*4538Sdamico extern int *left; 195*4538Sdamico extern int *right; 196*4538Sdamico extern int *parent; 197*4538Sdamico extern Boolean *nullstr; 198*4538Sdamico extern int tptr; 199*4538Sdamico extern CHR pushc[TOKENSIZE]; 200*4538Sdamico extern CHR *pushptr; 201*4538Sdamico extern CHR slist[STARTSIZE]; 202*4538Sdamico extern CHR *slptr; 203*4538Sdamico extern CHR **def, **subs, *dchar; 204*4538Sdamico extern CHR **sname, *schar; 205*4538Sdamico /* XCU4: %x exclusive start */ 206*4538Sdamico extern int *exclusive; 207*4538Sdamico extern CHR *ccl; 208*4538Sdamico extern CHR *ccptr; 209*4538Sdamico extern CHR *dp, *sp; 210*4538Sdamico extern int dptr, sptr; 211*4538Sdamico extern CHR *bptr; /* store input position */ 212*4538Sdamico extern CHR *tmpstat; 213*4538Sdamico extern int count; 214*4538Sdamico extern int **foll; 215*4538Sdamico extern int *nxtpos; 216*4538Sdamico extern int *positions; 217*4538Sdamico extern int *gotof; 218*4538Sdamico extern int *nexts; 219*4538Sdamico extern CHR *nchar; 220*4538Sdamico extern int **state; 221*4538Sdamico extern int *sfall; /* fallback state num */ 222*4538Sdamico extern Boolean *cpackflg; /* true if state has been character packed */ 223*4538Sdamico extern int *atable, aptr; 224*4538Sdamico extern int nptr; 225*4538Sdamico extern Boolean symbol[MAXNCG]; 226*4538Sdamico extern CHR cindex[MAXNCG]; 227*4538Sdamico extern int xstate; 228*4538Sdamico extern int stnum; 229*4538Sdamico extern int ctable[]; 230*4538Sdamico extern int ZCH; 231*4538Sdamico extern int ccount; 232*4538Sdamico extern CHR match[MAXNCG]; 233*4538Sdamico extern BYTE extra[]; 234*4538Sdamico extern CHR *pcptr, *pchar; 235*4538Sdamico extern int pchlen; 236*4538Sdamico extern int nstates, maxpos; 237*4538Sdamico extern int yytop; 238*4538Sdamico extern int report; 239*4538Sdamico extern int ntrans, treesize, outsize; 240*4538Sdamico extern long rcount; 241*4538Sdamico extern int optim; 242*4538Sdamico extern int *verify, *advance, *stoff; 243*4538Sdamico extern int scon; 244*4538Sdamico extern CHR *psave; 245*4538Sdamico extern CHR *getl(); 246*4538Sdamico extern BYTE *myalloc(); 247*4538Sdamico 248*4538Sdamico void phead1(void); 249*4538Sdamico void phead2(void); 250*4538Sdamico void ptail(void); 251*4538Sdamico void statistics(void); 252*4538Sdamico void error_tail(void) __NORETURN; 253*4538Sdamico void error(); 254*4538Sdamico void warning(); 255*4538Sdamico void lgate(void); 256*4538Sdamico void scopy(CHR *s, CHR *t); 257*4538Sdamico void cclinter(int sw); 258*4538Sdamico void cpycom(CHR *p); 259*4538Sdamico void munput(int t, CHR *p); 260*4538Sdamico void cfoll(int v); 261*4538Sdamico void cgoto(void); 262*4538Sdamico void mkmatch(void); 263*4538Sdamico void layout(void); 264*4538Sdamico void remch(wchar_t c); 265*4538Sdamico void sortcgidtbl(void); 266*4538Sdamico void repbycgid(void); 267*4538Sdamico int gch(void); 268*4538Sdamico int slength(CHR *s); 269*4538Sdamico int yyparse(void); 270*4538Sdamico int scomp(CHR *x, CHR *y); 271*4538Sdamico int space(int ch); 272*4538Sdamico int siconv(CHR *t); 273*4538Sdamico int digit(int c); 274*4538Sdamico int ctrans(CHR **ss); 275*4538Sdamico int cpyact(void); 276*4538Sdamico int lookup(CHR *s, CHR **t); 277*4538Sdamico int usescape(int c); 278*4538Sdamico int alpha(int c); 279*4538Sdamico int mn2(int a, int d, int c); 280*4538Sdamico int mn1(int a, int d); 281*4538Sdamico int mn0(int a); 282*4538Sdamico int dupl(int n); 283*4538Sdamico 284*4538Sdamico extern int isArray; /* XCU4: for %array %pointer */ 285*4538Sdamico 286*4538Sdamico #endif /* _LDEFS_H */ 287