booting and verifying - pasting in hashes now

This commit is contained in:
Paul Driver 2018-05-08 18:30:19 -07:00
parent 10c775961f
commit 109ad54c53
3 changed files with 141 additions and 42 deletions

View File

@ -21,9 +21,14 @@
jit=* :: FIXME: should probably be (map battery *)
:: since there can be multiple batteries per location
==
::
+= hot-info $: reg=registry
hot-index=@ud
drivers=(map axis @ud)
label=path
==
+= bash mug=@ :: later, noun-flavored sha256
+= hot (map bash registry)
::
+= hot (map bash hot-info)
+= cold (map battery=^ registry)
+= warm (map location activation)
#endif

View File

@ -217,8 +217,12 @@ static u3j_core _143_pen_d[] =
};
static u3j_harm _143_qua__cold_fun_a[] = {{".2", u3we_cold_fun}, {}};
static c3_c* _143_qua__cold_fun_ha[] = {
"7a6d3682",
0,
};
static u3j_core _143_qua__cold_d[] =
{ { "fun", 7, _143_qua__cold_fun_a },
{ { "fun", 7, _143_qua__cold_fun_a, 0, _143_qua__cold_fun_ha },
{}
};
@ -235,8 +239,12 @@ static u3j_core _143_pen_d[] =
};
static u3j_harm _143_qua__easy_fun_a[] = {{".2", u3we_easy_fun}, {}};
static c3_c* _143_qua__easy_fun_ha[] = {
"13cb0749",
0,
};
static u3j_core _143_qua__easy_d[] =
{ { "fun", 7, _143_qua__easy_fun_a },
{ { "fun", 7, _143_qua__easy_fun_a, 0, _143_qua__easy_fun_ha },
{}
};
@ -253,20 +261,32 @@ static u3j_core _143_pen_d[] =
};
static u3j_harm _143_qua__just_fun_a[] = {{".2", u3we_just_fun}, {}};
static c3_c* _143_qua__just_fun_ha[] = {
"50d2f368",
0,
};
static u3j_core _143_qua__just_d[] =
{ { "fun", 7, _143_qua__just_fun_a },
{ { "fun", 7, _143_qua__just_fun_a, 0, _143_qua__just_fun_ha },
{}
};
static u3j_harm _143_qua__mask_fun_a[] = {{".2", u3we_mask_fun}, {}};
static c3_c* _143_qua__mask_fun_ha[] = {
"5fb25be8",
0,
};
static u3j_core _143_qua__mask_d[] =
{ { "fun", 7, _143_qua__mask_fun_a },
{ { "fun", 7, _143_qua__mask_fun_a, 0, _143_qua__mask_fun_ha },
{}
};
static u3j_harm _143_qua__shim_fun_a[] = {{".2", u3we_shim_fun}, {}};
static c3_c* _143_qua__shim_fun_ha[] = {
"61c4cfac",
0,
};
static u3j_core _143_qua__shim_d[] =
{ { "fun", 7, _143_qua__shim_fun_a },
{ { "fun", 7, _143_qua__shim_fun_a, 0, _143_qua__shim_fun_ha },
{}
};
@ -283,8 +303,12 @@ static u3j_core _143_pen_d[] =
};
static u3j_harm _143_qua__stir_fun_a[] = {{".2", u3we_stir_fun}, {}};
static c3_c* _143_qua__stir_fun_ha[] = {
"261f565a",
0,
};
static u3j_core _143_qua__stir_d[] =
{ { "fun", 7, _143_qua__stir_fun_a },
{ { "fun", 7, _143_qua__stir_fun_a, 0, _143_qua__stir_fun_ha },
{}
};
@ -296,26 +320,64 @@ static u3j_core _143_pen_d[] =
static u3j_harm _143_qua_mink_a[] = {{".2", u3we_mink}, {}};
static u3j_harm _143_qua_mule_a[] = {{".2", u3we_mule}, {}};
static c3_c* _143_pen_ha[] = {
"4fcd534d",
0,
};
static c3_c* _143_qua_trip_ha[] = {
"2988e186",
0,
};
static c3_c* _143_qua__cold_ha[] = {
"7881e709",
0,
};
static c3_c* _143_qua__easy_ha[] = {
"7c0caf1b",
0,
};
static c3_c* _143_qua__just_ha[] = {
"295a2fbe",
0,
};
static c3_c* _143_qua__mask_ha[] = {
"25f3cc5e",
0,
};
static c3_c* _143_qua__shim_ha[] = {
"53e64202",
0,
};
static c3_c* _143_qua__stir_ha[] = {
"1e2b7159",
0,
};
static u3j_hood _143_pen_ho[] = {
{ "al", 350 },
{ "ap", 24412 },
{ "ut", 11262 },
{},
};
static u3j_core _143_qua_d[] =
{ { "pen", 3, 0, _143_pen_d },
{ { "pen", 3, 0, _143_pen_d, _143_pen_ha, _143_pen_ho },
{ "po", 7, 0, _143_qua__po_d },
{ "trip", 7, _143_qua_trip_a },
{ "trip", 7, _143_qua_trip_a, 0, _143_qua_trip_ha },
{ "bend", 7, 0, _143_qua__bend_d },
{ "cold", 7, 0, _143_qua__cold_d },
{ "cold", 7, 0, _143_qua__cold_d, _143_qua__cold_ha },
{ "comp", 7, 0, _143_qua__comp_d },
{ "cook", 7, 0, _143_qua__cook_d },
{ "easy", 7, 0, _143_qua__easy_d },
{ "easy", 7, 0, _143_qua__easy_d, _143_qua__easy_ha },
{ "glue", 7, 0, _143_qua__glue_d },
{ "here", 7, 0, _143_qua__here_d },
{ "just", 7, 0, _143_qua__just_d },
{ "mask", 7, 0, _143_qua__mask_d },
{ "shim", 7, 0, _143_qua__shim_d },
{ "just", 7, 0, _143_qua__just_d, _143_qua__just_ha },
{ "mask", 7, 0, _143_qua__mask_d, _143_qua__mask_ha },
{ "shim", 7, 0, _143_qua__shim_d, _143_qua__shim_ha },
{ "stag", 7, 0, _143_qua__stag_d },
{ "stew", 7, 0, _143_qua__stew_d },
{ "stir", 7, 0, _143_qua__stir_d },
{ "stir", 7, 0, _143_qua__stir_d, _143_qua__stir_ha },
{ "pfix", 7, _143_qua_pfix_a },
{ "plug", 7, _143_qua_plug_a },
@ -451,9 +513,17 @@ static u3j_core _143_qua_d[] =
static u3j_harm _143_tri_shas_a[] = {{".2", u3we_shas}, {}};
static u3j_harm _143_tri_shal_a[] = {{".2", u3we_shal}, {}};
static c3_c* _143_qua_ha[] = {
"7f2af46e",
0,
};
static u3j_hood _143_qua_ho[] = {
{ "mute", 0x17dfc },
{ "show", 0x2fbbaba },
{},
};
static u3j_core _143_tri_d[] =
{ { "qua", 3, 0, _143_qua_d },
{ { "qua", 3, 0, _143_qua_d, _143_qua_ha, _143_qua_ho },
{ "cofl", 7, 0, _143_tri__cofl_d },
{ "rd", 7, 0, _143_tri__rd_d },
{ "rs", 7, 0, _143_tri__rs_d },
@ -569,8 +639,12 @@ static u3j_core _143_tri_d[] =
static u3j_harm _143_two_mat_a[] = {{".2", u3we_mat}, {}};
static u3j_harm _143_two_rub_a[] = {{".2", u3we_rub}, {}};
static c3_c* _143_tri_ha[] = {
"6cc318e2",
0,
};
static u3j_core _143_two_d[] =
{ { "tri", 3, 0, _143_tri_d },
{ { "tri", 3, 0, _143_tri_d, _143_tri_ha },
{ "flop", 7, _143_two_flop_a },
{ "lent", 7, _143_two_lent_a },
{ "levy", 7, _143_two_levy_a },
@ -646,8 +720,12 @@ static u3j_core _143_two_d[] =
static u3j_harm _143_one_peg_a[] = {{".2", u3wc_peg, c3y}, {}};
static u3j_harm _143_one_mas_a[] = {{".2", u3wc_mas, c3y}, {}};
static c3_c* _143_two_ha[] = {
"613c4d6d",
0,
};
static u3j_core _143_one_d[] =
{ { "two", 3, 0, _143_two_d },
{ { "two", 3, 0, _143_two_d, _143_two_ha },
{ "add", 7, _143_one_add_a },
{ "dec", 7, _143_one_dec_a },
{ "div", 7, _143_one_div_a },
@ -666,13 +744,22 @@ static u3j_core _143_one_d[] =
{}
};
static c3_c* _143_one_ha[] = {
"c4b5bd8",
0,
};
u3j_core _k143_d[] =
{ { "one", 3, 0, _143_one_d },
{ { "one", 3, 0, _143_one_d, _143_one_ha },
{}
};
static c3_c* _k143_h[] = {
"13e199f7",
0
};
static u3j_core _d[] = {
{ "k143", 0, 0, _k143_d, 0, 0, (u3j_core*) 143, 0},
{ "k143", 0, 0, _k143_d, _k143_h, 0, (u3j_core*) 143, 0},
{}
};

View File

@ -51,13 +51,13 @@ _cj_core_loc(u3_noun pel, u3j_core* cop_u)
for ( i_w = 0; 0 != cop_u->huc_u[i_w].nam_c; ++i_w ) {
huc = u3kdb_put(huc,
u3i_string(cop_u->huc_u[i_w].nam_c),
cop_u->huc_u[i_w].axe_l);
u3nq(9, cop_u->huc_u[i_w].axe_l, 0, 1));
}
}
pat = ( 0 == cop_u->axe_l )
? u3nt(c3y, c3y, pel)
: ( (3 == cop_u->axe_l) && (c3y == u3h(pel)) )
: ( (3 == cop_u->axe_l) && (c3y == u3h(u3h(pel))) )
? u3nt(c3y, c3n, pel)
: u3nt(c3n, cop_u->axe_l, pel);
@ -70,7 +70,7 @@ static u3_noun
_cj_hash(c3_c* has_c)
{
c3_l mug;
sscanf(has_c, "%d", &mug);
sscanf(has_c, "%x", &mug);
return mug;
}
@ -177,8 +177,9 @@ _cj_install(u3j_core* ray_u, c3_w jax_l, u3_noun pel, u3_noun lab, u3j_core* dev
c3_w j_w;
for ( j_w = 0; 0 != kid_u->bas_u[j_w]; j_w++ ) {
u3_noun key = _cj_hash(kid_u->bas_u[j_w]),
reg = _cj_gust(u3h_get(u3D.hot_p, key),
kid_u->axe_l, u3k(pel), u3k(loc));
hot = u3h_get(u3D.hot_p, key),
old = ( u3_none == hot ) ? u3_none : u3k(u3h(hot)),
reg = _cj_gust(old, kid_u->axe_l, u3k(pel), u3k(loc));
u3h_put(u3D.hot_p, key,
u3nq(reg, jax_l, u3k(u3t(u3t(loc))), u3k(bal)));
u3z(key);
@ -681,7 +682,7 @@ u3j_boot(void)
memset(u3D.ray_u, 0, (u3D.all_l * sizeof(u3j_core)));
u3D.hot_p = u3h_new();
jax_l = _cj_install(u3D.ray_u, 1, (c3_l) (long long) u3D.ray_u[0].par_u, u3_nul, u3D.dev_u);
jax_l = _cj_install(u3D.ray_u, 1, (c3_l) (long long) u3D.dev_u[0].par_u, u3_nul, u3D.dev_u);
fprintf(stderr, "boot: installed %d jets\n", jax_l);
}
@ -1594,22 +1595,24 @@ _cj_mine(u3_noun cey, u3_noun cor)
u3h_put(u3R->jed.war_p, loc, act); // see note in _cj_spot
{
u3_noun bas = _cj_bash(bat);
u3_noun hot = u3h_get(u3D.hot_p, bas);
u3_noun bas = _cj_bash(bat),
hot = u3h_get(u3D.hot_p, bas);
c3_o hav_o = c3n;
if ( u3_none == hot ) {
u3m_p("unregistered battery", bal);
}
else {
u3_noun hol = _cj_reg_find(hot, cor);
u3_noun her = u3h(hot),
hol = _cj_reg_find(her, cor);
if ( hol != u3_none ) {
if ( c3n == u3r_sing(loc, hol) ) {
u3m_p("bogus hot location", hol);
u3m_p("bogus hot loc", hol);
u3m_p("registered as", loc);
}
else {
hav_o = c3y;
fprintf(stderr, "dev mode match: %x\r\n", bas);
}
}
u3z(hol);
@ -1652,14 +1655,17 @@ _cj_mile(u3_noun clu, u3_noun cor)
u3z(cor);
}
else {
loc = _cj_spot(cor, u3_none);
if ( u3_none == loc ) {
loc = _cj_moan(clu, cor);
}
else {
u3z(clu);
u3z(cor);
}
loc = _cj_moan(clu, cor);
// don't early terminate for located cores,
// that's handled at rites (fine checks)
//loc = _cj_spot(cor, u3_none);
//if ( u3_none == loc ) {
// loc = _cj_moan(clu, cor);
//}
//else {
// u3z(clu);
// u3z(cor);
//}
}
return loc;
}
@ -1669,9 +1675,11 @@ _cj_mile(u3_noun clu, u3_noun cor)
void
u3j_mine(u3_noun clu, u3_noun cor)
{
// TODO: bail early unless developer mode is set
u3t_on(glu_o);
if ( (c3n == u3du(cor)) || (c3y == _cj_scan(cor)) ) {
// this path (not called by bytecode interpreter) will not
// verify (as u3j_rite_mine does) that hot registration
// matches hinted registration.
u3z(clu);
u3z(cor);
}
@ -1689,7 +1697,6 @@ u3j_mine(u3_noun clu, u3_noun cor)
void
u3j_rite_mine(u3j_rite* rit_u, u3_noun clu, u3_noun cor)
{
// TODO: bail early unless developer mode is set
c3_t non_t;
u3t_on(glu_o);