dbertoni 2003/12/29 13:14:01
Modified: c/Projects/Win32/VC6/AllInOne AllInOne.dsp
AllInOneWithICU.dsp
c/src/xalanc/XalanTransformer XalanTransformer.cpp
Added: c/src/xalanc/XalanEXSLT XalanEXSLTDateTime.cpp
XalanEXSLTDateTime.hpp XalanEXSLTDateTimeImpl.hpp
Log:
Patch for Bugzilla 24441.
Revision Changes Path
1.45 +12 -0 xml-xalan/c/Projects/Win32/VC6/AllInOne/AllInOne.dsp
Index: AllInOne.dsp
===================================================================
RCS file: /home/cvs/xml-xalan/c/Projects/Win32/VC6/AllInOne/AllInOne.dsp,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- AllInOne.dsp 29 Dec 2003 01:25:52 -0000 1.44
+++ AllInOne.dsp 29 Dec 2003 21:14:01 -0000 1.45
@@ -3183,6 +3183,18 @@
# End Source File
# Begin Source File
+SOURCE=..\..\..\..\src\xalanc\XalanEXSLT\XalanEXSLTDateTime.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\xalanc\XalanEXSLT\XalanEXSLTDateTime.hpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\xalanc\XalanEXSLT\XalanEXSLTDateTimeImpl.hpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\..\..\src\xalanc\XalanEXSLT\XalanEXSLTDefinitions.hpp
# End Source File
# Begin Source File
1.42 +12 -0
xml-xalan/c/Projects/Win32/VC6/AllInOne/AllInOneWithICU.dsp
Index: AllInOneWithICU.dsp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/Projects/Win32/VC6/AllInOne/AllInOneWithICU.dsp,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- AllInOneWithICU.dsp 29 Dec 2003 01:25:52 -0000 1.41
+++ AllInOneWithICU.dsp 29 Dec 2003 21:14:01 -0000 1.42
@@ -2811,6 +2811,18 @@
# End Source File
# Begin Source File
+SOURCE=..\..\..\..\src\xalanc\XalanEXSLT\XalanEXSLTDateTime.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\xalanc\XalanEXSLT\XalanEXSLTDateTime.hpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\xalanc\XalanEXSLT\XalanEXSLTDateTimeImpl.hpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\..\..\src\xalanc\XalanEXSLT\XalanEXSLTDefinitions.hpp
# End Source File
# Begin Source File
1.1 xml-xalan/c/src/xalanc/XalanEXSLT/XalanEXSLTDateTime.cpp
Index: XalanEXSLTDateTime.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#include "XalanEXSLTDateTime.hpp"
#include "XalanEXSLTDateTimeImpl.hpp"
#include <ctime>
#include <cstdio>
#include <xalanc/PlatformSupport/XalanMessageLoader.hpp>
#include <xalanc/XPath/XObjectFactory.hpp>
XALAN_CPP_NAMESPACE_BEGIN
#define MAX_DATE_TIME_LEN 100
static const XalanEXSLTFunctionDateTime
s_dateTimeFunction;
static const XalanDOMChar s_dateTimeFunctionName[] =
{
XalanUnicode::charLetter_d,
XalanUnicode::charLetter_a,
XalanUnicode::charLetter_t,
XalanUnicode::charLetter_e,
XalanUnicode::charHyphenMinus,
XalanUnicode::charLetter_t,
XalanUnicode::charLetter_i,
XalanUnicode::charLetter_m,
XalanUnicode::charLetter_e,
0
};
static const XalanEXSLTDateTimeFunctionsInstaller::FunctionTableEntry
theFunctionTable[] =
{
{ s_dateTimeFunctionName, &s_dateTimeFunction },
{ 0, 0 }
};
static const XalanDOMChar s_dateTimeNamespace[] =
{
XalanUnicode::charLetter_h,
XalanUnicode::charLetter_t,
XalanUnicode::charLetter_t,
XalanUnicode::charLetter_p,
XalanUnicode::charColon,
XalanUnicode::charSolidus,
XalanUnicode::charSolidus,
XalanUnicode::charLetter_e,
XalanUnicode::charLetter_x,
XalanUnicode::charLetter_s,
XalanUnicode::charLetter_l,
XalanUnicode::charLetter_t,
XalanUnicode::charFullStop,
XalanUnicode::charLetter_o,
XalanUnicode::charLetter_r,
XalanUnicode::charLetter_g,
XalanUnicode::charSolidus,
XalanUnicode::charLetter_d,
XalanUnicode::charLetter_a,
XalanUnicode::charLetter_t,
XalanUnicode::charLetter_e,
XalanUnicode::charLetter_s,
XalanUnicode::charHyphenMinus,
XalanUnicode::charLetter_a,
XalanUnicode::charLetter_n,
XalanUnicode::charLetter_d,
XalanUnicode::charHyphenMinus,
XalanUnicode::charLetter_t,
XalanUnicode::charLetter_i,
XalanUnicode::charLetter_m,
XalanUnicode::charLetter_e,
XalanUnicode::charLetter_s,
0
};
XObjectPtr
XalanEXSLTFunctionDateTime::execute(
XPathExecutionContext&
executionContext,
XalanNode*
context,
const XObjectArgVectorType& args,
const LocatorType*
locator) const
{
if (args.size() != 0)
{
executionContext.error(getError(), context, locator);
}
XPathExecutionContext::GetAndReleaseCachedString
theGuard(executionContext);
XalanDOMString& theResult = theGuard.get();
time_t long_time;
time( &long_time );
const struct tm* strctTime = localtime(&long_time);
assert (strctTime != 0 );
//save hours - the struct going to be overrided
const int iHours = strctTime->tm_hour;
char stringTime[MAX_DATE_TIME_LEN + 1];
const size_t result = strftime(stringTime, MAX_DATE_TIME_LEN,
"%Y-%m-%dT%H:%M:%S", strctTime);
if (result == 0)
{
theResult.clear();
}
else
{
// Microsoft doesn't fully support the strftime definition.
Let's complete the job manually
strctTime = gmtime(&long_time);
assert (strctTime != 0 );
char timeZone[MAX_DATE_TIME_LEN+1];
sprintf(timeZone , "%2.2d:00", iHours - strctTime->tm_hour);
theResult.assign(stringTime);
theResult.append(timeZone);
}
return executionContext.getXObjectFactory().createString(theResult);
}
const XalanDOMString
XalanEXSLTFunctionDateTime::getError() const
{
return
XalanMessageLoader::getMessage(XalanMessages::EXSLTFunctionAcceptsOneArgument_1Param,
s_dateTimeFunctionName);
}
void
XalanEXSLTDateTimeFunctionsInstaller::installLocal(XPathEnvSupportDefault&
theSupport)
{
doInstallLocal(s_dateTimeNamespace, theFunctionTable, theSupport);
}
void
XalanEXSLTDateTimeFunctionsInstaller::installGlobal()
{
doInstallGlobal(s_dateTimeNamespace, theFunctionTable);
}
void
XalanEXSLTDateTimeFunctionsInstaller::uninstallLocal(XPathEnvSupportDefault&
theSupport)
{
doUninstallLocal(s_dateTimeNamespace, theFunctionTable, theSupport);
}
void
XalanEXSLTDateTimeFunctionsInstaller::uninstallGlobal()
{
doUninstallGlobal(s_dateTimeNamespace, theFunctionTable);
}
XALAN_CPP_NAMESPACE_END
1.1 xml-xalan/c/src/xalanc/XalanEXSLT/XalanEXSLTDateTime.hpp
Index: XalanEXSLTDateTime.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(EXSLT_DATE_TIME_HEADER_GUARD_1357924680)
#define EXSLT_DATE_TIME_HEADER_GUARD_1357924680
#include <xalanc/XalanEXSLT/XalanEXSLTDefinitions.hpp>
#include <xalanc/XalanExtensions/XalanExtensions.hpp>
XALAN_CPP_NAMESPACE_BEGIN
class XALAN_EXSLT_EXPORT XalanEXSLTDateTimeFunctionsInstaller : public
XalanExtensionsInstaller
{
public:
static void
installLocal(XPathEnvSupportDefault& theSupport);
static void
installGlobal();
static void
uninstallLocal(XPathEnvSupportDefault& theSupport);
static void
uninstallGlobal();
};
XALAN_CPP_NAMESPACE_END
#endif // EXSLT_DATE_TIME_HEADER_GUARD_1357924680
1.1
xml-xalan/c/src/xalanc/XalanEXSLT/XalanEXSLTDateTimeImpl.hpp
Index: XalanEXSLTDateTimeImpl.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(EXSLT_DATE_TIMEIMPL_HEADER_GUARD_1357924680)
#define EXSLT_DATE_TIMEIMPL_HEADER_GUARD_1357924680
#include <xalanc/XalanEXSLT/XalanEXSLTDefinitions.hpp>
#include <xalanc/XPath/Function.hpp>
XALAN_CPP_NAMESPACE_BEGIN
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionDateTime : public Function
{
public:
typedef Function ParentType;
XalanEXSLTFunctionDateTime()
{
}
virtual
~XalanEXSLTFunctionDateTime()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext&
executionContext,
XalanNode*
context,
const XObjectArgVectorType& args,
const LocatorType*
locator) const;
#if !defined(XALAN_NO_USING_DECLARATION)
using ParentType::execute;
#endif
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionDateTime*
#endif
clone() const
{
return new XalanEXSLTFunctionDateTime(*this);
}
protected:
virtual const XalanDOMString
getError() const;
private:
// Not implemented...
XalanEXSLTFunctionDateTime&
operator=(const XalanEXSLTFunctionDateTime&);
bool
operator==(const XalanEXSLTFunctionDateTime&) const;
};
XALAN_CPP_NAMESPACE_END
#endif //EXSLT_DATE_TIMEIMPL_HEADER_GUARD_1357924680
1.11 +4 -0
xml-xalan/c/src/xalanc/XalanTransformer/XalanTransformer.cpp
Index: XalanTransformer.cpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/xalanc/XalanTransformer/XalanTransformer.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- XalanTransformer.cpp 4 Dec 2003 21:47:47 -0000 1.10
+++ XalanTransformer.cpp 29 Dec 2003 21:14:01 -0000 1.11
@@ -110,6 +110,7 @@
#include <xalanc/XalanEXSLT/XalanEXSLTMath.hpp>
#include <xalanc/XalanEXSLT/XalanEXSLTSet.hpp>
#include <xalanc/XalanEXSLT/XalanEXSLTString.hpp>
+#include <xalanc/XalanEXSLT/XalanEXSLTDateTime.hpp>
@@ -216,6 +217,8 @@
XalanEXSLTMathFunctionsInstaller::installGlobal();
XalanEXSLTSetFunctionsInstaller::installGlobal();
XalanEXSLTStringFunctionsInstaller::installGlobal();
+ XalanEXSLTDateTimeFunctionsInstaller::installGlobal();
+
#if defined(XALAN_USE_ICU)
// Install the ICU version of format-number...
@@ -239,6 +242,7 @@
XalanEXSLTMathFunctionsInstaller::uninstallGlobal();
XalanEXSLTSetFunctionsInstaller::uninstallGlobal();
XalanEXSLTStringFunctionsInstaller::uninstallGlobal();
+ XalanEXSLTDateTimeFunctionsInstaller::uninstallGlobal();
#if defined(XALAN_USE_ICU)
XPath::uninstallFunction(XPathFunctionTable::s_formatNumber);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]