From 706e4a1f3b87a0ad87b5785a2c222d733319d4f3 Mon Sep 17 00:00:00 2001
From: Lars Kanis <kanis@comcard.de>
Date: Tue, 26 Feb 2013 10:01:20 +0100
Subject: [PATCH] Add compat with Ruby 2.0.

---
 ext/fox16_c/FXRbApp.cpp | 6 +++---
 ext/fox16_c/FXRuby.cpp  | 6 +++---
 ext/fox16_c/extconf.rb  | 2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/ext/fox16_c/FXRbApp.cpp b/ext/fox16_c/FXRbApp.cpp
index 7ade711..acd6fe1 100644
--- a/ext/fox16_c/FXRbApp.cpp
+++ b/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);
diff --git a/ext/fox16_c/FXRuby.cpp b/ext/fox16_c/FXRuby.cpp
index f933db3..94eee99 100644
--- a/ext/fox16_c/FXRuby.cpp
+++ b/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;
diff --git a/ext/fox16_c/extconf.rb b/ext/fox16_c/extconf.rb
index ba24adf..796c927 100755
--- a/ext/fox16_c/extconf.rb
+++ b/ext/fox16_c/extconf.rb
@@ -145,8 +145,8 @@ end
 # 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")
-- 
GitLab