shrub/gen164/6/ut_mint.c

968 lines
23 KiB
C
Raw Normal View History

2013-09-29 00:21:18 +04:00
/* j/6/mint.c
**
** This file is in the public domain.
*/
#include "all.h"
#include "../pit.h"
2014-06-11 18:06:36 +04:00
int FOO;
2013-09-29 00:21:18 +04:00
/* logic
*/
static u2_noun
2014-08-21 01:18:34 +04:00
_mint_in(u2_noun, u2_noun, u2_noun, u2_noun);
2013-09-29 00:21:18 +04:00
static u2_noun
2014-08-21 01:18:34 +04:00
_mint_bean(void)
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
return u2nt(c3__fork,
u2nq(c3__cube, 0, c3__atom, 'f'),
u2nq(c3__cube, 1, c3__atom, 'f'));
2013-09-29 00:21:18 +04:00
}
static u2_bean
2014-08-21 01:18:34 +04:00
_mint_vet(
2013-09-29 00:21:18 +04:00
u2_noun van)
{
2014-08-21 01:24:29 +04:00
// u2_bean vet = u2_cj_hook(u2k(van), "vet");
2014-09-03 09:46:55 +04:00
u2_bean vet = u2_cr_at(u2_cqfu_van_vet, van);
2013-09-29 00:21:18 +04:00
switch ( vet ) {
case u2_no:
2013-09-29 00:21:18 +04:00
case u2_yes: return vet;
2014-08-21 01:18:34 +04:00
default: return u2_cm_bail(c3__fail);
2013-09-29 00:21:18 +04:00
}
}
2014-09-04 01:33:18 +04:00
static u2_noun
2014-08-21 01:18:34 +04:00
_mint_core(
2014-09-04 01:33:18 +04:00
u2_noun pac,
u2_noun con)
2013-09-29 00:21:18 +04:00
{
if ( (c3__void == pac) ) {
return c3__void;
} else {
2014-08-21 01:18:34 +04:00
return u2nt(c3__core, pac, con);
2013-09-29 00:21:18 +04:00
}
}
2014-09-04 01:33:18 +04:00
static u2_noun
2014-08-21 01:18:34 +04:00
_mint_foil(
2014-09-04 01:33:18 +04:00
u2_noun pok)
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun p_pok = u2h(pok);
u2_noun q_pok = u2t(pok);
2013-09-29 00:21:18 +04:00
u2_noun ret;
2014-08-21 01:18:34 +04:00
if ( u2_yes == u2h(q_pok) ) {
u2_noun pq_pok = u2t(q_pok);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
ret = u2nc(
u2k(p_pok),
u2nc(u2_nul,
u2nc(
u2nc(
u2k(pq_pok),
u2nt(c3__elm, u2_nul, 1)),
2013-09-29 00:21:18 +04:00
u2_nul)));
}
else {
2014-08-21 01:18:34 +04:00
u2_noun pq_pok = u2h(u2t(q_pok));
u2_noun qq_pok = u2t(u2t(q_pok));
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
ret = u2nc(u2k(p_pok),
u2nc(u2k(pq_pok),
u2k(qq_pok)));
2013-09-29 00:21:18 +04:00
}
2014-08-21 01:18:34 +04:00
u2z(pok);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-09-04 01:33:18 +04:00
static u2_noun
2014-08-21 01:18:34 +04:00
_mint_cond(
2014-09-04 01:33:18 +04:00
u2_noun pex,
u2_noun yom,
u2_noun woq)
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
if ( 1 == u2h(pex) ) {
if ( 0 == u2t(pex) ) {
u2z(pex);
u2z(woq);
2013-09-29 00:21:18 +04:00
return yom;
}
2014-08-21 01:18:34 +04:00
else if ( 1 == u2t(pex) ) {
u2z(pex);
u2z(yom);
2013-09-29 00:21:18 +04:00
return woq;
}
}
2014-08-21 01:18:34 +04:00
return u2nq(6, pex, yom, woq);
2013-09-29 00:21:18 +04:00
}
static u2_noun
2014-08-21 01:18:34 +04:00
_mint_corn(
2013-09-29 00:21:18 +04:00
u2_noun van,
u2_noun sut,
u2_noun gen)
{
2014-08-21 01:18:34 +04:00
u2_noun mil = _mint_in(van, sut, c3__noun, gen);
u2_noun fol = u2k(u2t(mil));
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2z(mil);
2013-09-29 00:21:18 +04:00
return fol;
}
2014-09-04 01:33:18 +04:00
static u2_noun
2014-08-21 01:18:34 +04:00
_mint_nice(
2014-09-04 01:33:18 +04:00
u2_noun van,
u2_noun gol,
u2_noun typ)
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
if ( (u2_yes == _mint_vet(van)) &&
2014-09-03 07:36:29 +04:00
(u2_no == u2_cqfu_nest(van, gol, u2_yes, typ)) )
2013-09-29 00:21:18 +04:00
{
2014-09-03 07:36:29 +04:00
// u2_noun dun = u2_cqfu_dunq(van, "need", gol);
// u2_noun niz = u2_cqfu_dunq(van, "have", typ);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
// u2_ct_push(u2nc(c3__mean, dun));
// u2_ct_push(u2nc(c3__mean, niz));
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
return u2_cm_error("mint-nice");
2013-09-29 00:21:18 +04:00
}
else return typ;
}
2014-09-04 01:33:18 +04:00
static u2_noun
2014-08-21 01:18:34 +04:00
_mint_coke(
2014-09-04 01:33:18 +04:00
u2_noun nug)
2013-09-29 00:21:18 +04:00
{
u2_atom axe;
2014-08-21 01:18:34 +04:00
if ( 0 == u2h(nug) ) {
axe = u2t(nug);
} else if ( 10 == u2h(nug) ) {
u2_noun xin = u2k(u2t(u2t(nug)));
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
axe = _mint_coke(xin);
2013-09-29 00:21:18 +04:00
}
else {
2014-08-21 01:18:34 +04:00
return u2_cm_error("mint-coke");
2013-09-29 00:21:18 +04:00
}
2014-08-21 01:18:34 +04:00
u2z(nug);
2013-09-29 00:21:18 +04:00
return axe;
}
2014-09-04 01:33:18 +04:00
static u2_noun
2014-08-21 01:18:34 +04:00
_mint_edit(
2014-09-04 01:33:18 +04:00
u2_noun van,
u2_noun sut,
u2_noun mew,
u2_noun p_lar,
u2_noun rag,
u2_noun hej)
2013-09-29 00:21:18 +04:00
{
while ( 1 ) {
2014-08-21 01:18:34 +04:00
if ( u2_no == u2du(mew) ) {
2014-09-03 07:36:29 +04:00
u2_noun gim = u2_cqfu_fire(van, sut, rag);
u2_noun fol = u2_cqf_hike(p_lar, hej);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2z(rag);
u2z(hej);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
return u2nc(gim, fol);
2013-09-29 00:21:18 +04:00
} else {
2014-08-21 01:18:34 +04:00
u2_noun i_mew = u2h(mew);
u2_noun t_mew = u2t(mew);
u2_noun pi_mew = u2h(i_mew);
u2_noun qi_mew = u2t(i_mew);
2014-09-03 07:36:29 +04:00
u2_noun zil = u2_cqfu_mint(van, sut, c3__noun, qi_mew);
2014-08-21 01:18:34 +04:00
u2_noun p_zil = u2h(zil);
u2_noun q_zil = u2t(zil);
2014-09-03 07:36:29 +04:00
u2_noun wip = u2_cqfu_tock
2014-08-21 01:18:34 +04:00
(van, sut, pi_mew, p_zil, rag);
2014-08-21 01:18:34 +04:00
u2z(rag);
rag = u2k(u2t(wip));
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
hej = u2nc(u2nc(u2k(u2h(wip)),
u2k(q_zil)),
2013-09-29 00:21:18 +04:00
hej);
2014-08-21 01:18:34 +04:00
u2z(zil);
u2z(wip);
2013-09-29 00:21:18 +04:00
mew = t_mew;
}
}
}
static u2_noun
2014-08-21 01:18:34 +04:00
_mint_brew(
2013-09-29 00:21:18 +04:00
u2_noun van,
u2_noun sut,
u2_bean tov,
u2_noun gen)
{
u2_noun von;
2013-09-29 00:21:18 +04:00
switch ( tov ) {
2014-08-21 01:18:34 +04:00
default: return u2_cm_bail(c3__fail);
case u2_yes:
2014-08-21 01:18:34 +04:00
von = u2k(van); break;
case u2_no:
2014-09-03 09:46:55 +04:00
von = u2_ci_molt(u2k(van), u2_cqfu_van_vet, u2_no, 0); break;
2013-09-29 00:21:18 +04:00
}
{
2014-09-03 07:36:29 +04:00
u2_noun mil = u2_cqfu_mint(von, sut, c3__noun, gen);
2014-08-21 01:18:34 +04:00
u2_noun fol = u2k(u2t(mil));
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2z(mil);
u2z(von);
2013-09-29 00:21:18 +04:00
return fol;
}
}
2014-09-04 01:33:18 +04:00
static u2_noun
2014-08-21 01:18:34 +04:00
_mint_bake(
2014-09-04 01:33:18 +04:00
u2_noun van,
u2_noun sut,
u2_noun dab)
2013-09-29 00:21:18 +04:00
{
if ( (u2_nul == dab) ) {
2014-08-21 01:18:34 +04:00
return 0;
2013-09-29 00:21:18 +04:00
}
else {
u2_noun n_dab, l_dab, r_dab;
2014-08-21 01:18:34 +04:00
u2_cr_trel(dab, &n_dab, &l_dab, &r_dab);
if ( u2_no == u2du(n_dab) ) {
return u2_cm_bail(c3__fail);
}
2013-09-29 00:21:18 +04:00
else {
2014-08-21 01:18:34 +04:00
u2_noun qn_dab = u2t(n_dab);
2013-09-29 00:21:18 +04:00
u2_noun vad;
2014-08-21 01:18:34 +04:00
switch ( u2h(qn_dab) ) {
default: return u2_cm_bail(c3__exit);
2013-09-29 00:21:18 +04:00
case c3__ash: {
2014-08-21 01:18:34 +04:00
vad = _mint_brew(van, sut, u2_yes, u2t(qn_dab));
2013-09-29 00:21:18 +04:00
break;
}
case c3__elm: {
2014-08-21 01:18:34 +04:00
vad = _mint_brew(van, sut, u2_no, u2t(qn_dab));
2013-09-29 00:21:18 +04:00
break;
}
}
if ( (u2_nul == l_dab) && (u2_nul == r_dab) ) {
return vad;
}
else if ( (u2_nul == l_dab) ) {
2014-08-21 01:18:34 +04:00
return u2nc
(vad, _mint_bake(van, sut, r_dab));
2013-09-29 00:21:18 +04:00
}
else if ( (u2_nul == r_dab) ) {
2014-08-21 01:18:34 +04:00
return u2nc
(vad, _mint_bake(van, sut, l_dab));
2013-09-29 00:21:18 +04:00
}
else {
2014-08-21 01:18:34 +04:00
return u2nt
(vad,
_mint_bake(van, sut, l_dab),
_mint_bake(van, sut, r_dab));
2013-09-29 00:21:18 +04:00
}
}
}
}
static u2_noun
2014-08-21 01:18:34 +04:00
_mint_grow(
2013-09-29 00:21:18 +04:00
u2_noun van,
u2_noun sut,
u2_noun gol,
u2_atom mel,
u2_noun ruf,
u2_noun dab)
{
2014-08-21 01:18:34 +04:00
u2_noun dan = _mint_in(van, sut, c3__noun, ruf);
u2_noun p_dan = u2h(dan);
u2_noun q_dan = u2t(dan);
2013-09-29 00:21:18 +04:00
u2_noun toc = _mint_core
2014-08-21 01:18:34 +04:00
(u2k(p_dan),
u2nt(c3__gold,
u2k(p_dan),
u2nc(u2_nul, u2k(dab))));
u2_noun dez = _mint_bake(van, toc, dab);
u2_noun zod = u2nc(1, dez);
2013-09-29 00:21:18 +04:00
u2_noun cot = _mint_core
2014-08-21 01:18:34 +04:00
(u2k(p_dan),
u2nt(mel,
u2k(p_dan),
u2nc(u2k(dez),
u2k(dab))));
u2_noun ret = u2nc
(
_mint_nice(van, gol, cot),
2014-09-03 07:36:29 +04:00
u2_cqf_cons(zod, q_dan));
2014-08-21 01:18:34 +04:00
u2z(zod);
u2z(toc);
u2z(dan);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-09-04 01:33:18 +04:00
static u2_noun
2014-08-21 01:18:34 +04:00
_mint_loc(
2014-09-04 01:33:18 +04:00
u2_noun van,
u2_noun loc)
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun mol = u2nc('o', u2k(loc));
2014-08-21 01:24:29 +04:00
u2_noun sho = u2_cj_hook(u2k(van), "show");
2014-08-21 01:18:34 +04:00
u2_noun ret = u2_ci_molt(u2k(sho), u2_cv_sam, u2k(mol), 0);
2014-08-21 01:18:34 +04:00
u2z(mol);
u2z(sho);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-08-21 01:18:34 +04:00
# define _mint_used()
2013-09-29 00:21:18 +04:00
2014-09-04 01:33:18 +04:00
static u2_noun
2014-08-21 01:18:34 +04:00
_mint_in(
2014-09-04 01:33:18 +04:00
u2_noun van,
u2_noun sut,
u2_noun gol,
u2_noun gen)
2013-09-29 00:21:18 +04:00
{
u2_noun p_gen, q_gen, r_gen;
u2_noun ret;
if ( (c3__void == sut) &&
2014-08-21 01:18:34 +04:00
!((u2_yes == u2du(gen)) && (c3__zpcb == u2h(gen))) )
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
if ( (u2_no == _mint_vet(van))
|| ((u2_yes == u2du(gen)) &&
((c3__zpfs == u2h(gen)) || (c3__zpzp == u2h(gen)))) )
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
return u2nt(c3__void, 0, 0);
2013-09-29 00:21:18 +04:00
}
else {
2014-08-21 01:18:34 +04:00
return u2_cm_error("mint-vain");
2013-09-29 00:21:18 +04:00
}
}
2014-08-21 01:18:34 +04:00
if ( u2_no == u2du(gen) ) {
u2_noun ter = u2_cr_at(u2_cv_con_3, van);
2014-09-03 07:36:29 +04:00
u2_noun rex = u2_cqfp_open(ter, gen);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
ret = _mint_in(van, sut, gol, rex);
u2z(rex);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-08-21 01:18:34 +04:00
else if ( u2_yes == u2du(u2h(gen)) ) {
_mint_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun hed = _mint_in(van, sut, c3__noun, u2h(gen));
u2_noun tal = _mint_in(van, sut, c3__noun, u2t(gen));
2014-09-03 07:36:29 +04:00
u2_noun typ = u2_cqf_cell(u2h(hed), u2h(tal));
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
ret = u2nc
(
_mint_nice(van, gol, typ),
2014-09-03 07:36:29 +04:00
u2_cqf_cons(u2t(hed), u2t(tal)));
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2z(hed);
u2z(tal);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-08-21 01:18:34 +04:00
} else switch ( u2h(gen) ) {
2013-09-29 00:21:18 +04:00
default: {
2014-08-21 01:18:34 +04:00
u2_noun ter = u2_cr_at(u2_cv_con_3, van);
2014-09-03 07:36:29 +04:00
u2_noun rex = u2_cqfp_open(ter, gen);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
if ( u2_yes == u2_cr_sing(rex, gen) ) {
2013-09-29 00:21:18 +04:00
#if 1
2014-09-03 07:36:29 +04:00
u2_noun zix = u2_cqfu_shep
2014-08-21 01:18:34 +04:00
(van, "gene", 'q', u2k(gen));
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2_ct_push(u2nc(c3__mean, zix));
return u2_cm_error("mint-open");
2013-09-29 00:21:18 +04:00
#else
2014-08-21 01:18:34 +04:00
u2_err("h", u2h(gen));
return u2_cm_bail(c3__fail);
2013-09-29 00:21:18 +04:00
#endif
}
2014-08-21 01:18:34 +04:00
ret = _mint_in(van, sut, gol, rex);
u2z(rex);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__bcpt: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_mint_used();
2014-01-04 11:28:16 +04:00
{
2014-09-03 07:36:29 +04:00
u2_noun sep = u2_cqfu_seep(van, sut, c3__read, p_gen);
2014-01-04 11:28:16 +04:00
u2_noun axe = u2h(sep);
2014-09-03 07:36:29 +04:00
u2_noun rex = u2_cqfl_whip(van, q_gen, axe);
2014-08-21 01:18:34 +04:00
u2_noun ret = _mint_in(van, sut, gol, rex);
2014-01-04 11:28:16 +04:00
u2z(sep);
u2z(rex);
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__wtts: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_mint_used();
2013-12-27 06:43:25 +04:00
{
2014-09-03 07:36:29 +04:00
u2_noun nob = u2_cqfl_bunt(van, p_gen);
2014-01-05 07:27:22 +04:00
u2_noun dok = u2nc(c3__cnzz, q_gen);
2014-08-21 01:18:34 +04:00
u2_noun vol = _mint_corn(van, sut, dok);
u2_noun axe = _mint_coke(vol);
2014-09-03 07:36:29 +04:00
u2_noun wam = u2_cqfu_play(van, sut, nob);
2013-12-27 06:43:25 +04:00
2014-08-21 01:18:34 +04:00
ret = u2nc
(
_mint_nice(van, gol, _mint_bean()),
2014-09-03 07:36:29 +04:00
u2_cqfu_fish(van, wam, axe));
2013-12-27 06:43:25 +04:00
2014-08-21 01:18:34 +04:00
u2z(axe);
u2z(wam);
u2z(nob);
u2z(dok);
2014-01-01 10:48:21 +04:00
2013-12-27 06:43:25 +04:00
return ret;
}
2014-01-01 00:11:16 +04:00
2014-08-21 01:18:34 +04:00
case c3__wtcl: u2_cx_trel(u2t(gen), &p_gen, &q_gen, &r_gen);
_mint_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun bol = _mint_bean();
u2_noun nor = _mint_in(van, sut, bol, p_gen);
2014-09-03 07:36:29 +04:00
u2_noun fex = u2_cqfu_gain(van, sut, p_gen);
u2_noun wux = u2_cqfu_lose(van, sut, p_gen);
2013-09-29 00:21:18 +04:00
u2_noun duy = (c3__void == fex)
? ( (c3__void == wux)
2014-08-21 01:18:34 +04:00
? u2nc(0, 0)
: u2nc(1, 1) )
2013-09-29 00:21:18 +04:00
: ( (c3__void == wux)
2014-08-21 01:18:34 +04:00
? u2nc(1, 0)
: u2k(u2t(nor)) );
u2_noun hiq = _mint_in(van, fex, gol, q_gen);
u2_noun ran = _mint_in(van, wux, gol, r_gen);
ret = u2nc
2014-09-03 07:36:29 +04:00
(u2_cqf_fork(u2h(hiq), u2h(ran)),
2014-08-21 01:18:34 +04:00
_mint_cond(duy,
u2k(u2t(hiq)),
u2k(u2t(ran))));
u2z(ran);
u2z(hiq);
u2z(nor);
u2z(wux);
u2z(fex);
u2z(bol);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__clhp: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_mint_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun hed = _mint_in(van, sut, c3__noun, p_gen);
u2_noun tal = _mint_in(van, sut, c3__noun, q_gen);
2014-09-03 07:36:29 +04:00
u2_noun typ = u2_cqf_cell(u2h(hed), u2h(tal));
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
ret = u2nc
(
_mint_nice(van, gol, typ),
2014-09-03 07:36:29 +04:00
u2_cqf_cons(u2t(hed), u2t(tal)));
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2z(hed);
u2z(tal);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__dtts: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_mint_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun typ = _mint_nice(van, gol, _mint_bean());
u2_noun one = _mint_corn(van, sut, p_gen);
u2_noun two = _mint_corn(van, sut, q_gen);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
return u2nc(typ, u2nt(5, one, two));
2013-09-29 00:21:18 +04:00
}
2014-08-21 01:18:34 +04:00
case c3__dtwt: p_gen = u2t(gen);
_mint_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun typ = _mint_nice(van, gol, _mint_bean());
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
return u2nc
(
2013-09-29 00:21:18 +04:00
typ,
2014-08-21 01:18:34 +04:00
u2nc(3, _mint_corn(van, sut, p_gen)));
2013-09-29 00:21:18 +04:00
}
2014-08-21 01:18:34 +04:00
case c3__dtkt: p_gen = u2t(gen);
_mint_used();
2013-09-29 00:21:18 +04:00
{
u2_noun tom = c3__noun;
2014-08-21 01:18:34 +04:00
u2_noun sam = _mint_in(van, sut, tom, p_gen);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
ret = u2nc
(
_mint_nice(van, gol, tom),
u2nc(11, u2k(u2t(sam))));
2014-08-21 01:18:34 +04:00
u2z(sam);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__dtls: p_gen = u2t(gen);
_mint_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun tom = u2nc(c3__atom, u2_blip);
u2_noun sam = _mint_in(van, sut, tom, p_gen);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
ret = u2nc
(
_mint_nice(van, gol, tom),
u2nc(4, u2k(u2t(sam))));
2014-08-21 01:18:34 +04:00
u2z(sam);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__dtzz: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_mint_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun boc = (u2_no == u2ud(q_gen))
2013-09-29 00:21:18 +04:00
? c3__noun
2014-08-21 01:18:34 +04:00
: u2nc(c3__atom, u2k(p_gen));
2014-09-03 07:36:29 +04:00
u2_noun typ = u2_cqf_cube(q_gen, boc);
u2_noun ret =
2014-08-21 01:18:34 +04:00
u2nc(
_mint_nice(van, gol, typ),
u2nc(1, u2k(q_gen)));
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2z(boc);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__dttr: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_mint_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun one = _mint_corn(van, sut, p_gen);
u2_noun two = _mint_corn(van, sut, q_gen);
2014-07-24 03:23:53 +04:00
2014-08-21 01:18:34 +04:00
return u2nc
(
_mint_nice(van, gol, c3__noun),
u2nt(2, one, two));
2013-09-29 00:21:18 +04:00
}
2014-08-21 01:18:34 +04:00
case c3__dtzy: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_mint_used();
2013-09-29 00:21:18 +04:00
{
2014-09-03 07:36:29 +04:00
u2_noun typ = u2_cqfu_play(van, sut, gen);
u2_noun ret =
2014-08-21 01:18:34 +04:00
u2nc(
_mint_nice(van, gol, typ),
u2nc(1, u2k(q_gen)));
2013-09-29 00:21:18 +04:00
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__ktbr: p_gen = u2t(gen);
_mint_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun ryd = _mint_in(van, sut, gol, p_gen);
2014-09-03 07:36:29 +04:00
u2_noun tyf = u2_cqfu_wrap(van, u2h(ryd), c3__iron);
2014-08-21 01:18:34 +04:00
u2_noun pro = u2nc(tyf, u2k(u2t(ryd)));
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2z(ryd);
2013-09-29 00:21:18 +04:00
return pro;
}
2014-08-21 01:18:34 +04:00
case c3__ktpm: p_gen = u2t(gen);
_mint_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun ryd = _mint_in(van, sut, gol, p_gen);
2014-09-03 07:36:29 +04:00
u2_noun tyf = u2_cqfu_wrap(van, u2h(ryd), c3__zinc);
2014-08-21 01:18:34 +04:00
u2_noun pro = u2nc(tyf, u2k(u2t(ryd)));
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2z(ryd);
2013-09-29 00:21:18 +04:00
return pro;
}
2014-08-21 01:18:34 +04:00
case c3__ktwt: p_gen = u2t(gen);
_mint_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun ryd = _mint_in(van, sut, gol, p_gen);
2014-09-03 07:36:29 +04:00
u2_noun tyf = u2_cqfu_wrap(van, u2h(ryd), c3__lead);
2014-08-21 01:18:34 +04:00
u2_noun pro = u2nc(tyf, u2k(u2t(ryd)));
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2z(ryd);
2013-09-29 00:21:18 +04:00
return pro;
}
2014-08-21 01:18:34 +04:00
case c3__ktts: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_mint_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun vat = _mint_in(van, sut, gol, q_gen);
2014-08-21 01:18:34 +04:00
ret = u2nc
(
2014-09-03 07:36:29 +04:00
u2_cqfu_conk(van, u2h(vat), p_gen),
2014-08-21 01:18:34 +04:00
u2k(u2t(vat)));
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2z(vat);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__ktzp: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_mint_used();
{
2014-08-21 01:18:34 +04:00
u2_noun vat = _mint_in(van, sut, gol, q_gen);
2014-08-21 01:18:34 +04:00
ret = u2nc
(
2014-09-03 07:36:29 +04:00
u2_cqfu_conk(van, u2h(vat), p_gen),
2014-08-21 01:18:34 +04:00
u2k(u2t(vat)));
2014-08-21 01:18:34 +04:00
u2z(vat);
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__ktsg: p_gen = u2t(gen);
_mint_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun nef = _mint_in(van, sut, gol, p_gen);
u2_noun p_nef = u2h(nef);
u2_noun q_nef = u2t(nef);
2013-09-29 00:21:18 +04:00
u2_noun fom;
{
2014-09-03 07:36:29 +04:00
u2_noun cag = u2_cqfu_burn(van, sut);
2014-08-21 01:18:34 +04:00
u2_noun wim = u2_cn_nock_an(cag, u2k(q_nef));
2013-09-29 00:21:18 +04:00
if ( 0 == u2h(wim) ) {
fom = u2nc(1, u2k(u2t(wim)));
} else {
fom = u2k(q_nef);
}
u2z(wim);
}
2014-08-21 01:18:34 +04:00
ret = u2nc(u2k(p_nef), fom);
2014-08-21 01:18:34 +04:00
u2z(nef);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__ktls: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_mint_used();
2013-09-29 00:21:18 +04:00
{
2014-09-03 07:36:29 +04:00
u2_noun huz = u2_cqfu_play(van, sut, p_gen);
2014-08-21 01:18:34 +04:00
u2_noun hif = _mint_nice(van, gol, huz);
u2_noun zel = _mint_in(van, sut, hif, q_gen);
u2_noun ret = u2nc(hif, u2k(u2t(zel)));
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2z(zel);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__kthx: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_mint_used();
2014-06-11 18:06:36 +04:00
{
2014-09-03 07:36:29 +04:00
u2_noun huz = u2_cqfu_play(van, sut, p_gen);
2014-08-21 01:18:34 +04:00
u2_noun hif = _mint_nice(van, gol, huz);
u2_noun zel = _mint_in(van, sut, hif, q_gen);
u2_noun ret = u2nc(hif, u2k(u2t(zel)));
2014-06-11 18:06:36 +04:00
2014-06-26 01:59:22 +04:00
#if 0
2014-06-11 18:06:36 +04:00
{
2014-09-03 07:36:29 +04:00
u2_noun goz = u2_cqfu_play(van, sut, q_gen);
2014-06-11 18:06:36 +04:00
u2_noun bar;
2014-09-04 01:33:18 +04:00
2014-06-11 18:06:36 +04:00
FOO = 1;
fprintf(stderr, "\r\n");
2014-09-03 07:36:29 +04:00
bar = u2_cqfu_nest(van, huz, u2_no, goz);
2014-06-11 18:06:36 +04:00
fprintf(stderr, "kthx: bar %d\r\n", bar);
FOO = 0;
}
2014-06-26 01:59:22 +04:00
#endif
2014-08-21 01:18:34 +04:00
u2z(zel);
2014-06-11 18:06:36 +04:00
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__tsgr: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_mint_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun fid = _mint_in(van, sut, c3__noun, p_gen);
u2_noun p_fid = u2h(fid);
u2_noun q_fid = u2t(fid);
u2_noun dov = _mint_in(van, p_fid, gol, q_gen);
u2_noun p_dov = u2h(dov);
u2_noun q_dov = u2t(dov);
ret = u2nc
(u2k(p_dov),
2014-09-03 07:36:29 +04:00
u2_cqf_comb(q_fid, q_dov));
2014-08-21 01:18:34 +04:00
u2z(fid);
u2z(dov);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__tstr: u2_cx_trel(u2t(gen), &p_gen, &q_gen, &r_gen);
_mint_used();
2013-12-26 21:12:07 +04:00
{
2014-09-03 07:36:29 +04:00
u2_noun sep = u2_cqfu_seep(van, sut, c3__both, q_gen);
2014-08-21 01:18:34 +04:00
u2_noun bid = u2nt(u2k(p_gen), u2k(q_gen), sep);
2014-09-03 07:36:29 +04:00
u2_noun boc = u2_cqf_bull(bid, sut);
2014-08-21 01:18:34 +04:00
u2_noun ret = _mint_in(van, boc, gol, r_gen);
2013-12-26 21:12:07 +04:00
u2z(bid);
u2z(boc);
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__cnts: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_mint_used();
2013-12-15 12:23:23 +04:00
{
2014-09-03 07:36:29 +04:00
u2_noun sec = u2_cqfu_seek(van, sut, c3__read, p_gen);
2014-08-21 01:18:34 +04:00
u2_noun lar = _mint_foil(sec);
u2_noun p_lar = u2h(lar);
u2_noun q_lar = u2t(lar);
u2_noun pq_lar = u2h(q_lar);
u2_noun qq_lar = u2t(q_lar);
2014-09-03 07:36:29 +04:00
u2_noun mew = u2_cqfu_snub(van, sut, q_gen);
2013-12-15 12:23:23 +04:00
u2_noun yom = _mint_edit
2014-08-21 01:18:34 +04:00
(van, sut, mew, p_lar, u2k(qq_lar), u2_nul);
u2_noun p_yom = u2h(yom);
u2_noun q_yom = u2t(yom);
u2_noun ret = u2nc
(_mint_nice(van, gol, u2k(p_yom)),
(0 == pq_lar) ? u2k(q_yom)
: u2nt(9,
u2k(pq_lar),
u2k(q_yom)));
u2z(yom);
u2z(mew);
u2z(lar);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__pmcl: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_mint_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun ruf = u2nt
(c3__clhp,
u2nc(u2_nul, 1),
u2k(p_gen));
u2_noun ret = _mint_grow(van, sut, gol, c3__zinc, ruf, q_gen);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2z(ruf);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__brcn: p_gen = u2t(gen);
_mint_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun ruf = u2nc(u2_nul, 1);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
ret = _mint_grow(van, sut, gol, c3__gold, ruf, p_gen);
u2z(ruf);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__pmcn: p_gen = u2t(gen);
_mint_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun ruf = u2nc(u2_nul, 1);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
ret = _mint_grow(van, sut, gol, c3__lead, ruf, p_gen);
u2z(ruf);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__pmls: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_mint_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun ruf = u2nt
(c3__clhp,
u2nc(u2_nul, 1),
u2k(p_gen));
u2_noun ret = _mint_grow(van, sut, gol, c3__iron, ruf, q_gen);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2z(ruf);
2013-09-29 00:21:18 +04:00
return ret;
2013-12-05 02:30:09 +04:00
}
2014-08-21 01:18:34 +04:00
case c3__sgzp: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_mint_used();
2013-12-05 02:30:09 +04:00
{
2014-09-03 07:36:29 +04:00
u2_noun typ = u2_cqfu_play(van, sut, p_gen);
u2_noun dug = u2_cqfu_duck(van, typ);
2013-12-05 02:30:09 +04:00
2014-08-21 01:18:34 +04:00
u2_ct_push(u2nc(c3__mean, dug));
2013-12-05 02:30:09 +04:00
{
2014-08-21 01:18:34 +04:00
ret = _mint_in(van, sut, gol, q_gen);
}
2014-08-21 01:18:34 +04:00
u2_ct_drop();
2013-12-05 02:30:09 +04:00
2014-08-21 01:18:34 +04:00
u2z(typ);
2013-12-05 02:30:09 +04:00
return ret;
2013-09-29 00:21:18 +04:00
}
2014-08-21 01:18:34 +04:00
case c3__sggr: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_mint_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun hum = _mint_in(van, sut, gol, q_gen);
2013-09-29 00:21:18 +04:00
u2_noun bez;
2014-08-21 01:18:34 +04:00
if ( u2_yes == u2ud(p_gen) ) {
bez = u2k(p_gen);
2013-09-29 00:21:18 +04:00
} else {
2014-08-21 01:18:34 +04:00
bez = u2nc(u2k(u2h(p_gen)),
_mint_corn(van, sut, u2t(p_gen)));
2013-09-29 00:21:18 +04:00
}
2014-08-21 01:18:34 +04:00
ret = u2nc(
u2k(u2h(hum)),
u2nt(10, bez, u2k(u2t(hum))));
2014-08-21 01:18:34 +04:00
u2z(hum);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__zpts: p_gen = u2t(gen);
_mint_used();
2013-09-29 00:21:18 +04:00
{
2014-09-03 09:46:55 +04:00
u2_noun von = u2_ci_molt(u2k(van), u2_cqfu_van_vet, u2_no, 0);
2014-08-21 01:18:34 +04:00
u2_noun sev = _mint_corn(von, sut, p_gen);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2z(von);
return u2nc(c3__noun, u2nc(1, sev));
2013-09-29 00:21:18 +04:00
}
2014-08-21 01:18:34 +04:00
case c3__zpcm: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_mint_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
return u2nc
(
_mint_nice(van,
gol,
2014-09-03 07:36:29 +04:00
u2_cqfu_play(van, sut, p_gen)),
2014-08-21 01:18:34 +04:00
u2nc(1, u2k(q_gen)));
2013-09-29 00:21:18 +04:00
}
2014-08-21 01:18:34 +04:00
case c3__zpcb: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_ct_push(u2nc(c3__mean, _mint_loc(van, p_gen)));
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun hum = _mint_in(van, sut, gol, q_gen);
u2_noun bez = u2nt(c3__spot, 1, u2k(p_gen));
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
ret = u2nc(
u2k(u2h(hum)),
u2nt(10, bez, u2k(u2t(hum))));
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2z(hum);
2013-09-29 00:21:18 +04:00
}
2014-08-21 01:18:34 +04:00
u2_ct_drop();
2013-09-29 00:21:18 +04:00
return ret;
}
case c3__zpcn:
2014-08-21 01:18:34 +04:00
_mint_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:24:29 +04:00
u2_noun pet = u2_cj_hook(u2k(van), "seed");
2014-08-21 01:18:34 +04:00
u2_noun p_pet = u2h(pet);
u2_noun q_pet = u2t(pet);
2013-09-29 00:21:18 +04:00
u2_noun ret;
2014-08-21 01:18:34 +04:00
ret = u2nc(_mint_nice(van, gol, u2k(p_pet)),
u2nc(1, u2k(q_pet)));
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2z(pet);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__zpsm: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_mint_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun vos = _mint_in(van, sut, c3__noun, q_gen);
2014-09-03 07:36:29 +04:00
u2_noun zur = u2_cqfu_play(van, sut, p_gen);
2014-08-21 01:18:34 +04:00
u2_noun p_vos = u2h(vos);
u2_noun q_vos = u2t(vos);
u2_noun waz = u2nc(1, u2k(p_vos));
2014-08-28 23:40:40 +04:00
u2_noun sif = u2k(zur);
2014-09-03 07:36:29 +04:00
u2_noun cig = u2_cqf_cell(sif, p_vos);
2013-09-29 00:21:18 +04:00
u2_noun ret;
2014-08-21 01:18:34 +04:00
ret = u2nc(
_mint_nice(van, gol, cig),
2014-09-03 07:36:29 +04:00
u2_cqf_cons(waz, q_vos));
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2z(waz);
u2z(zur);
u2z(sif);
u2z(vos);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__zpfs: p_gen = u2t(gen);
_mint_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
if ( u2_yes == _mint_vet(van) ) {
2014-09-03 07:36:29 +04:00
u2_noun zur = u2_cqfu_play(van, sut, p_gen);
u2_noun dun = u2_cqfu_dunq(van, "lost", zur);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2_ct_push(u2nc(c3__mean, dun));
return u2_cm_error("mint-lost");
2013-09-29 00:21:18 +04:00
}
else {
2014-08-21 01:18:34 +04:00
return u2nt(c3__void, 0, 0);
2013-09-29 00:21:18 +04:00
}
}
case c3__zpzp:
2014-08-21 01:18:34 +04:00
_mint_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
return u2nt(c3__void, 0, 0);
2013-09-29 00:21:18 +04:00
}
}
}
2014-09-04 01:33:18 +04:00
u2_noun
2014-09-03 09:46:55 +04:00
_cqfu_mint(
2014-09-04 01:33:18 +04:00
u2_noun van,
u2_noun sut,
2013-09-29 00:21:18 +04:00
u2_noun gol,
2014-09-04 01:33:18 +04:00
u2_noun gen)
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
return _mint_in(van, sut, gol, gen);
2013-09-29 00:21:18 +04:00
}
/* boilerplate
*/
2014-09-04 01:33:18 +04:00
u2_noun
u2_cwfu_mint(u2_noun cor)
2013-09-29 00:21:18 +04:00
{
u2_noun sut, gol, gen, van;
2014-08-21 01:18:34 +04:00
if ( (u2_no == u2_cr_mean(cor, u2_cv_sam_2, &gol,
2013-09-29 00:21:18 +04:00
u2_cv_sam_3, &gen,
u2_cv_con, &van,
2013-09-29 00:21:18 +04:00
0)) ||
2014-08-21 01:18:34 +04:00
(u2_none == (sut = u2_cr_at(u2_cv_sam, van))) )
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
return u2_cm_bail(c3__fail);
2013-09-29 00:21:18 +04:00
} else {
2014-09-03 09:46:55 +04:00
return _cqfu_mint(van, sut, gol, gen);
2013-09-29 00:21:18 +04:00
}
}
2014-09-04 01:33:18 +04:00
u2_noun
u2_cqfu_mint(u2_noun van,
u2_noun sut,
u2_noun gol,
u2_noun gen)
2013-09-29 00:21:18 +04:00
{
2014-08-28 23:40:40 +04:00
c3_m fun_m = c3__mint;
2014-09-03 09:46:55 +04:00
u2_noun vrf = u2_cr_at(u2_cqfu_van_vrf, van);
2014-08-28 23:40:40 +04:00
u2_noun pro = u2_cz_find_4(fun_m, vrf, sut, gol, gen);
2013-09-29 00:21:18 +04:00
2014-08-28 23:40:40 +04:00
if ( u2_none != pro ) {
return pro;
2013-09-29 00:21:18 +04:00
}
else {
2014-09-03 09:46:55 +04:00
pro = _cqfu_mint(van, sut, gol, gen);
2013-09-29 00:21:18 +04:00
2014-08-28 23:40:40 +04:00
return u2_cz_save_4(fun_m, vrf, sut, gol, gen, pro);
2013-09-29 00:21:18 +04:00
}
}