Compare commits

...

2 Commits

Author SHA1 Message Date
Devine Lu Linvega 11d32db150 (uxnasm) Print token during nested macro error 2024-04-03 21:08:17 -07:00
Devine Lu Linvega fc7ae4301c (uxnasm) Only find hex glyph once 2024-04-03 20:58:55 -07:00
1 changed files with 3 additions and 3 deletions

View File

@ -38,7 +38,7 @@ static char ops[][4] = {
};
static int find(char *s, char t) { int i = 0; char c; while((c = *s++)) { if(c == t) return i; i++; } return -1; }
static int shex(char *s) { int n = 0; char c; while((c = *s++)) { if(find(hexad, c) < 0) return -1; n = n << 4, n |= find(hexad, c); } return n; }
static int shex(char *s) { int d, n = 0; char c; while((c = *s++)) { d = find(hexad, c); if(d < 0) return d; n = n << 4, n |= d; } return n; }
static int scmp(char *a, char *b, int len) { int i = 0; while(a[i] == b[i]) if(!a[i] || ++i >= len) return 1; return 0; }
static char *copy(char *src, char *dst, char c) { while(*src && *src != c) *dst++ = *src++; *dst++ = 0; return dst; }
static char *save(char *s, char c) { char *o = dictnext; while((*dictnext++ = *s++) && *s); *dictnext++ = c; return o; }
@ -179,7 +179,7 @@ makemacro(char *name, FILE *f, Context *ctx)
if(c == 0xa) ctx->line++;
while(f && fread(&c, 1, 1, f)) {
if(c == 0xa) ctx->line++;
if(c == '%') return error_top("Macro nested", name);
if(c == '%') return error_asm("Macro nested");
if(c == '{') depth++;
if(c == '}' && --depth) break;
if(c == '(' && !walkcomment(f, ctx))
@ -212,7 +212,7 @@ static int
makeref(char *label, char rune, Uint16 addr, Context *ctx)
{
Item *r;
if(refs_len >= 0x1000) return error_top("References limit exceeded", label);
if(refs_len >= 0x1000) return error_asm("References limit exceeded");
r = &refs[refs_len++];
if(label[0] == '{') {
lambda_stack[lambda_ptr++] = lambda_len;