Author: ArcRiley
Date: 2007-07-05 19:59:10 -0400 (Thu, 05 Jul 2007)
New Revision: 373
Modified:
trunk/pysoy/include/stdio.pxd
trunk/pysoy/src/transports/File.pxi
trunk/pysoy/src/transports/Transport.pxi
trunk/pysoy/src/transports/soy.transports.pxd
Log:
#264 (finishing off soy.transports.File)
Modified: trunk/pysoy/include/stdio.pxd
===================================================================
--- trunk/pysoy/include/stdio.pxd 2007-07-05 23:10:43 UTC (rev 372)
+++ trunk/pysoy/include/stdio.pxd 2007-07-05 23:59:10 UTC (rev 373)
@@ -18,6 +18,10 @@
# $Id$
cdef extern from "stdio.h" :
+ ctypedef enum :
+ SEEK_SET
+ SEEK_CUR
+ SEEK_END
int printf ( char*, ... )
void *fopen ( char*, char* )
int fclose ( void* )
Modified: trunk/pysoy/src/transports/File.pxi
===================================================================
--- trunk/pysoy/src/transports/File.pxi 2007-07-05 23:10:43 UTC (rev 372)
+++ trunk/pysoy/src/transports/File.pxi 2007-07-05 23:59:10 UTC (rev 373)
@@ -29,17 +29,32 @@
cdef int _read(self, char *_buffer, int _len) :
- cdef int _ret
- if not self._file :
- return 0
- _ret = stdio.fread(_buffer, 1, _len, self._file)
- if _ret == 0 :
- stdio.fclose(self._file)
- self._file = NULL
- return _ret
+ return stdio.fread(_buffer, 1, _len, self._file)
cdef int _write(self, char *_buffer, int _len) :
return stdio.fwrite(_buffer, 1, _len, self._file)
+ cdef int _goto(self, long _offset) :
+ if _offset >= 0 :
+ return stdio.fseek(self._file, _offset, stdio.SEEK_SET)
+ else :
+ return stdio.fseek(self._file, _offset, stdio.SEEK_END)
+
+
+ cdef int _seek(self, long _offset) :
+ return stdio.fseek(self._file, _offset, stdio.SEEK_CUR)
+
+
+ cdef long _tell(self) :
+ return stdio.ftell(self._file)
+
+
+ cdef void _rewind(self) :
+ stdio.rewind(self._file)
+
+
+ cdef void _close(self) :
+ stdio.fclose(self._file)
+ self._file = NULL
Modified: trunk/pysoy/src/transports/Transport.pxi
===================================================================
--- trunk/pysoy/src/transports/Transport.pxi 2007-07-05 23:10:43 UTC (rev
372)
+++ trunk/pysoy/src/transports/Transport.pxi 2007-07-05 23:59:10 UTC (rev
373)
@@ -70,6 +70,26 @@
return 0
+ cdef int _goto(self, long _offset) :
+ return 0
+
+
+ cdef int _seek(self, long _offset) :
+ return 0
+
+
+ cdef long _tell(self) :
+ return 0
+
+
+ cdef void _rewind(self) :
+ return
+
+
+ cdef void _close(self) :
+ return
+
+
############################################################################
# Ogg functions
#
@@ -123,6 +143,7 @@
cdef ogg.ogg_page _page
if self._readOggPage(&_page) :
_sn = ogg.ogg_page_serialno(&_page)
+ stdio.printf('processed %d:%d\n', _sn, ogg.ogg_page_pageno(&_page))
if self._snos.has_key(_sn) :
(<soy._internals.Loadable> self._objs[self._snos[_sn]])._load(&_page)
Modified: trunk/pysoy/src/transports/soy.transports.pxd
===================================================================
--- trunk/pysoy/src/transports/soy.transports.pxd 2007-07-05 23:10:43 UTC
(rev 372)
+++ trunk/pysoy/src/transports/soy.transports.pxd 2007-07-05 23:59:10 UTC
(rev 373)
@@ -33,9 +33,14 @@
cdef void _process(self)
#
# Transport-specific functions
- cdef int _open(self, path)
- cdef int _read(self, char *_buffer, int _len)
- cdef int _write(self, char *_buffer, int _len)
+ cdef int _open (self, path)
+ cdef int _read (self, char*, int)
+ cdef int _write (self, char*, int)
+ cdef int _goto (self, long)
+ cdef int _seek (self, long)
+ cdef long _tell (self)
+ cdef void _rewind(self)
+ cdef void _close (self)
#
# Ogg functions
cdef void _headOgg(self)
_______________________________________________
PySoy-SVN mailing list
[email protected]
http://www.pysoy.org/mailman/listinfo/pysoy-svn