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 567298654Sdamico * Common Development and Distribution License (the "License"). 667298654Sdamico * 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 /* 2267298654Sdamico * 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 2967298654Sdamico #ifndef _LDEFS_H 3067298654Sdamico #define _LDEFS_H 3167298654Sdamico 327c478bd9Sstevel@tonic-gate #include <stdio.h> 337c478bd9Sstevel@tonic-gate #include <stdlib.h> 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate #include <widec.h> 367c478bd9Sstevel@tonic-gate #include <wctype.h> 377c478bd9Sstevel@tonic-gate #include "sgs.h" 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate #define CHR wchar_t 407c478bd9Sstevel@tonic-gate #define BYTE char 417c478bd9Sstevel@tonic-gate #define Boolean char 427c478bd9Sstevel@tonic-gate #define LONG_WCHAR_T 1 437c478bd9Sstevel@tonic-gate 447c478bd9Sstevel@tonic-gate #define PP 1 457c478bd9Sstevel@tonic-gate #ifdef u370 467c478bd9Sstevel@tonic-gate #define CWIDTH 8 477c478bd9Sstevel@tonic-gate #define CMASK 0377 487c478bd9Sstevel@tonic-gate #define ASCII 1 497c478bd9Sstevel@tonic-gate #else 507c478bd9Sstevel@tonic-gate 517c478bd9Sstevel@tonic-gate #ifdef unix 527c478bd9Sstevel@tonic-gate #define CWIDTH 7 537c478bd9Sstevel@tonic-gate #define CMASK 0177 547c478bd9Sstevel@tonic-gate #define ASCII 1 557c478bd9Sstevel@tonic-gate #endif 567c478bd9Sstevel@tonic-gate 577c478bd9Sstevel@tonic-gate #ifdef gcos 587c478bd9Sstevel@tonic-gate #define CWIDTH 9 597c478bd9Sstevel@tonic-gate #define CMASK 0777 607c478bd9Sstevel@tonic-gate #define ASCII 1 617c478bd9Sstevel@tonic-gate #endif 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate #ifdef ibm 647c478bd9Sstevel@tonic-gate #define CWIDTH 8 657c478bd9Sstevel@tonic-gate #define CMASK 0377 667c478bd9Sstevel@tonic-gate #define EBCDIC 1 677c478bd9Sstevel@tonic-gate #endif 687c478bd9Sstevel@tonic-gate #endif 697c478bd9Sstevel@tonic-gate 707c478bd9Sstevel@tonic-gate #define NCH 256 717c478bd9Sstevel@tonic-gate #define TOKENSIZE 10000 727c478bd9Sstevel@tonic-gate #define DEFSIZE 1000 737c478bd9Sstevel@tonic-gate #define DEFCHAR 2000 747c478bd9Sstevel@tonic-gate #define BUF_SIZ 2000 757c478bd9Sstevel@tonic-gate #define STARTCHAR 2560 767c478bd9Sstevel@tonic-gate #define STARTSIZE 256 777c478bd9Sstevel@tonic-gate #define CCLSIZE 20000 787c478bd9Sstevel@tonic-gate 797c478bd9Sstevel@tonic-gate 807c478bd9Sstevel@tonic-gate #ifdef SMALL 817c478bd9Sstevel@tonic-gate #define TREESIZE 600 827c478bd9Sstevel@tonic-gate #define NTRANS 1500 837c478bd9Sstevel@tonic-gate #define NSTATES 300 847c478bd9Sstevel@tonic-gate #define MAXPOS 1500 857c478bd9Sstevel@tonic-gate #define MAXPOSSTATE 500 867c478bd9Sstevel@tonic-gate #define NOUTPUT 1500 877c478bd9Sstevel@tonic-gate #endif 887c478bd9Sstevel@tonic-gate 897c478bd9Sstevel@tonic-gate #ifndef SMALL 907c478bd9Sstevel@tonic-gate #define TREESIZE 1000 917c478bd9Sstevel@tonic-gate #define NSTATES 500 927c478bd9Sstevel@tonic-gate #define MAXPOS 2500 937c478bd9Sstevel@tonic-gate #define MAXPOSSTATE 4*1000 947c478bd9Sstevel@tonic-gate #define NTRANS 2000 957c478bd9Sstevel@tonic-gate #define NOUTPUT 4*3000 967c478bd9Sstevel@tonic-gate #endif 977c478bd9Sstevel@tonic-gate #define NACTIONS 4*1000 987c478bd9Sstevel@tonic-gate #define ALITTLEEXTRA 300 997c478bd9Sstevel@tonic-gate 1007c478bd9Sstevel@tonic-gate #define RCCL 0x4000 1017c478bd9Sstevel@tonic-gate #define RNCCL 0x4001 1027c478bd9Sstevel@tonic-gate #define RSTR 0x4002 1037c478bd9Sstevel@tonic-gate #define RSCON 0x4003 1047c478bd9Sstevel@tonic-gate /* XCU4: add RXSCON */ 1057c478bd9Sstevel@tonic-gate #define RXSCON 0x4011 1067c478bd9Sstevel@tonic-gate #define RNEWE 0x4004 1077c478bd9Sstevel@tonic-gate #define FINAL 0x4005 1087c478bd9Sstevel@tonic-gate #define RNULLS 0x4006 1097c478bd9Sstevel@tonic-gate #define RCAT 0x4007 1107c478bd9Sstevel@tonic-gate #define STAR 0x4008 1117c478bd9Sstevel@tonic-gate #define PLUS 0x4009 1127c478bd9Sstevel@tonic-gate #define QUEST 0x400a 1137c478bd9Sstevel@tonic-gate #define DIV 0x400b 1147c478bd9Sstevel@tonic-gate #define BAR 0x400c 1157c478bd9Sstevel@tonic-gate #define CARAT 0x400d 1167c478bd9Sstevel@tonic-gate #define S1FINAL 0x400e 1177c478bd9Sstevel@tonic-gate #define S2FINAL 0x400f 1187c478bd9Sstevel@tonic-gate #define DOT 0x4010 1197c478bd9Sstevel@tonic-gate #define ISOPERATOR(n) ((n & 0xc080) == 0x4000) 1207c478bd9Sstevel@tonic-gate 1217c478bd9Sstevel@tonic-gate /* 1227c478bd9Sstevel@tonic-gate * New to JLE; this is not really a node tag. 1237c478bd9Sstevel@tonic-gate * This is used in a string pointed to by 1247c478bd9Sstevel@tonic-gate * the leaf of an RCCL or RNCCL node as a 1257c478bd9Sstevel@tonic-gate * special prefix code that substitutes 1267c478bd9Sstevel@tonic-gate * the infix '-' range operator. For 1277c478bd9Sstevel@tonic-gate * example, a lex character class "[_0-9a-zA-Z]" 1287c478bd9Sstevel@tonic-gate * would be translated to the intermidiate 1297c478bd9Sstevel@tonic-gate * form: 130*e207f0deSToomas Soome * RCCL 1317c478bd9Sstevel@tonic-gate * | 1327c478bd9Sstevel@tonic-gate * | 1337c478bd9Sstevel@tonic-gate * v 1347c478bd9Sstevel@tonic-gate * "_<RANGE>09<RANGE>a-z<RANGE>A-Z" 1357c478bd9Sstevel@tonic-gate */ 1367c478bd9Sstevel@tonic-gate #define RANGE 0x40ff 1377c478bd9Sstevel@tonic-gate 1387c478bd9Sstevel@tonic-gate #define MAXNCG 1000 1397c478bd9Sstevel@tonic-gate extern int ncgidtbl; 1407c478bd9Sstevel@tonic-gate extern int ncg; /* ncg == ncgidtbl * 2 */ 1417c478bd9Sstevel@tonic-gate typedef unsigned long lchar; 1427c478bd9Sstevel@tonic-gate extern lchar yycgidtbl[]; 1437c478bd9Sstevel@tonic-gate extern int yycgid(wchar_t); 1447c478bd9Sstevel@tonic-gate extern Boolean handleeuc; /* TRUE iff -w or -e option is specified. */ 1457c478bd9Sstevel@tonic-gate extern Boolean widecio; /* TRUE iff -w option is specified. */ 1467c478bd9Sstevel@tonic-gate 1477c478bd9Sstevel@tonic-gate #define DEFSECTION 1 1487c478bd9Sstevel@tonic-gate #define RULESECTION 2 1497c478bd9Sstevel@tonic-gate #define ENDSECTION 5 1507c478bd9Sstevel@tonic-gate 1517c478bd9Sstevel@tonic-gate #define PC 1 1527c478bd9Sstevel@tonic-gate #define PS 1 1537c478bd9Sstevel@tonic-gate 1547c478bd9Sstevel@tonic-gate #ifdef DEBUG 1557c478bd9Sstevel@tonic-gate #define LINESIZE 110 1567c478bd9Sstevel@tonic-gate extern int yydebug; 1577c478bd9Sstevel@tonic-gate extern int debug; /* 1 = on */ 1587c478bd9Sstevel@tonic-gate extern int charc; 1597c478bd9Sstevel@tonic-gate #endif 1607c478bd9Sstevel@tonic-gate 1617c478bd9Sstevel@tonic-gate #ifndef DEBUG 1627c478bd9Sstevel@tonic-gate #define freturn(s) s 1637c478bd9Sstevel@tonic-gate #endif 1647c478bd9Sstevel@tonic-gate 1657c478bd9Sstevel@tonic-gate 1667c478bd9Sstevel@tonic-gate extern int optind; 1677c478bd9Sstevel@tonic-gate extern int no_input; 1687c478bd9Sstevel@tonic-gate extern int sargc; 1697c478bd9Sstevel@tonic-gate extern char **sargv; 1707c478bd9Sstevel@tonic-gate extern char *v_stmp; 1717c478bd9Sstevel@tonic-gate extern char *release_string; 1727c478bd9Sstevel@tonic-gate extern CHR buf[]; 1737c478bd9Sstevel@tonic-gate extern int ratfor; /* 1 = ratfor, 0 = C */ 1747c478bd9Sstevel@tonic-gate extern int fatal; 1757c478bd9Sstevel@tonic-gate extern int n_error; 1767c478bd9Sstevel@tonic-gate extern int copy_line; 1777c478bd9Sstevel@tonic-gate extern int yyline; /* line number of file */ 1787c478bd9Sstevel@tonic-gate extern int sect; 1797c478bd9Sstevel@tonic-gate extern int eof; 1807c478bd9Sstevel@tonic-gate extern int lgatflg; 1817c478bd9Sstevel@tonic-gate extern int divflg; 1827c478bd9Sstevel@tonic-gate extern int funcflag; 1837c478bd9Sstevel@tonic-gate extern int pflag; 1847c478bd9Sstevel@tonic-gate extern int casecount; 1857c478bd9Sstevel@tonic-gate extern int chset; /* 1 = CHR set modified */ 1867c478bd9Sstevel@tonic-gate extern FILE *fin, *fout, *fother, *errorf; 1877c478bd9Sstevel@tonic-gate extern int fptr; 1887c478bd9Sstevel@tonic-gate extern int prev; /* previous input character */ 1897c478bd9Sstevel@tonic-gate extern int pres; /* present input character */ 1907c478bd9Sstevel@tonic-gate extern int peek; /* next input character */ 1917c478bd9Sstevel@tonic-gate extern int *name; 1927c478bd9Sstevel@tonic-gate extern int *left; 1937c478bd9Sstevel@tonic-gate extern int *right; 1947c478bd9Sstevel@tonic-gate extern int *parent; 1957c478bd9Sstevel@tonic-gate extern Boolean *nullstr; 1967c478bd9Sstevel@tonic-gate extern int tptr; 1977c478bd9Sstevel@tonic-gate extern CHR pushc[TOKENSIZE]; 1987c478bd9Sstevel@tonic-gate extern CHR *pushptr; 1997c478bd9Sstevel@tonic-gate extern CHR slist[STARTSIZE]; 2007c478bd9Sstevel@tonic-gate extern CHR *slptr; 2017c478bd9Sstevel@tonic-gate extern CHR **def, **subs, *dchar; 2027c478bd9Sstevel@tonic-gate extern CHR **sname, *schar; 2037c478bd9Sstevel@tonic-gate /* XCU4: %x exclusive start */ 2047c478bd9Sstevel@tonic-gate extern int *exclusive; 2057c478bd9Sstevel@tonic-gate extern CHR *ccl; 2067c478bd9Sstevel@tonic-gate extern CHR *ccptr; 2077c478bd9Sstevel@tonic-gate extern CHR *dp, *sp; 2087c478bd9Sstevel@tonic-gate extern int dptr, sptr; 2097c478bd9Sstevel@tonic-gate extern CHR *bptr; /* store input position */ 2107c478bd9Sstevel@tonic-gate extern CHR *tmpstat; 2117c478bd9Sstevel@tonic-gate extern int count; 2127c478bd9Sstevel@tonic-gate extern int **foll; 2137c478bd9Sstevel@tonic-gate extern int *nxtpos; 2147c478bd9Sstevel@tonic-gate extern int *positions; 2157c478bd9Sstevel@tonic-gate extern int *gotof; 2167c478bd9Sstevel@tonic-gate extern int *nexts; 2177c478bd9Sstevel@tonic-gate extern CHR *nchar; 2187c478bd9Sstevel@tonic-gate extern int **state; 2197c478bd9Sstevel@tonic-gate extern int *sfall; /* fallback state num */ 2207c478bd9Sstevel@tonic-gate extern Boolean *cpackflg; /* true if state has been character packed */ 2217c478bd9Sstevel@tonic-gate extern int *atable, aptr; 2227c478bd9Sstevel@tonic-gate extern int nptr; 2237c478bd9Sstevel@tonic-gate extern Boolean symbol[MAXNCG]; 2247c478bd9Sstevel@tonic-gate extern CHR cindex[MAXNCG]; 2257c478bd9Sstevel@tonic-gate extern int xstate; 2267c478bd9Sstevel@tonic-gate extern int stnum; 2277c478bd9Sstevel@tonic-gate extern int ctable[]; 2287c478bd9Sstevel@tonic-gate extern int ZCH; 2297c478bd9Sstevel@tonic-gate extern int ccount; 2307c478bd9Sstevel@tonic-gate extern CHR match[MAXNCG]; 2317c478bd9Sstevel@tonic-gate extern BYTE extra[]; 2327c478bd9Sstevel@tonic-gate extern CHR *pcptr, *pchar; 2337c478bd9Sstevel@tonic-gate extern int pchlen; 2347c478bd9Sstevel@tonic-gate extern int nstates, maxpos; 2357c478bd9Sstevel@tonic-gate extern int yytop; 2367c478bd9Sstevel@tonic-gate extern int report; 2377c478bd9Sstevel@tonic-gate extern int ntrans, treesize, outsize; 2387c478bd9Sstevel@tonic-gate extern long rcount; 2397c478bd9Sstevel@tonic-gate extern int optim; 2407c478bd9Sstevel@tonic-gate extern int *verify, *advance, *stoff; 2417c478bd9Sstevel@tonic-gate extern int scon; 2427c478bd9Sstevel@tonic-gate extern CHR *psave; 2437c478bd9Sstevel@tonic-gate extern CHR *getl(); 2447c478bd9Sstevel@tonic-gate extern BYTE *myalloc(); 2457c478bd9Sstevel@tonic-gate 2467c478bd9Sstevel@tonic-gate void phead1(void); 2477c478bd9Sstevel@tonic-gate void phead2(void); 2487c478bd9Sstevel@tonic-gate void ptail(void); 2497c478bd9Sstevel@tonic-gate void statistics(void); 2507c478bd9Sstevel@tonic-gate void error_tail(void) __NORETURN; 251*e207f0deSToomas Soome void error(char *, ...); 252*e207f0deSToomas Soome void warning(char *, ...); 2537c478bd9Sstevel@tonic-gate void lgate(void); 2547c478bd9Sstevel@tonic-gate void scopy(CHR *s, CHR *t); 2557c478bd9Sstevel@tonic-gate void cclinter(int sw); 2567c478bd9Sstevel@tonic-gate void cpycom(CHR *p); 2577c478bd9Sstevel@tonic-gate void munput(int t, CHR *p); 2587c478bd9Sstevel@tonic-gate void cfoll(int v); 2597c478bd9Sstevel@tonic-gate void cgoto(void); 2607c478bd9Sstevel@tonic-gate void mkmatch(void); 2617c478bd9Sstevel@tonic-gate void layout(void); 2627c478bd9Sstevel@tonic-gate void remch(wchar_t c); 2637c478bd9Sstevel@tonic-gate void sortcgidtbl(void); 2647c478bd9Sstevel@tonic-gate void repbycgid(void); 2657c478bd9Sstevel@tonic-gate int gch(void); 2667c478bd9Sstevel@tonic-gate int slength(CHR *s); 2677c478bd9Sstevel@tonic-gate int yyparse(void); 2687c478bd9Sstevel@tonic-gate int scomp(CHR *x, CHR *y); 2697c478bd9Sstevel@tonic-gate int space(int ch); 2707c478bd9Sstevel@tonic-gate int siconv(CHR *t); 2717c478bd9Sstevel@tonic-gate int digit(int c); 2727c478bd9Sstevel@tonic-gate int ctrans(CHR **ss); 2737c478bd9Sstevel@tonic-gate int cpyact(void); 2747c478bd9Sstevel@tonic-gate int lookup(CHR *s, CHR **t); 2757c478bd9Sstevel@tonic-gate int usescape(int c); 2767c478bd9Sstevel@tonic-gate int alpha(int c); 2777c478bd9Sstevel@tonic-gate int mn2(int a, int d, int c); 2787c478bd9Sstevel@tonic-gate int mn1(int a, int d); 2797c478bd9Sstevel@tonic-gate int mn0(int a); 2807c478bd9Sstevel@tonic-gate int dupl(int n); 2817c478bd9Sstevel@tonic-gate 2827c478bd9Sstevel@tonic-gate extern int isArray; /* XCU4: for %array %pointer */ 28367298654Sdamico 28467298654Sdamico #endif /* _LDEFS_H */ 285