commit 6c5473fdf2e858dcb987bd3d0e04c7cb320ce92d
parent 231533f3c9434fdfa183fdd7dddcb741d6e6d84c
Author: Drew DeVault <sir@cmpwn.com>
Date: Fri, 26 Feb 2021 15:00:04 -0500
stdlib: add encoding::hex
Diffstat:
2 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/gen-stdlib b/gen-stdlib
@@ -155,6 +155,13 @@ crypto_sha256() {
fi
}
+encoding_hex() {
+ printf '# encoding::hex\n'
+ gen_srcs encoding::hex \
+ hex.ha
+ gen_ssa encoding::hex io strconv strio strings
+}
+
encoding_utf8() {
# XXX: Also has ordering issues
printf '# encoding::utf8\n'
@@ -416,6 +423,7 @@ bytes
crypto_math
crypto_random
crypto_sha256
+encoding_hex
encoding_utf8
endian
fmt
diff --git a/mk/stdlib.mk b/mk/stdlib.mk
@@ -78,6 +78,9 @@ hare_stdlib_deps+=$(stdlib_crypto_random)
stdlib_crypto_sha256=$(HARECACHE)/crypto/sha256/crypto.sha256.o
hare_stdlib_deps+=$(stdlib_crypto_sha256)
+stdlib_encoding_hex=$(HARECACHE)/encoding/hex/encoding.hex.o
+hare_stdlib_deps+=$(stdlib_encoding_hex)
+
stdlib_encoding_utf8=$(HARECACHE)/encoding/utf8/encoding.utf8.o
hare_stdlib_deps+=$(stdlib_encoding_utf8)
@@ -206,6 +209,16 @@ $(HARECACHE)/crypto/sha256/crypto.sha256.ssa: $(stdlib_crypto_sha256_srcs) $(std
@HARECACHE=$(HARECACHE) $(HAREC) $(HAREFLAGS) -o $@ -Ncrypto::sha256 \
-t$(HARECACHE)/crypto/sha256/crypto.sha256.td $(stdlib_crypto_sha256_srcs)
+# encoding::hex
+stdlib_encoding_hex_srcs= \
+ $(STDLIB)/encoding/hex/hex.ha
+
+$(HARECACHE)/encoding/hex/encoding.hex.ssa: $(stdlib_encoding_hex_srcs) $(stdlib_rt) $(stdlib_io) $(stdlib_strconv) $(stdlib_strio) $(stdlib_strings)
+ @printf 'HAREC \t$@\n'
+ @mkdir -p $(HARECACHE)/encoding/hex
+ @HARECACHE=$(HARECACHE) $(HAREC) $(HAREFLAGS) -o $@ -Nencoding::hex \
+ -t$(HARECACHE)/encoding/hex/encoding.hex.td $(stdlib_encoding_hex_srcs)
+
# encoding::utf8
stdlib_encoding_utf8_srcs= \
$(STDLIB)/encoding/utf8/rune.ha \
@@ -530,6 +543,9 @@ hare_testlib_deps+=$(testlib_crypto_random)
testlib_crypto_sha256=$(TESTCACHE)/crypto/sha256/crypto.sha256.o
hare_testlib_deps+=$(testlib_crypto_sha256)
+testlib_encoding_hex=$(TESTCACHE)/encoding/hex/encoding.hex.o
+hare_testlib_deps+=$(testlib_encoding_hex)
+
testlib_encoding_utf8=$(TESTCACHE)/encoding/utf8/encoding.utf8.o
hare_testlib_deps+=$(testlib_encoding_utf8)
@@ -659,6 +675,16 @@ $(TESTCACHE)/crypto/sha256/crypto.sha256.ssa: $(testlib_crypto_sha256_srcs) $(te
@HARECACHE=$(TESTCACHE) $(HAREC) $(TESTHAREFLAGS) -o $@ -Ncrypto::sha256 \
-t$(TESTCACHE)/crypto/sha256/crypto.sha256.td $(testlib_crypto_sha256_srcs)
+# encoding::hex
+testlib_encoding_hex_srcs= \
+ $(STDLIB)/encoding/hex/hex.ha
+
+$(TESTCACHE)/encoding/hex/encoding.hex.ssa: $(testlib_encoding_hex_srcs) $(testlib_rt) $(testlib_io) $(testlib_strconv) $(testlib_strio) $(testlib_strings)
+ @printf 'HAREC \t$@\n'
+ @mkdir -p $(TESTCACHE)/encoding/hex
+ @HARECACHE=$(TESTCACHE) $(HAREC) $(TESTHAREFLAGS) -o $@ -Nencoding::hex \
+ -t$(TESTCACHE)/encoding/hex/encoding.hex.td $(testlib_encoding_hex_srcs)
+
# encoding::utf8
testlib_encoding_utf8_srcs= \
$(STDLIB)/encoding/utf8/rune.ha \