hare

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

commit aec0f3c0818e0c84ceb7afb250d434e6eac87a17
parent d157d2a4ab3635aaa1abd880300095ce4fd0d83b
Author: Drew DeVault <sir@cmpwn.com>
Date:   Tue,  9 Mar 2021 15:50:50 -0500

Update stdlib, provision workdir

Diffstat:
Mgen-stdlib | 8++++++++
Mmain.ha | 9++++++++-
Mmk/stdlib.mk | 26++++++++++++++++++++++++++
Mplan.ha | 4+++-
4 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/gen-stdlib b/gen-stdlib @@ -441,6 +441,13 @@ strio() { gen_ssa strio io strings encoding::utf8 } +temp() { + printf '# temp\n' + gen_srcs temp \ + '$(PLATFORM).ha' + gen_ssa temp +} + types() { printf '# types\n' gen_srcs types \ @@ -481,6 +488,7 @@ sort strconv strings strio +temp types" stdlib() { rt diff --git a/main.ha b/main.ha @@ -5,14 +5,21 @@ use hare::module; use io; use os::exec; use os; +use path; use strio; +use temp; export fn main() void = { if (len(os::args) == 1) { fmt::fatal("Usage: {} <path>", os::args[0]); }; - let plan = plan { ... }; + let plan = plan { + workdir = temp::dir(), + ... + }; + defer os::rmdirall(plan.workdir); + defer path::path_free(plan.workdir); let ctx = module::context_init([module::tag { name = os::machine(), mode = module::tag_mode::INCLUSIVE, diff --git a/mk/stdlib.mk b/mk/stdlib.mk @@ -147,6 +147,9 @@ hare_stdlib_deps+=$(stdlib_strings) stdlib_strio=$(HARECACHE)/strio/strio.o hare_stdlib_deps+=$(stdlib_strio) +stdlib_temp=$(HARECACHE)/temp/temp.o +hare_stdlib_deps+=$(stdlib_temp) + stdlib_types=$(HARECACHE)/types/types.o hare_stdlib_deps+=$(stdlib_types) @@ -502,6 +505,16 @@ $(HARECACHE)/strio/strio.ssa: $(stdlib_strio_srcs) $(stdlib_rt) $(stdlib_io) $(s @HARECACHE=$(HARECACHE) $(HAREC) $(HAREFLAGS) -o $@ -Nstrio \ -t$(HARECACHE)/strio/strio.td $(stdlib_strio_srcs) +# temp +stdlib_temp_srcs= \ + $(STDLIB)/temp/$(PLATFORM).ha + +$(HARECACHE)/temp/temp.ssa: $(stdlib_temp_srcs) $(stdlib_rt) + @printf 'HAREC \t$@\n' + @mkdir -p $(HARECACHE)/temp + @HARECACHE=$(HARECACHE) $(HAREC) $(HAREFLAGS) -o $@ -Ntemp \ + -t$(HARECACHE)/temp/temp.td $(stdlib_temp_srcs) + # types stdlib_types_srcs= \ $(STDLIB)/types/limits.ha \ @@ -663,6 +676,9 @@ hare_testlib_deps+=$(testlib_strings) testlib_strio=$(TESTCACHE)/strio/strio.o hare_testlib_deps+=$(testlib_strio) +testlib_temp=$(TESTCACHE)/temp/temp.o +hare_testlib_deps+=$(testlib_temp) + testlib_types=$(TESTCACHE)/types/types.o hare_testlib_deps+=$(testlib_types) @@ -1028,6 +1044,16 @@ $(TESTCACHE)/strio/strio.ssa: $(testlib_strio_srcs) $(testlib_rt) $(testlib_io) @HARECACHE=$(TESTCACHE) $(HAREC) $(TESTHAREFLAGS) -o $@ -Nstrio \ -t$(TESTCACHE)/strio/strio.td $(testlib_strio_srcs) +# temp +testlib_temp_srcs= \ + $(STDLIB)/temp/$(PLATFORM).ha + +$(TESTCACHE)/temp/temp.ssa: $(testlib_temp_srcs) $(testlib_rt) + @printf 'HAREC \t$@\n' + @mkdir -p $(TESTCACHE)/temp + @HARECACHE=$(TESTCACHE) $(HAREC) $(TESTHAREFLAGS) -o $@ -Ntemp \ + -t$(TESTCACHE)/temp/temp.td $(testlib_temp_srcs) + # types testlib_types_srcs= \ $(STDLIB)/types/limits.ha \ diff --git a/plan.ha b/plan.ha @@ -1,7 +1,8 @@ use fmt; use hare::module; -use os; use os::exec; +use os; +use path; type status = enum { SCHEDULED, @@ -17,6 +18,7 @@ type task = struct { }; type plan = struct { + workdir: path::path, scheduled: []*task, complete: []*task, };