Merge branch 'release-candidate' into crypto-additions

This commit is contained in:
Fang 2018-09-28 12:02:05 -07:00 committed by GitHub
commit 97bc5ba400
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
82 changed files with 12015 additions and 1723 deletions

4
.gitmodules vendored
View File

@ -25,4 +25,6 @@
[submodule "subprojects/secp256k1"]
path = subprojects/secp256k1
url = https://github.com/urbit/secp256k1.git
[submodule "subprojects/libsni"]
path = subprojects/libsni
url = https://github.com/urbit/sniproxy

View File

@ -50,6 +50,7 @@
# 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__bcdt c3_s4('b','c','d','t')
# define c3__bckt c3_s4('b','c','k','t')
# define c3__bclc c3_s4('b','c','l','c')
# define c3__bcmt c3_s4('b','c','m','t')
@ -141,6 +142,7 @@
# define c3__brtg c3_s4('b','r','t','g')
# define c3__brtr c3_s4('b','r','t','r')
# define c3__brts c3_s4('b','r','t','s')
# define c3__brvt c3_s4('b','r','v','t')
# define c3__brwt c3_s4('b','r','w','t')
# define c3__brzp c3_s4('b','r','z','p')
# define c3__bud c3_s3('b','u','d')
@ -148,8 +150,9 @@
# define c3__bump c3_s4('b','u','m','p')
# define c3__bund c3_s4('b','u','n','d')
# define c3__bung c3_s4('b','u','n','g')
# define c3__bunt c3_s4('b','u','n','t')
# define c3__bunk c3_s4('b','u','n','k')
# define c3__bunt c3_s4('b','u','n','t')
# define c3__bunx c3_s4('b','u','n','x')
# define c3__burn c3_s4('b','u','r','n')
# define c3__busk c3_s4('b','u','s','k')
# define c3__bust c3_s4('b','u','s','t')
@ -237,6 +240,7 @@
# define c3__cook c3_s4('c','o','o','k')
# define c3__cool c3_s4('c','o','o','l')
# define c3__core c3_s4('c','o','r','e')
# define c3__corp c3_s4('c','o','r','p')
# define c3__corm c3_s4('c','o','r','m')
# define c3__cow c3_s3('c','o','w')
# define c3__cpu c3_s3('c','p','u')
@ -345,6 +349,7 @@
# define c3__dtwt c3_s4('d','t','w','t')
# define c3__dtzy c3_s4('d','t','z','y')
# define c3__dtzz c3_s4('d','t','z','z')
# define c3__dxkt c3_s4('d','x','k','t')
# define c3__dub c3_s3('d','u','b')
# define c3__duct c3_s4('d','u','c','t')
# define c3__dumb c3_s4('d','u','m','b')
@ -411,6 +416,7 @@
# define c3__forb c3_s4('f','o','r','b')
# define c3__fore c3_s4('f','o','r','e')
# define c3__fork c3_s4('f','o','r','k')
# define c3__form c3_s4('f','o','r','m')
# define c3__forq c3_s4('f','o','r','q')
# define c3__foul c3_s4('f','o','u','l')
# define c3__frag c3_s4('f','r','a','g')
@ -422,8 +428,8 @@
# define c3__fron c3_s4('f','r','o','n')
# define c3__fry c3_s3('f','r','y')
# define c3__fuge c3_s4('f','u','g','e')
# define c3__fume c3_s4('f','u','l','l')
# define c3__full c3_s4('f','u','m','e')
# define c3__fume c3_s4('f','u','m','e')
# define c3__full c3_s4('f','u','l','l')
# define c3__fun c3_s3('f','u','n')
# define c3__fund c3_s4('f','u','n','d')
# define c3__fung c3_s4('f','u','n','g')
@ -552,6 +558,7 @@
# define c3__i c3_s1('i')
# define c3__ic c3_s2('i','c')
# define c3__ice c3_s3('i','c','e')
# define c3__iced c3_s4('i','c','e','d')
# define c3__if c3_s2('i','f')
# define c3__ifix c3_s4('i','f','i','x')
# define c3__in c3_s2('i','n')
@ -1056,6 +1063,7 @@
# define c3__term c3_s4('t','e','r','m')
# define c3__test c3_s4('t','e','s','t')
# define c3__text c3_s4('t','e','x','t')
# define c3__that c3_s4('t','h','a','t')
# define c3__this c3_s4('t','h','i','s')
# define c3__thin c3_s4('t','h','i','n')
# define c3__thud c3_s4('t','h','u','d')
@ -1110,6 +1118,7 @@
# define c3__trop c3_s4('t','r','o','p')
# define c3__trup c3_s4('t','r','u','p')
# define c3__try c3_s3('t','r','y')
# define c3__tsbn c3_s4('t','s','b','n')
# define c3__tsbr c3_s4('t','s','b','r')
# define c3__tscl c3_s4('t','s','c','l')
# define c3__tscm c3_s4('t','s','c','m')
@ -1178,6 +1187,7 @@
# define c3__watt c3_s4('w','a','t','t')
# define c3__weak c3_s4('w','e','a','k')
# define c3__web c3_s3('w','e','b')
# define c3__wet c3_s3('w','e','t')
# define c3__werp c3_s4('w','e','r','p')
# define c3__west c3_s4('w','e','s','t')
# define c3__what c3_s4('w','h','a','t')
@ -1185,6 +1195,7 @@
# define c3__wild c3_s4('w','i','l','d')
# define c3__win c3_s3('w','i','n')
# define c3__wipe c3_s4('w','i','p','e')
# define c3__wise c3_s4('w','i','s','e')
# define c3__wish c3_s4('w','i','s','h')
# define c3__with c3_s4('w','i','t','h')
# define c3__wnut c3_s4('w','n','u','t')
@ -1247,6 +1258,7 @@
# define c3__zptm c3_s4('z','p','t','m')
# define c3__zpts c3_s4('z','p','t','s')
# define c3__zpvn c3_s4('z','p','v','n')
# define c3__zpvt c3_s4('z','p','v','t')
# define c3__zpzp c3_s4('z','p','z','p')
# define c3__zuse c3_s4('z','u','s','e')
# define c3__zush c3_s4('z','u','s','h')

View File

@ -221,7 +221,7 @@
u3_noun u3qf_forq(u3_noun, u3_noun);
u3_noun u3qf_fork(u3_noun);
u3_noun u3qf_grof(u3_noun);
u3_noun u3qf_help(u3_noun, u3_noun);
u3_noun u3qf_hint(u3_noun, u3_noun);
u3_noun u3qf_hike(u3_noun, u3_noun);
u3_noun u3qf_look(u3_noun, u3_noun);
u3_noun u3qf_loot(u3_noun, u3_noun);
@ -231,9 +231,11 @@
u3_noun u3qfl_bunt(u3_noun, u3_noun);
u3_noun u3qfl_whip(u3_noun, u3_noun, u3_noun);
u3_noun u3qfr_fish(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfp_hack(u3_noun, u3_noun);
u3_noun u3qfp_late(u3_noun);
u3_noun u3qfp_open(u3_noun, u3_noun);
u3_noun u3qfp_open(u3_noun, u3_noun, u3_noun);
u3_noun u3qfp_nepo(u3_noun, u3_noun);
u3_noun u3qfp_rake(u3_noun);
@ -255,6 +257,7 @@
u3_noun u3qfu_dunq(u3_noun, const c3_c*, u3_noun);
void u3qfu_dump(u3_noun, const c3_c*, u3_noun);
u3_noun u3qfu_fond(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_find(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_finc(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_fink(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_fire(u3_noun, u3_noun, u3_noun);
@ -299,7 +302,7 @@
u3_noun u3qz_forq(u3_noun, u3_noun);
u3_noun u3qz_fork(u3_noun);
u3_noun u3qz_grof(u3_noun);
u3_noun u3qz_help(u3_noun, u3_noun);
u3_noun u3qz_hint(u3_noun, u3_noun);
u3_noun u3qz_hike(u3_noun, u3_noun);
u3_noun u3qz_look(u3_noun, u3_noun);
u3_noun u3qz_loot(u3_noun, u3_noun);
@ -309,12 +312,15 @@
u3_noun u3qzl_bunt(u3_noun, u3_noun);
u3_noun u3qzl_whip(u3_noun, u3_noun, u3_noun);
u3_noun u3qzr_fish(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qzp_hack(u3_noun, u3_noun);
u3_noun u3qzp_late(u3_noun);
u3_noun u3qzp_open(u3_noun, u3_noun);
u3_noun u3qzp_nepo(u3_noun, u3_noun);
u3_noun u3qzp_open(u3_noun, u3_noun, u3_noun);
u3_noun u3qzp_rake(u3_noun);
void u3qf_test(const c3_c*, u3_noun);
# define u3qzu_van_fan 28
# define u3qzu_van_rib 58
# define u3qzu_van_vrf 59
@ -333,6 +339,7 @@
u3_noun u3qzu_dunq(u3_noun, const c3_c*, u3_noun);
void u3qzu_dump(u3_noun, const c3_c*, u3_noun);
u3_noun u3qzu_fond(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qzu_find(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qzu_finc(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qzu_fink(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qzu_fire(u3_noun, u3_noun, u3_noun);

View File

@ -246,7 +246,7 @@
u3_noun u3wf_flor(u3_noun);
u3_noun u3wf_forq(u3_noun);
u3_noun u3wf_fork(u3_noun);
u3_noun u3wf_help(u3_noun);
u3_noun u3wf_hint(u3_noun);
u3_noun u3wf_hike(u3_noun);
u3_noun u3wf_look(u3_noun);
u3_noun u3wf_loot(u3_noun);

View File

@ -19,6 +19,8 @@
# define u3x_sam_7 27
# define u3x_sam_14 54
# define u3x_sam_15 55
# define u3x_sam_30 110
# define u3x_sam_31 111
# define u3x_con 7 // context
# define u3x_con_2 14 // context
# define u3x_con_3 15 // context

View File

@ -16,7 +16,6 @@
/** Data types.
**/
struct _u3_http;
/* u3_hhed: http header.
*/
@ -50,8 +49,10 @@
h2o_req_t* rec_u; // h2o request
c3_w seq_l; // sequence within connection
u3_rsat sat_e; // request state
uv_timer_t* tim_u; // timeout
struct _u3_hcon* hon_u; // connection backlink
struct _u3_hreq* nex_u; // next in connection's list
struct _u3_hreq* pre_u; // next in connection's list
} u3_hreq;
/* u3_hcon: incoming http connection.
@ -66,26 +67,113 @@
struct _u3_http* htp_u; // server backlink
struct _u3_hreq* req_u; // request list
struct _u3_hcon* nex_u; // next in server's list
struct _u3_hcon* pre_u; // next in server's list
} u3_hcon;
/* u3_http: http server.
*/
typedef struct _u3_http {
uv_tcp_t wax_u; // server stream handler
h2o_globalconf_t* fig_u; // h2o global config
h2o_context_t* ctx_u; // h2o ctx
h2o_accept_ctx_t* cep_u; // h2o accept ctx (wat for?)
h2o_hostconf_t* hos_u; // h2o host config
h2o_handler_t* han_u; // h2o request handler
void* h2o_u; // libh2o configuration
struct _u3_prox* rox_u; // maybe proxied
c3_w sev_l; // server number
c3_w coq_l; // next connection number
c3_w por_w; // running port
c3_s por_s; // running port
c3_o sec; // logically secure
c3_o lop; // loopback-only
c3_o liv; // c3n == shutdown
struct _u3_hcon* hon_u; // connection list
struct _u3_http* nex_u; // next in list
} u3_http;
/* u3_form: http config from %eyre
*/
typedef struct _u3_form {
c3_o pro; // proxy
c3_o log; // keep access log
c3_o red; // redirect to HTTPS
uv_buf_t key_u; // PEM RSA private key
uv_buf_t cer_u; // PEM certificate chain
} u3_form;
/* u3_hfig: general http configuration
*/
typedef struct _u3_hfig {
u3_form* for_u; // config from %eyre
struct _u3_warc* cli_u; // rev proxy clients
struct _u3_pcon* con_u; // cli_u connections
} u3_hfig;
/* u3_proxy_type: proxy connection downstream type
*/
typedef enum {
u3_ptyp_prox = 0, // connected to us
u3_ptyp_ward = 1 // we connected back to
} u3_proxy_type;
/* u3_pcon: established proxy connection
*/
typedef struct _u3_pcon {
uv_tcp_t don_u; // downstream handle
uv_tcp_t* upt_u; // upstream handle
uv_buf_t buf_u; // pending buffer
c3_o sec; // yes == https
u3_proxy_type typ_e; // tagged
union { // union
struct _u3_warc* cli_u; // typ_e == ward
struct _u3_prox* lis_u; // typ_e == prox
} src_u; // connection source
struct _u3_pcon* nex_u; // next in list
struct _u3_pcon* pre_u; // previous in list
} u3_pcon;
/* u3_warc: server connecting back to u3_ward as client
*/
typedef struct _u3_warc {
c3_w ipf_w; // ward ip
c3_s por_s; // ward port
c3_o sec; // secure connection
u3_atom sip; // ward ship
c3_c* hot_c; // ward hostname
uv_buf_t non_u; // nonce
struct _u3_http* htp_u; // local server backlink
struct _u3_warc* nex_u; // next in list
struct _u3_warc* pre_u; // previous in list
} u3_warc;
/* u3_wcon: candidate u3_ward upstream connection
*/
typedef struct _u3_wcon {
uv_tcp_t upt_u; // connection handle
struct _u3_ward* rev_u; // connecting to ward
struct _u3_wcon* nex_u; // next in list
} u3_wcon;
/* u3_ward: reverse, reverse TCP proxy (ship-specific listener)
*/
typedef struct _u3_ward {
uv_tcp_t tcp_u; // listener handle
uv_timer_t tim_u; // expiration timer
u3_atom sip; // reverse proxy for ship
c3_s por_s; // listening on port
uv_buf_t non_u; // nonce
struct _u3_wcon* won_u; // candidate upstream connections
struct _u3_pcon* con_u; // initiating connection
struct _u3_ward* nex_u; // next in list
struct _u3_ward* pre_u; // previous in list
} u3_ward;
/* u3_prox: reverse TCP proxy server
*/
typedef struct _u3_prox {
uv_tcp_t sev_u; // server handle
c3_s por_s; // listening on port
c3_o sec; // yes == https
struct _u3_http* htp_u; // local server backlink
struct _u3_pcon* con_u; // active connection list
struct _u3_ward* rev_u; // active reverse listeners
} u3_prox;
/* u3_csat: client connection state.
*/
typedef enum {
@ -146,15 +234,17 @@
void* tls_u; // client SSL_CTX*
} u3_cttp;
/* u3_apac: ames packet, coming or going.
/* u3_pact: ames packet, coming or going.
*/
typedef struct _u3_apac {
struct _u3_apac* nex_u; // next in queue
c3_w pip_w; // IPv4 address, to
c3_s por_s; // IPv4 port, to
typedef struct _u3_pact {
uv_udp_send_t snd_u; // udp send request
c3_w pip_w; // target IPv4 address
c3_s por_s; // target port
c3_w len_w; // length in bytes
c3_y hun_y[0]; // data
} u3_apac;
c3_y* hun_y; // packet buffer
c3_y imp_y; // galaxy number (optional)
c3_c* dns_c; // galaxy fqdn (optional)
} u3_pact;
/* u3_ames: ames networking.
*/
@ -527,6 +617,7 @@
c3_c* dir_c; // pier path (no trailing /)
c3_d now_d; // event tick
uv_loop_t* lup_u; // libuv event loop
u3_hfig fig_u; // http configuration
u3_http* htp_u; // http servers
u3_cttp ctp_u; // http clients
u3_utel tel_u; // telnet listener
@ -971,6 +1062,16 @@
/** HTTP server.
**/
/* u3_http_ef_form: send %from effect to http.
*/
void
u3_http_ef_form(u3_noun fig);
/* u3_http_ef_that: send %that effect to http.
*/
void
u3_http_ef_that(u3_noun tat);
/* u3_http_ef_thou(): send %thou effect to http.
*/
void

View File

@ -11,7 +11,7 @@
u3_noun u3wfp_hack(u3_noun);
static u3_noun
_ap_open_l(u3_noun, u3_noun);
_ap_open_l(u3_noun, u3_noun, u3_noun);
// make sure these match the array below!
//
@ -511,6 +511,7 @@
u3qdb_put(q_gen, u3_blip, diz)),
u3nc(c3__cnzy, u3_blip));
c3_assert(0);
u3z(diz);
return ret;
}
@ -996,18 +997,51 @@
return u3i_molt(gat, u3x_sam, u3k(gen), 0);
}
static u3_noun
_ar_core(u3_noun van,
u3_noun ref,
u3_noun syn)
{
u3_noun gat = u3j_hook(u3k(van), "ar");
return u3i_molt(gat, u3x_sam, u3nc(u3k(ref), u3k(syn)), 0);
}
/* fish
*/
u3_noun
u3qfr_fish(u3_noun van,
u3_noun ref,
u3_noun syn,
u3_noun axe)
{
u3_noun gat = u3j_soft(_ar_core(van, ref, syn), "fish");
return u3n_kick_on(u3i_molt(gat,
u3x_sam,
u3k(axe),
0));
}
/* open
*/
static u3_noun
_ap_open_n(u3_noun ter,
u3_noun fab,
u3_noun gen)
{
u3_noun cor = _ap_core(ter, gen);
#if 1
if ( c3n == fab ) {
cor = u3i_molt(cor, 14, c3n, 0);
}
#endif
return u3j_soft(cor, "open");
}
static u3_noun
_ap_open_l(u3_noun ter,
u3_noun fab,
u3_noun gen)
{
#if 0
@ -1019,22 +1053,16 @@
return _ap_open_n(ter, gen);
}
#else
return _ap_open_n(ter, gen);
return _ap_open_n(ter, fab, gen);
#endif
}
u3_noun
u3qfp_open(u3_noun ter,
u3_noun fab,
u3_noun gen)
{
return _ap_open_l(ter, gen);
}
u3_noun
u3qfp_nepo(u3_noun ter,
u3_noun gen)
{
return _ap_open_l(ter, gen);
return _ap_open_l(ter, fab, gen);
}
u3_noun
@ -1047,7 +1075,7 @@
} else {
u3_noun ter = u3r_at(u3x_con, cor);
return u3qfp_open(ter, gen);
return u3qfp_open(ter, c3y, gen);
}
}

View File

@ -18,6 +18,7 @@
u3k(p_vur),
u3k(p_sed));
}
#if 0
else if ( c3y == u3r_p(vur, 0, &p_vur) &&
c3y == u3r_p(sed, 0, &p_sed) &&
!(c3y == u3r_sing(1, p_vur)) &&
@ -37,6 +38,7 @@
u3z(nof);
}
}
#endif
return u3nc(u3k(vur), u3k(sed));
}
u3_noun

View File

@ -13,6 +13,19 @@
if ( (c3__void == pac) ) {
return c3__void;
} else {
{
u3_noun p_con, q_con, r_con, hr_con, tr_con;
u3r_trel(con, &p_con, &q_con, &r_con);
u3r_cell(r_con, &hr_con, &tr_con);
if ( (c3y == u3du(hr_con)) &&
(u3_nul == u3h(hr_con)) &&
(u3_nul == u3t(hr_con)) )
{
fprintf(stderr, "old core\r\n");
abort();
}
}
return u3nt(c3__core, u3k(pac), u3k(con));
}
}
@ -27,3 +40,79 @@
return u3qf_core(pac, con);
}
}
#if 0
static void
_fork_test(const c3_c *lab_c, u3_noun set)
{
if ( u3_nul == set ) {
return;
} else {
u3_noun n_set, l_set, r_set;
u3x_trel(set, &n_set, &l_set, &r_set);
u3qf_test(lab_c, n_set);
_fork_test(lab_c, l_set);
_fork_test(lab_c, r_set);
}
}
void
u3qf_test(const c3_c* lab_c, u3_noun sut)
{
u3_noun p_sut, q_sut;
if ( c3n == u3du(sut) ) switch ( sut ) {
default: u3m_bail(c3__fail); return;
case c3__noun:
{
return;
}
case c3__void:
{
return;
}
}
else switch ( u3h(sut) ) {
default: u3m_bail(c3__fail); return;
case c3__atom: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
return;
}
case c3__cell: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3qf_test(lab_c, p_sut);
u3qf_test(lab_c, q_sut);
return;
}
case c3__core: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3qf_test(lab_c, p_sut);
return;
}
case c3__face: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3qf_test(lab_c, q_sut);
return;
}
case c3__fork: p_sut = u3t(sut);
{
_fork_test(lab_c, p_sut);
return;
}
case c3__hint: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3qf_test(lab_c, q_sut);
u3qf_test(lab_c, u3h(p_sut));
return;
}
case c3__hold: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3qf_test(lab_c, p_sut);
return;
}
}
}
#endif

View File

@ -10,6 +10,9 @@
u3qf_flan(u3_noun bos,
u3_noun nif)
{
if ( c3y == u3r_sing(bos, nif) ) {
return u3k(bos);
}
if ( c3y == u3r_sing(1, u3h(bos)) ) {
if ( (u3_nul == u3t(bos)) ) {
return u3k(nif);

View File

@ -10,6 +10,9 @@
u3qf_flor(u3_noun bos,
u3_noun nif)
{
if ( c3y == u3r_sing(bos, nif) ) {
return u3k(bos);
}
if ( c3y == u3r_sing(1, u3h(bos)) ) {
if ( (u3_nul == u3t(bos)) ) {
return u3k(bos);

32
jets/f/hint.c Normal file
View File

@ -0,0 +1,32 @@
/* j/6/help.c
**
*/
#include "all.h"
/* functions
*/
u3_noun
u3qf_hint(u3_noun sag,
u3_noun tip)
{
if ( c3__void == tip ) {
return c3__void;
}
if ( c3__noun == tip ) {
return c3__noun;
}
else return u3nt(c3__hint, u3k(sag), u3k(tip));
}
u3_noun
u3wf_hint(u3_noun cor)
{
u3_noun sag, tip;
if ( c3n == u3r_mean(cor, u3x_sam_2, &sag, u3x_sam_3, &tip, 0) ) {
return u3m_bail(c3__fail);
} else {
return u3qf_hint(sag, tip);
}
}

View File

@ -19,7 +19,9 @@
u3r_trel(dab, &n_dab, &l_dab, &r_dab);
if ( c3n == u3du(n_dab) ) {
return u3m_bail(c3__fail);
// return u3m_bail(c3__fail);
fprintf(stderr, "bad look\r\n");
return u3m_bail(c3__exit) ;
}
else {
u3_noun pn_dab = u3h(n_dab);

View File

@ -35,7 +35,10 @@
case c3__fork: p_sut = u3t(sut);
{
}
case c3__hold: p_sut = u3t(sut);
case c3__hint: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
}
case c3__hold: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
}
}

View File

@ -1,192 +0,0 @@
/* j/6/ut_burn.c
**
*/
#include "all.h"
/* logic
*/
static u3_noun
_burn_in(u3_noun van, u3_noun sut, u3_noun gil);
static u3_noun
_burn_fork(u3_noun van,
u3_noun yed,
u3_noun gil)
{
if ( u3_nul == yed ) {
return u3_nul;
} else {
u3_noun dis = _burn_in(van, u3h(yed), gil);
u3_noun mor = _burn_fork(van, u3t(yed), gil);
if ( u3_nul == dis ) return mor;
if ( u3_nul == mor ) return dis;
{
u3_noun u_dis = u3t(dis);
u3_noun u_mor = u3t(mor);
if ( u3du(u_dis) == u3du(u_mor) ) {
if ( c3y == u3qc_gor(u_mor, u_dis) ) {
u3z(dis);
return mor;
} else {
u3z(mor);
return dis;
}
} else {
if ( c3y == u3ud(u_dis) ) {
u3z(mor);
return dis;
}
else {
u3z(dis);
return mor;
}
}
}
}
}
static u3_noun
_burn_in(u3_noun van,
u3_noun sut,
u3_noun gil)
{
u3_noun p_sut, q_sut, pq_sut, qq_sut, rq_sut, sq_sut, psq_sut, qsq_sut;
if ( c3n == u3du(sut) ) switch ( sut ) {
default: return u3m_bail(c3__fail);
case c3__noun: return u3nc(u3_nul, 0);
case c3__void: {
return u3_nul;
}
}
else switch ( u3h(sut) ) {
default: return u3m_bail(c3__fail);
case c3__atom: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
if ( c3y == u3du(q_sut) ) {
return u3nc(u3_nul, u3k(u3t(q_sut)));
} else {
return u3nc(u3_nul, 0);
}
}
case c3__cell: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3_noun hed = _burn_in(van, p_sut, gil);
if ( u3_nul == hed ) {
return u3_nul;
}
else {
u3_noun tal = _burn_in(van, q_sut, gil);
if ( u3_nul == tal ) {
u3z(hed);
return u3_nul;
}
else {
u3_noun ret = u3nt(u3_nul, u3k(u3t(hed)), u3k(u3t(tal)));
u3z(hed);
u3z(tal);
return ret;
}
}
}
case c3__core: u3x_cell(u3t(sut), &p_sut, &q_sut);
u3x_qual(q_sut, &pq_sut, &qq_sut, &rq_sut, &sq_sut);
u3x_cell(sq_sut, &psq_sut, &qsq_sut);
{
u3_noun pay = _burn_in(van, p_sut, gil);
if ( u3_nul == pay ) {
return u3_nul;
}
else {
u3_noun ret = u3nt(u3_nul, u3k(psq_sut), u3k(u3t(pay)));
u3z(pay);
return ret;
}
}
case c3__help:
case c3__face: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
return _burn_in(van, q_sut, gil);
}
case c3__fork: p_sut = u3t(sut);
{
u3_noun yed = u3qdi_tap(p_sut);
u3_noun ret = _burn_fork(van, yed, gil);
u3z(yed);
return ret;
}
case c3__hold:
{
if ( (c3y == u3qdi_has(gil, sut)) ) {
return u3_nul;
}
else {
u3_noun zoc = u3qdi_put(gil, sut);
u3_noun fop = u3qfu_repo(van, sut);
u3_noun pro = _burn_in(van, fop, zoc);
u3z(fop);
u3z(zoc);
return pro;
}
}
}
}
static u3_noun
_cqfu_burn(u3_noun van,
u3_noun sut)
{
u3_noun unt = _burn_in(van, sut, u3_nul);
if ( u3_nul == unt ) {
return u3m_error("burn");
}
else {
u3_noun ret = u3k(u3t(unt));
u3z(unt);
return ret;
}
}
u3_noun
u3qfu_burn(u3_noun van,
u3_noun sut)
{
c3_m fun_m = 144 + c3__burn + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find(fun_m, sut);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqfu_burn(van, sut);
return u3z_save(fun_m, sut, pro);
}
}
u3_noun
u3wfu_burn(u3_noun cor)
{
u3_noun sut;
if ( u3_none == (sut = u3r_at(u3x_sam, cor)) ) {
return u3m_bail(c3__fail);
} else {
return u3qfu_burn(cor, sut);
}
}

View File

@ -12,10 +12,8 @@
u3_noun got)
{
if ( c3y == u3ud(got) ) {
u3_noun nux = u3nc(u3_nul, u3k(got));
u3_noun ret = u3qf_face(nux, sut);
u3_noun ret = u3qf_face(u3k(got), sut);
u3z(nux);
return ret;
}
else switch ( u3h(got) ) {

View File

@ -142,10 +142,10 @@
}
else return _crop_sint(van, sut, ref, bix);
}
case c3__help: u3x_cell(u3t(sut), &p_sut, &q_sut);
case c3__hint: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3_noun foz = _crop_dext(van, q_sut, ref, bix);
u3_noun ret = u3qf_help(p_sut, foz);
u3_noun ret = u3qf_hint(p_sut, foz);
u3z(foz);
return ret;
@ -204,7 +204,7 @@
default: return u3m_bail(c3__fail);
case c3__core:
case c3__help:
case c3__hint:
case c3__face: u3x_cell(u3t(ref), &p_ref, &q_ref);
{
return _crop_dext(van, sut, q_ref, bix);
@ -257,7 +257,7 @@
u3_noun sut,
u3_noun ref)
{
c3_m fun_m = 144 + c3__crop + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
c3_m fun_m = 141 + c3__crop + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_2(fun_m, sut, ref);
if ( u3_none != pro ) {

View File

@ -69,9 +69,8 @@
u3_noun gil)
{
if ( 0 == p_heg ) {
return u3nq
return u3nt
(c3y,
u3_nul,
u3nt(u3_nul,
u3nc(u3_nul, u3k(axe)),
u3k(lon)),
@ -83,17 +82,6 @@
}
}
static u3_noun
_find_join(u3_noun a,
u3_noun b)
{
if ( c3y == u3r_sing(a, b) ) {
return u3k(a);
} else {
return u3kb_weld(u3k(a), u3nc(c3_s2('|', '|'), u3k(b)));
}
}
static u3_noun
_find_buck_lose(u3_noun van,
u3_noun sut,
@ -173,17 +161,19 @@
u3_noun lon,
u3_noun gil)
{
u3_noun p_sut, q_sut, pq_sut, qq_sut, rq_sut, sq_sut, psq_sut, qsq_sut;
u3_noun p_sut, q_sut, pq_sut, qq_sut, rq_sut, prq_sut, qrq_sut;
u3_noun ppq_sut, qpq_sut, rpq_sut;
u3x_cell(u3t(sut), &p_sut, &q_sut);
u3x_qual(q_sut, &pq_sut, &qq_sut, &rq_sut, &sq_sut);
u3x_cell(sq_sut, &psq_sut, &qsq_sut);
u3x_trel(q_sut, &pq_sut, &qq_sut, &rq_sut);
u3x_trel(pq_sut, &ppq_sut, &qpq_sut, &rpq_sut);
u3x_cell(rq_sut, &prq_sut, &qrq_sut);
{
if ( u3_nul == q_heg ) {
return _find_buck_here(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
else {
u3_noun zem = u3qf_loot(u3t(q_heg), qsq_sut);
u3_noun zem = u3qf_loot(u3t(q_heg), qrq_sut);
if ( (u3_nul != zem) && (0 != p_heg) ) {
u3_noun ped;
@ -199,31 +189,38 @@
u3_noun u_zem = u3t(zem);
u3_noun pu_zem = u3h(u_zem);
u3_noun qu_zem = u3t(u_zem);
u3_noun pqu_zem = u3h(qu_zem);
u3_noun qqu_zem = u3t(qu_zem);
u3_noun zut;
u3_noun mut;
u3_noun pro;
mut = u3nt(c3__core,
u3k(p_sut),
u3nq(c3__gold,
u3nt(u3nt(u3k(ppq_sut), u3k(qpq_sut), c3__gold),
u3k(qq_sut),
u3k(rq_sut),
u3k(sq_sut)));
u3k(rq_sut)));
pro = u3nq
#if 1
if ( qpq_sut == c3__wet ) {
zut = u3nc(c3__wet, u3k(qu_zem));
}
else if ( qpq_sut == c3__dry ) {
zut = u3nc(c3__dry, u3k(qu_zem));
}
else u3m_bail(c3__fail);
#endif
pro = u3nt
(c3y,
u3k(pqu_zem),
u3nc(u3nc(u3_nul, u3k(axe)), u3k(lon)),
u3nt(c3n,
u3qc_peg(2, pu_zem),
u3nt(u3nc(mut, u3k(qqu_zem)), u3_nul, u3_nul)));
u3nt(u3nc(mut, zut), u3_nul, u3_nul)));
u3z(zem);
return pro;
}
else {
u3_noun pec = u3qfu_peel(van, sut, way, pq_sut);
u3_noun pec = u3qfu_peel(van, sut, way, rpq_sut);
u3_noun pro;
if ( c3n == u3h(pec) ) {
@ -278,24 +275,19 @@
else {
u3_noun pp_hax = u3t(p_hax); // {span nock}
u3_noun pp_yor = u3t(p_yor); // {span nock}
u3_noun ppp_hax = u3h(pp_hax); // wain
u3_noun ppp_yor = u3h(pp_yor); // wain
u3_noun qpp_hax = u3t(pp_hax);
u3_noun qpp_yor = u3t(pp_yor);
u3_noun pqpp_hax = u3h(qpp_hax); // span
u3_noun pqpp_yor = u3h(qpp_yor); // span
u3_noun qqpp_hax = u3t(qpp_hax); // nock
u3_noun qqpp_yor = u3t(qpp_yor); // nock
u3_noun ppp_hax = u3h(pp_hax); // span
u3_noun ppp_yor = u3h(pp_yor); // span
u3_noun qpp_hax = u3t(pp_hax); // nock
u3_noun qpp_yor = u3t(pp_yor); // nock
if ( c3n == u3r_sing(qqpp_hax, qqpp_yor) ) {
if ( c3n == u3r_sing(qpp_hax, qpp_yor) ) {
return u3m_error("find-fork-c");
}
return u3nq(c3n,
return u3nt(c3n,
c3n,
_find_join(ppp_hax, ppp_yor),
u3nc(
u3kf_fork(u3nt(u3k(pqpp_hax), u3k(pqpp_yor), u3_nul)),
u3k(qqpp_hax)));
u3kf_fork(u3nt(u3k(ppp_hax), u3k(ppp_yor), u3_nul)),
u3k(qpp_hax)));
}
}
}
@ -304,52 +296,46 @@
return u3m_error("find-fork-d");
}
else {
u3_noun p_hax = u3t(hax); // {wain vein opal}
u3_noun p_yor = u3t(yor); // {wain vein opal}
u3_noun pp_hax = u3h(p_hax); // wain
u3_noun pp_yor = u3h(p_yor); // wain
u3_noun qp_hax = u3t(p_hax); // {vein opal}
u3_noun qp_yor = u3t(p_yor); // {vein opal}
u3_noun pqp_hax = u3h(qp_hax); // vein
u3_noun pqp_yor = u3h(qp_yor); // vein
u3_noun qqp_hax = u3t(qp_hax); // opal
u3_noun qqp_yor = u3t(qp_yor); // opal
u3_noun p_hax = u3t(hax); // {vein opal}
u3_noun p_yor = u3t(yor); // {vein opal}
u3_noun pp_hax = u3h(p_hax); // vein
u3_noun pp_yor = u3h(p_yor); // vein
u3_noun qp_hax = u3t(p_hax); // opal
u3_noun qp_yor = u3t(p_yor); // opal
if ( c3n == u3r_sing(pqp_hax, pqp_yor) ) {
if ( c3n == u3r_sing(pp_hax, pp_yor) ) {
return u3m_error("find-fork-e");
}
else {
if ( c3y == u3h(qqp_hax) ) {
if ( c3y != u3h(qqp_yor) ) {
if ( c3y == u3h(qp_hax) ) {
if ( c3y != u3h(qp_yor) ) {
return u3m_error("find-fork-f");
} else {
u3_noun pqqp_hax = u3t(qqp_hax); // span
u3_noun pqqp_yor = u3t(qqp_yor); // span
u3_noun pqp_hax = u3t(qp_hax); // type
u3_noun pqp_yor = u3t(qp_yor); // type
return
u3nq(c3y,
_find_join(pp_hax, pp_yor),
u3k(pqp_hax),
u3nt(c3y,
u3k(pp_hax),
u3nc(c3y, u3kf_fork
(u3nt(u3k(pqqp_hax), u3k(pqqp_yor), u3_nul))));
(u3nt(u3k(pqp_hax), u3k(pqp_yor), u3_nul))));
}
}
else if ( c3n != u3h(qqp_yor) ) {
else if ( c3n != u3h(qp_yor) ) {
return u3m_error("find-fork-g");
} else {
u3_noun pqqp_hax = u3h(u3t(qqp_hax)); // axis
u3_noun pqqp_yor = u3h(u3t(qqp_yor)); // axis
u3_noun qqqp_hax = u3t(u3t(qqp_hax)); // (set {span foot})
u3_noun qqqp_yor = u3t(u3t(qqp_yor)); // (set {span foot})
u3_noun pqp_hax = u3h(u3t(qp_hax)); // axis
u3_noun pqp_yor = u3h(u3t(qp_yor)); // axis
u3_noun qqp_hax = u3t(u3t(qp_hax)); // (set {type foot})
u3_noun qqp_yor = u3t(u3t(qp_yor)); // (set {type foot})
if ( c3n == u3r_sing(pqqp_hax, pqqp_yor) ) {
if ( c3n == u3r_sing(pqp_hax, pqp_yor) ) {
return u3m_error("find-fork-h");
} else {
return
u3nq(c3y,
u3_nul,
u3k(pqp_hax),
u3nt(c3n, u3k(pqqp_hax), u3qdi_uni(qqqp_hax, qqqp_yor)));
u3nt(c3y,
u3k(pp_hax),
u3nt(c3n, u3k(pqp_hax), u3qdi_uni(qqp_hax, qqp_yor)));
}
}
}
@ -446,10 +432,10 @@
}
else {
u3_noun iqp_sut = u3h(qp_sut); // twig
u3_noun tiv = u3qfu_mint // (pair span nock)
u3_noun tiv = u3qfu_mint // (pair type nock)
(van, q_sut, c3__noun, iqp_sut);
u3_noun tqp_sut = u3t(qp_sut); // (list twig)
u3_noun p_tiv = u3h(tiv); // span
u3_noun p_tiv = u3h(tiv); // type
u3_noun q_tiv = u3t(tiv); // nock
u3_noun fid = _find_buck // pony
(van, p_tiv, way, p_heg, q_heg, 1, u3_nul, u3_nul);
@ -469,17 +455,14 @@
}
else {
u3_noun tor; // port
u3_noun vat; // (pair span nock)
u3_noun vat; // (pair type nock)
u3_noun ret;
u3_noun dog = u3nc(0, u3k(axe)); // nock
u3_noun cob = u3qf_comb(dog, q_tiv);
u3_noun wan;
if ( c3y == u3h(fid) ) {
wan = u3k(u3h(u3t(fid)));
tor = u3nc(c3y, u3k(u3t(u3t(fid))));
tor = u3nc(c3y, u3k(u3t(fid)));
} else {
wan = u3k(u3h(u3t(u3t(fid))));
tor = u3nc(c3n, u3k(u3t(u3t(fid))));
}
u3z(fid);
@ -487,10 +470,9 @@
vat = u3qfu_fine(van, sut, tor);
u3z(tor);
ret = u3nq
ret = u3nt
(c3n,
c3n,
wan,
u3nc(u3k(u3h(vat)), u3qf_comb(cob, u3t(vat))));
u3z(vat);
@ -514,10 +496,8 @@
u3_noun gil)
{
u3_noun p_sut, q_sut;
u3_noun pp_sut, qp_sut;
u3x_cell(u3t(sut), &p_sut, &q_sut);
u3x_cell(p_sut, &pp_sut, &qp_sut);
if ( u3_nul == q_heg ) {
return _find_buck_here(van, q_sut, way, p_heg, q_heg, axe, lon, gil);
@ -525,8 +505,8 @@
else {
u3_noun uq_heg = u3t(q_heg); // term
if ( c3y == u3ud(qp_sut) ) {
if ( c3y == u3r_sing(qp_sut, uq_heg) ) {
if ( c3y == u3ud(p_sut) ) {
if ( c3y == u3r_sing(p_sut, uq_heg) ) {
return _find_buck_here(van, q_sut, way, p_heg, q_heg, axe, lon, gil);
}
else {
@ -534,20 +514,18 @@
}
}
else {
u3_noun pqp_sut = u3h(qp_sut); // (map term {wain (unit twig)})
u3_noun qqp_sut = u3t(qp_sut); // (list (pair span nock))
u3_noun tyr = u3qdb_get(pqp_sut, uq_heg); // (unit {wain (unit twig)})
u3_noun pp_sut = u3h(p_sut); // (map term {wain (unit twig)})
u3_noun qp_sut = u3t(p_sut); // (list (pair type nock))
u3_noun tyr = u3qdb_get(pp_sut, uq_heg); // (unit (unit twig))
if ( u3_nul == tyr ) {
return _find_buck_face_next
(van, sut, q_sut, qqp_sut, way, p_heg, q_heg, axe, lon, gil);
(van, sut, q_sut, qp_sut, way, p_heg, q_heg, axe, lon, gil);
}
else {
u3_noun u_tyr = u3t(tyr); // (pair wain (unit twig))
u3_noun pu_tyr = u3h(u_tyr);
u3_noun qu_tyr = u3t(u_tyr);
u3_noun u_tyr = u3t(tyr); // (unit twig)
if ( u3_nul == qu_tyr ) {
if ( u3_nul == u_tyr ) {
u3_noun nol = u3nc(u3_nul, u3k(lon));
u3_noun dep = u3qa_inc(p_heg);
u3_noun ret = _find_buck
@ -559,8 +537,8 @@
return ret;
}
else {
u3_noun uqu_tyr = u3t(qu_tyr);
u3_noun tor = u3qfu_fund(van, sut, way, uqu_tyr);
u3_noun uu_tyr = u3t(u_tyr);
u3_noun tor = u3qfu_fund(van, sut, way, uu_tyr);
if ( c3y == u3h(tor) ) {
u3_noun p_tor = u3t(tor); // (pair vein opal)
@ -570,22 +548,21 @@
u3nt(u3_nul, u3nc(u3_nul, u3k(axe)), u3k(lon));
u3_noun ret;
ret = u3nq(c3y, u3_nul, u3qb_weld(pp_tor, nol), u3k(qp_tor));
ret = u3nt(c3y, u3qb_weld(pp_tor, nol), u3k(qp_tor));
u3z(nol);
u3z(tor);
u3z(tyr);
return ret;
}
else {
u3_noun p_tor = u3t(tor); // (pair span nock)
u3_noun pp_tor = u3h(p_tor); // span
u3_noun p_tor = u3t(tor); // (pair type nock)
u3_noun pp_tor = u3h(p_tor); // type
u3_noun qp_tor = u3t(p_tor); // nock
u3_noun dog = u3nc(0, u3k(axe)); // nock
u3_noun ret;
ret = u3nq(c3n,
ret = u3nt(c3n,
c3n,
u3k(pu_tyr),
u3nc(u3k(pp_tor), u3qf_comb(dog, qp_tor)));
u3z(dog);
u3z(tor);
@ -640,7 +617,7 @@
// fprintf(stderr, "core\r\n");
return _find_buck_core(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
case c3__help:
case c3__hint:
{
u3_noun fop = u3qfu_repo(van, sut);
u3_noun pro = _find_buck(van, fop, way, p_heg, q_heg, axe, lon, gil);
@ -677,20 +654,19 @@
}
}
static u3_noun
_find_limb(u3_noun van,
u3_noun sut, // span
u3_noun sut, // type
u3_noun way, // ?(%read %rite %free %both)
u3_noun i_hyp, // limb
u3_noun p_mor) // {wain palo}
u3_noun p_mor) // palo
{
u3_noun qp_mor = u3t(p_mor); // palo
u3_noun pqp_mor = u3h(qp_mor); // vein
u3_noun qqp_mor = u3t(qp_mor); // opal
u3_noun pp_mor = u3h(p_mor); // vein
u3_noun qp_mor = u3t(p_mor); // opal
{
u3_noun ref = u3qfu_felt(van, sut, qqp_mor);
u3_noun lon = u3k(pqp_mor);
u3_noun ref = u3qfu_felt(van, sut, qp_mor);
u3_noun lon = u3k(pp_mor);
u3_noun heg = (c3y == u3du(i_hyp))
? u3k(i_hyp)
: u3nq(c3n, 0, u3_nul, u3k(i_hyp));
@ -699,9 +675,13 @@
if ( c3y == u3h(heg) ) {
u3_noun p_heg = u3t(heg); // axis
ret = u3nq
if ( c3n == u3ud(p_heg) ) {
u3m_p("weird p_heg", p_heg);
return u3m_bail(c3__fail);
}
ret = u3nt
(c3y,
u3_nul,
u3nc(u3nc(u3_nul, u3k(p_heg)), u3k(lon)),
u3nc(c3y, u3qfu_peek(van, ref, way, p_heg)));
}
@ -727,7 +707,7 @@
u3_noun hyp)
{
if ( u3_nul == hyp ) {
return u3nq(c3y, u3_nul, u3_nul, u3nc(c3y, u3k(sut)));
return u3nt(c3y, u3_nul, u3nc(c3y, u3k(sut)));
}
else {
u3_noun i_hyp = u3h(hyp);
@ -741,18 +721,15 @@
return mor;
}
else {
u3_noun pp_mor = u3t(p_mor); // {wain span nock}
u3_noun ppp_mor = u3h(pp_mor);
u3_noun qpp_mor = u3t(pp_mor);
u3_noun pqpp_mor = u3h(qpp_mor); // span
u3_noun qqpp_mor = u3t(qpp_mor); // nock
u3_noun pp_mor = u3t(p_mor); // {span nock}
u3_noun ppp_mor = u3h(pp_mor); // span
u3_noun qpp_mor = u3t(pp_mor); // nock
u3_noun gen = u3nt(c3__wing, u3k(i_hyp), u3_nul);
u3_noun fex = u3qfu_mint(van, pqpp_mor, c3__noun, gen);
u3_noun ret = u3nq(c3n,
u3_noun fex = u3qfu_mint(van, ppp_mor, c3__noun, gen);
u3_noun ret = u3nt(c3n,
c3n,
u3k(ppp_mor),
u3nc(u3k(u3h(fex)),
u3qf_comb(qqpp_mor, u3t(fex))));
u3qf_comb(qpp_mor, u3t(fex))));
u3z(fex);
u3z(gen);
u3z(mor);
@ -796,8 +773,8 @@
}
else {
if ( c3y == u3h(taf) ) {
u3_noun fat = u3nc(c3y, u3k(u3t(u3t(taf))));
u3_noun fat = u3nc(c3y, u3k(u3t(taf)));
u3z(taf);
return fat;
}
@ -845,7 +822,7 @@
u3_noun way,
u3_noun hyp)
{
c3_m fun_m = 144 + c3__find + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
c3_m fun_m = 141 + c3__find + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_3(fun_m, sut, way, hyp);
if ( u3_none != pro ) {
@ -883,7 +860,7 @@
u3_noun way,
u3_noun hyp)
{
c3_m fun_m = 144 + c3__fond + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
c3_m fun_m = 141 + c3__fond + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_3(fun_m, sut, way, hyp);
if ( u3_none != pro ) {

View File

@ -76,7 +76,7 @@
u3_noun dox = u3nt
(c3__core, u3k(qq_typ), u3k(q_typ));
if ( c3__ash == u3h(gat) ) {
if ( (c3__ash == u3h(gat)) || (c3__dry == u3h(gat)) ) {
if ( (c3y == vet) &&
(c3n == u3qfu_nest(van, qq_typ, c3y, p_typ)) )
{
@ -94,7 +94,7 @@
}
}
else {
c3_assert(c3__elm == u3h(gat));
c3_assert(c3__wet == u3h(gat));
#if 0
u3_noun dun = u3qfu_dunq(van, "wild", typ);
u3_noun niz = u3qfu_dunq(van, "tame", dox);
@ -155,7 +155,7 @@
u3_noun pi_hag = u3h(i_hag);
u3_noun qi_hag = u3t(i_hag);
if ( c3__elm == u3h(qi_hag) ) {
if ( (c3__wet == u3h(qi_hag)) ) {
u3_noun qqi_hag = u3t(qi_hag);
if ( c3y == u3du(qqi_hag) &&

View File

@ -90,9 +90,9 @@
}
}
case c3__core: {
return u3nc(0, 0);
return u3m_error("fish-core");
}
case c3__help:
case c3__hint:
case c3__face: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);
@ -166,7 +166,7 @@
u3_noun sut,
u3_noun axe)
{
c3_m fun_m = 144 + c3__fish + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
c3_m fun_m = 141 + c3__fish + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_2(fun_m, sut, axe);
if ( u3_none != pro ) {

View File

@ -124,10 +124,10 @@
{
return _fuse_repo(van, sut, ref, bix);
}
case c3__help: u3x_cell(u3t(sut), &p_sut, &q_sut);
case c3__hint: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3_noun vot = _fuse_in(van, q_sut, ref, bix);
u3_noun ret = u3qf_help(p_sut, vot);
u3_noun ret = u3qf_hint(p_sut, vot);
u3z(vot);
return ret;
@ -201,7 +201,7 @@
u3_noun sut,
u3_noun ref)
{
c3_m fun_m = 144 + c3__fuse + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
c3_m fun_m = 141 + c3__fuse + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_2(fun_m, sut, ref);
if ( u3_none != pro ) {

View File

@ -16,6 +16,25 @@
u3_nul));
}
static u3_noun
_mint_tend(u3_noun vit)
{
if ( u3_nul == vit ) {
return 1;
} else {
u3_noun nex = _mint_tend(u3t(vit));
if ( u3_nul == u3h(vit) ) {
return nex;
} else {
u3_noun boy = u3qc_peg(u3t(u3h(vit)), nex);
u3z(nex);
return boy;
}
}
}
static u3_noun
_mint_vet(u3_noun van)
{
@ -30,14 +49,49 @@
}
static u3_noun
_mint_core(u3_noun pac,
u3_noun con)
_mint_feel(u3_noun van,
u3_noun sut,
u3_noun rot)
{
if ( (c3__void == pac) ) {
return c3__void;
} else {
return u3nt(c3__core, pac, con);
}
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "feel");
return u3n_kick_on(u3i_molt(gat,
u3x_sam,
u3k(rot),
0));
}
static u3_noun
_mint_mine(u3_noun van,
u3_noun sut,
u3_noun mel,
u3_noun nym,
u3_noun hud,
u3_noun dom)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "mine");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
u3k(mel),
u3x_sam_6,
u3k(nym),
u3x_sam_14,
u3k(hud),
u3x_sam_15,
u3k(dom),
0));
}
static u3_noun
_mint_burp(u3_noun van,
u3_noun sut)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
return u3j_hook(von, "burp");
}
static u3_noun
@ -107,152 +161,25 @@
}
}
static u3_noun
_mint_brew(u3_noun van,
u3_noun sut,
u3_noun tov,
u3_noun gen)
{
u3_noun von;
switch ( tov ) {
default: return u3m_bail(c3__fail);
case c3y:
von = u3k(van); break;
case c3n:
von = u3i_molt(u3k(van), u3qfu_van_vet, c3n, 0); break;
}
{
u3_noun mil = u3qfu_mint(von, sut, c3__noun, gen);
u3_noun fol = u3k(u3t(mil));
u3z(mil);
u3z(von);
return fol;
}
}
static u3_noun
_mint_harp(u3_noun van,
u3_noun sut,
u3_noun dab)
{
if ( (u3_nul == dab) ) {
return 0;
}
else {
u3_noun n_dab, l_dab, r_dab;
u3r_trel(dab, &n_dab, &l_dab, &r_dab);
if ( c3n == u3du(n_dab) ) {
return u3m_bail(c3__fail);
}
else {
u3_noun qqn_dab = u3t(u3t(n_dab));
u3_noun vad;
switch ( u3h(qqn_dab) ) {
default: return u3m_bail(c3__exit);
case c3__ash: {
vad = _mint_brew(van, sut, c3y, u3t(qqn_dab));
break;
}
case c3__elm: {
vad = _mint_brew(van, sut, c3n, u3t(qqn_dab));
break;
}
}
if ( (u3_nul == l_dab) && (u3_nul == r_dab) ) {
return vad;
}
else if ( (u3_nul == l_dab) ) {
return u3nc(vad, _mint_harp(van, sut, r_dab));
}
else if ( (u3_nul == r_dab) ) {
return u3nc(vad, _mint_harp(van, sut, l_dab));
}
else {
return u3nt(vad,
_mint_harp(van, sut, l_dab),
_mint_harp(van, sut, r_dab));
}
}
}
}
static u3_noun
_mint_hope(u3_noun van,
u3_noun sut,
u3_noun dom)
{
if ( (u3_nul == dom) ) {
return 0;
}
else {
u3_noun n_dom, l_dom, r_dom;
u3r_trel(dom, &n_dom, &l_dom, &r_dom);
if ( c3n == u3du(n_dom) ) {
return u3m_bail(c3__fail);
}
else {
u3_noun qqn_dom = u3t(u3t(n_dom));
u3_noun dov;
dov = _mint_harp(van, sut, qqn_dom);
if ( (u3_nul == l_dom) && (u3_nul == r_dom) ) {
return dov;
}
else if ( (u3_nul == l_dom) ) {
return u3nc(dov, _mint_hope(van, sut, r_dom));
}
else if ( (u3_nul == r_dom) ) {
return u3nc(dov, _mint_hope(van, sut, l_dom));
}
else {
return u3nt(dov,
_mint_hope(van, sut, l_dom),
_mint_hope(van, sut, r_dom));
}
}
}
}
static u3_noun
_mint_grow(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_atom mel,
u3_noun nym,
u3_noun hud,
u3_noun ruf,
u3_noun wan,
u3_noun dom)
{
u3_noun dan = _mint_in(van, sut, c3__noun, ruf);
u3_noun p_dan = u3h(dan);
u3_noun q_dan = u3t(dan);
u3_noun toc = _mint_core(u3k(p_dan),
u3nq(c3__gold,
u3k(p_dan),
u3k(wan),
u3nc(u3_nul,
u3k(dom))));
u3_noun dez = _mint_hope(van, toc, dom);
u3_noun zod = u3nc(1, dez);
u3_noun cot = _mint_core(u3k(p_dan),
u3nq(mel,
u3k(p_dan),
u3k(wan),
u3nc(u3k(dez),
u3k(dom))));
u3_noun ret = u3nc(_mint_nice(van, gol, cot),
u3qf_cons(zod, q_dan));
u3_noun pul = _mint_mine(van, p_dan, mel, nym, hud, dom);
u3_noun ret = u3nc(_mint_nice(van, gol, u3k(u3h(pul))),
u3qf_cons(u3t(pul), q_dan));
u3z(zod);
u3z(toc);
u3z(pul);
u3z(dan);
return ret;
}
@ -389,10 +316,9 @@
}
if ( c3n == u3du(gen) ) {
u3_noun fab = u3r_at(u3qfu_van_fab, van);
u3_noun ter = u3r_at(u3x_con_3, van);
u3_noun rex = (c3n == fab) ? u3qfp_nepo(ter, gen)
: u3qfp_open(ter, gen);
u3_noun fab = u3r_at(u3qfu_van_fab, van);
u3_noun rex = u3qfp_open(ter, fab, gen);
ret = _mint_in(van, sut, gol, rex);
u3z(rex);
@ -417,10 +343,9 @@
}
} else switch ( u3h(gen) ) {
default: {
u3_noun fab = u3r_at(u3qfu_van_fab, van);
u3_noun ter = u3r_at(u3x_con_3, van);
u3_noun rex = (c3n == fab) ? u3qfp_nepo(ter, gen)
: u3qfp_open(ter, gen);
u3_noun fab = u3r_at(u3qfu_van_fab, van);
u3_noun rex = u3qfp_open(ter, fab, gen);
if ( c3y == u3r_sing(rex, gen) ) {
#if 1
@ -541,7 +466,7 @@
case c3__dtkt: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun nog = u3nc(c3__bunt, u3k(p_gen));
u3_noun nog = u3nc(c3__kttr, u3k(p_gen));
u3_noun nef = _mint_in(van, sut, gol, nog);
u3_noun viz = _mint_in(van, sut, c3__noun, q_gen);
@ -614,6 +539,7 @@
return pro;
}
case c3__ktpd:
case c3__ktpm: p_gen = u3t(gen);
_mint_used();
{
@ -636,40 +562,16 @@
return pro;
}
case c3__help: u3x_cell(u3t(gen), &p_gen, &q_gen);
case c3__note: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun hit = u3nc(u3k(sut), u3k(p_gen));
u3_noun hum = _mint_in(van, sut, gol, q_gen);
u3_noun ret = u3nc(u3qf_help(p_gen, u3h(hum)),
u3_noun ret = u3nc(u3qf_hint(hit, u3h(hum)),
u3k(u3t(hum)));
u3z(hum);
return ret;
}
case c3__docs: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun hep = u3nc(c3__docs, u3k(p_gen));
u3_noun hum = _mint_in(van, sut, gol, q_gen);
u3_noun ret = u3nc(u3qf_help(hep, u3h(hum)),
u3k(u3t(hum)));
u3z(hep);
u3z(hum);
return ret;
}
case c3__ktts: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun vat = _mint_in(van, sut, gol, q_gen);
ret = u3nc(u3qfu_conk(van, u3h(vat), p_gen),
u3k(u3t(vat)));
u3z(vat);
u3z(hit);
return ret;
}
@ -679,31 +581,6 @@
return u3nc(u3qf_face(p_gen, sut), u3nc(0, 1));
}
case c3__ktsg: p_gen = u3t(gen);
_mint_used();
{
u3_noun nef = _mint_in(van, sut, gol, p_gen);
u3_noun p_nef = u3h(nef);
u3_noun q_nef = u3t(nef);
u3_noun fom;
{
u3_noun cag = u3qfu_burn(van, sut);
u3_noun wim = u3n_nock_an(cag, u3k(q_nef));
if ( 0 == u3h(wim) ) {
fom = u3nc(1, u3k(u3t(wim)));
} else {
fom = u3k(q_nef);
}
u3z(wim);
}
ret = u3nc(u3k(p_nef), fom);
u3z(nef);
return ret;
}
case c3__ktls: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
@ -716,12 +593,17 @@
return ret;
}
case c3__tsgr: u3x_cell(u3t(gen), &p_gen, &q_gen);
case c3__tsbn: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun fid = _mint_in(van, sut, c3__noun, p_gen);
u3_noun p_fid = u3h(fid);
u3_noun q_fid = u3t(fid);
if ( 0 == p_fid ) {
u3m_p("bad subject: p_gen", p_gen);
c3_assert(0);
}
u3_noun dov = _mint_in(van, p_fid, gol, q_gen);
u3_noun p_dov = u3h(dov);
u3_noun q_dov = u3t(dov);
@ -734,16 +616,6 @@
return ret;
}
case c3__tstr: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
_mint_used();
{
u3_noun boc = u3qfu_buss(van, sut, p_gen, q_gen);
u3_noun ret = _mint_in(van, boc, gol, r_gen);
u3z(boc);
return ret;
}
case c3__tscm: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
@ -765,7 +637,18 @@
{
u3_noun ruf = u3nc(u3_nul, 1);
ret = _mint_grow(van, sut, gol, c3__gold, ruf, p_gen, q_gen);
ret = _mint_grow(van, sut, gol, c3__gold, p_gen, c3__dry, ruf, q_gen);
u3z(ruf);
return ret;
}
case c3__brvt: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun ruf = u3nc(u3_nul, 1);
ret = _mint_grow(van, sut, gol, c3__gold, p_gen, c3__wet, ruf, q_gen);
u3z(ruf);
return ret;
@ -787,7 +670,7 @@
return ret;
}
case c3__sggr: u3x_cell(u3t(gen), &p_gen, &q_gen);
case c3__sgbn: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun hum = _mint_in(van, sut, gol, q_gen);
@ -826,11 +709,45 @@
return ret;
}
case c3__cold: p_gen = u3t(gen);
case c3__wthx: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun hyp = u3nc(u3nc(c3y, 1), u3k(q_gen));
u3_noun fid = u3qfu_find(van, sut, c3__free, hyp);
if ( c3y != u3h(fid) ) {
return u3m_error("mint-fragment");
}
else {
u3_noun pp_fid = u3h(u3t(fid));
u3_noun qp_fid = u3t(u3t(fid));
if ( c3y != u3h(qp_fid) ) {
return u3m_error("mint-fragment");
}
else {
u3_noun pqp_fid = u3t(qp_fid);
u3_noun axe = _mint_tend(pp_fid);
u3_noun ret;
ret = u3nc(_mint_nice(van, gol, _mint_bean()),
u3qfr_fish(van, pqp_fid, p_gen, axe));
u3z(axe);
u3z(fid);
u3z(hyp);
return ret;
}
}
}
case c3__cold:
case c3__ktsg: p_gen = u3t(gen);
_mint_used();
{
c3_m fun_m = 144 + c3__blow;
c3_m fun_m = 141 + c3__blow;
u3_noun vrf = u3r_at(u3qfu_van_vrf, van);
u3_noun pro = u3z_find_4(fun_m, vrf, sut, gol, p_gen);
@ -876,15 +793,16 @@
return ret;
}
case c3__zpsm:
case c3__zpmc: u3x_cell(u3t(gen), &p_gen, &q_gen);
case c3__zpmc:
case c3__zpsm: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun vos = _mint_in(van, sut, c3__noun, q_gen);
u3_noun zur = u3qfu_play(van, sut, p_gen);
u3_noun p_vos = u3h(vos);
u3_noun q_vos = u3t(vos);
u3_noun waz = u3nc(1, u3k(p_vos));
u3_noun waz = u3nc(1, _mint_burp(van, p_vos));
// u3_noun waz = u3nc(1, u3k(p_vos));
u3_noun sif = u3k(zur);
u3_noun cig = u3qf_cell(sif, p_vos);
u3_noun ret;
@ -900,6 +818,16 @@
return ret;
}
case c3__zpvt: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
_mint_used();
{
if ( c3y == _mint_feel(van, sut, p_gen) ) {
return _mint_in(van, sut, gol, q_gen);
} else {
return _mint_in(van, sut, gol, r_gen);
}
}
case c3__lost: p_gen = u3t(gen);
_mint_used();
{
@ -958,7 +886,7 @@
u3_noun gol,
u3_noun gen)
{
c3_m fun_m = 144 + c3__mint;
c3_m fun_m = 141 + c3__mint;
u3_noun vrf = u3r_at(u3qfu_van_vrf, van);
u3_noun pro = u3z_find_4(fun_m, vrf, sut, gol, gen);

View File

@ -8,17 +8,6 @@
static u3_noun
_mull_in(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
static u3_noun
_mull_core(u3_noun pac,
u3_noun con)
{
if ( (c3__void == pac) ) {
return c3__void;
} else {
return u3nt(c3__core, pac, con);
}
}
static u3_noun
_mull_bean()
{
@ -41,6 +30,38 @@
return ret;
}
static u3_noun
_mull_feel(u3_noun van,
u3_noun sut,
u3_noun rot)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "feel");
return u3n_kick_on(u3i_molt(gat,
u3x_sam,
u3k(rot),
0));
}
static u3_noun
_mull_tend(u3_noun vit)
{
if ( u3_nul == vit ) {
return 1;
} else {
u3_noun nex = _mull_tend(u3t(vit));
if ( u3_nul == u3h(vit) ) {
return nex;
} else {
u3_noun boy = u3qc_peg(u3t(u3h(vit)), nex);
u3z(nex);
return boy;
}
}
}
static u3_noun
_mull_coke(u3_noun nug)
{
@ -55,6 +76,33 @@
}
}
static u3_noun
_mull_mile(u3_noun van,
u3_noun sut,
u3_noun dox,
u3_noun mel,
u3_noun nym,
u3_noun hud,
u3_noun dom)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "mile");
// fprintf(stderr, "mile\r\n");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
u3k(dox),
u3x_sam_6,
u3k(mel),
u3x_sam_14,
u3k(nym),
u3x_sam_30,
u3k(hud),
u3x_sam_31,
u3k(dom),
0));
}
static u3_noun
_mull_doke(u3_noun van,
u3_noun sut,
@ -84,129 +132,26 @@
else return typ;
}
static void
_mull_bake(u3_noun van,
u3_noun sut,
u3_noun dox,
u3_noun dab)
{
if ( u3_nul != dab ) {
u3_noun n_dab, l_dab, r_dab;
u3r_trel(dab, &n_dab, &l_dab, &r_dab);
if ( c3n == u3du(n_dab) ) {
u3m_bail(c3__fail);
}
else {
u3_noun qqn_dab = u3t(u3t(n_dab));
u3_noun vad;
switch ( u3h(qqn_dab) ) {
default: u3m_bail(c3__exit);
case c3__ash: {
vad = _mull_in(van, sut, c3__noun, dox, u3t(qqn_dab));
break;
}
case c3__elm: {
vad = u3_nul;
break;
}
}
u3z(vad);
if ( (u3_nul == l_dab) && (u3_nul == r_dab) ) {
return;
}
else if ( (u3_nul == l_dab) ) {
_mull_bake(van, sut, dox, r_dab);
}
else if ( (u3_nul == r_dab) ) {
_mull_bake(van, sut, dox, l_dab);
}
else {
_mull_bake(van, sut, dox, l_dab);
_mull_bake(van, sut, dox, r_dab);
}
}
}
}
static void
_mull_balk(u3_noun van,
u3_noun sut,
u3_noun dox,
u3_noun dom)
{
if ( u3_nul != dom ) {
u3_noun n_dom, l_dom, r_dom;
u3r_trel(dom, &n_dom, &l_dom, &r_dom);
if ( c3n == u3du(n_dom) ) {
u3m_bail(c3__fail);
}
else {
u3_noun qqn_dom = u3t(u3t(n_dom));
_mull_bake(van, sut, dox, qqn_dom);
if ( (u3_nul == l_dom) && (u3_nul == r_dom) ) {
return;
}
else if ( (u3_nul == l_dom) ) {
_mull_balk(van, sut, dox, r_dom);
}
else if ( (u3_nul == r_dom) ) {
_mull_balk(van, sut, dox, l_dom);
}
else {
_mull_balk(van, sut, dox, l_dom);
_mull_balk(van, sut, dox, r_dom);
}
}
}
}
static u3_noun
_mull_grow(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun dox,
u3_atom mel,
u3_noun nym,
u3_noun hud,
u3_noun ruf,
u3_noun wan,
u3_noun dom)
{
u3_noun dan = _mull_in(van, sut, c3__noun, dox, ruf);
u3_noun p_dan = u3h(dan);
u3_noun q_dan = u3t(dan);
u3_noun p_toc = _mull_core(u3k(p_dan),
u3nq(c3__gold,
u3k(p_dan),
u3k(wan),
u3nc(u3_nul, u3k(dom))));
u3_noun q_toc = _mull_core(u3k(q_dan),
u3nq(c3__gold,
u3k(q_dan),
u3k(wan),
u3nc(u3_nul, u3k(dom))));
u3_noun p_ret = _mull_core(u3k(p_dan),
u3nq(u3k(mel),
u3k(p_dan),
u3k(wan),
u3nc(u3nc(u3_nul, u3_nul),
u3k(dom))));
u3_noun q_ret = _mull_core(u3k(q_dan),
u3nq(u3k(mel),
u3k(q_dan),
u3k(wan),
u3nc(u3nc(u3_nul, u3_nul),
u3k(dom))));
u3_noun ret = u3nc(_mull_nice(van, gol, p_ret), q_ret);
u3_noun yaz = _mull_mile(van, p_dan, q_dan, mel, nym, hud, dom);
u3_noun p_yaz = u3h(yaz);
u3_noun q_yaz = u3t(yaz);
u3_noun ret = u3nc(_mull_nice(van, gol, u3k(p_yaz)), u3k(q_yaz));
_mull_balk(van, p_toc, q_toc, dom);
u3z(q_toc);
u3z(p_toc);
u3z(yaz);
u3z(dan);
return ret;
@ -340,10 +285,9 @@
u3_noun ret;
if ( c3n == u3du(gen) ) {
u3_noun fab = u3r_at(u3qfu_van_fab, van);
u3_noun ter = u3r_at(u3x_con_3, van);
u3_noun rex = (c3n == fab) ? u3qfp_nepo(ter, gen)
: u3qfp_open(ter, gen);
u3_noun fab = u3r_at(u3qfu_van_fab, van);
u3_noun rex = u3qfp_open(ter, fab, gen);
ret = _mull_in(van, sut, gol, dox, rex);
u3z(rex);
@ -367,10 +311,9 @@
}
else switch ( u3h(gen) ) {
default: {
u3_noun fab = u3r_at(u3qfu_van_fab, van);
u3_noun ter = u3r_at(u3x_con_3, van);
u3_noun rex = (c3n == fab) ? u3qfp_nepo(ter, gen)
: u3qfp_open(ter, gen);
u3_noun fab = u3r_at(u3qfu_van_fab, van);
u3_noun rex = u3qfp_open(ter, fab, gen);
if ( c3y == u3r_sing(rex, gen) ) {
#if 1
@ -413,6 +356,61 @@
return _mull_both(van, gol, _mull_bean());
}
case c3__wthx: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun hyp = u3nc(u3nc(c3y, 1), u3k(q_gen));
u3_noun fid = u3qfu_find(van, sut, c3__free, hyp);
u3_noun gax = u3qfu_find(van, dox, c3__free, hyp);
u3_noun old_type, old_axis;
u3_noun new_type, new_axis;
{
if ( c3y != u3h(fid) ) {
return u3m_error("mull-bonk-x");
}
else {
u3_noun pp_fid = u3h(u3t(fid));
u3_noun qp_fid = u3t(u3t(fid));
if ( c3y != u3h(qp_fid) ) {
return u3m_error("mull-bonk-x");
}
new_type = u3t(qp_fid);
new_axis = _mull_tend(pp_fid);
}
}
{
if ( c3y != u3h(gax) ) {
return u3m_error("mull-bonk-x");
}
else {
u3_noun pp_gax = u3h(u3t(gax));
u3_noun qp_gax = u3t(u3t(gax));
if ( c3y != u3h(qp_gax) ) {
return u3m_error("mull-bonk-x");
}
old_type = u3t(qp_gax);
old_axis = _mull_tend(pp_gax);
}
}
if ( c3n == u3r_sing(old_axis, new_axis) ) {
return u3m_error("mull-bonk-x");
}
else if ( c3n == u3qfu_nest(van, old_type, c3y, new_type) ) {
return u3m_error("mull-bonk-x");
}
u3z(old_axis);
u3z(new_axis);
u3z(gax);
u3z(fid);
return _mull_both(van, gol, _mull_bean());
}
case c3__wtcl: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
_mull_used();
{
@ -502,7 +500,7 @@
case c3__dtkt: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun nog = u3nc(c3__bunt, u3k(p_gen));
u3_noun nog = u3nc(c3__kttr, u3k(p_gen));
u3_noun vay = _mull_in(van, sut, c3__noun, dox, q_gen);
u3_noun ret;
@ -570,6 +568,7 @@
return pro;
}
case c3__ktpd:
case c3__ktpm: p_gen = u3t(gen);
_mull_used();
{
@ -600,38 +599,17 @@
return pro;
}
case c3__help: u3x_cell(u3t(gen), &p_gen, &q_gen);
case c3__note: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun vat = _mull_in(van, sut, gol, dox, q_gen);
u3_noun ret = u3nc(u3qf_help(p_gen, u3h(vat)),
u3qf_help(p_gen, u3t(vat)));
u3z(vat);
return ret;
}
case c3__docs: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun vat = _mull_in(van, sut, gol, dox, q_gen);
u3_noun hep = u3nc(c3__docs, u3k(p_gen));
u3_noun ret = u3nc(u3qf_help(hep, u3h(vat)),
u3qf_help(hep, u3t(vat)));
u3z(hep);
u3z(vat);
return ret;
}
case c3__ktts: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun vat = _mull_in(van, sut, gol, dox, q_gen);
u3_noun ret = u3nc(u3qfu_conk(van, u3h(vat), p_gen),
u3qfu_conk(van, u3t(vat), p_gen));
u3_noun hit = u3nc(u3k(sut), u3k(p_gen));
u3_noun hix = u3nc(u3k(dox), u3k(p_gen));
u3_noun ret = u3nc(u3qf_hint(hit, u3h(vat)),
u3qf_hint(hix, u3t(vat)));
u3z(hix);
u3z(hit);
u3z(vat);
return ret;
}
@ -661,7 +639,7 @@
return ret;
}
case c3__tsgr: u3x_cell(u3t(gen), &p_gen, &q_gen);
case c3__tsbn: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun lem = _mull_in(van, sut, c3__noun, dox, p_gen);
@ -673,19 +651,6 @@
return ret;
}
case c3__tstr: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
_mull_used();
{
u3_noun boc = u3qfu_buss(van, sut, p_gen, q_gen);
u3_noun nuf = u3qfu_buss(van, dox, p_gen, q_gen);
u3_noun ret = _mull_in(van, boc, gol, nuf, r_gen);
u3z(boc);
u3z(nuf);
return ret;
}
case c3__tscm: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
@ -710,7 +675,20 @@
{
u3_noun ruf = u3nc(u3_nul, 1);
ret = _mull_grow(van, sut, gol, dox, c3__gold, ruf, p_gen, q_gen);
ret = _mull_grow
(van, sut, gol, dox, c3__gold, p_gen, c3__dry, ruf, q_gen);
u3z(ruf);
return ret;
}
case c3__brvt: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun ruf = u3nc(u3_nul, 1);
ret = _mull_grow
(van, sut, gol, dox, c3__gold, p_gen, c3__wet, ruf, q_gen);
u3z(ruf);
return ret;
@ -733,7 +711,7 @@
return ret;
}
case c3__sggr: u3x_cell(u3t(gen), &p_gen, &q_gen);
case c3__sgbn: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
return _mull_in(van, sut, gol, dox, q_gen);
@ -794,6 +772,23 @@
return u3nc
(_mull_nice(van, gol, p_ret), q_ret);
}
case c3__zpvt: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
_mull_used();
{
c3_o fes = _mull_feel(van, sut, p_gen);
c3_o fed = _mull_feel(van, dox, p_gen);
if ( fes != fed ) {
return u3m_error("mull-bonk-f");
}
else {
if ( c3y == fes ) {
return _mull_in(van, sut, gol, dox, q_gen);
} else {
return _mull_in(van, sut, gol, dox, r_gen);
}
}
}
case c3__lost:
case c3__fail:
@ -842,7 +837,7 @@
u3_noun dox,
u3_noun gen)
{
c3_m fun_m = 144 + c3__mull + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
c3_m fun_m = 141 + c3__mull + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_4(fun_m, sut, gol, dox, gen);
if ( u3_none != pro ) {

View File

@ -28,7 +28,7 @@
} else {
u3_noun n_dab, l_dab, r_dab;
u3_noun n_hem, l_hem, r_hem;
u3_noun pn_hem, pqn_hem, qqn_hem, pn_dab, pqn_dab, qqn_dab;
u3_noun pn_hem, qn_hem, pn_dab, qn_dab;
u3x_trel(dab, &n_dab, &l_dab, &r_dab);
u3x_trel(hem, &n_hem, &l_hem, &r_hem);
@ -38,37 +38,21 @@
{
return c3n;
}
u3x_trel(n_dab, &pn_dab, &pqn_dab, &qqn_dab);
u3x_trel(n_hem, &pn_hem, &pqn_hem, &qqn_hem);
u3x_cell(n_dab, &pn_dab, &qn_dab);
u3x_cell(n_hem, &pn_hem, &qn_hem);
if ( c3n == u3r_sing(pn_dab, pn_hem) ) {
return c3n;
} else {
if ( (c3n == u3du(qqn_dab)) || (c3n == u3du(qqn_hem)) ) {
return u3m_bail(c3__fail);
}
else switch ( u3h(qqn_dab) ) {
default: return u3m_bail(c3__exit);
case c3__ash: {
if ( c3__ash != u3h(qqn_hem) ) {
return c3n;
} else {
u3_noun qqqn_dab = u3t(qqn_dab);
u3_noun qqqn_hem = u3t(qqn_hem);
u3_noun vis = u3qfu_play(van, sut, qqqn_dab);
u3_noun lon = u3qfu_play(van, ref, qqqn_hem);
u3_noun ret = _nest_dext(van, vis, tel, lon, u3_nul, u3_nul, gil);
}
else {
u3_noun vis = u3qfu_play(van, sut, qn_dab);
u3_noun lon = u3qfu_play(van, ref, qn_hem);
u3z(vis);
u3z(lon);
return ret;
}
}
case c3__elm: {
return u3r_sing(qqn_dab, qqn_hem);
}
}
u3_noun ret = _nest_dext(van, vis, tel, lon, u3_nul, u3_nul, gil);
u3z(vis);
u3z(lon);
return ret;
}
}
}
@ -89,7 +73,8 @@
} else {
u3_noun n_dom, l_dom, r_dom;
u3_noun n_vim, l_vim, r_vim;
u3_noun pn_vim, pqn_vim, qqn_vim, pn_dom, pqn_dom, qqn_dom;
u3_noun pn_vim, qn_vim, pn_dom, qn_dom;
u3_noun pqn_vim, qqn_vim, pqn_dom, qqn_dom;
u3x_trel(dom, &n_dom, &l_dom, &r_dom);
u3x_trel(vim, &n_vim, &l_vim, &r_vim);
@ -99,8 +84,11 @@
{
return c3n;
}
u3x_trel(n_dom, &pn_dom, &pqn_dom, &qqn_dom);
u3x_trel(n_vim, &pn_vim, &pqn_vim, &qqn_vim);
u3x_cell(n_dom, &pn_dom, &qn_dom);
u3x_cell(n_vim, &pn_vim, &qn_vim);
u3x_cell(qn_dom, &pqn_dom, &qqn_dom);
u3x_cell(qn_vim, &pqn_vim, &qqn_vim);
if ( c3n == u3r_sing(pn_dom, pn_vim) ) {
return c3n;
@ -118,23 +106,31 @@
u3_noun gil)
{
u3_noun p_sut, q_sut, p_ref, q_ref;
u3_noun pq_sut, qq_sut, rq_sut, sq_sut;
u3_noun pq_ref, qq_ref, rq_ref, sq_ref;
u3_noun psq_sut, qsq_sut, psq_ref, qsq_ref;
u3_noun pq_sut, qq_sut, rq_sut;
u3_noun pq_ref, qq_ref, rq_ref;
u3_noun prq_sut, qrq_sut, prq_ref, qrq_ref;
u3_noun ppq_sut, qpq_sut, rpq_sut;
u3_noun ppq_ref, qpq_ref, rpq_ref;
u3_noun ret;
u3x_trel(sut, 0, &p_sut, &q_sut);
u3x_trel(ref, 0, &p_ref, &q_ref);
u3x_qual(q_sut, &pq_sut, &qq_sut, &rq_sut, &sq_sut);
u3x_qual(q_ref, &pq_ref, &qq_ref, &rq_ref, &sq_ref);
u3x_trel(q_sut, &pq_sut, &qq_sut, &rq_sut);
u3x_trel(q_ref, &pq_ref, &qq_ref, &rq_ref);
u3x_trel(pq_sut, &ppq_sut, &qpq_sut, &rpq_sut);
u3x_trel(pq_ref, &ppq_ref, &qpq_ref, &rpq_ref);
u3x_cell(sq_sut, &psq_sut, &qsq_sut);
u3x_cell(sq_ref, &psq_ref, &qsq_ref);
u3x_cell(rq_sut, &prq_sut, &qrq_sut);
u3x_cell(rq_ref, &prq_ref, &qrq_ref);
if ( c3y == u3r_sing(q_sut, q_ref) ) {
return _nest_dext(van, p_sut, tel, p_ref, u3_nul, u3_nul, gil);
}
else if ( c3n == u3r_sing(qpq_sut, qpq_ref) ) {
return c3n;
}
else if ( (c3n == _nest_dext
(van, qq_sut, tel, p_sut, u3_nul, u3_nul, gil)) ||
(c3n == _nest_dext
@ -145,12 +141,18 @@
return c3n;
}
else {
if ( (pq_sut != pq_ref) &&
(c3__lead != pq_sut) &&
(c3__gold != pq_ref) )
if ( (rpq_sut != rpq_ref) &&
(c3__lead != rpq_sut) &&
(c3__gold != rpq_ref) )
{
return c3n;
}
else if ( c3__wet == qpq_sut ) {
return u3r_sing(qrq_sut, qrq_ref);
}
else if ( c3y == u3r_sing(qrq_sut, qrq_ref) ) {
return c3y;
}
else {
u3_noun hud = u3nc(u3k(sut), u3k(ref));
@ -163,15 +165,15 @@
u3_noun zoc = u3qdi_put(gil, hud);
u3_noun tus = u3nt(c3__core,
u3k(qq_sut),
u3nc(c3__gold,
u3nc(u3nt(u3k(ppq_sut), u3k(qpq_sut), c3__gold),
u3k(u3t(q_sut))));
u3_noun fer = u3nt(c3__core,
u3k(qq_ref),
u3nc(c3__gold,
u3nc(u3nt(u3k(ppq_ref), u3k(qpq_ref), c3__gold),
u3k(u3t(q_ref))));
ret = _nest_dope(van, tus, tel, fer, qsq_sut, qsq_ref, zoc);
ret = _nest_dope(van, tus, tel, fer, qrq_sut, qrq_ref, zoc);
u3z(fer);
u3z(tus);
u3z(zoc);
@ -181,7 +183,7 @@
return c3n;
}
else {
switch ( pq_sut ) {
switch ( rpq_sut ) {
default: return u3m_bail(c3__fail);
case c3__gold: {
@ -283,7 +285,7 @@
else return _nest_sint(van, sut, tel, ref, seg, reg, gil);
}
}
case c3__help:
case c3__hint:
case c3__face: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);
@ -395,7 +397,7 @@
}
{
c3_m fun_m = 144 + c3__nest + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
c3_m fun_m = 141 + c3__nest + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_2(fun_m, sut, ref);
if ( u3_none != pro ) {
@ -447,7 +449,7 @@
u3z(gam);
return hiv;
}
case c3__help:
case c3__hint:
case c3__face: {
if ( c3n == u3r_trel(ref, 0, &p_ref, &q_ref) ) {
return u3m_bail(c3__fail);
@ -540,7 +542,7 @@
u3_noun ref)
{
#if 1
c3_m fun_m = 144 + c3__nest;
c3_m fun_m = 141 + c3__nest;
u3_noun vrf = u3r_at(u3qfu_van_vrf, van);
u3_noun pro = u3z_find_4(fun_m, vrf, sut, tel, ref);

View File

@ -71,10 +71,12 @@
}
case c3__core: {
u3_noun pq_sut, qq_sut, rq_sut;
u3_noun ppq_sut, qpq_sut, rpq_sut;
u3_noun prq_sut, qrq_sut;
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ||
(c3n == u3r_trel(q_sut, &pq_sut, &qq_sut, &rq_sut)) ||
(c3n == u3r_trel(pq_sut, &ppq_sut, &qpq_sut, &rpq_sut)) ||
(c3n == u3r_cell(rq_sut, &prq_sut, &qrq_sut)) )
{
return u3m_bail(c3__fail);
@ -83,7 +85,7 @@
u3_atom lat = u3qc_mas(axe);
if ( 3 == now ) {
u3_noun pec = u3qfu_peel(van, sut, way, pq_sut);
u3_noun pec = u3qfu_peel(van, sut, way, rpq_sut);
u3_noun sam = u3h(pec);
u3_noun con = u3t(pec);
@ -128,7 +130,7 @@
return pro;
}
}
case c3__help:
case c3__hint:
case c3__face: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);
@ -200,7 +202,7 @@
u3_noun way,
u3_noun axe)
{
c3_m fun_m = 144 + c3__peek + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
c3_m fun_m = 141 + c3__peek + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_3(fun_m, sut, way, axe);
if ( u3_none != pro ) {

View File

@ -79,6 +79,20 @@
return ret;
}
static u3_noun
_play_feel(u3_noun van,
u3_noun sut,
u3_noun rot)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "feel");
return u3n_kick_on(u3i_molt(gat,
u3x_sam,
u3k(rot),
0));
}
#if 0
static u3_noun
_play_loc_term(u3_noun van,
@ -167,17 +181,17 @@
_play_grow(u3_noun van,
u3_noun sut,
u3_atom mel,
u3_noun nym,
u3_noun hud,
u3_noun ruf,
u3_noun wan,
u3_noun dom)
{
u3_noun dan = _play_in(van, sut, ruf);
return _play_core(dan,
u3nq(u3k(mel),
u3nt(u3nt(u3k(nym), u3k(hud), u3k(mel)),
u3k(dan),
u3k(wan),
u3nc(u3nc(u3_nul, u3_nul),
u3nc(u3nc(u3nc(c3__full, u3_nul), u3_nul),
u3k(dom))));
}
@ -216,10 +230,9 @@
if ( c3n == u3du(gen) ) {
open: {
u3_noun fab = u3r_at(u3qfu_van_fab, van);
u3_noun ter = u3r_at(u3x_con_3, van);
u3_noun rex = (c3n == fab) ? u3qfp_nepo(ter, gen)
: u3qfp_open(ter, gen);
u3_noun fab = u3r_at(u3qfu_van_fab, van);
u3_noun rex = u3qfp_open(ter, fab, gen);
u3_noun ret;
if ( c3y == u3r_sing(rex, gen) ) {
@ -286,7 +299,7 @@
case c3__dtkt: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun nog = u3nc(c3__bunt, u3k(p_gen));
u3_noun nog = u3nc(c3__kttr, u3k(p_gen));
u3_noun ret = _play_x(van, sut, nog);
u3z(nog);
@ -365,34 +378,14 @@
return pro;
}
case c3__help: u3x_cell(u3t(gen), &p_gen, &q_gen);
case c3__note: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun boc = _play_x(van, sut, q_gen);
u3_noun ret = u3qf_help(p_gen, boc);
u3z(boc);
return ret;
}
case c3__docs: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun boc = _play_x(van, sut, q_gen);
u3_noun hep = u3nc(c3__docs, u3k(p_gen));
u3_noun ret = u3qf_help(hep, boc);
u3z(hep);
u3z(boc);
return ret;
}
case c3__ktts: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun boc = _play_x(van, sut, q_gen);
u3_noun ret = u3qfu_conk(van, boc, p_gen);
u3_noun hit = u3nc(u3k(sut), u3k(p_gen));
u3_noun ret = u3qf_hint(hit, boc);
u3z(hit);
u3z(boc);
return ret;
}
@ -415,7 +408,7 @@
return _play_x(van, sut, p_gen);
}
case c3__tsgr: u3x_cell(u3t(gen), &p_gen, &q_gen);
case c3__tsbn: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun boc = _play_x(van, sut, p_gen);
@ -425,16 +418,6 @@
return ret;
}
case c3__tstr: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
_play_used();
{
u3_noun boc = u3qfu_buss(van, sut, p_gen, q_gen);
u3_noun ret = _play_x(van, boc, r_gen);
u3z(boc);
return ret;
}
case c3__tscm: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
@ -455,7 +438,19 @@
_play_used();
{
u3_noun ruf = u3nc(u3_nul, 1);
u3_noun ret = _play_grow(van, sut, c3__gold, ruf, p_gen, q_gen);
u3_noun ret = _play_grow
(van, sut, c3__gold, p_gen, c3__dry, ruf, q_gen);
u3z(ruf);
return ret;
}
case c3__brvt: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun ruf = u3nc(u3_nul, 1);
u3_noun ret = _play_grow
(van, sut, c3__gold, p_gen, c3__wet, ruf, q_gen);
u3z(ruf);
return ret;
@ -478,7 +473,7 @@
return ret;
}
case c3__sggr: u3x_cell(u3t(gen), &p_gen, &q_gen);
case c3__sgbn: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
return _play_x(van, sut, q_gen);
@ -539,6 +534,16 @@
return ret;
}
case c3__zpvt: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
_play_used();
{
if ( c3y == _play_feel(van, sut, p_gen) ) {
return _play_x(van, sut, q_gen);
} else {
return _play_x(van, sut, r_gen);
}
}
case c3__lost:
case c3__fail:
case c3__zpzp:
@ -583,7 +588,7 @@
u3_noun gen)
{
#if 1
c3_m fun_m = 144 + c3__play;
c3_m fun_m = 141 + c3__play;
u3_noun vrf = u3r_at(u3qfu_van_vrf, van);
u3_noun pro = u3z_find_3(fun_m, vrf, sut, gen);

View File

@ -34,7 +34,7 @@
return u3nt(c3__cell, c3__noun, u3k(p_sut));
}
}
case c3__help:
case c3__hint:
case c3__face: {
if ( c3n == u3r_cell(u3t(sut), &p_sut, &q_sut)) {
return u3m_bail(c3__fail);

View File

@ -100,7 +100,7 @@
u3_noun sut,
u3_noun leg)
{
c3_m fun_m = 144 + c3__rest + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
c3_m fun_m = 141 + c3__rest + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_2(fun_m, sut, leg);
if ( u3_none != pro ) {

View File

@ -32,21 +32,24 @@
case c3__core: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3_noun pq_sut, qq_sut, rq_sut, sq_sut;
u3_noun pq_sut, qq_sut, rq_sut;
u3_noun ppq_sut, qpq_sut, rpq_sut;
if ( c3n == u3r_qual(q_sut, &pq_sut, &qq_sut, &rq_sut, &sq_sut) ) {
if ( c3n == u3r_trel(q_sut, &pq_sut, &qq_sut, &rq_sut) ) {
return u3m_bail(c3__fail);
}
else if ( c3__gold != pq_sut ) {
if ( c3n == u3r_trel(pq_sut, &ppq_sut, &qpq_sut, &rpq_sut) ) {
return u3m_bail(c3__fail);
}
else if ( c3__gold != rpq_sut ) {
return u3m_error("wrap-gold");
}
else {
return u3nt(c3__core,
u3k(p_sut),
u3nq(u3k(yoz),
u3nt(u3nt(u3k(ppq_sut), u3k(qpq_sut), u3k(yoz)),
u3k(qq_sut),
u3k(rq_sut),
u3k(sq_sut)));
u3k(rq_sut)));
}
}
case c3__fork: p_sut = u3t(sut);

File diff suppressed because it is too large Load Diff

1054
jets/z/ap.c Normal file

File diff suppressed because it is too large Load Diff

29
jets/z/cell.c Normal file
View File

@ -0,0 +1,29 @@
/* j/6/cell.c
**
*/
#include "all.h"
/* functions
*/
u3_noun
u3qz_cell(u3_noun hed,
u3_noun tal)
{
if ( (c3__void == hed) || (c3__void == tal) ) {
return c3__void;
} else {
return u3nt(c3__cell, u3k(hed), u3k(tal));
}
}
u3_noun
u3wz_cell(u3_noun cor)
{
u3_noun hed, tal;
if ( c3n == u3r_mean(cor, u3x_sam_2, &hed, u3x_sam_3, &tal, 0) ) {
return u3m_bail(c3__fail);
} else {
return u3qz_cell(hed, tal);
}
}

70
jets/z/comb.c Normal file
View File

@ -0,0 +1,70 @@
/* j/6/comb.c
**
*/
#include "all.h"
/* functions
*/
u3_noun
u3qz_comb(u3_noun mal,
u3_noun buz)
{
if ( (u3_none == mal) || (u3_none == buz) ) {
return u3_none;
}
else {
u3_noun p_mal, q_mal, p_buz, q_buz, pp_buz, pq_buz;
if ( (c3y == u3r_p(mal, 0, &p_mal)) && (0 != p_mal) ) {
if ( (c3y == u3r_p(buz, 0, &p_buz)) && (0 != p_buz) ) {
return u3nc(0,
u3qc_peg(p_mal, p_buz));
}
else if ( c3y == u3r_pq(buz, 2, &p_buz, &q_buz) &&
c3y == u3r_p(p_buz, 0, &pp_buz) &&
c3y == u3r_p(q_buz, 0, &pq_buz) )
{
return u3nt(2,
u3nc(0,
u3qc_peg(p_mal, pp_buz)),
u3nc(0,
u3qc_peg(p_mal, pq_buz)));
}
else return u3nt(7,
u3k(mal),
u3k(buz));
}
#if 1
else if ( (c3y == u3r_bush(mal, &p_mal, &q_mal)) &&
(c3y == u3du(p_mal)) &&
(c3y == u3du(q_mal)) &&
(0 == u3h(q_mal)) &&
(1 == u3t(q_mal)) )
{
return u3nt(8,
u3k(p_mal),
u3k(buz));
}
#endif
else if ( (c3y == u3r_p(buz, 0, &p_buz)) &&
(c3y == u3r_sing(1, p_buz)) )
{
return u3k(mal);
}
else return u3nt(7,
u3k(mal),
u3k(buz));
}
}
u3_noun
u3wz_comb(u3_noun cor)
{
u3_noun mal, buz;
if ( c3n == u3r_mean(cor, u3x_sam_2, &mal, u3x_sam_3, &buz, 0) ) {
return u3_none;
} else {
return u3qz_comb(mal, buz);
}
}

52
jets/z/cons.c Normal file
View File

@ -0,0 +1,52 @@
/* j/6/cons.c
**
*/
#include "all.h"
/* functions
*/
u3_noun
u3qz_cons(u3_noun vur,
u3_noun sed)
{
u3_noun p_vur, p_sed;
if ( c3y == u3r_p(vur, 1, &p_vur) &&
c3y == u3r_p(sed, 1, &p_sed) ) {
return u3nt(1,
u3k(p_vur),
u3k(p_sed));
}
else if ( c3y == u3r_p(vur, 0, &p_vur) &&
c3y == u3r_p(sed, 0, &p_sed) &&
!(c3y == u3r_sing(1, p_vur)) &&
!(c3y == u3r_sing(p_vur, p_sed)) &&
(0 == u3r_nord(p_vur, p_sed)) )
{
u3_atom fub = u3qa_div(p_vur, 2);
u3_atom nof = u3qa_div(p_sed, 2);
if ( c3y == u3r_sing(fub, nof) ) {
u3z(nof);
return u3nc(0, fub);
}
else {
u3z(fub);
u3z(nof);
}
}
return u3nc(u3k(vur), u3k(sed));
}
u3_noun
u3wz_cons(u3_noun cor)
{
u3_noun vur, sed;
if ( c3n == u3r_mean(cor, u3x_sam_2, &vur, u3x_sam_3, &sed, 0) ) {
return u3m_bail(c3__fail);
} else {
return u3qz_cons(vur, sed);
}
}

42
jets/z/core.c Normal file
View File

@ -0,0 +1,42 @@
/* j/6/core.c
**
*/
#include "all.h"
/* functions
*/
u3_noun
u3qz_core(u3_noun pac,
u3_noun con)
{
if ( (c3__void == pac) ) {
return c3__void;
} else {
{
u3_noun p_con, q_con, r_con, hr_con, tr_con;
u3r_trel(con, &p_con, &q_con, &r_con);
u3r_cell(r_con, &hr_con, &tr_con);
if ( (c3y == u3du(hr_con)) &&
(u3_nul == u3h(hr_con)) &&
(u3_nul == u3t(hr_con)) )
{
fprintf(stderr, "old core\r\n");
abort();
}
}
return u3nt(c3__core, u3k(pac), u3k(con));
}
}
u3_noun
u3wz_core(u3_noun cor)
{
u3_noun pac, con;
if ( c3n == u3r_mean(cor, u3x_sam_2, &pac, u3x_sam_3, &con, 0) ) {
return u3m_bail(c3__fail);
} else {
return u3qz_core(pac, con);
}
}

View File

@ -1,4 +1,4 @@
/* j/6/help.c
/* j/6/face.c
**
*/
#include "all.h"
@ -7,25 +7,25 @@
/* functions
*/
u3_noun
u3qf_help(u3_noun sag,
u3qz_face(u3_noun sag,
u3_noun tip)
{
if ( c3__void == tip ) {
return c3__void;
}
else return u3nt(c3__help,
else return u3nt(c3__face,
u3k(sag),
u3k(tip));
}
u3_noun
u3wf_help(u3_noun cor)
u3wz_face(u3_noun cor)
{
u3_noun sag, tip;
if ( c3n == u3r_mean(cor, u3x_sam_2, &sag, u3x_sam_3, &tip, 0) ) {
return u3m_bail(c3__fail);
} else {
return u3qf_help(sag, tip);
return u3qz_face(sag, tip);
}
}

35
jets/z/fine.c Normal file
View File

@ -0,0 +1,35 @@
/* j/6/fine.c
**
*/
#include "all.h"
/* functions
*/
u3_noun
u3qz_fine(u3_noun fuv,
u3_noun lup,
u3_noun mar)
{
if ( (c3__void == lup) || (c3__void == mar) ) {
return c3__void;
} else {
return u3nq(c3__fine,
u3k(fuv),
u3k(lup),
u3k(mar));
}
}
u3_noun
u3wz_fine(u3_noun cor)
{
u3_noun fuv, lup, mar;
if ( c3n == u3r_mean(cor, u3x_sam_2, &fuv,
u3x_sam_6, &lup,
u3x_sam_7, &mar, 0) ) {
return u3m_bail(c3__fail);
} else {
return u3qz_fine(fuv, lup, mar);
}
}

67
jets/z/fitz.c Normal file
View File

@ -0,0 +1,67 @@
/* j/6/fitz.c
**
*/
#include "all.h"
/* functions
*/
static u3_noun
_fitz_fiz(u3_noun yaz,
u3_noun wix)
{
c3_w yaz_w = u3r_met(3, yaz);
c3_w wix_w = u3r_met(3, wix);
c3_y yaz_y, wix_y;
yaz_y = (0 == yaz_w) ? 0 : u3r_byte((yaz_w - 1), yaz);
if ( (yaz_y < 'A') || (yaz_y > 'Z') ) yaz_y = 0;
wix_y = (0 == wix_w) ? 0 : u3r_byte((wix_w - 1), wix);
if ( (wix_y < 'A') || (wix_y > 'Z') ) wix_y = 0;
if ( yaz_y && wix_y ) {
if ( !wix_y || (wix_y > yaz_y) ) {
return c3n;
}
}
return c3y;
}
u3_noun
u3qz_fitz(u3_noun yaz,
u3_noun wix)
{
c3_w i_w, met_w = c3_min(u3r_met(3, yaz), u3r_met(3, wix));
if ( c3n == _fitz_fiz(yaz, wix) ) {
return c3n;
}
for ( i_w = 0; i_w < met_w; i_w++ ) {
c3_y yaz_y = u3r_byte(i_w, yaz);
c3_y wix_y = u3r_byte(i_w, wix);
if ( (yaz_y >= 'A') && (yaz_y <= 'Z') ) yaz_y = 0;
if ( (wix_y >= 'A') && (wix_y <= 'Z') ) wix_y = 0;
if ( yaz_y && wix_y && (yaz_y != wix_y) ) {
return c3n;
}
}
return c3y;
}
u3_noun
u3wz_fitz(u3_noun cor)
{
u3_noun yaz, wix;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &yaz, u3x_sam_3, &wix, 0)) ||
(c3n == u3ud(yaz)) ||
(c3n == u3ud(wix)) )
{
return u3m_bail(c3__fail);
} else {
return u3qz_fitz(yaz, wix);
}
}

44
jets/z/flan.c Normal file
View File

@ -0,0 +1,44 @@
/* j/6/flan.c
**
*/
#include "all.h"
/* functions
*/
u3_noun
u3qz_flan(u3_noun bos,
u3_noun nif)
{
if ( c3y == u3r_sing(1, u3h(bos)) ) {
if ( (u3_nul == u3t(bos)) ) {
return u3k(nif);
}
else return u3k(bos);
}
else {
if ( c3y == u3r_sing(1, u3h(nif)) ) {
if ( (u3_nul == u3t(nif)) ) {
return u3k(bos);
}
else return u3k(nif);
}
else {
return u3nq(6,
u3k(bos),
u3k(nif),
u3nc(1, c3n));
}
}
}
u3_noun
u3wz_flan(u3_noun cor)
{
u3_noun bos, nif;
if ( c3n == u3r_mean(cor, u3x_sam_2, &bos, u3x_sam_3, &nif, 0) ) {
return u3m_bail(c3__fail);
} else {
return u3qz_flan(bos, nif);
}
}

39
jets/z/flip.c Normal file
View File

@ -0,0 +1,39 @@
/* j/6/flip.c
**
*/
#include "all.h"
/* functions
*/
u3_noun
u3qz_flip(u3_noun hel)
{
if ( c3y == u3r_sing(1, u3h(hel)) ) {
if ( (c3y == u3t(hel)) ) {
return u3nc(1, c3n);
}
else {
c3_assert((c3n == u3t(hel)));
return u3nc(1, c3y);
}
}
else {
return u3nq(6,
u3k(hel),
u3nc(1, c3n),
u3nc(1, c3y));
}
}
u3_noun
u3wz_flip(u3_noun cor)
{
u3_noun hel;
if ( u3_none == (hel = u3r_at(u3x_sam, cor)) ) {
return u3m_bail(c3__fail);
} else {
return u3qz_flip(hel);
}
}

44
jets/z/flor.c Normal file
View File

@ -0,0 +1,44 @@
/* j/6/flor.c
**
*/
#include "all.h"
/* functions
*/
u3_noun
u3qz_flor(u3_noun bos,
u3_noun nif)
{
if ( c3y == u3r_sing(1, u3h(bos)) ) {
if ( (u3_nul == u3t(bos)) ) {
return u3k(bos);
}
else return u3k(nif);
}
else {
if ( c3y == u3r_sing(1, u3h(nif)) ) {
if ( (u3_nul == u3t(nif)) ) {
return u3k(nif);
}
else return u3k(bos);
}
else {
return u3nq(6,
u3k(bos),
u3nc(1, c3y),
u3k(nif));
}
}
}
u3_noun
u3wz_flor(u3_noun cor)
{
u3_noun bos, nif;
if ( c3n == u3r_mean(cor, u3x_sam_2, &bos, u3x_sam_3, &nif, 0) ) {
return u3m_bail(c3__fail);
} else {
return u3qz_flor(bos, nif);
}
}

78
jets/z/fork.c Normal file
View File

@ -0,0 +1,78 @@
/* j/6/fork.c
**
*/
#include "all.h"
/* functions
*/
u3_noun
u3qz_forq(u3_noun hoz,
u3_noun bur)
{
if ( c3y == u3r_sing(hoz, bur) ) {
return u3k(hoz);
}
else if ( c3__void == bur ) {
return u3k(hoz);
}
else if ( c3__void == hoz ) {
return u3k(bur);
}
else return u3kz_fork(u3nt(u3k(hoz), u3k(bur), u3_nul));
}
u3_noun
u3qz_fork(u3_noun yed)
{
u3_noun lez = u3_nul;
while ( u3_nul != yed ) {
u3_noun i_yed = u3h(yed);
if ( c3__void != i_yed ) {
if ( (c3y == u3du(i_yed)) && (c3__fork == u3h(i_yed)) ) {
lez = u3kdi_uni(lez, u3k(u3t(i_yed)));
}
else {
lez = u3kdi_put(lez, u3k(i_yed));
}
}
yed = u3t(yed);
}
if ( u3_nul == lez ) {
return c3__void;
}
else if ( (u3_nul == u3h(u3t(lez))) && (u3_nul == u3t(u3t(lez))) ) {
u3_noun ret = u3k(u3h(lez));
u3z(lez);
return ret;
}
else {
return u3nc(c3__fork, lez);
}
}
u3_noun
u3wz_fork(u3_noun cor)
{
u3_noun yed;
if ( c3n == u3r_mean(cor, u3x_sam, &yed, 0) ) {
return u3m_bail(c3__fail);
} else {
return u3qz_fork(yed);
}
}
u3_noun
u3kz_fork(u3_noun yed)
{
u3_noun ret = u3qz_fork(yed);
u3z(yed);
return ret;
}

136
jets/z/hike.c Normal file
View File

@ -0,0 +1,136 @@
/* j/6/hike.c
**
*/
#include "all.h"
/* internal tools
*/
/* _lily_hike_belt_root(): convert (pac) to a list of root tools.
*/
static u3_noun
_lily_hike_belt_root(u3_noun pac)
{
if ( (u3_nul == pac) ) {
return u3_nul;
}
else {
u3_atom axis = u3h(u3h(pac));
u3_noun tool = u3t(u3h(pac));
u3_noun list_tool = _lily_hike_belt_root(u3t(pac));
if ( c3y == u3r_sing(1, axis) ) {
return u3nc(u3k(tool),
list_tool);
}
else return list_tool;
}
}
/* _lily_hike_belt_l(): factor (pac) left.
*/
static u3_noun
_lily_hike_belt_l(u3_noun pac)
{
if ( (u3_nul == pac) ) {
return u3_nul;
}
else {
u3_atom axis = u3h(u3h(pac));
u3_noun tool = u3t(u3h(pac));
u3_noun belt_l = _lily_hike_belt_l(u3t(pac));
{
if ( (1 != axis) &&
(c3y == u3r_sing(2, u3qc_cap(axis))) )
{
u3_atom axis_tap = u3qc_mas(axis);
return u3nc(u3nc(u3k(axis_tap),
u3k(tool)),
belt_l);
}
else return belt_l;
}
}
}
/* _lily_hike_belt_r(): factor (pac) right.
*/
static u3_noun
_lily_hike_belt_r(u3_noun pac)
{
if ( (u3_nul == pac) ) {
return u3_nul;
}
else {
u3_atom axis = u3h(u3h(pac));
u3_noun tool = u3t(u3h(pac));
u3_noun belt_r = _lily_hike_belt_r(u3t(pac));
{
if ( (1 != axis) &&
(c3y == u3r_sing(3, u3qc_cap(axis))) )
{
u3_atom axis_tap = u3qc_mas(axis);
return u3nc(u3nc(u3k(axis_tap),
u3k(tool)),
belt_r);
}
else return belt_r;
}
}
}
/* functions
*/
u3_noun
u3qz_hike(u3_noun axe,
u3_noun pac)
{
if ( (u3_nul == pac) ) {
return u3nc(0, u3k(axe));
}
else {
u3_noun zet = _lily_hike_belt_root(pac);
if ( u3_nul != zet ) {
u3_noun fol = u3k(u3h(zet));
u3z(zet);
return fol;
}
else {
u3_noun tum = _lily_hike_belt_l(pac);
u3_noun gam = _lily_hike_belt_r(pac);
u3_noun hax = u3qc_peg(axe, 2);
u3_noun moz = u3qc_peg(axe, 3);
u3_noun zip = u3qz_hike(hax, tum);
u3_noun dof = u3qz_hike(moz, gam);
u3_noun fol = u3qz_cons(zip, dof);
u3z(tum);
u3z(gam);
u3z(hax);
u3z(moz);
u3z(zip);
u3z(dof);
return fol;
}
}
}
u3_noun
u3wz_hike(u3_noun cor)
{
u3_noun axe, pac;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &axe, u3x_sam_3, &pac, 0)) ||
(c3n == u3ud(axe)) )
{
return u3m_bail(c3__fail);
} else {
return u3qz_hike(axe, pac);
}
}

32
jets/z/hint.c Normal file
View File

@ -0,0 +1,32 @@
/* j/6/help.c
**
*/
#include "all.h"
/* functions
*/
u3_noun
u3qz_hint(u3_noun sag,
u3_noun tip)
{
if ( c3__void == tip ) {
return c3__void;
}
if ( c3__noun == tip ) {
return c3__noun;
}
else return u3nt(c3__hint, u3k(sag), u3k(tip));
}
u3_noun
u3wz_hint(u3_noun cor)
{
u3_noun sag, tip;
if ( c3n == u3r_mean(cor, u3x_sam_2, &sag, u3x_sam_3, &tip, 0) ) {
return u3m_bail(c3__fail);
} else {
return u3qz_hint(sag, tip);
}
}

134
jets/z/look.c Normal file
View File

@ -0,0 +1,134 @@
/* j/6/look.c
**
*/
#include "all.h"
/* internals
*/
static u3_noun
_look_in(u3_noun cog,
u3_noun dab,
u3_atom axe)
{
if ( u3_nul == dab ) {
return u3_nul;
}
else {
u3_noun n_dab, l_dab, r_dab;
u3r_trel(dab, &n_dab, &l_dab, &r_dab);
if ( c3n == u3du(n_dab) ) {
// return u3m_bail(c3__fail);
fprintf(stderr, "bad look\r\n");
return u3m_bail(c3__exit) ;
}
else {
u3_noun pn_dab = u3h(n_dab);
u3_noun qn_dab = u3t(n_dab);
if ( (u3_nul == l_dab) && (u3_nul == r_dab) ) {
if ( (c3y == u3du(qn_dab)) &&
(c3y == u3r_sing(cog, pn_dab)) ) {
return u3nt(u3_nul,
u3k(axe),
u3k(qn_dab));
}
else {
return u3_nul;
}
}
else if ( (u3_nul == l_dab) ) {
if ( (c3y == u3du(qn_dab)) &&
(c3y == u3r_sing(cog, pn_dab)) ) {
return u3nt(u3_nul,
u3qc_peg(axe, 2),
u3k(qn_dab));
}
else {
if ( c3y == u3qc_gor(cog, pn_dab) ) {
return u3_nul;
}
else {
u3_noun pro;
axe = u3qc_peg(axe, 3);
pro = _look_in(cog, r_dab, axe);
u3z(axe);
return pro;
}
}
}
else if ( (u3_nul == r_dab) ) {
if ( (c3y == u3du(qn_dab)) &&
(c3y == u3r_sing(cog, pn_dab)) ) {
return u3nt(u3_nul,
u3qc_peg(axe, 2),
u3k(qn_dab));
}
else {
if ( c3y == u3qc_gor(cog, pn_dab) ) {
u3_noun pro;
axe = u3qc_peg(axe, 3);
pro = _look_in(cog, l_dab, axe);
u3z(axe);
return pro;
}
else {
return u3_nul;
}
}
}
else {
if ( (c3y == u3du(qn_dab)) &&
(c3y == u3r_sing(cog, pn_dab)) ) {
return u3nt(u3_nul,
u3qc_peg(axe, 2),
u3k(qn_dab));
}
else {
if ( c3y == u3qc_gor(cog, pn_dab) ) {
u3_noun pro;
axe = u3qc_peg(axe, 6);
pro = _look_in(cog, l_dab, axe);
u3z(axe);
return pro;
}
else {
u3_noun pro;
axe = u3qc_peg(axe, 7);
pro = _look_in(cog, r_dab, axe);
u3z(axe);
return pro;
}
}
}
}
}
}
/* functions
*/
u3_noun
u3qz_look(u3_noun cog,
u3_noun dab)
{
return _look_in(cog, dab, 1);
}
u3_noun
u3wz_look(u3_noun cor)
{
u3_noun cog, dab;
if ( c3n == u3r_mean(cor, u3x_sam_2, &cog, u3x_sam_3, &dab, 0) ) {
return u3m_bail(c3__fail);
} else {
return u3qz_look(cog, dab);
}
}

133
jets/z/loot.c Normal file
View File

@ -0,0 +1,133 @@
/* j/6/loot.c
**
*/
#include "all.h"
/* internals
*/
static u3_noun
_loot_in(u3_noun cog,
u3_noun dom,
u3_atom axe)
{
if ( u3_nul == dom ) {
return u3_nul;
}
else {
u3_noun n_dom, l_dom, r_dom;
u3r_trel(dom, &n_dom, &l_dom, &r_dom);
if ( c3n == u3du(n_dom) ) {
return u3m_bail(c3__fail);
}
else {
u3_noun qn_dom = u3t(n_dom);
u3_noun yep = u3qz_look(cog, qn_dom);
if ( (u3_nul == l_dom) && (u3_nul == r_dom) ) {
if ( u3_nul == yep ) {
return u3_nul;
} else {
u3_noun u_yep = u3t(yep);
u3_noun pro;
pro = u3nt(u3_nul, u3qc_peg(axe, u3h(u_yep)), u3k(u3t(u_yep)));
u3z(yep);
return pro;
}
}
else if ( (u3_nul == l_dom) ) {
if ( u3_nul == yep ) {
u3_noun nax = u3qc_peg(axe, 3);
u3_noun pro;
pro = _loot_in(cog, r_dom, nax);
u3z(nax);
return pro;
}
else {
u3_noun u_yep = u3t(yep);
u3_noun nax = u3qc_peg(axe, 2);
u3_noun pro;
pro = u3nt(u3_nul, u3qc_peg(nax, u3h(u_yep)), u3k(u3t(u_yep)));
u3z(nax);
u3z(yep);
return pro;
}
}
else if ( (u3_nul == r_dom) ) {
if ( u3_nul == yep ) {
u3_noun nax = u3qc_peg(axe, 3);
u3_noun pro;
pro = _loot_in(cog, l_dom, nax);
u3z(nax);
return pro;
}
else {
u3_noun u_yep = u3t(yep);
u3_noun nax = u3qc_peg(axe, 2);
u3_noun pro;
pro = u3nt(u3_nul, u3qc_peg(nax, u3h(u_yep)), u3k(u3t(u_yep)));
u3z(nax);
u3z(yep);
return pro;
}
}
else {
if ( u3_nul == yep ) {
u3_noun nax = u3qc_peg(axe, 6);
u3_noun pey;
pey = _loot_in(cog, l_dom, nax);
u3z(nax);
if ( u3_nul != pey ) {
return pey;
}
else {
u3_noun nax = u3qc_peg(axe, 7);
u3_noun pro;
pro = _loot_in(cog, r_dom, nax);
u3z(nax);
return pro;
}
}
else {
u3_noun u_yep = u3t(yep);
u3_noun nax = u3qc_peg(axe, 2);
u3_noun pro;
pro = u3nt(u3_nul, u3qc_peg(nax, u3h(u_yep)), u3k(u3t(u_yep)));
u3z(nax);
u3z(yep);
return pro;
}
}
}
}
}
/* functions
*/
u3_noun
u3qz_loot(u3_noun cog,
u3_noun dom)
{
return _loot_in(cog, dom, 1);
}
u3_noun
u3wz_loot(u3_noun cor)
{
u3_noun cog, dom;
if ( c3n == u3r_mean(cor, u3x_sam_2, &cog, u3x_sam_3, &dom, 0) ) {
return u3m_bail(c3__fail);
} else {
return u3qz_loot(cog, dom);
}
}

55
jets/z/slot.c Normal file
View File

@ -0,0 +1,55 @@
/* j/6/slot.c
**
*/
#include "all.h"
/* functions
*/
u3_noun
u3qz_slot(u3_atom axe,
u3_noun vax)
{
u3_noun fag = u3r_at(axe, u3t(vax));
fprintf(stderr, "slot axe %d\r\n", axe);
if ( u3_none == fag ) {
return u3m_bail(c3__exit);
}
else {
u3_noun typ = u3qzu_peek(
}
c3_w i_w, met_w = c3_min(u3r_met(3, axe), u3r_met(3, vax));
if ( c3n == _slot_fiz(axe, vax) ) {
return c3n;
}
for ( i_w = 0; i_w < met_w; i_w++ ) {
c3_y axe_y = u3r_byte(i_w, axe);
c3_y vax_y = u3r_byte(i_w, vax);
if ( (axe_y >= 'A') && (axe_y <= 'Z') ) axe_y = 0;
if ( (vax_y >= 'A') && (vax_y <= 'Z') ) vax_y = 0;
if ( axe_y && vax_y && (axe_y != vax_y) ) {
return c3n;
}
}
return c3y;
}
u3_noun
u3we_slot(u3_noun cor)
{
u3_noun axe, vax;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &axe, u3x_sam_3, &vax, 0)) ||
(c3n == u3ud(axe)) ||
(c3n == u3du(vax)) )
{
return u3m_bail(c3__fail);
} else {
return u3qz_slot(axe, vax);
}
}

42
jets/z/type.c Normal file
View File

@ -0,0 +1,42 @@
/* j/6/type.c
**
*/
/* new template for type switching
*/
{
u3_noun p_sut, q_sut, r_sut;
if ( c3n == u3du(sut) ) switch ( sut ) {
default: return u3m_bail(c3__fail);
case c3__noun:
{
}
case c3__void:
{
}
}
else switch ( u3h(sut) ) {
default: return u3m_bail(c3__fail);
case c3__atom: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
}
case c3__cell: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
}
case c3__core: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
}
case c3__face: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
}
case c3__fork: p_sut = u3t(sut);
{
}
case c3__hold: p_sut = u3t(sut);
{
}
}
}

100
jets/z/ut.c Normal file
View File

@ -0,0 +1,100 @@
/* j/6/ut.c
**
*/
#include "all.h"
extern void
u3_pier_tank(c3_l tab_l, u3_noun tac);
// duck: create a duck core for mean.
//
u3_noun
u3qzu_duck(u3_noun van,
u3_noun typ)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(typ), 0);
u3_noun ret = u3j_hook(u3k(von), "dune");
u3z(von);
return ret;
}
// dung: create a dunk core for mean (noun caption)
//
u3_noun
u3qzu_dung(u3_noun van,
u3_noun paz,
u3_noun typ)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(typ), 0);
u3_noun duq = u3j_hook(u3k(von), "dunk");
u3_noun ret = u3i_molt(u3k(duq), u3x_sam, u3k(paz), 0);
u3z(duq);
u3z(von);
return ret;
}
// dunq: create a dunk core for mean
//
u3_noun
u3qzu_dunq(u3_noun van,
const c3_c* paz_c,
u3_noun typ)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(typ), 0);
u3_noun duq = u3j_hook(u3k(von), "dunk");
u3_noun paz = u3i_string(paz_c);
u3_noun ret = u3i_molt(u3k(duq), u3x_sam, u3k(paz), 0);
u3z(paz);
u3z(duq);
u3z(von);
return ret;
}
// dump: dump a type.
//
void
u3qzu_dump(u3_noun van,
const c3_c* paz_c,
u3_noun typ)
{
c3_c* pfix_c = u3r_string((c3y == u3du(typ)) ? u3h(typ) : typ);
c3_c ugh_c[1024];
sprintf(ugh_c, "%s: %s: 0x%8x:",
paz_c, pfix_c, u3r_mug(typ));
#if 0
u3_pier_tank(0, u3n_kick_on(u3qzu_dunq(van, ugh_c, typ)));
#endif
}
// shew: create a show core for mean
//
u3_noun
u3qzu_shew(u3_noun van,
u3_noun mol)
{
u3_noun sho = u3j_hook(u3k(van), "show");
u3_noun ret = u3i_molt(u3k(sho), u3x_sam, u3k(mol), 0);
u3z(sho);
u3z(mol);
return ret;
}
// shep: show with caption and style
//
u3_noun
u3qzu_shep(u3_noun van,
const c3_c* paz_c,
u3_noun sty,
u3_noun mol)
{
return u3qzu_shew(van,
u3nc(u3nc('c', u3i_string(paz_c)),
u3nc(u3k(sty), mol)));
}

93
jets/z/ut_buss.c Normal file
View File

@ -0,0 +1,93 @@
/* j/6/ut_buss.c
**
*/
#include "all.h"
/* logic
*/
static u3_noun
_cqzu_buss(u3_noun van,
u3_noun sut,
u3_noun cog,
u3_noun gen)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "buss");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
u3k(cog),
u3x_sam_3,
u3k(gen),
0));
}
static u3_noun
_cqzu_busk(u3_noun van,
u3_noun sut,
u3_noun gen)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "busk");
return u3n_kick_on(u3i_molt(gat,
u3x_sam,
u3k(gen),
0));
}
/* boilerplate
*/
u3_noun
u3wzu_buss(u3_noun cor)
{
u3_noun sut, cog, gen, van;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &cog,
u3x_sam_3, &gen,
u3x_con, &van,
0)) ||
(c3n == u3ud(cog)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqzu_buss(van, sut, cog, gen);
}
}
u3_noun
u3qzu_buss(u3_noun van,
u3_noun sut,
u3_noun cog,
u3_noun gen)
{
return _cqzu_buss(van, sut, cog, gen);
}
u3_noun
u3wzu_busk(u3_noun cor)
{
u3_noun sut, gen, van;
if ( (c3n == u3r_mean(cor, u3x_sam, &gen,
u3x_con, &van,
0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqzu_busk(van, sut, gen);
}
}
u3_noun
u3qzu_busk(u3_noun van,
u3_noun sut,
u3_noun gen)
{
return _cqzu_busk(van, sut, gen);
}

88
jets/z/ut_conk.c Normal file
View File

@ -0,0 +1,88 @@
/* j/6/ut_conk.c
**
*/
#include "all.h"
/* logic
*/
static u3_noun
_cqzu_conk(u3_noun van,
u3_noun sut,
u3_noun got)
{
if ( c3y == u3ud(got) ) {
u3_noun ret = u3qz_face(u3k(got), sut);
return ret;
}
else switch ( u3h(got) ) {
default: return u3m_bail(c3__fail);
case 0: {
return u3k(sut);
}
case 1: {
u3_noun cok = _cqzu_conk(van, sut, u3t(u3t(got)));
u3_noun nux = u3k(u3h(u3t(got)));
u3_noun ret = u3qz_face(nux, cok);
u3z(nux);
u3z(cok);
return ret;
}
case 2: {
u3_noun vet = u3r_at(u3qzu_van_vet, van);
u3_noun hed, tal, deh, lat, ret;
if ( c3y == vet ) {
u3_noun cel = u3nt(c3__cell, c3__noun, c3__noun);
if ( c3n == u3qzu_nest(van, cel, c3y, sut) ) {
return u3m_bail(c3__fail);
}
u3z(cel);
}
hed = u3qzu_peek(van, sut, c3__both, 2);
tal = u3qzu_peek(van, sut, c3__both, 3);
deh = _cqzu_conk(van, hed, u3h(u3t(got)));
lat = _cqzu_conk(van, tal, u3t(u3t(got)));
ret = u3qz_cell(deh, lat);
u3z(lat);
u3z(deh);
u3z(tal);
u3z(hed);
return ret;
}
}
}
/* boilerplate
*/
u3_noun
u3wzu_conk(u3_noun cor)
{
u3_noun sut, got, van;
if ( (c3n == u3r_mean(cor, u3x_sam, &got,
u3x_con, &van,
0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqzu_conk(van, sut, got);
}
}
u3_noun
u3qzu_conk(u3_noun van,
u3_noun sut,
u3_noun got)
{
return _cqzu_conk(van, sut, got);
}

271
jets/z/ut_crop.c Normal file
View File

@ -0,0 +1,271 @@
/* j/6/crop.c
**
*/
#include "all.h"
/* logic
*/
static u3_noun
_crop_dext(u3_noun, u3_noun, u3_noun, u3_noun);
static u3_noun
_crop_sint(u3_noun, u3_noun, u3_noun, u3_noun);
static u3_noun
_crop_repo(u3_noun van,
u3_noun sut,
u3_noun ref,
u3_noun bix)
{
u3_noun rep = u3qzu_repo(van, sut);
u3_noun ret = _crop_dext(van, rep, ref, bix);
if ( c3y == u3r_sing(ret, rep) ) {
if ( c3__void == rep ) {
return c3__void;
} else {
u3z(rep);
u3z(ret);
return u3k(sut);
}
} else {
u3z(rep);
return ret;
}
}
static u3_noun
_crop_dext_fork(u3_noun van, u3_noun p_sut, u3_noun ref, u3_noun bix)
{
if ( u3_nul == p_sut ) {
return u3_nul;
}
else {
return u3nc(_crop_dext(van, u3h(p_sut), ref, bix),
_crop_dext_fork(van, u3t(p_sut), ref, bix));
}
}
static u3_noun
_crop_sint_fork(u3_noun van, u3_noun sut, u3_noun p_ref, u3_noun bix)
{
if ( u3_nul == p_ref ) {
return u3k(sut);
}
else {
u3_noun tuz = _crop_dext(van, sut, u3h(p_ref), bix);
u3_noun zat = _crop_sint_fork(van, tuz, u3t(p_ref), bix);
u3z(tuz);
return zat;
}
}
static u3_noun
_crop_dext(u3_noun van,
u3_noun sut,
u3_noun ref,
u3_noun bix)
{
u3_noun p_sut, q_sut, p_ref, q_ref;
if ( c3n == u3du(ref) ) {
switch ( ref ) {
case c3__void: return u3k(sut);
case c3__noun: return c3__void;
default: return u3m_bail(c3__fail);
}
}
if ( c3y == u3r_sing(sut, ref) ) {
return c3__void;
}
if ( c3n == u3du(sut) ) switch ( sut ) {
default: return u3m_bail(c3__fail);
case c3__noun: return _crop_repo(van, sut, ref, bix);
case c3__void: return c3__void;
}
else switch ( u3h(sut) ) {
default: return u3m_bail(c3__fail);
case c3__atom: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
if ( c3__atom == u3h(ref) ) {
u3x_cell(u3t(ref), &p_ref, &q_ref);
if ( c3y == u3du(q_sut) ) {
if ( c3y == u3du(q_ref) ) {
if ( c3y == u3r_sing(q_sut, q_ref) ) {
return c3__void;
} else {
return u3k(sut);
}
} else {
return c3__void;
}
}
else {
if ( c3y == u3du(q_ref) ) {
return u3k(sut);
}
else return c3__void;
}
}
else if ( c3__cell == u3h(ref) ) {
return u3k(sut);
}
else return _crop_sint(van, sut, ref, bix);
}
case c3__cell: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
if ( c3__atom == u3h(ref) ) {
return u3k(sut);
}
else if ( c3__cell == u3h(ref) ) {
u3x_cell(u3t(ref), &p_ref, &q_ref);
if ( c3y == u3qzu_nest(van, p_ref, c3n, p_sut) )
{
u3_noun foz = _crop_dext(van, q_sut, q_ref, bix);
u3_noun ret = u3qz_cell(p_sut, foz);
u3z(foz);
return ret;
}
else return u3k(sut);
}
else return _crop_sint(van, sut, ref, bix);
}
case c3__core:
{
if ( (c3__atom == u3h(ref)) ||
(c3__cell == u3h(ref)) ) {
return u3k(sut);
}
else return _crop_sint(van, sut, ref, bix);
}
case c3__hint: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3_noun foz = _crop_dext(van, q_sut, ref, bix);
u3_noun ret = u3qz_hint(p_sut, foz);
u3z(foz);
return ret;
}
case c3__face: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3_noun foz = _crop_dext(van, q_sut, ref, bix);
u3_noun ret = u3qz_face(p_sut, foz);
u3z(foz);
return ret;
}
case c3__fork: p_sut = u3t(sut);
{
u3_noun yed = u3qdi_tap(p_sut);
u3_noun ret = u3kf_fork(_crop_dext_fork(van, yed, ref, bix));
u3z(yed);
return ret;
}
case c3__hold:
{
u3_noun hud = u3nc(u3k(sut), u3k(ref));
if ( c3y == u3qdi_has(bix, hud) ) {
# if 0
u3_noun dun = u3qzu_dunq(van, "type", sut);
u3_noun niz = u3qzu_dunq(van, "over", ref);
u3t_push(u3nc(c3__mean, dun));
u3t_push(u3nc(c3__mean, niz));
# endif
return u3m_error("crop-loop");
} else {
u3_noun bux = u3qdi_put(bix, hud);
u3_noun ret = _crop_repo(van, sut, ref, bux);
u3z(hud);
u3z(bux);
return ret;
}
}
}
}
static u3_noun
_crop_sint(u3_noun van,
u3_noun sut,
u3_noun ref,
u3_noun bix)
{
u3_noun p_ref, q_ref;
switch ( u3h(ref) ) {
default: return u3m_bail(c3__fail);
case c3__core:
case c3__hint:
case c3__face: u3x_cell(u3t(ref), &p_ref, &q_ref);
{
return _crop_dext(van, sut, q_ref, bix);
}
case c3__fork: p_ref = u3t(ref);
{
u3_noun yed = u3qdi_tap(p_ref);
u3_noun ret = _crop_sint_fork(van, sut, yed, bix);
u3z(yed);
return ret;
}
case c3__hold:
{
u3_noun rep = u3qzu_repo(van, ref);
u3_noun ret = _crop_dext(van, sut, rep, bix);
u3z(rep);
return ret;
}
}
}
static u3_noun
_cqzu_crop(u3_noun van,
u3_noun sut,
u3_noun ref)
{
return _crop_dext(van, sut, ref, u3_nul);
}
/* boilerplate
*/
u3_noun
u3wzu_crop(u3_noun cor)
{
u3_noun sut, ref, van;
if ( (c3n == u3r_mean(cor, u3x_sam, &ref, u3x_con, &van, 0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqzu_crop(van, sut, ref);
}
}
u3_noun
u3qzu_crop(u3_noun van,
u3_noun sut,
u3_noun ref)
{
c3_m fun_m = 144 + c3__crop + ((!!u3r_at(u3qzu_van_vet, van)) << 8);
u3_noun pro = u3z_find_2(fun_m, sut, ref);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqzu_crop(van, sut, ref);
return u3z_save_2(fun_m, sut, ref, pro);
}
}

915
jets/z/ut_find.c Normal file
View File

@ -0,0 +1,915 @@
/* j/6/find.c
**
*/
#include "all.h"
static u3_noun
_find_buck(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun p_heg,
u3_noun q_heg,
u3_noun axe,
u3_noun lon,
u3_noun gil);
static u3_noun
_opal_sane(u3_noun ope)
{
if ( (0 == u3h(ope)) && (0 == u3t(ope)) ) {
fprintf(stderr, "insane opal\r\n");
c3_assert(0);
}
else return ope;
}
static u3_noun
_pony_sane(u3_noun poy)
{
if ( 0 == poy ) {
return poy;
}
else if ( c3n == u3h(poy) ) {
if ( c3n == u3h(u3t(poy)) ) {
// abnormal
u3_noun type = u3h(u3t(u3t(u3t(poy))));
if ( 0 == type ) {
u3m_p("insane type", 0);
c3_assert(0);
}
}
return poy;
}
else {
u3_noun tt_poy = u3t(u3t(poy)); // opal
_opal_sane(tt_poy);
return poy;
}
}
static u3_noun
u3qzu_felt(u3_noun van,
u3_noun sut,
u3_noun lap)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "felt");
return u3n_kick_on(u3i_molt(gat,
u3x_sam,
u3k(lap),
0));
}
static u3_noun
u3qzu_fund(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun gen)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "fund");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
u3k(way),
u3x_sam_3,
u3k(gen),
0));
}
static u3_noun
u3qzu_fine(u3_noun van,
u3_noun sut,
u3_noun tor)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "fine");
return u3n_kick_on(u3i_molt(gat,
u3x_sam,
u3k(tor),
0));
}
static u3_noun
_find_buck_here(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun p_heg,
u3_noun q_heg,
u3_noun axe,
u3_noun lon,
u3_noun gil)
{
if ( 0 == p_heg ) {
return u3nt
(c3y,
u3nt(u3_nul,
u3nc(u3_nul, u3k(axe)),
u3k(lon)),
u3nc(c3y, u3k(sut)));
}
else {
return u3nt
(c3n, c3y, u3qa_dec(p_heg));
}
}
static u3_noun
_find_buck_lose(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun p_heg,
u3_noun q_heg,
u3_noun axe,
u3_noun lon,
u3_noun gil)
{
return u3nt(c3n, c3y, u3k(p_heg));
}
static u3_noun
_find_buck_stop(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun p_heg,
u3_noun q_heg,
u3_noun axe,
u3_noun lon,
u3_noun gil)
{
if ( u3_nul == q_heg ) {
return _find_buck_here(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
else {
return _find_buck_lose(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
}
static u3_noun
_find_buck_cell(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun p_heg,
u3_noun q_heg,
u3_noun axe,
u3_noun lon,
u3_noun gil)
{
u3_noun p_sut, q_sut;
u3x_cell(u3t(sut), &p_sut, &q_sut);
{
if ( u3_nul == q_heg ) {
return _find_buck_here(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
else {
u3_noun exa = u3qc_peg(axe, 2);
u3_noun hed = _find_buck(van, p_sut, way, p_heg, q_heg, exa, lon, gil);
u3z(exa);
if ( (u3_nul == hed) || (c3y == u3h(hed)) || (c3n == u3h(u3t(hed))) ) {
return hed;
}
else {
u3_noun exa = u3qc_peg(axe, 3);
u3_noun tal = _find_buck
(van, q_sut, way, u3t(u3t(hed)), q_heg, exa, lon, gil);
u3z(exa);
u3z(hed);
return tal;
}
}
}
}
static u3_noun
_find_buck_core(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun p_heg,
u3_noun q_heg,
u3_noun axe,
u3_noun lon,
u3_noun gil)
{
u3_noun p_sut, q_sut, pq_sut, qq_sut, rq_sut, prq_sut, qrq_sut;
u3_noun ppq_sut, qpq_sut, rpq_sut;
u3x_cell(u3t(sut), &p_sut, &q_sut);
u3x_trel(q_sut, &pq_sut, &qq_sut, &rq_sut);
u3x_trel(pq_sut, &ppq_sut, &qpq_sut, &rpq_sut);
u3x_cell(rq_sut, &prq_sut, &qrq_sut);
{
if ( u3_nul == q_heg ) {
return _find_buck_here(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
else {
u3_noun zem = u3qz_loot(u3t(q_heg), qrq_sut);
if ( (u3_nul != zem) && (0 != p_heg) ) {
u3_noun ped;
ped = u3qa_dec(p_heg);
u3z(p_heg); p_heg = ped;
u3z(zem);
zem = u3_nul;
}
if ( u3_nul != zem ) {
u3_noun u_zem = u3t(zem);
u3_noun pu_zem = u3h(u_zem);
u3_noun qu_zem = u3t(u_zem);
u3_noun qqu_zem = u3t(qu_zem);
u3_noun mut;
u3_noun pro;
mut = u3nt(c3__core,
u3k(p_sut),
u3nt(u3nt(u3k(ppq_sut), u3k(qpq_sut), c3__gold),
u3k(qq_sut),
u3k(rq_sut)));
pro = u3nt
(c3y,
u3nc(u3nc(u3_nul, u3k(axe)), u3k(lon)),
u3nt(c3n,
u3qc_peg(2, pu_zem),
u3nt(u3nc(mut, u3k(qqu_zem)), u3_nul, u3_nul)));
u3z(zem);
return pro;
}
else {
u3_noun pec = u3qzu_peel(van, sut, way, rpq_sut);
u3_noun pro;
if ( c3n == u3h(pec) ) {
pro = _find_buck_lose(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
else if ( c3y == u3t(pec) ) {
u3_noun exa = u3qc_peg(axe, 3);
pro = _find_buck(van, p_sut, way, p_heg, q_heg, exa, lon, gil);
u3z(exa);
}
else {
u3_noun sam = u3qzu_peek(van, p_sut, way, 2);
u3_noun exa = u3qc_peg(axe, 6);
pro = _find_buck(van, sam, way, p_heg, q_heg, exa, lon, gil);
u3z(exa);
u3z(sam);
}
u3z(pec);
return pro;
}
}
}
}
static u3_noun
_find_twin(u3_noun van,
u3_noun hax,
u3_noun yor)
{
if ( c3y == u3r_sing(hax, yor) ) {
return u3k(hax);
}
else if ( u3_nul == hax ) {
return u3k(yor);
}
else if ( u3_nul == yor ) {
return u3k(hax);
}
else if ( c3n == u3h(hax) ) {
if ( (c3n != u3h(yor)) ) {
return u3m_error("find-fork-a");
}
else {
u3_noun p_hax = u3t(hax); // (each @ud {span nock})
u3_noun p_yor = u3t(yor); // (each @ud {span nock})
if ( (c3n != u3h(p_hax)) || (c3n != u3h(p_yor)) ) {
return u3m_error("find-fork-b");
}
else {
u3_noun pp_hax = u3t(p_hax); // {span nock}
u3_noun pp_yor = u3t(p_yor); // {span nock}
u3_noun ppp_hax = u3h(pp_hax); // span
u3_noun ppp_yor = u3h(pp_yor); // span
u3_noun qpp_hax = u3t(pp_hax); // nock
u3_noun qpp_yor = u3t(pp_yor); // nock
if ( c3n == u3r_sing(qpp_hax, qpp_yor) ) {
return u3m_error("find-fork-c");
}
return u3nt(c3n,
c3n,
u3nc(
u3kf_fork(u3nt(u3k(ppp_hax), u3k(ppp_yor), u3_nul)),
u3k(qpp_hax)));
}
}
}
else {
if ( c3n == u3h(yor) ) {
return u3m_error("find-fork-d");
}
else {
u3_noun p_hax = u3t(hax); // {vein opal}
u3_noun p_yor = u3t(yor); // {vein opal}
u3_noun pp_hax = u3h(p_hax); // vein
u3_noun pp_yor = u3h(p_yor); // vein
u3_noun qp_hax = u3t(p_hax); // opal
u3_noun qp_yor = u3t(p_yor); // opal
if ( c3n == u3r_sing(pp_hax, pp_yor) ) {
return u3m_error("find-fork-e");
}
else {
if ( c3y == u3h(qp_hax) ) {
if ( c3y != u3h(qp_yor) ) {
return u3m_error("find-fork-f");
} else {
u3_noun pqp_hax = u3t(qp_hax); // type
u3_noun pqp_yor = u3t(qp_yor); // type
return
u3nt(c3y,
u3k(pp_hax),
u3nc(c3y, u3kf_fork
(u3nt(u3k(pqp_hax), u3k(pqp_yor), u3_nul))));
}
}
else if ( c3n != u3h(qp_yor) ) {
return u3m_error("find-fork-g");
} else {
u3_noun pqp_hax = u3h(u3t(qp_hax)); // axis
u3_noun pqp_yor = u3h(u3t(qp_yor)); // axis
u3_noun qqp_hax = u3t(u3t(qp_hax)); // (set {type foot})
u3_noun qqp_yor = u3t(u3t(qp_yor)); // (set {type foot})
if ( c3n == u3r_sing(pqp_hax, pqp_yor) ) {
return u3m_error("find-fork-h");
} else {
return
u3nt(c3y,
u3k(pp_hax),
u3nt(c3n, u3k(pqp_hax), u3qdi_uni(qqp_hax, qqp_yor)));
}
}
}
}
}
// error: { return u3m_error("find-fork"); }
}
static u3_noun
_find_buck_fork_twin(u3_noun van, u3_noun wiz)
{
if ( u3_nul == wiz ) {
return u3_nul;
}
else if ( u3_nul == u3t(wiz) ) {
return u3k(u3h(wiz));
}
else {
u3_noun hax = u3k(u3h(wiz));
u3_noun yor = _find_buck_fork_twin(van, u3t(wiz));
u3_noun fid = _find_twin(van, hax, yor);
u3z(hax);
u3z(yor);
return fid;
}
}
static u3_noun
_find_buck_fork_turn(u3_noun van,
u3_noun yed,
u3_noun way,
u3_noun p_heg,
u3_noun q_heg,
u3_noun axe,
u3_noun lon,
u3_noun gil)
{
if ( u3_nul == yed ) {
return u3_nul;
}
else {
u3_noun fid = _find_buck(van, u3h(yed), way, p_heg, q_heg, axe, lon, gil);
return u3nc
(fid,
_find_buck_fork_turn
(van, u3t(yed), way, p_heg, q_heg, axe, lon, gil));
}
}
static u3_noun
_find_buck_fork(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun p_heg,
u3_noun q_heg,
u3_noun axe,
u3_noun lon,
u3_noun gil)
{
u3_noun p_sut = u3t(sut);
u3_noun yed = u3qdi_tap(p_sut);
u3_noun wiz;
u3_noun ret;
wiz = _find_buck_fork_turn(van, yed, way, p_heg, q_heg, axe, lon, gil);
u3z(yed);
ret = _find_buck_fork_twin(van, wiz);
u3z(wiz);
return ret;
}
static u3_noun
_find_buck_face_next(u3_noun van,
u3_noun sut,
u3_noun q_sut,
u3_noun qp_sut,
u3_noun way,
u3_noun p_heg,
u3_noun q_heg,
u3_noun axe,
u3_noun lon,
u3_noun gil)
{
if ( u3_nul == qp_sut ) {
u3_noun nol = u3nc(u3_nul, u3k(lon));
u3_noun ret = _find_buck(van, q_sut, way, p_heg, q_heg, axe, nol, gil);
u3z(nol);
return ret;
}
else {
u3_noun iqp_sut = u3h(qp_sut); // twig
u3_noun tiv = u3qzu_mint // (pair type nock)
(van, q_sut, c3__noun, iqp_sut);
u3_noun tqp_sut = u3t(qp_sut); // (list twig)
u3_noun p_tiv = u3h(tiv); // type
u3_noun q_tiv = u3t(tiv); // nock
u3_noun fid = _find_buck // pony
(van, p_tiv, way, p_heg, q_heg, 1, u3_nul, u3_nul);
if ( u3_nul == fid ) {
u3z(tiv);
return u3_nul;
}
else if ( (c3n == u3h(fid)) && (c3y == u3h(u3t(fid))) ) {
u3_noun ret;
ret = _find_buck_face_next
(van, sut, q_sut, tqp_sut, way, u3t(u3t(fid)), q_heg, axe, lon, gil);
u3z(fid);
u3z(tiv);
return ret;
}
else {
u3_noun tor; // port
u3_noun vat; // (pair type nock)
u3_noun ret;
u3_noun dog = u3nc(0, u3k(axe)); // nock
u3_noun cob = u3qz_comb(dog, q_tiv);
if ( c3y == u3h(fid) ) {
tor = u3nc(c3y, u3k(u3t(fid)));
} else {
tor = u3nc(c3n, u3k(u3t(u3t(fid))));
}
u3z(fid);
vat = u3qzu_fine(van, sut, tor);
u3z(tor);
ret = u3nt
(c3n,
c3n,
u3nc(u3k(u3h(vat)), u3qz_comb(cob, u3t(vat))));
u3z(vat);
u3z(dog);
u3z(cob);
u3z(tiv);
return ret;
}
}
}
static u3_noun
_find_buck_face(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun p_heg,
u3_noun q_heg,
u3_noun axe,
u3_noun lon,
u3_noun gil)
{
u3_noun p_sut, q_sut;
u3x_cell(u3t(sut), &p_sut, &q_sut);
if ( u3_nul == q_heg ) {
return _find_buck_here(van, q_sut, way, p_heg, q_heg, axe, lon, gil);
}
else {
u3_noun uq_heg = u3t(q_heg); // term
if ( c3y == u3ud(p_sut) ) {
if ( c3y == u3r_sing(p_sut, uq_heg) ) {
return _find_buck_here(van, q_sut, way, p_heg, q_heg, axe, lon, gil);
}
else {
return _find_buck_lose(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
}
else {
u3_noun pp_sut = u3h(p_sut); // (map term {wain (unit twig)})
u3_noun qp_sut = u3t(p_sut); // (list (pair type nock))
u3_noun tyr = u3qdb_get(pp_sut, uq_heg); // (unit {wain (unit twig)})
if ( u3_nul == tyr ) {
return _find_buck_face_next
(van, sut, q_sut, qp_sut, way, p_heg, q_heg, axe, lon, gil);
}
else {
u3_noun u_tyr = u3t(tyr); // (pair wain (unit twig))
u3_noun qu_tyr = u3t(u_tyr);
if ( u3_nul == qu_tyr ) {
u3_noun nol = u3nc(u3_nul, u3k(lon));
u3_noun dep = u3qa_inc(p_heg);
u3_noun ret = _find_buck
(van, q_sut, way, dep, q_heg, axe, nol, gil);
u3z(dep);
u3z(nol);
u3z(tyr);
return ret;
}
else {
u3_noun uqu_tyr = u3t(qu_tyr);
u3_noun tor = u3qzu_fund(van, sut, way, uqu_tyr);
if ( c3y == u3h(tor) ) {
u3_noun p_tor = u3t(tor); // (pair vein opal)
u3_noun pp_tor = u3h(p_tor); // vein
u3_noun qp_tor = u3t(p_tor); // opal
u3_noun nol = // vein
u3nt(u3_nul, u3nc(u3_nul, u3k(axe)), u3k(lon));
u3_noun ret;
ret = u3nt(c3y, u3qb_weld(pp_tor, nol), u3k(qp_tor));
u3z(nol);
u3z(tor);
u3z(tyr);
return ret;
}
else {
u3_noun p_tor = u3t(tor); // (pair type nock)
u3_noun pp_tor = u3h(p_tor); // type
u3_noun qp_tor = u3t(p_tor); // nock
u3_noun dog = u3nc(0, u3k(axe)); // nock
u3_noun ret;
ret = u3nt(c3n,
c3n,
u3nc(u3k(pp_tor), u3qz_comb(dog, qp_tor)));
u3z(dog);
u3z(tor);
u3z(tyr);
return ret;
}
}
}
}
}
}
static u3_noun
_find_bucx(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun p_heg,
u3_noun q_heg,
u3_noun axe,
u3_noun lon,
u3_noun gil)
{
if ( c3n == u3du(sut) ) switch ( sut ) {
default: return u3m_bail(c3__fail);
case c3__noun: {
// fprintf(stderr, "noun\r\n");
return _find_buck_stop(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
case c3__void: {
// fprintf(stderr, "void\r\n");
// return _find_buck_stop(van, sut, way, p_heg, q_heg, axe, lon, gil);
return u3_nul;
}
}
else switch ( u3h(sut) ) {
default: return u3m_bail(c3__fail);
case c3__atom:
{
// fprintf(stderr, "atom\r\n");
return _find_buck_stop(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
case c3__cell:
{
// fprintf(stderr, "cell\r\n");
return _find_buck_cell(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
case c3__core:
{
// fprintf(stderr, "core\r\n");
return _find_buck_core(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
case c3__hint:
{
u3_noun fop = u3qzu_repo(van, sut);
u3_noun pro = _find_bucx(van, fop, way, p_heg, q_heg, axe, lon, gil);
u3z(fop);
return pro;
}
case c3__face:
{
// fprintf(stderr, "face\r\n");
return _find_buck_face(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
case c3__fork:
{
// fprintf(stderr, "fork\r\n");
return _find_buck_fork(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
case c3__hold:
{
// fprintf(stderr, "hold\r\n");
if ( (c3y == u3qdi_has(gil, sut)) ) {
return u3_nul;
}
else {
u3_noun zoc = u3qdi_put(gil, sut);
u3_noun fop = u3qzu_repo(van, sut);
u3_noun pro = _find_buck(van, fop, way, p_heg, q_heg, axe, lon, zoc);
u3z(fop);
u3z(zoc);
return pro;
}
}
}
}
static u3_noun
_find_buck(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun p_heg,
u3_noun q_heg,
u3_noun axe,
u3_noun lon,
u3_noun gil)
{
u3_noun ret = _find_bucx(van, sut, way, p_heg, q_heg, axe, lon, gil);
return _pony_sane(ret);
}
static u3_noun
_find_limb(u3_noun van,
u3_noun sut, // type
u3_noun way, // ?(%read %rite %free %both)
u3_noun i_hyp, // limb
u3_noun p_mor) // palo
{
u3_noun pp_mor = u3h(p_mor); // vein
u3_noun qp_mor = u3t(p_mor); // opal
qp_mor = _opal_sane(qp_mor);
{
u3_noun ref = u3qzu_felt(van, sut, qp_mor);
u3_noun lon = u3k(pp_mor);
u3_noun heg = (c3y == u3du(i_hyp))
? u3k(i_hyp)
: u3nq(c3n, 0, u3_nul, u3k(i_hyp));
u3_noun ret;
if ( c3y == u3h(heg) ) {
u3_noun p_heg = u3t(heg); // axis
ret = u3nt
(c3y,
u3nc(u3nc(u3_nul, u3k(p_heg)), u3k(lon)),
u3nc(c3y, u3qzu_peek(van, ref, way, p_heg)));
ret = _pony_sane(ret);
}
else {
u3_noun p_heg = u3h(u3t(heg)); // @ud
u3_noun q_heg = u3t(u3t(heg)); // (unit term)
ret = _find_buck
(van, ref, way, p_heg, q_heg, 1, lon, u3_nul);
}
u3z(heg);
u3z(lon);
u3z(ref);
return _pony_sane(ret);
}
}
static u3_noun
_find_pony(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun hyp)
{
if ( u3_nul == hyp ) {
return _pony_sane(u3nt(c3y, u3_nul, u3nc(c3y, u3k(sut))));
}
else {
u3_noun i_hyp = u3h(hyp);
u3_noun t_hyp = u3t(hyp);
u3_noun mor = _find_pony(van, sut, way, t_hyp);
mor = _pony_sane(mor);
if ( c3n == u3h(mor) ) {
u3_noun p_mor = u3t(mor);
if ( c3y == u3h(p_mor) ) {
return mor;
}
else {
u3_noun pp_mor = u3t(p_mor); // {span nock}
u3_noun ppp_mor = u3h(pp_mor); // span
u3_noun qpp_mor = u3t(pp_mor); // nock
u3_noun gen = u3nt(c3__wing, u3k(i_hyp), u3_nul);
u3_noun fex = u3qfu_mint(van, ppp_mor, c3__noun, gen);
u3_noun ret = u3nt(c3n,
c3n,
u3nc(u3k(u3h(fex)),
u3qf_comb(qpp_mor, u3t(fex))));
u3z(fex);
u3z(gen);
u3z(mor);
return _pony_sane(ret);
}
}
else {
u3_noun p_mor = u3t(mor);
u3_noun ret = _find_limb(van, sut, way, i_hyp, p_mor);
u3z(mor);
return _pony_sane(ret);
}
}
}
static u3_noun
_cqzu_fond(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun hyp)
{
u3_noun taf;
taf = _find_pony(van, sut, way, hyp);
return taf;
}
static u3_noun
_cqzu_find(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun hyp)
{
u3_noun taf = _find_pony(van, sut, way, hyp);
if ( u3_nul == taf ) {
goto error;
}
else {
if ( c3y == u3h(taf) ) {
u3_noun fat = u3nc(c3y, u3k(u3t(taf)));
u3z(taf);
return fat;
}
else {
if ( c3n == u3h(u3t(taf)) ) {
u3_noun fat = u3nc(c3n, u3k(u3t(u3t(u3t(taf)))));
u3z(taf);
return fat;
}
else {
goto error;
}
}
}
error: {
u3m_p("wing", hyp);
return u3m_error("find");
}
}
/* boilerplate
*/
u3_noun
u3wzu_find(u3_noun cor)
{
u3_noun sut, way, hyp, van;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &way,
u3x_sam_3, &hyp,
u3x_con, &van,
0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqzu_find(van, sut, way, hyp);
}
}
u3_noun
u3qzu_find(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun hyp)
{
c3_m fun_m = 144 + c3__find + ((!!u3r_at(u3qzu_van_vet, van)) << 8);
u3_noun pro = u3z_find_3(fun_m, sut, way, hyp);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqzu_find(van, sut, way, hyp);
return u3z_save_3(fun_m, sut, way, hyp, pro);
}
}
/* boilerplate
*/
u3_noun
u3wzu_fond(u3_noun cor)
{
u3_noun sut, way, hyp, van;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &way,
u3x_sam_3, &hyp,
u3x_con, &van,
0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqzu_fond(van, sut, way, hyp);
}
}
u3_noun
u3qzu_fond(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun hyp)
{
c3_m fun_m = 144 + c3__fond + ((!!u3r_at(u3qzu_van_vet, van)) << 8);
u3_noun pro = u3z_find_3(fun_m, sut, way, hyp);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqzu_fond(van, sut, way, hyp);
return u3z_save_3(fun_m, sut, way, hyp, pro);
}
}

195
jets/z/ut_fire.c Normal file
View File

@ -0,0 +1,195 @@
/* j/6/fire.c
**
*/
#include "all.h"
/* logic
*/
static u3_noun
_fire_vet(u3_noun van)
{
// u3_noun vet = u3j_hook(u3k(van), "vet");
u3_noun vet = u3r_at(u3qzu_van_vet, van);
switch ( vet ) {
case c3n:
case c3y: return vet;
default: return u3m_bail(c3__fail);
}
}
static u3_noun
_fire_mull(u3_noun van,
u3_noun sut,
u3_noun dox,
u3_noun gen)
{
u3_noun rib = u3r_at(u3qzu_van_rib, van);
u3_noun key = u3nt(u3k(sut),
u3k(dox),
u3k(gen));
u3_noun ret;
if ( c3n == _fire_vet(van) ) {
ret = c3y;
}
if ( c3y == u3qdi_has(rib, key) ) {
ret = c3y;
}
else {
u3_noun rob = u3qdi_put(rib, key);
u3_noun von = u3i_molt(u3k(van),
u3qzu_van_rib,
u3k(rob),
0);
u3_noun mul = u3qzu_mull(von, sut, c3__noun, dox, gen);
ret = c3y;
u3z(mul);
u3z(von);
u3z(rob);
}
u3z(key);
return ret;
}
static u3_noun
_fire_each(u3_noun van,
u3_noun vet,
u3_noun typ,
u3_noun gat)
{
u3_noun p_typ, q_typ, pq_typ, qq_typ, rq_typ;
u3_noun h_gat, t_gat;
if ( (c3n == u3du(typ)) || (c3__core != u3h(typ)) ) {
return u3m_error("fire-core");
} else if
( (c3n == u3r_cell(u3t(typ), &p_typ, &q_typ)) ||
(c3n == u3r_trel(q_typ, &pq_typ, &qq_typ, &rq_typ)) ||
(c3n == u3r_cell(gat, &h_gat, &t_gat)) )
{
return u3m_bail(c3__fail);
} else {
u3_noun dox = u3nt
(c3__core, u3k(qq_typ), u3k(q_typ));
if ( c3__ash == u3h(gat) ) {
if ( (c3y == vet) &&
(c3n == u3qzu_nest(van, qq_typ, c3y, p_typ)) )
{
#if 0
u3_noun dun = u3qzu_dunq(van, "need", qq_typ);
u3_noun niz = u3qzu_dunq(van, "have", p_typ);
u3t_push(u3nc(c3__mean, niz));
u3t_push(u3nc(c3__mean, dun));
#endif
return u3m_error("fire-dry");
}
else {
return u3nc(dox, u3k(t_gat));
}
}
else {
c3_assert(c3__elm == u3h(gat));
#if 0
u3_noun dun = u3qzu_dunq(van, "wild", typ);
u3_noun niz = u3qzu_dunq(van, "tame", dox);
u3t_push(u3nc(c3__mean, dun));
u3t_push(u3nc(c3__mean, niz));
#endif
if ( (c3y == vet) &&
(c3n == _fire_mull(van, typ, dox, t_gat)) )
{
return u3m_error("fire-wet");
}
else {
u3z(dox);
#if 0
u3t_drop();
u3t_drop();
#endif
return u3nc(u3k(typ), u3k(t_gat));
}
}
}
}
static u3_noun
_fire_in(u3_noun van,
u3_noun vet,
u3_noun hag)
{
if ( u3_nul == hag ) {
return u3_nul;
}
else {
u3_noun i_hag = u3h(hag);
u3_noun t_hag = u3t(hag);
if ( c3n == u3du(i_hag) ) {
return u3m_bail(c3__fail);
} else {
return u3nc
(_fire_each(van, vet, u3h(i_hag), u3t(i_hag)),
_fire_in(van, vet, t_hag));
}
}
}
static u3_noun
_cqzu_fire(u3_noun van,
u3_noun sut,
u3_noun hag)
{
u3_noun vet = u3r_at(u3qzu_van_vet, van);
c3_assert(!"not live");
{
if ( (c3y == u3du(hag)) && (u3_nul == u3t(hag)) ) {
u3_noun i_hag = u3h(hag);
u3_noun pi_hag = u3h(i_hag);
u3_noun qi_hag = u3t(i_hag);
if ( c3__elm == u3h(qi_hag) ) {
u3_noun qqi_hag = u3t(qi_hag);
if ( c3y == u3du(qqi_hag) &&
(u3_nul == u3h(qqi_hag)) &&
(1 == u3t(qqi_hag)) )
{
return u3k(pi_hag);
}
}
}
}
return u3nc(c3__hold, _fire_in(van, vet, hag));
}
/* boilerplate
*/
u3_noun
u3wzu_fire(u3_noun cor)
{
u3_noun sut, hag, van;
if ( (c3n == u3r_mean(cor, u3x_sam, &hag, u3x_con, &van, 0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqzu_fire(van, sut, hag);
}
}
u3_noun
u3qzu_fire(u3_noun van,
u3_noun sut,
u3_noun hag)
{
return _cqzu_fire(van, sut, hag);
}

180
jets/z/ut_fish.c Normal file
View File

@ -0,0 +1,180 @@
/* j/6/fish.c
**
*/
#include "all.h"
/* functions
*/
static u3_noun
_fish_in(u3_noun, u3_noun, u3_atom, u3_noun);
static u3_noun
_fish_fork(u3_noun van,
u3_noun p_sut,
u3_atom axe,
u3_noun vit)
{
if ( u3_nul == p_sut ) {
return u3nc(1, 1);
}
else {
u3_noun hed = _fish_in(van, u3h(p_sut), axe, vit);
u3_noun tal = _fish_fork(van, u3t(p_sut), axe, vit);
u3_noun pro = u3qz_flor(hed, tal);
u3z(hed);
u3z(tal);
return pro;
}
}
static u3_noun
_fish_in(u3_noun van,
u3_noun sut,
u3_atom axe,
u3_noun vit)
{
u3_noun p_sut, q_sut;
if ( c3y == u3ud(sut) ) switch ( sut ) {
default: return u3m_bail(c3__fail);
case c3__noun: {
return u3nc(1, 0);
}
case c3__void: {
return u3nc(1, 1);
}
}
else switch ( u3h(sut) ) {
default: return u3m_bail(c3__fail);
case c3__atom: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);
} else {
if ( c3n == u3du(q_sut) ) {
u3_noun ton = u3nt(3, 0, u3k(axe));
u3_noun pro = u3qz_flip(ton);
u3z(ton);
return pro;
} else {
return u3nt(5,
u3nc(1, u3k(u3t(q_sut))),
u3nc(0, u3k(axe)));
}
}
}
case c3__cell: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);
} else {
u3_noun hut = u3nt(3, 0, u3k(axe));
u3_noun lef = u3qc_peg(axe, 2);
u3_noun rit = u3qc_peg(axe, 3);
u3_noun hed = _fish_in(van, p_sut, lef, vit);
u3_noun tal = _fish_in(van, q_sut, rit, vit);
u3_noun hob = u3qz_flan(hed, tal);
u3_noun vug = u3qz_flan(hut, hob);
u3z(hob);
u3z(tal);
u3z(hed);
u3z(rit);
u3z(lef);
u3z(hut);
return vug;
}
}
case c3__core: {
return u3m_error("fish-core");
}
case c3__hint:
case c3__face: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);
} else {
return _fish_in(van, q_sut, axe, vit);
}
}
case c3__fork: p_sut = u3t(sut);
{
u3_noun yed = u3qdi_tap(p_sut);
u3_noun ret = _fish_fork(van, yed, axe, vit);
u3z(yed);
return ret;
}
case c3__hold: {
p_sut = u3t(sut);
{
if ( (c3y == u3qdi_has(vit, sut)) ) {
// u3_noun dun = u3qzu_dunq(van, "type", sut);
u3_noun niz = u3qzu_shep
(van, "axis", 'd', u3k(axe));
// u3t_push(u3nc(c3__mean, dun));
u3t_push(u3nc(c3__mean, niz));
return u3m_error("fish-loop");
} else {
u3_noun zoc = u3qdi_put(vit, sut);
u3_noun fop = u3qzu_repo(van, sut);
u3_noun pro = _fish_in(van, fop, axe, zoc);
u3z(fop);
u3z(zoc);
return pro;
}
}
}
}
}
static u3_noun
_cqzu_fish(u3_noun van,
u3_noun sut,
u3_atom axe)
{
return _fish_in(van, sut, axe, u3_nul);
}
/* boilerplate
*/
u3_noun
u3wzu_fish(u3_noun cor)
{
u3_noun sut, axe, van;
if ( (c3n == u3r_mean(cor, u3x_sam, &axe, u3x_con, &van, 0)) ||
(c3n == u3ud(axe)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqzu_fish(van, sut, axe);
}
}
u3_noun
u3qzu_fish(u3_noun van,
u3_noun sut,
u3_noun axe)
{
c3_m fun_m = 144 + c3__fish + ((!!u3r_at(u3qzu_van_vet, van)) << 8);
u3_noun pro = u3z_find_2(fun_m, sut, axe);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqzu_fish(van, sut, axe);
return u3z_save_2(fun_m, sut, axe, pro);
}
}

215
jets/z/ut_fuse.c Normal file
View File

@ -0,0 +1,215 @@
/* j/6/fuse.c
**
*/
#include "all.h"
/* logic
*/
static u3_noun
_fuse_in(u3_noun, u3_noun, u3_noun, u3_noun);
static u3_noun
_fuse_repo(u3_noun van,
u3_noun sut,
u3_noun ref,
u3_noun bix)
{
u3_noun rep = u3qzu_repo(van, sut);
u3_noun ret = _fuse_in(van, rep, ref, bix);
if ( c3y == u3r_sing(ret, rep) ) {
if ( c3__void == rep ) {
return c3__void;
} else {
u3z(rep);
u3z(ret);
return u3k(sut);
}
} else {
u3z(rep);
return ret;
}
}
static u3_noun
_fuse_in_fork(u3_noun van, u3_noun p_sut, u3_noun ref, u3_noun bix)
{
if ( u3_nul == p_sut ) {
return u3_nul;
}
else {
return u3nc(_fuse_in(van, u3h(p_sut), ref, bix),
_fuse_in_fork(van, u3t(p_sut), ref, bix));
}
}
static u3_noun
_fuse_in(u3_noun van,
u3_noun sut,
u3_noun ref,
u3_noun bix)
{
u3_noun p_sut, q_sut;
if ( c3y == u3r_sing(sut, ref) || (c3__noun == ref) ) {
return u3k(sut);
}
if ( c3n == u3du(sut) ) switch ( sut ) {
default: return u3m_bail(c3__fail);
case c3__noun:
{
return u3k(ref);
}
case c3__void:
{
return c3__void;
}
}
else switch ( u3h(sut) ) {
default: return u3m_bail(c3__fail);
case c3__atom: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
if ( c3y == u3du(ref) ) {
if ( c3__atom == u3h(ref) ) {
u3_noun p_ref, q_ref;
u3x_cell(u3t(ref), &p_ref, &q_ref);
{
u3_noun foc = (c3y == u3qz_fitz(p_ref, p_sut))
? u3k(p_sut)
: u3k(p_ref);
if ( c3y == u3du(q_sut) ) {
if ( c3y == u3du(q_ref) ) {
if ( c3y == u3r_sing(q_ref, q_sut) ) {
return u3nt(c3__atom, foc, u3k(q_sut));
}
else {
u3z(foc);
return c3__void;
}
}
else {
return u3nt(c3__atom, foc, u3k(q_sut));
}
} else {
return u3nt(c3__atom, foc, u3k(q_ref));
}
}
}
else if ( c3__cell == u3h(ref) ) {
return c3__void;
}
}
return _fuse_in(van, ref, sut, bix);
}
case c3__cell: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3_noun p_ref, q_ref;
if ( c3y == u3r_pq(ref, c3__cell, &p_ref, &q_ref) ) {
u3_noun hed = _fuse_in(van, p_sut, p_ref, bix);
u3_noun tal = _fuse_in(van, q_sut, q_ref, bix);
u3_noun ret = u3qz_cell(hed, tal);
u3z(hed);
u3z(tal);
return ret;
}
else return _fuse_in(van, ref, sut, bix);
}
case c3__core:
{
return _fuse_repo(van, sut, ref, bix);
}
case c3__hint: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3_noun vot = _fuse_in(van, q_sut, ref, bix);
u3_noun ret = u3qz_hint(p_sut, vot);
u3z(vot);
return ret;
}
case c3__face: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3_noun vot = _fuse_in(van, q_sut, ref, bix);
u3_noun ret = u3qz_face(p_sut, vot);
u3z(vot);
return ret;
}
case c3__fork: p_sut = u3t(sut);
{
u3_noun yed = u3qdi_tap(p_sut);
u3_noun ret = u3kf_fork(_fuse_in_fork(van, yed, ref, bix));
u3z(yed);
return ret;
}
case c3__hold:
{
u3_noun hud = u3nc(u3k(sut), u3k(ref));
if ( c3y == u3qdi_has(bix, hud) ) {
// u3_noun dun = u3qzu_dunq(van, "type", sut);
// u3_noun niz = u3qzu_dunq(van, "over", ref);
// u3t_push(u3nc(c3__mean, dun));
// u3t_push(u3nc(c3__mean, niz));
return u3m_error("fuse-loop");
} else {
u3_noun bux = u3qdi_put(bix, hud);
u3_noun ret = _fuse_repo(van, sut, ref, bux);
u3z(hud);
u3z(bux);
return ret;
}
}
}
}
static u3_noun
_cqzu_fuse(u3_noun van,
u3_noun sut,
u3_noun ref)
{
return _fuse_in(van, sut, ref, u3_nul);
}
/* boilerplate
*/
u3_noun
u3wzu_fuse(u3_noun cor)
{
u3_noun sut, ref, van;
if ( (c3n == u3r_mean(cor, u3x_sam, &ref, u3x_con, &van, 0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqzu_fuse(van, sut, ref);
}
}
u3_noun
u3qzu_fuse(u3_noun van,
u3_noun sut,
u3_noun ref)
{
c3_m fun_m = 144 + c3__fuse + ((!!u3r_at(u3qzu_van_vet, van)) << 8);
u3_noun pro = u3z_find_2(fun_m, sut, ref);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqzu_fuse(van, sut, ref);
return u3z_save_2(fun_m, sut, ref, pro);
}
}

16
jets/z/ut_gain.c Normal file
View File

@ -0,0 +1,16 @@
/* j/6/gain.c
**
*/
#include "all.h"
u3_noun
u3qzu_gain(u3_noun van,
u3_noun sut,
u3_noun gen)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "gain");
return u3n_kick_on(u3i_molt(gat, u3x_sam, u3k(gen), 0));
}

16
jets/z/ut_lose.c Normal file
View File

@ -0,0 +1,16 @@
/* j/6/lose.c
**
*/
#include "all.h"
u3_noun
u3qzu_lose(u3_noun van,
u3_noun sut,
u3_noun gen)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "lose");
return u3n_kick_on(u3i_molt(gat, u3x_sam, u3k(gen), 0));
}

830
jets/z/ut_mint.c Normal file
View File

@ -0,0 +1,830 @@
/* j/6/mint.c
**
*/
#include "all.h"
/* logic
*/
static u3_noun
_mint_in(u3_noun, u3_noun, u3_noun, u3_noun);
static u3_noun
_mint_bean()
{
return u3kf_fork(u3nt(u3nq(c3__atom, 'f', u3_nul, 0),
u3nq(c3__atom, 'f', u3_nul, 1),
u3_nul));
}
static u3_noun
_mint_vet(u3_noun van)
{
// u3_noun vet = u3j_hook(u3k(van), "vet");
u3_noun vet = u3r_at(u3qzu_van_vet, van);
switch ( vet ) {
case c3n:
case c3y: return vet;
default: return u3m_bail(c3__fail);
}
}
static u3_noun
_mint_feel(u3_noun van,
u3_noun sut,
u3_noun rot)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "feel");
return u3n_kick_on(u3i_molt(gat,
u3x_sam,
u3k(rot),
0));
}
static u3_noun
_mint_mine(u3_noun van,
u3_noun sut,
u3_noun mel,
u3_noun dom)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "mine");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
u3k(mel),
u3x_sam_3,
u3k(dom),
0));
}
static u3_noun
_mint_burp(u3_noun van,
u3_noun sut)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
return u3j_hook(von, "burp");
}
static u3_noun
_mint_cond(u3_noun pex,
u3_noun yom,
u3_noun woq)
{
if ( 1 == u3h(pex) ) {
if ( 0 == u3t(pex) ) {
u3z(pex);
u3z(woq);
return yom;
}
else if ( 1 == u3t(pex) ) {
u3z(pex);
u3z(yom);
return woq;
}
}
return u3nq(6, pex, yom, woq);
}
static u3_noun
_mint_corn(u3_noun van,
u3_noun sut,
u3_noun gen)
{
u3_noun mil = _mint_in(van, sut, c3__noun, gen);
u3_noun fol = u3k(u3t(mil));
u3z(mil);
return fol;
}
static u3_noun
_mint_nice(u3_noun van,
u3_noun gol,
u3_noun typ)
{
if ( (c3y == _mint_vet(van)) &&
(c3n == u3qzu_nest(van, gol, c3y, typ)) )
{
// u3_noun dun = u3qzu_dunq(van, "need", gol);
// u3_noun niz = u3qzu_dunq(van, "have", typ);
// u3t_push(u3nc(c3__mean, dun));
// u3t_push(u3nc(c3__mean, niz));
return u3m_error("mint-nice");
}
else return typ;
}
static u3_noun
_mint_coke(u3_noun nug)
{
if ( 0 == u3h(nug) ) {
return u3k(u3t(nug));
}
else if ( 10 == u3h(nug) ) {
return _mint_coke(u3t(u3t(nug)));
}
else {
return u3m_error("mint-coke");
}
}
static u3_noun
_mint_grow(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_atom mel,
u3_noun ruf,
u3_noun dom)
{
u3_noun dan = _mint_in(van, sut, c3__noun, ruf);
u3_noun p_dan = u3h(dan);
u3_noun q_dan = u3t(dan);
u3_noun pul = _mint_mine(van, p_dan, mel, dom);
u3_noun ret = u3nc(_mint_nice(van, gol, u3k(u3h(pul))),
u3qz_cons(u3t(pul), q_dan));
u3z(pul);
u3z(dan);
return ret;
}
static u3_noun
_mint_loc(u3_noun van,
u3_noun loc)
{
u3_noun mol = u3nc('o', u3k(loc));
u3_noun sho = u3j_hook(u3k(van), "show");
u3_noun ret = u3i_molt(u3k(sho), u3x_sam, u3k(mol), 0);
u3z(mol);
u3z(sho);
return ret;
}
#if 1
static u3_noun
_mint_cnts(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun hyp,
u3_noun rig)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "emin");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
u3k(gol),
u3x_sam_6,
u3k(hyp),
u3x_sam_7,
u3k(rig),
0));
}
#else
static u3_noun
_mint_edit(u3_noun van,
u3_noun sut,
u3_noun mew,
u3_noun p_lar,
u3_noun rag,
u3_noun hej)
{
while ( 1 ) {
if ( c3n == u3du(mew) ) {
u3_noun gim = u3qzu_fire(van, sut, rag);
u3_noun fol = u3qz_hike(p_lar, hej);
u3z(rag);
u3z(hej);
return u3nc(gim, fol);
} else {
u3_noun i_mew = u3h(mew);
u3_noun t_mew = u3t(mew);
u3_noun pi_mew = u3h(i_mew);
u3_noun qi_mew = u3t(i_mew);
u3_noun zil = u3qzu_mint(van, sut, c3__noun, qi_mew);
u3_noun p_zil = u3h(zil);
u3_noun q_zil = u3t(zil);
u3_noun wip = u3qzu_toss(van, sut, pi_mew, p_zil, rag);
u3z(rag);
rag = u3k(u3t(wip));
hej = u3nc(u3nc(u3k(u3h(wip)),
u3k(q_zil)),
hej);
u3z(zil);
u3z(wip);
mew = t_mew;
}
}
}
static u3_noun
_mint_cnts_old(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun hyp,
u3_noun rig)
{
u3_noun lar = u3qzu_seek(van, sut, c3__read, hyp);
u3_noun p_lar = u3h(lar);
u3_noun q_lar = u3t(lar);
u3_noun pq_lar = u3h(q_lar);
u3_noun qq_lar = u3t(q_lar);
u3_noun mew = rig;
u3_noun yom = _mint_edit(van, sut, mew, p_lar, u3k(qq_lar), u3_nul);
u3_noun p_yom = u3h(yom);
u3_noun q_yom = u3t(yom);
u3_noun ret = u3nc(_mint_nice(van, gol, u3k(p_yom)),
(0 == pq_lar) ? u3k(q_yom)
: u3nt(9, u3k(pq_lar), u3k(q_yom)));
u3z(yom);
u3z(lar);
return ret;
}
#endif
# define _mint_used()
static u3_noun
_mint_in(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun gen)
{
u3_noun p_gen, q_gen, r_gen;
u3_noun ret;
if ( (c3__void == sut) &&
!((c3y == u3du(gen)) && (c3__dbug == u3h(gen))) )
{
if ( (c3n == _mint_vet(van))
|| ((c3y == u3du(gen)) &&
((c3__zpfs == u3h(gen)) ||
(c3__zpsk == u3h(gen)) ||
(c3__lost == u3h(gen)) ||
(c3__fail == u3h(gen)) ||
(c3__zpzp == u3h(gen)))) )
{
return u3nt(c3__void, 0, 0);
}
else {
return u3m_error("mint-vain");
}
}
if ( c3n == u3du(gen) ) {
u3_noun ter = u3r_at(u3x_con_3, van);
u3_noun fab = u3r_at(u3qzu_van_fab, van);
u3_noun rex = u3qzp_open(ter, fab, gen);
ret = _mint_in(van, sut, gol, rex);
u3z(rex);
return ret;
}
else if ( c3y == u3du(u3h(gen)) ) {
_mint_used();
{
u3_noun hed = _mint_in(van, sut, c3__noun, u3h(gen));
u3_noun tal = _mint_in(van, sut, c3__noun, u3t(gen));
u3_noun typ = u3qz_cell(u3h(hed), u3h(tal));
ret = u3nc(_mint_nice(van, gol, typ),
u3qz_cons(u3t(hed),
u3t(tal)));
u3z(hed);
u3z(tal);
return ret;
}
} else switch ( u3h(gen) ) {
default: {
u3_noun ter = u3r_at(u3x_con_3, van);
u3_noun fab = u3r_at(u3qzu_van_fab, van);
u3_noun rex = u3qzp_open(ter, fab, gen);
if ( c3y == u3r_sing(rex, gen) ) {
#if 1
u3_noun zix = u3qzu_shep(van, "gene", 'q', u3k(gen));
u3t_push(u3nc(c3__mean, zix));
return u3m_error("mint-open");
#else
u3_err("h", u3h(gen));
return u3m_bail(c3__fail);
#endif
}
ret = _mint_in(van, sut, gol, rex);
u3z(rex);
return ret;
}
case c3__fits: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun wam = u3qzu_play(van, sut, p_gen);
u3_noun dok = u3nc(c3__wing, u3k(q_gen));
u3_noun vol = _mint_corn(van, sut, dok);
u3_noun axe = _mint_coke(vol);
ret = u3nc(_mint_nice(van, gol, _mint_bean()),
u3qzu_fish(van, wam, axe));
u3z(axe);
u3z(vol);
u3z(wam);
u3z(dok);
return ret;
}
case c3__wtcl: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
_mint_used();
{
u3_noun bol = _mint_bean();
u3_noun nor = _mint_in(van, sut, bol, p_gen);
u3_noun fex = u3qzu_gain(van, sut, p_gen);
u3_noun wux = u3qzu_lose(van, sut, p_gen);
u3_noun duy = (c3__void == fex)
? ( (c3__void == wux)
? u3nc(0, 0)
: u3nc(1, 1) )
: ( (c3__void == wux)
? u3nc(1, 0)
: u3k(u3t(nor)) );
u3_noun hiq = _mint_in(van, fex, gol, q_gen);
u3_noun ran = _mint_in(van, wux, gol, r_gen);
ret = u3nc(u3qz_forq(u3h(hiq),
u3h(ran)),
_mint_cond(duy,
u3k(u3t(hiq)),
u3k(u3t(ran))));
u3z(ran);
u3z(hiq);
u3z(nor);
u3z(wux);
u3z(fex);
u3z(bol);
return ret;
}
case c3__clhp: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun hed = _mint_in(van, sut, c3__noun, p_gen);
u3_noun tal = _mint_in(van, sut, c3__noun, q_gen);
u3_noun typ = u3qz_cell(u3h(hed), u3h(tal));
ret = u3nc(_mint_nice(van, gol, typ),
u3qz_cons(u3t(hed),
u3t(tal)));
u3z(hed);
u3z(tal);
return ret;
}
case c3__dtts: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun typ = _mint_nice(van, gol, _mint_bean());
u3_noun one = _mint_in(van, sut, c3__noun, p_gen);
u3_noun two = _mint_in(van, sut, c3__noun, q_gen);
u3_noun ret;
if ( (c3y == _mint_vet(van)) &&
(c3n == u3qzu_nest(van, u3h(one), c3n, u3h(two))) &&
(c3n == u3qzu_nest(van, u3h(two), c3y, u3h(one))) )
{
return u3m_error("nest");
}
ret = u3nc(typ, u3nt(5, u3k(u3t(one)), u3k(u3t(two))));
u3z(one);
u3z(two);
return ret;
}
case c3__dtwt: p_gen = u3t(gen);
_mint_used();
{
u3_noun typ = _mint_nice(van, gol, _mint_bean());
return u3nc(typ,
u3nc(3, _mint_corn(van, sut, p_gen)));
}
case c3__dtkt: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun nog = u3nc(c3__bcdt, u3k(p_gen));
u3_noun nef = _mint_in(van, sut, gol, nog);
u3_noun viz = _mint_in(van, sut, c3__noun, q_gen);
ret = u3nc(u3k(u3h(nef)),
u3nt(11, u3nc(1, u3nc(151, u3k(u3h(nef)))), u3k(u3t(viz))));
u3z(viz);
u3z(nef);
u3z(nog);
return ret;
}
case c3__dtls: p_gen = u3t(gen);
_mint_used();
{
u3_noun tom = u3nt(c3__atom, u3_blip, u3_nul);
u3_noun sam = _mint_in(van, sut, tom, p_gen);
ret = u3nc(_mint_nice(van, gol, tom),
u3nc(4, u3k(u3t(sam))));
u3z(sam);
return ret;
}
case c3__rock: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun typ = u3qzu_play(van, sut, gen);
u3_noun ret = u3nc(_mint_nice(van, gol, typ),
u3nc(1, u3k(q_gen)));
return ret;
}
case c3__dttr: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun one = _mint_corn(van, sut, p_gen);
u3_noun two = _mint_corn(van, sut, q_gen);
return u3nc(_mint_nice(van, gol, c3__noun),
u3nt(2, one, two));
}
case c3__sand: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun typ = u3qzu_play(van, sut, gen);
u3_noun ret = u3nc(_mint_nice(van, gol, typ),
u3nc(1, u3k(q_gen)));
return ret;
}
case c3__hand:
_mint_used();
{
return u3k(u3t(gen));
}
case c3__ktbr: p_gen = u3t(gen);
_mint_used();
{
u3_noun ryd = _mint_in(van, sut, gol, p_gen);
u3_noun tyf = u3qzu_wrap(van, u3h(ryd), c3__iron);
u3_noun pro = u3nc(tyf, u3k(u3t(ryd)));
u3z(ryd);
return pro;
}
case c3__ktpd:
case c3__ktpm: p_gen = u3t(gen);
_mint_used();
{
u3_noun ryd = _mint_in(van, sut, gol, p_gen);
u3_noun tyf = u3qzu_wrap(van, u3h(ryd), c3__zinc);
u3_noun pro = u3nc(tyf, u3k(u3t(ryd)));
u3z(ryd);
return pro;
}
case c3__ktwt: p_gen = u3t(gen);
_mint_used();
{
u3_noun ryd = _mint_in(van, sut, gol, p_gen);
u3_noun tyf = u3qzu_wrap(van, u3h(ryd), c3__lead);
u3_noun pro = u3nc(tyf, u3k(u3t(ryd)));
u3z(ryd);
return pro;
}
case c3__note: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun hit = u3nc(u3k(sut), u3k(p_gen));
u3_noun hum = _mint_in(van, sut, gol, q_gen);
u3_noun ret = u3nc(u3qz_hint(hit, u3h(hum)),
u3k(u3t(hum)));
u3z(hum);
u3z(hit);
return ret;
}
case c3__tune: p_gen = u3t(gen);
_mint_used();
{
return u3nc(u3qz_face(p_gen, sut), u3nc(0, 1));
}
case c3__ktls: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun huz = u3qzu_play(van, sut, p_gen);
u3_noun hif = _mint_nice(van, gol, huz);
u3_noun zel = _mint_in(van, sut, hif, q_gen);
u3_noun ret = u3nc(hif, u3k(u3t(zel)));
u3z(zel);
return ret;
}
case c3__tsgr: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun fid = _mint_in(van, sut, c3__noun, p_gen);
u3_noun p_fid = u3h(fid);
u3_noun q_fid = u3t(fid);
if ( 0 == p_fid ) {
u3m_p("bad subject: p_gen", p_gen);
c3_assert(0);
}
u3_noun dov = _mint_in(van, p_fid, gol, q_gen);
u3_noun p_dov = u3h(dov);
u3_noun q_dov = u3t(dov);
ret = u3nc(u3k(p_dov),
u3qz_comb(q_fid, q_dov));
u3z(fid);
u3z(dov);
return ret;
}
case c3__tscm: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun boc = u3qzu_busk(van, sut, p_gen);
u3_noun ret = _mint_in(van, boc, gol, q_gen);
u3z(boc);
return ret;
}
case c3__cnts: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
return _mint_cnts(van, sut, gol, p_gen, q_gen);
}
case c3__brcn: p_gen = u3t(gen);
_mint_used();
{
u3_noun ruf = u3nc(u3_nul, 1);
ret = _mint_grow(van, sut, gol, c3__gold, ruf, p_gen);
u3z(ruf);
return ret;
}
case c3__sgzp: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun typ = u3qzu_play(van, sut, p_gen);
u3_noun dug = u3qzu_duck(van, typ);
u3t_push(u3nc(c3__mean, dug));
{
ret = _mint_in(van, sut, gol, q_gen);
}
u3t_drop();
u3z(typ);
return ret;
}
case c3__sggr: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun hum = _mint_in(van, sut, gol, q_gen);
u3_noun bez;
if ( c3y == u3ud(p_gen) ) {
bez = u3k(p_gen);
} else {
bez = u3nc(u3k(u3h(p_gen)),
_mint_corn(van, sut, u3t(p_gen)));
}
ret = u3nc(u3k(u3h(hum)),
u3nt(10, bez, u3k(u3t(hum))));
u3z(hum);
return ret;
}
case c3__zpts: p_gen = u3t(gen);
_mint_used();
{
u3_noun von = u3i_molt(u3k(van), u3qzu_van_vet, c3n, 0);
u3_noun sev = _mint_corn(von, sut, p_gen);
u3z(von);
return u3nc(c3__noun, u3nc(1, sev));
}
case c3__ktcn: p_gen = u3t(gen);
_mint_used();
{
u3_noun von = u3i_molt(u3k(van), u3qzu_van_fab, c3n, 0);
u3_noun ret = _mint_in(von, sut, gol, p_gen);
u3z(von);
return ret;
}
case c3__cold:
case c3__ktsg: p_gen = u3t(gen);
_mint_used();
{
c3_m fun_m = 144 + c3__blow;
u3_noun vrf = u3r_at(u3qzu_van_vrf, van);
u3_noun pro = u3z_find_4(fun_m, vrf, sut, gol, p_gen);
if ( u3_none != pro ) {
return pro;
}
else {
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "blow");
u3_noun pro;
pro = u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
u3k(gol),
u3x_sam_3,
u3k(p_gen),
0));
return u3z_save_4(fun_m, vrf, sut, gol, p_gen, pro);
}
}
case c3__zpcm: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
return u3nc(_mint_nice(van,
gol,
u3qzu_play(van, sut, p_gen)),
u3nc(1, u3k(q_gen)));
}
case c3__dbug: u3x_cell(u3t(gen), &p_gen, &q_gen);
{
u3t_push(u3nc(c3__mean, _mint_loc(van, p_gen)));
{
u3_noun hum = _mint_in(van, sut, gol, q_gen);
u3_noun bez = u3nt(c3__spot, 1, u3k(p_gen));
ret = u3nc(u3k(u3h(hum)), u3nt(10, bez, u3k(u3t(hum))));
u3z(hum);
}
u3t_drop();
return ret;
}
case c3__zpmc:
case c3__zpsm: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun vos = _mint_in(van, sut, c3__noun, q_gen);
u3_noun zur = u3qzu_play(van, sut, p_gen);
u3_noun p_vos = u3h(vos);
u3_noun q_vos = u3t(vos);
u3_noun waz = u3nc(1, _mint_burp(van, p_vos));
// u3_noun waz = u3nc(1, u3k(p_vos));
u3_noun sif = u3k(zur);
u3_noun cig = u3qz_cell(sif, p_vos);
u3_noun ret;
ret = u3nc(_mint_nice(van, gol, cig),
u3qz_cons(waz, q_vos));
u3z(waz);
u3z(zur);
u3z(sif);
u3z(vos);
return ret;
}
case c3__zpvt: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
_mint_used();
{
if ( c3y == _mint_feel(van, sut, p_gen) ) {
return _mint_in(van, sut, gol, q_gen);
} else {
return _mint_in(van, sut, gol, r_gen);
}
}
case c3__lost: p_gen = u3t(gen);
_mint_used();
{
if ( c3y == _mint_vet(van) ) {
u3_noun zur = u3qzu_play(van, sut, p_gen);
u3_noun dun = u3qzu_dunq(van, "lost", zur);
u3t_push(u3nc(c3__mean, dun));
return u3m_error("mint-lost");
}
else {
return u3nt(c3__void, 0, 0);
}
}
case c3__fail:
case c3__zpzp:
_mint_used();
{
return u3nt(c3__void, 0, 0);
}
}
}
static u3_noun
_cqzu_mint(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun gen)
{
return _mint_in(van, sut, gol, gen);
}
/* boilerplate
*/
u3_noun
u3wzu_mint(u3_noun cor)
{
u3_noun sut, gol, gen, van;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &gol,
u3x_sam_3, &gen,
u3x_con, &van,
0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqzu_mint(van, sut, gol, gen);
}
}
u3_noun
u3qzu_mint(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun gen)
{
c3_m fun_m = 144 + c3__mint;
u3_noun vrf = u3r_at(u3qzu_van_vrf, van);
u3_noun pro = u3z_find_4(fun_m, vrf, sut, gol, gen);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqzu_mint(van, sut, gol, gen);
return u3z_save_4(fun_m, vrf, sut, gol, gen, pro);
}
}

757
jets/z/ut_mull.c Normal file
View File

@ -0,0 +1,757 @@
/* j/6/mull.c
**
*/
#include "all.h"
/* functions
*/
static u3_noun
_mull_in(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
static u3_noun
_mull_bean()
{
return u3kf_fork(u3nt(u3nq(c3__atom, 'f', u3_nul, 0),
u3nq(c3__atom, 'f', u3_nul, 1),
u3_nul));
}
static u3_noun
_mull_loc(u3_noun van,
u3_noun loc)
{
u3_noun mol = u3nc('o', u3k(loc));
u3_noun sho = u3j_hook(u3k(van), "show");
u3_noun ret = u3i_molt(u3k(sho), u3x_sam, u3k(mol), 0);
u3z(mol);
u3z(sho);
return ret;
}
static u3_noun
_mull_feel(u3_noun van,
u3_noun sut,
u3_noun rot)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "feel");
return u3n_kick_on(u3i_molt(gat,
u3x_sam,
u3k(rot),
0));
}
static u3_noun
_mull_coke(u3_noun nug)
{
if ( 0 == u3h(nug) ) {
return u3k(u3t(nug));
}
else if ( 10 == u3h(nug) ) {
return _mull_coke(u3t(u3t(nug)));
}
else {
return u3m_error("mull-coke");
}
}
static u3_noun
_mull_mile(u3_noun van,
u3_noun sut,
u3_noun dox,
u3_noun mel,
u3_noun dom)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "mile");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
u3k(dox),
u3x_sam_6,
u3k(mel),
u3x_sam_7,
u3k(dom),
0));
}
static u3_noun
_mull_doke(u3_noun van,
u3_noun sut,
u3_noun gen)
{
u3_noun fug = u3qzu_mint(van, sut, c3__noun, gen);
u3_noun axe = _mull_coke(u3t(fug));
u3z(fug);
return axe;
}
static u3_noun
_mull_nice(u3_noun van,
u3_noun gol,
u3_noun typ)
{
if ( c3n == u3qzu_nest(van, gol, c3y, typ) ) {
// u3_noun dun = u3qzu_dunq(van, "need", gol);
// u3_noun niz = u3qzu_dunq(van, "have", typ);
// u3t_push(u3nc(c3__mean, dun));
// u3t_push(u3nc(c3__mean, niz));
return u3m_error("mull-nice");
}
else return typ;
}
static u3_noun
_mull_grow(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun dox,
u3_atom mel,
u3_noun ruf,
u3_noun dom)
{
u3_noun dan = _mull_in(van, sut, c3__noun, dox, ruf);
u3_noun p_dan = u3h(dan);
u3_noun q_dan = u3t(dan);
u3_noun yaz = _mull_mile(van, p_dan, q_dan, mel, dom);
u3_noun p_yaz = u3h(yaz);
u3_noun q_yaz = u3t(yaz);
u3_noun ret = u3nc(_mull_nice(van, gol, u3k(p_yaz)), u3k(q_yaz));
u3z(yaz);
u3z(dan);
return ret;
}
static u3_noun
_mull_both(u3_noun van,
u3_noun gol,
u3_noun typ)
{
return u3nc(_mull_nice(van, gol, u3k(typ)),
typ);
}
#if 1
static u3_noun
_mull_cnts(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun dox,
u3_noun hyp,
u3_noun rig)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "emul");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
u3k(gol),
u3x_sam_6,
u3k(dox),
u3x_sam_14,
u3k(hyp),
u3x_sam_15,
u3k(rig),
0));
}
#else
static u3_noun
_mull_edit(u3_noun van,
u3_noun sut,
u3_noun dox,
u3_noun mew,
u3_noun p_yom,
u3_noun q_yom)
{
while ( 1 ) {
if ( c3n == u3du(mew) ) {
return u3nc(p_yom, q_yom);
} else {
u3_noun i_mew = u3h(mew);
u3_noun t_mew = u3t(mew);
u3_noun pi_mew = u3h(i_mew);
u3_noun qi_mew = u3t(i_mew);
u3_noun zil = _mull_in(van, sut, c3__noun, dox, qi_mew);
u3_noun p_zil = u3h(zil);
u3_noun q_zil = u3t(zil);
u3_noun cuf = u3qzu_toss(van, sut, pi_mew, p_zil, p_yom);
u3_noun dof = u3qzu_toss(van, sut, pi_mew, q_zil, q_yom);
if ( u3r_sing(u3h(cuf), u3h(dof)) ) {
u3m_error("mull-bonk-a");
}
u3z(p_yom);
p_yom = u3k(u3t(cuf));
u3z(q_yom);
q_yom = u3k(u3t(dof));
u3z(dof);
u3z(cuf);
u3z(zil);
mew = t_mew;
}
}
}
static u3_noun
_mull_cnts_old(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun dox,
u3_noun hyp,
u3_noun rig)
{
u3_noun lar = u3qzu_seek(van, sut, c3__read, hyp);
u3_noun vug = u3qzu_seek(van, dox, c3__read, hyp);
u3_noun p_lar = u3h(lar);
u3_noun q_lar = u3t(lar);
u3_noun pq_lar = u3h(q_lar);
u3_noun qq_lar = u3t(q_lar);
u3_noun p_vug = u3h(vug);
u3_noun q_vug = u3t(vug);
u3_noun pq_vug = u3h(q_vug);
u3_noun qq_vug = u3t(q_vug);
if ( c3a(u3r_sing(p_lar, p_vug), u3r_sing(pq_lar, pq_vug)) ) {
u3m_error("mull-bonk-e");
}
{
u3_noun mew = rig;
u3_noun yom = _mull_edit
(van, sut, dox, mew, u3k(qq_lar),
u3k(qq_vug));
u3_noun von = u3i_molt(u3k(van), u3qzu_van_vet, c3n, 0);
u3_noun p_ret = u3qzu_fire(van, sut, u3h(yom));
u3_noun q_ret = u3qzu_fire(von, sut, u3t(yom));
u3z(von);
u3z(yom);
u3z(vug);
u3z(lar);
return u3nc(_mull_nice(van, gol, p_ret), q_ret);
}
}
#endif
# define _mull_used()
static u3_noun
_mull_in(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun dox,
u3_noun gen)
{
u3_noun p_gen, q_gen, r_gen;
u3_noun ret;
if ( c3n == u3du(gen) ) {
u3_noun ter = u3r_at(u3x_con_3, van);
u3_noun fab = u3r_at(u3qzu_van_fab, van);
u3_noun rex = u3qzp_open(ter, fab, gen);
ret = _mull_in(van, sut, gol, dox, rex);
u3z(rex);
return ret;
}
else if ( c3y == u3du(u3h(gen)) ) {
_mull_used();
{
u3_noun hed = _mull_in(van, sut, c3__noun, dox, u3h(gen));
u3_noun tal = _mull_in(van, sut, c3__noun, dox, u3t(gen));
u3_noun dis = u3qz_cell(u3h(hed), u3h(tal));
u3_noun dat = u3qz_cell(u3t(hed), u3t(tal));
u3_noun ret = u3nc(_mull_nice(van, gol, dis), dat);
u3z(tal);
u3z(hed);
return ret;
}
}
else switch ( u3h(gen) ) {
default: {
u3_noun ter = u3r_at(u3x_con_3, van);
u3_noun fab = u3r_at(u3qzu_van_fab, van);
u3_noun rex = u3qzp_open(ter, fab, gen);
if ( c3y == u3r_sing(rex, gen) ) {
#if 1
u3_noun zix = u3qzu_shep(van, "gene", 'q', u3k(gen));
u3t_push(u3nc(c3__mean, zix));
return u3m_error("mull-open");
#else
u3_err("h", u3h(gen));
return u3m_bail(c3__fail);
#endif
}
ret = _mull_in(van, sut, gol, dox, rex);
u3z(rex);
return ret;
}
case c3__fits: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun p_waz = u3qzu_play(van, sut, p_gen);
u3_noun q_waz = u3qzu_play(van, dox, p_gen);
u3_noun dok = u3nc(c3__wing, u3k(q_gen));
u3_noun p_syx = _mull_doke(van, sut, dok);
u3_noun q_syx = _mull_doke(van, dox, dok);
u3_noun p_pov = u3qzu_fish(van, p_waz, p_syx);
u3_noun q_pov = u3qzu_fish(van, q_waz, q_syx);
if ( (c3n == u3r_sing(p_syx, q_syx)) ||
(c3n == u3r_sing(p_pov, q_pov)) )
{
return u3m_error("mull-bonk-b");
}
u3z(p_waz); u3z(q_waz);
u3z(p_syx); u3z(q_syx);
u3z(p_pov); u3z(q_pov);
u3z(dok);
return _mull_both(van, gol, _mull_bean());
}
case c3__wtcl: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
_mull_used();
{
u3_noun bol = _mull_bean();
u3_noun nor = _mull_in(van, sut, bol, dox, p_gen);
u3_noun p_fex = u3qzu_gain(van, sut, p_gen);
u3_noun q_fex = u3qzu_gain(van, dox, p_gen);
u3_noun p_wux = u3qzu_lose(van, sut, p_gen);
u3_noun q_wux = u3qzu_lose(van, dox, p_gen);
u3_noun hiq, ran;
u3_noun dis, dat;
u3_noun ret;
if ( c3__void == p_fex ) {
hiq = u3nc(c3__void,
(c3__void == q_fex)
? c3__void
: u3qzu_play(van, q_fex, q_gen));
} else if ( c3__void == q_fex ) {
hiq = u3m_error("mull-bonk-c");
}
else hiq = _mull_in(van, p_fex, gol, q_fex, q_gen);
if ( c3__void == p_wux ) {
ran = u3nc(c3__void,
(c3__void == q_wux)
? c3__void
: u3qzu_play(van, q_wux, r_gen));
} else if ( c3__void == q_wux ) {
ran = u3m_error("mull-bonk-d");
}
else ran = _mull_in(van, p_wux, gol, q_wux, r_gen);
dis = u3qz_forq(u3h(hiq), u3h(ran));
dat = u3qz_forq(u3t(hiq), u3t(ran));
ret = u3nc(_mull_nice(van, gol, dis), dat);
u3z(ran);
u3z(hiq);
u3z(q_wux);
u3z(p_wux);
u3z(q_fex);
u3z(p_fex);
u3z(nor);
u3z(bol);
return ret;
}
case c3__clhp: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun hed = _mull_in(van, sut, c3__noun, dox, p_gen);
u3_noun tal = _mull_in(van, sut, c3__noun, dox, q_gen);
u3_noun dis = u3qz_cell(u3h(hed), u3h(tal));
u3_noun dat = u3qz_cell(u3t(hed), u3t(tal));
u3_noun ret = u3nc(_mull_nice(van, gol, dis), dat);
u3z(tal);
u3z(hed);
return ret;
}
case c3__dtts: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun hed = _mull_in(van, sut, c3__noun, dox, p_gen);
u3_noun tal = _mull_in(van, sut, c3__noun, dox, q_gen);
u3z(hed);
u3z(tal);
return _mull_both(van, gol, _mull_bean());
}
case c3__dtwt: p_gen = u3t(gen);
_mull_used();
{
u3_noun vay = _mull_in(van, sut, c3__noun, dox, p_gen);
u3z(vay);
return _mull_both(van, gol, _mull_bean());
}
case c3__dtkt: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun nog = u3nc(c3__bcdt, u3k(p_gen));
u3_noun vay = _mull_in(van, sut, c3__noun, dox, q_gen);
u3_noun ret;
u3z(vay);
ret = _mull_in(van, sut, gol, dox, nog);
u3z(nog);
return ret;
}
case c3__dtls: p_gen = u3t(gen);
_mull_used();
{
u3_noun wuq = u3nt(c3__atom, u3_blip, u3_nul);
u3_noun vay = _mull_in(van, sut, wuq, dox, p_gen);
u3z(vay);
return _mull_both(van, gol, wuq);
}
case c3__rock: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun typ = u3qzu_play(van, sut, gen);
return _mull_both(van, gol, typ);
}
case c3__dttr: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun hed = _mull_in(van, sut, c3__noun, dox, p_gen);
u3_noun tal = _mull_in(van, sut, c3__noun, dox, q_gen);
u3z(hed);
u3z(tal);
return _mull_both(van, gol, c3__noun);
}
case c3__sand: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun typ = u3qzu_play(van, sut, gen);
return _mull_both(van, gol, typ);
}
case c3__hand: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
return u3nc(u3k(p_gen), u3k(p_gen));
}
case c3__ktbr: p_gen = u3t(gen);
_mull_used();
{
u3_noun vat = _mull_in(van, sut, gol, dox, p_gen);
u3_noun pro = u3nc(u3qzu_wrap(van,
u3h(vat),
c3__iron),
u3qzu_wrap(van,
u3t(vat),
c3__iron));
u3z(vat);
return pro;
}
case c3__ktpd:
case c3__ktpm: p_gen = u3t(gen);
_mull_used();
{
u3_noun vat = _mull_in(van, sut, gol, dox, p_gen);
u3_noun pro = u3nc(u3qzu_wrap(van,
u3h(vat),
c3__zinc),
u3qzu_wrap(van,
u3t(vat),
c3__zinc));
u3z(vat);
return pro;
}
case c3__ktwt: p_gen = u3t(gen);
_mull_used();
{
u3_noun vat = _mull_in(van, sut, gol, dox, p_gen);
u3_noun pro = u3nc(u3qzu_wrap(van,
u3h(vat),
c3__lead),
u3qzu_wrap(van,
u3t(vat),
c3__lead));
u3z(vat);
return pro;
}
case c3__note: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun vat = _mull_in(van, sut, gol, dox, q_gen);
u3_noun hit = u3nc(u3k(sut), u3k(p_gen));
u3_noun hix = u3nc(u3k(dox), u3k(p_gen));
u3_noun ret = u3nc(u3qz_hint(hit, u3h(vat)),
u3qz_hint(hix, u3t(vat)));
u3z(hix);
u3z(hit);
u3z(vat);
return ret;
}
case c3__tune: p_gen = u3t(gen);
_mull_used();
{
return u3nc(u3qz_face(p_gen, sut),
u3qz_face(p_gen, dox));
}
case c3__ktsg: p_gen = u3t(gen);
_mull_used();
{
return _mull_in(van, sut, gol, dox, p_gen);
}
case c3__ktls: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun p_hif = _mull_nice(van, gol, u3qzu_play(van, sut, p_gen));
u3_noun q_hif = u3qzu_play(van, dox, p_gen);
u3_noun zel = _mull_in(van, sut, p_hif, dox, q_gen);
u3_noun ret = u3nc(p_hif, q_hif);
u3z(zel);
return ret;
}
case c3__tsgr: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun lem = _mull_in(van, sut, c3__noun, dox, p_gen);
u3_noun p_lem = u3h(lem);
u3_noun q_lem = u3t(lem);
u3_noun ret = _mull_in(van, p_lem, gol, q_lem, q_gen);
u3z(lem);
return ret;
}
case c3__tscm: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun boc = u3qzu_busk(van, sut, p_gen);
u3_noun nuf = u3qzu_busk(van, dox, p_gen);
u3_noun ret = _mull_in(van, boc, gol, nuf, q_gen);
u3z(boc);
u3z(nuf);
return ret;
}
case c3__cnts: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
return _mull_cnts(van, sut, gol, dox, p_gen, q_gen);
}
case c3__brcn: p_gen = u3t(gen);
_mull_used();
{
u3_noun ruf = u3nc(u3_nul, 1);
ret = _mull_grow(van, sut, gol, dox, c3__gold, ruf, p_gen);
u3z(ruf);
return ret;
}
case c3__sgzp: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun typ = u3qzu_play(van, sut, p_gen);
u3_noun dug = u3qzu_duck(van, typ);
u3_noun ret;
u3t_push(u3nc(c3__mean, dug));
{
ret = _mull_in(van, sut, gol, dox, q_gen);
}
u3t_drop();
u3z(typ);
return ret;
}
case c3__sggr: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
return _mull_in(van, sut, gol, dox, q_gen);
}
case c3__zpcm: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun p_ret = u3qzu_play(van, sut, p_gen);
u3_noun q_ret = u3qzu_play(van, sut, q_gen);
return u3nc(_mull_nice(van, gol, p_ret),
q_ret);
}
case c3__dbug: u3x_cell(u3t(gen), &p_gen, &q_gen);
{
u3_noun ret;
u3t_push(u3nc(c3__mean, _mull_loc(van, p_gen)));
{
ret = _mull_in(van, sut, gol, dox, q_gen);
}
u3t_drop();
return ret;
}
case c3__zpts: p_gen = u3t(gen);
_mull_used();
{
return _mull_both(van, gol, c3__noun);
}
case c3__ktcn: p_gen = u3t(gen);
_mull_used();
{
u3_noun von = u3i_molt(u3k(van), u3qzu_van_fab, c3n, 0);
u3_noun ret = _mull_in(von, sut, gol, dox, p_gen);
u3z(von);
return ret;
}
case c3__zpmc:
case c3__zpsm: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun p_zur = u3qzu_play(van, sut, p_gen);
u3_noun q_zur = u3qzu_play (van, dox, p_gen);
u3_noun vos = _mull_in(van, sut, c3__noun, dox, q_gen);
u3_noun p_ret = u3qz_cell(p_zur, u3h(vos));
u3_noun q_ret = u3qz_cell(q_zur, u3t(vos));
u3z(vos);
u3z(q_zur);
u3z(p_zur);
return u3nc
(_mull_nice(van, gol, p_ret), q_ret);
}
case c3__zpvt: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
_mull_used();
{
c3_o fes = _mull_feel(van, sut, p_gen);
c3_o fed = _mull_feel(van, dox, p_gen);
if ( fes != fed ) {
return u3m_error("mull-bonk-f");
}
else {
if ( c3y == fes ) {
return _mull_in(van, sut, gol, dox, q_gen);
} else {
return _mull_in(van, sut, gol, dox, r_gen);
}
}
}
case c3__lost:
case c3__fail:
case c3__zpzp:
_mull_used();
{
return u3nc(c3__void, c3__void);
}
}
}
static u3_noun
_cqzu_mull(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun dox,
u3_noun gen)
{
return _mull_in(van, sut, gol, dox, gen);
}
/* boilerplate
*/
u3_noun
u3wzu_mull(u3_noun cor)
{
u3_noun sut, gol, dox, gen, van;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &gol,
u3x_sam_6, &dox,
u3x_sam_7, &gen,
u3x_con, &van,
0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqzu_mull(van, sut, gol, dox, gen);
}
}
u3_noun
u3qzu_mull(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun dox,
u3_noun gen)
{
c3_m fun_m = 144 + c3__mull + ((!!u3r_at(u3qzu_van_vet, van)) << 8);
u3_noun pro = u3z_find_4(fun_m, sut, gol, dox, gen);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqzu_mull(van, sut, gol, dox, gen);
return u3z_save_4(fun_m, sut, gol, dox, gen, pro);
}
}

566
jets/z/ut_nest.c Normal file
View File

@ -0,0 +1,566 @@
/* j/6/ut_nest.c
**
*/
#include "all.h"
/* logic
*/
/* forward
*/
static u3_noun
_nest_sint(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
static u3_noun
_nest_dext(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
static u3_noun
_nest_deep(u3_noun van,
u3_noun sut,
u3_noun tel,
u3_noun ref,
u3_noun dab,
u3_noun hem,
u3_noun gil)
{
if ( u3_nul == dab ) {
return u3r_sing(u3_nul, hem);
} else if ( u3_nul == hem ) {
return c3n;
} else {
u3_noun n_dab, l_dab, r_dab;
u3_noun n_hem, l_hem, r_hem;
u3_noun pn_hem, pqn_hem, qqn_hem, pn_dab, pqn_dab, qqn_dab;
u3x_trel(dab, &n_dab, &l_dab, &r_dab);
u3x_trel(hem, &n_hem, &l_hem, &r_hem);
if ( (c3n == _nest_deep(van, sut, tel, ref, l_dab, l_hem, gil)) ||
(c3n == _nest_deep(van, sut, tel, ref, r_dab, r_hem, gil)) )
{
return c3n;
}
u3x_trel(n_dab, &pn_dab, &pqn_dab, &qqn_dab);
u3x_trel(n_hem, &pn_hem, &pqn_hem, &qqn_hem);
if ( c3n == u3r_sing(pn_dab, pn_hem) ) {
return c3n;
} else {
if ( (c3n == u3du(qqn_dab)) || (c3n == u3du(qqn_hem)) ) {
return u3m_bail(c3__fail);
}
else switch ( u3h(qqn_dab) ) {
default: return u3m_bail(c3__exit);
case c3__ash: {
if ( c3__ash != u3h(qqn_hem) ) {
return c3n;
} else {
u3_noun qqqn_dab = u3t(qqn_dab);
u3_noun qqqn_hem = u3t(qqn_hem);
u3_noun vis = u3qzu_play(van, sut, qqqn_dab);
u3_noun lon = u3qzu_play(van, ref, qqqn_hem);
u3_noun ret = _nest_dext(van, vis, tel, lon, u3_nul, u3_nul, gil);
u3z(vis);
u3z(lon);
return ret;
}
}
case c3__elm: {
return u3r_sing(qqn_dab, qqn_hem);
}
}
}
}
}
static u3_noun
_nest_dope(u3_noun van,
u3_noun sut,
u3_noun tel,
u3_noun ref,
u3_noun dom,
u3_noun vim,
u3_noun gil)
{
if ( u3_nul == dom ) {
return u3r_sing(u3_nul, vim);
} else if ( u3_nul == vim ) {
return c3n;
} else {
u3_noun n_dom, l_dom, r_dom;
u3_noun n_vim, l_vim, r_vim;
u3_noun pn_vim, qn_vim, pn_dom, qn_dom;
u3x_trel(dom, &n_dom, &l_dom, &r_dom);
u3x_trel(vim, &n_vim, &l_vim, &r_vim);
if ( (c3n == _nest_dope(van, sut, tel, ref, l_dom, l_vim, gil)) ||
(c3n == _nest_dope(van, sut, tel, ref, r_dom, r_vim, gil)) )
{
return c3n;
}
u3x_cell(n_dom, &pn_dom, &qn_dom);
u3x_cell(n_vim, &pn_vim, &qn_vim);
if ( c3n == u3r_sing(pn_dom, pn_vim) ) {
return c3n;
} else {
return _nest_deep(van, sut, tel, ref, qn_dom, qn_vim, gil);
}
}
}
static u3_noun
_nest_cong(u3_noun van,
u3_noun sut,
u3_noun tel,
u3_noun ref,
u3_noun gil)
{
u3_noun p_sut, q_sut, p_ref, q_ref;
u3_noun pq_sut, qq_sut, rq_sut;
u3_noun pq_ref, qq_ref, rq_ref;
u3_noun prq_sut, qrq_sut, prq_ref, qrq_ref;
u3_noun ppq_sut, qpq_sut, rpq_sut;
u3_noun ppq_ref, qpq_ref, rpq_ref;
u3_noun ret;
u3x_trel(sut, 0, &p_sut, &q_sut);
u3x_trel(ref, 0, &p_ref, &q_ref);
u3x_trel(q_sut, &pq_sut, &qq_sut, &rq_sut);
u3x_trel(q_ref, &pq_ref, &qq_ref, &rq_ref);
u3x_trel(pq_sut, &ppq_sut, &qpq_sut, &rpq_sut);
u3x_trel(pq_ref, &ppq_ref, &qpq_ref, &rpq_ref);
u3x_cell(rq_sut, &prq_sut, &qrq_sut);
u3x_cell(rq_ref, &prq_ref, &qrq_ref);
if ( c3y == u3r_sing(q_sut, q_ref) ) {
return _nest_dext(van, p_sut, tel, p_ref, u3_nul, u3_nul, gil);
}
else if ( (c3n == _nest_dext
(van, qq_sut, tel, p_sut, u3_nul, u3_nul, gil)) ||
(c3n == _nest_dext
(van, p_sut, tel, qq_sut, u3_nul, u3_nul, gil)) ||
(c3n == _nest_dext
(van, qq_ref, tel, p_ref, u3_nul, u3_nul, gil)) )
{
return c3n;
}
else {
if ( (rpq_sut != rpq_ref) &&
(c3__lead != rpq_sut) &&
(c3__gold != rpq_ref) )
{
return c3n;
}
else {
u3_noun hud = u3nc(u3k(sut), u3k(ref));
if ( (c3y == u3qdi_has(gil, hud)) ) {
u3z(hud);
return c3y;
}
else {
u3_noun zoc = u3qdi_put(gil, hud);
u3_noun tus = u3nt(c3__core,
u3k(qq_sut),
u3nc(u3nt(u3k(ppq_sut), u3k(qpq_sut), c3__gold),
u3k(u3t(q_sut))));
u3_noun fer = u3nt(c3__core,
u3k(qq_ref),
u3nc(u3nt(u3k(ppq_ref), u3k(qpq_ref), c3__gold),
u3k(u3t(q_ref))));
ret = _nest_dope(van, tus, tel, fer, qrq_sut, qrq_ref, zoc);
u3z(fer);
u3z(tus);
u3z(zoc);
u3z(hud);
if ( c3n == ret ) {
return c3n;
}
else {
switch ( rpq_sut ) {
default: return u3m_bail(c3__fail);
case c3__gold: {
return
c3a(_nest_dext(van, qq_sut, tel, qq_ref, u3_nul, u3_nul, gil),
_nest_dext(van, qq_ref, tel, qq_sut, u3_nul, u3_nul, gil));
}
case c3__iron: {
u3_noun s_sam = u3qzu_peek(van, qq_sut, c3__rite, 2);
u3_noun r_sam = u3qzu_peek(van, qq_ref, c3__rite, 2);
u3_noun ret = _nest_dext
(van, r_sam, tel, s_sam, u3_nul, u3_nul, gil);
u3z(r_sam);
u3z(s_sam);
return ret;
}
case c3__lead: {
return c3y;
}
case c3__zinc: {
u3_noun s_pal = u3qzu_peek(van, qq_sut, c3__read, 2);
u3_noun r_pal = u3qzu_peek(van, qq_ref, c3__read, 2);
u3_noun ret = _nest_dext
(van, s_pal, tel, r_pal, u3_nul, u3_nul, gil);
u3z(r_pal);
u3z(s_pal);
return ret;
}
}
}
}
}
}
}
static u3_noun
_nest_dext_in(u3_noun van,
u3_noun sut,
u3_noun tel,
u3_noun ref,
u3_noun seg,
u3_noun reg,
u3_noun gil)
{
u3_noun p_sut, q_sut, p_ref, q_ref;
if ( (c3n == u3du(sut)) ) switch ( sut ) {
default: return u3m_bail(c3__fail);
case c3__noun: {
return c3y;
}
case c3__void: {
return _nest_sint(van, sut, tel, ref, seg, reg, gil);
}
}
else switch ( u3h(sut) ) {
default: return u3m_bail(c3__fail);
case c3__atom: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);
}
else {
if ( c3y == u3r_pq(ref, c3__atom, &p_ref, &q_ref) ) {
if ( (c3n == u3qz_fitz(p_sut, p_ref)) ||
( (c3y == u3du(q_sut)) &&
( (c3n == u3du(q_ref)) ||
(c3n == u3r_sing(q_sut, q_ref)))) )
{
return c3n;
}
return c3y;
}
return _nest_sint(van, sut, tel, ref, seg, reg, gil);
}
}
case c3__cell: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);
} else {
if ( c3y == u3r_pq(ref, c3__cell, &p_ref, &q_ref) ) {
return c3a(_nest_dext(van, p_sut, tel, p_ref, u3_nul, u3_nul, gil),
_nest_dext(van, q_sut, tel, q_ref, u3_nul, u3_nul, gil));
}
else return _nest_sint(van, sut, tel, ref, seg, reg, gil);
}
}
case c3__core: {
if ( c3n == u3r_trel(sut, 0, &p_sut, &q_sut) ) {
return u3m_bail(c3__fail);
} else {
if ( (c3y == u3r_pq(ref, c3__core, &p_ref, &q_ref)) ) {
return _nest_cong(van, sut, tel, ref, gil);
}
else return _nest_sint(van, sut, tel, ref, seg, reg, gil);
}
}
case c3__hint:
case c3__face: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);
} else {
return _nest_dext(van, q_sut, tel, ref, seg, reg, gil);
}
}
case c3__fork: p_sut = u3t(sut);
{
if ( c3n == u3du(ref) ) switch ( ref ) {
default: return _nest_sint(van, sut, tel, ref, seg, reg, gil);
case c3__noun:
break;
}
else switch ( u3h(ref) ) {
default: return _nest_sint(van, sut, tel, ref, seg, reg, gil);
case c3__atom:
case c3__cell:
case c3__core:
break;
}
{
u3_noun dey = u3qdi_tap(p_sut);
u3_noun yed = dey;
while ( u3_nul != yed ) {
if ( c3y == _nest_dext(van, u3h(yed), c3n, ref, seg, reg, gil) ) {
u3z(dey);
return c3y;
} else {
yed = u3t(yed);
}
}
u3z(dey);
return c3n;
}
}
case c3__hold:
{
if ( c3y == u3qdi_has(seg, sut) ) {
return c3n;
}
else {
u3_noun hud = u3nc(u3k(sut), u3k(ref));
if ( (c3y == u3qdi_has(gil, hud)) ) {
u3z(hud);
return c3y;
}
else {
u3_noun gus = u3qdi_put(seg, sut);
u3_noun zoc = u3qdi_put(gil, hud);
u3_noun fop = u3qzu_repo(van, sut);
u3_noun hiv = _nest_dext(van, fop, tel, ref, gus, reg, zoc);
u3z(hud);
u3z(fop);
u3z(zoc);
u3z(gus);
return hiv;
}
}
}
}
}
static u3_noun
_nest_dext_to(u3_noun van,
u3_noun sut,
u3_noun tel,
u3_noun ref,
u3_noun seg,
u3_noun reg,
u3_noun gil)
{
u3_noun tyn = _nest_dext_in(van, sut, tel, ref, seg, reg, gil);
if ( (c3y == tyn) || (c3n == tel) ) {
return tyn;
} else {
#if 0
u3_noun dun = u3qzu_dunq(van, "need", sut);
u3_noun niz = u3qzu_dunq(van, "have", ref);
u3t_push(u3nc(c3__mean, dun));
u3t_push(u3nc(c3__mean, niz));
#endif
return u3m_error("nest-fail");
}
}
static u3_noun
_nest_dext(u3_noun van,
u3_noun sut,
u3_noun tel,
u3_noun ref,
u3_noun seg,
u3_noun reg,
u3_noun gil)
{
if ( (c3y == u3r_sing(sut, ref)) ) {
return c3y;
}
{
c3_m fun_m = 144 + c3__nest + ((!!u3r_at(u3qzu_van_vet, van)) << 8);
u3_noun pro = u3z_find_2(fun_m, sut, ref);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _nest_dext_to(van, sut, tel, ref, seg, reg, gil);
if ( ((c3y == pro) && (u3_nul == reg)) ||
((c3n == pro) && (u3_nul == seg)) )
{
return u3z_save_2(fun_m, sut, ref, pro);
}
else return pro;
}
}
}
static u3_noun
_nest_sint(u3_noun van,
u3_noun sut,
u3_noun tel,
u3_noun ref,
u3_noun seg,
u3_noun reg,
u3_noun gil)
{
u3_noun p_ref, q_ref;
if ( (c3n == u3du(ref)) ) {
switch ( ref ) {
default: return u3m_bail(c3__fail);
case c3__noun: return c3n;
case c3__void: return c3y;
}
}
else {
switch ( u3h(ref) ) {
default: {
return u3m_bail(c3__fail);
}
case c3__atom: return c3n;
case c3__cell: return c3n;
case c3__core: {
u3_noun gam = u3qzu_repo(van, ref);
u3_noun hiv = _nest_dext(van, sut, tel, gam, seg, reg, gil);
u3z(gam);
return hiv;
}
case c3__hint:
case c3__face: {
if ( c3n == u3r_trel(ref, 0, &p_ref, &q_ref) ) {
return u3m_bail(c3__fail);
} else {
return _nest_dext(van, sut, tel, q_ref, seg, reg, gil);
}
}
case c3__fork: p_ref = u3t(ref);
{
u3_noun dey = u3qdi_tap(p_ref);
u3_noun yed = dey;
while ( u3_nul != yed ) {
if ( c3n == _nest_dext(van, sut, c3n, u3h(yed), seg, reg, gil) ) {
u3z(dey);
return c3n;
} else {
yed = u3t(yed);
}
}
u3z(dey);
return c3y;
}
case c3__hold: {
if ( c3y == u3qdi_has(reg, ref) ) {
return c3y;
}
{
u3_noun hud = u3nc(u3k(sut), u3k(ref));
if ( (c3y == u3qdi_has(gil, hud)) ) {
u3z(hud);
return c3y;
} else {
u3_noun gur = u3qdi_put(reg, ref);
u3_noun zoc = u3qdi_put(gil, hud);
u3_noun gam = u3qzu_repo(van, ref);
{
u3_noun hiv = _nest_dext(van, sut, tel, gam, seg, gur, zoc);
u3z(hud);
u3z(gam);
u3z(zoc);
u3z(gur);
return hiv;
}
}
}
}
}
}
}
static u3_noun
_cqzu_nest(u3_noun van,
u3_noun sut,
u3_noun tel,
u3_noun ref)
{
return _nest_dext(van, sut, tel, ref, u3_nul, u3_nul, u3_nul);
}
/* boilerplate
*/
u3_noun
u3wzu_nest(u3_noun cor)
{
u3_noun sut, tel, ref, van;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &tel,
u3x_sam_3, &ref,
u3x_con, &van,
0)) ||
(c3n == u3ud(tel)) || (tel > 1) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqzu_nest(van, sut, tel, ref);
}
}
u3_noun
u3qzu_nest(u3_noun van,
u3_noun sut,
u3_noun tel,
u3_noun ref)
{
#if 1
c3_m fun_m = 144 + c3__nest;
u3_noun vrf = u3r_at(u3qzu_van_vrf, van);
u3_noun pro = u3z_find_4(fun_m, vrf, sut, tel, ref);
if ( u3_none != pro ) {
// u3t_heck(c3__good);
return pro;
}
else {
pro = _cqzu_nest(van, sut, tel, ref);
// u3t_heck(c3__nest);
return u3z_save_4(fun_m, vrf, sut, tel, ref, pro);
}
#else
return _cqzu_nest(van, sut, tel, ref);
#endif
}

216
jets/z/ut_peek.c Normal file
View File

@ -0,0 +1,216 @@
/* j/6/peek.c
**
*/
#include "all.h"
/* logic
*/
static u3_noun
_cqzu_peek(u3_noun, u3_noun, u3_noun, u3_atom);
static u3_noun
_peek_in(u3_noun, u3_noun, u3_noun, u3_atom, u3_noun);
static u3_noun
_peek_fork(u3_noun van, u3_noun p_sut, u3_noun way, u3_noun axe, u3_noun gil)
{
if ( u3_nul == p_sut ) {
return u3_nul;
}
else {
return u3nc(_peek_in(van, u3h(p_sut), way, axe, gil),
_peek_fork(van, u3t(p_sut), way, axe, gil));
}
}
static u3_noun
_peek_in(u3_noun van,
u3_noun sut,
u3_noun way,
u3_atom axe,
u3_noun gil)
{
u3_noun p_sut, q_sut;
u3_noun pro;
if ( (c3n == u3du(sut)) ) switch ( sut ) {
default: return u3m_bail(c3__fail);
case c3__noun: {
return c3__noun;
}
case c3__void: {
return c3__void;
}
}
else switch ( u3h(sut) ) {
default: return u3m_bail(c3__fail);
case c3__atom: {
return c3__void;
}
case c3__cell: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);
} else {
u3_atom tip = u3qc_cap(axe);
u3_atom tap = u3qc_mas(axe);
if ( 2 == tip ) {
pro = _cqzu_peek(van, p_sut, way, tap);
}
else {
pro = _cqzu_peek(van, q_sut, way, tap);
}
u3z(tap);
u3z(tip);
return pro;
}
}
case c3__core: {
u3_noun pq_sut, qq_sut, rq_sut;
u3_noun ppq_sut, qpq_sut, rpq_sut;
u3_noun prq_sut, qrq_sut;
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ||
(c3n == u3r_trel(q_sut, &pq_sut, &qq_sut, &rq_sut)) ||
(c3n == u3r_trel(pq_sut, &ppq_sut, &qpq_sut, &rpq_sut)) ||
(c3n == u3r_cell(rq_sut, &prq_sut, &qrq_sut)) )
{
return u3m_bail(c3__fail);
} else {
u3_atom now = u3qc_cap(axe);
u3_atom lat = u3qc_mas(axe);
if ( 3 == now ) {
u3_noun pec = u3qzu_peel(van, sut, way, rpq_sut);
u3_noun sam = u3h(pec);
u3_noun con = u3t(pec);
if ( c3y == c3a(sam, con) ) {
pro = _cqzu_peek(van, p_sut, way, lat);
}
else {
u3_noun typ;
{
u3_noun hed, tal;
if ( c3n == sam ) {
hed = c3__noun;
} else {
hed = _cqzu_peek(van, p_sut, way, 2);
}
if ( c3n == con ) {
tal = c3__noun;
} else {
tal = _cqzu_peek(van, p_sut, way, 3);
}
typ = u3qz_cell(hed, tal);
u3z(hed);
u3z(tal);
}
pro = _cqzu_peek(van, typ, way, lat);
u3z(typ);
}
u3z(pec);
}
else {
pro = c3__noun;
}
u3z(lat);
u3z(now);
return pro;
}
}
case c3__hint:
case c3__face: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);
} else {
return _peek_in(van, q_sut, way, axe, gil);
}
}
case c3__fork: p_sut = u3t(sut);
{
u3_noun yed = u3qdi_tap(p_sut);
u3_noun ret = u3kf_fork(_peek_fork(van, yed, way, axe, gil));
u3z(yed);
return ret;
}
case c3__hold: {
if ( (c3y == u3qdi_has(gil, sut)) ) {
return c3__void;
}
else {
u3_noun zoc = u3qdi_put(gil, sut);
u3_noun fop = u3qzu_repo(van, sut);
u3_noun pro = _peek_in(van, fop, way, axe, zoc);
u3z(fop);
u3z(zoc);
return pro;
}
}
}
}
static u3_noun
_cqzu_peek(u3_noun van,
u3_noun sut,
u3_noun way,
u3_atom axe)
{
if ( 1 == axe ) {
return u3k(sut);
}
else return _peek_in(van, sut, way, axe, u3_nul);
}
/* boilerplate
*/
u3_noun
u3wzu_peek(u3_noun cor)
{
u3_noun sut, way, axe, van;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &way,
u3x_sam_3, &axe,
u3x_con, &van,
0)) ||
(c3n == u3ud(axe)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqzu_peek(van, sut, way, axe);
}
}
u3_noun
u3qzu_peek(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun axe)
{
c3_m fun_m = 144 + c3__peek + ((!!u3r_at(u3qzu_van_vet, van)) << 8);
u3_noun pro = u3z_find_3(fun_m, sut, way, axe);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqzu_peek(van, sut, way, axe);
return u3z_save_3(fun_m, sut, way, axe, pro);
}
}

55
jets/z/ut_peel.c Normal file
View File

@ -0,0 +1,55 @@
/* j/6/ut_peel.c
**
*/
#include "all.h"
/* logic
*/
u3_noun
_cqzu_peel(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun met)
{
if ( c3__gold == met ) {
return u3nc(c3y, c3y);
}
else switch ( way ) {
default: return u3m_bail(c3__fail);
case c3__both: return u3nc(c3n, c3n);
case c3__free: return u3nc(c3y, c3y);
case c3__read: return u3nc(((met == c3__zinc) ? c3y : c3n), c3n);
case c3__rite: return u3nc(((met == c3__iron) ? c3y : c3n), c3n);
}
}
/* boilerplate
*/
u3_noun
u3wzu_peel(u3_noun cor)
{
u3_noun sut, way, met, van;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &way,
u3x_sam_3, &met,
u3x_con, &van,
0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqzu_peel(van, sut, way, met);
}
}
u3_noun
u3qzu_peel(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun met)
{
return _cqzu_peel(van, sut, way, met);
}

592
jets/z/ut_play.c Normal file
View File

@ -0,0 +1,592 @@
/* j/6/play.c
**
*/
#include "all.h"
/* logic
*/
# define _play_used()
static u3_noun
_play_in(u3_noun, u3_noun, u3_noun);
static u3_noun
_play_bean()
{
return u3kf_fork(u3nt(u3nq(c3__atom, 'f', u3_nul, 0),
u3nq(c3__atom, 'f', u3_nul, 1),
u3_nul));
}
static u3_noun
_play_rock(u3_noun odo, u3_noun bob)
{
if ( c3y == u3ud(bob) ) {
return u3nq(c3__atom, u3k(odo), u3_nul, u3k(bob));
}
else return u3nt(c3__cell, _play_rock(odo, u3h(bob)),
_play_rock(odo, u3t(bob)));
}
static u3_noun
_play_sand(u3_noun odo, u3_noun bob)
{
if ( c3y == u3ud(bob) ) {
if ( 'n' == odo ) {
if ( (bob != 0) ) {
return u3m_bail(c3__exit);
} else {
return u3nq(c3__atom, odo, u3_nul, bob);
}
}
if ( 'f' == odo ) {
if ( (bob > 1) ) {
return u3m_bail(c3__exit);
} else {
return _play_bean();
}
}
return u3nt(c3__atom, u3k(odo), u3_nul);
}
else return u3nt(c3__cell, _play_rock(odo, u3h(bob)),
_play_rock(odo, u3t(bob)));
}
static u3_noun
_play_core(u3_noun pac,
u3_noun con)
{
if ( (c3__void == pac) ) {
u3z(con);
return c3__void;
} else {
return u3nt(c3__core, pac, con);
}
}
static u3_noun
_play_loc(u3_noun van,
u3_noun loc)
{
u3_noun mol = u3nc('o', u3k(loc));
u3_noun sho = u3j_hook(u3k(van), "show");
u3_noun ret = u3i_molt(u3k(sho), u3x_sam, u3k(mol), 0);
u3z(mol);
u3z(sho);
return ret;
}
static u3_noun
_play_feel(u3_noun van,
u3_noun sut,
u3_noun rot)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "feel");
return u3n_kick_on(u3i_molt(gat,
u3x_sam,
u3k(rot),
0));
}
#if 0
static u3_noun
_play_loc_term(u3_noun van,
u3_noun loc)
{
u3_noun fop = u3kb_flop(u3k(u3h(loc)));
u3_noun nam = ((0 == fop) ? c3__none : u3k(u3h(fop)));
u3_noun lys = u3nt(u3k(u3h(u3t(loc))), u3k(u3t(u3t(loc))), u3_nul);
u3_noun rup = u3nc(nam, lys);
c3_c* pre_c = u3m_pretty(rup);
u3_noun pro = u3i_string(pre_c);
u3z(fop);
u3z(rup);
free(pre_c);
return pro;
}
#endif
#if 1
static u3_noun
_play_cnts(u3_noun van,
u3_noun sut,
u3_noun hyp,
u3_noun rig)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "epla");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
u3k(hyp),
u3x_sam_3,
u3k(rig),
0));
}
#else
static u3_noun
_play_edit(u3_noun van,
u3_noun sut,
u3_noun mew,
u3_noun rag)
{
while ( 1 ) {
if ( c3n == u3du(mew) ) {
return rag;
} else {
u3_noun i_mew = u3h(mew);
u3_noun t_mew = u3t(mew);
u3_noun pi_mew = u3h(i_mew);
u3_noun qi_mew = u3t(i_mew);
u3_noun laf = _play_in(van, sut, qi_mew);
u3_noun ruz = u3qzu_toss(van, sut, pi_mew, laf, rag);
u3z(laf);
u3z(rag);
rag = u3k(u3t(ruz));
u3z(ruz);
mew = t_mew;
}
}
}
static u3_noun
_play_cnts_old(u3_noun van,
u3_noun sut,
u3_noun hyp,
u3_noun rig)
{
u3_noun lar = u3qzu_seek(van, sut, c3__read, hyp);
u3_noun q_lar = u3t(lar);
u3_noun qq_lar = u3t(q_lar);
u3_noun mew = rig;
u3_noun rag = _play_edit(van, sut, mew, u3k(qq_lar));
u3_noun ret = u3qzu_fire(van, sut, rag);
u3z(rag);
u3z(lar);
return ret;
}
#endif
static u3_noun
_play_grow(u3_noun van,
u3_noun sut,
u3_atom mel,
u3_noun ruf,
u3_noun dom)
{
u3_noun dan = _play_in(van, sut, ruf);
return _play_core(dan,
u3nt(u3nt(u3_nul, c3__dry, u3k(mel)),
u3k(dan),
u3nc(u3nc(u3nc(c3__full, u3_nul), u3_nul),
u3k(dom))));
}
static u3_noun
_play_in(u3_noun van,
u3_noun sut,
u3_noun gen);
static u3_noun
_play_x(u3_noun van,
u3_noun sut,
u3_noun gen)
{
#if 1
return _play_in(van, sut, gen);
#else
u3_noun zix = u3qzu_shep
(van, "gene", 'q', u3k(gen));
u3_noun ret;
u3t_push(u3nc(c3__mean, zix));
ret = _play_in(van, sut, gen);
u3t_drop();
return ret;
#endif
}
static u3_noun
_play_in(u3_noun van,
u3_noun sut,
u3_noun gen)
{
u3_noun p_gen, q_gen, r_gen;
if ( c3n == u3du(gen) ) {
open: {
u3_noun ter = u3r_at(u3x_con_3, van);
u3_noun fab = u3r_at(u3qzu_van_fab, van);
u3_noun rex = u3qzp_open(ter, fab, gen);
u3_noun ret;
if ( c3y == u3r_sing(rex, gen) ) {
u3_noun zix = u3qzu_shep(van, "gene", 'q', u3k(gen));
u3t_push(u3nc(c3__mean, zix));
return u3m_error("play-open-z");
}
ret = _play_x(van, sut, rex);
u3z(rex);
return ret;
}
}
else if ( c3y == u3du(u3h(gen)) ) {
_play_used();
{
u3_noun dis = _play_x(van, sut, u3h(gen));
u3_noun dat = _play_x(van, sut, u3t(gen));
u3_noun ret = u3qz_cell(dis, dat);
u3z(dis);
u3z(dat);
return ret;
}
}
else switch ( u3h(gen) ) {
default: goto open;
case c3__fits: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
return _play_bean();
}
case c3__wtcl: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
_play_used();
{
u3_noun fex = u3qzu_gain(van, sut, p_gen);
u3_noun wux = u3qzu_lose(van, sut, p_gen);
u3_noun dez = (fex == c3__void) ? c3__void
: _play_x(van, fex, q_gen);
u3_noun doz = (wux == c3__void) ? c3__void
: _play_x(van, wux, r_gen);
u3_noun ret = u3qz_forq(dez, doz);
u3z(dez); u3z(doz);
u3z(fex); u3z(wux);
return ret;
}
case c3__clhp: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun dis = _play_x(van, sut, p_gen);
u3_noun dat = _play_x(van, sut, q_gen);
u3_noun ret = u3qz_cell(dis, dat);
u3z(dis);
u3z(dat);
return ret;
}
case c3__dtkt: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun nog = u3nc(c3__bcdt, u3k(p_gen));
u3_noun ret = _play_x(van, sut, nog);
u3z(nog);
return ret;
}
case c3__dtwt: p_gen = u3t(gen);
_play_used();
{
return _play_bean();
}
case c3__dtts: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
return _play_bean();
}
case c3__dtls: p_gen = u3t(gen);
_play_used();
{
return u3nt(c3__atom, u3_blip, u3_nul);
}
case c3__rock: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
return _play_rock(p_gen, q_gen);
}
case c3__dttr: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
return c3__noun;
}
case c3__sand: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
return _play_sand(p_gen, q_gen);
}
case c3__hand: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
return u3k(p_gen);
}
case c3__ktbr: p_gen = u3t(gen);
_play_used();
{
u3_noun boc = _play_x(van, sut, p_gen);
u3_noun pro = u3qzu_wrap(van, boc, c3__iron);
u3z(boc);
return pro;
}
case c3__ktpm: p_gen = u3t(gen);
_play_used();
{
u3_noun boc = _play_x(van, sut, p_gen);
u3_noun pro = u3qzu_wrap(van, boc, c3__zinc);
u3z(boc);
return pro;
}
case c3__ktwt: p_gen = u3t(gen);
_play_used();
{
u3_noun boc = _play_x(van, sut, p_gen);
u3_noun pro = u3qzu_wrap(van, boc, c3__lead);
u3z(boc);
return pro;
}
case c3__note: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun boc = _play_x(van, sut, q_gen);
u3_noun hit = u3nc(u3k(sut), u3k(p_gen));
u3_noun ret = u3qz_hint(hit, boc);
u3z(hit);
u3z(boc);
return ret;
}
case c3__tune: p_gen = u3t(gen);
_play_used();
{
return u3qz_face(p_gen, sut);
}
case c3__ktsg: p_gen = u3t(gen);
_play_used();
{
return _play_x(van, sut, p_gen);
}
case c3__ktls: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
return _play_x(van, sut, p_gen);
}
case c3__tsgr: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun boc = _play_x(van, sut, p_gen);
u3_noun ret = _play_x(van, boc, q_gen);
u3z(boc);
return ret;
}
case c3__tscm: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun boc = u3qzu_busk(van, sut, p_gen);
u3_noun ret = _play_x(van, boc, q_gen);
u3z(boc);
return ret;
}
case c3__cnts: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
return _play_cnts(van, sut, p_gen, q_gen);
}
case c3__brcn: p_gen = u3t(gen);
_play_used();
{
u3_noun ruf = u3nc(u3_nul, 1);
u3_noun ret = _play_grow(van, sut, c3__gold, ruf, p_gen);
u3z(ruf);
return ret;
}
case c3__sgzp: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun typ = u3qzu_play(van, sut, p_gen);
u3_noun dug = u3qzu_duck(van, typ);
u3_noun ret;
u3t_push(u3nc(c3__mean, dug));
{
ret = _play_x(van, sut, q_gen);
}
u3t_drop();
u3z(typ);
return ret;
}
case c3__sggr: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
return _play_x(van, sut, q_gen);
}
case c3__zpts: p_gen = u3t(gen);
_play_used();
{
return c3__noun;
}
case c3__ktcn: p_gen = u3t(gen);
{
u3_noun von = u3i_molt(u3k(van), u3qzu_van_fab, c3n, 0);
u3_noun ret = _play_x(von, sut, p_gen);
u3z(von);
return ret;
}
case c3__zpcm: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
return _play_x(van, sut, p_gen);
}
case c3__dbug: u3x_cell(u3t(gen), &p_gen, &q_gen);
{
u3_noun ret;
#if 0
{
u3_noun cog = _play_loc_term(van, p_gen);
u3t_heck(cog);
u3z(cog);
}
#endif
u3t_push(u3nc(c3__mean, _play_loc(van, p_gen)));
{
ret = _play_x(van, sut, q_gen);
}
u3t_drop();
return ret;
}
case c3__zpmc:
case c3__zpsm: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun zur = _play_x(van, sut, p_gen);
u3_noun vos = _play_x(van, sut, q_gen);
u3_noun ret = u3qz_cell(zur, vos);
u3z(zur);
u3z(vos);
return ret;
}
case c3__zpvt: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
_play_used();
{
if ( c3y == _play_feel(van, sut, p_gen) ) {
return _play_x(van, sut, q_gen);
} else {
return _play_x(van, sut, r_gen);
}
}
case c3__lost:
case c3__fail:
case c3__zpzp:
_play_used();
{
return c3__void;
}
}
}
static u3_noun
_cqzu_play(u3_noun van,
u3_noun sut,
u3_noun gen)
{
u3_noun von = u3i_molt(u3k(van), u3qzu_van_vet, c3n, 0);
u3_noun ret = _play_x(von, sut, gen);
u3z(von);
return ret;
}
/* boilerplate
*/
u3_noun
u3wzu_play(u3_noun cor)
{
u3_noun sut, gen, van;
if ( (c3n == u3r_mean(cor, u3x_sam, &gen, u3x_con, &van, 0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqzu_play(van, sut, gen);
}
}
u3_noun
u3qzu_play(u3_noun van,
u3_noun sut,
u3_noun gen)
{
#if 1
c3_m fun_m = 144 + c3__play;
u3_noun vrf = u3r_at(u3qzu_van_vrf, van);
u3_noun pro = u3z_find_3(fun_m, vrf, sut, gen);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqzu_play(van, sut, gen);
return u3z_save_3(fun_m, vrf, sut, gen, pro);
}
#else
return _cqzu_play(van, sut, gen);
#endif
}

70
jets/z/ut_repo.c Normal file
View File

@ -0,0 +1,70 @@
/* j/6/ut_repo.c
**
*/
#include "all.h"
/* logic
*/
u3_noun
u3qzu_repo(u3_noun van,
u3_noun sut)
{
u3_noun p_sut, q_sut;
if ( c3n == u3du(sut) ) switch ( sut ) {
default: return u3k(sut);
case c3__noun: {
return u3kf_fork(u3nt(u3nt(c3__atom, u3_blip, u3_nul),
u3nt(c3__cell, c3__noun, c3__noun),
u3_nul));
}
}
else switch ( u3h(sut) ) {
default: {
u3m_p("head", u3h(sut));
return u3m_error("repo-flat");
}
case c3__core: {
if ( c3n == u3r_cell(u3t(sut), &p_sut, &q_sut) ) {
return u3m_bail(c3__fail);
} else {
return u3nt(c3__cell, c3__noun, u3k(p_sut));
}
}
case c3__hint:
case c3__face: {
if ( c3n == u3r_cell(u3t(sut), &p_sut, &q_sut)) {
return u3m_bail(c3__fail);
} else {
return u3k(q_sut);
}
}
case c3__hold: {
if ( c3n == u3r_cell(u3t(sut), &p_sut, &q_sut)) {
return u3m_bail(c3__fail);
} else {
u3_noun old = u3nc(u3nc(u3k(p_sut), u3k(q_sut)), u3_nul);
u3_noun ret;
ret = u3qzu_rest(van, sut, old);
u3z(old);
return ret;
}
}
}
}
u3_noun
u3wzu_repo(u3_noun cor)
{
u3_noun sut;
if ( u3_none == (sut = u3r_at(u3x_sam, cor)) ) {
return u3m_bail(c3__fail);
} else {
return u3qzu_repo(cor, sut);
}
}

114
jets/z/ut_rest.c Normal file
View File

@ -0,0 +1,114 @@
/* j/6/ut_rest.c
**
*/
#include "all.h"
/* logic
*/
static u3_noun
_rest_in_list(u3_noun van,
u3_noun leg)
{
if ( u3_nul == leg ) {
return u3_nul;
} else {
u3_noun i_leg = u3h(leg);
u3_noun t_leg = u3t(leg);
return u3nc(u3qzu_play(van, u3h(i_leg), u3t(i_leg)),
_rest_in_list(van, t_leg));
}
}
static u3_noun
_rest_in_stil(u3_noun van,
u3_noun gar)
{
u3_noun gun = u3qdi_gas(u3_nul, gar);
u3_noun yed = u3qdi_tap(gun);
u3z(gun);
return yed;
}
static u3_noun
_rest_in(u3_noun van,
u3_noun leg)
{
u3_noun gar = _rest_in_list(van, leg);
u3_noun yed = _rest_in_stil(van, gar);
u3_noun fub = u3qz_fork(yed);
u3z(gar);
u3z(yed);
return fub;
}
static u3_noun
_rest_hit_fan(u3_noun fan,
u3_noun leg)
{
if ( u3_nul == leg ) {
return c3n;
} else {
return c3o(u3qdi_has(fan, u3h(leg)),
_rest_hit_fan(fan, u3t(leg)));
}
}
static u3_noun
_cqzu_rest(u3_noun van,
u3_noun sut,
u3_noun leg)
{
u3_noun fan = u3r_at(u3qzu_van_fan, van);
if ( c3y == _rest_hit_fan(fan, leg) ) {
return u3m_error("rest-loop");
}
else {
u3_noun naf = u3qdi_gas(fan, leg);
u3_noun nav = u3i_molt(u3k(van), u3qzu_van_fan, u3k(naf), 0);
u3_noun mez = _rest_in(nav, leg);
u3z(naf);
u3z(nav);
return mez;
}
}
/* boilerplate
*/
u3_noun
u3wzu_rest(u3_noun cor)
{
u3_noun sut, leg, van;
if ( (c3n == u3r_mean(cor, u3x_sam, &leg, u3x_con, &van, 0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqzu_rest(van, sut, leg);
}
}
u3_noun
u3qzu_rest(u3_noun van,
u3_noun sut,
u3_noun leg)
{
c3_m fun_m = 144 + c3__rest + ((!!u3r_at(u3qzu_van_vet, van)) << 8);
u3_noun pro = u3z_find_2(fun_m, sut, leg);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqzu_rest(van, sut, leg);
return u3z_save_2(fun_m, sut, leg, pro);
}
}

21
jets/z/ut_tack.c Normal file
View File

@ -0,0 +1,21 @@
/* j/6/tack.c
**
*/
#include "all.h"
u3_noun
u3qzu_tack(u3_noun van,
u3_noun sut,
u3_noun hyp,
u3_noun mur)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "tack");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
u3k(hyp),
u3x_sam_3,
u3k(mur),
0));
}

97
jets/z/ut_toss.c Normal file
View File

@ -0,0 +1,97 @@
/* j/6/toss.c
**
*/
#include "all.h"
/* internals
*/
static u3_noun
_toss_in(u3_noun van,
u3_noun sut,
u3_noun peh,
u3_noun mur,
u3_noun men)
{
if ( c3n == u3du(men) ) {
return u3nc(u3_nul, u3_nul);
}
else {
u3_noun i_men = u3h(men);
u3_noun pi_men = u3h(i_men);
u3_noun qi_men = u3t(i_men);
u3_noun t_men = u3t(men);
u3_noun geq = u3qzu_tack(van, pi_men, peh, mur);
u3_noun p_geq = u3h(geq);
u3_noun q_geq = u3t(geq);
u3_noun mox = _toss_in(van, sut, peh, mur, t_men);
u3_noun p_mox = u3h(mox);
u3_noun q_mox = u3t(mox);
u3_noun ret;
ret = u3nc(
( (u3_nul == p_mox)
? u3nc(u3_nul, u3k(p_geq))
: (c3n == u3r_sing(p_geq, u3t(p_mox)))
? u3m_bail(c3__exit)
: u3k(p_mox) ),
u3nc(u3nc(u3k(q_geq), u3k(qi_men)), u3k(q_mox)));
u3z(mox);
u3z(geq);
return ret;
}
}
/* functions
*/
u3_noun
_cqzu_toss(u3_noun van,
u3_noun sut,
u3_noun peh,
u3_noun mur,
u3_noun men)
{
u3_noun wib = _toss_in(van, sut, peh, mur, men);
u3_noun p_wib = u3h(wib);
u3_noun q_wib = u3t(wib);
if ( u3_nul == p_wib ) {
return u3m_bail(c3__exit);
} else {
u3_noun ret = u3nc(u3k(u3t(p_wib)), u3k(q_wib));
u3z(wib);
return ret;
}
}
/* boilerplate
*/
u3_noun
u3wzu_toss(u3_noun cor)
{
u3_noun van, sut, peh, mur, men;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &peh,
u3x_sam_6, &mur,
u3x_sam_7, &men,
u3x_con, &van,
0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqzu_toss(van, sut, peh, mur, men);
}
}
u3_noun
u3qzu_toss(u3_noun van,
u3_noun sut,
u3_noun peh,
u3_noun mur,
u3_noun men)
{
return _cqzu_toss(van, sut, peh, mur, men);
}

96
jets/z/ut_wrap.c Normal file
View File

@ -0,0 +1,96 @@
/* j/6/wrap.c
**
*/
#include "all.h"
static u3_noun _cqzu_wrap(u3_noun, u3_noun, u3_noun);
static u3_noun
_wrap_fork(u3_noun van, u3_noun p_sut, u3_noun yoz)
{
if ( u3_nul == p_sut ) {
return u3_nul;
}
else {
return u3nc(_cqzu_wrap(van, u3h(p_sut), yoz),
_wrap_fork(van, u3t(p_sut), yoz));
}
}
static u3_noun
_cqzu_wrap(u3_noun van,
u3_noun sut,
u3_noun yoz)
{
u3_noun p_sut, q_sut;
if ( c3n == u3du(sut) ) {
return u3m_error("wrap-type");
}
else switch ( u3h(sut) ) {
default: return u3m_error("wrap-type");
case c3__core: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3_noun pq_sut, qq_sut, rq_sut;
u3_noun ppq_sut, qpq_sut, rpq_sut;
if ( c3n == u3r_trel(q_sut, &pq_sut, &qq_sut, &rq_sut) ) {
return u3m_bail(c3__fail);
}
if ( c3n == u3r_trel(pq_sut, &ppq_sut, &qpq_sut, &rpq_sut) ) {
return u3m_bail(c3__fail);
}
else if ( c3__gold != rpq_sut ) {
return u3m_error("wrap-gold");
}
else {
return u3nt(c3__core,
u3k(p_sut),
u3nt(u3nt(u3k(ppq_sut), u3k(qpq_sut), u3k(yoz)),
u3k(qq_sut),
u3k(rq_sut)));
}
}
case c3__fork: p_sut = u3t(sut);
{
u3_noun yed = u3qdi_tap(p_sut);
u3_noun ret = u3kf_fork(_wrap_fork(van, yed, yoz));
u3z(yed);
return ret;
}
case c3__hold:
{
u3_noun fop = u3qzu_repo(van, sut);
u3_noun pro = _cqzu_wrap(van, fop, yoz);
u3z(fop);
return pro;
}
}
}
/* boilerplate
*/
u3_noun
u3wzu_wrap(u3_noun cor)
{
u3_noun sut, yoz, van;
if ( (c3n == u3r_mean(cor, u3x_sam, &yoz, u3x_con, &van, 0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqzu_wrap(van, sut, yoz);
}
}
u3_noun
u3qzu_wrap(u3_noun van,
u3_noun sut,
u3_noun yoz)
{
return _cqzu_wrap(van, sut, yoz);
}

View File

@ -133,8 +133,8 @@ jets_e_ed_src = [
'jets/e/ed_sign.c',
'jets/e/ed_veri.c',
'jets/e/ed_shar.c'
]
jets_f_src = [
'jets/f/ap.c',
'jets/f/cell.c',
@ -147,7 +147,7 @@ jets_f_src = [
'jets/f/flip.c',
'jets/f/flor.c',
'jets/f/fork.c',
'jets/f/help.c',
'jets/f/hint.c',
'jets/f/hike.c',
'jets/f/look.c',
'jets/f/loot.c'
@ -155,9 +155,7 @@ jets_f_src = [
jets_f_ut_src = [
'jets/f/ut.c',
'jets/f/ut_burn.c',
'jets/f/ut_buss.c',
'jets/f/ut_conk.c',
'jets/f/ut_crop.c',
'jets/f/ut_find.c',
'jets/f/ut_fire.c',
@ -178,6 +176,47 @@ jets_f_ut_src = [
'jets/f/ut_wrap.c'
]
jets_z_src = [
'jets/z/ap.c',
'jets/z/cell.c',
'jets/z/comb.c',
'jets/z/cons.c',
'jets/z/core.c',
'jets/z/face.c',
'jets/z/fitz.c',
'jets/z/flan.c',
'jets/z/flip.c',
'jets/z/flor.c',
'jets/z/fork.c',
'jets/z/hint.c',
'jets/z/hike.c',
'jets/z/look.c',
'jets/z/loot.c'
]
jets_z_ut_src = [
'jets/z/ut.c',
'jets/z/ut_buss.c',
'jets/z/ut_crop.c',
'jets/z/ut_find.c',
'jets/z/ut_fire.c',
'jets/z/ut_fish.c',
'jets/z/ut_fuse.c',
'jets/z/ut_gain.c',
'jets/z/ut_lose.c',
'jets/z/ut_mint.c',
'jets/z/ut_mull.c',
'jets/z/ut_nest.c',
'jets/z/ut_peek.c',
'jets/z/ut_peel.c',
'jets/z/ut_play.c',
'jets/z/ut_repo.c',
'jets/z/ut_rest.c',
'jets/z/ut_tack.c',
'jets/z/ut_toss.c',
'jets/z/ut_wrap.c'
]
jets_g_src = [
'jets/g/down.c'
]
@ -217,7 +256,9 @@ src_list = [
vere_src, noun_src,
jets_a_src, jets_b_src,
jets_c_src, jets_d_src,
jets_e_src, jets_e_ed_src, jets_f_src, jets_f_ut_src,
jets_e_src, jets_e_ed_src,
jets_f_src, jets_f_ut_src,
jets_z_src, jets_z_ut_src,
jets_g_src, jets_src]
sources = []
@ -250,7 +291,7 @@ if osdet == 'linux'
elif osdet == 'darwin'
conf_data.set('U3_OS_osx', true)
os_c_flags = os_c_flags + ['-bind_at_load']
# os_c_flags = os_c_flags + ['-bind_at_load']
# os_link_flags = ['-framework CoreServices', '-framework CoreFoundation']
if(legacy_meson)
ncurses_dep = find_library('ncurses')
@ -314,6 +355,8 @@ libh2o_dep = dependency('libh2o', version: '>=0.13.3', fallback: ['libh2o', 'lib
argon2_dep = dependency('argon2', version: '>=1', fallback: ['argon2', 'argon2_dep'])
secp256k1_dep = dependency('libsecp256k1', version: '>=0.1.0', fallback: ['secp256k1', 'secp256k1_dep'])
libsni_dep = dependency('libsni', version: '>=0.5.0', fallback: ['libsni', 'libsni_dep'])
executable('urbit',
sources : sources,
include_directories : incdir,
@ -331,5 +374,6 @@ dependencies: [openssl_dep,
ed25519_dep,
murmur3_dep,
argon2_dep,
softfloat3_dep] + os_deps,
softfloat3_dep,
libsni_dep] + os_deps,
install: true)

View File

@ -334,6 +334,7 @@ u3i_list(u3_weak one, ...);
return cut_t ? cut_w : i_w;
}
__attribute__((no_sanitize("address")))
static u3_noun // transfer
_molt_apply(u3_noun som, // retain
c3_w len_w,
@ -358,6 +359,8 @@ u3i_list(u3_weak one, ...);
}
}
}
__attribute__((no_sanitize("address")))
u3_noun
u3i_molt(u3_noun som, ...)
{

View File

@ -5,7 +5,8 @@
/* _cj_count(): count and link dashboard entries.
*/
static c3_w
__attribute__((no_sanitize("address")))
static c3_w
_cj_count(u3j_core* par_u, u3j_core* dev_u)
{
c3_w len_l = 0;
@ -23,6 +24,7 @@
}
/* _cj_install(): install dashboard entries.
*/
__attribute__((no_sanitize("address")))
static c3_w
_cj_install(u3j_core* ray_u, c3_w jax_l, u3j_core* dev_u)
{
@ -268,6 +270,7 @@ _cj_warm_hump(c3_l jax_l, u3_noun huc)
**
** XX bat is used only for printing, remove.
*/
__attribute__((no_sanitize("address")))
static c3_l
_cj_hot_mean(c3_l par_l, u3_noun mop, u3_noun bat)
{
@ -382,11 +385,11 @@ _cj_kick_z(u3_noun cor, u3j_core* cop_u, u3j_harm* ham_u, u3_atom axe)
c3_w cod_w;
{
char soc_c[6];
char soc_c[5];
memset(soc_c, 0, 6);
strncpy(soc_c, cop_u->cos_c, 5);
soc_c[5] = 0;
memset(soc_c, 0, 5);
strncpy(soc_c, cop_u->cos_c, 4);
soc_c[4] = 0;
cod_w = u3i_string(soc_c);
cod_w = u3a_lush(cod_w);

View File

@ -187,6 +187,7 @@ _cm_signal_reset(void)
u3R->kid_p = 0;
}
#if 0
/* _cm_stack_recover(): recover stack trace, with lacunae.
*/
static u3_noun
@ -227,6 +228,25 @@ _cm_stack_recover(u3a_road* rod_u)
}
}
}
#endif
/* _cm_stack_unwind(): unwind to the top level, preserving all frames.
*/
static u3_noun
_cm_stack_unwind(void)
{
u3_noun tax;
while ( u3R != &(u3H->rod_u) ) {
u3_noun yat = u3m_love(u3R->bug.tax);
u3R->bug.tax = u3kb_weld(yat, u3R->bug.tax);
}
tax = u3R->bug.tax;
u3R->bug.tax = 0;
return tax;
}
/* _cm_signal_recover(): recover from a deep signal, after longjmp. Free arg.
*/
@ -268,6 +288,7 @@ _cm_signal_recover(c3_l sig_l, u3_noun arg)
//
_cm_emergency("recover: dig", sig_l);
#if 0
// Descend to the innermost trace, collecting stack.
//
{
@ -285,7 +306,9 @@ _cm_signal_recover(c3_l sig_l, u3_noun arg)
rod_u = u3to(u3_road, rod_u->kid_p);
}
}
#else
tax = _cm_stack_unwind();
#endif
pro = u3nt(3, sig_l, tax);
_cm_signal_reset();

View File

@ -155,6 +155,7 @@ u3r_at(u3_atom a, u3_noun b)
}
}
__attribute__((no_sanitize("address")))
c3_o
u3r_mean(u3_noun som,
...)

View File

@ -82,6 +82,9 @@ u3t_slog(u3_noun hod)
void
u3t_heck(u3_atom cog)
{
#if 0
u3R->pro.cel_d++;
#else
c3_w len_w = u3r_met(3, cog);
c3_c* str_c = alloca(1 + len_w);
@ -104,6 +107,7 @@ u3t_heck(u3_atom cog)
}
u3R = rod_u;
}
#endif
}
/* _t_jet_label():
@ -257,7 +261,9 @@ u3t_samp(void)
c3_assert(u3R == &u3H->rod_u);
if ( 0 == u3R->pro.day ) {
u3R->pro.day = u3v_do("doss", 0);
/* bunt a +doss
*/
u3R->pro.day = u3nt(u3nq(0, 0, 0, u3nq(0, 0, 0, 0)), 0, 0);
}
u3R->pro.day = u3dt("pi-noon", mot_l, lab, u3R->pro.day);
}
@ -346,7 +352,9 @@ u3t_damp(void)
u3_noun wol = u3do("pi-tell", u3R->pro.day);
u3_term_wall(wol);
u3R->pro.day = u3v_do("doss", 0);
/* bunt a +doss
*/
u3R->pro.day = u3nt(u3nq(0, 0, 0, u3nq(0, 0, 0, 0)), 0, 0);
}
u3t_print_steps("nocks", u3R->pro.nox_d);

@ -1 +1 @@
Subproject commit e1e0fa353fc0051c8bb7e5b748917c4ebe76609e
Subproject commit 41958a8aedb3aa2a85332bc8ac0ac389aa725a09

1
subprojects/libsni Submodule

@ -0,0 +1 @@
Subproject commit a59901c38a67660039ee93a6170a338634d76ec0

View File

@ -22,18 +22,6 @@
#include "all.h"
#include "vere/vere.h"
/* u3_pact: ames packet struct.
*/
typedef struct {
uv_udp_send_t snd_u;
c3_y* buf_y;
c3_w len_w;
c3_s por_s;
c3_w pip_w;
c3_y imp_y;
c3_c* dns_c;
} u3_pact;
/* _ames_alloc(): libuv buffer allocator.
*/
static void
@ -60,7 +48,7 @@ _ames_free(void* ptr_v)
static void
_ames_pact_free(u3_pact* pac_u)
{
free(pac_u->buf_y);
free(pac_u->hun_y);
free(pac_u->dns_c);
free(pac_u);
}
@ -88,7 +76,7 @@ _ames_send(u3_pact* pac_u)
{
u3_ames* sam_u = &u3_Host.sam_u;
if ( !pac_u->buf_y ) {
if ( !pac_u->hun_y ) {
_ames_pact_free(pac_u);
return;
}
@ -100,7 +88,7 @@ _ames_send(u3_pact* pac_u)
add_u.sin_addr.s_addr = htonl(pac_u->pip_w);
add_u.sin_port = htons(pac_u->por_s);
uv_buf_t buf_u = uv_buf_init((c3_c*)pac_u->buf_y, pac_u->len_w);
uv_buf_t buf_u = uv_buf_init((c3_c*)pac_u->hun_y, pac_u->len_w);
c3_i sas_i;
@ -222,6 +210,7 @@ _ames_czar(u3_pact* pac_u, c3_c* bos_c)
(now - sam_u->imp_t[pac_u->imp_y]) > 300 ) { /* 5 minute TTL */
u3_noun nam = u3dc("scot", 'p', pac_u->imp_y);
c3_c* nam_c = u3r_string(nam);
// XX remove extra byte for '~'
pac_u->dns_c = c3_malloc(1 + strlen(bos_c) + 1 + strlen(nam_c));
snprintf(pac_u->dns_c, 256, "%s.%s", nam_c + 1, bos_c);
@ -302,9 +291,9 @@ u3_ames_ef_send(u3_noun lan, u3_noun pac)
if ( c3y == _ames_lane_ip(lan, &pac_u->por_s, &pac_u->pip_w) ) {
pac_u->len_w = u3r_met(3, pac);
pac_u->buf_y = c3_malloc(pac_u->len_w);
pac_u->hun_y = c3_malloc(pac_u->len_w);
u3r_bytes(0, pac_u->len_w, pac_u->buf_y, pac);
u3r_bytes(0, pac_u->len_w, pac_u->hun_y, pac);
if ( 0 == pac_u->pip_w ) {
pac_u->pip_w = 0x7f000001;
@ -477,6 +466,7 @@ u3_ames_io_exit()
{
u3_ames* sam_u = &u3_Host.sam_u;
// XX close wax_u instead
uv_close(&sam_u->had_u, 0);
}

View File

@ -482,6 +482,10 @@ static void
_cttp_creq_link(u3_creq* ceq_u)
{
ceq_u->nex_u = u3_Host.ctp_u.ceq_u;
if ( 0 != ceq_u->nex_u ) {
ceq_u->nex_u->pre_u = ceq_u;
}
u3_Host.ctp_u.ceq_u = ceq_u;
}
@ -492,9 +496,17 @@ _cttp_creq_unlink(u3_creq* ceq_u)
{
if ( ceq_u->pre_u ) {
ceq_u->pre_u->nex_u = ceq_u->nex_u;
if ( 0 != ceq_u->nex_u ) {
ceq_u->nex_u->pre_u = ceq_u->pre_u;
}
}
else {
u3_Host.ctp_u.ceq_u = ceq_u->nex_u;
if ( 0 != ceq_u->nex_u ) {
ceq_u->nex_u->pre_u = 0;
}
}
}
@ -829,21 +841,22 @@ _cttp_creq_resolve_cb(uv_getaddrinfo_t* adr_u,
u3_creq* ceq_u = adr_u->data;
if ( u3_csat_quit == ceq_u->sat_e ) {
return _cttp_creq_quit(ceq_u);;
_cttp_creq_quit(ceq_u);;
}
if ( 0 != sas_i ) {
return _cttp_creq_fail(ceq_u, uv_strerror(sas_i));
else if ( 0 != sas_i ) {
_cttp_creq_fail(ceq_u, uv_strerror(sas_i));
}
else {
// XX traverse struct a la _ames_czar_cb
ceq_u->ipf_w = ntohl(((struct sockaddr_in *)aif_u->ai_addr)->sin_addr.s_addr);
ceq_u->ipf_c = _cttp_creq_ip(ceq_u->ipf_w);
ceq_u->ipf_w = ntohl(((struct sockaddr_in *)aif_u->ai_addr)->sin_addr.s_addr);
ceq_u->ipf_c = _cttp_creq_ip(ceq_u->ipf_w);
ceq_u->sat_e = u3_csat_ripe;
_cttp_creq_connect(ceq_u);
}
free(adr_u);
uv_freeaddrinfo(aif_u);
ceq_u->sat_e = u3_csat_ripe;
_cttp_creq_connect(ceq_u);
}
/* _cttp_creq_resolve(): resolve hostname to IP address
@ -864,6 +877,7 @@ _cttp_creq_resolve(u3_creq* ceq_u)
hin_u.ai_socktype = SOCK_STREAM;
hin_u.ai_protocol = IPPROTO_TCP;
// XX is this necessary?
c3_c* por_c = ceq_u->por_c ? ceq_u->por_c :
( c3y == ceq_u->sec ) ? "443" : "80";
@ -920,8 +934,7 @@ _cttp_init_h2o()
{
h2o_timeout_t* tim_u = c3_malloc(sizeof(*tim_u));
// XX how long? 1 minute?
h2o_timeout_init(u3L, tim_u, 10000);
h2o_timeout_init(u3L, tim_u, 120 * 1000);
h2o_http1client_ctx_t* ctx_u = c3_calloc(sizeof(*ctx_u));
ctx_u->loop = u3L;

File diff suppressed because it is too large Load Diff

View File

@ -136,6 +136,22 @@ _reck_kick_http(u3_noun pox,
else switch ( u3h(fav) ) {
default: u3z(pox); u3z(fav); return c3n;
case c3__form: p_fav = u3t(fav);
{
u3_http_ef_form(u3k(p_fav));
u3z(pox); u3z(fav);
return c3y;
}
case c3__that: p_fav = u3t(fav);
{
u3_http_ef_that(u3k(p_fav));
u3z(pox); u3z(fav);
return c3y;
}
case c3__thus: p_fav = u3h(u3t(fav)); q_fav = u3t(u3t(fav));
{
u3_cttp_ef_thus(u3r_word(0, p_fav), u3k(q_fav));

View File

@ -21,19 +21,11 @@
#include "vere/vere.h"
static void _term_spinner_cb(void*);
static void _term_read_tn_cb(uv_stream_t* tcp_u,
ssize_t siz_i,
const uv_buf_t * buf_u);
static void _term_read_cb(uv_stream_t* tcp_u,
ssize_t siz_i,
const uv_buf_t * buf_u);
static inline void _term_suck(u3_utty*, const c3_y*, ssize_t);
#define _T_ECHO 1 // local echo
#define _T_CTIM 3 // suppress GA/char-at-a-time
#define _T_NAWS 31 // negotiate about window size
#define _SPIN_COOL_US 500000 // spinner activation delay when cool
#define _SPIN_WARM_US 50000 // spinner activation delay when warm
#define _SPIN_RATE_US 250000 // spinner rate (microseconds/frame)