From 2311b3ee825db632172e6ede3e7d7b9ef6f037cc Mon Sep 17 00:00:00 2001 From: Dan Haffey Date: Mon, 1 Aug 2016 01:55:42 -0700 Subject: [PATCH] Fix ++peek:ut jet semi-discrepancy --- Makefile | 2 +- include/jets/q.h | 2 +- include/jets/w.h | 2 +- jets/f/ut_find.c | 18 ---------- jets/f/ut_park.c | 90 ------------------------------------------------ jets/f/ut_peek.c | 55 ++++++++++++++++++++--------- jets/tree.c | 4 +-- 7 files changed, 44 insertions(+), 129 deletions(-) delete mode 100644 jets/f/ut_park.c diff --git a/Makefile b/Makefile index fff488b126..6fe628fe4f 100644 --- a/Makefile +++ b/Makefile @@ -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 \ diff --git a/include/jets/q.h b/include/jets/q.h index d508712eac..65c7d260fe 100644 --- a/include/jets/q.h +++ b/include/jets/q.h @@ -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); diff --git a/include/jets/w.h b/include/jets/w.h index ebe70213f6..7457ef84f3 100644 --- a/include/jets/w.h +++ b/include/jets/w.h @@ -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); diff --git a/jets/f/ut_find.c b/jets/f/ut_find.c index 1e498a8253..130e0c5fe3 100644 --- a/jets/f/ut_find.c +++ b/jets/f/ut_find.c @@ -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, diff --git a/jets/f/ut_park.c b/jets/f/ut_park.c deleted file mode 100644 index 0bbf878377..0000000000 --- a/jets/f/ut_park.c +++ /dev/null @@ -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); - } - diff --git a/jets/f/ut_peek.c b/jets/f/ut_peek.c index 41c0c5b8d4..f52a5d9d4c 100644 --- a/jets/f/ut_peek.c +++ b/jets/f/ut_peek.c @@ -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; } diff --git a/jets/tree.c b/jets/tree.c index 6c9c3c72a1..2c23ccd8c1 100644 --- a/jets/tree.c +++ b/jets/tree.c @@ -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 },