Lines Matching refs:fp
2956 FILE *fp; in Parse() local
2971 fp = fopen(ps.filename,"rb"); in Parse()
2972 if( fp==0 ){ in Parse()
2977 fseek(fp,0,2); in Parse()
2978 filesize = ftell(fp); in Parse()
2979 rewind(fp); in Parse()
2985 fclose(fp); in Parse()
2988 if( fread(filebuf,1,filesize,fp)!=filesize ){ in Parse()
2993 fclose(fp); in Parse()
2996 fclose(fp); in Parse()
3218 FILE *fp; in file_open() local
3222 fp = fopen(lemp->outname,mode); in file_open()
3223 if( fp==0 && *mode=='w' ){ in file_open()
3228 return fp; in file_open()
3289 void RulePrint(FILE *fp, struct rule *rp, int iCursor){ in RulePrint() argument
3292 fprintf(fp,"%s ::=",rp->lhs->name); in RulePrint()
3294 if( i==iCursor ) fprintf(fp," *"); in RulePrint()
3298 fprintf(fp," %s", sp->subsym[0]->name); in RulePrint()
3300 fprintf(fp,"|%s",sp->subsym[j]->name); in RulePrint()
3303 fprintf(fp," %s", sp->name); in RulePrint()
3310 void ConfigPrint(FILE *fp, struct config *cfp){ in ConfigPrint() argument
3311 RulePrint(fp, cfp->rp, cfp->dot); in ConfigPrint()
3355 FILE *fp, /* Print the action here */ in PrintAction() argument
3362 fprintf(fp,"%*s shift %-7d",indent,ap->sp->name,stp->statenum); in PrintAction()
3367 fprintf(fp,"%*s reduce %-7d",indent,ap->sp->name,rp->iRule); in PrintAction()
3368 RulePrint(fp, rp, -1); in PrintAction()
3373 fprintf(fp,"%*s shift-reduce %-7d",indent,ap->sp->name,rp->iRule); in PrintAction()
3374 RulePrint(fp, rp, -1); in PrintAction()
3378 fprintf(fp,"%*s accept",indent,ap->sp->name); in PrintAction()
3381 fprintf(fp,"%*s error",indent,ap->sp->name); in PrintAction()
3385 fprintf(fp,"%*s reduce %-7d ** Parsing conflict **", in PrintAction()
3389 fprintf(fp,"%*s shift %-7d ** Parsing conflict **", in PrintAction()
3394 fprintf(fp,"%*s shift %-7d -- dropped by precedence", in PrintAction()
3402 fprintf(fp,"%*s reduce %-7d -- dropped by precedence", in PrintAction()
3413 fprintf(fp," /* because %s==%s */", ap->sp->name, ap->spOpt->name); in PrintAction()
3426 FILE *fp; in ReportOutput() local
3428 fp = file_open(lemp,".out","wb"); in ReportOutput()
3429 if( fp==0 ) return; in ReportOutput()
3432 fprintf(fp,"State %d:\n",stp->statenum); in ReportOutput()
3439 fprintf(fp," %5s ",buf); in ReportOutput()
3441 fprintf(fp," "); in ReportOutput()
3443 ConfigPrint(fp,cfp); in ReportOutput()
3444 fprintf(fp,"\n"); in ReportOutput()
3446 SetPrint(fp,cfp->fws,lemp); in ReportOutput()
3447 PlinkPrint(fp,cfp->fplp,"To "); in ReportOutput()
3448 PlinkPrint(fp,cfp->bplp,"From"); in ReportOutput()
3453 fprintf(fp,"\n"); in ReportOutput()
3455 if( PrintAction(ap,fp,30) ) fprintf(fp,"\n"); in ReportOutput()
3457 fprintf(fp,"\n"); in ReportOutput()
3459 fprintf(fp, "----------------------------------------------------\n"); in ReportOutput()
3460 fprintf(fp, "Symbols:\n"); in ReportOutput()
3461 fprintf(fp, "The first-set of non-terminals is shown after the name.\n\n"); in ReportOutput()
3467 fprintf(fp, " %3d: %s", i, sp->name); in ReportOutput()
3469 fprintf(fp, ":"); in ReportOutput()
3471 fprintf(fp, " <lambda>"); in ReportOutput()
3475 fprintf(fp, " %s", lemp->symbols[j]->name); in ReportOutput()
3479 if( sp->prec>=0 ) fprintf(fp," (precedence=%d)", sp->prec); in ReportOutput()
3480 fprintf(fp, "\n"); in ReportOutput()
3482 fprintf(fp, "----------------------------------------------------\n"); in ReportOutput()
3483 fprintf(fp, "Syntax-only Symbols:\n"); in ReportOutput()
3484 fprintf(fp, "The following symbols never carry semantic content.\n\n"); in ReportOutput()
3491 fprintf(fp,"\n"); in ReportOutput()
3495 fprintf(fp, " "); in ReportOutput()
3498 fprintf(fp, "%s", sp->name); in ReportOutput()
3501 if( n>0 ) fprintf(fp, "\n"); in ReportOutput()
3502 fprintf(fp, "----------------------------------------------------\n"); in ReportOutput()
3503 fprintf(fp, "Rules:\n"); in ReportOutput()
3505 fprintf(fp, "%4d: ", rp->iRule); in ReportOutput()
3506 rule_print(fp, rp); in ReportOutput()
3507 fprintf(fp,"."); in ReportOutput()
3509 fprintf(fp," [%s precedence=%d]", in ReportOutput()
3512 fprintf(fp,"\n"); in ReportOutput()
3514 fclose(fp); in ReportOutput()