From 43e1588ba2ab05810ab815bfc43852bf5a44b28e Mon Sep 17 00:00:00 2001 From: "C. Guy Yarvin" Date: Sat, 8 Oct 2016 21:41:50 -0700 Subject: [PATCH] Add %use rune (=,). --- include/jets/q.h | 1 + jets/f/ut_buss.c | 55 +++++++++++++++++++++++++++++++++++++++++------- jets/f/ut_mint.c | 10 +++++++++ jets/f/ut_mull.c | 13 ++++++++++++ jets/f/ut_play.c | 10 +++++++++ 5 files changed, 81 insertions(+), 8 deletions(-) diff --git a/include/jets/q.h b/include/jets/q.h index acaeea878f..19cbc63943 100644 --- a/include/jets/q.h +++ b/include/jets/q.h @@ -211,6 +211,7 @@ # define u3qfu_van_fab 119 u3_noun u3qfu_burn(u3_noun, u3_noun); + u3_noun u3qfu_busk(u3_noun, u3_noun, u3_noun); u3_noun u3qfu_buss(u3_noun, u3_noun, u3_noun, u3_noun); u3_noun u3qfu_bust(u3_noun, u3_noun, u3_noun); u3_noun u3qfu_conk(u3_noun, u3_noun, u3_noun); diff --git a/jets/f/ut_buss.c b/jets/f/ut_buss.c index 578abc705f..eda3255203 100644 --- a/jets/f/ut_buss.c +++ b/jets/f/ut_buss.c @@ -12,16 +12,29 @@ u3_noun cog, u3_noun gen) { - u3_noun cug, ret; + u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0); + u3_noun gat = u3j_hook(von, "buss"); - cug = u3nc(u3nt(u3nt(u3k(cog), u3_nul, u3k(gen)), - u3_nul, - u3_nul), - u3_nul); - ret = u3qf_face(cug, sut); + return u3n_kick_on(u3i_molt(gat, + u3x_sam_2, + u3k(cog), + u3x_sam_3, + u3k(gen), + 0)); + } - u3z(cug); - return ret; + u3_noun + _cqfu_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 @@ -52,3 +65,29 @@ { return _cqfu_buss(van, sut, cog, gen); } + + + u3_noun + u3wfu_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 _cqfu_busk(van, sut, gen); + } + } + + u3_noun + u3qfu_busk(u3_noun van, + u3_noun sut, + u3_noun gen) + { + return _cqfu_busk(van, sut, gen); + } + diff --git a/jets/f/ut_mint.c b/jets/f/ut_mint.c index b964fb7614..fdcf923bca 100644 --- a/jets/f/ut_mint.c +++ b/jets/f/ut_mint.c @@ -676,6 +676,16 @@ return ret; } + case c3__use: u3x_cell(u3t(gen), &p_gen, &q_gen); + _mint_used(); + { + u3_noun boc = u3qfu_busk(van, sut, p_gen); + u3_noun ret = _mint_in(van, boc, gol, q_gen); + + u3z(boc); + return ret; + } + case c3__make: u3x_cell(u3t(gen), &p_gen, &q_gen); _mint_used(); { diff --git a/jets/f/ut_mull.c b/jets/f/ut_mull.c index f8c9f4181a..89970527fc 100644 --- a/jets/f/ut_mull.c +++ b/jets/f/ut_mull.c @@ -620,6 +620,19 @@ return ret; } + case c3__use: u3x_cell(u3t(gen), &p_gen, &q_gen); + _mull_used(); + { + u3_noun boc = u3qfu_busk(van, sut, p_gen); + u3_noun nuf = u3qfu_busk(van, dox, p_gen); + u3_noun ret = _mull_in(van, boc, gol, nuf, q_gen); + + u3z(boc); + u3z(nuf); + + return ret; + } + case c3__make: u3x_cell(u3t(gen), &p_gen, &q_gen); _mull_used(); { diff --git a/jets/f/ut_play.c b/jets/f/ut_play.c index 78afe68e35..645824943a 100644 --- a/jets/f/ut_play.c +++ b/jets/f/ut_play.c @@ -389,6 +389,16 @@ return ret; } + case c3__use: u3x_cell(u3t(gen), &p_gen, &q_gen); + _play_used(); + { + u3_noun boc = u3qfu_busk(van, sut, p_gen); + u3_noun ret = _play_x(van, boc, q_gen); + + u3z(boc); + return ret; + } + case c3__make: u3x_cell(u3t(gen), &p_gen, &q_gen); _play_used(); {