diff --git a/pkg/urbit/daemon/main.c b/pkg/urbit/daemon/main.c index 62f1ee59e..76d28bde4 100644 --- a/pkg/urbit/daemon/main.c +++ b/pkg/urbit/daemon/main.c @@ -1037,28 +1037,28 @@ _cw_eval_commence(c3_i argc, c3_c* argv[]) } printf("executing hoon\n"); - u3_noun res = u3v_wish(evl_c); - u3m_p("Hoon Output",res); + c3_c* inp_c; + c3_i ret_i = asprintf(&inp_c, "%%- sell !> \n%s", evl_c); + c3_assert( ret_i > 0 ); - /*u3_noun bus = u3i_word(55); - u3_noun fol = u3i_trel(u3i_word(4), - u3i_word(0), - u3i_word(1)); - u3_noun cons = u3nc(bus, fol); - u3_noun res = u3m_soft(0, virt_nock, u3k(cons)); + u3_noun res = u3m_soft(0, u3v_wish_n, u3i_string(inp_c)); + if(0 == u3h(res)){ - u3m_p("", cons); - u3m_p("", u3t(res)); - u3m_grab(res, cons, u3_none); + u3_pier_tank(0,0,u3k(u3t(res))); + + //u3m_p("", cons); + //u3m_p("", u3t(res)); + //u3m_grab(res, cons, u3_none); }else{ - printf("error\n"); + u3_pier_punt_goof("error", u3k(res)); } u3z(res); - u3z(cons);*/ - printf("finishing"); + free(inp_c); + + printf("finishing\n"); } diff --git a/pkg/urbit/include/noun/vortex.h b/pkg/urbit/include/noun/vortex.h index 3e8f01484..b953c7c44 100644 --- a/pkg/urbit/include/noun/vortex.h +++ b/pkg/urbit/include/noun/vortex.h @@ -57,6 +57,11 @@ u3_noun u3v_do(const c3_c* txt_c, u3_noun arg); + /* u3v_wish_n(): text expression with cache. + */ + u3_noun + u3v_wish_n(const u3_noun txt); + /* u3v_wish(): text expression with cache. */ u3_noun diff --git a/pkg/urbit/noun/vortex.c b/pkg/urbit/noun/vortex.c index 03d174e1f..614682cfa 100644 --- a/pkg/urbit/noun/vortex.c +++ b/pkg/urbit/noun/vortex.c @@ -107,6 +107,31 @@ _cv_nock_wish(u3_noun txt) return pro; } +/* u3v_wish(): text expression with cache. +*/ +u3_noun +u3v_wish_n(u3_noun txt) +{ + u3t_event_trace("u3v_wish", 'b'); + u3_weak exp = u3kdb_get(u3k(u3A->yot), u3k(txt)); + + if ( u3_none == exp ) { + exp = _cv_nock_wish(u3k(txt)); + + // It's probably not a good idea to use u3v_wish() + // outside the top level... (as the result is uncached) + // + if ( u3R == &u3H->rod_u ) { + u3A->yot = u3kdb_put(u3A->yot, u3k(txt), u3k(exp)); + } + } + + u3t_event_trace("u3v_wish", 'e'); + + u3z(txt); + return exp; +} + /* u3v_wish(): text expression with cache. */ u3_noun