vere: pill reform

This commit is contained in:
Joe Bryan 2020-12-06 20:15:57 -08:00
parent ea06fbed59
commit fe7c37c324
3 changed files with 79 additions and 64 deletions

View File

@ -52,7 +52,12 @@ _cv_lite(u3_noun pil)
{
u3_noun eve, pro;
u3x_trel(pil, &eve, 0, 0);
{
u3_noun hed, tal;
u3x_cell(pil, &hed, &tal);
u3_assent( u3r_sing_c("ivory", hed) );
eve = tal;
}
u3l_log("lite: arvo formula %x\r\n", u3r_mug(pil));
pro = u3v_life(u3k(eve));

View File

@ -69,24 +69,10 @@ static c3_w sag_w;
==
:: +pill: boot-sequence ingredients
::
+$ pill
%+ each
:: %&: complete pill (either +brass or +solid)
::
:: p: jammed pill
:: q: optional %into ovum overriding that of .p
::
[p=@ q=(unit ovum)]
:: %|: incomplete pill (+ivory)
::
:: XX not implemented, needs generation of
:: %veer ova for install %zuse and the vanes
::
:: p: jammed pill
:: q: module ova
:: r: userspace ova
::
[p=@ q=(list ovum) r=(list ovum)]
:: p: jammed pill
:: q: optional %into ovum overriding that of .p
::
+$ pill [p=@ q=(unit ovum)]
--
*/
@ -382,7 +368,7 @@ _boothack_pill(void)
arv = u3nc(u3_nul, u3_unix_initial_into_card(u3_Host.ops_u.arv_c));
}
return u3nt(c3y, pil, arv);
return u3nc(pil, arv);
}
/* _boothack_key(): parse a private key file or value

View File

@ -1584,64 +1584,88 @@ static u3_boot
_pier_pill_parse(u3_noun pil)
{
u3_boot bot_u;
u3_noun pil_p, pil_q, pil_r;
u3_noun pro;
u3_noun pil_p, pil_q;
c3_assert( c3y == u3du(pil) );
u3x_cell(pil, &pil_p, &pil_q);
if ( c3y == u3h(pil) ) {
u3x_trel(pil, 0, &pil_p, &pil_q);
{
// XX use faster cue
//
u3_noun pro = u3m_soft(0, u3ke_cue, u3k(pil_p));
u3_noun mot, tag, dat;
if ( (c3n == u3r_trel(pro, &mot, &tag, &dat))
|| (u3_blip != mot) )
{
u3m_p("mot", u3h(pro));
fprintf(stderr, "boot: failed: unable to parse pill\r\n");
u3_king_bail();
exit(1);
}
if ( c3y == u3r_sing_c("ivory", tag) ) {
fprintf(stderr, "boot: failed: unable to boot from ivory pill\r\n");
exit(1);
}
else if ( c3__pill != tag ) {
if ( c3y == u3a_is_atom(tag) ) {
u3m_p("pill", tag);
}
fprintf(stderr, "boot: failed: unrecognized pill\r\n");
u3_king_bail();
exit(1);
}
{
u3_noun typ;
c3_c* typ_c;
if ( c3n == u3r_qual(dat, &typ, &bot_u.bot, &bot_u.mod, &bot_u.use) ) {
fprintf(stderr, "boot: failed: unable to extract pill\r\n");
u3_king_bail();
exit(1);
}
if ( c3y == u3a_is_atom(typ) ) {
c3_c* typ_c = u3r_string(typ);
fprintf(stderr, "boot: parsing %%%s pill\r\n", typ_c);
c3_free(typ_c);
}
}
u3k(bot_u.bot); u3k(bot_u.mod); u3k(bot_u.use);
u3z(pro);
}
else {
u3x_qual(pil, 0, &pil_p, &pil_q, &pil_r);
}
pro = u3m_soft(0, u3ke_cue, u3k(pil_p));
if ( 0 != u3h(pro) ) {
fprintf(stderr, "boot: failed: unable to parse pill\r\n");
exit(1);
}
u3x_trel(u3t(pro), &bot_u.bot, &bot_u.mod, &bot_u.use);
u3k(bot_u.bot); u3k(bot_u.mod); u3k(bot_u.use);
// optionally replace filesystem in userspace
//
if ( c3y == u3h(pil) ) {
if ( u3_nul != pil_q ) {
c3_w len_w = 0;
u3_noun ova = bot_u.use;
u3_noun new = u3_nul;
u3_noun ovo;
if ( u3_nul != pil_q ) {
c3_w len_w = 0;
u3_noun ova = bot_u.use;
u3_noun new = u3_nul;
u3_noun ovo;
while ( u3_nul != ova ) {
ovo = u3h(ova);
while ( u3_nul != ova ) {
ovo = u3h(ova);
if ( c3__into == u3h(u3t(ovo)) ) {
c3_assert( 0 == len_w );
len_w++;
ovo = u3t(pil_q);
}
new = u3nc(u3k(ovo), new);
ova = u3t(ova);
if ( c3__into == u3h(u3t(ovo)) ) {
c3_assert( 0 == len_w );
len_w++;
ovo = u3t(pil_q);
}
c3_assert( 1 == len_w );
u3z(bot_u.use);
bot_u.use = u3kb_flop(new);
new = u3nc(u3k(ovo), new);
ova = u3t(ova);
}
}
// prepend %lite module and userspace ova
//
else {
bot_u.mod = u3kb_weld(u3k(pil_q), bot_u.mod);
bot_u.use = u3kb_weld(u3k(pil_r), bot_u.use);
c3_assert( 1 == len_w );
u3z(bot_u.use);
bot_u.use = u3kb_flop(new);
}
u3z(pro); u3z(pil);
u3z(pil);
return bot_u;
}