gate_prep transfers, rites to posts

This commit is contained in:
Paul Driver 2018-04-30 09:57:09 -07:00
parent 35f137453e
commit d306975af8
12 changed files with 35 additions and 29 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}
}