mirror of
https://github.com/RevCurtisP/C02.git
synced 2024-11-29 01:49:19 +00:00
Added ENUM directive
This commit is contained in:
parent
709f465860
commit
792c67507f
2
c02.c
2
c02.c
@ -72,6 +72,8 @@ void pdrctv()
|
|||||||
DEBUG("Processing directive '%s'\n", word);
|
DEBUG("Processing directive '%s'\n", word);
|
||||||
if (wordis("DEFINE"))
|
if (wordis("DEFINE"))
|
||||||
pdefin(); //Parse Define
|
pdefin(); //Parse Define
|
||||||
|
else if (wordis("ENUM"))
|
||||||
|
penumd(); //Parse Enum Directive
|
||||||
else if (wordis("INCLUDE"))
|
else if (wordis("INCLUDE"))
|
||||||
pincfl(); //Parse Include File
|
pincfl(); //Parse Include File
|
||||||
else if (wordis("ERROR")) {
|
else if (wordis("ERROR")) {
|
||||||
|
19
include.c
19
include.c
@ -72,6 +72,23 @@ void pdefin()
|
|||||||
DEBUG("Defined as '%s'\n", value);
|
DEBUG("Defined as '%s'\n", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Process enum directive */
|
||||||
|
void penumd()
|
||||||
|
{
|
||||||
|
int enmval = 0;
|
||||||
|
do {
|
||||||
|
getwrd(); //get defined identifier
|
||||||
|
DEBUG("Enumerating '%s'\n", word);
|
||||||
|
strncpy(defnam[defcnt], word, VARLEN);
|
||||||
|
setlbl(word); //Set label Assembler Line
|
||||||
|
defval[defcnt++] = enmval; //Set Value
|
||||||
|
sprintf(value, "%d", enmval);
|
||||||
|
asmlin(EQUOP, value); //Write Definition
|
||||||
|
DEBUG("Defined as '%s'\n", value);
|
||||||
|
enmval++;
|
||||||
|
} while (look(','));
|
||||||
|
}
|
||||||
|
|
||||||
/* Parse ASCII Subdirective */
|
/* Parse ASCII Subdirective */
|
||||||
void pascii()
|
void pascii()
|
||||||
{
|
{
|
||||||
@ -135,7 +152,7 @@ void pincdr()
|
|||||||
DEBUG("Processing include file directive '%s'\n", word);
|
DEBUG("Processing include file directive '%s'\n", word);
|
||||||
if (wordis("DEFINE"))
|
if (wordis("DEFINE"))
|
||||||
pdefin();
|
pdefin();
|
||||||
if (wordis("PRAGMA"))
|
else if (wordis("PRAGMA"))
|
||||||
pprgma();
|
pprgma();
|
||||||
else {
|
else {
|
||||||
fprintf(stderr, "Unrecognized directive '%s'\n", word);
|
fprintf(stderr, "Unrecognized directive '%s'\n", word);
|
||||||
|
Loading…
Reference in New Issue
Block a user