aboutsummaryrefslogtreecommitdiffstats
path: root/enumerator.c
Commit message (Collapse)AuthorAgeFilesLines
* * include/ruby/ruby.h (rb_data_type_t): restructured. [ruby-dev:41862]nobu2010-07-181-9/+15
| | | | | | | | add parent member. * error.c (rb_typeddata_inherited_p): new function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * removed trailing spaces.nobu2010-05-291-9/+9
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c: Documentation: change => in call-seq to ->.marcandre2010-05-171-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Harmonize "#=>" in examples. [ruby-core:30206] * bignum.c: ditto * class.c: ditto * compar.c: ditto * cont.c: ditto * dir.c: ditto * encoding.c: ditto * enum.c: ditto * enumerator.c: ditto * error.c: ditto * eval.c: ditto * file.c: ditto * gc.c: ditto * io.c: ditto * load.c: ditto * marshal.c: ditto * math.c: ditto * numeric.c: ditto * object.c: ditto * pack.c: ditto * proc.c: ditto * process.c: ditto * random.c: ditto * range.c: ditto * re.c: ditto * ruby.c: ditto * signal.c: ditto * sprintf.c: ditto * string.c: ditto * struct.c: ditto * thread.c: ditto * time.c: ditto * transcode.c: ditto * variable.c: ditto * vm_eval.c: ditto * vm_method.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * error.c: RDoc for subclasses of Exception. [ruby-core:28394]marcandre2010-05-081-1/+16
| | | | | | | | | | | | | | | | | | | | | | * cont.c: ditto * enumerator.c: ditto * io.c: ditto * math.c: ditto * numeric.c: ditto * proc.c: ditto * re.c: ditto * thread.c: ditto * transcode.c: ditto. Thanks to Run Paint for some of the documentation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (inspect_enumerator): don't raise for uninitializedakr2010-04-121-2/+10
| | | | | | | enumerator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: move implementation of each_slice, each_cons,matz2010-02-031-142/+0
| | | | | | | | | | | | | each_with_object to enum.c. * enum.c (each_slice_i): convert multiple values from yield into an array. * enum.c (each_cons_i): ditto. * enum.c (each_with_object_i): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_eval.c (rb_iterate): pass current block when the argument bl_procmame2009-12-201-7/+1
| | | | | | | | | | | | is NULL. This behavior can be used to make enumerator faster [ruby-dev:39874] * enumerator.c (enumerator_each): pass current block directly instead of trampoline block (enumerator_each_i). * io.c (argf_each_line, argf_each_byte, argf_each_char): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (yielder_yield_push): Yielder#<< should return self.mame2009-11-111-1/+8
| | | | | | [ruby-dev:39660] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix typos.akr2009-11-031-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_to_ary): do not use #respond_to? to detectmatz2009-10-291-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to_ary. Just call. [ruby-core:23738] * eval.c (rb_check_funcall): new function with method existence check. returns Qundef when the method does not exist. * enumerator.c (enumerator_rewind): just call method, using rb_check_funcall(). [ruby-core:23738] * error.c (exc_equal): ditto. * object.c (convert_type): ditto. * error.c (rb_name_err_mesg_new): export function. * eval.c (make_exception): ditto. * io.c (pop_last_hash): return early when the last argument is nil. * io.c (rb_io_puts): treat T_STRING specially for small optimization. * vm_eval.c (raise_method_missing): skip method call if possible using rb_method_basic_definition_p(). * vm_eval.c (method_missing): ditto. * test/ruby/test_rubyoptions.rb (TestRubyOptions#test_debug): test suites changed to ignore exceptions caused by just-call policy. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerator_block_call): extracted.nobu2009-09-291-36/+22
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25164 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerator_data_type): typed.nobu2009-09-091-26/+56
| | | | | | | (yielder_data_type, generator_data_type): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (next_i): typo fixed (reached at end -> reached anmatz2009-08-271-1/+1
| | | | | | end). pointed out by James Edward Gray II at LoneStar RubyConf. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix rdoc.akr2009-08-221-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24623 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rdoc update.akr2009-08-221-11/+40
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (ary2sv): add dup argument.akr2009-08-211-11/+19
| | | | | | | | | | | (enumerator_next): call ary2sv with dup=0. (enumerator_peek): call ary2sv with dup=1 to return duplicated array. (enumerator_peek_values_m): new function to return duplicated array. (Init_Enumerator): use enumerator_peek_values_m as Enumerator#peek_value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rdoc update.akr2009-08-211-2/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (get_next_values): extracted fromakr2009-08-211-29/+32
| | | | | | | | | | enumerator_next_values. (enumerator_next_values): use get_next_values. (enumerator_peek_values): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24615 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rdoc update.akr2009-08-191-7/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (next_init): don't clear feedvalue.akr2009-08-191-1/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24588 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c: implement Enumerator#{next_values,peek_values,feed}akr2009-08-191-26/+271
| | | | | | | | | | | | | | | | | | | | | | and StopIteration#result. [ruby-dev:39109] (struct enumerator): replace no_next by stop_exc. new field feedvalue. (enumerator_mark): mark feedvalue and stop_exc. (enumerator_init): initialize feedvalue and stop_exc. (enumerator_init_copy): initialize feedvalue. (next_ii): send yield arguments as an array. return feedvalue. (next_i): generate StopIteration exception here. set result. (next_init): initialize feedvalue. (enumerator_next_values): new method Enumerator#next_values. (ary2sv): new function. (enumerator_peek_values): new method Enumerator#peek_values. (enumerator_feed): new method Enumerator#feed. (yielder_yield): return the yield value. (generator_each): return the iterator value. (stop_result): new method StopIteration#result. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerator_peek): new method Enumerator#peek. akr2009-08-181-3/+46
| | | | | | | | (enumerator_next): don't rewind at end. [ruby-dev:38932] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24578 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * suppressed shorten-64-to-32 warnings.nobu2009-07-181-5/+5
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (yielder_yield_i): use rb_proc_new instead ofmame2009-07-131-7/+1
| | | | | | | | | | | | rb_iterate. [ruby-dev:38518] * README.EXT: rb_iterate is obsolete since 1.9; use rb_block_call instead. * README.EXT.ja: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (inspect_enumerator): should use long.nobu2009-05-201-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Trivial change in comment.knu2009-04-221-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@22992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Slightly fix rdoc of with_index.knu2009-02-091-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/ruby/trunk@18564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerator_with_object): suppress a warning.nobu2008-07-211-0/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/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: svn+ssh://ci.ruby-lang.org/ruby/trunk@16146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e