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