hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 100734fe5ca7b554fa3efe4e4b262eba7fde5ac6
parent f0abc8189191d6101a6f1b2b090d3d56561fd8be
Author: Ember Sawady <ecs@d2evs.net>
Date:   Wed,  7 Jun 2023 06:32:00 +0000

Get rid of rt/+test/ztos.ha

Signed-off-by: Ember Sawady <ecs@d2evs.net>

Diffstat:
Drt/+test/ztos.ha | 40----------------------------------------
Mscripts/gen-stdlib | 3+--
Mstdlib.mk | 6++----
3 files changed, 3 insertions(+), 46 deletions(-)

diff --git a/rt/+test/ztos.ha b/rt/+test/ztos.ha @@ -1,40 +0,0 @@ -// License: MPL-2.0 -// (c) 2021 Drew DeVault <sir@cmpwn.com> - -fn bytes_reverse(b: []u8) void = { - if (len(b) == 0) { - return; - }; - for (let s = 0z, e = len(b) - 1; s < e) { - let x = b[s]; - b[s] = b[e]; - b[e] = x; - s += 1; - e -= 1; - }; -}; - -fn ztos(u: size) const str = { - static let buf: [20]u8 = [0...]; - buf = [0...]; - - let s = struct { - b: *[*]u8 = &buf, - l: size = 0, - c: size = 0, - }; - - if (u == 0) { - s.b[s.l] = '0'; - s.l += 1; - }; - - for (u > 0) { - s.b[s.l] = '0' + (u % 10): u8; - s.l += 1; - u /= 10; - }; - - bytes_reverse(s.b[..s.l]); - return *(&s: *str); -}; diff --git a/scripts/gen-stdlib b/scripts/gen-stdlib @@ -83,8 +83,7 @@ rt() { gensrcs_rt \ abort+test.ha \ start+test.ha \ - +test/signal_test.ha \ - +test/ztos.ha + +test/signal_test.ha fi gen_ssa -plinux rt gen_ssa -pfreebsd rt diff --git a/stdlib.mk b/stdlib.mk @@ -2423,8 +2423,7 @@ testlib_rt_linux_srcs = \ $(STDLIB)/rt/strcmp.ha \ $(STDLIB)/rt/abort+test.ha \ $(STDLIB)/rt/start+test.ha \ - $(STDLIB)/rt/+test/signal_test.ha \ - $(STDLIB)/rt/+test/ztos.ha + $(STDLIB)/rt/+test/signal_test.ha # rt (+freebsd) testlib_rt_freebsd_srcs = \ @@ -2452,8 +2451,7 @@ testlib_rt_freebsd_srcs = \ $(STDLIB)/rt/strcmp.ha \ $(STDLIB)/rt/abort+test.ha \ $(STDLIB)/rt/start+test.ha \ - $(STDLIB)/rt/+test/signal_test.ha \ - $(STDLIB)/rt/+test/ztos.ha + $(STDLIB)/rt/+test/signal_test.ha $(TESTCACHE)/rt/rt-linux.ssa: $(testlib_rt_linux_srcs) $(testlib_rt) @printf 'HAREC \t$@\n'