2 * types.c: converter functions between the internal representation
3 * and the Python objects
5 * Copyright (C) 2005, 2007 Red Hat, Inc.
7 * Daniel Veillard <veillard@redhat.com>
12 /* Horrible kludge to work around even more horrible name-space pollution
13 * via Python.h. That file includes /usr/include/python2.5/pyconfig*.h,
14 * which has over 180 autoconf-style HAVE_* definitions. Shame on them. */
17 #include "libvirt_wrap.h"
20 libvirt_intWrap(int val
)
23 ret
= PyInt_FromLong((long) val
);
28 libvirt_longWrap(long val
)
31 ret
= PyInt_FromLong(val
);
36 libvirt_ulongWrap(unsigned long val
)
39 ret
= PyLong_FromLong(val
);
44 libvirt_longlongWrap(long long val
)
47 ret
= PyLong_FromUnsignedLongLong((unsigned long long) val
);
52 libvirt_charPtrWrap(char *str
)
60 ret
= PyString_FromString(str
);
66 libvirt_constcharPtrWrap(const char *str
)
74 ret
= PyString_FromString(str
);
79 libvirt_charPtrConstWrap(const char *str
)
87 ret
= PyString_FromString(str
);
92 libvirt_virDomainPtrWrap(virDomainPtr node
)
101 PyCObject_FromVoidPtrAndDesc((void *) node
, (char *) "virDomainPtr",
107 libvirt_virNetworkPtrWrap(virNetworkPtr node
)
116 PyCObject_FromVoidPtrAndDesc((void *) node
, (char *) "virNetworkPtr",
122 libvirt_virStoragePoolPtrWrap(virStoragePoolPtr node
)
131 PyCObject_FromVoidPtrAndDesc((void *) node
, (char *) "virStoragePoolPtr",
137 libvirt_virStorageVolPtrWrap(virStorageVolPtr node
)
146 PyCObject_FromVoidPtrAndDesc((void *) node
, (char *) "virStorageVolPtr",
152 libvirt_virConnectPtrWrap(virConnectPtr node
)
161 PyCObject_FromVoidPtrAndDesc((void *) node
, (char *) "virConnectPtr",
167 libvirt_virNodeDevicePtrWrap(virNodeDevicePtr node
)
176 PyCObject_FromVoidPtrAndDesc((void *) node
, (char *) "virNodeDevicePtr",
182 libvirt_virEventHandleCallbackWrap(virEventHandleCallback node
)
188 printf("%s: WARNING - Wrapping None\n", __func__
);
192 PyCObject_FromVoidPtrAndDesc((void *) node
, (char *) "virEventHandleCallback",
198 libvirt_virEventTimeoutCallbackWrap(virEventTimeoutCallback node
)
203 printf("%s: WARNING - Wrapping None\n", __func__
);
208 PyCObject_FromVoidPtrAndDesc((void *) node
, (char *) "virEventTimeoutCallback",
214 libvirt_virFreeCallbackWrap(virFreeCallback node
)
223 PyCObject_FromVoidPtrAndDesc((void *) node
, (char *) "virFreeCallback",
229 libvirt_virVoidPtrWrap(void* node
)
238 PyCObject_FromVoidPtrAndDesc((void *) node
, (char *) "void*",