Revert jet code to un-break.

This commit is contained in:
C. Guy Yarvin 2014-11-17 14:12:11 -08:00
parent 3e7455a14e
commit 5332ae57a3
2 changed files with 51 additions and 50 deletions

61
i/n/j.h
View File

@ -9,22 +9,14 @@
++ bash ,@uvH :: ctx identity hash
++ bosh ,@uvH :: local battery hash
++ batt ,* :: battery
++ calf ::
++ calx :: cached by battery
$: 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
++ chum $? lef=term :: jet name
[std=term kel=@] :: kelvin version
[ven=term pro=term kel=@] :: vendor and product
[ven=term pro=term ver=@ kel=@] :: all of the above
== ::
++ club (pair corp (map term nock)) :: battery pattern
++ clue ,[p=chum q=nock r=(list (pair term nock))] :: battery definition
++ clog (pair cope (map batt club)) :: identity record
++ clog (pair cope (map batt (map term nock))) :: identity record
++ cope (trel bane axis (each bash noun)) :: core pattern
++ corp (each batt core) :: parent or static
++ dash :: jet system
$: sys=(map batt bash) :: battery/identity
haw=(map bash clog) :: identity/core
@ -68,35 +60,39 @@
/** Data structures.
***
*** All of these are process structures on the heap or data segment.
*** All of these are transient structures allocated with malloc.
**/
/* u3j_harm: jet arm.
*/
typedef struct _u3j_harm {
c3_c* fcs_c; // `.axe` or name
u3_noun (*fun_f)(u3_noun); // compute or 0 / semitransfer
c3_o ice; // perfect (don't test)
c3_o tot; // total (never punts)
c3_o liv; // live (enabled)
c3_c* fcs_c; // `.axe` or name
u3_noun (*fun_f)(u3_noun); // compute or 0 / semitransfer
// c3_o (*val_f)(u3_noun); // validate or 0 / retain
c3_o ice; // perfect (don't test)
c3_o tot; // total (never punts)
c3_o liv; // live (enabled)
c3_l axe_l; // computed/discovered axis
struct _u3j_core* cop_u; // containing core
} u3j_harm;
/* u3j_core: driver definition.
*/
typedef struct _u3j_core {
c3_c* cos_c; // control string
struct _u3j_harm* arm_u; // blank-terminated static list
struct _u3j_core* dev_u; // blank-terminated static list
struct _u3j_core* par_u; // initialized parent pointer
c3_l jax_l; // initialized jet index
c3_c* cos_c; // control string
struct _u3j_harm* arm_u; // blank-terminated static list
struct _u3j_core* dev_u; // blank-terminated static list
struct _u3j_core* par_u; // dynamic parent pointer
c3_l axe_l; // axis to parent
c3_l jax_l; // index in global dashboard
} u3j_core;
/* u3e_dash, u3_Dash, u3D: jet dashboard singleton
*/
typedef struct _u3e_dash {
u3j_core* dev_u; // null-terminated static list
c3_l len_l; // dynamic array length
c3_l all_l; // allocated length
u3j_core* ray_u; // dynamic array by axis
u3j_core* dev_u; // null-terminated static list
c3_l len_l; // dynamic array length
c3_l all_l; // allocated length
u3j_core* ray_u; // dynamic array by axis
} u3j_dash;
/** Globals.
@ -114,6 +110,11 @@
void
u3j_boot(void);
/* u3j_clear(): clear jet table to re-register.
*/
void
u3j_clear(void);
/* u3j_hook():
**
** Execute hook from core.
@ -144,17 +145,19 @@
*/
u3_weak
u3j_kick(u3_noun cor,
u3_noun axe);
u3_noun axe);
/* u3j_kink(): kick either by jet or by nock.
*/
u3_noun
u3j_kink(u3_noun cor, u3_noun axe);
u3j_kink(u3_noun cor,
u3_noun axe);
/* u3j_mine(): register core for jets.
*/
void
u3j_mine(u3_noun clu, u3_noun cor);
u3j_mine(u3_noun clu,
u3_noun cor);
/* u3j_ream(): refresh after restoring from checkpoint.
*/

40
n/j.c
View File

@ -355,12 +355,12 @@ _cj_warm_hump(c3_l jax_l, u3_noun huc)
return hap;
}
/* _cj_hot_mean(): in parent, declare a core. RETAINS.
/* _cj_boil_mean(): in parent, declare a core. RETAINS.
**
** XX bat is used only for printing, remove.
*/
static c3_l
_cj_hot_mean(c3_l par_l, u3_noun mop, u3_noun bat)
_cj_boil_mean(c3_l par_l, u3_noun mop, u3_noun bat)
{
u3j_core* par_u;
u3j_core* dev_u;
@ -395,10 +395,10 @@ _cj_hot_mean(c3_l par_l, u3_noun mop, u3_noun bat)
return 0;
}
/* _cj_hot_mine(): in boiling state, declare a core. RETAINS.
/* _cj_boil_mine(): in boiling state, declare a core. RETAINS.
*/
static c3_l
_cj_hot_mine(u3_noun mop, u3_noun cor)
_cj_boil_mine(u3_noun mop, u3_noun cor)
{
u3_noun p_mop, q_mop, r_mop, hr_mop, tr_mop;
@ -412,12 +412,12 @@ _cj_hot_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(u3h(cax));
par_l = u3h(cax);
u3z(cax);
}
else par_l = 0;
return _cj_hot_mean(par_l, mop, u3h(cor));
return _cj_boil_mean(par_l, mop, u3h(cor));
}
}
@ -433,8 +433,9 @@ _cj_warm_ream_be(c3_l jax_l,
{
u3h_put(u3R->jed.har_p,
bat,
u3nt(u3nt(jax_l, u3k(pax), _cj_warm_hump(jax_l, huc)),
u3_nul,
u3nq(jax_l,
u3k(pax),
_cj_warm_hump(jax_l, huc),
u3k(huc)));
}
@ -468,7 +469,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(u3h(cax));
jax_l = u3h(cax);
u3z(cax);
}
else {
@ -497,7 +498,7 @@ _cj_warm_ream_at(u3_noun soh, u3_noun cag)
}
else par_l = 0;
jax_l = _cj_hot_mean(par_l, mop, 0);
jax_l = _cj_boil_mean(par_l, mop, 0);
_cj_warm_ream_is(jax_l, q_mop, sab);
return jax_l;
@ -568,13 +569,14 @@ _cj_warm_mine(u3_noun clu, u3_noun cor)
u3_noun mop;
if ( u3_none != (mop = _cj_cold_mine(cey, cor)) ) {
c3_l jax_l = _cj_hot_mine(mop, cor);
c3_l jax_l = _cj_boil_mine(mop, cor);
// fprintf(stderr, "warm: bat %x\r\n", u3r_mug(bat));
u3h_put(u3R->jed.har_p,
bat,
u3nt(u3nt(jax_l, u3k(pax), _cj_warm_hump(jax_l, huc)),
u3_nul,
u3nq(jax_l,
u3k(pax),
_cj_warm_hump(jax_l, huc),
u3k(huc)));
u3z(mop);
}
@ -725,13 +727,9 @@ _cj_hook_in(u3_noun cor,
if ( u3_none == cax ) { return u3m_bail(c3__fail); }
{
u3_noun p_cax, q_cax, r_cax;
u3_noun jax, pax, ext, huc, hap;
u3_noun jax, pax, huc, hap;
u3x_trel(cax, &p_cax, &q_cax, &r_cax);
u3x_trel(p_cax, &jax, &pax, &hap);
ext = q_cax;
huc = r_cax;
u3x_qual(cax, &jax, &pax, &hap, &huc);
{
c3_l jax_l = jax;
u3j_core* cop_u = &u3D.ray_u[jax_l];
@ -821,14 +819,14 @@ u3j_kick(u3_noun cor, u3_noun axe)
if ( u3_none == cax ) { return u3_none; }
{
u3_noun hap = u3t(u3t(u3h(cax)));
u3_noun hap = u3h(u3t(u3t(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(u3h(cax));
c3_l jax_l = u3h(cax);
u3j_core* cop_u = &u3D.ray_u[jax_l];
c3_l inx_l = inx;
u3j_harm* ham_u = &cop_u->arm_u[inx_l];