You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@apache.org on 2004/08/03 18:49:53 UTC

cvs commit: xml-xalan/c/src/xalanc/XSLT XalanMatchPatternData.cpp XalanMatchPatternData.hpp XalanMatchPatternDataAllocator.cpp XalanMatchPatternDataAllocator.hpp ElemCopyOf.hpp Stylesheet.cpp Stylesheet.hpp StylesheetConstructionContext.hpp StylesheetConstructionContextDefault.cpp StylesheetConstructionContextDefault.hpp

dbertoni    2004/08/03 09:49:53

  Modified:    c/src/xalanc/XSLT ElemCopyOf.hpp Stylesheet.cpp
                        Stylesheet.hpp StylesheetConstructionContext.hpp
                        StylesheetConstructionContextDefault.cpp
                        StylesheetConstructionContextDefault.hpp
  Added:       c/src/xalanc/XSLT XalanMatchPatternData.cpp
                        XalanMatchPatternData.hpp
                        XalanMatchPatternDataAllocator.cpp
                        XalanMatchPatternDataAllocator.hpp
  Log:
  Removed use of std::deque in Stylesheet class.
  
  Revision  Changes    Path
  1.8       +2 -6      xml-xalan/c/src/xalanc/XSLT/ElemCopyOf.hpp
  
  Index: ElemCopyOf.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/ElemCopyOf.hpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ElemCopyOf.hpp	31 Jul 2004 05:08:49 -0000	1.7
  +++ ElemCopyOf.hpp	3 Aug 2004 16:49:52 -0000	1.8
  @@ -17,12 +17,8 @@
   #define XALAN_ELEMCOPYOF_HEADER_GUARD 
   
   /**
  - * $Id$
  - * 
  - * 
  - * $State$
  - * 
  - * @author Myriam Midy (Myriam_Midy @lotus.com 
  + * @author David Bertoni (david_n_bertoni@us.ibm.com)
  + * @author Matthew Hoyt (mhoyt@ca.ibm.com)
    */
   
   // Base include file.  Must be first.
  
  
  
  1.12      +33 -55    xml-xalan/c/src/xalanc/XSLT/Stylesheet.cpp
  
  Index: Stylesheet.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/Stylesheet.cpp,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Stylesheet.cpp	6 Apr 2004 18:38:29 -0000	1.11
  +++ Stylesheet.cpp	3 Aug 2004 16:49:52 -0000	1.12
  @@ -63,6 +63,7 @@
   #include "KeyTable.hpp"
   #include "StylesheetConstructionContext.hpp"
   #include "StylesheetExecutionContext.hpp"
  +#include "XalanMatchPatternData.hpp"
   
   
   
  @@ -108,7 +109,6 @@
   	m_rootPatternList(),
   	m_piPatternList(),
   	m_nodePatternList(),
  -	m_matchPattern2Container(),
   	m_patternCount(0),
   	m_elemDecimalFormats(),
   	m_namespacesHandler()
  @@ -375,13 +375,13 @@
   static void
   addToList(
   			Stylesheet::PatternTableVectorType&		theList,
  -			const Stylesheet::MatchPattern2*		thePattern)
  +			const XalanMatchPatternData*		    thePattern)
   {
   	typedef Stylesheet::size_type	size_type;
   	assert(thePattern != 0);
   
   	const double		thePatternPriority = thePattern->getPriorityOrDefault();
  -	const size_type		thePatternPosition = thePattern->getPositionInStylesheet();
  +	const size_type		thePatternPosition = thePattern->getPosition();
   
   	typedef Stylesheet::PatternTableVectorType	PatternTableListType;
   	typedef PatternTableListType::iterator		iterator;
  @@ -399,7 +399,7 @@
   			break;
   		}
   		else if (thePatternPriority == theCurrentPriority &&
  -				 thePatternPosition > (*theCurrent)->getPositionInStylesheet())
  +				 thePatternPosition > (*theCurrent)->getPosition())
   		{
   			break;
   		}
  @@ -550,8 +550,6 @@
   
   	addToTable(m_elementPatternTable, m_elementAnyPatternList);
   	addToTable(m_attributePatternTable, m_attributeAnyPatternList);
  -
  -	m_patternCount = m_matchPattern2Container.size();
   }
   
   
  @@ -666,24 +664,6 @@
   
   
   
  -double
  -Stylesheet::MatchPattern2::getPriorityOrDefault() const
  -{
  -	const double	templatePriority =
  -		m_template->getPriority();
  -
  -	if (DoubleSupport::isNegativeInfinity(templatePriority) == true)
  -	{
  -		return XPath::getMatchScoreValue(m_priority);
  -	}
  -	else
  -	{
  -		return templatePriority;
  -	}
  -}
  -
  -
  -
   void
   Stylesheet::addTemplate(
   			ElemTemplate*					theTemplate,
  @@ -781,17 +761,16 @@
   				
   				tempString = data[i].getString();
   
  -				m_matchPattern2Container.push_back(
  -					MatchPattern2(
  +				const XalanMatchPatternData* const	newMatchPat =
  +				    constructionContext.createXalanMatchPatternData(
   						*theTemplate,
  -						m_matchPattern2Container.size(),
  +						m_patternCount,
   						tempString,
   						*xp,
   						xp->getExpression().getCurrentPattern(),
  -						data[i].getDefaultPriority()));
  +						data[i].getDefaultPriority());
   
  -				const MatchPattern2* const	newMatchPat =
  -					&m_matchPattern2Container.back();
  +                ++m_patternCount;
   
   				// Always put things on the front of the list, so
   				// templates later in the stylesheet are always
  @@ -890,8 +869,8 @@
   
   void
   Stylesheet::addObjectIfNotFound(
  -			const MatchPattern2*		thePattern,
  -			PatternTableVectorType& 	theVector)
  +			const XalanMatchPatternData*    thePattern,
  +			PatternTableVectorType& 	    theVector)
   {
   	XALAN_USING_STD(find)
   
  @@ -912,9 +891,9 @@
   
   inline void
   Stylesheet::addObjectIfNotFound(
  -			const MatchPattern2*	thePattern,
  -			const MatchPattern2* 	thePatternArray[],
  -			unsigned int&			thePatternArraySize)
  +			const XalanMatchPatternData*	thePattern,
  +			const XalanMatchPatternData* 	thePatternArray[],
  +			unsigned int&			        thePatternArraySize)
   {
   	assert(thePattern != 0 && thePatternArray != 0);
   
  @@ -950,7 +929,7 @@
   
   
   inline const Stylesheet::PatternTableVectorType* 
  -Stylesheet::locateElementMatchPatternList2(const XalanDOMString&	theName) const
  +Stylesheet::locateElementMatchPatternDataList(const XalanDOMString&	    theName) const
   {
   	assert(m_elementPatternTableEnd == m_elementPatternTable.end());
   
  @@ -970,7 +949,7 @@
   
   
   inline const Stylesheet::PatternTableVectorType* 
  -Stylesheet::locateAttributeMatchPatternList2(const XalanDOMString&	theName) const
  +Stylesheet::locateAttributeMatchPatternDataList(const XalanDOMString&	theName) const
   {
   	assert(m_attributePatternTableEnd == m_attributePatternTable.end());
   
  @@ -990,7 +969,7 @@
   
   
   inline const Stylesheet::PatternTableVectorType*
  -Stylesheet::locateMatchPatternList2(
  +Stylesheet::locateMatchPatternDataList(
   			const XalanNode&		theNode,
   			XalanNode::NodeType		targetNodeType) const
   {
  @@ -999,7 +978,7 @@
   	switch(targetNodeType)
   	{
   	case XalanNode::ELEMENT_NODE:
  -		return locateElementMatchPatternList2(DOMServices::getLocalNameOfNode(theNode));
  +		return locateElementMatchPatternDataList(DOMServices::getLocalNameOfNode(theNode));
   		break;
   
   	case XalanNode::PROCESSING_INSTRUCTION_NODE:
  @@ -1012,7 +991,7 @@
   #else
   		assert(DOMServices::isNamespaceDeclaration(static_cast<const XalanAttr&>(theNode)) == false);
   #endif
  -		return locateAttributeMatchPatternList2(DOMServices::getLocalNameOfNode(theNode));
  +		return locateAttributeMatchPatternDataList(DOMServices::getLocalNameOfNode(theNode));
   		break;
   
   	case XalanNode::CDATA_SECTION_NODE:
  @@ -1081,7 +1060,6 @@
   {
   	assert(targetNode != 0);
   	assert(targetNode->getNodeType() == targetNodeType);
  -	assert(m_patternCount == m_matchPattern2Container.size());
   
   	if(m_isWrapperless == true)
   	{
  @@ -1100,7 +1078,7 @@
   			// Points to the current list of match patterns.  Note
   			// that this may point to more than one table.
   			const PatternTableVectorType* 	matchPatternList =
  -					locateMatchPatternList2(*targetNode, targetNodeType);
  +					locateMatchPatternDataList(*targetNode, targetNodeType);
   			assert(matchPatternList != 0);
   
   			PatternTableVectorType::const_iterator		theCurrentEntry =
  @@ -1111,7 +1089,7 @@
   
   			while(theCurrentEntry != theTableEnd)
   			{
  -				const MatchPattern2*	matchPat = *theCurrentEntry;
  +				const XalanMatchPatternData*	matchPat = *theCurrentEntry;
   				assert(matchPat != 0);
   
   				const ElemTemplate*	const	rule = matchPat->getTemplate();
  @@ -1155,7 +1133,7 @@
   		else
   		{
   			const PatternTableVectorType* 	matchPatternList =
  -					locateMatchPatternList2(*targetNode, targetNodeType);
  +					locateMatchPatternDataList(*targetNode, targetNodeType);
   			assert(matchPatternList != 0);
   
   			PatternTableVectorType::const_iterator		theCurrentEntry =
  @@ -1166,7 +1144,7 @@
   
   			if (theCurrentEntry != theTableEnd)
   			{
  -				const MatchPattern2*	bestMatchedPattern = 0; // Syncs with bestMatchedRule
  +				const XalanMatchPatternData*	bestMatchedPattern = 0; // Syncs with bestMatchedRule
   				const double			matchScoreNoneValue = 
   					XPath::getMatchScoreValue(XPath::eMatchScoreNone);
   
  @@ -1175,18 +1153,18 @@
   				unsigned int			nConflicts = 0;
   
   				// Use a stack-based array when possible...
  -				const MatchPattern2*	conflictsArray[100];
  +				const XalanMatchPatternData*	conflictsArray[100];
   
  -				XalanArrayAutoPtr<const MatchPattern2*>		conflictsVector;
  +				XalanArrayAutoPtr<const XalanMatchPatternData*>		conflictsVector;
   
  -				const MatchPattern2**	conflicts = 0;
  +				const XalanMatchPatternData**	conflicts = 0;
   
  -				const XalanDOMString*	prevPat = 0;
  -				const MatchPattern2*	prevMatchPat = 0;
  +				const XalanDOMString*	        prevPat = 0;
  +				const XalanMatchPatternData*	prevMatchPat = 0;
   
   				do
   				{
  -					const MatchPattern2*	matchPat = *theCurrentEntry;
  +					const XalanMatchPatternData*	matchPat = *theCurrentEntry;
   					double					matchPatPriority = matchScoreNoneValue;
   					assert(matchPat != 0);
   
  @@ -1251,7 +1229,7 @@
   									{
   										if (m_patternCount > sizeof(conflictsArray) / sizeof(conflictsArray[0]))
   										{
  -											conflictsVector.reset(new const MatchPattern2*[m_patternCount]);
  +											conflictsVector.reset(new const XalanMatchPatternData*[m_patternCount]);
   
   											conflicts = conflictsVector.get();
   										}
  @@ -1289,15 +1267,15 @@
   					
   					for(unsigned int i = 0; i < nConflicts; i++)
   					{
  -						const MatchPattern2* const	conflictPat = conflicts[i];
  +						const XalanMatchPatternData* const	conflictPat = conflicts[i];
   
   						if(0 != i)
   						{
   							conflictsString += XALAN_STATIC_UCODE_STRING(", ");
   
   							// Find the furthest one towards the bottom of the document.
  -							if(conflictPat->getPositionInStylesheet() >
  -								bestMatchedPattern->getPositionInStylesheet())
  +							if(conflictPat->getPosition() >
  +								bestMatchedPattern->getPosition())
   							{
   								bestMatchedPattern = conflictPat;
   							}
  
  
  
  1.11      +22 -159   xml-xalan/c/src/xalanc/XSLT/Stylesheet.hpp
  
  Index: Stylesheet.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/Stylesheet.hpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Stylesheet.hpp	31 Jul 2004 06:05:08 -0000	1.10
  +++ Stylesheet.hpp	3 Aug 2004 16:49:52 -0000	1.11
  @@ -24,7 +24,6 @@
   
   
   
  -#include <deque>
   #include <map>
   
   
  @@ -36,6 +35,7 @@
   #include <xalanc/XalanDOM/XalanNode.hpp>
   
   
  +
   #include <xalanc/PlatformSupport/PrefixResolver.hpp>
   
   
  @@ -48,6 +48,7 @@
   
   #include <xalanc/XSLT/NamespacesHandler.hpp>
   #include <xalanc/XSLT/KeyDeclaration.hpp>
  +#include <xalanc/XSLT/StylesheetConstructionContext.hpp>
   #include <xalanc/XSLT/StylesheetExecutionContext.hpp>
   #include <xalanc/XSLT/XalanSpaceNodeTester.hpp>
   
  @@ -68,6 +69,7 @@
   class PrefixResolver;
   class StylesheetConstructionContext;
   class StylesheetRoot;
  +class XalanMatchPatternData;
   class XalanQName;
   class XObject;
   class StylesheetExecutionContext;
  @@ -83,12 +85,7 @@
   
   public:
   
  -#if defined(XALAN_STRICT_ANSI_HEADERS)
  -	typedef std::size_t		size_type;
  -#else
  -	typedef size_t			size_type;
  -#endif
  -
  +    typedef StylesheetConstructionContext::size_type        size_type;
   	typedef StylesheetExecutionContext::ParamVectorType		ParamVectorType;
   	typedef XalanQName::NamespaceVectorType					NamespaceVectorType;
   	typedef XalanQName::NamespacesStackType					NamespacesStackType;
  @@ -99,17 +96,24 @@
   	typedef XalanVector<XalanDOMString>					URLStackType;
   	typedef XalanVector<ElemDecimalFormat*>				ElemDecimalFormatVectorType;
   	typedef XalanVector<XalanSpaceNodeTester>			WhitespaceElementsVectorType;
  +    typedef XalanVector<const XalanMatchPatternData*>	PatternTableVectorType;
   	
   	typedef XALAN_STD_QUALIFIER map<XalanDOMString,
   				ExtensionNSHandler*,
   				XALAN_STD_QUALIFIER less<XalanDOMString> >		ExtensionNamespacesMapType;
  -	typedef XALAN_STD_QUALIFIER map<XalanQNameByReference,
  +
  +    typedef XALAN_STD_QUALIFIER map<XalanQNameByReference,
   				const ElemTemplate*,
   				XALAN_STD_QUALIFIER less<XalanQName> >			ElemTemplateMapType;
  -	typedef XALAN_STD_QUALIFIER map<const XalanNode*,
  +
  +    typedef XALAN_STD_QUALIFIER map<const XalanNode*,
   				KeyTable*,
   				XALAN_STD_QUALIFIER less<const XalanNode*> >	KeyTablesTableType;
   
  +	typedef XALAN_STD_QUALIFIER map<XalanDOMString,
  +					 PatternTableVectorType,
  +                     XALAN_STD_QUALIFIER less<XalanDOMString> > PatternTableMapType;
  +
   	/**
   	 * Constructor for a Stylesheet needs a Document.
   	 * @exception XSLProcessorException thrown if the active ProblemListener and XMLParserLiaison decide 
  @@ -559,138 +563,6 @@
   			bool							onlyUseImports) const;
   
   	/**
  -	 * A class to contain a match pattern and it's corresponding template.
  -	 * This class also defines a node in a match pattern linked list.
  -	 */
  -	class MatchPattern2
  -	{
  -	public:
  -
  -		typedef XPath::eMatchScore	eMatchScore;
  -
  -		/**
  -		 * Construct a match pattern from a pattern and template.
  -		 *
  -		 * @param theTemplate node that contains the template for this pattern
  -		 * @param posInStylesheet position in stylesheet
  -		 * @param targetString target string
  -		 * @param matchPattern the match pattern
  -		 * @param pattern the pattern string
  -		 * @param priority the default priority
  -		 */
  -		MatchPattern2(
  -				const ElemTemplate&		theTemplate,
  -				size_type 				posInStylesheet,
  -				const XalanDOMString&	targetString,
  -				const XPath&			matchPattern,
  -				const XalanDOMString&	pattern,
  -				eMatchScore				priority) :
  -			m_template(&theTemplate),
  -			m_posInStylesheet(posInStylesheet),
  -			m_targetString(targetString),
  -			m_matchPattern(&matchPattern),
  -			m_pattern(&pattern),
  -			m_priority(priority)
  -		{
  -		}
  -
  -		MatchPattern2() :
  -			m_template(0),
  -			m_posInStylesheet(0),
  -			m_targetString(),
  -			m_matchPattern(0),
  -			m_pattern(0),
  -			m_priority(XPath::eMatchScoreNone)
  -		{
  -		}
  -
  -		~MatchPattern2()
  -		{
  -		}
  -
  -		/**
  -		 * Retrieve string for target.
  -		 * 
  -		 * @return target string
  -		 */
  -		const XalanDOMString&
  -		getTargetString() const
  -		{
  -			return m_targetString;
  -		}
  -
  -		/**
  -		 * Retrieve the match pattern associated with pattern.
  -		 * 
  -		 * @return XPath for pattern
  -		 */
  -		const XPath*
  -		getExpression() const
  -		{
  -			return m_matchPattern;
  -		}
  -
  -		/**
  -		 * Retrieve position of pattern in stylesheet.
  -		 * 
  -		 * @return position in stylesheet
  -		 */
  -		size_type
  -		getPositionInStylesheet() const
  -		{
  -			return m_posInStylesheet;
  -		}
  -
  -		/**
  -		 * Retrieve pattern string.
  -		 * 
  -		 * @return string that contains element pattern
  -		 */
  -		const XalanDOMString*
  -		getPattern() const
  -		{
  -			return m_pattern;
  -		}
  -
  -		/**
  -		 * Retrieve node that contains the template for this pattern.
  -		 * 
  -		 * @return template node
  -		 */
  -		const ElemTemplate*
  -		getTemplate() const
  -		{
  -			return m_template;
  -		}
  -
  -		eMatchScore
  -		getDefaultPriority() const
  -		{
  -			return m_priority;
  -		}
  -
  -		double
  -		getPriorityOrDefault() const;
  -
  -	private:
  -
  -		const ElemTemplate*		m_template;
  -		size_type				m_posInStylesheet;
  -		XalanDOMString			m_targetString;
  -		const XPath*			m_matchPattern;
  -		const XalanDOMString*	m_pattern;
  -		eMatchScore				m_priority;
  -	};
  -
  -	typedef XalanVector<const MatchPattern2*>		PatternTableVectorType;
  -
  -	typedef XALAN_STD_QUALIFIER map<XalanDOMString,
  -			    PatternTableVectorType,
  -				XALAN_STD_QUALIFIER less<XalanDOMString> >		PatternTableMapType;
  -
  -	typedef XALAN_STD_QUALIFIER deque<MatchPattern2>	MatchPattern2Container;
  -
  -	/**
   	 * Add object to vector of match patterns if not already there.
   	 *
   	 * @param thePattern pattern to add
  @@ -698,8 +570,8 @@
   	 */
   	static void
   	addObjectIfNotFound(
  -			const MatchPattern2*		thePattern,
  -			PatternTableVectorType& 	theVector);
  +			const XalanMatchPatternData*    thePattern,
  +			PatternTableVectorType& 	    theVector);
   
   	/**
   	 * Add object to array of match patterns if not already there.
  @@ -712,9 +584,9 @@
   	 */
   	static void
   	addObjectIfNotFound(
  -			const MatchPattern2*	thePattern,
  -			const MatchPattern2* 	theArray[],
  -			unsigned int&			theArraySize);
  +			const XalanMatchPatternData*    thePattern,
  +			const XalanMatchPatternData* 	theArray[],
  +			unsigned int&			        theArraySize);
   
   	/**
   	 * Given a name, locate the start of a list of 
  @@ -724,7 +596,7 @@
   	 * @param theName The name to match
   	 */
   	const PatternTableVectorType*
  -	locateElementMatchPatternList2(const XalanDOMString&	theName) const;
  +	locateElementMatchPatternDataList(const XalanDOMString&	    theName) const;
   
   	/**
   	 * Given a name, locate the start of a list of 
  @@ -734,7 +606,7 @@
   	 * @param theName The name to match
   	 */
   	const PatternTableVectorType*
  -	locateAttributeMatchPatternList2(const XalanDOMString&	theName) const;
  +	locateAttributeMatchPatternDataList(const XalanDOMString&	theName) const;
   
   	/**
   	 * Given a XalanNode, locate the start of a list of 
  @@ -743,7 +615,7 @@
   	 * @param XalanNode The node to match
   	 */
   	const PatternTableVectorType*
  -	locateMatchPatternList2(
  +	locateMatchPatternDataList(
   			const XalanNode&		theNode,
   			XalanNode::NodeType		targetNodeType) const;
   
  @@ -978,16 +850,7 @@
   	 */
   	PatternTableVectorType					m_nodePatternList;
   
  -	/**
  -	 * This will hold all of the MatchPattern2 instances for the
  -	 * stylesheet.
  -	 */
  -	MatchPattern2Container					m_matchPattern2Container;
  -
  -	/**
  -	 * This caches the number of possible patterns we can match.
  -	 */
  -	MatchPattern2Container::size_type		m_patternCount;
  +	size_type	                            m_patternCount;
   
   	ElemDecimalFormatVectorType				m_elemDecimalFormats;
   
  
  
  
  1.6       +29 -1     xml-xalan/c/src/xalanc/XSLT/StylesheetConstructionContext.hpp
  
  Index: StylesheetConstructionContext.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/StylesheetConstructionContext.hpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- StylesheetConstructionContext.hpp	26 Feb 2004 22:58:58 -0000	1.5
  +++ StylesheetConstructionContext.hpp	3 Aug 2004 16:49:53 -0000	1.6
  @@ -32,6 +32,7 @@
   
   
   #include <xalanc/XPath/XalanQName.hpp>
  +#include <xalanc/XPath/XPath.hpp>
   #include <xalanc/XPath/XPathConstructionContext.hpp>
   
   
  @@ -52,14 +53,15 @@
   
   class AVT;
   class AVTPart;
  +class ElemTemplate;
   class ElemTemplateElement;
   class ExtensionNSHandler;
   class PrefixResolver;
   class Stylesheet;
   class StylesheetRoot;
   class XalanDocument;
  +class XalanMatchPatternData;
   class XalanNode;
  -class XPath;
   class XSLTInputSource;
   
   
  @@ -691,6 +693,32 @@
   			const AttributeListType&	atts,
   			ExtensionNSHandler&			handler,
   			const LocatorType*			locator = 0) = 0;
  +
  +	/**
  +	 * Create an instance of XalanMatchPatternData, which describes
  +	 * data related to a match pattern and template in stylesheet.
  +	 * The instance owns the memory and will delete the element when
  +	 * it goes out of scope and the containing stylesheet is
  +	 * destroyed.
  +     *
  +     * @param theTemplate The ElemTemplate node that contains the template for this pattern
  +     * @param thePosition The position in the stylesheet
  +     * @param theTargetString The target string for match pattern
  +     * @param TheMatchPattern The match pattern
  +     * @param thePatternString the pattern string
  +     * @param thePriority The priority for the match pattern.
  +     *
  +     * @return A pointer to the new instance.
  +	 */
  +    virtual const XalanMatchPatternData*
  +    createXalanMatchPatternData(
  +            const ElemTemplate&     theTemplate,
  +            size_type               thePosition,
  +            const XalanDOMString&   theTargetString,
  +            const XPath&            theMatchPattern,
  +            const XalanDOMString&   thePatternString,
  +            XPath::eMatchScore      thePriority) = 0;
  +
   
   	// These are inherited from XPathConstructionContext...
   
  
  
  
  1.9       +23 -0     xml-xalan/c/src/xalanc/XSLT/StylesheetConstructionContextDefault.cpp
  
  Index: StylesheetConstructionContextDefault.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/StylesheetConstructionContextDefault.cpp,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- StylesheetConstructionContextDefault.cpp	26 Feb 2004 22:58:58 -0000	1.8
  +++ StylesheetConstructionContextDefault.cpp	3 Aug 2004 16:49:53 -0000	1.9
  @@ -109,6 +109,7 @@
   	m_elemTextLiteralAllocator(eDefaultElemTextLiteralBlockSize),
   	m_elemValueOfAllocator(eDefaultElemValueOfBlockSize),
   	m_elemVariableAllocator(eDefaultElemVariableBlockSize),
  +    m_matchPatternDataAllocator(eDefaultMatchPatternDataBlockSize),
   	m_spaceAttrQName(DOMServices::s_XMLNamespaceURI, Constants::ATTRNAME_SPACE)
   {
   }
  @@ -329,6 +330,8 @@
   	m_elemValueOfAllocator.reset();
   
   	m_elemVariableAllocator.reset();
  +
  +    m_matchPatternDataAllocator.reset();
   }
   
   
  @@ -1025,6 +1028,26 @@
   			length,
   			preserveSpace, 
   			disableOutputEscaping);
  +}
  +
  +
  +
  +const XalanMatchPatternData*
  +StylesheetConstructionContextDefault::createXalanMatchPatternData(
  +            const ElemTemplate&     theTemplate,
  +            size_type               thePosition,
  +            const XalanDOMString&   theTargetString,
  +            const XPath&            theMatchPattern,
  +            const XalanDOMString&   thePatternString,
  +            XPath::eMatchScore      thePriority)
  +{
  +    return m_matchPatternDataAllocator.create(
  +            theTemplate,
  +            thePosition,
  +            theTargetString,
  +            theMatchPattern,
  +            thePatternString,
  +            thePriority);
   }
   
   
  
  
  
  1.7       +14 -1     xml-xalan/c/src/xalanc/XSLT/StylesheetConstructionContextDefault.hpp
  
  Index: StylesheetConstructionContextDefault.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/StylesheetConstructionContextDefault.hpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- StylesheetConstructionContextDefault.hpp	31 Jul 2004 06:05:08 -0000	1.6
  +++ StylesheetConstructionContextDefault.hpp	3 Aug 2004 16:49:53 -0000	1.7
  @@ -74,6 +74,7 @@
   #include <xalanc/XSLT/XalanElemTextLiteralAllocator.hpp>
   #include <xalanc/XSLT/XalanElemValueOfAllocator.hpp>
   #include <xalanc/XSLT/XalanElemVariableAllocator.hpp>
  +#include "xalanc/XSLT/XalanMatchPatternDataAllocator.hpp"
   
   
   
  @@ -119,7 +120,8 @@
   			eDefaultElemTemplateBlockSize = 10,
   			eDefaultElemTextLiteralBlockSize = 20,
   			eDefaultElemValueOfBlockSize = 10,
  -			eDefaultElemVariableBlockSize = 10 };
  +			eDefaultElemVariableBlockSize = 10,
  +            eDefaultMatchPatternDataBlockSize = 10 };
   
   	/*
   	 * Construct an instance.  If the stylesheet(s) constructed is/are meant to be reused (a.k.a. "compiled"),
  @@ -436,6 +438,15 @@
   			ExtensionNSHandler&			handler,
   			const LocatorType*			locator = 0);
   
  +    virtual const XalanMatchPatternData*
  +    createXalanMatchPatternData(
  +            const ElemTemplate&     theTemplate,
  +            size_type               thePosition,
  +            const XalanDOMString&   theTargetString,
  +            const XPath&            theMatchPattern,
  +            const XalanDOMString&   thePatternString,
  +            XPath::eMatchScore      thePriority);
  +
   	static eElementToken
   	getElementNameToken(const XalanDOMString&	name);
   
  @@ -534,6 +545,8 @@
   	XalanElemValueOfAllocator				m_elemValueOfAllocator;
   
   	XalanElemVariableAllocator				m_elemVariableAllocator;
  +
  +    XalanMatchPatternDataAllocator          m_matchPatternDataAllocator;
   
   	const XalanQNameByReference				m_spaceAttrQName;
   
  
  
  
  1.1                  xml-xalan/c/src/xalanc/XSLT/XalanMatchPatternData.cpp
  
  Index: XalanMatchPatternData.cpp
  ===================================================================
  /*
   * Copyright 1999-2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  #include "XalanMatchPatternData.hpp"
  
  
  
  #include "xalanc/PlatformSupport/DoubleSupport.hpp"
  
  
  
  #include "ElemTemplate.hpp"
  
  
  
  XALAN_CPP_NAMESPACE_BEGIN
  
  
  
  double
  XalanMatchPatternData::getPriorityOrDefault() const
  {
  	const double	templatePriority =
  		m_template->getPriority();
  
  	if (DoubleSupport::isNegativeInfinity(templatePriority) == true)
  	{
  		return XPath::getMatchScoreValue(m_priority);
  	}
  	else
  	{
  		return templatePriority;
  	}
  }
  
  
  
  XALAN_CPP_NAMESPACE_END
  
  
  
  1.1                  xml-xalan/c/src/xalanc/XSLT/XalanMatchPatternData.hpp
  
  Index: XalanMatchPatternData.hpp
  ===================================================================
  /*
   * Copyright 1999-2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  #if !defined(XALAN_MATCHPATTERNDATA_HEADER_GUARD)
  #define XALAN_MATCHPATTERNDATA_HEADER_GUARD
  
  
  
  // Base include file.  Must be first.
  #include "xalanc/XSLT/XSLTDefinitions.hpp"
  
  
  
  #include <cstddef>
  
  
  
  #include "xalanc/XalanDOM/XalanDOMString.hpp"
  
  
  
  #include "xalanc/XPath/XPath.hpp"
  
  
  
  XALAN_CPP_NAMESPACE_BEGIN
  
  
  class ElemTemplate;
  
  
  
  /**
   * This class contains information concerning a match pattern in
   * a stylesheet.
   */
  class XALAN_XSLT_EXPORT XalanMatchPatternData
  {   
  
  public:
  
      typedef XPath::eMatchScore  eMatchScore;
  
  #if defined(XALAN_STRICT_ANSI_HEADERS)
  	typedef std::size_t		size_type;
  #else
  	typedef size_t			size_type;
  #endif
  
  
      /**
       * Construct a XalanMatchPatternData from a pattern and template.
       *
       * @param theTemplate The ElemTemplate node that contains the template for this pattern
       * @param thePosition The position in the stylesheet
       * @param theTargetString The target string for match pattern
       * @param TheMatchPattern The match pattern
       * @param thePatternString the pattern string
       * @param thePriority The priority for the match pattern.
       */
      XalanMatchPatternData(
              const ElemTemplate&     theTemplate,
              size_type               thePosition,
              const XalanDOMString&   theTargetString,
              const XPath&            theMatchPattern,
              const XalanDOMString&   thePatternString,
              eMatchScore             thePriority) :
          m_template(&theTemplate),
          m_position(thePosition),
          m_targetString(theTargetString),
          m_matchPattern(&theMatchPattern),
          m_pattern(&thePatternString),
          m_priority(thePriority)
      {
      }
  
      ~XalanMatchPatternData()
      {
      }
  
      /**
       * Retrieve string for target.
       * 
       * @return target string
       */
      const XalanDOMString&
      getTargetString() const
      {
          return m_targetString;
      }
  
      /**
       * Retrieve the match pattern associated with pattern.
       * 
       * @return XPath for pattern
       */
      const XPath*
      getExpression() const
      {
          return m_matchPattern;
      }
  
      /**
       * Retrieve position of pattern in stylesheet.
       * 
       * @return The position in the stylesheet
       */
      size_type
      getPosition() const
      {
          return m_position;
      }
  
      /**
       * Retrieve pattern string.
       * 
       * @return string that contains element pattern
       */
      const XalanDOMString*
      getPattern() const
      {
          return m_pattern;
      }
  
      /**
       * Retrieve node that contains the template for this pattern.
       * 
       * @return template node
       */
      const ElemTemplate*
      getTemplate() const
      {
          return m_template;
      }
  
      eMatchScore
      getDefaultPriority() const
      {
          return m_priority;
      }
  
      double
      getPriorityOrDefault() const;
  
  private:
  
      const ElemTemplate*     m_template;
  
      size_type               m_position;
  
      XalanDOMString          m_targetString;
  
      const XPath*            m_matchPattern;
  
      const XalanDOMString*   m_pattern;
  
      eMatchScore             m_priority;
  };
  
  
  
  XALAN_CPP_NAMESPACE_END
  
  
  
  #endif  // XALAN_MATCHPATTERNDATA_HEADER_GUARD
  
  
  
  1.1                  xml-xalan/c/src/xalanc/XSLT/XalanMatchPatternDataAllocator.cpp
  
  Index: XalanMatchPatternDataAllocator.cpp
  ===================================================================
  /*
   * Copyright 1999-2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  // Class header file.
  #include "XalanMatchPatternDataAllocator.hpp"
  
  
  
  XALAN_CPP_NAMESPACE_BEGIN
  
  
  
  XalanMatchPatternDataAllocator::XalanMatchPatternDataAllocator(size_type    theBlockCount) :
  	m_allocator(theBlockCount)
  {
  }
  
  
  
  XalanMatchPatternDataAllocator::~XalanMatchPatternDataAllocator()
  {
  }
  
  
  
  XalanMatchPatternDataAllocator::data_type*
  XalanMatchPatternDataAllocator::create(
              const ElemTemplate&     theTemplate,
              data_type::size_type    thePosition,
              const XalanDOMString&   theTargetString,
              const XPath&            theMatchPattern,
              const XalanDOMString&   thePatternString,
              data_type::eMatchScore  thePriority)
  {
  	data_type* const	theBlock = m_allocator.allocateBlock();
  	assert(theBlock != 0);
  
  	data_type* const	theResult =
  		new(theBlock) data_type(
  				theTemplate,
  				thePosition,
  				theTargetString,
  				theMatchPattern,
                  thePatternString,
  				thePriority);
  
  	m_allocator.commitAllocation(theBlock);
  
  	return theResult;
  }
  
  
  
  XALAN_CPP_NAMESPACE_END
  
  
  
  1.1                  xml-xalan/c/src/xalanc/XSLT/XalanMatchPatternDataAllocator.hpp
  
  Index: XalanMatchPatternDataAllocator.hpp
  ===================================================================
  /*
   * Copyright 1999-2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  #if !defined(XALANMATCHPATTERNDATAALLOCATOR_INCLUDE_GUARD_12455133)
  #define XALANMATCHPATTERNDATAALLOCATOR_INCLUDE_GUARD_12455133
  
  
  
  // Base include file.  Must be first.
  #include "xalanc/XSLT/XSLTDefinitions.hpp"
  
  
  
  #include "xalanc/XSLT/XalanMatchPatternData.hpp"
  
  
  
  #include "xalanc/PlatformSupport/ArenaAllocator.hpp"
  
  
  
  XALAN_CPP_NAMESPACE_BEGIN
  
  
  
  class XALAN_XSLT_EXPORT XalanMatchPatternDataAllocator
  {
  public:
  
      typedef XalanMatchPatternData           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.
       */
      XalanMatchPatternDataAllocator(size_type    theBlockCount);
  
      ~XalanMatchPatternDataAllocator();
  
      /**
       * 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
       *
       * @param theTemplate The ElemTemplate node that contains the template for this pattern
       * @param thePosition The position in the stylesheet
       * @param theTargetString The target string for match pattern
       * @param TheMatchPattern The match pattern
       * @param thePatternString the pattern string
       * @param thePriority The priority for the match pattern.
       *
       * @return A pointer to the new instance.
       */
      data_type*
      create(
              const ElemTemplate&     theTemplate,
              data_type::size_type    thePosition,
              const XalanDOMString&   theTargetString,
              const XPath&            theMatchPattern,
              const XalanDOMString&   thePatternString,
              data_type::eMatchScore  thePriority);
  
      /**
       * 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...
      XalanMatchPatternDataAllocator(const XalanMatchPatternDataAllocator&);
  
      XalanMatchPatternDataAllocator&
      operator=(const XalanMatchPatternDataAllocator&);
  
      // Data members...
      ArenaAllocatorType  m_allocator;
  };
  
  
  
  XALAN_CPP_NAMESPACE_END
  
  
  
  #endif  // XALANMATCHPATTERNDATAALLOCATOR_INCLUDE_GUARD_12455133
  
  
  

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