using u3x functions

This commit is contained in:
joshuareagan 2018-12-06 01:01:27 -06:00
parent def6538c08
commit 2769cb2ac9

View File

@ -22,44 +22,34 @@
static u3_noun
u3qfu_felt_arm(u3_noun lis)
{
if ( u3_nul == lis ) {
return u3_nul;
if ( u3_nul == lis ) {
return u3_nul;
}
else if ( c3y != u3du(lis) ) {
return u3m_bail(c3__exit);
}
else
{
u3_noun i_lis, t_lis, fot, typ;
u3_noun p_typ, q_typ, pq_typ, qq_typ, rq_typ;
u3x_cell(lis, &i_lis, &t_lis);
u3x_cell(i_lis, &typ, &fot);
if ( (c3n == u3du(typ)) ||
(c3__core != u3h(typ)) ) {
return u3m_error("felt-core");
}
else if ( c3y != u3du(lis) ) {
return u3m_bail(c3__exit);
}
else
{
u3_noun i_lis = u3h(lis);
u3_noun t_lis = u3t(lis);
if (c3y != u3du(i_lis)) { u3m_bail(c3__exit); }
u3_noun typ = u3h(i_lis);
u3_noun p_typ, q_typ, pq_typ, qq_typ, rq_typ;
if ( (c3n == u3du(typ)) ||
(c3__core != u3h(typ)) ) {
return u3m_error("felt-core");
}
else if
( (c3n == u3r_cell(u3t(typ), &p_typ, &q_typ)) ||
(c3n == u3r_trel(q_typ, &pq_typ, &qq_typ, &rq_typ)) )
{
return u3m_bail(c3__exit);
}
else
{
u3_noun dox = u3nt(c3__core, u3k(qq_typ), u3k(q_typ));
u3_noun par = u3nt(c3__hold, dox, u3nc(u3_nul, 1));
u3_noun pro = u3nc(par, u3qfu_felt_arm(t_lis));
return pro;
}
else {
u3x_cell(u3t(typ), &p_typ, &q_typ);
u3x_trel(q_typ, &pq_typ, &qq_typ, &rq_typ);
u3_noun dox = u3nt(c3__core, u3k(qq_typ), u3k(q_typ));
u3_noun par = u3nt(c3__hold, dox, u3nc(u3_nul, 1));
u3_noun pro = u3nc(par, u3qfu_felt_arm(t_lis));
return pro;
}
}
}
/* `u3qfu_felt` takes an opal, lap, and converts
@ -71,35 +61,25 @@
static u3_noun
u3qfu_felt(u3_noun lap)
{
u3_noun pro;
u3_noun pro, lim, mil;
u3x_cell(lap, &lim, &mil);
if (c3y != u3du(lap)) { u3m_bail(c3__exit); }
u3_noun lim = u3h(lap);
if ( c3y == lim ) {
u3_noun p_lap = u3t(lap);
pro = u3k(p_lap);
if ( c3y == lim ) {
pro = u3k(mil);
}
else if ( c3n == lim ) {
u3_noun p_lap, q_lap;
u3x_cell(mil, &p_lap, &q_lap);
u3_noun lis = u3qdi_tap(q_lap);
u3_noun hos = u3qfu_felt_arm(lis);
pro = u3kf_fork(hos);
u3z(lis);
}
else if ( c3n == lim ) {
u3_noun tal_lap = u3t(lap);
if (u3du(tal_lap) != c3y) { u3m_bail(c3__exit); }
u3_noun q_lap = u3t(tal_lap);
u3_noun lis = u3qdi_tap(q_lap);
u3_noun hos = u3qfu_felt_arm(lis);
pro = u3kf_fork(hos);
u3z(lis);
}
else { u3m_bail(c3__exit); }
return pro;
else {
u3m_bail(c3__exit);
}
return pro;
}
static u3_noun