diff options
author | Martin <gzlist@googlemail.com> | 2009-09-17 16:54:18 +0200 |
---|---|---|
committer | Daniel Veillard <veillard@redhat.com> | 2009-09-17 16:54:18 +0200 |
commit | ce169a52f485dbf5522c0668e2975201b179add7 (patch) | |
tree | bf54bf74a0e518855b6502e6deb5a8cfb78ca554 /libexslt/math.c | |
parent | 3d435b25cf2e8112d87cb133c00b94d5924ec75c (diff) | |
download | libxslt-ce169a52f485dbf5522c0668e2975201b179add7.tar.gz libxslt-ce169a52f485dbf5522c0668e2975201b179add7.tar.bz2 libxslt-ce169a52f485dbf5522c0668e2975201b179add7.zip |
Allow use of EXSLT outside XSLT
* libexslt/exslt.h libexslt/date.c libexslt/math.c libexslt/sets.c
libexslt/strings.c: provide registration function for an XPath
context directly
Diffstat (limited to 'libexslt/math.c')
-rw-r--r-- | libexslt/math.c | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/libexslt/math.c b/libexslt/math.c index e56709bd..a1971e05 100644 --- a/libexslt/math.c +++ b/libexslt/math.c @@ -1106,3 +1106,97 @@ exsltMathRegister (void) { exsltMathExpFunction); #endif } + +/** + * exsltMathXpathCtxtRegister: + * + * Registers the EXSLT - Math module for use outside XSLT + */ +int +exsltMathXpathCtxtRegister (xmlXPathContextPtr ctxt, const xmlChar *prefix) +{ + if (ctxt + && prefix + && !xmlXPathRegisterNs(ctxt, + prefix, + (const xmlChar *) EXSLT_MATH_NAMESPACE) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "min", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathMinFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "max", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathMaxFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "highest", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathHighestFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "lowest", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathLowestFunction) +#ifdef HAVE_STDLIB_H + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "random", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathRandomFunction) +#endif +#if HAVE_MATH_H + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "abs", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathAbsFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "sqrt", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathSqrtFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "power", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathPowerFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "log", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathLogFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "sin", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathSinFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "cos", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathCosFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "tan", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathTanFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "asin", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathAsinFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "acos", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathAcosFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "atan", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathAtanFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "atan2", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathAtan2Function) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "exp", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathExpFunction) +#endif + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "constant", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathConstantFunction)) { + return 0; + } + return -1; +} |