From d008cfc764ab8b528df1377fde1eb2e158d71d1c Mon Sep 17 00:00:00 2001 From: crc <> Date: Wed, 18 Sep 2024 14:08:43 +0000 Subject: [PATCH] nga-c: begin implementing utf32 string functions FossilOrigin-Name: 1761bf66ecc7107bf82d04486c8192c3278b727746e07c4b3cf31dd2a22e5fa4 --- vm/nga-c/retro.c | 2 ++ vm/nga-c/utf32.c | 5 +++++ 2 files changed, 7 insertions(+) create mode 100644 vm/nga-c/utf32.c diff --git a/vm/nga-c/retro.c b/vm/nga-c/retro.c index ed85655..11a12d1 100644 --- a/vm/nga-c/retro.c +++ b/vm/nga-c/retro.c @@ -29,6 +29,8 @@ #include "config.h" #include "devices.h" +#include "utf32.c" + #define ACTIVE vm->cpu[vm->active] #define TIB vm->memory[7] #define TIB_END vm->memory[8] diff --git a/vm/nga-c/utf32.c b/vm/nga-c/utf32.c new file mode 100644 index 0000000..0571401 --- /dev/null +++ b/vm/nga-c/utf32.c @@ -0,0 +1,5 @@ +int utf32_length(int *s, int max) { + int l = 0; + while (*s++ != 0 && l < max) l++; + return l; +}