urbit/gen164/6/ut_busk.c

84 lines
2.3 KiB
C
Raw Normal View History

2014-01-04 06:59:56 +04:00
/* j/6/ut_busk.c
**
** This file is in the public domain.
*/
#include "all.h"
#include "../pit.h"
u2_ho_jet
2014-01-04 06:59:56 +04:00
j2_mcj(Pt6, ut, busk)[];
/* logic
*/
u2_noun // transfer
2014-08-21 01:18:34 +04:00
j2_mcx(Pt6, ut, busk)(
2014-01-04 06:59:56 +04:00
u2_noun van, // retain
u2_noun sut, // retain
u2_noun cog, // retain
u2_noun hyp) // retain
{
2014-09-03 07:36:29 +04:00
u2_noun sep = u2_cqfu_seep(van, sut, c3__both, hyp);
2014-08-21 01:18:34 +04:00
u2_noun bid = u2nt(u2k(cog), u2k(hyp), sep);
2014-09-03 07:36:29 +04:00
u2_noun ret = u2_cqf_bull(bid, sut);
2014-01-04 06:59:56 +04:00
u2z(bid);
return ret;
}
/* boilerplate
*/
u2_noun // transfer
2014-08-28 23:40:40 +04:00
j2_mc(Pt6, ut, busk)(u2_noun cor) // retain
2014-01-04 06:59:56 +04:00
{
u2_noun sut, cog, hyp, van;
2014-08-21 01:18:34 +04:00
if ( (u2_no == u2_cr_mean(cor, u2_cv_sam_2, &cog,
u2_cv_sam_3, &hyp,
u2_cv_con, &van,
2014-01-04 06:59:56 +04:00
0)) ||
2014-08-21 01:18:34 +04:00
(u2_no == u2ud(cog)) ||
(u2_none == (sut = u2_cr_at(u2_cv_sam, van))) )
2014-01-04 06:59:56 +04:00
{
2014-08-21 01:18:34 +04:00
return u2_cm_bail(c3__fail);
2014-01-04 06:59:56 +04:00
} else {
2014-08-21 01:18:34 +04:00
return j2_mcx(Pt6, ut, busk)(van, sut, cog, hyp);
2014-01-04 06:59:56 +04:00
}
}
u2_noun // transfer
2014-09-03 07:36:29 +04:00
u2_cqfu_busk(u2_noun van, // retain
2014-01-04 06:59:56 +04:00
u2_noun sut, // retain
u2_noun cog, // retain
u2_noun hyp) // retain
{
2014-08-28 23:40:40 +04:00
return j2_mcx(Pt6, ut, busk)(van, sut, cog, hyp);
2014-01-04 06:59:56 +04:00
}
u2_weak
2014-08-28 23:40:40 +04:00
j2_mck(Pt6, ut, busk)(u2_noun cor)
2014-01-04 06:59:56 +04:00
{
u2_noun sut, hyp, van;
2014-08-21 01:18:34 +04:00
if ( (u2_no == u2_cr_mean(cor, u2_cv_sam_3, &hyp, u2_cv_con, &van, &hyp, 0)) ||
(u2_none == (sut = u2_cr_at(u2_cv_sam, van))) )
2014-01-04 06:59:56 +04:00
{
return u2_none;
} else {
2014-08-21 01:18:34 +04:00
return u2nc(u2k(sut), u2k(hyp));
2014-01-04 06:59:56 +04:00
}
}
/* structures
*/
u2_ho_jet
2014-01-04 06:59:56 +04:00
j2_mcj(Pt6, ut, busk)[] = {
{ ".2", c3__hevy,
j2_mc(Pt6, ut, busk),
2014-01-04 06:59:56 +04:00
Tier6_b_memo,
u2_none, u2_none,
j2_mck(Pt6, ut, busk), c3__busk,
},
{ }
};