uxn

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

commit ddd3a46156ebc9fc757d4dbe62871f49760017be
parent b66d3f26123e6512bf4d1f1ea3310c2af2a5a1a2
Author: neauoire <aliceffekt@gmail.com>
Date:   Tue, 15 Aug 2023 18:47:34 -0700

Standardized main() in uxncli and uxnemu

Diffstat:
Msrc/uxncli.c | 18++++++++++++------
Msrc/uxnemu.c | 2+-
2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/uxncli.c b/src/uxncli.c @@ -41,7 +41,17 @@ emu_deo(Uxn *u, Uint8 addr) } } -int +static void +emu_run(Uxn *u) +{ + while(!u->dev[0x0f]) { + int c = fgetc(stdin); + if(c == EOF) break; + console_input(u, (Uint8)c, CONSOLE_STD); + } +} + +static int emu_end(Uxn *u) { free(u->ram); @@ -70,11 +80,7 @@ main(int argc, char **argv) u.dev[0x17] = argc - i; if(uxn_eval(&u, PAGE_PROGRAM)) { console_listen(&u, i, argc, argv); - while(!u.dev[0x0f]) { - int c = fgetc(stdin); - if(c == EOF) break; - console_input(&u, (Uint8)c, CONSOLE_STD); - } + emu_run(&u); } return emu_end(&u); } diff --git a/src/uxnemu.c b/src/uxnemu.c @@ -517,7 +517,7 @@ emu_run(Uxn *u, char *rom) } } -int +static int emu_end(Uxn *u) { #ifdef _WIN32