author | Tero Marttila <terom@fixme.fi> |
Mon, 17 Aug 2009 01:29:31 +0300 | |
changeset 20 | 0e4933d5862e |
parent 16 | 24ce1035b338 |
child 22 | f6e8d5e37998 |
permissions | -rw-r--r-- |
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 |
|
74fde84264b1
broke Cython with this package magic
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
26 |
# raise OSError with errno |
74fde84264b1
broke Cython with this package magic
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
27 |
# XXX: doesn't do anything with func |
74fde84264b1
broke Cython with this package magic
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
28 |
cdef int raise_errno (char *func) except -1 |
74fde84264b1
broke Cython with this package magic
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
29 |