2013-12-18 05:47:20 +04:00
|
|
|
/* j/6/ut_conk.c
|
|
|
|
**
|
|
|
|
** This file is in the public domain.
|
|
|
|
*/
|
|
|
|
#include "all.h"
|
|
|
|
#include "../pit.h"
|
|
|
|
|
|
|
|
/* logic
|
|
|
|
*/
|
|
|
|
u2_bean // transfer
|
2014-08-21 01:18:34 +04:00
|
|
|
j2_mcx(Pt6, ut, conk)(
|
2013-12-18 05:47:20 +04:00
|
|
|
u2_noun van, // retain
|
|
|
|
u2_noun sut, // retain
|
|
|
|
u2_noun got) // retain
|
2013-12-21 02:26:23 +04:00
|
|
|
{
|
|
|
|
if ( u2_yes == u2ud(got) ) {
|
2014-08-21 01:18:34 +04:00
|
|
|
return j2_mby(Pt6, face)(got, sut);
|
2013-12-21 02:26:23 +04:00
|
|
|
}
|
|
|
|
else switch ( u2h(got) ) {
|
|
|
|
default: return u2_cm_bail(c3__fail);
|
|
|
|
|
|
|
|
case 0: {
|
|
|
|
return u2k(sut);
|
|
|
|
}
|
|
|
|
case 1: {
|
|
|
|
return j2_mby(Pt6, face)
|
2014-08-21 01:18:34 +04:00
|
|
|
(u2h(u2t(got)),
|
|
|
|
j2_mcx(Pt6, ut, conk)(van, sut, u2t(u2t(got))));
|
2013-12-21 02:26:23 +04:00
|
|
|
}
|
|
|
|
case 2: {
|
2014-08-21 01:18:34 +04:00
|
|
|
u2_bean vet = u2_cr_at(j2_ut_van_vet, van);
|
2013-12-21 02:26:23 +04:00
|
|
|
u2_noun hed, tal, ret;
|
|
|
|
|
|
|
|
if ( u2_yes == vet ) {
|
|
|
|
u2_noun cel = u2nt(c3__cell, c3__noun, c3__noun);
|
2014-04-22 05:22:11 +04:00
|
|
|
|
2014-08-21 01:18:34 +04:00
|
|
|
if ( u2_no == j2_mcy(Pt6, ut, nest)(van, cel, u2_yes, sut) ) {
|
|
|
|
return u2_cm_bail(c3__fail);
|
2013-12-21 02:26:23 +04:00
|
|
|
}
|
|
|
|
u2z(cel);
|
|
|
|
}
|
2014-08-21 01:18:34 +04:00
|
|
|
hed = j2_mcy(Pt6, ut, peek)(van, sut, c3__both, 2);
|
|
|
|
tal = j2_mcy(Pt6, ut, peek)(van, sut, c3__both, 3);
|
2013-12-21 02:26:23 +04:00
|
|
|
|
|
|
|
ret = j2_mby(Pt6, cell)
|
2014-08-21 01:18:34 +04:00
|
|
|
(
|
|
|
|
j2_mcx(Pt6, ut, conk)(van, hed, u2h(u2t(got))),
|
|
|
|
j2_mcx(Pt6, ut, conk)(van, tal, u2t(u2t(got))));
|
2013-12-21 02:26:23 +04:00
|
|
|
|
|
|
|
u2z(hed);
|
|
|
|
u2z(tal);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-18 05:47:20 +04:00
|
|
|
/* boilerplate
|
|
|
|
*/
|
2014-04-22 05:22:11 +04:00
|
|
|
u2_ho_jet
|
2013-12-18 05:47:20 +04:00
|
|
|
j2_mcj(Pt6, ut, conk)[];
|
|
|
|
|
|
|
|
u2_noun // transfer
|
2014-08-28 23:40:40 +04:00
|
|
|
j2_mc(Pt6, ut, conk)(u2_noun cor) // retain
|
2013-12-18 05:47:20 +04:00
|
|
|
{
|
|
|
|
u2_noun sut, got, van;
|
|
|
|
|
2014-08-21 01:18:34 +04:00
|
|
|
if ( (u2_no == u2_cr_mean(cor, u2_cv_sam, &got,
|
2014-04-22 05:22:11 +04:00
|
|
|
u2_cv_con, &van,
|
2013-12-18 05:47:20 +04:00
|
|
|
0)) ||
|
2014-08-21 01:18:34 +04:00
|
|
|
(u2_none == (sut = u2_cr_at(u2_cv_sam, van))) )
|
2013-12-18 05:47:20 +04:00
|
|
|
{
|
2014-08-21 01:18:34 +04:00
|
|
|
return u2_cm_bail(c3__fail);
|
2013-12-18 05:47:20 +04:00
|
|
|
} else {
|
2014-08-21 01:18:34 +04:00
|
|
|
return j2_mcx(Pt6, ut, conk)(van, sut, got);
|
2013-12-18 05:47:20 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
u2_noun // transfer
|
2014-08-28 23:40:40 +04:00
|
|
|
j2_mcy(Pt6, ut, conk)(u2_noun van, // retain
|
2013-12-18 05:47:20 +04:00
|
|
|
u2_noun sut, // retain
|
|
|
|
u2_noun got) // retain
|
|
|
|
{
|
2014-08-28 23:40:40 +04:00
|
|
|
return j2_mcx(Pt6, ut, conk)(van, sut, got);
|
2013-12-18 05:47:20 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* structures
|
|
|
|
*/
|
2014-04-22 05:22:11 +04:00
|
|
|
u2_ho_jet
|
2013-12-18 05:47:20 +04:00
|
|
|
j2_mcj(Pt6, ut, conk)[] = {
|
|
|
|
{ ".2", c3__hevy, j2_mc(Pt6, ut, conk), Tier6_b, u2_none, u2_none },
|
|
|
|
{ }
|
|
|
|
};
|
2013-12-21 02:26:23 +04:00
|
|
|
|