#include #include #include # define U(x) x # define NLSTATE yyprevious=YYNEWLINE # define BEGIN yybgin = yysvec + 1 + # define INITIAL 0 # define YYLERR yysvec # define YYSTATE (yyestate-yysvec-1) # define YYOPTIM 1 # ifndef YYLMAX # define YYLMAX BUFSIZ # endif #ifndef __cplusplus # define output(c) (void)putc(c,yyout) #else # define lex_output(c) (void)putc(c,yyout) #endif #if defined(__cplusplus) || defined(__STDC__) #if defined(__cplusplus) && defined(__EXTERN_C__) extern "C" { #endif int yyback(int *, int); int yyinput(void); int yylook(void); void yyoutput(int); int yyracc(int); int yyreject(void); void yyunput(int); int yylex(void); #ifdef YYLEX_E void yywoutput(wchar_t); wchar_t yywinput(void); void yywunput(wchar_t); #endif #ifndef yyless int yyless(int); #endif #ifndef yywrap int yywrap(void); #endif #ifdef LEXDEBUG void allprint(char); void sprint(char *); #endif #if defined(__cplusplus) && defined(__EXTERN_C__) } #endif #ifdef __cplusplus extern "C" { #endif void exit(int); #ifdef __cplusplus } #endif #endif # define unput(c) {yytchar= (c);if(yytchar=='\n')yylineno--;*yysptr++=yytchar;} # define yymore() (yymorfg=1) #ifndef __cplusplus # define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar) #else # define lex_input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar) #endif #define ECHO fprintf(yyout, "%s",yytext) # define REJECT { nstr = yyreject(); goto yyfussy;} int yyleng; #define YYISARRAY char yytext[YYLMAX]; int yymorfg; extern char *yysptr, yysbuf[]; int yytchar; FILE *yyin = {stdin}, *yyout = {stdout}; extern int yylineno; struct yysvf { struct yywork *yystoff; struct yysvf *yyother; int *yystops;}; struct yysvf *yyestate; extern struct yysvf yysvec[], *yybgin; # line 3 "genmsg.l" /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. * See the License for the specific language governing permissions * and limitations under the License. * * When distributing Covered Code, include this CDDL HEADER in each * file and include the License file at usr/src/OPENSOLARIS.LICENSE. * If applicable, add the following below this CDDL HEADER, with the * fields enclosed by brackets "[]" replaced with your own identifying * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ # line 23 "genmsg.l" /* * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #include #include #include #include #include #include #include "genmsg.h" #include "y.tab.h" extern int is_cat_found; /* from main.c */ extern void add_comment(Mode, char *); /* from util.c */ int lineno = 1; # line 42 "genmsg.l" /* * msg_line stores the line number where a msgid is to be replaced. */ int msg_line = 0; int end_of_cat = TRUE; # line 49 "genmsg.l" /* * In preprocessor mode, genmsg has to parse both the original * soruce code and the code which a preprocessor generates. * While genmsg is parsing the original source code, 'pound_is_mine' * is set to TRUE. */ int pound_is_mine = FALSE; void warning(char *); #define NOLINEMSG -2 void set_linemsgid(int, int); int get_linemsgid(int); # line 64 "genmsg.l" /* * cat_field indicates which token is currently parsed by lex. */ #define CatdField 0 #define SetidField 1 #define MsgidField 2 #define StrField 3 static int cat_field; # line 74 "genmsg.l" /* * This will be turned on when '-' is found in the catgets message * number field. */ static int save_minus = FALSE; static char *skip_quoted(int skip_ch); static char *skip_comment(void); static void parse_cppline(char *); # define CAT 2 # define YYNEWLINE 10 int yylex(){ int nstr; extern int yyprevious; #ifdef __cplusplus /* to avoid CC and lint complaining yyfussy not being used ...*/ static int __lex_hack = 0; if (__lex_hack) goto yyfussy; #endif while((nstr = yylook()) >= 0) yyfussy: switch(nstr){ case 0: if(yywrap()) return(0); break; case 1: # line 86 "genmsg.l" { if (IsActiveMode(ReplaceMode)) { (void) fprintf(newfp, "%s", yytext); } } break; case 2: # line 92 "genmsg.l" { if (IsActiveMode(ReplaceMode)) { (void) fprintf(newfp, "%s", yytext); } } break; case 3: # line 98 "genmsg.l" { if (end_of_cat) { /* * If the previous catgets * state is on, turn it off * first. */ BEGIN 0; } if (IsActiveMode(ReplaceMode)) { (void) fprintf(newfp, "%s", yytext); } if (!IsActiveMode(ReplaceMode) || !IsActiveMode(PreProcessMode)) { BEGIN CAT; end_of_cat = FALSE; cat_field = CatdField; return (CATGETS); } } break; case 4: # line 119 "genmsg.l" { /* punctuation */ cat_field++; if (IsActiveMode(ReplaceMode)) { (void) fprintf(newfp, "%c", yytext[0]); } if (end_of_cat) { BEGIN 0; } else { return (yytext[0]); } } break; case 5: # line 131 "genmsg.l" { /* punctuation */ if (IsActiveMode(ReplaceMode)) { (void) fprintf(newfp, "%c", yytext[0]); } if (end_of_cat) { BEGIN 0; } else { return (yytext[0]); } } break; case 6: # line 142 "genmsg.l" { if (IsActiveMode(ReplaceMode)) { (void) fprintf(newfp, "%s", yytext); } if (end_of_cat) { BEGIN 0; } else { return (CONST); } } break; case 7: # line 153 "genmsg.l" { if (IsActiveMode(ReplaceMode)) { (void) fprintf(newfp, "%s", yytext); } if (end_of_cat) { BEGIN 0; } else { return (CATD); } } break; case 8: # line 164 "genmsg.l" { if (IsActiveMode(ReplaceMode)) { (void) fprintf(newfp, "%s", yytext); } if (end_of_cat) { BEGIN 0; } else { return (CHAR); } } break; case 9: # line 175 "genmsg.l" { if (IsActiveMode(ReplaceMode)) { (void) fprintf(newfp, "%s", yytext); } if (end_of_cat) { BEGIN 0; } else { return (INT); } } break; case 10: # line 186 "genmsg.l" { if (IsActiveMode(ReplaceMode)) { (void) fprintf(newfp, "%s", yytext); } if (end_of_cat) { BEGIN 0; } else { return (INC); } } break; case 11: # line 197 "genmsg.l" { if (IsActiveMode(ReplaceMode)) { (void) fprintf(newfp, "%s", yytext); } if (end_of_cat) { BEGIN 0; } else { return (INC); } } break; case 12: # line 208 "genmsg.l" { /* extract quoted string */ yylval.str = skip_quoted('"'); if (IsActiveMode(ReplaceMode)) { (void) fprintf(newfp, "\"%s\"", yylval.str); } if (end_of_cat) { /* just in case */ BEGIN 0; free(yylval.str); } else { return (QSTR); } } break; case 13: # line 221 "genmsg.l" { /* punctuation */ if (IsActiveMode(ReplaceMode)) { if (cat_field == MsgidField && get_linemsgid(lineno) != NOLINEMSG) { save_minus = TRUE; /* be replaced. */ } else { (void) fprintf(newfp, "%c", yytext[0]); } } if (end_of_cat) { /* just in case */ BEGIN 0; } else { return (yytext[0]); } } break; case 14: # line 237 "genmsg.l" { /* numbers */ switch (cat_field) { case SetidField: yylval.id = atoi(yytext); if (IsActiveMode(ReplaceMode)) { (void) fprintf(newfp, "%s", yytext); } if (end_of_cat) { BEGIN 0; } else { return (SETID); } break; case MsgidField: yylval.id = atoi(yytext); if (IsActiveMode(ReplaceMode)) { int id = get_linemsgid(lineno); if (id == NOLINEMSG) { (void) fprintf(newfp, "%s", yytext); } else if (id == NOMSGID && IsActiveMode(ReverseMode)) { (void) fprintf(newfp, "%d", NOMSGID); } else if (save_minus == TRUE && yylval.id == 1) { (void) fprintf(newfp, "%d", id); } else { /* just in case */ (void) fprintf(newfp, "%s", yytext); } save_minus = FALSE; } else { msg_line = lineno; } if (end_of_cat) { BEGIN 0; } else { return (MSGID); } break; default: yylval.id = atoi(yytext); if (IsActiveMode(ReplaceMode)) { (void) fprintf(newfp, "%s", yytext); } if (end_of_cat) { BEGIN 0; } else { return (DIGIT); } } } break; case 15: # line 291 "genmsg.l" { if (IsActiveMode(ReplaceMode)) { (void) fprintf(newfp, "%s", yytext); } if (end_of_cat) { BEGIN 0; } else { return (STR); } } break; case 16: # line 302 "genmsg.l" { lineno++; if (IsActiveMode(ReplaceMode)) { (void) fprintf(newfp, "\n"); } if (end_of_cat) { BEGIN 0; } } break; case 17: # line 312 "genmsg.l" { /* not interested */ if (IsActiveMode(ReplaceMode)) { (void) fprintf(newfp, "%c", yytext[0]); } if (end_of_cat) { BEGIN 0; } } break; case 18: # line 321 "genmsg.l" { /* -1 */ if (end_of_cat == FALSE) { REJECT } else if (IsActiveMode(ReplaceMode)) { if (IsActiveMode(PreProcessMode)) { int id = get_linemsgid(lineno); if (id == NOLINEMSG) { (void) fprintf(newfp, "%s", yytext); } else { /* could be -1. */ (void) fprintf(newfp, "%d", id); } } else { (void) fprintf(newfp, "%s", yytext); } } } break; case 19: # line 339 "genmsg.l" { if (IsActiveMode(ReplaceMode)) { if (IsActiveMode(PreProcessMode) && IsActiveMode(ReverseMode)) { int id = get_linemsgid(lineno); if (id == NOLINEMSG) { (void) fprintf(newfp, "%s", yytext); } else if (id == NOMSGID) { (void) fprintf(newfp, "%d", id); } } else { (void) fprintf(newfp, "%s", yytext); } } } break; case 20: # line 356 "genmsg.l" { /* pound for c-preprocessor */ if (IsActiveMode(PreProcessMode)) { if (IsActiveMode(ReplaceMode)) { (void) fprintf(newfp, "%s", yytext); } else { parse_cppline(yytext); } } else if (IsActiveMode(ReplaceMode)) { (void) fprintf(newfp, "%s", yytext); } lineno++; } break; case 21: # line 369 "genmsg.l" { /* skip a comment block */ char *comment = skip_comment(); if (IsActiveMode(ReplaceMode)) { (void) fprintf(newfp, "%s", comment); } else { if (IsActiveMode(MsgCommentMode)) { add_comment(MsgCommentMode, comment); } if (IsActiveMode(SetCommentMode)) { add_comment(SetCommentMode, comment); } } free(comment); } break; case 22: # line 384 "genmsg.l" { /* skip a c++ comment */ if (IsActiveMode(ReplaceMode)) { (void) fprintf(newfp, "%s", yytext); } else { if (IsActiveMode(MsgCommentMode)) { add_comment(MsgCommentMode, yytext); } if (IsActiveMode(SetCommentMode)) { add_comment(SetCommentMode, yytext); } } lineno++; } break; case 23: # line 398 "genmsg.l" { /* skip quoted string */ char *qstr = skip_quoted('"'); if (IsActiveMode(ReplaceMode)) { (void) fprintf(newfp, "\"%s\"", qstr); } free(qstr); } break; case 24: # line 406 "genmsg.l" { /* skip single-quoted character */ char *qchr = skip_quoted('\''); if (IsActiveMode(ReplaceMode)) { (void) fprintf(newfp, "\'%s\'", qchr); } free(qchr); } break; case 25: # line 414 "genmsg.l" { if (IsActiveMode(ReplaceMode)) { (void) fprintf(newfp, "\n"); } lineno++; } break; case 26: # line 421 "genmsg.l" { if (IsActiveMode(ReplaceMode)) { (void) fprintf(newfp, "%c", yytext[0]); } } break; case -1: break; default: (void)fprintf(yyout,"bad switch yylook %d",nstr); } return(0); } /* end of yylex */ # line 428 "genmsg.l" static char * skip_quoted(int skip_ch) { char *buf, *ptr; /* saved buffer and its pointer */ int bsize = BUFSIZ; /* growing buffer size */ int i = 0; /* counter */ int c, old = 0; /* input character */ if ((buf = ptr = malloc(bsize)) == NULL) { prg_err(gettext("fatal: out of memory")); exit(EXIT_FAILURE); } for (; ; i++) { if (i == bsize) { bsize += BUFSIZ; if ((buf = realloc(buf, bsize)) == NULL) { prg_err(gettext("fatal: out of memory")); exit(EXIT_FAILURE); } ptr = buf + i; } c = input(); if (c == skip_ch && old != '\\') { break; } else if (c == '\n') { lineno++; } else if (c == 0) { if (skip_ch == '"') { warning(gettext("warning: unmatched \"")); } else if (skip_ch == '\'') { warning(gettext("warning: unmatched '")); } else { /* Should not happen */ warning(gettext( "warning: unmatched character")); } break; } *ptr++ = c; if (old == '\\') { old = '\0'; } else { old = c; } } *ptr = '\0'; return (buf); } static char * skip_comment(void) { char *buf, *ptr; /* saved buffer and its pointer */ int bsize = BUFSIZ; /* growing buffer size */ int i = 0; /* counter */ int c, old = 0; /* input character */ if ((buf = ptr = malloc(bsize)) == NULL) { prg_err(gettext("fatal: out of memory")); exit(EXIT_FAILURE); } *ptr++ = '/'; i++; *ptr++ = '*'; i++; for (; ; i++) { if (i == bsize) { bsize += BUFSIZ; if ((buf = realloc(buf, bsize)) == NULL) { prg_err(gettext("fatal: out of memory")); exit(EXIT_FAILURE); } ptr = buf + i; } c = input(); if (c == '/' && old == '*') { *ptr++ = c; break; } else if (c == '\n') { lineno++; } else if (c == 0) { warning(gettext("warning: unmatched /*")); break; } *ptr++ = old = c; } *ptr = '\0'; return (buf); } /* * parse_cppline() parses the line control information that a C * preprocessor generates to indicate the location in the original * file. See the cpp man in the details. */ static void parse_cppline(char *str) { int n, line, len; char ch; char file[BUFSIZ]; char *altfile = NULL; char *pfile; len = strlen(str); if (len >= sizeof (file)) { if ((altfile = malloc(len + 1)) == NULL) { prg_err(gettext("fatal: out of memory")); exit(EXIT_FAILURE); } pfile = altfile; } else { pfile = file; } /* LINTED: E_SEC_SCANF_UNBOUNDED_COPY */ n = sscanf(str, "%c%d%s", &ch, &line, pfile); /* 'file' is a quoted string but 'srcfile' is not. */ len = strlen(pfile) - 2; pfile++; if (n == 3 && (strncmp(pfile, srcfile, len) == 0)) { pound_is_mine = TRUE; lineno = line - 1; } else if (n == 2 && (pound_is_mine == TRUE)) { lineno = line - 1; } else { pound_is_mine = FALSE; } if (altfile) free(altfile); } typedef struct { int line; int msgid; } LineMsgID; static LineMsgID line_msgid[NL_MSGMAX]; static int line_msgcnt; void init_lex(void) { lineno = 1; end_of_cat = TRUE; pound_is_mine = FALSE; } void init_linemsgid(void) { line_msgcnt = 0; (void) memset(line_msgid, 0, sizeof (LineMsgID) * NL_MSGMAX); } void set_linemsgid(int line, int msgid) { if (line_msgcnt >= NL_MSGMAX) { return; /* oops */ } line_msgid[line_msgcnt].line = line; line_msgid[line_msgcnt].msgid = msgid; line_msgcnt++; } int get_linemsgid(int line) { int i, left, right; left = 0; right = line_msgcnt - 1; while (left <= right) { i = (left + right) >> 1; if (line < line_msgid[i].line) { right = i - 1; } else if (line > line_msgid[i].line) { left = i + 1; } else { return (line_msgid[i].msgid); } } return (NOLINEMSG); } void yyerror(char *s) { if ((IsActiveMode(PreProcessMode) && pound_is_mine == FALSE) || IsActiveMode(ReplaceMode)) { return; } src_err(srcfile, lineno, gettext("%s before or at: %s"), s, yytext); } void warning(char *s) { if ((IsActiveMode(PreProcessMode) && pound_is_mine == FALSE) || IsActiveMode(ReplaceMode)) { return; } src_err(srcfile, lineno, "%s", s); } int yyvstop[] = { 0, 26, 0, 25, 0, 23, 26, 0, 24, 26, 0, 26, 0, 26, 0, 26, 0, 19, 26, 0, 26, 0, 26, 0, 17, 26, 0, 16, 25, 0, 12, 17, 23, 26, 0, 15, 17, 26, 0, 17, 24, 26, 0, 5, 17, 26, 0, 5, 17, 26, 0, 4, 17, 26, 0, 13, 17, 26, 0, 17, 26, 0, 5, 17, 26, 0, 14, 15, 17, 19, 26, 0, 15, 17, 26, 0, 15, 17, 26, 0, 15, 17, 26, 0, 15, 17, 26, 0, 17, 26, 0, 18, 0, 21, 0, 19, 0, 15, 0, 10, 0, 11, 0, 14, 15, 19, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 22, 0, 20, 0, 15, 0, 15, 0, 15, 0, 15, 0, 9, 15, 0, 15, 0, 15, 0, 15, 0, 8, 15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 6, 15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 3, 0, 15, 0, 3, 15, 0, 7, 15, 0, 1, 0, 2, 0, 1, 15, 0, 2, 15, 0, 0}; # define YYTYPE unsigned char struct yywork { YYTYPE verify, advance; } yycrank[] = { 0,0, 0,0, 1,5, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 1,5, 1,6, 0,0, 9,32, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 3,15, 1,7, 9,32, 0,0, 0,0, 1,5, 1,8, 1,5, 3,15, 3,16, 21,42, 11,35, 1,9, 1,10, 1,11, 1,12, 11,36, 2,7, 2,14, 9,33, 23,43, 54,54, 2,8, 0,0, 0,0, 0,0, 0,0, 0,0, 2,9, 1,5, 2,11, 0,0, 1,10, 3,17, 0,0, 0,0, 0,0, 3,18, 3,19, 3,20, 0,0, 0,0, 3,21, 3,22, 3,23, 3,24, 3,25, 3,26, 0,0, 4,17, 4,31, 0,0, 0,0, 0,0, 4,19, 0,0, 0,0, 0,0, 4,21, 4,22, 4,23, 3,20, 4,25, 50,61, 3,27, 34,51, 1,13, 10,34, 12,37, 12,37, 12,37, 12,37, 12,37, 12,37, 12,37, 12,37, 12,37, 12,37, 13,38, 27,45, 13,34, 45,56, 2,13, 38,53, 46,57, 47,58, 48,59, 14,39, 26,44, 26,44, 26,44, 26,44, 26,44, 26,44, 26,44, 26,44, 26,44, 26,44, 3,28, 28,46, 29,45, 28,45, 49,60, 30,45, 3,29, 51,62, 28,47, 53,63, 56,64, 3,30, 14,39, 29,49, 30,50, 28,48, 4,28, 57,65, 58,66, 59,67, 61,68, 12,34, 4,29, 62,69, 63,70, 64,71, 65,72, 4,30, 14,40, 14,40, 14,40, 14,40, 14,40, 14,40, 14,40, 14,40, 14,40, 14,40, 18,41, 67,73, 68,74, 26,45, 69,75, 70,76, 71,77, 72,78, 18,41, 74,79, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 75,80, 76,81, 77,82, 78,83, 18,41, 79,84, 80,85, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 82,87, 0,0, 0,0, 0,0, 18,41, 0,0, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 18,41, 36,36, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 36,36, 36,52, 37,37, 37,37, 37,37, 37,37, 37,37, 37,37, 37,37, 37,37, 37,37, 37,37, 40,54, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 40,54, 40,55, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 36,36, 0,0, 36,36, 0,0, 0,0, 0,0, 0,0, 0,0, 36,36, 0,0, 36,36, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 40,54, 0,0, 40,54, 0,0, 36,36, 0,0, 0,0, 36,36, 40,54, 0,0, 40,40, 44,44, 44,44, 44,44, 44,44, 44,44, 44,44, 44,44, 44,44, 44,44, 44,44, 0,0, 0,0, 0,0, 40,54, 0,0, 81,86, 40,54, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 0,0, 0,0, 0,0, 0,0, 81,86, 0,0, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 81,86, 83,88, 0,0, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 0,0, 0,0, 0,0, 0,0, 83,88, 0,0, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 83,88, 0,0}; struct yysvf yysvec[] = { 0, 0, 0, yycrank+-1, 0, 0, yycrank+-17, yysvec+1, 0, yycrank+-33, 0, 0, yycrank+-49, yysvec+3, 0, yycrank+0, 0, yyvstop+1, yycrank+0, 0, yyvstop+3, yycrank+0, 0, yyvstop+5, yycrank+0, 0, yyvstop+8, yycrank+4, 0, yyvstop+11, yycrank+2, 0, yyvstop+13, yycrank+3, 0, yyvstop+15, yycrank+54, 0, yyvstop+17, yycrank+15, 0, yyvstop+20, yycrank+112, 0, yyvstop+22, yycrank+0, 0, yyvstop+24, yycrank+0, 0, yyvstop+27, yycrank+0, 0, yyvstop+30, yycrank+132, 0, yyvstop+35, yycrank+0, 0, yyvstop+39, yycrank+0, 0, yyvstop+43, yycrank+1, 0, yyvstop+47, yycrank+0, 0, yyvstop+51, yycrank+9, yysvec+9, yyvstop+55, yycrank+0, yysvec+10, yyvstop+59, yycrank+0, yysvec+11, yyvstop+62, yycrank+74, yysvec+18, yyvstop+66, yycrank+14, yysvec+18, yyvstop+72, yycrank+36, yysvec+18, yyvstop+76, yycrank+35, yysvec+18, yyvstop+80, yycrank+38, yysvec+18, yyvstop+84, yycrank+0, yysvec+14, yyvstop+88, yycrank+0, yysvec+9, 0, yycrank+0, 0, yyvstop+91, yycrank+2, 0, 0, yycrank+0, 0, yyvstop+93, yycrank+-254, 0, 0, yycrank+217, 0, yyvstop+95, yycrank+1, 0, 0, yycrank+0, yysvec+14, 0, yycrank+-274, 0, 0, yycrank+0, yysvec+18, yyvstop+97, yycrank+0, 0, yyvstop+99, yycrank+0, 0, yyvstop+101, yycrank+275, yysvec+18, yyvstop+103, yycrank+18, yysvec+18, yyvstop+107, yycrank+2, yysvec+18, yyvstop+109, yycrank+22, yysvec+18, yyvstop+111, yycrank+10, yysvec+18, yyvstop+113, yycrank+20, yysvec+18, yyvstop+115, yycrank+2, yysvec+18, yyvstop+117, yycrank+23, 0, 0, yycrank+0, 0, yyvstop+119, yycrank+38, 0, 0, yycrank+-7, yysvec+40, 0, yycrank+0, 0, yyvstop+121, yycrank+26, yysvec+18, yyvstop+123, yycrank+46, yysvec+18, yyvstop+125, yycrank+36, yysvec+18, yyvstop+127, yycrank+36, yysvec+18, yyvstop+129, yycrank+0, yysvec+18, yyvstop+131, yycrank+53, yysvec+18, yyvstop+134, yycrank+52, 0, 0, yycrank+55, 0, 0, yycrank+54, yysvec+18, yyvstop+136, yycrank+57, yysvec+18, yyvstop+138, yycrank+0, yysvec+18, yyvstop+140, yycrank+55, yysvec+18, yyvstop+143, yycrank+75, yysvec+18, yyvstop+145, yycrank+73, 0, 0, yycrank+59, 0, 0, yycrank+75, yysvec+18, yyvstop+147, yycrank+61, yysvec+18, yyvstop+149, yycrank+0, yysvec+18, yyvstop+151, yycrank+63, yysvec+18, yyvstop+154, yycrank+74, 0, 0, yycrank+76, 0, 0, yycrank+76, yysvec+18, yyvstop+156, yycrank+78, yysvec+18, yyvstop+158, yycrank+95, yysvec+18, yyvstop+160, yycrank+81, 0, 0, yycrank+292, 0, yyvstop+162, yycrank+108, yysvec+18, yyvstop+164, yycrank+369, yysvec+18, yyvstop+166, yycrank+0, yysvec+18, yyvstop+169, yycrank+0, 0, yyvstop+172, yycrank+0, 0, yyvstop+174, yycrank+0, yysvec+18, yyvstop+176, yycrank+0, yysvec+18, yyvstop+179, 0, 0, 0}; struct yywork *yytop = yycrank+491; struct yysvf *yybgin = yysvec+1; char yymatch[] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 9, 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9, 1, 1, 1, 1, 1, 38, 1, 40, 40, 40, 40, 1, 1, 46, 40, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 1, 40, 1, 1, 62, 1, 1, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 1, 1, 1, 1, 65, 1, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}; char yyextra[] = { 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0}; /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License, Version 1.0 only * (the "License"). You may not use this file except in compliance * with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. * See the License for the specific language governing permissions * and limitations under the License. * * When distributing Covered Code, include this CDDL HEADER in each * file and include the License file at usr/src/OPENSOLARIS.LICENSE. * If applicable, add the following below this CDDL HEADER, with the * fields enclosed by brackets "[]" replaced with your own identifying * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ /* Copyright (c) 1989 AT&T */ /* All Rights Reserved */ #pragma ident "%Z%%M% %I% %E% SMI" int yylineno =1; # define YYU(x) x # define NLSTATE yyprevious=YYNEWLINE struct yysvf *yylstate [YYLMAX], **yylsp, **yyolsp; char yysbuf[YYLMAX]; char *yysptr = yysbuf; int *yyfnd; extern struct yysvf *yyestate; int yyprevious = YYNEWLINE; #if defined(__cplusplus) || defined(__STDC__) int yylook(void) #else yylook() #endif { register struct yysvf *yystate, **lsp; register struct yywork *yyt; struct yysvf *yyz; int yych, yyfirst; struct yywork *yyr; # ifdef LEXDEBUG int debug; # endif char *yylastch; /* start off machines */ # ifdef LEXDEBUG debug = 0; # endif yyfirst=1; if (!yymorfg) yylastch = yytext; else { yymorfg=0; yylastch = yytext+yyleng; } for(;;){ lsp = yylstate; yyestate = yystate = yybgin; if (yyprevious==YYNEWLINE) yystate++; for (;;){ # ifdef LEXDEBUG if(debug)fprintf(yyout,"state %d\n",yystate-yysvec-1); # endif yyt = yystate->yystoff; if(yyt == yycrank && !yyfirst){ /* may not be any transitions */ yyz = yystate->yyother; if(yyz == 0)break; if(yyz->yystoff == yycrank)break; } #ifndef __cplusplus *yylastch++ = yych = input(); #else *yylastch++ = yych = lex_input(); #endif #ifdef YYISARRAY if(yylastch > &yytext[YYLMAX]) { fprintf(yyout,"Input string too long, limit %d\n",YYLMAX); exit(1); } #else if (yylastch >= &yytext[ yytextsz ]) { int x = yylastch - yytext; yytextsz += YYTEXTSZINC; if (yytext == yy_tbuf) { yytext = (char *) malloc(yytextsz); memcpy(yytext, yy_tbuf, sizeof (yy_tbuf)); } else yytext = (char *) realloc(yytext, yytextsz); if (!yytext) { fprintf(yyout, "Cannot realloc yytext\n"); exit(1); } yylastch = yytext + x; } #endif yyfirst=0; tryagain: # ifdef LEXDEBUG if(debug){ fprintf(yyout,"char "); allprint(yych); putchar('\n'); } # endif yyr = yyt; if ( (uintptr_t)yyt > (uintptr_t)yycrank){ yyt = yyr + yych; if (yyt <= yytop && yyt->verify+yysvec == yystate){ if(yyt->advance+yysvec == YYLERR) /* error transitions */ {unput(*--yylastch);break;} *lsp++ = yystate = yyt->advance+yysvec; if(lsp > &yylstate[YYLMAX]) { fprintf(yyout,"Input string too long, limit %d\n",YYLMAX); exit(1); } goto contin; } } # ifdef YYOPTIM else if((uintptr_t)yyt < (uintptr_t)yycrank) { /* r < yycrank */ yyt = yyr = yycrank+(yycrank-yyt); # ifdef LEXDEBUG if(debug)fprintf(yyout,"compressed state\n"); # endif yyt = yyt + yych; if(yyt <= yytop && yyt->verify+yysvec == yystate){ if(yyt->advance+yysvec == YYLERR) /* error transitions */ {unput(*--yylastch);break;} *lsp++ = yystate = yyt->advance+yysvec; if(lsp > &yylstate[YYLMAX]) { fprintf(yyout,"Input string too long, limit %d\n",YYLMAX); exit(1); } goto contin; } yyt = yyr + YYU(yymatch[yych]); # ifdef LEXDEBUG if(debug){ fprintf(yyout,"try fall back character "); allprint(YYU(yymatch[yych])); putchar('\n'); } # endif if(yyt <= yytop && yyt->verify+yysvec == yystate){ if(yyt->advance+yysvec == YYLERR) /* error transition */ {unput(*--yylastch);break;} *lsp++ = yystate = yyt->advance+yysvec; if(lsp > &yylstate[YYLMAX]) { fprintf(yyout,"Input string too long, limit %d\n",YYLMAX); exit(1); } goto contin; } } if ((yystate = yystate->yyother) && (yyt= yystate->yystoff) != yycrank){ # ifdef LEXDEBUG if(debug)fprintf(yyout,"fall back to state %d\n",yystate-yysvec-1); # endif goto tryagain; } # endif else {unput(*--yylastch);break;} contin: # ifdef LEXDEBUG if(debug){ fprintf(yyout,"state %d char ",yystate-yysvec-1); allprint(yych); putchar('\n'); } # endif ; } # ifdef LEXDEBUG if(debug){ fprintf(yyout,"stopped at %d with ",*(lsp-1)-yysvec-1); allprint(yych); putchar('\n'); } # endif while (lsp-- > yylstate){ *yylastch-- = 0; if (*lsp != 0 && (yyfnd= (*lsp)->yystops) && *yyfnd > 0){ yyolsp = lsp; if(yyextra[*yyfnd]){ /* must backup */ while(yyback((*lsp)->yystops,-*yyfnd) != 1 && lsp > yylstate){ lsp--; unput(*yylastch--); } } yyprevious = YYU(*yylastch); yylsp = lsp; yyleng = yylastch-yytext+1; yytext[yyleng] = 0; # ifdef LEXDEBUG if(debug){ fprintf(yyout,"\nmatch "); sprint(yytext); fprintf(yyout," action %d\n",*yyfnd); } # endif return(*yyfnd++); } unput(*yylastch); } if (yytext[0] == 0 /* && feof(yyin) */) { yysptr=yysbuf; return(0); } #ifndef __cplusplus yyprevious = yytext[0] = input(); if (yyprevious>0) output(yyprevious); #else yyprevious = yytext[0] = lex_input(); if (yyprevious>0) lex_output(yyprevious); #endif yylastch=yytext; # ifdef LEXDEBUG if(debug)putchar('\n'); # endif } } #if defined(__cplusplus) || defined(__STDC__) int yyback(int *p, int m) #else yyback(p, m) int *p; #endif { if (p==0) return(0); while (*p) { if (*p++ == m) return(1); } return(0); } /* the following are only used in the lex library */ #if defined(__cplusplus) || defined(__STDC__) int yyinput(void) #else yyinput() #endif { #ifndef __cplusplus return(input()); #else return(lex_input()); #endif } #if defined(__cplusplus) || defined(__STDC__) void yyoutput(int c) #else yyoutput(c) int c; #endif { #ifndef __cplusplus output(c); #else lex_output(c); #endif } #if defined(__cplusplus) || defined(__STDC__) void yyunput(int c) #else yyunput(c) int c; #endif { unput(c); }