Daniel Veillard | 3ce5257 | 2002-02-03 15:08:05 +0000 | [diff] [blame] | 1 | #include <Python.h> |
Daniel Veillard | d2897fd | 2002-01-30 16:37:32 +0000 | [diff] [blame] | 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> |
Daniel Veillard | 96fe095 | 2002-01-30 20:52:23 +0000 | [diff] [blame] | 13 | #include <libxml/HTMLparser.h> |
| 14 | #include <libxml/HTMLtree.h> |
| 15 | #include <libxml/xinclude.h> |
Daniel Veillard | 1971ee2 | 2002-01-31 20:29:19 +0000 | [diff] [blame] | 16 | #include <libxml/xpointer.h> |
Daniel Veillard | bd9afb5 | 2002-09-25 22:25:35 +0000 | [diff] [blame] | 17 | #include <libxml/xmlunicode.h> |
| 18 | #include <libxml/xmlregexp.h> |
| 19 | #include <libxml/xmlautomata.h> |
Daniel Veillard | 0eb38c7 | 2002-12-14 23:00:35 +0000 | [diff] [blame] | 20 | #include <libxml/xmlreader.h> |
Daniel Veillard | 259f0df | 2004-08-18 09:13:18 +0000 | [diff] [blame] | 21 | #ifdef LIBXML_SCHEMAS_ENABLED |
Daniel Veillard | 71531f3 | 2003-02-05 13:19:53 +0000 | [diff] [blame] | 22 | #include <libxml/relaxng.h> |
Daniel Veillard | 259f0df | 2004-08-18 09:13:18 +0000 | [diff] [blame] | 23 | #include <libxml/xmlschemas.h> |
| 24 | #endif |
Daniel Veillard | 0eb38c7 | 2002-12-14 23:00:35 +0000 | [diff] [blame] | 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 |
Daniel Veillard | 0eb38c7 | 2002-12-14 23:00:35 +0000 | [diff] [blame] | 37 | #ifndef ATTRIBUTE_UNUSED |
Daniel Veillard | 0e9dafa | 2002-12-27 11:58:25 +0000 | [diff] [blame] | 38 | #define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) |
| 39 | #endif /* ATTRIBUTE_UNUSED */ |
Daniel Veillard | 0eb38c7 | 2002-12-14 23:00:35 +0000 | [diff] [blame] | 40 | #else |
| 41 | #define ATTRIBUTE_UNUSED |
| 42 | #endif |
Daniel Veillard | 96fe095 | 2002-01-30 20:52:23 +0000 | [diff] [blame] | 43 | |
Daniel Veillard | 36eea2d | 2002-02-04 00:17:01 +0000 | [diff] [blame] | 44 | #define PyxmlNode_Get(v) (((v) == Py_None) ? NULL : \ |
| 45 | (((PyxmlNode_Object *)(v))->obj)) |
Daniel Veillard | 96fe095 | 2002-01-30 20:52:23 +0000 | [diff] [blame] | 46 | |
| 47 | typedef struct { |
| 48 | PyObject_HEAD |
| 49 | xmlNodePtr obj; |
| 50 | } PyxmlNode_Object; |
Daniel Veillard | d2897fd | 2002-01-30 16:37:32 +0000 | [diff] [blame] | 51 | |
Daniel Veillard | 36eea2d | 2002-02-04 00:17:01 +0000 | [diff] [blame] | 52 | #define PyxmlXPathContext_Get(v) (((v) == Py_None) ? NULL : \ |
| 53 | (((PyxmlXPathContext_Object *)(v))->obj)) |
| 54 | |
Daniel Veillard | 1971ee2 | 2002-01-31 20:29:19 +0000 | [diff] [blame] | 55 | typedef struct { |
| 56 | PyObject_HEAD |
| 57 | xmlXPathContextPtr obj; |
| 58 | } PyxmlXPathContext_Object; |
| 59 | |
Daniel Veillard | 7db3871 | 2002-02-07 16:39:11 +0000 | [diff] [blame] | 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 | |
Daniel Veillard | 36eea2d | 2002-02-04 00:17:01 +0000 | [diff] [blame] | 68 | #define PyparserCtxt_Get(v) (((v) == Py_None) ? NULL : \ |
| 69 | (((PyparserCtxt_Object *)(v))->obj)) |
| 70 | |
Daniel Veillard | 3ce5257 | 2002-02-03 15:08:05 +0000 | [diff] [blame] | 71 | typedef struct { |
| 72 | PyObject_HEAD |
| 73 | xmlParserCtxtPtr obj; |
| 74 | } PyparserCtxt_Object; |
| 75 | |
Daniel Veillard | 7db3871 | 2002-02-07 16:39:11 +0000 | [diff] [blame] | 76 | #define Pycatalog_Get(v) (((v) == Py_None) ? NULL : \ |
| 77 | (((Pycatalog_Object *)(v))->obj)) |
| 78 | |
| 79 | typedef struct { |
| 80 | PyObject_HEAD |
| 81 | xmlCatalogPtr obj; |
| 82 | } Pycatalog_Object; |
| 83 | |
Daniel Veillard | 0e298ad | 2003-02-04 16:14:33 +0000 | [diff] [blame] | 84 | #ifdef LIBXML_REGEXP_ENABLED |
Daniel Veillard | bd9afb5 | 2002-09-25 22:25:35 +0000 | [diff] [blame] | 85 | #define PyxmlReg_Get(v) (((v) == Py_None) ? NULL : \ |
| 86 | (((PyxmlReg_Object *)(v))->obj)) |
| 87 | |
| 88 | typedef struct { |
| 89 | PyObject_HEAD |
| 90 | xmlRegexpPtr obj; |
| 91 | } PyxmlReg_Object; |
Daniel Veillard | 0e298ad | 2003-02-04 16:14:33 +0000 | [diff] [blame] | 92 | #endif /* LIBXML_REGEXP_ENABLED */ |
Daniel Veillard | bd9afb5 | 2002-09-25 22:25:35 +0000 | [diff] [blame] | 93 | |
Daniel Veillard | 0eb38c7 | 2002-12-14 23:00:35 +0000 | [diff] [blame] | 94 | #define PyxmlTextReader_Get(v) (((v) == Py_None) ? NULL : \ |
| 95 | (((PyxmlTextReader_Object *)(v))->obj)) |
| 96 | |
| 97 | typedef struct { |
| 98 | PyObject_HEAD |
| 99 | xmlTextReaderPtr obj; |
| 100 | } PyxmlTextReader_Object; |
| 101 | |
Daniel Veillard | 417be3a | 2003-01-20 21:26:34 +0000 | [diff] [blame] | 102 | #define PyxmlTextReaderLocator_Get(v) (((v) == Py_None) ? NULL : \ |
| 103 | (((PyxmlTextReaderLocator_Object *)(v))->obj)) |
| 104 | |
| 105 | typedef struct { |
| 106 | PyObject_HEAD |
| 107 | xmlTextReaderLocatorPtr obj; |
| 108 | } PyxmlTextReaderLocator_Object; |
| 109 | |
Daniel Veillard | 6361da0 | 2002-02-23 10:10:33 +0000 | [diff] [blame] | 110 | #define PyURI_Get(v) (((v) == Py_None) ? NULL : \ |
| 111 | (((PyURI_Object *)(v))->obj)) |
| 112 | |
| 113 | typedef struct { |
| 114 | PyObject_HEAD |
Daniel Veillard | 46da464 | 2004-01-06 22:54:57 +0000 | [diff] [blame] | 115 | xmlErrorPtr obj; |
| 116 | } PyError_Object; |
| 117 | |
| 118 | #define PyError_Get(v) (((v) == Py_None) ? NULL : \ |
| 119 | (((PyError_Object *)(v))->obj)) |
| 120 | |
| 121 | typedef struct { |
| 122 | PyObject_HEAD |
Daniel Veillard | c6d4a93 | 2002-09-12 15:00:57 +0000 | [diff] [blame] | 123 | xmlOutputBufferPtr obj; |
| 124 | } PyoutputBuffer_Object; |
| 125 | |
| 126 | #define PyoutputBuffer_Get(v) (((v) == Py_None) ? NULL : \ |
Daniel Veillard | 6cbd6c0 | 2003-12-04 12:31:49 +0000 | [diff] [blame] | 127 | (((PyoutputBuffer_Object *)(v))->obj)) |
Daniel Veillard | c6d4a93 | 2002-09-12 15:00:57 +0000 | [diff] [blame] | 128 | |
| 129 | typedef struct { |
| 130 | PyObject_HEAD |
| 131 | xmlParserInputBufferPtr obj; |
| 132 | } PyinputBuffer_Object; |
| 133 | |
| 134 | #define PyinputBuffer_Get(v) (((v) == Py_None) ? NULL : \ |
Daniel Veillard | 6cbd6c0 | 2003-12-04 12:31:49 +0000 | [diff] [blame] | 135 | (((PyinputBuffer_Object *)(v))->obj)) |
Daniel Veillard | c6d4a93 | 2002-09-12 15:00:57 +0000 | [diff] [blame] | 136 | |
| 137 | typedef struct { |
| 138 | PyObject_HEAD |
Daniel Veillard | 6361da0 | 2002-02-23 10:10:33 +0000 | [diff] [blame] | 139 | xmlURIPtr obj; |
| 140 | } PyURI_Object; |
| 141 | |
| 142 | /* FILE * have their own internal representation */ |
Daniel Veillard | 7db3871 | 2002-02-07 16:39:11 +0000 | [diff] [blame] | 143 | #define PyFile_Get(v) (((v) == Py_None) ? NULL : \ |
Daniel Veillard | bd9afb5 | 2002-09-25 22:25:35 +0000 | [diff] [blame] | 144 | (PyFile_Check(v) ? (PyFile_AsFile(v)) : stdout)) |
Daniel Veillard | 7db3871 | 2002-02-07 16:39:11 +0000 | [diff] [blame] | 145 | |
Daniel Veillard | 591b4be | 2003-02-09 23:33:36 +0000 | [diff] [blame] | 146 | #ifdef LIBXML_SCHEMAS_ENABLED |
| 147 | typedef struct { |
| 148 | PyObject_HEAD |
| 149 | xmlRelaxNGPtr obj; |
| 150 | } PyrelaxNgSchema_Object; |
| 151 | |
| 152 | #define PyrelaxNgSchema_Get(v) (((v) == Py_None) ? NULL : \ |
| 153 | (((PyrelaxNgSchema_Object *)(v))->obj)) |
| 154 | |
| 155 | typedef struct { |
| 156 | PyObject_HEAD |
| 157 | xmlRelaxNGParserCtxtPtr obj; |
| 158 | } PyrelaxNgParserCtxt_Object; |
| 159 | |
| 160 | #define PyrelaxNgParserCtxt_Get(v) (((v) == Py_None) ? NULL : \ |
| 161 | (((PyrelaxNgParserCtxt_Object *)(v))->obj)) |
| 162 | |
| 163 | typedef struct { |
| 164 | PyObject_HEAD |
| 165 | xmlRelaxNGValidCtxtPtr obj; |
| 166 | } PyrelaxNgValidCtxt_Object; |
| 167 | |
| 168 | #define PyrelaxNgValidCtxt_Get(v) (((v) == Py_None) ? NULL : \ |
| 169 | (((PyrelaxNgValidCtxt_Object *)(v))->obj)) |
| 170 | |
Daniel Veillard | 259f0df | 2004-08-18 09:13:18 +0000 | [diff] [blame] | 171 | typedef struct { |
| 172 | PyObject_HEAD |
| 173 | xmlSchemaPtr obj; |
| 174 | } PySchema_Object; |
| 175 | |
| 176 | #define PySchema_Get(v) (((v) == Py_None) ? NULL : \ |
| 177 | (((PySchema_Object *)(v))->obj)) |
| 178 | |
| 179 | typedef struct { |
| 180 | PyObject_HEAD |
| 181 | xmlSchemaParserCtxtPtr obj; |
| 182 | } PySchemaParserCtxt_Object; |
| 183 | |
| 184 | #define PySchemaParserCtxt_Get(v) (((v) == Py_None) ? NULL : \ |
| 185 | (((PySchemaParserCtxt_Object *)(v))->obj)) |
| 186 | |
| 187 | typedef struct { |
| 188 | PyObject_HEAD |
| 189 | xmlSchemaValidCtxtPtr obj; |
| 190 | } PySchemaValidCtxt_Object; |
| 191 | |
| 192 | #define PySchemaValidCtxt_Get(v) (((v) == Py_None) ? NULL : \ |
| 193 | (((PySchemaValidCtxt_Object *)(v))->obj)) |
| 194 | |
Daniel Veillard | 591b4be | 2003-02-09 23:33:36 +0000 | [diff] [blame] | 195 | #endif /* LIBXML_SCHEMAS_ENABLED */ |
Daniel Veillard | 6361da0 | 2002-02-23 10:10:33 +0000 | [diff] [blame] | 196 | |
Daniel Veillard | d2897fd | 2002-01-30 16:37:32 +0000 | [diff] [blame] | 197 | PyObject * libxml_intWrap(int val); |
Daniel Veillard | 4e1b26c | 2002-02-03 20:13:06 +0000 | [diff] [blame] | 198 | PyObject * libxml_longWrap(long val); |
Daniel Veillard | 1971ee2 | 2002-01-31 20:29:19 +0000 | [diff] [blame] | 199 | PyObject * libxml_xmlCharPtrWrap(xmlChar *str); |
| 200 | PyObject * libxml_constxmlCharPtrWrap(const xmlChar *str); |
| 201 | PyObject * libxml_charPtrWrap(char *str); |
| 202 | PyObject * libxml_constcharPtrWrap(const char *str); |
Daniel Veillard | c575b99 | 2002-02-08 13:28:40 +0000 | [diff] [blame] | 203 | PyObject * libxml_charPtrConstWrap(const char *str); |
| 204 | PyObject * libxml_xmlCharPtrConstWrap(const xmlChar *str); |
Daniel Veillard | d2897fd | 2002-01-30 16:37:32 +0000 | [diff] [blame] | 205 | PyObject * libxml_xmlDocPtrWrap(xmlDocPtr doc); |
| 206 | PyObject * libxml_xmlNodePtrWrap(xmlNodePtr node); |
| 207 | PyObject * libxml_xmlAttrPtrWrap(xmlAttrPtr attr); |
Daniel Veillard | 1971ee2 | 2002-01-31 20:29:19 +0000 | [diff] [blame] | 208 | PyObject * libxml_xmlNsPtrWrap(xmlNsPtr ns); |
| 209 | PyObject * libxml_xmlAttributePtrWrap(xmlAttributePtr ns); |
| 210 | PyObject * libxml_xmlElementPtrWrap(xmlElementPtr ns); |
Daniel Veillard | 96fe095 | 2002-01-30 20:52:23 +0000 | [diff] [blame] | 211 | PyObject * libxml_doubleWrap(double val); |
Daniel Veillard | 1971ee2 | 2002-01-31 20:29:19 +0000 | [diff] [blame] | 212 | PyObject * libxml_xmlXPathContextPtrWrap(xmlXPathContextPtr ctxt); |
Daniel Veillard | 3ce5257 | 2002-02-03 15:08:05 +0000 | [diff] [blame] | 213 | PyObject * libxml_xmlParserCtxtPtrWrap(xmlParserCtxtPtr ctxt); |
Daniel Veillard | 7db3871 | 2002-02-07 16:39:11 +0000 | [diff] [blame] | 214 | PyObject * libxml_xmlXPathParserContextPtrWrap(xmlXPathParserContextPtr ctxt); |
Daniel Veillard | 1971ee2 | 2002-01-31 20:29:19 +0000 | [diff] [blame] | 215 | PyObject * libxml_xmlXPathObjectPtrWrap(xmlXPathObjectPtr obj); |
Daniel Veillard | 7db3871 | 2002-02-07 16:39:11 +0000 | [diff] [blame] | 216 | PyObject * libxml_xmlCatalogPtrWrap(xmlCatalogPtr obj); |
Daniel Veillard | 6361da0 | 2002-02-23 10:10:33 +0000 | [diff] [blame] | 217 | PyObject * libxml_xmlURIPtrWrap(xmlURIPtr uri); |
Daniel Veillard | c6d4a93 | 2002-09-12 15:00:57 +0000 | [diff] [blame] | 218 | PyObject * libxml_xmlOutputBufferPtrWrap(xmlOutputBufferPtr buffer); |
| 219 | PyObject * libxml_xmlParserInputBufferPtrWrap(xmlParserInputBufferPtr buffer); |
Daniel Veillard | 0e298ad | 2003-02-04 16:14:33 +0000 | [diff] [blame] | 220 | #ifdef LIBXML_REGEXP_ENABLED |
Daniel Veillard | bd9afb5 | 2002-09-25 22:25:35 +0000 | [diff] [blame] | 221 | PyObject * libxml_xmlRegexpPtrWrap(xmlRegexpPtr regexp); |
Daniel Veillard | 0e298ad | 2003-02-04 16:14:33 +0000 | [diff] [blame] | 222 | #endif /* LIBXML_REGEXP_ENABLED */ |
Daniel Veillard | 0eb38c7 | 2002-12-14 23:00:35 +0000 | [diff] [blame] | 223 | PyObject * libxml_xmlTextReaderPtrWrap(xmlTextReaderPtr reader); |
Daniel Veillard | 417be3a | 2003-01-20 21:26:34 +0000 | [diff] [blame] | 224 | PyObject * libxml_xmlTextReaderLocatorPtrWrap(xmlTextReaderLocatorPtr locator); |
Daniel Veillard | 96fe095 | 2002-01-30 20:52:23 +0000 | [diff] [blame] | 225 | |
Daniel Veillard | 3ce5257 | 2002-02-03 15:08:05 +0000 | [diff] [blame] | 226 | xmlXPathObjectPtr libxml_xmlXPathObjectPtrConvert(PyObject * obj); |
Daniel Veillard | 591b4be | 2003-02-09 23:33:36 +0000 | [diff] [blame] | 227 | #ifdef LIBXML_SCHEMAS_ENABLED |
| 228 | PyObject * libxml_xmlRelaxNGPtrWrap(xmlRelaxNGPtr ctxt); |
| 229 | PyObject * libxml_xmlRelaxNGParserCtxtPtrWrap(xmlRelaxNGParserCtxtPtr ctxt); |
| 230 | PyObject * libxml_xmlRelaxNGValidCtxtPtrWrap(xmlRelaxNGValidCtxtPtr valid); |
Daniel Veillard | 259f0df | 2004-08-18 09:13:18 +0000 | [diff] [blame] | 231 | PyObject * libxml_xmlSchemaPtrWrap(xmlSchemaPtr ctxt); |
| 232 | PyObject * libxml_xmlSchemaParserCtxtPtrWrap(xmlSchemaParserCtxtPtr ctxt); |
| 233 | PyObject * libxml_xmlSchemaValidCtxtPtrWrap(xmlSchemaValidCtxtPtr valid); |
Daniel Veillard | 591b4be | 2003-02-09 23:33:36 +0000 | [diff] [blame] | 234 | #endif /* LIBXML_SCHEMAS_ENABLED */ |
Daniel Veillard | 46da464 | 2004-01-06 22:54:57 +0000 | [diff] [blame] | 235 | PyObject * libxml_xmlErrorPtrWrap(xmlErrorPtr error); |
Daniel Veillard | 6ebf3c4 | 2004-08-22 13:11:39 +0000 | [diff] [blame^] | 236 | PyObject * libxml_xmlSchemaSetValidErrors(PyObject * self, PyObject * args); |