pike.git / src / builtin.cmod

version» Context lines:

pike.git/src/builtin.cmod:6563:    gc_recurse_list_node_tree_forward(THIS->cur->next, THIS->cur->prev);    gc_recurse_list_node_tree_backward(THIS->cur->next, THIS->cur->prev);    }       PIKEFUN int(0..1) `!()    flags ID_PROTECTED;    {    RETURN (!THIS->cur->next || !THIS->cur->prev);    }    -  PIKEFUN int(0..) index() +  PIKEFUN int(0..) _iterator_index() +  flags ID_PROTECTED    {    pop_n_elems(args);    if (THIS->cur->next && THIS->cur->prev) {    push_int(THIS->ind);    } else {    push_undefined();    }    }    -  +  PIKEFUN int(0..) index() /* Compat. */ +  { +  pop_n_elems(args); +  if (THIS->cur->next && THIS->cur->prev) { +  push_int(THIS->ind); +  } else { +  push_undefined(); +  } +  } +  +  /*! @decl protected mixed _iterator_value() +  *! +  *! @returns +  *! Returns the value at the current position. +  */ +  PIKEFUN mixed _iterator_value() +  flags ID_PROTECTED; +  { +  pop_n_elems(args); +  if (THIS->cur->next && THIS->cur->prev) { +  push_svalue(&THIS->cur->val); +  } else { +  push_undefined(); +  } +  } +     /*! @decl mixed value()    *!    *! @returns    *! Returns the value at the current position.    */ -  PIKEFUN mixed value() +  PIKEFUN mixed value() /* Compat. */    {    pop_n_elems(args);    if (THIS->cur->next && THIS->cur->prev) {    push_svalue(&THIS->cur->val);    } else {    push_undefined();    }    }       /*! @decl int(0..1) first()
pike.git/src/builtin.cmod:6621:    add_ref(THIS->cur = parent->head);    THIS->ind = 0;    pop_n_elems(args);    if (THIS->cur->next) {    push_int(1);    } else {    push_undefined();    }    }    +  /*! @decl protected int(0..1) _iterator_next() +  *! +  *! Advance to the next element in the list. +  *! +  *! @returns +  *! Returns @expr{1@} on success, and @expr{0@} (zero) +  *! at the end of the list. +  *! +  *! @seealso +  *! @[prev()] +  */ +  PIKEFUN int(0..1) _iterator_next() +  flags ID_PROTECTED; +  { +  struct pike_list_node *next; +  if ((next = THIS->cur->next)) { +  free_list_node(THIS->cur); +  add_ref(THIS->cur = next); +  THIS->ind++; +  if (next->next) +  RETURN 1; +  } +  RETURN 0; +  } +     /*! @decl int(0..1) next()    *!    *! Advance to the next element in the list.    *!    *! @returns    *! Returns @expr{1@} on success, and @expr{0@} (zero)    *! at the end of the list.    *!    *! @seealso    *! @[prev()]    */ -  PIKEFUN int(0..1) next() +  PIKEFUN int(0..1) next() /* Compat. */    {    struct pike_list_node *next;    if ((next = THIS->cur->next)) {    free_list_node(THIS->cur);    add_ref(THIS->cur = next);    THIS->ind++;    if (next->next)    RETURN 1;    }    RETURN 0;