1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-29 11:41:22 +03:00

cleanup, creating a new legacy.c module, made sure make tests ran in

* Makefile.am: cleanup, creating a new legacy.c module,
  made sure make tests ran in reduced conditions
* SAX.c SAX2.c configure.in entities.c globals.c parser.c
  parserInternals.c tree.c valid.c xlink.c xmlIO.c xmlcatalog.c
  xmlmemory.c xpath.c xmlmemory.c include/libxml/xmlversion.h.in:
  increased the modularization, allow to configure out
  validation code and legacy code, added a configuration
  option --with-minimum compiling only the mandatory code
  which then shrink to 200KB.
Daniel
This commit is contained in:
Daniel Veillard
2003-09-28 18:58:27 +00:00
parent 9ee35f3643
commit 4432df239b
22 changed files with 419 additions and 1195 deletions

View File

@ -54,8 +54,6 @@
#endif
#include <libxml/globals.h>
void xmlUpgradeOldNs(xmlDocPtr doc);
/*
* Various global defaults for parsing
*/
@ -2713,405 +2711,3 @@ xmlKeepBlanksDefault(int val) {
return(old);
}
/************************************************************************
* *
* Deprecated functions kept for compatibility *
* *
************************************************************************/
/**
* xmlCheckLanguageID:
* @lang: pointer to the string value
*
* Checks that the value conforms to the LanguageID production:
*
* NOTE: this is somewhat deprecated, those productions were removed from
* the XML Second edition.
*
* [33] LanguageID ::= Langcode ('-' Subcode)*
* [34] Langcode ::= ISO639Code | IanaCode | UserCode
* [35] ISO639Code ::= ([a-z] | [A-Z]) ([a-z] | [A-Z])
* [36] IanaCode ::= ('i' | 'I') '-' ([a-z] | [A-Z])+
* [37] UserCode ::= ('x' | 'X') '-' ([a-z] | [A-Z])+
* [38] Subcode ::= ([a-z] | [A-Z])+
*
* Returns 1 if correct 0 otherwise
**/
int
xmlCheckLanguageID(const xmlChar * lang)
{
const xmlChar *cur = lang;
if (cur == NULL)
return (0);
if (((cur[0] == 'i') && (cur[1] == '-')) ||
((cur[0] == 'I') && (cur[1] == '-'))) {
/*
* IANA code
*/
cur += 2;
while (((cur[0] >= 'A') && (cur[0] <= 'Z')) || /* non input consuming */
((cur[0] >= 'a') && (cur[0] <= 'z')))
cur++;
} else if (((cur[0] == 'x') && (cur[1] == '-')) ||
((cur[0] == 'X') && (cur[1] == '-'))) {
/*
* User code
*/
cur += 2;
while (((cur[0] >= 'A') && (cur[0] <= 'Z')) || /* non input consuming */
((cur[0] >= 'a') && (cur[0] <= 'z')))
cur++;
} else if (((cur[0] >= 'A') && (cur[0] <= 'Z')) ||
((cur[0] >= 'a') && (cur[0] <= 'z'))) {
/*
* ISO639
*/
cur++;
if (((cur[0] >= 'A') && (cur[0] <= 'Z')) ||
((cur[0] >= 'a') && (cur[0] <= 'z')))
cur++;
else
return (0);
} else
return (0);
while (cur[0] != 0) { /* non input consuming */
if (cur[0] != '-')
return (0);
cur++;
if (((cur[0] >= 'A') && (cur[0] <= 'Z')) ||
((cur[0] >= 'a') && (cur[0] <= 'z')))
cur++;
else
return (0);
while (((cur[0] >= 'A') && (cur[0] <= 'Z')) || /* non input consuming */
((cur[0] >= 'a') && (cur[0] <= 'z')))
cur++;
}
return (1);
}
/**
* xmlDecodeEntities:
* @ctxt: the parser context
* @len: the len to decode (in bytes !), -1 for no size limit
* @what: combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF
* @end: an end marker xmlChar, 0 if none
* @end2: an end marker xmlChar, 0 if none
* @end3: an end marker xmlChar, 0 if none
*
* This function is deprecated, we now always process entities content
* through xmlStringDecodeEntities
*
* TODO: remove it in next major release.
*
* [67] Reference ::= EntityRef | CharRef
*
* [69] PEReference ::= '%' Name ';'
*
* Returns A newly allocated string with the substitution done. The caller
* must deallocate it !
*/
xmlChar *
xmlDecodeEntities(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED,
int len ATTRIBUTE_UNUSED, int what ATTRIBUTE_UNUSED,
xmlChar end ATTRIBUTE_UNUSED,
xmlChar end2 ATTRIBUTE_UNUSED,
xmlChar end3 ATTRIBUTE_UNUSED)
{
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
"xmlDecodeEntities() deprecated function reached\n");
deprecated = 1;
}
return (NULL);
}
/**
* xmlNamespaceParseNCName:
* @ctxt: an XML parser context
*
* parse an XML namespace name.
*
* TODO: this seems not in use anymore, the namespace handling is done on
* top of the SAX interfaces, i.e. not on raw input.
*
* [NS 3] NCName ::= (Letter | '_') (NCNameChar)*
*
* [NS 4] NCNameChar ::= Letter | Digit | '.' | '-' | '_' |
* CombiningChar | Extender
*
* Returns the namespace name or NULL
*/
xmlChar *
xmlNamespaceParseNCName(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED)
{
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
"xmlNamespaceParseNCName() deprecated function reached\n");
deprecated = 1;
}
return (NULL);
}
/**
* xmlNamespaceParseQName:
* @ctxt: an XML parser context
* @prefix: a xmlChar **
*
* TODO: this seems not in use anymore, the namespace handling is done on
* top of the SAX interfaces, i.e. not on raw input.
*
* parse an XML qualified name
*
* [NS 5] QName ::= (Prefix ':')? LocalPart
*
* [NS 6] Prefix ::= NCName
*
* [NS 7] LocalPart ::= NCName
*
* Returns the local part, and prefix is updated
* to get the Prefix if any.
*/
xmlChar *
xmlNamespaceParseQName(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED,
xmlChar ** prefix ATTRIBUTE_UNUSED)
{
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
"xmlNamespaceParseQName() deprecated function reached\n");
deprecated = 1;
}
return (NULL);
}
/**
* xmlNamespaceParseNSDef:
* @ctxt: an XML parser context
*
* parse a namespace prefix declaration
*
* TODO: this seems not in use anymore, the namespace handling is done on
* top of the SAX interfaces, i.e. not on raw input.
*
* [NS 1] NSDef ::= PrefixDef Eq SystemLiteral
*
* [NS 2] PrefixDef ::= 'xmlns' (':' NCName)?
*
* Returns the namespace name
*/
xmlChar *
xmlNamespaceParseNSDef(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED)
{
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
"xmlNamespaceParseNSDef() deprecated function reached\n");
deprecated = 1;
}
return (NULL);
}
/**
* xmlParseQuotedString:
* @ctxt: an XML parser context
*
* Parse and return a string between quotes or doublequotes
*
* TODO: Deprecated, to be removed at next drop of binary compatibility
*
* Returns the string parser or NULL.
*/
xmlChar *
xmlParseQuotedString(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED)
{
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
"xmlParseQuotedString() deprecated function reached\n");
deprecated = 1;
}
return (NULL);
}
/**
* xmlParseNamespace:
* @ctxt: an XML parser context
*
* xmlParseNamespace: parse specific PI '<?namespace ...' constructs.
*
* This is what the older xml-name Working Draft specified, a bunch of
* other stuff may still rely on it, so support is still here as
* if it was declared on the root of the Tree:-(
*
* TODO: remove from library
*
* To be removed at next drop of binary compatibility
*/
void
xmlParseNamespace(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED)
{
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
"xmlParseNamespace() deprecated function reached\n");
deprecated = 1;
}
}
/**
* xmlScanName:
* @ctxt: an XML parser context
*
* Trickery: parse an XML name but without consuming the input flow
* Needed for rollback cases. Used only when parsing entities references.
*
* TODO: seems deprecated now, only used in the default part of
* xmlParserHandleReference
*
* [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' |
* CombiningChar | Extender
*
* [5] Name ::= (Letter | '_' | ':') (NameChar)*
*
* [6] Names ::= Name (S Name)*
*
* Returns the Name parsed or NULL
*/
xmlChar *
xmlScanName(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED)
{
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
"xmlScanName() deprecated function reached\n");
deprecated = 1;
}
return (NULL);
}
/**
* xmlParserHandleReference:
* @ctxt: the parser context
*
* TODO: Remove, now deprecated ... the test is done directly in the
* content parsing
* routines.
*
* [67] Reference ::= EntityRef | CharRef
*
* [68] EntityRef ::= '&' Name ';'
*
* [ WFC: Entity Declared ]
* the Name given in the entity reference must match that in an entity
* declaration, except that well-formed documents need not declare any
* of the following entities: amp, lt, gt, apos, quot.
*
* [ WFC: Parsed Entity ]
* An entity reference must not contain the name of an unparsed entity
*
* [66] CharRef ::= '&#' [0-9]+ ';' |
* '&#x' [0-9a-fA-F]+ ';'
*
* A PEReference may have been detected in the current input stream
* the handling is done accordingly to
* http://www.w3.org/TR/REC-xml#entproc
*/
void
xmlParserHandleReference(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED)
{
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
"xmlParserHandleReference() deprecated function reached\n");
deprecated = 1;
}
return;
}
/**
* xmlHandleEntity:
* @ctxt: an XML parser context
* @entity: an XML entity pointer.
*
* Default handling of defined entities, when should we define a new input
* stream ? When do we just handle that as a set of chars ?
*
* OBSOLETE: to be removed at some point.
*/
void
xmlHandleEntity(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED,
xmlEntityPtr entity ATTRIBUTE_UNUSED)
{
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
"xmlHandleEntity() deprecated function reached\n");
deprecated = 1;
}
}
/**
* xmlNewGlobalNs:
* @doc: the document carrying the namespace
* @href: the URI associated
* @prefix: the prefix for the namespace
*
* Creation of a Namespace, the old way using PI and without scoping
* DEPRECATED !!!
* It now create a namespace on the root element of the document if found.
* Returns NULL this functionality had been removed
*/
xmlNsPtr
xmlNewGlobalNs(xmlDocPtr doc ATTRIBUTE_UNUSED,
const xmlChar * href ATTRIBUTE_UNUSED,
const xmlChar * prefix ATTRIBUTE_UNUSED)
{
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
"xmlNewGlobalNs() deprecated function reached\n");
deprecated = 1;
}
return (NULL);
}
/**
* xmlUpgradeOldNs:
* @doc: a document pointer
*
* Upgrade old style Namespaces (PI) and move them to the root of the document.
* DEPRECATED
*/
void
xmlUpgradeOldNs(xmlDocPtr doc ATTRIBUTE_UNUSED)
{
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
"xmlUpgradeOldNs() deprecated function reached\n");
deprecated = 1;
}
}