Imported Upstream version 0.5
[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     FILE* PyFile_AsFile(object)
15     char *fgets(char *str, int size, FILE *ifile)
16     int feof(FILE *stream)
17     size_t strlen(char *s)
18     size_t getline(char **lineptr, size_t *n, FILE *stream)
19     char *strstr(char *, char *)
20     char *strchr(char *string, int c)
21     int fileno(FILE *stream)
22
23 cdef extern from "string.h":
24   int strcmp(char *s1, char *s2)
25   int strncmp(char *s1,char *s2,size_t len)
26   char *strcpy(char *dest,char *src)
27   char *strncpy(char *dest,char *src, size_t len)
28   char *strdup(char *)
29   char *strcat(char *,char *)
30   size_t strlen(char *s)
31   int memcmp( void * s1, void *s2, size_t len )
32   void *memcpy(void *dest, void *src, size_t n)
33   void *memchr(void *s, int c, size_t n)
34
35 cdef extern from "stdint.h":
36   ctypedef int int64_t
37   ctypedef int int32_t
38   ctypedef int uint32_t
39   ctypedef int uint8_t
40   ctypedef int uint64_t
41
42 cdef class TupleProxy:
43
44     cdef:
45         char * data
46         char ** fields
47         int nfields
48         int index
49         int nbytes
50         int offset
51         cdef bint is_modified
52
53     cdef int getMaxFields( self, size_t nbytes )
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 * contig
64         char * source
65         char * feature
66         uint32_t start
67         uint32_t end
68         char * score
69         char * strand
70         char * frame
71         char * attributes
72         cdef bint hasOwnAttributes
73
74     cdef int getMaxFields( self, size_t nbytes )
75     cdef update( self, char * buffer, size_t nbytes )
76
77 cdef class NamedTupleProxy( TupleProxy) :
78     pass
79
80 cdef class BedProxy( NamedTupleProxy) :
81
82     cdef:
83         char * contig
84         uint32_t start
85         uint32_t end
86         int bedfields
87
88     cdef int getMaxFields( self, size_t nbytes )
89     cdef update( self, char * buffer, size_t nbytes )
90
91 cdef class VCFProxy( NamedTupleProxy) :
92
93     cdef:
94         char * contig
95         uint32_t pos
96
97     cdef update( self, char * buffer, size_t nbytes )