4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2005 Sun Microsystems, Inc.
24 * All rights reserved.
25 * Use is subject to license terms.
28 /* Copyright (c) 1989 AT&T */
29 /* All Rights Reserved */
32 #pragma ident "%Z%%M% %I% %E% SMI"
36 #define LONG_WCHAR_T 1
38 # define NLSTATE yyprevious=YYNEWLINE
39 wchar_t yysbuf[YYLMAX];
40 wchar_t *yysptr = yysbuf;
41 struct yysvf *yylstate [YYLMAX], **yylsp, **yyolsp;
43 extern struct yysvf *yyestate;
44 int yyprevious = YYNEWLINE;
45 #if defined(__cplusplus) || defined(__STDC__)
51 struct yysvf *yystate, **lsp;
60 /* start off machines */
69 yylastch = YYTEXT+YYLENG;
73 yyestate = yystate = yybgin;
74 if (yyprevious==YYNEWLINE) yystate++;
77 if(debug)fprintf(yyout,"state %d\n",yystate-yysvec-1);
79 yyt = yystate->yystoff;
80 if(yyt == yycrank && !yyfirst){ /* may not be any transitions */
81 yyz = yystate->yyother;
83 if(yyz->yystoff == yycrank)break;
85 *yylastch++ = yych = YYINPUT();
87 if(yylastch > &YYTEXT[YYLMAX]) {
88 fprintf(yyout,"Input string too long, limit %d\n",YYLMAX);
92 if (yylastch >= &YYTEXT[ yytextsz ]) {
93 int x = yylastch - YYTEXT;
95 yytextsz += YYTEXTSZINC;
96 #ifdef YYLEX_E /* -e */
97 if (YYTEXT == yy_twbuf) {
101 memcpy(YYTEXT, yy_twbuf,
106 memcpy(yytext, yy_tbuf,
109 if (YYTEXT == yy_tbuf) {
113 memcpy(YYTEXT, yy_tbuf,
119 realloc(YYTEXT, yytextsz);
120 #ifdef YYLEX_E /* -e */
123 yytextsz * sizeof (wchar_t));
128 "Cannot realloc YYTEXT\n");
131 yylastch = YYTEXT + x;
134 yygid = yycgid(yych);
139 fprintf(yyout,"wchar_t ");
141 fprintf(yyout," gid %d\n", yygid);
145 if ( (uintptr_t)yyt > (uintptr_t)yycrank){
147 if (yyt <= yytop && yyt->verify+yysvec == yystate){
148 if(yyt->advance+yysvec == YYLERR) /* error transitions */
149 {YYUNPUT(*--yylastch);break;}
150 *lsp++ = yystate = yyt->advance+yysvec;
151 if(lsp > &yylstate[YYLMAX]) {
152 fprintf(yyout,"Input string too long, limit %d\n",YYLMAX);
159 else if((uintptr_t)yyt < (uintptr_t)yycrank) { /* r < yycrank */
160 yyt = yyr = yycrank+(yycrank-yyt);
162 if(debug)fprintf(yyout,"compressed state\n");
165 if(yyt <= yytop && yyt->verify+yysvec == yystate){
166 if(yyt->advance+yysvec == YYLERR) /* error transitions */
167 {YYUNPUT(*--yylastch);break;}
168 *lsp++ = yystate = yyt->advance+yysvec;
169 if(lsp > &yylstate[YYLMAX]) {
170 fprintf(yyout,"Input string too long, limit %d\n",YYLMAX);
175 yyt = yyr + YYU(yymatch[yygid]);
178 fprintf(yyout,"try fall back character ");
179 allprint_w(YYU(yymatch[yygid]));
180 fprintf(yyout," gid %d\n", yygid);
183 if(yyt <= yytop && yyt->verify+yysvec == yystate){
184 if(yyt->advance+yysvec == YYLERR) /* error transition */
185 {YYUNPUT(*--yylastch);break;}
186 *lsp++ = yystate = yyt->advance+yysvec;
187 if(lsp > &yylstate[YYLMAX]) {
188 fprintf(yyout,"Input string too long, limit %d\n",YYLMAX);
194 if ((yystate = yystate->yyother) && (yyt= yystate->yystoff) != yycrank){
196 if(debug)fprintf(yyout,"fall back to state %d\n",yystate-yysvec-1);
202 {YYUNPUT(*--yylastch);break;}
206 fprintf(yyout,"state %d wchar_t ",yystate-yysvec-1);
208 fprintf(yyout," gid %d\n", yygid);
215 fprintf(yyout,"stopped at %d with ",*(lsp-1)-yysvec-1);
217 fprintf(yyout," gid %d\n", yygid);
220 while (lsp-- > yylstate){
222 if (*lsp != 0 && (yyfnd= (*lsp)->yystops) && *yyfnd > 0){
224 if(yyextra[*yyfnd]){ /* must backup */
225 while(yyback((*lsp)->yystops,-*yyfnd) != 1 && lsp > yylstate){
227 YYUNPUT(*yylastch--);
230 yyprevious = YYU(*yylastch);
232 YYLENG = yylastch-YYTEXT+1;
236 fprintf(yyout,"\nmatch ");
238 fprintf(yyout," action %d\n",*yyfnd);
241 #ifdef YYLEX_E /* -e */
242 yyleng=wcstombs((char *)yytext, YYTEXT, sizeof(yytext)-1);
244 if(yyleng>=sizeof(yytext)-1)
245 fprintf(yyout, "yytext[] too short\n");
252 if (YYTEXT[0] == 0 /* && feof(yyin) */)
257 yyprevious = YYTEXT[0] = YYINPUT();
259 YYOUTPUT(yyprevious);
262 if(debug)putchar('\n');
267 #if defined(__cplusplus) || defined(__STDC__)
268 yyback(int *p, int m)
283 #ifdef YYLEX_E /* -e */
285 #if defined(__cplusplus) || defined(__STDC__)
290 unsigned char eucbuf[MB_LEN_MAX];
292 unsigned char *p=eucbuf;
298 while(--n>0) *p++=input();
302 while(--n>0) *p++=lex_input();
306 mbtowc( &wc, (char *)eucbuf, MB_LEN_MAX );
310 #if defined(__cplusplus) || defined(__STDC__)
312 yywoutput(wchar_t wc)
318 unsigned char eucbuf[MB_LEN_MAX];
320 unsigned char *p=eucbuf;
322 n=wctomb( (char *)eucbuf, wc );
324 while(n-->0) output(*p++);
326 while(n-->0) lex_output(*p++);
330 #if defined(__cplusplus) || defined(__STDC__)
338 unsigned char eucbuf[MB_LEN_MAX];
342 n=wctomb( (char *)eucbuf, wc );
344 while(n-->0) unput(*--p);
349 #define yylinearize(lc) lc
350 #else/*!LONG_WCHAR_T*/
355 unsigned long prefix;
357 case 0x0000: prefix=0x00000000; break;
358 case 0x0080: prefix=0x20000000; break;
359 case 0x8000: prefix=0x40000000; break;
360 case 0x8080: prefix=0x60000000; break;
364 #endif/*!LONG_WCHAR_T*/
370 int last = YYNCGIDTBL - 1;
371 unsigned long lc=yylinearize(c);
373 if( yycgidtbl[YYNCGIDTBL-1] < lc ) return YYNCGIDTBL*2-1;
376 int i = (first+last)/2;
377 if (lc == yycgidtbl[i])
379 else if ( yycgidtbl[i]<lc) {
380 if (lc<yycgidtbl[i+1])
394 /* the following are only used in the lex library */
396 #if defined(__cplusplus) || defined(__STDC__)
408 #if defined(__cplusplus) || defined(__STDC__)
422 #if defined(__cplusplus) || defined(__STDC__)