posts in sites

This commit is contained in:
Paul Driver 2018-04-30 10:16:47 -07:00
parent d306975af8
commit 825b7eb604
3 changed files with 47 additions and 43 deletions

View File

@ -61,39 +61,43 @@
u3j_core* ray_u; // dynamic array by axis
} u3j_dash;
/* u3j_fist: a single step in a fine check */
/* u3j_fist: a single step in a fine check
*/
typedef struct {
u3_noun bat; // battery
u3_noun pax; // parent axis
} u3j_fist;
/* u3j_fink: (fine check) verify a located core */
/* u3j_fink: (fine check) verify a located core
*/
typedef struct {
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 */
/* u3j_rite: site of a %fast, used to skip re-mining
*/
typedef struct {
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 */
/* u3j_site: site of a kick (nock 9), used to cache call target
*/
struct _u3n_prog;
typedef struct {
struct _u3n_prog *pog_u;
u3_noun axe;
u3_weak bat;
u3_weak loc;
c3_o jet_o;
c3_o fon_o;
u3_weak lab;
u3j_core* cop_u;
u3j_harm* ham_u;
u3j_fink* fin_u;
u3p(struct _u3n_prog) pog_p; // program for formula
u3_noun axe; // axis
u3_weak bat; // battery (for verification)
u3_weak loc; // location (for reaming)
c3_o jet_o; // have jet driver?
c3_o fon_o; // site owns fink?
u3_weak lab; // label (for tracing)
u3j_core* cop_u; // jet core
u3j_harm* ham_u; // jet arm
u3p(u3j_fink) fin_p; // fine check
} u3j_site;
/** Globals.

View File

@ -788,7 +788,7 @@ _cj_hank_fine(_cj_hank* han_u, u3_noun cor, u3_noun *inn)
else {
u3j_site* sit_u = &(han_u->sit_u);
c3_assert(u3_none != sit_u->loc);
return _cj_fine(*inn, sit_u->fin_u);
return _cj_fine(*inn, u3to(u3j_fink, sit_u->fin_p));
}
}
}
@ -846,14 +846,14 @@ _cj_hank_fill(_cj_hank* han_u, u3_noun tam, u3_noun cor)
u3z(got);
sit_u->bat = u3k(u3h(cor));
sit_u->loc = u3k(loc);
sit_u->fin_u = _cj_cast(cor, loc);
sit_u->fin_p = u3of(u3j_fink, _cj_cast(cor, loc));
sit_u->fon_o = c3y;
if ( 0 == (sit_u->axe = _cj_axis(fol)) ) {
sit_u->jet_o = c3n;
sit_u->pog_u = _cj_prog(fol);
sit_u->pog_p = u3of(u3n_prog, _cj_prog(fol));
}
else {
han_u->sit_u.pog_u = _cj_prog(u3r_at(sit_u->axe, cor));
han_u->sit_u.pog_p = u3of(u3n_prog, _cj_prog(u3r_at(sit_u->axe, cor)));
han_u->sit_u.jet_o = _cj_nail(loc, sit_u->axe,
&(sit_u->lab), &(sit_u->cop_u), &(sit_u->ham_u));
}
@ -1043,21 +1043,21 @@ u3j_site_copy(u3j_site* dst_u, u3j_site* src_u, c3_o los_o)
}
else {
dst_u->bat = u3_none;
dst_u->pog_u = NULL;
dst_u->pog_p = 0;
dst_u->loc = u3_none;
dst_u->lab = u3_none;
dst_u->jet_o = c3n;
dst_u->fon_o = c3n;
dst_u->cop_u = NULL;
dst_u->ham_u = NULL;
dst_u->fin_u = NULL;
dst_u->fin_p = 0;
}
if ( u3_none != src_u->loc ) {
u3_noun lob = dst_u->lab,
lod = dst_u->loc;
c3_o fon_o = dst_u->fon_o;
u3j_fink* fon_u = dst_u->fin_u;
u3p(u3j_fink) fon_p = dst_u->fin_p;
dst_u->loc = u3a_take(src_u->loc);
dst_u->lab = u3a_take(src_u->lab);
@ -1066,11 +1066,11 @@ u3j_site_copy(u3j_site* dst_u, u3j_site* src_u, c3_o los_o)
dst_u->jet_o = src_u->jet_o;
if ( c3y == src_u->fon_o ) {
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)));
dst_u->fon_o = c3y;
}
else if ( fon_u != src_u->fin_u ) {
dst_u->fin_u = src_u->fin_u;
else if ( fon_p != src_u->fin_p ) {
dst_u->fin_p = src_u->fin_p;
dst_u->fon_o = c3n;
}
else {
@ -1082,7 +1082,7 @@ u3j_site_copy(u3j_site* dst_u, u3j_site* src_u, c3_o los_o)
u3z(lod);
u3z(lob);
if ( c3y == fon_o ) {
_cj_fink_free(fon_u);
_cj_fink_free(u3to(u3j_fink, fon_p));
}
}
}
@ -1108,7 +1108,7 @@ _cj_site_lock(u3_noun cor, u3j_site* sit_u)
(c3y == u3r_sing(sit_u->bat, u3h(cor))) ) {
return u3_none;
}
sit_u->pog_u = _cj_prog(u3r_at(sit_u->axe, cor));
sit_u->pog_p = u3of(u3n_prog, _cj_prog(u3r_at(sit_u->axe, cor)));
if ( u3_none != sit_u->bat ) {
u3z(sit_u->bat);
}
@ -1145,7 +1145,7 @@ _cj_site_kick_hot(u3_noun cor, u3j_site* sit_u)
if ( u3_none == pro ) {
pro = _cj_site_lock(cor, sit_u);
if ( u3_none == pro ) {
pro = _cj_burn(cor, sit_u->pog_u);
pro = _cj_burn(cor, u3to(u3n_prog, sit_u->pog_p));
}
}
if ( c3y == pof_o ) {
@ -1163,7 +1163,7 @@ _cj_site_kick(u3_noun cor, u3j_site* sit_u)
loc = pro = u3_none;
if ( u3_none != sit_u->loc ) {
if ( c3y == _cj_fine(cor, sit_u->fin_u) ) {
if ( c3y == _cj_fine(cor, u3to(u3j_fink, sit_u->fin_p)) ) {
loc = sit_u->loc;
if ( c3y == sit_u->jet_o ) {
pro = _cj_site_kick_hot(cor, sit_u);
@ -1174,7 +1174,7 @@ _cj_site_kick(u3_noun cor, u3j_site* sit_u)
if ( u3_none == loc ) {
loc = _cj_spot(cor);
if ( u3_none != loc ) {
u3j_fink* fon_u = NULL;
u3p(u3j_fink) fon_p = 0;
u3_weak lod = u3_none;
u3_weak lob = u3_none;
@ -1182,12 +1182,12 @@ _cj_site_kick(u3_noun cor, u3j_site* sit_u)
lod = sit_u->loc;
lob = sit_u->lab;
if ( c3y == sit_u->fon_o ) {
fon_u = sit_u->fin_u;
fon_p = sit_u->fin_p;
}
}
sit_u->loc = loc;
sit_u->fin_u = _cj_cast(cor, loc);
sit_u->fin_p = u3of(u3j_fink, _cj_cast(cor, loc));
sit_u->fon_o = c3y;
if ( c3y ==
(sit_u->jet_o = _cj_nail(loc, sit_u->axe,
@ -1202,8 +1202,8 @@ _cj_site_kick(u3_noun cor, u3j_site* sit_u)
if ( u3_none != lod ) {
u3z(lod);
u3z(lob);
if ( NULL != fon_u ) {
_cj_fink_free(fon_u);
if ( 0 != fon_p ) {
_cj_fink_free(u3to(u3j_fink, fon_p));
}
}
}
@ -1248,7 +1248,7 @@ u3j_cook(const c3_c* key_c,
}
pro = _cj_site_kick(u3k(inn), &(han_u->sit_u));
if ( u3_none == pro ) {
pro = _cj_burn(inn, han_u->sit_u.pog_u);
pro = _cj_burn(inn, u3to(u3n_prog, han_u->sit_u.pog_p));
}
u3z(cor);
@ -1293,7 +1293,7 @@ u3j_gate_prep(u3j_site* sit_u, u3_noun cor)
}
sit_u->axe = 2;
sit_u->bat = cor; // a lie, this isn't really the battery!
sit_u->pog_u = _cj_prog(u3h(cor));
sit_u->pog_p = u3of(u3n_prog, _cj_prog(u3h(cor)));
if ( u3_none != (loc = sit_u->loc = _cj_spot(cor)) ) {
u3_noun pax = u3h(u3t(loc)),
pay = u3qc_cap(pax),
@ -1328,7 +1328,7 @@ u3j_gate_slam(u3j_site* sit_u, u3_noun sam)
pro = _cj_site_kick_hot(cor, sit_u);
}
if ( u3_none == pro ) {
pro = _cj_burn(cor, sit_u->pog_u);
pro = _cj_burn(cor, u3to(u3n_prog, sit_u->pog_p));
}
u3t_off(glu_o);
return pro;
@ -1832,7 +1832,7 @@ u3j_site_lose(u3j_site* sit_u)
u3z(sit_u->loc);
u3z(sit_u->lab);
if ( c3y == sit_u->fon_o ) {
_cj_fink_free(sit_u->fin_u);
_cj_fink_free(u3to(u3j_fink, sit_u->fin_p));
}
}
}
@ -1874,7 +1874,7 @@ u3j_site_mark(u3j_site* sit_u)
tot_w += u3a_mark_noun(sit_u->loc);
tot_w += u3a_mark_noun(sit_u->lab);
if ( c3y == sit_u->fon_o ) {
tot_w += _cj_fink_mark(sit_u->fin_u);
tot_w += _cj_fink_mark(u3to(u3j_fink, sit_u->fin_p));
}
}
return tot_w;

View File

@ -883,7 +883,7 @@ _n_prog_asm(u3_noun ops, u3n_prog* pog_u, u3_noun sip)
_n_prog_asm_inx(buf_y, &i_w, cal_s, cod);
u3j_site* sit_u = &(pog_u->cal_u.sit_u[cal_s++]);
sit_u->axe = u3k(u3t(op));
sit_u->pog_u = NULL;
sit_u->pog_p = 0;
sit_u->bat = u3_none;
sit_u->loc = u3_none;
sit_u->lab = u3_none;
@ -891,7 +891,7 @@ _n_prog_asm(u3_noun ops, u3n_prog* pog_u, u3_noun sip)
sit_u->fon_o = c3n;
sit_u->cop_u = NULL;
sit_u->ham_u = NULL;
sit_u->fin_u = NULL;
sit_u->fin_p = 0;
break;
}
}
@ -1449,7 +1449,7 @@ _n_find(u3_noun fol)
for ( i_w = 0; i_w < old->cal_u.len_w; ++i_w ) {
u3j_site* sit_u = &(old->cal_u.sit_u[i_w]);
sit_u->bat = u3_none;
sit_u->pog_u = NULL;
sit_u->pog_p = 0;
sit_u->fon_o = c3n;
}
u3h_put(u3R->byc.har_p, fol, u3a_outa(old));
@ -1938,7 +1938,7 @@ _n_burn(u3n_prog* pog_u, u3_noun bus, c3_ys mov, c3_ys off)
fam->ip_w = ip_w;
fam->pog_u = pog_u;
pog_u = sit_u->pog_u;
pog_u = u3to(u3n_prog, sit_u->pog_p);
pog = pog_u->byc_u.ops_y;
ip_w = 0;
#ifdef U3_CPU_DEBUG
@ -1970,7 +1970,7 @@ _n_burn(u3n_prog* pog_u, u3_noun bus, c3_ys mov, c3_ys off)
*top = _n_kick(o, sit_u);
if ( u3_none == *top ) {
*top = o;
pog_u = sit_u->pog_u;
pog_u = u3to(u3n_prog, sit_u->pog_p);
pog = pog_u->byc_u.ops_y;
ip_w = 0;
#ifdef U3_CPU_DEBUG