Write .lst
after the second pass. (#375)
This commit is contained in:
parent
19dabbbeb0
commit
9a16724b6a
@ -280,6 +280,7 @@ enum {
|
|||||||
enum {
|
enum {
|
||||||
statIDLE, /* not compiling yet */
|
statIDLE, /* not compiling yet */
|
||||||
statFIRST, /* first pass */
|
statFIRST, /* first pass */
|
||||||
|
statSECOND, /* second pass */
|
||||||
statWRITE, /* writing output */
|
statWRITE, /* writing output */
|
||||||
statSKIP, /* skipping output */
|
statSKIP, /* skipping output */
|
||||||
};
|
};
|
||||||
|
@ -575,20 +575,6 @@ int pc_compile(int argc, char *argv[])
|
|||||||
fline++; /* keep line number up to date */
|
fline++; /* keep line number up to date */
|
||||||
skipinput=fline;
|
skipinput=fline;
|
||||||
sc_status=statFIRST;
|
sc_status=statFIRST;
|
||||||
/* write starting options (from the command line or the configuration file) */
|
|
||||||
if (sc_listing) {
|
|
||||||
char string[150];
|
|
||||||
sprintf(string,"#pragma ctrlchar 0x%02x\n"
|
|
||||||
"#pragma pack %s\n"
|
|
||||||
"#pragma semicolon %s\n"
|
|
||||||
"#pragma tabsize %d\n",
|
|
||||||
sc_ctrlchar,
|
|
||||||
sc_packstr ? "true" : "false",
|
|
||||||
sc_needsemicolon ? "true" : "false",
|
|
||||||
sc_tabsize);
|
|
||||||
pc_writeasm(outf,string);
|
|
||||||
} /* if */
|
|
||||||
setfiledirect(inpfname);
|
|
||||||
/* do the first pass through the file (or possibly two or more "first passes") */
|
/* do the first pass through the file (or possibly two or more "first passes") */
|
||||||
sc_parsenum=0;
|
sc_parsenum=0;
|
||||||
inpfmark=pc_getpossrc(inpf_org);
|
inpfmark=pc_getpossrc(inpf_org);
|
||||||
@ -629,7 +615,10 @@ int pc_compile(int argc, char *argv[])
|
|||||||
} while (sc_reparse);
|
} while (sc_reparse);
|
||||||
|
|
||||||
/* second (or third) pass */
|
/* second (or third) pass */
|
||||||
sc_status=statWRITE; /* set, to enable warnings */
|
if (sc_listing)
|
||||||
|
sc_status=statSECOND;
|
||||||
|
else
|
||||||
|
sc_status=statWRITE; /* set, to enable warnings */
|
||||||
state_conflict(&glbtab);
|
state_conflict(&glbtab);
|
||||||
|
|
||||||
/* write a report, if requested */
|
/* write a report, if requested */
|
||||||
@ -649,8 +638,28 @@ int pc_compile(int argc, char *argv[])
|
|||||||
} /* if */
|
} /* if */
|
||||||
} /* if */
|
} /* if */
|
||||||
#endif
|
#endif
|
||||||
if (sc_listing)
|
|
||||||
goto cleanup;
|
sc_ctrlchar=sc_ctrlchar_org;
|
||||||
|
sc_packstr=lcl_packstr;
|
||||||
|
sc_needsemicolon=lcl_needsemicolon;
|
||||||
|
sc_tabsize=lcl_tabsize;
|
||||||
|
|
||||||
|
/*if (sc_listing)
|
||||||
|
goto cleanup;*/
|
||||||
|
/* write starting options (from the command line or the configuration file) */
|
||||||
|
if (sc_listing) {
|
||||||
|
char string[150];
|
||||||
|
sprintf(string,"#pragma ctrlchar 0x%02x\n"
|
||||||
|
"#pragma pack %s\n"
|
||||||
|
"#pragma semicolon %s\n"
|
||||||
|
"#pragma tabsize %d\n",
|
||||||
|
sc_ctrlchar,
|
||||||
|
sc_packstr ? "true" : "false",
|
||||||
|
sc_needsemicolon ? "true" : "false",
|
||||||
|
sc_tabsize);
|
||||||
|
pc_writeasm(outf,string);
|
||||||
|
} /* if */
|
||||||
|
setfiledirect(inpfname);
|
||||||
|
|
||||||
/* ??? for re-parsing the listing file instead of the original source
|
/* ??? for re-parsing the listing file instead of the original source
|
||||||
* file (and doing preprocessing twice):
|
* file (and doing preprocessing twice):
|
||||||
@ -666,10 +675,6 @@ int pc_compile(int argc, char *argv[])
|
|||||||
delete_substtable();
|
delete_substtable();
|
||||||
#endif
|
#endif
|
||||||
resetglobals();
|
resetglobals();
|
||||||
sc_ctrlchar=sc_ctrlchar_org;
|
|
||||||
sc_packstr=lcl_packstr;
|
|
||||||
sc_needsemicolon=lcl_needsemicolon;
|
|
||||||
sc_tabsize=lcl_tabsize;
|
|
||||||
errorset(sRESET,0);
|
errorset(sRESET,0);
|
||||||
/* reset the source file */
|
/* reset the source file */
|
||||||
inpf=inpf_org;
|
inpf=inpf_org;
|
||||||
@ -677,7 +682,10 @@ int pc_compile(int argc, char *argv[])
|
|||||||
pc_resetsrc(inpf,inpfmark); /* reset file position */
|
pc_resetsrc(inpf,inpfmark); /* reset file position */
|
||||||
fline=skipinput; /* reset line number */
|
fline=skipinput; /* reset line number */
|
||||||
lexinit(); /* clear internal flags of lex() */
|
lexinit(); /* clear internal flags of lex() */
|
||||||
sc_status=statWRITE; /* allow to write --this variable was reset by resetglobals() */
|
if (sc_listing)
|
||||||
|
sc_status=statSECOND;
|
||||||
|
else
|
||||||
|
sc_status=statWRITE; /* allow to write --this variable was reset by resetglobals() */
|
||||||
setstringconstants();
|
setstringconstants();
|
||||||
writeleader(&glbtab);
|
writeleader(&glbtab);
|
||||||
setfileconst(inpfname);
|
setfileconst(inpfname);
|
||||||
@ -690,6 +698,8 @@ int pc_compile(int argc, char *argv[])
|
|||||||
} /* if */
|
} /* if */
|
||||||
preprocess(); /* fetch first line */
|
preprocess(); /* fetch first line */
|
||||||
parse(); /* process all input */
|
parse(); /* process all input */
|
||||||
|
if (sc_listing)
|
||||||
|
goto cleanup;
|
||||||
/* inpf is already closed when readline() attempts to pop of a file */
|
/* inpf is already closed when readline() attempts to pop of a file */
|
||||||
writetrailer(); /* write remaining stuff */
|
writetrailer(); /* write remaining stuff */
|
||||||
|
|
||||||
|
@ -1911,7 +1911,7 @@ SC_FUNC void preprocess(void)
|
|||||||
lptr=pline; /* reset "line pointer" to start of the parsing buffer */
|
lptr=pline; /* reset "line pointer" to start of the parsing buffer */
|
||||||
} /* if */
|
} /* if */
|
||||||
#endif
|
#endif
|
||||||
if (sc_status==statFIRST && sc_listing && freading
|
if (sc_status==statSECOND && freading
|
||||||
&& (iscommand==CMD_NONE || iscommand==CMD_EMPTYLINE || iscommand==CMD_DIRECTIVE))
|
&& (iscommand==CMD_NONE || iscommand==CMD_EMPTYLINE || iscommand==CMD_DIRECTIVE))
|
||||||
{
|
{
|
||||||
listline++;
|
listline++;
|
||||||
|
@ -263,7 +263,7 @@ SC_FUNC void setline(int chkbounds)
|
|||||||
|
|
||||||
SC_FUNC void setfiledirect(char *name)
|
SC_FUNC void setfiledirect(char *name)
|
||||||
{
|
{
|
||||||
if (sc_status==statFIRST && sc_listing) {
|
if (sc_status==statSECOND && sc_listing) {
|
||||||
assert(name!=NULL);
|
assert(name!=NULL);
|
||||||
pc_writeasm(outf,"\n#file \"");
|
pc_writeasm(outf,"\n#file \"");
|
||||||
pc_writeasm(outf,name);
|
pc_writeasm(outf,name);
|
||||||
@ -281,7 +281,7 @@ SC_FUNC void setfileconst(char *name)
|
|||||||
|
|
||||||
SC_FUNC void setlinedirect(int line)
|
SC_FUNC void setlinedirect(int line)
|
||||||
{
|
{
|
||||||
if (sc_status==statFIRST && sc_listing) {
|
if (sc_status==statSECOND && sc_listing) {
|
||||||
char string[40];
|
char string[40];
|
||||||
sprintf(string,"#line %d\n",line);
|
sprintf(string,"#line %d\n",line);
|
||||||
pc_writeasm(outf,string);
|
pc_writeasm(outf,string);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user