[seed] Support some more primitive array types



commit f37e1c383f4d34b480e6361284999bee04335b1e
Author: Robert Carr <racarr mireia (none)>
Date:   Mon Mar 2 21:35:41 2009 -0500

    Support some more primitive array types
---
 libseed/seed-types.c |   39 ++++++++++++++++++++++++++++++++++++++-
 1 files changed, 38 insertions(+), 1 deletions(-)

diff --git a/libseed/seed-types.c b/libseed/seed-types.c
index 2c6bdf9..1c1078c 100644
--- a/libseed/seed-types.c
+++ b/libseed/seed-types.c
@@ -131,7 +131,6 @@ seed_release_arg (GITransfer transfer,
 	      g_free (arg->v_pointer);
 	      break;
 	    case GI_TYPE_TAG_INTERFACE:
-	      // TODOOO FIXME
 	      break;
 	    default:
 	      g_assert_not_reached ();
@@ -335,6 +334,44 @@ seed_gi_make_array (JSContextRef ctx,
 	*array_p = result;
       }
       break;
+    case GI_TYPE_TAG_DOUBLE:
+      {
+	gdouble *result;
+	guint i;
+	
+	result = g_new0 (gdouble, length + 1);
+	
+	for (i = 0; i < length; i++)
+	  {
+	    JSValueRef elem = JSObjectGetPropertyAtIndex (ctx,
+							  (JSObjectRef) array,
+							  i,
+							  exception);
+	    result[i] = seed_value_to_double (ctx, elem, exception);
+	  }
+	
+	*array_p = result;
+      }
+      break;
+    case GI_TYPE_TAG_INT:
+      {
+	gint *result;
+	guint i;
+	
+	result = g_new0 (gint, length + 1);
+	
+	for (i = 0; i < length; i++)
+	  {
+	    JSValueRef elem = JSObjectGetPropertyAtIndex (ctx,
+							  (JSObjectRef) array,
+							  i,
+							  exception);
+	    result[i] = seed_value_to_int (ctx, elem, exception);
+	  }
+	
+	*array_p = result;
+      }
+      break;
     case GI_TYPE_TAG_UINT8:
       {
 	guint8 *result;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]