[ruby-oci8-commit] [409] trunk/ruby-oci8/ext/oci8: * ext/oci8/env.c, ext/oci8/error.c, ext/ oci8/extconf.rb, ext/oci8/oci8.c,

nobody at rubyforge.org nobody at rubyforge.org
Sat Aug 28 05:02:01 EDT 2010


Revision: 409
Author:   kubo
Date:     2010-08-28 05:02:01 -0400 (Sat, 28 Aug 2010)

Log Message:
-----------
* ext/oci8/env.c, ext/oci8/error.c, ext/oci8/extconf.rb, ext/oci8/oci8.c,
  ext/oci8/oci8.h, oci8/oci8lib.c, ext/oci8/ocinumber.c: fix for rubinius.
    Note that this is not enough to compile ruby-oci8 on it.

Modified Paths:
--------------
    branches/ruby-oci8-2.0/ChangeLog
    branches/ruby-oci8-2.0/ext/oci8/env.c
    branches/ruby-oci8-2.0/ext/oci8/error.c
    branches/ruby-oci8-2.0/ext/oci8/extconf.rb
    branches/ruby-oci8-2.0/ext/oci8/oci8.c
    branches/ruby-oci8-2.0/ext/oci8/oci8.h
    branches/ruby-oci8-2.0/ext/oci8/oci8lib.c
    branches/ruby-oci8-2.0/ext/oci8/ocinumber.c
    trunk/ruby-oci8/ChangeLog
    trunk/ruby-oci8/ext/oci8/env.c
    trunk/ruby-oci8/ext/oci8/error.c
    trunk/ruby-oci8/ext/oci8/extconf.rb
    trunk/ruby-oci8/ext/oci8/oci8.c
    trunk/ruby-oci8/ext/oci8/oci8.h
    trunk/ruby-oci8/ext/oci8/oci8lib.c
    trunk/ruby-oci8/ext/oci8/ocinumber.c

Modified: branches/ruby-oci8-2.0/ChangeLog
===================================================================
--- branches/ruby-oci8-2.0/ChangeLog	2010-08-23 15:39:13 UTC (rev 408)
+++ branches/ruby-oci8-2.0/ChangeLog	2010-08-28 09:02:01 UTC (rev 409)
@@ -1,3 +1,8 @@
+2010-08-28  KUBO Takehiro  <kubo at jiubao.org>
+	* ext/oci8/env.c, ext/oci8/error.c, ext/oci8/extconf.rb, ext/oci8/oci8.c,
+	  ext/oci8/oci8.h, oci8/oci8lib.c, ext/oci8/ocinumber.c: fix for rubinius.
+	    Note that this is not enough to compile ruby-oci8 on it.
+
 2010-08-23  KUBO Takehiro  <kubo at jiubao.org>
 	* lib/oci8/object.rb: fix an error when SDO_GEOMETRY is used
 	    and $VERBOSE is set.

Modified: branches/ruby-oci8-2.0/ext/oci8/env.c
===================================================================
--- branches/ruby-oci8-2.0/ext/oci8/env.c	2010-08-23 15:39:13 UTC (rev 408)
+++ branches/ruby-oci8-2.0/ext/oci8/env.c	2010-08-28 09:02:01 UTC (rev 409)
@@ -6,7 +6,7 @@
  */
 #include "oci8.h"
 
-#if !defined(RUBY_VM)
+#if defined(HAVE_UTIL_H)
 /* ruby_setenv for workaround ruby 1.8.4 */
 #include <util.h>
 #endif

Modified: branches/ruby-oci8-2.0/ext/oci8/error.c
===================================================================
--- branches/ruby-oci8-2.0/ext/oci8/error.c	2010-08-23 15:39:13 UTC (rev 408)
+++ branches/ruby-oci8-2.0/ext/oci8/error.c	2010-08-28 09:02:01 UTC (rev 409)
@@ -10,6 +10,10 @@
 */
 #include "oci8.h"
 
+#ifndef DLEXT
+#define DLEXT ".so"
+#endif
+
 /* Exception */
 VALUE eOCIException;
 VALUE eOCIBreak;

Modified: branches/ruby-oci8-2.0/ext/oci8/extconf.rb
===================================================================
--- branches/ruby-oci8-2.0/ext/oci8/extconf.rb	2010-08-23 15:39:13 UTC (rev 408)
+++ branches/ruby-oci8-2.0/ext/oci8/extconf.rb	2010-08-28 09:02:01 UTC (rev 409)
@@ -111,6 +111,8 @@
 have_var("ruby_errinfo", "ruby.h") # ruby 1.8
 have_func("rb_errinfo", "ruby.h")  # ruby 1.9
 
+have_type("rb_blocking_function_t", "ruby.h")
+
 # replace files
 replace = {
   'OCI8_CLIENT_VERSION' => oraconf.version,

Modified: branches/ruby-oci8-2.0/ext/oci8/oci8.c
===================================================================
--- branches/ruby-oci8-2.0/ext/oci8/oci8.c	2010-08-23 15:39:13 UTC (rev 408)
+++ branches/ruby-oci8-2.0/ext/oci8/oci8.c	2010-08-28 09:02:01 UTC (rev 409)
@@ -313,7 +313,7 @@
     }
     svcctx->pid = getpid();
     svcctx->is_autocommit = 0;
-#ifdef RUBY_VM
+#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T
     svcctx->non_blocking = 1;
 #endif
     svcctx->long_read_len = INT2FIX(65535);
@@ -417,7 +417,7 @@
 static VALUE oci8_non_blocking_p(VALUE self)
 {
     oci8_svcctx_t *svcctx = DATA_PTR(self);
-#ifdef RUBY_VM
+#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T
     return svcctx->non_blocking ? Qtrue : Qfalse;
 #else
     sb1 non_blocking;
@@ -470,7 +470,7 @@
 static VALUE oci8_set_non_blocking(VALUE self, VALUE val)
 {
     oci8_svcctx_t *svcctx = DATA_PTR(self);
-#ifdef RUBY_VM
+#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T
     svcctx->non_blocking = RTEST(val);
 #else
     sb1 non_blocking;
@@ -560,14 +560,14 @@
 static VALUE oci8_break(VALUE self)
 {
     oci8_svcctx_t *svcctx = DATA_PTR(self);
-#ifndef RUBY_VM
+#ifndef HAVE_TYPE_RB_BLOCKING_FUNCTION_T
     sword rv;
 #endif
 
     if (NIL_P(svcctx->executing_thread)) {
         return Qfalse;
     }
-#ifndef RUBY_VM
+#ifndef HAVE_TYPE_RB_BLOCKING_FUNCTION_T
     rv = OCIBreak(svcctx->base.hp.ptr, oci8_errhp);
     if (rv != OCI_SUCCESS)
         oci8_raise(oci8_errhp, rv, NULL);

Modified: branches/ruby-oci8-2.0/ext/oci8/oci8.h
===================================================================
--- branches/ruby-oci8-2.0/ext/oci8/oci8.h	2010-08-23 15:39:13 UTC (rev 408)
+++ branches/ruby-oci8-2.0/ext/oci8/oci8.h	2010-08-28 09:02:01 UTC (rev 409)
@@ -135,7 +135,7 @@
 #if !defined(HAVE_RB_ERRINFO) && defined(HAVE_RUBY_ERRINFO)
 #define rb_errinfo() ruby_errinfo
 #endif
-#ifndef RUBY_VM
+#ifndef HAVE_TYPE_RB_BLOCKING_FUNCTION_T
 typedef VALUE rb_blocking_function_t(void *);
 #endif
 
@@ -185,7 +185,7 @@
  *    set a value to the key.
  *
  */
-#ifdef RUBY_VM
+#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T
 /* ruby 1.9 */
 #if defined(_WIN32)
 #include <windows.h>
@@ -195,16 +195,14 @@
     (*(key_p) == 0xFFFFFFFF) ? GetLastError() : 0)
 #define oci8_tls_get(key)        TlsGetValue(key)
 #define oci8_tls_set(key, val)   TlsSetValue((key), (val))
-#elif defined(HAVE_PTHREAD_H)
+#else
 #include <pthread.h>
 #define oci8_tls_key_t           pthread_key_t
 #define oci8_tls_key_init(key_p) pthread_key_create((key_p), NULL)
 #define oci8_tls_get(key)        pthread_getspecific(key)
 #define oci8_tls_set(key, val)   pthread_setspecific((key), (val))
-#else
-#error unsupported thread API
 #endif
-#endif /* RUBY_VM */
+#endif /* HAVE_TYPE_RB_BLOCKING_FUNCTION_T */
 
 /* utility macros
  */
@@ -310,7 +308,7 @@
     OCIServer *srvhp;
     rb_pid_t pid;
     char is_autocommit;
-#ifdef RUBY_VM
+#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T
     char non_blocking;
 #endif
     VALUE long_read_len;
@@ -364,7 +362,7 @@
  *   extern OCIError *oci8_errhp;
  */
 #define oci8_envhp (LIKELY(oci8_global_envhp != NULL) ? oci8_global_envhp : oci8_make_envhp())
-#ifdef RUBY_VM
+#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T
 #define oci8_errhp oci8_get_errhp()
 #else
 #define oci8_errhp (LIKELY(oci8_global_errhp != NULL) ? oci8_global_errhp : oci8_make_errhp())
@@ -374,7 +372,7 @@
 extern ub4 oci8_env_mode;
 extern OCIEnv *oci8_global_envhp;
 OCIEnv *oci8_make_envhp(void);
-#ifdef RUBY_VM
+#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T
 extern oci8_tls_key_t oci8_tls_key; /* native thread key */
 OCIError *oci8_make_errhp(void);
 

Modified: branches/ruby-oci8-2.0/ext/oci8/oci8lib.c
===================================================================
--- branches/ruby-oci8-2.0/ext/oci8/oci8lib.c	2010-08-23 15:39:13 UTC (rev 408)
+++ branches/ruby-oci8-2.0/ext/oci8/oci8lib.c	2010-08-28 09:02:01 UTC (rev 409)
@@ -196,7 +196,7 @@
     base->parent = NULL;
 }
 
-#ifdef RUBY_VM
+#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T
 
 #if 0
 typedef struct {
@@ -251,7 +251,7 @@
         return (sword)func(data);
     }
 }
-#else /* RUBY_VM */
+#else /* HAVE_TYPE_RB_BLOCKING_FUNCTION_T */
 
 /* ruby 1.8 */
 sword oci8_blocking_region(oci8_svcctx_t *svcctx, rb_blocking_function_t func, void *data)
@@ -281,7 +281,7 @@
     svcctx->executing_thread = Qnil;
     return rv;
 }
-#endif /* RUBY_VM */
+#endif /* HAVE_TYPE_RB_BLOCKING_FUNCTION_T */
 
 typedef struct {
     oci8_svcctx_t *svcctx;

Modified: branches/ruby-oci8-2.0/ext/oci8/ocinumber.c
===================================================================
--- branches/ruby-oci8-2.0/ext/oci8/ocinumber.c	2010-08-23 15:39:13 UTC (rev 408)
+++ branches/ruby-oci8-2.0/ext/oci8/ocinumber.c	2010-08-28 09:02:01 UTC (rev 409)
@@ -10,7 +10,7 @@
 #include <errno.h>
 #include "oranumber_util.h"
 
-#ifndef RUBY_VM
+#ifndef RB_NUM_COERCE_FUNCS_NEED_OPID
 /* ruby 1.8 */
 #define rb_num_coerce_cmp(x, y, id) rb_num_coerce_cmp((x), (y))
 #define rb_num_coerce_bin(x, y, id) rb_num_coerce_bin((x), (y))
@@ -39,6 +39,9 @@
 
 #define _NUMBER(val) ((OCINumber *)DATA_PTR(val)) /* dangerous macro */
 
+#ifndef T_MASK
+#define T_MASK 0x100 /* TODO: rboci8_type() should be changed to be more portable. */
+#endif
 #define RBOCI8_T_ORANUMBER (T_MASK + 1)
 #define RBOCI8_T_BIGDECIMAL (T_MASK + 2)
 #ifdef T_RATIONAL

Modified: trunk/ruby-oci8/ChangeLog
===================================================================
--- trunk/ruby-oci8/ChangeLog	2010-08-23 15:39:13 UTC (rev 408)
+++ trunk/ruby-oci8/ChangeLog	2010-08-28 09:02:01 UTC (rev 409)
@@ -1,3 +1,8 @@
+2010-08-28  KUBO Takehiro  <kubo at jiubao.org>
+	* ext/oci8/env.c, ext/oci8/error.c, ext/oci8/extconf.rb, ext/oci8/oci8.c,
+	  ext/oci8/oci8.h, oci8/oci8lib.c, ext/oci8/ocinumber.c: fix for rubinius.
+	    Note that this is not enough to compile ruby-oci8 on it.
+
 2010-08-23  KUBO Takehiro  <kubo at jiubao.org>
 	* lib/oci8/object.rb: fix an error when SDO_GEOMETRY is used
 	    and $VERBOSE is set.

Modified: trunk/ruby-oci8/ext/oci8/env.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/env.c	2010-08-23 15:39:13 UTC (rev 408)
+++ trunk/ruby-oci8/ext/oci8/env.c	2010-08-28 09:02:01 UTC (rev 409)
@@ -6,7 +6,7 @@
  */
 #include "oci8.h"
 
-#if !defined(RUBY_VM)
+#if defined(HAVE_UTIL_H)
 /* ruby_setenv for workaround ruby 1.8.4 */
 #include <util.h>
 #endif

Modified: trunk/ruby-oci8/ext/oci8/error.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/error.c	2010-08-23 15:39:13 UTC (rev 408)
+++ trunk/ruby-oci8/ext/oci8/error.c	2010-08-28 09:02:01 UTC (rev 409)
@@ -10,6 +10,10 @@
 */
 #include "oci8.h"
 
+#ifndef DLEXT
+#define DLEXT ".so"
+#endif
+
 /* Exception */
 VALUE eOCIException;
 VALUE eOCIBreak;

Modified: trunk/ruby-oci8/ext/oci8/extconf.rb
===================================================================
--- trunk/ruby-oci8/ext/oci8/extconf.rb	2010-08-23 15:39:13 UTC (rev 408)
+++ trunk/ruby-oci8/ext/oci8/extconf.rb	2010-08-28 09:02:01 UTC (rev 409)
@@ -113,6 +113,8 @@
 have_var("ruby_errinfo", "ruby.h") # ruby 1.8
 have_func("rb_errinfo", "ruby.h")  # ruby 1.9
 
+have_type("rb_blocking_function_t", "ruby.h")
+
 # replace files
 replace = {
   'OCI8_CLIENT_VERSION' => oraconf.version,

Modified: trunk/ruby-oci8/ext/oci8/oci8.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/oci8.c	2010-08-23 15:39:13 UTC (rev 408)
+++ trunk/ruby-oci8/ext/oci8/oci8.c	2010-08-28 09:02:01 UTC (rev 409)
@@ -70,7 +70,7 @@
     svcctx->server = DATA_PTR(rb_obj_alloc(oci8_cOCIHandle));
     svcctx->pid = getpid();
     svcctx->is_autocommit = 0;
-#ifdef RUBY_VM
+#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T
     svcctx->non_blocking = 1;
 #endif
     svcctx->long_read_len = INT2FIX(65535);
@@ -448,7 +448,7 @@
 static VALUE oci8_non_blocking_p(VALUE self)
 {
     oci8_svcctx_t *svcctx = DATA_PTR(self);
-#ifdef RUBY_VM
+#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T
     return svcctx->non_blocking ? Qtrue : Qfalse;
 #else
     sb1 non_blocking;
@@ -501,7 +501,7 @@
 static VALUE oci8_set_non_blocking(VALUE self, VALUE val)
 {
     oci8_svcctx_t *svcctx = DATA_PTR(self);
-#ifdef RUBY_VM
+#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T
     svcctx->non_blocking = RTEST(val);
 #else
     sb1 non_blocking;
@@ -591,14 +591,14 @@
 static VALUE oci8_break(VALUE self)
 {
     oci8_svcctx_t *svcctx = DATA_PTR(self);
-#ifndef RUBY_VM
+#ifndef HAVE_TYPE_RB_BLOCKING_FUNCTION_T
     sword rv;
 #endif
 
     if (NIL_P(svcctx->executing_thread)) {
         return Qfalse;
     }
-#ifndef RUBY_VM
+#ifndef HAVE_TYPE_RB_BLOCKING_FUNCTION_T
     rv = OCIBreak(svcctx->base.hp.ptr, oci8_errhp);
     if (rv != OCI_SUCCESS)
         oci8_raise(oci8_errhp, rv, NULL);

Modified: trunk/ruby-oci8/ext/oci8/oci8.h
===================================================================
--- trunk/ruby-oci8/ext/oci8/oci8.h	2010-08-23 15:39:13 UTC (rev 408)
+++ trunk/ruby-oci8/ext/oci8/oci8.h	2010-08-28 09:02:01 UTC (rev 409)
@@ -138,7 +138,7 @@
 #if !defined(HAVE_RB_ERRINFO) && defined(HAVE_RUBY_ERRINFO)
 #define rb_errinfo() ruby_errinfo
 #endif
-#ifndef RUBY_VM
+#ifndef HAVE_TYPE_RB_BLOCKING_FUNCTION_T
 typedef VALUE rb_blocking_function_t(void *);
 #endif
 
@@ -188,7 +188,7 @@
  *    set a value to the key.
  *
  */
-#ifdef RUBY_VM
+#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T
 /* ruby 1.9 */
 #if defined(_WIN32)
 #include <windows.h>
@@ -198,16 +198,14 @@
     (*(key_p) == 0xFFFFFFFF) ? GetLastError() : 0)
 #define oci8_tls_get(key)        TlsGetValue(key)
 #define oci8_tls_set(key, val)   TlsSetValue((key), (val))
-#elif defined(HAVE_PTHREAD_H)
+#else
 #include <pthread.h>
 #define oci8_tls_key_t           pthread_key_t
 #define oci8_tls_key_init(key_p) pthread_key_create((key_p), NULL)
 #define oci8_tls_get(key)        pthread_getspecific(key)
 #define oci8_tls_set(key, val)   pthread_setspecific((key), (val))
-#else
-#error unsupported thread API
 #endif
-#endif /* RUBY_VM */
+#endif /* HAVE_TYPE_RB_BLOCKING_FUNCTION_T */
 
 /* utility macros
  */
@@ -317,7 +315,7 @@
     rb_pid_t pid;
     unsigned char state;
     char is_autocommit;
-#ifdef RUBY_VM
+#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T
     char non_blocking;
 #endif
     VALUE long_read_len;
@@ -371,7 +369,7 @@
  *   extern OCIError *oci8_errhp;
  */
 #define oci8_envhp (LIKELY(oci8_global_envhp != NULL) ? oci8_global_envhp : oci8_make_envhp())
-#ifdef RUBY_VM
+#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T
 #define oci8_errhp oci8_get_errhp()
 #else
 #define oci8_errhp (LIKELY(oci8_global_errhp != NULL) ? oci8_global_errhp : oci8_make_errhp())
@@ -381,7 +379,7 @@
 extern ub4 oci8_env_mode;
 extern OCIEnv *oci8_global_envhp;
 OCIEnv *oci8_make_envhp(void);
-#ifdef RUBY_VM
+#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T
 extern oci8_tls_key_t oci8_tls_key; /* native thread key */
 OCIError *oci8_make_errhp(void);
 

Modified: trunk/ruby-oci8/ext/oci8/oci8lib.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/oci8lib.c	2010-08-23 15:39:13 UTC (rev 408)
+++ trunk/ruby-oci8/ext/oci8/oci8lib.c	2010-08-28 09:02:01 UTC (rev 409)
@@ -200,7 +200,7 @@
     base->parent = NULL;
 }
 
-#ifdef RUBY_VM
+#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T
 
 #if 0
 typedef struct {
@@ -255,7 +255,7 @@
         return (sword)func(data);
     }
 }
-#else /* RUBY_VM */
+#else /* HAVE_TYPE_RB_BLOCKING_FUNCTION_T */
 
 /* ruby 1.8 */
 sword oci8_blocking_region(oci8_svcctx_t *svcctx, rb_blocking_function_t func, void *data)
@@ -285,7 +285,7 @@
     svcctx->executing_thread = Qnil;
     return rv;
 }
-#endif /* RUBY_VM */
+#endif /* HAVE_TYPE_RB_BLOCKING_FUNCTION_T */
 
 typedef struct {
     oci8_svcctx_t *svcctx;

Modified: trunk/ruby-oci8/ext/oci8/ocinumber.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/ocinumber.c	2010-08-23 15:39:13 UTC (rev 408)
+++ trunk/ruby-oci8/ext/oci8/ocinumber.c	2010-08-28 09:02:01 UTC (rev 409)
@@ -10,7 +10,7 @@
 #include <errno.h>
 #include "oranumber_util.h"
 
-#ifndef RUBY_VM
+#ifndef RB_NUM_COERCE_FUNCS_NEED_OPID
 /* ruby 1.8 */
 #define rb_num_coerce_cmp(x, y, id) rb_num_coerce_cmp((x), (y))
 #define rb_num_coerce_bin(x, y, id) rb_num_coerce_bin((x), (y))
@@ -39,6 +39,9 @@
 
 #define _NUMBER(val) ((OCINumber *)DATA_PTR(val)) /* dangerous macro */
 
+#ifndef T_MASK
+#define T_MASK 0x100 /* TODO: rboci8_type() should be changed to be more portable. */
+#endif
 #define RBOCI8_T_ORANUMBER (T_MASK + 1)
 #define RBOCI8_T_BIGDECIMAL (T_MASK + 2)
 #ifdef T_RATIONAL




More information about the ruby-oci8-commit mailing list