system's alloca. [ruby-core:01503]
* io.c (rb_f_gets): should call next_argv() before type check
current_file. [ruby-list:38336]
* eval.c (proc_invoke): should retrieve retval when pcall is true.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
need to restore previous value. [ruby-talk:77577]
* array.c (rb_ary_fill): array length may be changed during the
block execution. [ruby-talk:77579]
* array.c (rb_ary_zip): ditto.
* array.c (rb_ary_fill): ditto.
* hash.c (env_reject_bang): length may be changed during the block
execution.
* hash.c (env_clear): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
iteration. reported on [ruby-talk:77500], and fixed by
K.Sasada <ko1@namikilab.tuat.ac.jp> on [ruby-talk:77504]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4240 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
rb_ary_values_at. follow DRY principle.
* re.c (match_values_at): values_at should understand ranges.
* struct.c (rb_struct_values_at): ditto.
* struct.c (inspect_struct): inspect format changed; add "struct "
at the top.
* sprintf.c (rb_f_sprintf): "%p" specifier for inspect output.
(RCR#68)
* eval.c (rb_mod_undef_method): allow "undef_method" to accept
multiple arguments. (RCR#146)
* lib/timeout.rb: put timeout in Timeout module. (RCR#121)
[ruby-talk:61028]
* re.c (match_groups): new method added. (RCR#139)
* variable.c (rb_mod_const_of): should exclude constant defined
in Object, unless retrieving constants of Object.
* string.c (rb_str_new4): do not allocate new string if original
is frozen or already have copy-on-write entry. [ruby-talk:74940]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4031 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Each END proc should preserve its own $SAFE level. [ruby-core:01119]
* marshal.c (marshal_load): remove unused variable "hash".
[ruby-core:01120]
* hash.c (env_str_new): freeze strings from ENV. [ruby-talk:72860]
* array.c (rb_ary_first): optional argument to retrieve first n
elements.
* array.c (rb_ary_last): optional argument to retrieve last n
elements.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
ranges too.
* range.c (rb_range_beg_len): length calculation was wrong.
* eval.c (rb_call): should set T_ICLASS in the frame->last_class.
[ruby-core:01110]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
before detach pid. [ruby-talk:71519]
* eval.c (PUSH_FRAME): save outer ruby_block. [ruby-list:37677],
[ruby-dev:20202]
* eval.c (BEGIN_CALLARGS): restore outer block by using
ruby_block->outer.
* eval.c (block_pass): do not alter block->prev, but block->outer.
* array.c (get_inspect_tbl): warning on wrong condition.
* eval.c (localjump_xvalue): renamed exitstatus to exit_value
since it's not exit "status" after all.
* eval.c (localjump_error): add reason to LocalJumpError.
* compar.c (rb_cmpint): raise error via rb_cmperr(), if cmp value
is nil. now take new 2 arguments.
* time.c (time_cmp): 2003-05-16 fix was incomplete.
(ruby-bugs-ja:PR#458)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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
valid array. (ruby-bugs-ja PR#65)
* array.c (inspect_ensure,rb_protect_inspect,rb_inspecting_p):
use get_inspect_tbl().
* eval.c (rb_f_abort): call exit(1) if exception is raised. This
patch was made by Nobuyoshi Nakada <nobu.nokada@softhome.net> on
2002-05-30. (ruby-bugs-ja PR#236)
* signal.c: disable Ruby's interrupt handler at the beginning.
(ruby-bugs-ja PR#236)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3817 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* 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
pad string. [ruby-talk:70482]
* string.c (rb_str_rjust): ditto.
* string.c (rb_str_center): ditto.
* string.c (rb_str_justify): utility function.
* eval.c (rb_add_method): call singleton_method_added or
method_added for every method definition (after ruby_running).
[ruby-talk:70471]
* array.c (rb_ary_reverse_bang): Array#reverse! should not return
nil even for arrays sized less than 2.
* io.c (argf_eof): should not block after reading all argument
files. (ruby-bugs-ja PR#449)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
[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
receiver is an instance of subclass of Array.
* string.c (rb_str_to_s): return value should be a String if the
receiver is an instance of subclass of String.
* eval.c (rb_call): calls method_missing when superclass method
does not exist.
* eval.c (rb_f_missing): now handles "no super" case.
* object.c (rb_obj_ivar_get): Object#instance_variable_get: new
method to get instance variable value without eval(). [new]
* object.c (rb_obj_ivar_set): Object#instance_variable_set: new
method to set instance variable value without eval(). [new]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
object, if b has "to_ary" and b == a.
* hash.c (rb_hash_equal): a == b is true when b is non T_HASH
object, if b has "to_hash" and b == a.
* string.c (rb_str_equal): a == b is true when b is non T_STRING
object, if b has "to_str" and b == a.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3442 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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
* error.c (Init_Exception): "to_str" removed.
* eval.c (eval): should not rely on Exception#to_str
* eval.c (compile_error): ditto.
* error.c (err_append): ditto.
* hash.c (rb_hash_merge): Hash#merge, non destructive "update".
now there's also Hash#merge! which is an alias to "update".
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c (env_shift): ditto.
* hash.c (env_invert): ditto.
* hash.c (env_replace): ditto.
* hash.c (env_update): ditto.
* array.c (rb_ary_join): dispatch based on "to_str".
* array.c (rb_ary_times): ditto.
* array.c (rb_ary_equal): ditto.
* process.c (rb_f_exec): dispatch based on "to_ary".
* eval.c (umethod_bind): exact class match is not required. relax
the restriction to subclasses.
* eval.c (rb_eval): call "inherited" before executing class body.
* class.c (rb_define_class): call "inherited" after defining the
constant.
* class.c (rb_define_class_under): ditto.
* eval.c (massign): expand first element if RHS is an array and
its size is 1, and LHS has concrete assignment target (i.e. LHS
has target(s) other than *var).
* eval.c (massign): avoid unnecessary avalue/svalue conversion.
* eval.c (rb_yield_0): ditto
* array.c (rb_ary_update): do not allocate unused array if rpl is
nil (i.e. merely removing elements).
* io.c (io_read): should resize supplied string if it's shorter
than expected.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
mvalue, etc.
* eval.c (rb_yield_0): new parameter added to tell whether val is
an array value or not.
* parse.y (yield_args): restructuring: new nodes: NODE_RESTARY2,
NODE_SVALUE; removed node: NODE_RESTARGS.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3270 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* file.c (rb_file_s_chmod): Do not directly cast an int to void *
to avoid a warning.
* defines.h (FLUSH_REGISTER_WINDOWS): Add support for
FreeBSD/sparc64. miniruby still coredumps in a different place,
though.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* 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
* 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
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
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
zipped with nil if argument arrays are shorter. if arrays are
longer, left items are ignored. now works with blocks.
* enum.c (zip_i): changed for new behavior.
* array.c (rb_ary_transpose): added. [new]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
variable table if it existes.
* class.c (rb_make_metaclass): metaclass of a metaclass is a
metaclass itself.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval.c (rb_alias): prohibit making an alias named "allocate" if
klass is a metaclass.
* string.c (rb_string_value_ptr): StringValuePtr() should never
return NULL pointer.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* 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
* 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
substring, slice! should return nil without exception.
* array.c (rb_ary_insert): type fixed.
* string.c (rb_str_split_m): accept separator value nil as well.
* string.c (rb_str_become): was leaking memory.
* class.c (rb_include_module): should not alter other
classes/modules by inclusion. by this fix, local order may not
be preserved for some cases.
* class.c (include_class_new): module may be T_ICLASS; retrieve
original module information.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2632 b2dd03c8-39d4-4d8f-98ff-823fe69b080e