summaryrefslogtreecommitdiff
path: root/enum.c
AgeCommit message (Collapse)Author
2008-05-31Merge from ruby_1_8.knu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-29Merge from ruby_1_8.knu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-27Merge from ruby_1_8.knu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-18Merge -r16241:16456 from ruby_1_8.knu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-14 * enum.c (inject_i, inject_op_i): prototype.usa
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-14* enum.c New methods: Enumerable#take, #take_while, #drop andknu
#drop_while; backported from 1.9. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16012 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-14* enum.c: New methods: Enumerable#one?, #none?, #minmax, #min_by,knu
#max_by, #minmax_by and #cycle; backported from 1.9. * enum.c (enum_find_index): Add support for find_index(obj); [ruby-dev:34313]; backported from 1.9. * enum.c (enum_inject): Add support for Enumerable#inject(:binop); backported from 1.9. * enum.c: Alias Enumerable#reject to #inject; backported from 1.9. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16011 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-14* enum.c (enum_find, enum_reject): Return an enumerator if noknu
block is given. * io.c (rb_io_each_line, rb_io_each_byte, rb_io_s_foreach, argf_each_line, argf_each_byte): Ditto. * string.c (str_gsub): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-14 * enum.c (find_index_i, find_index_iter_i): add prototype for VC.usa
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-14* array.c (rb_ary_collect_bang, rb_ary_select): Return anknu
enumerator if no block is given. * dir.c (dir_each, dir_foreach): Return an enumerator if no block is given. * enum.c (enum_partition, enum_sort_by): Ditto. * gc.c (os_each_obj): Ditto. * hash.c (rb_hash_delete_if, rb_hash_reject_bang, rb_hash_select, rb_hash_each_value, rb_hash_each_key, rb_hash_each_pair, env_each_key, env_each_value, env_each, env_each_pair, env_reject_bang, env_delete_if, env_select): Ditto. * numeric.c (num_step, int_upto, int_downto, int_dotimes): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-14fix a typoknu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-14* enum.c (enum_count, enum_find_index): New methods:knu
Enumerable#count and #find_index; backported from 1.9. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16004 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-10* enum.c (enum_first, enum_group_by): New methods:knu
Enumerable#first and #group_by; backported from 1.9. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15956 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-09 * enum.c (iterate_method): add prototype to avoid warning on VC++.usa
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-09* enumerator.c, inits.c (rb_call_inits), ruby.h, intern.h,knu
ext/enumerator, common.mk (OBJS, enumerator.$(OBJEXT)): Make the enumerator module built-in, * enumerator.c: New method: Enumerable::Enumerator#with_index. * enum.c (enum_each_with_index): Enumerable#each_with_index now returns an enumerator instead of raising an exception if no block is given. Enumerable#enum_with_index, formerly defined in the enumerator module, is kept as an alias to each_with_index for backward compatibility. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-14* enum.c (sort_by_cmp): check if reentered. [ruby-dev:24291]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-06-15Documentation typodrbrain
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-06-30* enum.c (enum_min, enum_max): must not return Qundef.nobu
fixed: [ruby-core:05299] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-06-25* enum.c (enum_min, enum_max): do not ignore nil as the first element.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8665 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-06-09* enum.c (enum_inject): default the result value to Qundef to usenobu
first element as initial value if not given. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-06-07* enum.c (enum_min_by, enum_max_by): return nil if no iteration.nobu
fixed: [ruby-dev:26245] * eval.c (rb_need_block): ensure a block is given. * eval.c (backtrace): skip successive frames sharing same node. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-30* string.c (rb_str_locktmp): lock string temporarily.matz
* string.c (str_independent): add tmplock check. * io.c (io_write): lock output string temporarily. [ruby-dev:24649] * io.c (io_write): use rb_str_locktmp(). * io.c (read_all): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7149 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-20* string.c (str_gsub): reentrant check. [ruby-dev:24432]matz
* backport all SEGV bug fixes from CVS HEAD. [ruby-dev:24536] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7090 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-19* io.c (read_all): block string buffer modification duringmatz
rb_io_fread() by freezing it temporarily. [ruby-dev:24479] * dir.c (rb_push_glob): block call at once the end of method. [ruby-dev:24487] * ext/enumerator/enumerator.c (enum_each_slice): remove rb_gc_force_recycle() to prevent potential SEGV. [ruby-dev:24499] * ext/zlib/zlib.c (zstream_expand_buffer): hide internal string buffer by clearing klass. [ruby-dev:24510] * ext/socket/socket.c (sock_s_getservbyaname): protocol string might be altered. [ruby-dev:24503] * string.c (rb_str_upto): check if return value from succ is a string. [ruby-dev:24504] * io.c (rb_io_popen): get mode string via rb_io_flags_mode() to avoid mode string modification. [ruby-dev:24454] * io.c (rb_io_getline_fast): should take delim as unsigned char to distinguish EOF and '\377'. [ruby-dev:24460] * io.c (rb_io_getline): add check for RS modification. [ruby-dev:24461] * enum.c (enum_sort_by): use qsort() directly instead using rb_iterate(). [ruby-dev:24462] * enum.c (enum_each_with_index): remove rb_gc_force_recycle() to prevent access to recycled object (via continuation for example). [ruby-dev:24463] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-02* string.c (rb_str_sum): check was done with false pointer.matz
[ruby-dev:24383] * string.c (rb_str_sum): string may be altered. [ruby-dev:24381] * eval.c (rb_f_eval): defer pointer retrieval to prevent unsafe sourcefile string modification. [ruby-dev:24373] * io.c (io_read): block string buffer modification during rb_io_fread() by freezing it temporarily. [ruby-dev:24366] * io.c (rb_io_s_popen): mode argument may be altered. [ruby-dev:24375] * file.c (rb_file_s_basename): ext argument may be altered. [ruby-dev:24377] * enum.c (enum_sort_by): use NODE instead of 2 element arrays. [ruby-dev:24378] * string.c (rb_str_chomp_bang): StringValue() may change the receiver. [ruby-dev:24371] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-09-29* enum.c (sort_by_i): internally used object must not be changednobu
outside. [ruby-dev:24368] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-09-21* array.c (rb_ary_uniq_bang): element size might change duringmatz
comparison. [ruby-dev:24298] * enum.c (enum_sort_by): do not use qsort directly. use rb_ary_sort_bang() instead. [ruby-dev:24291] * enum.c (enum_sort_by): pedantic type check added. [ruby-dev:24291] * hash.c (rb_hash_foreach_iter): check iter_lev after each iteration. [ruby-dev:24289] * array.c (rb_ary_and): element size might change during comparison. [ruby-dev:24290] * array.c (rb_ary_or): ditto. [ruby-dev:24292] * array.c (rb_ary_equal): wrong fix. [ruby-dev:24286] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6940 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-07-14minor rdoc typo in enum#mindave
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-07-09* array.c, enum.c, pack.c: rdoc patch from Johan Holmbergocean
<holmberg@iar.se> [ruby-core:3132] [ruby-core:3136] * numeric.c: rdoc patch. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-04-14* array.c, enum.c, eval.c, file.c, io.c, numeric.c, object.c, prec.c,nobu
process.c, re.c, string.c: typos in RDoc comments. [ruby-core:02783] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-16* enum.c (enum_find): mention about ifnone argument. [ruby-talk:90003]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@5474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-29Add RDoc for Kernel global functions, tidy array and errordave
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@5343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-18Annotate enum.c. Add pager support, and report on methods in included modulesdave
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-22* enum.c (each_with_index_i): typo.matz
* eval.c (rb_yield_splat): should call svalue_to_avalue() before calling rb_yield_0(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-22* enum.c (inject_i): use rb_yield_values.matz
* enum.c (each_with_index_i): ditto. * eval.c (rb_yield_splat): new function to call "yield *values". * string.c (rb_str_scan): use rb_yield_splat(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-20* eval.c (rb_yield_0): give warning for multiple values for amatz
block parameter. * eval.c (rb_yield_values): a function to yield multiple values. * array.c (sort_1): use rb_yield_values. * enum.c (min_ii, max_ii): ditto. * hash.c (rb_hash_update_block_i, delete_if_i, select_i, each_pair_i, env_each, env_reject_bang, env_select, env_update_i): ditto. * struct.c (rb_struct_each_pair): ditto. * eval.c (top_include): should include module in the current self, not ruby_top_self. [ruby-dev:20198] * eval.c (top_include): stop inclusion to ruby_wrapper; give warning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-19* ext/pty/pty.c (pty_finalize_syswait): join (using Thread#value)matz
before detach pid. [ruby-talk:71519] * eval.c (PUSH_FRAME): save outer ruby_block. [ruby-list:37677], [ruby-dev:20202] * eval.c (BEGIN_CALLARGS): restore outer block by using ruby_block->outer. * eval.c (block_pass): do not alter block->prev, but block->outer. * array.c (get_inspect_tbl): warning on wrong condition. * eval.c (localjump_xvalue): renamed exitstatus to exit_value since it's not exit "status" after all. * eval.c (localjump_error): add reason to LocalJumpError. * compar.c (rb_cmpint): raise error via rb_cmperr(), if cmp value is nil. now take new 2 arguments. * time.c (time_cmp): 2003-05-16 fix was incomplete. (ruby-bugs-ja:PR#458) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-16-Wall cleanups (removed unused vars, no 'code has no effect' warnings)michal
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-16Updated Copyrights of Matz to 2003.michal
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-15* enum.c (enum_all): now works without block.matz
* enum.c (enum_any): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3344 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-11-22* file.c (rb_find_file_ext): should not terminate searching withmatz
empty path, just ignore. * dir.c: remove <sys/parm.h> inclusion. * compar.c (cmp_eq,cmp_gt,cmp_ge,cmp_lt,cmp_le): check using rb_cmpint(). * error.c (init_syserr): remove sys_nerr dependency. * numeric.c (num_cmp): added to satisfy Comparable assumption. * eval.c (rb_add_method): "initialize" should be public if it is a singleton method. * regex.c (re_match): avoid dereferencing if size == 0. (ruby-bugs-ja:PR#360) * time.c (time_cmp): should return nil if an operand is not a number nor time. (ruby-bugs-ja:PR#359) * file.c (rb_stat_cmp): should return nil if an operand is not File::Stat. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-11-19* array.c (rb_ary_zip): iterates over items in the receiver.matz
zipped with nil if argument arrays are shorter. if arrays are longer, left items are ignored. now works with blocks. * enum.c (zip_i): changed for new behavior. * array.c (rb_ary_transpose): added. [new] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-11-03* object.c (Init_Object): added Object#object_id, new name formatz
Object#id. [new] * object.c (rb_obj_id_obsolete): give warning for Object#id. * numeric.c (fix_intern): added Fixnum#to_sym. [new] * object.c (sym_to_sym): rename from Symbol#intern * enum.c (enum_zip): added Enumerable#zip. [new] * array.c (rb_ary_zip): added Array#zip. * error.c (init_syserr): remove sys_nerr dependency. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-08-01* parse.y (tokadd_string): ignore backslashed spaces in %w.matz
* enum.c (enum_find): do not use rb_eval_cmd(); should not accept a string for if_none. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-07-05enum.c: Fix bug in enum_sort_by and some code indentsmichal
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-06-13* eval.c (svalue_to_avalue): v may be Qundef. This fix wasmatz
suggested by Guy Decoux. * hash.c (rb_hash_s_create): use rb_hash_aset() instead of calling st_insert() directly, to dup&freeze string keys. * parse.y (yylex): proper error message for "@@0". * parse.y (yylex): paren to parse_string() must be zero for unparenthesized strings. * parse.y (str_extend): broken string when unterminated "#{". * enum.c (enum_sort_by): had a bug in 1 element enumeration. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-05-01* numeric.c (num_step): better iteration condition for floatmatz
values; suggested by Masahiro TANAKA <masa@ir.isas.ac.jp>. * range.c (range_step): step (for Range#step method) <= 0 makes no sence, thus ArgError will be raised. * range.c (range_each): Range#each method is special case for Range#step(1) * file.c (rb_find_file): load must be done from an abolute path if $SAFE >= 4. * enum.c (enum_partition): new method. [new] * re.c (rb_reg_s_quote): quote whitespaces for /x cases. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-04-18* re.c (rb_reg_expr_str): should treat backslash specially inmatz
escaping. * io.c: complete off_t handling; missing argument for fptr_finalize(); polished rb_scan_args call. * dir.c: wrap multi-statment macro by do { } while (0) * eval.c, numeric,c, sprintf.c, util.c: ditto. * bignum.c (rb_big_eq): check `y == x' if y is neither Fixnum, Bignum, nor Float. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-18* enum.c (enum_find): catch a value before recycle.nobu
* enum.c (enum_all): ditto. * enum.c (enum_any): ditto. * enum.c (enum_min): ditto. * enum.c (enum_max): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-18* enum.c (enum_inject): use the first iterated element as thenobu
initial value when omitted. * enum.c (inject_i): ditto. * enum.c (Init_Enumerable): Enumerable#inject now takes variable count arguments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2215 b2dd03c8-39d4-4d8f-98ff-823fe69b080e