diff --git a/ChangeLog b/ChangeLog index d1dab2b0..137b19d4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Thu Jul 26 07:16:04 EDT 2001 Daniel Veillard + + * parser.c parserInternals.c: fixed the xmlLineNumbersDefault() + errors, lesson don't add new functions at 1am before a release + * xpath.c: integrated fix from Bjorn to avoid divide by zero + from XPath initialization when possible. + Tue Jul 24 15:39:11 CEST 2001 Daniel Veillard * result/scripts/base*: removing history/readline changed diff --git a/parser.c b/parser.c index 5af7035f..e3261be2 100644 --- a/parser.c +++ b/parser.c @@ -80,21 +80,7 @@ /* * Various global defaults for parsing */ -int xmlGetWarningsDefaultValue = 1; int xmlParserDebugEntities = 0; -#ifdef VMS -int xmlSubstituteEntitiesDefaultVal = 0; -#define xmlSubstituteEntitiesDefaultValue xmlSubstituteEntitiesDefaultVal -int xmlDoValidityCheckingDefaultVal = 0; -#define xmlDoValidityCheckingDefaultValue xmlDoValidityCheckingDefaultVal -#else -int xmlSubstituteEntitiesDefaultValue = 0; -int xmlDoValidityCheckingDefaultValue = 0; -#endif -int xmlLoadExtDtdDefaultValue = 0; -int xmlPedanticParserDefaultValue = 0; -int xmlLineNumbersDefaultValue = 0; -int xmlKeepBlanksDefaultValue = 1; /* * List of XML prefixed PI allowed by W3C specs @@ -10105,93 +10091,3 @@ xmlCleanupParser(void) { xmlCleanupPredefinedEntities(); } -/** - * xmlPedanticParserDefault: - * @val: int 0 or 1 - * - * Set and return the previous value for enabling pedantic warnings. - * - * Returns the last value for 0 for no substitution, 1 for substitution. - */ - -int -xmlPedanticParserDefault(int val) { - int old = xmlPedanticParserDefaultValue; - - xmlPedanticParserDefaultValue = val; - return(old); -} - -/** - * xmlLineNumbersDefault: - * @val: int 0 or 1 - * - * Set and return the previous value for enabling line numbers in elements - * contents. This may break on old application and is turned off by default. - * - * Returns the last value for 0 for no substitution, 1 for substitution. - */ - -int -xmlLineNumbersDefault(int val) { - int old = xmlLineNumbersDefaultValue; - - xmlLineNumbersDefaultValue = val; - return(old); -} - -/** - * xmlSubstituteEntitiesDefault: - * @val: int 0 or 1 - * - * Set and return the previous value for default entity support. - * Initially the parser always keep entity references instead of substituting - * entity values in the output. This function has to be used to change the - * default parser behaviour - * SAX::subtituteEntities() has to be used for changing that on a file by - * file basis. - * - * Returns the last value for 0 for no substitution, 1 for substitution. - */ - -int -xmlSubstituteEntitiesDefault(int val) { - int old = xmlSubstituteEntitiesDefaultValue; - - xmlSubstituteEntitiesDefaultValue = val; - return(old); -} - -/** - * xmlKeepBlanksDefault: - * @val: int 0 or 1 - * - * Set and return the previous value for default blanks text nodes support. - * The 1.x version of the parser used an heuristic to try to detect - * ignorable white spaces. As a result the SAX callback was generating - * ignorableWhitespace() callbacks instead of characters() one, and when - * using the DOM output text nodes containing those blanks were not generated. - * The 2.x and later version will switch to the XML standard way and - * ignorableWhitespace() are only generated when running the parser in - * validating mode and when the current element doesn't allow CDATA or - * mixed content. - * This function is provided as a way to force the standard behaviour - * on 1.X libs and to switch back to the old mode for compatibility when - * running 1.X client code on 2.X . Upgrade of 1.X code should be done - * by using xmlIsBlankNode() commodity function to detect the "empty" - * nodes generated. - * This value also affect autogeneration of indentation when saving code - * if blanks sections are kept, indentation is not generated. - * - * Returns the last value for 0 for no substitution, 1 for substitution. - */ - -int -xmlKeepBlanksDefault(int val) { - int old = xmlKeepBlanksDefaultValue; - - xmlKeepBlanksDefaultValue = val; - xmlIndentTreeOutput = !val; - return(old); -} - diff --git a/parserInternals.c b/parserInternals.c index 6eeae3db..e31e6f29 100644 --- a/parserInternals.c +++ b/parserInternals.c @@ -49,6 +49,24 @@ void xmlUpgradeOldNs(xmlDocPtr doc); +/* + * Various global defaults for parsing + */ +int xmlGetWarningsDefaultValue = 1; +#ifdef VMS +int xmlSubstituteEntitiesDefaultVal = 0; +#define xmlSubstituteEntitiesDefaultValue xmlSubstituteEntitiesDefaultVal +int xmlDoValidityCheckingDefaultVal = 0; +#define xmlDoValidityCheckingDefaultValue xmlDoValidityCheckingDefaultVal +#else +int xmlSubstituteEntitiesDefaultValue = 0; +int xmlDoValidityCheckingDefaultValue = 0; +#endif +int xmlLoadExtDtdDefaultValue = 0; +int xmlPedanticParserDefaultValue = 0; +int xmlLineNumbersDefaultValue = 0; +int xmlKeepBlanksDefaultValue = 1; + /************************************************************************ * * * Version and Features handling * @@ -2230,7 +2248,7 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt) ctxt->loadsubset = xmlLoadExtDtdDefaultValue; ctxt->validate = xmlDoValidityCheckingDefaultValue; ctxt->pedantic = xmlPedanticParserDefaultValue; - ctxt->linenumbers = xmlPedanticParserDefaultValue; + ctxt->linenumbers = xmlLineNumbersDefaultValue; ctxt->keepBlanks = xmlKeepBlanksDefaultValue; ctxt->vctxt.userData = ctxt; if (ctxt->validate) { @@ -2488,6 +2506,101 @@ xmlParserAddNodeInfo(xmlParserCtxtPtr ctxt, } } +/************************************************************************ + * * + * Defaults settings * + * * + ************************************************************************/ +/** + * xmlPedanticParserDefault: + * @val: int 0 or 1 + * + * Set and return the previous value for enabling pedantic warnings. + * + * Returns the last value for 0 for no substitution, 1 for substitution. + */ + +int +xmlPedanticParserDefault(int val) { + int old = xmlPedanticParserDefaultValue; + + xmlPedanticParserDefaultValue = val; + return(old); +} + +/** + * xmlLineNumbersDefault: + * @val: int 0 or 1 + * + * Set and return the previous value for enabling line numbers in elements + * contents. This may break on old application and is turned off by default. + * + * Returns the last value for 0 for no substitution, 1 for substitution. + */ + +int +xmlLineNumbersDefault(int val) { + int old = xmlLineNumbersDefaultValue; + + xmlLineNumbersDefaultValue = val; + return(old); +} + +/** + * xmlSubstituteEntitiesDefault: + * @val: int 0 or 1 + * + * Set and return the previous value for default entity support. + * Initially the parser always keep entity references instead of substituting + * entity values in the output. This function has to be used to change the + * default parser behaviour + * SAX::subtituteEntities() has to be used for changing that on a file by + * file basis. + * + * Returns the last value for 0 for no substitution, 1 for substitution. + */ + +int +xmlSubstituteEntitiesDefault(int val) { + int old = xmlSubstituteEntitiesDefaultValue; + + xmlSubstituteEntitiesDefaultValue = val; + return(old); +} + +/** + * xmlKeepBlanksDefault: + * @val: int 0 or 1 + * + * Set and return the previous value for default blanks text nodes support. + * The 1.x version of the parser used an heuristic to try to detect + * ignorable white spaces. As a result the SAX callback was generating + * ignorableWhitespace() callbacks instead of characters() one, and when + * using the DOM output text nodes containing those blanks were not generated. + * The 2.x and later version will switch to the XML standard way and + * ignorableWhitespace() are only generated when running the parser in + * validating mode and when the current element doesn't allow CDATA or + * mixed content. + * This function is provided as a way to force the standard behaviour + * on 1.X libs and to switch back to the old mode for compatibility when + * running 1.X client code on 2.X . Upgrade of 1.X code should be done + * by using xmlIsBlankNode() commodity function to detect the "empty" + * nodes generated. + * This value also affect autogeneration of indentation when saving code + * if blanks sections are kept, indentation is not generated. + * + * Returns the last value for 0 for no substitution, 1 for substitution. + */ + +int +xmlKeepBlanksDefault(int val) { + int old = xmlKeepBlanksDefaultValue; + + xmlKeepBlanksDefaultValue = val; + xmlIndentTreeOutput = !val; + return(old); +} + /************************************************************************ * * * Deprecated functions kept for compatibility * diff --git a/xpath.c b/xpath.c index 73143b20..fc661f89 100644 --- a/xpath.c +++ b/xpath.c @@ -194,9 +194,16 @@ xmlXPathInit(void) { if (initialized) return; +#if defined(HUGE_VAL) && defined(DBL_MAX) + xmlXPathPINF = (HUGE_VAL == DBL_MAX) ? + xmlXPathDivideBy(1.0, 0.0) : HUGE_VAL; + xmlXPathNINF = -xmlXPathPINF; + xmlXPathNAN = xmlXPathDivideBy(xmlXPathPINF, xmlXPathPINF); +#else xmlXPathNAN = xmlXPathDivideBy(0.0, 0.0); xmlXPathPINF = xmlXPathDivideBy(1.0, 0.0); xmlXPathNINF = xmlXPathDivideBy(-1.0, 0.0); +#endif initialized = 1; }