ruby-changes:18536
From: yugui <ko1@a...>
Date: Sun, 16 Jan 2011 15:31:01 +0900 (JST)
Subject: [ruby-changes:18536] Ruby:r30559 (ruby_1_9_2): merges r30407 and r30450 from trunk into ruby_1_9_2.
yugui 2011-01-16 15:30:33 +0900 (Sun, 16 Jan 2011) New Revision: 30559 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30559 Log: merges r30407 and r30450 from trunk into ruby_1_9_2. -- * ext/fiddle/extconf.rb: check for windows.h while building fiddle. Thanks Jon Forums! [ruby-core:33923] -- * Use _WIN32 rather than checking for windows.h. Thanks Jon Forums! [ruby-core:33977] Modified files: branches/ruby_1_9_2/ChangeLog branches/ruby_1_9_2/ext/dl/cfunc.c branches/ruby_1_9_2/ext/dl/dl.h branches/ruby_1_9_2/ext/dl/handle.c branches/ruby_1_9_2/ext/fiddle/fiddle.c branches/ruby_1_9_2/ext/fiddle/fiddle.h branches/ruby_1_9_2/ext/fiddle/function.c branches/ruby_1_9_2/test/fiddle/test_fiddle.rb branches/ruby_1_9_2/version.h Index: ruby_1_9_2/ChangeLog =================================================================== --- ruby_1_9_2/ChangeLog (revision 30558) +++ ruby_1_9_2/ChangeLog (revision 30559) @@ -1,3 +1,13 @@ +Wed Jan 5 12:10:08 2011 Aaron Patterson <aaron@t...> + + * Use _WIN32 rather than checking for windows.h. Thanks Jon Forums! + [ruby-core:33977] + +Tue Dec 28 04:32:37 2010 Aaron Patterson <aaron@t...> + + * ext/fiddle/extconf.rb: check for windows.h while building fiddle. + Thanks Jon Forums! [ruby-core:33923] + Sun Dec 26 11:39:11 2010 Nobuyoshi Nakada <nobu@r...> * parse.y (stmt): missing ripper rule. i.e., `a::B ||= c 1'. Index: ruby_1_9_2/ext/dl/cfunc.c =================================================================== --- ruby_1_9_2/ext/dl/cfunc.c (revision 30558) +++ ruby_1_9_2/ext/dl/cfunc.c (revision 30559) @@ -25,7 +25,7 @@ return Qnil; } -#if defined(HAVE_WINDOWS_H) +#if defined(_WIN32) #include <windows.h> static ID id_win32_last_error; @@ -578,7 +578,7 @@ } rb_dl_set_last_error(self, INT2NUM(errno)); -#if defined(HAVE_WINDOWS_H) +#if defined(_WIN32) rb_dl_set_win32_last_error(self, INT2NUM(GetLastError())); #endif @@ -607,13 +607,13 @@ Init_dlcfunc(void) { id_last_error = rb_intern("__DL2_LAST_ERROR__"); -#if defined(HAVE_WINDOWS_H) +#if defined(_WIN32) id_win32_last_error = rb_intern("__DL2_WIN32_LAST_ERROR__"); #endif rb_cDLCFunc = rb_define_class_under(rb_mDL, "CFunc", rb_cObject); rb_define_alloc_func(rb_cDLCFunc, rb_dlcfunc_s_allocate); rb_define_module_function(rb_cDLCFunc, "last_error", rb_dl_get_last_error, 0); -#if defined(HAVE_WINDOWS_H) +#if defined(_WIN32) rb_define_module_function(rb_cDLCFunc, "win32_last_error", rb_dl_get_win32_last_error, 0); #endif rb_define_method(rb_cDLCFunc, "initialize", rb_dlcfunc_initialize, -1); Index: ruby_1_9_2/ext/dl/dl.h =================================================================== --- ruby_1_9_2/ext/dl/dl.h (revision 30558) +++ ruby_1_9_2/ext/dl/dl.h (revision 30559) @@ -20,7 +20,7 @@ #define RTLD_NOW 0 #endif #else -# if defined(HAVE_WINDOWS_H) +# if defined(_WIN32) # include <windows.h> # define dlopen(name,flag) ((void*)LoadLibrary(name)) # define dlerror() strerror(rb_w32_map_errno(GetLastError())) Index: ruby_1_9_2/ext/dl/handle.c =================================================================== --- ruby_1_9_2/ext/dl/handle.c (revision 30558) +++ ruby_1_9_2/ext/dl/handle.c (revision 30559) @@ -7,7 +7,7 @@ VALUE rb_cDLHandle; -#ifdef HAVE_WINDOWS_H +#ifdef _WIN32 # ifndef _WIN32_WCE static void * w32_coredll(void) @@ -142,7 +142,7 @@ rb_secure(2); -#if defined(HAVE_WINDOWS_H) +#if defined(_WIN32) if( !clib ){ HANDLE rb_libruby_handle(void); ptr = rb_libruby_handle(); Index: ruby_1_9_2/ext/fiddle/function.c =================================================================== --- ruby_1_9_2/ext/fiddle/function.c (revision 30558) +++ ruby_1_9_2/ext/fiddle/function.c (revision 30559) @@ -125,7 +125,7 @@ ffi_call(cif, NUM2PTR(rb_Integer(cfunc)), &retval, values); rb_funcall(mFiddle, rb_intern("last_error="), 1, INT2NUM(errno)); -#if defined(HAVE_WINDOWS_H) +#if defined(_WIN32) rb_funcall(mFiddle, rb_intern("win32_last_error="), 1, INT2NUM(errno)); #endif Index: ruby_1_9_2/ext/fiddle/fiddle.c =================================================================== --- ruby_1_9_2/ext/fiddle/fiddle.c (revision 30558) +++ ruby_1_9_2/ext/fiddle/fiddle.c (revision 30559) @@ -18,7 +18,7 @@ rb_define_const(mFiddle, "TYPE_FLOAT", INT2NUM(TYPE_FLOAT)); rb_define_const(mFiddle, "TYPE_DOUBLE", INT2NUM(TYPE_DOUBLE)); -#if defined(HAVE_WINDOWS_H) +#if defined(_WIN32) rb_define_const(mFiddle, "WINDOWS", Qtrue); #else rb_define_const(mFiddle, "WINDOWS", Qfalse); Index: ruby_1_9_2/ext/fiddle/fiddle.h =================================================================== --- ruby_1_9_2/ext/fiddle/fiddle.h (revision 30558) +++ ruby_1_9_2/ext/fiddle/fiddle.h (revision 30559) @@ -4,7 +4,7 @@ #include <ruby.h> #include <errno.h> -#if defined(HAVE_WINDOWS_H) +#if defined(_WIN32) #include <windows.h> #endif Index: ruby_1_9_2/version.h =================================================================== --- ruby_1_9_2/version.h (revision 30558) +++ ruby_1_9_2/version.h (revision 30559) @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_PATCHLEVEL 141 +#define RUBY_PATCHLEVEL 142 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 Index: ruby_1_9_2/test/fiddle/test_fiddle.rb =================================================================== --- ruby_1_9_2/test/fiddle/test_fiddle.rb (revision 30558) +++ ruby_1_9_2/test/fiddle/test_fiddle.rb (revision 30559) @@ -16,4 +16,14 @@ assert_equal(DL.const_get(name), Fiddle.const_get(name)) end end + + def test_windows_constant + require 'rbconfig' + if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ + assert Fiddle::WINDOWS, "Fiddle::WINDOWS should be 'true' on Windows platforms" + else + refute Fiddle::WINDOWS, "Fiddle::WINDOWS should be 'false' on non-Windows platforms" + end + end + end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/