uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit 78c428d215655d6b2f787a6f76b3d17a293c252b
parent ac60a33f39a69ae8e3828401dd6b584fed1e8901
Author: neauoire <aliceffekt@gmail.com>
Date:   Thu, 17 Jun 2021 17:41:55 -0700

Improved uxnasm error report

Diffstat:
Msrc/uxnasm.c | 8++++----
Msrc/uxnemu.c | 3++-
2 files changed, 6 insertions(+), 5 deletions(-)

diff --git 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 @@ -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);