Imported Upstream version 0.7
[pysam.git] / pysam / TabProxies.pxd
1 cdef extern from "stdlib.h":
2     void free(void *)
3     void *malloc(size_t)       
4     void *calloc(size_t,size_t)
5     void *realloc(void *,size_t)
6     int c_abs "abs" (int)  
7     int c_abs "abs" (int)
8     int atoi( char *nptr)
9     long atol( char *nptr)
10     double atof( char *nptr)
11
12 cdef extern from "Python.h":
13     ctypedef struct FILE
14     char *fgets(char *str, int size, FILE *ifile)
15     int feof(FILE *stream)
16     size_t strlen(char *s)
17     size_t getline(char **lineptr, size_t *n, FILE *stream)
18     char *strstr(char *, char *)
19     char *strchr(char *string, int c)
20     int fileno(FILE *stream)
21
22 cdef extern from "string.h":
23   int strcmp(char *s1, char *s2)
24   int strncmp(char *s1,char *s2,size_t len)
25   char *strcpy(char *dest,char *src)
26   char *strncpy(char *dest,char *src, size_t len)
27   char *strdup(char *)
28   char *strcat(char *,char *)
29   size_t strlen(char *s)
30   int memcmp( void * s1, void *s2, size_t len )
31   void *memcpy(void *dest, void *src, size_t n)
32   void *memchr(void *s, int c, size_t n)
33
34 cdef extern from "stdint.h":
35   ctypedef int int64_t
36   ctypedef int int32_t
37   ctypedef int uint32_t
38   ctypedef int uint8_t
39   ctypedef int uint64_t
40
41 cdef class TupleProxy:
42
43     cdef:
44         char * data
45         char ** fields
46         int nfields
47         int index
48         int nbytes
49         int offset
50         cdef bint is_modified
51
52     cdef int getMaxFields( self, size_t nbytes )
53 #    cdef char * _getindex( self, int idx )
54
55     cdef take( self, char * buffer, size_t nbytes )
56     cdef present( self, char * buffer, size_t nbytes )
57     cdef copy( self, char * buffer, size_t nbytes )
58     cdef update( self, char * buffer, size_t nbytes )
59
60 cdef class GTFProxy( TupleProxy) :
61
62     cdef:
63         char * _attributes
64         cdef bint hasOwnAttributes
65
66     cdef int getMaxFields( self, size_t nbytes )
67     cdef char * getAttributes( self )
68
69 cdef class NamedTupleProxy( TupleProxy) :
70     pass
71
72 cdef class BedProxy( NamedTupleProxy) :
73
74     cdef:
75         char * contig
76         uint32_t start
77         uint32_t end
78         int bedfields
79
80     cdef int getMaxFields( self, size_t nbytes )
81     cdef update( self, char * buffer, size_t nbytes )
82
83 cdef class VCFProxy( NamedTupleProxy) :
84
85     cdef:
86         char * contig
87         uint32_t pos
88
89     cdef update( self, char * buffer, size_t nbytes )