xalan-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbert...@apache.org
Subject svn commit: r690861 [2/6] - in /xalan/c/trunk: Projects/Win32/VC8/AllInOne/ Projects/Win32/VC9/AllInOne/ Tests/Conf/ samples/ExternalFunction/ src/xalanc/DOMSupport/ src/xalanc/Harness/ src/xalanc/ICUBridge/ src/xalanc/Include/ src/xalanc/NLS/en_US/ sr...
Date Mon, 01 Sep 2008 06:42:13 GMT
Modified: xalan/c/trunk/src/xalanc/PlatformSupport/XalanOutputStream.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/PlatformSupport/XalanOutputStream.hpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/PlatformSupport/XalanOutputStream.hpp (original)
+++ xalan/c/trunk/src/xalanc/PlatformSupport/XalanOutputStream.hpp Sun Aug 31 23:42:06 2008
@@ -291,58 +291,42 @@
 
 		XalanOutputStreamException(
 			const XalanDOMString&	theMessage,
-            MemoryManagerType&      theManager);
+            MemoryManager&          theManager,
+            const Locator*          theLocator);
 
-        XalanOutputStreamException( const XalanOutputStreamException& other):
-            XSLException(other)
-            {
-            }
-
-		virtual
-		~XalanOutputStreamException();
-
-		virtual const XalanDOMChar*
-		getType() const
-		{
-			return m_type;
-		}
-
-	private:
-		static const XalanDOMChar	m_type[];
-
-	};
-
-	class XALAN_PLATFORMSUPPORT_EXPORT UnknownEncodingException : public XalanOutputStreamException
-	{
-	public:
+		XalanOutputStreamException(
+			const XalanDOMString&	theMessage,
+            MemoryManager&          theManager);
 
-		explicit
-		UnknownEncodingException(XalanDOMString& theBuffer);
+        XalanOutputStreamException(const XalanOutputStreamException& other);
 
 		virtual
-		~UnknownEncodingException();
+		~XalanOutputStreamException();
 
 		virtual const XalanDOMChar*
-		getType() const
-		{
-			return m_type;
-		}
+		getType() const;
 
 	private:
-		static const XalanDOMChar	m_type[];
-
 	};
 
 	class XALAN_PLATFORMSUPPORT_EXPORT UnsupportedEncodingException : public XalanOutputStreamException
 	{
 	public:
 
-		UnsupportedEncodingException(const XalanDOMString&	theEncoding,
-                                        XalanDOMString& theBuffer);
+		UnsupportedEncodingException(
+            const XalanDOMString&	theEncoding,
+            XalanDOMString&         theBuffer,
+            const Locator*          theLocator);
+
+		UnsupportedEncodingException(
+            const XalanDOMString&	theEncoding,
+            XalanDOMString&         theBuffer);
 
-        UnsupportedEncodingException(const UnsupportedEncodingException& other) :
-        XalanOutputStreamException(other),
-        m_encoding(other.getEncoding(),(const_cast<XalanDOMString*>(&(other.m_encoding)))->getMemoryManager())
+        UnsupportedEncodingException(const UnsupportedEncodingException&    other) :
+            XalanOutputStreamException(other),
+            m_encoding(
+                other.m_encoding,
+                other.m_memoryManager)
         {
         }
 
@@ -355,15 +339,10 @@
 			return m_encoding;
 		}
 
-
 		virtual const XalanDOMChar*
-		getType() const
-		{
-			return m_type;
-		}
-	private:
+		getType() const;
 
-		static const XalanDOMChar	m_type[];
+    private:
 
 		const XalanDOMString	m_encoding;
 	};
@@ -372,18 +351,23 @@
 	{
 	public:
 
-		TranscoderInternalFailureException(const XalanDOMString&	theEncoding,
-                                            XalanDOMString& theBuffer);
+		TranscoderInternalFailureException(
+            const XalanDOMString&	theEncoding,
+            XalanDOMString&         theBuffer,
+            const Locator*          theLocator);
+
+		TranscoderInternalFailureException(
+            const XalanDOMString&	theEncoding,
+            XalanDOMString&         theBuffer);
 
-        TranscoderInternalFailureException(const TranscoderInternalFailureException& other) :
-            XalanOutputStreamException(other),
-            m_encoding(other.getEncoding(),(const_cast<XalanDOMString*>(&(other.m_encoding)))->getMemoryManager())
-            {
-            }
+        TranscoderInternalFailureException(const TranscoderInternalFailureException& other);
 
 		virtual
 		~TranscoderInternalFailureException();
 
+		virtual const XalanDOMChar*
+		getType() const;
+
 		const XalanDOMString&
 		getEncoding() const
 		{
@@ -399,16 +383,20 @@
 	{
 	public:
 
+		TranscodingException(
+            XalanDOMString&     theBuffer,
+            const Locator*      theLocator);
+
 		explicit
-		TranscodingException(XalanDOMString& theBuffer);
+		TranscodingException(XalanDOMString&    theBuffer);
 
-        TranscodingException(const TranscodingException& other) :
-        XalanOutputStreamException(other)
-        {
-        }
+        TranscodingException(const TranscodingException& other);
 
 		virtual
 		~TranscodingException();
+
+        virtual const XalanDOMChar*
+		getType() const;
 	};
 
 protected:

Modified: xalan/c/trunk/src/xalanc/PlatformSupport/XalanStdOutputStream.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/PlatformSupport/XalanStdOutputStream.cpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/PlatformSupport/XalanStdOutputStream.cpp (original)
+++ xalan/c/trunk/src/xalanc/PlatformSupport/XalanStdOutputStream.cpp Sun Aug 31 23:42:06 2008
@@ -244,7 +244,8 @@
                 XalanMessages::ErrorWritingToStdStream),
         theErrorCode,
         theBuffer),
-    theBuffer.getMemoryManager())
+    theBuffer.getMemoryManager(),
+    0)
 {
 }
 

Modified: xalan/c/trunk/src/xalanc/PlatformSupport/XalanTranscodingServices.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/PlatformSupport/XalanTranscodingServices.cpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/PlatformSupport/XalanTranscodingServices.cpp (original)
+++ xalan/c/trunk/src/xalanc/PlatformSupport/XalanTranscodingServices.cpp Sun Aug 31 23:42:06 2008
@@ -469,7 +469,8 @@
 XalanTranscodingServices::MakeTranscoderException::MakeTranscoderException(
             eCode                   theCode,
             const XalanDOMChar*     theEncoding,
-            XalanDOMString&         theBuffer) :
+            XalanDOMString&         theBuffer,
+            const Locator*          theLocator) :
     XSLException(
         XalanMessageLoader::getMessage(
             theBuffer,
@@ -478,7 +479,8 @@
                 static_cast<long>(theCode),
                 theBuffer).c_str(),
             theEncoding),
-        theBuffer.getMemoryManager()),
+        theBuffer.getMemoryManager(),
+        theLocator),
     m_code(theCode),
     m_encoding(
         theEncoding,
@@ -548,7 +550,8 @@
 XalanTranscodingServices::UnrepresentableCharacterException::UnrepresentableCharacterException(
             XalanUnicodeChar        theCharacter,
             const XalanDOMString&   theEncoding,
-            XalanDOMString&         theBuffer) :
+            XalanDOMString&         theBuffer,
+            const Locator*          theLocator) :
     XSLException(
         XalanMessageLoader::getMessage(
             theBuffer,
@@ -557,7 +560,8 @@
                 theCharacter,
                 theBuffer),
             theEncoding),
-        theBuffer.getMemoryManager()),
+        theBuffer.getMemoryManager(),
+        theLocator),
     m_badCharacter(theCharacter),
     m_encoding(
         theEncoding,

Modified: xalan/c/trunk/src/xalanc/PlatformSupport/XalanTranscodingServices.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/PlatformSupport/XalanTranscodingServices.hpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/PlatformSupport/XalanTranscodingServices.hpp (original)
+++ xalan/c/trunk/src/xalanc/PlatformSupport/XalanTranscodingServices.hpp Sun Aug 31 23:42:06 2008
@@ -50,7 +50,7 @@
      * Perform static initialization.  See class PlatformSupportInit.
      */
     static void
-    initialize(MemoryManagerType&      theManager);
+    initialize(MemoryManager&   theManager);
  
     /**
      * Perform static shut down.  See class PlatformSupportInit.
@@ -96,14 +96,14 @@
      */
     static XalanOutputTranscoder*
     makeNewTranscoder(
-            MemoryManagerType&      theManager,
+            MemoryManager&          theManager,
             const XalanDOMString&   theEncodingName,
             eCode&                  theResult,
             size_type               theBlockSize);
 
     static XalanOutputTranscoder*
     makeNewTranscoder(
-            MemoryManagerType&      theManager,
+            MemoryManager&          theManager,
             const XalanDOMChar*     theEncodingName,
             eCode&                  theResult,
             size_type               theBlockSize);
@@ -242,7 +242,8 @@
         MakeTranscoderException(
                 eCode                   theCode,
                 const XalanDOMChar*     theEncoding,
-                XalanDOMString&         theBuffer);
+                XalanDOMString&         theBuffer,
+                const Locator*          theLocator = 0);
 
         MakeTranscoderException(const MakeTranscoderException&);
 
@@ -283,7 +284,8 @@
         UnrepresentableCharacterException(
                 XalanUnicodeChar        theCharacter,
                 const XalanDOMString&   theEncoding,
-                XalanDOMString&         theBuffer);
+                XalanDOMString&         theBuffer,
+                const Locator*          theLocator = 0);
 
         UnrepresentableCharacterException(const UnrepresentableCharacterException&  theSource);
 

Modified: xalan/c/trunk/src/xalanc/XMLSupport/XMLParserLiaison.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XMLSupport/XMLParserLiaison.hpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XMLSupport/XMLParserLiaison.hpp (original)
+++ xalan/c/trunk/src/xalanc/XMLSupport/XMLParserLiaison.hpp Sun Aug 31 23:42:06 2008
@@ -268,6 +268,53 @@
 	virtual void
 	setErrorHandler(ErrorHandler*	handler) = 0;
 
+    // A utility class for classes to use.
+    class EnsureResetErrorHandler
+    {
+    public:
+
+        EnsureResetErrorHandler(
+                XMLParserLiaison*   theLiaison = 0,
+                ErrorHandler*       theErrorHandler = 0) :
+            m_liaison(theLiaison),
+            m_errorHandler(theErrorHandler)
+        {
+            if (theLiaison != 0)
+            {
+                theLiaison->setErrorHandler(theErrorHandler);
+            }
+        }
+
+        ~EnsureResetErrorHandler()
+        {
+            if (m_liaison != 0)
+            {
+                m_liaison->setErrorHandler(m_errorHandler);
+            }
+        }
+
+        void
+        set(
+                XMLParserLiaison*   theLiaison,
+                ErrorHandler*       theErrorHandler)
+        {
+            m_liaison = theLiaison;
+
+            m_errorHandler = theErrorHandler;
+
+            if (theLiaison != 0)
+            {
+                theLiaison->setErrorHandler(theErrorHandler);
+            }
+        }
+
+    private:
+
+        XMLParserLiaison*   m_liaison;
+
+        ErrorHandler*       m_errorHandler;
+    };
+
 protected:
 
     // A utility class for derived classes to use.

Modified: xalan/c/trunk/src/xalanc/XMLSupport/XMLSupportException.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XMLSupport/XMLSupportException.cpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XMLSupport/XMLSupportException.cpp (original)
+++ xalan/c/trunk/src/xalanc/XMLSupport/XMLSupportException.cpp Sun Aug 31 23:42:06 2008
@@ -25,9 +25,21 @@
 
 
 
-XMLSupportException::XMLSupportException(const XalanDOMString&	message,
-                                         MemoryManagerType& theManager) :
-	XSLException(message, theManager)
+XMLSupportException::XMLSupportException(
+            const XalanDOMString&	theMessage,
+            MemoryManager&          theManager,
+            const Locator*          theLocator) :
+	XSLException(
+        theMessage,
+        theManager,
+        theLocator)
+{
+}
+
+
+
+XMLSupportException::XMLSupportException(const XMLSupportException&     other) :
+    XSLException(other)
 {
 }
 

Modified: xalan/c/trunk/src/xalanc/XMLSupport/XMLSupportException.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XMLSupport/XMLSupportException.hpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XMLSupport/XMLSupportException.hpp (original)
+++ xalan/c/trunk/src/xalanc/XMLSupport/XMLSupportException.hpp Sun Aug 31 23:42:06 2008
@@ -47,10 +47,12 @@
 	 * 
 	 * @param theMessage message to print when exception thrown
 	 */
-	explicit
-	XMLSupportException(const XalanDOMString&	message,
-                        MemoryManagerType& theManager);
+	XMLSupportException(
+            const XalanDOMString&	theMessage,
+            MemoryManager&          theManager,
+            const Locator*          theLocator);
 
+    XMLSupportException(const XMLSupportException& other);
 
 	virtual
 	~XMLSupportException();

Modified: xalan/c/trunk/src/xalanc/XPath/Function.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/Function.cpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/Function.cpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/Function.cpp Sun Aug 31 23:42:06 2008
@@ -68,11 +68,12 @@
 	}
 	else
 	{
-        XalanDOMString theBuffer(executionContext.getMemoryManager());
+        generalError(
+            executionContext,
+            context,
+            locator);
 
-		executionContext.error(getError(theBuffer), context, locator);
-
-		return XObjectPtr(0);
+        return XObjectPtr(0);
 	}
 }
 
@@ -84,11 +85,12 @@
 			XalanNode*				context,			
 			const LocatorType*		locator) const
 {
-    XalanDOMString theBuffer(executionContext.getMemoryManager());
-
-	executionContext.error(getError(theBuffer), context, locator);
+    generalError(
+        executionContext,
+        context,
+        locator);
 
-	return XObjectPtr(0);
+    return XObjectPtr(0);
 }
 
 
@@ -100,11 +102,12 @@
 			const XObjectPtr		/* arg1 */,
 			const LocatorType*		locator) const
 {
-    XalanDOMString theBuffer(executionContext.getMemoryManager());
-
-	executionContext.error(getError(theBuffer), context, locator);
+    generalError(
+        executionContext,
+        context,
+        locator);
 
-	return XObjectPtr(0);
+    return XObjectPtr(0);
 }
 
 
@@ -117,11 +120,12 @@
 			const XObjectPtr		/* arg2 */,
 			const LocatorType*		locator) const
 {
-    XalanDOMString theBuffer(executionContext.getMemoryManager());
+    generalError(
+        executionContext,
+        context,
+        locator);
 
-	executionContext.error(getError(theBuffer), context, locator);
-
-	return XObjectPtr(0);
+    return XObjectPtr(0);
 }
 
 
@@ -135,11 +139,30 @@
 			const XObjectPtr		/* arg3 */,
 			const LocatorType*		locator) const
 {
-    XalanDOMString theBuffer(executionContext.getMemoryManager());
+    generalError(
+        executionContext,
+        context,
+        locator);
 
-	executionContext.error(getError(theBuffer), context, locator);
+    return XObjectPtr(0);
+}
+
+
+
+void
+Function::generalError(
+			XPathExecutionContext&  executionContext,
+			const XalanNode*        context,
+			const Locator*          locator) const
+{
+    const GetCachedString   theGuard(executionContext);
 
-	return XObjectPtr(0);
+    executionContext.problem(
+        XPathExecutionContext::eXPath,
+        XPathExecutionContext::eError,
+        getError(theGuard.get()),
+        locator,
+        context);
 }
 
 

Modified: xalan/c/trunk/src/xalanc/XPath/Function.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/Function.hpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/Function.hpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/Function.hpp Sun Aug 31 23:42:06 2008
@@ -63,7 +63,9 @@
 	virtual
 	~Function();
 
-	typedef XPathExecutionContext::XObjectArgVectorType	XObjectArgVectorType;
+	typedef XPathExecutionContext::XObjectArgVectorType     XObjectArgVectorType;
+    typedef XPathExecutionContext::GetCachedString          GetCachedString;
+    typedef XPathExecutionContext::GetCachedNodeList        GetCachedNodeList;
 
 	/**
 	 * Execute an XPath function object.  The function must return a valid
@@ -146,7 +148,7 @@
 	 * @param arg1             pointer to XObject arguments
 	 * @param arg2             pointer to XObject argument
 	 * @param arg3             pointer to XObject argument
-	 * @param locator		   LocatorType instance for the XPath expression that contains the function call
+	 * @param locator		   Locator instance for the XPath expression that contains the function call
 	 * @return                 pointer to the result XObject
 	 */
 	virtual XObjectPtr
@@ -173,10 +175,25 @@
 	 * the function is called with the wrong
 	 * number of arguments.
 	 *
-	 * @return function error message
+	 * @param theBuffer The XalanDOMString for the message.
+	 * @return The error message
 	 */
 	virtual const XalanDOMString&
-	getError(XalanDOMString& theBuffer) const = 0;
+	getError(XalanDOMString&    theBuffer) const = 0;
+
+	/**
+	 * Report the error returned from the getError()
+	 * call.
+	 *
+	 * @param executionContext The current XPathExecutionContext
+	 * @param context The context node
+	 * @param locator The Locator instance for the XPath expression that contains the function call
+	 */
+    void
+    generalError(
+			XPathExecutionContext&  executionContext,
+			const XalanNode*        context,
+			const Locator*          locator) const;
 
 private:
 

Modified: xalan/c/trunk/src/xalanc/XPath/FunctionConcat.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/FunctionConcat.cpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/FunctionConcat.cpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/FunctionConcat.cpp Sun Aug 31 23:42:06 2008
@@ -53,7 +53,7 @@
 {
     assert(arg1.null() == false && arg2.null() == false);   
 
-    XPathExecutionContext::GetAndReleaseCachedString    theResult(executionContext);
+    GetCachedString     theResult(executionContext);
 
     XalanDOMString&     theString = theResult.get();
 
@@ -76,9 +76,9 @@
 {
     assert(arg1.null() == false && arg2.null() == false && arg3.null() == false);   
 
-    XPathExecutionContext::GetAndReleaseCachedString    theResult(executionContext);
+    GetCachedString     theResult(executionContext);
 
-    XalanDOMString&         theString = theResult.get();
+    XalanDOMString&     theString = theResult.get();
 
     arg1->str(executionContext, theString);
     arg2->str(executionContext, theString);
@@ -98,7 +98,7 @@
 {
     const XObjectArgVectorType::const_iterator  theEnd = args.end();
 
-    XPathExecutionContext::GetAndReleaseCachedString    theResult(executionContext);
+    GetCachedString     theResult(executionContext);
 
     XalanDOMString&     theString = theResult.get();
 

Modified: xalan/c/trunk/src/xalanc/XPath/FunctionID.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/FunctionID.cpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/FunctionID.cpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/FunctionID.cpp Sun Aug 31 23:42:06 2008
@@ -57,11 +57,9 @@
     assert(arg1.null() == false);   
     assert(context != 0);
 
-    typedef XPathExecutionContext::GetAndReleaseCachedString    GetAndReleaseCachedString;
+    const GetCachedString   theGuard1(executionContext);
 
-    GetAndReleaseCachedString   theGuard1(executionContext);
-
-    XalanDOMString&             theResultString = theGuard1.get();
+    XalanDOMString&   theResultString = theGuard1.get();
 
     // Do the callback to get the data.
     FunctionIDXObjectTypeCallback   theCallback(executionContext, theResultString);
@@ -82,7 +80,7 @@
     {
         StringTokenizer     theTokenizer(theResultString);
 
-        GetAndReleaseCachedString   theGuard2(executionContext);
+        const GetCachedString   theGuard2(executionContext);
 
         XalanDOMString&     theToken = theGuard2.get();
 

Modified: xalan/c/trunk/src/xalanc/XPath/FunctionLang.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/FunctionLang.cpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/FunctionLang.cpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/FunctionLang.cpp Sun Aug 31 23:42:06 2008
@@ -95,8 +95,8 @@
 
             if (0 != length(langVal))
             {
-                XPathExecutionContext::GetAndReleaseCachedString theGuard1(executionContext);
-                XPathExecutionContext::GetAndReleaseCachedString theGuard2(executionContext);
+                const GetCachedString   theGuard1(executionContext);
+                const GetCachedString   theGuard2(executionContext);
 
                 if (startsWith(toLowerCaseASCII(langVal, theGuard1.get()), toLowerCaseASCII(lang, theGuard2.get())))
                 {

Modified: xalan/c/trunk/src/xalanc/XPath/FunctionNamespaceURI.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/FunctionNamespaceURI.cpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/FunctionNamespaceURI.cpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/FunctionNamespaceURI.cpp Sun Aug 31 23:42:06 2008
@@ -60,17 +60,19 @@
 {
     if (context == 0)
     {
-        XPathExecutionContext::GetAndReleaseCachedString    theGuard(executionContext);
+        const GetCachedString   theGuard(executionContext);
 
         XalanDOMString& theResult = theGuard.get();
 
-        executionContext.error(
+        executionContext.problem(
+            XPathExecutionContext::eXPath,
+            XPathExecutionContext::eError,
             XalanMessageLoader::getMessage(
                 theResult,
                 XalanMessages::FunctionRequiresNonNullContextNode_1Param,
                 "namespace-uri()"),
-            context,
-            locator);
+            locator,
+            context);
 
         // Dummy return value...
         return XObjectPtr(0);

Modified: xalan/c/trunk/src/xalanc/XPath/FunctionNormalizeSpace.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/FunctionNormalizeSpace.cpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/FunctionNormalizeSpace.cpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/FunctionNormalizeSpace.cpp Sun Aug 31 23:42:06 2008
@@ -20,6 +20,10 @@
 
 
 
+#include "xalanc/XalanDOM/XalanDOMString.hpp"
+
+
+
 #include <xalanc/PlatformSupport/XalanMessageLoader.hpp>
 
 
@@ -36,7 +40,8 @@
 
 
 
-FunctionNormalizeSpace::FunctionNormalizeSpace()
+FunctionNormalizeSpace::FunctionNormalizeSpace() :
+    Function()
 {
 }
 
@@ -48,6 +53,10 @@
 
 
 
+static const XalanDOMString     s_emptyString(XalanMemMgrs::getDummyMemMgr());
+
+
+
 XObjectPtr
 FunctionNormalizeSpace::execute(
             XPathExecutionContext&  executionContext,
@@ -56,16 +65,19 @@
 {
     if (context == 0)
     {
-        XPathExecutionContext::GetAndReleaseCachedString    theGuard(executionContext);
-        XalanDOMString& theResult = theGuard.get();
+        const GetCachedString   theGuard(executionContext);
+
+        XalanDOMString&         theResult = theGuard.get();
 
-        executionContext.error(
+        executionContext.problem(
+            XPathExecutionContext::eXPath,
+            XPathExecutionContext::eError,
             XalanMessageLoader::getMessage(
                 theResult,
                 XalanMessages::FunctionRequiresNonNullContextNode_1Param,
                 "normalize-space()"),
-            context,
-            locator);
+            locator,
+            context);
 
         // Dummy return value...
         return XObjectPtr(0);
@@ -77,7 +89,7 @@
         // DOMServices::getNodeData() will give us the data.
 
         // Get a cached string...
-        XPathExecutionContext::GetAndReleaseCachedString    theData(executionContext);
+        const GetCachedString    theData(executionContext);
 
         XalanDOMString&     theString = theData.get();
 
@@ -106,66 +118,54 @@
 XObjectPtr
 FunctionNormalizeSpace::normalize(
             XPathExecutionContext&  executionContext,
-            const XalanDOMString&   theString) const
+            const XalanDOMString&   theString,
+            GetCachedString&        theResult) const
 {
-    const XalanDOMString::size_type     theStringLength = length(theString);
-
-    // A string contain the result...
-    XPathExecutionContext::GetAndReleaseCachedString    theResult(executionContext);
+    const XalanDOMString::size_type     theStringLength =
+        theString.length();
 
     XalanDOMString&     theNewString = theResult.get();
-    assert(length(theNewString) == 0);
+    assert(theNewString.length() == 0);
 
     // The result string can only be as large as the source string, so
     // just reserve the space now.
-    reserve(theNewString, theStringLength);
+    theNewString.reserve(theStringLength);
 
-    bool    fPreviousIsSpace = false;
+    enum  eLastCharState { eNonSpace, eSpace, eSpaceAppended };
+
+    eLastCharState  theState = eSpace;
 
     // OK, strip out any multiple spaces...
-    for (XalanDOMString::size_type i = 0; i < theStringLength; ++i)
+    for (XalanDOMString::const_iterator i = theString.begin();
+            i != theString.end(); ++i)
     {
-        const XalanDOMChar  theCurrentChar = charAt(theString, i);
+        const XalanDOMChar  theCurrentChar = *i;
 
-        if (isXMLWhitespace(theCurrentChar) == true)
+        if (isXMLWhitespace(theCurrentChar) == false)
         {
-            // If the previous character wasn't a space, and we've
-            // encountered some non-space characters, and it's not
-            // the last character in the string, then push the
-            // space character (not the original character).
-            if (fPreviousIsSpace == false)
-            {
-                if (length(theNewString) > 0 &&
-                    i < theStringLength - 1)
-                {
-                    append(theNewString, XalanDOMChar(XalanUnicode::charSpace));
-                }
+            theNewString.push_back(theCurrentChar);
 
-                fPreviousIsSpace = true;
-            }
+            theState = eNonSpace;
         }
-        else
+        else if (theState == eNonSpace)
         {
-            append(theNewString, theCurrentChar);
+            theNewString.push_back(XalanDOMChar(XalanUnicode::charSpace));
 
-            fPreviousIsSpace = false;
+            theState = eSpaceAppended;
         }
     }
 
-    const XalanDOMString::size_type     theNewStringLength = length(theNewString);
-
-    if (theNewStringLength == 0)
+    if (theNewString.empty() == true)
     {
-        return executionContext.getXObjectFactory().createString(XalanDOMString(executionContext.getMemoryManager()));
+        return executionContext.getXObjectFactory().createStringReference(s_emptyString);
     }
     else
     {
         // We may have a space character at end, since we don't look ahead,
         // so removed it now...
-        if (charAt(theNewString, theNewStringLength - 1) ==
-                XalanDOMChar(XalanUnicode::charSpace))
+        if (theState == eSpaceAppended)
         {
-            theNewString.erase(theNewStringLength - 1, 1);
+            theNewString.erase(theNewString.end() - 1);
         }
 
         return executionContext.getXObjectFactory().createString(theResult);

Modified: xalan/c/trunk/src/xalanc/XPath/FunctionNormalizeSpace.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/FunctionNormalizeSpace.hpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/FunctionNormalizeSpace.hpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/FunctionNormalizeSpace.hpp Sun Aug 31 23:42:06 2008
@@ -76,12 +76,12 @@
 #else
 	virtual FunctionNormalizeSpace*
 #endif
-	clone(MemoryManagerType& theManager) const;
+	clone(MemoryManager&    theManager) const;
 
 protected:
 
 	virtual const XalanDOMString&
-	getError(XalanDOMString& theResult) const;
+	getError(XalanDOMString&    theResult) const;
 
 private:
 
@@ -91,13 +91,25 @@
 	XObjectPtr
 	normalize(
 		XPathExecutionContext&	executionContext,
-		const XalanDOMString&	theString) const;
+		const XalanDOMString&	theString) const
+    {
+        // A string contain the result...
+        GetCachedString     theResult(executionContext);
+
+        return normalize(executionContext, theString, theResult);
+    }
 
 	XObjectPtr
 	normalize(
 		XPathExecutionContext&	executionContext,
 		const XObjectPtr&		theArg) const;
 
+    XObjectPtr
+    normalize(
+            XPathExecutionContext&  executionContext,
+            const XalanDOMString&   theString,
+            GetCachedString&        theResult) const;
+
 	// Not implemented...
 	FunctionNormalizeSpace&
 	operator=(const FunctionNormalizeSpace&);

Modified: xalan/c/trunk/src/xalanc/XPath/FunctionString.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/FunctionString.cpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/FunctionString.cpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/FunctionString.cpp Sun Aug 31 23:42:06 2008
@@ -55,16 +55,19 @@
 {
     if (context == 0)
     {
-        XPathExecutionContext::GetAndReleaseCachedString    theGuard(executionContext);
-        XalanDOMString&     theResult = theGuard.get();
+        const GetCachedString   theGuard(executionContext);
 
-        executionContext.error(
+        XalanDOMString&         theResult = theGuard.get();
+
+        executionContext.problem(
+            XPathExecutionContext::eXPath,
+            XPathExecutionContext::eError,
             XalanMessageLoader::getMessage(
                 theResult,
                 XalanMessages::FunctionRequiresNonNullContextNode_1Param,
                 "string"),
-            context,
-            locator);
+            locator,
+            context);
 
         // Dummy return value...
         return XObjectPtr();
@@ -78,7 +81,7 @@
         // DOMServices::getNodeData() will give us the data.
 
         // Get a cached string...
-        XPathExecutionContext::GetAndReleaseCachedString    theData(executionContext);
+        GetCachedString     theData(executionContext);
 
         XalanDOMString&     theString = theData.get();
 

Modified: xalan/c/trunk/src/xalanc/XPath/FunctionSubstring.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/FunctionSubstring.cpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/FunctionSubstring.cpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/FunctionSubstring.cpp Sun Aug 31 23:42:06 2008
@@ -265,7 +265,7 @@
             }
             else
             {
-                XPathExecutionContext::GetAndReleaseCachedString    theResult(executionContext);
+                GetCachedString     theResult(executionContext);
 
                 XalanDOMString&     theString = theResult.get();
 

Modified: xalan/c/trunk/src/xalanc/XPath/FunctionSubstringAfter.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/FunctionSubstringAfter.cpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/FunctionSubstringAfter.cpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/FunctionSubstringAfter.cpp Sun Aug 31 23:42:06 2008
@@ -105,7 +105,7 @@
                 const XalanDOMString::size_type     theSubstringLength =
                     theFirstStringLength  - theIndex - theSecondStringLength;
 
-                XPathExecutionContext::GetAndReleaseCachedString    theResult(executionContext);
+                GetCachedString     theResult(executionContext);
 
                 XalanDOMString&     theString = theResult.get();
 

Modified: xalan/c/trunk/src/xalanc/XPath/FunctionSubstringBefore.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/FunctionSubstringBefore.cpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/FunctionSubstringBefore.cpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/FunctionSubstringBefore.cpp Sun Aug 31 23:42:06 2008
@@ -93,7 +93,7 @@
             }
             else
             {
-                XPathExecutionContext::GetAndReleaseCachedString    theResult(executionContext);
+                GetCachedString     theResult(executionContext);
 
                 XalanDOMString&     theString = theResult.get();
 

Modified: xalan/c/trunk/src/xalanc/XPath/FunctionTranslate.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/FunctionTranslate.cpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/FunctionTranslate.cpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/FunctionTranslate.cpp Sun Aug 31 23:42:06 2008
@@ -68,7 +68,7 @@
     typedef XalanVector<XalanDOMChar>       VectorType;
 
     // A string to hold the result.
-    XPathExecutionContext::GetAndReleaseCachedString    theResult(executionContext);
+    GetCachedString     theResult(executionContext);
 
     XalanDOMString&     theString = theResult.get();
 

Modified: xalan/c/trunk/src/xalanc/XPath/XObject.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/XObject.cpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/XObject.cpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/XObject.cpp Sun Aug 31 23:42:06 2008
@@ -254,7 +254,7 @@
             XPathExecutionContext&  executionContext,
             const XalanNode&        theNode)
 {
-    XPathExecutionContext::GetAndReleaseCachedString    theGuard(executionContext);
+    const GetCachedString   theGuard(executionContext);
 
     XalanDOMString&     theString = theGuard.get();
 
@@ -375,6 +375,8 @@
 
 
 
+typedef XObject::GetCachedString    GetCachedString;
+
 struct
 getNumberFromNodeFunction
 {
@@ -402,7 +404,7 @@
     double
     getNumberFromNode(const XalanNode&  theNode) const
     {
-        XPathExecutionContext::GetAndReleaseCachedString    theString(m_executionContext);
+        const GetCachedString   theString(m_executionContext);
 
         getStringFromNode(theNode, m_executionContext, theString.get());
 
@@ -718,9 +720,9 @@
 
         if (len2 > 0)
         {
-            XPathExecutionContext::GetAndReleaseCachedString    s1(executionContext);
+            const GetCachedString   s1(executionContext);
 
-            XPathExecutionContext::GetAndReleaseCachedString    s2(executionContext);
+            const GetCachedString   s2(executionContext);
 
             for(NodeRefListBase::size_type i = 0; i < len1 && theResult == false; i++)
             {
@@ -767,7 +769,7 @@
 
     const NodeRefListBase::size_type    len1 = theLHSNodeSet.getLength();
 
-    XPathExecutionContext::GetAndReleaseCachedString    theGuard(executionContext);
+    XPathExecutionContext::GetCachedString  theGuard(executionContext);
 
     XalanDOMString&     theLHS = theGuard.get();
 
@@ -1315,7 +1317,7 @@
 
 
 
-const XalanDOMChar  XObject::XObjectException::m_type[] = 
+const XalanDOMChar  XObject::XObjectException::s_type[] = 
 {   
     XalanUnicode::charLetter_X,
     XalanUnicode::charLetter_O,
@@ -1339,16 +1341,29 @@
 
 
 XObject::XObjectException::XObjectException(
-                const XalanDOMString&   message,
-                MemoryManager&          theManager) :
+            const XalanDOMString&   theMessage,
+            MemoryManager&          theManager) :
     XalanXPathException(
-        message,
+        theMessage,
         theManager)
 {
 }
 
     
     
+XObject::XObjectException::XObjectException(
+            const XalanDOMString&   theMessage,
+            MemoryManager&          theManager,
+            const Locator*          theLocator) :
+    XalanXPathException(
+        theMessage,
+        theManager,
+        theLocator)
+{
+}
+
+
+
 XObject::XObjectException::XObjectException(const XObjectException&     other):
     XalanXPathException(other)
 {
@@ -1362,7 +1377,15 @@
 
 
 
-const XalanDOMChar  XObject::XObjectInvalidConversionException::m_type[] = 
+const XalanDOMChar*
+XObject::XObjectException::getType() const
+{
+    return s_type;
+}
+
+
+
+const XalanDOMChar  XObject::XObjectInvalidConversionException::s_type[] = 
 {   
     XalanUnicode::charLetter_X,
     XalanUnicode::charLetter_O,
@@ -1432,6 +1455,14 @@
 
 
 
+const XalanDOMChar*
+XObject::XObjectInvalidConversionException::getType() const
+{
+    return s_type;
+}
+
+
+
 const XalanDOMString&
 XObject::XObjectInvalidConversionException::formatErrorString(
                 const XalanDOMString&   fromType,

Modified: xalan/c/trunk/src/xalanc/XPath/XObject.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/XObject.hpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/XObject.hpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/XObject.hpp Sun Aug 31 23:42:06 2008
@@ -66,6 +66,8 @@
 
 	friend class XObjectPtr;
 
+    typedef XPathExecutionContext::GetCachedString  GetCachedString;
+
 	/**
 	 * Enumeration of possible object types
 	 */
@@ -736,25 +738,26 @@
 	{
 	public:
 
-		explicit
 		XObjectException(
 				const XalanDOMString&	theMessage,
                 MemoryManager&          theManager);
 
+		XObjectException(
+				const XalanDOMString&	theMessage,
+                MemoryManager&          theManager,
+                const Locator*          theLocator);
+
         XObjectException(const XObjectException&    other) ;
 
 		virtual
 		~XObjectException();
 
 		virtual const XalanDOMChar*
-		getType() const
-		{
-			return m_type;
-		}
+		getType() const;
 
     private:
 
-		static const XalanDOMChar	m_type[];
+		static const XalanDOMChar	s_type[];
 	};
 
 	class XObjectInvalidConversionException : public XObjectException
@@ -773,14 +776,11 @@
 		~XObjectInvalidConversionException();
 
 		virtual const XalanDOMChar*
-		getType() const
-		{
-			return m_type;
-		}
+		getType() const;
 
     private:
 
-		static const XalanDOMChar	m_type[];
+		static const XalanDOMChar	s_type[];
 
 		static const XalanDOMString&
 		formatErrorString(

Modified: xalan/c/trunk/src/xalanc/XPath/XObjectFactory.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/XObjectFactory.hpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/XObjectFactory.hpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/XObjectFactory.hpp Sun Aug 31 23:42:06 2008
@@ -54,8 +54,9 @@
 {
 public:
 
-	typedef XPathExecutionContext::BorrowReturnMutableNodeRefList	BorrowReturnMutableNodeRefList;
-	typedef XPathExecutionContext::GetAndReleaseCachedString		GetAndReleaseCachedString;
+	typedef XPathExecutionContext::BorrowReturnMutableNodeRefList   BorrowReturnMutableNodeRefList;
+	typedef XPathExecutionContext::GetCachedString		            GetCachedString;
+	typedef XPathExecutionContext::GetCachedString		            GetAndReleaseCachedString;
 
 
 	XObjectFactory(MemoryManager&   theManager);
@@ -210,7 +211,7 @@
 	 * @return pointer to new object
 	 */
 	virtual const XObjectPtr
-	createString(GetAndReleaseCachedString&		theValue) = 0;
+	createString(GetCachedString&   theValue) = 0;
 
 	/**
 	 * Create an "unknown" XObject from a string.

Modified: xalan/c/trunk/src/xalanc/XPath/XObjectFactoryDefault.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/XObjectFactoryDefault.cpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/XObjectFactoryDefault.cpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/XObjectFactoryDefault.cpp Sun Aug 31 23:42:06 2008
@@ -458,7 +458,7 @@
 
 
 const XObjectPtr
-XObjectFactoryDefault::createString(GetAndReleaseCachedString&	theValue)
+XObjectFactoryDefault::createString(GetCachedString&    theValue)
 {
 	XStringCached* const	theXStringCached = m_xstringCachedAllocator.createString(theValue);
 

Modified: xalan/c/trunk/src/xalanc/XPath/XObjectFactoryDefault.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/XObjectFactoryDefault.hpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/XObjectFactoryDefault.hpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/XObjectFactoryDefault.hpp Sun Aug 31 23:42:06 2008
@@ -149,11 +149,10 @@
             XPathExecutionContext&  theExecutionContext);
 
 	virtual const XObjectPtr
-	createString(GetAndReleaseCachedString&		theValue);
+	createString(GetCachedString&   theValue);
 
 	virtual const XObjectPtr
-	createUnknown(
-			const XalanDOMString&	theValue);
+	createUnknown(const XalanDOMString&     theValue);
 
 	typedef XalanVector<XObject*>		XObjectCollectionType;
 	typedef XalanVector<XNumber*>		XNumberCacheType;

Modified: xalan/c/trunk/src/xalanc/XPath/XPath.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/XPath.cpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/XPath.cpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/XPath.cpp Sun Aug 31 23:42:06 2008
@@ -108,13 +108,15 @@
 
     const GetCachedString   theGuard2(executionContext);
 
-    executionContext.error(
+    executionContext.problem(
+        XPathExecutionContext::eXPath,
+        XPathExecutionContext::eError,
         XalanMessageLoader::getMessage(
             theGuard2.get(),
             XalanMessages::InvalidOpcodeWasDetected_1Param,
             theOpCode),
-        context,
-        m_locator);
+        m_locator,
+        context);
 }
 
 
@@ -128,12 +130,14 @@
 
     XalanDOMString&     theBuffer = theGuard.get();
 
-    executionContext.error(
+    executionContext.problem(
+        XPathExecutionContext::eXPath,
+        XPathExecutionContext::eError,
         XalanMessageLoader::getMessage(
             theBuffer,
             XalanMessages::ExpressionDoesNotEvaluateToNodeSet),
-        context,
-        m_locator);
+        m_locator,
+        context);
 }
 
 
@@ -1403,12 +1407,14 @@
 
         XalanDOMString&     theBuffer = theGuard.get();
 
-        executionContext.error(
+        executionContext.problem(
+            XPathExecutionContext::eXPath,
+            XPathExecutionContext::eError,
             XalanMessageLoader::getMessage(
                 theBuffer,
                 XalanMessages::CannotEvaluateXPathExpressionAsMatchPattern),
-            node,
-            m_locator);
+            m_locator,
+            node);
     }
     else
     {
@@ -2810,7 +2816,7 @@
     {
         assert(theNodeList->item(0) != 0);
 
-        const XPathExecutionContext::GetAndReleaseCachedString  theData(executionContext);
+        const GetCachedString   theData(executionContext);
 
         XalanDOMString&     theString = theData.get();
 
@@ -3342,15 +3348,17 @@
             const GetCachedString   theGuard1(executionContext);
             const GetCachedString   theGuard2(executionContext);
 
-            executionContext.error(
+            executionContext.problem(
+                XPathExecutionContext::eXPath,
+                XPathExecutionContext::eError,
                 XalanMessageLoader::getMessage(
                     theGuard1.get(),
                     XalanMessages::UnknownMatchOpCode_1Param,
                     NumberToDOMString(
                         stepType,
                         theGuard2.get())),
-                context,
-                getLocator());
+                getLocator(),
+                context);
 
             break;
         }
@@ -4446,15 +4454,17 @@
     const GetCachedString   theGuard1(executionContext);
     const GetCachedString   theGuard2(executionContext);
 
-    executionContext.error(
+    executionContext.problem(
+            XPathExecutionContext::eXPath,
+            XPathExecutionContext::eError,
             XalanMessageLoader::getMessage(
                 theGuard1.get(),
                 XalanMessages::UnknownAxis_1Param,
                 NumberToDOMString(
                     stepType,
                     theGuard2.get())),
-            context,
-            getLocator());
+            getLocator(),
+            context);
 
     return opPos + argLen + 3;
 }
@@ -4628,13 +4638,15 @@
         {
             GetCachedString     theGuard(executionContext);
 
-            executionContext.error(
+            executionContext.problem(
+                XPathExecutionContext::eXPath,
+                XPathExecutionContext::eError,
                 XalanMessageLoader::getMessage(
                     theGuard.get(),
                     XalanMessages::ArgLengthNodeTestIsIncorrect_1Param,
                     "processing-instruction()"),
-                0,
-                xpath.getLocator());
+                xpath.getLocator(),
+                executionContext.getCurrentNode());
         }
         break;
 
@@ -4824,15 +4836,17 @@
         {
             if (XalanQName::isValidNCName(theNameTest) == false)
             {
-                const XPathConstructionContext::GetAndReleaseCachedString   theGuard(theConstructionContext);
+                const XPathConstructionContext::GetCachedString     theGuard(theConstructionContext);
 
-                theConstructionContext.error(
+                theConstructionContext.problem(
+                    XPathConstructionContext::eXPath,
+                    XPathConstructionContext::eError,
                     XalanMessageLoader::getMessage(
                         theGuard.get(),
                         XalanMessages::IsNotValidQName_1Param,
                         theNameTest),
-                        0,
-                        theLocator);
+                        theLocator,
+                        0);
             }
             else
             {
@@ -4843,7 +4857,7 @@
         }
         else
         {
-            const XPathConstructionContext::GetAndReleaseCachedString   scratchGuard(theConstructionContext);
+            const XPathConstructionContext::GetCachedString     scratchGuard(theConstructionContext);
 
             XalanDOMString&     theScratchString = scratchGuard.get();
 
@@ -4855,25 +4869,29 @@
 
             if (theNamespaceURI == 0)
             {
-                theConstructionContext.error(
+                theConstructionContext.problem(
+                    XPathConstructionContext::eXPath,
+                    XPathConstructionContext::eError,
                     XalanMessageLoader::getMessage(
                         theScratchString,
                         XalanMessages::PrefixIsNotDeclared_1Param),
-                        0,
-                        theLocator);
+                        theLocator,
+                        0);
             }
             else
             {
                 // OK, now we have a namespace URI...
                 if (XalanQName::isValidNCName(theScratchString) == false)
                 {
-                    theConstructionContext.error(
+                    theConstructionContext.problem(
+                        XPathConstructionContext::eXPath,
+                        XPathConstructionContext::eError,
                         XalanMessageLoader::getMessage(
                             theScratchString,
                             XalanMessages::IsNotValidQName_1Param,
                             theNameTest),
-                            0,
-                            theLocator);
+                            theLocator,
+                            0);
                 }
                 else if (theIndex == theLength - 2 &&
                          theNameTest[theIndex + 1] == XPath::PSEUDONAME_ANY[0])
@@ -4889,13 +4907,15 @@
 
                     if (XalanQName::isValidNCName(theScratchString) == false)
                     {
-                        theConstructionContext.error(
+                        theConstructionContext.problem(
+                            XPathConstructionContext::eXPath,
+                            XPathConstructionContext::eError,
                             XalanMessageLoader::getMessage(
                                 theScratchString,
                                 XalanMessages::IsNotValidQName_1Param,
                                 theNameTest),
-                            0,
-                            theLocator);
+                            theLocator,
+                            0);
                     }
                     else
                     {

Modified: xalan/c/trunk/src/xalanc/XPath/XPath.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/XPath.hpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/XPath.hpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/XPath.hpp Sun Aug 31 23:42:06 2008
@@ -70,7 +70,7 @@
     typedef XPathExpression::OpCodeMapPositionType              OpCodeMapPositionType;
     typedef XPathExpression::OpCodeMapValueType                 OpCodeMapValueType;
     typedef XPathExpression::TokenQueuePositionType             TokenQueuePositionType;
-    typedef XPathExecutionContext::GetAndReleaseCachedString    GetCachedString;
+    typedef XPathExecutionContext::GetCachedString              GetCachedString;
     typedef XPathExecutionContext::PrefixResolverSetAndRestore  PrefixResolverSetAndRestore;
     typedef XPathExecutionContext::CurrentNodePushAndPop        CurrentNodePushAndPop;
 
@@ -148,7 +148,7 @@
      * Perform static initialization.  See class XPathInit.
      */
     static void
-    initialize(MemoryManagerType& theManager);
+    initialize(MemoryManager&   theManager);
 
     /**
      * Perform static shut down.  See class XPathInit.
@@ -162,16 +162,21 @@
      * @param theLocator The applicable LocatorType, if any.
      */
     explicit
-    XPath(MemoryManagerType& theManager, const LocatorType*	theLocator = 0);
+    XPath(
+            MemoryManager&  theManager,
+            const Locator*	theLocator = 0);
 
     static XPath*
-    create(MemoryManagerType& theManager, const LocatorType*	theLocator = 0);
+    create(
+            MemoryManager&  theManager,
+            const Locator*	theLocator = 0);
 
-    MemoryManagerType&
-     getMemoryManager()
+    MemoryManager&
+    getMemoryManager()
     {
         return m_expression.getMemoryManager();
     }
+
     ~XPath();
 
     /**

Modified: xalan/c/trunk/src/xalanc/XPath/XPathConstructionContext.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/XPathConstructionContext.hpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/XPathConstructionContext.hpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/XPathConstructionContext.hpp Sun Aug 31 23:42:06 2008
@@ -29,6 +29,10 @@
 
 
 
+#include "xalanc/PlatformSupport/ProblemListenerBase.hpp"
+
+
+
 XALAN_DECLARE_XERCES_CLASS(Locator)
 
 
@@ -47,22 +51,37 @@
 
 
 //
-/**
- * @author <a href="mailto:david_n_bertoni@lotus.com">David N. Bertoni</a>
- */
 // An abstract class which provides support for constructing the internal
 // representation  of a stylesheet.
 //
-class XALAN_XPATH_EXPORT XPathConstructionContext
+class XALAN_XPATH_EXPORT XPathConstructionContext : public ProblemListenerBase
 {
 public:
 
-    XPathConstructionContext(MemoryManagerType&              theManager);
+    XPathConstructionContext(MemoryManager&     theManager);
 
     virtual
     ~XPathConstructionContext();
 
 
+    // These interfaces are inherited from ProblemListenerBase...
+	virtual void
+	problem(
+			eSource		            source,
+			eClassification			classification,
+			const XalanDOMString&	msg,
+            const Locator*          locator,
+			const XalanNode*		sourceNode) = 0;
+
+	virtual void
+	problem(
+            eSource                 source,
+            eClassification         classification,
+			const XalanDOMString&	msg,
+			const XalanNode*		sourceNode) = 0;
+
+
+    // These interfaces are new...
     /**
      * Reset the instance.  Any existing objects
      * created by the instance will be destroyed.
@@ -115,17 +134,17 @@
     virtual bool
     releaseCachedString(XalanDOMString&     theString) = 0;
 
-    class GetAndReleaseCachedString
+    class GetCachedString
     {
     public:
 
-        GetAndReleaseCachedString(XPathConstructionContext&     theConstructionContext) :
+        GetCachedString(XPathConstructionContext&     theConstructionContext) :
             m_constructionContext(&theConstructionContext),
             m_string(&theConstructionContext.getCachedString())
         {
         }
 
-        ~GetAndReleaseCachedString()
+        ~GetCachedString()
         {
             assert(m_string != 0);
 
@@ -151,12 +170,12 @@
     private:
 
         // Not implemented...
-        GetAndReleaseCachedString();
+        GetCachedString();
 
-        GetAndReleaseCachedString(const GetAndReleaseCachedString&);
+        GetCachedString(const GetCachedString&);
 
-        GetAndReleaseCachedString&
-        operator=(const GetAndReleaseCachedString&);
+        GetCachedString&
+        operator=(const GetCachedString&);
 
 
         // Data members...
@@ -165,27 +184,23 @@
         XalanDOMString*             m_string;
     };
 
-    typedef GetAndReleaseCachedString   GetCachedString;
+    typedef GetCachedString     GetAndReleaseCachedString;
 
-    MemoryManagerType&
-    getMemoryManager()
+    MemoryManager&
+    getMemoryManager() const
     {
         return m_memoryManager;
     }
 
-    virtual void
-    error(
-            const XalanDOMString&   msg,
-            const XalanNode*        sourceNode,
-            const Locator*          locator) const = 0;
+    MemoryManager&
+    getMemoryManager()
+    {
+        return m_memoryManager;
+    }
 
-    virtual void
-    warn(
-            const XalanDOMString&   msg,
-            const XalanNode*        sourceNode,
-            const Locator*          locator) const = 0;
+private:
 
-    MemoryManagerType&              m_memoryManager;
+    mutable MemoryManager&  m_memoryManager;
 };
 
 

Modified: xalan/c/trunk/src/xalanc/XPath/XPathConstructionContextDefault.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/XPathConstructionContextDefault.cpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/XPathConstructionContextDefault.cpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/XPathConstructionContextDefault.cpp Sun Aug 31 23:42:06 2008
@@ -20,7 +20,20 @@
 
 
 
-#include "xalanc/XPath/XPathParserException.hpp"
+#if defined(XALAN_CLASSIC_IOSTREAMS)
+#include <iostream.h>
+#else
+#include <iostream>
+#endif
+
+
+
+#include "xalanc/PlatformSupport/XalanOutputStreamPrintWriter.hpp"
+#include "xalanc/PlatformSupport/XalanStdOutputStream.hpp"
+
+
+
+#include "XPathParserException.hpp"
 
 
 
@@ -28,29 +41,31 @@
 
 
 
-XPathConstructionContextDefault::XPathConstructionContextDefault(MemoryManagerType& theManager) :
+XPathConstructionContextDefault::XPathConstructionContextDefault(MemoryManager&     theManager) :
 	XPathConstructionContext(theManager),
 	m_stringPool(theManager),
 	m_stringCache(theManager)
 {
 }
 
+
+    
 XPathConstructionContextDefault*
-XPathConstructionContextDefault::create(MemoryManagerType& theManager)
+XPathConstructionContextDefault::create(MemoryManager&  theManager)
 {
     typedef XPathConstructionContextDefault ThisType;
 
-    XalanMemMgrAutoPtr<ThisType, false> theGuard( theManager , (ThisType*)theManager.allocate(sizeof(ThisType)));
-
-    ThisType* theResult = theGuard.get();
+    XalanAllocationGuard    theGuard(theManager, theManager.allocate(sizeof(ThisType)));
 
-    new (theResult) ThisType(theManager);
+    ThisType* theResult = new (theGuard.get()) ThisType(theManager);
 
     theGuard.release();
 
     return theResult;
 }
 
+
+
 XPathConstructionContextDefault::~XPathConstructionContextDefault()
 {
 	reset();
@@ -101,32 +116,61 @@
 
 
 void
-XPathConstructionContextDefault::error(
+XPathConstructionContextDefault::problem(
+			eSource		            source,
+			eClassification			classification,
 			const XalanDOMString&	msg,
-			const XalanNode* 		/* sourceNode */,
-			const LocatorType* 		locator) const
+            const Locator*          locator,
+			const XalanNode*		sourceNode)
 {
-    MemoryManagerType& theManager = const_cast<XPathConstructionContextDefault*>(this)-> getMemoryManager();
+    MemoryManager&  theManager = getMemoryManager();
 
-    if (locator != 0)
-	{
-        MemoryManagerType& theManager = const_cast<XPathConstructionContextDefault*>(this)-> getMemoryManager();
+    XALAN_USING_STD(cerr)
 
-		throw XPathParserException(*locator, msg, theManager);
-	}
-	else
-	{
-		throw XPathParserException(msg, theManager);
+    XalanStdOutputStream            theStream(cerr, theManager);
+    XalanOutputStreamPrintWriter    thePrintWriter(theStream);
+
+    defaultFormat(
+        thePrintWriter,
+        source,
+        classification,
+        msg,
+        locator,
+        sourceNode);
+
+    if (classification == eError)
+    {
+		throw XPathParserException(msg, theManager, locator);
 	}
 }
 
 
+
 void
-XPathConstructionContextDefault::warn(
-			const XalanDOMString&	/* msg */,
-			const XalanNode* 		/* sourceNode */,
-			const LocatorType* 		/* locator */) const
+XPathConstructionContextDefault::problem(
+            eSource                 source,
+            eClassification         classification,
+			const XalanDOMString&	msg,
+			const XalanNode*		sourceNode)
 {
+    MemoryManager&  theManager = getMemoryManager();
+
+    XALAN_USING_STD(cerr)
+
+    XalanStdOutputStream            theStream(cerr, theManager);
+    XalanOutputStreamPrintWriter    thePrintWriter(theStream);
+
+    defaultFormat(
+        thePrintWriter,
+        source,
+        classification,
+        msg,
+        sourceNode);
+
+    if (classification == eError)
+    {
+		throw XPathParserException(msg, theManager);
+	}
 }
 
 

Modified: xalan/c/trunk/src/xalanc/XPath/XPathConstructionContextDefault.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/XPathConstructionContextDefault.hpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/XPathConstructionContextDefault.hpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/XPathConstructionContextDefault.hpp Sun Aug 31 23:42:06 2008
@@ -55,15 +55,32 @@
 	/*
 	 * Construct an instance.
 	 */
-	XPathConstructionContextDefault(MemoryManagerType& theManager XALAN_DEFAULT_MEMMGR);
+	XPathConstructionContextDefault(MemoryManager&  theManager XALAN_DEFAULT_MEMMGR);
 
     static XPathConstructionContextDefault*
-    create(MemoryManagerType& theManager);
+    create(MemoryManager&   theManager);
 
 	virtual
 	~XPathConstructionContextDefault();
 
+
+    // These interfaces are inherited from XPathConstructionContext...
+	virtual void
+	problem(
+			eSource		            source,
+			eClassification			classification,
+			const XalanDOMString&	msg,
+            const Locator*          locator,
+			const XalanNode*		sourceNode);
+
 	virtual void
+	problem(
+            eSource                 source,
+            eClassification         classification,
+			const XalanDOMString&	msg,
+			const XalanNode*		sourceNode);
+
+    virtual void
 	reset();
 
 	virtual const XalanDOMString&
@@ -80,18 +97,6 @@
 	virtual bool
 	releaseCachedString(XalanDOMString&		theString);
 
-	virtual void
-	error(
-			const XalanDOMString&	msg,
-			const XalanNode* 		sourceNode,
-			const LocatorType* 		locator) const;
-
-	virtual void
-	warn(
-			const XalanDOMString&	msg,
-			const XalanNode* 		sourceNode,
-			const LocatorType* 		locator) const;
-
 private:
 
 	XalanDOMStringPool		m_stringPool;

Modified: xalan/c/trunk/src/xalanc/XPath/XPathEnvSupport.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/XPathEnvSupport.hpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/XPathEnvSupport.hpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/XPathEnvSupport.hpp Sun Aug 31 23:42:06 2008
@@ -25,12 +25,7 @@
 
 
 
-// $$$ ToDo: Necessary while XalanDOMString is style a typedef.
-#include <xalanc/XalanDOM/XalanDOMString.hpp>
-
-
-
-#include <xalanc/PlatformSupport/DOMStringHelper.hpp>
+#include "xalanc/PlatformSupport/ProblemListenerBase.hpp"
 
 
 
@@ -46,22 +41,20 @@
 
 
 
-/**
- * @author <a href="mailto:david_n_bertoni@lotus.com">David N. Bertoni</a>
- */
 class NodeRefListBase;
 class PrefixResolver;
 class XObject;
 class XPathExecutionContext;
 class XObjectFactory;
 class XalanDocument;
+class XalanDOMString;
 class XalanElement;
 class XalanNode;
 class XalanQName;
 
 
 
-class XALAN_XPATH_EXPORT XPathEnvSupport
+class XALAN_XPATH_EXPORT XPathEnvSupport : public ProblemListenerBase
 {
 public:
 
@@ -74,18 +67,40 @@
 	virtual
 	~XPathEnvSupport();
 
+
+    // These methods are inherited from ProblemListener ...
+	virtual void
+	problem(
+			eSource					source,
+			eClassification			classification,
+			const XalanDOMString&	msg,
+            const Locator*          locator,
+			const XalanNode*		sourceNode) = 0;
+
+	virtual void
+	problem(
+			eSource					source,
+			eClassification			classification,
+			const XalanDOMString&	msg,
+			const XalanNode*		sourceNode) = 0;
+
+
+    // These interfaces are new to XPathEnvSupport
 	/**
 	 * Provides support for XML parsing service.
 	 *
+     * @param theManager The MemoryManager instance to use.
 	 * @param urlString location of the XML
 	 * @param base base location for URI
+     * @param theErrorHandler An optional ErrorHandler instance for error reporting.
 	 * @return parsed document
 	 */
 	virtual XalanDocument*
 	parseXML(
-            MemoryManagerType&      theManager,
+            MemoryManager&          theManager,
 			const XalanDOMString&	urlString,
-			const XalanDOMString&	base) = 0;
+			const XalanDOMString&	base,
+            ErrorHandler*           theErrorHandler = 0) = 0;
 
 	/**
 	 * Get the source document for the given URI.
@@ -162,43 +177,6 @@
 			const XObjectArgVectorType&		argVec,
 			const LocatorType*				locator) const = 0;
 
-	enum eSource { eXMLParser		= 1,
-				   eXSLTProcessor	= 2,
-				   eXPATHParser		= 3,
-				   eXPATHProcessor	= 4,
-				   eDataSource		= 5 };
-
-	enum eClassification { eMessage = 0,
-						   eWarning = 1,
-						   eError = 2 };
-
-	/**
-	 * Function that is called when a problem event occurs.
-	 * 
-	 * @param where 			either eXMLParser, eXSLTProcessor,
-	 *			 			      eXPATHParser, eXPATHProcessor, or eDataSource.
-	 * @param classification	either eWarning, or eError
-	 * @param resolver       resolver for namespace resolution
-	 * @param sourceNode     source tree node where the problem occurred
-	 *                       (may be 0)
-	 * @param msg            string message explaining the problem.
-	 * @param   uri				  the URI of the stylesheet, if available.  May be 0;
-	 * @param lineNo         line number where the problem occurred.
-	 * @param charOffset     character offset where the problem.
-	 * @return true if the return is an ERROR, in which case exception will be
-	 *         thrown.  Otherwise the processor will continue to process.
-	 */
-	virtual bool
-	problem(
-			eSource					where,
-			eClassification			classification,
-			const PrefixResolver*	resolver,
-			const XalanNode*		sourceNode,
-			const XalanDOMString&	msg,
-			const XalanDOMChar*		uri,
-			XalanFileLoc			lineNo,
-			XalanFileLoc			charOffset) const = 0;
-
 	/**
 	 * Reset the instance.
 	 */

Modified: xalan/c/trunk/src/xalanc/XPath/XPathEnvSupportDefault.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/XPathEnvSupportDefault.cpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/XPathEnvSupportDefault.cpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/XPathEnvSupportDefault.cpp Sun Aug 31 23:42:06 2008
@@ -37,6 +37,7 @@
 
 
 #include <xalanc/PlatformSupport/DOMStringHelper.hpp>
+#include <xalanc/PlatformSupport/PrintWriter.hpp>
 #include <xalanc/PlatformSupport/XalanMessageLoader.hpp>
 
 
@@ -66,7 +67,7 @@
 const XalanDOMString                                    XPathEnvSupportDefault::s_emptyString(XalanMemMgrs::getDummyMemMgr());
 
 void
-XPathEnvSupportDefault::initialize(MemoryManagerType&  theManager)
+XPathEnvSupportDefault::initialize(MemoryManager&   theManager)
 {
     XPathEnvSupportDefault::NamespaceFunctionTablesType tmpMap(theManager);
 
@@ -91,10 +92,12 @@
 
 
 
-XPathEnvSupportDefault::XPathEnvSupportDefault(MemoryManagerType&  theManager) :
+XPathEnvSupportDefault::XPathEnvSupportDefault(MemoryManager&   theManager) :
 	XPathEnvSupport(),
 	m_sourceDocs(theManager),
-	m_externalFunctions(theManager)
+	m_externalFunctions(theManager),
+    m_memoryManager(theManager),
+    m_pw(0)
 {
 }
 
@@ -157,7 +160,7 @@
 			// Found it, so delete the function...
             const_cast<Function*>((*j).second)->~Function();
 
-            MemoryManagerType& theManager = theTable.getMemoryManager();
+            MemoryManager&  theManager = theTable.getMemoryManager();
 
             theManager.deallocate((void*)(*j).second);
 
@@ -233,7 +236,8 @@
 XPathEnvSupportDefault::parseXML(
             MemoryManagerType&      /* theManager */,
 			const XalanDOMString&	/* urlString */,
-			const XalanDOMString&	/* base */)
+			const XalanDOMString&	/* base */,
+            ErrorHandler*           /* theErrorHandler */)
 {
 	return 0;
 }
@@ -423,16 +427,12 @@
 
 		theFunctionName += functionName;
 
-        XPathExecutionContext::GetAndReleaseCachedString theGuard(executionContext);
+        const XPathExecutionContext::GetCachedString    theGuard(executionContext);
 
-		if (locator != 0)
-		{
-			throw XPathExceptionFunctionNotAvailable(theFunctionName, *locator, theGuard.get());
-		}
-		else
-		{
-			throw XPathExceptionFunctionNotAvailable(theFunctionName,  theGuard.get());
-		}
+        throw XPathExceptionFunctionNotAvailable(
+                theFunctionName,
+                theGuard.get(),
+                locator);
 
 		// dummy return value...
 		return XObjectPtr();
@@ -441,37 +441,58 @@
 
 
 
-bool
+void
+XPathEnvSupportDefault::setPrintWriter(PrintWriter*     pw)
+{
+    m_pw = pw;
+}
+
+
+
+void
 XPathEnvSupportDefault::problem(
-			eSource					/* where */,
+			eSource					source,
 			eClassification			classification,
-			const PrefixResolver*	/* resolver */,
-			const XalanNode*		/* sourceNode */,
 			const XalanDOMString&	msg,
-			const XalanDOMChar*		uri,
-			XalanFileLoc			lineNo,
-			XalanFileLoc			charOffset) const
+            const Locator*          locator,
+			const XalanNode*		sourceNode)
 {
-	cerr << msg;
+    if (m_pw != 0)
+    {
+        defaultFormat(
+            *m_pw,
+            source,
+            classification,
+            msg,
+            locator,
+            sourceNode);
+    }
+}
 
-	if (uri != 0)
-	{
-		cerr << ",in " << uri;
-	}
 
-	cerr << ", at line number "
-		 << static_cast<long>(lineNo)
-		 << " at offset "
-		 << static_cast<long>(charOffset)
-		 << endl;
 
-	return classification == eError ? true : false;
+void
+XPathEnvSupportDefault::problem(
+			eSource					source,
+			eClassification			classification,
+			const XalanDOMString&	msg,
+			const XalanNode*		sourceNode)
+{
+    if (m_pw != 0)
+    {
+        defaultFormat(
+            *m_pw,
+            source,
+            classification,
+            msg,
+            sourceNode);
+    }
 }
 
 
 
-XPathEnvSupportDefault::NamespaceFunctionTableDeleteFunctor::NamespaceFunctionTableDeleteFunctor(MemoryManagerType& theManager) :
-	m_memMgr(theManager)
+XPathEnvSupportDefault::NamespaceFunctionTableDeleteFunctor::NamespaceFunctionTableDeleteFunctor(MemoryManager&     theManager) :
+	m_memoryManager(theManager)
 {
 }
 
@@ -482,11 +503,11 @@
 {
 	FunctionTableInnerType::const_iterator	i = thePair.second.begin();
 
-	while(i != thePair.second.end())
+	while (i != thePair.second.end())
 	{
-        const_cast<Function*>((*i).second)->~Function();
-
-        m_memMgr.deallocate((void*)(*i).second);
+        XalanDestroy(
+            m_memoryManager,
+            const_cast<Function*>((*i).second));
 
         ++i;
 	}

Modified: xalan/c/trunk/src/xalanc/XPath/XPathEnvSupportDefault.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/XPathEnvSupportDefault.hpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/XPathEnvSupportDefault.hpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/XPathEnvSupportDefault.hpp Sun Aug 31 23:42:06 2008
@@ -25,29 +25,30 @@
 #include <xalanc/XPath/XPathEnvSupport.hpp>
 
 
+
 #include<xalanc/PlatformSupport/DOMStringHelper.hpp>
 
 
+
 #include<xalanc/Include/XalanMap.hpp>
 
 
+
 XALAN_CPP_NAMESPACE_BEGIN
 
+
+
 typedef XalanMap<XalanDOMString, const Function*>   FunctionTableTypeDefinition;
 XALAN_USES_MEMORY_MANAGER(FunctionTableTypeDefinition)
 
 
-/**
- * Dummy class in order to make the XPath object happy 
- * for diagnostic purposes.
- * @author <a href="mailto:david_n_bertoni@us.ibm.com">David N. Bertoni</a>
- */
+
 class XALAN_XPATH_EXPORT XPathEnvSupportDefault : public XPathEnvSupport
 {
 public:
 
 	typedef XalanMap<XalanDOMString, XalanDocument*>	SourceDocsTableType;
-	typedef FunctionTableTypeDefinition                         FunctionTableType;
+	typedef FunctionTableTypeDefinition                 FunctionTableType;
 	typedef XalanMap<XalanDOMString, FunctionTableType>	NamespaceFunctionTablesType;
 
 	/**
@@ -55,7 +56,7 @@
 	 * processing occurs.  See class XPathInit.
 	 */
 	static void
-	initialize(MemoryManagerType&  theManager);
+	initialize(MemoryManager&   theManager);
 
 	/**
 	 * Perform termination of statics.  See class XPathInit.
@@ -64,17 +65,35 @@
 	terminate();
 
 
-	XPathEnvSupportDefault(MemoryManagerType&  theManager XALAN_DEFAULT_MEMMGR);
+	XPathEnvSupportDefault(MemoryManager&   theManager XALAN_DEFAULT_MEMMGR);
 
 	virtual
 	~XPathEnvSupportDefault();
 
-    MemoryManagerType& 
-    getMemoryManager()
+    MemoryManager& 
+    getMemoryManager() const
     {
-        return m_sourceDocs.getMemoryManager();
+        return m_memoryManager;
     }
 
+	virtual void
+	setPrintWriter(PrintWriter*		pw);
+
+	virtual void
+	problem(
+			eSource					source,
+			eClassification			classification,
+			const XalanDOMString&	msg,
+            const Locator*          locator,
+			const XalanNode*		sourceNode);
+
+	virtual void
+	problem(
+			eSource					source,
+			eClassification			classification,
+			const XalanDOMString&	msg,
+			const XalanNode*		sourceNode);
+
 	// Interfaces to install and uninstall external functions globally.
 	// These calls are not thread-safe, and should happen during
 	// processing.
@@ -136,7 +155,8 @@
 	parseXML(
             MemoryManagerType&      theManager,
 			const XalanDOMString&	urlString,
-			const XalanDOMString&	base);
+			const XalanDOMString&	base,
+            ErrorHandler*           theErrorHandler = 0);
 
 	virtual XalanDocument*
 	getSourceDocument(const XalanDOMString&	theURI) const;
@@ -168,19 +188,6 @@
 			const XObjectArgVectorType&		argVec,
 			const LocatorType*				locator) const;
 
-	virtual bool
-	problem(
-			eSource					where,
-			eClassification			classification,
-			const PrefixResolver*	resolver,
-			const XalanNode*		sourceNode,
-			const XalanDOMString&	msg,
-			const XalanDOMChar*		uri,
-			XalanFileLoc			lineNo,
-			XalanFileLoc			charOffset) const;
-
-	// These interfaces are inherited from Resettable...
-
 	virtual void
 	reset();
 
@@ -190,7 +197,7 @@
 		typedef FunctionTableType				FunctionTableInnerType;
 		typedef NamespaceFunctionTablesType		NamespaceFunctionTablesInnerType;
 
-        NamespaceFunctionTableDeleteFunctor(MemoryManagerType& theManager);
+        NamespaceFunctionTableDeleteFunctor(MemoryManager&  theManager);
 		/**
 		 * Delete the value object in a map value pair.  The value of the pair must
 		 * be of pointer type.
@@ -199,8 +206,10 @@
 		 */
 		void
 		operator()(const NamespaceFunctionTablesInnerType::value_type&	thePair) const;
+
     private:
-        MemoryManagerType& m_memMgr;
+
+        MemoryManager&  m_memoryManager;
 	};
 
 protected:
@@ -268,6 +277,10 @@
 
 	NamespaceFunctionTablesType				m_externalFunctions;
 
+    mutable MemoryManager&                  m_memoryManager;
+
+    PrintWriter*		                    m_pw;
+
 	static NamespaceFunctionTablesType		s_externalFunctions;
 
     static const XalanDOMString             s_emptyString;

Modified: xalan/c/trunk/src/xalanc/XPath/XPathEvaluator.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/XPathEvaluator.cpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/XPathEvaluator.cpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/XPathEvaluator.cpp Sun Aug 31 23:42:06 2008
@@ -390,7 +390,7 @@
 
 
 
-typedef XPathConstructionContext::GetAndReleaseCachedString     GetAndReleaseCachedString;
+typedef XPathConstructionContext::GetCachedString   GetCachedString;
 
 
 
@@ -404,7 +404,7 @@
 
 	XPathProcessorImpl		theProcessor(m_memoryManager);
 
-    GetAndReleaseCachedString   theGuard(*m_constructionContext.get());
+    const GetCachedString   theGuard(*m_constructionContext.get());
 
     XalanDOMString&     theTempString = theGuard.get();
 
@@ -455,7 +455,7 @@
 
 	XPathProcessorImpl  theProcessor(m_memoryManager);
 
-    GetAndReleaseCachedString   theGuard(*m_constructionContext.get());
+    const GetCachedString   theGuard(*m_constructionContext.get());
 
     XalanDOMString&     theTempString = theGuard.get();
 

Modified: xalan/c/trunk/src/xalanc/XPath/XPathExecutionContext.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/XPathExecutionContext.cpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/XPathExecutionContext.cpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/XPathExecutionContext.cpp Sun Aug 31 23:42:06 2008
@@ -24,8 +24,10 @@
 
 
 
-XPathExecutionContext::XPathExecutionContext(MemoryManagerType& m_memoryManager, XObjectFactory*	theXObjectFactory) :
-    ExecutionContext(m_memoryManager),
+XPathExecutionContext::XPathExecutionContext(
+            MemoryManager&      theMemoryManager,
+            XObjectFactory*     theXObjectFactory) :
+    ExecutionContext(theMemoryManager),
 	m_xobjectFactory(theXObjectFactory)
 {
 }

Modified: xalan/c/trunk/src/xalanc/XPath/XPathExecutionContext.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/XPathExecutionContext.hpp?rev=690861&r1=690860&r2=690861&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/XPathExecutionContext.hpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/XPathExecutionContext.hpp Sun Aug 31 23:42:06 2008
@@ -46,6 +46,10 @@
 
 
 
+XALAN_DECLARE_XERCES_CLASS(ErrorHandler)
+
+
+
 XALAN_CPP_NAMESPACE_BEGIN
 
 
@@ -63,6 +67,10 @@
 
 
 
+XALAN_USING_XERCES(ErrorHandler)
+
+
+
 //
 // An abstract class which provides support for executing XPath functions
 // and extension functions.
@@ -77,7 +85,9 @@
     typedef NodeRefListBase::size_type  size_type;
 
     explicit
-    XPathExecutionContext(MemoryManagerType& m_memoryManager, XObjectFactory*   theXObjectFactory = 0);
+    XPathExecutionContext(
+            MemoryManager&      theMemoryManager,
+            XObjectFactory*     theXObjectFactory = 0);
 
     virtual
     ~XPathExecutionContext();
@@ -227,6 +237,7 @@
      *
      * @return whether the given element is available or not
      */
+
     virtual bool
     elementAvailable(const XalanQName&  theQName) const = 0;
 
@@ -265,7 +276,7 @@
     virtual bool
     functionAvailable(
             const XalanDOMString&   theName,
-            const LocatorType*      locator) const = 0;
+            const Locator*          locator) const = 0;
 
     /**
      * Handle an extension function.
@@ -283,20 +294,23 @@
             const XalanDOMString&           functionName,
             XalanNode*                      context,
             const XObjectArgVectorType&     argVec,
-            const LocatorType*              locator) = 0;
+            const Locator*                  locator) = 0;
 
     /**
      * Provides support for XML parsing service.
      *
+     * @param theManager The MemoryManager instance to use.
      * @param urlString location of the XML
      * @param base base location for URI
+     * @param theErrorHandler An optional ErrorHandler instance for error reporting.
      * @return parsed document
      */
     virtual XalanDocument*
     parseXML(
             MemoryManagerType&      theManager,
             const XalanDOMString&   urlString,
-            const XalanDOMString&   base) const = 0;
+            const XalanDOMString&   base,
+            ErrorHandler*           theErrorHandler = 0) const = 0;
 
     /**
      * Borrow a cached MutableNodeRefList instance.
@@ -315,11 +329,11 @@
     virtual bool
     returnMutableNodeRefList(MutableNodeRefList*    theList) = 0;
 
-    class BorrowReturnMutableNodeRefList
+    class GetCachedNodeList
     {
     public:
 
-        BorrowReturnMutableNodeRefList(XPathExecutionContext&   executionContext) :
+        GetCachedNodeList(XPathExecutionContext&    executionContext) :
             m_xpathExecutionContext(&executionContext),
             m_mutableNodeRefList(executionContext.borrowMutableNodeRefList())
         {
@@ -327,7 +341,7 @@
         }
 
         // N.B. Non-const copy constructor semantics (like std::auto_ptr)
-        BorrowReturnMutableNodeRefList(const BorrowReturnMutableNodeRefList&    theSource) :
+        GetCachedNodeList(const GetCachedNodeList&  theSource) :
             m_xpathExecutionContext(theSource.m_xpathExecutionContext),
             m_mutableNodeRefList(theSource.m_mutableNodeRefList)
         {
@@ -336,7 +350,7 @@
             ((BorrowReturnMutableNodeRefList&)theSource).m_mutableNodeRefList = 0;
         }
 
-        ~BorrowReturnMutableNodeRefList()
+        ~GetCachedNodeList()
         {
             release();
         }
@@ -374,12 +388,12 @@
             }
         }
 
-        BorrowReturnMutableNodeRefList
+        GetCachedNodeList
         clone() const
         {
             assert(m_xpathExecutionContext != 0);
 
-            BorrowReturnMutableNodeRefList  theResult(*m_xpathExecutionContext);
+            GetCachedNodeList   theResult(*m_xpathExecutionContext);
 
             *theResult = *m_mutableNodeRefList;
 
@@ -387,8 +401,8 @@
         }
 
         // N.B. Non-const assignment operator semantics.
-        BorrowReturnMutableNodeRefList&
-        operator=(BorrowReturnMutableNodeRefList&   theRHS)
+        GetCachedNodeList&
+        operator=(GetCachedNodeList&    theRHS)
         {
             release();
 
@@ -408,6 +422,8 @@
         MutableNodeRefList*     m_mutableNodeRefList;
     };
 
+    typedef GetCachedNodeList   BorrowReturnMutableNodeRefList;
+
     /**
      * Get a cached string for temporary use.
      *
@@ -426,25 +442,25 @@
     virtual bool
     releaseCachedString(XalanDOMString&     theString) = 0;
 
-    class GetAndReleaseCachedString
+    class GetCachedString
     {
     public:
 
-        GetAndReleaseCachedString(XPathExecutionContext&    theExecutionContext) :
+        GetCachedString(XPathExecutionContext&  theExecutionContext) :
             m_executionContext(&theExecutionContext),
             m_string(&theExecutionContext.getCachedString())
         {
         }
 
         // Note non-const copy semantics...
-        GetAndReleaseCachedString(GetAndReleaseCachedString&    theSource) :
+        GetCachedString(GetCachedString&    theSource) :
             m_executionContext(theSource.m_executionContext),
             m_string(theSource.m_string)
         {
             theSource.m_string = 0;
         }
 
-        ~GetAndReleaseCachedString()
+        ~GetCachedString()
         {
             if (m_string != 0)
             {
@@ -469,12 +485,12 @@
     private:
 
         // Not implemented...
-        GetAndReleaseCachedString();
+        GetCachedString();
 
-        GetAndReleaseCachedString(const GetAndReleaseCachedString&);
+        GetCachedString(const GetCachedString&);
 
-        GetAndReleaseCachedString&
-        operator=(const GetAndReleaseCachedString&);
+        GetCachedString&
+        operator=(const GetCachedString&);
 
 
         // Data members...
@@ -483,7 +499,7 @@
         XalanDOMString*         m_string;
     };
 
-    typedef GetAndReleaseCachedString   GetCachedString;
+    typedef GetCachedString     GetAndReleaseCachedString;
 
     /**
      * Create a MutableNodeRefList with the appropriate context.
@@ -686,23 +702,20 @@
 
     // These interfaces are inherited from ExecutionContext...
 
-    virtual void
-    error(
-            const XalanDOMString&   msg,
-            const XalanNode*        sourceNode = 0,
-            const LocatorType*      locator = 0) const = 0;
-
-    virtual void
-    warn(
-            const XalanDOMString&   msg,
-            const XalanNode*        sourceNode = 0,
-            const LocatorType*      locator = 0) const = 0;
-
-    virtual void
-    message(
-            const XalanDOMString&   msg,
-            const XalanNode*        sourceNode = 0,
-            const LocatorType*      locator = 0) const = 0;
+	virtual void
+	problem(
+			eSource		            source,
+			eClassification			classification,
+			const XalanDOMString&	msg,
+            const Locator*          locator,
+			const XalanNode*		sourceNode) = 0;
+
+	virtual void
+	problem(
+            eSource                 source,
+            eClassification         classification,
+			const XalanDOMString&	msg,
+			const XalanNode*		sourceNode) = 0;
 
     virtual bool
     shouldStripSourceNode(const XalanText&  node) = 0;



---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org


Mime
View raw message