Browse code

Improved uxnasm error report

neauoire authored on 18/06/2021 00:41:55
Showing 2 changed files
... ...
@@ -18,7 +18,7 @@ typedef signed char Sint8;
18 18
 typedef unsigned short Uint16;
19 19
 
20 20
 typedef struct {
21
-	char name[64], items[64][64];
21
+	char name[64], items[128][64];
22 22
 	Uint8 len, refs;
23 23
 } Macro;
24 24
 
... ...
@@ -267,7 +267,7 @@ parsetoken(char *w)
267 267
 		else if(sihx(w + 1) && slen(w + 1) == 4)
268 268
 			pushshort(shex(w + 1), 1);
269 269
 		else
270
-			return 0;
270
+			return error("Invalid hexadecimal literal", w);
271 271
 		return 1;
272 272
 	} else if(sihx(w)) { /* raw */
273 273
 		if(slen(w) == 2)
... ...
@@ -281,10 +281,10 @@ parsetoken(char *w)
281 281
 		int i;
282 282
 		for(i = 0; i < m->len; ++i)
283 283
 			if(!parsetoken(m->items[i]))
284
-				return 0;
284
+				return error("Invalid macro", m->name);
285 285
 		return ++m->refs;
286 286
 	}
287
-	return 0;
287
+	return error("Invalid token", w);
288 288
 }
289 289
 
290 290
 int
... ...
@@ -89,8 +89,9 @@ screencapture(void)
89 89
 {
90 90
 	const Uint32 format = SDL_PIXELFORMAT_ARGB8888;
91 91
 	int w, h;
92
+	SDL_Surface *surface;
92 93
 	SDL_GetRendererOutputSize(gRenderer, &w, &h);
93
-	SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormat(0, w, h, 32, format);
94
+	surface = SDL_CreateRGBSurfaceWithFormat(0, w, h, 32, format);
94 95
 	SDL_RenderReadPixels(gRenderer, NULL, format, surface->pixels, surface->pitch);
95 96
 	SDL_SaveBMP(surface, "screenshot.bmp");
96 97
 	SDL_FreeSurface(surface);