seed r286 - trunk/libseed



Author: racarr
Date: Sat Nov 22 00:28:45 2008
New Revision: 286
URL: http://svn.gnome.org/viewvc/seed?rev=286&view=rev

Log:
Seed boxed class, also seed-gtype and should use seed_make_pointer for class_init callback.


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

Modified: trunk/libseed/seed-gtype.c
==============================================================================
--- trunk/libseed/seed-gtype.c	(original)
+++ trunk/libseed/seed-gtype.c	Sat Nov 22 00:28:45 2008
@@ -370,7 +370,7 @@
     JSValueRef exception = 0;
 
     type = (GType) JSObjectGetPrivate(*(JSObjectRef *) args[1]);
-    jsargs[0] = seed_make_struct(*(gpointer *) args[0], 0);
+    jsargs[0] = seed_make_pointer(*(gpointer *) args[0]);
     jsargs[1] = seed_gobject_get_prototype_for_gtype(type);
 
     // TODO: 
@@ -403,7 +403,7 @@
     JSValueRef exception = 0;
     JSObjectRef this_object;
 
-    jsargs = seed_make_struct(*(gpointer *) args[1], 0);
+    jsargs = seed_make_pointer(*(gpointer *) args[1]);
     this_object =
 	(JSObjectRef) seed_value_from_object(*(GObject **) args[0], 0);
 

Modified: trunk/libseed/seed-structs.c
==============================================================================
--- trunk/libseed/seed-structs.c	(original)
+++ trunk/libseed/seed-structs.c	Sat Nov 22 00:28:45 2008
@@ -23,6 +23,7 @@
 #include <string.h>
 JSClassRef seed_struct_class = 0;
 JSClassRef seed_pointer_class = 0;
+JSClassRef seed_boxed_class = 0;
 
 JSClassDefinition seed_pointer_def = {
     0,				/* Version, always 0 */
@@ -64,6 +65,26 @@
     NULL			/* Convert To Type */
 };
 
+JSClassDefinition seed_boxed_def = {
+    0,				/* Version, always 0 */
+    0,
+    "seed_boxed",		/* Class Name */
+    NULL,			/* Parent Class */
+    NULL,			/* Static Values */
+    NULL,			/* Static Functions */
+    NULL,
+    NULL,
+    NULL,			/* Has Property */
+    0,
+    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 */
+};
+
 gpointer seed_struct_get_pointer(JSValueRef strukt)
 {
     if (JSValueIsObjectOfClass(eng->context, strukt, seed_pointer_class))
@@ -71,6 +92,11 @@
     return 0;
 }
 
+JSObjectRef seed_make_pointer(gpointer pointer)
+{
+    return JSObjectMake(eng->context, seed_pointer_class, pointer);
+}
+
 JSObjectRef seed_make_union(gpointer younion, GIBaseInfo * info)
 {
     JSObjectRef object;
@@ -126,4 +152,6 @@
     seed_pointer_class = JSClassCreate(&seed_pointer_def);
     seed_struct_def.parentClass = seed_pointer_class;
     seed_struct_class = JSClassCreate(&seed_struct_def);
+    seed_boxed_def.parentClass = seed_struct_class;
+    seed_boxed_class = JSClassCreate(&seed_boxed_def);
 }

Modified: trunk/libseed/seed-structs.h
==============================================================================
--- trunk/libseed/seed-structs.h	(original)
+++ trunk/libseed/seed-structs.h	Sat Nov 22 00:28:45 2008
@@ -26,6 +26,8 @@
 JSObjectRef seed_make_union(gpointer younion, GIBaseInfo * info);
 JSObjectRef seed_make_struct(gpointer strukt, GIBaseInfo * info);
 
+JSObjectRef seed_make_pointer(gpointer pointer);
+
 gpointer seed_struct_get_pointer(JSValueRef strukt);
 void seed_structs_init();
 



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