Граф коммитов

164 Коммитов

Автор SHA1 Сообщение Дата
marcandre 51b89eeb03 enum.c (enum_chunk): Give proper error message if no block given. cf [ruby-core:25912]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-03 04:55:00 +00:00
akr a21b7ddf26 rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-02 23:10:38 +00:00
akr 5bdef2f984 rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-02 23:02:04 +00:00
akr 2e70b9e70d * enum.c (enum_slice_before): take a pattern if no block given.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-02 11:50:11 +00:00
akr e9c728fea3 update rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25185 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-02 10:54:31 +00:00
akr 9278fab680 rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-27 14:44:43 +00:00
akr 50bbca9d5c * enum.c (enum_minmax): use struct for memo.
(enum_minmax_by): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-27 02:28:57 +00:00
akr 0ff9cf3625 fix rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-27 01:58:07 +00:00
akr fdb3e278f5 rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25093 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-25 18:29:53 +00:00
akr e6f4473316 rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25075 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-24 10:35:35 +00:00
akr fc58a6c5bd * enum.c (enum_minmax): reduce comparison.
(enum_minmax_by): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-23 15:19:13 +00:00
akr 475074d5da * enum.c (enum_chunk): new method Enumerable#chunk.
* enum.c (enum_slice_before): new method Enumerable#slice_before.
  [ruby-dev:38392] [ruby-dev:39240]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25032 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-22 01:35:53 +00:00
nobu e07cb859cc * suppressed shorten-64-to-32 warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-18 08:05:32 +00:00
nobu af8f8e5b0e * array.c (recursive_join): use obj to tell if recursion occurs.
[ruby-core:24150]

* enum.c (enum_join): reverted r23966.  [ruby-core:24196]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-10 07:30:08 +00:00
nobu 0f2d1527ab * enum.c (DEFINE_ENUMFUNCS): included function signature.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-07 04:36:50 +00:00
nobu e895bc3cdb * enum.c (rb_enum_join): non-nil separator must be convertible to
String.  [ruby-core:24172]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-07 04:34:34 +00:00
matz 9041ac4289 * enum.c (rb_enum_join): should propagate taint to the return
value.  the change was overridden by r23967.  [ruby-core:24176]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23978 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-07 03:55:18 +00:00
matz 8c7f7c29b4 * enum.c (enum_to_a): should propagate taint to the return value.
[ruby-core:24152]

* enum.c (enum_sort_by): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-06 01:03:16 +00:00
nobu def66ceca3 * enum.c (enum_join): deals with self recursive objects to get rid
of infinite recursion.  [ruby-core:24150]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-06 00:04:56 +00:00
nobu e86d1ce77e * enum.c (enum_join): added rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-05 23:15:51 +00:00
matz 9d9986d25c * enum.c (enum_join): add Enumerable#join.
* array.c (ary_join_1): recursive join for Enumerators (and
  objects with #to_a).

* array.c (rb_ary_join): performance tune.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-03 18:14:33 +00:00
nobu 01430b6e69 * enum.c (enum_grep): gets rid of type-punning calls.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-30 21:47:14 +00:00
matz 304c060d4a * enum.c (first_i): wrong condition for no argument #first.
[ruby-core:24017]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-24 22:46:35 +00:00
matz cab726cfac * enum.c (enum_first): should check negative length.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23623 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-03 00:06:40 +00:00
matz 967001d9da * enum.c (first_i): Enumerator#first should consume only what is
needed.   a patch from Marc-Andre Lafortune.  [ruby-core:23661]

* enum.c (enum_first): call to_int once for an argument.  based on
  a patch from Marc-Andre Lafortune.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-03 00:02:14 +00:00
nobu 82f2e90d07 * enum.c (collect_all): checks interrupts. [ruby-core:23594]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-29 00:30:02 +00:00
nobu 1da3e0f992 * enum.c (zip_ary): should use long.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-20 08:58:56 +00:00
nobu 12d2c8ba41 stripped trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 14:23:33 +00:00
nobu cab67c3197 * array.c (take_items), enum.c (enum_zip): tries to convert to
array first.  [ruby-core:21442]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-19 21:47:48 +00:00
ko1 2e311f6bd5 * include/ruby/node.h, node.h: move node.h from include path.
This change stop to install node.h beacuase of saving ABI
  (node.h will be changed. Extensions should not depends on
  this file).
* blockinlining.c, class.c, compile.c, debug.h, enum.c,
  gc.c, iseq.c, parse.y, ruby.c, signal.c, variable.c,
  vm.c, vm_core.h, vm_dump.c: ditto.
* ext/ripper/depend: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 19:52:31 +00:00
nobu 51e0bcb72a * enum.c (enum_take): get rid of extraneous iteration.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-20 13:24:51 +00:00
nobu 5f9c188d97 * include/ruby/ruby.h (rb_intern_const): tiny optimization.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-16 00:20:31 +00:00
matz 97c8c1fa0e * enum.c (sort_by_i): use NODE_DOT2 instead of NODE_MEMO to avoid
extra calls to is_pointer_to_heap() in GC.

* enum.c (enum_zip): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-13 04:02:36 +00:00
nobu 5a647a3f5f * include/ruby/ruby.h (CONST_ID): constant ID cache for non-gcc.
* *.c: no cache in init functions.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-09 09:25:32 +00:00
knu 3a3e250975 * enum.c (enum_count, count_all_i, Init_Enumerable),
array.c (rb_ary_count): If no argument or block is given, count
  the number of all elements.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-29 19:18:54 +00:00
knu fc19d23c5d * enum.c (enum_to_a): Pass arguments through to #each().
(enum_sort): Follow the enum_to_a signature change.
  (enum_reverse_each): Add #reverse_each().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-27 04:15:44 +00:00
knu 16ddb4f689 Cosmetic.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-27 03:25:51 +00:00
nobu 1072cb65c9 * enum.c (enum_yield): use rb_yield_values2.
* enum.c (DEFINE_ENUMFUNCS): macro to define enumerator and yielding
  functions.

* enum.c (enum_all_func, enum_any_func, enum_one_func,
  enum_none_func): reduced duplicate code.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16404 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-13 14:32:46 +00:00
knu d701d21dbe * enum.c (grep_i): Be aware of multiple values;
fix [ruby-dev:34653].
  (grep_iter_i): Ditto.
  (count_i): Ditto.
  (find_i): Ditto.
  (find_index_i): Ditto.
  (find_all_i): Ditto.
  (reject_i): Ditto.
  (inject_i): Ditto.
  (inject_op_i): Ditto.
  (partition_i): Ditto.
  (group_by_i): Ditto.
  (first_i): Ditto.
  (sort_by_i): Ditto.
  (all_i): Ditto.
  (all_iter_i): Ditto.
  (any_i): Ditto.
  (any_iter_i): Ditto.
  (one_i): Ditto.
  (one_iter_i): Ditto.
  (none_i): Ditto.
  (none_iter_i): Ditto.
  (min_i): Ditto.
  (min_ii): Ditto.
  (max_i): Ditto.
  (max_ii): Ditto.
  (minmax_i): Ditto.
  (minmax_ii): Ditto.
  (min_by_i): Ditto.
  (max_by_i): Ditto.
  (minmax_by_i): Ditto.
  (member_i): Ditto.
  (take_i): Ditto.
  (take_while_i): Ditto.
  (drop_i): Ditto.
  (drop_while_i): Ditto.
  (cycle_i): Ditto.

* enum.c (each_with_index): Update rdoc.  each_with_index() takes
  argments that are passed through to each(), and a hash preserves
  key order.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-12 11:21:39 +00:00
nobu 8481c848da * enum.c (all_iter_i, any_iter_i): reduced duplicated code.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-11 14:19:41 +00:00
nobu 93df43f8ae * enum.c: removed trailing garbage spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16365 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-11 14:10:20 +00:00
knu 181f815591 * enum.c (enum_cycle): Make Enumerable#cycle do a finite loop when
the number of cycles is specified.

* array.c (rb_ary_cycle): Ditto for Array#cycle.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-13 14:59:55 +00:00
matz 3734fd0e79 * enum.c (count_i): modified to shut warning up.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-11 08:36:47 +00:00
knu f9c5484cc5 * enum.c (count_i, count_iter_i, enum_count, enum_find_index):
Reduce code.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15974 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-11 08:26:45 +00:00
matz f79e9281ff * enum.c (find_index_i): modified to shut warning up.
* enum.c (find_index_iter_i): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-11 08:06:31 +00:00
knu 033a32b4c1 * enum.c (enum_find_index): Add support for find_index(obj);
[ruby-dev:34313].

* array.c (rb_ary_index): Define find_index as an alias to index.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-11 07:58:06 +00:00
mame b6c9957058 * array.c (ary_new): fix size check. [ruby-dev:34123]
* array.c (rb_ary_take, rb_ary_drop): check negative size and use
  NUM2LONG instead of FIX2LONG.  [ruby-dev:34123]

* enum.c (enum_take, enum_drop): check negative size.

* test/ruby/test_array.rb: add tests for above.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-25 10:13:03 +00:00
matz 1d2078824f * enum.c (zip_ary): wrong boundary condition.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-13 16:38:23 +00:00
matz 2b1b74a099 * enum.c (enum_zip): optimize if all arguments are arrays.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-11 16:20:44 +00:00
akr 861219ce4a fix doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-09 01:04:46 +00:00