[prev in list] [next in list] [prev in thread] [next in thread]
List: xalan-cvs
Subject: cvs commit: xml-xalan/c/src/xalanc/XalanSourceTree XalanSourceTreeDocument.hpp
From: mhoyt () apache ! org
Date: 2004-09-17 22:23:10
Message-ID: 20040917222310.66304.qmail () minotaur ! apache ! org
[Download RAW message or body]
mhoyt 2004/09/17 15:23:10
Modified: c/Projects/Win32/VC6/AllInOne AllInOne.dsp
c/src/xalanc/DOMSupport XalanDocumentPrefixResolver.hpp
c/src/xalanc/Include STLHelper.hpp XalanList.hpp
XalanMap.hpp
c/src/xalanc/PlatformSupport DOMStringHelper.hpp
c/src/xalanc/XPath XPathEnvSupportDefault.hpp
XPathProcessorImpl.hpp XalanQName.hpp
XalanQNameByReference.hpp
c/src/xalanc/XSLT KeyTable.hpp NamespacesHandler.hpp
Stylesheet.hpp
StylesheetExecutionContextDefault.hpp
StylesheetRoot.hpp
c/src/xalanc/XalanSourceTree XalanSourceTreeDocument.hpp
Log:
Patch to enable HP/aCC build (reduce symbol names by reducing number of template \
parameters/nested templates) and updated project files to enable VC6 Build.
Revision Changes Path
1.59 +15 -4 xml-xalan/c/Projects/Win32/VC6/AllInOne/AllInOne.dsp
Index: AllInOne.dsp
===================================================================
RCS file: /home/cvs/xml-xalan/c/Projects/Win32/VC6/AllInOne/AllInOne.dsp,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- AllInOne.dsp 13 Aug 2004 17:25:20 -0000 1.58
+++ AllInOne.dsp 17 Sep 2004 22:23:09 -0000 1.59
@@ -46,7 +46,7 @@
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D \
"_MBCS" /D "_USRDLL" /D "XSLT_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W4 /GR /GX /O2 /Ob2 /I \
"..\..\..\..\Build\Win32\VC6\Release\Nls\Include" /I \
"..\..\..\..\..\..\xml-xerces\c\src" /I "..\..\..\..\src\\" /I "$(XERCESCROOT)\src" \
/I "$(XERCESCROOT)\include" /D "NDEBUG" /D "XALAN_DOMSUPPORT_BUILD_DLL" /D "WIN32" /D \
"_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XALAN_XSLT_BUILD_DLL" /D \
"XALAN_PLATFORMSUPPORT_BUILD_DLL" /D "XALAN_DOM_BUILD_DLL" /D \
"XALAN_XALANEXTENSIONS_BUILD_DLL" /D "XALAN_XALANSOURCETREE_BUILD_DLL" /D \
"XALAN_TRANSFORMER_BUILD_DLL" /D "XALAN_XERCESPARSERLIAISON_BUILD_DLL" /D \
"XALAN_XMLSUPPORT_BUILD_DLL" /D "XALAN_XPATH_BUILD_DLL" /D \
"XALAN_XPATHCAPI_BUILD_DLL" /D "XALAN_ALLINONE_BUILD_DLL" /D "XALAN_EXSLT_BUILD_DLL" \
/D "XALAN_HARNESS_BUILD_DLL" /D "XALAN_INMEM_MSG_LOADER" /D "ITERATIVE_EXECUTION" /FD \
/Zm125 /c +# ADD CPP /nologo /MD /W4 /GR /GX /O2 /Ob2 /I \
"..\..\..\..\Build\Win32\VC6\Release\Nls\Include" /I \
"..\..\..\..\..\..\xml-xerces\c\src" /I "..\..\..\..\src\\" /I "$(XERCESCROOT)\src" \
/I "$(XERCESCROOT)\include" /D "NDEBUG" /D "XALAN_DOMSUPPORT_BUILD_DLL" /D "WIN32" /D \
"_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XALAN_XSLT_BUILD_DLL" /D \
"XALAN_PLATFORMSUPPORT_BUILD_DLL" /D "XALAN_DOM_BUILD_DLL" /D \
"XALAN_XALANEXTENSIONS_BUILD_DLL" /D "XALAN_XALANSOURCETREE_BUILD_DLL" /D \
"XALAN_TRANSFORMER_BUILD_DLL" /D "XALAN_XERCESPARSERLIAISON_BUILD_DLL" /D \
"XALAN_XMLSUPPORT_BUILD_DLL" /D "XALAN_XPATH_BUILD_DLL" /D \
"XALAN_XPATHCAPI_BUILD_DLL" /D "XALAN_ALLINONE_BUILD_DLL" /D "XALAN_EXSLT_BUILD_DLL" \
/D "XALAN_HARNESS_BUILD_DLL" /D "XALAN_INMEM_MSG_LOADER" /D "ITERATIVE_EXECUTION" /FD \
/Zm250 /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
@@ -72,8 +72,7 @@
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D \
"_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XSLT_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W4 /Gm /GR /GX /Zi /Od /I \
"..\..\..\..\Build\Win32\VC6\Debug\Nls\Include" /I \
"..\..\..\..\..\..\xml-xerces\c\src" /I "..\..\..\..\src\\" /I "$(XERCESCROOT)\src" \
/I "$(XERCESCROOT)\include" /D "_DEBUG" /D "XALAN_DOMSUPPORT_BUILD_DLL" /D "WIN32" /D \
"_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XALAN_XSLT_BUILD_DLL" /D \
"XALAN_PLATFORMSUPPORT_BUILD_DLL" /D "XALAN_DOM_BUILD_DLL" /D \
"XALAN_XALANEXTENSIONS_BUILD_DLL" /D "XALAN_XALANSOURCETREE_BUILD_DLL" /D \
"XALAN_TRANSFORMER_BUILD_DLL" /D "XALAN_XERCESPARSERLIAISON_BUILD_DLL" /D \
"XALAN_XMLSUPPORT_BUILD_DLL" /D "XALAN_XPATH_BUILD_DLL" /D \
"XALAN_XPATHCAPI_BUILD_DLL" /D "XALAN_ALLINONE_BUILD_DLL" /D "XALAN_EXSLT_BUILD_DLL" \
/D "XALAN_HARNESS_BUILD_DLL" /D "XALAN_INMEM_MSG_LOADER" /D "ITERATIVE_EXECUTION" /YX \
/FD /GZ /Zm125 /c
-# SUBTRACT CPP /Fr
+# ADD CPP /nologo /MDd /W4 /Gm /GR /GX /Zi /Od /I \
"..\..\..\..\Build\Win32\VC6\Debug\Nls\Include" /I \
"..\..\..\..\..\..\xml-xerces\c\src" /I "..\..\..\..\src\\" /I "$(XERCESCROOT)\src" \
/I "$(XERCESCROOT)\include" /D "_DEBUG" /D "XALAN_DOMSUPPORT_BUILD_DLL" /D "WIN32" /D \
"_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XALAN_XSLT_BUILD_DLL" /D \
"XALAN_PLATFORMSUPPORT_BUILD_DLL" /D "XALAN_DOM_BUILD_DLL" /D \
"XALAN_XALANEXTENSIONS_BUILD_DLL" /D "XALAN_XALANSOURCETREE_BUILD_DLL" /D \
"XALAN_TRANSFORMER_BUILD_DLL" /D "XALAN_XERCESPARSERLIAISON_BUILD_DLL" /D \
"XALAN_XMLSUPPORT_BUILD_DLL" /D "XALAN_XPATH_BUILD_DLL" /D \
"XALAN_XPATHCAPI_BUILD_DLL" /D "XALAN_ALLINONE_BUILD_DLL" /D "XALAN_EXSLT_BUILD_DLL" \
/D "XALAN_HARNESS_BUILD_DLL" /D "XALAN_INMEM_MSG_LOADER" /D "ITERATIVE_EXECUTION" /YX \
/FD /GZ /Zm250 /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
@@ -102,7 +101,7 @@
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W4 /GR /GX /O2 /I "..\..\..\..\..\..\xml-xerces\c\src" \
/I "..\..\..\..\src\\" /I "..\..\..\..\Build\Win32\VC6\Release.symbols\Nls\Include" \
/D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D \
"XALAN_XSLT_BUILD_DLL" /D "XALAN_XERCES" /FD /c # SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /MD /W4 /GR /GX /Zi /O2 /Ob2 /I \
"..\..\..\..\Build\Win32\VC6\Release.symbols\Nls\Include" /I \
"..\..\..\..\..\..\xml-xerces\c\src" /I "..\..\..\..\src\\" /I "$(XERCESCROOT)\src" \
/I "$(XERCESCROOT)\include" /D "NDEBUG" /D "XALAN_DOMSUPPORT_BUILD_DLL" /D "WIN32" /D \
"_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XALAN_XSLT_BUILD_DLL" /D \
"XALAN_PLATFORMSUPPORT_BUILD_DLL" /D "XALAN_DOM_BUILD_DLL" /D \
"XALAN_XALANEXTENSIONS_BUILD_DLL" /D "XALAN_XALANSOURCETREE_BUILD_DLL" /D \
"XALAN_TRANSFORMER_BUILD_DLL" /D "XALAN_XERCESPARSERLIAISON_BUILD_DLL" /D \
"XALAN_XMLSUPPORT_BUILD_DLL" /D "XALAN_XPATH_BUILD_DLL" /D \
"XALAN_XPATHCAPI_BUILD_DLL" /D "XALAN_ALLINONE_BUILD_DLL" /D "XALAN_EXSLT_BUILD_DLL" \
/D "XALAN_HARNESS_BUILD_DLL" /D "XALAN_INMEM_MSG_LOADER" /D "ITERATIVE_EXECUTION" /FD \
/Zm125 /c +# ADD CPP /nologo /MD /W4 /GR /GX /Zi /O2 /Ob2 /I \
"..\..\..\..\Build\Win32\VC6\Release.symbols\Nls\Include" /I \
"..\..\..\..\..\..\xml-xerces\c\src" /I "..\..\..\..\src\\" /I "$(XERCESCROOT)\src" \
/I "$(XERCESCROOT)\include" /D "NDEBUG" /D "XALAN_DOMSUPPORT_BUILD_DLL" /D "WIN32" /D \
"_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XALAN_XSLT_BUILD_DLL" /D \
"XALAN_PLATFORMSUPPORT_BUILD_DLL" /D "XALAN_DOM_BUILD_DLL" /D \
"XALAN_XALANEXTENSIONS_BUILD_DLL" /D "XALAN_XALANSOURCETREE_BUILD_DLL" /D \
"XALAN_TRANSFORMER_BUILD_DLL" /D "XALAN_XERCESPARSERLIAISON_BUILD_DLL" /D \
"XALAN_XMLSUPPORT_BUILD_DLL" /D "XALAN_XPATH_BUILD_DLL" /D \
"XALAN_XPATHCAPI_BUILD_DLL" /D "XALAN_ALLINONE_BUILD_DLL" /D "XALAN_EXSLT_BUILD_DLL" \
/D "XALAN_HARNESS_BUILD_DLL" /D "XALAN_INMEM_MSG_LOADER" /D "ITERATIVE_EXECUTION" /FD \
/Zm250 /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
@@ -199,7 +198,19 @@
# End Source File
# Begin Source File
+SOURCE=..\..\..\..\src\xalanc\Include\XalanList.hpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\xalanc\Include\XalanMap.hpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\..\..\src\xalanc\Include\XalanObjectCache.hpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\xalanc\Include\XalanVector.hpp
# End Source File
# Begin Source File
1.6 +1 -3 \
xml-xalan/c/src/xalanc/DOMSupport/XalanDocumentPrefixResolver.hpp
Index: XalanDocumentPrefixResolver.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/DOMSupport/XalanDocumentPrefixResolver.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XalanDocumentPrefixResolver.hpp 31 Aug 2004 14:20:26 -0000 1.5
+++ XalanDocumentPrefixResolver.hpp 17 Sep 2004 22:23:09 -0000 1.6
@@ -59,9 +59,7 @@
typedef XalanVector<const XalanNode*> AttributeVectorType;
typedef XalanMap<const XalanDOMString*,
- AttributeVectorType,
- DOMStringPointerHashFunction,
- pointer_equal<XalanDOMString> > NamespacesMapType;
+ AttributeVectorType> NamespacesMapType;
/**
* Constructor.
1.7 +14 -0 xml-xalan/c/src/xalanc/Include/STLHelper.hpp
Index: STLHelper.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/Include/STLHelper.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- STLHelper.hpp 31 Aug 2004 18:29:18 -0000 1.6
+++ STLHelper.hpp 17 Sep 2004 22:23:10 -0000 1.7
@@ -28,6 +28,10 @@
+#include <xalanc/Include/XalanMap.hpp>
+
+
+
XALAN_CPP_NAMESPACE_BEGIN
@@ -353,6 +357,16 @@
return ++theHashValue;
}
};
+
+
+
+template<>
+struct XalanMapKeyTraits<const XalanDOMChar*>
+{
+ typedef hash_null_terminated_arrays<XalanDOMChar> Hasher;
+ typedef equal_null_terminated_arrays<XalanDOMChar> Comparator;
+};
+
template<class CollectionType>
1.3 +40 -27 xml-xalan/c/src/xalanc/Include/XalanList.hpp
Index: XalanList.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/Include/XalanList.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XalanList.hpp 7 Sep 2004 21:52:11 -0000 1.2
+++ XalanList.hpp 17 Sep 2004 22:23:10 -0000 1.3
@@ -44,7 +44,9 @@
XALAN_CPP_NAMESPACE_BEGIN
-
+/**
+ * Xalan implementation of a doubly linked list
+ */
template <class Type>
class XalanList
{
@@ -72,32 +74,35 @@
next(&nextNode)
{
}
-
+
value_type value;
Node* prev;
Node* next;
};
- template<class Value, class Ref, class Ptr, class ListNode>
+
+ template<class Value>
struct iterator_base
{
typedef Value value_type;
- typedef Ref reference;
- typedef Ptr pointer;
+ typedef Value& reference;
+ typedef Value* pointer;
+
typedef size_type difference_type;
typedef XALAN_STD_QUALIFIER bidirectional_iterator_tag iterator_category;
- typedef iterator_base<Value, Value&, Value*, Node> iterator;
- typedef iterator_base<Value, Ref, Ptr, ListNode> ThisType;
+ typedef iterator_base<Type> iterator;
+
+ typedef iterator_base<value_type> ThisType;
- iterator_base(ListNode& node)
+ iterator_base(Node& node) :
+ currentNode(&node)
{
- currentNode = &node;
}
- iterator_base(const iterator& theRhs)
+ iterator_base(const iterator& theRhs) :
+ currentNode(theRhs.currentNode)
{
- currentNode = theRhs.currentNode;
}
iterator_base operator++()
@@ -108,7 +113,7 @@
iterator_base operator++(int)
{
- ListNode& origNode = *currentNode;
+ Node& origNode = *currentNode;
currentNode = currentNode->next;
return iterator_base(origNode);
}
@@ -119,6 +124,17 @@
return *this;
}
+ iterator_base operator-(difference_type decrement) const
+ {
+ Node* node = currentNode;
+ while (decrement > 0)
+ {
+ node = node->prev;
+ --decrement;
+ };
+ return iterator_base(*node);
+ }
+
reference operator*() const
{
return currentNode->value;
@@ -145,27 +161,18 @@
return currentNode == theRhs.currentNode;
}
- ListNode& node()
+ Node& node()
{
return *currentNode;
}
- ListNode* currentNode;
+ Node* currentNode;
};
-
- typedef iterator_base<
- value_type,
- value_type&,
- value_type*,
- Node> iterator;
-
- typedef iterator_base<
- value_type,
- const value_type&,
- const value_type*,
- const Node> const_iterator;
-
+ typedef iterator_base<value_type> iterator;
+
+ typedef iterator_base<const value_type> const_iterator;
+
#if defined(XALAN_HAS_STD_ITERATORS)
typedef XALAN_STD_QUALIFIER reverse_iterator<iterator> reverse_iterator_;
typedef XALAN_STD_QUALIFIER \
reverse_iterator<const_iterator> const_reverse_iterator_; @@ -372,9 +379,15 @@
void swap(ThisType& theRHS)
{
+ #if defined(XALAN_NO_STD_NAMESPACE)
+ ::swap(m_memoryManager, theRHS.m_memoryManager);
+ ::swap(m_listHead, theRHS.m_listHead);
+ ::swap(m_freeListHeadPtr, theRHS.m_freeListHeadPtr);
+ #else
XALAN_STD_QUALIFIER swap(m_memoryManager, theRHS.m_memoryManager);
XALAN_STD_QUALIFIER swap(m_listHead, theRHS.m_listHead);
XALAN_STD_QUALIFIER swap(m_freeListHeadPtr, theRHS.m_freeListHeadPtr);
+ #endif
}
1.6 +96 -168 xml-xalan/c/src/xalanc/Include/XalanMap.hpp
Index: XalanMap.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/Include/XalanMap.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XalanMap.hpp 7 Sep 2004 21:52:11 -0000 1.5
+++ XalanMap.hpp 17 Sep 2004 22:23:10 -0000 1.6
@@ -44,7 +44,7 @@
typedef size_t size_type;
template <class Key>
-class XalanHash : public XALAN_STD_QUALIFIER unary_function<Key, size_type>
+class XalanHasher : public XALAN_STD_QUALIFIER unary_function<Key, size_type>
{
public:
size_type operator()(const Key& key) const
@@ -63,6 +63,14 @@
};
template <class Key>
+struct XalanMapKeyTraits
+{
+ typedef XalanHasher<Key> Hasher;
+ typedef XALAN_STD_QUALIFIER equal_to<Key> Comparator;
+};
+
+
+template <class Key>
struct XalanHashMemberPointer
{
@@ -83,14 +91,44 @@
}
};
+template <class Value>
+struct XalanMapEntry : public Value
+{
+ typedef Value value_type;
+ typedef size_t size_type;
+
+ size_type bucketIndex;
+
+ XalanMapEntry(const value_type& value, size_type index) :
+ value_type(value), bucketIndex(index)
+ {
+ }
+
+ XalanMapEntry() :
+ value_type(),
+ bucketIndex(size_type())
+ {
+ }
+};
+
+/**
+ * Xalan implementation of a hashtable.
+ *
+ */
template <
class Key,
- class Value,
- class Hash = XalanHash<Key>,
- class Comparator = XALAN_STD_QUALIFIER equal_to<Key> >
+ class Value,
+ class KeyTraits = XalanMapKeyTraits<Key> >
class XalanMap
{
public:
+ /**
+ * Each map entry is stored in a linked list.
+ * The hash buckets are a vector of pointers into the entry list
+ * An empty bucket will point to the end of the list,
+ * A non-empty bucket will point to its first entry. Remaining
+ * entries in the chain follow the first and have the same index value.
+ */
typedef XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager MemoryManagerType;
@@ -99,129 +137,37 @@
typedef size_t size_type;
typedef XALAN_STD_QUALIFIER pair<const key_type, data_type> value_type;
-
- typedef XalanMap<Key, Value, Hash, Comparator> ThisType;
-
- struct Entry : public value_type
- {
- typedef value_type Parent;
- size_type bucketIndex;
-
- Entry(const key_type & key, const data_type& data, size_type index) :
- value_type(key, data), bucketIndex(index)
- {
- }
-
- Entry() :
- value_type(key_type(),
- data_type()),
- bucketIndex(size_type())
- {
- }
- };
+ typedef XalanMapEntry<value_type> Entry;
typedef XalanList<Entry> EntryListType;
- typedef typename EntryListType::iterator EntryListIterator;
- typedef typename EntryListType::const_iterator EntryListConstIterator;
-
- typedef XalanVector<typename EntryListType::iterator> EntryPosVectorType;
-
- template<class ValueType, class Ref, class Ptr, class Iterator, class Map>
- struct iterator_base
- {
- typedef ValueType value_type;
- typedef Ref reference_type;
- typedef Ptr pointer_type;
-
- typedef ThisType MapType;
- typedef iterator_base<value_type, reference_type, pointer_type, Iterator, Map> \
IteratorType; + typedef typename EntryListType::iterator iterator;
+ typedef typename EntryListType::const_iterator const_iterator;
- typedef iterator_base<value_type, value_type&, value_type*, EntryListIterator, \
MapType> iterator;
-
- iterator_base(
- Map& map,
- Iterator bucketPos) :
- m_map(&map),
- m_bucketPos(bucketPos)
- {
- }
-
- iterator_base(const iterator& theRhs) :
- m_map(theRhs.m_map),
- m_bucketPos(theRhs.m_bucketPos)
- {
- }
-
- const IteratorType & operator=(const IteratorType& theRhs)
- {
- m_map = theRhs.m_map;
- m_bucketPos = theRhs.m_bucketPos;
- return *this;
- }
-
- reference_type operator*() const
- {
- return *m_bucketPos;
- }
-
- int operator!=(const IteratorType& theRhs) const
- {
- return !operator==(theRhs);
- }
-
- int operator==(const IteratorType& theRhs) const
- {
- return (theRhs.m_map == m_map)
- && (theRhs.m_bucketPos == m_bucketPos);
- }
-
- IteratorType& operator++()
- {
- m_bucketPos++;
- return *this;
- }
-
- Map* m_map;
- Iterator m_bucketPos;
- };
-
- typedef iterator_base<
- value_type,
- value_type&,
- value_type*,
- EntryListIterator,
- ThisType> iterator;
-
- typedef iterator_base<
- value_type,
- const value_type&,
- const value_type*,
- EntryListConstIterator,
- const ThisType> const_iterator;
+ typedef XalanVector<typename EntryListType::iterator> EntryPosVectorType;
XalanMap(
+ MemoryManagerType* theMemoryManager = 0,
float loadFactor = 0.75,
- size_type minBuckets = 10,
- MemoryManagerType* theMemoryManager = 0) :
+ size_type minBuckets = 10) :
m_memoryManager(theMemoryManager),
m_loadFactor(loadFactor),
m_minBuckets(minBuckets),
m_size(0),
- m_entries(/* m_memoryManager */),
- m_buckets(m_memoryManager),
- m_freeList()
+ m_entries(m_memoryManager),
+ m_buckets(m_memoryManager)
{
}
- XalanMap(const XalanMap &theRhs) :
- m_memoryManager(theRhs.m_memoryManager),
+ XalanMap(
+ const XalanMap &theRhs,
+ MemoryManagerType* theManager = 0) :
+ m_memoryManager(theManager != 0 ? theManager : theRhs.m_memoryManager),
m_loadFactor(theRhs.m_loadFactor),
m_minBuckets(10),
m_size(0),
- m_entries(/* m_memoryManager */),
- m_buckets(size_type(m_loadFactor * theRhs.size())+ 1, m_entries.end(), \
m_memoryManager),
- m_freeList()
+ m_entries(m_memoryManager),
+ m_buckets(size_type(m_loadFactor * theRhs.size())+ 1, m_entries.end(), \
m_memoryManager) {
const_iterator entry = theRhs.begin();
while(entry != theRhs.end())
@@ -244,7 +190,6 @@
return *this;
}
-
size_type size() const
{
return m_size;
@@ -256,22 +201,22 @@
iterator begin()
{
- return iterator(*this, m_entries.begin());
+ return m_entries.begin();
}
const_iterator begin() const
{
- return const_iterator(*this, m_entries.begin());
+ return m_entries.begin();
}
iterator end()
{
- return iterator(*this, m_entries.end());
+ return m_entries.end();
}
const_iterator end() const
{
- return const_iterator(*this, m_entries.end());
+ return m_entries.end();
}
iterator find(const key_type& key)
@@ -280,14 +225,14 @@
{
size_type index = doHash(key);
- EntryListIterator bucketPos = m_buckets[index];
+ iterator bucketPos = m_buckets[index];
while (bucketPos != m_entries.end() &&
bucketPos->bucketIndex == index)
{
if (m_equals(key,bucketPos->first))
{
- return iterator(*this,bucketPos);
+ return bucketPos;
}
++bucketPos;
}
@@ -298,7 +243,7 @@
const_iterator find(const key_type& key) const
{
- return const_cast<ThisType *>(this)->find(key);
+ return const_cast<XalanMap *>(this)->find(key);
}
data_type & operator[](const key_type& key)
@@ -331,7 +276,7 @@
{
if (pos != end())
{
- doRemoveEntry(pos.m_bucketPos);
+ doRemoveEntry(pos);
}
}
@@ -351,14 +296,10 @@
m_buckets.end(),
m_entries.end());
- m_freeList.splice(
- m_freeList.begin(),
- m_entries,
- m_entries.begin(),
- m_entries.end());
+ m_entries.clear();
}
- void swap(ThisType& theRhs)
+ void swap(XalanMap& theRhs)
{
size_type tempSize = m_size;
m_size = theRhs.m_size;
@@ -370,19 +311,19 @@
m_entries.swap(theRhs.m_entries);
m_buckets.swap(theRhs.m_buckets);
- m_freeList.swap(theRhs.m_freeList);
-
}
protected:
iterator doCreateEntry(const key_type & key, const data_type& data)
{
+ // if there are no buckets, create initial minimum set of buckets
if (m_buckets.empty())
{
m_buckets.insert(m_buckets.begin(), m_minBuckets, m_entries.end());
}
+ // if the load factor has been reached, rehash
if (size_type(m_loadFactor * size()) > m_buckets.size())
{
rehash();
@@ -390,39 +331,23 @@
size_type index = doHash(key);
- EntryListIterator & bucketStartPos = m_buckets[index];
-
- if (m_freeList.empty() == true)
- {
- Entry newEntry = Entry(key, data, index);
-
- if (bucketStartPos == m_entries.end())
- {
- bucketStartPos = m_entries.insert(m_entries.end(), newEntry);
- }
- else
- {
- bucketStartPos = m_entries.insert(bucketStartPos, newEntry);
- }
- }
- else
- {
- (*m_freeList.begin()).~Entry();
- new (&*m_freeList.begin()) Entry(key, data, index);
-
- m_entries.splice(bucketStartPos, m_freeList, m_freeList.begin());
- --bucketStartPos;
- }
+ iterator & bucketStartPos = m_buckets[index];
+ // insert a new entry as the first position in the bucket
+ bucketStartPos = m_entries.insert(bucketStartPos, Entry(value_type(key, data), \
index)); +
++m_size;
- return iterator(*this, bucketStartPos);
+ return bucketStartPos;
}
- void doRemoveEntry(const EntryListIterator & toRemovePos)
+ void doRemoveEntry(const iterator & toRemovePos)
{
size_type index = toRemovePos->bucketIndex;
- EntryListIterator nextPos = ++(EntryListIterator(toRemovePos));
+ iterator nextPos = ++(iterator(toRemovePos));
+ // if the entry to remove is the first in the bucket
+ // set the next entry as the first or,
+ // if there are no more entries set it to the end
if (m_buckets[index] == toRemovePos)
{
if (nextPos->bucketIndex == index)
@@ -435,7 +360,7 @@
}
}
- m_freeList.splice(m_freeList.begin(), m_entries, toRemovePos, nextPos);
+ m_entries.erase(toRemovePos);
--m_size;
}
@@ -446,20 +371,25 @@
void rehash()
{
+ // grow the number of buckets by 60%
EntryPosVectorType temp(size_type(1.6 * size()), m_entries.end(), \
m_memoryManager); m_buckets.swap(temp);
+ // move current entries into a temporary list
EntryListType tempEntryList;
tempEntryList.splice(tempEntryList.begin(),m_entries, m_entries.begin(), \
m_entries.end());
-
+ // rehash each entry assign to bucket and insert into list
while (tempEntryList.begin() != tempEntryList.end())
{
- EntryListIterator entry = tempEntryList.begin();
+ iterator entry = tempEntryList.begin();
entry->bucketIndex = doHash(entry->first);
- EntryListIterator & bucketStartPos = m_buckets[entry->bucketIndex];
+ iterator & bucketStartPos = m_buckets[entry->bucketIndex];
+ // if the bucket is empty assign to the entry and insert
+ // into the list, otherwise insert into front of the
+ // current first entry
if (bucketStartPos == m_entries.end())
{
bucketStartPos = entry;
@@ -474,23 +404,21 @@
}
// Data members...
- Hash m_hash;
-
- Comparator m_equals;
-
- MemoryManagerType* m_memoryManager;
+ typename KeyTraits::Hasher m_hash;
+
+ typename KeyTraits::Comparator m_equals;
- float m_loadFactor;
+ MemoryManagerType* m_memoryManager;
- size_type m_minBuckets;
+ float m_loadFactor;
- size_type m_size;
+ size_type m_minBuckets;
- EntryListType m_entries;
+ size_type m_size;
- EntryPosVectorType m_buckets;
+ EntryListType m_entries;
- EntryListType m_freeList;
+ EntryPosVectorType m_buckets;
};
1.8 +25 -17 xml-xalan/c/src/xalanc/PlatformSupport/DOMStringHelper.hpp
Index: DOMStringHelper.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/PlatformSupport/DOMStringHelper.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- DOMStringHelper.hpp 31 Aug 2004 14:20:26 -0000 1.7
+++ DOMStringHelper.hpp 17 Sep 2004 22:23:10 -0000 1.8
@@ -35,6 +35,8 @@
#include <xalanc/Include/XalanVector.hpp>
+#include <xalanc/Include/XalanMap.hpp>
+#include <xalanc/Include/STLHelper.hpp>
@@ -2544,33 +2546,30 @@
* @param theKey XalanDOMString to be hashed
* @return hash value for XalanDOMString
*/
-#if defined(XALAN_NO_STD_NAMESPACE)
-struct DOMStringHashFunction : public unary_function<const XalanDOMString&, \
size_t>
-#else
-struct DOMStringHashFunction : public std::unary_function<const XalanDOMString&, \
size_t>
-#endif
+struct DOMStringHashFunction : public XALAN_STD_QUALIFIER unary_function<const \
XalanDOMString&, size_t> {
result_type
operator() (argument_type theKey) const
{
const XalanDOMChar* theRawBuffer = c_wstr(theKey);
- result_type theHashValue = 0;
-
- if (theRawBuffer != 0)
- {
- while (*theRawBuffer)
- {
- theHashValue = 5 * theHashValue + *theRawBuffer;
-
- theRawBuffer++;
- }
- }
+ hash_null_terminated_arrays<XalanDOMChar> hasher;
- return theHashValue++;
+ return hasher(theRawBuffer);
}
};
+
+
+template<>
+struct XalanMapKeyTraits<XalanDOMString>
+{
+ typedef DOMStringHashFunction Hasher;
+ typedef XALAN_STD_QUALIFIER equal_to<XalanDOMString> Comparator;
+};
+
+
+
/**
* Hash functor for DOMStrings
*
@@ -2585,6 +2584,15 @@
assert (theKey != 0);
return DOMStringHashFunction()(*theKey);
}
+};
+
+
+
+template<>
+struct XalanMapKeyTraits<XalanDOMString*>
+{
+ typedef DOMStringPointerHashFunction Hasher;
+ typedef pointer_equal<XalanDOMString> Comparator;
};
1.7 +3 -3 xml-xalan/c/src/xalanc/XPath/XPathEnvSupportDefault.hpp
Index: XPathEnvSupportDefault.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XPath/XPathEnvSupportDefault.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XPathEnvSupportDefault.hpp 31 Aug 2004 14:20:27 -0000 1.6
+++ XPathEnvSupportDefault.hpp 17 Sep 2004 22:23:10 -0000 1.7
@@ -45,9 +45,9 @@
{
public:
- typedef XalanMap<XalanDOMString, XalanDocument*, \
DOMStringHashFunction> SourceDocsTableType;
- typedef XalanMap<XalanDOMString, const Function*, \
DOMStringHashFunction> FunctionTableType;
- typedef XalanMap<XalanDOMString, FunctionTableType, \
DOMStringHashFunction> NamespaceFunctionTablesType; + typedef \
XalanMap<XalanDOMString, XalanDocument*> SourceDocsTableType; + typedef \
XalanMap<XalanDOMString, const Function*> FunctionTableType; + typedef \
XalanMap<XalanDOMString, FunctionTableType> NamespaceFunctionTablesType;
/**
* Perform initialization of statics -- must be called before any
1.8 +1 -2 xml-xalan/c/src/xalanc/XPath/XPathProcessorImpl.hpp
Index: XPathProcessorImpl.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XPath/XPathProcessorImpl.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- XPathProcessorImpl.hpp 31 Aug 2004 14:20:27 -0000 1.7
+++ XPathProcessorImpl.hpp 17 Sep 2004 22:23:10 -0000 1.8
@@ -63,8 +63,7 @@
public:
typedef XalanMap<XalanDOMString,
- const XalanDOMString*,
- DOMStringHashFunction> StringToStringMapType;
+ const XalanDOMString*> StringToStringMapType;
typedef XalanVector<bool> BoolVectorType;
1.7 +19 -0 xml-xalan/c/src/xalanc/XPath/XalanQName.hpp
Index: XalanQName.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XPath/XalanQName.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XalanQName.hpp 31 Aug 2004 14:20:27 -0000 1.6
+++ XalanQName.hpp 17 Sep 2004 22:23:10 -0000 1.7
@@ -27,6 +27,11 @@
+#include <xalanc/Include/XalanMap.hpp>
+#include <xalanc/Include/STLHelper.hpp>
+
+
+
#include <xalanc/XalanDOM/XalanDOMString.hpp>
@@ -420,6 +425,20 @@
return false;
}
}
+
+template<>
+struct XalanMapKeyTraits<XalanQName>
+{
+ typedef XalanHashMemberReference<XalanQName> Hasher;
+ typedef XALAN_STD_QUALIFIER equal_to<XalanQName> Comparator;
+};
+
+template<>
+struct XalanMapKeyTraits<const XalanQName*>
+{
+ typedef XalanHashMemberPointer<XalanQName> Hasher;
+ typedef pointer_equal<XalanQName> Comparator;
+};
1.5 +7 -0 xml-xalan/c/src/xalanc/XPath/XalanQNameByReference.hpp
Index: XalanQNameByReference.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XPath/XalanQNameByReference.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XalanQNameByReference.hpp 26 Feb 2004 22:40:35 -0000 1.4
+++ XalanQNameByReference.hpp 17 Sep 2004 22:23:10 -0000 1.5
@@ -133,6 +133,13 @@
+template<>
+struct XalanMapKeyTraits<XalanQNameByReference> : public \
XalanMapKeyTraits<XalanQName> +{
+};
+
+
+
XALAN_CPP_NAMESPACE_END
1.7 +6 -13 xml-xalan/c/src/xalanc/XSLT/KeyTable.hpp
Index: KeyTable.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/KeyTable.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- KeyTable.hpp 31 Aug 2004 14:20:27 -0000 1.6
+++ KeyTable.hpp 17 Sep 2004 22:23:10 -0000 1.7
@@ -65,6 +65,9 @@
* root of the current context. It contains a table of name mappings
* to tables that contain mappings of identifier values to nodes.
*/
+
+
+
class KeyTable
{
public:
@@ -72,20 +75,10 @@
typedef XalanVector<KeyDeclaration> KeyDeclarationVectorType;
typedef XalanMap<XalanDOMString,
- MutableNodeRefList,
- DOMStringHashFunction> NodeListMapType;
-
-
+ MutableNodeRefList> NodeListMapType;
typedef XalanMap<XalanQNameByReference,
- NodeListMapType,
- XalanHashMemberReference<XalanQNameByReference> > KeysMapType;
-
-
-
- /*typedef std::map<XalanQNameByReference,
- NodeListMapType
- > KeysMapType;*/
+ NodeListMapType > KeysMapType;
/**
* Build a keys table.
1.9 +1 -3 xml-xalan/c/src/xalanc/XSLT/NamespacesHandler.hpp
Index: NamespacesHandler.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/NamespacesHandler.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- NamespacesHandler.hpp 31 Aug 2004 14:20:27 -0000 1.8
+++ NamespacesHandler.hpp 17 Sep 2004 22:23:10 -0000 1.9
@@ -200,9 +200,7 @@
typedef XalanVector<const XalanDOMString*> XalanDOMStringPointerVectorType;
typedef XalanMap<const XalanDOMString*,
- const XalanDOMString*,
- DOMStringPointerHashFunction,
- DOMStringPointerEqualToFunction> NamespaceAliasesMapType;
+ const XalanDOMString*> NamespaceAliasesMapType;
/**
1.13 +4 -10 xml-xalan/c/src/xalanc/XSLT/Stylesheet.hpp
Index: Stylesheet.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/Stylesheet.hpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- Stylesheet.hpp 31 Aug 2004 14:20:27 -0000 1.12
+++ Stylesheet.hpp 17 Sep 2004 22:23:10 -0000 1.13
@@ -99,20 +99,14 @@
typedef XalanVector<XalanSpaceNodeTester> WhitespaceElementsVectorType;
typedef XalanVector<const XalanMatchPatternData*> PatternTableVectorType;
- typedef XalanMap<XalanDOMString,
- ExtensionNSHandler*,
- DOMStringHashFunction> ExtensionNamespacesMapType;
+ typedef XalanMap<XalanDOMString, \
ExtensionNSHandler*> ExtensionNamespacesMapType;
typedef XalanMap<XalanQNameByReference,
- const ElemTemplate*,
- XalanHashMemberReference<XalanQNameByReference> > ElemTemplateMapType;
+ const ElemTemplate* > ElemTemplateMapType;
- typedef XalanMap<const XalanNode*,
- KeyTable* > KeyTablesTableType;
+ typedef XalanMap<const XalanNode*, KeyTable* > KeyTablesTableType;
- typedef XalanMap<XalanDOMString,
- PatternTableVectorType,
- DOMStringHashFunction> PatternTableMapType;
+ typedef XalanMap<XalanDOMString, PatternTableVectorType> PatternTableMapType;
/**
* Constructor for a Stylesheet needs a Document.
1.29 +1 -3 \
xml-xalan/c/src/xalanc/XSLT/StylesheetExecutionContextDefault.hpp
Index: StylesheetExecutionContextDefault.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/StylesheetExecutionContextDefault.hpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- StylesheetExecutionContextDefault.hpp 31 Aug 2004 14:20:27 -0000 1.28
+++ StylesheetExecutionContextDefault.hpp 17 Sep 2004 22:23:10 -0000 1.29
@@ -94,9 +94,7 @@
typedef XALAN_STD_QUALIFIER set<const KeyDeclaration*,
XALAN_STD_QUALIFIER less<const KeyDeclaration*> > KeyDeclarationSetType;
typedef XALAN_STD_QUALIFIER pair<const XPath*, ClockType> XPathCacheEntry;
- typedef XalanMap <XalanDOMString,
- XPathCacheEntry,
- DOMStringHashFunction> XPathCacheMapType;
+ typedef XalanMap <XalanDOMString, XPathCacheEntry> XPathCacheMapType;
typedef XALAN_STD_QUALIFIER deque<const \
ElemTemplate*> CurrentTemplateStackType;
typedef Stylesheet::KeyTablesTableType KeyTablesTableType;
1.12 +6 -3 xml-xalan/c/src/xalanc/XSLT/StylesheetRoot.hpp
Index: StylesheetRoot.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/StylesheetRoot.hpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- StylesheetRoot.hpp 31 Aug 2004 14:20:27 -0000 1.11
+++ StylesheetRoot.hpp 17 Sep 2004 22:23:10 -0000 1.12
@@ -27,6 +27,11 @@
+#include <xalanc/Include/XalanMap.hpp>
+#include <xalanc/Include/STLHelper.hpp>
+
+
+
#include <xalanc/XalanDOM/XalanDOMString.hpp>
@@ -59,9 +64,7 @@
typedef XalanVector<ElemAttributeSet*> AttributeSetVectorType;
typedef XalanMap<const XalanQName*,
- AttributeSetVectorType,
- XalanHashMemberPointer<XalanQName>,
- pointer_equal<const XalanQName> > AttributeSetMapType;
+ AttributeSetVectorType> AttributeSetMapType;
/**
* Construct a Stylesheet from a Document.
1.7 +2 -5 \
xml-xalan/c/src/xalanc/XalanSourceTree/XalanSourceTreeDocument.hpp
Index: XalanSourceTreeDocument.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XalanSourceTree/XalanSourceTreeDocument.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XalanSourceTreeDocument.hpp 31 Aug 2004 14:20:28 -0000 1.6
+++ XalanSourceTreeDocument.hpp 17 Sep 2004 22:23:10 -0000 1.7
@@ -82,14 +82,11 @@
typedef XalanMap<
const XalanDOMChar*,
- XalanSourceTreeElement*,
- hash_null_terminated_arrays<XalanDOMChar>,
- equal_null_terminated_arrays<XalanDOMChar> > ElementByIDMapType;
+ XalanSourceTreeElement*> ElementByIDMapType;
typedef XalanMap<
XalanDOMString,
- XalanDOMString,
- DOMStringHashFunction> UnparsedEntityURIMapType;
+ XalanDOMString> UnparsedEntityURIMapType;
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic