blob: 7a38f54c0440e05f33b6ccb6b51460c1c409f11f [file] [log] [blame]
Daniel Veillard3ce52572002-02-03 15:08:05 +00001#include <Python.h>
Daniel Veillardd2897fd2002-01-30 16:37:32 +00002#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 Veillard96fe0952002-01-30 20:52:23 +000013#include <libxml/HTMLparser.h>
14#include <libxml/HTMLtree.h>
15#include <libxml/xinclude.h>
Daniel Veillard1971ee22002-01-31 20:29:19 +000016#include <libxml/xpointer.h>
Daniel Veillardbd9afb52002-09-25 22:25:35 +000017#include <libxml/xmlunicode.h>
18#include <libxml/xmlregexp.h>
19#include <libxml/xmlautomata.h>
Daniel Veillard0eb38c72002-12-14 23:00:35 +000020#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
33#include <ansidecl.h>
34#ifndef ATTRIBUTE_UNUSED
35#define ATTRIBUTE_UNUSED
36#endif
37#else
38#define ATTRIBUTE_UNUSED
39#endif
Daniel Veillard96fe0952002-01-30 20:52:23 +000040
Daniel Veillard36eea2d2002-02-04 00:17:01 +000041#define PyxmlNode_Get(v) (((v) == Py_None) ? NULL : \
42 (((PyxmlNode_Object *)(v))->obj))
Daniel Veillard96fe0952002-01-30 20:52:23 +000043
44typedef struct {
45 PyObject_HEAD
46 xmlNodePtr obj;
47} PyxmlNode_Object;
Daniel Veillardd2897fd2002-01-30 16:37:32 +000048
Daniel Veillard36eea2d2002-02-04 00:17:01 +000049#define PyxmlXPathContext_Get(v) (((v) == Py_None) ? NULL : \
50 (((PyxmlXPathContext_Object *)(v))->obj))
51
Daniel Veillard1971ee22002-01-31 20:29:19 +000052typedef struct {
53 PyObject_HEAD
54 xmlXPathContextPtr obj;
55} PyxmlXPathContext_Object;
56
Daniel Veillard7db38712002-02-07 16:39:11 +000057#define PyxmlXPathParserContext_Get(v) (((v) == Py_None) ? NULL : \
58 (((PyxmlXPathParserContext_Object *)(v))->obj))
59
60typedef struct {
61 PyObject_HEAD
62 xmlXPathParserContextPtr obj;
63} PyxmlXPathParserContext_Object;
64
Daniel Veillard36eea2d2002-02-04 00:17:01 +000065#define PyparserCtxt_Get(v) (((v) == Py_None) ? NULL : \
66 (((PyparserCtxt_Object *)(v))->obj))
67
Daniel Veillard3ce52572002-02-03 15:08:05 +000068typedef struct {
69 PyObject_HEAD
70 xmlParserCtxtPtr obj;
71} PyparserCtxt_Object;
72
Daniel Veillard7db38712002-02-07 16:39:11 +000073#define Pycatalog_Get(v) (((v) == Py_None) ? NULL : \
74 (((Pycatalog_Object *)(v))->obj))
75
76typedef struct {
77 PyObject_HEAD
78 xmlCatalogPtr obj;
79} Pycatalog_Object;
80
Daniel Veillardbd9afb52002-09-25 22:25:35 +000081#define PyxmlReg_Get(v) (((v) == Py_None) ? NULL : \
82 (((PyxmlReg_Object *)(v))->obj))
83
84typedef struct {
85 PyObject_HEAD
86 xmlRegexpPtr obj;
87} PyxmlReg_Object;
88
Daniel Veillard0eb38c72002-12-14 23:00:35 +000089#define PyxmlTextReader_Get(v) (((v) == Py_None) ? NULL : \
90 (((PyxmlTextReader_Object *)(v))->obj))
91
92typedef struct {
93 PyObject_HEAD
94 xmlTextReaderPtr obj;
95} PyxmlTextReader_Object;
96
Daniel Veillard6361da02002-02-23 10:10:33 +000097#define PyURI_Get(v) (((v) == Py_None) ? NULL : \
98 (((PyURI_Object *)(v))->obj))
99
100typedef struct {
101 PyObject_HEAD
Daniel Veillardc6d4a932002-09-12 15:00:57 +0000102 xmlOutputBufferPtr obj;
103} PyoutputBuffer_Object;
104
105#define PyoutputBuffer_Get(v) (((v) == Py_None) ? NULL : \
106 (((PyURI_Object *)(v))->obj))
107
108typedef struct {
109 PyObject_HEAD
110 xmlParserInputBufferPtr obj;
111} PyinputBuffer_Object;
112
113#define PyinputBuffer_Get(v) (((v) == Py_None) ? NULL : \
114 (((PyURI_Object *)(v))->obj))
115
116typedef struct {
117 PyObject_HEAD
Daniel Veillard6361da02002-02-23 10:10:33 +0000118 xmlURIPtr obj;
119} PyURI_Object;
120
121/* FILE * have their own internal representation */
Daniel Veillard7db38712002-02-07 16:39:11 +0000122#define PyFile_Get(v) (((v) == Py_None) ? NULL : \
Daniel Veillardbd9afb52002-09-25 22:25:35 +0000123 (PyFile_Check(v) ? (PyFile_AsFile(v)) : stdout))
Daniel Veillard7db38712002-02-07 16:39:11 +0000124
Daniel Veillard6361da02002-02-23 10:10:33 +0000125
Daniel Veillardd2897fd2002-01-30 16:37:32 +0000126PyObject * libxml_intWrap(int val);
Daniel Veillard4e1b26c2002-02-03 20:13:06 +0000127PyObject * libxml_longWrap(long val);
Daniel Veillard1971ee22002-01-31 20:29:19 +0000128PyObject * libxml_xmlCharPtrWrap(xmlChar *str);
129PyObject * libxml_constxmlCharPtrWrap(const xmlChar *str);
130PyObject * libxml_charPtrWrap(char *str);
131PyObject * libxml_constcharPtrWrap(const char *str);
Daniel Veillardc575b992002-02-08 13:28:40 +0000132PyObject * libxml_charPtrConstWrap(const char *str);
133PyObject * libxml_xmlCharPtrConstWrap(const xmlChar *str);
Daniel Veillardd2897fd2002-01-30 16:37:32 +0000134PyObject * libxml_xmlDocPtrWrap(xmlDocPtr doc);
135PyObject * libxml_xmlNodePtrWrap(xmlNodePtr node);
136PyObject * libxml_xmlAttrPtrWrap(xmlAttrPtr attr);
Daniel Veillard1971ee22002-01-31 20:29:19 +0000137PyObject * libxml_xmlNsPtrWrap(xmlNsPtr ns);
138PyObject * libxml_xmlAttributePtrWrap(xmlAttributePtr ns);
139PyObject * libxml_xmlElementPtrWrap(xmlElementPtr ns);
Daniel Veillard96fe0952002-01-30 20:52:23 +0000140PyObject * libxml_doubleWrap(double val);
Daniel Veillard1971ee22002-01-31 20:29:19 +0000141PyObject * libxml_xmlXPathContextPtrWrap(xmlXPathContextPtr ctxt);
Daniel Veillard3ce52572002-02-03 15:08:05 +0000142PyObject * libxml_xmlParserCtxtPtrWrap(xmlParserCtxtPtr ctxt);
Daniel Veillard7db38712002-02-07 16:39:11 +0000143PyObject * libxml_xmlXPathParserContextPtrWrap(xmlXPathParserContextPtr ctxt);
Daniel Veillard1971ee22002-01-31 20:29:19 +0000144PyObject * libxml_xmlXPathObjectPtrWrap(xmlXPathObjectPtr obj);
Daniel Veillard7db38712002-02-07 16:39:11 +0000145PyObject * libxml_xmlCatalogPtrWrap(xmlCatalogPtr obj);
Daniel Veillard6361da02002-02-23 10:10:33 +0000146PyObject * libxml_xmlURIPtrWrap(xmlURIPtr uri);
Daniel Veillardc6d4a932002-09-12 15:00:57 +0000147PyObject * libxml_xmlOutputBufferPtrWrap(xmlOutputBufferPtr buffer);
148PyObject * libxml_xmlParserInputBufferPtrWrap(xmlParserInputBufferPtr buffer);
Daniel Veillardbd9afb52002-09-25 22:25:35 +0000149PyObject * libxml_xmlRegexpPtrWrap(xmlRegexpPtr regexp);
Daniel Veillard0eb38c72002-12-14 23:00:35 +0000150PyObject * libxml_xmlTextReaderPtrWrap(xmlTextReaderPtr reader);
Daniel Veillard96fe0952002-01-30 20:52:23 +0000151
Daniel Veillard3ce52572002-02-03 15:08:05 +0000152xmlXPathObjectPtr libxml_xmlXPathObjectPtrConvert(PyObject * obj);