summaryrefslogtreecommitdiff
path: root/missing/nan.c
diff options
context:
space:
mode:
Diffstat (limited to 'missing/nan.c')
-rw-r--r--missing/nan.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/missing/nan.c b/missing/nan.c
new file mode 100644
index 0000000000..686c48a336
--- /dev/null
+++ b/missing/nan.c
@@ -0,0 +1,28 @@
+#include "ruby/missing.h"
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+
+double
+nan(const char *spec)
+{
+#if 0
+ /* FIXME: we have not yet seen any situation this is
+ * necessary. Please write a proper implementation that
+ * covers this branch. */
+ if (spec && spec[0]) {
+ double generated_nan;
+ int len = snprintf(NULL, 0, "NAN(%s)", spec);
+ char *buf = malloc(len + 1); /* +1 for NUL */
+ sprintf(buf, "NAN(%s)", spec);
+ generated_nan = strtod(buf, NULL);
+ free(buf);
+ return generated_nan;
+ }
+ else
+#endif
+ {
+ assert(!spec || !spec[0]);
+ return (double)NAN;
+ }
+}
a>4
-rw-r--r--eval_jump.c5
-rw-r--r--ext/bigdecimal/bigdecimal.c149
-rw-r--r--ext/dl/lib/dl/func.rb70
-rw-r--r--ext/dl/lib/dl/import.rb8
-rw-r--r--ext/fiddle/closure.c2
-rw-r--r--ext/fiddle/extconf.rb30
-rw-r--r--ext/fiddle/function.c4
-rw-r--r--ext/json/lib/json/add/core.rb9
-rw-r--r--ext/json/lib/json/common.rb17
-rw-r--r--ext/json/lib/json/version.rb2
-rw-r--r--ext/json/parser/parser.c36
-rw-r--r--ext/json/parser/parser.rl5
-rw-r--r--ext/readline/readline.c6
-rw-r--r--ext/socket/basicsocket.c8
-rw-r--r--ext/socket/init.c9
-rw-r--r--ext/socket/lib/socket.rb26
-rw-r--r--ext/socket/raddrinfo.c84
-rw-r--r--ext/socket/rubysocket.h3
-rw-r--r--ext/socket/socket.c25
-rw-r--r--ext/socket/unixsocket.c22
-rw-r--r--file.c3
-rw-r--r--gc.c45
-rw-r--r--include/ruby/intern.h1
-rw-r--r--insns.def2
-rw-r--r--iseq.h1
-rw-r--r--lib/mkmf.rb7
-rw-r--r--lib/net/protocol.rb2
-rw-r--r--lib/rdoc.rb2
-rw-r--r--lib/rdoc/generator/template/darkfish/js/darkfish.js16
-rw-r--r--lib/rexml/document.rb12
-rw-r--r--lib/rexml/parsers/baseparser.rb2
-rw-r--r--lib/rexml/text.rb40
-rw-r--r--missing/setproctitle.c6
-rw-r--r--object.c18
-rw-r--r--regparse.c2
-rw-r--r--test/bigdecimal/test_bigdecimal.rb40
-rw-r--r--test/dl/test_func.rb91
-rwxr-xr-xtest/json/test_json.rb24
-rwxr-xr-xtest/json/test_json_addition.rb46
-rw-r--r--test/json/test_json_string_matching.rb11
-rw-r--r--test/net/protocol/test_protocol.rb20
-rw-r--r--test/openssl/test_config.rb5
-rw-r--r--test/rexml/test_comment.rb25
-rw-r--r--test/rexml/test_entity.rb18
-rw-r--r--test/ruby/test_argf.rb4
-rw-r--r--test/ruby/test_beginendblock.rb13
-rw-r--r--test/ruby/test_class.rb15
-rw-r--r--test/ruby/test_dir.rb14
-rw-r--r--test/ruby/test_flip.rb8
-rw-r--r--test/ruby/test_gc.rb6
-rw-r--r--test/socket/test_unix.rb72
-rw-r--r--thread.c28
-rw-r--r--thread_pthread.c1
-rwxr-xr-xtool/mkconfig.rb5
-rw-r--r--version.h10
-rw-r--r--vm.c16
-rw-r--r--vm_core.h13
-rw-r--r--vm_exec.h2
-rw-r--r--vm_insnhelper.c4
-rw-r--r--vm_method.c2
67 files changed, 1254 insertions, 318 deletions
diff --git a/ChangeLog b/ChangeLog
index 5eb42a3161..4354671c1f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,339 @@
+Fri Feb 22 18:36:51 2013 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * lib/rexml/document.rb (REXML::Document.entity_expansion_text_limit):
+ new attribute to read/write entity expansion text limit. the default
+ limit is 10Kb.
+
+ * lib/rexml/text.rb (REXML::Text.unnormalize): check above attribute.
+
+Fri Feb 22 14:48:15 2013 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * vm.c (vm_exec): get rid of a SEGV when calling rb_iter_break() from
+ some extention libraries. [Backport #7896] [ruby-core:52607]
+
+Fri Feb 22 14:40:57 2013 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c : remove a unused function.
+
+Fri Feb 22 14:40:57 2013 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * regparse.c (onig_number_of_names): suppress a warning.
+
+Fri Feb 22 14:40:57 2013 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_call_cfunc): remove useless hack.
+
+Fri Feb 22 14:40:57 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_call_cfunc): suppress a warning. note that
+ `volatile type *var' doesn't make var itself volatile.
+
+Fri Feb 22 14:28:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval_jump.c (rb_exec_end_proc): remember the latest exit status.
+ [ruby-core:43173][Bug #5218]
+
+Fri Feb 22 14:25:57 2013 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/readline/readline.c (Init_readline): don't set 0 to
+ rl_catch_signals and rl_catch_sigwinch. [Bug #5423]
+
+Wed Feb 13 16:18:22 2013 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/json: Import JSON 1.5.5.
+
+Wed Feb 6 17:39:19 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc: Import RDoc 3.9.5.
+
+Wed Feb 6 14:27:25 2013 Shugo Maeda <shugo@ruby-lang.org>
+
+ * ext/socket/raddrinfo.c (rsock_unix_sockaddr_len): return
+ sizeof(sa_familiy_t) if path is empty. see "Autobind Feature" in
+ unix(7) for details.
+
+ * ext/socket/lib/socket.rb (unix_socket_abstract_name?): treat an
+ empty path as an abstract name.
+
+ * test/socket/test_unix.rb: related test.
+
+ * ext/socket/unixsocket.c (rsock_init_unixsock): use rb_inspect()
+ because rb_sys_fail_str() fails if its argument contains NUL.
+
+ * test/socket/test_unix.rb: related test.
+
+ * ext/socket/socket.c (sock_s_pack_sockaddr_un): calculate the
+ correct address length of an abstract socket.
+
+ * test/socket/test_unix.rb: related test.
+
+ * ext/socket/raddrinfo (rsock_unix_sockaddr_len): renamed from
+ rsock_unixpath_len, because it returns not the length of the path,
+ but the length of a socket address for the path.
+
+ * ext/socket/raddrinfo.c (rsock_unixpath_len, init_unix_addrinfo),
+ ext/socket/unixsocket.c (unixsock_connect_internal,
+ rsock_init_unixsock): calculate the correct address length of
+ an abstract socket. Without this fix, sizeof(struct sockaddr_un)
+ is specified as the length of an abstract socket for bind(2) or
+ connect(2), so the address of the socket is filled with extra NUL
+ characters. See unix(7) for details.
+
+ * ext/socket/lib/socket.rb (unix_server_socket): don't access the
+ file system if the platform is Linux and path starts with NUL,
+ which means that the socket is an abstract socket.
+
+ * test/socket/test_unix.rb: related test.
+
+ * ext/socket/socket.c (sock_s_pack_sockaddr_un): support the longest
+ path in sockaddr_un, really.
+ reported by nagachika.
+ http://d.hatena.ne.jp/nagachika/20120426/ruby_trunk_changes_35474_35476
+
+ * ext/socket/raddrinfo.c (init_unix_addrinfo): support the longest
+ path in sockaddr_un.
+ (inspect_sockaddr): ditto.
+ (addrinfo_mdump): ditto.
+ (addrinfo_mload): ditto.
+ (rsock_unixpath_str): new function.
+ (rsock_unixpath): removed.
+ (rsock_unixaddr): use rsock_unixpath_str.
+
+ * ext/socket/socket.c (sock_s_pack_sockaddr_un): support the longest
+ path in sockaddr_un.
+ (sock_s_unpack_sockaddr_un): ditto.
+ (sock_s_gethostbyaddr): unused variable removed.
+
+ * ext/socket/unixsocket.c (rsock_init_unixsock): support the longest
+ path in sockaddr_un.
+
+ * ext/socket/rubysocket.h (rsock_unixpath_str): declared.
+ (rsock_unixpath): removed.
+
+ * test/socket/test_unix.rb: comment out test_nul because abstract unix
+ sockets may contain NULs.
+
+Wed Feb 6 14:20:12 2013 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/basicsocket.c (bsock_getsockname): ignore truncated
+ part of socket address.
+ (bsock_getpeername): ditto.
+ (bsock_local_address): ditto.
+ (bsock_remote_address): ditto.
+
+ * ext/socket/unixsocket.c (unix_path): ditto.
+ (unix_addr): ditto.
+ (unix_peeraddr): ditto.
+
+ * ext/socket/init.c (cloexec_accept): ditto.
+
+Wed Feb 6 14:19:07 2013 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rexml/parsers/baseparser.rb, test/rexml/test_comment.rb:
+ allow a single hyphen in comment. [Bug #5278] [ruby-core:39289]
+ Reported by Thomas Fritzsche. Thanks!!!
+
+Wed Feb 6 14:14:38 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (realpath_rec): prevent link from GC while link_names refers
+ the content.
+
+Wed Feb 6 14:13:25 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * missing/setproctitle.c (environ): use (*_NSGetEnviron()) instead of
+ environ on Darwin for namespace cleanness, same as [ruby-core:00537].
+ [ruby-core:45615] [Bug #6576]
+
+Wed Feb 6 14:05:09 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * dir.c (glob_make_pattern): names under recursive need to be single
+ basenames to match for each name. [ruby-core:47418] [Bug #6977]
+
+Tue Jan 15 16:30:29 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_pthread.c (gvl_init): Reset gvl.wait_yield explicitly when
+ fork()ing. Patch by Apollon Oikonomopoulos. Thanks!
+ [Bug #7693][ruby-core:51424]
+
+Tue Jan 15 16:25:35 2013 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c (rb_objspace_call_finalizer): finalize_deferred may free up
+ a object which is reachable from a part after this function,
+ e.g. ruby_vm_destruct(). [ruby-dev:46647] [Bug #7452]
+
+ * test/ruby/test_gc.rb (test_finalizing_main_thread): add a test
+ for above.
+
+Tue Jan 15 16:23:30 2013 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/net/protocol.rb (Net::InternetMessageIO#each_crlf_line):
+ treat \r as newline as mame pointed. [ruby-dev:46425] [Bug #7278]
+
+Tue Jan 15 16:23:30 2013 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/net/protocol.rb (Net::InternetMessageIO#each_crlf_line):
+ don't use /n in universal regexp. [ruby-dev:46394] [Bug #7278]
+
+Tue Jan 15 16:13:47 2013 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_to_s): use CRuby style.
+
+Tue Jan 15 16:13:47 2013 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c: use `RB_TYPE_P(x, t)` instead of
+ `TYPE(x) == t`.
+
+Tue Jan 15 16:13:47 2013 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_sub):
+ need to specify precision for converting Rational and Float.
+ [ruby-dev:46544] [Bug #7404]
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_mult): ditto.
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_divide): ditto.
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_DoDivmod): ditto.
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_divremain): ditto.
+
+ * test/bigdecimal/test_bigdecimal.rb: add tests for the above fixes.
+
+Tue Jan 15 16:03:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * tool/mkconfig.rb: use configured libdir value to fix
+ --enable-load-relative on systems where libdir is not default value,
+ overridden in config.site files. [ruby-core:47267] [Bug #6903]
+
+Tue Jan 15 15:55:09 2013 Eric Hodel <drbrain@segment7.net>
+
+ * object.c (Init_Object): Added RDoc location pointers for
+ Kernel#methods, Kernel#protected_methods, Kernel#private_methods and
+ Kernel#public_methods. [Bug #6666]
+
+Fri Jan 11 17:12:44 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_core.h (rb_iseq_t): move flip_cnt from struct iseq_compile_data,
+ because it has same life span as enclosing iseq. [Bug #7671]
+ [ruby-core:51296]
+
+Fri Jan 11 17:11:26 2013 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/mkmf.rb: add dummy clean-static target to prevent errors for the
+ case real clean-static target doesn't exist.
+
+Fri Jan 11 17:02:59 2013 Koichi Sasada <ko1@atdot.net>
+
+ * vm_exec.h (GENTRY): GENTRY should be pointer size.
+ A patch by yoshidam (Yoshida Masato) [Bug #7332].
+
+Fri Jan 11 16:57:31 2013 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * vm_trace.c (rb_threadptr_exec_event_hooks): added a parameter to pop
+ a frame before JUMP_TAG() if exception occurred. This change fix bug
+ of Ruby 1.9. [ruby-core:51128] [ruby-trunk - Bug #7624]
+
+ * vm_core.h (EXEC_EVENT_HOOK_AND_POP_FRAME): add to use
+ `rb_threadptr_exec_event_hooks()' with the pop flag.
+
+ * vm.c (vm_exec): use EXEC_EVENT_HOOK_AND_POP_FRAME() while exception
+ handling. While exception hadnling, if an exception is raised in
+ hooks, need to pop current frame and raise this raised exception by
+ hook.
+
+ * bootstraptest/test_flow.rb: add a test.
+
+Mon Jan 7 15:50:25 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm.c (rb_vm_make_proc): save the proc made from the given block so
+ that it will not get collected. [ruby-core:50545] [Bug #7507]
+
+Tue Dec 25 23:35:09 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/mkmf.rb: fix for if config["libdir"] is nil.
+
+Tue Dec 25 20:40:47 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * bignum.c, include/ruby/intern.h (rb_big_eql): exported.
+
+ * thread.c (recursive_check): object_id maybe a Bignum, not Fixnum on
+ LLP64. see also r38493 and r38548.
+ reported by Heesob Park at [ruby-core:51083] [Bug #7607], and patched
+ by shirosaki at [ruby-core:51095]
+
+Tue Dec 25 09:54:31 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * gc.c (obj_id_to_ref): add a macro to treat Bignum object id.
+ This follows the change r38493.
+
+ * gc.c (id2ref): fix for working fine with Bignum object id on x64
+ Windows.
+ * gc.c (wmap_finalize): ditto.
+
+Sat Dec 22 00:33:28 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * object.c (rb_obj_hash): shouldn't assume object_id can be long.
+ based on a patch by Heesob Park at [ruby-core:51060].
+ cf. [Backport #7454]
+
+Sat Dec 22 00:33:28 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * gc.c (nonspecial_obj_id): VALUE is not compatible with Fixnum on
+ LLP64 platform, such as 64bit Windows.
+ reporeted by Heesob Park at [ruby-core:50255] [Bug #7454], and the
+ fix is suggested by akr.
+
+Fri Dec 21 16:03:54 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_argf.rb (TestArgf#test_chars): since marshal data is
+ binary, shouldn't pass via text mode. use base64 encoded data.
+
+Thu Dec 13 23:10:52 Charlie Somerville <charlie@charliesomerville.com>
+ * object.c (Init_Object): use rb_mod_init_copy for Class#initialize_copy
+ * class.c (rb_class_init_copy): rename to class_init_copy_check, performs type
+ checks on arguments to prevent reinitialization of initialized class
+ [ruby-core:50869] [Bug #7557]
+ * class.c (rb_mod_init_copy): use class_init_copy_check if receiver is T_CLASS
+ * test/ruby/test_class.rb (class TestClass): related test
+
+
+Thu Dec 20 18:46:17 2012 Naohisa Goto <ngotogenome@gmail.com>
+
+ * test/dl/test_func.rb (test_name_with_block, test_bind, test_qsort1):
+ call unbind to release the callback closure because maximum number
+ of callbacks is limited to DL::MAX_CALLBACK (== 5) with pure DL
+ without Fiddle.
+
+Thu Dec 20 18:46:17 2012 Naohisa Goto <ngotogenome@gmail.com>
+
+ * ext/dl/lib/dl/func.rb (DL::Function#unbind, #bound?): suppress
+ NoMethodError when Fiddle is available. [ruby-core:50756] [Bug #7543]
+ * test/dl/test_func.rb (test_bound*, test_unbind*): tests for the above.
+
+Thu Dec 20 18:46:17 2012 Naohisa Goto <ngotogenome@gmail.com>
+
+ * ext/dl/lib/dl/func.rb (DL::Function#initialize, DL::Function#bind):
+ ABI should be set by using CFunc#calltype even when Fiddle is used.
+ When Fiddle is used and a block is given, name shoud not be ignored.
+ [ruby-core:50562] [Bug #7514]
+
+ * ext/dl/lib/dl/import.rb (DL::Importer#bind_function): should respect
+ abi and name when Fiddle is used.
+
+ * test/dl/test_func.rb (test_name_with_block): test for "name" method
+ with giving a block.
+
+Thu Dec 20 18:43:00 2012 Naohisa Goto <ngotogenome@gmail.com>
+
+ * ext/fiddle/extconf.rb, ext/fiddle/function.c
+ (Fiddle::Function::STDCALL): FFI_STDCALL is not a macro, but an
+ enumeration. [ruby-core:50398] [Bug #7483]
+
+Thu Dec 20 18:40:25 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread.c (exec_event_hooks): exceptions in event hooks should not
+ propagate outside.
+
Thu Dec 20 18:37:45 2012 NARUSE, Yui <naruse@ruby-lang.org>
* test/ruby/test_m17n_comb.rb (test_str_crypt): Use RbConfig to get
diff --git a/bignum.c b/bignum.c
index 04df7ba4ea..85f739d2bb 100644
--- a/bignum.c
+++ b/bignum.c
@@ -1628,7 +1628,7 @@ rb_big_eq(VALUE x, VALUE y)
* 68719476736.eql?(68719476736.0) #=> false
*/
-static VALUE
+VALUE
rb_big_eql(VALUE x, VALUE y)
{
if (TYPE(y) != T_BIGNUM) return Qfalse;
diff --git a/bootstraptest/test_flow.rb b/bootstraptest/test_flow.rb
index fc93a5a46c..6b3ef749c3 100644
--- a/bootstraptest/test_flow.rb
+++ b/bootstraptest/test_flow.rb
@@ -562,3 +562,17 @@ assert_equal %Q{ENSURE\n}, %q{
assert_equal "false", src + %q{e.all? {false}}, bug
assert_equal "true", src + %q{e.include?(:foo)}, bug
end
+
+assert_equal('ok', %q{
+ class FOO < RuntimeError; end
+ class BAR < RuntimeError; end
+ def m
+ raise FOO
+ end
+ set_trace_func(proc{|t,| raise BAR if t == 'return'})
+ begin
+ m
+ rescue BAR
+ 'ok'
+ end
+}, '[ruby-core:51128] [ruby-trunk - Bug #7624]')
diff --git a/class.c b/class.c
index df19812d15..4fbdf18fb7 100644
--- a/class.c
+++ b/class.c
@@ -159,10 +159,27 @@ clone_const_i(st_data_t key, st_data_t value, st_data_t data)
return clone_const((ID)key, (const rb_const_entry_t *)value, (st_table *)data);
}
+static void
+class_init_copy_check(VALUE clone, VALUE orig)
+{
+ if (orig == rb_cBasicObject) {
+ rb_raise(rb_eTypeError, "can't copy the root class");
+ }
+ if (RCLASS_SUPER(clone) != 0 || clone == rb_cBasicObject) {
+ rb_raise(rb_eTypeError, "already initialized class");
+ }
+ if (FL_TEST(orig, FL_SINGLETON)) {
+ rb_raise(rb_eTypeError, "can't copy singleton class");
+ }
+}
+
/* :nodoc: */
VALUE
rb_mod_init_copy(VALUE clone, VALUE orig)
{
+ if (RB_TYPE_P(clone, T_CLASS)) {
+ class_init_copy_check(clone, orig);
+ }
rb_obj_init_copy(clone, orig);
if (!FL_TEST(CLASS_OF(clone), FL_SINGLETON)) {
RBASIC(clone)->klass = rb_singleton_class_clone(orig);
@@ -203,22 +220,6 @@ rb_mod_init_copy(VALUE clone, VALUE orig)
return clone;
}
-/* :nodoc: */
-VALUE
-rb_class_init_copy(VALUE clone, VALUE orig)
-{
- if (orig == rb_cBasicObject) {
- rb_raise(rb_eTypeError, "can't copy the root class");
- }
- if (RCLASS_SUPER(clone) != 0 || clone == rb_cBasicObject) {
- rb_raise(rb_eTypeError, "already initialized class");
- }
- if (FL_TEST(orig, FL_SINGLETON)) {
- rb_raise(rb_eTypeError, "can't copy singleton class");
- }
- return rb_mod_init_copy(clone, orig);
-}
-
VALUE
rb_singleton_class_clone(VALUE obj)
{
diff --git a/common.mk b/common.mk
index 0cf3a125a3..ccc964701e 100644
--- a/common.mk
+++ b/common.mk
@@ -233,14 +233,14 @@ $(ruby_pc): $(srcdir)/template/ruby.pc.in config.status
install-all: docs pre-install-all do-install-all post-install-all
pre-install-all:: pre-install-local pre-install-ext pre-install-doc
-do-install-all: $(PROGRAM)
+do-install-all: all
$(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=all --rdoc-output="$(RDOCOUT)"
post-install-all:: post-install-local post-install-ext post-install-doc
@$(NULLCMD)
install-nodoc: pre-install-nodoc do-install-nodoc post-install-nodoc
pre-install-nodoc:: pre-install-local pre-install-ext
-do-install-nodoc: $(PREP)
+do-install-nodoc: main
$(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS)
post-install-nodoc:: post-install-local post-install-ext
@@ -258,7 +258,7 @@ post-install-ext:: post-install-ext-arch post-install-ext-comm
install-arch: pre-install-arch do-install-arch post-install-arch
pre-install-arch:: pre-install-bin pre-install-ext-arch
-do-install-arch: $(PREP)
+do-install-arch: main
$(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=bin --install=ext-arch
post-install-arch:: post-install-bin post-install-ext-arch
diff --git a/compile.c b/compile.c
index f78d13db78..bbc80e5ef5 100644
--- a/compile.c
+++ b/compile.c
@@ -4844,12 +4844,11 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
LABEL *lend = NEW_LABEL(nd_line(node));
LABEL *lfin = NEW_LABEL(nd_line(node));
LABEL *ltrue = NEW_LABEL(nd_line(node));
- struct iseq_compile_data *data = iseq->local_iseq->compile_data;
+ rb_iseq_t *local_iseq = iseq->local_iseq;
rb_num_t cnt;
VALUE key;
- if (!data) data = iseq->compile_data;
- cnt = data->flip_cnt++ + DEFAULT_SPECIAL_VAR_COUNT;
+ cnt = local_iseq->flip_cnt++ + DEFAULT_SPECIAL_VAR_COUNT;
key = INT2FIX(cnt);
ADD_INSN2(ret, nd_line(node), getspecial, key, INT2FIX(0));
diff --git a/dir.c b/dir.c
index 387a2490b6..4246b10c9d 100644
--- a/dir.c
+++ b/dir.c
@@ -1175,6 +1175,7 @@ glob_make_pattern(const char *p, const char *e, int flags, rb_encoding *enc)
{
struct glob_pattern *list, *tmp, **tail = &list;
int dirsep = 0; /* pattern is terminated with '/' */
+ int recursive = 0;
while (p < e && *p) {
tmp = GLOB_ALLOC(struct glob_pattern);
@@ -1185,13 +1186,14 @@ glob_make_pattern(const char *p, const char *e, int flags, rb_encoding *enc)
tmp->type = RECURSIVE;
tmp->str = 0;
dirsep = 1;
+ recursive = 1;
}
else {
const char *m = find_dirsep(p, e, flags, enc);
int magic = has_magic(p, m, flags, enc);
char *buf;
- if (!magic && *m) {
+ if (!magic && !recursive && *m) {
const char *m2;
while (!has_magic(m+1, m2 = find_dirsep(m+1, e, flags, enc), flags, enc) &&
*m2) {
diff --git a/eval_jump.c b/eval_jump.c
index a8f04808ca..f3a1f78a3f 100644
--- a/eval_jump.c
+++ b/eval_jump.c
@@ -99,6 +99,8 @@ rb_exec_end_proc(void)
struct end_proc_data *volatile link;
int status;
volatile int safe = rb_safe_level();
+ rb_thread_t *th = GET_THREAD();
+ VALUE errinfo = th->errinfo;
while (ephemeral_end_procs) {
link = ephemeral_end_procs;
@@ -112,6 +114,7 @@ rb_exec_end_proc(void)
POP_TAG();
if (status) {
error_handle(status);
+ if (!NIL_P(th->errinfo)) errinfo = th->errinfo;
}
xfree(link);
}
@@ -128,10 +131,12 @@ rb_exec_end_proc(void)
POP_TAG();
if (status) {
error_handle(status);
+ if (!NIL_P(th->errinfo)) errinfo = th->errinfo;
}
xfree(link);
}
rb_set_safe_level_force(safe);
+ th->errinfo = errinfo;
}
void
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
index b344153bfd..14f80b1929 100644
--- a/ext/bigdecimal/bigdecimal.c
+++ b/ext/bigdecimal/bigdecimal.c
@@ -660,7 +660,7 @@ BigDecimal_to_i(VALUE self)
ret = rb_funcall(numerator, '*', 1,
rb_funcall(INT2FIX(10), rb_intern("**"), 1,
INT2FIX(dpower)));
- if (TYPE(ret) == T_FLOAT)
+ if (RB_TYPE_P(ret, T_FLOAT))
rb_raise(rb_eFloatDomainError, "Infinity");
return ret;
}
@@ -768,11 +768,11 @@ BigDecimal_coerce(VALUE self, VALUE other)
VALUE obj;
Real *b;
- if (TYPE(other) == T_FLOAT) {
+ if (RB_TYPE_P(other, T_FLOAT)) {
obj = rb_assoc_new(other, BigDecimal_to_f(self));
}
else {
- if (TYPE(other) == T_RATIONAL) {
+ if (RB_TYPE_P(other, T_RATIONAL)) {
Real* pv = DATA_PTR(self);
GUARD_OBJ(b, GetVpValueWithPrec(other, pv->Prec*VpBaseFig(), 1));
}
@@ -810,10 +810,10 @@ BigDecimal_add(VALUE self, VALUE r)
size_t mx;
GUARD_OBJ(a, GetVpValue(self, 1));
- if (TYPE(r) == T_FLOAT) {
+ if (RB_TYPE_P(r, T_FLOAT)) {
b = GetVpValueWithPrec(r, DBL_DIG+1, 1);
}
- else if (TYPE(r) == T_RATIONAL) {
+ else if (RB_TYPE_P(r, T_RATIONAL)) {
b = GetVpValueWithPrec(r, a->Prec*VpBaseFig(), 1);
}
else {
@@ -862,7 +862,16 @@ BigDecimal_sub(VALUE self, VALUE r)
size_t mx;
GUARD_OBJ(a,GetVpValue(self,1));
- b = GetVpValue(r,0);
+ if (RB_TYPE_P(r, T_FLOAT)) {
+ b = GetVpValueWithPrec(r, DBL_DIG+1, 1);
+ }
+ else if (RB_TYPE_P(r, T_RATIONAL)) {
+ b = GetVpValueWithPrec(r, a->Prec*VpBaseFig(), 1);
+ }
+ else {
+ b = GetVpValue(r,0);
+ }
+
if(!b) return DoSomeOne(self,r,'-');
SAVE(b);
@@ -1095,7 +1104,16 @@ BigDecimal_mult(VALUE self, VALUE r)
size_t mx;
GUARD_OBJ(a,GetVpValue(self,1));
- b = GetVpValue(r,0);
+ if (RB_TYPE_P(r, T_FLOAT)) {
+ b = GetVpValueWithPrec(r, DBL_DIG+1, 1);
+ }
+ else if (RB_TYPE_P(r, T_RATIONAL)) {
+ b = GetVpValueWithPrec(r, a->Prec*VpBaseFig(), 1);
+ }
+ else {
+ b = GetVpValue(r,0);
+ }
+
if(!b) return DoSomeOne(self,r,'*');
SAVE(b);
@@ -1114,9 +1132,19 @@ BigDecimal_divide(Real **c, Real **res, Real **div, VALUE self, VALUE r)
size_t mx;
GUARD_OBJ(a,GetVpValue(self,1));
- b = GetVpValue(r,0);
+ if (RB_TYPE_P(r, T_FLOAT)) {
+ b = GetVpValueWithPrec(r, DBL_DIG+1, 1);
+ }
+ else if (RB_TYPE_P(r, T_RATIONAL)) {
+ b = GetVpValueWithPrec(r, a->Prec*VpBaseFig(), 1);
+ }
+ else {
+ b = GetVpValue(r,0);
+ }
+
if(!b) return DoSomeOne(self,r,'/');
SAVE(b);
+
*div = b;
mx = a->Prec + vabs(a->exponent);
if(mx<b->Prec + vabs(b->exponent)) mx = b->Prec + vabs(b->exponent);
@@ -1177,7 +1205,16 @@ BigDecimal_DoDivmod(VALUE self, VALUE r, Real **div, Real **mod)
size_t mx;
GUARD_OBJ(a,GetVpValue(self,1));
- b = GetVpValue(r,0);
+ if (RB_TYPE_P(r, T_FLOAT)) {
+ b = GetVpValueWithPrec(r, DBL_DIG+1, 1);
+ }
+ else if (RB_TYPE_P(r, T_RATIONAL)) {
+ b = GetVpValueWithPrec(r, a->Prec*VpBaseFig(), 1);
+ }
+ else {
+ b = GetVpValue(r,0);
+ }
+
if(!b) return Qfalse;
SAVE(b);
@@ -1267,7 +1304,16 @@ BigDecimal_divremain(VALUE self, VALUE r, Real **dv, Real **rv)
Real *f=NULL;
GUARD_OBJ(a,GetVpValue(self,1));
- b = GetVpValue(r,0);
+ if (RB_TYPE_P(r, T_FLOAT)) {
+ b = GetVpValueWithPrec(r, DBL_DIG+1, 1);
+ }
+ else if (RB_TYPE_P(r, T_RATIONAL)) {
+ b = GetVpValueWithPrec(r, a->Prec*VpBaseFig(), 1);
+ }
+ else {
+ b = GetVpValue(r,0);
+ }
+
if(!b) return DoSomeOne(self,r,rb_intern("remainder"));
SAVE(b);
@@ -1741,8 +1787,8 @@ static VALUE
BigDecimal_to_s(int argc, VALUE *argv, VALUE self)
{
ENTER(5);
- int fmt=0; /* 0:E format */
- int fPlus=0; /* =0:default,=1: set ' ' before digits ,set '+' before digits. */
+ int fmt = 0; /* 0:E format */
+ int fPlus = 0; /* =0:default,=1: set ' ' before digits ,set '+' before digits. */
Real *vp;
volatile VALUE str;
char *psz;
@@ -1752,42 +1798,53 @@ BigDecimal_to_s(int argc, VALUE *argv, VALUE self)
GUARD_OBJ(vp,GetVpValue(self,1));
- if(rb_scan_args(argc,argv,"01",&f)==1) {
- if(TYPE(f)==T_STRING) {
- SafeStringValue(f);
- psz = RSTRING_PTR(f);
- if(*psz==' ') {
- fPlus = 1; psz++;
- } else if(*psz=='+') {
- fPlus = 2; psz++;
- }
- while((ch=*psz++)!=0) {
- if(ISSPACE(ch)) continue;
- if(!ISDIGIT(ch)) {
- if(ch=='F' || ch=='f') fmt = 1; /* F format */
- break;
- }
- mc = mc * 10 + ch - '0';
- }
- }
+ if (rb_scan_args(argc,argv,"01",&f)==1) {
+ if (RB_TYPE_P(f, T_STRING)) {
+ SafeStringValue(f);
+ psz = RSTRING_PTR(f);
+ if (*psz == ' ') {
+ fPlus = 1;
+ psz++;
+ }
+ else if (*psz == '+') {
+ fPlus = 2;
+ psz++;
+ }
+ while ((ch = *psz++) != 0) {
+ if (ISSPACE(ch)) {
+ continue;
+ }
+ if (!ISDIGIT(ch)) {
+ if (ch == 'F' || ch == 'f') {
+ fmt = 1; /* F format */
+ }
+ break;
+ }
+ mc = mc * 10 + ch - '0';
+ }
+ }
else {
- mc = (size_t)GetPositiveInt(f);
- }
+ mc = (size_t)GetPositiveInt(f);
+ }
}
- if(fmt) {
- nc = VpNumOfChars(vp,"F");
- } else {
- nc = VpNumOfChars(vp,"E");
+ if (fmt) {
+ nc = VpNumOfChars(vp, "F");
+ }
+ else {
+ nc = VpNumOfChars(vp, "E");
+ }
+ if (mc > 0) {
+ nc += (nc + mc - 1) / mc + 1;
}
- if(mc>0) nc += (nc + mc - 1) / mc + 1;
str = rb_str_new(0, nc);
psz = RSTRING_PTR(str);
- if(fmt) {
- VpToFString(vp, psz, mc, fPlus);
- } else {
- VpToString (vp, psz, mc, fPlus);
+ if (fmt) {
+ VpToFString(vp, psz, mc, fPlus);
+ }
+ else {
+ VpToString (vp, psz, mc, fPlus);
}
rb_str_resize(str, strlen(psz));
return str;
@@ -1904,7 +1961,7 @@ static VALUE BigMath_s_log(VALUE, VALUE, VALUE);
inline static int
is_integer(VALUE x)
{
- return (TYPE(x) == T_FIXNUM || TYPE(x) == T_BIGNUM);
+ return (RB_TYPE_P(x, T_FIXNUM) || RB_TYPE_P(x, T_BIGNUM));
}
inline static int
@@ -1913,10 +1970,10 @@ is_negative(VALUE x)
if (FIXNUM_P(x)) {
return FIX2LONG(x) < 0;
}
- else if (TYPE(x) == T_BIGNUM) {
+ else if (RB_TYPE_P(x, T_BIGNUM)) {
return RBIGNUM_NEGATIVE_P(x);
}
- else if (TYPE(x) == T_FLOAT) {
+ else if (RB_TYPE_P(x, T_FLOAT)) {
return RFLOAT_VALUE(x) < 0.0;
}
return RTEST(rb_funcall(x, '<', 1, INT2FIX(0)));
@@ -2175,7 +2232,7 @@ retry:
if (exp != NULL) {
return rmpd_power_by_big_decimal(x, exp, n);
}
- else if (TYPE(vexp) == T_BIGNUM) {
+ else if (RB_TYPE_P(vexp, T_BIGNUM)) {
VALUE abs_value = BigDecimal_abs(self);
if (is_one(abs_value)) {
return ToValue(VpCreateRbObject(n, "1"));
@@ -2571,7 +2628,7 @@ BigMath_s_log(VALUE klass, VALUE x, VALUE vprec)
double flo;
long fix;
- if (TYPE(vprec) != T_FIXNUM && TYPE(vprec) != T_BIGNUM) {
+ if (!is_integer(vprec)) {
rb_raise(rb_eArgError, "precision must be an Integer");
}
diff --git a/ext/dl/lib/dl/func.rb b/ext/dl/lib/dl/func.rb
index 3e82dcde20..7b9b54f318 100644
--- a/ext/dl/lib/dl/func.rb
+++ b/ext/dl/lib/dl/func.rb
@@ -11,13 +11,50 @@ module DL
include DL
include ValueUtil
+ if DL.fiddle?
+ # :stopdoc:
+ CALL_TYPE_TO_ABI = Hash.new { |h, k|
+ raise RuntimeError, "unsupported call type: #{k}"
+ }.merge({ :stdcall =>
+ (Fiddle::Function::STDCALL rescue Fiddle::Function::DEFAULT),
+ :cdecl => Fiddle::Function::DEFAULT,
+ nil => Fiddle::Function::DEFAULT
+ }).freeze
+ private_constant :CALL_TYPE_TO_ABI
+ # :startdoc:
+
+ def self.call_type_to_abi(call_type) # :nodoc:
+ CALL_TYPE_TO_ABI[call_type]
+ end
+ private_class_method :call_type_to_abi
+
+ class FiddleClosureCFunc < Fiddle::Closure # :nodoc: all
+ def initialize ctype, arg, abi, name
+ @name = name
+ super(ctype, arg, abi)
+ end
+ def name
+ @name
+ end
+ def ptr
+ to_i
+ end
+ end
+ private_constant :FiddleClosureCFunc
+
+ def self.class_fiddle_closure_cfunc # :nodoc:
+ FiddleClosureCFunc
+ end
+ private_class_method :class_fiddle_closure_cfunc
+ end
+
def initialize cfunc, argtypes, abi = nil, &block
if DL.fiddle?
- abi ||= Fiddle::Function::DEFAULT
+ abi ||= CALL_TYPE_TO_ABI[(cfunc.calltype rescue nil)]
if block_given?
- @cfunc = Class.new(Fiddle::Closure) {
+ @cfunc = Class.new(FiddleClosureCFunc) {
define_method(:call, block)
- }.new(cfunc.ctype, argtypes)
+ }.new(cfunc.ctype, argtypes, abi, cfunc.name)
else
@cfunc = cfunc
end
@@ -76,16 +113,16 @@ module DL
def bind(&block)
if DL.fiddle?
- @cfunc = Class.new(Fiddle::Closure) {
- def initialize ctype, args, block
- super(ctype, args)
+ @cfunc = Class.new(FiddleClosureCFunc) {
+ def initialize ctype, args, abi, name, block
+ super(ctype, args, abi, name)
@block = block
end
def call *args
@block.call(*args)
end
- }.new(@cfunc.ctype, @args, block)
+ }.new(@cfunc.ctype, @args, abi, name, block)
@ptr = @cfunc
return nil
else
@@ -120,6 +157,25 @@ module DL
end
def unbind()
+ if DL.fiddle? then
+ if @cfunc.kind_of?(Fiddle::Closure) and @cfunc.ptr != 0 then
+ call_type = case abi
+ when CALL_TYPE_TO_ABI[nil]
+ nil
+ when CALL_TYPE_TO_ABI[:stdcall]
+ :stdcall
+ else
+ raise(RuntimeError, "unsupported abi: #{abi}")
+ end
+ @cfunc = CFunc.new(0, @cfunc.ctype, name, call_type)
+ return 0
+ elsif @cfunc.ptr != 0 then
+ @cfunc.ptr = 0
+ return 0
+ else
+ return nil
+ end
+ end
if( @cfunc.ptr != 0 )
case @cfunc.calltype
when :cdecl
diff --git a/ext/dl/lib/dl/import.rb b/ext/dl/lib/dl/import.rb