Fix ++peek:ut jet semi-discrepancy

This commit is contained in:
Dan Haffey 2016-08-01 01:55:42 -07:00
parent 74be202fd6
commit 2311b3ee82
7 changed files with 44 additions and 129 deletions

View File

@ -297,8 +297,8 @@ J_F_OFILES_UT=\
jets/f/ut_mint.o \
jets/f/ut_mull.o \
jets/f/ut_nest.o \
jets/f/ut_park.o \
jets/f/ut_peek.o \
jets/f/ut_perk.o \
jets/f/ut_play.o \
jets/f/ut_repo.o \
jets/f/ut_rest.o \

View File

@ -219,8 +219,8 @@
u3_noun u3qfu_nest(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_nost(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_orth(u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_park(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_peek(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_perk(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_play(u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_repo(u3_noun, u3_noun);
u3_noun u3qfu_rest(u3_noun, u3_noun, u3_noun);

View File

@ -232,8 +232,8 @@
u3_noun u3wfu_mint(u3_noun);
u3_noun u3wfu_mull(u3_noun);
u3_noun u3wfu_nest(u3_noun);
u3_noun u3wfu_park(u3_noun);
u3_noun u3wfu_peek(u3_noun);
u3_noun u3wfu_perk(u3_noun);
u3_noun u3wfu_play(u3_noun);
u3_noun u3wfu_repo(u3_noun);
u3_noun u3wfu_rest(u3_noun);

View File

@ -58,24 +58,6 @@
0));
}
static u3_noun
u3qfu_perk(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun met)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "perk");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
u3k(way),
u3x_sam_3,
u3k(met),
0));
}
static u3_noun
_find_buck_here(u3_noun van,
u3_noun sut,

View File

@ -1,90 +0,0 @@
/* j/6/ut_park.c
**
*/
#include "all.h"
/* logic
*/
u3_noun
_cqfu_park(u3_noun van,
u3_noun sut,
u3_noun way,
u3_atom axe)
{
if ( c3n == u3du(sut) || c3__core != u3h(sut) ) {
return u3m_bail(c3__fail);
}
// else if ( c3n == u3j_hook(u3k(van), "vet") ) {
else if ( c3n == u3r_at(u3qfu_van_vet, van) ) {
return c3y;
}
else {
u3_noun p_sut, q_sut, pq_sut;
u3x_cell(u3t(sut), &p_sut, &q_sut);
u3x_cell(q_sut, &pq_sut, 0);
if ( c3__both == way ) {
if ( c3__gold == pq_sut ) {
return c3y;
} else return c3n;
}
if ( c3__read == way ) {
switch ( pq_sut ) {
default: return u3m_bail(c3__fail);
case c3__gold: return c3y;
case c3__lead: return c3n;
case c3__iron: return c3n;
case c3__zinc: return
c3a(!(u3r_sing(1, axe)),
u3r_sing(2, u3qc_cap(axe)));
}
}
else if ( c3__rite == way ) {
switch ( pq_sut ) {
default: return u3m_bail(c3__fail);
case c3__gold: return c3y;
case c3__lead: return c3n;
case c3__iron: return
c3a(!(u3r_sing(1, axe)),
u3r_sing(2, u3qc_cap(axe)));
case c3__zinc: return c3n;
}
}
else if ( c3__free == way ) { return c3y; }
else return u3m_bail(c3__fail);
}
}
/* boilerplate
*/
u3_noun
u3wfu_park(u3_noun cor)
{
u3_noun sut, way, axe, van;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &way,
u3x_sam_3, &axe,
u3x_con, &van,
0)) ||
(c3n == u3ud(axe)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_park(van, sut, way, axe);
}
}
u3_noun
u3qfu_park(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun axe)
{
return _cqfu_park(van, sut, way, axe);
}

View File

@ -17,7 +17,7 @@
{
if ( u3_nul == p_sut ) {
return u3_nul;
}
}
else {
return u3nc(_peek_in(van, u3h(p_sut), way, axe, gil),
_peek_fork(van, u3t(p_sut), way, axe, gil));
@ -79,28 +79,51 @@
{
return u3m_bail(c3__fail);
} else {
u3_atom tip = u3qc_cap(axe);
u3_atom tap = u3qc_mas(axe);
u3_atom now = u3qc_cap(axe);
u3_atom lat = u3qc_mas(axe);
if ( 3 == tip ) {
if ( c3n == u3qfu_park(van, sut, way, tap) )
{
// u3_noun dun = u3qfu_dunq(van, "type", sut);
u3_noun waz = u3qfu_shep
(van, "axis", 'd', u3k(axe));
if ( 3 == now ) {
u3_noun pec = u3qfu_perk(van, sut, way, pq_sut);
u3_noun sam = u3h(pec);
u3_noun con = u3t(pec);
// u3t_push(u3nc(c3__mean, dun));
u3t_push(u3nc(c3__mean, waz));
return u3m_error("peek-park");
if ( c3y == c3a(sam, con) ) {
pro = _cqfu_peek(van, p_sut, way, lat);
}
else pro = _cqfu_peek(van, p_sut, way, tap);
else {
u3_noun typ;
{
u3_noun hed, tal;
if ( c3n == sam ) {
hed = c3__noun;
} else {
hed = _cqfu_peek(van, p_sut, way, 2);
}
if ( c3n == con ) {
tal = c3__noun;
} else {
tal = _cqfu_peek(van, p_sut, way, 3);
}
typ = u3qf_cell(hed, tal);
u3z(hed);
u3z(tal);
}
pro = _cqfu_peek(van, typ, way, lat);
u3z(typ);
}
u3z(pec);
}
else {
pro = c3__noun;
}
u3z(tap);
u3z(tip);
u3z(lat);
u3z(now);
return pro;
}

View File

@ -353,8 +353,8 @@ static u3j_harm _mood__hoon__ut_fuse_a[] = {{".2", u3wfu_fuse}, {}};
static u3j_harm _mood__hoon__ut_mint_a[] = {{".2", u3wfu_mint}, {}};
static u3j_harm _mood__hoon__ut_mull_a[] = {{".2", u3wfu_mull}, {}};
static u3j_harm _mood__hoon__ut_nest_a[] = {{".2", u3wfu_nest}, {}};
static u3j_harm _mood__hoon__ut_park_a[] = {{".2", u3wfu_park}, {}};
static u3j_harm _mood__hoon__ut_peek_a[] = {{".2", u3wfu_peek}, {}};
static u3j_harm _mood__hoon__ut_perk_a[] = {{".2", u3wfu_perk}, {}};
static u3j_harm _mood__hoon__ut_play_a[] = {{".2", u3wfu_play}, {}};
static u3j_harm _mood__hoon__ut_rest_a[] = {{".2", u3wfu_rest}, {}};
static u3j_harm _mood__hoon__ut_toss_a[] = {{".2", u3wfu_toss}, {}};
@ -372,8 +372,8 @@ static u3j_core _mood__hoon__ut_d[] =
{ "mint", _mood__hoon__ut_mint_a },
{ "mull", _mood__hoon__ut_mull_a },
{ "nest", _mood__hoon__ut_nest_a },
{ "park", _mood__hoon__ut_park_a },
{ "peek", _mood__hoon__ut_peek_a },
{ "perk", _mood__hoon__ut_perk_a },
{ "play", _mood__hoon__ut_play_a },
{ "rest", _mood__hoon__ut_rest_a },
{ "toss", _mood__hoon__ut_toss_a },