mirror of
https://github.com/libexpat/libexpat.git
synced 2025-04-10 15:01:12 +00:00
Applied patch #835123: Suspend/Resume functionality.
For details check the patch description.
This commit is contained in:
parent
e99be5e232
commit
2335294f7c
6 changed files with 569 additions and 172 deletions
|
@ -67,6 +67,10 @@ EXPORTS
|
|||
_XML_MemMalloc @60
|
||||
_XML_MemRealloc @61
|
||||
_XML_MemFree @62
|
||||
; added with version 1.95.8
|
||||
_XML_StopParser @63
|
||||
_XML_ResumeParser @64
|
||||
_XML_GetParsingStatus @65
|
||||
|
||||
; Aliases for MS compatible names
|
||||
XML_DefaultCurrent = _XML_DefaultCurrent
|
||||
|
@ -131,3 +135,7 @@ EXPORTS
|
|||
XML_MemMalloc = _XML_MemMalloc
|
||||
XML_MemRealloc = _XML_MemRealloc
|
||||
XML_MemFree = _XML_MemFree
|
||||
XML_StopParser = _XML_StopParser
|
||||
XML_ResumeParser = _XML_ResumeParser
|
||||
XML_GetParsingStatus = _XML_GetParsingStatus
|
||||
|
||||
|
|
|
@ -67,6 +67,10 @@ EXPORTS
|
|||
_XML_MemMalloc @60
|
||||
_XML_MemRealloc @61
|
||||
_XML_MemFree @62
|
||||
; added with version 1.95.8
|
||||
_XML_StopParser @63
|
||||
_XML_ResumeParser @64
|
||||
_XML_GetParsingStatus @65
|
||||
|
||||
; Aliases for MS compatible names
|
||||
XML_DefaultCurrent = _XML_DefaultCurrent
|
||||
|
@ -131,3 +135,6 @@ EXPORTS
|
|||
XML_MemMalloc = _XML_MemMalloc
|
||||
XML_MemRealloc = _XML_MemRealloc
|
||||
XML_MemFree = _XML_MemFree
|
||||
XML_StopParser = _XML_StopParser
|
||||
XML_ResumeParser = _XML_ResumeParser
|
||||
XML_GetParsingStatus = _XML_GetParsingStatus
|
||||
|
|
|
@ -127,8 +127,10 @@ typedef unsigned char XML_Bool;
|
|||
enum XML_Status {
|
||||
XML_STATUS_ERROR = 0,
|
||||
#define XML_STATUS_ERROR XML_STATUS_ERROR
|
||||
XML_STATUS_OK = 1
|
||||
XML_STATUS_OK = 1,
|
||||
#define XML_STATUS_OK XML_STATUS_OK
|
||||
XML_STATUS_SUSPENDED = 2,
|
||||
#define XML_STATUS_SUSPENDED XML_STATUS_SUSPENDED
|
||||
};
|
||||
|
||||
enum XML_Error {
|
||||
|
@ -159,7 +161,11 @@ enum XML_Error {
|
|||
XML_ERROR_ENTITY_DECLARED_IN_PE,
|
||||
XML_ERROR_FEATURE_REQUIRES_XML_DTD,
|
||||
XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING,
|
||||
XML_ERROR_UNBOUND_PREFIX
|
||||
XML_ERROR_UNBOUND_PREFIX,
|
||||
XML_ERROR_SUSPENDED,
|
||||
XML_ERROR_NOT_SUSPENDED,
|
||||
XML_ERROR_ABORTED,
|
||||
XML_ERROR_FINISHED
|
||||
};
|
||||
|
||||
enum XML_Content_Type {
|
||||
|
@ -818,6 +824,53 @@ XML_GetBuffer(XML_Parser parser, int len);
|
|||
XMLPARSEAPI(enum XML_Status)
|
||||
XML_ParseBuffer(XML_Parser parser, int len, int isFinal);
|
||||
|
||||
/* Stops parsing, causing XML_Parse() or XML_ParseBuffer() to return as
|
||||
soon as possible, but some handler call-backs - which would otherwise
|
||||
get lost - may still follow. Examples: endElementHandler() for empty
|
||||
elements when stopped in startElementHandler(), endNameSpaceDeclHandler()
|
||||
when stopped in endElementHandler(), and possibly others.
|
||||
|
||||
Can be called from most handlers, including DTD related call-backs.
|
||||
Returns XML_STATUS_OK when successful, XML_STATUS_ERROR otherwise.
|
||||
Possible error codes: XML_ERROR_SUSPENDED, XML_ERROR_FINISHED.
|
||||
When resumable = XML_TRUE then parsing is suspended, that is,
|
||||
XML_Parse() and XML_ParseBuffer() return XML_STATUS_SUSPENDED.
|
||||
Otherwise, parsing is aborted, that is, XML_Parse() and XML_ParseBuffer()
|
||||
return XML_STATUS_ERROR with error code XML_ERROR_ABORTED.
|
||||
|
||||
When suspended, parsing can be resumed by calling XML_ResumeParser().
|
||||
*/
|
||||
XMLPARSEAPI(enum XML_Status)
|
||||
XML_StopParser(XML_Parser parser, XML_Bool resumable);
|
||||
|
||||
/* Resumes parsing after it has been suspended with XML_StopParser().
|
||||
Must not be called from within a handler call-back. Returns same
|
||||
status codes as XML_Parse() or XML_ParseBuffer().
|
||||
Additional error code XML_ERROR_NOT_SUSPENDED possible.
|
||||
*/
|
||||
XMLPARSEAPI(enum XML_Status)
|
||||
XML_ResumeParser(XML_Parser parser);
|
||||
|
||||
enum XML_Parsing {
|
||||
XML_INITIALIZED,
|
||||
XML_PARSING,
|
||||
XML_FINISHED,
|
||||
XML_SUSPENDED
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
enum XML_Parsing parsing;
|
||||
XML_Bool finalBuffer;
|
||||
} XML_ParsingStatus;
|
||||
|
||||
/* Returns status of parser with respect to being initialized, parsing,
|
||||
finished, or suspended and processing the final buffer.
|
||||
XXX XML_Parse() and XML_ParseBuffer() should return XML_ParsingStatus,
|
||||
XXX with XML_FINISHED_OK or XML_FINISHED_ERROR replacing XML_FINISHED
|
||||
*/
|
||||
XMLPARSEAPI(XML_ParsingStatus)
|
||||
XML_GetParsingStatus(XML_Parser parser);
|
||||
|
||||
/* Creates an XML_Parser object that can parse an external general
|
||||
entity; context is a '\0'-terminated string specifying the parse
|
||||
context; encoding is a '\0'-terminated string giving the name of
|
||||
|
|
|
@ -67,3 +67,7 @@ EXPORTS
|
|||
XML_MemMalloc @60
|
||||
XML_MemRealloc @61
|
||||
XML_MemFree @62
|
||||
; added with version 1.95.8
|
||||
XML_StopParser @63
|
||||
XML_ResumeParser @64
|
||||
XML_GetParsingStatus @65
|
||||
|
|
|
@ -67,3 +67,7 @@ EXPORTS
|
|||
XML_MemMalloc @60
|
||||
XML_MemRealloc @61
|
||||
XML_MemFree @62
|
||||
; added with version 1.95.8
|
||||
XML_StopParser @63
|
||||
XML_ResumeParser @64
|
||||
XML_GetParsingStatus @65
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue