seed r120 - trunk/libseed



Author: racarr
Date: Wed Nov  5 10:24:54 2008
New Revision: 120
URL: http://svn.gnome.org/viewvc/seed?rev=120&view=rev

Log:
Give seed native callbacks their own class.


Modified:
   trunk/libseed/seed-builtins.c
   trunk/libseed/seed-structs.h

Modified: trunk/libseed/seed-builtins.c
==============================================================================
--- trunk/libseed/seed-builtins.c	(original)
+++ trunk/libseed/seed-builtins.c	Wed Nov  5 10:24:54 2008
@@ -23,6 +23,8 @@
 #include <string.h>
 #include <sys/mman.h>
 
+JSClassRef seed_native_callback_class;
+
 JSValueRef
 seed_include(JSContextRef ctx,
 	     JSObjectRef function,
@@ -596,9 +598,28 @@
 		ffi_prep_closure(closure, cif, seed_handle_closure, privates);
 
 		
-		return seed_make_struct(closure, 0);
+		return JSObjectMake(eng->context, seed_native_callback_class, closure);
 }
 
+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,
+	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_init_builtins(int *argc, char ***argv)
 {
@@ -620,6 +641,9 @@
 	seed_create_function("closure_native", &seed_closure_native, obj);
 
 
+	seed_native_callback_def.parentClass = seed_struct_class;
+	seed_native_callback_class = JSClassCreate(&seed_native_callback_def);
+	JSClassRetain(seed_native_callback_class);
 
 	arrayObj = JSObjectMake(eng->context, NULL, NULL);
 

Modified: trunk/libseed/seed-structs.h
==============================================================================
--- trunk/libseed/seed-structs.h	(original)
+++ trunk/libseed/seed-structs.h	Wed Nov  5 10:24:54 2008
@@ -19,6 +19,7 @@
 
 #ifndef _SEED_STRUCT_H
 #define _SEED_STRUCT_H
+extern JSClassRef seed_struct_class;
 
 JSObjectRef seed_make_union(gpointer younion, GIBaseInfo * info);
 JSObjectRef seed_make_struct(gpointer strukt, GIBaseInfo * info);



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