commit b33c4d843e81fd7add47ddb1328a0496769ffdf0
parent 7f74585446ce1c5c464cf97dcefcfe0827274694
Author: Drew DeVault <sir@cmpwn.com>
Date: Sun, 31 Jan 2021 10:35:41 -0500
stdlib: update bytes, strings, os
Diffstat:
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/main.ha b/main.ha
@@ -2,8 +2,12 @@ use io;
use os;
export fn main() void = {
- io::println("Hello, world!");
- for (let i = 0z; i < len(os::args); i += 1z) {
- io::println(os::args[i]);
+ if (len(os::args) < 2z) {
+ return;
+ };
+
+ match (os::getenv(os::args[1])) {
+ void => io::println("variable unset"),
+ var: str => io::println(var),
};
};
diff --git a/stdlib.mk b/stdlib.mk
@@ -35,6 +35,8 @@ stdlib_start=$(HARECACHE)/rt/start.o
# bytes
libbytes_srcs=\
+ $(STDLIB)/bytes/equal.ha \
+ $(STDLIB)/bytes/index.ha \
$(STDLIB)/bytes/reverse.ha
$(HARECACHE)/bytes/bytes.ssa: $(libbytes_srcs) $(stdlib_rt)
@@ -88,9 +90,12 @@ stdlib_io=$(HARECACHE)/io/io.o
# strings
libstrings_srcs=\
- $(STDLIB)/strings/cstrings.ha
+ $(STDLIB)/strings/cstrings.ha \
+ $(STDLIB)/strings/utf8.ha
-$(HARECACHE)/strings/strings.ssa: $(libstrings_srcs) $(stdlib_rt)
+libstrings_deps=$(stdlib_rt) $(stdlib_types)
+
+$(HARECACHE)/strings/strings.ssa: $(libstrings_srcs) $(libstrings_deps)
@printf 'HAREC \t$@\n'
@mkdir -p $(HARECACHE)/strings
@$(HAREC) -o $@ -Nstrings -t$(HARECACHE)/strings/strings.td $(libstrings_srcs)
@@ -100,7 +105,8 @@ stdlib_strings=$(HARECACHE)/strings/strings.o
# os
libos_srcs=\
$(STDLIB)/os/$(PLATFORM)/environ.ha \
- $(STDLIB)/os/$(PLATFORM)/exit.ha
+ $(STDLIB)/os/$(PLATFORM)/exit.ha \
+ $(STDLIB)/os/environ.ha
libos_deps=$(stdlib_rt) $(stdlib_strings) $(stdlib_types)