Skip to content

Commit

Permalink
zpsm is now fully sifted.
Browse files Browse the repository at this point in the history
  • Loading branch information
cgyarvin committed Jan 5, 2014
1 parent ccf499f commit b9f65d8
Show file tree
Hide file tree
Showing 7 changed files with 157 additions and 4 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ J191_6_OFILES_UT=\
gen191/6/ut_repo.o \
gen191/6/ut_rest.o \
gen191/6/ut_seek.o \
gen191/6/ut_sift.o \
gen191/6/ut_swab.o \
gen191/6/ut_tack.o \
gen191/6/ut_tock.o \
Expand Down
2 changes: 2 additions & 0 deletions gen191/6/ut.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
extern u2_ho_jet j2_mcj(Pt6, ut, play)[];
extern u2_ho_jet j2_mcj(Pt6, ut, rest)[];
extern u2_ho_jet j2_mcj(Pt6, ut, seek)[];
extern u2_ho_jet j2_mcj(Pt6, ut, sift)[];
extern u2_ho_jet j2_mcj(Pt6, ut, tack)[];
extern u2_ho_jet j2_mcj(Pt6, ut, tock)[];

Expand Down Expand Up @@ -177,6 +178,7 @@
{ j2_sc(Pt6, ut, play), j2_mcj(Pt6, ut, play), 0, 0, u2_none },
{ j2_sc(Pt6, ut, rest), j2_mcj(Pt6, ut, rest), 0, 0, u2_none },
{ j2_sc(Pt6, ut, seek), j2_mcj(Pt6, ut, seek), 0, 0, u2_none },
{ j2_sc(Pt6, ut, sift), j2_mcj(Pt6, ut, sift), 0, 0, u2_none },
{ j2_sc(Pt6, ut, tack), j2_mcj(Pt6, ut, tack), 0, 0, u2_none },
{ j2_sc(Pt6, ut, tock), j2_mcj(Pt6, ut, tock), 0, 0, u2_none },
{ }
Expand Down
4 changes: 3 additions & 1 deletion gen191/6/ut_mint.c
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,8 @@
u2_noun p_vos = u2_h(vos);
u2_noun q_vos = u2_t(vos);
u2_noun waz = u2_bc(wir_r, _1, u2_rx(wir_r, p_vos));
u2_noun cig = j2_mby(Pt6, cell)(wir_r, zur, p_vos);
u2_noun sif = j2_mcy(Pt6, ut, sift)(wir_r, van, sut, zur);
u2_noun cig = j2_mby(Pt6, cell)(wir_r, sif, p_vos);
u2_noun ret;

ret = u2_bc(wir_r,
Expand All @@ -864,6 +865,7 @@

u2_rz(wir_r, waz);
u2_rz(wir_r, zur);
u2_rz(wir_r, sif);
u2_rz(wir_r, vos);

return ret;
Expand Down
131 changes: 131 additions & 0 deletions gen191/6/ut_sift.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
/* j/6/sift.c
**
** This file is in the public domain.
*/
#include "all.h"
#include "../pit.h"

/* boilerplate
*/
u2_ho_jet
j2_mcj(Pt6, ut, sift)[];

u2_noun // transfer
j2_mc(Pt6, ut, sift)(u2_wire wir_r,
u2_noun cor) // retain
{
u2_noun sut, ref, van;

if ( (u2_no == u2_mean(cor, u2_cv_sam, &ref,
u2_cv_con, &van,
0)) ||
(u2_none == (sut = u2_frag(u2_cv_sam, van))) )
{
return u2_bl_bail(wir_r, c3__fail);
} else {
return j2_mcy(Pt6, ut, sift)(wir_r, van, sut, ref);
}
}

u2_weak // transfer
j2_mci(Pt6, ut, sift)(u2_wire wir_r,
u2_noun van, // retain
u2_noun sut, // retain
u2_noun ref) // retain
{
u2_weak hoc = u2_ds_look(wir_r, van, "sift");

if ( u2_none == hoc ) {
c3_assert(!"register sift");
return u2_none;
} else {
u2_weak von = u2_rl_molt(wir_r, van, u2_cv_sam, u2_rx(wir_r, sut), 0);
u2_weak gat = u2_nk_soft(wir_r, von, hoc);
u2_weak cor = u2_rl_molt(wir_r, gat, u2_cv_sam, u2_rx(wir_r, ref), 0);

if ( (u2_none == j2_mcj(Pt6, ut, sift)[0].xip) ) {
u2_noun xip = u2_ds_find(wir_r, cor);

// c3_assert(u2_none != xip);
j2_mcj(Pt6, ut, sift)[0].xip = xip;
}
u2_rl_lose(wir_r, gat);
return cor;
}
}

u2_noun // transfer
j2_mcy(Pt6, ut, sift)(u2_wire wir_r,
u2_noun van, // retain
u2_noun sut, // retain
u2_noun ref) // retain
{
#if 0
u2_ho_jet *jet_j = &j2_mcj(Pt6, ut, sift)[0];

if ( (jet_j->sat_s & u2_jet_live) && !(jet_j->sat_s & u2_jet_test) ) {
if ( !(jet_j->sat_s & u2_jet_memo) ) {
return j2_mcx(Pt6, ut, sift)(wir_r, van, sut, ref);
}
else {
c3_m fun_m = c3__sift;
u2_noun pro = u2_rl_find_trel(wir_r, fun_m, sut, ref);

if ( u2_none != pro ) {
return pro;
}
else {
pro = j2_mcx(Pt6, ut, sift)(wir_r, van, sut, ref);

return u2_rl_save_trel(wir_r, fun_m, sut, ref, pro);
}
}
return pro;
} else
#else
{
u2_noun cor, pro;

cor = j2_mci(Pt6, ut, sift)(wir_r, van, sut, ref);

pro = u2_nk_soft(wir_r, u2k(cor), u2h(cor));
if ( u2_none == pro ) return u2_bl_bail(wir_r, c3__fail);

u2_rz(wir_r, cor);

return pro;
#endif
}
}

u2_weak
j2_mck(Pt6, ut, sift)(u2_wire wir_r,
u2_noun cor)
{
u2_noun sut, ref, van;

if ( (u2_no == u2_mean(cor, u2_cv_sam, &ref,
u2_cv_con, &van,
0)) ||
(u2_none == (sut = u2_frag(u2_cv_sam, van))) )
{
return u2_none;
} else {
return u2_rc
(wir_r, u2_rx(wir_r, sut), u2_rx(wir_r, ref));
}
}

/* structures
*/
u2_ho_jet
j2_mcj(Pt6, ut, sift)[] = {
{ ".2", c3__hevy,
j2_mc(Pt6, ut, sift),
Tier6_b_memo,
u2_none, u2_none,
j2_mck(Pt6, ut, sift), c3__sift
},
{ }
};

5 changes: 5 additions & 0 deletions gen191/pit.h
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,11 @@
u2_noun hep); // retain

u2_noun // transfer
j2_mcy(Pt6, ut, sift)(u2_wire wir_r,
u2_noun van, // retain
u2_noun sut, // retain
u2_noun ref); // retain
u2_noun // transfer
j2_mcy(Pt6, ut, tack)(u2_wire wir_r,
u2_noun van, // retain
u2_noun sut, // retain
Expand Down
Binary file modified urb/urbit.pill
Binary file not shown.
18 changes: 15 additions & 3 deletions urb/zod/arvo/hoon.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -3708,7 +3708,7 @@
^- type
?:(|(=(%void der) =(%void s.bid)) %void [%bull bid der])
::
++ cain |=(vix=vise (sell (seer vix)))
++ cain |=(vax=vase (sell vax))
++ cell
~/ %cell
|= [hed=type tal=type]
Expand Down Expand Up @@ -3969,7 +3969,8 @@
|= txt=@
q:(~(mint ut %noun) %noun (ream txt))
::
++ noah |=(vix=vise (pave (seer vix)))
++ noah |=(vax=vase (pave vax))
++ onan |=(vix=vise (seer vix))
++ rain
|= [bon=path txt=@]
=+ vaz=vast
Expand Down Expand Up @@ -4808,7 +4809,9 @@
[%wtpt puce:vaw (blue:vaw q.gen) (blue:vaw r.gen)]
::
[%zpcb *] q.gen
[%zpgr *] [%zpsm [%bctr [%herb [%cnbc %abel]]] p.gen]
[%zpgr *]
[%cnhp [%cnbc %onan] [%zpsm [%bctr [%herb [%cnbc %abel]]] p.gen] ~]
::
[%zpwt *]
?: ?: ?=(@ p.gen)
(lte stub p.gen)
Expand Down Expand Up @@ -4870,6 +4873,7 @@
%peek peek
%repo repo
%rest rest
%sift sift
%seek seek
%tack tack
%tock tock
Expand Down Expand Up @@ -5871,6 +5875,7 @@
::
[%zpsm *]
=+ vos=$(gol %noun, gen q.gen) :: XX validate!
:: [(nice (cell (sift (play p.gen)) p.vos)) (cons [%1 p.vos] q.vos)]
[(nice (cell (play p.gen) p.vos)) (cons [%1 p.vos] q.vos)]
::
[%zpts *] [(nice %noun) [%1 q:$(vet |, gen p.gen)]]
Expand Down Expand Up @@ -6414,6 +6419,13 @@
=+ zar=(seek way hyp)
?>(?=(& -.q.zar) [p.zar p.q.zar])
::
++ sift
|= ref=type
^- type
=+ ^= oat ^- type
~+ -:!>(*typo)
~|(%sift-lose ?>((nest(sut ref) & oat) ref))
::
++ snub
~/ %snub
|= har=(list ,[p=wing q=twig])
Expand Down

0 comments on commit b9f65d8

Please sign in to comment.