dbertoni    00/11/27 13:46:35

  Modified:    c/src/Include VCPPDefinitions.hpp XalanArrayKeyMap.hpp
               c/src/PlatformSupport DOMStringHelper.cpp
                        DOMStringHelper.hpp DoubleSupport.cpp STLHelper.hpp
               c/src/XPath FunctionSubstring.cpp FunctionSubstringAfter.cpp
                        FunctionSubstringBefore.cpp XObject.cpp XPath.cpp
               c/src/XSLT ElemApplyTemplates.cpp ElemApplyTemplates.hpp
                        ElemAttributeSet.cpp ElemAttributeSet.hpp
                        ElemCallTemplate.cpp ElemCallTemplate.hpp
                        ElemLiteralResult.cpp ElemTemplate.cpp
                        ElemTemplate.hpp ElemTemplateElement.cpp
                        ElemUse.cpp ElemUse.hpp ElemVariable.cpp
                        ElemVariable.hpp ElemWithParam.cpp
                        ElemWithParam.hpp FunctionElementAvailable.cpp
                        Stylesheet.cpp Stylesheet.hpp
                        StylesheetExecutionContextDefault.cpp
                        StylesheetExecutionContextDefault.hpp
                        StylesheetRoot.cpp TopLevelArg.hpp
                        VariablesStack.cpp VariablesStack.hpp
                        XSLTEngineImpl.cpp
               c/src/XalanDOM XalanDOMString.cpp XalanDOMString.hpp
  Log:
  Various performance enhancements.
  
  Revision  Changes    Path
  1.9       +1 -0      xml-xalan/c/src/Include/VCPPDefinitions.hpp
  
  Index: VCPPDefinitions.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/Include/VCPPDefinitions.hpp,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- VCPPDefinitions.hpp       2000/09/29 22:17:14     1.8
  +++ VCPPDefinitions.hpp       2000/11/27 21:42:53     1.9
  @@ -77,6 +77,7 @@
   #define XALAN_NO_COVARIANT_RETURN_TYPE
   #define XALAN_LSTRSUPPORT
   #define XALAN_FULL_WCHAR_SUPPORT
  +#define XALAN_USE_WCHAR_SUPPORT
   #define XALAN_RTTI_AVAILABLE
   #define XALAN_LITLE_ENDIAN
   #define XALAN_NEWLINE_IS_CRLF
  
  
  
  1.3       +13 -13    xml-xalan/c/src/Include/XalanArrayKeyMap.hpp
  
  Index: XalanArrayKeyMap.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/Include/XalanArrayKeyMap.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XalanArrayKeyMap.hpp      2000/11/02 22:25:34     1.2
  +++ XalanArrayKeyMap.hpp      2000/11/27 21:42:56     1.3
  @@ -79,21 +79,21 @@
        typedef std::deque<VectorType>                                          
                VectorHolderType;
   #endif
   
  -     typedef MapType::key_type                                       
key_type;
  -     typedef MapType::value_type                                     
value_type;
  -     typedef ValueType                                                       
referent_type;
  -     typedef CompareType                                                     
key_compare;
  +     typedef typename MapType::key_type                                      
key_type;
  +     typedef typename MapType::value_type                            
value_type;
  +     typedef ValueType                                                       
                referent_type;
  +     typedef CompareType                                                     
                key_compare;
   #if !defined(XALAN_NO_STD_ALLOCATORS)
  -     typedef MapType::allocator_type                         allocator_type;
  +     typedef typename MapType::allocator_type                        
allocator_type;
   #endif
  -     typedef MapType::size_type                                      
size_type;
  -     typedef MapType::difference_type                        difference_type;
  -     typedef MapType::reference                                      
reference;
  -     typedef MapType::const_reference                        const_reference;
  -     typedef MapType::iterator                                       
iterator;
  -     typedef MapType::const_iterator                         const_iterator;
  -     typedef MapType::reverse_iterator                       
reverse_iterator;
  -     typedef MapType::const_reverse_iterator         const_reverse_iterator;
  +     typedef typename MapType::size_type                                     
size_type;
  +     typedef typename MapType::difference_type                       
difference_type;
  +     typedef typename MapType::reference                                     
reference;
  +     typedef typename MapType::const_reference                       
const_reference;
  +     typedef typename MapType::iterator                                      
iterator;
  +     typedef typename MapType::const_iterator                        
const_iterator;
  +     typedef typename MapType::reverse_iterator                      
reverse_iterator;
  +     typedef typename MapType::const_reverse_iterator        
const_reverse_iterator;
   
   #if defined(XALAN_NO_NAMESPACES)
        typedef pair<iterator, bool>                                    
insert_pair_type;
  
  
  
  1.44      +90 -100   xml-xalan/c/src/PlatformSupport/DOMStringHelper.cpp
  
  Index: DOMStringHelper.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/DOMStringHelper.cpp,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- DOMStringHelper.cpp       2000/11/20 20:04:25     1.43
  +++ DOMStringHelper.cpp       2000/11/27 21:43:07     1.44
  @@ -604,27 +604,27 @@
   
                                const XalanDOMChar* const       ptr = 
toCharArray(theString);
   
  -     #if defined(XALAN_NO_ALGORITHMS_WITH_BUILTINS)
  +#if defined(XALAN_NO_ALGORITHMS_WITH_BUILTINS)
                                XalanCopy(
                                        ptr,
                                        ptr + theLength,
                                        back_inserter(theBuffer));
  -     #else
  +#else
                                copy(
                                        ptr,
                                        ptr + theLength,
                                        back_inserter(theBuffer));
  -     #endif
  +#endif
   
                                return XalanDOMString(theBuffer.begin(), 
theBuffer.size());
                        }
                        else
                        {
  -     #if defined(XALAN_USE_CUSTOM_STRING) || defined(XALAN_USE_STD_STRING)
  +#if defined(XALAN_USE_CUSTOM_STRING) || defined(XALAN_USE_STD_STRING)
                                return theString.substr(theStartIndex, 
theLength);
  -     #else
  +#else
                                return theString.substringData(theStartIndex, 
theLength);
  -     #endif
  +#endif
                        }
                }
        }
  @@ -1021,61 +1021,7 @@
                        const XalanDOMChar*             theLHS,
                        const XalanDOMChar*             theRHS)
   {
  -#if 1
        return doCompare(theLHS, length(theLHS), theRHS, length(theRHS));
  -#else
  -     const unsigned int      theLHSLength = length(theLHS);
  -     const unsigned int      theRHSLength = length(theRHS);
  -
  -     int                                     theResult = 0;
  -
  -     if (theLHSLength != 0 || theRHSLength != 0)
  -     {
  -             XalanDOMChar            theLHSChar = 0;
  -             XalanDOMChar            theRHSChar = 0;
  -
  -             unsigned int    i = 0;
  -
  -             for(; i < theLHSLength && i < theRHSLength; i++)
  -             {
  -                     theLHSChar = theLHS[i];
  -                     theRHSChar = theRHS[i];
  -
  -                     if (theLHSChar != theRHSChar)
  -                     {
  -                             break;
  -                     }
  -             }
  -
  -             if (i == theLHSLength)
  -             {
  -                     // We reached the end of theLHS...
  -                     if (i != theRHSLength)
  -                     {
  -                             // but not the end of theRHS.
  -                             theResult = -1;
  -                     }
  -             }
  -             else if (i == theRHSLength)
  -             {
  -                     // We reached the end of theRHS string...
  -                     if (i != theLHSLength)
  -                     {
  -                             // but not the end of theLHS string.
  -                             theResult = 1;
  -                     }
  -             }
  -             else
  -             {
  -                     // We didn't reach the end of _either_ string, so
  -                     // return the difference between the two characters
  -                     // that caused the problem.
  -                     theResult = theLHSChar - theRHSChar;
  -             }
  -     }
  -
  -     return theResult;
  -#endif
   }
   
   
  @@ -1348,6 +1294,45 @@
   
   
   
  +XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
  +equals(
  +                     const XalanDOMChar*             theLHS,
  +                     const XalanDOMChar*             theRHS)
  +{
  +     assert(theLHS != 0 && theRHS != 0);
  +
  +     for(;;)
  +     {
  +             const XalanDOMChar      theLHSChar = *theLHS;
  +             const XalanDOMChar      theRHSChar = *theRHS;
  +
  +             if (theLHSChar == 0)
  +             {
  +                     return theRHSChar == 0 ? true : false;
  +             }
  +             else if (theRHSChar == 0)
  +             {
  +                     return theLHSChar == 0 ? true : false;
  +             }
  +             else if (theLHSChar != theRHSChar)
  +             {
  +                     return false;
  +             }
  +             else
  +             {
  +                     ++theLHS;
  +                     ++theRHS;
  +             }
  +     }
  +
  +     assert(false);
  +
  +     // Dummy return value...
  +     return false;
  +}
  +
  +
  +
   XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(XalanDOMCharVectorType)
   MakeXalanDOMCharVector(
                        const char*             data,
  @@ -1444,64 +1429,69 @@
   
   
   
  -XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(int)
  -WideStringToInt(const XalanDOMChar*          theString)
  +template <class Type>
  +Type
  +WideStringToIntegral(
  +                     const XalanDOMChar*             theString,
  +                     Type                                    theDummy)
   {
  -     int                             theResult = 0;
  -
  -     vector<char>    theVector;
  -
  -     CopyWideStringToVector(theString,
  -                                                theVector);
  -
  -     if (theVector.size() > 0)
  +     if (theString == 0)
        {
  -             theResult = atoi(theVector.begin());
  +             return Type(0);
        }
  -
  -     return theResult;
  -}
  +     else
  +     {
  +             Type    theResult = 0;
   
  +             const bool      isNegative = *theString == 
XalanUnicode::charHyphenMinus ? true : false;
   
  +             if (isNegative == true)
  +             {
  +                     ++theString;
  +             }
   
  -XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(long)
  -WideStringToLong(const XalanDOMChar* theString)
  -{
  -     long                    theResult = 0;
  +             while(*theString != 0)
  +             {
  +                     if (*theString >= XalanUnicode::charDigit_0 && 
*theString <= XalanUnicode::charDigit_9)
  +                     {
  +                             theResult *= 10;
   
  -     CharVectorType  theVector;
  +                             theResult += *theString - 
XalanUnicode::charDigit_0;
   
  -     CopyWideStringToVector(theString,
  -                                                theVector);
  +                             ++theString;
  +                     }
  +                     else
  +                     {
  +                             return 0;
  +                     }
  +             }
   
  -     if (theVector.size() > 0)
  -     {
  -             theResult = atol(theVector.begin());
  +             return isNegative == true ? -theResult : theResult;
        }
  -
  -     return theResult;
   }
   
   
   
  -XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(unsigned long)
  -WideStringToUnsignedLong(const XalanDOMChar* theString)
  +XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(int)
  +WideStringToInt(const XalanDOMChar*          theString)
   {
  -     unsigned long   theResult = 0;
  +     return WideStringToIntegral(theString, int(0));
  +}
   
  -     CharVectorType  theVector;
   
  -     CopyWideStringToVector(theString,
  -                                                theVector);
   
  -     if (theVector.size() > 0)
  -     {
  -             istrstream      theFormatter(&theVector[0]);
  +XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(long)
  +WideStringToLong(const XalanDOMChar* theString)
  +{
  +     return WideStringToIntegral(theString, long(0));
  +}
   
  -             theFormatter >> theResult;
  -     }
   
  -     return theResult;
  +
  +XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(unsigned long)
  +WideStringToUnsignedLong(const XalanDOMChar* theString)
  +{
  +     return WideStringToIntegral(theString, (unsigned long)0);
   }
   
   
  @@ -1630,7 +1620,7 @@
   // I'm 99% sure that we don't need to use swprintf
   // to format, since strings of numbers don't to be
   // generated as wide strings.
  -#if defined(XALAN_USE_WCHAR_SUPPORT)
  +#if 0 // defined(XALAN_USE_WCHAR_SUPPORT)
   
        wchar_t         theBuffer[MAX_PRINTF_DIGITS + 1];
   
  @@ -1696,7 +1686,7 @@
   XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(XalanDOMString)
   LongToDOMString(long theLong)
   {
  -#if defined(XALAN_USE_WCHAR_SUPPORT)
  +#if 0 // defined(XALAN_USE_WCHAR_SUPPORT)
   
        wchar_t         theBuffer[MAX_PRINTF_DIGITS + 1];
   
  
  
  
  1.36      +17 -14    xml-xalan/c/src/PlatformSupport/DOMStringHelper.hpp
  
  Index: DOMStringHelper.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/DOMStringHelper.hpp,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- DOMStringHelper.hpp       2000/11/21 20:54:14     1.35
  +++ DOMStringHelper.hpp       2000/11/27 21:43:09     1.36
  @@ -333,7 +333,7 @@
   {
        // For the time being, we're using our own custom routine,
        // since performance is better.
  -#if defined(XALAN_USE_WCHAR_SUPPORT)
  +#if 0 // defined(XALAN_USE_WCHAR_SUPPORT)
   
        const XalanDOMChar* const       thePointer =
                        wcschr(theString, theChar);
  @@ -432,7 +432,7 @@
   
   // For the time being, we're using our own custom routine,
   // since performance is better.
  -#if defined(XALAN_USE_WCHAR_SUPPORT)
  +#if 0 // defined(XALAN_USE_WCHAR_SUPPORT)
   
   inline unsigned int
   lastIndexOf(
  @@ -1312,7 +1312,7 @@
   // For the time being, we're using our own custom routine,
   // since performance is better.
   
  -#if defined(XALAN_USE_WCHAR_SUPPORT)
  +#if 0 // defined(XALAN_USE_WCHAR_SUPPORT)
   
   /**
    * Compare the contents of two strings.
  @@ -1440,7 +1440,7 @@
   
   
   
  -#if defined(XALAN_USE_WCHAR_SUPPORT)
  +#if 0 // defined(XALAN_USE_WCHAR_SUPPORT)
   
   /**
    * Compare the contents of two strings using the
  @@ -1554,12 +1554,10 @@
    * @param theRHS second string to compare
    * @return true if the contents of both strings are identical
    */
  -inline bool
  -equals(const XalanDOMChar*   theLHS,
  -        const XalanDOMChar*  theRHS)
  -{
  -     return compare(theLHS, theRHS) == 0 ? true : false;
  -}
  +XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(bool)
  +equals(
  +                     const XalanDOMChar*             theLHS,
  +                     const XalanDOMChar*             theRHS);
   
   
   
  @@ -1571,8 +1569,9 @@
    * @return true if the contents of both strings are identical
    */
   inline bool
  -equals(const XalanDOMChar*           theLHS,
  -        const XalanDOMString&        theRHS)
  +equals(
  +                     const XalanDOMChar*             theLHS,
  +                     const XalanDOMString&   theRHS)
   {
        assert(theLHS != 0);
   
  @@ -1598,8 +1597,10 @@
   {
        assert(theRHS != 0);
   
  -#if defined(XALAN_USE_CUSTOM_STRING) || defined(XALAN_USE_STD_STRING)
  +#if defined(XALAN_USE_CUSTOM_STRING)
        return theLHS == theRHS;
  +#elif defined(XALAN_USE_STD_STRING)
  +     return equals(c_wstr(theLHS), theRHS);
   #else
        return theLHS.equals(theRHS);
   #endif
  @@ -1686,8 +1687,10 @@
                        const XalanDOMString&   theLHS,
                        const XalanDOMString&   theRHS)
   {
  -#if defined(XALAN_USE_CUSTOM_STRING) || defined(XALAN_USE_STD_STRING)
  +#if defined(XALAN_USE_CUSTOM_STRING)
        return theLHS == theRHS;
  +#elif defined(XALAN_USE_STD_STRING)
  +     return equals(c_wstr(theLHS), c_wstr(theRHS));
   #else
        return theLHS.equals(theRHS) ? true : false;
   #endif
  
  
  
  1.15      +6 -0      xml-xalan/c/src/PlatformSupport/DoubleSupport.cpp
  
  Index: DoubleSupport.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/DoubleSupport.cpp,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- DoubleSupport.cpp 2000/10/11 19:43:04     1.14
  +++ DoubleSupport.cpp 2000/11/27 21:43:13     1.15
  @@ -464,11 +464,17 @@
        }
        else
        {
  +#if defined(XALAN_FULL_WCHAR_SUPPORT) && defined(XALAN_USE_WCHAR_SUPPORT)
  +             XalanDOMChar*   theDummy;
  +
  +             return wcstod(theString, &theDummy);
  +#else
                CharVectorType  theVector;
   
                CopyWideStringToVector(theString, theVector);
   
                return atof(&theVector.front());
  +#endif
        }
   }
   
  
  
  
  1.13      +38 -0     xml-xalan/c/src/PlatformSupport/STLHelper.hpp
  
  Index: STLHelper.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/STLHelper.hpp,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- STLHelper.hpp     2000/08/31 19:42:51     1.12
  +++ STLHelper.hpp     2000/11/27 21:43:16     1.13
  @@ -270,6 +270,44 @@
   
   
   
  +template<class CollectionType>
  +class CollectionClearGuard
  +{
  +public:
  +
  +     CollectionClearGuard(CollectionType&    theCollection) :
  +             m_collection(&theCollection)
  +     {
  +     }
  +
  +     ~CollectionClearGuard()
  +     {
  +             if (m_collection != 0)
  +             {
  +                     m_collection->clear();
  +             }
  +     }
  +
  +     void
  +     release()
  +     {
  +             m_collection = 0;
  +     }
  +
  +private:
  +
  +     // Not implemented...
  +     CollectionClearGuard(const CollectionClearGuard<CollectionType>&);
  +
  +     CollectionClearGuard<CollectionType>&
  +     operator=(const CollectionClearGuard<CollectionType>&);
  +
  +     // Data members...
  +     CollectionType*         m_collection;
  +};
  +
  +
  +
   template<class CollectionType, class DeleteFunctorType>
   class CollectionDeleteGuard
   {
  
  
  
  1.6       +121 -70   xml-xalan/c/src/XPath/FunctionSubstring.cpp
  
  Index: FunctionSubstring.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionSubstring.cpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FunctionSubstring.cpp     2000/11/21 21:08:16     1.5
  +++ FunctionSubstring.cpp     2000/11/27 21:43:34     1.6
  @@ -70,102 +70,154 @@
   
   
   
  +/*
  + * Get the value for the start index (C-style, not XPath).
  + */
  +inline unsigned int
  +getStartIndex(double theSecondArgValue)
  +{
  +     // We always subtract 1 for C-style index, since XPath indexes from 1.
  +     
  +     // Anything less than, or equal to 1 is 0.
  +     if (theSecondArgValue <= 1)
  +     {
  +             return 0;
  +     }
  +     else
  +     {
  +             return 
unsigned(FunctionRound::getRoundedValue(theSecondArgValue)) - 1;
  +     }
  +}
  +
  +
  +
  +/*
  + * Get the length of the substring.
  + */
  +inline unsigned int
  +getSubstringLength(
  +                     unsigned int    theSourceStringLength,
  +                     unsigned int    theStartIndex,
  +                     double                  theThirdArgValue)
  +{
  +     // The last index must be less than theThirdArgValue.  Since it has
  +     // already been rounded, subtracting 1 will do the job.
  +     const unsigned int      theLastIndex = unsigned(theThirdArgValue - 1);
  +
  +     if (theLastIndex >= theSourceStringLength)
  +     {
  +             return theSourceStringLength - theStartIndex;
  +     }
  +     else
  +     {
  +             return theLastIndex - theStartIndex;
  +     }
  +}
  +
  +
  +
  +/*
  + * Get the total of the second and third arguments.
  + */
  +inline double
  +getTotal(
  +                     unsigned int            theSourceStringLength,
  +                     double                          theSecondArgValue,
  +                     const XObjectPtr&       arg3)
  +{
  +     // Total the second and third arguments.  Ithe third argument is
  +     // missing, make it the length of the string + 1 (for XPath
  +     // indexing style).
  +     if (arg3.null() == true || 
DoubleSupport::isPositiveInfinity(arg3->num()) == true)
  +     {
  +             return double(theSourceStringLength + 1);
  +     }
  +     else
  +     {
  +             return FunctionRound::getRoundedValue(theSecondArgValue + 
arg3->num());
  +     }
  +}
  +
  +
  +
  +inline XObjectPtr
  +createEmptyString(XPathExecutionContext&     executionContext)
  +{
  +     return 
executionContext.getXObjectFactory().createString(XalanDOMString());
  +}
  +
  +
  +
   XObjectPtr
   FunctionSubstring::execute(
  -             XPathExecutionContext&                  executionContext,
  -             XalanNode*                                              /* 
context */,                  
  -             const XObjectPtr                                arg1,
  -             const XObjectPtr                                arg2,
  -             const XObjectPtr                                arg3)
  +             XPathExecutionContext&  executionContext,
  +             XalanNode*                              /* context */,          
        
  +             const XObjectPtr                arg1,
  +             const XObjectPtr                arg2,
  +             const XObjectPtr                arg3)
   {
        assert(arg1.null() == false && arg2.null() == false);   
   
        const XalanDOMString&   theSourceString = arg1->str();
        const unsigned int              theSourceStringLength = 
length(theSourceString);
   
  -#if defined(XALAN_NO_NAMESPACES)
  -     typedef vector<XalanDOMChar>            VectorType;
  -#else
  -     typedef std::vector<XalanDOMChar>       VectorType;
  -#endif
  -
  -     // This buffer will hold the output characters.
  -     VectorType      theBuffer;
  -
  -     if (theSourceStringLength > 0)
  +     if (theSourceStringLength == 0)
        {
  -             // The substring can only be as long as the source string,
  -             // so reserve enough space now.  Also reserve space for
  -             // the terminating 0.
  -             theBuffer.reserve(theSourceStringLength);
  -
  -             // $$$ ToDo: Add support for NaN.
  -
  +             return createEmptyString(executionContext);
  +     }
  +     else
  +     {
                // Get the value of the second argument...
                const double    theSecondArgValue =
                        FunctionRound::getRoundedValue(arg2->num());
   
  -             // Now, total the second and third arguments.  If
  -             // the third argument is missing, make the total
  -             // DBL_MAX.
  -             const double    theTotal =
  -                             arg3.null() == true ? DBL_MAX :
  -                                                                
FunctionRound::getRoundedValue(
  -                                                                        
theSecondArgValue + arg3->num());
  -
  -             if (DoubleSupport::isNaN(theSecondArgValue) == false &&
  -                     DoubleSupport::isNaN(theTotal) == false &&
  -                     DoubleSupport::isNegativeInfinity(theTotal) == false)
  +             // XPath indexes from 1, so this is the first XPath index....
  +             const unsigned int      theStartIndex = 
getStartIndex(theSecondArgValue);
  +
  +             if (theStartIndex >= theSourceStringLength)
  +             {
  +                     return createEmptyString(executionContext);
  +             }
  +             else
                {
  -                     // Start with 1, since strings are index from 1 in the 
XPath spec,
  -                     for (unsigned int i = 1; i <= theSourceStringLength; 
i++)
  +                     const double    theTotal =
  +                             getTotal(theSourceStringLength, 
theSecondArgValue, arg3);
  +
  +                     if (DoubleSupport::isNaN(theSecondArgValue) == true ||
  +                             DoubleSupport::isNaN(theTotal) == true ||
  +                             DoubleSupport::isNegativeInfinity(theTotal) == 
true ||
  +                             theTotal < double(theStartIndex))
                        {
  -                             // Is the index greater than or equal to the 
second argument?
  -                             if (i >= theSecondArgValue)
  -                             {
  -                                     // Is it less than the sum of the 
second and
  -                                     // third arguments?
  -                                     if (i < theTotal)
  -                                     {
  -                                             // It is, so include the 
character.
  -                                             
theBuffer.push_back(charAt(theSourceString, i - 1));
  -                                     }
  -                                     else
  -                                     {
  -                                             // It's not, so stop.
  -                                             break;
  -                                     }
  -                             }
  +                             return createEmptyString(executionContext);
                        }
  +                     else
  +                     {
  +                             const unsigned int      theSubstringLength =
  +                                     getSubstringLength(
  +                                             theSourceStringLength,
  +                                             theStartIndex,
  +                                             theTotal);
  +
  +                             return 
executionContext.getXObjectFactory().createString(
  +                                                             
toCharArray(theSourceString) + theStartIndex,
  +                                                             
theSubstringLength);
  +                     }
                }
        }
  -
  -     const VectorType::size_type             theSize = theBuffer.size();
  -
  -     if (theSize == 0)
  -     {
  -             return 
executionContext.getXObjectFactory().createString(XalanDOMString());
  -     }
  -     else
  -     {
  -             return 
executionContext.getXObjectFactory().createString(theBuffer.begin(), theSize);
  -     }
   }
   
   
   
   XObjectPtr
   FunctionSubstring::execute(
  -             XPathExecutionContext&                  executionContext,
  -             XalanNode*                                              
context,                        
  -             const XObjectPtr                                arg1,
  -             const XObjectPtr                                arg2)
  +             XPathExecutionContext&  executionContext,
  +             XalanNode*                              context,                
        
  +             const XObjectPtr                arg1,
  +             const XObjectPtr                arg2)
   {
        assert(arg1.null() == false && arg2.null() == false);
  -     
  -     XObjectPtr dummy;
   
  -     return execute(executionContext, context, arg1, arg2, dummy);
  +     return execute(executionContext, context, arg1, arg2, XObjectPtr());
   }
   
   
  @@ -188,4 +240,3 @@
        return XALAN_STATIC_UCODE_STRING(
                "The substring() function takes two or three arguments!");
   }
  -
  
  
  
  1.6       +28 -35    xml-xalan/c/src/XPath/FunctionSubstringAfter.cpp
  
  Index: FunctionSubstringAfter.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionSubstringAfter.cpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FunctionSubstringAfter.cpp        2000/11/21 21:08:16     1.5
  +++ FunctionSubstringAfter.cpp        2000/11/27 21:43:36     1.6
  @@ -72,54 +72,48 @@
   
   XObjectPtr
   FunctionSubstringAfter::execute(
  -             XPathExecutionContext&                  executionContext,
  -             XalanNode*                                              /* 
context */,                  
  -             const XObjectPtr                                arg1,
  -             const XObjectPtr                                arg2)
  +             XPathExecutionContext&  executionContext,
  +             XalanNode*                              /* context */,          
        
  +             const XObjectPtr                arg1,
  +             const XObjectPtr                arg2)
   {
        assert(arg1.null() == false && arg2.null() == false);
   
        const XalanDOMString&   theFirstString = arg1->str();
  -     const XalanDOMString&   theSecondString = arg2->str();
   
  -     const unsigned int              theIndex = indexOf(theFirstString,
  -                                                                             
           theSecondString);
  -
        const unsigned int              theFirstStringLength = 
length(theFirstString);
  -
  -#if defined(XALAN_NO_NAMESPACES)
  -     typedef vector<XalanDOMChar>            VectorType;
  -#else
  -     typedef std::vector<XalanDOMChar>       VectorType;
  -#endif
  -
  -     // This buffer will hold the output characters.
  -     VectorType      theBuffer;
   
  -     if (theIndex < theFirstStringLength)
  +     if (theFirstStringLength == 0)
  +     {
  +             return 
executionContext.getXObjectFactory().createString(XalanDOMString());
  +     }
  +     else
        {
  -             unsigned int            theStartIndex = theIndex + 
length(theSecondString);
  +             const XalanDOMString&   theSecondString = arg2->str();
   
  -             // The result string can only be as large as the source string, 
so
  -             // just reserve the space now.  Also reserve a space for the
  -             // terminating 0.
  -             theBuffer.reserve(theFirstStringLength - theStartIndex + 1);
  +             const unsigned int              theIndex = 
indexOf(theFirstString,
  +                                                                             
                   theSecondString);
   
  -             for (; theStartIndex < theFirstStringLength; theStartIndex++)
  +             if (theIndex == theFirstStringLength)
                {
  -                     theBuffer.push_back(charAt(theFirstString, 
theStartIndex));
  +                     return 
executionContext.getXObjectFactory().createString(XalanDOMString());
                }
  -     }
  +             else
  +             {
  +                     const unsigned int              theSecondStringLength = 
length(theSecondString);
   
  -     const VectorType::size_type             theSize = theBuffer.size();
  +                     // Find the first character, which will be the offset 
of the index of the
  +                     // beginning of the second string, plus the length of 
the second string.
  +                     const XalanDOMChar* const       theFirstCharacter =
  +                             toCharArray(theFirstString) + theIndex + 
theSecondStringLength;
  +
  +                     // The remaining length is just the opposite -- the 
length of the string,
  +                     // minus the index, minus the length of the second 
string.
  +                     const unsigned int              theSubstringLength =
  +                             theFirstStringLength  - theIndex - 
theSecondStringLength;
   
  -     if (theSize == 0)
  -     {
  -             return 
executionContext.getXObjectFactory().createString(XalanDOMString());
  -     }
  -     else
  -     {
  -             return 
executionContext.getXObjectFactory().createString(theBuffer.begin(), theSize);
  +                     return 
executionContext.getXObjectFactory().createString(theFirstCharacter, 
theSubstringLength);
  +             }
        }
   }
   
  @@ -143,4 +137,3 @@
        return XALAN_STATIC_UCODE_STRING(
                "The substring-after() function takes two arguments!");
   }
  -
  
  
  
  1.6       +22 -35    xml-xalan/c/src/XPath/FunctionSubstringBefore.cpp
  
  Index: FunctionSubstringBefore.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionSubstringBefore.cpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FunctionSubstringBefore.cpp       2000/11/21 21:08:17     1.5
  +++ FunctionSubstringBefore.cpp       2000/11/27 21:43:37     1.6
  @@ -72,51 +72,39 @@
   
   XObjectPtr
   FunctionSubstringBefore::execute(
  -             XPathExecutionContext&                  executionContext,
  -             XalanNode*                                              /* 
context */,                  
  -             const XObjectPtr                                arg1,
  -             const XObjectPtr                                arg2)
  +             XPathExecutionContext&  executionContext,
  +             XalanNode*                              /* context */,          
        
  +             const XObjectPtr                arg1,
  +             const XObjectPtr                arg2)
   {
        assert(arg1.null() == false && arg2.null() == false);
   
        const XalanDOMString&   theFirstString = arg1->str();
  -     const XalanDOMString&   theSecondString = arg2->str();
   
  -     const unsigned int              theIndex = indexOf(theFirstString,
  -                                                                             
           theSecondString);
  +     const unsigned int              theFirstStringLength = 
length(theFirstString);
   
  -#if defined(XALAN_NO_NAMESPACES)
  -     typedef vector<XalanDOMChar>            VectorType;
  -#else
  -     typedef std::vector<XalanDOMChar>       VectorType;
  -#endif
  -
  -     // This buffer will hold the output characters.
  -     VectorType      theBuffer;
  -
  -     if (theIndex < length(theFirstString))
  -     {
  -             // The result string can only be as large as the source string, 
so
  -             // just reserve the space now.  Also reserve a space for the
  -             // terminating 0.
  -             theBuffer.reserve(theIndex + 2);
  -
  -             // Stop with the last character before the index.
  -             for (unsigned int i = 0; i < theIndex; i++)
  -             {
  -                     theBuffer.push_back(charAt(theFirstString, i));
  -             }
  -     }
  -
  -     const VectorType::size_type             theSize = theBuffer.size();
  -
  -     if (theSize == 0)
  +     if (theFirstStringLength == 0)
        {
                return 
executionContext.getXObjectFactory().createString(XalanDOMString());
        }
        else
        {
  -             return 
executionContext.getXObjectFactory().createString(theBuffer.begin(), theSize);
  +             const XalanDOMString&   theSecondString = arg2->str();
  +
  +             const unsigned int              theIndex = 
indexOf(theFirstString,
  +                                                                             
                   theSecondString);
  +
  +             if (theIndex == theFirstStringLength)
  +             {
  +                     return 
executionContext.getXObjectFactory().createString(XalanDOMString());
  +             }
  +             else
  +             {
  +                     // Create a string of the appropriate length...
  +                     return 
executionContext.getXObjectFactory().createString(
  +                                     toCharArray(theFirstString),
  +                                     theIndex);
  +             }
        }
   }
   
  @@ -140,4 +128,3 @@
        return XALAN_STATIC_UCODE_STRING(
                "The substring-before() function takes two arguments!");
   }
  -
  
  
  
  1.15      +1 -5      xml-xalan/c/src/XPath/XObject.cpp
  
  Index: XObject.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/XObject.cpp,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- XObject.cpp       2000/11/21 21:08:24     1.14
  +++ XObject.cpp       2000/11/27 21:43:39     1.15
  @@ -243,11 +243,7 @@
                        const XalanNode&        theNode,
                        double&                         theNumber)
   {
  -     XalanDOMString  theString;
  -
  -     getStringFromNode(theNode, theString);
  -
  -     theNumber = DoubleSupport::toDouble(theString);
  +     theNumber = getNumberFromNode(theNode);
   }
   
   
  
  
  
  1.36      +3 -3      xml-xalan/c/src/XPath/XPath.cpp
  
  Index: XPath.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/XPath.cpp,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- XPath.cpp 2000/11/21 22:05:24     1.35
  +++ XPath.cpp 2000/11/27 21:43:43     1.36
  @@ -74,7 +74,7 @@
   
   #include "FoundIndex.hpp"
   #include "MutableNodeRefList.hpp"
  -#include "QName.hpp"
  +#include "QNameByReference.hpp"
   #include "PrefixResolver.hpp"
   #include "SimpleNodeLocator.hpp"
   #include "XLocator.hpp"
  @@ -1106,8 +1106,8 @@
        const XObject&  varName = 
m_expression.m_tokenQueue[m_expression.m_opMap[opPos + 3]];
   
        // $$$ ToDo: I don't this will be parsed right in the first place...
  -     const QName             qname(ns.str(),
  -                                               varName.str());       
  +     const QNameByReference  qname(ns.str(),
  +                                                               
varName.str());       
   
        XObjectPtr result;
   
  
  
  
  1.10      +29 -12    xml-xalan/c/src/XSLT/ElemApplyTemplates.cpp
  
  Index: ElemApplyTemplates.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemApplyTemplates.cpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ElemApplyTemplates.cpp    2000/11/02 01:46:18     1.9
  +++ ElemApplyTemplates.cpp    2000/11/27 21:44:05     1.10
  @@ -104,7 +104,7 @@
                        break;
   
                case Constants::TATTRNAME_MODE:
  -                     m_mode = QName(atts.getValue(i), 
getStylesheet().getNamespaces());
  +                     m_mode = QNameByValue(atts.getValue(i), 
getStylesheet().getNamespaces());
                        break;
   
                default:
  @@ -153,17 +153,34 @@
                        mode,
                        this);
   
  -             transformSelectedChildren(
  -                     executionContext,
  -                     getStylesheet(),
  -                     *this, 
  -                     0, 
  -                     sourceTree, 
  -                     sourceNode, 
  -                     m_isDefaultTemplate == false ? m_mode : mode,
  -                     m_pSelectPattern, 
  -                     Constants::ELEMNAME_APPLY_TEMPLATES,
  -                     thePushPop.getStackFrameIndex());
  +             if (m_isDefaultTemplate == false)
  +             {
  +                     transformSelectedChildren(
  +                             executionContext,
  +                             getStylesheet(),
  +                             *this,
  +                             0,
  +                             sourceTree,
  +                             sourceNode,
  +                             m_mode,
  +                             m_pSelectPattern,
  +                             Constants::ELEMNAME_APPLY_TEMPLATES,
  +                             thePushPop.getStackFrameIndex());
  +             }
  +             else
  +             {
  +                     transformSelectedChildren(
  +                             executionContext,
  +                             getStylesheet(),
  +                             *this,
  +                             0,
  +                             sourceTree,
  +                             sourceNode,
  +                             mode,
  +                             m_pSelectPattern,
  +                             Constants::ELEMNAME_APPLY_TEMPLATES,
  +                             thePushPop.getStackFrameIndex());
  +             }
        }
       else
        {
  
  
  
  1.6       +7 -4      xml-xalan/c/src/XSLT/ElemApplyTemplates.hpp
  
  Index: ElemApplyTemplates.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemApplyTemplates.hpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ElemApplyTemplates.hpp    2000/11/02 01:46:18     1.5
  +++ ElemApplyTemplates.hpp    2000/11/27 21:44:07     1.6
  @@ -58,7 +58,7 @@
   #define XALAN_ELEMAPPLYTEMPLATES_HEADER_GUARD 
   
   /**
  - * $Id: ElemApplyTemplates.hpp,v 1.5 2000/11/02 01:46:18 dbertoni Exp $
  + * $Id: ElemApplyTemplates.hpp,v 1.6 2000/11/27 21:44:07 dbertoni Exp $
    * 
    * $State: Exp $
    * 
  @@ -75,7 +75,7 @@
   
   
   
  -#include <XPath/QName.hpp>
  +#include <XPath/QNameByValue.hpp>
   
   
   
  @@ -139,8 +139,11 @@
   
   private:
   
  -     bool    m_isDefaultTemplate;
  +     bool                    m_isDefaultTemplate;
   
  -     QName   m_mode;
  +     QNameByValue    m_mode;
   };
  +
  +
  +
   #endif       // XALAN_ELEMAPPLYTEMPLATES_HEADER_GUARD
  
  
  
  1.6       +1 -1      xml-xalan/c/src/XSLT/ElemAttributeSet.cpp
  
  Index: ElemAttributeSet.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemAttributeSet.cpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ElemAttributeSet.cpp      2000/11/02 01:46:19     1.5
  +++ ElemAttributeSet.cpp      2000/11/27 21:44:12     1.6
  @@ -93,7 +93,7 @@
   
                if(equals(aname,Constants::ATTRNAME_NAME))
                {
  -                     m_QName = QName(atts.getValue(i), 
stylesheetTree.getNamespaces());
  +                     m_QName = QNameByValue(atts.getValue(i), 
stylesheetTree.getNamespaces());
   
                        stylesheetTree.addAttributeSet(m_QName, this);
                }
  
  
  
  1.6       +5 -16     xml-xalan/c/src/XSLT/ElemAttributeSet.hpp
  
  Index: ElemAttributeSet.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemAttributeSet.hpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ElemAttributeSet.hpp      2000/11/02 01:46:19     1.5
  +++ ElemAttributeSet.hpp      2000/11/27 21:44:14     1.6
  @@ -57,31 +57,20 @@
   #if !defined(XALAN_ELEMATTRIBUTESET_HEADER_GUARD)
   #define XALAN_ELEMATTRIBUTESET_HEADER_GUARD 
   
  -/**
  - * $Id: ElemAttributeSet.hpp,v 1.5 2000/11/02 01:46:19 dbertoni Exp $
  - * 
  - * 
  - * $State: Exp $
  - * 
  - * @author Myriam Midy (Myriam_Midy @lotus.com 
  - */
   
  +
   // Base include file.  Must be first.
   #include "XSLTDefinitions.hpp"
   
  +
  +
   // Base class header file.
   #include "ElemUse.hpp"
   
   
  -
  -//#include <dom/XalanDOMString.hpp>
   
  -//#include <sax/AttributeList.hpp>
  +#include <XPath/QNameByValue.hpp>
   
  -//#include <XPath/NameSpace.hpp>
  -#include <XPath/QName.hpp>
  -//#include <XPath/XObject.hpp>
  -//#include <XPath/XPath.hpp>
   
   
   class ElemAttributeSet : public ElemUse
  @@ -136,7 +125,7 @@
   
   private:
   
  -     QName   m_QName;
  +     QNameByValue    m_QName;
   };
   
   
  
  
  
  1.10      +1 -1      xml-xalan/c/src/XSLT/ElemCallTemplate.cpp
  
  Index: ElemCallTemplate.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemCallTemplate.cpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ElemCallTemplate.cpp      2000/11/02 01:46:19     1.9
  +++ ElemCallTemplate.cpp      2000/11/27 21:44:17     1.10
  @@ -99,7 +99,7 @@
   
                if(equals(aname, Constants::ATTRNAME_NAME))
                {
  -                     m_templateName = QName(atts.getValue(i), 
getStylesheet().getNamespaces());        
  +                     m_templateName = QNameByValue(atts.getValue(i), 
getStylesheet().getNamespaces());        
                }
                else if(!isAttrOK(aname, atts, i, constructionContext))
                {
  
  
  
  1.8       +5 -12     xml-xalan/c/src/XSLT/ElemCallTemplate.hpp
  
  Index: ElemCallTemplate.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemCallTemplate.hpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ElemCallTemplate.hpp      2000/11/02 01:46:20     1.7
  +++ ElemCallTemplate.hpp      2000/11/27 21:44:20     1.8
  @@ -57,21 +57,14 @@
   #if !defined(XALAN_ELEMCALLTEMPLATE_HEADER_GUARD)
   #define XALAN_ELEMCALLTEMPLATE_HEADER_GUARD 
   
  -/**
  - * $Id: ElemCallTemplate.hpp,v 1.7 2000/11/02 01:46:20 dbertoni Exp $
  - * 
  - * 
  - * $State: Exp $
  - * 
  - * @author Myriam Midy (Myriam_Midy @lotus.com 
  - */
   
  +
   // Base include file.  Must be first.
   #include "XSLTDefinitions.hpp"
   
   
   
  -#include <XPath/QName.hpp>
  +#include <XPath/QNameByValue.hpp>
   
   
   
  @@ -122,13 +115,13 @@
   private:
   
        // not implemented
  -     ElemCallTemplate(const ElemCallTemplate &);
  +     ElemCallTemplate(const ElemCallTemplate&);
   
        ElemCallTemplate&
  -     operator=(const ElemCallTemplate &);
  +     operator=(const ElemCallTemplate&);
   
        // Data members...
  -     QName   m_templateName;
  +     QNameByValue    m_templateName;
   };
   
   
  
  
  
  1.24      +1 -1      xml-xalan/c/src/XSLT/ElemLiteralResult.cpp
  
  Index: ElemLiteralResult.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemLiteralResult.cpp,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- ElemLiteralResult.cpp     2000/11/02 01:46:24     1.23
  +++ ElemLiteralResult.cpp     2000/11/27 21:44:22     1.24
  @@ -123,7 +123,7 @@
   
                        if(!equals(prefix, DOMServices::s_XMLNamespace))
                        {
  -                             const XalanDOMString&   ns = 
getNamespaceForPrefix(prefix);
  +                             const XalanDOMString&   ns = 
getNamespaceForPrefixInternal(prefix, true);
   
                                if(equals(ns, 
stylesheetTree.getXSLTNamespaceURI()))
                                {
  
  
  
  1.10      +2 -2      xml-xalan/c/src/XSLT/ElemTemplate.cpp
  
  Index: ElemTemplate.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemTemplate.cpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ElemTemplate.cpp  2000/11/02 22:25:59     1.9
  +++ ElemTemplate.cpp  2000/11/27 21:44:24     1.10
  @@ -111,7 +111,7 @@
                        break; 
   
                case Constants::TATTRNAME_NAME:
  -                     m_name = QName(atts.getValue(i), 
getStylesheet().getNamespaces());
  +                     m_name = QNameByValue(atts.getValue(i), 
getStylesheet().getNamespaces());
                        break;
   
                case Constants::TATTRNAME_PRIORITY:
  @@ -123,7 +123,7 @@
                        break;
   
                case Constants::TATTRNAME_MODE:
  -                     m_mode = QName(atts.getValue(i), 
getStylesheet().getNamespaces());
  +                     m_mode = QNameByValue(atts.getValue(i), 
getStylesheet().getNamespaces());
                        break;
   
                case Constants::TATTRNAME_XMLSPACE:
  
  
  
  1.7       +5 -4      xml-xalan/c/src/XSLT/ElemTemplate.hpp
  
  Index: ElemTemplate.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemTemplate.hpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ElemTemplate.hpp  2000/11/02 22:25:59     1.6
  +++ ElemTemplate.hpp  2000/11/27 21:44:26     1.7
  @@ -71,7 +71,7 @@
   
   
   
  -#include <XPath/QName.hpp>
  +#include <XPath/QNameByValue.hpp>
   
   
   
  @@ -103,7 +103,7 @@
   
        virtual
        ~ElemTemplate();
  -     
  +
        /**
         * Retrieve the qualified name of element
         * 
  @@ -164,10 +164,11 @@
        ElemTemplate&
        operator=(const ElemTemplate &);
   
  +     // Data members...
        const XPath*    m_matchPattern;
   
  -     QName                   m_name;
  -     QName                   m_mode;
  +     QNameByValue    m_name;
  +     QNameByValue    m_mode;
   
        double                  m_priority;
   };
  
  
  
  1.41      +23 -19    xml-xalan/c/src/XSLT/ElemTemplateElement.cpp
  
  Index: ElemTemplateElement.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemTemplateElement.cpp,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- ElemTemplateElement.cpp   2000/11/21 21:09:59     1.40
  +++ ElemTemplateElement.cpp   2000/11/27 21:44:28     1.41
  @@ -665,10 +665,8 @@
                // @@ JMD: Should this be an assert ??
                if (theXObject.null() == false)
                {
  -                     const XObjectPtr        result(theXObject);
  +                     const NodeRefListBase&  sourceNodes = 
theXObject->nodeset();
   
  -                     const NodeRefListBase&  sourceNodes = result->nodeset();
  -
                        if(0 != executionContext.getTraceListeners())
                        {
                                executionContext.fireSelectEvent(
  @@ -677,7 +675,7 @@
                                                        *this,
                                                        
StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("select")),
                                                        *selectPattern,
  -                                                     result));
  +                                                     theXObject));
                        }
   
                        const unsigned int      nNodes = 
sourceNodes.getLength();
  @@ -1457,7 +1455,7 @@
   const XalanDOMString&
   ElemTemplateElement::getNamespaceForPrefix(const XalanDOMString&     prefix) 
const
   {
  -     return getNamespaceForPrefixInternal(prefix, true);
  +     return getNamespaceForPrefixInternal(prefix, false);
   }
   
   
  @@ -1475,24 +1473,30 @@
   
                if(m_finishedConstruction == true)
                {
  -                      if (equals(prefix, DOMServices::s_XMLString) == true)
  -                      {
  -                              nameSpace = &DOMServices::s_XMLNamespaceURI;
  -                      }
  -                      else if (equals(prefix, DOMServices::s_XMLNamespace) 
== true)
  -                      {
  -                              fEmptyIsError = false;
  -                      }
  -                      else
  -                      {
  -                              nameSpace = 
&getNamespacesHandler().getNamespace(prefix);
  +                     if (equals(prefix, DOMServices::s_XMLString) == true)
  +                     {
  +                             nameSpace = &DOMServices::s_XMLNamespaceURI;
  +                     }
  +                     else if (equals(prefix, DOMServices::s_XMLNamespace) == 
true)
  +                     {
  +                             fEmptyIsError = false;
  +                     }
  +                     else
  +                     {
  +                             nameSpace = 
&getNamespacesHandler().getNamespace(prefix);
   
                                if(isEmpty(*nameSpace) == true)
                                {
  -                                      if (m_parentNode != 0)
  -                                      {
  +                                     if (m_parentNode != 0)
  +                                     {
                                                nameSpace = 
&m_parentNode->getNamespaceForPrefixInternal(prefix, false);
  -                                      }
  +                                     }
  +
  +                                     // Try one last time with the 
stylesheet...
  +                                     if(isEmpty(*nameSpace) == true)
  +                                     {
  +                                             nameSpace = 
&getStylesheet().getNamespaceForPrefix(prefix);
  +                                     }
                                }
                        }
                }
  
  
  
  1.7       +2 -2      xml-xalan/c/src/XSLT/ElemUse.cpp
  
  Index: ElemUse.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemUse.cpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ElemUse.cpp       2000/11/02 01:46:26     1.6
  +++ ElemUse.cpp       2000/11/27 21:44:30     1.7
  @@ -132,7 +132,7 @@
   
        if(Constants::ELEMNAME_LITERALRESULT == getXSLToken())
        {
  -             const QName             qname(attrName, 
getStylesheet().getNamespaces());
  +             const QNameByValue      qname(attrName, 
getStylesheet().getNamespaces());
   
                isUAS = ((equals(qname.getNamespace(),
                        constructionContext.getXSLTNamespaceURI())) &&
  @@ -160,7 +160,7 @@
                        const XalanDOMString            qname = 
tokenizer.nextToken();
                        assert(length(qname) != 0);
   
  -                     m_attributeSetsNames.push_back(QName(qname, 
getStylesheet().getNamespaces()));
  +                     
m_attributeSetsNames.push_back(QNameVectorType::value_type(qname, 
getStylesheet().getNamespaces()));
                }
        }
   
  
  
  
  1.7       +6 -6      xml-xalan/c/src/XSLT/ElemUse.hpp
  
  Index: ElemUse.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemUse.hpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ElemUse.hpp       2000/11/02 01:46:26     1.6
  +++ ElemUse.hpp       2000/11/27 21:44:32     1.7
  @@ -69,7 +69,7 @@
   
   
   
  -#include <XPath/QName.hpp>
  +#include <XPath/QNameByValue.hpp>
   
   
   
  @@ -129,15 +129,15 @@
                        XalanNode*                                              
sourceNode,
                        const QName&                                    mode) 
const;
   
  -private:
  -
   #if defined(XALAN_NO_NAMESPACES)
  -     typedef vector<QName>           QNameVectorType;
  +     typedef vector<QNameByValue>            QNameVectorType;
   #else
  -     typedef std::vector<QName>      QNameVectorType;
  +     typedef std::vector<QNameByValue>       QNameVectorType;
   #endif
  +
  +private:
   
  -     QNameVectorType m_attributeSetsNames;
  +     QNameVectorType         m_attributeSetsNames;
   };
   
   
  
  
  
  1.10      +1 -1      xml-xalan/c/src/XSLT/ElemVariable.cpp
  
  Index: ElemVariable.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemVariable.cpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ElemVariable.cpp  2000/11/02 22:26:00     1.9
  +++ ElemVariable.cpp  2000/11/27 21:44:35     1.10
  @@ -117,7 +117,7 @@
                        break;
   
                case Constants::TATTRNAME_NAME:
  -                     m_qname = QName(atts.getValue(i), 
stylesheetTree.getNamespaces());
  +                     m_qname = QNameByValue(atts.getValue(i), 
stylesheetTree.getNamespaces());
                        break;
   
                case Constants::TATTRNAME_XMLSPACE:
  
  
  
  1.9       +4 -7      xml-xalan/c/src/XSLT/ElemVariable.hpp
  
  Index: ElemVariable.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemVariable.hpp,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ElemVariable.hpp  2000/11/21 21:10:01     1.8
  +++ ElemVariable.hpp  2000/11/27 21:44:37     1.9
  @@ -58,7 +58,7 @@
   #define XALAN_ELEMVARIABLE_HEADER_GUARD 
   
   /**
  - * $Id: ElemVariable.hpp,v 1.8 2000/11/21 21:10:01 auriemma Exp $
  + * $Id: ElemVariable.hpp,v 1.9 2000/11/27 21:44:37 dbertoni Exp $
    * 
    * $State: Exp $
    * 
  @@ -74,15 +74,12 @@
   
   
   
  -#include <XPath/QName.hpp>
  +#include <XPath/QNameByValue.hpp>
   #include <XPath/XObject.hpp>
   
   
  -#include <XSLT/Constants.hpp>
  -
   
  -
  -class XObjectPtr;
  +#include <XSLT/Constants.hpp>
   
   
   
  @@ -156,7 +153,7 @@
   
   protected:
   
  -     QName                   m_qname;
  +     QNameByValue    m_qname;
   
   private:
   
  
  
  
  1.6       +1 -1      xml-xalan/c/src/XSLT/ElemWithParam.cpp
  
  Index: ElemWithParam.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemWithParam.cpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ElemWithParam.cpp 2000/11/02 01:46:26     1.5
  +++ ElemWithParam.cpp 2000/11/27 21:44:42     1.6
  @@ -100,7 +100,7 @@
                }
                else if(equals(aname, Constants::ATTRNAME_NAME))
                {
  -                     m_qname = QName(atts.getValue(i), 
stylesheetTree.getNamespaces());
  +                     m_qname = QNameByValue(atts.getValue(i), 
stylesheetTree.getNamespaces());
                }
                else if(!isAttrOK(aname, atts, i, constructionContext))
                {
  
  
  
  1.6       +2 -2      xml-xalan/c/src/XSLT/ElemWithParam.hpp
  
  Index: ElemWithParam.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemWithParam.hpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ElemWithParam.hpp 2000/11/02 01:46:26     1.5
  +++ ElemWithParam.hpp 2000/11/27 21:44:44     1.6
  @@ -69,7 +69,7 @@
   
   
   
  -#include <XPath/QName.hpp>
  +#include <XPath/QNameByValue.hpp>
   
   
   
  @@ -131,7 +131,7 @@
        // Data members...
        const XPath*    m_selectPattern;
   
  -     QName                   m_qname;
  +     QNameByValue    m_qname;
   };
   
   
  
  
  
  1.9       +10 -3     xml-xalan/c/src/XSLT/FunctionElementAvailable.cpp
  
  Index: FunctionElementAvailable.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/FunctionElementAvailable.cpp,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- FunctionElementAvailable.cpp      2000/11/21 21:10:07     1.8
  +++ FunctionElementAvailable.cpp      2000/11/27 21:44:46     1.9
  @@ -89,11 +89,18 @@
   
        const XalanDOMString    prefix = indexOfNSSep < nameLength ? 
substring(fullName, 0, indexOfNSSep) : XalanDOMString();
   
  -     const XalanDOMString    theNamespace = 
executionContext.getNamespaceForPrefix(prefix);
  +     const XalanDOMString&   theNamespace = 
executionContext.getNamespaceForPrefix(prefix);
   
  -     const XalanDOMString    elementName = indexOfNSSep == nameLength ? 
fullName : substring(fullName, indexOfNSSep + 1);
  +     if (length(theNamespace) == 0)
  +     {
  +             return 
executionContext.getXObjectFactory().createBoolean(false);
  +     }
  +     else
  +     {
  +             const XalanDOMString    elementName = indexOfNSSep == 
nameLength ? fullName : substring(fullName, indexOfNSSep + 1);
   
  -     return 
executionContext.getXObjectFactory().createBoolean(executionContext.elementAvailable(theNamespace,
 elementName));
  +             return 
executionContext.getXObjectFactory().createBoolean(executionContext.elementAvailable(theNamespace,
 elementName));
  +     }
   }
   
   
  
  
  
  1.43      +4 -3      xml-xalan/c/src/XSLT/Stylesheet.cpp
  
  Index: Stylesheet.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/Stylesheet.cpp,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- Stylesheet.cpp    2000/11/21 21:10:19     1.42
  +++ Stylesheet.cpp    2000/11/27 21:44:48     1.43
  @@ -89,6 +89,7 @@
   #include <XPath/ElementPrefixResolverProxy.hpp>
   #include <XPath/XObject.hpp>
   #include <XPath/XPath.hpp>
  +#include <XPath/QNameByReference.hpp>
   
   
   
  @@ -575,7 +576,7 @@
                        const XalanDOMString&                   name,
                        StylesheetExecutionContext&     executionContext) const
   {
  -     return findNamedTemplate(QName(name, m_namespaces), executionContext);
  +     return findNamedTemplate(QNameByValue(name, m_namespaces), 
executionContext);
   }
   
   
  @@ -627,7 +628,7 @@
   {
        const Stylesheet*       theDummy;
   
  -     return findTemplate(executionContext, sourceTree, targetNode, QName(), 
false, theDummy);
  +     return findTemplate(executionContext, sourceTree, targetNode, 
QNameByReference(), false, theDummy);
   }
   
   
  @@ -1112,7 +1113,7 @@
                        var->execute(executionContext,
                                                 doc,
                                                 doc,
  -                                              QName());
  +                                              QNameByReference());
                }
        }
   
  
  
  
  1.28      +5 -5      xml-xalan/c/src/XSLT/Stylesheet.hpp
  
  Index: Stylesheet.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/Stylesheet.hpp,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- Stylesheet.hpp    2000/11/02 01:46:27     1.27
  +++ Stylesheet.hpp    2000/11/27 21:44:50     1.28
  @@ -81,7 +81,7 @@
   
   #include <XPath/PrefixResolver.hpp>
   #include <XPath/NameSpace.hpp>
  -#include <XPath/QName.hpp>
  +#include <XPath/QNameByValue.hpp>
   
   
   
  @@ -132,7 +132,7 @@
        typedef map<XalanDOMString,
                                ExtensionNSHandler*,
                                less<XalanDOMString> >                          
ExtensionNamespacesMapType;
  -     typedef map<QName,
  +     typedef map<QNameByValue,
                                ElemTemplate*,
                                less<QName> >                                   
        ElemTemplateMapType;
        typedef vector<ElemAttributeSet*>                               
AttributeSetMapType;
  @@ -141,7 +141,7 @@
        typedef map<const XalanNode*,
                                KeyTable*,
                                less<const XalanNode*> >                        
KeyTablesTableType;
  -     typedef vector<QName>                                                   
QNameVectorType;
  +     typedef vector<QNameByValue>                                    
QNameVectorType;
        typedef vector<Stylesheet*>                                             
StylesheetVectorType;
        typedef vector<XalanDOMString>                                  
URLStackType;
        typedef vector<const XPath*>                                    
XPathVectorType;
  @@ -149,12 +149,12 @@
   #else
        typedef std::map<XalanDOMString, XalanDOMString>                
StringToStringMapType;
        typedef std::map<XalanDOMString, ExtensionNSHandler*>   
ExtensionNamespacesMapType;
  -     typedef std::map<QName, ElemTemplate*>                                  
ElemTemplateMapType;
  +     typedef std::map<QNameByValue, ElemTemplate*>                   
ElemTemplateMapType;
        typedef std::vector<ElemAttributeSet*>                                  
AttributeSetMapType;
        typedef std::vector<ElemVariable*>                                      
        ElemVariableVectorType;
        typedef std::vector<KeyDeclaration>                                     
        KeyDeclarationVectorType;
        typedef std::map<const XalanNode*, KeyTable*>                   
KeyTablesTableType;
  -     typedef std::vector<QName>                                              
                QNameVectorType;
  +     typedef std::vector<QNameByValue>                                       
        QNameVectorType;
        typedef std::vector<Stylesheet*>                                        
        StylesheetVectorType;
        typedef std::vector<XalanDOMString>                                     
        URLStackType;
        typedef std::vector<const XPath*>                                       
        XPathVectorType;
  
  
  
  1.42      +30 -25    
xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.cpp
  
  Index: StylesheetExecutionContextDefault.cpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.cpp,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- StylesheetExecutionContextDefault.cpp     2000/11/21 21:10:20     1.41
  +++ StylesheetExecutionContextDefault.cpp     2000/11/27 21:44:52     1.42
  @@ -76,7 +76,7 @@
   
   
   
  -#include <XPath/QName.hpp>
  +#include <XPath/QNameByReference.hpp>
   #include <XPath/ResultTreeFragBase.hpp>
   #include <XPath/XObjectFactory.hpp>
   #include <XPath/XPath.hpp>
  @@ -482,20 +482,17 @@
                        XalanNode*                                      
contextNode,
                        const PrefixResolver&           resolver)
   {
  -     XObjectPtr      var;
  -
        if (length(str) > 0)
        {
  -             var = m_xsltProcessor.evalXPathStr(
  -                                             str,
  -                                             contextNode,
  -                                             resolver,
  -                                             *this);
  -             assert(var.null() == false);
  +             m_variablesStack.pushVariable(
  +                     name,
  +                     m_xsltProcessor.evalXPathStr(
  +                                                     str,
  +                                                     contextNode,
  +                                                     resolver,
  +                                                     *this),
  +                     element);
        }
  -
  -     // Call to our own member function, to keep track of the XObject...
  -     pushVariable(name, var, element);
   }
   
   
  @@ -519,9 +516,7 @@
                        XalanNode*                                      
contextNode,
                        const PrefixResolver&           resolver)
   {
  -     XObjectPtr      theXObject(xpath.execute(contextNode, resolver, *this));
  -
  -     pushVariable(name, theXObject, element);
  +     m_variablesStack.pushVariable(name, xpath.execute(contextNode, 
resolver, *this), element);
   }
   
   
  @@ -534,7 +529,7 @@
                        XalanNode*                                      
sourceTree,
                        XalanNode*                                      
sourceNode)
   {
  -     pushVariable(name, createXResultTreeFrag(templateChild, sourceTree, 
sourceNode), element);
  +     m_variablesStack.pushVariable(name, 
createXResultTreeFrag(templateChild, sourceTree, sourceNode), element);
   }
   
   
  @@ -605,20 +600,29 @@
                        const QName&                            mode,
                        const ElemTemplateElement*      targetTemplate)
   {
  -     typedef VariablesStack::ParamsVectorType        ParamsVectorType;
  -     
  -     ParamsVectorType        theParams;
  -
        const ElemTemplateElement*      child =
                        xslCallTemplateElement.getFirstChildElem();
   
  +     // This will ensure that the contents of m_paramsVector are
  +     // cleared.
  +     CollectionClearGuard<ParamsVectorType>  theGuard(m_paramsVector);
  +
        if (0 != child)
        {
  +             assert(m_paramsVector.size() == 0);
  +
                // This object will take care of popping, then
                // pushing the context marker at the top of the
  -             // stack, even if an exception is thrown...
  +             // stack, even if an exception is thrown.
                PopPushContextMarker    thePopPush(*this);
   
  +             // Make sure we have the default capacity for the params
  +             // vector...
  +             if (m_paramsVector.capacity() == 0)
  +             {
  +                      m_paramsVector.reserve(eDefaultParamsVectorSize);
  +             }
  +
                while(0 != child)
                {
                        if(Constants::ELEMNAME_WITHPARAM == 
child->getXSLToken())
  @@ -654,15 +658,16 @@
                                                        mode);
                                }
   
  -                             
theParams.push_back(ParamsVectorType::value_type(&xslParamElement->getQName(), 
theXObject));
  +                             
m_paramsVector.push_back(ParamsVectorType::value_type(&xslParamElement->getQName(),
 theXObject));
                        }
   
                        child = child->getNextSiblingElem();
                }
        }
   
  -     m_variablesStack.pushParams(theParams,
  -                                                        targetTemplate);
  +     m_variablesStack.pushParams(
  +                             m_paramsVector,
  +                             targetTemplate);
   }
   
   
  @@ -818,7 +823,7 @@
        return createXResultTreeFrag(templateChild,
                                                                 sourceTree,
                                                                 sourceNode,
  -                                                              QName());
  +                                                              
QNameByReference());
   }
   
   
  
  
  
  1.39      +5 -2      
xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.hpp
  
  Index: StylesheetExecutionContextDefault.hpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.hpp,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- StylesheetExecutionContextDefault.hpp     2000/11/21 21:10:21     1.38
  +++ StylesheetExecutionContextDefault.hpp     2000/11/27 21:44:55     1.39
  @@ -122,8 +122,8 @@
   #endif
   
        typedef Stylesheet::KeyTablesTableType                          
KeyTablesTableType;
  +     typedef VariablesStack::ParamsVectorType                        
ParamsVectorType;
   
  -
        StylesheetExecutionContextDefault(
                        XSLTEngineImpl&                 xsltProcessor,
                        XPathEnvSupport&                theXPathEnvSupport,
  @@ -813,7 +813,8 @@
   
        enum { eDefaultVariablesCollectionSize = 10,
                   eXPathCacheMax = 50,
  -                eDefaultVariablesStackSize = 200 };
  +                eDefaultVariablesStackSize = 200,
  +                eDefaultParamsVectorSize = 10 };
   
        ElementRecursionStackType                       m_elementRecursionStack;
   
  @@ -833,6 +834,8 @@
         * Holds all information about variables during execution.
         */
        VariablesStack                                          
m_variablesStack;
  +
  +     ParamsVectorType                                        m_paramsVector;
   
        XPathCacheMapType                                       
m_matchPatternCache;
   
  
  
  
  1.31      +3 -2      xml-xalan/c/src/XSLT/StylesheetRoot.cpp
  
  Index: StylesheetRoot.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetRoot.cpp,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- StylesheetRoot.cpp        2000/11/20 20:04:37     1.30
  +++ StylesheetRoot.cpp        2000/11/27 21:44:57     1.31
  @@ -87,6 +87,7 @@
   
   
   
  +#include <XPath/QNameByReference.hpp>
   #include <XPath/XPathFactory.hpp>
   #include <XPath/XPathProcessor.hpp>
   
  @@ -219,7 +220,7 @@
   
        // Output the action of the found root rule.  All processing
        // occurs from here.
  -     rootRule->execute(executionContext, sourceTree, sourceTree, QName());
  +     rootRule->execute(executionContext, sourceTree, sourceTree, 
QNameByReference());
   
        executionContext.endDocument();
   
  @@ -474,7 +475,7 @@
                        {
                                const XalanDOMString    token = 
tokenizer.nextToken();
   
  -                             const QName                             
qname(token, getNamespaces());
  +                             const QNameByValue              qname(token, 
getNamespaces());
   
                                m_cdataSectionElems.push_back(qname);
                        }
  
  
  
  1.4       +3 -3      xml-xalan/c/src/XSLT/TopLevelArg.hpp
  
  Index: TopLevelArg.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/TopLevelArg.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TopLevelArg.hpp   2000/11/21 21:10:22     1.3
  +++ TopLevelArg.hpp   2000/11/27 21:44:59     1.4
  @@ -73,7 +73,7 @@
   
   
   
  -#include <XPath/QName.hpp>
  +#include <XPath/QNameByValue.hpp>
   #include <XPath/XObject.hpp>
   
   
  @@ -106,7 +106,7 @@
         * @param variable      the XObject instance.
         */
        TopLevelArg(
  -             const QName&            name = QName(),
  +             const QName&            name = QNameByValue(),
                const XObjectPtr        variable = XObjectPtr());
   
        /**
  @@ -172,7 +172,7 @@
   
   private:
   
  -     QName                           m_qname;
  +     QNameByValue            m_qname;
   
        XalanDOMString          m_expression;
   
  
  
  
  1.8       +15 -1     xml-xalan/c/src/XSLT/VariablesStack.cpp
  
  Index: VariablesStack.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/VariablesStack.cpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- VariablesStack.cpp        2000/11/21 21:10:23     1.7
  +++ VariablesStack.cpp        2000/11/27 21:45:01     1.8
  @@ -69,6 +69,7 @@
   VariablesStack::VariablesStack() :
        m_stack(),
        m_globalStackFrameIndex(-1),
  +     m_globalStackFrameMarked(false),
        m_currentStackFrameIndex(0)
   {
        m_stack.reserve(eDefaultStackSize);
  @@ -91,6 +92,8 @@
        }
   
        m_stack.clear();
  +
  +     m_globalStackFrameMarked = false;
   }
   
   
  @@ -227,6 +230,15 @@
        }
   
        m_stack.push_back(theEntry);
  +
  +     // Increment the global stack frame index as long as we're pushing 
variables, and
  +     // it already hasn't been marked.  This is a temporary work-around for 
problems
  +     // with evaluating top-level variables as they're pushed, rather than 
as they're
  +     // used.
  +     if (m_globalStackFrameMarked == false && theEntry.getType() == 
StackEntry::eVariable)
  +     {
  +             m_globalStackFrameIndex = m_currentStackFrameIndex;
  +     }
   }
   
   
  @@ -310,6 +322,8 @@
   {
        m_globalStackFrameIndex = m_stack.size();
   
  +     m_globalStackFrameMarked = true;
  +
        pushContextMarker();
   }
   
  @@ -371,7 +385,7 @@
                }
        }
   
  -     if(0 == theResult && true == fSearchGlobalSpace)
  +     if(0 == theResult && true == fSearchGlobalSpace && 
m_globalStackFrameIndex > 1)
        {
                // Look in the global space
                for(unsigned int i = m_globalStackFrameIndex - 1; i > 0; i--)
  
  
  
  1.6       +2 -2      xml-xalan/c/src/XSLT/VariablesStack.hpp
  
  Index: VariablesStack.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/VariablesStack.hpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- VariablesStack.hpp        2000/11/21 21:10:23     1.5
  +++ VariablesStack.hpp        2000/11/27 21:45:03     1.6
  @@ -81,8 +81,6 @@
   class Arg;
   class ElemTemplateElement;
   class StylesheetExecutionContext;
  -class XObject;
  -class XObjectPtr;
   class XalanNode;
   
   
  @@ -443,6 +441,8 @@
        VariableStackStackType                  m_stack;
   
        int                                                             
m_globalStackFrameIndex;
  +
  +     bool                                                    
m_globalStackFrameMarked;
   
        /**
         * This is the top of the stack frame from where a search 
  
  
  
  1.72      +7 -7      xml-xalan/c/src/XSLT/XSLTEngineImpl.cpp
  
  Index: XSLTEngineImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTEngineImpl.cpp,v
  retrieving revision 1.71
  retrieving revision 1.72
  diff -u -r1.71 -r1.72
  --- XSLTEngineImpl.cpp        2000/11/21 22:48:38     1.71
  +++ XSLTEngineImpl.cpp        2000/11/27 21:45:06     1.72
  @@ -108,8 +108,10 @@
   
   
   #include <XPath/ElementPrefixResolverProxy.hpp>
  +#include <XPath/QNameByReference.hpp>
   #include <XPath/ResultTreeFrag.hpp>
   #include <XPath/XObject.hpp>
  +#include <XPath/XObjectFactory.hpp>
   #include <XPath/XPathEnvSupport.hpp>
   #include <XPath/XPathEnvSupportDefault.hpp>
   #include <XPath/XPathExecutionContextDefault.hpp>
  @@ -117,8 +119,6 @@
   #include <XPath/XPathProcessorImpl.hpp>
   #include <XPath/XPathSupport.hpp>
   #include <XPath/XPathSupportDefault.hpp>
  -#include <XPath/XObject.hpp>
  -#include <XPath/XObjectFactory.hpp>
   #include <XPath/XResultTreeFrag.hpp>
   
   
  @@ -2214,9 +2214,9 @@
   
                for(Stylesheet::QNameVectorType::size_type i = 0; i < theSize 
&& is == false; i++)
                {
  -                     const QName& qname = cdataElems[i];
  +                     const QName&    qname = cdataElems[i];
   
  -                     is = qname.equals(QName(elemNS, elemLocalName));
  +                     is = qname.equals(QNameByReference(elemNS, 
elemLocalName));
                }
        }
   
  @@ -2261,7 +2261,7 @@
                elemLocalName = elementName;
        }
   
  -     return qname.equals(QName(elemNS, elemLocalName));
  +     return qname.equals(QNameByReference(elemNS, elemLocalName));
   }
   
   
  @@ -2942,7 +2942,7 @@
                        const XalanDOMString&   theName,
                        const XalanDOMString&   expression)
   {
  -     const QName             qname(theName, 0, m_xpathEnvSupport, 
m_xpathSupport);
  +     const QNameByValue      qname(theName, 0, m_xpathEnvSupport, 
m_xpathSupport);
   
        m_topLevelParams.push_back(ParamVectorType::value_type(qname, 
expression));
   }
  @@ -2954,7 +2954,7 @@
                        const XalanDOMString&   theName,
                        XObjectPtr                              theValue)
   {
  -     const QName             qname(theName, 0, m_xpathEnvSupport, 
m_xpathSupport);
  +     const QNameByValue      qname(theName, 0, m_xpathEnvSupport, 
m_xpathSupport);
   
        m_topLevelParams.push_back(ParamVectorType::value_type(qname, 
theValue));
   }
  
  
  
  1.4       +2 -0      xml-xalan/c/src/XalanDOM/XalanDOMString.cpp
  
  Index: XalanDOMString.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XalanDOM/XalanDOMString.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XalanDOMString.cpp        2000/11/20 19:58:24     1.3
  +++ XalanDOMString.cpp        2000/11/27 21:46:26     1.4
  @@ -636,6 +636,7 @@
   
   
   
  +#if defined(XALAN_USE_XERCES_DOMSTRING) || defined(XALAN_USE_STD_STRING)
   XALAN_DOM_EXPORT_FUNCTION(const XalanDOMString)
   TranscodeFromLocalCodePage(
                        const char*             theSourceString,
  @@ -663,3 +664,4 @@
                return XalanDOMString(&theResult[0], theSize);
        }
   }
  +#endif
  
  
  
  1.6       +41 -7     xml-xalan/c/src/XalanDOM/XalanDOMString.hpp
  
  Index: XalanDOMString.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XalanDOM/XalanDOMString.hpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XalanDOMString.hpp        2000/11/20 21:35:39     1.5
  +++ XalanDOMString.hpp        2000/11/27 21:46:29     1.6
  @@ -853,6 +853,31 @@
   
   
   /**
  + * Convert a string to a XalanDOMString, transcoding from
  + * the default local code page.
  + * 
  + * @param theSourceString The source string
  + * @param theSourceStringLength The source string length.
  + * @return The new string.
  + */
  +#if defined(XALAN_USE_XERCES_DOMSTRING) || defined(XALAN_USE_STD_STRING)
  +XALAN_DOM_EXPORT_FUNCTION(const XalanDOMString)
  +TranscodeFromLocalCodePage(
  +                     const char*             theSourceString,
  +                     unsigned int    theSourceStringLength = unsigned(-1));
  +#else 
  +inline const XalanDOMString
  +TranscodeFromLocalCodePage(
  +                     const char*             theSourceString,
  +                     unsigned int    theSourceStringLength = unsigned(-1))
  +{
  +     return XalanDOMString(theSourceString, theSourceStringLength);
  +}
  +#endif
  +
  +
  +
  +/**
    * Convert a string to a C++ standard library
    * vector, transcoding from the default local code
    * page.
  @@ -891,17 +916,26 @@
   
   
   /**
  - * Convert XalanDOMString to C++ standard library
  - * vector, transcoding to the default local code
  - * page.
  + * Convert a vector of characters to a XalanDOMString,
  + * transcoding from the default local code
    *
    * @param theSourceString source string
    * @return The transcoded string.
    */
  -XALAN_DOM_EXPORT_FUNCTION(const XalanDOMString)
  -TranscodeFromLocalCodePage(
  -                     const char*             theSourceString,
  -                     unsigned int    theSourceStringLength = unsigned(-1));
  +inline const XalanDOMString
  +TranscodeFromLocalCodePage(const CharVectorType&     theSourceString)
  +{
  +     const CharVectorType::size_type         theSize = 
theSourceString.size();
  +
  +     if (theSourceString[theSize - 1] == CharVectorType::value_type(0))
  +     {
  +             return TranscodeFromLocalCodePage(&*theSourceString.begin(), 
theSize - 1);
  +     }
  +     else
  +     {
  +             return TranscodeFromLocalCodePage(&*theSourceString.begin(), 
theSize);
  +     }
  +}
   
   
   
  
  
  

Reply via email to