shrub/j/f/flay.c

57 lines
1001 B
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-11-05 04:18:47 +03:00
if ( c3n == 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));
2014-11-06 22:13:57 +03:00
u3_noun oon = u3qf_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
2014-11-06 22:13:57 +03:00
u3qf_flay(
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
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) ) {
2014-11-06 03:20:01 +03:00
default: return u3m_bail(c3__fail);
2013-09-29 00:21:18 +04:00
2014-11-05 04:18:47 +03:00
case c3y: typ = u3k(u3t(q_pok));
2013-09-29 00:21:18 +04:00
break;
2014-11-05 04:18:47 +03:00
case c3n: 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
2014-11-06 22:13:57 +03:00
u3wf_flay(
2014-09-06 00:13:24 +04:00
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-11-18 00:56:51 +03:00
if ( (c3n == u3r_mean(cor, u3x_sam, &pok, 0)) ||
2014-11-05 04:18:47 +03:00
(c3n == u3du(pok)) ) {
2014-11-06 03:20:01 +03:00
return u3m_bail(c3__fail);
2013-09-29 00:21:18 +04:00
} else {
2014-11-06 22:13:57 +03:00
return u3qf_flay(pok);
2013-09-29 00:21:18 +04:00
}
}