shrub/j/6/ut_bust.c

73 lines
1.4 KiB
C
Raw Normal View History

2013-09-29 00:21:18 +04:00
/* j/6/bust.c
**
** This file is in the public domain.
*/
#include "all.h"
2014-09-04 07:10:43 +04:00
2013-09-29 00:21:18 +04:00
/* logic
*/
2014-09-04 01:33:18 +04:00
u2_noun
2014-09-03 09:46:55 +04:00
_cqfu_bust(
2014-09-04 01:33:18 +04:00
u2_noun van,
u2_noun sut,
u2_noun dib)
2013-09-29 00:21:18 +04:00
{
2014-09-03 07:36:29 +04:00
u2_noun yam = u2_cqfu_burn(van, sut);
2014-08-21 01:18:34 +04:00
u2_noun yib = u2nc
(
u2nc(u2k(u2h(u2h(yam))),
u2k(dib)),
u2k(u2t(yam)));
u2_noun woo = u2nc(c3__cnzy, u2_blip);
2014-09-03 07:36:29 +04:00
u2_noun wox = u2_cqfu_mint(van, sut, c3__noun, woo);
2014-08-21 01:18:34 +04:00
u2_noun ret = u2_cn_nock_on(yib, u2k(u2t(wox)));
2013-09-29 00:21:18 +04:00
if ( u2_none == ret ) {
2014-08-21 01:18:34 +04:00
return u2_cm_error("bust-nock");
2013-09-29 00:21:18 +04:00
}
2014-08-21 01:18:34 +04:00
u2z(wox);
u2z(woo);
u2z(yam);
2013-09-29 00:21:18 +04:00
return ret;
}
/* boilerplate
*/
2014-09-04 01:33:18 +04:00
u2_noun
u2_cwfu_bust(u2_noun cor)
2013-09-29 00:21:18 +04:00
{
u2_noun sut, dib, van;
2014-08-21 01:18:34 +04:00
if ( (u2_no == u2_cr_mean(cor, u2_cv_sam, &dib, u2_cv_con, &van, 0)) ||
(u2_none == (sut = u2_cr_at(u2_cv_sam, van))) )
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
return u2_cm_bail(c3__fail);
2013-09-29 00:21:18 +04:00
} else {
2014-09-03 09:46:55 +04:00
return _cqfu_bust(van, sut, dib);
2013-09-29 00:21:18 +04:00
}
}
2014-09-04 01:33:18 +04:00
u2_noun
u2_cqfu_bust(u2_noun van,
u2_noun sut,
u2_noun dib)
2013-09-29 00:21:18 +04:00
{
2014-08-28 23:40:40 +04:00
#if 1
2014-09-03 09:46:55 +04:00
return _cqfu_bust(van, sut, dib);
2014-08-28 23:40:40 +04:00
#else
c3_m fun_m = c3__bust;
u2_noun pro = u2_cz_find_2(fun_m, sut, dib);
2013-09-29 00:21:18 +04:00
2014-08-28 23:40:40 +04:00
if ( u2_none != pro ) {
return pro;
2013-09-29 00:21:18 +04:00
}
else {
2014-09-03 09:46:55 +04:00
pro = _cqfu_bust(van, sut, dib);
2013-09-29 00:21:18 +04:00
2014-08-28 23:40:40 +04:00
return u2_cz_save_2(fun_m, sut, dib, pro);
2013-09-29 00:21:18 +04:00
}
2014-08-28 23:40:40 +04:00
#endif
2013-09-29 00:21:18 +04:00
}