1*0Sstevel@tonic-gate/* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate 23*0Sstevel@tonic-gate/* Copyright (c) 1989 AT&T */ 24*0Sstevel@tonic-gate/* All Rights Reserved */ 25*0Sstevel@tonic-gate 26*0Sstevel@tonic-gate#pragma ident "%Z%%M% %I% %E% SMI" 27*0Sstevel@tonic-gate 28*0Sstevel@tonic-gateint yylineno =1; 29*0Sstevel@tonic-gate# define YYU(x) x 30*0Sstevel@tonic-gate# define NLSTATE yyprevious=YYNEWLINE 31*0Sstevel@tonic-gatestruct yysvf *yylstate [YYLMAX], **yylsp, **yyolsp; 32*0Sstevel@tonic-gatechar yysbuf[YYLMAX]; 33*0Sstevel@tonic-gatechar *yysptr = yysbuf; 34*0Sstevel@tonic-gateint *yyfnd; 35*0Sstevel@tonic-gateextern struct yysvf *yyestate; 36*0Sstevel@tonic-gateint yyprevious = YYNEWLINE; 37*0Sstevel@tonic-gate#if defined(__cplusplus) || defined(__STDC__) 38*0Sstevel@tonic-gateint yylook(void) 39*0Sstevel@tonic-gate#else 40*0Sstevel@tonic-gateyylook() 41*0Sstevel@tonic-gate#endif 42*0Sstevel@tonic-gate{ 43*0Sstevel@tonic-gate register struct yysvf *yystate, **lsp; 44*0Sstevel@tonic-gate register struct yywork *yyt; 45*0Sstevel@tonic-gate struct yysvf *yyz; 46*0Sstevel@tonic-gate int yych, yyfirst; 47*0Sstevel@tonic-gate struct yywork *yyr; 48*0Sstevel@tonic-gate# ifdef LEXDEBUG 49*0Sstevel@tonic-gate int debug; 50*0Sstevel@tonic-gate# endif 51*0Sstevel@tonic-gate char *yylastch; 52*0Sstevel@tonic-gate /* start off machines */ 53*0Sstevel@tonic-gate# ifdef LEXDEBUG 54*0Sstevel@tonic-gate debug = 0; 55*0Sstevel@tonic-gate# endif 56*0Sstevel@tonic-gate yyfirst=1; 57*0Sstevel@tonic-gate if (!yymorfg) 58*0Sstevel@tonic-gate yylastch = yytext; 59*0Sstevel@tonic-gate else { 60*0Sstevel@tonic-gate yymorfg=0; 61*0Sstevel@tonic-gate yylastch = yytext+yyleng; 62*0Sstevel@tonic-gate } 63*0Sstevel@tonic-gate for(;;){ 64*0Sstevel@tonic-gate lsp = yylstate; 65*0Sstevel@tonic-gate yyestate = yystate = yybgin; 66*0Sstevel@tonic-gate if (yyprevious==YYNEWLINE) yystate++; 67*0Sstevel@tonic-gate for (;;){ 68*0Sstevel@tonic-gate# ifdef LEXDEBUG 69*0Sstevel@tonic-gate if(debug)fprintf(yyout,"state %d\n",yystate-yysvec-1); 70*0Sstevel@tonic-gate# endif 71*0Sstevel@tonic-gate yyt = yystate->yystoff; 72*0Sstevel@tonic-gate if(yyt == yycrank && !yyfirst){ /* may not be any transitions */ 73*0Sstevel@tonic-gate yyz = yystate->yyother; 74*0Sstevel@tonic-gate if(yyz == 0)break; 75*0Sstevel@tonic-gate if(yyz->yystoff == yycrank)break; 76*0Sstevel@tonic-gate } 77*0Sstevel@tonic-gate#ifndef __cplusplus 78*0Sstevel@tonic-gate *yylastch++ = yych = input(); 79*0Sstevel@tonic-gate#else 80*0Sstevel@tonic-gate *yylastch++ = yych = lex_input(); 81*0Sstevel@tonic-gate#endif 82*0Sstevel@tonic-gate#ifdef YYISARRAY 83*0Sstevel@tonic-gate if(yylastch > &yytext[YYLMAX]) { 84*0Sstevel@tonic-gate fprintf(yyout,"Input string too long, limit %d\n",YYLMAX); 85*0Sstevel@tonic-gate exit(1); 86*0Sstevel@tonic-gate } 87*0Sstevel@tonic-gate#else 88*0Sstevel@tonic-gate if (yylastch >= &yytext[ yytextsz ]) { 89*0Sstevel@tonic-gate int x = yylastch - yytext; 90*0Sstevel@tonic-gate 91*0Sstevel@tonic-gate yytextsz += YYTEXTSZINC; 92*0Sstevel@tonic-gate if (yytext == yy_tbuf) { 93*0Sstevel@tonic-gate yytext = (char *) malloc(yytextsz); 94*0Sstevel@tonic-gate memcpy(yytext, yy_tbuf, sizeof (yy_tbuf)); 95*0Sstevel@tonic-gate } 96*0Sstevel@tonic-gate else 97*0Sstevel@tonic-gate yytext = (char *) realloc(yytext, yytextsz); 98*0Sstevel@tonic-gate if (!yytext) { 99*0Sstevel@tonic-gate fprintf(yyout, 100*0Sstevel@tonic-gate "Cannot realloc yytext\n"); 101*0Sstevel@tonic-gate exit(1); 102*0Sstevel@tonic-gate } 103*0Sstevel@tonic-gate yylastch = yytext + x; 104*0Sstevel@tonic-gate } 105*0Sstevel@tonic-gate#endif 106*0Sstevel@tonic-gate yyfirst=0; 107*0Sstevel@tonic-gate tryagain: 108*0Sstevel@tonic-gate# ifdef LEXDEBUG 109*0Sstevel@tonic-gate if(debug){ 110*0Sstevel@tonic-gate fprintf(yyout,"char "); 111*0Sstevel@tonic-gate allprint(yych); 112*0Sstevel@tonic-gate putchar('\n'); 113*0Sstevel@tonic-gate } 114*0Sstevel@tonic-gate# endif 115*0Sstevel@tonic-gate yyr = yyt; 116*0Sstevel@tonic-gate if ( (uintptr_t)yyt > (uintptr_t)yycrank){ 117*0Sstevel@tonic-gate yyt = yyr + yych; 118*0Sstevel@tonic-gate if (yyt <= yytop && yyt->verify+yysvec == yystate){ 119*0Sstevel@tonic-gate if(yyt->advance+yysvec == YYLERR) /* error transitions */ 120*0Sstevel@tonic-gate {unput(*--yylastch);break;} 121*0Sstevel@tonic-gate *lsp++ = yystate = yyt->advance+yysvec; 122*0Sstevel@tonic-gate if(lsp > &yylstate[YYLMAX]) { 123*0Sstevel@tonic-gate fprintf(yyout,"Input string too long, limit %d\n",YYLMAX); 124*0Sstevel@tonic-gate exit(1); 125*0Sstevel@tonic-gate } 126*0Sstevel@tonic-gate goto contin; 127*0Sstevel@tonic-gate } 128*0Sstevel@tonic-gate } 129*0Sstevel@tonic-gate# ifdef YYOPTIM 130*0Sstevel@tonic-gate else if((uintptr_t)yyt < (uintptr_t)yycrank) { /* r < yycrank */ 131*0Sstevel@tonic-gate yyt = yyr = yycrank+(yycrank-yyt); 132*0Sstevel@tonic-gate# ifdef LEXDEBUG 133*0Sstevel@tonic-gate if(debug)fprintf(yyout,"compressed state\n"); 134*0Sstevel@tonic-gate# endif 135*0Sstevel@tonic-gate yyt = yyt + yych; 136*0Sstevel@tonic-gate if(yyt <= yytop && yyt->verify+yysvec == yystate){ 137*0Sstevel@tonic-gate if(yyt->advance+yysvec == YYLERR) /* error transitions */ 138*0Sstevel@tonic-gate {unput(*--yylastch);break;} 139*0Sstevel@tonic-gate *lsp++ = yystate = yyt->advance+yysvec; 140*0Sstevel@tonic-gate if(lsp > &yylstate[YYLMAX]) { 141*0Sstevel@tonic-gate fprintf(yyout,"Input string too long, limit %d\n",YYLMAX); 142*0Sstevel@tonic-gate exit(1); 143*0Sstevel@tonic-gate } 144*0Sstevel@tonic-gate goto contin; 145*0Sstevel@tonic-gate } 146*0Sstevel@tonic-gate yyt = yyr + YYU(yymatch[yych]); 147*0Sstevel@tonic-gate# ifdef LEXDEBUG 148*0Sstevel@tonic-gate if(debug){ 149*0Sstevel@tonic-gate fprintf(yyout,"try fall back character "); 150*0Sstevel@tonic-gate allprint(YYU(yymatch[yych])); 151*0Sstevel@tonic-gate putchar('\n'); 152*0Sstevel@tonic-gate } 153*0Sstevel@tonic-gate# endif 154*0Sstevel@tonic-gate if(yyt <= yytop && yyt->verify+yysvec == yystate){ 155*0Sstevel@tonic-gate if(yyt->advance+yysvec == YYLERR) /* error transition */ 156*0Sstevel@tonic-gate {unput(*--yylastch);break;} 157*0Sstevel@tonic-gate *lsp++ = yystate = yyt->advance+yysvec; 158*0Sstevel@tonic-gate if(lsp > &yylstate[YYLMAX]) { 159*0Sstevel@tonic-gate fprintf(yyout,"Input string too long, limit %d\n",YYLMAX); 160*0Sstevel@tonic-gate exit(1); 161*0Sstevel@tonic-gate } 162*0Sstevel@tonic-gate goto contin; 163*0Sstevel@tonic-gate } 164*0Sstevel@tonic-gate } 165*0Sstevel@tonic-gate if ((yystate = yystate->yyother) && (yyt= yystate->yystoff) != yycrank){ 166*0Sstevel@tonic-gate# ifdef LEXDEBUG 167*0Sstevel@tonic-gate if(debug)fprintf(yyout,"fall back to state %d\n",yystate-yysvec-1); 168*0Sstevel@tonic-gate# endif 169*0Sstevel@tonic-gate goto tryagain; 170*0Sstevel@tonic-gate } 171*0Sstevel@tonic-gate# endif 172*0Sstevel@tonic-gate else 173*0Sstevel@tonic-gate {unput(*--yylastch);break;} 174*0Sstevel@tonic-gate contin: 175*0Sstevel@tonic-gate# ifdef LEXDEBUG 176*0Sstevel@tonic-gate if(debug){ 177*0Sstevel@tonic-gate fprintf(yyout,"state %d char ",yystate-yysvec-1); 178*0Sstevel@tonic-gate allprint(yych); 179*0Sstevel@tonic-gate putchar('\n'); 180*0Sstevel@tonic-gate } 181*0Sstevel@tonic-gate# endif 182*0Sstevel@tonic-gate ; 183*0Sstevel@tonic-gate } 184*0Sstevel@tonic-gate# ifdef LEXDEBUG 185*0Sstevel@tonic-gate if(debug){ 186*0Sstevel@tonic-gate fprintf(yyout,"stopped at %d with ",*(lsp-1)-yysvec-1); 187*0Sstevel@tonic-gate allprint(yych); 188*0Sstevel@tonic-gate putchar('\n'); 189*0Sstevel@tonic-gate } 190*0Sstevel@tonic-gate# endif 191*0Sstevel@tonic-gate while (lsp-- > yylstate){ 192*0Sstevel@tonic-gate *yylastch-- = 0; 193*0Sstevel@tonic-gate if (*lsp != 0 && (yyfnd= (*lsp)->yystops) && *yyfnd > 0){ 194*0Sstevel@tonic-gate yyolsp = lsp; 195*0Sstevel@tonic-gate if(yyextra[*yyfnd]){ /* must backup */ 196*0Sstevel@tonic-gate while(yyback((*lsp)->yystops,-*yyfnd) != 1 && lsp > yylstate){ 197*0Sstevel@tonic-gate lsp--; 198*0Sstevel@tonic-gate unput(*yylastch--); 199*0Sstevel@tonic-gate } 200*0Sstevel@tonic-gate } 201*0Sstevel@tonic-gate yyprevious = YYU(*yylastch); 202*0Sstevel@tonic-gate yylsp = lsp; 203*0Sstevel@tonic-gate yyleng = yylastch-yytext+1; 204*0Sstevel@tonic-gate yytext[yyleng] = 0; 205*0Sstevel@tonic-gate# ifdef LEXDEBUG 206*0Sstevel@tonic-gate if(debug){ 207*0Sstevel@tonic-gate fprintf(yyout,"\nmatch "); 208*0Sstevel@tonic-gate sprint(yytext); 209*0Sstevel@tonic-gate fprintf(yyout," action %d\n",*yyfnd); 210*0Sstevel@tonic-gate } 211*0Sstevel@tonic-gate# endif 212*0Sstevel@tonic-gate return(*yyfnd++); 213*0Sstevel@tonic-gate } 214*0Sstevel@tonic-gate unput(*yylastch); 215*0Sstevel@tonic-gate } 216*0Sstevel@tonic-gate if (yytext[0] == 0 /* && feof(yyin) */) 217*0Sstevel@tonic-gate { 218*0Sstevel@tonic-gate yysptr=yysbuf; 219*0Sstevel@tonic-gate return(0); 220*0Sstevel@tonic-gate } 221*0Sstevel@tonic-gate#ifndef __cplusplus 222*0Sstevel@tonic-gate yyprevious = yytext[0] = input(); 223*0Sstevel@tonic-gate if (yyprevious>0) 224*0Sstevel@tonic-gate output(yyprevious); 225*0Sstevel@tonic-gate#else 226*0Sstevel@tonic-gate yyprevious = yytext[0] = lex_input(); 227*0Sstevel@tonic-gate if (yyprevious>0) 228*0Sstevel@tonic-gate lex_output(yyprevious); 229*0Sstevel@tonic-gate#endif 230*0Sstevel@tonic-gate yylastch=yytext; 231*0Sstevel@tonic-gate# ifdef LEXDEBUG 232*0Sstevel@tonic-gate if(debug)putchar('\n'); 233*0Sstevel@tonic-gate# endif 234*0Sstevel@tonic-gate } 235*0Sstevel@tonic-gate } 236*0Sstevel@tonic-gate#if defined(__cplusplus) || defined(__STDC__) 237*0Sstevel@tonic-gateint yyback(int *p, int m) 238*0Sstevel@tonic-gate#else 239*0Sstevel@tonic-gateyyback(p, m) 240*0Sstevel@tonic-gate int *p; 241*0Sstevel@tonic-gate#endif 242*0Sstevel@tonic-gate{ 243*0Sstevel@tonic-gate if (p==0) return(0); 244*0Sstevel@tonic-gate while (*p) { 245*0Sstevel@tonic-gate if (*p++ == m) 246*0Sstevel@tonic-gate return(1); 247*0Sstevel@tonic-gate } 248*0Sstevel@tonic-gate return(0); 249*0Sstevel@tonic-gate} 250*0Sstevel@tonic-gate /* the following are only used in the lex library */ 251*0Sstevel@tonic-gate#if defined(__cplusplus) || defined(__STDC__) 252*0Sstevel@tonic-gateint yyinput(void) 253*0Sstevel@tonic-gate#else 254*0Sstevel@tonic-gateyyinput() 255*0Sstevel@tonic-gate#endif 256*0Sstevel@tonic-gate{ 257*0Sstevel@tonic-gate#ifndef __cplusplus 258*0Sstevel@tonic-gate return(input()); 259*0Sstevel@tonic-gate#else 260*0Sstevel@tonic-gate return(lex_input()); 261*0Sstevel@tonic-gate#endif 262*0Sstevel@tonic-gate } 263*0Sstevel@tonic-gate#if defined(__cplusplus) || defined(__STDC__) 264*0Sstevel@tonic-gatevoid yyoutput(int c) 265*0Sstevel@tonic-gate#else 266*0Sstevel@tonic-gateyyoutput(c) 267*0Sstevel@tonic-gate int c; 268*0Sstevel@tonic-gate#endif 269*0Sstevel@tonic-gate{ 270*0Sstevel@tonic-gate#ifndef __cplusplus 271*0Sstevel@tonic-gate output(c); 272*0Sstevel@tonic-gate#else 273*0Sstevel@tonic-gate lex_output(c); 274*0Sstevel@tonic-gate#endif 275*0Sstevel@tonic-gate } 276*0Sstevel@tonic-gate#if defined(__cplusplus) || defined(__STDC__) 277*0Sstevel@tonic-gatevoid yyunput(int c) 278*0Sstevel@tonic-gate#else 279*0Sstevel@tonic-gateyyunput(c) 280*0Sstevel@tonic-gate int c; 281*0Sstevel@tonic-gate#endif 282*0Sstevel@tonic-gate{ 283*0Sstevel@tonic-gate unput(c); 284*0Sstevel@tonic-gate } 285