Example #1
0
/* functions
*/
  u3_noun
  _cqfu_heal(
                        u3_noun van,
                        u3_noun sut,
                        u3_noun qog,
                        u3_noun axe,
                        u3_noun ref)
  {
    return _heal_as(van, sut, qog, axe, ref);
  }
Example #2
0
/* functions
*/
  u2_noun                                                         //  transfer
  j2_mcx(Pt6, ut, heal)(u2_wire wir_r, 
                        u2_noun van,                              //  retain
                        u2_noun sut,                              //  retain
                        u2_noun qog,                              //  retain
                        u2_noun axe,                              //  retain
                        u2_noun ref)                              //  retain
  {
    return _heal_as(wir_r, van, sut, qog, axe, ref);
  }
Example #3
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;
    }
  }
Example #4
0
  static u2_noun
  _heal_to(u2_wire wir_r,
           u2_noun van,
           u2_noun sut,
           u2_noun gil,
           u2_noun qog,
           u2_noun ref,
           u2_atom now,
           u2_atom lat)
  {
    u2_noun p_sut, q_sut;

    if ( u2_no == u2_dust(sut) ) {
      goto repo;
    }
    else switch ( u2_h(sut) ) {
      default: goto repo;

      case c3__atom: return c3__void;
      case c3__cell: u2_bi_cell(wir_r, u2_t(sut), &p_sut, &q_sut);
      {
        u2_noun ter, ret;

        if ( _2 == now ) {
          ter = _heal_as(wir_r, van, p_sut, qog, lat, ref);
          ret = j2_mby(Pt6, cell)(wir_r, ter, q_sut);
        } else {
          ter = _heal_as(wir_r, van, q_sut, qog, lat, ref);
          ret = j2_mby(Pt6, cell)(wir_r, p_sut, ter);
        }
        u2_rz(wir_r, ter);
        return ret;
      }

      case c3__core: u2_bi_cell(wir_r, u2_t(sut), &p_sut, &q_sut);
      {
        if ( _3 != now ) {
          return u2_bl_error(wir_r, "heal-core");
        } else {
          u2_noun ter = _heal_as(wir_r, van, p_sut, qog, lat, ref);
          u2_noun ret = j2_mby(Pt6, core)(wir_r, ter, q_sut);

          u2_rz(wir_r, ter);
          return ret;
        }
      }

      case c3__fork: u2_bi_cell(wir_r, u2_t(sut), &p_sut, &q_sut);
      {
        u2_noun dis = _heal_to(wir_r, van, p_sut, gil, qog, ref, now, lat);
        u2_noun dat = _heal_to(wir_r, van, q_sut, gil, qog, ref, now, lat);
        u2_noun ret = j2_mby(Pt6, fork)(wir_r, dis, dat);

        u2_rl_lose(wir_r, dis);
        u2_rl_lose(wir_r, dat);
        return ret;
      }

      case c3__hold: {
        if ( (u2_yes == j2_mcc(Pt4, in, has)(wir_r, gil, sut)) ) {
          return c3__void;
        } 
        else {
          u2_noun zoc = j2_mcc(Pt4, in, put)(wir_r, gil, sut);
          u2_type rep = j2_mcy(Pt6, ut, repo)(wir_r, van, sut);
          u2_noun ret = _heal_to(wir_r, van, rep, zoc, qog, ref, now, lat);

          u2_rl_lose(wir_r, rep);
          u2_rl_lose(wir_r, zoc);

          return ret;
        }
      }
    }

    repo: {
      u2_noun rep = j2_mcy(Pt6, ut, repo)(wir_r, van, sut);
      u2_noun ret = _heal_to(wir_r, van, rep, gil, qog, ref, now, lat);

      u2_rz(wir_r, rep);
      return ret;
    }
  }