| OLD | NEW |
| 1 #define IN_LIBEXSLT | 1 #define IN_LIBEXSLT |
| 2 #include "libexslt/libexslt.h" | 2 #include "libexslt/libexslt.h" |
| 3 | 3 |
| 4 #if defined(WIN32) && !defined (__CYGWIN__) && (!__MINGW32__) | 4 #if defined(WIN32) && !defined (__CYGWIN__) && (!__MINGW32__) |
| 5 #include <win32config.h> | 5 #include <win32config.h> |
| 6 #else | 6 #else |
| 7 #include "config.h" | 7 #include "config.h" |
| 8 #endif | 8 #endif |
| 9 | 9 |
| 10 #include <libxml/tree.h> | 10 #include <libxml/tree.h> |
| (...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 965 | 965 |
| 966 /** | 966 /** |
| 967 * exsltMathAtan2Function: | 967 * exsltMathAtan2Function: |
| 968 * @ctxt: an XPath parser context | 968 * @ctxt: an XPath parser context |
| 969 * @nargs: the number of arguments | 969 * @nargs: the number of arguments |
| 970 * | 970 * |
| 971 * Wraps #exsltMathAtan2 for use by the XPath processor. | 971 * Wraps #exsltMathAtan2 for use by the XPath processor. |
| 972 */ | 972 */ |
| 973 static void | 973 static void |
| 974 exsltMathAtan2Function (xmlXPathParserContextPtr ctxt, int nargs) { | 974 exsltMathAtan2Function (xmlXPathParserContextPtr ctxt, int nargs) { |
| 975 double ret, y; | 975 double ret, x; |
| 976 | 976 |
| 977 if (nargs != 2) { | 977 if (nargs != 2) { |
| 978 xmlXPathSetArityError(ctxt); | 978 xmlXPathSetArityError(ctxt); |
| 979 return; | 979 return; |
| 980 } | 980 } |
| 981 y = xmlXPathPopNumber(ctxt); | 981 x = xmlXPathPopNumber(ctxt); |
| 982 if (xmlXPathCheckError(ctxt)) | 982 if (xmlXPathCheckError(ctxt)) |
| 983 return; | 983 return; |
| 984 | 984 |
| 985 /* x */ | 985 /* y */ |
| 986 ret = xmlXPathPopNumber(ctxt); | 986 ret = xmlXPathPopNumber(ctxt); |
| 987 if (xmlXPathCheckError(ctxt)) | 987 if (xmlXPathCheckError(ctxt)) |
| 988 return; | 988 return; |
| 989 | 989 |
| 990 ret = exsltMathAtan2(y, ret); | 990 ret = exsltMathAtan2(ret, x); |
| 991 | 991 |
| 992 xmlXPathReturnNumber(ctxt, ret); | 992 xmlXPathReturnNumber(ctxt, ret); |
| 993 } | 993 } |
| 994 | 994 |
| 995 /** | 995 /** |
| 996 * exsltMathExp: | 996 * exsltMathExp: |
| 997 * @num: a double | 997 * @num: a double |
| 998 * | 998 * |
| 999 * Implements the EXSLT - Math exp() function: | 999 * Implements the EXSLT - Math exp() function: |
| 1000 * number math:exp (number) | 1000 * number math:exp (number) |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1099 EXSLT_MATH_NAMESPACE, | 1099 EXSLT_MATH_NAMESPACE, |
| 1100 exsltMathAtanFunction); | 1100 exsltMathAtanFunction); |
| 1101 xsltRegisterExtModuleFunction ((const xmlChar *) "atan2", | 1101 xsltRegisterExtModuleFunction ((const xmlChar *) "atan2", |
| 1102 EXSLT_MATH_NAMESPACE, | 1102 EXSLT_MATH_NAMESPACE, |
| 1103 exsltMathAtan2Function); | 1103 exsltMathAtan2Function); |
| 1104 xsltRegisterExtModuleFunction ((const xmlChar *) "exp", | 1104 xsltRegisterExtModuleFunction ((const xmlChar *) "exp", |
| 1105 EXSLT_MATH_NAMESPACE, | 1105 EXSLT_MATH_NAMESPACE, |
| 1106 exsltMathExpFunction); | 1106 exsltMathExpFunction); |
| 1107 #endif | 1107 #endif |
| 1108 } | 1108 } |
| 1109 |
| 1110 /** |
| 1111 * exsltMathXpathCtxtRegister: |
| 1112 * |
| 1113 * Registers the EXSLT - Math module for use outside XSLT |
| 1114 */ |
| 1115 int |
| 1116 exsltMathXpathCtxtRegister (xmlXPathContextPtr ctxt, const xmlChar *prefix) |
| 1117 { |
| 1118 if (ctxt |
| 1119 && prefix |
| 1120 && !xmlXPathRegisterNs(ctxt, |
| 1121 prefix, |
| 1122 (const xmlChar *) EXSLT_MATH_NAMESPACE) |
| 1123 && !xmlXPathRegisterFuncNS(ctxt, |
| 1124 (const xmlChar *) "min", |
| 1125 (const xmlChar *) EXSLT_MATH_NAMESPACE, |
| 1126 exsltMathMinFunction) |
| 1127 && !xmlXPathRegisterFuncNS(ctxt, |
| 1128 (const xmlChar *) "max", |
| 1129 (const xmlChar *) EXSLT_MATH_NAMESPACE, |
| 1130 exsltMathMaxFunction) |
| 1131 && !xmlXPathRegisterFuncNS(ctxt, |
| 1132 (const xmlChar *) "highest", |
| 1133 (const xmlChar *) EXSLT_MATH_NAMESPACE, |
| 1134 exsltMathHighestFunction) |
| 1135 && !xmlXPathRegisterFuncNS(ctxt, |
| 1136 (const xmlChar *) "lowest", |
| 1137 (const xmlChar *) EXSLT_MATH_NAMESPACE, |
| 1138 exsltMathLowestFunction) |
| 1139 #ifdef HAVE_STDLIB_H |
| 1140 && !xmlXPathRegisterFuncNS(ctxt, |
| 1141 (const xmlChar *) "random", |
| 1142 (const xmlChar *) EXSLT_MATH_NAMESPACE, |
| 1143 exsltMathRandomFunction) |
| 1144 #endif |
| 1145 #if HAVE_MATH_H |
| 1146 && !xmlXPathRegisterFuncNS(ctxt, |
| 1147 (const xmlChar *) "abs", |
| 1148 (const xmlChar *) EXSLT_MATH_NAMESPACE, |
| 1149 exsltMathAbsFunction) |
| 1150 && !xmlXPathRegisterFuncNS(ctxt, |
| 1151 (const xmlChar *) "sqrt", |
| 1152 (const xmlChar *) EXSLT_MATH_NAMESPACE, |
| 1153 exsltMathSqrtFunction) |
| 1154 && !xmlXPathRegisterFuncNS(ctxt, |
| 1155 (const xmlChar *) "power", |
| 1156 (const xmlChar *) EXSLT_MATH_NAMESPACE, |
| 1157 exsltMathPowerFunction) |
| 1158 && !xmlXPathRegisterFuncNS(ctxt, |
| 1159 (const xmlChar *) "log", |
| 1160 (const xmlChar *) EXSLT_MATH_NAMESPACE, |
| 1161 exsltMathLogFunction) |
| 1162 && !xmlXPathRegisterFuncNS(ctxt, |
| 1163 (const xmlChar *) "sin", |
| 1164 (const xmlChar *) EXSLT_MATH_NAMESPACE, |
| 1165 exsltMathSinFunction) |
| 1166 && !xmlXPathRegisterFuncNS(ctxt, |
| 1167 (const xmlChar *) "cos", |
| 1168 (const xmlChar *) EXSLT_MATH_NAMESPACE, |
| 1169 exsltMathCosFunction) |
| 1170 && !xmlXPathRegisterFuncNS(ctxt, |
| 1171 (const xmlChar *) "tan", |
| 1172 (const xmlChar *) EXSLT_MATH_NAMESPACE, |
| 1173 exsltMathTanFunction) |
| 1174 && !xmlXPathRegisterFuncNS(ctxt, |
| 1175 (const xmlChar *) "asin", |
| 1176 (const xmlChar *) EXSLT_MATH_NAMESPACE, |
| 1177 exsltMathAsinFunction) |
| 1178 && !xmlXPathRegisterFuncNS(ctxt, |
| 1179 (const xmlChar *) "acos", |
| 1180 (const xmlChar *) EXSLT_MATH_NAMESPACE, |
| 1181 exsltMathAcosFunction) |
| 1182 && !xmlXPathRegisterFuncNS(ctxt, |
| 1183 (const xmlChar *) "atan", |
| 1184 (const xmlChar *) EXSLT_MATH_NAMESPACE, |
| 1185 exsltMathAtanFunction) |
| 1186 && !xmlXPathRegisterFuncNS(ctxt, |
| 1187 (const xmlChar *) "atan2", |
| 1188 (const xmlChar *) EXSLT_MATH_NAMESPACE, |
| 1189 exsltMathAtan2Function) |
| 1190 && !xmlXPathRegisterFuncNS(ctxt, |
| 1191 (const xmlChar *) "exp", |
| 1192 (const xmlChar *) EXSLT_MATH_NAMESPACE, |
| 1193 exsltMathExpFunction) |
| 1194 #endif |
| 1195 && !xmlXPathRegisterFuncNS(ctxt, |
| 1196 (const xmlChar *) "constant", |
| 1197 (const xmlChar *) EXSLT_MATH_NAMESPACE, |
| 1198 exsltMathConstantFunction)) { |
| 1199 return 0; |
| 1200 } |
| 1201 return -1; |
| 1202 } |
| OLD | NEW |