Merge branch 'dillbo' into talk

This commit is contained in:
Galen Wolfe-Pauly 2015-03-19 13:14:17 -07:00
commit 9ae8048bc3
6 changed files with 44 additions and 7 deletions

View File

@ -300,6 +300,7 @@
# define c3__do c3_s2('d','o')
# define c3__doc c3_s3('d','o','c')
# define c3__dogo c3_s4('d','o','g','o')
# define c3__dojo c3_s4('d','o','j','o')
# define c3__dome c3_s4('d','o','m','e')
# define c3__done c3_s4('d','o','n','e')
# define c3__door c3_s4('d','o','o','r')
@ -412,6 +413,7 @@
# define c3__gab c3_s3('g','a','b')
# define c3__galb c3_s4('g','a','l','b')
# define c3__gald c3_s4('g','a','l','d')
# define c3__galk c3_s4('g','a','l','k')
# define c3__game c3_s4('g','a','m','e')
# define c3__gamp c3_s4('g','a','m','p')
# define c3__gant c3_s4('g','a','n','t')
@ -477,6 +479,7 @@
# define c3__head c3_s4('h','e','a','d')
# define c3__heal c3_s4('h','e','a','l')
# define c3__hear c3_s4('h','e','a','r')
# define c3__helm c3_s4('h','e','l','m')
# define c3__helo c3_s4('h','e','l','o')
# define c3__hep c3_s3('h','e','p')
# define c3__hept c3_s4('h','e','p','t')
@ -886,6 +889,7 @@
# define c3__scry c3_s4('s','c','r','y')
# define c3__scsg c3_s4('s','c','s','g')
# define c3__seal c3_s4('s','e','a','l')
# define c3__seat c3_s4('s','e','a','t')
# define c3__see c3_s3('s','e','e')
# define c3__seed c3_s4('s','e','e','d')
# define c3__seek c3_s4('s','e','e','k')

View File

@ -178,3 +178,12 @@
# else
# error "port: timeconvert"
# endif
/* Entropy
*/
# if defined(U3_OS_bsd) && defined(__OpenBSD__)
# define c3_rand(rd) (getentropy((void*)rd, 32) == 0 ? \
(void)0 : c3_assert(!"ent"))
# else
# define c3_rand u3_sist_rand
# endif

View File

@ -1094,6 +1094,11 @@
void
u3_sist_get(const c3_c* key_c, c3_y* val_y);
/* u3_sist_rand(): fill 8 words (32 bytes) with high-quality entropy.
*/
void
u3_sist_rand(c3_w* rad_w);
/** New timer system.
**/
/* u3_temp_io_init(): initialize time timer.

View File

@ -104,7 +104,7 @@ _reck_kick_term(u3_noun pox, c3_l tid_l, u3_noun fav)
u3_unix_ef_init(u3k(p_fav));
// uL(fprintf(uH, "kick: init: %d\n", p_fav));
uL(fprintf(uH, "kick: init: %d\n", p_fav));
u3z(pox); u3z(fav); return c3y;
} break;
}

View File

@ -444,10 +444,10 @@ _sist_bask(c3_c* pop_c, u3_noun may)
}
#endif
/* _sist_rand(): fill a 256-bit (8-word) buffer.
/* u3_sist_rand(): fill a 256-bit (8-word) buffer.
*/
static void
_sist_rand(c3_w* rad_w)
void
u3_sist_rand(c3_w* rad_w)
{
c3_i fid_i = open(DEVRANDOM, O_RDONLY);
@ -589,7 +589,7 @@ _sist_zest()
{
c3_w rad_w[8];
_sist_rand(rad_w);
c3_rand(rad_w);
sal_l = (0x7fffffff & rad_w[0]);
}
@ -599,7 +599,7 @@ _sist_zest()
c3_w rad_w[8];
u3_noun pas;
_sist_rand(rad_w);
c3_rand(rad_w);
pas = u3i_words(2, rad_w);
u3A->key = _sist_fatt(sal_l, u3k(pas));
@ -1201,7 +1201,7 @@ _sist_zen()
{
c3_w rad_w[8];
_sist_rand(rad_w);
c3_rand(rad_w);
return u3i_words(8, rad_w);
}

View File

@ -303,6 +303,7 @@ _term_listen_cb(uv_stream_t *wax_u, int sas_i)
{
u3_noun tid = u3dc("scot", c3__ud, tty_u->tid_l);
u3_noun pax = u3nq(u3_blip, c3__term, tid, u3_nul);
// u3v_plan(u3k(pax), u3nq(c3__flow, c3__seat, c3__dojo, u3_nul));
u3v_plan(u3k(pax), u3nc(c3__blew, u3nc(80, 25)));
u3v_plan(u3k(pax), u3nc(c3__hail, u3_nul));
u3z(pax);
@ -667,6 +668,20 @@ _term_it_save(u3_noun pax, u3_noun pad)
free(pax_c);
}
/* _term_io_flow(): send flow.
*/
static void
_term_io_flow(u3_utty* uty_u)
{
// u3_noun tid = u3dc("scot", c3__ud, uty_u->tid_l);
// u3_noun pax = u3nq(u3_blip, c3__term, tid, u3_nul);
// u3v_plan(pax, u3nq(c3__flow, c3__seat, c3__talk, u3_nul));
// u3v_plan(pax, u3nt(c3__flow, c3__seat, u3_nul));
// u3v_plan(pax, u3nq(c3__flow, c3__seat, c3__dojo, u3_nul));
// u3v_plan(pax, u3nq(c3__flow, c3__seat, c3__helm, u3_nul));
}
/* _term_io_belt(): send belt.
*/
static void
@ -817,6 +832,9 @@ _term_io_suck_char(u3_utty* uty_u, c3_y cay_y)
else if ( 13 == cay_y ) {
_term_io_belt(uty_u, u3nc(c3__ret, u3_nul));
}
else if ( 6 == cay_y ) {
_term_io_flow(uty_u); // XX hack
}
else if ( cay_y <= 26 ) {
_term_io_belt(uty_u, u3nc(c3__ctl, ('a' + (cay_y - 1))));
}
@ -1014,6 +1032,7 @@ u3_term_ef_bake(u3_noun fav)
u3_noun pax = u3nq(u3_blip, c3__term, '1', u3_nul);
u3v_plan(u3k(pax), u3nc(c3__boot, fav));
// u3v_plan(u3k(pax), u3nq(c3__flow, c3__seat, c3__dojo, u3_nul));
u3v_plan(u3k(pax), u3nc(c3__blew, u3_term_get_blew(1)));
u3v_plan(u3k(pax), u3nc(c3__hail, u3_nul));