VirtualBox

source: vbox/trunk/src/libs/libxml2-2.12.6/python/libxml_wrap.h@ 104106

Last change on this file since 104106 was 104106, checked in by vboxsync, 11 months ago

libxml2-2.9.14: Applied and adjusted our libxml2 changes to 2.9.14. bugref:10640

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

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