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

445 Коммитов

Автор SHA1 Сообщение Дата
nobu 8b9afe6520 error.c: preserve encoding
* error.c (rb_error_frozen_object): preserve encoding of class
  name in error message.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-19 01:46:42 +00:00
nobu 876bfc6b4e Init functions don't need ID caches
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-03 03:38:10 +00:00
nobu f2980e3e20 encoding.h: constify rb_encoding
* include/ruby/encoding.h: constify `rb_encoding` itself, not only
  arguments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-02 20:23:47 +00:00
nobu 046831094b constify rb_encoding and OnigEncoding
* include/ruby/encoding.h: constify `rb_encoding` arguments.
* include/ruby/oniguruma.h: constify `OnigEncoding` arguments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-01 22:06:11 +00:00
nobu 82f4c4d4d7 report bug with machine regisiters
* error.c (rb_bug_context): new function to report bug with
  context.
* vm_dump.c (rb_vm_bugreport): accepts `ucontext_t` argument to
  dump machine regisiters.  based on [GH-584].
* signal.c (sigbus, sigsegv): dump machine regisiters if available.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-25 03:46:55 +00:00
nobu 20061dad6a error.c: Crash Report log
* error.c (REPORTBUG_MSG): mention about Crash Report log file on
  MacOS X.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-12 02:25:30 +00:00
kazu bd950a75b5 * error.c: [DOC] Exception#cause may return nil. [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-03 03:05:51 +00:00
zzak 16220d9abb * error.c: [DOC] Document Exception#cause by @jasonrclark [ci skip]
[Fixes GH-519] https://github.com/ruby/ruby/pull/519


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-31 21:31:12 +00:00
ko1 0aed7c6874 * error.c: add Exception#backtrace_locations.
Now, there are no setter and independent from Exception#backtrace.
  [Feature #8960]
* eval.c (setup_exception): set backtrace locations for `bt_location'
  special attribute.
* vm_backtrace.c (rb_backtrace_to_location_ary): added.
* internal.h: ditto.
* test/ruby/test_backtrace.rb: add a test for
  Exception#backtrace_locations.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-13 04:31:06 +00:00
nobu b050cc5ab9 error.c: Exception#cause
* error.c (exc_cause): captured previous exception.
* eval.c (make_exception): capture previous exception automagically.
  [Feature #8257]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43636 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-10 13:16:33 +00:00
ko1 c5e08b764e * add RUBY_TYPED_FREE_IMMEDIATELY to data types which only use
safe functions during garbage collection such as xfree().
  On default, T_DATA objects are freed at same points as fianlizers.
  This approach protects issues such as reported by [ruby-dev:35578].
  However, freeing T_DATA objects immediately helps heap usage.
  Most of T_DATA (in other words, most of dfree functions) are safe.
  However, we turned off RUBY_TYPED_FREE_IMMEDIATELY by default
  for safety.
* cont.c: ditto.
* dir.c: ditto.
* encoding.c: ditto.
* enumerator.c: ditto.
* error.c: ditto.
* file.c: ditto.
* gc.c: ditto.
* io.c: ditto.
* iseq.c: ditto.
* marshal.c: ditto.
* parse.y: ditto.
* proc.c: ditto.
* process.c: ditto.
* random.c: ditto.
* thread.c: ditto.
* time.c: ditto.
* transcode.c: ditto.
* variable.c: ditto.
* vm.c: ditto.
* vm_backtrace.c: ditto.
* vm_trace.c: ditto.
* ext/bigdecimal/bigdecimal.c: ditto.
* ext/objspace/objspace.c: ditto.
* ext/stringio/stringio.c: ditto.
* ext/strscan/strscan.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-29 11:16:54 +00:00
nobu 6cb24cee64 error.c: remove NameError#to_s
* error.c (name_err_to_s): remove no longer needed overriding, since
  r30455 which made exc_to_s almost same.  Fixes [GH-413].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-28 04:17:20 +00:00
nobu c6b9f2913a internal.h: rb_syserr_fail_path
* error.c (rb_syserr_fail_path_in): new function split from
  rb_sys_fail_path_in to raise SystemCallError without errno.
* internal.h (rb_syserr_fail_path): like rb_sys_fail_path but without
  errno.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-20 06:29:06 +00:00
ko1 f9718bf703 * error.c (rb_bug_reporter_add): return simply 0 if failed.
Please check return value.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-16 20:32:28 +00:00
ko1 955a38da08 * error.c, internal.h (rb_bug_reporter_add): add a new C-API.
rb_bug_reporter_add() allows to register a function which
  is called at rb_bug() called.
* ext/-test-/bug_reporter/bug_reporter.c: add a test for this C-API.
* ext/-test-/bug_reporter/extconf.rb: ditto.
* test/-ext-/bug_reporter/test_bug_reporter.rb: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-16 08:39:39 +00:00
naruse 61837409e0 Revert r42800 "* error.c: [DOC] Update bug tracker url by @ScotterC [Fixes GH-390]"
It should be fixed on www.ruby-lang.org side.
* [Bug #8854]
* ruby/www.ruby-lang.org#288 https://github.com/ruby/www.ruby-lang.org/issues/288

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42803 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-03 08:20:48 +00:00
zzak 31bd386452 * error.c: [DOC] Update bug tracker url by @ScotterC [Fixes GH-390]
https://github.com/ruby/ruby/pull/390


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-03 05:38:48 +00:00
ktsj 00b8bd5c87 * error.c, object.c, ext/readline/README.ja: [DOC] $SAFE=4 is obsolete.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42609 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-18 10:36:54 +00:00
ktsj 04f0de74dd * error.c, file.c, gc.c, hash.c, thread.c, variable.c, vm_eval.c, bin/erb:
$SAFE=4 is obsolete.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-18 10:36:51 +00:00
nobu c81f8578c8 error.c: evaluate RARRAY_AREF once
* error.c (rb_check_backtrace): evaluate RARRAY_AREF only once.
  the first argument of RB_TYPE_P is expanded twice for non-immediate
  types.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-20 04:14:09 +00:00
shugo 1f828497d1 * safe.c (rb_set_safe_level, safe_setter): raise an ArgumentError
when $SAFE is set to 4.  $SAFE=4 is now obsolete.
  [ruby-core:55222] [Feature #8468]

* object.c (rb_obj_untrusted, rb_obj_untrust, rb_obj_trust):
  Kernel#untrusted?, untrust, and trust are now deprecated.
  Their behavior is same as tainted?, taint, and untaint,
  respectively.

* include/ruby/ruby.h (OBJ_UNTRUSTED, OBJ_UNTRUST): OBJ_UNTRUSTED()
  and OBJ_UNTRUST() are aliases of OBJ_TAINTED() and OBJ_TAINT(),
  respectively.

* array.c, class.c, debug.c, dir.c, encoding.c, error.c, eval.c,
  ext/curses/curses.c, ext/dbm/dbm.c, ext/dl/cfunc.c,
  ext/dl/cptr.c, ext/dl/dl.c, ext/etc/etc.c, ext/fiddle/fiddle.c,
  ext/fiddle/pointer.c, ext/gdbm/gdbm.c, ext/readline/readline.c,
  ext/sdbm/init.c, ext/socket/ancdata.c, ext/socket/basicsocket.c,
  ext/socket/socket.c, ext/socket/udpsocket.c,
  ext/stringio/stringio.c, ext/syslog/syslog.c, ext/tk/tcltklib.c,
  ext/win32ole/win32ole.c, file.c, gc.c, hash.c, io.c, iseq.c,
  load.c, marshal.c, object.c, proc.c, process.c, random.c, re.c,
  safe.c, string.c, thread.c, transcode.c, variable.c,
  vm_insnhelper.c, vm_method.c, vm_trace.c: remove code for
  $SAFE=4.

* test/dl/test_dl2.rb, test/erb/test_erb.rb,
  test/readline/test_readline.rb,
  test/readline/test_readline_history.rb, test/ruby/test_alias.rb,
  test/ruby/test_array.rb, test/ruby/test_dir.rb,
  test/ruby/test_encoding.rb, test/ruby/test_env.rb,
  test/ruby/test_eval.rb, test/ruby/test_exception.rb,
  test/ruby/test_file_exhaustive.rb, test/ruby/test_hash.rb,
  test/ruby/test_io.rb, test/ruby/test_method.rb,
  test/ruby/test_module.rb, test/ruby/test_object.rb,
  test/ruby/test_pack.rb, test/ruby/test_rand.rb,
  test/ruby/test_regexp.rb, test/ruby/test_settracefunc.rb,
  test/ruby/test_struct.rb, test/ruby/test_thread.rb,
  test/ruby/test_time.rb: remove tests for $SAFE=4.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-12 14:20:51 +00:00
akr bd15d4ca78 * internal.h (numberof): Gathered from various files.
* array.c, math.c, thread_pthread.c, iseq.c, enum.c, string.c, io.c,
  load.c, compile.c, struct.c, eval.c, gc.c, parse.y, process.c,
  error.c, ruby.c: Remove the definitions of numberof.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-07 10:01:19 +00:00
nobu 6db56c86c9 fill rdocs
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-02 03:12:04 +00:00
nobu e71d501ee0 error.c: better names for rb_exc_new family
* error.c (rb_exc_new_cstr): rename from rb_exc_new2.
* error.c (rb_exc_new_str): rename from rb_exc_new3.

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



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



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 09:56:22 +00:00
nobu fa93be2f05 * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-08 20:27:01 +00:00
headius 0626d9b91c Fix #6154 by introducing new EAGAIN/EWOULDBLOCK/EINPROGRESS
subclasses that include WaitReadable or WaitWritable rather than
extending them into the exception object each time.

* error.c: Capture EGAIN, EWOULDBLOCK, EINPROGRESS exceptions and
  export them for use in WaitReadable/Writable exceptions.
* io.c: Create versions of EAGAIN, EWOULDBLOCK, EINPROGRESS that
  include WaitReadable and WaitWritable. Add rb_readwrite_sys_fail
  for nonblocking failures using those exceptions. Use that
  function in io_getpartial and io_write_nonblock instead of
  rb_mod_sys_fail
* ext/openssl/ossl_ssl.c: Add new SSLError subclasses that include
  WaitReadable and WaitWritable. Use those classes for
  write_would_block and read_would_block instead of rb_mod_sys_fail.
* ext/socket/ancdata.c: Use rb_readwrite_sys_fail instead of
  rb_mod_sys_fail in bsock_sendmsg_internal and
  bsock_recvmsg_internal.
* ext/socket/init.c: Use rb_readwrite_sys_fail instead of
  rb_mod_sys_fail in rsock_s_recvfrom_nonblock and
  rsock_s_connect_nonblock.
* ext/socket/socket.c: Use rb_readwrite_sys_fail instead of
  rb_mod_sys_fail in sock_connect_nonblock.
* include/ruby/ruby.h: Export rb_readwrite_sys_fail for use instead
  of rb_mod_sys_fail. Introduce new constants RB_IO_WAIT_READABLE and
  RB_IO_WAIT_WRITABLE for first arg to rb_readwrite_sys_fail.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-08 19:58:55 +00:00
nobu c7c3a275f3 error.c: rb_sys_fail_path_in
* error.c (syserr_initialize): add optional function name.

* error.c (rb_sys_fail_path_in): rename and move from file.c, and pass
  func_name to SystemCallError#initialize.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-15 11:19:56 +00:00
zzak 47809f0934 * error.c: clarify reason for sleep in SignalException example
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-25 19:52:11 +00:00
kosaki ffbd120efd * error.c: clarify a document of SignalException. Process.kill()
doesn't have any guarantee when signal will be delivered.
  [Bug #7951] [ruby-core:52864]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-25 18:43:41 +00:00
marcandre c34e9f23aa * object.c: Improve error for failed implicit conversions [Bug #7539]
* error.c: Adapt rdoc

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

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-29 22:00:58 +00:00
nobu 320b49473e error.c: rb_write_error_str
* error.c (compile_err_append, compile_warn_print, warn_print): use
  rb_write_error_str() instead of writing to rb_stderr directly.
* io.c (rb_write_error_str): a stopgap measure not to unblock GVL.
  warning from require seems to still have race condition errors.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-25 04:38:18 +00:00
nobu d2fa4d7118 error.c: NameError::message _dump
* error.c (name_err_mesg_dump): adapt argument number.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38584 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-24 15:58:15 +00:00
nobu 427bcc40ac error.c: VALUE to messages
* error.c (name_err_mesg_to_str, syserr_initialize): use VALUE to
  format messages.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-24 15:57:51 +00:00
nobu e9381c0559 * error.c (rb_compile_error_append): fix typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-23 22:23:52 +00:00
nobu 1df33a4a5f error.c: PRIsVALUE
* error.c (rb_compile_error, rb_compile_warn, rb_compile_warning),
  (rb_warn, rb_warning): support PRIsVALUE.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-22 14:59:21 +00:00
nobu 5a5a86cc52 hash.c: refine error messages
* hash.c (rb_hash_s_create): refine error messages.
* error.c (rb_builtin_class_name): share for above.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-11 06:38:17 +00:00
shugo a1ed68b931 * error.c (exc_to_s, name_err_to_s, name_err_mesg_to_str): do not
taint messages.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-02 17:25:10 +00:00
nobu 0ff0133984 fix typo
* error.c (rb_builtin_type_name): fix typo.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36442 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-18 09:25:18 +00:00
nobu 6e018e3f49 error.c: map by index
* error.c (rb_builtin_type_name): map by index.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-18 08:45:29 +00:00
nobu 13bc74fa74 rb_builtin_type_name
* error.c (rb_builtin_type_name): extract from rb_check_type() for
  debug purpose.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36249 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-29 02:26:46 +00:00
nobu 77898c33e3 error.c: rb_check_copyable
* error.c (rb_check_copyable): new function, to ensure the target is
  not frozen and the source is not tainted nor untrusted.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-22 04:32:39 +00:00
ko1 0cfee32828 * error.c (err_append): rename err_append() to compile_err_append()
and move definition body.  err_append() is used only by compiling.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-20 22:25:46 +00:00
drbrain 9e84f83736 * error.c (exc_set_backtrace): Updated documentation to indicate
set_backtrace allows a string as well as an array of strings.
  [ruby-trunk - Bug #6501]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-29 21:20:45 +00:00
nobu 80aaa3ef6c sprintf.c: inspect by plus
* sprintf.c (ruby__sfvextra): [EXPERIMENTAL] use inspect instead of
  to_s if plus flag is given.
* vsnprintf.c (BSD_vfprintf): pass sign flag.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-24 16:15:42 +00:00
nobu ce8e2d5404 Feature #5896
* vsnprintf.c (BSD_vfprintf): [EXPERIMENTAL] object representation in
  rb_enc_vsprintf(). [Feature #5896]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-24 14:36:54 +00:00
ko1 d5893b91fa * vm_method.c (rb_method_defined_by): removed.
nobu pointed out that rb_method_basic_definition_p() is enough
  for last commit.
* error.c, eval_error.c: change for above.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-24 06:36:44 +00:00
ko1 3dcebce523 * vm.c: add RubyVM::Backtrace object (btobj).
Backtrace information contains an array consists of location
  information for each frames by string.
  RubyVM::Backtrace object is lightweight backtrace information,
  which contains complete information to generate traditional style
  backtrace (an array of strings) with faster generation.
  If someone accesses to backtrace information via
  Exception#backtrace, then convert a RubyVM::Backtrace object to
  traditonal style backtrace.
  This change causes incompatibility on marshal dumpped binary
  of Exception.  If you have any trouble on it, please tell us
  before Ruby 2.0 release.
  Note that RubyVM::Backtrace object should not expose Ruby level.
* error.c, eval.c, vm_eval.c: ditto.
* internal.h: ditto.
* eval_error.c: fix to skip "set_backtrace" method invocation in
  creating an exception object if it call a normal set_backtrace
  method (defined by core).
* test/ruby/test_settracefunc.rb: fix for above change.
* vm_method.c (rb_method_defined_by): added.  This function
  checks that the given object responds with the given method
  by the given cfunc.
* benchmark/bm_vm2_raise1.rb, benchmark/bm_vm2_raise2.rb:
  add to measure exception creation speed. raise1 create
  exception objects from shallow stack frame.  raise2 create
  exception objects from deep stack frame.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-24 06:09:23 +00:00
nobu b0dd250dc9 use RB_TYPE_P() instead of comparison of TYPE()
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-23 07:13:21 +00:00
nobu 72fffe5cee * configure.in (RUBY_MSVCRT_VERSION): define on mingw too.
* win32/Makefile.sub (config.h): prefix RT_VER with RUBY and make
  more descriptive to get rid of potential conflict.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-16 07:08:27 +00:00
nobu 24476c0c0b * eval_error.c (error_print): use RB_TYPE_P instead of TYPE.
* error.c (rb_check_backtrace): ditto.
* error.c (name_err_mesg_to_str): compare immediate values
  directly.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35319 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-13 15:34:34 +00:00
nobu f45fc7daa0 * error.c (rb_enc_raise): new function to raise an exception with
the message in the given encoding.  patched by now (Nikolai
  Weibull) at [ruby-core:41160].  [Feature #5650]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-10 10:07:07 +00:00
nobu 075d98c7dc * error.c (rb_load_fail): should honor encoding.
* load.c (load_failed): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-07 07:30:31 +00:00
nobu 72de92d1f9 rb_load_fail
* error.c (rb_load_fail): use path as a string, not char*.
* internal.h: (rb_load_fail): moved from ruby/intern.h.
* ruby.c (load_file_internal): fname cannot be NULL.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-07 03:26:30 +00:00
tenderlove d576a25c26 * error.c (rb_loaderror_with_path): Adding the missing file as an
instance variable to the LoadError exception.

* load.c: call rb_loaderror_with_path so that the missing path is
  added to the exception.

* ruby.c: call rb_loaderror rather than raising our own LoadError
  exception.

* include/ruby/intern.h: add declaration for rb_loaderror_with_path.

* test/ruby/test_require.rb: add supporting test for LoadError#path
  method.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-06 23:38:33 +00:00
naruse d068ac8e0c * error.c (report_bug): use buf and snprintf to avoid consuming stack.
[ruby-dev:45272] [Bug #6058]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34817 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-25 20:37:15 +00:00
nobu 85738261a5 * dir.c (dir_initialize): keep path in original encoding.
* error.c (syserr_initialize): prefer the encoding of message over
  locale.  [ruby-dev:45279][Bug #6071]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-24 22:53:42 +00:00
nobu 7d742d47cc * error.c: new functions to deal exceptions with string instances.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34787 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-24 07:39:59 +00:00
ayumin 89a2a10508 * error.c (exc_inspect): Fix typo. patch from Trent Ogren
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-07 11:13:40 +00:00
nagachika 15e1ff7f23 * error.c (exc_equal): clear rb_thread_t::errinfo when ignore
an exception under rb_protect(). [ruby-core:41979] [Bug #5865]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-14 09:36:18 +00:00
nobu f2aa0fd5d4 * error.c (exc_equal): ignore exceptions during implicit
conversion.  [ruby-core:41979] [Bug #5865]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-14 03:00:24 +00:00
naruse 1648e9442d Revert "* error.c (exc_equal): try implicit conversion for delegator."
This reverts commit r34291 because it breaks objects whose "exception"
method doesn't allow no argument like XMLRPC::FaultException class.
To reproduce: `RuntimeError.new == XMLRPC::FaultException`.
[ruby-core:41979] [Bug #5865]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-13 23:41:55 +00:00
nobu a5bfe7ca83 * error.c (exc_equal): try implicit conversion for delegator.
[ruby-core:41979] [Bug #5865]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34291 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-13 07:44:50 +00:00
nagachika d95ce7fc03 * error.c (builtin_type_name): don't return pointer to the buffer of
temporary String object.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-15 14:19:59 +00:00
nobu 2a5ddef59f * error.c (rb_check_type): fix typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-15 08:40:29 +00:00
nobu 9dccfb5513 * error.c (rb_check_typeddata): refine error message with
including expected struct name.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-15 05:33:34 +00:00
nagachika d61d9d5e8e * error.c (name_err_mesg_to_str): clear rb_thread_t::errinfo when
ignore exception under rb_protect().

* test/ruby/test_exception.rb (test_exception_in_name_error_to_str):
  add a corresponding test.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34028 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-13 14:50:12 +00:00
nobu ea82d4809d * error.c (exit_initialize): deal with true and false as well as
Kernel#exit.  [ruby-dev:44951] [Bug #5728]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-11 01:48:21 +00:00
akr 63fe8b697c update doc and add test for SystemExit.new.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-08 13:50:10 +00:00
drbrain 34fb36422d * error.c (Init_Exception): Document $! and $@. Provide
recommendations for creating exceptions for a library.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-19 02:52:38 +00:00
drbrain 62bd3dd4af * error.c (Init_Exception): Add hierarchy of Exception subclasses.
Based on patch by Sylvain Daubert.  [Ruby 1.9 - Bug #5438]


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

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-29 11:07:45 +00:00
kosaki 3abbda4f6e * error.c (report_bug): use a small message buffer instead of BUFSIZ.
It is needed for avoiding nested SIGSEGV on Linux.
  Note: BUFSIZ is not proper buffer size. It's unrelated with maximum
  filename length. :-/
  [Bug #5139] [ruby-dev:44315]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-04 11:23:16 +00:00
nobu 4dc1a21809 * error.c (rb_name_error_str): new function to raise NameError
with the name string but not ID.
* object.c, proc.c, variable.c: more removal of inadvertent symbol
  creation.  [Feature #5079]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-23 15:05:03 +00:00
nobu e2fd80b3d3 * error.c (rb_check_trusted): new function to check an object is
trusted.
* struct.c (rb_struct_modify), time.c (time_modify): check by the
  above function to show proper class names.  [Bug #5036]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-17 07:26:45 +00:00
nobu 18f0a65018 * error.c (rb_warn_m): accept multiple args in like puts. rdoc
patch by Erik Price at [ruby-core:38119].  [Feature #5029]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-17 06:30:10 +00:00
nobu 9878d2199c * error.c (rb_bug): get rid of segfault after all threads
disposed.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-08 06:53:33 +00:00
nobu 8ad06e2604 * error.c, thread_pthread.c (WRITE_CONST): suppress warnings
`ignoring return value'.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-30 23:03:23 +00:00
drbrain 9802a3e7de * lib/cmath.rb: Hide handle_no_method_error from RDoc.
* error.c:  Document or hide undocumented error classes.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-30 00:22:32 +00:00
ko1 c22126755c * error.c (rb_async_bug_errno): async-safe bug report function.
In timer thread, signal handler shoul use it.
  The patch is contributed by Eric Wong <normalperson@yhbt.net>.
  Refs: [ruby-core:37644] and [ruby-core:37647]
* thread_pthread.c: use rb_async_bug_errno().
  And replace all fprintf() to write().
* internal.h (rb_async_bug_errno): add decl. of above func.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-28 21:17:29 +00:00
akr e7996eb3cc * internal.h: declare internal functions here.
* node.h: declare NODE dependent internal functions here.

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

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

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

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



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-17 22:43:38 +00:00
nobu e7c0a6e1d7 * prevent temporary objects from GC, and should not use
RSTRING_PTR() for function calls since it evaluates the argument
  a couple of times.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-20 07:23:55 +00:00
nobu 97b8e4996f * error.c (rb_invalid_str): prevent intermediate variable from GC.
[ruby-core:34820]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-24 12:04:47 +00:00
ryan 36a0e432f2 Exception#to_s should actually call to_s.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-12 22:05:05 +00:00
ryan 89d6841175 Error#to_s should ensure that the value returned is a string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-05 05:18:48 +00:00
usa 90d5bcf910 * re.c (rb_reg_expr_str): need to escape if the coderage is invalid.
* error.c, include/ruby/intern.h (rb_compile_error_with_enc): new
	  function to raise syntax error, with source encoding'ed message.

	* parse.y (compile_error): use above function.
	  [ruby-core:33951] (#4217)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-28 09:43:49 +00:00
nobu c5a19b38af * error.c (rb_check_type): check for type from extensions for ruby
1.8.  see [ruby-core:33797].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-23 02:00:12 +00:00
kosaki 12b8ff1f46 * error.c: Fix build error for win32. This regression was
introduced by r30271.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-20 15:40:07 +00:00
kosaki 7503f19346 * error.c (exit_success_p): Check status code more carefully.
status code may have garbage in upper bit.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-20 14:49:18 +00:00
akr c4442536b2 * encoding.c: parenthesize macro arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-12 02:54:23 +00:00
nobu b3c7867df7 * error.c (rb_syserr_new): new function to make SystemCallError
instance without errno.  [EXPERIMENTAL]
* error.c (rb_syserr_fail, rb_mod_syserr_fail): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-08 22:30:20 +00:00
nobu 58d3597e74 * include/ruby/intern.h (rb_check_frozen): optimize.
[ruby-core:32878]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-24 08:05:55 +00:00
nobu d410639a6d * compile.c (iseq_build_body), error.c (set_syserr, get_syserr),
(syserr_initialize), gc.c (define_final, rb_gc_copy_finalizer),
  (run_final), hash.c (rb_hash_aref, rb_hash_lookup2),
  (rb_hash_fetch_m, rb_hash_clear, rb_hash_aset, eql_i),
  iseq.c (iseq_load, iseq_data_to_ary), marshal.c (r_symlink),
  thread.c (rb_thread_local_aref),
  variable.c (generic_ivar_remove, ivar_get, rb_const_get_0),
  (rb_cvar_get), vm.c (rb_vm_check_redefinition_opt_method),
  vm_insnhelper.c (vm_get_ev_const), vm_method.c (remove_method),
  ext/iconv/iconv.c (map_charset): use st_data_t.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-12 14:47:23 +00:00
naruse 681e551369 * error.c (exc_to_s): use OBJ_INFECT.
* error.c (name_err_to_s): ditto.

* error.c (name_err_mesg_to_str): ditto.

* error.c (syserr_initialize): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-12 12:39:22 +00:00
naruse 628c802eae * error.c (syserr_initialize): taint message if mesg is given
and it is tainted.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-12 10:09:31 +00:00
naruse c1b24588d3 * error.c (syserr_initialize): use mesg's encoding when locale
encoding is US-ASCII. If locale encoding is not US-ASCII,
  assume err has non ASCII characters. [ruby-dev:42358]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-11 08:43:31 +00:00
naruse 44691b901e * error.c (syserr_initialize): set the encoding of Errno::*#message
as locale. [ruby-dev:42358]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29438 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-11 05:15:03 +00:00
nobu 25b9eb5e57 * include/ruby/ruby.h (rb_data_type_t): restructured. [ruby-dev:41862]
add parent member.

* error.c (rb_typeddata_inherited_p): new function.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-18 07:31:54 +00:00
usa de26eababa * error.c (rb_bug): existance of _set_abort_behavior() depends on
runtime version, not compiler version.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-16 06:41:56 +00:00
akr d81b2491f7 * error.c (rb_name_err_mesg_new): guard mesg, recv and method.
The problem in [ruby-dev:41464] is caused because mesg is collected.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-05 02:01:29 +00:00
nobu 45f6fbf339 * removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-29 18:51:39 +00:00
tarui 47000e8aeb * error.c (rb_bug): suppress the error report dialog if report_bug()
is finished successfly.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-27 15:53:42 +00:00
akr 0344bece9f * error.c: fix wrong exception class name in rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27994 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-24 14:05:33 +00:00
marcandre c1ecff1b1e * hash.c: Documentation: change => in call-seq to ->.
* enum.c: Documentation: whitespace fix for r27865

* error.c: ditto

* file.c: ditto

* io.c: ditto

* load.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-17 21:31:22 +00:00
marcandre 7729de4d91 * array.c: Documentation: change => in call-seq to ->.
Harmonize "#=>" in examples. [ruby-core:30206]

* bignum.c: ditto

* class.c: ditto

* compar.c: ditto

* cont.c: ditto

* dir.c: ditto

* encoding.c: ditto

* enum.c: ditto

* enumerator.c: ditto

* error.c: ditto

* eval.c: ditto

* file.c: ditto

* gc.c: ditto

* io.c: ditto

* load.c: ditto

* marshal.c: ditto

* math.c: ditto

* numeric.c: ditto

* object.c: ditto

* pack.c: ditto

* proc.c: ditto

* process.c: ditto

* random.c: ditto

* range.c: ditto

* re.c: ditto

* ruby.c: ditto

* signal.c: ditto

* sprintf.c: ditto

* string.c: ditto

* struct.c: ditto

* thread.c: ditto

* time.c: ditto

* transcode.c: ditto

* variable.c: ditto

* vm_eval.c: ditto

* vm_method.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-17 21:07:33 +00:00
nobu 40caeb6bd1 * error.c (rb_loaderror): use locale string, not ascii-8bit.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-16 04:55:29 +00:00
marcandre 4afa9ed041 * array.c: Harmonize documentation, in particular regarding:
- methods returning enumerators
    - array methods and argument naming (array -> ary, an_array -> new_ary)
    - minor improvements, typo fixed and styling issues

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

* dir.c: ditto.

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

* error.c: ditto.

* gc.c: ditto.

* hash.c: ditto.

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

* numeric.c: ditto.

* range.c: ditto.

* string.c: ditto.

* struct.c: ditto.

* vm_eval.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-13 05:49:55 +00:00
marcandre 1dee5e34a3 * error.c: RDoc for subclasses of Exception. [ruby-core:28394]
* cont.c: ditto

* enumerator.c: ditto

* io.c: ditto

* math.c: ditto

* numeric.c: ditto

* proc.c: ditto

* re.c: ditto

* thread.c: ditto

* transcode.c: ditto. Thanks to Run Paint for some of the documentation.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-08 04:50:09 +00:00
nobu e8249be9fc * error.c (name_err_mesg_to_str): preserve encoding of inspection.
[ruby-core:29948]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27615 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-04 09:51:27 +00:00
akr 8f5865e251 * error.c: include errno.h at beginning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-24 12:26:06 +00:00
akr ff9d908832 * include/ruby/ruby.h (rb_bug_errno): declared.
* include/ruby/intern.h (rb_strerrno): declaration removed.

* error.c (rb_strerrno): make it static.  return NULL for unknown
  errors.
  (rb_bug_errno): defined.

* thread_pthread.c: use rb_bug_errno.

* signal.c (ruby_signal): use rb_bug_errno.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-24 11:03:51 +00:00
nobu d7ffefb405 * error.c (rb_strerrno): constified.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-24 01:00:02 +00:00
akr 3861ba9f49 * error.c (rb_strerrno): return "UNKNOWNERROR" for non-zero unknown
error.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25895 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-24 00:50:26 +00:00
akr 3302b8fff5 * include/ruby/intern.h (rb_strerrno): declared.
* template/known_errors.inc.tmpl: generate defined_error() and
  undefined_error() instead of set_syserr.

* error.c (Init_syserr): define defined_error() and undefined_error()
  to follow the above change.
  (rb_strerrno): defined.

* thread_pthread.c: show error message and errno macro name with
  rb_bug.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-24 00:26:52 +00:00
matz 0580ba0611 * array.c (rb_ary_to_ary): do not use #respond_to? to detect
to_ary.  Just call.  [ruby-core:23738]

* eval.c (rb_check_funcall): new function with method existence
  check.  returns Qundef when the method does not exist.

* enumerator.c (enumerator_rewind): just call method, using
  rb_check_funcall().  [ruby-core:23738]

* error.c (exc_equal): ditto.

* object.c (convert_type): ditto.

* error.c (rb_name_err_mesg_new): export function.

* eval.c (make_exception): ditto.

* io.c (pop_last_hash): return early when the last argument is nil.

* io.c (rb_io_puts): treat T_STRING specially for small
  optimization. 

* vm_eval.c (raise_method_missing): skip method call if possible
  using rb_method_basic_definition_p().

* vm_eval.c (method_missing): ditto.

* test/ruby/test_rubyoptions.rb (TestRubyOptions#test_debug): test
  suites changed to ignore exceptions caused by just-call policy.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-29 04:55:10 +00:00
nobu 355047fb49 * error.c (name_err_mesg_data_type): typed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-09 02:55:09 +00:00
nobu 081625d16e * error.c (compile_warn_print, warn_print): fixed false warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-09 22:18:55 +00:00
nobu a7c32bf81d * error.c (rb_check_type): rejects typed data.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-08 10:10:28 +00:00
ko1 9e60743008 * include/ruby/ruby.h:
rename
  "...TypeStruct" and "typed_struct" to
  "TypedData..." and "typeddata", respectively.
  rename
  rb_data_type_t#name to
  rb_data_type_t#wrap_struct_name.
* error.c, gc.c, iseq.c, vm.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23987 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-07 20:28:27 +00:00
nobu ac3c2866c7 * error.c (rb_typed_struct_is_kind_of): new function to see if the
given typed struct.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23983 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-07 07:54:28 +00:00
nobu 7bb9cc23a1 * error.c (rb_check_typed_struct): new function to check typed
struct.

* include/ruby/ruby.h (Check_TypedStruct, Data_Get_TypedStruct):
  new macro to check typed struct.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-07 04:44:54 +00:00
nobu 4c79d4bee2 * include/ruby/intern.h (rb_exc_new2): optimization for literal.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23615 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-01 01:41:43 +00:00
nobu b55ff99891 * error.c (syserr_initialize): errno is int.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-24 13:39:35 +00:00
akr c4049f4cb6 * io.c (rb_mWaitReadable): defined.
(rb_mWaitWritable): defined.
  (io_getpartial): extend IO::WaitReadable on EWOULDBLOCK and EAGAIN.
  (rb_io_write_nonblock): extend IO::WaitWritable on EWOULDBLOCK and
  EAGAIN.

* error.c (make_errno_exc): extracted from rb_sys_fail.
  (rb_mod_sys_fail): new function.

* include/ruby/ruby.h (rb_mod_sys_fail): declared.
  (rb_mWaitReadable): declared.
  (rb_mWaitWritable): declared.

* ext/socket/init.c (rsock_s_recvfrom_nonblock): extend
  IO::WaitReadable on EWOULDBLOCK and EAGAIN.
  (rsock_s_accept_nonblock): extend IO::WaitReadable on EWOULDBLOCK,
  EAGAIN, ECONNABORTED and EPROTO.

* ext/socket/socket.c (sock_connect_nonblock): extend IO::WaitWritable
  on EINPROGRESS.

* ext/socket/ancdata.c (bsock_sendmsg_internal): extend
  IO::WaitWritable on EWOULDBLOCK and EAGAIN.
  (bsock_recvmsg_internal): extend IO::WaitReadable on EWOULDBLOCK and
  EAGAIN.

* ext/openssl/ossl_ssl.c (ossl_ssl_read_internal): raise SSLError
  extended by IO::WaitReadable/IO::WaitWritable on
  SSL_ERROR_WANT_READ/SSL_ERROR_WANT_WRITE.

* ext/openssl/ossl.c (ossl_make_error): extracted from ossl_raise.
  (ossl_exc_new): new function.

* ext/openssl/ossl.h (ossl_exc_new): declared.

* lib/net/protocol.rb (rbuf_fill): rescue IO::WaitReadable and
  IO::WaitWritable.

  [ruby-core:22539], [ruby-dev:38140] 



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-19 11:40:38 +00:00
nobu 402b8f5de9 * error.c (report_bug): rb_bug can be caused by extension
libraries.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-18 03:48:03 +00:00
nobu d1abc53721 * array.c, bignum.c, dln.c, error.c, gc.c, io.c, marshal.c,
numeric.c, pack.c, strftime.c, string.c, thread.c, transcode.c,
  transcode_data.h, util.c, variable.c, vm_dump.c,
  include/ruby/encoding.h, missing/crypt.c, missing/vsnprintf.c:
  suppress VC type warnings.  [ruby-core:22726]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-12 09:16:15 +00:00
matz 36f56996ab * error.c (report_bug): message updated to better English.
[ruby-core:22665]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-06 06:00:41 +00:00
nobu 12d2c8ba41 stripped trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 14:23:33 +00:00
ko1 8d1689508d * error.c, vm_dump.c: change message by rb_bug().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-24 13:39:16 +00:00
ko1 7160543aeb * error.c (exc_equal): == method should not raise Exception.
[ruby-dev:37519]
* sample/test.rb: fix test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-24 12:02:21 +00:00
matz 00856f76f7 * error.c (exc_equal): duck typing equal to make it transitive.
[ruby-dev:34880]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-18 23:42:00 +00:00
nobu 1da55b38fa * error.c (Init_syserr): moved function definition itself from
template/known_errors.inc.tmpl.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-18 17:39:33 +00:00
matz b348ed3344 * error.c (exc_equal): should not compare recursively.
[ruby-dev:36796]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-20 11:18:50 +00:00
yugui e8ee99ff1a * dln.c: Ruby no longer supports VMS.
* error.c: ditto.

* eval.c: ditto.

* eval_intern.h: ditto.

* include/ruby/defines.h: ditto.

* include/ruby/ruby.h: ditto.

* io.c: ditto.

* process.c: ditto.

* ruby.c: ditto.

* vms/config.h: removed.

* vms/vms.h: ditto.

* vms/vmsruby_private.c: ditto.

* vms/vmsruby_private.h: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-04 13:57:06 +00:00
yugui 16c95b42ce * error.c (Init_syserr): moved to the template.
(errno_missing): removed. fixed [ruby-dev:35958].

* defs/knwon_errors.def: added. extracted from Init_syserr.

* templates/known_errors.inc.tmpl: added. Template for Init_syserr.
  c.f. [ruby-dev:35958].

* tools/generic_erb.rb: added. general purpose mapper which maps
  data+template into source code.

* common.mk (error.$(OBJEXT), incs, known_errors.inc):
  Fixed dependencies.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-26 08:18:49 +00:00
matz 3deb806a06 * error.c (Init_Exception): introduce EncodingError which is a
superclass for all encoding related exception classes,
  e.g. Encoding::CompatibilityError.  [ruby-dev:36371]

* transcode.c (Init_transcode): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-26 03:53:11 +00:00
matz d5ec36c486 * transcode.c: add "Error" suffix for Encoding exception classes.
a patch from Tadashi Saito <shiba at mail2.accsnet.ne.jp> in
  [ruby-dev:36346].

* encoding.c (Init_Encoding): rename EncodingCompatibilityError to
  Encoding::CompatibilityError.  [ruby-dev:36366]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-18 08:57:33 +00:00
naruse 85c41f4fbc * error.c (rb_eEncCompatError): add Exception.
* include/ruby/ruby.h: ditto.

* encoding.c (rb_enc_check): use rb_eEncCompatError.

* string.c (rb_enc_cr_str_buf_cat): ditto.

* string.c (rb_str_sub_bang): ditto.

* string.c (rb_str_hex): ditto.

* string.c (rb_str_oct): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-12 18:17:05 +00:00
nobu 0acca9a826 * compile.c (insn_data_to_s_detail), file.c (rb_stat_inspect),
iseq.c (ruby_iseq_disasm_insn, ruby_iseq_disasm),
  process.c (pst_message), re.c (match_inspect): use rb_str_catf.

* dir.c (dir_inspect), iseq.c (iseq_inspect, insn_operand_intern): use
  rb_sprintf.

* error.c (rb_name_error, rb_raise, rb_loaderror, rb_fatal): use
  rb_vsprintf.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-22 08:53:34 +00:00
mame 5874de95e8 * Add coverage measurement constant COVERAGE__. This constant is not
for casual use.  Usage: (1) assign {} to COVERAGE__, (2) require or
  load Ruby source file, and (3) COVERAGE__["sourcefilepath"] will
  return an array whose elements represent number of executions per
  line of source code.

* vm_core.h: add field of coverage array to iseq.

* iseq.c (prepare_iseq_build): ditto.

* insns.def (trace): update coverage array.

* parse.y (coverage): create and initialize coverage array.

* compile.h (ADD_TRACE): add trace instruction to update covearge
  array.

* thread.c (clear_coverage): delete coverage array when forking.
  Otherwise, double count of coverage may occur.

* lib/coverage.rb: sample coverage measurement tool.

* error.c: distinguish explicitly between parse_in_eval and
  mild_compile_error.

* load.c: ditto.

* vm_eval.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-01 16:55:30 +00:00
nobu 5a647a3f5f * include/ruby/ruby.h (CONST_ID): constant ID cache for non-gcc.
* *.c: no cache in init functions.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-09 09:25:32 +00:00
matz 582da7dac7 * error.c (exc_equal): == operator should be transitional.
[ruby-dev:34808]

* error.c (syserr_eqq): === should be able to handle delegated
  objects as well.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-24 13:39:57 +00:00
nobu c7451eb725 * error.c (builtin_types), gc.c (count_objects): added Complex and
Rational.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-26 08:42:34 +00:00
nobu 52ee839409 * error.c (rb_eNOERROR): renamed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-26 08:35:23 +00:00
nobu e615e3ce30 * error.c (builtin_types), signal.c (siglist), st.c (primes),
struct.c (ref_func), time.c (months): constified.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-26 08:30:22 +00:00
akr 861219ce4a fix doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-09 01:04:46 +00:00
akr 6cdef2dc7e * $Date$ keyword removed to avoid inclusion of locale dependent
string.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-06 15:49:38 +00:00
akr 5088b14db7 fix typos.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-31 06:43:32 +00:00
nobu 0d570142ba * error.c (ruby_description): fixed type.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-25 02:37:40 +00:00
nobu 81a68908cd * error.c (report_bug): uses ruby_description.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14644 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-25 02:33:54 +00:00
matz 7f018bde09 * error.c (Init_Exception): make NameError to be subclass of
StandardError again.

* error.c (Init_Exception): make SecurityError to be subclass of
  Exception, since it's too important to be handled implicitly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13802 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-02 06:28:52 +00:00
akr 5c0e68c39c * include/ruby/intern.h: export rb_ivar_foreach.
* include/ruby/ruby.h: modify struct RObject and RClass for optimizing
  T_OBJECT space.  [ruby-dev:31853]
  (ROBJECT_LEN, ROBJECT_PTR)
  (RCLASS_IV_TBL, RCLASS_M_TBL, RCLASS_SUPER, RCLASS_IV_INDEX_TBL)
  (RMODULE_IV_TBL, RMODULE_M_TBL, RMODULE_SUPER): abstract accessor
  defined.

* variable.c: support the modified RObject and RClass.

* object.c: ditto.

* class.c: ditto.

* gc.c: ditto.

* marshal.c: ditto.

* eval_method.ci: use the abstract accessor.

* insns.def: ditto.

* proc.c: ditto.

* struct.c: ditto.

* eval.c: ditto.

* error.c: ditto.

* vm.c: ditto.

* insnhelper.ci: ditto.

* ext/digest/digest.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-28 06:21:46 +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 a1c76bc3de * eval_error.ci (get_backtrace): check the result more.
[ruby-dev:31261] [ruby-bugs-12398]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12815 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-19 10:24:17 +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
nobu 46603a78af * include/ruby/{intern,ruby}.h, compile.[ch], error.c, eval.c,
eval_load.c, gc.c, iseq.c, main.c, parse.y, re.c, ruby.c,
  yarvcore.[ch] (ruby_eval_tree, ruby_sourcefile, ruby_sourceline,
  ruby_nerrs): purge global variables.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-05 08:12:18 +00:00
ko1 f58eb1e276 * eval.c: remove ruby_current_node and change eval() prototype.
fix to use rb_sourcefile/line() instead of ruby_sourcefile/line.
* error.c, eval_error.ci, eval_load.c, eval_safe.ci, gc.c,
  include/ruby/intern.h, parse.y, process.c, ruby.c: ditto.
* vm.c: fix spaces.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-24 20:33:04 +00:00
ko1 6bd0345627 * eval_*.h: rename to eval_*.ci.
* common.mk: ditto.
* eval_error.ci: remove ruby_set_current_source().
* error.c, eval.c, ruby.c: ditto.
* eval_safe.c, proc.c: remove unused macros.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-24 19:23: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
nobu 50e6933b09 * error.c, parse.y, ruby.h (rb_compile_warn, rb_compile_warning): warn
for compilation.  the parser should no longer use rb_warn() and
  rb_warning().  [ruby-dev:30121]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-01 21:45:48 +00:00
nobu f1796fdb2c * error.c (rb_notimplement), io.c (pipe_open): removed definite
articles and UNIX manual section from messages.  [ruby-dev:30690]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-04-04 15:42:16 +00:00
usa 7f8eb55d6c * error.c (rb_notimplement): should show the name of this func,
not callee.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12145 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-04-04 03:29:31 +00:00
matz 33163ad123 * regparse.c, etc.: K&R to ANSI code cleanup patch from Stefan
Huehner <stefan at huehner.org>.  [ruby-core:10543]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-03-19 03:58:57 +00:00
ko1 9c574383a4 * blockinlining.c, error.c, eval.c, eval_error.h, eval_intern.h,
eval_jump.h, eval_load.c, eval_safe.h, gc.c, proc.c, signal.c,
  thread.c, thread_pthread.ci, thread_win32.ci, vm.c, vm.h,
  vm_dump.c, vm_evalbody.ci, yarvcore.c, yarvcore.h:
  fix typo (rb_thead_t -> rb_thread_t).

* eval_intern.h: remove unused definitions.

* common.mk: fix around vm_opts.h path
  and remove harmful argument passed to insns2vm.rb.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-08 06:37:46 +00:00
ko1 44aef0b53f * this commit is a result of refactoring. only renaming functions,
moving definitions place, add/remove prototypes, deleting
  unused variables and removing yarv.h.
  This commit doesn't change any behavior of ruby/vm.
* yarv.h, common.mk: remove yarv.h (contents are moved to yarvcore.h).
* error.c, eval_intern.h: include yarvcore.h instead yarv.h
* rename some functions:
  * debug.[ch]: debug_*() -> ruby_debug_*()
  * iseq.c: iseq_*() -> rb_iseq_*(), ruby_iseq_disasm()
  * iseq.c: node_name() -> ruby_node_name()
  * vm.c: yarv_check_redefinition_opt_method() ->
    rb_vm_check_redefinition_opt_method()
* some refactoring with checking -Wall.
* array.c: remove rb_ary_ptr() (unused) and remove unused
  local variables.
* object.c: add a prototype of rb_mod_module_exec().
* eval_intern.h (ruby_cref): set it inline.
* eval_load.c (rb_load), yarvcore.c: yarv_load() -> rb_load_internal().
* parse.y: add a prototype of rb_parse_in_eval() (in eval.c).
* process.c: add a prototype of rb_thread_stop_timer_thread() (in thread.c).
* thread.c: remove raw_gets() function (unused) and fix some format
  mismatch (format mismatchs have remained yet. this is todo).
* thread.c (rb_thread_wait_fd_rw): fix typo on label name.
* thread_pthread.ci: comment out codes with USE_THREAD_CACHE.
* vm.c (rb_svar, rb_backref_get, rb_backref_get,
  rb_lastline_get, rb_lastline_set) : moved from yarvcore.c.
* vm.c (yarv_init_redefined_flag): add a prototype and rename
  yarv_opt_method_table to vm_opt_method_table.
* vm.c (rb_thread_eval): moved from yarvcore.c.
* yarvcore.c: remove unused global variables and fix to use nsdr().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-07 01:25:05 +00:00
ko1 8ee7d0767f * blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
  eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
  process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
  vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
  yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
  * yarv_*_t -> rb_*_t
  * yarv_*_struct -> rb_*_struct
  * yarv_tag -> rb_vm_tag
  * YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
  from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
  from proc.c to ruby.c.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 19:00:03 +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 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
matz c09cea5e1b * object.c (rb_mod_attr): make Module#attr to be an alias to
attr_reader.  [RCR#331]

* ruby.h: export classes/modules to implement sandbox.
  [ruby-core:08283]


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

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

* parse.y (parser_yylex): remove tLAMBDA_ARG.

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

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

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

* eval.c (rb_call0): ditto.

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

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

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

* eval.c (rb_proc_arity): ditto.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* time.c (time_add): ditto.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* array.c (rb_ary_flatten): ditto.

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

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

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

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

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

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

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

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

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


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-06-09 21:20:17 +00:00
matz 7f72360259 * parse.y (parser_parse_string): mention "regexp" in a error
message.  a patch from Mauricio Fernandez <mfp at acm.org>
  [ruby-core:07340]

* eval.c (rb_f_autoload): check if ruby_cbase is nil (during
  instance_eval for objects cannot have singleton classes,
  e.g. fixnums and symbols).  [ruby-dev:28178]

* gc.c (rb_gc_call_finalizer_at_exit): turn on during_gc while
  invoking finalizers.

* gc.c (rb_gc_finalize_deferred): ditto.

* io.c (rb_write_error2): use fwrite(3) if rb_stderr is not
  updated or is already freed.  [ruby-dev:28313]

* eval.c (error_line): include the class name of a surrounding
  method in error position description.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-02-13 04:53:22 +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 3284ccb55a banish a warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-28 03:51:52 +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 759a63b6a3 * parse.y (lambda): Perl6 style -> lambda expression. [NEW]
[VERY EXPERIMENTAL]

* gc.c (id2ref): must not assign pointers to long int.  use
  LONG_LONG instead if SIZEOF_LONG < SIZEOF_VOIDP.
  [ruby-talk:149645]

* ruby.h: use LONG_LONG to simplify the change.
  [ruby-talk:149645]

* dir.c (dir_each): rewinddir(3) before iteration.
  [ruby-talk:149628]

* eval.c (rb_f_throw): replace all '0x%lx' by '%p'.
  [ruby-talk:149553]

* missing/vsnprintf.c (BSD_vfprintf): '%p' need to handle 64bit
  size pointer.  [ruby-talk:149553]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-07-27 07:27:19 +00:00
nobu 6524f34a26 * sprintf.c (rb_vsprintf, rb_sprintf): new functions return new String,
using missing/vsnprintf.c.  [ruby-dev:26580]

*  missing/vsnprintf.c: made the output changeable.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-07-23 01:02:18 +00:00
matz 2201229b4a * variable.c (rb_class_path): need to adjust snprintf() len for
teminating NUL.  [ruby-dev:26581]

* error.c (syserr_initialize): don't use str before StringValue()
  check.  [ruby-dev:26579]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8807 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-07-20 01:08:13 +00:00
matz 7af1a11438 * error.c (syserr_initialize): add 1 byte for snprintf() size for
NUL at the end.  [ruby-dev:26574]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8802 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-07-19 14:59:01 +00:00
matz 30434d4078 * error.c (syserr_initialize): need to allocate an additional byte
for NUL at the end.  [ruby-dev:26574]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-07-19 13:52:42 +00:00
matz 2031602787 * signal.c (trap): remove sigexit(); handle "EXIT" via sig_exec().
[ruby-dev:26440]

* io.c (rb_io_inspect): replace sprintf() with "%s" format all
  over the place by snprintf() to avoid integer overflow.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-07-19 08:31:04 +00:00
matz db128e1b31 * bignum.c (bignorm): fixed a bug in normalizing negative numbers
reported from Honda Hiroki <hhonda@ipflex.com>.  normalizing
  should not trim preceding zeros from negative numbers.

* ext/socket/socket.c (ruby_getaddrinfo__aix): merged a patch from
  KUBO Takehiro <kubo@jiubao.org> to support AIX.  [ruby-list:40832]

* lib/yaml/rubytypes.rb (Array::to_yaml): merged a patch from
  Tilman Sauerbeck <tilman@code-monkey.de>.  [ruby-core:05055]

* lib/yaml/rubytypes.rb (Hash::to_yaml): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8589 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-06-07 16:33:01 +00:00
nobu a399253153 * error.c (exc_exception): reverted to call Exception#initialize
directly.  fixed: [ruby-dev:26177]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-05-18 14:43:03 +00:00
nobu 36e3983a27 * error.c (exc_exception, {exit,name_err,syserr}_initialize): call
Execption#initialize.  fixed: [ruby-talk:142593]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-05-14 14:59:53 +00:00
eban cd20570803 * error.c: typo fix.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-03-18 03:17:27 +00:00
nobu f109834b8c * error.c (errno_missing): add rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-03-15 14:53:17 +00:00
matz 2f2cc0ddfc * error.c (errno_missing): Errno.const_missing to allow references
to SyscallError exceptions not defined on the platform.
  [ruby-core:04522]

* error.c (Init_syserr): Errno::NOERROR(0) for fallback exception.

* eval.c (block_pass): should not push unique number if a block is
  not an orphan.  [ruby-dev:25808]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8112 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-03-08 01:46:33 +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
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
nobu 20beabcb68 * error.c (syserr_initialize): use stringified object.
[ruby-dev:24768]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-10 16:53:26 +00:00
matz 0c97c8e335 * hash.c (rb_hash_rehash): add iteration check. [ruby-dev:24301]
* st.c (st_foreach): add deep check.

* hash.c (rb_hash_fetch): returns KeyError instead of IndexError.

* hash.c (env_fetch): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-09-22 04:48:52 +00:00
matz 88ba175ab0 * bignum.c (rb_big_and): protect parameters from GC.
[ruby-talk:110664]

* error.c (exc_equal): exceptions are equal if they share same
  class, message and backtrace. [ruby-talk:110354]

* error.c (name_err_mesg_equal): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-08-28 14:14:11 +00:00
matz 1bd47bf0bc * eval.c (rb_call0): should call rb_call_super() directly for
visibility overriding.  [ruby-dev:23989]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-07-28 09:05:08 +00:00
matz ca14017bb6 * gc.c (define_final): should not disclose NODE* to Ruby world.
[ruby-dev:23957]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-07-23 07:52:38 +00:00
nobu 428228fe22 * error.c (exit_initialize): use EXIT_SUCCESS instead of 0.
[ruby-dev:23913]

* error.c (exit_success_p): new method SystemExit#success?.
  [ruby-dev:23912]

* error.c (syserr_initialize): initialization for subclasses.
  [ruby-dev:23912]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6644 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-07-16 02:17:59 +00:00
matz ce44928d2b * error.c (Init_Exception): remove Exception#to_str. [Ruby2]
* eval.c (error_print): should no call "to_str" anymore use
  "message" method instead.

* io.c (rb_f_open): Kernel#open() calls "to_open" if the first
  argument responds to it. [Ruby2]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-04-05 15:55:09 +00:00
nobu ec37ab2efe * version.c (ruby_show_copyright): obtain copyright year from
RUBY_RELEASE_YEAR.

* win32/resource.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-03-25 12:01:41 +00:00
matz ab6963043d * error.c (exc_initialize): calling 'to_str' each time just for
type checking is too heavy.  [ruby-core:02661]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-03-16 23:03:17 +00:00