/* u2_cm_bury(): store fresh or volatile noun `som` to freezer. */ u2_weak u2_cm_bury(u2_weak som) { if ( u2_none == som ) return som; if ( u2_no == u2_rl_junior(u2_wire_bas_r(u2_Wire), som) ) { return som; } else { u2_noun pro = u2_rl_take(u2_wire_bas_r(u2_Wire), som); u2_cz(som); return pro; } }
/* u2_bx_spot(): declare source position. */ void u2_bx_spot(u2_ray wir_r, u2_noun hod) // transfer { u2_ray bex_r, bas_r; if ( (0 == (bex_r = u2_wire_bex_r(wir_r))) || (0 == (bas_r = u2_wire_bas_r(wir_r))) ) { u2_rl_lose(wir_r, hod); return; } else { u2_noun sud = u2_rl_take(bas_r, hod); u2_rl_lose(wir_r, hod); if ( u2_none == sud ) { return; } else { u2_rl_lose(wir_r, u2_benx_at(bex_r, zat)); u2_benx_at(bex_r, zat) = sud; } } }
/* u2_bx_bean_ent(), u2_bx_bean_out(): enter and exit source position. */ void u2_bx_bean_ent(u2_ray wir_r, u2_noun hod) // transfer { u2_ray bex_r, bas_r; if ( (0 == (bex_r = u2_wire_bex_r(wir_r))) || (0 == (bas_r = u2_wire_bas_r(wir_r))) ) { u2_rl_lose(wir_r, hod); return; } else { u2_noun naz = u2_rl_uniq(wir_r, hod); u2_rl_lose(wir_r, hod); if ( u2_none != naz ) { u2_noun zof = u2_rc (bas_r, u2_rx(bas_r, naz), u2_rx(bas_r, u2_benx_at(bex_r, zof))); if ( u2_none != zof ) { u2_rl_lose(bas_r, u2_benx_at(bex_r, zof)); u2_benx_at(bex_r, zof) = zof; } } } }
/* u2_bx_post(): export and reset the performance log. ** ** zat: source position stack (on shed) ** zof: programer action stack (on shed) ** sap: number of steps ** cop: number of words copied ** det: number of identical nouns compared ** jax: number of jet activations ** use: number of user counts ** wax: maximum depth of C stack ** viq: words in wire allocated ** zor: words in basket allocated ** ums: number of milliseconds consumed */ u2_bean u2_bx_post(u2_ray wir_r, u2_noun* zat, u2_noun* zof, c3_d* sap_d, c3_d* cop_d, c3_d* det_d, c3_d* jax_d, c3_d* use_d, c3_w* wax_w, c3_ws* viq_ws, c3_ws* zor_ws, c3_w* ums_w) { u2_ray bex_r; if ( 0 == (bex_r = u2_wire_bex_r(wir_r)) ) { return u2_no; } else { c3_w sec_w, usc_w; *zat = u2_benx_at(bex_r, zat); *zof = u2_benx_at(bex_r, zof); *sap_d = u2_benx_be(bex_r, c3_d, sap_d); *cop_d = u2_benx_be(bex_r, c3_d, cop_d); *det_d = u2_benx_be(bex_r, c3_d, det_d); *jax_d = u2_benx_be(bex_r, c3_d, jax_d); *use_d = u2_benx_be(bex_r, c3_d, use_d); *wax_w = u2_benx_at(bex_r, wax_w); *viq_ws = u2_soup_liv_w(u2_rail_rut_r(wir_r)) - u2_benx_be(bex_r, c3_w, lif_w); *zor_ws = u2_soup_liv_w(u2_rail_rut_r(u2_wire_bas_r(wir_r))) - u2_benx_be(bex_r, c3_w, bos_w); sec_w = u2_benx_at(bex_r, sec_w); usc_w = u2_benx_at(bex_r, usc_w); u2_bx_boot(wir_r); /* Measure and return time change. */ { c3_d old_d, new_d; old_d = sec_w; old_d *= 1000000ULL; old_d += usc_w; new_d = u2_benx_at(bex_r, sec_w); new_d *= 1000000ULL; new_d += u2_benx_at(bex_r, usc_w); *ums_w = (c3_w) (((new_d - old_d) + 999ULL) / 1000ULL); } return u2_yes; } }
/* u2_bx_boot(): reset the performance log. */ void u2_bx_boot(u2_ray wir_r) { u2_ray bex_r; if ( 0 == (bex_r = u2_wire_bex_r(wir_r)) ) { return; } else { u2_benx_at(bex_r, zat) = u2_nul; u2_benx_at(bex_r, zof) = u2_nul; u2_benx_be(bex_r, c3_d, sap_d) = 0; u2_benx_be(bex_r, c3_d, cop_d) = 0; u2_benx_be(bex_r, c3_d, det_d) = 0; u2_benx_be(bex_r, c3_d, jax_d) = 0; u2_benx_be(bex_r, c3_d, use_d) = 0; u2_benx_be(bex_r, c3_w, wac_w) = 0; u2_benx_be(bex_r, c3_w, wax_w) = 0; u2_benx_be(bex_r, c3_w, lif_w) = u2_soup_liv_w(u2_rail_rut_r(wir_r)); u2_benx_be(bex_r, c3_w, bos_w) = u2_soup_liv_w(u2_rail_rut_r(u2_wire_bas_r(wir_r))); { struct timeval tv; gettimeofday(&tv, 0); u2_benx_at(bex_r, sec_w) = tv.tv_sec; u2_benx_at(bex_r, usc_w) = tv.tv_usec; } } }
/* u2_sh_look(): ** ** Produce hook formula from core, or u2_none. */ u2_weak u2_sh_look(u2_wire wir_r, u2_noun cor, const c3_c* tam_c) { u2_ray bas_r = u2_wire_bas_r(wir_r); u2_noun bat = u2_t(cor); u2_noun fol; if ( u2_none != (fol = u2_ch_find_mixt(u2_bask_hag_r(bas_r), tam_c, bat)) ) { return fol; } else { u2_noun xip = u2_sh_find(wir_r, cor); if ( u2_none == xip ) { return u2_none; } else { u2_axis axe_w = _1; while ( 1 ) { fol = u2_sh_cook(wir_r, xip, tam_c); if ( u2_none == fol ) { u2_noun pet = u2_t(u2_t(xip)); if ( _0 == pet ) { return u2_none; } else { u2_axis pax = u2_h(pet); c3_assert(u2_fly_is_cat(pax)); c3_assert((u2_ax_dep(axe_w) + u2_ax_dep(pax)) <= 30); axe_w = u2_ax_peg(axe_w, pax); xip = u2_t(pet); continue; } } else { fol = u2_rl_take(bas_r, fol); if ( _1 != axe_w ) { /* XX: suboptimal; use comb:lily. */ fol = u2_rt(bas_r, u2_nock_flac, u2_rc(bas_r, u2_nock_frag, axe_w), fol); } fol = u2_ch_save_mixt(bas_r, u2_bask_hag_r(bas_r), tam_c, bat, fol); return fol; } } } } }
/* u2_sh_find(): find chip by core. */ u2_weak u2_sh_find(u2_ray wir_r, u2_noun cor) { u2_ray bas_r; if ( 0 == (bas_r = u2_wire_bas_r(wir_r)) ) { return u2_none; } if ( u2_no == u2_dust(cor) ) { return u2_none; } else { u2_noun bat = u2_t(cor); if ( !u2_fly_is_dog(bat) ) { return u2_none; } else { u2_ray bat_r = u2_dog_a(bat); u2_ray rut_r = u2_rail_rut_r(bas_r); u2_ray hat_r = u2_rail_hat_r(bas_r); if ( (bat_r < rut_r) || (bat_r >= hat_r) ) { return u2_none; } else { u2_chip xip = u2_ch_find(u2_bask_hag_r(bas_r), bat); if ( u2_none == xip ) { #if 0 printf("bat_r %d.%x; hat_r %d.%x; rut_r %d.%x\n", u2_ray_a(bat_r), u2_ray_b(bat_r), u2_ray_a(hat_r), u2_ray_b(hat_r), u2_ray_a(rut_r), u2_ray_b(rut_r)); u2_ho_warn_here(); #endif return u2_none; } else { if ( u2_yes == _sh_good(cor, xip) ) { return xip; } else { u2_ho_warn_here(); return u2_none; } } } } } }
/* u2_ds_mine(): ** ** Register and/or save core. */ u2_noun // transfer u2_ds_mine(u2_wire wir_r, u2_noun clu, // retain u2_noun cor) // transfer { u2_noun bas_r = u2_wire_bas_r(wir_r); if ( u2_no == u2_dust(cor) ) { return cor; } else { u2_noun pay = u2_t(cor); u2_noun bat = u2_h(cor); u2_noun pug = u2_cs_find(bas_r, u2_wire_des_r(wir_r), 0, bat); u2_noun xip, bat_xip; u2_noun gop; if ( u2_none == pug ) { pug = u2_nul; } if ( u2_none == (xip = _ds_scan(pug, cor)) ) { gop = u2_rc(bas_r, (xip = _ds_chip(wir_r, clu, cor)), u2_rx(bas_r, pug)); if ( u2_none == gop ) { return cor; } else { bat_xip = u2_h(u2_t(xip)); // {c3_c* xip_c=u2_ho_cstring(xip); printf("%s\n", xip_c); free(xip_c);} gop = u2_cs_save(bas_r, u2_wire_des_r(wir_r), 0, bat_xip, gop); u2_rz(bas_r, gop); } } else bat_xip = u2_h(u2_t(xip)); if ( bat_xip != bat ) { u2_noun cyr = u2_rc(wir_r, u2_rx(wir_r, pay), bat_xip); if ( u2_none == cyr ) { return cor; } else { u2_rz(wir_r, cor); return cyr; } } else return cor; } }
/* u2_ds_find(): find chip by core, or none. */ u2_weak // senior u2_ds_find(u2_wire wir_r, u2_noun cor) // retain { if ( u2_no == u2_dust(cor) ) { return u2_none; } else { u2_rail bas_r = u2_wire_bas_r(wir_r); u2_noun pug = u2_cs_find(bas_r, u2_wire_des_r(wir_r), 0, u2_h(cor)); if ( u2_none == pug ) { return u2_none; } else return _ds_scan(pug, cor); } }
void u2_bx_bean_out(u2_ray wir_r) { u2_ray bex_r, bas_r; if ( (0 == (bex_r = u2_wire_bex_r(wir_r))) || (0 == (bas_r = u2_wire_bas_r(wir_r))) ) { return; } else { u2_noun zof = u2_benx_at(bex_r, zof); c3_assert(u2_nul != zof); u2_benx_at(bex_r, zof) = u2_rx(bas_r, u2_t(zof)); u2_rl_lose(bas_r, zof); } }
void u2_bx_spot_out(u2_ray wir_r) { u2_ray bex_r, bas_r; if ( (0 == (bex_r = u2_wire_bex_r(wir_r))) || (0 == (bas_r = u2_wire_bas_r(wir_r))) ) { return; } else { u2_noun zat = u2_benx_at(bex_r, zat); c3_assert(u2_nul != zat); u2_benx_at(bex_r, zat) = u2_t(zat); u2_rl_lose(wir_r, zat); } }
/* u2_ds_find(): find chip by core, or none. */ u2_weak // senior u2_ds_find(u2_wire wir_r, u2_noun cor) // retain { if ( u2_no == u2_dust(cor) ) { return u2_none; } else { u2_rail bas_r = u2_wire_bas_r(wir_r); u2_noun pug = u2_cs_find(bas_r, u2_wire_des_r(wir_r), 0, u2_h(cor)); u2_noun out; if ( u2_none == pug ) { out = u2_none; } else out = _ds_scan(pug, cor); #if 0 if ( (u2_none == out) && (u2_none != pug) ) { fprintf(stderr, "half match\r\n"); } #endif return out; } }
/* hill_boot(): create the hill engine. */ struct hill_state* // produce hill_boot(void) { struct hill_state* hil_h = malloc(sizeof(struct hill_state)); u2_ray wir_r; u2_boot(); wir_r = u2_wr_init(c3__rock, u2_ray_of(0, 0), u2_ray_of(1, 0)); Hill = hil_h; Hill->wir_r = wir_r; Hill->soa = u2_none; Hill->sob = u2_none; Hill->soc = u2_none; /* Mint the shoes. Impeccable memory practices. */ { u2_noun soa = u2_none; u2_noun sob = u2_none; u2_noun soc = u2_none; do { /* Boot shoe A. */ if ( u2_no == u2_rl_leap(wir_r, c3__rock) ) { c3_assert(0); } u2_bx_boot(wir_r); { u2_ray kit_r = u2_bl_open(wir_r); if ( u2_bl_set(wir_r) ) { u2_bl_done(wir_r, kit_r); u2_rl_fall(wir_r); fprintf(stderr, "{no boot, a}\n"); break; } else { soa = _hill_z_boot(wir_r, FileA); u2_bl_done(wir_r, kit_r); u2_bx_spot(wir_r, u2_nul); u2_bx_show(wir_r); } } fprintf(stderr, "{cold boot: %s, with %s jets: %x}\n", FileA, FileZ, u2_mug(soa)); Hill->soa = u2_rl_take(u2_wire_bas_r(wir_r), soa); u2_rl_fall(wir_r); /* Boot shoe B. */ if ( u2_no == u2_rl_leap(wir_r, c3__rock) ) { c3_assert(0); } u2_bx_boot(wir_r); { u2_ray kit_r = u2_bl_open(wir_r); if ( u2_bl_set(wir_r) ) { u2_bl_done(wir_r, kit_r); u2_rl_fall(wir_r); fprintf(stderr, "{no boot, b}\n"); break; } else { sob = _hill_a_boot(wir_r, soa, FileB); u2_bl_done(wir_r, kit_r); u2_bx_spot(wir_r, u2_nul); u2_bx_show(wir_r); } } fprintf(stderr, "{warm boot: %s, with %s: %x}\n", FileB, FileA, u2_mug(sob)); Hill->sob = u2_rl_take(u2_wire_bas_r(wir_r), sob); u2_rl_fall(wir_r); /* Boot shoe C. */ if ( u2_no == u2_rl_leap(wir_r, c3__rock) ) { c3_assert(0); } u2_bx_boot(wir_r); { u2_ray kit_r = u2_bl_open(wir_r); if ( u2_bl_set(wir_r) ) { u2_bl_done(wir_r, kit_r); u2_rl_fall(wir_r); fprintf(stderr, "{no boot, c}\n"); u2_bx_show(wir_r); break; } else { soc = _hill_b_eyre(wir_r, soa, sob, FileC); u2_bl_done(wir_r, kit_r); u2_bx_spot(wir_r, u2_nul); u2_bx_show(wir_r); } } fprintf(stderr, "{last boot: %s, with %s: %x}\n", FileC, FileB, u2_mug(soc)); Hill->soc = u2_rl_take(u2_wire_bas_r(wir_r), soc); u2_rl_fall(wir_r); /* Testing basics of soc. */ printf("testing eyre...\n"); { u2_noun foo = u2_rl_string(wir_r, "|!(a=@ (dec a))"); u2_noun bar = u2_nk_nock(wir_r, foo, Hill->soc); if ( u2_none == bar ) { printf("no bar\n"); } else { u2_noun moo = u2_nk_nock(wir_r, _0, bar); if ( u2_none == moo ) { printf("no moo\n"); } else { u2_noun zor = u2_nk_mung(wir_r, moo, 13); u2_err(wir_r, "zor", zor); } } } printf("tested.\n"); #if 1 { u2_noun soa = Hill->soa; u2_noun sob = Hill->sob; u2_noun dat = Hill->soc; u2_noun pak, bag; fprintf(stderr, "jam test: jam\n"); u2_bx_boot(wir_r); pak = _hill_b_jam(wir_r, soa, sob, dat); u2_bx_show(wir_r); fprintf(stderr, "jam test: %d bits\n", u2_met(0, pak)); u2_ux_write(wir_r, pak, "watt/264", "noun"); fprintf(stderr, "jam test: cue\n"); u2_bx_boot(wir_r); bag = _hill_b_cue(wir_r, soa, sob, pak); u2_bx_show(wir_r); if ( u2_yes == u2_sing(bag, dat) ) { fprintf(stderr, "jam test: match\n"); } else { fprintf(stderr, "jam test: NO MATCH\n"); } } #endif return Hill; } while (0); free(Hill); return 0; } }
/* u2_sh_mine(): substitute active, annotated battery. */ u2_weak // transfer u2_sh_mine(u2_ray wir_r, u2_clue clu, // retain u2_noun cor) // transfer { u2_ray bas_r; u2_noun pay, bat; u2_noun sil, bud, nut; u2_chip xip; if ( 0 == (bas_r = u2_wire_bas_r(wir_r)) ) { return cor; } else if ( (u2_none == u2_as_cell(cor, &pay, &bat)) || (u2_no == u2_dust(bat)) ) { return cor; } else if ( u2_none != (xip = u2_ch_find(u2_bask_hag_r(bas_r), bat)) ) { u2_noun cyr; if ( u2_none == (cyr = u2_rc(wir_r, u2_rx(wir_r, pay), u2_h(u2_t(xip)))) ) { return cor; } else { u2_rl_lose(wir_r, cor); return cyr; } } else if ( (u2_no == u2_as_trel(clu, &bud, &sil, &nut)) || (u2_no == _sh_good_bud(bud)) || (u2_no == _sh_good_sil(sil)) || (u2_no == _sh_good_nut(nut)) ) { return cor; } else { u2_noun dac, bot, pet, xop, cyr; dac = bot = pet = xop = cyr = u2_none; while ( 1 ) { /* disc: dac */ { if ( u2_none == (dac = u2_rl_take(bas_r, u2_t(clu))) ) { break; } } /* battery: bot */ { if ( u2_no == u2_rl_junior(bas_r, bat) ) { /* We need the jet battery to be in the shed, so that we ** have a fast algorithm for distinguishing jet batteries ** by ray address. */ bot = u2_rc(bas_r, u2_h(bat), u2_t(bat)); #if 0 printf("battery: in basket: %d.%x\n", u2_ray_a(u2_dog_a(bot)), u2_ray_b(u2_dog_a(bot))); #endif } else { bot = u2_rl_take(bas_r, bat); #if 0 printf("battery: in shed! %d.%x\n", u2_ray_a(u2_dog_a(bot)), u2_ray_b(u2_dog_a(bot))); #endif } if ( u2_none == bot ) { break; } } /* trunk: pet */ { if ( _0 == bud ) { pet = u2_nul; } else { u2_atom p_bud = u2_t(bud); u2_noun car = u2_frag(p_bud, cor); if ( (u2_none == car) || (u2_no == u2_dust(car)) ) { break; } else { u2_noun but = u2_t(car); u2_noun xup, axe; if ( u2_none == (xup = u2_ch_find(u2_bask_hag_r(bas_r), but)) ) { printf("no base!\n"); u2_err(wir_r, "clu", clu); break; } else u2_rl_gain(bas_r, xup); if ( u2_none == (axe = u2_rl_take(bas_r, p_bud)) ) { u2_rl_lose(bas_r, xup); } if ( u2_none == (pet = u2_rc(bas_r, p_bud, xup)) ) { u2_rl_lose(bas_r, axe); u2_rl_lose(bas_r, xup); break; } } } } /* xop: new chip. */ { if ( u2_none == (xop = u2_rt(bas_r, dac, bot, pet)) ) { break; } if ( u2_none == (u2_ch_save(bas_r, u2_bask_hag_r(bas_r), bot, xop)) ) { break; } u2_rl_lose(bas_r, xop); } /* cyr: new core. */ { u2_noun cyr; if ( u2_none == (cyr = u2_rc(wir_r, u2_rx(wir_r, pay), bot)) ) { break; } else { u2_rl_lose(wir_r, cor); return cyr; } } } u2_ho_warn_here(); #if 0 // XXX: an unknown bug is triggered here; // but basket needs a minor rewrite. // if ( dac != u2_none ) u2_rl_lose(bas_r, dac); if ( bot != u2_none ) u2_rl_lose(bas_r, bot); if ( pet != u2_none ) u2_rl_lose(bas_r, pet); if ( xop != u2_none ) u2_rl_lose(bas_r, xop); #endif return cor; } }
/* u2_wr_init(): ** ** Install an empty wire within `hat_r` and `mat_r` in the loom, ** with memory model `hip`. ** ** Returns ray to wire, which always equalls the passed `mat_r`. */ u2_ray u2_wr_init(c3_m hip_m, u2_ray hat_r, u2_ray mat_r) { u2_ray wir_r; wir_r = u2_rl_init(hip_m, hat_r, mat_r); u2_rail_hat_r(wir_r) += (c3_wiseof(u2_loom_wire) - c3_wiseof(u2_loom_rail)); #if 1 u2_wire_bas_r(wir_r) = 0; #endif u2_wire_kit_r(wir_r) = 0; u2_cs_init(u2_wire_des_r(wir_r)); /* Trace stack, garbage. */ { u2_wire_tax(wir_r) = u2_nul; u2_wire_lan(wir_r) = u2_yes; } /* Permanent basket = 1/16 of address space. */ { u2_ray bas_r; bas_r = u2_rl_leap_part(wir_r, c3__sand, 1, 16, 0); u2_wire_bas_r(wir_r) = bas_r; #if 0 fprintf(stderr, "bas_r %d, hat %d, mat %d, cap %d, rut %d\n", bas_r >> LoomPageWords, u2_rail_hat_r(bas_r) >> LoomPageWords, u2_rail_mat_r(bas_r) >> LoomPageWords, u2_rail_cap_r(bas_r) >> LoomPageWords, u2_rail_rut_r(bas_r) >> LoomPageWords); fprintf(stderr, "wir_r %d, hat %d, mat %d, cap %d, rut %d\n", wir_r >> LoomPageWords, u2_rail_hat_r(wir_r) >> LoomPageWords, u2_rail_mat_r(wir_r) >> LoomPageWords, u2_rail_cap_r(wir_r) >> LoomPageWords, u2_rail_rut_r(wir_r) >> LoomPageWords); #endif // u2_ba_init(wir_r, 0); } #if 1 /* Host control. */ { u2_ho_push(); } #endif /* Basic performance tracking. */ { u2_wire_bex_r(wir_r) = u2_rl_ralloc(wir_r, c3_wiseof(u2_loom_benx)); u2_bx_boot(wir_r); } /* New performance tracking. */ { u2_wire_rac_r(wir_r) = u2_tx_init(wir_r); } /* Global namespace. */ { u2_wire_hev_r(wir_r) = u2_hv_init(wir_r); } /* OS kernel. */ { u2_wire_arv_r(wir_r) = u2_rl_ralloc(wir_r, c3_wiseof(u2_reck)); } return wir_r; }
/* _ds_chip(): fabricate chip from clue and core. */ static u2_weak // senior _ds_chip(u2_wire wir_r, u2_noun clu, // retain u2_noun cor) // retain { u2_rail bas_r = u2_wire_bas_r(wir_r); u2_noun bud_clu, cop_clu, pic_clu; if ( (u2_no == u2_as_trel(clu, &bud_clu, &cop_clu, &pic_clu)) || (u2_no == _ds_good_bud(bud_clu)) || (u2_no == _ds_good_cop(cop_clu)) || (u2_no == _ds_good_pic(pic_clu)) ) { return u2_none; } else { u2_noun dac, bat, pet; /* disc: dac */ { if ( u2_none == (dac = u2_rx(bas_r, u2_t(clu))) ) { u2_ho_warn_here(); return u2_none; } } #if 1 /* battery: bat */ { if ( u2_none == (bat = u2_rx(bas_r, u2_h(cor))) ) { u2_ho_warn_here(); u2_rz(bas_r, dac); return u2_none; } } #endif #if 0 /* bat: battery */ { // Important to reuse existing battery even if it does not match // the whole chip - since battery is a comparison key, we don't // want duplicates, which compare slowly. // if ( u2_nul == pug ) { bat = u2_rx(bas_r, u2_h(cor)); } else { u2_noun i_pug = u2_h(pug); bat = u2_rx(bas_r, u2_h(u2_t(i_pug))); } if ( u2_none == bat ) { u2_ho_warn_here(); u2_rz(bas_r, dac); return u2_none; } } #endif /* trunk: pet */ { if ( _0 == bud_clu ) { pet = u2_nul; } else { while ( _10 == u2_h(bud_clu) ) { bud_clu = u2_t(u2_t(bud_clu)); } if ( _1 == u2_h(bud_clu) ) { pet = u2_nul; } else { u2_atom axe = u2_t(bud_clu); u2_noun ruc = u2_frag(axe, cor); u2_noun led; if ( u2_none == ruc ) { // u2_err(wir_r, "clu", clu); u2_ho_warn_here(); u2_rz(bas_r, dac); u2_rz(bas_r, bat); return u2_none; } else { if ( u2_none == (led = u2_ds_find(wir_r, ruc)) ) { u2_lo_show("clu", clu); u2_ho_warn_here(); c3_assert(0); u2_rz(bas_r, dac); u2_rz(bas_r, bat); return u2_none; } pet = u2_rc(bas_r, u2_rx(bas_r, axe), u2_rx(bas_r, led)); } } } } return u2_rt(bas_r, dac, bat, pet); } }
/* u2_ds_mine(): ** ** Register and/or save core. */ u2_noun // transfer u2_ds_mine(u2_wire wir_r, u2_noun clu, // retain u2_noun cor) // transfer { u2_noun bas_r = u2_wire_bas_r(wir_r); if ( u2_no == u2_dust(cor) ) { return cor; } else { u2_noun pay = u2_t(cor); u2_noun bat = u2_h(cor); u2_noun pug = u2_cs_find(bas_r, u2_wire_des_r(wir_r), 0, bat); u2_noun xip, bat_xip; u2_noun gop; if ( u2_none == pug ) { pug = u2_nul; } if ( u2_none == (xip = _ds_scan(pug, cor)) ) { gop = u2_rc(bas_r, (xip = _ds_chip(wir_r, clu, cor)), u2_rx(bas_r, pug)); if ( u2_none == gop ) { return cor; } else { bat_xip = u2_h(u2_t(xip)); #if 0 { c3_c* xip_c = u2_ho_cstring(xip); fprintf(stderr, "!%s - lent %d\r\n", xip_c, u2_ckb_lent(gop)); free(xip_c); } #endif gop = u2_cs_save(bas_r, u2_wire_des_r(wir_r), 0, bat_xip, gop); { u2_noun poo = u2_cs_find(bas_r, u2_wire_des_r(wir_r), 0, bat_xip); { _ds_scan(poo, cor); } } u2_rz(bas_r, gop); } } else { bat_xip = u2_h(u2_t(xip)); } if ( bat_xip != bat ) { u2_noun cyr = u2_rc(wir_r, bat_xip, u2_rx(wir_r, pay)); if ( u2_none == cyr ) { return cor; } else { u2_rz(wir_r, cor); return cyr; } } else return cor; } }