2013-09-29 00:21:18 +04:00
|
|
|
/* j/5/parse.c
|
|
|
|
**
|
|
|
|
** This file is in the public domain.
|
|
|
|
*/
|
|
|
|
#include "all.h"
|
|
|
|
#include "../pit.h"
|
|
|
|
|
2014-09-04 01:33:18 +04:00
|
|
|
static u2_noun
|
2014-08-20 10:22:41 +04:00
|
|
|
_slip(
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun weq,
|
|
|
|
u2_noun naz)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun p_naz, q_naz;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(naz, &p_naz, &q_naz);
|
2013-09-29 00:21:18 +04:00
|
|
|
if ( 10 == weq ) {
|
2014-08-20 10:22:41 +04:00
|
|
|
return u2nc(u2_cx_good(
|
|
|
|
u2_ci_vint(u2k(p_naz))),
|
2013-09-29 00:21:18 +04:00
|
|
|
1);
|
|
|
|
} else {
|
2014-08-20 10:22:41 +04:00
|
|
|
return u2nc(u2k(p_naz),
|
|
|
|
u2_cx_good(
|
|
|
|
u2_ci_vint(u2k(q_naz))));
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-04 01:33:18 +04:00
|
|
|
static u2_noun
|
2014-08-20 10:22:41 +04:00
|
|
|
_fail(
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun tub)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun p_tub, q_tub;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(tub, &p_tub, &q_tub);
|
|
|
|
return u2nc(u2k(p_tub), u2_nul);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
|
2014-09-04 01:33:18 +04:00
|
|
|
static u2_noun
|
2014-08-20 10:22:41 +04:00
|
|
|
_last(
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun zyc,
|
|
|
|
u2_noun naz)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun p_zyc, q_zyc, p_naz, q_naz;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(zyc, &p_zyc, &q_zyc);
|
|
|
|
u2_cx_cell(naz, &p_naz, &q_naz);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( u2_ne(u2_co_is_cat(p_zyc)) || u2_ne(u2_co_is_cat(q_zyc)) ||
|
|
|
|
u2_ne(u2_co_is_cat(p_naz)) || u2_ne(u2_co_is_cat(q_naz)) )
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-08-20 10:22:41 +04:00
|
|
|
return u2_cm_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
|
|
|
if ( p_zyc == p_naz ) {
|
2014-08-20 10:22:41 +04:00
|
|
|
return (q_zyc > q_naz) ? u2k(zyc) : u2k(naz);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
else {
|
2014-08-20 10:22:41 +04:00
|
|
|
return (p_zyc > p_naz) ? u2k(zyc) : u2k(naz);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-04 01:33:18 +04:00
|
|
|
static u2_noun
|
2014-08-20 10:22:41 +04:00
|
|
|
_next(
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun tub)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun p_tub, q_tub;
|
|
|
|
u2_noun zac;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(tub, &p_tub, &q_tub);
|
|
|
|
if ( u2_no == u2du(q_tub) ) {
|
|
|
|
return _fail(tub);
|
2014-04-22 05:22:11 +04:00
|
|
|
}
|
2013-09-29 00:21:18 +04:00
|
|
|
else {
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_noun iq_tub = u2h(q_tub);
|
|
|
|
u2_noun tq_tub = u2t(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-08-20 10:22:41 +04:00
|
|
|
return u2nc
|
|
|
|
(zac,
|
|
|
|
u2nq(u2_nul,
|
|
|
|
u2k(iq_tub),
|
|
|
|
u2k(zac),
|
|
|
|
u2k(tq_tub)));
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* bend
|
|
|
|
*/
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun
|
|
|
|
_cqe_bend_fun(u2_noun raq,
|
|
|
|
u2_noun vex,
|
|
|
|
u2_noun sab)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun p_vex, q_vex;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(vex, &p_vex, &q_vex);
|
|
|
|
if ( u2_no == u2du(q_vex) ) {
|
|
|
|
return u2k(vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_noun uq_vex = u2t(q_vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_noun puq_vex, quq_vex;
|
|
|
|
u2_noun yit, yur;
|
|
|
|
u2_noun p_yit, q_yit;
|
|
|
|
u2_noun ret;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(uq_vex, &puq_vex, &quq_vex);
|
|
|
|
yit = u2_cx_good(u2_cn_slam_on(u2k(sab), u2k(quq_vex)));
|
2014-04-22 05:22:11 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(yit, &p_yit, &q_yit);
|
|
|
|
yur = _last(p_vex, p_yit);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( u2_no == u2du(q_yit) ) {
|
|
|
|
ret = u2nc(yur, u2k(q_vex));
|
2014-04-22 05:22:11 +04:00
|
|
|
}
|
2013-09-29 00:21:18 +04:00
|
|
|
else {
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_noun uq_yit = u2t(q_yit);
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_noun puq_yit, quq_yit;
|
|
|
|
u2_noun vux;
|
2014-04-22 05:22:11 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(uq_yit, &puq_yit, &quq_yit);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
vux = u2_cx_good
|
|
|
|
(u2_cn_slam_on
|
|
|
|
(u2k(raq),
|
|
|
|
u2nc(u2k(puq_vex),
|
|
|
|
u2k(puq_yit))));
|
2013-09-29 00:21:18 +04:00
|
|
|
if ( u2_nul == vux ) {
|
2014-08-20 10:22:41 +04:00
|
|
|
ret = u2nc(yur, u2k(q_vex));
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
else {
|
2014-08-20 10:22:41 +04:00
|
|
|
ret = u2nq(yur,
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_nul,
|
|
|
|
u2k(u2t(vux)),
|
2014-08-20 10:22:41 +04:00
|
|
|
u2k(quq_yit));
|
2013-09-29 00:21:18 +04:00
|
|
|
u2z(vux);
|
|
|
|
}
|
|
|
|
}
|
2014-08-20 10:22:41 +04:00
|
|
|
u2z(yit);
|
2013-09-29 00:21:18 +04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun
|
|
|
|
u2_cwe_bend_fun(u2_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun van, raq, vex, sab;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( (u2_no == u2_cr_mean(cor, u2_cv_sam_2, &vex,
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_cv_sam_3, &sab,
|
|
|
|
u2_cv_con, &van, 0)) ||
|
2014-08-20 10:22:41 +04:00
|
|
|
(u2_none == (raq = u2_cr_at(u2_cv_sam, van))) )
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-08-20 10:22:41 +04:00
|
|
|
return u2_cm_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-04 01:33:18 +04:00
|
|
|
u2_noun
|
2014-09-03 09:46:55 +04:00
|
|
|
_cqe_cold_fun(
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun cus,
|
|
|
|
u2_noun sef,
|
|
|
|
u2_noun tub)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_noun vex = u2_cx_good(u2_cn_slam_on(u2k(sef), u2k(tub)));
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_noun p_vex, q_vex;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(vex, &p_vex, &q_vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( u2_no == u2du(q_vex) ) {
|
2013-09-29 00:21:18 +04:00
|
|
|
return vex;
|
|
|
|
}
|
|
|
|
else {
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_noun uq_vex = u2t(q_vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_noun quq_vex;
|
|
|
|
u2_noun ret;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(uq_vex, 0, &quq_vex);
|
|
|
|
ret = u2nq(u2k(p_vex),
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_nul,
|
2014-08-20 10:22:41 +04:00
|
|
|
u2k(cus),
|
|
|
|
u2k(quq_vex));
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2z(vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun
|
|
|
|
u2_cwe_cold_fun(
|
|
|
|
u2_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun van, cus, sef, tub;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( (u2_no == u2_cr_mean(cor, u2_cv_sam, &tub, u2_cv_con, &van, 0)) ||
|
|
|
|
(u2_no == u2_cr_mean(van, u2_cv_sam_2, &cus, u2_cv_sam_3, &sef, 0)) )
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-08-20 10:22:41 +04:00
|
|
|
return u2_cm_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-04 01:33:18 +04:00
|
|
|
u2_noun
|
2014-09-03 09:46:55 +04:00
|
|
|
_cqe_cook_fun(
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun poq,
|
|
|
|
u2_noun sef,
|
|
|
|
u2_noun tub)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_noun vex = u2_cx_good(u2_cn_slam_on(u2k(sef), u2k(tub)));
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_noun p_vex, q_vex;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(vex, &p_vex, &q_vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( u2_no == u2du(q_vex) ) {
|
2013-09-29 00:21:18 +04:00
|
|
|
return vex;
|
|
|
|
}
|
|
|
|
else {
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_noun uq_vex = u2t(q_vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_noun puq_vex, quq_vex;
|
|
|
|
u2_noun wag;
|
|
|
|
u2_noun ret;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(uq_vex, &puq_vex, &quq_vex);
|
|
|
|
wag = u2_cx_good(u2_cn_slam_on(u2k(poq), u2k(puq_vex)));
|
|
|
|
ret = u2nq(u2k(p_vex),
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_nul,
|
|
|
|
wag,
|
2014-08-20 10:22:41 +04:00
|
|
|
u2k(quq_vex));
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2z(vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun
|
|
|
|
u2_cwe_cook_fun(
|
|
|
|
u2_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun van, poq, sef, tub;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( (u2_no == u2_cr_mean(cor, u2_cv_sam, &tub, u2_cv_con, &van, 0)) ||
|
|
|
|
(u2_no == u2_cr_mean(van, u2_cv_sam_2, &poq, u2_cv_sam_3, &sef, 0)) )
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-08-20 10:22:41 +04:00
|
|
|
return u2_cm_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-04 01:33:18 +04:00
|
|
|
u2_noun
|
2014-09-03 09:46:55 +04:00
|
|
|
_cqe_comp_fun(
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun raq,
|
|
|
|
u2_noun vex,
|
|
|
|
u2_noun sab)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun p_vex, q_vex;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(vex, &p_vex, &q_vex);
|
|
|
|
if ( u2_no == u2du(q_vex) ) {
|
|
|
|
return u2k(vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_noun uq_vex = u2t(q_vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_noun puq_vex, quq_vex;
|
|
|
|
u2_noun yit, yur;
|
|
|
|
u2_noun p_yit, q_yit;
|
|
|
|
u2_noun ret;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(uq_vex, &puq_vex, &quq_vex);
|
|
|
|
yit = u2_cx_good(u2_cn_slam_on(u2k(sab), u2k(quq_vex)));
|
2014-04-22 05:22:11 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(yit, &p_yit, &q_yit);
|
|
|
|
yur = _last(p_vex, p_yit);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( u2_no == u2du(q_yit) ) {
|
|
|
|
ret = u2nc(yur, u2k(q_yit));
|
2014-04-22 05:22:11 +04:00
|
|
|
}
|
2013-09-29 00:21:18 +04:00
|
|
|
else {
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_noun uq_yit = u2t(q_yit);
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_noun puq_yit, quq_yit;
|
2014-04-22 05:22:11 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(uq_yit, &puq_yit, &quq_yit);
|
|
|
|
ret = u2nq(yur,
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_nul,
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_good
|
|
|
|
(
|
|
|
|
u2_cn_slam_on
|
|
|
|
(u2k(raq),
|
|
|
|
u2nc(u2k(puq_vex),
|
|
|
|
u2k(puq_yit)))),
|
|
|
|
u2k(quq_yit));
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
2014-08-20 10:22:41 +04:00
|
|
|
u2z(yit);
|
2013-09-29 00:21:18 +04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun
|
|
|
|
u2_cwe_comp_fun(
|
|
|
|
u2_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun van, raq, vex, sab;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( (u2_no == u2_cr_mean(cor, u2_cv_sam_2, &vex,
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_cv_sam_3, &sab,
|
|
|
|
u2_cv_con, &van, 0)) ||
|
2014-08-20 10:22:41 +04:00
|
|
|
(u2_none == (raq = u2_cr_at(u2_cv_sam, van))) )
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-08-20 10:22:41 +04:00
|
|
|
return u2_cm_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-04 01:33:18 +04:00
|
|
|
u2_noun
|
2014-09-03 09:46:55 +04:00
|
|
|
_cqe_easy_fun(
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun huf,
|
|
|
|
u2_noun tub)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun p_tub, q_tub;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(tub, &p_tub, &q_tub);
|
|
|
|
return u2nq(u2k(p_tub),
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_nul,
|
2014-08-20 10:22:41 +04:00
|
|
|
u2k(huf),
|
|
|
|
u2k(tub));
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun
|
|
|
|
u2_cwe_easy_fun(
|
|
|
|
u2_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun van, huf, tub;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( (u2_no == u2_cr_mean(cor, u2_cv_sam, &tub, u2_cv_con, &van, 0)) ||
|
|
|
|
(u2_none == (huf = u2_cr_at(u2_cv_sam, van))) )
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-08-20 10:22:41 +04:00
|
|
|
return u2_cm_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-04 01:33:18 +04:00
|
|
|
u2_noun
|
2014-09-03 09:46:55 +04:00
|
|
|
_cqe_glue_fun(
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun bus,
|
|
|
|
u2_noun vex,
|
|
|
|
u2_noun sab)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun p_vex, q_vex;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(vex, &p_vex, &q_vex);
|
|
|
|
if ( u2_no == u2du(q_vex) ) {
|
|
|
|
return u2k(vex);
|
2014-04-22 05:22:11 +04:00
|
|
|
}
|
2013-09-29 00:21:18 +04:00
|
|
|
else {
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_noun uq_vex = u2t(q_vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_noun puq_vex, quq_vex;
|
|
|
|
u2_noun yit, yur;
|
|
|
|
u2_noun p_yit, q_yit;
|
|
|
|
u2_noun ret;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(uq_vex, &puq_vex, &quq_vex);
|
|
|
|
yit = u2_cx_good(u2_cn_slam_on(u2k(bus), u2k(quq_vex)));
|
2014-04-22 05:22:11 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(yit, &p_yit, &q_yit);
|
|
|
|
yur = _last(p_vex, p_yit);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( u2_no == u2du(q_yit) ) {
|
|
|
|
ret = u2nc(yur, u2_nul);
|
2014-04-22 05:22:11 +04:00
|
|
|
}
|
2013-09-29 00:21:18 +04:00
|
|
|
else {
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_noun uq_yit = u2t(q_yit);
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_noun puq_yit, quq_yit;
|
|
|
|
u2_noun wam, p_wam, q_wam, goy;
|
2014-04-22 05:22:11 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(uq_yit, &puq_yit, &quq_yit);
|
|
|
|
wam = u2_cx_good(u2_cn_slam_on(u2k(sab), u2k(quq_yit)));
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(wam, &p_wam, &q_wam);
|
|
|
|
goy = _last(yur, p_wam);
|
|
|
|
u2z(yur);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( u2_no == u2du(q_wam) ) {
|
|
|
|
ret = u2nc(goy, u2_nul);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_noun uq_wam = u2t(q_wam);
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_noun puq_wam, quq_wam;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(uq_wam, &puq_wam, &quq_wam);
|
|
|
|
ret = u2nq(goy,
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_nul,
|
2014-08-20 10:22:41 +04:00
|
|
|
u2nc(u2k(puq_vex),
|
|
|
|
u2k(puq_wam)),
|
|
|
|
u2k(quq_wam));
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
2014-08-20 10:22:41 +04:00
|
|
|
u2z(wam);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
2014-08-20 10:22:41 +04:00
|
|
|
u2z(yit);
|
2013-09-29 00:21:18 +04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun
|
|
|
|
u2_cwe_glue_fun(
|
|
|
|
u2_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun van, bus, vex, sab;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( (u2_no == u2_cr_mean(cor, u2_cv_sam_2, &vex,
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_cv_sam_3, &sab,
|
|
|
|
u2_cv_con, &van, 0)) ||
|
2014-08-20 10:22:41 +04:00
|
|
|
(u2_none == (bus = u2_cr_at(u2_cv_sam, van))) )
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-08-20 10:22:41 +04:00
|
|
|
return u2_cm_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-04 01:33:18 +04:00
|
|
|
u2_noun
|
2014-09-03 09:46:55 +04:00
|
|
|
_cqe_here_fun(
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun hez,
|
|
|
|
u2_noun sef,
|
|
|
|
u2_noun tub)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_noun vex = u2_cx_good(u2_cn_slam_on(u2k(sef), u2k(tub)));
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_noun p_vex, q_vex;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(vex, &p_vex, &q_vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( u2_no == u2du(q_vex) ) {
|
2013-09-29 00:21:18 +04:00
|
|
|
return vex;
|
|
|
|
}
|
|
|
|
else {
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_noun uq_vex = u2t(q_vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_noun p_tub, q_tub;
|
|
|
|
u2_noun puq_vex, quq_vex, pquq_vex;
|
|
|
|
u2_noun gud, wag;
|
|
|
|
u2_noun ret;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(tub, &p_tub, &q_tub);
|
|
|
|
u2_cx_cell(uq_vex, &puq_vex, &quq_vex);
|
|
|
|
u2_cx_cell(quq_vex, &pquq_vex, 0);
|
|
|
|
gud = u2nc(
|
|
|
|
u2nc(u2k(p_tub),
|
|
|
|
u2k(pquq_vex)),
|
|
|
|
u2k(puq_vex));
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
wag = u2_cx_good(u2_cn_slam_on(u2k(hez), gud));
|
|
|
|
ret = u2nq(u2k(p_vex),
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_nul,
|
|
|
|
wag,
|
2014-08-20 10:22:41 +04:00
|
|
|
u2k(quq_vex));
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2z(vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun
|
|
|
|
u2_cwe_here_fun(
|
|
|
|
u2_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun van, hez, sef, tub;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( (u2_no == u2_cr_mean(cor, u2_cv_sam, &tub, u2_cv_con, &van, 0)) ||
|
|
|
|
(u2_no == u2_cr_mean(van, u2_cv_sam_2, &hez, u2_cv_sam_3, &sef, 0)) )
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-08-20 10:22:41 +04:00
|
|
|
return u2_cm_bail(c3__fail);
|
2013-09-29 00:21:18 +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-04 01:33:18 +04:00
|
|
|
u2_noun
|
2014-09-03 09:46:55 +04:00
|
|
|
_cqe_just_fun(
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun daf,
|
|
|
|
u2_noun tub)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun p_tub, q_tub;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(tub, &p_tub, &q_tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( u2_no == u2du(q_tub) ) {
|
|
|
|
return _fail(tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
else {
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_noun iq_tub = u2h(q_tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( u2_yes == u2_cr_sing(daf, iq_tub) ) {
|
|
|
|
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-04 01:33:18 +04:00
|
|
|
u2_noun
|
|
|
|
u2_cwe_just_fun(
|
|
|
|
u2_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun van, daf, tub;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( (u2_no == u2_cr_mean(cor, u2_cv_sam, &tub, u2_cv_con, &van, 0)) ||
|
|
|
|
(u2_none == (daf = u2_cr_at(u2_cv_sam, van))) )
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-08-20 10:22:41 +04:00
|
|
|
return u2_cm_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-04 01:33:18 +04:00
|
|
|
u2_noun
|
2014-09-03 09:46:55 +04:00
|
|
|
_cqe_mask_fun(
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun bud,
|
|
|
|
u2_noun tub)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun p_tub, q_tub;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(tub, &p_tub, &q_tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( u2_no == u2du(q_tub) ) {
|
|
|
|
return _fail(tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
else {
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_noun iq_tub = u2h(q_tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
while ( u2_yes == u2du(bud) ) {
|
|
|
|
if ( u2_yes == u2_cr_sing(u2h(bud), iq_tub) ) {
|
|
|
|
return _next(tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
2014-08-20 10:22:41 +04:00
|
|
|
bud = u2t(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-04 01:33:18 +04:00
|
|
|
u2_noun
|
|
|
|
u2_cwe_mask_fun(
|
|
|
|
u2_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun van, bud, tub;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( (u2_no == u2_cr_mean(cor, u2_cv_sam, &tub, u2_cv_con, &van, 0)) ||
|
|
|
|
(u2_none == (bud = u2_cr_at(u2_cv_sam, van))) )
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-08-20 10:22:41 +04:00
|
|
|
return u2_cm_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-04 01:33:18 +04:00
|
|
|
u2_noun
|
|
|
|
_cqe_pfix(
|
|
|
|
u2_noun vex,
|
|
|
|
u2_noun sab)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun p_vex, q_vex;
|
2014-04-22 05:22:11 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(vex, &p_vex, &q_vex);
|
|
|
|
if ( u2_no == u2du(q_vex) ) {
|
|
|
|
return u2k(vex);
|
2014-04-22 05:22:11 +04:00
|
|
|
}
|
2013-09-29 00:21:18 +04:00
|
|
|
else {
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_noun uq_vex = u2t(q_vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_noun puq_vex, quq_vex;
|
|
|
|
u2_noun yit, p_yit, q_yit;
|
|
|
|
u2_noun ret;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(uq_vex, &puq_vex, &quq_vex);
|
|
|
|
yit = u2_cx_good(u2_cn_slam_on(u2k(sab), u2k(quq_vex)));
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(yit, &p_yit, &q_yit);
|
|
|
|
ret = u2nc
|
|
|
|
(
|
|
|
|
_last(p_vex, p_yit),
|
|
|
|
u2k(q_yit));
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2z(yit);
|
2013-09-29 00:21:18 +04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun
|
|
|
|
u2_cwe_pfix(
|
|
|
|
u2_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun vex, sab;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( (u2_no == u2_cr_mean(cor, u2_cv_sam_2, &vex, u2_cv_sam_3, &sab, 0)) ) {
|
|
|
|
return u2_cm_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-04 01:33:18 +04:00
|
|
|
u2_noun
|
|
|
|
_cqe_plug(
|
|
|
|
u2_noun vex,
|
|
|
|
u2_noun sab)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun p_vex, q_vex;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(vex, &p_vex, &q_vex);
|
|
|
|
if ( u2_no == u2du(q_vex) ) {
|
|
|
|
return u2k(vex);
|
2014-04-22 05:22:11 +04:00
|
|
|
}
|
2013-09-29 00:21:18 +04:00
|
|
|
else {
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_noun uq_vex = u2t(q_vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_noun puq_vex, quq_vex;
|
|
|
|
u2_noun yit, yur;
|
|
|
|
u2_noun p_yit, q_yit;
|
|
|
|
u2_noun ret;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(uq_vex, &puq_vex, &quq_vex);
|
|
|
|
yit = u2_cx_good(u2_cn_slam_on(u2k(sab), u2k(quq_vex)));
|
2014-04-22 05:22:11 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(yit, &p_yit, &q_yit);
|
|
|
|
yur = _last(p_vex, p_yit);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( u2_no == u2du(q_yit) ) {
|
|
|
|
ret = u2nc(yur, u2k(q_yit));
|
2014-04-22 05:22:11 +04:00
|
|
|
}
|
2013-09-29 00:21:18 +04:00
|
|
|
else {
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_noun uq_yit = u2t(q_yit);
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_noun puq_yit, quq_yit;
|
2014-04-22 05:22:11 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(uq_yit, &puq_yit, &quq_yit);
|
|
|
|
ret = u2nq(yur,
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_nul,
|
2014-08-20 10:22:41 +04:00
|
|
|
u2nc(u2k(puq_vex),
|
|
|
|
u2k(puq_yit)),
|
|
|
|
u2k(quq_yit));
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
2014-08-20 10:22:41 +04:00
|
|
|
u2z(yit);
|
2013-09-29 00:21:18 +04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun
|
|
|
|
u2_cwe_plug(
|
|
|
|
u2_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun vex, sab;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( (u2_no == u2_cr_mean(cor, u2_cv_sam_2, &vex, u2_cv_sam_3, &sab, 0)) ) {
|
|
|
|
return u2_cm_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-04 01:33:18 +04:00
|
|
|
u2_noun
|
|
|
|
u2_cqe_pose(u2_noun vex,
|
|
|
|
u2_noun sab)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun p_vex, q_vex;
|
2014-04-22 05:22:11 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(vex, &p_vex, &q_vex);
|
|
|
|
if ( u2_yes == u2du(q_vex) ) {
|
|
|
|
return u2k(vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_noun roq = u2_cx_good(u2_cn_kick_on(u2k(sab)));
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_noun p_roq, q_roq;
|
|
|
|
u2_noun ret;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(roq, &p_roq, &q_roq);
|
|
|
|
ret = u2nc
|
|
|
|
(
|
|
|
|
_last(p_vex, p_roq),
|
|
|
|
u2k(q_roq));
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2z(roq);
|
2013-09-29 00:21:18 +04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun
|
|
|
|
u2_cwe_pose(
|
|
|
|
u2_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun vex, sab;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( (u2_no == u2_cr_mean(cor, u2_cv_sam_2, &vex, u2_cv_sam_3, &sab, 0)) ) {
|
|
|
|
return u2_cm_bail(c3__exit);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-09-04 01:33:18 +04:00
|
|
|
return u2_cqe_pose(vex, sab);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* sfix
|
|
|
|
*/
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun
|
|
|
|
_cqe_sfix(u2_noun vex, u2_noun sab)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun p_vex, q_vex;
|
2014-04-22 05:22:11 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(vex, &p_vex, &q_vex);
|
|
|
|
if ( u2_no == u2du(q_vex) ) {
|
|
|
|
return u2k(vex);
|
2014-04-22 05:22:11 +04:00
|
|
|
}
|
2013-09-29 00:21:18 +04:00
|
|
|
else {
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_noun uq_vex = u2t(q_vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_noun puq_vex, quq_vex;
|
|
|
|
u2_noun yit, p_yit, q_yit, yur;
|
|
|
|
u2_noun ret;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(uq_vex, &puq_vex, &quq_vex);
|
|
|
|
yit = u2_cx_good(u2_cn_slam_on(u2k(sab), u2k(quq_vex)));
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(yit, &p_yit, &q_yit);
|
|
|
|
yur = _last(p_vex, p_yit);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( u2_no == u2du(q_yit) ) {
|
|
|
|
ret = u2nc(yur, u2_nul);
|
2014-04-22 05:22:11 +04:00
|
|
|
}
|
2013-09-29 00:21:18 +04:00
|
|
|
else {
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_noun uq_yit = u2t(q_yit);
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_noun puq_yit, quq_yit;
|
2014-04-22 05:22:11 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(uq_yit, &puq_yit, &quq_yit);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
ret = u2nq(yur,
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_nul,
|
2014-08-20 10:22:41 +04:00
|
|
|
u2k(puq_vex),
|
|
|
|
u2k(quq_yit));
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
2014-08-20 10:22:41 +04:00
|
|
|
u2z(yit);
|
2013-09-29 00:21:18 +04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun
|
|
|
|
u2_cwe_sfix(u2_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun vex, sab;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( (u2_no == u2_cr_mean(cor, u2_cv_sam_2, &vex, u2_cv_sam_3, &sab, 0)) ) {
|
|
|
|
return u2_cm_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-04 01:33:18 +04:00
|
|
|
u2_noun
|
|
|
|
_cqe_shim_fun(u2_noun zep,
|
|
|
|
u2_noun tub)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun p_tub, q_tub;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(tub, &p_tub, &q_tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( u2_no == u2du(q_tub) ) {
|
|
|
|
return _fail(tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
u2_noun p_zep, q_zep;
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_noun iq_tub = u2h(q_tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(zep, &p_zep, &q_zep);
|
|
|
|
if ( u2_so(u2_co_is_cat(p_zep)) &&
|
|
|
|
u2_so(u2_co_is_cat(q_zep)) &&
|
|
|
|
u2_so(u2_co_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-08-20 10:22:41 +04:00
|
|
|
return u2_cm_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun
|
|
|
|
u2_cwe_shim_fun(
|
|
|
|
u2_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun van, zep, tub;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( (u2_no == u2_cr_mean(cor, u2_cv_sam, &tub, u2_cv_con, &van, 0)) ||
|
|
|
|
(u2_none == (zep = u2_cr_at(u2_cv_sam, van))) )
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-08-20 10:22:41 +04:00
|
|
|
return u2_cm_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-04 01:33:18 +04:00
|
|
|
u2_noun
|
2014-09-03 09:46:55 +04:00
|
|
|
_cqe_stag_fun(
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun gob,
|
|
|
|
u2_noun sef,
|
|
|
|
u2_noun tub)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_noun vex = u2_cx_good(u2_cn_slam_on(u2k(sef), u2k(tub)));
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_noun p_vex, q_vex;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(vex, &p_vex, &q_vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( u2_no == u2du(q_vex) ) {
|
2013-09-29 00:21:18 +04:00
|
|
|
return vex;
|
|
|
|
}
|
|
|
|
else {
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_noun uq_vex = u2t(q_vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_noun puq_vex, quq_vex;
|
|
|
|
u2_noun wag;
|
|
|
|
u2_noun ret;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(uq_vex, &puq_vex, &quq_vex);
|
|
|
|
wag = u2nc(u2k(gob), u2k(puq_vex));
|
|
|
|
ret = u2nq(u2k(p_vex),
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_nul,
|
|
|
|
wag,
|
2014-08-20 10:22:41 +04:00
|
|
|
u2k(quq_vex));
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2z(vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun
|
|
|
|
u2_cwe_stag_fun(
|
|
|
|
u2_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun van, gob, sef, tub;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( (u2_no == u2_cr_mean(cor, u2_cv_sam, &tub, u2_cv_con, &van, 0)) ||
|
|
|
|
(u2_no == u2_cr_mean(van, u2_cv_sam_2, &gob, u2_cv_sam_3, &sef, 0)) )
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-08-20 10:22:41 +04:00
|
|
|
return u2_cm_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
|
|
|
|
*/
|
|
|
|
static u2_bean
|
2014-08-20 10:22:41 +04:00
|
|
|
_stew_wor(
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_noun ort,
|
|
|
|
u2_noun wan)
|
|
|
|
{
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( u2_ne(u2_co_is_cat(ort)) ) {
|
|
|
|
return u2_cm_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
else {
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( u2_no == u2du(wan) ) {
|
|
|
|
if ( u2_ne(u2_co_is_cat(wan)) ) {
|
|
|
|
return u2_cm_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
else return (ort < wan) ? u2_yes : u2_no;
|
|
|
|
}
|
|
|
|
else {
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_noun h_wan = u2h(wan);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( u2_ne(u2_co_is_cat(h_wan)) ) {
|
|
|
|
return u2_cm_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
else return (ort < h_wan) ? u2_yes : u2_no;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun
|
2014-09-03 09:46:55 +04:00
|
|
|
_cqe_stew_fun(
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun hel,
|
|
|
|
u2_noun tub)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun p_tub, q_tub;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(tub, &p_tub, &q_tub);
|
|
|
|
if ( u2_no == u2du(q_tub) ) {
|
|
|
|
return _fail(tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
else {
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_noun iq_tub = u2h(q_tub);
|
|
|
|
|
|
|
|
if ( u2_ne(u2_co_is_cat(iq_tub)) ) {
|
|
|
|
return u2_cm_bail(c3__fail);
|
2014-09-04 01:33:18 +04:00
|
|
|
}
|
2014-08-20 10:22:41 +04:00
|
|
|
else while ( 1 ) {
|
|
|
|
if ( u2_no == u2du(hel) ) {
|
|
|
|
return _fail(tub);
|
2014-04-22 05:22:11 +04:00
|
|
|
}
|
2013-09-29 00:21:18 +04:00
|
|
|
else {
|
|
|
|
u2_noun n_hel, l_hel, r_hel;
|
|
|
|
u2_noun pn_hel, qn_hel;
|
|
|
|
c3_t bit_t;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_trel(hel, &n_hel, &l_hel, &r_hel);
|
|
|
|
u2_cx_cell(n_hel, &pn_hel, &qn_hel);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( (u2_no == u2du(pn_hel)) ) {
|
2013-09-29 00:21:18 +04:00
|
|
|
bit_t = (iq_tub == pn_hel);
|
|
|
|
}
|
|
|
|
else {
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_noun hpn_hel = u2h(pn_hel);
|
|
|
|
u2_noun tpn_hel = u2t(pn_hel);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-09-04 01:33:18 +04:00
|
|
|
if ( u2_ne(u2_co_is_cat(hpn_hel)) ||
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_ne(u2_co_is_cat(tpn_hel)) ) {
|
|
|
|
return _fail(tub);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
else bit_t = (iq_tub >= hpn_hel) && (iq_tub <= tpn_hel);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( bit_t ) {
|
2014-08-20 10:22:41 +04:00
|
|
|
return u2_cx_good
|
|
|
|
(u2_cn_slam_on(u2k(qn_hel), u2k(tub)));
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( u2_yes == _stew_wor(iq_tub, pn_hel) ) {
|
2013-09-29 00:21:18 +04:00
|
|
|
hel = l_hel;
|
|
|
|
}
|
|
|
|
else hel = r_hel;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun
|
|
|
|
u2_cwe_stew_fun(
|
|
|
|
u2_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun con, hel, tub;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( (u2_no == u2_cr_mean(cor, u2_cv_sam, &tub, u2_cv_con, &con, 0)) ||
|
|
|
|
(u2_none == (hel = u2_cr_at(2, con))) )
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-08-20 10:22:41 +04:00
|
|
|
return u2_cm_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-04 01:33:18 +04:00
|
|
|
u2_noun
|
|
|
|
_cqe_stir_fun(u2_noun rud,
|
|
|
|
u2_noun raq,
|
|
|
|
u2_noun fel,
|
|
|
|
u2_noun tub)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_noun vex = u2_cx_good(u2_cn_slam_on(u2k(fel), u2k(tub)));
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_noun p_vex, q_vex;
|
|
|
|
u2_noun ret;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(vex, &p_vex, &q_vex);
|
|
|
|
if ( u2_no == u2du(q_vex) ) {
|
|
|
|
ret = u2nq(u2k(p_vex),
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_nul,
|
2014-08-20 10:22:41 +04:00
|
|
|
u2k(rud),
|
|
|
|
u2k(tub));
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
else {
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_noun uq_vex = u2t(q_vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_noun puq_vex, quq_vex;
|
|
|
|
u2_noun wag, p_wag, q_wag, uq_wag, puq_wag, quq_wag;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_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-08-20 10:22:41 +04:00
|
|
|
u2_cx_cell(wag, &p_wag, &q_wag);
|
|
|
|
if ( u2_no == u2du(q_wag) ) {
|
|
|
|
return u2_cm_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
2014-08-20 10:22:41 +04:00
|
|
|
uq_wag = u2t(q_wag);
|
|
|
|
u2_cx_cell(uq_wag, &puq_wag, &quq_wag);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
ret = u2nq
|
|
|
|
(_last(p_vex, p_wag),
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_nul,
|
2014-08-20 10:22:41 +04:00
|
|
|
u2_cx_good(u2_cn_slam_on
|
|
|
|
(u2k(raq),
|
|
|
|
u2nc(u2k(puq_vex),
|
|
|
|
u2k(puq_wag)))),
|
|
|
|
u2k(quq_wag));
|
|
|
|
u2z(wag);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
2014-08-20 10:22:41 +04:00
|
|
|
u2z(vex);
|
2013-09-29 00:21:18 +04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun
|
|
|
|
u2_cwe_stir_fun(u2_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun van, rud, raq, fel, tub;
|
|
|
|
|
2014-08-20 10:22:41 +04:00
|
|
|
if ( (u2_no == u2_cr_mean(cor, u2_cv_sam, &tub, u2_cv_con, &van, 0)) ||
|
|
|
|
(u2_no == u2_cr_mean(van, u2_cv_sam_2, &rud,
|
2014-04-22 05:22:11 +04:00
|
|
|
u2_cv_sam_6, &raq,
|
|
|
|
u2_cv_sam_7, &fel,
|
2013-09-29 00:21:18 +04:00
|
|
|
0)) )
|
|
|
|
{
|
2014-08-20 10:22:41 +04:00
|
|
|
return u2_cm_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
|
|
|
}
|
|
|
|
}
|