shrub/j/6/flay.c

57 lines
1.0 KiB
C
Raw Normal View History

2013-09-29 00:21:18 +04:00
/* j/6/flay.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
/* functions
*/
2014-09-06 00:13:24 +04:00
static u3_noun
2014-08-21 01:18:34 +04:00
_flay_roll(
2014-09-06 00:13:24 +04:00
u3_noun quz)
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
if ( u3_no == u3du(quz) ) {
2013-09-29 00:21:18 +04:00
return c3__void;
} else {
2014-09-06 00:13:24 +04:00
u3_noun voo = _flay_roll(u3t(quz));
u3_noun oon = u3_cqf_fork(u3h(u3h(quz)), voo);
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3z(voo);
2013-09-29 00:21:18 +04:00
return oon;
}
}
2014-09-06 00:13:24 +04:00
u3_noun
u3_cqf_flay(
u3_noun pok)
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun p_pok = u3h(pok);
u3_noun q_pok = u3t(pok);
u3_noun typ;
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
switch ( u3h(q_pok) ) {
default: return u3_cm_bail(c3__fail);
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
case u3_yes: typ = u3k(u3t(q_pok));
2013-09-29 00:21:18 +04:00
break;
2014-09-06 00:13:24 +04:00
case u3_no: typ = _flay_roll(u3t(u3t(q_pok)));
2013-09-29 00:21:18 +04:00
break;
}
2014-09-06 00:13:24 +04:00
return u3nc(u3k(p_pok), typ);
2013-09-29 00:21:18 +04:00
}
2014-09-06 00:13:24 +04:00
u3_noun
u3_cwf_flay(
u3_noun cor)
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun pok;
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
if ( (u3_no == u3_cr_mean(cor, u3_cv_sam, &pok, 0)) ||
(u3_no == u3du(pok)) ) {
return u3_cm_bail(c3__fail);
2013-09-29 00:21:18 +04:00
} else {
2014-09-06 00:13:24 +04:00
return u3_cqf_flay(pok);
2013-09-29 00:21:18 +04:00
}
}