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

436 Коммитов

Автор SHA1 Сообщение Дата
akr bd15d4ca78 * internal.h (numberof): Gathered from various files.
* array.c, math.c, thread_pthread.c, iseq.c, enum.c, string.c, io.c,
  load.c, compile.c, struct.c, eval.c, gc.c, parse.y, process.c,
  error.c, ruby.c: Remove the definitions of numberof.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-07 10:01:19 +00:00
ko1 83aba04862 * include/ruby/ruby.h: constify RBasic::klass and add
RBASIC_CLASS(obj) macro which returns a class of `obj'.
  This change is a part of RGENGC branch [ruby-trunk - Feature #8339].
* object.c: add new function rb_obj_reveal().
  This function reveal interal (hidden) object by rb_obj_hide().
  Note that do not change class before and after hiding.
  Only permitted example is:
  klass = RBASIC_CLASS(obj);
  rb_obj_hide(obj);
  ....
  rb_obj_reveal(obj, klass);
  TODO: API design. rb_obj_reveal() should be replaced with others.
  TODO: modify constified variables using cast may be harmful for
  compiler's analysis and optimizaton.
  Any idea to prohibt inserting RBasic::klass directly?
  If rename RBasic::klass and force to use RBASIC_CLASS(obj),
  then all codes such as `RBASIC(obj)->klass' will be
  compilation error. Is it acceptable? (We have similar
  experience at Ruby 1.9,
  for example "RARRAY(ary)->ptr" to "RARRAY_PTR(ary)".
* internal.h: add some macros.
* RBASIC_CLEAR_CLASS(obj) clear RBasic::klass to make it internal
  object.
* RBASIC_SET_CLASS(obj, cls) set RBasic::klass.
* RBASIC_SET_CLASS_RAW(obj, cls) same as RBASIC_SET_CLASS
  without write barrier (planned).
* RCLASS_SET_SUPER(a, b) set super class of a.
* array.c, class.c, compile.c, encoding.c, enum.c, error.c, eval.c,
  file.c, gc.c, hash.c, io.c, iseq.c, marshal.c, object.c,
  parse.y, proc.c, process.c, random.c, ruby.c, sprintf.c,
  string.c, thread.c, transcode.c, vm.c, vm_eval.c, win32/file.c:
  Use above macros and functions to access RBasic::klass.
* ext/coverage/coverage.c, ext/readline/readline.c,
  ext/socket/ancdata.c, ext/socket/init.c,
* ext/zlib/zlib.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 10:49:11 +00:00
ko1 aacd771046 * *.c, parse.y, insns.def: use RARRAY_AREF/ASET macro
instead of using RARRAY_PTR().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 09:56:22 +00:00
eregon bd14f5bf94 * enum.c (Enumerable#chunk): fix grammar of error message
for symbols beginning with an underscore [Bug #8351]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-01 10:04:21 +00:00
nobu 9f87297c21 enum.c: avoid inadvertent symbol creation
* enum.c (enum_inject): avoid inadvertent symbol creation.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-04 06:46:53 +00:00
zzak d2c218d559 * enum.c (Enumerable#chunk: Improved examples, grammar, and formatting
Patch by Dan Bernier and Rich Bruchal of newhaven.rb
  [Github documenting-ruby/ruby#8]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-22 02:11:26 +00:00
marcandre 1677cbce9d * enumerator.c: Use to_enum for Enumerable methods returning Enumerators.
This makes Lazy#cycle no longer needed, so it was removed.
  Make Enumerator#chunk and slice_before return lazy Enumerators.
  [Bug #7715]

* internal.h: Remove ref to rb_enum_cycle_size; no longer needed

* enum.c: Make enum_cycle_size static.

* test/ruby/test_lazy_enumerator.rb: Test for above

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-05 03:49:59 +00:00
marcandre 96af5360a4 * enum.c (enum_zip): Fix error message
* array.c (take_items): Same, for Array#zip
  [Bug #7706]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-24 07:51:05 +00:00
ko1 f6f388a5bd * array.c, enum.c, insns.def, io.c, numeric.c, parse.y, process.c,
range.c: use prepared IDs.
  A patch from charliesome (Charlie Somerville).
  [Bug #7495]
* common.mk: add dependency to id.h.
* common.mk: replace ID_H_INCLUDES with id.h.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-02 09:57:47 +00:00
nobu 66fd9d44d8 adjust style.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-01 15:25:28 +00:00
nobu db54dc7215 enum.c: prefix
* enum.c (rb_enum_cycle_size): prefix with rb.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06 22:52:52 +00:00
marcandre 0814c4ac64 * enumerator.c: Support for lazy.cycle.size
[Feature #6636]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06 17:16:58 +00:00
marcandre cef054d5b2 * enum.c (enum_cycle): Support for Enumerable#cycle.size
[Feature #6636]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06 17:13:19 +00:00
marcandre fe9386cdcb * enum.c (enum_each_cons): Support for Enumerable#each_cons.size
[Feature #6636]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06 17:13:04 +00:00
marcandre df8451e606 * enum.c (enum_each_slice): Support for Enumerable#each_slice.size
[Feature #6636]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37508 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06 17:12:50 +00:00
marcandre c82ad6d207 * enum.c: Support for enumerators created by Enumerable with forwarding:
find_all, reject, ...
  [Feature #6636]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06 17:12:35 +00:00
nobu a7353f6924 enum.c: id_call
* enum.c (enum_find): use id_call.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-24 01:18:22 +00:00
nobu 8a3856dc1e enum.c: id_call
* enum.c (id_call): intern first and share.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-24 01:16:36 +00:00
nobu abeedb0875 array.c, enum.c: TypeError in zip
* array.c (take_items), enum.c (enum_zip): raise TypeError at
  non-enumerable objects, not NoMethodError.  [ruby-dev:46145]
  [Bug #7038]
* vm_eval.c (rb_check_block_call): check_funcall variant with block
  function.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-19 15:42:26 +00:00
zzak 1ae1b85e81 * array.c (rb_ary_select):
Update documentation for Array#select
* enum.c (enum_find_all, enum_reject):
  Update documentation for Enumerable#find_all and Enumerable#reject
  Based on a patch by Jeff Saracco
  [Bug #6908] [ruby-core:47285] [Fixes #166 on github]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-13 18:32:07 +00:00
ayumin 8198cca945 Merge branch 'pullreq/129' into trunk
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-18 16:28:42 +00:00
drbrain 38f0dd0aba * enum.c (enum_count): Enumerable#count no longer uses #size when
counting elements.  Patch by Nobuhiro IMAI.  [ruby-trunk - Bug #6473]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-24 23:51:56 +00:00
drbrain e95f7ea80d * variable.c (trace_ev): Removed "not reached" comment as this line is
reached.
* variable.c (rb_obj_remove_instance_variable):  Replaced "not reached"
  comment with the UNREACHABLE macro.
* variable.c (rb_mod_const_missing):  ditto.
* variable.c (rb_mod_remove_cvar):  ditto.
* enum.c (first_i):  ditto.
* string.c (rb_str_aref):  ditto.
* string.c (str_byte_aref):  ditto.
* string.c (rb_to_id):  ditto.
* io.c (rb_io_fmode_modestr):  ditto.
* io.c (rb_io_oflags_modestr):  ditto.
* pack.c (num2i32):  ditto.
* vm_eval.c (rb_method_missing):  ditto.
* vm_eval.c (rb_f_throw):  ditto.
* dir.c (dir_read):  ditto.
* win32/win32.c (child_result):  ditto.
* struct.c (rb_struct_getmember):  ditto.
* struct.c (rb_struct_set):  ditto.
* struct.c (rb_struct_aref_id):  ditto.
* eval.c (rb_f_raise):  ditto.
* process.c (rb_f_exit_bang):  ditto.
* process.c (rb_f_exit):  ditto.
* process.c (rb_f_abort):  ditto.
* ext/-test-/iter/break.c (iter_break_value):  ditto.
* ext/pty/pty.c (pty_check):  ditto.
* ext/openssl/ossl_pkey.c (ossl_pkey_new):  ditto.
* ext/readline/readline.c (rb_remove_history):  ditto.
* ext/stringio/stringio.c (strio_unimpl):  ditto.
* numeric.c (num_sadded):  ditto.
* numeric.c (num_init_copy):  ditto.
* numeric.c (rb_num2ll):  ditto.
* numeric.c (rb_num2ull):  ditto.
* vm_insnhelper.c (call_cfunc):  ditto.
* ruby.c (opt_W_getter):  ditto.
* bignum.c (rb_big_coerce):  ditto.
* file.c (rb_f_test):  ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-14 00:36:26 +00:00
shugo 592a629bd0 * enum.c (zip_i): variadic argument needs explicit cast on the
platforms where VALUE is longer than int.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35091 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-19 07:39:12 +00:00
nobu 19451891d8 * enum.c (enum_take): allocate buffer array before iteration, as well
as enum_first did.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-16 08:33:10 +00:00
nobu a920c29c16 * enum.c (enum_first): remove duplication.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-16 06:02:37 +00:00
shugo 2baeb78294 * enum.c (rb_enum_values_pack): rename from enum_values_pack, and
remove static.

* enumerator.c (lazy_init_iterator, lazy_init_yielder,
  lazy_select_func, lazy_reject_func, lazy_grep_func): handle
  multiple values correctly.

* enumerator.c (lazy_grep): change the behavior when a block is
  given, to be consistent with Enumerable#grep.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-15 14:20:27 +00:00
shugo 0b35e9e5dd * enumerator.c (lazy_take): add Enumerable::Lazy#take.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-14 10:29:25 +00:00
nobu 5362e7fcdd * enum.c (enum_each_slice): arrays to be yielded can be newly
created in the block.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-17 06:20:56 +00:00
nobu 41e331cc36 * enum.c: move work variables to objects not to let called blocks
access stack area out of scope.  [Bug #5801]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34661 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-17 04:24:48 +00:00
nobu f5d724ab19 * enum.c (id_lshift): use constant ID.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-16 22:33:31 +00:00
akr 3b1276eb39 update doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-09 13:18:26 +00:00
akr de25f35c98 update doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34494 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-08 15:44:41 +00:00
drbrain 2a4ce0757d * enum.c: Reformat block args to a single standard, { |args| ... }.
Patch by b t.  [Ruby 1.9 - Bug #5393]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-19 02:07:50 +00:00
drbrain 82f1f640ec * enum.c (group_by): Improve group_by description. Patch by b t. [#5411]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33429 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-07 23:55:41 +00:00
drbrain 8f6cb4b473 * enum.c (group_by): Improve documentation based on patch by b t.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-06 01:01:22 +00:00
drbrain e2974b1a4b * enum.c: Clean up wording in Enumerable documentation. Patch by b t.
[Ruby 1.9 - Bug #5411


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-06 00:57:06 +00:00
nobu 8e6e8e6288 * use RB_TYPE_P which is optimized for constant types, instead of
comparison with TYPE.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-29 11:07:45 +00:00
naruse 73220a234e * enum.c (slice_before_i): use rb_attr_get to surpress wrong warning
for internal instance variable slicebefore_initial_state.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-24 18:43:32 +00:00
naruse 579f2a0aa8 * enum.c (enum_inject): remove empty line to notify rdoc
Enumerable#reduce is alias. patched by milki@github.
  https://github.com/ruby/ruby/pull/26

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-21 09:12:36 +00:00
nobu 3a47cf3395 * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-15 11:55:52 +00:00
matz 00e84afa33 * enum.c (enum_inject): typo fixed. a patch from Gaku Ueda in
[ruby-core:35216].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30857 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-12 22:41:02 +00:00
akr e1680f8cc1 * enum.c (sort_by_i): reenter check more strictly.
(sort_by_cmp): ditto.
  [ruby-dev:43003] reported by Usaku NAKAMURA.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-12 10:27:48 +00:00
akr 5a17f4c4a3 fix spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-11 11:34:12 +00:00
akr 113f27ba68 * enum.c (enum_sort_by): use rb_ary_resize.
(ary_cutoff): removed.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30494 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-08 12:48:12 +00:00
akr 74b08ff339 * enum.c (enum_sort_by): use less temporary objects.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-31 03:02:53 +00:00
akr e8fc308315 update doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-30 02:58:42 +00:00
nobu 786e4ce25a * enum.c: use constants in id.h.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29637 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-30 00:40:56 +00:00
naruse 5c132d0ad2 * enum.c (enum_zip): fix typo of rdoc.
patched by Andrei Kulakov [ruby-core:31974]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-01 05:36:31 +00:00
naruse fee5e4ff5f * enum.c (enum_inject): fix typo of rdoc.
patched by Andrei Kulakov [ruby-core:31768]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-19 02:12:32 +00:00
marcandre 165ebcd5ac * enum.c (zip): rdoc fix, patch by okkez [ruby-dev:41737]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-27 03:10:20 +00:00
nobu 45f6fbf339 * removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-29 18:51:39 +00:00
marcandre c5b5ab0935 * enum.c: Documentation: small fixes
* file.c: ditto

* io.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-17 21:51:01 +00:00
marcandre c1ecff1b1e * hash.c: Documentation: change => in call-seq to ->.
* enum.c: Documentation: whitespace fix for r27865

* error.c: ditto

* file.c: ditto

* io.c: ditto

* load.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-17 21:31:22 +00:00
marcandre 7729de4d91 * array.c: Documentation: change => in call-seq to ->.
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
2010-05-17 21:07:33 +00:00
marcandre 4afa9ed041 * array.c: Harmonize documentation, in particular regarding:
- methods returning enumerators
    - array methods and argument naming (array -> ary, an_array -> new_ary)
    - minor improvements, typo fixed and styling issues

  Other documentation errors fixed:
    - return value was self instead of a new array (or vice-versa) for
      Array#{pop,shift,permutation,repeated_permutation,keep_if}
    - Array#rindex was missing the form with a block.

* dir.c: ditto.

* enum.c: ditto. Modified Enumerable#reverse_each' documentation to clarify
  that #each will be finish before any element is yielded.

* error.c: ditto.

* gc.c: ditto.

* hash.c: ditto.

* io.c: ditto. IO#{codepoints,each_codepoint} fixed as per [ruby-core:23948]

* numeric.c: ditto.

* range.c: ditto.

* string.c: ditto.

* struct.c: ditto.

* vm_eval.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-13 05:49:55 +00:00
akr ab284526a4 update doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-23 13:59:16 +00:00
akr b5388e8538 update rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-19 12:54:01 +00:00
akr ad690e96cf rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-13 16:40:27 +00:00
matz 8b55878d2a * enum.c (enum_join): remove Enumerable#join. [ruby-core:24786]
* array.c (ary_join_1): use #to_ary to detect recursive array.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-13 05:55:46 +00:00
akr 73fc3b5a34 rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-12 14:00:49 +00:00
mame fec209551a * enum.c (min_ii, max_ii, minmax_ii): remove wrong optimization that
reuses array for yield parameter, which caused unexpected behavior.
  [ruby-core:25989]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-10 12:29:50 +00:00
matz 78a59da8bc * enumerator.c: move implementation of each_slice, each_cons,
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
2010-02-03 01:29:44 +00:00
akr f7d5887fdb unused variable removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-02 15:14:34 +00:00
matz 970e90dd15 * enum.c (enum_each_entry): new method #each_entry to pack values
from yield into an array.

* lib/set.rb (Set#merge): use Enumerable#each_entry to implement
  Set compatible to 1.8 behavior.  [ruby-core:27985]

* lib/set.rb: replace is_a?(Enumerable) with respond_to?(:each)
  for duck typing.

* lib/set.rb (SortedSet#add): typo fixed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26540 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-02 08:54:52 +00:00
akr b9e0294eda fix typos.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-03 17:46:28 +00:00
matz c0a0aa0c47 * enum.c (enum_count): remove optimization using #size.
revert r25560.

* vm_eval.c (rb_funcall_no_recursive): remove method.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-31 16:14:38 +00:00
matz 7f2ef1a96e * enum.c (enum_count): call #size using rb_funcall_no_recursive()
to prevent infinite recursive calls.  [ruby-core:24794]

* vm_eval.c (rb_funcall_no_recursive): utility function to check
  direct recursive call.

* vm_eval.c (rb_check_funcall): move from eval.c. [refactoring]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-29 17:16:05 +00:00
matz 0580ba0611 * array.c (rb_ary_to_ary): do not use #respond_to? to detect
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
2009-10-29 04:55:10 +00:00
matz 55bf7f9d40 * enum.c (enum_flat_map): new method that concatenates the values
from given block.  also provides alias #collect_concat.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-24 17:01:38 +00:00
akr 3e54f0ee1f rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-11 07:39:17 +00:00
akr 31959b52ef * enum.c (slicebefore_ii): use id_eqq.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-03 23:29:03 +00:00
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
matz 39787ea14d * numeric.c (fix_to_s): avoid rb_scan_args() when no argument
given. 
* bignum.c (rb_big_to_s): ditto.
* enum.c (enum_first): ditto.
* eval_jump.c (rb_f_catch): ditto.
* io.c (rb_obj_display): ditto.
* class.c (rb_obj_singleton_methods): ditto.
* object.c (rb_class_initialize): ditto.
* random.c (rb_f_srand): ditto.
* range.c (range_step): ditto.
* re.c (rb_reg_s_last_match): ditto.
* string.c (rb_str_to_i): ditto.
* string.c (rb_str_each_line): ditto.
* string.c (rb_str_chomp_bang): ditto.
* string.c (rb_str_sum): ditto.

* string.c (str_modifiable): declare inline.
* string.c (str_independent): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-05 05:22:17 +00:00
mame 0dba38026a * enum.c (enum_one, enum_take_while, enum_drop_while): fix documents.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-24 14:23:51 +00:00
jeg2 8ed70a5186 * enum.c: Updating the documentation of Enumrable#zip to reflect
the recent changes Matz made to the method.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-08 23:42:38 +00:00
matz 929faf7906 * enum.c (enum_zip): honor length of the receiver, not the
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: svn+ssh://ci.ruby-lang.org/ruby/trunk@14952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-08 09:50:01 +00:00
akr 6cdef2dc7e * $Date$ keyword removed to avoid inclusion of locale dependent
string.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-06 15:49:38 +00:00
akr 5088b14db7 fix typos.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-31 06:43:32 +00:00
matz f46baadb56 * enum.c (collect_all): should pack all values. [ruby-core:14410]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-25 06:22:27 +00:00
matz 54cf2fca17 * enum.c (enum_yield): when multiple values yielded from #each
pack them into an array.  [ruby-dev:32708]

* enum.c: all method but all?, any?, one? and none? passed packed
  multiple values to the block.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-25 06:01:22 +00:00
matz 9bfdc4e736 * enum.c (enum_inject): updated documentation. a patch from Keita
Yamaguchi <keita.yamaguchi@gmail.com> in [ruby-dev:32686].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-23 20:35:12 +00:00
akr d4463c42c0 * enum.c (enum_count): suppress warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-08 08:53:20 +00:00
matz 9497f7996a * enum.c (enum_count): precise argument number check.
* enum.c (enum_count): return Enumerator if no block given.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-30 10:08:03 +00:00
matz 58c070aa9b * enum.c (enum_take_while): returns Enumerator if no block given.
* enum.c (enum_drop_while): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-30 08:15:12 +00:00
matz c23d672932 * enum.c (each_with_index_i): use rb_yield_values() for
compatibility with Enumerator#with_index().  a patch from Yusuke
  ENDOH <mame AT tsg.ne.jp>.  [ruby-dev:32195]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-09 04:59:07 +00:00
nobu ec0187ef15 * enum.c (enum_each_with_index): make different arrays at each
iteration.  [ruby-dev:32181]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-07 06:07:52 +00:00
davidflanagan d04b7871a1 * enum.c (take_while_i, drop_while_i) add RTEST to handle nil return
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-01 05:53:52 +00:00
usa 4905959e34 * enum.c (enum_drop): fix typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-31 16:53:04 +00:00
matz d2a1637d90 * enum.c (enum_take_while): separate with-block form.
* enum.c (drop_while_i): ditto.

* enum.c (enum_butfirst): abandon butfirst method.  reverted.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-30 23:43:26 +00:00
matz a68451d610 * enum.c (enum_butfirst): add a new method to iterates over
elements but first n.  RDoc need to be updated.

* enumerator.c (Init_Enumerator): remove unnecessary symbol
  initialization.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13793 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-30 01:06:10 +00:00
matz 15112cf003 * enum.c (enum_cycle): hide temporary array from ObjectSpace.
[ruby-core:12762]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-22 15:29:17 +00:00
matz 0c7d366e47 * enum.c (enum_find_index): update RDoc. a patch from David Flanagan
<david AT davidflanagan.com> in [ruby-core:12710].

* enum.c (enum_take, enum_drop): ditto.

* enum.c (enum_cycle): should not cause infinite loop for empty
  arrays.  [ruby-core:12710]

  <david AT davidflanagan.com> in [ruby-core:12710].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-18 08:12:27 +00:00
matz fada885be6 * range.c (range_first): takes first n element if argument is
given.  [ruby-core:12697]

* range.c (range_last): returns last n elements if argument is
  given.

* array.c (rb_ary_subseq, rb_ary_last): export.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-18 06:58:35 +00:00
matz 8cb190c416 * enum.c (enum_inject): RDoc update. a patch from David Flanagan
<david AT davidflanagan.com> in [ruby-core:12679]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-15 16:41:30 +00:00
matz a25fbe3b3e * encoding.c: provide basic features for M17N.
* parse.y: encoding aware parsing.

* parse.y (pragma_encoding): encoding specification pragma.

* parse.y (rb_intern3): encoding specified symbols.

* string.c (rb_str_length): length based on characters.  
  for older behavior, bytesize method added.

* string.c (rb_str_index_m): index based on characters.  rindex as
  well.

* string.c (succ_char): encoding aware succeeding string.

* string.c (rb_str_reverse): reverse based on characters.

* string.c (rb_str_inspect): encoding aware string description.

* string.c (rb_str_upcase_bang): encoding aware case conversion.
  downcase, capitalize, swapcase as well.

* string.c (rb_str_tr_bang): tr based on characters.  delete,
  squeeze, tr_s, count as well.

* string.c (rb_str_split_m): split based on characters.

* string.c (rb_str_each_line): encoding aware each_line.

* string.c (rb_str_each_char): added.  iteration based on
  characters.

* string.c (rb_str_strip_bang): encoding aware whitespace
  stripping.  lstrip, rstrip as well.

* string.c (rb_str_justify): encoding aware justifying (ljust,
  rjust, center).

* string.c (str_encoding): get encoding attribute from a string. 

* re.c (rb_reg_initialize): encoding aware regular expression

* sprintf.c (rb_str_format): formatting (i.e. length count) based
  on characters.

* io.c (rb_io_getc): getc to return one-character string.
  for older behavior, getbyte method added.

* ext/stringio/stringio.c (strio_getc): ditto.

* io.c (rb_io_ungetc): allow pushing arbitrary string at the
  current reading point.

* ext/stringio/stringio.c (strio_ungetc): ditto.

* ext/strscan/strscan.c: encoding support.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-25 03:29:39 +00:00
matz e2de7c70dc * enum.c (enum_cycle): typo fixed. a patch from Kazuhiro
NISHIYAMA <zn AT mbf.nifty.com>.  [ruby-dev:31362]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-08 17:03:33 +00:00
matz c186fdb90b * enumerator.c (enumerator_next_p): should check correctly even when
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: svn+ssh://ci.ruby-lang.org/ruby/trunk@12905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-08 07:07:03 +00:00
matz ecb93c3fdf * enum.c (enum_zip): zip no longer converts arguments into
arrays, uses enumerators.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-06 16:53:36 +00:00
matz b3e977a4c0 * enum.c (enum_cycle): new method to cycle enumerable forever.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-06 16:26:17 +00:00
nobu a594151668 * enum.c (sort_by_cmp): check if reentered. [ruby-dev:24291]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-14 05:04:09 +00:00
akr 1fb587ddec * enum.c (enum_minmax): fix SEGV by [].minmax.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-23 18:10:59 +00:00
matz 3f2fe37200 * enum.c (enum_minmax): new method to get the minimum and maximum
values from the enumerable at once.

* enum.c (enum_minmax_by): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-23 15:05:05 +00:00
nobu 2b592580bf * include/ruby: moved public headers.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-10 03:06:15 +00:00
matz 3d7439d568 * enum.c (each_with_index_i): should work well with continuation.
a patch from sheepman <sheepman AT sheepman.sakura.ne.jp>.
  [ruby-dev:30846]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12419 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-31 16:59:12 +00:00
nobu 3d18c14e2c * enum.c (enum_inject): minor improvement. [ruby-dev:30792]
* enum.c (one_i): no needs to iterate once the result became false.

* enum.c (enum_one): fix for an example.

* enum.c (one_iter_i, none_iter_i): DRY.;


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-18 18:06:54 +00:00
matz 9eec640e9d * enum.c (enum_inject): it is now can work without block. you
have to specify two argument method name as the first argument.

* enum.c (Init_Enumerable): reduce is new alias to inject.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-18 16:10:46 +00:00
matz e7bab2a61b * enum.c (enum_each_with_index): each_with_index to forward
arguments to each.  [ruby-core:10921]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-04-16 07:29:30 +00:00
matz b2c25d56c5 * enum.c (take_i): small cosmetic / documentation patch from
Tadashi Saito <shiba AT mail2.accsnet.ne.jp>. [ruby-dev:30446]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-27 19:04:52 +00:00
matz 60c3c901fe * enum.c (enum_take): new method. [ruby-dev:30407]
* enum.c (enum_drop): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11901 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-27 09:19:21 +00:00
matz 5ba0254777 * enum.c (enum_each_with_index): reuse array for yield parameters.
* enum.c (enum_min, enum_max): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-12-29 19:49:23 +00:00
matz 873b2f9fe3 * enum.c (enum_inject): reuse array for yield parameters.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-12-29 19:27:27 +00:00
matz 6adef5abe5 * enum.c (enum_zip): add RETURN_ENUMERATOR() to zip method.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11217 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-10-25 00:11:16 +00:00
matz 5b93abf50e enum.c: revert last changes
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-04 07:42:10 +00:00
matz 52817c3654 * lib/cgi.rb (CGI::out): specify -x option for nkf.
* lib/cgi.rb (CGI::out): should not convert utf-8 implicitly using
  NKF.  it is too Japanese centric.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-04 07:40:46 +00:00
matz 2156870525 * ruby.h (struct RArray): embed small arrays.
(RARRAY_LEN): defined for accessing array members.
  (RARRAY_PTR): ditto.

* array.c: use RARRAY_LEN and RARRAY_PTR.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-02 14:42:08 +00:00
drbrain bb58656b74 Documentation typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-06-15 01:15:11 +00:00
matz 6458906292 * enum.c (enum_find_index): a new method Enumerable#find_index.
[ruby-talk:178495]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-02-05 15:26:53 +00:00
matz 5675cdbd41 * eval.c: unify ruby_class (for method definition) and ruby_cbase
(for constant reference).

* eval.c (rb_call0): use TMP_ALLOC() instead of allocating
  a temporary array object.

* eval.c (eval): need not to protect $SAFE value.
  [ruby-core:07177]

* error.c (Init_Exception): change NameError to direct subclass of
  Exception so that default rescue do not handle it silently.

* struct.c (rb_struct_select): update RDoc description.
  [ruby-core:7254]

* numeric.c (int_upto): return an enumerator if no block is
  attached to the method.

* numeric.c (int_downto): ditto.

* numeric.c (int_dotimes): ditto.

* enum.c (enum_first): new method Enumerable#first to take first n
  element from an enumerable.

* enum.c (enum_group_by): new method Enumerable#group_by that
  groups enumerable values according to their block values.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9880 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-02-03 09:15:42 +00:00
matz de3bff164c * eval.c (rb_mod_define_method): should save safe_level in the
proc object.  [ruby-dev:28146]

* test/drb/drbtest.rb (DRbService::self.ext_service): increase
  timeout limit.  a patch from Kazuhiro NISHIYAMA
  <zn at mbf.nifty.com>. [ruby-dev:28132]

* eval.c (ev_const_get): fixed a bug in constant reference during
  instance_eval.  [yarv-dev:707]

* eval.c (ev_const_defined): ditto.

* lib/yaml.rb (YAML::add_domain_type): typo fixed.  a patch from
  Joel VanderWerf <vjoel at path.berkeley.edu>.
  [ruby-talk:165285] [ruby-core:6995]

* ext/digest/sha2/sha2.c (ULL): support AIX C.  a patch from
  Kailden <kailden at gmail.com>.  [ruby-core:06984]

* ext/syck/rubyext.c (rb_syck_compile): avoid potential memory
  leak.

* ext/syck/rubyext.c (syck_set_ivars): avoid potential memory
  leak by explicit symbol allocation.

* lib/delegate.rb (Delegator::method_missing): should delegate
  block as well.

* lib/cgi.rb (CGI::QueryExtension::MorphingBody): fix criteria to
  use Tempfile.  A fix from Zev Blut <rubyzbibd at ubit.com>.
  [ruby-core:06076]

* string.c: remove global functions work on $_.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-12-29 12:05:16 +00:00
matz 4d467a0865 * ext/digest/digest.c (rb_digest_base_s_digest): add volatile to
protect temporary context object.  [ruby-dev:27979]

* ext/iconv/iconv.c (Init_iconv): rb_gc_register_address() should
  be called before actual variable initialization.
  [ruby-dev:27986]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9673 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-12-12 00:36:54 +00:00
nobu 1b03efee58 * array.c, enum.c, eval.c, util.c: safer function pointer usage.
fixed: [ruby-core:06143]

* util.h (qsort): removed the definition incompatible to ANSI.
  fixed: [ruby-core:06147]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-10-11 12:30:48 +00:00
ocean dda5dc00cf * array.c: moved to ANSI function style from K&R function style.
(used protoize on windows, so still K&R remains on #ifdef part of
   other platforms. And  `foo _((boo))' stuff is still there)
   [ruby-dev:26975]

* bignum.c, class.c, compar.c, dir.c, dln.c, dmyext.c, enum.c,
  enumerator.c, error.c, eval.c, file.c, gc.c, hash.c, inits.c,
  io.c, main.c, marshal.c, math.c, numeric.c, object.c, pack.c,
  prec.c, process.c, random.c, range.c, re.c, regcomp.c, regenc.c,
  regerror.c, regexec.c, regparse.c, regparse.h, ruby.c, signal.c,
  sprintf.c, st.c, string.c, struct.c, time.c, util.h, variable.c,
  version.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-12 10:44:21 +00:00
matz 69ba229546 * enum.c (enum_count): new method. [ruby-dev:26895]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-08-30 15:35:18 +00:00
nobu 74433fd300 * array.c, dir.c, enum.c, hash.c, io.c, range.c, string.c, struct.c:
let enumerable methods return Enumerator.  [ruby-dev:26924]

* intern.h (RETURN_ENUMERATOR): utility macro for enumerable methods.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-08-30 14:49:51 +00:00
nobu ad46d47e6a * enum.c (enum_member): Enumerable#member? is not an iterator.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-07-14 16:18:44 +00:00
nobu d725e6666a * enum.c (enumeratorize): create new enumerator for current method if
no block is given.

* enumerator.c: moved from ext/enumerator.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-07-14 15:15:22 +00:00
nobu 3f9e6adeb4 * enum.c (enum_min, enum_max): must not return Qundef.
fixed: [ruby-core:05299]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-06-30 16:46:13 +00:00
nobu 9480c6b720 * enum.c (enum_min, enum_max, enum_min_by, enum_max_by): do not ignore
nil as the first element.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-06-25 06:49:25 +00:00
nobu 3f12095fbf * enum.c (enum_inject): default the result value to Qundef to use
first element as initial value if not given.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-06-09 14:36:02 +00:00
nobu 17920c7a9e * enum.c (enum_min_by, enum_max_by): return nil if no iteration.
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/trunk@8590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-06-07 23:33:51 +00:00
matz 3e9e2bd4ed * eval.c (rb_eval): NODE_XSTR should pass copy of literal string.
* array.c (rb_ary_update): a[n,m]=nil no longer works as element
  deletion.

* enum.c (enum_sort_by): protect continuation jump in.
  [ruby-dev:24642]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7145 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-30 06:56:18 +00:00
matz 1057902ac7 * io.c (read_all): block string buffer modification during
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/trunk@7071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-19 10:25:23 +00:00
matz c800d0b75d * io.c (rb_fopen): mode string copy at the lowest level.
* io.c (rb_io_flags_mode): requires output buffer no more.  no
  allocation needed.

* array.c (rb_ary_index): takes a block to compare items in an
  array.  [ruby-talk:113069] [Ruby2]

* array.c (rb_ary_rindex): ditto.

* marshal.c (r_byte): retrieve pointer from string value for each
  time.  [ruby-dev:24404]

* marshal.c (r_bytes0): ditto.

* enum.c (sort_by_i): re-entrance check added.  [ruby-dev:24399]

* io.c (io_read): should freeze all reading buffer.
  [ruby-dev:24400]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-05 01:37:46 +00:00
matz 779f3d6d11 * string.c (rb_str_sum): wrong cast caused wrong result.
[ruby-dev:24385]

* enum.c (enum_sort_by): hide temporary array from
  ObjectSpace.each_object.  [ruby-dev:24386]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-02 07:57:32 +00:00
matz 1b4d97ddba * 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/trunk@6976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-01 15:56:05 +00:00
nobu 3615015df0 * enum.c (sort_by_i): internally used object must not be changed
outside.  [ruby-dev:24368]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-09-29 01:58:43 +00:00
matz bfabc05a43 * 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/trunk@6939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-09-21 03:08:33 +00:00
matz 6c6a24826c * enum.c (enum_min_by): new method Enum#min_by. added Enum#max_by
as well.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6629 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-07-14 14:51:42 +00:00
ocean 29c3cb6d20 * array.c, enum.c, pack.c: rdoc patch from Johan Holmberg
<holmberg@iar.se> [ruby-core:3132] [ruby-core:3136]

* numeric.c: rdoc patch.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-07-09 13:38:34 +00:00
nobu d952e33003 * array.c, enum.c, eval.c, file.c, io.c, numeric.c, object.c, prec.c,
process.c, re.c, string.c: typos in RDoc comments.  [ruby-core:02783]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-04-14 04:06:52 +00:00
matz bfb47068b0 * eval.c: remove specialized version of rb_Array(). use simple
one defined in object.c.

* object.c (Init_Object): remove Kernel#to_a.

* enum.c (enum_zip): use "to_a" instead of "to_ary".


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-03-18 06:59:04 +00:00
matz aba4666e19 * eval.c (localjump_destination): lambda should not interfere
return from the yielded block.

* hash.c (delete_if_i): use st_delete_safe() (via
  rb_hash_delete()) instead of returning ST_DELETE.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5842 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-02-26 17:15:00 +00:00
nobu 8e8c7f04ef * enum.c (enum_find): mention about ifnone argument. [ruby-talk:90003]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-16 14:07:06 +00:00
dave d993e38f18 Add RDoc for Kernel global functions, tidy array and error
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-29 03:56:22 +00:00
dave 84f0b051de Annotate enum.c. Add pager support, and report on methods in included modules
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-18 21:08:25 +00:00
matz fc63eb3a77 * enum.c (each_with_index_i): typo.
* 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 17:43:57 +00:00
matz 7ff7bcbf9d * enum.c (inject_i): use rb_yield_values.
* 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-08-22 08:09:58 +00:00
matz 82cf98939f * eval.c (rb_yield_0): give warning for multiple values for a
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-20 06:29:23 +00:00
matz 7e35911e10 * ext/pty/pty.c (pty_finalize_syswait): join (using Thread#value)
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-05-19 15:45:46 +00:00
michal 4e13d36561 -Wall cleanups (removed unused vars, no 'code has no effect' warnings)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-16 07:38:40 +00:00
michal 9df466b287 Updated Copyrights of Matz to 2003.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-16 07:34:03 +00:00
matz a973f9698f * enum.c (enum_all): now works without block.
* enum.c (enum_any): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3344 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-15 08:07:41 +00:00
matz e2d384d628 * file.c (rb_find_file_ext): should not terminate searching with
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-22 09:14:24 +00:00
matz 5315f0d667 * array.c (rb_ary_zip): iterates over items in the receiver.
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-19 08:07:51 +00:00
matz aae36756dc * object.c (Init_Object): added Object#object_id, new name for
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-11-03 11:04:35 +00:00
matz 5e6634ce67 * parse.y (tokadd_string): ignore backslashed spaces in %w.
* 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-08-01 09:42:38 +00:00
michal 722c202b9a enum.c: Fix bug in enum_sort_by and some code indents
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-07-05 08:58:57 +00:00
matz b3ecbfaa01 * eval.c (svalue_to_avalue): v may be Qundef. This fix was
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-06-13 03:55:44 +00:00
matz 4fa0cdea78 * numeric.c (num_step): better iteration condition for float
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-05-01 09:41:50 +00:00
matz e63a990141 * re.c (rb_reg_expr_str): should treat backslash specially in
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-04-18 08:46:18 +00:00
nobu e3235029ad * enum.c (enum_find): catch a value before recycle.
* 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 01:48:56 +00:00
nobu cecb9cae01 * enum.c (enum_inject): use the first iterated element as the
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
2002-03-18 01:46:33 +00:00
matz 86c6af5873 * marshal.c (w_object): module inclusion using extend() should
also be detected.

* eval.c (rb_eval_cmd): cbase should not be NULL; it should be
  either ruby_wrapper or Object.

* enum.c (enum_each_with_index): should return self.

* process.c (proc_setpgrp): should return value for non-void function.

* process.c (proc_getpgid): should raise exception if getpgid() return -1.

* string.c (rb_str_ljust): should return a duplicated string.

* string.c (rb_str_rjust): ditto.

* string.c (rb_str_center): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-11 08:02:04 +00:00
matz 2f8d3bdc21 * array.c (rb_ary_modify): should copy the internal buffer if the
modifying buffer is shared.

* array.c (ary_make_shared): make an internal buffer of an array
  to be shared.

* array.c (rb_ary_shift): avoid sliding an internal buffer by
  using shared buffer.

* array.c (rb_ary_subseq): avoid copying the buffer.

* parse.y (gettable): should freeze __LINE__ string.

* io.c (rb_io_puts): old behavoir restored.  rationale: a) if you
  want to call to_s for arrays, you can just call print a, "\n".
  b) to_s wastes memory if array (and sum of its contents) is
  huge.  c) now any object that has to_ary is treated as an array,
  using rb_check_convert_type().

* hash.c (rb_hash_initialize): now accepts a block to calculate
  the default value. [new]

* hash.c (rb_hash_aref): call "default" method to get the value
  corrensponding to the non existing key.

* hash.c (rb_hash_default): get the default value based on the
  block given to 'new'.  Now it takes an optinal "key" argument.
  "default" became the method to get the value for non existing
  key.  Users may override "default" method to change the hash
  behavior.

* hash.c (rb_hash_set_default): clear the flag if a block is given
  to 'new'

* object.c (Init_Object): undef Data.allocate, left Data.new.

* ext/curses/curses.c (window_scrollok): use RTEST().

* ext/curses/curses.c (window_idlok): ditto.

* ext/curses/curses.c (window_keypad): ditto.

* ext/curses/curses.c (window_idlok): idlok() may return void on
  some platforms; so don't use return value.

* ext/curses/curses.c (window_scrollok): ditto for consistency.

* ext/curses/curses.c: replace FIX2INT() by typechecking NUM2INT().

* parse.y (str_extend): should not process immature #$x and
  #@x interpolation, e.g #@#@ etc.

* enum.c (enum_sort_by): sort_by does not have to be stable always.

* enum.c (enum_sort_by): call qsort directly to gain performance.

* util.c (ruby_qsort): ruby_qsort(qs6) is now native thread safe.

* error.c (rb_sys_fail): it must be a bug if it's called when
  errno == 0.

* regex.c (WC2MBC1ST): should not pass through > 0x80 number in UTF-8.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-12-10 07:18:16 +00:00
nobu ca1a9450fb * enum.c (enum_sort_by): should replace with last elements.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-12-09 13:47:54 +00:00
matz 186c8b592a * marshal.c (w_float): must distinguish -0.0 from 0.0.
* gc.c (gc_mark_all): tweak mark order for little bit better scan.

* gc.c (rb_gc_mark): ditto.

* gc.c (rb_gc): ditto.

* enum.c (sort_by_i): slight performance boost.

* gc.c (gc_mark_rest): should call gc_mark_children(), not gc_mark().

* gc.c (rb_gc_mark): may cause infinite looop.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-11-27 10:00:35 +00:00
matz 7422ccdd9e * signal.c (sighandle): should not re-register sighandler if
POSIX_SIGNAL is defined.

* eval.c (error_print): errat array may be empty.

* eval.c (rb_eval_cmd): should not upgrade safe level unless
  explicitly specified by argument newly added.

* signal.c (sig_trap): should not allow tainted trap closure.

* variable.c (rb_f_trace_var): should not allow trace_var on safe
  level higher than 3.

* variable.c (rb_f_trace_var): should not allow tainted trace
  closure.

* gc.c: do not use static stack until system stack overflows.

* eval.c (eval): should call Exception#exception instead of
  calling rb_exc_new3() directly.

* error.c (exc_exception): set "mesg" directly to the clone.  it
  might be better to set mesg via some method for flexibility.

* variable.c (cvar_override_check): should print original module
  name, if 'a' is T_ICLASS.

* parse.y (yylex): float '1_.0' should not be allowed.

* variable.c (var_getter): should care about var as Qfalse
  (ruby-bugs#PR199).

* array.c (cmpint): <=> or block for {min,max} may return bignum.

* array.c (sort_1): use rb_compint.

* array.c (sort_2): ditto.

* enum.c (min_ii): ditto.

* enum.c (min_ii): ditto.

* enum.c (max_i): ditto.

* enum.c (max_ii): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-11-13 08:19:52 +00:00
matz 1fe40b7cc5 * marshal.c (r_object): better allocation type check for
TYPE_UCLASS. usage of allocation framework is disabled for now.

* variable.c (rb_class_path): Module may have subclass.

* string.c (rb_str_update): should maintain original negative
  offset.

* string.c (rb_str_subpat_set): ditto

* string.c (rb_str_aset): ditto.

* re.c (rb_reg_nth_match): should check negative nth.

* re.c (rb_reg_nth_defined): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-10-03 07:19:19 +00:00
nobu 4ffb361630 fix typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-08-23 17:49:08 +00:00
matz 1289a7a11f * eval.c (is_defined): should not dump core for "defined?(())".
* eval.c (umethod_bind): recv can be an instance of descender of
  oklass if oklass is a Module.

* hash.c (rb_hash_equal): check identiry equality first.

* file.c (group_member): should check real gid only.

* file.c (eaccess): do not cache euid, since effective euid may be
  changed via Process.euid=().

* file.c (eaccess): return -1 unless every specified access mode
  is permitted.

* eval.c (rb_eval): while/until returns the value which is given
  to break.

* parse.y (value_expr): using while/until/class/def as an
  expression is now gives a warning, not an error.

* range.c (range_eqq): should compare strings based on magical
  increment (using String#upto), not dictionary order.

* enum.c (enum_sort_by): new method for Schewartzian transformed
  stable sort.

* variable.c (mod_av_set): detect constant overriding for built-in
  classes/modules.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-08-23 06:02:15 +00:00
matz e502549be1 * io.c (argf_seek_m): wrong calling sequence of rb_io_seek().
* parse.y (cond0): no special treatment of string literal in
  condition.

* math.c: add acos, asin, atan, conh, sinh, tanh and hypot to Math.

* configure.in: check hypot availablility.

* missing/hypot.c: public domain rewrite of hypot.

* parse.y (warn_unless_e_option): warning condition was wrong.

* parse.y (warning_unless_e_option): ditto.

* enum.c (enum_all): new method 'all?', which returns true if
  block returns true for all elements.

* enum.c (enum_any): new method 'any?', which returns true if
  block retruns true for any of elements.

* marshal.c (marshal_load): do not give warning unless explicitly
  set to verbose.

* eval.c (rb_exit): give string value "exit" to SystemExit.

* ruby.c (proc_options): -v should not print version if
  proc_options called via moreswitches().

* parse.y (stmt): while/until modifier must work for empty body.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1241 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-03-13 05:45:13 +00:00
matz 2f0faf671d * string.c (str_independent): should not clear str->orig here.
it's too early.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-01-29 05:10:42 +00:00
matz 87beea4496 * enum.c (enum_inject): new method.
* gc.c (rb_gc_call_finalizer_at_exit): clear klass member of
  terminating object.

* eval.c (rb_call): raise exception for terminated object.

* bignum.c (bigdivrem): t2 might be too big for signed long; do
  not use rb_int2big(), but rb_uint2big().

* error.c (rb_load_fail): new func to report LoadError.

* ruby.c (load_file): use rb_load_fail.

* eval.c (ruby_finalize): should enclosed by PUSH_TAG/POP_TAG.

* gc.c (rb_gc_mark): link 2 of NODE_IFUNC should not be explicitly
  marked.  it may contain non object pointer.

* re.c (reg_s_last_match): Regexp::last_match(nth) returns nth
  substring of the match  (alternative for $& and $<digit>).

* eval.c (rb_mod_define_method): wrong comparison for blocks.

* gc.c (id2ref): should handle Symbol too.

* gc.c (id2ref): should print original ptr value

* eval.c (rb_iterate): NODE_CFUNC does not protect its data
  (nd_tval), so create new node NODE_IFUNC for iteration C
  function.

* eval.c (rb_yield_0): use NODE_IFUNC.

* gc.c (rb_gc_mark): support NODE_IFUNC.

* gc.c (mem_error): prohibit recursive mem_error().
  (ruby-bugs-ja:PR#36)

* eval.c (rb_thread_fd_writable): should not switch context if
  rb_thread_critical is set.

* eval.c (rb_thread_wait_fd): ditto.

* eval.c (rb_thread_wait_for): ditto.

* eval.c (rb_thread_select): ditto.

* eval.c (rb_thread_join): join during critical section causes
  deadlock.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1090 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-01-09 07:26:21 +00:00
matz 8b1de0b1ad 2000-05-24
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-05-24 04:34:26 +00:00
matz fedf48986d 2000-05-01
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-05-01 09:42:38 +00:00
matz 7194267b3b 2000-04-10
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@661 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-04-10 05:48:43 +00:00
matz dde62bcd2e 2000-01-17
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-01-17 08:37:53 +00:00
matz de71615260 20000105
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-01-05 04:41:21 +00:00
matz c18d3740a9 991207
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1999-12-07 09:25:55 +00:00
matz ebab487fcd 19991125
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1999-11-25 09:03:08 +00:00
matz 8e48dc16e9 19991117
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1999-11-17 07:30:37 +00:00
matz 0d684beafb 19991029
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1999-10-29 09:25:48 +00:00
matz 65a5162550 1.4.0
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1999-08-13 05:45:20 +00:00
matz 210367ec88 This commit was generated by cvs2svn to compensate for changes in r372,
which included commits to RCS files with non-trunk default branches.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@373 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1999-01-20 04:59:39 +00:00
matz 7ea2ceddb8 This commit was generated by cvs2svn to compensate for changes in r11,
which included commits to RCS files with non-trunk default branches.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1998-01-16 12:19:22 +00:00
matz 3db12e8b23 Initial revision
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1998-01-16 12:13:05 +00:00