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>
Bjorn Reese <breese@users.sourceforge.net>
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>
* 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
P.S.: Bjorn Reese, William Brack and Thomas Broyer get an exception for
the send before commit rule as well as John Fleck for the doc maintenance
Send them mail if I don't answer to request in a timely fashion
P.S.: Bjorn Reese, William Brack, Thomas Broyer and Igor Zlatkovic get an
exception for the send before commit rule as well as John Fleck
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$(top_srcdir)/include
DOCS_DIR = $(prefix)/share/doc/libxml2-python-$(LIBXML_VERSION)
DOCS_DIR = $(datadir)/doc/libxml2-python-$(LIBXML_VERSION)
# libxml2class.txt is generated
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= \
build.py \

View File

@ -145,6 +145,11 @@ static const char rcsid[] = "@(#)$Id$";
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 */
static TRIO_CONST unsigned char ieee_754_exponent_mask[] = {
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
};
/* 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 */
static TRIO_CONST unsigned char ieee_754_infinity_array[] = {
0x7F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
@ -207,6 +217,37 @@ trio_is_special_quantity(double number,
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 */

73
xpath.c
View File

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