forked from enlightenment/efl
parent
4abf2af2f4
commit
383755fc56
|
@ -501,8 +501,6 @@ void setactivefile(int fnumber);
|
|||
cell nameincells(char *name);
|
||||
void setfile(char *name, int fileno);
|
||||
void setline(int line, int fileno);
|
||||
void setfiledirect(char *name);
|
||||
void setlinedirect(int line);
|
||||
void setlabel(int index);
|
||||
void endexpr(int fullexpr);
|
||||
void startfunc(char *fname);
|
||||
|
|
|
@ -316,10 +316,7 @@ sc_compile(int argc, char *argv[])
|
|||
|
||||
setopt(argc, argv, inpfname, outfname, incfname, reportname);
|
||||
/* set output names that depend on the input name */
|
||||
if (sc_listing)
|
||||
set_extension(outfname, ".lst", TRUE);
|
||||
else
|
||||
set_extension(outfname, ".asm", TRUE);
|
||||
set_extension(outfname, ".asm", TRUE);
|
||||
strcpy(binfname, outfname);
|
||||
set_extension(binfname, ".amx", TRUE);
|
||||
setconfig(argv[0]); /* the path to the include files */
|
||||
|
@ -336,33 +333,15 @@ sc_compile(int argc, char *argv[])
|
|||
if (outf == NULL)
|
||||
error(101, outfname);
|
||||
/* immediately open the binary file, for other programs to check */
|
||||
if (sc_asmfile || sc_listing)
|
||||
{
|
||||
binf = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
binf = (FILE *) sc_openbin(binfname);
|
||||
if (binf == NULL)
|
||||
error(101, binfname);
|
||||
} /* if */
|
||||
binf = (FILE *) sc_openbin(binfname);
|
||||
if (binf == NULL)
|
||||
error(101, binfname);
|
||||
setconstants(); /* set predefined constants and tagnames */
|
||||
for (i = 0; i < skipinput; i++) /* skip lines in the input file */
|
||||
if (sc_readsrc(inpf, pline, sLINEMAX) != NULL)
|
||||
fline++; /* keep line number up to date */
|
||||
skipinput = fline;
|
||||
sc_status = statFIRST;
|
||||
/* write starting options (from the command line or the
|
||||
* configuration file) */
|
||||
if (sc_listing)
|
||||
{
|
||||
fprintf(outf, "#pragma ctrlchar '%c'\n", sc_ctrlchar);
|
||||
fprintf(outf, "#pragma pack %s\n", sc_packstr ? "true" : "false");
|
||||
fprintf(outf, "#pragma semicolon %s\n",
|
||||
sc_needsemicolon ? "true" : "false");
|
||||
fprintf(outf, "#pragma tabsize %d\n", sc_tabsize);
|
||||
setfiledirect(inpfname);
|
||||
} /* if */
|
||||
/* do the first pass through the file */
|
||||
inpfmark = sc_getpossrc(inpf);
|
||||
if (strlen(incfname) > 0)
|
||||
|
@ -383,9 +362,6 @@ sc_compile(int argc, char *argv[])
|
|||
|
||||
/* second pass */
|
||||
sc_status = statWRITE; /* set, to enable warnings */
|
||||
/* write a report, if requested */
|
||||
if (sc_listing)
|
||||
goto cleanup;
|
||||
|
||||
/* ??? for re-parsing the listing file instead of the original source
|
||||
* file (and doing preprocessing twice):
|
||||
|
@ -438,14 +414,14 @@ sc_compile(int argc, char *argv[])
|
|||
if (inpf != NULL) /* main source file is not closed, do it now */
|
||||
sc_closesrc(inpf);
|
||||
/* write the binary file (the file is already open) */
|
||||
if (!(sc_asmfile || sc_listing) && errnum == 0 && jmpcode == 0)
|
||||
if (errnum == 0 && jmpcode == 0)
|
||||
{
|
||||
assert(binf != NULL);
|
||||
sc_resetasm(outf); /* flush and loop back, for reading */
|
||||
assemble(binf, outf); /* assembler file is now input */
|
||||
} /* if */
|
||||
if (outf != NULL)
|
||||
sc_closeasm(outf, !(sc_asmfile || sc_listing));
|
||||
sc_closeasm(outf, TRUE);
|
||||
if (binf != NULL)
|
||||
sc_closebin(binf, errnum != 0);
|
||||
|
||||
|
@ -568,8 +544,6 @@ initglobals(void)
|
|||
{
|
||||
resetglobals();
|
||||
|
||||
sc_asmfile = FALSE; /* do not create .ASM file */
|
||||
sc_listing = FALSE; /* do not create .LST file */
|
||||
skipinput = 0; /* number of lines to skip from the first
|
||||
* input file */
|
||||
sc_ctrlchar = CTRL_CHAR; /* the escape character */
|
||||
|
|
|
@ -126,7 +126,6 @@ plungequalifiedfile(char *name)
|
|||
fcurrent = fnumber;
|
||||
icomment = FALSE;
|
||||
setfile(inpfname, fcurrent);
|
||||
setfiledirect(inpfname);
|
||||
listline = -1; /* force a #line directive when changing the file */
|
||||
setactivefile(fcurrent);
|
||||
return TRUE;
|
||||
|
@ -276,7 +275,6 @@ readline(char *line)
|
|||
inpfname = (char *)popstk();
|
||||
inpf = (FILE *) popstk();
|
||||
setactivefile(fcurrent);
|
||||
setfiledirect(inpfname);
|
||||
listline = -1; /* force a #line directive when changing the file */
|
||||
elsedone = 0;
|
||||
} /* if */
|
||||
|
@ -1717,21 +1715,6 @@ preprocess(void)
|
|||
lptr = pline; /* reset "line pointer" to start of the parsing buffer */
|
||||
} /* if */
|
||||
#endif
|
||||
if (sc_status == statFIRST && sc_listing && freading
|
||||
&& (iscommand == CMD_NONE || iscommand == CMD_EMPTYLINE
|
||||
|| iscommand == CMD_DIRECTIVE))
|
||||
{
|
||||
listline++;
|
||||
if (fline != listline)
|
||||
{
|
||||
listline = fline;
|
||||
setlinedirect(fline);
|
||||
} /* if */
|
||||
if (iscommand == CMD_EMPTYLINE)
|
||||
fputs("\n", outf);
|
||||
else
|
||||
fputs(pline, outf);
|
||||
} /* if */
|
||||
}
|
||||
while (iscommand != CMD_NONE && iscommand != CMD_TERM && freading); /* enddo */
|
||||
}
|
||||
|
|
|
@ -171,23 +171,6 @@ setline(int line, int fileno)
|
|||
} /* if */
|
||||
}
|
||||
|
||||
SC_FUNC void
|
||||
setfiledirect(char *name)
|
||||
{
|
||||
if (sc_status == statFIRST && sc_listing)
|
||||
{
|
||||
assert(name != NULL);
|
||||
fprintf(outf, "#file %s\n", name);
|
||||
} /* if */
|
||||
}
|
||||
|
||||
SC_FUNC void
|
||||
setlinedirect(int line)
|
||||
{
|
||||
if (sc_status == statFIRST && sc_listing)
|
||||
fprintf(outf, "#line %d\n", line);
|
||||
}
|
||||
|
||||
/* setlabel
|
||||
*
|
||||
* Post a code label (specified as a number), on a new line.
|
||||
|
@ -232,14 +215,6 @@ SC_FUNC void
|
|||
startfunc(char *fname)
|
||||
{
|
||||
stgwrite("\tproc");
|
||||
if (sc_asmfile)
|
||||
{
|
||||
char symname[2 * sNAMEMAX + 16];
|
||||
|
||||
funcdisplayname(symname, fname);
|
||||
stgwrite("\t; ");
|
||||
stgwrite(symname);
|
||||
} /* if */
|
||||
stgwrite("\n");
|
||||
code_idx += opcodes(1);
|
||||
}
|
||||
|
@ -679,12 +654,8 @@ ffcase(cell value, char *labelname, int newtable)
|
|||
SC_FUNC void
|
||||
ffcall(symbol * sym, int numargs)
|
||||
{
|
||||
char symname[2 * sNAMEMAX + 16];
|
||||
|
||||
assert(sym != NULL);
|
||||
assert(sym->ident == iFUNCTN);
|
||||
if (sc_asmfile)
|
||||
funcdisplayname(symname, sym->name);
|
||||
if ((sym->usage & uNATIVE) != 0)
|
||||
{
|
||||
/* reserve a SYSREQ id if called for the first time */
|
||||
|
@ -693,11 +664,6 @@ ffcall(symbol * sym, int numargs)
|
|||
sym->addr = ntv_funcid++;
|
||||
stgwrite("\tsysreq.c ");
|
||||
outval(sym->addr, FALSE);
|
||||
if (sc_asmfile)
|
||||
{
|
||||
stgwrite("\t; ");
|
||||
stgwrite(symname);
|
||||
} /* if */
|
||||
stgwrite("\n\tstack ");
|
||||
outval((numargs + 1) * sizeof(cell), TRUE);
|
||||
code_idx += opcodes(2) + opargs(2);
|
||||
|
@ -707,13 +673,6 @@ ffcall(symbol * sym, int numargs)
|
|||
/* normal function */
|
||||
stgwrite("\tcall ");
|
||||
stgwrite(sym->name);
|
||||
if (sc_asmfile
|
||||
&& !isalpha(sym->name[0]) && sym->name[0] != '_'
|
||||
&& sym->name[0] != sc_ctrlchar)
|
||||
{
|
||||
stgwrite("\t; ");
|
||||
stgwrite(symname);
|
||||
} /* if */
|
||||
stgwrite("\n");
|
||||
code_idx += opcodes(1) + opargs(1);
|
||||
} /* if */
|
||||
|
|
|
@ -57,8 +57,6 @@ int warnnum = 0; /* number of warnings */
|
|||
int sc_debug = sCHKBOUNDS; /* by default: bounds checking+assertions */
|
||||
int charbits = 8; /* a "char" is 8 bits */
|
||||
int sc_packstr = FALSE; /* strings are packed by default? */
|
||||
int sc_asmfile = FALSE; /* create .ASM file? */
|
||||
int sc_listing = FALSE; /* create .LST file? */
|
||||
int sc_compress = TRUE; /* compress bytecode? */
|
||||
int sc_needsemicolon = TRUE; /* semicolon required to terminate expressions? */
|
||||
int sc_dataalign = sizeof(cell); /* data alignment value */
|
||||
|
|
Loading…
Reference in New Issue