Imported Upstream version 0.6
[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 #    cdef char * _getindex( self, int idx )
55
56     cdef take( self, char * buffer, size_t nbytes )
57     cdef present( self, char * buffer, size_t nbytes )
58     cdef copy( self, char * buffer, size_t nbytes )
59     cdef update( self, char * buffer, size_t nbytes )
60
61 cdef class GTFProxy( TupleProxy) :
62
63     cdef:
64         char * contig
65         char * source
66         char * feature
67         uint32_t start
68         uint32_t end
69         char * score
70         char * strand
71         char * frame
72         char * attributes
73         cdef bint hasOwnAttributes
74
75     cdef int getMaxFields( self, size_t nbytes )
76     cdef update( self, char * buffer, size_t nbytes )
77
78 cdef class NamedTupleProxy( TupleProxy) :
79     pass
80
81 cdef class BedProxy( NamedTupleProxy) :
82
83     cdef:
84         char * contig
85         uint32_t start
86         uint32_t end
87         int bedfields
88
89     cdef int getMaxFields( self, size_t nbytes )
90     cdef update( self, char * buffer, size_t nbytes )
91
92 cdef class VCFProxy( NamedTupleProxy) :
93
94     cdef:
95         char * contig
96         uint32_t pos
97
98     cdef update( self, char * buffer, size_t nbytes )