mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-11-24 06:45:11 +00:00
uxnasm errors-out if too many macros
This commit is contained in:
parent
a373939544
commit
33e77e261c
1 changed files with 6 additions and 3 deletions
|
@ -15,6 +15,7 @@ WITH REGARD TO THIS SOFTWARE.
|
|||
#define LENGTH 0x10000
|
||||
|
||||
#define LABELS 512
|
||||
#define MACROS 256
|
||||
|
||||
typedef unsigned char Uint8;
|
||||
typedef signed char Sint8;
|
||||
|
@ -31,10 +32,10 @@ typedef struct {
|
|||
} Label;
|
||||
|
||||
typedef struct {
|
||||
Uint8 data[LENGTH], mlen;
|
||||
Uint16 ptr, length, llen;
|
||||
Uint8 data[LENGTH];
|
||||
Uint16 ptr, length, llen, mlen;
|
||||
Label labels[LABELS];
|
||||
Macro macros[256];
|
||||
Macro macros[MACROS];
|
||||
} Program;
|
||||
|
||||
Program p;
|
||||
|
@ -158,6 +159,8 @@ makemacro(char *name, FILE *f)
|
|||
return error("Macro name is hex number", name);
|
||||
if(findopcode(name) || scmp(name, "BRK", 4) || !slen(name) || scmp(name, "include", 8))
|
||||
return error("Macro name is invalid", name);
|
||||
if(p.mlen == MACROS)
|
||||
return error("Too many macros", name);
|
||||
m = &p.macros[p.mlen++];
|
||||
scpy(name, m->name, 64);
|
||||
while(fscanf(f, "%63s", word) == 1) {
|
||||
|
|
Loading…
Reference in a new issue