mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-15 13:17:41 +03:00
Merge branch 'master' of https://github.com/urbit/urbit
This commit is contained in:
commit
985414fa2e
75
f/coal.c
75
f/coal.c
@ -957,11 +957,84 @@ u2_ckd_in_tap(u2_noun a, u2_noun b)
|
||||
|
||||
/* u2_cke_cue(): expand saved pill.
|
||||
*/
|
||||
static u2_noun // produce
|
||||
_cue_in(u2_wire wir_r,
|
||||
u2_atom a, // retain
|
||||
u2_atom b, // retain
|
||||
u2_ray t_r) // retain
|
||||
{
|
||||
u2_noun p, q;
|
||||
|
||||
if ( _0 == j2_mbc(Pt3, cut)(wir_r, 0, b, 1, a) ) {
|
||||
u2_noun x = j2_mbc(Pt1, inc)(wir_r, b);
|
||||
u2_noun c = j2_mby(Pt5, rub)(wir_r, x, a);
|
||||
|
||||
p = j2_mbc(Pt1, inc)(wir_r, u2_h(c));
|
||||
q = u2_rx(wir_r, u2_t(c));
|
||||
q = u2_cs_save(wir_r, t_r, 0, b, q);
|
||||
|
||||
u2_rz(wir_r, c);
|
||||
u2_rz(wir_r, x);
|
||||
}
|
||||
else {
|
||||
u2_noun c = j2_mbc(Pt1, add)(wir_r, _2, b);
|
||||
u2_noun l = j2_mbc(Pt1, inc)(wir_r, b);
|
||||
|
||||
if ( _0 == j2_mbc(Pt3, cut)(wir_r, 0, l, 1, a) ) {
|
||||
u2_noun u, v, w;
|
||||
u2_noun x, y;
|
||||
|
||||
u = _cue_in(wir_r, a, c, t_r);
|
||||
x = j2_mbc(Pt1, add)(wir_r, u2_h(u), c);
|
||||
v = _cue_in(wir_r, a, x, t_r);
|
||||
|
||||
w = u2_bc(wir_r, u2_rx(wir_r, u2_t(u)),
|
||||
u2_rx(wir_r, u2_t(v)));
|
||||
|
||||
y = j2_mbc(Pt1, add)(wir_r, u2_h(u), u2_h(v));
|
||||
|
||||
p = j2_mbc(Pt1, add)(wir_r, _2, y);
|
||||
q = u2_cs_save(wir_r, t_r, 0, b, w);
|
||||
|
||||
u2_rz(wir_r, u); u2_rz(wir_r, v); u2_rz(wir_r, x); u2_rz(wir_r, y);
|
||||
}
|
||||
else {
|
||||
u2_noun d = j2_mby(Pt5, rub)(wir_r, c, a);
|
||||
u2_weak x = u2_cs_find(wir_r, t_r, 0, u2_t(d));
|
||||
|
||||
p = j2_mbc(Pt1, add)(wir_r, _2, u2_h(d));
|
||||
|
||||
if ( u2_none == x ) {
|
||||
return u2_bl_bail(wir_r, c3__fail);
|
||||
}
|
||||
q = u2_rx(wir_r, x);
|
||||
|
||||
u2_rz(wir_r, d);
|
||||
}
|
||||
u2_rz(wir_r, l);
|
||||
u2_rz(wir_r, c);
|
||||
}
|
||||
return u2_bc(wir_r, p, q);
|
||||
}
|
||||
|
||||
u2_noun // transfer
|
||||
_cue_internal(u2_wire wir_r,
|
||||
u2_atom a) // retain
|
||||
{
|
||||
u2_ray t_r = u2_cs_make(wir_r);
|
||||
u2_noun x = _cue_in(wir_r, a, _0, t_r);
|
||||
u2_noun y = u2_rx(wir_r, u2_t(x));
|
||||
|
||||
u2_rz(wir_r, x);
|
||||
u2_cs_free(wir_r, t_r);
|
||||
|
||||
return y;
|
||||
}
|
||||
|
||||
u2_noun
|
||||
u2_cke_cue(u2_atom a)
|
||||
{
|
||||
u2_noun b = _coal_cue(u2_Wire, a);
|
||||
u2_noun b = _cue_internal(u2_Wire, a);
|
||||
|
||||
u2_cz(a);
|
||||
return b;
|
||||
|
@ -4,17 +4,18 @@
|
||||
*/
|
||||
#include "all.h"
|
||||
#include "../pit.h"
|
||||
#include "f/nash.h"
|
||||
|
||||
/* functions
|
||||
*/
|
||||
struct u2_nash* T_r;
|
||||
u2_ray T_r;
|
||||
|
||||
static u2_noun // produce
|
||||
_cue_in(u2_wire wir_r,
|
||||
u2_atom a, // retain
|
||||
u2_atom b) // retain
|
||||
u2_atom b, // retain
|
||||
u2_noun m) // retain
|
||||
{
|
||||
u2_noun p, q;
|
||||
u2_noun p, q, r;
|
||||
|
||||
if ( _0 == j2_mbc(Pt3, cut)(wir_r, 0, b, 1, a) ) {
|
||||
u2_noun x = j2_mbc(Pt1, inc)(wir_r, b);
|
||||
@ -22,7 +23,8 @@
|
||||
|
||||
p = j2_mbc(Pt1, inc)(wir_r, u2_h(c));
|
||||
q = u2_rx(wir_r, u2_t(c));
|
||||
u2_na_put(T_r, b, q);
|
||||
// q = u2_cs_save(wir_r, T_r, 0, b, q);
|
||||
r = j2_mcc(Pt4, by, put)(wir_r, m, b, u2_t(c));
|
||||
|
||||
u2_rz(wir_r, c);
|
||||
u2_rz(wir_r, x);
|
||||
@ -35,9 +37,9 @@
|
||||
u2_noun u, v, w;
|
||||
u2_noun x, y;
|
||||
|
||||
u = _cue_in(wir_r, a, c);
|
||||
u = _cue_in(wir_r, a, c, m);
|
||||
x = j2_mbc(Pt1, add)(wir_r, u2_h(u), c);
|
||||
v = _cue_in(wir_r, a, x);
|
||||
v = _cue_in(wir_r, a, x, u2_t(u2_t(u)));
|
||||
|
||||
w = u2_bc(wir_r, u2_rx(wir_r, u2_h(u2_t(u))),
|
||||
u2_rx(wir_r, u2_h(u2_t(v))));
|
||||
@ -46,42 +48,54 @@
|
||||
|
||||
p = j2_mbc(Pt1, add)(wir_r, _2, y);
|
||||
q = w;
|
||||
u2_na_put(T_r, b, q);
|
||||
// q = u2_cs_save(wir_r, T_r, 0, b, w);
|
||||
r = j2_mcc(Pt4, by, put)(wir_r, u2_t(u2_t(v)), b, w);
|
||||
|
||||
u2_rz(wir_r, u); u2_rz(wir_r, v); u2_rz(wir_r, x); u2_rz(wir_r, y);
|
||||
}
|
||||
else {
|
||||
u2_noun d = j2_mby(Pt5, rub)(wir_r, c, a);
|
||||
u2_noun x = u2_na_get(T_r, u2_t(d));
|
||||
u2_noun x = j2_mcc(Pt4, by, get)(wir_r, m, u2_t(d));
|
||||
// u2_weak T = u2_cs_find(wir_r, T_r, 0, u2_t(d));
|
||||
|
||||
p = j2_mbc(Pt1, add)(wir_r, _2, u2_h(d));
|
||||
if ( u2_nul == x ) {
|
||||
return u2_bl_bail(wir_r, c3__exit);
|
||||
}
|
||||
q = u2_rx(wir_r, x);
|
||||
#if 0
|
||||
else if ( (u2_none == T) || (u2_no == u2_sing(T, x)) ) {
|
||||
printf("fail!\n");
|
||||
return u2_bl_bail(wir_r, c3__fail);
|
||||
}
|
||||
#endif
|
||||
q = u2_rx(wir_r, u2_t(x));
|
||||
r = u2_rx(wir_r, m);
|
||||
|
||||
u2_rz(wir_r, x);
|
||||
u2_rz(wir_r, d);
|
||||
}
|
||||
u2_rz(wir_r, l);
|
||||
u2_rz(wir_r, c);
|
||||
}
|
||||
return u2_bt(wir_r, p, q, 0);
|
||||
return u2_bt(wir_r, p, q, r);
|
||||
}
|
||||
|
||||
u2_noun // transfer
|
||||
j2_mby(Pt5, cue)(u2_wire wir_r,
|
||||
u2_atom a) // retain
|
||||
{
|
||||
T_r = u2_na_make();
|
||||
#if 0
|
||||
if ( 0 == T_r ) {
|
||||
T_r = u2_cs_make(wir_r);
|
||||
}
|
||||
#endif
|
||||
{
|
||||
u2_noun x = _cue_in(wir_r, a, _0, u2_nul);
|
||||
u2_noun y = u2_rx(wir_r, u2_h(u2_t(x)));
|
||||
|
||||
u2_noun x = _cue_in(wir_r, a, _0);
|
||||
u2_noun y = u2_rx(wir_r, u2_h(u2_t(x)));
|
||||
|
||||
u2_na_take(T_r);
|
||||
T_r = 0;
|
||||
|
||||
u2_rz(wir_r, x);
|
||||
return y;
|
||||
u2_rz(wir_r, x);
|
||||
return y;
|
||||
}
|
||||
}
|
||||
u2_noun // transfer
|
||||
j2_mb(Pt5, cue)(u2_wire wir_r,
|
||||
|
Loading…
Reference in New Issue
Block a user