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

330 Коммитов

Автор SHA1 Сообщение Дата
k0kubun 46697c7e26 internal.h: use the same declaration as definition
range.c: cast the function type to meet the declaration

This change is for fixing build error on AppVeyor:
https://ci.appveyor.com/project/ruby/ruby/build/1.0.8177

string.c
../string.c(4330) : error C4028: formal parameter 2 different from declaration

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63198 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19 16:19:48 +00:00
mame d55452cb37 Prefer CONST_ID to static global IDs
Just refactoring.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19 15:19:00 +00:00
mame d658a8d568 range.c: Make Range#bsearch support endless ranges
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19 15:18:57 +00:00
mame db1bdecb0d Make Range#min, max, include?, cover?, and === to support endless range
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19 15:18:53 +00:00
mame 7f95eed19e Introduce endless range [Feature#12912]
Typical usages:
```
p ary[1..]          # drop the first element; identical to ary[1..-1]
(1..).each {|n|...} # iterate forever from 1; identical to 1.step{...}
```

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19 15:18:50 +00:00
mrkn 2234edf0b1 Use RB_INTEGER_TYPE_P instead of rb_obj_is_kind_of
For checking whether an object is an Integer, because a subclass of
Integer is meaningless in Ruby, RB_INTEGER_TYPE_P is better than
rb_obj_is_kind_of for speed.

* object.c (rb_to_integer): Use RB_INTEGER_TYPE_P instead of rb_obj_is_kind_of.

* object.c (rb_check_to_integer): ditto.

* range.c (range_max): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-26 07:57:15 +00:00
nobu 50a99a7679 range.c: use rb_check_funcall
* range.c (rb_range_values): use rb_check_funcall instead of
  calling rb_respond_to then rb_funcall, and allow `begin` and
  `end` to be private as well as other internal conversions.
  [ruby-core:83541] [Bug #14048]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-25 05:23:54 +00:00
nobu 0ba049256e range.c: check if exclude_end? is defined
* range.c (rb_range_values): should raise TypeError if necessary
  method is not defined, not NoMethodError, when trying to tell if
  the object is a Range and extract info.
  [ruby-core:83541] [Bug #14048]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60411 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-25 01:40:15 +00:00
watson1978 ab3a40c103 Improve performance of Range#{min,max}
range.c (range_min): use OPTIMIZED_CMP() to compare the objects instead of
    `<=>' method dispatching for Fixnum/Float/String object inside Range object.

range.c (range_max): ditto.

    Range#min -> 34 % up
    Range#max -> 44 % up

    [ruby-core:80713] [Bug #13443] [Fix GH-1585]

### Before
           Range#min      8.428M (± 1.3%) i/s -     42.141M in   5.000952s
           Range#max      8.157M (± 1.3%) i/s -     40.852M in   5.009297s

### After
           Range#min     11.269M (± 1.2%) i/s -     56.388M in   5.004611s
           Range#max     11.764M (± 1.3%) i/s -     58.856M in   5.003820s

### Test code
require 'benchmark/ips'

Benchmark.ips do |x|
  x.report "Range#min" do |i|
    i.times { (1..100).min }
  end

  x.report "Range#max" do |i|
    i.times { (1..100).max }
  end
end

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-30 02:57:33 +00:00
nobu 6c8852c1d3 range.c: remove no longer used variable
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-26 00:30:05 +00:00
eregon ead61f4ac8 no longer rescue exceptions of #<=> when initializing a Range
* range.c (range_init): no longer hide the user exception
  with a ArgumentError, just let the user exception go through.
* test/ruby/test_range.rb (test_new): add tests.
  [Feature #7688]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58476 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-25 11:42:43 +00:00
nobu 54bc0a446d range.c: check loading
* range.c (range_loader): check loading values if the data came
  from an initialized range object. [ruby-core:78067] [Bug #12915]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-11 11:52:03 +00:00
nobu 1a7aba1b47 range.c: check if range modifiable
* range.c (range_modify): frozen object cannot be modified.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-10 10:39:51 +00:00
nobu 38320caaf6 range.c: indent [ci skip]
* range.c (range_alloc): adjust indent of comments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-10 00:49:16 +00:00
hsbt 82dd08285f * range.c: Add docs for max/min behavior with exclusive range.
[fix GH-1433][ci skip] Patch by @BM5k

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-05 05:27:42 +00:00
akr 577de1e93d replace fixnum by integer in documents.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-08 04:57:49 +00:00
nobu 706534b5f5 range.c: check_step_domain
* range.c (check_step_domain): check step argument domain by <=>
  method, instead of < and >.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-25 12:33:15 +00:00
shugo 62b750bb55 * range.c (range_eqq): revert r11113 because rb_call_super() is
called in range_include() and thus r11113 doesn't work when the
  receiver Range object consists of non linear objects such as Date
  objects.
  [ruby-core:72908] [Bug #12003]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-23 11:16:09 +00:00
nobu f7fb4e00f7 range.c: infected by the receiver
* range.c (range_to_s): should be infected by the receiver.
  str2 infects by appending.  [ruby-core:71811] [Bug #11767]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-03 05:22:18 +00:00
nobu 72ff61f4a8 NameError#receiver of uninitialized constant
* error.c (name_err_mesg_to_str): quote the name if unprintable.
* object.c (check_setter_id): use rb_check_id to convert names.
* variable.c (uninitialized_constant): use NameError::message to
  keep the receiver of uninitialized constant.  [Feature #10881]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-28 06:24:12 +00:00
nobu a19830c42c range.c: call range_include directly if possible
* range.c (range_eqq): trivial optimization to jump to
  range_include directly if the method is not redefined.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51585 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-15 02:30:56 +00:00
nobu 80e0ef3a81 range.c: move String specific code
* range.c (range_include): call rb_str_include_range_p on String.

* string.c (str_upto_each): extract from rb_str_upto.

* string.c (rb_str_include_range_p): move String specific code
  from Range#include? in range.c.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-15 12:39:56 +00:00
nobu 04c10b8af3 range.c: r_less
* range.c (r_less): merge r_le() and r_lt() and make code shorter
  with less branches.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-15 09:06:18 +00:00
nobu bad0560661 range.c: r_cover_p
* range.c (r_cover_p): extract from range_cover and share with
  range_include.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-15 09:05:57 +00:00
nobu b0616346f8 range.c: covered for linear objects
* range.c (linear_object_p, range_include): test if covered for
  linear objects.  [ruby-core:69052] [Bug #11113]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-03 01:02:15 +00:00
nobu 0238f47fa7 range.c: predefined IDs
* range.c (id_cmp, id_succ): use predefined IDs in id.def.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-01 22:39:14 +00:00
nobu 523ecd29b8 use frozen string of symbols
* range.c (range_step, range_each): String#upto should never
  modifies the receiver, use frozen strings to enumerate symbols.

* re.c (reg_operand): matching target is not modified.

* ext/socket/constants.c (constant_arg): str_to_int never modifies
  argument strings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-14 03:31:28 +00:00
nobu 16294913f7 use rb_funcallv
* use rb_funcallv() for no arguments call instead of variadic
  rb_funcall().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-16 04:08:52 +00:00
nobu b13432890f range.c: trivial optimizations
* range.c (range_bsearch): trivial optimizations, for Fixnum, and
  by keeping the last satisfied element.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49230 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-13 03:51:35 +00:00
nobu 6b8b66b401 range.c: class name encoding
* range.c (range_bsearch): preserve encoding of class name in an
  exception message.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-13 03:47:55 +00:00
nobu 225e3b011f range.c: reduce argument evaluations
* range.c (BSEARCH_CHECK): get rid of conversion of the argument
  multiple times.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49227 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-13 03:47:41 +00:00
akr 7cd76ab0c5 * internal.h: Include ruby.h and ruby/encoding.h to be
includable without prior inclusion.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15 11:49:06 +00:00
nobu 4a91fb7a45 range.c: unused function
* range.c (SET_EXCL): remove no longer used function.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45331 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-14 01:27:46 +00:00
nobu fc23374f06 [DOC] add links to `Object#hash`
add links to `Object#hash` to each #`hash` methods rdocs.
[Fixes GH-567]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-14 01:27:43 +00:00
marcandre d4cf669da7 Range#bsearch: fix typo in rdoc
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44960 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-15 00:39:25 +00:00
akr f526784e1e * enum.c: Enumerable#{min,min_by,max,max_by} extended to take an
optional argument.
  (nmin_cmp): New function.
  (nmin_block_cmp): Ditto
  (nmin_filter): Ditto.
  (nmin_i): Ditto.
  (nmin_run): Ditto.
  (enum_min): Call nmin_run if the optional argument is given.
  (nmin_max): Ditto.
  (nmin_min_by): Ditto.
  (nmin_max_by): Ditto.

* range.c: Range#{min,max} extended to take an optional argument.
  (range_min): Call range_first if the optional argument is given.
  (range_max): Call rb_call_super if the optional argument is given.

[ruby-core:57111] [Feature #8887]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-14 15:45:11 +00:00
eregon d31cd06516 * range.c (Range#size): [DOC] improve description and add examples.
Patch by @skade. [Fixes GH-501]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-09 21:23:45 +00:00
nobu 6f2efe84fb hash.c: detect recursion for all
* hash.c (rb_hash): detect recursion for all `hash' methods.  each
  `hash' methods no longer need to use rb_exec_recursive().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-03 13:18:30 +00:00
nobu 4ce307aeee range.c: revert the old behavior
* range.c (range_each): revert the old behavior, no block is given to
  the yielded block.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-30 04:21:22 +00:00
nobu 92b4a05e07 vm_eval.c: rb_yield_block
* vm_eval.c (rb_yield_block): yield block with rb_block_call_func
  arguments.
* range.c (range_each): use rb_yield_block.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-29 08:06:19 +00:00
nobu 7566c49068 ruby/ruby.h: RB_BLOCK_CALL_FUNC_ARGLIST
* include/ruby/ruby.h (RB_BLOCK_CALL_FUNC_ARGLIST): for declaration
  argument list of rb_block_call_func.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-29 07:59:14 +00:00
nobu 32145ebfd6 array.c, enum.c, range.c: rb_block_call_func compatible
* array.c (take_i), range.c (first_i): make rb_block_call_func
  compatible.

* enum.c (collect_all, DEFINE_ENUMFUNCS): add blockarg.

* enum.c ({min,max,minmax,chunk,slicebefore}_ii): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-29 07:45:00 +00:00
nobu 9f45081627 ruby/ruby.h: add blockarg to rb_block_call_func
* include/ruby/ruby.h (rb_block_call_func): add blockarg.  block
  function can take block argument, e.g., proc {|&blockarg| ...}.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-29 02:26:48 +00:00
nobu 94f01c55df should not ignore the rest of recursive constructs
* array.c (rb_ary_hash): should not ignore the rest of recursive
  constructs.
* hash.c (rb_hash_hash): ditto.
* range.c (range_hash): ditto.
* struct.c (rb_struct_hash): ditto.
* test/-ext-/test_recursion.rb (TestRecursion): separate from
  test/ruby/test_thread.rb.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-26 17:20:16 +00:00
nobu 64f2b9f990 range.c: modify check
* range.c (range_initialize_copy): disallow to modify after
  initialized.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43433 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-26 10:08:02 +00:00
nobu a2231670d6 range.c: fix int and VALUE
* range.c (SET_EXCL): set boolean always.

* range.c (range_init): fix int flag and boolean VALUE.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-25 06:57:20 +00:00
nobu a6d095bd22 range.c: setter macros
* range.c (RANGE_SET_{BEG,END,EXCL}): add setter macros which wrap
  RSTRUCT_SET() and index.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43419 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-25 05:18:26 +00:00
nobu 0be97c7015 range.c: revert r42400
* range.c (range_last): revert r42400.  [Bug #8739]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-08 01:27:19 +00:00
nobu 9deecfc453 range.c: return nil for empty range
* range.c (range_last): return nil for empty range, or in the case the
  predecessor is smaller than the begin.  [Bug #8739]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-06 12:59:59 +00:00
nobu 2743b0d608 range.c: consider exclusive
* range.c (range_last): exclude the last number of the exclusive range
  if the end is Numeric.  [ruby-dev:47587] [Bug #8739]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42400 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-06 08:42:51 +00:00
nobu 5e2f227d21 intern.h: define rb_enumerator_size_func
* include/ruby/intern.h (rb_enumerator_size_func): define strict
  function declaration for rb_enumeratorize_with_size().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-26 13:43:22 +00:00
ko1 6a1101f23e * include/ruby/ruby.h: support write barrier protection for T_STRUCT.
Introduce the following C APIs:
  * RSTRUCT_RAWPTR(st) returns pointer (do WB on your risk).
    The type of returned pointer is (const VALUE *).
  * RSTRUCT_GET(st, idx) returns idx-th value of struct.
  * RSTRUCT_SET(st, idx, v) set idx-th value by v with WB.
  And
  * RSTRUCT_PTR(st) returns pointer with shady operation.
    The type of returned pointer is (VALUE *).
* struct.c, re.c, gc.c, marshal.c: rewrite with above APIs.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21 11:22:18 +00:00
zzak eb5f361937 * range.c: Fix rdoc on Range#bsearch [Bug #8242] [ruby-core:54143]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-02 03:05:26 +00:00
ktsj edb98f8b91 fix typos. Patch by k_takata.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-19 03:10:21 +00:00
ko1 4f401816ff * gc.c: support RGENGC. [ruby-trunk - Feature #8339]
See this ticet about RGENGC.
* gc.c: Add several flags:
* RGENGC_DEBUG: if >0, then prints debug information.
* RGENGC_CHECK_MODE: if >0, add assertions.
* RGENGC_PROFILE: if >0, add profiling features.
  check GC.stat and GC::Profiler.
* include/ruby/ruby.h: disable RGENGC by default (USE_RGENGC == 0).
* array.c: add write barriers for T_ARRAY and generate sunny objects.
* include/ruby/ruby.h (RARRAY_PTR_USE): added. Use this macro if
  you want to access raw pointers. If you modify the contents which
  pointer pointed, then you need to care write barrier.
* bignum.c, marshal.c, random.c: generate T_BIGNUM sunny objects.
* complex.c, include/ruby/ruby.h: add write barriers for T_COMPLEX
  and generate sunny objects.
* rational.c (nurat_s_new_internal), include/ruby/ruby.h: add write
  barriers for T_RATIONAL and generate sunny objects.
* internal.h: add write barriers for RBasic::klass.
* numeric.c (rb_float_new_in_heap): generate sunny T_FLOAT objects.
* object.c (rb_class_allocate_instance), range.c:
  generate sunny T_OBJECT objects.
* string.c: add write barriers for T_STRING and generate sunny objects.
* variable.c: add write barriers for ivars.
* vm_insnhelper.c (vm_setivar): ditto.
* include/ruby/ruby.h, debug.c: use two flags
  FL_WB_PROTECTED and FL_OLDGEN.
* node.h (NODE_FL_CREF_PUSHED_BY_EVAL, NODE_FL_CREF_OMOD_SHARED):
  move flag bits.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 18:07:47 +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
nobu 2d1c94a18d prefix global symbols
* iseq.c (rb_insn_operand_intern): prefix global symbols.

* numeric.c (ruby_num_interval_step_size): ditto.

* vm_backtrace.c (rb_vm_backtrace_str_ary),
  (rb_vm_backtrace_location_ary, rb_vm_thread_backtrace),
  (rb_vm_thread_backtrace_locations): ditto.

* vm_trace.c (rb_vm_trace_mark_event_hooks): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-06 06:30:03 +00:00
marcandre e29e4b55ab * range.c: Use div instead of / for bsearch
* test/ruby/test_range.rb: Test showing bug when requiring mathn

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-05 03:51:09 +00:00
nobu e449d06f15 ChangeLog, range.c: adjust indent and style
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-30 06:20:26 +00:00
marcandre 69adf990e1 * array.c (rb_ary_bsearch): Fix r38986 (typo) [Bug #7726]
* range.c (range_bsearch): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-30 06:07:29 +00:00
marcandre a7938af19c * array.c (rb_ary_bsearch): Fix r38986 (missing whitespace)
* range.c (range_bsearch): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38987 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-30 06:01:40 +00:00
marcandre 20c0fb69d6 * array.c (rb_ary_bsearch): Raise TypeError on bad return from block
* range.c (range_bsearch): ditto

* test/ruby/test_array.rb (class): Test for above

* test/ruby/test_range.rb (class): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-30 06:00:24 +00:00
marcandre 00d6bb5108 * range.c: Restrict bsearch to integers [#7728]
* test/ruby/test_range.rb: Test for above

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-30 05:46:48 +00:00
marcandre 39048aca75 * array.c (rb_ary_bsearch): Return enumerator if no block [#7725]
* range.c (range_bsearch): ditto

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

* test/ruby/test_range.rb: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-30 05:11:03 +00:00
marcandre 115a51f8ec * range.c: Fix Range#bsearch for floats [Bug #7724]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38978 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-29 22:00:36 +00:00
nobu e878df745c use RB_TYPE_P
* enumerator.c (enumerator_initialize), eval.c (rb_using_refinement),
  (add_activated_refinement), numeric.c (num_interval_step_size),
  parse.y (arg, match_op_gen, cond0), range.c (range_bsearch),
  vm_insnhelper.c (vm_get_iclass): use RB_TYPE_P() to optimize.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-29 12:22:01 +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 ecaba0f21f remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29 02:58:31 +00:00
marcandre 165da0da2f * range.c (rb_range_beg_len): Fix potential bug for limit case [#6203]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-21 04:23:56 +00:00
mame 4c37c520e2 * array.c (rb_ary_bsearch): fix rdoc bug (O(n log n) -> O(log n)).
Patch by Charlie Somerville.  [ruby-core:49661] [Bug #7409]

* range.c (range_bsearch): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-20 11:13:45 +00:00
nobu c9b6a01435 range.c: compare signedness only
* range.c (BSEARCH_CHECK): compare signedness only and relax an
  assumption of the result of rb_cmpint() which compilers cannot know.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-16 07:28:30 +00:00
mame 412b023742 * range.c (range_bsearch): fix some bugs: a documentation bug, a wrong
condition, missed break in switch/case, and workaround for GCC
  optimization. See [ruby-core:49364] in detail.  A great patch from
  Heesob Park. [Bug #7352] [Feature #4766]

* array.c (rb_ary_bsearch): fix similar bug (missed break).

* test/ruby/test_range.rb: add two test cases for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-15 13:50:55 +00:00
mame de07850e47 * array.c (rb_ary_bsearch): add Array#bsearch for binary search.
[ruby-core:36390] [Feature #4766]

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

* range.c (range_bsearch): add Range#bsearch for binary search.
  [ruby-core:36390] [Feature #4766]

* test/ruby/test_range.rb: add a test for above

* NEWS: added the two new methods.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-14 15:53:50 +00:00
marcandre faed90d814 * range.c: Support for range.step.size
[Feature #6636]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06 17:15:00 +00:00
marcandre 28d8bf902d * range.c: Support for Range#size and Range#each.size
[Feature #6636]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37516 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06 17:14:46 +00:00
nari c3a46d6aca * include/ruby/ruby.h: add C APIs.
VALUE rb_newobj_of(VALUE klass, VALUE flags)
  #define NEWOBJ_OF(obj,type,klass,flags)
  These allow to change a allocation strategy depending on klass
  or flags.

* gc.c: ditto

* array.c: use new C API.
* bignum.c: ditto
* class.c: ditto
* complex.c: ditto
* ext/socket/ancdata.c: ditto
* ext/socket/option.c: ditto
* hash.c: ditto
* io.c: ditto
* marshal.c: ditto
* numeric.c: ditto
* object.c: ditto
* random.c: ditto
* range.c: ditto
* rational.c: ditto
* re.c: ditto
* string.c: ditto
* struct.c: ditto
  [Feature #7177][Feature #7047]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-20 06:57:51 +00:00
tadf cb5217088b trivial changes
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-03 03:29:01 +00:00
drbrain 79bc357902 * range.c: Improve documentation for Range. Patch by Chris Zetter.
[Ruby 1.9 - Bug #5656]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-05 23:36:53 +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
tarui d22e08f937 * range.c (range_max): fix behavior with excluded end value.
[Bug #4591]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-10 00:47:31 +00:00
akr 5ed8c08aa0 * eval.c, hash.c, load.c, proc.c, range.c, thread.c, time.c: don't
declare internal functions.

* internal.h, vm_core.h: declare internal functions.

* array.c: include internal.h.

* common.mk: update dependency for array.o.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-18 08:26:19 +00:00
akr afd7e4668f * internal.h: declare more internal functions.
* iseq.h (rb_method_get_iseq): declared.

* compile.c, eval.c, eval_error.c, iseq.c, parse.y, proc.c, range.c,
  ruby.c, time.c, util.c, vm.c: don't declare internal functions.

* eval.c, parse.y, thread_pthread.c: non-existing function declarations
  removed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-18 01:54:57 +00:00
akr e7996eb3cc * internal.h: declare internal functions here.
* node.h: declare NODE dependent internal functions here.

* iseq.h: declare rb_iseq_t dependent internal functions here.

* vm_core.h: declare rb_thread_t dependent internal functions here.

* bignum.c, class.c, compile.c, complex.c, cont.c, dir.c, encoding.c,
  enumerator.c, error.c, eval.c, file.c, gc.c, hash.c, inits.c, io.c,
  iseq.c, load.c, marshal.c, math.c, numeric.c, object.c, parse.y,
  proc.c, process.c, range.c, rational.c, re.c, ruby.c, string.c,
  thread.c, time.c, transcode.c, variable.c, vm.c,
  tool/compile_prelude.rb: don't declare internal functions declared
  in above headers.  include above headers if required.

  Note that rb_thread_mark() was declared as
  void rb_thread_mark(rb_thread_t *th) in cont.c but defined as
  void rb_thread_mark(void *ptr) in vm.c.  Now it is declared as
  the later in internal.h.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-17 22:43:38 +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
nobu e66470a106 * range.c (discrete_object_p): needs the argument type to get rid
of truncation on platforms where VALUE is larger than int.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-02 15:31:05 +00:00
matz 9b192302ec * time.c (rb_time_succ): make Time#succ obsolete since time is not
a discrete value.

* range.c (discrete_object_p): treat time objects specially to
  determine discrete values, since time objects have #succ yet are
  discrete (for now at least).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-30 08:32:43 +00:00
nobu 5a993c5d22 * range.c: fixed type.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-23 03:39:44 +00:00
marcandre 0ebfc1348b * struct.c (rb_struct_equal, rb_struct_eql): Handle comparison of recursive structures [ruby-core:24759]
* range.c (range_eq, range_eql):  ditto for ranges

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-20 02:14:02 +00:00
marcandre 1796522f10 * thread.c (rb_exec_recursive_outer, rb_exec_recursive): Added method to short-circuit to the outermost level in case of recursion
* test/ruby/test_thread.rb (test_recursive_outer): Test for above

* hash.c (rb_hash_hash): Return a sensible hash for in case of recursion [ruby-core:24648]

* range.c (rb_range_hash): ditto

* struct.c (rb_struct_hash): ditto

* array.c (rb_array_hash): ditto

* test/ruby/test_array.rb (test_hash2): test for above

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-15 21:30:50 +00:00
nobu 31b7ae00c0 * include/ruby/st.h (st_hash_func): use st_index_t.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-08 13:10:04 +00:00
matz 95e77269a9 * range.c (range_step): treat symbols specially so that iterating
over symbols should work like strings.  [ruby-core:24780]

* range.c (range_each): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-17 17:00:47 +00:00
matz 554786aedc * range.c (range_each): should honor to_str conversion.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-17 16:41:00 +00:00
matz da19797648 * range.c (range_eql, range_eq): fixed equality to work for
subclasses of Range.  a patch from Marc-Andre Lafortune.
   [ruby-core:22190]

* test/ruby/test_range.rb: add assertions for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24405 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-05 05:01:12 +00:00
akr bc2df41365 * range.c (recursive_hash): extracted from range_hash. reject
recursive key.
  (range_hash): use recursive_hash.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-17 09:28:46 +00:00
nobu 5e65d8f433 * bignum.c (rb_big_new, rb_bigzero_p), range.c (rb_range_values):
added for random.c.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-16 06:52:29 +00:00
matz a5e227edfe * hash.c (rb_hash_hash): documentation fix. a patch from
Marc-Andre Lafortune.  [ruby-core:23943]

* object.c (rb_mod_cmp): ditto.

* range.c (range_eq): ditto.

* string.c (rb_str_partition, rb_str_rpartition): ditto.

* struct.c (rb_struct_s_def): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-01 21:20:44 +00:00
nobu 94ecf211e5 * range.c (r_le): fixed types.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-07 05:01:56 +00:00
nobu 61d0d8babb * range.c (range_eql): fixed rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-07 04:58:54 +00:00
matz e69f212933 * range.c (range_each): check #succ only when it is really
needed.  small performance improvement.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22574 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-23 15:46:02 +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
mame e722ad99d5 * string.c (rb_hash_uint32, rb_hash_uint, rb_hash_start, rb_hash_end),
include/ruby/intern.h: add Murmurhash API.  [ruby-dev:37784]

* complex.c (nucomp_hash), array.c (rb_ary_hash), time.c (time_hash),
  string.c (rb_str_hsah), object.c (rb_obj_hash), range.c
  (range_hash), struct.c (rb_struct_hash), hash.c (rb_any_hash),
  rational.c (nurat_hash): use Murmurhash.  [ruby-dev:37784]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-14 19:55:34 +00:00
matz f3844ccf44 * range.c (range_step): should not add up errors on loops.
[ruby-dev:37691]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-04 23:20:39 +00:00
matz 61394a1b55 * range.c (range_max): max value from ... not defined for non
Integer Numeric end values. [ruby-dev:37690] fix: #974

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-04 22:32:40 +00:00
nobu 367de8b97b * numeric.c (ruby_float_step): extracted from num_step().
* range.c (range_step): uses ruby_float_step() for float range.
  [ruby-dev:37691]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-04 02:58:45 +00:00
yugui d5c6b265b9 * range.c (rb_range_beg_len): rb_raise takes C values as arguments.
[BUG] ranges turned into other value in a message of RangeError.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-03 04:10:17 +00:00
mame ec0c394b9e * range.c (range_inspect): fix SEGV for cyclic range object.
[ruby-core:18835]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-25 15:42:23 +00:00
nobu e1ebab4ed0 * range.c (range_initialize_copy): Range is now a Struct.
[ruby-core:18353]

* struct.c (rb_struct_init_copy): made public.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-20 21:02:54 +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
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
matz f099a94afa * range.c (range_step): call to_int if step is not a numeric
value.  [ruby-dev:34575]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-02 08:31:04 +00:00
matz 7f31465bb5 * range.c (range_step): do not forcefully convert steps into
integers.  [ruby-dev:34571]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-02 07:15:28 +00:00
matz 494f6fcfcf * range.c (range_step): step may be bignum.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-02 05:22:17 +00:00
nobu 7b2c68fd32 * range.c (range_step): check if step can be converted to an integer.
[ruby-dev:34558]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16256 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-01 14:43:24 +00:00
nobu 0a32f9a43f * range.c (range_step): allow float step bigger than zero but less
than one.  [ruby-dev:34557]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-01 14:35:13 +00:00
matz cb2bfadd2d * range.c (range_each): use INT2FIX() for fixnum values.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-28 09:35:09 +00:00
nobu 4653fedd0c * range.c (range_each_func): should not leave a variable
uninitialized, which could cause SEGV.

* range.c (range_step): removed duplicated and unreachable code.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-07 03:15:26 +00:00
matz bdc00ba604 * bignum.c (rb_cmpint): moved from compar.c, to check bignum
zero.

* range.c (range_step): add step for each iteration if begin and
  end are numeric.  [ruby-core:15990]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-06 17:11:50 +00:00
matz b916c39db4 * range.c (range_include): add RDoc to describe that comparison
for numeric is done according magnitude of values.
  [ruby-core:15907]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15895 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-03 11:57:23 +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
nobu 9c0be2d516 * range.c (rb_range_beg_len): check if responds to "begin" and "end"
methods for non-Range object.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-15 15:21:51 +00:00
matz 0472db84c5 * range.c (range_include): specialize single character string
case (e.g. (?a ..?z).include(?x)) for performance.
  [ruby-core:15481]

* string.c (rb_str_upto): specialize single character case.

* string.c (rb_str_hash): omit coderange scan for performance.

* object.c (rb_check_to_integer): check Fixnum first.

* object.c (rb_to_integer): ditto.

* string.c (rb_str_equal): inline memcmp to avoid unnecessary
  rb_str_comparable(). 

* parse.y (rb_intern2): use US-ASCII encoding.

* parse.y (rb_intern_str): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15433 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-11 17:46:52 +00:00
mame 45ef2e8ef2 * range.c: fix SEGV by ("a" .. "z").step(2 ** 30) { }.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-29 13:27:51 +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
nobu e8ffe28214 * range.c (step_i, range_step): support non-fixnum steps.
[ruby-talk:282100]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-05 06:15:23 +00:00
matz 2bbffcd6a4 * insns.def (concatarray, splatarray): use to_a instead of
to_splat.

* insnhelper.ci (caller_setup_args): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-01 05:20:06 +00:00
akr 0d89567252 * struct.c (rb_struct_alloc_noinit): new function.
(rb_struct_define_without_accessor): add allocator to the arguments.

* range.c (range_alloc): re-introduced using rb_struct_alloc_noinit.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-23 07:00:50 +00:00
akr 0dbdad7599 * struct.c (rb_struct_define_without_accessor): new function.
* range.c (range_alloc): removed.
  (Init_Range): use rb_struct_define_without_accessor.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-23 04:35:53 +00:00
nobu 5725135274 * range.c (range_last): commit miss.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-19 01:57:49 +00:00
matz 53d8c99d8b * range.c (Init_Range): typo fixed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-18 08:14:21 +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
akr 068d11ef96 * range.c (range_dumper): make uninitialized range dumpable.
(range_loader): make uninitialized range loadable.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-10 06:50:22 +00:00
akr 4261abb230 * range.c: represent initialized state using EXCL instead of FL_USER3.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-10 06:25:40 +00:00
matz 3ee33a6dbc * range.c (range_step): fixed integer overflow. [ruby-dev:31763]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13422 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-09 16:11:28 +00:00
akr 2a37152f3f * eval_method.ci (rb_get_alloc_func): new function to get allocation
function.

* include/ruby/intern.h (rb_alloc_func_t): declared.
  (rb_define_alloc_func): declared.
  (rb_marshal_define_compat): declared.

* range.c: use T_STRUCT for Range.

* inits.c: move Init_marshal() prior to Init_Range() because
  Init_Range calls rb_marshal_define_compat which needs
  marshal's compat_allocator_tbl initialized.

* marshal.c: support marshal format compatibility layer designed for
  marshaling T_STRUCT Range using T_OBJECT format.
  (rb_marshal_define_compat): defined.

[ruby-dev:31710]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-08 15:07:18 +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 6d9a4f510c * range.c (range_eqq): call_super() in === does not work well
since Enumerable#=== has different behavior.  [ruby-dev:31296]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-26 13:37:13 +00:00
nobu 113a709cce * range.c (range_max, range_min): return nil for empty set as well as
1.8 and Enumerable.  [ruby-dev:31198]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-13 02:33:11 +00:00
akr c13cd729bf * range.c (range_max): use FIX2LONG instead of FIX2INT to avoid
RangeError by ((-0x80000001)...(-0x80000001)).max on LP64.

* insns.def (opt_plus): use FIX2LONG instead of FIX2INT to avoid
  RangeError by 0x3fffffffffffffff+1 on LP64.

* insns.def (opt_succ): don't use 0x80000000 which assumes 32bit VALUE.
  use FIX2LONG instead of FIX2INT.
  [ruby-dev:31190]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-12 09:52:48 +00:00
matz 115410ecde * string.c (rb_str_upto): add optional argument to specify
exclusiveness.

* range.c (range_step): use String#upto with optional argument.

* range.c (range_each): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-22 16:23:16 +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
nobu 205f310c29 * call_cfunc.ci, compile.c, compile.h, debug.h, eval.c,
eval_error.h, eval_jump.h, eval_load.c, eval_thread.c, gc.c,
  insnhelper.h, insns.def, iseq.c, main.c, numeric.c, parse.y,
  range.c, regenc.h, ruby.h, signal.c, thread.c, thread_win32.ci,
  vm.c, vm.h, vm_dump.c, vm_evalbody.ci, yarvcore.c, yarvcore.h:
  fixed indents and non-C90 comments.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-02 16:26:04 +00:00
ko1 a3e1b1ce7e * Merge YARV
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-12-31 15:02:22 +00:00
matz 9317700a5d * eval.c (splat_value): use "to_splat" instead of "to_ary" to
prepare splat values as an array.

* array.c (Init_Array): define to_splat.

* range.c (range_to_splat): new method.

* enumerator.c (enumerator_to_splat): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-10-02 17:39:57 +00:00
matz 0d15c66aaf * range.c (range_include): should always call Enumerable#include?
(not #===) for non numeric end points.  [ruby-core:08477]
  [ruby-core:08496]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-08-03 06:21:03 +00:00
matz 9b383bd6cf * sprintf.c (rb_str_format): allow %c to print one character
string (e.g. ?x).

* lib/tempfile.rb (Tempfile::make_tmpname): put dot between
  basename and pid.  [ruby-talk:196272]
* parse.y (do_block): remove -> style block.

* parse.y (parser_yylex): remove tLAMBDA_ARG.

* eval.c (rb_call0): binding for the return event hook should have
  consistent scope.  [ruby-core:07928]

* eval.c (proc_invoke): return behavior should depend whether it
  is surrounded by a lambda or a mere block.

* eval.c (formal_assign): handles post splat arguments.

* eval.c (rb_call0): ditto.

* st.c (strhash): use FNV-1a hash.

* parse.y (parser_yylex): removed experimental ';;' terminator.

* eval.c (rb_node_arity): should be aware of post splat arguments.

* eval.c (rb_proc_arity): ditto.

* parse.y (f_args): syntax rule enhanced to support arguments
  after the splat.

* parse.y (block_param): ditto for block parameters.

* parse.y (f_post_arg): mandatory formal arguments after the splat
  argument.

* parse.y (new_args_gen): generate nodes for mandatory formal
  arguments after the splat argument.

* eval.c (rb_eval): dispatch mandatory formal arguments after the
  splat argument.

* parse.y (args): allow more than one splat in the argument list.

* parse.y (method_call): allow aref [] to accept all kind of
  method argument, including assocs, splat, and block argument.

* eval.c (SETUP_ARGS0): prepare block argument as well.

* lib/mathn.rb (Integer): remove Integer#gcd2. [ruby-core:07931]

* eval.c (error_line): print receivers true/false/nil specially.

* eval.c (rb_proc_yield): handles parameters in yield semantics.

* eval.c (nil_yield): gives LocalJumpError to denote no block
  error.

* io.c (rb_io_getc): now takes one-character string.

* string.c (rb_str_hash): use FNV-1a hash from Fowler/Noll/Vo
  hashing algorithm.

* string.c (rb_str_aref): str[0] now returns 1 character string,
  instead of a fixnum.	[Ruby2]

* parse.y (parser_yylex): ?c now returns 1 character string,
  instead of a fixnum.	[Ruby2]

* string.c (rb_str_aset): no longer support fixnum insertion.

* eval.c (umethod_bind): should not update original class.
  [ruby-dev:28636]

* eval.c (ev_const_get): should support constant access from
  within instance_eval().  [ruby-dev:28327]

* time.c (time_timeval): should round for usec floating
  number.  [ruby-core:07896]

* time.c (time_add): ditto.

* dir.c (sys_warning): should not call a vararg function
  rb_sys_warning() indirectly.	[ruby-core:07886]

* numeric.c (flo_divmod): the first element of Float#divmod should
  be an integer. [ruby-dev:28589]

* test/ruby/test_float.rb: add tests for divmod, div, modulo and remainder.

* re.c (rb_reg_initialize): should not allow modifying literal
  regexps.  frozen check moved from rb_reg_initialize_m as well.

* re.c (rb_reg_initialize): should not modify untainted objects in
  safe levels higher than 3.

* re.c (rb_memcmp): type change from char* to const void*.

* dir.c (dir_close): should not close untainted dir stream.

* dir.c (GetDIR): add tainted/frozen check for each dir operation.

* lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_symbol_arg):
  typo fixed.  a patch from Florian Gross <florg at florg.net>.

* eval.c (EXEC_EVENT_HOOK): trace_func may remove itself from
  event_hooks.	no guarantee for arbitrary hook deletion.
  [ruby-dev:28632]

* util.c (ruby_strtod): differ addition to minimize error.
  [ruby-dev:28619]

* util.c (ruby_strtod): should not raise ERANGE when the input
  string does not have any digits.  [ruby-dev:28629]

* eval.c (proc_invoke): should restore old ruby_frame->block.
  thanks to ts <decoux at moulon.inra.fr>.  [ruby-core:07833]
  also fix [ruby-dev:28614] as well.

* signal.c (trap): sig should be less then NSIG.  Coverity found
  this bug.  a patch from Kevin Tew <tewk at tewk.com>.
  [ruby-core:07823]

* math.c (math_log2): add new method inspired by
  [ruby-talk:191237].

* math.c (math_log): add optional base argument to Math::log().
  [ruby-talk:191308]

* ext/syck/emitter.c (syck_scan_scalar): avoid accessing
  uninitialized array element.	a patch from Pat Eyler
  <rubypate at gmail.com>.  [ruby-core:07809]

* array.c (rb_ary_fill): initialize local variables first.  a
  patch from Pat Eyler <rubypate at gmail.com>.	 [ruby-core:07810]

* ext/syck/yaml2byte.c (syck_yaml2byte_handler): need to free
  type_tag.  a patch from Pat Eyler <rubypate at gmail.com>.
  [ruby-core:07808]

* ext/socket/socket.c (make_hostent_internal): accept ai_family
  check from Sam Roberts <sroberts at uniserve.com>.
  [ruby-core:07691]

* util.c (ruby_strtod): should not cut off 18 digits for no
  reason.  [ruby-core:07796]

* array.c (rb_ary_fill): internalize local variable "beg" to
  pacify Coverity.  [ruby-core:07770]

* pack.c (pack_unpack): now supports CRLF newlines.  a patch from
  <tommy at tmtm.org>.	[ruby-dev:28601]

* applied code clean-up patch from Stefan Huehner
  <stefan at huehner.org>.  [ruby-core:07764]

* lib/jcode.rb (String::tr_s): should have translated non
  squeezing character sequence (i.e. a character) as well.  thanks
  to Hiroshi Ichikawa <gimite at gimite.ddo.jp> [ruby-list:42090]

* ext/socket/socket.c: document update patch from Sam Roberts
  <sroberts at uniserve.com>.  [ruby-core:07701]

* lib/mathn.rb (Integer): need not to remove gcd2.  a patch from
  NARUSE, Yui <naruse at airemix.com>.	[ruby-dev:28570]

* parse.y (arg): too much NEW_LIST()

* eval.c (SETUP_ARGS0): remove unnecessary access to nd_alen.

* eval.c (rb_eval): use ARGSCAT for NODE_OP_ASGN1.
  [ruby-dev:28585]

* parse.y (arg): use NODE_ARGSCAT for placeholder.

* lib/getoptlong.rb (GetoptLong::get): RDoc update patch from
  mathew <meta at pobox.com>.  [ruby-core:07738]

* variable.c (rb_const_set): raise error when no target klass is
  supplied.  [ruby-dev:28582]

* prec.c (prec_prec_f): documentation patch from
  <gerardo.santana at gmail.com>.  [ruby-core:07689]

* bignum.c (rb_big_pow): second operand may be too big even if
  it's a Fixnum.  [ruby-talk:187984]

* README.EXT: update symbol description.  [ruby-talk:188104]

* COPYING: explicitly note GPLv2.  [ruby-talk:187922]

* parse.y: remove some obsolete syntax rules (unparenthesized
  method calls in argument list).

* eval.c (rb_call0): insecure calling should be checked for non
  NODE_SCOPE method invocations too.

* eval.c (rb_alias): should preserve the current safe level as
  well as method definition.

* process.c (rb_f_sleep): remove RDoc description about SIGALRM
  which is not valid on the current implementation. [ruby-dev:28464]

 Thu Mar 23 21:40:47 2006  K.Kosako  <sndgk393 AT ybb.ne.jp>

* eval.c (method_missing): should support argument splat in
  super.  a bug in combination of super, splat and
  method_missing.  [ruby-talk:185438]

* configure.in: Solaris SunPro compiler -rapth patch from
  <kuwa at labs.fujitsu.com>.  [ruby-dev:28443]

* configure.in: remove enable_rpath=no for Solaris.
  [ruby-dev:28440]

* ext/win32ole/win32ole.c (ole_val2olevariantdata): change behavior
  of converting  OLE Variant object with VT_ARRAY|VT_UI1 and Ruby
  String object.

* ruby.1: a clarification patch from David Lutterkort
  <dlutter at redhat.com>.  [ruby-core:7508]

* lib/rdoc/ri/ri_paths.rb (RI::Paths): adding paths from rubygems
  directories.	a patch from Eric Hodel <drbrain at segment7.net>.
  [ruby-core:07423]

* eval.c (rb_clear_cache_by_class): clearing wrong cache.

* ext/extmk.rb: use :remove_destination to install extension libraries
  to avoid SEGV.  [ruby-dev:28417]

* eval.c (rb_thread_fd_writable): should not re-schedule output
  from KILLED thread (must be error printing).

* array.c (rb_ary_flatten_bang): allow specifying recursion
  level.  [ruby-talk:182170]

* array.c (rb_ary_flatten): ditto.

* gc.c (add_heap): a heap_slots may overflow.  a patch from Stefan
  Weil <weil at mail.berlios.de>.

* eval.c (rb_call): use separate cache for fcall/vcall
  invocation.

* eval.c (rb_eval): NODE_FCALL, NODE_VCALL can call local
  functions.

* eval.c (rb_mod_local): a new method to specify newly added
  visibility "local".

* eval.c (search_method): search for local methods which are
  visible only from the current class.

* class.c (rb_class_local_methods): a method to list local methods.

* object.c (Init_Object): add BasicObject class as a top level
  BlankSlate class.

* ruby.h (SYM2ID): should not cast to signed long.
  [ruby-core:07414]

* class.c (rb_include_module): allow module duplication.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-06-09 21:20:17 +00:00
matz 81be039884 * range.c (range_cover): new method Range#cover? added. the
method name might be changed.  thanks to takano32 at
  http://www.rubyist.net/~matz/20051210.html#c08 for name
  suggestion.  [ruby-talk:167182]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-12-12 01:01:29 +00:00
akr ed75a38f76 remove unused variable `tmp'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-12-09 15:29:03 +00:00
nobu c4c90eca34 * range.c (range_include): return false unless included in numeric
range.  fixed: [ruby-dev:27975]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-12-09 14:17:09 +00:00
matz da32ce1a67 * sprintf.c (rb_f_sprintf): [ruby-dev:27967]
* range.c (range_include): use discrete membership for non Numeric
  values, for example, String.

* numeric.c (num_scalar_p): new method. [ruby-dev:27936]

* lib/complex.rb (Complex#scalar?): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-12-07 08:41:59 +00:00