summaryrefslogtreecommitdiff
path: root/mbld
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2016-02-02 11:30:24 -0800
committerOri Bernstein <ori@eigenstate.org>2016-02-02 11:30:24 -0800
commitad4d1397fb08b0d205e623f9a7c74fa19afb1c8c (patch)
tree98fae98b43ee63812619d17ce93e39c4104e1f89 /mbld
parent0205329e24d0e078a8150020843586cbd12613c8 (diff)
downloadmc-ad4d1397fb08b0d205e623f9a7c74fa19afb1c8c.tar.gz
Make slpush take an address.
Diffstat (limited to 'mbld')
-rw-r--r--mbld/build.myr74
-rw-r--r--mbld/deps.myr18
-rw-r--r--mbld/main.myr4
-rw-r--r--mbld/parse.myr32
-rw-r--r--mbld/syssel.myr2
-rw-r--r--mbld/test.myr10
6 files changed, 70 insertions, 70 deletions
diff --git a/mbld/build.myr b/mbld/build.myr
index 37346d4..10d40f2 100644
--- a/mbld/build.myr
+++ b/mbld/build.myr
@@ -134,7 +134,7 @@ const buildbin = {b, targ, addsrc
incs = std.sldup(targ.incpath)
if opt_instbase.len > 0 && !std.sleq(opt_instbase, "none")
libpath = std.pathcat(bld.opt_instbase, config.Libpath)
- incs = std.slpush(incs, libpath)
+ std.slpush(&incs, libpath)
;;
linkbin(dg, targ.name, src, targ.ldscript, targ.runtime, incs, targ.libdeps)
std.slfree(incs)
@@ -247,36 +247,36 @@ const compile = {dg, src, incs
cmd = [][:]
if std.hassuffix(src, ".myr")
- cmd = std.slpush(cmd, opt_mc)
+ std.slpush(&cmd, opt_mc)
for inc in incs
- cmd = std.slpush(cmd, "-I")
- cmd = std.slpush(cmd, inc)
+ std.slpush(&cmd, "-I")
+ std.slpush(&cmd, inc)
;;
if opt_genasm
- cmd = std.slpush(cmd, "-S")
+ std.slpush(&cmd, "-S")
;;
- cmd = std.slpush(cmd, src)
+ std.slpush(&cmd, src)
run(cmd)
std.slfree(cmd)
elif std.hassuffix(src, ".s")
o = srcswapsuffix(src, config.Objsuffix)
for c in config.Ascmd
- cmd = std.slpush(cmd, c)
+ std.slpush(&cmd, c)
;;
- cmd = std.slpush(cmd,"-o")
- cmd = std.slpush(cmd, o)
- cmd = std.slpush(cmd, src)
+ std.slpush(&cmd,"-o")
+ std.slpush(&cmd, o)
+ std.slpush(&cmd, src)
run(cmd)
std.slfree(o)
elif std.hassuffix(src, ".glue.c")
o = srcswapsuffix(src, config.Objsuffix)
- cmd = std.slpush(cmd, "cc")
- cmd = std.slpush(cmd,"-c")
- cmd = std.slpush(cmd,"-o")
- cmd = std.slpush(cmd, o)
- cmd = std.slpush(cmd, src)
+ std.slpush(&cmd, "cc")
+ std.slpush(&cmd,"-c")
+ std.slpush(&cmd,"-o")
+ std.slpush(&cmd, o)
+ std.slpush(&cmd, src)
for flg in std.htgetv(dg.cflags, src, [][:])
- cmd = std.slpush(cmd, flg)
+ std.slpush(&cmd, flg)
;;
run(cmd)
else
@@ -291,27 +291,27 @@ const linkbin = {dg, bin, srcfiles, ldscript, rt, incs, extlibs
/* ld -o bin */
for c in config.Linkcmd
- cmd = std.slpush(cmd, std.sldup(c))
+ std.slpush(&cmd, std.sldup(c))
;;
- cmd = std.slpush(cmd, std.sldup(bin))
+ std.slpush(&cmd, std.sldup(bin))
/* [-T script] */
if ldscript.len > 0
- cmd = std.slpush(cmd, std.sldup("-T"))
- cmd = std.slpush(cmd, std.sldup(ldscript))
+ std.slpush(&cmd, std.sldup("-T"))
+ std.slpush(&cmd, std.sldup(ldscript))
;;
if rt.len != 0
if !std.sleq(rt, "none")
- cmd = std.slpush(cmd, std.sldup(rt))
+ std.slpush(&cmd, std.sldup(rt))
;;
else
- cmd = std.slpush(cmd, std.sldup(opt_runtime))
+ std.slpush(&cmd, std.sldup(opt_runtime))
;;
/* input.o list.o... */
for f in srcfiles
- cmd = std.slpush(cmd, srcswapsuffix(f, config.Objsuffix))
+ std.slpush(&cmd, srcswapsuffix(f, config.Objsuffix))
;;
/* -L path -l lib... */
@@ -320,16 +320,16 @@ const linkbin = {dg, bin, srcfiles, ldscript, rt, incs, extlibs
/* add extra libs */
for l in dg.extlibs
- cmd = std.slpush(cmd, std.fmt("-l{}", l))
+ std.slpush(&cmd, std.fmt("-l{}", l))
;;
/* special for OSX: it warns if we don't add this */
if std.sleq(opt_sys, "osx")
- cmd = std.slpush(cmd, std.sldup("-macosx_version_min"))
- cmd = std.slpush(cmd, std.sldup("10.6"))
+ std.slpush(&cmd, std.sldup("-macosx_version_min"))
+ std.slpush(&cmd, std.sldup("10.6"))
elif std.sleq(opt_sys, "linux") && dg.dynamic
- cmd = std.slpush(cmd, std.sldup("-dynamic-linker"))
- cmd = std.slpush(cmd, std.sldup("/lib64/ld-linux-x86-64.so.2"))
+ std.slpush(&cmd, std.sldup("-dynamic-linker"))
+ std.slpush(&cmd, std.sldup("/lib64/ld-linux-x86-64.so.2"))
;;
run(cmd)
@@ -342,12 +342,12 @@ const archivelib = {dg, lib, files, incs
cmd = [][:]
for c in config.Arcmd
- cmd = std.slpush(cmd, std.sldup(c))
+ std.slpush(&cmd, std.sldup(c))
;;
- cmd = std.slpush(cmd, std.fmt("lib{}.a", lib))
+ std.slpush(&cmd, std.fmt("lib{}.a", lib))
for f in files
obj = srcswapsuffix(f, config.Objsuffix)
- cmd = std.slpush(cmd, obj)
+ std.slpush(&cmd, obj)
;;
run(cmd)
strlistfree(cmd)
@@ -357,18 +357,18 @@ const mergeuse = {dg, lib, files, incs
var cmd
cmd = [][:]
- cmd = std.slpush(cmd, std.sldup(opt_muse))
- cmd = std.slpush(cmd, std.sldup("-o"))
- cmd = std.slpush(cmd, std.sldup(lib))
+ std.slpush(&cmd, std.sldup(opt_muse))
+ std.slpush(&cmd, std.sldup("-o"))
+ std.slpush(&cmd, std.sldup(lib))
for f in files
if std.hassuffix(f, ".myr")
- cmd = std.slpush(cmd, srcswapsuffix(f, ".use"))
+ std.slpush(&cmd, srcswapsuffix(f, ".use"))
elif !std.hassuffix(f, ".s") && !std.hassuffix(f, ".glue.c")
std.fatal("unknown file type for {}\n", f)
;;
;;
for l in dg.extlibs
- cmd = std.slpush(cmd, std.fmt("-l{}", l))
+ std.slpush(&cmd, std.fmt("-l{}", l))
;;
run(cmd)
strlistfree(cmd)
@@ -383,7 +383,7 @@ const addlibs = {cmd, libgraph, incs
/* -L incpath... */
if !config.Directlib
for inc in incs
- cmd = std.slpush(cmd, std.fmt("-L{}", inc))
+ std.slpush(&cmd, std.fmt("-L{}", inc))
;;
;;
diff --git a/mbld/deps.myr b/mbld/deps.myr
index 8541f15..48211ee 100644
--- a/mbld/deps.myr
+++ b/mbld/deps.myr
@@ -112,7 +112,7 @@ const swapall = {srcs, suff
sl = [][:]
for s in srcs
- sl = std.slpush(sl, srcswapsuffix(s, suff))
+ std.slpush(&sl, srcswapsuffix(s, suff))
;;
-> sl
}
@@ -140,7 +140,7 @@ const srcdeps = {b, ds, g, path, obj, usefile
-> void
;;
- ds.depstk = std.slpush(ds.depstk, path)
+ std.slpush(&ds.depstk, path)
if std.htgetv(g.seen, path, false)
std.fput(1, "dependency loop involving {}:\n", path)
for d in ds.depstk
@@ -234,7 +234,7 @@ const getcflags = {ln, cflags, libs
| `std.Some m:
flags = std.strtok(m[1])
for fl in flags
- cflags = std.slpush(cflags, std.sldup(fl))
+ std.slpush(&cflags, std.sldup(fl))
;;
std.slfree(flags)
regex.matchfree(m)
@@ -245,7 +245,7 @@ const getcflags = {ln, cflags, libs
| `std.Some m:
flags = std.strtok(m[1])
for fl in flags
- libs = std.slpush(libs, std.sldup(fl))
+ std.slpush(&libs, std.sldup(fl))
;;
std.slfree(flags)
regex.matchfree(m)
@@ -297,9 +297,9 @@ const depname = {deps, ln, lnum
match regex.exec(usepat, ln)
| `std.Some uses:
if uses[2].len > 0
- deps = std.slpush(deps, `Lib (std.sldup(uses[2]), lnum))
+ std.slpush(&deps, `Lib (std.sldup(uses[2]), lnum))
else
- deps = std.slpush(deps, `Local (std.sldup(uses[3]), lnum))
+ std.slpush(&deps, `Local (std.sldup(uses[3]), lnum))
;;
regex.matchfree(uses)
| `std.None:
@@ -343,10 +343,10 @@ const scrapelibs = {dg, lib, incs
match bio.getc(f)
| `bio.Ok 'L':
d = rdstr(f)
- deps = std.slpush(deps, d)
+ std.slpush(&deps, d)
| `bio.Ok 'X':
d = rdstr(f)
- dg.extlibs = std.slpush(dg.extlibs, d)
+ std.slpush(&dg.extlibs, d)
| `bio.Ok _: done = true
| `bio.Eof: done = true
| `bio.Err e: std.fatal("io error reading {}: {}", lib, e)
@@ -389,7 +389,7 @@ const pushdep = {dg, src, dst
std.put("{} <= {}\n", dst, src)
;;
sl = std.htgetv(dg.deps, dst, [][:])
- sl = std.slpush(sl, src)
+ std.slpush(&sl, src)
std.htput(dg.deps, dst, sl)
}
diff --git a/mbld/main.myr b/mbld/main.myr
index e0a9507..097f4f7 100644
--- a/mbld/main.myr
+++ b/mbld/main.myr
@@ -58,9 +58,9 @@ const main = {args : byte[:][:]
| ('T', ""): dumponly = true
| ('S', ""): bld.opt_genasm = true
| ('c', ""): cleanfirst = true
- | ('I', arg): bld.opt_incpaths = std.slpush(bld.opt_incpaths, arg)
+ | ('I', arg): std.slpush(&bld.opt_incpaths, arg)
| ('B', arg): bld.opt_instbase = arg
- | ('t', tag): tags = std.slpush(tags, tag)
+ | ('t', tag): std.slpush(&tags, tag)
| ('R', arg): runsrc = arg
| ('b', arg):
targname = arg
diff --git a/mbld/parse.myr b/mbld/parse.myr
index fab0c0e..10eef0b 100644
--- a/mbld/parse.myr
+++ b/mbld/parse.myr
@@ -39,7 +39,7 @@ const load = {b
targs = sysselfin(sel)
for (name, targ) in targs
- b.all = std.slpush(b.all, name)
+ std.slpush(&b.all, name)
std.htput(b.targs, name, targ)
;;
@@ -121,7 +121,7 @@ const sortdeps = {b
match gettarg(b.targs, dep)
| `Bin _: all = visit(all, b, "all", dep, looped, marked)
| `Lib _: all = visit(all, b, "all", dep, looped, marked)
- | targ: all = std.slpush(all, dep)
+ | targ: std.slpush(&all, dep)
;;
;;
std.slfree(b.all)
@@ -142,7 +142,7 @@ const visit = {all, b, parent, targ, looped, marked
;;
std.htdel(looped, targ)
std.htput(marked, targ, true)
- -> std.slpush(all, targ)
+ -> std.slpush(&all, targ)
}
const getdeps = {b, parent, targname
@@ -280,7 +280,7 @@ const subtarget = {b, p
subs = anontarget(p, "sub")
for s in subs
- p.subdirs = std.slpush(p.subdirs, std.pathcat(p.fdir, s))
+ std.slpush(&p.subdirs, std.pathcat(p.fdir, s))
;;
}
@@ -334,8 +334,8 @@ const cmdtarget = {b, p, cmd, iscmd
| ("durable", ""): durable = true
| ("test", ""): istest = true
| ("notest", ""): istest = false
- | ("dep", depname): deplist = std.slpush(deplist, depname)
- | ("tag", tag): tags = std.slpush(tags, tag)
+ | ("dep", depname): std.slpush(&deplist, depname)
+ | ("tag", tag): std.slpush(&tags, tag)
| (attr, ""):
failparse(p, "attribute {} not valid on {} targets\n", attr, cmd)
| (attr, val):
@@ -415,15 +415,15 @@ const myrtarget = {b, p, targ
ldscript = p.ldscript
incpath = [][:]
for path in p.incpath
- incpath = std.slpush(incpath, path)
+ std.slpush(&incpath, path)
;;
tags = [][:]
for elt in attrs
match elt
| ("ldscript", lds): ldscript = std.sldup(lds)
| ("runtime", rt): runtime = std.sldup(rt)
- | ("inc", path): incpath = std.slpush(incpath, std.sldup(path))
- | ("tag", tag): tags = std.slpush(tags, tag)
+ | ("inc", path): std.slpush(&incpath, std.sldup(path))
+ | ("tag", tag): std.slpush(&tags, tag)
| ("inst", ""): install = true
| ("noinst", ""): install = false
| ("test", ""): istest = true
@@ -435,7 +435,7 @@ const myrtarget = {b, p, targ
;;
;;
for inc in bld.opt_incpaths
- incpath = std.slpush(incpath, std.sldup(inc))
+ std.slpush(&incpath, std.sldup(inc))
;;
-> std.mk([
/* target */
@@ -492,7 +492,7 @@ const datatarget = {b, p, targ
tags = [][:]
for elt in attrs
match elt
- | ("tag", tag): tags = std.slpush(tags, tag)
+ | ("tag", tag): std.slpush(&tags, tag)
| ("path", pathdir): path = pathdir
| (invalid, ""):
std.fatal("{}: got invalid attr '{}'\n", targ, invalid)
@@ -551,12 +551,12 @@ const attrlist = {p
if matchc(p, '=')
match word(p)
| `std.Some v:
- al = std.slpush(al, (k, v))
+ std.slpush(&al, (k, v))
| `std.None:
failparse(p, "invalid attr in attribute list\n")
;;
else
- al = std.slpush(al, (k, [][:]))
+ std.slpush(&al, (k, [][:]))
;;
if !matchc(p, ',')
break
@@ -593,11 +593,11 @@ const inputlist = {p
match word(p)
| `std.Some l:
(dir, lib, targ) = libpath(p, l)
- libs = std.slpush(libs, (dir, lib, targ))
+ std.slpush(&libs, (dir, lib, targ))
| `std.None:
failparse(p, "expected lib name after 'lib'\n")
;;
- | `std.Some w: wl = std.slpush(wl, w)
+ | `std.Some w: std.slpush(&wl, w)
| `std.None: break
;;
;;
@@ -615,7 +615,7 @@ const wordlist = {p
wl = [][:]
while true
match word(p)
- | `std.Some w: wl = std.slpush(wl, w)
+ | `std.Some w: std.slpush(&wl, w)
| `std.None: break
;;
;;
diff --git a/mbld/syssel.myr b/mbld/syssel.myr
index 3c3abdd..9d7a759 100644
--- a/mbld/syssel.myr
+++ b/mbld/syssel.myr
@@ -88,7 +88,7 @@ generic sysselfin = {syssel
if nmatch == -1
std.fatal("{}:{}: target {}, no applicable file for '{}'\n", syssel.file, syssel.line, syssel.targ, k)
;;
- ret = std.slpush(ret, std.get(std.htget(syssel._best, k)))
+ std.slpush(&ret, std.get(std.htget(syssel._best, k)))
;;
std.htfree(syssel._match)
std.htfree(syssel._best)
diff --git a/mbld/test.myr b/mbld/test.myr
index 34281cb..d4ce0d9 100644
--- a/mbld/test.myr
+++ b/mbld/test.myr
@@ -41,12 +41,12 @@ const test = {b
;;
buildbin(b, t, false)
bincmd = std.sldup([std.strcat("./", t.name)][:])
- tests = std.slpush(tests, (bincmd, std.sldup(t.dir)))
+ std.slpush(&tests, (bincmd, std.sldup(t.dir)))
| `Cmd t:
if !t.istest
continue
;;
- tests = std.slpush(tests, (dupcmd(t.cmd), std.sldup(t.dir)))
+ std.slpush(&tests, (dupcmd(t.cmd), std.sldup(t.dir)))
| _:
/* skip */
;;
@@ -59,7 +59,7 @@ const test = {b
if !runtest(b, c)
ok = false
p = std.pathcat(b.curdir, c[0])
- failed = std.slpush(failed, p)
+ std.slpush(&failed, p)
;;
;;
@@ -101,7 +101,7 @@ const dupcmd = {cmd
ret = [][:]
for c in cmd
- ret = std.slpush(ret, std.sldup(c))
+ std.slpush(&ret, std.sldup(c))
;;
-> ret
}
@@ -135,7 +135,7 @@ const buildtests = {b, targ
buildbin(b, &tt, true)
cmd = std.sldup([std.strcat("./", bin)][:])
- tests = std.slpush(tests, (cmd, std.sldup(targ.dir)))
+ std.slpush(&tests, (cmd, std.sldup(targ.dir)))
std.slfree(tt.libdeps)
std.slfree(tt.incpath)
std.slfree(path)