shrub/j/2/scag.c

53 lines
827 B
C
Raw Normal View History

2014-05-27 04:33:41 +04:00
/* j/2/scag.c
**
** This file is in the public domain.
*/
#include "all.h"
2014-09-04 07:10:43 +04:00
2014-05-27 04:33:41 +04:00
/* functions
*/
2014-09-04 01:33:18 +04:00
u2_noun
u2_cqb_scag(
u2_atom a,
u2_noun b)
2014-05-27 04:33:41 +04:00
{
2014-08-20 01:49:16 +04:00
if ( u2_ne(u2_co_is_cat(a)) ) {
return u2_cm_bail(c3__fail);
2014-05-27 04:33:41 +04:00
}
else {
u2_noun acc;
2014-05-27 04:33:41 +04:00
c3_w i_w = a;
if ( !i_w )
2014-05-27 04:33:41 +04:00
return u2_nul;
while ( i_w ) {
2014-08-20 01:49:16 +04:00
if ( u2_no == u2du(b) ) {
2014-05-27 04:33:41 +04:00
return u2_nul;
}
2014-08-20 01:49:16 +04:00
acc = u2_ci_cell( u2h(b), acc );
b = u2t(b);
2014-05-27 04:33:41 +04:00
i_w--;
}
return u2_ckb_flop(acc);
2014-05-27 04:33:41 +04:00
}
}
2014-09-04 01:33:18 +04:00
u2_noun
u2_cwb_scag(
u2_noun cor)
2014-05-27 04:33:41 +04:00
{
u2_noun a, b;
2014-08-20 01:49:16 +04:00
if ( (u2_no == u2_cr_mean(cor, u2_cv_sam_2, &a, u2_cv_sam_3, &b, 0)) ||
(u2_no == u2ud(a)) )
2014-05-27 04:33:41 +04:00
{
2014-08-20 01:49:16 +04:00
return u2_cm_bail(c3__exit);
2014-05-27 04:33:41 +04:00
} else {
2014-09-04 01:33:18 +04:00
return u2_cqb_scag(a, b);
2014-05-27 04:33:41 +04:00
}
}