urbit/j/6/ut_busk.c

54 lines
1.1 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"
2014-09-04 07:10:43 +04:00
2014-01-04 06:59:56 +04:00
/* logic
*/
2014-09-04 01:33:18 +04:00
u2_noun
2014-09-03 09:46:55 +04:00
_cqfu_busk(
2014-09-04 01:33:18 +04:00
u2_noun van,
u2_noun sut,
u2_noun cog,
u2_noun hyp)
2014-01-04 06:59:56 +04:00
{
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
*/
2014-09-04 01:33:18 +04:00
u2_noun
u2_cwfu_busk(u2_noun cor)
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-09-03 09:46:55 +04:00
return _cqfu_busk(van, sut, cog, hyp);
2014-01-04 06:59:56 +04:00
}
}
2014-09-04 01:33:18 +04:00
u2_noun
u2_cqfu_busk(u2_noun van,
u2_noun sut,
u2_noun cog,
u2_noun hyp)
2014-01-04 06:59:56 +04:00
{
2014-09-03 09:46:55 +04:00
return _cqfu_busk(van, sut, cog, hyp);
2014-01-04 06:59:56 +04:00
}