Skip to content
Snippets Groups Projects
Select Git revision
  • ab727af49fd068cd97c3bf5ce4f6e55f23f9b34f
  • master default protected
  • 8.0
  • 9.0
  • 7.8
  • 7.6
  • 7.4
  • 7.2
  • 7.0
  • 0.6
  • rosuav/latex-markdown-renderer
  • rxnpatch/rxnpatch
  • marcus/gobject-introspection
  • rxnpatch/8.0
  • rosuav/pre-listening-ports
  • nt-tools
  • rosuav/async-annotations
  • rosuav/pgsql-ssl
  • rxnpatch/rxnpatch-broken/2023-10-06T094250
  • grubba/fdlib
  • grubba/wip/sakura/8.0
  • v8.0.2004
  • v8.0.2002
  • v8.0.2000
  • v8.0.1998
  • v8.0.1996
  • v8.0.1994
  • v8.0.1992
  • v8.0.1990
  • v8.0.1988
  • v8.0.1986
  • rxnpatch/clusters/8.0/2025-04-29T124414
  • rxnpatch/2025-04-29T124414
  • v8.0.1984
  • v8.0.1982
  • v8.0.1980
  • v8.0.1978
  • v8.0.1976
  • v8.0.1974
  • v8.0.1972
  • v8.0.1970
41 results

iterators.cmod

Blame
    • Martin Nilsson's avatar
      95489a21
      ID_STATIC -> ID_PROTECTED · 95489a21
      Martin Nilsson authored
      Rev: src/backend.cmod:1.229
      Rev: src/builtin.cmod:1.217
      Rev: src/errors.h:1.40
      Rev: src/interpret_functions.h:1.208
      Rev: src/iterators.cmod:1.70
      Rev: src/language.yacc:1.440
      Rev: src/object.c:1.299
      Rev: src/pike_search.c:1.31
      Rev: src/program.c:1.728
      Rev: src/signal_handler.c:1.333
      Rev: src/threads.c:1.259
      95489a21
      History
      ID_STATIC -> ID_PROTECTED
      Martin Nilsson authored
      Rev: src/backend.cmod:1.229
      Rev: src/builtin.cmod:1.217
      Rev: src/errors.h:1.40
      Rev: src/interpret_functions.h:1.208
      Rev: src/iterators.cmod:1.70
      Rev: src/language.yacc:1.440
      Rev: src/object.c:1.299
      Rev: src/pike_search.c:1.31
      Rev: src/program.c:1.728
      Rev: src/signal_handler.c:1.333
      Rev: src/threads.c:1.259
    iterators.cmod 53.49 KiB
    /* -*- c -*-
    || This file is part of Pike. For copyright information see COPYRIGHT.
    || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
    || for more information.
    || $Id: iterators.cmod,v 1.70 2008/06/29 12:37:10 nilsson Exp $
    */
    
    #include "global.h"
    #include "main.h"
    #include "object.h"
    #include "mapping.h"
    #include "multiset.h"
    #include "svalue.h"
    #include "array.h"
    #include "pike_macros.h"
    #include "pike_error.h"
    #include "pike_memory.h"
    #include "dynamic_buffer.h"
    #include "interpret.h"
    #include "las.h"
    #include "gc.h"
    #include "stralloc.h"
    #include "pike_security.h"
    #include "opcodes.h"
    #include "pike_error.h"
    #include "program.h"
    #include "operators.h"
    #include "builtin_functions.h"
    #include "constants.h"
    
    #define sp Pike_sp
    
    DECLARATIONS
    
    /*! @class Iterator
     *!
     *! This is the interface for iterator objects. They implement an
     *! interface to a collection or stream of data items and a cursor
     *! that can be used to iterate over and examine individual items in
     *! the data set.
     *!
     *! Iterators are typically created to access a data set in some
     *! specific object, array, mapping, multiset or string. An object can
     *! have several iterators that access different data sets in it, or
     *! the same in different ways. E.g. strings have both an iterator for
     *! access char-by-char (@[String.Iterator]), and another for access
     *! over splitted substrings (@[String.SplitIterator]).
     *! @[lfun::_get_iterator] may be defined in an object to get an
     *! instance of the canonical iterator type for it. It's used by e.g.
     *! @[foreach] to iterate over objects conveniently.
     *!
     *! It's not an error to advance an iterator past the beginning or end
     *! of the data set; @[`!()] will only return true then, and @[index]
     *! and @[value] will return @[UNDEFINED]. An iterator in that state
     *! need not keep track of positions, so it's undefined what happens
     *! if it's "moved back" into the set of items.
     *!
     *! Backward movement for iterators is optional. It's supported if and
     *! only if @[`-()] is defined, but even then it's undefined how far
     *! back the iterator can move. Therefore iterators may support only a
     *! limited amount of backward movement, e.g. when they access a
     *! stream through a limited buffer. If such an iterator is moved back
     *! past the limit then it'll behave as if it's pointing entirely
     *! outside the data set (see above).
     *!
     *! An iterator that doesn't support backward movement at all should
     *! throw an error if it's attempted.
     *!
     *! @seealso
     *!   @[predef::get_iterator], @[lfun::_get_iterator],