seed r351 - trunk/libseed
- From: racarr svn gnome org
- To: svn-commits-list gnome org
- Subject: seed r351 - trunk/libseed
- Date: Tue, 25 Nov 2008 07:02:42 +0000 (UTC)
Author: racarr
Date: Tue Nov 25 07:02:41 2008
New Revision: 351
URL: http://svn.gnome.org/viewvc/seed?rev=351&view=rev
Log:
Lots more global context cleanup in seed-structs.c
Modified:
trunk/libseed/seed-builtins.c
trunk/libseed/seed-engine.c
trunk/libseed/seed-gtype.c
trunk/libseed/seed-structs.c
trunk/libseed/seed-structs.h
trunk/libseed/seed-types.c
Modified: trunk/libseed/seed-builtins.c
==============================================================================
--- trunk/libseed/seed-builtins.c (original)
+++ trunk/libseed/seed-builtins.c Tue Nov 25 07:02:41 2008
@@ -372,7 +372,7 @@
else
closure = seed_make_gclosure(ctx, (JSObjectRef) arguments[0], 0);
- return (JSValueRef) seed_make_struct(closure, 0);
+ return (JSValueRef) seed_make_struct(ctx, closure, 0);
}
static JSValueRef
Modified: trunk/libseed/seed-engine.c
==============================================================================
--- trunk/libseed/seed-engine.c (original)
+++ trunk/libseed/seed-engine.c Tue Nov 25 07:02:41 2008
@@ -268,7 +268,7 @@
// get it.
if (!
((object = seed_value_to_object(this_object, 0)) ||
- (object = seed_pointer_get_pointer(this_object))))
+ (object = seed_pointer_get_pointer(ctx, this_object))))
instance_method = FALSE;
n_args = g_callable_info_get_n_args((GICallableInfo *) info);
@@ -697,7 +697,8 @@
found_field:
if (field)
{
- ret = seed_field_get_value(b, field, exception);
+ ret = seed_field_get_value(context, b,
+ field, exception);
g_base_info_unref((GIBaseInfo *) info);
g_free(cproperty_name);
return ret;
Modified: trunk/libseed/seed-gtype.c
==============================================================================
--- trunk/libseed/seed-gtype.c (original)
+++ trunk/libseed/seed-gtype.c Tue Nov 25 07:02:41 2008
@@ -230,12 +230,12 @@
return JSValueMakeNull(ctx);
}
- spec = (GParamSpec *) seed_pointer_get_pointer(arguments[0]);
+ spec = (GParamSpec *) seed_pointer_get_pointer(ctx, arguments[0]);
oldcount = seed_object_get_property(thisObject, "property_count");
property_count = seed_value_to_int(oldcount, exception);
- class = seed_pointer_get_pointer(thisObject);
+ class = seed_pointer_get_pointer(ctx, thisObject);
g_object_class_install_property(class, property_count, spec);
newcount = seed_value_from_int(property_count + 1, exception);
@@ -362,7 +362,7 @@
JSValueRef exception = 0;
type = (GType) JSObjectGetPrivate(*(JSObjectRef *) args[1]);
- jsargs[0] = seed_make_pointer(*(gpointer *) args[0]);
+ jsargs[0] = seed_make_pointer(eng->context, *(gpointer *) args[0]);
jsargs[1] = seed_gobject_get_prototype_for_gtype(type);
// TODO:
@@ -395,7 +395,7 @@
JSValueRef exception = 0;
JSObjectRef this_object;
- jsargs = seed_make_pointer(*(gpointer *) args[1]);
+ jsargs = seed_make_pointer(eng->context, *(gpointer *) args[1]);
this_object =
(JSObjectRef) seed_value_from_object(*(GObject **) args[0], 0);
Modified: trunk/libseed/seed-structs.c
==============================================================================
--- trunk/libseed/seed-structs.c (original)
+++ trunk/libseed/seed-structs.c Tue Nov 25 07:02:41 2008
@@ -113,7 +113,8 @@
}
JSValueRef
-seed_field_get_value(gpointer object,
+seed_field_get_value(JSContextRef ctx,
+ gpointer object,
GIFieldInfo * field,
JSValueRef * exception)
{
@@ -136,20 +137,20 @@
switch (g_base_info_get_type(interface))
{
case GI_INFO_TYPE_STRUCT:
- return seed_make_struct((object + offset), interface);
+ return seed_make_struct(ctx, (object + offset), interface);
case GI_INFO_TYPE_UNION:
- return seed_make_union((object + offset), interface);
+ return seed_make_union(ctx, (object + offset), interface);
case GI_INFO_TYPE_BOXED:
- return seed_make_boxed((object + offset), interface);
+ return seed_make_boxed(ctx, (object + offset), interface);
default:
g_base_info_unref(interface);
}
}
- return JSValueMakeNull(eng->context);
+ return JSValueMakeNull(ctx);
}
// Maybe need to release argument.
@@ -191,7 +192,8 @@
return 0;
}
- ret = seed_field_get_value(priv->pointer, field, exception);
+ ret = seed_field_get_value(context,
+ priv->pointer, field, exception);
g_base_info_unref((GIBaseInfo *) field);
@@ -273,7 +275,8 @@
return 0;
}
- ret = seed_field_get_value(priv->pointer, field, exception);
+ ret = seed_field_get_value(context,
+ priv->pointer, field, exception);
g_base_info_unref((GIBaseInfo *) field);
g_free(cproperty_name);
@@ -361,9 +364,9 @@
NULL /* Convert To Type */
};
-gpointer seed_pointer_get_pointer(JSValueRef pointer)
+gpointer seed_pointer_get_pointer(JSContextRef ctx, JSValueRef pointer)
{
- if (JSValueIsObjectOfClass(eng->context, pointer, seed_pointer_class))
+ if (JSValueIsObjectOfClass(ctx, pointer, seed_pointer_class))
{
seed_struct_privates *priv = JSObjectGetPrivate((JSObjectRef) pointer);
return priv->pointer;
@@ -371,7 +374,9 @@
return 0;
}
-void seed_pointer_set_free(JSValueRef pointer, gboolean free_pointer)
+void seed_pointer_set_free(JSContextRef ctx,
+ JSValueRef pointer,
+ gboolean free_pointer)
{
if (JSValueIsObjectOfClass(eng->context, pointer, seed_pointer_class))
{
@@ -380,17 +385,18 @@
}
}
-JSObjectRef seed_make_pointer(gpointer pointer)
+JSObjectRef seed_make_pointer(JSContextRef ctx, gpointer pointer)
{
seed_struct_privates *priv = g_malloc(sizeof(seed_struct_privates));
priv->pointer = pointer;
priv->info = 0;
priv->free_pointer = FALSE;
- return JSObjectMake(eng->context, seed_pointer_class, priv);
+ return JSObjectMake(ctx, seed_pointer_class, priv);
}
-JSObjectRef seed_make_union(gpointer younion, GIBaseInfo * info)
+JSObjectRef seed_make_union(JSContextRef ctx, gpointer younion,
+ GIBaseInfo * info)
{
JSObjectRef object;
gint i, n_methods;
@@ -400,7 +406,7 @@
priv->info = info;
priv->free_pointer = FALSE;
- object = JSObjectMake(eng->context, seed_union_class, priv);
+ object = JSObjectMake(ctx, seed_union_class, priv);
if (info)
{
@@ -420,7 +426,9 @@
return object;
}
-JSObjectRef seed_make_boxed(gpointer boxed, GIBaseInfo * info)
+JSObjectRef seed_make_boxed(JSContextRef ctx,
+ gpointer boxed,
+ GIBaseInfo * info)
{
JSObjectRef object;
gint i, n_methods;
@@ -431,14 +439,16 @@
// Boxed finalize handler handles freeing.
priv->free_pointer = FALSE;
- object = JSObjectMake(eng->context, seed_boxed_class, priv);
+ object = JSObjectMake(ctx, seed_boxed_class, priv);
// FIXME: Instance methods?
return object;
}
-JSObjectRef seed_make_struct(gpointer strukt, GIBaseInfo * info)
+JSObjectRef seed_make_struct(JSContextRef ctx,
+ gpointer strukt,
+ GIBaseInfo * info)
{
JSObjectRef object;
gint i, n_methods;
@@ -448,7 +458,7 @@
priv->pointer = strukt;
priv->free_pointer = FALSE;
- object = JSObjectMake(eng->context, seed_struct_class, priv);
+ object = JSObjectMake(ctx, seed_struct_class, priv);
if (info)
{
@@ -508,11 +518,11 @@
object = g_slice_alloc0(size);
if (type == GI_INFO_TYPE_STRUCT)
- ret = seed_make_struct(object, info);
+ ret = seed_make_struct(eng->context, object, info);
else
- ret = seed_make_union(object, info);
+ ret = seed_make_union(eng->context, object, info);
- seed_pointer_set_free(ret, TRUE);
+ seed_pointer_set_free(eng->context, ret, TRUE);
if (!parameters)
return ret;
Modified: trunk/libseed/seed-structs.h
==============================================================================
--- trunk/libseed/seed-structs.h (original)
+++ trunk/libseed/seed-structs.h Tue Nov 25 07:02:41 2008
@@ -23,19 +23,25 @@
#define _SEED_STRUCT_H
extern JSClassRef seed_struct_class;
-JSObjectRef seed_make_union(gpointer younion, GIBaseInfo * info);
-JSObjectRef seed_make_struct(gpointer strukt, GIBaseInfo * info);
-JSObjectRef seed_make_boxed(gpointer boxed, GIBaseInfo * info);
+JSObjectRef seed_make_union(JSContextRef ctx, gpointer younion,
+ GIBaseInfo * info);
+JSObjectRef seed_make_struct(JSContextRef ctx, gpointer strukt,
+ GIBaseInfo * info);
+JSObjectRef seed_make_boxed(JSContextRef ctx,
+ gpointer boxed, GIBaseInfo * info);
-JSObjectRef seed_make_pointer(gpointer pointer);
+JSObjectRef seed_make_pointer(JSContextRef ctx, gpointer pointer);
JSValueRef
-seed_field_get_value(gpointer object,
+seed_field_get_value(JSContextRef ctx,
+ gpointer object,
GIFieldInfo * field,
JSValueRef * exception);
-gpointer seed_pointer_get_pointer(JSValueRef strukt);
-void seed_pointer_set_free(JSValueRef pointer, gboolean free_pointer);
+gpointer seed_pointer_get_pointer(JSContextRef ctx, JSValueRef strukt);
+void seed_pointer_set_free(JSContextRef ctx,
+ JSValueRef pointer,
+ gboolean free_pointer);
GIFieldInfo *seed_struct_find_field(GIStructInfo * info,
gchar * field_name);
Modified: trunk/libseed/seed-types.c
==============================================================================
--- trunk/libseed/seed-types.c (original)
+++ trunk/libseed/seed-types.c Tue Nov 25 07:02:41 2008
@@ -295,7 +295,8 @@
{
if (JSValueIsObjectOfClass(eng->context,
value, seed_struct_class))
- arg->v_pointer = seed_pointer_get_pointer(value);
+ arg->v_pointer = seed_pointer_get_pointer(eng->context,
+ value);
else
{
GType type =
@@ -323,7 +324,8 @@
JSObjectRef strukt =
seed_construct_struct_type_with_parameters(
interface, (JSObjectRef)value, exception);
- arg->v_pointer = seed_pointer_get_pointer(strukt);
+ arg->v_pointer = seed_pointer_get_pointer(eng->context,
+ strukt);
}
}
g_base_info_unref(interface);
@@ -471,7 +473,8 @@
{
JSValueRef strukt;
- strukt = seed_make_struct(arg->v_pointer, interface);
+ strukt = seed_make_struct(eng->context,
+ arg->v_pointer, interface);
g_base_info_unref(interface);
return strukt;
@@ -568,10 +571,12 @@
return seed_value_from_string((gchar *)
g_value_get_string(gval), exception);
case G_TYPE_POINTER:
- return seed_make_pointer(g_value_get_pointer(gval));
+ return seed_make_pointer(eng->context,
+ g_value_get_pointer(gval));
case G_TYPE_PARAM:
// Might need to dup and make a boxed.
- return seed_make_pointer(g_value_get_param(gval));
+ return seed_make_pointer(eng->context,
+ g_value_get_param(gval));
}
if (g_type_is_a(G_VALUE_TYPE(gval), G_TYPE_ENUM) ||
@@ -596,15 +601,18 @@
if (type == GI_INFO_TYPE_UNION)
{
- return seed_make_union(g_value_peek_pointer(gval), info);
+ return seed_make_union(eng->context,
+ g_value_peek_pointer(gval), info);
}
else if (type == GI_INFO_TYPE_STRUCT)
{
- return seed_make_struct(g_value_peek_pointer(gval), info);
+ return seed_make_struct(eng->context,
+ g_value_peek_pointer(gval), info);
}
else if (type == GI_INFO_TYPE_BOXED)
{
- return seed_make_boxed(g_value_dup_boxed(gval), info);
+ return seed_make_boxed(eng->context,
+ g_value_dup_boxed(gval), info);
}
}
@@ -755,7 +763,7 @@
/* Boxed handling is broken. Will be fixed in struct overhall. */
else if (g_type_is_a(type, G_TYPE_BOXED))
{
- gpointer p = seed_pointer_get_pointer(val);
+ gpointer p = seed_pointer_get_pointer(eng->context, val);
if (p)
{
g_value_init(ret, type);
@@ -774,7 +782,7 @@
new_struct = seed_construct_struct_type_with_parameters(info,
(JSObjectRef)val,
exception);
- p = seed_pointer_get_pointer(new_struct);
+ p = seed_pointer_get_pointer(eng->context, new_struct);
if (p)
{
g_value_init(ret, type);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]