mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-28 00:02:28 +00:00
Undiamond Python headers
This change gets the Python codebase into a state where it conforms to the conventions of this codebase. It's now possible to include headers from Python, without worrying about ordering. Python has traditionally solved that problem by "diamonding" everything in Python.h, but that's problematic since it means any change to any Python header invalidates all the build artifacts. Lastly it makes tooling not work. Since it is hard to explain to Emacs when I press C-c C-h to add an import line it shouldn't add the header that actually defines the symbol, and instead do follow the nonstandard Python convention. Progress has been made on letting Python load source code from the zip executable structure via the standard C library APIs. System calss now recognizes zip!FILENAME alternative URIs as equivalent to zip:FILENAME since Python uses colon as its delimiter. Some progress has been made on embedding the notice license terms into the Python object code. This is easier said than done since Python has an extremely complicated ownership story. - Some termios APIs have been added - Implement rewinddir() dirstream API - GetCpuCount() API added to Cosmopolitan Libc - More bugs in Cosmopolitan Libc have been fixed - zipobj.com now has flags for mangling the path - Fixed bug a priori with sendfile() on certain BSDs - Polyfill F_DUPFD and F_DUPFD_CLOEXEC across platforms - FIOCLEX / FIONCLEX now polyfilled for fast O_CLOEXEC changes - APE now supports a hybrid solution to no-self-modify for builds - Many BSD-only magnums added, e.g. O_SEARCH, O_SHLOCK, SF_NODISKIO
This commit is contained in:
parent
20bb8db9f8
commit
b420ed8248
762 changed files with 18410 additions and 53772 deletions
|
@ -1,35 +1,4 @@
|
|||
/* clang-format off */
|
||||
/*
|
||||
__ __ _
|
||||
___\ \/ /_ __ __ _| |_
|
||||
/ _ \\ /| '_ \ / _` | __|
|
||||
| __// \| |_) | (_| | |_
|
||||
\___/_/\_\ .__/ \__,_|\__|
|
||||
|_| XML parser
|
||||
|
||||
Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
|
||||
Copyright (c) 2000-2017 Expat development team
|
||||
Licensed under the MIT license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
persons to whom the Software is furnished to do so, subject to the
|
||||
following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#define ASCII_A 0x41
|
||||
#define ASCII_B 0x42
|
477
third_party/python/Modules/expat/expat.h
vendored
477
third_party/python/Modules/expat/expat.h
vendored
|
@ -1,50 +1,13 @@
|
|||
/* clang-format off */
|
||||
/*
|
||||
__ __ _
|
||||
___\ \/ /_ __ __ _| |_
|
||||
/ _ \\ /| '_ \ / _` | __|
|
||||
| __// \| |_) | (_| | |_
|
||||
\___/_/\_\ .__/ \__,_|\__|
|
||||
|_| XML parser
|
||||
|
||||
Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
|
||||
Copyright (c) 2000-2017 Expat development team
|
||||
Licensed under the MIT license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
persons to whom the Software is furnished to do so, subject to the
|
||||
following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef Expat_INCLUDED
|
||||
#define Expat_INCLUDED 1
|
||||
|
||||
#include "expat_external.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "third_party/python/Modules/expat/expat_external.h"
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
struct XML_ParserStruct;
|
||||
typedef struct XML_ParserStruct *XML_Parser;
|
||||
|
||||
typedef unsigned char XML_Bool;
|
||||
#define XML_TRUE ((XML_Bool)1)
|
||||
#define XML_TRUE ((XML_Bool)1)
|
||||
#define XML_FALSE ((XML_Bool)0)
|
||||
|
||||
/* The XML_Status enum gives the possible return values for several
|
||||
|
@ -166,12 +129,11 @@ struct XML_cp {
|
|||
description of the model argument. It's the caller's responsibility
|
||||
to free model when finished with it.
|
||||
*/
|
||||
typedef void(XMLCALL *XML_ElementDeclHandler)(void *userData,
|
||||
const XML_Char *name,
|
||||
XML_Content *model);
|
||||
typedef void (*XML_ElementDeclHandler)(void *userData, const XML_Char *name,
|
||||
XML_Content *model);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetElementDeclHandler(XML_Parser parser, XML_ElementDeclHandler eldecl);
|
||||
void XML_SetElementDeclHandler(XML_Parser parser,
|
||||
XML_ElementDeclHandler eldecl);
|
||||
|
||||
/* The Attlist declaration handler is called for *each* attribute. So
|
||||
a single Attlist declaration with multiple attributes declared will
|
||||
|
@ -181,12 +143,13 @@ XML_SetElementDeclHandler(XML_Parser parser, XML_ElementDeclHandler eldecl);
|
|||
value will be NULL in the case of "#REQUIRED". If "isrequired" is
|
||||
true and default is non-NULL, then this is a "#FIXED" default.
|
||||
*/
|
||||
typedef void(XMLCALL *XML_AttlistDeclHandler)(
|
||||
void *userData, const XML_Char *elname, const XML_Char *attname,
|
||||
const XML_Char *att_type, const XML_Char *dflt, int isrequired);
|
||||
typedef void (*XML_AttlistDeclHandler)(void *userData, const XML_Char *elname,
|
||||
const XML_Char *attname,
|
||||
const XML_Char *att_type,
|
||||
const XML_Char *dflt, int isrequired);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetAttlistDeclHandler(XML_Parser parser, XML_AttlistDeclHandler attdecl);
|
||||
void XML_SetAttlistDeclHandler(XML_Parser parser,
|
||||
XML_AttlistDeclHandler attdecl);
|
||||
|
||||
/* The XML declaration handler is called for *both* XML declarations
|
||||
and text declarations. The way to distinguish is that the version
|
||||
|
@ -196,13 +159,10 @@ XML_SetAttlistDeclHandler(XML_Parser parser, XML_AttlistDeclHandler attdecl);
|
|||
was no standalone parameter in the declaration, that it was given
|
||||
as no, or that it was given as yes.
|
||||
*/
|
||||
typedef void(XMLCALL *XML_XmlDeclHandler)(void *userData,
|
||||
const XML_Char *version,
|
||||
const XML_Char *encoding,
|
||||
int standalone);
|
||||
typedef void (*XML_XmlDeclHandler)(void *userData, const XML_Char *version,
|
||||
const XML_Char *encoding, int standalone);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetXmlDeclHandler(XML_Parser parser, XML_XmlDeclHandler xmldecl);
|
||||
void XML_SetXmlDeclHandler(XML_Parser parser, XML_XmlDeclHandler xmldecl);
|
||||
|
||||
typedef struct {
|
||||
void *(*malloc_fcn)(size_t size);
|
||||
|
@ -213,8 +173,7 @@ typedef struct {
|
|||
/* Constructs a new parser; encoding is the encoding specified by the
|
||||
external protocol or NULL if there is none specified.
|
||||
*/
|
||||
XMLPARSEAPI(XML_Parser)
|
||||
XML_ParserCreate(const XML_Char *encoding);
|
||||
XML_Parser XML_ParserCreate(const XML_Char *encoding);
|
||||
|
||||
/* Constructs a new parser and namespace processor. Element type
|
||||
names and attribute names that belong to a namespace will be
|
||||
|
@ -227,8 +186,8 @@ XML_ParserCreate(const XML_Char *encoding);
|
|||
It is a programming error to use the separator '\0' with namespace
|
||||
triplets (see XML_SetReturnNSTriplet).
|
||||
*/
|
||||
XMLPARSEAPI(XML_Parser)
|
||||
XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator);
|
||||
XML_Parser XML_ParserCreateNS(const XML_Char *encoding,
|
||||
XML_Char namespaceSeparator);
|
||||
|
||||
/* Constructs a new parser using the memory management suite referred to
|
||||
by memsuite. If memsuite is NULL, then use the standard library memory
|
||||
|
@ -239,10 +198,9 @@ XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator);
|
|||
All further memory operations used for the created parser will come from
|
||||
the given suite.
|
||||
*/
|
||||
XMLPARSEAPI(XML_Parser)
|
||||
XML_ParserCreate_MM(const XML_Char *encoding,
|
||||
const XML_Memory_Handling_Suite *memsuite,
|
||||
const XML_Char *namespaceSeparator);
|
||||
XML_Parser XML_ParserCreate_MM(const XML_Char *encoding,
|
||||
const XML_Memory_Handling_Suite *memsuite,
|
||||
const XML_Char *namespaceSeparator);
|
||||
|
||||
/* Prepare a parser object to be re-used. This is particularly
|
||||
valuable when memory allocation overhead is disproportionately high,
|
||||
|
@ -253,33 +211,30 @@ XML_ParserCreate_MM(const XML_Char *encoding,
|
|||
|
||||
Added in Expat 1.95.3.
|
||||
*/
|
||||
XMLPARSEAPI(XML_Bool)
|
||||
XML_ParserReset(XML_Parser parser, const XML_Char *encoding);
|
||||
XML_Bool XML_ParserReset(XML_Parser parser, const XML_Char *encoding);
|
||||
|
||||
/* atts is array of name/value pairs, terminated by 0;
|
||||
names and values are 0 terminated.
|
||||
*/
|
||||
typedef void(XMLCALL *XML_StartElementHandler)(void *userData,
|
||||
const XML_Char *name,
|
||||
const XML_Char **atts);
|
||||
typedef void (*XML_StartElementHandler)(void *userData, const XML_Char *name,
|
||||
const XML_Char **atts);
|
||||
|
||||
typedef void(XMLCALL *XML_EndElementHandler)(void *userData,
|
||||
const XML_Char *name);
|
||||
typedef void (*XML_EndElementHandler)(void *userData, const XML_Char *name);
|
||||
|
||||
/* s is not 0 terminated. */
|
||||
typedef void(XMLCALL *XML_CharacterDataHandler)(void *userData,
|
||||
const XML_Char *s, int len);
|
||||
typedef void (*XML_CharacterDataHandler)(void *userData, const XML_Char *s,
|
||||
int len);
|
||||
|
||||
/* target and data are 0 terminated */
|
||||
typedef void(XMLCALL *XML_ProcessingInstructionHandler)(void *userData,
|
||||
const XML_Char *target,
|
||||
const XML_Char *data);
|
||||
typedef void (*XML_ProcessingInstructionHandler)(void *userData,
|
||||
const XML_Char *target,
|
||||
const XML_Char *data);
|
||||
|
||||
/* data is 0 terminated */
|
||||
typedef void(XMLCALL *XML_CommentHandler)(void *userData, const XML_Char *data);
|
||||
typedef void (*XML_CommentHandler)(void *userData, const XML_Char *data);
|
||||
|
||||
typedef void(XMLCALL *XML_StartCdataSectionHandler)(void *userData);
|
||||
typedef void(XMLCALL *XML_EndCdataSectionHandler)(void *userData);
|
||||
typedef void (*XML_StartCdataSectionHandler)(void *userData);
|
||||
typedef void (*XML_EndCdataSectionHandler)(void *userData);
|
||||
|
||||
/* This is called for any characters in the XML document for which
|
||||
there is no applicable handler. This includes both characters that
|
||||
|
@ -294,23 +249,22 @@ typedef void(XMLCALL *XML_EndCdataSectionHandler)(void *userData);
|
|||
default handler: for example, a comment might be split between
|
||||
multiple calls.
|
||||
*/
|
||||
typedef void(XMLCALL *XML_DefaultHandler)(void *userData, const XML_Char *s,
|
||||
int len);
|
||||
typedef void (*XML_DefaultHandler)(void *userData, const XML_Char *s, int len);
|
||||
|
||||
/* This is called for the start of the DOCTYPE declaration, before
|
||||
any DTD or internal subset is parsed.
|
||||
*/
|
||||
typedef void(XMLCALL *XML_StartDoctypeDeclHandler)(void *userData,
|
||||
const XML_Char *doctypeName,
|
||||
const XML_Char *sysid,
|
||||
const XML_Char *pubid,
|
||||
int has_internal_subset);
|
||||
typedef void (*XML_StartDoctypeDeclHandler)(void *userData,
|
||||
const XML_Char *doctypeName,
|
||||
const XML_Char *sysid,
|
||||
const XML_Char *pubid,
|
||||
int has_internal_subset);
|
||||
|
||||
/* This is called for the start of the DOCTYPE declaration when the
|
||||
closing > is encountered, but after processing any external
|
||||
subset.
|
||||
*/
|
||||
typedef void(XMLCALL *XML_EndDoctypeDeclHandler)(void *userData);
|
||||
typedef void (*XML_EndDoctypeDeclHandler)(void *userData);
|
||||
|
||||
/* This is called for entity declarations. The is_parameter_entity
|
||||
argument will be non-zero if the entity is a parameter entity, zero
|
||||
|
@ -330,14 +284,13 @@ typedef void(XMLCALL *XML_EndDoctypeDeclHandler)(void *userData);
|
|||
Note that is_parameter_entity can't be changed to XML_Bool, since
|
||||
that would break binary compatibility.
|
||||
*/
|
||||
typedef void(XMLCALL *XML_EntityDeclHandler)(
|
||||
typedef void (*XML_EntityDeclHandler)(
|
||||
void *userData, const XML_Char *entityName, int is_parameter_entity,
|
||||
const XML_Char *value, int value_length, const XML_Char *base,
|
||||
const XML_Char *systemId, const XML_Char *publicId,
|
||||
const XML_Char *notationName);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetEntityDeclHandler(XML_Parser parser, XML_EntityDeclHandler handler);
|
||||
void XML_SetEntityDeclHandler(XML_Parser parser, XML_EntityDeclHandler handler);
|
||||
|
||||
/* OBSOLETE -- OBSOLETE -- OBSOLETE
|
||||
This handler has been superseded by the EntityDeclHandler above.
|
||||
|
@ -348,20 +301,22 @@ XML_SetEntityDeclHandler(XML_Parser parser, XML_EntityDeclHandler handler);
|
|||
entityName, systemId and notationName arguments will never be
|
||||
NULL. The other arguments may be.
|
||||
*/
|
||||
typedef void(XMLCALL *XML_UnparsedEntityDeclHandler)(
|
||||
void *userData, const XML_Char *entityName, const XML_Char *base,
|
||||
const XML_Char *systemId, const XML_Char *publicId,
|
||||
const XML_Char *notationName);
|
||||
typedef void (*XML_UnparsedEntityDeclHandler)(void *userData,
|
||||
const XML_Char *entityName,
|
||||
const XML_Char *base,
|
||||
const XML_Char *systemId,
|
||||
const XML_Char *publicId,
|
||||
const XML_Char *notationName);
|
||||
|
||||
/* This is called for a declaration of notation. The base argument is
|
||||
whatever was set by XML_SetBase. The notationName will never be
|
||||
NULL. The other arguments can be.
|
||||
*/
|
||||
typedef void(XMLCALL *XML_NotationDeclHandler)(void *userData,
|
||||
const XML_Char *notationName,
|
||||
const XML_Char *base,
|
||||
const XML_Char *systemId,
|
||||
const XML_Char *publicId);
|
||||
typedef void (*XML_NotationDeclHandler)(void *userData,
|
||||
const XML_Char *notationName,
|
||||
const XML_Char *base,
|
||||
const XML_Char *systemId,
|
||||
const XML_Char *publicId);
|
||||
|
||||
/* When namespace processing is enabled, these are called once for
|
||||
each namespace declaration. The call to the start and end element
|
||||
|
@ -369,12 +324,12 @@ typedef void(XMLCALL *XML_NotationDeclHandler)(void *userData,
|
|||
declaration handlers. For an xmlns attribute, prefix will be
|
||||
NULL. For an xmlns="" attribute, uri will be NULL.
|
||||
*/
|
||||
typedef void(XMLCALL *XML_StartNamespaceDeclHandler)(void *userData,
|
||||
const XML_Char *prefix,
|
||||
const XML_Char *uri);
|
||||
typedef void (*XML_StartNamespaceDeclHandler)(void *userData,
|
||||
const XML_Char *prefix,
|
||||
const XML_Char *uri);
|
||||
|
||||
typedef void(XMLCALL *XML_EndNamespaceDeclHandler)(void *userData,
|
||||
const XML_Char *prefix);
|
||||
typedef void (*XML_EndNamespaceDeclHandler)(void *userData,
|
||||
const XML_Char *prefix);
|
||||
|
||||
/* This is called if the document is not standalone, that is, it has an
|
||||
external subset or a reference to a parameter entity, but does not
|
||||
|
@ -385,7 +340,7 @@ typedef void(XMLCALL *XML_EndNamespaceDeclHandler)(void *userData,
|
|||
conditions above this handler will only be called if the referenced
|
||||
entity was actually read.
|
||||
*/
|
||||
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData);
|
||||
typedef int (*XML_NotStandaloneHandler)(void *userData);
|
||||
|
||||
/* This is called for a reference to an external parsed general
|
||||
entity. The referenced entity is not automatically parsed. The
|
||||
|
@ -421,25 +376,25 @@ typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData);
|
|||
Note that unlike other handlers the first argument is the parser,
|
||||
not userData.
|
||||
*/
|
||||
typedef int(XMLCALL *XML_ExternalEntityRefHandler)(XML_Parser parser,
|
||||
const XML_Char *context,
|
||||
const XML_Char *base,
|
||||
const XML_Char *systemId,
|
||||
const XML_Char *publicId);
|
||||
typedef int (*XML_ExternalEntityRefHandler)(XML_Parser parser,
|
||||
const XML_Char *context,
|
||||
const XML_Char *base,
|
||||
const XML_Char *systemId,
|
||||
const XML_Char *publicId);
|
||||
|
||||
/* This is called in two situations:
|
||||
1) An entity reference is encountered for which no declaration
|
||||
has been read *and* this is not an error.
|
||||
has been read *and* this is not an error.
|
||||
2) An internal entity reference is read, but not expanded, because
|
||||
XML_SetDefaultHandler has been called.
|
||||
XML_SetDefaultHandler has been called.
|
||||
Note: skipped parameter entities in declarations and skipped general
|
||||
entities in attribute values cannot be reported, because
|
||||
the event would be out of sync with the reporting of the
|
||||
declarations or attribute values
|
||||
entities in attribute values cannot be reported, because
|
||||
the event would be out of sync with the reporting of the
|
||||
declarations or attribute values
|
||||
*/
|
||||
typedef void(XMLCALL *XML_SkippedEntityHandler)(void *userData,
|
||||
const XML_Char *entityName,
|
||||
int is_parameter_entity);
|
||||
typedef void (*XML_SkippedEntityHandler)(void *userData,
|
||||
const XML_Char *entityName,
|
||||
int is_parameter_entity);
|
||||
|
||||
/* This structure is filled in by the XML_UnknownEncodingHandler to
|
||||
provide information to the parser about encodings that are unknown
|
||||
|
@ -476,28 +431,28 @@ typedef void(XMLCALL *XML_SkippedEntityHandler)(void *userData,
|
|||
using this mechanism.
|
||||
|
||||
1. Every ASCII character that can appear in a well-formed XML document,
|
||||
other than the characters
|
||||
other than the characters
|
||||
|
||||
$@\^`{}~
|
||||
$@\^`{}~
|
||||
|
||||
must be represented by a single byte, and that byte must be the
|
||||
same byte that represents that character in ASCII.
|
||||
must be represented by a single byte, and that byte must be the
|
||||
same byte that represents that character in ASCII.
|
||||
|
||||
2. No character may require more than 4 bytes to encode.
|
||||
|
||||
3. All characters encoded must have Unicode scalar values <=
|
||||
0xFFFF, (i.e., characters that would be encoded by surrogates in
|
||||
UTF-16 are not allowed). Note that this restriction doesn't
|
||||
apply to the built-in support for UTF-8 and UTF-16.
|
||||
0xFFFF, (i.e., characters that would be encoded by surrogates in
|
||||
UTF-16 are not allowed). Note that this restriction doesn't
|
||||
apply to the built-in support for UTF-8 and UTF-16.
|
||||
|
||||
4. No Unicode character may be encoded by more than one distinct
|
||||
sequence of bytes.
|
||||
sequence of bytes.
|
||||
*/
|
||||
typedef struct {
|
||||
int map[256];
|
||||
void *data;
|
||||
int(XMLCALL *convert)(void *data, const char *s);
|
||||
void(XMLCALL *release)(void *data);
|
||||
int (*convert)(void *data, const char *s);
|
||||
void (*release)(void *data);
|
||||
} XML_Encoding;
|
||||
|
||||
/* This is called for an encoding that is unknown to the parser.
|
||||
|
@ -515,118 +470,97 @@ typedef struct {
|
|||
If info does not describe a suitable encoding, then the parser will
|
||||
return an XML_UNKNOWN_ENCODING error.
|
||||
*/
|
||||
typedef int(XMLCALL *XML_UnknownEncodingHandler)(void *encodingHandlerData,
|
||||
const XML_Char *name,
|
||||
XML_Encoding *info);
|
||||
typedef int (*XML_UnknownEncodingHandler)(void *encodingHandlerData,
|
||||
const XML_Char *name,
|
||||
XML_Encoding *info);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetElementHandler(XML_Parser parser, XML_StartElementHandler start,
|
||||
XML_EndElementHandler end);
|
||||
void XML_SetElementHandler(XML_Parser parser, XML_StartElementHandler start,
|
||||
XML_EndElementHandler end);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetStartElementHandler(XML_Parser parser, XML_StartElementHandler handler);
|
||||
void XML_SetStartElementHandler(XML_Parser parser,
|
||||
XML_StartElementHandler handler);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetEndElementHandler(XML_Parser parser, XML_EndElementHandler handler);
|
||||
void XML_SetEndElementHandler(XML_Parser parser, XML_EndElementHandler handler);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetCharacterDataHandler(XML_Parser parser,
|
||||
XML_CharacterDataHandler handler);
|
||||
void XML_SetCharacterDataHandler(XML_Parser parser,
|
||||
XML_CharacterDataHandler handler);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetProcessingInstructionHandler(XML_Parser parser,
|
||||
XML_ProcessingInstructionHandler handler);
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetCommentHandler(XML_Parser parser, XML_CommentHandler handler);
|
||||
void XML_SetProcessingInstructionHandler(
|
||||
XML_Parser parser, XML_ProcessingInstructionHandler handler);
|
||||
void XML_SetCommentHandler(XML_Parser parser, XML_CommentHandler handler);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetCdataSectionHandler(XML_Parser parser,
|
||||
XML_StartCdataSectionHandler start,
|
||||
XML_EndCdataSectionHandler end);
|
||||
void XML_SetCdataSectionHandler(XML_Parser parser,
|
||||
XML_StartCdataSectionHandler start,
|
||||
XML_EndCdataSectionHandler end);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetStartCdataSectionHandler(XML_Parser parser,
|
||||
XML_StartCdataSectionHandler start);
|
||||
void XML_SetStartCdataSectionHandler(XML_Parser parser,
|
||||
XML_StartCdataSectionHandler start);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetEndCdataSectionHandler(XML_Parser parser,
|
||||
XML_EndCdataSectionHandler end);
|
||||
void XML_SetEndCdataSectionHandler(XML_Parser parser,
|
||||
XML_EndCdataSectionHandler end);
|
||||
|
||||
/* This sets the default handler and also inhibits expansion of
|
||||
internal entities. These entity references will be passed to the
|
||||
default handler, or to the skipped entity handler, if one is set.
|
||||
*/
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetDefaultHandler(XML_Parser parser, XML_DefaultHandler handler);
|
||||
void XML_SetDefaultHandler(XML_Parser parser, XML_DefaultHandler handler);
|
||||
|
||||
/* This sets the default handler but does not inhibit expansion of
|
||||
internal entities. The entity reference will not be passed to the
|
||||
default handler.
|
||||
*/
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetDefaultHandlerExpand(XML_Parser parser, XML_DefaultHandler handler);
|
||||
void XML_SetDefaultHandlerExpand(XML_Parser parser, XML_DefaultHandler handler);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetDoctypeDeclHandler(XML_Parser parser, XML_StartDoctypeDeclHandler start,
|
||||
XML_EndDoctypeDeclHandler end);
|
||||
void XML_SetDoctypeDeclHandler(XML_Parser parser,
|
||||
XML_StartDoctypeDeclHandler start,
|
||||
XML_EndDoctypeDeclHandler end);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetStartDoctypeDeclHandler(XML_Parser parser,
|
||||
XML_StartDoctypeDeclHandler start);
|
||||
void XML_SetStartDoctypeDeclHandler(XML_Parser parser,
|
||||
XML_StartDoctypeDeclHandler start);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetEndDoctypeDeclHandler(XML_Parser parser, XML_EndDoctypeDeclHandler end);
|
||||
void XML_SetEndDoctypeDeclHandler(XML_Parser parser,
|
||||
XML_EndDoctypeDeclHandler end);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetUnparsedEntityDeclHandler(XML_Parser parser,
|
||||
XML_UnparsedEntityDeclHandler handler);
|
||||
void XML_SetUnparsedEntityDeclHandler(XML_Parser parser,
|
||||
XML_UnparsedEntityDeclHandler handler);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetNotationDeclHandler(XML_Parser parser, XML_NotationDeclHandler handler);
|
||||
void XML_SetNotationDeclHandler(XML_Parser parser,
|
||||
XML_NotationDeclHandler handler);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetNamespaceDeclHandler(XML_Parser parser,
|
||||
XML_StartNamespaceDeclHandler start,
|
||||
XML_EndNamespaceDeclHandler end);
|
||||
void XML_SetNamespaceDeclHandler(XML_Parser parser,
|
||||
XML_StartNamespaceDeclHandler start,
|
||||
XML_EndNamespaceDeclHandler end);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetStartNamespaceDeclHandler(XML_Parser parser,
|
||||
XML_StartNamespaceDeclHandler start);
|
||||
void XML_SetStartNamespaceDeclHandler(XML_Parser parser,
|
||||
XML_StartNamespaceDeclHandler start);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetEndNamespaceDeclHandler(XML_Parser parser,
|
||||
XML_EndNamespaceDeclHandler end);
|
||||
void XML_SetEndNamespaceDeclHandler(XML_Parser parser,
|
||||
XML_EndNamespaceDeclHandler end);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetNotStandaloneHandler(XML_Parser parser,
|
||||
XML_NotStandaloneHandler handler);
|
||||
void XML_SetNotStandaloneHandler(XML_Parser parser,
|
||||
XML_NotStandaloneHandler handler);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetExternalEntityRefHandler(XML_Parser parser,
|
||||
XML_ExternalEntityRefHandler handler);
|
||||
void XML_SetExternalEntityRefHandler(XML_Parser parser,
|
||||
XML_ExternalEntityRefHandler handler);
|
||||
|
||||
/* If a non-NULL value for arg is specified here, then it will be
|
||||
passed as the first argument to the external entity ref handler
|
||||
instead of the parser object.
|
||||
*/
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg);
|
||||
void XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetSkippedEntityHandler(XML_Parser parser,
|
||||
XML_SkippedEntityHandler handler);
|
||||
void XML_SetSkippedEntityHandler(XML_Parser parser,
|
||||
XML_SkippedEntityHandler handler);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetUnknownEncodingHandler(XML_Parser parser,
|
||||
XML_UnknownEncodingHandler handler,
|
||||
void *encodingHandlerData);
|
||||
void XML_SetUnknownEncodingHandler(XML_Parser parser,
|
||||
XML_UnknownEncodingHandler handler,
|
||||
void *encodingHandlerData);
|
||||
|
||||
/* This can be called within a handler for a start element, end
|
||||
element, processing instruction or character data. It causes the
|
||||
corresponding markup to be passed to the default handler.
|
||||
*/
|
||||
XMLPARSEAPI(void)
|
||||
XML_DefaultCurrent(XML_Parser parser);
|
||||
void XML_DefaultCurrent(XML_Parser parser);
|
||||
|
||||
/* If do_nst is non-zero, and namespace processing is in effect, and
|
||||
a name has a prefix (i.e. an explicit namespace qualifier) then
|
||||
|
@ -639,15 +573,13 @@ XML_DefaultCurrent(XML_Parser parser);
|
|||
has a prefix.
|
||||
|
||||
Note: Calling XML_SetReturnNSTriplet after XML_Parse or
|
||||
XML_ParseBuffer has no effect.
|
||||
XML_ParseBuffer has no effect.
|
||||
*/
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetReturnNSTriplet(XML_Parser parser, int do_nst);
|
||||
void XML_SetReturnNSTriplet(XML_Parser parser, int do_nst);
|
||||
|
||||
/* This value is passed as the userData argument to callbacks. */
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetUserData(XML_Parser parser, void *userData);
|
||||
void XML_SetUserData(XML_Parser parser, void *userData);
|
||||
|
||||
/* Returns the last value set by XML_SetUserData or NULL. */
|
||||
#define XML_GetUserData(parser) (*(void **)(parser))
|
||||
|
@ -656,17 +588,15 @@ XML_SetUserData(XML_Parser parser, void *userData);
|
|||
XML_ParserCreate. On success XML_SetEncoding returns non-zero,
|
||||
zero otherwise.
|
||||
Note: Calling XML_SetEncoding after XML_Parse or XML_ParseBuffer
|
||||
has no effect and returns XML_STATUS_ERROR.
|
||||
has no effect and returns XML_STATUS_ERROR.
|
||||
*/
|
||||
XMLPARSEAPI(enum XML_Status)
|
||||
XML_SetEncoding(XML_Parser parser, const XML_Char *encoding);
|
||||
enum XML_Status XML_SetEncoding(XML_Parser parser, const XML_Char *encoding);
|
||||
|
||||
/* If this function is called, then the parser will be passed as the
|
||||
first argument to callbacks instead of userData. The userData will
|
||||
still be accessible using XML_GetUserData.
|
||||
*/
|
||||
XMLPARSEAPI(void)
|
||||
XML_UseParserAsHandlerArg(XML_Parser parser);
|
||||
void XML_UseParserAsHandlerArg(XML_Parser parser);
|
||||
|
||||
/* If useDTD == XML_TRUE is passed to this function, then the parser
|
||||
will assume that there is an external subset, even if none is
|
||||
|
@ -674,21 +604,20 @@ XML_UseParserAsHandlerArg(XML_Parser parser);
|
|||
externalEntityRefHandler with a value of NULL for the systemId
|
||||
argument (the publicId and context arguments will be NULL as well).
|
||||
Note: For the purpose of checking WFC: Entity Declared, passing
|
||||
useDTD == XML_TRUE will make the parser behave as if the document
|
||||
had a DTD with an external subset.
|
||||
useDTD == XML_TRUE will make the parser behave as if the document
|
||||
had a DTD with an external subset.
|
||||
Note: If this function is called, then this must be done before
|
||||
the first call to XML_Parse or XML_ParseBuffer, since it will
|
||||
have no effect after that. Returns
|
||||
XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING.
|
||||
the first call to XML_Parse or XML_ParseBuffer, since it will
|
||||
have no effect after that. Returns
|
||||
XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING.
|
||||
Note: If the document does not have a DOCTYPE declaration at all,
|
||||
then startDoctypeDeclHandler and endDoctypeDeclHandler will not
|
||||
be called, despite an external subset being parsed.
|
||||
then startDoctypeDeclHandler and endDoctypeDeclHandler will not
|
||||
be called, despite an external subset being parsed.
|
||||
Note: If XML_DTD is not defined when Expat is compiled, returns
|
||||
XML_ERROR_FEATURE_REQUIRES_XML_DTD.
|
||||
XML_ERROR_FEATURE_REQUIRES_XML_DTD.
|
||||
Note: If parser == NULL, returns XML_ERROR_INVALID_ARGUMENT.
|
||||
*/
|
||||
XMLPARSEAPI(enum XML_Error)
|
||||
XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD);
|
||||
enum XML_Error XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD);
|
||||
|
||||
/* Sets the base to be used for resolving relative URIs in system
|
||||
identifiers in declarations. Resolving relative identifiers is
|
||||
|
@ -698,11 +627,9 @@ XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD);
|
|||
argument will be copied. Returns XML_STATUS_ERROR if out of memory,
|
||||
XML_STATUS_OK otherwise.
|
||||
*/
|
||||
XMLPARSEAPI(enum XML_Status)
|
||||
XML_SetBase(XML_Parser parser, const XML_Char *base);
|
||||
enum XML_Status XML_SetBase(XML_Parser parser, const XML_Char *base);
|
||||
|
||||
XMLPARSEAPI(const XML_Char *)
|
||||
XML_GetBase(XML_Parser parser);
|
||||
const XML_Char *XML_GetBase(XML_Parser parser);
|
||||
|
||||
/* Returns the number of the attribute/value pairs passed in last call
|
||||
to the XML_StartElementHandler that were specified in the start-tag
|
||||
|
@ -710,8 +637,7 @@ XML_GetBase(XML_Parser parser);
|
|||
this correspondds to an index into the atts array passed to the
|
||||
XML_StartElementHandler. Returns -1 if parser == NULL.
|
||||
*/
|
||||
XMLPARSEAPI(int)
|
||||
XML_GetSpecifiedAttributeCount(XML_Parser parser);
|
||||
int XML_GetSpecifiedAttributeCount(XML_Parser parser);
|
||||
|
||||
/* Returns the index of the ID attribute passed in the last call to
|
||||
XML_StartElementHandler, or -1 if there is no ID attribute or
|
||||
|
@ -719,8 +645,7 @@ XML_GetSpecifiedAttributeCount(XML_Parser parser);
|
|||
correspondds to an index into the atts array passed to the
|
||||
XML_StartElementHandler.
|
||||
*/
|
||||
XMLPARSEAPI(int)
|
||||
XML_GetIdAttributeIndex(XML_Parser parser);
|
||||
int XML_GetIdAttributeIndex(XML_Parser parser);
|
||||
|
||||
#ifdef XML_ATTR_INFO
|
||||
/* Source file byte offsets for the start and end of attribute names and values.
|
||||
|
@ -741,8 +666,7 @@ typedef struct {
|
|||
as 1; thus the number of entries in the array is
|
||||
XML_GetSpecifiedAttributeCount(parser) / 2.
|
||||
*/
|
||||
XMLPARSEAPI(const XML_AttrInfo *)
|
||||
XML_GetAttributeInfo(XML_Parser parser);
|
||||
const XML_AttrInfo *XML_GetAttributeInfo(XML_Parser parser);
|
||||
#endif
|
||||
|
||||
/* Parses some input. Returns XML_STATUS_ERROR if a fatal error is
|
||||
|
@ -754,21 +678,19 @@ XML_GetAttributeInfo(XML_Parser parser);
|
|||
1.95.x series, has always returned exactly one of the XML_Status
|
||||
values.
|
||||
*/
|
||||
XMLPARSEAPI(enum XML_Status)
|
||||
XML_Parse(XML_Parser parser, const char *s, int len, int isFinal);
|
||||
enum XML_Status XML_Parse(XML_Parser parser, const char *s, int len,
|
||||
int isFinal);
|
||||
|
||||
XMLPARSEAPI(void *)
|
||||
XML_GetBuffer(XML_Parser parser, int len);
|
||||
void *XML_GetBuffer(XML_Parser parser, int len);
|
||||
|
||||
XMLPARSEAPI(enum XML_Status)
|
||||
XML_ParseBuffer(XML_Parser parser, int len, int isFinal);
|
||||
enum XML_Status XML_ParseBuffer(XML_Parser parser, int len, int isFinal);
|
||||
|
||||
/* Stops parsing, causing XML_Parse() or XML_ParseBuffer() to return.
|
||||
Must be called from within a call-back handler, except when aborting
|
||||
(resumable = 0) an already suspended parser. Some call-backs may
|
||||
still follow because they would otherwise get lost. Examples:
|
||||
- endElementHandler() for empty elements when stopped in
|
||||
startElementHandler(),
|
||||
startElementHandler(),
|
||||
- endNameSpaceDeclHandler() when stopped in endElementHandler(),
|
||||
and possibly others.
|
||||
|
||||
|
@ -794,8 +716,7 @@ XML_ParseBuffer(XML_Parser parser, int len, int isFinal);
|
|||
|
||||
When suspended, parsing can be resumed by calling XML_ResumeParser().
|
||||
*/
|
||||
XMLPARSEAPI(enum XML_Status)
|
||||
XML_StopParser(XML_Parser parser, XML_Bool resumable);
|
||||
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
|
||||
|
@ -809,8 +730,7 @@ XML_StopParser(XML_Parser parser, XML_Bool resumable);
|
|||
That is, the parent parser will not resume by itself and it is up to the
|
||||
application to call XML_ResumeParser() on it at the appropriate moment.
|
||||
*/
|
||||
XMLPARSEAPI(enum XML_Status)
|
||||
XML_ResumeParser(XML_Parser parser);
|
||||
enum XML_Status XML_ResumeParser(XML_Parser parser);
|
||||
|
||||
enum XML_Parsing { XML_INITIALIZED, XML_PARSING, XML_FINISHED, XML_SUSPENDED };
|
||||
|
||||
|
@ -824,8 +744,7 @@ typedef struct {
|
|||
XXX XML_Parse() and XML_ParseBuffer() should return XML_ParsingStatus,
|
||||
XXX with XML_FINISHED_OK or XML_FINISHED_ERROR replacing XML_FINISHED
|
||||
*/
|
||||
XMLPARSEAPI(void)
|
||||
XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status);
|
||||
void XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status);
|
||||
|
||||
/* Creates an XML_Parser object that can parse an external general
|
||||
entity; context is a '\0'-terminated string specifying the parse
|
||||
|
@ -843,9 +762,9 @@ XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status);
|
|||
initialized from the parser argument. Returns NULL if out of memory.
|
||||
Otherwise returns a new XML_Parser object.
|
||||
*/
|
||||
XMLPARSEAPI(XML_Parser)
|
||||
XML_ExternalEntityParserCreate(XML_Parser parser, const XML_Char *context,
|
||||
const XML_Char *encoding);
|
||||
XML_Parser XML_ExternalEntityParserCreate(XML_Parser parser,
|
||||
const XML_Char *context,
|
||||
const XML_Char *encoding);
|
||||
|
||||
enum XML_ParamEntityParsing {
|
||||
XML_PARAM_ENTITY_PARSING_NEVER,
|
||||
|
@ -874,12 +793,11 @@ enum XML_ParamEntityParsing {
|
|||
XML_SetParamEntityParsing will return 0 if parsing of parameter
|
||||
entities is requested; otherwise it will return non-zero.
|
||||
Note: If XML_SetParamEntityParsing is called after XML_Parse or
|
||||
XML_ParseBuffer, then it has no effect and will always return 0.
|
||||
XML_ParseBuffer, then it has no effect and will always return 0.
|
||||
Note: If parser == NULL, the function will do nothing and return 0.
|
||||
*/
|
||||
XMLPARSEAPI(int)
|
||||
XML_SetParamEntityParsing(XML_Parser parser,
|
||||
enum XML_ParamEntityParsing parsing);
|
||||
int XML_SetParamEntityParsing(XML_Parser parser,
|
||||
enum XML_ParamEntityParsing parsing);
|
||||
|
||||
/* Sets the hash salt to use for internal hash calculations.
|
||||
Helps in preventing DoS attacks based on predicting hash
|
||||
|
@ -887,14 +805,12 @@ XML_SetParamEntityParsing(XML_Parser parser,
|
|||
Returns 1 if successful, 0 when called after parsing has started.
|
||||
Note: If parser == NULL, the function will do nothing and return 0.
|
||||
*/
|
||||
XMLPARSEAPI(int)
|
||||
XML_SetHashSalt(XML_Parser parser, unsigned long hash_salt);
|
||||
int XML_SetHashSalt(XML_Parser parser, unsigned long hash_salt);
|
||||
|
||||
/* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then
|
||||
XML_GetErrorCode returns information about the error.
|
||||
*/
|
||||
XMLPARSEAPI(enum XML_Error)
|
||||
XML_GetErrorCode(XML_Parser parser);
|
||||
enum XML_Error XML_GetErrorCode(XML_Parser parser);
|
||||
|
||||
/* These functions return information about the current parse
|
||||
location. They may be called from any callback called to report
|
||||
|
@ -916,15 +832,14 @@ XML_GetErrorCode(XML_Parser parser);
|
|||
return 0 to indicate an error.
|
||||
Note: XML_GetCurrentByteIndex returns -1 to indicate an error.
|
||||
*/
|
||||
XMLPARSEAPI(XML_Size) XML_GetCurrentLineNumber(XML_Parser parser);
|
||||
XMLPARSEAPI(XML_Size) XML_GetCurrentColumnNumber(XML_Parser parser);
|
||||
XMLPARSEAPI(XML_Index) XML_GetCurrentByteIndex(XML_Parser parser);
|
||||
XML_Size XML_GetCurrentLineNumber(XML_Parser parser);
|
||||
XML_Size XML_GetCurrentColumnNumber(XML_Parser parser);
|
||||
XML_Index XML_GetCurrentByteIndex(XML_Parser parser);
|
||||
|
||||
/* Return the number of bytes in the current event.
|
||||
Returns 0 if the event is in an internal entity.
|
||||
*/
|
||||
XMLPARSEAPI(int)
|
||||
XML_GetCurrentByteCount(XML_Parser parser);
|
||||
int XML_GetCurrentByteCount(XML_Parser parser);
|
||||
|
||||
/* If XML_CONTEXT_BYTES is defined, returns the input buffer, sets
|
||||
the integer pointed to by offset to the offset within this buffer
|
||||
|
@ -936,42 +851,33 @@ XML_GetCurrentByteCount(XML_Parser parser);
|
|||
NOTE: The character pointer returned should not be used outside
|
||||
the handler that makes the call.
|
||||
*/
|
||||
XMLPARSEAPI(const char *)
|
||||
XML_GetInputContext(XML_Parser parser, int *offset, int *size);
|
||||
const char *XML_GetInputContext(XML_Parser parser, int *offset, int *size);
|
||||
|
||||
/* For backwards compatibility with previous versions. */
|
||||
#define XML_GetErrorLineNumber XML_GetCurrentLineNumber
|
||||
#define XML_GetErrorLineNumber XML_GetCurrentLineNumber
|
||||
#define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber
|
||||
#define XML_GetErrorByteIndex XML_GetCurrentByteIndex
|
||||
#define XML_GetErrorByteIndex XML_GetCurrentByteIndex
|
||||
|
||||
/* Frees the content model passed to the element declaration handler */
|
||||
XMLPARSEAPI(void)
|
||||
XML_FreeContentModel(XML_Parser parser, XML_Content *model);
|
||||
void XML_FreeContentModel(XML_Parser parser, XML_Content *model);
|
||||
|
||||
/* Exposing the memory handling functions used in Expat */
|
||||
XMLPARSEAPI(void *)
|
||||
XML_ATTR_MALLOC
|
||||
XML_ATTR_ALLOC_SIZE(2)
|
||||
XML_MemMalloc(XML_Parser parser, size_t size);
|
||||
void *XML_ATTR_MALLOC XML_ATTR_ALLOC_SIZE(2)
|
||||
XML_MemMalloc(XML_Parser parser, size_t size);
|
||||
|
||||
XMLPARSEAPI(void *)
|
||||
XML_ATTR_ALLOC_SIZE(3)
|
||||
XML_MemRealloc(XML_Parser parser, void *ptr, size_t size);
|
||||
void *XML_ATTR_ALLOC_SIZE(3)
|
||||
XML_MemRealloc(XML_Parser parser, void *ptr, size_t size);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_MemFree(XML_Parser parser, void *ptr);
|
||||
void XML_MemFree(XML_Parser parser, void *ptr);
|
||||
|
||||
/* Frees memory used by the parser. */
|
||||
XMLPARSEAPI(void)
|
||||
XML_ParserFree(XML_Parser parser);
|
||||
void XML_ParserFree(XML_Parser parser);
|
||||
|
||||
/* Returns a string describing the error. */
|
||||
XMLPARSEAPI(const XML_LChar *)
|
||||
XML_ErrorString(enum XML_Error code);
|
||||
const XML_LChar *XML_ErrorString(enum XML_Error code);
|
||||
|
||||
/* Return a string containing the version number of this expat */
|
||||
XMLPARSEAPI(const XML_LChar *)
|
||||
XML_ExpatVersion(void);
|
||||
const XML_LChar *XML_ExpatVersion(void);
|
||||
|
||||
typedef struct {
|
||||
int major;
|
||||
|
@ -982,8 +888,7 @@ typedef struct {
|
|||
/* Return an XML_Expat_Version structure containing numeric version
|
||||
number information for this version of expat.
|
||||
*/
|
||||
XMLPARSEAPI(XML_Expat_Version)
|
||||
XML_ExpatVersionInfo(void);
|
||||
XML_Expat_Version XML_ExpatVersionInfo(void);
|
||||
|
||||
/* Added in Expat 1.95.5. */
|
||||
enum XML_FeatureEnum {
|
||||
|
@ -1007,8 +912,7 @@ typedef struct {
|
|||
long int value;
|
||||
} XML_Feature;
|
||||
|
||||
XMLPARSEAPI(const XML_Feature *)
|
||||
XML_GetFeatureList(void);
|
||||
const XML_Feature *XML_GetFeatureList(void);
|
||||
|
||||
/* Expat follows the semantic versioning convention.
|
||||
See http://semver.org.
|
||||
|
@ -1017,8 +921,5 @@ XML_GetFeatureList(void);
|
|||
#define XML_MINOR_VERSION 2
|
||||
#define XML_MICRO_VERSION 8
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* not Expat_INCLUDED */
|
||||
|
|
144
third_party/python/Modules/expat/expat_external.h
vendored
144
third_party/python/Modules/expat/expat_external.h
vendored
|
@ -1,111 +1,8 @@
|
|||
/* clang-format off */
|
||||
/*
|
||||
__ __ _
|
||||
___\ \/ /_ __ __ _| |_
|
||||
/ _ \\ /| '_ \ / _` | __|
|
||||
| __// \| |_) | (_| | |_
|
||||
\___/_/\_\ .__/ \__,_|\__|
|
||||
|_| XML parser
|
||||
|
||||
Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
|
||||
Copyright (c) 2000-2017 Expat development team
|
||||
Licensed under the MIT license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
persons to whom the Software is furnished to do so, subject to the
|
||||
following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef Expat_External_INCLUDED
|
||||
#define Expat_External_INCLUDED 1
|
||||
|
||||
/* External API definitions */
|
||||
|
||||
/* Expat tries very hard to make the API boundary very specifically
|
||||
defined. There are two macros defined to control this boundary;
|
||||
each of these can be defined before including this header to
|
||||
achieve some different behavior, but doing so it not recommended or
|
||||
tested frequently.
|
||||
|
||||
XMLCALL - The calling convention to use for all calls across the
|
||||
"library boundary." This will default to cdecl, and
|
||||
try really hard to tell the compiler that's what we
|
||||
want.
|
||||
|
||||
XMLIMPORT - Whatever magic is needed to note that a function is
|
||||
to be imported from a dynamically loaded library
|
||||
(.dll, .so, or .sl, depending on your platform).
|
||||
|
||||
The XMLCALL macro was added in Expat 1.95.7. The only one which is
|
||||
expected to be directly useful in client code is XMLCALL.
|
||||
|
||||
Note that on at least some Unix versions, the Expat library must be
|
||||
compiled with the cdecl calling convention as the default since
|
||||
system headers may assume the cdecl convention.
|
||||
*/
|
||||
|
||||
/* Namespace external symbols to allow multiple libexpat version to
|
||||
co-exist. */
|
||||
#include "pyexpatns.h"
|
||||
|
||||
#ifndef XMLCALL
|
||||
# if defined(_MSC_VER)
|
||||
# define XMLCALL __cdecl
|
||||
# elif defined(__GNUC__) && defined(__i386) && ! defined(__INTEL_COMPILER)
|
||||
# define XMLCALL __attribute__((cdecl))
|
||||
# else
|
||||
/* For any platform which uses this definition and supports more than
|
||||
one calling convention, we need to extend this definition to
|
||||
declare the convention used on that platform, if it's possible to
|
||||
do so.
|
||||
|
||||
If this is the case for your platform, please file a bug report
|
||||
with information on how to identify your platform via the C
|
||||
pre-processor and how to specify the same calling convention as the
|
||||
platform's malloc() implementation.
|
||||
*/
|
||||
# define XMLCALL
|
||||
# endif
|
||||
#endif /* not defined XMLCALL */
|
||||
|
||||
#if ! defined(XML_STATIC) && ! defined(XMLIMPORT)
|
||||
# ifndef XML_BUILDING_EXPAT
|
||||
/* using Expat from an application */
|
||||
|
||||
# if defined(_MSC_EXTENSIONS) && ! defined(__BEOS__) && ! defined(__CYGWIN__)
|
||||
# define XMLIMPORT __declspec(dllimport)
|
||||
# endif
|
||||
|
||||
# endif
|
||||
#endif /* not defined XML_STATIC */
|
||||
|
||||
#ifndef XML_ENABLE_VISIBILITY
|
||||
# define XML_ENABLE_VISIBILITY 0
|
||||
#endif
|
||||
|
||||
#if ! defined(XMLIMPORT) && XML_ENABLE_VISIBILITY
|
||||
# define XMLIMPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
/* If we didn't define it above, define it away: */
|
||||
#ifndef XMLIMPORT
|
||||
# define XMLIMPORT
|
||||
#endif
|
||||
#include "third_party/python/Modules/expat/pyexpatns.h"
|
||||
COSMOPOLITAN_C_START_
|
||||
/* clang-format off */
|
||||
|
||||
#if defined(__GNUC__) \
|
||||
&& (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96))
|
||||
|
@ -121,44 +18,11 @@
|
|||
# define XML_ATTR_ALLOC_SIZE(x)
|
||||
#endif
|
||||
|
||||
#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef XML_UNICODE_WCHAR_T
|
||||
# ifndef XML_UNICODE
|
||||
# define XML_UNICODE
|
||||
# endif
|
||||
# if defined(__SIZEOF_WCHAR_T__) && (__SIZEOF_WCHAR_T__ != 2)
|
||||
# error "sizeof(wchar_t) != 2; Need -fshort-wchar for both Expat and libc"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef XML_UNICODE /* Information is UTF-16 encoded. */
|
||||
# ifdef XML_UNICODE_WCHAR_T
|
||||
typedef wchar_t XML_Char;
|
||||
typedef wchar_t XML_LChar;
|
||||
# else
|
||||
typedef unsigned short XML_Char;
|
||||
typedef char XML_LChar;
|
||||
# endif /* XML_UNICODE_WCHAR_T */
|
||||
#else /* Information is UTF-8 encoded. */
|
||||
typedef char XML_Char;
|
||||
typedef char XML_LChar;
|
||||
#endif /* XML_UNICODE */
|
||||
|
||||
#ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */
|
||||
typedef long long XML_Index;
|
||||
typedef unsigned long long XML_Size;
|
||||
#else
|
||||
typedef long XML_Index;
|
||||
typedef unsigned long XML_Size;
|
||||
#endif /* XML_LARGE_SIZE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* not Expat_External_INCLUDED */
|
||||
|
|
|
@ -1,22 +1,6 @@
|
|||
/* clang-format off */
|
||||
/* internal.h
|
||||
|
||||
Internal definitions used by Expat. This is not needed to compile
|
||||
client code.
|
||||
|
||||
The following calling convention macros are defined for frequently
|
||||
called functions:
|
||||
|
||||
FASTCALL - Used for those internal functions that have a simple
|
||||
body and a low number of arguments and local variables.
|
||||
|
||||
PTRCALL - Used for functions called though function pointers.
|
||||
|
||||
PTRFASTCALL - Like PTRCALL, but for low number of arguments.
|
||||
|
||||
inline - Used for selected internal functions for which inlining
|
||||
may improve performance on some platforms.
|
||||
|
||||
Note: Use of these macros is based on judgement, not hard rules,
|
||||
and therefore subject to change.
|
||||
__ __ _
|
||||
|
@ -74,18 +58,6 @@
|
|||
|
||||
/* Make sure all of these are defined if they aren't already. */
|
||||
|
||||
#ifndef FASTCALL
|
||||
# define FASTCALL
|
||||
#endif
|
||||
|
||||
#ifndef PTRCALL
|
||||
# define PTRCALL
|
||||
#endif
|
||||
|
||||
#ifndef PTRFASTCALL
|
||||
# define PTRFASTCALL
|
||||
#endif
|
||||
|
||||
#ifndef XML_MIN_SIZE
|
||||
# if ! defined(__cplusplus) && ! defined(inline)
|
||||
# ifdef __GNUC__
|
41
third_party/python/Modules/expat/pyexpatns.h
vendored
41
third_party/python/Modules/expat/pyexpatns.h
vendored
|
@ -1,43 +1,6 @@
|
|||
/* clang-format off */
|
||||
/* Copyright (c) 2005-2006 ActiveState Software Inc.
|
||||
*
|
||||
* Namespace all expat exported symbols to avoid dynamic loading symbol
|
||||
* collisions when embedding Python.
|
||||
*
|
||||
* The Problem:
|
||||
* - you embed Python in some app
|
||||
* - the app dynamically loads libexpat of version X
|
||||
* - the embedded Python imports pyexpat (which was built against
|
||||
* libexpat version X+n)
|
||||
* --> pyexpat gets the expat symbols from the already loaded and *older*
|
||||
* libexpat: crash (Specifically the crash we observed was in
|
||||
* getting an old XML_ErrorString (from xmlparse.c) and then calling
|
||||
* it with newer values in the XML_Error enum:
|
||||
*
|
||||
* // pyexpat.c, line 1970
|
||||
* ...
|
||||
* // Added in Expat 1.95.7.
|
||||
* MYCONST(XML_ERROR_UNBOUND_PREFIX);
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* The Solution:
|
||||
* Prefix all exported symbols with "PyExpat_". This is similar to
|
||||
* what Mozilla does for some common libs:
|
||||
* http://lxr.mozilla.org/seamonkey/source/modules/libimg/png/mozpngconf.h#115
|
||||
*
|
||||
* The list of relevant exported symbols can be had with this command:
|
||||
*
|
||||
nm pyexpat.so \
|
||||
| grep -v " [a-zBUA] " \
|
||||
| grep -v "_fini\|_init\|initpyexpat"
|
||||
*
|
||||
* If any of those symbols are NOT prefixed with "PyExpat_" then
|
||||
* a #define should be added for it here.
|
||||
*/
|
||||
|
||||
#ifndef PYEXPATNS_H
|
||||
#define PYEXPATNS_H
|
||||
/* clang-format off */
|
||||
|
||||
#define XML_DefaultCurrent PyExpat_XML_DefaultCurrent
|
||||
#define XML_ErrorString PyExpat_XML_ErrorString
|
||||
|
@ -121,6 +84,4 @@
|
|||
#define XmlUtf16Encode PyExpat_XmlUtf16Encode
|
||||
#define XmlUtf8Encode PyExpat_XmlUtf8Encode
|
||||
|
||||
|
||||
#endif /* !PYEXPATNS_H */
|
||||
|
||||
|
|
57
third_party/python/Modules/expat/winconfig.h
vendored
57
third_party/python/Modules/expat/winconfig.h
vendored
|
@ -1,57 +0,0 @@
|
|||
/* clang-format off */
|
||||
/*
|
||||
__ __ _
|
||||
___\ \/ /_ __ __ _| |_
|
||||
/ _ \\ /| '_ \ / _` | __|
|
||||
| __// \| |_) | (_| | |_
|
||||
\___/_/\_\ .__/ \__,_|\__|
|
||||
|_| XML parser
|
||||
|
||||
Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
|
||||
Copyright (c) 2000-2017 Expat development team
|
||||
Licensed under the MIT license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
persons to whom the Software is furnished to do so, subject to the
|
||||
following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef WINCONFIG_H
|
||||
#define WINCONFIG_H
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
|
||||
#include <memory.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(HAVE_EXPAT_CONFIG_H) /* e.g. MinGW */
|
||||
# include <expat_config.h>
|
||||
#else /* !defined(HAVE_EXPAT_CONFIG_H) */
|
||||
|
||||
# define XML_NS 1
|
||||
# define XML_DTD 1
|
||||
# define XML_CONTEXT_BYTES 1024
|
||||
|
||||
/* we will assume all Windows platforms are little endian */
|
||||
# define BYTEORDER 1234
|
||||
|
||||
#endif /* !defined(HAVE_EXPAT_CONFIG_H) */
|
||||
|
||||
#endif /* ndef WINCONFIG_H */
|
321
third_party/python/Modules/expat/xmlparse.c
vendored
321
third_party/python/Modules/expat/xmlparse.c
vendored
|
@ -31,14 +31,11 @@
|
|||
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#if !defined(_GNU_SOURCE)
|
||||
#define _GNU_SOURCE 1 /* syscall prototype */
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
/* force stdlib to define rand_s() */
|
||||
#define _CRT_RAND_S
|
||||
#endif
|
||||
asm(".ident\t\"\\n\\n\
|
||||
expat (MIT License)\\n\
|
||||
Copyright (c) 1997-2000 Thai Open Source Software Center Ltd\\n\
|
||||
Copyright (c) 2000-2017 Expat development team\"");
|
||||
asm(".include \"libc/disclaimer.inc\"");
|
||||
|
||||
#define XML_BUILDING_EXPAT 1
|
||||
|
||||
|
@ -55,12 +52,12 @@
|
|||
#include "libc/calls/calls.h"
|
||||
#include "libc/assert.h"
|
||||
#include "libc/limits.h"
|
||||
#include "expat_config.h"
|
||||
#include "third_party/python/Modules/expat/expat_config.h"
|
||||
#endif
|
||||
|
||||
#include "ascii.h"
|
||||
#include "expat.h"
|
||||
#include "siphash.h"
|
||||
#include "third_party/python/Modules/expat/ascii.inc"
|
||||
#include "third_party/python/Modules/expat/expat.h"
|
||||
#include "third_party/python/Modules/expat/siphash.inc"
|
||||
|
||||
#if defined(_WIN32) && !defined(LOAD_LIBRARY_SEARCH_SYSTEM32)
|
||||
#define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800
|
||||
|
@ -119,9 +116,9 @@ typedef char ICHAR;
|
|||
/* Do safe (NULL-aware) pointer arithmetic */
|
||||
#define EXPAT_SAFE_PTR_DIFF(p, q) (((p) && (q)) ? ((p) - (q)) : 0)
|
||||
|
||||
#include "internal.h"
|
||||
#include "xmlrole.h"
|
||||
#include "xmltok.h"
|
||||
#include "third_party/python/Modules/expat/internal.inc"
|
||||
#include "third_party/python/Modules/expat/xmlrole.h"
|
||||
#include "third_party/python/Modules/expat/xmltok.h"
|
||||
|
||||
typedef const XML_Char *KEY;
|
||||
|
||||
|
@ -324,7 +321,7 @@ typedef struct open_internal_entity {
|
|||
XML_Bool betweenDecl; /* WFC: PE Between Declarations */
|
||||
} OPEN_INTERNAL_ENTITY;
|
||||
|
||||
typedef enum XML_Error PTRCALL Processor(XML_Parser parser, const char *start,
|
||||
typedef enum XML_Error Processor(XML_Parser parser, const char *start,
|
||||
const char *end, const char **endPtr);
|
||||
|
||||
static Processor prologProcessor;
|
||||
|
@ -401,7 +398,7 @@ static void reportDefault(XML_Parser parser, const ENCODING *enc,
|
|||
static const XML_Char *getContext(XML_Parser parser);
|
||||
static XML_Bool setContext(XML_Parser parser, const XML_Char *context);
|
||||
|
||||
static void FASTCALL normalizePublicId(XML_Char *s);
|
||||
static void normalizePublicId(XML_Char *s);
|
||||
|
||||
static DTD *dtdCreate(const XML_Memory_Handling_Suite *ms);
|
||||
/* do not call if m_parentParser != NULL */
|
||||
|
@ -414,30 +411,30 @@ static int copyEntityTable(XML_Parser oldParser, HASH_TABLE *, STRING_POOL *,
|
|||
const HASH_TABLE *);
|
||||
static NAMED *lookup(XML_Parser parser, HASH_TABLE *table, KEY name,
|
||||
size_t createSize);
|
||||
static void FASTCALL hashTableInit(HASH_TABLE *,
|
||||
static void hashTableInit(HASH_TABLE *,
|
||||
const XML_Memory_Handling_Suite *ms);
|
||||
static void FASTCALL hashTableClear(HASH_TABLE *);
|
||||
static void FASTCALL hashTableDestroy(HASH_TABLE *);
|
||||
static void FASTCALL hashTableIterInit(HASH_TABLE_ITER *, const HASH_TABLE *);
|
||||
static NAMED *FASTCALL hashTableIterNext(HASH_TABLE_ITER *);
|
||||
static void hashTableClear(HASH_TABLE *);
|
||||
static void hashTableDestroy(HASH_TABLE *);
|
||||
static void hashTableIterInit(HASH_TABLE_ITER *, const HASH_TABLE *);
|
||||
static NAMED *hashTableIterNext(HASH_TABLE_ITER *);
|
||||
|
||||
static void FASTCALL poolInit(STRING_POOL *,
|
||||
static void poolInit(STRING_POOL *,
|
||||
const XML_Memory_Handling_Suite *ms);
|
||||
static void FASTCALL poolClear(STRING_POOL *);
|
||||
static void FASTCALL poolDestroy(STRING_POOL *);
|
||||
static void poolClear(STRING_POOL *);
|
||||
static void poolDestroy(STRING_POOL *);
|
||||
static XML_Char *poolAppend(STRING_POOL *pool, const ENCODING *enc,
|
||||
const char *ptr, const char *end);
|
||||
static XML_Char *poolStoreString(STRING_POOL *pool, const ENCODING *enc,
|
||||
const char *ptr, const char *end);
|
||||
static XML_Bool FASTCALL poolGrow(STRING_POOL *pool);
|
||||
static const XML_Char *FASTCALL poolCopyString(STRING_POOL *pool,
|
||||
static XML_Bool poolGrow(STRING_POOL *pool);
|
||||
static const XML_Char *poolCopyString(STRING_POOL *pool,
|
||||
const XML_Char *s);
|
||||
static const XML_Char *poolCopyStringN(STRING_POOL *pool, const XML_Char *s,
|
||||
int n);
|
||||
static const XML_Char *FASTCALL poolAppendString(STRING_POOL *pool,
|
||||
static const XML_Char *poolAppendString(STRING_POOL *pool,
|
||||
const XML_Char *s);
|
||||
|
||||
static int FASTCALL nextScaffoldPart(XML_Parser parser);
|
||||
static int nextScaffoldPart(XML_Parser parser);
|
||||
static XML_Content *build_model(XML_Parser parser);
|
||||
static ELEMENT_TYPE *getElementType(XML_Parser parser, const ENCODING *enc,
|
||||
const char *ptr, const char *end);
|
||||
|
@ -515,7 +512,7 @@ struct XML_ParserStruct {
|
|||
void *m_unknownEncodingMem;
|
||||
void *m_unknownEncodingData;
|
||||
void *m_unknownEncodingHandlerData;
|
||||
void(XMLCALL *m_unknownEncodingRelease)(void *);
|
||||
void(*m_unknownEncodingRelease)(void *);
|
||||
PROLOG_STATE m_prologState;
|
||||
Processor *m_processor;
|
||||
enum XML_Error m_errorCode;
|
||||
|
@ -573,12 +570,12 @@ struct XML_ParserStruct {
|
|||
#define REALLOC(parser, p, s) (parser->m_mem.realloc_fcn((p), (s)))
|
||||
#define FREE(parser, p) (parser->m_mem.free_fcn((p)))
|
||||
|
||||
XML_Parser XMLCALL XML_ParserCreate(const XML_Char *encodingName) {
|
||||
XML_Parser XML_ParserCreate(const XML_Char *encodingName) {
|
||||
return XML_ParserCreate_MM(encodingName, NULL, NULL);
|
||||
}
|
||||
|
||||
XML_Parser XMLCALL XML_ParserCreateNS(const XML_Char *encodingName,
|
||||
XML_Char nsSep) {
|
||||
XML_Parser XML_ParserCreateNS(const XML_Char *encodingName,
|
||||
XML_Char nsSep) {
|
||||
XML_Char tmp[2];
|
||||
*tmp = nsSep;
|
||||
return XML_ParserCreate_MM(encodingName, NULL, tmp);
|
||||
|
@ -802,7 +799,7 @@ startParsing(XML_Parser parser) {
|
|||
return XML_TRUE;
|
||||
}
|
||||
|
||||
XML_Parser XMLCALL XML_ParserCreate_MM(
|
||||
XML_Parser XML_ParserCreate_MM(
|
||||
const XML_Char *encodingName, const XML_Memory_Handling_Suite *memsuite,
|
||||
const XML_Char *nameSep) {
|
||||
return parserCreate(encodingName, memsuite, nameSep, NULL);
|
||||
|
@ -968,7 +965,7 @@ static void parserInit(XML_Parser parser, const XML_Char *encodingName) {
|
|||
parser->m_declNotationPublicId = NULL;
|
||||
parser->m_declAttributeIsCdata = XML_FALSE;
|
||||
parser->m_declAttributeIsId = XML_FALSE;
|
||||
memset(&parser->m_position, 0, sizeof(POSITION));
|
||||
bzero(&parser->m_position, sizeof(POSITION));
|
||||
parser->m_errorCode = XML_ERROR_NONE;
|
||||
parser->m_eventPtr = NULL;
|
||||
parser->m_eventEndPtr = NULL;
|
||||
|
@ -993,7 +990,7 @@ static void parserInit(XML_Parser parser, const XML_Char *encodingName) {
|
|||
}
|
||||
|
||||
/* moves list of bindings to m_freeBindingList */
|
||||
static void FASTCALL moveToFreeBindingList(XML_Parser parser,
|
||||
static void moveToFreeBindingList(XML_Parser parser,
|
||||
BINDING *bindings) {
|
||||
while (bindings) {
|
||||
BINDING *b = bindings;
|
||||
|
@ -1003,7 +1000,7 @@ static void FASTCALL moveToFreeBindingList(XML_Parser parser,
|
|||
}
|
||||
}
|
||||
|
||||
XML_Bool XMLCALL XML_ParserReset(XML_Parser parser,
|
||||
XML_Bool XML_ParserReset(XML_Parser parser,
|
||||
const XML_Char *encodingName) {
|
||||
TAG *tStk;
|
||||
OPEN_INTERNAL_ENTITY *openEntityList;
|
||||
|
@ -1042,7 +1039,7 @@ XML_Bool XMLCALL XML_ParserReset(XML_Parser parser,
|
|||
return XML_TRUE;
|
||||
}
|
||||
|
||||
enum XML_Status XMLCALL XML_SetEncoding(XML_Parser parser,
|
||||
enum XML_Status XML_SetEncoding(XML_Parser parser,
|
||||
const XML_Char *encodingName) {
|
||||
if (parser == NULL) return XML_STATUS_ERROR;
|
||||
/* Block after XML_Parse()/XML_ParseBuffer() has been called.
|
||||
|
@ -1066,7 +1063,7 @@ enum XML_Status XMLCALL XML_SetEncoding(XML_Parser parser,
|
|||
return XML_STATUS_OK;
|
||||
}
|
||||
|
||||
XML_Parser XMLCALL
|
||||
XML_Parser
|
||||
XML_ExternalEntityParserCreate(XML_Parser oldParser, const XML_Char *context,
|
||||
const XML_Char *encodingName) {
|
||||
XML_Parser parser = oldParser;
|
||||
|
@ -1232,7 +1229,7 @@ XML_ExternalEntityParserCreate(XML_Parser oldParser, const XML_Char *context,
|
|||
return parser;
|
||||
}
|
||||
|
||||
static void FASTCALL destroyBindings(BINDING *bindings, XML_Parser parser) {
|
||||
static void destroyBindings(BINDING *bindings, XML_Parser parser) {
|
||||
for (;;) {
|
||||
BINDING *b = bindings;
|
||||
if (!b) break;
|
||||
|
@ -1242,7 +1239,7 @@ static void FASTCALL destroyBindings(BINDING *bindings, XML_Parser parser) {
|
|||
}
|
||||
}
|
||||
|
||||
void XMLCALL XML_ParserFree(XML_Parser parser) {
|
||||
void XML_ParserFree(XML_Parser parser) {
|
||||
TAG *tagList;
|
||||
OPEN_INTERNAL_ENTITY *entityList;
|
||||
if (parser == NULL) return;
|
||||
|
@ -1304,11 +1301,11 @@ void XMLCALL XML_ParserFree(XML_Parser parser) {
|
|||
FREE(parser, parser);
|
||||
}
|
||||
|
||||
void XMLCALL XML_UseParserAsHandlerArg(XML_Parser parser) {
|
||||
void XML_UseParserAsHandlerArg(XML_Parser parser) {
|
||||
if (parser != NULL) parser->m_handlerArg = parser;
|
||||
}
|
||||
|
||||
enum XML_Error XMLCALL XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD) {
|
||||
enum XML_Error XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD) {
|
||||
if (parser == NULL) return XML_ERROR_INVALID_ARGUMENT;
|
||||
#ifdef XML_DTD
|
||||
/* block after XML_Parse()/XML_ParseBuffer() has been called */
|
||||
|
@ -1322,7 +1319,7 @@ enum XML_Error XMLCALL XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD) {
|
|||
#endif
|
||||
}
|
||||
|
||||
void XMLCALL XML_SetReturnNSTriplet(XML_Parser parser, int do_nst) {
|
||||
void XML_SetReturnNSTriplet(XML_Parser parser, int do_nst) {
|
||||
if (parser == NULL) return;
|
||||
/* block after XML_Parse()/XML_ParseBuffer() has been called */
|
||||
if (parser->m_parsingStatus.parsing == XML_PARSING ||
|
||||
|
@ -1331,7 +1328,7 @@ void XMLCALL XML_SetReturnNSTriplet(XML_Parser parser, int do_nst) {
|
|||
parser->m_ns_triplets = do_nst ? XML_TRUE : XML_FALSE;
|
||||
}
|
||||
|
||||
void XMLCALL XML_SetUserData(XML_Parser parser, void *p) {
|
||||
void XML_SetUserData(XML_Parser parser, void *p) {
|
||||
if (parser == NULL) return;
|
||||
if (parser->m_handlerArg == parser->m_userData)
|
||||
parser->m_handlerArg = parser->m_userData = p;
|
||||
|
@ -1339,7 +1336,7 @@ void XMLCALL XML_SetUserData(XML_Parser parser, void *p) {
|
|||
parser->m_userData = p;
|
||||
}
|
||||
|
||||
enum XML_Status XMLCALL XML_SetBase(XML_Parser parser, const XML_Char *p) {
|
||||
enum XML_Status XML_SetBase(XML_Parser parser, const XML_Char *p) {
|
||||
if (parser == NULL) return XML_STATUS_ERROR;
|
||||
if (p) {
|
||||
p = poolCopyString(&parser->m_dtd->pool, p);
|
||||
|
@ -1350,29 +1347,29 @@ enum XML_Status XMLCALL XML_SetBase(XML_Parser parser, const XML_Char *p) {
|
|||
return XML_STATUS_OK;
|
||||
}
|
||||
|
||||
const XML_Char *XMLCALL XML_GetBase(XML_Parser parser) {
|
||||
const XML_Char *XML_GetBase(XML_Parser parser) {
|
||||
if (parser == NULL) return NULL;
|
||||
return parser->m_curBase;
|
||||
}
|
||||
|
||||
int XMLCALL XML_GetSpecifiedAttributeCount(XML_Parser parser) {
|
||||
int XML_GetSpecifiedAttributeCount(XML_Parser parser) {
|
||||
if (parser == NULL) return -1;
|
||||
return parser->m_nSpecifiedAtts;
|
||||
}
|
||||
|
||||
int XMLCALL XML_GetIdAttributeIndex(XML_Parser parser) {
|
||||
int XML_GetIdAttributeIndex(XML_Parser parser) {
|
||||
if (parser == NULL) return -1;
|
||||
return parser->m_idAttIndex;
|
||||
}
|
||||
|
||||
#ifdef XML_ATTR_INFO
|
||||
const XML_AttrInfo *XMLCALL XML_GetAttributeInfo(XML_Parser parser) {
|
||||
const XML_AttrInfo *XML_GetAttributeInfo(XML_Parser parser) {
|
||||
if (parser == NULL) return NULL;
|
||||
return parser->m_attInfo;
|
||||
}
|
||||
#endif
|
||||
|
||||
void XMLCALL XML_SetElementHandler(XML_Parser parser,
|
||||
void XML_SetElementHandler(XML_Parser parser,
|
||||
XML_StartElementHandler start,
|
||||
XML_EndElementHandler end) {
|
||||
if (parser == NULL) return;
|
||||
|
@ -1380,32 +1377,32 @@ void XMLCALL XML_SetElementHandler(XML_Parser parser,
|
|||
parser->m_endElementHandler = end;
|
||||
}
|
||||
|
||||
void XMLCALL XML_SetStartElementHandler(XML_Parser parser,
|
||||
void XML_SetStartElementHandler(XML_Parser parser,
|
||||
XML_StartElementHandler start) {
|
||||
if (parser != NULL) parser->m_startElementHandler = start;
|
||||
}
|
||||
|
||||
void XMLCALL XML_SetEndElementHandler(XML_Parser parser,
|
||||
void XML_SetEndElementHandler(XML_Parser parser,
|
||||
XML_EndElementHandler end) {
|
||||
if (parser != NULL) parser->m_endElementHandler = end;
|
||||
}
|
||||
|
||||
void XMLCALL XML_SetCharacterDataHandler(XML_Parser parser,
|
||||
void XML_SetCharacterDataHandler(XML_Parser parser,
|
||||
XML_CharacterDataHandler handler) {
|
||||
if (parser != NULL) parser->m_characterDataHandler = handler;
|
||||
}
|
||||
|
||||
void XMLCALL XML_SetProcessingInstructionHandler(
|
||||
void XML_SetProcessingInstructionHandler(
|
||||
XML_Parser parser, XML_ProcessingInstructionHandler handler) {
|
||||
if (parser != NULL) parser->m_processingInstructionHandler = handler;
|
||||
}
|
||||
|
||||
void XMLCALL XML_SetCommentHandler(XML_Parser parser,
|
||||
void XML_SetCommentHandler(XML_Parser parser,
|
||||
XML_CommentHandler handler) {
|
||||
if (parser != NULL) parser->m_commentHandler = handler;
|
||||
}
|
||||
|
||||
void XMLCALL XML_SetCdataSectionHandler(XML_Parser parser,
|
||||
void XML_SetCdataSectionHandler(XML_Parser parser,
|
||||
XML_StartCdataSectionHandler start,
|
||||
XML_EndCdataSectionHandler end) {
|
||||
if (parser == NULL) return;
|
||||
|
@ -1413,31 +1410,31 @@ void XMLCALL XML_SetCdataSectionHandler(XML_Parser parser,
|
|||
parser->m_endCdataSectionHandler = end;
|
||||
}
|
||||
|
||||
void XMLCALL XML_SetStartCdataSectionHandler(
|
||||
void XML_SetStartCdataSectionHandler(
|
||||
XML_Parser parser, XML_StartCdataSectionHandler start) {
|
||||
if (parser != NULL) parser->m_startCdataSectionHandler = start;
|
||||
}
|
||||
|
||||
void XMLCALL XML_SetEndCdataSectionHandler(XML_Parser parser,
|
||||
void XML_SetEndCdataSectionHandler(XML_Parser parser,
|
||||
XML_EndCdataSectionHandler end) {
|
||||
if (parser != NULL) parser->m_endCdataSectionHandler = end;
|
||||
}
|
||||
|
||||
void XMLCALL XML_SetDefaultHandler(XML_Parser parser,
|
||||
void XML_SetDefaultHandler(XML_Parser parser,
|
||||
XML_DefaultHandler handler) {
|
||||
if (parser == NULL) return;
|
||||
parser->m_defaultHandler = handler;
|
||||
parser->m_defaultExpandInternalEntities = XML_FALSE;
|
||||
}
|
||||
|
||||
void XMLCALL XML_SetDefaultHandlerExpand(XML_Parser parser,
|
||||
void XML_SetDefaultHandlerExpand(XML_Parser parser,
|
||||
XML_DefaultHandler handler) {
|
||||
if (parser == NULL) return;
|
||||
parser->m_defaultHandler = handler;
|
||||
parser->m_defaultExpandInternalEntities = XML_TRUE;
|
||||
}
|
||||
|
||||
void XMLCALL XML_SetDoctypeDeclHandler(XML_Parser parser,
|
||||
void XML_SetDoctypeDeclHandler(XML_Parser parser,
|
||||
XML_StartDoctypeDeclHandler start,
|
||||
XML_EndDoctypeDeclHandler end) {
|
||||
if (parser == NULL) return;
|
||||
|
@ -1445,27 +1442,27 @@ void XMLCALL XML_SetDoctypeDeclHandler(XML_Parser parser,
|
|||
parser->m_endDoctypeDeclHandler = end;
|
||||
}
|
||||
|
||||
void XMLCALL XML_SetStartDoctypeDeclHandler(XML_Parser parser,
|
||||
void XML_SetStartDoctypeDeclHandler(XML_Parser parser,
|
||||
XML_StartDoctypeDeclHandler start) {
|
||||
if (parser != NULL) parser->m_startDoctypeDeclHandler = start;
|
||||
}
|
||||
|
||||
void XMLCALL XML_SetEndDoctypeDeclHandler(XML_Parser parser,
|
||||
void XML_SetEndDoctypeDeclHandler(XML_Parser parser,
|
||||
XML_EndDoctypeDeclHandler end) {
|
||||
if (parser != NULL) parser->m_endDoctypeDeclHandler = end;
|
||||
}
|
||||
|
||||
void XMLCALL XML_SetUnparsedEntityDeclHandler(
|
||||
void XML_SetUnparsedEntityDeclHandler(
|
||||
XML_Parser parser, XML_UnparsedEntityDeclHandler handler) {
|
||||
if (parser != NULL) parser->m_unparsedEntityDeclHandler = handler;
|
||||
}
|
||||
|
||||
void XMLCALL XML_SetNotationDeclHandler(XML_Parser parser,
|
||||
void XML_SetNotationDeclHandler(XML_Parser parser,
|
||||
XML_NotationDeclHandler handler) {
|
||||
if (parser != NULL) parser->m_notationDeclHandler = handler;
|
||||
}
|
||||
|
||||
void XMLCALL XML_SetNamespaceDeclHandler(XML_Parser parser,
|
||||
void XML_SetNamespaceDeclHandler(XML_Parser parser,
|
||||
XML_StartNamespaceDeclHandler start,
|
||||
XML_EndNamespaceDeclHandler end) {
|
||||
if (parser == NULL) return;
|
||||
|
@ -1473,27 +1470,27 @@ void XMLCALL XML_SetNamespaceDeclHandler(XML_Parser parser,
|
|||
parser->m_endNamespaceDeclHandler = end;
|
||||
}
|
||||
|
||||
void XMLCALL XML_SetStartNamespaceDeclHandler(
|
||||
void XML_SetStartNamespaceDeclHandler(
|
||||
XML_Parser parser, XML_StartNamespaceDeclHandler start) {
|
||||
if (parser != NULL) parser->m_startNamespaceDeclHandler = start;
|
||||
}
|
||||
|
||||
void XMLCALL XML_SetEndNamespaceDeclHandler(XML_Parser parser,
|
||||
void XML_SetEndNamespaceDeclHandler(XML_Parser parser,
|
||||
XML_EndNamespaceDeclHandler end) {
|
||||
if (parser != NULL) parser->m_endNamespaceDeclHandler = end;
|
||||
}
|
||||
|
||||
void XMLCALL XML_SetNotStandaloneHandler(XML_Parser parser,
|
||||
void XML_SetNotStandaloneHandler(XML_Parser parser,
|
||||
XML_NotStandaloneHandler handler) {
|
||||
if (parser != NULL) parser->m_notStandaloneHandler = handler;
|
||||
}
|
||||
|
||||
void XMLCALL XML_SetExternalEntityRefHandler(
|
||||
void XML_SetExternalEntityRefHandler(
|
||||
XML_Parser parser, XML_ExternalEntityRefHandler handler) {
|
||||
if (parser != NULL) parser->m_externalEntityRefHandler = handler;
|
||||
}
|
||||
|
||||
void XMLCALL XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg) {
|
||||
void XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg) {
|
||||
if (parser == NULL) return;
|
||||
if (arg)
|
||||
parser->m_externalEntityRefHandlerArg = (XML_Parser)arg;
|
||||
|
@ -1501,12 +1498,12 @@ void XMLCALL XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg) {
|
|||
parser->m_externalEntityRefHandlerArg = parser;
|
||||
}
|
||||
|
||||
void XMLCALL XML_SetSkippedEntityHandler(XML_Parser parser,
|
||||
void XML_SetSkippedEntityHandler(XML_Parser parser,
|
||||
XML_SkippedEntityHandler handler) {
|
||||
if (parser != NULL) parser->m_skippedEntityHandler = handler;
|
||||
}
|
||||
|
||||
void XMLCALL XML_SetUnknownEncodingHandler(XML_Parser parser,
|
||||
void XML_SetUnknownEncodingHandler(XML_Parser parser,
|
||||
XML_UnknownEncodingHandler handler,
|
||||
void *data) {
|
||||
if (parser == NULL) return;
|
||||
|
@ -1514,27 +1511,27 @@ void XMLCALL XML_SetUnknownEncodingHandler(XML_Parser parser,
|
|||
parser->m_unknownEncodingHandlerData = data;
|
||||
}
|
||||
|
||||
void XMLCALL XML_SetElementDeclHandler(XML_Parser parser,
|
||||
void XML_SetElementDeclHandler(XML_Parser parser,
|
||||
XML_ElementDeclHandler eldecl) {
|
||||
if (parser != NULL) parser->m_elementDeclHandler = eldecl;
|
||||
}
|
||||
|
||||
void XMLCALL XML_SetAttlistDeclHandler(XML_Parser parser,
|
||||
void XML_SetAttlistDeclHandler(XML_Parser parser,
|
||||
XML_AttlistDeclHandler attdecl) {
|
||||
if (parser != NULL) parser->m_attlistDeclHandler = attdecl;
|
||||
}
|
||||
|
||||
void XMLCALL XML_SetEntityDeclHandler(XML_Parser parser,
|
||||
void XML_SetEntityDeclHandler(XML_Parser parser,
|
||||
XML_EntityDeclHandler handler) {
|
||||
if (parser != NULL) parser->m_entityDeclHandler = handler;
|
||||
}
|
||||
|
||||
void XMLCALL XML_SetXmlDeclHandler(XML_Parser parser,
|
||||
void XML_SetXmlDeclHandler(XML_Parser parser,
|
||||
XML_XmlDeclHandler handler) {
|
||||
if (parser != NULL) parser->m_xmlDeclHandler = handler;
|
||||
}
|
||||
|
||||
int XMLCALL XML_SetParamEntityParsing(XML_Parser parser,
|
||||
int XML_SetParamEntityParsing(XML_Parser parser,
|
||||
enum XML_ParamEntityParsing peParsing) {
|
||||
if (parser == NULL) return 0;
|
||||
/* block after XML_Parse()/XML_ParseBuffer() has been called */
|
||||
|
@ -1549,7 +1546,7 @@ int XMLCALL XML_SetParamEntityParsing(XML_Parser parser,
|
|||
#endif
|
||||
}
|
||||
|
||||
int XMLCALL XML_SetHashSalt(XML_Parser parser, unsigned long hash_salt) {
|
||||
int XML_SetHashSalt(XML_Parser parser, unsigned long hash_salt) {
|
||||
if (parser == NULL) return 0;
|
||||
if (parser->m_parentParser)
|
||||
return XML_SetHashSalt(parser->m_parentParser, hash_salt);
|
||||
|
@ -1561,7 +1558,7 @@ int XMLCALL XML_SetHashSalt(XML_Parser parser, unsigned long hash_salt) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
enum XML_Status XMLCALL XML_Parse(XML_Parser parser, const char *s, int len,
|
||||
enum XML_Status XML_Parse(XML_Parser parser, const char *s, int len,
|
||||
int isFinal) {
|
||||
if ((parser == NULL) || (len < 0) || ((s == NULL) && (len != 0))) {
|
||||
if (parser != NULL) parser->m_errorCode = XML_ERROR_INVALID_ARGUMENT;
|
||||
|
@ -1713,7 +1710,7 @@ enum XML_Status XMLCALL XML_Parse(XML_Parser parser, const char *s, int len,
|
|||
}
|
||||
}
|
||||
|
||||
enum XML_Status XMLCALL XML_ParseBuffer(XML_Parser parser, int len,
|
||||
enum XML_Status XML_ParseBuffer(XML_Parser parser, int len,
|
||||
int isFinal) {
|
||||
const char *start;
|
||||
enum XML_Status result = XML_STATUS_OK;
|
||||
|
@ -1771,7 +1768,7 @@ enum XML_Status XMLCALL XML_ParseBuffer(XML_Parser parser, int len,
|
|||
return result;
|
||||
}
|
||||
|
||||
void *XMLCALL XML_GetBuffer(XML_Parser parser, int len) {
|
||||
void *XML_GetBuffer(XML_Parser parser, int len) {
|
||||
if (parser == NULL) return NULL;
|
||||
if (len < 0) {
|
||||
parser->m_errorCode = XML_ERROR_NO_MEMORY;
|
||||
|
@ -1884,7 +1881,7 @@ void *XMLCALL XML_GetBuffer(XML_Parser parser, int len) {
|
|||
return parser->m_bufferEnd;
|
||||
}
|
||||
|
||||
enum XML_Status XMLCALL XML_StopParser(XML_Parser parser, XML_Bool resumable) {
|
||||
enum XML_Status XML_StopParser(XML_Parser parser, XML_Bool resumable) {
|
||||
if (parser == NULL) return XML_STATUS_ERROR;
|
||||
switch (parser->m_parsingStatus.parsing) {
|
||||
case XML_SUSPENDED:
|
||||
|
@ -1912,7 +1909,7 @@ enum XML_Status XMLCALL XML_StopParser(XML_Parser parser, XML_Bool resumable) {
|
|||
return XML_STATUS_OK;
|
||||
}
|
||||
|
||||
enum XML_Status XMLCALL XML_ResumeParser(XML_Parser parser) {
|
||||
enum XML_Status XML_ResumeParser(XML_Parser parser) {
|
||||
enum XML_Status result = XML_STATUS_OK;
|
||||
|
||||
if (parser == NULL) return XML_STATUS_ERROR;
|
||||
|
@ -1950,19 +1947,19 @@ enum XML_Status XMLCALL XML_ResumeParser(XML_Parser parser) {
|
|||
return result;
|
||||
}
|
||||
|
||||
void XMLCALL XML_GetParsingStatus(XML_Parser parser,
|
||||
void XML_GetParsingStatus(XML_Parser parser,
|
||||
XML_ParsingStatus *status) {
|
||||
if (parser == NULL) return;
|
||||
assert(status != NULL);
|
||||
*status = parser->m_parsingStatus;
|
||||
}
|
||||
|
||||
enum XML_Error XMLCALL XML_GetErrorCode(XML_Parser parser) {
|
||||
enum XML_Error XML_GetErrorCode(XML_Parser parser) {
|
||||
if (parser == NULL) return XML_ERROR_INVALID_ARGUMENT;
|
||||
return parser->m_errorCode;
|
||||
}
|
||||
|
||||
XML_Index XMLCALL XML_GetCurrentByteIndex(XML_Parser parser) {
|
||||
XML_Index XML_GetCurrentByteIndex(XML_Parser parser) {
|
||||
if (parser == NULL) return -1;
|
||||
if (parser->m_eventPtr)
|
||||
return (XML_Index)(parser->m_parseEndByteIndex -
|
||||
|
@ -1970,14 +1967,14 @@ XML_Index XMLCALL XML_GetCurrentByteIndex(XML_Parser parser) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
int XMLCALL XML_GetCurrentByteCount(XML_Parser parser) {
|
||||
int XML_GetCurrentByteCount(XML_Parser parser) {
|
||||
if (parser == NULL) return 0;
|
||||
if (parser->m_eventEndPtr && parser->m_eventPtr)
|
||||
return (int)(parser->m_eventEndPtr - parser->m_eventPtr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *XMLCALL XML_GetInputContext(XML_Parser parser, int *offset,
|
||||
const char *XML_GetInputContext(XML_Parser parser, int *offset,
|
||||
int *size) {
|
||||
#ifdef XML_CONTEXT_BYTES
|
||||
if (parser == NULL) return NULL;
|
||||
|
@ -1994,7 +1991,7 @@ const char *XMLCALL XML_GetInputContext(XML_Parser parser, int *offset,
|
|||
return (char *)0;
|
||||
}
|
||||
|
||||
XML_Size XMLCALL XML_GetCurrentLineNumber(XML_Parser parser) {
|
||||
XML_Size XML_GetCurrentLineNumber(XML_Parser parser) {
|
||||
if (parser == NULL) return 0;
|
||||
if (parser->m_eventPtr && parser->m_eventPtr >= parser->m_positionPtr) {
|
||||
XmlUpdatePosition(parser->m_encoding, parser->m_positionPtr,
|
||||
|
@ -2004,7 +2001,7 @@ XML_Size XMLCALL XML_GetCurrentLineNumber(XML_Parser parser) {
|
|||
return parser->m_position.lineNumber + 1;
|
||||
}
|
||||
|
||||
XML_Size XMLCALL XML_GetCurrentColumnNumber(XML_Parser parser) {
|
||||
XML_Size XML_GetCurrentColumnNumber(XML_Parser parser) {
|
||||
if (parser == NULL) return 0;
|
||||
if (parser->m_eventPtr && parser->m_eventPtr >= parser->m_positionPtr) {
|
||||
XmlUpdatePosition(parser->m_encoding, parser->m_positionPtr,
|
||||
|
@ -2014,25 +2011,25 @@ XML_Size XMLCALL XML_GetCurrentColumnNumber(XML_Parser parser) {
|
|||
return parser->m_position.columnNumber;
|
||||
}
|
||||
|
||||
void XMLCALL XML_FreeContentModel(XML_Parser parser, XML_Content *model) {
|
||||
void XML_FreeContentModel(XML_Parser parser, XML_Content *model) {
|
||||
if (parser != NULL) FREE(parser, model);
|
||||
}
|
||||
|
||||
void *XMLCALL XML_MemMalloc(XML_Parser parser, size_t size) {
|
||||
void *XML_MemMalloc(XML_Parser parser, size_t size) {
|
||||
if (parser == NULL) return NULL;
|
||||
return MALLOC(parser, size);
|
||||
}
|
||||
|
||||
void *XMLCALL XML_MemRealloc(XML_Parser parser, void *ptr, size_t size) {
|
||||
void *XML_MemRealloc(XML_Parser parser, void *ptr, size_t size) {
|
||||
if (parser == NULL) return NULL;
|
||||
return REALLOC(parser, ptr, size);
|
||||
}
|
||||
|
||||
void XMLCALL XML_MemFree(XML_Parser parser, void *ptr) {
|
||||
void XML_MemFree(XML_Parser parser, void *ptr) {
|
||||
if (parser != NULL) FREE(parser, ptr);
|
||||
}
|
||||
|
||||
void XMLCALL XML_DefaultCurrent(XML_Parser parser) {
|
||||
void XML_DefaultCurrent(XML_Parser parser) {
|
||||
if (parser == NULL) return;
|
||||
if (parser->m_defaultHandler) {
|
||||
if (parser->m_openInternalEntities)
|
||||
|
@ -2045,7 +2042,7 @@ void XMLCALL XML_DefaultCurrent(XML_Parser parser) {
|
|||
}
|
||||
}
|
||||
|
||||
const XML_LChar *XMLCALL XML_ErrorString(enum XML_Error code) {
|
||||
const XML_LChar *XML_ErrorString(enum XML_Error code) {
|
||||
switch (code) {
|
||||
case XML_ERROR_NONE:
|
||||
return NULL;
|
||||
|
@ -2142,7 +2139,7 @@ const XML_LChar *XMLCALL XML_ErrorString(enum XML_Error code) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
const XML_LChar *XMLCALL XML_ExpatVersion(void) {
|
||||
const XML_LChar *XML_ExpatVersion(void) {
|
||||
/* V1 is used to string-ize the version number. However, it would
|
||||
string-ize the actual version macro *names* unless we get them
|
||||
substituted before being passed to V1. CPP is defined to expand
|
||||
|
@ -2160,7 +2157,7 @@ const XML_LChar *XMLCALL XML_ExpatVersion(void) {
|
|||
#undef V2
|
||||
}
|
||||
|
||||
XML_Expat_Version XMLCALL XML_ExpatVersionInfo(void) {
|
||||
XML_Expat_Version XML_ExpatVersionInfo(void) {
|
||||
XML_Expat_Version version;
|
||||
|
||||
version.major = XML_MAJOR_VERSION;
|
||||
|
@ -2170,7 +2167,7 @@ XML_Expat_Version XMLCALL XML_ExpatVersionInfo(void) {
|
|||
return version;
|
||||
}
|
||||
|
||||
const XML_Feature *XMLCALL XML_GetFeatureList(void) {
|
||||
const XML_Feature *XML_GetFeatureList(void) {
|
||||
static const XML_Feature features[] = {
|
||||
{XML_FEATURE_SIZEOF_XML_CHAR, XML_L("sizeof(XML_Char)"),
|
||||
sizeof(XML_Char)},
|
||||
|
@ -2252,7 +2249,7 @@ static XML_Bool storeRawNames(XML_Parser parser) {
|
|||
return XML_TRUE;
|
||||
}
|
||||
|
||||
static enum XML_Error PTRCALL contentProcessor(XML_Parser parser,
|
||||
static enum XML_Error contentProcessor(XML_Parser parser,
|
||||
const char *start,
|
||||
const char *end,
|
||||
const char **endPtr) {
|
||||
|
@ -2265,7 +2262,7 @@ static enum XML_Error PTRCALL contentProcessor(XML_Parser parser,
|
|||
return result;
|
||||
}
|
||||
|
||||
static enum XML_Error PTRCALL externalEntityInitProcessor(XML_Parser parser,
|
||||
static enum XML_Error externalEntityInitProcessor(XML_Parser parser,
|
||||
const char *start,
|
||||
const char *end,
|
||||
const char **endPtr) {
|
||||
|
@ -2275,7 +2272,7 @@ static enum XML_Error PTRCALL externalEntityInitProcessor(XML_Parser parser,
|
|||
return externalEntityInitProcessor2(parser, start, end, endPtr);
|
||||
}
|
||||
|
||||
static enum XML_Error PTRCALL
|
||||
static enum XML_Error
|
||||
externalEntityInitProcessor2(XML_Parser parser, const char *start,
|
||||
const char *end, const char **endPtr) {
|
||||
const char *next = start; /* XmlContentTok doesn't always set the last arg */
|
||||
|
@ -2313,7 +2310,7 @@ externalEntityInitProcessor2(XML_Parser parser, const char *start,
|
|||
return externalEntityInitProcessor3(parser, start, end, endPtr);
|
||||
}
|
||||
|
||||
static enum XML_Error PTRCALL
|
||||
static enum XML_Error
|
||||
externalEntityInitProcessor3(XML_Parser parser, const char *start,
|
||||
const char *end, const char **endPtr) {
|
||||
int tok;
|
||||
|
@ -2355,7 +2352,7 @@ externalEntityInitProcessor3(XML_Parser parser, const char *start,
|
|||
return externalEntityContentProcessor(parser, start, end, endPtr);
|
||||
}
|
||||
|
||||
static enum XML_Error PTRCALL
|
||||
static enum XML_Error
|
||||
externalEntityContentProcessor(XML_Parser parser, const char *start,
|
||||
const char *end, const char **endPtr) {
|
||||
enum XML_Error result =
|
||||
|
@ -3303,10 +3300,10 @@ static enum XML_Error addBinding(XML_Parser parser, PREFIX *prefix,
|
|||
/* The idea here is to avoid using stack for each CDATA section when
|
||||
the whole file is parsed with one call.
|
||||
*/
|
||||
static enum XML_Error PTRCALL cdataSectionProcessor(XML_Parser parser,
|
||||
const char *start,
|
||||
const char *end,
|
||||
const char **endPtr) {
|
||||
static enum XML_Error cdataSectionProcessor(XML_Parser parser,
|
||||
const char *start,
|
||||
const char *end,
|
||||
const char **endPtr) {
|
||||
enum XML_Error result =
|
||||
doCdataSection(parser, parser->m_encoding, &start, end, endPtr,
|
||||
(XML_Bool)!parser->m_parsingStatus.finalBuffer);
|
||||
|
@ -3442,10 +3439,10 @@ static enum XML_Error doCdataSection(XML_Parser parser, const ENCODING *enc,
|
|||
/* The idea here is to avoid using stack for each IGNORE section when
|
||||
the whole file is parsed with one call.
|
||||
*/
|
||||
static enum XML_Error PTRCALL ignoreSectionProcessor(XML_Parser parser,
|
||||
const char *start,
|
||||
const char *end,
|
||||
const char **endPtr) {
|
||||
static enum XML_Error ignoreSectionProcessor(XML_Parser parser,
|
||||
const char *start,
|
||||
const char *end,
|
||||
const char **endPtr) {
|
||||
enum XML_Error result =
|
||||
doIgnoreSection(parser, parser->m_encoding, &start, end, endPtr,
|
||||
(XML_Bool)!parser->m_parsingStatus.finalBuffer);
|
||||
|
@ -3672,10 +3669,10 @@ static enum XML_Error handleUnknownEncoding(XML_Parser parser,
|
|||
return XML_ERROR_UNKNOWN_ENCODING;
|
||||
}
|
||||
|
||||
static enum XML_Error PTRCALL prologInitProcessor(XML_Parser parser,
|
||||
const char *s,
|
||||
const char *end,
|
||||
const char **nextPtr) {
|
||||
static enum XML_Error prologInitProcessor(XML_Parser parser,
|
||||
const char *s,
|
||||
const char *end,
|
||||
const char **nextPtr) {
|
||||
enum XML_Error result = initializeEncoding(parser);
|
||||
if (result != XML_ERROR_NONE) return result;
|
||||
parser->m_processor = prologProcessor;
|
||||
|
@ -3684,7 +3681,7 @@ static enum XML_Error PTRCALL prologInitProcessor(XML_Parser parser,
|
|||
|
||||
#ifdef XML_DTD
|
||||
|
||||
static enum XML_Error PTRCALL externalParEntInitProcessor(
|
||||
static enum XML_Error externalParEntInitProcessor(
|
||||
XML_Parser parser, const char *s, const char *end, const char **nextPtr) {
|
||||
enum XML_Error result = initializeEncoding(parser);
|
||||
if (result != XML_ERROR_NONE) return result;
|
||||
|
@ -3702,10 +3699,10 @@ static enum XML_Error PTRCALL externalParEntInitProcessor(
|
|||
}
|
||||
}
|
||||
|
||||
static enum XML_Error PTRCALL entityValueInitProcessor(XML_Parser parser,
|
||||
const char *s,
|
||||
const char *end,
|
||||
const char **nextPtr) {
|
||||
static enum XML_Error entityValueInitProcessor(XML_Parser parser,
|
||||
const char *s,
|
||||
const char *end,
|
||||
const char **nextPtr) {
|
||||
int tok;
|
||||
const char *start = s;
|
||||
const char *next = start;
|
||||
|
@ -3773,10 +3770,10 @@ static enum XML_Error PTRCALL entityValueInitProcessor(XML_Parser parser,
|
|||
}
|
||||
}
|
||||
|
||||
static enum XML_Error PTRCALL externalParEntProcessor(XML_Parser parser,
|
||||
const char *s,
|
||||
const char *end,
|
||||
const char **nextPtr) {
|
||||
static enum XML_Error externalParEntProcessor(XML_Parser parser,
|
||||
const char *s,
|
||||
const char *end,
|
||||
const char **nextPtr) {
|
||||
const char *next = s;
|
||||
int tok;
|
||||
|
||||
|
@ -3812,10 +3809,10 @@ static enum XML_Error PTRCALL externalParEntProcessor(XML_Parser parser,
|
|||
(XML_Bool)!parser->m_parsingStatus.finalBuffer, XML_TRUE);
|
||||
}
|
||||
|
||||
static enum XML_Error PTRCALL entityValueProcessor(XML_Parser parser,
|
||||
const char *s,
|
||||
const char *end,
|
||||
const char **nextPtr) {
|
||||
static enum XML_Error entityValueProcessor(XML_Parser parser,
|
||||
const char *s,
|
||||
const char *end,
|
||||
const char **nextPtr) {
|
||||
const char *start = s;
|
||||
const char *next = s;
|
||||
const ENCODING *enc = parser->m_encoding;
|
||||
|
@ -3848,9 +3845,9 @@ static enum XML_Error PTRCALL entityValueProcessor(XML_Parser parser,
|
|||
|
||||
#endif /* XML_DTD */
|
||||
|
||||
static enum XML_Error PTRCALL prologProcessor(XML_Parser parser, const char *s,
|
||||
const char *end,
|
||||
const char **nextPtr) {
|
||||
static enum XML_Error prologProcessor(XML_Parser parser, const char *s,
|
||||
const char *end,
|
||||
const char **nextPtr) {
|
||||
const char *next = s;
|
||||
int tok = XmlPrologTok(parser->m_encoding, s, end, &next);
|
||||
return doProlog(parser, parser->m_encoding, s, end, tok, next, nextPtr,
|
||||
|
@ -4805,9 +4802,9 @@ static enum XML_Error doProlog(XML_Parser parser, const ENCODING *enc,
|
|||
/* not reached */
|
||||
}
|
||||
|
||||
static enum XML_Error PTRCALL epilogProcessor(XML_Parser parser, const char *s,
|
||||
const char *end,
|
||||
const char **nextPtr) {
|
||||
static enum XML_Error epilogProcessor(XML_Parser parser, const char *s,
|
||||
const char *end,
|
||||
const char **nextPtr) {
|
||||
parser->m_processor = epilogProcessor;
|
||||
parser->m_eventPtr = s;
|
||||
for (;;) {
|
||||
|
@ -4924,10 +4921,10 @@ static enum XML_Error processInternalEntity(XML_Parser parser, ENTITY *entity,
|
|||
return result;
|
||||
}
|
||||
|
||||
static enum XML_Error PTRCALL internalEntityProcessor(XML_Parser parser,
|
||||
const char *s,
|
||||
const char *end,
|
||||
const char **nextPtr) {
|
||||
static enum XML_Error internalEntityProcessor(XML_Parser parser,
|
||||
const char *s,
|
||||
const char *end,
|
||||
const char **nextPtr) {
|
||||
ENTITY *entity;
|
||||
const char *textStart, *textEnd;
|
||||
const char *next;
|
||||
|
@ -4985,8 +4982,8 @@ static enum XML_Error PTRCALL internalEntityProcessor(XML_Parser parser,
|
|||
}
|
||||
}
|
||||
|
||||
static enum XML_Error PTRCALL errorProcessor(XML_Parser parser, const char *s,
|
||||
const char *end,
|
||||
static enum XML_Error errorProcessor(XML_Parser parser, const char *s,
|
||||
const char *end,
|
||||
const char **nextPtr) {
|
||||
UNUSED_P(s);
|
||||
UNUSED_P(end);
|
||||
|
@ -5327,7 +5324,7 @@ endEntityValue:
|
|||
return result;
|
||||
}
|
||||
|
||||
static void FASTCALL normalizeLines(XML_Char *s) {
|
||||
static void normalizeLines(XML_Char *s) {
|
||||
XML_Char *p;
|
||||
for (;; s++) {
|
||||
if (*s == XML_T('\0')) return;
|
||||
|
@ -5683,7 +5680,7 @@ static XML_Bool setContext(XML_Parser parser, const XML_Char *context) {
|
|||
return XML_TRUE;
|
||||
}
|
||||
|
||||
static void FASTCALL normalizePublicId(XML_Char *publicId) {
|
||||
static void normalizePublicId(XML_Char *publicId) {
|
||||
XML_Char *p = publicId;
|
||||
XML_Char *s;
|
||||
for (s = publicId; *s; s++) {
|
||||
|
@ -5967,7 +5964,7 @@ static int copyEntityTable(XML_Parser oldParser, HASH_TABLE *newTable,
|
|||
|
||||
#define INIT_POWER 6
|
||||
|
||||
static XML_Bool FASTCALL keyeq(KEY s1, KEY s2) {
|
||||
static XML_Bool keyeq(KEY s1, KEY s2) {
|
||||
for (; *s1 == *s2; s1++, s2++)
|
||||
if (*s1 == 0) return XML_TRUE;
|
||||
return XML_FALSE;
|
||||
|
@ -5985,7 +5982,7 @@ static void copy_salt_to_sipkey(XML_Parser parser, struct sipkey *key) {
|
|||
key->k[1] = get_hash_secret_salt(parser);
|
||||
}
|
||||
|
||||
static unsigned long FASTCALL hash(XML_Parser parser, KEY s) {
|
||||
static unsigned long hash(XML_Parser parser, KEY s) {
|
||||
struct siphash state;
|
||||
struct sipkey key;
|
||||
(void)sip24_valid;
|
||||
|
@ -6010,7 +6007,7 @@ static NAMED *lookup(XML_Parser parser, HASH_TABLE *table, KEY name,
|
|||
table->size = 0;
|
||||
return NULL;
|
||||
}
|
||||
memset(table->v, 0, tsize);
|
||||
bzero(table->v, tsize);
|
||||
i = hash(parser, name) & ((unsigned long)table->size - 1);
|
||||
} else {
|
||||
unsigned long h = hash(parser, name);
|
||||
|
@ -6032,7 +6029,7 @@ static NAMED *lookup(XML_Parser parser, HASH_TABLE *table, KEY name,
|
|||
size_t tsize = newSize * sizeof(NAMED *);
|
||||
NAMED **newV = (NAMED **)table->mem->malloc_fcn(tsize);
|
||||
if (!newV) return NULL;
|
||||
memset(newV, 0, tsize);
|
||||
bzero(newV, tsize);
|
||||
for (i = 0; i < table->size; i++)
|
||||
if (table->v[i]) {
|
||||
unsigned long newHash = hash(parser, table->v[i]->name);
|
||||
|
@ -6058,13 +6055,13 @@ static NAMED *lookup(XML_Parser parser, HASH_TABLE *table, KEY name,
|
|||
}
|
||||
table->v[i] = (NAMED *)table->mem->malloc_fcn(createSize);
|
||||
if (!table->v[i]) return NULL;
|
||||
memset(table->v[i], 0, createSize);
|
||||
bzero(table->v[i], createSize);
|
||||
table->v[i]->name = name;
|
||||
(table->used)++;
|
||||
return table->v[i];
|
||||
}
|
||||
|
||||
static void FASTCALL hashTableClear(HASH_TABLE *table) {
|
||||
static void hashTableClear(HASH_TABLE *table) {
|
||||
size_t i;
|
||||
for (i = 0; i < table->size; i++) {
|
||||
table->mem->free_fcn(table->v[i]);
|
||||
|
@ -6073,13 +6070,13 @@ static void FASTCALL hashTableClear(HASH_TABLE *table) {
|
|||
table->used = 0;
|
||||
}
|
||||
|
||||
static void FASTCALL hashTableDestroy(HASH_TABLE *table) {
|
||||
static void hashTableDestroy(HASH_TABLE *table) {
|
||||
size_t i;
|
||||
for (i = 0; i < table->size; i++) table->mem->free_fcn(table->v[i]);
|
||||
table->mem->free_fcn(table->v);
|
||||
}
|
||||
|
||||
static void FASTCALL hashTableInit(HASH_TABLE *p,
|
||||
static void hashTableInit(HASH_TABLE *p,
|
||||
const XML_Memory_Handling_Suite *ms) {
|
||||
p->power = 0;
|
||||
p->size = 0;
|
||||
|
@ -6088,13 +6085,13 @@ static void FASTCALL hashTableInit(HASH_TABLE *p,
|
|||
p->mem = ms;
|
||||
}
|
||||
|
||||
static void FASTCALL hashTableIterInit(HASH_TABLE_ITER *iter,
|
||||
static void hashTableIterInit(HASH_TABLE_ITER *iter,
|
||||
const HASH_TABLE *table) {
|
||||
iter->p = table->v;
|
||||
iter->end = iter->p + table->size;
|
||||
}
|
||||
|
||||
static NAMED *FASTCALL hashTableIterNext(HASH_TABLE_ITER *iter) {
|
||||
static NAMED *hashTableIterNext(HASH_TABLE_ITER *iter) {
|
||||
while (iter->p != iter->end) {
|
||||
NAMED *tem = *(iter->p)++;
|
||||
if (tem) return tem;
|
||||
|
@ -6102,7 +6099,7 @@ static NAMED *FASTCALL hashTableIterNext(HASH_TABLE_ITER *iter) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static void FASTCALL poolInit(STRING_POOL *pool,
|
||||
static void poolInit(STRING_POOL *pool,
|
||||
const XML_Memory_Handling_Suite *ms) {
|
||||
pool->blocks = NULL;
|
||||
pool->freeBlocks = NULL;
|
||||
|
@ -6112,7 +6109,7 @@ static void FASTCALL poolInit(STRING_POOL *pool,
|
|||
pool->mem = ms;
|
||||
}
|
||||
|
||||
static void FASTCALL poolClear(STRING_POOL *pool) {
|
||||
static void poolClear(STRING_POOL *pool) {
|
||||
if (!pool->freeBlocks)
|
||||
pool->freeBlocks = pool->blocks;
|
||||
else {
|
||||
|
@ -6130,7 +6127,7 @@ static void FASTCALL poolClear(STRING_POOL *pool) {
|
|||
pool->end = NULL;
|
||||
}
|
||||
|
||||
static void FASTCALL poolDestroy(STRING_POOL *pool) {
|
||||
static void poolDestroy(STRING_POOL *pool) {
|
||||
BLOCK *p = pool->blocks;
|
||||
while (p) {
|
||||
BLOCK *tem = p->next;
|
||||
|
@ -6159,7 +6156,7 @@ static XML_Char *poolAppend(STRING_POOL *pool, const ENCODING *enc,
|
|||
return pool->start;
|
||||
}
|
||||
|
||||
static const XML_Char *FASTCALL poolCopyString(STRING_POOL *pool,
|
||||
static const XML_Char *poolCopyString(STRING_POOL *pool,
|
||||
const XML_Char *s) {
|
||||
do {
|
||||
if (!poolAppendChar(pool, *s)) return NULL;
|
||||
|
@ -6193,7 +6190,7 @@ static const XML_Char *poolCopyStringN(STRING_POOL *pool, const XML_Char *s,
|
|||
return s;
|
||||
}
|
||||
|
||||
static const XML_Char *FASTCALL poolAppendString(STRING_POOL *pool,
|
||||
static const XML_Char *poolAppendString(STRING_POOL *pool,
|
||||
const XML_Char *s) {
|
||||
while (*s) {
|
||||
if (!poolAppendChar(pool, *s)) return NULL;
|
||||
|
@ -6234,7 +6231,7 @@ static size_t poolBytesToAllocateFor(int blockSize) {
|
|||
}
|
||||
}
|
||||
|
||||
static XML_Bool FASTCALL poolGrow(STRING_POOL *pool) {
|
||||
static XML_Bool poolGrow(STRING_POOL *pool) {
|
||||
if (pool->freeBlocks) {
|
||||
if (pool->start == 0) {
|
||||
pool->blocks = pool->freeBlocks;
|
||||
|
@ -6333,7 +6330,7 @@ static XML_Bool FASTCALL poolGrow(STRING_POOL *pool) {
|
|||
return XML_TRUE;
|
||||
}
|
||||
|
||||
static int FASTCALL nextScaffoldPart(XML_Parser parser) {
|
||||
static int nextScaffoldPart(XML_Parser parser) {
|
||||
DTD *const dtd = parser->m_dtd; /* save one level of indirection */
|
||||
CONTENT_SCAFFOLD *me;
|
||||
int next;
|
||||
|
|
128
third_party/python/Modules/expat/xmlrole.c
vendored
128
third_party/python/Modules/expat/xmlrole.c
vendored
|
@ -31,11 +31,17 @@
|
|||
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "expat_config.h"
|
||||
#include "expat_external.h"
|
||||
#include "internal.h"
|
||||
#include "xmlrole.h"
|
||||
#include "ascii.h"
|
||||
asm(".ident\t\"\\n\\n\
|
||||
expat (MIT License)\\n\
|
||||
Copyright (c) 1997-2000 Thai Open Source Software Center Ltd\\n\
|
||||
Copyright (c) 2000-2017 Expat development team\"");
|
||||
asm(".include \"libc/disclaimer.inc\"");
|
||||
|
||||
#include "third_party/python/Modules/expat/expat_config.h"
|
||||
#include "third_party/python/Modules/expat/expat_external.h"
|
||||
#include "third_party/python/Modules/expat/internal.inc"
|
||||
#include "third_party/python/Modules/expat/xmlrole.h"
|
||||
#include "third_party/python/Modules/expat/ascii.inc"
|
||||
|
||||
/* Doesn't check:
|
||||
|
||||
|
@ -105,9 +111,9 @@ static const char KW_SYSTEM[]
|
|||
# define setTopLevel(state) ((state)->handler = internalSubset)
|
||||
#endif /* not XML_DTD */
|
||||
|
||||
typedef int PTRCALL PROLOG_HANDLER(PROLOG_STATE *state, int tok,
|
||||
const char *ptr, const char *end,
|
||||
const ENCODING *enc);
|
||||
typedef int PROLOG_HANDLER(PROLOG_STATE *state, int tok,
|
||||
const char *ptr, const char *end,
|
||||
const ENCODING *enc);
|
||||
|
||||
static PROLOG_HANDLER prolog0, prolog1, prolog2, doctype0, doctype1, doctype2,
|
||||
doctype3, doctype4, doctype5, internalSubset, entity0, entity1, entity2,
|
||||
|
@ -121,9 +127,9 @@ static PROLOG_HANDLER prolog0, prolog1, prolog2, doctype0, doctype1, doctype2,
|
|||
#endif /* XML_DTD */
|
||||
declClose, error;
|
||||
|
||||
static int FASTCALL common(PROLOG_STATE *state, int tok);
|
||||
static int common(PROLOG_STATE *state, int tok);
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
prolog0(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
switch (tok) {
|
||||
|
@ -154,7 +160,7 @@ prolog0(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
prolog1(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
switch (tok) {
|
||||
|
@ -186,7 +192,7 @@ prolog1(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
prolog2(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -206,7 +212,7 @@ prolog2(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
doctype0(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -223,7 +229,7 @@ doctype0(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
doctype1(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
switch (tok) {
|
||||
|
@ -249,7 +255,7 @@ doctype1(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
doctype2(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -265,7 +271,7 @@ doctype2(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
doctype3(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -281,7 +287,7 @@ doctype3(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
doctype4(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -300,7 +306,7 @@ doctype4(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
doctype5(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -316,7 +322,7 @@ doctype5(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
internalSubset(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
switch (tok) {
|
||||
|
@ -361,7 +367,7 @@ internalSubset(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
|
||||
#ifdef XML_DTD
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
externalSubset0(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
state->handler = externalSubset1;
|
||||
|
@ -370,7 +376,7 @@ externalSubset0(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return externalSubset1(state, tok, ptr, end, enc);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
externalSubset1(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
switch (tok) {
|
||||
|
@ -398,7 +404,7 @@ externalSubset1(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
|
||||
#endif /* XML_DTD */
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
entity0(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -417,7 +423,7 @@ entity0(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
entity1(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -433,7 +439,7 @@ entity1(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
entity2(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
switch (tok) {
|
||||
|
@ -457,7 +463,7 @@ entity2(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
entity3(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -473,7 +479,7 @@ entity3(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
entity4(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -489,7 +495,7 @@ entity4(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
entity5(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
switch (tok) {
|
||||
|
@ -508,7 +514,7 @@ entity5(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
entity6(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -525,7 +531,7 @@ entity6(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
entity7(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
switch (tok) {
|
||||
|
@ -549,7 +555,7 @@ entity7(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
entity8(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -565,7 +571,7 @@ entity8(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
entity9(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -581,7 +587,7 @@ entity9(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
entity10(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -597,7 +603,7 @@ entity10(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
notation0(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -613,7 +619,7 @@ notation0(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
notation1(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
switch (tok) {
|
||||
|
@ -633,7 +639,7 @@ notation1(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
notation2(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -649,7 +655,7 @@ notation2(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
notation3(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -666,7 +672,7 @@ notation3(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
notation4(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -686,7 +692,7 @@ notation4(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
attlist0(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -703,7 +709,7 @@ attlist0(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
attlist1(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -723,7 +729,7 @@ attlist1(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
attlist2(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
switch (tok) {
|
||||
|
@ -753,7 +759,7 @@ attlist2(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
attlist3(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -771,7 +777,7 @@ attlist3(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
attlist4(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -790,7 +796,7 @@ attlist4(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
attlist5(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -806,7 +812,7 @@ attlist5(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
attlist6(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -822,7 +828,7 @@ attlist6(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
attlist7(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -842,7 +848,7 @@ attlist7(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
}
|
||||
|
||||
/* default value */
|
||||
static int PTRCALL
|
||||
static int
|
||||
attlist8(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
switch (tok) {
|
||||
|
@ -872,7 +878,7 @@ attlist8(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
attlist9(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -888,7 +894,7 @@ attlist9(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
element0(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -905,7 +911,7 @@ element0(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
element1(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
switch (tok) {
|
||||
|
@ -931,7 +937,7 @@ element1(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
element2(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
switch (tok) {
|
||||
|
@ -965,7 +971,7 @@ element2(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
element3(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -989,7 +995,7 @@ element3(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
element4(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -1006,7 +1012,7 @@ element4(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
element5(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -1026,7 +1032,7 @@ element5(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
element6(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -1055,7 +1061,7 @@ element6(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
element7(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -1104,7 +1110,7 @@ element7(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
|
||||
#ifdef XML_DTD
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
condSect0(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
switch (tok) {
|
||||
|
@ -1124,7 +1130,7 @@ condSect0(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
condSect1(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -1141,7 +1147,7 @@ condSect1(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
return common(state, tok);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
condSect2(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -1159,7 +1165,7 @@ condSect2(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
|
||||
#endif /* XML_DTD */
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
declClose(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(ptr);
|
||||
|
@ -1195,7 +1201,7 @@ declClose(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
*
|
||||
* LCOV_EXCL_START
|
||||
*/
|
||||
static int PTRCALL
|
||||
static int
|
||||
error(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
||||
const ENCODING *enc) {
|
||||
UNUSED_P(state);
|
||||
|
@ -1207,7 +1213,7 @@ error(PROLOG_STATE *state, int tok, const char *ptr, const char *end,
|
|||
}
|
||||
/* LCOV_EXCL_STOP */
|
||||
|
||||
static int FASTCALL
|
||||
static int
|
||||
common(PROLOG_STATE *state, int tok) {
|
||||
#ifdef XML_DTD
|
||||
if (! state->documentEntity && tok == XML_TOK_PARAM_ENTITY_REF)
|
||||
|
|
57
third_party/python/Modules/expat/xmlrole.h
vendored
57
third_party/python/Modules/expat/xmlrole.h
vendored
|
@ -1,50 +1,8 @@
|
|||
/* clang-format off */
|
||||
/*
|
||||
__ __ _
|
||||
___\ \/ /_ __ __ _| |_
|
||||
/ _ \\ /| '_ \ / _` | __|
|
||||
| __// \| |_) | (_| | |_
|
||||
\___/_/\_\ .__/ \__,_|\__|
|
||||
|_| XML parser
|
||||
|
||||
Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
|
||||
Copyright (c) 2000-2017 Expat development team
|
||||
Licensed under the MIT license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
persons to whom the Software is furnished to do so, subject to the
|
||||
following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef XmlRole_INCLUDED
|
||||
#define XmlRole_INCLUDED 1
|
||||
|
||||
#ifdef __VMS
|
||||
/* 0 1 2 3 0 1 2 3
|
||||
1234567890123456789012345678901 1234567890123456789012345678901 */
|
||||
# define XmlPrologStateInitExternalEntity XmlPrologStateInitExternalEnt
|
||||
#endif
|
||||
|
||||
#include "xmltok.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "third_party/python/Modules/expat/xmltok.h"
|
||||
COSMOPOLITAN_C_START_
|
||||
/* clang-format off */
|
||||
|
||||
enum {
|
||||
XML_ROLE_ERROR = -1,
|
||||
|
@ -114,8 +72,8 @@ enum {
|
|||
};
|
||||
|
||||
typedef struct prolog_state {
|
||||
int(PTRCALL *handler)(struct prolog_state *state, int tok, const char *ptr,
|
||||
const char *end, const ENCODING *enc);
|
||||
int(*handler)(struct prolog_state *state, int tok, const char *ptr,
|
||||
const char *end, const ENCODING *enc);
|
||||
unsigned level;
|
||||
int role_none;
|
||||
#ifdef XML_DTD
|
||||
|
@ -133,8 +91,5 @@ void XmlPrologStateInitExternalEntity(PROLOG_STATE *);
|
|||
#define XmlTokenRole(state, tok, ptr, end, enc) \
|
||||
(((state)->handler)(state, tok, ptr, end, enc))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* not XmlRole_INCLUDED */
|
||||
|
|
202
third_party/python/Modules/expat/xmltok.c
vendored
202
third_party/python/Modules/expat/xmltok.c
vendored
|
@ -31,12 +31,19 @@
|
|||
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "expat_config.h"
|
||||
#include "expat_external.h"
|
||||
#include "internal.h"
|
||||
#include "xmltok.h"
|
||||
asm(".ident\t\"\\n\\n\
|
||||
expat (MIT License)\\n\
|
||||
Copyright (c) 1997-2000 Thai Open Source Software Center Ltd\\n\
|
||||
Copyright (c) 2000-2017 Expat development team\"");
|
||||
asm(".include \"libc/disclaimer.inc\"");
|
||||
|
||||
#include "third_party/python/Modules/expat/expat_config.h"
|
||||
#include "third_party/python/Modules/expat/expat_external.h"
|
||||
#include "third_party/python/Modules/expat/internal.inc"
|
||||
#include "third_party/python/Modules/expat/xmltok.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "nametab.h"
|
||||
#include "third_party/python/Modules/expat/nametab.inc"
|
||||
#include "third_party/python/Modules/expat/xmltok_impl.h.inc"
|
||||
|
||||
#ifdef XML_DTD
|
||||
# define IGNORE_SECTION_TOK_VTABLE , PREFIX(ignoreSectionTok)
|
||||
|
@ -113,20 +120,20 @@
|
|||
: ((p)[1] & 0x80) == 0 \
|
||||
|| ((*p) == 0xF4 ? (p)[1] > 0x8F : ((p)[1] & 0xC0) == 0xC0)))
|
||||
|
||||
static int PTRFASTCALL
|
||||
static int
|
||||
isNever(const ENCODING *enc, const char *p) {
|
||||
UNUSED_P(enc);
|
||||
UNUSED_P(p);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int PTRFASTCALL
|
||||
static int
|
||||
utf8_isName2(const ENCODING *enc, const char *p) {
|
||||
UNUSED_P(enc);
|
||||
return UTF8_GET_NAMING2(namePages, (const unsigned char *)p);
|
||||
}
|
||||
|
||||
static int PTRFASTCALL
|
||||
static int
|
||||
utf8_isName3(const ENCODING *enc, const char *p) {
|
||||
UNUSED_P(enc);
|
||||
return UTF8_GET_NAMING3(namePages, (const unsigned char *)p);
|
||||
|
@ -134,13 +141,13 @@ utf8_isName3(const ENCODING *enc, const char *p) {
|
|||
|
||||
#define utf8_isName4 isNever
|
||||
|
||||
static int PTRFASTCALL
|
||||
static int
|
||||
utf8_isNmstrt2(const ENCODING *enc, const char *p) {
|
||||
UNUSED_P(enc);
|
||||
return UTF8_GET_NAMING2(nmstrtPages, (const unsigned char *)p);
|
||||
}
|
||||
|
||||
static int PTRFASTCALL
|
||||
static int
|
||||
utf8_isNmstrt3(const ENCODING *enc, const char *p) {
|
||||
UNUSED_P(enc);
|
||||
return UTF8_GET_NAMING3(nmstrtPages, (const unsigned char *)p);
|
||||
|
@ -148,19 +155,19 @@ utf8_isNmstrt3(const ENCODING *enc, const char *p) {
|
|||
|
||||
#define utf8_isNmstrt4 isNever
|
||||
|
||||
static int PTRFASTCALL
|
||||
static int
|
||||
utf8_isInvalid2(const ENCODING *enc, const char *p) {
|
||||
UNUSED_P(enc);
|
||||
return UTF8_INVALID2((const unsigned char *)p);
|
||||
}
|
||||
|
||||
static int PTRFASTCALL
|
||||
static int
|
||||
utf8_isInvalid3(const ENCODING *enc, const char *p) {
|
||||
UNUSED_P(enc);
|
||||
return UTF8_INVALID3((const unsigned char *)p);
|
||||
}
|
||||
|
||||
static int PTRFASTCALL
|
||||
static int
|
||||
utf8_isInvalid4(const ENCODING *enc, const char *p) {
|
||||
UNUSED_P(enc);
|
||||
return UTF8_INVALID4((const unsigned char *)p);
|
||||
|
@ -170,21 +177,21 @@ struct normal_encoding {
|
|||
ENCODING enc;
|
||||
unsigned char type[256];
|
||||
#ifdef XML_MIN_SIZE
|
||||
int(PTRFASTCALL *byteType)(const ENCODING *, const char *);
|
||||
int(PTRFASTCALL *isNameMin)(const ENCODING *, const char *);
|
||||
int(PTRFASTCALL *isNmstrtMin)(const ENCODING *, const char *);
|
||||
int(PTRFASTCALL *byteToAscii)(const ENCODING *, const char *);
|
||||
int(PTRCALL *charMatches)(const ENCODING *, const char *, int);
|
||||
int(*byteType)(const ENCODING *, const char *);
|
||||
int(*isNameMin)(const ENCODING *, const char *);
|
||||
int(*isNmstrtMin)(const ENCODING *, const char *);
|
||||
int(*byteToAscii)(const ENCODING *, const char *);
|
||||
int(*charMatches)(const ENCODING *, const char *, int);
|
||||
#endif /* XML_MIN_SIZE */
|
||||
int(PTRFASTCALL *isName2)(const ENCODING *, const char *);
|
||||
int(PTRFASTCALL *isName3)(const ENCODING *, const char *);
|
||||
int(PTRFASTCALL *isName4)(const ENCODING *, const char *);
|
||||
int(PTRFASTCALL *isNmstrt2)(const ENCODING *, const char *);
|
||||
int(PTRFASTCALL *isNmstrt3)(const ENCODING *, const char *);
|
||||
int(PTRFASTCALL *isNmstrt4)(const ENCODING *, const char *);
|
||||
int(PTRFASTCALL *isInvalid2)(const ENCODING *, const char *);
|
||||
int(PTRFASTCALL *isInvalid3)(const ENCODING *, const char *);
|
||||
int(PTRFASTCALL *isInvalid4)(const ENCODING *, const char *);
|
||||
int(*isName2)(const ENCODING *, const char *);
|
||||
int(*isName3)(const ENCODING *, const char *);
|
||||
int(*isName4)(const ENCODING *, const char *);
|
||||
int(*isNmstrt2)(const ENCODING *, const char *);
|
||||
int(*isNmstrt3)(const ENCODING *, const char *);
|
||||
int(*isNmstrt4)(const ENCODING *, const char *);
|
||||
int(*isInvalid2)(const ENCODING *, const char *);
|
||||
int(*isInvalid3)(const ENCODING *, const char *);
|
||||
int(*isInvalid4)(const ENCODING *, const char *);
|
||||
};
|
||||
|
||||
#define AS_NORMAL_ENCODING(enc) ((const struct normal_encoding *)(enc))
|
||||
|
@ -209,10 +216,9 @@ struct normal_encoding {
|
|||
/* isNmstrt2 */ NULL, /* isNmstrt3 */ NULL, /* isNmstrt4 */ NULL, \
|
||||
/* isInvalid2 */ NULL, /* isInvalid3 */ NULL, /* isInvalid4 */ NULL
|
||||
|
||||
static int FASTCALL checkCharRefNumber(int);
|
||||
static int checkCharRefNumber(int);
|
||||
|
||||
#include "xmltok_impl.h"
|
||||
#include "ascii.h"
|
||||
#include "third_party/python/Modules/expat/ascii.inc"
|
||||
|
||||
#ifdef XML_MIN_SIZE
|
||||
# define sb_isNameMin isNever
|
||||
|
@ -230,7 +236,7 @@ static int FASTCALL checkCharRefNumber(int);
|
|||
(((struct normal_encoding *)(enc))->type[(unsigned char)*(p)])
|
||||
|
||||
#ifdef XML_MIN_SIZE
|
||||
static int PTRFASTCALL
|
||||
static int
|
||||
sb_byteType(const ENCODING *enc, const char *p) {
|
||||
return SB_BYTE_TYPE(enc, p);
|
||||
}
|
||||
|
@ -241,7 +247,7 @@ sb_byteType(const ENCODING *enc, const char *p) {
|
|||
|
||||
#ifdef XML_MIN_SIZE
|
||||
# define BYTE_TO_ASCII(enc, p) (AS_NORMAL_ENCODING(enc)->byteToAscii(enc, p))
|
||||
static int PTRFASTCALL
|
||||
static int
|
||||
sb_byteToAscii(const ENCODING *enc, const char *p) {
|
||||
UNUSED_P(enc);
|
||||
return *p;
|
||||
|
@ -268,7 +274,7 @@ sb_byteToAscii(const ENCODING *enc, const char *p) {
|
|||
#ifdef XML_MIN_SIZE
|
||||
# define CHAR_MATCHES(enc, p, c) \
|
||||
(AS_NORMAL_ENCODING(enc)->charMatches(enc, p, c))
|
||||
static int PTRCALL
|
||||
static int
|
||||
sb_charMatches(const ENCODING *enc, const char *p, int c) {
|
||||
UNUSED_P(enc);
|
||||
return *p == c;
|
||||
|
@ -280,7 +286,7 @@ sb_charMatches(const ENCODING *enc, const char *p, int c) {
|
|||
|
||||
#define PREFIX(ident) normal_##ident
|
||||
#define XML_TOK_IMPL_C
|
||||
#include "xmltok_impl.c"
|
||||
#include "third_party/python/Modules/expat/xmltok_impl.inc"
|
||||
#undef XML_TOK_IMPL_C
|
||||
|
||||
#undef MINBPC
|
||||
|
@ -339,7 +345,7 @@ _INTERNAL_trim_to_complete_utf8_characters(const char *from,
|
|||
*fromLimRef = fromLim;
|
||||
}
|
||||
|
||||
static enum XML_Convert_Result PTRCALL
|
||||
static enum XML_Convert_Result
|
||||
utf8_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim,
|
||||
char **toP, const char *toLim) {
|
||||
bool input_incomplete = false;
|
||||
|
@ -378,7 +384,7 @@ utf8_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim,
|
|||
return XML_CONVERT_COMPLETED;
|
||||
}
|
||||
|
||||
static enum XML_Convert_Result PTRCALL
|
||||
static enum XML_Convert_Result
|
||||
utf8_toUtf16(const ENCODING *enc, const char **fromP, const char *fromLim,
|
||||
unsigned short **toP, const unsigned short *toLim) {
|
||||
enum XML_Convert_Result res = XML_CONVERT_COMPLETED;
|
||||
|
@ -438,8 +444,8 @@ after:
|
|||
static const struct normal_encoding utf8_encoding_ns
|
||||
= {{VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0},
|
||||
{
|
||||
# include "asciitab.h"
|
||||
# include "utf8tab.h"
|
||||
#include "third_party/python/Modules/expat/asciitab.inc"
|
||||
#include "third_party/python/Modules/expat/utf8tab.inc"
|
||||
},
|
||||
STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_)};
|
||||
#endif
|
||||
|
@ -448,9 +454,9 @@ static const struct normal_encoding utf8_encoding
|
|||
= {{VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0},
|
||||
{
|
||||
#define BT_COLON BT_NMSTRT
|
||||
#include "asciitab.h"
|
||||
#include "third_party/python/Modules/expat/asciitab.inc"
|
||||
#undef BT_COLON
|
||||
#include "utf8tab.h"
|
||||
#include "third_party/python/Modules/expat/utf8tab.inc"
|
||||
},
|
||||
STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_)};
|
||||
|
||||
|
@ -459,8 +465,8 @@ static const struct normal_encoding utf8_encoding
|
|||
static const struct normal_encoding internal_utf8_encoding_ns
|
||||
= {{VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0},
|
||||
{
|
||||
# include "iasciitab.h"
|
||||
# include "utf8tab.h"
|
||||
#include "third_party/python/Modules/expat/iasciitab.inc"
|
||||
#include "third_party/python/Modules/expat/utf8tab.inc"
|
||||
},
|
||||
STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_)};
|
||||
|
||||
|
@ -470,13 +476,13 @@ static const struct normal_encoding internal_utf8_encoding
|
|||
= {{VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0},
|
||||
{
|
||||
#define BT_COLON BT_NMSTRT
|
||||
#include "iasciitab.h"
|
||||
#include "third_party/python/Modules/expat/iasciitab.inc"
|
||||
#undef BT_COLON
|
||||
#include "utf8tab.h"
|
||||
#include "third_party/python/Modules/expat/utf8tab.inc"
|
||||
},
|
||||
STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_)};
|
||||
|
||||
static enum XML_Convert_Result PTRCALL
|
||||
static enum XML_Convert_Result
|
||||
latin1_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim,
|
||||
char **toP, const char *toLim) {
|
||||
UNUSED_P(enc);
|
||||
|
@ -499,7 +505,7 @@ latin1_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim,
|
|||
}
|
||||
}
|
||||
|
||||
static enum XML_Convert_Result PTRCALL
|
||||
static enum XML_Convert_Result
|
||||
latin1_toUtf16(const ENCODING *enc, const char **fromP, const char *fromLim,
|
||||
unsigned short **toP, const unsigned short *toLim) {
|
||||
UNUSED_P(enc);
|
||||
|
@ -517,8 +523,8 @@ latin1_toUtf16(const ENCODING *enc, const char **fromP, const char *fromLim,
|
|||
static const struct normal_encoding latin1_encoding_ns
|
||||
= {{VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0},
|
||||
{
|
||||
# include "asciitab.h"
|
||||
# include "latin1tab.h"
|
||||
#include "third_party/python/Modules/expat/asciitab.inc"
|
||||
#include "third_party/python/Modules/expat/latin1tab.inc"
|
||||
},
|
||||
STANDARD_VTABLE(sb_) NULL_VTABLE};
|
||||
|
||||
|
@ -528,13 +534,13 @@ static const struct normal_encoding latin1_encoding
|
|||
= {{VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0},
|
||||
{
|
||||
#define BT_COLON BT_NMSTRT
|
||||
#include "asciitab.h"
|
||||
#include "third_party/python/Modules/expat/asciitab.inc"
|
||||
#undef BT_COLON
|
||||
#include "latin1tab.h"
|
||||
#include "third_party/python/Modules/expat/latin1tab.inc"
|
||||
},
|
||||
STANDARD_VTABLE(sb_) NULL_VTABLE};
|
||||
|
||||
static enum XML_Convert_Result PTRCALL
|
||||
static enum XML_Convert_Result
|
||||
ascii_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim,
|
||||
char **toP, const char *toLim) {
|
||||
UNUSED_P(enc);
|
||||
|
@ -552,7 +558,7 @@ ascii_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim,
|
|||
static const struct normal_encoding ascii_encoding_ns
|
||||
= {{VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0},
|
||||
{
|
||||
# include "asciitab.h"
|
||||
#include "third_party/python/Modules/expat/asciitab.inc"
|
||||
/* BT_NONXML == 0 */
|
||||
},
|
||||
STANDARD_VTABLE(sb_) NULL_VTABLE};
|
||||
|
@ -563,13 +569,13 @@ static const struct normal_encoding ascii_encoding
|
|||
= {{VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0},
|
||||
{
|
||||
#define BT_COLON BT_NMSTRT
|
||||
#include "asciitab.h"
|
||||
#include "third_party/python/Modules/expat/asciitab.inc"
|
||||
#undef BT_COLON
|
||||
/* BT_NONXML == 0 */
|
||||
},
|
||||
STANDARD_VTABLE(sb_) NULL_VTABLE};
|
||||
|
||||
static int PTRFASTCALL
|
||||
static int
|
||||
unicode_byte_type(char hi, char lo) {
|
||||
switch ((unsigned char)hi) {
|
||||
/* 0xD800–0xDBFF first 16-bit code unit or high surrogate (W1) */
|
||||
|
@ -596,7 +602,7 @@ unicode_byte_type(char hi, char lo) {
|
|||
}
|
||||
|
||||
#define DEFINE_UTF16_TO_UTF8(E) \
|
||||
static enum XML_Convert_Result PTRCALL E##toUtf8( \
|
||||
static enum XML_Convert_Result E##toUtf8( \
|
||||
const ENCODING *enc, const char **fromP, const char *fromLim, \
|
||||
char **toP, const char *toLim) { \
|
||||
const char *from = *fromP; \
|
||||
|
@ -673,7 +679,7 @@ unicode_byte_type(char hi, char lo) {
|
|||
}
|
||||
|
||||
#define DEFINE_UTF16_TO_UTF16(E) \
|
||||
static enum XML_Convert_Result PTRCALL E##toUtf16( \
|
||||
static enum XML_Convert_Result E##toUtf16( \
|
||||
const ENCODING *enc, const char **fromP, const char *fromLim, \
|
||||
unsigned short **toP, const unsigned short *toLim) { \
|
||||
enum XML_Convert_Result res = XML_CONVERT_COMPLETED; \
|
||||
|
@ -727,30 +733,30 @@ DEFINE_UTF16_TO_UTF16(big2_)
|
|||
|
||||
#ifdef XML_MIN_SIZE
|
||||
|
||||
static int PTRFASTCALL
|
||||
static int
|
||||
little2_byteType(const ENCODING *enc, const char *p) {
|
||||
return LITTLE2_BYTE_TYPE(enc, p);
|
||||
}
|
||||
|
||||
static int PTRFASTCALL
|
||||
static int
|
||||
little2_byteToAscii(const ENCODING *enc, const char *p) {
|
||||
UNUSED_P(enc);
|
||||
return LITTLE2_BYTE_TO_ASCII(p);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
little2_charMatches(const ENCODING *enc, const char *p, int c) {
|
||||
UNUSED_P(enc);
|
||||
return LITTLE2_CHAR_MATCHES(p, c);
|
||||
}
|
||||
|
||||
static int PTRFASTCALL
|
||||
static int
|
||||
little2_isNameMin(const ENCODING *enc, const char *p) {
|
||||
UNUSED_P(enc);
|
||||
return LITTLE2_IS_NAME_CHAR_MINBPC(p);
|
||||
}
|
||||
|
||||
static int PTRFASTCALL
|
||||
static int
|
||||
little2_isNmstrtMin(const ENCODING *enc, const char *p) {
|
||||
UNUSED_P(enc);
|
||||
return LITTLE2_IS_NMSTRT_CHAR_MINBPC(p);
|
||||
|
@ -774,7 +780,7 @@ little2_isNmstrtMin(const ENCODING *enc, const char *p) {
|
|||
# define IS_NMSTRT_CHAR_MINBPC(enc, p) LITTLE2_IS_NMSTRT_CHAR_MINBPC(p)
|
||||
|
||||
# define XML_TOK_IMPL_C
|
||||
# include "xmltok_impl.c"
|
||||
#include "third_party/python/Modules/expat/xmltok_impl.inc"
|
||||
# undef XML_TOK_IMPL_C
|
||||
|
||||
# undef MINBPC
|
||||
|
@ -800,8 +806,8 @@ static const struct normal_encoding little2_encoding_ns
|
|||
# endif
|
||||
},
|
||||
{
|
||||
# include "asciitab.h"
|
||||
# include "latin1tab.h"
|
||||
#include "third_party/python/Modules/expat/asciitab.inc"
|
||||
#include "third_party/python/Modules/expat/latin1tab.inc"
|
||||
},
|
||||
STANDARD_VTABLE(little2_) NULL_VTABLE};
|
||||
|
||||
|
@ -817,9 +823,9 @@ static const struct normal_encoding little2_encoding
|
|||
},
|
||||
{
|
||||
#define BT_COLON BT_NMSTRT
|
||||
#include "asciitab.h"
|
||||
#include "third_party/python/Modules/expat/asciitab.inc"
|
||||
#undef BT_COLON
|
||||
#include "latin1tab.h"
|
||||
#include "third_party/python/Modules/expat/latin1tab.inc"
|
||||
},
|
||||
STANDARD_VTABLE(little2_) NULL_VTABLE};
|
||||
|
||||
|
@ -830,8 +836,8 @@ static const struct normal_encoding little2_encoding
|
|||
static const struct normal_encoding internal_little2_encoding_ns
|
||||
= {{VTABLE, 2, 0, 1},
|
||||
{
|
||||
# include "iasciitab.h"
|
||||
# include "latin1tab.h"
|
||||
# include "third_party/python/Modules/expat/iasciitab.inc"
|
||||
# include "third_party/python/Modules/expat/latin1tab.inc"
|
||||
},
|
||||
STANDARD_VTABLE(little2_) NULL_VTABLE};
|
||||
|
||||
|
@ -841,9 +847,9 @@ static const struct normal_encoding internal_little2_encoding
|
|||
= {{VTABLE, 2, 0, 1},
|
||||
{
|
||||
# define BT_COLON BT_NMSTRT
|
||||
# include "iasciitab.h"
|
||||
#include "third_party/python/Modules/expat/iasciitab.inc"
|
||||
# undef BT_COLON
|
||||
# include "latin1tab.h"
|
||||
#include "third_party/python/Modules/expat/latin1tab.inc"
|
||||
},
|
||||
STANDARD_VTABLE(little2_) NULL_VTABLE};
|
||||
|
||||
|
@ -862,30 +868,30 @@ static const struct normal_encoding internal_little2_encoding
|
|||
|
||||
#ifdef XML_MIN_SIZE
|
||||
|
||||
static int PTRFASTCALL
|
||||
static int
|
||||
big2_byteType(const ENCODING *enc, const char *p) {
|
||||
return BIG2_BYTE_TYPE(enc, p);
|
||||
}
|
||||
|
||||
static int PTRFASTCALL
|
||||
static int
|
||||
big2_byteToAscii(const ENCODING *enc, const char *p) {
|
||||
UNUSED_P(enc);
|
||||
return BIG2_BYTE_TO_ASCII(p);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
big2_charMatches(const ENCODING *enc, const char *p, int c) {
|
||||
UNUSED_P(enc);
|
||||
return BIG2_CHAR_MATCHES(p, c);
|
||||
}
|
||||
|
||||
static int PTRFASTCALL
|
||||
static int
|
||||
big2_isNameMin(const ENCODING *enc, const char *p) {
|
||||
UNUSED_P(enc);
|
||||
return BIG2_IS_NAME_CHAR_MINBPC(p);
|
||||
}
|
||||
|
||||
static int PTRFASTCALL
|
||||
static int
|
||||
big2_isNmstrtMin(const ENCODING *enc, const char *p) {
|
||||
UNUSED_P(enc);
|
||||
return BIG2_IS_NMSTRT_CHAR_MINBPC(p);
|
||||
|
@ -909,7 +915,7 @@ big2_isNmstrtMin(const ENCODING *enc, const char *p) {
|
|||
# define IS_NMSTRT_CHAR_MINBPC(enc, p) BIG2_IS_NMSTRT_CHAR_MINBPC(p)
|
||||
|
||||
# define XML_TOK_IMPL_C
|
||||
# include "xmltok_impl.c"
|
||||
#include "third_party/python/Modules/expat/xmltok_impl.inc"
|
||||
# undef XML_TOK_IMPL_C
|
||||
|
||||
# undef MINBPC
|
||||
|
@ -935,8 +941,8 @@ static const struct normal_encoding big2_encoding_ns
|
|||
# endif
|
||||
},
|
||||
{
|
||||
# include "asciitab.h"
|
||||
# include "latin1tab.h"
|
||||
#include "third_party/python/Modules/expat/asciitab.inc"
|
||||
#include "third_party/python/Modules/expat/latin1tab.inc"
|
||||
},
|
||||
STANDARD_VTABLE(big2_) NULL_VTABLE};
|
||||
|
||||
|
@ -952,9 +958,9 @@ static const struct normal_encoding big2_encoding
|
|||
},
|
||||
{
|
||||
#define BT_COLON BT_NMSTRT
|
||||
#include "asciitab.h"
|
||||
#include "third_party/python/Modules/expat/asciitab.inc"
|
||||
#undef BT_COLON
|
||||
#include "latin1tab.h"
|
||||
#include "third_party/python/Modules/expat/latin1tab.inc"
|
||||
},
|
||||
STANDARD_VTABLE(big2_) NULL_VTABLE};
|
||||
|
||||
|
@ -965,8 +971,8 @@ static const struct normal_encoding big2_encoding
|
|||
static const struct normal_encoding internal_big2_encoding_ns
|
||||
= {{VTABLE, 2, 0, 1},
|
||||
{
|
||||
# include "iasciitab.h"
|
||||
# include "latin1tab.h"
|
||||
# include "third_party/python/Modules/expat/iasciitab.inc"
|
||||
# include "third_party/python/Modules/expat/latin1tab.inc"
|
||||
},
|
||||
STANDARD_VTABLE(big2_) NULL_VTABLE};
|
||||
|
||||
|
@ -976,9 +982,9 @@ static const struct normal_encoding internal_big2_encoding
|
|||
= {{VTABLE, 2, 0, 1},
|
||||
{
|
||||
# define BT_COLON BT_NMSTRT
|
||||
# include "iasciitab.h"
|
||||
#include "third_party/python/Modules/expat/iasciitab.inc"
|
||||
# undef BT_COLON
|
||||
# include "latin1tab.h"
|
||||
#include "third_party/python/Modules/expat/latin1tab.inc"
|
||||
},
|
||||
STANDARD_VTABLE(big2_) NULL_VTABLE};
|
||||
|
||||
|
@ -986,7 +992,7 @@ static const struct normal_encoding internal_big2_encoding
|
|||
|
||||
#undef PREFIX
|
||||
|
||||
static int FASTCALL
|
||||
static int
|
||||
streqci(const char *s1, const char *s2) {
|
||||
for (;;) {
|
||||
char c1 = *s1++;
|
||||
|
@ -1007,7 +1013,7 @@ streqci(const char *s1, const char *s2) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
static void PTRCALL
|
||||
static void
|
||||
initUpdatePosition(const ENCODING *enc, const char *ptr, const char *end,
|
||||
POSITION *pos) {
|
||||
UNUSED_P(enc);
|
||||
|
@ -1025,7 +1031,7 @@ toAscii(const ENCODING *enc, const char *ptr, const char *end) {
|
|||
return buf[0];
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int
|
||||
isSpace(int c) {
|
||||
switch (c) {
|
||||
case 0x20:
|
||||
|
@ -1212,7 +1218,7 @@ doParseXmlDecl(const ENCODING *(*encodingFinder)(const ENCODING *, const char *,
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int FASTCALL
|
||||
static int
|
||||
checkCharRefNumber(int result) {
|
||||
switch (result >> 8) {
|
||||
case 0xD8:
|
||||
|
@ -1236,7 +1242,7 @@ checkCharRefNumber(int result) {
|
|||
return result;
|
||||
}
|
||||
|
||||
int FASTCALL
|
||||
int
|
||||
XmlUtf8Encode(int c, char *buf) {
|
||||
enum {
|
||||
/* minN is minimum legal resulting value for N byte sequence */
|
||||
|
@ -1272,7 +1278,7 @@ XmlUtf8Encode(int c, char *buf) {
|
|||
return 0; /* LCOV_EXCL_LINE: this case too is eliminated before calling */
|
||||
}
|
||||
|
||||
int FASTCALL
|
||||
int
|
||||
XmlUtf16Encode(int charNum, unsigned short *buf) {
|
||||
if (charNum < 0)
|
||||
return 0;
|
||||
|
@ -1304,7 +1310,7 @@ XmlSizeOfUnknownEncoding(void) {
|
|||
return sizeof(struct unknown_encoding);
|
||||
}
|
||||
|
||||
static int PTRFASTCALL
|
||||
static int
|
||||
unknown_isName(const ENCODING *enc, const char *p) {
|
||||
const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc);
|
||||
int c = uenc->convert(uenc->userData, p);
|
||||
|
@ -1313,7 +1319,7 @@ unknown_isName(const ENCODING *enc, const char *p) {
|
|||
return UCS2_GET_NAMING(namePages, c >> 8, c & 0xFF);
|
||||
}
|
||||
|
||||
static int PTRFASTCALL
|
||||
static int
|
||||
unknown_isNmstrt(const ENCODING *enc, const char *p) {
|
||||
const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc);
|
||||
int c = uenc->convert(uenc->userData, p);
|
||||
|
@ -1322,14 +1328,14 @@ unknown_isNmstrt(const ENCODING *enc, const char *p) {
|
|||
return UCS2_GET_NAMING(nmstrtPages, c >> 8, c & 0xFF);
|
||||
}
|
||||
|
||||
static int PTRFASTCALL
|
||||
static int
|
||||
unknown_isInvalid(const ENCODING *enc, const char *p) {
|
||||
const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc);
|
||||
int c = uenc->convert(uenc->userData, p);
|
||||
return (c & ~0xFFFF) || checkCharRefNumber(c) < 0;
|
||||
}
|
||||
|
||||
static enum XML_Convert_Result PTRCALL
|
||||
static enum XML_Convert_Result
|
||||
unknown_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim,
|
||||
char **toP, const char *toLim) {
|
||||
const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc);
|
||||
|
@ -1359,7 +1365,7 @@ unknown_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim,
|
|||
}
|
||||
}
|
||||
|
||||
static enum XML_Convert_Result PTRCALL
|
||||
static enum XML_Convert_Result
|
||||
unknown_toUtf16(const ENCODING *enc, const char **fromP, const char *fromLim,
|
||||
unsigned short **toP, const unsigned short *toLim) {
|
||||
const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc);
|
||||
|
@ -1483,7 +1489,7 @@ static const char KW_UTF_16LE[]
|
|||
= {ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1,
|
||||
ASCII_6, ASCII_L, ASCII_E, '\0'};
|
||||
|
||||
static int FASTCALL
|
||||
static int
|
||||
getEncodingIndex(const char *name) {
|
||||
static const char *const encodingNames[] = {
|
||||
KW_ISO_8859_1, KW_US_ASCII, KW_UTF_8, KW_UTF_16, KW_UTF_16BE, KW_UTF_16LE,
|
||||
|
@ -1626,7 +1632,7 @@ initScan(const ENCODING *const *encodingTable, const INIT_ENCODING *enc,
|
|||
#define NS(x) x
|
||||
#define ns(x) x
|
||||
#define XML_TOK_NS_C
|
||||
#include "xmltok_ns.c"
|
||||
#include "third_party/python/Modules/expat/xmltok_ns.inc"
|
||||
#undef XML_TOK_NS_C
|
||||
#undef NS
|
||||
#undef ns
|
||||
|
@ -1637,7 +1643,7 @@ initScan(const ENCODING *const *encodingTable, const INIT_ENCODING *enc,
|
|||
# define ns(x) x##_ns
|
||||
|
||||
# define XML_TOK_NS_C
|
||||
# include "xmltok_ns.c"
|
||||
#include "third_party/python/Modules/expat/xmltok_ns.inc"
|
||||
# undef XML_TOK_NS_C
|
||||
|
||||
# undef NS
|
||||
|
|
96
third_party/python/Modules/expat/xmltok.h
vendored
96
third_party/python/Modules/expat/xmltok.h
vendored
|
@ -1,42 +1,8 @@
|
|||
/* clang-format off */
|
||||
/*
|
||||
__ __ _
|
||||
___\ \/ /_ __ __ _| |_
|
||||
/ _ \\ /| '_ \ / _` | __|
|
||||
| __// \| |_) | (_| | |_
|
||||
\___/_/\_\ .__/ \__,_|\__|
|
||||
|_| XML parser
|
||||
|
||||
Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
|
||||
Copyright (c) 2000-2017 Expat development team
|
||||
Licensed under the MIT license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
persons to whom the Software is furnished to do so, subject to the
|
||||
following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef XmlTok_INCLUDED
|
||||
#define XmlTok_INCLUDED 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "third_party/python/Modules/expat/expat_external.h"
|
||||
COSMOPOLITAN_C_START_
|
||||
/* clang-format off */
|
||||
|
||||
/* The following token may be returned by XmlContentTok */
|
||||
#define XML_TOK_TRAILING_RSQB \
|
||||
|
@ -156,7 +122,7 @@ typedef struct {
|
|||
struct encoding;
|
||||
typedef struct encoding ENCODING;
|
||||
|
||||
typedef int(PTRCALL *SCANNER)(const ENCODING *, const char *, const char *,
|
||||
typedef int( *SCANNER)(const ENCODING *, const char *, const char *,
|
||||
const char **);
|
||||
|
||||
enum XML_Convert_Result {
|
||||
|
@ -169,28 +135,28 @@ enum XML_Convert_Result {
|
|||
struct encoding {
|
||||
SCANNER scanners[XML_N_STATES];
|
||||
SCANNER literalScanners[XML_N_LITERAL_TYPES];
|
||||
int(PTRCALL *nameMatchesAscii)(const ENCODING *, const char *, const char *,
|
||||
const char *);
|
||||
int(PTRFASTCALL *nameLength)(const ENCODING *, const char *);
|
||||
const char *(PTRFASTCALL *skipS)(const ENCODING *, const char *);
|
||||
int(PTRCALL *getAtts)(const ENCODING *enc, const char *ptr, int attsMax,
|
||||
ATTRIBUTE *atts);
|
||||
int(PTRFASTCALL *charRefNumber)(const ENCODING *enc, const char *ptr);
|
||||
int(PTRCALL *predefinedEntityName)(const ENCODING *, const char *,
|
||||
const char *);
|
||||
void(PTRCALL *updatePosition)(const ENCODING *, const char *ptr,
|
||||
const char *end, POSITION *);
|
||||
int(PTRCALL *isPublicId)(const ENCODING *enc, const char *ptr,
|
||||
const char *end, const char **badPtr);
|
||||
enum XML_Convert_Result(PTRCALL *utf8Convert)(const ENCODING *enc,
|
||||
const char **fromP,
|
||||
const char *fromLim, char **toP,
|
||||
const char *toLim);
|
||||
enum XML_Convert_Result(PTRCALL *utf16Convert)(const ENCODING *enc,
|
||||
const char **fromP,
|
||||
const char *fromLim,
|
||||
unsigned short **toP,
|
||||
const unsigned short *toLim);
|
||||
int(*nameMatchesAscii)(const ENCODING *, const char *, const char *,
|
||||
const char *);
|
||||
int(*nameLength)(const ENCODING *, const char *);
|
||||
const char *(*skipS)(const ENCODING *, const char *);
|
||||
int(*getAtts)(const ENCODING *enc, const char *ptr, int attsMax,
|
||||
ATTRIBUTE *atts);
|
||||
int(*charRefNumber)(const ENCODING *enc, const char *ptr);
|
||||
int(*predefinedEntityName)(const ENCODING *, const char *,
|
||||
const char *);
|
||||
void(*updatePosition)(const ENCODING *, const char *ptr,
|
||||
const char *end, POSITION *);
|
||||
int(*isPublicId)(const ENCODING *enc, const char *ptr,
|
||||
const char *end, const char **badPtr);
|
||||
enum XML_Convert_Result(*utf8Convert)(const ENCODING *enc,
|
||||
const char **fromP,
|
||||
const char *fromLim, char **toP,
|
||||
const char *toLim);
|
||||
enum XML_Convert_Result(*utf16Convert)(const ENCODING *enc,
|
||||
const char **fromP,
|
||||
const char *fromLim,
|
||||
unsigned short **toP,
|
||||
const unsigned short *toLim);
|
||||
int minBytesPerChar;
|
||||
char isUtf8;
|
||||
char isUtf16;
|
||||
|
@ -289,11 +255,11 @@ int XmlParseXmlDecl(int isGeneralTextEntity, const ENCODING *enc,
|
|||
int XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name);
|
||||
const ENCODING *XmlGetUtf8InternalEncoding(void);
|
||||
const ENCODING *XmlGetUtf16InternalEncoding(void);
|
||||
int FASTCALL XmlUtf8Encode(int charNumber, char *buf);
|
||||
int FASTCALL XmlUtf16Encode(int charNumber, unsigned short *buf);
|
||||
int XmlUtf8Encode(int charNumber, char *buf);
|
||||
int XmlUtf16Encode(int charNumber, unsigned short *buf);
|
||||
int XmlSizeOfUnknownEncoding(void);
|
||||
|
||||
typedef int(XMLCALL *CONVERTER)(void *userData, const char *p);
|
||||
typedef int(*CONVERTER)(void *userData, const char *p);
|
||||
|
||||
ENCODING *XmlInitUnknownEncoding(void *mem, int *table, CONVERTER convert,
|
||||
void *userData);
|
||||
|
@ -309,8 +275,6 @@ const ENCODING *XmlGetUtf8InternalEncodingNS(void);
|
|||
const ENCODING *XmlGetUtf16InternalEncodingNS(void);
|
||||
ENCODING *XmlInitUnknownEncodingNS(void *mem, int *table, CONVERTER convert,
|
||||
void *userData);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* not XmlTok_INCLUDED */
|
||||
|
|
|
@ -132,7 +132,7 @@
|
|||
|
||||
/* ptr points to character following "<!-" */
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
PREFIX(scanComment)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr) {
|
||||
if (HAS_CHAR(enc, ptr, end)) {
|
||||
|
@ -169,7 +169,7 @@ PREFIX(scanComment)(const ENCODING *enc, const char *ptr, const char *end,
|
|||
|
||||
/* ptr points to character following "<!" */
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
PREFIX(scanDecl)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr) {
|
||||
REQUIRE_CHAR(enc, ptr, end);
|
||||
|
@ -218,7 +218,7 @@ PREFIX(scanDecl)(const ENCODING *enc, const char *ptr, const char *end,
|
|||
return XML_TOK_PARTIAL;
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
PREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
int *tokPtr) {
|
||||
int upper = 0;
|
||||
|
@ -263,7 +263,7 @@ PREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr, const char *end,
|
|||
|
||||
/* ptr points to character following "<?" */
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
PREFIX(scanPi)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr) {
|
||||
int tok;
|
||||
|
@ -323,7 +323,7 @@ PREFIX(scanPi)(const ENCODING *enc, const char *ptr, const char *end,
|
|||
return XML_TOK_PARTIAL;
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
PREFIX(scanCdataSection)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr) {
|
||||
static const char CDATA_LSQB[]
|
||||
|
@ -342,7 +342,7 @@ PREFIX(scanCdataSection)(const ENCODING *enc, const char *ptr, const char *end,
|
|||
return XML_TOK_CDATA_SECT_OPEN;
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
PREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr) {
|
||||
if (ptr >= end)
|
||||
|
@ -418,7 +418,7 @@ PREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr, const char *end,
|
|||
|
||||
/* ptr points to character following "</" */
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
PREFIX(scanEndTag)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr) {
|
||||
REQUIRE_CHAR(enc, ptr, end);
|
||||
|
@ -469,7 +469,7 @@ PREFIX(scanEndTag)(const ENCODING *enc, const char *ptr, const char *end,
|
|||
|
||||
/* ptr points to character following "&#X" */
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
PREFIX(scanHexCharRef)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr) {
|
||||
if (HAS_CHAR(enc, ptr, end)) {
|
||||
|
@ -500,7 +500,7 @@ PREFIX(scanHexCharRef)(const ENCODING *enc, const char *ptr, const char *end,
|
|||
|
||||
/* ptr points to character following "&#" */
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
PREFIX(scanCharRef)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr) {
|
||||
if (HAS_CHAR(enc, ptr, end)) {
|
||||
|
@ -531,7 +531,7 @@ PREFIX(scanCharRef)(const ENCODING *enc, const char *ptr, const char *end,
|
|||
|
||||
/* ptr points to character following "&" */
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
PREFIX(scanRef)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr) {
|
||||
REQUIRE_CHAR(enc, ptr, end);
|
||||
|
@ -559,7 +559,7 @@ PREFIX(scanRef)(const ENCODING *enc, const char *ptr, const char *end,
|
|||
|
||||
/* ptr points to character following first character of attribute name */
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr) {
|
||||
# ifdef XML_NS
|
||||
|
@ -712,7 +712,7 @@ PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
|
|||
|
||||
/* ptr points to character following "<" */
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr) {
|
||||
# ifdef XML_NS
|
||||
|
@ -810,7 +810,7 @@ PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end,
|
|||
return XML_TOK_PARTIAL;
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr) {
|
||||
if (ptr >= end)
|
||||
|
@ -910,7 +910,7 @@ PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end,
|
|||
|
||||
/* ptr points to character following "%" */
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
PREFIX(scanPercent)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr) {
|
||||
REQUIRE_CHAR(enc, ptr, end);
|
||||
|
@ -940,7 +940,7 @@ PREFIX(scanPercent)(const ENCODING *enc, const char *ptr, const char *end,
|
|||
return XML_TOK_PARTIAL;
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
PREFIX(scanPoundName)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr) {
|
||||
REQUIRE_CHAR(enc, ptr, end);
|
||||
|
@ -970,7 +970,7 @@ PREFIX(scanPoundName)(const ENCODING *enc, const char *ptr, const char *end,
|
|||
return -XML_TOK_POUND_NAME;
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
PREFIX(scanLit)(int open, const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr) {
|
||||
while (HAS_CHAR(enc, ptr, end)) {
|
||||
|
@ -1004,7 +1004,7 @@ PREFIX(scanLit)(int open, const ENCODING *enc, const char *ptr, const char *end,
|
|||
return XML_TOK_PARTIAL;
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr) {
|
||||
int tok;
|
||||
|
@ -1244,7 +1244,7 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
|
|||
return -tok;
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr) {
|
||||
const char *start;
|
||||
|
@ -1313,7 +1313,7 @@ PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr, const char *end,
|
|||
return XML_TOK_DATA_CHARS;
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
PREFIX(entityValueTok)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr) {
|
||||
const char *start;
|
||||
|
@ -1380,7 +1380,7 @@ PREFIX(entityValueTok)(const ENCODING *enc, const char *ptr, const char *end,
|
|||
|
||||
# ifdef XML_DTD
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
PREFIX(ignoreSectionTok)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr) {
|
||||
int level = 0;
|
||||
|
@ -1432,7 +1432,7 @@ PREFIX(ignoreSectionTok)(const ENCODING *enc, const char *ptr, const char *end,
|
|||
|
||||
# endif /* XML_DTD */
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **badPtr) {
|
||||
ptr += MINBPC(enc);
|
||||
|
@ -1492,7 +1492,7 @@ PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end,
|
|||
first attsMax attributes are stored in atts.
|
||||
*/
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
PREFIX(getAtts)(const ENCODING *enc, const char *ptr, int attsMax,
|
||||
ATTRIBUTE *atts) {
|
||||
enum { other, inName, inValue } state = inName;
|
||||
|
@ -1585,7 +1585,7 @@ PREFIX(getAtts)(const ENCODING *enc, const char *ptr, int attsMax,
|
|||
/* not reached */
|
||||
}
|
||||
|
||||
static int PTRFASTCALL
|
||||
static int
|
||||
PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr) {
|
||||
int result = 0;
|
||||
/* skip &# */
|
||||
|
@ -1643,7 +1643,7 @@ PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr) {
|
|||
return checkCharRefNumber(result);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
PREFIX(predefinedEntityName)(const ENCODING *enc, const char *ptr,
|
||||
const char *end) {
|
||||
UNUSED_P(enc);
|
||||
|
@ -1697,7 +1697,7 @@ PREFIX(predefinedEntityName)(const ENCODING *enc, const char *ptr,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
PREFIX(nameMatchesAscii)(const ENCODING *enc, const char *ptr1,
|
||||
const char *end1, const char *ptr2) {
|
||||
UNUSED_P(enc);
|
||||
|
@ -1716,7 +1716,7 @@ PREFIX(nameMatchesAscii)(const ENCODING *enc, const char *ptr1,
|
|||
return ptr1 == end1;
|
||||
}
|
||||
|
||||
static int PTRFASTCALL
|
||||
static int
|
||||
PREFIX(nameLength)(const ENCODING *enc, const char *ptr) {
|
||||
const char *start = ptr;
|
||||
for (;;) {
|
||||
|
@ -1746,7 +1746,7 @@ PREFIX(nameLength)(const ENCODING *enc, const char *ptr) {
|
|||
}
|
||||
}
|
||||
|
||||
static const char *PTRFASTCALL
|
||||
static const char *
|
||||
PREFIX(skipS)(const ENCODING *enc, const char *ptr) {
|
||||
for (;;) {
|
||||
switch (BYTE_TYPE(enc, ptr)) {
|
||||
|
@ -1761,7 +1761,7 @@ PREFIX(skipS)(const ENCODING *enc, const char *ptr) {
|
|||
}
|
||||
}
|
||||
|
||||
static void PTRCALL
|
||||
static void
|
||||
PREFIX(updatePosition)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
POSITION *pos) {
|
||||
while (HAS_CHAR(enc, ptr, end)) {
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
|
||||
Copyright (c) 2000-2017 Expat development team
|
||||
Licensed under the MIT license:
|
||||
i Licensed under the MIT license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
|
@ -58,14 +58,14 @@ static const ENCODING *const NS(encodings)[] = {
|
|||
&ns(utf8_encoding).enc /* NO_ENC */
|
||||
};
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
NS(initScanProlog)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr) {
|
||||
return initScan(NS(encodings), (const INIT_ENCODING *)enc, XML_PROLOG_STATE,
|
||||
ptr, end, nextTokPtr);
|
||||
}
|
||||
|
||||
static int PTRCALL
|
||||
static int
|
||||
NS(initScanContent)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr) {
|
||||
return initScan(NS(encodings), (const INIT_ENCODING *)enc, XML_CONTENT_STATE,
|
Loading…
Add table
Add a link
Reference in a new issue