urbit/gen164/6/ut_sift.c

69 lines
1.6 KiB
C
Raw Normal View History

2014-01-05 06:05:33 +04:00
/* j/6/sift.c
**
** This file is in the public domain.
*/
#include "all.h"
#include "../pit.h"
/* boilerplate
*/
u2_ho_jet
2014-01-05 06:05:33 +04:00
j2_mcj(Pt6, ut, sift)[];
u2_noun // transfer
2014-08-21 01:18:34 +04:00
j2_mc(Pt6, ut, sift)(
2014-01-05 06:05:33 +04:00
u2_noun cor) // retain
{
u2_noun sut, ref, van;
2014-08-21 01:18:34 +04:00
if ( (u2_no == u2_cr_mean(cor, u2_cv_sam, &ref,
u2_cv_con, &van,
2014-01-05 06:05:33 +04:00
0)) ||
2014-08-21 01:18:34 +04:00
(u2_none == (sut = u2_cr_at(u2_cv_sam, van))) )
2014-01-05 06:05:33 +04:00
{
2014-08-21 01:18:34 +04:00
return u2_cm_bail(c3__fail);
2014-01-05 06:05:33 +04:00
} else {
2014-09-03 07:36:29 +04:00
return u2_cqfu_sift(van, sut, ref);
2014-01-05 06:05:33 +04:00
}
}
u2_noun // transfer
2014-09-03 07:36:29 +04:00
u2_cqfu_sift(u2_noun van, // retain
2014-01-05 06:05:33 +04:00
u2_noun sut, // retain
u2_noun ref) // retain
{
2014-01-05 07:18:06 +04:00
return u2k(ref);
2014-01-05 06:05:33 +04:00
}
u2_weak
2014-08-21 01:18:34 +04:00
j2_mck(Pt6, ut, sift)(
2014-01-05 06:05:33 +04:00
u2_noun cor)
{
u2_noun sut, ref, van;
2014-08-21 01:18:34 +04:00
if ( (u2_no == u2_cr_mean(cor, u2_cv_sam, &ref,
u2_cv_con, &van,
2014-01-05 06:05:33 +04:00
0)) ||
2014-08-21 01:18:34 +04:00
(u2_none == (sut = u2_cr_at(u2_cv_sam, van))) )
2014-01-05 06:05:33 +04:00
{
return u2_none;
} else {
2014-08-21 01:18:34 +04:00
return u2nc
(u2k(sut), u2k(ref));
2014-01-05 06:05:33 +04:00
}
}
/* structures
*/
u2_ho_jet
2014-01-05 06:05:33 +04:00
j2_mcj(Pt6, ut, sift)[] = {
{ ".2", c3__hevy,
j2_mc(Pt6, ut, sift),
2014-01-05 06:05:33 +04:00
Tier6_b_memo,
u2_none, u2_none,
j2_mck(Pt6, ut, sift), c3__sift
},
{ }
};