mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-18 20:31:40 +03:00
WIP refactored but still dying
This commit is contained in:
parent
63ccf3ad7e
commit
e815ad4be7
@ -1701,14 +1701,10 @@ u3r_mug(u3_noun veb)
|
||||
veb = fam->veb;
|
||||
veb_u = u3a_to_ptr(veb);
|
||||
|
||||
if ( _(u3a_is_atom(veb)) ) {
|
||||
mug_w = _mug_atom(veb);
|
||||
fam = _mug_pop(mov, off, mug_w);
|
||||
}
|
||||
// both head and tail are mugged; combine them and pop stack
|
||||
//
|
||||
else if ( (0 != a) && (0 != b) ) {
|
||||
//fprintf(stderr, "combining head and tail mugs\r\n");
|
||||
if ( (0 != a) && (0 != b) ) {
|
||||
fprintf(stderr, "combining head and tail mugs\r\n");
|
||||
mug_w = u3r_mug_both(a, b);
|
||||
veb_u->mug_w = mug_w;
|
||||
fam = _mug_pop(mov, off, mug_w);
|
||||
@ -1716,24 +1712,38 @@ u3r_mug(u3_noun veb)
|
||||
// head is mugged, but not tail; push tail onto stack
|
||||
//
|
||||
else if ( (0 != a) && (0 == b) ) {
|
||||
//fprintf(stderr, "pushing tail\r\n");
|
||||
fam = _mug_push(mov, off, u3t(veb));
|
||||
if ( _(u3a_is_atom(u3t(veb))) ) {
|
||||
fprintf(stderr, "tail is atom\r\n");
|
||||
mug_w = _mug_atom(u3t(veb));
|
||||
fam->b = mug_w;
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "pushing tail\r\n");
|
||||
fam = _mug_push(mov, off, u3t(veb));
|
||||
}
|
||||
}
|
||||
// cell, and neither head nor tail is mugged; push head onto stack
|
||||
//
|
||||
else {
|
||||
//fprintf(stderr, "asserting cell\r\n");
|
||||
fprintf(stderr, "asserting cell\r\n");
|
||||
c3_assert(_(u3a_is_cell(veb)));
|
||||
// already mugged; pop stack
|
||||
//
|
||||
if ( veb_u->mug_w ) {
|
||||
//fprintf(stderr, "already mugged\r\n");
|
||||
fprintf(stderr, "already mugged\r\n");
|
||||
mug_w = veb_u->mug_w;
|
||||
fam = _mug_pop(mov, off, mug_w);
|
||||
}
|
||||
else {
|
||||
//fprintf(stderr, "pushing head\r\n");
|
||||
fam = _mug_push(mov, off, u3h(veb));
|
||||
if ( _(u3a_is_atom(u3h(veb))) ) {
|
||||
fprintf(stderr, "head is atom\r\n");
|
||||
mug_w = _mug_atom(u3h(veb));
|
||||
fam->a = mug_w;
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "pushing head\r\n");
|
||||
fam = _mug_push(mov, off, u3h(veb));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ _test_mug(void)
|
||||
|
||||
u3_noun set = u3_nul;
|
||||
c3_w len_w = 0;
|
||||
while ( 0xf > len_w ) {
|
||||
while ( 0x1 > len_w ) {
|
||||
set = u3qdi_put(set, len_w++);
|
||||
}
|
||||
u3r_mug(set);
|
||||
|
Loading…
Reference in New Issue
Block a user