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

379 Коммитов

Автор SHA1 Сообщение Дата
usa 6cca1f4c6a * numeric.c (SQRT_LONG_MAX): use SIZEOF_LONG instead of SIZEOF_VALUE
because SIZEOF_VALUE > SIZEOF_LONG on some platforms.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-30 22:15:07 +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
nobu 09ce106ab3 * bignum.c (rb_big_lshift, rb_big_rshift): separated functions
to get rid of infinite recursion.  fixed calculation in edge
  cases.  [ruby-dev:31244]

* numeric.c (rb_fix_lshift, rb_fix_rshift): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12814 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-19 05:38:48 +00:00
matz 7f0bb427e0 * numeric.c (fix_pow): integer power calculation: 0**n => 0,
1**n => 1, -1**n => 1 (n: even) / -1 (n: odd).

* test/ruby/test_fixnum.rb (TestFixnum::test_pow): update test
  suite.  pow(-3, 2^64) gives NaN when pow(3, 2^64) gives Inf.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-14 14:31:21 +00:00
matz b13b3e624b * numeric.c (int_pow): overflow detection using FIT_SQRT_LONG().
[ruby-dev:31215]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-13 17:29:24 +00:00
matz 3e6f0e6a20 * numeric.c (int_round): should not return false, but self.
[ruby-dev:31212]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-13 15:38:48 +00:00
ko1 6b6bf4dd48 * blockinlining.c: remove "yarv" prefix.
* array.c, numeric.c: ditto.
* insnhelper.ci, insns.def, vm_evalbody.ci: ditto.
* yarvcore.c: removed.
* yarvcore.h: renamed to core.h.
* cont.c, debug.c, error.c, process.c, signal.c : ditto.
* ext/probeprofiler/probeprofiler.c: ditto.
* id.c, id.h: added.
* inits.c: ditto.
* compile.c: rename internal functions.
* compile.h: fix debug flag.
* eval.c, object.c, vm.c: remove ruby_top_self.
  use rb_vm_top_self() instead.
* eval_intern.h, eval_load: ditto.
* gc.c: rename yarv_machine_stack_mark() to
  rb_gc_mark_machine_stack().
* insnhelper.h: remove unused macros.
* iseq.c: add iseq_compile() to create iseq object
  from source string.
* proc.c: rename a internal function.
* template/insns.inc.tmpl: remove YARV prefix.
* thread.c:
* vm.c (rb_iseq_eval): added.
* vm.c: move some functions from yarvcore.c.
* vm_dump.c: fix to remove compiler warning.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-12 04:25:46 +00:00
usa a0d50fa3c4 * numeric.c (int_pow): fix previous nubu's commit.
* test/ruby/test_fixnum.rb: new test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-05 07:38:41 +00:00
nobu b553a34c63 * numeric.c (int_pow): even number multiplication never be negative.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-05 06:56:10 +00:00
nobu 3b5eac1a08 * numeric.c (fix_pow): get rid of division by zero. reported by
Yusuke ENDOH <mame AT tsg.ne.jp> [ruby-dev:31040]

* numeric.c (int_round): do nothing when rounding by zeroth digit.
  check underflow.  [ruby-dev:31043]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12661 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-29 06:44:01 +00:00
nobu f359740661 * numeric.c: fix indent.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12660 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-29 06:43:24 +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 931614a341 * numeric.c (int_round): should not just truncate.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-05 05:31:05 +00:00
nobu 99d65b14b4 * compile.c, dir.c, eval.c, eval_jump.h, eval_method.h, numeric.c,
pack.c, parse.y, re.c, thread.c, vm.c, vm_dump.c, call_cfunc.ci,
  thread_pthread.ci, thread_win32.ci: fixed indentation.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-05 04:25:10 +00:00
matz 2c4aff3fe0 * numeric.c (int_round): small optimization to handle bignums.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12423 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-01 16:27:05 +00:00
nobu b8cb3679bb * numeric.c (num_round): should convert self to Float.
[ruby-dev:30860]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-01 02:32:17 +00:00
matz 609ebfe51f * numeric.c (flo_round): now takes optional argument to specify
number of digits, like round() in Python/PHP.

* numeric.c (num_round): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-31 17:01:15 +00:00
nobu ea758d28c3 * numeric.c: purged trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-09 04:11:41 +00:00
nobu 7de7d5ddeb * bignum.c (Init_Bignum), numeric.c (Init_Numeric): added fdiv as
aliases of quo.  [ruby-dev:30771]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12263 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-09 03:28:08 +00:00
nobu ea2cb282ae * numeric.c (int_pow): bugfix of overflow detection.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-04-27 08:05:21 +00:00
nobu 5d2069cd56 * numeric.c (int_pow): rb_big_pow() may return other than Bignum.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12227 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-04-27 03:53:43 +00:00
nobu 93bdc98f33 * bignum.c (rb_big_pow): reduce multiplying for even number.
* numeric.c (int_pow): calculate power in Fixnum as possible.
  [ruby-dev:30726]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12223 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-04-26 08:30:10 +00:00
knu 4563573a6b * numeric.c (fix_equal): A bit more optimization.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-21 13:30:17 +00:00
matz f67795869d * numeric.c (fix_equal): remove FIX2LONG() to optimize. suggested
in http://t-a-w.blogspot.com/2007/02/making-ruby-faster.html.
  [ruby-talk:240223]

* numeric.c (fix_cmp): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11807 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-21 08:53: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
matz 8418ea8bb8 * numeric.c (int_pred): add Integer#pred corresponding
Integer#succ.  [RCR#5]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-01-30 04:27: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 51281b961b * bignum.c (rb_big_hash): use rb_memhash().
* numeric.c (flo_hash): simplified.  klass need not to affect
  resulting hash value.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-21 22:52:38 +00:00
nobu ae7ea70a3a * numeric.c (Init_Numeric): fix_odd_p and fix_even_p are for Fixnum.
patch from Ondrej Bilka <neleai at seznam.cz>.  [ruby-core:08904]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-21 15:36:17 +00:00
matz 255702be8c * numeric.c (int_odd_p): a new method to check even or odd.
[RCR#337]

* numeric.c (int_even_p): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-21 06:09:26 +00:00
nobu 4e259f9094 * numeric.c (fix_mul): typo again. patch from Tadashi Saito
<shiba at mail2.accsnet.ne.jp>.  fixed: [ruby-core:08893]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-20 13:41:55 +00:00
nobu 3851ac03b5 * numeric.c (fix_mul): get rid of shift overflow.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-18 03:17:06 +00:00
nobu cd5cfab0e7 * numeric.c (fix_mul): fixed typo. fixed: [ruby-core:08885]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-17 01:42:28 +00:00
matz 49f0e92f28 * numeric.c (fix_mul): avoid bignum multiplication as far as
possible.  a patch from Ondrej Bilka <neleai at seznam.cz>.
  [ruby-core:08825]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-14 08:23:28 +00:00
matz 5f61a22950 * numeric.c (fix_plus): addition in Fixnum will never overflow
long.  a patch from Ondrej Bilka <neleai at seznam.cz>.
  [ruby-core:08794]

* numeric.c (fix_minus): ditto.

* bignum.c (rb_big_pow): eagerly truncate resulting bignum.
  [ruby-core:08794]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-04 20:10:45 +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
matz 54af80844f * ruby.h (struct RString): embed small strings.
(RSTRING_LEN): defined for accessing string members.
  (RSTRING_PTR): ditto.

* string.c: use RSTRING_LEN and RSTRING_PTR.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-08-31 10:47:44 +00:00
nobu 59b1cef2f1 * numeric.c (flo_hash): improve collision.
* string.c (rb_memhash): new generic function to calculate hash value
  for memory chunk.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-08-30 03:02:35 +00:00
nobu a35efc05ad * numeric.c (num_step): also return an enumerator object if no block
is given.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10753 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-08-20 02:47:13 +00:00
matz 1db0db3ba0 * bignum.c (rb_int2big): use SIGNED_VALUE. [ruby-dev:29019]
* bignum.c (rb_int2inum, rb_uint2inum): use VALUE sized integer.

* bignum.c (rb_big2long, rb_big2ulong): ditto.

* numeric.c (rb_num2long, rb_num2ulong): ditto.

* numeric.c (check_int, check_uint): ditto.

* bignum.c (rb_quad_pack): typo fixed.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-07-11 06:47:09 +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
ocean 08cb01f073 * numeric.c (fix_to_s): removed workaround for radix 2. Historically,
rb_fix2str can only handle radix 8, 10, 16. (Rev1.37) But for now,
  it can handle radix 2..36. [ruby-Bugs#3438]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-02-05 12:09:31 +00:00
ocean 4c9c7a82ac * numeric.c (fix_to_s): (2**32).to_s(2) fails with exception where
sizeof(int) == 4 < sizeof(long). [ruby-core:7300]

  I think the function name of rb_int2big is quite misleading.
  This should be "rb_long2big".


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9882 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-02-04 06:58:43 +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
akr f59bd226b3 * configure.in: define IA64 for portability. (HP aC++/ANSI C doesn't
define __ia64__.)
  don't check libunwind stuff.
  check __libc_ia64_register_backing_store_base.

* defines.h: declare rb_ia64_bsp and rb_ia64_flushrs.
  (flush_register_windows): call rb_ia64_flushrs on IA64.

* ia64.s: new file for IA64.
  it is separated from C program files because
  Intel C++ Compiler for IA64 doesn't support inline assembly.

* common.mk (ia64.$(OBJEXT)): new target.

* ruby.h (RUBY_INIT_STACK): defined.
  (ruby_init_stack): declared for RUBY_INIT_STACK.

* main.c (main): precedes RUBY_INIT_STACK before ruby_init.

* gc.c (rb_gc_register_stack_start): new global variable on IA64.
  (garbage_collect): simplify register stack marking code.
  don't use libunwind.
  (Init_stack): initialize rb_gc_register_stack_start.
  (ruby_init_stack): new function for RUBY_INIT_STACK.

* eval.c (struct thread): add bstr_pos member for original position of
  register stack.
  (rb_thread_save_context): simplify register stack saving code.
  don't use libunwind.
  (rb_thread_restore_context_0): new function.  moved from
  rb_thread_restore_context except the stack position checking code.
  don't use libunwind for IA64 register stack.
  (register_stack_extend): new function.
  (stack_extend): make it self-recursive with
  the stack position checking code in old rb_thread_restore_context.
  (rb_thread_restore_context): just call stack_extend.
  (flush_register_windows): removed.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-12-27 05:40:04 +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
matz 4f85b9edfb * numeric.c (num_div): use floor rather than rb_Integer().
[ruby-dev:27674]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-11-23 14:54:43 +00:00
matz 9974cb96d3 * eval.c (rb_call_super): should call method_missing if super is
called from Kernel method.

* eval.c (exec_under): frame during eval should preserve external
  information.

* configure.in: use proper option for Sun linker. A patch from
  Shinya Kuwamura <kuwa@labs.fujitsu.com>.  [ruby-dev:27603]

* numeric.c (fix_rshift): RDoc fix.  [ruby-core:6351]

* util.h (strtod): add #undef for platforms defines strtod()
  macro.   [ruby-dev:27563]

* ext/etc/etc.c: document update from mathew <meta@pobox.com>.
  [ruby-core:06473]

* ext/fcntl/fcntl.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-11-01 13:04:35 +00:00
matz 22f1926644 * range.c (rb_range_beg_len): should return Qfalse for non-range
object.

* pack.c (EXTEND16): [ruby-dev:27383]

* eval.c (set_trace_func): add rb_secure(4) to prevent adding
  tracing function.

* lib/delegate.rb: document update from James Edward Gray II
  <james@grayproductions.net>.  [ruby-core:05942]

* process.c (proc_daemon): should restrict execution on levels
  higher than $SAFE=2.  suggested by URABE Shyouhei
  <shyouhei@ice.uec.ac.jp>.

* lib/forwardable.rb: replaced by new implementation from
  <Daniel.Berger@qwest.com>.  [ruby-core:05899]

* file.c (path_check_0): disallow sticky world writable directory
  in PATH (and $LOAD_PATH).  [ruby-dev:27226]

* numeric.c (fix_idiv): 1.div(1.0) should return integer value.
  [ruby-dev:27235]

* lib/yaml.rb: require 'yaml/constants'.  [ruby-core:5776]

* lib/xmlrpc/client.rb (XMLRPC::Client::do_rpc): add charset
  information to content-type header.[ruby-core:5127]

* lib/xmlrpc/server.rb (CGIServer::serve): ditto.

* lib/xmlrpc/server.rb (ModRubyServer::serve): ditto.

* lib/xmlrpc/server.rb (WEBrickServlet::service): ditto.

* test/dbm/test_dbm.rb (TestDBM::test_s_open_error): remove
  test_s_open_error test to detect duplicate open.
  [ruby-dev:27202]

* eval.c (splat_value): use to_a to splat non Array object.

* object.c (nil_to_a): remove nil.to_a.  [experimental]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-10-05 16:15:16 +00:00
matz 7559d2fd7a * io.c (io_close): call rb_io_close() directly if io is a T_FILE
object.  [ruby-dev:27156]

* file.c (file_expand_path): allow pathnames to expand.
  [ruby-dev:27152]

* numeric.c (Init_Numeric): should define Fixnum#div.
  [ruby-dev:27129]

* file.c (rb_thread_flock): wrap flock(2) by TRAP_BEG and
  TRAP_END.  [ruby-dev:27122]

* file.c (rb_file_join): call FilePathValue() to all Pathnames to
  join.  [ruby-dev:27127]

* file.c (rb_get_path): call StringValueCStr() to ensure no nul
  bytes in path strings.

* gc.c (garbage_collect): need value for return.  [ruby-dev:27127]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-19 16:01:06 +00:00
ocean 08c1738c51 * bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
  gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
  node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
  rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
  util.c, util.h, variable.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 06:32:32 +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 e439bc27dc * parse.y (f_larglist): allow optional arguments even when
parentheses are omitted.  based on Nobu's patch from
  http://www.rubyist.net/~nobu/t/20050805.html

* parse.y (parser_yylex): update & maintain lpar_beg for detect
  lambda parameters.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-08-12 08:13:28 +00:00
matz 4fd5436b32 * numeric.c (Init_Numeric): do not share implementation among
Fixnum#/ and Fixnum#div.  [ruby-core:05531]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-08-04 11:29:51 +00:00
matz 53b4c2b87a * numeric.c (fix_div): should not convert the result into
integer.  [ruby-core:05524]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-08-04 04:31:33 +00:00
matz c32b77cee1 * numeric.c (fix_minus, fix_mul, fix_quo, fix_div, fix_mod,
fix_divmod, fix_pow): ditto.

* numeric.c (fix_plus): reduce coercing when a method knows about
  a operand type.  [ruby-dev:26723]

* bignum.c (rb_big_div, rb_big_modulo): export to reduce
  coercing.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-08-03 07:09:48 +00:00
matz f65273b419 * bignum.c (rb_big_eq): reduce isnan(). [ruby-dev:26600]
* numeric.c (flo_eq, flo_gt, flo_ge, flo_lt, flo_le): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-07-25 07:08:14 +00:00
matz d3a0ec7636 * numeric.c (fix_pow): support Fixnum ** Float case directly
without coercing.  [ruby-talk:142697] [ruby-talk:143054]

* ruby.c (require_libraries): caused SEGV when continuation jumped
  in to the required library code.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8516 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-05-24 15:24:23 +00:00
matz ce3eb0b204 * eval.c (rb_attr): attribute name check added.
* numeric.c (flo_plus): small typo fix.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-04-18 06:38:30 +00:00
matz 70bbad3cfd * array.c: replace rb_protect_inspect() and rb_inspecting_p() by
rb_exec_recursive() in eval.c.

* eval.c (rb_exec_recursive): new function.

* array.c (rb_ary_join): use rb_exec_recursive().

* array.c (rb_ary_inspect, rb_ary_hash): ditto.

* file.c (rb_file_join): ditto.

* hash.c (rb_hash_inspect, rb_hash_to_s, rb_hash_hash): ditto.

* io.c (rb_io_puts): ditto.

* object.c (rb_obj_inspect): ditto

* struct.c (rb_struct_inspect): ditto.

* lib/set.rb (SortedSet::setup): a hack to shut up warning.
  [ruby-talk:132866]

* lib/time.rb (Time::strptime): add new function.  inspired by
  [ruby-talk:132815].

* lib/parsedate.rb (ParseDate::strptime): ditto.

* regparse.c: move st_*_strend() functions from st.c.  fixed some
  potential memory leaks.

* exception error messages updated.  [ruby-core:04497]

* ext/socket/socket.c (Init_socket): add bunch of Socket
  constants.  Patch from Sam Roberts <sroberts@uniserve.com>.
  [ruby-core:04409]

* array.c (rb_ary_s_create): no need for negative argc check.
  [ruby-core:04463]

* array.c (rb_ary_unshift_m): ditto.

* lib/xmlrpc/parser.rb (XMLRPC::FaultException): make it subclass
  of StandardError class, not Exception class.  [ruby-core:04429]

* parse.y (fcall_gen): lvar(arg) will be evaluated as
  lvar.call(arg) when lvar is a defined local variable. [new]

* object.c (rb_class_initialize): call inherited method before
  calling initializing block.

* eval.c (rb_thread_start_1): initialize newly pushed frame.

* lib/open3.rb (Open3::popen3): $? should not be EXIT_FAILURE.
  fixed: [ruby-core:04444]

* eval.c (is_defined): NODE_IASGN is an assignment.

* ext/readline/readline.c (Readline.readline): use rl_outstream
  and rl_instream.  [ruby-dev:25699]

* ext/etc/etc.c (Init_etc): sGroup needs HAVE_ST_GR_PASSWD check
  [ruby-dev:25675]

* misc/ruby-mode.el: [ruby-core:04415]

* lib/rdoc/generators/html_generator.rb: [ruby-core:04412]

* lib/rdoc/generators/ri_generator.rb: ditto.

* struct.c (make_struct): fixed: [ruby-core:04402]

* ext/curses/curses.c (window_color_set): [ruby-core:04393]

* ext/socket/socket.c (Init_socket): SO_REUSEPORT added.
  [ruby-talk:130092]

* object.c: [ruby-doc:818]

* parse.y (open_args): fix too verbose warnings for the space
  before argument parentheses.  [ruby-dev:25492]

* parse.y (parser_yylex): ditto.

* parse.y (parser_yylex): the first expression in the parentheses
  should not be a command.  [ruby-dev:25492]

* lib/irb/context.rb (IRB::Context::initialize): [ruby-core:04330]

* object.c (Init_Object): remove Object#type.  [ruby-core:04335]

* st.c (st_foreach): report success/failure by return value.
  [ruby-Bugs-1396]

* parse.y: forgot to initialize parser struct.  [ruby-dev:25492]

* parse.y (parser_yylex): no tLABEL on EXPR_BEG.
  [ruby-talk:127711]

* document updates - [ruby-core:04296], [ruby-core:04301],
  [ruby-core:04302], [ruby-core:04307]

* dir.c (rb_push_glob): should work for NUL delimited patterns.

* dir.c (rb_glob2): should aware of offset in the pattern.

* string.c (rb_str_new4): should propagate taintedness.

* env.h: rename member names in struct FRAME; last_func -> callee,
  orig_func -> this_func, last_class -> this_class.

* struct.c (rb_struct_set): use original method name, not callee
  name, to retrieve member slot.  [ruby-core:04268]

* time.c (time_strftime): protect from format modification from GC
  finalizers.

* object.c (Init_Object): remove rb_obj_id_obsolete()

* eval.c (rb_mod_define_method): incomplete subclass check.
  [ruby-dev:25464]

* gc.c (rb_data_object_alloc): klass may be NULL.
  [ruby-list:40498]

* bignum.c (rb_big_rand): should return positive random number.
  [ruby-dev:25401]

* bignum.c (rb_big_rand): do not use rb_big_modulo to generate
  random bignums.  [ruby-dev:25396]

* variable.c (rb_autoload): [ruby-dev:25373]

* eval.c (svalue_to_avalue): [ruby-dev:25366]

* string.c (rb_str_justify): [ruby-dev:25367]

* io.c (rb_f_select): [ruby-dev:25312]

* ext/socket/socket.c (sock_s_getservbyport): [ruby-talk:124072]

* struct.c (make_struct): [ruby-dev:25249]

* dir.c (dir_open_dir): new function.  [ruby-dev:25242]

* io.c (rb_f_open): add type check for return value from to_open.

* lib/pstore.rb (PStore#transaction): Use the empty content when a
  file is not found.  [ruby-dev:24561]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-03-04 06:47:45 +00:00
ocean ff57fbf2a6 * numeric.c (Init_Numeric): turn off floating point exceptions
on bcc32. "1e300".to_f had crashed by overflow.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-01-11 00:46:35 +00:00
matz 288ceaeec2 * re.c (rb_reg_initialize_m): should raise exception instead of
compile error.  [ruby-core:03755]

* string.c (rb_str_splice): move rb_str_modify() after
  StringValue(), which may alter the receiver.  [ruby-dev:24878]

* error.c (rb_error_frozen): now raise RuntimeError instead of
  TypeError.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-17 02:27:38 +00:00
matz 02f848f9a4 * numeric.c (flo_divmod): protect float values from GC by
assignment to local variables.  [ruby-dev:24873]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7289 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-16 14:51:38 +00:00
matz 018837b84f * node.h (NODE_TYPESHIFT): allow 4 more bits for line numbers.
[ruby-talk:117841]

* ruby.h (FL_ABLE): nodes are not subject for flag operations.

* io.c (ARGF_FORWARD): should have specified argv explicitly,
  since we no longer have frame->argv saved.  [ruby-dev:24602]

* string.c (RESIZE_CAPA): check string attribute before modifying
  capacity member of string structure.  [ruby-dev:24594]

* ext/zlib/zlib.c (gzreader_gets): use memchr() to to gain
  performance.  [ruby-talk:117701]

* sprintf.c (rb_f_sprintf): raise ArgumentError for extra
  arguments, unless (digit)$ style used.

* io.c (rb_io_fptr_finalize): leave stdin/stdout/stderr open in
  interpreter termination.  [ruby-dev:24579]

* eval.c (frame_free): Guy Decoux solved the leak problem.
  Thanks.  [ruby-core:03549]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-27 09:29:26 +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
matz 9d1f9bd56b * eval.c (rb_mod_freeze): prepare string representation before
freezing. [ruby-talk:103646]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-06-16 14:21:34 +00:00
matz 4f127ee34b * io.c (rb_io_gets_m): set lastline ($_) even when read line is
nil.  [ruby-dev:23663]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-06-04 09:56:25 +00:00
matz a6a8847190 * numeric.c (flo_eq): alway check if operands are NaN.
[ruby-list:39685]

* lib/cgi/session.rb: use LOCK_SH to read, and a few other
  improvements.  [ruby-core:02328]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-05-20 04:34:14 +00:00
ocean a655b0d8e1 * numeric.c (flo_to_s): p 0.0 should be '0.0' not '0.0e+00'.
* numeric.c (flo_to_s): the number of significand is correctly handled,
  there is assumption that DBL_DIG == 15 though.
  (p 0.00000000000000000001 was '9.999999999999999e-21', now is
  '1.0e-20')


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-05-17 07:14:45 +00:00
matz ae3241dcfe * eval.c (eval): warning during eval should not cause deadlock.
[ruby-talk:98651]

* eval.c (rb_eval): raise TypeError exception for superclass
  mismatch.  [ruby-dev:39567]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-05-10 08:23:13 +00:00
matz 1b0f90ca33 * parse.y (string_content): turn off NODE_NEWLINE flag to avoid
unnecessary line trace for inlined expression.
  (ruby-bugs PR#1320)

* numeric.c (flo_to_s): tweak output string based to preserve
  decimal point and to remove trailing zeros.  [ruby-talk:97891]

* string.c (rb_str_index_m): use unsigned comparison for T_FIXNUM
  search.  [ruby-talk:97342]

* hash.c (rb_hash_equal): returns true if two hashes have same set
  of key-value set.  [ruby-talk:97559]

* hash.c (rb_hash_eql): returns true if two hashes are equal and
  have same default values.

* string.c (rb_str_equal): always returns true or false, never
  returns nil. [ruby-dev:23404]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-05-07 08:44:24 +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
eban b88dfa10b5 * numeric.c (flo_eq): workaround for bcc32's bug.
(ruby-bugs-ja:PR#594)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-04-14 02:32:15 +00:00
matz c0ab40c785 * eval.c (top_include): include in the wrapped load is done for
the wrapper, not for a singleton class for wrapped main.
  [ruby-dev:23305]

* bignum.c (rb_big_eq): use temporary double variable to save the
  result (internal float register may be bigger than 64 bits, for
  example, 80 bits on x86).  [ruby-dev:23311]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-04-02 08:35:32 +00:00
nobu a7b1a2eced * class.c, error.c, file.c, io.c, numeric.c, object.c, re.c, struct.c,
time.c: marked init_copy functions nodoc.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-18 14:16:47 +00:00
dave 791f868395 Add RDoc comments
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-27 05:46:46 +00:00
dave a3ecd5c83d RDoc comments for Fixnum, Float, and Hash. Add heuristic to RDoc to handle yaml/stringio
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-23 16:21:17 +00:00
nobu 748b699d1b * configure.in (ac_cv_func_setitimer): moved from defines.h
* defines.h, rubysig.h, signal.c: removed macro handling which
  should be done in configure.

* configure.in (intrinsics.h): check if present.

* ruby.h: include intrinsics.h if available.

* bignum.c, marshal.c: include ieeefp.h if available.

* missing.h (isinf): define as a macro if finite() and isnan()
  are available.  [ruby-core:02032]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-22 08:23:55 +00:00
matz e91e9e7bbf * eval.c (rb_with_disable_interrupt): prohibit thread context
switch during proc execution.  [ruby-dev:21899]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-20 15:45:15 +00:00
nobu faab8f264d * configure.in (ieeefp.h), numeric.c: needed for finite() on
Solaris.  [ruby-core:01921]

* file.c (rb_stat_inspect): adjust format specifier.

* parse.c (arg_prepend): nodetype() is for debug use.

* ruby.h (ISASCII, etc): cast to int to get rid of warning.

* ruby.h (alloca.h): include even in GCC.  [ruby-core:01925]

* ext/bigdecimal/bigdecimal.c (GetVpValue): adjust format
  specifier.

* ext/bigdecimal/bigdecimal.c (BigDecimal_prec, BigDecimal_coerce,
  BigDecimal_divmod): use rb_assoc_new() to suppress memory usage.

* ext/bigdecimal/bigdecimal.c (BigDecimal_split): ditto.

* ext/dl/sym.c (rb_dlsym_guardcall): guard itself should be
  volatile.

* ext/iconv/iconv.c (iconv_convert): ensure actual parameter with
  format specifier.

* ext/pty/pty.c (MasterDevice, SlaveDevice, deviceNo): do not
  define unless used.

* ext/pty/pty.c (getDevice): get rid of warning.

* ext/socket/socket.c (port_str, sock_s_getaddrinfo,
  sock_s_getnameinfo): FIX2INT() now returns long.

* ext/socket/socket.c (init_inetsock_internal): uninitialized
  variable.

* ext/syck/rubyext.c (syck_parser_assign_io): add prototype.

* ext/syck/rubyext.c (rb_syck_mktime, yaml_org_handler): use
  ISDIGIT() instead of isdigit() to avoid warnings and for
  platforms which don't support non-ascii charater.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-11 02:39:59 +00:00
matz ac761cda20 * numeric.c (num_sadded): prohibit singleton method definition for
Numerics.  fill yet another gap between Fixnum and Bignum.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-01 13:16:09 +00:00
matz b0acbc4c9a * pack.c (htov16): converts endian using swap16. htov32(), hton16,
hton32 as well. [ruby-talk:85377]

* pack.c (swap16): swap 2 bytes no matter how big short is on the
  platform.  swap32() is also prepared.

* numeric.c (rb_num2int): returns long to preserve information.
  rb_fix2int(), rb_num2uint(), rb_fix2uint() as well.
  [ruby-talk:85377]

* numeric.c (rb_num2uint): should not check for value range if the
  source value is negative.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5075 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-01 08:42:53 +00:00
matz 11f521b98e * variable.c (rb_const_get_0): should check constants defined in
included modules, if klass is Object. [ruby-talk:79302]

* numeric.c (check_uint): check should be done using UINT_MAX, not
  INT_MAX. this fix is submitted by <lyle@knology.net> in
  [ruby-core:01486]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4454 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-28 08:35:43 +00:00
matz 4aaa5493f9 * eval.c (method_proc): should specify YIELD_FUNC_SVALUE.
[ruby-dev:21107]

* marshal.c (w_object): should not call w_extended for USRMARSHAL
  dump. [ruby-dev:21106]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-04 05:28:50 +00:00
matz 2c225e77e0 * numeric.c (flo_to_s): get rid of buffer overflow.
* io.c (appendline): clearerr(3) before raising exception, since
  exception may be captured by rescue. [ruby-talk:77794]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-02 18:05:02 +00:00
matz 5b9afca5e4 * numeric.c (rb_num_coerce_relop): export function.
* marshal.c (w_object): check has been dropped. "_dump must return
  string." [ruby-dev:21024]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-31 08:42:44 +00:00
matz 85911c410a * ext/socket/socket.c (tcp_s_gethostbyname): was using
uninitialized size_t value. [ruby-talk:76946]

* Minor cleanups.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-25 05:36:55 +00:00
matz c26663f24b * numeric.c (num_equal): should not use rb_equal().
* object.c (rb_equal): back out the last change.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-21 18:48:58 +00:00
eban ae6fd90c18 * numeric.c (rb_fix2uint): renamed from rb_fix2int on IA64.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-06-16 09:10:17 +00:00
nobu 045eb9773e * numeric.c (rb_num2uint, rb_fix2int): new function to convert
values over INT_MAX.  [ruby-core:01099]

* ruby.h (NUM2UINT, FIX2INT): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3885 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-30 13:28:10 +00:00
matz 6e52d10fe6 * object.c (init_copy): rename copy_object as initialize_copy,
since it works as copy constructor.

* eval.c (rb_add_method): initialize_copy should always be
  private, like initialize.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3820 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-19 05:41:08 +00:00
matz 13230a3417 * gc.c (rb_gc): check odd alignment stack on m68k machines.
* numeric.c (num_step): better error treatment of float values.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-08 09:45:52 +00:00
nobu 698a24674e * compar.c (rb_cmperr): raise comparison failure.
* intern.h: prototype; rb_cmperr

* numeric.c (flo_gt, flo_ge, flo_lt, flo_le, fix_gt, fix_ge,
  fix_lt, fix_le): should fail unless the argument is comparable.
  (ruby-bugs-ja:PR#456)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-08 03:56:12 +00:00
nobu 89c25a3dd6 * numeric.c (int_upto, int_downto): should fail unless the
argument is comparable.  (ruby-bugs-ja:PR#454)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-07 23:56:11 +00:00
matz e49203726e * numeric.c (num_step): remove epsilon; add margin of 0.5, to make
"1.1.step(1.5,0.1)" to work (third try).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-06 16:48:51 +00:00
matz 7752fb4205 * object.c (rb_obj_methods): list singleton methods if recur
argument is false;  list all methods otherwise.

* numeric.c (num_step): double epsilon to make "1.1.step(1.5,0.1)"
  to work.

* ext/gdbm/gdbm.c (fgdbm_values_at): new method to replace
select(index..).

* ext/sdbm/init.c (fsdbm_values_at): ditto.

* ext/dbm/dbm.c (fdbm_values_at): ditto.

* ext/dbm/dbm.c (DBM::VERSION): defined.

* ext/gdbm/testgdbm.rb: replace select with values_at.

* ext/sdbm/testsdbm.rb: ditto.

* ext/dbm/testdbm.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-06 06:51:31 +00:00
matz f595d5b0d2 * array.c (rb_ary_values_at): new method to replace select(index..).
* hash.c (rb_hash_values_at,env_values_at): ditto.

* re.c (match_values_at): ditto.

* struct.c (rb_struct_values_at): ditto.

* re.c (match_select): add iterator behavior.
	* ext/curses/curses.c, ext/digest/sha2/sha2.c, ext/iconv/iconv.c,
	  ext/racc/cparse/cparse.c: include "ruby.h" at the top to shut up
	  "_FILE_OFFSET_BITS redefined" warning on Solaris.

* class.c (rb_class_protected_instance_methods): now gives
  warnings to show migration path.  The default will be reversed
  on Jan 2004.

* numeric.c (num_step): "1.1.step(1.5,0.1)" to work.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-04 16:03:24 +00:00
nobu 71e0bb92d1 * numeric.c (flo_is_finite_p): use finite() if available.
* win32/win32.h (isinf, isnan): define as macro.
  [ruby-win32:00533]

* bcc32/Makefile.sub, win32/Makefile.sub: no longer use
  missing/isinf.c, missing/isnan.c.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-04-21 12:26:08 +00:00
nobu fae5cc75fa * numeric.c (rb_fix2str): buffer was insufficient.
(ruby-bugs-ja:PR#431)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3681 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-04-15 07:05:15 +00:00
matz f34f20ebc5 * rubyio.h (struct OpenFile): add error raise flag to finalizer.
* io.c (Init_IO): define $/, $-0, and $\ as string-only
  variables.

* string.c (rb_str_split_m): does not generate empty string if
  there's no match in the receiver.

* io.c (fptr_finalize): should raise error on EBADF for readable
  IOs as well.

* file.c (rb_stat): use rb_check_convert_type() to retrieve IO.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-04-14 09:04:43 +00:00
nobu 3f4472433d * bignum.c (rb_cstr_to_inum, rb_big2str): allow 2-36 as radix.
* numeric.c (rb_fix2str): ditto.

* string.c (rb_str_to_i): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-04-14 06:54:27 +00:00
nobu 76d7e7d54c * numeric.c (coerce_rescue): prevent inspected String from GC.
* numeric.c (flo_eq, rb_dbl_cmp, flo_gt, flo_ge, flo_lt, flo_le,
  flo_eql): correct NaN comparison.  (ruby-bugs:PR#744)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-04-11 06:37:48 +00:00
matz c94187bce0 * eval.c (rb_f_missing): use "inspect" for T_OBJECT as well.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-04-03 05:25:00 +00:00
matz 0b39cf78fe * numeric.c (flo_to_s): change format specifier to "%.15g" to
avoid unnecessary 9s (e.g. 99.59999999999999). (ruby-bugs-ja PR#406)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-03-20 07:15:29 +00:00
matz 72dfee9a96 * array.c (rb_ary_aref): give warning if index is a symbol.
[ruby-list:37217]

* array.c (rb_ary_aset): raise TypeError if index is a symbol.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-03-04 09:31:02 +00:00
matz e5c5576aeb * string.c (str_new): need no MEMZERO().
* numeric.c (fix_gt): use rb_num_coerce_cmp() instead of
  rb_num_coerce_bin.

* numeric.c (fix_ge, fix_lt, fix_le): ditto.

* numeric.c (flo_gt, flo_ge, flo_lt, flo_le): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-02-27 08:04:32 +00:00
matz 467035750e * object.c (Init_Object): default Object#=== now calls "=="
internally.

* re.c (rb_reg_initialize_m): should honor option status of
  original regexp.

* array.c (rb_ary_equal): ary2 should be T_ARRAY (no to_ary
  conversion).

* array.c (rb_ary_eql): ditto.

* string.c (rb_str_equal): str2 should be T_STRING (no to_str
  conversion).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-02-03 08:45:26 +00:00
matz 74d5623029 * variable.c (rb_obj_classname): new function.
* string.c (rb_str_dup): should preserve original's class (but not
  hidden singleton class).

* string.c (rb_str_substr): ditto.

* parse.y: backout EXPR_CMDARG removal.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-31 04:00:17 +00:00
matz a9ec8adff3 * lib/rational.rb: modified to support "quo".
* numeric.c (num_quo): should return most exact quotient value,
  i.e. float by default, rational if available.

* numeric.c (num_div): "div" should return x.divmod(x)[0].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-23 06:22:50 +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 17065d47a6 * range.c (range_each): treat fixnums specially to boost.
* numeric.c (num_step): remove rb_scan_args() for small speedup.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-08 06:05:08 +00:00
usa 96737482af * numeric.c (DBL_MAX_10_EXP): fix typo. [ruby-dev:36826]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-24 10:20:29 +00:00
matz ee9d5d41d1 021224
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-24 08:53:56 +00:00
matz bc49bc7c6b * parse.y (do_block): split "do" block and tLBRACE_ARG block.
* parse.y (cmd_brace_block): new tLBRACE_ARG block rule

* parse.y (command): can take optional cmd_brace_block; use %prec
  to resolve shift/reduce conflict. (ruby-bugs-ja PR#372)

* eval.c (ruby_finalize): trace_func should be cleared here (after
  executing exit procs and finalizers).

* eval.c (rb_define_alloc_func): new allocation framework, based
  on Nobu's work [ruby-dev:19116].  "allocate" method is no longer
  used for object allocation.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-20 08:33:17 +00:00
usa 32145b0652 * numeric.c (DBL_EPSILON): fix typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-19 13:56:28 +00:00
matz baa00aa250 * numeric.c (num_step): use DBL_EPSILON.
* array.c (rb_check_array_type): new function: return an array
  (convert if possible), or nil.

* string.c (rb_check_string_type): new function: return a string
  (convert if possible), or nil.

* numeric.c (rb_dbl_cmp): returns nil if values are not
  comparable.

* numeric.c (fix_cmp,flo_cmp): use rb_num_coerce_cmp()

* bignum.c (rb_big_cmp): ditto.

* numeric.c (rb_num_coerce_cmp): new coercing function for "<=>",
  which does not raise TypeError.

* numeric.c (do_coerce): can be supress exception now.

* object.c (rb_mod_cmp): should return nil for non class/module
  objects.

* re.c (rb_reg_eqq): return false if the argument is not a
  string.  now returns boolean value.

* class.c (rb_include_module): argument should be T_MODULE, not
  T_class, nor T_ICLASS.

* eval.c (is_defined): "defined?" should return "assignment" for
  attribute assignment (e.g. a.foo=b) and indexed assignment
  (e.g. a[2] = 44).

* parse.y (aryset): use NODE_ATTRASGN.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-19 09:20:20 +00:00
matz 60b2446bea * sprintf.c (rb_f_sprintf): preceding ".." for negative numbers
still left;  removed.

* sprintf.c (rb_f_sprintf): should not prepend '0' if width > prec
  for example "%5.3d".

* process.c (Init_process): add Process.exit and Process.abort

* pack.c (utf8_to_uv): raise ArgumentError for malformed/redundant
  UTF-8 sequences.

* process.c (last_status_set): add pid attribute to Process::Status.

* pack.c (uv_to_utf8): limit maximum length of the encoded string
  to 6 bytes, even when the platform supports 8 bytes long integers.

* pack.c (utf8_to_uv): do not decode sequences longer than 6 bytes.

* object.c (copy_object): use "copy_object" method, not "become".


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-10 06:23:44 +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 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
michal 0d0ae37e50 Int vs Long cleanup #3 (ruby-core:352)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-08-28 08:05:23 +00:00
matz c45908e41f * file.c (rb_find_file): $LOAD_PATH must not be empty.
* file.c (rb_find_file_ext): ditto.

* range.c (range_eq): class check should be based on range.class,
  instead of Range to work with Range.dup.

* range.c (range_eql): ditto.

* class.c (rb_mod_dup): need to preserve metaclass and flags.

* object.c (rb_cstr_to_dbl): had a buffer overrun.

* marshal.c (w_class): integrate singleton check into a funciton
  to follow DRY principle.

* marshal.c (w_uclass): should check singleton method.

* object.c (rb_obj_dup): dmark and dfree functions must be match
  for T_DATA type.

* object.c (rb_obj_dup): class of the duped object must be match
  to the class of the original.

* re.c (rb_reg_quote): do not escape \t, \f, \r, \n, for they are
  not regular expression metacharacters.

* time.c (time_s_alloc): use time_free instead of free (null check,
  also serves for type mark).

* time.c (time_s_at): check dfree function too.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-08-27 08:31:08 +00:00
michal ffc13a6525 *.c: Int vs Long cleanup
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-08-21 15:47:54 +00:00
matz ae23000c0e * array.c (sort_2): *a - *b may overflow.
* array.c (ary_new): len*sizeof(VALUE) may be a positive value.

* array.c (rb_ary_initialize): ditto.

* object.c (rb_class_allocate_instance): move singleton class
  check from rb_obj_alloc().

* re.c (rb_reg_initialize): should not modify frozen Regexp.

* ext/tcltklib/tcltklib.c (ip_init): allocation framework.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-08-19 05:56:09 +00:00
matz cf5d04f663 * hash.c (rb_hash_replace): should copy ifnone.
* hash.c (rb_hash_dup): should preserve HASH_PROC_DEFAULT and
  HASH_DELETED flags.

* hash.c (rb_hash_shift): shift from empty hash should not return
  its default proc.

* hash.c (rb_hash_default_proc): new method. [new]

* array.c (rb_ary_aref): no need for Bignum check.

* array.c (rb_ary_aset): explicit Bignum check removd.

* numeric.c (fix_aref): normalize bignum before bit-op.

* bignum.c (rb_big_rand): max may be Bignum zero.

* bignum.c (rb_cstr_to_inum): should normalize bignums, to avoid
  returning fixable bignum value.

* bignum.c (rb_uint2big): there should be no zero sized bignum.

* ext/extmk.rb.in: extmake() that works properly for both tkutil
  (tk/tkutil.so) and digest/sha1.

* hash.c (rb_hash_equal): should check HASH_PROC_DEFAULT too.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-08-13 09:21:18 +00:00
matz 89dbf99bac * numeric.c (num_to_int): default to_int implementaion for every
numeric class.

* re.c (rb_reg_quote): initial part of the string was never copied
  to the quoted string.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-07-29 06:14:10 +00:00
matz 7194b66fb2 * random.c: replace with Mersenne Twister RNG.
* eval.c (jump_tag_but_local_jump): preserve retval in
  LocalJumpError exceptions.

* parse.y (command): no more check for "super outside of method".

* eval.c (rb_mod_define_method): should set last_class and
  last_func in the block->frame.

* eval.c (error_handle): should handle TAG_THROW as well.

* parse.y (yylex): new decimal notation '0d4567'.

* parse.y (yylex): new octal notation '0o777'.

* parse.y (string_content): every string_content node should
  return string only.  use NODE_EVSTR to coercing.

* eval.c (rb_eval): NODE_EVSTR support.

* re.c (rb_reg_quote): avoid unnecessary string allocation.

* string.c (get_pat): quote metachracters before compiling a
  string into a regex.

* string.c (rb_str_split_m): special treatment of strings of size
  1, but AWK emulation.  now uses get_pat().

* string.c (rb_str_match_m): quote metacharacters.

* string.c (rb_str_match2): ditto.

* ext/socket/socket.c (sock_addrinfo): make all 3 versions of
  getaddrinfo happy.  [ruby-core:00184]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-07-26 06:12:39 +00:00
nobu 31de741673 * numeric.c (fix_lshift): negative shift count means right shift.
* numeric.c (fix_rshift): return -1 when left side operand is
  negative.

* parse.y (yylex): `0_' should be an error. (ruby-bugs-ja:PR#239)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-06-10 10:06:12 +00:00
matz b7bc0cae53 * string.c (rb_str_aset): should raise error if an indexing string
is not found in the receiver.

* sprintf.c (rb_f_sprintf): "%d" should convert objects into
  integers using Integer().

* lib/tempfile.rb (Tempfile::size): added.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-06-04 07:34:19 +00:00
michal bab153b243 * array.c: fixed format string for 'long' args (%d -> %ld).
* class.c: ditto.

	* eval.c: ditto.

	* numeric.c: ditto.

	* pack.c: ditto.

	* parse.y: ditto.

	* range.c: ditto.

	* string.c: ditto.

	* util.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-05-28 18:11:07 +00:00
matz eb6118992b * eval.c (rb_clear_cache_by_class): new function.
* eval.c (set_method_visibility): should have clear cache forq
  updated visibility.

* numeric.c (flo_to_s): default format precision to be "%.16g".

* util.c (ruby_strtod): use own strtod(3) implementation to avoid
  locale hell.  Due to this change "0xff".to_f no longer returns 255.0

* eval.c (avalue_to_yvalue): new function to distinguish yvalue
  (no-arg == Qundef) from svalue (no-arg == Qnil).

* eval.c (rb_yield_0): use avalue_to_yvalue().

* eval.c (assign): warn if val == Qundef where it means rhs is
  void (e.g. yield without value or call without argument).

* parse.y (value_expr): need not to warn for WHILE and UNTIL,
  since they can have return value (via valued break).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-05-14 06:22:31 +00:00
matz 20ed1f8d1a * error.c: use HAVE_DECL_SYS_NERR instead of platform names.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2423 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-05-02 07:50:36 +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 b134b91278 * various files: macro fix-up by Michal Rokos.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2411 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-04-25 13:57:01 +00:00
matz 936ad409ad * numeric.c (num_step): try to reduce residual on Float operations.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2403 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-04-24 05:08:04 +00:00
matz e3a8c62630 * io.c (rb_io_mode_flags): both 'r+b' and 'rb+' should be allowed.
* io.c (rb_io_mode_modenum): ditto.

* gc.c (rb_memerror): rename from mem_error, and exported.

* gc.c (Init_GC): pre-allocate NoMemoryError instance.

* object.c (convert_type): error message changed from "failed to
  convert" to "cannot convert", since it does not try to convert
  if an object does not respond to the converting method.

* eval.c (block_pass): convert Method to Proc using
  rb_check_convert_type().

* object.c (rb_check_convert_type): always convert T_DATA

* eval.c (rb_thread_cleanup): should not terminate main_thread by
  Fatal error.

* regex.c (is_in_list): need to not exclude NUL and NEWLINE.

* re.c (rb_reg_expr_str): wrong backslash escapement.

* re.c (rb_reg_expr_str): do not escape embedded space
  characters.

* marshal.c (w_object): T_DATA process patch from Joel VanderWerf
  <vjoel@PATH.Berkeley.EDU>.  This is temporary hack; it remains
  undocumented, and it will be removed when marshaling is
  re-designed.

* marshal.c (r_object): ditto.

* numeric.c (num_step): Integer#step is moved to Numeric#step;
  Fixnum#step is merged into this method.

* numeric.c (int_dotimes): Fixnum#times is merged.

* numeric.c (int_upto): Fixnum#upto is merged.

* numeric.c (int_downto): Fixnum#downto is merged.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-04-24 04:54:16 +00:00
matz 19c42c0740 * variable.c (rb_obj_remove_instance_variable): raise NameError if
specified instance variable is not defined.

* variable.c (generic_ivar_remove): modified to check ivar
  existence.

* file.c (rb_file_s_extname): new method based on the proposal
  (and patch) from Mike Hall. [new]

* eval.c (error_handle): default to 1 unless status is set.

* eval.c (ruby_options): guard error_handle() with PROT_NONE.

* eval.c (ruby_stop): ditto.

* math.c (math_acosh): added. [new]

* math.c (math_asinh): ditto.

* math.c (math_atanh): ditto.

* struct.c (rb_struct_each_pair): method added. [new]

* class.c (rb_singleton_class): wrong condition; was creating
  unnecessary singleton class.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2348 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-04-10 08:45:26 +00:00
matz 2bd0c2bf73 * the VMS support patch submitted by Akiyoshi, Masamichi
<Masamichi.Akiyoshi@jp.compaq.com> is merged.

* eval.c (exec_under): changing ruby_class is OK, but should not
  alter cbase.

* eval.c (yield_under_i): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2258 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-22 07:26:42 +00:00
usa 6ba0d31e8f * bignum.c, intern.h (rb_ull2big, rb_ll2big, rb_ull2inum, rb_ll2inum,
big2ull, rb_big2ull, rb_big2ll): use LONG_LONG macro instead of
  long long.
* numeric.c, intern.h, ruby.h (rb_num2ll, rb_num2ull): ditto.
* ruby.h: use _I64_MAX and _I64_MIN if they are defined (for VC++).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-15 08:51:31 +00:00
matz 997b69cb6a * re.c (rb_reg_match): should clear $~ if operand is nil.
* re.c (rb_reg_match2): ditto.

* configure: merge Jonathan Baker's large file support patch
  [ruby-talk:35316], with read_all patch in [ruby-talk:35470].

* eval.c (rb_f_abort): optional message argument that be printed
  on termination. [new]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-14 06:23:46 +00:00
matz 85e32dd221 * re.c (match_select): should propagate taintness.
* hash.c (rb_hash_set_default): Hash#default= should return the
  new value.

* string.c (rb_str_to_i): accepts optional base argument. [new]

* numeric.c (rb_fix2str): should not handle negative fixnum values
  int32 via calling sprintf() directly.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-01-11 09:18:54 +00:00
matz df96f994f1 * parse.y (parse_regx): should raise error on untermitated
expression interpolation.

* pack.c (pack_unpack): should give length to utf8_to_uv().

* pack.c (utf8_to_uv): add length check.

* massages: replace "wrong #" by "wrong number".

* marshal.c (w_float): output Infinity and NaN explicitly.

* marshal.c (r_object): support new explicit float format.

* eval.c (rb_thread_wait_for): select may cause ERESTART on
  Solaris.

* eval.c (rb_thread_select): ditto.

* array.c (rb_ary_join): dumped core if sep is not T_STRING nor T_NIL.

* array.c (rb_ary_join): buffer size calculattion was wrong.

* array.c (rb_ary_to_s): if rb_output_fs is nil, insert newlines
  between array elements (use rb_default_rs as newline litral)
  [experimental].

* gc.c (init_mark_stack): no need to clear mark_stack.

* gc.c (gc_mark_all): need to handle finalizer mark.

* gc.c (gc_mark_rest): use MEMCPY instead of memcpy.

* gc.c (rb_gc_mark): earlier const check to avoid pusing special
  constants into mark stack.

* numeric.c (fix_to_s): 'to_s' now takes optional argument to
  specify radix. [new]

* bignum.c (rb_big_to_s): ditto. [new]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1842 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-11-19 05:03:03 +00:00
matz bbb608ad79 * bignum.c (rb_big_aref): idx may be a Bignum.
* numeric.c (fix_aref): negative index must return zero.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-11-01 05:11:24 +00:00
matz 88abd791f5 * parse.y (str_extend): shuould allow interpolation of $-x.
* variable.c (rb_cvar_set): empty iv_tbl may cause infinite loop.

* variable.c (rb_cvar_get): ditto.

* variable.c (cvar_override_check): ditto.

* bignum.c (rb_big_eq): convert Bignum to Float, instead of
  reverse.

* time.c (time_localtime): getting tm should not be prohibited for
  frozen time objects.

* time.c (time_gmtime): ditto.

* version.c (Init_version): freeze RUBY_VERSION,
  RUBY_RELEASE_DATE, and RUBY_PLATFORM.

* file.c (Init_File): freeze File::SEPARATOR, ALT_SEPARATOR and
  PATH_SEPARATOR.

* file.c (rb_stat_cmp): should check operand type before calling
  get_stat().

* eval.c (rb_eval_cmd): should not invoke "call" with a block on
  any occasion.

* numeric.c (fix_aref): idx may be a Bignum.

* numeric.c (num_remainder): a bug in Numeric#remainder.

* eval.c (rb_exec_end_proc): END might be called within END
  block.

* class.c (rb_mod_clone): should not copy class name, since clone
  should remain anonymous.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-10-29 05:07:26 +00:00
matz 8098dd6c80 * file.c (rb_stat_clone): should copy internal data too.
* numeric.c (num_clone): Numeric should not be copied by clone.

* object.c (rb_obj_clone): should check immediate values.

* parse.y (command): `yield' should take command_args.

* parse.y (parse_quotedwords): %w(...) is not a string.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-10-10 08:21:13 +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
matz 75eee0bafd * ext/socket/socket.c (unix_addr): getsockname(2) may result len = 0.
* ext/socket/socket.c (unix_peeraddr): getpeername(2) may result
  len = 0.

* string.c (rb_str_subpat_set): support function for new argument
  pattern String#[re,offset] = val. [new]

* eval.c (POP_BLOCK): rb_gc_force_recycle() was called too much.
  Should not be called if SCOPE_DONT_RECYCLE is set.

* string.c (rb_str_aref_m): new argument pattern
  String#[re,offset]. [new]

* string.c (rb_str_substr): should return an instance of
  receiver's class.

* string.c (rb_str_succ): ditto.

* array.c (rb_ary_subseq): ditto.

* array.c (rb_ary_initialize): Array.new([1,2,3]) => [1,2,3]. [new]

* string.c (rb_str_reverse): should return an instance of
  receiver's class.

* string.c (rb_str_times): ditto.

* array.c (rb_ary_times): ditto

* string.c (str_gsub): ditto.

* string.c (rb_str_ljust): ditto.

* string.c (rb_str_rjust): ditto.

* string.c (rb_str_center): ditto.

* eval.c (eval): retrieves file, line information from binding.

* eval.c (intersect_fds): counts intersecting fds.

* eval.c (rb_thread_schedule): only fds requested by
  each thread count as select_value.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-10-02 04:31:23 +00:00
matz 67245eec71 * eval.c (rb_thread_restore_context): save current value of
lastline and lastmatch in the thread struct for later restore.

* eval.c (rb_thread_save_context): restore lastline and lastmatch.

* numeric.c (flo_to_s): should handle negative float value.

* class.c (rb_include_module): should check whole ancestors to
  avoid duplicate module inclusion.

* string.c (trnext): should check backslash before updating "now"
  position.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-09-08 14:17:53 +00:00
matz 0f35b58a2f * ruby.c (proc_options): should not alter origargv[].
* ruby.c (set_arg0): long strings for $0 dumped core.

* ruby.c (set_arg0): use setprogtitle() if it's available.

* io.c (rb_io_popen): accept integer flags as mode.

* file.c (rb_find_file_ext): extension table can be supplied from
  outside.  renamed.

* eval.c (rb_f_require): replace rb_find_file_noext by
  rb_find_file_ext.

* eval.c (rb_provided): should also check feature without
  extension.

* numeric.c (flo_to_s): do not rely on decimal point to be '.'


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-09-03 05:37:42 +00:00
matz b47a99485b * parse.y (yylex): ternary ? can be followed by newline.
* eval.c (rb_f_require): should check static linked libraries
  before raising exception.

* array.c (rb_ary_equal): check identiry equality first.

* string.c (rb_str_equal): ditto.

* struct.c (rb_struct_equal): ditto.

* numeric.c (Init_Numeric): undef Integer::new.

* eval.c (rb_eval): NODE_WHILE should update result for each
  conditional evaluation.

* eval.c (rb_eval): NODE_UNTIL should return last evaluated value
  (or value given to break).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-08-29 06:28:51 +00:00
usa 2270c16ff9 * numeric.c (num_divmod): fix typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-08-06 05:33:17 +00:00
matz f33a61c28d * string.c (rb_str_lstrip_bang): new method.
* string.c (rb_str_rstrip_bang): new method.

* string.c (rb_str_associate): should consider STR_ASSOC too.

* eval.c (rb_undefined): do not recurse if method_missing is
  undefined.

* process.c (proc_waitpid): now all arguments are optional.

* process.c (Init_process): waitpid is now alias to wait.

* process.c (Init_process): waitpid2 is now alias to wait2.

* process.c (rb_waitpid): made public.

* ext/pty/pty.c (pty_getpty): avoid disturbing SIGCHLD using
  thread and rb_waitpid.

* process.c (proc_getpgrp): now takes no argument on all
  platforms.

* process.c (proc_setpgrp): ditto.

* ext/socket/socket.c (sock_s_pack_sockaddr_in): added
  Socket::pack_sockaddr_in(). [new]

* ext/socket/socket.c (sock_s_pack_sockaddr_un): added
  Socket::pack_sockaddr_un(). [new]

* ext/socket/socket.c (sock_s_pack_sockaddr_in): added
  Socket::unpack_sockaddr_in(). [new]

* ext/socket/socket.c (sock_s_pack_sockaddr_un): added
  Socket::unpack_sockaddr_un(). [new]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-08-06 03:05:23 +00:00
matz c8a7361e45 * marshal.c (Init_marshal): new constant Marshal::MAJOR_VERSION
and Marshal::MINOR_VERSION.

* marshal.c (marshal_load): ruby_verbose test should be wrapped by
  RTEST().

* hash.c (rb_hash_index): should return nil (not the default
  value) if value is not in the hash.

* numeric.c (num_div): new method added.  alias to '/' which
  should be preserved even if '/' is redefined (e.g. by
  mathn). [new]

* bignum.c (rb_cstr2inum): "0 ff".hex should return 0, not 255.

* file.c (rb_file_s_expand_path): fixed using CharNext().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-07-31 06:24:45 +00:00
matz 15ffbb1f82 * eval.c (rb_provide_feature): should not tweak extension used for
loading.

* io.c (io_fread): use fread(3) if PENDING_COUND is available.

* class.c (rb_mod_include_p): Module#include? added. [new]

* re.c (ignorecase_setter): give warning on modifying $=.

* string.c (rb_str_casecmp): new method. [new]

* string.c (rb_str_eql): separated from rb_str_equal(), make it
  always be case sensitive. [new]

* string.c (rb_str_hash): made it always be case sensitive.

* eval.c (rb_f_require): should not include path in $" value

* file.c (rb_find_file): should return 0 explicitly on failure.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1642 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-07-24 09:07:33 +00:00
matz ffe1cf575e * error.c (exc_exception): clone the receiver exception instead of
creating brand new exception object of the receiver.

* eval.c (rb_eval_string_wrap): extend new ruby_top_self, not
  original self.

* eval.c (rb_eval_cmd): respect ruby_wrapper if set.

* eval.c (eval): do not update ruby_class unless scope is not
  provided.

* eval.c (eval): preserve wrapper information.

* eval.c (proc_invoke): ditto.

* eval.c (block_pass): ditto.

* parse.y (void_expr): too much warnings for void context
  (e.g. foo[1] that can be mere Proc call).

* error.c (rb_name_error): new function to raise NameError with
  name attribute set.

* eval.c (rb_f_missing): set name and args in the exception
  object. [new]

* error.c (name_name): NameError#name - new method.

* error.c (nometh_args): NoMethodError#args - new method.

* lex.c (rb_reserved_word): lex_state after tRESCUE should be
  EXPR_MID.

* gc.c (add_heap): allocation size of the heap unit is doubled for
  each allocation.

* dir.c (isdelim): space, tab, and newline are no longer
  delimiters for glob patterns.

* eval.c (svalue_to_avalue): new conversion scheme between single
  value and array values.

* eval.c (avalue_to_svalue): ditto.

* eval.c (rb_eval): REXPAND now uses avalue_to_svalue(), return
  and yield too.

* eval.c (rb_yield_0): use avalue_to_svalue().

* eval.c (proc_invoke): Proc#call gives avaules, whereas
  Proc#yield gives mvalues.

* eval.c (bmcall): convert given value (svalue) to avalue.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-07-02 08:46:28 +00:00
matz fd06a2a7fb * eval.c (block_pass): should not downgrade safe level.
* ext/dbm/extconf.rb: allow specifying dbm-type explicitly.

* ext/dbm/extconf.rb: avoid gdbm if possible, because it leaks
  memory, whereas gdbm.so doesn't.  potential incompatibility.

* string.c (rb_str_insert): new method.

* parse.y (yylex): lex_state after RESCUE_MOD should be EXPR_BEG.

* array.c (rb_ary_insert): new method.

* array.c (rb_ary_update): new utility function.

* io.c (set_outfile): should check if closed before assignment.

* eval.c (rb_eval): should preserve value of ruby_errinfo.

* eval.c (rb_thread_schedule): infinite sleep should not cause
  dead lock.

* array.c (rb_ary_flatten_bang): proper recursive detection.

* eval.c (yield_under): need not to prohibit at safe level 4.

* pack.c (pack_pack): p/P packs nil into NULL.

* pack.c (pack_unpack): p/P unpacks NULL into nil.

* pack.c (pack_pack): size check for P template.

* ruby.c (set_arg0): wrong predicate when new $0 value is bigger
  than original space.

* gc.c (id2ref): should use NUM2ULONG()

* object.c (rb_mod_const_get): check whether name is a class
  variable name.

* object.c (rb_mod_const_set): ditto.

* object.c (rb_mod_const_defined): ditto.

* marshal.c (w_float): precision changed to "%.16g"

* eval.c (rb_call0): wrong retry behavior.

* numeric.c (fix_aref): a bug on long>int architecture.

* eval.c (rb_eval_string_wrap): should restore ruby_wrapper.

* regex.c (re_compile_pattern): char class at either edge of range
  should be invalid.

* eval.c (handle_rescue): use === to compare exception match.

* error.c (syserr_eqq): comparison between SytemCallErrors should
  based on their error numbers.

* eval.c (safe_getter): should use INT2NUM().

* bignum.c (rb_big2long): 2**31 cannot fit in 31 bit long.

* regex.c (calculate_must_string): wrong length calculation.

* eval.c (rb_thread_start_0): fixed memory leak.

* parse.y (none): should clear cmdarg_stack too.

* io.c (rb_fopen): use setvbuf() to avoid recursive malloc() on
  some platforms.

* file.c (rb_stat_dev): device functions should honor stat field
  types (except long long such as dev_t).

* eval.c (rb_mod_nesting): should not push nil for nesting array.

* eval.c (rb_mod_s_constants): should not search array by
  rb_mod_const_at() for nil (happens for singleton class).

* class.c (rb_singleton_class_attached): should modify iv_tbl by
  itself, no longer use rb_iv_set() to avoid freeze check error.

* variable.c (rb_const_get): error message "uninitialized constant
  Foo at Bar::Baz" instead of "uninitialized constantBar::Baz::Foo".

* eval.c (rb_mod_included): new hook called from rb_mod_include().

* io.c (opt_i_set): should strdup() inplace_edit string.

* eval.c (exec_under): need to push cref too.

* eval.c (rb_f_missing): raise NameError for "undefined local
  variable or method".

* error.c (Init_Exception): new exception NoMethodError.
  NameError moved under ScriptError again.

* eval.c (rb_f_missing): use NoMethodError instead of NameError.

* file.c (Init_File): should redifine "new" class method.

* eval.c (PUSH_CREF): sharing cref node was problematic.  maintain
  runtime cref list instead.

* eval.c (rb_eval): copy defn node before registering.

* eval.c (rb_load): clear ruby_cref before loading.

* variable.c (rb_const_get): no recursion to show full class path
  for modules.

* eval.c (rb_set_safe_level): should set safe level in curr_thread
  as well.

* eval.c (safe_setter): ditto.

* object.c (rb_obj_is_instance_of): nil belongs to false, not true.

* time.c (make_time_t): proper (I hope) daylight saving time
  handling for both US and Europe.  I HATE DST!

* eval.c (rb_thread_wait_for): non blocked signal interrupt should
  stop the interval.

* eval.c (proc_eq): class check aded.

* eval.c (proc_eq): typo fixed ("return" was ommitted).

* error.c (Init_Exception): move NameError under StandardError.

* class.c (rb_mod_clone): should copy method bodies too.

* bignum.c (bigdivrem): should trim trailing zero bdigits of
  remainder, even if dd == 0.

* file.c (check3rdbyte): safe string check moved here.

* time.c (make_time_t): remove HAVE_TM_ZONE code since it
  sometimes reports wrong time.

* time.c (make_time_t): remove unnecessary range check for
  platforms where negative time_t is available.

* process.c (proc_waitall): should push Process::Status instead of
  Finuxm status.

* process.c (waitall_each): should add all entries in pid_tbl.
  these changes are inspired by Koji Arai.  Thanks.

* process.c (proc_wait): should not iterate if pid_tbl is 0.

* process.c (proc_waitall): ditto.

* numeric.c (flodivmod): a bug in no fmod case.

* process.c (pst_wifsignaled): should apply WIFSIGNALED for status
  (int), not st (VALUE).

* io.c (Init_IO): value of $/ and $\ are no longer restricted to
  strings.  type checks are done on demand.

* class.c (rb_include_module): module inclusion should be check
  taints.

* ruby.h (STR2CSTR): replace to StringType() and StringTypePtr().

* ruby.h (rb_str2cstr): ditto.

* eval.c (rb_load): should not copy topleve local variables.  It
  cause variable/method ambiguity.  Thanks to L. Peter Deutsch.

* class.c (rb_include_module): freeze check at first.

* eval.c (rb_attr): sprintf() and rb_intern() moved into
  conditional body.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-05-02 04:22:21 +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 8e5c3b23f2 * dir.c (dir_s_glob): supprt backslash escape of metacharacters
and delimiters.

* dir.c (remove_backslases): remove backslashes from path before
  calling stat(2).

* dir.c (dir_s_glob): call rb_yield directly (via push_pattern) if
  block is given to the method.

* dir.c (push_pattern): do not call rb_ary_push; yield directly.

* eval.c (blk_copy_prev): reduced ALLOC_N too much.

* eval.c (frame_dup): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-02-14 05:52:06 +00:00
matz f54418b71f matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-11-27 09:23:38 +00:00
matz 46620a8772 matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-11-14 07:10:31 +00:00
matz 2a1b0ff232 matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-11-13 05:39:35 +00:00
matz e0009b6a54 matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-08-31 05:29:54 +00:00
matz 3043170b14 matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-07-07 03:20:53 +00:00
matz d1375688cd matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-07-06 07:21:26 +00:00
matz 4f51d81418 matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-07-04 04:17:26 +00:00
matz 6ad90f5ad4 matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@802 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-07-03 05:46:36 +00:00
matz 548b5143db 2000-06-12
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-06-12 07:48:31 +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 c8f58f2a16 freebsd floating point
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-04-18 04:56:28 +00:00
matz 4d215cd9d3 2000-03-07
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-03-07 08:37:59 +00:00
matz 96b40dff45 2000-02-17
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-02-17 07:11:22 +00:00
matz e4b53b2222 2000-02-01
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-02-01 03:12:21 +00:00
matz a69b9bce31 2000-01-08
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@601 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-01-08 05:00:25 +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 dee96209bf 19991206
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1999-12-06 09:04:03 +00:00
matz 9e3d9a2a00 1.4.1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1999-09-16 09:40:33 +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