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-06 00:13:24 +04:00
u3_noun
2014-09-03 09:46:55 +04:00
_cqfu_busk(
2014-09-06 00:13:24 +04:00
u3_noun van,
u3_noun sut,
u3_noun cog,
u3_noun hyp)
2014-01-04 06:59:56 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun sep = u3_cqfu_seep(van, sut, c3__both, hyp);
u3_noun bid = u3nt(u3k(cog), u3k(hyp), sep);
u3_noun ret = u3_cqf_bull(bid, sut);
2014-01-04 06:59:56 +04:00
2014-09-06 00:13:24 +04:00
u3z(bid);
2014-01-04 06:59:56 +04:00
return ret;
}
/* boilerplate
*/
2014-09-06 00:13:24 +04:00
u3_noun
u3_cwfu_busk(u3_noun cor)
2014-01-04 06:59:56 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun sut, cog, hyp, van;
2014-01-04 06:59:56 +04:00
2014-11-05 04:18:47 +03:00
if ( (c3n == u3_cr_mean(cor, u3_cv_sam_2, &cog,
2014-09-06 00:13:24 +04:00
u3_cv_sam_3, &hyp,
u3_cv_con, &van,
2014-01-04 06:59:56 +04:00
0)) ||
2014-11-05 04:18:47 +03:00
(c3n == u3ud(cog)) ||
(c3nne == (sut = u3_cr_at(u3_cv_sam, van))) )
2014-01-04 06:59:56 +04:00
{
2014-09-06 00:13:24 +04:00
return u3_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-06 00:13:24 +04:00
u3_noun
u3_cqfu_busk(u3_noun van,
u3_noun sut,
u3_noun cog,
u3_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
}