qmsk/net/py.pxd
author Tero Marttila <terom@fixme.fi>
Sun, 16 Aug 2009 23:32:00 +0300
changeset 14 c44754cc1ffe
parent 11 7ae92c2b433f
child 16 24ce1035b338
permissions -rw-r--r--
some recv magic, still no PyString_Resize, though
14
c44754cc1ffe some recv magic, still no PyString_Resize, though
Tero Marttila <terom@fixme.fi>
parents: 11
diff changeset
     1
from qmsk.net.libc cimport ssize_t, errno
7
74fde84264b1 broke Cython with this package magic
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     2
74fde84264b1 broke Cython with this package magic
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     3
cdef extern from "Python.h" :
74fde84264b1 broke Cython with this package magic
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     4
    struct PyObject :
74fde84264b1 broke Cython with this package magic
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     5
        pass
74fde84264b1 broke Cython with this package magic
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     6
74fde84264b1 broke Cython with this package magic
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     7
    ## string stuff
14
c44754cc1ffe some recv magic, still no PyString_Resize, though
Tero Marttila <terom@fixme.fi>
parents: 11
diff changeset
     8
    int PyObject_AsCharBuffer (object obj, char **buf, ssize_t *len) except -1
c44754cc1ffe some recv magic, still no PyString_Resize, though
Tero Marttila <terom@fixme.fi>
parents: 11
diff changeset
     9
c44754cc1ffe some recv magic, still no PyString_Resize, though
Tero Marttila <terom@fixme.fi>
parents: 11
diff changeset
    10
    object PyString_FromStringAndSize (char *v, ssize_t len)
c44754cc1ffe some recv magic, still no PyString_Resize, though
Tero Marttila <terom@fixme.fi>
parents: 11
diff changeset
    11
    char* PyString_AS_STRING (object) except NULL
c44754cc1ffe some recv magic, still no PyString_Resize, though
Tero Marttila <terom@fixme.fi>
parents: 11
diff changeset
    12
    int _PyString_Resize (PyObject **string, ssize_t newsize) except -1
7
74fde84264b1 broke Cython with this package magic
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    13
    
74fde84264b1 broke Cython with this package magic
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    14
    ## except setting
74fde84264b1 broke Cython with this package magic
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    15
    PyObject* PyErr_SetFromErrno (PyObject *type)
74fde84264b1 broke Cython with this package magic
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    16
74fde84264b1 broke Cython with this package magic
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    17
    PyObject *PyExc_OSError
74fde84264b1 broke Cython with this package magic
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    18
    
14
c44754cc1ffe some recv magic, still no PyString_Resize, though
Tero Marttila <terom@fixme.fi>
parents: 11
diff changeset
    19
## custom haxes
c44754cc1ffe some recv magic, still no PyString_Resize, though
Tero Marttila <terom@fixme.fi>
parents: 11
diff changeset
    20
#cdef extern from "_py.c" :
c44754cc1ffe some recv magic, still no PyString_Resize, though
Tero Marttila <terom@fixme.fi>
parents: 11
diff changeset
    21
#    object py_string_resize (object string, ssize_t new_size)
c44754cc1ffe some recv magic, still no PyString_Resize, though
Tero Marttila <terom@fixme.fi>
parents: 11
diff changeset
    22
7
74fde84264b1 broke Cython with this package magic
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    23
# raise OSError with errno
74fde84264b1 broke Cython with this package magic
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    24
# XXX: doesn't do anything with func
74fde84264b1 broke Cython with this package magic
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    25
cdef int raise_errno (char *func) except -1
74fde84264b1 broke Cython with this package magic
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    26