mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
27f15990ad
commit
66fd410332
9 changed files with 31 additions and 11 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
Wed Jan 5 12:10:08 2011 Aaron Patterson <aaron@tenderlovemaking.com>
|
||||||
|
|
||||||
|
* Use _WIN32 rather than checking for windows.h. Thanks Jon Forums!
|
||||||
|
[ruby-core:33977]
|
||||||
|
|
||||||
|
Tue Dec 28 04:32:37 2010 Aaron Patterson <aaron@tenderlovemaking.com>
|
||||||
|
|
||||||
|
* 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@ruby-lang.org>
|
Sun Dec 26 11:39:11 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* parse.y (stmt): missing ripper rule. i.e., `a::B ||= c 1'.
|
* parse.y (stmt): missing ripper rule. i.e., `a::B ||= c 1'.
|
||||||
|
|
|
@ -25,7 +25,7 @@ rb_dl_set_last_error(VALUE self, VALUE val)
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_WINDOWS_H)
|
#if defined(_WIN32)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
static ID id_win32_last_error;
|
static ID id_win32_last_error;
|
||||||
|
|
||||||
|
@ -578,7 +578,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
|
||||||
}
|
}
|
||||||
|
|
||||||
rb_dl_set_last_error(self, INT2NUM(errno));
|
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()));
|
rb_dl_set_win32_last_error(self, INT2NUM(GetLastError()));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -607,13 +607,13 @@ void
|
||||||
Init_dlcfunc(void)
|
Init_dlcfunc(void)
|
||||||
{
|
{
|
||||||
id_last_error = rb_intern("__DL2_LAST_ERROR__");
|
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__");
|
id_win32_last_error = rb_intern("__DL2_WIN32_LAST_ERROR__");
|
||||||
#endif
|
#endif
|
||||||
rb_cDLCFunc = rb_define_class_under(rb_mDL, "CFunc", rb_cObject);
|
rb_cDLCFunc = rb_define_class_under(rb_mDL, "CFunc", rb_cObject);
|
||||||
rb_define_alloc_func(rb_cDLCFunc, rb_dlcfunc_s_allocate);
|
rb_define_alloc_func(rb_cDLCFunc, rb_dlcfunc_s_allocate);
|
||||||
rb_define_module_function(rb_cDLCFunc, "last_error", rb_dl_get_last_error, 0);
|
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);
|
rb_define_module_function(rb_cDLCFunc, "win32_last_error", rb_dl_get_win32_last_error, 0);
|
||||||
#endif
|
#endif
|
||||||
rb_define_method(rb_cDLCFunc, "initialize", rb_dlcfunc_initialize, -1);
|
rb_define_method(rb_cDLCFunc, "initialize", rb_dlcfunc_initialize, -1);
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#define RTLD_NOW 0
|
#define RTLD_NOW 0
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
# if defined(HAVE_WINDOWS_H)
|
# if defined(_WIN32)
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# define dlopen(name,flag) ((void*)LoadLibrary(name))
|
# define dlopen(name,flag) ((void*)LoadLibrary(name))
|
||||||
# define dlerror() strerror(rb_w32_map_errno(GetLastError()))
|
# define dlerror() strerror(rb_w32_map_errno(GetLastError()))
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
VALUE rb_cDLHandle;
|
VALUE rb_cDLHandle;
|
||||||
|
|
||||||
#ifdef HAVE_WINDOWS_H
|
#ifdef _WIN32
|
||||||
# ifndef _WIN32_WCE
|
# ifndef _WIN32_WCE
|
||||||
static void *
|
static void *
|
||||||
w32_coredll(void)
|
w32_coredll(void)
|
||||||
|
@ -142,7 +142,7 @@ rb_dlhandle_initialize(int argc, VALUE argv[], VALUE self)
|
||||||
|
|
||||||
rb_secure(2);
|
rb_secure(2);
|
||||||
|
|
||||||
#if defined(HAVE_WINDOWS_H)
|
#if defined(_WIN32)
|
||||||
if( !clib ){
|
if( !clib ){
|
||||||
HANDLE rb_libruby_handle(void);
|
HANDLE rb_libruby_handle(void);
|
||||||
ptr = rb_libruby_handle();
|
ptr = rb_libruby_handle();
|
||||||
|
|
|
@ -18,7 +18,7 @@ void Init_fiddle()
|
||||||
rb_define_const(mFiddle, "TYPE_FLOAT", INT2NUM(TYPE_FLOAT));
|
rb_define_const(mFiddle, "TYPE_FLOAT", INT2NUM(TYPE_FLOAT));
|
||||||
rb_define_const(mFiddle, "TYPE_DOUBLE", INT2NUM(TYPE_DOUBLE));
|
rb_define_const(mFiddle, "TYPE_DOUBLE", INT2NUM(TYPE_DOUBLE));
|
||||||
|
|
||||||
#if defined(HAVE_WINDOWS_H)
|
#if defined(_WIN32)
|
||||||
rb_define_const(mFiddle, "WINDOWS", Qtrue);
|
rb_define_const(mFiddle, "WINDOWS", Qtrue);
|
||||||
#else
|
#else
|
||||||
rb_define_const(mFiddle, "WINDOWS", Qfalse);
|
rb_define_const(mFiddle, "WINDOWS", Qfalse);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include <ruby.h>
|
#include <ruby.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#if defined(HAVE_WINDOWS_H)
|
#if defined(_WIN32)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,7 @@ function_call(int argc, VALUE argv[], VALUE self)
|
||||||
ffi_call(cif, NUM2PTR(rb_Integer(cfunc)), &retval, values);
|
ffi_call(cif, NUM2PTR(rb_Integer(cfunc)), &retval, values);
|
||||||
|
|
||||||
rb_funcall(mFiddle, rb_intern("last_error="), 1, INT2NUM(errno));
|
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));
|
rb_funcall(mFiddle, rb_intern("win32_last_error="), 1, INT2NUM(errno));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -16,4 +16,14 @@ class TestFiddle < Fiddle::TestCase
|
||||||
assert_equal(DL.const_get(name), Fiddle.const_get(name))
|
assert_equal(DL.const_get(name), Fiddle.const_get(name))
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#define RUBY_VERSION "1.9.2"
|
#define RUBY_VERSION "1.9.2"
|
||||||
#define RUBY_PATCHLEVEL 141
|
#define RUBY_PATCHLEVEL 142
|
||||||
#define RUBY_VERSION_MAJOR 1
|
#define RUBY_VERSION_MAJOR 1
|
||||||
#define RUBY_VERSION_MINOR 9
|
#define RUBY_VERSION_MINOR 9
|
||||||
#define RUBY_VERSION_TEENY 1
|
#define RUBY_VERSION_TEENY 1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue