Author: EricStein
Date: 2008-01-04 09:02:08 +0000 (Fri, 04 Jan 2008)
New Revision: 745

Modified:
   trunk/pysoy/include/glib.pxd
   trunk/pysoy/setup.py
   trunk/pysoy/src/_core-common/_eventLoop.pxi
   trunk/pysoy/src/_core-x11/soy._core.pxd
   trunk/pysoy/src/_datatypes/AsyncQueue.pxi
   trunk/pysoy/src/_datatypes/soy._datatypes.pxd
Log:
callback queue created, tested


Modified: trunk/pysoy/include/glib.pxd
===================================================================
--- trunk/pysoy/include/glib.pxd        2008-01-04 08:42:32 UTC (rev 744)
+++ trunk/pysoy/include/glib.pxd        2008-01-04 09:02:08 UTC (rev 745)
@@ -36,6 +36,9 @@
   cdef     gpointer  g_malloc          ( gulong )
   cdef     void      g_free            ( gpointer )
 
+  ctypedef struct GThreadFunctions :
+    void* none
+
   ctypedef struct GHashTable :
     void* none
 
@@ -79,6 +82,11 @@
   cdef GHashTable* g_hash_table_ref               ( GHashTable* )
   cdef void        g_hash_table_unref             ( GHashTable* )
 
-  cdef GAsyncQueue*    g_async_queue_new         ( )
+  cdef     void      g_thread_init     ( GThreadFunctions* )
 
+  cdef GAsyncQueue*  g_async_queue_new            ( )
+  cdef void          g_async_queue_unref          ( GAsyncQueue* )
+  cdef void          g_async_queue_push           ( GAsyncQueue*, gpointer )
+  cdef gpointer      g_async_queue_pop            ( GAsyncQueue* )
+
   cdef gchar*      g_strdup                       ( gchar* )

Modified: trunk/pysoy/setup.py
===================================================================
--- trunk/pysoy/setup.py        2008-01-04 08:42:32 UTC (rev 744)
+++ trunk/pysoy/setup.py        2008-01-04 09:02:08 UTC (rev 745)
@@ -75,7 +75,7 @@
                                   libraries=[translate[i] for i in modules[m]] 
) )
   extensions.append( Extension( name = '_core',
                                 sources = ['src/_core-w32/soy._core.c',],
-                                libraries = ['opengl32', 'glew32', 'ode', 
'gdi32']))
+                                libraries = ['opengl32', 'glew32', 'ode', 
'gdi32', 'glib-2.0', 'gthread-2.0']))
   scripts.append('win32_postinstall.py')
 
 # Apple OSX
@@ -93,7 +93,7 @@
                                   extra_link_args = frameworks ) )
   extensions.append( Extension( name = '_core',
                                 sources = ['src/_core-osx/soy._core.c',],
-                                libraries = ['GL'],
+                                libraries = ['GL', 'glib-2.0', 'gthread-2.0'],
                                 extra_compile_args = frameworks,
                                 extra_link_args = frameworks ) )
 
@@ -114,7 +114,7 @@
                                 sources = ['src/_core-x11/soy._core.c',],
                                 extra_compile_args = include_dirs,
                                 libraries = ['GLEW', 'GL', 'X11', 'Xxf86vm',
-                                             'ode']))
+                                             'ode', 'glib-2.0', 
'gthread-2.0']))
 #
 ############################################################################
 

Modified: trunk/pysoy/src/_core-common/_eventLoop.pxi
===================================================================
--- trunk/pysoy/src/_core-common/_eventLoop.pxi 2008-01-04 08:42:32 UTC (rev 
744)
+++ trunk/pysoy/src/_core-common/_eventLoop.pxi 2008-01-04 09:02:08 UTC (rev 
745)
@@ -17,8 +17,17 @@
 #
 # $Id$
 
+cimport glib
+cimport stdio
 cimport soy.transports
 
+glib.g_thread_init(<glib.GThreadFunctions*> 0)
+
+cdef soy._datatypes.AsyncQueue _queue
+_queue = soy._datatypes.AsyncQueue()
+
 cdef void _eventLoop() :
+  cdef void* callb
   while (1) :
-    _sleep(10)
+    callb = _queue._pop()
+    stdio.printf("got callback: %p\n", callb)

Modified: trunk/pysoy/src/_core-x11/soy._core.pxd
===================================================================
--- trunk/pysoy/src/_core-x11/soy._core.pxd     2008-01-04 08:42:32 UTC (rev 
744)
+++ trunk/pysoy/src/_core-x11/soy._core.pxd     2008-01-04 09:02:08 UTC (rev 
745)
@@ -19,6 +19,7 @@
 
 cimport gl
 cimport glx
+cimport glib
 cimport ode
 cimport ogg
 cimport py

Modified: trunk/pysoy/src/_datatypes/AsyncQueue.pxi
===================================================================
--- trunk/pysoy/src/_datatypes/AsyncQueue.pxi   2008-01-04 08:42:32 UTC (rev 
744)
+++ trunk/pysoy/src/_datatypes/AsyncQueue.pxi   2008-01-04 09:02:08 UTC (rev 
745)
@@ -25,3 +25,12 @@
 
   def __cinit__(self) :
     self._asyncqueue = glib.g_async_queue_new()
+
+  def __dealloc__(self) :
+    glib.g_async_queue_unref(self._asyncqueue)
+
+  cdef void _push(self, void* data) :
+    glib.g_async_queue_push(self._asyncqueue, data)
+
+  cdef void* _pop(self) :
+    return glib.g_async_queue_pop(self._asyncqueue)

Modified: trunk/pysoy/src/_datatypes/soy._datatypes.pxd
===================================================================
--- trunk/pysoy/src/_datatypes/soy._datatypes.pxd       2008-01-04 08:42:32 UTC 
(rev 744)
+++ trunk/pysoy/src/_datatypes/soy._datatypes.pxd       2008-01-04 09:02:08 UTC 
(rev 745)
@@ -48,6 +48,8 @@
 
 cdef class AsyncQueue :
   cdef glib.GAsyncQueue* _asyncqueue
+  cdef void              _push(self, void*)
+  cdef void*             _pop(self)
 
 cdef class HashTable :
   cdef glib.GHashTable*  _hashtable

_______________________________________________
PySoy-SVN mailing list
[email protected]
http://www.pysoy.org/mailman/listinfo/pysoy-svn

Reply via email to