summaryrefslogtreecommitdiffstats
path: root/enumerator.c
Commit message (Collapse)AuthorAgeFilesLines
* * enumerator.c (Enumerator#{each_,}{with_index,with_object}): Fixknu2009-03-171-5/+14
| | | | | | | | a bug where any parameter but the first one is dropped even if multiple values are yielded with. [Bug #1198] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Slightly fix rdoc of with_index.knu2009-02-091-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerator_with_index): receives one argument whichmame2009-02-081-9/+28
| | | | | | | represents a start offset. [ruby-dev:37921] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Introduce id_each to save rb_itern() and SYM2ID()knu2009-02-021-6/+7
| | | | | | | calls. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerator_rewind): If the enclosed objectknu2008-12-101-0/+7
| | | | | | | responds to a "rewind" method, call it; cf. [ruby-dev:37268] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerator_next): Fix a typo: s/rewinded/rewound/.knu2008-12-101-1/+1
| | | | | | | * lib/prime.rb (Prime::OldCompatibility#each): Ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (inspect_enumerator): Implement #inspect.knu2008-12-041-0/+63
| | | | | | | [ruby-dev:37248]-[ruby-dev:37263] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20481 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * common.mk: clean upko12008-09-231-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | - remove blockinlining.$(OBJEXT) to built - make ENCODING_H_INCLDUES variable (include/ruby/encoding.h) - make VM_CORE_H_INCLUDES variable (vm_core.h) - simplify rules. - make depends rule to output depend status using gcc -MM. * include/ruby/mvm.h, include/ruby/vm.h: rename mvm.h to vm.h. * include/ruby.h: ditto. * load.c: add inclusion explicitly. * enumerator.c, object.c, parse.y, thread.c, vm_dump.c: remove useless inclusion. * eval_intern.h: cleanup inclusion. * vm_core.h: rb_thread_t should be defined in this file. * vm_evalbody.c, vm_exec.c: rename vm_evalbody.c to vm_exec.c. * vm.h, vm_exec.h: rename vm.h to vm_exec.h. * insnhelper.h, vm_insnhelper.h: rename insnhelper.h to vm_insnhelper.h. * vm.c, vm_insnhelper.c, vm_insnhelper.h: - rename vm_eval() to vm_exec_core(). - rename vm_eval_body() to vm_exec(). - cleanup include order. * vm_method.c: fix comment. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Activate Enumerator#with_object and addknu2008-08-261-6/+35
| | | | | | | | Enumerable#each_with_object. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerator_initialize),knu2008-08-261-12/+282
| | | | | | | | | test/ruby/test_enumerator.rb: Add an ability to generate an enumerator from a block. [experimental] [ruby-dev:35903] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (Init_Enumerator): Rename Enumerable::Enumerator toknu2008-08-131-7/+7
| | | | | | | just Enumerator. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerator_with_object): suppress a warning.nobu2008-07-211-0/+2
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18149 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enum_each_cons): typo in RDoc fixed.matz2008-06-201-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerator_with_object, Init_Enumerator):knu2008-06-161-6/+8
| | | | | | | Temporarily back out with_memo, for which we need a better name. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17353 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c, bignum.c, cont.c, dir.c, dln.c, encoding.c, enumerator.c,ko12008-06-081-2/+1
| | | | | | | | | | | | | | | | | | | enumerator.c (enumerator_allocate), eval_jump.c, file.c, hash.c, io.c, load.c, pack.c, proc.c, random.c, re.c, ruby.c, st.c, string.c, thread.c, thread_pthread.c, time.c, util.c, variable.c, vm.c, gc.c: allocated memory objects by xmalloc (ruby_xmalloc) should be freed by xfree (ruby_xfree). * ext/curses/curses.c, ext/dbm/dbm.c, ext/digest/digest.c, ext/gdbm/gdbm.c, ext/json/ext/parser/parser.c, ext/json/ext/parser/unicode.c, ext/openssl/ossl_cipher.c, ext/openssl/ossl_hmac.c, ext/openssl/ossl_pkey_ec.c, ext/sdbm/init.c, ext/strscan/strscan.c, ext/zlib/zlib.c: ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerator_with_index, enumerator_with_memo): Fixknu2008-06-041-4/+4
| | | | | | | grammo in rdoc. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16802 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerator_with_memo): New method: with_memo().knu2008-06-031-0/+37
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerator_init_copy): Take care ofknu2008-06-031-1/+6
| | | | | | | initialize_copy as well as initialize. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerator_allocate, enumerator_ptr): Properlyknu2008-06-031-6/+16
| | | | | | | | | detect if the object is initialized and raise error when appropriate. (enumerator_initialize): Fix a typo in rdoc. [ruby-core:17052] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (struct enumerator, enumerator_init)knu2008-05-261-7/+6
| | | | | | | | | | (enumerator_init_copy, enumerator_each): Eliminate iter. (enumerator_ptr): Do not hardcode the class name. (enumerator_with_index): Delay variable initialization after RETURN_ENUMERATOR(). git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (Init_Enumerator): Overrideknu2008-05-231-0/+1
| | | | | | | Enumerable::Enumerator#each_with_index with #with_index. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Update rdoc.knu2008-05-131-10/+10
| | | | | | | | | (enumerator_initialize): Discourage the use. (enum_each_slice, enum_each_cons, enumerator_each) (enumerator_with_index): Add a note about a call without a block. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16402 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerator_each, enumerator_with_index): suppressnobu2008-04-221-2/+0
| | | | | | | | | | | | | | | | | | warnings. * pack.c (pack_unpack): ditto. * process.c (rb_syswait): ditto. * re.c (rb_reg_prepare_enc, rb_reg_prepare_re, rb_reg_adjust_startpos): ditto. * regparse.c (onig_name_to_group_numbers): ditto. * missing/vsnprintf.c (BSD_vfprintf): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerator_initialize): Remove an undocumentedknu2008-04-221-26/+1
| | | | | | | | feature (passing a block to the constructor) that's broken. This is not what I intended. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerator_init): preserve the method name in ID.matz2008-04-211-5/+4
| | | | | | | | * enumerator.c (enumerator_each): need not to call rb_to_id(). * enumerator.c (enumerator_with_index): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c, include/ruby/ruby.h: Export rb_cEnumerator.knu2008-04-201-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: Resolve the method every time an enumerationknu2008-04-201-9/+14
| | | | | | | | | method is run, not once when the enumerator is initialized as it was before, so that method_missing() and method (re)definition afterwards are both in effect; pointed out in: [ruby-core:16441] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix doc.akr2008-03-091-0/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: fix documents.mame2008-01-291-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_zip): honor length of the receiver, not thematz2008-01-081-2/+2
| | | | | | | | | | | | | shortest length. [ruby-core:14738] * enum.c (enum_zip): returns array not enumerator for no block form. [ruby-core:14738] * enumerator.c (next_ii): do not ignore multiple values yielded. * array.c (rb_ary_zip): faster version without creating generators. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerator_iter_i): adjusted for rb_block_call_func.nobu2007-12-211-7/+4
| | | | | | | | * include/ruby/ruby.h (rb_block_call_func): function to be called back as block. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerator_init_copy): typo fixed.matz2007-12-211-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerator_init_copy): prohibit cloning ofmatz2007-12-211-3/+9
| | | | | | generators since Fibers cannot be copied. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14404 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerator_next): should call next_init() if fibermatz2007-12-201-1/+1
| | | | | | is dead already. [ruby-dev:32459] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * insnhelper.ci (vm_yield_with_cfunc): call cfunc withmatz2007-12-191-7/+2
| | | | | | | | (argv[0], data, argc, argv) to pass all arguments. * eval.c (loop_i): adapted to new calling convention. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14319 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * insns.def (concatarray, splatarray): use to_a instead ofmatz2007-12-011-14/+0
| | | | | | | | to_splat. * insnhelper.ci (caller_setup_args): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * insnhelper.ci (vm_yield_with_cfunc): fix to passing argc on thirdko12007-12-011-3/+14
| | | | | | | | | | | | | parameter of IFUNC. [ruby-dev:32329] * enumerator.c: fix to pass exact number of argument. * eval.c (rb_yield_values2): added. * include/ruby/ruby.h: ditto. * bootstraptest/test_knownbug.rb: move a fixed test. * bootstraptest/test_block.rb: ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14062 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_butfirst): add a new method to iterates overmatz2007-10-301-4/+1
| | | | | | | | | elements but first n. RDoc need to be updated. * enumerator.c (Init_Enumerator): remove unnecessary symbol initialization. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13793 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerator_next): message changed.matz2007-08-261-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c: separate Continuation and Fiber from core.ko12007-08-251-1/+1
| | | | | | | | | | | | | | * ext/continuation/*, ext/fiber/*: ditto. * include/ruby/ruby.h: remove rb_cFiber. * include/ruby/intern.h: add the rb_fiber_new() declaration. * enumerator.c (next_init): fix to use rb_fiber_new(). * test/ruby/test_enumerator.rb: remove next? tests. * test/ruby/test_continuation.rb: add a require 'continuation'. * test/ruby/test_fiber.rb: add a require 'fiber'. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerator_next): stop pre-fetching.matz2007-08-241-40/+13
| | | | | | | | * enumerator.c (Init_Enumerator): remove next? method. * eval.c (rb_f_loop): now handles StopIteration exception. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (sym_call): initialize first.nobu2007-08-231-8/+12
| | | | | | | | | * enumerator.c (enum_iter): typedefed. * enumerator.c (next_i): suppress a warning. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c: add Fiber#resume and Fiber.yield.ko12007-08-211-4/+4
| | | | | | | | | | | and Fiber::Core class to realize Coroutine. * include/ruby/intern.h: declare rb_fiber_yield(), rb_fiber_resume(), * enumerator.c: use above api. * test/ruby/test_fiber.rb: fix and add tests for above changes. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13130 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (next_i): fix to return with Fiber#yield atko12007-08-201-7/+12
| | | | | | | | | | | the end of each block. [ruby-dev:31470] * enumerator.c (enumerator_next_p): call init_next if not initialized. [ruby-dev:31514] * test/ruby/test_enumerator.rb: add tests for Enumerator. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerator_next_p): should check correctly even whenmatz2007-08-081-13/+31
| | | | | | | | | | | | | | | | | e.next has not been called before. * enumerator.c (enumerator_next): raise StopIteration (name taken from Python) instead of IndexError. * enum.c (enum_zip): catch StopIteration exception. * enumerator.c (enumerator_with_index): return Enumerator if no block is given. * test/ruby/test_iterator.rb (TestIterator::test_enumerator): add test for enumerators. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@12905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_zip): zip no longer converts arguments intomatz2007-08-061-20/+18
| | | | | | arrays, uses enumerators. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@12892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (rb_fiber_yield): change argument ordering. export.matz2007-08-061-2/+104
| | | | | | | | | | | | | | | | | * cont.c (rb_fiber_current): export * include/ruby/intern.h: export several functions from cont.c. * enumerator.c (enumerator_next): new method to implement external iterator (generator) using fiber. * enumerator.c (enumerator_next_p): new method to check whether any element is left in the generator sequence. * enumerator.c (enumerator_rewind): a new method to rewind the generator sequence. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@12891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby: moved public headers.nobu2007-06-101-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@12501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerator_init_copy): need to copy internalmatz2007-01-251-0/+16
| | | | | | structure on clone and dup. [ruby-dev:30192] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@11574 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enum_each_cons): move RETURN_ENUMERATOR() aftermatz2006-10-271-1/+1
| | | | | | | argument check. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@11230 b2dd03c8-39d4-4d8f-98ff-823fe69b080e