16 # define FALSE (0 == 1) 17 # define TRUE (1 == 1) 20 #define SYMBOL_QUOTE ((xmlChar)'\'') 22 #define DEFAULT_TOKEN '0' 23 #define DEFAULT_SEPARATOR "." 25 #define MAX_TOKENS 1024 85 #define IS_SPECIAL(self,letter) \ 86 ((xsltUTF8Charcmp((letter), (self)->zeroDigit) == 0) || \ 87 (xsltUTF8Charcmp((letter), (self)->digit) == 0) || \ 88 (xsltUTF8Charcmp((letter), (self)->decimalPoint) == 0) || \ 89 (xsltUTF8Charcmp((letter), (self)->grouping) == 0) || \ 90 (xsltUTF8Charcmp((letter), (self)->patternSeparator) == 0)) 92 #define IS_DIGIT_ZERO(x) xsltIsDigitZero(x) 93 #define IS_DIGIT_ONE(x) xsltIsDigitZero((x)-1) 105 case 0x0030:
case 0x0660:
case 0x06F0:
case 0x0966:
106 case 0x09E6:
case 0x0A66:
case 0x0AE6:
case 0x0B66:
107 case 0x0C66:
case 0x0CE6:
case 0x0D66:
case 0x0E50:
108 case 0x0ED0:
case 0x0F20:
121 int groupingCharacter,
122 int groupingCharacterLen)
140 pointer = &temp_string[
sizeof(temp_string)] - 1;
143 while (
pointer > temp_string) {
146 if ((
i > 0) && (groupingCharacter != 0) &&
147 (digitsPerGroup > 0) &&
148 ((
i % digitsPerGroup) == 0)) {
149 if (
pointer - groupingCharacterLen < temp_string) {
153 pointer -= groupingCharacterLen;
185 "xsltNumberFormatDecimal: Internal buffer size exceeded\n");
215 data->digitsPerGroup,
216 data->groupingCharacter,
217 data->groupingCharacterLen);
222 pointer = &temp_string[
sizeof(temp_string)];
226 for (
i = 1;
i < (
int)
sizeof(temp_string);
i++) {
246 if (number < 1.0 || number > 5000.0) {
248 data->digitsPerGroup,
249 data->groupingCharacter,
250 data->groupingCharacterLen);
257 while (
number >= 1000.0) {
374 }
else if ( (
val ==
'A') ||
437 for (
i = 0;
i < numbers_max;
i++) {
439 number = numbers[(numbers_max - 1) -
i];
453 "xsl-number : negative value\n");
457 if (i < tokens->nTokens) {
463 }
else if (tokens->
nTokens > 0) {
486 switch (xmlXPathIsInf(
number)) {
494 if (xmlXPathIsNaN(
number)) {
498 switch (
token->token) {
517 data->digitsPerGroup,
518 data->groupingCharacter,
519 data->groupingCharacterLen);
542 if (countPat !=
NULL) {
588 if ((fromPat !=
NULL) &&
596 (
cur->type == XML_DOCB_DOCUMENT_NODE) ||
640 xmlXPathParserContextPtr
parser;
642 oldCtxtNode =
context->xpathCtxt->node;
648 if ((fromPat !=
NULL) &&
662 context->xpathCtxt->node = ancestor;
663 preceding = xmlXPathNextPrecedingSibling(
parser, ancestor);
664 while (preceding !=
NULL) {
668 context->xpathCtxt->node = ancestor;
670 xmlXPathNextPrecedingSibling(
parser, preceding);
677 ancestor = xmlXPathNextAncestor(
parser, ancestor);
679 xmlXPathFreeParserContext(
parser);
681 context->xpathCtxt->node = oldCtxtNode;
693 xmlXPathObjectPtr
obj;
706 xmlXPathFreeObject(
obj);
738 if (
data->has_format == 0)
751 goto XSLT_NUMBER_FORMAT_END;
769 }
else if (
data->level) {
786 double numarray[1024];
787 int max =
sizeof(numarray)/
sizeof(numarray[0]);
831 XSLT_NUMBER_FORMAT_END:
873 if (
info->is_multiplier_set)
875 info->multiplier = 100;
878 if (
info->is_multiplier_set)
880 info->multiplier = 1000;
940 xmlXPathError
status = XPATH_EXPRESSION_OK;
944 int prefix_length, suffix_length = 0, nprefix_length, nsuffix_length;
947 int self_grouping_len;
953 int delayed_multiplier = 0;
955 char default_sign = 0;
957 char found_error = 0;
961 "xsltFormatNumberConversion : " 962 "Invalid format (0-length)\n");
965 switch (xmlXPathIsInf(
number)) {
967 if (self->minusSign ==
NULL)
973 if ((
self ==
NULL) || (self->infinity ==
NULL))
979 if (xmlXPathIsNaN(
number)) {
980 if ((
self ==
NULL) || (self->noNumber ==
NULL))
990 return XPATH_MEMORY_ERROR;
1009 prefix = the_format;
1011 if (prefix_length < 0) {
1023 self_grouping_len =
xmlStrlen(self->grouping);
1024 while ((*the_format != 0) &&
1028 if (delayed_multiplier != 0) {
1031 delayed_multiplier = 0;
1045 }
else if ((self_grouping_len > 0) &&
1046 (!
xmlStrncmp(the_format, self->grouping, self_grouping_len))) {
1049 the_format += self_grouping_len;
1056 delayed_multiplier = 100;
1062 delayed_multiplier = 1000;
1075 if ( (*the_format != 0) &&
1085 while (*the_format != 0) {
1100 delayed_multiplier = 100;
1112 delayed_multiplier = 1000;
1127 if (delayed_multiplier != 0) {
1129 delayed_multiplier = 0;
1138 if (delayed_multiplier != 0) {
1140 delayed_multiplier = 0;
1143 suffix = the_format;
1145 if ( (suffix_length < 0) ||
1146 ((*the_format != 0) &&
1177 nprefix = the_format;
1180 if (nprefix_length<0) {
1185 while (*the_format != 0) {
1193 delayed_multiplier = 1;
1196 delayed_multiplier = 0;
1205 if (delayed_multiplier != 0) {
1211 if (*the_format != 0) {
1212 nsuffix = the_format;
1215 if (nsuffix_length < 0) {
1222 if (*the_format != 0) {
1230 if ((nprefix_length != prefix_length) ||
1231 (nsuffix_length != suffix_length) ||
1232 ((nprefix_length > 0) &&
1233 (
xmlStrncmp(nprefix, prefix, prefix_length) !=0 )) ||
1234 ((nsuffix_length > 0) &&
1235 (
xmlStrncmp(nsuffix, suffix, suffix_length) !=0 ))) {
1237 prefix_length = nprefix_length;
1239 suffix_length = nsuffix_length;
1248 if (found_error != 0) {
1250 "xsltFormatNumberConversion : " 1251 "error in format string '%s', using default\n",
format);
1252 default_sign = (
number < 0.0) ? 1 : 0;
1253 prefix_length = suffix_length = 0;
1264 if (default_sign != 0)
1268 for (
j = 0;
j < prefix_length; ) {
1281 if ((self->grouping !=
NULL) &&
1282 (self->grouping[0] != 0)) {
1333 for (
j = 0;
j < suffix_length; ) {
xsltFormat * xsltFormatPtr
static int xsltNumberFormatGetValue(xmlXPathContextPtr context, xmlNodePtr node, const xmlChar *value, double *number)
GLint GLint GLsizei width
static void xsltNumberFormatInsertNumbers(xsltNumberDataPtr data, double *numbers, int numbers_max, xsltFormatPtr tokens, xmlBufferPtr buffer)
static UCHAR ULONG UCHAR ULONG UCHAR * output
XMLPUBFUN const xmlChar *XMLCALL xmlBufferContent(const xmlBuffer *buf)
static int xsltTestCompMatchCount(xsltTransformContextPtr context, xmlNodePtr node, xsltCompMatchPtr countPat, xmlNodePtr cur)
XMLPUBFUN int XMLCALL xmlCopyCharMultiByte(xmlChar *out, int val)
GLsizei const GLvoid * pointer
XMLPUBFUN xmlChar *XMLCALL xmlStrndup(const xmlChar *cur, int len)
static int xsltUTF8Charcmp(xmlChar *utf1, xmlChar *utf2)
XMLPUBFUN const xmlChar *XMLCALL xmlUTF8Strpos(const xmlChar *utf, int pos)
GLuint GLuint GLsizei count
XMLPUBFUN int XMLCALL xmlStrlen(const xmlChar *str)
GLenum GLenum GLenum GLenum GLenum scale
XMLPUBFUN void XMLCALL xmlBufferFree(xmlBufferPtr buf)
static int xsltIsDigitZero(unsigned int ch)
XMLPUBFUN int XMLCALL xmlStringCurrentChar(xmlParserCtxtPtr ctxt, const xmlChar *cur, int *len)
static xsltFormatToken default_token
XMLPUBFUN xmlBufferPtr XMLCALL xmlBufferCreate(void)
xmlChar * xsltEvalAttrValueTemplate(xsltTransformContextPtr ctxt, xmlNodePtr inst, const xmlChar *name, const xmlChar *ns)
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
GLsizei GLsizei GLuint * obj
XMLPUBFUN int XMLCALL xmlBufferCCat(xmlBufferPtr buf, const char *str)
static void xsltNumberFormatAlpha(xsltNumberDataPtr data, xmlBufferPtr buffer, double number, int is_upper)
int xsltGetUTF8Char(const unsigned char *utf, int *len)
xmlGenericErrorFunc xsltGenericError
float pow(float __x, int __y)
static size_t double number
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
XMLPUBFUN xmlChar *XMLCALL xmlStrcat(xmlChar *cur, const xmlChar *add)
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
static int xsltNumberFormatGetMultipleLevel(xsltTransformContextPtr context, xmlNodePtr node, xsltCompMatchPtr countPat, xsltCompMatchPtr fromPat, double *array, int max)
void xsltNumberFormat(xsltTransformContextPtr ctxt, xsltNumberDataPtr data, xmlNodePtr node)
xmlXPathContextPtr xpathCtxt
xsltFormatToken * xsltFormatTokenPtr
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
XMLPUBFUN int XMLCALL xmlBufferCat(xmlBufferPtr buf, const xmlChar *str)
XMLPUBFUN int XMLCALL xmlUTF8Strloc(const xmlChar *utf, const xmlChar *utfchar)
#define DEFAULT_SEPARATOR
XMLPUBFUN int XMLCALL xmlUTF8Strsize(const xmlChar *utf, int len)
int xsltTestCompMatchList(xsltTransformContextPtr ctxt, xmlNodePtr node, xsltCompMatchPtr comp)
_Check_return_ double __cdecl fmod(_In_ double x, _In_ double y)
XMLPUBFUN int XMLCALL xmlBufferAdd(xmlBufferPtr buf, const xmlChar *str, int len)
XMLPUBVAR xmlFreeFunc xmlFree
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
void * xsltGenericErrorContext
static void xsltNumberFormatDecimal(xmlBufferPtr buffer, double number, int digit_zero, int width, int digitsPerGroup, int groupingCharacter, int groupingCharacterLen)
#define memcpy(s1, s2, n)
XMLPUBFUN int XMLCALL xmlStrncmp(const xmlChar *str1, const xmlChar *str2, int len)
#define LIBXML_DOCB_ENABLED
_Check_return_ _CRT_JIT_INTRINSIC double __cdecl fabs(_In_ double x)
static unsigned __int64 next
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
static int xsltFormatNumberPreSuffix(xsltDecimalFormatPtr self, xmlChar **format, xsltFormatNumberInfoPtr info)
static void xsltNumberFormatRoman(xsltNumberDataPtr data, xmlBufferPtr buffer, double number, int is_upper)
xmlXPathError xsltFormatNumberConversion(xsltDecimalFormatPtr self, xmlChar *format, double number, xmlChar **result)
void xsltCompMatchClearCache(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp)
static char alpha_upper_list[]
static char alpha_lower_list[]
static void xsltNumberFormatTokenize(const xmlChar *format, xsltFormatPtr tokens)
XMLPUBFUN int XMLCALL xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
_Check_return_ _CRTIMP double __cdecl floor(_In_ double x)
static int xsltNumberFormatGetAnyLevel(xsltTransformContextPtr context, xmlNodePtr node, xsltCompMatchPtr countPat, xsltCompMatchPtr fromPat, double *array)
#define IS_SPECIAL(self, letter)
static SERVICE_STATUS status
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *