uxnasm errors-out if too many macros
This commit is contained in:
parent
a373939544
commit
33e77e261c
|
@ -15,6 +15,7 @@ WITH REGARD TO THIS SOFTWARE.
|
||||||
#define LENGTH 0x10000
|
#define LENGTH 0x10000
|
||||||
|
|
||||||
#define LABELS 512
|
#define LABELS 512
|
||||||
|
#define MACROS 256
|
||||||
|
|
||||||
typedef unsigned char Uint8;
|
typedef unsigned char Uint8;
|
||||||
typedef signed char Sint8;
|
typedef signed char Sint8;
|
||||||
|
@ -31,10 +32,10 @@ typedef struct {
|
||||||
} Label;
|
} Label;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Uint8 data[LENGTH], mlen;
|
Uint8 data[LENGTH];
|
||||||
Uint16 ptr, length, llen;
|
Uint16 ptr, length, llen, mlen;
|
||||||
Label labels[LABELS];
|
Label labels[LABELS];
|
||||||
Macro macros[256];
|
Macro macros[MACROS];
|
||||||
} Program;
|
} Program;
|
||||||
|
|
||||||
Program p;
|
Program p;
|
||||||
|
@ -158,6 +159,8 @@ makemacro(char *name, FILE *f)
|
||||||
return error("Macro name is hex number", name);
|
return error("Macro name is hex number", name);
|
||||||
if(findopcode(name) || scmp(name, "BRK", 4) || !slen(name) || scmp(name, "include", 8))
|
if(findopcode(name) || scmp(name, "BRK", 4) || !slen(name) || scmp(name, "include", 8))
|
||||||
return error("Macro name is invalid", name);
|
return error("Macro name is invalid", name);
|
||||||
|
if(p.mlen == MACROS)
|
||||||
|
return error("Too many macros", name);
|
||||||
m = &p.macros[p.mlen++];
|
m = &p.macros[p.mlen++];
|
||||||
scpy(name, m->name, 64);
|
scpy(name, m->name, 64);
|
||||||
while(fscanf(f, "%63s", word) == 1) {
|
while(fscanf(f, "%63s", word) == 1) {
|
||||||
|
|
Loading…
Reference in New Issue