qmsk/net/py.pxd
author Tero Marttila <terom@fixme.fi>
Mon, 17 Aug 2009 00:45:58 +0300
changeset 16 24ce1035b338
parent 14 c44754cc1ffe
child 20 0e4933d5862e
permissions -rw-r--r--
sockbuf stuff and fully implement recvmsg
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" :
16
24ce1035b338 sockbuf stuff and fully implement recvmsg
Tero Marttila <terom@fixme.fi>
parents: 14
diff changeset
     4
    ctypedef struct PyObject :
7
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
16
24ce1035b338 sockbuf stuff and fully implement recvmsg
Tero Marttila <terom@fixme.fi>
parents: 14
diff changeset
     7
    ## refcounting
24ce1035b338 sockbuf stuff and fully implement recvmsg
Tero Marttila <terom@fixme.fi>
parents: 14
diff changeset
     8
    void Py_XDECREF (PyObject *obj)
24ce1035b338 sockbuf stuff and fully implement recvmsg
Tero Marttila <terom@fixme.fi>
parents: 14
diff changeset
     9
7
74fde84264b1 broke Cython with this package magic
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    10
    ## string stuff
14
c44754cc1ffe some recv magic, still no PyString_Resize, though
Tero Marttila <terom@fixme.fi>
parents: 11
diff changeset
    11
    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
    12
16
24ce1035b338 sockbuf stuff and fully implement recvmsg
Tero Marttila <terom@fixme.fi>
parents: 14
diff changeset
    13
    PyObject* PyString_FromStringAndSize (char *v, ssize_t len)
24ce1035b338 sockbuf stuff and fully implement recvmsg
Tero Marttila <terom@fixme.fi>
parents: 14
diff changeset
    14
24ce1035b338 sockbuf stuff and fully implement recvmsg
Tero Marttila <terom@fixme.fi>
parents: 14
diff changeset
    15
    # no error checking
24ce1035b338 sockbuf stuff and fully implement recvmsg
Tero Marttila <terom@fixme.fi>
parents: 14
diff changeset
    16
    ssize_t PyString_GET_SIZE (PyObject *str)
24ce1035b338 sockbuf stuff and fully implement recvmsg
Tero Marttila <terom@fixme.fi>
parents: 14
diff changeset
    17
    char* PyString_AS_STRING (PyObject *str)
24ce1035b338 sockbuf stuff and fully implement recvmsg
Tero Marttila <terom@fixme.fi>
parents: 14
diff changeset
    18
14
c44754cc1ffe some recv magic, still no PyString_Resize, though
Tero Marttila <terom@fixme.fi>
parents: 11
diff changeset
    19
    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
    20
    
74fde84264b1 broke Cython with this package magic
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    21
    ## except setting
74fde84264b1 broke Cython with this package magic
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    22
    PyObject* PyErr_SetFromErrno (PyObject *type)
74fde84264b1 broke Cython with this package magic
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    23
74fde84264b1 broke Cython with this package magic
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    24
    PyObject *PyExc_OSError
74fde84264b1 broke Cython with this package magic
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    25
    
14
c44754cc1ffe some recv magic, still no PyString_Resize, though
Tero Marttila <terom@fixme.fi>
parents: 11
diff changeset
    26
## custom haxes
c44754cc1ffe some recv magic, still no PyString_Resize, though
Tero Marttila <terom@fixme.fi>
parents: 11
diff changeset
    27
#cdef extern from "_py.c" :
c44754cc1ffe some recv magic, still no PyString_Resize, though
Tero Marttila <terom@fixme.fi>
parents: 11
diff changeset
    28
#    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
    29
7
74fde84264b1 broke Cython with this package magic
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    30
# raise OSError with errno
74fde84264b1 broke Cython with this package magic
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    31
# XXX: doesn't do anything with func
74fde84264b1 broke Cython with this package magic
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    32
cdef int raise_errno (char *func) except -1
74fde84264b1 broke Cython with this package magic
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    33