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