From feaf929a788f349259fd32ca452595387756aa13 Mon Sep 17 00:00:00 2001 From: Martin Koegler Date: Wed, 16 Jan 2008 19:58:17 +0100 Subject: [PATCH] Fix EIB_Cache_Read and EIB_Cache_Read_Sync in swig wrapper Signed-off-by: Filip Vancraenbroeck Signed-off-by: Martin Koegler --- contrib/swig/eibclient.i | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/contrib/swig/eibclient.i b/contrib/swig/eibclient.i index f78b81e..5dc8bc7 100644 --- a/contrib/swig/eibclient.i +++ b/contrib/swig/eibclient.i @@ -54,6 +54,12 @@ $2 = temp; } +%typemap(in, numinputs=0) (int max_len, uint8_t *buf) (unsigned char temp[1024]) +{ + $1 = sizeof(temp); + $2 = temp; +} + %typemap(in, numinputs=1) (int len, uint8_t * data) { $1 = PyString_Size($input); @@ -83,6 +89,30 @@ } } + +%typemap(argout) (int max_len, uint8_t *buf) +{ + if (result < 0) { /* Check for I/O error */ + PyErr_SetFromErrno(PyExc_IOError); + return NULL; + } + PyObject *o; + o = PyString_FromStringAndSize((char *)$2,result); + if ((!$result) || ($result == Py_None)) { + $result = o; + } + else { + if (!PyList_Check($result)) { + PyObject *o2 = $result; + $result = PyList_New(0); + PyList_Append($result,o2); + Py_XDECREF(o2); + } + PyList_Append($result,o); + Py_XDECREF(o); + } +} + %typemap(in, numinputs=0) (eibaddr_t *OUTPUT) (eibaddr_t temp) { $1 = &temp; @@ -110,6 +140,10 @@ $1 = ($type) PyInt_AsLong($input); } +%typemap(in) (uint16_t age) { + $1 = ($type) PyInt_AsLong($input); +} + %exception { Py_BEGIN_ALLOW_THREADS $function -- 2.11.4.GIT