Browse code

Do no display unused macros anymore

neauoire authored on 28/08/2021 17:30:50
Showing 3 changed files
... ...
@@ -31,10 +31,10 @@ contexts:
31 31
       scope:  entity.name.type.typedef
32 32
       pop: true
33 33
     - match: '\;(\S+)\sLDA2'
34
-      scope:  constant.numeric
34
+      scope:  entity.name.type.typedef
35 35
       pop: true
36 36
     - match: '\;(\S+)\sLDA'
37
-      scope:  constant.numeric
37
+      scope:  entity.name.type.typedef
38 38
       pop: true
39 39
     # set
40 40
     - match: '\.(\S+)\sDEO2'
... ...
@@ -56,10 +56,10 @@ contexts:
56 56
       scope:  constant.numeric
57 57
       pop: true
58 58
     - match: '\;(\S+)\sSTA2'
59
-      scope:  entity.name.type.typedef
59
+      scope:  constant.numeric
60 60
       pop: true
61 61
     - match: '\;(\S+)\sSTA'
62
-      scope:  entity.name.type.typedef
62
+      scope:  constant.numeric
63 63
       pop: true
64 64
 
65 65
     # label
... ...
@@ -70,6 +70,10 @@ contexts:
70 70
     - match: '\&(\S+)\s?'
71 71
       scope: string.control
72 72
       pop: true
73
+    # include
74
+    - match: 'include'
75
+      scope: string.control
76
+      pop: true
73 77
 
74 78
     # jump
75 79
     - match: '\|(\S+)\s?'
... ...
@@ -20,7 +20,6 @@ typedef unsigned short Uint16;
20 20
 typedef struct {
21 21
 	char name[64], items[256][64];
22 22
 	Uint8 len;
23
-	Uint16 refs;
24 23
 } Macro;
25 24
 
26 25
 typedef struct {
... ...
@@ -154,7 +153,7 @@ makemacro(char *name, FILE *f)
154 153
 		return error("Macro duplicate", name);
155 154
 	if(sihx(name) && slen(name) % 2 == 0)
156 155
 		return error("Macro name is hex number", name);
157
-	if(findopcode(name) || scmp(name, "BRK", 4) || !slen(name))
156
+	if(findopcode(name) || scmp(name, "BRK", 4) || !slen(name) || scmp(name,"include",8))
158 157
 		return error("Macro name is invalid", name);
159 158
 	m = &p.macros[p.mlen++];
160 159
 	scpy(name, m->name, 64);
... ...
@@ -280,7 +279,7 @@ parsetoken(char *w)
280 279
 		for(i = 0; i < m->len; ++i)
281 280
 			if(!parsetoken(m->items[i]))
282 281
 				return error("Invalid macro", m->name);
283
-		return ++m->refs;
282
+		return 1;
284 283
 	}
285 284
 	return error("Invalid token", w);
286 285
 }
... ...
@@ -380,9 +379,6 @@ cleanup(char *filename)
380 379
 			continue; /* Ignore capitalized labels(devices) */
381 380
 		else if(!p.labels[i].refs)
382 381
 			fprintf(stderr, "--- Unused label: %s\n", p.labels[i].name);
383
-	for(i = 0; i < p.mlen; ++i)
384
-		if(!p.macros[i].refs)
385
-			fprintf(stderr, "--- Unused macro: %s\n", p.macros[i].name);
386 382
 	printf("Assembled %s(%d bytes), %d labels, %d macros.\n", filename, (p.length - TRIM), p.llen, p.mlen);
387 383
 }
388 384
 
... ...
@@ -112,14 +112,7 @@ redraw(Uxn *u)
112 112
 {
113 113
 	if(devsystem->dat[0xe])
114 114
 		inspect(&ppu, u->wst.dat, u->wst.ptr, u->rst.ptr, u->ram.dat);
115
-	if(rgbaSurface == NULL)
116
-		SDL_BlitScaled(idxSurface, NULL, winSurface, &gRect);
117
-	else if(zoom == 1)
118
-		SDL_BlitSurface(idxSurface, NULL, winSurface, &gRect);
119
-	else {
120
-		SDL_BlitSurface(idxSurface, NULL, rgbaSurface, NULL);
121
-		SDL_BlitScaled(rgbaSurface, NULL, winSurface, &gRect);
122
-	}
115
+	SDL_BlitSurface(idxSurface, NULL, winSurface, &gRect);
123 116
 	SDL_UpdateWindowSurface(gWindow);
124 117
 	reqdraw = 0;
125 118
 }