Rationalize jets.

This commit is contained in:
C. Guy Yarvin 2015-12-26 23:39:38 -05:00
parent 54774d3b3f
commit 8421df97e8
11 changed files with 92 additions and 1089 deletions

View File

@ -291,19 +291,13 @@ J_F_OFILES=\
J_F_OFILES_UT=\
jets/f/ut.o \
jets/f/ut_burn.o \
jets/f/ut_busk.o \
jets/f/ut_bust.o \
jets/f/ut_conk.o \
jets/f/ut_crop.o \
jets/f/ut_cull.o \
jets/f/ut_find.o \
jets/f/ut_fink.o \
jets/f/ut_fire.o \
jets/f/ut_firm.o \
jets/f/ut_fish.o \
jets/f/ut_fuse.o \
jets/f/ut_gain.o \
jets/f/ut_heal.o \
jets/f/ut_lose.o \
jets/f/ut_mint.o \
jets/f/ut_mull.o \
@ -314,7 +308,6 @@ J_F_OFILES_UT=\
jets/f/ut_repo.o \
jets/f/ut_rest.o \
jets/f/ut_seek.o \
jets/f/ut_swab.o \
jets/f/ut_tack.o \
jets/f/ut_toss.o \
jets/f/ut_wrap.o

View File

@ -1,51 +0,0 @@
/* j/6/ut_busk.c
**
*/
#include "all.h"
/* logic
*/
u3_noun
_cqfu_busk(u3_noun van,
u3_noun sut,
u3_noun cog,
u3_noun hyp)
{
u3_noun sep = u3qfu_seep(van, sut, c3__both, hyp);
u3_noun bid = u3nt(u3k(cog), u3k(hyp), sep);
u3_noun ret = u3qf_bull(bid, sut);
u3z(bid);
return ret;
}
/* boilerplate
*/
u3_noun
u3wfu_busk(u3_noun cor)
{
u3_noun sut, cog, hyp, van;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &cog,
u3x_sam_3, &hyp,
u3x_con, &van,
0)) ||
(c3n == u3ud(cog)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_busk(van, sut, cog, hyp);
}
}
u3_noun
u3qfu_busk(u3_noun van,
u3_noun sut,
u3_noun cog,
u3_noun hyp)
{
return _cqfu_busk(van, sut, cog, hyp);
}

View File

@ -1,203 +0,0 @@
/* j/6/cull.c
**
*/
#include "all.h"
/* logic
*/
u3_noun
_cqfu_cull(u3_noun, u3_noun, u3_noun, u3_atom, u3_noun);
static u3_noun
_cull_in(u3_noun van,
u3_noun sut,
u3_noun pol,
u3_atom axe,
u3_noun ref,
u3_noun now,
u3_noun lat,
u3_noun vil)
{
u3_noun ret, p_sut, q_sut;
if ( c3n == u3du(sut) ) switch ( sut ) {
default: return u3m_bail(c3__fail);
case c3__noun: {
u3_noun pyr = u3qfu_repo(van, sut);
u3_noun yot = _cqfu_cull(van, pyr, pol, axe, ref);
if ( c3y == u3r_sing(pyr, yot) ) {
ret = u3k(sut);
} else {
ret = u3k(yot);
}
u3z(pyr);
u3z(yot);
break;
}
case c3__void: {
ret = c3__void;
}
}
else switch ( u3h(sut) ) {
default: return u3m_bail(c3__fail);
case c3__atom: {
ret = c3__void;
break;
}
case c3__bull: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3_noun hic = _cqfu_cull(van, q_sut, pol, axe, ref);
if ( c3y == u3r_sing(hic, q_sut) ) {
ret = u3k(sut);
} else {
ret = u3qf_bull(p_sut, hic);
}
u3z(hic);
break;
}
case c3__cell: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3_noun hub;
if ( 2 == now ) {
hub = _cqfu_cull(van, p_sut, pol, lat, ref);
ret = u3qf_cell(hub, q_sut);
} else {
hub = _cqfu_cull(van, q_sut, pol, lat, ref);
ret = u3qf_cell(p_sut, hub);
}
u3z(hub);
break;
}
case c3__core: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
if ( 3 != now ) {
ret = u3k(sut);
} else {
u3_noun hub = _cqfu_cull(van, p_sut, pol, lat, ref);
ret = u3qf_core(hub, q_sut);
u3z(hub);
}
break;
}
case c3__face: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3_noun hic = _cqfu_cull(van, q_sut, pol, axe, ref);
if ( c3y == u3r_sing(hic, q_sut) ) {
ret = u3k(sut);
} else {
ret = u3qf_face(p_sut, hic);
}
u3z(hic);
break;
}
case c3__fork: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
if ( c3y == u3qdi_has(vil, sut) ) {
return c3__void;
} else {
u3_noun zoc = u3qdi_put(vil, sut);
u3_noun sin = _cull_in(van, p_sut, pol, axe, ref, now, lat, zoc);
u3_noun dex = _cull_in(van, q_sut, pol, axe, ref, now, lat, zoc);
ret = u3qf_fork(sin, dex);
u3z(sin);
u3z(dex);
u3z(zoc);
return ret;
}
}
case c3__cube:
case c3__hold:
{
u3_noun pyr = u3qfu_repo(van, sut);
u3_noun yot = _cull_in(van, pyr, pol, axe, ref, now, lat, vil);
if ( c3y == u3r_sing(pyr, yot) ) {
if ( c3__void == pyr ) {
ret = c3__void;
}
else ret = u3k(sut);
} else {
ret = u3k(yot);
}
u3z(pyr);
u3z(yot);
break;
}
}
u3z(lat);
return ret;
}
u3_noun
_cqfu_cull(u3_noun van,
u3_noun sut,
u3_noun pol,
u3_atom axe,
u3_noun ref)
{
if ( 1 == axe ) {
if ( c3y == pol ) {
return u3qfu_fuse(van, sut, ref);
} else {
return u3qfu_crop(van, sut, ref);
}
} else {
u3_atom now = u3qc_cap(axe);
u3_atom lat = u3qc_mas(axe);
return _cull_in(van, sut, pol, axe, ref, now, lat, u3_nul);
}
}
/* boilerplate
*/
u3_noun
u3wfu_cull(u3_noun cor)
{
u3_noun sut, axe, pol, ref, van;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &pol,
u3x_sam_6, &axe,
u3x_sam_7, &ref,
u3x_con, &van, 0)) ||
(c3n == u3ud(axe)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_cull(van, sut, pol, axe, ref);
}
}
u3_noun
u3qfu_cull(u3_noun van,
u3_noun sut,
u3_noun pol,
u3_noun axe,
u3_noun ref)
{
c3_m fun_m = c3__cull + !!u3r_at(u3qfu_van_vet, van);
u3_noun pro = u3z_find_4(fun_m, sut, pol, axe, ref);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqfu_cull(van, sut, pol, axe, ref);
return u3z_save_4(fun_m, sut, pol, axe, ref, pro);
}
}

View File

@ -1,370 +0,0 @@
/* j/6/find.c
**
*/
#include "all.h"
static u3_noun
_find_in(u3_noun van,
u3_noun sut,
u3_noun dep,
u3_noun way,
u3_noun cug,
u3_noun gil)
{
u3_noun p_sut, q_sut;
c3_assert(0);
if ( c3y == u3ud(sut) ) {
return u3nc(u3k(dep), u3_nul);
}
else switch ( u3h(sut) ) {
default: return u3nc(u3k(dep), u3_nul);
case c3__bull: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);
}
else {
if ( (c3n == u3du(cug)) ||
(c3n == u3r_sing(u3t(cug), u3h(p_sut))) ) {
return _find_in(van, q_sut, dep, way, cug, gil);
}
else {
if ( 0 == dep ) {
return u3nc(0,
u3nt(u3_nul,
1,
u3nt(2, u3k(p_sut),
u3k(q_sut))));
} else {
return _find_in(van, q_sut, u3qa_dec(dep), way, cug, gil);
}
}
}
}
case c3__cell: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);
} else {
u3_noun taf = _find_in(van, p_sut, dep, way, cug, gil);
u3_noun p_taf = u3h(taf);
u3_noun q_taf = u3t(taf);
u3_noun ret;
if ( u3_nul == q_taf ) {
u3_noun bov = _find_in(van, q_sut, p_taf, way, cug, gil);
u3_noun p_bov = u3h(bov);
u3_noun q_bov = u3t(bov);
if ( u3_nul == q_bov ) {
ret = u3k(bov);
}
else {
u3_noun puq_bov, quq_bov;
u3r_mean(q_bov, 6, &puq_bov, 7, &quq_bov, 0);
ret = u3nq(u3k(p_bov),
u3_nul,
u3qc_peg(3, puq_bov),
u3k(quq_bov));
}
u3z(bov);
}
else {
u3_noun puq_taf, quq_taf;
u3r_mean(q_taf, 6, &puq_taf, 7, &quq_taf, 0);
ret = u3nq(u3k(p_taf),
u3_nul,
u3qc_peg(2, puq_taf),
u3k(quq_taf));
}
u3z(taf);
return ret;
}
}
case c3__core: {
u3_noun pq_sut, qq_sut, rq_sut;
u3_noun prq_sut, qrq_sut;
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ||
(c3n == u3r_trel(q_sut, &pq_sut, &qq_sut, &rq_sut)) ||
(c3n == u3r_cell(rq_sut, &prq_sut, &qrq_sut)) )
{
return u3m_bail(c3__fail);
} else {
u3_noun zem = (c3n == u3du(cug))
? u3_nul
: u3qf_look(u3t(cug), qrq_sut);
if ( (u3_nul != zem) && (0 != dep) ) {
u3_noun ped;
ped = u3qa_dec(dep);
u3z(dep); dep = ped;
u3z(zem);
zem = u3_nul;
}
if ( u3_nul == zem ) {
u3_noun taf = _find_in(van, p_sut, dep, way, cug, gil);
u3_noun p_taf = u3h(taf);
u3_noun q_taf = u3t(taf);
if ( u3_nul == q_taf ) {
u3z(taf);
return u3nc(u3k(dep), u3_nul);
}
else {
u3_noun puq_taf, quq_taf;
u3_noun pro;
u3r_mean(q_taf, 6, &puq_taf, 7, &quq_taf, 0);
if ( c3n == u3qfu_park(van, sut, way, puq_taf) )
{
u3_noun weh = u3qfu_shep(van, "way", 'a', u3k(way));
u3_noun waz = u3qfu_shep(van, "axis", 'd', u3k(puq_taf));
u3t_push(u3nc(c3__mean, weh));
u3t_push(u3nc(c3__mean, waz));
return u3m_error("find-park");
}
else {
pro = u3nq(u3k(p_taf),
u3_nul,
u3qc_peg(3, puq_taf),
u3k(quq_taf));
u3z(taf);
return pro;
}
}
}
else {
u3_noun u_zem = u3t(zem);
u3_noun pu_zem = u3h(u_zem);
u3_noun qu_zem = u3t(u_zem);
u3_noun mut;
u3_noun pro;
mut = u3nt(c3__core,
u3k(p_sut),
u3nt(c3__gold,
u3k(qq_sut),
u3k(rq_sut)));
pro = u3nc(0,
u3nq(u3_nul,
1,
1,
u3nc(u3qc_peg(2, pu_zem),
u3nc(u3nc(mut, u3k(qu_zem)),
u3_nul))));
u3z(zem);
return pro;
}
}
}
case c3__face: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);
} else {
if ( (c3n == u3du(cug)) || (c3n == u3r_sing(u3t(cug), p_sut)) ) {
return u3nc(u3k(dep), u3_nul);
} else {
if ( 0 == dep ) {
return u3nc(0, u3nq(u3_nul, 1, 0, u3k(q_sut)));
} else {
return u3nc
(u3qa_dec(dep), u3_nul);
}
}
}
}
case c3__cube: {
u3_noun fop = u3qfu_repo(van, sut);
u3_noun pro = _find_in(van, fop, dep, way, cug, gil);
u3z(fop);
return pro;
}
case c3__fork: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);
}
if ( (c3y == u3qdi_has(gil, q_sut)) ) {
return _find_in(van, p_sut, dep, way, cug, gil);
}
else if ( (c3y == u3qdi_has(gil, p_sut)) ) {
return _find_in(van, q_sut, dep, way, cug, gil);
}
else {
u3_noun hax = _find_in(van, p_sut, dep, way, cug, gil);
u3_noun yor = _find_in(van, q_sut, dep, way, cug, gil);
u3_noun p_hax = u3h(hax);
u3_noun p_yor = u3h(yor);
u3_noun q_hax = u3t(hax);
u3_noun q_yor = u3t(yor);
u3_noun puq_hax, quq_hax;
u3_noun puq_yor, quq_yor;
u3_noun ret = 0;
if ( u3_nul != q_hax ) {
u3r_mean(q_hax, 6, &puq_hax, 7, &quq_hax, 0);
}
if ( u3_nul != q_yor ) {
u3r_mean(q_yor, 6, &puq_yor, 7, &quq_yor, 0);
}
if ( c3y == u3r_sing(hax, yor) ) {
ret = u3k(hax);
}
else {
if ( (c3n == u3r_sing(p_hax, p_yor)) ||
((u3_nul == q_hax) || (u3_nul == q_yor)) ||
(c3n == u3r_sing(puq_hax, puq_yor)) ||
(c3n == u3r_sing(u3h(quq_hax), u3h(quq_yor))) )
{
return u3m_error("find-fork");
}
switch ( u3h(quq_hax) ) {
case 0: {
u3_noun pquq_hax = u3t(quq_hax);
u3_noun pquq_yor = u3t(quq_yor);
ret = u3nc(u3k(p_hax),
u3nq(u3_nul,
u3k(puq_hax),
0,
u3qf_fork(pquq_hax, pquq_yor)));
break;
}
case 1: {
u3_noun pquq_hax, qquq_hax, pquq_yor, qquq_yor;
u3x_cell(u3t(quq_hax), &pquq_hax, &qquq_hax);
u3x_cell(u3t(quq_yor), &pquq_yor, &qquq_yor);
if ( c3n == u3r_sing(pquq_hax, pquq_yor) ) {
return u3m_error("find-fork");
} else {
ret = u3nc(u3k(p_hax),
u3nq(u3_nul,
u3k(puq_hax),
1,
u3nc(u3k(pquq_hax),
u3qb_weld(qquq_hax, qquq_yor))));
break;
}
}
case 2: {
u3_noun pquq_hax, qquq_hax, pquq_yor, qquq_yor;
u3_noun ppquq_hax, qpquq_hax, rpquq_hax, spquq_hax;
u3_noun ppquq_yor, qpquq_yor, rpquq_yor, spquq_yor;
u3x_cell(u3t(quq_hax), &pquq_hax, &qquq_hax);
u3x_cell(u3t(quq_yor), &pquq_yor, &qquq_yor);
u3x_qual(pquq_hax,
&ppquq_hax, &qpquq_hax, &rpquq_hax, &spquq_hax);
u3x_qual(pquq_yor,
&ppquq_yor, &qpquq_yor, &rpquq_yor, &spquq_yor);
if ( (c3n == u3r_sing(ppquq_hax, ppquq_yor)) ||
(c3n == u3r_sing(qpquq_hax, qpquq_yor)) ||
(c3n == u3r_sing(rpquq_hax, rpquq_yor)) )
{
return u3m_error("find-fork");
}
else {
ret = u3nc(u3k(p_hax),
u3nq(u3_nul,
u3k(puq_hax),
2,
u3nc(u3nq(u3k(ppquq_hax),
u3k(qpquq_hax),
u3k(rpquq_hax),
u3qf_fork(spquq_hax,
spquq_yor)),
u3qf_fork(qquq_hax, qquq_yor))));
break;
}
}
}
}
u3z(yor);
u3z(hax);
return ret;
}
}
case c3__hold: p_sut = u3t(sut);
{
if ( (c3y == u3qdi_has(gil, sut)) ) {
return u3nc(u3k(dep), u3_nul);
}
else {
u3_noun zoc = u3qdi_put(gil, sut);
u3_noun fop = u3qfu_repo(van, sut);
u3_noun pro = _find_in(van, fop, dep, way, cug, zoc);
u3z(fop);
u3z(zoc);
return pro;
}
}
}
}
u3_noun
_cqfu_find(u3_noun van,
u3_noun sut,
u3_noun dep,
u3_noun way,
u3_noun cug)
{
return _find_in(van, sut, dep, way, cug, u3_nul);
}
/* boilerplate
*/
u3_noun
u3wfu_find(u3_noun cor)
{
u3_noun sut, dep, way, cug, van;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &dep,
u3x_sam_6, &way,
u3x_sam_7, &cug,
u3x_con, &van,
0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_find(van, sut, dep, way, cug);
}
}
u3_noun
u3qfu_find(u3_noun van,
u3_noun sut,
u3_noun dep,
u3_noun way,
u3_noun cug)
{
c3_m fun_m = c3__find + !!u3r_at(u3qfu_van_vet, van);
u3_noun pro = u3z_find_4(fun_m, sut, dep, way, cug);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqfu_find(van, sut, dep, way, cug);
return u3z_save_4(fun_m, sut, dep, way, cug, pro);
}
}

View File

@ -1,106 +0,0 @@
/* j/6/fink.c
**
*/
#include "all.h"
/* logic
*/
static u3_noun
_fink_flee(u3_noun poy)
{
u3_noun p_poy = u3h(poy);
u3_noun q_poy = u3t(poy);
switch ( u3h(q_poy) ) {
default: return u3m_bail(c3__fail);
case 0: {
u3_noun pq_poy = u3t(q_poy);
return u3nt(u3k(p_poy), c3y, u3k(pq_poy));
}
case 1: {
u3_noun pq_poy = u3h(u3t(q_poy));
u3_noun qq_poy = u3t(u3t(q_poy));
return u3nq(u3k(p_poy), c3n, u3k(pq_poy), u3k(qq_poy));
}
case 2: {
u3_noun pq_poy = u3h(u3t(q_poy));
// u3_noun qq_poy = u3t(u3t(q_poy));
// u3_noun ppq_poy = u3h(pq_poy);
// u3_noun qpq_poy = u3h(u3t(pq_poy));
u3_noun rpq_poy = u3h(u3t(u3t(pq_poy)));
u3_noun spq_poy = u3t(u3t(u3t(pq_poy)));
return u3nt(u3qc_peg(p_poy, rpq_poy), c3y, u3k(spq_poy));
}
}
}
u3_noun
_cqfu_fink(u3_noun van,
u3_noun sut,
u3_noun dep,
u3_noun way,
u3_noun cug)
{
// u3_noun dun = u3qfu_dunq(van, "type", sut);
u3_noun nuc = (u3_blip == cug)
? u3qfu_shew(van,
u3nc(u3nc('c',
u3i_string("find-limb")),
'$'))
: u3qfu_shep(van, "find-limb", 'a', u3k(cug));
u3_noun pro;
// u3t_push(u3nc(c3__mean, dun));
u3t_push(u3nc(c3__mean, nuc));
{
u3_noun hoq = u3qfu_find(van, sut, dep, way, cug);
u3_noun fin = u3t(hoq);
if ( u3_nul == fin ) {
// u3m_p("cug", cug);
return u3m_error("find-none");
}
else {
pro = _fink_flee(u3t(fin));
u3z(hoq);
}
}
// u3t_drop();
u3t_drop();
return pro;
}
/* boilerplate
*/
u3_noun
u3wfu_fink(u3_noun cor)
{
u3_noun sut, dep, way, cug, van;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &dep,
u3x_sam_6, &way,
u3x_sam_7, &cug,
u3x_con, &van,
0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_fink(van, sut, dep, way, cug);
}
}
u3_noun
u3qfu_fink(u3_noun van,
u3_noun sut,
u3_noun dep,
u3_noun way,
u3_noun cug)
{
return _cqfu_fink(van, sut, dep, way, cug);
}

View File

@ -1,242 +0,0 @@
/* j/6/heal.c
**
*/
#include "all.h"
/* internals
*/
static u3_noun
_heal_as(u3_noun, u3_noun, u3_noun, u3_atom, u3_noun);
static u3_noun
_heal_by(u3_noun van,
u3_noun sut,
u3_noun qug,
u3_noun ref)
{
u3_noun p_sut, q_sut;
if ( c3n == u3du(sut) ) {
return u3m_error("heal-name");
}
else switch ( u3h(sut) ) {
default: return u3m_error("heal-name");
case c3__core:
{
return u3k(ref);
}
case c3__bull: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
if ( (c3y == u3du(u3t(qug))) &&
(c3y == u3r_sing(u3h(p_sut), u3t(u3t(qug))) ) ) {
return u3k(ref);
}
else {
u3_noun sub = _heal_by(van, q_sut, qug, ref);
u3_noun ret;
ret = u3qfu_busk(van,
sub,
u3h(p_sut),
u3h(u3t(p_sut)));
u3z(sub);
return ret;
}
}
case c3__face: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
if ( (c3n == u3du(u3t(qug))) ||
(c3y == u3r_sing(p_sut, u3t(u3t(qug)))) ) {
return u3qf_face(p_sut, ref);
}
else return u3m_error("heal-name");
}
case c3__hold: {
u3_noun rep = u3qfu_repo(van, sut);
u3_noun ret = _heal_by(van, rep, qug, ref);
u3z(rep);
return ret;
}
case c3__fork: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3_noun dis = _heal_by(van, p_sut, qug, ref);
u3_noun dat = _heal_by(van, q_sut, qug, ref);
u3_noun ret = u3qf_fork(dis, dat);
u3z(dis);
u3z(dat);
return ret;
}
}
}
static u3_noun
_heal_to(u3_noun van,
u3_noun sut,
u3_noun gil,
u3_noun qug,
u3_noun ref,
u3_atom now,
u3_atom lat)
{
u3_noun p_sut, q_sut;
if ( c3n == u3du(sut) ) {
goto repo;
}
else switch ( u3h(sut) ) {
default: goto repo;
case c3__atom: return c3__void;
case c3__bull: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3_noun sub = _heal_to(van, q_sut, gil, qug, ref, now, lat);
u3_noun ret;
ret = u3qfu_busk
(van, sub, u3h(p_sut), u3h(u3t(p_sut)));
u3z(sub);
return ret;
}
case c3__cell: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3_noun ter, ret;
if ( 2 == now ) {
ter = _heal_as(van, p_sut, qug, lat, ref);
ret = u3qf_cell(ter, q_sut);
} else {
ter = _heal_as(van, q_sut, qug, lat, ref);
ret = u3qf_cell(p_sut, ter);
}
u3z(ter);
return ret;
}
case c3__core: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
if ( 3 != now ) {
return u3m_error("heal-core");
} else {
u3_noun ter = _heal_as(van, p_sut, qug, lat, ref);
u3_noun ret = u3qf_core(ter, q_sut);
u3z(ter);
return ret;
}
}
case c3__face: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3_noun dun = _heal_to(van, q_sut, gil, qug, ref, now, lat);
u3_noun ret = u3qf_face(p_sut, dun);
u3z(dun);
return ret;
}
case c3__fork: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3_noun dis = _heal_to(van, p_sut, gil, qug, ref, now, lat);
u3_noun dat = _heal_to(van, q_sut, gil, qug, ref, now, lat);
u3_noun ret = u3qf_fork(dis, dat);
u3z(dis);
u3z(dat);
return ret;
}
case c3__hold: {
if ( (c3y == u3qdi_has(gil, sut)) ) {
return c3__void;
}
else {
u3_noun zoc = u3qdi_put(gil, sut);
u3_noun rep = u3qfu_repo(van, sut);
u3_noun ret = _heal_to(van, rep, zoc, qug, ref, now, lat);
u3z(rep);
u3z(zoc);
return ret;
}
}
}
repo: {
u3_noun rep = u3qfu_repo(van, sut);
u3_noun ret = _heal_to(van, rep, gil, qug, ref, now, lat);
u3z(rep);
return ret;
}
}
static u3_noun
_heal_as(u3_noun van,
u3_noun sut,
u3_noun qug,
u3_atom axe,
u3_noun ref)
{
if ( 1 == axe ) {
if ( u3_nul == qug ) {
return u3k(ref);
} else return _heal_by(van, sut, qug, ref);
}
else {
u3_atom now = u3qc_cap(axe);
u3_atom lat = u3qc_mas(axe);
u3_noun ret = _heal_to(van, sut, u3_nul, qug, ref, now, lat);
u3z(lat);
return ret;
}
}
/* functions
*/
u3_noun
_cqfu_heal(u3_noun van,
u3_noun sut,
u3_noun qug,
u3_noun axe,
u3_noun ref)
{
return _heal_as(van, sut, qug, axe, ref);
}
/* boilerplate
*/
u3_noun
u3wfu_heal(u3_noun cor)
{
u3_noun van, sut, qug, axe, ref;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &qug,
u3x_sam_6, &axe,
u3x_sam_7, &ref,
u3x_con, &van,
0)) ||
(c3n == u3ud(axe)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_heal(van, sut, qug, axe, ref);
}
}
u3_noun
u3qfu_heal(u3_noun van,
u3_noun sut,
u3_noun qug,
u3_noun axe,
u3_noun ref)
{
return _cqfu_heal(van, sut, qug, axe, ref);
}

View File

@ -695,12 +695,6 @@ int FOO;
if ( c3y == u3ud(p_gen) ) {
bez = u3k(p_gen);
} else {
#ifdef HUSH
bez = u3h(p_gen);
if(!(bez == c3__fast || bez == c3__memo)){
return hum;
}
#endif
bez = u3nc(u3k(u3h(p_gen)),
_mint_corn(van, sut, u3t(p_gen)));
}

90
jets/f/ut_perk.c Normal file
View File

@ -0,0 +1,90 @@
/* 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

@ -1,31 +0,0 @@
/* j/6/sift.c
**
*/
#include "all.h"
/* boilerplate
*/
u3_noun
u3wfu_sift(u3_noun cor)
{
u3_noun sut, ref, van;
if ( (c3n == u3r_mean(cor, u3x_sam, &ref,
u3x_con, &van,
0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return u3qfu_sift(van, sut, ref);
}
}
u3_noun
u3qfu_sift(u3_noun van,
u3_noun sut,
u3_noun ref)
{
return u3k(ref);
}

View File

@ -1,57 +0,0 @@
/* j/6/swab.c
**
*/
#include "all.h"
/* internals
*/
/* functions
*/
u3_noun
_cqfu_snub(u3_noun van,
u3_noun sut,
u3_noun har)
{
if ( c3n == u3du(har) ) {
return u3_nul;
} else {
u3_noun i_har = u3h(har);
u3_noun t_har = u3t(har);
u3_noun pi_har = u3h(i_har);
u3_noun qi_har = u3t(i_har);
u3_noun peh = u3qb_flop(pi_har);
u3_noun ret = u3nc(u3nc(peh, u3k(qi_har)),
_cqfu_snub(van, sut, t_har));
return ret;
}
}
/* boilerplate
*/
u3_noun
u3wfu_snub(u3_noun cor)
{
u3_noun van, sut, har;
if ( (c3n == u3r_mean(cor, u3x_sam, &har,
u3x_con, &van,
0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_snub(van, sut, har);
}
}
u3_noun
u3qfu_snub(u3_noun van,
u3_noun sut,
u3_noun har)
{
return _cqfu_snub(van, sut, har);
}

View File

@ -347,17 +347,13 @@ static u3j_harm _mood__hoon_fork_a[] = {{".2", u3wf_fork}, {}};
static u3j_harm _mood__hoon_hike_a[] = {{".2", u3wf_hike}, {}};
static u3j_harm _mood__hoon_look_a[] = {{".2", u3wf_look}, {}};
static u3j_harm _mood__hoon__ut_busk_a[] = {{".2", u3wfu_busk}, {}};
static u3j_harm _mood__hoon__ut_bust_a[] = {{".2", u3wfu_bust}, {}};
static u3j_harm _mood__hoon__ut_burn_a[] = {{".2", u3wfu_burn}, {}};
static u3j_harm _mood__hoon__ut_conk_a[] = {{".2", u3wfu_conk}, {}};
static u3j_harm _mood__hoon__ut_crop_a[] = {{".2", u3wfu_crop}, {}};
static u3j_harm _mood__hoon__ut_cull_a[] = {{".2", u3wfu_cull}, {}};
static u3j_harm _mood__hoon__ut_find_a[] = {{".2", u3wfu_find}, {}};
static u3j_harm _mood__hoon__ut_fire_a[] = {{".2", u3wfu_fire}, {}};
static u3j_harm _mood__hoon__ut_firm_a[] = {{".2", u3wfu_firm}, {}};
static u3j_harm _mood__hoon__ut_fish_a[] = {{".2", u3wfu_fish}, {}};
static u3j_harm _mood__hoon__ut_fuse_a[] = {{".2", u3wfu_fuse}, {}};
static u3j_harm _mood__hoon__ut_heal_a[] = {{".2", u3wfu_heal}, {}};
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}, {}};
@ -365,25 +361,18 @@ 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_play_a[] = {{".2", u3wfu_play}, {}};
static u3j_harm _mood__hoon__ut_rest_a[] = {{".2", u3wfu_rest}, {}};
static u3j_harm _mood__hoon__ut_seek_a[] = {{".2", u3wfu_seek}, {}};
static u3j_harm _mood__hoon__ut_seep_a[] = {{".2", u3wfu_seep}, {}};
static u3j_harm _mood__hoon__ut_snub_a[] = {{".2", u3wfu_snub}, {}};
static u3j_harm _mood__hoon__ut_toss_a[] = {{".2", u3wfu_toss}, {}};
static u3j_harm _mood__hoon__ut_wrap_a[] = {{".2", u3wfu_wrap}, {}};
static u3j_core _mood__hoon__ut_d[] =
{
{ "busk", _mood__hoon__ut_busk_a },
{ "bust", _mood__hoon__ut_bust_a },
{ "burn", _mood__hoon__ut_burn_a },
{ "conk", _mood__hoon__ut_conk_a },
{ "crop", _mood__hoon__ut_crop_a },
{ "cull", _mood__hoon__ut_cull_a },
{ "find", _mood__hoon__ut_find_a },
{ "fire", _mood__hoon__ut_fire_a },
{ "firm", _mood__hoon__ut_firm_a },
{ "fish", _mood__hoon__ut_fish_a },
{ "fuse", _mood__hoon__ut_fuse_a },
{ "heal", _mood__hoon__ut_heal_a },
{ "mint", _mood__hoon__ut_mint_a },
{ "mull", _mood__hoon__ut_mull_a },
{ "nest", _mood__hoon__ut_nest_a },
@ -391,9 +380,6 @@ static u3j_core _mood__hoon__ut_d[] =
{ "peek", _mood__hoon__ut_peek_a },
{ "play", _mood__hoon__ut_play_a },
{ "rest", _mood__hoon__ut_rest_a },
{ "seek", _mood__hoon__ut_seek_a },
{ "seep", _mood__hoon__ut_seep_a },
{ "snub", _mood__hoon__ut_snub_a },
{ "toss", _mood__hoon__ut_toss_a },
{ "wrap", _mood__hoon__ut_wrap_a },
{}