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 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 227c478bd9Sstevel@tonic-gate/* 237c478bd9Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. 247c478bd9Sstevel@tonic-gate * All rights reserved. 257c478bd9Sstevel@tonic-gate * Use is subject to license terms. 267c478bd9Sstevel@tonic-gate */ 277c478bd9Sstevel@tonic-gate 287c478bd9Sstevel@tonic-gate/* Copyright (c) 1989 AT&T */ 297c478bd9Sstevel@tonic-gate/* All Rights Reserved */ 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gateint yylineno =1; 327c478bd9Sstevel@tonic-gateint yygid; 337c478bd9Sstevel@tonic-gate#define LONG_WCHAR_T 1 347c478bd9Sstevel@tonic-gate# define YYU(x) x 357c478bd9Sstevel@tonic-gate# define NLSTATE yyprevious=YYNEWLINE 367c478bd9Sstevel@tonic-gatewchar_t yysbuf[YYLMAX]; 377c478bd9Sstevel@tonic-gatewchar_t *yysptr = yysbuf; 387c478bd9Sstevel@tonic-gatestruct yysvf *yylstate [YYLMAX], **yylsp, **yyolsp; 397c478bd9Sstevel@tonic-gateint *yyfnd; 407c478bd9Sstevel@tonic-gateextern struct yysvf *yyestate; 417c478bd9Sstevel@tonic-gateint yyprevious = YYNEWLINE; 42*966c588fSToomas Soome 437c478bd9Sstevel@tonic-gateint yylook(void) 447c478bd9Sstevel@tonic-gate{ 457c478bd9Sstevel@tonic-gate struct yysvf *yystate, **lsp; 467c478bd9Sstevel@tonic-gate struct yywork *yyt; 477c478bd9Sstevel@tonic-gate struct yysvf *yyz; 487c478bd9Sstevel@tonic-gate int yych, yyfirst; 497c478bd9Sstevel@tonic-gate struct yywork *yyr; 507c478bd9Sstevel@tonic-gate# ifdef LEXDEBUG 517c478bd9Sstevel@tonic-gate int debug; 527c478bd9Sstevel@tonic-gate# endif 537c478bd9Sstevel@tonic-gate wchar_t *yylastch; 547c478bd9Sstevel@tonic-gate /* start off machines */ 557c478bd9Sstevel@tonic-gate# ifdef LEXDEBUG 567c478bd9Sstevel@tonic-gate debug = 0; 577c478bd9Sstevel@tonic-gate# endif 587c478bd9Sstevel@tonic-gate yyfirst=1; 597c478bd9Sstevel@tonic-gate if (!yymorfg) 607c478bd9Sstevel@tonic-gate yylastch = YYTEXT; 617c478bd9Sstevel@tonic-gate else { 627c478bd9Sstevel@tonic-gate yymorfg=0; 637c478bd9Sstevel@tonic-gate yylastch = YYTEXT+YYLENG; 647c478bd9Sstevel@tonic-gate } 657c478bd9Sstevel@tonic-gate for(;;){ 667c478bd9Sstevel@tonic-gate lsp = yylstate; 677c478bd9Sstevel@tonic-gate yyestate = yystate = yybgin; 687c478bd9Sstevel@tonic-gate if (yyprevious==YYNEWLINE) yystate++; 697c478bd9Sstevel@tonic-gate for (;;){ 707c478bd9Sstevel@tonic-gate# ifdef LEXDEBUG 717c478bd9Sstevel@tonic-gate if(debug)fprintf(yyout,"state %d\n",yystate-yysvec-1); 727c478bd9Sstevel@tonic-gate# endif 737c478bd9Sstevel@tonic-gate yyt = yystate->yystoff; 747c478bd9Sstevel@tonic-gate if(yyt == yycrank && !yyfirst){ /* may not be any transitions */ 757c478bd9Sstevel@tonic-gate yyz = yystate->yyother; 767c478bd9Sstevel@tonic-gate if(yyz == 0)break; 777c478bd9Sstevel@tonic-gate if(yyz->yystoff == yycrank)break; 787c478bd9Sstevel@tonic-gate } 797c478bd9Sstevel@tonic-gate *yylastch++ = yych = YYINPUT(); 807c478bd9Sstevel@tonic-gate#ifdef YYISARRAY 817c478bd9Sstevel@tonic-gate if(yylastch > &YYTEXT[YYLMAX]) { 827c478bd9Sstevel@tonic-gate fprintf(yyout,"Input string too long, limit %d\n",YYLMAX); 837c478bd9Sstevel@tonic-gate exit(1); 847c478bd9Sstevel@tonic-gate } 857c478bd9Sstevel@tonic-gate#else 867c478bd9Sstevel@tonic-gate if (yylastch >= &YYTEXT[ yytextsz ]) { 877c478bd9Sstevel@tonic-gate int x = yylastch - YYTEXT; 887c478bd9Sstevel@tonic-gate 897c478bd9Sstevel@tonic-gate yytextsz += YYTEXTSZINC; 907c478bd9Sstevel@tonic-gate#ifdef YYLEX_E /* -e */ 917c478bd9Sstevel@tonic-gate if (YYTEXT == yy_twbuf) { 927c478bd9Sstevel@tonic-gate YYTEXT = (wchar_t *) 937c478bd9Sstevel@tonic-gate malloc(yytextsz * 947c478bd9Sstevel@tonic-gate sizeof (wchar_t)); 957c478bd9Sstevel@tonic-gate memcpy(YYTEXT, yy_twbuf, 967c478bd9Sstevel@tonic-gate sizeof (yy_twbuf)); 977c478bd9Sstevel@tonic-gate yytext = (wchar_t *) 987c478bd9Sstevel@tonic-gate malloc(yytextsz * 997c478bd9Sstevel@tonic-gate sizeof (wchar_t)); 1007c478bd9Sstevel@tonic-gate memcpy(yytext, yy_tbuf, 1017c478bd9Sstevel@tonic-gate sizeof (yy_tbuf)); 1027c478bd9Sstevel@tonic-gate#else 1037c478bd9Sstevel@tonic-gate if (YYTEXT == yy_tbuf) { 1047c478bd9Sstevel@tonic-gate YYTEXT = (wchar_t *) 1057c478bd9Sstevel@tonic-gate malloc(yytextsz * 1067c478bd9Sstevel@tonic-gate sizeof (wchar_t)); 1077c478bd9Sstevel@tonic-gate memcpy(YYTEXT, yy_tbuf, 1087c478bd9Sstevel@tonic-gate sizeof (yy_tbuf)); 1097c478bd9Sstevel@tonic-gate#endif 1107c478bd9Sstevel@tonic-gate } 1117c478bd9Sstevel@tonic-gate else { 1127c478bd9Sstevel@tonic-gate YYTEXT = (wchar_t *) 1137c478bd9Sstevel@tonic-gate realloc(YYTEXT, yytextsz); 1147c478bd9Sstevel@tonic-gate#ifdef YYLEX_E /* -e */ 1157c478bd9Sstevel@tonic-gate yytext = (wchar_t *) 1167c478bd9Sstevel@tonic-gate realloc(yytext, 1177c478bd9Sstevel@tonic-gate yytextsz * sizeof (wchar_t)); 1187c478bd9Sstevel@tonic-gate#endif 1197c478bd9Sstevel@tonic-gate } 1207c478bd9Sstevel@tonic-gate if (!YYTEXT) { 1217c478bd9Sstevel@tonic-gate fprintf(yyout, 1227c478bd9Sstevel@tonic-gate "Cannot realloc YYTEXT\n"); 1237c478bd9Sstevel@tonic-gate exit(1); 1247c478bd9Sstevel@tonic-gate } 1257c478bd9Sstevel@tonic-gate yylastch = YYTEXT + x; 1267c478bd9Sstevel@tonic-gate } 1277c478bd9Sstevel@tonic-gate#endif 1287c478bd9Sstevel@tonic-gate yygid = yycgid(yych); 1297c478bd9Sstevel@tonic-gate yyfirst=0; 1307c478bd9Sstevel@tonic-gate tryagain: 1317c478bd9Sstevel@tonic-gate# ifdef LEXDEBUG 1327c478bd9Sstevel@tonic-gate if(debug){ 1337c478bd9Sstevel@tonic-gate fprintf(yyout,"wchar_t "); 1347c478bd9Sstevel@tonic-gate allprint(yych); 1357c478bd9Sstevel@tonic-gate fprintf(yyout," gid %d\n", yygid); 1367c478bd9Sstevel@tonic-gate } 1377c478bd9Sstevel@tonic-gate# endif 1387c478bd9Sstevel@tonic-gate yyr = yyt; 1397c478bd9Sstevel@tonic-gate if ( (uintptr_t)yyt > (uintptr_t)yycrank){ 1407c478bd9Sstevel@tonic-gate yyt = yyr + yygid; 1417c478bd9Sstevel@tonic-gate if (yyt <= yytop && yyt->verify+yysvec == yystate){ 1427c478bd9Sstevel@tonic-gate if(yyt->advance+yysvec == YYLERR) /* error transitions */ 1437c478bd9Sstevel@tonic-gate {YYUNPUT(*--yylastch);break;} 1447c478bd9Sstevel@tonic-gate *lsp++ = yystate = yyt->advance+yysvec; 1457c478bd9Sstevel@tonic-gate if(lsp > &yylstate[YYLMAX]) { 1467c478bd9Sstevel@tonic-gate fprintf(yyout,"Input string too long, limit %d\n",YYLMAX); 1477c478bd9Sstevel@tonic-gate exit(1); 1487c478bd9Sstevel@tonic-gate } 1497c478bd9Sstevel@tonic-gate goto contin; 1507c478bd9Sstevel@tonic-gate } 1517c478bd9Sstevel@tonic-gate } 1527c478bd9Sstevel@tonic-gate# ifdef YYOPTIM 1537c478bd9Sstevel@tonic-gate else if((uintptr_t)yyt < (uintptr_t)yycrank) { /* r < yycrank */ 1547c478bd9Sstevel@tonic-gate yyt = yyr = yycrank+(yycrank-yyt); 1557c478bd9Sstevel@tonic-gate# ifdef LEXDEBUG 1567c478bd9Sstevel@tonic-gate if(debug)fprintf(yyout,"compressed state\n"); 1577c478bd9Sstevel@tonic-gate# endif 1587c478bd9Sstevel@tonic-gate yyt = yyt + yygid; 1597c478bd9Sstevel@tonic-gate if(yyt <= yytop && yyt->verify+yysvec == yystate){ 1607c478bd9Sstevel@tonic-gate if(yyt->advance+yysvec == YYLERR) /* error transitions */ 1617c478bd9Sstevel@tonic-gate {YYUNPUT(*--yylastch);break;} 1627c478bd9Sstevel@tonic-gate *lsp++ = yystate = yyt->advance+yysvec; 1637c478bd9Sstevel@tonic-gate if(lsp > &yylstate[YYLMAX]) { 1647c478bd9Sstevel@tonic-gate fprintf(yyout,"Input string too long, limit %d\n",YYLMAX); 1657c478bd9Sstevel@tonic-gate exit(1); 1667c478bd9Sstevel@tonic-gate } 1677c478bd9Sstevel@tonic-gate goto contin; 1687c478bd9Sstevel@tonic-gate } 1697c478bd9Sstevel@tonic-gate yyt = yyr + YYU(yymatch[yygid]); 1707c478bd9Sstevel@tonic-gate# ifdef LEXDEBUG 1717c478bd9Sstevel@tonic-gate if(debug){ 1727c478bd9Sstevel@tonic-gate fprintf(yyout,"try fall back character "); 1737c478bd9Sstevel@tonic-gate allprint_w(YYU(yymatch[yygid])); 1747c478bd9Sstevel@tonic-gate fprintf(yyout," gid %d\n", yygid); 1757c478bd9Sstevel@tonic-gate } 1767c478bd9Sstevel@tonic-gate# endif 1777c478bd9Sstevel@tonic-gate if(yyt <= yytop && yyt->verify+yysvec == yystate){ 1787c478bd9Sstevel@tonic-gate if(yyt->advance+yysvec == YYLERR) /* error transition */ 1797c478bd9Sstevel@tonic-gate {YYUNPUT(*--yylastch);break;} 1807c478bd9Sstevel@tonic-gate *lsp++ = yystate = yyt->advance+yysvec; 1817c478bd9Sstevel@tonic-gate if(lsp > &yylstate[YYLMAX]) { 1827c478bd9Sstevel@tonic-gate fprintf(yyout,"Input string too long, limit %d\n",YYLMAX); 1837c478bd9Sstevel@tonic-gate exit(1); 1847c478bd9Sstevel@tonic-gate } 1857c478bd9Sstevel@tonic-gate goto contin; 1867c478bd9Sstevel@tonic-gate } 1877c478bd9Sstevel@tonic-gate } 1887c478bd9Sstevel@tonic-gate if ((yystate = yystate->yyother) && (yyt= yystate->yystoff) != yycrank){ 1897c478bd9Sstevel@tonic-gate# ifdef LEXDEBUG 1907c478bd9Sstevel@tonic-gate if(debug)fprintf(yyout,"fall back to state %d\n",yystate-yysvec-1); 1917c478bd9Sstevel@tonic-gate# endif 1927c478bd9Sstevel@tonic-gate goto tryagain; 1937c478bd9Sstevel@tonic-gate } 1947c478bd9Sstevel@tonic-gate# endif 1957c478bd9Sstevel@tonic-gate else 1967c478bd9Sstevel@tonic-gate {YYUNPUT(*--yylastch);break;} 1977c478bd9Sstevel@tonic-gate contin: 1987c478bd9Sstevel@tonic-gate# ifdef LEXDEBUG 1997c478bd9Sstevel@tonic-gate if(debug){ 2007c478bd9Sstevel@tonic-gate fprintf(yyout,"state %d wchar_t ",yystate-yysvec-1); 2017c478bd9Sstevel@tonic-gate allprint_w(yych); 2027c478bd9Sstevel@tonic-gate fprintf(yyout," gid %d\n", yygid); 2037c478bd9Sstevel@tonic-gate } 2047c478bd9Sstevel@tonic-gate# endif 2057c478bd9Sstevel@tonic-gate ; 2067c478bd9Sstevel@tonic-gate } 2077c478bd9Sstevel@tonic-gate# ifdef LEXDEBUG 2087c478bd9Sstevel@tonic-gate if(debug){ 2097c478bd9Sstevel@tonic-gate fprintf(yyout,"stopped at %d with ",*(lsp-1)-yysvec-1); 2107c478bd9Sstevel@tonic-gate allprint_w(yych); 2117c478bd9Sstevel@tonic-gate fprintf(yyout," gid %d\n", yygid); 2127c478bd9Sstevel@tonic-gate } 2137c478bd9Sstevel@tonic-gate# endif 2147c478bd9Sstevel@tonic-gate while (lsp-- > yylstate){ 2157c478bd9Sstevel@tonic-gate *yylastch-- = 0; 2167c478bd9Sstevel@tonic-gate if (*lsp != 0 && (yyfnd= (*lsp)->yystops) && *yyfnd > 0){ 2177c478bd9Sstevel@tonic-gate yyolsp = lsp; 2187c478bd9Sstevel@tonic-gate if(yyextra[*yyfnd]){ /* must backup */ 2197c478bd9Sstevel@tonic-gate while(yyback((*lsp)->yystops,-*yyfnd) != 1 && lsp > yylstate){ 2207c478bd9Sstevel@tonic-gate lsp--; 2217c478bd9Sstevel@tonic-gate YYUNPUT(*yylastch--); 2227c478bd9Sstevel@tonic-gate } 2237c478bd9Sstevel@tonic-gate } 2247c478bd9Sstevel@tonic-gate yyprevious = YYU(*yylastch); 2257c478bd9Sstevel@tonic-gate yylsp = lsp; 2267c478bd9Sstevel@tonic-gate YYLENG = yylastch-YYTEXT+1; 2277c478bd9Sstevel@tonic-gate YYTEXT[YYLENG] = 0; 2287c478bd9Sstevel@tonic-gate# ifdef LEXDEBUG 2297c478bd9Sstevel@tonic-gate if(debug){ 2307c478bd9Sstevel@tonic-gate fprintf(yyout,"\nmatch "); 2317c478bd9Sstevel@tonic-gate sprint_w(YYTEXT); 2327c478bd9Sstevel@tonic-gate fprintf(yyout," action %d\n",*yyfnd); 2337c478bd9Sstevel@tonic-gate } 2347c478bd9Sstevel@tonic-gate# endif 2357c478bd9Sstevel@tonic-gate#ifdef YYLEX_E /* -e */ 2367c478bd9Sstevel@tonic-gate yyleng=wcstombs((char *)yytext, YYTEXT, sizeof(yytext)-1); 2377c478bd9Sstevel@tonic-gate#ifdef LEXDEBUG 2387c478bd9Sstevel@tonic-gate if(yyleng>=sizeof(yytext)-1) 2397c478bd9Sstevel@tonic-gate fprintf(yyout, "yytext[] too short\n"); 2407c478bd9Sstevel@tonic-gate#endif 2417c478bd9Sstevel@tonic-gate#endif 2427c478bd9Sstevel@tonic-gate return(*yyfnd++); 2437c478bd9Sstevel@tonic-gate } 2447c478bd9Sstevel@tonic-gate YYUNPUT(*yylastch); 2457c478bd9Sstevel@tonic-gate } 2467c478bd9Sstevel@tonic-gate if (YYTEXT[0] == 0 /* && feof(yyin) */) 2477c478bd9Sstevel@tonic-gate { 2487c478bd9Sstevel@tonic-gate yysptr=yysbuf; 2497c478bd9Sstevel@tonic-gate return(0); 2507c478bd9Sstevel@tonic-gate } 2517c478bd9Sstevel@tonic-gate yyprevious = YYTEXT[0] = YYINPUT(); 2527c478bd9Sstevel@tonic-gate if (yyprevious>0) 2537c478bd9Sstevel@tonic-gate YYOUTPUT(yyprevious); 2547c478bd9Sstevel@tonic-gate yylastch=YYTEXT; 2557c478bd9Sstevel@tonic-gate# ifdef LEXDEBUG 2567c478bd9Sstevel@tonic-gate if(debug)putchar('\n'); 2577c478bd9Sstevel@tonic-gate# endif 2587c478bd9Sstevel@tonic-gate } 2597c478bd9Sstevel@tonic-gate } 2607c478bd9Sstevel@tonic-gateint 2617c478bd9Sstevel@tonic-gateyyback(int *p, int m) 2627c478bd9Sstevel@tonic-gate{ 2637c478bd9Sstevel@tonic-gate if (p==0) return(0); 2647c478bd9Sstevel@tonic-gate while (*p) { 2657c478bd9Sstevel@tonic-gate if (*p++ == m) 2667c478bd9Sstevel@tonic-gate return(1); 2677c478bd9Sstevel@tonic-gate } 2687c478bd9Sstevel@tonic-gate return(0); 2697c478bd9Sstevel@tonic-gate} 2707c478bd9Sstevel@tonic-gate 2717c478bd9Sstevel@tonic-gate#ifdef YYLEX_E /* -e */ 2727c478bd9Sstevel@tonic-gatewchar_t 273*966c588fSToomas Soomeyywinput(void) 274*966c588fSToomas Soome{ 2757c478bd9Sstevel@tonic-gate unsigned char eucbuf[MB_LEN_MAX]; 2767c478bd9Sstevel@tonic-gate wchar_t wc; 2777c478bd9Sstevel@tonic-gate unsigned char *p=eucbuf; 2787c478bd9Sstevel@tonic-gate int n; 2797c478bd9Sstevel@tonic-gate 2807c478bd9Sstevel@tonic-gate#ifndef __cplusplus 2817c478bd9Sstevel@tonic-gate *p++=input(); 2827c478bd9Sstevel@tonic-gate n=euclen(eucbuf); 2837c478bd9Sstevel@tonic-gate while(--n>0) *p++=input(); 2847c478bd9Sstevel@tonic-gate#else 2857c478bd9Sstevel@tonic-gate *p++=lex_input(); 2867c478bd9Sstevel@tonic-gate n=euclen(eucbuf); 2877c478bd9Sstevel@tonic-gate while(--n>0) *p++=lex_input(); 2887c478bd9Sstevel@tonic-gate#endif 2897c478bd9Sstevel@tonic-gate *p=0; 2907c478bd9Sstevel@tonic-gate 2917c478bd9Sstevel@tonic-gate mbtowc( &wc, (char *)eucbuf, MB_LEN_MAX ); 2927c478bd9Sstevel@tonic-gate return wc; 2937c478bd9Sstevel@tonic-gate} 2947c478bd9Sstevel@tonic-gate 2957c478bd9Sstevel@tonic-gatevoid 2967c478bd9Sstevel@tonic-gateyywoutput(wchar_t wc) 2977c478bd9Sstevel@tonic-gate{ 2987c478bd9Sstevel@tonic-gate unsigned char eucbuf[MB_LEN_MAX]; 2997c478bd9Sstevel@tonic-gate int n; 3007c478bd9Sstevel@tonic-gate unsigned char *p=eucbuf; 3017c478bd9Sstevel@tonic-gate 3027c478bd9Sstevel@tonic-gate n=wctomb( (char *)eucbuf, wc ); 3037c478bd9Sstevel@tonic-gate#ifndef __cplusplus 3047c478bd9Sstevel@tonic-gate while(n-->0) output(*p++); 3057c478bd9Sstevel@tonic-gate#else 3067c478bd9Sstevel@tonic-gate while(n-->0) lex_output(*p++); 3077c478bd9Sstevel@tonic-gate#endif 3087c478bd9Sstevel@tonic-gate} 3097c478bd9Sstevel@tonic-gate 3107c478bd9Sstevel@tonic-gatevoid 3117c478bd9Sstevel@tonic-gateyywunput(wchar_t wc) 3127c478bd9Sstevel@tonic-gate{ 3137c478bd9Sstevel@tonic-gate unsigned char eucbuf[MB_LEN_MAX]; 3147c478bd9Sstevel@tonic-gate int n; 3157c478bd9Sstevel@tonic-gate unsigned char *p; 3167c478bd9Sstevel@tonic-gate 3177c478bd9Sstevel@tonic-gate n=wctomb( (char *)eucbuf, wc ); 3187c478bd9Sstevel@tonic-gate p=eucbuf+n; 3197c478bd9Sstevel@tonic-gate while(n-->0) unput(*--p); 3207c478bd9Sstevel@tonic-gate} 3217c478bd9Sstevel@tonic-gate#endif 3227c478bd9Sstevel@tonic-gate 3237c478bd9Sstevel@tonic-gate#ifdef LONG_WCHAR_T 3247c478bd9Sstevel@tonic-gate#define yylinearize(lc) lc 3257c478bd9Sstevel@tonic-gate#else/*!LONG_WCHAR_T*/ 3267c478bd9Sstevel@tonic-gateunsigned long 3277c478bd9Sstevel@tonic-gateyylinearize(wc) 3287c478bd9Sstevel@tonic-gate wchar_t wc; 3297c478bd9Sstevel@tonic-gate{ 3307c478bd9Sstevel@tonic-gate unsigned long prefix; 3317c478bd9Sstevel@tonic-gate switch(wc&0x8080){ 3327c478bd9Sstevel@tonic-gate case 0x0000: prefix=0x00000000; break; 3337c478bd9Sstevel@tonic-gate case 0x0080: prefix=0x20000000; break; 3347c478bd9Sstevel@tonic-gate case 0x8000: prefix=0x40000000; break; 3357c478bd9Sstevel@tonic-gate case 0x8080: prefix=0x60000000; break; 3367c478bd9Sstevel@tonic-gate } 3377c478bd9Sstevel@tonic-gate return prefix|wc; 3387c478bd9Sstevel@tonic-gate} 3397c478bd9Sstevel@tonic-gate#endif/*!LONG_WCHAR_T*/ 3407c478bd9Sstevel@tonic-gateint 341*966c588fSToomas Soomeyycgid(wchar_t c) 3427c478bd9Sstevel@tonic-gate{ 3437c478bd9Sstevel@tonic-gate int first = 0; 3447c478bd9Sstevel@tonic-gate int last = YYNCGIDTBL - 1; 3457c478bd9Sstevel@tonic-gate unsigned long lc=yylinearize(c); 3467c478bd9Sstevel@tonic-gate 3477c478bd9Sstevel@tonic-gate if( yycgidtbl[YYNCGIDTBL-1] < lc ) return YYNCGIDTBL*2-1; 3487c478bd9Sstevel@tonic-gate 3497c478bd9Sstevel@tonic-gate while (last >= 0) { 3507c478bd9Sstevel@tonic-gate int i = (first+last)/2; 3517c478bd9Sstevel@tonic-gate if (lc == yycgidtbl[i]) 3527c478bd9Sstevel@tonic-gate return (2*i); 3537c478bd9Sstevel@tonic-gate else if ( yycgidtbl[i]<lc) { 3547c478bd9Sstevel@tonic-gate if (lc<yycgidtbl[i+1]) 3557c478bd9Sstevel@tonic-gate return (2*i+1); 3567c478bd9Sstevel@tonic-gate else 3577c478bd9Sstevel@tonic-gate first = i + 1; 3587c478bd9Sstevel@tonic-gate }else 3597c478bd9Sstevel@tonic-gate last = i - 1; 3607c478bd9Sstevel@tonic-gate } 3617c478bd9Sstevel@tonic-gate return 0; /*Error*/ 3627c478bd9Sstevel@tonic-gate} 3637c478bd9Sstevel@tonic-gate 3647c478bd9Sstevel@tonic-gate 3657c478bd9Sstevel@tonic-gate 3667c478bd9Sstevel@tonic-gate 3677c478bd9Sstevel@tonic-gate 3687c478bd9Sstevel@tonic-gate /* the following are only used in the lex library */ 3697c478bd9Sstevel@tonic-gateint 3707c478bd9Sstevel@tonic-gateyyinput(void) 3717c478bd9Sstevel@tonic-gate{ 3727c478bd9Sstevel@tonic-gate#ifndef __cplusplus 3737c478bd9Sstevel@tonic-gate return(input()); 3747c478bd9Sstevel@tonic-gate#else 3757c478bd9Sstevel@tonic-gate return(lex_input()); 3767c478bd9Sstevel@tonic-gate#endif 3777c478bd9Sstevel@tonic-gate} 378*966c588fSToomas Soome 3797c478bd9Sstevel@tonic-gatevoid 3807c478bd9Sstevel@tonic-gateyyoutput(int c) 3817c478bd9Sstevel@tonic-gate{ 3827c478bd9Sstevel@tonic-gate#ifndef __cplusplus 3837c478bd9Sstevel@tonic-gate output(c); 3847c478bd9Sstevel@tonic-gate#else 3857c478bd9Sstevel@tonic-gate lex_output(c); 3867c478bd9Sstevel@tonic-gate#endif 3877c478bd9Sstevel@tonic-gate} 388*966c588fSToomas Soome 3897c478bd9Sstevel@tonic-gatevoid 3907c478bd9Sstevel@tonic-gateyyunput(int c) 3917c478bd9Sstevel@tonic-gate{ 3927c478bd9Sstevel@tonic-gate unput(c); 3937c478bd9Sstevel@tonic-gate} 394