Add test user-level jet.

This commit is contained in:
C. Guy Yarvin 2014-12-03 15:21:55 -08:00
parent afff845f97
commit b927a7bf78
6 changed files with 65 additions and 2 deletions

View File

@ -250,6 +250,9 @@ J_F_OFILES_UT=\
j/f/ut_tock.o \
j/f/ut_wrap.o
J_G_OFILES=\
j/g/sqar.o
J_OFILES=\
$(J_A_OFILES) \
$(J_B_OFILES) \
@ -259,6 +262,7 @@ J_OFILES=\
$(J_E_OFILES_ED) \
$(J_F_OFILES) \
$(J_F_OFILES_UT) \
$(J_G_OFILES) \
j/tree.o
BASE_OFILES=$(N_OFILES) $(J_OFILES)

View File

@ -195,3 +195,8 @@
u3_noun u3wfu_snub(u3_noun);
u3_noun u3wfu_tock(u3_noun);
u3_noun u3wfu_wrap(u3_noun);
/** Tier 7.
**/
u3_noun u3wg_sqar(u3_noun);

34
j/g/sqar.c Normal file
View File

@ -0,0 +1,34 @@
/* j/1/sqgr.c
**
** This file is in the public domain.
*/
#include "all.h"
/* functions
*/
u3_noun
u3qg_sqar(u3_atom a)
{
mpz_t a_mp;
fprintf(stderr, "C squared %d!\r\n", a);
u3r_mp(a_mp, a);
mpz_mul(a_mp, a_mp, a_mp);
return u3i_mp(a_mp);
}
u3_noun
u3wg_sqar(u3_noun cor)
{
u3_noun a;
if ( (u3_none == (a = u3r_at(u3x_sam, cor))) ||
(c3n == u3ud(a)) )
{
return u3m_bail(c3__exit);
} else {
return u3qg_sqar(a);
}
}

View File

@ -333,6 +333,24 @@ static u3j_harm _mood__hoon__al_a[] =
};
#endif
static u3j_harm _util_sqar_a[] = {{".2", u3wg_sqar, c3y}, {}};
static u3j_core _util_d[] =
{ { "sqar", _util_sqar_a },
{}
};
#if 0
static u3j_core _zuse_d[] =
{ { "util", 0, _util_d },
{}
};
#endif
static u3j_core _arvo_d[] =
{ { "util", 0, _util_d },
{}
};
static u3j_core _mood__hoon_d[] =
{ { "add", _mood__hoon_add_a },
{ "dec", _mood__hoon_dec_a },
@ -451,6 +469,7 @@ static u3j_core _mood__hoon_d[] =
{ "ap", _mood__hoon__ap_a },
// { "al", _mood__hoon__al_a },
{ "ut", _mood__hoon__ut_a, _mood__hoon__ut_d },
{ "arvo", 0, _arvo_d },
#endif
{}
};

3
n/j.c
View File

@ -764,7 +764,8 @@ _cj_mine(u3_noun cey, u3_noun cor)
#if 0
u3m_p("new jet", bal);
fprintf(stderr, "label %x, batt %x\r\n", u3r_mug(bal), u3r_mug(bat));
fprintf(stderr, "label %x, batt %x, jax %d\r\n",
u3r_mug(bal), u3r_mug(bat), jax_l);
#endif
u3h_put(u3R->jed.har_p,