forked from pcraston/pyxmlsec
-
Notifications
You must be signed in to change notification settings - Fork 4
/
wrap_objs.h
65 lines (50 loc) · 2.16 KB
/
wrap_objs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef __PYXMLSEC_WRAP_OBJS_H__
#define __PYXMLSEC_WRAP_OBJS_H__
#undef _POSIX_C_SOURCE
#include <Python.h>
#include <libxml/xpath.h>
#include <libxml/xmlmemory.h>
#include <xmlsec/xmlsec.h>
typedef struct {
PyObject_HEAD
xmlDocPtr obj;
} xmlDocPtr_object;
typedef struct {
PyObject_HEAD
xmlNodePtr obj;
} xmlNodePtr_object;
typedef struct {
PyObject_HEAD
xmlOutputBufferPtr obj;
} xmlOutputBufferPtr_object;
typedef struct {
PyObject_HEAD
xmlNodeSetPtr obj;
} xmlNodeSetPtr_object;
typedef struct {
PyObject_HEAD
xmlSecPtr obj;
} xmlSecPtr_object;
/* Functions to wrap LibXML Python objects -> LibXML C objects */
#define xmlDocPtr_get(v) (((v) == Py_None) ? NULL : (((xmlDocPtr_object *)(PyObject_GetAttr(v, PyString_FromString("_o"))))->obj))
#define xmlNodePtr_get(v) (((v) == Py_None) ? NULL : (((xmlNodePtr_object *)(PyObject_GetAttr(v, PyString_FromString("_o"))))->obj))
#define xmlNodeSetPtr_get(v) (((v) == Py_None) ? NULL : (((xmlNodeSetPtr_object *)(PyObject_GetAttr(v, PyString_FromString("_o"))))->obj))
#define xmlOutputBufferPtr_get(v) (((v) == Py_None) ? NULL : (((xmlOutputBufferPtr_object *)(PyObject_GetAttr(v, PyString_FromString("_o"))))->obj))
/* Functions to wrap XMLSec Python objects -> XMLSec C objects */
#define xmlSecPtr_get(v) (((v) == Py_None) ? NULL : (((xmlSecPtr_object *)(PyObject_GetAttr(v, PyString_FromString("_o"))))->obj))
/* Functions to wrap Python objects -> C objects */
#define PythonFile_get(v) (((v) == Py_None) ? NULL : (PyFile_Check(v) ? (PyFile_AsFile(v)) : stdout))
xmlChar **PythonStringList_get(PyObject *list_obj);
PyObject *wrap_int(int val);
PyObject *wrap_charPtr(char *str);
PyObject *wrap_charPtrConst(const char *str);
PyObject *wrap_xmlCharPtr(xmlChar *str);
PyObject *wrap_xmlCharPtrConst(const xmlChar *str);
PyObject *wrap_xmlDocPtr(xmlDocPtr doc);
PyObject *wrap_xmlNodePtr(xmlNodePtr node);
PyObject *wrap_xmlNodeSetPtr(xmlNodeSetPtr nset);
PyObject *wrap_xmlOutputBufferPtr(xmlOutputBufferPtr buf);
PyObject *wrap_xmlSecPtr(xmlSecPtr ptr);
PyObject *wrap_xmlSecBytePtr(xmlSecByte *str);
PyObject *wrap_xmlSecBytePtrConst(const xmlSecByte *str);
#endif /* __PYXMLSEC_WRAP_OBJS_H__ */