blob: 168b5b2ae1dd433ebc0268073a1bb9e8741b2134 [file] [log] [blame]
Fredrik Lundhc3345042005-12-13 19:49:55 +00001/* Stuff to export relevant 'expat' entry points from pyexpat to other
2 * parser modules, such as cElementTree. */
3
4/* note: you must import expat.h before importing this module! */
5
Fredrik Lundhd7a42882005-12-13 20:43:04 +00006#define PyExpat_CAPI_MAGIC "pyexpat.expat_CAPI 1.0"
Benjamin Petersonb173f782009-05-05 22:31:58 +00007#define PyExpat_CAPSULE_NAME "pyexpat.expat_CAPI"
Fredrik Lundhc3345042005-12-13 19:49:55 +00008
Fredrik Lundhd7a42882005-12-13 20:43:04 +00009struct PyExpat_CAPI
Fredrik Lundhc3345042005-12-13 19:49:55 +000010{
Fredrik Lundhcc117db2005-12-13 21:55:36 +000011 char* magic; /* set to PyExpat_CAPI_MAGIC */
Fredrik Lundhd7a42882005-12-13 20:43:04 +000012 int size; /* set to sizeof(struct PyExpat_CAPI) */
Fredrik Lundhcc117db2005-12-13 21:55:36 +000013 int MAJOR_VERSION;
Fredrik Lundhc3345042005-12-13 19:49:55 +000014 int MINOR_VERSION;
15 int MICRO_VERSION;
16 /* pointers to selected expat functions. add new functions at
17 the end, if needed */
18 const XML_LChar * (*ErrorString)(enum XML_Error code);
Fredrik Lundhcc117db2005-12-13 21:55:36 +000019 enum XML_Error (*GetErrorCode)(XML_Parser parser);
Thomas Wouters0e3f5912006-08-11 14:57:12 +000020 XML_Size (*GetErrorColumnNumber)(XML_Parser parser);
21 XML_Size (*GetErrorLineNumber)(XML_Parser parser);
Fredrik Lundhc3345042005-12-13 19:49:55 +000022 enum XML_Status (*Parse)(
23 XML_Parser parser, const char *s, int len, int isFinal);
24 XML_Parser (*ParserCreate_MM)(
25 const XML_Char *encoding, const XML_Memory_Handling_Suite *memsuite,
26 const XML_Char *namespaceSeparator);
27 void (*ParserFree)(XML_Parser parser);
28 void (*SetCharacterDataHandler)(
29 XML_Parser parser, XML_CharacterDataHandler handler);
30 void (*SetCommentHandler)(
31 XML_Parser parser, XML_CommentHandler handler);
32 void (*SetDefaultHandlerExpand)(
33 XML_Parser parser, XML_DefaultHandler handler);
34 void (*SetElementHandler)(
35 XML_Parser parser, XML_StartElementHandler start,
36 XML_EndElementHandler end);
37 void (*SetNamespaceDeclHandler)(
38 XML_Parser parser, XML_StartNamespaceDeclHandler start,
39 XML_EndNamespaceDeclHandler end);
40 void (*SetProcessingInstructionHandler)(
41 XML_Parser parser, XML_ProcessingInstructionHandler handler);
42 void (*SetUnknownEncodingHandler)(
43 XML_Parser parser, XML_UnknownEncodingHandler handler,
44 void *encodingHandlerData);
45 void (*SetUserData)(XML_Parser parser, void *userData);
Eli Bendersky2b6b73e2012-06-01 11:32:34 +030046 void (*SetStartDoctypeDeclHandler)(XML_Parser parser,
47 XML_StartDoctypeDeclHandler start);
Fredrik Lundhc3345042005-12-13 19:49:55 +000048 /* always add new stuff to the end! */
49};
50