hare

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

commit bab8835b7cdb37ca6a4b49635aed60bde8c5cd1e
parent ed24768e26175995613648040f6a2a5f140f7e12
Author: Drew DeVault <sir@cmpwn.com>
Date:   Wed, 24 Feb 2021 15:35:37 -0500

update stdlib

Diffstat:
Mgen-stdlib | 7+++++--
Mmain.ha | 3++-
Mmk/stdlib.mk | 14++++++++++----
3 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/gen-stdlib b/gen-stdlib @@ -245,11 +245,14 @@ os() { '$(PLATFORM)/environ.ha' \ '$(PLATFORM)/errors.ha' \ '$(PLATFORM)/exit.ha' \ + '$(PLATFORM)/dirfdfs.ha' \ '$(PLATFORM)/fdstream.ha' \ '$(PLATFORM)/open.ha' \ '$(PLATFORM)/stdfd.ha' \ - stdfd.ha - gen_ssa os io strings types + '$(PLATFORM)/fs.ha' \ + stdfd.ha \ + fs.ha + gen_ssa os io strings types fs } os_exec() { diff --git a/main.ha b/main.ha @@ -4,12 +4,13 @@ use hare::lex; use hare::parse; use io; use os; +use fs; export fn main() void = { let in = switch (len(os::args)) { 1 => (os::stdin, "<stdin>"), 2 => { - let fd = match (os::open(os::args[1])) { + let fd = match (fs::open(os::cwd, os::args[1], io::mode::READ)) { err: io::error => fmt::fatal("Error opening '{}': {}", os::args[1], io::errstr(err)), fd: *io::stream => fd, diff --git a/mk/stdlib.mk b/mk/stdlib.mk @@ -266,12 +266,15 @@ stdlib_os_srcs= \ $(STDLIB)/os/$(PLATFORM)/environ.ha \ $(STDLIB)/os/$(PLATFORM)/errors.ha \ $(STDLIB)/os/$(PLATFORM)/exit.ha \ + $(STDLIB)/os/$(PLATFORM)/dirfdfs.ha \ $(STDLIB)/os/$(PLATFORM)/fdstream.ha \ $(STDLIB)/os/$(PLATFORM)/open.ha \ $(STDLIB)/os/$(PLATFORM)/stdfd.ha \ - $(STDLIB)/os/stdfd.ha + $(STDLIB)/os/$(PLATFORM)/fs.ha \ + $(STDLIB)/os/stdfd.ha \ + $(STDLIB)/os/fs.ha -$(HARECACHE)/os/os.ssa: $(stdlib_os_srcs) $(stdlib_rt) $(stdlib_io) $(stdlib_strings) $(stdlib_types) +$(HARECACHE)/os/os.ssa: $(stdlib_os_srcs) $(stdlib_rt) $(stdlib_io) $(stdlib_strings) $(stdlib_types) $(stdlib_fs) @printf 'HAREC \t$@\n' @mkdir -p $(HARECACHE)/os @HARECACHE=$(HARECACHE) $(HAREC) $(HAREFLAGS) -o $@ -Nos \ @@ -636,12 +639,15 @@ testlib_os_srcs= \ $(STDLIB)/os/$(PLATFORM)/environ.ha \ $(STDLIB)/os/$(PLATFORM)/errors.ha \ $(STDLIB)/os/$(PLATFORM)/exit.ha \ + $(STDLIB)/os/$(PLATFORM)/dirfdfs.ha \ $(STDLIB)/os/$(PLATFORM)/fdstream.ha \ $(STDLIB)/os/$(PLATFORM)/open.ha \ $(STDLIB)/os/$(PLATFORM)/stdfd.ha \ - $(STDLIB)/os/stdfd.ha + $(STDLIB)/os/$(PLATFORM)/fs.ha \ + $(STDLIB)/os/stdfd.ha \ + $(STDLIB)/os/fs.ha -$(TESTCACHE)/os/os.ssa: $(testlib_os_srcs) $(testlib_rt) $(testlib_io) $(testlib_strings) $(testlib_types) +$(TESTCACHE)/os/os.ssa: $(testlib_os_srcs) $(testlib_rt) $(testlib_io) $(testlib_strings) $(testlib_types) $(testlib_fs) @printf 'HAREC \t$@\n' @mkdir -p $(TESTCACHE)/os @HARECACHE=$(TESTCACHE) $(HAREC) $(TESTHAREFLAGS) -o $@ -Nos \