VirtualBox

source: vbox/trunk/src/libs/libxml2-2.9.4/python/libxml_wrap.h@ 83541

Last change on this file since 83541 was 65950, checked in by vboxsync, 8 years ago

libxml 2.9.4: fix export

  • Property svn:eol-style set to native
File size: 8.1 KB
Line 
1#include <Python.h>
2#include <libxml/tree.h>
3#include <libxml/parser.h>
4#include <libxml/parserInternals.h>
5#include <libxml/catalog.h>
6#include <libxml/threads.h>
7#include <libxml/nanoftp.h>
8#include <libxml/nanohttp.h>
9#include <libxml/uri.h>
10#include <libxml/xpath.h>
11#include <libxml/xpathInternals.h>
12#include <libxml/debugXML.h>
13#include <libxml/HTMLparser.h>
14#include <libxml/HTMLtree.h>
15#include <libxml/xinclude.h>
16#include <libxml/xpointer.h>
17#include <libxml/xmlunicode.h>
18#include <libxml/xmlregexp.h>
19#include <libxml/xmlautomata.h>
20#include <libxml/xmlreader.h>
21#ifdef LIBXML_SCHEMAS_ENABLED
22#include <libxml/relaxng.h>
23#include <libxml/xmlschemas.h>
24#endif
25
26/*
27 * for older versions of Python, we don't use PyBytes, but keep PyString
28 * and don't use Capsule but CObjects
29 */
30#if PY_VERSION_HEX < 0x02070000
31#ifndef PyBytes_Check
32#define PyBytes_Check PyString_Check
33#define PyBytes_Size PyString_Size
34#define PyBytes_AsString PyString_AsString
35#define PyBytes_AS_STRING PyString_AS_STRING
36#define PyBytes_GET_SIZE PyString_GET_SIZE
37#endif
38#ifndef PyCapsule_New
39#define PyCapsule_New PyCObject_FromVoidPtrAndDesc
40#define PyCapsule_CheckExact PyCObject_Check
41#define PyCapsule_GetPointer(o, n) PyCObject_GetDesc((o))
42#endif
43#endif
44
45/**
46 * ATTRIBUTE_UNUSED:
47 *
48 * Macro used to signal to GCC unused function parameters
49 * Repeated here since the definition is not available when
50 * compiled outside the libxml2 build tree.
51 */
52#ifdef __GNUC__
53#ifdef ATTRIBUTE_UNUSED
54#undef ATTRIBUTE_UNUSED
55#endif
56#ifndef ATTRIBUTE_UNUSED
57#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
58#endif /* ATTRIBUTE_UNUSED */
59#else
60#define ATTRIBUTE_UNUSED
61#endif
62
63#define PyxmlNode_Get(v) (((v) == Py_None) ? NULL : \
64 (((PyxmlNode_Object *)(v))->obj))
65
66typedef struct {
67 PyObject_HEAD
68 xmlNodePtr obj;
69} PyxmlNode_Object;
70
71#define PyxmlXPathContext_Get(v) (((v) == Py_None) ? NULL : \
72 (((PyxmlXPathContext_Object *)(v))->obj))
73
74typedef struct {
75 PyObject_HEAD
76 xmlXPathContextPtr obj;
77} PyxmlXPathContext_Object;
78
79#define PyxmlXPathParserContext_Get(v) (((v) == Py_None) ? NULL : \
80 (((PyxmlXPathParserContext_Object *)(v))->obj))
81
82typedef struct {
83 PyObject_HEAD
84 xmlXPathParserContextPtr obj;
85} PyxmlXPathParserContext_Object;
86
87#define PyparserCtxt_Get(v) (((v) == Py_None) ? NULL : \
88 (((PyparserCtxt_Object *)(v))->obj))
89
90typedef struct {
91 PyObject_HEAD
92 xmlParserCtxtPtr obj;
93} PyparserCtxt_Object;
94
95#define PyValidCtxt_Get(v) (((v) == Py_None) ? NULL : \
96 (((PyValidCtxt_Object *)(v))->obj))
97
98typedef struct {
99 PyObject_HEAD
100 xmlValidCtxtPtr obj;
101} PyValidCtxt_Object;
102
103#define Pycatalog_Get(v) (((v) == Py_None) ? NULL : \
104 (((Pycatalog_Object *)(v))->obj))
105
106typedef struct {
107 PyObject_HEAD
108 xmlCatalogPtr obj;
109} Pycatalog_Object;
110
111#ifdef LIBXML_REGEXP_ENABLED
112#define PyxmlReg_Get(v) (((v) == Py_None) ? NULL : \
113 (((PyxmlReg_Object *)(v))->obj))
114
115typedef struct {
116 PyObject_HEAD
117 xmlRegexpPtr obj;
118} PyxmlReg_Object;
119#endif /* LIBXML_REGEXP_ENABLED */
120
121#ifdef LIBXML_READER_ENABLED
122#define PyxmlTextReader_Get(v) (((v) == Py_None) ? NULL : \
123 (((PyxmlTextReader_Object *)(v))->obj))
124
125typedef struct {
126 PyObject_HEAD
127 xmlTextReaderPtr obj;
128} PyxmlTextReader_Object;
129
130#define PyxmlTextReaderLocator_Get(v) (((v) == Py_None) ? NULL : \
131 (((PyxmlTextReaderLocator_Object *)(v))->obj))
132
133typedef struct {
134 PyObject_HEAD
135 xmlTextReaderLocatorPtr obj;
136} PyxmlTextReaderLocator_Object;
137#endif
138
139#define PyURI_Get(v) (((v) == Py_None) ? NULL : \
140 (((PyURI_Object *)(v))->obj))
141
142typedef struct {
143 PyObject_HEAD
144 xmlErrorPtr obj;
145} PyError_Object;
146
147#define PyError_Get(v) (((v) == Py_None) ? NULL : \
148 (((PyError_Object *)(v))->obj))
149
150typedef struct {
151 PyObject_HEAD
152 xmlOutputBufferPtr obj;
153} PyoutputBuffer_Object;
154
155#define PyoutputBuffer_Get(v) (((v) == Py_None) ? NULL : \
156 (((PyoutputBuffer_Object *)(v))->obj))
157
158typedef struct {
159 PyObject_HEAD
160 xmlParserInputBufferPtr obj;
161} PyinputBuffer_Object;
162
163#define PyinputBuffer_Get(v) (((v) == Py_None) ? NULL : \
164 (((PyinputBuffer_Object *)(v))->obj))
165
166typedef struct {
167 PyObject_HEAD
168 xmlURIPtr obj;
169} PyURI_Object;
170
171/* FILE * have their own internal representation */
172#if PY_MAJOR_VERSION >= 3
173FILE *libxml_PyFileGet(PyObject *f);
174void libxml_PyFileRelease(FILE *f);
175#define PyFile_Get(v) (((v) == Py_None) ? NULL : libxml_PyFileGet(v))
176#define PyFile_Release(f) libxml_PyFileRelease(f)
177#else
178#define PyFile_Get(v) (((v) == Py_None) ? NULL : \
179 (PyFile_Check(v) ? (PyFile_AsFile(v)) : stdout))
180#define PyFile_Release(f)
181#endif
182
183#ifdef LIBXML_SCHEMAS_ENABLED
184typedef struct {
185 PyObject_HEAD
186 xmlRelaxNGPtr obj;
187} PyrelaxNgSchema_Object;
188
189#define PyrelaxNgSchema_Get(v) (((v) == Py_None) ? NULL : \
190 (((PyrelaxNgSchema_Object *)(v))->obj))
191
192typedef struct {
193 PyObject_HEAD
194 xmlRelaxNGParserCtxtPtr obj;
195} PyrelaxNgParserCtxt_Object;
196
197#define PyrelaxNgParserCtxt_Get(v) (((v) == Py_None) ? NULL : \
198 (((PyrelaxNgParserCtxt_Object *)(v))->obj))
199
200typedef struct {
201 PyObject_HEAD
202 xmlRelaxNGValidCtxtPtr obj;
203} PyrelaxNgValidCtxt_Object;
204
205#define PyrelaxNgValidCtxt_Get(v) (((v) == Py_None) ? NULL : \
206 (((PyrelaxNgValidCtxt_Object *)(v))->obj))
207
208typedef struct {
209 PyObject_HEAD
210 xmlSchemaPtr obj;
211} PySchema_Object;
212
213#define PySchema_Get(v) (((v) == Py_None) ? NULL : \
214 (((PySchema_Object *)(v))->obj))
215
216typedef struct {
217 PyObject_HEAD
218 xmlSchemaParserCtxtPtr obj;
219} PySchemaParserCtxt_Object;
220
221#define PySchemaParserCtxt_Get(v) (((v) == Py_None) ? NULL : \
222 (((PySchemaParserCtxt_Object *)(v))->obj))
223
224typedef struct {
225 PyObject_HEAD
226 xmlSchemaValidCtxtPtr obj;
227} PySchemaValidCtxt_Object;
228
229#define PySchemaValidCtxt_Get(v) (((v) == Py_None) ? NULL : \
230 (((PySchemaValidCtxt_Object *)(v))->obj))
231
232#endif /* LIBXML_SCHEMAS_ENABLED */
233
234PyObject * libxml_intWrap(int val);
235PyObject * libxml_longWrap(long val);
236PyObject * libxml_xmlCharPtrWrap(xmlChar *str);
237PyObject * libxml_constxmlCharPtrWrap(const xmlChar *str);
238PyObject * libxml_charPtrWrap(char *str);
239PyObject * libxml_constcharPtrWrap(const char *str);
240PyObject * libxml_charPtrConstWrap(const char *str);
241PyObject * libxml_xmlCharPtrConstWrap(const xmlChar *str);
242PyObject * libxml_xmlDocPtrWrap(xmlDocPtr doc);
243PyObject * libxml_xmlNodePtrWrap(xmlNodePtr node);
244PyObject * libxml_xmlAttrPtrWrap(xmlAttrPtr attr);
245PyObject * libxml_xmlNsPtrWrap(xmlNsPtr ns);
246PyObject * libxml_xmlAttributePtrWrap(xmlAttributePtr ns);
247PyObject * libxml_xmlElementPtrWrap(xmlElementPtr ns);
248PyObject * libxml_doubleWrap(double val);
249PyObject * libxml_xmlXPathContextPtrWrap(xmlXPathContextPtr ctxt);
250PyObject * libxml_xmlParserCtxtPtrWrap(xmlParserCtxtPtr ctxt);
251PyObject * libxml_xmlXPathParserContextPtrWrap(xmlXPathParserContextPtr ctxt);
252PyObject * libxml_xmlXPathObjectPtrWrap(xmlXPathObjectPtr obj);
253PyObject * libxml_xmlValidCtxtPtrWrap(xmlValidCtxtPtr valid);
254PyObject * libxml_xmlCatalogPtrWrap(xmlCatalogPtr obj);
255PyObject * libxml_xmlURIPtrWrap(xmlURIPtr uri);
256PyObject * libxml_xmlOutputBufferPtrWrap(xmlOutputBufferPtr buffer);
257PyObject * libxml_xmlParserInputBufferPtrWrap(xmlParserInputBufferPtr buffer);
258#ifdef LIBXML_REGEXP_ENABLED
259PyObject * libxml_xmlRegexpPtrWrap(xmlRegexpPtr regexp);
260#endif /* LIBXML_REGEXP_ENABLED */
261#ifdef LIBXML_READER_ENABLED
262PyObject * libxml_xmlTextReaderPtrWrap(xmlTextReaderPtr reader);
263PyObject * libxml_xmlTextReaderLocatorPtrWrap(xmlTextReaderLocatorPtr locator);
264#endif
265
266xmlXPathObjectPtr libxml_xmlXPathObjectPtrConvert(PyObject * obj);
267#ifdef LIBXML_SCHEMAS_ENABLED
268PyObject * libxml_xmlRelaxNGPtrWrap(xmlRelaxNGPtr ctxt);
269PyObject * libxml_xmlRelaxNGParserCtxtPtrWrap(xmlRelaxNGParserCtxtPtr ctxt);
270PyObject * libxml_xmlRelaxNGValidCtxtPtrWrap(xmlRelaxNGValidCtxtPtr valid);
271PyObject * libxml_xmlSchemaPtrWrap(xmlSchemaPtr ctxt);
272PyObject * libxml_xmlSchemaParserCtxtPtrWrap(xmlSchemaParserCtxtPtr ctxt);
273PyObject * libxml_xmlSchemaValidCtxtPtrWrap(xmlSchemaValidCtxtPtr valid);
274#endif /* LIBXML_SCHEMAS_ENABLED */
275PyObject * libxml_xmlErrorPtrWrap(xmlErrorPtr error);
276PyObject * libxml_xmlSchemaSetValidErrors(PyObject * self, PyObject * args);
277PyObject * libxml_xmlRegisterInputCallback(PyObject *self, PyObject *args);
278PyObject * libxml_xmlUnregisterInputCallback(PyObject *self, PyObject *args);
279PyObject * libxml_xmlNodeRemoveNsDef(PyObject * self, PyObject * args);
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette