33# define FALSE (0 == 1)
37#define SYMBOL_QUOTE ((xmlChar)'\'')
39#define DEFAULT_TOKEN '0'
40#define DEFAULT_SEPARATOR "."
42#define MAX_TOKENS 1024
108#define IS_SPECIAL(self,letter) \
109 ((xsltUTF8Charcmp((letter), (self)->zeroDigit) == 0) || \
110 (xsltUTF8Charcmp((letter), (self)->digit) == 0) || \
111 (xsltUTF8Charcmp((letter), (self)->decimalPoint) == 0) || \
112 (xsltUTF8Charcmp((letter), (self)->grouping) == 0) || \
113 (xsltUTF8Charcmp((letter), (self)->patternSeparator) == 0))
115#define IS_DIGIT_ZERO(x) xsltIsDigitZero(x)
116#define IS_DIGIT_ONE(x) xsltIsDigitZero((x)-1)
128 case 0x0030:
case 0x0660:
case 0x06F0:
case 0x0966:
129 case 0x09E6:
case 0x0A66:
case 0x0AE6:
case 0x0B66:
130 case 0x0C66:
case 0x0CE6:
case 0x0D66:
case 0x0E50:
131 case 0x0ED0:
case 0x0F20:
144 int groupingCharacter,
145 int groupingCharacterLen)
163 pointer = &temp_string[
sizeof(temp_string)] - 1;
166 while (
pointer > temp_string) {
169 if ((
i > 0) && (groupingCharacter != 0) &&
170 (digitsPerGroup > 0) &&
171 ((
i % digitsPerGroup) == 0)) {
172 if (
pointer - groupingCharacterLen < temp_string) {
176 pointer -= groupingCharacterLen;
208 "xsltNumberFormatDecimal: Internal buffer size exceeded\n");
238 data->digitsPerGroup,
239 data->groupingCharacter,
240 data->groupingCharacterLen);
245 pointer = &temp_string[
sizeof(temp_string)];
249 for (
i = 1;
i < (
int)
sizeof(temp_string);
i++) {
269 if (number < 1.0 || number > 5000.0) {
271 data->digitsPerGroup,
272 data->groupingCharacter,
273 data->groupingCharacterLen);
280 while (
number >= 1000.0) {
396 }
else if ( (
val ==
'A') ||
459 for (
i = 0;
i < numbers_max;
i++) {
461 number = numbers[(numbers_max - 1) -
i];
475 "xsl-number : negative value\n");
479 if (i < tokens->nTokens) {
485 }
else if (tokens->
nTokens > 0) {
508 switch (xmlXPathIsInf(
number)) {
510 xmlBufferCCat(
buffer,
"-Infinity");
513 xmlBufferCCat(
buffer,
"Infinity");
516 if (xmlXPathIsNaN(
number)) {
517 xmlBufferCCat(
buffer,
"NaN");
520 switch (
token->token) {
539 data->digitsPerGroup,
540 data->groupingCharacter,
541 data->groupingCharacterLen);
564 if (countPat !=
NULL) {
578 if (
node->type == XML_NAMESPACE_DECL)
610 if ((fromPat !=
NULL) &&
616 if ((
cur->type == XML_DOCUMENT_NODE) ||
617#ifdef LIBXML_DOCB_ENABLED
618 (
cur->type == XML_DOCB_DOCUMENT_NODE) ||
620 (
cur->type == XML_HTML_DOCUMENT_NODE))
623 if (
cur->type == XML_NAMESPACE_DECL) {
629 }
else if (
cur->type == XML_ATTRIBUTE_NODE) {
632 while ((
cur->prev !=
NULL) && ((
cur->prev->type == XML_DTD_NODE) ||
633 (
cur->prev->type == XML_XINCLUDE_START) ||
634 (
cur->prev->type == XML_XINCLUDE_END)))
659 xmlNodePtr oldCtxtNode;
661 xmlNodePtr preceding;
662 xmlXPathParserContextPtr
parser;
664 oldCtxtNode =
context->xpathCtxt->node;
669 while ((ancestor !=
NULL) && (ancestor->type != XML_DOCUMENT_NODE)) {
670 if ((fromPat !=
NULL) &&
684 context->xpathCtxt->node = ancestor;
685 preceding = xmlXPathNextPrecedingSibling(
parser, ancestor);
686 while (preceding !=
NULL) {
690 context->xpathCtxt->node = ancestor;
692 xmlXPathNextPrecedingSibling(
parser, preceding);
699 ancestor = xmlXPathNextAncestor(
parser, ancestor);
701 xmlXPathFreeParserContext(
parser);
703 context->xpathCtxt->node = oldCtxtNode;
715 xmlXPathObjectPtr
obj;
719 xmlBufferCCat(
pattern,
"number(");
723 obj = xmlXPathEvalExpression(xmlBufferContent(
pattern),
728 xmlXPathFreeObject(
obj);
748 xmlBufferPtr output =
NULL;
760 if (
data->has_format == 0)
771 output = xmlBufferCreate();
773 goto XSLT_NUMBER_FORMAT_END;
791 }
else if (
data->level) {
808 double numarray[1024];
809 int max =
sizeof(numarray)/
sizeof(numarray[0]);
851 xmlBufferFree(output);
853XSLT_NUMBER_FORMAT_END:
895 if (
info->is_multiplier_set)
897 info->multiplier = 100;
900 if (
info->is_multiplier_set)
902 info->multiplier = 1000;
962 xmlXPathError
status = XPATH_EXPRESSION_OK;
966 int prefix_length, suffix_length = 0, nprefix_length, nsuffix_length;
970 int self_grouping_len;
976 int delayed_multiplier = 0;
978 char default_sign = 0;
980 char found_error = 0;
984 "xsltFormatNumberConversion : "
985 "Invalid format (0-length)\n");
988 if (xmlXPathIsNaN(
number)) {
1014 if (prefix_length < 0) {
1027 while ((*the_format != 0) &&
1031 if (delayed_multiplier != 0) {
1034 delayed_multiplier = 0;
1048 }
else if ((self_grouping_len > 0) &&
1052 the_format += self_grouping_len;
1059 delayed_multiplier = 100;
1065 delayed_multiplier = 1000;
1078 if ( (*the_format != 0) &&
1088 while (*the_format != 0) {
1103 delayed_multiplier = 100;
1115 delayed_multiplier = 1000;
1130 if (delayed_multiplier != 0) {
1132 delayed_multiplier = 0;
1141 if (delayed_multiplier != 0) {
1143 delayed_multiplier = 0;
1146 suffix = the_format;
1148 if ( (suffix_length < 0) ||
1149 ((*the_format != 0) &&
1180 nprefix = the_format;
1183 if (nprefix_length<0) {
1188 while (*the_format != 0) {
1196 delayed_multiplier = 1;
1199 delayed_multiplier = 0;
1208 if (delayed_multiplier != 0) {
1214 if (*the_format != 0) {
1215 nsuffix = the_format;
1218 if (nsuffix_length < 0) {
1225 if (*the_format != 0) {
1233 if ((nprefix_length != prefix_length) ||
1234 (nsuffix_length != suffix_length) ||
1235 ((nprefix_length > 0) &&
1237 ((nsuffix_length > 0) &&
1238 (
xmlStrncmp(nsuffix, suffix, suffix_length) !=0 ))) {
1240 prefix_length = nprefix_length;
1242 suffix_length = nsuffix_length;
1251 if (found_error != 0) {
1253 "xsltFormatNumberConversion : "
1254 "error in format string '%s', using default\n",
format);
1255 default_sign = (
number < 0.0) ? 1 : 0;
1256 prefix_length = suffix_length = 0;
1285 buffer = xmlBufferCreate();
1287 return XPATH_MEMORY_ERROR;
1291 if (default_sign != 0)
1295 for (
j = 0;
j < prefix_length; ) {
1374 for (
j = 0;
j < suffix_length; ) {
static char alpha_lower_list[]
static int xsltTestCompMatchCount(xsltTransformContextPtr context, xmlNodePtr node, xsltCompMatchPtr countPat, xmlNodePtr cur)
static int xsltIsDigitZero(int ch)
static void xsltNumberFormatInsertNumbers(xsltNumberDataPtr data, double *numbers, int numbers_max, xsltFormatPtr tokens, xmlBufferPtr buffer)
static int xsltNumberFormatGetMultipleLevel(xsltTransformContextPtr context, xmlNodePtr node, xsltCompMatchPtr countPat, xsltCompMatchPtr fromPat, double *array, int max)
static char alpha_upper_list[]
static xsltFormatToken default_token
static int xsltNumberFormatGetValue(xmlXPathContextPtr context, xmlNodePtr node, const xmlChar *value, double *number)
static void xsltNumberFormatDecimal(xmlBufferPtr buffer, double number, int digit_zero, int width, int digitsPerGroup, int groupingCharacter, int groupingCharacterLen)
xsltFormat * xsltFormatPtr
static void xsltNumberFormatRoman(xsltNumberDataPtr data, xmlBufferPtr buffer, double number, int is_upper)
xmlXPathError xsltFormatNumberConversion(xsltDecimalFormatPtr self, xmlChar *format, double number, xmlChar **result)
static int xsltIsLetterDigit(int val)
xsltFormatToken * xsltFormatTokenPtr
#define DEFAULT_SEPARATOR
#define IS_SPECIAL(self, letter)
static void xsltNumberFormatTokenize(const xmlChar *format, xsltFormatPtr tokens)
static int xsltUTF8Charcmp(xmlChar *utf1, xmlChar *utf2)
static int xsltNumberFormatGetAnyLevel(xsltTransformContextPtr context, xmlNodePtr node, xsltCompMatchPtr countPat, xsltCompMatchPtr fromPat, double *array)
static int xsltFormatNumberPreSuffix(xsltDecimalFormatPtr self, xmlChar **format, xsltFormatNumberInfoPtr info)
static void xsltNumberFormatAlpha(xsltNumberDataPtr data, xmlBufferPtr buffer, double number, int is_upper)
void xsltNumberFormat(xsltTransformContextPtr ctxt, xsltNumberDataPtr data, xmlNodePtr node)
#define xmlIsIdeographicQ(c)
#define xmlIsBaseCharQ(c)
int xsltTestCompMatchList(xsltTransformContextPtr ctxt, xmlNodePtr node, xsltCompMatchPtr comp)
void xsltCompMatchClearCache(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp)
_ACRTIMP double __cdecl fabs(double)
_ACRTIMP double __cdecl fmod(double, double)
_ACRTIMP double __cdecl floor(double)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
double pow(double x, double y)
GLuint GLuint GLsizei count
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLint GLint GLsizei width
GLenum GLenum GLenum GLenum GLenum scale
GLsizei const GLvoid * pointer
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
#define memcpy(s1, s2, n)
static unsigned int number
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
XMLPUBFUN int xmlCopyCharMultiByte(xmlChar *out, int val)
static unsigned __int64 next
xmlXPathContextPtr xpathCtxt
xmlChar * xsltEvalAttrValueTemplate(xsltTransformContextPtr ctxt, xmlNodePtr inst, const xmlChar *name, const xmlChar *ns)
Character const *const prefix
XMLPUBFUN int xmlUTF8Strloc(const xmlChar *utf, const xmlChar *utfchar)
XMLPUBFUN xmlChar * xmlStrndup(const xmlChar *cur, int len)
XMLPUBFUN int xmlStrlen(const xmlChar *str)
XMLPUBFUN const xmlChar * xmlUTF8Strpos(const xmlChar *utf, int pos)
XMLPUBFUN int xmlStrncmp(const xmlChar *str1, const xmlChar *str2, int len)
XMLPUBFUN xmlChar * xmlStrcat(xmlChar *cur, const xmlChar *add)
XMLPUBFUN int xmlUTF8Strsize(const xmlChar *utf, int len)
XMLPUBFUN int xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
XMLPUBFUN xmlChar * xmlStrdup(const xmlChar *cur)
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
xmlGenericErrorFunc xsltGenericError
int xsltGetUTF8Char(const unsigned char *utf, int *len)
int xsltGetUTF8CharZ(const unsigned char *utf, int *len)
void * xsltGenericErrorContext