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" |
Fredrik Lundh | c334504 | 2005-12-13 19:49:55 +0000 | [diff] [blame] | 7 | |
Fredrik Lundh | d7a4288 | 2005-12-13 20:43:04 +0000 | [diff] [blame] | 8 | struct PyExpat_CAPI |
Fredrik Lundh | c334504 | 2005-12-13 19:49:55 +0000 | [diff] [blame] | 9 | { |
Fredrik Lundh | cc117db | 2005-12-13 21:55:36 +0000 | [diff] [blame] | 10 | char* magic; /* set to PyExpat_CAPI_MAGIC */ |
Fredrik Lundh | d7a4288 | 2005-12-13 20:43:04 +0000 | [diff] [blame] | 11 | int size; /* set to sizeof(struct PyExpat_CAPI) */ |
Fredrik Lundh | cc117db | 2005-12-13 21:55:36 +0000 | [diff] [blame] | 12 | int MAJOR_VERSION; |
Fredrik Lundh | c334504 | 2005-12-13 19:49:55 +0000 | [diff] [blame] | 13 | int MINOR_VERSION; |
| 14 | int MICRO_VERSION; |
| 15 | /* pointers to selected expat functions. add new functions at |
| 16 | the end, if needed */ |
| 17 | const XML_LChar * (*ErrorString)(enum XML_Error code); |
Fredrik Lundh | cc117db | 2005-12-13 21:55:36 +0000 | [diff] [blame] | 18 | enum XML_Error (*GetErrorCode)(XML_Parser parser); |
Thomas Wouters | 0e3f591 | 2006-08-11 14:57:12 +0000 | [diff] [blame^] | 19 | XML_Size (*GetErrorColumnNumber)(XML_Parser parser); |
| 20 | XML_Size (*GetErrorLineNumber)(XML_Parser parser); |
Fredrik Lundh | c334504 | 2005-12-13 19:49:55 +0000 | [diff] [blame] | 21 | enum XML_Status (*Parse)( |
| 22 | XML_Parser parser, const char *s, int len, int isFinal); |
| 23 | XML_Parser (*ParserCreate_MM)( |
| 24 | const XML_Char *encoding, const XML_Memory_Handling_Suite *memsuite, |
| 25 | const XML_Char *namespaceSeparator); |
| 26 | void (*ParserFree)(XML_Parser parser); |
| 27 | void (*SetCharacterDataHandler)( |
| 28 | XML_Parser parser, XML_CharacterDataHandler handler); |
| 29 | void (*SetCommentHandler)( |
| 30 | XML_Parser parser, XML_CommentHandler handler); |
| 31 | void (*SetDefaultHandlerExpand)( |
| 32 | XML_Parser parser, XML_DefaultHandler handler); |
| 33 | void (*SetElementHandler)( |
| 34 | XML_Parser parser, XML_StartElementHandler start, |
| 35 | XML_EndElementHandler end); |
| 36 | void (*SetNamespaceDeclHandler)( |
| 37 | XML_Parser parser, XML_StartNamespaceDeclHandler start, |
| 38 | XML_EndNamespaceDeclHandler end); |
| 39 | void (*SetProcessingInstructionHandler)( |
| 40 | XML_Parser parser, XML_ProcessingInstructionHandler handler); |
| 41 | void (*SetUnknownEncodingHandler)( |
| 42 | XML_Parser parser, XML_UnknownEncodingHandler handler, |
| 43 | void *encodingHandlerData); |
| 44 | void (*SetUserData)(XML_Parser parser, void *userData); |
| 45 | /* always add new stuff to the end! */ |
| 46 | }; |
| 47 | |