hare

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

commit c6fb576d6457ff6f30d41df911c25b828a3a1fa0
parent 9e7aeebbf63677da4bffefcca5fb4dbded521937
Author: Andri Yngvason <andri@yngvason.is>
Date:   Fri,  5 Feb 2021 00:40:42 +0000

gen-stdlib: add strconv::stou

Diffstat:
Mgen-stdlib | 22+++++++++++++++++-----
Mmk/stdlib.mk | 63+++++++++++++++++++++++++++++++++------------------------------
2 files changed, 50 insertions(+), 35 deletions(-)

diff --git a/gen-stdlib b/gen-stdlib @@ -115,13 +115,25 @@ types() { gen_lib types } -strconv() { - printf '# strconv\n' +gensrcs_strconv() { gen_srcs strconv \ itos.ha \ utos.ha \ - numeric.ha - gen_ssa strconv types + stou.ha \ + numeric.ha \ + $* +} + +strconv() { + printf '# strconv\n' + if [ $testing -eq 0 ] + then + gensrcs_strconv + else + gensrcs_strconv \ + stou+test.ha + fi + gen_ssa strconv types strings ascii gen_lib strconv } @@ -203,10 +215,10 @@ stdlib() { ascii bytes types - strconv io encoding_utf8 strings + strconv os fmt } diff --git a/mk/stdlib.mk b/mk/stdlib.mk @@ -101,21 +101,6 @@ $(HARECACHE)/types/types.ssa: $(stdlib_types_srcs) $(stdlib_rt) stdlib_stdlib_types=$(HARECACHE)/types/types.o hare_stdlib_deps+=$(stdlib_stdlib_types) -# strconv -stdlib_strconv_srcs= \ - $(STDLIB)/strconv/itos.ha \ - $(STDLIB)/strconv/utos.ha \ - $(STDLIB)/strconv/numeric.ha - -$(HARECACHE)/strconv/strconv.ssa: $(stdlib_strconv_srcs) $(stdlib_rt) $(stdlib_stdlib_types) - @printf 'HAREC \t$@\n' - @mkdir -p $(HARECACHE)/strconv - @HARECACHE=$(HARECACHE) $(HAREC) $(HAREFLAGS) -o $@ -Nstrconv \ - -t$(HARECACHE)/strconv/strconv.td $(stdlib_strconv_srcs) - -stdlib_stdlib_strconv=$(HARECACHE)/strconv/strconv.o -hare_stdlib_deps+=$(stdlib_stdlib_strconv) - # io stdlib_io_srcs= \ $(STDLIB)/io/arch$(ARCH).ha \ @@ -164,6 +149,22 @@ $(HARECACHE)/strings/strings.ssa: $(stdlib_strings_srcs) $(stdlib_rt) $(stdlib_s stdlib_stdlib_strings=$(HARECACHE)/strings/strings.o hare_stdlib_deps+=$(stdlib_stdlib_strings) +# strconv +stdlib_strconv_srcs= \ + $(STDLIB)/strconv/itos.ha \ + $(STDLIB)/strconv/utos.ha \ + $(STDLIB)/strconv/stou.ha \ + $(STDLIB)/strconv/numeric.ha + +$(HARECACHE)/strconv/strconv.ssa: $(stdlib_strconv_srcs) $(stdlib_rt) $(stdlib_stdlib_types) $(stdlib_stdlib_strings) $(stdlib_stdlib_ascii) + @printf 'HAREC \t$@\n' + @mkdir -p $(HARECACHE)/strconv + @HARECACHE=$(HARECACHE) $(HAREC) $(HAREFLAGS) -o $@ -Nstrconv \ + -t$(HARECACHE)/strconv/strconv.td $(stdlib_strconv_srcs) + +stdlib_stdlib_strconv=$(HARECACHE)/strconv/strconv.o +hare_stdlib_deps+=$(stdlib_stdlib_strconv) + # os stdlib_os_srcs= \ $(STDLIB)/os/$(PLATFORM)/environ.ha \ @@ -298,21 +299,6 @@ $(TESTCACHE)/types/types.ssa: $(testlib_types_srcs) $(testlib_rt) testlib_testlib_types=$(TESTCACHE)/types/types.o hare_testlib_deps+=$(testlib_testlib_types) -# strconv -testlib_strconv_srcs= \ - $(STDLIB)/strconv/itos.ha \ - $(STDLIB)/strconv/utos.ha \ - $(STDLIB)/strconv/numeric.ha - -$(TESTCACHE)/strconv/strconv.ssa: $(testlib_strconv_srcs) $(testlib_rt) $(testlib_testlib_types) - @printf 'HAREC \t$@\n' - @mkdir -p $(TESTCACHE)/strconv - @HARECACHE=$(TESTCACHE) $(HAREC) $(TESTHAREFLAGS) -o $@ -Nstrconv \ - -t$(TESTCACHE)/strconv/strconv.td $(testlib_strconv_srcs) - -testlib_testlib_strconv=$(TESTCACHE)/strconv/strconv.o -hare_testlib_deps+=$(testlib_testlib_strconv) - # io testlib_io_srcs= \ $(STDLIB)/io/arch$(ARCH).ha \ @@ -362,6 +348,23 @@ $(TESTCACHE)/strings/strings.ssa: $(testlib_strings_srcs) $(testlib_rt) $(testli testlib_testlib_strings=$(TESTCACHE)/strings/strings.o hare_testlib_deps+=$(testlib_testlib_strings) +# strconv +testlib_strconv_srcs= \ + $(STDLIB)/strconv/itos.ha \ + $(STDLIB)/strconv/utos.ha \ + $(STDLIB)/strconv/stou.ha \ + $(STDLIB)/strconv/numeric.ha \ + $(STDLIB)/strconv/stou+test.ha + +$(TESTCACHE)/strconv/strconv.ssa: $(testlib_strconv_srcs) $(testlib_rt) $(testlib_testlib_types) $(testlib_testlib_strings) $(testlib_testlib_ascii) + @printf 'HAREC \t$@\n' + @mkdir -p $(TESTCACHE)/strconv + @HARECACHE=$(TESTCACHE) $(HAREC) $(TESTHAREFLAGS) -o $@ -Nstrconv \ + -t$(TESTCACHE)/strconv/strconv.td $(testlib_strconv_srcs) + +testlib_testlib_strconv=$(TESTCACHE)/strconv/strconv.o +hare_testlib_deps+=$(testlib_testlib_strconv) + # os testlib_os_srcs= \ $(STDLIB)/os/$(PLATFORM)/environ.ha \