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

Added Igor Zlatkovic as official maintainer Albert Chin pointed that

* AUTHORS HACKING: Added Igor Zlatkovic as official maintainer
* python/Makefile.am python/tests/Makefile.am: Albert Chin pointed
  that $(datadir) should be used for docs
Daniel
This commit is contained in:
Daniel Veillard
2002-03-27 09:05:40 +00:00
parent db1dc39525
commit 5fc1f0893a
7 changed files with 113 additions and 19 deletions

View File

@ -1,3 +1,4 @@
Daniel Veillard <daniel@veillard.com> Daniel Veillard <daniel@veillard.com>
Bjorn Reese <breese@users.sourceforge.net> Bjorn Reese <breese@users.sourceforge.net>
William Brack <wbrack@mmm.com.hk> William Brack <wbrack@mmm.com.hk>
Igor Zlatkovic <igor@stud.fh-frankfurt.de> for the Windows port

View File

@ -1,3 +1,9 @@
Wed Mar 27 10:03:11 CET 2002 Daniel Veillard <daniel@veillard.com>
* AUTHORS HACKING: Added Igor Zlatkovic as official maintainer
* python/Makefile.am python/tests/Makefile.am: Albert Chin pointed
that $(datadir) should be used for docs
Tue Mar 26 13:43:16 CET 2002 Daniel Veillard <daniel@veillard.com> Tue Mar 26 13:43:16 CET 2002 Daniel Veillard <daniel@veillard.com>
* xmlIO.c: Thomas Steinborn pointed out #76404 that libxml2 * xmlIO.c: Thomas Steinborn pointed out #76404 that libxml2

View File

@ -30,7 +30,8 @@ This simply mean that I'm on holliday or on the road.
Daniel Daniel
P.S.: Bjorn Reese, William Brack and Thomas Broyer get an exception for P.S.: Bjorn Reese, William Brack, Thomas Broyer and Igor Zlatkovic get an
the send before commit rule as well as John Fleck for the doc maintenance exception for the send before commit rule as well as John Fleck
Send them mail if I don't answer to request in a timely fashion for the doc maintenance Send them mail if I don't answer to request
in a timely fashion

View File

@ -7,7 +7,7 @@ INCLUDES = \
-I$(PYTHON_INCLUDES) \ -I$(PYTHON_INCLUDES) \
-I$(top_srcdir)/include -I$(top_srcdir)/include
DOCS_DIR = $(prefix)/share/doc/libxml2-python-$(LIBXML_VERSION) DOCS_DIR = $(datadir)/doc/libxml2-python-$(LIBXML_VERSION)
# libxml2class.txt is generated # libxml2class.txt is generated
DOCS = TODO DOCS = TODO

View File

@ -1,4 +1,4 @@
EXAMPLE_DIR = $(prefix)/share/doc/libxml2-python-$(LIBXML_VERSION)/examples EXAMPLE_DIR = $(datadir)/doc/libxml2-python-$(LIBXML_VERSION)/examples
PYTESTS= \ PYTESTS= \
build.py \ build.py \

View File

@ -145,6 +145,11 @@ static const char rcsid[] = "@(#)$Id$";
static TRIO_CONST double internalEndianMagic = 7.949928895127363e-275; static TRIO_CONST double internalEndianMagic = 7.949928895127363e-275;
/* Mask for the sign */
static TRIO_CONST unsigned char ieee_754_sign_mask[] = {
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
/* Mask for the exponent */ /* Mask for the exponent */
static TRIO_CONST unsigned char ieee_754_exponent_mask[] = { static TRIO_CONST unsigned char ieee_754_exponent_mask[] = {
0x7F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 0x7F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
@ -155,6 +160,11 @@ static TRIO_CONST unsigned char ieee_754_mantissa_mask[] = {
0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
}; };
/* Bit-pattern for negative zero */
static TRIO_CONST unsigned char ieee_754_negzero_array[] = {
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
/* Bit-pattern for infinity */ /* Bit-pattern for infinity */
static TRIO_CONST unsigned char ieee_754_infinity_array[] = { static TRIO_CONST unsigned char ieee_754_infinity_array[] = {
0x7F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 0x7F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
@ -207,6 +217,37 @@ trio_is_special_quantity(double number,
return is_special_quantity; return is_special_quantity;
} }
/**
Get the sign value
@return 1 for negative, 0 for positive
*/
TRIO_PUBLIC int
trio_get_sign(double number)
{
unsigned int i;
unsigned char current;
int sign = (1 == 1);
for (i = 0; i < (unsigned int)sizeof(double); i++) {
current = ((unsigned char *)&number)[TRIO_DOUBLE_INDEX(i)];
sign
&= ((current & ieee_754_sign_mask[i]) == ieee_754_sign_mask[i]);
}
return sign;
}
/**
Generate negative zero
@return Floating-point representation of negative zero.
*/
TRIO_PUBLIC double
trio_nzero(void)
{
return trio_make_double(ieee_754_negzero_array);
}
#endif /* USE_IEEE_754 */ #endif /* USE_IEEE_754 */

67
xpath.c
View File

@ -95,6 +95,7 @@ static int xmlXPathDisableOptimizer = 0;
double xmlXPathNAN = 0; double xmlXPathNAN = 0;
double xmlXPathPINF = 1; double xmlXPathPINF = 1;
double xmlXPathNINF = -1; double xmlXPathNINF = -1;
double xmlXPathNZERO = 0;
static int xmlXPathInitialized = 0; static int xmlXPathInitialized = 0;
/** /**
@ -109,6 +110,7 @@ xmlXPathInit(void) {
xmlXPathPINF = trio_pinf(); xmlXPathPINF = trio_pinf();
xmlXPathNINF = trio_ninf(); xmlXPathNINF = trio_ninf();
xmlXPathNAN = trio_nan(); xmlXPathNAN = trio_nan();
xmlXPathNZERO = trio_nzero();
xmlXPathInitialized = 1; xmlXPathInitialized = 1;
} }
@ -143,6 +145,22 @@ xmlXPathIsInf(double val) {
return(trio_isinf(val)); return(trio_isinf(val));
} }
/**
* xmlXPathGetSign:
* @val: a double value
*
* Provides a portable function to detect the sign of a double
* Modified from trio code
* http://sourceforge.net/projects/ctrio/
*
* Returns 1 if the value is Negative, 0 if positive
*/
int
xmlXPathGetSign(double val) {
return(trio_get_sign(val));
}
/************************************************************************ /************************************************************************
* * * *
* Parser Types * * Parser Types *
@ -583,7 +601,7 @@ xmlXPathDebugDumpObject(FILE *output, xmlXPathObjectPtr cur, int depth) {
case XPATH_NUMBER: case XPATH_NUMBER:
switch (xmlXPathIsInf(cur->floatval)) { switch (xmlXPathIsInf(cur->floatval)) {
case 1: case 1:
fprintf(output, "Object is a number : +Infinity\n"); fprintf(output, "Object is a number : Infinity\n");
break; break;
case -1: case -1:
fprintf(output, "Object is a number : -Infinity\n"); fprintf(output, "Object is a number : -Infinity\n");
@ -1114,8 +1132,8 @@ xmlXPathFormatNumber(double number, char buffer[], int buffersize)
{ {
switch (xmlXPathIsInf(number)) { switch (xmlXPathIsInf(number)) {
case 1: case 1:
if (buffersize > (int)sizeof("+Infinity")) if (buffersize > (int)sizeof("Infinity"))
sprintf(buffer, "+Infinity"); sprintf(buffer, "Infinity");
break; break;
case -1: case -1:
if (buffersize > (int)sizeof("-Infinity")) if (buffersize > (int)sizeof("-Infinity"))
@ -1263,9 +1281,12 @@ xmlXPatherror(xmlXPathParserContextPtr ctxt, const char *file,
const xmlChar *cur; const xmlChar *cur;
const xmlChar *base; const xmlChar *base;
xmlGenericError(xmlGenericErrorContext, /* xmlGenericError(xmlGenericErrorContext,
"Error %s:%d: %s\n", file, line, "Error %s:%d: %s\n", file, line,
xmlXPathErrorMessages[no]); xmlXPathErrorMessages[no]);
*/
xmlGenericError(xmlGenericErrorContext,
"Error %s\n", xmlXPathErrorMessages[no]);
cur = ctxt->cur; cur = ctxt->cur;
base = ctxt->base; base = ctxt->base;
@ -3161,7 +3182,7 @@ xmlXPathCastNumberToString (double val) {
xmlChar *ret; xmlChar *ret;
switch (xmlXPathIsInf(val)) { switch (xmlXPathIsInf(val)) {
case 1: case 1:
ret = xmlStrdup((const xmlChar *) "+Infinity"); ret = xmlStrdup((const xmlChar *) "Infinity");
break; break;
case -1: case -1:
ret = xmlStrdup((const xmlChar *) "-Infinity"); ret = xmlStrdup((const xmlChar *) "-Infinity");
@ -4614,6 +4635,13 @@ void
xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt) { xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt) {
CAST_TO_NUMBER; CAST_TO_NUMBER;
CHECK_TYPE(XPATH_NUMBER); CHECK_TYPE(XPATH_NUMBER);
if (ctxt->value->floatval == 0) {
if (xmlXPathGetSign(ctxt->value->floatval) == 0)
ctxt->value->floatval = xmlXPathNZERO;
else
ctxt->value->floatval = 0;
}
else
ctxt->value->floatval = - ctxt->value->floatval; ctxt->value->floatval = - ctxt->value->floatval;
} }
@ -4710,7 +4738,15 @@ xmlXPathDivValues(xmlXPathParserContextPtr ctxt) {
CAST_TO_NUMBER; CAST_TO_NUMBER;
CHECK_TYPE(XPATH_NUMBER); CHECK_TYPE(XPATH_NUMBER);
if (val == 0) { if (val == 0 && xmlXPathGetSign(val) == 1) {
if (ctxt->value->floatval == 0)
ctxt->value->floatval = xmlXPathNAN;
else if (ctxt->value->floatval > 0)
ctxt->value->floatval = xmlXPathNINF;
else if (ctxt->value->floatval < 0)
ctxt->value->floatval = xmlXPathPINF;
}
else if (val == 0) {
if (ctxt->value->floatval == 0) if (ctxt->value->floatval == 0)
ctxt->value->floatval = xmlXPathNAN; ctxt->value->floatval = xmlXPathNAN;
else if (ctxt->value->floatval > 0) else if (ctxt->value->floatval > 0)
@ -4732,21 +4768,23 @@ xmlXPathDivValues(xmlXPathParserContextPtr ctxt) {
void void
xmlXPathModValues(xmlXPathParserContextPtr ctxt) { xmlXPathModValues(xmlXPathParserContextPtr ctxt) {
xmlXPathObjectPtr arg; xmlXPathObjectPtr arg;
int arg1, arg2; double arg1, arg2, tmp;
arg = valuePop(ctxt); arg = valuePop(ctxt);
if (arg == NULL) if (arg == NULL)
XP_ERROR(XPATH_INVALID_OPERAND); XP_ERROR(XPATH_INVALID_OPERAND);
arg2 = (int) xmlXPathCastToNumber(arg); arg2 = xmlXPathCastToNumber(arg);
xmlXPathFreeObject(arg); xmlXPathFreeObject(arg);
CAST_TO_NUMBER; CAST_TO_NUMBER;
CHECK_TYPE(XPATH_NUMBER); CHECK_TYPE(XPATH_NUMBER);
arg1 = (int) ctxt->value->floatval; arg1 = ctxt->value->floatval;
if (arg2 == 0) if (arg2 == 0)
ctxt->value->floatval = xmlXPathNAN; ctxt->value->floatval = xmlXPathNAN;
else else {
ctxt->value->floatval = arg1 % arg2; tmp=arg1/arg2;
ctxt->value->floatval = arg2 * (tmp - (double)((int)tmp));
}
} }
/************************************************************************ /************************************************************************
@ -6523,9 +6561,14 @@ xmlXPathCeilingFunction(xmlXPathParserContextPtr ctxt, int nargs) {
if (f != ctxt->value->floatval) { if (f != ctxt->value->floatval) {
if (ctxt->value->floatval > 0) if (ctxt->value->floatval > 0)
ctxt->value->floatval = f + 1; ctxt->value->floatval = f + 1;
else {
if (ctxt->value->floatval < 0 && f == 0)
ctxt->value->floatval = xmlXPathNZERO;
else else
ctxt->value->floatval = f; ctxt->value->floatval = f;
} }
}
#endif #endif
} }
@ -6560,6 +6603,8 @@ xmlXPathRoundFunction(xmlXPathParserContextPtr ctxt, int nargs) {
ctxt->value->floatval = f - 1; ctxt->value->floatval = f - 1;
else else
ctxt->value->floatval = f; ctxt->value->floatval = f;
if (ctxt->value->floatval == 0)
ctxt->value->floatval = xmlXPathNZERO;
} else { } else {
if (ctxt->value->floatval < f + 0.5) if (ctxt->value->floatval < f + 0.5)
ctxt->value->floatval = f; ctxt->value->floatval = f;