From 78c428d215655d6b2f787a6f76b3d17a293c252b Mon Sep 17 00:00:00 2001 From: neauoire Date: Thu, 17 Jun 2021 17:41:55 -0700 Subject: [PATCH] Improved uxnasm error report --- src/uxnasm.c | 8 ++++---- src/uxnemu.c | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/uxnasm.c b/src/uxnasm.c index ae0c770..2d3c1d4 100644 --- a/src/uxnasm.c +++ b/src/uxnasm.c @@ -18,7 +18,7 @@ typedef signed char Sint8; typedef unsigned short Uint16; typedef struct { - char name[64], items[64][64]; + char name[64], items[128][64]; Uint8 len, refs; } Macro; @@ -267,7 +267,7 @@ parsetoken(char *w) else if(sihx(w + 1) && slen(w + 1) == 4) pushshort(shex(w + 1), 1); else - return 0; + return error("Invalid hexadecimal literal", w); return 1; } else if(sihx(w)) { /* raw */ if(slen(w) == 2) @@ -281,10 +281,10 @@ parsetoken(char *w) int i; for(i = 0; i < m->len; ++i) if(!parsetoken(m->items[i])) - return 0; + return error("Invalid macro", m->name); return ++m->refs; } - return 0; + return error("Invalid token", w); } int diff --git a/src/uxnemu.c b/src/uxnemu.c index 0253d15..0b26c7f 100644 --- a/src/uxnemu.c +++ b/src/uxnemu.c @@ -89,8 +89,9 @@ screencapture(void) { const Uint32 format = SDL_PIXELFORMAT_ARGB8888; int w, h; + SDL_Surface *surface; SDL_GetRendererOutputSize(gRenderer, &w, &h); - SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormat(0, w, h, 32, format); + surface = SDL_CreateRGBSurfaceWithFormat(0, w, h, 32, format); SDL_RenderReadPixels(gRenderer, NULL, format, surface->pixels, surface->pitch); SDL_SaveBMP(surface, "screenshot.bmp"); SDL_FreeSurface(surface);