uxn

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

commit c37831749f669b1736f93c2fa6dceb4f6a65e3de
parent c827fdc960383130114116892741ed4853261452
Author: Andrew Alderwick <andrew@alderwick.co.uk>
Date:   Wed,  5 Jan 2022 12:59:22 +0000

Split uxn_halt into beginnings of System device file.

Diffstat:
Mbuild.sh | 5+++--
Asrc/devices/system.c | 23+++++++++++++++++++++++
Msrc/uxncli.c | 9---------
Msrc/uxnemu.c | 9---------
4 files changed, 26 insertions(+), 20 deletions(-)

diff --git a/build.sh b/build.sh @@ -14,6 +14,7 @@ then echo "Formatting.." clang-format -i src/uxn.h clang-format -i src/uxn.c + clang-format -i src/devices/system.c clang-format -i src/devices/screen.h clang-format -i src/devices/screen.c clang-format -i src/devices/audio.h @@ -62,8 +63,8 @@ fi echo "Building.." ${CC} ${CFLAGS} src/uxnasm.c -o bin/uxnasm -${CC} ${CFLAGS} ${CORE} src/devices/file.c src/devices/mouse.c src/devices/controller.c src/devices/screen.c src/devices/audio.c src/uxnemu.c ${UXNEMU_LDFLAGS} -o bin/uxnemu -${CC} ${CFLAGS} ${CORE} src/devices/file.c src/uxncli.c -o bin/uxncli +${CC} ${CFLAGS} ${CORE} src/devices/system.c src/devices/file.c src/devices/mouse.c src/devices/controller.c src/devices/screen.c src/devices/audio.c src/uxnemu.c ${UXNEMU_LDFLAGS} -o bin/uxnemu +${CC} ${CFLAGS} ${CORE} src/devices/system.c src/devices/file.c src/uxncli.c -o bin/uxncli if [ -d "$HOME/bin" ] then diff --git a/src/devices/system.c b/src/devices/system.c @@ -0,0 +1,23 @@ +#include "../uxn.h" + +#include <stdio.h> + +/* +Copyright (c) 2022 Devine Lu Linvega, Andrew Alderwick + +Permission to use, copy, modify, and distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE. +*/ + +static const char *errors[] = {"underflow", "overflow", "division by zero"}; + +int +uxn_halt(Uxn *u, Uint8 error, char *name, Uint16 addr) +{ + fprintf(stderr, "Halted: %s %s#%04x, at 0x%04x\n", name, errors[error - 1], u->ram[addr], addr); + return 0; +} diff --git a/src/uxncli.c b/src/uxncli.c @@ -115,15 +115,6 @@ nil_deo(Device *d, Uint8 port) #pragma mark - Generics -static const char *errors[] = {"underflow", "overflow", "division by zero"}; - -int -uxn_halt(Uxn *u, Uint8 error, char *name, Uint16 addr) -{ - fprintf(stderr, "Halted: %s %s#%04x, at 0x%04x\n", name, errors[error - 1], u->ram[addr], addr); - return 0; -} - static int console_input(Uxn *u, char c) { diff --git a/src/uxnemu.c b/src/uxnemu.c @@ -410,15 +410,6 @@ do_shortcut(Uxn *u, SDL_Event *event) restart(u); } -static const char *errors[] = {"underflow", "overflow", "division by zero"}; - -int -uxn_halt(Uxn *u, Uint8 error, char *name, Uint16 addr) -{ - fprintf(stderr, "Halted: %s %s#%04x, at 0x%04x\n", name, errors[error - 1], u->ram[addr], addr); - return 0; -} - static int console_input(Uxn *u, char c) {