seed r334 - in trunk: libseed modules/sqlite
- From: racarr svn gnome org
- To: svn-commits-list gnome org
- Subject: seed r334 - in trunk: libseed modules/sqlite
- Date: Tue, 25 Nov 2008 00:49:47 +0000 (UTC)
Author: racarr
Date: Tue Nov 25 00:49:47 2008
New Revision: 334
URL: http://svn.gnome.org/viewvc/seed?rev=334&view=rev
Log:
Add seed-api.c to have functions that don't map to internal functions. Make sqlite bindings wrap around all the error codes.
Added:
trunk/libseed/seed-api.c
Modified:
trunk/libseed/Makefile.am
trunk/libseed/seed.h
trunk/modules/sqlite/seed-sqlite.c
Modified: trunk/libseed/Makefile.am
==============================================================================
--- trunk/libseed/Makefile.am (original)
+++ trunk/libseed/Makefile.am Tue Nov 25 00:49:47 2008
@@ -4,6 +4,7 @@
libseed_la_SOURCES = \
seed-closure.c \
+ seed-api.c \
seed-closure.h \
seed-builtins.c\
seed-builtins.h \
Added: trunk/libseed/seed-api.c
==============================================================================
--- (empty file)
+++ trunk/libseed/seed-api.c Tue Nov 25 00:49:47 2008
@@ -0,0 +1,6 @@
+#include "seed-private.h"
+
+JSObjectRef seed_make_object(JSClassRef class, gpointer private)
+{
+ return JSObjectMake(eng->context, class, private);
+}
Modified: trunk/libseed/seed.h
==============================================================================
--- trunk/libseed/seed.h (original)
+++ trunk/libseed/seed.h Tue Nov 25 00:49:47 2008
@@ -31,6 +31,7 @@
typedef gpointer SeedClass;
typedef gpointer SeedException;
typedef gpointer SeedFunction;
+
typedef gpointer SeedContextRef;
typedef struct _SeedScript SeedScript;
@@ -58,8 +59,19 @@
SeedValue seed_evaluate(SeedScript * s, SeedObject this);
/*
+ * seed-api.c
+ */
+
+SeedObject seed_make_object(SeedClass class, gpointer private);
+
+/*
* seed-types.c
*/
+gboolean seed_object_set_property(SeedObject object,
+ const gchar * name,
+ SeedValue value);
+SeedValue seed_object_get_property(SeedObject object,
+ const gchar * name);
gboolean seed_value_to_boolean(SeedValue val, SeedException * exception);
SeedValue seed_value_from_boolean(gboolean val, SeedException * exception);
Modified: trunk/modules/sqlite/seed-sqlite.c
==============================================================================
--- trunk/modules/sqlite/seed-sqlite.c (original)
+++ trunk/modules/sqlite/seed-sqlite.c Tue Nov 25 00:49:47 2008
@@ -1,7 +1,42 @@
#include <seed.h>
#include <sqlite3.h>
+#define MAKE_ERROR_ENUM(name) \
+ seed_object_set_property(namespace_ref, #name, \
+ seed_value_from_int(SQLITE_##name, 0))
+
void seed_module_init(SeedEngine * eng)
{
- printf("Hello Seed SQLite world");
+ SeedObject namespace_ref = seed_make_object(0, 0);
+
+ seed_object_set_property(eng->global, "sqlite", namespace_ref);
+
+ MAKE_ERROR_ENUM(OK);
+ MAKE_ERROR_ENUM(ERROR);
+ MAKE_ERROR_ENUM(INTERNAL);
+ MAKE_ERROR_ENUM(PERM);
+ MAKE_ERROR_ENUM(ABORT);
+ MAKE_ERROR_ENUM(BUSY);
+ MAKE_ERROR_ENUM(LOCKED);
+ MAKE_ERROR_ENUM(NOMEM);
+ MAKE_ERROR_ENUM(READONLY);
+ MAKE_ERROR_ENUM(INTERRUPT);
+ MAKE_ERROR_ENUM(CORRUPT);
+ MAKE_ERROR_ENUM(NOTFOUND);
+ MAKE_ERROR_ENUM(FULL);
+ MAKE_ERROR_ENUM(CANTOPEN);
+ MAKE_ERROR_ENUM(PROTOCOL);
+ MAKE_ERROR_ENUM(EMPTY);
+ MAKE_ERROR_ENUM(SCHEMA);
+ MAKE_ERROR_ENUM(TOOBIG);
+ MAKE_ERROR_ENUM(CONSTRAINT);
+ MAKE_ERROR_ENUM(MISMATCH);
+ MAKE_ERROR_ENUM(MISUSE);
+ MAKE_ERROR_ENUM(NOLFS);
+ MAKE_ERROR_ENUM(AUTH);
+ MAKE_ERROR_ENUM(FORMAT);
+ MAKE_ERROR_ENUM(RANGE);
+ MAKE_ERROR_ENUM(NOTADB);
+ MAKE_ERROR_ENUM(ROW);
+ MAKE_ERROR_ENUM(DONE);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]