コード例 #1
0
  /* _cf_path_1: write at/inpath.
  */
  static c3_w
  _cf_path_1(c3_c*   buf_c,
             c3_w    pos_w,
             u2_noun hut)                                         //  retain
  {
    if ( u2_no == u2_cr_du(hut) ) {
      c3_w met_w = u2_cr_met(3, hut);

      if ( buf_c ) u2_cr_bytes(0, met_w, (c3_y*)(buf_c + pos_w), hut);
      return (pos_w + met_w);
    }
    else {
      c3_w met_w  = u2_cr_met(3, u2h(hut));
      c3_w end_w  = _cf_path_1(buf_c, pos_w, u2t(hut));
      u2_noun san = u2h(hut);

      if ( buf_c ) buf_c[end_w] = '/';
      end_w++;

      // little security thing - last ditch
      //
      if ( c3_s2('.', '.') == san ) {
        san = c3_s3('.','.','.');
      }
      if ( buf_c ) u2_cr_bytes(0, met_w, (c3_y*)(buf_c + end_w), san);
      end_w += met_w;

      return end_w;
    }
  }
コード例 #2
0
/* u2_ckd_by_get(): map get for key `b` in map `a` with u2_none.
*/
u2_weak
u2_ckd_by_get(u2_noun a, u2_noun b)
{
  u2_noun c = _coal_by_get(u2_Wire, a, b);

  u2_cz(a); u2_cz(b);
  if ( u2_no == u2_cr_du(c) ) {
    u2_cz(c);
    return u2_none;
  } else {
    u2_noun pro = u2_ct(u2t(c));

    u2_cz(c);
    return pro;
  }
}
コード例 #3
0
ファイル: loop.c プロジェクト: gunnarahlberg/urbit
/* u2_lo_punt(): dump tank list.
*/
void
u2_lo_punt(c3_l tab_l, u2_noun tac)
{
  u2_noun blu   = u2_term_get_blew(0);
  c3_l    col_l = u2h(blu);
  u2_noun cat   = tac;

  //  We are calling nock here, but hopefully need no protection.
  //
  while ( u2_yes == u2_cr_du(cat) ) {
    u2_noun wol = u2_dc("wash", u2nc(tab_l, col_l), u2k(u2h(cat)));

    _lo_wall(u2_Arv, wol);
    cat = u2t(cat);
  }
  u2z(tac);
  u2z(blu);
}