dmitryh     2004/11/08 10:14:35

  Modified:    c/src/xalanc/XMLSupport FormatterToDOM.cpp
                        FormatterToDOM.hpp FormatterToHTML.cpp
                        FormatterToHTML.hpp FormatterToText.cpp
                        FormatterToText.hpp FormatterToXML.cpp
                        FormatterToXML.hpp FormatterToXML_UTF16.cpp
                        FormatterToXML_UTF16.hpp FormatterToXML_UTF8.cpp
                        FormatterToXML_UTF8.hpp FormatterToXMLBase.cpp
                        FormatterToXMLBase.hpp FormatterTreeWalker.cpp
                        FormatterTreeWalker.hpp XMLParserLiaison.hpp
                        XMLSupportException.cpp XMLSupportException.hpp
                        XMLSupportInit.cpp XMLSupportInit.hpp
  Log:
  Initial implementation on the pluggable memory management
  
  Revision  Changes    Path
  1.5       +9 -7      xml-xalan/c/src/xalanc/XMLSupport/FormatterToDOM.cpp
  
  Index: FormatterToDOM.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XMLSupport/FormatterToDOM.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FormatterToDOM.cpp        26 Feb 2004 22:37:44 -0000      1.4
  +++ FormatterToDOM.cpp        8 Nov 2004 18:14:35 -0000       1.5
  @@ -51,11 +51,12 @@
   
   
   
  -const XalanDOMString FormatterToDOM::s_emptyString;
  +const XalanDOMString 
FormatterToDOM::s_emptyString(XalanMemMgrs::getDummyMemMgr());
   
   
   
   FormatterToDOM::FormatterToDOM(
  +            MemoryManagerType&      theManager ,                   
                        XalanDocument*                  doc,
                        XalanDocumentFragment*  docFrag,
                        XalanElement*                   currentElement) :
  @@ -63,9 +64,9 @@
        m_doc(doc),
        m_docFrag(docFrag),
        m_currentElem(currentElement),
  -     m_elemStack(),
  -     m_buffer1(),
  -     m_buffer2()
  +     m_elemStack(theManager),
  +     m_buffer1(theManager),
  +     m_buffer2(theManager)
   {
        assert(m_doc != 0 && m_docFrag != 0);
   }
  @@ -73,15 +74,16 @@
   
   
   FormatterToDOM::FormatterToDOM(
  +            MemoryManagerType& theManager,
                        XalanDocument*  doc,
                        XalanElement*   elem) :
        FormatterListener(OUTPUT_METHOD_DOM),
        m_doc(doc),
        m_docFrag(0),
        m_currentElem(elem),
  -     m_elemStack(),
  -     m_buffer1(),
  -     m_buffer2()
  +     m_elemStack(theManager),
  +     m_buffer1(theManager),
  +     m_buffer2(theManager)
   {
        assert(m_doc != 0);
   }
  
  
  
  1.7       +2 -0      xml-xalan/c/src/xalanc/XMLSupport/FormatterToDOM.hpp
  
  Index: FormatterToDOM.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XMLSupport/FormatterToDOM.hpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- FormatterToDOM.hpp        31 Jul 2004 06:05:06 -0000      1.6
  +++ FormatterToDOM.hpp        8 Nov 2004 18:14:35 -0000       1.7
  @@ -68,6 +68,7 @@
         * @param currentElement current element for nodes
         */
        FormatterToDOM(
  +            MemoryManagerType& theManager,
                        XalanDocument*                  doc,
                        XalanDocumentFragment*  docFrag,
                        XalanElement*                   currentElement);
  @@ -80,6 +81,7 @@
         * @param elem current element for nodes
         */
        FormatterToDOM(
  +            MemoryManagerType& theManager,
                        XalanDocument*  doc,
                        XalanElement*   elem);
   
  
  
  
  1.7       +47 -12    xml-xalan/c/src/xalanc/XMLSupport/FormatterToHTML.cpp
  
  Index: FormatterToHTML.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XMLSupport/FormatterToHTML.cpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- FormatterToHTML.cpp       26 Feb 2004 22:37:44 -0000      1.6
  +++ FormatterToHTML.cpp       8 Nov 2004 18:14:35 -0000       1.7
  @@ -33,9 +33,8 @@
   
   
   
  -#include <xalanc/Include/XalanAutoPtr.hpp>
  -
   
  +#include <xalanc/Include/XalanMemMgrAutoPtr.hpp>
   
   #include <xalanc/PlatformSupport/DOMStringHelper.hpp>
   #include <xalanc/PlatformSupport/PrefixResolver.hpp>
  @@ -54,11 +53,12 @@
   
   
   
  -const XalanDOMString FormatterToHTML::s_emptyString;
  +const XalanDOMString 
FormatterToHTML::s_emptyString(XalanMemMgrs::getDummyMemMgr());
   
   
   
   FormatterToHTML::FormatterToHTML(
  +            MemoryManagerType&      theManager,
                        Writer&                                 writer,
                        const XalanDOMString&   encoding, 
                        const XalanDOMString&   mediaType,
  @@ -69,6 +69,7 @@
                        bool                                    escapeURLs,
                        bool                                    omitMetaTag) :
        FormatterToXML(
  +            theManager,
                        writer,
                        s_emptyString,
                        doIndent,
  @@ -80,18 +81,18 @@
                        false,
                        s_emptyString,
                        OUTPUT_METHOD_HTML),
  -     m_currentElementName(),
  +     m_currentElementName(theManager),
        m_inBlockElem(false),
  -     m_isRawStack(),
  +     m_isRawStack(theManager),
        m_isScriptOrStyleElem(false),
  -     m_inScriptElemStack(),
  +     m_inScriptElemStack(theManager),
        m_escapeURLs(escapeURLs),
        m_isFirstElement(false),
        m_isUTF8(XalanTranscodingServices::encodingIsUTF8(m_encoding)),
        m_elementLevel(0),
  -     m_hasNamespaceStack(),
  +     m_hasNamespaceStack(theManager),
        m_omitMetaTag(omitMetaTag),
  -     m_elementPropertiesStack()
  +     m_elementPropertiesStack(theManager)
   {
        initCharsMap();
   
  @@ -100,7 +101,41 @@
       m_shouldWriteXMLHeader = false;
   }
   
  +FormatterToHTML*
  +FormatterToHTML::create(
  +            MemoryManagerType&      theManager,
  +                     Writer&                                 writer,
  +                     const XalanDOMString&   encoding, 
  +                     const XalanDOMString&   mediaType,
  +                     const XalanDOMString&   doctypeSystem,
  +                     const XalanDOMString&   doctypePublic,
  +                     bool                                    doIndent,
  +                     int                                             indent,
  +                     bool                                    escapeURLs,
  +                     bool                                    omitMetaTag) 
  +{
  +    typedef FormatterToHTML ThisType;
  +
  +    XalanMemMgrAutoPtr<ThisType, false> theGuard( theManager , 
(ThisType*)theManager.allocate(sizeof(ThisType)));
  +
  +    ThisType* theResult = theGuard.get();
   
  +    new (theResult) ThisType(           
  +                        theManager,
  +                                 writer,
  +                                 encoding, 
  +                                 mediaType,
  +                                 doctypeSystem,
  +                                 doctypePublic,
  +                                 doIndent,
  +                                 indent,
  +                                 escapeURLs,
  +                                 omitMetaTag);
  +
  +   theGuard.release();
  +
  +    return theResult;
  +}
   
   FormatterToHTML::~FormatterToHTML()
   {
  @@ -689,7 +724,7 @@
   
                                        if (i + 1 >= theLength) 
                                        {
  -                                             
throwInvalidUTF16SurrogateException(ch);
  +                        throwInvalidUTF16SurrogateException(ch, 
getMemoryManager());
                                        }
                                        else
                                        {
  @@ -697,7 +732,7 @@
   
                                                if (!(0xdc00 <= next && next < 
0xe000))
                                                {
  -                                                     
throwInvalidUTF16SurrogateException(ch, next);
  +                            throwInvalidUTF16SurrogateException(ch, next, 
getMemoryManager());
                                                }
   
                                                next = XalanDOMChar(((ch - 
0xd800) << 10) + next - 0xdc00 + 0x00010000);
  @@ -765,7 +800,7 @@
   
                                        if (i + 1 >= theStringLength) 
                                        {
  -                                             
throwInvalidUTF16SurrogateException(ch);
  +                                             
throwInvalidUTF16SurrogateException(ch, getMemoryManager());
                                        }
                                        else 
                                        {
  @@ -773,7 +808,7 @@
   
                                                if (!(0xdc00 <= next && next < 
0xe000))
                                                {
  -                                                     
throwInvalidUTF16SurrogateException(ch, next);
  +                                                     
throwInvalidUTF16SurrogateException(ch, next, getMemoryManager());
                                                }
   
                                                next = XalanDOMChar(((ch - 
0xd800) << 10) + next -0xdc00 + 0x00010000);
  
  
  
  1.6       +18 -4     xml-xalan/c/src/xalanc/XMLSupport/FormatterToHTML.hpp
  
  Index: FormatterToHTML.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XMLSupport/FormatterToHTML.hpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FormatterToHTML.hpp       31 Jul 2004 06:05:06 -0000      1.5
  +++ FormatterToHTML.hpp       8 Nov 2004 18:14:35 -0000       1.6
  @@ -49,6 +49,7 @@
    */
   class XALAN_XMLSUPPORT_EXPORT FormatterToHTML : public FormatterToXML 
   {  
  +    
   public:
   
   
  @@ -72,16 +73,29 @@
         * @param omitMetaTag   Whether or not to output a META TAG according 
to the recommendation.  The default is false.
         */
        FormatterToHTML(
  +            MemoryManagerType&      theManager,
                        Writer&                                 writer,
  -                     const XalanDOMString&   encoding = XalanDOMString(),
  -                     const XalanDOMString&   mediaType = XalanDOMString(),
  -                     const XalanDOMString&   doctypeSystem = 
XalanDOMString(),
  -                     const XalanDOMString&   doctypePublic = 
XalanDOMString(),
  +                     const XalanDOMString&   encoding = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
  +                     const XalanDOMString&   mediaType = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
  +                     const XalanDOMString&   doctypeSystem = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
  +                     const XalanDOMString&   doctypePublic = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
                        bool                                    doIndent = true,
                        int                                             indent 
= eDefaultIndentAmount,
                        bool                                    escapeURLs = 
true,
                        bool                                    omitMetaTag = 
false);
   
  +    static FormatterToHTML*
  +    create(
  +            MemoryManagerType&      theManager,
  +                     Writer&                                 writer,
  +                     const XalanDOMString&   encoding, 
  +                     const XalanDOMString&   mediaType,
  +                     const XalanDOMString&   doctypeSystem,
  +                     const XalanDOMString&   doctypePublic,
  +                     bool                                    doIndent,
  +                     int                                             indent,
  +                     bool                                    escapeURLs,
  +                     bool                                    omitMetaTag);
        virtual
        ~FormatterToHTML();
   
  
  
  
  1.7       +42 -6     xml-xalan/c/src/xalanc/XMLSupport/FormatterToText.cpp
  
  Index: FormatterToText.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XMLSupport/FormatterToText.cpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- FormatterToText.cpp       26 Feb 2004 22:37:44 -0000      1.6
  +++ FormatterToText.cpp       8 Nov 2004 18:14:35 -0000       1.7
  @@ -16,7 +16,7 @@
   // Class header file
   #include "FormatterToText.hpp"
   
  -
  +#include <xalanc/Include/XalanMemMgrAutoPtr.hpp>
   
   #include <xalanc/PlatformSupport/Writer.hpp>
   #include <xalanc/PlatformSupport/XalanOutputStream.hpp>
  @@ -31,11 +31,11 @@
   
   
   
  -FormatterToText::FormatterToText() :
  +FormatterToText::FormatterToText(MemoryManagerType& theManager) :
        FormatterListener(OUTPUT_METHOD_TEXT),
        m_writer(0),
        m_maxCharacter(XalanDOMChar(~0)),
  -     m_encoding(),
  +     m_encoding(theManager),
        m_haveEncoding(false),
        m_normalize(true),
        m_handleIgnorableWhitespace(true),
  @@ -47,13 +47,14 @@
   
   
   FormatterToText::FormatterToText(
  +            MemoryManagerType& theManager,
                        Writer&         writer,
                        bool            normalizeLinefeed,
                        bool            handleIgnorableWhitespace) :
        FormatterListener(OUTPUT_METHOD_TEXT),
        m_writer(&writer),
        m_maxCharacter(XalanDOMChar(~0)),
  -     m_encoding(),
  +     m_encoding(theManager),
        m_haveEncoding(false),
        m_normalize(normalizeLinefeed),
        m_handleIgnorableWhitespace(handleIgnorableWhitespace),
  @@ -66,6 +67,7 @@
   
   
   FormatterToText::FormatterToText(
  +            MemoryManagerType&      theManager,
                        Writer&                                 writer,
                        const XalanDOMString&   encoding,
                        bool                                    
normalizeLinefeed,
  @@ -73,16 +75,50 @@
        FormatterListener(OUTPUT_METHOD_TEXT),
        m_writer(&writer),
        m_maxCharacter(0),
  -     m_encoding(isEmpty(encoding) == false ? encoding : 
XalanDOMString(XalanTranscodingServices::s_utf8String)),
  +     m_encoding(theManager),
        m_haveEncoding(true),
        m_normalize(normalizeLinefeed),
        m_handleIgnorableWhitespace(handleIgnorableWhitespace),
        m_newlineString(0),
        m_newlineStringLength(0)
   {
  +    if(isEmpty(encoding) == false)
  +    {
  +        m_encoding = encoding;
  +    }
  +    else
  +    {
  +        m_encoding = XalanDOMString(XalanTranscodingServices::s_utf8String, 
theManager);
  +    }
  +
        update(false);
   }
   
  +FormatterToText*
  +FormatterToText::create(
  +            MemoryManagerType&      theManager,
  +                     Writer&                                 writer,
  +                     const XalanDOMString&   encoding,
  +                     bool                                    
normalizeLinefeed,
  +                     bool                                    
handleIgnorableWhitespace) 
  +{
  +    typedef FormatterToText ThisType;
  +
  +    XalanMemMgrAutoPtr<ThisType, false> theGuard( theManager , 
(ThisType*)theManager.allocate(sizeof(ThisType)));
  +
  +    ThisType* theResult = theGuard.get();
  +
  +    new (theResult) ThisType(
  +                        theManager,
  +                                 writer,
  +                                 encoding,
  +                                 normalizeLinefeed,
  +                                 handleIgnorableWhitespace); 
  +
  +    theGuard.release();
  +
  +    return theResult;
  +}
   
   
   FormatterToText::~FormatterToText()
  @@ -306,7 +342,7 @@
                        }
                        catch(const 
XalanOutputStream::UnsupportedEncodingException&)
                        {
  -                             const XalanDOMString    
theUTF8String(XalanTranscodingServices::s_utf8String);
  +                             const XalanDOMString    
theUTF8String(XalanTranscodingServices::s_utf8String, getMemoryManager());
   
                                // Default to UTF-8 if the requested encoding 
is not supported...
                                theStream->setOutputEncoding(theUTF8String);
  
  
  
  1.5       +16 -1     xml-xalan/c/src/xalanc/XMLSupport/FormatterToText.hpp
  
  Index: FormatterToText.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XMLSupport/FormatterToText.hpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FormatterToText.hpp       26 Feb 2004 22:37:44 -0000      1.4
  +++ FormatterToText.hpp       8 Nov 2004 18:14:35 -0000       1.5
  @@ -51,7 +51,7 @@
        /**
         * FormatterToText instance constructor.
         */
  -     FormatterToText();
  +     FormatterToText(MemoryManagerType& theManager);
   
        /**
         * FormatterToText instance constructor.
  @@ -61,6 +61,7 @@
         * @param handleIgnorableWhitespace If true ignorableWhitespace() will 
write data to the Writer
         */
        FormatterToText(
  +            MemoryManagerType& theManager,
                        Writer&         writer,
                        bool            normalizeLinefeed = true,
                        bool            handleIgnorableWhitespace = true);
  @@ -74,6 +75,15 @@
         * @param handleIgnorableWhitespace If true ignorableWhitespace() will 
write data to the Writer
         */
        FormatterToText(
  +            MemoryManagerType&      theManager,
  +                     Writer&                                 writer,
  +                     const XalanDOMString&   encoding,
  +                     bool                                    
normalizeLinefeed = true,
  +                     bool                                    
handleIgnorableWhitespace = true);
  +
  +     static FormatterToText*
  +    create(
  +            MemoryManagerType&      theManager,
                        Writer&                                 writer,
                        const XalanDOMString&   encoding,
                        bool                                    
normalizeLinefeed = true,
  @@ -82,6 +92,11 @@
        virtual
        ~FormatterToText();
   
  +    MemoryManagerType&
  +    getMemoryManager()
  +    {
  +        return m_encoding.getMemoryManager();
  +    }
   
        Writer*
        getWriter() const
  
  
  
  1.11      +90 -28    xml-xalan/c/src/xalanc/XMLSupport/FormatterToXML.cpp
  
  Index: FormatterToXML.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XMLSupport/FormatterToXML.cpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- FormatterToXML.cpp        26 Feb 2004 22:37:44 -0000      1.10
  +++ FormatterToXML.cpp        8 Nov 2004 18:14:35 -0000       1.11
  @@ -55,6 +55,7 @@
   
   
   FormatterToXML::FormatterToXML(
  +            MemoryManagerType&      theManager,
                        Writer&                                 writer,
                        const XalanDOMString&   version,
                        bool                                    doIndent,
  @@ -85,26 +86,26 @@
        m_nextIsRaw(false),
        m_inCData(false),
        m_encodingIsUTF(false),
  -     m_doctypeSystem(doctypeSystem),
  -     m_doctypePublic(doctypePublic),
  -     m_encoding(isEmpty(encoding) == false ? encoding : 
XalanDOMString(XalanTranscodingServices::s_utf8String)),
  +     m_doctypeSystem(doctypeSystem, theManager),
  +     m_doctypePublic(doctypePublic, theManager),
  +     m_encoding(theManager),
        m_currentIndent(0),
        m_indent(indent),
  -     m_preserves(),
  -     m_stringBuffer(),
  +     m_preserves(theManager),
  +     m_stringBuffer(theManager),
        m_bytesEqualChars(false),
        m_shouldFlush(fBufferData),
        m_spaceBeforeClose(false),
        m_escapeCData(false),
        m_inEntityRef(false),
  -     m_version(version),
  -     m_standalone(standalone),
  -     m_mediaType(mediaType),
  -     m_attrSpecialChars(theDefaultAttrSpecialChars),
  -     m_charBuf(),
  +     m_version(version, theManager),
  +     m_standalone(standalone, theManager),
  +     m_mediaType(mediaType, theManager),
  +     m_attrSpecialChars(theDefaultAttrSpecialChars, theManager),
  +     m_charBuf(theManager),
        m_pos(0),
  -     m_byteBuf(),
  -     m_elemStack(),
  +     m_byteBuf(theManager),
  +     m_elemStack(theManager),
        m_accumNameCharFunction(0),
        m_accumNameStringFunction(0),
        m_accumNameDOMStringFunction(0),
  @@ -114,7 +115,16 @@
        m_accumContentDOMStringFunction(0),
        m_accumContentArrayFunction(0)
   {
  -     assert(isEmpty(m_encoding) == false);
  +    if (isEmpty(encoding) == false)
  +    {
  +        m_encoding = encoding;
  +    }
  +    else
  +    {
  +        m_encoding = XalanDOMString(XalanTranscodingServices::s_utf8String, 
theManager);
  +    }
  +
  +     assert(isEmpty(m_encoding) == false);
   
        if(isEmpty(m_doctypePublic) == false)
        {
  @@ -139,7 +149,7 @@
                catch(const XalanOutputStream::UnsupportedEncodingException&)
                {
                        // Default to UTF-8 if the requested encoding is not 
supported...
  -                     
m_stream->setOutputEncoding(XalanDOMString(XalanTranscodingServices::s_utf8String));
  +                     
m_stream->setOutputEncoding(XalanDOMString(XalanTranscodingServices::s_utf8String,
 theManager));
   
                        m_encoding = XalanTranscodingServices::s_utf8String;
                }
  @@ -302,7 +312,47 @@
        initCharsMap();
   }
   
  +FormatterToXML*
  +FormatterToXML::create(
  +                       MemoryManagerType&      theManager,
  +                       Writer&                                       writer,
  +                       const XalanDOMString& version,
  +                       bool                                      doIndent ,
  +                       int                                           indent ,
  +                       const XalanDOMString& encoding ,
  +                       const XalanDOMString& mediaType ,
  +                       const XalanDOMString& doctypeSystem ,
  +                       const XalanDOMString& doctypePublic ,
  +                       bool                                      xmlDecl ,
  +                       const XalanDOMString& standalone ,
  +                       eFormat                                       format,
  +                       bool                                      fBufferData 
)
  +{
  +    typedef FormatterToXML ThisType;
  +
  +    XalanMemMgrAutoPtr<ThisType, false> theGuard( theManager , 
(ThisType*)theManager.allocate(sizeof(ThisType)));
  +
  +    ThisType* theResult = theGuard.get();
  +
  +    new (theResult) ThisType(   theManager,
  +                                     writer,
  +                                     version,
  +                                doIndent ,
  +                                     indent ,
  +                                     encoding ,
  +                                     mediaType ,
  +                                     doctypeSystem ,
  +                                     doctypePublic ,
  +                                xmlDecl ,
  +                                     standalone ,
  +                                     format,
  +                                fBufferData);
  +
   
  +    theGuard.release();
  +
  +    return theResult;
  +}
   
   FormatterToXML::~FormatterToXML()
   {
  @@ -723,13 +773,17 @@
   XALAN_USING_XERCES(SAXException)
   
   void
  -FormatterToXML::throwInvalidUTF16SurrogateException(XalanDOMChar     ch)
  +FormatterToXML::throwInvalidUTF16SurrogateException(XalanDOMChar     ch, 
MemoryManagerType& theManager)
   {
  -     const XalanDOMString chStr = UnsignedLongToHexDOMString(ch);
  -     const XalanDOMString    theMessage = 
XalanMessageLoader::getMessage(XalanMessages::InvalidSurrogate_1Param,chStr);
  +    XalanDOMString chStr(theManager);
  +    chStr = UnsignedLongToHexDOMString(ch, chStr);
  +
  +     XalanDOMString  theMessage (theManager) ;
   
  +    XalanMessageLoader::getMessage(XalanMessages::InvalidSurrogate_1Param, 
theMessage, chStr);
   
  -     throw SAXException(c_wstr(theMessage));
  +
  +     throw SAXException(c_wstr(theMessage),&theManager);
   }
   
   
  @@ -737,13 +791,21 @@
   void
   FormatterToXML::throwInvalidUTF16SurrogateException(
                        XalanDOMChar    ch,
  -                     XalanDOMChar    next)
  +                     XalanDOMChar    next,
  +            MemoryManagerType& theManager)
   {
   
  -     const XalanDOMString chStr = 
UnsignedLongToHexDOMString(ch)+UnsignedLongToHexDOMString(next);
  -     const XalanDOMString    theMessage = 
XalanMessageLoader::getMessage(XalanMessages::InvalidSurrogate_1Param,chStr);
  +     XalanDOMString chStr(theManager); 
  +    XalanDOMString chStr1(theManager); 
  +
  +    UnsignedLongToHexDOMString(ch, chStr);
  +    UnsignedLongToHexDOMString(next, chStr1);
  +
  +    chStr.append(chStr1);
  +     XalanDOMString  theMessage(theManager);
  +    
XalanMessageLoader::getMessage(XalanMessages::InvalidSurrogate_1Param,theMessage,
 chStr);
   
  -     throw SAXException(c_wstr(theMessage));
  +     throw SAXException(c_wstr(theMessage),&theManager);
   }
   
   
  @@ -765,7 +827,7 @@
   
                        if (i + 1 >= len)
                        {
  -                             throwInvalidUTF16SurrogateException(ch);
  +                             throwInvalidUTF16SurrogateException(ch, 
getMemoryManager());
                        }
                        else 
                        {
  @@ -773,7 +835,7 @@
   
                                if (!(0xdc00u <= next && next < 0xe000u))
                                {
  -                                     throwInvalidUTF16SurrogateException(ch, 
XalanDOMChar(next));
  +                                     throwInvalidUTF16SurrogateException(ch, 
XalanDOMChar(next),getMemoryManager());
                                }
   
                                next = ((ch - 0xd800u) << 10) + next - 0xdc00u 
+ 0x00010000u;
  @@ -1346,7 +1408,7 @@
   
                                if (i + 1 >= end) 
                                {
  -                                     throwInvalidUTF16SurrogateException(c);
  +                                     
throwInvalidUTF16SurrogateException(c,getMemoryManager());
                                }
                                else 
                                {
  @@ -1354,7 +1416,7 @@
   
                                        if (!(0xdc00 <= next && next < 0xe000))
                                        {
  -                                             
throwInvalidUTF16SurrogateException(c, next);
  +                                             
throwInvalidUTF16SurrogateException(c, next, getMemoryManager());
                                        }
   
                                        next = XalanDOMChar(((c - 0xd800) << 
10) + next - 0xdc00 + 0x00010000);
  @@ -1420,7 +1482,7 @@
   
                                if (i + 1 >= end) 
                                {
  -                                     throwInvalidUTF16SurrogateException(c);
  +                    throwInvalidUTF16SurrogateException(c, 
getMemoryManager());
                                }
                                else
                                {
  @@ -1428,7 +1490,7 @@
   
                                        if (!(0xdc00 <= next && next < 0xe000))
                                        {
  -                                             
throwInvalidUTF16SurrogateException(c, next);
  +                        throwInvalidUTF16SurrogateException(c, next, 
getMemoryManager());
                                        }
   
                                        next = XalanDOMChar(((c - 0xd800) << 
10) + next - 0xdc00 + 0x00010000);
  
  
  
  1.7       +32 -8     xml-xalan/c/src/xalanc/XMLSupport/FormatterToXML.hpp
  
  Index: FormatterToXML.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XMLSupport/FormatterToXML.hpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- FormatterToXML.hpp        31 Jul 2004 06:05:06 -0000      1.6
  +++ FormatterToXML.hpp        8 Nov 2004 18:14:35 -0000       1.7
  @@ -85,22 +85,44 @@
         * @param fBufferData           If true, data will be buffered in the 
formatter
         */
        FormatterToXML(
  +            MemoryManagerType&      theManager,
                        Writer&                                 writer,
  -                     const XalanDOMString&   version = XalanDOMString(),
  +                     const XalanDOMString&   version = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
                        bool                                    doIndent = 
false,
                        int                                             indent 
= eDefaultIndentAmount,
  -                     const XalanDOMString&   encoding = XalanDOMString(),
  -                     const XalanDOMString&   mediaType = XalanDOMString(),
  -                     const XalanDOMString&   doctypeSystem = 
XalanDOMString(),
  -                     const XalanDOMString&   doctypePublic = 
XalanDOMString(),
  +                     const XalanDOMString&   encoding = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
  +                     const XalanDOMString&   mediaType = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
  +                     const XalanDOMString&   doctypeSystem = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
  +                     const XalanDOMString&   doctypePublic = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
                        bool                                    xmlDecl = true,
  -                     const XalanDOMString&   standalone = XalanDOMString(),
  +                     const XalanDOMString&   standalone = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
  +                     eFormat                                 format = 
OUTPUT_METHOD_XML,
  +                     bool                                    fBufferData = 
true);
  +    
  +    static FormatterToXML*
  +    create(
  +            MemoryManagerType&      theManager,
  +                     Writer&                                 writer,
  +                     const XalanDOMString&   version = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
  +                     bool                                    doIndent = 
false,
  +                     int                                             indent 
= eDefaultIndentAmount,
  +                     const XalanDOMString&   encoding = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
  +                     const XalanDOMString&   mediaType = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
  +                     const XalanDOMString&   doctypeSystem = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
  +                     const XalanDOMString&   doctypePublic = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
  +                     bool                                    xmlDecl = true,
  +                     const XalanDOMString&   standalone = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
                        eFormat                                 format = 
OUTPUT_METHOD_XML,
                        bool                                    fBufferData = 
true);
   
        virtual
        ~FormatterToXML();
   
  +    MemoryManagerType&
  +    getMemoryManager()
  +    {
  +        return m_stringBuffer.getMemoryManager();
  +    }
   
        // These methods are inherited from FormatterListener ...
   
  @@ -528,7 +550,8 @@
         * @param ch The first character in the surrogate
         */
        static void
  -     throwInvalidUTF16SurrogateException(XalanDOMChar        ch);
  +     throwInvalidUTF16SurrogateException(XalanDOMChar        ch,
  +                                        MemoryManagerType& theManager);
   
        /**
         * Throw an exception when an invalid
  @@ -539,7 +562,8 @@
        static void
        throwInvalidUTF16SurrogateException(
                        XalanDOMChar    ch,
  -                     XalanDOMChar    next);
  +                     XalanDOMChar    next,
  +            MemoryManagerType& theManager);
   
        static bool
        isUTF16Surrogate(XalanDOMChar   ch)
  
  
  
  1.13      +41 -5     
xml-xalan/c/src/xalanc/XMLSupport/FormatterToXML_UTF16.cpp
  
  Index: FormatterToXML_UTF16.cpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/src/xalanc/XMLSupport/FormatterToXML_UTF16.cpp,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- FormatterToXML_UTF16.cpp  2 Nov 2004 05:35:46 -0000       1.12
  +++ FormatterToXML_UTF16.cpp  8 Nov 2004 18:14:35 -0000       1.13
  @@ -22,7 +22,7 @@
   
   #include <xercesc/sax/AttributeList.hpp>
   
  -
  +#include <xalanc/Include/XalanMemMgrAutoPtr.hpp>
   
   #include <xalanc/PlatformSupport/DOMStringHelper.hpp>
   #include <xalanc/PlatformSupport/Writer.hpp>
  @@ -40,6 +40,7 @@
   
   
   FormatterToXML_UTF16::FormatterToXML_UTF16(
  +            MemoryManagerType&      theManager,
                        Writer&                                 writer,
                        const XalanDOMString&   version,
                        const XalanDOMString&   mediaType,
  @@ -48,6 +49,7 @@
                        bool                                    xmlDecl,
                        const XalanDOMString&   standalone) :
        FormatterToXMLBase(
  +        theManager,
                writer,
                version,
                mediaType,
  @@ -73,6 +75,38 @@
   #endif
   }
   
  +FormatterToXML_UTF16*
  +FormatterToXML_UTF16::create(
  +                             MemoryManagerType&         theManager,
  +                             Writer&                                 writer,
  +                             const XalanDOMString&       version ,
  +                             const XalanDOMString&       mediaType ,
  +                             const XalanDOMString&       doctypeSystem ,
  +                             const XalanDOMString&       doctypePublic ,
  +                             bool                                        
xmlDecl ,
  +                             const XalanDOMString&       standalone )
  +{
  +    typedef FormatterToXML_UTF16 ThisType;
  +
  +    XalanMemMgrAutoPtr<ThisType, false> theGuard( theManager , 
(ThisType*)theManager.allocate(sizeof(ThisType)));
  +
  +    ThisType* theResult = theGuard.get();
  +
  +    new (theResult) ThisType(   theManager,
  +                             writer,
  +                             version ,
  +                             mediaType ,
  +                             doctypeSystem ,
  +                             doctypePublic ,
  +                                xmlDecl ,
  +                             standalone );
  +
  +
  +    theGuard.release();
  +
  +    return theResult;
  +}
  +
   
   
   FormatterToXML_UTF16::~FormatterToXML_UTF16()
  @@ -690,7 +724,7 @@
   
   
   
  -static XalanDOMString        s_localUTF16String;
  +static XalanDOMString        
s_localUTF16String(XalanMemMgrs::getDummyMemMgr());
   
   
   
  @@ -699,9 +733,11 @@
   
   
   void
  -FormatterToXML_UTF16::initialize()
  +FormatterToXML_UTF16::initialize(MemoryManagerType& theManager)
   {
  -     s_localUTF16String = XalanTranscodingServices::s_utf16String;
  +    XalanDOMString tmpString(XalanTranscodingServices::s_utf16String, 
theManager);
  +
  +     s_localUTF16String.swap(tmpString);
   }
   
   
  @@ -709,7 +745,7 @@
   void
   FormatterToXML_UTF16::terminate()
   {
  -     XalanDOMString().swap(s_localUTF16String);
  +     XalanDOMString(XalanMemMgrs::getDummyMemMgr()).swap(s_localUTF16String);
   }
   
   
  
  
  
  1.11      +20 -6     
xml-xalan/c/src/xalanc/XMLSupport/FormatterToXML_UTF16.hpp
  
  Index: FormatterToXML_UTF16.hpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/src/xalanc/XMLSupport/FormatterToXML_UTF16.hpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- FormatterToXML_UTF16.hpp  20 Apr 2004 01:19:59 -0000      1.10
  +++ FormatterToXML_UTF16.hpp  8 Nov 2004 18:14:35 -0000       1.11
  @@ -43,12 +43,14 @@
   class XALAN_XMLSUPPORT_EXPORT FormatterToXML_UTF16 : public 
FormatterToXMLBase 
   {
   public:
  +    
  +
   
        /**
         * Perform static initialization.  See class XMLSupportInit.
         */
        static void
  -     initialize();
  +     initialize(MemoryManagerType& theManager);
    
        /**
         * Perform static shut down.  See class XMLSupportInit.
  @@ -72,13 +74,25 @@
         *                          the standalone document declaration
         */
        FormatterToXML_UTF16(
  +            MemoryManagerType&      theManager,
  +                     Writer&                                 writer,
  +                     const XalanDOMString&   version = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
  +                     const XalanDOMString&   mediaType = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
  +                     const XalanDOMString&   doctypeSystem = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
  +                     const XalanDOMString&   doctypePublic = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
  +                     bool                                    xmlDecl = true,
  +                     const XalanDOMString&   standalone = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()));
  +
  +    static FormatterToXML_UTF16*
  +    create(
  +            MemoryManagerType&      theManager,
                        Writer&                                 writer,
  -                     const XalanDOMString&   version = XalanDOMString(),
  -                     const XalanDOMString&   mediaType = XalanDOMString(),
  -                     const XalanDOMString&   doctypeSystem = 
XalanDOMString(),
  -                     const XalanDOMString&   doctypePublic = 
XalanDOMString(),
  +                     const XalanDOMString&   version = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
  +                     const XalanDOMString&   mediaType = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
  +                     const XalanDOMString&   doctypeSystem = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
  +                     const XalanDOMString&   doctypePublic = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
                        bool                                    xmlDecl = true,
  -                     const XalanDOMString&   standalone = XalanDOMString());
  +                     const XalanDOMString&   standalone = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()));
   
        virtual
        ~FormatterToXML_UTF16();
  
  
  
  1.13      +43 -10    xml-xalan/c/src/xalanc/XMLSupport/FormatterToXML_UTF8.cpp
  
  Index: FormatterToXML_UTF8.cpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/src/xalanc/XMLSupport/FormatterToXML_UTF8.cpp,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- FormatterToXML_UTF8.cpp   20 Apr 2004 01:19:59 -0000      1.12
  +++ FormatterToXML_UTF8.cpp   8 Nov 2004 18:14:35 -0000       1.13
  @@ -22,7 +22,7 @@
   
   #include <xercesc/sax/AttributeList.hpp>
   
  -
  +#include <xalanc/Include/XalanMemMgrAutoPtr.hpp>
   
   #include <xalanc/PlatformSupport/DOMStringHelper.hpp>
   #include <xalanc/PlatformSupport/DoubleSupport.hpp>
  @@ -41,6 +41,7 @@
   
   
   FormatterToXML_UTF8::FormatterToXML_UTF8(
  +            MemoryManagerType&      theManager,
                        Writer&                                 writer,
                        const XalanDOMString&   version,
                        const XalanDOMString&   mediaType,
  @@ -49,6 +50,7 @@
                        bool                                    xmlDecl,
                        const XalanDOMString&   standalone) :
        FormatterToXMLBase(
  +        theManager,
                writer,
                version,
                mediaType,
  @@ -62,7 +64,7 @@
        m_bufferRemaining(kBufferSize)
   {
        if (m_version.empty() == true ||
  -             DoubleSupport::equal(DOMStringToDouble(m_version), 1.0) == true)
  +             DoubleSupport::equal(DOMStringToDouble(m_version, theManager), 
1.0) == true)
        {
                m_nameFunction = &FormatterToXML_UTF8::writeName1_0;
        }
  @@ -72,7 +74,36 @@
        }
   }
   
  +FormatterToXML_UTF8*
  +FormatterToXML_UTF8::create(
  +            MemoryManagerType&      theManager,
  +                     Writer&                                 writer,
  +                     const XalanDOMString&   version ,
  +                     const XalanDOMString&   mediaType ,
  +                     const XalanDOMString&   doctypeSystem ,
  +                     const XalanDOMString&   doctypePublic ,
  +                     bool                                    xmlDecl ,
  +                     const XalanDOMString&   standalone )
  +{
  +    typedef FormatterToXML_UTF8 ThisType;
  +
  +    XalanMemMgrAutoPtr<ThisType, false> theGuard( theManager , 
(ThisType*)theManager.allocate(sizeof(ThisType)));
  +
  +    ThisType* theResult = theGuard.get();
  +
  +    new (theResult) ThisType(theManager,
  +                            writer,
  +                            version,
  +                            mediaType, 
  +                            doctypeSystem,
  +                            doctypePublic,
  +                            xmlDecl,
  +                            standalone);
   
  +    theGuard.release();
  +
  +    return theResult;
  +}
   
   FormatterToXML_UTF8::~FormatterToXML_UTF8()
   {
  @@ -250,7 +281,7 @@
        }
        else
        {
  -             throwInvalidCharacterException(theChar);
  +             throwInvalidCharacterException(theChar, getMemoryManager());
        }
   }
   
  @@ -318,7 +349,7 @@
                        const XalanDOMChar      high = *currentChar;
                        const XalanDOMChar      low = *(++currentChar);
   
  -                     write(decodeUTF16SurrogatePair(high, low));
  +                     write(decodeUTF16SurrogatePair(high, low,  
getMemoryManager()));
   
                        ++currentChar;
   
  @@ -732,11 +763,11 @@
        {
                if (start + 1 >= length)
                {
  -                     throwInvalidUTF16SurrogateException(ch);
  +                     throwInvalidUTF16SurrogateException(ch,  
getMemoryManager());
                }
                else 
                {
  -                     write(decodeUTF16SurrogatePair(ch, chars[++start]));
  +                     write(decodeUTF16SurrogatePair(ch, chars[++start],  
getMemoryManager()));
                }
        }
        else
  @@ -960,7 +991,7 @@
   
   
   
  -static XalanDOMString        s_localUTF8String;
  +static XalanDOMString        
s_localUTF8String(XalanMemMgrs::getDummyMemMgr());
   
   
   
  @@ -969,9 +1000,11 @@
   
   
   void
  -FormatterToXML_UTF8::initialize()
  +FormatterToXML_UTF8::initialize(MemoryManagerType& theManager)
   {
  -     s_localUTF8String = XalanTranscodingServices::s_utf8String;
  +    XalanDOMString theTmp(XalanTranscodingServices::s_utf8String, 
theManager);
  +
  +     s_localUTF8String.swap(theTmp);
   }
   
   
  @@ -979,7 +1012,7 @@
   void
   FormatterToXML_UTF8::terminate()
   {
  -     XalanDOMString().swap(s_localUTF8String);
  +     XalanDOMString(XalanMemMgrs::getDummyMemMgr()).swap(s_localUTF8String);
   }
   
   
  
  
  
  1.11      +18 -6     xml-xalan/c/src/xalanc/XMLSupport/FormatterToXML_UTF8.hpp
  
  Index: FormatterToXML_UTF8.hpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/src/xalanc/XMLSupport/FormatterToXML_UTF8.hpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- FormatterToXML_UTF8.hpp   20 Apr 2004 01:19:59 -0000      1.10
  +++ FormatterToXML_UTF8.hpp   8 Nov 2004 18:14:35 -0000       1.11
  @@ -48,7 +48,7 @@
         * Perform static initialization.  See class XMLSupportInit.
         */
        static void
  -     initialize();
  +     initialize(MemoryManagerType& theManager);
    
        /**
         * Perform static shut down.  See class XMLSupportInit.
  @@ -72,13 +72,25 @@
         *                          the standalone document declaration
         */
        FormatterToXML_UTF8(
  +            MemoryManagerType&      theManager,
                        Writer&                                 writer,
  -                     const XalanDOMString&   version = XalanDOMString(),
  -                     const XalanDOMString&   mediaType = XalanDOMString(),
  -                     const XalanDOMString&   doctypeSystem = 
XalanDOMString(),
  -                     const XalanDOMString&   doctypePublic = 
XalanDOMString(),
  +                     const XalanDOMString&   version = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
  +                     const XalanDOMString&   mediaType = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
  +                     const XalanDOMString&   doctypeSystem = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
  +                     const XalanDOMString&   doctypePublic = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
                        bool                                    xmlDecl = true,
  -                     const XalanDOMString&   standalone = XalanDOMString());
  +                     const XalanDOMString&   standalone = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()));
  +
  +    static FormatterToXML_UTF8*
  +    create(
  +            MemoryManagerType&      theManager,
  +                     Writer&                                 writer,
  +                     const XalanDOMString&   version = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
  +                     const XalanDOMString&   mediaType = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
  +                     const XalanDOMString&   doctypeSystem = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
  +                     const XalanDOMString&   doctypePublic = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
  +                     bool                                    xmlDecl = true,
  +                     const XalanDOMString&   standalone = 
XalanDOMString(XalanMemMgrs::getDummyMemMgr()));
   
        virtual
        ~FormatterToXML_UTF8();
  
  
  
  1.12      +35 -19    xml-xalan/c/src/xalanc/XMLSupport/FormatterToXMLBase.cpp
  
  Index: FormatterToXMLBase.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XMLSupport/FormatterToXMLBase.cpp,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- FormatterToXMLBase.cpp    24 Jun 2004 16:32:56 -0000      1.11
  +++ FormatterToXMLBase.cpp    8 Nov 2004 18:14:35 -0000       1.12
  @@ -105,6 +105,7 @@
   
   
   FormatterToXMLBase::FormatterToXMLBase(
  +            MemoryManagerType&      theManager,
                        Writer&                                 writer,
                        const XalanDOMString&   version,
                        const XalanDOMString&   mediaType,
  @@ -116,17 +117,17 @@
        m_writer(&writer),
        m_nextIsRaw(false),
        m_spaceBeforeClose(false),
  -     m_doctypeSystem(doctypeSystem),
  -     m_doctypePublic(doctypePublic),
  -     m_version(version),
  -     m_standalone(standalone),
  -     m_mediaType(mediaType),
  +     m_doctypeSystem(doctypeSystem,theManager),
  +     m_doctypePublic(doctypePublic,theManager),
  +     m_version(version,theManager),
  +     m_standalone(standalone,theManager),
  +     m_mediaType(mediaType, theManager),
        m_newlineString(0),
        m_newlineStringLength(0),
        m_needToOutputDoctypeDecl(false),
       // We must write the XML declaration if standalone is specified
       m_shouldWriteXMLHeader(xmlDecl == true ? true : standalone.length() != 
0),
  -     m_elemStack()
  +     m_elemStack(theManager)
   {
        if(isEmpty(m_doctypePublic) == false)
        {
  @@ -167,13 +168,14 @@
   unsigned int
   FormatterToXMLBase::decodeUTF16SurrogatePair(
                        XalanDOMChar    theHighSurrogate,
  -                     XalanDOMChar    theLowSurrogate)
  +                     XalanDOMChar    theLowSurrogate,
  +            MemoryManagerType& theManager)
   {
        assert(isUTF16HighSurrogate(theHighSurrogate) == true);
   
        if (isUTF16LowSurrogate(theLowSurrogate) == false)
        {
  -             throwInvalidUTF16SurrogateException(theHighSurrogate, 
theLowSurrogate);
  +        throwInvalidUTF16SurrogateException(theHighSurrogate, 
theLowSurrogate, theManager);
        }
   
        return ((theHighSurrogate - 0xD800u) << 10) + theLowSurrogate - 0xDC00u 
+ 0x00010000u;
  @@ -184,33 +186,47 @@
   XALAN_USING_XERCES(SAXException)
   
   void
  -FormatterToXMLBase::throwInvalidUTF16SurrogateException(XalanDOMChar ch)
  +FormatterToXMLBase::throwInvalidUTF16SurrogateException(XalanDOMChar ch,
  +                                                        MemoryManagerType& 
theManager)
   {
  -     const XalanDOMString    theMessage = 
XalanMessageLoader::getMessage(XalanMessages::InvalidUFT16Surrogate_2Param, 
UnsignedLongToHexDOMString(ch));
  +     XalanDOMString  theMessage(theManager);
  +    XalanDOMString   theBuffer(theManager);
   
  -     throw SAXException(c_wstr(theMessage));
  +    
XalanMessageLoader::getMessage(XalanMessages::InvalidUFT16Surrogate_2Param, 
theMessage, UnsignedLongToHexDOMString(ch, theBuffer));
  +
  +     throw SAXException(c_wstr(theMessage), &theManager);
   }
   
   
   
   void
   FormatterToXMLBase::throwInvalidUTF16SurrogateException(
  -                     XalanDOMChar    ch,
  -                     XalanDOMChar    next)
  -{
  -     const XalanDOMString    theMessage = 
XalanMessageLoader::getMessage(XalanMessages::InvalidUFT16Surrogate_2Param, 
UnsignedLongToHexDOMString(ch),UnsignedLongToHexDOMString(next));
  +                     XalanDOMChar        ch,
  +                     XalanDOMChar        next,
  +            MemoryManagerType&  theManager)
  +{
  +    XalanDOMString   theMessage(theManager);
  +    XalanDOMString   theBuffer(theManager);
  +    XalanDOMString   theBuffer2(theManager);
   
  -     throw SAXException(c_wstr(theMessage));
  +     
XalanMessageLoader::getMessage(XalanMessages::InvalidUFT16Surrogate_2Param, 
theMessage, 
  +                    UnsignedLongToHexDOMString(ch, 
theBuffer),UnsignedLongToHexDOMString(next, theBuffer2));
  +
  +     throw SAXException(c_wstr(theMessage), &theManager);
   }
   
   
   
   void
  -FormatterToXMLBase::throwInvalidCharacterException(unsigned int              
ch)
  +FormatterToXMLBase::throwInvalidCharacterException(unsigned int              
ch,
  +                                                   MemoryManagerType& 
theManager)
   {
  -     const XalanDOMString    theMessage = 
XalanMessageLoader::getMessage(XalanMessages::InvalidCharDetected_1Param, 
UnsignedLongToHexDOMString(ch));
  +     XalanDOMString  theMessage(theManager);
  +    XalanDOMString   theBuffer(theManager);  
  +
  +    
XalanMessageLoader::getMessage(XalanMessages::InvalidCharDetected_1Param, 
theMessage, UnsignedLongToHexDOMString(ch, theBuffer));
   
  -     throw SAXException(c_wstr(theMessage));
  +     throw SAXException(c_wstr(theMessage),&theManager);
   }
   
   
  
  
  
  1.6       +14 -4     xml-xalan/c/src/xalanc/XMLSupport/FormatterToXMLBase.hpp
  
  Index: FormatterToXMLBase.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XMLSupport/FormatterToXMLBase.hpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FormatterToXMLBase.hpp    31 Jul 2004 06:05:06 -0000      1.5
  +++ FormatterToXMLBase.hpp    8 Nov 2004 18:14:35 -0000       1.6
  @@ -68,6 +68,7 @@
         *                          the standalone document declaration
         */
        FormatterToXMLBase(
  +            MemoryManagerType&      theManager,
                        Writer&                                 writer,
                        const XalanDOMString&   version,
                        const XalanDOMString&   mediaType,
  @@ -79,6 +80,11 @@
        virtual
        ~FormatterToXMLBase();
   
  +    MemoryManagerType&
  +    getMemoryManager()
  +    {
  +        return m_elemStack.getMemoryManager();
  +    }
        // These methods are inherited from FormatterListener ...
   
        virtual void
  @@ -343,7 +349,8 @@
        static unsigned int
        decodeUTF16SurrogatePair(
                        XalanDOMChar    theHighSurrogate,
  -                     XalanDOMChar    theLowSurrogate);
  +                     XalanDOMChar    theLowSurrogate,
  +            MemoryManagerType& theManager);
   
        /**
         * Throw an exception when an invalid
  @@ -351,7 +358,8 @@
         * @param ch The first character in the surrogate
         */
        static void
  -     throwInvalidUTF16SurrogateException(XalanDOMChar        ch);
  +     throwInvalidUTF16SurrogateException(XalanDOMChar        ch,
  +                                        MemoryManagerType& theManager);
   
        /**
         * Throw an exception when an invalid
  @@ -362,7 +370,8 @@
        static void
        throwInvalidUTF16SurrogateException(
                        XalanDOMChar    ch,
  -                     XalanDOMChar    next);
  +                     XalanDOMChar    next,
  +            MemoryManagerType& theManager);
   
        /**
         * Throw an exception when an invalid
  @@ -371,7 +380,8 @@
         * @param next The next character in the surrogate
         */
        static void
  -     throwInvalidCharacterException(unsigned int             ch);
  +     throwInvalidCharacterException(unsigned int             ch,
  +                                    MemoryManagerType& theManager);
   
        enum
        {
  
  
  
  1.4       +5 -3      xml-xalan/c/src/xalanc/XMLSupport/FormatterTreeWalker.cpp
  
  Index: FormatterTreeWalker.cpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/src/xalanc/XMLSupport/FormatterTreeWalker.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- FormatterTreeWalker.cpp   26 Feb 2004 22:37:44 -0000      1.3
  +++ FormatterTreeWalker.cpp   8 Nov 2004 18:14:35 -0000       1.4
  @@ -35,9 +35,11 @@
   
   
   
  -FormatterTreeWalker::FormatterTreeWalker(FormatterListener&  
formatterListener) :
  +FormatterTreeWalker::FormatterTreeWalker(FormatterListener&  
formatterListener,
  +                                         MemoryManagerType& theManager) :
        TreeWalker(),
  -     m_formatterListener(formatterListener)
  +     m_formatterListener(formatterListener),
  +    m_memoryManager(theManager)
   {
   }
   
  @@ -82,7 +84,7 @@
                        const XalanNamedNodeMap*        atts = 
theElementNode->getAttributes();
                        assert(atts != 0);
   
  -                     NamedNodeMapAttributeList       theAttributeList(*atts);
  +            NamedNodeMapAttributeList        theAttributeList(*atts, 
m_memoryManager);
   
                        
m_formatterListener.startElement(c_wstr(theElementNode->getNodeName()),
                                                                                
         theAttributeList);
  
  
  
  1.4       +5 -2      xml-xalan/c/src/xalanc/XMLSupport/FormatterTreeWalker.hpp
  
  Index: FormatterTreeWalker.hpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/src/xalanc/XMLSupport/FormatterTreeWalker.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- FormatterTreeWalker.hpp   26 Feb 2004 22:37:44 -0000      1.3
  +++ FormatterTreeWalker.hpp   8 Nov 2004 18:14:35 -0000       1.4
  @@ -21,7 +21,7 @@
   // Base include file.  Must be first.
   #include <xalanc/XMLSupport/XMLSupportDefinitions.hpp>
   
  -
  +#include <xalanc/Include/XalanMemoryManagement.hpp>
   
   #include <xalanc/DOMSupport/TreeWalker.hpp>
   
  @@ -45,7 +45,8 @@
         * @param formatterListener implemention of the FormatterListener 
operation
         *                          (toXMLString, digest, ...)
         */
  -     FormatterTreeWalker(FormatterListener&  formatterListener);
  +     FormatterTreeWalker(FormatterListener&  formatterListener,
  +                        MemoryManagerType& theManager);
   
        virtual
        ~FormatterTreeWalker();
  @@ -67,6 +68,8 @@
   private:
   
        FormatterListener&      m_formatterListener;
  +
  +    MemoryManagerType&  m_memoryManager;
   };
   
   
  
  
  
  1.6       +8 -4      xml-xalan/c/src/xalanc/XMLSupport/XMLParserLiaison.hpp
  
  Index: XMLParserLiaison.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XMLSupport/XMLParserLiaison.hpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XMLParserLiaison.hpp      12 Mar 2004 22:50:45 -0000      1.5
  +++ XMLParserLiaison.hpp      8 Nov 2004 18:14:35 -0000       1.6
  @@ -53,6 +53,7 @@
   
   class XALAN_XMLSUPPORT_EXPORT XMLParserLiaison
   {
  +    
   public:
   
        XMLParserLiaison();
  @@ -70,6 +71,9 @@
        virtual ExecutionContext*
        getExecutionContext() const = 0;
   
  +    virtual MemoryManagerType&
  +    getMemoryManager() = 0;
  +
        virtual void
        setExecutionContext(ExecutionContext&   theContext) = 0;
   
  @@ -92,7 +96,7 @@
        virtual XalanDocument*
        parseXMLStream(
                        const InputSourceType&  inputSource,
  -                     const XalanDOMString&   identifier = XalanDOMString()) 
= 0;
  +                     const XalanDOMString&   identifier) = 0;
   
        /**
         * Parse the text pointed at by the reader as XML. It is recommended 
that
  @@ -109,7 +113,7 @@
        parseXMLStream(
                        const InputSourceType&  inputSource,
                        DocumentHandlerType&    handler,
  -                     const XalanDOMString&   identifier = XalanDOMString()) 
= 0;
  +                     const XalanDOMString&   identifier) = 0;
   
        /**
         * Destroy the supplied XalanDocument instance.  It must be an instance 
that
  @@ -163,8 +167,8 @@
         *
         * @return string describing parser
         */
  -     virtual const XalanDOMString
  -     getParserDescription() const = 0;
  +     virtual const XalanDOMString&
  +     getParserDescription(XalanDOMString& theResult) const = 0;
   
        /**
          * This method returns the installed entity resolver.
  
  
  
  1.5       +3 -2      xml-xalan/c/src/xalanc/XMLSupport/XMLSupportException.cpp
  
  Index: XMLSupportException.cpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/src/xalanc/XMLSupport/XMLSupportException.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XMLSupportException.cpp   26 Feb 2004 22:37:44 -0000      1.4
  +++ XMLSupportException.cpp   8 Nov 2004 18:14:35 -0000       1.5
  @@ -23,8 +23,9 @@
   
   
   
  -XMLSupportException::XMLSupportException(const XalanDOMString&       
message) :
  -     XSLException(message)
  +XMLSupportException::XMLSupportException(const XalanDOMString&       message,
  +                                         MemoryManagerType& theManager) :
  +     XSLException(message, theManager)
   {
   }
   
  
  
  
  1.5       +3 -1      xml-xalan/c/src/xalanc/XMLSupport/XMLSupportException.hpp
  
  Index: XMLSupportException.hpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/src/xalanc/XMLSupport/XMLSupportException.hpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XMLSupportException.hpp   26 Feb 2004 22:37:44 -0000      1.4
  +++ XMLSupportException.hpp   8 Nov 2004 18:14:35 -0000       1.5
  @@ -46,7 +46,9 @@
         * @param theMessage message to print when exception thrown
         */
        explicit
  -     XMLSupportException(const XalanDOMString&       message);
  +     XMLSupportException(const XalanDOMString&       message,
  +                        MemoryManagerType& theManager);
  +
   
        virtual
        ~XMLSupportException();
  
  
  
  1.6       +7 -7      xml-xalan/c/src/xalanc/XMLSupport/XMLSupportInit.cpp
  
  Index: XMLSupportInit.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XMLSupport/XMLSupportInit.cpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XMLSupportInit.cpp        26 Feb 2004 22:37:44 -0000      1.5
  +++ XMLSupportInit.cpp        8 Nov 2004 18:14:35 -0000       1.6
  @@ -31,15 +31,15 @@
   
   
   
  -XMLSupportInit::XMLSupportInit() :
  -     m_platformSupportInit(),
  -     m_domSupportInit()
  +XMLSupportInit::XMLSupportInit(MemoryManagerType& theManager) :
  +     m_platformSupportInit(theManager),
  +     m_domSupportInit(theManager)
   {
        ++s_initCounter;
   
        if (s_initCounter == 1)
        {
  -             initialize();
  +             initialize(theManager);
        }
   }
   
  @@ -58,10 +58,10 @@
   
   
   void
  -XMLSupportInit::initialize()
  +XMLSupportInit::initialize(MemoryManagerType& theManager)
   {
  -     FormatterToXML_UTF8::initialize();
  -     FormatterToXML_UTF16::initialize();
  +     FormatterToXML_UTF8::initialize(theManager);
  +     FormatterToXML_UTF16::initialize(theManager);
   }
   
   
  
  
  
  1.5       +2 -2      xml-xalan/c/src/xalanc/XMLSupport/XMLSupportInit.hpp
  
  Index: XMLSupportInit.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XMLSupport/XMLSupportInit.hpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XMLSupportInit.hpp        26 Feb 2004 22:37:44 -0000      1.4
  +++ XMLSupportInit.hpp        8 Nov 2004 18:14:35 -0000       1.5
  @@ -41,7 +41,7 @@
   public:
   
        explicit
  -     XMLSupportInit();
  +     XMLSupportInit(MemoryManagerType& theManager);
   
        ~XMLSupportInit();
   
  @@ -55,7 +55,7 @@
   
        
        static void
  -     initialize();
  +     initialize(MemoryManagerType& theManager);
   
        static void
        terminate();
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to