2013-09-29 00:21:18 +04:00
|
|
|
/* j/5/parse.c
|
|
|
|
**
|
|
|
|
** This file is in the public domain.
|
|
|
|
*/
|
|
|
|
#include "all.h"
|
2014-09-04 07:10:43 +04:00
|
|
|
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
static u3_noun
|
2014-08-20 10:22:41 +04:00
|
|
|
_slip(
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun weq,
|
|
|
|
u3_noun naz)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun p_naz, q_naz;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(naz, &p_naz, &q_naz);
|
2013-09-29 00:21:18 +04:00
|
|
|
if ( 10 == weq ) {
|
2014-11-06 03:20:01 +03:00
|
|
|
return u3nc(u3x_good(
|
|
|
|
u3i_vint(u3k(p_naz))),
|
2013-09-29 00:21:18 +04:00
|
|
|
1);
|
|
|
|
} else {
|
2014-09-06 00:13:24 +04:00
|
|
|
return u3nc(u3k(p_naz),
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_good(
|
|
|
|
u3i_vint(u3k(q_naz))));
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
static u3_noun
|
2014-08-20 10:22:41 +04:00
|
|
|
_fail(
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun tub)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun p_tub, q_tub;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(tub, &p_tub, &q_tub);
|
2014-09-06 00:13:24 +04:00
|
|
|
return u3nc(u3k(p_tub), u3_nul);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
static u3_noun
|
2014-08-20 10:22:41 +04:00
|
|
|
_last(
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun zyc,
|
|
|
|
u3_noun naz)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun p_zyc, q_zyc, p_naz, q_naz;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(zyc, &p_zyc, &q_zyc);
|
|
|
|
u3x_cell(naz, &p_naz, &q_naz);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
if ( !_(u3a_is_cat(p_zyc)) || !_(u3a_is_cat(q_zyc)) ||
|
|
|
|
!_(u3a_is_cat(p_naz)) || !_(u3a_is_cat(q_naz)) )
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-11-06 03:20:01 +03:00
|
|
|
return u3m_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
|
|
|
if ( p_zyc == p_naz ) {
|
2014-09-06 00:13:24 +04:00
|
|
|
return (q_zyc > q_naz) ? u3k(zyc) : u3k(naz);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
else {
|
2014-09-06 00:13:24 +04:00
|
|
|
return (p_zyc > p_naz) ? u3k(zyc) : u3k(naz);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
static u3_noun
|
2014-08-20 10:22:41 +04:00
|
|
|
_next(
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun tub)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun p_tub, q_tub;
|
|
|
|
u3_noun zac;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(tub, &p_tub, &q_tub);
|
2014-11-05 04:18:47 +03:00
|
|
|
if ( c3n == u3du(q_tub) ) {
|
2014-08-20 10:22:41 +04:00
|
|
|
return _fail(tub);
|
2014-04-22 05:22:11 +04:00
|
|
|
}
|
2013-09-29 00:21:18 +04:00
|
|
|
else {
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun iq_tub = u3h(q_tub);
|
|
|
|
u3_noun tq_tub = u3t(q_tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
zac = _slip(iq_tub, p_tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
return u3nc
|
2014-08-20 10:22:41 +04:00
|
|
|
(zac,
|
2014-09-06 00:13:24 +04:00
|
|
|
u3nq(u3_nul,
|
|
|
|
u3k(iq_tub),
|
|
|
|
u3k(zac),
|
|
|
|
u3k(tq_tub)));
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* bend
|
|
|
|
*/
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
|
|
|
_cqe_bend_fun(u3_noun raq,
|
|
|
|
u3_noun vex,
|
|
|
|
u3_noun sab)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun p_vex, q_vex;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(vex, &p_vex, &q_vex);
|
2014-11-05 04:18:47 +03:00
|
|
|
if ( c3n == u3du(q_vex) ) {
|
2014-09-06 00:13:24 +04:00
|
|
|
return u3k(vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun uq_vex = u3t(q_vex);
|
|
|
|
u3_noun puq_vex, quq_vex;
|
|
|
|
u3_noun yit, yur;
|
|
|
|
u3_noun p_yit, q_yit;
|
|
|
|
u3_noun ret;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(uq_vex, &puq_vex, &quq_vex);
|
|
|
|
yit = u3x_good(u3n_slam_on(u3k(sab), u3k(quq_vex)));
|
2014-04-22 05:22:11 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(yit, &p_yit, &q_yit);
|
2014-08-20 10:22:41 +04:00
|
|
|
yur = _last(p_vex, p_yit);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-05 04:18:47 +03:00
|
|
|
if ( c3n == u3du(q_yit) ) {
|
2014-09-06 00:13:24 +04:00
|
|
|
ret = u3nc(yur, u3k(q_vex));
|
2014-04-22 05:22:11 +04:00
|
|
|
}
|
2013-09-29 00:21:18 +04:00
|
|
|
else {
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun uq_yit = u3t(q_yit);
|
|
|
|
u3_noun puq_yit, quq_yit;
|
|
|
|
u3_noun vux;
|
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(uq_yit, &puq_yit, &quq_yit);
|
2014-09-06 00:13:24 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
vux = u3x_good
|
|
|
|
(u3n_slam_on
|
2014-09-06 00:13:24 +04:00
|
|
|
(u3k(raq),
|
|
|
|
u3nc(u3k(puq_vex),
|
|
|
|
u3k(puq_yit))));
|
|
|
|
if ( u3_nul == vux ) {
|
|
|
|
ret = u3nc(yur, u3k(q_vex));
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
else {
|
2014-09-06 00:13:24 +04:00
|
|
|
ret = u3nq(yur,
|
|
|
|
u3_nul,
|
|
|
|
u3k(u3t(vux)),
|
|
|
|
u3k(quq_yit));
|
|
|
|
u3z(vux);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
2014-09-06 00:13:24 +04:00
|
|
|
u3z(yit);
|
2013-09-29 00:21:18 +04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
|
|
|
u3_cwe_bend_fun(u3_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun van, raq, vex, sab;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
if ( (c3n == u3r_mean(cor, u3v_sam_2, &vex,
|
|
|
|
u3v_sam_3, &sab,
|
|
|
|
u3v_con, &van, 0)) ||
|
|
|
|
(u3_none == (raq = u3r_at(u3v_sam, van))) )
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-11-06 03:20:01 +03:00
|
|
|
return u3m_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-09-03 09:46:55 +04:00
|
|
|
return _cqe_bend_fun(raq, vex, sab);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* cold
|
|
|
|
*/
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
2014-09-03 09:46:55 +04:00
|
|
|
_cqe_cold_fun(
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun cus,
|
|
|
|
u3_noun sef,
|
|
|
|
u3_noun tub)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-11-06 03:20:01 +03:00
|
|
|
u3_noun vex = u3x_good(u3n_slam_on(u3k(sef), u3k(tub)));
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun p_vex, q_vex;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(vex, &p_vex, &q_vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-05 04:18:47 +03:00
|
|
|
if ( c3n == u3du(q_vex) ) {
|
2013-09-29 00:21:18 +04:00
|
|
|
return vex;
|
|
|
|
}
|
|
|
|
else {
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun uq_vex = u3t(q_vex);
|
|
|
|
u3_noun quq_vex;
|
|
|
|
u3_noun ret;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(uq_vex, 0, &quq_vex);
|
2014-09-06 00:13:24 +04:00
|
|
|
ret = u3nq(u3k(p_vex),
|
|
|
|
u3_nul,
|
|
|
|
u3k(cus),
|
|
|
|
u3k(quq_vex));
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
u3z(vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
|
|
|
u3_cwe_cold_fun(
|
|
|
|
u3_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun van, cus, sef, tub;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
if ( (c3n == u3r_mean(cor, u3v_sam, &tub, u3v_con, &van, 0)) ||
|
|
|
|
(c3n == u3r_mean(van, u3v_sam_2, &cus, u3v_sam_3, &sef, 0)) )
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-11-06 03:20:01 +03:00
|
|
|
return u3m_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-09-03 09:46:55 +04:00
|
|
|
return _cqe_cold_fun(cus, sef, tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* cook
|
|
|
|
*/
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
2014-09-03 09:46:55 +04:00
|
|
|
_cqe_cook_fun(
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun poq,
|
|
|
|
u3_noun sef,
|
|
|
|
u3_noun tub)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-11-06 03:20:01 +03:00
|
|
|
u3_noun vex = u3x_good(u3n_slam_on(u3k(sef), u3k(tub)));
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun p_vex, q_vex;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(vex, &p_vex, &q_vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-05 04:18:47 +03:00
|
|
|
if ( c3n == u3du(q_vex) ) {
|
2013-09-29 00:21:18 +04:00
|
|
|
return vex;
|
|
|
|
}
|
|
|
|
else {
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun uq_vex = u3t(q_vex);
|
|
|
|
u3_noun puq_vex, quq_vex;
|
|
|
|
u3_noun wag;
|
|
|
|
u3_noun ret;
|
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(uq_vex, &puq_vex, &quq_vex);
|
|
|
|
wag = u3x_good(u3n_slam_on(u3k(poq), u3k(puq_vex)));
|
2014-09-06 00:13:24 +04:00
|
|
|
ret = u3nq(u3k(p_vex),
|
|
|
|
u3_nul,
|
2013-09-29 00:21:18 +04:00
|
|
|
wag,
|
2014-09-06 00:13:24 +04:00
|
|
|
u3k(quq_vex));
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
u3z(vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
|
|
|
u3_cwe_cook_fun(
|
|
|
|
u3_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun van, poq, sef, tub;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
if ( (c3n == u3r_mean(cor, u3v_sam, &tub, u3v_con, &van, 0)) ||
|
|
|
|
(c3n == u3r_mean(van, u3v_sam_2, &poq, u3v_sam_3, &sef, 0)) )
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-11-06 03:20:01 +03:00
|
|
|
return u3m_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-09-03 09:46:55 +04:00
|
|
|
return _cqe_cook_fun(poq, sef, tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* comp
|
|
|
|
*/
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
2014-09-03 09:46:55 +04:00
|
|
|
_cqe_comp_fun(
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun raq,
|
|
|
|
u3_noun vex,
|
|
|
|
u3_noun sab)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun p_vex, q_vex;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(vex, &p_vex, &q_vex);
|
2014-11-05 04:18:47 +03:00
|
|
|
if ( c3n == u3du(q_vex) ) {
|
2014-09-06 00:13:24 +04:00
|
|
|
return u3k(vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun uq_vex = u3t(q_vex);
|
|
|
|
u3_noun puq_vex, quq_vex;
|
|
|
|
u3_noun yit, yur;
|
|
|
|
u3_noun p_yit, q_yit;
|
|
|
|
u3_noun ret;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(uq_vex, &puq_vex, &quq_vex);
|
|
|
|
yit = u3x_good(u3n_slam_on(u3k(sab), u3k(quq_vex)));
|
2014-04-22 05:22:11 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(yit, &p_yit, &q_yit);
|
2014-08-20 10:22:41 +04:00
|
|
|
yur = _last(p_vex, p_yit);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-05 04:18:47 +03:00
|
|
|
if ( c3n == u3du(q_yit) ) {
|
2014-09-06 00:13:24 +04:00
|
|
|
ret = u3nc(yur, u3k(q_yit));
|
2014-04-22 05:22:11 +04:00
|
|
|
}
|
2013-09-29 00:21:18 +04:00
|
|
|
else {
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun uq_yit = u3t(q_yit);
|
|
|
|
u3_noun puq_yit, quq_yit;
|
2014-04-22 05:22:11 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(uq_yit, &puq_yit, &quq_yit);
|
2014-09-06 00:13:24 +04:00
|
|
|
ret = u3nq(yur,
|
|
|
|
u3_nul,
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_good
|
2014-08-20 10:22:41 +04:00
|
|
|
(
|
2014-11-06 03:20:01 +03:00
|
|
|
u3n_slam_on
|
2014-09-06 00:13:24 +04:00
|
|
|
(u3k(raq),
|
|
|
|
u3nc(u3k(puq_vex),
|
|
|
|
u3k(puq_yit)))),
|
|
|
|
u3k(quq_yit));
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
2014-09-06 00:13:24 +04:00
|
|
|
u3z(yit);
|
2013-09-29 00:21:18 +04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
|
|
|
u3_cwe_comp_fun(
|
|
|
|
u3_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun van, raq, vex, sab;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
if ( (c3n == u3r_mean(cor, u3v_sam_2, &vex,
|
|
|
|
u3v_sam_3, &sab,
|
|
|
|
u3v_con, &van, 0)) ||
|
|
|
|
(u3_none == (raq = u3r_at(u3v_sam, van))) )
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-11-06 03:20:01 +03:00
|
|
|
return u3m_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-09-03 09:46:55 +04:00
|
|
|
return _cqe_comp_fun(raq, vex, sab);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* easy
|
|
|
|
*/
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
2014-09-03 09:46:55 +04:00
|
|
|
_cqe_easy_fun(
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun huf,
|
|
|
|
u3_noun tub)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun p_tub, q_tub;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(tub, &p_tub, &q_tub);
|
2014-09-06 00:13:24 +04:00
|
|
|
return u3nq(u3k(p_tub),
|
|
|
|
u3_nul,
|
|
|
|
u3k(huf),
|
|
|
|
u3k(tub));
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
|
|
|
u3_cwe_easy_fun(
|
|
|
|
u3_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun van, huf, tub;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
if ( (c3n == u3r_mean(cor, u3v_sam, &tub, u3v_con, &van, 0)) ||
|
|
|
|
(u3_none == (huf = u3r_at(u3v_sam, van))) )
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-11-06 03:20:01 +03:00
|
|
|
return u3m_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-09-03 09:46:55 +04:00
|
|
|
return _cqe_easy_fun(huf, tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* glue
|
|
|
|
*/
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
2014-09-03 09:46:55 +04:00
|
|
|
_cqe_glue_fun(
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun bus,
|
|
|
|
u3_noun vex,
|
|
|
|
u3_noun sab)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun p_vex, q_vex;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(vex, &p_vex, &q_vex);
|
2014-11-05 04:18:47 +03:00
|
|
|
if ( c3n == u3du(q_vex) ) {
|
2014-09-06 00:13:24 +04:00
|
|
|
return u3k(vex);
|
2014-04-22 05:22:11 +04:00
|
|
|
}
|
2013-09-29 00:21:18 +04:00
|
|
|
else {
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun uq_vex = u3t(q_vex);
|
|
|
|
u3_noun puq_vex, quq_vex;
|
|
|
|
u3_noun yit, yur;
|
|
|
|
u3_noun p_yit, q_yit;
|
|
|
|
u3_noun ret;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(uq_vex, &puq_vex, &quq_vex);
|
|
|
|
yit = u3x_good(u3n_slam_on(u3k(bus), u3k(quq_vex)));
|
2014-04-22 05:22:11 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(yit, &p_yit, &q_yit);
|
2014-08-20 10:22:41 +04:00
|
|
|
yur = _last(p_vex, p_yit);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-05 04:18:47 +03:00
|
|
|
if ( c3n == u3du(q_yit) ) {
|
2014-09-06 00:13:24 +04:00
|
|
|
ret = u3nc(yur, u3_nul);
|
2014-04-22 05:22:11 +04:00
|
|
|
}
|
2013-09-29 00:21:18 +04:00
|
|
|
else {
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun uq_yit = u3t(q_yit);
|
|
|
|
u3_noun puq_yit, quq_yit;
|
|
|
|
u3_noun wam, p_wam, q_wam, goy;
|
2014-04-22 05:22:11 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(uq_yit, &puq_yit, &quq_yit);
|
|
|
|
wam = u3x_good(u3n_slam_on(u3k(sab), u3k(quq_yit)));
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(wam, &p_wam, &q_wam);
|
2014-08-20 10:22:41 +04:00
|
|
|
goy = _last(yur, p_wam);
|
2014-09-06 00:13:24 +04:00
|
|
|
u3z(yur);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-05 04:18:47 +03:00
|
|
|
if ( c3n == u3du(q_wam) ) {
|
2014-09-06 00:13:24 +04:00
|
|
|
ret = u3nc(goy, u3_nul);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun uq_wam = u3t(q_wam);
|
|
|
|
u3_noun puq_wam, quq_wam;
|
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(uq_wam, &puq_wam, &quq_wam);
|
2014-09-06 00:13:24 +04:00
|
|
|
ret = u3nq(goy,
|
|
|
|
u3_nul,
|
|
|
|
u3nc(u3k(puq_vex),
|
|
|
|
u3k(puq_wam)),
|
|
|
|
u3k(quq_wam));
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
2014-09-06 00:13:24 +04:00
|
|
|
u3z(wam);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
2014-09-06 00:13:24 +04:00
|
|
|
u3z(yit);
|
2013-09-29 00:21:18 +04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
|
|
|
u3_cwe_glue_fun(
|
|
|
|
u3_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun van, bus, vex, sab;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
if ( (c3n == u3r_mean(cor, u3v_sam_2, &vex,
|
|
|
|
u3v_sam_3, &sab,
|
|
|
|
u3v_con, &van, 0)) ||
|
|
|
|
(u3_none == (bus = u3r_at(u3v_sam, van))) )
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-11-06 03:20:01 +03:00
|
|
|
return u3m_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-09-03 09:46:55 +04:00
|
|
|
return _cqe_glue_fun(bus, vex, sab);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* here
|
|
|
|
*/
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
2014-09-03 09:46:55 +04:00
|
|
|
_cqe_here_fun(
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun hez,
|
|
|
|
u3_noun sef,
|
|
|
|
u3_noun tub)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-11-06 03:20:01 +03:00
|
|
|
u3_noun vex = u3x_good(u3n_slam_on(u3k(sef), u3k(tub)));
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun p_vex, q_vex;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(vex, &p_vex, &q_vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-05 04:18:47 +03:00
|
|
|
if ( c3n == u3du(q_vex) ) {
|
2013-09-29 00:21:18 +04:00
|
|
|
return vex;
|
|
|
|
}
|
|
|
|
else {
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun uq_vex = u3t(q_vex);
|
|
|
|
u3_noun p_tub, q_tub;
|
|
|
|
u3_noun puq_vex, quq_vex, pquq_vex;
|
|
|
|
u3_noun gud, wag;
|
|
|
|
u3_noun ret;
|
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(tub, &p_tub, &q_tub);
|
|
|
|
u3x_cell(uq_vex, &puq_vex, &quq_vex);
|
|
|
|
u3x_cell(quq_vex, &pquq_vex, 0);
|
2014-09-06 00:13:24 +04:00
|
|
|
gud = u3nc(
|
|
|
|
u3nc(u3k(p_tub),
|
|
|
|
u3k(pquq_vex)),
|
|
|
|
u3k(puq_vex));
|
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
wag = u3x_good(u3n_slam_on(u3k(hez), gud));
|
2014-09-06 00:13:24 +04:00
|
|
|
ret = u3nq(u3k(p_vex),
|
|
|
|
u3_nul,
|
2013-09-29 00:21:18 +04:00
|
|
|
wag,
|
2014-09-06 00:13:24 +04:00
|
|
|
u3k(quq_vex));
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
u3z(vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
|
|
|
u3_cwe_here_fun(
|
|
|
|
u3_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun van, hez, sef, tub;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
if ( (c3n == u3r_mean(cor, u3v_sam, &tub, u3v_con, &van, 0)) ||
|
|
|
|
(c3n == u3r_mean(van, u3v_sam_2, &hez, u3v_sam_3, &sef, 0)) )
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-11-06 03:20:01 +03:00
|
|
|
return u3m_bail(c3__fail);
|
2014-10-09 02:16:24 +04:00
|
|
|
}
|
|
|
|
else {
|
2014-09-03 09:46:55 +04:00
|
|
|
return _cqe_here_fun(hez, sef, tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* just
|
|
|
|
*/
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
2014-09-03 09:46:55 +04:00
|
|
|
_cqe_just_fun(
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun daf,
|
|
|
|
u3_noun tub)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun p_tub, q_tub;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(tub, &p_tub, &q_tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-05 04:18:47 +03:00
|
|
|
if ( c3n == u3du(q_tub) ) {
|
2014-08-20 10:22:41 +04:00
|
|
|
return _fail(tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
else {
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun iq_tub = u3h(q_tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
if ( c3y == u3r_sing(daf, iq_tub) ) {
|
2014-08-20 10:22:41 +04:00
|
|
|
return _next(tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
2014-08-20 10:22:41 +04:00
|
|
|
else return _fail(tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
|
|
|
u3_cwe_just_fun(
|
|
|
|
u3_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun van, daf, tub;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
if ( (c3n == u3r_mean(cor, u3v_sam, &tub, u3v_con, &van, 0)) ||
|
|
|
|
(u3_none == (daf = u3r_at(u3v_sam, van))) )
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-11-06 03:20:01 +03:00
|
|
|
return u3m_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-09-03 09:46:55 +04:00
|
|
|
return _cqe_just_fun(daf, tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* mask
|
|
|
|
*/
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
2014-09-03 09:46:55 +04:00
|
|
|
_cqe_mask_fun(
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun bud,
|
|
|
|
u3_noun tub)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun p_tub, q_tub;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(tub, &p_tub, &q_tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-05 04:18:47 +03:00
|
|
|
if ( c3n == u3du(q_tub) ) {
|
2014-08-20 10:22:41 +04:00
|
|
|
return _fail(tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
else {
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun iq_tub = u3h(q_tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-05 04:18:47 +03:00
|
|
|
while ( c3y == u3du(bud) ) {
|
2014-11-06 03:20:01 +03:00
|
|
|
if ( c3y == u3r_sing(u3h(bud), iq_tub) ) {
|
2014-08-20 10:22:41 +04:00
|
|
|
return _next(tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
2014-09-06 00:13:24 +04:00
|
|
|
bud = u3t(bud);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
2014-08-20 10:22:41 +04:00
|
|
|
return _fail(tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
|
|
|
u3_cwe_mask_fun(
|
|
|
|
u3_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun van, bud, tub;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
if ( (c3n == u3r_mean(cor, u3v_sam, &tub, u3v_con, &van, 0)) ||
|
|
|
|
(u3_none == (bud = u3r_at(u3v_sam, van))) )
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-11-06 03:20:01 +03:00
|
|
|
return u3m_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-09-03 09:46:55 +04:00
|
|
|
return _cqe_mask_fun(bud, tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/* pfix
|
|
|
|
*/
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
2014-09-04 01:33:18 +04:00
|
|
|
_cqe_pfix(
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun vex,
|
|
|
|
u3_noun sab)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun p_vex, q_vex;
|
2014-04-22 05:22:11 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(vex, &p_vex, &q_vex);
|
2014-11-05 04:18:47 +03:00
|
|
|
if ( c3n == u3du(q_vex) ) {
|
2014-09-06 00:13:24 +04:00
|
|
|
return u3k(vex);
|
2014-04-22 05:22:11 +04:00
|
|
|
}
|
2013-09-29 00:21:18 +04:00
|
|
|
else {
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun uq_vex = u3t(q_vex);
|
|
|
|
u3_noun puq_vex, quq_vex;
|
|
|
|
u3_noun yit, p_yit, q_yit;
|
|
|
|
u3_noun ret;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(uq_vex, &puq_vex, &quq_vex);
|
|
|
|
yit = u3x_good(u3n_slam_on(u3k(sab), u3k(quq_vex)));
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(yit, &p_yit, &q_yit);
|
2014-09-06 00:13:24 +04:00
|
|
|
ret = u3nc
|
2014-08-20 10:22:41 +04:00
|
|
|
(
|
|
|
|
_last(p_vex, p_yit),
|
2014-09-06 00:13:24 +04:00
|
|
|
u3k(q_yit));
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
u3z(yit);
|
2013-09-29 00:21:18 +04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
|
|
|
u3_cwe_pfix(
|
|
|
|
u3_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun vex, sab;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
if ( (c3n == u3r_mean(cor, u3v_sam_2, &vex, u3v_sam_3, &sab, 0)) ) {
|
|
|
|
return u3m_bail(c3__exit);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-09-04 01:33:18 +04:00
|
|
|
return _cqe_pfix(vex, sab);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* plug
|
|
|
|
*/
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
2014-09-04 01:33:18 +04:00
|
|
|
_cqe_plug(
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun vex,
|
|
|
|
u3_noun sab)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun p_vex, q_vex;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(vex, &p_vex, &q_vex);
|
2014-11-05 04:18:47 +03:00
|
|
|
if ( c3n == u3du(q_vex) ) {
|
2014-09-06 00:13:24 +04:00
|
|
|
return u3k(vex);
|
2014-04-22 05:22:11 +04:00
|
|
|
}
|
2013-09-29 00:21:18 +04:00
|
|
|
else {
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun uq_vex = u3t(q_vex);
|
|
|
|
u3_noun puq_vex, quq_vex;
|
|
|
|
u3_noun yit, yur;
|
|
|
|
u3_noun p_yit, q_yit;
|
|
|
|
u3_noun ret;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(uq_vex, &puq_vex, &quq_vex);
|
|
|
|
yit = u3x_good(u3n_slam_on(u3k(sab), u3k(quq_vex)));
|
2014-04-22 05:22:11 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(yit, &p_yit, &q_yit);
|
2014-08-20 10:22:41 +04:00
|
|
|
yur = _last(p_vex, p_yit);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-05 04:18:47 +03:00
|
|
|
if ( c3n == u3du(q_yit) ) {
|
2014-09-06 00:13:24 +04:00
|
|
|
ret = u3nc(yur, u3k(q_yit));
|
2014-04-22 05:22:11 +04:00
|
|
|
}
|
2013-09-29 00:21:18 +04:00
|
|
|
else {
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun uq_yit = u3t(q_yit);
|
|
|
|
u3_noun puq_yit, quq_yit;
|
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(uq_yit, &puq_yit, &quq_yit);
|
2014-09-06 00:13:24 +04:00
|
|
|
ret = u3nq(yur,
|
|
|
|
u3_nul,
|
|
|
|
u3nc(u3k(puq_vex),
|
|
|
|
u3k(puq_yit)),
|
|
|
|
u3k(quq_yit));
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
2014-09-06 00:13:24 +04:00
|
|
|
u3z(yit);
|
2013-09-29 00:21:18 +04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
|
|
|
u3_cwe_plug(
|
|
|
|
u3_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun vex, sab;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
if ( (c3n == u3r_mean(cor, u3v_sam_2, &vex, u3v_sam_3, &sab, 0)) ) {
|
|
|
|
return u3m_bail(c3__exit);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-09-04 01:33:18 +04:00
|
|
|
return _cqe_plug(vex, sab);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* pose
|
|
|
|
*/
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
|
|
|
u3_cqe_pose(u3_noun vex,
|
|
|
|
u3_noun sab)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun p_vex, q_vex;
|
2014-04-22 05:22:11 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(vex, &p_vex, &q_vex);
|
2014-11-05 04:18:47 +03:00
|
|
|
if ( c3y == u3du(q_vex) ) {
|
2014-09-06 00:13:24 +04:00
|
|
|
return u3k(vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-11-06 03:20:01 +03:00
|
|
|
u3_noun roq = u3x_good(u3n_kick_on(u3k(sab)));
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun p_roq, q_roq;
|
|
|
|
u3_noun ret;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(roq, &p_roq, &q_roq);
|
2014-09-06 00:13:24 +04:00
|
|
|
ret = u3nc
|
2014-08-20 10:22:41 +04:00
|
|
|
(
|
|
|
|
_last(p_vex, p_roq),
|
2014-09-06 00:13:24 +04:00
|
|
|
u3k(q_roq));
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
u3z(roq);
|
2013-09-29 00:21:18 +04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
|
|
|
u3_cwe_pose(
|
|
|
|
u3_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun vex, sab;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
if ( (c3n == u3r_mean(cor, u3v_sam_2, &vex, u3v_sam_3, &sab, 0)) ) {
|
|
|
|
return u3m_bail(c3__exit);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-09-06 00:13:24 +04:00
|
|
|
return u3_cqe_pose(vex, sab);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* sfix
|
|
|
|
*/
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
|
|
|
_cqe_sfix(u3_noun vex, u3_noun sab)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun p_vex, q_vex;
|
2014-04-22 05:22:11 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(vex, &p_vex, &q_vex);
|
2014-11-05 04:18:47 +03:00
|
|
|
if ( c3n == u3du(q_vex) ) {
|
2014-09-06 00:13:24 +04:00
|
|
|
return u3k(vex);
|
2014-04-22 05:22:11 +04:00
|
|
|
}
|
2013-09-29 00:21:18 +04:00
|
|
|
else {
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun uq_vex = u3t(q_vex);
|
|
|
|
u3_noun puq_vex, quq_vex;
|
|
|
|
u3_noun yit, p_yit, q_yit, yur;
|
|
|
|
u3_noun ret;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(uq_vex, &puq_vex, &quq_vex);
|
|
|
|
yit = u3x_good(u3n_slam_on(u3k(sab), u3k(quq_vex)));
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(yit, &p_yit, &q_yit);
|
2014-08-20 10:22:41 +04:00
|
|
|
yur = _last(p_vex, p_yit);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-05 04:18:47 +03:00
|
|
|
if ( c3n == u3du(q_yit) ) {
|
2014-09-06 00:13:24 +04:00
|
|
|
ret = u3nc(yur, u3_nul);
|
2014-04-22 05:22:11 +04:00
|
|
|
}
|
2013-09-29 00:21:18 +04:00
|
|
|
else {
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun uq_yit = u3t(q_yit);
|
|
|
|
u3_noun puq_yit, quq_yit;
|
2014-04-22 05:22:11 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(uq_yit, &puq_yit, &quq_yit);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
ret = u3nq(yur,
|
|
|
|
u3_nul,
|
|
|
|
u3k(puq_vex),
|
|
|
|
u3k(quq_yit));
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
2014-09-06 00:13:24 +04:00
|
|
|
u3z(yit);
|
2013-09-29 00:21:18 +04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
|
|
|
u3_cwe_sfix(u3_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun vex, sab;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
if ( (c3n == u3r_mean(cor, u3v_sam_2, &vex, u3v_sam_3, &sab, 0)) ) {
|
|
|
|
return u3m_bail(c3__exit);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-09-04 01:33:18 +04:00
|
|
|
return _cqe_sfix(vex, sab);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* shim
|
|
|
|
*/
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
|
|
|
_cqe_shim_fun(u3_noun zep,
|
|
|
|
u3_noun tub)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun p_tub, q_tub;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(tub, &p_tub, &q_tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-05 04:18:47 +03:00
|
|
|
if ( c3n == u3du(q_tub) ) {
|
2014-08-20 10:22:41 +04:00
|
|
|
return _fail(tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
else {
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun p_zep, q_zep;
|
|
|
|
u3_noun iq_tub = u3h(q_tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(zep, &p_zep, &q_zep);
|
|
|
|
if ( _(u3a_is_cat(p_zep)) &&
|
|
|
|
_(u3a_is_cat(q_zep)) &&
|
|
|
|
_(u3a_is_cat(iq_tub)) )
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
if ( (iq_tub >= p_zep) && (iq_tub <= q_zep) ) {
|
2014-08-20 10:22:41 +04:00
|
|
|
return _next(tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
2014-08-20 10:22:41 +04:00
|
|
|
else return _fail(tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
else {
|
2014-11-06 03:20:01 +03:00
|
|
|
return u3m_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
|
|
|
u3_cwe_shim_fun(
|
|
|
|
u3_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun van, zep, tub;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
if ( (c3n == u3r_mean(cor, u3v_sam, &tub, u3v_con, &van, 0)) ||
|
|
|
|
(u3_none == (zep = u3r_at(u3v_sam, van))) )
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-11-06 03:20:01 +03:00
|
|
|
return u3m_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-09-03 09:46:55 +04:00
|
|
|
return _cqe_shim_fun(zep, tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* stag
|
|
|
|
*/
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
2014-09-03 09:46:55 +04:00
|
|
|
_cqe_stag_fun(
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun gob,
|
|
|
|
u3_noun sef,
|
|
|
|
u3_noun tub)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-11-06 03:20:01 +03:00
|
|
|
u3_noun vex = u3x_good(u3n_slam_on(u3k(sef), u3k(tub)));
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun p_vex, q_vex;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(vex, &p_vex, &q_vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-05 04:18:47 +03:00
|
|
|
if ( c3n == u3du(q_vex) ) {
|
2013-09-29 00:21:18 +04:00
|
|
|
return vex;
|
|
|
|
}
|
|
|
|
else {
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun uq_vex = u3t(q_vex);
|
|
|
|
u3_noun puq_vex, quq_vex;
|
|
|
|
u3_noun wag;
|
|
|
|
u3_noun ret;
|
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(uq_vex, &puq_vex, &quq_vex);
|
2014-09-06 00:13:24 +04:00
|
|
|
wag = u3nc(u3k(gob), u3k(puq_vex));
|
|
|
|
ret = u3nq(u3k(p_vex),
|
|
|
|
u3_nul,
|
2013-09-29 00:21:18 +04:00
|
|
|
wag,
|
2014-09-06 00:13:24 +04:00
|
|
|
u3k(quq_vex));
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
u3z(vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
|
|
|
u3_cwe_stag_fun(
|
|
|
|
u3_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun van, gob, sef, tub;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
if ( (c3n == u3r_mean(cor, u3v_sam, &tub, u3v_con, &van, 0)) ||
|
|
|
|
(c3n == u3r_mean(van, u3v_sam_2, &gob, u3v_sam_3, &sef, 0)) )
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-11-06 03:20:01 +03:00
|
|
|
return u3m_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-09-03 09:46:55 +04:00
|
|
|
return _cqe_stag_fun(gob, sef, tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* stew
|
|
|
|
*/
|
2014-11-06 06:10:22 +03:00
|
|
|
static u3_noun
|
2014-08-20 10:22:41 +04:00
|
|
|
_stew_wor(
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun ort,
|
|
|
|
u3_noun wan)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-11-06 03:20:01 +03:00
|
|
|
if ( !_(u3a_is_cat(ort)) ) {
|
|
|
|
return u3m_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
else {
|
2014-11-05 04:18:47 +03:00
|
|
|
if ( c3n == u3du(wan) ) {
|
2014-11-06 03:20:01 +03:00
|
|
|
if ( !_(u3a_is_cat(wan)) ) {
|
|
|
|
return u3m_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
2014-11-05 04:18:47 +03:00
|
|
|
else return (ort < wan) ? c3y : c3n;
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
else {
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun h_wan = u3h(wan);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
if ( !_(u3a_is_cat(h_wan)) ) {
|
|
|
|
return u3m_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
2014-11-05 04:18:47 +03:00
|
|
|
else return (ort < h_wan) ? c3y : c3n;
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
2014-09-03 09:46:55 +04:00
|
|
|
_cqe_stew_fun(
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun hel,
|
|
|
|
u3_noun tub)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun p_tub, q_tub;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(tub, &p_tub, &q_tub);
|
2014-11-05 04:18:47 +03:00
|
|
|
if ( c3n == u3du(q_tub) ) {
|
2014-08-20 10:22:41 +04:00
|
|
|
return _fail(tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
else {
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun iq_tub = u3h(q_tub);
|
2014-08-20 10:22:41 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
if ( !_(u3a_is_cat(iq_tub)) ) {
|
|
|
|
return u3m_bail(c3__fail);
|
2014-09-04 01:33:18 +04:00
|
|
|
}
|
2014-08-20 10:22:41 +04:00
|
|
|
else while ( 1 ) {
|
2014-11-05 04:18:47 +03:00
|
|
|
if ( c3n == u3du(hel) ) {
|
2014-08-20 10:22:41 +04:00
|
|
|
return _fail(tub);
|
2014-04-22 05:22:11 +04:00
|
|
|
}
|
2013-09-29 00:21:18 +04:00
|
|
|
else {
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun n_hel, l_hel, r_hel;
|
|
|
|
u3_noun pn_hel, qn_hel;
|
2014-09-11 04:01:32 +04:00
|
|
|
c3_o bit_o;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_trel(hel, &n_hel, &l_hel, &r_hel);
|
|
|
|
u3x_cell(n_hel, &pn_hel, &qn_hel);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-05 04:18:47 +03:00
|
|
|
if ( (c3n == u3du(pn_hel)) ) {
|
|
|
|
bit_o = __((iq_tub == pn_hel));
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
else {
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun hpn_hel = u3h(pn_hel);
|
|
|
|
u3_noun tpn_hel = u3t(pn_hel);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
if ( !_(u3a_is_cat(hpn_hel)) ||
|
|
|
|
!_(u3a_is_cat(tpn_hel)) ) {
|
2014-08-20 10:22:41 +04:00
|
|
|
return _fail(tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
2014-11-05 04:18:47 +03:00
|
|
|
else bit_o = __((iq_tub >= hpn_hel) && (iq_tub <= tpn_hel));
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
|
2014-11-05 04:18:47 +03:00
|
|
|
if ( c3y == bit_o ) {
|
2014-11-06 03:20:01 +03:00
|
|
|
return u3x_good
|
|
|
|
(u3n_slam_on(u3k(qn_hel), u3k(tub)));
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-11-05 04:18:47 +03:00
|
|
|
if ( c3y == _stew_wor(iq_tub, pn_hel) ) {
|
2013-09-29 00:21:18 +04:00
|
|
|
hel = l_hel;
|
|
|
|
}
|
|
|
|
else hel = r_hel;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-09-15 07:27:48 +04:00
|
|
|
u3_noun
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_cwe_stew_fun(
|
|
|
|
u3_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun con, hel, tub;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
if ( (c3n == u3r_mean(cor, u3v_sam, &tub, u3v_con, &con, 0)) ||
|
|
|
|
(u3_none == (hel = u3r_at(2, con))) )
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-11-06 03:20:01 +03:00
|
|
|
return u3m_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-09-03 09:46:55 +04:00
|
|
|
return _cqe_stew_fun(hel, tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* stir
|
|
|
|
*/
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
|
|
|
_cqe_stir_fun(u3_noun rud,
|
|
|
|
u3_noun raq,
|
|
|
|
u3_noun fel,
|
|
|
|
u3_noun tub)
|
|
|
|
{
|
2014-11-06 03:20:01 +03:00
|
|
|
u3_noun vex = u3x_good(u3n_slam_on(u3k(fel), u3k(tub)));
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun p_vex, q_vex;
|
|
|
|
u3_noun ret;
|
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(vex, &p_vex, &q_vex);
|
2014-11-05 04:18:47 +03:00
|
|
|
if ( c3n == u3du(q_vex) ) {
|
2014-09-06 00:13:24 +04:00
|
|
|
ret = u3nq(u3k(p_vex),
|
|
|
|
u3_nul,
|
|
|
|
u3k(rud),
|
|
|
|
u3k(tub));
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
else {
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun uq_vex = u3t(q_vex);
|
|
|
|
u3_noun puq_vex, quq_vex;
|
|
|
|
u3_noun wag, p_wag, q_wag, uq_wag, puq_wag, quq_wag;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(uq_vex, &puq_vex, &quq_vex);
|
2014-09-03 09:46:55 +04:00
|
|
|
wag = _cqe_stir_fun(rud, raq, fel, quq_vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(wag, &p_wag, &q_wag);
|
2014-11-05 04:18:47 +03:00
|
|
|
if ( c3n == u3du(q_wag) ) {
|
2014-11-06 03:20:01 +03:00
|
|
|
return u3m_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
2014-09-06 00:13:24 +04:00
|
|
|
uq_wag = u3t(q_wag);
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(uq_wag, &puq_wag, &quq_wag);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
ret = u3nq
|
2014-08-20 10:22:41 +04:00
|
|
|
(_last(p_vex, p_wag),
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_nul,
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_good(u3n_slam_on
|
2014-09-06 00:13:24 +04:00
|
|
|
(u3k(raq),
|
|
|
|
u3nc(u3k(puq_vex),
|
|
|
|
u3k(puq_wag)))),
|
|
|
|
u3k(quq_wag));
|
|
|
|
u3z(wag);
|
|
|
|
}
|
|
|
|
u3z(vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
|
|
|
u3_cwe_stir_fun(u3_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun van, rud, raq, fel, tub;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
if ( (c3n == u3r_mean(cor, u3v_sam, &tub, u3v_con, &van, 0)) ||
|
|
|
|
(c3n == u3r_mean(van, u3v_sam_2, &rud,
|
|
|
|
u3v_sam_6, &raq,
|
|
|
|
u3v_sam_7, &fel,
|
2013-09-29 00:21:18 +04:00
|
|
|
0)) )
|
|
|
|
{
|
2014-11-06 03:20:01 +03:00
|
|
|
return u3m_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-09-03 09:46:55 +04:00
|
|
|
return _cqe_stir_fun(rud, raq, fel, tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|