seed r122 - trunk/libseed
- From: racarr svn gnome org
- To: svn-commits-list gnome org
- Subject: seed r122 - trunk/libseed
- Date: Wed, 5 Nov 2008 10:54:08 +0000 (UTC)
Author: racarr
Date: Wed Nov 5 10:54:08 2008
New Revision: 122
URL: http://svn.gnome.org/viewvc/seed?rev=122&view=rev
Log:
Move seed-closure.c, seed-closure.h into their own files. Add
seed_make_closure.
Added:
trunk/libseed/seed-closure.c
trunk/libseed/seed-closure.h
Modified:
trunk/libseed/Makefile.am
trunk/libseed/Makefile.in
trunk/libseed/seed-builtins.c
trunk/libseed/seed-builtins.h
trunk/libseed/seed-engine.c
trunk/libseed/seed-private.h
trunk/libseed/seed-types.c
Modified: trunk/libseed/Makefile.am
==============================================================================
--- trunk/libseed/Makefile.am (original)
+++ trunk/libseed/Makefile.am Wed Nov 5 10:54:08 2008
@@ -3,6 +3,8 @@
libseed.la
libseed_la_SOURCES = \
+ seed-closure.c \
+ seed-closure.h \
seed-builtins.c\
seed-builtins.h \
seed-engine.c \
Modified: trunk/libseed/Makefile.in
==============================================================================
--- trunk/libseed/Makefile.in (original)
+++ trunk/libseed/Makefile.in Wed Nov 5 10:54:08 2008
@@ -54,8 +54,8 @@
LTLIBRARIES = $(lib_LTLIBRARIES)
am__DEPENDENCIES_1 =
libseed_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
-am_libseed_la_OBJECTS = seed-builtins.lo seed-engine.lo \
- seed-signals.lo seed-structs.lo seed-types.lo
+am_libseed_la_OBJECTS = seed-closure.lo seed-builtins.lo \
+ seed-engine.lo seed-signals.lo seed-structs.lo seed-types.lo
libseed_la_OBJECTS = $(am_libseed_la_OBJECTS)
DEFAULT_INCLUDES = -I am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -236,6 +236,8 @@
libseed.la
libseed_la_SOURCES = \
+ seed-closure.c \
+ seed-closure.h \
seed-builtins.c\
seed-builtins.h \
seed-engine.c \
@@ -333,6 +335,7 @@
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote /$(DEPDIR)/seed-builtins Plo am__quote@
+ AMDEP_TRUE@@am__include@ @am__quote /$(DEPDIR)/seed-closure Plo am__quote@
@AMDEP_TRUE@@am__include@ @am__quote /$(DEPDIR)/seed-engine Plo am__quote@
@AMDEP_TRUE@@am__include@ @am__quote /$(DEPDIR)/seed-signals Plo am__quote@
@AMDEP_TRUE@@am__include@ @am__quote /$(DEPDIR)/seed-structs Plo am__quote@
Modified: trunk/libseed/seed-builtins.c
==============================================================================
--- trunk/libseed/seed-builtins.c (original)
+++ trunk/libseed/seed-builtins.c Wed Nov 5 10:54:08 2008
@@ -339,208 +339,6 @@
return (JSValueRef)seed_make_struct(closure, 0);
}
-static ffi_type *
-get_ffi_type (GITypeInfo *info)
-{
- ffi_type *rettype;
-
- if (g_type_info_is_pointer (info))
- rettype = &ffi_type_pointer;
- else
- switch (g_type_info_get_tag (info))
- {
- case GI_TYPE_TAG_VOID:
- rettype = &ffi_type_void;
- break;
- case GI_TYPE_TAG_BOOLEAN:
- rettype = &ffi_type_uint;
- break;
- case GI_TYPE_TAG_INT8:
- rettype = &ffi_type_sint8;
- break;
- case GI_TYPE_TAG_UINT8:
- rettype = &ffi_type_uint8;
- break;
- case GI_TYPE_TAG_INT16:
- rettype = &ffi_type_sint16;
- break;
- case GI_TYPE_TAG_UINT16:
- rettype = &ffi_type_uint16;
- break;
- case GI_TYPE_TAG_INT32:
- rettype = &ffi_type_sint32;
- break;
- case GI_TYPE_TAG_UINT32:
- rettype = &ffi_type_uint32;
- break;
- case GI_TYPE_TAG_INT64:
- rettype = &ffi_type_sint64;
- break;
- case GI_TYPE_TAG_UINT64:
- rettype = &ffi_type_uint64;
- break;
- case GI_TYPE_TAG_INT:
- rettype = &ffi_type_sint;
- break;
- case GI_TYPE_TAG_UINT:
- rettype = &ffi_type_uint;
- break;
- case GI_TYPE_TAG_SSIZE: /* FIXME */
- case GI_TYPE_TAG_LONG:
- rettype = &ffi_type_slong;
- break;
- case GI_TYPE_TAG_SIZE: /* FIXME */
- case GI_TYPE_TAG_TIME_T: /* May not be portable */
- case GI_TYPE_TAG_ULONG:
- rettype = &ffi_type_ulong;
- break;
- case GI_TYPE_TAG_FLOAT:
- rettype = &ffi_type_float;
- break;
- case GI_TYPE_TAG_DOUBLE:
- rettype = &ffi_type_double;
- break;
- case GI_TYPE_TAG_UTF8:
- case GI_TYPE_TAG_FILENAME:
- case GI_TYPE_TAG_ARRAY:
- case GI_TYPE_TAG_INTERFACE:
- case GI_TYPE_TAG_GLIST:
- case GI_TYPE_TAG_GSLIST:
- case GI_TYPE_TAG_GHASH:
- case GI_TYPE_TAG_ERROR:
- rettype = &ffi_type_pointer;
- break;
- default:
- g_assert_not_reached ();
- }
-
- return rettype;
-}
-
-
-static void seed_closure_finalize(JSObjectRef object)
-{
- SeedClosurePrivates * privates =
- (SeedClosurePrivates*)JSObjectGetPrivate(object);
-
- g_free(privates->cif->arg_types);
- g_free(privates->cif);
- JSValueUnprotect(eng->context, privates->function);
- munmap(privates->closure, sizeof(ffi_closure));
-}
-
-static void
-seed_handle_closure(ffi_cif *cif,
- void * result,
- void ** args,
- void * userdata)
-{
- SeedClosurePrivates * privates = userdata;
- int num_args, i;
- JSValueRef * jsargs;
- JSValueRef * return_value;
- GIArgInfo * arg_info;
- GITypeInfo * return_type;
- GArgument rarg;
-
- num_args = g_callable_info_get_n_args(privates->info);
- jsargs = (JSValueRef *)g_new0(JSValueRef, num_args);
-
- for (i = 0; i < num_args; i++)
- {
- GITypeInfo * arg_type;
- GITypeTag tag;
- GType type;
- GArgument * arg = &rarg;
-
- arg_info = g_callable_info_get_arg(privates->info, i);
- arg_type = g_arg_info_get_type(arg_info);
- tag = g_type_info_get_tag(arg_type);
-
- switch(tag)
- {
- case GI_TYPE_TAG_BOOLEAN:
- arg->v_boolean = *(gboolean*)args[i];
- break;
- case GI_TYPE_TAG_INT8:
- arg->v_int8 = *(gint8*)args[i];
- break;
- case GI_TYPE_TAG_UINT8:
- arg->v_uint8 = *(guint8*)args[i];
- break;
- case GI_TYPE_TAG_INT16:
- arg->v_int16 = *(gint16*)args[i];
- break;
- case GI_TYPE_TAG_UINT16:
- arg->v_uint16 = *(guint16*)args[i];
- break;
- case GI_TYPE_TAG_INT32:
- arg->v_int32 = *(gint32*)args[i];
- break;
- case GI_TYPE_TAG_UINT32:
- arg->v_uint32 = *(guint32*)args[i];
- break;
- case GI_TYPE_TAG_LONG:
- case GI_TYPE_TAG_INT64:
- arg->v_int64 = *(glong*)args[i];
- break;
- case GI_TYPE_TAG_ULONG:
- case GI_TYPE_TAG_UINT64:
- arg->v_uint64 = *(glong*)args[i];
- break;
- case GI_TYPE_TAG_INT:
- case GI_TYPE_TAG_SSIZE:
- case GI_TYPE_TAG_SIZE:
- arg->v_int32 = *(gint*)args[i];
- break;
- case GI_TYPE_TAG_UINT:
- arg->v_uint32 = *(guint*)args[i];
- break;
- case GI_TYPE_TAG_FLOAT:
- arg->v_float = *(gfloat*)args[i];
- break;
- case GI_TYPE_TAG_DOUBLE:
- arg->v_double = *(gdouble*)args[i];
- break;
- case GI_TYPE_TAG_UTF8:
- arg->v_string = (gchar *)args[i];
- break;
- case GI_TYPE_TAG_INTERFACE:
- {
- GIBaseInfo *interface;
- GIInfoType interface_type;
-
- interface = g_type_info_get_interface(arg_type);
- interface_type = g_base_info_get_type(interface);
-
- if (interface_type == GI_INFO_TYPE_OBJECT ||
- interface_type == GI_INFO_TYPE_INTERFACE) {
- arg->v_pointer = *(gpointer*)args[i];
- break;
- }
-
- else if (interface_type == GI_INFO_TYPE_ENUM ||
- interface_type == GI_INFO_TYPE_FLAGS) {
- arg->v_double = *(double*)args[i];
- break;
- } else if (interface_type == GI_INFO_TYPE_STRUCT) {
- arg->v_pointer = *(gpointer*)args[i];
- break;
- }
- }
- case GI_TYPE_TAG_GLIST:
- case GI_TYPE_TAG_GSLIST:
- arg->v_pointer = *(gpointer*)args[i];
- break;
- default:
- arg->v_pointer = 0;
- }
- jsargs[i] = seed_gi_argument_make_js(arg, arg_type, 0);
- }
-
- JSObjectCallAsFunction(eng->context, (JSObjectRef)privates->function,
- 0, num_args, jsargs, 0);
-}
JSValueRef
seed_closure_native(JSContextRef ctx,
@@ -574,60 +372,12 @@
info = (GICallableInfo *)
JSObjectGetPrivate((JSObjectRef)arguments[1]);
-
- num_args = g_callable_info_get_n_args(info);
- return_type = g_callable_info_get_return_type(info);
- arg_types = (ffi_type **)g_new0(ffi_type, num_args+1);
- cif = g_new0(ffi_cif, 1);
-
- privates = g_new0(SeedClosurePrivates, 1);
- privates->info = info;
- privates->function = arguments[0];
- privates->cif = cif;
- //Leaks the function? Would need a new class for closures and finalize
- //handler.
- JSValueProtect(eng->context, privates->function);
-
- for (i = 0; i < num_args; i++)
- {
- arg_info = g_callable_info_get_arg(info, i);
- arg_types[i] = get_ffi_type(g_arg_info_get_type(arg_info));
- }
- arg_types[num_args] = 0;
-
- closure = mmap(0, sizeof(ffi_closure), PROT_READ | PROT_WRITE |
- PROT_EXEC,
- MAP_ANON | MAP_PRIVATE, -1, 0);
- privates->closure = closure;
-
- ffi_prep_cif(cif, FFI_DEFAULT_ABI, 2,
- &ffi_type_void, arg_types);
- ffi_prep_closure(closure, cif, seed_handle_closure, privates);
-
+ privates = seed_make_closure(info, arguments[0]);
+
return JSObjectMake(eng->context, seed_native_callback_class, privates);
}
-JSClassDefinition seed_native_callback_def = {
- 0, /* Version, always 0 */
- 0,
- "seed_native_callback", /* Class Name */
- 0, /* Parent Class */
- NULL, /* Static Values */
- NULL, /* Static Functions */
- NULL,
- seed_closure_finalize, /* 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_init_builtins(int *argc, char ***argv)
{
int i;
@@ -648,9 +398,6 @@
seed_create_function("closure_native", &seed_closure_native, obj);
- seed_native_callback_class = JSClassCreate(&seed_native_callback_def);
- JSClassRetain(seed_native_callback_class);
-
arrayObj = JSObjectMake(eng->context, NULL, NULL);
for (i = 0; i < *argc; ++i) {
Modified: trunk/libseed/seed-builtins.h
==============================================================================
--- trunk/libseed/seed-builtins.h (original)
+++ trunk/libseed/seed-builtins.h Wed Nov 5 10:54:08 2008
@@ -24,16 +24,6 @@
// TODO: someday, maybe, move import_namespace here!
-typedef struct _SeedClosurePrivates
-{
- GICallableInfo * info;
- JSValueRef function;
-
- ffi_closure * closure;
- ffi_cif * cif;
-} SeedClosurePrivates;
-
-extern JSClassRef seed_native_callback_class;
JSValueRef
seed_include(JSContextRef ctx,
Added: trunk/libseed/seed-closure.c
==============================================================================
--- (empty file)
+++ trunk/libseed/seed-closure.c Wed Nov 5 10:54:08 2008
@@ -0,0 +1,297 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * seed-closure.c.h
+ * Copyright (C) Robert Carr 2008 <carrr rpi edu>
+ *
+ * libseed is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * libseed is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "seed-private.h"
+#include <sys/mman.h>
+
+static ffi_type *
+get_ffi_type (GITypeInfo *info)
+{
+ ffi_type *rettype;
+
+ if (g_type_info_is_pointer (info))
+ rettype = &ffi_type_pointer;
+ else
+ switch (g_type_info_get_tag (info))
+ {
+ case GI_TYPE_TAG_VOID:
+ rettype = &ffi_type_void;
+ break;
+ case GI_TYPE_TAG_BOOLEAN:
+ rettype = &ffi_type_uint;
+ break;
+ case GI_TYPE_TAG_INT8:
+ rettype = &ffi_type_sint8;
+ break;
+ case GI_TYPE_TAG_UINT8:
+ rettype = &ffi_type_uint8;
+ break;
+ case GI_TYPE_TAG_INT16:
+ rettype = &ffi_type_sint16;
+ break;
+ case GI_TYPE_TAG_UINT16:
+ rettype = &ffi_type_uint16;
+ break;
+ case GI_TYPE_TAG_INT32:
+ rettype = &ffi_type_sint32;
+ break;
+ case GI_TYPE_TAG_UINT32:
+ rettype = &ffi_type_uint32;
+ break;
+ case GI_TYPE_TAG_INT64:
+ rettype = &ffi_type_sint64;
+ break;
+ case GI_TYPE_TAG_UINT64:
+ rettype = &ffi_type_uint64;
+ break;
+ case GI_TYPE_TAG_INT:
+ rettype = &ffi_type_sint;
+ break;
+ case GI_TYPE_TAG_UINT:
+ rettype = &ffi_type_uint;
+ break;
+ case GI_TYPE_TAG_SSIZE: /* FIXME */
+ case GI_TYPE_TAG_LONG:
+ rettype = &ffi_type_slong;
+ break;
+ case GI_TYPE_TAG_SIZE: /* FIXME */
+ case GI_TYPE_TAG_TIME_T: /* May not be portable */
+ case GI_TYPE_TAG_ULONG:
+ rettype = &ffi_type_ulong;
+ break;
+ case GI_TYPE_TAG_FLOAT:
+ rettype = &ffi_type_float;
+ break;
+ case GI_TYPE_TAG_DOUBLE:
+ rettype = &ffi_type_double;
+ break;
+ case GI_TYPE_TAG_UTF8:
+ case GI_TYPE_TAG_FILENAME:
+ case GI_TYPE_TAG_ARRAY:
+ case GI_TYPE_TAG_INTERFACE:
+ case GI_TYPE_TAG_GLIST:
+ case GI_TYPE_TAG_GSLIST:
+ case GI_TYPE_TAG_GHASH:
+ case GI_TYPE_TAG_ERROR:
+ rettype = &ffi_type_pointer;
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+
+ return rettype;
+}
+
+
+static void seed_closure_finalize(JSObjectRef object)
+{
+ SeedClosurePrivates * privates =
+ (SeedClosurePrivates*)JSObjectGetPrivate(object);
+
+ g_free(privates->cif->arg_types);
+ g_free(privates->cif);
+ JSValueUnprotect(eng->context, privates->function);
+ munmap(privates->closure, sizeof(ffi_closure));
+}
+
+static void
+seed_handle_closure(ffi_cif *cif,
+ void * result,
+ void ** args,
+ void * userdata)
+{
+ SeedClosurePrivates * privates = userdata;
+ int num_args, i;
+ JSValueRef * jsargs;
+ JSValueRef * return_value;
+ GIArgInfo * arg_info;
+ GITypeInfo * return_type;
+ GArgument rarg;
+
+ num_args = g_callable_info_get_n_args(privates->info);
+ jsargs = (JSValueRef *)g_new0(JSValueRef, num_args);
+
+ for (i = 0; i < num_args; i++)
+ {
+ GITypeInfo * arg_type;
+ GITypeTag tag;
+ GType type;
+ GArgument * arg = &rarg;
+
+ arg_info = g_callable_info_get_arg(privates->info, i);
+ arg_type = g_arg_info_get_type(arg_info);
+ tag = g_type_info_get_tag(arg_type);
+
+ switch(tag)
+ {
+ case GI_TYPE_TAG_BOOLEAN:
+ arg->v_boolean = *(gboolean*)args[i];
+ break;
+ case GI_TYPE_TAG_INT8:
+ arg->v_int8 = *(gint8*)args[i];
+ break;
+ case GI_TYPE_TAG_UINT8:
+ arg->v_uint8 = *(guint8*)args[i];
+ break;
+ case GI_TYPE_TAG_INT16:
+ arg->v_int16 = *(gint16*)args[i];
+ break;
+ case GI_TYPE_TAG_UINT16:
+ arg->v_uint16 = *(guint16*)args[i];
+ break;
+ case GI_TYPE_TAG_INT32:
+ arg->v_int32 = *(gint32*)args[i];
+ break;
+ case GI_TYPE_TAG_UINT32:
+ arg->v_uint32 = *(guint32*)args[i];
+ break;
+ case GI_TYPE_TAG_LONG:
+ case GI_TYPE_TAG_INT64:
+ arg->v_int64 = *(glong*)args[i];
+ break;
+ case GI_TYPE_TAG_ULONG:
+ case GI_TYPE_TAG_UINT64:
+ arg->v_uint64 = *(glong*)args[i];
+ break;
+ case GI_TYPE_TAG_INT:
+ case GI_TYPE_TAG_SSIZE:
+ case GI_TYPE_TAG_SIZE:
+ arg->v_int32 = *(gint*)args[i];
+ break;
+ case GI_TYPE_TAG_UINT:
+ arg->v_uint32 = *(guint*)args[i];
+ break;
+ case GI_TYPE_TAG_FLOAT:
+ arg->v_float = *(gfloat*)args[i];
+ break;
+ case GI_TYPE_TAG_DOUBLE:
+ arg->v_double = *(gdouble*)args[i];
+ break;
+ case GI_TYPE_TAG_UTF8:
+ arg->v_string = (gchar *)args[i];
+ break;
+ case GI_TYPE_TAG_INTERFACE:
+ {
+ GIBaseInfo *interface;
+ GIInfoType interface_type;
+
+ interface = g_type_info_get_interface(arg_type);
+ interface_type = g_base_info_get_type(interface);
+
+ if (interface_type == GI_INFO_TYPE_OBJECT ||
+ interface_type == GI_INFO_TYPE_INTERFACE) {
+ arg->v_pointer = *(gpointer*)args[i];
+ break;
+ }
+
+ else if (interface_type == GI_INFO_TYPE_ENUM ||
+ interface_type == GI_INFO_TYPE_FLAGS) {
+ arg->v_double = *(double*)args[i];
+ break;
+ } else if (interface_type == GI_INFO_TYPE_STRUCT) {
+ arg->v_pointer = *(gpointer*)args[i];
+ break;
+ }
+ }
+ case GI_TYPE_TAG_GLIST:
+ case GI_TYPE_TAG_GSLIST:
+ arg->v_pointer = *(gpointer*)args[i];
+ break;
+ default:
+ arg->v_pointer = 0;
+ }
+ jsargs[i] = seed_gi_argument_make_js(arg, arg_type, 0);
+ }
+
+ JSObjectCallAsFunction(eng->context, (JSObjectRef)privates->function,
+ 0, num_args, jsargs, 0);
+}
+
+
+SeedClosurePrivates * seed_make_closure(GICallableInfo * info,
+ JSValueRef function)
+{
+ ffi_cif * cif;
+ ffi_closure *closure;
+ ffi_type ** arg_types;
+ ffi_arg result;
+ ffi_status status;
+ GITypeInfo * return_type;
+ GIArgInfo * arg_info;
+ gint num_args, i;
+ SeedClosurePrivates * privates;
+
+
+ num_args = g_callable_info_get_n_args(info);
+ return_type = g_callable_info_get_return_type(info);
+ arg_types = (ffi_type **)g_new0(ffi_type, num_args+1);
+ cif = g_new0(ffi_cif, 1);
+
+ privates = g_new0(SeedClosurePrivates, 1);
+ privates->info = info;
+ privates->function = function;
+ privates->cif = cif;
+ JSValueProtect(eng->context, privates->function);
+
+ for (i = 0; i < num_args; i++)
+ {
+ arg_info = g_callable_info_get_arg(info, i);
+ arg_types[i] = get_ffi_type(g_arg_info_get_type(arg_info));
+ }
+ arg_types[num_args] = 0;
+
+
+ closure = mmap(0, sizeof(ffi_closure), PROT_READ | PROT_WRITE |
+ PROT_EXEC,
+ MAP_ANON | MAP_PRIVATE, -1, 0);
+ privates->closure = closure;
+
+ ffi_prep_cif(cif, FFI_DEFAULT_ABI, 2,
+ &ffi_type_void, arg_types);
+ ffi_prep_closure(closure, cif, seed_handle_closure, privates);
+
+ return privates;
+}
+
+JSClassDefinition seed_native_callback_def = {
+ 0, /* Version, always 0 */
+ 0,
+ "seed_native_callback", /* Class Name */
+ 0, /* Parent Class */
+ NULL, /* Static Values */
+ NULL, /* Static Functions */
+ NULL,
+ seed_closure_finalize, /* 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_closures_init(void)
+{
+ seed_native_callback_class = JSClassCreate(&seed_native_callback_def);
+ JSClassRetain(seed_native_callback_class);
+}
Added: trunk/libseed/seed-closure.h
==============================================================================
--- (empty file)
+++ trunk/libseed/seed-closure.h Wed Nov 5 10:54:08 2008
@@ -0,0 +1,39 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * seed-builtins.h
+ * Copyright (C) Robert Carr 2008 <carrr rpi edu>
+ *
+ * libseed is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * libseed is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef _SEED_CLOSURE_H_
+#define _SEED_CLOSURE_H_
+
+#include "seed-private.h"
+
+typedef struct _SeedClosurePrivates
+{
+ GICallableInfo * info;
+ JSValueRef function;
+
+ ffi_closure * closure;
+ ffi_cif * cif;
+} SeedClosurePrivates;
+
+extern JSClassRef seed_native_callback_class;
+
+SeedClosurePrivates * seed_make_closure(GICallableInfo * info,
+ JSValueRef function);
+void seed_closures_init();
+
+#endif
Modified: trunk/libseed/seed-engine.c
==============================================================================
--- trunk/libseed/seed-engine.c (original)
+++ trunk/libseed/seed-engine.c Wed Nov 5 10:54:08 2008
@@ -890,6 +890,7 @@
seed_create_function("import_namespace", &seed_gi_import_namespace,
seed_obj_ref);
seed_init_builtins(argc, argv);
+ seed_closures_init();
defaults_script =
JSStringCreateWithUTF8CString("Seed.include(\"/usr/local/share"
Modified: trunk/libseed/seed-private.h
==============================================================================
--- trunk/libseed/seed-private.h (original)
+++ trunk/libseed/seed-private.h Wed Nov 5 10:54:08 2008
@@ -41,6 +41,7 @@
#include "seed-signals.h"
#include "seed-builtins.h"
#include "seed-structs.h"
+#include "seed-closure.h"
#endif
Modified: trunk/libseed/seed-types.c
==============================================================================
--- trunk/libseed/seed-types.c (original)
+++ trunk/libseed/seed-types.c Wed Nov 5 10:54:08 2008
@@ -289,6 +289,11 @@
arg->v_pointer = privates->closure;
break;
}
+ else if (JSObjectIsFunction(eng->context,
+ (JSObjectRef)value))
+ {
+
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]