diff options
Diffstat (limited to 'lib')
43 files changed, 126 insertions, 124 deletions
diff --git a/lib/bio/bio.myr b/lib/bio/bio.myr index be82867..465cc93 100644 --- a/lib/bio/bio.myr +++ b/lib/bio/bio.myr @@ -354,7 +354,7 @@ const getc = {f } /* ensures we have enough to read a single codepoint in the buffer */ -const ensurecodepoint : (f : file# -> status(std.size)) = {f +const ensurecodepoint = {f var b var len @@ -702,7 +702,7 @@ const geterr = {f -> errtype(e) } -const errtype : (e : std.errno -> ioerr )= {e : std.errno -> ioerr +const errtype = {e : std.errno -> ioerr var errno errno = (e : std.errno) diff --git a/lib/crypto/test/aes.myr b/lib/crypto/test/aes.myr index 46c5a64..1ad9036 100644 --- a/lib/crypto/test/aes.myr +++ b/lib/crypto/test/aes.myr @@ -8,28 +8,28 @@ type aestest = struct ;; const main = { - for tc in ECBVarKey128encvecs + for tc : ECBVarKey128encvecs enctest(tc) ;; - for tc in ECBVarKey192encvecs + for tc : ECBVarKey192encvecs enctest(tc) ;; - for tc in ECBVarKey256encvecs + for tc : ECBVarKey256encvecs enctest(tc) ;; - for tc in ECBVarKey128decvecs + for tc : ECBVarKey128decvecs dectest(tc) ;; - for tc in ECBVarKey192decvecs + for tc : ECBVarKey192decvecs dectest(tc) ;; - for tc in ECBVarKey256decvecs + for tc : ECBVarKey256decvecs dectest(tc) ;; - for tc in ECBVarKey128encbigvecs + for tc : ECBVarKey128encbigvecs bigenctest(tc) ;; - for tc in ECBVarKey128decbigvecs + for tc : ECBVarKey128decbigvecs bigdectest(tc) ;; } diff --git a/lib/crypto/test/chacha20.myr b/lib/crypto/test/chacha20.myr index e9c09f4..7ca349f 100644 --- a/lib/crypto/test/chacha20.myr +++ b/lib/crypto/test/chacha20.myr @@ -848,7 +848,7 @@ const check = {chk crypto.chacha20keysetup(&st, chk.key) crypto.chacha20ivsetup(&st, chk.iv) - for (i, s) in std.byenum(chk.state) + for (i, s) : std.byenum(chk.state) std.assert(st.input[i] == s, "mismatched state\n") ;; diff --git a/lib/crypto/test/util.myr b/lib/crypto/test/util.myr index ceb411c..e6a3211 100644 --- a/lib/crypto/test/util.myr +++ b/lib/crypto/test/util.myr @@ -8,7 +8,7 @@ const hasheq = {got, expected var sb, str sb = std.mksb() - for x in got + for x : got std.sbfmt(sb, "{p=0,w=2,x}", x) ;; str = std.sbfin(sb) diff --git a/lib/date/fmt.myr b/lib/date/fmt.myr index bc57500..c66827b 100644 --- a/lib/date/fmt.myr +++ b/lib/date/fmt.myr @@ -18,14 +18,14 @@ const __init__ = { ][:]) } -/* Always formats in proleptic Gregorian format */ +/* Always formats : proleptic Gregorian format */ const sbfmt = {sb, ap, opts var d : instant var fmt d = std.vanext(ap) fmt = Datetimefmt; - for o in opts + for o : opts match o | ("d", ""): fmt = Datefmt | ("t", ""): fmt = Timefmt diff --git a/lib/date/test/fmt.myr b/lib/date/test/fmt.myr index e0aa610..024c7b6 100644 --- a/lib/date/test/fmt.myr +++ b/lib/date/test/fmt.myr @@ -31,7 +31,7 @@ const main = { d = date.mkinstant(-50000000000*1_000_000, "") eq("385-7-25 07:06:40 +0000", std.bfmt(buf[:], "{D}", d)) - /* date in the bc */ + /* date : the bc */ d = date.mkinstant(-70000000000*1_000_000, "") eq("-249-11-19 19:33:20 +0000", std.bfmt(buf[:], "{D}", d)) diff --git a/lib/date/types.myr b/lib/date/types.myr index 3e3af76..0849052 100644 --- a/lib/date/types.myr +++ b/lib/date/types.myr @@ -4,14 +4,14 @@ pkg date = type instant = struct actual : std.time /* epoch time in microseconds */ tzoff : duration /* timezone offset in microseconds */ - year : int /* year, starting at 0 (ie, 1 BCE) */ - mon : int /* month, [1..12] */ - day : int /* day, [1..31] */ - wday : int /* weekday, [0..6] */ - h : int /* hour: [0..23] */ - m : int /* minute: [0..59] */ - s : int /* second: [0..59] */ - us : int /* microsecond: [0..999,999] */ + year : int /* year, starting at 0 (ie, 1 BCE) */ + mon : int /* month, [1..12] */ + day : int /* day, [1..31] */ + wday : int /* weekday, [0..6] */ + h : int /* hour: [0..23] */ + m : int /* minute: [0..59] */ + s : int /* second: [0..59] */ + us : int /* microsecond: [0..999,999] */ tzname : byte[:] /* current time zone name */ _tzbuf : byte[32] /* current time zone name storage */ ;; diff --git a/lib/date/zoneinfo+posixy.myr b/lib/date/zoneinfo+posixy.myr index 26aa916..69b2e85 100644 --- a/lib/date/zoneinfo+posixy.myr +++ b/lib/date/zoneinfo+posixy.myr @@ -47,7 +47,7 @@ const findtzoff = {tz, tm -> std.option(date.duration) path = std.sldup("/etc/localtime") else path = "" - for z in zonepath + for z : zonepath path = std.pathcat(z, tz) if sys.stat(path, &sb) == 0 goto found diff --git a/lib/escfmt/eschtml.myr b/lib/escfmt/eschtml.myr index 950c8bc..e9aea4a 100644 --- a/lib/escfmt/eschtml.myr +++ b/lib/escfmt/eschtml.myr @@ -19,7 +19,7 @@ const htmlfmt = {sb, ap, args var s : byte[:] s = std.vanext(ap) - for c in std.bychar(s) + for c : std.bychar(s) match c | '&': std.sbputs(sb, "&") | '<': std.sbputs(sb, "<") diff --git a/lib/escfmt/escre.myr b/lib/escfmt/escre.myr index 72eb7ae..39c9a30 100644 --- a/lib/escfmt/escre.myr +++ b/lib/escfmt/escre.myr @@ -19,7 +19,7 @@ const refmt = {sb, ap, args var s : byte[:] s = std.vanext(ap) - for c in std.bychar(s) + for c : std.bychar(s) match c | '|': std.sbputs(sb, "\\|") | '*': std.sbputs(sb, "\\*") diff --git a/lib/escfmt/escsh.myr b/lib/escfmt/escsh.myr index 11f6104..b2388b8 100644 --- a/lib/escfmt/escsh.myr +++ b/lib/escfmt/escsh.myr @@ -20,7 +20,7 @@ const shfmt = {sb, ap, args s = std.vanext(ap) std.sbputb(sb, ('\'' : byte)) - for b in s + for b : s if b == ('\'' : byte) std.sbputs(sb, "'\\''") else diff --git a/lib/escfmt/escurl.myr b/lib/escfmt/escurl.myr index 8ca2f4c..1f1841e 100644 --- a/lib/escfmt/escurl.myr +++ b/lib/escfmt/escurl.myr @@ -19,7 +19,7 @@ const urlfmt = {sb, ap, args var s : byte[:] s = std.vanext(ap) - for b in s + for b : s match (b : char) | ':': std.sbfmt(sb, "%{x}", b) | '/': std.sbfmt(sb, "%{x}", b) diff --git a/lib/inifile/parse.myr b/lib/inifile/parse.myr index 28718f9..e2490c2 100644 --- a/lib/inifile/parse.myr +++ b/lib/inifile/parse.myr @@ -25,12 +25,12 @@ const load = {path } const free = {ini - for ((sect, key), val) in std.byhtkeyvals(ini.elts) + for ((sect, key), val) : std.byhtkeyvals(ini.elts) std.slfree(val) std.slfree(sect) std.slfree(key) ;; - for s in ini.sects + for s : ini.sects std.slfree(s) ;; std.slfree(ini.sects) diff --git a/lib/inifile/test/inifile.myr b/lib/inifile/test/inifile.myr index f3c7a98..ccc43f9 100644 --- a/lib/inifile/test/inifile.myr +++ b/lib/inifile/test/inifile.myr @@ -43,7 +43,7 @@ const itersects = { ini = std.try(inifile.load("test/test.ini")) somesect=0 anothersection=0 - for k in inifile.bysection(ini) + for k : inifile.bysection(ini) match k | "somesect": somesect++ | "another section": anothersection++ diff --git a/lib/inifile/write.myr b/lib/inifile/write.myr index deb3ccc..1c7071d 100644 --- a/lib/inifile/write.myr +++ b/lib/inifile/write.myr @@ -44,7 +44,7 @@ const writeini = {f, ini }) oldsect = "" - for (sect, key) in keys + for (sect, key) : keys std.put("sect={}, oldsect={}\n", sect, oldsect) if !std.sleq(sect, oldsect) bio.put(f, "[{}]\n", sect) diff --git a/lib/json/fmt.myr b/lib/json/fmt.myr index 04867f2..fe29688 100644 --- a/lib/json/fmt.myr +++ b/lib/json/fmt.myr @@ -32,7 +32,7 @@ const eltfmt = {sb, e, ind const jstrfmt = {sb, str std.sbputs(sb, "\"") - for c in str + for c : str match (c : char) | '\x0c': std.sbputs(sb, "\\f") | '\\': std.sbputs(sb, "\\\\") @@ -50,7 +50,7 @@ const arrfmt = {sb, arr, ind sep = "" std.sbputs(sb, "[\n") - for e in arr + for e : arr std.sbputs(sb, sep) indent(sb, ind + 1) eltfmt(sb, e, ind + 1) @@ -66,7 +66,7 @@ const objfmt = {sb, obj, ind sep = "" std.sbputs(sb, "{\n") - for (k, v) in obj + for (k, v) : obj std.sbputs(sb, sep) indent(sb, ind + 1) jstrfmt(sb, k) diff --git a/lib/json/parse.myr b/lib/json/parse.myr index ec22d91..d57d991 100644 --- a/lib/json/parse.myr +++ b/lib/json/parse.myr @@ -51,11 +51,11 @@ const free = {j | &(`Num _): /* nothing */ | &(`Str s): std.slfree(s) | &(`Arr a): - for e in a + for e : a free(e) ;; | &(`Obj o): - for (k, v) in o + for (k, v) : o std.slfree(k) free(v) ;; @@ -124,7 +124,7 @@ const parseobj = {p exit(p) -> `std.Ok std.mk(`Obj membs) :error - for (k, v) in membs + for (k, v) : membs std.slfree(k) free(v) ;; @@ -196,7 +196,7 @@ const parsearr = {p -> std.result(elt#, err) exit(p) -> `std.Ok std.mk(`Arr elts) :error - for e in elts + for e : elts free(e) ;; std.slfree(elts) diff --git a/lib/json/test/parse.myr b/lib/json/test/parse.myr index 4ed65dc..893398d 100644 --- a/lib/json/test/parse.myr +++ b/lib/json/test/parse.myr @@ -94,7 +94,7 @@ const filetest = { var dir, data, path dir = std.try(std.diropen("test/inputs")) - for f in std.byentry(dir) + for f : std.byentry(dir) path = std.pathcat("test/inputs", f) data = std.try(std.slurp(path)) /* 'n' indicates expected failure, 'y' indicates expected success, 'i' indicates implementation defined */ @@ -104,7 +104,7 @@ const filetest = { [.name=f, .fn={ctx match json.parse(data) | `std.Err e: /* ok */ - | `std.Ok r: testr.fail(ctx, "succeeded in parsing malformed json: {}\n", r) + | `std.Ok r: testr.fail(ctx, "succeeded : parsing malformed json: {}\n", r) std.die("hah") ;; }] diff --git a/lib/regex/compile.myr b/lib/regex/compile.myr index 5228d08..edfa3aa 100644 --- a/lib/regex/compile.myr +++ b/lib/regex/compile.myr @@ -85,7 +85,7 @@ const free = {re if re.debug std.htfree(re.astloc) std.slfree(re.pcidx) - for bs in re.traces + for bs : re.traces std.bsfree(bs) ;; std.slfree(re.traces) @@ -128,7 +128,7 @@ const genranges = {re, sl, ast /* generate a trie of ranges */ rt = std.zalloc() - for r in sl + for r : sl /* encode: lo => bounds[loidx] - 1 @@ -226,7 +226,7 @@ const rtinsert = {rt, lo, hi } const rtfree = {rt - for l in rt.link + for l : rt.link rtfree(l) ;; std.slfree(rt.link) @@ -270,7 +270,7 @@ const rangeprogsize = {rt sz = 0 else sz = 2*rt.ranges.len - 1 - for l in rt.link + for l : rt.link sz += rangeprogsize(l) ;; ;; @@ -454,7 +454,7 @@ const dump = {re, t, indent std.put("Chr {}\n", c) | `Ranges rl: std.put("Ranges") - for r in rl + for r : rl for var i = 0; i < indent + 1; i++ std.put(" ") ;; @@ -797,7 +797,7 @@ const negate = {rng neg = [][:] start = 0 next = 0 /* if we have no ranges */ - for r in rng + for r : rng (end, next) = (r[0], r[1]) std.slpush(&neg, [start, end - 1]) start = next + 1 @@ -817,7 +817,7 @@ const merge = {rl ret = [][:] lo = rl[0][0] hi = rl[0][1] - for r in rl[1:] + for r : rl[1:] /* if it overlaps or abuts, merge */ if r[0] <= hi + 1 hi = r[1] diff --git a/lib/regex/interp.myr b/lib/regex/interp.myr index 6c2c68b..c7e8514 100644 --- a/lib/regex/interp.myr +++ b/lib/regex/interp.myr @@ -223,7 +223,7 @@ const run = {re, str, idx, wholestr re.runq = mkthread(re, 0) if re.debug /* The last run could have left things here, since we need this info after the run */ - for bs in re.traces + for bs : re.traces std.bsfree(bs) ;; std.slfree(re.traces) diff --git a/lib/regex/redump.myr b/lib/regex/redump.myr index a69e642..e47b824 100644 --- a/lib/regex/redump.myr +++ b/lib/regex/redump.myr @@ -16,7 +16,7 @@ const main = {args [.opt='v', .desc="dump verbose regex output"] ][:], ]) - for opt in cmd.opts + for opt : cmd.opts match opt | ('v', _): verbose = true | _: std.fatal("Unknown argument") @@ -43,7 +43,7 @@ const main = {args const runall = {re, files - for f in files + for f : files match bio.open(f, bio.Rd) | `std.Ok fd: dump(re, fd) @@ -112,7 +112,7 @@ const showcoverage = {re ;; std.put("\t") - for h in hit + for h : hit if h std.put("^") else diff --git a/lib/std/bigint.myr b/lib/std/bigint.myr index f66659e..45170dd 100644 --- a/lib/std/bigint.myr +++ b/lib/std/bigint.myr @@ -252,7 +252,7 @@ const bigparse = {str fit in one digit. */ v = mkbigint(1) - for c in std.bychar(str) + for c : std.bychar(str) if c == '_' continue ;; diff --git a/lib/std/bitset.myr b/lib/std/bitset.myr index 937e65b..1d846da 100644 --- a/lib/std/bitset.myr +++ b/lib/std/bitset.myr @@ -67,7 +67,7 @@ const bscount = {bs var n n = 0 - for v in bybsvalue(bs) + for v : bybsvalue(bs) n++ ;; -> n diff --git a/lib/std/bytealloc.myr b/lib/std/bytealloc.myr index 6c5d94c..654aa88 100644 --- a/lib/std/bytealloc.myr +++ b/lib/std/bytealloc.myr @@ -56,7 +56,8 @@ type slab = struct nfree : size /* the number of free nodes */ ;; -type chunk = struct /* NB: must be smaller than sizeof(slab) */ +/* NB: must be smaller than sizeof(slab) */ +type chunk = struct next : chunk# /* the next chunk in the free list */ ;; diff --git a/lib/std/dial+posixy.myr b/lib/std/dial+posixy.myr index 15fc58f..386dac5 100644 --- a/lib/std/dial+posixy.myr +++ b/lib/std/dial+posixy.myr @@ -22,6 +22,7 @@ pkg std = a map from service name to a list of (port,proto) pairs in order of preference */ + /* FIXME: implement var services : htab(byte[:], [int, byte[:]][:])# var inited = false diff --git a/lib/std/env+posixy.myr b/lib/std/env+posixy.myr index 3919388..fe73c7e 100644 --- a/lib/std/env+posixy.myr +++ b/lib/std/env+posixy.myr @@ -26,7 +26,7 @@ const getenv = {name var n, env envinit() - for envp in environ + for envp : environ env = cstrconvp(envp) n = min(name.len, env.len) if sleq(name, env[:n]) && sleq(env[n:n+1], "=") @@ -48,7 +48,7 @@ const setenv = {name, val envdup() idx = 0 - for envp in environ + for envp : environ env = cstrconvp(envp) n = min(name.len, env.len) if sleq(name, env[:n]) && sleq(env[n:n+1], "=") diff --git a/lib/std/execvp.myr b/lib/std/execvp.myr index c719e5c..f6696e3 100644 --- a/lib/std/execvp.myr +++ b/lib/std/execvp.myr @@ -21,7 +21,7 @@ const execvp = {cmd, args -> execv(cmd, args) | `None: paths = getpaths() - for p in paths + for p : paths binpath = bfmt(buf[:], "{}/{}", p, cmd) execv(binpath, args) ;; @@ -39,7 +39,7 @@ const execvpe = {cmd, args, env -> execve(cmd, args, env) | `None: paths = getpaths() - for p in paths + for p : paths binpath = bfmt(buf[:], "{}/{}", p, cmd) execve(binpath, args, env) ;; diff --git a/lib/std/fltbits.myr b/lib/std/fltbits.myr index 2a9e8cf..f9afd7a 100644 --- a/lib/std/fltbits.myr +++ b/lib/std/fltbits.myr @@ -24,9 +24,9 @@ const flt64explode = {flt var bits, isneg, mant, exp bits = flt64bits(flt) - isneg = (bits >> 63) != 0 /* msb is sign bit */ + isneg = (bits >> 63) != 0 /* msb is sign bit */ exp = (bits >> 52) & 0x7ff /* exp is in bits [52..63] */ - mant = bits & ((1l << 52) - 1) /* msb is in bits [..51] */ + mant = bits & ((1l << 52) - 1) /* msb is in bits [..51] */ /* add back the implicit bit if this is not a denormal */ if exp != 0 @@ -47,9 +47,9 @@ const flt32explode = {flt var bits, isneg, mant, exp bits = flt32bits(flt) - isneg = (bits >> 31) != 0 /* msb is sign bit */ - exp = (bits >> 22) & 0xff /* exp is in bits [23..30] */ - mant = bits & ((1 << 22) - 1) /* msb is in bits [0..22] */ + isneg = (bits >> 31) != 0 /* msb is sign bit */ + exp = (bits >> 22) & 0xff /* exp is in bits [23..30] */ + mant = bits & ((1 << 22) - 1) /* msb is in bits [0..22] */ /* add back the implicit bit if this is not a denormal */ if exp != 0 diff --git a/lib/std/fmt.myr b/lib/std/fmt.myr index 794218a..e405075 100644 --- a/lib/std/fmt.myr +++ b/lib/std/fmt.myr @@ -216,7 +216,7 @@ const parseparams = {paramstr, optdesc std.fatal("invalid format options {}\n") ;; params = strsplit(paramstr, ",") - for p in params + for p : params /* parse out the key/value pair */ match std.strfind(p, "=") | `std.Some idx: @@ -231,7 +231,7 @@ const parseparams = {paramstr, optdesc found = false /* verify and add the arg */ - for (opt, hasarg) in optdesc + for (opt, hasarg) : optdesc if !std.sleq(opt, o) continue ;; @@ -245,7 +245,7 @@ const parseparams = {paramstr, optdesc ;; if !found std.put("options: \n") - for (opt, hasarg) in optdesc + for (opt, hasarg) : optdesc std.put("\t'{}', hasarg={}\n", opt, hasarg) ;; std.fatal("invalid option '{}' ", o) @@ -427,7 +427,7 @@ const fmtslice = {sb, subap, params ][:]) join = ", " joined = false - for o in opts + for o : opts match o | ("j", j): joined = true @@ -483,7 +483,7 @@ const intparams = {params ("x", false), ("w", true), ("p", true)][:]) - for o in opts + for o : opts match o | ("x", ""): ip.base = 16 | ("w", wid): ip.padto = getint(wid, "fmt: width must be integer") @@ -511,7 +511,7 @@ const strfmt = {sb, str, params ("e", false), ][:]) - for o in opts + for o : opts match o | ("w", wid): w = getint(wid, "fmt: width must be integer") | ("p", pad): p = decode(pad) @@ -523,14 +523,14 @@ const strfmt = {sb, str, params iassert(p >= 0, "pad must be >= 0") std.slfree(opts) if raw - for b in str + for b : str if esc sbputs(sb, "\\x") ;; intfmt(sb, [.padto=2, .padfill='0', .base=16], false, b) ;; elif esc - for b in str + for b : str if isprint(b) sbputb(sb, b) else diff --git a/lib/std/intparse.myr b/lib/std/intparse.myr index e9686b3..18cc478 100644 --- a/lib/std/intparse.myr +++ b/lib/std/intparse.myr @@ -52,7 +52,7 @@ generic doparse = {s, isneg, base -> option(@a::(integral,numeric)) var cv : int32 v = 0 - for c in std.bychar(s) + for c : std.bychar(s) if c == '_' continue ;; diff --git a/lib/std/optparse.myr b/lib/std/optparse.myr index a2cf06c..0569dfc 100644 --- a/lib/std/optparse.myr +++ b/lib/std/optparse.myr @@ -153,7 +153,7 @@ const optdone = {ctx } const optinfo = {ctx, opt - for o in ctx.optdef.opts + for o : ctx.optdef.opts if o.opt == opt -> `Some (o.arg.len != 0, !o.optional, o.dest) ;; @@ -189,13 +189,13 @@ const optusage = {prog, def sb = mksb() std.sbfmt(sb, "usage: {} [-h?", prog) - for o in def.opts + for o : def.opts if o.arg.len == 0 std.sbfmt(sb, "{}", o.opt) ;; ;; std.sbfmt(sb, "] ") - for o in def.opts + for o : def.opts if o.arg.len != 0 std.sbfmt(sb, "[-{} {}] ", o.opt, o.arg) ;; @@ -203,7 +203,7 @@ const optusage = {prog, def std.sbfmt(sb, "{}\n", def.argdesc) std.sbfmt(sb, "\t-h\tprint this help message\n") std.sbfmt(sb, "\t-?\tprint this help message\n") - for o in def.opts + for o : def.opts std.sbfmt(sb, "\t-{}{}{}\t{}\n", o.opt, sep(o.arg), o.arg, o.desc) ;; s = sbfin(sb) diff --git a/lib/std/pathjoin.myr b/lib/std/pathjoin.myr index 2cc2340..eb5e6fd 100644 --- a/lib/std/pathjoin.myr +++ b/lib/std/pathjoin.myr @@ -42,7 +42,7 @@ const pathnorm = {p /* "." is a no-op component, so we drop it. In order to drop a component, we set it to the empty string, - and remove it later on in the code. + and remove it later on. */ for i = 0; i < comps.len; i++ if sleq(comps[i], ".") diff --git a/lib/std/resolve+posixy.myr b/lib/std/resolve+posixy.myr index 50962a7..06250d5 100644 --- a/lib/std/resolve+posixy.myr +++ b/lib/std/resolve+posixy.myr @@ -123,7 +123,7 @@ const loadhosts = { ;; lines = strsplit(h, "\n") - for l in lines + for l : lines /* trim comment */ match strfind(l, "#") | `Some idx: l = l[:idx] @@ -190,7 +190,7 @@ const loadresolv = { ;; lines = strsplit(h, "\n") - for l in lines + for l : lines match strfind(l, "#") | `Some _idx: l = l[:_idx] | `None: @@ -247,7 +247,7 @@ const dnsresolve = {host, rt -> `Err (`Badhost) ;; /* FIXME: Assumption: nameservers is not modified by other threads */ - for ns in nameservers + for ns : nameservers nsrv = dnsconnect(ns) if nsrv >= 0 r = dnsquery(nsrv, host, rt) diff --git a/lib/std/slpush.myr b/lib/std/slpush.myr index 1790073..b09069c 100644 --- a/lib/std/slpush.myr +++ b/lib/std/slpush.myr @@ -10,9 +10,9 @@ generic slpush = {sl, elt slpush relies on implementation details of slgrow for efficiency. Because bucket sizes come in powers of two for all buckets - <= 32k, and we only reallocate when we hit - a bucket boundary, this is effectively - growing the slice by powers of two. + <= 32k, and by powers of 1.5 for larger + slices, this is effectively growing the + slice by powers of two. */ slgrow(sl, sl#.len + 1) sl#[sl#.len - 1] = elt diff --git a/lib/std/test/bitset.myr b/lib/std/test/bitset.myr index 0415be8..13706a6 100644 --- a/lib/std/test/bitset.myr +++ b/lib/std/test/bitset.myr @@ -36,7 +36,7 @@ const main = { std.bsput(bs, 16) std.bsput(bs, 7) std.bsput(bs, 3) - for e in std.bybsvalue(bs) + for e : std.bybsvalue(bs) testr.check(ctx, e == expected[i], "expected[{}] ({}) != {}", i, e, expected[i]) i++ ;; @@ -63,7 +63,7 @@ const mkset = {elts var bs bs = std.mkbs() - for e in elts + for e : elts std.bsput(bs, e) ;; -> bs diff --git a/lib/std/test/bytealloc.myr b/lib/std/test/bytealloc.myr index e6d87d6..7da7de8 100644 --- a/lib/std/test/bytealloc.myr +++ b/lib/std/test/bytealloc.myr @@ -3,9 +3,9 @@ use std const main = { var a : byte#[1000] - for sz in [10, 100, 1000, 10000, 10000] + for sz : [10, 100, 1000, 10000, 10000] std.put("sz: {}\n", sz) - for cnt in [1, 10, 100] + for cnt : [1, 10, 100] std.put("cnt: {}\n", cnt) /* alloc forwards, dealloc forwards */ for var i = 0; i < cnt; i++ diff --git a/lib/std/test/fmt.myr b/lib/std/test/fmt.myr index e8e3f22..67ba2e4 100644 --- a/lib/std/test/fmt.myr +++ b/lib/std/test/fmt.myr @@ -154,7 +154,7 @@ const pairfmt = {sb, ap, opts x = std.vanext(ap) std.sbfmt(sb, "formatted a pair: [{}, {}]", x.x, x.y) - for opt in opts + for opt : opts std.sbputc(sb, ' ') match opt | ("x", val): std.sbfmt(sb, "x={}", val) diff --git a/lib/std/test/ipparse.myr b/lib/std/test/ipparse.myr index 1ea14db..fd6140a 100644 --- a/lib/std/test/ipparse.myr +++ b/lib/std/test/ipparse.myr @@ -69,11 +69,11 @@ const eq = {ip, expected if !std.sleq(p, e) std.fput(1, "misparsed ip {}\n", ip) std.put("parsed: ") - for b in p + for b : p std.put("{x}, ", b) ;; std.put("\nexpected: ") - for b in e + for b : e std.put("{x}, ", b) ;; std.put("\n") diff --git a/lib/std/test/iterutil.myr b/lib/std/test/iterutil.myr index dfa46fa..1d45a4d 100644 --- a/lib/std/test/iterutil.myr +++ b/lib/std/test/iterutil.myr @@ -4,21 +4,21 @@ const main = { var n n = 0 - for (x, i) in std.byenum([1,3,5,7,9][:]) + for (x, i) : std.byenum([1,3,5,7,9][:]) std.assert(x == n, "invalid enum idx {}", x) std.assert(i == n*2 + 1, "invalid enum val {}", i) n++ ;; n = 0 - for (a, b) in std.byzip([0,2,4,6,8][:], [2,4][:]) + for (a, b) : std.byzip([0,2,4,6,8][:], [2,4][:]) std.assert(a == n*2, "invalid val from a: {}", a) std.assert(b == n*2 + 2, "invalid val from b: {}", b) n++ ;; n = 0 - for x in std.byreverse([3, 2, 1, 0][:]) + for x : std.byreverse([3, 2, 1, 0][:]) std.assert(x == n, "invalid reversed value {}, expected {}", x, n) n++ ;; diff --git a/lib/std/test/striter.myr b/lib/std/test/striter.myr index 2684f8d..90b38ed 100644 --- a/lib/std/test/striter.myr +++ b/lib/std/test/striter.myr @@ -6,13 +6,13 @@ const main = { var i i = 0 - for c in std.bychar("abc") + for c : std.bychar("abc") std.assert(chars[i++] == c, "wrong char") ;; std.assert(i == chars.len, "wrong split count") i = 0 - for sp in std.bysplit("foo+++bar", "++") + for sp : std.bysplit("foo+++bar", "++") std.assert(std.streq(splits[i++], sp), "wrong split {}", sp) ;; std.assert(i == splits.len, "wrong split count") diff --git a/lib/sys/sys+freebsd-x64.myr b/lib/sys/sys+freebsd-x64.myr index e7349a5..bfe0d54 100644 --- a/lib/sys/sys+freebsd-x64.myr +++ b/lib/sys/sys+freebsd-x64.myr @@ -108,10 +108,10 @@ pkg sys = type utsname = struct system : byte[32] - node : byte[32] - release : byte[32] - version : byte[32] - machine : byte[32] + node : byte[32] + release : byte[32] + version : byte[32] + machine : byte[32] ;; type sockaddr = struct @@ -146,9 +146,9 @@ pkg sys = type sockaddr_storage = struct len : byte fam : sockfam - __pad1 : byte[6] - __align : int64 - __pad2 : byte[112] + __pad1 : byte[6] + __align : int64 + __pad2 : byte[112] ;; type dirent = struct @@ -304,25 +304,25 @@ pkg sys = const Maxpathlen : size = 1024 /* fcntl constants */ - const Fdupfd : fcntlcmd = 0 /* duplicate file descriptor */ - const Fgetfd : fcntlcmd = 1 /* get file descriptor flags */ - const Fsetfd : fcntlcmd = 2 /* set file descriptor flags */ - const Fgetfl : fcntlcmd = 3 /* get file status flags */ - const Fsetfl : fcntlcmd = 4 /* set file status flags */ - const Fgetown : fcntlcmd = 5 /* get SIGIO/SIGURG proc/pgrp */ - const Fsetown : fcntlcmd = 6 /* set SIGIO/SIGURG proc/pgrp */ - const Fogetlk : fcntlcmd = 7 /* get record locking information */ - const Fosetlk : fcntlcmd = 8 /* set record locking information */ - const Fosetlkw : fcntlcmd = 9 /* F_SETLK; wait if blocked */ - const Fdup2fd : fcntlcmd = 10 /* duplicate file descriptor to arg */ - const Fgetlk : fcntlcmd = 11 /* get record locking information */ - const Fsetlk : fcntlcmd = 12 /* set record locking information */ - const Fsetlkw : fcntlcmd = 13 /* F_SETLK; wait if blocked */ - const Fsetlk_remote : fcntlcmd = 14 /* debugging support for remote locks */ - const Freadahead : fcntlcmd = 15 /* read ahead */ - const Frdahead : fcntlcmd = 16 /* Darwin compatible read ahead */ - const Fdupfd_cloexec : fcntlcmd = 17 /* Like F_DUPFD, but FD_CLOEXEC is set */ - const Fdup2fd_cloexec : fcntlcmd = 18 /* Like F_DUP2FD, but FD_CLOEXEC is set */ + const Fdupfd : fcntlcmd = 0 /* duplicate file descriptor */ + const Fgetfd : fcntlcmd = 1 /* get file descriptor flags */ + const Fsetfd : fcntlcmd = 2 /* set file descriptor flags */ + const Fgetfl : fcntlcmd = 3 /* get file status flags */ + const Fsetfl : fcntlcmd = 4 /* set file status flags */ + const Fgetown : fcntlcmd = 5 /* get SIGIO/SIGURG proc/pgrp */ + const Fsetown : fcntlcmd = 6 /* set SIGIO/SIGURG proc/pgrp */ + const Fogetlk : fcntlcmd = 7 /* get record locking information */ + const Fosetlk : fcntlcmd = 8 /* set record locking information */ + const Fosetlkw : fcntlcmd = 9 /* F_SETLK; wait if blocked */ + const Fdup2fd : fcntlcmd = 10 /* duplicate file descriptor to arg */ + const Fgetlk : fcntlcmd = 11 /* get record locking information */ + const Fsetlk : fcntlcmd = 12 /* set record locking information */ + const Fsetlkw : fcntlcmd = 13 /* F_SETLK; wait if blocked */ + const Fsetlk_remote : fcntlcmd = 14 /* debugging support for remote locks */ + const Freadahead : fcntlcmd = 15 /* read ahead */ + const Frdahead : fcntlcmd = 16 /* Darwin compatible read ahead */ + const Fdupfd_cloexec : fcntlcmd = 17 /* Like F_DUPFD, but FD_CLOEXEC is set */ + const Fdup2fd_cloexec : fcntlcmd = 18 /* Like F_DUP2FD, but FD_CLOEXEC is set */ /* return value for a failed mapping */ const Mapbad : byte# = (-1 : byte#) diff --git a/lib/sys/sys+netbsd-x64.myr b/lib/sys/sys+netbsd-x64.myr index 94073e1..c13d88a 100644 --- a/lib/sys/sys+netbsd-x64.myr +++ b/lib/sys/sys+netbsd-x64.myr @@ -90,7 +90,7 @@ pkg sys = mtime : timespec /* time of last data modification */ ctime : timespec /* time of last file status change */ btime : timespec /* time of creation */ - size : uint64 /* file size, in bytes */ + size : uint64 /* file size in bytes */ blocks : uint64 /* blocks allocated for file */ blksize : uint32 /* optimal blocksize for I/O */ flags : uint32 /* user defined flags for file */ diff --git a/lib/testr/testr.myr b/lib/testr/testr.myr index 2c43449..22a271c 100644 --- a/lib/testr/testr.myr +++ b/lib/testr/testr.myr @@ -22,7 +22,7 @@ pkg testr = const run = {specs std.put("MTEST {}\n", specs.len) - for s in specs + for s : specs runspec(&s) ;; } |