Author: ArcRiley Date: 2008-02-19 11:05:57 -0500 (Tue, 19 Feb 2008) New Revision: 946
Removed: trunk/pysoy/src/_core/_Transports.pxi Modified: trunk/pysoy/src/_core/_coreLoop.pxi trunk/pysoy/src/_core/soy._core.pyx trunk/pysoy/src/transports/Transport.pxi trunk/pysoy/src/transports/soy.transports.pxd trunk/pysoy/src/transports/soy.transports.pyx Log: #932 : Implemented working TransportLoop, currently a bit slow to start loading however Deleted: trunk/pysoy/src/_core/_Transports.pxi =================================================================== --- trunk/pysoy/src/_core/_Transports.pxi 2008-02-19 15:58:32 UTC (rev 945) +++ trunk/pysoy/src/_core/_Transports.pxi 2008-02-19 16:05:57 UTC (rev 946) @@ -1,26 +0,0 @@ -# PySoy _Transports -# -# Copyright (C) 2006,2007,2008 PySoy Group -# -# This program 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. -# -# This program 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 -# -# $Id$ - -# This hack counts as a level 5 sin. - -cdef soy._internals.Children _transports -_transports = soy._internals.Children() - -def _Transports() : - return py.PyCObject_FromVoidPtr(<void *> _transports, NULL) Modified: trunk/pysoy/src/_core/_coreLoop.pxi =================================================================== --- trunk/pysoy/src/_core/_coreLoop.pxi 2008-02-19 15:58:32 UTC (rev 945) +++ trunk/pysoy/src/_core/_coreLoop.pxi 2008-02-19 16:05:57 UTC (rev 946) @@ -27,11 +27,6 @@ cdef soy._internals.Children _scenes _scenes = <soy._internals.Children> soy.scenes._getScenes() while (1) : - _transports.lock() - for i from 0 <= i < _transports.current : - (<soy.transports.Transport> _transports.list[i])._coreProcess() - _transports.unlock() - # _screens.lock() for i from 0 <= i < _screens.current : (<Screen> _screens.list[i])._events() Modified: trunk/pysoy/src/_core/soy._core.pyx =================================================================== --- trunk/pysoy/src/_core/soy._core.pyx 2008-02-19 15:58:32 UTC (rev 945) +++ trunk/pysoy/src/_core/soy._core.pyx 2008-02-19 16:05:57 UTC (rev 946) @@ -38,8 +38,6 @@ cimport soy.transports cimport soy.widgets -include "_Transports.pxi" - IF UNAME_SYSNAME == "Windows" : include "_windowproc.pxi" include "Screen-w32.pxi" Modified: trunk/pysoy/src/transports/Transport.pxi =================================================================== --- trunk/pysoy/src/transports/Transport.pxi 2008-02-19 15:58:32 UTC (rev 945) +++ trunk/pysoy/src/transports/Transport.pxi 2008-02-19 16:05:57 UTC (rev 946) @@ -17,16 +17,13 @@ # # $Id$ -cimport soy.textures - -cdef class Transport : +cdef class Transport (soy._internals.Loopable) : '''PySoy Transport This class provides the basic data stream parsing for all transports. ''' def __init__(self, path, loop=1, *args, **keywords) : cdef char _magic[4] - cdef soy._internals.Children _transports self._objs = <Stored *> py.PyMem_Malloc(sizeof(Stored) * 4) self._mobj = 4 self._dict = {} @@ -40,37 +37,22 @@ else : raise TypeError('unsupported soy version %d' % _magic[3]) elif _magic[:4] == 'OggS' : - self._loop = loop + self._oggLoop = loop self._headOgg() else : self._vers = -10 raise TypeError('unsupported file type') - - # This is a hack, coreloop must have _transports to process files - _transports = <soy._internals.Children> \ - py.PyCObject_AsVoidPtr(__import__('soy._core', [], [], - ['_Transports']).__dict__['_Transports']()) - _transports.lock() - _transports.append(<void *> self) - _transports.unlock() + _transports._append(<void*> self) def __dealloc__(self) : - cdef soy._internals.Children _transports - if self._vers > -10 : - _transports = <soy._internals.Children> \ - py.PyCObject_AsVoidPtr(__import__('soy._core', [], [], - ['_Transports']).__dict__['_Transports']()) - _transports.lock() - _transports.remove(<void *> self) - _transports.unlock() + _transports._remove(<void*> self) py.PyMem_Free(self._objs) - # This is called by _coreLoop() - cdef void _coreProcess(self) : + cdef int _loop(self) : if self._mode == 0 : - return + return 1 elif self._mode == 1 : if self._vers == 0 : self._coreLoadSoy() @@ -78,6 +60,7 @@ self._coreLoadOgg() # If finished loading/saving, decref just before returning #py.Py_DECREF(self) + return 1 cdef int _initObjt(self, int _serialno, object _name, object _object) : @@ -254,7 +237,7 @@ if i >= 0 : (<soy._internals.Loadable> self._objs[i].object)._coreLoad(&_page, 0) else : - if self._loop : + if self._oggLoop : self._rewind() else : self._mode = 0 Modified: trunk/pysoy/src/transports/soy.transports.pxd =================================================================== --- trunk/pysoy/src/transports/soy.transports.pxd 2008-02-19 15:58:32 UTC (rev 945) +++ trunk/pysoy/src/transports/soy.transports.pxd 2008-02-19 16:05:57 UTC (rev 946) @@ -30,7 +30,7 @@ void *object -cdef class Transport : +cdef class Transport (soy._internals.Loopable) : cdef Stored *_objs cdef object _dict cdef int _mobj @@ -38,11 +38,10 @@ cdef int _vers # <-9=error, -1=empty, 0=ogg, >0=soy cdef int _mode # 0 = idle, 1 = load, 2 = save # for Ogg - cdef int _loop + cdef int _oggLoop cdef ogg.ogg_sync_state _sync # # General Functions - cdef void _coreProcess(self) cdef int _initObjt(self, int, object, object) cdef int _findName(self, char*, unsigned char) cdef int _findSrno(self, int) Modified: trunk/pysoy/src/transports/soy.transports.pyx =================================================================== --- trunk/pysoy/src/transports/soy.transports.pyx 2008-02-19 15:58:32 UTC (rev 945) +++ trunk/pysoy/src/transports/soy.transports.pyx 2008-02-19 16:05:57 UTC (rev 946) @@ -23,5 +23,10 @@ 'by '+'$Author$'[9:-2] __version__ = 'Trunk (r'+'$Rev$'[6:-2]+')' +cimport soy.textures + +cdef soy._internals.LoopThread _transports +_transports = soy._internals.LoopThread('TransportLoop') + include "Transport.pxi" include "File.pxi" _______________________________________________ PySoy-SVN mailing list PySoy-SVN@pysoy.org http://www.pysoy.org/mailman/listinfo/pysoy-svn