0
0
Fork 0
mirror of https://git.sr.ht/~rabbits/uxn synced 2024-11-23 22:35:11 +00:00

Do no display unused macros anymore

This commit is contained in:
neauoire 2021-08-28 10:30:50 -07:00
parent 08f20d35c8
commit 83de614e53
3 changed files with 11 additions and 18 deletions

View file

@ -31,10 +31,10 @@ contexts:
scope: entity.name.type.typedef
pop: true
- match: '\;(\S+)\sLDA2'
scope: constant.numeric
scope: entity.name.type.typedef
pop: true
- match: '\;(\S+)\sLDA'
scope: constant.numeric
scope: entity.name.type.typedef
pop: true
# set
- match: '\.(\S+)\sDEO2'
@ -56,10 +56,10 @@ contexts:
scope: constant.numeric
pop: true
- match: '\;(\S+)\sSTA2'
scope: entity.name.type.typedef
scope: constant.numeric
pop: true
- match: '\;(\S+)\sSTA'
scope: entity.name.type.typedef
scope: constant.numeric
pop: true
# label
@ -70,6 +70,10 @@ contexts:
- match: '\&(\S+)\s?'
scope: string.control
pop: true
# include
- match: 'include'
scope: string.control
pop: true
# jump
- match: '\|(\S+)\s?'

View file

@ -20,7 +20,6 @@ typedef unsigned short Uint16;
typedef struct {
char name[64], items[256][64];
Uint8 len;
Uint16 refs;
} Macro;
typedef struct {
@ -154,7 +153,7 @@ makemacro(char *name, FILE *f)
return error("Macro duplicate", name);
if(sihx(name) && slen(name) % 2 == 0)
return error("Macro name is hex number", name);
if(findopcode(name) || scmp(name, "BRK", 4) || !slen(name))
if(findopcode(name) || scmp(name, "BRK", 4) || !slen(name) || scmp(name,"include",8))
return error("Macro name is invalid", name);
m = &p.macros[p.mlen++];
scpy(name, m->name, 64);
@ -280,7 +279,7 @@ parsetoken(char *w)
for(i = 0; i < m->len; ++i)
if(!parsetoken(m->items[i]))
return error("Invalid macro", m->name);
return ++m->refs;
return 1;
}
return error("Invalid token", w);
}
@ -380,9 +379,6 @@ cleanup(char *filename)
continue; /* Ignore capitalized labels(devices) */
else if(!p.labels[i].refs)
fprintf(stderr, "--- Unused label: %s\n", p.labels[i].name);
for(i = 0; i < p.mlen; ++i)
if(!p.macros[i].refs)
fprintf(stderr, "--- Unused macro: %s\n", p.macros[i].name);
printf("Assembled %s(%d bytes), %d labels, %d macros.\n", filename, (p.length - TRIM), p.llen, p.mlen);
}

View file

@ -112,14 +112,7 @@ redraw(Uxn *u)
{
if(devsystem->dat[0xe])
inspect(&ppu, u->wst.dat, u->wst.ptr, u->rst.ptr, u->ram.dat);
if(rgbaSurface == NULL)
SDL_BlitScaled(idxSurface, NULL, winSurface, &gRect);
else if(zoom == 1)
SDL_BlitSurface(idxSurface, NULL, winSurface, &gRect);
else {
SDL_BlitSurface(idxSurface, NULL, rgbaSurface, NULL);
SDL_BlitScaled(rgbaSurface, NULL, winSurface, &gRect);
}
SDL_BlitSurface(idxSurface, NULL, winSurface, &gRect);
SDL_UpdateWindowSurface(gWindow);
reqdraw = 0;
}