urbit/jets/f/ut_busk.c

52 lines
980 B
C
Raw Normal View History

2014-01-04 06:59:56 +04:00
/* j/6/ut_busk.c
**
*/
#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
2015-08-28 19:34:36 +03:00
_cqfu_busk(u3_noun van,
u3_noun sut,
u3_noun cog,
u3_noun hyp)
2014-01-04 06:59:56 +04:00
{
2014-11-06 22:13:57 +03:00
u3_noun sep = u3qfu_seep(van, sut, c3__both, hyp);
2014-09-06 00:13:24 +04:00
u3_noun bid = u3nt(u3k(cog), u3k(hyp), sep);
2014-11-06 22:13:57 +03:00
u3_noun ret = u3qf_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
2014-11-06 22:13:57 +03:00
u3wfu_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-18 00:56:51 +03:00
if ( (c3n == u3r_mean(cor, u3x_sam_2, &cog,
2015-08-28 19:34:36 +03:00
u3x_sam_3, &hyp,
u3x_con, &van,
0)) ||
2014-11-05 04:18:47 +03:00
(c3n == u3ud(cog)) ||
2014-11-18 00:56:51 +03:00
(u3_none == (sut = u3r_at(u3x_sam, van))) )
2014-01-04 06:59:56 +04:00
{
2014-11-06 03:20:01 +03:00
return u3m_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
2014-11-06 22:13:57 +03:00
u3qfu_busk(u3_noun van,
2015-08-28 19:34:36 +03:00
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
}