(uxnasm) Count line number during macros
This commit is contained in:
parent
59b7ee83c5
commit
f50e915e42
18
src/uxnasm.c
18
src/uxnasm.c
|
@ -116,7 +116,7 @@ static int
|
||||||
makemacro(char *name, FILE *f)
|
makemacro(char *name, FILE *f)
|
||||||
{
|
{
|
||||||
Item *m;
|
Item *m;
|
||||||
char word[0x40];
|
char c, word[0x40];
|
||||||
if(!slen(name)) return error_asm("Macro is empty");
|
if(!slen(name)) return error_asm("Macro is empty");
|
||||||
if(findmacro(name)) return error_asm("Macro is duplicate");
|
if(findmacro(name)) return error_asm("Macro is duplicate");
|
||||||
if(sihx(name)) return error_asm("Macro is hex number");
|
if(sihx(name)) return error_asm("Macro is hex number");
|
||||||
|
@ -125,15 +125,13 @@ makemacro(char *name, FILE *f)
|
||||||
m = ¯os[macro_len++];
|
m = ¯os[macro_len++];
|
||||||
m->name = push(name, 0);
|
m->name = push(name, 0);
|
||||||
m->content = dictnext;
|
m->content = dictnext;
|
||||||
while(fscanf(f, "%63s", word) == 1) {
|
while(fread(&c, 1, 1, f) && c != '{')
|
||||||
if(word[0] == '{') continue;
|
if(c == 0xa) line++;
|
||||||
if(word[0] == '}') break;
|
while(fread(&c, 1, 1, f) && c != '}') {
|
||||||
if(word[0] == '%') return error_asm("Macro error");
|
if(c == 0xa) line++;
|
||||||
if(word[0] == '(') {
|
if(c == '%') return 0;
|
||||||
if(!walkcomment(f)) return error_asm("Comment error");
|
if(c == '(') walkcomment(f);
|
||||||
continue;
|
*dictnext++ = c;
|
||||||
}
|
|
||||||
push(word, ' ');
|
|
||||||
}
|
}
|
||||||
*dictnext++ = 0;
|
*dictnext++ = 0;
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in New Issue