Merge branch 'master' of github.com:urbit/urbit

This commit is contained in:
C. Guy Yarvin 2014-01-15 22:44:20 -08:00
commit 327bba824f
6 changed files with 67 additions and 24 deletions

View File

@ -390,7 +390,9 @@
c3_c* hom_c; c3_c* hom_c;
c3_w kno_w; c3_w kno_w;
c3_w fuz_w; c3_w fuz_w;
c3_s por_s;
u2_bean abo; u2_bean abo;
u2_bean bat;
u2_bean gab; u2_bean gab;
u2_bean dem; u2_bean dem;
u2_bean loh; u2_bean loh;
@ -696,6 +698,11 @@
/** Main loop, new style. /** Main loop, new style.
**/ **/
/* u2_lo_boot(): restore or create pier.
*/
void
u2_lo_boot(void);
/* u2_lo_loop(): enter main event loop. /* u2_lo_loop(): enter main event loop.
*/ */
void void

View File

@ -311,7 +311,7 @@ u2_ames_io_init()
memset(&add_u, 0, sizeof(add_u)); memset(&add_u, 0, sizeof(add_u));
add_u.sin_family = AF_INET; add_u.sin_family = AF_INET;
add_u.sin_addr.s_addr = htonl(INADDR_ANY); add_u.sin_addr.s_addr = htonl(INADDR_ANY);
add_u.sin_port = htons(por_s); add_u.sin_port = htons(u2_Host.ops_u.por_s);
if ( uv_udp_bind(&sam_u->wax_u, add_u, 0) != 0 ) { if ( uv_udp_bind(&sam_u->wax_u, add_u, 0) != 0 ) {
uL(fprintf(uH, "ames: bind: %s\n", uL(fprintf(uH, "ames: bind: %s\n",

View File

@ -1832,10 +1832,10 @@ _lo_slow()
#endif #endif
} }
/* u2_lo_loop(): begin main event loop. /* u2_lo_boot(): restore or create pier.
*/ */
void void
u2_lo_loop(u2_reck* rec_u) u2_lo_boot()
{ {
uv_loop_t* lup_u = uv_default_loop(); uv_loop_t* lup_u = uv_default_loop();
@ -1846,6 +1846,13 @@ u2_lo_loop(u2_reck* rec_u)
_lo_init(); _lo_init();
_lo_boot(); _lo_boot();
}
/* u2_lo_loop(): begin main event loop.
*/
void
u2_lo_loop(u2_reck* rec_u)
{
{ {
u2_unix_ef_look(); u2_unix_ef_look();
u2_reck_plan(rec_u, u2nt(c3__gold, c3__ames, u2_nul), u2_reck_plan(rec_u, u2nt(c3__gold, c3__ames, u2_nul),
@ -1867,7 +1874,7 @@ u2_lo_loop(u2_reck* rec_u)
_lo_slow(); _lo_slow();
#endif #endif
uv_run(lup_u, UV_RUN_DEFAULT); uv_run(u2L, UV_RUN_DEFAULT);
} }
/* _lo_mark_reck(): mark a reck. /* _lo_mark_reck(): mark a reck.

View File

@ -45,6 +45,7 @@ _main_getopt(c3_i argc, c3_c** argv)
c3_i ch_i; c3_i ch_i;
u2_Host.ops_u.abo = u2_no; u2_Host.ops_u.abo = u2_no;
u2_Host.ops_u.bat = u2_no;
u2_Host.ops_u.gab = u2_no; u2_Host.ops_u.gab = u2_no;
u2_Host.ops_u.loh = u2_no; u2_Host.ops_u.loh = u2_no;
u2_Host.ops_u.dem = u2_no; u2_Host.ops_u.dem = u2_no;
@ -55,21 +56,12 @@ _main_getopt(c3_i argc, c3_c** argv)
u2_Host.ops_u.vno = u2_no; u2_Host.ops_u.vno = u2_no;
u2_Host.ops_u.kno_w = DefaultKernel; u2_Host.ops_u.kno_w = DefaultKernel;
u2_Host.ops_u.fuz_w = 0; u2_Host.ops_u.fuz_w = 0;
u2_Host.ops_u.por_s = 0;
while ( (ch_i = getopt(argc, argv, "k:f:h:I:Lcdsagqv")) != -1 ) { while ( (ch_i = getopt(argc, argv, "I:f:h:k:p:Labcdgqv")) != -1 ) {
switch ( ch_i ) { switch ( ch_i ) {
case 'L': { u2_Host.ops_u.loh = u2_yes; break; } case 'I': {
case 'a': { u2_Host.ops_u.abo = u2_yes; break; } u2_Host.ops_u.imp_c = strdup(optarg);
case 'c': { u2_Host.ops_u.nuu = u2_yes; break; }
case 'd': { u2_Host.ops_u.dem = u2_yes; break; }
case 'g': { u2_Host.ops_u.gab = u2_yes; break; }
case 'k': {
c3_w arg_w = atoi(optarg);
if ( (arg_w > 0) && (arg_w < 256) ) {
u2_Host.ops_u.kno_w = arg_w;
}
else return u2_no;
break; break;
} }
case 'f': { case 'f': {
@ -81,14 +73,34 @@ _main_getopt(c3_i argc, c3_c** argv)
else return u2_no; else return u2_no;
break; break;
} }
case 'I': {
u2_Host.ops_u.imp_c = strdup(optarg);
break;
}
case 'h': { case 'h': {
u2_Host.ops_u.hom_c = strdup(optarg); u2_Host.ops_u.hom_c = strdup(optarg);
break; break;
} }
case 'k': {
c3_w arg_w = atoi(optarg);
if ( (arg_w > 0) && (arg_w < 256) ) {
u2_Host.ops_u.kno_w = arg_w;
}
else return u2_no;
break;
}
case 'p': {
c3_w arg_w = atoi(optarg);
if ( (arg_w > 0) && (arg_w < 65536) ) {
u2_Host.ops_u.por_s = arg_w;
}
else return u2_no;
break;
}
case 'L': { u2_Host.ops_u.loh = u2_yes; break; }
case 'a': { u2_Host.ops_u.abo = u2_yes; break; }
case 'b': { u2_Host.ops_u.bat = u2_yes; break; }
case 'c': { u2_Host.ops_u.nuu = u2_yes; break; }
case 'd': { u2_Host.ops_u.dem = u2_yes; break; }
case 'g': { u2_Host.ops_u.gab = u2_yes; break; }
case 'q': { u2_Host.ops_u.veb = u2_no; break; } case 'q': { u2_Host.ops_u.veb = u2_no; break; }
case 'v': { u2_Host.ops_u.veb = u2_yes; break; } case 'v': { u2_Host.ops_u.veb = u2_yes; break; }
case 'V': { u2_Host.ops_u.vno = u2_yes; break; } case 'V': { u2_Host.ops_u.vno = u2_yes; break; }
@ -98,6 +110,11 @@ _main_getopt(c3_i argc, c3_c** argv)
} }
} }
if ( u2_yes == u2_Host.ops_u.bat ) {
u2_Host.ops_u.dem = u2_yes;
u2_Host.ops_u.nuu = u2_yes;
}
if ( u2_Host.ops_u.hom_c == 0 ) { if ( u2_Host.ops_u.hom_c == 0 ) {
u2_Host.ops_u.hom_c = getenv("URBIT_HOME"); u2_Host.ops_u.hom_c = getenv("URBIT_HOME");
@ -148,7 +165,7 @@ _main_getopt(c3_i argc, c3_c** argv)
static void static void
u2_ve_usage(c3_i argc, c3_c** argv) u2_ve_usage(c3_i argc, c3_c** argv)
{ {
fprintf(stderr, "%s: usage: [-v] [-k stage] computer\n", argv[0]); fprintf(stderr, "%s: usage: [-v] [-k stage] [-p ames_port] computer\n", argv[0]);
exit(1); exit(1);
} }
@ -218,7 +235,7 @@ main(c3_i argc,
} }
u2_ve_sysopt(); u2_ve_sysopt();
if ( u2_yes == u2_Host.ops_u.dem ) { if ( u2_yes == u2_Host.ops_u.dem && u2_no == u2_Host.ops_u.bat ) {
printf("Starting daemon\n"); printf("Starting daemon\n");
} }
@ -337,6 +354,10 @@ main(c3_i argc,
u2_lo_grab("main", u2_none); u2_lo_grab("main", u2_none);
u2_lo_loop(u2_Host.arv_u); u2_lo_boot();
if ( u2_no == u2_Host.ops_u.bat ) {
u2_lo_loop(u2_Host.arv_u);
}
return 0; return 0;
} }

View File

@ -7,6 +7,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/wait.h>
#include <unistd.h> #include <unistd.h>
#include <setjmp.h> #include <setjmp.h>
#include <gmp.h> #include <gmp.h>

View File

@ -421,9 +421,16 @@ _term_it_show_clear(u2_utty* uty_u)
if ( tat_u->siz.col_l ) { if ( tat_u->siz.col_l ) {
c3_w ful_w = tat_u->mir.cus_w / tat_u->siz.col_l; c3_w ful_w = tat_u->mir.cus_w / tat_u->siz.col_l;
if ( 0 != tat_u->mir.cus_w &&
ful_w * tat_u->siz.col_l == tat_u->mir.cus_w )
{
ful_w--;
}
while ( ful_w-- ) { while ( ful_w-- ) {
_term_it_write_txt(uty_u, uty_u->ufo_u.out.cuu1_y); _term_it_write_txt(uty_u, uty_u->ufo_u.out.cuu1_y);
} }
_term_it_write_str(uty_u, "\r"); _term_it_write_str(uty_u, "\r");
_term_it_write_txt(uty_u, uty_u->ufo_u.out.ed_y); _term_it_write_txt(uty_u, uty_u->ufo_u.out.ed_y);