dbertoni    2002/11/04 21:19:26

  Modified:    c/src/XSLT ElemApplyTemplates.cpp ElemApplyTemplates.hpp
                        ElemEmpty.cpp ElemExtensionCall.cpp
                        ElemExtensionCall.hpp ElemForEach.cpp
                        ElemForEach.hpp ElemTemplateElement.cpp
                        ElemTemplateElement.hpp ElemTextLiteral.cpp
                        Stylesheet.cpp Stylesheet.hpp
                        StylesheetConstructionContext.hpp
                        StylesheetConstructionContextDefault.cpp
                        StylesheetConstructionContextDefault.hpp
                        StylesheetHandler.cpp StylesheetHandler.hpp
                        StylesheetRoot.cpp StylesheetRoot.hpp
                        XalanElemEmptyAllocator.hpp
                        XalanElemTextAllocator.hpp
  Added:       c/src/XSLT XalanElemLiteralResultAllocator.cpp
                        XalanElemLiteralResultAllocator.hpp
                        XalanElemTemplateAllocator.cpp
                        XalanElemTemplateAllocator.hpp
                        XalanElemTextLiteralAllocator.cpp
                        XalanElemTextLiteralAllocator.hpp
                        XalanElemValueOfAllocator.cpp
                        XalanElemValueOfAllocator.hpp
                        XalanElemVariableAllocator.cpp
                        XalanElemVariableAllocator.hpp
  Log:
  Major re-working of stylesheet creation code, including initial block 
allocation of some stylesheet elements.
  
  Revision  Changes    Path
  1.27      +16 -5     xml-xalan/c/src/XSLT/ElemApplyTemplates.cpp
  
  Index: ElemApplyTemplates.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemApplyTemplates.cpp,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- ElemApplyTemplates.cpp    3 Nov 2002 03:41:05 -0000       1.26
  +++ ElemApplyTemplates.cpp    5 Nov 2002 05:19:24 -0000       1.27
  @@ -85,11 +85,12 @@
                        const AttributeList&                    atts,
                        int                                                     
        lineNumber,
                        int                                                     
        columnNumber) :
  -     ElemForEach(constructionContext,
  -                             stylesheetTree,
  -                             lineNumber,
  -                             columnNumber,
  -                             
StylesheetConstructionContext::ELEMNAME_APPLY_TEMPLATES),
  +     ParentType(
  +             constructionContext,
  +             stylesheetTree,
  +             lineNumber,
  +             columnNumber,
  +             StylesheetConstructionContext::ELEMNAME_APPLY_TEMPLATES),
        m_isDefaultTemplate(false),
        m_mode(0)
   {
  @@ -151,6 +152,16 @@
   ElemApplyTemplates::getElementName() const
   {
        return Constants::ELEMNAME_APPLY_TEMPLATES_WITH_PREFIX_STRING;
  +}
  +
  +
  +
  +void
  +ElemApplyTemplates::setDefaultTemplate(bool          value)
  +{
  +     m_isDefaultTemplate = value;
  +
  +     ParentType::setDefaultTemplate(value);
   }
   
   
  
  
  
  1.13      +5 -11     xml-xalan/c/src/XSLT/ElemApplyTemplates.hpp
  
  Index: ElemApplyTemplates.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemApplyTemplates.hpp,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ElemApplyTemplates.hpp    3 Nov 2002 03:41:05 -0000       1.12
  +++ ElemApplyTemplates.hpp    5 Nov 2002 05:19:24 -0000       1.13
  @@ -83,6 +83,8 @@
   {
   public:
   
  +     typedef ElemForEach             ParentType;
  +
        /**
         * Construct an object corresponding to an "xsl:apply-template" element
         * 
  @@ -113,16 +115,8 @@
                return m_isDefaultTemplate;
        }
   
  -     /**
  -      * Sets a flag indicating this is the default template
  -      *
  -      * @param def value of flag to set
  -      */
  -     void
  -     setDefaultTemplate(bool def)
  -     {
  -             m_isDefaultTemplate = def;
  -     }
  +     virtual void
  +     setDefaultTemplate(bool         value);
   
        // These methods are inherited from ElemTemplateElement ...
        
  
  
  
  1.13      +4 -4      xml-xalan/c/src/XSLT/ElemEmpty.cpp
  
  Index: ElemEmpty.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemEmpty.cpp,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ElemEmpty.cpp     3 Nov 2002 05:52:25 -0000       1.12
  +++ ElemEmpty.cpp     5 Nov 2002 05:19:24 -0000       1.13
  @@ -83,12 +83,12 @@
   
   
   ElemEmpty::ElemEmpty(
  -                     StylesheetConstructionContext&  constructionContext,
  +                     StylesheetConstructionContext&  /* constructionContext 
*/,
                        Stylesheet&                                             
stylesheetTree,
                        const XalanDOMString*                   elementName) :
  -     ElemTemplateElement(constructionContext,
  -                                             stylesheetTree,
  -                                             
StylesheetConstructionContext::ELEMNAME_UNDEFINED),
  +     ElemTemplateElement(
  +                     stylesheetTree,
  +                     StylesheetConstructionContext::ELEMNAME_UNDEFINED),
        m_elementName(elementName)
   {
   }
  
  
  
  1.14      +6 -14     xml-xalan/c/src/XSLT/ElemExtensionCall.cpp
  
  Index: ElemExtensionCall.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemExtensionCall.cpp,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ElemExtensionCall.cpp     3 Nov 2002 03:41:05 -0000       1.13
  +++ ElemExtensionCall.cpp     5 Nov 2002 05:19:24 -0000       1.14
  @@ -59,6 +59,7 @@
   
   
   #include "Constants.hpp"
  +#include "Stylesheet.hpp"
   #include "StylesheetConstructionContext.hpp"
   #include "StylesheetExecutionContext.hpp"
   
  @@ -71,8 +72,7 @@
                        const AttributeList&                    atts,
                        int                                                     
        lineNumber,
                        int                                                     
        columnNumber,
  -                     ExtensionNSHandler&                             ns,
  -                     const XalanDOMString&                   localpart) :
  +                     ExtensionNSHandler&                             ns) :
        ElemLiteralResult(constructionContext,
                                          stylesheetTree,
                                          name,
  @@ -80,18 +80,10 @@
                                          lineNumber,
                                          columnNumber,
                                          
StylesheetConstructionContext::ELEMNAME_EXTENSION_CALL),
  -     m_name(constructionContext.getPooledString(name)),
  -     m_nsh(ns),
  -     m_localPart(constructionContext.getPooledString(localpart))     
  +     m_qname(constructionContext.createXalanQName(name, 
getStylesheet().getNamespaces(), getLocator())),
  +     m_nsh(ns)
   {
  -}
  -
  -
  -
  -const XalanDOMString&
  -ElemExtensionCall::getElementName() const
  -{
  -     return m_name;
  +     assert(m_qname != 0);
   }
   
   
  @@ -118,5 +110,5 @@
   bool
   ElemExtensionCall::elementAvailable(StylesheetExecutionContext&              
executionContext) const
   {
  -     return executionContext.elementAvailable(XalanDOMString(), m_localPart);
  +     return executionContext.elementAvailable(m_qname->getNamespace(), 
m_qname->getLocalPart());
   }
  
  
  
  1.12      +4 -10     xml-xalan/c/src/XSLT/ElemExtensionCall.hpp
  
  Index: ElemExtensionCall.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemExtensionCall.hpp,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ElemExtensionCall.hpp     21 Sep 2002 01:24:41 -0000      1.11
  +++ ElemExtensionCall.hpp     5 Nov 2002 05:19:24 -0000       1.12
  @@ -70,6 +70,7 @@
   
   
   class ExtensionNSHandler;
  +class XalanQName;
   
   
   
  @@ -87,7 +88,6 @@
         * @param lineNumber                            line number in document
         * @param columnNumber                  column number in document
         * @param ns                  handler for the extension
  -      * @param localPart                        element name's local part
         */
        ElemExtensionCall(
                        StylesheetConstructionContext&  constructionContext,
  @@ -96,14 +96,10 @@
                        const AttributeList&                    atts,
                        int                                                     
        lineNumber,
                        int                                                     
        columnNumber,
  -                     ExtensionNSHandler&                             ns,
  -                     const XalanDOMString&                   localpart);
  +                     ExtensionNSHandler&                             ns);
        
        // These methods are inherited from ElemLiteralResult ...
   
  -     virtual const XalanDOMString&
  -     getElementName() const;
  -
        virtual void
        execute(StylesheetExecutionContext&             executionContext) const;
   
  @@ -112,11 +108,9 @@
   
   private:
   
  -     const XalanDOMString&   m_name;
  -
  -     ExtensionNSHandler&             m_nsh;
  +     const XalanQName* const         m_qname;
   
  -     const XalanDOMString&   m_localPart;
  +     ExtensionNSHandler&                     m_nsh;
   };
   
   
  
  
  
  1.29      +24 -0     xml-xalan/c/src/XSLT/ElemForEach.cpp
  
  Index: ElemForEach.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemForEach.cpp,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- ElemForEach.cpp   3 Nov 2002 03:41:05 -0000       1.28
  +++ ElemForEach.cpp   5 Nov 2002 05:19:24 -0000       1.29
  @@ -165,6 +165,30 @@
   
   
   
  +void
  +ElemForEach::processSortElement(
  +                     StylesheetConstructionContext&  constructionContext,
  +                     Stylesheet&                                             
theStylesheet,
  +                     const AttributeList&                    atts,
  +                     const Locator*                                  locator)
  +{
  +     const int       lineNumber = locator != 0 ? locator->getLineNumber() : 
-1;
  +     const int       columnNumber = locator != 0 ? 
locator->getColumnNumber() : -1;
  +
  +     m_sortElems.reserve(m_sortElems.size() + 1);
  +
  +     ElemSort* sortElem = new ElemSort(
  +             constructionContext,
  +             theStylesheet,
  +             atts,
  +             lineNumber,
  +             columnNumber);
  +
  +     m_sortElems.push_back(sortElem);
  +}
  +
  +
  +
   const XalanDOMString&
   ElemForEach::getElementName() const
   {
  
  
  
  1.15      +7 -18     xml-xalan/c/src/XSLT/ElemForEach.hpp
  
  Index: ElemForEach.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemForEach.hpp,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ElemForEach.hpp   10 Jul 2002 05:09:48 -0000      1.14
  +++ ElemForEach.hpp   5 Nov 2002 05:19:24 -0000       1.15
  @@ -118,28 +118,17 @@
   #endif
   
   
  -     const SortElemsVectorType&
  -     getSortElems() const
  -     {
  -             return m_sortElems;
  -     }
  -
  -     SortElemsVectorType&
  -     getSortElems()
  -     {
  -             return m_sortElems;
  -     }
  -
  -     const XPath*
  -     getSelectExpression() const
  -     {
  -             return m_selectPattern;
  -     }
  -
        // These methods are inherited from ElemTemplateElement ...
   
        virtual const XalanDOMString&
        getElementName() const;
  +
  +     virtual void
  +     processSortElement(
  +                     StylesheetConstructionContext&  constructionContext,
  +                     Stylesheet&                                             
theStylesheet,
  +                     const AttributeList&                    atts,
  +                     const Locator*                                  locator 
= 0);
   
        virtual void
        postConstruction(
  
  
  
  1.83      +31 -10    xml-xalan/c/src/XSLT/ElemTemplateElement.cpp
  
  Index: ElemTemplateElement.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemTemplateElement.cpp,v
  retrieving revision 1.82
  retrieving revision 1.83
  diff -u -r1.82 -r1.83
  --- ElemTemplateElement.cpp   3 Nov 2002 03:41:05 -0000       1.82
  +++ ElemTemplateElement.cpp   5 Nov 2002 05:19:24 -0000       1.83
  @@ -150,16 +150,17 @@
   
   
   ElemTemplateElement::ElemTemplateElement(
  -                     StylesheetConstructionContext&  /* constructionContext 
*/,
                        Stylesheet&                                             
stylesheetTree,
  +                     int                                                     
        lineNumber,
  +                     int                                                     
        columnNumber,
                        int                                                     
        xslToken) :
        XalanElement(),
        PrefixResolver(),
        m_finishedConstruction(false),
        m_namespacesHandler(),
        m_stylesheet(stylesheetTree),
  -     m_lineNumber(-1),
  -     m_columnNumber(-1),
  +     m_lineNumber(lineNumber),
  +     m_columnNumber(columnNumber),
        m_defaultSpace(true),
        m_xslToken(xslToken),
        m_parentNode(0),
  @@ -177,12 +178,6 @@
   
   ElemTemplateElement::~ElemTemplateElement()
   {
  -     delete m_nextSibling;
  -
  -     if (hasDirectTemplate() == false)
  -     {
  -             delete m_firstChild;
  -     }
   }
   
   
  @@ -346,6 +341,32 @@
   
   
   
  +void
  +ElemTemplateElement::processSortElement(
  +                     StylesheetConstructionContext&  constructionContext,
  +                     Stylesheet&                                             
/* theStylesheet */,
  +                     const AttributeList&                    /* atts */,
  +                     const Locator*                                  locator)
  +{
  +     constructionContext.error(
  +             "xsl:sort is not allowed at this position in the stylesheet",
  +             0,
  +             locator);
  +}
  +
  +
  +
  +void
  +ElemTemplateElement::setDefaultTemplate(bool value)
  +{
  +     for (ElemTemplateElement* node = m_firstChild; node != 0; node = 
node->m_nextSibling) 
  +     {
  +             node->setDefaultTemplate(value);
  +     }
  +}
  +
  +
  +
   XalanDOMString&
   ElemTemplateElement::doChildrenToString(
                        StylesheetExecutionContext&             
executionContext, 
  @@ -1116,7 +1137,7 @@
   
                                m_directTemplate = 
theCallTemplateChild->getTemplate();
   
  -                             delete theCallTemplateChild;
  +//                           delete theCallTemplateChild;
                        }
                }
                else if (canGenerateAttributes() == false &&
  
  
  
  1.50      +32 -3     xml-xalan/c/src/XSLT/ElemTemplateElement.hpp
  
  Index: ElemTemplateElement.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemTemplateElement.hpp,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- ElemTemplateElement.hpp   3 Nov 2002 03:41:05 -0000       1.49
  +++ ElemTemplateElement.hpp   5 Nov 2002 05:19:25 -0000       1.50
  @@ -127,14 +127,17 @@
         * Special constructor used by dummy elements which do not exist in the
         * final stylesheet.
         * 
  -      * @param constructionContext  The current construction context
         * @param stylesheetTree           owning stylesheet
  +      * @param lineNumber               line in the XSLT file where the 
element occurs
  +      * @param columnNumber             column index in the XSLT file where 
the
  +      *                                                         element 
occurs
         * @param xslToken                         an integer representing the 
type of instance.
         */
        ElemTemplateElement(
  -                     StylesheetConstructionContext&  constructionContext,
                        Stylesheet&                                     
stylesheetTree,
  -                     int                                                     
xslToken);
  +                     int                                                     
xslToken,
  +                     int                                                     
lineNumber = -1,
  +                     int                                                     
columnNumber = -1);
   
        virtual
        ~ElemTemplateElement();
  @@ -346,6 +349,32 @@
        addToStylesheet(
                        StylesheetConstructionContext&  constructionContext,
                        Stylesheet&                                             
theStylesheet);
  +
  +     /** 
  +      * Called during compilation to process xsl:sort elements in
  +      * the stylesheet.
  +      * 
  +      * @param constructionContext  The current construction context
  +      * @param theStylesheet The owning stylesheet
  +      * @param atts The list of attributes for the sort element
  +      * @param locator A Locator instance for error reporting, if available.
  +      *
  +      * @return nothing
  +      */
  +     virtual void
  +     processSortElement(
  +                     StylesheetConstructionContext&  constructionContext,
  +                     Stylesheet&                                             
theStylesheet,
  +                     const AttributeList&                    atts,
  +                     const Locator*                                  locator 
= 0);
  +
  +     /**
  +      * Sets a flag indicating this is the default template
  +      *
  +      * @param value The value of flag.
  +      */
  +     virtual void
  +     setDefaultTemplate(bool         value);
   
   #if defined(XALAN_NO_NAMESPACES)
        typedef map<XalanDOMString,
  
  
  
  1.20      +5 -5      xml-xalan/c/src/XSLT/ElemTextLiteral.cpp
  
  Index: ElemTextLiteral.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemTextLiteral.cpp,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- ElemTextLiteral.cpp       31 Oct 2002 07:15:56 -0000      1.19
  +++ ElemTextLiteral.cpp       5 Nov 2002 05:19:25 -0000       1.20
  @@ -83,11 +83,11 @@
               bool                                                     isCData,
                        bool                                                    
preserveSpace,
               bool                                                     
disableOutputEscaping) :
  -     ElemTemplateElement(constructionContext,
  -                                             stylesheetTree,
  -                                             lineNumber,
  -                                             columnNumber,
  -                                             
StylesheetConstructionContext::ELEMNAME_TEXT_LITERAL_RESULT),
  +     ElemTemplateElement(
  +             stylesheetTree,
  +             lineNumber,
  +             columnNumber,
  +             StylesheetConstructionContext::ELEMNAME_TEXT_LITERAL_RESULT),
        m_isCData(isCData),
        m_preserveSpace(preserveSpace), 
        m_disableOutputEscaping(disableOutputEscaping),
  
  
  
  1.85      +72 -30    xml-xalan/c/src/XSLT/Stylesheet.cpp
  
  Index: Stylesheet.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/Stylesheet.cpp,v
  retrieving revision 1.84
  retrieving revision 1.85
  diff -u -r1.84 -r1.85
  --- Stylesheet.cpp    3 Nov 2002 03:41:05 -0000       1.84
  +++ Stylesheet.cpp    5 Nov 2002 05:19:25 -0000       1.85
  @@ -133,7 +133,6 @@
        m_namespaces(),
        m_namespaceDecls(),
        m_isWrapperless(false),
  -     m_wrapperlessTemplate(0),
        m_extensionNamespaces(),
        m_firstTemplate(0),
        m_includeStack(),
  @@ -201,16 +200,6 @@
                         m_imports.end(),
                         DeleteFunctor<Stylesheet>());
   
  -     // Clean up the atribute sets vector
  -     for_each(m_attributeSets.begin(),
  -                      m_attributeSets.end(),
  -                      DeleteFunctor<ElemAttributeSet>());
  -
  -     // Clean up the top-level variables vector
  -     for_each(m_topLevelVariables.begin(),
  -                      m_topLevelVariables.end(),
  -                      DeleteFunctor<ElemVariable>());
  -
        // Clean up the decimal formats vector
        for_each(m_elemDecimalFormats.begin(),
                         m_elemDecimalFormats.end(),
  @@ -220,10 +209,46 @@
        for_each(m_extensionNamespaces.begin(),
                         m_extensionNamespaces.end(),
                         MapValueDeleteFunctor<ExtensionNamespacesMapType>());
  +}
  +
  +
  +
  +ElemTemplateElement*
  +Stylesheet::initWrapperless(
  +                     StylesheetConstructionContext&  constructionContext,
  +                     const Locator*                                  locator)
  +{
  +     if (m_isWrapperless == true)
  +     {
  +             constructionContext.error(
  +                     "The stylesheet already has a wrapperless template",
  +                     0,
  +                     locator);
  +     }
  +
  +     assert(m_firstTemplate == 0);
  +
  +     m_isWrapperless = true;
  +
  +
  +     AttributeListImpl       templateAttrs;
  +
  +     templateAttrs.addAttribute(c_wstr(Constants::ATTRNAME_NAME),
  +                                                        
c_wstr(Constants::ATTRTYPE_CDATA),
  +                                                        
c_wstr(Constants::ATTRVAL_SIMPLE));
  +
  +     ElemTemplateElement* const      theNewTemplate =
  +             constructionContext.createElement(
  +                     StylesheetConstructionContext::ELEMNAME_TEMPLATE,
  +                     *this,
  +                     templateAttrs,
  +                     locator);
  +
  +     theNewTemplate->addToStylesheet(constructionContext, *this);
   
  -     delete m_wrapperlessTemplate;
  +     assert(m_firstTemplate == theNewTemplate);
   
  -     delete m_firstTemplate;
  +     return theNewTemplate;
   }
   
   
  @@ -494,15 +519,6 @@
                }
        }
   
  -     {
  -             for (ElemTemplateElement* node = m_wrapperlessTemplate;
  -                      node != 0;
  -                      node = node->getNextSiblingElem())
  -             {
  -                     node->postConstruction(constructionContext, 
m_namespacesHandler);
  -             }
  -     }
  -
        // Cache the size...
        m_attributeSetsSize = m_attributeSets.size();
   
  @@ -619,7 +635,7 @@
   
        if (m_isWrapperless == true)
        {
  -             if (m_wrapperlessTemplate != 0)
  +             if (m_firstTemplate != 0)
                {
                        constructionContext.error(
                                "The stylesheet already has a wrapperless 
template",
  @@ -628,7 +644,7 @@
                }
                else
                {
  -                     m_wrapperlessTemplate = theTemplate;
  +                     m_firstTemplate = theTemplate;
                }
        }
        else if(0 == m_firstTemplate)
  @@ -995,7 +1011,7 @@
   
        if(m_isWrapperless == true)
        {
  -             return m_wrapperlessTemplate;
  +             return m_firstTemplate;
        }
        else if (onlyUseImports == true)
        {
  @@ -1243,12 +1259,15 @@
   
   
   void
  -Stylesheet::addExtensionNamespace(
  +Stylesheet::processExtensionNamespace(
                        StylesheetConstructionContext&  theConstructionContext,
  -                     const XalanDOMString&                   uri,
  -                     ExtensionNSHandler*                             nsh)
  +                     const XalanDOMString&                   uri)
   {
  -     
m_extensionNamespaces.insert(ExtensionNamespacesMapType::value_type(uri, nsh));
  +     XalanAutoPtr<ExtensionNSHandler>        theGuard(new 
ExtensionNSHandler(uri));
  +
  +     
m_extensionNamespaces.insert(ExtensionNamespacesMapType::value_type(uri, 
theGuard.get()));
  +
  +     theGuard.release();
   
        m_namespacesHandler.addExtensionNamespaceURI(theConstructionContext, 
uri);
   }
  @@ -1395,6 +1414,29 @@
   
   
   
  +
  +void
  +Stylesheet::processDecimalFormatElement(
  +                     StylesheetConstructionContext&  constructionContext,
  +                     const AttributeList&                    atts,
  +                     const Locator*                                  locator)
  +{
  +     const int       lineNumber = locator != 0 ? locator->getLineNumber() : 
-1;
  +     const int       columnNumber = locator != 0 ? 
locator->getColumnNumber() : -1;
  +
  +     m_elemDecimalFormats.reserve(m_elemDecimalFormats.size() + 1);
  +
  +     m_elemDecimalFormats.push_back(
  +                                     new ElemDecimalFormat(
  +                                                     constructionContext,
  +                                                     *this,
  +                                                     atts,
  +                                                     lineNumber,
  +                                                     columnNumber));
  +}
  +
  +
  +
   const XalanDecimalFormatSymbols*
   Stylesheet::getDecimalFormatSymbols(const XalanQName&        theQName) const
   {
  @@ -1822,7 +1864,7 @@
   XalanElement*
   Stylesheet::getDocumentElement() const
   {
  -     return m_wrapperlessTemplate != 0 ? m_wrapperlessTemplate : 
m_firstTemplate;
  +     return m_firstTemplate;
   }
   
   
  
  
  
  1.53      +15 -40    xml-xalan/c/src/XSLT/Stylesheet.hpp
  
  Index: Stylesheet.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/Stylesheet.hpp,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- Stylesheet.hpp    3 Nov 2002 03:41:05 -0000       1.52
  +++ Stylesheet.hpp    5 Nov 2002 05:19:25 -0000       1.53
  @@ -104,6 +104,7 @@
   class ElemTemplateElement;
   class ElemVariable;
   class KeyTable;
  +class Locator;
   class NodeRefListBase;
   class PrefixResolver;
   class StylesheetConstructionContext;
  @@ -490,12 +491,10 @@
         * @param elemDecimalFormat   the element
         */
        void
  -     processDecimalFormatElement(ElemDecimalFormat*  elemDecimalFormat)
  -     {
  -             assert(elemDecimalFormat != 0);
  -
  -             m_elemDecimalFormats.push_back(elemDecimalFormat);
  -     }
  +     processDecimalFormatElement(
  +                     StylesheetConstructionContext&  constructionContext,
  +                     const AttributeList&                    atts,
  +                     const Locator*                                  locator 
= 0);
   
        /**
         * Retrieve the XalanDecimalFormatSymbols instance associated with
  @@ -551,17 +550,6 @@
        }
   
        /**
  -      * Retrieve the manufactured template to use if there is no wrapper.
  -      * 
  -      * @return pointer to template
  -      */
  -     const ElemTemplate*
  -     getWrapperlessTemplate()
  -     {
  -             return m_wrapperlessTemplate;
  -     }
  -
  -     /**
         * whether there is a wrapper template
         * 
         * @return true is there is a wrapper
  @@ -572,16 +560,10 @@
                return m_isWrapperless;
        }
   
  -     /**
  -      * Set whether there is a wrapper template
  -      * 
  -      * @param b true is there is a wrapper
  -      */
  -     void
  -     setWrapperless(bool b)
  -     {
  -             m_isWrapperless = b;
  -     }
  +     ElemTemplateElement*
  +     initWrapperless(
  +                     StylesheetConstructionContext&  constructionContext,
  +                     const Locator*                                  
locator);
   
        /**
         * Retrieve the stack of who's including who
  @@ -856,14 +838,13 @@
         * an element extension as well as for function calls (which is passed
         * on to XPath).
         *
  -      * @param uri the URI of the extension namespace
  -      * @param nsh handler
  +      * @param constructionContext The current construction context.
  +      * @param uri The namespace URI of the extension.
         */
        void
  -     addExtensionNamespace(
  +     processExtensionNamespace(
                        StylesheetConstructionContext&  theConstructionContext,
  -                     const XalanDOMString&                   uri,
  -                     ExtensionNSHandler*                     nsh);
  +                     const XalanDOMString&                   uri);
   
        /**
         * Return the handler for a given extension namespace.
  @@ -1187,21 +1168,15 @@
        bool                                                                    
m_isWrapperless;
   
        /**
  -      * The manufactured template if there is no wrapper.
  -      */
  -     ElemTemplate*                                                   
m_wrapperlessTemplate;
  -  
  -     /**
         * The table of extension namespaces.
         */
        ExtensionNamespacesMapType                              
m_extensionNamespaces;
   
  -  
        /**
         * The first template of the template children.
         */
  -     ElemTemplateElement*                                    m_firstTemplate;
  -  
  +     ElemTemplate*                                                   
m_firstTemplate;
  +
        /**
         * A stack of who's including who is needed in order to support "It is 
an
         * error if a stylesheet directly or indirectly includes itself."
  
  
  
  1.19      +91 -1     xml-xalan/c/src/XSLT/StylesheetConstructionContext.hpp
  
  Index: StylesheetConstructionContext.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetConstructionContext.hpp,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- StylesheetConstructionContext.hpp 3 Nov 2002 03:41:05 -0000       1.18
  +++ StylesheetConstructionContext.hpp 5 Nov 2002 05:19:25 -0000       1.19
  @@ -79,10 +79,12 @@
   
   
   
  +class AttributeList;
   class AVT;
   class AVTPart;
   class DocumentHandler;
   class ElemTemplateElement;
  +class ExtensionNSHandler;
   class Locator;
   class PrefixResolver;
   class Stylesheet;
  @@ -466,7 +468,7 @@
         * @param name a probable xsl:xxx element
         * @return The enum value for that token, or ELEMNAME_UNDEFINED
         */
  -     virtual int
  +     virtual eElementToken
        getElementToken(const XalanDOMString&   name) const = 0;
   
        /**
  @@ -631,6 +633,94 @@
                        const NamespacesStackType&      namespaces,
                        const Locator*                          locator = 0,
                        bool                                            
fUseDefault = false) = 0;
  +
  +     /**
  +      * Create a stylesheet element for the provided type.   The
  +      * instance owns the memory and will delete the element when
  +      * it goes out of scope and the containing stylesheet is
  +      * destroyed.
  +      *
  +      * @param token The enum value of the element to create.
  +      * @param stylesheetTree The stylesheet containing the element
  +      * @param atts The list of attributes for the element
  +      * @param locator The Locator instance for error reporting.  May be 0.
  +      *
  +      * @return A pointer to the new instance.
  +      */
  +     virtual ElemTemplateElement*
  +     createElement(
  +                     int                                             token,
  +                     Stylesheet&                             stylesheetTree,
  +                     const AttributeList&    atts,
  +                     const Locator*                  locator = 0) = 0;
  +
  +     /**
  +      * Create a literal result element. The instance owns the
  +      * memory and will delete the element when it goes out of
  +      * scope and the containing stylesheet is destroyed.
  +      *
  +      * @param stylesheetTree The stylesheet containing the element
  +      * @param name The name of the element
  +      * @param atts The list of attributes for the element
  +      * @param locator The Locator instance for error reporting.  May be 0.
  +      *
  +      * @return A pointer to the new instance.
  +      */
  +     virtual ElemTemplateElement*
  +     createElement(
  +                     Stylesheet&                             stylesheetTree,
  +                     const XalanDOMChar*             name,
  +                     const AttributeList&    atts,
  +                     const Locator*                  locator = 0) = 0;
  +
  +     /**
  +      * Create a an element for literal text. The instance owns the
  +      * memory and will delete the element when it goes out of
  +      * scope and the containing stylesheet is destroyed.
  +      *
  +      * @param stylesheetTree The stylesheet containing the element
  +      * @param chars The pointer to character string for element
  +      * @param length length of the chars parameter.
  +      * @param isCData true if a CDATA element
  +      * @param preserveSpace true is space should be preserved
  +      * @param disableOutputEscaping true if output escaping should be 
disabled
  +      * @param locator The Locator instance for error reporting.  May be 0.
  +      *
  +      * @return A pointer to the new instance.
  +      */
  +     virtual ElemTemplateElement*
  +     createElement(
  +                     Stylesheet&                                     
stylesheetTree,
  +            const XalanDOMChar*                      chars,
  +                     XalanDOMString::size_type       length,
  +            bool                                             isCData,
  +                     bool                                            
preserveSpace,
  +            bool                                             
disableOutputEscaping,
  +                     const Locator*                          locator = 0) = 
0;
  +
  +     /**
  +      * Create an element to handle an extension element.   The
  +      * instance owns the memory and will delete the element when
  +      * it goes out of scope and the containing stylesheet is
  +      * destroyed.
  +      *
  +      * @param stylesheetTree The stylesheet containing the element
  +      * @param name The name of the element
  +      * @param atts The list of attributes for the element
  +      * @param handler The handler for elements in the extension namespace
  +      * @param locator The Locator instance for error reporting.  May be 0.
  +      *
  +      * @return A pointer to the new instance.
  +      */
  +     virtual ElemTemplateElement*
  +     createElement(
  +                     Stylesheet&                             stylesheetTree,
  +                     const XalanDOMChar*             name,
  +                     const AttributeList&    atts,
  +                     ExtensionNSHandler&             handler,
  +                     const Locator*                  locator = 0) = 0;
  +
  +     // These are inherited from XPathConstructionContext...
   
        virtual void
        error(
  
  
  
  1.29      +448 -4    
xml-xalan/c/src/XSLT/StylesheetConstructionContextDefault.cpp
  
  Index: StylesheetConstructionContextDefault.cpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/src/XSLT/StylesheetConstructionContextDefault.cpp,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- StylesheetConstructionContextDefault.cpp  3 Nov 2002 03:41:05 -0000       
1.28
  +++ StylesheetConstructionContextDefault.cpp  5 Nov 2002 05:19:25 -0000       
1.29
  @@ -86,7 +86,33 @@
   
   
   #include "Constants.hpp"
  -#include "ElemTemplateElement.hpp"
  +#include "ElemApplyImport.hpp"
  +#include "ElemApplyTemplates.hpp"
  +#include "ElemAttribute.hpp"
  +#include "ElemAttributeSet.hpp"
  +#include "ElemCallTemplate.hpp"
  +#include "ElemChoose.hpp"
  +#include "ElemComment.hpp"
  +#include "ElemCopy.hpp"
  +#include "ElemCopyOf.hpp"
  +#include "ElemDecimalFormat.hpp"
  +#include "ElemElement.hpp"
  +#include "ElemExtensionCall.hpp"
  +#include "ElemFallback.hpp"
  +#include "ElemForEach.hpp"
  +#include "ElemIf.hpp"
  +#include "ElemLiteralResult.hpp"
  +#include "ElemMessage.hpp"
  +#include "ElemNumber.hpp"
  +#include "ElemOtherwise.hpp"
  +#include "ElemParam.hpp"
  +#include "ElemPI.hpp"
  +#include "ElemSort.hpp"
  +#include "ElemTemplate.hpp"
  +#include "ElemTextLiteral.hpp"
  +#include "ElemValueOf.hpp"
  +#include "ElemWhen.hpp"
  +#include "ElemWithParam.hpp"
   #include "StylesheetRoot.hpp"
   #include "XSLTEngineImpl.hpp"
   #include "XSLTInputSource.hpp"
  @@ -117,7 +143,13 @@
        m_avtPartXPathAllocator(theAVTPartXPathAllocatorBlockSize),
        m_xalanQNameByValueAllocator(theXalanQNameByValueAllocatorBlockSize),
        m_useAttributeSetsQName(XSLTEngineImpl::getXSLNameSpaceURL(), 
Constants::ATTRNAME_USEATTRIBUTESETS),
  -     m_pointerVectorAllocator(thePointerVectorAllocatorBlockSize)
  +     m_pointerVectorAllocator(thePointerVectorAllocatorBlockSize),
  +     m_allocatedElements(),
  +     m_elemLiteralResultAllocator(eDefaultElemLiteralResultBlockSize),
  +     m_elemTemplateAllocator(eDefaultElemTemplateBlockSize),
  +     m_elemTextLiteralAllocator(eDefaultElemTextLiteralBlockSize),
  +     m_elemValueOfAllocator(eDefaultElemValueOfBlockSize),
  +     m_elemVariableAllocator(eDefaultElemVariableBlockSize)
   {
   }
   
  @@ -297,6 +329,13 @@
   
        m_stylesheets.clear();
   
  +     for_each(
  +                     m_allocatedElements.begin(),
  +                     m_allocatedElements.end(),
  +                     DeleteFunctor<ElemTemplateElement>());
  +
  +     m_allocatedElements.clear();
  +
        m_xpathFactory.reset();
   
        m_stringPool.clear();
  @@ -312,6 +351,16 @@
        m_xalanQNameByValueAllocator.reset();
   
        m_pointerVectorAllocator.reset();
  +
  +     m_elemLiteralResultAllocator.reset();
  +
  +     m_elemTemplateAllocator.reset();
  +
  +     m_elemTextLiteralAllocator.reset();
  +
  +     m_elemValueOfAllocator.reset();
  +
  +     m_elemVariableAllocator.reset();
   }
   
   
  @@ -381,6 +430,11 @@
   
                delete theStylesheetRoot;
        }
  +
  +     if (m_stylesheets.size() == 0)
  +     {
  +             reset();
  +     }
   }
   
   
  @@ -621,7 +675,397 @@
   
   
   
  -int
  +inline XMLSSize_t
  +getLineNumber(const Locator* theLocator)
  +{
  +     return theLocator == 0 ? -1 : theLocator->getLineNumber();
  +}
  +
  +
  +
  +inline XMLSSize_t
  +getColumnNumber(const Locator*       theLocator)
  +{
  +     return theLocator == 0 ? -1 : theLocator->getColumnNumber();
  +}
  +
  +
  +
  +ElemTemplateElement*
  +StylesheetConstructionContextDefault::createElement(
  +                     int                                             token,
  +                     Stylesheet&                             stylesheetTree,
  +                     const AttributeList&    atts,
  +                     const Locator*                  locator)
  +{
  +     const XMLSSize_t        lineNumber = getLineNumber(locator);
  +     const XMLSSize_t        columnNumber = getColumnNumber(locator);
  +
  +     ElemTemplateElement*    theElement = 0;
  +
  +     switch(token)
  +     {
  +     case ELEMNAME_APPLY_IMPORTS:
  +             m_allocatedElements.push_back(0);
  +
  +             theElement = new ElemApplyImport(
  +                     *this,
  +                     stylesheetTree,
  +                     atts,
  +                     lineNumber,
  +                     columnNumber);
  +             break;
  +
  +     case ELEMNAME_APPLY_TEMPLATES:
  +             m_allocatedElements.push_back(0);
  +
  +             theElement = new ElemApplyTemplates(
  +                     *this,
  +                     stylesheetTree,
  +                     atts,
  +                     lineNumber,
  +                     columnNumber);
  +             break;
  +
  +     case ELEMNAME_ATTRIBUTE:
  +             m_allocatedElements.push_back(0);
  +
  +             theElement = new ElemAttribute(
  +                     *this,
  +                     stylesheetTree,
  +                     atts,
  +                     lineNumber,
  +                     columnNumber);
  +             break;
  +
  +     case ELEMNAME_ATTRIBUTE_SET:
  +             m_allocatedElements.push_back(0);
  +
  +             theElement = new ElemAttributeSet(
  +                     *this,
  +                     stylesheetTree,
  +                     atts,
  +                     lineNumber,
  +                     columnNumber);
  +             break;
  +
  +     case ELEMNAME_CALL_TEMPLATE:
  +             m_allocatedElements.push_back(0);
  +
  +             theElement = new ElemCallTemplate(
  +                     *this,
  +                     stylesheetTree,
  +                     atts,
  +                     lineNumber,
  +                     columnNumber);
  +             break;
  +
  +     case ELEMNAME_CHOOSE:
  +             m_allocatedElements.push_back(0);
  +
  +             theElement = new ElemChoose(
  +                     *this,
  +                     stylesheetTree,
  +                     atts,
  +                     lineNumber,
  +                     columnNumber);
  +             break;
  +
  +     case ELEMNAME_COMMENT:
  +             m_allocatedElements.push_back(0);
  +
  +             theElement = new ElemComment(
  +                     *this,
  +                     stylesheetTree,
  +                     atts,
  +                     lineNumber,
  +                     columnNumber);
  +       break;
  +
  +     case ELEMNAME_COPY:
  +             m_allocatedElements.push_back(0);
  +
  +             theElement = new ElemCopy(
  +                     *this,
  +                     stylesheetTree,
  +                     atts,
  +                     lineNumber,
  +                     columnNumber);
  +             break;
  +
  +     case ELEMNAME_COPY_OF:
  +             m_allocatedElements.push_back(0);
  +
  +             theElement = new ElemCopyOf(
  +                     *this,
  +                     stylesheetTree,
  +                     atts,
  +                     lineNumber,
  +                     columnNumber);
  +             break;
  +
  +     case ELEMNAME_DECIMAL_FORMAT:
  +             m_allocatedElements.push_back(0);
  +
  +             theElement = new ElemDecimalFormat(
  +                     *this,
  +                     stylesheetTree,
  +                     atts,
  +                     lineNumber,
  +                     columnNumber);
  +             break;
  +
  +     case ELEMNAME_ELEMENT:
  +             m_allocatedElements.push_back(0);
  +
  +             theElement = new ElemElement(
  +                     *this,
  +                     stylesheetTree,
  +                     atts,
  +                     lineNumber,
  +                     columnNumber);
  +       break;
  +
  +     case ELEMNAME_FALLBACK:
  +             m_allocatedElements.push_back(0);
  +
  +             theElement = new ElemFallback(
  +                     *this,
  +                     stylesheetTree,
  +                     atts,
  +                     lineNumber,
  +                     columnNumber);
  +             break;
  +
  +     case ELEMNAME_FOR_EACH:
  +             m_allocatedElements.push_back(0);
  +
  +             theElement = new ElemForEach(
  +                     *this,
  +                     stylesheetTree,
  +                     atts,
  +                     lineNumber,
  +                     columnNumber);
  +             break;
  +
  +     case ELEMNAME_IF:
  +             m_allocatedElements.push_back(0);
  +
  +             theElement = new ElemIf(
  +                     *this,
  +                     stylesheetTree,
  +                     atts,
  +                     lineNumber,
  +                     columnNumber);
  +             break;
  +
  +     case ELEMNAME_MESSAGE:
  +             m_allocatedElements.push_back(0);
  +
  +             theElement = new ElemMessage(
  +                     *this,
  +                     stylesheetTree,
  +                     atts,
  +                     lineNumber,
  +                     columnNumber);
  +             break;
  +
  +     case ELEMNAME_NUMBER:
  +             m_allocatedElements.push_back(0);
  +
  +             theElement = new ElemNumber(
  +                     *this,
  +                     stylesheetTree,
  +                     atts,
  +                     lineNumber,
  +                     columnNumber,
  +                     
stylesheetTree.getStylesheetRoot().getNextElemNumberID());
  +             break;
  +
  +     case ELEMNAME_OTHERWISE:
  +             m_allocatedElements.push_back(0);
  +
  +             theElement = new ElemOtherwise(
  +                     *this,
  +                     stylesheetTree,
  +                     atts,
  +                     lineNumber,
  +                     columnNumber);
  +             break;
  +
  +     case ELEMNAME_PARAM:
  +             m_allocatedElements.push_back(0);
  +
  +             theElement = new ElemParam(
  +                     *this,
  +                     stylesheetTree,
  +                     atts,
  +                     lineNumber,
  +                     columnNumber);
  +             break;
  +
  +     case ELEMNAME_PI:
  +             m_allocatedElements.push_back(0);
  +
  +             theElement = new ElemPI(
  +                     *this,
  +                     stylesheetTree,
  +                     atts,
  +                     lineNumber,
  +                     columnNumber);
  +       break;
  +
  +     case ELEMNAME_SORT:
  +             m_allocatedElements.push_back(0);
  +
  +             theElement = new ElemSort(
  +                     *this,
  +                     stylesheetTree,
  +                     atts,
  +                     lineNumber,
  +                     columnNumber);
  +             break;
  +
  +     case ELEMNAME_TEMPLATE:
  +             return m_elemTemplateAllocator.create(
  +                     *this,
  +                     stylesheetTree,
  +                     atts,
  +                     lineNumber,
  +                     columnNumber);
  +             break;
  +
  +     case ELEMNAME_VALUE_OF:
  +             return m_elemValueOfAllocator.create(
  +                     *this,
  +                     stylesheetTree,
  +                     atts,
  +                     lineNumber,
  +                     columnNumber);
  +             break;
  +
  +     case ELEMNAME_VARIABLE:
  +             return m_elemVariableAllocator.create(
  +                     *this,
  +                     stylesheetTree,
  +                     atts,
  +                     lineNumber,
  +                     columnNumber);
  +             break;
  +
  +     case ELEMNAME_WITH_PARAM:
  +             m_allocatedElements.push_back(0);
  +
  +             theElement = new ElemWithParam(
  +                     *this,
  +                     stylesheetTree,
  +                     atts,
  +                     lineNumber,
  +                     columnNumber);
  +             break;
  +
  +     case ELEMNAME_WHEN:
  +             m_allocatedElements.push_back(0);
  +
  +             theElement = new ElemWhen(
  +                     *this,
  +                     stylesheetTree,
  +                     atts,
  +                     lineNumber,
  +                     columnNumber);
  +             break;
  +
  +     default:
  +             error("Unsupported XSLT element requested", 0, locator);
  +             break;
  +     };
  +
  +     assert(theElement != 0 && m_allocatedElements.back() == 0);
  +
  +     m_allocatedElements.back() = theElement;
  +
  +     return theElement;
  +}
  +
  +
  +
  +ElemTemplateElement*
  +StylesheetConstructionContextDefault::createElement(
  +                     Stylesheet&                             stylesheetTree,
  +                     const XalanDOMChar*             name,
  +                     const AttributeList&    atts,
  +                     const Locator*                  locator)
  +{
  +     const XMLSSize_t        lineNumber = getLineNumber(locator);
  +     const XMLSSize_t        columnNumber = getColumnNumber(locator);
  +
  +     return m_elemLiteralResultAllocator.create(
  +                     *this,
  +                     stylesheetTree,
  +                     name,
  +                     atts,
  +                     lineNumber,
  +                     columnNumber);
  +}
  +
  +
  +
  +ElemTemplateElement*
  +StylesheetConstructionContextDefault::createElement(
  +                     Stylesheet&                             stylesheetTree,
  +                     const XalanDOMChar*             name,
  +                     const AttributeList&    atts,
  +                     ExtensionNSHandler&             handler,
  +                     const Locator*                  locator)
  +{
  +     const XMLSSize_t        lineNumber = getLineNumber(locator);
  +     const XMLSSize_t        columnNumber = getColumnNumber(locator);
  +
  +     m_allocatedElements.push_back(0);
  +
  +     m_allocatedElements.back() = new ElemExtensionCall(
  +                     *this,
  +                     stylesheetTree,
  +                     name,
  +                     atts,
  +                     lineNumber,
  +                     columnNumber,
  +                     handler);
  +
  +     return m_allocatedElements.back();
  +}
  +
  +
  +
  +ElemTemplateElement*
  +StylesheetConstructionContextDefault::createElement(
  +                     Stylesheet&                                     
stylesheetTree,
  +            const XalanDOMChar*                      chars,
  +                     XalanDOMString::size_type       length,
  +            bool                                             isCData,
  +                     bool                                            
preserveSpace,
  +            bool                                             
disableOutputEscaping,
  +                     const Locator*                          locator)
  +{
  +     const XMLSSize_t        lineNumber = getLineNumber(locator);
  +     const XMLSSize_t        columnNumber = getColumnNumber(locator);
  +
  +     return m_elemTextLiteralAllocator.create(
  +                     *this,
  +                     stylesheetTree,
  +                     lineNumber,
  +                     columnNumber,
  +                     chars,
  +                     0,
  +                     length,
  +                     isCData,
  +                     preserveSpace, 
  +                     disableOutputEscaping);
  +}
  +
  +
  +
  +StylesheetConstructionContextDefault::eElementToken
   StylesheetConstructionContextDefault::getElementToken(const XalanDOMString&  
        name) const
   {
        return getElementNameToken(name);
  @@ -629,7 +1073,7 @@
   
   
   
  -int
  +StylesheetConstructionContextDefault::eElementToken
   StylesheetConstructionContextDefault::getElementNameToken(const 
XalanDOMString&              name)
   {
        // Find the entity, if any...
  
  
  
  1.28      +60 -4     
xml-xalan/c/src/XSLT/StylesheetConstructionContextDefault.hpp
  
  Index: StylesheetConstructionContextDefault.hpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/src/XSLT/StylesheetConstructionContextDefault.hpp,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- StylesheetConstructionContextDefault.hpp  3 Nov 2002 03:41:05 -0000       
1.27
  +++ StylesheetConstructionContextDefault.hpp  5 Nov 2002 05:19:25 -0000       
1.28
  @@ -107,6 +107,11 @@
   #include <XSLT/XalanAVTPartSimpleAllocator.hpp>
   #include <XSLT/AVTPartXPath.hpp>
   #include <XSLT/XalanAVTPartXPathAllocator.hpp>
  +#include <XSLT/XalanElemLiteralResultAllocator.hpp>
  +#include <XSLT/XalanElemTemplateAllocator.hpp>
  +#include <XSLT/XalanElemTextLiteralAllocator.hpp>
  +#include <XSLT/XalanElemValueOfAllocator.hpp>
  +#include <XSLT/XalanElemVariableAllocator.hpp>
   
   
   
  @@ -138,7 +143,12 @@
                        eDefaultAVTPartSimpleBlockSize = 128,
                        eDefaultAVTPartXPathBlockSize = 128,
                        eDefaultXalanQNameByValueBlockSize = 32,
  -                     eDefaultPointerVectorBlockSize = 512 };
  +                     eDefaultPointerVectorBlockSize = 512,
  +                     eDefaultElemLiteralResultBlockSize = 20,
  +                     eDefaultElemTemplateBlockSize = 10,
  +                     eDefaultElemTextLiteralBlockSize = 20,
  +                     eDefaultElemValueOfBlockSize = 10,
  +                     eDefaultElemVariableBlockSize = 10 };
   
        /*
         * Construct an instance.  If the stylesheet(s) constructed is/are 
meant to be reused (a.k.a. "compiled"),
  @@ -347,7 +357,7 @@
                        const Stylesheet&               theStylesheet,
                        const Locator*                  theLocator = 0);
   
  -     virtual int
  +     virtual eElementToken
        getElementToken(const XalanDOMString&   name) const;
   
        virtual double
  @@ -423,13 +433,47 @@
                        const Locator*                          locator = 0,
                        bool                                            
fUseDefault = false);
   
  -     static int
  +     virtual ElemTemplateElement*
  +     createElement(
  +                     int                                             token,
  +                     Stylesheet&                             stylesheetTree,
  +                     const AttributeList&    atts,
  +                     const Locator*                  locator = 0);
  +
  +     virtual ElemTemplateElement*
  +     createElement(
  +                     Stylesheet&                             stylesheetTree,
  +                     const XalanDOMChar*             name,
  +                     const AttributeList&    atts,
  +                     const Locator*                  locator = 0);
  +
  +     virtual ElemTemplateElement*
  +     createElement(
  +                     Stylesheet&                                     
stylesheetTree,
  +            const XalanDOMChar*                      chars,
  +                     XalanDOMString::size_type       length,
  +            bool                                             isCData,
  +                     bool                                            
preserveSpace,
  +            bool                                             
disableOutputEscaping,
  +                     const Locator*                          locator = 0);
  +
  +     virtual ElemTemplateElement*
  +     createElement(
  +                     Stylesheet&                             stylesheetTree,
  +                     const XalanDOMChar*             name,
  +                     const AttributeList&    atts,
  +                     ExtensionNSHandler&             handler,
  +                     const Locator*                  locator = 0);
  +
  +     static eElementToken
        getElementNameToken(const XalanDOMString&       name);
   
   #if defined(XALAN_NO_NAMESPACES)
        typedef vector<StylesheetRoot*>                 StylesheetVectorType;
  +     typedef vector<ElemTemplateElement*>    ElemTemplateElementVectorType;
   #else
  -     typedef std::vector<StylesheetRoot*>    StylesheetVectorType;
  +     typedef std::vector<StylesheetRoot*>            StylesheetVectorType;
  +     typedef std::vector<ElemTemplateElement*>       
ElemTemplateElementVectorType;
   #endif
   
   private:
  @@ -502,6 +546,18 @@
        const XalanQNameByReference                             
m_useAttributeSetsQName;
   
        PointerVectorAllocatorType                              
m_pointerVectorAllocator;
  +
  +     ElemTemplateElementVectorType                   m_allocatedElements;
  +
  +     XalanElemLiteralResultAllocator                 
m_elemLiteralResultAllocator;
  +
  +     XalanElemTemplateAllocator                              
m_elemTemplateAllocator;
  +
  +     XalanElemTextLiteralAllocator                   
m_elemTextLiteralAllocator;
  +
  +     XalanElemValueOfAllocator                               
m_elemValueOfAllocator;
  +
  +     XalanElemVariableAllocator                              
m_elemVariableAllocator;
   
        static const XalanQNameByReference      s_spaceAttrQName;
   
  
  
  
  1.95      +125 -378  xml-xalan/c/src/XSLT/StylesheetHandler.cpp
  
  Index: StylesheetHandler.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetHandler.cpp,v
  retrieving revision 1.94
  retrieving revision 1.95
  diff -u -r1.94 -r1.95
  --- StylesheetHandler.cpp     3 Nov 2002 05:51:22 -0000       1.94
  +++ StylesheetHandler.cpp     5 Nov 2002 05:19:25 -0000       1.95
  @@ -88,37 +88,8 @@
   
   
   #include "Constants.hpp"
  -#include "ElemApplyImport.hpp"
  -#include "ElemApplyTemplates.hpp"
  -#include "ElemAttribute.hpp"
  -#include "ElemAttributeSet.hpp"
  -#include "ElemCallTemplate.hpp"
  -#include "ElemChoose.hpp"
  -#include "ElemComment.hpp"
  -#include "ElemCopy.hpp"
  -#include "ElemCopyOf.hpp"
  -#include "ElemDecimalFormat.hpp"
  -#include "ElemElement.hpp"
  -#include "ElemEmpty.hpp"
  -#include "ElemExtensionCall.hpp"
  -#include "ElemFallback.hpp"
  -#include "ElemForEach.hpp"
  -#include "ElemIf.hpp"
  -#include "ElemLiteralResult.hpp"
  -#include "ElemMessage.hpp"
  -#include "ElemNumber.hpp"
  -#include "ElemOtherwise.hpp"
  -#include "ElemParam.hpp"
  -#include "ElemPI.hpp"
  -#include "ElemSort.hpp"
  -#include "ElemTemplate.hpp"
  -#include "ElemText.hpp"
  +#include "ElemTemplateElement.hpp"
   #include "ElemTextLiteral.hpp"
  -#include "ElemUse.hpp"
  -#include "ElemValueOf.hpp"
  -#include "ElemWhen.hpp"
  -#include "ElemWithParam.hpp"
  -#include "ExtensionNSHandler.hpp"
   #include "Stylesheet.hpp"
   #include "StylesheetConstructionContext.hpp"
   #include "StylesheetRoot.hpp"
  @@ -142,7 +113,6 @@
        m_elemEmptyAllocator(eElemEmptyAllocatorBlockSize),
        m_elemTextAllocator(eElemTextBlockSize),
        m_elemStack(),
  -     m_elemStackParentedElements(),
        m_whiteSpaceElems(),
        m_pTemplate(0),
        m_lastPopped(*this),
  @@ -164,51 +134,7 @@
   
   StylesheetHandler::~StylesheetHandler()
   {
  -#if !defined(XALAN_NO_NAMESPACES)
  -     using std::for_each;
  -#endif
  -
  -     // Clean up the element stack vector...
  -     ElemTemplateStackType::const_iterator   i = m_elemStack.begin();
  -
  -     while(i != m_elemStack.end())
  -     {
  -             // See if the element is in the set of elements that have
  -             // already been parented, so we don't try to delete it after
  -             // it's parent has already deleted it...
  -             const ElemTemplateSetType::iterator             j =
  -                             m_elemStackParentedElements.find(*i);
  -
  -             if (j == m_elemStackParentedElements.end())
  -             {
  -                     if ((*i)->getXSLToken() != 
StylesheetConstructionContext::ELEMNAME_UNDEFINED &&
  -                             (*i)->getXSLToken() != 
StylesheetConstructionContext::ELEMNAME_TEXT)
  -                     {
  -                             // Not found, so delete it...
  -                             delete *i;
  -                     }
  -             }
  -             else
  -             {
  -                     // Found, so erase it from the set...
  -                     m_elemStackParentedElements.erase(j);
  -             }
  -
  -             ++i;
  -     }
  -
        doCleanup();
  -
  -     // Clean up the whitespace elements.
  -     for_each(m_whiteSpaceElems.begin(),
  -                      m_whiteSpaceElems.end(),
  -                      DeleteFunctor<ElemTextLiteral>());
  -
  -     // Clean up any template that's left over...
  -     if (m_pTemplate != m_stylesheet.getWrapperlessTemplate())
  -     {
  -             delete m_pTemplate;
  -     }
   }
   
   
  @@ -358,17 +284,14 @@
                processAccumulatedText();
   
                // Clean up the whitespace elements.
  -             for_each(m_whiteSpaceElems.begin(),
  -                              m_whiteSpaceElems.end(),
  -                              DeleteFunctor<ElemTextLiteral>());
  -
  +//           for_each(m_whiteSpaceElems.begin(),
  +//                            m_whiteSpaceElems.end(),
  +//                            DeleteFunctor<ElemTemplateElement>());
  +//
                m_whiteSpaceElems.clear();
   
                const Locator* const    locator = 
m_constructionContext.getLocatorFromStack();
   
  -             const XalanLocator::size_type   lineNumber = 
getLineNumber(locator);
  -             const XalanLocator::size_type   columnNumber = 
getColumnNumber(locator);
  -
                // First push namespaces
                m_stylesheet.pushNamespaces(atts);
   
  @@ -400,13 +323,8 @@
                        if(!isEmpty(m_stylesheet.getXSLTNamespaceURI()))
                                m_stylesheet.setXSLTNamespaceURI(ns);
   
  -                     if(false == m_foundStylesheet)
  -                     {
  -                             
m_stylesheet.getStylesheetRoot().initDefaultRule(m_constructionContext);
  -                             m_stylesheet.setWrapperless(false);
  -                     }
  -
  -                     const int       xslToken = 
m_constructionContext.getElementToken(m_elementLocalName);
  +                     const StylesheetConstructionContext::eElementToken      
xslToken =
  +                             
m_constructionContext.getElementToken(m_elementLocalName);
   
                        if(!m_inTemplate)
                        {
  @@ -417,65 +335,46 @@
                                switch(xslToken)
                                {            
                                case 
StylesheetConstructionContext::ELEMNAME_APPLY_TEMPLATES:
  -                                     elem = new 
ElemApplyTemplates(m_constructionContext,
  -                                                                             
                m_stylesheet,
  -                                                                             
                atts, lineNumber, columnNumber);
  -                                     break;
  -          
  +                             case 
StylesheetConstructionContext::ELEMNAME_ATTRIBUTE:
                                case 
StylesheetConstructionContext::ELEMNAME_CALL_TEMPLATE:
  -                                     elem = new 
ElemCallTemplate(m_constructionContext,
  -                                                                             
          m_stylesheet,
  -                                                                             
          atts, lineNumber, columnNumber);
  -                                     break;
  -          
  -                             case 
StylesheetConstructionContext::ELEMNAME_WITH_PARAM:
  -                                     elem = new 
ElemWithParam(m_constructionContext,
  -                                                                             
   m_stylesheet,
  -                                                                             
   atts, lineNumber, columnNumber);
  -                                     break;
  -          
  +                             case 
StylesheetConstructionContext::ELEMNAME_CHOOSE:
  +                             case 
StylesheetConstructionContext::ELEMNAME_COMMENT:
  +                             case 
StylesheetConstructionContext::ELEMNAME_COPY:
  +                             case 
StylesheetConstructionContext::ELEMNAME_COPY_OF:
  +                             case 
StylesheetConstructionContext::ELEMNAME_ELEMENT:
  +                             case 
StylesheetConstructionContext::ELEMNAME_FALLBACK:
                                case 
StylesheetConstructionContext::ELEMNAME_FOR_EACH:
  -                                     elem = new 
ElemForEach(m_constructionContext,
  -                                                                             
 m_stylesheet,
  -                                                                             
 atts, lineNumber, columnNumber);
  +                             case StylesheetConstructionContext::ELEMNAME_IF:
  +                             case 
StylesheetConstructionContext::ELEMNAME_MESSAGE:
  +                             case 
StylesheetConstructionContext::ELEMNAME_NUMBER:
  +                             case 
StylesheetConstructionContext::ELEMNAME_VALUE_OF:
  +                             case 
StylesheetConstructionContext::ELEMNAME_WITH_PARAM:
  +                             case 
StylesheetConstructionContext::ELEMNAME_PARAM:
  +                             case StylesheetConstructionContext::ELEMNAME_PI:
  +                                     elem = 
m_constructionContext.createElement(
  +                                                                             
                xslToken,
  +                                                                             
                m_stylesheet,
  +                                                                             
                atts,
  +                                                                             
                locator);
  +                                     assert(elem != 0);
                                        break;
             
                                case 
StylesheetConstructionContext::ELEMNAME_SORT:
                                        {
                                                if (m_elemStack.empty() == true)
                                                {
  -                                                     error("Misplaced 
xsl:sort.", locator);
  +                                                     error("xsl:sort is not 
allowed at this position in the stylesheet", locator);
                                                }
   
                                                ElemTemplateElement* const      
theElement =
                                                                
m_elemStack.back();
                                                assert(theElement != 0);
   
  -                                             const int       xslToken = 
theElement->getXSLToken();
  -
  -                                             if (xslToken != 
StylesheetConstructionContext::ELEMNAME_FOR_EACH &&
  -                                                     xslToken != 
StylesheetConstructionContext::ELEMNAME_APPLY_TEMPLATES)
  -                                             {
  -                                                     error("Misplaced 
xsl:sort.", locator);
  -                                             }
  -
  -                                             ElemForEach* foreach =
  -#if defined(XALAN_OLD_STYLE_CASTS)
  -                                                             
(ElemForEach*)theElement;
  -#else
  -                                                             
static_cast<ElemForEach*>(theElement);
  -#endif
  -
  -                                             ElemSort* sortElem = new 
ElemSort(m_constructionContext,
  -                                                                             
                                 m_stylesheet,
  -                                                                             
                                 atts, lineNumber, columnNumber);
  -
  -                                             // Note: deleted in ElemForEach 
destructor
  -                                             
foreach->getSortElems().push_back(sortElem);
  -
  -                                             
sortElem->setParentNodeElem(foreach);
  -
  -                                             
m_elemStackParentedElements.insert(foreach);
  +                                             theElement->processSortElement(
  +                                                     m_constructionContext,
  +                                                     m_stylesheet,
  +                                                     atts,
  +                                                     locator);
   
                                                m_elemStack.push_back(
                                                        
m_elemEmptyAllocator.create(
  @@ -496,78 +395,37 @@
                                                                
m_elemStack.back();
                                                assert(theElement != 0);
   
  -                                             const int       xslToken = 
theElement->getXSLToken();
  +                                             const int       parentToken =
  +                                                     
theElement->getXSLToken();
   
  -                                             if (xslToken == 
StylesheetConstructionContext::ELEMNAME_FOR_EACH)
  +                                             if (parentToken == 
StylesheetConstructionContext::ELEMNAME_FOR_EACH)
                                                {
                                                        
error("xsl:apply-imports is not allowed at this position in the stylesheet", 
locator);
                                                }
   
  -                                             elem = new 
ElemApplyImport(m_constructionContext,
  -                                                                             
                 m_stylesheet,
  -                                                                             
                 atts, lineNumber, columnNumber);
  +                                             elem = 
m_constructionContext.createElement(
  +                                                                             
                        xslToken,
  +                                                                             
                        m_stylesheet,
  +                                                                             
                        atts,
  +                                                                             
                        locator);
  +                                             assert(elem != 0);
                                        }
                                        break;
             
  -                             case 
StylesheetConstructionContext::ELEMNAME_VALUE_OF:
  -                                     elem = new 
ElemValueOf(m_constructionContext,
  -                                                                             
 m_stylesheet,
  -                                                                             
 atts, lineNumber, columnNumber);
  -                                     break;
  -
  -                             case 
StylesheetConstructionContext::ELEMNAME_NUMBER:
  -                                     elem = new ElemNumber(
  -                                                     m_constructionContext,
  -                                                     m_stylesheet,
  -                                                     atts,
  -                                                     lineNumber,
  -                                                     columnNumber,
  -                                                     
m_stylesheet.getStylesheetRoot().getNextElemNumberID());
  -                                     break;
  -          
                                case 
StylesheetConstructionContext::ELEMNAME_VARIABLE:
                                        {
  -                                             
XalanAutoPtr<ElemTemplateElement>       newVar(
  -                                                     new ElemVariable(
  -                                                                     
m_constructionContext,
  -                                                                     
m_stylesheet,
  -                                                                     atts,
  -                                                                     
lineNumber,
  -                                                                     
columnNumber));
  -
  -                                             
checkForOrAddVariableName(newVar->getNameAttribute(), locator);
  +                                             elem =
  +                                                     
m_constructionContext.createElement(
  +                                                                             
                xslToken,
  +                                                                             
                m_stylesheet,
  +                                                                             
                atts,
  +                                                                             
                locator);
  +                                             assert(elem != 0);
   
  -                                             elem = newVar.release();
  +                                             
checkForOrAddVariableName(elem->getNameAttribute(), locator);
                                        }
                                        break;
   
  -                             case 
StylesheetConstructionContext::ELEMNAME_PARAM:
  -                                     elem = new 
ElemParam(m_constructionContext,
  -                                                                        
m_stylesheet,
  -                                                                        
atts, lineNumber, columnNumber);
  -                                     break;
  -          
  -                             case StylesheetConstructionContext::ELEMNAME_IF:
  -                                     elem = new ElemIf(m_constructionContext,
  -                                                                     
m_stylesheet,
  -                                                                     atts, 
lineNumber, columnNumber);
  -                                     break;
  -
  -                             case 
StylesheetConstructionContext::ELEMNAME_FALLBACK:
  -                                     elem = new ElemFallback(
  -                                                     m_constructionContext,
  -                                                     m_stylesheet,
  -                                                     atts,
  -                                                     lineNumber,
  -                                                     columnNumber);
  -                                     break;
  -
  -                             case 
StylesheetConstructionContext::ELEMNAME_CHOOSE:
  -                                     elem = new 
ElemChoose(m_constructionContext,
  -                                                                             
m_stylesheet,
  -                                                                             
atts, lineNumber, columnNumber);
  -                                     break;
  -          
                                case 
StylesheetConstructionContext::ELEMNAME_WHEN:
                                        {
                                                ElemTemplateElement* const      
parent = m_elemStack.back();
  @@ -584,9 +442,12 @@
                                                                
StylesheetConstructionContext::ELEMNAME_WHEN == lastChild->getXSLToken() ||
                                                                
lastChild->isWhitespace() == true)
                                                        {
  -                                                             elem = new 
ElemWhen(m_constructionContext,
  -                                                                             
        m_stylesheet,
  -                                                                             
        atts, lineNumber, columnNumber);
  +                                                             elem = 
m_constructionContext.createElement(
  +                                                                             
                                        xslToken,
  +                                                                             
                                        m_stylesheet,
  +                                                                             
                                        atts,
  +                                                                             
                                        locator);
  +                                                             assert(elem != 
0);
                                                        }
                                                        else
                                                        {
  @@ -612,9 +473,12 @@
                                                                
StylesheetConstructionContext::ELEMNAME_WHEN == lastChild->getXSLToken() ||
                                                                
lastChild->isWhitespace() == true)
                                                        {
  -                                                             elem = new 
ElemOtherwise(m_constructionContext,
  -                                                                             
                 m_stylesheet,
  -                                                                             
                 atts, lineNumber, columnNumber);
  +                                                             elem = 
m_constructionContext.createElement(
  +                                                                             
                                        xslToken,
  +                                                                             
                                        m_stylesheet,
  +                                                                             
                                        atts,
  +                                                                             
                                        locator);
  +                                                             assert(elem != 
0);
                                                        }
                                                        else
                                                        {
  @@ -624,59 +488,16 @@
                                        }
                                        break;
   
  -                             case 
StylesheetConstructionContext::ELEMNAME_COPY_OF:
  -                                     elem = new 
ElemCopyOf(m_constructionContext,
  -                                                                             
m_stylesheet,
  -                                                                             
atts, lineNumber, columnNumber);
  -                                     break;
  -
  -                             case 
StylesheetConstructionContext::ELEMNAME_COPY:
  -                                     elem = new 
ElemCopy(m_constructionContext,
  -                                                                       
m_stylesheet,
  -                                                                       atts, 
lineNumber, columnNumber);
  -                                     break;
  -
                                case 
StylesheetConstructionContext::ELEMNAME_TEXT:
                                        m_elemStack.push_back(
                                                m_elemTextAllocator.create(
                                                        m_constructionContext,
                                                        m_stylesheet,
                                                        atts,
  -                                                     lineNumber,
  -                                                     columnNumber));
  -                                     break;
  -
  -                             case 
StylesheetConstructionContext::ELEMNAME_ATTRIBUTE:
  -                                     elem = new 
ElemAttribute(m_constructionContext,
  -                                                                             
   m_stylesheet,
  -                                                                             
   atts, lineNumber, columnNumber);
  +                                                     getLineNumber(locator),
  +                                                     
getColumnNumber(locator)));
                                        break;
   
  -                             case 
StylesheetConstructionContext::ELEMNAME_ELEMENT:
  -                                     elem = new 
ElemElement(m_constructionContext,
  -                                                                             
 m_stylesheet,
  -                                                                             
 atts, lineNumber, columnNumber);
  -                               break;
  -          
  -                             case StylesheetConstructionContext::ELEMNAME_PI:
  -                                     elem = new ElemPI(m_constructionContext,
  -                                                                     
m_stylesheet,
  -                                                                     atts, 
lineNumber, columnNumber);
  -                               break;
  -
  -                             case 
StylesheetConstructionContext::ELEMNAME_COMMENT:
  -                                     elem = new 
ElemComment(m_constructionContext,
  -                                                                             
 m_stylesheet,
  -                                                                             
 atts, lineNumber, columnNumber);
  -                               break;
  -          
  -                             case 
StylesheetConstructionContext::ELEMNAME_MESSAGE:
  -                                     elem = new 
ElemMessage(m_constructionContext,
  -                                                                             
 m_stylesheet,
  -                                                                             
 atts, lineNumber, columnNumber);
  -
  -                                     break;
  -          
                                case 
StylesheetConstructionContext::ELEMNAME_TEMPLATE:
                                case 
StylesheetConstructionContext::ELEMNAME_ATTRIBUTE_SET:
                                case 
StylesheetConstructionContext::ELEMNAME_EXTENSION:
  @@ -720,7 +541,7 @@
                                // If it's a top level 
                                if (!m_foundStylesheet)
                                {
  -                                     elem = initWrapperless(name, atts, 
lineNumber, columnNumber);
  +                                     elem = initWrapperless(name, atts, 
locator);
                                }
                                else if (length(ns) == 0 && m_elemStack.size() 
== 1)
                                {
  @@ -739,31 +560,29 @@
                                // is this an extension element call?
                                ExtensionNSHandler*             nsh = 0;
   
  -                             if (!isEmpty(ns) && 
  -                                     ((nsh = 
m_stylesheet.lookupExtensionNSHandler(ns)) != 0)) 
  +                             if (!isEmpty(ns) &&
  +                                     ((nsh = 
m_stylesheet.lookupExtensionNSHandler(ns)) != 0))
                                {
  -                                     elem = new ElemExtensionCall 
(m_constructionContext,
  -                                                                             
        m_stylesheet,
  -                                                                             
        name,
  -                                                                             
        atts,
  -                                                                             
        lineNumber,
  -                                                                             
        columnNumber,
  -                                                                             
        *nsh,
  -                                                                             
        m_elementLocalName);
  -
  +                                     elem = 
m_constructionContext.createElement(
  +                                                                             
                m_stylesheet,
  +                                                                             
                name,
  +                                                                             
                atts,
  +                                                                             
                *nsh,
  +                                                                             
                locator);
                                        
assert(m_inExtensionElementStack.empty() == false);
   
                                        m_inExtensionElementStack.back() = true;
                                }
                                else 
                                {
  -                                     elem = new 
ElemLiteralResult(m_constructionContext,
  -                                                                             
   m_stylesheet,
  -                                                                             
   name,
  -                                                                             
   atts,
  -                                                                             
   lineNumber,
  -                                                                             
   columnNumber);
  +                                     elem = 
m_constructionContext.createElement(
  +                                                                             
                m_stylesheet,
  +                                                                             
                name,
  +                                                                             
                atts,
  +                                                                             
                locator);
                                }
  +
  +                             assert(elem != 0);
                        }
                }
   
  @@ -771,14 +590,7 @@
                {
                        if(!m_elemStack.empty())
                        {
  -                             // Guard against an exception in 
appendChildElem()...
  -                             XalanAutoPtr<ElemTemplateElement>       
theGuard(elem);
  -
                                appendChildElementToParent(elem, locator);
  -
  -                             // The element is parented and will now be
  -                             // deleted when the parent is delete...
  -                             theGuard.release();
                        }
   
                        m_elemStack.push_back(elem);
  @@ -802,13 +614,6 @@
                if(origStackSize == m_elemStack.size())
                {
                        
m_elemStack.push_back(m_elemEmptyAllocator.create(m_constructionContext, 
m_stylesheet));
  -
  -                     if (elem != 0)
  -                     {
  -                             delete elem;
  -
  -                             m_elemStackParentedElements.erase(elem);
  -                     }
                }
        } // end try
        catch(...)
  @@ -825,32 +630,19 @@
   StylesheetHandler::initWrapperless(
                        const XalanDOMChar*             name,
                        const AttributeList&    atts,
  -                     int                                             
lineNumber,
  -                     int                                             
columnNumber)
  +                     const Locator*                  locator)
   {
  -     m_stylesheet.getStylesheetRoot().initDefaultRule(m_constructionContext);
  -
  -     AttributeListImpl       templateAttrs;
  -
  -     templateAttrs.addAttribute(c_wstr(Constants::ATTRNAME_NAME),
  -                                                        
c_wstr(Constants::ATTRTYPE_CDATA),
  -                                                        
c_wstr(Constants::ATTRVAL_SIMPLE));
  -
        assert(m_pTemplate == 0);
   
  -     m_pTemplate = new ElemTemplate(m_constructionContext,
  -                                                                m_stylesheet,
  -                                                                
templateAttrs,
  -                                                                lineNumber,
  -                                                                
columnNumber);
  +     m_pTemplate = m_stylesheet.initWrapperless(m_constructionContext, 
locator);
  +     assert(m_pTemplate != 0);
   
        ElemTemplateElement* const      pElem =
  -                             new ElemLiteralResult(m_constructionContext,
  -                                                                       
m_stylesheet,
  -                                                                       name,
  -                                                                       atts,
  -                                                                       
lineNumber,
  -                                                                       
columnNumber);
  +             m_constructionContext.createElement(
  +                     m_stylesheet,
  +                     name,
  +                     atts,
  +                     locator);
   
        m_pTemplate->appendChildElem(pElem);
        m_inTemplate = true;
  @@ -858,9 +650,6 @@
        m_inScopeVariableNamesStack.push_back(QNameSetVectorType::value_type());
   
        m_foundStylesheet = true;
  -     m_stylesheet.setWrapperless(true);
  -
  -     m_pTemplate->addToStylesheet(m_constructionContext, m_stylesheet);
   
        // This attempts to optimize for a literal result element with
        // the name HTML, so we don't have to switch on-the-fly.
  @@ -930,23 +719,19 @@
                m_foundNotImport = true;
        }
   
  -     const int       lineNumber = getLineNumber(locator);
  -     const int       columnNumber = getColumnNumber(locator);
  -
        switch(xslToken)
        {
        case StylesheetConstructionContext::ELEMNAME_TEMPLATE:
                assert(m_pTemplate == 0);
   
  -             m_pTemplate = new ElemTemplate(
  -                             m_constructionContext,
  -                             m_stylesheet,
  -                             atts,
  -                             lineNumber,
  -                             columnNumber);
  +             m_pTemplate =
  +                     m_constructionContext.createElement(
  +                                                                     
StylesheetConstructionContext::ELEMNAME_TEMPLATE,
  +                                                                       
m_stylesheet,
  +                                                                       atts,
  +                                                                       
locator);
        
                m_elemStack.push_back(m_pTemplate);
  -             m_elemStackParentedElements.insert(m_pTemplate);
                m_inTemplate = true;
                
m_inScopeVariableNamesStack.push_back(QNameSetVectorType::value_type());
                break;
  @@ -954,17 +739,12 @@
        case StylesheetConstructionContext::ELEMNAME_VARIABLE:
        case StylesheetConstructionContext::ELEMNAME_PARAM:
                {
  -                     ElemTemplateElement* const      elem = 
(StylesheetConstructionContext::ELEMNAME_PARAM == xslToken) 
  -                                                                        ? 
new ElemParam(m_constructionContext,
  -                                                                             
                           m_stylesheet,
  -                                                                             
                           atts, 
  -                                                                             
                           lineNumber, columnNumber)
  -                                                                             
 : new ElemVariable(m_constructionContext,
  -                                                                             
                                        m_stylesheet,
  -                                                                             
                                        atts, 
  -                                                                             
                                        lineNumber, columnNumber);
  -
  -                     XalanAutoPtr<ElemTemplateElement>       newVar(elem);
  +                     ElemTemplateElement* const      elem = 
m_constructionContext.createElement(
  +                                                                             
                xslToken,
  +                                                                             
                m_stylesheet,
  +                                                                             
                atts,
  +                                                                             
                locator);
  +                     assert(elem != 0);
   
                        checkForOrAddVariableName(elem->getNameAttribute(), 
locator);
   
  @@ -972,9 +752,6 @@
                        m_inTemplate = true; // fake it out
                        
m_inScopeVariableNamesStack.push_back(QNameSetVectorType::value_type());
                        elem->addToStylesheet(m_constructionContext, 
m_stylesheet);
  -                     m_elemStackParentedElements.insert(elem);
  -
  -                     newVar.release();
                }
        break;
   
  @@ -998,13 +775,12 @@
                        m_inTemplate = true; // fake it out
                        
m_inScopeVariableNamesStack.push_back(QNameSetVectorType::value_type());
   
  -                     ElemAttributeSet* attrSet = new 
ElemAttributeSet(m_constructionContext,
  -                                                                             
                                           m_stylesheet,
  -                                                                             
                                           atts,
  -                                                                             
                                           lineNumber,
  -                                                                             
                                           columnNumber);
  -             
  -                     m_elemStack.push_back(attrSet);
  +                     m_elemStack.push_back(
  +                             m_constructionContext.createElement(
  +                                     xslToken,
  +                                     m_stylesheet,
  +                                     atts,
  +                                     locator));
                }
                break;
   
  @@ -1022,12 +798,9 @@
   
        case StylesheetConstructionContext::ELEMNAME_DECIMAL_FORMAT:
                m_stylesheet.processDecimalFormatElement(
  -                                     new ElemDecimalFormat(
                                                        m_constructionContext,
  -                                                     m_stylesheet,
                                                        atts,
  -                                                     lineNumber,
  -                                                     columnNumber));
  +                                                     locator);
                break;
   
        case StylesheetConstructionContext::ELEMNAME_NAMESPACE_ALIAS:
  @@ -1082,7 +855,6 @@
                        bool&                                   fPreserveSpace,
                        bool&                                   
fSpaceAttrProcessed)
   {
  -     m_stylesheet.setWrapperless(false);
        m_foundStylesheet = true;
   
        const unsigned int      nAttrs = atts.getLength();
  @@ -1112,9 +884,7 @@
   
                                const XalanDOMString&   extns = 
getNamespaceForPrefixFromStack(prefix);
   
  -                             ExtensionNSHandler* const       nsh = new 
ExtensionNSHandler(extns);
  -
  -                             
m_stylesheet.addExtensionNamespace(m_constructionContext, extns, nsh);
  +                             
m_stylesheet.processExtensionNamespace(m_constructionContext, extns);
                        }
                }
                else if(equals(aname, Constants::ATTRNAME_ID))
  @@ -1323,8 +1093,6 @@
                                locator);
                }
        }
  -
  -     m_elemStackParentedElements.insert(elem);
   }
   
   
  @@ -1339,14 +1107,6 @@
                --m_locatorsPushed;
        }
   
  -     // Pop anything that's not an empty element...
  -     while(m_elemStack.empty() == false &&
  -               m_elemStack.back()->getXSLToken() != 
StylesheetConstructionContext::ELEMNAME_UNDEFINED)
  -     {
  -             m_elemStackParentedElements.erase(m_elemStack.back());
  -             m_elemStack.pop_back();
  -     }
  -
        m_lastPopped = 0;
   }
   
  @@ -1524,9 +1284,9 @@
        processAccumulatedText();
   
        // Clean up the whitespace elements.
  -     for_each(m_whiteSpaceElems.begin(),
  -                      m_whiteSpaceElems.end(),
  -                      DeleteFunctor<ElemTextLiteral>());
  +//   for_each(m_whiteSpaceElems.begin(),
  +//                    m_whiteSpaceElems.end(),
  +//                    DeleteFunctor<ElemTemplateElement>());
   
        m_whiteSpaceElems.clear();
   
  @@ -1539,7 +1299,6 @@
        assert(m_lastPopped != 0);
   
        m_elemStack.pop_back();
  -     m_elemStackParentedElements.erase(m_lastPopped.get());
        m_lastPopped->finishedConstruction();
   
        const int tok = m_lastPopped->getXSLToken();
  @@ -1663,7 +1422,6 @@
                        const XMLCh* const      /* chars */,
                        const unsigned int      /* length */)
   {
  -  // No action for the moment.
   }
   
   
  @@ -1697,19 +1455,16 @@
   
                const Locator* const    locator = 
m_constructionContext.getLocatorFromStack();
   
  -             const XalanLocator::size_type   lineNumber = (0 != locator) ? 
locator->getLineNumber() : 0;
  -             const XalanLocator::size_type   columnNumber = (0 != locator) ? 
locator->getColumnNumber() : 0;
  -
  -             XalanAutoPtr<ElemTextLiteral>   elem(new 
ElemTextLiteral(m_constructionContext,
  -                     m_stylesheet,
  -                     lineNumber,
  -                     columnNumber,
  -                     chars,
  -                     0,
  -                     length,
  -                     true,
  -                     preserveSpace, 
  -                     disableOutputEscaping));
  +             ElemTemplateElement* const      elem =
  +                     m_constructionContext.createElement(
  +                             m_stylesheet,
  +                             chars,
  +                             length,
  +                             true,
  +                             preserveSpace, 
  +                             disableOutputEscaping,
  +                             locator);
  +             assert(elem != 0);
   
                const bool      isWhite = elem->isWhitespace();
   
  @@ -1728,13 +1483,11 @@
   
                        appendChildElementToParent(
                                parent,
  -                             elem.get());
  -
  -                     elem.release();
  +                             elem);
                }
                else if(isWhite)
                {
  -                     bool                                            
shouldPush = true;
  +                     bool    shouldPush = true;
   
                        ElemTemplateElement* const      last = 
parent->getLastChildElem();
   
  @@ -1751,9 +1504,7 @@
                                {
                                        appendChildElementToParent(
                                                parent,
  -                                             elem.get());
  -
  -                                     elem.release();
  +                                             elem);
   
                                        shouldPush = false;
                                }
  @@ -1761,9 +1512,7 @@
   
                        if(shouldPush)
                        {
  -                             m_whiteSpaceElems.push_back(elem.get());
  -
  -                             elem.release();
  +                             m_whiteSpaceElems.push_back(elem);
                        }
                }
        }
  @@ -1947,7 +1696,6 @@
   
StylesheetHandler::PushPopIncludeState::PushPopIncludeState(StylesheetHandler&  
     theHandler) :
        m_handler(theHandler),
        m_elemStack(theHandler.m_elemStack),
  -     m_elemStackParentedElements(theHandler.m_elemStackParentedElements),
        m_pTemplate(theHandler.m_pTemplate),
        m_lastPopped(theHandler),
        m_inTemplate(theHandler.m_inTemplate),
  @@ -1995,7 +1743,6 @@
   
        clear(m_handler.m_accumulateText);
        m_handler.m_elemStack = m_elemStack;
  -     m_handler.m_elemStackParentedElements = m_elemStackParentedElements;
        m_handler.m_pTemplate = m_pTemplate;
   
        m_lastPopped.swap(m_handler.m_lastPopped);
  
  
  
  1.40      +5 -18     xml-xalan/c/src/XSLT/StylesheetHandler.hpp
  
  Index: StylesheetHandler.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetHandler.hpp,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- StylesheetHandler.hpp     3 Nov 2002 05:51:22 -0000       1.39
  +++ StylesheetHandler.hpp     5 Nov 2002 05:19:25 -0000       1.40
  @@ -111,17 +111,14 @@
   
   #if defined(XALAN_NO_NAMESPACES)
        typedef vector<ElemTemplateElement*>            ElemTemplateStackType;
  -     typedef vector<ElemTextLiteral*>                        
ElemTextLiteralStackType;
  -     typedef set<ElemTemplateElement*,
  -                             less<ElemTemplateElement*> >    
ElemTemplateSetType;
  +     typedef vector<ElemTemplateElement*>            
ElemTextLiteralStackType;
        typedef vector<bool>                                            
BoolStackType;
        typedef set<XalanQNameByReference,
                                less<XalanQName> >                              
QNameSetType;
        typedef vector<QNameSetType>                            
QNameSetVectorType;
   #else
        typedef std::vector<ElemTemplateElement*>       ElemTemplateStackType;
  -     typedef std::vector<ElemTextLiteral*>           
ElemTextLiteralStackType;
  -     typedef std::set<ElemTemplateElement*>          ElemTemplateSetType;
  +     typedef std::vector<ElemTemplateElement*>       
ElemTextLiteralStackType;
        typedef std::vector<bool>                                       
BoolStackType;
        typedef std::set<XalanQNameByReference,
                                         std::less<XalanQName> >        
QNameSetType;
  @@ -603,13 +600,6 @@
        ElemTemplateStackType   m_elemStack;
   
        /**
  -      * The set of elements in m_elemStack which have already
  -      * been parented.  This prevents us from deleting them
  -      * twice if an exception is thrown.
  -      */
  -     ElemTemplateSetType             m_elemStackParentedElements;
  -
  -     /**
         * Need to keep a stack of found whitespace elements so that 
         * whitespace elements next to non-whitespace elements can 
         * be merged.  For instance: &lt;out> &lt;![CDATA[test]]> &lt;/out>
  @@ -619,7 +609,7 @@
        /**
         * The current template.
         */
  -     ElemTemplate* m_pTemplate;
  +     ElemTemplateElement*    m_pTemplate;
   
        class LastPoppedHolder
        {
  @@ -766,8 +756,7 @@
        initWrapperless(
                        const XalanDOMChar*             name,
                        const AttributeList&    atts,
  -                     int                                             
lineNumber,
  -                     int                                             
columnNumber);
  +                     const Locator*                  locator);
   
        const XalanDOMString&
        getNamespaceFromStack(const XalanDOMChar*       theName) const;
  @@ -793,9 +782,7 @@
   
                ElemTemplateStackType                           m_elemStack;
   
  -             ElemTemplateSetType                                     
m_elemStackParentedElements;
  -
  -             ElemTemplate* const                                     
m_pTemplate;
  +             ElemTemplateElement* const                      m_pTemplate;
   
                LastPoppedHolder                                        
m_lastPopped;           
   
  
  
  
  1.67      +48 -43    xml-xalan/c/src/XSLT/StylesheetRoot.cpp
  
  Index: StylesheetRoot.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetRoot.cpp,v
  retrieving revision 1.66
  retrieving revision 1.67
  diff -u -r1.66 -r1.67
  --- StylesheetRoot.cpp        3 Nov 2002 03:41:06 -0000       1.66
  +++ StylesheetRoot.cpp        5 Nov 2002 05:19:25 -0000       1.67
  @@ -156,9 +156,6 @@
   
   StylesheetRoot::~StylesheetRoot()
   {
  -     delete m_defaultRule;
  -     delete m_defaultTextRule;
  -     delete m_defaultRootRule;
   }
   
   
  @@ -169,6 +166,8 @@
        // Chain-up first...
        Stylesheet::postConstruction(constructionContext);
   
  +     initDefaultRule(constructionContext);
  +
        // We may need to build keys, since we may have inherited them from
        // our imports.
        if (m_needToBuildKeysTable == false && m_keyDeclarations.empty() == 
false)
  @@ -199,8 +198,12 @@
                        XSLTResultTarget&                               
outputTarget,
                        StylesheetExecutionContext&             
executionContext) const
   {
  +     assert(m_defaultRule != 0);
  +     assert(m_defaultTextRule != 0);
  +     assert(m_defaultRootRule != 0);
  +
        // Find the root pattern in the XSL.
  -     const ElemTemplate*             rootRule =
  +     const ElemTemplateElement*              rootRule =
                        findTemplate(executionContext, sourceTree);
   
        if(0 == rootRule)
  @@ -615,33 +618,32 @@
                assert(m_defaultTextRule == 0);
                assert(m_defaultRootRule == 0);
   
  -             const int                               lineNumber = 0;
  -             const int                               columnNumber = 0;
  -
                AttributeListImpl               attrs;
   
                attrs.addAttribute(c_wstr(Constants::ATTRNAME_MATCH),
                                                   
c_wstr(Constants::ATTRTYPE_CDATA),
                                                   XPath::PSEUDONAME_ANY);
   
  -             m_defaultRule = new ElemTemplate(constructionContext,
  -                                                                             
 *this,
  -                                                                             
 attrs,
  -                                                                             
 lineNumber,
  -                                                                             
 columnNumber);
  +             m_defaultRule =
  +                     constructionContext.createElement(
  +                             
StylesheetConstructionContext::ELEMNAME_TEMPLATE,
  +                             *this,
  +                             attrs);
  +             assert(m_defaultRule != 0);
   
                attrs.clear();
   
  -             ElemApplyTemplates* childrenElement 
  -               = new ElemApplyTemplates(constructionContext,
  -                                                                *this,
  -                                                                attrs,
  -                                                                lineNumber,
  -                                                                
columnNumber);
  +             ElemTemplateElement*    childrenElement =
  +                     constructionContext.createElement(
  +                             
StylesheetConstructionContext::ELEMNAME_APPLY_TEMPLATES,
  +                             *this,
  +                             attrs);
  +             assert(childrenElement != 0);
   
  -             childrenElement->setDefaultTemplate(true);
                m_defaultRule->appendChildElem(childrenElement);
   
  +             m_defaultRule->setDefaultTemplate(true);
  +
                // -----------------------------
   
                attrs.clear();
  @@ -649,25 +651,28 @@
                                                   
c_wstr(Constants::ATTRTYPE_CDATA),
                                                   
c_wstr(Constants::ATTRVAL_DEFAULT_TEXT_RULE));
   
  -             m_defaultTextRule = new ElemTemplate(constructionContext,
  -                                                                             
         *this,
  -                                                                             
         attrs,
  -                                                                             
         lineNumber,
  -                                                                             
         columnNumber);
  +             m_defaultTextRule =
  +                     constructionContext.createElement(
  +                             
StylesheetConstructionContext::ELEMNAME_TEMPLATE,
  +                             *this,
  +                             attrs);
  +             assert(m_defaultTextRule != 0);
   
                attrs.clear();
                attrs.addAttribute(c_wstr(Constants::ATTRNAME_SELECT),
                                                   
c_wstr(Constants::ATTRTYPE_CDATA),
                                                   
c_wstr(Constants::ATTRVAL_THIS));
   
  -             ElemValueOf* elemValueOf =
  -                     new ElemValueOf(constructionContext,
  -                                                     *this,
  -                                                     attrs,
  -                                                     lineNumber,
  -                                                     columnNumber);
  +             childrenElement =
  +                     constructionContext.createElement(
  +                             
StylesheetConstructionContext::ELEMNAME_VALUE_OF,
  +                             *this,
  +                             attrs);
  +             assert(childrenElement != 0);
  +
  +             m_defaultTextRule->appendChildElem(childrenElement);
   
  -             m_defaultTextRule->appendChildElem(elemValueOf);
  +             m_defaultTextRule->setDefaultTemplate(true);
   
                //--------------------------------
       
  @@ -677,24 +682,24 @@
                                                   XPath::PSEUDONAME_ROOT);
   
                m_defaultRootRule =
  -                     new ElemTemplate(constructionContext,
  -                                                      *this,
  -                                                      attrs,
  -                                                      lineNumber,
  -                                                      columnNumber);
  +                     constructionContext.createElement(
  +                             
StylesheetConstructionContext::ELEMNAME_TEMPLATE,
  +                             *this,
  +                             attrs);
  +             assert(m_defaultRootRule != 0);
   
                attrs.clear();
   
                childrenElement =
  -                     new ElemApplyTemplates(constructionContext,
  -                                                                *this,
  -                                                                attrs,
  -                                                                lineNumber,
  -                                                                
columnNumber);
  -
  -             childrenElement->setDefaultTemplate(true);
  +                     constructionContext.createElement(
  +                             
StylesheetConstructionContext::ELEMNAME_APPLY_TEMPLATES,
  +                             *this,
  +                             attrs);
  +             assert(childrenElement != 0);
   
                m_defaultRootRule->appendChildElem(childrenElement);
  +
  +             m_defaultRootRule->setDefaultTemplate(true);
        }
   
        assert(m_defaultRule != 0);
  
  
  
  1.23      +65 -65    xml-xalan/c/src/XSLT/StylesheetRoot.hpp
  
  Index: StylesheetRoot.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetRoot.hpp,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- StylesheetRoot.hpp        31 Oct 2002 07:15:56 -0000      1.22
  +++ StylesheetRoot.hpp        5 Nov 2002 05:19:25 -0000       1.23
  @@ -263,7 +263,7 @@
         *
         * @return pointer to template rule for text
         */
  -     ElemTemplate* 
  +     ElemTemplateElement*
        getDefaultTextRule() const
        {
                return m_defaultTextRule;
  @@ -274,7 +274,7 @@
         *
         * @return pointer to default template rule
         */
  -     ElemTemplate* 
  +     ElemTemplateElement*
        getDefaultRule() const
        {
                return m_defaultRule;
  @@ -285,7 +285,7 @@
         *
         * @return pointer to default root template rule
         */
  -     ElemTemplate* 
  +     ElemTemplateElement*
        getDefaultRootRule() const
        {
                return m_defaultRootRule;
  @@ -305,65 +305,6 @@
                        StylesheetConstructionContext&  constructionContext);
   
        /**
  -      * Create the default rule if needed.
  -      *
  -      * @param constructionContext context for construction of object
  -      */
  -     void 
  -     initDefaultRule(StylesheetConstructionContext&  constructionContext);
  -
  -     /**
  -      * The version tells the version of XML to be used for outputting the 
result tree,
  -      * as specified in xsl:output.
  -      */
  -     XalanDOMString  m_version;
  -
  -     /**
  -      * indent-result is by default no, which means an XSL processor must not
  -      * change the whitespace on output.
  -      */
  -     bool                    m_indentResult;
  -
  -     /**
  -      * The encoding attribute specifies the preferred encoding to use 
  -      * for outputting the result tree. 
  -      */
  -     XalanDOMString  m_encoding;
  -
  -     /**
  -      * The media-type attribute is applicable for the xml output method. 
  -      * The default value for the media-type attribute is text/xml.
  -      */
  -     XalanDOMString  m_mediatype;
  -
  -     /**
  -      * If the doctype-system-id attribute is specified, the xml output 
method should 
  -      * output a document type declaration immediately before the first 
element. 
  -      * The name following <!DOCTYPE should be the name of the first 
element. 
  -      */
  -     XalanDOMString  m_doctypeSystem;
  -
  -     /**
  -      * If doctype-public-id attribute is also specified, then the xml 
output 
  -      * method should output PUBLIC followed by the public identifier and 
then 
  -      * the system identifier; otherwise, it should output SYSTEM followed 
by 
  -      * the system identifier. The internal subset should be empty. The 
  -      * doctype-public-id attribute should be ignored unless the 
doctype-system-id 
  -      * attribute is specified.
  -      */
  -     XalanDOMString  m_doctypePublic;
  -
  -     /**
  -      * Tells whether or not to output an XML declaration.
  -      */
  -     bool                    m_omitxmlDecl;
  -
  -     /**
  -      * Tells what the xmldecl should specify for the standalone value.
  -     */
  -     XalanDOMString  m_standalone;
  -
  -     /**
         * Retrieve the stack of imported stylesheets.
         * 
         * @return stack of URIs for stylesheets
  @@ -464,6 +405,65 @@
   private:
   
        /**
  +      * Create the default rule if needed.
  +      *
  +      * @param constructionContext context for construction of object
  +      */
  +     void 
  +     initDefaultRule(StylesheetConstructionContext&  constructionContext);
  +
  +     /**
  +      * The version tells the version of XML to be used for outputting the 
result tree,
  +      * as specified in xsl:output.
  +      */
  +     XalanDOMString  m_version;
  +
  +     /**
  +      * indent-result is by default no, which means an XSL processor must not
  +      * change the whitespace on output.
  +      */
  +     bool                    m_indentResult;
  +
  +     /**
  +      * The encoding attribute specifies the preferred encoding to use 
  +      * for outputting the result tree. 
  +      */
  +     XalanDOMString  m_encoding;
  +
  +     /**
  +      * The media-type attribute is applicable for the xml output method. 
  +      * The default value for the media-type attribute is text/xml.
  +      */
  +     XalanDOMString  m_mediatype;
  +
  +     /**
  +      * If the doctype-system-id attribute is specified, the xml output 
method should 
  +      * output a document type declaration immediately before the first 
element. 
  +      * The name following <!DOCTYPE should be the name of the first 
element. 
  +      */
  +     XalanDOMString  m_doctypeSystem;
  +
  +     /**
  +      * If doctype-public-id attribute is also specified, then the xml 
output 
  +      * method should output PUBLIC followed by the public identifier and 
then 
  +      * the system identifier; otherwise, it should output SYSTEM followed 
by 
  +      * the system identifier. The internal subset should be empty. The 
  +      * doctype-public-id attribute should be ignored unless the 
doctype-system-id 
  +      * attribute is specified.
  +      */
  +     XalanDOMString  m_doctypePublic;
  +
  +     /**
  +      * Tells whether or not to output an XML declaration.
  +      */
  +     bool                    m_omitxmlDecl;
  +
  +     /**
  +      * Tells what the xmldecl should specify for the standalone value.
  +     */
  +     XalanDOMString  m_standalone;
  +
  +     /**
         * The URL that belongs to the result namespace.
         * @serial
         */
  @@ -493,19 +493,19 @@
         * The default template to use for text nodes if we don't find 
         * anything else.  This is initialized in initDefaultRule().
         */
  -     ElemTemplate*                           m_defaultTextRule;
  +     ElemTemplateElement*            m_defaultTextRule;
   
        /**
         * The default template to use if we don't find anything
         * else.  This is initialized in initDefaultRule().
         */
  -     ElemTemplate*                           m_defaultRule;
  +     ElemTemplateElement*            m_defaultRule;
   
        /**
         * The default template to use for the root if we don't find 
         * anything else.  This is initialized in initDefaultRule().
         */
  -     ElemTemplate*                           m_defaultRootRule;
  +     ElemTemplateElement*            m_defaultRootRule;
   
        /**
         * This is set to true if an xsl:key directive is found.
  
  
  
  1.2       +2 -0      xml-xalan/c/src/XSLT/XalanElemEmptyAllocator.hpp
  
  Index: XalanElemEmptyAllocator.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/XalanElemEmptyAllocator.hpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XalanElemEmptyAllocator.hpp       3 Nov 2002 05:50:37 -0000       1.1
  +++ XalanElemEmptyAllocator.hpp       5 Nov 2002 05:19:25 -0000       1.2
  @@ -100,6 +100,8 @@
         * @param lineNumber The line number in the document
         * @param columnNumber The column number in the document
         * @param elementName The name of element.  Can be 0.
  +      *
  +      * @return A pointer to the new instance.
         */
        data_type*
        create(
  
  
  
  1.2       +2 -0      xml-xalan/c/src/XSLT/XalanElemTextAllocator.hpp
  
  Index: XalanElemTextAllocator.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/XalanElemTextAllocator.hpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XalanElemTextAllocator.hpp        3 Nov 2002 05:50:37 -0000       1.1
  +++ XalanElemTextAllocator.hpp        5 Nov 2002 05:19:25 -0000       1.2
  @@ -100,6 +100,8 @@
         * @param atts The list of attributes for the element
         * @param lineNumber The line number in the document
         * @param columnNumber The column number in the document
  +      *
  +      * @return A pointer to the new instance.
         */
        data_type*
        create(
  
  
  
  1.1                  xml-xalan/c/src/XSLT/XalanElemLiteralResultAllocator.cpp
  
  Index: XalanElemLiteralResultAllocator.cpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  // Class header file.
  #include "XalanElemLiteralResultAllocator.hpp"
  
  
  
  XalanElemLiteralResultAllocator::XalanElemLiteralResultAllocator(size_type    
theBlockCount) :
        m_allocator(theBlockCount)
  {
  }
  
  
  
  XalanElemLiteralResultAllocator::~XalanElemLiteralResultAllocator()
  {
  }
  
  
  
  XalanElemLiteralResultAllocator::data_type*
  XalanElemLiteralResultAllocator::create(
                        StylesheetConstructionContext&  constructionContext,
                        Stylesheet&                                             
stylesheetTree,
                        const XalanDOMChar*                             name,
                        const AttributeList&                    atts,
                        int                                                     
        lineNumber,
                        int                                                     
        columnNumber)
  {
        data_type* const        theBlock = m_allocator.allocateBlock();
        assert(theBlock != 0);
  
        data_type* const        theResult =
                new(theBlock) data_type(
                                constructionContext,
                                stylesheetTree,
                                name,
                                atts,
                                lineNumber,
                                columnNumber);
  
        m_allocator.commitAllocation(theBlock);
  
        return theResult;
  }
  
  
  
  1.1                  xml-xalan/c/src/XSLT/XalanElemLiteralResultAllocator.hpp
  
  Index: XalanElemLiteralResultAllocator.hpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  #if !defined(XALANELEMLITERALRESULTALLOCATOR_INCLUDE_GUARD_12455133)
  #define XALANELEMLITERALRESULTALLOCATOR_INCLUDE_GUARD_12455133
  
  
  
  // Base include file.  Must be first.
  #include <XSLT/XSLTDefinitions.hpp>
  
  
  
  #include <XSLT/ElemLiteralResult.hpp>
  
  
  
  #include <PlatformSupport/ArenaAllocator.hpp>
  
  
  
  class XALAN_XSLT_EXPORT XalanElemLiteralResultAllocator
  {
  public:
  
        typedef ElemLiteralResult                                       
data_type;
  
  #if defined(XALAN_NO_DEFAULT_TEMPLATE_ARGUMENTS)
        typedef ArenaBlock<data_type>                           ArenaBlockType;
        typedef ArenaAllocator<data_type,
                                                   ArenaBlockType>              
ArenaAllocatorType;
  #else
        typedef ArenaAllocator<data_type>                       
ArenaAllocatorType;
  #endif
  
        typedef ArenaAllocatorType::size_type           size_type;
  
        /**
         * Construct an instance that will allocate blocks of the specified 
size.
         *
         * @param theBlockSize The block size.
         */
        XalanElemLiteralResultAllocator(size_type               theBlockCount);
  
        ~XalanElemLiteralResultAllocator();
        
        /**
         * Construct an instance
         * 
         * @param constructionContext context for construction of object
         * @param stylesheetTree      stylesheet containing element
         * @param name                name of element
         * @param atts                list of attributes for element
         * @param lineNumber                            line number in document
         * @param columnNumber                  column number in document
         *
         * @return A pointer to the new instance.
         */
        data_type*
        create(
                        StylesheetConstructionContext&  constructionContext,
                        Stylesheet&                                             
stylesheetTree,
                        const XalanDOMChar*                             name,
                        const AttributeList&                    atts,
                        int                                                     
        lineNumber,
                        int                                                     
        columnNumber);
  
        /**
         * Determine if an object is owned by the allocator...
         */
        bool
        ownsObject(const data_type*             theObject)
        {
                return m_allocator.ownsObject(theObject);
        }
  
        /**
         * Delete all objects from the allocator.        
         */     
        void
        reset()
        {
                m_allocator.reset();
        }
  
        /**
         * Get the number of ArenaBlocks currently allocated.
         *
         * @return The number of blocks.
         */
        size_type
        getBlockCount() const
        {
                return m_allocator.getBlockCount();
        }
  
        /**
         * Get size of an ArenaBlock, that is, the number
         * of objects in each block.
         *
         * @return The size of the block
         */
        size_type
        getBlockSize() const
        {
                return m_allocator.getBlockSize();
        }
  
  private:
  
        // Not implemented...
        XalanElemLiteralResultAllocator(const XalanElemLiteralResultAllocator&);
  
        XalanElemLiteralResultAllocator&
        operator=(const XalanElemLiteralResultAllocator&);
  
        // Data members...
        ArenaAllocatorType      m_allocator;
  };
  
  
  
  #endif        // XALANELEMLITERALRESULTALLOCATOR_INCLUDE_GUARD_12455133
  
  
  
  1.1                  xml-xalan/c/src/XSLT/XalanElemTemplateAllocator.cpp
  
  Index: XalanElemTemplateAllocator.cpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  // Class header file.
  #include "XalanElemTemplateAllocator.hpp"
  
  
  
  XalanElemTemplateAllocator::XalanElemTemplateAllocator(size_type      
theBlockCount) :
        m_allocator(theBlockCount)
  {
  }
  
  
  
  XalanElemTemplateAllocator::~XalanElemTemplateAllocator()
  {
  }
  
  
  
  XalanElemTemplateAllocator::data_type*
  XalanElemTemplateAllocator::create(
                        StylesheetConstructionContext&  constructionContext,
                        Stylesheet&                                             
stylesheetTree,
                        const AttributeList&                    atts,
                        int                                                     
        lineNumber,
                        int                                                     
        columnNumber)
  {
        data_type* const        theBlock = m_allocator.allocateBlock();
        assert(theBlock != 0);
  
        data_type* const        theResult =
                new(theBlock) data_type(
                                constructionContext,
                                stylesheetTree,
                                atts,
                                lineNumber,
                                columnNumber);
  
        m_allocator.commitAllocation(theBlock);
  
        return theResult;
  }
  
  
  
  1.1                  xml-xalan/c/src/XSLT/XalanElemTemplateAllocator.hpp
  
  Index: XalanElemTemplateAllocator.hpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  #if !defined(XALANELEMTEMPLATEALLOCATOR_INCLUDE_GUARD_12455133)
  #define XALANELEMTEMPLATEALLOCATOR_INCLUDE_GUARD_12455133
  
  
  
  // Base include file.  Must be first.
  #include <XSLT/XSLTDefinitions.hpp>
  
  
  
  #include <XSLT/ElemTemplate.hpp>
  
  
  
  #include <PlatformSupport/ArenaAllocator.hpp>
  
  
  
  class XALAN_XSLT_EXPORT XalanElemTemplateAllocator
  {
  public:
  
        typedef ElemTemplate                                            
data_type;
  
  #if defined(XALAN_NO_DEFAULT_TEMPLATE_ARGUMENTS)
        typedef ArenaBlock<data_type>                           ArenaBlockType;
        typedef ArenaAllocator<data_type,
                                                   ArenaBlockType>              
ArenaAllocatorType;
  #else
        typedef ArenaAllocator<data_type>                       
ArenaAllocatorType;
  #endif
  
        typedef ArenaAllocatorType::size_type           size_type;
  
        /**
         * Construct an instance that will allocate blocks of the specified 
size.
         *
         * @param theBlockSize The block size.
         */
        XalanElemTemplateAllocator(size_type            theBlockCount);
  
        ~XalanElemTemplateAllocator();
        
        /**
         * Construct an instance
         * 
         * @param constructionContext context for construction of object
         * @param stylesheetTree      stylesheet containing element
         * @param atts                list of attributes for element
         * @param lineNumber                            line number in document
         * @param columnNumber                  column number in document
         *
         * @return A pointer to the new instance.
         */
        data_type*
        create(
                        StylesheetConstructionContext&  constructionContext,
                        Stylesheet&                                             
stylesheetTree,
                        const AttributeList&                    atts,
                        int                                                     
        lineNumber,
                        int                                                     
        columnNumber);
  
        /**
         * Determine if an object is owned by the allocator...
         */
        bool
        ownsObject(const data_type*             theObject)
        {
                return m_allocator.ownsObject(theObject);
        }
  
        /**
         * Delete all objects from the allocator.        
         */     
        void
        reset()
        {
                m_allocator.reset();
        }
  
        /**
         * Get the number of ArenaBlocks currently allocated.
         *
         * @return The number of blocks.
         */
        size_type
        getBlockCount() const
        {
                return m_allocator.getBlockCount();
        }
  
        /**
         * Get size of an ArenaBlock, that is, the number
         * of objects in each block.
         *
         * @return The size of the block
         */
        size_type
        getBlockSize() const
        {
                return m_allocator.getBlockSize();
        }
  
  private:
  
        // Not implemented...
        XalanElemTemplateAllocator(const XalanElemTemplateAllocator&);
  
        XalanElemTemplateAllocator&
        operator=(const XalanElemTemplateAllocator&);
  
        // Data members...
        ArenaAllocatorType      m_allocator;
  };
  
  
  
  #endif        // XALANELEMTEMPLATEALLOCATOR_INCLUDE_GUARD_12455133
  
  
  
  1.1                  xml-xalan/c/src/XSLT/XalanElemTextLiteralAllocator.cpp
  
  Index: XalanElemTextLiteralAllocator.cpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  // Class header file.
  #include "XalanElemTextLiteralAllocator.hpp"
  
  
  
  XalanElemTextLiteralAllocator::XalanElemTextLiteralAllocator(size_type        
theBlockCount) :
        m_allocator(theBlockCount)
  {
  }
  
  
  
  XalanElemTextLiteralAllocator::~XalanElemTextLiteralAllocator()
  {
  }
  
  
  
  XalanElemTextLiteralAllocator::data_type*
  XalanElemTextLiteralAllocator::create(
                        StylesheetConstructionContext&  constructionContext,
                        Stylesheet&                                             
stylesheetTree,
                        int                                                     
        lineNumber,
                        int                                                     
        columnNumber,
              const XalanDOMChar*                               ch,
                        XalanDOMString::size_type               start,
                        XalanDOMString::size_type               length,
              bool                                                      isCData,
                        bool                                                    
preserveSpace,
              bool                                                      
disableOutputEscaping)
  {
        data_type* const        theBlock = m_allocator.allocateBlock();
        assert(theBlock != 0);
  
        data_type* const        theResult =
                new(theBlock) data_type(
                                constructionContext,
                                stylesheetTree,
                                lineNumber,
                                columnNumber,
                                ch,
                                start,
                                length,
                                isCData,
                                preserveSpace,
                                disableOutputEscaping);
  
        m_allocator.commitAllocation(theBlock);
  
        return theResult;
  }
  
  
  
  1.1                  xml-xalan/c/src/XSLT/XalanElemTextLiteralAllocator.hpp
  
  Index: XalanElemTextLiteralAllocator.hpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  #if !defined(XALANELEMTEXTLITERALALLOCATOR_INCLUDE_GUARD_12455133)
  #define XALANELEMTEXTLITERALALLOCATOR_INCLUDE_GUARD_12455133
  
  
  
  // Base include file.  Must be first.
  #include <XSLT/XSLTDefinitions.hpp>
  
  
  
  #include <XSLT/ElemTextLiteral.hpp>
  
  
  
  #include <PlatformSupport/ReusableArenaAllocator.hpp>
  
  
  
  class XALAN_XSLT_EXPORT XalanElemTextLiteralAllocator
  {
  public:
  
        typedef ElemTextLiteral                                         
data_type;
  
  #if defined(XALAN_NO_DEFAULT_TEMPLATE_ARGUMENTS)
        typedef ArenaBlock<data_type>                           ArenaBlockType;
        typedef ArenaAllocator<data_type,
                                                   ArenaBlockType>              
ArenaAllocatorType;
  #else
        typedef ArenaAllocator<data_type>                       
ArenaAllocatorType;
  #endif
  
        typedef ArenaAllocatorType::size_type           size_type;
  
        /**
         * Construct an instance that will allocate blocks of the specified 
size.
         *
         * @param theBlockSize The block size.
         */
        XalanElemTextLiteralAllocator(size_type         theBlockCount);
  
        ~XalanElemTextLiteralAllocator();
        
        /**
         * Construct an instance
         * 
         * @param constructionContext   context for construction of object
         * @param stylesheetTree        stylesheet containing element
         * @param lineNumber            line number in document
         * @param columnNumber          column number in document
         * @param ch                    pointer to character string for element
         * @param start                 starting offset of element
         * @param length                number of characters in element
         * @param isCData               true if a CDATA element
         * @param preserveSpace         true is space should be preserved
         * @param disableOutputEscaping true if output escaping should be 
disabled
         *
         * @return A pointer to the new instance.
         */
        data_type*
        create(
                        StylesheetConstructionContext&  constructionContext,
                        Stylesheet&                                             
stylesheetTree,
                        int                                                     
        lineNumber,
                        int                                                     
        columnNumber,
              const XalanDOMChar*                               ch,
                        XalanDOMString::size_type               start,
                        XalanDOMString::size_type               length,
              bool                                                      isCData,
                        bool                                                    
preserveSpace,
              bool                                                      
disableOutputEscaping);
  
        /**
         * Determine if an object is owned by the allocator...
         */
        bool
        ownsObject(const data_type*             theObject)
        {
                return m_allocator.ownsObject(theObject);
        }
  
        /**
         * Delete all objects from the allocator.        
         */     
        void
        reset()
        {
                m_allocator.reset();
        }
  
        /**
         * Get the number of ArenaBlocks currently allocated.
         *
         * @return The number of blocks.
         */
        size_type
        getBlockCount() const
        {
                return m_allocator.getBlockCount();
        }
  
        /**
         * Get size of an ArenaBlock, that is, the number
         * of objects in each block.
         *
         * @return The size of the block
         */
        size_type
        getBlockSize() const
        {
                return m_allocator.getBlockSize();
        }
  
  private:
  
        // Not implemented...
        XalanElemTextLiteralAllocator(const XalanElemTextLiteralAllocator&);
  
        XalanElemTextLiteralAllocator&
        operator=(const XalanElemTextLiteralAllocator&);
  
        // Data members...
        ArenaAllocatorType      m_allocator;
  };
  
  
  
  #endif        // XALANELEMTEXTLITERALALLOCATOR_INCLUDE_GUARD_12455133
  
  
  
  1.1                  xml-xalan/c/src/XSLT/XalanElemValueOfAllocator.cpp
  
  Index: XalanElemValueOfAllocator.cpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  // Class header file.
  #include "XalanElemValueOfAllocator.hpp"
  
  
  
  XalanElemValueOfAllocator::XalanElemValueOfAllocator(size_type        
theBlockCount) :
        m_allocator(theBlockCount)
  {
  }
  
  
  
  XalanElemValueOfAllocator::~XalanElemValueOfAllocator()
  {
  }
  
  
  
  XalanElemValueOfAllocator::data_type*
  XalanElemValueOfAllocator::create(
                        StylesheetConstructionContext&  constructionContext,
                        Stylesheet&                                             
stylesheetTree,
                        const AttributeList&                    atts,
                        int                                                     
        lineNumber,
                        int                                                     
        columnNumber)
  {
        data_type* const        theBlock = m_allocator.allocateBlock();
        assert(theBlock != 0);
  
        data_type* const        theResult =
                new(theBlock) data_type(
                                constructionContext,
                                stylesheetTree,
                                atts,
                                lineNumber,
                                columnNumber);
  
        m_allocator.commitAllocation(theBlock);
  
        return theResult;
  }
  
  
  
  1.1                  xml-xalan/c/src/XSLT/XalanElemValueOfAllocator.hpp
  
  Index: XalanElemValueOfAllocator.hpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  #if !defined(XALANELEMVALUEOFALLOCATOR_INCLUDE_GUARD_12455133)
  #define XALANELEMVALUEOFALLOCATOR_INCLUDE_GUARD_12455133
  
  
  
  // Base include file.  Must be first.
  #include <XSLT/XSLTDefinitions.hpp>
  
  
  
  #include <XSLT/ElemValueOf.hpp>
  
  
  
  #include <PlatformSupport/ArenaAllocator.hpp>
  
  
  
  class XALAN_XSLT_EXPORT XalanElemValueOfAllocator
  {
  public:
  
        typedef ElemValueOf                                                     
data_type;
  
  #if defined(XALAN_NO_DEFAULT_TEMPLATE_ARGUMENTS)
        typedef ArenaBlock<data_type>                           ArenaBlockType;
        typedef ArenaAllocator<data_type,
                                                   ArenaBlockType>              
ArenaAllocatorType;
  #else
        typedef ArenaAllocator<data_type>                       
ArenaAllocatorType;
  #endif
  
        typedef ArenaAllocatorType::size_type           size_type;
  
        /**
         * Construct an instance that will allocate blocks of the specified 
size.
         *
         * @param theBlockSize The block size.
         */
        XalanElemValueOfAllocator(size_type             theBlockCount);
  
        ~XalanElemValueOfAllocator();
        
        /**
         * Construct an instance
         * 
         * @param constructionContext context for construction of object
         * @param stylesheetTree      stylesheet containing element
         * @param atts                list of attributes for element
         * @param lineNumber                            line number in document
         * @param columnNumber                  column number in document
         *
         * @return A pointer to the new instance.
         */
        data_type*
        create(
                        StylesheetConstructionContext&  constructionContext,
                        Stylesheet&                                             
stylesheetTree,
                        const AttributeList&                    atts,
                        int                                                     
        lineNumber,
                        int                                                     
        columnNumber);
  
        /**
         * Determine if an object is owned by the allocator...
         */
        bool
        ownsObject(const data_type*             theObject)
        {
                return m_allocator.ownsObject(theObject);
        }
  
        /**
         * Delete all objects from the allocator.        
         */     
        void
        reset()
        {
                m_allocator.reset();
        }
  
        /**
         * Get the number of ArenaBlocks currently allocated.
         *
         * @return The number of blocks.
         */
        size_type
        getBlockCount() const
        {
                return m_allocator.getBlockCount();
        }
  
        /**
         * Get size of an ArenaBlock, that is, the number
         * of objects in each block.
         *
         * @return The size of the block
         */
        size_type
        getBlockSize() const
        {
                return m_allocator.getBlockSize();
        }
  
  private:
  
        // Not implemented...
        XalanElemValueOfAllocator(const XalanElemValueOfAllocator&);
  
        XalanElemValueOfAllocator&
        operator=(const XalanElemValueOfAllocator&);
  
        // Data members...
        ArenaAllocatorType      m_allocator;
  };
  
  
  
  #endif        // XALANELEMVALUEOFALLOCATOR_INCLUDE_GUARD_12455133
  
  
  
  1.1                  xml-xalan/c/src/XSLT/XalanElemVariableAllocator.cpp
  
  Index: XalanElemVariableAllocator.cpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  // Class header file.
  #include "XalanElemVariableAllocator.hpp"
  
  
  
  XalanElemVariableAllocator::XalanElemVariableAllocator(size_type      
theBlockCount) :
        m_allocator(theBlockCount)
  {
  }
  
  
  
  XalanElemVariableAllocator::~XalanElemVariableAllocator()
  {
  }
  
  
  
  XalanElemVariableAllocator::data_type*
  XalanElemVariableAllocator::create(
                        StylesheetConstructionContext&  constructionContext,
                        Stylesheet&                                             
stylesheetTree,
                        const AttributeList&                    atts,
                        int                                                     
        lineNumber,
                        int                                                     
        columnNumber)
  {
        data_type* const        theBlock = m_allocator.allocateBlock();
        assert(theBlock != 0);
  
        data_type* const        theResult =
                new(theBlock) data_type(
                                constructionContext,
                                stylesheetTree,
                                atts,
                                lineNumber,
                                columnNumber);
  
        m_allocator.commitAllocation(theBlock);
  
        return theResult;
  }
  
  
  
  1.1                  xml-xalan/c/src/XSLT/XalanElemVariableAllocator.hpp
  
  Index: XalanElemVariableAllocator.hpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  #if !defined(XALANELEMVARIABLEALLOCATOR_INCLUDE_GUARD_12455133)
  #define XALANELEMVARIABLEALLOCATOR_INCLUDE_GUARD_12455133
  
  
  
  // Base include file.  Must be first.
  #include <XSLT/XSLTDefinitions.hpp>
  
  
  
  #include <XSLT/ElemVariable.hpp>
  
  
  
  #include <PlatformSupport/ArenaAllocator.hpp>
  
  
  
  class XALAN_XSLT_EXPORT XalanElemVariableAllocator
  {
  public:
  
        typedef ElemVariable                                            
data_type;
  
  #if defined(XALAN_NO_DEFAULT_TEMPLATE_ARGUMENTS)
        typedef ArenaBlock<data_type>                           ArenaBlockType;
        typedef ArenaAllocator<data_type,
                                                   ArenaBlockType>              
ArenaAllocatorType;
  #else
        typedef ArenaAllocator<data_type>                       
ArenaAllocatorType;
  #endif
  
        typedef ArenaAllocatorType::size_type           size_type;
  
        /**
         * Construct an instance that will allocate blocks of the specified 
size.
         *
         * @param theBlockSize The block size.
         */
        XalanElemVariableAllocator(size_type            theBlockCount);
  
        ~XalanElemVariableAllocator();
        
        /**
         * Construct an instance
         * 
         * @param constructionContext context for construction of object
         * @param stylesheetTree      stylesheet containing element
         * @param atts                list of attributes for element
         * @param lineNumber                            line number in document
         * @param columnNumber                  column number in document
         *
         * @return A pointer to the new instance.
         */
        data_type*
        create(
                        StylesheetConstructionContext&  constructionContext,
                        Stylesheet&                                             
stylesheetTree,
                        const AttributeList&                    atts,
                        int                                                     
        lineNumber,
                        int                                                     
        columnNumber);
  
        /**
         * Determine if an object is owned by the allocator...
         */
        bool
        ownsObject(const data_type*             theObject)
        {
                return m_allocator.ownsObject(theObject);
        }
  
        /**
         * Delete all objects from the allocator.        
         */     
        void
        reset()
        {
                m_allocator.reset();
        }
  
        /**
         * Get the number of ArenaBlocks currently allocated.
         *
         * @return The number of blocks.
         */
        size_type
        getBlockCount() const
        {
                return m_allocator.getBlockCount();
        }
  
        /**
         * Get size of an ArenaBlock, that is, the number
         * of objects in each block.
         *
         * @return The size of the block
         */
        size_type
        getBlockSize() const
        {
                return m_allocator.getBlockSize();
        }
  
  private:
  
        // Not implemented...
        XalanElemVariableAllocator(const XalanElemVariableAllocator&);
  
        XalanElemVariableAllocator&
        operator=(const XalanElemVariableAllocator&);
  
        // Data members...
        ArenaAllocatorType      m_allocator;
  };
  
  
  
  #endif        // XALANELEMVARIABLEALLOCATOR_INCLUDE_GUARD_12455133
  
  
  

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

Reply via email to