seed r285 - trunk/libseed



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

Log:
Make seed_pointer_class, seed_struct_class is now a type of that.


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

Modified: trunk/libseed/seed-engine.c
==============================================================================
--- trunk/libseed/seed-engine.c	(original)
+++ trunk/libseed/seed-engine.c	Sat Nov 22 00:08:35 2008
@@ -1153,6 +1153,7 @@
 			 seed_obj_ref);
     seed_init_builtins(argc, argv);
     seed_closures_init();
+    seed_structs_init();
 
     seed_gtype_init();
 

Modified: trunk/libseed/seed-structs.c
==============================================================================
--- trunk/libseed/seed-structs.c	(original)
+++ trunk/libseed/seed-structs.c	Sat Nov 22 00:08:35 2008
@@ -22,8 +22,29 @@
 #include "seed-private.h"
 #include <string.h>
 JSClassRef seed_struct_class = 0;
+JSClassRef seed_pointer_class = 0;
 
-JSClassDefinition gobject_struct_def = {
+JSClassDefinition seed_pointer_def = {
+    0,				/* Version, always 0 */
+    0,
+    "seed_pointer",		/* 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 */
+};
+
+JSClassDefinition seed_struct_def = {
     0,				/* Version, always 0 */
     0,
     "seed_struct",		/* Class Name */
@@ -45,7 +66,7 @@
 
 gpointer seed_struct_get_pointer(JSValueRef strukt)
 {
-    if (JSValueIsObjectOfClass(eng->context, strukt, seed_struct_class))
+    if (JSValueIsObjectOfClass(eng->context, strukt, seed_pointer_class))
 	return JSObjectGetPrivate((JSObjectRef) strukt);
     return 0;
 }
@@ -55,9 +76,6 @@
     JSObjectRef object;
     gint i, n_methods;
 
-    if (!seed_struct_class)
-	seed_struct_class = JSClassCreate(&gobject_struct_def);
-
     object = JSObjectMake(eng->context, seed_struct_class, younion);
 
     if (info)
@@ -83,9 +101,6 @@
     JSObjectRef object;
     gint i, n_methods;
 
-    if (!seed_struct_class)
-	seed_struct_class = JSClassCreate(&gobject_struct_def);
-
     object = JSObjectMake(eng->context, seed_struct_class, strukt);
 
     if (info)
@@ -105,3 +120,10 @@
 
     return object;
 }
+
+void seed_structs_init(void)
+{
+    seed_pointer_class = JSClassCreate(&seed_pointer_def);
+    seed_struct_def.parentClass = seed_pointer_class;
+    seed_struct_class = JSClassCreate(&seed_struct_def);
+}

Modified: trunk/libseed/seed-structs.h
==============================================================================
--- trunk/libseed/seed-structs.h	(original)
+++ trunk/libseed/seed-structs.h	Sat Nov 22 00:08:35 2008
@@ -25,6 +25,8 @@
 
 JSObjectRef seed_make_union(gpointer younion, GIBaseInfo * info);
 JSObjectRef seed_make_struct(gpointer strukt, GIBaseInfo * info);
+
 gpointer seed_struct_get_pointer(JSValueRef strukt);
+void seed_structs_init();
 
 #endif



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