blob: 07020b5dc964cb3abeeb7bd14131dce55acc737a [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
Christian Heimescb5778f2018-09-18 14:38:58 +02006#define PyExpat_CAPI_MAGIC "pyexpat.expat_CAPI 1.1"
Benjamin Petersonb173f782009-05-05 22:31:58 +00007#define PyExpat_CAPSULE_NAME "pyexpat.expat_CAPI"
Fredrik Lundhc3345042005-12-13 19:49:55 +00008
Eli Bendersky6dc32b32013-05-25 05:25:48 -07009struct 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);
Serhiy Storchaka66d53fa2013-05-22 17:07:51 +030048 enum XML_Status (*SetEncoding)(XML_Parser parser, const XML_Char *encoding);
Eli Bendersky6dc32b32013-05-25 05:25:48 -070049 int (*DefaultUnknownEncodingHandler)(
50 void *encodingHandlerData, const XML_Char *name, XML_Encoding *info);
Christian Heimescb5778f2018-09-18 14:38:58 +020051 /* might be none for expat < 2.1.0 */
52 int (*SetHashSalt)(XML_Parser parser, unsigned long hash_salt);
Fredrik Lundhc3345042005-12-13 19:49:55 +000053 /* always add new stuff to the end! */
54};
55