mirror of
https://gitlab.gnome.org/GNOME/libxslt
synced 2025-11-27 16:21:14 +03:00
added date:sum routine supplied by Joel Reed
* libexslt/date.c: added date:sum routine supplied by Joel Reed
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
Fri Aug 6 11:05:31 PDT 2004 William Brack <wbrack@mmm.com.hk>
|
||||
|
||||
* libexslt/date.c: added date:sum routine supplied by Joel
|
||||
Reed
|
||||
|
||||
Wed Aug 4 00:04:13 CEST 2004 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* doc/downloads.html doc/xslt.html: fixed a couple of problems
|
||||
|
||||
@@ -253,7 +253,8 @@ dnl
|
||||
if [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XSLT" ]] || \
|
||||
[[ "${LOGNAME}" = "bill" -a "`pwd`" = "/home/bill/gnomecvs/xsltest" ]]
|
||||
then
|
||||
if test "${with_mem_debug}" = "" ; then
|
||||
if test "${with_mem_debug}" = "" ;
|
||||
then
|
||||
with_mem_debug="yes"
|
||||
fi
|
||||
CFLAGS="-Wall -g -O -ansi -pedantic -W -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline "
|
||||
|
||||
378
libexslt/date.c
378
libexslt/date.c
@@ -197,7 +197,8 @@ static const unsigned long dayInLeapYearByMonth[12] =
|
||||
* Returns 0 or the error code
|
||||
*/
|
||||
static int
|
||||
_exsltDateParseGYear (exsltDateValDatePtr dt, const xmlChar **str) {
|
||||
_exsltDateParseGYear (exsltDateValDatePtr dt, const xmlChar **str)
|
||||
{
|
||||
const xmlChar *cur = *str, *firstChar;
|
||||
int isneg = 0, digcnt = 0;
|
||||
|
||||
@@ -366,7 +367,8 @@ _exsltDateParseGYear (exsltDateValDatePtr dt, const xmlChar **str) {
|
||||
* Returns 0 or the error code
|
||||
*/
|
||||
static int
|
||||
_exsltDateParseGMonth (exsltDateValDatePtr dt, const xmlChar **str) {
|
||||
_exsltDateParseGMonth (exsltDateValDatePtr dt, const xmlChar **str)
|
||||
{
|
||||
const xmlChar *cur = *str;
|
||||
int ret = 0;
|
||||
|
||||
@@ -410,7 +412,8 @@ _exsltDateParseGMonth (exsltDateValDatePtr dt, const xmlChar **str) {
|
||||
* Returns 0 or the error code
|
||||
*/
|
||||
static int
|
||||
_exsltDateParseGDay (exsltDateValDatePtr dt, const xmlChar **str) {
|
||||
_exsltDateParseGDay (exsltDateValDatePtr dt, const xmlChar **str)
|
||||
{
|
||||
const xmlChar *cur = *str;
|
||||
int ret = 0;
|
||||
|
||||
@@ -472,7 +475,8 @@ _exsltDateParseGDay (exsltDateValDatePtr dt, const xmlChar **str) {
|
||||
* Returns 0 or the error code
|
||||
*/
|
||||
static int
|
||||
_exsltDateParseTime (exsltDateValDatePtr dt, const xmlChar **str) {
|
||||
_exsltDateParseTime (exsltDateValDatePtr dt, const xmlChar **str)
|
||||
{
|
||||
const xmlChar *cur = *str;
|
||||
unsigned int hour = 0; /* use temp var in case str is not xs:time */
|
||||
int ret = 0;
|
||||
@@ -543,7 +547,8 @@ _exsltDateParseTime (exsltDateValDatePtr dt, const xmlChar **str) {
|
||||
* Returns 0 or the error code
|
||||
*/
|
||||
static int
|
||||
_exsltDateParseTimeZone (exsltDateValDatePtr dt, const xmlChar **str) {
|
||||
_exsltDateParseTimeZone (exsltDateValDatePtr dt, const xmlChar **str)
|
||||
{
|
||||
const xmlChar *cur = *str;
|
||||
int ret = 0;
|
||||
|
||||
@@ -649,7 +654,8 @@ _exsltDateParseTimeZone (exsltDateValDatePtr dt, const xmlChar **str) {
|
||||
* Returns the #exsltDateValPtr
|
||||
*/
|
||||
static exsltDateValPtr
|
||||
exsltDateCreateDate (exsltDateType type) {
|
||||
exsltDateCreateDate (exsltDateType type)
|
||||
{
|
||||
exsltDateValPtr ret;
|
||||
|
||||
ret = (exsltDateValPtr) xmlMalloc(sizeof(exsltDateVal));
|
||||
@@ -737,7 +743,8 @@ exsltDateFreeDate (exsltDateValPtr date) {
|
||||
* Returns the current date and time.
|
||||
*/
|
||||
static exsltDateValPtr
|
||||
exsltDateCurrent (void) {
|
||||
exsltDateCurrent (void)
|
||||
{
|
||||
struct tm *localTm, *gmTm;
|
||||
time_t secs;
|
||||
#if HAVE_LOCALTIME_R
|
||||
@@ -791,7 +798,8 @@ exsltDateCurrent (void) {
|
||||
* Returns a newly built #exsltDateValPtr of NULL in case of error
|
||||
*/
|
||||
static exsltDateValPtr
|
||||
exsltDateParse (const xmlChar *dateTime) {
|
||||
exsltDateParse (const xmlChar *dateTime)
|
||||
{
|
||||
exsltDateValPtr dt;
|
||||
int ret;
|
||||
const xmlChar *cur = dateTime;
|
||||
@@ -940,7 +948,8 @@ error:
|
||||
* Returns a newly built #exsltDateValPtr of NULL in case of error
|
||||
*/
|
||||
static exsltDateValPtr
|
||||
exsltDateParseDuration (const xmlChar *duration) {
|
||||
exsltDateParseDuration (const xmlChar *duration)
|
||||
{
|
||||
const xmlChar *cur = duration;
|
||||
exsltDateValPtr dur;
|
||||
int isneg = 0;
|
||||
@@ -1065,7 +1074,8 @@ error:
|
||||
* Returns a newly allocated string, or NULL in case of error
|
||||
*/
|
||||
static xmlChar *
|
||||
exsltDateFormatDuration (const exsltDateValDurationPtr dt) {
|
||||
exsltDateFormatDuration (const exsltDateValDurationPtr dt)
|
||||
{
|
||||
xmlChar buf[100], *cur = buf;
|
||||
double secs, days;
|
||||
double years, months;
|
||||
@@ -1143,7 +1153,8 @@ exsltDateFormatDuration (const exsltDateValDurationPtr dt) {
|
||||
* Returns a newly allocated string, or NULL in case of error
|
||||
*/
|
||||
static xmlChar *
|
||||
exsltDateFormatDateTime (const exsltDateValDatePtr dt) {
|
||||
exsltDateFormatDateTime (const exsltDateValDatePtr dt)
|
||||
{
|
||||
xmlChar buf[100], *cur = buf;
|
||||
|
||||
if ((dt == NULL) || !VALID_DATETIME(dt))
|
||||
@@ -1168,7 +1179,8 @@ exsltDateFormatDateTime (const exsltDateValDatePtr dt) {
|
||||
* Returns a newly allocated string, or NULL in case of error
|
||||
*/
|
||||
static xmlChar *
|
||||
exsltDateFormatDate (const exsltDateValDatePtr dt) {
|
||||
exsltDateFormatDate (const exsltDateValDatePtr dt)
|
||||
{
|
||||
xmlChar buf[100], *cur = buf;
|
||||
|
||||
if ((dt == NULL) || !VALID_DATETIME(dt))
|
||||
@@ -1192,7 +1204,8 @@ exsltDateFormatDate (const exsltDateValDatePtr dt) {
|
||||
* Returns a newly allocated string, or NULL in case of error
|
||||
*/
|
||||
static xmlChar *
|
||||
exsltDateFormatTime (const exsltDateValDatePtr dt) {
|
||||
exsltDateFormatTime (const exsltDateValDatePtr dt)
|
||||
{
|
||||
xmlChar buf[100], *cur = buf;
|
||||
|
||||
if ((dt == NULL) || !VALID_TIME(dt))
|
||||
@@ -1218,7 +1231,8 @@ exsltDateFormatTime (const exsltDateValDatePtr dt) {
|
||||
* Returns a newly allocated string, or NULL in case of error
|
||||
*/
|
||||
static xmlChar *
|
||||
exsltDateFormat (const exsltDateValPtr dt) {
|
||||
exsltDateFormat (const exsltDateValPtr dt)
|
||||
{
|
||||
|
||||
if (dt == NULL)
|
||||
return NULL;
|
||||
@@ -1703,7 +1717,8 @@ _exsltDateAddDuration (exsltDateValPtr x, exsltDateValPtr y)
|
||||
* Returns the current date and time as a date/time string.
|
||||
*/
|
||||
static xmlChar *
|
||||
exsltDateDateTime (void) {
|
||||
exsltDateDateTime (void)
|
||||
{
|
||||
xmlChar *ret = NULL;
|
||||
#ifdef WITH_TIME
|
||||
exsltDateValPtr cur;
|
||||
@@ -1735,7 +1750,8 @@ exsltDateDateTime (void) {
|
||||
* formats, returns NULL.
|
||||
*/
|
||||
static xmlChar *
|
||||
exsltDateDate (const xmlChar *dateTime) {
|
||||
exsltDateDate (const xmlChar *dateTime)
|
||||
{
|
||||
exsltDateValPtr dt = NULL;
|
||||
xmlChar *ret = NULL;
|
||||
|
||||
@@ -1778,7 +1794,8 @@ exsltDateDate (const xmlChar *dateTime) {
|
||||
* formats, returns NULL.
|
||||
*/
|
||||
static xmlChar *
|
||||
exsltDateTime (const xmlChar *dateTime) {
|
||||
exsltDateTime (const xmlChar *dateTime)
|
||||
{
|
||||
exsltDateValPtr dt = NULL;
|
||||
xmlChar *ret = NULL;
|
||||
|
||||
@@ -1825,7 +1842,8 @@ exsltDateTime (const xmlChar *dateTime) {
|
||||
* returned.
|
||||
*/
|
||||
static double
|
||||
exsltDateYear (const xmlChar *dateTime) {
|
||||
exsltDateYear (const xmlChar *dateTime)
|
||||
{
|
||||
exsltDateValPtr dt;
|
||||
double ret;
|
||||
|
||||
@@ -1873,7 +1891,8 @@ exsltDateYear (const xmlChar *dateTime) {
|
||||
* returned.
|
||||
*/
|
||||
static xmlXPathObjectPtr
|
||||
exsltDateLeapYear (const xmlChar *dateTime) {
|
||||
exsltDateLeapYear (const xmlChar *dateTime)
|
||||
{
|
||||
double year;
|
||||
|
||||
year = exsltDateYear(dateTime);
|
||||
@@ -1908,7 +1927,8 @@ exsltDateLeapYear (const xmlChar *dateTime) {
|
||||
* returned.
|
||||
*/
|
||||
static double
|
||||
exsltDateMonthInYear (const xmlChar *dateTime) {
|
||||
exsltDateMonthInYear (const xmlChar *dateTime)
|
||||
{
|
||||
exsltDateValPtr dt;
|
||||
double ret;
|
||||
|
||||
@@ -1960,7 +1980,8 @@ exsltDateMonthInYear (const xmlChar *dateTime) {
|
||||
* 'October', 'November' or 'December'.
|
||||
*/
|
||||
static const xmlChar *
|
||||
exsltDateMonthName (const xmlChar *dateTime) {
|
||||
exsltDateMonthName (const xmlChar *dateTime)
|
||||
{
|
||||
static const xmlChar monthNames[13][10] = {
|
||||
{ 0 },
|
||||
{ 'J', 'a', 'n', 'u', 'a', 'r', 'y', 0 },
|
||||
@@ -2007,7 +2028,8 @@ exsltDateMonthName (const xmlChar *dateTime) {
|
||||
* 'Dec'.
|
||||
*/
|
||||
static const xmlChar *
|
||||
exsltDateMonthAbbreviation (const xmlChar *dateTime) {
|
||||
exsltDateMonthAbbreviation (const xmlChar *dateTime)
|
||||
{
|
||||
static const xmlChar monthAbbreviations[13][4] = {
|
||||
{ 0 },
|
||||
{ 'J', 'a', 'n', 0 },
|
||||
@@ -2052,7 +2074,8 @@ exsltDateMonthAbbreviation (const xmlChar *dateTime) {
|
||||
* returned.
|
||||
*/
|
||||
static double
|
||||
exsltDateWeekInYear (const xmlChar *dateTime) {
|
||||
exsltDateWeekInYear (const xmlChar *dateTime)
|
||||
{
|
||||
exsltDateValPtr dt;
|
||||
long fdiy, fdiw, ret;
|
||||
|
||||
@@ -2114,7 +2137,8 @@ exsltDateWeekInYear (const xmlChar *dateTime) {
|
||||
* returned.
|
||||
*/
|
||||
static double
|
||||
exsltDateWeekInMonth (const xmlChar *dateTime) {
|
||||
exsltDateWeekInMonth (const xmlChar *dateTime)
|
||||
{
|
||||
exsltDateValPtr dt;
|
||||
long fdiy, fdiw, ret;
|
||||
|
||||
@@ -2167,7 +2191,8 @@ exsltDateWeekInMonth (const xmlChar *dateTime) {
|
||||
* returned.
|
||||
*/
|
||||
static double
|
||||
exsltDateDayInYear (const xmlChar *dateTime) {
|
||||
exsltDateDayInYear (const xmlChar *dateTime)
|
||||
{
|
||||
exsltDateValPtr dt;
|
||||
long ret;
|
||||
|
||||
@@ -2216,7 +2241,8 @@ exsltDateDayInYear (const xmlChar *dateTime) {
|
||||
* returned.
|
||||
*/
|
||||
static double
|
||||
exsltDateDayInMonth (const xmlChar *dateTime) {
|
||||
exsltDateDayInMonth (const xmlChar *dateTime)
|
||||
{
|
||||
exsltDateValPtr dt;
|
||||
double ret;
|
||||
|
||||
@@ -2263,7 +2289,8 @@ exsltDateDayInMonth (const xmlChar *dateTime) {
|
||||
* returned.
|
||||
*/
|
||||
static double
|
||||
exsltDateDayOfWeekInMonth (const xmlChar *dateTime) {
|
||||
exsltDateDayOfWeekInMonth (const xmlChar *dateTime)
|
||||
{
|
||||
exsltDateValPtr dt;
|
||||
long ret;
|
||||
|
||||
@@ -2311,7 +2338,8 @@ exsltDateDayOfWeekInMonth (const xmlChar *dateTime) {
|
||||
* Monday and so on up to 7 for Saturday.
|
||||
*/
|
||||
static double
|
||||
exsltDateDayInWeek (const xmlChar *dateTime) {
|
||||
exsltDateDayInWeek (const xmlChar *dateTime)
|
||||
{
|
||||
exsltDateValPtr dt;
|
||||
long diy, ret;
|
||||
|
||||
@@ -2362,7 +2390,8 @@ exsltDateDayInWeek (const xmlChar *dateTime) {
|
||||
* 'Tuesday', 'Wednesday', 'Thursday' or 'Friday'.
|
||||
*/
|
||||
static const xmlChar *
|
||||
exsltDateDayName (const xmlChar *dateTime) {
|
||||
exsltDateDayName (const xmlChar *dateTime)
|
||||
{
|
||||
static const xmlChar dayNames[8][10] = {
|
||||
{ 0 },
|
||||
{ 'S', 'u', 'n', 'd', 'a', 'y', 0 },
|
||||
@@ -2401,7 +2430,8 @@ exsltDateDayName (const xmlChar *dateTime) {
|
||||
* 'Sun', 'Mon', 'Tue', 'Wed', 'Thu' or 'Fri'.
|
||||
*/
|
||||
static const xmlChar *
|
||||
exsltDateDayAbbreviation (const xmlChar *dateTime) {
|
||||
exsltDateDayAbbreviation (const xmlChar *dateTime)
|
||||
{
|
||||
static const xmlChar dayAbbreviations[8][4] = {
|
||||
{ 0 },
|
||||
{ 'S', 'u', 'n', 0 },
|
||||
@@ -2438,7 +2468,8 @@ exsltDateDayAbbreviation (const xmlChar *dateTime) {
|
||||
* returned.
|
||||
*/
|
||||
static double
|
||||
exsltDateHourInDay (const xmlChar *dateTime) {
|
||||
exsltDateHourInDay (const xmlChar *dateTime)
|
||||
{
|
||||
exsltDateValPtr dt;
|
||||
double ret;
|
||||
|
||||
@@ -2483,7 +2514,8 @@ exsltDateHourInDay (const xmlChar *dateTime) {
|
||||
* returned.
|
||||
*/
|
||||
static double
|
||||
exsltDateMinuteInHour (const xmlChar *dateTime) {
|
||||
exsltDateMinuteInHour (const xmlChar *dateTime)
|
||||
{
|
||||
exsltDateValPtr dt;
|
||||
double ret;
|
||||
|
||||
@@ -2530,7 +2562,8 @@ exsltDateMinuteInHour (const xmlChar *dateTime) {
|
||||
* Returns the second or NaN.
|
||||
*/
|
||||
static double
|
||||
exsltDateSecondInMinute (const xmlChar *dateTime) {
|
||||
exsltDateSecondInMinute (const xmlChar *dateTime)
|
||||
{
|
||||
exsltDateValPtr dt;
|
||||
double ret;
|
||||
|
||||
@@ -2671,6 +2704,100 @@ exsltDateAddDuration (const xmlChar *xstr, const xmlChar *ystr)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* exsltDateSumFunction:
|
||||
* @ns: a node set of duration strings
|
||||
*
|
||||
* The date:sum function adds a set of durations together.
|
||||
* The string values of the nodes in the node set passed as an argument
|
||||
* are interpreted as durations and added together as if using the
|
||||
* date:add-duration function. (from exslt.org)
|
||||
*
|
||||
* The return value is a string in the format defined for xs:duration
|
||||
* in [3.2.6 duration] of [XML Schema Part 2: Datatypes].
|
||||
* The durations can usually be added by summing the numbers given for
|
||||
* each of the components in the durations. However, if the durations
|
||||
* are differently signed, then this sometimes results in durations
|
||||
* that are impossible to express in this syntax (e.g. 'P1M' + '-P1D').
|
||||
* In these cases, the function returns an empty string ('').
|
||||
*
|
||||
* Returns duration string or NULL.
|
||||
*/
|
||||
static void
|
||||
exsltDateSumFunction (xmlXPathParserContextPtr ctxt, int nargs)
|
||||
{
|
||||
xmlNodeSetPtr ns;
|
||||
void *user = NULL;
|
||||
xmlChar *tmp;
|
||||
exsltDateValPtr x, total;
|
||||
xmlChar *ret;
|
||||
long carry;
|
||||
int i;
|
||||
|
||||
if (nargs != 1) {
|
||||
xmlXPathSetArityError (ctxt);
|
||||
return;
|
||||
}
|
||||
|
||||
/* We need to delay the freeing of value->user */
|
||||
if ((ctxt->value != NULL) && ctxt->value->boolval != 0) {
|
||||
user = ctxt->value->user;
|
||||
ctxt->value->boolval = 0;
|
||||
ctxt->value->user = NULL;
|
||||
}
|
||||
|
||||
ns = xmlXPathPopNodeSet (ctxt);
|
||||
if (xmlXPathCheckError (ctxt))
|
||||
return;
|
||||
|
||||
if ((ns == NULL) || (ns->nodeNr == 0))
|
||||
return;
|
||||
|
||||
total = exsltDateCreateDate (XS_DURATION);
|
||||
|
||||
for (i = 0; i < ns->nodeNr; i++) {
|
||||
|
||||
tmp = xmlXPathCastNodeToString (ns->nodeTab[i]);
|
||||
if (tmp == NULL)
|
||||
return;
|
||||
|
||||
x = exsltDateParseDuration (tmp);
|
||||
if (x == NULL) {
|
||||
xmlFree (tmp);
|
||||
return;
|
||||
}
|
||||
|
||||
/* months */
|
||||
total->value.dur.mon += x->value.dur.mon;
|
||||
|
||||
/* seconds */
|
||||
total->value.dur.sec += x->value.dur.sec;
|
||||
carry = (long) FQUOTIENT (total->value.dur.sec, SECS_PER_DAY);
|
||||
if (total->value.dur.sec != 0.0) {
|
||||
total->value.dur.sec =
|
||||
MODULO (total->value.dur.sec, SECS_PER_DAY);
|
||||
}
|
||||
|
||||
/* days */
|
||||
total->value.dur.day += x->value.dur.day + carry;
|
||||
|
||||
exsltDateFreeDate (x);
|
||||
xmlFree (tmp);
|
||||
}
|
||||
|
||||
ret = exsltDateFormatDuration (&(total->value.dur));
|
||||
exsltDateFreeDate (total);
|
||||
|
||||
xmlXPathFreeNodeSet (ns);
|
||||
if (user != NULL)
|
||||
xmlFreeNodeList ((xmlNodePtr) user);
|
||||
|
||||
if (ret == NULL)
|
||||
xmlXPathReturnEmptyString (ctxt);
|
||||
else
|
||||
xmlXPathReturnString (ctxt, ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* exsltDateSeconds:
|
||||
* @dateTime: a date/time string
|
||||
@@ -2914,7 +3041,8 @@ exsltDateDateTimeFunction (xmlXPathParserContextPtr ctxt, int nargs)
|
||||
* Wraps exsltDateDate() for use by the XPath engine.
|
||||
*/
|
||||
static void
|
||||
exsltDateDateFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
exsltDateDateFunction (xmlXPathParserContextPtr ctxt, int nargs)
|
||||
{
|
||||
xmlChar *ret, *dt = NULL;
|
||||
|
||||
if ((nargs < 0) || (nargs > 1)) {
|
||||
@@ -2952,7 +3080,8 @@ exsltDateDateFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
* Wraps exsltDateTime() for use by the XPath engine.
|
||||
*/
|
||||
static void
|
||||
exsltDateTimeFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
exsltDateTimeFunction (xmlXPathParserContextPtr ctxt, int nargs)
|
||||
{
|
||||
xmlChar *ret, *dt = NULL;
|
||||
|
||||
if ((nargs < 0) || (nargs > 1)) {
|
||||
@@ -2990,7 +3119,8 @@ exsltDateTimeFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
* Wraps exsltDateYear() for use by the XPath engine.
|
||||
*/
|
||||
static void
|
||||
exsltDateYearFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
exsltDateYearFunction (xmlXPathParserContextPtr ctxt, int nargs)
|
||||
{
|
||||
xmlChar *dt = NULL;
|
||||
double ret;
|
||||
|
||||
@@ -3023,7 +3153,8 @@ exsltDateYearFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
* Wraps exsltDateLeapYear() for use by the XPath engine.
|
||||
*/
|
||||
static void
|
||||
exsltDateLeapYearFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
exsltDateLeapYearFunction (xmlXPathParserContextPtr ctxt, int nargs)
|
||||
{
|
||||
xmlChar *dt = NULL;
|
||||
xmlXPathObjectPtr ret;
|
||||
|
||||
@@ -3093,7 +3224,8 @@ X_IN_Y(Month,Year)
|
||||
* Wraps exsltDateMonthName() for use by the XPath engine.
|
||||
*/
|
||||
static void
|
||||
exsltDateMonthNameFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
exsltDateMonthNameFunction (xmlXPathParserContextPtr ctxt, int nargs)
|
||||
{
|
||||
xmlChar *dt = NULL;
|
||||
const xmlChar *ret;
|
||||
|
||||
@@ -3220,7 +3352,8 @@ X_IN_Y(Day,Week)
|
||||
* Wraps exsltDateDayName() for use by the XPath engine.
|
||||
*/
|
||||
static void
|
||||
exsltDateDayNameFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
exsltDateDayNameFunction (xmlXPathParserContextPtr ctxt, int nargs)
|
||||
{
|
||||
xmlChar *dt = NULL;
|
||||
const xmlChar *ret;
|
||||
|
||||
@@ -3256,7 +3389,8 @@ exsltDateDayNameFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
* Wraps exsltDateDayAbbreviation() for use by the XPath engine.
|
||||
*/
|
||||
static void
|
||||
exsltDateDayAbbreviationFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
exsltDateDayAbbreviationFunction (xmlXPathParserContextPtr ctxt, int nargs)
|
||||
{
|
||||
xmlChar *dt = NULL;
|
||||
const xmlChar *ret;
|
||||
|
||||
@@ -3320,7 +3454,8 @@ X_IN_Y(Second,Minute)
|
||||
* Wraps exsltDateSeconds() for use by the XPath engine.
|
||||
*/
|
||||
static void
|
||||
exsltDateSecondsFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
exsltDateSecondsFunction (xmlXPathParserContextPtr ctxt, int nargs)
|
||||
{
|
||||
xmlChar *str = NULL;
|
||||
double ret;
|
||||
|
||||
@@ -3352,7 +3487,8 @@ exsltDateSecondsFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
* Wraps exsltDateAdd() for use by the XPath processor.
|
||||
*/
|
||||
static void
|
||||
exsltDateAddFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
exsltDateAddFunction (xmlXPathParserContextPtr ctxt, int nargs)
|
||||
{
|
||||
xmlChar *ret, *xstr, *ystr;
|
||||
|
||||
if (nargs != 2) {
|
||||
@@ -3388,7 +3524,8 @@ exsltDateAddFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
* Wraps exsltDateAddDuration() for use by the XPath processor.
|
||||
*/
|
||||
static void
|
||||
exsltDateAddDurationFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
exsltDateAddDurationFunction (xmlXPathParserContextPtr ctxt, int nargs)
|
||||
{
|
||||
xmlChar *ret, *xstr, *ystr;
|
||||
|
||||
if (nargs != 2) {
|
||||
@@ -3424,7 +3561,8 @@ exsltDateAddDurationFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
* Wraps exsltDateDifference() for use by the XPath processor.
|
||||
*/
|
||||
static void
|
||||
exsltDateDifferenceFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
exsltDateDifferenceFunction (xmlXPathParserContextPtr ctxt, int nargs)
|
||||
{
|
||||
xmlChar *ret, *xstr, *ystr;
|
||||
|
||||
if (nargs != 2) {
|
||||
@@ -3460,7 +3598,8 @@ exsltDateDifferenceFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
* Wraps exsltDateDuration() for use by the XPath engine
|
||||
*/
|
||||
static void
|
||||
exsltDateDurationFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
exsltDateDurationFunction (xmlXPathParserContextPtr ctxt, int nargs)
|
||||
{
|
||||
xmlChar *ret;
|
||||
xmlChar *number = NULL;
|
||||
|
||||
@@ -3494,80 +3633,83 @@ exsltDateDurationFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
* Registers the EXSLT - Dates and Times module
|
||||
*/
|
||||
void
|
||||
exsltDateRegister(void)
|
||||
exsltDateRegister (void)
|
||||
{
|
||||
xsltRegisterExtModuleFunction ((const xmlChar *) "add",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateAddFunction);
|
||||
xsltRegisterExtModuleFunction ((const xmlChar *) "add-duration",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateAddDurationFunction);
|
||||
xsltRegisterExtModuleFunction ((const xmlChar *) "date",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateDateFunction);
|
||||
#ifdef WITH_TIME
|
||||
xsltRegisterExtModuleFunction((const xmlChar *) "date-time",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateDateTimeFunction);
|
||||
xsltRegisterExtModuleFunction ((const xmlChar *) "date-time",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateDateTimeFunction);
|
||||
#endif
|
||||
xsltRegisterExtModuleFunction((const xmlChar *) "date",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateDateFunction);
|
||||
xsltRegisterExtModuleFunction((const xmlChar *) "time",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateTimeFunction);
|
||||
xsltRegisterExtModuleFunction((const xmlChar *) "year",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateYearFunction);
|
||||
xsltRegisterExtModuleFunction((const xmlChar *) "leap-year",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateLeapYearFunction);
|
||||
xsltRegisterExtModuleFunction((const xmlChar *) "month-in-year",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateMonthInYearFunction);
|
||||
xsltRegisterExtModuleFunction((const xmlChar *) "month-name",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateMonthNameFunction);
|
||||
xsltRegisterExtModuleFunction((const xmlChar *) "month-abbreviation",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateMonthAbbreviationFunction);
|
||||
xsltRegisterExtModuleFunction((const xmlChar *) "week-in-year",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateWeekInYearFunction);
|
||||
xsltRegisterExtModuleFunction((const xmlChar *) "week-in-month",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateWeekInMonthFunction);
|
||||
xsltRegisterExtModuleFunction((const xmlChar *) "day-in-year",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateDayInYearFunction);
|
||||
xsltRegisterExtModuleFunction((const xmlChar *) "day-in-month",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateDayInMonthFunction);
|
||||
xsltRegisterExtModuleFunction((const xmlChar *) "day-of-week-in-month",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateDayOfWeekInMonthFunction);
|
||||
xsltRegisterExtModuleFunction((const xmlChar *) "day-in-week",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateDayInWeekFunction);
|
||||
xsltRegisterExtModuleFunction((const xmlChar *) "day-name",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateDayNameFunction);
|
||||
xsltRegisterExtModuleFunction((const xmlChar *) "day-abbreviation",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateDayAbbreviationFunction);
|
||||
xsltRegisterExtModuleFunction((const xmlChar *) "hour-in-day",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateHourInDayFunction);
|
||||
xsltRegisterExtModuleFunction((const xmlChar *) "minute-in-hour",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateMinuteInHourFunction);
|
||||
xsltRegisterExtModuleFunction((const xmlChar *) "second-in-minute",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateSecondInMinuteFunction);
|
||||
xsltRegisterExtModuleFunction((const xmlChar *) "seconds",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateSecondsFunction);
|
||||
xsltRegisterExtModuleFunction((const xmlChar *) "add",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateAddFunction);
|
||||
xsltRegisterExtModuleFunction((const xmlChar *) "add-duration",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateAddDurationFunction);
|
||||
xsltRegisterExtModuleFunction((const xmlChar *) "difference",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateDifferenceFunction);
|
||||
xsltRegisterExtModuleFunction((const xmlChar *) "duration",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateDurationFunction);
|
||||
xsltRegisterExtModuleFunction ((const xmlChar *) "day-abbreviation",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateDayAbbreviationFunction);
|
||||
xsltRegisterExtModuleFunction ((const xmlChar *) "day-in-month",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateDayInMonthFunction);
|
||||
xsltRegisterExtModuleFunction ((const xmlChar *) "day-in-week",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateDayInWeekFunction);
|
||||
xsltRegisterExtModuleFunction ((const xmlChar *) "day-in-year",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateDayInYearFunction);
|
||||
xsltRegisterExtModuleFunction ((const xmlChar *) "day-name",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateDayNameFunction);
|
||||
xsltRegisterExtModuleFunction ((const xmlChar *) "day-of-week-in-month",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateDayOfWeekInMonthFunction);
|
||||
xsltRegisterExtModuleFunction ((const xmlChar *) "difference",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateDifferenceFunction);
|
||||
xsltRegisterExtModuleFunction ((const xmlChar *) "duration",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateDurationFunction);
|
||||
xsltRegisterExtModuleFunction ((const xmlChar *) "hour-in-day",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateHourInDayFunction);
|
||||
xsltRegisterExtModuleFunction ((const xmlChar *) "leap-year",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateLeapYearFunction);
|
||||
xsltRegisterExtModuleFunction ((const xmlChar *) "minute-in-hour",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateMinuteInHourFunction);
|
||||
xsltRegisterExtModuleFunction ((const xmlChar *) "month-abbreviation",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateMonthAbbreviationFunction);
|
||||
xsltRegisterExtModuleFunction ((const xmlChar *) "month-in-year",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateMonthInYearFunction);
|
||||
xsltRegisterExtModuleFunction ((const xmlChar *) "month-name",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateMonthNameFunction);
|
||||
xsltRegisterExtModuleFunction ((const xmlChar *) "second-in-minute",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateSecondInMinuteFunction);
|
||||
xsltRegisterExtModuleFunction ((const xmlChar *) "seconds",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateSecondsFunction);
|
||||
xsltRegisterExtModuleFunction ((const xmlChar *) "sum",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateSumFunction);
|
||||
xsltRegisterExtModuleFunction ((const xmlChar *) "time",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateTimeFunction);
|
||||
xsltRegisterExtModuleFunction ((const xmlChar *) "week-in-month",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateWeekInMonthFunction);
|
||||
xsltRegisterExtModuleFunction ((const xmlChar *) "week-in-year",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateWeekInYearFunction);
|
||||
xsltRegisterExtModuleFunction ((const xmlChar *) "year",
|
||||
(const xmlChar *) EXSLT_DATE_NAMESPACE,
|
||||
exsltDateYearFunction);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user