/* Important Safety Tip for VAXCHEF.C: * This is a C program. You must compile it to produce an * executable. Furthermore, VAX C is hosed. You must use the * following commands: * * $ DEFINE LNK$LIBRARY SYS$LIBRARY:VAXCRTL * $ CC VAXCHEF * $ LINK VAXCHEF * $ RUN VAXCHEF * * You can then type text, and it will echo it back to you, * encheferized. Hit control-Z to exit. * * This is all you need to make the program work, but there's * another thing you can do to make the program smaller. Create a * file called VAXC.OPT containing the following line: * * sys$share:vaxcrtl/share * * Then, when you link the program, use the command * * $ LINK VAXCHEF, VAXC /OPTIONS * * This links the program against shareable libraries, resulting in * a much smaller executable. This is very helpful if your system * is tight with disk quotas, since without it, even the shortest C * programs suck up about 100 blocks. All other VMS programming * languages do this automatically; VAX C is just really messed up. * * To encheferize files, you can use the command * * $ RUN VAXCHEF /INPUT=filename1 /OUTPUT=filename2 * * Where 'filename1' is the file you want to encheferize. The new * version will be in 'filename2'. One thing to note about this * approach is that it creates a detached process, and if the * program gets stuck in a loop, it can sit there munching on the * CPU. So you'll want to keep an eye on the process. Problems of * this sort aren't likely to happen with the Encheferizer, but * since it was a total hack, I can't guarantee that the program is * flawless. * * Another way to redirect input and output is to use the commands * * $ DEFINE SYS$INPUT filename1 /USER * $ DEFINE SYS$OUTPUT filename2 /USER * $ RUN VAXCHEF * * By redefining the logicals SYS$INPUT and SYS$OUTPUT, the input * and output will be the respective files. The /USER qualifier * indicates that these definitions will only be in effect for the * next program that is run. * * May 5, 1993 * */ #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 #define YYLMAX 200 #define output(c) printf("%c",c) #define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getchar())==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar) #define unput(c) {yytchar= (c);if(yytchar=='\n')yylineno--;*yysptr++=yytchar;} #define yymore() (yymorfg=1) #define ECHO printf( "%s",yytext) #define REJECT { nstr = yyreject(); goto yyfussy;} int yyleng; extern char yytext[]; int yymorfg; extern char *yysptr, yysbuf[]; int yytchar; FILE *yyin /* ={chefinput.txt}*/, *yyout /*={chefoutput.txt}*/; extern int yylineno; struct yysvf { struct yywork *yystoff; struct yysvf *yyother; int *yystops;}; struct yysvf *yyestate; extern struct yysvf yysvec[], *yybgin; /* chef.x - convert English on stdin to Mock Swedish on stdout * * The WC definition matches any word character, and the NW definition matches * any non-word character. Two start conditions are maintained: INW (in word) * and NIW (not in word). The first rule passes TeX commands without change. * * HISTORY * * Apr 15, 1992; John Hagerman: Created. * * 30-MAR-1993; Cliff McCarthy: Hacked C code to produce a VMS version */ static int i_seen = 0; # define INW 2 # define NIW 4 # define YYNEWLINE 10 int yylex(){ int nstr; extern int yyprevious; while((nstr = yylook()) >= 0) yyfussy: switch(nstr){ case 0: /*if(yywrap()) return(0)*/; break; case 1: ECHO; break; case 2: { BEGIN NIW; i_seen = 0; ECHO; } break; case 3: { BEGIN NIW; i_seen = 0; printf(".\nBork Bork Bork!"); } break; case 4: ECHO; break; case 5: ECHO; break; case 6: { BEGIN INW; printf("un"); } break; case 7: { BEGIN INW; printf("Un"); } break; case 8: { BEGIN INW; printf("oo"); } break; case 9: { BEGIN INW; printf("Oo"); } break; case 10: { BEGIN INW; printf("e"); } break; case 11: { BEGIN INW; printf("E"); } break; case 12: { BEGIN INW; printf("ee"); } break; case 13: { BEGIN INW; printf("oo"); } break; case 14: { BEGIN INW; printf("e-a"); } break; case 15: { BEGIN INW; printf("i"); } break; case 16: { BEGIN INW; printf("I"); } break; case 17: { BEGIN INW; printf("ff"); } break; case 18: { BEGIN INW; printf("ur"); } break; case 19: { BEGIN INW; printf(i_seen++ ? "i" : "ee"); } break; case 20: { BEGIN INW; printf("oo"); } break; case 21: { BEGIN INW; printf("oo"); } break; case 22: { BEGIN INW; printf("Oo"); } break; case 23: { BEGIN INW; printf("u"); } break; case 24: { BEGIN INW; printf("zee"); } break; case 25: { BEGIN INW; printf("Zee"); } break; case 26: { BEGIN INW; printf("t"); } break; case 27: { BEGIN INW; printf("shun"); } break; case 28: { BEGIN INW; printf("oo"); } break; case 29: { BEGIN INW; printf("Oo"); } break; case 30: { BEGIN INW; printf("f"); } break; case 31: { BEGIN INW; printf("F"); } break; case 32: { BEGIN INW; printf("v"); } break; case 33: { BEGIN INW; printf("V"); } break; case 34: { BEGIN INW; ECHO; } break; case -1: break; default: printf("bad switch yylook %d",nstr); } return(0); } /* end of yylex */ int yyvstop[] ={ 0, 2, 34, 0, 2, 0, 34, 0, 2, 34, -3, 0, 34, -11, 0, 34, 0, 31, 34, 0, 33, 34, 0, 2, 34, 0, 34, -10, 0, 34, 0, 34, 0, 30, 34, 0, 32, 34, 0, 29, 34, 0, 34, -14, 0, 17, 34, 0, 19, 34, 0, 23, 34, 0, 34, 0, 28, 34, 0, 34, 0, 16, 34, 0, 22, 34, 0, 34, 0, 15, 34, 0, 21, 34, 0, 3, 0, 11, 0, 7, 11, 0, 9, 11, 0, 1, 0, 10, 0, 6, 10, 0, 8, 10, 0, -12, 0, -26, 0, 14, 0, 13, 0, 18, 0, 20, 0, 25, 0, 12, 0, 26, 0, 24, 0, 27, 0, -5, 0, -4, 0, 5, 0, 4, 0, 0}; # define YYTYPE unsigned char struct yywork { YYTYPE verify, advance; } yycrank[] ={ 0,0, 0,0, 1,7, 0,0, 15,39, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 1,8, 10,34, 15,0, 39,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, 1,7, 0,0, 15,0, 39,0, 0,0, 0,0, 0,0, 1,9, 0,0, 15,39, 0,0, 0,0, 0,0, 3,7, 1,10, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 2,10, 3,8, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 1,11, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 2,11, 0,0, 0,0, 0,0, 3,7, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 3,9, 1,12, 0,0, 1,13, 1,14, 0,0, 0,0, 3,10, 2,12, 1,15, 2,13, 2,14, 0,0, 0,0, 1,16, 0,0, 2,15, 0,0, 1,17, 38,52, 0,0, 2,16, 12,38, 18,44, 0,0, 2,17, 3,11, 17,43, 28,50, 5,7, 4,10, 24,47, 31,51, 1,18, 49,56, 1,19, 1,20, 25,48, 5,8, 50,57, 2,18, 51,58, 2,19, 2,20, 56,59, 3,12, 3,21, 3,13, 3,14, 4,11, 26,44, 26,49, 57,60, 3,15, 58,61, 0,0, 0,0, 0,0, 3,16, 0,0, 5,7, 0,0, 3,22, 3,23, 0,0, 0,0, 3,24, 5,9, 4,12, 4,21, 4,13, 4,14, 3,25, 0,0, 5,10, 0,0, 4,15, 3,26, 3,27, 3,19, 3,20, 4,16, 0,0, 0,0, 0,0, 4,22, 4,23, 0,0, 0,0, 4,24, 6,10, 0,0, 0,0, 5,11, 5,28, 4,25, 0,0, 5,29, 0,0, 0,0, 4,26, 4,27, 4,19, 4,20, 0,0, 0,0, 0,0, 5,30, 0,0, 6,11, 6,28, 0,0, 5,12, 6,29, 5,13, 5,14, 0,0, 0,0, 0,0, 0,0, 5,15, 0,0, 0,0, 6,30, 0,0, 5,16, 5,31, 0,0, 6,12, 5,32, 6,13, 6,14, 0,0, 0,0, 0,0, 0,0, 6,15, 0,0, 11,35, 5,33, 0,0, 6,16, 6,31, 0,0, 5,18, 6,32, 5,19, 5,20, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 6,33, 0,0, 0,0, 0,0, 0,0, 6,18, 0,0, 6,19, 6,20, 11,35, 11,35, 11,35, 11,35, 11,35, 11,35, 11,35, 11,35, 11,35, 11,35, 11,35, 11,35, 11,35, 11,35, 11,35, 11,35, 11,35, 11,35, 11,35, 11,35, 11,35, 11,35, 11,35, 11,35, 11,35, 11,35, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 11,35, 11,35, 11,35, 11,35, 11,35, 11,35, 11,35, 11,35, 11,35, 11,35, 11,35, 11,35, 11,35, 11,36, 11,35, 11,35, 11,35, 11,35, 11,35, 11,35, 11,37, 11,35, 11,35, 11,35, 11,35, 11,35, 16,40, 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, 0,0, 0,0, 0,0, 0,0, 0,0, 16,40, 16,40, 16,40, 16,40, 16,40, 16,40, 16,40, 16,40, 16,40, 16,40, 16,40, 16,40, 16,40, 16,40, 16,40, 16,40, 16,40, 16,40, 16,40, 16,40, 16,40, 16,40, 16,40, 16,40, 16,40, 16,40, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 16,40, 16,40, 16,40, 16,40, 16,40, 16,40, 16,40, 16,40, 16,40, 16,40, 16,40, 16,40, 16,40, 16,41, 16,40, 16,40, 16,40, 16,40, 16,40, 16,40, 16,42, 16,40, 16,40, 16,40, 16,40, 16,40, 22,45, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 22,45, 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, 0,0, 22,45, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 22,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,0, 0,0, 0,0, 0,0, 0,0, 0,0, 22,0, 22,0, 22,0, 22,0, 22,0, 22,0, 22,0, 22,0, 22,0, 22,0, 22,0, 22,0, 22,0, 22,0, 22,0, 22,0, 22,0, 22,0, 22,0, 22,0, 22,0, 22,0, 22,0, 22,0, 22,0, 22,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 22,0, 22,0, 22,0, 22,0, 22,0, 22,0, 22,0, 22,0, 22,0, 22,0, 22,0, 22,0, 22,0, 22,43, 22,0, 22,0, 22,0, 22,0, 22,0, 22,0, 22,0, 22,0, 22,46, 22,0, 22,0, 22,0, 43,53, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 43,53, 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, 0,0, 43,53, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 43,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,0, 0,0, 0,0, 0,0, 0,0, 0,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 43,0, 44,54, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 44,54, 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, 0,0, 44,54, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 44,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,0, 0,0, 0,0, 0,0, 0,0, 0,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 44,0, 44,0, 44,0, 44,0, 44,55, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 44,0, 60,62, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 60,62, 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, 0,0, 60,62, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 60,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,0, 0,0, 0,0, 0,0, 0,0, 0,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 60,0, 61,63, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 61,63, 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, 0,0, 61,63, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 61,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,0, 0,0, 0,0, 0,0, 0,0, 0,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 0,0}; struct yysvf yysvec[] ={ 0, 0, 0, yycrank+-1, 0, 0, yycrank+-8, yysvec+1, 0, yycrank+-45, 0, 0, yycrank+-68, yysvec+3, 0, yycrank+-112, 0, 0, yycrank+-128, yysvec+5, 0, yycrank+0, 0, yyvstop+1, yycrank+0, 0, yyvstop+4, yycrank+0, 0, yyvstop+6, yycrank+2, 0, yyvstop+8, yycrank+183, 0, yyvstop+12, yycrank+2, 0, yyvstop+15, yycrank+0, 0, yyvstop+17, yycrank+0, 0, yyvstop+20, yycrank+-3, 0, yyvstop+23, yycrank+267, 0, yyvstop+26, yycrank+1, 0, yyvstop+29, yycrank+3, 0, yyvstop+31, yycrank+0, 0, yyvstop+33, yycrank+0, 0, yyvstop+36, yycrank+0, 0, yyvstop+39, yycrank+-389, 0, yyvstop+42, yycrank+0, 0, yyvstop+45, yycrank+1, 0, yyvstop+48, yycrank+2, 0, yyvstop+51, yycrank+30, 0, yyvstop+54, yycrank+0, 0, yyvstop+56, yycrank+1, 0, yyvstop+59, yycrank+0, 0, yyvstop+61, yycrank+0, 0, yyvstop+64, yycrank+5, 0, yyvstop+67, yycrank+0, yysvec+17, yyvstop+69, yycrank+0, 0, yyvstop+72, yycrank+0, 0, yyvstop+75, yycrank+0, 0, yyvstop+77, yycrank+0, 0, yyvstop+79, yycrank+0, 0, yyvstop+82, yycrank+2, 0, 0, yycrank+-4, yysvec+15, yyvstop+85, yycrank+0, 0, yyvstop+87, yycrank+0, 0, yyvstop+89, yycrank+0, 0, yyvstop+92, yycrank+-511, 0, yyvstop+95, yycrank+-633, 0, yyvstop+97, yycrank+0, 0, yyvstop+99, yycrank+0, 0, yyvstop+101, yycrank+0, 0, yyvstop+103, yycrank+0, 0, yyvstop+105, yycrank+7, 0, 0, yycrank+9, 0, 0, yycrank+11, 0, 0, yycrank+0, 0, yyvstop+107, yycrank+0, 0, yyvstop+109, yycrank+0, 0, yyvstop+111, yycrank+0, 0, yyvstop+113, yycrank+18, 0, 0, yycrank+29, 0, 0, yycrank+31, 0, 0, yycrank+0, 0, yyvstop+115, yycrank+-755, 0, yyvstop+117, yycrank+-877, 0, yyvstop+119, yycrank+0, 0, yyvstop+121, yycrank+0, 0, yyvstop+123, 0, 0, 0}; struct yywork *yytop = yycrank+999; struct yysvf *yybgin = yysvec+1; char yymatch[] ={ 00 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , 01 ,01 ,012 ,01 ,01 ,01 ,01 ,01 , 01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , 01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , 040 ,01 ,01 ,01 ,01 ,01 ,01 ,047 , 01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , 01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , 01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , 01 ,047 ,047 ,047 ,047 ,047 ,047 ,047 , 047 ,047 ,047 ,047 ,047 ,047 ,047 ,047 , 047 ,047 ,047 ,047 ,047 ,047 ,047 ,047 , 047 ,047 ,047 ,01 ,01 ,01 ,01 ,01 , 01 ,047 ,047 ,047 ,047 ,047 ,047 ,047 , 047 ,047 ,047 ,047 ,047 ,047 ,047 ,047 , 047 ,047 ,047 ,047 ,047 ,047 ,047 ,047 , 047 ,047 ,047 ,01 ,01 ,01 ,01 ,01 , 0}; char yyextra[] ={ 0,0,0,1,1,1,0,0, 0,0,1,1,1,0,1,0, 0,0,0,0,0,0,0,0, 0,0,1,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0}; /* ncform 4.1 83/08/11 */ int yylineno =1; # define YYU(x) x # define NLSTATE yyprevious=YYNEWLINE char yytext[YYLMAX]; struct yysvf *yylstate [YYLMAX], **yylsp, **yyolsp; char yysbuf[YYLMAX]; char *yysptr = yysbuf; int *yyfnd; extern struct yysvf *yyestate; int yyprevious = YYNEWLINE; #if NeXT int yylook(){ #else yylook(){ #endif NeXT register struct yysvf *yystate, **lsp; register struct yywork *yyt; struct yysvf *yyz; int yych; struct yywork *yyr; # ifdef LEXDEBUG int debug; # endif char *yylastch; /* start off machines */ # ifdef LEXDEBUG debug = 0; # endif 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)printf("state %d\n",yystate-yysvec-1); # endif yyt = yystate->yystoff; if(yyt == yycrank){ /* may not be any transitions */ yyz = yystate->yyother; if(yyz == 0)break; if(yyz->yystoff == yycrank)break; } *yylastch++ = yych = input(); if (yych==0) exit(0); tryagain: # ifdef LEXDEBUG if(debug){ printf("char "); allprint(yych); putchar('\n'); } # endif yyr = yyt; if ( (int)yyt > (int)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; goto contin; } } # ifdef YYOPTIM else if((int)yyt < (int)yycrank) { /* r < yycrank */ yyt = yyr = yycrank+(yycrank-yyt); # ifdef LEXDEBUG if(debug)printf("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; goto contin; } yyt = yyr + YYU(yymatch[yych]); # ifdef LEXDEBUG if(debug){ printf("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; goto contin; } } if ((yystate = yystate->yyother) && (yyt= yystate->yystoff) != yycrank){ # ifdef LEXDEBUG if(debug)printf("fall back to state %d\n",yystate-yysvec-1); # endif goto tryagain; } # endif else {unput(*--yylastch);break;} contin: # ifdef LEXDEBUG if(debug){ printf("state %d char ",yystate-yysvec-1); allprint(yych); putchar('\n'); } # endif ; } # ifdef LEXDEBUG if(debug){ printf("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){ printf("\nmatch "); sprint(yytext); printf(" action %d\n",*yyfnd); } # endif return(*yyfnd++); } unput(*yylastch); } if (yytext[0] == 0 /* && eof() */) { yysptr=yysbuf; return(0); } yyprevious = yytext[0] = input(); if (yyprevious>0) output(yyprevious); yylastch=yytext; # ifdef LEXDEBUG if(debug)putchar('\n'); # endif } } #if NeXT int yyback(p, m) int *p; int m; #else yyback(p, m) int *p; #endif NeXT { if (p==0) return(0); while (*p) { if (*p++ == m) return(1); } return(0); } /* the following are only used in the lex library */ #if NeXT int yyinput(){ #else yyinput(){ #endif NeXT return(input()); } #if NeXT void yyoutput(c) int c; { output(c); } #else yyoutput(c) int c; { output(c); } #endif NeXT #if NeXT void yyunput(c) int c; { unput(c); } #else yyunput(c) int c; { unput(c); } #endif NeXT