summaryrefslogtreecommitdiff
path: root/mbld
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2017-09-30 22:18:21 -0700
committerOri Bernstein <ori@eigenstate.org>2017-09-30 22:18:21 -0700
commit8672ce0c95bf5d6e6b721694bd0e5944d4af556b (patch)
treead54ebc4603c410cd9eb0b2f07cf133a701ff185 /mbld
parent7cc7912b2834f9f5dde95412e5302f13fb82042c (diff)
downloadmc-8672ce0c95bf5d6e6b721694bd0e5944d4af556b.tar.gz
Replace bio.status(@t) with std.result(@t, bio.err)
It's more consistent.
Diffstat (limited to 'mbld')
-rw-r--r--mbld/libs.myr27
-rw-r--r--mbld/subtest.myr8
2 files changed, 17 insertions, 18 deletions
diff --git a/mbld/libs.myr b/mbld/libs.myr
index f3deec5..487d110 100644
--- a/mbld/libs.myr
+++ b/mbld/libs.myr
@@ -55,16 +55,14 @@ const scrapelib = {b, targ, lib, incs
(f, dir) = openlib(lib, targ, incs)
match bio.getc(f)
- | `bio.Ok 'U': /* ok */
- | `bio.Ok _: std.fput(1, "{}/{}: not a usefile\n", dir, lib)
- | `bio.Err e: std.fatal("{}/{}: error reading: {}\n", dir, lib, e)
- | `bio.Eof: std.fatal("{}/{}: truncated\n", dir, lib)
+ | `std.Ok 'U': /* ok */
+ | `std.Ok _: std.fput(1, "{}/{}: not a usefile\n", dir, lib)
+ | `std.Err e: std.fatal("{}/{}: error reading: {}\n", dir, lib, e)
;;
match bio.getbe32(f)
- | `bio.Ok Abiversion: /* nothing: version matches. */
- | `bio.Ok v: std.fput(1, "{}/{}: mismatched abi {}\n", dir, lib, v)
- | `bio.Err e: std.fatal("{}/{}: error reading: {}\n", dir, lib, e)
- | `bio.Eof: std.fatal("{}/{}: truncated\n", dir, lib)
+ | `std.Ok Abiversion: /* nothing: version matches. */
+ | `std.Ok v: std.fput(1, "{}/{}: mismatched abi {}\n", dir, lib, v)
+ | `std.Err e: std.fatal("{}/{}: error reading: {}\n", dir, lib, e)
;;
std.slfree(rdstr(f))
@@ -72,10 +70,10 @@ const scrapelib = {b, targ, lib, incs
dyndep = [][:]
while true
match bio.getc(f)
- | `bio.Ok 'L': std.slpush(&dep, rdstr(f))
- | `bio.Ok 'X': std.slpush(&dyndep, rdstr(f))
- | `bio.Err e: std.fatal("{}: error reading {}", lib, e)
- | _: break;
+ | `std.Ok 'L': std.slpush(&dep, rdstr(f))
+ | `std.Ok 'X': std.slpush(&dyndep, rdstr(f))
+ | `std.Err e: std.fatal("{}: error reading {}\n", lib, e)
+ | _: break
;;
;;
bio.close(f)
@@ -179,11 +177,10 @@ const rdstr = {f -> byte[:]
var sl
match bio.getbe32(f)
- | `bio.Ok l:
+ | `std.Ok l:
len = l
sl = std.slalloc(len)
- | `bio.Eof: std.fatal("end of file while reading string")
- | `bio.Err e: std.fatal("error while reading string: {}", e)
+ | `std.Err e: std.fatal("error while reading string: {}", e)
;;
bio.read(f, sl)
-> sl
diff --git a/mbld/subtest.myr b/mbld/subtest.myr
index 1078105..f631895 100644
--- a/mbld/subtest.myr
+++ b/mbld/subtest.myr
@@ -29,9 +29,11 @@ const showsub = {b, cmd, fd, logfd, failed
log = bio.mkfile(logfd, bio.Wr)
res = `std.None
match bio.readln(f)
- | `bio.Err e: std.fatal("error reading subfile: {}\n", e)
- | `bio.Eof: -> `std.None
- | `bio.Ok ln:
+ | `std.Err `bio.Eof:
+ -> `std.None
+ | `std.Err e:
+ std.fatal("error reading subfile: {}\n", e)
+ | `std.Ok ln:
match testplan(ln)
| `std.None:
bio.write(log, ln)