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

150 Коммитов

Автор SHA1 Сообщение Дата
matz 4f0ef242cc * object.c (rb_mod_cvar_get): new method Module#class_variable_get.
* object.c (rb_mod_cvar_set): ditto (Module#class_variable_set).

* eval.c (rb_thread_atfork): 1.9 warns no more for thread
  termination.  [ruby-dev:23212]


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

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

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


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-03-18 06:59:04 +00:00
nobu b416c57c0a * eval.c (method_proc): return bound Proc object. [ruby-dev:22854]
* eval.c (rb_mod_define_method): bind method body itself for Method
  object.

* node.h (NODE_DMETHOD): deprecated.

* object.c (rb_class_inherited_p): export.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-02-10 11:49:14 +00:00
nobu 509fa97431 * object.c (rb_obj_clone, rb_obj_dup): mentioned about
initialize_copy.  [ruby-core:02339]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-02-10 08:12:04 +00:00
matz 7df46a4493 * pack.c (num2i32): pack should not raise RangeError.
[ruby-dev:22654]

* pack.c (pack_pack): do not auto convert nil to zero.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-22 18:06:38 +00:00
matz 22c005569b * variable.c (rb_set_class_path): do not set path if
* lib/cgi.rb (CGI::QueryExtension): give extended string, not a
  delegater object.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-19 09:19:31 +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 a1d3a8e861 Add explicit line breaks in method signatures for ri. Fixup some comments in object.c. Support changes comments for "in xxx.c"
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-12 03:11:25 +00:00
matz b07337fcb3 * configure.in: install rdoc by default. if you do not want to
install rdoc, specify --disable-install-doc.

* eval.c (eval): need to add message delimiter. [ruby-dev:22561]

* defines.h (__NeXT__): Ensure that all standard S_IRUSR, S_IWGRP,
  S_IRWXO, etc. macros are defined since future code might require
  them (even though present code only requires a subset).

* defines.h (__NeXT__): Bug fix: WORDS_BIGENDIAN was not being set
  correctly on Rhapsody when -arch compiler flag was used (via
  configure's --enable-fat-binary option).

* ext/socket/socket.c (make_hostent): getaddrinfo(3) on BSD do not
  fill ai_canonname if serv is not supplied.  (ruby-bugs PR#1243)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-10 17:39:07 +00:00
eban 973c2ad00d * eval.c, object.c, process.c, re.c: don't use C++ style comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-08 02:21:28 +00:00
dave 88c127c19b Finish documenting internal stuff. See Changelog for other details
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5364 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-02 06:01:12 +00:00
dave 8d32798543 RDoc Struct and random
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-28 20:47:56 +00:00
dave 3c288b427d Add RDoc documentation for stuff in object.c
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-28 06:33:07 +00:00
dave d89650c8cf RDoc comments for Symbol
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-27 06:09:08 +00:00
nobu 65fed5dad3 * class.c (rb_mod_init_copy): always copy singleton class.
[ruby-dev:22325]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-22 12:15:34 +00:00
nobu 7c34e359a1 * class.c (rb_check_inheritable): new function. [ruby-dev:22316]
* intern.h: add prototype.

* eval.c (superclass): use rb_check_inheritable().

* object.c (rb_class_initialize): check argument validity.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-21 08:29:06 +00:00
dave da99e407fb Add file.c comments (and necessary support in parse_c.rb)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-21 07:28:54 +00:00
dave 5076ed519b Document Class and Dir
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-19 15:18:09 +00:00
matz aabecebd69 * eval.c (rb_exec_end_proc): should not clear end_procs and
ephemeral_end_procs before execution. [ruby-dev:22144]

* eval.c (rb_obj_extend): call Module#extended hook after
  extended_object.  [ruby-list:38866]

* object.c (Init_Object): Module#extended defined.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-05 05:54:00 +00:00
eban d434a6973e * object.c (rb_class_s_alloc): add function prototype to avoid VC++
warning.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-13 07:13:45 +00:00
matz b51416e21f * eval.c (rb_call0): update ruby_class as well as ruby_cref.
(ruby-bugs-ja PR#540)

* eval.c (rb_yield_0): remove ruby_frame->cbase and unify to
  ruby_cref.  [ruby-talk:78141]

* eval.c: initialize /* OK */ variables by Qnil to stop warnings.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-06 21:50:06 +00:00
matz 5dd2b7102c * gcc -Wall clean-up.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-24 18:33:50 +00:00
matz 0d1df1cd7d * variable.c (rb_mod_const_missing): new method. [ruby-core:00441]
* variable.c (rb_const_get_at): allow "const_missing" hook.

* variable.c (rb_const_get_0): ditto.

* eval.c (method_missing): rename from rb_undefined to clarify.

* eval.c (ruby_finalize_0): update exit status if any of END proc
  raises SystemExit. [ruby-core:01256]

* eval.c (rb_exec_end_proc): reduce rb_protect().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4116 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-22 08:42:47 +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
matz fa284f8127 * string.c (rb_str_equal): should return nil for non string
operand to conform comparable convention. [ruby-dev:20759]

* object.c (rb_equal): preserve nil if "==" returns nil.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4112 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-21 18:37:07 +00:00
matz 662e3cf1f9 * eval.c (rb_load): put rb_load_file() in a thread critical
section. [ruby-dev:20490]

* eval.c (compile): put rb_compile_string() in a thread critical
  section.

* variable.c (rb_const_get_0): should not warn if constant is not
  defined. (ruby-bugs-ja PR#509)

* bignum.c (rb_big2dbl): give a warning on overflow.
  (ruby-bugs-ja PR#510)

* util.c (ruby_strtod): change MDMAXEXPT from 511 to 308.

* pack.c (utf8_to_uv): long is sufficient.  LONG_LONG is not
  required.

* bignum.c (rb_big2str): support 32 bit (without `long long' type)
  machines. (ruby-bugs-ja PR#512)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-09 22:28:42 +00:00
nobu 442c836bfe * class.c (rb_define_class, rb_define_module): also set constant under
Object.  [ruby-dev:20445]

* object.c (boot_defclass): ditto.

* variable.c (rb_const_get_at, rb_const_get_0, rb_mod_const_at,
  rb_const_defined, mod_av_set, rb_const_assign): toplevel constants
  are now under Object, rb_class_tbl remains for GC.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4019 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-01 01:36:25 +00:00
matz 9060b3355a * object.c (str_to_id): check for empty string before intern.
[ruby-talk:74006]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-06-21 14:51:21 +00:00
nobu f96ab4131c * object.c (rb_to_id): use rb_str_intern() instead of rb_intern()
directly, for sanity check.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-06-21 12:27:21 +00:00
matz b4fd4d6018 * eval.c (Init_Proc): Block/Proc separation. [huge change]
* eval.c (block_arity): returns exact arity number for Procs out
  of methods. also gives 1 for {|a|..}.

* string.c (rb_str_match): revert use of String#index for
  invocation like string =~ string.

* eval.c (rb_Array): move Object#to_a exclusion hack from
  splat_value().  need to be in eval.c for a while.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-26 08:22:33 +00:00
matz c3584231ba * object.c (rb_obj_clone): defer copying freezing state after
calling initialize_copy().  [ruby-dev:20276]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-22 16:37:22 +00:00
matz 56a4cc27ed * object.c (init_copy): call initialize_copy at the end of copy
process.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-20 08:40:50 +00:00
matz db0b2bb241 * object.c (rb_mod_cmp): stupid comparison fixed.
* io.c (Init_IO): ARGF.path added (alias to ARGF.filename).
  [ruby-dev:20197]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3821 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-19 06:27:06 +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 25fd1d7ff2 * object.c (rb_class_allocate_instance): singleton class check
moved to rb_obj_alloc(). (ruby-bugs-ja PR#345)

* re.c (rb_reg_quote): should escape white space characters,
  \t, \f, \n, \r. (ruby-bugs-ja PR#231)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-16 23:28:31 +00:00
matz 068170e47a * object.c (rb_mod_le): returns nil if two classes/modules are not
in class-superclass relationship.

* object.c (rb_mod_cmp): uses new rb_mod_le() behavior.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3802 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-15 07:57:07 +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
matz 776e2693e7 * string.c (rb_str_ljust): now takes optional argument to specify
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
2003-05-02 06:41:33 +00:00
matz dc08e8a60f * variable.c (rb_mod_name): search module path if classname is not
set yet. (ruby-bugs-ja PR#424)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-04-09 18:33:52 +00:00
matz e11f6de3c5 * ext/socket/socket.c (sock_s_unpack_sockaddr_in): remove struct
size check.  getnameinfo(3) can handle. [ruby-dev:19967]

* io.c (io_read): do not call rb_sys_fail() when required data
  length is zero. (ruby-bugs-ja PR#420)

* eval.c (umethod_proc): should raise TypeError, instead of
  returning error causing Proc.  Following the principle of "fail
  early".  [ruby-core:00927]

* pack.c (pack_pack): small but serious typo.

* eval.c (backtrace): skip internal allocator frame.
  (ruby-bugs-ja PR#416)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-04-07 06:58:31 +00:00
matz fec60bc7c4 * eval.c (avalue_to_svalue): use rb_check_array_type() again.
Clarify how "to_ary" and "to_a" work. [ruby-talk:68155]

* eval.c (svalue_to_avalue): ditto.

* eval.c (svalue_to_mrhs): ditto.

* eval.c (rb_eval): unary splat to use to_a, but we need a hack to
  exclude Object#to_a until it's removed.

* object.c (rb_Array): check obj.respond_to?("to_a").  Currently
  all object respond_to "to_a", but Object#to_a will be removed.

* range.c (Init_Range): undefine to_ary.

* re.c (Init_Regexp): ditto.

* regex.c (re_compile_pattern): do not warn if "-" is at the top
  or last of character class.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3633 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-03-29 02:56:18 +00:00
matz d4db9e9c60 * io.c (rb_io_initialize): should check rb_secure(4).
* dir.c (dir_s_getwd): should check rb_secure(4).

* object.c (rb_obj_infect): function version of OBJ_INFECT().

* eval.c (rb_secure_update): new function to check object update.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-03-25 03:11:27 +00:00
matz ece972717b security enhancement of dl library (need test).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3609 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-03-24 09:38:37 +00:00
matz ab24be4e98 * array.c (rb_ary_to_a): return value should be an Array if the
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
2003-02-10 09:40:13 +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
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
usa b469f3155a * array.c (ary_alloc), dir.c (dir_s_alloc), eval.c (thgroup_s_alloc),
file.c (rb_stat_s_alloc), hash.c (hash_alloc), io.c (io_alloc),
  object.c (rb_module_s_alloc, rb_class_allocate_instance),
  re.c (match_alloc, rb_reg_s_alloc), string.c (str_alloc),
  time.c (time_s_alloc), ext/digest/digest.c (rb_digest_base_alloc),
  ext/tcltklib/tcltklib.c (ip_alloc),
  ext/win32ole/win32ole.c (fole_s_allocate, fev_s_allocate)
  : add prototype to get rid of VC++ warnings.

* ext/sdbm/init.c (fsdbm_alloc): allocator takes only one argument.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-21 18:02:01 +00:00
matz 71ef585f4e * object.c (Init_Object): should not remove Class#allocate.
* lib/profiler.rb: separate profiling functions, without
  trace_func and at_exit setting.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-20 09:00:10 +00:00