seed r11 - trunk/libseed
- From: racarr svn gnome org
- To: svn-commits-list gnome org
- Subject: seed r11 - trunk/libseed
- Date: Wed, 22 Oct 2008 20:40:12 +0000 (UTC)
Author: racarr
Date: Wed Oct 22 20:40:12 2008
New Revision: 11
URL: http://svn.gnome.org/viewvc/seed?rev=11&view=rev
Log:
More tim changes. Type conversion rework beginnings.
Removed:
trunk/libseed/seed-utils.c
trunk/libseed/seed-utils.h
Modified:
trunk/libseed/seed-engine.c
trunk/libseed/seed-private.h
trunk/libseed/seed-types.c
trunk/libseed/seed-types.h
Modified: trunk/libseed/seed-engine.c
==============================================================================
--- trunk/libseed/seed-engine.c (original)
+++ trunk/libseed/seed-engine.c Wed Oct 22 20:40:12 2008
@@ -616,10 +616,10 @@
JSObjectRef namespace_ref;
int n,i;
- namespace = seed_value_to_locale_string(arguments[0]);
+ namespace = seed_value_to_string(arguments[0]);
if (argumentCount == 2)
{
- version = seed_value_to_locale_string(arguments[1]);
+ version = seed_value_to_string(arguments[1]);
}
if(!g_irepository_require (g_irepository_get_default (), namespace,
@@ -886,7 +886,7 @@
return 0;
name = seed_value_get_property(e, "name");
- return seed_value_to_locale_string(name);
+ return seed_value_to_string(name);
}
gchar * seed_exception_get_message(JSValueRef e)
@@ -897,5 +897,5 @@
return 0;
name = seed_value_get_property(e, "message");
- return seed_value_to_locale_string(name);
+ return seed_value_to_string(name);
}
Modified: trunk/libseed/seed-private.h
==============================================================================
--- trunk/libseed/seed-private.h (original)
+++ trunk/libseed/seed-private.h Wed Oct 22 20:40:12 2008
@@ -41,7 +41,6 @@
#include "seed-types.h"
#include "seed-signals.h"
#include "seed-builtins.h"
-#include "seed-utils.h"
#include "seed-structs.h"
#endif
Modified: trunk/libseed/seed-types.c
==============================================================================
--- trunk/libseed/seed-types.c (original)
+++ trunk/libseed/seed-types.c Wed Oct 22 20:40:12 2008
@@ -19,12 +19,240 @@
#include "seed-private.h"
+#include <string.h>
JSClassRef gobject_class;
JSClassRef gobject_method_class;
JSClassRef gobject_constructor_class;
SeedEngine * eng;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+gboolean seed_value_to_boolean(JSValueRef val)
+{
+}
+
+JSValueRef seed_value_from_boolean(gboolean val)
+{
+}
+
+guint seed_value_to_uint(JSValueRef val)
+{
+}
+
+JSValueRef seed_value_from_uint(guint val)
+{
+}
+
+gint seed_value_to_int(JSValueRef val)
+{
+}
+
+JSValueRef seed_value_from_int(gint val)
+{
+}
+
+gchar seed_value_to_char(JSValueRef val)
+{
+}
+
+JSValueRef seed_value_from_char(gchar val)
+{
+}
+
+guchar seed_value_to_uchar(JSValueRef val)
+{
+}
+
+JSValueRef seed_value_from_uchar(guchar val)
+{
+}
+
+glong seed_value_to_long(JSValueRef val)
+{
+}
+
+JSValueRef seed_value_from_long(glong val)
+{
+}
+
+gulong seed_value_to_ulong(JSValueRef val)
+{
+}
+
+JSValueRef seed_value_from_ulong(gulong val)
+{
+}
+
+gint64 seed_value_to_int64(JSValueRef val)
+{
+}
+
+JSValueRef seed_value_from_int64(gint64 val)
+{
+}
+
+guint64 seed_value_to_uint64(JSValueRef val)
+{
+}
+
+JSValueRef seed_value_from_uint64(guint64 val)
+{
+}
+
+gfloat seed_value_to_float(JSValueRef val)
+{
+}
+
+JSValueRef seed_value_from_float(gfloat val)
+{
+}
+
+gdouble seed_value_to_double(JSValueRef val)
+{
+}
+
+JSValueRef seed_value_from_double(gdouble val)
+{
+}
+
+gchar * seed_value_to_string(JSValueRef val)
+{
+ JSStringRef jsstr;
+ JSValueRef func, str;
+ gchar * buf;
+ gint length;
+
+ if(val == NULL)
+ return NULL;
+
+ if(JSValueIsBoolean(eng->context, val) || JSValueIsNumber(eng->context, val))
+ {
+ buf = g_strdup_printf("%f", JSValueToNumber(eng->context, val, NULL));
+ }
+ else if(JSValueIsNull(eng->context, val) || JSValueIsUndefined(eng->context, val))
+ {
+ buf = strdup("[null]");
+ }
+ else
+ {
+ if(!JSValueIsString(eng->context, val)) // In this case, it's an object
+ {
+ func = seed_value_get_property(val, "toString");
+ str = JSObjectCallAsFunction(eng->context, (JSObjectRef)func, (JSObjectRef)val, 0, NULL, NULL);
+ }
+
+ jsstr = JSValueToStringCopy(eng->context, val, NULL);
+ length = JSStringGetMaximumUTF8CStringSize(jsstr);
+
+ buf = malloc(length * sizeof(gchar));
+ JSStringGetUTF8CString(jsstr, buf, length);
+ JSStringRelease(jsstr);
+ }
+
+ return buf;
+}
+
+JSValueRef seed_value_from_string(gchar * val)
+{
+}
+
+GObject * seed_value_to_object(JSValueRef val)
+{
+}
+
+JSValueRef seed_value_from_object(GObject * val)
+{
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
static void seed_protect_object(SeedValue val)
{
JSValueProtect(eng->context, val);
@@ -131,31 +359,6 @@
return js_ref;
}
-/* Should update to try and use glib type conversion */
-gchar * seed_value_to_locale_string (SeedValue val)
-{
- JSStringRef jsstr;
- gint length;
- gchar * ret;
-
- g_return_if_fail(val);
-
- if (!JSValueIsString(eng->context, val))
- return 0;
-
-
- jsstr = JSValueToStringCopy(eng->context, val, NULL);
-
- length = JSStringGetMaximumUTF8CStringSize(jsstr);
- ret = malloc(length * sizeof(gchar));
-
- JSStringGetUTF8CString(jsstr, ret, length);
-
- JSStringRelease(jsstr);
-
- return ret;
-}
-
GType seed_gi_type_to_gtype(GITypeInfo *type_info, GITypeTag tag)
{
switch(tag)
@@ -756,7 +959,7 @@
}
case kJSTypeString:
{
- gchar * cv = seed_value_to_locale_string(val);
+ gchar * cv = seed_value_to_string(val);
g_value_init(ret, G_TYPE_STRING);
g_value_take_string(ret, cv);
Modified: trunk/libseed/seed-types.h
==============================================================================
--- trunk/libseed/seed-types.h (original)
+++ trunk/libseed/seed-types.h Wed Oct 22 20:40:12 2008
@@ -23,7 +23,6 @@
#include "seed-private.h"
-gchar * seed_value_to_locale_string(SeedValue val);
SeedValue seed_value_from_gvalue(GValue * gval);
SeedValue seed_value_get_property(SeedValue val,
const char * name);
@@ -40,5 +39,45 @@
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);
+
+guint seed_value_to_uint(JSValueRef val);
+JSValueRef seed_value_from_uint(guint val);
+
+gint seed_value_to_int(JSValueRef val);
+JSValueRef seed_value_from_int(gint val);
+
+gchar seed_value_to_char(JSValueRef val);
+JSValueRef seed_value_from_char(gchar val);
+
+guchar seed_value_to_uchar(JSValueRef val);
+JSValueRef seed_value_from_uchar(guchar val);
+
+glong seed_value_to_long(JSValueRef val);
+JSValueRef seed_value_from_long(glong val);
+
+gulong seed_value_to_ulong(JSValueRef val);
+JSValueRef seed_value_from_ulong(gulong val);
+
+gint64 seed_value_to_int64(JSValueRef val);
+JSValueRef seed_value_from_int64(gint64 val);
+
+guint64 seed_value_to_uint64(JSValueRef val);
+JSValueRef seed_value_from_uint64(guint64 val);
+
+gfloat seed_value_to_float(JSValueRef val);
+JSValueRef seed_value_from_float(gfloat val);
+
+gdouble seed_value_to_double(JSValueRef val);
+JSValueRef seed_value_from_double(gdouble val);
+
+gchar * seed_value_to_string(JSValueRef val);
+JSValueRef seed_value_from_string(gchar * val);
+
+GObject * seed_value_to_object(JSValueRef val);
+JSValueRef seed_value_from_object(GObject * val);
+
+
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]