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/02/12 06:36:02 UTC

cvs commit: xml-xalan/c/src/xalanc/XPath XPath.cpp XPath.hpp XPathExpression.cpp XPathExpression.hpp

dbertoni    2004/02/11 21:36:02

  Modified:    c/src/xalanc/XPath XPath.cpp XPath.hpp XPathExpression.cpp
                        XPathExpression.hpp
  Log:
  Implementation of iteration for op code map execution.
  
  Revision  Changes    Path
  1.11      +283 -295  xml-xalan/c/src/xalanc/XPath/XPath.cpp
  
  Index: XPath.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XPath/XPath.cpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- XPath.cpp	11 Feb 2004 01:08:30 -0000	1.10
  +++ XPath.cpp	12 Feb 2004 05:36:02 -0000	1.11
  @@ -121,7 +121,7 @@
   XPath::unknownOpCodeError(
   			XalanNode*				context,
   			XPathExecutionContext&	executionContext,
  -			OpCodePositionType		opPos) const
  +			OpCodeMapPositionType	opPos) const
   {
   	XalanDOMString	theOpCode;
   			
  @@ -155,16 +155,19 @@
   			XPathExecutionContext&	executionContext) const
   {
   	// Push and pop the PrefixResolver...
  -	XPathExecutionContext::PrefixResolverSetAndRestore	theResolverSetAndRestore(
  +	const XPathExecutionContext::PrefixResolverSetAndRestore	theResolverSetAndRestore(
   									executionContext,
   									&prefixResolver);
   
   	// Push and pop the current node...
  -	XPathExecutionContext::CurrentNodePushAndPop		theNodePushAndPop(
  +	const XPathExecutionContext::CurrentNodePushAndPop	theNodePushAndPop(
   									executionContext,
   									context);
   
  -	return executeMore(context, 0, executionContext);
  +	return executeMore(
  +            context,
  +            m_expression.getInitialOpCodePosition(),
  +            executionContext);
   }
   
   
  @@ -179,16 +182,20 @@
   	assert(context != 0);
   
   	// Push and pop the PrefixResolver...
  -	XPathExecutionContext::PrefixResolverSetAndRestore	theResolverSetAndRestore(
  +	const XPathExecutionContext::PrefixResolverSetAndRestore	theResolverSetAndRestore(
   									executionContext,
   									&prefixResolver);
   
   	// Push and pop the current node...
  -	XPathExecutionContext::CurrentNodePushAndPop		theNodePushAndPop(
  +	const XPathExecutionContext::CurrentNodePushAndPop	theNodePushAndPop(
   									executionContext,
   									context);
   
  -	executeMore(context, 0, executionContext, result);
  +	executeMore(
  +            context,
  +            m_expression.getInitialOpCodePosition(),
  +            executionContext,
  +            result);
   }
   
   
  @@ -203,16 +210,20 @@
   	assert(context != 0);
   
   	// Push and pop the PrefixResolver...
  -	XPathExecutionContext::PrefixResolverSetAndRestore	theResolverSetAndRestore(
  +	const XPathExecutionContext::PrefixResolverSetAndRestore	theResolverSetAndRestore(
   									executionContext,
   									&prefixResolver);
   
   	// Push and pop the current node...
  -	XPathExecutionContext::CurrentNodePushAndPop		theNodePushAndPop(
  +	const XPathExecutionContext::CurrentNodePushAndPop	theNodePushAndPop(
   									executionContext,
   									context);
   
  -	executeMore(context, 0, executionContext, result);
  +	executeMore(
  +            context,
  +            m_expression.getInitialOpCodePosition(),
  +            executionContext,
  +            result);
   }
   
   
  @@ -227,16 +238,20 @@
   	assert(context != 0);
   
   	// Push and pop the PrefixResolver...
  -	XPathExecutionContext::PrefixResolverSetAndRestore	theResolverSetAndRestore(
  +	const XPathExecutionContext::PrefixResolverSetAndRestore	theResolverSetAndRestore(
   									executionContext,
   									&prefixResolver);
   
   	// Push and pop the current node...
  -	XPathExecutionContext::CurrentNodePushAndPop		theNodePushAndPop(
  +	const XPathExecutionContext::CurrentNodePushAndPop	theNodePushAndPop(
   									executionContext,
   									context);
   
  -	executeMore(context, 0, executionContext, result);
  +	executeMore(
  +            context,
  +            m_expression.getInitialOpCodePosition(),
  +            executionContext,
  +            result);
   }
   
   
  @@ -252,16 +267,21 @@
   	assert(context != 0);
   
   	// Push and pop the PrefixResolver...
  -	XPathExecutionContext::PrefixResolverSetAndRestore	theResolverSetAndRestore(
  +	const XPathExecutionContext::PrefixResolverSetAndRestore	theResolverSetAndRestore(
   									executionContext,
   									&prefixResolver);
   
   	// Push and pop the current node...
  -	XPathExecutionContext::CurrentNodePushAndPop		theNodePushAndPop(
  +	const XPathExecutionContext::CurrentNodePushAndPop	theNodePushAndPop(
   									executionContext,
   									context);
   
  -	executeMore(context, 0, executionContext, formatterListener, function);
  +	executeMore(
  +            context,
  +            m_expression.getInitialOpCodePosition(),
  +            executionContext,
  +            formatterListener,
  +            function);
   }
   
   
  @@ -282,11 +302,15 @@
   									&prefixResolver);
   
   	// Push and pop the current node...
  -	XPathExecutionContext::CurrentNodePushAndPop		theNodePushAndPop(
  +	XPathExecutionContext::CurrentNodePushAndPop	theNodePushAndPop(
   									executionContext,
   									context);
   
  -	return executeMore(context, 0, executionContext, result);
  +	return executeMore(
  +            context,
  +            m_expression.getInitialOpCodePosition(),
  +            executionContext,
  +            result);
   }
   
   
  @@ -294,7 +318,7 @@
   const XObjectPtr
   XPath::executeMore(
   			XalanNode* 				context,
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			XPathExecutionContext&	executionContext) const
   {
   	switch(m_expression.getOpCodeMapValue(opPos))
  @@ -488,7 +512,7 @@
   void
   XPath::executeMore(
   			XalanNode* 				context,
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			XPathExecutionContext&	executionContext,
   			bool&					result) const
   {
  @@ -673,7 +697,7 @@
   void
   XPath::executeMore(
   			XalanNode* 				context,
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			XPathExecutionContext&	executionContext,
   			double&					result) const
   {
  @@ -858,7 +882,7 @@
   void
   XPath::executeMore(
   			XalanNode* 				context,
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			XPathExecutionContext&	executionContext,
   			XalanDOMString&			result) const
   {
  @@ -1054,7 +1078,7 @@
   void
   XPath::executeMore(
   			XalanNode* 				context,
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			XPathExecutionContext&	executionContext,
   			FormatterListener&		formatterListener,
   			MemberFunctionPtr		function) const
  @@ -1264,7 +1288,7 @@
   const XObjectPtr
   XPath::executeMore(
   			XalanNode* 				context,
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			XPathExecutionContext&	executionContext,
   			MutableNodeRefList&		result) const
   {
  @@ -1365,11 +1389,12 @@
   {
   	assert(context != 0);
   
  -	OpCodePositionType	opPos = 2;
  +	OpCodeMapPositionType	opPos =
  +        m_expression.getInitialOpCodePosition() + 2;
   
   	while(m_expression.getOpCodeMapValue(opPos) == XPathExpression::eOP_LOCATIONPATHPATTERN)
   	{
  -		const OpCodePositionType	nextOpPos = m_expression.getNextOpCodePosition(opPos);
  +		const OpCodeMapPositionType	    nextOpPos = m_expression.getNextOpCodePosition(opPos);
   
   		score = locationPathPattern(executionContext, *context, opPos);
   
  @@ -1441,18 +1466,21 @@
   
   inline const XalanDOMString*
   getStringFromTokenQueue(
  -			const XPathExpression&	    expression,
  -            XPath::OpCodePositionType	opPos)
  +			const XPathExpression&	        expression,
  +            XPath::OpCodeMapPositionType	opPos)
   {
  -	const XPath::OpCodePositionType     tokenPosition =
  +	const XPath::OpCodeMapValueType     tokenPosition =
   				expression.getOpCodeMapValue(opPos);
   
  -	if (tokenPosition < 0)
  +    if (tokenPosition == XPathExpression::eEMPTY ||
  +        tokenPosition == XPathExpression::eELEMWILDCARD)
   	{
   		return 0;
   	}
   	else
   	{
  +        assert(tokenPosition != XPathExpression::eENDOP);
  +
   		const XObject* const	token =
   					expression.getToken(tokenPosition);
   		assert(token != 0);
  @@ -1466,13 +1494,14 @@
   void
   XPath::getTargetData(TargetDataVectorType&	targetData) const
   {
  -	OpCodePositionType opPos = 2;
  +	OpCodeMapPositionType   opPos =
  +        m_expression.getInitialOpCodePosition() + 2;
   
   	targetData.reserve(eDefaultTargetDataSize);
   
   	while(m_expression.getOpCodeMapValue(opPos) == XPathExpression::eOP_LOCATIONPATHPATTERN)
   	{
  -		const OpCodePositionType	nextOpPos = m_expression.getNextOpCodePosition(opPos);
  +		const OpCodeMapPositionType	    nextOpPos = m_expression.getNextOpCodePosition(opPos);
   
   		opPos += 2;
   	 
  @@ -1482,10 +1511,10 @@
   		{
   			++stepCount;
   
  -			const OpCodePositionType	nextStepPos =
  +			const OpCodeMapPositionType	    nextStepPos =
   				m_expression.getNextOpCodePosition(opPos);
   
  -			const OpCodePositionType	nextOp = m_expression.getOpCodeMapValue(nextStepPos);
  +			const OpCodeMapValueType    nextOp = m_expression.getOpCodeMapValue(nextStepPos);
   
   			if(nextOp == XPathExpression::eENDOP)
   			{
  @@ -1553,8 +1582,8 @@
   
   						case XPathExpression::eNODETYPE_PI:
   							{
  -								const OpCodePositionType	argLen =
  -									m_expression.getOpCodeMapValue(opPos - 3 + XPathExpression::s_opCodeMapLengthIndex + 1) - 3;
  +								const OpCodeMapValueType	argLen =
  +									m_expression.getOpCodeArgumentLength(opPos - 3);
   
   								targetLocalName = PSEUDONAME_PI;
   
  @@ -1663,7 +1692,7 @@
   bool
   XPath::Or(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   {
   	opPos += 2;
  @@ -1687,7 +1716,7 @@
   bool
   XPath::And(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   {
   	opPos += 2;	
  @@ -1711,7 +1740,7 @@
   bool
   XPath::notequals(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   {
   	opPos += 2;	
  @@ -1731,7 +1760,7 @@
   bool
   XPath::equals(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   {
   	opPos += 2;	
  @@ -1751,7 +1780,7 @@
   bool
   XPath::lte(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   {
   	opPos += 2;	
  @@ -1771,7 +1800,7 @@
   bool
   XPath::lt(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   {
   	opPos += 2;
  @@ -1791,7 +1820,7 @@
   bool
   XPath::gte(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   {
   	opPos += 2;
  @@ -1811,7 +1840,7 @@
   bool
   XPath::gt(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   {
   	opPos += 2;
  @@ -1831,7 +1860,7 @@
   double
   XPath::getNumericOperand(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   {
   	if (m_expression.getOpCodeMapValue(opPos) == XPathExpression::eOP_NUMBERLIT)
  @@ -1856,7 +1885,7 @@
   double
   XPath::plus(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   {
   	opPos += 2;
  @@ -1875,7 +1904,7 @@
   void
   XPath::plus(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			FormatterListener&		formatterListener,
   			MemberFunctionPtr		function) const
  @@ -1890,7 +1919,7 @@
   double
   XPath::minus(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   {
   	opPos += 2;
  @@ -1909,7 +1938,7 @@
   void
   XPath::minus(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			FormatterListener&		formatterListener,
   			MemberFunctionPtr		function) const
  @@ -1924,7 +1953,7 @@
   double
   XPath::mult(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   {
   	opPos += 2;
  @@ -1943,7 +1972,7 @@
   void
   XPath::mult(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			FormatterListener&		formatterListener,
   			MemberFunctionPtr		function) const
  @@ -1958,7 +1987,7 @@
   double
   XPath::div(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   {
   	opPos += 2;
  @@ -1977,7 +2006,7 @@
   void
   XPath::div(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			FormatterListener&		formatterListener,
   			MemberFunctionPtr		function) const
  @@ -1992,7 +2021,7 @@
   double
   XPath::mod(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   {
   	opPos += 2;	
  @@ -2011,7 +2040,7 @@
   void
   XPath::mod(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			FormatterListener&		formatterListener,
   			MemberFunctionPtr		function) const
  @@ -2026,7 +2055,7 @@
   double
   XPath::neg(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   {
   	return DoubleSupport::negative(getNumericOperand(context, opPos + 2, executionContext));
  @@ -2037,7 +2066,7 @@
   void
   XPath::neg(
   			XalanNode*				context,
  -			OpCodePositionType						opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			FormatterListener&		formatterListener,
   			MemberFunctionPtr		function) const
  @@ -2052,7 +2081,7 @@
   const XObjectPtr
   XPath::Union(
   			XalanNode*				context,
  -			OpCodePositionType						opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   {
   	typedef XPathExecutionContext::BorrowReturnMutableNodeRefList	BorrowReturnMutableNodeRefList;
  @@ -2069,7 +2098,7 @@
   void
   XPath::Union(
   			XalanNode*				context,
  -			OpCodePositionType						opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			bool&					result) const
   {
  @@ -2087,7 +2116,7 @@
   void
   XPath::Union(
   			XalanNode*				context,
  -			OpCodePositionType						opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			double&					result) const
   {
  @@ -2105,7 +2134,7 @@
   void
   XPath::Union(
   			XalanNode*				context,
  -			OpCodePositionType						opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			XalanDOMString&			result) const
   {
  @@ -2123,7 +2152,7 @@
   void
   XPath::Union(
   			XalanNode*				context,
  -			OpCodePositionType						opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			FormatterListener&		formatterListener,
   			MemberFunctionPtr		function) const
  @@ -2142,7 +2171,7 @@
   void
   XPath::Union(
   			XalanNode*				context,
  -			OpCodePositionType						opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			MutableNodeRefList&		result) const
   {
  @@ -2181,11 +2210,11 @@
   
   const XObjectPtr
   XPath::literal(
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   {
  -	assert(m_expression.opCodeMapSize() > opPos + 2);
  -	assert(m_expression.tokenQueueSize() > m_expression.getOpCodeMapValue(opPos + 2));
  +	assert(m_expression.isValidOpCodePosition(opPos + 2));
  +    assert(m_expression.isValidTokenQueuePosition(m_expression.getOpCodeMapValue(opPos + 2)));
   
       const XToken* const	    theLiteral = m_expression.getToken(m_expression.getOpCodeMapValue(opPos + 2));
       assert(theLiteral != 0);
  @@ -2204,11 +2233,11 @@
   
   void
   XPath::literal(
  -			OpCodePositionType	opPos,
  -			bool&	            theResult) const
  +			OpCodeMapPositionType	opPos,
  +			bool&	                theResult) const
   {
  -	assert(m_expression.opCodeMapSize() > opPos + 2);
  -    assert(m_expression.tokenQueueSize() > m_expression.getOpCodeMapValue(opPos + 2));
  +	assert(m_expression.isValidOpCodePosition(opPos + 2));
  +    assert(m_expression.isValidTokenQueuePosition(m_expression.getOpCodeMapValue(opPos + 2)));
   
       const XToken* const	    theLiteral = m_expression.getToken(m_expression.getOpCodeMapValue(opPos + 2));
       assert(theLiteral != 0);
  @@ -2220,11 +2249,11 @@
   
   void
   XPath::literal(
  -			OpCodePositionType	opPos,
  -			double&		        theResult) const
  +			OpCodeMapPositionType	opPos,
  +			double&		            theResult) const
   {
  -	assert(m_expression.opCodeMapSize() > opPos + 2);
  -    assert(m_expression.tokenQueueSize() > m_expression.getOpCodeMapValue(opPos + 2));
  +	assert(m_expression.isValidOpCodePosition(opPos + 2));
  +    assert(m_expression.isValidTokenQueuePosition(m_expression.getOpCodeMapValue(opPos + 2)));
   
       const XToken* const	    theLiteral = m_expression.getToken(m_expression.getOpCodeMapValue(opPos + 2));
       assert(theLiteral != 0);
  @@ -2236,11 +2265,11 @@
   
   void
   XPath::literal(
  -			OpCodePositionType	opPos,
  -			XalanDOMString&		theString) const
  +			OpCodeMapPositionType	opPos,
  +			XalanDOMString&		    theString) const
   {
  -	assert(m_expression.opCodeMapSize() > opPos + 2);
  -    assert(m_expression.tokenQueueSize() > m_expression.getOpCodeMapValue(opPos + 2));
  +	assert(m_expression.isValidOpCodePosition(opPos + 2));
  +    assert(m_expression.isValidTokenQueuePosition(m_expression.getOpCodeMapValue(opPos + 2)));
   
       const XToken* const	    theLiteral = m_expression.getToken(m_expression.getOpCodeMapValue(opPos + 2));
       assert(theLiteral != 0);
  @@ -2252,12 +2281,12 @@
   
   void
   XPath::literal(
  -			OpCodePositionType	opPos,
  -			FormatterListener&	formatterListener,
  -			MemberFunctionPtr	function) const
  +			OpCodeMapPositionType	opPos,
  +			FormatterListener&	    formatterListener,
  +			MemberFunctionPtr	    function) const
   {
  -	assert(m_expression.opCodeMapSize() > opPos + 2);
  -    assert(m_expression.tokenQueueSize() > m_expression.getOpCodeMapValue(opPos + 2));
  +	assert(m_expression.isValidOpCodePosition(opPos + 2));
  +    assert(m_expression.isValidTokenQueuePosition(m_expression.getOpCodeMapValue(opPos + 2)));
   
       const XToken* const	    theLiteral = m_expression.getToken(m_expression.getOpCodeMapValue(opPos + 2));
       assert(theLiteral != 0);
  @@ -2269,11 +2298,11 @@
   
   const XObjectPtr
   XPath::variable(
  -			OpCodePositionType	    opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   {
  -	assert(m_expression.opCodeMapSize() > opPos + 3);
  -    assert(m_expression.tokenQueueSize() > m_expression.getOpCodeMapValue(opPos + 3));
  +	assert(m_expression.isValidOpCodePosition(opPos + 3));
  +    assert(m_expression.isValidTokenQueuePosition(m_expression.getOpCodeMapValue(opPos + 3)));
   
       const XToken* const	    ns =
           m_expression.getToken(m_expression.getOpCodeMapValue(opPos + 2));
  @@ -2290,11 +2319,11 @@
   
   const XObjectPtr
   XPath::numberlit(
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   {
  -	assert(m_expression.opCodeMapSize() > opPos + 3);
  -    assert(m_expression.tokenQueueSize() > m_expression.getOpCodeMapValue(opPos + 3));
  +	assert(m_expression.isValidOpCodePosition(opPos + 3));
  +    assert(m_expression.isValidTokenQueuePosition(m_expression.getOpCodeMapValue(opPos + 3)));
   
   	const XToken* const	    theLiteral =
           m_expression.getToken(m_expression.getOpCodeMapValue(opPos + 3));
  @@ -2313,10 +2342,10 @@
   
   
   double
  -XPath::numberlit(OpCodePositionType	opPos) const
  +XPath::numberlit(OpCodeMapPositionType	opPos) const
   {
  -	assert(m_expression.opCodeMapSize() > opPos + 3);
  -    assert(m_expression.tokenQueueSize() > m_expression.getOpCodeMapValue(opPos + 3));
  +	assert(m_expression.isValidOpCodePosition(opPos + 3));
  +    assert(m_expression.isValidTokenQueuePosition(m_expression.getOpCodeMapValue(opPos + 3)));
   
   	const XToken* const	    theLiteral =
           m_expression.getToken(m_expression.getOpCodeMapValue(opPos + 3));
  @@ -2329,11 +2358,11 @@
   
   void
   XPath::numberlit(
  -			OpCodePositionType	opPos,
  -			bool&	            theResult) const
  +			OpCodeMapPositionType	opPos,
  +			bool&	                theResult) const
   {
  -	assert(m_expression.opCodeMapSize() > opPos + 3);
  -    assert(m_expression.tokenQueueSize() > m_expression.getOpCodeMapValue(opPos + 3));
  +	assert(m_expression.isValidOpCodePosition(opPos + 3));
  +    assert(m_expression.isValidTokenQueuePosition(m_expression.getOpCodeMapValue(opPos + 3)));
   
   	const XToken* const	    theLiteral =
           m_expression.getToken(m_expression.getOpCodeMapValue(opPos + 3));
  @@ -2346,11 +2375,11 @@
   
   void
   XPath::numberlit(
  -			OpCodePositionType	opPos,
  -			XalanDOMString&		theString) const
  +			OpCodeMapPositionType	opPos,
  +			XalanDOMString&		    theString) const
   {
  -	assert(m_expression.opCodeMapSize() > opPos + 3);
  -    assert(m_expression.tokenQueueSize() > m_expression.getOpCodeMapValue(opPos + 3));
  +	assert(m_expression.isValidOpCodePosition(opPos + 3));
  +    assert(m_expression.isValidTokenQueuePosition(m_expression.getOpCodeMapValue(opPos + 3)));
   
   	const XToken* const	    theLiteral =
           m_expression.getToken(m_expression.getOpCodeMapValue(opPos + 3));
  @@ -2363,12 +2392,12 @@
   
   void
   XPath::numberlit(
  -			OpCodePositionType	opPos,
  -			FormatterListener&	formatterListener,
  -			MemberFunctionPtr	function) const
  +			OpCodeMapPositionType	opPos,
  +			FormatterListener&	    formatterListener,
  +			MemberFunctionPtr	    function) const
   {
  -	assert(m_expression.opCodeMapSize() > opPos + 3);
  -    assert(m_expression.tokenQueueSize() > m_expression.getOpCodeMapValue(opPos + 3));
  +	assert(m_expression.isValidOpCodePosition(opPos + 3));
  +    assert(m_expression.isValidTokenQueuePosition(m_expression.getOpCodeMapValue(opPos + 3)));
   
   	const XToken* const	    theLiteral =
           m_expression.getToken(m_expression.getOpCodeMapValue(opPos + 3));
  @@ -2382,7 +2411,7 @@
   const XObjectPtr
   XPath::locationPath(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   {    
   	assert(context != 0);
  @@ -2401,7 +2430,7 @@
   void
   XPath::locationPath(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			bool&					theResult) const
   {
  @@ -2421,7 +2450,7 @@
   void
   XPath::locationPath(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			double&					theResult) const
   {
  @@ -2441,7 +2470,7 @@
   void
   XPath::locationPath(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			XalanDOMString&			theResult) const
   {
  @@ -2461,7 +2490,7 @@
   void
   XPath::locationPath(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			FormatterListener&		formatterListener,
   			MemberFunctionPtr		function) const
  @@ -2482,12 +2511,13 @@
   const XObjectPtr
   XPath::runExtFunction(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   {
   	assert(context != 0);
   
  -	const OpCodePositionType	endExtFunc = opPos + m_expression.getOpCodeMapValue(opPos + 1) - 1;
  +	const OpCodeMapPositionType	    endExtFunc =
  +        opPos + m_expression.getOpCodeMapValue(opPos + 1) - 1;
   
   	opPos += 2;
   
  @@ -2507,7 +2537,8 @@
   
   	while(opPos < endExtFunc)
   	{
  -		const OpCodePositionType	nextOpPos = m_expression.getNextOpCodePosition(opPos);
  +		const OpCodeMapPositionType	    nextOpPos =
  +            m_expression.getNextOpCodePosition(opPos);
   
   		args.push_back(executeMore(context, opPos, executionContext));
   
  @@ -2522,10 +2553,11 @@
   const XObjectPtr
   XPath::runFunction(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   {
  -	const OpCodePositionType	endFunc = opPos + m_expression.getOpCodeMapValue(opPos + 1) - 1;
  +	const OpCodeMapPositionType	    endFunc =
  +        opPos + m_expression.getOpCodeMapValue(opPos + 1) - 1;
   
   	opPos += 2;
   
  @@ -2613,7 +2645,7 @@
   double
   XPath::functionCount(
   			XalanNode*				context,
  -			OpCodePositionType						opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   {
   	assert(context != 0);
  @@ -2639,7 +2671,7 @@
   const XalanDOMString&
   XPath::functionName(
   			XalanNode*				context,
  -			OpCodePositionType						opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   {
   	assert(context != 0);
  @@ -2700,7 +2732,7 @@
   const XalanDOMString&
   XPath::functionLocalName(
   			XalanNode*				context,
  -			OpCodePositionType						opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   {
   	assert(context != 0);
  @@ -2746,7 +2778,7 @@
   double
   XPath::functionStringLength(
   			XalanNode*				context,
  -			OpCodePositionType						opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   {
   	assert(context != 0);
  @@ -2763,7 +2795,7 @@
   double
   XPath::functionSum(
   			XalanNode*				context,
  -			OpCodePositionType						opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   {
   	assert(context != 0);
  @@ -2809,7 +2841,7 @@
   XPath::locationPathPattern(
   			XPathExecutionContext&	executionContext,
   			XalanNode&				context, 
  -			OpCodePositionType 					opPos) const
  +			OpCodeMapPositionType 	opPos) const
   {
   	eMatchScore	score = eMatchScoreNone;
   
  @@ -2823,8 +2855,8 @@
   void
   XPath::step(
   			XPathExecutionContext&	executionContext,
  -			XalanNode*				context, 
  -			OpCodePositionType 		opPos,
  +			XalanNode*				context,
  +			OpCodeMapPositionType 	opPos,
   			MutableNodeRefList& 	queryResults) const
   {
   	const XPathExpression&	currentExpression = getExpression();
  @@ -2832,8 +2864,6 @@
   	const OpCodeMapValueType   stepType =
   		currentExpression.getOpCodeMapValue(opPos);
   
  -	OpCodePositionType 		argLen = 0;
  -
   	typedef XPathExecutionContext::BorrowReturnMutableNodeRefList	BorrowReturnMutableNodeRefList;
   
   	BorrowReturnMutableNodeRefList	subQueryResults(executionContext);
  @@ -2846,27 +2876,27 @@
   	case XPathExpression::eOP_EXTFUNCTION:
   	case XPathExpression::eOP_FUNCTION:
   	case XPathExpression::eOP_GROUP:
  -		argLen = findNodeSet(executionContext, context, opPos, stepType, *subQueryResults);
  +		opPos = findNodeSet(executionContext, context, opPos, stepType, *subQueryResults);
   		break;
   
   	case XPathExpression::eFROM_ROOT:
  -		argLen = findRoot(executionContext, context, opPos, stepType, *subQueryResults);
  +		opPos = findRoot(executionContext, context, opPos, stepType, *subQueryResults);
   		break;
   
   	case XPathExpression::eFROM_PARENT:
  -		argLen = findParent(executionContext, context, opPos, stepType, *subQueryResults);
  +		opPos = findParent(executionContext, context, opPos, stepType, *subQueryResults);
   		break;
   
   	case XPathExpression::eFROM_SELF:
  -		argLen = findSelf(executionContext, context, opPos, stepType, *subQueryResults);
  +		opPos = findSelf(executionContext, context, opPos, stepType, *subQueryResults);
   		break;
   
   	case XPathExpression::eFROM_ANCESTORS:
  -		argLen = findAncestors(executionContext, context, opPos, stepType, *subQueryResults);
  +		opPos = findAncestors(executionContext, context, opPos, stepType, *subQueryResults);
   		break;
   
   	case XPathExpression::eFROM_ANCESTORS_OR_SELF:
  -		argLen = findAncestorsOrSelf(executionContext, context, opPos, stepType, *subQueryResults);
  +		opPos = findAncestorsOrSelf(executionContext, context, opPos, stepType, *subQueryResults);
   		break;
   
   	case XPathExpression::eMATCH_ATTRIBUTE:
  @@ -2874,7 +2904,7 @@
   		// fall-through on purpose.
   
   	case XPathExpression::eFROM_ATTRIBUTES:
  -		argLen = findAttributes(executionContext, context, opPos, stepType, *subQueryResults);
  +		opPos = findAttributes(executionContext, context, opPos, stepType, *subQueryResults);
   		break;
   
   	case XPathExpression::eMATCH_ANY_ANCESTOR:
  @@ -2884,41 +2914,39 @@
   		// fall-through on purpose.
   
   	case XPathExpression::eFROM_CHILDREN:
  -		argLen = findChildren(executionContext, context, opPos, stepType, *subQueryResults);
  +		opPos = findChildren(executionContext, context, opPos, stepType, *subQueryResults);
   		break;
   
   	case XPathExpression::eFROM_DESCENDANTS:
   	case XPathExpression::eFROM_DESCENDANTS_OR_SELF:
  -		argLen = findDescendants(executionContext, context, opPos, stepType, *subQueryResults);
  +		opPos = findDescendants(executionContext, context, opPos, stepType, *subQueryResults);
   		break;
   
   	case XPathExpression::eFROM_FOLLOWING:
  -		argLen = findFollowing(executionContext, context, opPos, stepType, *subQueryResults);
  +		opPos = findFollowing(executionContext, context, opPos, stepType, *subQueryResults);
   		break;
   
   	case XPathExpression::eFROM_FOLLOWING_SIBLINGS:
  -		argLen = findFollowingSiblings(executionContext, context, opPos, stepType, *subQueryResults);
  +		opPos = findFollowingSiblings(executionContext, context, opPos, stepType, *subQueryResults);
   		break;
   
   	case XPathExpression::eFROM_PRECEDING:
  -		argLen = findPreceeding(executionContext, context, opPos, stepType, *subQueryResults);
  +		opPos = findPreceeding(executionContext, context, opPos, stepType, *subQueryResults);
   		break;
   
   	case XPathExpression::eFROM_PRECEDING_SIBLINGS:
  -		argLen = findPreceedingSiblings(executionContext, context, opPos, stepType, *subQueryResults);
  +		opPos = findPreceedingSiblings(executionContext, context, opPos, stepType, *subQueryResults);
   		break;
   
   	case XPathExpression::eFROM_NAMESPACE:
  -		argLen = findNamespace(executionContext, context, opPos,  stepType, *subQueryResults);
  +		opPos = findNamespace(executionContext, context, opPos,  stepType, *subQueryResults);
   		break;
   
   	default:
  -		argLen = findNodesOnUnknownAxis(executionContext, context, opPos, stepType, *subQueryResults);
  +		opPos = findNodesOnUnknownAxis(executionContext, context, opPos, stepType, *subQueryResults);
   		break;
   	}
   
  -	opPos += argLen;
  -
   	OpCodeMapValueType  nextStepType = currentExpression.getOpCodeMapValue(opPos);
   
   	// Push and pop the context node list...
  @@ -3002,13 +3030,13 @@
   XPath::stepPattern(
   			XPathExecutionContext&	executionContext,
   			XalanNode*				context, 
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			eMatchScore& 			scoreHolder) const
   {
   	const XPathExpression&	currentExpression = getExpression();
   
  -	const OpCodePositionType    endStep = currentExpression.getNextOpCodePosition(opPos);
  -	OpCodeMapValueType          nextStepType = currentExpression.getOpCodeMapValue(endStep);
  +	const OpCodeMapPositionType     endStep = currentExpression.getNextOpCodePosition(opPos);
  +	OpCodeMapValueType              nextStepType = currentExpression.getOpCodeMapValue(endStep);
   
   	if(XPathExpression::eENDOP != nextStepType)
   	{
  @@ -3047,12 +3075,12 @@
   
   	assert(context != 0);
   
  -	OpCodePositionType	argLen = 0;
  +	OpCodeMapValueType	argLen = 0;
   
   	eMatchScore		    score = eMatchScoreNone;
   
  -	const OpCodePositionType	startOpPos = opPos;
  -	const OpCodeMapValueType	stepType =
  +	const OpCodeMapPositionType	    startOpPos = opPos;
  +	const OpCodeMapValueType	    stepType =
           currentExpression.getOpCodeMapValue(opPos);
   
   	switch(stepType)
  @@ -3118,10 +3146,7 @@
   
   	case XPathExpression::eFROM_ROOT:
   		{
  -			// $$ ToDO: Can we reduce this to some call on the
  -			// XPathExpression interface?
  -			argLen =
  -				currentExpression.getOpCodeMapValue(opPos + XPathExpression::s_opCodeMapLengthIndex + 1) - 3;
  +			argLen = currentExpression.getOpCodeArgumentLength(opPos);
   
   			opPos += 3;
   
  @@ -3134,8 +3159,8 @@
   			}
   			else
   			{
  -				const OpCodePositionType    prevPos = currentExpression.getNextOpCodePosition(startOpPos);		
  -				const OpCodeMapValueType	prevStepType = currentExpression.getOpCodeMapValue(prevPos);
  +				const OpCodeMapPositionType     prevPos = currentExpression.getNextOpCodePosition(startOpPos);		
  +				const OpCodeMapValueType        prevStepType = currentExpression.getOpCodeMapValue(prevPos);
   
   				if (eMatchScoreNone == score  && 
   				    (prevStepType == XPathExpression::eMATCH_ANY_ANCESTOR ||
  @@ -3166,10 +3191,7 @@
   
   	case XPathExpression::eMATCH_ATTRIBUTE:
   		{
  -			// $$ ToDO: Can we reduce this to some call on the
  -			// XPathExpression interface?
  -			argLen =
  -				currentExpression.getOpCodeMapValue(opPos + XPathExpression::s_opCodeMapLengthIndex + 1) - 3;
  +			argLen = currentExpression.getOpCodeArgumentLength(opPos);
   
   			opPos += 3;
   
  @@ -3193,10 +3215,7 @@
   	case XPathExpression::eMATCH_ANY_ANCESTOR:
   	case XPathExpression::eMATCH_ANY_ANCESTOR_WITH_PREDICATE:
   		{
  -			// $$ ToDO: Can we reduce this to some call on the
  -			// XPathExpression interface?
  -			argLen =
  -					currentExpression.getOpCodeMapValue(opPos + XPathExpression::s_opCodeMapLengthIndex + 1) - 3;
  +			argLen = currentExpression.getOpCodeArgumentLength(opPos);
   
   			XalanNode::NodeType		nodeType = context->getNodeType();
   
  @@ -3232,10 +3251,7 @@
   
   	case XPathExpression::eMATCH_IMMEDIATE_ANCESTOR:
   		{
  -			// $$ ToDO: Can we reduce this to some call on the
  -			// XPathExpression interface?
  -			argLen =
  -				currentExpression.getOpCodeMapValue(opPos + XPathExpression::s_opCodeMapLengthIndex + 1) - 3;
  +			argLen = currentExpression.getOpCodeArgumentLength(opPos);
   
   			const XalanNode::NodeType	nodeType = context->getNodeType();
   
  @@ -3336,7 +3352,7 @@
   XPath::handleFoundIndex(
   			XPathExecutionContext&	executionContext,
   			XalanNode* 				localContext, 
  -			OpCodePositionType 					startOpPos) const
  +			OpCodeMapPositionType 	startOpPos) const
   {
   	// We have an index somewhere in our pattern.  So, we have 
   	// to do a full search for our step, using the parent as 
  @@ -3375,7 +3391,7 @@
   XPath::handleFoundIndexPositional(
   			XPathExecutionContext&	executionContext,
   			XalanNode* 				localContext,
  -			OpCodePositionType 					startOpPos) const
  +			OpCodeMapPositionType 	startOpPos) const
   {
   	XalanNode* const	parentContext =
   				DOMServices::getParentOfNode(*localContext);
  @@ -3407,11 +3423,11 @@
   
   
   
  -XPath::OpCodePositionType
  +XPath::OpCodeMapPositionType
   XPath::findNodeSet(
   			XPathExecutionContext&	executionContext,
   			XalanNode*				context, 
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			OpCodeMapValueType 		/* stepType */,
   			MutableNodeRefList& 	subQueryResults) const
   {
  @@ -3430,16 +3446,16 @@
   		subQueryResults.setDocumentOrder();
   	}
   
  -	return getExpression().getOpCodeLengthFromOpMap(opPos);
  +	return opPos + getExpression().getOpCodeLengthFromOpMap(opPos);
   }
   
   
   
  -XPath::OpCodePositionType
  +XPath::OpCodeMapPositionType
   XPath::findRoot(
   			XPathExecutionContext&	/* executionContext */,
   			XalanNode*				context, 
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			OpCodeMapValueType 		/* stepType */,
   			MutableNodeRefList& 	subQueryResults) const
   {
  @@ -3447,10 +3463,8 @@
   
   	const XPathExpression&	currentExpression = getExpression();
   
  -	// $$ ToDO: Can we reduce this to some call on the
  -	// XPathExpression interface?
  -	const OpCodePositionType	argLen =
  -		currentExpression.getOpCodeMapValue(opPos + XPathExpression::s_opCodeMapLengthIndex + 1) - 3;
  +	const OpCodeMapValueType    argLen =
  +		currentExpression.getOpCodeArgumentLength(opPos);
   
   	XalanNode* const	docContext = XalanNode::DOCUMENT_NODE == context->getNodeType() ?
   									context :
  @@ -3461,16 +3475,16 @@
   
   	subQueryResults.setDocumentOrder();
   
  -	return argLen + 3;
  +	return opPos + argLen + 3;
   }
   
   
   
  -XPath::OpCodePositionType
  +XPath::OpCodeMapPositionType
   XPath::findParent(
   			XPathExecutionContext&	executionContext,
   			XalanNode*				context, 
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			OpCodeMapValueType 		stepType,
   			MutableNodeRefList& 	subQueryResults) const
   {
  @@ -3479,19 +3493,17 @@
   
   	const XPathExpression&	currentExpression = getExpression();
   
  -	// $$ ToDO: Can we reduce this to some call on the
  -	// XPathExpression interface?
  -	const OpCodePositionType	argLen =
  -			currentExpression.getOpCodeMapValue(opPos + XPathExpression::s_opCodeMapLengthIndex + 1) - 3;
  +	const OpCodeMapValueType    argLen =
  +			currentExpression.getOpCodeArgumentLength(opPos);
   
   	XalanNode* const	theParent = DOMServices::getParentOfNode(*context);
   
  +	opPos += 3;
  +
   	if(0 != theParent)
   	{
   		if(argLen > 0)
   		{
  -			opPos += 3;
  -
   			const NodeTester	theTester(
   							*this,
   							executionContext,
  @@ -3515,16 +3527,16 @@
   
   	subQueryResults.setDocumentOrder();
   
  -	return argLen + 3;
  +	return opPos + argLen;
   }
   
   
   
  -XPath::OpCodePositionType
  +XPath::OpCodeMapPositionType
   XPath::findSelf(
   			XPathExecutionContext&	executionContext,
   			XalanNode*				context, 
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			OpCodeMapValueType 		stepType,
   			MutableNodeRefList& 	subQueryResults) const
   {
  @@ -3533,10 +3545,10 @@
   
   	const XPathExpression&	currentExpression = getExpression();
   
  -	// $$ ToDO: Can we reduce this to some call on the
  -	// XPathExpression interface?
  -	const OpCodePositionType	argLen =
  -		currentExpression.getOpCodeMapValue(opPos + XPathExpression::s_opCodeMapLengthIndex + 1) - 3;
  +	const OpCodeMapValueType    argLen =
  +		currentExpression.getOpCodeArgumentLength(opPos);
  +
  +	opPos += 3;
   
   	if(argLen == 0)
   	{
  @@ -3544,8 +3556,6 @@
   	}
   	else
   	{
  -		opPos += 3;
  -
   		const NodeTester	theTester(
   						*this,
   						executionContext,
  @@ -3565,16 +3575,16 @@
   
   	subQueryResults.setDocumentOrder();
   
  -	return argLen + 3;
  +	return opPos + argLen;
   }
   
   
   
  -XPath::OpCodePositionType
  +XPath::OpCodeMapPositionType
   XPath::findAncestors(
   			XPathExecutionContext&	executionContext,
   			XalanNode*				context, 
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			OpCodeMapValueType 		stepType,
   			MutableNodeRefList& 	subQueryResults) const
   {
  @@ -3585,15 +3595,13 @@
   
   	const XPathExpression&	currentExpression = getExpression();
   
  -	// $$ ToDO: Can we reduce this to some call on the
  -	// XPathExpression interface?
  -	const OpCodePositionType	argLen =
  -			currentExpression.getOpCodeMapValue(opPos + XPathExpression::s_opCodeMapLengthIndex + 1) - 3;
  +	const OpCodeMapValueType    argLen =
  +			currentExpression.getOpCodeArgumentLength(opPos);
  +
  +	opPos += 3;
   
   	if (context != 0)
   	{
  -		opPos += 3;
  -
   		const NodeTester	theTester(
   						*this,
   						executionContext,
  @@ -3618,16 +3626,16 @@
   
   	subQueryResults.setReverseDocumentOrder();
   
  -	return argLen + 3;
  +	return opPos + argLen;
   }
   
   
   
  -XPath::OpCodePositionType
  +XPath::OpCodeMapPositionType
   XPath::findAncestorsOrSelf(
   			XPathExecutionContext&	executionContext,
   			XalanNode*				context, 
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			OpCodeMapValueType 		stepType,
   			MutableNodeRefList& 	subQueryResults) const
   {
  @@ -3636,10 +3644,8 @@
   
   	const XPathExpression&	currentExpression = getExpression();
   
  -	// $$ ToDO: Can we reduce this to some call on the
  -	// XPathExpression interface?
  -	const OpCodePositionType	argLen =
  -		currentExpression.getOpCodeMapValue(opPos + XPathExpression::s_opCodeMapLengthIndex + 1) - 3;
  +	const OpCodeMapValueType	argLen =
  +		currentExpression.getOpCodeArgumentLength(opPos);
   
   	opPos += 3;
   
  @@ -3666,16 +3672,16 @@
   
   	subQueryResults.setReverseDocumentOrder();
   
  -	return argLen + 3;
  +	return opPos + argLen;
   }
   
   
   
  -XPath::OpCodePositionType
  +XPath::OpCodeMapPositionType
   XPath::findAttributes(
   			XPathExecutionContext&	executionContext,
   			XalanNode*				context, 
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			OpCodeMapValueType		stepType,
   			MutableNodeRefList& 	subQueryResults) const
   {
  @@ -3684,10 +3690,10 @@
   
   	const XPathExpression&	currentExpression = getExpression();
   
  -	// $$ ToDO: Can we reduce this to some call on the
  -	// XPathExpression interface?
  -	const OpCodePositionType	argLen =
  -				currentExpression.getOpCodeMapValue(opPos + XPathExpression::s_opCodeMapLengthIndex + 1) - 3;
  +	const OpCodeMapValueType	argLen =
  +				currentExpression.getOpCodeArgumentLength(opPos);
  +
  +	opPos += 3;
   
   	if(context->getNodeType() == XalanNode::ELEMENT_NODE)
   	{
  @@ -3695,8 +3701,6 @@
   
   		if(attributeList != 0) 
   		{
  -			opPos += 3;
  -
   			const unsigned int	nAttrs = attributeList->getLength();
   
   			if (nAttrs != 0)
  @@ -3728,16 +3732,16 @@
   
   	subQueryResults.setDocumentOrder();
   
  -	return argLen + 3;
  +	return opPos + argLen;
   }
   
   
   
  -XPath::OpCodePositionType
  +XPath::OpCodeMapPositionType
   XPath::findChildren(
   			XPathExecutionContext&	executionContext,
   			XalanNode*				context, 
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			OpCodeMapValueType		stepType,
   			MutableNodeRefList& 	subQueryResults) const
   {
  @@ -3748,15 +3752,13 @@
   
   	const XPathExpression&	currentExpression = getExpression();
   
  -	// $$ ToDO: Can we reduce this to some call on the
  -	// XPathExpression interface?
  -	const OpCodePositionType	argLen =
  -		currentExpression.getOpCodeMapValue(opPos + XPathExpression::s_opCodeMapLengthIndex + 1) - 3;
  +	const OpCodeMapValueType    argLen =
  +		currentExpression.getOpCodeArgumentLength(opPos);
  +
  +	opPos += 3;
   
   	if (child != 0)
   	{
  -		opPos += 3;
  -
   		const NodeTester	theTester(
   						*this,
   						executionContext,
  @@ -3781,16 +3783,16 @@
   
   	subQueryResults.setDocumentOrder();
   
  -	return argLen + 3;
  +	return opPos + argLen;
   }
   
   
   
  -XPath::OpCodePositionType
  +XPath::OpCodeMapPositionType
   XPath::findDescendants(
   			XPathExecutionContext&	executionContext,
   			XalanNode*				context, 
  -			OpCodePositionType 	    opPos,
  +			OpCodeMapPositionType 	opPos,
   			OpCodeMapValueType 		stepType,
   			MutableNodeRefList& 	subQueryResults) const
   {
  @@ -3799,10 +3801,8 @@
   
   	const XPathExpression&	currentExpression = getExpression();
   
  -	// $$ ToDO: Can we reduce this to some call on the
  -	// XPathExpression interface?
  -	const OpCodePositionType	argLen =
  -		currentExpression.getOpCodeMapValue(opPos + XPathExpression::s_opCodeMapLengthIndex + 1) - 3;
  +	const OpCodeMapValueType    argLen =
  +		currentExpression.getOpCodeArgumentLength(opPos);
   
   	// Perform a pre-order traversal of descendents...
   	XalanNode*	pos = context;
  @@ -3857,16 +3857,16 @@
   
   	subQueryResults.setDocumentOrder();
   
  -	return argLen + 3;
  +	return opPos + argLen;
   }
   
   
   
  -XPath::OpCodePositionType
  +XPath::OpCodeMapPositionType
   XPath::findFollowing(
   			XPathExecutionContext&	executionContext,
   			XalanNode*				context, 
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			OpCodeMapValueType 		stepType,
   			MutableNodeRefList& 	subQueryResults) const
   {
  @@ -3875,10 +3875,8 @@
   
   	const XPathExpression&	currentExpression = getExpression();
   
  -	// $$ ToDO: Can we reduce this to some call on the
  -	// XPathExpression interface?
  -	const OpCodePositionType	argLen =
  -		currentExpression.getOpCodeMapValue(opPos + XPathExpression::s_opCodeMapLengthIndex + 1) - 3;
  +	const OpCodeMapValueType    argLen =
  +		currentExpression.getOpCodeArgumentLength(opPos);
   
   	opPos += 3;
   
  @@ -3954,16 +3952,16 @@
   
   	subQueryResults.setDocumentOrder();
   
  -	return argLen + 3;
  +	return opPos + argLen;
   }
   
   
   
  -XPath::OpCodePositionType
  +XPath::OpCodeMapPositionType
   XPath::findFollowingSiblings(
   			XPathExecutionContext&	executionContext,
   			XalanNode*				context, 
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			OpCodeMapValueType 		stepType,
   			MutableNodeRefList& 	subQueryResults) const
   {
  @@ -3972,17 +3970,15 @@
   
   	const XPathExpression&	currentExpression = getExpression();
   
  -	// $$ ToDO: Can we reduce this to some call on the
  -	// XPathExpression interface?
  -	const OpCodePositionType	argLen =
  -		currentExpression.getOpCodeMapValue(opPos + XPathExpression::s_opCodeMapLengthIndex + 1) - 3;
  +	const OpCodeMapValueType	argLen =
  +		currentExpression.getOpCodeArgumentLength(opPos);
   
   	XalanNode*	pos = context->getNextSibling();
   
  +	opPos += 3;
  +
   	if (pos != 0)
   	{
  -		opPos += 3;
  -
   		const NodeTester	theTester(
   						*this,
   						executionContext,
  @@ -4007,7 +4003,7 @@
   
   	subQueryResults.setDocumentOrder();
   
  -	return argLen + 3;
  +	return opPos + argLen;
   }
   
   
  @@ -4058,11 +4054,11 @@
   
   
   
  -XPath::OpCodePositionType
  +XPath::OpCodeMapPositionType
   XPath::findPreceeding(
   			XPathExecutionContext&	executionContext,
   			XalanNode*				context, 
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			OpCodeMapValueType		stepType,
   			MutableNodeRefList& 	subQueryResults) const
   {
  @@ -4071,10 +4067,8 @@
   
   	const XPathExpression&	currentExpression = getExpression();
   
  -	// $$ ToDO: Can we reduce this to some call on the
  -	// XPathExpression interface?
  -	const OpCodePositionType	argLen =
  -		currentExpression.getOpCodeMapValue(opPos + XPathExpression::s_opCodeMapLengthIndex + 1) - 3;
  +	const OpCodeMapValueType    argLen =
  +		currentExpression.getOpCodeArgumentLength(opPos);
   
   	opPos += 3;
   
  @@ -4177,16 +4171,16 @@
   
   	subQueryResults.setReverseDocumentOrder();
   
  -	return argLen + 3;
  +	return opPos + argLen;
   }
   
   
   
  -XPath::OpCodePositionType
  +XPath::OpCodeMapPositionType
   XPath::findPreceedingSiblings(
   			XPathExecutionContext&	executionContext,
   			XalanNode*				context, 
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			OpCodeMapValueType		stepType,
   			MutableNodeRefList& 	subQueryResults) const
   {
  @@ -4195,18 +4189,16 @@
   
   	const XPathExpression&	currentExpression = getExpression();
   
  -	// $$ ToDO: Can we reduce this to some call on the
  -	// XPathExpression interface?
  -	const OpCodePositionType	argLen =
  -		currentExpression.getOpCodeMapValue(opPos + XPathExpression::s_opCodeMapLengthIndex + 1) - 3;
  +	const OpCodeMapValueType    argLen =
  +		currentExpression.getOpCodeArgumentLength(opPos);
  +
  +	opPos += 3;
   
   #if 1
   	XalanNode*	pos = context->getPreviousSibling();
   
   	if (pos != 0)
   	{
  -		opPos += 3;
  -
   		const NodeTester	theTester(
   						*this,
   						executionContext,
  @@ -4239,8 +4231,6 @@
   
   		if (pos != context)
   		{
  -			opPos += 3;
  -
   			const NodeTester	theTester(
   							*this,
   							executionContext,
  @@ -4272,16 +4262,16 @@
   
   	subQueryResults.setReverseDocumentOrder();
   
  -	return argLen + 3;
  +	return opPos + argLen;
   }
   
   
   
  -XPath::OpCodePositionType
  +XPath::OpCodeMapPositionType
   XPath::findNamespace(
   			XPathExecutionContext&	executionContext,
   			XalanNode*				context, 
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			OpCodeMapValueType		stepType,
   			MutableNodeRefList& 	subQueryResults) const
   {
  @@ -4290,15 +4280,13 @@
   
   	const XPathExpression&	currentExpression = getExpression();
   
  -	// $$ ToDO: Can we reduce this to some call on the
  -	// XPathExpression interface?
  -	const OpCodePositionType	argLen =
  -		currentExpression.getOpCodeMapValue(opPos + XPathExpression::s_opCodeMapLengthIndex + 1) - 3;
  +	const OpCodeMapValueType	argLen =
  +		currentExpression.getOpCodeArgumentLength(opPos);
  +
  +	opPos += 3;
   
   	if(context->getNodeType() == XalanNode::ELEMENT_NODE)
   	{
  -		opPos += 3;
  -
   		// Look up the element chain until we hit the document, so that we
   		// get all of the attribute/namespace nodes.
   		const XalanNode* const	theOwnerDocument = context->getOwnerDocument();
  @@ -4389,32 +4377,30 @@
   
   	subQueryResults.setDocumentOrder();
   
  -	return argLen + 3;
  +	return opPos + argLen;
   }
   
   
   
  -XPath::OpCodePositionType
  +XPath::OpCodeMapPositionType
   XPath::findNodesOnUnknownAxis(
   			XPathExecutionContext&	executionContext,
   			XalanNode*				context, 
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			OpCodeMapValueType 	    /* stepType */,
   			MutableNodeRefList& 	/* subQueryResults */) const
   {
   	const XPathExpression&	currentExpression = getExpression();
   
  -	// $$ ToDO: Can we reduce this to some call on the
  -	// XPathExpression interface?
  -	const OpCodePositionType	argLen =
  -		currentExpression.getOpCodeMapValue(opPos + XPathExpression::s_opCodeMapLengthIndex + 1) - 3;
  +	const OpCodeMapValueType	argLen =
  +		currentExpression.getOpCodeArgumentLength(opPos);
   
   	executionContext.error(
   			XalanMessageLoader::getMessage(XalanMessages::UnknownAxis),
   			context,
   			getLocator());
   
  -	return argLen + 3;
  +	return opPos + argLen + 3;
   }
   
   
  @@ -4424,8 +4410,8 @@
   			XPathExecutionContext&	executionContext,
   			XalanNode* 				context,
   			XalanNode::NodeType		nodeType,
  -			OpCodePositionType 		opPos,
  -			OpCodePositionType 		argLen,
  +			OpCodeMapPositionType 	opPos,
  +			OpCodeMapValueType 	    argLen,
   			OpCodeMapValueType 		stepType) const
   {
   	assert(context->getNodeType() == nodeType);
  @@ -4518,8 +4504,10 @@
   				bool					test = false;
   
   				OpCodeMapValueType 		queueIndex = currentExpression.getOpCodeMapValue(opPos);
  +                assert(queueIndex == XPathExpression::eEMPTY ||
  +                       queueIndex < currentExpression.tokenQueueSize());
   
  -				const XalanDOMString&	targetNS = queueIndex >= 0 ?
  +                const XalanDOMString&	targetNS = queueIndex != XPathExpression::eEMPTY ?
   										currentExpression.getToken(queueIndex)->str() :
   											s_emptyString;
   
  @@ -4698,10 +4686,10 @@
   
   
   
  -XPath::OpCodePositionType
  +XPath::OpCodeMapPositionType
   XPath::predicates(
   			XPathExecutionContext&	executionContext,
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			MutableNodeRefList& 	subQueryResults) const
   {
   	assert(&executionContext.getContextNodeList() == &subQueryResults);
  @@ -4720,7 +4708,7 @@
   		// update endPredicatePos.
   		if (theLength > 0)
   		{
  -			const OpCodePositionType	predOpPos = opPos + 2;
  +			const OpCodeMapPositionType	predOpPos = opPos + 2;
   
   			// OK, this is a huge hack/optimization.  If the predicate is
   			// simple a number, such as [2], we can just get the
  @@ -4816,8 +4804,8 @@
   XPath::NodeTester::NodeTester(
   			const XPath&			xpath,
   			XPathExecutionContext&	executionContext,
  -			OpCodePositionType 		opPos,
  -			OpCodePositionType 		argLen,
  +			OpCodeMapPositionType 	opPos,
  +			OpCodeMapValueType 	    argLen,
   			OpCodeMapValueType		stepType) :
   	m_executionContext(executionContext),
   	m_targetNamespace(0),
  
  
  
  1.6       +193 -144  xml-xalan/c/src/xalanc/XPath/XPath.hpp
  
  Index: XPath.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XPath/XPath.hpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XPath.hpp	11 Feb 2004 01:08:30 -0000	1.5
  +++ XPath.hpp	12 Feb 2004 05:36:02 -0000	1.6
  @@ -104,8 +104,9 @@
   
   	typedef XERCES_CPP_NAMESPACE_QUALIFIER Locator	LocatorType;
   
  -    typedef XPathExpression::OpCodeMapSizeType      OpCodePositionType;
  -    typedef XPathExpression::OpCodeMapValueType     OpCodeMapValueType;
  +    typedef XPathExpression::OpCodeMapPositionType      OpCodeMapPositionType;
  +    typedef XPathExpression::OpCodeMapValueType         OpCodeMapValueType;
  +    typedef XPathExpression::TokenQueuePositionType     TokenQueuePositionType;
   
   	static const XalanDOMChar	PSEUDONAME_ANY[];
   	static const XalanDOMChar	PSEUDONAME_ROOT[];
  @@ -495,7 +496,10 @@
   		assert(executionContext.getCurrentNode() != 0);
   		assert(executionContext.getPrefixResolver() != 0);
   
  -		return executeMore(executionContext.getCurrentNode(), 0, executionContext);
  +		return executeMore(
  +                executionContext.getCurrentNode(),
  +                m_expression.getInitialOpCodePosition(),
  +                executionContext);
   	}
   
   	/**
  @@ -515,7 +519,11 @@
   		assert(executionContext.getCurrentNode() != 0);
   		assert(executionContext.getPrefixResolver() != 0);
   
  -		executeMore(executionContext.getCurrentNode(), 0, executionContext, result);
  +		executeMore(
  +                executionContext.getCurrentNode(),
  +                m_expression.getInitialOpCodePosition(),
  +                executionContext,
  +                result);
   	}
   
   	/**
  @@ -535,7 +543,11 @@
   		assert(executionContext.getCurrentNode() != 0);
   		assert(executionContext.getPrefixResolver() != 0);
   
  -		executeMore(executionContext.getCurrentNode(), 0, executionContext, result);
  +		executeMore(
  +                executionContext.getCurrentNode(),
  +                m_expression.getInitialOpCodePosition(),
  +                executionContext,
  +                result);
   	}
   
   	/**
  @@ -556,7 +568,11 @@
   		assert(executionContext.getCurrentNode() != 0);
   		assert(executionContext.getPrefixResolver() != 0);
   
  -		executeMore(executionContext.getCurrentNode(), 0, executionContext, result);
  +		executeMore(
  +                executionContext.getCurrentNode(),
  +                m_expression.getInitialOpCodePosition(),
  +                executionContext,
  +                result);
   	}
   
   	/**
  @@ -578,7 +594,12 @@
   		assert(executionContext.getCurrentNode() != 0);
   		assert(executionContext.getPrefixResolver() != 0);
   
  -		executeMore(executionContext.getCurrentNode(), 0, executionContext, formatterListener, function);
  +		executeMore(
  +                executionContext.getCurrentNode(),
  +                m_expression.getInitialOpCodePosition(),
  +                executionContext,
  +                formatterListener,
  +                function);
   	}
   
   	/**
  @@ -609,7 +630,11 @@
   		assert(executionContext.getCurrentNode() != 0);
   		assert(executionContext.getPrefixResolver() != 0);
   
  -		return executeMore(executionContext.getCurrentNode(), 0, executionContext, result);
  +		return executeMore(
  +                executionContext.getCurrentNode(),
  +                m_expression.getInitialOpCodePosition(),
  +                executionContext,
  +                result);
   	}
   
   	/**
  @@ -630,11 +655,14 @@
   		assert(executionContext.getCurrentNode() != 0);
   
   		// Push and pop the PrefixResolver...
  -		XPathExecutionContext::PrefixResolverSetAndRestore	theResolverSetAndRestore(
  +		const XPathExecutionContext::PrefixResolverSetAndRestore	theResolverSetAndRestore(
   										executionContext,
   										&prefixResolver);
   
  -		return executeMore(executionContext.getCurrentNode(), 0, executionContext);
  +		return executeMore(
  +                executionContext.getCurrentNode(),
  +                m_expression.getInitialOpCodePosition(),
  +                executionContext);
   	}
   
   	/**
  @@ -656,11 +684,15 @@
   		assert(executionContext.getCurrentNode() != 0);
   
   		// Push and pop the PrefixResolver...
  -		XPathExecutionContext::PrefixResolverSetAndRestore	theResolverSetAndRestore(
  +		const XPathExecutionContext::PrefixResolverSetAndRestore	theResolverSetAndRestore(
   										executionContext,
   										&prefixResolver);
   
  -		executeMore(executionContext.getCurrentNode(), 0, executionContext, result);
  +		executeMore(
  +                executionContext.getCurrentNode(),
  +                m_expression.getInitialOpCodePosition(),
  +                executionContext,
  +                result);
   	}
   
   	/**
  @@ -682,11 +714,15 @@
   		assert(executionContext.getCurrentNode() != 0);
   
   		// Push and pop the PrefixResolver...
  -		XPathExecutionContext::PrefixResolverSetAndRestore	theResolverSetAndRestore(
  +		const XPathExecutionContext::PrefixResolverSetAndRestore	theResolverSetAndRestore(
   										executionContext,
   										&prefixResolver);
   
  -		executeMore(executionContext.getCurrentNode(), 0, executionContext, result);
  +		executeMore(
  +                executionContext.getCurrentNode(),
  +                m_expression.getInitialOpCodePosition(),
  +                executionContext,
  +                result);
   	}
   
   	/**
  @@ -709,11 +745,15 @@
   		assert(executionContext.getCurrentNode() != 0);
   
   		// Push and pop the PrefixResolver...
  -		XPathExecutionContext::PrefixResolverSetAndRestore	theResolverSetAndRestore(
  +		const XPathExecutionContext::PrefixResolverSetAndRestore	theResolverSetAndRestore(
   										executionContext,
   										&prefixResolver);
   
  -		executeMore(executionContext.getCurrentNode(), 0, executionContext, result);
  +		executeMore(
  +                executionContext.getCurrentNode(),
  +                m_expression.getInitialOpCodePosition(),
  +                executionContext,
  +                result);
   	}
   
   	/**
  @@ -734,11 +774,16 @@
   		assert(executionContext.getCurrentNode() != 0);
   
   		// Push and pop the PrefixResolver...
  -		XPathExecutionContext::PrefixResolverSetAndRestore	theResolverSetAndRestore(
  +		const XPathExecutionContext::PrefixResolverSetAndRestore	theResolverSetAndRestore(
   										executionContext,
   										&prefixResolver);
   
  -		executeMore(executionContext.getCurrentNode(), 0, executionContext, formatterListener, function);
  +		executeMore(
  +                executionContext.getCurrentNode(),
  +                m_expression.getInitialOpCodePosition(),
  +                executionContext,
  +                formatterListener,
  +                function);
   	}
   
   	/**
  @@ -771,11 +816,15 @@
   		assert(executionContext.getCurrentNode() != 0);
   
   		// Push and pop the PrefixResolver...
  -		XPathExecutionContext::PrefixResolverSetAndRestore	theResolverSetAndRestore(
  +		const XPathExecutionContext::PrefixResolverSetAndRestore	theResolverSetAndRestore(
   										executionContext,
   										&prefixResolver);
   
  -		return executeMore(executionContext.getCurrentNode(), 0, executionContext, result);
  +		return executeMore(
  +                executionContext.getCurrentNode(),
  +                m_expression.getInitialOpCodePosition(),
  +                executionContext,
  +                result);
   	}
   
   	/**
  @@ -867,7 +916,7 @@
   	const XObjectPtr
   	predicate(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   	{
   		return executeMore(context, opPos + 2, executionContext);
  @@ -1031,7 +1080,7 @@
   	const XObjectPtr
   	locationPath(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const;
   
   	/**
  @@ -1045,7 +1094,7 @@
   	void
   	locationPath(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			bool&					theResult) const;
   
  @@ -1060,7 +1109,7 @@
   	void
   	locationPath(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			double&					theResult) const;
   
  @@ -1075,7 +1124,7 @@
   	void
   	locationPath(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			XalanDOMString&			theResult) const;
   
  @@ -1091,7 +1140,7 @@
   	void
   	locationPath(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			FormatterListener&		formatterListener,
   			MemberFunctionPtr		function) const;
  @@ -1107,7 +1156,7 @@
   	void
   	locationPath(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			MutableNodeRefList&		theResult) const
   	{
  @@ -1125,7 +1174,7 @@
   	const XObjectPtr
   	executeMore(
   			XalanNode* 				context,
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			XPathExecutionContext&	executionContext) const;
   
   	/**
  @@ -1139,7 +1188,7 @@
   	void
   	executeMore(
   			XalanNode* 				context,
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			XPathExecutionContext&	executionContext,
   			bool&					theResult) const;
   
  @@ -1154,7 +1203,7 @@
   	void
   	executeMore(
   			XalanNode* 				context,
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			XPathExecutionContext&	executionContext,
   			double&					theResult) const;
   
  @@ -1170,7 +1219,7 @@
   	void
   	executeMore(
   			XalanNode* 				context,
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			XPathExecutionContext&	executionContext,
   			XalanDOMString&			theResult) const;
   
  @@ -1186,7 +1235,7 @@
   	void
   	executeMore(
   			XalanNode* 				context,
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			XPathExecutionContext&	executionContext,
   			FormatterListener&		formatterListener,
   			MemberFunctionPtr		function) const;
  @@ -1203,7 +1252,7 @@
   	const XObjectPtr
   	executeMore(
   			XalanNode* 				context,
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			XPathExecutionContext&	executionContext,
   			MutableNodeRefList&		theResult) const;
   
  @@ -1229,7 +1278,7 @@
   	bool
   	Or(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const;
   
   	/**
  @@ -1242,7 +1291,7 @@
   	bool
   	And(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const;
   
   	/**
  @@ -1255,7 +1304,7 @@
   	bool
   	notequals(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const;
   
   	/**
  @@ -1268,7 +1317,7 @@
   	bool
   	equals(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const;
   
   	/**
  @@ -1281,7 +1330,7 @@
   	bool
   	lte(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const;
   
   	/**
  @@ -1294,7 +1343,7 @@
   	bool
   	lt(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const;
   
   	/**
  @@ -1307,7 +1356,7 @@
   	bool
   	gte(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const;
   
   	/**
  @@ -1320,7 +1369,7 @@
   	bool
   	gt(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const;
   
   	/**
  @@ -1333,7 +1382,7 @@
   	double
   	plus(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const;
   
   	/**
  @@ -1347,7 +1396,7 @@
   	void
   	plus(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			FormatterListener&		formatterListener,
   			MemberFunctionPtr		function) const;
  @@ -1362,7 +1411,7 @@
   	double
   	minus(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const;
   
   	/**
  @@ -1376,7 +1425,7 @@
   	void
   	minus(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			FormatterListener&		formatterListener,
   			MemberFunctionPtr		function) const;
  @@ -1391,7 +1440,7 @@
   	double
   	mult(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const;
   
   	/**
  @@ -1405,7 +1454,7 @@
   	void
   	mult(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			FormatterListener&		formatterListener,
   			MemberFunctionPtr		function) const;
  @@ -1420,7 +1469,7 @@
   	double
   	div(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const;
   
   	/**
  @@ -1434,7 +1483,7 @@
   	void
   	div(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			FormatterListener&		formatterListener,
   			MemberFunctionPtr		function) const;
  @@ -1449,7 +1498,7 @@
   	double
   	mod(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const;
   
   	/**
  @@ -1463,7 +1512,7 @@
   	void
   	mod(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			FormatterListener&		formatterListener,
   			MemberFunctionPtr		function) const;
  @@ -1478,7 +1527,7 @@
   	double
   	neg(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const;
   
   	/**
  @@ -1492,7 +1541,7 @@
   	void
   	neg(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			FormatterListener&		formatterListener,
   			MemberFunctionPtr		function) const;
  @@ -1507,7 +1556,7 @@
   	const XObjectPtr
   	Union(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const;
   
   	/**
  @@ -1521,7 +1570,7 @@
   	void
   	Union(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			bool&					result) const;
   
  @@ -1536,7 +1585,7 @@
   	void
   	Union(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			double&					result) const;
   
  @@ -1551,7 +1600,7 @@
   	void
   	Union(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			XalanDOMString&			result) const;
   
  @@ -1567,7 +1616,7 @@
   	void
   	Union(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			FormatterListener&		formatterListener,
   			MemberFunctionPtr		function) const;
  @@ -1582,7 +1631,7 @@
   	void
   	Union(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			MutableNodeRefList&		result) const;
   
  @@ -1594,7 +1643,7 @@
   	 */
   	const XObjectPtr
   	literal(
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const;
     
   	/**
  @@ -1605,8 +1654,8 @@
   	 */
   	void
   	literal(
  -			OpCodePositionType	opPos,
  -			bool&	            theResult) const;
  +			OpCodeMapPositionType	opPos,
  +			bool&	                theResult) const;
   
   	/**
   	 * Get a literal value as a number.
  @@ -1616,8 +1665,8 @@
   	 */
   	void
   	literal(
  -			OpCodePositionType	opPos,
  -			double&		        theResult) const;
  +			OpCodeMapPositionType	opPos,
  +			double&		            theResult) const;
   
   	/**
   	 * Get a literal value.  The value is appended to the
  @@ -1628,8 +1677,8 @@
   	 */
   	void
   	literal(
  -			OpCodePositionType	opPos,
  -			XalanDOMString&		theResult) const;
  +			OpCodeMapPositionType	opPos,
  +			XalanDOMString&		    theResult) const;
   
   	/**
   	 * Get a literal value.
  @@ -1639,9 +1688,9 @@
   	 */
   	void
   	literal(
  -			OpCodePositionType	opPos,
  -			FormatterListener&	formatterListener,
  -			MemberFunctionPtr	function) const;
  +			OpCodeMapPositionType	opPos,
  +			FormatterListener&	    formatterListener,
  +			MemberFunctionPtr	    function) const;
   
   	/**
   	 * Get the value of a variable.
  @@ -1651,7 +1700,7 @@
   	 */
   	const XObjectPtr
   	variable(
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const;
   
   	/**
  @@ -1664,7 +1713,7 @@
   	const XObjectPtr
   	group(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   	{
   		return executeMore(context, opPos + 2, executionContext);
  @@ -1680,7 +1729,7 @@
   	void
   	group(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			bool&					theResult) const
   	{
  @@ -1697,7 +1746,7 @@
   	void
   	group(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			double&					theResult) const
   	{
  @@ -1714,7 +1763,7 @@
   	void
   	group(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			XalanDOMString&			theResult) const
   	{
  @@ -1733,7 +1782,7 @@
   	void
   	group(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			FormatterListener&		formatterListener,
   			MemberFunctionPtr		function) const
  @@ -1751,7 +1800,7 @@
   	void
   	group(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext,
   			MutableNodeRefList&		theResult) const
   	{
  @@ -1764,7 +1813,7 @@
   	 * @return The result as a double.
   	 */
   	double
  -	numberlit(OpCodePositionType	opPos) const;
  +	numberlit(OpCodeMapPositionType	    opPos) const;
   
   	/**
   	 * Get a literal value.
  @@ -1773,7 +1822,7 @@
   	 */
   	const XObjectPtr
   	numberlit(
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const;
   
   	/**
  @@ -1784,8 +1833,8 @@
   	 */
   	void
   	numberlit(
  -			OpCodePositionType	opPos,
  -			bool&	            theResult) const;
  +			OpCodeMapPositionType	opPos,
  +			bool&	                theResult) const;
   
   	/**
   	 * Get a literal value.  The value is appended to the
  @@ -1796,8 +1845,8 @@
   	 */
   	void
   	numberlit(
  -			OpCodePositionType	opPos,
  -			XalanDOMString&		theResult) const;
  +			OpCodeMapPositionType	opPos,
  +			XalanDOMString&		    theResult) const;
   
   	/**
   	 * Get a literal value.
  @@ -1808,9 +1857,9 @@
   	 */
   	void
   	numberlit(
  -			OpCodePositionType	opPos,
  -			FormatterListener&	formatterListener,
  -			MemberFunctionPtr	function) const;
  +			OpCodeMapPositionType	opPos,
  +			FormatterListener&	    formatterListener,
  +			MemberFunctionPtr	    function) const;
   
   	/**
   	 * Setup for and run an extension function.
  @@ -1822,7 +1871,7 @@
   	const XObjectPtr
   	runExtFunction(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const;
   
   	/**
  @@ -1837,7 +1886,7 @@
   	const XObjectPtr
   	extfunction(
   			XalanNode*								context,
  -			OpCodePositionType						/* opPos */,
  +			OpCodeMapPositionType					/* opPos */,
   			const XalanDOMString&					theNamespace,
   			const XalanDOMString&					functionName, 
   			const Function::XObjectArgVectorType&	argVec,
  @@ -1860,7 +1909,7 @@
   	const XObjectPtr
   	runFunction(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const;
   
   	/**
  @@ -1921,7 +1970,7 @@
   	double
   	functionCount(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const;
   
   	/**
  @@ -1935,7 +1984,7 @@
   	bool
   	functionNot(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   	{
   		assert(context != 0);
  @@ -1954,7 +2003,7 @@
   	bool
   	functionBoolean(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   	{
   		assert(context != 0);
  @@ -1991,7 +2040,7 @@
   	const XalanDOMString&
   	functionName(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const;
   
   	/**
  @@ -2014,7 +2063,7 @@
   	const XalanDOMString&
   	functionLocalName(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const;
   
   	/**
  @@ -2045,7 +2094,7 @@
   	double
   	functionNumber(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   	{
   		double	result;
  @@ -2066,7 +2115,7 @@
   	double
   	functionFloor(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   	{
   		return DoubleSupport::floor(functionNumber(context, opPos, executionContext));
  @@ -2083,7 +2132,7 @@
   	double
   	functionCeiling(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   	{
   		return DoubleSupport::ceiling(functionNumber(context, opPos, executionContext));
  @@ -2100,7 +2149,7 @@
   	double
   	functionRound(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const
   	{
   		return DoubleSupport::round(functionNumber(context, opPos, executionContext));
  @@ -2126,7 +2175,7 @@
   	double
   	functionStringLength(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const;
   
   	/**
  @@ -2140,7 +2189,7 @@
   	double
   	functionSum(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const;
   
   	/**
  @@ -2153,7 +2202,7 @@
   	double
   	getNumericOperand(
   			XalanNode*				context,
  -			OpCodePositionType		opPos,
  +			OpCodeMapPositionType	opPos,
   			XPathExecutionContext&	executionContext) const;
   
   private:
  @@ -2177,7 +2226,7 @@
   	locationPathPattern(
   			XPathExecutionContext&	executionContext,
   			XalanNode& 				context, 
  -			OpCodePositionType 		opPos) const;
  +			OpCodeMapPositionType 	opPos) const;
   
   	class NodeTester
   	{
  @@ -2186,8 +2235,8 @@
   		NodeTester(
   			const XPath&			xpath,
   			XPathExecutionContext&	executionContext,
  -			OpCodePositionType 		opPos,
  -			OpCodePositionType 		argLen,
  +			OpCodeMapPositionType 	opPos,
  +			OpCodeMapValueType 	    argLen,
   			OpCodeMapValueType 		stepType);
   
   		eMatchScore
  @@ -2321,7 +2370,7 @@
   	step(
   			XPathExecutionContext&	executionContext,
   			XalanNode* 				context, 
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			MutableNodeRefList&		queryResults) const;
   
   	/**
  @@ -2338,126 +2387,126 @@
   	stepPattern(
   			XPathExecutionContext&	executionContext,
   			XalanNode* 				context, 
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			eMatchScore& 			scoreHolder) const;
   
  -	OpCodePositionType
  +	OpCodeMapPositionType
   	findNodeSet(
   			XPathExecutionContext&	executionContext,
   			XalanNode* 				context, 
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			OpCodeMapValueType 	    stepType,
   			MutableNodeRefList& 	subQueryResults) const;
   
  -	OpCodePositionType
  +	OpCodeMapPositionType
   	findRoot(
   			XPathExecutionContext&	executionContext,
   			XalanNode* 				context, 
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			OpCodeMapValueType 		stepType,
   			MutableNodeRefList& 	subQueryResults) const;
   
  -	OpCodePositionType
  +	OpCodeMapPositionType
   	findParent(
   			XPathExecutionContext&	executionContext,
   			XalanNode* 				context, 
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			OpCodeMapValueType 		stepType,
   			MutableNodeRefList& 	subQueryResults) const;
   
  -	OpCodePositionType
  +	OpCodeMapPositionType
   	findSelf(
   			XPathExecutionContext&	executionContext,
   			XalanNode* 				context, 
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			OpCodeMapValueType 		stepType,
   			MutableNodeRefList& 	subQueryResults) const;
   
  -	OpCodePositionType
  +	OpCodeMapPositionType
   	findAncestors(
   			XPathExecutionContext&	executionContext,
   			XalanNode* 				context, 
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			OpCodeMapValueType 		stepType,
   			MutableNodeRefList& 	subQueryResults) const;
   
  -	OpCodePositionType
  +	OpCodeMapPositionType
   	findAncestorsOrSelf(
   			XPathExecutionContext&	executionContext,
   			XalanNode* 				context, 
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			OpCodeMapValueType 		stepType,
   			MutableNodeRefList& 	subQueryResults) const;
   
  -	OpCodePositionType
  +	OpCodeMapPositionType
   	findAttributes(
   			XPathExecutionContext&	executionContext,
   			XalanNode* 				context, 
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			OpCodeMapValueType 		stepType,
   			MutableNodeRefList& 	subQueryResults) const;
   
  -	OpCodePositionType
  +	OpCodeMapPositionType
   	findChildren(
   			XPathExecutionContext&	executionContext,
   			XalanNode* 				context, 
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			OpCodeMapValueType 		stepType,
   			MutableNodeRefList& 	subQueryResults) const;
   
  -	OpCodePositionType
  +	OpCodeMapPositionType
   	findDescendants(
   			XPathExecutionContext&	executionContext,
   			XalanNode* 				context, 
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			OpCodeMapValueType 		stepType,
   			MutableNodeRefList& 	subQueryResults) const;
   
  -	OpCodePositionType
  +	OpCodeMapPositionType
   	findFollowing(
   			XPathExecutionContext&	executionContext,
   			XalanNode* 				context, 
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			OpCodeMapValueType 		stepType,
   			MutableNodeRefList& 	subQueryResults) const;
   
  -	OpCodePositionType
  +	OpCodeMapPositionType
   	findFollowingSiblings(
   			XPathExecutionContext&	executionContext,
   			XalanNode* 				context, 
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			OpCodeMapValueType 		stepType,
   			MutableNodeRefList& 	subQueryResults) const;
   
  -	OpCodePositionType
  +	OpCodeMapPositionType
   	findPreceeding(
   			XPathExecutionContext&	executionContext,
   			XalanNode* 				context, 
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			OpCodeMapValueType 		stepType,
   			MutableNodeRefList& 	subQueryResults) const;
   
  -	OpCodePositionType
  +	OpCodeMapPositionType
   	findPreceedingSiblings(
   			XPathExecutionContext&	executionContext,
   			XalanNode* 				context, 
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			OpCodeMapValueType 		stepType,
   			MutableNodeRefList& 	subQueryResults) const;
   
  -	OpCodePositionType
  +	OpCodeMapPositionType
   	findNamespace(
   			XPathExecutionContext&	executionContext,
   			XalanNode* 				context, 
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			OpCodeMapValueType 		stepType,
   			MutableNodeRefList& 	subQueryResults) const;
   
  -	OpCodePositionType
  +	OpCodeMapPositionType
   	findNodesOnUnknownAxis(
   			XPathExecutionContext&	executionContext,
   			XalanNode* 				context, 
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			OpCodeMapValueType 		stepType,
   			MutableNodeRefList& 	subQueryResults) const;
   
  @@ -2466,27 +2515,27 @@
   			XPathExecutionContext&	executionContext,
   			XalanNode* 				context,
   			XalanNode::NodeType		nodeType,
  -			OpCodePositionType 		opPos,
  -			OpCodePositionType 		argLen,
  +			OpCodeMapPositionType 	opPos,
  +			OpCodeMapValueType 	    argLen,
   			OpCodeMapValueType 		stepType) const;
   
  -	OpCodePositionType
  +	OpCodeMapPositionType
   	predicates(
   			XPathExecutionContext&	executionContext,
  -			OpCodePositionType 		opPos,
  +			OpCodeMapPositionType 	opPos,
   			MutableNodeRefList& 	subQueryResults) const;
   
   	eMatchScore
   	handleFoundIndex(
   			XPathExecutionContext&	executionContext,
   			XalanNode* 				localContext,
  -			OpCodePositionType 		startOpPos) const;
  +			OpCodeMapPositionType 	startOpPos) const;
   
   	eMatchScore
   	handleFoundIndexPositional(
   			XPathExecutionContext&	executionContext,
   			XalanNode* 				localContext,
  -			OpCodePositionType 		startOpPos) const;
  +			OpCodeMapPositionType 	startOpPos) const;
   
   private:
   
  @@ -2494,7 +2543,7 @@
   	unknownOpCodeError(
   			XalanNode*				context,
   			XPathExecutionContext&	executionContext,
  -			OpCodePositionType		opPos) const;
  +			OpCodeMapPositionType	opPos) const;
   
   	void
   	notNodeSetError(
  @@ -2527,9 +2576,9 @@
   	 * This is the table of installed functions.
   	 *
   	 */
  -	static FunctionTableType			s_functions;
  +	static FunctionTableType		s_functions;
   
  -	static const XalanDOMString			s_emptyString;
  +	static const XalanDOMString     s_emptyString;
   };
   
   
  
  
  
  1.9       +44 -8     xml-xalan/c/src/xalanc/XPath/XPathExpression.cpp
  
  Index: XPathExpression.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XPath/XPathExpression.cpp,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- XPathExpression.cpp	11 Feb 2004 06:53:49 -0000	1.8
  +++ XPathExpression.cpp	12 Feb 2004 05:36:02 -0000	1.9
  @@ -378,19 +378,55 @@
   
   
   
  +#if defined(XALAN_XPATH_EXPRESSION_USE_ITERATORS)
  +
  +XPathExpression::OpCodeMapValueType
  +XPathExpression::getOpCodeLengthFromOpMap(OpCodeMapPositionType     opPos) const
  +{
  +    assert(opPos - getInitialOpCodePosition() >= 0 &&
  +           opPos - getInitialOpCodePosition() < opCodeMapSize());
  +
  +    OpCodeMapValueType	theResult = 0;
  +
  +	// Is there a valid opcode?
  +	const int	theOpCodeLength = getOpCodeLength(*opPos);
  +
  +	if (theOpCodeLength == 0)
  +	{
  +		throw InvalidOpCodeException(-1);
  +	}
  +	else
  +	{
  +		// Does the Op code have a length > 1?
  +		if (theOpCodeLength > 1)
  +		{
  +			// Yes, so get the length.
  +			theResult = *(opPos + s_opCodeMapLengthIndex);
  +		}
  +	}
  +
  +	return theResult;
  +}
  +
  +#endif
  +
   XPathExpression::OpCodeMapValueType
  -XPathExpression::getOpCodeLengthFromOpMap(OpCodeMapSizeType		opPos) const
  +#if defined(XALAN_XPATH_EXPRESSION_USE_ITERATORS)
  +XPathExpression::getOpCodeLengthFromOpMap(OpCodeMapSizeType     theIndex) const
  +#else
  +XPathExpression::getOpCodeLengthFromOpMap(OpCodeMapPositionType     theIndex) const
  +#endif
   {
   	OpCodeMapValueType	theResult = 0;
   
  -	if (opPos >= opCodeMapSize())
  +	if (theIndex >= opCodeMapSize())
   	{
   		throw InvalidOpCodeException(-1);
   	}
   	else
   	{
   		// Is there a valid opcode?
  -		const int	theOpCodeLength = getOpCodeLength(m_opMap[opPos]);
  +		const int	theOpCodeLength = getOpCodeLength(m_opMap[theIndex]);
   
   		if (theOpCodeLength == 0)
   		{
  @@ -402,7 +438,7 @@
   			if (theOpCodeLength > 1)
   			{
   				// Yes, so get the length.
  -				theResult = m_opMap[opPos + s_opCodeMapLengthIndex];
  +				theResult = m_opMap[theIndex + s_opCodeMapLengthIndex];
   			}
   		}
   	}
  @@ -567,11 +603,11 @@
   XPathExpression::updateShiftedOpCodeLength(
   			OpCodeMapValueType	theOpCode,
   #if defined(NDEBUG)
  -			OpCodeMapValueType	/* theOriginalIndex */,
  +			OpCodeMapSizeType	/* theOriginalIndex */,
   #else
  -			OpCodeMapValueType	theOriginalIndex,
  +			OpCodeMapSizeType	theOriginalIndex,
   #endif
  -			OpCodeMapValueType	theNewIndex)
  +			OpCodeMapSizeType	theNewIndex)
   {
   	// There must be some other expressions in
   	// the buffer...
  @@ -667,7 +703,7 @@
   
   
   void
  -XPathExpression::updateOpCodeLengthAfterNodeTest(OpCodeMapValueType	    theIndex)
  +XPathExpression::updateOpCodeLengthAfterNodeTest(OpCodeMapSizeType  theIndex)
   {
   	// There must be some other expressions in
   	// the buffer...
  
  
  
  1.7       +140 -40   xml-xalan/c/src/xalanc/XPath/XPathExpression.hpp
  
  Index: XPathExpression.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XPath/XPathExpression.hpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XPathExpression.hpp	11 Feb 2004 06:53:49 -0000	1.6
  +++ XPathExpression.hpp	12 Feb 2004 05:36:02 -0000	1.7
  @@ -122,8 +122,17 @@
   	typedef std::vector<double>				NumberLiteralValueVectorType;
   #endif
   
  -	typedef TokenQueueType::value_type		TokenQueueValueType;
  +#define XALAN_XPATH_EXPRESSION_USE_ITERATORS
  +
  +#if defined(XALAN_XPATH_EXPRESSION_USE_ITERATORS)
  +    typedef OpCodeMapType::const_iterator   OpCodeMapPositionType;
  +#else
  +    typedef OpCodeMapSizeType               OpCodeMapPositionType;
  +#endif
  +    typedef OpCodeMapType::difference_type  OpCodeMapDifferenceType;
  +	typedef TokenQueueType::value_type      TokenQueueValueType;
   	typedef int		                        TokenQueueSizeType;
  +	typedef TokenQueueSizeType		        TokenQueuePositionType;
   
   	/**
   	 * List of operations codes.
  @@ -809,16 +818,48 @@
   		}
   	}
   
  -	/**
  -	 * Retrieve number of elements in the token queue.
  +    OpCodeMapPositionType
  +    getInitialOpCodePosition() const
  +    {
  +#if defined(XALAN_XPATH_EXPRESSION_USE_ITERATORS)
  +        return m_opMap.begin();
  +#else
  +        return 0;
  +#endif
  +    }
  +
  +    bool
  +    isValidOpCodePosition(OpCodeMapPositionType     opPos) const
  +    {
  +        const OpCodeMapDifferenceType  theDifference =
  +            OpCodeMapDifferenceType(opPos - getInitialOpCodePosition());
  +
  +        return theDifference >= 0 && 
  +               theDifference < opCodeMapSize();
  +    }
  +
  +#if defined(XALAN_XPATH_EXPRESSION_USE_ITERATORS)
  +    bool
  +    isValidOpCodePosition(OpCodeMapSizeType     theIndex) const
  +    {
  +        return theIndex >= 0 && theIndex < opCodeMapSize();
  +    }
  +
  +    /**
  +	 * Retrieve the value of an operation code at a specified index in the
  +	 * op code map.
   	 * 
  -	 * @return size of token queue
  +	 * @param theIndex The index in list
  +	 * @return value of operation code
   	 */
  -	TokenQueueSizeType
  -	tokenQueueSize() const
  +	OpCodeMapValueType
  +	getOpCodeMapValue(OpCodeMapSizeType     theIndex) const
   	{
  -		return TokenQueueSizeType(m_tokenQueue.size());
  +        assert(theIndex < opCodeMapLength());
  +
  +		return m_opMap[theIndex];
   	}
  +#endif
   
   	/**
   	 * Retrieve the value of an operation code at a specified position in the
  @@ -828,30 +869,37 @@
   	 * @return value of operation code
   	 */
   	OpCodeMapValueType
  -	getOpCodeMapValue(OpCodeMapSizeType		opPos) const
  +	getOpCodeMapValue(OpCodeMapPositionType     opPos) const
   	{
  +        assert(opPos < getInitialOpCodePosition() + opCodeMapLength());
  +
  +#if defined(XALAN_XPATH_EXPRESSION_USE_ITERATORS)
  +        return *opPos;
  +#else
  +
   		return m_opMap[opPos];
  +#endif
   	}
   
   	/**
  -	 * Retrieve the value of an operation code at a specified position in the
  -	 * list.
  +	 * Set the value of an operation code at a specified index in the
  +	 * OpCode map.
   	 * 
  -	 * @param opPos position in list
  -	 * @return value of operation code
  +	 * @param theOpCodeMapIndex The index in the OpCode map
  +	 * @param theValue value of operation code
   	 */
   	void
   	setOpCodeMapValue(
  -            OpCodeMapSizeType	        opPos,
  +            OpCodeMapSizeType	        theOpCodeMapIndex,
               const OpCodeMapValueType&   theValue)
   	{
  -        assert(opPos < opCodeMapLength());
  +        assert(theOpCodeMapIndex < opCodeMapLength());
   
  -		m_opMap[opPos] = theValue;
  +		m_opMap[theOpCodeMapIndex] = theValue;
   	}
   
   	OpCodeMapValueType
  -	getOpCodeArgumentLength(OpCodeMapSizeType	opPos) const
  +	getOpCodeArgumentLength(OpCodeMapPositionType	opPos) const
   	{
   		return getOpCodeMapValue(opPos + XPathExpression::s_opCodeMapLengthIndex + 1) - 3;
   	}
  @@ -864,8 +912,21 @@
   	 * @return length of operation code
   	 */
   	OpCodeMapValueType
  -	getOpCodeLengthFromOpMap(OpCodeMapSizeType	opPos) const;
  +	getOpCodeLengthFromOpMap(OpCodeMapPositionType  opPos) const;
   
  +#if defined(XALAN_XPATH_EXPRESSION_USE_ITERATORS)
  +	/**
  +	 * Retrieve the length of an operation code at a specified index in the
  +	 * op map.
  +	 * 
  +	 * @param theIndex The index in the op map
  +	 * @return length of operation code
  +	 */
  +	OpCodeMapValueType
  +	getOpCodeLengthFromOpMap(OpCodeMapSizeType  theIndex) const;
  +#endif
  +
  +#if defined(XALAN_XPATH_EXPRESSION_USE_ITERATORS)
   	/**
   	 * Retrieve the position of the next operation code at a specified position
   	 * in the list.
  @@ -873,14 +934,35 @@
   	 * @param opPos position in list
   	 * @return position of next operation code
   	 */
  -	OpCodeMapValueType
  -	getNextOpCodePosition(OpCodeMapSizeType		opPos) const
  +	OpCodeMapPositionType
  +	getNextOpCodePosition(OpCodeMapPositionType	    opPos) const
   	{
  -		assert(opPos < opCodeMapSize());
  +        assert(opPos < getInitialOpCodePosition() + opCodeMapLength());
   
  -		assert(opPos + m_opMap[opPos + s_opCodeMapLengthIndex] == OpCodeMapValueType(opPos + m_opMap[opPos + s_opCodeMapLengthIndex]));
  +		return opPos + *(opPos + s_opCodeMapLengthIndex);
  +	}
  +#endif
  +
  +	/**
  +	 * Retrieve the position of the next operation code at a specified index
  +	 * in the list.
  +	 * 
  +	 * @param theIndex theIndex in list
  +	 * @return position of next operation code
  +	 */
  +	OpCodeMapSizeType
  +#if defined(XALAN_XPATH_EXPRESSION_USE_ITERATORS)
  +	getNextOpCodePosition(OpCodeMapSizeType     theIndex) const
  +#else
  +	getNextOpCodePosition(OpCodeMapPositionType     theIndex) const
  +#endif
  +	{
  +        assert(theIndex < opCodeMapLength());
   
  -		return OpCodeMapValueType(opPos + m_opMap[opPos + s_opCodeMapLengthIndex]);
  +		assert(theIndex + m_opMap[theIndex + s_opCodeMapLengthIndex] ==
  +               OpCodeMapSizeType(theIndex + m_opMap[theIndex + s_opCodeMapLengthIndex]));
  +
  +		return OpCodeMapSizeType(theIndex + m_opMap[theIndex + s_opCodeMapLengthIndex]);
   	}
   
   	/**
  @@ -895,7 +977,7 @@
   	void
   	setOpCodeArgs(
   			eOpCodes							theOpCode,
  -			OpCodeMapSizeType					theIndex,
  +			OpCodeMapSizeType				    theIndex,
   			const OpCodeMapValueVectorType&		theArgs);
   
   	/**
  @@ -914,8 +996,9 @@
   	 * @param theArgs   vector or arguments to supply
   	 */
   	OpCodeMapSizeType
  -	appendOpCode(eOpCodes							theOpCode,
  -				 const OpCodeMapValueVectorType&	theArgs)
  +	appendOpCode(
  +            eOpCodes							theOpCode,
  +			const OpCodeMapValueVectorType&	    theArgs)
   	{
   		const OpCodeMapSizeType		thePosition = appendOpCode(theOpCode);
   
  @@ -935,7 +1018,7 @@
   	 */
   	void
   	replaceOpCode(
  -			OpCodeMapSizeType	theIndex,
  +			OpCodeMapSizeType   theIndex,
   			eOpCodes			theOldOpCode,
   			eOpCodes			theNewOpCode);
   
  @@ -960,7 +1043,7 @@
   	 * @param theIndex  index in list
   	 */
   	void
  -	updateOpCodeLength(OpCodeMapValueType	theIndex)
  +	updateOpCodeLength(OpCodeMapSizeType	theIndex)
   	{
   		assert(theIndex < opCodeMapSize());
   
  @@ -978,8 +1061,8 @@
   	void
   	updateShiftedOpCodeLength(
   			OpCodeMapValueType	theOpCode,
  -			OpCodeMapValueType	theOriginalIndex,
  -			OpCodeMapValueType	theNewIndex);
  +			OpCodeMapSizeType	theOriginalIndex,
  +			OpCodeMapSizeType	theNewIndex);
   
   	/**
   	 * Update the length of an operation code at a specified index in the list.
  @@ -994,7 +1077,7 @@
   	void
   	updateOpCodeLength(
   			OpCodeMapValueType	theOpCode,
  -			OpCodeMapValueType	theIndex);
  +			OpCodeMapSizeType	theIndex);
   
   	/**
   	 * Whether the operation code is one of the node test types, for example,
  @@ -1012,7 +1095,7 @@
   	 * @param theIndex  index in list
   	 */
   	void
  -	updateOpCodeLengthAfterNodeTest(OpCodeMapValueType	theIndex);
  +	updateOpCodeLengthAfterNodeTest(OpCodeMapSizeType   theIndex);
   
   	/**
   	 * Whether there are any more tokens in the token queue.
  @@ -1026,6 +1109,23 @@
   	}
   
   	/**
  +	 * Retrieve number of elements in the token queue.
  +	 * 
  +	 * @return size of token queue
  +	 */
  +	TokenQueueSizeType
  +	tokenQueueSize() const
  +	{
  +		return TokenQueueSizeType(m_tokenQueue.size());
  +	}
  +
  +    bool
  +    isValidTokenQueuePosition(TokenQueueSizeType    thePosition) const
  +    {
  +        return thePosition < tokenQueueSize();
  +    }
  +
  +	/**
   	 * Retrieve the current position in the token queue.
   	 *
   	 * @return position in queue
  @@ -1052,7 +1152,7 @@
   	 * @return pointer to XObject token
   	 */
   	const XToken*
  -	getToken(TokenQueueSizeType		thePosition) const
  +	getToken(TokenQueuePositionType     thePosition) const
   	{
   		assert(thePosition < tokenQueueSize());
   
  @@ -1111,10 +1211,10 @@
   	 */
   	const XToken*
   	getRelativeToken(
  -        TokenQueueSizeType	theOffset,
  -        eRelativeDirection  theDirection) const
  +        TokenQueuePositionType	theOffset,
  +        eRelativeDirection      theDirection) const
   	{
  -		const TokenQueueSizeType	thePosition =
  +		const TokenQueuePositionType	thePosition =
               calculateRelativePosition(theOffset, theDirection);
   
   		if (thePosition == tokenQueueSize())
  @@ -1187,11 +1287,11 @@
   	 */
   	void
   	replaceRelativeToken(
  -            TokenQueueSizeType	    theOffset,
  +            TokenQueuePositionType  theOffset,
               eRelativeDirection      theDirection,
   			const XalanDOMString&	theString)
   	{
  -		const TokenQueueSizeType	thePosition =
  +		const TokenQueuePositionType	thePosition =
               calculateRelativePosition(theOffset, theDirection);
           assert(thePosition < tokenQueueSize());
   
  @@ -1369,10 +1469,10 @@
        * @param theDirection the direction in which to move
   	 * @return thePosition
   	 */
  -	TokenQueueSizeType
  +	TokenQueuePositionType
   	calculateRelativePosition(
  -        TokenQueueSizeType	theOffset,
  -        eRelativeDirection  theDirection) const
  +        TokenQueuePositionType	theOffset,
  +        eRelativeDirection      theDirection) const
   	{
           if (theDirection == eRelativeBackward &&
               theOffset <= m_currentPosition)
  
  
  

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