[seed] Add seed_value_get_type and seed_object_copy_property_names to the API
- From: Robert Carr <racarr src gnome org>
- To: svn-commits-list gnome org
- Subject: [seed] Add seed_value_get_type and seed_object_copy_property_names to the API
- Date: Sat, 9 May 2009 00:42:40 -0400 (EDT)
commit a19712102e5390ad2cd06a62dacf3d3827b8ba17
Author: Robert Carr <racarr svn gnome org>
Date: Sat May 9 00:42:34 2009 -0400
Add seed_value_get_type and seed_object_copy_property_names to the API
---
libseed/seed-api.c | 36 ++++++++++++++++++++++++++++++++++++
libseed/seed.h | 4 ++++
2 files changed, 40 insertions(+), 0 deletions(-)
diff --git a/libseed/seed-api.c b/libseed/seed-api.c
index 73b3dba..f916e89 100644
--- a/libseed/seed-api.c
+++ b/libseed/seed-api.c
@@ -594,3 +594,39 @@ seed_make_undefined (JSContextRef ctx)
{
return JSValueMakeUndefined (ctx);
}
+
+JSType
+seed_value_get_type (JSContextRef ctx,
+ JSValueRef value)
+{
+ return JSValueGetType (ctx, value);
+}
+
+gchar **
+seed_object_copy_property_names(JSContextRef ctx,
+ JSObjectRef object)
+{
+ JSPropertyNameArrayRef names;
+ guint i, length;
+ gchar **ret;
+
+ names = JSObjectCopyPropertyNames (ctx, object);
+ length = JSPropertyNameArrayGetCount (names);
+ ret = g_malloc((length+1)*sizeof(gchar *));
+ for (i = 0; i < length; i++)
+ {
+ JSStringRef name = JSPropertyNameArrayGetNameAtIndex (names, i);
+ guint max_length;
+ gchar *c_name;
+
+ max_length = JSStringGetMaximumUTF8CStringSize (name);
+ c_name = g_malloc (max_length * sizeof (gchar));
+ JSStringGetUTF8CString (name, c_name, length);
+ ret[i] = c_name;
+
+ }
+ ret[length] = NULL;
+ JSPropertyNameArrayRelease (names);
+
+ return ret;
+}
diff --git a/libseed/seed.h b/libseed/seed.h
index 1db4cc7..1bb2640 100644
--- a/libseed/seed.h
+++ b/libseed/seed.h
@@ -375,5 +375,9 @@ void seed_importer_set_search_path (SeedContext ctx,
void seed_prepare_global_context (SeedContext ctx);
+SeedType seed_value_get_type (SeedContext ctx, SeedType type);
+
+gchar **seed_object_copy_property_names(SeedContext ctx, SeedObject object);
+
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]