mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-01 20:04:09 +03:00
More typed .^.
This commit is contained in:
parent
326fd27db8
commit
b26fd40636
@ -102,6 +102,7 @@
|
||||
u3_noun u3we_rub(u3_noun);
|
||||
u3_noun u3we_lore(u3_noun);
|
||||
u3_noun u3we_loss(u3_noun);
|
||||
u3_noun u3we_micq(u3_noun);
|
||||
u3_noun u3we_mick(u3_noun);
|
||||
u3_noun u3we_mink(u3_noun);
|
||||
u3_noun u3we_mule(u3_noun);
|
||||
|
@ -148,6 +148,7 @@
|
||||
struct { // namespace
|
||||
u3_noun flu; // (list $+(* (unit))), old
|
||||
u3_noun sea; // (list $+(* (unit))), new
|
||||
u3_noun gul; // (list $+(* (unit (unit)))) now
|
||||
} ski;
|
||||
|
||||
struct { // trace stack
|
||||
|
@ -73,6 +73,7 @@
|
||||
u3_noun
|
||||
u3m_soft_run(u3_noun fly,
|
||||
u3_noun sea,
|
||||
u3_noun gul,
|
||||
u3_funq fun_f,
|
||||
u3_noun aga,
|
||||
u3_noun agb);
|
||||
|
@ -29,6 +29,11 @@
|
||||
u3_noun
|
||||
u3n_nock_it(u3_noun sea, u3_noun bus, u3_noun fol);
|
||||
|
||||
/* u3n_nock_et(): produce .*(bus fol), as ++toon, in namespace.
|
||||
*/
|
||||
u3_noun
|
||||
u3n_nock_et(u3_noun gul, u3_noun bus, u3_noun fol);
|
||||
|
||||
/* u3n_slam_in(): produce (gat sam), as ++toon, in namespace.
|
||||
*/
|
||||
u3_noun
|
||||
@ -39,6 +44,11 @@
|
||||
u3_noun
|
||||
u3n_slam_it(u3_noun sea, u3_noun gat, u3_noun sam);
|
||||
|
||||
/* u3n_slam_et(): produce (gat sam), as ++toon, in namespace.
|
||||
*/
|
||||
u3_noun
|
||||
u3n_slam_it(u3_noun gul, u3_noun gat, u3_noun sam);
|
||||
|
||||
/* u3n_nock_an(): as slam_in(), but with empty fly.
|
||||
*/
|
||||
u3_noun
|
||||
|
@ -45,3 +45,24 @@
|
||||
return som;
|
||||
}
|
||||
}
|
||||
|
||||
u3_noun
|
||||
u3we_micq(u3_noun cor)
|
||||
{
|
||||
u3_noun bus, fol, gul;
|
||||
|
||||
if ( c3n == u3r_mean(cor, u3x_sam_4, &bus,
|
||||
u3x_sam_5, &fol,
|
||||
u3x_sam_3, &gul,
|
||||
0) )
|
||||
{
|
||||
return u3m_bail(c3__exit);
|
||||
}
|
||||
else {
|
||||
u3_noun som;
|
||||
|
||||
som = u3n_nock_et(u3k(gul), u3k(bus), u3k(fol));
|
||||
|
||||
return som;
|
||||
}
|
||||
}
|
||||
|
@ -502,7 +502,7 @@
|
||||
u3_noun viz = _mint_in(van, sut, c3__noun, q_gen);
|
||||
|
||||
ret = u3nc(u3k(u3h(nef)),
|
||||
u3nt(12, u3nc(1, u3k(u3h(nef))), u3k(u3t(viz))));
|
||||
u3nt(11, u3nc(1, u3nc(151, u3k(u3h(nef)))), u3k(u3t(viz))));
|
||||
|
||||
u3z(viz);
|
||||
u3z(nef);
|
||||
|
@ -125,6 +125,7 @@ static u3j_harm _mood__hoon_rub_a[] = {{".2", u3we_rub}, {}};
|
||||
static u3j_harm _mood__hoon_lore_a[] = {{".2", u3we_lore}, {}};
|
||||
static u3j_harm _mood__hoon_loss_a[] = {{".2", u3we_loss}, {}};
|
||||
static u3j_harm _mood__hoon_mick_a[] = {{".2", u3we_mick}, {}};
|
||||
static u3j_harm _mood__hoon_micq_a[] = {{".2", u3we_micq}, {}};
|
||||
static u3j_harm _mood__hoon_mink_a[] = {{".2", u3we_mink}, {}};
|
||||
static u3j_harm _mood__hoon_mule_a[] = {{".2", u3we_mule}, {}};
|
||||
static u3j_harm _mood__hoon_repg_a[] = {{".2", u3we_repg}, {}};
|
||||
@ -487,6 +488,7 @@ static u3j_core _mood__hoon_d[] =
|
||||
{ "loss", _mood__hoon_loss_a },
|
||||
{ "mink", _mood__hoon_mink_a },
|
||||
{ "mick", _mood__hoon_mick_a },
|
||||
{ "micq", _mood__hoon_micq_a },
|
||||
{ "mule", _mood__hoon_mule_a },
|
||||
{ "repg", _mood__hoon_repg_a },
|
||||
{ "rexp", _mood__hoon_rexp_a },
|
||||
|
@ -471,6 +471,7 @@ u3m_mark(void)
|
||||
tot_w += u3a_mark_noun(u3R->jed.das);
|
||||
tot_w += u3a_mark_noun(u3R->ski.flu);
|
||||
tot_w += u3a_mark_noun(u3R->ski.sea);
|
||||
tot_w += u3a_mark_noun(u3R->ski.gul);
|
||||
tot_w += u3a_mark_noun(u3R->bug.tax);
|
||||
tot_w += u3a_mark_noun(u3R->bug.mer);
|
||||
tot_w += u3a_mark_noun(u3R->pro.don);
|
||||
@ -971,6 +972,7 @@ u3m_soft_nock(u3_noun bus, u3_noun fol)
|
||||
u3_noun
|
||||
u3m_soft_run(u3_noun fly,
|
||||
u3_noun sea,
|
||||
u3_noun gul,
|
||||
u3_funq fun_f,
|
||||
u3_noun aga,
|
||||
u3_noun agb)
|
||||
@ -986,6 +988,7 @@ u3m_soft_run(u3_noun fly,
|
||||
{
|
||||
u3R->ski.flu = u3nc(fly, u3to(u3_road, u3R->par_p)->ski.flu);
|
||||
u3R->ski.sea = u3nc(sea, u3to(u3_road, u3R->par_p)->ski.sea);
|
||||
u3R->ski.gul = u3nc(gul, u3to(u3_road, u3R->par_p)->ski.gul);
|
||||
u3R->pro.don = u3to(u3_road, u3R->par_p)->pro.don;
|
||||
u3R->bug.tax = 0;
|
||||
}
|
||||
@ -1049,6 +1052,7 @@ u3m_soft_run(u3_noun fly,
|
||||
{
|
||||
u3z(fly);
|
||||
u3z(sea);
|
||||
u3z(gul);
|
||||
u3z(aga);
|
||||
u3z(agb);
|
||||
}
|
||||
@ -1063,13 +1067,15 @@ u3m_soft_run(u3_noun fly,
|
||||
u3_noun
|
||||
u3m_soft_esc(u3_noun ref, u3_noun sam)
|
||||
{
|
||||
u3_noun why, fly, sea, pro;
|
||||
u3_noun why, fly, sea, gul, pro;
|
||||
|
||||
/* Assert preconditions.
|
||||
*/
|
||||
{
|
||||
c3_assert(0 != u3R->ski.flu);
|
||||
c3_assert(0 != u3R->ski.sea);
|
||||
c3_assert(0 != u3R->ski.gul);
|
||||
gul = u3h(u3R->ski.gul);
|
||||
sea = u3h(u3R->ski.sea);
|
||||
fly = u3h(u3R->ski.flu);
|
||||
}
|
||||
@ -1083,6 +1089,7 @@ u3m_soft_esc(u3_noun ref, u3_noun sam)
|
||||
{
|
||||
u3R->ski.flu = u3t(u3to(u3_road, u3R->par_p)->ski.flu);
|
||||
u3R->ski.sea = u3t(u3to(u3_road, u3R->par_p)->ski.sea);
|
||||
u3R->ski.gul = u3t(u3to(u3_road, u3R->par_p)->ski.gul);
|
||||
u3R->pro.don = u3to(u3_road, u3R->par_p)->pro.don;
|
||||
u3R->bug.tax = 0;
|
||||
}
|
||||
@ -1090,10 +1097,24 @@ u3m_soft_esc(u3_noun ref, u3_noun sam)
|
||||
/* Trap for exceptions.
|
||||
*/
|
||||
if ( 0 == (why = (u3_noun)_setjmp(u3R->esc.buf)) ) {
|
||||
if ( 0 == sea ) {
|
||||
if ( 0 != fly ) {
|
||||
// fprintf(stderr, "fly escape\r\n");
|
||||
pro = u3n_slam_on(fly, sam);
|
||||
} else {
|
||||
if ( u3_nul != pro ) {
|
||||
pro = u3nc(u3_nul, pro);
|
||||
}
|
||||
} else if ( 0 != sea ) {
|
||||
// fprintf(stderr, "sea escape\r\n");
|
||||
pro = u3n_slam_on(sea, u3nc(ref, sam));
|
||||
if ( u3_nul != pro ) {
|
||||
pro = u3nc(u3_nul, pro);
|
||||
}
|
||||
} else if ( 0 != gul ) {
|
||||
// fprintf(stderr, "gul escape\r\n");
|
||||
pro = u3n_slam_on(gul, u3nc(ref, sam));
|
||||
}
|
||||
else {
|
||||
return u3m_bail(c3__oops);
|
||||
}
|
||||
|
||||
/* Fall back to the old road, leaving temporary memory intact.
|
||||
@ -1109,7 +1130,8 @@ u3m_soft_esc(u3_noun ref, u3_noun sam)
|
||||
u3m_bail(u3nc(4, u3m_love(why)));
|
||||
}
|
||||
|
||||
/* Release the sample.
|
||||
/* Release the sample. Note that we used it above, but in a junior
|
||||
** road, so its refcount is intact.
|
||||
*/
|
||||
u3z(ref);
|
||||
u3z(sam);
|
||||
|
55
noun/nock.c
55
noun/nock.c
@ -356,41 +356,24 @@ _n_nock_on(u3_noun bus, u3_noun fol)
|
||||
if ( !_(u3du(val)) ) {
|
||||
u3m_bail(u3nt(1, gof, 0));
|
||||
}
|
||||
else {
|
||||
u3_noun pro;
|
||||
|
||||
u3z(gof);
|
||||
u3z(fol);
|
||||
pro = u3k(u3t(val));
|
||||
u3z(val);
|
||||
|
||||
return pro;
|
||||
}
|
||||
}
|
||||
|
||||
case 12: {
|
||||
u3_noun gof = _n_nock_on(bus, u3k(u3t(gal)));
|
||||
u3_noun val;
|
||||
|
||||
u3t_off(noc_o);
|
||||
val = u3m_soft_esc(0, u3k(gof));
|
||||
u3t_on(noc_o);
|
||||
|
||||
if ( !_(u3du(val)) ) {
|
||||
u3m_bail(u3nt(1, gof, 0));
|
||||
if ( !_(u3du(u3t(val))) ) {
|
||||
//
|
||||
// replace with proper error stack push
|
||||
//
|
||||
u3m_p("lost", gof);
|
||||
return u3m_bail(c3__exit);
|
||||
}
|
||||
else {
|
||||
u3_noun pro;
|
||||
|
||||
u3z(gof);
|
||||
u3z(fol);
|
||||
pro = u3k(u3t(val));
|
||||
pro = u3k(u3t(u3t(val)));
|
||||
u3z(val);
|
||||
|
||||
return pro;
|
||||
}
|
||||
}
|
||||
|
||||
c3_assert(!"not reached");
|
||||
}
|
||||
}
|
||||
@ -444,7 +427,15 @@ u3n_slam_on(u3_noun gat, u3_noun sam)
|
||||
u3_noun
|
||||
u3n_nock_it(u3_noun sea, u3_noun bus, u3_noun fol)
|
||||
{
|
||||
return u3m_soft_run(0, sea, u3n_nock_on, bus, fol);
|
||||
return u3m_soft_run(0, sea, 0, u3n_nock_on, bus, fol);
|
||||
}
|
||||
|
||||
/* u3n_nock_et(): produce .*(bus fol), as ++toon, in namespace.
|
||||
*/
|
||||
u3_noun
|
||||
u3n_nock_et(u3_noun gul, u3_noun bus, u3_noun fol)
|
||||
{
|
||||
return u3m_soft_run(0, 0, gul, u3n_nock_on, bus, fol);
|
||||
}
|
||||
|
||||
/* u3n_nock_in(): produce .*(bus fol), as ++toon, in namespace.
|
||||
@ -452,7 +443,7 @@ u3n_nock_it(u3_noun sea, u3_noun bus, u3_noun fol)
|
||||
u3_noun
|
||||
u3n_nock_in(u3_noun fly, u3_noun bus, u3_noun fol)
|
||||
{
|
||||
return u3m_soft_run(fly, 0, u3n_nock_on, bus, fol);
|
||||
return u3m_soft_run(fly, 0, 0, u3n_nock_on, bus, fol);
|
||||
}
|
||||
|
||||
/* u3n_slam_it(): produce (gat sam), as ++toon, in namespace.
|
||||
@ -460,7 +451,15 @@ u3n_nock_in(u3_noun fly, u3_noun bus, u3_noun fol)
|
||||
u3_noun
|
||||
u3n_slam_it(u3_noun sea, u3_noun gat, u3_noun sam)
|
||||
{
|
||||
return u3m_soft_run(0, sea, u3n_slam_on, gat, sam);
|
||||
return u3m_soft_run(0, sea, 0, u3n_slam_on, gat, sam);
|
||||
}
|
||||
|
||||
/* u3n_slam_et(): produce (gat sam), as ++toon, in namespace.
|
||||
*/
|
||||
u3_noun
|
||||
u3n_slam_et(u3_noun gul, u3_noun gat, u3_noun sam)
|
||||
{
|
||||
return u3m_soft_run(0, 0, gul, u3n_slam_on, gat, sam);
|
||||
}
|
||||
|
||||
/* u3n_slam_in(): produce (gat sam), as ++toon, in namespace.
|
||||
@ -468,7 +467,7 @@ u3n_slam_it(u3_noun sea, u3_noun gat, u3_noun sam)
|
||||
u3_noun
|
||||
u3n_slam_in(u3_noun fly, u3_noun gat, u3_noun sam)
|
||||
{
|
||||
return u3m_soft_run(fly, 0, u3n_slam_on, gat, sam);
|
||||
return u3m_soft_run(fly, 0, 0, u3n_slam_on, gat, sam);
|
||||
}
|
||||
|
||||
/* u3n_nock_an(): as slam_in(), but with empty fly.
|
||||
|
Loading…
Reference in New Issue
Block a user