From 22313fbcf4cc93d55afafb21c2bda1f23b3cde10 Mon Sep 17 00:00:00 2001 From: Luke Patmore Date: Wed, 11 Jun 2014 13:16:34 -0700 Subject: [PATCH 1/4] Added macro expansions for bczp, brls, cncb, cnzy, and cnzz to ap.c --- gen164/6/ap.c | 47 +++++++++++++++++++++++++++++++++++++++++++---- include/c/motes.h | 3 +++ 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/gen164/6/ap.c b/gen164/6/ap.c index 42f8217506..fe5d017356 100644 --- a/gen164/6/ap.c +++ b/gen164/6/ap.c @@ -85,6 +85,15 @@ } /*** **** +***/ + _open_do_p(bczp) // $! + { + return u2_bt + (wir_r, c3__bccb, c3__axil, u2_rx(wir_r, p_gen)); + } + +/*** +**** ***/ _open_do_p(brhp) // |- { @@ -274,6 +283,15 @@ /*** **** ***/ + _open_do_pq(cncb) // %_ + { + return u2_bc + (wir_r, c3__ktls, + u2_bq(wir_r, u2_bc(wir_r, c3__cnzz, u2_rx(wir_r, p_gen)), + c3__cnts, + u2_rx(wir_r, p_gen), + u2_rx(wir_r, q_gen))); + } _open_do_pq(cncl) // %: { return u2_bq @@ -334,21 +352,30 @@ u2_bc(wir_r, u2_nul, _6)), u2_rx(wir_r, r_gen)))); } + _open_do_p(cnzy) // %cnzy + { + return u2_bt + (wir_r, c3__cnts, + u2_bc(wir_r, u2_rx(wir_r, p_gen), u2_nul), + u2_nul); + } + _open_do_p(cnzz) // %cnzz + { + return u2_bt + (wir_r, c3__cnts, u2_rx(wir_r, p_gen), u2_nul); + } /*** **** ***/ _open_do_pq(brcb) // |_ { - // [%brcb *] [%tsls [%bctr p.gen] [%brcn q.gen]] return u2_bt(wir_r, c3__tsls, u2_bc(wir_r, c3__bctr, u2_rx(wir_r, p_gen)), u2_bc(wir_r, c3__brcn, u2_rx(wir_r, q_gen))); } - _open_do_pq(brkt) // &- + _open_do_pq(brkt) // |^ { - // [%brkt *] [%tsgr [%brcn (~(put by q.gen) %% [%ash p.gen])] %%] - // u2_noun diz = u2_bc(wir_r, c3__ash, u2_rx(wir_r, p_gen)); u2_noun ret = u2_bt (wir_r, @@ -361,6 +388,13 @@ u2_rz(wir_r, diz); return ret; } + _open_do_pq(brls) // |+ + { + return u2_bc(wir_r, c3__ktbr, + u2_bt(wir_r, c3__brts, + u2_rx(wir_r, p_gen), + u2_rx(wir_r, q_gen))); + } /*** **** ***/ @@ -533,22 +567,27 @@ return u2_bl_bail(wir_r, c3__fail); \ } else return _open_in_##stem(wir_r, p_gen, q_gen, r_gen, s_gen); + _open_p (bczp); _open_p (brhp); _open_p (brdt); _open_pq (brcb); _open_pq (brkt); + _open_pq (brls); _open_pq (clcb); _open_pq (clhp); _open_pqrs(clkt); _open_pqr (clls); _open_p (cltr); _open_p (clsg); + _open_pq (cncb); _open_pq (cncl); _open_pq (cndt); _open_pqrs(cnkt); _open_pq (cnhp); _open_pqr (cnls); _open_pqr (cnsg); + _open_p (cnzy); + _open_p (cnzz); _open_pq (sgts); _open_pq (sgbr); _open_pq (sggl); diff --git a/include/c/motes.h b/include/c/motes.h index 1782a2921a..ca2536e4ff 100644 --- a/include/c/motes.h +++ b/include/c/motes.h @@ -41,6 +41,7 @@ # define c3__bbye c3_s4('b','b','y','e') # define c3__bcbn c3_s4('b','c','b','n') # define c3__bcbr c3_s4('b','c','b','r') +# define c3__bccb c3_s4('b','c','c','b') # define c3__bccn c3_s4('b','c','c','n') # define c3__bcdg c3_s4('b','c','d','g') # define c3__bckt c3_s4('b','c','k','t') @@ -51,6 +52,7 @@ # define c3__bcsg c3_s4('b','c','s','g') # define c3__bctr c3_s4('b','c','t','r') # define c3__bcts c3_s4('b','c','t','s') +# define c3__bczp c3_s4('b','c','z','p') # define c3__bead c3_s4('b','e','a','d') # define c3__bean c3_s4('b','e','a','n') # define c3__bear c3_s4('b','e','a','r') @@ -188,6 +190,7 @@ # define c3__cltr c3_s4('c','l','t','r') # define c3__cnbc c3_s4('c','n','b','c') # define c3__cnbr c3_s4('c','n','b','r') +# define c3__cncb c3_s4('c','n','c','b') # define c3__cncl c3_s4('c','n','c','l') # define c3__cndt c3_s4('c','n','d','t') # define c3__cnhp c3_s4('c','n','h','p') From f0f3c7bd574c987335a5183c3ef8c1ae08e0357e Mon Sep 17 00:00:00 2001 From: Luke Patmore Date: Wed, 11 Jun 2014 15:29:17 -0700 Subject: [PATCH 2/4] Added moar macro expansions to ap.c --- gen164/6/ap.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++- include/c/motes.h | 6 +++++ 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/gen164/6/ap.c b/gen164/6/ap.c index fe5d017356..6643c52fe7 100644 --- a/gen164/6/ap.c +++ b/gen164/6/ap.c @@ -364,7 +364,37 @@ return u2_bt (wir_r, c3__cnts, u2_rx(wir_r, p_gen), u2_nul); } - +/*** +**** +***/ + _open_do_p(hxgl) // #< + { + return u2_bq + (wir_r, c3__cnhp, + u2_bc(wir_r, c3__cnzy, c3__noah), + u2_bc(wir_r, c3__zpgr, + u2_bc(wir_r, c3__cltr, u2_rx(wir_r, p_gen))), + u2_nul); + } + _open_do_p(hxgr) // #> + { + return u2_bq + (wir_r, c3__cnhp, + u2_bc(wir_r, c3__cnzy, c3__cain), + u2_bc(wir_r, c3__zpgr, + u2_bc(wir_r, c3__cltr, u2_rx(wir_r, p_gen))), + u2_nul); + } +/*** +**** +***/ + _open_do_pq(ktdt) // ^. + { + return u2_bt + (wir_r, c3__ktls, + u2_bq(wir_r, c3__cnhp, u2_rx(wir_r, p_gen), u2_rx(wir_r, q_gen), u2_nul), + u2_rx(wir_r, q_gen)); + } /*** **** ***/ @@ -425,6 +455,15 @@ u2_bq(wir_r, c3__live, c3__dtzz, u2_blip, u2_rx(wir_r, p_gen)), u2_rx(wir_r, q_gen)); + } + _open_do_pq(sgcb) // ~_ + { + return u2_bt + (wir_r, c3__sggr, + u2_bc(wir_r, c3__mean, + u2_bc(wir_r, c3__brdt, + u2_rx(wir_r, p_gen))), + u2_rx(wir_r, q_gen)); } static u2_noun _sgcn_a(u2_wire wir_r, @@ -462,6 +501,15 @@ _sgcn_a(wir_r, r_gen, u2_nul))), u2_rx(wir_r, s_gen)); } + _open_do_pq(sgfs) // ~/ + { + return u2_bc + (wir_r, c3__sgcn, + u2_bq(wir_r, u2_rx(wir_r, p_gen), + u2_bc(wir_r, u2_nul, _7), + u2_nul, + u2_rx(wir_r, q_gen))); + } _open_do_pq(sgls) // ~+ { return u2_bt @@ -588,16 +636,27 @@ _open_pqr (cnsg); _open_p (cnzy); _open_p (cnzz); + + _open_p (hxgl); + _open_p (hxgr); + + _open_pq (ktdt); + _open_pq (sgts); _open_pq (sgbr); _open_pq (sggl); _open_pq (sgbc); + _open_pq (sgcb); _open_pqrs(sgcn); + _open_pq (sgfs); _open_pq (sgls); + _open_pq (smcl); + _open_pq (tsgl); _open_pq (tshp); _open_pq (tsls); + _open_pqr (wtdt); _open_pq (wtgl); _open_p (wtzp); diff --git a/include/c/motes.h b/include/c/motes.h index ca2536e4ff..f944601255 100644 --- a/include/c/motes.h +++ b/include/c/motes.h @@ -144,6 +144,7 @@ # define c3__by c3_s2('b','y') # define c3__byte c3_s4('b','y','t','e') # define c3__cage c3_s4('c','a','g','e') +# define c3__cain c3_s4('c','a','i','n') # define c3__call c3_s4('c','a','l','l') # define c3__can c3_s3('c','a','n') # define c3__cap c3_s3('c','a','p') @@ -503,6 +504,8 @@ # define c3__hunk c3_s4('h','u','n','k') # define c3__hxtr c3_s4('h','x','t','r') # define c3__hxts c3_s4('h','x','t','s') +# define c3__hxgl c3_s4('h','x','g','l') +# define c3__hxgr c3_s4('h','x','g','r') # define c3__ic c3_s2('i','c') # define c3__ice c3_s3('i','c','e') # define c3__if c3_s2('i','f') @@ -688,6 +691,7 @@ # define c3__nil c3_s3('n','i','l') # define c3__nilk c3_s4('n','i','l','k') # define c3__no c3_s2('n','o') +# define c3__noah c3_s4('n','o','a','h') # define c3__nock c3_s4('n','o','c','k') # define c3__none c3_s4('n','o','n','e') # define c3__nop c3_s3('n','o','p') @@ -876,6 +880,7 @@ # define c3__sgdp c3_s4('s','g','d','p') # define c3__sgdt c3_s4('s','g','d','t') # define c3__sgdx c3_s4('s','g','d','x') +# define c3__sgfs c3_s4('s','g','f','s') # define c3__sggl c3_s4('s','g','g','l') # define c3__sggr c3_s4('s','g','g','r') # define c3__sghp c3_s4('s','g','h','p') @@ -1139,6 +1144,7 @@ # define c3__zpdg c3_s4('z','p','d','g') # define c3__zpdx c3_s4('z','p','d','x') # define c3__zpfs c3_s4('z','p','f','s') +# define c3__zpgr c3_s4('z','p','g','r') # define c3__zphs c3_s4('z','p','h','x') # define c3__zphx c3_s4('z','p','h','x') # define c3__zplc c3_s4('z','p','l','c') From 43fb7819d6e6388e16761742f2f463a8795372e8 Mon Sep 17 00:00:00 2001 From: pcmonk Date: Wed, 11 Jun 2014 20:14:50 -0700 Subject: [PATCH 3/4] Added set and map union and intersection (uni,int) --- Makefile | 5 +- gen164/4/by.c | 4 +- gen164/4/by_int.c | 135 +++++++++++++++++++++++++++++++ gen164/4/by_mer.c | 106 ------------------------ gen164/4/by_uni.c | 109 +++++++++++++++++++++---- gen164/4/in.c | 6 +- gen164/4/{in_mer.c => in_int.c} | 63 +++++++-------- gen164/4/in_uni.c | 139 ++++++++++++++++++++++++++++++++ gen164/pit.h | 34 ++++++-- 9 files changed, 437 insertions(+), 164 deletions(-) create mode 100644 gen164/4/by_int.c delete mode 100644 gen164/4/by_mer.c rename gen164/4/{in_mer.c => in_int.c} (60%) create mode 100644 gen164/4/in_uni.c diff --git a/Makefile b/Makefile index 667ff9baf3..420d6d80e9 100644 --- a/Makefile +++ b/Makefile @@ -153,14 +153,15 @@ J164_4_OFILES=\ gen164/4/in.o \ gen164/4/by.o \ gen164/4/in_has.o \ + gen164/4/in_int.o \ gen164/4/in_gas.o \ - gen164/4/in_mer.o \ gen164/4/in_put.o \ gen164/4/in_tap.o \ + gen164/4/in_uni.o \ gen164/4/by_gas.o \ gen164/4/by_get.o \ gen164/4/by_has.o \ - gen164/4/by_mer.o \ + gen164/4/by_int.o \ gen164/4/by_put.o \ gen164/4/by_uni.o diff --git a/gen164/4/by.c b/gen164/4/by.c index 09226a2d03..878b075378 100644 --- a/gen164/4/by.c +++ b/gen164/4/by.c @@ -10,7 +10,7 @@ extern u2_ho_jet j2_mcj(Pt4, by, gas)[]; extern u2_ho_jet j2_mcj(Pt4, by, get)[]; extern u2_ho_jet j2_mcj(Pt4, by, has)[]; - extern u2_ho_jet j2_mcj(Pt4, by, mer)[]; + extern u2_ho_jet j2_mcj(Pt4, by, int)[]; extern u2_ho_jet j2_mcj(Pt4, by, put)[]; extern u2_ho_jet j2_mcj(Pt4, by, uni)[]; @@ -21,7 +21,7 @@ { j2_sc(Pt4, by, gas), j2_mcj(Pt4, by, gas), 0, 0, u2_none }, { j2_sc(Pt4, by, get), j2_mcj(Pt4, by, get), 0, 0, u2_none }, { j2_sc(Pt4, by, has), j2_mcj(Pt4, by, has), 0, 0, u2_none }, - { j2_sc(Pt4, by, mer), j2_mcj(Pt4, by, mer), 0, 0, u2_none }, + { j2_sc(Pt4, by, int), j2_mcj(Pt4, by, int), 0, 0, u2_none }, { j2_sc(Pt4, by, put), j2_mcj(Pt4, by, put), 0, 0, u2_none }, { j2_sc(Pt4, by, uni), j2_mcj(Pt4, by, uni), 0, 0, u2_none }, {} diff --git a/gen164/4/by_int.c b/gen164/4/by_int.c new file mode 100644 index 0000000000..3080dbf701 --- /dev/null +++ b/gen164/4/by_int.c @@ -0,0 +1,135 @@ +/* j/4/by_int.c +** +** This file is in the public domain. +*/ +#include "all.h" +#include "../pit.h" + +/* functions +*/ + u2_weak // transfer + j2_mcc(Pt4, by, int)(u2_wire wir_r, + u2_noun a, // retain + u2_noun b) // retain + { + if ( u2_nul == a ) { + return u2_rx(wir_r, u2_nul); + } + else if ( u2_nul == b ) { + return u2_rx(wir_r, u2_nul); + } + else { + u2_noun l_a, n_a, r_a, lr_a, p_n_a, q_n_a; + u2_noun l_b, n_b, r_b, lr_b, p_n_b, q_n_b; + + if ( (u2_no == u2_as_cell(a, &n_a, &lr_a)) ) { + return u2_bl_bail(wir_r, c3__exit); + } + else if ( (u2_no == u2_as_cell(b, &n_b, &lr_b)) ) { + return u2_bl_bail(wir_r, c3__exit); + } + else if ( u2_no == u2_as_cell(lr_a, &l_a, &r_a) ) { + return u2_bl_bail(wir_r, c3__exit); + } + else if ( u2_no == u2_as_cell(lr_b, &l_b, &r_b) ) { + return u2_bl_bail(wir_r, c3__exit); + } + else if ( u2_no == u2_as_cell(n_a, &p_n_a, &q_n_a) ) { + return u2_bl_bail(wir_r, c3__exit); + } + else if ( u2_no == u2_as_cell(n_b, &p_n_b, &q_n_b) ) { + return u2_bl_bail(wir_r, c3__exit); + } + else if ( u2_yes == j2_mbc(Pt3, vor)(wir_r, p_n_a, p_n_b) ) { + if ( u2_yes == u2_sing(p_n_a, p_n_b) ) { + return u2_rt( + wir_r, + u2_rx(wir_r, n_b), + j2_mcc(Pt4, by, int)(wir_r, u2_rx(wir_r, l_a), u2_rx(wir_r, l_b)), + j2_mcc(Pt4, by, int)(wir_r, u2_rx(wir_r, r_a), u2_rx(wir_r, r_b))); + } + else if ( u2_yes == j2_mbc(Pt3, hor)(wir_r, p_n_b, p_n_a) ) { + return j2_mcc(Pt4, by, uni)( + wir_r, + j2_mcc(Pt4, by, int)(wir_r, + u2_rx(wir_r, l_a), + u2_rt(wir_r, + u2_rx(wir_r, n_b), + u2_rx(wir_r, l_b), + u2_rx(wir_r, u2_nul))), + j2_mcc(Pt4, by, int)(wir_r, + u2_rx(wir_r, a), + u2_rx(wir_r, r_b))); + } + else { + return j2_mcc(Pt4, by, uni)( + wir_r, + j2_mcc(Pt4, by, int)(wir_r, + u2_rx(wir_r, r_a), + u2_rt(wir_r, + u2_rx(wir_r, n_b), + u2_rx(wir_r, u2_nul), + u2_rx(wir_r, r_b))), + j2_mcc(Pt4, by, int)(wir_r, + u2_rx(wir_r, a), + u2_rx(wir_r, l_b))); + } + } + else if ( u2_yes == u2_sing(p_n_b, p_n_a) ) { + return u2_rt( + wir_r, + u2_rx(wir_r, n_b), + j2_mcc(Pt4, by, int)(wir_r, u2_rx(wir_r, l_b), u2_rx(wir_r, l_a)), + j2_mcc(Pt4, by, int)(wir_r, u2_rx(wir_r, r_b), u2_rx(wir_r, r_a))); + } + else if ( u2_yes == j2_mbc(Pt3, hor)(wir_r, p_n_a, p_n_b) ) { + return j2_mcc(Pt4, by, uni)( + wir_r, + j2_mcc(Pt4, by, int)(wir_r, + u2_rx(wir_r, l_b), + u2_rt(wir_r, + u2_rx(wir_r, n_a), + u2_rx(wir_r, l_a), + u2_rx(wir_r, u2_nul))), + j2_mcc(Pt4, by, int)(wir_r, + u2_rx(wir_r, a), + u2_rx(wir_r, r_a))); + } + else { + return j2_mcc(Pt4, by, uni)( + wir_r, + j2_mcc(Pt4, by, int)(wir_r, + u2_rx(wir_r, r_b), + u2_rt(wir_r, + u2_rx(wir_r, n_a), + u2_rx(wir_r, u2_nul), + u2_rx(wir_r, r_a))), + j2_mcc(Pt4, by, int)(wir_r, + u2_rx(wir_r, a), + u2_rx(wir_r, l_a))); + } + } + } + u2_weak // transfer + j2_mc(Pt4, by, int)(u2_wire wir_r, + u2_noun cor) // retain + { + u2_noun a, b; + + if ( u2_no == u2_mean(cor, u2_cv_sam, &b, u2_cv_con_sam, &a, 0) ) { + return u2_bl_bail(wir_r, c3__exit); + } else { + return j2_mcc(Pt4, by, int)(wir_r, a, b); + } + } + +/* structures +*/ + u2_ho_jet + j2_mcj(Pt4, by, int)[] = { + { ".2", c3__lite, j2_mc(Pt4, by, int), Tier4, u2_none, u2_none }, + { } + }; + + + diff --git a/gen164/4/by_mer.c b/gen164/4/by_mer.c deleted file mode 100644 index f079043363..0000000000 --- a/gen164/4/by_mer.c +++ /dev/null @@ -1,106 +0,0 @@ -/* j/4/by_mer.c -** -** This file is in the public domain. -*/ -#include "all.h" -#include "../pit.h" - -/* functions -*/ - u2_weak // transfer - j2_mcc(Pt4, by, mer)(u2_wire wir_r, - u2_noun a, // retain - u2_noun b) // retain - { - if ( u2_nul == a ) { - return u2_rx(wir_r, b); - } - else if ( u2_nul == b ) { - return u2_rx(wir_r, a); - } - else { - u2_noun l_a, n_a, r_a, lr_a, p_n_a, q_n_a; - u2_noun l_b, n_b, r_b, lr_b, p_n_b, q_n_b; - u2_noun c; - - if ( (u2_no == u2_as_cell(a, &n_a, &lr_a)) ) { - return u2_bl_bail(wir_r, c3__exit); - } - else if ( (u2_no == u2_as_cell(b, &n_b, &lr_b)) ) { - return u2_bl_bail(wir_r, c3__exit); - } - else if ( (u2_no == u2_as_cell(n_a, &p_n_a, &q_n_a)) ) { - return u2_bl_bail(wir_r, c3__exit); - } - else if ( (u2_no == u2_as_cell(n_b, &p_n_b, &q_n_b)) ) { - return u2_bl_bail(wir_r, c3__exit); - } - else { - if ( u2_yes == j2_mbc(Pt3, vor)(wir_r, p_n_b, p_n_a) ) { - c = a; a = b; b = c; - c = n_a; n_a = n_b; n_b = c; - c = lr_a; lr_a = lr_b; lr_b = c; - c = p_n_a; p_n_a = p_n_b; p_n_b = c; - c = q_n_a; q_n_a = q_n_b; q_n_b = c; - } - if ( u2_no == u2_as_cell(lr_a, &l_a, &r_a) ) { - return u2_bl_bail(wir_r, c3__exit); - } - else if ( u2_no == u2_as_cell(lr_b, &l_b, &r_b) ) { - return u2_bl_bail(wir_r, c3__exit); - } - else if ( u2_yes == u2_sing(p_n_a, p_n_b) ) { - return u2_rt(wir_r, u2_rx(wir_r, n_b), - j2_mcc(Pt4, by, mer)(wir_r, l_a, l_b), - j2_mcc(Pt4, by, mer)(wir_r, r_a, r_b)); - } - else if ( u2_yes == j2_mbc(Pt3, hor)(wir_r, p_n_b, p_n_a) ) { - return j2_mcc(Pt4, by, mer)(wir_r, - u2_rt(wir_r, - n_a, - j2_mcc(Pt4, by, mer)(wir_r, - l_a, - u2_rt(wir_r, - n_b, - l_b, - u2_nul)), - r_a), - r_b); - } - else { - return j2_mcc(Pt4, by, mer)(wir_r, - u2_rt(wir_r, - n_a, - l_a, - j2_mcc(Pt4, by, mer)(wir_r, - r_a, - u2_rt(wir_r, - n_b, - u2_nul, - r_b))), - l_b); - } - } - } - } - u2_weak // transfer - j2_mc(Pt4, by, mer)(u2_wire wir_r, - u2_noun cor) // retain - { - u2_noun a, b; - - if ( u2_no == u2_mean(cor, u2_cv_sam, &b, u2_cv_con_sam, &a, 0) ) { - return u2_bl_bail(wir_r, c3__exit); - } else { - return j2_mcc(Pt4, by, mer)(wir_r, a, b); - } - } - -/* structures -*/ - u2_ho_jet - j2_mcj(Pt4, by, mer)[] = { - { ".2", c3__lite, j2_mc(Pt4, by, mer), Tier4, u2_none, u2_none }, - { } - }; - diff --git a/gen164/4/by_uni.c b/gen164/4/by_uni.c index 4de9cb9302..b2517506a8 100644 --- a/gen164/4/by_uni.c +++ b/gen164/4/by_uni.c @@ -1,4 +1,4 @@ -/* j/4/uni.c +/* j/4/by_uni.c ** ** This file is in the public domain. */ @@ -12,25 +12,105 @@ u2_noun a, // retain u2_noun b) // retain { - if ( u2_nul == b ) { - return u2k(a); + if ( u2_nul == a ) { + return u2_rx(wir_r, b); + } + else if ( u2_nul == b ) { + return u2_rx(wir_r, a); } else { - u2_noun l_b, n_b, r_b; - u2_noun pn_b, qn_b; + u2_noun l_a, n_a, r_a, lr_a, p_n_a, q_n_a; + u2_noun l_b, n_b, r_b, lr_b, p_n_b, q_n_b; - if ( (u2_no == u2_as_trel(b, &n_b, &l_b, &r_b)) || - (u2_no == u2_as_cell(n_b, &pn_b, &qn_b)) ) - { + if ( (u2_no == u2_as_cell(a, &n_a, &lr_a)) ) { return u2_bl_bail(wir_r, c3__exit); } + else if ( (u2_no == u2_as_cell(b, &n_b, &lr_b)) ) { + return u2_bl_bail(wir_r, c3__exit); + } + else if ( (u2_no == u2_as_cell(n_a, &p_n_a, &q_n_a)) ) { + return u2_bl_bail(wir_r, c3__exit); + } + else if ( (u2_no == u2_as_cell(n_b, &p_n_b, &q_n_b)) ) { + return u2_bl_bail(wir_r, c3__exit); + } + else if ( u2_no == u2_as_cell(lr_a, &l_a, &r_a) ) { + return u2_bl_bail(wir_r, c3__exit); + } + else if ( u2_no == u2_as_cell(lr_b, &l_b, &r_b) ) { + return u2_bl_bail(wir_r, c3__exit); + } + else if ( u2_yes == j2_mbc(Pt3, vor)(wir_r, p_n_a, p_n_b) ) { + if ( u2_yes == u2_sing(p_n_a, p_n_b) ) { + return u2_rt(wir_r, n_b, + j2_mcc(Pt4, by, uni)( + wir_r, u2_rx(wir_r, l_a), u2_rx(wir_r, l_b)), + j2_mcc(Pt4, by, uni)( + wir_r, u2_rx(wir_r, r_a), u2_rx(wir_r, r_b))); + } + else if ( u2_yes == j2_mbc(Pt3, hor)(wir_r, p_n_b, p_n_a) ) { + return j2_mcc(Pt4, by, uni)( + wir_r, + u2_rt(wir_r, + u2_rx(wir_r, n_a), + j2_mcc(Pt4, by, uni)(wir_r, + u2_rx(wir_r, l_a), + u2_rt(wir_r, + u2_rx(wir_r, n_b), + u2_rx(wir_r, l_b), + u2_rx(wir_r, u2_nul))), + u2_rx(wir_r, r_a)), + u2_rx(wir_r, r_b)); + } + else { + return j2_mcc(Pt4, by, uni)( + wir_r, + u2_rt(wir_r, + u2_rx(wir_r, n_a), + u2_rx(wir_r, l_a), + j2_mcc(Pt4, by, uni)(wir_r, + u2_rx(wir_r, r_a), + u2_rt(wir_r, + u2_rx(wir_r, n_b), + u2_rx(wir_r, u2_nul), + u2_rx(wir_r, r_b)))), + u2_rx(wir_r, l_b)); + } + } + else if ( u2_yes == u2_sing(p_n_b, p_n_a) ) { + return u2_rt( + wir_r, + u2_rx(wir_r, n_b), + j2_mcc(Pt4, by, uni)(wir_r, u2_rx(wir_r, r_b), u2_rx(wir_r, r_a)), + j2_mcc(Pt4, by, uni)(wir_r, u2_rx(wir_r, l_b), u2_rx(wir_r, l_a))); + } + else if ( u2_yes == j2_mbc(Pt3, hor)(wir_r, p_n_a, p_n_b) ) { + return j2_mcc(Pt4, by, uni)( + wir_r, + u2_rx(wir_r, r_a), + u2_rt(wir_r, + u2_rx(wir_r, n_b), + j2_mcc(Pt4, by, uni)(wir_r, + u2_rt(wir_r, + u2_rx(wir_r, n_a), + u2_rx(wir_r, l_a), + u2_rx(wir_r, u2_nul)), + u2_rx(wir_r, l_b)), + u2_rx(wir_r, r_b))); + } else { - u2_noun l = j2_mcc(Pt4, by, uni)(wir_r, a, l_b); - u2_noun r = j2_mcc(Pt4, by, uni)(wir_r, l, r_b); - u2_noun z = j2_mcc(Pt4, by, put)(wir_r, r, pn_b, qn_b); - - u2z(l); u2z(r); - return z; + return j2_mcc(Pt4, by, uni)( + wir_r, + u2_rx(wir_r, l_a), + u2_rt(wir_r, + u2_rx(wir_r, n_b), + u2_rx(wir_r, l_b), + j2_mcc(Pt4, by, uni)(wir_r, + u2_rx(wir_r, r_b), + u2_rt(wir_r, + u2_rx(wir_r, n_a), + u2_rx(wir_r, u2_nul), + u2_rx(wir_r, r_a))))); } } } @@ -54,3 +134,4 @@ { ".2", c3__lite, j2_mc(Pt4, by, uni), Tier4, u2_none, u2_none }, { } }; + diff --git a/gen164/4/in.c b/gen164/4/in.c index 9562f1a769..80a85bc857 100644 --- a/gen164/4/in.c +++ b/gen164/4/in.c @@ -9,9 +9,10 @@ */ extern u2_ho_jet j2_mcj(Pt4, in, gas)[]; extern u2_ho_jet j2_mcj(Pt4, in, has)[]; - extern u2_ho_jet j2_mcj(Pt4, in, mer)[]; + extern u2_ho_jet j2_mcj(Pt4, in, int)[]; extern u2_ho_jet j2_mcj(Pt4, in, put)[]; extern u2_ho_jet j2_mcj(Pt4, in, tap)[]; + extern u2_ho_jet j2_mcj(Pt4, in, uni)[]; /* structures */ @@ -19,9 +20,10 @@ j2_mbd(Pt4, in)[] = { { j2_sc(Pt4, in, gas), j2_mcj(Pt4, in, gas), 0, 0, u2_none }, { j2_sc(Pt4, in, has), j2_mcj(Pt4, in, has), 0, 0, u2_none }, - { j2_sc(Pt4, in, mer), j2_mcj(Pt4, in, mer), 0, 0, u2_none }, + { j2_sc(Pt4, in, int), j2_mcj(Pt4, in, int), 0, 0, u2_none }, { j2_sc(Pt4, in, put), j2_mcj(Pt4, in, put), 0, 0, u2_none }, { j2_sc(Pt4, in, tap), j2_mcj(Pt4, in, tap), 0, 0, u2_none }, + { j2_sc(Pt4, in, uni), j2_mcj(Pt4, in, uni), 0, 0, u2_none }, {} }; diff --git a/gen164/4/in_mer.c b/gen164/4/in_int.c similarity index 60% rename from gen164/4/in_mer.c rename to gen164/4/in_int.c index d40043d38b..1156962d69 100644 --- a/gen164/4/in_mer.c +++ b/gen164/4/in_int.c @@ -1,4 +1,4 @@ -/* j/4/in_mer.c +/* j/4/in_int.c ** ** This file is in the public domain. */ @@ -8,15 +8,15 @@ /* functions */ u2_weak // transfer - j2_mcc(Pt4, in, mer)(u2_wire wir_r, + j2_mcc(Pt4, in, int)(u2_wire wir_r, u2_noun a, // retain u2_noun b) // retain { if ( u2_nul == a ) { - return u2_rx(wir_r, b); + return u2_rx(wir_r, u2_nul); } else if ( u2_nul == b ) { - return u2_rx(wir_r, a); + return u2_rx(wir_r, u2_nul); } else { u2_noun l_a, n_a, r_a, lr_a; @@ -43,40 +43,38 @@ } else if ( u2_yes == u2_sing(n_a, n_b) ) { return u2_rt(wir_r, u2_rx(wir_r, n_a), - j2_mcc(Pt4, in, mer)(wir_r, l_a, l_b), - j2_mcc(Pt4, in, mer)(wir_r, r_a, r_b)); + j2_mcc(Pt4, in, int)(wir_r, l_a, l_b), + j2_mcc(Pt4, in, int)(wir_r, r_a, r_b)); } else if ( u2_yes == j2_mbc(Pt3, hor)(wir_r, n_b, n_a) ) { - return j2_mcc(Pt4, in, mer)(wir_r, - u2_rt(wir_r, - n_a, - j2_mcc(Pt4, in, mer)(wir_r, - l_a, - u2_rt(wir_r, - n_b, - l_b, - u2_nul)), - r_a), - r_b); + return j2_mcc(Pt4, in, uni)(wir_r, + j2_mcc(Pt4, in, int)(wir_r, + l_a, + u2_rt(wir_r, + n_b, + l_b, + u2_nul)), + j2_mcc(Pt4, in, int)(wir_r, + a, + r_b)); } else { - return j2_mcc(Pt4, in, mer)(wir_r, - u2_rt(wir_r, - n_a, - l_a, - j2_mcc(Pt4, in, mer)(wir_r, - r_a, - u2_rt(wir_r, - n_b, - u2_nul, - r_b))), - l_b); + return j2_mcc(Pt4, in, uni)(wir_r, + j2_mcc(Pt4, in, int)(wir_r, + r_a, + u2_rt(wir_r, + n_b, + u2_nul, + r_b)), + j2_mcc(Pt4, in, int)(wir_r, + a, + l_b)); } } } } u2_weak // transfer - j2_mc(Pt4, in, mer)(u2_wire wir_r, + j2_mc(Pt4, in, int)(u2_wire wir_r, u2_noun cor) // retain { u2_noun a, b; @@ -84,15 +82,16 @@ if ( u2_no == u2_mean(cor, u2_cv_sam, &b, u2_cv_con_sam, &a, 0) ) { return u2_bl_bail(wir_r, c3__exit); } else { - return j2_mcc(Pt4, in, mer)(wir_r, a, b); + return j2_mcc(Pt4, in, int)(wir_r, a, b); } } /* structures */ u2_ho_jet - j2_mcj(Pt4, in, mer)[] = { - { ".2", c3__lite, j2_mc(Pt4, in, mer), Tier4, u2_none, u2_none }, + j2_mcj(Pt4, in, int)[] = { + { ".2", c3__lite, j2_mc(Pt4, in, int), Tier4, u2_none, u2_none }, { } }; + diff --git a/gen164/4/in_uni.c b/gen164/4/in_uni.c new file mode 100644 index 0000000000..8a6273bc82 --- /dev/null +++ b/gen164/4/in_uni.c @@ -0,0 +1,139 @@ +/* j/4/in_uni.c +** +** This file is in the public domain. +*/ +#include "all.h" +#include "../pit.h" + +/* functions +*/ + u2_weak // transfer + j2_mcc(Pt4, in, uni)(u2_wire wir_r, + u2_noun a, // retain + u2_noun b) // retain + { + if ( u2_nul == a ) { + return u2_rx(wir_r, b); + } + else if ( u2_nul == b ) { + return u2_rx(wir_r, a); + } + else { + u2_noun l_a, n_a, r_a, lr_a; + u2_noun l_b, n_b, r_b, lr_b; + + if ( (u2_no == u2_as_cell(a, &n_a, &lr_a)) ) { + return u2_bl_bail(wir_r, c3__exit); + } + else if ( (u2_no == u2_as_cell(b, &n_b, &lr_b)) ) { + return u2_bl_bail(wir_r, c3__exit); + } + else { + if ( u2_yes == j2_mbc(Pt3, vor)(wir_r, n_a, n_b) ) { + if ( u2_no == u2_as_cell(lr_a, &l_a, &r_a) ) { + return u2_bl_bail(wir_r, c3__exit); + } + else if ( u2_no == u2_as_cell(lr_b, &l_b, &r_b) ) { + return u2_bl_bail(wir_r, c3__exit); + } + else if ( u2_yes == u2_sing(n_a, n_b) ) { + return u2_rt( + wir_r, + u2_rx(wir_r, n_b), + j2_mcc(Pt4, in, uni)(wir_r, u2_rx(wir_r, l_a), u2_rx(wir_r, l_b)), + j2_mcc(Pt4, in, uni)(wir_r, u2_rx(wir_r, r_a), u2_rx(wir_r, r_b))); + } + else if ( u2_yes == j2_mbc(Pt3, hor)(wir_r, n_b, n_a) ) { + return j2_mcc(Pt4, in, uni)( + wir_r, + u2_rt(wir_r, + u2_rx(wir_r, n_a), + j2_mcc(Pt4, in, uni)(wir_r, + u2_rx(wir_r, l_a), + u2_rt(wir_r, + u2_rx(wir_r, n_b), + u2_rx(wir_r, l_b), + u2_rx(wir_r, u2_nul))), + u2_rx(wir_r, r_a)), + u2_rx(wir_r, r_b)); + } + else { + return j2_mcc(Pt4, in, uni)( + wir_r, + u2_rt(wir_r, + u2_rx(wir_r, n_a), + u2_rx(wir_r, l_a), + j2_mcc(Pt4, in, uni)(wir_r, + u2_rx(wir_r, r_a), + u2_rt(wir_r, + u2_rx(wir_r, n_b), + u2_rx(wir_r, u2_nul), + u2_rx(wir_r, r_b)))), + u2_rx(wir_r, l_b)); + } + } + else if ( u2_no == u2_as_cell(lr_b, &l_b, &r_b) ) { + return u2_bl_bail(wir_r, c3__exit); + } + else if ( u2_no == u2_as_cell(lr_a, &l_a, &r_a) ) { + return u2_bl_bail(wir_r, c3__exit); + } + else if ( u2_yes == u2_sing(n_b, n_a) ) { + return u2_rt( + wir_r, + u2_rx(wir_r, n_b), + j2_mcc(Pt4, in, uni)(wir_r, u2_rx(wir_r, r_b), u2_rx(wir_r, r_a)), + j2_mcc(Pt4, in, uni)(wir_r, u2_rx(wir_r, l_b), u2_rx(wir_r, l_a))); + } + else if ( u2_yes == j2_mbc(Pt3, hor)(wir_r, n_a, n_b) ) { + return j2_mcc(Pt4, in, uni)( + wir_r, + u2_rx(wir_r, r_a), + u2_rt(wir_r, + u2_rx(wir_r, n_b), + j2_mcc(Pt4, in, uni)(wir_r, + u2_rt(wir_r, + u2_rx(wir_r, n_a), + u2_rx(wir_r, l_a), + u2_nul), + u2_rx(wir_r, l_b)), + u2_rx(wir_r, r_b))); + } + else { + return j2_mcc(Pt4, in, uni)( + wir_r, + u2_rx(wir_r, l_a), + u2_rt(wir_r, + u2_rx(wir_r, n_b), + u2_rx(wir_r, l_b), + j2_mcc(Pt4, in, uni)(wir_r, + u2_rt(wir_r, + u2_rx(wir_r, n_a), + u2_rx(wir_r, u2_nul), + u2_rx(wir_r, r_a)), + u2_rx(wir_r, r_b)))); + } + } + } + } + u2_weak // transfer + j2_mc(Pt4, in, uni)(u2_wire wir_r, + u2_noun cor) // retain + { + u2_noun a, b; + + if ( u2_no == u2_mean(cor, u2_cv_sam, &b, u2_cv_con_sam, &a, 0) ) { + return u2_bl_bail(wir_r, c3__exit); + } else { + return j2_mcc(Pt4, in, uni)(wir_r, a, b); + } + } + +/* structures +*/ + u2_ho_jet + j2_mcj(Pt4, in, uni)[] = { + { ".2", c3__lite, j2_mc(Pt4, in, uni), Tier4, u2_none, u2_none }, + { } + }; + diff --git a/gen164/pit.h b/gen164/pit.h index ab55fd54fb..e5b32f915f 100644 --- a/gen164/pit.h +++ b/gen164/pit.h @@ -294,11 +294,6 @@ /** Tier 4. **/ - u2_weak // transfer - j2_mcc(Pt4, in, put)(u2_wire wir_r, - u2_noun a, // retain - u2_noun b); // retain - u2_weak // transfer j2_mcc(Pt4, in, gas)(u2_wire wir_r, u2_noun a, // retain @@ -309,16 +304,42 @@ u2_noun a, // retain u2_noun b); // retain + u2_weak // transfer + j2_mcc(Pt4, in, int)(u2_wire wir_r, + u2_noun a, // retain + u2_noun b); // retain + + u2_weak // transfer + j2_mcc(Pt4, in, put)(u2_wire wir_r, + u2_noun a, // retain + u2_noun b); // retain + u2_weak // transfer j2_mcc(Pt4, in, tap)(u2_wire wir_r, u2_noun a, // retain u2_noun b); // retain + u2_weak // transfer + j2_mcc(Pt4, in, uni)(u2_wire wir_r, + u2_noun a, // retain + u2_noun b); // retain + + u2_noun // transfer j2_mcc(Pt4, by, get)(u2_wire wir_r, u2_noun a, // retain u2_noun b); // retain + u2_weak // transfer + j2_mcc(Pt4, by, gas)(u2_wire wir_r, + u2_noun a, // retain + u2_noun b); // retain + + u2_weak // transfer + j2_mcc(Pt4, by, int)(u2_wire wir_r, + u2_noun a, // retain + u2_noun b); // retain + u2_weak // transfer j2_mcc(Pt4, by, put)(u2_wire wir_r, u2_noun a, // retain @@ -326,9 +347,10 @@ u2_noun c); // retain u2_weak // transfer - j2_mcc(Pt4, by, gas)(u2_wire wir_r, + j2_mcc(Pt4, by, uni)(u2_wire wir_r, u2_noun a, // retain u2_noun b); // retain + /** Tier 5. **/ u2_noun // transfer From c10abf3e2546ee91c0efb1a27cac997cd9712c9e Mon Sep 17 00:00:00 2001 From: pcmonk Date: Wed, 11 Jun 2014 20:24:14 -0700 Subject: [PATCH 4/4] Fix memory bug in map union. --- gen164/4/by_uni.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gen164/4/by_uni.c b/gen164/4/by_uni.c index b2517506a8..f76e50a4ac 100644 --- a/gen164/4/by_uni.c +++ b/gen164/4/by_uni.c @@ -42,7 +42,7 @@ } else if ( u2_yes == j2_mbc(Pt3, vor)(wir_r, p_n_a, p_n_b) ) { if ( u2_yes == u2_sing(p_n_a, p_n_b) ) { - return u2_rt(wir_r, n_b, + return u2_rt(wir_r, u2_rx(wir_r, n_b), j2_mcc(Pt4, by, uni)( wir_r, u2_rx(wir_r, l_a), u2_rx(wir_r, l_b)), j2_mcc(Pt4, by, uni)(