Browse files

Add compat with Ruby 2.0.

  • Loading branch information...
1 parent 0847b59 commit 706e4a1f3b87a0ad87b5785a2c222d733319d4f3 @larskanis committed Feb 26, 2013
Showing with 7 additions and 7 deletions.
  1. +3 −3 ext/fox16_c/FXRbApp.cpp
  2. +3 −3 ext/fox16_c/FXRuby.cpp
  3. +1 −1 ext/fox16_c/extconf.rb
View
6 ext/fox16_c/FXRbApp.cpp
@@ -26,7 +26,7 @@
#include "FXRbCommon.h"
-#ifndef RUBY_1_9
+#if !(defined(RUBY_1_9) || defined(RUBY_2_0))
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
-#ifndef RUBY_1_9
+#if !(defined(RUBY_1_9) || defined(RUBY_2_0))
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 */
+#endif /* RUBY_1_9 || RUBY_2_0 */
// Re-register this chore for next time
addChore(this,ID_CHORE_THREADS);
View
6 ext/fox16_c/FXRuby.cpp
@@ -39,7 +39,7 @@
#include <signal.h> // for definitions of SIGINT, etc.
#endif
-#ifdef RUBY_1_9
+#if defined(RUBY_1_9) || defined(RUBY_2_0)
#include "ruby/io.h"
#include "ruby/st.h"
@@ -51,7 +51,7 @@ extern "C" {
#include "rubyio.h" // for GetOpenFile(), etc.
}
-#endif /* RUBY_1_9 */
+#endif /* RUBY_1_9 || RUBY_2_0 */
// Opaque type declaration from SWIG runtime
@@ -204,7 +204,7 @@ 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)
+#elif defined(RUBY_1_9) || defined(RUBY_2_0)
rb_io_t *fptr;
GetOpenFile(obj, fptr);
VALUE wrio = fptr->tied_io_for_writing;
View
2 ext/fox16_c/extconf.rb
@@ -145,8 +145,8 @@ def do_rake_compiler_setup
# Platform-specific modifications
do_rake_compiler_setup
-# Check for Ruby 1.9
$CFLAGS += " -DRUBY_1_9" if RUBY_VERSION =~ /1\.9\./
+$CFLAGS += " -DRUBY_2_0" if RUBY_VERSION =~ /2\.0\./
# Last step: build the makefile
create_makefile("fox16_c")

0 comments on commit 706e4a1

Please sign in to comment.