Skip to content

Commit

Permalink
Added Igor Zlatkovic as official maintainer Albert Chin pointed that
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Daniel Veillard committed Mar 27, 2002
1 parent db1dc39 commit 5fc1f08
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 19 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 4 additions & 3 deletions HACKING
Original file line number Diff line number Diff line change
Expand Up @@ -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

2 changes: 1 addition & 1 deletion python/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion python/tests/Makefile.am
Original file line number Diff line number Diff line change
@@ -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 \
Expand Down
41 changes: 41 additions & 0 deletions trionan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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 */


Expand Down
73 changes: 59 additions & 14 deletions xpath.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ static int xmlXPathDisableOptimizer = 0;
double xmlXPathNAN = 0;
double xmlXPathPINF = 1;
double xmlXPathNINF = -1;
double xmlXPathNZERO = 0;
static int xmlXPathInitialized = 0;

/**
Expand All @@ -109,6 +110,7 @@ xmlXPathInit(void) {
xmlXPathPINF = trio_pinf();
xmlXPathNINF = trio_ninf();
xmlXPathNAN = trio_nan();
xmlXPathNZERO = trio_nzero();

xmlXPathInitialized = 1;
}
Expand Down Expand Up @@ -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 *
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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"))
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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;
}

/**
Expand Down Expand Up @@ -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)
Expand All @@ -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));
}
}

/************************************************************************
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 5fc1f08

Please sign in to comment.