1
0
mirror of https://github.com/RevCurtisP/C02.git synced 2025-02-19 19:31:04 +00:00

Removed extraneous semicolon after ERROR( macro invocations

This commit is contained in:
Curtis F Kaylor 2018-03-04 13:38:40 -05:00
parent 1156f3b47b
commit f84affdb4a
10 changed files with 50 additions and 57 deletions

View File

@ -54,10 +54,10 @@ void pword(void) {
getwrd();
DEBUG("Parsing Word '%s'\n", word);
if (xstmnt[0]) {
if (wordis(xstmnt))
if (wordis(xstmnt))
xstmnt[0] = 0; //Clear xstmnt
else
ERROR("Expected '%s' statement\n", xstmnt, EXIT_FAILURE);
ERROR("Expected '%s' statement\n", xstmnt, EXIT_FAILURE)
}
if (!pmodfr() && !ptype(MTNONE))
pstmnt(); //Parse Statement
@ -69,19 +69,12 @@ void pdrctv(void) {
CCMNT('#');
getwrd(); //read directive into word
DEBUG("Processing directive '%s'\n", word);
if (wordis("DEFINE"))
pdefin(); //Parse Define
else if (wordis("ENUM"))
penumd(); //Parse Enum Directive
else if (wordis("INCLUDE"))
pincfl(); //Parse Include File
else if (wordis("ERROR")) {
ERROR("Error \n", 0, EXIT_FAILURE);
}
else if (wordis("PRAGMA"))
pprgma();
else
ERROR("Illegal directive %s encountered\n", word, EXIT_FAILURE);
if (wordis("DEFINE")) pdefin(); //Parse Define
else if (wordis("ENUM")) penumd(); //Parse Enum Directive
else if (wordis("INCLUDE")) pincfl(); //Parse Include File
else if (wordis("ERROR")) ERROR("Error \n", 0, EXIT_FAILURE)
else if (wordis("PRAGMA")) pprgma();
else ERROR("Illegal directive %s encountered\n", word, EXIT_FAILURE)
}
void prolog(void) {
@ -117,7 +110,7 @@ void compile(void) {
else if (isalph())
pword(); //Parse Word
else
ERROR("Unexpected character '%c'\n", nxtchr, EXIT_FAILURE);
ERROR("Unexpected character '%c'\n", nxtchr, EXIT_FAILURE)
}
epilog();
}
@ -135,11 +128,11 @@ int popt(int arg, int argc, char *argv[]) {
char optarg[32]; //Option Argument
strncpy (argstr, argv[arg], 31);
if (strlen(argstr) != 2)
ERROR("malformed option %s\n", argstr, EXIT_FAILURE);
ERROR("malformed option %s\n", argstr, EXIT_FAILURE)
opt = toupper(argstr[1]);
if (strchr("H", opt)) {
if (++arg >= argc)
ERROR("Option -%c requires an argument\n", opt, EXIT_FAILURE);
ERROR("Option -%c requires an argument\n", opt, EXIT_FAILURE)
strncpy(optarg, argv[arg], 31);
}
DEBUG("Processing Command Line Option -%c\n", argstr[1]);
@ -149,7 +142,7 @@ int popt(int arg, int argc, char *argv[]) {
DEBUG("Header Name set to '%s'\n", hdrnam);
break;
default:
ERROR("Illegal option -%c\n", opt, EXIT_FAILURE);
ERROR("Illegal option -%c\n", opt, EXIT_FAILURE)
}
return arg;
}
@ -177,7 +170,7 @@ void pargs(int argc, char *argv[]) {
DEBUG("outnam set to '%s'\n", outnam);
}
else
ERROR("Unexpected argument '%s'\n", argv[arg], EXIT_FAILURE);
ERROR("Unexpected argument '%s'\n", argv[arg], EXIT_FAILURE)
}
}

View File

@ -77,7 +77,7 @@ void prccmp(void) {
asmlin("BNE", cndlbl);
break;
default:
ERROR("Unsupported comparison operator index %d\n", cmprtr, EXIT_FAILURE);
ERROR("Unsupported comparison operator index %d\n", cmprtr, EXIT_FAILURE)
}
}

View File

@ -59,9 +59,9 @@ void pdecl(int m, int t) {
while(TRUE) {
getwrd();
if (match('(')) {
if (m != MTNONE) {
ERROR("Illegal Modifier %d in Function Definion", m, EXIT_FAILURE);
}
if (m != MTNONE)
ERROR("Illegal Modifier %d in Function Definion", m, EXIT_FAILURE)
addfnc(); //Add Function Call
return;
}

View File

@ -67,9 +67,9 @@ void chkidx(void) {
void prstrm(void) {
DEBUG("Parsing term\n", 0);
prsval(FALSE);
if (valtyp == FUNCTION) {
ERROR("Function call only allowed in first term\n", 0, EXIT_FAILURE);
}
if (valtyp == FUNCTION)
ERROR("Function call only allowed in first term\n", 0, EXIT_FAILURE)
strcpy(term, value);
DEBUG("Parsed term %s\n", term);
chkidx(); //Check for Array Index
@ -137,7 +137,7 @@ int chkadr(int adract) {
void prsfnc(char trmntr) {
DEBUG("Processing Function Call '%s'...\n", term);
if (fnscnt >= MAXFNS)
ERROR("Maximum Function Call Depth Exceeded", 0, EXIT_FAILURE);
ERROR("Maximum Function Call Depth Exceeded", 0, EXIT_FAILURE)
strcpy(fnstck[fnscnt++], term);
skpchr(); //skip open paren
CCMNT('(');

View File

@ -91,7 +91,7 @@ void opninc(void)
/* Close Include File *
* Uses: incfil - Include File Handle */
void clsinc() {
void clsinc(void) {
fclose(incfil);
}

View File

@ -31,7 +31,7 @@ void pincnm(void) {
dlmtr = '>';
}
else if (dlmtr != '"')
ERROR("Unexpected character '%c' after include\n", dlmtr, EXIT_FAILURE);
ERROR("Unexpected character '%c' after include\n", dlmtr, EXIT_FAILURE)
while (!match(dlmtr))
{
incnam[inclen++] = nxtchr;
@ -114,9 +114,9 @@ void prszpg(void) {
/* Process Vartable Subdirective */
void pvrtbl(void) {
if (vrwrtn) {
ERROR("Variable table already written", 0, EXIT_FAILURE);
}
if (vrwrtn)
ERROR("Variable table already written", 0, EXIT_FAILURE)
vartbl(); //Write Variable Table
}
@ -133,7 +133,7 @@ void pprgma(void) {
else if (wordis("ZEROPAGE"))
prszpg(); //Parse Origin
else
ERROR("Illegal pragma subdirective '%s'\n", word, EXIT_FAILURE);
ERROR("Illegal pragma subdirective '%s'\n", word, EXIT_FAILURE)
}
/* Process Include File Directive */

View File

@ -49,7 +49,7 @@ void setlbl(char *lblset) {
asmlin("",""); //Emit Block End Label on it's own line
}
if (strlen(lblset) > LABLEN)
ERROR("Label '%s' exceeds maximum size\n", word, EXIT_FAILURE);
ERROR("Label '%s' exceeds maximum size\n", word, EXIT_FAILURE)
strcpy(lblasm, lblset);
}

View File

@ -295,9 +295,9 @@ int prsnum(int maxval) {
DEBUG("Parsed number '%s' ", word);
DETAIL("with value '%d'\n", number);
if (number > maxval) {
ERROR("Out of bounds constant '%d';\n", number, EXIT_FAILURE);
}
if (number > maxval)
ERROR("Out of bounds constant '%d';\n", number, EXIT_FAILURE)
if (maxval > 255)
sprintf(value, "$%04X", number);
else
@ -323,9 +323,9 @@ int prsdef(void) {
expect('#');
getwrd(); //Get Constant Name
fnddef(word);
if (defidx < 0) {
ERROR("Undefined constant '%s'\n", word, EXIT_FAILURE);
}
if (defidx < 0)
ERROR("Undefined constant '%s'\n", word, EXIT_FAILURE)
strcpy(value, word);
return defval[defidx];
}

View File

@ -38,7 +38,7 @@ void endblk(int blkflg) {
expect('}'); //Block End Character
DEBUG("Found inblck set to %d\n", inblck);
if (inblck != blkflg)
ERROR("Encountered '}' without matching '{'\n", 0, EXIT_FAILURE);
ERROR("Encountered '}' without matching '{'\n", 0, EXIT_FAILURE)
lbtype = poplbl();
if (lbtype == LTDO)
pdowhl(); //Parse While at End of Do Loop
@ -139,9 +139,9 @@ void prcvar(char trmntr) {
}
else {
if (look(',')) {
if (asntyp == REGISTER) {
ERROR("Register %s not allowed in plural assignment\n", asnvar, EXIT_FAILURE);
}
if (asntyp == REGISTER)
ERROR("Register %s not allowed in plural assignment\n", asnvar, EXIT_FAILURE)
prsvar(FALSE); //get variable name
strcpy(ysnvar, word);
DEBUG("Set STY variable to %s\n", ysnvar);
@ -156,9 +156,9 @@ void prcvar(char trmntr) {
prsvar(FALSE); //get variable name
strcpy(xsnvar, word);
DEBUG("Set STX variable to %s\n", xsnvar);
if (valtyp == ARRAY) {
ERROR("Array element not allowed in third assignment\n", 0, EXIT_FAILURE);
}
if (valtyp == ARRAY)
ERROR("Array element not allowed in third assignment\n", 0, EXIT_FAILURE)
}
}
prcasn(trmntr);
@ -199,7 +199,7 @@ void pbrcnt(int lbflag)
{
DEBUG("Parsing BREAK/CONTINUE statement\n", 0);
if (lstlbl(lbflag) < 0)
ERROR("Break/continue statement outside of loop\n", 0, EXIT_FAILURE);
ERROR("Break/continue statement outside of loop\n", 0, EXIT_FAILURE)
DEBUG("Found Label '%s'\n", tmplbl);
asmlin("JMP", tmplbl);
expect(';');
@ -372,9 +372,9 @@ void pslct(void) {
void ecase(void) {
DEBUG("Processing end of CASE block\n", 0);
if (poplbl(cndlbl) != LTCASE)
ERROR("%s not at end of CASE block\n", word, EXIT_FAILURE);
ERROR("%s not at end of CASE block\n", word, EXIT_FAILURE)
if (toplbl(endlbl) != LTSLCT)
ERROR("Illegal nesting in SELECT statement\n", 0, EXIT_FAILURE);
ERROR("Illegal nesting in SELECT statement\n", 0, EXIT_FAILURE)
asmlin("JMP", endlbl); //Emit jump over default case
setlbl(cndlbl); //Set entry point label to emit
}
@ -432,7 +432,7 @@ void pwhile(void) {
/* generate unimplemented statement error */
void punimp(void) {
ERROR("Unimplemented statement '%s' encountered\n", word, EXIT_FAILURE);
ERROR("Unimplemented statement '%s' encountered\n", word, EXIT_FAILURE)
}
/* Parse Function Call as Statement */
@ -472,7 +472,7 @@ void pstmnt(void) {
return;
}
if (wordis("SWITCH")) {
ERROR("SWITCH not implemented. Use SELECT.\n", word, EXIT_FAILURE);
ERROR("SWITCH not implemented. Use SELECT.\n", word, EXIT_FAILURE)
}
if (wordis("SELECT")) {
pslct();

View File

@ -38,10 +38,10 @@ void chksym(int alwreg, char *name) {
valtyp = REGISTER;
return;
}
ERROR("Illegal reference to register %s\n", name, EXIT_FAILURE);
ERROR("Illegal reference to register %s\n", name, EXIT_FAILURE)
}
if (!fndvar(name))
ERROR("Undeclared variable '%s' encountered\n", name, EXIT_FAILURE);
ERROR("Undeclared variable '%s' encountered\n", name, EXIT_FAILURE)
}
/* Parse next word as variable or function name *
@ -153,9 +153,9 @@ void setvar(int m, int t) {
void addvar(int m, int t) {
strcpy(vrname, word); //Save Variable Name
if (fndvar(vrname))
ERROR("Duplicate declaration of variable '%s\n", word,EXIT_FAILURE);
ERROR("Duplicate declaration of variable '%s\n", word,EXIT_FAILURE)
if (t == VTVOID)
ERROR("Illegal Variable Type\n", 0, EXIT_FAILURE);
ERROR("Illegal Variable Type\n", 0, EXIT_FAILURE)
if (m == MTZP) {
setlbl(vrname);
sprintf(word, "$%hhX", zpaddr++);