seed r388 - in trunk: libseed modules/sqlite



Author: racarr
Date: Fri Dec  5 03:32:41 2008
New Revision: 388
URL: http://svn.gnome.org/viewvc/seed?rev=388&view=rev

Log:
Add seed_object_call to API. some more fleshing out of sqlite bindings...


Modified:
   trunk/libseed/seed-api.c
   trunk/libseed/seed.h
   trunk/modules/sqlite/seed-sqlite.c

Modified: trunk/libseed/seed-api.c
==============================================================================
--- trunk/libseed/seed-api.c	(original)
+++ trunk/libseed/seed-api.c	Fri Dec  5 03:32:41 2008
@@ -12,6 +12,18 @@
 	return JSObjectMake(ctx, class, private);
 }
 
+JSValueRef seed_object_call(JSContextRef ctx,
+							  JSObjectRef object,
+							  JSObjectRef this,
+							  size_t argument_count,
+							  const JSValueRef arguments[],
+							  JSValueRef * exception)
+{
+	return JSObjectCallAsFunction(ctx, object, this,
+								  argument_count, arguments, 
+								  exception);
+}
+
 SeedScript *seed_make_script(JSContextRef ctx,
 							 const gchar * js,
 							 const gchar * source_url,

Modified: trunk/libseed/seed.h
==============================================================================
--- trunk/libseed/seed.h	(original)
+++ trunk/libseed/seed.h	Fri Dec  5 03:32:41 2008
@@ -31,7 +31,6 @@
 typedef gpointer SeedObject;
 typedef gpointer SeedClass;
 typedef gpointer SeedException;
-typedef gpointer SeedFunction;
 
 typedef gpointer SeedContext;
 
@@ -107,6 +106,13 @@
 gboolean seed_string_is_equal(SeedString a, SeedString b);
 gboolean seed_string_is_equal_utf8(SeedString a, const gchar * b);
 
+SeedValue seed_object_call(SeedContext ctx, 
+						   SeedObject object,
+						   SeedObject this,
+						   gsize argument_count,
+						   const SeedValue arguments[],
+						   SeedException * exception);
+
 
 /*
  * seed-types.c 
@@ -216,7 +222,7 @@
 typedef void (*SeedFunctionCallback) (SeedContext ctx,
 									  SeedObject function,
 									  SeedObject this_object,
-									  size_t argument_count,
+									  gsize argument_count,
 									  const SeedValue arguments[],
 									  SeedException * exception);
 
@@ -259,13 +265,13 @@
 typedef SeedValue (*SeedObjectCallAsFunctionCallback) (SeedContext ctx,
 														SeedObject function,
 														SeedObject this_object,
-														size_t argument_count,
+														gsize argument_count,
    												  const SeedValue arguments[],
 													SeedException * exception);
 typedef SeedValue (*SeedObjectCallAsConstructorCallback) 
                                                 (SeedContext ctx,
 												 SeedObject constructor,
-												 size_t argument_count,
+												 gsize argument_count,
 												 const SeedValue arguments[],
 												 SeedException * exception);
 

Modified: trunk/modules/sqlite/seed-sqlite.c
==============================================================================
--- trunk/modules/sqlite/seed-sqlite.c	(original)
+++ trunk/modules/sqlite/seed-sqlite.c	Fri Dec  5 03:32:41 2008
@@ -75,6 +75,23 @@
 	return ret;
 }
 
+SeedValue seed_sqlite_close  (SeedContext ctx,
+							  SeedObject function,
+							  SeedObject this_object,
+							  size_t argument_count,
+							  const SeedValue arguments[],
+							  SeedException * exception)
+{
+	sqlite3 * db = seed_object_get_private(this_object);
+	sqlite3_close(db);
+	return seed_value_from_boolean(ctx, TRUE, exception);
+}
+
+seed_static_function database_funcs[] = {
+	{"close", seed_sqlite_close, 0},
+	{0, 0, 0}
+};
+
 void seed_module_init(SeedEngine * eng)
 {
 	SeedObject db_constructor;
@@ -87,6 +104,7 @@
 	
 	sqlite_class_def.class_name = "Database";
 	sqlite_class_def.finalize = sqlite_database_finalize;
+	sqlite_class_def.static_functions = database_funcs;
 
 	sqlite_class = seed_create_class(&sqlite_class_def);
 	



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]