u3: updates +end, +lsh, and +rsh jet interfaces

This commit is contained in:
Joe Bryan 2020-12-02 00:27:29 -08:00
parent 9e713a5e10
commit c082c2677a
5 changed files with 96 additions and 169 deletions

View File

@ -55,10 +55,8 @@
u3_noun u3wc_dor(u3_noun);
u3_noun u3wc_dvr(u3_noun);
u3_noun u3wc_end(u3_noun);
u3_noun u3wc_new_end(u3_noun);
u3_noun u3wc_gor(u3_noun);
u3_noun u3wc_lsh(u3_noun);
u3_noun u3wc_new_lsh(u3_noun);
u3_noun u3wc_mas(u3_noun);
u3_noun u3wc_met(u3_noun);
u3_noun u3wc_mix(u3_noun);
@ -72,7 +70,6 @@
u3_noun u3wc_rev(u3_noun);
u3_noun u3wc_rip(u3_noun);
u3_noun u3wc_rsh(u3_noun);
u3_noun u3wc_new_rsh(u3_noun);
u3_noun u3wc_swp(u3_noun);
u3_noun u3wc_sqt(u3_noun);

View File

@ -3,61 +3,41 @@
*/
#include "all.h"
u3_noun
u3qc_end(u3_atom a,
u3_atom b,
u3_atom c)
{
if ( !_(u3a_is_cat(a)) || (a >= 32) ) {
return u3m_bail(c3__fail);
}
else if ( !_(u3a_is_cat(b)) ) {
return u3k(c);
}
else {
c3_g a_g = a;
c3_w b_w = b;
c3_w len_w = u3r_met(a_g, c);
/* functions
*/
u3_noun
u3qc_end(u3_atom a,
u3_atom b,
u3_atom c)
{
if ( !_(u3a_is_cat(a)) || (a >= 32) ) {
return u3m_bail(c3__fail);
if ( 0 == b_w ) {
return 0;
}
else if ( !_(u3a_is_cat(b)) ) {
else if ( b_w >= len_w ) {
return u3k(c);
}
else {
c3_g a_g = a;
c3_w b_w = b;
c3_w len_w = u3r_met(a_g, c);
u3i_slab sab_u;
u3i_slab_init(&sab_u, a_g, b_w);
if ( 0 == b_w ) {
return 0;
}
else if ( b_w >= len_w ) {
return u3k(c);
}
else {
u3i_slab sab_u;
u3i_slab_init(&sab_u, a_g, b_w);
u3r_chop(a_g, 0, b_w, 0, sab_u.buf_w, c);
u3r_chop(a_g, 0, b_w, 0, sab_u.buf_w, c);
return u3i_slab_mint(&sab_u);
}
}
}
u3_noun
u3wc_end(u3_noun cor)
{
u3_noun a, b, c;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &a,
u3x_sam_6, &b,
u3x_sam_7, &c, 0)) ||
(c3n == u3ud(a)) ||
(c3n == u3ud(b)) ||
(c3n == u3ud(c)) )
{
return u3m_bail(c3__exit);
} else {
return u3qc_end(a, b, c);
return u3i_slab_mint(&sab_u);
}
}
}
u3_noun
u3wc_new_end(u3_noun cor)
u3wc_end(u3_noun cor)
{
u3_atom bloq, step;
u3_noun a, b;

View File

@ -3,71 +3,41 @@
*/
#include "all.h"
u3_noun
u3qc_lsh(u3_atom a,
u3_atom b,
u3_atom c)
{
if ( !_(u3a_is_cat(a)) || (a >= 32) ) {
return u3m_bail(c3__fail);
}
else if ( !_(u3a_is_cat(b)) ) {
return u3m_bail(c3__fail);
}
else {
c3_g a_g = a;
c3_w b_w = b;
c3_w len_w = u3r_met(a_g, c);
/* functions
*/
u3_noun
u3qc_lsh(u3_atom a,
u3_atom b,
u3_atom c)
{
if ( !_(u3a_is_cat(a)) || (a >= 32) ) {
return u3m_bail(c3__fail);
if ( 0 == len_w ) {
return 0;
}
else if ( !_(u3a_is_cat(b)) ) {
return u3m_bail(c3__fail);
else if ( (b_w + len_w) < len_w ) {
return u3m_bail(c3__exit);
}
else {
c3_g a_g = a;
c3_w b_w = b;
c3_w len_w = u3r_met(a_g, c);
u3i_slab sab_u;
u3i_slab_init(&sab_u, a_g, (b_w + len_w));
if ( 0 == len_w ) {
return 0;
}
else if ( (b_w + len_w) < len_w ) {
return u3m_bail(c3__exit);
}
else {
u3i_slab sab_u;
u3i_slab_init(&sab_u, a_g, (b_w + len_w));
u3r_chop(a_g, 0, len_w, b_w, sab_u.buf_w, c);
u3r_chop(a_g, 0, len_w, b_w, sab_u.buf_w, c);
return u3i_slab_mint(&sab_u);
}
return u3i_slab_mint(&sab_u);
}
}
u3_noun
u3wc_lsh(u3_noun cor)
{
u3_noun a, b, c;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &a,
u3x_sam_6, &b,
u3x_sam_7, &c, 0)) ||
(c3n == u3ud(a)) ||
(c3n == u3ud(b)) ||
(c3n == u3ud(c)) )
{
return u3m_bail(c3__exit);
} else {
return u3qc_lsh(a, b, c);
}
}
u3_noun
u3kc_lsh(u3_noun a,
u3_noun b,
u3_noun c)
{
u3_noun d = u3qc_lsh(a, b, c);
u3z(a); u3z(b); u3z(c);
return d;
}
}
u3_noun
u3wc_new_lsh(u3_noun cor)
u3wc_lsh(u3_noun cor)
{
u3_atom bloq, step;
u3_noun a, b;
@ -77,3 +47,14 @@ u3wc_new_lsh(u3_noun cor)
return u3qc_lsh(bloq, step, u3x_atom(b));
}
u3_noun
u3kc_lsh(u3_noun a,
u3_noun b,
u3_noun c)
{
u3_noun d = u3qc_lsh(a, b, c);
u3z(a); u3z(b); u3z(c);
return d;
}

View File

@ -3,68 +3,38 @@
*/
#include "all.h"
u3_noun
u3qc_rsh(u3_atom a,
u3_atom b,
u3_atom c)
{
if ( !_(u3a_is_cat(a)) || (a >= 32) ) {
return u3m_bail(c3__fail);
}
else if ( !_(u3a_is_cat(b)) ) {
return 0;
}
else {
c3_g a_g = a;
c3_w b_w = b;
c3_w len_w = u3r_met(a_g, c);
/* functions
*/
u3_noun
u3qc_rsh(u3_atom a,
u3_atom b,
u3_atom c)
{
if ( !_(u3a_is_cat(a)) || (a >= 32) ) {
return u3m_bail(c3__fail);
}
else if ( !_(u3a_is_cat(b)) ) {
if ( b_w >= len_w ) {
return 0;
}
else {
c3_g a_g = a;
c3_w b_w = b;
c3_w len_w = u3r_met(a_g, c);
u3i_slab sab_u;
u3i_slab_init(&sab_u, a_g, (len_w - b_w));
if ( b_w >= len_w ) {
return 0;
}
else {
u3i_slab sab_u;
u3i_slab_init(&sab_u, a_g, (len_w - b_w));
u3r_chop(a_g, b_w, (len_w - b_w), 0, sab_u.buf_w, c);
u3r_chop(a_g, b_w, (len_w - b_w), 0, sab_u.buf_w, c);
return u3i_slab_mint(&sab_u);
}
return u3i_slab_mint(&sab_u);
}
}
u3_noun
u3wc_rsh(u3_noun cor)
{
u3_noun a, b, c;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &a,
u3x_sam_6, &b,
u3x_sam_7, &c, 0)) ||
(c3n == u3ud(a)) ||
(c3n == u3ud(b)) ||
(c3n == u3ud(c)) )
{
return u3m_bail(c3__exit);
} else {
return u3qc_rsh(a, b, c);
}
}
u3_noun
u3kc_rsh(u3_noun a,
u3_noun b,
u3_noun c)
{
u3_noun d = u3qc_rsh(a, b, c);
u3z(a); u3z(b); u3z(c);
return d;
}
}
u3_noun
u3wc_new_rsh(u3_noun cor)
u3wc_rsh(u3_noun cor)
{
u3_atom bloq, step;
u3_noun a, b;
@ -74,3 +44,14 @@ u3wc_new_rsh(u3_noun cor)
return u3qc_rsh(bloq, step, u3x_atom(b));
}
u3_noun
u3kc_rsh(u3_noun a,
u3_noun b,
u3_noun c)
{
u3_noun d = u3qc_rsh(a, b, c);
u3z(a); u3z(b); u3z(c);
return d;
}

View File

@ -1503,10 +1503,6 @@ static c3_c* _141_two_end_ha[] = {
"45a0efc0c4ae4b93f554d480a9d2c52474d5ebd6b1b9b0ab888b9bee2117db55",
0
};
static u3j_harm _141_two_new_end_a[] = {{".2", u3wc_new_end, c3y}, {}};
static c3_c* _141_two_new_end_ha[] = {
0
};
static u3j_harm _141_two_gor_a[] = {{".2", u3wc_gor, c3y}, {}};
static c3_c* _141_two_gor_ha[] = {
"3ab7d6a56b8b347bd677a77ec43cda984d1eb869bab5c9bc2185f5c4a366703a",
@ -1517,10 +1513,6 @@ static c3_c* _141_two_lsh_ha[] = {
"a93f01f1db5bcaf1973d01234bbcec8f8adf9d6402a8d715a1b13b70a140a428",
0
};
static u3j_harm _141_two_new_lsh_a[] = {{".2", u3wc_new_lsh, c3y}, {}};
static c3_c* _141_two_new_lsh_ha[] = {
0
};
// XX appears to be a duplicate of _141_one_mas_a
//
static u3j_harm _141_two_mas_a[] = {{".2", u3wc_mas, c3y}, {}};
@ -1585,10 +1577,6 @@ static c3_c* _141_two_rsh_ha[] = {
"a401145b4c11ec8d17a729fe30f06c295865ffed1b970b0a788f0fec1ed0a703",
0
};
static u3j_harm _141_two_new_rsh_a[] = {{".2", u3wc_new_rsh, c3y}, {}};
static c3_c* _141_two_new_rsh_ha[] = {
0
};
static u3j_harm _141_two_swp_a[] = {{".2", u3wc_swp, c3y}, {}};
static c3_c* _141_two_swp_ha[] = {
"f809ed11a87db6cef8944c7252d53cda1e030240ee52912c3843d56805ac17fa",
@ -1857,11 +1845,11 @@ static u3j_core _141_two_d[] =
{ "dor", 7, _141_two_dor_a, 0, _141_two_dor_ha },
{ "dvr", 7, _141_two_dvr_a, 0, _141_two_dvr_ha },
{ "end", 7, _141_two_end_a, 0, _141_two_end_ha },
{ "new-end", 7, _141_two_new_end_a, 0, _141_two_new_end_ha },
{ "new-end", 7, _141_two_end_a, 0, _141_two_end_ha },
{ "gor", 7, _141_two_gor_a, 0, _141_two_gor_ha },
{ "jam", 7, _141_two_jam_a, 0, _141_two_jam_ha },
{ "lsh", 7, _141_two_lsh_a, 0, _141_two_lsh_ha },
{ "new-lsh", 7, _141_two_new_lsh_a, 0, _141_two_new_lsh_ha },
{ "new-lsh", 7, _141_two_lsh_a, 0, _141_two_lsh_ha },
{ "mas", 7, _141_two_mas_a, 0, _141_two_mas_ha },
{ "mat", 7, _141_two_mat_a, 0, _141_two_mat_ha },
{ "met", 7, _141_two_met_a, 0, _141_two_met_ha },
@ -1874,7 +1862,7 @@ static u3j_core _141_two_d[] =
{ "rev", 7, _141_two_rev_a, 0, _141_two_rev_ha },
{ "rip", 7, _141_two_rip_a, 0, _141_two_rip_ha },
{ "rsh", 7, _141_two_rsh_a, 0, _141_two_rsh_ha },
{ "new-rsh", 7, _141_two_new_rsh_a, 0, _141_two_new_rsh_ha },
{ "new-rsh", 7, _141_two_rsh_a, 0, _141_two_rsh_ha },
{ "swp", 7, _141_two_swp_a, 0, _141_two_swp_ha },
{ "rub", 7, _141_two_rub_a, 0, _141_two_rub_ha },
{ "peg", 7, _141_two_peg_a, 0, _141_two_peg_ha },