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 91 #define IS_SPECIAL(self,letter) \ 92 ((xsltUTF8Charcmp((letter), (self)->zeroDigit) == 0) || \ 93 (xsltUTF8Charcmp((letter), (self)->digit) == 0) || \ 94 (xsltUTF8Charcmp((letter), (self)->decimalPoint) == 0) || \ 95 (xsltUTF8Charcmp((letter), (self)->grouping) == 0) || \ 96 (xsltUTF8Charcmp((letter), (self)->patternSeparator) == 0)) 98 #define IS_DIGIT_ZERO(x) xsltIsDigitZero(x) 99 #define IS_DIGIT_ONE(x) xsltIsDigitZero((x)-1) 111 case 0x0030:
case 0x0660:
case 0x06F0:
case 0x0966:
112 case 0x09E6:
case 0x0A66:
case 0x0AE6:
case 0x0B66:
113 case 0x0C66:
case 0x0CE6:
case 0x0D66:
case 0x0E50:
114 case 0x0ED0:
case 0x0F20:
127 int groupingCharacter,
128 int groupingCharacterLen)
146 pointer = &temp_string[
sizeof(temp_string)] - 1;
149 while (
pointer > temp_string) {
152 if ((
i > 0) && (groupingCharacter != 0) &&
153 (digitsPerGroup > 0) &&
154 ((
i % digitsPerGroup) == 0)) {
155 if (
pointer - groupingCharacterLen < temp_string) {
159 pointer -= groupingCharacterLen;
191 "xsltNumberFormatDecimal: Internal buffer size exceeded\n");
221 data->digitsPerGroup,
222 data->groupingCharacter,
223 data->groupingCharacterLen);
228 pointer = &temp_string[
sizeof(temp_string)];
232 for (
i = 1;
i < (
int)
sizeof(temp_string);
i++) {
252 if (number < 1.0 || number > 5000.0) {
254 data->digitsPerGroup,
255 data->groupingCharacter,
256 data->groupingCharacterLen);
263 while (
number >= 1000.0) {
380 }
else if ( (
val ==
'A') ||
443 for (
i = 0;
i < numbers_max;
i++) {
445 number = numbers[(numbers_max - 1) -
i];
459 "xsl-number : negative value\n");
463 if (i < tokens->nTokens) {
469 }
else if (tokens->
nTokens > 0) {
492 switch (xmlXPathIsInf(
number)) {
500 if (xmlXPathIsNaN(
number)) {
504 switch (
token->token) {
523 data->digitsPerGroup,
524 data->groupingCharacter,
525 data->groupingCharacterLen);
548 if (countPat !=
NULL) {
594 if ((fromPat !=
NULL) &&
601 #ifdef LIBXML_DOCB_ENABLED
646 xmlXPathParserContextPtr
parser;
648 oldCtxtNode =
context->xpathCtxt->node;
654 if ((fromPat !=
NULL) &&
668 context->xpathCtxt->node = ancestor;
669 preceding = xmlXPathNextPrecedingSibling(
parser, ancestor);
670 while (preceding !=
NULL) {
674 context->xpathCtxt->node = ancestor;
676 xmlXPathNextPrecedingSibling(
parser, preceding);
683 ancestor = xmlXPathNextAncestor(
parser, ancestor);
685 xmlXPathFreeParserContext(
parser);
687 context->xpathCtxt->node = oldCtxtNode;
699 xmlXPathObjectPtr
obj;
712 xmlXPathFreeObject(
obj);
744 if (
data->has_format == 0)
757 goto XSLT_NUMBER_FORMAT_END;
775 }
else if (
data->level) {
792 double numarray[1024];
793 int max =
sizeof(numarray)/
sizeof(numarray[0]);
837 XSLT_NUMBER_FORMAT_END:
879 if (
info->is_multiplier_set)
881 info->multiplier = 100;
884 if (
info->is_multiplier_set)
886 info->multiplier = 1000;
946 xmlXPathError
status = XPATH_EXPRESSION_OK;
950 int prefix_length, suffix_length = 0, nprefix_length, nsuffix_length;
953 int self_grouping_len;
959 int delayed_multiplier = 0;
961 char default_sign = 0;
963 char found_error = 0;
967 "xsltFormatNumberConversion : " 968 "Invalid format (0-length)\n");
971 switch (xmlXPathIsInf(
number)) {
973 if (self->minusSign ==
NULL)
979 if ((
self ==
NULL) || (self->infinity ==
NULL))
985 if (xmlXPathIsNaN(
number)) {
986 if ((
self ==
NULL) || (self->noNumber ==
NULL))
996 return XPATH_MEMORY_ERROR;
1015 prefix = the_format;
1017 if (prefix_length < 0) {
1029 self_grouping_len =
xmlStrlen(self->grouping);
1030 while ((*the_format != 0) &&
1034 if (delayed_multiplier != 0) {
1037 delayed_multiplier = 0;
1051 }
else if ((self_grouping_len > 0) &&
1052 (!
xmlStrncmp(the_format, self->grouping, self_grouping_len))) {
1055 the_format += self_grouping_len;
1062 delayed_multiplier = 100;
1068 delayed_multiplier = 1000;
1081 if ( (*the_format != 0) &&
1091 while (*the_format != 0) {
1106 delayed_multiplier = 100;
1118 delayed_multiplier = 1000;
1133 if (delayed_multiplier != 0) {
1135 delayed_multiplier = 0;
1144 if (delayed_multiplier != 0) {
1146 delayed_multiplier = 0;
1149 suffix = the_format;
1151 if ( (suffix_length < 0) ||
1152 ((*the_format != 0) &&
1183 nprefix = the_format;
1186 if (nprefix_length<0) {
1191 while (*the_format != 0) {
1199 delayed_multiplier = 1;
1202 delayed_multiplier = 0;
1211 if (delayed_multiplier != 0) {
1217 if (*the_format != 0) {
1218 nsuffix = the_format;
1221 if (nsuffix_length < 0) {
1228 if (*the_format != 0) {
1236 if ((nprefix_length != prefix_length) ||
1237 (nsuffix_length != suffix_length) ||
1238 ((nprefix_length > 0) &&
1239 (
xmlStrncmp(nprefix, prefix, prefix_length) !=0 )) ||
1240 ((nsuffix_length > 0) &&
1241 (
xmlStrncmp(nsuffix, suffix, suffix_length) !=0 ))) {
1243 prefix_length = nprefix_length;
1245 suffix_length = nsuffix_length;
1254 if (found_error != 0) {
1256 "xsltFormatNumberConversion : " 1257 "error in format string '%s', using default\n",
format);
1258 default_sign = (
number < 0.0) ? 1 : 0;
1259 prefix_length = suffix_length = 0;
1270 if (default_sign != 0)
1274 for (
j = 0;
j < prefix_length; ) {
1287 if ((self->grouping !=
NULL) &&
1288 (self->grouping[0] != 0)) {
1339 for (
j = 0;
j < suffix_length; ) {
xsltFormat * xsltFormatPtr
static int xsltNumberFormatGetValue(xmlXPathContextPtr context, xmlNodePtr node, const xmlChar *value, double *number)
double pow(double x, double y)
GLint GLint GLsizei width
static void xsltNumberFormatInsertNumbers(xsltNumberDataPtr data, double *numbers, int numbers_max, xsltFormatPtr tokens, xmlBufferPtr buffer)
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)
#define XML_DOCB_DOCUMENT_NODE
XMLPUBFUN int XMLCALL xmlStringCurrentChar(xmlParserCtxtPtr ctxt, const xmlChar *cur, int *len)
static xsltFormatToken default_token
#define xmlIsBaseCharQ(c)
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
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)
#define xmlIsIdeographicQ(c)
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)
static int xsltIsLetterDigit(int val)
XMLPUBFUN int XMLCALL xmlStrncmp(const xmlChar *str1, const xmlChar *str2, int len)
_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 *