seed r762 - trunk/libseed



Author: racarr
Date: Sun Jan 18 20:23:32 2009
New Revision: 762
URL: http://svn.gnome.org/viewvc/seed?rev=762&view=rev

Log:
Add support for gfloat arrays.

Modified:
   trunk/libseed/seed-types.c

Modified: trunk/libseed/seed-types.c
==============================================================================
--- trunk/libseed/seed-types.c	(original)
+++ trunk/libseed/seed-types.c	Sun Jan 18 20:23:32 2009
@@ -125,7 +125,8 @@
 				else if (transfer == GI_TRANSFER_CONTAINER)
 					g_free(arg->v_pointer);
 			}
-			else if (g_type_info_get_tag(param_type) == GI_TYPE_TAG_GTYPE)
+			else if (g_type_info_get_tag(param_type) == GI_TYPE_TAG_GTYPE ||
+					 g_type_info_get_tag(param_type) == GI_TYPE_TAG_FLOAT)
 				g_free(arg->v_pointer);
 			else
 				g_assert_not_reached();
@@ -285,7 +286,7 @@
 
 		*array_p = result;
 	}
-	if (element_type == GI_TYPE_TAG_GTYPE)
+	else if (element_type == GI_TYPE_TAG_GTYPE)
 	{
 		GType *result;
 		guint i;
@@ -303,6 +304,24 @@
 
 		*array_p = result;
 	}
+	else if (element_type == GI_TYPE_TAG_FLOAT)
+	{
+		gfloat * result;
+		guint i;
+		
+		result = g_new0(gfloat, length+1);
+		
+		for (i = 0; i < length; i++)
+		{
+			JSValueRef elem = JSObjectGetPropertyAtIndex(ctx,
+														 (JSObjectRef) array,
+														 i,
+														 exception);
+			result[i] = seed_value_to_float(ctx, elem, exception);
+		}
+		
+		*array_p = result;
+	}
 	else
 	{
 		seed_make_exception(ctx, exception, "ArgumentError",



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