[seed] Support for gobject introspection pre-0.9
- From: Alan Knowles <alank src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seed] Support for gobject introspection pre-0.9
- Date: Tue, 13 Jul 2010 03:44:46 +0000 (UTC)
commit b9a71e10a2fa30cb45ad2fe7ecbcc7ece6e1c941
Author: Alan Knowles <alan akbkhome com>
Date: Tue Jul 13 11:42:39 2010 +0800
Support for gobject introspection pre-0.9
Set's up defines for GOBJECT_INTROSPECTION_VERSION_MAJOR and GOBJECT_INTROSPECTION_VERSION_MINOR
configure.ac | 8 ++++++++
libseed/Makefile.am | 4 +++-
libseed/seed-closure.c | 41 ++++++++++++++++++++++++++++++++++++++++-
libseed/seed-types.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 98 insertions(+), 2 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index b01e08e..7fb8980 100644
--- a/configure.ac
+++ b/configure.ac
@@ -100,10 +100,18 @@ AS_CASE([$with_webkit],
AC_SUBST(WEBKIT_CFLAGS)
AC_SUBST(WEBKIT_LDFLAGS)
dnl =========================Introspection=====================================
+
PKG_CHECK_MODULES(GOBJECT_INTROSPECTION, gobject-introspection-1.0 >= 0.6.14)
AC_SUBST(GOBJECT_INTROSPECTION_CFLAGS)
AC_SUBST(GOBJECT_INTROSPECTION_LDFLAGS)
+GOBJECT_INTROSPECTION_VERSION_MAJOR=`$PKG_CONFIG --modversion gobject-introspection-1.0 | cut -d . -f 1`
+GOBJECT_INTROSPECTION_VERSION_MINOR=`$PKG_CONFIG --modversion gobject-introspection-1.0 | cut -d . -f 2`
+AC_SUBST(GOBJECT_INTROSPECTION_VERSION_MAJOR)
+AC_SUBST(GOBJECT_INTROSPECTION_VERSION_MINOR)
+
+
+
dnl ========================GNOME-js common====================================
PKG_CHECK_MODULES(GNOME_JS, gnome-js-common)
GNOME_JS_DIR=`pkg-config --variable=moduledir gnome-js-common`
diff --git a/libseed/Makefile.am b/libseed/Makefile.am
index 909aa2a..6393e19 100644
--- a/libseed/Makefile.am
+++ b/libseed/Makefile.am
@@ -32,7 +32,9 @@ libseed_la_CFLAGS = \
$(SEED_OSX_CFLAGS) \
$(SEED_DEBUG_CFLAGS) \
$(SEED_PROFILE_CFLAGS) \
- $(FFI_CFLAGS)
+ $(FFI_CFLAGS) \
+ -DGOBJECT_INTROSPECTION_VERSION_MAJOR=$(GOBJECT_INTROSPECTION_VERSION_MAJOR) \
+ -DGOBJECT_INTROSPECTION_VERSION_MINOR=$(GOBJECT_INTROSPECTION_VERSION_MINOR)
libseed_la_LDFLAGS = \
-no-undefined \
diff --git a/libseed/seed-closure.c b/libseed/seed-closure.c
index 1ce4b6f..8173fe2 100644
--- a/libseed/seed-closure.c
+++ b/libseed/seed-closure.c
@@ -76,6 +76,26 @@ seed_handle_closure (ffi_cif * cif, void *result, void **args, void *userdata)
switch (tag)
{
+#if GOBJECT_INTROSPECTION_VERSION_MAJOR == 0 && GOBJECT_INTROSPECTION_VERSION_MINOR < 9
+ case GI_TYPE_TAG_LONG:
+ arg->v_long = *(glong *) args[i];
+ break;
+ case GI_TYPE_TAG_ULONG:
+ arg->v_ulong = *(gulong *) args[i];
+ break;
+ case GI_TYPE_TAG_INT:
+ arg->v_int = *(gint *) args[i];
+ break;
+ case GI_TYPE_TAG_SSIZE:
+ arg->v_ssize = *(gssize *) args[i];
+ break;
+ case GI_TYPE_TAG_SIZE:
+ arg->v_size = *(gsize *) args[i];
+ break;
+ case GI_TYPE_TAG_UINT:
+ arg->v_uint = *(guint *) args[i];
+ break;
+#endif
case GI_TYPE_TAG_BOOLEAN:
arg->v_boolean = *(gboolean *) args[i];
break;
@@ -175,7 +195,26 @@ seed_handle_closure (ffi_cif * cif, void *result, void **args, void *userdata)
&return_arg, 0);
switch (return_tag)
{
-
+#if GOBJECT_INTROSPECTION_VERSION_MAJOR == 0 && GOBJECT_INTROSPECTION_VERSION_MINOR < 9
+ case GI_TYPE_TAG_LONG:
+ *(glong *) result = return_arg.v_long;
+ break;
+ case GI_TYPE_TAG_ULONG:
+ *(gulong *) result = return_arg.v_ulong;
+ break;
+ case GI_TYPE_TAG_INT:
+ *(gint *) result = return_arg.v_int;
+ break;
+ case GI_TYPE_TAG_SSIZE:
+ *(gssize *) result = return_arg.v_ssize;
+ break;
+ case GI_TYPE_TAG_SIZE:
+ *(gsize *) result = return_arg.v_size;
+ break;
+ case GI_TYPE_TAG_UINT:
+ *(guint *) result = return_arg.v_uint;
+ break;
+#endif
case GI_TYPE_TAG_BOOLEAN:
*(gboolean *) result = return_arg.v_boolean;
break;
diff --git a/libseed/seed-types.c b/libseed/seed-types.c
index 12ae227..1548909 100644
--- a/libseed/seed-types.c
+++ b/libseed/seed-types.c
@@ -389,6 +389,10 @@ seed_gi_make_array (JSContextRef ctx,
*array_p = dblresult;
}
break;
+
+#if GOBJECT_INTROSPECTION_VERSION_MAJOR == 0 && GOBJECT_INTROSPECTION_VERSION_MINOR < 9
+ case GI_TYPE_TAG_INT:
+#endif
case GI_TYPE_TAG_INT32:
{
gint *intresult;
@@ -512,6 +516,31 @@ seed_gi_make_argument (JSContextRef ctx,
arg->v_pointer = gobject;
}
break;
+
+#if GOBJECT_INTROSPECTION_VERSION_MAJOR == 0 && GOBJECT_INTROSPECTION_VERSION_MINOR < 9
+ case GI_TYPE_TAG_LONG:
+ arg->v_long = seed_value_to_long (ctx, value, exception);
+ break;
+ case GI_TYPE_TAG_ULONG:
+ arg->v_ulong = seed_value_to_ulong (ctx, value, exception);
+ break;
+ case GI_TYPE_TAG_INT:
+ arg->v_int = seed_value_to_int (ctx, value, exception);
+ break;
+ case GI_TYPE_TAG_UINT:
+ arg->v_uint = seed_value_to_uint (ctx, value, exception);
+ break;
+ case GI_TYPE_TAG_SIZE:
+ arg->v_size = seed_value_to_size (ctx, value, exception);
+ break;
+ case GI_TYPE_TAG_SSIZE:
+ arg->v_ssize = seed_value_to_ssize (ctx, value, exception);
+ break;
+ case GI_TYPE_TAG_TIME_T:
+ arg->v_long = seed_value_to_time_t (ctx, value, exception);
+ break;
+#endif
+
case GI_TYPE_TAG_BOOLEAN:
arg->v_boolean = seed_value_to_boolean (ctx, value, exception);
break;
@@ -778,6 +807,24 @@ seed_gi_argument_make_js (JSContextRef ctx,
GITypeTag gi_tag = g_type_info_get_tag (type_info);
switch (gi_tag)
{
+
+#if GOBJECT_INTROSPECTION_VERSION_MAJOR == 0 && GOBJECT_INTROSPECTION_VERSION_MINOR < 9
+ case GI_TYPE_TAG_LONG:
+ return seed_value_from_long (ctx, arg->v_long, exception);
+ case GI_TYPE_TAG_ULONG:
+ return seed_value_from_ulong (ctx, arg->v_ulong, exception);
+ case GI_TYPE_TAG_INT:
+ return seed_value_from_int (ctx, arg->v_int32, exception);
+ case GI_TYPE_TAG_UINT:
+ return seed_value_from_uint (ctx, arg->v_uint32, exception);
+ case GI_TYPE_TAG_SSIZE:
+ return seed_value_from_ssize (ctx, arg->v_ssize, exception);
+ case GI_TYPE_TAG_SIZE:
+ return seed_value_from_size (ctx, arg->v_size, exception);
+ case GI_TYPE_TAG_TIME_T:
+ return seed_value_from_time_t (ctx, arg->v_long, exception);
+#endif
+
case GI_TYPE_TAG_VOID:
return JSValueMakeUndefined (ctx);
case GI_TYPE_TAG_BOOLEAN:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]