1
0
mirror of https://github.com/ilyakooo0/urbit.git synced 2024-12-29 18:06:43 +03:00
urbit/jets/f/ut_buss.c
2018-04-26 16:36:29 -07:00

94 lines
2.0 KiB
C

/* j/6/ut_buss.c
**
*/
#include "all.h"
/* logic
*/
static u3_noun
_cqfu_buss(u3_noun van,
u3_noun sut,
u3_noun cog,
u3_noun gen)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_cook("_cqfu_buss-buss", von, "buss");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
u3k(cog),
u3x_sam_3,
u3k(gen),
0));
}
static u3_noun
_cqfu_busk(u3_noun van,
u3_noun sut,
u3_noun gen)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_cook("_cqfu_busk-busk", von, "busk");
return u3n_kick_on(u3i_molt(gat,
u3x_sam,
u3k(gen),
0));
}
/* boilerplate
*/
u3_noun
u3wfu_buss(u3_noun cor)
{
u3_noun sut, cog, gen, van;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &cog,
u3x_sam_3, &gen,
u3x_con, &van,
0)) ||
(c3n == u3ud(cog)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_buss(van, sut, cog, gen);
}
}
u3_noun
u3qfu_buss(u3_noun van,
u3_noun sut,
u3_noun cog,
u3_noun gen)
{
return _cqfu_buss(van, sut, cog, gen);
}
u3_noun
u3wfu_busk(u3_noun cor)
{
u3_noun sut, gen, van;
if ( (c3n == u3r_mean(cor, u3x_sam, &gen,
u3x_con, &van,
0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_busk(van, sut, gen);
}
}
u3_noun
u3qfu_busk(u3_noun van,
u3_noun sut,
u3_noun gen)
{
return _cqfu_busk(van, sut, gen);
}