Exemple #1
0
/* glue
*/
  u3_noun
  _cqe_glue_fun(u3_noun bus,
                u3_noun vex,
                u3_noun sab)
  {
    u3_noun p_vex, q_vex;

    u3x_cell(vex, &p_vex, &q_vex);
    if ( c3n == u3du(q_vex) ) {
      return u3k(vex);
    }
    else {
      u3_noun uq_vex = u3t(q_vex);
      u3_noun puq_vex, quq_vex;
      u3_noun yit, yur;
      u3_noun p_yit, q_yit;
      u3_noun ret;

      u3x_cell(uq_vex, &puq_vex, &quq_vex);
      yit = u3x_good(u3n_slam_on(u3k(bus), u3k(quq_vex)));

      u3x_cell(yit, &p_yit, &q_yit);
      yur = _last(p_vex, p_yit);

      if ( c3n == u3du(q_yit) ) {
        ret = u3nc(yur, u3_nul);
      }
      else {
        u3_noun uq_yit = u3t(q_yit);
        u3_noun puq_yit, quq_yit;
        u3_noun wam, p_wam, q_wam, goy;

        u3x_cell(uq_yit, &puq_yit, &quq_yit);
        wam = u3x_good(u3n_slam_on(u3k(sab), u3k(quq_yit)));

        u3x_cell(wam, &p_wam, &q_wam);
        goy = _last(yur, p_wam);
        u3z(yur);

        if ( c3n == u3du(q_wam) ) {
          ret = u3nc(goy, u3_nul);
        } else {
          u3_noun uq_wam = u3t(q_wam);
          u3_noun puq_wam, quq_wam;

          u3x_cell(uq_wam, &puq_wam, &quq_wam);
          ret = u3nq(goy,
                     u3_nul,
                     u3nc(u3k(puq_vex),
                          u3k(puq_wam)),
                     u3k(quq_wam));
        }
        u3z(wam);
      }
      u3z(yit);
      return ret;
    }
  }
Exemple #2
0
  static u3_noun
  _slip(u3_noun weq,
        u3_noun naz)
  {
    u3_noun p_naz, q_naz;

    u3x_cell(naz, &p_naz, &q_naz);
    if ( 10 == weq ) {
      return u3nc(u3x_good(u3i_vint(u3k(p_naz))),
                           1);
    } else {
      return u3nc(u3k(p_naz),
                  u3x_good(u3i_vint(u3k(q_naz))));
    }
  }
Exemple #3
0
    static u3_noun
    _sgcn_a(u3_noun r_gen,
            u3_noun nob)
    {
      if ( c3n == u3du(r_gen) ) {
        return u3k(nob);
      } else {
        u3_noun ir_gen = u3h(r_gen);
        u3_noun tr_gen = u3t(r_gen);
        u3_noun pir_gen, qir_gen;

        u3x_cell(ir_gen, &pir_gen, &qir_gen);

        return u3nc(u3nc(u3nt(c3__dtzz, u3_blip, u3k(pir_gen)),
                         u3nc(c3__zpts, u3k(qir_gen))),
                    _sgcn_a(tr_gen, nob));
      }
    }
Exemple #4
0
/* just
*/
  u3_noun
  _cqe_just_fun(u3_noun daf,
                u3_noun tub)
  {
    u3_noun p_tub, q_tub;

    u3x_cell(tub, &p_tub, &q_tub);

    if ( c3n == u3du(q_tub) ) {
      return _fail(tub);
    }
    else {
      u3_noun iq_tub = u3h(q_tub);

      if ( c3y == u3r_sing(daf, iq_tub) ) {
        return _next(tub);
      }
      else return _fail(tub);
    }
  }
Exemple #5
0
  static u3_noun
  _next(u3_noun tub)
  {
    u3_noun p_tub, q_tub;
    u3_noun zac;

    u3x_cell(tub, &p_tub, &q_tub);
    if ( c3n == u3du(q_tub) ) {
      return _fail(tub);
    }
    else {
      u3_noun iq_tub = u3h(q_tub);
      u3_noun tq_tub = u3t(q_tub);

      zac = _slip(iq_tub, p_tub);

      return u3nc(zac,
                  u3nq(u3_nul,
                       u3k(iq_tub),
                       u3k(zac),
                       u3k(tq_tub)));
    }
  }
Exemple #6
0
/* mask
*/
  u3_noun
  _cqe_mask_fun(u3_noun bud,
                u3_noun tub)
  {
    u3_noun p_tub, q_tub;

    u3x_cell(tub, &p_tub, &q_tub);

    if ( c3n == u3du(q_tub) ) {
      return _fail(tub);
    }
    else {
      u3_noun iq_tub = u3h(q_tub);

      while ( c3y == u3du(bud) ) {
        if ( c3y == u3r_sing(u3h(bud), iq_tub) ) {
          return _next(tub);
        }
        bud = u3t(bud);
      }
      return _fail(tub);
    }
  }
Exemple #7
0
  /** hack
  **/
    u3_noun
    u3qfp_hack(u3_noun ter,
               u3_noun gen)
    {
      u3_noun p_gen, q_gen;
      u3_noun ret;

      if ( c3y == u3du(u3h(gen)) ) {
        return u3nt(c3y,
                    u3k(u3h(gen)),
                    u3k(u3t(gen)));
      }
      else switch ( u3h(gen) ) {
        case c3__tsgr: u3x_cell(u3t(gen), &p_gen, &q_gen);
        {
          if ( (c3n == u3du(p_gen)) || (u3_nul != u3h(p_gen)) ) {
            return u3nc(c3n, u3k(gen));
          }
          else {
            u3_noun pyr = u3qfp_hack(ter, q_gen);

            if ( c3y == u3h(pyr) ) {
              ret = u3nt(c3y,
                         u3nt(c3__tsgr,
                              u3k(p_gen),
                              u3k(u3h(u3t(pyr)))),
                         u3nt(c3__tsgr,
                              u3k(p_gen),
                              u3k(u3t(u3t(pyr)))));
            }
            else {
              ret = u3nc(c3n,
                         u3nt(c3__tsgr,
                              u3k(p_gen),
                              u3k(u3t(pyr))));
            }
            u3z(pyr);
            return ret;
          }
        }
        case c3__zpcb: u3x_cell(u3t(gen), &p_gen, &q_gen);
        {
          u3_noun pyr = u3qfp_hack(ter, q_gen);

          if ( c3y == u3h(pyr) ) {
            ret = u3nt(c3y,
                       u3nt(c3__zpcb,
                            u3k(p_gen),
                            u3k(u3h(u3t(pyr)))),
                       u3nt(c3__zpcb,
                            u3k(p_gen),
                            u3k(u3t(u3t(pyr)))));
          }
          else {
            ret = u3nc(c3n,
                       u3nt(c3__zpcb,
                            u3k(p_gen),
                            u3k(u3t(pyr))));
          }
          u3z(pyr);
          return ret;
        }
        default: break;
      }

      {
        u3_noun voq = _ap_open_l(ter, gen);

        if ( u3_none == voq ) {
          return u3nc(c3n, u3k(gen));
        }
        else if ( c3y == u3r_sing(voq, gen) ) {
          return u3nc(c3n, voq);
        }
        else {
          ret = u3qfp_hack(ter, voq);

          u3z(voq);
          return ret;
        }
      }
    }
Exemple #8
0
  static u3_noun
  _nest_cong(u3_noun van,
             u3_noun sut,
             u3_noun tel,
             u3_noun ref,
             u3_noun gil)
  {
    u3_noun p_sut, q_sut, p_ref, q_ref;
    u3_noun pq_sut, qq_sut, rq_sut;
    u3_noun pq_ref, qq_ref, rq_ref;
    u3_noun prq_sut, qrq_sut, prq_ref, qrq_ref;
    u3_noun ret;

    u3x_trel(sut, 0, &p_sut, &q_sut);
    u3x_trel(ref, 0, &p_ref, &q_ref);

    u3x_trel(q_sut, &pq_sut, &qq_sut, &rq_sut);
    u3x_trel(q_ref, &pq_ref, &qq_ref, &rq_ref);

    u3x_cell(rq_sut, &prq_sut, &qrq_sut);
    u3x_cell(rq_ref, &prq_ref, &qrq_ref);

    if ( c3y == u3r_sing(q_sut, q_ref) ) {
      return _nest_dext(van, p_sut, tel, p_ref, gil);
    }
    else if ( (c3n == _nest_dext(van, qq_sut, tel, p_sut, gil)) ||
              (c3n == _nest_dext(van, p_sut, tel, qq_sut, gil)) ||
              (c3n == _nest_dext(van, qq_ref, tel, p_ref, gil)) )
    {
      return c3n;
    }
    else {
      if ( (pq_sut != pq_ref) && (c3__gold != pq_ref) ) {
        return c3n;
      }
      else {
        u3_noun hud = u3nc(u3k(sut), u3k(ref));

        if ( (c3y == u3qdi_has(gil, hud)) ) {
          u3z(hud);

          return c3y;
        }
        else {
          u3_noun zoc = u3qdi_put(gil, hud);
          u3_noun tus = u3nt(c3__core,
                                     u3k(qq_sut),
                                     u3k(q_sut));
          u3_noun fer = u3nt(c3__core,
                                     u3k(qq_ref),
                                     u3k(q_ref));

          ret = _nest_cram(van, tus, tel, fer, qrq_sut, qrq_ref, zoc);
          u3z(fer);
          u3z(tus);
          u3z(zoc);
          u3z(hud);

          if ( c3n == ret ) {
            return c3n;
          }
          else {
            switch ( pq_sut ) {
              default: return u3m_bail(c3__fail);

              case c3__gold: {
                return
                  c3a(_nest_dext(van, qq_sut, tel, qq_ref, gil),
                         _nest_dext(van, qq_ref, tel, qq_sut, gil));
              }
              case c3__iron: {
                u3_noun s_sam = u3qfu_peek
                                        (van, qq_sut, c3__rite, 2);
                u3_noun r_sam = u3qfu_peek
                                        (van, qq_ref, c3__rite, 2);
                u3_noun ret = _nest_dext(van, r_sam, tel, s_sam, gil);

                u3z(r_sam);
                u3z(s_sam);
                return ret;
              }
              case c3__lead: {
                return c3y;
              }
              case c3__zinc: {
                u3_noun s_pal = u3qfu_peek
                                        (van, qq_sut, c3__read, 2);
                u3_noun r_pal = u3qfu_peek
                                        (van, qq_ref, c3__read, 2);
                u3_noun ret = _nest_dext(van, s_pal, tel, r_pal, gil);

                u3z(r_pal);
                u3z(s_pal);

                return ret;
              }
            }
          }
        }
      }
    }
  }
Exemple #9
0
  static u3_noun
  _nest_cram(
             u3_noun van,
             u3_noun sut,
             u3_noun tel,
             u3_noun ref,
             u3_noun dab,
             u3_noun hem,
             u3_noun gil)
  {
    if ( u3_nul == dab ) {
      return u3r_sing(u3_nul, hem);
    } else if ( u3_nul == hem ) {
      return c3n;
    } else {
      u3_noun n_dab, l_dab, r_dab;
      u3_noun n_hem, l_hem, r_hem;
      u3_noun pn_hem, qn_hem, pn_dab, qn_dab;

      u3x_trel(dab, &n_dab, &l_dab, &r_dab);
      u3x_trel(hem, &n_hem, &l_hem, &r_hem);

      if ( (c3n == _nest_cram
                        (van, sut, tel, ref, l_dab, l_hem, gil)) ||
           (c3n == _nest_cram
                        (van, sut, tel, ref, r_dab, r_hem, gil)) ) {
        return c3n;
      }
      u3x_cell(n_dab, &pn_dab, &qn_dab);
      u3x_cell(n_hem, &pn_hem, &qn_hem);

      if ( c3n == u3r_sing(pn_dab, pn_hem) ) {
        return c3n;
      } else {
        if ( (c3n == u3du(qn_dab)) || (c3n == u3du(qn_hem)) ) {
          return u3m_bail(c3__fail);
        }
        else switch ( u3h(qn_dab) ) {
          default: return u3m_bail(c3__exit);
          case c3__ash: {
            if ( c3__ash != u3h(qn_hem) ) {
              return c3n;
            } else {
              u3_noun pqn_dab = u3t(qn_dab);
              u3_noun pqn_hem = u3t(qn_hem);
              u3_noun vis = u3qfu_play(van, sut, pqn_dab);
              u3_noun lon = u3qfu_play(van, ref, pqn_hem);
              u3_noun ret = _nest_dext(van, vis, tel, lon, gil);

              u3z(vis);
              u3z(lon);
              return ret;
            }
          }
          case c3__elm: {
            return u3r_sing(qn_dab, qn_hem);
          }
        }
      }
    }
  }
Exemple #10
0
  static u3_noun
  _play_in(u3_noun van,
           u3_noun sut,
           u3_noun gen)
  {
    u3_noun p_gen, q_gen, r_gen;

    if ( c3n == u3du(gen) ) {
      open: {
        u3_noun ter = u3r_at(u3x_con_3, van);
        u3_noun rex = u3qfp_open(ter, gen);
        u3_noun ret;

        if ( c3y == u3r_sing(rex, gen) ) {
          u3_noun zix = u3qfu_shep(van, "gene", 'q', u3k(gen));

          u3t_push(u3nc(c3__mean, zix));
          return u3m_error("play-open");
        }
        ret = _play_x(van, sut, rex);
        u3z(rex);

        return ret;
      }
    }
    else if ( c3y == u3du(u3h(gen)) ) {
      _play_used();
      {
        u3_noun dis = _play_x(van, sut, u3h(gen));
        u3_noun dat = _play_x(van, sut, u3t(gen));
        u3_noun ret = u3qf_cell(dis, dat);

        u3z(dis);
        u3z(dat);
        return ret;
      }
    }
    else switch ( u3h(gen) ) {
      default: goto open;

      case c3__fits: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        return _play_bean();
      }

      case c3__if: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
      _play_used();
      {
        u3_noun fex = u3qfu_gain(van, sut, p_gen);
        u3_noun wux = u3qfu_lose(van, sut, p_gen);
        u3_noun dez = (fex == c3__void) ? c3__void
                                        : _play_x(van, fex, q_gen);
        u3_noun doz = (wux == c3__void) ? c3__void
                                        : _play_x(van, wux, r_gen);
        u3_noun ret = u3qf_forq(dez, doz);

        u3z(dez); u3z(doz);
        u3z(fex); u3z(wux);
        return ret;
      }

      case c3__cons: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        u3_noun dis = _play_x(van, sut, p_gen);
        u3_noun dat = _play_x(van, sut, q_gen);
        u3_noun ret = u3qf_cell(dis, dat);

        u3z(dis);
        u3z(dat);
        return ret;
      }

      case c3__wish: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        u3_noun nog = u3nc(c3__bunt, u3k(p_gen));
        u3_noun ret = _play_x(van, sut, nog);

        u3z(nog);
        return ret;
      }

      case c3__deep: p_gen = u3t(gen);
      _play_used();
      {
        return _play_bean();
      }

      case c3__same: u3x_cell(u3t(gen), &p_gen, &q_gen); 
      _play_used();
      {
        return _play_bean();
      }
      
      case c3__bump: p_gen = u3t(gen);
      _play_used();
      {
        return u3nt(c3__atom, u3_blip, u3_nul);
      }

      case c3__rock: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        return _play_rock(p_gen, q_gen);
      }

      case c3__nock: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        return c3__noun;
      }

      case c3__sand: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        return _play_sand(p_gen, q_gen);
      }

      case c3__hand: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        return u3k(p_gen);
      }

      case c3__iron: p_gen = u3t(gen);
      _play_used();
      {
        u3_noun boc = _play_x(van, sut, p_gen);
        u3_noun pro = u3qfu_wrap(van, boc, c3__iron);

        u3z(boc);
        return pro;
      }

      case c3__zinc: p_gen = u3t(gen);
      _play_used();
      {
        u3_noun boc = _play_x(van, sut, p_gen);
        u3_noun pro = u3qfu_wrap(van, boc, c3__zinc);

        u3z(boc);
        return pro;
      }

      case c3__lead: p_gen = u3t(gen);
      _play_used();
      {
        u3_noun boc = _play_x(van, sut, p_gen);
        u3_noun pro = u3qfu_wrap(van, boc, c3__lead);

        u3z(boc);
        return pro;
      }

      case c3__name: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        u3_noun boc = _play_x(van, sut, q_gen);
        u3_noun ret = u3qfu_conk(van, boc, p_gen);

        u3z(boc);
        return ret;
      }

      case c3__burn: p_gen = u3t(gen);
      _play_used();
      {
        return _play_x(van, sut, p_gen);
      }

      case c3__like: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        return _play_x(van, sut, p_gen);
      }

      case c3__per: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        u3_noun boc = _play_x(van, sut, p_gen);
        u3_noun ret = _play_x(van, boc, q_gen);

        u3z(boc);
        return ret;
      }

      case c3__aka: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
      _play_used();
      {
        u3_noun boc = u3qfu_buss(van, sut, p_gen, q_gen);
        u3_noun ret = _play_x(van, boc, r_gen);

        u3z(boc);
        return ret;
      }

      case c3__make: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        return _play_cnts(van, sut, p_gen, q_gen);
      }

      case c3__core: p_gen = u3t(gen);
      _play_used();
      {
        u3_noun ruf = u3nc(u3_nul, 1);
        u3_noun ret = _play_grow(van, sut, c3__gold, ruf, p_gen);

        u3z(ruf);
        return ret;
      }

      case c3__peep: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        u3_noun typ = u3qfu_play(van, sut, p_gen);
        u3_noun dug = u3qfu_duck(van, typ);
        u3_noun ret;

        u3t_push(u3nc(c3__mean, dug));
        {
          ret = _play_x(van, sut, q_gen);
        }
        u3t_drop();

        u3z(typ);
        return ret;
      }

      case c3__hint: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        return _play_x(van, sut, q_gen);
      }

      case c3__code: p_gen = u3t(gen);
      _play_used();
      {
        return c3__noun;
      }

      case c3__twig: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        return _play_x(van, sut, p_gen);
      }

      case c3__dbug: u3x_cell(u3t(gen), &p_gen, &q_gen);
      {
        u3_noun ret;

        u3t_push(u3nc(c3__mean, _play_loc(van, p_gen)));
        {
          ret = _play_x(van, sut, q_gen);
        }
        u3t_drop();
        return ret;
      }

      case c3__spit: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        u3_noun zur = _play_x(van, sut, p_gen);
        u3_noun vos = _play_x(van, sut, q_gen);
        u3_noun ret = u3qf_cell(zur, vos);

        u3z(zur);
        u3z(vos);

        return ret;
      }

      case c3__lost:
      case c3__fail:
      _play_used();
      {
        return c3__void;
      }
    }
  }
Exemple #11
0
  static u3_noun
  _mint_in(u3_noun van,
           u3_noun sut,
           u3_noun gol,
           u3_noun gen)
  {
    u3_noun p_gen, q_gen, r_gen;
    u3_noun ret;

    if ( (c3__void == sut) &&
         !((c3y == u3du(gen)) && (c3__zpcb == u3h(gen))) )
    {
      if ( (c3n == _mint_vet(van))
           || ((c3y == u3du(gen)) &&
               ((c3__zpfs == u3h(gen)) || (c3__zpzp == u3h(gen)))) )
      {
        return u3nt(c3__void, 0, 0);
      }
      else {
        return u3m_error("mint-vain");
      }
    }

    if ( c3n == u3du(gen) ) {
      u3_noun ter = u3r_at(u3x_con_3, van);
      u3_noun rex = u3qfp_open(ter, gen);

      ret = _mint_in(van, sut, gol, rex);
      u3z(rex);

      return ret;
    }
    else if ( c3y == u3du(u3h(gen)) ) {
      _mint_used();
      {
        u3_noun hed = _mint_in(van, sut, c3__noun, u3h(gen));
        u3_noun tal = _mint_in(van, sut, c3__noun, u3t(gen));
        u3_noun typ = u3qf_cell(u3h(hed), u3h(tal));

        ret = u3nc
          (
           _mint_nice(van, gol, typ),
           u3qf_cons(u3t(hed), u3t(tal)));

        u3z(hed);
        u3z(tal);

        return ret;
      }
    } else switch ( u3h(gen) ) {
      default: {
        u3_noun ter = u3r_at(u3x_con_3, van);
        u3_noun rex = u3qfp_open(ter, gen);

        if ( c3y == u3r_sing(rex, gen) ) {
#if 1
          u3_noun zix = u3qfu_shep(van, "gene", 'q', u3k(gen));

          u3t_push(u3nc(c3__mean, zix));
          return u3m_error("mint-open");
#else
          u3_err("h", u3h(gen));
          return u3m_bail(c3__fail);
#endif
        }
        ret = _mint_in(van, sut, gol, rex);
        u3z(rex);

        return ret;
      }

      case c3__bcpt: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _mint_used();
      {
        u3_noun sep = u3qfu_seep(van, sut, c3__read, p_gen);
        u3_noun axe = u3h(sep);
        u3_noun rex = u3qfl_whip(van, q_gen, axe);
        u3_noun ret = _mint_in(van, sut, gol, rex);

        u3z(sep);
        u3z(rex);

        return ret;
      }

      case c3__wtts: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _mint_used();
      {
        u3_noun nob = u3qfl_bunt(van, p_gen);
        u3_noun dok = u3nc(c3__cnzz, u3k(q_gen));
        u3_noun vol = _mint_corn(van, sut, dok);
        u3_noun axe = _mint_coke(vol);
        u3_noun wam = u3qfu_play(van, sut, nob);

        ret = u3nc
          (
           _mint_nice(van, gol, _mint_bean()),
           u3qfu_fish(van, wam, axe));

        u3z(axe);
        u3z(wam);
        u3z(nob);
        u3z(dok);

        return ret;
      }

      case c3__wtcl: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
      _mint_used();
      {
        u3_noun bol = _mint_bean();
        u3_noun nor = _mint_in(van, sut, bol, p_gen);
        u3_noun fex = u3qfu_gain(van, sut, p_gen);
        u3_noun wux = u3qfu_lose(van, sut, p_gen);
        u3_noun duy = (c3__void == fex)
                        ? ( (c3__void == wux)
                             ?  u3nc(0, 0)
                             :  u3nc(1, 1) )
                        : ( (c3__void == wux)
                            ?  u3nc(1, 0)
                            :  u3k(u3t(nor)) );
        u3_noun hiq = _mint_in(van, fex, gol, q_gen);
        u3_noun ran = _mint_in(van, wux, gol, r_gen);

        ret = u3nc
          (u3qf_fork(u3h(hiq), u3h(ran)),
                  _mint_cond(duy,
                                    u3k(u3t(hiq)),
                                    u3k(u3t(ran))));

        u3z(ran);
        u3z(hiq);
        u3z(nor);
        u3z(wux);
        u3z(fex);
        u3z(bol);

        return ret;
      }
      case c3__clhp: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _mint_used();
      {
        u3_noun hed = _mint_in(van, sut, c3__noun, p_gen);
        u3_noun tal = _mint_in(van, sut, c3__noun, q_gen);
        u3_noun typ = u3qf_cell(u3h(hed), u3h(tal));

        ret = u3nc
          (
           _mint_nice(van, gol, typ),
           u3qf_cons(u3t(hed), u3t(tal)));

        u3z(hed);
        u3z(tal);

        return ret;
      }
      case c3__dtts: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _mint_used();
      {
        u3_noun typ = _mint_nice(van, gol, _mint_bean());
        u3_noun one = _mint_corn(van, sut, p_gen);
        u3_noun two = _mint_corn(van, sut, q_gen);

        return u3nc(typ, u3nt(5, one, two));
      }
      case c3__dtwt: p_gen = u3t(gen);
      _mint_used();
      {
        u3_noun typ = _mint_nice(van, gol, _mint_bean());

        return u3nc
          (
           typ,
           u3nc(3, _mint_corn(van, sut, p_gen)));
      }
      case c3__dtkt: p_gen = u3t(gen);
      _mint_used();
      {
        u3_noun tom = c3__noun;
        u3_noun sam = _mint_in(van, sut, tom, p_gen);

        ret = u3nc
          (
           _mint_nice(van, gol, tom),
           u3nc(11, u3k(u3t(sam))));

        u3z(sam);
        return ret;
      }
      case c3__dtls: p_gen = u3t(gen);
      _mint_used();
      {
        u3_noun tom = u3nc(c3__atom, u3_blip);
        u3_noun sam = _mint_in(van, sut, tom, p_gen);

        ret = u3nc
          (
           _mint_nice(van, gol, tom),
           u3nc(4, u3k(u3t(sam))));

        u3z(sam);
        return ret;
      }
      case c3__dtzz: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _mint_used();
      {
        u3_noun boc = (c3n == u3ud(q_gen))
                        ? c3__noun
                        : u3nc(c3__atom, u3k(p_gen));
        u3_noun typ = u3qf_cube(q_gen, boc);
        u3_noun ret =
            u3nc(
                  _mint_nice(van, gol, typ),
                  u3nc(1, u3k(q_gen)));

        u3z(boc);
        return ret;
      }
      case c3__dttr: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _mint_used();
      {
        u3_noun one = _mint_corn(van, sut, p_gen);
        u3_noun two = _mint_corn(van, sut, q_gen);

        return u3nc
          (
           _mint_nice(van, gol, c3__noun),
           u3nt(2, one, two));
      }
      case c3__dtzy: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _mint_used();
      {
        u3_noun typ = u3qfu_play(van, sut, gen);
        u3_noun ret =
            u3nc(
                  _mint_nice(van, gol, typ),
                  u3nc(1, u3k(q_gen)));

        return ret;
      }
      case c3__ktbr: p_gen = u3t(gen);
      _mint_used();
      {
        u3_noun ryd = _mint_in(van, sut, gol, p_gen);
        u3_noun tyf = u3qfu_wrap(van, u3h(ryd), c3__iron);
        u3_noun pro = u3nc(tyf, u3k(u3t(ryd)));

        u3z(ryd);
        return pro;
      }
      case c3__ktpm: p_gen = u3t(gen);
      _mint_used();
      {
        u3_noun ryd = _mint_in(van, sut, gol, p_gen);
        u3_noun tyf = u3qfu_wrap(van, u3h(ryd), c3__zinc);
        u3_noun pro = u3nc(tyf, u3k(u3t(ryd)));

        u3z(ryd);
        return pro;
      }
      case c3__ktwt: p_gen = u3t(gen);
      _mint_used();
      {
        u3_noun ryd = _mint_in(van, sut, gol, p_gen);
        u3_noun tyf = u3qfu_wrap(van, u3h(ryd), c3__lead);
        u3_noun pro = u3nc(tyf, u3k(u3t(ryd)));

        u3z(ryd);
        return pro;
      }
      case c3__ktts: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _mint_used();
      {
        u3_noun vat = _mint_in(van, sut, gol, q_gen);

        ret = u3nc
          (
           u3qfu_conk(van, u3h(vat), p_gen),
           u3k(u3t(vat)));

        u3z(vat);
        return ret;
      }
      case c3__ktzp: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _mint_used();
      {
        u3_noun vat = _mint_in(van, sut, gol, q_gen);

        ret = u3nc
          (
           u3qfu_conk(van, u3h(vat), p_gen),
           u3k(u3t(vat)));

        u3z(vat);
        return ret;
      }
      case c3__ktsg: p_gen = u3t(gen);
      _mint_used();
      {
        u3_noun nef = _mint_in(van, sut, gol, p_gen);
        u3_noun p_nef = u3h(nef);
        u3_noun q_nef = u3t(nef);
        u3_noun fom;

        {
          u3_noun cag = u3qfu_burn(van, sut);
          u3_noun wim = u3n_nock_an(cag, u3k(q_nef));

          if ( 0 == u3h(wim) ) {
            fom = u3nc(1, u3k(u3t(wim)));
          } else {
            fom = u3k(q_nef);
          }
          u3z(wim);
        }
        ret = u3nc(u3k(p_nef), fom);

        u3z(nef);
        return ret;
      }
      case c3__ktls: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _mint_used();
      {
        u3_noun huz = u3qfu_play(van, sut, p_gen);
        u3_noun hif = _mint_nice(van, gol, huz);
        u3_noun zel = _mint_in(van, sut, hif, q_gen);
        u3_noun ret = u3nc(hif, u3k(u3t(zel)));

        u3z(zel);
        return ret;
      }
      case c3__kthx: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _mint_used();
      {
        u3_noun huz = u3qfu_play(van, sut, p_gen);
        u3_noun hif = _mint_nice(van, gol, huz);
        u3_noun zel = _mint_in(van, sut, hif, q_gen);
        u3_noun ret = u3nc(hif, u3k(u3t(zel)));

#if 0
        {
          u3_noun goz = u3qfu_play(van, sut, q_gen);
          u3_noun bar;

          FOO = 1;
          fprintf(stderr, "\r\n");
          bar = u3qfu_nest(van, huz, c3n, goz);
          fprintf(stderr, "kthx: bar %d\r\n", bar);
          FOO = 0;
        }
#endif
        u3z(zel);
        return ret;
      }
      case c3__tsgr: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _mint_used();
      {
        u3_noun fid = _mint_in(van, sut, c3__noun, p_gen);
        u3_noun p_fid = u3h(fid);
        u3_noun q_fid = u3t(fid);
        u3_noun dov = _mint_in(van, p_fid, gol, q_gen);
        u3_noun p_dov = u3h(dov);
        u3_noun q_dov = u3t(dov);

        ret = u3nc
          (u3k(p_dov),
                  u3qf_comb(q_fid, q_dov));

        u3z(fid);
        u3z(dov);
        return ret;
      }
      case c3__tstr: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
      _mint_used();
      {
        u3_noun sep = u3qfu_seep(van, sut, c3__both, q_gen);
        u3_noun bid = u3nt(u3k(p_gen), u3k(q_gen), sep);
        u3_noun boc = u3qf_bull(bid, sut);
        u3_noun ret = _mint_in(van, boc, gol, r_gen);

        u3z(bid);
        u3z(boc);

        return ret;
      }
      case c3__cnts: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _mint_used();
      {
        u3_noun sec = u3qfu_seek(van, sut, c3__read, p_gen);
        u3_noun lar = _mint_foil(sec);
        u3_noun p_lar = u3h(lar);
        u3_noun q_lar = u3t(lar);
        u3_noun pq_lar = u3h(q_lar);
        u3_noun qq_lar = u3t(q_lar);
        u3_noun mew = u3qfu_snub(van, sut, q_gen);
        u3_noun yom = _mint_edit
          (van, sut, mew, p_lar, u3k(qq_lar), u3_nul);
        u3_noun p_yom = u3h(yom);
        u3_noun q_yom = u3t(yom);
        u3_noun ret = u3nc
          (_mint_nice(van, gol, u3k(p_yom)),
                  (0 == pq_lar) ? u3k(q_yom)
                                : u3nt(9, u3k(pq_lar), u3k(q_yom)));

        u3z(yom);
        u3z(mew);
        u3z(lar);

        return ret;
      }
      case c3__pmcl: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _mint_used();
      {
        u3_noun ruf = u3nt
          (c3__clhp,
                  u3nc(u3_nul, 1),
                  u3k(p_gen));
        u3_noun ret = _mint_grow(van, sut, gol, c3__zinc, ruf, q_gen);

        u3z(ruf);
        return ret;
      }
      case c3__brcn: p_gen = u3t(gen);
      _mint_used();
      {
        u3_noun ruf = u3nc(u3_nul, 1);

        ret = _mint_grow(van, sut, gol, c3__gold, ruf, p_gen);
        u3z(ruf);

        return ret;
      }
      case c3__pmcn: p_gen = u3t(gen);
      _mint_used();
      {
        u3_noun ruf = u3nc(u3_nul, 1);

        ret = _mint_grow(van, sut, gol, c3__lead, ruf, p_gen);
        u3z(ruf);

        return ret;
      }
      case c3__pmls: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _mint_used();
      {
        u3_noun ruf = u3nt
          (c3__clhp,
                  u3nc(u3_nul, 1),
                  u3k(p_gen));
        u3_noun ret = _mint_grow(van, sut, gol, c3__iron, ruf, q_gen);

        u3z(ruf);
        return ret;
      }
      case c3__sgzp: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _mint_used();
      {
        u3_noun typ = u3qfu_play(van, sut, p_gen);
        u3_noun dug = u3qfu_duck(van, typ);

        u3t_push(u3nc(c3__mean, dug));
        {
          ret = _mint_in(van, sut, gol, q_gen);
        }
        u3t_drop();

        u3z(typ);
        return ret;
      }
      case c3__sggr: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _mint_used();
      {
        u3_noun hum = _mint_in(van, sut, gol, q_gen);
        u3_noun bez;

          if ( c3y == u3ud(p_gen) ) {
            bez = u3k(p_gen);
          } else {
            bez = u3nc(u3k(u3h(p_gen)),
                               _mint_corn(van, sut, u3t(p_gen)));
          }
          ret = u3nc(
                      u3k(u3h(hum)),
                      u3nt(10, bez, u3k(u3t(hum))));

        u3z(hum);
        return ret;
      }
      case c3__zpts: p_gen = u3t(gen);
      _mint_used();
      {
        u3_noun von = u3i_molt(u3k(van), u3qfu_van_vet, c3n, 0);
        u3_noun sev = _mint_corn(von, sut, p_gen);

        u3z(von);
        return u3nc(c3__noun, u3nc(1, sev));
      }
      case c3__zpcm: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _mint_used();
      {
        return u3nc
          (
           _mint_nice(van,
                             gol,
                             u3qfu_play(van, sut, p_gen)),
           u3nc(1, u3k(q_gen)));
      }
      case c3__zpcb: u3x_cell(u3t(gen), &p_gen, &q_gen);
      {
        u3t_push(u3nc(c3__mean, _mint_loc(van, p_gen)));
        {
          u3_noun hum = _mint_in(van, sut, gol, q_gen);
          u3_noun bez = u3nt(c3__spot, 1, u3k(p_gen));

          ret = u3nc(u3k(u3h(hum)), u3nt(10, bez, u3k(u3t(hum))));
          u3z(hum);
        }
        u3t_drop();
        return ret;
      }
      case c3__zpcn:
      _mint_used();
      {
        u3_noun pet   = u3j_hook(u3k(van), "seed");
        u3_noun p_pet = u3h(pet);
        u3_noun q_pet = u3t(pet);
        u3_noun ret;

        ret = u3nc(_mint_nice(van, gol, u3k(p_pet)),
                           u3nc(1, u3k(q_pet)));

        u3z(pet);
        return ret;
      }
      case c3__zpsm: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _mint_used();
      {
        u3_noun vos   = _mint_in(van, sut, c3__noun, q_gen);
        u3_noun zur   = u3qfu_play(van, sut, p_gen);
        u3_noun p_vos = u3h(vos);
        u3_noun q_vos = u3t(vos);
        u3_noun waz   = u3nc(1, u3k(p_vos));
        u3_noun sif   = u3k(zur);
        u3_noun cig   = u3qf_cell(sif, p_vos);
        u3_noun ret;

        ret = u3nc(
                    _mint_nice(van, gol, cig),
                    u3qf_cons(waz, q_vos));

        u3z(waz);
        u3z(zur);
        u3z(sif);
        u3z(vos);

        return ret;
      }
      case c3__zpfs: p_gen = u3t(gen);
      _mint_used();
      {
        if ( c3y == _mint_vet(van) ) {
          u3_noun zur = u3qfu_play(van, sut, p_gen);
          u3_noun dun = u3qfu_dunq(van, "lost", zur);

          u3t_push(u3nc(c3__mean, dun));
          return u3m_error("mint-lost");
        }
        else {
          return u3nt(c3__void, 0, 0);
        }
      }
      case c3__zpzp:
      _mint_used();
      {
        return u3nt(c3__void, 0, 0);
      }
    }
  }
Exemple #12
0
  static u3_noun
  _play_in(u3_noun van,
           u3_noun sut,
           u3_noun gen)
  {
    u3_noun p_gen, q_gen, r_gen;

    if ( c3n == u3du(gen) ) {
      open: {
        u3_noun ter = u3r_at(u3x_con_3, van);
        u3_noun rex = u3qfp_open(ter, gen);
        u3_noun ret;

        if ( c3y == u3r_sing(rex, gen) ) {
          u3_noun zix = u3qfu_shep(van, "gene", 'q', u3k(gen));

          u3t_push(u3nc(c3__mean, zix));
          return u3m_error("play-open");
        }
        ret = _play_x(van, sut, rex);
        u3z(rex);

        return ret;
      }
    }
    else if ( c3y == u3du(u3h(gen)) ) {
      _play_used();
      {
        u3_noun dis = _play_x(van, sut, u3h(gen));
        u3_noun dat = _play_x(van, sut, u3t(gen));
        u3_noun ret = u3qf_cell(dis, dat);

        u3z(dis);
        u3z(dat);
        return ret;
      }
    }
    else switch ( u3h(gen) ) {
      default: goto open;

      case c3__bcpt: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        u3_noun sep = u3qfu_seep(van, sut, c3__read, p_gen);
        u3_noun axe = u3h(sep);
        u3_noun rex = u3qfl_whip(van, q_gen, axe);
        u3_noun ret = _play_x(van, sut, rex);

        u3z(sep);
        u3z(rex);

        return ret;
      }
      case c3__wtts: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        return _play_bean();
      }
      case c3__wtcl: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
      _play_used();
      {
        u3_noun fex = u3qfu_gain(van, sut, p_gen);
        u3_noun wux = u3qfu_lose(van, sut, p_gen);
        u3_noun dez = (fex == c3__void) ? c3__void
                                        : _play_x(van, fex, q_gen);
        u3_noun doz = (wux == c3__void) ? c3__void
                                        : _play_x(van, wux, r_gen);
        u3_noun ret = u3qf_fork(dez, doz);

        u3z(dez); u3z(doz);
        u3z(fex); u3z(wux);
        return ret;
      }
      case c3__clhp: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        u3_noun dis = _play_x(van, sut, p_gen);
        u3_noun dat = _play_x(van, sut, q_gen);
        u3_noun ret = u3qf_cell(dis, dat);

        u3z(dis);
        u3z(dat);
        return ret;
      }
      case c3__dtkt: p_gen = u3t(gen);
      _play_used();
      {
        return c3__noun;
      }
      case c3__dtwt: p_gen = u3t(gen);
      _play_used();
      {
        return _play_bean();
      }
      case c3__dtts: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        return _play_bean();
      }
      case c3__dtls: p_gen = u3t(gen);
      _play_used();
      {
        return u3nc(c3__atom, u3_blip);
      }
      case c3__dtzz: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        u3_noun boc = (c3n == u3ud(q_gen))
                        ? c3__noun
                        : u3nc(c3__atom, u3k(p_gen));
        u3_noun ret = u3qf_cube(q_gen, boc);

        u3z(boc);
        return ret;
      }
      case c3__dttr: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        return c3__noun;
      }
      case c3__dtzy: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        if ( 'f' == p_gen ) {
          if ( (q_gen > 1) ) {
            return u3m_bail(c3__exit);
          } else {
            return _play_bean();
          }
        }
        else return u3nc(c3__atom, u3k(p_gen));
      }
      case c3__ktbr: p_gen = u3t(gen);
      _play_used();
      {
        u3_noun boc = _play_x(van, sut, p_gen);
        u3_noun pro = u3qfu_wrap(van, boc, c3__iron);

        u3z(boc);
        return pro;
      }
      case c3__ktpm: p_gen = u3t(gen);
      _play_used();
      {
        u3_noun boc = _play_x(van, sut, p_gen);
        u3_noun pro = u3qfu_wrap(van, boc, c3__zinc);

        u3z(boc);
        return pro;
      }
      case c3__ktwt: p_gen = u3t(gen);
      _play_used();
      {
        u3_noun boc = _play_x(van, sut, p_gen);
        u3_noun pro = u3qfu_wrap(van, boc, c3__lead);

        u3z(boc);
        return pro;
      }
      case c3__ktts: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        u3_noun boc = _play_x(van, sut, q_gen);
        u3_noun ret = u3qfu_conk(van, boc, p_gen);

        u3z(boc);
        return ret;
      }
      case c3__ktzp: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        u3_noun boc = _play_x(van, sut, q_gen);
        u3_noun ret = u3qfu_conk(van, boc, p_gen);

        u3z(boc);
        return ret;
      }
      case c3__ktsg: p_gen = u3t(gen);
      _play_used();
      {
        return _play_x(van, sut, p_gen);
      }
      case c3__kthx: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        return _play_x(van, sut, p_gen);
      }
      case c3__ktls: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        return _play_x(van, sut, p_gen);
      }
      case c3__tsgr: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        u3_noun boc = _play_x(van, sut, p_gen);
        u3_noun ret = _play_x(van, boc, q_gen);

        u3z(boc);
        return ret;
      }
      case c3__tstr: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
      _play_used();
      {
        u3_noun sep = u3qfu_seep(van, sut, c3__both, q_gen);
        u3_noun bid = u3nt(u3k(p_gen), u3k(q_gen), sep);
        u3_noun boc = u3qf_bull(bid, sut);
        u3_noun ret = _play_x(van, boc, r_gen);

        u3z(bid);
        u3z(boc);

        return ret;
      }
      case c3__cnts: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        u3_noun sec = u3qfu_seek(van, sut, c3__read, p_gen);
        u3_noun lar = _play_foil(sec);
        u3_noun q_lar = u3t(lar);
        u3_noun qq_lar = u3t(q_lar);
        u3_noun mew = u3qfu_snub(van, sut, q_gen);
        u3_noun rag = _play_edit(van, sut, mew, u3k(qq_lar));
        u3_noun ret = u3qfu_fire(van, sut, rag);

        u3z(rag);
        u3z(mew);
        u3z(lar);

        return ret;
      }
      case c3__pmcl: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        u3_noun ruf = u3nt(c3__clhp,
                           u3nc(u3_nul, 1),
                           u3k(p_gen));
        u3_noun ret = _play_grow(van, sut, c3__zinc, ruf, q_gen);

        u3z(ruf);
        return ret;
      }
      case c3__brcn: p_gen = u3t(gen);
      _play_used();
      {
        u3_noun ruf = u3nc(u3_nul, 1);
        u3_noun ret = _play_grow(van, sut, c3__gold, ruf, p_gen);

        u3z(ruf);
        return ret;
      }
      case c3__pmcn: p_gen = u3t(gen);
      _play_used();
      {
        u3_noun ruf = u3nc(u3_nul, 1);
        u3_noun ret = _play_grow(van, sut, c3__lead, ruf, p_gen);

        u3z(ruf);
        return ret;
      }
      case c3__pmls: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        u3_noun ruf = u3nt(c3__clhp,
                           u3nc(u3_nul, 1),
                           u3k(p_gen));
        u3_noun ret = _play_grow(van, sut, c3__iron, ruf, q_gen);

        u3z(ruf);
        return ret;
      }
      case c3__sgzp: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        u3_noun typ = u3qfu_play(van, sut, p_gen);
        u3_noun dug = u3qfu_duck(van, typ);
        u3_noun ret;

        u3t_push(u3nc(c3__mean, dug));
        {
          ret = _play_x(van, sut, q_gen);
        }
        u3t_drop();

        u3z(typ);
        return ret;
      }
      case c3__sggr: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        return _play_x(van, sut, q_gen);
      }
      case c3__zpts: p_gen = u3t(gen);
      _play_used();
      {
        return c3__noun;
      }
      case c3__zpcm: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        return _play_x(van, sut, p_gen);
      }
      case c3__zpcb: u3x_cell(u3t(gen), &p_gen, &q_gen);
      {
        u3_noun ret;

        u3t_push(u3nc(c3__mean, _play_loc(van, p_gen)));
        {
          ret = _play_x(van, sut, q_gen);
        }
        u3t_drop();
        return ret;
      }
      case c3__zpcn:
      _play_used();
      {
        u3_noun pet = u3j_hook(u3k(van), "seed");
        u3_noun ret = u3k(u3h(pet));

        u3z(pet);
        return ret;
      }
      case c3__zpsm: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        u3_noun zur = _play_x(van, sut, p_gen);
        u3_noun vos = _play_x(van, sut, q_gen);
        u3_noun ret = u3qf_cell(zur, vos);

        u3z(zur);
        u3z(vos);

        return ret;
      }
      case c3__zpfs:
      case c3__zpzp:
      _play_used();
      {
        return c3__void;
      }
    }
  }
Exemple #13
0
  static u3_noun
  _cull_in(u3_noun van,
           u3_noun sut,
           u3_noun pol,
           u3_atom axe,
           u3_noun ref,
           u3_noun now,
           u3_noun lat,
           u3_noun vil)
  {
    u3_noun ret, p_sut, q_sut;

    if ( c3n == u3du(sut) ) switch ( sut ) {
      default: return u3m_bail(c3__fail);

      case c3__noun: {
        u3_noun pyr = u3qfu_repo(van, sut);
        u3_noun yot = _cqfu_cull(van, pyr, pol, axe, ref);

        if ( c3y == u3r_sing(pyr, yot) ) {
          ret = u3k(sut);
        } else {
          ret = u3k(yot);
        }
        u3z(pyr);
        u3z(yot);
        break;
      }
      case c3__void: {
        ret = c3__void;
      }
    }
    else switch ( u3h(sut) ) {
      default: return u3m_bail(c3__fail);

      case c3__atom: {
        ret = c3__void;
        break;
      }
      case c3__bull: u3x_cell(u3t(sut), &p_sut, &q_sut);
      {
        u3_noun hic = _cqfu_cull(van, q_sut, pol, axe, ref);

        if ( c3y == u3r_sing(hic, q_sut) ) {
          ret = u3k(sut);
        } else {
          ret = u3qf_bull(p_sut, hic);
        }
        u3z(hic);

        break;
      }
      case c3__cell: u3x_cell(u3t(sut), &p_sut, &q_sut);
      {
        u3_noun hub;

        if ( 2 == now ) {
          hub = _cqfu_cull(van, p_sut, pol, lat, ref);
          ret = u3qf_cell(hub, q_sut);
        } else {
          hub = _cqfu_cull(van, q_sut, pol, lat, ref);
          ret = u3qf_cell(p_sut, hub);
        }
        u3z(hub);
        break;
      }
      case c3__core: u3x_cell(u3t(sut), &p_sut, &q_sut);
      {
        if ( 3 != now ) {
          ret = u3k(sut);
        } else {
          u3_noun hub = _cqfu_cull(van, p_sut, pol, lat, ref);

          ret = u3qf_core(hub, q_sut);

          u3z(hub);
        }
        break;
      }
      case c3__face: u3x_cell(u3t(sut), &p_sut, &q_sut);
      {
        u3_noun hic = _cqfu_cull(van, q_sut, pol, axe, ref);

        if ( c3y == u3r_sing(hic, q_sut) ) {
          ret = u3k(sut);
        } else {
          ret = u3qf_face(p_sut, hic);
        }
        u3z(hic);

        break;
      }
      case c3__fork: u3x_cell(u3t(sut), &p_sut, &q_sut);
      {
        if ( c3y == u3qdi_has(vil, sut) ) {
          return c3__void;
        } else {
          u3_noun zoc = u3qdi_put(vil, sut);
          u3_noun sin = _cull_in(van, p_sut, pol, axe, ref, now, lat, zoc);
          u3_noun dex = _cull_in(van, q_sut, pol, axe, ref, now, lat, zoc);

          ret = u3qf_fork(sin, dex);
          u3z(sin);
          u3z(dex);
          u3z(zoc);

          return ret;
        }
      }
      case c3__cube:
      case c3__hold:
      {
        u3_noun pyr = u3qfu_repo(van, sut);
        u3_noun yot = _cull_in(van, pyr, pol, axe, ref, now, lat, vil);

        if ( c3y == u3r_sing(pyr, yot) ) {
          if ( c3__void == pyr ) {
            ret = c3__void;
          }
          else ret = u3k(sut);
        } else {
          ret = u3k(yot);
        }
        u3z(pyr);
        u3z(yot);
        break;
      }
    }
    u3z(lat);
    return ret;
  }
Exemple #14
0
  static u3_noun
  _heal_by(
           u3_noun van,
           u3_noun sut,
           u3_noun qog,
           u3_noun ref)
  {
    u3_noun p_sut, q_sut;

    if ( c3n == u3du(sut) ) {
      return u3m_error("heal-name");
    }
    else switch ( u3h(sut) ) {
      default: return u3m_error("heal-name");

      case c3__core:
      {
        return u3k(ref);
      }
      case c3__bull: u3x_cell(u3t(sut), &p_sut, &q_sut);
      {
        if ( c3y == u3r_sing(u3h(p_sut), u3t(qog)) ) {
          return u3k(ref);
        }
        else {
          u3_noun sub = _heal_by(van, q_sut, qog, ref);
          u3_noun ret;

          ret = u3qfu_busk
            (van, sub, u3h(p_sut), u3h(u3t(p_sut)));

          u3z(sub);
          return ret;
        }
      }
      case c3__face: u3x_cell(u3t(sut), &p_sut, &q_sut);
      {
        if ( c3y == u3r_sing(p_sut, u3t(qog)) ) {
          return u3qf_face(p_sut, ref);
        }
        else return u3m_error("heal-name");
      }
      case c3__hold: {
        u3_noun rep = u3qfu_repo(van, sut);
        u3_noun ret = _heal_by(van, rep, qog, ref);

        u3z(rep);
        return ret;
      }
      case c3__fork: u3x_cell(u3t(sut), &p_sut, &q_sut);
      {
        u3_noun dis = _heal_by(van, p_sut, qog, ref);
        u3_noun dat = _heal_by(van, q_sut, qog, ref);
        u3_noun ret = u3qf_fork(dis, dat);

        u3z(dis);
        u3z(dat);
        return ret;
      }
    }
  }
Exemple #15
0
  static u3_noun
  _play_in(u3_noun van,
           u3_noun sut,
           u3_noun gen)
  {
    u3_noun p_gen, q_gen, r_gen;

    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 = (c3n == fab) ? u3qfp_nepo(ter, gen)
                                   : u3qfp_open(ter, gen);
        u3_noun ret;

        if ( c3y == u3r_sing(rex, gen) ) {
          u3_noun zix = u3qfu_shep(van, "gene", 'q', u3k(gen));

          u3t_push(u3nc(c3__mean, zix));
          return u3m_error("play-open-z");
        }
        ret = _play_x(van, sut, rex);
        u3z(rex);

        return ret;
      }
    }
    else if ( c3y == u3du(u3h(gen)) ) {
      _play_used();
      {
        u3_noun dis = _play_x(van, sut, u3h(gen));
        u3_noun dat = _play_x(van, sut, u3t(gen));
        u3_noun ret = u3qf_cell(dis, dat);

        u3z(dis);
        u3z(dat);
        return ret;
      }
    }
    else switch ( u3h(gen) ) {
      default: goto open;

      case c3__fits: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        return _play_bean();
      }

      case c3__wtcl: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
      _play_used();
      {
        u3_noun fex = u3qfu_gain(van, sut, p_gen);
        u3_noun wux = u3qfu_lose(van, sut, p_gen);
        u3_noun dez = (fex == c3__void) ? c3__void
                                        : _play_x(van, fex, q_gen);
        u3_noun doz = (wux == c3__void) ? c3__void
                                        : _play_x(van, wux, r_gen);
        u3_noun ret = u3qf_forq(dez, doz);

        u3z(dez); u3z(doz);
        u3z(fex); u3z(wux);
        return ret;
      }

      case c3__clhp: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        u3_noun dis = _play_x(van, sut, p_gen);
        u3_noun dat = _play_x(van, sut, q_gen);
        u3_noun ret = u3qf_cell(dis, dat);

        u3z(dis);
        u3z(dat);
        return ret;
      }

      case c3__dtkt: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        u3_noun nog = u3nc(c3__bunt, u3k(p_gen));
        u3_noun ret = _play_x(van, sut, nog);

        u3z(nog);
        return ret;
      }

      case c3__dtwt: p_gen = u3t(gen);
      _play_used();
      {
        return _play_bean();
      }

      case c3__dtts: u3x_cell(u3t(gen), &p_gen, &q_gen); 
      _play_used();
      {
        return _play_bean();
      }
      
      case c3__dtls: p_gen = u3t(gen);
      _play_used();
      {
        return u3nt(c3__atom, u3_blip, u3_nul);
      }

      case c3__rock: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        return _play_rock(p_gen, q_gen);
      }

      case c3__dttr: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        return c3__noun;
      }

      case c3__sand: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        return _play_sand(p_gen, q_gen);
      }

      case c3__hand: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        return u3k(p_gen);
      }

      case c3__ktbr: p_gen = u3t(gen);
      _play_used();
      {
        u3_noun boc = _play_x(van, sut, p_gen);
        u3_noun pro = u3qfu_wrap(van, boc, c3__iron);

        u3z(boc);
        return pro;
      }

      case c3__ktpm: p_gen = u3t(gen);
      _play_used();
      {
        u3_noun boc = _play_x(van, sut, p_gen);
        u3_noun pro = u3qfu_wrap(van, boc, c3__zinc);

        u3z(boc);
        return pro;
      }

      case c3__ktwt: p_gen = u3t(gen);
      _play_used();
      {
        u3_noun boc = _play_x(van, sut, p_gen);
        u3_noun pro = u3qfu_wrap(van, boc, c3__lead);

        u3z(boc);
        return pro;
      }

      case c3__help: 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);

        u3z(boc);
        return ret;
      }

      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();
      {
        u3_noun boc = _play_x(van, sut, q_gen);
        u3_noun ret = u3qfu_conk(van, boc, p_gen);

        u3z(boc);
        return ret;
      }

      case c3__tune: p_gen = u3t(gen);
      _play_used();
      {
        return u3qf_face(p_gen, sut);
      }

      case c3__ktsg: p_gen = u3t(gen);
      _play_used();
      {
        return _play_x(van, sut, p_gen);
      }

      case c3__ktls: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        return _play_x(van, sut, p_gen);
      }

      case c3__tsgr: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        u3_noun boc = _play_x(van, sut, p_gen);
        u3_noun ret = _play_x(van, boc, q_gen);

        u3z(boc);
        return ret;
      }

      case c3__tstr: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
      _play_used();
      {
        u3_noun boc = u3qfu_buss(van, sut, p_gen, q_gen);
        u3_noun ret = _play_x(van, boc, r_gen);

        u3z(boc);
        return ret;
      }

      case c3__tscm: 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__cnts: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        return _play_cnts(van, sut, p_gen, q_gen);
      }

      case c3__brcn: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        u3_noun ruf = u3nc(u3_nul, 1);
        u3_noun ret = _play_grow(van, sut, c3__gold, ruf, p_gen, q_gen);

        u3z(ruf);
        return ret;
      }

      case c3__sgzp: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        u3_noun typ = u3qfu_play(van, sut, p_gen);
        u3_noun dug = u3qfu_duck(van, typ);
        u3_noun ret;

        u3t_push(u3nc(c3__mean, dug));
        {
          ret = _play_x(van, sut, q_gen);
        }
        u3t_drop();

        u3z(typ);
        return ret;
      }

      case c3__sggr: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        return _play_x(van, sut, q_gen);
      }

      case c3__zpts: p_gen = u3t(gen);
      _play_used();
      {
        return c3__noun;
      }

      case c3__ktcn: p_gen = u3t(gen);
      {
        u3_noun von = u3i_molt(u3k(van), u3qfu_van_fab, c3n, 0);
        u3_noun ret = _play_x(von, sut, p_gen);

        u3z(von);
        return ret;
      }

      case c3__zpcm: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        return _play_x(van, sut, p_gen);
      }

      case c3__dbug: u3x_cell(u3t(gen), &p_gen, &q_gen);
      {
        u3_noun ret;

#if 0
        {
          u3_noun cog = _play_loc_term(van, p_gen);

          u3t_heck(cog);
          u3z(cog);
        }
#endif
        u3t_push(u3nc(c3__mean, _play_loc(van, p_gen)));
        {
          ret = _play_x(van, sut, q_gen);
        }
        u3t_drop();
        return ret;
      }

      case c3__zpmc:
      case c3__zpsm: u3x_cell(u3t(gen), &p_gen, &q_gen);
      _play_used();
      {
        u3_noun zur = _play_x(van, sut, p_gen);
        u3_noun vos = _play_x(van, sut, q_gen);
        u3_noun ret = u3qf_cell(zur, vos);

        u3z(zur);
        u3z(vos);

        return ret;
      }

      case c3__lost:
      case c3__fail:
      case c3__zpzp:
      _play_used();
      {
        return c3__void;
      }
    }
  }
Exemple #16
0
  static u3_noun
  _heal_to(
           u3_noun van,
           u3_noun sut,
           u3_noun gil,
           u3_noun qog,
           u3_noun ref,
           u3_atom now,
           u3_atom lat)
  {
    u3_noun p_sut, q_sut;

    if ( c3n == u3du(sut) ) {
      goto repo;
    }
    else switch ( u3h(sut) ) {
      default: goto repo;

      case c3__atom: return c3__void;

      case c3__bull: u3x_cell(u3t(sut), &p_sut, &q_sut);
      {
        u3_noun sub = _heal_to(van, q_sut, gil, qog, ref, now, lat);
        u3_noun ret;

        ret = u3qfu_busk
          (van, sub, u3h(p_sut), u3h(u3t(p_sut)));

        u3z(sub);
        return ret;
      }
      case c3__cell: u3x_cell(u3t(sut), &p_sut, &q_sut);
      {
        u3_noun ter, ret;

        if ( 2 == now ) {
          ter = _heal_as(van, p_sut, qog, lat, ref);
          ret = u3qf_cell(ter, q_sut);
        } else {
          ter = _heal_as(van, q_sut, qog, lat, ref);
          ret = u3qf_cell(p_sut, ter);
        }
        u3z(ter);
        return ret;
      }

      case c3__core: u3x_cell(u3t(sut), &p_sut, &q_sut);
      {
        if ( 3 != now ) {
          return u3m_error("heal-core");
        } else {
          u3_noun ter = _heal_as(van, p_sut, qog, lat, ref);
          u3_noun ret = u3qf_core(ter, q_sut);

          u3z(ter);
          return ret;
        }
      }
      case c3__face: u3x_cell(u3t(sut), &p_sut, &q_sut);
      {
        u3_noun dun = _heal_to(van, q_sut, gil, qog, ref, now, lat);
        u3_noun ret = u3qf_face(p_sut, dun);

        u3z(dun);
        return ret;
      }
      case c3__fork: u3x_cell(u3t(sut), &p_sut, &q_sut);
      {
        u3_noun dis = _heal_to(van, p_sut, gil, qog, ref, now, lat);
        u3_noun dat = _heal_to(van, q_sut, gil, qog, ref, now, lat);
        u3_noun ret = u3qf_fork(dis, dat);

        u3z(dis);
        u3z(dat);
        return ret;
      }

      case c3__hold: {
        if ( (c3y == u3qdi_has(gil, sut)) ) {
          return c3__void;
        }
        else {
          u3_noun zoc = u3qdi_put(gil, sut);
          u3_noun rep = u3qfu_repo(van, sut);
          u3_noun ret = _heal_to(van, rep, zoc, qog, ref, now, lat);

          u3z(rep);
          u3z(zoc);

          return ret;
        }
      }
    }

    repo: {
      u3_noun rep = u3qfu_repo(van, sut);
      u3_noun ret = _heal_to(van, rep, gil, qog, ref, now, lat);

      u3z(rep);
      return ret;
    }
  }
Exemple #17
0
  static u3_noun
  _fuse_in(u3_noun van,
           u3_noun sut,
           u3_noun ref,
           u3_noun bix)
  {
    u3_noun p_sut, q_sut;

    if ( c3y == u3r_sing(sut, ref) || (c3__noun == ref) ) {
      return u3k(sut);
    }
    if ( c3n == u3du(sut) ) switch ( sut ) {
      default: return u3m_bail(c3__fail);

      case c3__noun:
      {
        return u3k(ref);
      }
      case c3__void:
      {
        return c3__void;
      }
    }
    else switch ( u3h(sut) ) {
      default: return u3m_bail(c3__fail);

      case c3__atom: u3x_cell(u3t(sut), &p_sut, &q_sut);
      {
        if ( c3y == u3du(ref) ) {
          if ( c3__atom == u3h(ref) ) {
            u3_noun p_ref, q_ref;

            u3x_cell(u3t(ref), &p_ref, &q_ref);
            {
              u3_noun foc = (c3y == u3qf_fitz(p_ref, p_sut))
                              ? u3k(p_sut)
                              : u3k(p_ref);

              if ( c3y == u3du(q_sut) ) {
                if ( c3y == u3du(q_ref) ) {
                  if ( c3y == u3r_sing(q_ref, q_sut) ) {
                    return u3nt(c3__atom, foc, u3k(q_sut));
                  }
                  else { 
                    u3z(foc);
                    return c3__void;
                  }
                }
                else {
                  return u3nt(c3__atom, foc, u3k(q_sut));
                }
              } else {
                return u3nt(c3__atom, foc, u3k(q_ref));
              }
            }
          }
          else if ( c3__cell == u3h(ref) ) {
            return c3__void;
          }
        }
        return _fuse_in(van, ref, sut, bix);
      }
      case c3__cell: u3x_cell(u3t(sut), &p_sut, &q_sut);
      {
        u3_noun p_ref, q_ref;

        if ( c3y == u3r_pq(ref, c3__cell, &p_ref, &q_ref) ) {
          u3_noun hed = _fuse_in(van, p_sut, p_ref, bix);
          u3_noun tal = _fuse_in(van, q_sut, q_ref, bix);
          u3_noun ret = u3qf_cell(hed, tal);

          u3z(hed);
          u3z(tal);
          return ret;
        }
        else return _fuse_in(van, ref, sut, bix);
      }
      case c3__core:
      {
        return _fuse_repo(van, sut, ref, bix);
      }
      case c3__help: 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);

        u3z(vot);
        return ret;
      }
      case c3__face: u3x_cell(u3t(sut), &p_sut, &q_sut);
      {
        u3_noun vot = _fuse_in(van, q_sut, ref, bix);
        u3_noun ret = u3qf_face(p_sut, vot);

        u3z(vot);
        return ret;
      }
      case c3__fork: p_sut = u3t(sut);
      {
        u3_noun yed = u3qdi_tap(p_sut);
        u3_noun ret = u3kf_fork(_fuse_in_fork(van, yed, ref, bix));

        u3z(yed);
        return ret;
      }
      case c3__hold:
      {
        u3_noun hud = u3nc(u3k(sut), u3k(ref));

        if ( c3y == u3qdi_has(bix, hud) ) {
          //  u3_noun dun = u3qfu_dunq(van, "type", sut);
          //  u3_noun niz = u3qfu_dunq(van, "over", ref);

          //  u3t_push(u3nc(c3__mean, dun));
          //  u3t_push(u3nc(c3__mean, niz));

          return u3m_error("fuse-loop");
        } else {
          u3_noun bux = u3qdi_put(bix, hud);
          u3_noun ret = _fuse_repo(van, sut, ref, bux);

          u3z(hud);
          u3z(bux);
          return ret;
        }
      }
    }
  }
Exemple #18
0
/* _n_nock_on(): produce .*(bus fol).  Do not virtualize.
*/
static u3_noun
_n_nock_on(u3_noun bus, u3_noun fol)
{
  u3_noun hib, gal;

  while ( 1 ) {
    hib = u3h(fol);
    gal = u3t(fol);

    u3R->pro.nox_d += 1;

    if ( c3y == u3r_du(hib) ) {
      u3_noun poz, riv;

      poz = _n_nock_on(u3k(bus), u3k(hib));
      riv = _n_nock_on(bus, u3k(gal));

      u3a_lose(fol);
      return u3i_cell(poz, riv);
    }
    else switch ( hib ) {
      default: return u3m_bail(c3__exit);

      case 0: {
        if ( c3n == u3r_ud(gal) ) {
          return u3m_bail(c3__exit);
        }
        else {
          u3_noun pro = u3k(u3at(gal, bus));

          u3a_lose(bus); u3a_lose(fol);
          return pro;
        }
      }
      c3_assert(!"not reached");

      case 1: {
        u3_noun pro = u3k(gal);

        u3a_lose(bus); u3a_lose(fol);
        return pro;
      }
      c3_assert(!"not reached");

      case 2: {
        u3_noun nex = _n_nock_on(u3k(bus), u3k(u3t(gal)));
        u3_noun seb = _n_nock_on(bus, u3k(u3h(gal)));

        u3a_lose(fol);
        bus = seb;
        fol = nex;
        continue;
      }
      c3_assert(!"not reached");

      case 3: {
        u3_noun gof, pro;

        gof = _n_nock_on(bus, u3k(gal));
        pro = u3r_du(gof);

        u3a_lose(gof); u3a_lose(fol);
        return pro;
      }
      c3_assert(!"not reached");

      case 4: {
        u3_noun gof, pro;

        gof = _n_nock_on(bus, u3k(gal));
        pro = u3i_vint(gof);

        u3a_lose(fol);
        return pro;
      }
      c3_assert(!"not reached");

      case 5: {
        u3_noun wim = _n_nock_on(bus, u3k(gal));
        u3_noun pro = u3r_sing(u3h(wim), u3t(wim));

        u3a_lose(wim); u3a_lose(fol);
        return pro;
      }
      c3_assert(!"not reached");

      case 6: {
        u3_noun b_gal, c_gal, d_gal;

        u3x_trel(gal, &b_gal, &c_gal, &d_gal);
        {
          u3_noun tys = _n_nock_on(u3k(bus), u3k(b_gal));
          u3_noun nex;

          if ( 0 == tys ) {
            nex = u3k(c_gal);
          } else if ( 1 == tys ) {
            nex = u3k(d_gal);
          } else return u3m_bail(c3__exit);

          u3a_lose(fol);
          fol = nex;
          continue;
        }
      }
      c3_assert(!"not reached");

      case 7: {
        u3_noun b_gal, c_gal;

        u3x_cell(gal, &b_gal, &c_gal);
        {
          u3_noun bod = _n_nock_on(bus, u3k(b_gal));
          u3_noun nex = u3k(c_gal);

          u3a_lose(fol);
          bus = bod;
          fol = nex;
          continue;
        }
      }
      c3_assert(!"not reached");

      case 8: {
        u3_noun b_gal, c_gal;

        u3x_cell(gal, &b_gal, &c_gal);
        {
          u3_noun heb = _n_nock_on(u3k(bus), u3k(b_gal));
          u3_noun bod = u3nc(heb, bus);
          u3_noun nex = u3k(c_gal);

          u3a_lose(fol);
          bus = bod;
          fol = nex;
          continue;
        }
      }
      c3_assert(!"not reached");

      case 9: {
        u3_noun b_gal, c_gal;

        u3x_cell(gal, &b_gal, &c_gal);
        {
          u3_noun seb = _n_nock_on(bus, u3k(c_gal));
          u3_noun pro;
         
          u3t_off(noc_o);
          pro = u3j_kick(seb, b_gal);
          u3t_on(noc_o);

          if ( u3_none != pro ) {
            u3a_lose(fol);
            return pro;
          }
          else {
            if ( c3n == u3r_ud(b_gal) ) {
              return u3m_bail(c3__exit);
            }
            else {
              u3_noun nex = u3k(u3at(b_gal, seb));

              u3a_lose(fol);
              bus = seb;
              fol = nex;
              continue;
            }
          }
        }
      }
      c3_assert(!"not reached");

      case 10: {
        u3_noun p_gal, q_gal;

        u3x_cell(gal, &p_gal, &q_gal);
        {
          u3_noun zep, hod, nex;

          if ( c3y == u3r_du(p_gal) ) {
            u3_noun b_gal = u3h(p_gal);
            u3_noun c_gal = u3t(p_gal);
            u3_noun d_gal = q_gal;

            zep = u3k(b_gal);
            hod = _n_nock_on(u3k(bus), u3k(c_gal));
            nex = u3k(d_gal);
          }
          else {
            u3_noun b_gal = p_gal;
            u3_noun c_gal = q_gal;

            zep = u3k(b_gal);
            hod = u3_nul;
            nex = u3k(c_gal);
          }

          u3a_lose(fol);
          return _n_hint(zep, hod, bus, nex);
        }
      }

      case 11: {
        u3_noun ref = _n_nock_on(u3k(bus), u3k(u3h(gal)));
        u3_noun gof = _n_nock_on(bus, u3k(u3t(gal)));
        u3_noun val;

        u3t_off(noc_o);
        val = u3m_soft_esc(ref, u3k(gof));
        u3t_on(noc_o);

        if ( !_(u3du(val)) ) {
          u3m_bail(u3nt(1, gof, 0));
        } 
        if ( !_(u3du(u3t(val))) ) {
          //
          //  replace with proper error stack push
          //
          u3t_push(u3nc(c3__hunk, _n_mush(gof)));
          return u3m_bail(c3__exit);
        }
        else {
          u3_noun pro;

          u3z(gof);
          u3z(fol);
          pro = u3k(u3t(u3t(val)));
          u3z(val);

          return pro;
        }
      }  
      c3_assert(!"not reached");
    }
  }
}
Exemple #19
0
  static u3_noun
  _crop_dext(
             u3_noun van,
             u3_noun sut,
             u3_noun ref,
             u3_noun bix)
  {
    u3_noun p_sut, q_sut, p_ref, q_ref;

    if ( c3n == u3du(ref) ) {
      switch ( ref ) {
        case c3__void: return u3k(sut);
        case c3__noun: return c3__void;
        default: return u3m_bail(c3__fail);
      }
    }
    if ( c3y == u3r_sing(sut, ref) ) {
      return c3__void;
    }
    if ( c3n == u3du(sut) ) switch ( sut ) {
      default: return u3m_bail(c3__fail);

      case c3__noun: return _crop_repo(van, sut, ref, bix);
      case c3__void: return c3__void;
    }
    else switch ( u3h(sut) ) {
      default: return u3m_bail(c3__fail);

      case c3__atom:
      {
        if ( c3__atom == u3h(ref) ) {
          return c3__void;
        }
        else if ( c3__cell == u3h(ref) ) {
          return u3k(sut);
        }
        else return _crop_sint(van, sut, ref, bix);
      }
      case c3__bull: u3x_cell(u3t(sut), &p_sut, &q_sut);
      {
        u3_noun foz = _crop_dext(van, q_sut, ref, bix);
        u3_noun ret = u3qf_bull(p_sut, foz);

        u3z(foz);
        return ret;
      }
      case c3__cell: u3x_cell(u3t(sut), &p_sut, &q_sut);
      {
        if ( c3__atom == u3h(ref) ) {
          return u3k(sut);
        }
        else if ( c3__cell == u3h(ref) ) {
          u3x_cell(u3t(ref), &p_ref, &q_ref);

          if ( c3y == u3qfu_nest
                              (van, p_ref, c3n, p_sut) )
          {
            u3_noun foz = _crop_dext(van, q_sut, q_ref, bix);
            u3_noun ret = u3qf_cell(p_sut, foz);

            u3z(foz);
            return ret;
          }
          else return u3k(sut);
        }
        else return _crop_sint(van, sut, ref, bix);
      }
      case c3__core:
      {
        if ( (c3__atom == u3h(ref)) || (c3__cell == u3h(ref)) ) {
          return u3k(sut);
        }
        else return _crop_sint(van, sut, ref, bix);
      }
      case c3__cube: u3x_cell(u3t(sut), &p_sut, &q_sut);
      {
        if ( (c3__cube == u3h(ref)) &&
             (c3y == u3r_sing(p_sut, u3h(u3t(ref)))) )
        {
          return c3__void;
        }
        else if ( (c3__atom == u3h(ref)) || (c3__cell == u3h(ref)) ) {
          u3_noun foz = _crop_dext(van, q_sut, ref, bix);
          u3_noun ret;

          if ( c3y == u3qfu_firm(van, foz, p_sut) ) {
            ret = u3qf_cube(p_sut, foz);
          }
          else ret = c3__void;

          u3z(foz);
          return ret;
        }
        else return _crop_sint(van, sut, ref, bix);
      }
      case c3__face: u3x_cell(u3t(sut), &p_sut, &q_sut);
      {
        u3_noun foz = _crop_dext(van, q_sut, ref, bix);
        u3_noun ret = u3qf_face(p_sut, foz);

        u3z(foz);
        return ret;
      }
      case c3__fork: u3x_cell(u3t(sut), &p_sut, &q_sut);
      {
        u3_noun dis = _crop_dext(van, p_sut, ref, bix);
        u3_noun dat = _crop_dext(van, q_sut, ref, bix);
        u3_noun ret = u3qf_fork(dis, dat);

        u3z(dis);
        u3z(dat);
        return ret;
      }
      case c3__hold: p_sut = u3t(sut);
      {
        u3_noun hud = u3nc(u3k(sut), u3k(ref));

        if ( c3y == u3qdi_has(bix, hud) ) {
#         if 0
            u3_noun dun = u3qfu_dunq(van, "type", sut);
            u3_noun niz = u3qfu_dunq(van, "over", ref);

            u3t_push(u3nc(c3__mean, dun));
            u3t_push(u3nc(c3__mean, niz));
#         endif

          return u3m_error("crop-loop");
        } else {
          u3_noun bux = u3qdi_put(bix, hud);
          u3_noun ret = _crop_repo(van, sut, ref, bux);

          u3z(hud);
          u3z(bux);
          return ret;
        }
      }
    }
  }