removed older SAXON extensions implementations from Darren Graves. applied
authorThomas Broyer <tbroyer@src.gnome.org>
Tue, 9 Oct 2001 17:51:47 +0000 (17:51 +0000)
committerThomas Broyer <tbroyer@src.gnome.org>
Tue, 9 Oct 2001 17:51:47 +0000 (17:51 +0000)
* libxslt/extra.[ch]: removed older SAXON extensions
  implementations from Darren Graves.
* libexslt/date.c: applied patch from Charlie Bozeman to fix
  a bug with time zone offset on Linux, not using mktime any
  more.

ChangeLog
libexslt/date.c
libxslt/extra.c
libxslt/extra.h

index f3f1153..bc7a0d9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Tue Oct  9 19:51:48 CEST 2001 Thomas Broyer <tbroyer@ltgt.net>
+
+       * libxslt/extra.[ch]: removed older SAXON extensions
+         implementations from Darren Graves.
+       * libexslt/date.c: applied patch from Charlie Bozeman to fix
+         a bug with time zone offset on Linux.
+
 Tue Oct  9 13:02:46 CEST 2001 Daniel Veillard <daniel@veillard.com>
 
        * libxslt/documents.c libxslt/extra.c libxslt/transform.[ch]:
index b279c96..997022e 100644 (file)
@@ -85,10 +85,7 @@ struct _exsltDate {
 #define IS_TZO_CHAR(c)                                         \
        ((c == 0) || (c == 'Z') || (c == '+') || (c == '-'))
 
-#define TZO_SECS(tm)           (tm->tm_isdst > 0 ? 3600 : 0)
-
 #define VALID_YEAR(yr)          (yr != 0)
-/* months are stored as 0 - 11 */
 #define VALID_MONTH(mon)        ((mon >= 1) && (mon <= 12))
 /* VALID_DAY should only be used when month is unknown */
 #define VALID_DAY(day)          ((day >= 1) && (day <= 31))
@@ -621,12 +618,12 @@ exsltDateFreeDate (exsltDatePtr date) {
 static exsltDatePtr
 exsltDateCurrent (void) {
     struct tm *localTm, *gmTm;
-    time_t tzSecs, secs;
+    time_t secs;
     exsltDatePtr ret;
 
     ret = exsltDateCreateDate();
     if (ret == NULL)
-       return NULL;
+        return NULL;
 
     /* get current time */
     secs    = time(NULL);
@@ -637,19 +634,20 @@ exsltDateCurrent (void) {
     /* get real year, not years since 1900 */
     ret->year = localTm->tm_year + 1900;
 
-    ret->mon = localTm->tm_mon + 1;
-    ret->day = localTm->tm_mday;
+    ret->mon  = localTm->tm_mon + 1;
+    ret->day  = localTm->tm_mday;
     ret->hour = localTm->tm_hour;
-    ret->min = localTm->tm_min;
+    ret->min  = localTm->tm_min;
 
     /* floating point seconds */
-    ret->sec         = (double) localTm->tm_sec;
+    ret->sec  = (double) localTm->tm_sec;
 
     /* determine the time zone offset from local to gm time */
     gmTm         = gmtime(&secs);
-    tzSecs       = mktime(gmTm) - secs;
     ret->tz_flag = 0;
-    ret->tzo = -(tzSecs - TZO_SECS(localTm)) / 60;
+    ret->tzo     = -(((ret->day - gmTm->tm_mday) * 1440) +
+                     ((ret->hour - gmTm->tm_hour) * 60) +
+                     (ret->min - gmTm->tm_min));
 
     return ret;
 }
index 1232958..f0620b3 100644 (file)
@@ -145,137 +145,6 @@ xsltFunctionNodeSet(xmlXPathParserContextPtr ctxt, int nargs){
     }
 }
 
-/**
- * xsltFunctionEvaluate:
- * @ctxt:  the XPath Parser context
- * @nargs:  the number of arguments
- *
- * Implement the evaluate() XSLT function
- *   node-set evaluate(string)
- *
- * This function is available in libxslt or saxon namespace.
- */
-void
-xsltFunctionEvaluate(xmlXPathParserContextPtr ctxt, int nargs){
-  xsltTransformContextPtr tctxt;
-  xmlXPathObjectPtr obj, ret;
-  xmlXPathCompExprPtr comp;
-
-  if (nargs != 1) {
-    xsltPrintErrorContext(xsltXPathGetTransformContext(ctxt), NULL, NULL);
-    xsltGenericError(xsltGenericErrorContext,
-                    "evaluate() : expects one string arg\n");
-    ctxt->error = XPATH_INVALID_ARITY;
-    return;
-  }
-
-  obj = valuePop(ctxt);
-  if (obj->type != XPATH_STRING) {
-    obj = xmlXPathConvertString(obj);
-  }
-
-  if (obj->stringval == NULL) {
-    valuePush(ctxt, xmlXPathNewNodeSet(NULL));
-  }
-  else {
-    tctxt = xsltXPathGetTransformContext(ctxt);
-    comp = xmlXPathCompile(obj->stringval);
-    ret = xmlXPathCompiledEval(comp, 
-                              tctxt->xpathCtxt);
-    valuePush(ctxt, ret);
-    xmlXPathFreeCompExpr(comp);
-  }
-  xmlXPathFreeObject(obj);
-} 
-
-/**
- * xsltFunctionExpression:
- * @ctxt:  the XPath Parser context
- * @nargs:  the number of arguments
- *
- * Implement the evaluate() XSLT function
- *   stored-expression expression(string)
- *
- * This function is available in libxslt or saxon namespace.
- */
-void
-xsltFunctionExpression(xmlXPathParserContextPtr ctxt, int nargs){
-  xsltTransformContextPtr tctxt;
-  xmlXPathObjectPtr obj, ret;
-  xmlXPathCompExprPtr comp;
-
-  if (nargs != 1) {
-    xsltPrintErrorContext(xsltXPathGetTransformContext(ctxt), NULL, NULL);
-    xsltGenericError(xsltGenericErrorContext,
-                    "expression() : expects one string arg\n");
-    ctxt->error = XPATH_INVALID_ARITY;
-    return;
-  }
-
-  obj = valuePop(ctxt);
-  if (obj->type != XPATH_STRING) {
-    obj = xmlXPathConvertString(obj);
-  }
-
-  if (obj->stringval == NULL) {
-    xsltGenericError(xsltGenericErrorContext,
-                    "expression() : invalid string arg\n");
-    ctxt->error = XPATH_INVALID_TYPE;
-    return; 
-  }
-  else {
-    tctxt = xsltXPathGetTransformContext(ctxt);
-    comp = xmlXPathCompile(obj->stringval);
-    if(comp != NULL) {
-      ret = xmlXPathNewString(obj->stringval);    
-      ret->user = comp;
-      valuePush(ctxt, ret);
-    }
-  }
-  xmlXPathFreeObject(obj);
-} 
-
-/**
- * xsltFunctionEval:
- * @ctxt:  the XPath Parser context
- * @nargs:  the number of arguments
- *
- * Implement the eval() XSLT function
- *   node-set eval(stored-expression)
- *
- * This function is available in libxslt or saxon namespace.
- */
-void
-xsltFunctionEval(xmlXPathParserContextPtr ctxt, int nargs){
-  xsltTransformContextPtr tctxt;
-  xmlXPathObjectPtr obj, ret;
-  xmlXPathCompExprPtr comp;
-
-  if (nargs != 1) {
-    xsltPrintErrorContext(xsltXPathGetTransformContext(ctxt), NULL, NULL);
-    xsltGenericError(xsltGenericErrorContext,
-                    "eval() : expects one compiled xpath expr\n");
-    ctxt->error = XPATH_INVALID_ARITY;
-    return;
-  }
-
-  obj = valuePop(ctxt);
-  if (obj->type != XPATH_STRING ||
-      obj->user == NULL) {
-    xsltGenericError(xsltGenericErrorContext,
-                    "eval() : invalid arg expecting compiled xpath expr\n");
-    ctxt->error = XPATH_INVALID_ARITY;
-  }
-
-  tctxt = xsltXPathGetTransformContext(ctxt);
-  comp = obj->user;
-  ret = xmlXPathCompiledEval(comp, 
-                            tctxt->xpathCtxt);
-  valuePush(ctxt, ret);
-  xmlXPathFreeObject(obj);
-} 
-
-
 
 /*
  * Okay the following really seems unportable and since it's not
@@ -430,24 +299,6 @@ xsltRegisterAllExtras (void) {
     xsltRegisterExtModuleFunction((const xmlChar *) "node-set",
                                  XSLT_XT_NAMESPACE,
                                  xsltFunctionNodeSet);
-    xsltRegisterExtModuleFunction((const xmlChar *) "evaluate",
-                                 XSLT_LIBXSLT_NAMESPACE,
-                                 xsltFunctionEvaluate);
-    xsltRegisterExtModuleFunction((const xmlChar *) "evaluate",
-                                 XSLT_SAXON_NAMESPACE,
-                                 xsltFunctionEvaluate);
-    xsltRegisterExtModuleFunction((const xmlChar *) "expression",
-                                 XSLT_LIBXSLT_NAMESPACE,
-                                 xsltFunctionExpression);
-    xsltRegisterExtModuleFunction((const xmlChar *) "expression",
-                                 XSLT_SAXON_NAMESPACE,
-                                 xsltFunctionExpression);
-    xsltRegisterExtModuleFunction((const xmlChar *) "eval",
-                                 XSLT_LIBXSLT_NAMESPACE,
-                                 xsltFunctionEval);
-    xsltRegisterExtModuleFunction((const xmlChar *) "eval",
-                                 XSLT_SAXON_NAMESPACE,
-                                 xsltFunctionEval);
 #ifdef WITH_LOCALTIME
     xsltRegisterExtModuleFunction((const xmlChar *) "localTime",
                                  XSLT_NORM_SAXON_NAMESPACE,
index 4a5cc65..6db0f65 100644 (file)
@@ -56,12 +56,6 @@ extern "C" {
 
 void           xsltFunctionNodeSet     (xmlXPathParserContextPtr ctxt,
                                         int nargs);
-void           xsltFunctionEvaluate    (xmlXPathParserContextPtr ctxt,
-                                        int nargs);
-void           xsltFunctionExpression  (xmlXPathParserContextPtr ctxt,
-                                        int nargs);
-void           xsltFunctionEval        (xmlXPathParserContextPtr ctxt,
-                                        int nargs);
 void           xsltDebug               (xsltTransformContextPtr ctxt,
                                         xmlNodePtr node,
                                         xmlNodePtr inst,