shrub/j/f/ut_mull.c

871 lines
22 KiB
C
Raw Normal View History

2013-09-29 00:21:18 +04:00
/* j/6/mull.c
**
** This file is in the public domain.
*/
#include "all.h"
2014-09-04 07:10:43 +04:00
2013-09-29 00:21:18 +04:00
/* functions
*/
2014-09-06 00:13:24 +04:00
static u3_noun
_mull_in(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
2013-09-29 00:21:18 +04:00
2014-11-06 06:10:22 +03:00
static u3_noun
2014-08-21 01:18:34 +04:00
_mull_vet(
2014-09-06 00:13:24 +04:00
u3_noun van)
2013-09-29 00:21:18 +04:00
{
2014-11-06 06:10:22 +03:00
// u3_noun vet = u3j_hook(u3k(van), "vet");
2014-11-06 22:13:57 +03:00
u3_noun vet = u3r_at(u3qfu_van_vet, van);
2013-09-29 00:21:18 +04:00
switch ( vet ) {
2014-11-05 04:18:47 +03:00
case c3n:
case c3y: return vet;
2014-11-06 03:20:01 +03:00
default: return u3m_bail(c3__fail);
2013-09-29 00:21:18 +04:00
}
}
2014-09-06 00:13:24 +04:00
static u3_noun
2014-08-21 01:18:34 +04:00
_mull_core(
2014-09-06 00:13:24 +04:00
u3_noun pac,
u3_noun con)
2013-09-29 00:21:18 +04:00
{
if ( (c3__void == pac) ) {
return c3__void;
} else {
2014-09-06 00:13:24 +04:00
return u3nt(c3__core, pac, con);
2013-09-29 00:21:18 +04:00
}
}
2014-09-06 00:13:24 +04:00
static u3_noun
2014-08-21 01:18:34 +04:00
_mull_bean()
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
return u3nt(c3__fork,
u3nq(c3__cube, 0, c3__atom, 'f'),
u3nq(c3__cube, 1, c3__atom, 'f'));
2013-09-29 00:21:18 +04:00
}
2014-09-06 00:13:24 +04:00
static u3_noun
2014-08-21 01:18:34 +04:00
_mull_loc(
2014-09-06 00:13:24 +04:00
u3_noun van,
u3_noun loc)
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun mol = u3nc('o', u3k(loc));
2014-11-06 03:20:01 +03:00
u3_noun sho = u3j_hook(u3k(van), "show");
2014-11-18 00:56:51 +03:00
u3_noun ret = u3i_molt(u3k(sho), u3x_sam, u3k(mol), 0);
2014-09-06 00:13:24 +04:00
u3z(mol);
u3z(sho);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-09-06 00:13:24 +04:00
static u3_noun
2014-08-21 01:18:34 +04:00
_mull_foil(
2014-09-06 00:13:24 +04:00
u3_noun pok)
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun p_pok = u3h(pok);
u3_noun q_pok = u3t(pok);
u3_noun ret;
2014-11-05 04:18:47 +03:00
if ( c3y == u3h(q_pok) ) {
2014-09-06 00:13:24 +04:00
u3_noun pq_pok = u3t(q_pok);
ret = u3nc(
u3k(p_pok),
u3nc(u3_nul,
u3nc(
u3nc(
u3k(pq_pok),
u3nt(c3__elm, u3_nul, 1)),
u3_nul)));
2013-09-29 00:21:18 +04:00
}
else {
2014-09-06 00:13:24 +04:00
u3_noun pq_pok = u3h(u3t(q_pok));
u3_noun qq_pok = u3t(u3t(q_pok));
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
ret = u3nc(u3k(p_pok),
u3nc(u3k(pq_pok),
u3k(qq_pok)));
2013-09-29 00:21:18 +04:00
}
2014-09-06 00:13:24 +04:00
u3z(pok);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-09-06 00:13:24 +04:00
static u3_noun
2014-08-21 01:18:34 +04:00
_mull_coke(
2014-09-06 00:13:24 +04:00
u3_noun nug)
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_atom axe;
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
if ( 0 == u3h(nug) ) {
axe = u3t(nug);
} else if ( 10 == u3h(nug) ) {
u3_noun xin = u3k(u3t(u3t(nug)));
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
axe = _mull_coke(xin);
2013-09-29 00:21:18 +04:00
}
else {
2014-11-06 03:20:01 +03:00
return u3m_error("mint-coke");
2013-09-29 00:21:18 +04:00
}
2014-09-06 00:13:24 +04:00
u3z(nug);
2013-09-29 00:21:18 +04:00
return axe;
}
2014-09-06 00:13:24 +04:00
static u3_noun
2014-08-21 01:18:34 +04:00
_mull_doke(
2014-09-06 00:13:24 +04:00
u3_noun van,
u3_noun sut,
u3_noun gen)
2013-09-29 00:21:18 +04:00
{
2014-11-06 22:13:57 +03:00
u3_noun fug = u3qfu_mint(van, sut, c3__noun, gen);
2014-09-06 00:13:24 +04:00
u3_noun axe = _mull_coke(u3k(u3t(fug)));
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3z(fug);
2013-09-29 00:21:18 +04:00
return axe;
}
2014-09-06 00:13:24 +04:00
static u3_noun
2014-08-21 01:18:34 +04:00
_mull_nice(
2014-09-06 00:13:24 +04:00
u3_noun van,
u3_noun gol,
u3_noun typ)
2013-09-29 00:21:18 +04:00
{
2014-11-06 22:13:57 +03:00
if ( c3n == u3qfu_nest(van, gol, c3y, typ) ) {
// u3_noun dun = u3qfu_dunq(van, "need", gol);
// u3_noun niz = u3qfu_dunq(van, "have", typ);
2013-09-29 00:21:18 +04:00
2014-11-06 03:20:01 +03:00
// u3t_push(u3nc(c3__mean, dun));
// u3t_push(u3nc(c3__mean, niz));
2013-09-29 00:21:18 +04:00
2014-11-06 03:20:01 +03:00
return u3m_error("mull-nice");
2013-09-29 00:21:18 +04:00
}
else return typ;
}
static void
2014-08-21 01:18:34 +04:00
_mull_bake(
2014-09-06 00:13:24 +04:00
u3_noun van,
u3_noun sut,
u3_noun dox,
u3_noun dab)
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
if ( u3_nul != dab ) {
u3_noun n_dab, l_dab, r_dab;
2014-11-06 03:20:01 +03:00
u3r_trel(dab, &n_dab, &l_dab, &r_dab);
2014-11-05 04:18:47 +03:00
if ( c3n == u3du(n_dab) ) {
2014-11-06 03:20:01 +03:00
u3m_bail(c3__fail);
}
2013-09-29 00:21:18 +04:00
else {
2014-09-06 00:13:24 +04:00
u3_noun qn_dab = u3t(n_dab);
u3_noun vad;
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
switch ( u3h(qn_dab) ) {
2014-11-06 03:20:01 +03:00
default: u3m_bail(c3__exit);
2013-09-29 00:21:18 +04:00
case c3__ash: {
2014-09-06 00:13:24 +04:00
vad = _mull_in(van, sut, c3__noun, dox, u3t(qn_dab));
2013-09-29 00:21:18 +04:00
break;
}
case c3__elm: {
2014-09-06 00:13:24 +04:00
vad = u3_nul;
2013-09-29 00:21:18 +04:00
break;
}
}
2014-09-06 00:13:24 +04:00
u3z(vad);
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
if ( (u3_nul == l_dab) && (u3_nul == r_dab) ) {
2013-09-29 00:21:18 +04:00
return;
}
2014-09-06 00:13:24 +04:00
else if ( (u3_nul == l_dab) ) {
2014-08-21 01:18:34 +04:00
_mull_bake(van, sut, dox, r_dab);
2013-09-29 00:21:18 +04:00
}
2014-09-06 00:13:24 +04:00
else if ( (u3_nul == r_dab) ) {
2014-08-21 01:18:34 +04:00
_mull_bake(van, sut, dox, l_dab);
2013-09-29 00:21:18 +04:00
}
else {
2014-08-21 01:18:34 +04:00
_mull_bake(van, sut, dox, l_dab);
_mull_bake(van, sut, dox, r_dab);
2013-09-29 00:21:18 +04:00
}
}
}
}
2014-09-06 00:13:24 +04:00
static u3_noun
2014-08-21 01:18:34 +04:00
_mull_grow(
2014-09-06 00:13:24 +04:00
u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun dox,
u3_atom mel,
u3_noun ruf,
u3_noun dab)
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
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),
u3nt(c3__gold,
u3k(p_dan),
u3nc(u3_nul, u3k(dab))));
u3_noun q_toc = _mull_core
(u3k(q_dan),
u3nt(c3__gold,
u3k(q_dan),
u3nc(u3_nul, u3k(dab))));
u3_noun p_ret = _mull_core
(u3k(p_dan),
u3nt(u3k(mel),
u3k(p_dan),
u3nc(u3nc(u3_nul, u3_nul),
u3k(dab))));
u3_noun q_ret = _mull_core
(u3k(q_dan),
u3nt(u3k(mel),
u3k(q_dan),
u3nc(u3nc(u3_nul, u3_nul),
u3k(dab))));
u3_noun ret = u3nc(_mull_nice(van, gol, p_ret), q_ret);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
_mull_bake(van, p_toc, q_toc, dab);
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3z(q_toc);
u3z(p_toc);
u3z(dan);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-09-06 00:13:24 +04:00
static u3_noun
2014-08-21 01:18:34 +04:00
_mull_both(
2014-09-06 00:13:24 +04:00
u3_noun van,
u3_noun gol,
u3_noun typ)
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
return u3nc(_mull_nice(van, gol, u3k(typ)),
2013-09-29 00:21:18 +04:00
typ);
}
2014-09-06 00:13:24 +04:00
static u3_noun
2014-08-21 01:18:34 +04:00
_mull_edit(
2014-09-06 00:13:24 +04:00
u3_noun van,
u3_noun sut,
u3_noun dox,
u3_noun mew,
u3_noun p_yom,
u3_noun q_yom)
2013-09-29 00:21:18 +04:00
{
while ( 1 ) {
2014-11-05 04:18:47 +03:00
if ( c3n == u3du(mew) ) {
2014-09-06 00:13:24 +04:00
return u3nc(p_yom, q_yom);
2013-09-29 00:21:18 +04:00
} else {
2014-09-06 00:13:24 +04:00
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);
2014-11-06 22:13:57 +03:00
u3_noun cuf = u3qfu_tock
2014-08-21 01:18:34 +04:00
(van, sut, pi_mew, p_zil, p_yom);
2014-11-06 22:13:57 +03:00
u3_noun dof = u3qfu_tock
2014-08-21 01:18:34 +04:00
(van, sut, pi_mew, q_zil, q_yom);
2013-09-29 00:21:18 +04:00
2014-11-06 03:20:01 +03:00
if ( u3r_sing(u3h(cuf), u3h(dof)) ) {
u3m_error("mull-bonk-a");
2013-11-12 11:09:11 +04:00
}
2014-09-06 00:13:24 +04:00
u3z(p_yom);
p_yom = u3k(u3t(cuf));
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3z(q_yom);
q_yom = u3k(u3t(dof));
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3z(dof);
u3z(cuf);
u3z(zil);
2013-09-29 00:21:18 +04:00
mew = t_mew;
}
}
}
2014-08-21 01:18:34 +04:00
# define _mull_used()
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
static u3_noun
2014-08-21 01:18:34 +04:00
_mull_in(
2014-09-06 00:13:24 +04:00
u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun dox,
u3_noun gen)
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun p_gen, q_gen, r_gen;
u3_noun ret;
2013-09-29 00:21:18 +04:00
2014-11-05 04:18:47 +03:00
if ( c3n == u3du(gen) ) {
2014-11-18 00:56:51 +03:00
u3_noun ter = u3r_at(u3x_con_3, van);
2014-11-06 22:13:57 +03:00
u3_noun rex = u3qfp_open(ter, gen);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
ret = _mull_in(van, sut, gol, dox, rex);
2014-09-06 00:13:24 +04:00
u3z(rex);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-11-05 04:18:47 +03:00
else if ( c3y == u3du(u3h(gen)) ) {
2014-08-21 01:18:34 +04:00
_mull_used();
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun hed = _mull_in(van, sut, c3__noun, dox, u3h(gen));
u3_noun tal = _mull_in(van, sut, c3__noun, dox, u3t(gen));
2014-11-06 22:13:57 +03:00
u3_noun dis = u3qf_cell(u3h(hed), u3h(tal));
u3_noun dat = u3qf_cell(u3t(hed), u3t(tal));
2014-09-06 00:13:24 +04:00
u3_noun ret = u3nc(_mull_nice(van, gol, dis), dat);
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3z(tal);
u3z(hed);
2013-09-29 00:21:18 +04:00
return ret;
}
}
2014-09-06 00:13:24 +04:00
else switch ( u3h(gen) ) {
2013-09-29 00:21:18 +04:00
default: {
2014-11-18 00:56:51 +03:00
u3_noun ter = u3r_at(u3x_con_3, van);
2014-11-06 22:13:57 +03:00
u3_noun rex = u3qfp_open(ter, gen);
2013-09-29 00:21:18 +04:00
2014-11-06 03:20:01 +03:00
if ( c3y == u3r_sing(rex, gen) ) {
2013-09-29 00:21:18 +04:00
#if 1
2014-11-06 22:13:57 +03:00
u3_noun zix = u3qfu_shep
2014-09-06 00:13:24 +04:00
(van, "gene", 'q', u3k(gen));
2013-09-29 00:21:18 +04:00
2014-11-06 03:20:01 +03:00
u3t_push(u3nc(c3__mean, zix));
return u3m_error("mull-open");
2013-09-29 00:21:18 +04:00
#else
2014-09-06 00:13:24 +04:00
u3_err("h", u3h(gen));
2014-11-06 03:20:01 +03:00
return u3m_bail(c3__fail);
2013-09-29 00:21:18 +04:00
#endif
}
2014-08-21 01:18:34 +04:00
ret = _mull_in(van, sut, gol, dox, rex);
2014-09-06 00:13:24 +04:00
u3z(rex);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-11-06 03:20:01 +03:00
case c3__bcpt: u3x_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_mull_used();
2014-01-04 11:28:16 +04:00
{
2014-11-06 22:13:57 +03:00
u3_noun sep = u3qfu_seep(van, sut, c3__read, p_gen);
u3_noun pox = u3qfu_seep(van, dox, c3__read, p_gen);
2014-09-06 00:13:24 +04:00
u3_noun axe = u3h(sep);
2014-01-04 11:28:16 +04:00
2014-09-06 00:13:24 +04:00
if ( axe != u3h(pox) ) {
2014-11-06 03:20:01 +03:00
return u3m_error("mull-bonk-wing");
2014-01-04 11:28:16 +04:00
}
else {
2014-11-06 22:13:57 +03:00
u3_noun rex = u3qfl_whip(van, q_gen, axe);
2014-09-06 00:13:24 +04:00
u3_noun ret = _mull_in(van, sut, gol, dox, rex);
2014-01-04 11:28:16 +04:00
2014-09-06 00:13:24 +04:00
u3z(sep);
u3z(pox);
u3z(rex);
2014-01-04 11:28:16 +04:00
return ret;
}
}
2014-11-06 03:20:01 +03:00
case c3__wtts: u3x_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_mull_used();
2013-09-29 00:21:18 +04:00
{
2014-11-06 22:13:57 +03:00
u3_noun nob = u3qfl_bunt(van, p_gen);
u3_noun p_waz = u3qfu_play(van, sut, nob);
u3_noun q_waz = u3qfu_play(van, dox, nob);
2014-10-09 02:16:24 +04:00
u3_noun dok = u3nc(c3__cnzz, u3k(q_gen));
2014-09-06 00:13:24 +04:00
u3_noun p_syx = _mull_doke(van, sut, dok);
u3_noun q_syx = _mull_doke(van, dox, dok);
2014-11-06 22:13:57 +03:00
u3_noun p_pov = u3qfu_fish(van, p_waz, p_syx);
u3_noun q_pov = u3qfu_fish(van, q_waz, q_syx);
2013-09-29 00:21:18 +04:00
2014-11-06 03:20:01 +03:00
if ( (c3n == u3r_sing(p_syx, q_syx)) ||
(c3n == u3r_sing(p_pov, q_pov)) )
2013-09-29 00:21:18 +04:00
{
2014-11-06 03:20:01 +03:00
return u3m_error("mull-bonk-b");
2013-09-29 00:21:18 +04:00
}
2014-09-06 00:13:24 +04:00
u3z(p_waz); u3z(q_waz);
u3z(p_syx); u3z(q_syx);
u3z(p_pov); u3z(q_pov);
u3z(nob);
u3z(dok);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
return _mull_both(van, gol, _mull_bean());
2013-12-27 06:43:25 +04:00
}
2014-01-01 00:11:16 +04:00
2014-11-06 03:20:01 +03:00
case c3__wtcl: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
2014-08-21 01:18:34 +04:00
_mull_used();
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun bol = _mull_bean();
u3_noun nor = _mull_in(van, sut, bol, dox, p_gen);
2014-11-06 22:13:57 +03:00
u3_noun p_fex = u3qfu_gain(van, sut, p_gen);
u3_noun q_fex = u3qfu_gain(van, dox, p_gen);
u3_noun p_wux = u3qfu_lose(van, sut, p_gen);
u3_noun q_wux = u3qfu_lose(van, dox, p_gen);
2014-09-06 00:13:24 +04:00
u3_noun hiq, ran;
u3_noun dis, dat;
u3_noun ret;
2013-09-29 00:21:18 +04:00
if ( c3__void == p_fex ) {
2014-09-06 00:13:24 +04:00
hiq = u3nc(
c3__void,
2013-09-29 00:21:18 +04:00
(c3__void == q_fex)
? c3__void
2014-11-06 22:13:57 +03:00
: u3qfu_play(van, q_fex, q_gen));
2013-09-29 00:21:18 +04:00
} else if ( c3__void == q_fex ) {
2014-11-06 03:20:01 +03:00
hiq = u3m_error("mull-bonk-c");
2013-09-29 00:21:18 +04:00
}
2014-08-21 01:18:34 +04:00
else hiq = _mull_in(van, p_fex, gol, q_fex, q_gen);
2013-09-29 00:21:18 +04:00
if ( c3__void == p_wux ) {
2014-09-06 00:13:24 +04:00
ran = u3nc(
c3__void,
2013-09-29 00:21:18 +04:00
(c3__void == q_wux)
? c3__void
2014-11-06 22:13:57 +03:00
: u3qfu_play(van, q_wux, r_gen));
2013-09-29 00:21:18 +04:00
} else if ( c3__void == q_wux ) {
2014-11-06 03:20:01 +03:00
ran = u3m_error("mull-bonk-d");
2013-09-29 00:21:18 +04:00
}
2014-08-21 01:18:34 +04:00
else ran = _mull_in(van, p_wux, gol, q_wux, r_gen);
2013-09-29 00:21:18 +04:00
2014-11-06 22:13:57 +03:00
dis = u3qf_fork(u3h(hiq), u3h(ran));
dat = u3qf_fork(u3t(hiq), u3t(ran));
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
ret = u3nc(_mull_nice(van, gol, dis), dat);
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3z(ran);
u3z(hiq);
u3z(q_wux);
u3z(p_wux);
u3z(q_fex);
u3z(p_fex);
u3z(nor);
u3z(bol);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-11-06 03:20:01 +03:00
case c3__clhp: u3x_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_mull_used();
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun hed = _mull_in(van, sut, c3__noun, dox, p_gen);
u3_noun tal = _mull_in(van, sut, c3__noun, dox, q_gen);
2014-11-06 22:13:57 +03:00
u3_noun dis = u3qf_cell(u3h(hed), u3h(tal));
u3_noun dat = u3qf_cell(u3t(hed), u3t(tal));
2014-09-06 00:13:24 +04:00
u3_noun ret = u3nc(_mull_nice(van, gol, dis), dat);
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3z(tal);
u3z(hed);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-11-06 03:20:01 +03:00
case c3__dtts: u3x_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_mull_used();
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun hed = _mull_in(van, sut, c3__noun, dox, p_gen);
u3_noun tal = _mull_in(van, sut, c3__noun, dox, q_gen);
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3z(hed);
u3z(tal);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
return _mull_both(van, gol, _mull_bean());
2013-09-29 00:21:18 +04:00
}
2014-09-06 00:13:24 +04:00
case c3__dtwt: p_gen = u3t(gen);
2014-08-21 01:18:34 +04:00
_mull_used();
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun vay = _mull_in(van, sut, c3__noun, dox, p_gen);
2014-09-06 00:13:24 +04:00
u3z(vay);
2014-08-21 01:18:34 +04:00
return _mull_both(van, gol, _mull_bean());
2013-09-29 00:21:18 +04:00
}
2014-09-06 00:13:24 +04:00
case c3__dtkt: p_gen = u3t(gen);
2014-08-21 01:18:34 +04:00
_mull_used();
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun wuq = c3__noun;
u3_noun vay = _mull_in(van, sut, wuq, dox, p_gen);
2014-09-06 00:13:24 +04:00
u3z(vay);
2014-08-21 01:18:34 +04:00
return _mull_both(van, gol, wuq);
2013-09-29 00:21:18 +04:00
}
2014-09-06 00:13:24 +04:00
case c3__dtls: p_gen = u3t(gen);
2014-08-21 01:18:34 +04:00
_mull_used();
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun wuq = u3nc(c3__atom, u3_blip);
u3_noun vay = _mull_in(van, sut, wuq, dox, p_gen);
2014-09-06 00:13:24 +04:00
u3z(vay);
2014-08-21 01:18:34 +04:00
return _mull_both(van, gol, wuq);
2013-09-29 00:21:18 +04:00
}
2014-11-06 03:20:01 +03:00
case c3__dtzz: u3x_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_mull_used();
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun tof = u3nt
2014-08-21 01:18:34 +04:00
(c3__cube,
2014-09-06 00:13:24 +04:00
u3k(q_gen),
2014-11-05 04:18:47 +03:00
(c3y == u3du(q_gen))
2013-09-29 00:21:18 +04:00
? c3__noun
2014-09-06 00:13:24 +04:00
: u3nc(c3__atom, u3k(p_gen)));
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
return _mull_both(van, gol, tof);
2013-09-29 00:21:18 +04:00
}
2014-11-06 03:20:01 +03:00
case c3__dttr: u3x_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_mull_used();
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun hed = _mull_in(van, sut, c3__noun, dox, p_gen);
u3_noun tal = _mull_in(van, sut, c3__noun, dox, q_gen);
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3z(hed);
u3z(tal);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
return _mull_both(van, gol, c3__noun);
2013-09-29 00:21:18 +04:00
}
2014-11-06 03:20:01 +03:00
case c3__dtzy: u3x_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_mull_used();
2013-09-29 00:21:18 +04:00
{
2014-11-06 22:13:57 +03:00
u3_noun typ = u3qfu_play(van, sut, gen);
2014-08-21 01:18:34 +04:00
return _mull_both(van, gol, typ);
2013-09-29 00:21:18 +04:00
}
2014-09-06 00:13:24 +04:00
case c3__ktbr: p_gen = u3t(gen);
2014-08-21 01:18:34 +04:00
_mull_used();
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun vat = _mull_in(van, sut, gol, dox, p_gen);
u3_noun pro = u3nc
2014-11-06 22:13:57 +03:00
(u3qfu_wrap(van, u3h(vat), c3__iron),
u3qfu_wrap(van, u3t(vat), c3__iron));
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3z(vat);
2013-09-29 00:21:18 +04:00
return pro;
}
2014-09-06 00:13:24 +04:00
case c3__ktpm: p_gen = u3t(gen);
2014-08-21 01:18:34 +04:00
_mull_used();
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun vat = _mull_in(van, sut, gol, dox, p_gen);
u3_noun pro = u3nc
2014-11-06 22:13:57 +03:00
(u3qfu_wrap(van, u3h(vat), c3__zinc),
u3qfu_wrap(van, u3t(vat), c3__zinc));
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3z(vat);
2013-09-29 00:21:18 +04:00
return pro;
}
2014-09-06 00:13:24 +04:00
case c3__ktwt: p_gen = u3t(gen);
2014-08-21 01:18:34 +04:00
_mull_used();
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun vat = _mull_in(van, sut, gol, dox, p_gen);
u3_noun pro = u3nc
2014-11-06 22:13:57 +03:00
(u3qfu_wrap(van, u3h(vat), c3__lead),
u3qfu_wrap(van, u3t(vat), c3__lead));
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3z(vat);
2013-09-29 00:21:18 +04:00
return pro;
}
2014-11-06 03:20:01 +03:00
case c3__ktts: u3x_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_mull_used();
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun vat = _mull_in(van, sut, gol, dox, q_gen);
u3_noun ret =
u3nc(
2014-11-06 22:13:57 +03:00
u3qfu_conk(van, u3h(vat), p_gen),
u3qfu_conk(van, u3t(vat), p_gen));
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3z(vat);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-11-06 03:20:01 +03:00
case c3__ktzp: u3x_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_mull_used();
{
2014-09-06 00:13:24 +04:00
u3_noun vat = _mull_in(van, sut, gol, dox, q_gen);
u3_noun ret =
u3nc(
2014-11-06 22:13:57 +03:00
u3qfu_conk(van, u3h(vat), p_gen),
u3qfu_conk(van, u3t(vat), p_gen));
2014-09-06 00:13:24 +04:00
u3z(vat);
return ret;
}
2014-09-06 00:13:24 +04:00
case c3__ktsg: p_gen = u3t(gen);
2014-08-21 01:18:34 +04:00
_mull_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
return _mull_in(van, sut, gol, dox, p_gen);
2013-09-29 00:21:18 +04:00
}
2014-11-06 03:20:01 +03:00
case c3__ktls: u3x_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_mull_used();
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun p_hif = _mull_nice
2014-11-06 22:13:57 +03:00
(van, gol, u3qfu_play(van, sut, p_gen));
u3_noun q_hif = u3qfu_play(van, dox, p_gen);
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3_noun zel = _mull_in(van, sut, p_hif, dox, q_gen);
u3_noun ret = u3nc(p_hif, q_hif);
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3z(zel);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-11-06 03:20:01 +03:00
case c3__kthx: u3x_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_mull_used();
2014-06-11 18:06:36 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun p_hif = _mull_nice
2014-11-06 22:13:57 +03:00
(van, gol, u3qfu_play(van, sut, p_gen));
u3_noun q_hif = u3qfu_play(van, dox, p_gen);
2014-06-11 18:06:36 +04:00
2014-09-06 00:13:24 +04:00
u3_noun zel = _mull_in(van, sut, p_hif, dox, q_gen);
u3_noun ret = u3nc(p_hif, q_hif);
2014-06-11 18:06:36 +04:00
2014-09-06 00:13:24 +04:00
u3z(zel);
2014-06-11 18:06:36 +04:00
return ret;
}
2014-11-06 03:20:01 +03:00
case c3__tsgr: u3x_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_mull_used();
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
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);
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3z(lem);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-11-06 03:20:01 +03:00
case c3__tstr: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
2014-08-21 01:18:34 +04:00
_mull_used();
2013-12-26 21:12:07 +04:00
{
2014-11-06 22:13:57 +03:00
u3_noun sep = u3qfu_seep(van, sut, c3__both, q_gen);
u3_noun pox = u3qfu_seep(van, dox, c3__both, q_gen);
2014-09-06 00:13:24 +04:00
u3_noun bid = u3nt(u3k(p_gen), u3k(q_gen), sep);
u3_noun yub = u3nt(u3k(p_gen), u3k(q_gen), pox);
2014-11-06 22:13:57 +03:00
u3_noun boc = u3qf_bull(bid, sut);
u3_noun nuf = u3qf_bull(yub, dox);
2014-09-06 00:13:24 +04:00
u3_noun ret = _mull_in(van, boc, gol, nuf, r_gen);
2013-12-26 21:12:07 +04:00
2014-09-06 00:13:24 +04:00
u3z(bid);
u3z(yub);
u3z(boc);
u3z(nuf);
2013-12-26 21:12:07 +04:00
return ret;
}
2014-11-06 03:20:01 +03:00
case c3__cnts: u3x_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_mull_used();
{
2014-11-06 22:13:57 +03:00
u3_noun sec = u3qfu_seek(van, sut, c3__read, p_gen);
u3_noun suc = u3qfu_seek(van, dox, c3__read, p_gen);
2014-09-06 00:13:24 +04:00
u3_noun lar = _mull_foil(sec);
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 vug = _mull_foil(suc);
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);
2014-08-21 01:18:34 +04:00
2014-11-06 03:20:01 +03:00
if ( c3a(u3r_sing(p_lar, p_vug), u3r_sing(pq_lar, pq_vug)) ) {
u3m_error("mull-bonk-e");
2013-12-15 12:23:23 +04:00
}
{
2014-11-06 22:13:57 +03:00
u3_noun mew = u3qfu_snub(van, sut, q_gen);
2014-09-06 00:13:24 +04:00
u3_noun yom = _mull_edit
(van, sut, dox, mew, u3k(qq_lar),
u3k(qq_vug));
2014-11-06 22:13:57 +03:00
u3_noun von = u3i_molt(u3k(van), u3qfu_van_vet, c3n, 0);
u3_noun p_ret = u3qfu_fire(van, sut, u3h(yom));
u3_noun q_ret = u3qfu_fire(von, sut, u3t(yom));
2014-09-06 00:13:24 +04:00
u3z(von);
u3z(yom);
u3z(mew);
u3z(vug);
u3z(lar);
return u3nc(_mull_nice(van, gol, p_ret), q_ret);
2013-11-12 11:09:11 +04:00
}
2013-09-29 00:21:18 +04:00
}
2014-11-06 03:20:01 +03:00
case c3__pmcl: u3x_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_mull_used();
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun ruf = u3nt
2014-08-21 01:18:34 +04:00
(c3__clhp,
2014-09-06 00:13:24 +04:00
u3nc(u3_nul, 1),
u3k(p_gen));
u3_noun ret = _mull_grow
2014-08-21 01:18:34 +04:00
(van, sut, gol, dox, c3__zinc, ruf, q_gen);
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3z(ruf);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-09-06 00:13:24 +04:00
case c3__brcn: p_gen = u3t(gen);
2014-08-21 01:18:34 +04:00
_mull_used();
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun ruf = u3nc(u3_nul, 1);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
ret = _mull_grow(van, sut, gol, dox, c3__gold, ruf, p_gen);
2014-09-06 00:13:24 +04:00
u3z(ruf);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-09-06 00:13:24 +04:00
case c3__pmcn: p_gen = u3t(gen);
2014-08-21 01:18:34 +04:00
_mull_used();
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun ruf = u3nc(u3_nul, 1);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
ret = _mull_grow(van, sut, gol, dox, c3__lead, ruf, p_gen);
2014-09-06 00:13:24 +04:00
u3z(ruf);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-11-06 03:20:01 +03:00
case c3__pmls: u3x_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_mull_used();
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun ruf = u3nt
2014-08-21 01:18:34 +04:00
(c3__clhp,
2014-09-06 00:13:24 +04:00
u3nc(u3_nul, 1),
u3k(p_gen));
u3_noun ret = _mull_grow
2014-08-21 01:18:34 +04:00
(van, sut, gol, dox, c3__iron, ruf, q_gen);
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3z(ruf);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-11-06 03:20:01 +03:00
case c3__sgzp: u3x_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_mull_used();
2013-12-05 02:30:09 +04:00
{
2014-11-06 22:13:57 +03:00
u3_noun typ = u3qfu_play(van, sut, p_gen);
u3_noun dug = u3qfu_duck(van, typ);
2014-09-06 00:13:24 +04:00
u3_noun ret;
2013-12-05 02:30:09 +04:00
2014-11-06 03:20:01 +03:00
u3t_push(u3nc(c3__mean, dug));
2013-12-05 02:30:09 +04:00
{
2014-08-21 01:18:34 +04:00
ret = _mull_in(van, sut, gol, dox, q_gen);
}
2014-11-06 03:20:01 +03:00
u3t_drop();
2013-12-05 02:30:09 +04:00
2014-09-06 00:13:24 +04:00
u3z(typ);
2013-12-05 02:30:09 +04:00
return ret;
}
2014-11-06 03:20:01 +03:00
case c3__sggr: u3x_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_mull_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
return _mull_in(van, sut, gol, dox, q_gen);
2013-09-29 00:21:18 +04:00
}
2014-11-06 03:20:01 +03:00
case c3__zpcm: u3x_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_mull_used();
2013-09-29 00:21:18 +04:00
{
2014-11-06 22:13:57 +03:00
u3_noun p_ret = u3qfu_play(van, sut, p_gen);
u3_noun q_ret = u3qfu_play(van, sut, q_gen);
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
return u3nc
2014-08-21 01:18:34 +04:00
(_mull_nice(van, gol, p_ret),
2013-09-29 00:21:18 +04:00
q_ret);
}
2014-11-06 03:20:01 +03:00
case c3__zpcb: u3x_cell(u3t(gen), &p_gen, &q_gen);
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun ret;
2013-09-29 00:21:18 +04:00
2014-11-06 03:20:01 +03:00
u3t_push(u3nc(c3__mean, _mull_loc(van, p_gen)));
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
ret = _mull_in(van, sut, gol, dox, q_gen);
2013-09-29 00:21:18 +04:00
}
2014-11-06 03:20:01 +03:00
u3t_drop();
2013-09-29 00:21:18 +04:00
return ret;
}
2014-09-06 00:13:24 +04:00
case c3__zpts: p_gen = u3t(gen);
2014-08-21 01:18:34 +04:00
_mull_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
return _mull_both(van, gol, c3__noun);
2013-09-29 00:21:18 +04:00
}
case c3__zpcn:
2014-08-21 01:18:34 +04:00
_mull_used();
2013-09-29 00:21:18 +04:00
{
2014-11-06 03:20:01 +03:00
u3_noun pet = u3j_hook(u3k(van), "seed");
2014-09-06 00:13:24 +04:00
u3_noun peq = u3k(u3h(pet));
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3z(pet);
2014-08-21 01:18:34 +04:00
return _mull_both(van, gol, peq);
2013-09-29 00:21:18 +04:00
}
2014-11-06 03:20:01 +03:00
case c3__zpsm: u3x_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_mull_used();
2013-09-29 00:21:18 +04:00
{
2014-11-06 22:13:57 +03:00
u3_noun p_zur = u3qfu_play(van, sut, p_gen);
u3_noun q_zur = u3qfu_play (van, dox, p_gen);
2014-09-06 00:13:24 +04:00
u3_noun vos = _mull_in(van, sut, c3__noun, dox, q_gen);
2014-11-06 22:13:57 +03:00
u3_noun p_ret = u3qf_cell(p_zur, u3h(vos));
u3_noun q_ret = u3qf_cell(q_zur, u3t(vos));
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3z(vos);
u3z(q_zur);
u3z(p_zur);
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
return u3nc
2014-08-21 01:18:34 +04:00
(_mull_nice(van, gol, p_ret), q_ret);
2013-09-29 00:21:18 +04:00
}
case c3__zpfs:
case c3__zpzp:
2014-08-21 01:18:34 +04:00
_mull_used();
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
return u3nc(c3__void, c3__void);
2013-09-29 00:21:18 +04:00
}
}
}
2014-11-06 06:10:22 +03:00
u3_noun
2014-09-03 09:46:55 +04:00
_cqfu_mull(
2014-09-06 00:13:24 +04:00
u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun dox,
u3_noun gen)
2013-09-29 00:21:18 +04:00
{
2014-11-05 04:18:47 +03:00
if ( c3n == _mull_vet(van) ) {
return c3y;
2013-09-29 00:21:18 +04:00
} else {
2014-09-06 00:13:24 +04:00
u3_noun mul = _mull_in(van, sut, gol, dox, gen);
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3z(mul);
2014-11-05 04:18:47 +03:00
return c3y;
2013-09-29 00:21:18 +04:00
}
}
/* boilerplate
*/
2014-09-06 00:13:24 +04:00
u3_noun
2014-11-06 22:13:57 +03:00
u3wfu_mull(u3_noun cor)
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun sut, gol, dox, gen, van;
2013-09-29 00:21:18 +04:00
2014-11-18 00:56:51 +03:00
if ( (c3n == u3r_mean(cor, u3x_sam_2, &gol,
u3x_sam_6, &dox,
u3x_sam_7, &gen,
u3x_con, &van,
2013-09-29 00:21:18 +04:00
0)) ||
2014-11-18 00:56:51 +03:00
(u3_none == (sut = u3r_at(u3x_sam, van))) )
2013-09-29 00:21:18 +04:00
{
2014-11-06 03:20:01 +03:00
return u3m_bail(c3__fail);
2013-09-29 00:21:18 +04:00
} else {
2014-09-03 09:46:55 +04:00
return _cqfu_mull(van, sut, gol, dox, gen);
2013-09-29 00:21:18 +04:00
}
}
2014-09-06 00:13:24 +04:00
u3_noun
2014-11-06 22:13:57 +03:00
u3qfu_mull(u3_noun van,
2014-09-06 00:13:24 +04:00
u3_noun sut,
u3_noun gol,
u3_noun dox,
u3_noun gen)
2013-09-29 00:21:18 +04:00
{
2014-08-28 23:40:40 +04:00
c3_m fun_m = c3__mull;
2014-11-06 03:20:01 +03:00
u3_noun pro = u3z_find_4(fun_m, sut, gol, dox, gen);
2013-09-29 00:21:18 +04:00
2014-11-06 02:36:30 +03:00
if ( u3_none != pro ) {
2014-08-28 23:40:40 +04:00
return pro;
2013-09-29 00:21:18 +04:00
}
else {
2014-09-03 09:46:55 +04:00
pro = _cqfu_mull(van, sut, gol, dox, gen);
2013-09-29 00:21:18 +04:00
2014-11-06 03:20:01 +03:00
return u3z_save_4(fun_m, sut, gol, dox, gen, pro);
2013-09-29 00:21:18 +04:00
}
}