From d306975af8a58c422687e9e7d349d5e5aa3f6ba7 Mon Sep 17 00:00:00 2001 From: Paul Driver Date: Mon, 30 Apr 2018 09:57:09 -0700 Subject: [PATCH] gate_prep transfers, rites to posts --- include/noun/jets.h | 20 ++++++++++++-------- jets/b/levy.c | 2 +- jets/b/lien.c | 2 +- jets/b/murn.c | 2 +- jets/b/reel.c | 2 +- jets/b/roll.c | 2 +- jets/b/skid.c | 2 +- jets/b/skim.c | 2 +- jets/b/skip.c | 2 +- jets/b/turn.c | 2 +- noun/jets.c | 24 +++++++++++++----------- noun/nock.c | 2 +- 12 files changed, 35 insertions(+), 29 deletions(-) diff --git a/include/noun/jets.h b/include/noun/jets.h index a0ef42f53..36b219aff 100644 --- a/include/noun/jets.h +++ b/include/noun/jets.h @@ -61,23 +61,27 @@ u3j_core* ray_u; // dynamic array by axis } u3j_dash; + /* u3j_fist: a single step in a fine check */ typedef struct { - u3_noun bat; - u3_noun pax; + u3_noun bat; // battery + u3_noun pax; // parent axis } u3j_fist; + /* u3j_fink: (fine check) verify a located core */ typedef struct { - c3_w len_w; - u3_noun sat; - u3j_fist fis_u[0]; + c3_w len_w; // number of fists + u3_noun sat; // static noun at end of check + u3j_fist fis_u[0]; // fists } u3j_fink; + /* u3j_rite: site of a %fast, used to skip re-mining */ typedef struct { - c3_o own_o; - u3_weak clu; - u3j_fink* fin_u; + c3_o own_o; // rite owns fink? + u3_weak clu; // cached product of clue formula + u3p(u3j_fink) fin_p; // fine check } u3j_rite; + /* u3j_site: site of a nock 9 */ struct _u3n_prog; typedef struct { struct _u3n_prog *pog_u; diff --git a/jets/b/levy.c b/jets/b/levy.c index 76d437371..3f4978b79 100644 --- a/jets/b/levy.c +++ b/jets/b/levy.c @@ -31,7 +31,7 @@ { u3_noun pro; u3j_site sit_u; - u3j_gate_prep(&sit_u, b); + u3j_gate_prep(&sit_u, u3k(b)); pro = _levy_in(&sit_u, a); u3j_gate_lose(&sit_u); return pro; diff --git a/jets/b/lien.c b/jets/b/lien.c index cede8fa83..c37b1ee8f 100644 --- a/jets/b/lien.c +++ b/jets/b/lien.c @@ -31,7 +31,7 @@ { u3_noun pro; u3j_site sit_u; - u3j_gate_prep(&sit_u, b); + u3j_gate_prep(&sit_u, u3k(b)); pro = _lien_in(&sit_u, a); u3j_gate_lose(&sit_u); return pro; diff --git a/jets/b/murn.c b/jets/b/murn.c index d177137f4..e0dcb8d23 100644 --- a/jets/b/murn.c +++ b/jets/b/murn.c @@ -37,7 +37,7 @@ { u3_noun pro; u3j_site sit_u; - u3j_gate_prep(&sit_u, b); + u3j_gate_prep(&sit_u, u3k(b)); pro = _murn_in(&sit_u, a); u3j_gate_lose(&sit_u); return pro; diff --git a/jets/b/reel.c b/jets/b/reel.c index 474e43280..de963fe34 100644 --- a/jets/b/reel.c +++ b/jets/b/reel.c @@ -28,7 +28,7 @@ { u3_noun pro; u3j_site sit_u; - u3j_gate_prep(&sit_u, b); + u3j_gate_prep(&sit_u, u3k(b)); pro = _reel_in(&sit_u, a, u3k(u3r_at(u3x_sam_3, b))); u3j_gate_lose(&sit_u); return pro; diff --git a/jets/b/roll.c b/jets/b/roll.c index 448c25275..49b7eccf0 100644 --- a/jets/b/roll.c +++ b/jets/b/roll.c @@ -26,7 +26,7 @@ { u3_noun pro; u3j_site sit_u; - u3j_gate_prep(&sit_u, b); + u3j_gate_prep(&sit_u, u3k(b)); pro = _roll_in(&sit_u, a, u3k(u3r_at(u3x_sam_3, b))); u3j_gate_lose(&sit_u); return pro; diff --git a/jets/b/skid.c b/jets/b/skid.c index 85269436d..29ab919b0 100644 --- a/jets/b/skid.c +++ b/jets/b/skid.c @@ -37,7 +37,7 @@ { u3_noun pro; u3j_site sit_u; - u3j_gate_prep(&sit_u, b); + u3j_gate_prep(&sit_u, u3k(b)); pro = _skid_in(&sit_u, a); u3j_gate_lose(&sit_u); return pro; diff --git a/jets/b/skim.c b/jets/b/skim.c index 0af438cd3..c5e721ec1 100644 --- a/jets/b/skim.c +++ b/jets/b/skim.c @@ -33,7 +33,7 @@ { u3_noun pro; u3j_site sit_u; - u3j_gate_prep(&sit_u, b); + u3j_gate_prep(&sit_u, u3k(b)); pro = _skim_in(&sit_u, a); u3j_gate_lose(&sit_u); return pro; diff --git a/jets/b/skip.c b/jets/b/skip.c index 7dc431a1f..36ff1a3e6 100644 --- a/jets/b/skip.c +++ b/jets/b/skip.c @@ -33,7 +33,7 @@ { u3j_site sit_u; u3_noun pro; - u3j_gate_prep(&sit_u, b); + u3j_gate_prep(&sit_u, u3k(b)); pro = _skip_in(&sit_u, a); u3j_gate_lose(&sit_u); return pro; diff --git a/jets/b/turn.c b/jets/b/turn.c index 42ba67e6e..e183ae4bf 100644 --- a/jets/b/turn.c +++ b/jets/b/turn.c @@ -24,7 +24,7 @@ u3_noun pro; u3j_site sit_u; - u3j_gate_prep(&sit_u, b); + u3j_gate_prep(&sit_u, u3k(b)); pro = _turn_in(&sit_u, a); u3j_gate_lose(&sit_u); return pro; diff --git a/noun/jets.c b/noun/jets.c index 4a6088b6e..3edce118a 100644 --- a/noun/jets.c +++ b/noun/jets.c @@ -1009,16 +1009,16 @@ u3j_rite_copy(u3j_rite* dst_u, u3j_rite* src_u, c3_o los_o) { if ( u3_none == src_u->clu ) { dst_u->clu = u3_none; - dst_u->fin_u = NULL; + dst_u->fin_p = 0; } else { - u3_noun old = dst_u->clu; - u3j_fink* fon_u = dst_u->fin_u; - c3_o own_o = dst_u->own_o; + u3_noun old = dst_u->clu; + u3j_fink* fon_u = u3to(u3j_fink, dst_u->fin_p); + c3_o own_o = dst_u->own_o; if ( c3y == src_u->own_o ) { dst_u->own_o = c3y; dst_u->clu = u3a_take(src_u->clu); - dst_u->fin_u = _cj_fink_take(src_u->fin_u); + dst_u->fin_p = u3of(u3j_fink, _cj_fink_take(u3to(u3j_fink, src_u->fin_p))); if ( (c3y == los_o) && (u3_none != old) && (c3y == own_o) ) { @@ -1280,6 +1280,7 @@ u3j_kink(u3_noun cor, u3_noun axe) } /* u3j_gate_prep(): prepare a locally cached gate to call repeatedly. + * core is TRANSFERRED. */ void u3j_gate_prep(u3j_site* sit_u, u3_noun cor) @@ -1288,9 +1289,10 @@ u3j_gate_prep(u3j_site* sit_u, u3_noun cor) u3t_on(glu_o); if ( c3n == u3du(cor) || c3n == u3du(u3t(cor)) ) { u3m_bail(c3__exit); + return; } sit_u->axe = 2; - sit_u->bat = u3k(cor); // a lie, this isn't really the battery! + sit_u->bat = cor; // a lie, this isn't really the battery! sit_u->pog_u = _cj_prog(u3h(cor)); if ( u3_none != (loc = sit_u->loc = _cj_spot(cor)) ) { u3_noun pax = u3h(u3t(loc)), @@ -1551,15 +1553,15 @@ u3j_rite_mine(u3j_rite* rit_u, u3_noun clu, u3_noun cor) if ( non_t || c3n == u3r_sing(rit_u->clu, clu) || - c3n == _cj_fine(cor, rit_u->fin_u) ) { + c3n == _cj_fine(cor, u3to(u3j_fink, rit_u->fin_p)) ) { u3_weak loc = _cj_mile(u3k(clu), u3k(cor)); if ( u3_none != loc ) { u3_noun old = rit_u->clu; - u3j_fink* fon_u = rit_u->fin_u; + u3j_fink* fon_u = u3to(u3j_fink, rit_u->fin_p); c3_o own_o = rit_u->own_o; rit_u->own_o = c3y; rit_u->clu = u3k(clu); - rit_u->fin_u = _cj_cast(cor, loc); + rit_u->fin_p = u3of(u3j_fink, _cj_cast(cor, loc)); u3z(loc); if ( !non_t && (c3y == own_o) ) { @@ -1842,7 +1844,7 @@ u3j_rite_lose(u3j_rite* rit_u) { if ( (c3y == rit_u->own_o) && u3_none != rit_u->clu ) { u3z(rit_u->clu); - _cj_fink_free(rit_u->fin_u); + _cj_fink_free(u3to(u3j_fink, rit_u->fin_p)); } } @@ -1854,7 +1856,7 @@ u3j_rite_mark(u3j_rite* rit_u) c3_w tot_w = 0; if ( (c3y == rit_u->own_o) && u3_none != rit_u->clu ) { tot_w += u3a_mark_noun(rit_u->clu); - tot_w += _cj_fink_mark(rit_u->fin_u); + tot_w += _cj_fink_mark(u3to(u3j_fink, rit_u->fin_p)); } return tot_w; } diff --git a/noun/nock.c b/noun/nock.c index 494ffc801..f682e1888 100644 --- a/noun/nock.c +++ b/noun/nock.c @@ -789,7 +789,7 @@ _n_prog_asm(u3_noun ops, u3n_prog* pog_u, u3_noun sip) u3j_rite* rit_u = &(pog_u->reg_u.rit_u[reg_s++]); rit_u->own_o = c3n; rit_u->clu = u3_none; - rit_u->fin_u = NULL; + rit_u->fin_p = 0; break; } }