From 17e1196eb4a68473f3d8433610a6bf6d056042ec Mon Sep 17 00:00:00 2001 From: "C. Guy Yarvin" Date: Sun, 10 Jan 2016 19:56:53 -0800 Subject: [PATCH] Jets use grof. Now ready to apply froqs piecemeal. --- include/jets/q.h | 2 ++ jets/f/fork.c | 18 ++++++++++++++++++ jets/f/ut_burn.c | 11 +++++++++++ jets/f/ut_crop.c | 26 ++++++++++++++++++++++++++ jets/f/ut_find.c | 5 +++-- jets/f/ut_fish.c | 14 ++++++++++++++ jets/f/ut_fuse.c | 14 ++++++++++++++ jets/f/ut_nest.c | 14 +++++++++++++- jets/f/ut_peek.c | 14 ++++++++++++++ jets/f/ut_wrap.c | 17 ++++++++++++++++- 10 files changed, 131 insertions(+), 4 deletions(-) diff --git a/include/jets/q.h b/include/jets/q.h index 342f5f05ec..2d7dfb8004 100644 --- a/include/jets/q.h +++ b/include/jets/q.h @@ -172,7 +172,9 @@ u3_noun u3qf_flip(u3_noun); u3_noun u3qf_flor(u3_noun, u3_noun); u3_noun u3qf_fork(u3_noun, u3_noun); + u3_noun u3qf_forq(u3_noun, u3_noun); u3_noun u3qf_frog(u3_noun); + u3_noun u3qf_grof(u3_noun); u3_noun u3qf_hike(u3_noun, u3_noun); u3_noun u3qf_look(u3_noun, u3_noun); u3_noun u3qf_slot(u3_atom, u3_noun); diff --git a/jets/f/fork.c b/jets/f/fork.c index da636681ec..596ab7afc9 100644 --- a/jets/f/fork.c +++ b/jets/f/fork.c @@ -62,6 +62,24 @@ } } + u3_noun + u3qf_grof(u3_noun yed) + { + if ( u3_nul == yed ) { + return c3__void; + } + else if ( u3_nul == u3t(yed) ) { + return u3k(u3h(yed)); + } + else { + u3_noun nex = u3qf_grof(u3t(yed)); + u3_noun ret = u3qf_fork(u3h(yed), nex); + + u3z(nex); + return ret; + } + } + u3_noun u3qf_frog(u3_noun yed) { diff --git a/jets/f/ut_burn.c b/jets/f/ut_burn.c index 0b8c047db4..e34f699c86 100644 --- a/jets/f/ut_burn.c +++ b/jets/f/ut_burn.c @@ -54,10 +54,21 @@ { return _burn_in(van, p_sut, gil); } +#if 0 case c3__frog: p_sut = u3t(sut); { return _burn_in(van, u3h(p_sut), gil); } +#else + case c3__frog: p_sut = u3t(sut); + { + u3_noun fag = u3qf_grof(p_sut); + u3_noun ret = _burn_in(van, fag, gil); + + u3z(fag); + return ret; + } +#endif case c3__hold: p_sut = u3t(sut); { if ( (c3y == u3qdi_has(gil, sut)) ) { diff --git a/jets/f/ut_crop.c b/jets/f/ut_crop.c index 9d938648df..6f9eac34c9 100644 --- a/jets/f/ut_crop.c +++ b/jets/f/ut_crop.c @@ -3,6 +3,7 @@ */ #include "all.h" +#undef FROG /* logic */ @@ -34,6 +35,7 @@ } } +#ifdef FROG static u3_noun _crop_dext_frog(u3_noun van, u3_noun p_sut, u3_noun ref, u3_noun bix) { @@ -59,6 +61,7 @@ return zat; } } +#endif static u3_noun _crop_dext(u3_noun van, @@ -161,10 +164,22 @@ u3z(dat); return ret; } + +#ifdef FROG case c3__frog: p_sut = u3t(sut); { return u3qf_frog(_crop_dext_frog(van, p_sut, ref, bix)); } +#else + case c3__frog: p_sut = u3t(sut); + { + u3_noun fag = u3qf_grof(p_sut); + u3_noun ret = _crop_dext(van, fag, ref, bix); + + u3z(fag); + return ret; + } +#endif case c3__hold: p_sut = u3t(sut); { @@ -216,10 +231,21 @@ u3z(hin); return ret; } +#if 0 case c3__frog: p_ref = u3t(ref); { return _crop_sint_frog(van, sut, p_ref, bix); } +#else + case c3__frog: p_ref = u3t(ref); + { + u3_noun fag = u3qf_grof(p_ref); + u3_noun ret = _crop_sint(van, sut, p_ref, bix); + + u3z(fag); + return ret; + } +#endif case c3__hold: p_ref = u3t(ref); { u3_noun rep = u3qfu_repo(van, ref); diff --git a/jets/f/ut_find.c b/jets/f/ut_find.c index 1727523a19..50aeab6a11 100644 --- a/jets/f/ut_find.c +++ b/jets/f/ut_find.c @@ -8,9 +8,10 @@ u3_noun sut, u3_noun dep, u3_noun way, - u3_noun cug, + u3_noun hyp, u3_noun gil) { + } { @@ -55,7 +56,7 @@ u3_noun sut, u3_noun dep, u3_noun way, - u3_noun cug, + u3_noun hyp, u3_noun gil) { u3_noun p_sut, q_sut; diff --git a/jets/f/ut_fish.c b/jets/f/ut_fish.c index 13c9c87771..8089963bfc 100644 --- a/jets/f/ut_fish.c +++ b/jets/f/ut_fish.c @@ -3,12 +3,14 @@ */ #include "all.h" +#undef FROG /* functions */ static u3_noun _fish_in(u3_noun, u3_noun, u3_atom, u3_noun); +#ifdef FROG static u3_noun _fish_frog(u3_noun van, u3_noun p_sut, @@ -29,6 +31,7 @@ return pro; } } +#endif static u3_noun _fish_in(u3_noun van, @@ -115,10 +118,21 @@ return pro; } } +#ifdef FROG case c3__frog: { p_sut = u3t(sut); return _fish_frog(van, p_sut, axe, vit); } +#else + case c3__frog: p_sut = u3t(sut); + { + u3_noun fag = u3qf_grof(p_sut); + u3_noun ret = _fish_in(van, fag, axe, vit); + + u3z(fag); + return ret; + } +#endif case c3__hold: { p_sut = u3t(sut); { diff --git a/jets/f/ut_fuse.c b/jets/f/ut_fuse.c index 86e0b5bdb7..e573eb54dc 100644 --- a/jets/f/ut_fuse.c +++ b/jets/f/ut_fuse.c @@ -3,6 +3,7 @@ */ #include "all.h" +#undef FROG /* logic */ @@ -32,6 +33,7 @@ } } +#ifdef FROG static u3_noun _fuse_in_frog(u3_noun van, u3_noun p_sut, u3_noun ref, u3_noun bix) { @@ -43,6 +45,7 @@ _fuse_in_frog(van, u3t(p_sut), ref, bix)); } } +#endif static u3_noun _fuse_in(u3_noun van, @@ -143,10 +146,21 @@ u3z(dat); return ret; } +#ifdef FROG case c3__frog: p_sut = u3t(sut); { return _fuse_in_frog(van, p_sut, ref, bix); } +#else + case c3__frog: p_sut = u3t(sut); + { + u3_noun fag = u3qf_grof(p_sut); + u3_noun ret = _fuse_in(van, fag, ref, bix); + + u3z(fag); + return ret; + } +#endif case c3__hold: p_sut = u3t(sut); { u3_noun hud = u3nc(u3k(sut), u3k(ref)); diff --git a/jets/f/ut_nest.c b/jets/f/ut_nest.c index ec470eca1d..221e64146b 100644 --- a/jets/f/ut_nest.c +++ b/jets/f/ut_nest.c @@ -3,6 +3,7 @@ */ #include "all.h" +#undef FROG /* logic */ @@ -278,6 +279,7 @@ _nest_dext(van, q_sut, c3n, ref, seg, reg, gil)); } } +#ifdef FROG case c3__frog: p_sut = u3t(sut); { if ( c3n == u3du(ref) ) switch ( ref ) { @@ -304,6 +306,16 @@ } return c3n; } +#else + case c3__frog: p_sut = u3t(sut); + { + u3_noun fag = u3qf_grof(p_sut); + u3_noun ret = _nest_dext(van, fag, tel, ref, seg, reg, gil); + + u3z(fag); + return ret; + } +#endif case c3__hold: p_sut = u3t(sut); { if ( c3y == u3qdi_has(seg, sut) ) { @@ -349,7 +361,7 @@ if ( (c3y == tyn) || (c3n == tel) ) { return tyn; } else { -#if 0 +#ifdef FROG u3_noun dun = u3qfu_dunq(van, "need", sut); u3_noun niz = u3qfu_dunq(van, "have", ref); diff --git a/jets/f/ut_peek.c b/jets/f/ut_peek.c index e0cfa5155e..92af1a83b4 100644 --- a/jets/f/ut_peek.c +++ b/jets/f/ut_peek.c @@ -3,6 +3,7 @@ */ #include "all.h" +#undef FROG /* logic */ @@ -12,6 +13,7 @@ static u3_noun _peek_in(u3_noun, u3_noun, u3_noun, u3_atom, u3_noun); +#ifdef FROG static u3_noun _peek_frog(u3_noun van, u3_noun p_sut, u3_noun way, u3_noun axe, u3_noun gil) { @@ -23,6 +25,7 @@ _peek_frog(van, u3t(p_sut), way, axe, gil)); } } +#endif static u3_noun _peek_in(u3_noun van, @@ -127,11 +130,22 @@ return pro; } } +#ifdef FROG case c3__frog: { p_sut = u3t(sut); return _peek_frog(van, p_sut, way, axe, gil); } +#else + case c3__frog: p_sut = u3t(sut); + { + u3_noun fag = u3qf_grof(p_sut); + u3_noun ret = _peek_in(van, fag, way, axe, gil); + + u3z(fag); + return ret; + } +#endif case c3__hold: { p_sut = u3t(sut); if ( (c3y == u3qdi_has(gil, sut)) ) { diff --git a/jets/f/ut_wrap.c b/jets/f/ut_wrap.c index 0a559ee2f8..e87aaa58c0 100644 --- a/jets/f/ut_wrap.c +++ b/jets/f/ut_wrap.c @@ -3,8 +3,11 @@ */ #include "all.h" +#undef FROG + static u3_noun _cqfu_wrap(u3_noun, u3_noun, u3_noun); +#ifdef FROG static u3_noun _wrap_frog(u3_noun van, u3_noun p_sut, u3_noun yoz) { @@ -16,6 +19,7 @@ _wrap_frog(van, u3t(p_sut), yoz)); } } +#endif static u3_noun _cqfu_wrap(u3_noun van, @@ -50,13 +54,24 @@ } case c3__fork: u3x_cell(u3t(sut), &p_sut, &q_sut); { - return u3qf_fork(_cqfu_wrap(van, p_sut, yoz), + return u3qf_forq(_cqfu_wrap(van, p_sut, yoz), _cqfu_wrap(van, q_sut, yoz)); } +#ifdef FROG case c3__frog: p_sut = u3t(sut); { return u3qf_frog(_wrap_frog(van, p_sut, yoz)); } +#else + case c3__frog: p_sut = u3t(sut); + { + u3_noun fag = u3qf_grof(p_sut); + u3_noun ret = _cqfu_wrap(van, fag, yoz); + + u3z(fag); + return ret; + } +#endif case c3__hold: { u3_noun fop = u3qfu_repo(van, sut);