blob: e318a15cc3f41631b467226833592875b871aa90 [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
Daniel Veillard0eb38c72002-12-14 23:00:35 +000033#ifndef ATTRIBUTE_UNUSED
Daniel Veillard0e9dafa2002-12-27 11:58:25 +000034#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
35#endif /* ATTRIBUTE_UNUSED */
Daniel Veillard0eb38c72002-12-14 23:00:35 +000036#else
37#define ATTRIBUTE_UNUSED
38#endif
Daniel Veillard96fe0952002-01-30 20:52:23 +000039
Daniel Veillard36eea2d2002-02-04 00:17:01 +000040#define PyxmlNode_Get(v) (((v) == Py_None) ? NULL : \
41 (((PyxmlNode_Object *)(v))->obj))
Daniel Veillard96fe0952002-01-30 20:52:23 +000042
43typedef struct {
44 PyObject_HEAD
45 xmlNodePtr obj;
46} PyxmlNode_Object;
Daniel Veillardd2897fd2002-01-30 16:37:32 +000047
Daniel Veillard36eea2d2002-02-04 00:17:01 +000048#define PyxmlXPathContext_Get(v) (((v) == Py_None) ? NULL : \
49 (((PyxmlXPathContext_Object *)(v))->obj))
50
Daniel Veillard1971ee22002-01-31 20:29:19 +000051typedef struct {
52 PyObject_HEAD
53 xmlXPathContextPtr obj;
54} PyxmlXPathContext_Object;
55
Daniel Veillard7db38712002-02-07 16:39:11 +000056#define PyxmlXPathParserContext_Get(v) (((v) == Py_None) ? NULL : \
57 (((PyxmlXPathParserContext_Object *)(v))->obj))
58
59typedef struct {
60 PyObject_HEAD
61 xmlXPathParserContextPtr obj;
62} PyxmlXPathParserContext_Object;
63
Daniel Veillard36eea2d2002-02-04 00:17:01 +000064#define PyparserCtxt_Get(v) (((v) == Py_None) ? NULL : \
65 (((PyparserCtxt_Object *)(v))->obj))
66
Daniel Veillard3ce52572002-02-03 15:08:05 +000067typedef struct {
68 PyObject_HEAD
69 xmlParserCtxtPtr obj;
70} PyparserCtxt_Object;
71
Daniel Veillard7db38712002-02-07 16:39:11 +000072#define Pycatalog_Get(v) (((v) == Py_None) ? NULL : \
73 (((Pycatalog_Object *)(v))->obj))
74
75typedef struct {
76 PyObject_HEAD
77 xmlCatalogPtr obj;
78} Pycatalog_Object;
79
Daniel Veillardbd9afb52002-09-25 22:25:35 +000080#define PyxmlReg_Get(v) (((v) == Py_None) ? NULL : \
81 (((PyxmlReg_Object *)(v))->obj))
82
83typedef struct {
84 PyObject_HEAD
85 xmlRegexpPtr obj;
86} PyxmlReg_Object;
87
Daniel Veillard0eb38c72002-12-14 23:00:35 +000088#define PyxmlTextReader_Get(v) (((v) == Py_None) ? NULL : \
89 (((PyxmlTextReader_Object *)(v))->obj))
90
91typedef struct {
92 PyObject_HEAD
93 xmlTextReaderPtr obj;
94} PyxmlTextReader_Object;
95
Daniel Veillard6361da02002-02-23 10:10:33 +000096#define PyURI_Get(v) (((v) == Py_None) ? NULL : \
97 (((PyURI_Object *)(v))->obj))
98
99typedef struct {
100 PyObject_HEAD
Daniel Veillardc6d4a932002-09-12 15:00:57 +0000101 xmlOutputBufferPtr obj;
102} PyoutputBuffer_Object;
103
104#define PyoutputBuffer_Get(v) (((v) == Py_None) ? NULL : \
105 (((PyURI_Object *)(v))->obj))
106
107typedef struct {
108 PyObject_HEAD
109 xmlParserInputBufferPtr obj;
110} PyinputBuffer_Object;
111
112#define PyinputBuffer_Get(v) (((v) == Py_None) ? NULL : \
113 (((PyURI_Object *)(v))->obj))
114
115typedef struct {
116 PyObject_HEAD
Daniel Veillard6361da02002-02-23 10:10:33 +0000117 xmlURIPtr obj;
118} PyURI_Object;
119
120/* FILE * have their own internal representation */
Daniel Veillard7db38712002-02-07 16:39:11 +0000121#define PyFile_Get(v) (((v) == Py_None) ? NULL : \
Daniel Veillardbd9afb52002-09-25 22:25:35 +0000122 (PyFile_Check(v) ? (PyFile_AsFile(v)) : stdout))
Daniel Veillard7db38712002-02-07 16:39:11 +0000123
Daniel Veillard6361da02002-02-23 10:10:33 +0000124
Daniel Veillardd2897fd2002-01-30 16:37:32 +0000125PyObject * libxml_intWrap(int val);
Daniel Veillard4e1b26c2002-02-03 20:13:06 +0000126PyObject * libxml_longWrap(long val);
Daniel Veillard1971ee22002-01-31 20:29:19 +0000127PyObject * libxml_xmlCharPtrWrap(xmlChar *str);
128PyObject * libxml_constxmlCharPtrWrap(const xmlChar *str);
129PyObject * libxml_charPtrWrap(char *str);
130PyObject * libxml_constcharPtrWrap(const char *str);
Daniel Veillardc575b992002-02-08 13:28:40 +0000131PyObject * libxml_charPtrConstWrap(const char *str);
132PyObject * libxml_xmlCharPtrConstWrap(const xmlChar *str);
Daniel Veillardd2897fd2002-01-30 16:37:32 +0000133PyObject * libxml_xmlDocPtrWrap(xmlDocPtr doc);
134PyObject * libxml_xmlNodePtrWrap(xmlNodePtr node);
135PyObject * libxml_xmlAttrPtrWrap(xmlAttrPtr attr);
Daniel Veillard1971ee22002-01-31 20:29:19 +0000136PyObject * libxml_xmlNsPtrWrap(xmlNsPtr ns);
137PyObject * libxml_xmlAttributePtrWrap(xmlAttributePtr ns);
138PyObject * libxml_xmlElementPtrWrap(xmlElementPtr ns);
Daniel Veillard96fe0952002-01-30 20:52:23 +0000139PyObject * libxml_doubleWrap(double val);
Daniel Veillard1971ee22002-01-31 20:29:19 +0000140PyObject * libxml_xmlXPathContextPtrWrap(xmlXPathContextPtr ctxt);
Daniel Veillard3ce52572002-02-03 15:08:05 +0000141PyObject * libxml_xmlParserCtxtPtrWrap(xmlParserCtxtPtr ctxt);
Daniel Veillard7db38712002-02-07 16:39:11 +0000142PyObject * libxml_xmlXPathParserContextPtrWrap(xmlXPathParserContextPtr ctxt);
Daniel Veillard1971ee22002-01-31 20:29:19 +0000143PyObject * libxml_xmlXPathObjectPtrWrap(xmlXPathObjectPtr obj);
Daniel Veillard7db38712002-02-07 16:39:11 +0000144PyObject * libxml_xmlCatalogPtrWrap(xmlCatalogPtr obj);
Daniel Veillard6361da02002-02-23 10:10:33 +0000145PyObject * libxml_xmlURIPtrWrap(xmlURIPtr uri);
Daniel Veillardc6d4a932002-09-12 15:00:57 +0000146PyObject * libxml_xmlOutputBufferPtrWrap(xmlOutputBufferPtr buffer);
147PyObject * libxml_xmlParserInputBufferPtrWrap(xmlParserInputBufferPtr buffer);
Daniel Veillardbd9afb52002-09-25 22:25:35 +0000148PyObject * libxml_xmlRegexpPtrWrap(xmlRegexpPtr regexp);
Daniel Veillard0eb38c72002-12-14 23:00:35 +0000149PyObject * libxml_xmlTextReaderPtrWrap(xmlTextReaderPtr reader);
Daniel Veillard96fe0952002-01-30 20:52:23 +0000150
Daniel Veillard3ce52572002-02-03 15:08:05 +0000151xmlXPathObjectPtr libxml_xmlXPathObjectPtrConvert(PyObject * obj);