mirror of
https://github.com/RevCurtisP/C02.git
synced 2024-11-22 01:31:33 +00:00
Added function names to DEBUG, cleaned prslit() calls
This commit is contained in:
parent
0ad8115dab
commit
e13bd5809c
24
src/cond.c
24
src/cond.c
@ -22,7 +22,7 @@ int cmpenc; //Encoded Comparator Character
|
|||||||
* Returns: Comparison Operator Bit Mask */
|
* Returns: Comparison Operator Bit Mask */
|
||||||
int enccmp(char c) {
|
int enccmp(char c) {
|
||||||
int e;
|
int e;
|
||||||
DEBUG("Encoding Comparison Character '%c'", c)
|
DEBUG("cond.enccm: Encoding Comparison Character '%c'", c)
|
||||||
switch(c) {
|
switch(c) {
|
||||||
case '=': e = 1; break;
|
case '=': e = 1; break;
|
||||||
case '<': e = 2; break;
|
case '<': e = 2; break;
|
||||||
@ -39,7 +39,7 @@ int enccmp(char c) {
|
|||||||
* Uses: term - Term Being Compared Against *
|
* Uses: term - Term Being Compared Against *
|
||||||
* label - Branch Target if Comparison is FALSE */
|
* label - Branch Target if Comparison is FALSE */
|
||||||
void prccmp(void) {
|
void prccmp(void) {
|
||||||
DEBUG("Processing comparator %d", cmprtr) DETAIL(" with REVCMP=%d\n", revcmp)
|
DEBUG("cond.prccmp: Processing comparator %d", cmprtr) DETAIL(" with REVCMP=%d\n", revcmp)
|
||||||
if (cmprtr > 7) { //Process Flag
|
if (cmprtr > 7) { //Process Flag
|
||||||
cmprtr = (cmprtr ^ revcmp) & 1; //Apply Reversal
|
cmprtr = (cmprtr ^ revcmp) & 1; //Apply Reversal
|
||||||
if (cmprtr) asmlin("BPL", cmplbl);
|
if (cmprtr) asmlin("BPL", cmplbl);
|
||||||
@ -81,12 +81,12 @@ void prscmp(int revrse) {
|
|||||||
skpspc();
|
skpspc();
|
||||||
if (cmprtr) prstrm(FALSE, TRUE);
|
if (cmprtr) prstrm(FALSE, TRUE);
|
||||||
//prccmp(); - Do after check for logical operator
|
//prccmp(); - Do after check for logical operator
|
||||||
DEBUG("Parsed comparator %d\n", cmprtr)
|
DEBUG("cond.prscmp: Parsed comparator %d\n", cmprtr)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse Flag Operator */
|
/* Parse Flag Operator */
|
||||||
void prsflg(int revrse) {
|
void prsflg(int revrse) {
|
||||||
DEBUG("Parsing Flag Operator '%c'\n", nxtchr)
|
DEBUG("cond.prsflg: Parsing Flag Operator '%c'\n", nxtchr)
|
||||||
if (match('+')) cmprtr = 8; //Bit 0 = 0
|
if (match('+')) cmprtr = 8; //Bit 0 = 0
|
||||||
else if (match('-')) cmprtr = 9; //Bit 1 = 1
|
else if (match('-')) cmprtr = 9; //Bit 1 = 1
|
||||||
else expctd("Flag operator");
|
else expctd("Flag operator");
|
||||||
@ -96,40 +96,40 @@ void prsflg(int revrse) {
|
|||||||
/* Parse Logical Operator *
|
/* Parse Logical Operator *
|
||||||
* Sets: logops */
|
* Sets: logops */
|
||||||
void prslop(void) {
|
void prslop(void) {
|
||||||
DEBUG("Checking for Logical Operator\n", 0)
|
DEBUG("cond.prslop: Checking for Logical Operator\n", 0)
|
||||||
logopr = LOPNONE;
|
logopr = LOPNONE;
|
||||||
skpspc();
|
skpspc();
|
||||||
if (isalph()) {
|
if (isalph()) {
|
||||||
getwrd(); //Get Logical Operator
|
getwrd(); //Get Logical Operator
|
||||||
DEBUG("Parsing Logical Operator %s\n", word)
|
DEBUG("cond.prslop: Parsing Logical Operator %s\n", word)
|
||||||
if (wordis("AND")) logopr = LOPAND;
|
if (wordis("AND")) logopr = LOPAND;
|
||||||
else if (wordis("OR")) logopr = LOPOR;
|
else if (wordis("OR")) logopr = LOPOR;
|
||||||
else ERROR("Encountered invalid token \"%s\"\n", word, EXIT_FAILURE)
|
else ERROR("Encountered invalid token \"%s\"\n", word, EXIT_FAILURE)
|
||||||
}
|
}
|
||||||
DEBUG("Set LOGOPR to %d\n", logopr)
|
DEBUG("cond.prslop: Set LOGOPR to %d\n", logopr)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse and Compile Conditional Expression *
|
/* Parse and Compile Conditional Expression *
|
||||||
* Condition = <expression> <comparator> <term> */
|
* Condition = <expression> <comparator> <term> */
|
||||||
void prscnd(char trmntr, int revrse) {
|
void prscnd(char trmntr, int revrse) {
|
||||||
DEBUG("Parsing condition with REVRSE=%d\n", revrse)
|
DEBUG("cond.prscnd: Parsing condition with REVRSE=%d\n", revrse)
|
||||||
tmplbl[0] = 0;
|
tmplbl[0] = 0;
|
||||||
do {
|
do {
|
||||||
strcpy(cmplbl, cndlbl); DEBUG("Set CMPLBL to \"%s\"\n", cmplbl);
|
strcpy(cmplbl, cndlbl); DEBUG("cond.prscnd: Set CMPLBL to \"%s\"\n", cmplbl);
|
||||||
revcmp = revrse;
|
revcmp = revrse;
|
||||||
if (look('!')) revcmp = (revcmp) ? FALSE: TRUE;
|
if (look('!')) revcmp = (revcmp) ? FALSE: TRUE;
|
||||||
DEBUG("Set REVCMP to %d\n", revcmp)
|
DEBUG("cond.prscnd: Set REVCMP to %d\n", revcmp)
|
||||||
if (!look('.')) prsxpr(0);
|
if (!look('.')) prsxpr(0);
|
||||||
if (look(':')) prsflg(revcmp); //Parse Flag Operator
|
if (look(':')) prsflg(revcmp); //Parse Flag Operator
|
||||||
else prscmp(revcmp); //Parse Comparison Operator
|
else prscmp(revcmp); //Parse Comparison Operator
|
||||||
prslop(); //Parse Logical Operator
|
prslop(); //Parse Logical Operator
|
||||||
if (logopr == LOPOR) {
|
if (logopr == LOPOR) {
|
||||||
revcmp = (revcmp) ? FALSE: TRUE;
|
revcmp = (revcmp) ? FALSE: TRUE;
|
||||||
DEBUG("Set REVCMP to %d\n", revcmp)
|
DEBUG("cond.prscnd: Set REVCMP to %d\n", revcmp)
|
||||||
}
|
}
|
||||||
if (logopr && revcmp) {
|
if (logopr && revcmp) {
|
||||||
if (!tmplbl[0]) newlbl(tmplbl);
|
if (!tmplbl[0]) newlbl(tmplbl);
|
||||||
strcpy(cmplbl, tmplbl); DEBUG("Set CMPLBL to \"%s\"\n", cmplbl);
|
strcpy(cmplbl, tmplbl); DEBUG("cond.prscnd: Set CMPLBL to \"%s\"\n", cmplbl);
|
||||||
}
|
}
|
||||||
prccmp(); //Process Comparison/Flag Operator
|
prccmp(); //Process Comparison/Flag Operator
|
||||||
} while (logopr);
|
} while (logopr);
|
||||||
|
26
src/dclrtn.c
26
src/dclrtn.c
@ -51,7 +51,7 @@ void addfnc(void) {
|
|||||||
expect(')');
|
expect(')');
|
||||||
if (look(';')) return; //Forward Definition
|
if (look(';')) return; //Forward Definition
|
||||||
infunc = TRUE; //Set Inside Function Definition Flag
|
infunc = TRUE; //Set Inside Function Definition Flag
|
||||||
DEBUG("Set infunc to %d\n", infunc)
|
DEBUG("dclrtn.addfnc: Set infunc to %d\n", infunc)
|
||||||
setlbl(fncnam); //Set Function Entry Point
|
setlbl(fncnam); //Set Function Entry Point
|
||||||
asmlin(LOCOP, ""); //Set Local Variables Boundary
|
asmlin(LOCOP, ""); //Set Local Variables Boundary
|
||||||
if (prmtra[0]) asmlin("STA", prmtra); //Store First Parameter
|
if (prmtra[0]) asmlin("STA", prmtra); //Store First Parameter
|
||||||
@ -72,7 +72,7 @@ void addcon(int numval) {
|
|||||||
if (alcvar) setlbl(defnam); //Set label Assembler Line
|
if (alcvar) setlbl(defnam); //Set label Assembler Line
|
||||||
conval[concnt++] = numval; //Get Value
|
conval[concnt++] = numval; //Get Value
|
||||||
if (alcvar) asmlin(EQUOP, value); //Write Definition
|
if (alcvar) asmlin(EQUOP, value); //Write Definition
|
||||||
DEBUG("Defined constant '%s'", defnam)
|
DEBUG("dclrtn.addcon: Defined constant '%s'", defnam)
|
||||||
DETAIL(" as '%s'\n", value)
|
DETAIL(" as '%s'\n", value)
|
||||||
if (!alcvar) SCMNT(""); //Clear Comment
|
if (!alcvar) SCMNT(""); //Clear Comment
|
||||||
}
|
}
|
||||||
@ -81,17 +81,17 @@ void addcon(int numval) {
|
|||||||
*/
|
*/
|
||||||
void penum(int m, int bitmsk) {
|
void penum(int m, int bitmsk) {
|
||||||
int enmval = (bitmsk) ? 1 : 0;
|
int enmval = (bitmsk) ? 1 : 0;
|
||||||
DEBUG("Processing Enum Declarations with BITMSK %d\n", bitmsk)
|
DEBUG("dclrtn.enum: Processing Enum Declarations with BITMSK %d\n", bitmsk)
|
||||||
if (m != MTNONE) ERROR("Illegal Modifier %d in Enum Definition", m, EXIT_FAILURE)
|
if (m != MTNONE) ERROR("Illegal Modifier %d in Enum Definition", m, EXIT_FAILURE)
|
||||||
expect('{');
|
expect('{');
|
||||||
do {
|
do {
|
||||||
if (enmval > 0xFF) ERROR("Maximum ENUM or BITMASK value exceeded\n", 0, EXIT_FAILURE)
|
if (enmval > 0xFF) ERROR("Maximum ENUM or BITMASK value exceeded\n", 0, EXIT_FAILURE)
|
||||||
if (look('.'))
|
if (look('.'))
|
||||||
DEBUG("Skipping sequence %d\n", enmval)
|
DEBUG("dclrtn.penum: Skipping sequence %d\n", enmval)
|
||||||
else {
|
else {
|
||||||
getwrd(); //get defined identifier
|
getwrd(); //get defined identifier
|
||||||
DEBUG("Enumerating '%s'", word)
|
DEBUG("dclrtn.penum: Enumerating '%s'", word)
|
||||||
DEBUG(" as %d\n", enmval);
|
DEBUG("dclrtn.penum: as %d\n", enmval);
|
||||||
strncpy(defnam, word, VARLEN);
|
strncpy(defnam, word, VARLEN);
|
||||||
sprintf(value, "%d", enmval);
|
sprintf(value, "%d", enmval);
|
||||||
addcon(enmval);
|
addcon(enmval);
|
||||||
@ -101,12 +101,12 @@ void penum(int m, int bitmsk) {
|
|||||||
} while (look(','));
|
} while (look(','));
|
||||||
expect('}');
|
expect('}');
|
||||||
expect(';');
|
expect(';');
|
||||||
DEBUG("Enum Declaration Completed\n", 0)
|
DEBUG("dclrtn.penum: Enum Declaration Completed\n", 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse Enum Declaration*/
|
/* Parse Enum Declaration*/
|
||||||
void pstrct(int m) {
|
void pstrct(int m) {
|
||||||
DEBUG("Processing Struct Declarations\n", 0)
|
DEBUG("dclrtn.pstrct: Processing Struct Declarations\n", 0)
|
||||||
getwrd(); //Parse Structure Name
|
getwrd(); //Parse Structure Name
|
||||||
if (look('{')) defstc(); //Parse Struct Definition
|
if (look('{')) defstc(); //Parse Struct Definition
|
||||||
else addstc(); //Parse and Compile Struct Declaration
|
else addstc(); //Parse and Compile Struct Declaration
|
||||||
@ -115,18 +115,18 @@ void pstrct(int m) {
|
|||||||
|
|
||||||
/* Parse Variable/Function Declaration*/
|
/* Parse Variable/Function Declaration*/
|
||||||
void pdecl(int m, int t) {
|
void pdecl(int m, int t) {
|
||||||
DEBUG("Processing declaration(s) of type %d\n", t)
|
DEBUG("dclrtn.pdegl: Processing declaration(s) of type %d\n", t)
|
||||||
do {
|
do {
|
||||||
getwrd();
|
getwrd();
|
||||||
if (match('(')) {
|
if (match('(')) {
|
||||||
if (m > MTNONE) ERROR("Illegal Modifier %d in Function Definition\n", m, EXIT_FAILURE)
|
if (m > MTNONE) ERROR("dclrtn.pdegl: Illegal Modifier %d in Function Definition\n", m, EXIT_FAILURE)
|
||||||
addfnc(); //Add Function Call
|
addfnc(); //Add Function Call
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
addvar(m, t);
|
addvar(m, t);
|
||||||
} while (look(','));
|
} while (look(','));
|
||||||
expect(';');
|
expect(';');
|
||||||
DEBUG("Declaration completed\n", 0)
|
DEBUG("dclrtn.pdegl: Declaration completed\n", 0)
|
||||||
cmtlin(); //Write out declaration comment
|
cmtlin(); //Write out declaration comment
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,13 +162,13 @@ int ptype(int m) {
|
|||||||
int pmtype(int m) {
|
int pmtype(int m) {
|
||||||
getwrd();
|
getwrd();
|
||||||
if (m == MTALGN && wordis("CONST")) {m = m | MTCONST; getwrd();}
|
if (m == MTALGN && wordis("CONST")) {m = m | MTCONST; getwrd();}
|
||||||
DEBUG("Parsing type %s\n", word)
|
DEBUG("dclrtn.pmtype: Parsing type %s\n", word)
|
||||||
return ptype(m);
|
return ptype(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for and Parse Modifier */
|
/* Check for and Parse Modifier */
|
||||||
int pmodfr(void) {
|
int pmodfr(void) {
|
||||||
DEBUG("Parsing modifier '%s'\n", word)
|
DEBUG("dclrtn.pmodfr: Parsing modifier '%s'\n", word)
|
||||||
int result = TRUE;
|
int result = TRUE;
|
||||||
if (wordis("ALIAS")) { pmtype(MTALS); }
|
if (wordis("ALIAS")) { pmtype(MTALS); }
|
||||||
else if (wordis("ALIGNED")) { pmtype(MTALGN); }
|
else if (wordis("ALIGNED")) { pmtype(MTALGN); }
|
||||||
|
10
src/expr.c
10
src/expr.c
@ -29,7 +29,7 @@ void poptrm(void) {
|
|||||||
trmidx--; //Decrement Stack Pointer
|
trmidx--; //Decrement Stack Pointer
|
||||||
strcpy(term, trmstk[trmidx]); //Restore Current Term from Stack
|
strcpy(term, trmstk[trmidx]); //Restore Current Term from Stack
|
||||||
oper = oprstk[trmidx]; //Restore Current Operator from Stack
|
oper = oprstk[trmidx]; //Restore Current Operator from Stack
|
||||||
DEBUG("expr.pshtrm: Popped term %s ", term)
|
DEBUG("expr.poptrm: Popped term %s ", term)
|
||||||
DETAIL("and operator '%c' off stack\n", oper)
|
DETAIL("and operator '%c' off stack\n", oper)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,6 +42,7 @@ void prsval(int alwreg, int alwcon) {
|
|||||||
DEBUG("expr.prsval: Parsing value\n", 0)
|
DEBUG("expr.prsval: Parsing value\n", 0)
|
||||||
skpspc();
|
skpspc();
|
||||||
if (islpre()) prslit(); //Parse Literal
|
if (islpre()) prslit(); //Parse Literal
|
||||||
|
else if (islpre()) prslit(TRUE); //Parse Literal
|
||||||
else if (isalph()) prsvar(alwreg, alwcon); //Parse Variable
|
else if (isalph()) prsvar(alwreg, alwcon); //Parse Variable
|
||||||
else if (isbtop()) prsbop(); //Parse Byte Operator
|
else if (isbtop()) prsbop(); //Parse Byte Operator
|
||||||
else expctd("literal or variable");
|
else expctd("literal or variable");
|
||||||
@ -308,6 +309,7 @@ void prsfnc(char trmntr) {
|
|||||||
skpchr(); //skip open paren
|
skpchr(); //skip open paren
|
||||||
CCMNT('(');
|
CCMNT('(');
|
||||||
prsfpr(')'); //Parse Function Parameters
|
prsfpr(')'); //Parse Function Parameters
|
||||||
|
DEBUG("expr.prsfnc: Checking for terminator #%d\n", trmntr)
|
||||||
expect(trmntr);
|
expect(trmntr);
|
||||||
poptrm(); //Pop Function Name off Term Stack
|
poptrm(); //Pop Function Name off Term Stack
|
||||||
asmlin("JSR", term);
|
asmlin("JSR", term);
|
||||||
@ -326,6 +328,8 @@ void prcvri(void) {
|
|||||||
* Args: alwint = Allow Integer-Like Variable *
|
* Args: alwint = Allow Integer-Like Variable *
|
||||||
* Returns: Integer-Like Variable Processed - TRUE/FALSE */
|
* Returns: Integer-Like Variable Processed - TRUE/FALSE */
|
||||||
int prcivr(int alwint) {
|
int prcivr(int alwint) {
|
||||||
|
DEBUG("expr.prcivr: Processing Integer Variiable %s", word)
|
||||||
|
DETAIL(" of type %d\n", vartyp)
|
||||||
switch (vartyp) {
|
switch (vartyp) {
|
||||||
case VTINT:
|
case VTINT:
|
||||||
if (!alwint) ERROR("Illegal Use of Integer Variable %s\n", word, EXIT_FAILURE)
|
if (!alwint) ERROR("Illegal Use of Integer Variable %s\n", word, EXIT_FAILURE)
|
||||||
@ -432,7 +436,7 @@ void prsxpi(char trmntr, int asmxpr) {
|
|||||||
DEBUG("expr.prsxpi: Parsing integer expression\n", 0)
|
DEBUG("expr.prsxpi: Parsing integer expression\n", 0)
|
||||||
if (!chkadr(TRUE, FALSE)) {
|
if (!chkadr(TRUE, FALSE)) {
|
||||||
if (isnpre()) {
|
if (isnpre()) {
|
||||||
DEBUG("expr.prsxpi: Parsing Integer Literal\n", 0)
|
DEBUG("expr.prsxpi: Parsing Integer Literal\n", 0)
|
||||||
int number = prsnum(0xFFFF); //Parse Number into value
|
int number = prsnum(0xFFFF); //Parse Number into value
|
||||||
if (asmxpr) {
|
if (asmxpr) {
|
||||||
sprintf(value, "#%d", number & 0xFF); asmlin("LDX", value);
|
sprintf(value, "#%d", number & 0xFF); asmlin("LDX", value);
|
||||||
@ -441,6 +445,7 @@ void prsxpi(char trmntr, int asmxpr) {
|
|||||||
} else if (isalph()) {
|
} else if (isalph()) {
|
||||||
prsvar(FALSE, TRUE);
|
prsvar(FALSE, TRUE);
|
||||||
if (valtyp == FUNCTION) {
|
if (valtyp == FUNCTION) {
|
||||||
|
DEBUG("stmnt.prrsxpi: Parsing function %s\n", value)
|
||||||
strcpy(term, value);
|
strcpy(term, value);
|
||||||
DEBUG("expr.prsxpi: Set term to %s\n", term)
|
DEBUG("expr.prsxpi: Set term to %s\n", term)
|
||||||
prsfnc(0); //Parse Expression Function
|
prsfnc(0); //Parse Expression Function
|
||||||
@ -456,5 +461,6 @@ void prsxpi(char trmntr, int asmxpr) {
|
|||||||
ERROR("Expected Integer Value or Function\n", 0, EXIT_FAILURE);
|
ERROR("Expected Integer Value or Function\n", 0, EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DEBUG("expr.prsxpi: Checking for terminater #%d\n", trmntr)
|
||||||
expect(trmntr);
|
expect(trmntr);
|
||||||
}
|
}
|
||||||
|
20
src/files.c
20
src/files.c
@ -22,9 +22,9 @@ void extsys(char *s) {
|
|||||||
* Uses: srcnam - Source File Name *
|
* Uses: srcnam - Source File Name *
|
||||||
* Sets: srcfil - Source File Handle */
|
* Sets: srcfil - Source File Handle */
|
||||||
void opnsrc(void) {
|
void opnsrc(void) {
|
||||||
DEBUG("Processing Source File Name '%s'\n", srcnam)
|
DEBUG("files.opnsrc: Processing Source File Name '%s'\n", srcnam)
|
||||||
if (strrchr(srcnam, '.') == NULL) strcat(srcnam, ".c02"); //if no extension. add ".c02"
|
if (strrchr(srcnam, '.') == NULL) strcat(srcnam, ".c02"); //if no extension. add ".c02"
|
||||||
DEBUG("opening Source File '%s'\n", srcnam)
|
DEBUG("files.opnsrc: Opening Source File '%s'\n", srcnam)
|
||||||
srcfil = fopen(srcnam, "r"); //open file
|
srcfil = fopen(srcnam, "r"); //open file
|
||||||
if (srcfil == NULL) extsys(srcnam);
|
if (srcfil == NULL) extsys(srcnam);
|
||||||
}
|
}
|
||||||
@ -36,16 +36,16 @@ void clssrc(void) { fclose(srcfil); }
|
|||||||
* Uses: outnam - Output File Name *
|
* Uses: outnam - Output File Name *
|
||||||
* Sets: outfil - Output File Handle */
|
* Sets: outfil - Output File Handle */
|
||||||
void opnout(void) {
|
void opnout(void) {
|
||||||
DEBUG("Processing Output File Name '%s'\n", outnam)
|
DEBUG("files.opnout: Processing Output File Name '%s'\n", outnam)
|
||||||
if (strlen(outnam) == 0) //if Output File not specified
|
if (strlen(outnam) == 0) //if Output File not specified
|
||||||
{
|
{
|
||||||
strcpy(outnam, srcnam); //copy Source Name to Ouput Name
|
strcpy(outnam, srcnam); //copy Source Name to Ouput Name
|
||||||
char *dot = strrchr(outnam, '.'); //find extension
|
char *dot = strrchr(outnam, '.'); //find extension
|
||||||
if (dot != NULL) *dot = 0; //and remove it
|
if (dot != NULL) *dot = 0; //and remove it
|
||||||
DEBUG("Set Output File Name to '%s'\n", outnam)
|
DEBUG("files.opnout: Set Output File Name to '%s'\n", outnam)
|
||||||
}
|
}
|
||||||
if (strrchr(outnam, '.') == NULL) strcat(outnam, ".asm"); //if no extension, add ".asm"
|
if (strrchr(outnam, '.') == NULL) strcat(outnam, ".asm"); //if no extension, add ".asm"
|
||||||
DEBUG("Opening Output File '%s'\n", outnam)
|
DEBUG("files.opnout: Opening Output File '%s'\n", outnam)
|
||||||
outfil = fopen(outnam, "w"); //open file
|
outfil = fopen(outnam, "w"); //open file
|
||||||
if (outfil == NULL) extsys(outnam);
|
if (outfil == NULL) extsys(outnam);
|
||||||
}
|
}
|
||||||
@ -64,7 +64,7 @@ void opnlog(void) {
|
|||||||
char *dot = strrchr(lognam, '.'); //find file extension
|
char *dot = strrchr(lognam, '.'); //find file extension
|
||||||
if (dot != NULL) *dot = 0; //and remove it
|
if (dot != NULL) *dot = 0; //and remove it
|
||||||
strcat(lognam, ".log"); //add extension ".log"
|
strcat(lognam, ".log"); //add extension ".log"
|
||||||
DEBUG("Opening Log File '%s'\n", lognam)
|
DEBUG("files.opnlog: Opening Log File '%s'\n", lognam)
|
||||||
logfil = fopen(lognam, "w");
|
logfil = fopen(lognam, "w");
|
||||||
if (logfil == NULL) extsys(lognam);
|
if (logfil == NULL) extsys(lognam);
|
||||||
}
|
}
|
||||||
@ -81,18 +81,18 @@ void opninc(int chksub)
|
|||||||
{
|
{
|
||||||
if (chksub) {
|
if (chksub) {
|
||||||
for (subidx=0; subidx<subcnt; subidx++) {
|
for (subidx=0; subidx<subcnt; subidx++) {
|
||||||
DEBUG("Attempting to open include file '%s'\n", subnam[subidx])
|
DEBUG("files.opninc: Attempting to open include file '%s'\n", subnam[subidx])
|
||||||
incfil = fopen(subnam[subidx], "r");
|
incfil = fopen(subnam[subidx], "r");
|
||||||
if (incfil == NULL) DEBUG("Open failed\n", 0)
|
if (incfil == NULL) DEBUG("files.opninc: Open failed\n", 0)
|
||||||
else {
|
else {
|
||||||
strcpy(incnam, subnam[subidx]);
|
strcpy(incnam, subnam[subidx]);
|
||||||
DEBUG("INCNAM set to '%s'\n", incnam);
|
DEBUG("files.opninc: INCNAM set to '%s'\n", incnam);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG("Opening include file '%s'\n", incnam)
|
DEBUG("files.opninc: Opening include file '%s'\n", incnam)
|
||||||
incfil = fopen(incnam, "r");
|
incfil = fopen(incnam, "r");
|
||||||
if (incfil == NULL) extsys(incnam);
|
if (incfil == NULL) extsys(incnam);
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
/* Read next include file name from Source File *
|
/* Read next include file name from Source File *
|
||||||
* Sets: incnam - the include file name */
|
* Sets: incnam - the include file name */
|
||||||
void pincnm(void) {
|
void pincnm(void) {
|
||||||
DEBUG("Parsing include file name", 0)
|
DEBUG("include.pincnm: Parsing include file name", 0)
|
||||||
char dlmtr;
|
char dlmtr;
|
||||||
int inclen = 0;
|
int inclen = 0;
|
||||||
int sublen[SUBMAX];
|
int sublen[SUBMAX];
|
||||||
@ -54,11 +54,11 @@ void pincnm(void) {
|
|||||||
}
|
}
|
||||||
skpchr(); //skip end dlmtr
|
skpchr(); //skip end dlmtr
|
||||||
incnam[inclen] = 0;
|
incnam[inclen] = 0;
|
||||||
DEBUG("Set INCNAM to '%s'\n", incnam);
|
DEBUG("include.pincnm: Set INCNAM to '%s'\n", incnam);
|
||||||
for (int subidx = 0; subidx < subcnt; subidx++) {
|
for (int subidx = 0; subidx < subcnt; subidx++) {
|
||||||
subnam[subidx][sublen[subidx]] = 0;
|
subnam[subidx][sublen[subidx]] = 0;
|
||||||
DEBUG("Set SUBNAM[%d] ", subidx)
|
DEBUG("include.pincnm: Set SUBNAM[%d] ", subidx)
|
||||||
DEBUG("to '%s'\n", subnam[subidx]);
|
DETAIL("to '%s'\n", subnam[subidx]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ void incasm(int chksub) {
|
|||||||
addcmt(" =======");
|
addcmt(" =======");
|
||||||
cmtlin();
|
cmtlin();
|
||||||
while (fgets(line, sizeof line, incfil) != NULL) {
|
while (fgets(line, sizeof line, incfil) != NULL) {
|
||||||
DEBUG("Writing line: %s", line)
|
DEBUG("include.incasm: Writing line: %s", line)
|
||||||
fputs(line, outfil);
|
fputs(line, outfil);
|
||||||
}
|
}
|
||||||
setcmt("==========================================");
|
setcmt("==========================================");
|
||||||
@ -80,7 +80,7 @@ void incasm(int chksub) {
|
|||||||
|
|
||||||
/* Process define directive */
|
/* Process define directive */
|
||||||
void pdefin(void) {
|
void pdefin(void) {
|
||||||
DEBUG("Processing DEFINE directive\n", 0)
|
DEBUG("include.pdefin: Processing DEFINE directive\n", 0)
|
||||||
getwrd(); //Get constant name
|
getwrd(); //Get constant name
|
||||||
strncpy(defnam, word, CONLEN);
|
strncpy(defnam, word, CONLEN);
|
||||||
addcon(prsbyt()); //Get Value and Add Constant
|
addcon(prsbyt()); //Get Value and Add Constant
|
||||||
@ -89,7 +89,7 @@ void pdefin(void) {
|
|||||||
/* Parse ASCII Subdirective */
|
/* Parse ASCII Subdirective */
|
||||||
void pascii(void) {
|
void pascii(void) {
|
||||||
getwrd(); //Get Subdirective Argument
|
getwrd(); //Get Subdirective Argument
|
||||||
DEBUG("Parsing subdirective '%s'\n", word)
|
DEBUG("include.pascii: Parsing subdirective '%s'\n", word)
|
||||||
if (wordis("INVERT"))
|
if (wordis("INVERT"))
|
||||||
invasc = TRUE;
|
invasc = TRUE;
|
||||||
else if (wordis("HIGH"))
|
else if (wordis("HIGH"))
|
||||||
@ -102,26 +102,26 @@ void pascii(void) {
|
|||||||
void porign(void) {
|
void porign(void) {
|
||||||
prsnum(0xFFFF); //Get Origin Address
|
prsnum(0xFFFF); //Get Origin Address
|
||||||
asmlin(ORGOP, value); //Emit Origin Instruction
|
asmlin(ORGOP, value); //Emit Origin Instruction
|
||||||
DEBUG("Set origin to %s\n", value)
|
DEBUG("include.poirgn: Set origin to %s\n", value)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse Padding Subdirective */
|
/* Parse Padding Subdirective */
|
||||||
void ppddng(void) {
|
void ppddng(void) {
|
||||||
padcnt = prsnum(0xFF); //Get Number of Padding Bytes
|
padcnt = prsnum(0xFF); //Get Number of Padding Bytes
|
||||||
DEBUG("Set padding to %d\n", padcnt)
|
DEBUG("include.ppddng: Set padding to %d\n", padcnt)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse RamBase Subdirective */
|
/* Parse RamBase Subdirective */
|
||||||
void prambs(void) {
|
void prambs(void) {
|
||||||
rambas = prsnum(0xFFFF); //Set Ram Base Address to Literal
|
rambas = prsnum(0xFFFF); //Set Ram Base Address to Literal
|
||||||
DEBUG("Set ram base address to %d\n", rambas)
|
DEBUG("include.prambs: Set ram base address to %d\n", rambas)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse WriteBase Subdirective */
|
/* Parse WriteBase Subdirective */
|
||||||
void pwrtbs(void) {
|
void pwrtbs(void) {
|
||||||
if (!rambas) ERROR("RAM Base must be set prior to Write Base\n", 0, EXIT_FAILURE);
|
if (!rambas) ERROR("RAM Base must be set prior to Write Base\n", 0, EXIT_FAILURE);
|
||||||
wrtbas = prsnum(0xFFFF); //Set Ram Base Address to Literal
|
wrtbas = prsnum(0xFFFF); //Set Ram Base Address to Literal
|
||||||
DEBUG("Set write base address to %d ", wrtbas)
|
DEBUG("include.pwrtbs: Set write base address to %d ", wrtbas)
|
||||||
if (rambas && wrtbas) sprintf(wrtofs, "%+d", wrtbas - rambas);
|
if (rambas && wrtbas) sprintf(wrtofs, "%+d", wrtbas - rambas);
|
||||||
else wrtofs[0] = 0;
|
else wrtofs[0] = 0;
|
||||||
DETAIL("and write offset to '%s'\n", wrtofs)
|
DETAIL("and write offset to '%s'\n", wrtofs)
|
||||||
@ -132,7 +132,7 @@ void pzropg(void) {
|
|||||||
zpgbgn = prsnum(0xFF); //Set Zero Page Address to Literal
|
zpgbgn = prsnum(0xFF); //Set Zero Page Address to Literal
|
||||||
zpgend = prsnum(0xFF); //Set Zero Page Address to Literal
|
zpgend = prsnum(0xFF); //Set Zero Page Address to Literal
|
||||||
zpaddr = zpgbgn;
|
zpaddr = zpgbgn;
|
||||||
DEBUG("Set free zero page to %d ", zpgbgn)
|
DEBUG("include.pzropg: Set free zero page to %d ", zpgbgn)
|
||||||
DETAIL("through %d ", zpgend)
|
DETAIL("through %d ", zpgend)
|
||||||
DETAIL("and zero page address to %d\n", zpaddr)
|
DETAIL("and zero page address to %d\n", zpaddr)
|
||||||
}
|
}
|
||||||
@ -146,7 +146,7 @@ void pvrtbl(void) {
|
|||||||
/* Parse Pragma Directive */
|
/* Parse Pragma Directive */
|
||||||
void pprgma(void) {
|
void pprgma(void) {
|
||||||
getwrd(); //Get Pragma Subdirective
|
getwrd(); //Get Pragma Subdirective
|
||||||
DEBUG("Parsing pragma directive '%s'\n", word)
|
DEBUG("include.pprgma: Parsing pragma directive '%s'\n", word)
|
||||||
if (wordis("ASCII"))
|
if (wordis("ASCII"))
|
||||||
pascii(); //Parse Ascii
|
pascii(); //Parse Ascii
|
||||||
else if (wordis("ORIGIN"))
|
else if (wordis("ORIGIN"))
|
||||||
@ -170,7 +170,7 @@ void pprgma(void) {
|
|||||||
void pincdr(void) {
|
void pincdr(void) {
|
||||||
skpchr(); //skip '#'
|
skpchr(); //skip '#'
|
||||||
getwrd(); //read directive into word
|
getwrd(); //read directive into word
|
||||||
DEBUG("Processing include file directive '%s'\n", word)
|
DEBUG("include.pincdr: Processing include file directive '%s'\n", word)
|
||||||
if (wordis("DEFINE"))
|
if (wordis("DEFINE"))
|
||||||
pdefin();
|
pdefin();
|
||||||
else if (wordis("PRAGMA"))
|
else if (wordis("PRAGMA"))
|
||||||
@ -236,7 +236,7 @@ void inchdr(int chksub) {
|
|||||||
{
|
{
|
||||||
skpspc();
|
skpspc();
|
||||||
if (match(EOF)) break;
|
if (match(EOF)) break;
|
||||||
DEBUG("Checking next character '%c'\n", nxtchr)
|
DEBUG("include.inchdr: Checking next character '%c'\n", nxtchr)
|
||||||
if (match('#'))
|
if (match('#'))
|
||||||
pincdr();
|
pincdr();
|
||||||
else if (match('/'))
|
else if (match('/'))
|
||||||
@ -255,7 +255,7 @@ void inchdr(int chksub) {
|
|||||||
/* Process Header File specified on Command Line */
|
/* Process Header File specified on Command Line */
|
||||||
void phdrfl(void) {
|
void phdrfl(void) {
|
||||||
if (hdrnam[0] == 0) return;
|
if (hdrnam[0] == 0) return;
|
||||||
DEBUG("Processing Header '%s'\n", hdrnam)
|
DEBUG("include.phdrfl: Processing Header '%s'\n", hdrnam)
|
||||||
setinm(".h02");
|
setinm(".h02");
|
||||||
inchdr(TRUE);
|
inchdr(TRUE);
|
||||||
setinm(".a02");
|
setinm(".a02");
|
||||||
@ -265,7 +265,7 @@ void phdrfl(void) {
|
|||||||
/* Process include file */
|
/* Process include file */
|
||||||
void pincfl(void) {
|
void pincfl(void) {
|
||||||
pincnm(); //Parse Include File Name
|
pincnm(); //Parse Include File Name
|
||||||
DEBUG("Processing include file '%s'\n", incnam)
|
DEBUG("include.pincfl: Processing include file '%s'\n", incnam)
|
||||||
char *dot = strrchr(incnam, '.'); //find extension
|
char *dot = strrchr(incnam, '.'); //find extension
|
||||||
if (dot == NULL) {
|
if (dot == NULL) {
|
||||||
ERROR("Invalid include file name '%sn", incnam, EXIT_FAILURE)
|
ERROR("Invalid include file name '%sn", incnam, EXIT_FAILURE)
|
||||||
@ -278,7 +278,7 @@ void pincfl(void) {
|
|||||||
inchdr(TRUE); //Process Header File
|
inchdr(TRUE); //Process Header File
|
||||||
dot = strrchr(incnam, '.'); //find extension
|
dot = strrchr(incnam, '.'); //find extension
|
||||||
strcpy(dot, ".a02");
|
strcpy(dot, ".a02");
|
||||||
DEBUG("INCNAM set to '%s'\n", incnam)
|
DEBUG("include.pincfl: INCNAM set to '%s'\n", incnam)
|
||||||
incasm(FALSE); //Process Assembly File with Same Name
|
incasm(FALSE); //Process Assembly File with Same Name
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -294,8 +294,9 @@ void pdowhl(void) {
|
|||||||
|
|
||||||
/* parse and compile for statement */
|
/* parse and compile for statement */
|
||||||
void pfor(void) {
|
void pfor(void) {
|
||||||
DEBUG("stmnt.pfor: Parsing FOR statement '%c'\n", nxtchr);
|
DEBUG("stmnt.pfor: Parsing FOR statement'\n", 0);
|
||||||
expect('(');
|
expect('(');
|
||||||
|
DEBUG("stmnt.pfor: Parsing Initial Assignment\n", 0);
|
||||||
prsasn(';'); //Process Initial Assignment
|
prsasn(';'); //Process Initial Assignment
|
||||||
newlbl(forlbl); //Create For Loop Conditional Label
|
newlbl(forlbl); //Create For Loop Conditional Label
|
||||||
setlbl(forlbl); //and Set to Emit on Next Line
|
setlbl(forlbl); //and Set to Emit on Next Line
|
||||||
@ -304,9 +305,11 @@ void pfor(void) {
|
|||||||
newlbl(loplbl); //Create Loop Label
|
newlbl(loplbl); //Create Loop Label
|
||||||
pshlbl(LTLOOP, loplbl); //and Push onto Stack
|
pshlbl(LTLOOP, loplbl); //and Push onto Stack
|
||||||
newlbl(cndlbl); //Create Conditional Label
|
newlbl(cndlbl); //Create Conditional Label
|
||||||
|
DEBUG("stmnt.pfor: Parsing Loop Conditional\n", 0);
|
||||||
prscnd(';', TRUE); //Parse Conditional Expession
|
prscnd(';', TRUE); //Parse Conditional Expession
|
||||||
asmlin("JMP", endlbl); //Jump over Increment
|
asmlin("JMP", endlbl); //Jump over Increment
|
||||||
setlbl(loplbl); //Set to Emit on Next Line
|
setlbl(loplbl); //Set to Emit on Next Line
|
||||||
|
DEBUG("stmnt.pfor: Parsing Increment Assignment\n", 0);
|
||||||
prsasn(')'); //Parse Increment Assignment
|
prsasn(')'); //Parse Increment Assignment
|
||||||
asmlin("JMP", forlbl); //Jump to Conditional
|
asmlin("JMP", forlbl); //Jump to Conditional
|
||||||
setlbl(cndlbl); //Emit Label at Start of Loop
|
setlbl(cndlbl); //Emit Label at Start of Loop
|
||||||
@ -383,7 +386,7 @@ void pinlne(void) {
|
|||||||
asmlin(BYTEOP, value);
|
asmlin(BYTEOP, value);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
prslit(0xFF); //Parse Literal
|
prslit(); //Parse Literal
|
||||||
sprintf(word, "$%hhX", litval); //not needed?
|
sprintf(word, "$%hhX", litval); //not needed?
|
||||||
asmlin(BYTEOP, value);
|
asmlin(BYTEOP, value);
|
||||||
}
|
}
|
||||||
|
@ -20,4 +20,5 @@ void endblk(int blkflg); //End Program Block
|
|||||||
void prcasp(char trmntr); //Process Pointer Assignment
|
void prcasp(char trmntr); //Process Pointer Assignment
|
||||||
void prcidx(int idxtyp, char *name, char *index);
|
void prcidx(int idxtyp, char *name, char *index);
|
||||||
void pdowhl(); //Parse and Compile WHILE after DO
|
void pdowhl(); //Parse and Compile WHILE after DO
|
||||||
|
void prssym(); //Parse and Compile Assignment or Function Call
|
||||||
void pstmnt(); //Parse and Compile Program Statement
|
void pstmnt(); //Parse and Compile Program Statement
|
||||||
|
28
src/vars.c
28
src/vars.c
@ -144,7 +144,7 @@ void reqvar(int alwary) {
|
|||||||
* Returns: variable size (as integer */
|
* Returns: variable size (as integer */
|
||||||
int pidxof(void) {
|
int pidxof(void) {
|
||||||
expect('?'); //Check for and Skip SizeOf Operator
|
expect('?'); //Check for and Skip SizeOf Operator
|
||||||
DEBUG("vars.pidxof: Parsing IndexOf operator", 0);
|
DEBUG("vars.pidxof: Parsing IndexOf operator\n", 0);
|
||||||
mbridx = -1; //Set Member Index to None
|
mbridx = -1; //Set Member Index to None
|
||||||
reqvar(FALSE); //Parse Variable Name to get Size Of
|
reqvar(FALSE); //Parse Variable Name to get Size Of
|
||||||
if (mbridx > -1) {
|
if (mbridx > -1) {
|
||||||
@ -160,7 +160,7 @@ int pidxof(void) {
|
|||||||
* Returns: variable size (as integer */
|
* Returns: variable size (as integer */
|
||||||
int psizof(void) {
|
int psizof(void) {
|
||||||
expect('@'); //Check for and Skip SizeOf Operator
|
expect('@'); //Check for and Skip SizeOf Operator
|
||||||
DEBUG("vars.pdizof: Parsing SizeOf operator", 0);
|
DEBUG("vars.psizof: Parsing SizeOf operator\n", 0);
|
||||||
mbridx = -1; //Set Member Index to None
|
mbridx = -1; //Set Member Index to None
|
||||||
reqvar(FALSE); //Parse Variable Name to get Size Of
|
reqvar(FALSE); //Parse Variable Name to get Size Of
|
||||||
if (mbridx > -1) {
|
if (mbridx > -1) {
|
||||||
@ -310,7 +310,8 @@ void addvar(int m, int t) {
|
|||||||
skpchr();
|
skpchr();
|
||||||
if (alcvar) {
|
if (alcvar) {
|
||||||
DEBUG("vars.addvar: Parsing array size\n", 0)
|
DEBUG("vars.addvar: Parsing array size\n", 0)
|
||||||
sprintf(value, "%d", prsnum(0xFF) + 1);
|
prslit();
|
||||||
|
sprintf(value, "%d", litval + 1);
|
||||||
}
|
}
|
||||||
expect(']');
|
expect(']');
|
||||||
}
|
}
|
||||||
@ -400,12 +401,12 @@ void addstc(void) {
|
|||||||
/* Parse Struct Definition *
|
/* Parse Struct Definition *
|
||||||
* Uses: word - Struct Name */
|
* Uses: word - Struct Name */
|
||||||
void defstc(void) {
|
void defstc(void) {
|
||||||
DEBUG("Parsing struct definition\n", 0)
|
DEBUG("vars.defstc: Parsing struct definition\n", 0)
|
||||||
if (fndstc(word)) ERROR("Duplicate Declaration of Struct '%s\n", word,EXIT_FAILURE)
|
if (fndstc(word)) ERROR("Duplicate Declaration of Struct '%s\n", word,EXIT_FAILURE)
|
||||||
int type;
|
int type;
|
||||||
int prnidx = stcidx;
|
int prnidx = stcidx;
|
||||||
strncpy(strct.name, word, STCLEN);
|
strncpy(strct.name, word, STCLEN);
|
||||||
DEBUG("Set struct name to '%s'\n", word);
|
DEBUG("vars.defstc: Set struct name to '%s'\n", word);
|
||||||
strct.size = 0; //Initialize Struct Length
|
strct.size = 0; //Initialize Struct Length
|
||||||
while (look('/')) skpcmt(FALSE); //Skip Comments
|
while (look('/')) skpcmt(FALSE); //Skip Comments
|
||||||
do {
|
do {
|
||||||
@ -434,10 +435,10 @@ void defstc(void) {
|
|||||||
default:
|
default:
|
||||||
ERROR("Invalid Type %s in Struct Definition\n", word, EXIT_FAILURE)
|
ERROR("Invalid Type %s in Struct Definition\n", word, EXIT_FAILURE)
|
||||||
}
|
}
|
||||||
DEBUG("Parsing members of type %s\n", word)
|
DEBUG("vars.defstc: Parsing members of type %s\n", word)
|
||||||
do {
|
do {
|
||||||
getwrd(); //Get Member Name
|
getwrd(); //Get Member Name
|
||||||
DEBUG("Parsing member %s\n", word)
|
DEBUG("vars.defstc: Parsing member %s\n", word)
|
||||||
if (fndmbr(stccnt, word)) ERROR("Duplicate Declaration of Struct Member '%s\n", word,EXIT_FAILURE)
|
if (fndmbr(stccnt, word)) ERROR("Duplicate Declaration of Struct Member '%s\n", word,EXIT_FAILURE)
|
||||||
if (strlen(word) > STMLEN) ERROR("Member Name %s too long\n", word, EXIT_FAILURE)
|
if (strlen(word) > STMLEN) ERROR("Member Name %s too long\n", word, EXIT_FAILURE)
|
||||||
strcpy(membr.name, word); //Set Member Name
|
strcpy(membr.name, word); //Set Member Name
|
||||||
@ -447,18 +448,19 @@ void defstc(void) {
|
|||||||
membr.offset = strct.size; //Set Offset into Struct
|
membr.offset = strct.size; //Set Offset into Struct
|
||||||
membr.size = mbrsiz; //Set Member Size
|
membr.size = mbrsiz; //Set Member Size
|
||||||
if (membr.vartyp == VTCHAR) {
|
if (membr.vartyp == VTCHAR) {
|
||||||
DEBUG("Checking member for array definition\n", 0)
|
DEBUG("vars.defstc: Checking member for array definition\n", 0)
|
||||||
if (match('[')) {
|
if (match('[')) {
|
||||||
CCMNT('[');
|
CCMNT('[');
|
||||||
skpchr();
|
skpchr();
|
||||||
membr.vartyp = VTARRAY;
|
membr.vartyp = VTARRAY;
|
||||||
DEBUG("Parsing member array size\n", 0)
|
DEBUG("vars.defstc: Parsing member array size\n", 0)
|
||||||
membr.size = prsnum(0xFF) + 1;
|
prslit();
|
||||||
|
membr.size = litval + 1;
|
||||||
expect(']');
|
expect(']');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DEBUG("Set member type to %d", membr.vartyp) DETAIL(" and size to %d\n", membr.size);
|
DEBUG("vars.defstc: Set member type to %d", membr.vartyp) DETAIL(" and size to %d\n", membr.size);
|
||||||
DEBUG("Adding member at index %d\n", mbrcnt);
|
DEBUG("vars.defstc: Adding member at index %d\n", mbrcnt);
|
||||||
membrs[mbrcnt++] = membr;
|
membrs[mbrcnt++] = membr;
|
||||||
strct.size += membr.size;
|
strct.size += membr.size;
|
||||||
} while (look(','));
|
} while (look(','));
|
||||||
@ -467,7 +469,7 @@ void defstc(void) {
|
|||||||
} while (!look('}'));
|
} while (!look('}'));
|
||||||
expect(';');
|
expect(';');
|
||||||
if (strct.size > 256) ERROR("Structure Size %d Exceeds Limit of 256 bytes.\n", strct.size, EXIT_FAILURE);
|
if (strct.size > 256) ERROR("Structure Size %d Exceeds Limit of 256 bytes.\n", strct.size, EXIT_FAILURE);
|
||||||
DEBUG("Adding struct with size %d", strct.size) DETAIL("at index %d\n", stccnt);
|
DEBUG("vars.defstc: Adding struct with size %d", strct.size) DETAIL("at index %d\n", stccnt);
|
||||||
strcts[stccnt++] = strct;
|
strcts[stccnt++] = strct;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user