seed r111 - in trunk: examples/shader libseed
- From: racarr svn gnome org
- To: svn-commits-list gnome org
- Subject: seed r111 - in trunk: examples/shader libseed
- Date: Tue, 4 Nov 2008 23:10:13 +0000 (UTC)
Author: racarr
Date: Tue Nov 4 23:10:13 2008
New Revision: 111
URL: http://svn.gnome.org/viewvc/seed?rev=111&view=rev
Log:
Massive exception rework. Type conversion functions now propogate
exceptions. Free bonus: Increase radius of blur on spinning bob dylan to
something visible.
Modified:
trunk/examples/shader/default.glsl
trunk/libseed/seed-builtins.c
trunk/libseed/seed-engine.c
trunk/libseed/seed-signals.c
trunk/libseed/seed-types.c
trunk/libseed/seed-types.h
trunk/libseed/seed.h
Modified: trunk/examples/shader/default.glsl
==============================================================================
--- trunk/examples/shader/default.glsl (original)
+++ trunk/examples/shader/default.glsl Tue Nov 4 23:10:13 2008
@@ -1,4 +1,4 @@
-uniform float radius = 10;
+uniform float radius = 30;
uniform sampler2D rectTexture;
uniform float x_step = 0.0001, y_step = 0.0001;
@@ -21,4 +21,4 @@
gl_FragColor = color / float(count);
gl_FragColor = gl_FragColor * gl_Color;
-}
\ No newline at end of file
+}
Modified: trunk/libseed/seed-builtins.c
==============================================================================
--- trunk/libseed/seed-builtins.c (original)
+++ trunk/libseed/seed-builtins.c Tue Nov 4 23:10:13 2008
@@ -40,7 +40,7 @@
seed_make_exception(exception, "ArgumentError", mes);
return JSValueMakeNull(eng->context);
}
- import_file = seed_value_to_string(arguments[0]);
+ import_file = seed_value_to_string(arguments[0], exception);
g_file_get_contents(import_file, &buffer, 0, 0);
@@ -86,7 +86,7 @@
return JSValueMakeNull(eng->context);
}
- gchar *buf = seed_value_to_string(arguments[0]);
+ gchar *buf = seed_value_to_string(arguments[0], exception);
printf("%s\n", buf);
free(buf);
@@ -116,12 +116,12 @@
return JSValueMakeNull(eng->context);
}
- buf = seed_value_to_string(arguments[0]);
+ buf = seed_value_to_string(arguments[0], exception);
str = readline(buf);
if (str && *str) {
add_history(str);
- valstr = seed_value_from_string(str);
+ valstr = seed_value_from_string(str, exception);
free(str);
}
@@ -197,12 +197,12 @@
seed_value_set_property(data_obj, "name",
(JSValueRef)
seed_value_from_string(g_base_info_get_name
- ((GIBaseInfo *) info)));
+ ((GIBaseInfo *) info), exception));
seed_value_set_property(data_obj, "return_type",
seed_value_from_string
(seed_g_type_name_to_string
- (g_callable_info_get_return_type(info))));
+ (g_callable_info_get_return_type(info)), exception));
args_obj = JSObjectMake(eng->context, NULL, NULL);
@@ -217,7 +217,7 @@
(info, i)));
seed_value_set_property(argument, "type",
- seed_value_from_string(arg_name));
+ seed_value_from_string(arg_name, exception));
JSObjectSetPropertyAtIndex(eng->context, args_obj, i, argument,
NULL);
@@ -258,7 +258,7 @@
pid_t child;
child = fork();
- return seed_value_from_int(child);
+ return seed_value_from_int(child, exception);
}
static gboolean seed_timeout_function(gpointer user_data)
@@ -294,7 +294,7 @@
arguments[0],
exception);
- guint interval = seed_value_to_uint(arguments[1]);
+ guint interval = seed_value_to_uint(arguments[1], exception);
g_timeout_add(interval, &seed_timeout_function, jsstr);
return JSValueMakeBoolean(ctx, 1);
@@ -323,11 +323,11 @@
// TODO: exceptions!
JSObjectSetPropertyAtIndex(eng->context, arrayObj, i,
- seed_value_from_string((*argv)[i]),
+ seed_value_from_string((*argv)[i], 0),
NULL);
}
- argcref = seed_value_from_int(*argc);
+ argcref = seed_value_from_int(*argc, 0);
seed_value_set_property(arrayObj, "length", argcref);
seed_value_set_property(obj, "argv", arrayObj);
Modified: trunk/libseed/seed-engine.c
==============================================================================
--- trunk/libseed/seed-engine.c (original)
+++ trunk/libseed/seed-engine.c Tue Nov 4 23:10:13 2008
@@ -128,7 +128,7 @@
type = param_spec->value_type;
if (!seed_gvalue_from_seed_value(jsprop_value,
- type, ¶ms[i].value)) {
+ type, ¶ms[i].value, exception)) {
g_free(prop_name);
g_free(params);
return 0;
@@ -146,7 +146,7 @@
if (!gobject)
JSValueMakeNull(eng->context);
- ret = (JSObjectRef) seed_value_from_object(gobject);
+ ret = (JSObjectRef) seed_value_from_object(gobject, exception);
g_type_class_unref(oclass);
@@ -166,12 +166,12 @@
g_assert(argumentCount == 1);
- this = seed_value_to_object((JSValueRef) this_object);
- that = seed_value_to_object(arguments[0]);
+ this = seed_value_to_object((JSValueRef) this_object, exception);
+ that = seed_value_to_object(arguments[0], exception);
if (this == that)
- return seed_value_from_boolean(1);
- return seed_value_from_boolean(0);
+ return seed_value_from_boolean(1, 0);
+ return seed_value_from_boolean(0, 0);
}
static JSValueRef
@@ -197,7 +197,7 @@
info = JSObjectGetPrivate(function);
if (!
- ((object = seed_value_to_object(this_object)) ||
+ ((object = seed_value_to_object(this_object, exception)) ||
(object = seed_struct_get_pointer(this_object))))
instance_method = FALSE;
@@ -219,7 +219,7 @@
if (!seed_gi_make_argument(arguments[i],
type_info,
- &in_args[n_in_args++])) {
+ &in_args[n_in_args++], exception)) {
gchar * mes = g_strdup_printf("Unable to make argument %d for"
" function: %s. \n",
i + 1, g_base_info_get_name((GIBaseInfo
@@ -254,7 +254,7 @@
retval_ref = JSValueMakeNull(eng->context);
else
retval_ref =
- seed_gi_argument_make_js(&retval, type_info);
+ seed_gi_argument_make_js(&retval, type_info, exception);
g_base_info_unref((GIBaseInfo *) type_info);
} else {
g_error("Error invoking function, %s. %s \n",
@@ -393,7 +393,7 @@
{
GObject *gobject;
- gobject = seed_value_to_object((JSValueRef) object);
+ gobject = seed_value_to_object((JSValueRef) object, 0);
if (!gobject)
return;
@@ -405,7 +405,7 @@
GObject *gobject;
GIBaseInfo *base;
- gobject = seed_value_to_object((JSValueRef) object);
+ gobject = seed_value_to_object((JSValueRef) object, 0);
if (!gobject)
return;
@@ -433,7 +433,7 @@
SeedValue ret;
int i, len;
- b = seed_value_to_object((JSValueRef) object);
+ b = seed_value_to_object((JSValueRef) object, exception);
if (!b)
return 0;
@@ -458,7 +458,7 @@
g_value_init(&gval, spec->value_type);
g_object_get_property(b, cproperty_name, &gval);
- ret = seed_value_from_gvalue(&gval);
+ ret = seed_value_from_gvalue(&gval, exception);
g_value_unset(&gval);
g_free(cproperty_name);
@@ -480,7 +480,7 @@
if (JSValueIsNull(eng->context, value))
return 0;
- obj = seed_value_to_object(object);
+ obj = seed_value_to_object(object, exception);
if (!obj || !G_IS_OBJECT(obj))
return FALSE;
@@ -511,7 +511,7 @@
else
type = spec->value_type;
- if (!seed_gvalue_from_seed_value(value, type, &gval)) {
+ if (!seed_gvalue_from_seed_value(value, type, &gval, exception)) {
gchar *mes = g_strdup_printf("Not able to set property %s"
"on object of type %s."
" Expected type: %s. \n",
@@ -561,9 +561,9 @@
return JSValueMakeNull(eng->context);
}
- namespace = seed_value_to_string(arguments[0]);
+ namespace = seed_value_to_string(arguments[0], exception);
if (argumentCount == 2) {
- version = seed_value_to_string(arguments[1]);
+ version = seed_value_to_string(arguments[1], exception);
}
if (!g_irepository_require(g_irepository_get_default(), namespace,
@@ -724,7 +724,8 @@
g_constant_info_get_value((GIConstantInfo *)info, &argument);
constant_value =
seed_gi_argument_make_js(&argument,
- g_constant_info_get_type((GIConstantInfo *)info));
+ g_constant_info_get_type((GIConstantInfo *)info),
+ exception);
seed_value_set_property(namespace_ref,
g_base_info_get_name(info),
constant_value);
@@ -937,7 +938,7 @@
return 0;
name = seed_value_get_property(e, "name");
- return seed_value_to_string(name);
+ return seed_value_to_string(name, 0);
}
gchar *seed_exception_get_message(JSValueRef e)
@@ -948,7 +949,7 @@
return 0;
name = seed_value_get_property(e, "message");
- return seed_value_to_string(name);
+ return seed_value_to_string(name, 0);
}
guint seed_exception_get_line(JSValueRef e)
@@ -958,7 +959,7 @@
if (!JSValueIsObject(eng->context, e))
return 0;
line = seed_value_get_property(e, "line");
- return seed_value_to_uint(line);
+ return seed_value_to_uint(line, 0);
}
gchar *seed_exception_get_file(JSValueRef e)
@@ -968,5 +969,5 @@
if (!JSValueIsObject(eng->context, e))
return 0;
file = seed_value_get_property(e, "sourceURL");
- return seed_value_to_string(file);
+ return seed_value_to_string(file, 0);
}
Modified: trunk/libseed/seed-signals.c
==============================================================================
--- trunk/libseed/seed-signals.c (original)
+++ trunk/libseed/seed-signals.c Tue Nov 4 23:10:13 2008
@@ -114,7 +114,7 @@
args = g_newa(JSValueRef, n_param_values);
for (i = 0; i < n_param_values; i++) {
- args[i] = seed_value_from_gvalue((GValue *) & param_values[i]);
+ args[i] = seed_value_from_gvalue((GValue *) & param_values[i], 0);
if (!args[i])
g_error("Error in signal marshal. "
Modified: trunk/libseed/seed-types.c
==============================================================================
--- trunk/libseed/seed-types.c (original)
+++ trunk/libseed/seed-types.c Tue Nov 4 23:10:13 2008
@@ -163,7 +163,8 @@
}
gboolean seed_gi_make_argument(SeedValue value,
- GITypeInfo * type_info, GArgument * arg)
+ GITypeInfo * type_info, GArgument * arg,
+ JSValueRef * exception)
{
GITypeTag gi_tag = g_type_info_get_tag(type_info);
@@ -176,52 +177,52 @@
case GI_TYPE_TAG_VOID:
break;
case GI_TYPE_TAG_BOOLEAN:
- arg->v_boolean = seed_value_to_boolean(value);
+ arg->v_boolean = seed_value_to_boolean(value, exception);
break;
case GI_TYPE_TAG_INT8:
- arg->v_int8 = seed_value_to_char(value);
+ arg->v_int8 = seed_value_to_char(value, exception);
break;
case GI_TYPE_TAG_UINT8:
- arg->v_uint8 = seed_value_to_uchar(value);
+ arg->v_uint8 = seed_value_to_uchar(value, exception);
break;
case GI_TYPE_TAG_INT16:
- arg->v_int16 = seed_value_to_int(value);
+ arg->v_int16 = seed_value_to_int(value, exception);
break;
case GI_TYPE_TAG_UINT16:
- arg->v_uint16 = seed_value_to_uint(value);
+ arg->v_uint16 = seed_value_to_uint(value, exception);
break;
case GI_TYPE_TAG_INT32:
- arg->v_int32 = seed_value_to_int(value);
+ arg->v_int32 = seed_value_to_int(value, exception);
break;
case GI_TYPE_TAG_UINT32:
- arg->v_uint32 = seed_value_to_uint(value);
+ arg->v_uint32 = seed_value_to_uint(value, exception);
break;
case GI_TYPE_TAG_LONG:
case GI_TYPE_TAG_INT64:
- arg->v_int64 = seed_value_to_long(value);
+ arg->v_int64 = seed_value_to_long(value, exception);
break;
case GI_TYPE_TAG_ULONG:
case GI_TYPE_TAG_UINT64:
- arg->v_uint64 = seed_value_to_ulong(value);
+ arg->v_uint64 = seed_value_to_ulong(value, exception);
break;
case GI_TYPE_TAG_INT:
- arg->v_int = seed_value_to_int(value);
+ arg->v_int = seed_value_to_int(value, exception);
break;
case GI_TYPE_TAG_UINT:
- arg->v_uint = seed_value_to_uint(value);
+ arg->v_uint = seed_value_to_uint(value, exception);
break;
case GI_TYPE_TAG_SIZE:
case GI_TYPE_TAG_SSIZE:
- arg->v_int = seed_value_to_int(value);
+ arg->v_int = seed_value_to_int(value, exception);
break;
case GI_TYPE_TAG_FLOAT:
- arg->v_float = seed_value_to_float(value);
+ arg->v_float = seed_value_to_float(value, exception);
break;
case GI_TYPE_TAG_DOUBLE:
- arg->v_double = seed_value_to_double(value);
+ arg->v_double = seed_value_to_double(value, exception);
break;
case GI_TYPE_TAG_UTF8:
- arg->v_string = seed_value_to_string(value);
+ arg->v_string = seed_value_to_string(value, exception);
break;
case GI_TYPE_TAG_INTERFACE:
{
@@ -237,9 +238,10 @@
if (interface_type == GI_INFO_TYPE_OBJECT
|| interface_type == GI_INFO_TYPE_INTERFACE) {
- gobject = seed_value_to_object(value);
+ gobject = seed_value_to_object(value, exception);
required_gtype =
- g_registered_type_info_get_g_type((GIRegisteredTypeInfo *) interface);
+ g_registered_type_info_get_g_type((GIRegisteredTypeInfo *)
+ interface);
if (!gobject
|| !g_type_is_a(G_OBJECT_TYPE(gobject),
required_gtype)) {
@@ -283,45 +285,46 @@
}
-JSValueRef seed_gi_argument_make_js(GArgument * arg, GITypeInfo * type_info)
+JSValueRef seed_gi_argument_make_js(GArgument * arg, GITypeInfo * type_info,
+ JSValueRef * exception)
{
GITypeTag gi_tag = g_type_info_get_tag(type_info);
switch (gi_tag) {
case GI_TYPE_TAG_VOID:
return 0;
case GI_TYPE_TAG_BOOLEAN:
- return seed_value_from_boolean(arg->v_boolean);
+ return seed_value_from_boolean(arg->v_boolean, exception);
case GI_TYPE_TAG_INT8:
- return seed_value_from_char(arg->v_int8);
+ return seed_value_from_char(arg->v_int8, exception);
case GI_TYPE_TAG_UINT8:
- return seed_value_from_uchar(arg->v_uint8);
+ return seed_value_from_uchar(arg->v_uint8, exception);
case GI_TYPE_TAG_INT16:
- return seed_value_from_int(arg->v_int16);
+ return seed_value_from_int(arg->v_int16, exception);
case GI_TYPE_TAG_UINT16:
- return seed_value_from_uint(arg->v_uint16);
+ return seed_value_from_uint(arg->v_uint16, exception);
case GI_TYPE_TAG_INT32:
- return seed_value_from_int(arg->v_int32);
+ return seed_value_from_int(arg->v_int32, exception);
case GI_TYPE_TAG_UINT32:
- return seed_value_from_uint(arg->v_uint32);
+ return seed_value_from_uint(arg->v_uint32, exception);
case GI_TYPE_TAG_LONG:
case GI_TYPE_TAG_INT64:
- return seed_value_from_long(arg->v_int64);
+ return seed_value_from_long(arg->v_int64, exception);
case GI_TYPE_TAG_ULONG:
case GI_TYPE_TAG_UINT64:
- return seed_value_from_ulong(arg->v_uint64);
+ return seed_value_from_ulong(arg->v_uint64, exception);
case GI_TYPE_TAG_INT:
- return seed_value_from_int(arg->v_int32);
+ return seed_value_from_int(arg->v_int32, exception);
case GI_TYPE_TAG_UINT:
- return seed_value_from_uint(arg->v_uint32);
+ return seed_value_from_uint(arg->v_uint32, exception);
case GI_TYPE_TAG_SSIZE:
case GI_TYPE_TAG_SIZE:
- return seed_value_from_int(arg->v_int);
+ return seed_value_from_int(arg->v_int, exception);
case GI_TYPE_TAG_FLOAT:
- return seed_value_from_float(arg->v_float);
+ return seed_value_from_float(arg->v_float, exception);
case GI_TYPE_TAG_DOUBLE:
- return seed_value_from_double(arg->v_double);
+ return seed_value_from_double(arg->v_double, exception);
case GI_TYPE_TAG_UTF8:
- return seed_value_from_string(arg->v_string);
+ return seed_value_from_string(arg->v_string, exception);
case GI_TYPE_TAG_INTERFACE:
{
GIBaseInfo *interface;
@@ -335,9 +338,9 @@
if (arg->v_pointer == 0) {
return JSValueMakeNull(eng->context);
}
- return seed_value_from_object(arg->v_pointer);
+ return seed_value_from_object(arg->v_pointer, exception);
} else if (interface_type == GI_INFO_TYPE_ENUM) {
- return seed_value_from_double(arg->v_double);
+ return seed_value_from_double(arg->v_double, exception);
} else if (interface_type == GI_INFO_TYPE_STRUCT) {
return seed_make_struct(arg->v_pointer,
interface);
@@ -361,7 +364,7 @@
larg.v_pointer = list->data;
ival =
(JSValueRef) seed_gi_argument_make_js(&larg,
- list_type);
+ list_type, exception);
JSObjectSetPropertyAtIndex(eng->context, ret, i,
ival, NULL);
i++;
@@ -388,7 +391,7 @@
larg.v_pointer = list->data;
ival =
(JSValueRef) seed_gi_argument_make_js(&larg,
- list_type);
+ list_type, exception);
JSObjectSetPropertyAtIndex(eng->context, ret, i,
ival, NULL);
i++;
@@ -447,48 +450,48 @@
return FALSE;
}
-SeedValue seed_value_from_gvalue(GValue * gval)
+SeedValue seed_value_from_gvalue(GValue * gval, JSValueRef * exception)
{
if (!G_IS_VALUE(gval)) {
return false;
}
switch (G_VALUE_TYPE(gval)) {
case G_TYPE_BOOLEAN:
- return seed_value_from_boolean(g_value_get_boolean(gval));
+ return seed_value_from_boolean(g_value_get_boolean(gval), exception);
case G_TYPE_CHAR:
- return seed_value_from_char(g_value_get_char(gval));
+ return seed_value_from_char(g_value_get_char(gval), exception);
case G_TYPE_UCHAR:
- return seed_value_from_uchar(g_value_get_uchar(gval));
+ return seed_value_from_uchar(g_value_get_uchar(gval), exception);
case G_TYPE_INT:
- return seed_value_from_int(g_value_get_int(gval));
+ return seed_value_from_int(g_value_get_int(gval), exception);
case G_TYPE_UINT:
- return seed_value_from_uint(g_value_get_uint(gval));
+ return seed_value_from_uint(g_value_get_uint(gval), exception);
case G_TYPE_LONG:
- return seed_value_from_long(g_value_get_long(gval));
+ return seed_value_from_long(g_value_get_long(gval), exception);
case G_TYPE_ULONG:
- return seed_value_from_ulong(g_value_get_ulong(gval));
+ return seed_value_from_ulong(g_value_get_ulong(gval), exception);
case G_TYPE_INT64:
- return seed_value_from_int64(g_value_get_int64(gval));
+ return seed_value_from_int64(g_value_get_int64(gval), exception);
case G_TYPE_UINT64:
- return seed_value_from_uint64(g_value_get_uint64(gval));
+ return seed_value_from_uint64(g_value_get_uint64(gval), exception);
case G_TYPE_FLOAT:
- return seed_value_from_float(g_value_get_float(gval));
+ return seed_value_from_float(g_value_get_float(gval), exception);
case G_TYPE_DOUBLE:
- return seed_value_from_double(g_value_get_double(gval));
+ return seed_value_from_double(g_value_get_double(gval), exception);
case G_TYPE_STRING:
return seed_value_from_string((gchar *)
- g_value_get_string(gval));
+ g_value_get_string(gval), exception);
case G_TYPE_POINTER:
return seed_make_struct(g_value_get_pointer(gval), 0);
}
if (g_type_is_a(G_VALUE_TYPE(gval), G_TYPE_ENUM))
- return seed_value_from_long(gval->data[0].v_long);
+ return seed_value_from_long(gval->data[0].v_long, exception);
else if (g_type_is_a(G_VALUE_TYPE(gval), G_TYPE_ENUM))
- return seed_value_from_long(gval->data[0].v_long);
+ return seed_value_from_long(gval->data[0].v_long, exception);
else if (g_type_is_a(G_VALUE_TYPE(gval), G_TYPE_OBJECT)) {
// TODO: check for leaks
- return seed_value_from_object(g_value_get_object(gval));
+ return seed_value_from_object(g_value_get_object(gval), exception);
} else {
GIBaseInfo *info;
GIInfoType type;
@@ -513,7 +516,8 @@
return NULL;
}
-gboolean seed_gvalue_from_seed_value(SeedValue val, GType type, GValue * ret)
+gboolean seed_gvalue_from_seed_value(SeedValue val, GType type, GValue * ret,
+ JSValueRef * exception)
{
switch (type) {
case G_TYPE_BOOLEAN:
@@ -525,7 +529,7 @@
// goto bad_type;
g_value_init(ret, G_TYPE_BOOLEAN);
- g_value_set_boolean(ret, seed_value_to_boolean(val));
+ g_value_set_boolean(ret, seed_value_to_boolean(val, exception));
return TRUE;
}
case G_TYPE_INT:
@@ -533,21 +537,21 @@
{
g_value_init(ret, type);
if (type == G_TYPE_INT)
- g_value_set_int(ret, seed_value_to_int(val));
+ g_value_set_int(ret, seed_value_to_int(val, exception));
else
- g_value_set_uint(ret, seed_value_to_uint(val));
+ g_value_set_uint(ret, seed_value_to_uint(val, exception));
return TRUE;
}
case G_TYPE_CHAR:
{
g_value_init(ret, G_TYPE_CHAR);
- g_value_set_char(ret, seed_value_to_char(val));
+ g_value_set_char(ret, seed_value_to_char(val, exception));
return TRUE;
}
case G_TYPE_UCHAR:
{
g_value_init(ret, G_TYPE_UCHAR);
- g_value_set_uchar(ret, seed_value_to_uchar(val));
+ g_value_set_uchar(ret, seed_value_to_uchar(val, exception));
return TRUE;
}
case G_TYPE_LONG:
@@ -560,39 +564,39 @@
switch (type) {
case G_TYPE_LONG:
g_value_init(ret, G_TYPE_LONG);
- g_value_set_long(ret, seed_value_to_long(val));
+ g_value_set_long(ret, seed_value_to_long(val, exception));
break;
case G_TYPE_ULONG:
g_value_init(ret, G_TYPE_ULONG);
g_value_set_ulong(ret,
- seed_value_to_ulong(val));
+ seed_value_to_ulong(val, exception));
break;
case G_TYPE_INT64:
g_value_init(ret, G_TYPE_INT64);
g_value_set_int64(ret,
- seed_value_to_int64(val));
+ seed_value_to_int64(val, exception));
break;
case G_TYPE_UINT64:
g_value_init(ret, G_TYPE_UINT64);
g_value_set_uint64(ret,
- seed_value_to_uint64(val));
+ seed_value_to_uint64(val, exception));
break;
case G_TYPE_FLOAT:
g_value_init(ret, G_TYPE_FLOAT);
g_value_set_float(ret,
- seed_value_to_float(val));
+ seed_value_to_float(val, exception));
break;
case G_TYPE_DOUBLE:
g_value_init(ret, G_TYPE_DOUBLE);
g_value_set_double(ret,
- seed_value_to_double(val));
+ seed_value_to_double(val, exception));
break;
}
return TRUE;
}
case G_TYPE_STRING:
{
- gchar *cval = seed_value_to_string(val);
+ gchar *cval = seed_value_to_string(val, exception);
g_value_init(ret, G_TYPE_STRING);
g_value_take_string(ret, cval);
@@ -607,7 +611,7 @@
g_value_init(ret, G_TYPE_BOOLEAN);
g_value_set_boolean(ret,
seed_value_to_boolean
- (val));
+ (val, exception));
return TRUE;
}
case kJSTypeNumber:
@@ -615,12 +619,12 @@
g_value_init(ret, G_TYPE_DOUBLE);
g_value_set_double(ret,
seed_value_to_double
- (val));
+ (val, exception));
return TRUE;
}
case kJSTypeString:
{
- gchar *cv = seed_value_to_string(val);
+ gchar *cv = seed_value_to_string(val, exception);
g_value_init(ret, G_TYPE_STRING);
g_value_take_string(ret, cv);
@@ -636,17 +640,17 @@
if (g_type_is_a(type, G_TYPE_ENUM)
&& JSValueIsNumber(eng->context, val)) {
g_value_init(ret, type);
- ret->data[0].v_long = seed_value_to_long(val);
+ ret->data[0].v_long = seed_value_to_long(val, exception);
return TRUE;
} else if (g_type_is_a(type, G_TYPE_FLAGS)
&& JSValueIsNumber(eng->context, val)) {
g_value_init(ret, type);
- ret->data[0].v_long = seed_value_to_long(val);
+ ret->data[0].v_long = seed_value_to_long(val, exception);
return TRUE;
} else if (g_type_is_a(type, G_TYPE_OBJECT)
&& (JSValueIsNull(eng->context, val)
|| seed_value_is_gobject(val))) {
- GObject *o = seed_value_to_object(val);
+ GObject *o = seed_value_to_object(val, exception);
if (o == NULL || g_type_is_a(G_OBJECT_TYPE(o), type)) {
g_value_init(ret, G_TYPE_OBJECT);
@@ -701,7 +705,7 @@
abort();
}
-gboolean seed_value_to_boolean(JSValueRef val)
+gboolean seed_value_to_boolean(JSValueRef val, JSValueRef * exception)
{
if (!JSValueIsBoolean(eng->context, val)) {
if (!JSValueIsNull(eng->context, val))
@@ -714,12 +718,12 @@
return JSValueToBoolean(eng->context, val);
}
-JSValueRef seed_value_from_boolean(gboolean val)
+JSValueRef seed_value_from_boolean(gboolean val, JSValueRef * exception)
{
return JSValueMakeBoolean(eng->context, val);
}
-guint seed_value_to_uint(JSValueRef val)
+guint seed_value_to_uint(JSValueRef val, JSValueRef * exception)
{
if (!JSValueIsNumber(eng->context, val)) {
if (!JSValueIsNull(eng->context, val))
@@ -730,12 +734,12 @@
return (guint) JSValueToNumber(eng->context, val, NULL);
}
-JSValueRef seed_value_from_uint(guint val)
+JSValueRef seed_value_from_uint(guint val, JSValueRef * exception)
{
return JSValueMakeNumber(eng->context, (gdouble) val);
}
-gint seed_value_to_int(JSValueRef val)
+gint seed_value_to_int(JSValueRef val, JSValueRef * exception)
{
if (!JSValueIsNumber(eng->context, val)) {
if (!JSValueIsNull(eng->context, val))
@@ -746,12 +750,12 @@
return (gint) JSValueToNumber(eng->context, val, NULL);
}
-JSValueRef seed_value_from_int(gint val)
+JSValueRef seed_value_from_int(gint val, JSValueRef * exception)
{
return JSValueMakeNumber(eng->context, (gdouble) val);
}
-gchar seed_value_to_char(JSValueRef val)
+gchar seed_value_to_char(JSValueRef val, JSValueRef * exception)
{
int cv;
@@ -771,12 +775,12 @@
return (char)cv;
}
-JSValueRef seed_value_from_char(gchar val)
+JSValueRef seed_value_from_char(gchar val, JSValueRef * exception)
{
return JSValueMakeNumber(eng->context, (gdouble) val);
}
-guchar seed_value_to_uchar(JSValueRef val)
+guchar seed_value_to_uchar(JSValueRef val, JSValueRef * exception)
{
guint cv;
@@ -796,12 +800,12 @@
return (guchar) cv;
}
-JSValueRef seed_value_from_uchar(guchar val)
+JSValueRef seed_value_from_uchar(guchar val, JSValueRef * exception)
{
return JSValueMakeNumber(eng->context, (gdouble) val);
}
-glong seed_value_to_long(JSValueRef val)
+glong seed_value_to_long(JSValueRef val, JSValueRef * exception)
{
if (!JSValueIsNumber(eng->context, val)) {
if (!JSValueIsNull(eng->context, val))
@@ -812,12 +816,12 @@
return (glong) JSValueToNumber(eng->context, val, NULL);
}
-JSValueRef seed_value_from_long(glong val)
+JSValueRef seed_value_from_long(glong val, JSValueRef * exception)
{
return JSValueMakeNumber(eng->context, (gdouble) val);
}
-gulong seed_value_to_ulong(JSValueRef val)
+gulong seed_value_to_ulong(JSValueRef val, JSValueRef * exception)
{
if (!JSValueIsNumber(eng->context, val)) {
if (!JSValueIsNull(eng->context, val))
@@ -828,12 +832,12 @@
return (gulong) JSValueToNumber(eng->context, val, NULL);
}
-JSValueRef seed_value_from_ulong(gulong val)
+JSValueRef seed_value_from_ulong(gulong val, JSValueRef * exception)
{
return JSValueMakeNumber(eng->context, (gdouble) val);
}
-gint64 seed_value_to_int64(JSValueRef val)
+gint64 seed_value_to_int64(JSValueRef val, JSValueRef * exception)
{
if (!JSValueIsNumber(eng->context, val)) {
if (!JSValueIsNull(eng->context, val))
@@ -844,12 +848,12 @@
return (gint64) JSValueToNumber(eng->context, val, NULL);
}
-JSValueRef seed_value_from_int64(gint64 val)
+JSValueRef seed_value_from_int64(gint64 val, JSValueRef * exception)
{
return JSValueMakeNumber(eng->context, (gdouble) val);
}
-guint64 seed_value_to_uint64(JSValueRef val)
+guint64 seed_value_to_uint64(JSValueRef val, JSValueRef * exception)
{
if (!JSValueIsNumber(eng->context, val)) {
if (!JSValueIsNull(eng->context, val))
@@ -860,12 +864,12 @@
return (guint64) JSValueToNumber(eng->context, val, NULL);
}
-JSValueRef seed_value_from_uint64(guint64 val)
+JSValueRef seed_value_from_uint64(guint64 val, JSValueRef * exception)
{
return JSValueMakeNumber(eng->context, (gdouble) val);
}
-gfloat seed_value_to_float(JSValueRef val)
+gfloat seed_value_to_float(JSValueRef val, JSValueRef * exception)
{
if (!JSValueIsNumber(eng->context, val)) {
if (!JSValueIsNull(eng->context, val))
@@ -876,12 +880,12 @@
return (gfloat) JSValueToNumber(eng->context, val, NULL);
}
-JSValueRef seed_value_from_float(gfloat val)
+JSValueRef seed_value_from_float(gfloat val, JSValueRef * exception)
{
return JSValueMakeNumber(eng->context, (gdouble) val);
}
-gdouble seed_value_to_double(JSValueRef val)
+gdouble seed_value_to_double(JSValueRef val, JSValueRef * exception)
{
if (!JSValueIsNumber(eng->context, val)) {
if (!JSValueIsNull(eng->context, val))
@@ -892,12 +896,12 @@
return (gdouble) JSValueToNumber(eng->context, val, NULL);
}
-JSValueRef seed_value_from_double(gdouble val)
+JSValueRef seed_value_from_double(gdouble val, JSValueRef * exception)
{
return JSValueMakeNumber(eng->context, (gdouble) val);
}
-gchar *seed_value_to_string(JSValueRef val)
+gchar *seed_value_to_string(JSValueRef val, JSValueRef * exception)
{
JSStringRef jsstr;
JSValueRef func, str;
@@ -937,7 +941,7 @@
return buf;
}
-JSValueRef seed_value_from_string(const gchar * val)
+JSValueRef seed_value_from_string(const gchar * val, JSValueRef * exception)
{
JSStringRef jsstr = JSStringCreateWithUTF8CString(val);
JSValueRef valstr = JSValueMakeString(eng->context, jsstr);
@@ -946,7 +950,7 @@
return valstr;
}
-GObject *seed_value_to_object(JSValueRef val)
+GObject *seed_value_to_object(JSValueRef val, JSValueRef * exception)
{
GObject *gobject;
@@ -962,7 +966,7 @@
return gobject;
}
-JSValueRef seed_value_from_object(GObject * val)
+JSValueRef seed_value_from_object(GObject * val, JSValueRef * exception)
{
if (val == NULL)
return JSValueMakeNull(eng->context);
Modified: trunk/libseed/seed-types.h
==============================================================================
--- trunk/libseed/seed-types.h (original)
+++ trunk/libseed/seed-types.h Tue Nov 4 23:10:13 2008
@@ -22,56 +22,58 @@
#include "seed-private.h"
-SeedValue seed_value_from_gvalue(GValue * gval);
+SeedValue seed_value_from_gvalue(GValue * gval, JSValueRef * exception);
SeedValue seed_value_get_property(SeedValue val, const char *name);
gboolean seed_value_set_property(JSObjectRef object,
const char *name, JSValueRef value);
-gboolean seed_gvalue_from_seed_value(SeedValue val, GType type, GValue * gval);
+gboolean seed_gvalue_from_seed_value(SeedValue val, GType type, GValue * gval,
+ JSValueRef * exception);
gboolean seed_gi_supports_type(GITypeInfo * type_info);
gboolean seed_gi_make_argument(SeedValue value, GITypeInfo * type_info,
- GArgument * arg);
-JSValueRef seed_gi_argument_make_js(GArgument * arg, GITypeInfo * type_info);
+ GArgument * arg, JSValueRef * exception);
+JSValueRef seed_gi_argument_make_js(GArgument * arg, GITypeInfo * type_info,
+ JSValueRef * exception);
GType seed_gi_type_to_gtype(GITypeInfo * type_info, GITypeTag tag);
-gboolean seed_value_to_boolean(JSValueRef val);
-JSValueRef seed_value_from_boolean(gboolean val);
+gboolean seed_value_to_boolean(JSValueRef val, JSValueRef * exception);
+JSValueRef seed_value_from_boolean(gboolean val, JSValueRef * exception);
-guint seed_value_to_uint(JSValueRef val);
-JSValueRef seed_value_from_uint(guint val);
+guint seed_value_to_uint(JSValueRef val, JSValueRef * exception);
+JSValueRef seed_value_from_uint(guint val, JSValueRef * exception);
-gint seed_value_to_int(JSValueRef val);
-JSValueRef seed_value_from_int(gint val);
+gint seed_value_to_int(JSValueRef val, JSValueRef * exception);
+JSValueRef seed_value_from_int(gint val, JSValueRef * exception);
-gchar seed_value_to_char(JSValueRef val);
-JSValueRef seed_value_from_char(gchar val);
+gchar seed_value_to_char(JSValueRef val, JSValueRef * exception);
+JSValueRef seed_value_from_char(gchar val, JSValueRef * exception);
-guchar seed_value_to_uchar(JSValueRef val);
-JSValueRef seed_value_from_uchar(guchar val);
+guchar seed_value_to_uchar(JSValueRef val, JSValueRef * exception);
+JSValueRef seed_value_from_uchar(guchar val, JSValueRef * exception);
-glong seed_value_to_long(JSValueRef val);
-JSValueRef seed_value_from_long(glong val);
+glong seed_value_to_long(JSValueRef val, JSValueRef * exception);
+JSValueRef seed_value_from_long(glong val, JSValueRef * exception);
-gulong seed_value_to_ulong(JSValueRef val);
-JSValueRef seed_value_from_ulong(gulong val);
+gulong seed_value_to_ulong(JSValueRef val, JSValueRef * exception);
+JSValueRef seed_value_from_ulong(gulong val, JSValueRef * exception);
-gint64 seed_value_to_int64(JSValueRef val);
-JSValueRef seed_value_from_int64(gint64 val);
+gint64 seed_value_to_int64(JSValueRef val, JSValueRef * exception);
+JSValueRef seed_value_from_int64(gint64 val, JSValueRef * exception);
-guint64 seed_value_to_uint64(JSValueRef val);
-JSValueRef seed_value_from_uint64(guint64 val);
+guint64 seed_value_to_uint64(JSValueRef val, JSValueRef * exception);
+JSValueRef seed_value_from_uint64(guint64 val, JSValueRef * exception);
-gfloat seed_value_to_float(JSValueRef val);
-JSValueRef seed_value_from_float(gfloat val);
+gfloat seed_value_to_float(JSValueRef val, JSValueRef * exception);
+JSValueRef seed_value_from_float(gfloat val, JSValueRef * exception);
-gdouble seed_value_to_double(JSValueRef val);
-JSValueRef seed_value_from_double(gdouble val);
+gdouble seed_value_to_double(JSValueRef val, JSValueRef * exception);
+JSValueRef seed_value_from_double(gdouble val, JSValueRef * exception);
-gchar *seed_value_to_string(JSValueRef val);
-JSValueRef seed_value_from_string(const gchar * val);
+gchar *seed_value_to_string(JSValueRef val, JSValueRef * exception);
+JSValueRef seed_value_from_string(const gchar * val, JSValueRef * exception);
-GObject *seed_value_to_object(JSValueRef val);
-JSValueRef seed_value_from_object(GObject * val);
+GObject *seed_value_to_object(JSValueRef val, JSValueRef * exception);
+JSValueRef seed_value_from_object(GObject * val, JSValueRef * exception);
#endif
Modified: trunk/libseed/seed.h
==============================================================================
--- trunk/libseed/seed.h (original)
+++ trunk/libseed/seed.h Tue Nov 4 23:10:13 2008
@@ -42,47 +42,45 @@
SeedValue seed_evaluate(SeedScript * s, SeedObject this);
-gchar *seed_value_to_string(SeedValue obj);
-
/* seed-types.c */
-gboolean seed_value_to_boolean(SeedValue val);
-SeedValue seed_value_from_boolean(gboolean val);
+gboolean seed_value_to_boolean(SeedValue val, SeedException *exception);
+SeedValue seed_value_from_boolean(gboolean val, SeedException *exception);
-guint seed_value_to_uint(SeedValue val);
-SeedValue seed_value_from_uint(guint val);
+guint seed_value_to_uint(SeedValue val, SeedException *exception);
+SeedValue seed_value_from_uint(guint val, SeedException *exception);
-gint seed_value_to_int(SeedValue val);
-SeedValue seed_value_from_int(gint val);
+gint seed_value_to_int(SeedValue val, SeedException *exception);
+SeedValue seed_value_from_int(gint val, SeedException *exception);
-gchar seed_value_to_char(SeedValue val);
-SeedValue seed_value_from_char(gchar val);
+gchar seed_value_to_char(SeedValue val, SeedException *exception);
+SeedValue seed_value_from_char(gchar val, SeedException *exception);
-guchar seed_value_to_uchar(SeedValue val);
-SeedValue seed_value_from_uchar(guchar val);
+guchar seed_value_to_uchar(SeedValue val, SeedException *exception);
+SeedValue seed_value_from_uchar(guchar val, SeedException *exception);
-glong seed_value_to_long(SeedValue val);
-SeedValue seed_value_from_long(glong val);
+glong seed_value_to_long(SeedValue val, SeedException *exception);
+SeedValue seed_value_from_long(glong val, SeedException *exception);
-gulong seed_value_to_ulong(SeedValue val);
-SeedValue seed_value_from_ulong(gulong val);
+gulong seed_value_to_ulong(SeedValue val, SeedException *exception);
+SeedValue seed_value_from_ulong(gulong val, SeedException *exception);
-gint64 seed_value_to_int64(SeedValue val);
-SeedValue seed_value_from_int64(gint64 val);
+gint64 seed_value_to_int64(SeedValue val, SeedException *exception);
+SeedValue seed_value_from_int64(gint64 val, SeedException *exception);
-guint64 seed_value_to_uint64(SeedValue val);
-SeedValue seed_value_from_uint64(guint64 val);
+guint64 seed_value_to_uint64(SeedValue val, SeedException *exception);
+SeedValue seed_value_from_uint64(guint64 val, SeedException *exception);
-gfloat seed_value_to_float(SeedValue val);
-SeedValue seed_value_from_float(gfloat val);
+gfloat seed_value_to_float(SeedValue val, SeedException *exception);
+SeedValue seed_value_from_float(gfloat val, SeedException *exception);
-gdouble seed_value_to_double(SeedValue val);
-SeedValue seed_value_from_double(gdouble val);
+gdouble seed_value_to_double(SeedValue val, SeedException *exception);
+SeedValue seed_value_from_double(gdouble val, SeedException *exception);
-gchar *seed_value_to_string(SeedValue val);
-SeedValue seed_value_from_string(gchar * val);
+gchar *seed_value_to_string(SeedValue val, SeedException *exception);
+SeedValue seed_value_from_string(gchar * val, SeedException *exception);
-GObject *seed_value_to_object(SeedValue val);
-SeedValue seed_value_from_object(GObject * val);
+GObject *seed_value_to_object(SeedValue val, SeedException *exception);
+SeedValue seed_value_from_object(GObject * val, SeedException *exception);
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]