seed r240 - in trunk: libseed tests
- From: racarr svn gnome org
- To: svn-commits-list gnome org
- Subject: seed r240 - in trunk: libseed tests
- Date: Tue, 11 Nov 2008 09:42:47 +0000 (UTC)
Author: racarr
Date: Tue Nov 11 09:42:47 2008
New Revision: 240
URL: http://svn.gnome.org/viewvc/seed?rev=240&view=rev
Log:
Lots of internal API cleanup as to Object<->Value distinction.
Modified:
trunk/libseed/Makefile.am
trunk/libseed/seed-builtins.c
trunk/libseed/seed-closure.c
trunk/libseed/seed-engine.c
trunk/libseed/seed-exceptions.c
trunk/libseed/seed-gtype.c
trunk/libseed/seed-private.h
trunk/libseed/seed-signals.c
trunk/libseed/seed-types.c
trunk/libseed/seed-types.h
trunk/tests/Makefile.am
Modified: trunk/libseed/Makefile.am
==============================================================================
--- trunk/libseed/Makefile.am (original)
+++ trunk/libseed/Makefile.am Tue Nov 11 09:42:47 2008
@@ -8,7 +8,7 @@
seed-builtins.c\
seed-builtins.h \
seed-exceptions.c \
- seed-exceptions.h \
+ seed-exceptions.h \
seed-engine.c \
seed-engine.h \
seed-private.h \
@@ -36,5 +36,7 @@
EXTRA_DIST = \
$(seedheaders_HEADERS)
+LIBSEED_CFLAGS+=-Werror
+
## File created by the gnome-build tools
Modified: trunk/libseed/seed-builtins.c
==============================================================================
--- trunk/libseed/seed-builtins.c (original)
+++ trunk/libseed/seed-builtins.c Tue Nov 11 09:42:47 2008
@@ -225,12 +225,12 @@
info = (GICallableInfo *) JSObjectGetPrivate((JSObjectRef) arguments[0]);
data_obj = JSObjectMake(ctx, NULL, NULL);
- seed_value_set_property(data_obj, "name", (JSValueRef)
+ seed_object_set_property(data_obj, "name", (JSValueRef)
seed_value_from_string(g_base_info_get_name
((GIBaseInfo *) info),
exception));
- seed_value_set_property(data_obj, "return_type",
+ seed_object_set_property(data_obj, "return_type",
seed_value_from_string
(seed_g_type_name_to_string
(g_callable_info_get_return_type(info)),
@@ -238,7 +238,7 @@
args_obj = JSObjectMake(eng->context, NULL, NULL);
- seed_value_set_property(data_obj, "args", args_obj);
+ seed_object_set_property(data_obj, "args", args_obj);
for (i = 0; i < g_callable_info_get_n_args(info); ++i)
{
@@ -248,7 +248,7 @@
seed_g_type_name_to_string(g_arg_info_get_type
(g_callable_info_get_arg(info, i)));
- seed_value_set_property(argument, "type",
+ seed_object_set_property(argument, "type",
seed_value_from_string(arg_name, exception));
JSObjectSetPropertyAtIndex(ctx, args_obj, i, argument, NULL);
@@ -432,7 +432,7 @@
JSObjectRef arrayObj;
JSValueRef argcref;
JSObjectRef obj =
- (JSObjectRef) seed_value_get_property(eng->global, "Seed");
+ (JSObjectRef) seed_object_get_property(eng->global, "Seed");
seed_create_function("include", &seed_include, obj);
seed_create_function("print", &seed_print, obj);
@@ -458,6 +458,6 @@
argcref = seed_value_from_int(*argc, 0);
- seed_value_set_property(arrayObj, "length", argcref);
- seed_value_set_property(obj, "argv", arrayObj);
+ seed_object_set_property(arrayObj, "length", argcref);
+ seed_object_set_property(obj, "argv", arrayObj);
}
Modified: trunk/libseed/seed-closure.c
==============================================================================
--- trunk/libseed/seed-closure.c (original)
+++ trunk/libseed/seed-closure.c Tue Nov 11 09:42:47 2008
@@ -330,7 +330,7 @@
JSObjectRef cached;
cached =
- (JSObjectRef) seed_value_get_property(function,
+ (JSObjectRef) seed_object_get_property(function,
"__seed_native_closure");
if (cached
&& JSValueIsObjectOfClass(eng->context, cached,
@@ -365,7 +365,7 @@
get_ffi_type(return_type), arg_types);
ffi_prep_closure(closure, cif, seed_handle_closure, privates);
- seed_value_set_property((JSObjectRef) function,
+ seed_object_set_property((JSObjectRef) function,
"__seed_native_closure",
(JSValueRef) JSObjectMake(eng->context,
seed_native_callback_class,
Modified: trunk/libseed/seed-engine.c
==============================================================================
--- trunk/libseed/seed-engine.c (original)
+++ trunk/libseed/seed-engine.c Tue Nov 11 09:42:47 2008
@@ -307,7 +307,7 @@
if (!JSValueIsNull(eng->context, arguments[i]) &&
JSValueIsObject(eng->context, arguments[i]))
{
- seed_value_set_property((JSObjectRef) arguments[i],
+ seed_object_set_property((JSObjectRef) arguments[i],
"value", jsout_val);
}
@@ -328,7 +328,7 @@
gboolean instance)
{
GIFunctionInfoFlags flags;
- SeedValue method_ref;
+ JSValueRef method_ref;
const gchar *name;
// if (g_base_info_is_deprecated ((GIBaseInfo *) info))
@@ -347,7 +347,7 @@
name = g_base_info_get_name((GIBaseInfo *) info);
if (!strcmp(name, "new"))
name = "_new";
- seed_value_set_property(object, name, method_ref);
+ seed_object_set_property(object, name, method_ref);
}
@@ -523,7 +523,7 @@
GValue gval = { 0 };
char *cproperty_name;
gint length;
- SeedValue ret;
+ JSValueRef ret;
gint i, len;
b = seed_value_to_object((JSValueRef) object, exception);
@@ -673,7 +673,7 @@
namespace_ref = JSObjectMake(eng->context, NULL, NULL);
JSValueProtect(eng->context, namespace_ref);
- seed_value_set_property(eng->global, namespace, namespace_ref);
+ seed_object_set_property(eng->global, namespace, namespace_ref);
for (i = 0; i < n; i++)
{
@@ -694,7 +694,7 @@
JSObjectRef enum_class = JSObjectMake(eng->context,
0, 0);
JSValueProtect(eng->context, (JSValueRef) enum_class);
- seed_value_set_property(namespace_ref,
+ seed_object_set_property(namespace_ref,
g_base_info_get_name(info), enum_class);
for (j = 0; j < num_vals; j++)
@@ -717,7 +717,7 @@
name[j] = '_';
}
- seed_value_set_property(enum_class, name, value_ref);
+ seed_object_set_property(enum_class, name, value_ref);
g_free(name);
@@ -745,7 +745,7 @@
JSObjectMake(eng->context,
gobject_constructor_class, (gpointer) type);
- seed_value_set_property(constructor_ref,
+ seed_object_set_property(constructor_ref,
"type",
seed_value_from_int(type, exception));
@@ -765,7 +765,7 @@
}
}
- seed_value_set_property(namespace_ref,
+ seed_object_set_property(namespace_ref,
g_base_info_get_name
(info), constructor_ref);
JSValueProtect(eng->context, (JSValueRef) constructor_ref);
@@ -789,7 +789,7 @@
}
- seed_value_set_property(namespace_ref,
+ seed_object_set_property(namespace_ref,
g_base_info_get_name(info), struct_ref);
JSValueProtect(eng->context, (JSValueRef) struct_ref);
@@ -799,7 +799,7 @@
JSObjectRef callback_ref = JSObjectMake(eng->context,
seed_callback_class,
info);
- seed_value_set_property(namespace_ref,
+ seed_object_set_property(namespace_ref,
g_base_info_get_name(info),
(JSValueRef) callback_ref);
}
@@ -812,7 +812,7 @@
constant_value =
seed_gi_argument_make_js(&argument,
g_constant_info_get_type((GIConstantInfo *) info), exception);
- seed_value_set_property(namespace_ref,
+ seed_object_set_property(namespace_ref,
g_base_info_get_name(info), constant_value);
}
@@ -925,7 +925,7 @@
oref = JSObjectMakeFunctionWithCallback(eng->context, NULL, func);
JSValueProtect(eng->context, oref);
- seed_value_set_property(obj, name, oref);
+ seed_object_set_property(obj, name, oref);
}
static void
@@ -965,7 +965,7 @@
g_type_set_qdata(G_TYPE_OBJECT, qname, gobject_class);
seed_obj_ref = JSObjectMake(eng->context, NULL, NULL);
- seed_value_set_property(eng->global, "Seed", seed_obj_ref);
+ seed_object_set_property(eng->global, "Seed", seed_obj_ref);
JSValueProtect(eng->context, seed_obj_ref);
seed_create_function("import_namespace", &seed_gi_import_namespace,
@@ -1018,7 +1018,7 @@
return ret;
}
-SeedValue seed_script_exception(SeedScript * s)
+JSValueRef seed_script_exception(SeedScript * s)
{
return s->exception;
}
Modified: trunk/libseed/seed-exceptions.c
==============================================================================
--- trunk/libseed/seed-exceptions.c (original)
+++ trunk/libseed/seed-exceptions.c Tue Nov 11 09:42:47 2008
@@ -45,8 +45,8 @@
}
exception_obj = JSObjectMake(eng->context, 0, NULL);
- seed_value_set_property(exception_obj, "message", js_message_ref);
- seed_value_set_property(exception_obj, "name", js_name_ref);
+ seed_object_set_property(exception_obj, "message", js_message_ref);
+ seed_object_set_property(exception_obj, "name", js_name_ref);
*exception = exception_obj;
@@ -79,43 +79,43 @@
gchar *seed_exception_get_name(JSValueRef e)
{
- SeedValue name;
+ JSValueRef name;
g_assert((e));
if (!JSValueIsObject(eng->context, e))
return 0;
- name = seed_value_get_property(e, "name");
+ name = seed_object_get_property((JSObjectRef)e, "name");
return seed_value_to_string(name, 0);
}
gchar *seed_exception_get_message(JSValueRef e)
{
- SeedValue name;
+ JSValueRef name;
g_assert((e));
if (!JSValueIsObject(eng->context, e))
return 0;
- name = seed_value_get_property(e, "message");
+ name = seed_object_get_property((JSObjectRef)e, "message");
return seed_value_to_string(name, 0);
}
guint seed_exception_get_line(JSValueRef e)
{
- SeedValue line;
+ JSValueRef line;
g_assert((e));
if (!JSValueIsObject(eng->context, e))
return 0;
- line = seed_value_get_property(e, "line");
+ line = seed_object_get_property((JSObjectRef)e, "line");
return seed_value_to_uint(line, 0);
}
gchar *seed_exception_get_file(JSValueRef e)
{
- SeedValue line;
+ JSValueRef line;
g_assert((e));
if (!JSValueIsObject(eng->context, e))
return 0;
- line = seed_value_get_property(e, "sourceURL");
+ line = seed_object_get_property((JSObjectRef)e, "sourceURL");
return seed_value_to_string(line, 0);
}
Modified: trunk/libseed/seed-gtype.c
==============================================================================
--- trunk/libseed/seed-gtype.c (original)
+++ trunk/libseed/seed-gtype.c Tue Nov 11 09:42:47 2008
@@ -234,7 +234,7 @@
/* Signal name */
- jsname = seed_value_get_property((JSObjectRef)arguments[0], "name");
+ jsname = seed_object_get_property((JSObjectRef)arguments[0], "name");
/* seed_value_to_string can handle non strings, however the kind
* of strings we want as a signal name are rather small, so make sure
* we have an actual string */
@@ -248,11 +248,11 @@
name = seed_value_to_string(jsname, exception);
/* Type to install on. Comes from class. */
- jstype = seed_value_get_property(thisObject, "type");
+ jstype = seed_object_get_property(thisObject, "type");
itype = seed_value_to_int(jstype, exception);
/* Signal flags */
- jsflags = seed_value_get_property((JSObjectRef)arguments[0], "flags");
+ jsflags = seed_object_get_property((JSObjectRef)arguments[0], "flags");
if (JSValueIsNull(eng->context, jsflags) ||
!JSValueIsNumber(eng->context, jsflags))
flags = G_SIGNAL_RUN_LAST;
@@ -261,7 +261,7 @@
/* Return type */
- jsreturn_type = seed_value_get_property((JSObjectRef)arguments[0],
+ jsreturn_type = seed_object_get_property((JSObjectRef)arguments[0],
"return_type");
if (JSValueIsNull(eng->context, jsreturn_type) ||
!JSValueIsNumber(eng->context, jsreturn_type))
@@ -270,13 +270,14 @@
return_type = seed_value_to_int(jsreturn_type, exception);
/* Number of params and types */
- jsparams = seed_value_get_property((JSObjectRef)arguments[0],
+ jsparams = seed_object_get_property((JSObjectRef)arguments[0],
"parameters");
if (!JSValueIsNull(eng->context, jsparams) &&
JSValueIsObject(eng->context, jsparams))
{
n_params = seed_value_to_int
- (seed_value_get_property(jsparams, "length"), exception);
+ (seed_object_get_property((JSObjectRef)jsparams, "length"),
+ exception);
if (n_params > 0)
{
guint i;
@@ -325,7 +326,7 @@
// TODO:
// Should probably have a custom type for class, and have it auto convert.
- seed_value_set_property((JSObjectRef)jsargs[0],
+ seed_object_set_property((JSObjectRef)jsargs[0],
"type", seed_value_from_int(type, 0));
seed_create_function("install_signal",
&seed_gsignal_method_invoked,
@@ -456,10 +457,14 @@
return (JSObjectRef)JSValueMakeNull(eng->context);
}
- parent_ref = seed_value_get_property(arguments[0], "parent");
- class_init = seed_value_get_property(arguments[0], "class_init");
- instance_init = seed_value_get_property(arguments[0], "instance_init");
- name = seed_value_get_property(arguments[0], "name");
+ parent_ref = seed_object_get_property((JSObjectRef)arguments[0],
+ "parent");
+ class_init = seed_object_get_property((JSObjectRef)arguments[0],
+ "class_init");
+ instance_init = seed_object_get_property((JSObjectRef)arguments[0],
+ "instance_init");
+ name = seed_object_get_property((JSObjectRef)arguments[0],
+ "name");
new_name = seed_value_to_string(name, exception);
if (!JSValueIsNumber(eng->context,
@@ -518,5 +523,5 @@
gtype_constructor = JSObjectMake(eng->context, seed_gtype_class, 0);
- seed_value_set_property(eng->global, "GType", gtype_constructor);
+ seed_object_set_property(eng->global, "GType", gtype_constructor);
}
Modified: trunk/libseed/seed-private.h
==============================================================================
--- trunk/libseed/seed-private.h (original)
+++ trunk/libseed/seed-private.h Tue Nov 11 09:42:47 2008
@@ -31,7 +31,6 @@
#include <ffi.h>
typedef struct _SeedEngine SeedEngine;
-typedef JSValueRef SeedValue;
struct _SeedEngine {
JSGlobalContextRef context;
Modified: trunk/libseed/seed-signals.c
==============================================================================
--- trunk/libseed/seed-signals.c (original)
+++ trunk/libseed/seed-signals.c Tue Nov 11 09:42:47 2008
@@ -51,7 +51,7 @@
priv->signal_id = signal->signal_id;
priv->object = obj;
- seed_value_set_property(object_ref, js_signal_name, signal_ref);
+ seed_object_set_property(object_ref, js_signal_name, signal_ref);
g_free(js_signal_name);
}
@@ -99,7 +99,7 @@
g_free(interfaces);
}
- seed_value_set_property(object_ref, "signal", signals_ref);
+ seed_object_set_property(object_ref, "signal", signals_ref);
}
void
Modified: trunk/libseed/seed-types.c
==============================================================================
--- trunk/libseed/seed-types.c (original)
+++ trunk/libseed/seed-types.c Tue Nov 11 09:42:47 2008
@@ -29,7 +29,7 @@
JSClassRef seed_callback_class;
SeedEngine *eng;
-static gboolean seed_value_is_gobject(SeedValue value)
+static gboolean seed_value_is_gobject(JSValueRef value)
{
if (!JSValueIsObject(eng->context, value) ||
JSValueIsNull(eng->context, value))
@@ -56,10 +56,10 @@
}
-static SeedValue seed_wrap_object(GObject * object)
+static JSValueRef seed_wrap_object(GObject * object)
{
- SeedValue user_data;
- SeedValue js_ref;
+ JSValueRef user_data;
+ JSValueRef js_ref;
JSClassRef class;
GType type, *interfaces;
JSValueRef prototype;
@@ -67,7 +67,7 @@
type = G_OBJECT_TYPE(object);
- user_data = (SeedValue) g_object_get_data(object, "js-ref");
+ user_data = (JSValueRef) g_object_get_data(object, "js-ref");
if (user_data)
return user_data;
@@ -173,7 +173,7 @@
}
gboolean
-seed_gi_make_argument(SeedValue value,
+seed_gi_make_argument(JSValueRef value,
GITypeInfo * type_info, GArgument * arg,
JSValueRef * exception)
{
@@ -527,7 +527,7 @@
return FALSE;
}
-SeedValue seed_value_from_gvalue(GValue * gval, JSValueRef * exception)
+JSValueRef seed_value_from_gvalue(GValue * gval, JSValueRef * exception)
{
if (!G_IS_VALUE(gval))
{
@@ -603,7 +603,7 @@
}
gboolean
-seed_gvalue_from_seed_value(SeedValue val, GType type, GValue * ret,
+seed_gvalue_from_seed_value(JSValueRef val, GType type, GValue * ret,
JSValueRef * exception)
{
switch (type)
@@ -764,7 +764,7 @@
return FALSE;
}
-SeedValue seed_value_get_property(SeedValue val, const gchar * name)
+JSValueRef seed_object_get_property(JSObjectRef val, const gchar * name)
{
JSStringRef jname = JSStringCreateWithUTF8CString(name);
@@ -778,7 +778,7 @@
}
gboolean
-seed_value_set_property(JSObjectRef object,
+seed_object_set_property(JSObjectRef object,
const gchar * name, JSValueRef value)
{
JSStringRef jname = JSStringCreateWithUTF8CString(name);
@@ -1054,7 +1054,7 @@
if (!JSValueIsString(eng->context, val)) // In this case,
// it's an object
{
- func = seed_value_get_property(val, "toString");
+ func = seed_object_get_property((JSObjectRef)val, "toString");
str =
JSObjectCallAsFunction(eng->context,
(JSObjectRef) func,
@@ -1090,7 +1090,8 @@
JSValueRef object;
if (!JSValueIsObject(eng->context, val))
return NULL;
- object = seed_value_get_property(val, "gsuper");
+ object = seed_object_get_property((JSObjectRef)val,
+ "gsuper");
if (val && object && JSValueIsObject(eng->context, object)) ;
{
JSValueRef ref_data = 0;
Modified: trunk/libseed/seed-types.h
==============================================================================
--- trunk/libseed/seed-types.h (original)
+++ trunk/libseed/seed-types.h Tue Nov 11 09:42:47 2008
@@ -24,15 +24,15 @@
#include "seed-private.h"
-SeedValue seed_value_from_gvalue(GValue * gval, JSValueRef * exception);
-SeedValue seed_value_get_property(SeedValue val, const gchar * name);
+JSValueRef seed_value_from_gvalue(GValue * gval, JSValueRef * exception);
+JSValueRef seed_object_get_property(JSObjectRef val, const gchar * name);
-gboolean seed_value_set_property(JSObjectRef object,
+gboolean seed_object_set_property(JSObjectRef object,
const gchar * name, JSValueRef value);
-gboolean seed_gvalue_from_seed_value(SeedValue val, GType type,
+gboolean seed_gvalue_from_seed_value(JSValueRef val, GType type,
GValue * gval, JSValueRef * exception);
gboolean seed_gi_supports_type(GITypeInfo * type_info);
-gboolean seed_gi_make_argument(SeedValue value,
+gboolean seed_gi_make_argument(JSValueRef value,
GITypeInfo * type_info,
GArgument * arg, JSValueRef * exception);
JSValueRef seed_gi_argument_make_js(GArgument * arg,
Modified: trunk/tests/Makefile.am
==============================================================================
--- trunk/tests/Makefile.am (original)
+++ trunk/tests/Makefile.am Tue Nov 11 09:42:47 2008
@@ -3,7 +3,7 @@
compare.js \
constructor-args.js \
signal-this.js \
- gtype-typerror.js
+ gtype-typerror.js \
gtype-signal.js \
signal-userdata.js \
gtype-signal-exception.js \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]