From de91adb61a6c839c353b436af441235662cb6efc Mon Sep 17 00:00:00 2001 From: Elliot Glaysher Date: Wed, 6 May 2020 15:23:45 -0700 Subject: [PATCH] jets: more cleanups from review. --- pkg/urbit/jets/e/scow.c | 28 ++++++++++++++++------------ pkg/urbit/jets/e/slaw.c | 9 ++++++--- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/pkg/urbit/jets/e/scow.c b/pkg/urbit/jets/e/scow.c index ea3f35c68d..f20d446120 100644 --- a/pkg/urbit/jets/e/scow.c +++ b/pkg/urbit/jets/e/scow.c @@ -204,7 +204,7 @@ _print_p(u3_atom cor, u3_atom p) } u3_noun list = 0; - for (u3_atom imp = 0; imp != dyy; ++imp) { + for (c3_w imp = 0; imp != dyy; ++imp) { u3_noun log = u3qc_end(4, 1, u3k(sxz)); u3_noun prefix = u3qc_rsh(3, 1, u3k(log)); u3_noun suffix = u3qc_end(3, 1, log); @@ -249,7 +249,7 @@ _print_ud(u3_atom ud) list = u3nc(u3ka_add(u3qa_mod(ud, 10), '0'), list); between++; ud = u3ka_div(ud, 10); - } while (c3n == u3r_sing(ud, 0)); + } while (ud != 0); return list; } @@ -274,7 +274,7 @@ _print_uv(u3_atom uv) list = u3nc(to_digit(tig), list); between++; uv = u3ka_div(uv, 32); - } while (c3n == u3r_sing(uv, 0)); + } while (uv != 0); return u3nt('0', 'v', list); } @@ -299,7 +299,7 @@ _print_uw(u3_atom uw) list = u3nc(to_w_digit(tig), list); between++; uw = u3ka_div(uw, 64); - } while (c3n == u3r_sing(uw, 0)); + } while (uw != 0); return u3nt('0', 'w', list); } @@ -311,10 +311,12 @@ u3we_scow(u3_noun cor) u3_noun atom; if (c3n == u3r_mean(cor, u3x_sam_2, &mod, - u3x_sam_3, &atom, 0) || - !_(u3a_is_cat(mod))) { - u3l_log("u3we_scow fail\r\n"); - return u3m_bail(c3__fail); + u3x_sam_3, &atom, 0)) { + return u3m_bail(c3__exit); + } + + if (!_(u3a_is_cat(mod))) { + return u3_none; } switch (mod) { @@ -345,10 +347,12 @@ u3we_scot(u3_noun cor) u3_noun atom; if (c3n == u3r_mean(cor, u3x_sam_2, &mod, - u3x_sam_3, &atom, 0) || - !_(u3a_is_cat(mod))) { - u3l_log("u3we_scot fail\r\n"); - return u3m_bail(c3__fail); + u3x_sam_3, &atom, 0)) { + return u3m_bail(c3__exit); + } + + if (!_(u3a_is_cat(mod))) { + return u3_none; } u3_noun tape; diff --git a/pkg/urbit/jets/e/slaw.c b/pkg/urbit/jets/e/slaw.c index 92ad23948d..0e8aa11075 100644 --- a/pkg/urbit/jets/e/slaw.c +++ b/pkg/urbit/jets/e/slaw.c @@ -259,7 +259,7 @@ _parse_p(u3_noun cor, u3_noun txt) { if (*cur != 0) { // We've parsed all of a comet shape, and there's still more in the - // string. Error. + // string. Bail back to the interpreter. u3a_free(c); return u3_none; } @@ -485,11 +485,14 @@ u3we_slaw(u3_noun cor) u3_noun txt; if (c3n == u3r_mean(cor, u3x_sam_2, &mod, - u3x_sam_3, &txt, 0) || - !_(u3a_is_cat(mod))) { + u3x_sam_3, &txt, 0)) { return u3m_bail(c3__exit); } + if (!_(u3a_is_cat(mod))) { + return u3_none; + } + switch (mod) { case c3__da: return _parse_da(cor, txt);