Support ^% switch to ++aq instead of ++ap.

This commit is contained in:
C. Guy Yarvin 2017-12-06 16:33:49 -08:00
parent 62b20b56ee
commit cb46432b9b
5 changed files with 73 additions and 31 deletions

View File

@ -217,6 +217,7 @@
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_nepo(u3_noun, u3_noun);
u3_noun u3qfp_rake(u3_noun);
# define u3qfu_van_fan 28
@ -294,6 +295,7 @@
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_rake(u3_noun);
# define u3qzu_van_fan 28

View File

@ -1039,3 +1039,59 @@
return u3qfp_open(ter, gen);
}
}
/* boilerplate
*
*/
static u3_noun
_aq_core(u3_noun ter,
u3_noun gen)
{
u3_noun gat = u3j_hook(u3k(ter), "ap");
return u3i_molt(gat, u3x_sam, u3k(gen), 0);
}
/* open
*/
static u3_noun
_aq_open_n(u3_noun ter,
u3_noun gen)
{
u3_noun cor = _aq_core(ter, gen);
return u3j_soft(cor, "open");
}
static u3_noun
_aq_open_l(u3_noun ter,
u3_noun gen)
{
u3_noun pro = _open_in(ter, gen);
if ( u3_none != pro ) {
return pro;
} else {
return _aq_open_n(ter, gen);
}
}
u3_noun
u3qfp_nepo(u3_noun ter,
u3_noun gen)
{
return _aq_open_l(ter, gen);
}
u3_noun
u3wfp_nepo(u3_noun cor)
{
u3_noun gen;
if ( u3_none == (gen = u3r_at(u3x_sam, cor)) ) {
return u3m_bail(c3__fail);
} else {
u3_noun ter = u3r_at(u3x_con, cor);
return u3qfp_nepo(ter, gen);
}
}

View File

@ -388,8 +388,10 @@
}
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 = u3qfp_open(ter, gen);
u3_noun rex = (c3n == fab) ? u3qfp_nepo(ter, gen)
: u3qfp_open(ter, gen);
ret = _mint_in(van, sut, gol, rex);
u3z(rex);
@ -414,8 +416,10 @@
}
} 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 = u3qfp_open(ter, gen);
u3_noun rex = (c3n == fab) ? u3qfp_nepo(ter, gen)
: u3qfp_open(ter, gen);
if ( c3y == u3r_sing(rex, gen) ) {
#if 1
@ -813,7 +817,6 @@
case c3__ktcn: p_gen = u3t(gen);
_mint_used();
#if 0
{
u3_noun von = u3i_molt(u3k(van), u3qfu_van_fab, c3n, 0);
u3_noun ret = _mint_in(von, sut, gol, p_gen);
@ -821,33 +824,9 @@
u3z(von);
return ret;
}
#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 pro;
}
#endif
case c3__cold: p_gen = u3t(gen);
_mint_used();
#if 0
{
u3_noun von = u3i_molt(u3k(van), u3qfu_van_fab, c3n, 0);
u3_noun ret = _mint_in(von, sut, gol, p_gen);
u3z(von);
return ret;
}
#else
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "blow");
@ -861,7 +840,6 @@
0));
return pro;
}
#endif
case c3__zpcm: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();

View File

@ -340,8 +340,10 @@
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 = u3qfp_open(ter, gen);
u3_noun rex = (c3n == fab) ? u3qfp_nepo(ter, gen)
: u3qfp_open(ter, gen);
ret = _mull_in(van, sut, gol, dox, rex);
u3z(rex);
@ -365,8 +367,10 @@
}
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 = u3qfp_open(ter, gen);
u3_noun rex = (c3n == fab) ? u3qfp_nepo(ter, gen)
: u3qfp_open(ter, gen);
if ( c3y == u3r_sing(rex, gen) ) {
#if 1

View File

@ -216,8 +216,10 @@
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 = u3qfp_open(ter, gen);
u3_noun rex = (c3n == fab) ? u3qfp_nepo(ter, gen)
: u3qfp_open(ter, gen);
u3_noun ret;
if ( c3y == u3r_sing(rex, gen) ) {