1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
/*
I C M - C O M P . C
*/
#include "iccomp.h"
#ifdef MSDOS
#pragma comment(lib, "icmcomp")
#pragma comment(lib, "../rss/icrss")
#endif
int main (argc, argv) /* icm-comp source(txt) dest(bin) */
int
argc;
char
**argv;
{
if (argc != 3)
{
copyright("Make Optimizing Compiler", version, release, 1);
error("Usage: %s source dest\n"
"where:\n"
"\tsource: source file to compile\n"
"\t (normally output from ICM-PP)\n"
"\tdest: name of binary file to generate\n"
,
program_name(argv[0]));
}
if
(
!(yyin = fopen(argv[1], "rt")) /* open text file for parsing */
||
!(s_bin = fopen(argv[2], "w+b")) /* open binary file to write/read */
)
error("%s Can't read/write file(s)");
/* malloc the dead-stack */
dead = xrealloc(NULL, sizeof(unsigned));
stringbuf = xstrdup(nullstring); /* malloc initial stringbuf */
/* go to first codebyte pos */
fseek(s_bin, sizeof(BIN_HEADER_), SEEK_SET);
yyparse(); /* parse the source */
if (!yynerrs) /* backend if no errors */
backend();
else /* informative message */
printf("\n%d error(s) detected\n", errcount);
return(yynerrs != 0); /* returnvalue */
}
|