コード例 #1
0
ファイル: ut_swab.c プロジェクト: mnemnion/urbit
/* functions
*/
  u2_noun                                                         //  produce
  j2_mcx(Pt6, ut, swab)(u2_wire wir_r, 
                        u2_noun van,                              //  retain
                        u2_noun sut,                              //  retain
                        u2_noun men,                              //  retain
                        u2_noun har)                              //  retain
  {
    if ( u2_no == u2_dust(har) ) {
      return u2_nul;
    } else {
      u2_noun i_har = u2_h(har);
      u2_noun t_har = u2_t(har);
      u2_noun pi_har = u2_h(i_har);
      u2_noun qi_har = u2_t(i_har);
      u2_noun roz = j2_mcy(Pt6, ap, rake)(wir_r, pi_har);
      u2_noun peh = j2_mbc(Pt2, flop)(wir_r, roz);
      u2_noun nuk = _snub(wir_r, van, sut, peh, men, qi_har, u2_nul);
      u2_noun ret = u2_bc(wir_r, u2_bc(wir_r, peh, nuk),
                                 j2_mcx(Pt6, ut, swab)
                                    (wir_r, van, sut, men, t_har));

      u2_rz(wir_r, roz);
      return ret;
    }
  }
コード例 #2
0
ファイル: mat.c プロジェクト: mnemnion/urbit
/* functions
*/
  u2_noun                                                         //  produce
  j2_mby(Pt5, mat)(u2_wire wir_r, 
                   u2_atom a)                                     //  retain
  {
    if ( _0 == a ) {
      return u2_bc(wir_r, 1, 1);
    } else {
      u2_atom b = j2_mbc(Pt3, met)(wir_r, 0, a);
      u2_atom c = j2_mbc(Pt3, met)(wir_r, 0, b);
      u2_atom u, v, w, x, y, z;
      u2_atom p, q;

      u = j2_mbc(Pt1, dec)(wir_r, c);
      v = j2_mbc(Pt1, add)(wir_r, c, c);
      w = j2_mbc(Pt3, bex)(wir_r, c);
      x = j2_mbc(Pt3, end)(wir_r, _0, u, b);
      y = j2_mbc(Pt3, lsh)(wir_r, _0, u, a);
      z = j2_mbc(Pt3, mix)(wir_r, x, y);

      p = j2_mbc(Pt1, add)(wir_r, v, b);
      q = j2_mbc(Pt3, cat)(wir_r, _0, w, z);

      u2_rz(wir_r, u);
      u2_rz(wir_r, v);
      u2_rz(wir_r, w);
      u2_rz(wir_r, x);
      u2_rz(wir_r, y);
      u2_rz(wir_r, z);

      return u2_bc(wir_r, p, q);
    }
  }
コード例 #3
0
ファイル: ut_tack.c プロジェクト: Gruelty/urbit
/* internals
*/
  static u2_noun                                                  //  transfer
  _tack_in(u2_wire wir_r, 
           u2_noun van,                                           //  retain
           u2_noun sut,                                           //  retain
           u2_noun peh,                                           //  retain
           u2_noun mur,                                           //  retain
           u2_atom axe)                                           //  retain
  {
    if ( u2_no == u2_dust(peh) ) {
      return u2_bc(wir_r, u2_rx(wir_r, axe), u2_rx(wir_r, mur));
    } 
    else {
      u2_noun i_peh = u2_h(peh);
      u2_noun t_peh = u2_t(peh);

      if ( (u2_yes == u2_stud(i_peh)) || (u2_no == u2_h(i_peh)) ) 
      {
        u2_noun pi_peh = (u2_yes == u2_stud(i_peh)) ? 0 : u2_h(u2_t(i_peh));
        u2_noun qi_peh = (u2_yes == u2_stud(i_peh)) ? i_peh : u2_t(u2_t(i_peh));
        u2_noun pok   = j2_mcy(Pt6, ut, fink)
                              (wir_r, van, sut, pi_peh, c3__rite, qi_peh);
        u2_noun wuf   = j2_mby(Pt6, flay)(wir_r, pok);
        u2_noun p_wuf = u2_h(wuf);
        u2_noun q_wuf = u2_t(wuf);
        u2_noun nax   = j2_mbc(Pt3, peg)(wir_r, axe, p_wuf); 
        u2_noun gav   = _tack_in(wir_r, van, q_wuf, t_peh, mur, nax);
        u2_noun p_gav = u2_h(gav);
        u2_noun q_gav = u2_t(gav);
        u2_noun qog   = u2_bc(wir_r, u2_nul, u2_rx(wir_r, qi_peh));
        u2_noun ret   = u2_bc
          (wir_r, u2_rx(wir_r, p_gav),
                  j2_mcy(Pt6, ut, heal)(wir_r, van, sut, qog, p_wuf, q_gav));

        u2_rz(wir_r, qog);
        u2_rz(wir_r, gav);
        u2_rz(wir_r, nax);
        u2_rz(wir_r, wuf);
        u2_rz(wir_r, pok);

        return ret;
      }
      else {
        u2_noun bax   = u2_t(i_peh);
        u2_noun vas   = j2_mcy(Pt6, ut, peek)(wir_r, van, sut, c3__rite, bax);
        u2_noun nax   = j2_mbc(Pt3, peg)(wir_r, axe, bax); 
        u2_noun gav   = _tack_in(wir_r, van, vas, t_peh, mur, nax);
        u2_noun p_gav = u2_h(gav);
        u2_noun q_gav = u2_t(gav);
        u2_noun ret   = u2_bc
          (wir_r, u2_rx(wir_r, p_gav),
                  j2_mcy(Pt6, ut, heal)(wir_r, van, sut, u2_nul, bax, q_gav));
        
        u2_rz(wir_r, gav);
        u2_rz(wir_r, nax);
        u2_rz(wir_r, vas);

        return ret;
      }
    }
  }
コード例 #4
0
ファイル: bail.c プロジェクト: MacTop/urbit
  static u2_noun
  _molt_apply(u2_wire            wir_r,
              u2_noun            som,
              c3_w               len_w,
              struct _molt_pair* pms_m)
  {
    if ( len_w == 0 ) {
      return u2_rl_gain(wir_r, som);
    }
    else if ( (len_w == 1) && (1 == pms_m[0].axe_w) ) {
      return u2_rl_gain(wir_r, pms_m[0].som);
    }
    else {
      c3_w cut_w = _molt_cut(len_w, pms_m);

      if ( u2_no == u2_dust(som) ) {
        return u2_bc
          (wir_r,
           _molt_apply(wir_r, u2_nul, cut_w, pms_m),
           _molt_apply(wir_r, u2_nul, (len_w - cut_w), (pms_m + cut_w)));
      } else {
        return u2_bc
          (wir_r,
           _molt_apply(wir_r, u2_h(som), cut_w, pms_m),
           _molt_apply(wir_r, u2_t(som), (len_w - cut_w), (pms_m + cut_w)));
      }
    }
  }
コード例 #5
0
ファイル: ut_bust.c プロジェクト: Gruelty/urbit
/* logic
*/
  u2_noun                                                         //  transfer
  j2_mcx(Pt6, ut, bust)(u2_wire wir_r, 
                        u2_noun van,                              //  retain
                        u2_noun sut,                              //  retain
                        u2_noun dib)                              //  retain
  {
    u2_noun yam = j2_mcy(Pt6, ut, burn)(wir_r, van, sut);
    u2_noun yib = u2_bc
      (wir_r,
       u2_bc(wir_r, u2_rx(wir_r, u2_bi_h(wir_r, u2_bi_h(wir_r, yam))),
                    u2_rx(wir_r, dib)),
       u2_rx(wir_r, u2_bi_t(wir_r, yam)));
    u2_noun woo = u2_bc(wir_r, c3__cnbc, u2_blip);
    u2_noun wox = j2_mcy(Pt6, ut, mint)(wir_r, van, sut, c3__noun, woo);
    u2_noun ret = u2_nk_nock(wir_r, yib, u2_t(wox));

    if ( u2_none == ret ) {
      return u2_bl_error(wir_r, "bust-nock");
    }
    u2_rz(wir_r, wox);
    u2_rz(wir_r, woo);
    u2_rz(wir_r, yam);

    return ret;
  }
コード例 #6
0
ファイル: zuse.c プロジェクト: aaronlifton/urbit
/* _zuse_load_cold(): load engine from cold source.
*/
static void
_zuse_load_cold(struct zuse_state* fod_f,
                const c3_c*        src_c)
{
  u2_wire wir_r = fod_f->wir_r;
  u2_noun src   = u2_ux_read(wir_r, src_c, "watt");

  if ( u2_none == src ) {
    u2_bl_bail(wir_r);
  }
  else {
    u2_noun gen, mil, pyt, kol, pit;

    gen = u2_fj_watt(wir_r, src);
    gen = u2_ba_sole(wir_r, gen);
    mil = u2_fj_plow_mill(wir_r, u2_bc(wir_r, c3__cube, _0), gen);
    pyt = u2_bi_h(wir_r, mil);
    kol = u2_bi_t(wir_r, mil);
    {
      // XX: bad dag interaction in old plow code
      //
      u2_rl_gain(wir_r, kol);
    }
    kol = u2_ba_sole(wir_r, kol);
    pit = u2_bn_nock(wir_r, _0, kol);

    fod_f->kol = kol;
    fod_f->pyt = pyt;
    fod_f->pit = pit;
    fod_f->bot = u2_bc(wir_r, u2_rx(wir_r, fod_f->pyt), 
                              u2_rx(wir_r, fod_f->pit));

    _zuse_save_rock(fod_f, src_c);
  }
}
コード例 #7
0
  /* _lily_hike_belt_r(): factor (pac) right.
  */
  static u2_list                                                  //  transfer
  _lily_hike_belt_r(u2_ray  wir_r,
                    u2_list pac)                                  //  retain
  {
    if ( (u2_nul == pac) ) {
      return u2_nul;
    }
    else {
      u2_axis axis       = u2_h(u2_h(pac));
      u2_tool tool       = u2_t(u2_h(pac));
      u2_list belt_r = _lily_hike_belt_r(wir_r, u2_t(pac));

      {
        if ( (_1 != axis) &&
             (u2_yes == u2_sing(_3, j2_mbc(Pt3, cap)(wir_r, axis))) )
        {
          u2_axis axis_tap = j2_mbc(Pt3, mas)(wir_r, axis);

          return u2_bc(wir_r,
                       u2_bc(wir_r, u2_rx(wir_r, axis_tap),
                                    u2_rx(wir_r, tool)),
                       belt_r);
        }
        else return belt_r;
      }
    }
  }
コード例 #8
0
  /* _lily_hike_belt_l(): factor (pac) left.
  */
  static u2_list
  _lily_hike_belt_l(u2_ray  wir_r,
                    u2_list pac)
  {
    if ( (u2_nul == pac) ) {
      return u2_nul;
    }
    else {
      u2_axis axis       = u2_h(u2_h(pac));
      u2_tool tool       = u2_t(u2_h(pac));
      u2_list belt_l = _lily_hike_belt_l(wir_r, u2_t(pac));

      {
        if ( (_1 != axis) &&
             (u2_yes == u2_sing(_2, j2_mbc(Pt3, cap)(wir_r, axis))) )
        {
          u2_axis axis_tap = j2_mbc(Pt3, mas)(wir_r, axis);

          return u2_bc(wir_r,
                       u2_bc(wir_r,
                             u2_rx(wir_r, axis_tap),
                             u2_rx(wir_r, tool)),
                       belt_l);
        }
        else return belt_l;
      }
    }
  }
コード例 #9
0
ファイル: parse.c プロジェクト: mnemnion/urbit
/* glue
*/
  u2_noun                                                         //  produce
  j2_mcx(Pt5, glue, fun)(u2_wire wir_r,
                         u2_noun bus,                             //  retain
                         u2_noun vex,                             //  retain
                         u2_noun sab)                             //  retain
  {
    u2_noun p_vex, q_vex;

    u2_bi_cell(wir_r, vex, &p_vex, &q_vex);
    if ( u2_no == u2_dust(q_vex) ) {
      return u2_rx(wir_r, vex);
    } 
    else {
      u2_noun uq_vex = u2_t(q_vex);
      u2_noun puq_vex, quq_vex;
      u2_noun yit, yur;
      u2_noun p_yit, q_yit;
      u2_noun ret;

      u2_bi_cell(wir_r, uq_vex, &puq_vex, &quq_vex);
      yit = u2_bl_good(wir_r, u2_nk_mong(wir_r, bus, u2_rx(wir_r, quq_vex)));
      
      u2_bi_cell(wir_r, yit, &p_yit, &q_yit);
      yur = _last(wir_r, p_vex, p_yit);

      if ( u2_no == u2_dust(q_yit) ) {
        ret = u2_bc(wir_r, yur, u2_nul);
      } 
      else {
        u2_noun uq_yit = u2_t(q_yit);
        u2_noun puq_yit, quq_yit;
        u2_noun wam, p_wam, q_wam, goy;
         
        u2_bi_cell(wir_r, uq_yit, &puq_yit, &quq_yit);
        wam = u2_bl_good(wir_r, u2_nk_mong(wir_r, sab, u2_rx(wir_r, quq_yit)));

        u2_bi_cell(wir_r, wam, &p_wam, &q_wam);
        goy = _last(wir_r, yur, p_wam);
        u2_rz(wir_r, yur);

        if ( u2_no == u2_dust(q_wam) ) {
          ret = u2_bc(wir_r, goy, u2_nul);
        } else {
          u2_noun uq_wam = u2_t(q_wam);
          u2_noun puq_wam, quq_wam;

          u2_bi_cell(wir_r, uq_wam, &puq_wam, &quq_wam);
          ret = u2_bq(wir_r, goy,
                             u2_nul,
                             u2_bc(wir_r, u2_rx(wir_r, puq_vex),
                                          u2_rx(wir_r, puq_wam)),
                             u2_rx(wir_r, quq_wam));
        }
        u2_rz(wir_r, wam);
      }
      u2_rz(wir_r, yit);
      return ret;
    }
  }
コード例 #10
0
ファイル: coal.c プロジェクト: dhaffey/urbit-archaeology
/* u2_cke_cue(): expand saved pill.
*/
  static u2_noun                                                  //  produce
  _cue_in(u2_wire wir_r,
          u2_atom a,                                              //  retain
          u2_atom b,                                              //  retain
          u2_ray  t_r)                                            //  retain
  {
    u2_noun p, q;

    if ( _0 == j2_mbc(Pt3, cut)(wir_r, 0, b, 1, a) ) {
      u2_noun x = j2_mbc(Pt1, inc)(wir_r, b);
      u2_noun c = j2_mby(Pt5, rub)(wir_r, x, a);

      p = j2_mbc(Pt1, inc)(wir_r, u2_h(c));
      q = u2_rx(wir_r, u2_t(c));
      q = u2_cs_save(wir_r, t_r, 0, b, q);

      u2_rz(wir_r, c);
      u2_rz(wir_r, x);
    }
    else {
      u2_noun c = j2_mbc(Pt1, add)(wir_r, _2, b);
      u2_noun l = j2_mbc(Pt1, inc)(wir_r, b);

      if ( _0 == j2_mbc(Pt3, cut)(wir_r, 0, l, 1, a) ) {
        u2_noun u, v, w;
        u2_noun x, y;

        u = _cue_in(wir_r, a, c, t_r);
        x = j2_mbc(Pt1, add)(wir_r, u2_h(u), c);
        v = _cue_in(wir_r, a, x, t_r);

        w = u2_bc(wir_r, u2_rx(wir_r, u2_t(u)),
                         u2_rx(wir_r, u2_t(v)));

        y = j2_mbc(Pt1, add)(wir_r, u2_h(u), u2_h(v));

        p = j2_mbc(Pt1, add)(wir_r, _2, y);
        q = u2_cs_save(wir_r, t_r, 0, b, w);

        u2_rz(wir_r, u); u2_rz(wir_r, v); u2_rz(wir_r, x); u2_rz(wir_r, y);
      }
      else {
        u2_noun d = j2_mby(Pt5, rub)(wir_r, c, a);
        u2_weak x = u2_cs_find(wir_r, t_r, 0, u2_t(d));

        p = j2_mbc(Pt1, add)(wir_r, _2, u2_h(d));

        if ( u2_none == x ) {
          return u2_bl_bail(wir_r, c3__fail);
        }
        q = u2_rx(wir_r, x);

        u2_rz(wir_r, d);
      }
      u2_rz(wir_r, l);
      u2_rz(wir_r, c);
    }
    return u2_bc(wir_r, p, q);
  }
コード例 #11
0
/* functions
*/
  u2_noun                                                         //  produce
  j2_mby(Pt5, rub)(u2_wire wir_r,
                   u2_atom a,                                     //  retain
                   u2_atom b)                                     //  retain
  {
    u2_atom c, d, e;
    u2_atom w, x, y, z;
    u2_atom p, q;

    u2_atom m = j2_mbc(Pt1, add)(wir_r, a, u2_met(0, b));

    //  Compute c and d.
    {
      x = u2_rx(wir_r, a);

      while ( _0 == j2_mbc(Pt3, cut)(wir_r, _0, x, _1, b) ) {
        u2_atom y = j2_mbc(Pt1, inc)(wir_r, x);

        //  Sanity check: crash if decoding more bits than available
        if ( u2_yes == j2_mbc(Pt1, gth)(wir_r, x, m)) {
          //  fprintf(stderr, "[%%rub-hard %d %d %d]\r\n", a, x, m);
          return u2_bl_bail(wir_r, c3__exit);
        }

        u2_rz(wir_r, x);
        x = y;
      }
      if ( u2_yes == u2_sing(x, a) ) {
        u2_rz(wir_r, x);
        return u2_bc(wir_r, _1, _0);
      }
      c = j2_mbc(Pt1, sub)(wir_r, x, a);
      d = j2_mbc(Pt1, inc)(wir_r, x);

      u2_rz(wir_r, x);
    }

    //  Compute e, p, q.
    {
      x = j2_mbc(Pt1, dec)(wir_r, c);
      y = j2_mbc(Pt3, bex)(wir_r, x);
      z = j2_mbc(Pt3, cut)(wir_r, _0, d, x, b);

      e = j2_mbc(Pt1, add)(wir_r, y, z);
      u2_rz(wir_r, y); u2_rz(wir_r, z);

      w = j2_mbc(Pt1, add)(wir_r, c, c);
      y = j2_mbc(Pt1, add)(wir_r, w, e);
      z = j2_mbc(Pt1, add)(wir_r, d, x);

      p = j2_mbc(Pt1, add)(wir_r, w, e);
      q = j2_mbc(Pt3, cut)(wir_r, _0, z, e, b);

      u2_rz(wir_r, w); u2_rz(wir_r, x); u2_rz(wir_r, y); u2_rz(wir_r, z);

      return u2_bc(wir_r, p, q);
    }
  }
コード例 #12
0
ファイル: parse.c プロジェクト: Gruelty/urbit
/* bend
*/
  u2_noun                                                         //  produce
  j2_mcx(Pt5, bend, fun)(u2_wire wir_r,
                         u2_noun raq,                             //  retain
                         u2_noun vex,                             //  retain
                         u2_noun sab)                             //  retain
  {
    u2_noun p_vex, q_vex;

    u2_bi_cell(wir_r, vex, &p_vex, &q_vex);
    if ( u2_no == u2_dust(q_vex) ) {
      return u2_rx(wir_r, vex);
    } else {
      u2_noun uq_vex = u2_t(q_vex);
      u2_noun puq_vex, quq_vex;
      u2_noun yit, yur;
      u2_noun p_yit, q_yit;
      u2_noun ret;

      u2_bi_cell(wir_r, uq_vex, &puq_vex, &quq_vex);
      yit = u2_bl_good(wir_r, u2_nk_mong(wir_r, sab, u2_rx(wir_r, quq_vex)));
      
      u2_bi_cell(wir_r, yit, &p_yit, &q_yit);
      yur = _last(wir_r, p_vex, p_yit);

      if ( u2_no == u2_dust(q_yit) ) {
        ret = u2_bc(wir_r, yur, u2_rx(wir_r, q_vex));
      } 
      else {
        u2_noun uq_yit = u2_t(q_yit);
        u2_noun puq_yit, quq_yit;
        u2_noun vux;
         
        u2_bi_cell(wir_r, uq_yit, &puq_yit, &quq_yit);

        vux = u2_bl_good
                    (wir_r, 
                     u2_nk_mong
                       (wir_r, raq, 
                               u2_bc(wir_r, u2_rx(wir_r, puq_vex),
                                            u2_rx(wir_r, puq_yit))));
        if ( u2_nul == vux ) {
          ret = u2_bc(wir_r, yur, u2_rx(wir_r, q_vex));
        }
        else {
          ret = u2_bq(wir_r, yur,
                             u2_nul,
                             u2k(u2t(vux)),
                             u2_rx(wir_r, quq_yit));
          u2z(vux);
        }
      }
      u2_rz(wir_r, yit);
      return ret;
    }
  }
コード例 #13
0
ファイル: ut_mint.c プロジェクト: mnemnion/urbit
  static u2_noun                                                  //  produce
  _mint_bake(u2_wire wir_r, 
             u2_noun van,                                         //  retain
             u2_noun sut,                                         //  retain
             u2_noun dab)                                         //  retain
  {
    if ( (u2_nul == dab) ) {
      return _0;
    }
    else {
      u2_noun n_dab, l_dab, r_dab; 
     
      u2_as_trel(dab, &n_dab, &l_dab, &r_dab);
      if ( u2_no == u2_dust(n_dab) ) {
        return u2_bl_bail(wir_r, c3__fail);
      } 
      else {
        u2_noun qn_dab = u2_t(n_dab);
        u2_noun vad;

        switch ( u2_h(qn_dab) ) {
          default: return u2_bl_bail(wir_r, c3__exit);
          case c3__ash: {
            vad = _mint_brew(wir_r, van, sut, u2_yes, u2_t(qn_dab));
            break;
          }
          case c3__elm: {
            vad = _mint_brew(wir_r, van, sut, u2_no, u2_t(qn_dab));
            break;
          }
        }

        if ( (u2_nul == l_dab) && (u2_nul == r_dab) ) {
          return vad;
        }
        else if ( (u2_nul == l_dab) ) {
          return u2_bc
            (wir_r, vad, _mint_bake(wir_r, van, sut, r_dab));
        }
        else if ( (u2_nul == r_dab) ) {
          return u2_bc
            (wir_r, vad, _mint_bake(wir_r, van, sut, l_dab));
        }
        else {
          return u2_bt
            (wir_r, vad,
                    _mint_bake(wir_r, van, sut, l_dab),
                    _mint_bake(wir_r, van, sut, r_dab));
        }
      }
    }
  }
コード例 #14
0
ファイル: ut.c プロジェクト: the0ther/urbit
 //  shep: show with caption and style
 //
 u2_noun                                                         //  produce
 j2_mcy(Pt6, ut, shep)(u2_wire     wir_r,
                       u2_noun     van,                          //  retain
                       const c3_c* paz_c,                        //  retain
                       u2_noun     sty,                          //  retain
                       u2_noun     mol)                          //  submit
 {
   return j2_mcy(Pt6, ut, shew)
     (wir_r, van,
             u2_bc
               (wir_r, u2_bc(wir_r, 'c', u2_bn_string(wir_r, paz_c)),
                       u2_bc(wir_r, u2_rx(wir_r, sty), mol)));
 }
コード例 #15
0
ファイル: ut_seek.c プロジェクト: ngvrnd/urbit
 static u2_noun                                                  //  transfer
 _seek_silk_fum(u2_noun wir_r,
                u2_noun hey,                                     //  retain
                u2_noun qq_tor)
 {
   if ( u2_nul == qq_tor ) {
     return u2_nul;
   }
   c3_assert(u2_nul != hey);
   return u2_bc
     (wir_r, u2_bc(wir_r, u2_rx(wir_r, u2_h(u2_h(qq_tor))),
                          u2_rx(wir_r, u2_t(u2_h(hey)))),
             _seek_silk_fum(wir_r, u2_t(hey), u2_t(qq_tor)));
 }
コード例 #16
0
ファイル: parse.c プロジェクト: mnemnion/urbit
/* pfix
*/
  u2_noun                                                         //  produce
  j2_mbx(Pt5, pfix)(u2_wire wir_r, 
                    u2_noun vex,                                  //  retain
                    u2_noun sab)                                  //  retain
  {
    u2_noun p_vex, q_vex;
    
    u2_bi_cell(wir_r, vex, &p_vex, &q_vex);
    if ( u2_no == u2_dust(q_vex) ) {
      return u2_rx(wir_r, vex);
    } 
    else {
      u2_noun uq_vex = u2_t(q_vex);
      u2_noun puq_vex, quq_vex;
      u2_noun yit, p_yit, q_yit;
      u2_noun ret;

      u2_bi_cell(wir_r, uq_vex, &puq_vex, &quq_vex);
      yit = u2_bl_good(wir_r, u2_nk_mong(wir_r, sab, u2_rx(wir_r, quq_vex)));

      u2_bi_cell(wir_r, yit, &p_yit, &q_yit);
      ret = u2_bc
        (wir_r,
         _last(wir_r, p_vex, p_yit),
         u2_rx(wir_r, q_yit));

      u2_rz(wir_r, yit);
      return ret;
    }
  }
コード例 #17
0
ファイル: ut_seek.c プロジェクト: ngvrnd/urbit
  static u2_noun                                                  //  transfer
  _seek_silk_yew(u2_wire wir_r, 
                 u2_noun van,                                     //  retain
                 u2_noun syx,                                     //  retain
                 u2_noun qq_tor)                                  //  retain
  {
    if ( u2_nul == qq_tor ) {
      return u2_nul;
    }
    else {
      u2_noun iqq_tor  = u2_h(qq_tor);
      u2_noun qiqq_tor = u2_t(iqq_tor);
      u2_noun yon      = _seek_silk_yew(wir_r, van, syx, u2_t(qq_tor));

      if ( c3__yew != u2_h(qiqq_tor) ) {
        return yon;
      } else {
        u2_noun nuy = j2_mby(Pt6, look)(wir_r, syx, u2_t(qiqq_tor));

        if ( u2_nul == nuy ) {
          return u2_bl_error(wir_r, "silk");
        }
        else {
          yon = u2_bc(wir_r, u2_rx(wir_r, u2_t(nuy)), yon);
          u2_rz(wir_r, nuy);
          return yon;
        }
      }
    } 
  }
コード例 #18
0
ファイル: parse.c プロジェクト: mnemnion/urbit
  static u2_noun                                                  //  produce
  _next(u2_wire wir_r,
        u2_noun tub)                                              //  retain
  {
    u2_noun p_tub, q_tub;
    u2_noun zac;

    u2_bi_cell(wir_r, tub, &p_tub, &q_tub);
    if ( u2_no == u2_dust(q_tub) ) {
      return _fail(wir_r, tub);
    } 
    else {
      u2_noun iq_tub = u2_h(q_tub);
      u2_noun tq_tub = u2_t(q_tub);

      zac = _slip(wir_r, iq_tub, p_tub);

      return u2_bc
        (wir_r, zac,
                u2_bq(wir_r, u2_nul,
                             u2_rx(wir_r, iq_tub),
                             u2_rx(wir_r, zac),
                             u2_rx(wir_r, tq_tub)));
    }
  }
コード例 #19
0
ファイル: parse.c プロジェクト: mnemnion/urbit
/* stag
*/
  u2_noun                                                         //  produce
  j2_mcx(Pt5, stag, fun)(u2_wire wir_r,
                         u2_noun gob,                             //  retain
                         u2_noun sef,                             //  retain
                         u2_noun tub)                             //  retain
  {
    u2_noun vex = u2_bl_good(wir_r, u2_nk_mong(wir_r, sef, u2_rx(wir_r, tub)));
    u2_noun p_vex, q_vex;

    u2_bi_cell(wir_r, vex, &p_vex, &q_vex);

    if ( u2_no == u2_dust(q_vex) ) {
      return vex;
    }
    else {
      u2_noun uq_vex = u2_t(q_vex);
      u2_noun puq_vex, quq_vex;
      u2_noun wag;
      u2_noun ret;

      u2_bi_cell(wir_r, uq_vex, &puq_vex, &quq_vex);
      wag = u2_bc(wir_r, u2_rx(wir_r, gob), u2_rx(wir_r, puq_vex));
      ret = u2_bq(wir_r, u2_rx(wir_r, p_vex),
                         u2_nul,
                         wag,
                         u2_rx(wir_r, quq_vex));

      u2_rz(wir_r, vex);
      return ret;
    }
  }
コード例 #20
0
ファイル: parse.c プロジェクト: mnemnion/urbit
/* pose
*/
  u2_noun                                                         //  produce
  j2_mbx(Pt5, pose)(u2_wire wir_r, 
                    u2_noun vex,                                  //  retain
                    u2_noun sab)                                  //  retain
  {
    u2_noun p_vex, q_vex;
    
    u2_bi_cell(wir_r, vex, &p_vex, &q_vex);
    if ( u2_yes == u2_dust(q_vex) ) {
      return u2_rx(wir_r, vex);
    } else {
      u2_noun roq = u2_bl_good(wir_r, u2_nk_kick(wir_r, sab));
      u2_noun p_roq, q_roq;
      u2_noun ret;

      u2_bi_cell(wir_r, roq, &p_roq, &q_roq);
      ret = u2_bc
        (wir_r,
         _last(wir_r, p_vex, p_roq),
         u2_rx(wir_r, q_roq));

      u2_rz(wir_r, roq);
      return ret;
    }
  }
コード例 #21
0
ファイル: ut_seek.c プロジェクト: ngvrnd/urbit
/* logic
*/
  static u2_noun                                                  //  produce
  _seek_flat(u2_wire wir_r,
             u2_noun wob)                                         //  retain
  {
    if ( u2_nul == wob ) {
      return u2_nul;
    } else {
      u2_noun i_wob = u2_h(wob);
      u2_noun t_wob = u2_t(wob);

      return u2_bc
        (wir_r, u2_bc(wir_r, u2_rx(wir_r, u2_h(i_wob)),
                             u2_bt(wir_r, c3__ash, u2_nul, _1)),
                _seek_flat(wir_r, t_wob));
    }
  }
コード例 #22
0
ファイル: ut_mull.c プロジェクト: mnemnion/urbit
  static u2_noun                                                  //  produce
  _mull_nice(u2_wire wir_r,
             u2_noun van,                                         //  retain
             u2_noun gol,                                         //  retain
             u2_noun typ)                                         //  submit
  {
    if ( u2_no == j2_mcy(Pt6, ut, nest)(wir_r, van, gol, u2_yes, typ) ) {
      u2_noun dun = j2_mcy(Pt6, ut, dunq)(wir_r, van, "need", gol);
      u2_noun niz = j2_mcy(Pt6, ut, dunq)(wir_r, van, "have", typ);

      u2_bl_push(wir_r, u2_bc(wir_r, c3__mean, dun));
      u2_bl_push(wir_r, u2_bc(wir_r, c3__mean, niz));

      return u2_bl_error(wir_r, "mull-nice");
    }
    else return typ;
  }
コード例 #23
0
ファイル: bail.c プロジェクト: MacTop/urbit
/* u2_bl_error(): simple string error.
*/
u2_noun
u2_bl_error(u2_wire     wir_r,
            const c3_c* err_c)                                    //  retain
{
  u2_bl_push(wir_r, u2_bc(wir_r, c3__lose, u2_bn_string(wir_r, err_c)));

  return u2_bl_bail(wir_r, c3__exit);
}
コード例 #24
0
ファイル: hill.c プロジェクト: aaronlifton/urbit
/* _hill_wake(): boot pit, from `[type form]` to `[type noun]`.
*/
static u2_noun                                                    //  produce
_hill_wake(u2_wire wir_r,
           u2_noun gam)                                           //  retain
{
  return u2_bc
    (wir_r, u2_rx(wir_r, u2_h(gam)),
            _hill_nock(wir_r, _0, u2_t(gam)));
}
コード例 #25
0
ファイル: ut_play.c プロジェクト: Gruelty/urbit
  static u2_noun 
  _play_grow(u2_wire wir_r,
             u2_noun van,
             u2_noun sut,
             u2_atom mel,
             u2_noun ruf,
             u2_noun dab)
  {
    u2_noun dan = _play_in(wir_r, van, sut, ruf);

    return _play_core
        (wir_r, dan,
                u2_bt(wir_r, u2_rx(wir_r, mel),
                             u2_rx(wir_r, dan), 
                             u2_bc(wir_r, u2_bc(wir_r, u2_nul, u2_nul),
                                          u2_rx(wir_r, dab))));
  }
コード例 #26
0
ファイル: ut_mull.c プロジェクト: mnemnion/urbit
 static u2_noun                                                  //  produce
 _mull_both(u2_wire wir_r,
            u2_noun van,                                         //  retain
            u2_noun gol,                                         //  retain
            u2_noun typ)                                         //  submit
 {
   return u2_bc(wir_r, _mull_nice(wir_r, van, gol, u2_rx(wir_r, typ)), 
                       typ);
 }
コード例 #27
0
ファイル: hill.c プロジェクト: aaronlifton/urbit
/* _hill_fill_1(): fill one argument in shoe; type assumed
*/
static u2_noun                                                    //  produce
_hill_fill_1(u2_wire wir_r,
             u2_noun sho,                                         //  retain
             u2_noun a)                                           //  retain
{
  return u2_bc
    (wir_r, u2_rx(wir_r, u2_h(sho)),
            u2_bn_molt(wir_r, u2_t(sho), u2_cv_sam, a, 0));  
}
コード例 #28
0
ファイル: parse.c プロジェクト: mnemnion/urbit
  static u2_noun                                                  //  produce
  _fail(u2_wire wir_r,
        u2_noun tub)                                              //  retain
  {
    u2_noun p_tub, q_tub;

    u2_bi_cell(wir_r, tub, &p_tub, &q_tub);
    return u2_bc(wir_r, u2_rx(wir_r, p_tub), u2_nul);
  }
コード例 #29
0
ファイル: parse.c プロジェクト: mnemnion/urbit
  static u2_noun                                                  //  produce
  _slip(u2_wire wir_r,
        u2_noun weq,                                              //  retain
        u2_noun naz)                                              //  retain
  {
    u2_noun p_naz, q_naz;

    u2_bi_cell(wir_r, naz, &p_naz, &q_naz);
    if ( 10 == weq ) {
      return u2_bc(wir_r, u2_bl_good(wir_r, 
                                     u2_rl_vint(wir_r, u2_rx(wir_r, p_naz))),
                          1);
    } else {
      return u2_bc(wir_r, u2_rx(wir_r, p_naz),
                          u2_bl_good(wir_r,
                                     u2_rl_vint(wir_r, u2_rx(wir_r, q_naz))));
    }
  }
コード例 #30
0
ファイル: hill.c プロジェクト: aaronlifton/urbit
/* _hill_z_mint_gen(): mint `gen` to `[type form]` with PitZ jets.
*/
static u2_noun                                                    //  produce
_hill_z_mint_gen(u2_wire wir_r,
                 u2_noun sut,                                     //  retain
                 u2_noun gol,                                     //  retain
                 u2_noun gen)                                     //  retain
{
  u2_noun gam;
  u2_noun van = u2_bc
    (wir_r, u2_bc(wir_r, 
                  c3__blur,
                  u2_bc(wir_r, u2_bq(wir_r, _0, _0, _0, _0),  // bq for 268 on
                               u2_bc(wir_r, _0, 42))),
            87);

  gam = j2_mcy(PitZ, ut, mint)(wir_r, van, sut, gol, gen);
  u2_rz(wir_r, van);

  return gam;
}