Positioned to load brass style.

This commit is contained in:
C. Guy Yarvin 2017-06-03 13:34:37 -07:00
parent 4b39beedaf
commit e882a454dd
3 changed files with 49 additions and 27 deletions

View File

@ -722,7 +722,10 @@
c3_c* sys_c; // pill file
c3_d gen_d; // last event discovered
c3_d but_d; // boot barrier
c3_d key_d[4]; // save and passkey
c3_d sec_d[1]; // secret (unstretched)
c3_d key_d[4]; // secret (stretched)
c3_d who_d[2]; // identity
c3_c* who_c; // identity as C string
u3_disk* log_u; // event log
u3_lord* god_u; // computer
u3_ames* sam_u; // packet interface
@ -731,6 +734,7 @@
u3_save* sav_u; // autosave
u3_writ* ent_u; // entry of queue
u3_writ* ext_u; // exit of queue
uv_prepare_t pep_u; // preloop registration
} u3_pier;
/* u3_king: all executing piers.
@ -1493,9 +1497,10 @@
/* u3_pier_boot(): start the new pier system.
*/
void
u3_pier_boot(c3_c* pax_c, // pier path
c3_c* sys_c, // path to boot pill
uv_prepare_t *pep_u);
u3_pier_boot(u3_noun who, // identity
u3_noun sec, // secret or 0
u3_noun pax, // path to pier
u3_noun sys); // path to boot pill
/* u3_pier_tank(): dump single tank.
*/

View File

@ -35,8 +35,8 @@
$% $: $boot :: boot new pier
who/ship :: ship
sec/@ :: secret
sys/@ :: boot pill
pax/@t :: directory
sys/@ :: boot pill
== ::
$: $exit :: end the daemon
$~ ::
@ -217,16 +217,8 @@ _king_boot(u3_noun bul)
u3_noun who, sec, sys, pax;
u3r_qual(bul, &who, &sec, &sys, &pax);
{
uv_prepare_t* pep_u = u3a_malloc(sizeof(uv_prepare_t)); // put in u3_pier?
c3_c* pax_c = u3r_string(pax);
c3_c* sys_c = u3r_string(sys);
u3_pier_boot(u3k(who), u3k(sec), u3k(sys), u3k(pax));
if ( pax_c ) {
fprintf(stderr, "boot %s %s\r\n", pax_c, sys_c);
}
u3_pier_boot(pax_c, sys_c, pep_u);
}
u3z(bul);
}
@ -349,7 +341,7 @@ _boothack_cb(uv_connect_t *conn, int status)
mat = u3ke_jam(u3nc(c3__doom,
u3nc(c3__boot,
u3nq(who, sec, sys, pax))));
u3nq(who, sec, pax, sys))));
u3_newt_write(moj_u, mat, 0);
}

View File

@ -1801,36 +1801,61 @@ u3_pier_stub(void)
/* _pier_boot_make(): create/load a pier.
*/
static void
_pier_boot_make(c3_c* pax_c,
c3_c* sys_c)
static u3_pier*
_pier_boot_make(u3_noun who,
u3_noun sec,
u3_noun pax,
u3_noun sys)
{
c3_c* pax_c = u3r_string(pax);
c3_c* sys_c = u3r_string(sys);
u3_pier* pir_u;
pir_u = u3_pier_create(pax_c, sys_c);
u3z(pax); free(pax_c);
u3z(sys); free(sys_c);
{
u3_noun how = u3dc("scot", 'p', u3k(who));
pir_u->who_c = u3r_string(how);
u3z(how);
fprintf(stderr, "boot: ship: %s\r\n", pir_u->who_c);
}
u3r_chubs(0, 1, pir_u->sec_d, sec);
u3r_chubs(0, 2, pir_u->who_d, who);
u3z(sec);
u3z(who);
_pier_loop_init_pier(pir_u);
return pir_u;
}
/* u3_pier_boot(): start the new pier system.
*/
void
u3_pier_boot(c3_c* pax_c, // pier path
c3_c* sys_c, // path to boot pill
uv_prepare_t *pep_u)
u3_pier_boot(u3_noun who, // identity
u3_noun sec, // secret or 0
u3_noun pax, // path to pier
u3_noun sys) // path to boot pill (if needed)
{
/* make initial pier
u3_pier* pir_u;
/* make/load pier
*/
_pier_boot_make(pax_c, sys_c);
pir_u = _pier_boot_make(who, sec, pax, sys);
/* initialize polling handle
*/
uv_prepare_init(u3_Host.lup_u, pep_u);
uv_prepare_start(pep_u, _pier_loop_prepare);
uv_prepare_init(u3_Host.lup_u, &pir_u->pep_u);
uv_prepare_start(&pir_u->pep_u, _pier_loop_prepare);
/* initialize loop - move to _pier_boot_make().
*/
_pier_loop_init();
/* remember to deal with _pier_loop_exit stuff */
/* XX: _pier_loop_exit() should be called somewhere, but is not.
*/
}