summaryrefslogtreecommitdiff
path: root/mbld/util.myr
diff options
context:
space:
mode:
Diffstat (limited to 'mbld/util.myr')
-rw-r--r--mbld/util.myr15
1 files changed, 13 insertions, 2 deletions
diff --git a/mbld/util.myr b/mbld/util.myr
index 3268f4e..383cdbd 100644
--- a/mbld/util.myr
+++ b/mbld/util.myr
@@ -11,7 +11,8 @@ pkg bld =
const srcswapsuffix : (f : byte[:], newsuff : byte[:] -> byte[:])
const strlistfree : (sl : byte[:][:] -> void)
const gettarg : (tab : std.htab(byte[:], targ)#, n : byte[:] -> targ)
- const setdir : (b : build#, dir : byte[:] -> void)
+ const pushdir : (b : build#, dir : byte[:] -> void)
+ const popdir : (b : build# -> void)
;;
const run = {cmd
@@ -103,13 +104,23 @@ const gettarg = {tab, n
;;
}
+const pushdir = {b, dir
+ b.dirstk = std.slpush(b.dirstk, dir)
+ setdir(b, dir)
+}
+
+const popdir = {b
+ b.dirstk = b.dirstk[:b.dirstk.len-1]
+ setdir(b, b.dirstk[b.dirstk.len-1])
+}
+
const setdir = {b, dir
var p
if !std.sleq(b.curdir, dir)
p = std.pathcat(b.basedir, dir)
if b.curdir.len != 0
- std.put("Leaving directory %s\n", b.curdir)
+ std.put("Leaving directory '%s'\n", b.curdir)
;;
std.put("Entering directory '%s'\n", dir)