dbertoni 2005/05/04 18:12:25
Modified: c/src/xercesc/util/regx ASCIIRangeFactory.cpp
BlockRangeFactory.cpp RangeToken.cpp RangeToken.hpp
RegularExpression.cpp UnicodeRangeFactory.cpp
XMLRangeFactory.cpp
Log:
Fix for Jira issue XERCESC-1391.
Revision Changes Path
1.7 +32 -0 xml-xerces/c/src/xercesc/util/regx/ASCIIRangeFactory.cpp
Index: ASCIIRangeFactory.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/regx/ASCIIRangeFactory.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ASCIIRangeFactory.cpp 12 Nov 2004 23:24:58 -0000 1.6
+++ ASCIIRangeFactory.cpp 5 May 2005 01:12:24 -0000 1.7
@@ -16,6 +16,9 @@
/*
* $Log$
+ * Revision 1.7 2005/05/05 01:12:24 dbertoni
+ * Fix for Jira issue XERCESC-1391.
+ *
* Revision 1.6 2004/11/12 23:24:58 knoaman
* Fix multi threading problem.
*
@@ -100,17 +103,33 @@
tok->addRange(chFF, chFF);
tok->addRange(chCR, chCR);
tok->addRange(chSpace, chSpace);
+
+ // Build the internal map.
+ tok->createMap();
+
rangeTokMap->setRangeToken(fgASCIISpace, tok);
tok = (RangeToken*) RangeToken::complementRanges(tok, tokFactory);
+
+ // Build the internal map.
+ tok->createMap();
+
rangeTokMap->setRangeToken(fgASCIISpace, tok , true);
// Create digits ranges
tok = tokFactory->createRange();
tok->addRange(chDigit_0, chDigit_9);
+
+ // Build the internal map.
+ tok->createMap();
+
rangeTokMap->setRangeToken(fgASCIIDigit, tok);
tok = (RangeToken*) RangeToken::complementRanges(tok, tokFactory);
+
+ // Build the internal map.
+ tok->createMap();
+
rangeTokMap->setRangeToken(fgASCIIDigit, tok , true);
// Create word ranges
@@ -119,9 +138,13 @@
tok->addRange(chLatin_A, chLatin_Z);
tok->addRange(chUnderscore, chUnderscore);
tok->addRange(chLatin_a, chLatin_z);
+ // Build the internal map.
+ tok->createMap();
rangeTokMap->setRangeToken(fgASCIIWord, tok);
tok = (RangeToken*) RangeToken::complementRanges(tok, tokFactory);
+ // Build the internal map.
+ tok->createMap();
rangeTokMap->setRangeToken(fgASCIIWord, tok , true);
// Create xdigit ranges
@@ -129,17 +152,26 @@
tok->addRange(chDigit_0, chDigit_9);
tok->addRange(chLatin_A, chLatin_F);
tok->addRange(chLatin_a, chLatin_a);
+ // Build the internal map.
+ tok->createMap();
+
rangeTokMap->setRangeToken(fgASCIIXDigit, tok);
tok = (RangeToken*) RangeToken::complementRanges(tok, tokFactory);
+ // Build the internal map.
+ tok->createMap();
rangeTokMap->setRangeToken(fgASCIIXDigit, tok , true);
// Create ascii ranges
tok = tokFactory->createRange();
tok->addRange(0x00, 0x7F);
+ // Build the internal map.
+ tok->createMap();
rangeTokMap->setRangeToken(fgASCII, tok);
tok = (RangeToken*) RangeToken::complementRanges(tok, tokFactory);
+ // Build the internal map.
+ tok->createMap();
rangeTokMap->setRangeToken(fgASCII, tok , true);
fRangesCreated = true;
1.9 +8 -0 xml-xerces/c/src/xercesc/util/regx/BlockRangeFactory.cpp
Index: BlockRangeFactory.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/regx/BlockRangeFactory.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- BlockRangeFactory.cpp 12 Nov 2004 23:24:58 -0000 1.8
+++ BlockRangeFactory.cpp 5 May 2005 01:12:24 -0000 1.9
@@ -16,6 +16,9 @@
/*
* $Log$
+ * Revision 1.9 2005/05/05 01:12:24 dbertoni
+ * Fix for Jira issue XERCESC-1391.
+ *
* Revision 1.8 2004/11/12 23:24:58 knoaman
* Fix multi threading problem.
*
@@ -387,8 +390,13 @@
tok->addRange(0x100000, 0x10FFFD);
foundPrivate = true;
}
+
+ // Build the internal map.
+ tok->createMap();
rangeTokMap->setRangeToken(fgBlockNames[i], tok);
tok = (RangeToken*) RangeToken::complementRanges(tok, tokFactory);
+ // Build the internal map.
+ tok->createMap();
rangeTokMap->setRangeToken(fgBlockNames[i], tok , true);
}
1.11 +9 -3 xml-xerces/c/src/xercesc/util/regx/RangeToken.cpp
Index: RangeToken.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/regx/RangeToken.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- RangeToken.cpp 8 Sep 2004 13:56:47 -0000 1.10
+++ RangeToken.cpp 5 May 2005 01:12:24 -0000 1.11
@@ -16,6 +16,9 @@
/*
* $Log$
+ * Revision 1.11 2005/05/05 01:12:24 dbertoni
+ * Fix for Jira issue XERCESC-1391.
+ *
* Revision 1.10 2004/09/08 13:56:47 peiyongz
* Apache License Version 2.0
*
@@ -75,6 +78,8 @@
//
---------------------------------------------------------------------------
// Includes
//
---------------------------------------------------------------------------
+#include <assert.h>
+
#include <xercesc/util/regx/RangeToken.hpp>
#include <xercesc/util/regx/TokenFactory.hpp>
#include <xercesc/util/IllegalArgumentException.hpp>
@@ -572,8 +577,7 @@
//
---------------------------------------------------------------------------
bool RangeToken::match(const XMLInt32 ch) {
- if (fMap == 0)
- createMap();
+ createMap();
bool ret;
@@ -631,7 +635,9 @@
fMaxCount = newMax;
}
-void RangeToken::createMap() {
+void RangeToken::doCreateMap() {
+
+ assert(!fMap);
int asize = MAPSIZE/32;
fMap = (int*) fMemoryManager->allocate(asize * sizeof(int));//new
int[asize];
1.9 +20 -2 xml-xerces/c/src/xercesc/util/regx/RangeToken.hpp
Index: RangeToken.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/regx/RangeToken.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- RangeToken.hpp 8 Sep 2004 13:56:47 -0000 1.8
+++ RangeToken.hpp 5 May 2005 01:12:24 -0000 1.9
@@ -78,6 +78,13 @@
//
-----------------------------------------------------------------------
bool match(const XMLInt32 ch);
+ //
-----------------------------------------------------------------------
+ // Creates the map. This will happen automatically,
+ // necessary.
+ //
-----------------------------------------------------------------------
+ void
+ createMap();
+
private:
//
-----------------------------------------------------------------------
// Unimplemented constructors and operators
@@ -88,9 +95,10 @@
//
-----------------------------------------------------------------------
// Private Helper methods
//
-----------------------------------------------------------------------
- void createMap();
void expand(const unsigned int length);
+ void doCreateMap();
+
//
-----------------------------------------------------------------------
// Private data members
//
-----------------------------------------------------------------------
@@ -105,6 +113,16 @@
MemoryManager* fMemoryManager;
};
+
+inline void RangeToken::createMap()
+{
+ if (!fMap)
+ {
+ doCreateMap();
+ }
+}
+
+
XERCES_CPP_NAMESPACE_END
#endif
1.26 +5 -0 xml-xerces/c/src/xercesc/util/regx/RegularExpression.cpp
Index: RegularExpression.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/regx/RegularExpression.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- RegularExpression.cpp 5 Apr 2005 18:18:34 -0000 1.25
+++ RegularExpression.cpp 5 May 2005 01:12:24 -0000 1.26
@@ -16,6 +16,9 @@
/*
* $Log$
+ * Revision 1.26 2005/05/05 01:12:24 dbertoni
+ * Fix for Jira issue XERCESC-1391.
+ *
* Revision 1.25 2005/04/05 18:18:34 knoaman
* Performance: do not make a copy of the expression to match.
*
@@ -1553,6 +1556,8 @@
rangeTok->compactRanges();
fFirstChar = rangeTok;
}
+
+ rangeTok->createMap();
}
if (fOperations != 0 && fOperations->getNextOp() == 0 &&
1.8 +31 -3
xml-xerces/c/src/xercesc/util/regx/UnicodeRangeFactory.cpp
Index: UnicodeRangeFactory.cpp
===================================================================
RCS file:
/home/cvs/xml-xerces/c/src/xercesc/util/regx/UnicodeRangeFactory.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- UnicodeRangeFactory.cpp 12 Nov 2004 23:24:58 -0000 1.7
+++ UnicodeRangeFactory.cpp 5 May 2005 01:12:24 -0000 1.8
@@ -16,6 +16,9 @@
/*
* $Log$
+ * Revision 1.8 2005/05/05 01:12:24 dbertoni
+ * Fix for Jira issue XERCESC-1391.
+ *
* Revision 1.7 2004/11/12 23:24:58 knoaman
* Fix multi threading problem.
*
@@ -172,6 +175,8 @@
for (int k=0; k < UNICATEGSIZE; k++) {
tok = (RangeToken*) RangeToken::complementRanges(ranges[k],
tokFactory);
+ // build the internal map.
+ tok->createMap();
rangeTokMap->setRangeToken(uniCategNames[k], ranges[k]);
rangeTokMap->setRangeToken(uniCategNames[k], tok , true);
}
@@ -179,6 +184,8 @@
// Create all range
tok = tokFactory->createRange();
tok->addRange(0, Token::UTF16_MAX);
+ // build the internal map.
+ tok->createMap();
rangeTokMap->setRangeToken(fgUniAll, tok);
// Create alpha range
@@ -186,38 +193,59 @@
tok->mergeRanges(ranges[XMLUniCharacter::UPPERCASE_LETTER]);
tok->mergeRanges(ranges[XMLUniCharacter::LOWERCASE_LETTER]);
tok->mergeRanges(ranges[XMLUniCharacter::OTHER_LETTER]);
+ // build the internal map.
+ tok->createMap();
rangeTokMap->setRangeToken(fgUniIsAlpha, tok);
// Create alpha-num range
RangeToken* alnumTok = tokFactory->createRange();
alnumTok->mergeRanges(tok);
alnumTok->mergeRanges(ranges[XMLUniCharacter::DECIMAL_DIGIT_NUMBER]);
+ // build the internal map.
+ alnumTok->createMap();
rangeTokMap->setRangeToken(fgUniIsAlnum, alnumTok);
// Create word range
tok = tokFactory->createRange();
tok->mergeRanges(alnumTok);
tok->addRange(chUnderscore, chUnderscore);
+ // build the internal map.
+ tok->createMap();
rangeTokMap->setRangeToken(fgUniIsWord, tok);
tok = (RangeToken*) RangeToken::complementRanges(tok, tokFactory);
+ // build the internal map.
+ tok->createMap();
rangeTokMap->setRangeToken(fgUniIsWord, tok , true);
// Create assigned range
- tok = ranges[XMLUniCharacter::UNASSIGNED];
-
rangeTokMap->setRangeToken(fgUniAssigned,(RangeToken*)RangeToken::complementRanges(tok,
- tokFactory, tokFactory->getMemoryManager()));
+ tok = (RangeToken*)RangeToken::complementRanges(
+ ranges[XMLUniCharacter::UNASSIGNED],
+ tokFactory,
+ tokFactory->getMemoryManager());
+ // build the internal map.
+ tok->createMap();
+ rangeTokMap->setRangeToken(fgUniAssigned,tok);
// Create space range
tok = tokFactory->createRange();
tok->mergeRanges(ranges[XMLUniCharacter::SPACE_SEPARATOR]);
tok->mergeRanges(ranges[XMLUniCharacter::LINE_SEPARATOR]);
//tok->mergeRanges(ranges[XMLUniCharacter::PARAGRAPH_SEPARATOR]);
+ // build the internal map.
+ tok->createMap();
rangeTokMap->setRangeToken(fgUniIsSpace, tok);
tok = (RangeToken*) RangeToken::complementRanges(tok, tokFactory);
+ // build the internal map.
+ tok->createMap();
rangeTokMap->setRangeToken(fgUniIsSpace, tok , true);
+ // build the internal maps.
+ for (int i=0; i < UNICATEGSIZE; i++) {
+ ranges[i]->createMap();
+ }
+
fRangesCreated = true;
}
1.9 +23 -0 xml-xerces/c/src/xercesc/util/regx/XMLRangeFactory.cpp
Index: XMLRangeFactory.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/regx/XMLRangeFactory.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- XMLRangeFactory.cpp 12 Nov 2004 23:24:58 -0000 1.8
+++ XMLRangeFactory.cpp 5 May 2005 01:12:24 -0000 1.9
@@ -16,6 +16,9 @@
/*
* $Log$
+ * Revision 1.9 2005/05/05 01:12:24 dbertoni
+ * Fix for Jira issue XERCESC-1391.
+ *
* Revision 1.8 2004/11/12 23:24:58 knoaman
* Fix multi threading problem.
*
@@ -150,9 +153,13 @@
tok->setRangeValues(wsRange, wsTblLen);
setupRange(wsRange, gWhitespaceChars, 0);
+ // Build the internal map.
+ tok->createMap();
rangeTokMap->setRangeToken(fgXMLSpace, tok);
tok = (RangeToken*) RangeToken::complementRanges(tok, tokFactory);
+ // Build the internal map.
+ tok->createMap();
rangeTokMap->setRangeToken(fgXMLSpace, tok , true);
// Create digits ranges
@@ -165,9 +172,13 @@
tok->setRangeValues(digitRange, digitTblLen);
setupRange(digitRange, gDigitChars, 0);
+ // Build the internal map.
+ tok->createMap();
rangeTokMap->setRangeToken(fgXMLDigit, tok);
tok = (RangeToken*) RangeToken::complementRanges(tok, tokFactory);
+ // Build the internal map.
+ tok->createMap();
rangeTokMap->setRangeToken(fgXMLDigit, tok , true);
// Build word ranges
@@ -208,9 +219,13 @@
nameRange[nameTblLen++] = chUnderscore;
tok->sortRanges();
tok->compactRanges();
+ // Build the internal map.
+ tok->createMap();
rangeTokMap->setRangeToken(fgXMLNameChar, tok);
tok = (RangeToken*) RangeToken::complementRanges(tok, tokFactory);
+ // Build the internal map.
+ tok->createMap();
rangeTokMap->setRangeToken(fgXMLNameChar, tok , true);
// Create initialNameChar ranges
@@ -229,9 +244,13 @@
initialNameRange[initialNameTblLen++] = chUnderscore;
tok->sortRanges();
tok->compactRanges();
+ // Build the internal map.
+ tok->createMap();
rangeTokMap->setRangeToken(fgXMLInitialNameChar, tok);
tok = (RangeToken*) RangeToken::complementRanges(tok, tokFactory);
+ // Build the internal map.
+ tok->createMap();
rangeTokMap->setRangeToken(fgXMLInitialNameChar, tok , true);
// Create word range
@@ -240,9 +259,13 @@
janWordRange.orphan();
tok->sortRanges();
tok->compactRanges();
+ // Build the internal map.
+ tok->createMap();
rangeTokMap->setRangeToken(fgXMLWord, tok);
tok = (RangeToken*) RangeToken::complementRanges(tok, tokFactory);
+ // Build the internal map.
+ tok->createMap();
rangeTokMap->setRangeToken(fgXMLWord, tok , true);
fRangesCreated = true;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]