Finish integrating %form in +type.

This commit is contained in:
Curtis Yarvin 2018-04-24 21:57:54 -07:00
parent b59aa59951
commit a2e2dee3db
16 changed files with 33 additions and 309 deletions

View File

@ -308,7 +308,6 @@ J_F_OFILES=\
J_F_OFILES_UT=\
jets/f/ut.o \
jets/f/ut_burn.o \
jets/f/ut_buss.o \
jets/f/ut_conk.o \
jets/f/ut_crop.o \

View File

@ -204,7 +204,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_form(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);
@ -282,7 +282,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_form(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);

View File

@ -233,7 +233,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_form(u3_noun);
u3_noun u3wf_hike(u3_noun);
u3_noun u3wf_look(u3_noun);
u3_noun u3wf_loot(u3_noun);

View File

@ -7,25 +7,26 @@
/* functions
*/
u3_noun
u3qf_help(u3_noun sag,
u3qf_form(u3_noun sag,
u3_noun tip)
{
if ( c3__void == tip ) {
return c3__void;
}
else return u3nt(c3__help,
u3k(sag),
u3k(tip));
if ( c3__noun == tip ) {
return c3__noun;
}
else return u3nt(c3__form, u3k(sag), u3k(tip));
}
u3_noun
u3wf_help(u3_noun cor)
u3wf_form(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 u3qf_form(sag, tip);
}
}

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

@ -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__form: 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_form(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__form:
case c3__face: u3x_cell(u3t(ref), &p_ref, &q_ref);
{
return _crop_dext(van, sut, q_ref, bix);

View File

@ -675,10 +675,10 @@
// fprintf(stderr, "core\r\n");
return _find_buck_core(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
case c3__help:
case c3__form:
{
u3_noun fop = u3qfu_repo(van, sut);
u3_noun pro = _find_buck(van, fop, way, p_heg, q_heg, axe, lon, gil);
u3_noun pro = _find_bucx(van, fop, way, p_heg, q_heg, axe, lon, gil);
u3z(fop);
return pro;
}

View File

@ -92,7 +92,7 @@
case c3__core: {
return u3m_error("fish-core");
}
case c3__help:
case c3__form:
case c3__face: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);

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__form: 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_form(p_sut, vot);
u3z(vot);
return ret;

View File

@ -539,12 +539,12 @@
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 hum = _mint_in(van, sut, gol, q_gen);
u3_noun ret = u3nc(u3qf_help(p_gen, u3h(hum)),
u3_noun ret = u3nc(u3qf_form(p_gen, u3h(hum)),
u3k(u3t(hum)));
u3z(hum);
return ret;
@ -556,7 +556,7 @@
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)),
u3_noun ret = u3nc(u3qf_form(hep, u3h(hum)),
u3k(u3t(hum)));
u3z(hep);
@ -564,23 +564,6 @@
return ret;
}
case c3__form: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun hum = _mint_in(van, sut, gol, q_gen);
if ( c3__void == u3h(hum) ) {
return hum;
}
else {
ret = u3nc(u3nt(c3__form, u3nc(u3k(sut), u3k(p_gen)), u3k(u3h(hum))),
u3k(u3t(hum)));
u3z(hum);
return ret;
}
}
case c3__ktts: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{

View File

@ -521,51 +521,12 @@
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__form: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun vat = _mull_in(van, sut, gol, dox, q_gen);
u3_noun nup, dur;
if ( c3__void == u3h(vat) ) {
nup = c3__void;
}
else {
nup = u3nt(c3__form, u3nc(u3k(sut), u3k(p_gen)), u3k(u3h(vat)));
}
if ( c3__void == u3t(vat) ) {
dur = c3__void;
}
else {
dur = u3nt(c3__form, u3nc(u3k(dox), u3k(p_gen)), u3k(u3t(vat)));
}
ret = u3nc(nup, dur);
u3_noun ret = u3nc(u3qf_form(p_gen, u3h(vat)),
u3qf_form(p_gen, u3t(vat)));
u3z(vat);
return ret;

View File

@ -283,7 +283,7 @@
else return _nest_sint(van, sut, tel, ref, seg, reg, gil);
}
}
case c3__help:
case c3__form:
case c3__face: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);
@ -447,7 +447,7 @@
u3z(gam);
return hiv;
}
case c3__help:
case c3__form:
case c3__face: {
if ( c3n == u3r_trel(ref, 0, &p_ref, &q_ref) ) {
return u3m_bail(c3__fail);

View File

@ -128,7 +128,7 @@
return pro;
}
}
case c3__help:
case c3__form:
case c3__face: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);

View File

@ -378,41 +378,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);
_play_used();
{
u3_noun boc = _play_x(van, sut, q_gen);
u3_noun ret = u3qf_help(p_gen, boc);
u3_noun ret = u3qf_form(p_gen, boc);
u3z(boc);
return ret;
}
case c3__form: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun boc = _play_x(van, sut, q_gen);
if ( c3__void == boc ) {
return boc;
}
else {
return u3nt(c3__form, u3nc(u3k(sut), u3k(p_gen)), boc);
}
}
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();
{

View File

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

View File

@ -105,7 +105,7 @@ static u3j_core _143_hex_d[] =
static u3j_harm _143_pen_comb_a[] = {{".2", u3wf_comb}, {}};
static u3j_harm _143_pen_cons_a[] = {{".2", u3wf_cons}, {}};
static u3j_harm _143_pen_core_a[] = {{".2", u3wf_core}, {}};
static u3j_harm _143_pen_help_a[] = {{".2", u3wf_help}, {}};
static u3j_harm _143_pen_form_a[] = {{".2", u3wf_form}, {}};
static u3j_harm _143_pen_face_a[] = {{".2", u3wf_face}, {}};
static u3j_harm _143_pen_fitz_a[] = {{".2", u3wf_fitz}, {}};
static u3j_harm _143_pen_flan_a[] = {{".2", u3wf_flan}, {}};
@ -116,7 +116,6 @@ static u3j_core _143_hex_d[] =
static u3j_harm _143_pen_look_a[] = {{".2", u3wf_look}, {}};
static u3j_harm _143_pen_loot_a[] = {{".2", u3wf_loot}, {}};
static u3j_harm _143_pen__ut_burn_a[] = {{".2", u3wfu_burn}, {}};
static u3j_harm _143_pen__ut_conk_a[] = {{".2", u3wfu_conk}, {}};
static u3j_harm _143_pen__ut_crop_a[] = {{".2", u3wfu_crop}, {}};
// static u3j_harm _143_pen__ut_fire_a[] = {{".2", u3wfu_fire}, {}};
@ -133,7 +132,6 @@ static u3j_core _143_hex_d[] =
static u3j_harm _143_pen__ut_wrap_a[] = {{".2", u3wfu_wrap}, {}};
static u3j_core _143_pen__ut_d[] =
{
{ "burn", _143_pen__ut_burn_a },
{ "conk", _143_pen__ut_conk_a },
{ "crop", _143_pen__ut_crop_a },
{ "fond", _143_pen__ut_fond_a },
@ -151,8 +149,7 @@ static u3j_core _143_hex_d[] =
{}
};
static u3j_harm _143_pen__ut_a[] =
{ {"burn", u3wfu_burn},
{"repo", u3wfu_repo},
{ {"repo", u3wfu_repo},
{}
};
@ -182,7 +179,7 @@ static u3j_core _143_pen_d[] =
{ "flip", _143_pen_flip_a },
{ "flor", _143_pen_flor_a },
{ "fork", _143_pen_fork_a },
{ "help", _143_pen_help_a },
{ "form", _143_pen_form_a },
{ "hike", _143_pen_hike_a },
{ "look", _143_pen_look_a },
{ "loot", _143_pen_loot_a },