[seed: 1/15] Begin work on the new importer
- From: Robert Carr <racarr src gnome org>
- To: svn-commits-list gnome org
- Subject: [seed: 1/15] Begin work on the new importer
- Date: Sun, 12 Apr 2009 02:10:49 -0400 (EDT)
commit 876b7e939e4bf48734f0673740fc70049e7e443d
Author: Robert Carr <racarr mireia (none)>
Date: Sat Apr 11 16:10:40 2009 -0400
Begin work on the new importer
---
libseed/Makefile.am | 4 +++-
libseed/seed-engine.c | 4 ++++
libseed/seed-importer.c | 34 ++++++++++++++++++++++++++++++++++
libseed/seed-importer.h | 8 ++++++++
libseed/seed-private.h | 1 +
5 files changed, 50 insertions(+), 1 deletions(-)
diff --git a/libseed/Makefile.am b/libseed/Makefile.am
index b3ba4c1..736c049 100644
--- a/libseed/Makefile.am
+++ b/libseed/Makefile.am
@@ -20,7 +20,9 @@ libseed_la_SOURCES = \
seed-gtype.h \
seed-structs.h \
seed-types.c \
- seed-types.h
+ seed-types.h \
+ seed-importer.c \
+ seed-importer.h
libseed_la_LIBADD = $(LIBSEED_LIBS)
libseed_la_CPPFLAGS = -lgmodule-2.0 $(LIBSEED_CFLAGS) $(SEED_OSX_CFLAGS) $(FFI_CFLAGS)
diff --git a/libseed/seed-engine.c b/libseed/seed-engine.c
index d69e3cf..a7e5cf7 100644
--- a/libseed/seed-engine.c
+++ b/libseed/seed-engine.c
@@ -1500,6 +1500,8 @@ seed_init (gint * argc, gchar *** argv)
g_irepository_require (g_irepository_get_default (), "GObject", NULL, 0, 0);
g_irepository_require (g_irepository_get_default (), "GIRepository",
NULL, 0, 0);
+
+ seed_initialize_importer (eng->context, eng->global);
seed_init_builtins (eng, argc, argv);
seed_closures_init ();
@@ -1585,6 +1587,8 @@ seed_init_with_context_group (gint * argc,
g_irepository_require (g_irepository_get_default (), "GIRepository",
NULL, 0, 0);
+ seed_initialize_importer (eng->context, eng->global);
+
seed_init_builtins (eng, argc, argv);
seed_closures_init ();
seed_structs_init ();
diff --git a/libseed/seed-importer.c b/libseed/seed-importer.c
new file mode 100644
index 0000000..1b840b1
--- /dev/null
+++ b/libseed/seed-importer.c
@@ -0,0 +1,34 @@
+#include "seed-private.h"
+
+JSClassRef importer_class;
+JSObjectRef importer;
+
+
+JSClassDefinition importer_class_def = {
+ 0, /* Version, always 0 */
+ 0,
+ "importer", /* Class Name */
+ NULL, /* Parent Class */
+ NULL, /* Static Values */
+ NULL, /* Static Functions */
+ NULL, /* Initialize */
+ NULL, /* Finalize */
+ NULL, /* Has Property */
+ NULL, /* Get Property */
+ NULL, /* Set Property */
+ NULL, /* Delete Property */
+ NULL, /* Get Property Names */
+ NULL, /* Call As Function */
+ NULL, /* Call As Constructor */
+ NULL, /* Has Instance */
+ NULL /* Convert To Type */
+};
+
+void seed_initialize_importer(JSContextRef ctx,
+ JSObjectRef global)
+{
+ importer_class = JSClassCreate (&importer_class_def);
+ importer = JSObjectMake (ctx, importer_class, NULL);
+
+ seed_object_set_property (ctx, global, "imports", importer);
+}
diff --git a/libseed/seed-importer.h b/libseed/seed-importer.h
new file mode 100644
index 0000000..1cf7d8b
--- /dev/null
+++ b/libseed/seed-importer.h
@@ -0,0 +1,8 @@
+#ifndef _SEED_IMPORTER_H
+#define _SEED_IMPORTER_H
+
+#include "seed-private.h"
+
+void seed_initialize_importer (JSContextRef ctx, JSObjectRef global);
+
+#endif
diff --git a/libseed/seed-private.h b/libseed/seed-private.h
index 13c7ebc..2d163cb 100644
--- a/libseed/seed-private.h
+++ b/libseed/seed-private.h
@@ -52,5 +52,6 @@ struct _SeedEngine
#include "seed-closure.h"
#include "seed-gtype.h"
#include "seed-exceptions.h"
+#include "seed-importer.h"
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]