Re-restructure calx.

This commit is contained in:
C. Guy Yarvin 2014-11-17 14:57:05 -08:00
parent 5332ae57a3
commit 031856b0ef
2 changed files with 17 additions and 50 deletions

39
i/n/j.h
View File

@ -9,53 +9,18 @@
++ bash ,@uvH :: ctx identity hash
++ bosh ,@uvH :: local battery hash
++ batt ,* :: battery
++ calx :: cached by battery
++ calf ::
$: jax=,@ud :: jet index
pax=,@ud :: parent axis or 0
hap=(map ,@ud ,@ud) :: axis/jet
huc=(map term nock) :: name/tool
== ::
++ calx (trel calf ,* (map term nock)) :: cached by battery
++ clog (pair cope (map batt (map term nock))) :: identity record
++ cope (trel bane axis (each bash noun)) :: core pattern
++ dash :: jet system
$: sys=(map batt bash) :: battery/identity
haw=(map bash clog) :: identity/core
== ::
++ je !: :: dashboard door
|_ dash
++ fsck :: parse classic clue
|= clu=clue
^- [p=term q=axis r=(map term nock)]
:+ ?@ p.clu `@tas`p.clu
?> ?=([@ @] p.clu)
(cat 3 -.p.clu (scot %ud +.p.clu))
|- ^- axis
?: ?=([10 *] q.clu) $(q.clu +>.q.clu)
?: ?=([1 0] q.clu) 0
?> ?=([0 @] q.clu) +.q.clu
(~(gas by *(map term nock)) r.jlu)
::
++ fund :: register battery
|= [clu=clue cor=*] ::
^+ +>
?. =(~ (find cor)) +>.$
=+ cey=(fsck clu)
=+ ^= mop ^- (trel bane axis (each bash ,*))
:- p.cey
?: =(0 q.cey)
[3 %| -.cor]
[q.cey %& (~(got by sys) -:.*([0 q.cey] cor))]
=+ soh=(sham mop)
=+ cag=(~(get by haw) soh)
%= +>.$
sys (~(put by sys) -.cor [soh r.cey])
haw %+ ~(put by haw) soh
:- mop
?~ cag
[[-.cor r.cey] ~ ~]
(~(put by q.u.cag) -.cor r.cey)
==
--
#endif
/** Data structures.

28
n/j.c
View File

@ -412,7 +412,7 @@ _cj_boil_mine(u3_noun mop, u3_noun cor)
if ( c3y == hr_mop ) {
u3_noun cax = _cj_warm_fend(u3h(u3r_at(q_mop, cor)));
par_l = u3h(cax);
par_l = u3h(u3h(cax));
u3z(cax);
}
else par_l = 0;
@ -433,9 +433,8 @@ _cj_warm_ream_be(c3_l jax_l,
{
u3h_put(u3R->jed.har_p,
bat,
u3nq(jax_l,
u3k(pax),
_cj_warm_hump(jax_l, huc),
u3nt(u3nt(jax_l, u3k(pax), _cj_warm_hump(jax_l, huc)),
u3_nul,
u3k(huc)));
}
@ -469,7 +468,7 @@ _cj_warm_ream_un(u3_noun soh)
c3_l jax_l;
if ( u3_none != (cax = u3h_get(u3R->jed.har_p, u3h(u3h(sab)))) ) {
jax_l = u3h(cax);
jax_l = u3h(u3h(cax));
u3z(cax);
}
else {
@ -574,9 +573,8 @@ _cj_warm_mine(u3_noun clu, u3_noun cor)
// fprintf(stderr, "warm: bat %x\r\n", u3r_mug(bat));
u3h_put(u3R->jed.har_p,
bat,
u3nq(jax_l,
u3k(pax),
_cj_warm_hump(jax_l, huc),
u3nt(u3nt(jax_l, u3k(pax), _cj_warm_hump(jax_l, huc)),
u3_nul,
u3k(huc)));
u3z(mop);
}
@ -727,9 +725,13 @@ _cj_hook_in(u3_noun cor,
if ( u3_none == cax ) { return u3m_bail(c3__fail); }
{
u3_noun jax, pax, huc, hap;
u3_noun p_cax, q_cax, r_cax;
u3_noun jax, pax, ext, huc, hap;
u3x_qual(cax, &jax, &pax, &hap, &huc);
u3x_trel(cax, &p_cax, &q_cax, &r_cax);
u3x_trel(p_cax, &jax, &pax, &hap);
ext = q_cax;
huc = r_cax;
{
c3_l jax_l = jax;
u3j_core* cop_u = &u3D.ray_u[jax_l];
@ -819,16 +821,16 @@ u3j_kick(u3_noun cor, u3_noun axe)
if ( u3_none == cax ) { return u3_none; }
{
u3_noun hap = u3h(u3t(u3t(cax)));
u3_noun hap = u3t(u3t(u3h(cax)));
u3_noun inx = u3kdb_get(u3k(hap), u3k(axe));
if ( u3_none == inx ) {
u3z(cax); return u3_none;
}
else {
c3_l jax_l = u3h(cax);
c3_l jax_l = u3h(u3h(cax));
u3j_core* cop_u = &u3D.ray_u[jax_l];
c3_l inx_l = inx;
c3_l inx_l = inx;
u3j_harm* ham_u = &cop_u->arm_u[inx_l];
u3_noun pro;