1: # include "ldefs.c"
   2: phead1(){
   3:     ratfor ? rhd1() : chd1();
   4:     }
   5: 
   6: chd1(){
   7:     fprintf(fout,"# include \"stdio.h\"\n");
   8:     if (ZCH>NCH)
   9:     fprintf(fout, "# define U(x) ((x)&0377)\n");
  10:     else
  11:     fprintf(fout, "# define U(x) x\n");
  12:     fprintf(fout, "# define NLSTATE yyprevious=YYNEWLINE\n");
  13:     fprintf(fout,"# define BEGIN yybgin = yysvec + 1 +\n");
  14:     fprintf(fout,"# define INITIAL 0\n");
  15:     fprintf(fout,"# define YYLERR yysvec\n");
  16:     fprintf(fout,"# define YYSTATE (yyestate-yysvec-1)\n");
  17:     if(optim)
  18:         fprintf(fout,"# define YYOPTIM 1\n");
  19: # ifdef DEBUG
  20:     fprintf(fout,"# define LEXDEBUG 1\n");
  21: # endif
  22:     fprintf(fout,"# define YYLMAX 200\n");
  23:     fprintf(fout,"# define output(c) putc(c,yyout)\n");
  24:     fprintf(fout, "%s%d%s\n",
  25:   "# define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==",
  26:     ctable['\n'],
  27:  "?(yylineno++,yytchar):yytchar)==EOF?0:yytchar)");
  28:     fprintf(fout,
  29: "# define unput(c) {yytchar= (c);if(yytchar=='\\n')yylineno--;*yysptr++=yytchar;}\n");
  30:     fprintf(fout,"# define yymore() (yymorfg=1)\n");
  31:     fprintf(fout,"# define ECHO fprintf(yyout, \"%%s\",yytext)\n");
  32:     fprintf(fout,"# define REJECT { nstr = yyreject(); goto yyfussy;}\n");
  33:     fprintf(fout,"int yyleng; extern char yytext[];\n");
  34:     fprintf(fout,"int yymorfg;\n");
  35:     fprintf(fout,"extern char *yysptr, yysbuf[];\n");
  36:     fprintf(fout,"int yytchar;\n");
  37:     fprintf(fout,"FILE *yyin ={stdin}, *yyout ={stdout};\n");
  38:     fprintf(fout,"extern int yylineno;\n");
  39:     fprintf(fout,"struct yysvf { \n");
  40:     fprintf(fout,"\tstruct yywork *yystoff;\n");
  41:     fprintf(fout,"\tstruct yysvf *yyother;\n");
  42:     fprintf(fout,"\tint *yystops;};\n");
  43:     fprintf(fout,"struct yysvf *yyestate;\n");
  44:     fprintf(fout,"extern struct yysvf yysvec[], *yybgin;\n");
  45:     }
  46: 
  47: rhd1(){
  48:     fprintf(fout,"integer function yylex(dummy)\n");
  49:     fprintf(fout,"define YYLMAX 200\n");
  50:     fprintf(fout,"define ECHO call yyecho(yytext,yyleng)\n");
  51:     fprintf(fout,"define REJECT nstr = yyrjct(yytext,yyleng);goto 30998\n");
  52:     fprintf(fout,"integer nstr,yylook,yywrap\n");
  53:     fprintf(fout,"integer yyleng, yytext(YYLMAX)\n");
  54:     fprintf(fout,"common /yyxel/ yyleng, yytext\n");
  55:     fprintf(fout,"common /yyldat/ yyfnd, yymorf, yyprev, yybgin, yylsp, yylsta\n");
  56:     fprintf(fout,"integer yyfnd, yymorf, yyprev, yybgin, yylsp, yylsta(YYLMAX)\n");
  57:     fprintf(fout,"for(;;){\n");
  58:     fprintf(fout,"\t30999 nstr = yylook(dummy)\n");
  59:     fprintf(fout,"\tgoto 30998\n");
  60:     fprintf(fout,"\t30000 k = yywrap(dummy)\n");
  61:     fprintf(fout,"\tif(k .ne. 0){\n");
  62:     fprintf(fout,"\tyylex=0; return; }\n");
  63:     fprintf(fout,"\t\telse goto 30998\n");
  64:     }
  65: 
  66: phead2(){
  67:     if(!ratfor)chd2();
  68:     }
  69: 
  70: chd2(){
  71:     fprintf(fout,"while((nstr = yylook()) >= 0)\n");
  72:     fprintf(fout,"yyfussy: switch(nstr){\n");
  73:     fprintf(fout,"case 0:\n");
  74:     fprintf(fout,"if(yywrap()) return(0); break;\n");
  75:     }
  76: 
  77: ptail(){
  78:     if(!pflag)
  79:         ratfor ? rtail() : ctail();
  80:     pflag = 1;
  81:     }
  82: 
  83: ctail(){
  84:     fprintf(fout,"case -1:\nbreak;\n");     /* for reject */
  85:     fprintf(fout,"default:\n");
  86:     fprintf(fout,"fprintf(yyout,\"bad switch yylook %%d\",nstr);\n");
  87:     fprintf(fout,"} return(0); }\n");
  88:     fprintf(fout,"/* end of yylex */\n");
  89:     }
  90: 
  91: rtail(){
  92:     register int i;
  93:     fprintf(fout,"\n30998 if(nstr .lt. 0 .or. nstr .gt. %d)goto 30999\n",casecount);
  94:     fprintf(fout,"nstr = nstr + 1\n");
  95:     fprintf(fout,"goto(\n");
  96:     for(i=0; i<casecount; i++)
  97:         fprintf(fout,"%d,\n",30000+i);
  98:     fprintf(fout,"30999),nstr\n");
  99:     fprintf(fout,"30997 continue\n");
 100:     fprintf(fout,"}\nend\n");
 101:     }
 102: statistics(){
 103:     fprintf(errorf,"%d/%d nodes(%%e), %d/%d positions(%%p), %d/%d (%%n), %ld transitions\n",
 104:         tptr, treesize, nxtpos-positions, maxpos, stnum+1, nstates, rcount);
 105:     fprintf(errorf, ", %d/%d packed char classes(%%k)", pcptr-pchar, pchlen);
 106:     if(optim)fprintf(errorf,", %d/%d packed transitions(%%a)",nptr, ntrans);
 107:     fprintf(errorf, ", %d/%d output slots(%%o)", yytop, outsize);
 108:     putc('\n',errorf);
 109:     }

Defined functions

chd1 defined in line 6; used 1 times
  • in line 3
chd2 defined in line 70; used 1 times
  • in line 67
ctail defined in line 83; used 1 times
  • in line 79
phead1 defined in line 2; used 1 times
phead2 defined in line 66; used 2 times
ptail defined in line 77; used 2 times
rhd1 defined in line 47; used 1 times
  • in line 3
rtail defined in line 91; used 1 times
  • in line 79
statistics defined in line 102; used 4 times
Last modified: 1983-12-09
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 730
Valid CSS Valid XHTML 1.0 Strict