urbit/gen164/3/cap.c
2014-01-06 12:37:42 -08:00

47 lines
1.0 KiB
C

/* j/3/cap.c
**
** This file is in the public domain.
*/
#include "all.h"
#include "../pit.h"
/* functions
*/
u2_weak // transfer
j2_mbc(Pt3, cap)(u2_wire wir_r,
u2_atom a) // retain
{
c3_w met_w = u2_met(0, a);
if ( met_w < 2 ) {
return u2_bl_bail(wir_r, c3__exit);
}
else if ( (1 == u2_bit((met_w - 2), a)) ) {
return _3;
} else {
return _2;
}
}
u2_weak // transfer
j2_mb(Pt3, cap)(u2_wire wir_r,
u2_noun cor) // retain
{
u2_noun a;
if ( (u2_none == (a = u2_frag(u2_cv_sam, cor))) ||
(u2_no == u2_stud(a)) )
{
return u2_bl_bail(wir_r, c3__exit);
} else {
return j2_mbc(Pt3, cap)(wir_r, a);
}
}
/* structures
*/
u2_ho_jet
j2_mbj(Pt3, cap)[] = {
{ ".2", c3__lite, j2_mb(Pt3, cap), Tier3, u2_none, u2_none },
{ }
};