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

Defined functions

chd1 defined in line 9; used 1 times
  • in line 6
chd2 defined in line 73; used 1 times
  • in line 70
ctail defined in line 86; used 1 times
  • in line 82
phead1 defined in line 5; used 1 times
phead2 defined in line 69; used 2 times
ptail defined in line 80; used 2 times
rhd1 defined in line 50; used 1 times
  • in line 6
rtail defined in line 94; used 1 times
  • in line 82
statistics defined in line 105; used 4 times

Defined variables

sccsid defined in line 2; never used
Last modified: 1983-08-12
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 866
Valid CSS Valid XHTML 1.0 Strict