summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mbld/build.myr36
-rw-r--r--mbld/clean.myr6
-rw-r--r--mbld/deps.myr34
-rw-r--r--mbld/install.myr18
-rw-r--r--mbld/main.myr4
-rw-r--r--mbld/parse.myr58
-rw-r--r--mbld/test.myr12
-rw-r--r--mbld/util.myr30
8 files changed, 99 insertions, 99 deletions
diff --git a/mbld/build.myr b/mbld/build.myr
index c154129..1a508ba 100644
--- a/mbld/build.myr
+++ b/mbld/build.myr
@@ -52,7 +52,7 @@ const build = {b, targ
| `std.Some (`Gen gt): runin(b, gt.cmd, gt.dir)
| `std.Some (`Cmd ct): runin(b, ct.cmd, ct.dir)
| `std.Some (`Man mt): /* nothing needed */
- | `std.None: std.fatal("invalid target %s\n", targ)
+ | `std.None: std.f2fatal("invalid target {}\n", targ)
;;
-> true
}
@@ -67,10 +67,10 @@ const buildbin = {b, targ, addsrc
setdir(b, targ.dir)
addincludes(b, targ)
- std.put("%s...\n", targ.name)
+ std.f2put("{}...\n", targ.name)
dg = myrdeps(b, targ, false, addsrc)
if !std.hthas(dg.deps, targ.name)
- std.fatal("no input files for %s\n", targ.name)
+ std.f2fatal("no input files for {}\n", targ.name)
;;
if builddep(b, dg, targ.name, targ.incpath) || !freshlibs(targ, dg.libs)
src = std.htkeys(dg.sources)
@@ -88,11 +88,11 @@ const buildlib = {b, targ
setdir(b, targ.dir)
addincludes(b, targ)
lib = targ.name
- std.put("lib%s.a...\n", lib)
- archive = std.fmt("lib%s.a", lib)
+ std.f2put("lib{}.a...\n", lib)
+ archive = std.f2fmt("lib{}.a", lib)
dg = myrdeps(b, targ, false, false)
if !std.hthas(dg.deps, lib)
- std.fatal("no target declared for %s\n", lib)
+ std.f2fatal("no target declared for {}\n", lib)
;;
u = builddep(b, dg, targ.name, targ.incpath)
l = builddep(b, dg, archive, targ.incpath)
@@ -155,7 +155,7 @@ const builddep = {b, dg, out, incs
;;
| `std.None:
if !std.fexists(d)
- std.fatal("no input file %s\n", d)
+ std.f2fatal("no input file {}\n", d)
;;
;;
if !isfresh(d, out)
@@ -204,7 +204,7 @@ const compile = {src, incs
run(cmd)
std.slfree(o)
else
- std.fatal("Unknown file type for %s\n", src)
+ std.f2fatal("Unknown file type for {}\n", src)
;;
}
@@ -257,7 +257,7 @@ const archivelib = {dg, lib, files, incs
for c in config.Arcmd
cmd = std.slpush(cmd, std.sldup(c))
;;
- cmd = std.slpush(cmd, std.fmt("lib%s.a", lib))
+ cmd = std.slpush(cmd, std.f2fmt("lib{}.a", lib))
for f in files
obj = srcswapsuffix(f, config.Objsuffix)
cmd = std.slpush(cmd, obj)
@@ -277,7 +277,7 @@ const mergeuse = {dg, lib, files, incs
if std.hassuffix(f, ".myr")
cmd = std.slpush(cmd, srcswapsuffix(f, ".use"))
elif !std.hassuffix(f, ".s")
- std.fatal("unknown file type for %s\n", f)
+ std.f2fatal("unknown file type for {}\n", f)
;;
;;
run(cmd)
@@ -293,7 +293,7 @@ const addlibs = {cmd, libgraph, incs
/* -L incpath... */
if !config.Directlib
for inc in incs
- cmd = std.slpush(cmd, std.fmt("-L%s", inc))
+ cmd = std.slpush(cmd, std.f2fmt("-L{}", inc))
;;
;;
@@ -311,7 +311,7 @@ const addlibs = {cmd, libgraph, incs
const visit = {cmd, head, g, lib, looped, marked, incs
if std.hthas(looped, lib)
- std.fatal("cycle in library graph involving \"%s\"\n", lib)
+ std.f2fatal("cycle in library graph involving \"{}\"\n", lib)
elif std.hthas(marked, lib)
-> cmd
;;
@@ -327,11 +327,11 @@ const visit = {cmd, head, g, lib, looped, marked, incs
const putlib = {cmd, head, lib, incs
if !config.Directlib
- -> std.slput(cmd, head, std.fmt("-l%s", lib))
+ -> std.slput(cmd, head, std.f2fmt("-l", lib))
else
match findlib(lib, incs)
| `std.None:
- std.fatal("could not find library lib%s.a\n", lib)
+ std.f2fatal("could not find library lib{}.a\n", lib)
| `std.Some p:
-> std.slput(cmd, head, p)
;;
@@ -366,10 +366,10 @@ const freshlibs = {targ, libgraph
;;
std.slfree(lib)
| `std.None:
- std.fput(1, "%s: could not find library lib%s.a\n", targ.name, l)
- std.fput(1, "searched:\n")
+ std.f2fput(1, "{}: could not find library lib{}.a\n", targ.name, l)
+ std.f2fput(1, "searched:\n")
for inc in targ.incpath
- std.fput(1, "\t%s\n", inc)
+ std.f2fput(1, "\t{}\n", inc)
;;
std.exit(1)
;;
@@ -401,7 +401,7 @@ const isfresh = {src, dst
*/
match std.fmtime(src)
| `std.Some mt: srcmt = mt
- | `std.None: std.fatal("could not stat %s\n", src)
+ | `std.None: std.f2fatal("could not stat {}\n", src)
;;
match std.fmtime(dst)
| `std.Some mt: dstmt = mt
diff --git a/mbld/clean.myr b/mbld/clean.myr
index abe8956..6f4fb2f 100644
--- a/mbld/clean.myr
+++ b/mbld/clean.myr
@@ -24,7 +24,7 @@ const cleanall = {b
| `Gen gt:
for f in gt.out
if !gt.durable && std.remove(f)
- std.put("\tclean %s\n", f)
+ std.f2put("\tclean {}\n", f)
;;
;;
| `Cmd ct: /* nothing to do */
@@ -52,7 +52,7 @@ const clean = {b, targ
| `Gen gt:
for f in gt.out
if !gt.durable && std.remove(f)
- std.put("\tclean %s\n", f)
+ std.f2put("\tclean {}\n", f)
;;
;;
| `Cmd ct:
@@ -80,7 +80,7 @@ const cleanup = {b, targ, leaves
keys = std.htkeys(dg.deps)
for k in keys
if !std.htgetv(mchammer_files, k, false) && std.remove(k)
- std.put("\tclean %s\n", k)
+ std.f2put("\tclean {}\n", k)
;;
;;
}
diff --git a/mbld/deps.myr b/mbld/deps.myr
index b2cb080..2a99612 100644
--- a/mbld/deps.myr
+++ b/mbld/deps.myr
@@ -48,7 +48,7 @@ const myrdeps = {b, mt, doclean, addsrc
])
/* direct dependencies of binary */
if mt.islib
- out = std.fmt("lib%s.a", mt.name)
+ out = std.f2fmt("lib{}.a", mt.name)
useout = std.sldup(mt.name)
else
out = std.sldup(mt.name)
@@ -106,13 +106,13 @@ const dumpgraph = {dg
->
;;
keys = std.htkeys(dg.deps)
- std.put("digraph dg {\n")
+ std.f2put("digraph dg {{\n")
for k in keys
for v in std.htgetv(dg.deps, k, ["WTFUNKNOWN!"][:])
- std.put("\t\"%s\" -> \"%s\";\n", k, v)
+ std.f2put("\t\"{}\" -> \"{}\";\n", k, v)
;;
;;
- std.put("}\n")
+ std.f2put("}\n")
}
const srcdeps = {b, ds, g, path, obj, usefile
@@ -124,9 +124,9 @@ const srcdeps = {b, ds, g, path, obj, usefile
ds.depstk = std.slpush(ds.depstk, path)
if std.htgetv(g.seen, path, false)
- std.fput(1, "dependency loop involving %s:\n", path)
+ std.f2fput(1, "dependency loop involving {}:\n", path)
for d in ds.depstk
- std.fput(1, "\t%s\n", d)
+ std.fput(1, "\t{}\n", d)
;;
std.exit(1)
;;
@@ -165,7 +165,7 @@ const addusedep = {b, ds, g, f, usefile, line
if std.hthas(g.done, usefile)
if opt_debug
- std.put("already loaded deps for %s\n", usefile)
+ std.f2put("already loaded deps for {}\n", usefile)
;;
->
;;
@@ -177,7 +177,7 @@ const addusedep = {b, ds, g, f, usefile, line
if ds.addsrc
std.htput(g.sources, src, true)
elif !std.hthas(g.input, usefile)
- std.fatal("%s:%i: source file %s not listed in bldfile\n", f, line, src)
+ std.f2fatal("{}:{}: source file {} not listed in bldfile\n", f, line, src)
;;
;;
pushdep(g, src, usefile)
@@ -194,12 +194,12 @@ const getdeps = {b, ds, path
if !std.fexists(path)
match std.htget(b.gensrc, path)
| `std.Some gt: run(gt.cmd)
- | `std.None: std.fatal("no input file %s\n", path)
+ | `std.None: std.f2fatal("no input file {}\n", path)
;;
;;
match bio.open(path, bio.Rd)
| `std.Some fd: f = fd
- | `std.None: std.fatal("could not open %s\n", path)
+ | `std.None: std.f2fatal("could not open {}\n", path)
;;
lnum = 0
@@ -230,14 +230,14 @@ const scrapelibs = {dg, lib, incs
f = openlib(lib, incs)
match bio.getc(f)
| `std.Some 'U': /* nothing */
- | `std.Some _: std.fatal("library %s: corrupt or invalid usefile\n", lib)
- | `std.None: std.fatal("library %s: could not read usefile\n", lib)
+ | `std.Some _: std.f2fatal("library {}: corrupt or invalid usefile\n", lib)
+ | `std.None: std.f2fatal("library {}: could not read usefile\n", lib)
;;
match bio.getbe32(f)
| `std.Some 1: /* nothing: version matches. */
- | `std.Some 0: std.fput(1, "library %s: warning: old usefile version\n", lib)
- | `std.Some _: std.fatal("library %s: usefile version unknown\n", lib)
- | `std.None: std.fatal("library %s: corrutpt or invalid usefile\n", lib)
+ | `std.Some 0: std.f2fput(1, "library {}: warning: old usefile version\n", lib)
+ | `std.Some _: std.f2fatal("library {}: usefile version unknown\n", lib)
+ | `std.None: std.f2fatal("library {}: corrutpt or invalid usefile\n", lib)
;;
std.slfree(rdstr(f))
done = false
@@ -276,7 +276,7 @@ const openlib = {lib, incs
| `std.None:
/* nothing */
;;
- std.fatal("could not find library %s.\n", lib)
+ std.f2fatal("could not find library {}.\n", lib)
}
const depname = {deps, ln, lnum
@@ -304,7 +304,7 @@ const pushdep = {dg, src, dst
var sl
if opt_debug
- std.put("%s <= %s\n", dst, src)
+ std.f2put("{} <= {}\n", dst, src)
;;
std.assert(dst.len < 200, "BUG!")
sl = std.htgetv(dg.deps, dst, [][:])
diff --git a/mbld/install.myr b/mbld/install.myr
index 8d6fbeb..e88a43a 100644
--- a/mbld/install.myr
+++ b/mbld/install.myr
@@ -34,7 +34,7 @@ const movetargs = {b, rm
| `Lib lt:
if lt.install
movefile(b, rm, lt.dir, lt.name, config.Libpath, 0o644)
- libarchive = std.fmt("lib%s.a", lt.name)
+ libarchive = std.f2fmt("lib{}.a", lt.name)
movefile(b, rm, lt.dir, libarchive, config.Libpath, 0o644)
std.slfree(libarchive)
;;
@@ -60,18 +60,18 @@ const movefile = {b, rm, dir, file, prefix, perm
setdir(b, dir)
path = std.pathjoin([opt_destdir, opt_instroot, prefix, file][:])
if rm
- std.put("\trm %s\n", path)
+ std.f2put("\trm {}\n", path)
if !std.remove(path)
- std.put("\t\tno such file %s\n", file)
+ std.f2put("\t\tno such file {}\n", file)
;;
else
- std.put("\t%s => %s\n", file, path)
+ std.f2put("\t{} => {}\n", file, path)
std.remove(path)
match std.slurp(file)
- | `std.Fail m: std.fatal("Could not open %s for reading\n", file)
+ | `std.Fail m: std.f2fatal("Could not open {} for reading\n", file)
| `std.Ok buf:
if !std.blat(path, buf, perm)
- std.put("Could not write %s\n", file)
+ std.f2put("Could not write {}\n", file)
;;
std.slfree(buf)
;;
@@ -84,15 +84,15 @@ const moveman = {b, rm, dir, man
match std.strrfind(man, ".")
| `std.None:
- std.fatal("manpage %s has no section\n", man)
+ std.f2fatal("manpage {} has no section\n", man)
| `std.Some s:
sect = s + 1
if s + 1 == man.len
- std.fatal("manpage %s missing suffix\n", man)
+ std.f2fatal("manpage {} missing suffix\n", man)
;;
;;
- manrel = std.fmt("%s%s", opt_manpath, man[sect:])
+ manrel = std.f2fmt("{}{}", opt_manpath, man[sect:])
movefile(b, rm, dir, man, manrel, 0o644)
std.slfree(manrel)
}
diff --git a/mbld/main.myr b/mbld/main.myr
index 60710d5..f6d2dcb 100644
--- a/mbld/main.myr
+++ b/mbld/main.myr
@@ -96,7 +96,7 @@ const main = {args : byte[:][:]
findproj(b, "bld.proj")
bld.load(b)
for t in b.all
- std.put("%s\n", t)
+ std.f2put("{}\n", t)
;;
else
findproj(b, "bld.proj")
@@ -133,7 +133,7 @@ const mkbuild = {
const findproj = {b, bldfile
if !findbase(b, bldfile) || !std.chdir(b.basedir)
- std.fatal("could not find %s\n", bldfile)
+ std.f2fatal("could not find {}\n", bldfile)
;;
bld.setdir(b, "")
}
diff --git a/mbld/parse.myr b/mbld/parse.myr
index e572cd3..88043dc 100644
--- a/mbld/parse.myr
+++ b/mbld/parse.myr
@@ -59,7 +59,7 @@ const loadall = {b, path, dir
loadall(b, subproj, subpath)
b.basedir = curbase
else
- std.fatal("could not open %s or %s \n", subbld, subproj)
+ std.f2fatal("could not open {} or {} \n", subbld, subproj)
;;
std.slfree(subbld)
std.slfree(subproj)
@@ -91,7 +91,7 @@ const sortdeps = {b
const visit = {all, b, targ, looped, marked
if std.hthas(looped, targ)
- std.fatal("cycle in build depgraph involving %s\n", targ)
+ std.f2fatal("cycle in build depgraph involving {}\n", targ)
elif std.hthas(marked, targ)
-> all
;;
@@ -109,7 +109,7 @@ const getdeps = {targ
match targ
| `Bin t: -> t.libdeps
| `Lib t: -> t.libdeps
- | _: std.fatal("depending on non-library target")
+ | _: std.f2fatal("depending on non-library target")
;;
}
@@ -123,7 +123,7 @@ const mkparser = {path, dir, basedir
p.basedir = std.sldup(basedir)
match std.slurp(path)
| `std.Ok d: p.data = d
- | `std.Fail _: std.fatal("could not open '%s'\n", path)
+ | `std.Fail _: std.f2fatal("could not open '{}'\n", path)
;;
p.rest = p.data
-> p
@@ -145,7 +145,7 @@ const failparse = {p, msg, args : ...
ap = std.vastart(&args)
sl = std.bfmtv(buf[:], msg, ap)
- std.fput(1, "%s:%i: %s", p.fname, p.line, sl)
+ std.f2fput(1, "{}:{}: {}", p.fname, p.line, sl)
std.exit(1)
}
@@ -158,7 +158,7 @@ const parse = {b, p, path
;;
skipspace(p)
if p.rest.len > 0
- failparse(p, "junk in file near %s\n", p.rest[:std.min(p.rest.len, 10)])
+ failparse(p, "junk in file near {}\n", p.rest[:std.min(p.rest.len, 10)])
-> false
;;
-> true
@@ -173,7 +173,7 @@ const target = {b, p
| `std.Some "cmd": cmdtarget(b, p, "cmd", true)
| `std.Some "man": mantarget(b, p)
| `std.Some "sub": subtarget(b, p)
- | `std.Some targtype: failparse(p, "unknown targtype type %s\n", targtype)
+ | `std.Some targtype: failparse(p, "unknown targtype type {}\n", targtype)
| `std.None: -> false
;;
-> true
@@ -230,10 +230,10 @@ const cmdtarget = {b, p, cmd, iscmd
var gt
match wordlist(p)
- | `std.None: failparse(p, "%s target missing output files\n", cmd)
+ | `std.None: failparse(p, "{} target missing output files\n", cmd)
| `std.Some out:
if iscmd && out.len != 1
- failparse(p, "%s target takes one name\n", cmd)
+ failparse(p, "{} target takes one name\n", cmd)
;;
outlist = out
;;
@@ -242,7 +242,7 @@ const cmdtarget = {b, p, cmd, iscmd
if !iscmd && matchc(p, '{')
match attrlist(p)
| `std.Some al: attrs = al
- | `std.None: failparse(p, "invalid attr list for %s\n", outlist[0])
+ | `std.None: failparse(p, "invalid attr list for {}\n", outlist[0])
;;
else
attrs = [][:]
@@ -250,17 +250,17 @@ const cmdtarget = {b, p, cmd, iscmd
skipspace(p)
if !matchc(p, '=')
- failparse(p, "expected '=' after '%s %s'\n", cmdlist, outlist[outlist.len-1])
+ failparse(p, "expected '=' after '{} {}'\n", cmdlist, outlist[outlist.len-1])
;;
match wordlist(p)
- | `std.None: failparse(p, "%s target missing command\n", cmd)
+ | `std.None: failparse(p, "{} target missing command\n", cmd)
| `std.Some cl:
cmdlist = cl
;;
if !matchc(p, ';') || !matchc(p, ';')
- failparse(p, "expected ';;' terminating genfile command, got %c\n", peekc(p))
+ failparse(p, "expected ';;' terminating genfile command, got {}\n", peekc(p))
;;
durable = false
@@ -271,9 +271,9 @@ const cmdtarget = {b, p, cmd, iscmd
| ("dep", depname): deplist = std.slpush(deplist, depname)
| ("sys", tags): systags = std.slpush(systags, tags)
| (attr, ""):
- failparse(p, "attribute %s not valid on %s targets\n", attr, cmd)
+ failparse(p, "attribute {} not valid on {} targets\n", attr, cmd)
| (attr, val):
- failparse(p, "attribute %s=%s not valid on %s targets\n", attr, val, cmd)
+ failparse(p, "attribute {}={} not valid on {} targets\n", attr, val, cmd)
;;
;;
@@ -306,14 +306,14 @@ const myrtarget = {p, targ
match word(p)
| `std.Some n: name = n
- | `std.None: failparse(p, "expected target name after '%s'\n", targ)
+ | `std.None: failparse(p, "expected target name after '{}'\n", targ)
;;
skipspace(p)
if matchc(p, '{')
match attrlist(p)
| `std.Some al: attrs = al
- | `std.None: failparse(p, "invalid attr list for %s %s\n", targ, name)
+ | `std.None: failparse(p, "invalid attr list for {} {}\n", targ, name)
;;
else
attrs = [][:]
@@ -321,7 +321,7 @@ const myrtarget = {p, targ
skipspace(p)
if !matchc(p, '=')
- failparse(p, "expected '=' after '%s %s'\n", targ, name)
+ failparse(p, "expected '=' after '{} {}'\n", targ, name)
;;
match inputlist(p)
@@ -333,12 +333,12 @@ const myrtarget = {p, targ
;;
inputs = fselfin(fsel)
std.slfree(wl)
- | `std.None: failparse(p, "expected list of file names after '%s %s'\n", targ, name)
+ | `std.None: failparse(p, "expected list of file names after '{} {}'\n", targ, name)
;;
skipspace(p)
if !matchc(p, ';') || !matchc(p, ';')
- failparse(p, "expected ';;' terminating input list, got %c\n", peekc(p))
+ failparse(p, "expected ';;' terminating input list, got {}\n", peekc(p))
;;
inst = true
@@ -353,7 +353,7 @@ const myrtarget = {p, targ
| ("noinst", ""): inst = false
| ("sys", tags): systags = std.slpush(systags, tags)
| (invalid, _):
- std.fatal("%s: got invalid attr '%s'\n", targ, invalid)
+ std.f2fatal("{}: got invalid attr '{}'\n", targ, invalid)
;;
;;
for inc in bld.opt_incpaths
@@ -382,11 +382,11 @@ const anontarget = {p, targ
inputs = [][:]
skipspace(p)
if !matchc(p, '=')
- failparse(p, "expected '=' after '%s' target\n", targ)
+ failparse(p, "expected '=' after '{}' target\n", targ)
;;
match wordlist(p)
- | `std.None: failparse(p, "expected list of file names after '%s' target\n", targ)
+ | `std.None: failparse(p, "expected list of file names after '{}' target\n", targ)
| `std.Some wl: inputs = wl
;;
skipspace(p)
@@ -430,7 +430,7 @@ const attrlist = {p
;;
;;
if !matchc(p, '}')
- failparse(p, "expected '}' at end of attr list, got '%c'\n", peekc(p))
+ failparse(p, "expected '}' at end of attr list, got '{}'\n", peekc(p))
;;
if al.len == 0
-> `std.None
@@ -596,9 +596,9 @@ const getc = {p
const addtarg = {p, b, name, targ
var tn
- tn = std.fmt("%s:%s", p.fdir, name)
+ tn = std.f2fmt("{}:{}", p.fdir, name)
if std.hthas(b.targs, tn)
- failparse(p, "duplicate target %s\n", tn)
+ failparse(p, "duplicate target {}\n", tn)
;;
b.all = std.slpush(b.all, tn)
std.htput(b.targs, tn, targ)
@@ -611,10 +611,10 @@ const libpath = {p, libpath
| `std.None:
dir = std.sldup(".")
lib = std.sldup(libpath)
- targ = std.fmt("%s:%s", p.fdir, lib)
+ targ = std.f2fmt("{}:{}", p.fdir, lib)
| `std.Some idx:
if idx == libpath.len
- std.fatal("libdep %s missing library after ':'\n")
+ std.f2fatal("libdep {} missing library after ':'\n")
;;
/* absolute path */
if std.hasprefix(libpath, "@/") || std.hasprefix(libpath, "@:")
@@ -627,7 +627,7 @@ const libpath = {p, libpath
lib = std.sldup(libpath[idx+1:])
targ = std.pathcat(p.fdir, libpath)
if std.hasprefix(targ, "../")
- std.fatal("library %s outside of project\n", libpath)
+ std.f2fatal("library {} outside of project\n", libpath)
;;
;;
;;
diff --git a/mbld/test.myr b/mbld/test.myr
index ae603a0..4f253ae 100644
--- a/mbld/test.myr
+++ b/mbld/test.myr
@@ -55,9 +55,9 @@ const test = {b
;;
if hastest
if ok
- std.put("TESTS PASSED\n")
+ std.f2put("TESTS PASSED\n")
else
- std.put("TESTS FAILED\n")
+ std.f2put("TESTS FAILED\n")
std.exit(1)
;;
;;
@@ -121,11 +121,11 @@ const cleantest = {b, src
const runtest = {bin
var r, log
- std.put("run %s:\t", bin)
+ std.f2put("run {}:\t", bin)
log = std.strcat(bin, ".log")
match std.spork([bin][:])
| `std.Fail m:
- std.fatal("unable to run test: %s\n", m)
+ std.f2fatal("unable to run test: {}\n", m)
| `std.Ok (pid, infd, outfd):
match std.fslurp(outfd)
| `std.Ok "": /* empty output; nothing to log */
@@ -137,8 +137,8 @@ const runtest = {bin
r = false
match std.wait(pid)
- | `std.Wfailure: std.put("FAIL\n")
- | `std.Wsignalled: std.put("CRASH\n")
+ | `std.Wfailure: std.f2put("FAIL\n")
+ | `std.Wsignalled: std.f2put("CRASH\n")
| `std.Wsuccess:
std.put("PASS\n")
r = true
diff --git a/mbld/util.myr b/mbld/util.myr
index 9e11a35..3325e66 100644
--- a/mbld/util.myr
+++ b/mbld/util.myr
@@ -20,30 +20,30 @@ const run = {cmd
printcmd(cmd)
pid = std.fork()
if pid == -1
- std.fatal("could not fork command\n")
+ std.f2fatal("could not fork command\n")
elif pid == 0
if std.execvp(cmd[0], cmd) < 0
- std.fatal("failed to exec %s\n", cmd[0])
+ std.f2fatal("failed to exec {}\n", cmd[0])
;;
else
match std.wait(pid)
| `std.Wsuccess: /* nothing */
- | `std.Wfailure: std.fatal("FAIL: \"%s\"\n", std.strjoin(cmd, " "))
- | `std.Wsignalled: std.fatal("CRASH: \"%s\"\n", std.strjoin(cmd, " "))
- | `std.Waiterror: std.fatal("WAT: \"%s\"\n", std.strjoin(cmd, " "))
+ | `std.Wfailure: std.f2fatal("FAIL: \"{}\"\n", std.strjoin(cmd, " "))
+ | `std.Wsignalled: std.f2fatal("CRASH: \"{}\"\n", std.strjoin(cmd, " "))
+ | `std.Waiterror: std.f2fatal("WAT: \"{}\"\n", std.strjoin(cmd, " "))
;;
;;
}
const printcmd = {lst
if lst.len > 0
- std.put("\t")
- std.put("%s\t", lst[0])
+ std.f2put("\t")
+ std.f2put("{}\t", lst[0])
for l in lst[1:]
- std.put("%s ", l)
+ std.f2put("{} ", l)
;;
;;
- std.put("\n")
+ std.f2put("\n")
}
const srcsplit = {src
@@ -73,7 +73,7 @@ const swapsuffix = {f, suff, newsuff
if std.hassuffix(f, suff)
f = f[:f.len - suff.len]
;;
- -> std.fmt("%s%s", f, newsuff)
+ -> std.f2fmt("{}{}", f, newsuff)
}
const srcswapsuffix = {src, new
@@ -85,7 +85,7 @@ const srcswapsuffix = {src, new
elif std.sleq(suff, ".s")
-> std.strcat(base, new)
else
- std.fatal("unrecognized source %s\n", src)
+ std.f2fatal("unrecognized source {}\n", src)
;;
}
@@ -98,7 +98,7 @@ const strlistfree = {sl
const gettarg = {tab, n
match std.htget(tab, n)
- | `std.None: std.fatal("internal: nonexistent %s\n", n)
+ | `std.None: std.f2fatal("internal: nonexistent {}\n", n)
| `std.Some t: -> t
;;
}
@@ -109,12 +109,12 @@ const setdir = {b, dir
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.f2put("Leaving directory '{}'\n", b.curdir)
;;
- std.put("Entering directory '%s'\n", dir)
+ std.f2put("Entering directory '{}'\n", dir)
if !std.chdir(p)
- std.fatal("could not cd into %s\n", p)
+ std.f2fatal("could not cd into {}\n", p)
;;
b.curdir = dir
std.slfree(p)