Fredrik Lundh | c334504 | 2005-12-13 19:49:55 +0000 | [diff] [blame] | 1 | /* 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 Lundh | d7a4288 | 2005-12-13 20:43:04 +0000 | [diff] [blame] | 6 | #define PyExpat_CAPI_MAGIC "pyexpat.expat_CAPI 1.0" |
Benjamin Peterson | b173f78 | 2009-05-05 22:31:58 +0000 | [diff] [blame] | 7 | #define PyExpat_CAPSULE_NAME "pyexpat.expat_CAPI" |
Fredrik Lundh | c334504 | 2005-12-13 19:49:55 +0000 | [diff] [blame] | 8 | |
Fredrik Lundh | d7a4288 | 2005-12-13 20:43:04 +0000 | [diff] [blame] | 9 | struct PyExpat_CAPI |
Fredrik Lundh | c334504 | 2005-12-13 19:49:55 +0000 | [diff] [blame] | 10 | { |
Fredrik Lundh | cc117db | 2005-12-13 21:55:36 +0000 | [diff] [blame] | 11 | char* magic; /* set to PyExpat_CAPI_MAGIC */ |
Fredrik Lundh | d7a4288 | 2005-12-13 20:43:04 +0000 | [diff] [blame] | 12 | int size; /* set to sizeof(struct PyExpat_CAPI) */ |
Fredrik Lundh | cc117db | 2005-12-13 21:55:36 +0000 | [diff] [blame] | 13 | int MAJOR_VERSION; |
Fredrik Lundh | c334504 | 2005-12-13 19:49:55 +0000 | [diff] [blame] | 14 | 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 Lundh | cc117db | 2005-12-13 21:55:36 +0000 | [diff] [blame] | 19 | enum XML_Error (*GetErrorCode)(XML_Parser parser); |
Thomas Wouters | 0e3f591 | 2006-08-11 14:57:12 +0000 | [diff] [blame] | 20 | XML_Size (*GetErrorColumnNumber)(XML_Parser parser); |
| 21 | XML_Size (*GetErrorLineNumber)(XML_Parser parser); |
Fredrik Lundh | c334504 | 2005-12-13 19:49:55 +0000 | [diff] [blame] | 22 | 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); |
| 46 | /* always add new stuff to the end! */ |
| 47 | }; |
| 48 | |