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 | * ATTRIBUTE_UNUSED:
|
---|
28 | *
|
---|
29 | * Macro used to signal to GCC unused function parameters
|
---|
30 | * Repeated here since the definition is not available when
|
---|
31 | * compiled outside the libxml2 build tree.
|
---|
32 | */
|
---|
33 | #ifdef __GNUC__
|
---|
34 | #ifdef ATTRIBUTE_UNUSED
|
---|
35 | #undef ATTRIBUTE_UNUSED
|
---|
36 | #endif
|
---|
37 | #ifndef ATTRIBUTE_UNUSED
|
---|
38 | #define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
|
---|
39 | #endif /* ATTRIBUTE_UNUSED */
|
---|
40 | #else
|
---|
41 | #define ATTRIBUTE_UNUSED
|
---|
42 | #endif
|
---|
43 |
|
---|
44 | #define PyxmlNode_Get(v) (((v) == Py_None) ? NULL : \
|
---|
45 | (((PyxmlNode_Object *)(v))->obj))
|
---|
46 |
|
---|
47 | typedef struct {
|
---|
48 | PyObject_HEAD
|
---|
49 | xmlNodePtr obj;
|
---|
50 | } PyxmlNode_Object;
|
---|
51 |
|
---|
52 | #define PyxmlXPathContext_Get(v) (((v) == Py_None) ? NULL : \
|
---|
53 | (((PyxmlXPathContext_Object *)(v))->obj))
|
---|
54 |
|
---|
55 | typedef struct {
|
---|
56 | PyObject_HEAD
|
---|
57 | xmlXPathContextPtr obj;
|
---|
58 | } PyxmlXPathContext_Object;
|
---|
59 |
|
---|
60 | #define PyxmlXPathParserContext_Get(v) (((v) == Py_None) ? NULL : \
|
---|
61 | (((PyxmlXPathParserContext_Object *)(v))->obj))
|
---|
62 |
|
---|
63 | typedef struct {
|
---|
64 | PyObject_HEAD
|
---|
65 | xmlXPathParserContextPtr obj;
|
---|
66 | } PyxmlXPathParserContext_Object;
|
---|
67 |
|
---|
68 | #define PyparserCtxt_Get(v) (((v) == Py_None) ? NULL : \
|
---|
69 | (((PyparserCtxt_Object *)(v))->obj))
|
---|
70 |
|
---|
71 | typedef struct {
|
---|
72 | PyObject_HEAD
|
---|
73 | xmlParserCtxtPtr obj;
|
---|
74 | } PyparserCtxt_Object;
|
---|
75 |
|
---|
76 | #define PyValidCtxt_Get(v) (((v) == Py_None) ? NULL : \
|
---|
77 | (((PyValidCtxt_Object *)(v))->obj))
|
---|
78 |
|
---|
79 | typedef struct {
|
---|
80 | PyObject_HEAD
|
---|
81 | xmlValidCtxtPtr obj;
|
---|
82 | } PyValidCtxt_Object;
|
---|
83 |
|
---|
84 | #define Pycatalog_Get(v) (((v) == Py_None) ? NULL : \
|
---|
85 | (((Pycatalog_Object *)(v))->obj))
|
---|
86 |
|
---|
87 | typedef struct {
|
---|
88 | PyObject_HEAD
|
---|
89 | xmlCatalogPtr obj;
|
---|
90 | } Pycatalog_Object;
|
---|
91 |
|
---|
92 | #ifdef LIBXML_REGEXP_ENABLED
|
---|
93 | #define PyxmlReg_Get(v) (((v) == Py_None) ? NULL : \
|
---|
94 | (((PyxmlReg_Object *)(v))->obj))
|
---|
95 |
|
---|
96 | typedef struct {
|
---|
97 | PyObject_HEAD
|
---|
98 | xmlRegexpPtr obj;
|
---|
99 | } PyxmlReg_Object;
|
---|
100 | #endif /* LIBXML_REGEXP_ENABLED */
|
---|
101 |
|
---|
102 | #define PyxmlTextReader_Get(v) (((v) == Py_None) ? NULL : \
|
---|
103 | (((PyxmlTextReader_Object *)(v))->obj))
|
---|
104 |
|
---|
105 | typedef struct {
|
---|
106 | PyObject_HEAD
|
---|
107 | xmlTextReaderPtr obj;
|
---|
108 | } PyxmlTextReader_Object;
|
---|
109 |
|
---|
110 | #define PyxmlTextReaderLocator_Get(v) (((v) == Py_None) ? NULL : \
|
---|
111 | (((PyxmlTextReaderLocator_Object *)(v))->obj))
|
---|
112 |
|
---|
113 | typedef struct {
|
---|
114 | PyObject_HEAD
|
---|
115 | xmlTextReaderLocatorPtr obj;
|
---|
116 | } PyxmlTextReaderLocator_Object;
|
---|
117 |
|
---|
118 | #define PyURI_Get(v) (((v) == Py_None) ? NULL : \
|
---|
119 | (((PyURI_Object *)(v))->obj))
|
---|
120 |
|
---|
121 | typedef struct {
|
---|
122 | PyObject_HEAD
|
---|
123 | xmlErrorPtr obj;
|
---|
124 | } PyError_Object;
|
---|
125 |
|
---|
126 | #define PyError_Get(v) (((v) == Py_None) ? NULL : \
|
---|
127 | (((PyError_Object *)(v))->obj))
|
---|
128 |
|
---|
129 | typedef struct {
|
---|
130 | PyObject_HEAD
|
---|
131 | xmlOutputBufferPtr obj;
|
---|
132 | } PyoutputBuffer_Object;
|
---|
133 |
|
---|
134 | #define PyoutputBuffer_Get(v) (((v) == Py_None) ? NULL : \
|
---|
135 | (((PyoutputBuffer_Object *)(v))->obj))
|
---|
136 |
|
---|
137 | typedef struct {
|
---|
138 | PyObject_HEAD
|
---|
139 | xmlParserInputBufferPtr obj;
|
---|
140 | } PyinputBuffer_Object;
|
---|
141 |
|
---|
142 | #define PyinputBuffer_Get(v) (((v) == Py_None) ? NULL : \
|
---|
143 | (((PyinputBuffer_Object *)(v))->obj))
|
---|
144 |
|
---|
145 | typedef struct {
|
---|
146 | PyObject_HEAD
|
---|
147 | xmlURIPtr obj;
|
---|
148 | } PyURI_Object;
|
---|
149 |
|
---|
150 | /* FILE * have their own internal representation */
|
---|
151 | #define PyFile_Get(v) (((v) == Py_None) ? NULL : \
|
---|
152 | (PyFile_Check(v) ? (PyFile_AsFile(v)) : stdout))
|
---|
153 |
|
---|
154 | #ifdef LIBXML_SCHEMAS_ENABLED
|
---|
155 | typedef struct {
|
---|
156 | PyObject_HEAD
|
---|
157 | xmlRelaxNGPtr obj;
|
---|
158 | } PyrelaxNgSchema_Object;
|
---|
159 |
|
---|
160 | #define PyrelaxNgSchema_Get(v) (((v) == Py_None) ? NULL : \
|
---|
161 | (((PyrelaxNgSchema_Object *)(v))->obj))
|
---|
162 |
|
---|
163 | typedef struct {
|
---|
164 | PyObject_HEAD
|
---|
165 | xmlRelaxNGParserCtxtPtr obj;
|
---|
166 | } PyrelaxNgParserCtxt_Object;
|
---|
167 |
|
---|
168 | #define PyrelaxNgParserCtxt_Get(v) (((v) == Py_None) ? NULL : \
|
---|
169 | (((PyrelaxNgParserCtxt_Object *)(v))->obj))
|
---|
170 |
|
---|
171 | typedef struct {
|
---|
172 | PyObject_HEAD
|
---|
173 | xmlRelaxNGValidCtxtPtr obj;
|
---|
174 | } PyrelaxNgValidCtxt_Object;
|
---|
175 |
|
---|
176 | #define PyrelaxNgValidCtxt_Get(v) (((v) == Py_None) ? NULL : \
|
---|
177 | (((PyrelaxNgValidCtxt_Object *)(v))->obj))
|
---|
178 |
|
---|
179 | typedef struct {
|
---|
180 | PyObject_HEAD
|
---|
181 | xmlSchemaPtr obj;
|
---|
182 | } PySchema_Object;
|
---|
183 |
|
---|
184 | #define PySchema_Get(v) (((v) == Py_None) ? NULL : \
|
---|
185 | (((PySchema_Object *)(v))->obj))
|
---|
186 |
|
---|
187 | typedef struct {
|
---|
188 | PyObject_HEAD
|
---|
189 | xmlSchemaParserCtxtPtr obj;
|
---|
190 | } PySchemaParserCtxt_Object;
|
---|
191 |
|
---|
192 | #define PySchemaParserCtxt_Get(v) (((v) == Py_None) ? NULL : \
|
---|
193 | (((PySchemaParserCtxt_Object *)(v))->obj))
|
---|
194 |
|
---|
195 | typedef struct {
|
---|
196 | PyObject_HEAD
|
---|
197 | xmlSchemaValidCtxtPtr obj;
|
---|
198 | } PySchemaValidCtxt_Object;
|
---|
199 |
|
---|
200 | #define PySchemaValidCtxt_Get(v) (((v) == Py_None) ? NULL : \
|
---|
201 | (((PySchemaValidCtxt_Object *)(v))->obj))
|
---|
202 |
|
---|
203 | #endif /* LIBXML_SCHEMAS_ENABLED */
|
---|
204 |
|
---|
205 | PyObject * libxml_intWrap(int val);
|
---|
206 | PyObject * libxml_longWrap(long val);
|
---|
207 | PyObject * libxml_xmlCharPtrWrap(xmlChar *str);
|
---|
208 | PyObject * libxml_constxmlCharPtrWrap(const xmlChar *str);
|
---|
209 | PyObject * libxml_charPtrWrap(char *str);
|
---|
210 | PyObject * libxml_constcharPtrWrap(const char *str);
|
---|
211 | PyObject * libxml_charPtrConstWrap(const char *str);
|
---|
212 | PyObject * libxml_xmlCharPtrConstWrap(const xmlChar *str);
|
---|
213 | PyObject * libxml_xmlDocPtrWrap(xmlDocPtr doc);
|
---|
214 | PyObject * libxml_xmlNodePtrWrap(xmlNodePtr node);
|
---|
215 | PyObject * libxml_xmlAttrPtrWrap(xmlAttrPtr attr);
|
---|
216 | PyObject * libxml_xmlNsPtrWrap(xmlNsPtr ns);
|
---|
217 | PyObject * libxml_xmlAttributePtrWrap(xmlAttributePtr ns);
|
---|
218 | PyObject * libxml_xmlElementPtrWrap(xmlElementPtr ns);
|
---|
219 | PyObject * libxml_doubleWrap(double val);
|
---|
220 | PyObject * libxml_xmlXPathContextPtrWrap(xmlXPathContextPtr ctxt);
|
---|
221 | PyObject * libxml_xmlParserCtxtPtrWrap(xmlParserCtxtPtr ctxt);
|
---|
222 | PyObject * libxml_xmlXPathParserContextPtrWrap(xmlXPathParserContextPtr ctxt);
|
---|
223 | PyObject * libxml_xmlXPathObjectPtrWrap(xmlXPathObjectPtr obj);
|
---|
224 | PyObject * libxml_xmlValidCtxtPtrWrap(xmlValidCtxtPtr valid);
|
---|
225 | PyObject * libxml_xmlCatalogPtrWrap(xmlCatalogPtr obj);
|
---|
226 | PyObject * libxml_xmlURIPtrWrap(xmlURIPtr uri);
|
---|
227 | PyObject * libxml_xmlOutputBufferPtrWrap(xmlOutputBufferPtr buffer);
|
---|
228 | PyObject * libxml_xmlParserInputBufferPtrWrap(xmlParserInputBufferPtr buffer);
|
---|
229 | #ifdef LIBXML_REGEXP_ENABLED
|
---|
230 | PyObject * libxml_xmlRegexpPtrWrap(xmlRegexpPtr regexp);
|
---|
231 | #endif /* LIBXML_REGEXP_ENABLED */
|
---|
232 | PyObject * libxml_xmlTextReaderPtrWrap(xmlTextReaderPtr reader);
|
---|
233 | PyObject * libxml_xmlTextReaderLocatorPtrWrap(xmlTextReaderLocatorPtr locator);
|
---|
234 |
|
---|
235 | xmlXPathObjectPtr libxml_xmlXPathObjectPtrConvert(PyObject * obj);
|
---|
236 | #ifdef LIBXML_SCHEMAS_ENABLED
|
---|
237 | PyObject * libxml_xmlRelaxNGPtrWrap(xmlRelaxNGPtr ctxt);
|
---|
238 | PyObject * libxml_xmlRelaxNGParserCtxtPtrWrap(xmlRelaxNGParserCtxtPtr ctxt);
|
---|
239 | PyObject * libxml_xmlRelaxNGValidCtxtPtrWrap(xmlRelaxNGValidCtxtPtr valid);
|
---|
240 | PyObject * libxml_xmlSchemaPtrWrap(xmlSchemaPtr ctxt);
|
---|
241 | PyObject * libxml_xmlSchemaParserCtxtPtrWrap(xmlSchemaParserCtxtPtr ctxt);
|
---|
242 | PyObject * libxml_xmlSchemaValidCtxtPtrWrap(xmlSchemaValidCtxtPtr valid);
|
---|
243 | #endif /* LIBXML_SCHEMAS_ENABLED */
|
---|
244 | PyObject * libxml_xmlErrorPtrWrap(xmlErrorPtr error);
|
---|
245 | PyObject * libxml_xmlSchemaSetValidErrors(PyObject * self, PyObject * args);
|
---|