shrub/gen164/6/comb.c

73 lines
1.9 KiB
C
Raw Normal View History

2013-09-29 00:21:18 +04:00
/* j/6/comb.c
**
** This file is in the public domain.
*/
#include "all.h"
#include "../pit.h"
/* functions
*/
2014-09-04 01:33:18 +04:00
u2_noun
2014-09-03 07:36:29 +04:00
u2_cqf_comb(
2014-09-04 01:33:18 +04:00
u2_noun mal,
u2_noun buz)
2013-09-29 00:21:18 +04:00
{
if ( (u2_none == mal) || (u2_none == buz) ) {
return u2_none;
}
else {
u2_noun p_mal, q_mal, p_buz, q_buz, pp_buz, pq_buz;
2014-08-21 01:18:34 +04:00
if ( (u2_yes == u2_cr_p(mal, 0, &p_mal)) && (0 != p_mal) ) {
if ( (u2_yes == u2_cr_p(buz, 0, &p_buz)) && (0 != p_buz) ) {
return u2nc(
0,
2014-09-03 07:36:29 +04:00
u2_cqc_peg(p_mal, p_buz));
2013-09-29 00:21:18 +04:00
}
2014-08-21 01:18:34 +04:00
else if ( u2_yes == u2_cr_pq(buz, 2, &p_buz, &q_buz) &&
u2_yes == u2_cr_p(p_buz, 0, &pp_buz) &&
u2_yes == u2_cr_p(q_buz, 0, &pq_buz) )
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
return u2nt
(2,
u2nc(0,
2014-09-03 07:36:29 +04:00
u2_cqc_peg(p_mal, pp_buz)),
2014-08-21 01:18:34 +04:00
u2nc(0,
2014-09-03 07:36:29 +04:00
u2_cqc_peg(p_mal, pq_buz)));
2013-09-29 00:21:18 +04:00
}
2014-08-21 01:18:34 +04:00
else return u2nt(7, u2k(mal),
u2k(buz));
2013-09-29 00:21:18 +04:00
}
#if 1
2014-08-21 01:18:34 +04:00
else if ( (u2_yes == u2_cr_bush(mal, &p_mal, &q_mal)) &&
(u2_yes == u2du(p_mal)) &&
(u2_yes == u2du(q_mal)) &&
(0 == u2h(q_mal)) &&
(1 == u2t(q_mal)) )
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
return u2nt(8, u2k(p_mal),
u2k(buz));
2013-09-29 00:21:18 +04:00
}
#endif
2014-08-21 01:18:34 +04:00
else if ( (u2_yes == u2_cr_p(buz, 0, &p_buz)) &&
(u2_yes == u2_cr_sing(1, p_buz)) )
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
return u2k(mal);
2013-09-29 00:21:18 +04:00
}
2014-08-21 01:18:34 +04:00
else return u2nt(7, u2k(mal),
u2k(buz));
2013-09-29 00:21:18 +04:00
}
}
2014-09-04 01:33:18 +04:00
u2_noun
2014-09-03 09:46:55 +04:00
u2_cwf_comb(
2014-09-04 01:33:18 +04:00
u2_noun cor)
2013-09-29 00:21:18 +04:00
{
u2_noun mal, buz;
2014-08-21 01:18:34 +04:00
if ( u2_no == u2_cr_mean(cor, u2_cv_sam_2, &mal, u2_cv_sam_3, &buz, 0) ) {
2013-09-29 00:21:18 +04:00
return u2_none;
} else {
2014-09-03 07:36:29 +04:00
return u2_cqf_comb(mal, buz);
2013-09-29 00:21:18 +04:00
}
}