[seed] Expose seed_value_(to|from)_gi_argument



commit 1bd4ec7b96f1b19e94fdd5b2b4e0df03aa2c0666
Author: Garrett Regier <alias301 gmail com>
Date:   Thu Mar 24 10:21:48 2011 -0700

    Expose seed_value_(to|from)_gi_argument

 libseed/seed-closure.c  |    4 ++--
 libseed/seed-engine.c   |   10 +++++-----
 libseed/seed-importer.c |    2 +-
 libseed/seed-structs.c  |   10 +++++-----
 libseed/seed-types.c    |   24 ++++++++++++------------
 libseed/seed-types.h    |   17 +++++++++--------
 libseed/seed.h          |   10 ++++++++++
 7 files changed, 44 insertions(+), 33 deletions(-)
---
diff --git a/libseed/seed-closure.c b/libseed/seed-closure.c
index d01c240..c472f69 100644
--- a/libseed/seed-closure.c
+++ b/libseed/seed-closure.c
@@ -171,7 +171,7 @@ seed_handle_closure (ffi_cif * cif, void *result, void **args, void *userdata)
 	default:
 	  arg->v_pointer = 0;
 	}
-      jsargs[i] = seed_gi_argument_make_js (ctx, arg, arg_type, 0);
+      jsargs[i] = seed_value_from_gi_argument (ctx, arg, arg_type, 0);
       seed_gi_release_arg (g_arg_info_get_ownership_transfer (arg_info),
 			      arg_type, arg);
       g_base_info_unref ((GIBaseInfo *) arg_info);
@@ -191,7 +191,7 @@ seed_handle_closure (ffi_cif * cif, void *result, void **args, void *userdata)
       exception = 0;
     }
 
-  seed_gi_make_argument (ctx, (JSValueRef) return_value, return_type,
+  seed_value_to_gi_argument (ctx, (JSValueRef) return_value, return_type,
 			 &return_arg, 0);
   switch (return_tag)
     {
diff --git a/libseed/seed-engine.c b/libseed/seed-engine.c
index 1053fb8..c393727 100644
--- a/libseed/seed-engine.c
+++ b/libseed/seed-engine.c
@@ -607,8 +607,8 @@ seed_gobject_method_invoked (JSContextRef ctx,
                 }
             }
 
-          if (!seed_gi_make_argument (ctx, arguments[i], type_info,
-				      &in_args[n_in_args++], exception))
+          if (!seed_value_to_gi_argument (ctx, arguments[i], type_info,
+					  &in_args[n_in_args++], exception))
 	    {
 	      seed_make_exception (ctx, exception,
 				   "ArgumentError",
@@ -718,7 +718,7 @@ seed_gobject_method_invoked (JSContextRef ctx,
 
 	    }
 	  retval_ref =
-	    seed_gi_argument_make_js (ctx, &retval, type_info, exception);
+	    seed_value_from_gi_argument (ctx, &retval, type_info, exception);
 
 	  if (sunk)
 	    g_object_unref (G_OBJECT (retval.v_pointer));
@@ -769,8 +769,8 @@ seed_gobject_method_invoked (JSContextRef ctx,
 	}
       
       // we are now only dealing with OUT arguments.
-      jsout_val = seed_gi_argument_make_js (ctx, &out_values[out_args_pos],
-					    type_info, exception);
+      jsout_val = seed_value_from_gi_argument (ctx, &out_values[out_args_pos],
+					       type_info, exception);
   
 
 #if GOBJECT_INTROSPECTION_VERSION > 0x000613
diff --git a/libseed/seed-importer.c b/libseed/seed-importer.c
index 149180a..1d34ef3 100644
--- a/libseed/seed-importer.c
+++ b/libseed/seed-importer.c
@@ -348,7 +348,7 @@ seed_gi_importer_handle_constant (JSContextRef ctx,
 
   g_constant_info_get_value (info, &argument);
   constant_value =
-    seed_gi_argument_make_js (ctx, &argument, constant_type, exception);
+    seed_value_from_gi_argument (ctx, &argument, constant_type, exception);
   seed_object_set_property (ctx, namespace_ref,
 			    g_base_info_get_name ((GIBaseInfo *) info),
 			    constant_value);
diff --git a/libseed/seed-structs.c b/libseed/seed-structs.c
index b697f5b..f34c3fc 100644
--- a/libseed/seed-structs.c
+++ b/libseed/seed-structs.c
@@ -171,7 +171,7 @@ seed_field_get_value (JSContextRef ctx,
     }
 
   // Maybe need to release argument.
-  ret = seed_gi_argument_make_js (ctx, &field_value, field_type, exception);
+  ret = seed_value_from_gi_argument (ctx, &field_value, field_type, exception);
   if (field_type)
     g_base_info_unref ((GIBaseInfo *) field_type);
   return ret;
@@ -241,7 +241,7 @@ seed_union_set_property (JSContextRef context,
 
   field_type = g_field_info_get_type (field);
 
-  seed_gi_make_argument (context, value, field_type, &field_value, exception);
+  seed_value_to_gi_argument (context, value, field_type, &field_value, exception);
   ret = g_field_info_set_field (field, priv->pointer, &field_value);
 
   g_base_info_unref ((GIBaseInfo *) field_type);
@@ -283,7 +283,7 @@ seed_struct_set_property (JSContextRef context,
 
   field_type = g_field_info_get_type (field);
 
-  seed_gi_make_argument (context, value, field_type, &field_value, exception);
+  seed_value_to_gi_argument (context, value, field_type, &field_value, exception);
   ret = g_field_info_set_field (field, priv->pointer, &field_value);
 
   if (!ret) 
@@ -785,8 +785,8 @@ seed_construct_struct_type_with_parameters (JSContextRef ctx,
 					  (JSObjectRef) parameters,
 					  jsprop_name, NULL);
 
-      seed_gi_make_argument (ctx, jsprop_value, field_type, &field_value,
-			     exception);
+      seed_value_to_gi_argument (ctx, jsprop_value, field_type, &field_value,
+				 exception);
       set_ret = g_field_info_set_field (field, object, &field_value);
 
 	  if (!set_ret) 
diff --git a/libseed/seed-types.c b/libseed/seed-types.c
index 11e259c..121b277 100644
--- a/libseed/seed-types.c
+++ b/libseed/seed-types.c
@@ -474,11 +474,11 @@ seed_gi_make_array (JSContextRef ctx,
 }
 
 gboolean
-seed_gi_make_argument (JSContextRef ctx,
-		       JSValueRef value,
-		       GITypeInfo * type_info,
-		       GArgument * arg,
-		       JSValueRef * exception)
+seed_value_to_gi_argument (JSContextRef ctx,
+			   JSValueRef value,
+			   GITypeInfo * type_info,
+			   GArgument * arg,
+			   JSValueRef * exception)
 {
   GITypeTag gi_tag = g_type_info_get_tag (type_info);
 
@@ -800,9 +800,9 @@ seed_gi_make_argument (JSContextRef ctx,
 }
 
 JSValueRef
-seed_gi_argument_make_js (JSContextRef ctx,
-			  GArgument * arg, GITypeInfo * type_info,
-			  JSValueRef * exception)
+seed_value_from_gi_argument (JSContextRef ctx,
+			     GArgument * arg, GITypeInfo * type_info,
+			     JSValueRef * exception)
 {
   GITypeTag gi_tag = g_type_info_get_tag (type_info);
   switch (gi_tag)
@@ -936,8 +936,8 @@ seed_gi_argument_make_js (JSContextRef ctx,
 
 	    larg.v_pointer = list->data;
 	    ival =
-	      (JSValueRef) seed_gi_argument_make_js (ctx, &larg,
-						     list_type, exception);
+	      (JSValueRef) seed_value_from_gi_argument (ctx, &larg,
+							list_type, exception);
 	    if (!ival)
 	      ival = JSValueMakeNull (ctx);
 	    JSObjectSetPropertyAtIndex (ctx, ret, i, ival, NULL);
@@ -962,8 +962,8 @@ seed_gi_argument_make_js (JSContextRef ctx,
 	  {
 	    larg.v_pointer = list->data;
 	    ival =
-	      (JSValueRef) seed_gi_argument_make_js (ctx, &larg,
-						     list_type, exception);
+	      (JSValueRef) seed_value_from_gi_argument (ctx, &larg,
+							list_type, exception);
 	    if (!ival)
 	      ival = JSValueMakeNull (ctx);
 	    JSObjectSetPropertyAtIndex (ctx, ret, i, ival, NULL);
diff --git a/libseed/seed-types.h b/libseed/seed-types.h
index 44ca648..5889122 100644
--- a/libseed/seed-types.h
+++ b/libseed/seed-types.h
@@ -37,14 +37,15 @@ JSValueRef seed_object_get_property (JSContextRef ctx,
 gboolean seed_object_set_property (JSContextRef ctx, JSObjectRef object,
 				   const gchar * name, JSValueRef value);
 
-gboolean seed_gi_make_argument (JSContextRef ctx,
-				JSValueRef value,
-				GITypeInfo * type_info,
-				GArgument * arg, JSValueRef * exception);
-JSValueRef seed_gi_argument_make_js (JSContextRef ctx,
-				     GArgument * arg,
-				     GITypeInfo * type_info,
-				     JSValueRef * exception);
+gboolean seed_value_to_gi_argument (JSContextRef ctx,
+				    JSValueRef value,
+				    GITypeInfo * type_info,
+				    GArgument * arg, JSValueRef * exception);
+
+JSValueRef seed_value_from_gi_argument (JSContextRef ctx,
+				        GArgument * arg,
+				        GITypeInfo * type_info,
+				        JSValueRef * exception);
 
 gboolean seed_gi_release_arg (GITransfer transfer,
 			      GITypeInfo * type_info, GArgument * arg);
diff --git a/libseed/seed.h b/libseed/seed.h
index c1bb7d2..71ad61a 100644
--- a/libseed/seed.h
+++ b/libseed/seed.h
@@ -166,6 +166,16 @@ gboolean seed_value_to_gvalue (SeedContext ctx,
 SeedValue seed_value_from_gvalue (SeedContext ctx,
 				  GValue * gval, SeedException * exception);
 
+gboolean seed_value_to_gi_argument (SeedContext ctx,
+				    SeedValue value,
+				    GITypeInfo * type_info,
+				    GArgument * arg, SeedValue * exception);
+
+SeedValue seed_value_from_gi_argument (SeedContext ctx,
+				       GArgument * arg,
+				       GITypeInfo * type_info,
+				       SeedException * exception);
+
 gboolean seed_value_to_boolean (SeedContext ctx,
 				SeedValue val, SeedException * exception);
 



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