From 6ba8ecf6630176c74a66c10b25e742ff60344264 Mon Sep 17 00:00:00 2001 From: Lars Kanis <kanis@comcard.de> Date: Tue, 26 Feb 2013 10:13:18 +0100 Subject: [PATCH] Make Ruby-1.9+ default instead of Ruby-1.8. --- ext/fox16_c/FXRbApp.cpp | 6 +++--- ext/fox16_c/FXRuby.cpp | 26 +++++++++++++------------- ext/fox16_c/extconf.rb | 1 + 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/ext/fox16_c/FXRbApp.cpp b/ext/fox16_c/FXRbApp.cpp index acd6fe1..6a61bc4 100644 --- a/ext/fox16_c/FXRbApp.cpp +++ b/ext/fox16_c/FXRbApp.cpp @@ -26,7 +26,7 @@ #include "FXRbCommon.h" -#if !(defined(RUBY_1_9) || defined(RUBY_2_0)) +#if defined(RUBY_1_8) extern "C" { #include "rubysig.h" /* For CHECK_INTS */ } @@ -97,14 +97,14 @@ long FXRbApp::onChoreThreads(FXObject*,FXSelector,void*){ wait.tv_usec=100*sleepTime; // Confirm that this thread can be interrupted, then go to sleep -#if !(defined(RUBY_1_9) || defined(RUBY_2_0)) +#if defined(RUBY_1_8) CHECK_INTS; if(!rb_thread_critical) rb_thread_wait_for(wait); #else // if(!rb_thread_critical) rb_thread_wait_for(wait); rb_thread_wait_for(wait); -#endif /* RUBY_1_9 || RUBY_2_0 */ +#endif /* RUBY_1_8 */ // Re-register this chore for next time addChore(this,ID_CHORE_THREADS); diff --git a/ext/fox16_c/FXRuby.cpp b/ext/fox16_c/FXRuby.cpp index 94eee99..4f2cb14 100644 --- a/ext/fox16_c/FXRuby.cpp +++ b/ext/fox16_c/FXRuby.cpp @@ -39,19 +39,19 @@ #include <signal.h> // for definitions of SIGINT, etc. #endif -#if defined(RUBY_1_9) || defined(RUBY_2_0) - -#include "ruby/io.h" -#include "ruby/st.h" - -#else +#if defined(RUBY_1_8) extern "C" { #include "st.h" #include "rubyio.h" // for GetOpenFile(), etc. } -#endif /* RUBY_1_9 || RUBY_2_0 */ +#else + +#include "ruby/io.h" +#include "ruby/st.h" + +#endif /* RUBY_1_8 */ // Opaque type declaration from SWIG runtime @@ -204,17 +204,17 @@ FXInputHandle FXRbGetWriteFileHandle(VALUE obj) { VALUE vwrite = rb_intern("@write"); if(rb_ivar_defined(obj, vwrite)) obj = rb_ivar_get(obj, vwrite); fd = FIX2INT(rb_funcall(obj, rb_intern("fileno"), 0)); -#elif defined(RUBY_1_9) || defined(RUBY_2_0) +#elif defined(RUBY_1_8) + OpenFile *fptr; + GetOpenFile(obj, fptr); + FILE *fpw=GetWriteFile(fptr); + fd = fileno(fpw); +#else rb_io_t *fptr; GetOpenFile(obj, fptr); VALUE wrio = fptr->tied_io_for_writing; if(wrio) obj = wrio; fd = FIX2INT(rb_funcall(obj, rb_intern("fileno"), 0)); -#else - OpenFile *fptr; - GetOpenFile(obj, fptr); - FILE *fpw=GetWriteFile(fptr); - fd = fileno(fpw); #endif #ifdef WIN32 #ifdef __CYGWIN__ diff --git a/ext/fox16_c/extconf.rb b/ext/fox16_c/extconf.rb index 796c927..9e9b75a 100755 --- a/ext/fox16_c/extconf.rb +++ b/ext/fox16_c/extconf.rb @@ -145,6 +145,7 @@ end # Platform-specific modifications do_rake_compiler_setup +$CFLAGS += " -DRUBY_1_8" if RUBY_VERSION =~ /1\.8\./ $CFLAGS += " -DRUBY_1_9" if RUBY_VERSION =~ /1\.9\./ $CFLAGS += " -DRUBY_2_0" if RUBY_VERSION =~ /2\.0\./ -- GitLab