mirror of
https://github.com/urbit/shrub.git
synced 2024-12-18 15:55:00 +03:00
53 lines
1.2 KiB
C
53 lines
1.2 KiB
C
/* j/3/dor.c
|
|
**
|
|
** This file is in the public domain.
|
|
*/
|
|
#include "all.h"
|
|
#include "../pit.h"
|
|
|
|
/* functions
|
|
*/
|
|
u2_weak // transfer
|
|
u2_cqc_dor(
|
|
u2_atom a, // retain
|
|
u2_atom b) // retain
|
|
{
|
|
if ( u2_yes == u2_cr_sing(a, b) ) {
|
|
return u2_yes;
|
|
}
|
|
else {
|
|
if ( u2_yes == u2ud(a) ) {
|
|
if ( u2_yes == u2ud(b) ) {
|
|
return u2_cqa_lth(a, b);
|
|
}
|
|
else {
|
|
return u2_yes;
|
|
}
|
|
}
|
|
else {
|
|
if ( u2_yes == u2ud(b) ) {
|
|
return u2_no;
|
|
}
|
|
else {
|
|
if ( u2_yes == u2_cr_sing(u2h(a), u2h(b)) ) {
|
|
return u2_cqc_dor(u2t(a), u2t(b));
|
|
}
|
|
else return u2_cqc_dor(u2h(a), u2h(b));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
u2_weak // transfer
|
|
u2_cwc_dor(
|
|
u2_noun cor) // retain
|
|
{
|
|
u2_noun a, b;
|
|
|
|
if ( u2_no == u2_cr_mean(cor, u2_cv_sam_2, &a, u2_cv_sam_3, &b, 0) ) {
|
|
return u2_cm_bail(c3__exit);
|
|
} else {
|
|
return u2_cqc_dor(a, b);
|
|
}
|
|
}
|
|
|