diff options
author | Ori Bernstein <ori@markovcorp.com> | 2017-07-17 15:30:01 -0700 |
---|---|---|
committer | Ori Bernstein <ori@markovcorp.com> | 2017-07-17 15:30:01 -0700 |
commit | 492aca3ff6f829ee09c52e17c86a808430ee7df4 (patch) | |
tree | f97424e14c9d3277c78ff53082daec725e1f4dcb /mbld | |
parent | 11f79ed8ff75049f6b1866d70bc032c8d18b1463 (diff) | |
download | mc-492aca3ff6f829ee09c52e17c86a808430ee7df4.tar.gz |
Convert from `in` to `:`.
The winds of change are a-blowin.
Diffstat (limited to 'mbld')
-rw-r--r-- | mbld/build.myr | 54 | ||||
-rw-r--r-- | mbld/clean.myr | 12 | ||||
-rw-r--r-- | mbld/deps.myr | 20 | ||||
-rw-r--r-- | mbld/install.myr | 6 | ||||
-rw-r--r-- | mbld/main.myr | 6 | ||||
-rw-r--r-- | mbld/opts.myr | 2 | ||||
-rw-r--r-- | mbld/parse.myr | 26 | ||||
-rw-r--r-- | mbld/subtest.myr | 4 | ||||
-rw-r--r-- | mbld/syssel.myr | 6 | ||||
-rw-r--r-- | mbld/test.myr | 20 | ||||
-rw-r--r-- | mbld/util.myr | 4 |
11 files changed, 80 insertions, 80 deletions
diff --git a/mbld/build.myr b/mbld/build.myr index 7628529..61ea0c3 100644 --- a/mbld/build.myr +++ b/mbld/build.myr @@ -16,7 +16,7 @@ pkg bld = ;; const buildall = {b - for tn in b.all + for tn : b.all if std.hthas(b.built, tn) continue ;; @@ -42,7 +42,7 @@ const buildtarg = {b, targ depset = std.mkht(std.strhash, std.streq) addeps(b, targ, depset) - for tn in b.all + for tn : b.all if std.hthas(b.built, tn) || !std.hthas(depset, tn) continue ;; @@ -75,11 +75,11 @@ const addeps = {b, targ, depset std.htput(depset, targ, true) match gettarg(b.targs, targ) | `Bin bt: - for (dir, lib, targname) in bt.libdeps + for (dir, lib, targname) : bt.libdeps addeps(b, targname, depset) ;; | `Lib lt: - for (dir, lib, targname) in lt.libdeps + for (dir, lib, targname) : lt.libdeps addeps(b, targname, depset) ;; | _: @@ -87,7 +87,7 @@ const addeps = {b, targ, depset } const genall = {b - for tn in b.all + for tn : b.all match gettarg(b.targs, tn) | `Gen gt: runin(b, gt.cmd, gt.dir) | _: /* skip */ @@ -173,7 +173,7 @@ const buildlib = {b, targ const genfiles = {b, gt setdir(b, gt.dir) - for out in gt.out + for out : gt.out if !std.fexists(out) || !allfresh(gt.deps, out) run(gt.cmd) break @@ -182,7 +182,7 @@ const genfiles = {b, gt } const addincludes = {b, targ - for (inc, lib, subtarg) in targ.libdeps + for (inc, lib, subtarg) : targ.libdeps if !hasinc(targ.incpath, inc) std.slput(&targ.incpath, 0, inc) ;; @@ -190,7 +190,7 @@ const addincludes = {b, targ } const hasinc = {path, t - for e in path + for e : path if std.sleq(e, t) -> true ;; @@ -210,7 +210,7 @@ const builddep = {b, dg, out, incs match std.htget(dg.deps, out) | `std.Some deps: - for d in deps + for d : deps if std.sleq(out, d) /* if an input generates itself (eg, object files), we @@ -259,7 +259,7 @@ const compile = {dg, src, incs cmd = [][:] if std.hassuffix(src, ".myr") std.slpush(&cmd, opt_mc) - for inc in incs + for inc : incs std.slpush(&cmd, "-I") std.slpush(&cmd, inc) ;; @@ -271,7 +271,7 @@ const compile = {dg, src, incs std.slfree(cmd) elif std.hassuffix(src, ".s") o = srcswapsuffix(src, config.Objsuffix) - for c in config.Ascmd + for c : config.Ascmd std.slpush(&cmd, c) ;; std.slpush(&cmd,"-o") @@ -286,7 +286,7 @@ const compile = {dg, src, incs std.slpush(&cmd,"-o") std.slpush(&cmd, o) std.slpush(&cmd, src) - for flg in std.htgetv(dg.cflags, src, [][:]) + for flg : std.htgetv(dg.cflags, src, [][:]) std.slpush(&cmd, flg) ;; run(cmd) @@ -303,7 +303,7 @@ const linkbin = {dg, bin, srcfiles, ldscript, rt, incs, extlibs cmd = [][:] /* ld -o bin */ - for c in config.Linkcmd + for c : config.Linkcmd std.slpush(&cmd, std.sldup(c)) ;; std.slpush(&cmd, std.sldup(bin)) @@ -323,7 +323,7 @@ const linkbin = {dg, bin, srcfiles, ldscript, rt, incs, extlibs ;; /* input.o list.o... */ - for f in srcfiles + for f : srcfiles std.slpush(&cmd, srcswapsuffix(f, config.Objsuffix)) ;; @@ -332,7 +332,7 @@ const linkbin = {dg, bin, srcfiles, ldscript, rt, incs, extlibs /* add extra libs */ - for l in dg.extlibs + for l : dg.extlibs std.slpush(&cmd, std.fmt("-l{}", l)) ;; @@ -354,11 +354,11 @@ const archivelib = {dg, lib, files, incs var obj cmd = [][:] - for c in config.Arcmd + for c : config.Arcmd std.slpush(&cmd, std.sldup(c)) ;; std.slpush(&cmd, std.fmt("lib{}.a", lib)) - for f in files + for f : files obj = srcswapsuffix(f, config.Objsuffix) std.slpush(&cmd, obj) ;; @@ -375,14 +375,14 @@ const mergeuse = {dg, lib, files, incs std.slpush(&cmd, std.fmt("lib{}.use", lib)) std.slpush(&cmd, std.sldup("-p")) std.slpush(&cmd, std.sldup(lib)) - for f in files + for f : files if std.hassuffix(f, ".myr") 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 + for l : dg.extlibs std.slpush(&cmd, std.fmt("-l{}", l)) ;; run(cmd) @@ -397,7 +397,7 @@ const addlibs = {cmd, libgraph, incs /* -L incpath... */ if !config.Directlib - for inc in incs + for inc : incs std.slpush(&cmd, std.fmt("-L{}", inc)) ;; ;; @@ -407,7 +407,7 @@ const addlibs = {cmd, libgraph, incs marked = std.mkht(std.strhash, std.streq) head = cmd.len - for lib in libs + for lib : libs cmd = visit(cmd, head, libgraph, lib, looped, marked, incs) ;; @@ -422,7 +422,7 @@ const visit = {cmd, head, g, lib, looped, marked, incs ;; std.htput(looped, lib, true) - for dep in std.htgetv(g, lib, [][:]) + for dep : std.htgetv(g, lib, [][:]) cmd = visit(cmd, head, g, dep, looped, marked, incs) ;; std.htdel(looped, lib) @@ -440,7 +440,7 @@ const putlib = {cmd, head, lib, incs | `std.None: mbldput("in path: ") sep = "" - for inc in incs + for inc : incs mbldput("\t{}{}\n", sep, inc) sep = ", " ;; @@ -456,7 +456,7 @@ const findlib = {lib, incs var sl, p sl = std.bfmt(buf[:], "lib{}.a", lib) - for i in incs + for i : incs p = std.pathcat(i, sl) if std.fexists(p) -> `std.Some p @@ -476,7 +476,7 @@ const freshlibs = {targ, output, libgraph var libs libs = std.htkeys(libgraph) - for l in libs + for l : libs match findlib(l, targ.incpath) | `std.Some lib: if !isfresh(lib, output) @@ -487,7 +487,7 @@ const freshlibs = {targ, output, libgraph | `std.None: std.fput(1, "{}: could not find library lib{}.a\n", targ.name, l) std.fput(1, "searched:\n") - for inc in targ.incpath + for inc : targ.incpath std.fput(1, "\t{}\n", inc) ;; std.fput(1, "\t{}/{}\n", opt_instbase, config.Libpath) @@ -499,7 +499,7 @@ const freshlibs = {targ, output, libgraph } const allfresh = {deps, out - for d in deps + for d : deps if !isfresh(d, out) -> false ;; diff --git a/mbld/clean.myr b/mbld/clean.myr index 1e317fe..234d980 100644 --- a/mbld/clean.myr +++ b/mbld/clean.myr @@ -14,14 +14,14 @@ pkg bld = ;; const cleanall = {b - for tn in b.all + for tn : b.all match gettarg(b.targs, tn) | `Bin bt: cleanup(b, bt, bt.inputs) | `Lib lt: cleanup(b, lt, lt.inputs) | `Gen gt: - for f in gt.out + for f : gt.out if !gt.durable && std.remove(f) mbldput("\tclean {}\n", f) ;; @@ -35,7 +35,7 @@ const cleanall = {b } const clean = {b, targ - for tn in b.all + for tn : b.all match gettarg(b.targs, tn) | `Bin bt: if std.sleq(bt.name, targ) @@ -46,7 +46,7 @@ const clean = {b, targ cleanup(b, lt, lt.inputs) ;; | `Gen gt: - for f in gt.out + for f : gt.out if !gt.durable && std.remove(f) mbldput("\tclean {}\n", f) ;; @@ -74,12 +74,12 @@ const cleanup = {b, targ, leaves setdir(b, targ.dir) dg = myrdeps(b, targ, true, true) mchammer_files = std.mkht(std.strhash, std.streq) - for l in leaves + for l : leaves std.htput(mchammer_files, l, true) ;; keys = std.htkeys(dg.deps) - for k in keys + for k : keys if !std.htgetv(mchammer_files, k, false) && std.remove(k) mbldput("\tclean {}\n", k) ;; diff --git a/mbld/deps.myr b/mbld/deps.myr index 506fffa..e501983 100644 --- a/mbld/deps.myr +++ b/mbld/deps.myr @@ -111,7 +111,7 @@ const swapall = {srcs, suff var sl sl = [][:] - for s in srcs + for s : srcs std.slpush(&sl, srcswapsuffix(s, suff)) ;; -> sl @@ -125,8 +125,8 @@ const dumpgraph = {dg ;; keys = std.htkeys(dg.deps) mbldput("digraph dg {{\n") - for k in keys - for v in std.htgetv(dg.deps, k, ["WTFUNKNOWN!"][:]) + for k : keys + for v : std.htgetv(dg.deps, k, ["WTFUNKNOWN!"][:]) mbldput("\t\"{}\" -> \"{}\";\n", k, v) ;; ;; @@ -143,14 +143,14 @@ const srcdeps = {b, ds, g, path, obj, usefile 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 + for d : ds.depstk std.fput(1, "\t{}\n", d) ;; std.exit(1) ;; deps = getdeps(b, ds, path, std.dirname(path)) std.htput(g.seen, path, true) - for d in deps + for d : deps match d | `Lib (lib, lnum): /* @@ -233,7 +233,7 @@ const getcflags = {ln, cflags, libs | `std.None: | `std.Some m: flags = std.strtok(m[1]) - for fl in flags + for fl : flags std.slpush(&cflags, std.sldup(fl)) ;; std.slfree(flags) @@ -244,7 +244,7 @@ const getcflags = {ln, cflags, libs | `std.None: | `std.Some m: flags = std.strtok(m[1]) - for fl in flags + for fl : flags std.slpush(&libs, std.sldup(fl)) ;; std.slfree(flags) @@ -358,7 +358,7 @@ const scrapelibs = {dg, lib, incs ;; bio.close(f) std.htput(dg.libs, lib, deps) - for dep in deps + for dep : deps scrapelibs(dg, dep, incs) ;; } @@ -366,7 +366,7 @@ const scrapelibs = {dg, lib, incs const openlib = {lib, incs var path, libname - for p in incs + for p : incs libname = std.fmt("lib{}.use", lib) path = std.pathjoin([p, libname][:]) std.slfree(libname) @@ -399,7 +399,7 @@ const openlib = {lib, incs ;; std.fput(std.Err, "could not find library {}\n", lib) std.fput(std.Err, "search path is:\n") - for p in incs + for p : incs std.fput(std.Err, "\t{}\n", p) ;; std.fput(std.Err, "\t{}\n", config.Libpath) diff --git a/mbld/install.myr b/mbld/install.myr index 82e6777..0d8352f 100644 --- a/mbld/install.myr +++ b/mbld/install.myr @@ -26,7 +26,7 @@ const movetargs = {b, rm var libarchive, libuse var pfx - for tn in b.all + for tn : b.all match gettarg(b.targs, tn) | `Bin bt: if bt.install && !bt.istest @@ -42,7 +42,7 @@ const movetargs = {b, rm std.slfree(libuse) ;; | `Data dt: - for blob in dt.blobs + for blob : dt.blobs if dt.path.len == 0 pfx = std.pathcat(config.Sharepath, dt.name) movefile(b, rm, dt.dir, blob, pfx, 0o644) @@ -57,7 +57,7 @@ const movetargs = {b, rm /* nothing to do */ | `Man mt: /* FIXME: figure out man section by number */ - for m in mt.pages + for m : mt.pages moveman(b, rm, mt.dir, m) ;; ;; diff --git a/mbld/main.myr b/mbld/main.myr index 10d3946..61f7ba8 100644 --- a/mbld/main.myr +++ b/mbld/main.myr @@ -46,7 +46,7 @@ const main = {args : byte[:][:] ok = true bld.initopts() - for opt in cmd.opts + for opt : cmd.opts match opt | ('S', ""): bld.opt_genasm = true | ('I', arg): std.slpush(&bld.opt_incpaths, arg) @@ -77,7 +77,7 @@ const main = {args : byte[:][:] ;; ;; - for (e, v) in config.Env + for (e, v) : config.Env std.setenv(e, v) ;; @@ -100,7 +100,7 @@ const main = {args : byte[:][:] if cmd.args.len == 0 bld.buildall(b) else - for c in cmd.args + for c : cmd.args match c | "all": r = bld.buildall(b) | "gen": r = bld.genall(b) diff --git a/mbld/opts.myr b/mbld/opts.myr index e753dcf..ffd9595 100644 --- a/mbld/opts.myr +++ b/mbld/opts.myr @@ -84,7 +84,7 @@ const parseversion = {v i = 0 a = [0, 0, 0] - for e in std.bysplit(v, ".") + for e : std.bysplit(v, ".") match std.intparse(e) | `std.Some n: a[i++] = n | `std.None: continue diff --git a/mbld/parse.myr b/mbld/parse.myr index 614a0a2..2cf2446 100644 --- a/mbld/parse.myr +++ b/mbld/parse.myr @@ -43,7 +43,7 @@ const load = {b ok = loadall(b, b.bldfile, "", sel) targs = sysselfin(sel) - for (name, targ) in targs + for (name, targ) : targs std.slpush(&b.all, name) std.htput(b.targs, name, targ) ;; @@ -62,11 +62,11 @@ const loadall = {b, path, dir, sel p = mkparser(path, dir, b.basedir, sel) ok = bld.parse(b, p, "") - for t in p.targs + for t : p.targs setopts(p, t) ;; - for sub in p.subdirs + for sub : p.subdirs subbld = std.pathcat(sub, "bld.sub") subproj = std.pathcat(sub, "bld.proj") /* @@ -115,11 +115,11 @@ const setmyropt = {p, t ;; std.sljoin(&t.incpath, p.incpath) - for l in p.libdeps + for l : p.libdeps libdep = libpath(p, l) std.slpush(&t.libdeps, libdep) ;; - for l in p.tstdeps + for l : p.tstdeps tstdep = libpath(p, l) std.slpush(&t.tstdeps, tstdep) ;; @@ -206,7 +206,7 @@ const sortdeps = {b all = [][:] looped = std.mkht(std.strhash, std.streq) marked = std.mkht(std.strhash, std.streq) - for dep in b.all + for dep : b.all match gettarg(b.targs, dep) | `Bin _: all = visit(all, b, "all", dep, looped, marked) | `Lib _: all = visit(all, b, "all", dep, looped, marked) @@ -226,7 +226,7 @@ const visit = {all, b, parent, targ, looped, marked ;; std.htput(looped, targ, true) - for (dir, lib, dep) in getdeps(b, parent, targ) + for (dir, lib, dep) : getdeps(b, parent, targ) all = visit(all, b, targ, dep, looped, marked) ;; std.htdel(looped, targ) @@ -311,7 +311,7 @@ const subtarget = {b, p var subs subs = anontarget(p, "sub") - for s in subs + for s : subs std.slpush(&p.subdirs, std.pathcat(p.fdir, s)) ;; } @@ -361,7 +361,7 @@ const cmdtarget = {b, p, cmd, iscmd istest = false deplist = [][:] tags = [][:] - for elt in attrs + for elt : attrs match elt | ("durable", ""): durable = true | ("test", ""): istest = true @@ -384,7 +384,7 @@ const cmdtarget = {b, p, cmd, iscmd .cmd=cmdlist, .tags=tags, ]) - for o in outlist + for o : outlist if iscmd addtarg(p, b, o, gt.tags, `Cmd gt) else @@ -429,7 +429,7 @@ const myrtarget = {b, p, targ match inputlist(p) | `std.Some (wl, libs): libdeps = libs - for w in wl + for w : wl sysseladd(fsel, w) ;; inputs = sysselfin(fsel) @@ -449,7 +449,7 @@ const myrtarget = {b, p, targ tags = [][:] istest = false tstdeps = [][:] - for elt in attrs + for elt : attrs match elt | ("ldscript", lds): ldscript = std.sldup(lds) | ("runtime", rt): runtime = std.sldup(rt) @@ -519,7 +519,7 @@ const datatarget = {b, p, targ ;; tags = [][:] - for elt in attrs + for elt : attrs match elt | ("tag", tag): std.slpush(&tags, tag) | ("path", pathdir): path = pathdir diff --git a/mbld/subtest.myr b/mbld/subtest.myr index 5f0668f..557746d 100644 --- a/mbld/subtest.myr +++ b/mbld/subtest.myr @@ -75,7 +75,7 @@ const showtests = {b, cmd, failed, f, log, ntests curtest = "" nresults = 0 mbldput("\n") - for ln in bio.byline(f) + for ln : bio.byline(f) ln = std.strstrip(ln) match testhead(ln) | `std.None: @@ -127,7 +127,7 @@ const checktests = {ntests, nresults const starttest = {curtest, t if curtest#.len != 0 - std.fatal("malformed input: test {} nested in {}\n", t, curtest) + std.fatal("malformed input in test {} nested : {}\n", t, curtest) ;; mbldput("\trun {}:\t", std.strstrip(t)) curtest# = t diff --git a/mbld/syssel.myr b/mbld/syssel.myr index 0aea817..09574d3 100644 --- a/mbld/syssel.myr +++ b/mbld/syssel.myr @@ -63,7 +63,7 @@ generic sysseladdlist = {syssel, base, attrs, val var nmatch, curbest, n, v nmatch = 0 - for a in attrs + for a : attrs match std.strfind(a, ":") | `std.Some i: n = a[:i] @@ -106,7 +106,7 @@ generic sysselfin = {syssel keys = std.htkeys(syssel._match) ret = [][:] - for k in keys + for k : keys nmatch = std.htgetv(syssel._match, k, -1) if nmatch == -1 std.fatal("{}:{}: target {}, no applicable file for '{}'\n", \ @@ -192,7 +192,7 @@ const word = {data } const tag = {sa, tags - for t in tags + for t : tags std.htput(sa, t, (-1, -1, -1)) ;; } diff --git a/mbld/test.myr b/mbld/test.myr index a6a35f7..16ab59f 100644 --- a/mbld/test.myr +++ b/mbld/test.myr @@ -27,14 +27,14 @@ const test = {b tests = [][:] buildall(b) setdir(b, "") - for tn in b.all + for tn : b.all match gettarg(b.targs, tn) | `Bin bt: std.sljoin(&tests, buildtests(b, bt)) | `Lib lt: std.sljoin(&tests, buildtests(b, lt)) | _: /* nothing */ ;; ;; - for tn in b.all + for tn : b.all match gettarg(b.targs, tn) | `Bin t: if !t.istest @@ -58,14 +58,14 @@ const test = {b ok = true failed = [][:] - for (c, dir) in tests + for (c, dir) : tests setdir(b, dir) if !runtest(b, c, &failed) ok = false ;; ;; - for (bin, dir) in tests + for (bin, dir) : tests freecmd(bin) std.slfree(dir) ;; @@ -74,7 +74,7 @@ const test = {b ;; printfailed(failed) - for f in failed + for f : failed std.slfree(f) ;; if ok @@ -90,7 +90,7 @@ const test = {b const printfailed = {failed if failed.len > 0 mbldput("FAILURES: {}\n", failed.len) - for t in failed + for t : failed mbldput("\t{}\n", t) ;; ;; @@ -100,14 +100,14 @@ const dupcmd = {cmd var ret ret = [][:] - for c in cmd + for c : cmd std.slpush(&ret, std.sldup(c)) ;; -> ret } const freecmd = {cmd - for c in cmd + for c : cmd std.slfree(c) ;; std.slfree(cmd) @@ -119,7 +119,7 @@ const buildtests = {b, targ tests = [][:] setdir(b, targ.dir) - for s in targ.inputs + for s : targ.inputs match testpath(s) | `std.None: /* nothing to do */ | `std.Some path: @@ -152,7 +152,7 @@ const runtest = {b, cmd, failed var sub mbldput("run") - for c in cmd + for c : cmd p = std.pathcat(b.curdir, c) mbldput(" {}", p) std.slfree(p) diff --git a/mbld/util.myr b/mbld/util.myr index 5cec15c..9b561c5 100644 --- a/mbld/util.myr +++ b/mbld/util.myr @@ -51,7 +51,7 @@ const printcmd = {lst if lst.len > 0 mbldput("\t") mbldput("{}\t", lst[0]) - for l in lst[1:] + for l : lst[1:] mbldput("{} ", l) ;; ;; @@ -111,7 +111,7 @@ const srcswapsuffix = {src, new } const strlistfree = {sl - for s in sl + for s : sl std.slfree(s) ;; std.slfree(sl) |