fixed a few of the issues ~master-morzod pointed out

This commit is contained in:
Amadeo Bellotti 2022-09-12 09:02:13 -04:00
parent 2e894f8dbc
commit 5ae2b48350
3 changed files with 11 additions and 50 deletions

View File

@ -999,19 +999,17 @@ static void
_cw_eval_commence(c3_i argc, c3_c* argv[])
{
//Read from stdin until an EOF is recieved
c3_c* line = NULL;
size_t len = 0;
ssize_t nread;
c3_c* lin_c = NULL;
size_t len_i = 0;
ssize_t red_i;
c3_c* evl_c = "";
while((nread = getline(&line, &len, stdin)) != -1)
while((red_i = getline(&lin_c, &len_i, stdin)) != -1)
{
len = asprintf(&evl_c, "%s%s", evl_c, line);
len_i = asprintf(&evl_c, "%s%s", evl_c, lin_c);
}
free(line);
//printf("%s", evl_c);
free(lin_c);
//Initialize the Loom and load the Ivory Pill
c3_d len_d = u3_Ivory_pill_len;
@ -1032,10 +1030,9 @@ _cw_eval_commence(c3_i argc, c3_c* argv[])
exit(1);
}
printf("Executing hoon:\n");
printf("eval:\n");
//Run the input through a virtualization (u3v_wish_n) and get the ouput
//u3_noun res = u3m_soft(0, u3v_wish_n, u3i_string(evl_c));
//Run the input through a virtualization (u3v_wish) and get the ouput
u3_noun gat = u3v_wish("|=(a=@t (sell (slap !>(+>.$) (rain /eval a))))");
u3_noun res;
{
@ -1044,22 +1041,16 @@ _cw_eval_commence(c3_i argc, c3_c* argv[])
res = u3m_soft(0, u3n_kick_on, cor); // Transfer cor and sam
}
if(0 == u3h(res)){//Succuessful execution print the output
u3_pier_tank(0,0,u3k(u3t(res)));
}else{
u3_pier_punt_goof("Hoon Error", u3k(res)); //print stack trace error
}
else{
u3_pier_punt_goof("eval", u3k(res)); //print stack trace error
}
u3z(res);
u3z(gat);
//printf("finishing\n");
}
/* _cw_serf_commence(): initialize and run serf
*/
static void

View File

@ -57,11 +57,6 @@
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

View File

@ -107,31 +107,6 @@ _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