diff --git a/pkg/urbit/include/jets/k.h b/pkg/urbit/include/jets/k.h index 7d6329c565..19eab297d0 100644 --- a/pkg/urbit/include/jets/k.h +++ b/pkg/urbit/include/jets/k.h @@ -5,7 +5,9 @@ /** Tier 1. **/ u3_noun u3ka_add(u3_noun a, u3_noun b); + u3_noun u3ka_div(u3_noun a, u3_noun b); u3_noun u3ka_sub(u3_noun a, u3_noun b); + u3_noun u3ka_mod(u3_noun a, u3_noun b); u3_noun u3ka_mul(u3_noun a, u3_noun b); u3_noun u3ka_gth(u3_noun a, u3_noun b); u3_noun u3ka_lte(u3_noun a, u3_noun b); @@ -18,6 +20,10 @@ /* u3kc: tier 3 functions */ + u3_noun + u3kc_con(u3_noun a, + u3_noun b); + /* u3kc_mix(): binary xor. */ u3_noun diff --git a/pkg/urbit/jets/a/div.c b/pkg/urbit/jets/a/div.c index fa28531607..c9e95de1db 100644 --- a/pkg/urbit/jets/a/div.c +++ b/pkg/urbit/jets/a/div.c @@ -44,3 +44,13 @@ return u3qa_div(a, b); } } + + +u3_noun +u3ka_div(u3_noun a, + u3_noun b) +{ + u3_noun c = u3qa_div(a, b); + u3z(a); u3z(b); + return c; +} diff --git a/pkg/urbit/jets/a/mod.c b/pkg/urbit/jets/a/mod.c index 80c8923ca6..af9f6662bb 100644 --- a/pkg/urbit/jets/a/mod.c +++ b/pkg/urbit/jets/a/mod.c @@ -41,3 +41,12 @@ return u3qa_mod(a, b); } } + +u3_noun +u3ka_mod(u3_noun a, + u3_noun b) +{ + u3_noun c = u3qa_mod(a, b); + u3z(a); u3z(b); + return c; +} diff --git a/pkg/urbit/jets/c/con.c b/pkg/urbit/jets/c/con.c index cf25e4033c..746cd79423 100644 --- a/pkg/urbit/jets/c/con.c +++ b/pkg/urbit/jets/c/con.c @@ -49,3 +49,12 @@ return u3qc_con(a, b); } } + +u3_noun +u3kc_con(u3_noun a, + u3_noun b) +{ + u3_noun c = u3qc_con(a, b); + u3z(a); u3z(b); + return c; +} diff --git a/pkg/urbit/jets/e/scow.c b/pkg/urbit/jets/e/scow.c index 4627c30793..f0d57778ba 100644 --- a/pkg/urbit/jets/e/scow.c +++ b/pkg/urbit/jets/e/scow.c @@ -55,7 +55,9 @@ static u3_noun _print_da(u3_atom cor, u3_atom raw_da) { + u3l_log("about to cook"); u3_noun hok = u3j_cook("u3we_scow_print_da", u3k(cor), "yore"); + u3l_log("cooked"); u3_noun yod = u3n_slam_on(hok, u3k(raw_da)); u3_noun out = 0; @@ -221,14 +223,17 @@ _print_ud(u3_atom ud) int between = 0; u3_atom list = 0; + u3k(ud); + do { if (between == 3) { list = u3nc('.', list); between = 0; } - list = u3nc(u3qa_add(u3qa_mod(u3k(ud), 10), '0'), list); + + list = u3nc(u3ka_add(u3ka_mod(ud, 10), '0'), list); between++; - ud = u3qa_div(ud, 10); + ud = u3ka_div(ud, 10); } while (c3n == u3r_sing(ud, 0)); return list; @@ -252,8 +257,8 @@ u3we_scow(u3_noun cor) case c3__da: return _print_da(cor, atom); - case 'p': - return _print_p(atom); + /* case 'p': */ + /* return _print_p(atom); */ case c3__ud: return _print_ud(atom); @@ -271,6 +276,7 @@ u3we_scow(u3_noun cor) u3_noun u3we_scot(u3_noun cor) { + /* u3l_log("u3we_scot"); */ u3_noun mod; u3_noun atom; @@ -292,11 +298,15 @@ u3we_scot(u3_noun cor) /* return u3qc_rap(3, x); */ /* } */ - case 'p': - return u3qc_rap(3, _print_p(atom)); + /* case 'p': */ + /* return u3qc_rap(3, _print_p(atom)); */ - case c3__ud: - return u3qc_rap(3, _print_ud(atom)); + case c3__ud: { + u3_atom tape = _print_ud(atom); + u3_atom ret = u3qc_rap(3, tape); + u3z(tape); + return ret; + } default: return u3_none; diff --git a/pkg/urbit/jets/e/slaw.c b/pkg/urbit/jets/e/slaw.c index 9476d004d9..97b35a573f 100644 --- a/pkg/urbit/jets/e/slaw.c +++ b/pkg/urbit/jets/e/slaw.c @@ -307,8 +307,8 @@ _parse_p(u3_noun txt) { numname = cur[0] - '0'; \ cur++; \ while (isdigit(cur[0])) { \ - numname = u3qa_mul(numname, 10); \ - numname = u3qa_add(numname, cur[0] - '0'); \ + numname = u3ka_mul(numname, 10); \ + numname = u3ka_add(numname, cur[0] - '0'); \ cur++; \ } \ } while (0) @@ -323,8 +323,8 @@ _parse_p(u3_noun txt) { numname = cur[0] - '0'; \ cur++; \ while (isdigit(cur[0])) { \ - numname = u3qa_mul(numname, 10); \ - numname = u3qa_add(numname, cur[0] - '0'); \ + numname = u3ka_mul(numname, 10); \ + numname = u3ka_add(numname, cur[0] - '0'); \ cur++; \ } \ } while (0) @@ -435,13 +435,15 @@ _parse_da(u3_noun cor, u3_noun txt) { if (cur[0] == 0) { c3_free(c); - list = u3qb_flop(list); + + u3_noun flopped = u3qb_flop(list); + u3z(list); u3_noun hok = u3j_cook("u3we_slaw_parse_da", u3k(cor), "year"); u3_noun res = u3n_slam_on(hok, u3nt(u3nc(bc, year), month, u3nc(day, - u3nq(hour, minute, second, list)))); + u3nq(hour, minute, second, flopped)))); return u3nc(0, res); } @@ -498,8 +500,8 @@ u3we_slaw(u3_noun cor) case c3__da: return _parse_da(cor, txt); - case 'p': - return _parse_p(txt); + /* case 'p': */ + /* return _parse_p(txt); */ case c3__ud: return _parse_ud(txt); diff --git a/pkg/urbit/jets/tree.c b/pkg/urbit/jets/tree.c index 5b91e95950..6c24820cd6 100644 --- a/pkg/urbit/jets/tree.c +++ b/pkg/urbit/jets/tree.c @@ -1298,7 +1298,7 @@ static c3_c* _141_tri_shal_ha[] = { static u3j_core _141_tri_d[] = { { "qua", 3, 0, _141_qua_d, _141_qua_ha, _141_qua_ho }, - { "ob", 3, 0, _141_tri__ob_d, 0 }, + // { "ob", 3, 0, _141_tri__ob_d, 0 }, { "cofl", 7, 0, _141_tri__cofl_d, _141_tri__cofl_ha }, { "rd", 7, 0, _141_tri__rd_d, _141_tri__rd_ha }, { "rs", 7, 0, _141_tri__rs_d, _141_tri__rs_ha },