shrub/j/f/ap.c

1087 lines
24 KiB
C
Raw Normal View History

2013-09-29 00:21:18 +04:00
/* j/6/ap.c
**
*/
#include "all.h"
2014-09-04 07:10:43 +04:00
2013-09-29 00:21:18 +04:00
/** forward declares
**/
2014-11-06 22:13:57 +03:00
u3_noun u3wfp_rake(u3_noun);
u3_noun u3wfp_open(u3_noun);
u3_noun u3wfp_hack(u3_noun);
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
static u3_noun
_ap_open_l(u3_noun, u3_noun);
2013-09-29 00:21:18 +04:00
// make sure these match the array below!
//
# define _ap_jet_open 0
# define _ap_jet_rake 1
# define _ap_jet_hack 2
2014-09-06 00:13:24 +04:00
static u3_noun
_open_in(u3_noun ter, u3_noun gen);
2013-09-29 00:21:18 +04:00
2014-09-02 04:10:04 +04:00
/* ~(. al gen)
*/
2014-09-06 00:13:24 +04:00
static u3_noun
2014-09-17 23:56:55 +04:00
_al_core(u3_noun ter, u3_noun gen)
2014-06-17 22:04:27 +04:00
{
2014-11-06 03:20:01 +03:00
u3_noun gat = u3j_hook(u3k(ter), "al");
2014-09-04 01:33:18 +04:00
2014-11-18 00:56:51 +03:00
return u3i_molt(gat, u3x_sam, u3k(gen), 0);
2014-06-17 22:04:27 +04:00
}
2014-10-10 05:27:02 +04:00
/* van is transferred, gen is retained
*/
static u3_noun
_ap_bunt(u3_noun van, u3_noun gen)
{
2014-11-06 22:13:57 +03:00
u3_noun pro = u3qfl_bunt(van, gen);
2014-10-10 05:27:02 +04:00
u3z(van);
return pro;
}
2013-09-29 00:21:18 +04:00
/** open cases
**/
#define _open_do_p(stem) \
2014-09-06 00:13:24 +04:00
static u3_noun _open_in_##stem \
( u3_noun ter, u3_noun p_gen)
2013-09-29 00:21:18 +04:00
#define _open_do_pq(stem) \
2014-09-06 00:13:24 +04:00
static u3_noun _open_in_##stem \
( u3_noun ter, u3_noun p_gen, u3_noun q_gen)
2013-09-29 00:21:18 +04:00
#define _open_do_pqr(stem) \
2014-09-06 00:13:24 +04:00
static u3_noun _open_in_##stem \
( u3_noun ter, u3_noun p_gen, u3_noun q_gen, u3_noun r_gen)
2013-09-29 00:21:18 +04:00
#define _open_do_pqrs(stem) \
2014-09-06 00:13:24 +04:00
static u3_noun _open_in_##stem \
( u3_noun ter, u3_noun p_gen, u3_noun q_gen, u3_noun r_gen, \
u3_noun s_gen)
2013-09-29 00:21:18 +04:00
/***
****
***/
2014-06-17 22:04:27 +04:00
_open_do_pq(tsbr) // =:
{
return
2014-09-06 00:13:24 +04:00
u3nt(c3__tsls,
2014-10-10 05:27:02 +04:00
_ap_bunt(
2014-08-21 01:18:34 +04:00
_al_core(ter, p_gen), p_gen),
2014-09-06 00:13:24 +04:00
u3k(q_gen));
2014-06-17 22:04:27 +04:00
}
_open_do_pq(tscl) // =:
{
2014-09-06 00:13:24 +04:00
return u3nt(c3__tsgr,
u3nt(c3__cncb,
u3nc(u3nc(u3_nul, 1),
u3_nul),
u3k(p_gen)),
u3k(q_gen));
}
_open_do_pqr(tsdt) // =.
{
return
2014-09-06 00:13:24 +04:00
u3nt(c3__tsgr,
u3nt(c3__cncb,
u3nc(u3nc(u3_nul, 1),
u3_nul),
u3nc(u3nc(u3k(p_gen),
u3k(q_gen)),
u3_nul)),
u3k(r_gen));
}
2013-09-29 00:21:18 +04:00
_open_do_pq(tsgl) // =<
{
2014-09-06 00:13:24 +04:00
return u3nt(c3__tsgr, u3k(q_gen),
u3k(p_gen));
2013-09-29 00:21:18 +04:00
}
_open_do_pq(tshp) // =-
{
2014-09-06 00:13:24 +04:00
return u3nt(c3__tsls, u3k(q_gen),
u3k(p_gen));
2013-09-29 00:21:18 +04:00
}
_open_do_pq(tsls) // =+
{
2014-09-06 00:13:24 +04:00
return u3nt
2014-08-21 01:18:34 +04:00
(c3__tsgr,
2014-09-06 00:13:24 +04:00
u3nc(u3k(p_gen),
u3nc(u3_nul, 1)),
u3k(q_gen));
2013-09-29 00:21:18 +04:00
}
2014-06-19 00:09:04 +04:00
_open_do_p(tssg) // =~
{
2014-11-05 04:18:47 +03:00
if ( !_(u3du(p_gen)) ) {
2014-11-04 23:20:44 +03:00
return u3nc(0, 1);
} else {
u3_noun tp_gen = u3t(p_gen);
u3_noun ip_gen = u3h(p_gen);
if ( (u3_nul == p_gen) ) {
return u3nc(u3_blip, 1);
}
else if ( (u3_nul == tp_gen) ) {
return u3k(ip_gen);
}
else {
return u3nt(c3__tsgr,
u3k(ip_gen),
_open_in_tssg(ter, tp_gen));
}
2014-06-19 00:09:04 +04:00
}
}
2013-09-29 00:21:18 +04:00
/***
****
***/
2014-06-17 22:04:27 +04:00
_open_do_p(bccb) // $_
{
2014-10-10 05:27:02 +04:00
return _ap_bunt(_al_core(ter, p_gen), p_gen);
2014-06-17 22:04:27 +04:00
}
_open_do_p(bctr) // $*
{
return
2014-09-06 00:13:24 +04:00
u3nc(c3__ktsg,
2014-10-10 05:27:02 +04:00
_ap_bunt(
2014-08-21 01:18:34 +04:00
_al_core(ter, p_gen),
2014-06-17 22:04:27 +04:00
p_gen));
}
_open_do_p(bczp) // $!
{
2014-09-06 00:13:24 +04:00
return u3nt
(c3__bccb, c3__axil, u3k(p_gen));
}
/***
****
2013-09-29 00:21:18 +04:00
***/
_open_do_p(brhp) // |-
{
2014-09-06 00:13:24 +04:00
return u3nt
2014-08-21 01:18:34 +04:00
(c3__tsgl,
2014-09-06 00:13:24 +04:00
u3nc(c3__cnzy, u3_blip),
u3nc(c3__brdt, u3k(p_gen)));
2013-09-29 00:21:18 +04:00
}
_open_do_p(brdt) // |.
{
2014-09-06 00:13:24 +04:00
return u3nc
2014-08-21 01:18:34 +04:00
(c3__brcn,
2014-09-06 00:13:24 +04:00
u3nt(
u3nt(u3_blip, c3__ash, u3k(p_gen)),
u3_nul,
u3_nul));
2013-09-29 00:21:18 +04:00
}
2014-06-11 01:31:16 +04:00
2013-09-29 00:21:18 +04:00
/***
****
***/
_open_do_p(wtbr) // ?|
{
2014-09-06 00:13:24 +04:00
if ( (u3_nul == p_gen) ) {
2014-11-05 04:18:47 +03:00
return u3nt(c3__dtzz, 'f', c3n);
2013-09-29 00:21:18 +04:00
}
else {
2014-09-06 00:13:24 +04:00
u3_noun ip_gen = u3h(p_gen);
u3_noun tp_gen = u3t(p_gen);
2014-08-21 01:18:34 +04:00
2014-09-06 00:13:24 +04:00
return u3nq
2014-08-21 01:18:34 +04:00
(c3__wtcl,
2014-09-06 00:13:24 +04:00
u3k(ip_gen),
2014-11-05 04:18:47 +03:00
u3nt(c3__dtzz, 'f', c3y),
2014-08-21 01:18:34 +04:00
_open_in_wtbr(ter, tp_gen));
2013-09-29 00:21:18 +04:00
}
}
2014-06-11 04:51:43 +04:00
_open_do_pqr(wtkt) // ?^
{
2014-09-06 00:13:24 +04:00
return u3nq
2014-08-21 01:18:34 +04:00
(c3__wtcl,
2014-09-06 00:13:24 +04:00
u3nt(c3__wtts,
u3nt(c3__axil, c3__atom, u3_blip),
u3k(p_gen)),
u3k(r_gen),
u3k(q_gen));
2014-06-11 04:51:43 +04:00
}
2013-09-29 00:21:18 +04:00
_open_do_pq(wtgl) // ?<
{
2014-09-06 00:13:24 +04:00
return u3nq
2014-08-21 01:18:34 +04:00
(c3__wtcl,
2014-09-06 00:13:24 +04:00
u3k(p_gen),
u3nc(c3__zpzp, u3_nul),
u3k(q_gen));
2013-09-29 00:21:18 +04:00
}
_open_do_pqr(wtdt) // ?.
{
2014-09-06 00:13:24 +04:00
return u3nq(c3__wtcl,
u3k(p_gen),
u3k(r_gen),
u3k(q_gen));
2013-09-29 00:21:18 +04:00
}
_open_do_pq(wtgr) // ?>
{
2014-09-06 00:13:24 +04:00
return u3nq
2014-08-21 01:18:34 +04:00
(c3__wtcl,
2014-09-06 00:13:24 +04:00
u3k(p_gen),
u3k(q_gen),
u3nc(c3__zpzp, u3_nul));
2013-09-29 00:21:18 +04:00
}
2014-06-16 23:19:33 +04:00
_open_do_pq(wthp) // ?-
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
if ( (u3_nul == q_gen) ) {
return u3nc(c3__zpfs,
u3nc(c3__cnzz,
u3k(p_gen)));
2013-09-29 00:21:18 +04:00
}
else {
2014-09-06 00:13:24 +04:00
u3_noun iq_gen = u3h(q_gen);
u3_noun tq_gen = u3t(q_gen);
u3_noun piq_gen = u3h(iq_gen);
u3_noun qiq_gen = u3t(iq_gen);
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
return u3nq
2014-08-21 01:18:34 +04:00
(
2013-09-29 00:21:18 +04:00
c3__wtcl,
2014-09-06 00:13:24 +04:00
u3nt(c3__wtts,
u3k(piq_gen),
u3k(p_gen)),
u3k(qiq_gen),
2014-08-21 01:18:34 +04:00
_open_in_wthp(ter, p_gen, tq_gen));
2013-09-29 00:21:18 +04:00
}
}
_open_do_p(wtpm) // ?&
{
2014-09-06 00:13:24 +04:00
if ( (u3_nul == p_gen) ) {
2014-11-05 04:18:47 +03:00
return u3nt(c3__dtzz, 'f', c3y);
2013-09-29 00:21:18 +04:00
}
else {
2014-09-06 00:13:24 +04:00
u3_noun ip_gen = u3h(p_gen);
u3_noun tp_gen = u3t(p_gen);
2014-08-21 01:18:34 +04:00
2014-09-06 00:13:24 +04:00
return u3nq
2014-08-21 01:18:34 +04:00
(c3__wtcl,
2014-09-06 00:13:24 +04:00
u3k(ip_gen),
2014-08-21 01:18:34 +04:00
_open_in_wtpm(ter, tp_gen),
2014-11-05 04:18:47 +03:00
u3nt(c3__dtzz, 'f', c3n));
2013-09-29 00:21:18 +04:00
}
}
_open_do_pqr(wtls) // ?+
2014-09-06 00:13:24 +04:00
{ u3_noun tul = u3nc(
u3nc(u3nc(c3__axil, c3__noun),
u3k(q_gen)),
u3_nul);
2014-11-06 22:13:57 +03:00
u3_noun zal = u3qb_weld(r_gen, tul);
2014-09-06 00:13:24 +04:00
u3_noun ret = u3nt(c3__wthp, u3k(p_gen), zal);
u3z(tul);
2013-09-29 00:21:18 +04:00
return ret;
2014-06-14 00:52:13 +04:00
}
_open_do_pqr(wtpt) // ?@
{
2014-09-06 00:13:24 +04:00
return u3nq(c3__wtcl,
u3nt(c3__wtts,
u3nt(c3__axil,
2014-06-14 00:52:13 +04:00
c3__atom,
2014-09-06 00:13:24 +04:00
u3_blip),
u3k(p_gen)),
u3k(q_gen),
u3k(r_gen));
2014-06-14 00:52:13 +04:00
}
_open_do_pqr(wtsg) // ?~
{
2014-09-06 00:13:24 +04:00
return u3nq(c3__wtcl,
u3nt(c3__wtts,
u3nc(c3__axil, c3__null),
u3k(p_gen)),
u3k(q_gen),
u3k(r_gen));
2013-09-29 00:21:18 +04:00
}
_open_do_p(wtzp) // ?!
{
2014-09-06 00:13:24 +04:00
return u3nq
2014-08-21 01:18:34 +04:00
(c3__wtcl,
2014-09-06 00:13:24 +04:00
u3k(p_gen),
2014-11-05 04:18:47 +03:00
u3nt(c3__dtzz, 'f', c3n),
u3nt(c3__dtzz, 'f', c3y));
2013-09-29 00:21:18 +04:00
}
/***
****
2014-06-13 02:22:25 +04:00
***/
2014-06-18 21:38:34 +04:00
_open_do_pq(zpcb) // !_
{
2014-09-06 00:13:24 +04:00
return u3k(q_gen);
2014-06-18 21:38:34 +04:00
}
2014-06-13 02:22:25 +04:00
_open_do_p(zpgr) // !>
{
2014-09-06 00:13:24 +04:00
return u3nq
2014-08-21 01:18:34 +04:00
(c3__cnhp,
2014-09-06 00:13:24 +04:00
u3nc(c3__cnzy, c3__onan),
u3nt(c3__zpsm,
u3nc(c3__bctr,
u3nc(c3__herb,
u3nc(c3__cnzy,
2014-06-13 02:22:25 +04:00
c3__abel))),
2014-09-06 00:13:24 +04:00
u3k(p_gen)),
u3_nul);
2014-06-13 02:22:25 +04:00
}
/***
****
2013-09-29 00:21:18 +04:00
***/
2014-06-05 06:46:12 +04:00
_open_do_pq(clhp) // :-
{
2014-09-06 00:13:24 +04:00
return u3nc
(u3k(p_gen),
u3k(q_gen));
2014-06-05 06:46:12 +04:00
}
_open_do_pq(clcb) // :_
{
2014-09-06 00:13:24 +04:00
return u3nc
(u3k(q_gen),
u3k(p_gen));
2014-06-05 06:46:12 +04:00
}
2014-06-13 02:22:25 +04:00
_open_do_p(clcn) // :%
{
2014-09-06 00:13:24 +04:00
return u3nc
(u3nc(c3__clsg,
u3k(p_gen)),
u3nc(c3__bczp, c3__null));
2014-06-13 02:22:25 +04:00
}
2013-09-29 00:21:18 +04:00
_open_do_pqrs(clkt) // :^
{
2014-09-06 00:13:24 +04:00
return u3nq
(u3k(p_gen),
u3k(q_gen),
u3k(r_gen),
u3k(s_gen));
2013-09-29 00:21:18 +04:00
}
_open_do_pqr(clls) // :+
{
2014-09-06 00:13:24 +04:00
return u3nt
(u3k(p_gen), u3k(q_gen), u3k(r_gen));
2013-09-29 00:21:18 +04:00
}
_open_do_p(clsg) // :~
{
2014-09-06 00:13:24 +04:00
if ( (u3_nul == p_gen) ) {
return u3nt(c3__dtzz, 'n', u3_nul);
2013-09-29 00:21:18 +04:00
}
else {
2014-09-06 00:13:24 +04:00
u3_noun ip_gen = u3h(p_gen);
u3_noun tp_gen = u3t(p_gen);
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
return u3nc(u3k(ip_gen),
2014-08-21 01:18:34 +04:00
_open_in_clsg(ter, tp_gen));
2013-09-29 00:21:18 +04:00
}
}
_open_do_p(cltr) // :*
{
2014-09-06 00:13:24 +04:00
if ( (u3_nul == p_gen) ) {
return u3nc(c3__zpzp, u3_nul);
2013-09-29 00:21:18 +04:00
}
else {
2014-09-06 00:13:24 +04:00
u3_noun ip_gen = u3h(p_gen);
u3_noun tp_gen = u3t(p_gen);
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
if ( (u3_nul == tp_gen) ) {
return u3k(ip_gen);
2013-09-29 00:21:18 +04:00
} else {
2014-09-06 00:13:24 +04:00
return u3nc
(u3k(ip_gen),
2014-08-21 01:18:34 +04:00
_open_in_cltr(ter, tp_gen));
2013-09-29 00:21:18 +04:00
}
}
}
/***
****
***/
_open_do_pq(cncb) // %_
{
2014-09-06 00:13:24 +04:00
return u3nc
2014-08-21 01:18:34 +04:00
(c3__ktls,
2014-09-06 00:13:24 +04:00
u3nq(u3nc(c3__cnzz, u3k(p_gen)),
c3__cnts,
2014-09-06 00:13:24 +04:00
u3k(p_gen),
u3k(q_gen)));
}
2015-03-07 04:15:51 +03:00
#if 0
2013-09-29 00:21:18 +04:00
_open_do_pq(cncl) // %:
{
2014-09-06 00:13:24 +04:00
return u3nq
2014-08-21 01:18:34 +04:00
(c3__cnsg,
2014-09-06 00:13:24 +04:00
u3nc(u3_blip, u3_nul),
u3k(p_gen),
u3k(q_gen));
2013-09-29 00:21:18 +04:00
}
2015-03-07 04:15:51 +03:00
#endif
2013-09-29 00:21:18 +04:00
_open_do_pq(cndt) // %.
{
2014-09-06 00:13:24 +04:00
return u3nt
2014-08-21 01:18:34 +04:00
(c3__cnhp,
2014-09-06 00:13:24 +04:00
u3k(q_gen),
u3nc(u3k(p_gen), u3_nul));
2013-09-29 00:21:18 +04:00
}
_open_do_pqrs(cnkt) // %^
{
2014-09-06 00:13:24 +04:00
return u3nq
2014-08-21 01:18:34 +04:00
(c3__cnhp,
2014-09-06 00:13:24 +04:00
u3k(p_gen),
u3k(q_gen),
u3nt(u3k(r_gen),
u3k(s_gen),
u3_nul));
2013-09-29 00:21:18 +04:00
}
_open_do_pq(cnhp) // %-
{
2014-09-06 00:13:24 +04:00
if ( (u3_nul == q_gen) ) {
return u3nt
2014-08-21 01:18:34 +04:00
(c3__tsgr,
2014-09-06 00:13:24 +04:00
u3k(p_gen),
u3nc(c3__cnzy, u3_blip));
2013-09-29 00:21:18 +04:00
} else {
2014-09-06 00:13:24 +04:00
return u3nq(c3__cncl,
u3k(p_gen),
c3__cltr,
2014-09-06 00:13:24 +04:00
u3k(q_gen));
2013-09-29 00:21:18 +04:00
}
}
_open_do_pqr(cnls) // %+
{
2014-09-06 00:13:24 +04:00
return u3nc
2014-08-21 01:18:34 +04:00
(c3__cnhp,
2014-09-06 00:13:24 +04:00
u3nq(u3k(p_gen),
u3k(q_gen),
u3k(r_gen),
u3_nul));
2013-09-29 00:21:18 +04:00
}
_open_do_pqr(cnsg) // %~
{
2014-09-06 00:13:24 +04:00
return u3nq
2014-08-21 01:18:34 +04:00
(c3__cntr,
2014-09-06 00:13:24 +04:00
u3k(p_gen),
u3k(q_gen),
u3nc(u3nc(u3nc(u3nc(u3_nul, 6), 0), u3k(r_gen)), 0));
2013-09-29 00:21:18 +04:00
}
_open_do_p(cnzy) // %cnzy
{
2014-09-06 00:13:24 +04:00
return u3nt
2014-08-21 01:18:34 +04:00
(c3__cnts,
2014-09-06 00:13:24 +04:00
u3nc(u3k(p_gen), u3_nul),
u3_nul);
}
_open_do_p(cnzz) // %cnzz
{
2014-09-06 00:13:24 +04:00
return u3nt
(c3__cnts, u3k(p_gen), u3_nul);
}
2014-06-12 02:29:17 +04:00
/***
****
***/
_open_do_p(hxgl) // #<
{
2014-09-06 00:13:24 +04:00
return u3nq
2014-08-21 01:18:34 +04:00
(c3__cnhp,
2014-09-06 00:13:24 +04:00
u3nc(c3__cnzy, c3__noah),
u3nc(c3__zpgr,
u3nc(c3__cltr, u3k(p_gen))),
u3_nul);
2014-06-12 02:29:17 +04:00
}
_open_do_p(hxgr) // #>
{
2014-09-06 00:13:24 +04:00
return u3nq
2014-08-21 01:18:34 +04:00
(c3__cnhp,
2014-09-06 00:13:24 +04:00
u3nc(c3__cnzy, c3__cain),
u3nc(c3__zpgr,
u3nc(c3__cltr, u3k(p_gen))),
u3_nul);
2014-06-12 02:29:17 +04:00
}
/***
****
***/
_open_do_pq(ktdt) // ^.
{
2014-09-06 00:13:24 +04:00
return u3nt
2014-08-21 01:18:34 +04:00
(c3__ktls,
2014-09-06 00:13:24 +04:00
u3nq(c3__cnhp, u3k(p_gen), u3k(q_gen), u3_nul),
u3k(q_gen));
2014-06-12 02:29:17 +04:00
}
2014-06-17 22:04:27 +04:00
_open_do_pq(kthp) // ^-
{
2014-09-06 00:13:24 +04:00
return u3nt
2014-08-21 01:18:34 +04:00
(c3__ktls,
2014-10-10 05:27:02 +04:00
_ap_bunt(_al_core(ter, p_gen), p_gen),
2014-09-06 00:13:24 +04:00
u3k(q_gen));
2014-06-17 22:04:27 +04:00
}
2013-09-29 00:21:18 +04:00
/***
****
***/
2014-06-11 01:31:16 +04:00
_open_do_pq(brcb) // |_
{
2014-09-06 00:13:24 +04:00
return u3nt(c3__tsls,
u3nc(c3__bctr, u3k(p_gen)),
u3nc(c3__brcn, u3k(q_gen)));
2014-06-11 01:31:16 +04:00
}
_open_do_pq(brkt) // |^
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun diz = u3nc(c3__ash, u3k(p_gen));
u3_noun ret = u3nt
2014-08-21 01:18:34 +04:00
(
2013-09-29 00:21:18 +04:00
c3__tsgr,
2014-09-06 00:13:24 +04:00
u3nc(
2013-09-29 00:21:18 +04:00
c3__brcn,
2014-11-06 22:13:57 +03:00
u3qdb_put(q_gen, u3_blip, diz)),
2014-09-06 00:13:24 +04:00
u3nc(c3__cnzy, u3_blip));
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3z(diz);
2013-09-29 00:21:18 +04:00
return ret;
}
_open_do_pq(brls) // |+
{
2014-09-06 00:13:24 +04:00
return u3nc(c3__ktbr,
u3nt(c3__brts,
u3k(p_gen),
u3k(q_gen)));
}
2014-06-13 02:22:25 +04:00
_open_do_p(brwt) // |?
{
2014-09-06 00:13:24 +04:00
return u3nt(c3__ktwt,
2014-06-13 02:22:25 +04:00
c3__brdt,
2014-09-06 00:13:24 +04:00
u3k(p_gen));
2014-06-13 02:22:25 +04:00
}
2013-09-29 00:21:18 +04:00
/***
****
***/
_open_do_pq(sgts) // ~=
{
2014-09-06 00:13:24 +04:00
return u3nt
2014-08-21 01:18:34 +04:00
(c3__sggr,
2014-09-06 00:13:24 +04:00
u3nc(c3__germ, u3k(p_gen)),
u3k(q_gen));
2013-09-29 00:21:18 +04:00
}
2015-01-22 06:31:17 +03:00
#if 0
2013-09-29 00:21:18 +04:00
_open_do_pq(sgbr) // ~|
{
2014-09-06 00:13:24 +04:00
return u3nt
2014-08-21 01:18:34 +04:00
(c3__sggr,
u3nc(c3__mean, u3k(p_gen)),
2014-09-06 00:13:24 +04:00
u3k(q_gen));
2013-09-29 00:21:18 +04:00
}
2015-01-22 06:31:17 +03:00
#endif
2013-09-29 00:21:18 +04:00
_open_do_pq(sggl) // ~>
{
2014-09-06 00:13:24 +04:00
return u3nt
2014-08-21 01:18:34 +04:00
(c3__tsgl,
2014-09-06 00:13:24 +04:00
u3nq(c3__sggr, u3k(p_gen), u3_nul, 1),
u3k(q_gen));
2013-09-29 00:21:18 +04:00
}
_open_do_pq(sgbc) // ~$
{
2014-09-06 00:13:24 +04:00
return u3nt(c3__sggr,
u3nq(c3__live,
c3__dtzz, u3_blip, u3k(p_gen)),
u3k(q_gen));
2014-06-12 02:29:17 +04:00
}
_open_do_pq(sgcb) // ~_
{
2014-09-06 00:13:24 +04:00
return u3nt
2014-08-21 01:18:34 +04:00
(c3__sggr,
2014-09-06 00:13:24 +04:00
u3nc(c3__mean,
u3nc(c3__brdt,
u3k(p_gen))),
u3k(q_gen));
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
_sgcn_a(
2014-09-06 00:13:24 +04:00
u3_noun r_gen,
u3_noun nob)
2013-09-29 00:21:18 +04:00
{
2014-11-05 04:18:47 +03:00
if ( c3n == u3du(r_gen) ) {
2014-09-06 00:13:24 +04:00
return u3k(nob);
2013-09-29 00:21:18 +04:00
} else {
2014-09-06 00:13:24 +04:00
u3_noun ir_gen = u3h(r_gen);
u3_noun tr_gen = u3t(r_gen);
u3_noun pir_gen, qir_gen;
2013-09-29 00:21:18 +04:00
2014-11-06 03:20:01 +03:00
u3x_cell(ir_gen, &pir_gen, &qir_gen);
2014-09-06 00:13:24 +04:00
return u3nc
(u3nc
2014-08-21 01:18:34 +04:00
(
2014-09-06 00:13:24 +04:00
u3nt(c3__dtzz, u3_blip, u3k(pir_gen)),
u3nc(c3__zpts, u3k(qir_gen))),
2014-08-21 01:18:34 +04:00
_sgcn_a(tr_gen, nob));
2013-09-29 00:21:18 +04:00
}
}
_open_do_pqrs(sgcn) // ~%
{
2014-09-06 00:13:24 +04:00
return u3nt
2014-08-21 01:18:34 +04:00
(c3__sggl,
2014-09-06 00:13:24 +04:00
u3nq
2014-08-21 01:18:34 +04:00
(c3__fast,
2013-09-29 00:21:18 +04:00
c3__clls,
2014-09-06 00:13:24 +04:00
u3nt(c3__dtzz, u3_blip, u3k(p_gen)),
u3nt
(u3nc(c3__zpts, u3k(q_gen)),
2013-09-29 00:21:18 +04:00
c3__clsg,
2014-09-06 00:13:24 +04:00
_sgcn_a(r_gen, u3_nul))),
u3k(s_gen));
2013-09-29 00:21:18 +04:00
}
2014-06-12 02:29:17 +04:00
_open_do_pq(sgfs) // ~/
{
2014-09-06 00:13:24 +04:00
return u3nc
2014-08-21 01:18:34 +04:00
(c3__sgcn,
2014-09-06 00:13:24 +04:00
u3nq(u3k(p_gen),
u3nc(u3_nul, 7),
u3_nul,
u3k(q_gen)));
2014-06-12 02:29:17 +04:00
}
2013-09-29 00:21:18 +04:00
_open_do_pq(sgls) // ~+
{
2014-09-06 00:13:24 +04:00
return u3nt
2014-08-21 01:18:34 +04:00
(c3__sggr,
2014-09-06 00:13:24 +04:00
u3nq(c3__memo, c3__dtzz, u3_blip, u3k(p_gen)),
u3k(q_gen));
2013-09-29 00:21:18 +04:00
}
2014-06-18 21:38:34 +04:00
_open_do_pqr(sgpm) // ~&
{
2014-09-06 00:13:24 +04:00
return u3nt
2014-08-21 01:18:34 +04:00
(
2014-06-18 21:38:34 +04:00
c3__sggr,
2014-09-06 00:13:24 +04:00
u3nt(
2014-06-18 21:38:34 +04:00
c3__slog,
2014-09-06 00:13:24 +04:00
u3nt(c3__dtzy, u3_blip, u3k(p_gen)),
u3nq(c3__cnhp, u3nc(c3__cnzy, c3__cain),
u3nc(c3__zpgr, u3k(q_gen)), u3_nul)),
u3k(r_gen));
2014-06-18 21:38:34 +04:00
}
2014-06-14 00:52:13 +04:00
_open_do_pqrs(sgwt) // ~?
{
2015-01-14 01:13:08 +03:00
return u3nt
(c3__tsls,
u3nq(c3__wtdt,
2015-01-15 02:18:03 +03:00
u3k(q_gen),
u3nc(c3__bczp, c3__null),
u3nc(u3nc(c3__bczp, c3__null), u3k(r_gen))),
u3nq(c3__wtsg,
u3nc(u3nc(u3_nul, 2),u3_nul),
2015-01-14 01:13:08 +03:00
u3nt(c3__tsgr,
u3nc(u3_nul, 3),
u3k(s_gen)),
u3nq(c3__sgpm,
u3k(p_gen),
2015-01-15 02:18:03 +03:00
u3nc(u3_nul, 5),
2015-01-14 01:13:08 +03:00
u3nt(c3__tsgr,
u3nc(u3_nul, 3),
u3k(s_gen)))));
2014-06-14 00:52:13 +04:00
}
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
_smcl_in(
2014-09-06 00:13:24 +04:00
u3_noun q_gen)
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun hq_gen = u3h(q_gen);
u3_noun tq_gen = u3t(q_gen);
2013-09-29 00:21:18 +04:00
2014-11-05 04:18:47 +03:00
if ( c3n == u3du(tq_gen) ) {
2014-09-06 00:13:24 +04:00
return u3nt(c3__tsgr,
u3nc(u3_nul, 3),
u3k(hq_gen));
2013-09-29 00:21:18 +04:00
} else {
2014-09-06 00:13:24 +04:00
return u3nc
2014-08-21 01:18:34 +04:00
(
2013-09-29 00:21:18 +04:00
c3__cnhp,
2014-09-06 00:13:24 +04:00
u3nq(
u3nc(u3_nul, 2),
u3nt(c3__tsgr,
u3nc(u3_nul, 3),
u3k(hq_gen)),
2014-08-21 01:18:34 +04:00
_smcl_in(tq_gen),
2014-09-06 00:13:24 +04:00
u3_nul));
2013-09-29 00:21:18 +04:00
}
}
_open_do_pq(smcl)
{
2014-11-05 04:18:47 +03:00
if ( c3n == u3du(q_gen) ) {
2014-09-06 00:13:24 +04:00
return u3nc(c3__zpzp, u3_nul);
}
2014-09-06 00:13:24 +04:00
else if ( u3_nul == u3t(q_gen) ) {
return u3k(u3h(q_gen));
2013-09-29 00:21:18 +04:00
}
else {
2014-09-06 00:13:24 +04:00
return u3nt
2014-08-21 01:18:34 +04:00
(
2013-09-29 00:21:18 +04:00
c3__tsls,
2014-09-06 00:13:24 +04:00
u3k(p_gen),
2014-08-21 01:18:34 +04:00
_smcl_in(q_gen));
2013-09-29 00:21:18 +04:00
}
}
2014-06-19 00:09:04 +04:00
#if 0
_open_do_pq(smsm)
{
return
2014-09-06 00:13:24 +04:00
u3nt(c3__tsgr, u3nq(c3__ktts, c3__v, u3_nul, 1),
u3nt(c3__tsls,
u3nt(c3__ktts, c3__a,
u3nt(c3__tsgr, u3nc(c3__cnzy, c3__v),
2015-02-27 09:35:41 +03:00
u3k(p_gen))),
2014-09-06 00:13:24 +04:00
u3nt(c3__tsls,
u3nt(c3__ktts, c3__b,
u3nt(c3__tsgr,
u3nc(c3__cnzy, c3__v),
u3k(q_gen))),
u3nt(c3__tsls,
u3nt(c3__ktts, c3__c,
u3nq(c3__cnhp,
u3nc(c3__cnzy, c3__a),
u3nc(c3__cnzy, c3__b),
u3_nul)),
u3nt(c3__wtgr,
u3nt(c3__dtts,
u3nc(c3__cnzy, c3__c),
u3nc(c3__cnzy, c3__b)),
u3nc(c3__cnzy, c3__c))))));
2014-06-19 00:09:04 +04:00
}
#endif
2014-09-03 09:46:55 +04:00
2013-09-29 00:21:18 +04:00
/* functions
*/
/** open
**/
2014-09-06 00:13:24 +04:00
static u3_noun
2014-08-21 01:18:34 +04:00
_open_in(
2014-09-06 00:13:24 +04:00
u3_noun ter,
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, s_gen;
2013-09-29 00:21:18 +04:00
2014-11-05 04:18:47 +03:00
if ( c3y == u3ud(gen) ) {
2013-09-29 00:21:18 +04:00
// printf("studly\n");
2014-09-06 00:13:24 +04:00
// u3_err("stud m", gen);
2014-11-06 03:20:01 +03:00
return u3m_bail(c3__exit);
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
return u3nt
2014-08-21 01:18:34 +04:00
(c3__cnts,
2014-09-06 00:13:24 +04:00
u3nc(u3k(gen), u3_nul),
u3_nul);
2013-09-29 00:21:18 +04:00
}
2014-09-06 00:13:24 +04:00
else switch ( u3h(gen) ) {
2014-11-06 02:36:30 +03:00
default: return u3_none;
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
case u3_nul: {
return u3nt
2014-08-21 01:18:34 +04:00
(c3__cnts,
2014-09-06 00:13:24 +04:00
u3nc(u3k(gen), u3_nul),
u3_nul);
2013-09-29 00:21:18 +04:00
}
2013-09-29 00:21:18 +04:00
# define _open_p(stem) \
case c3__##stem: \
2014-09-06 00:13:24 +04:00
return _open_in_##stem(ter, u3t(gen)); \
2013-09-29 00:21:18 +04:00
# define _open_pq(stem) \
case c3__##stem: \
2014-11-06 03:20:01 +03:00
if ( c3n == u3r_cell(u3t(gen), &p_gen, &q_gen) ) { \
return u3m_bail(c3__fail); \
2014-08-21 01:18:34 +04:00
} else return _open_in_##stem(ter, p_gen, q_gen);
2013-09-29 00:21:18 +04:00
# define _open_pqr(stem) \
case c3__##stem: \
2014-11-06 03:20:01 +03:00
if ( c3n == u3r_trel(u3t(gen), &p_gen, &q_gen, &r_gen) ) { \
return u3m_bail(c3__fail); \
2014-08-21 01:18:34 +04:00
} else return _open_in_##stem(ter, p_gen, q_gen, r_gen);
2013-09-29 00:21:18 +04:00
# define _open_pqrs(stem) \
case c3__##stem: \
2014-11-06 03:20:01 +03:00
if ( c3n == u3r_qual\
2014-09-06 00:13:24 +04:00
(u3t(gen), &p_gen, &q_gen, &r_gen, &s_gen) )\
2013-09-29 00:21:18 +04:00
{ \
2014-11-06 03:20:01 +03:00
return u3m_bail(c3__fail); \
2014-08-21 01:18:34 +04:00
} else return _open_in_##stem(ter, p_gen, q_gen, r_gen, s_gen);
2013-09-29 00:21:18 +04:00
2014-06-17 22:04:27 +04:00
_open_p (bccb);
_open_p (bctr);
_open_p (bczp);
2014-06-13 02:22:25 +04:00
2013-09-29 00:21:18 +04:00
_open_p (brdt);
2014-06-11 01:31:16 +04:00
_open_pq (brcb);
_open_p (brhp);
2014-06-11 01:31:16 +04:00
_open_pq (brkt);
_open_pq (brls);
2014-06-13 02:22:25 +04:00
_open_p (brwt);
2014-06-05 06:46:12 +04:00
_open_pq (clcb);
2014-06-13 02:22:25 +04:00
_open_p (clcn);
2014-06-05 06:46:12 +04:00
_open_pq (clhp);
2013-09-29 00:21:18 +04:00
_open_pqrs(clkt);
_open_pqr (clls);
2014-06-05 04:56:24 +04:00
_open_p (cltr);
_open_p (clsg);
_open_pq (cncb);
2015-03-07 04:15:51 +03:00
// _open_pq (cncl);
2013-09-29 00:21:18 +04:00
_open_pq (cndt);
_open_pqrs(cnkt);
_open_pq (cnhp);
_open_pqr (cnls);
2014-06-05 06:46:12 +04:00
_open_pqr (cnsg);
_open_p (cnzy);
_open_p (cnzz);
2014-06-12 02:29:17 +04:00
_open_p (hxgl);
_open_p (hxgr);
_open_pq (ktdt);
2014-06-17 22:04:27 +04:00
_open_pq (kthp);
2014-06-12 02:29:17 +04:00
_open_pq (sgts);
2015-01-22 06:31:17 +03:00
// _open_pq (sgbr);
_open_pq (sggl);
_open_pq (sgbc);
2014-06-12 02:29:17 +04:00
_open_pq (sgcb);
_open_pqrs(sgcn);
2014-06-12 02:29:17 +04:00
_open_pq (sgfs);
_open_pq (sgls);
2014-06-18 21:38:34 +04:00
_open_pqr (sgpm);
2014-06-14 00:52:13 +04:00
_open_pqrs(sgwt);
2014-06-12 02:29:17 +04:00
2013-09-29 00:21:18 +04:00
_open_pq (smcl);
2014-06-19 00:09:04 +04:00
// _open_pq (smsm);
2014-06-12 02:29:17 +04:00
2014-06-17 22:04:27 +04:00
_open_pq (tsbr);
_open_pq (tscl);
_open_pqr (tsdt);
2014-06-11 01:31:16 +04:00
_open_pq (tsgl);
_open_pq (tshp);
_open_pq (tsls);
2014-06-19 00:09:04 +04:00
_open_p (tssg);
2014-06-12 02:29:17 +04:00
2014-06-11 01:31:16 +04:00
_open_pqr (wtdt);
_open_pq (wtgl);
2014-06-14 00:52:13 +04:00
_open_pqr (wtpt);
_open_pqr (wtsg);
2014-06-11 01:31:16 +04:00
_open_p (wtzp);
_open_p (wtbr);
2014-06-16 23:19:33 +04:00
_open_pq (wthp);
2014-06-11 01:31:16 +04:00
_open_pq (wtgr);
2014-06-11 05:09:47 +04:00
_open_pqr (wtls);
_open_pqr (wtkt);
_open_p (wtpm);
2014-06-13 02:22:25 +04:00
2014-06-18 21:38:34 +04:00
_open_pq (zpcb);
2014-06-13 02:22:25 +04:00
_open_p (zpgr);
2013-09-29 00:21:18 +04:00
}
}
/** rake
**/
2014-09-06 00:13:24 +04:00
u3_noun
2014-11-06 22:13:57 +03:00
u3qfp_rake(
2014-09-06 00:13:24 +04:00
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;
2013-09-29 00:21:18 +04:00
2014-11-05 04:18:47 +03:00
if ( c3y == u3ud(gen) ) {
2014-09-06 00:13:24 +04:00
return u3nc(u3k(gen), u3_nul);
2013-09-29 00:21:18 +04:00
}
2014-09-06 00:13:24 +04:00
else switch ( u3h(gen) ) {
2014-11-06 03:20:01 +03:00
default: return u3m_error("rake-twig");
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
case u3_nul: return u3nc(u3k(gen), u3_nul);
2013-09-29 00:21:18 +04:00
2014-01-05 07:18:06 +04:00
case c3__cnzy: {
2014-09-06 00:13:24 +04:00
return u3nc(u3k(u3t(gen)), u3_nul);
2014-01-05 07:18:06 +04:00
}
case c3__cnzz: {
2014-09-06 00:13:24 +04:00
return u3k(u3t(gen));
2014-01-05 07:18:06 +04:00
}
2013-09-29 00:21:18 +04:00
case c3__cnts: {
2014-11-06 03:20:01 +03:00
if ( c3n == u3r_cell(u3t(gen), &p_gen, &q_gen) ) {
return u3m_bail(c3__fail);
2013-09-29 00:21:18 +04:00
}
else {
2014-09-06 00:13:24 +04:00
if ( u3_nul != q_gen ) {
2014-11-06 03:20:01 +03:00
return u3m_bail(c3__fail);
2013-09-29 00:21:18 +04:00
}
else {
2014-09-06 00:13:24 +04:00
return u3k(p_gen);
2013-09-29 00:21:18 +04:00
}
}
}
case c3__zpcb: {
2014-11-06 03:20:01 +03:00
if ( c3n == u3r_cell(u3t(gen), &p_gen, &q_gen) ) {
return u3m_bail(c3__fail);
2013-09-29 00:21:18 +04:00
}
2014-11-06 22:13:57 +03:00
else return u3qfp_rake(q_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
u3wfp_rake(
2014-09-06 00:13:24 +04:00
u3_noun cor)
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun gen;
2013-09-29 00:21:18 +04:00
2014-11-18 00:56:51 +03:00
if ( u3_none == (gen = u3r_at(u3x_sam, cor)) ) {
2014-11-06 03:20:01 +03:00
return u3m_bail(c3__fail);
2013-09-29 00:21:18 +04:00
} else {
2014-11-06 22:13:57 +03:00
return u3qfp_rake(gen);
2013-09-29 00:21:18 +04:00
}
}
/** hack
**/
2014-09-06 00:13:24 +04:00
u3_noun
2014-11-06 22:13:57 +03:00
u3qfp_hack(
2014-09-06 00:13:24 +04:00
u3_noun ter,
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;
u3_noun ret;
2013-09-29 00:21:18 +04:00
2014-11-05 04:18:47 +03:00
if ( c3y == u3du(u3h(gen)) ) {
return u3nt(c3y,
2014-09-06 00:13:24 +04:00
u3k(u3h(gen)),
u3k(u3t(gen)));
2013-09-29 00:21:18 +04:00
}
2014-09-06 00:13:24 +04:00
else switch ( u3h(gen) ) {
2014-11-06 03:20:01 +03:00
case c3__tsgr: u3x_cell(u3t(gen), &p_gen, &q_gen);
2013-09-29 00:21:18 +04:00
{
2014-11-05 04:18:47 +03:00
if ( (c3n == u3du(p_gen)) || (u3_nul != u3h(p_gen)) ) {
return u3nc(c3n, u3k(gen));
2013-09-29 00:21:18 +04:00
}
else {
2014-11-06 22:13:57 +03:00
u3_noun pyr = u3qfp_hack(ter, q_gen);
2014-09-06 00:13:24 +04:00
2014-11-05 04:18:47 +03:00
if ( c3y == u3h(pyr) ) {
2014-09-06 00:13:24 +04:00
ret = u3nt
2014-11-05 04:18:47 +03:00
(c3y,
2014-09-06 00:13:24 +04:00
u3nt(c3__tsgr,
u3k(p_gen),
u3k(u3h(u3t(pyr)))),
u3nt(c3__tsgr,
u3k(p_gen),
u3k(u3t(u3t(pyr)))));
2013-09-29 00:21:18 +04:00
}
else {
2014-09-06 00:13:24 +04:00
ret = u3nc
2014-11-05 04:18:47 +03:00
(c3n,
2014-09-06 00:13:24 +04:00
u3nt(c3__tsgr,
u3k(p_gen),
u3k(u3t(pyr))));
2013-09-29 00:21:18 +04:00
}
2014-09-06 00:13:24 +04:00
u3z(pyr);
2013-09-29 00:21:18 +04:00
return 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-11-06 22:13:57 +03:00
u3_noun pyr = u3qfp_hack(ter, q_gen);
2014-09-06 00:13:24 +04:00
2014-11-05 04:18:47 +03:00
if ( c3y == u3h(pyr) ) {
2014-09-06 00:13:24 +04:00
ret = u3nt
2014-11-05 04:18:47 +03:00
(c3y,
2014-09-06 00:13:24 +04:00
u3nt(c3__zpcb,
u3k(p_gen),
u3k(u3h(u3t(pyr)))),
u3nt(c3__zpcb,
u3k(p_gen),
u3k(u3t(u3t(pyr)))));
2013-09-29 00:21:18 +04:00
}
else {
2014-09-06 00:13:24 +04:00
ret = u3nc
2014-11-05 04:18:47 +03:00
(c3n,
2014-09-06 00:13:24 +04:00
u3nt(c3__zpcb,
u3k(p_gen),
u3k(u3t(pyr))));
2013-09-29 00:21:18 +04:00
}
2014-09-06 00:13:24 +04:00
u3z(pyr);
2013-09-29 00:21:18 +04:00
return ret;
}
2013-09-29 00:21:18 +04:00
default: break;
}
{
2014-09-06 00:13:24 +04:00
u3_noun voq = _ap_open_l(ter, gen);
2013-09-29 00:21:18 +04:00
2014-11-06 02:36:30 +03:00
if ( u3_none == voq ) {
2014-11-05 04:18:47 +03:00
return u3nc(c3n, u3k(gen));
2013-09-29 00:21:18 +04:00
}
2014-11-06 03:20:01 +03:00
else if ( c3y == u3r_sing(voq, gen) ) {
2014-11-05 04:18:47 +03:00
return u3nc(c3n, voq);
2013-09-29 00:21:18 +04:00
}
else {
2014-11-06 22:13:57 +03:00
ret = u3qfp_hack(ter, voq);
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3z(voq);
2013-09-29 00:21:18 +04:00
return ret;
}
}
}
2014-09-06 00:13:24 +04:00
u3_noun
2014-11-06 22:13:57 +03:00
u3wfp_hack(
2014-09-06 00:13:24 +04:00
u3_noun cor)
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun gen;
2013-09-29 00:21:18 +04:00
2014-11-18 00:56:51 +03:00
if ( u3_none == (gen = u3r_at(u3x_sam, cor)) ) {
2014-11-06 03:20:01 +03:00
return u3m_bail(c3__fail);
2013-09-29 00:21:18 +04:00
} else {
2014-11-18 00:56:51 +03:00
u3_noun ter = u3r_at(u3x_con, cor);
2013-09-29 00:21:18 +04:00
2014-11-06 22:13:57 +03:00
return u3qfp_hack(ter, gen);
2013-09-29 00:21:18 +04:00
}
}
/* boilerplate
*/
2014-09-06 00:13:24 +04:00
u3_noun
_ap_core(u3_noun ter, u3_noun gen)
2014-09-04 01:33:18 +04:00
{
2014-11-06 03:20:01 +03:00
u3_noun gat = u3j_hook(u3k(ter), "ap");
2014-09-04 01:33:18 +04:00
2014-11-18 00:56:51 +03:00
return u3i_molt(gat, u3x_sam, u3k(gen), 0);
2013-09-29 00:21:18 +04:00
}
/* open
*/
2014-09-06 00:13:24 +04:00
static u3_noun
_ap_open_n(u3_noun ter,
u3_noun gen)
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun cor = _ap_core(ter, gen);
2013-09-29 00:21:18 +04:00
2014-11-06 03:20:01 +03:00
return u3j_soft(cor, "open");
}
2014-09-06 00:13:24 +04:00
static u3_noun
2014-09-17 23:56:55 +04:00
_ap_open_l(u3_noun ter, u3_noun gen)
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun pro = _open_in(ter, gen);
2013-09-29 00:21:18 +04:00
2014-11-06 02:36:30 +03:00
if ( u3_none != pro ) {
2013-09-29 00:21:18 +04:00
return pro;
} else {
2014-09-04 01:33:18 +04:00
return _ap_open_n(ter, 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
u3qfp_open(u3_noun ter, u3_noun gen)
2013-09-29 00:21:18 +04:00
{
2014-09-04 01:33:18 +04:00
return _ap_open_l(ter, 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
u3wfp_open(u3_noun cor)
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun gen;
2013-09-29 00:21:18 +04:00
2014-11-18 00:56:51 +03:00
if ( u3_none == (gen = u3r_at(u3x_sam, cor)) ) {
2014-11-06 03:20:01 +03:00
return u3m_bail(c3__fail);
2013-09-29 00:21:18 +04:00
} else {
2014-11-18 00:56:51 +03:00
u3_noun ter = u3r_at(u3x_con, cor);
2013-09-29 00:21:18 +04:00
2014-11-06 22:13:57 +03:00
return u3qfp_open(ter, gen);
2013-09-29 00:21:18 +04:00
}
}