Fix EIB_Cache_Read and EIB_Cache_Read_Sync in swig wrapper
[bcusdk.git] / contrib / swig / eibclient.i
blob5dc8bc7af561f65d8d2a1d23107c4a2fb8cb0b39
1 /* SWIG interface spec for eibclient */
2 /* */
3 /* has all eibclient interfaces in */
4 /* (Martin's code THAT clean!) but */
5 /* you will realize, some of them */
6 /* cannot be called from Python */
7 /* unless you SWIG code around them */
8 /* analogous to the eibgetbusmonitorpacket */
9 /* I already did. Not hard. */
13 EIBD client library
14 Copyright (C) 2006 Tony Przygienda, Z2 GmbH
16 This program is free software; you can redistribute it and/or modify
17 it under the terms of the GNU General Public License as published by
18 the Free Software Foundation; either version 2 of the License, or
19 (at your option) any later version.
21 In addition to the permissions in the GNU General Public License,
22 you may link the compiled version of this file into combinations
23 with other programs, and distribute those combinations without any
24 restriction coming from the use of this file. (The General Public
25 License restrictions do apply in other respects; for example, they
26 cover modification of the file, and distribution when not linked into
27 a combine executable.)
29 This program is distributed in the hope that it will be useful,
30 but WITHOUT ANY WARRANTY; without even the implied warranty of
31 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 GNU General Public License for more details.
34 You should have received a copy of the GNU General Public License
35 along with this program; if not, write to the Free Software
36 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
39 %module eibclient
41 #include "eibtypes.h"
42 #include "eibclient.h"
49 %include exception.i
51 %typemap(in, numinputs=0) (int maxlen, uint8_t *buf) (unsigned char temp[1024])
53 $1 = sizeof(temp);
54 $2 = temp;
57 %typemap(in, numinputs=0) (int max_len, uint8_t *buf) (unsigned char temp[1024])
59 $1 = sizeof(temp);
60 $2 = temp;
63 %typemap(in, numinputs=1) (int len, uint8_t * data)
65 $1 = PyString_Size($input);
66 $2 = PyString_AsString($input);
69 %typemap(argout) (int maxlen, uint8_t *buf)
71 if (result < 0) { /* Check for I/O error */
72 PyErr_SetFromErrno(PyExc_IOError);
73 return NULL;
75 PyObject *o;
76 o = PyString_FromStringAndSize((char *)$2,result);
77 if ((!$result) || ($result == Py_None)) {
78 $result = o;
80 else {
81 if (!PyList_Check($result)) {
82 PyObject *o2 = $result;
83 $result = PyList_New(0);
84 PyList_Append($result,o2);
85 Py_XDECREF(o2);
87 PyList_Append($result,o);
88 Py_XDECREF(o);
93 %typemap(argout) (int max_len, uint8_t *buf)
95 if (result < 0) { /* Check for I/O error */
96 PyErr_SetFromErrno(PyExc_IOError);
97 return NULL;
99 PyObject *o;
100 o = PyString_FromStringAndSize((char *)$2,result);
101 if ((!$result) || ($result == Py_None)) {
102 $result = o;
104 else {
105 if (!PyList_Check($result)) {
106 PyObject *o2 = $result;
107 $result = PyList_New(0);
108 PyList_Append($result,o2);
109 Py_XDECREF(o2);
111 PyList_Append($result,o);
112 Py_XDECREF(o);
116 %typemap(in, numinputs=0) (eibaddr_t *OUTPUT) (eibaddr_t temp)
118 $1 = &temp;
121 %typemap(argout) (eibaddr_t *OUTPUT) {
122 PyObject *o;
123 o = PyInt_FromLong((long) *$1);
124 if ((!$result) || ($result == Py_None)) {
125 $result = o;
127 else {
128 if (!PyList_Check($result)) {
129 PyObject *o2 = $result;
130 $result = PyList_New(0);
131 PyList_Append($result,o2);
132 Py_XDECREF(o2);
134 PyList_Append($result,o);
135 Py_XDECREF(o);
139 %typemap(in) (eibaddr_t INPUT) {
140 $1 = ($type) PyInt_AsLong($input);
143 %typemap(in) (uint16_t age) {
144 $1 = ($type) PyInt_AsLong($input);
147 %exception {
148 Py_BEGIN_ALLOW_THREADS
149 $function
150 Py_END_ALLOW_THREADS
153 %apply eibaddr_t *OUTPUT { eibaddr_t *src };
154 %apply eibaddr_t *OUTPUT { eibaddr_t *dest };
155 %apply eibaddr_t INPUT { eibaddr_t dest };
157 %include "eibtypes.h"
158 #define __BEGIN_DECLS
159 #define __END_DECLS
160 %include "eibclient.h"
163 %module(package="eibclient") xrc