2015-07-22 23:10:36 +00:00
|
|
|
from libc.stdio cimport fopen, fclose, fread, fwrite, FILE
|
|
|
|
from cymem.cymem cimport Pool
|
|
|
|
|
|
|
|
cdef class CFile:
|
|
|
|
cdef FILE* fp
|
2017-05-17 10:04:50 +00:00
|
|
|
cdef unsigned char* data
|
|
|
|
cdef int is_open
|
2017-03-07 19:24:37 +00:00
|
|
|
cdef Pool mem
|
|
|
|
cdef int size # For compatibility with subclass
|
2017-05-17 10:04:50 +00:00
|
|
|
cdef int i # For compatibility with subclass
|
2017-03-07 19:24:37 +00:00
|
|
|
cdef int _capacity # For compatibility with subclass
|
|
|
|
|
|
|
|
cdef int read_into(self, void* dest, size_t number, size_t elem_size) except -1
|
|
|
|
|
|
|
|
cdef int write_from(self, void* src, size_t number, size_t elem_size) except -1
|
|
|
|
|
|
|
|
cdef void* alloc_read(self, Pool mem, size_t number, size_t elem_size) except *
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-05-17 10:04:50 +00:00
|
|
|
cdef class StringCFile:
|
2017-03-07 19:24:37 +00:00
|
|
|
cdef unsigned char* data
|
2017-05-17 10:04:50 +00:00
|
|
|
cdef int is_open
|
|
|
|
cdef Pool mem
|
|
|
|
cdef int size # For compatibility with subclass
|
|
|
|
cdef int i # For compatibility with subclass
|
|
|
|
cdef int _capacity # For compatibility with subclass
|
2015-07-22 23:10:36 +00:00
|
|
|
|
|
|
|
cdef int read_into(self, void* dest, size_t number, size_t elem_size) except -1
|
|
|
|
|
|
|
|
cdef int write_from(self, void* src, size_t number, size_t elem_size) except -1
|
|
|
|
|
|
|
|
cdef void* alloc_read(self, Pool mem, size_t number, size_t elem_size) except *
|