You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by kn...@apache.org on 2003/05/15 20:42:57 UTC

cvs commit: xml-xerces/c/src/xercesc/util/regx BMPattern.cpp BMPattern.hpp Match.hpp Op.hpp OpFactory.cpp OpFactory.hpp ParserForXMLSchema.cpp ParserForXMLSchema.hpp RangeFactory.hpp RangeTokenMap.hpp RegularExpression.cpp RegularExpression.hpp RegxParser.cpp RegxParser.hpp RegxUtil.cpp RegxUtil.hpp Token.hpp TokenFactory.hpp

knoaman     2003/05/15 11:42:56

  Modified:    c/src/xercesc/util/regx BMPattern.cpp BMPattern.hpp
                        Match.hpp Op.hpp OpFactory.cpp OpFactory.hpp
                        ParserForXMLSchema.cpp ParserForXMLSchema.hpp
                        RangeFactory.hpp RangeTokenMap.hpp
                        RegularExpression.cpp RegularExpression.hpp
                        RegxParser.cpp RegxParser.hpp RegxUtil.cpp
                        RegxUtil.hpp Token.hpp TokenFactory.hpp
  Log:
  Partial implementation of the configurable memory manager.
  
  Revision  Changes    Path
  1.3       +45 -20    xml-xerces/c/src/xercesc/util/regx/BMPattern.cpp
  
  Index: BMPattern.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/regx/BMPattern.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BMPattern.cpp	4 Nov 2002 15:17:00 -0000	1.2
  +++ BMPattern.cpp	15 May 2003 18:42:54 -0000	1.3
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.3  2003/05/15 18:42:54  knoaman
  + * Partial implementation of the configurable memory manager.
  + *
    * Revision 1.2  2002/11/04 15:17:00  tng
    * C++ Namespace Support.
    *
  @@ -76,20 +79,26 @@
   #include <xercesc/util/regx/BMPattern.hpp>
   #include <xercesc/util/XMLString.hpp>
   #include <xercesc/util/Janitor.hpp>
  +#include <xercesc/framework/MemoryManager.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
   // ---------------------------------------------------------------------------
   //  BMPattern: Constructors
   // ---------------------------------------------------------------------------
  -BMPattern::BMPattern(const XMLCh* const pattern, bool ignoreCase)
  -	:fPattern(XMLString::replicate(pattern)),
  -	 fUppercasePattern(0),
  -	 fIgnoreCase(ignoreCase),
  -	 fShiftTable(0),
  -	 fShiftTableLen(256) {
  -
  +BMPattern::BMPattern( const XMLCh*         const pattern
  +                    ,       bool                 ignoreCase
  +                    ,       MemoryManager* const manager) :
  +
  +    fIgnoreCase(ignoreCase)
  +    , fShiftTableLen(256)
  +    , fShiftTable(0)
  +    , fPattern(0)
  +    , fUppercasePattern(0)
  +    , fMemoryManager(manager)
  +{
   	try {
  +        fPattern = XMLString::replicate(pattern, fMemoryManager);
   		initialize();
   	}
   	catch(...) {
  @@ -99,14 +108,20 @@
   	}
   }
   
  -BMPattern::BMPattern(const XMLCh* const pattern, int tableSize, bool ignoreCase)
  -	:fPattern(XMLString::replicate(pattern)),
  -	 fUppercasePattern(0),
  -	 fIgnoreCase(ignoreCase),
  -	 fShiftTable(0),
  -	 fShiftTableLen(tableSize) {
  -	
  +BMPattern::BMPattern( const XMLCh*         const pattern
  +                    ,       int                  tableSize
  +                    ,       bool                 ignoreCase
  +                    ,       MemoryManager* const manager) :
  +
  +    fIgnoreCase(ignoreCase)
  +    , fShiftTableLen(tableSize)
  +    , fShiftTable(0)
  +    , fPattern(0)
  +    , fUppercasePattern(0)
  +    , fMemoryManager(manager)
  +{
   	try {
  +        fPattern = XMLString::replicate(pattern, fMemoryManager);
   		initialize();
   	}
   	catch(...) {
  @@ -135,11 +150,11 @@
   
   	if (fIgnoreCase) {
   		
  -		ucContent = XMLString::replicate(content);
  +		ucContent = XMLString::replicate(content, fMemoryManager);
   		XMLString::upperCase(ucContent);
   	}
   
  -	ArrayJanitor<XMLCh> janUCContent(ucContent);
  +	ArrayJanitor<XMLCh> janUCContent(ucContent, fMemoryManager);
   
   	int index = start + patternLen;
   
  @@ -184,17 +199,17 @@
   	const unsigned int	patternLen = XMLString::stringLen(fPattern);
   	XMLCh* lowercasePattern = 0;
   
  -	fShiftTable = new int[fShiftTableLen];
  +	fShiftTable = (int*) fMemoryManager->allocate(fShiftTableLen*sizeof(int)); //new int[fShiftTableLen];
   
   	if (fIgnoreCase) {
   
  -		fUppercasePattern = XMLString::replicate(fPattern);
  -		lowercasePattern = XMLString::replicate(fPattern);
  +		fUppercasePattern = XMLString::replicate(fPattern, fMemoryManager);
  +		lowercasePattern = XMLString::replicate(fPattern, fMemoryManager);
   		XMLString::upperCase(fUppercasePattern);
   		XMLString::lowerCase(lowercasePattern);
   	}
   
  -	ArrayJanitor<XMLCh> janLowercase(lowercasePattern);
  +	ArrayJanitor<XMLCh> janLowercase(lowercasePattern, fMemoryManager);
   
   	for (unsigned int i=0; i< fShiftTableLen; i++)
   		fShiftTable[i] = patternLen;
  @@ -220,6 +235,16 @@
   			}
   		}
   	}
  +}
  +
  +// ---------------------------------------------------------------------------
  +//  BMPattern: Cleanup
  +// ---------------------------------------------------------------------------
  +void BMPattern::cleanUp() {
  +
  +    fMemoryManager->deallocate(fPattern);//delete [] fPattern;
  +    fMemoryManager->deallocate(fUppercasePattern);//delete [] fUppercasePattern;
  +    fMemoryManager->deallocate(fShiftTable);
   }
   
   XERCES_CPP_NAMESPACE_END
  
  
  
  1.4       +29 -21    xml-xerces/c/src/xercesc/util/regx/BMPattern.hpp
  
  Index: BMPattern.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/regx/BMPattern.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BMPattern.hpp	7 Mar 2003 18:13:58 -0000	1.3
  +++ BMPattern.hpp	15 May 2003 18:42:54 -0000	1.4
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -63,11 +63,13 @@
   // ---------------------------------------------------------------------------
   //  Includes
   // ---------------------------------------------------------------------------
  -#include <xercesc/util/XercesDefs.hpp>
  +#include <xercesc/util/XMemory.hpp>
  +#include <xercesc/util/PlatformUtils.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  -class XMLUTIL_EXPORT BMPattern {
  +class XMLUTIL_EXPORT BMPattern : public XMemory
  +{
   public:
   	// -----------------------------------------------------------------------
   	//  Public Constructors and Destructor
  @@ -83,8 +85,15 @@
         *
         * @param  ignoreCase  A flag to indicate whether to ignore case
   	  *						matching or not.
  +      *
  +      * @param  manager     The configurable memory manager
         */
  -	BMPattern(const XMLCh* const pattern, bool ignoreCase);
  +	BMPattern
  +    (
  +        const XMLCh* const pattern
  +        , bool ignoreCase
  +        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
  +    );
   
   	/**
         * This is the constructor which takes all of the information
  @@ -96,8 +105,16 @@
   	  *
         * @param  ignoreCase  A flag to indicate whether to ignore case
   	  *						matching or not.
  +      *
  +      * @param  manager     The configurable memory manager
         */
  -	BMPattern(const XMLCh* const pattern, int tableSize, bool ignoreCase);
  +	BMPattern
  +    (
  +        const XMLCh* const pattern
  +        , int tableSize
  +        , bool ignoreCase
  +        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
  +    );
   
   	//@}
   
  @@ -160,22 +177,13 @@
       //      This is a table of offsets for shifting purposes used by the BM
   	//		search algorithm, and its length.
       // -----------------------------------------------------------------------
  -	XMLCh*			fPattern;
  -	XMLCh*			fUppercasePattern;
  -	bool			fIgnoreCase;
  -	int*			fShiftTable;
  -	unsigned int	fShiftTableLen;
  +	bool           fIgnoreCase;
  +	unsigned int   fShiftTableLen;
  +	int*           fShiftTable;
  +	XMLCh*         fPattern;
  +	XMLCh*         fUppercasePattern;
  +    MemoryManager* fMemoryManager; 
   };
  -
  -// ---------------------------------------------------------------------------
  -//  BMPattern: Cleanup
  -// ---------------------------------------------------------------------------
  -inline void BMPattern::cleanUp() {
  -
  -	delete [] fPattern;
  -	delete [] fUppercasePattern;
  -	delete [] fShiftTable;
  -}
   
   XERCES_CPP_NAMESPACE_END
   
  
  
  
  1.4       +3 -2      xml-xerces/c/src/xercesc/util/regx/Match.hpp
  
  Index: Match.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/regx/Match.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Match.hpp	18 Dec 2002 13:01:02 -0000	1.3
  +++ Match.hpp	15 May 2003 18:42:54 -0000	1.4
  @@ -72,7 +72,8 @@
   /**
     * An instance of this class has ranges captured in matching
     */
  -class XMLUTIL_EXPORT Match {
  +  class XMLUTIL_EXPORT Match : public XMemory
  +{
   public:
   
   	// -----------------------------------------------------------------------
  
  
  
  1.6       +4 -4      xml-xerces/c/src/xercesc/util/regx/Op.hpp
  
  Index: Op.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/regx/Op.hpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Op.hpp	7 Mar 2003 18:13:58 -0000	1.5
  +++ Op.hpp	15 May 2003 18:42:54 -0000	1.6
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -64,7 +64,6 @@
   // ---------------------------------------------------------------------------
   //  Includes
   // ---------------------------------------------------------------------------
  -#include <xercesc/util/XercesDefs.hpp>
   #include <xercesc/util/RefVectorOf.hpp>
   #include <xercesc/util/RuntimeException.hpp>
   
  @@ -76,7 +75,8 @@
   class Token;
   
   
  -class XMLUTIL_EXPORT Op {
  +class XMLUTIL_EXPORT Op : public XMemory
  +{
   public:
   
       enum {
  
  
  
  1.4       +23 -17    xml-xerces/c/src/xercesc/util/regx/OpFactory.cpp
  
  Index: OpFactory.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/regx/OpFactory.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- OpFactory.cpp	4 Nov 2002 15:17:00 -0000	1.3
  +++ OpFactory.cpp	15 May 2003 18:42:54 -0000	1.4
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.4  2003/05/15 18:42:54  knoaman
  + * Partial implementation of the configurable memory manager.
  + *
    * Revision 1.3  2002/11/04 15:17:00  tng
    * C++ Namespace Support.
    *
  @@ -81,6 +84,7 @@
   // ---------------------------------------------------------------------------
   #include <xercesc/util/regx/OpFactory.hpp>
   #include <xercesc/util/regx/Op.hpp>
  +#include <xercesc/util/PlatformUtils.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  @@ -88,8 +92,10 @@
   //  OpFactory: Constructors and Destructor
   // ---------------------------------------------------------------------------
   OpFactory::OpFactory() :
  -    fOpVector(new RefVectorOf<Op>(16, true)) {
  -
  +    fOpVector(0)
  +    , fMemoryManager(XMLPlatformUtils::fgMemoryManager)
  +{
  +    fOpVector = new (fMemoryManager) RefVectorOf<Op>(16, true);
   }
   
   OpFactory::~OpFactory() {
  @@ -103,14 +109,14 @@
   // ---------------------------------------------------------------------------
   Op* OpFactory::createDotOp() {
   
  -	Op* tmpOp = new Op(Op::O_DOT);
  +	Op* tmpOp = new (fMemoryManager) Op(Op::O_DOT);
   	fOpVector->addElement(tmpOp);
   	return tmpOp;
   }
   
   CharOp* OpFactory::createCharOp(int data) {
   
  -	CharOp* tmpOp = new CharOp(Op::O_CHAR, data);
  +	CharOp* tmpOp = new (fMemoryManager) CharOp(Op::O_CHAR, data);
   
   	fOpVector->addElement(tmpOp);
   	return tmpOp;
  @@ -118,7 +124,7 @@
   
   CharOp* OpFactory::createAnchorOp(int data) {
   
  -	CharOp* tmpOp = new CharOp(Op::O_ANCHOR, data);
  +	CharOp* tmpOp = new (fMemoryManager) CharOp(Op::O_ANCHOR, data);
   
   	fOpVector->addElement(tmpOp);
   	return tmpOp;
  @@ -126,7 +132,7 @@
   
   CharOp* OpFactory::createCaptureOp(int number, const Op* const next) {
   
  -	CharOp* tmpOp = new CharOp(Op::O_CAPTURE, number);
  +	CharOp* tmpOp = new (fMemoryManager) CharOp(Op::O_CAPTURE, number);
   
   	tmpOp->setNextOp(next);
   	fOpVector->addElement(tmpOp);
  @@ -135,7 +141,7 @@
   
   UnionOp* OpFactory::createUnionOp(int size) {
   
  -	UnionOp* tmpOp = new UnionOp(Op::O_UNION, size);
  +	UnionOp* tmpOp = new (fMemoryManager) UnionOp(Op::O_UNION, size);
   
   	fOpVector->addElement(tmpOp);
   	return tmpOp;
  @@ -143,7 +149,7 @@
   
   ChildOp* OpFactory::createClosureOp(int id) {
   
  -	ModifierOp* tmpOp = new ModifierOp(Op::O_CLOSURE, id, -1);
  +	ModifierOp* tmpOp = new (fMemoryManager) ModifierOp(Op::O_CLOSURE, id, -1);
   
   	fOpVector->addElement(tmpOp);
   	return tmpOp;
  @@ -151,7 +157,7 @@
   
   ChildOp* OpFactory::createNonGreedyClosureOp() {
   
  -	ChildOp* tmpOp = new ChildOp(Op::O_NONGREEDYCLOSURE);
  +	ChildOp* tmpOp = new (fMemoryManager) ChildOp(Op::O_NONGREEDYCLOSURE);
   
   	fOpVector->addElement(tmpOp);
   	return tmpOp;
  @@ -159,7 +165,7 @@
   
   ChildOp* OpFactory::createQuestionOp(bool nonGreedy) {
   
  -	ChildOp* tmpOp = new ChildOp(nonGreedy ? Op::O_NONGREEDYQUESTION :
  +	ChildOp* tmpOp = new (fMemoryManager)  ChildOp(nonGreedy ? Op::O_NONGREEDYQUESTION :
   											 Op::O_QUESTION);
   
   	fOpVector->addElement(tmpOp);
  @@ -168,7 +174,7 @@
   
   RangeOp* OpFactory::createRangeOp(const Token* const token) {
   
  -	RangeOp* tmpOp = new RangeOp(Op::O_RANGE, token);
  +	RangeOp* tmpOp = new (fMemoryManager)  RangeOp(Op::O_RANGE, token);
   	
   	fOpVector->addElement(tmpOp);
   	return tmpOp;
  @@ -177,7 +183,7 @@
   ChildOp* OpFactory::createLookOp(const short type, const Op* const next,
   						         const Op* const branch) {
   
  -	ChildOp* tmpOp = new ChildOp(type);
  +	ChildOp* tmpOp = new (fMemoryManager) ChildOp(type);
   
   	tmpOp->setNextOp(next);
   	tmpOp->setChild(branch);
  @@ -187,7 +193,7 @@
   
   CharOp* OpFactory::createBackReferenceOp(int refNo) {
   
  -	CharOp* tmpOp = new CharOp(Op::O_BACKREFERENCE, refNo);
  +	CharOp* tmpOp = new (fMemoryManager) CharOp(Op::O_BACKREFERENCE, refNo);
   
   	fOpVector->addElement(tmpOp);
   	return tmpOp;
  @@ -195,7 +201,7 @@
   
   StringOp* OpFactory::createStringOp(const XMLCh* const literal) {
   
  -	StringOp* tmpOp = new StringOp(Op::O_STRING, literal);
  +	StringOp* tmpOp = new (fMemoryManager) StringOp(Op::O_STRING, literal);
   
   	fOpVector->addElement(tmpOp);
   	return tmpOp;
  @@ -204,7 +210,7 @@
   ChildOp* OpFactory::createIndependentOp(const Op* const next,
   							            const Op* const branch) {
   
  -	ChildOp* tmpOp = new ChildOp(Op::O_INDEPENDENT);
  +	ChildOp* tmpOp = new (fMemoryManager) ChildOp(Op::O_INDEPENDENT);
   
   	tmpOp->setNextOp(next);
   	tmpOp->setChild(branch);
  @@ -216,7 +222,7 @@
                                           const Op* const branch,
                                           const int add, const int mask) {
   
  -	ModifierOp* tmpOp = new ModifierOp(Op::O_MODIFIER, add, mask);
  +	ModifierOp* tmpOp = new (fMemoryManager) ModifierOp(Op::O_MODIFIER, add, mask);
   
   	tmpOp->setNextOp(next);
   	tmpOp->setChild(branch);
  @@ -228,7 +234,7 @@
   								          const Op* const yesFlow,
   								          const Op* const noFlow) {
   
  -	ConditionOp* tmpOp = new ConditionOp(Op::O_CONDITION, ref, conditionFlow,
  +	ConditionOp* tmpOp = new (fMemoryManager) ConditionOp(Op::O_CONDITION, ref, conditionFlow,
   										 yesFlow, noFlow);
   
   	tmpOp->setNextOp(next);
  
  
  
  1.4       +6 -5      xml-xerces/c/src/xercesc/util/regx/OpFactory.hpp
  
  Index: OpFactory.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/regx/OpFactory.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- OpFactory.hpp	7 Mar 2003 18:13:58 -0000	1.3
  +++ OpFactory.hpp	15 May 2003 18:42:54 -0000	1.4
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -64,7 +64,7 @@
   // ---------------------------------------------------------------------------
   //  Includes
   // ---------------------------------------------------------------------------
  -#include <xercesc/util/XMLUniDefs.hpp>
  +#include <xercesc/util/XMemory.hpp>
   #include <xercesc/util/RefVectorOf.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
  @@ -90,8 +90,8 @@
    * all associated Op objects will be deleted.
    */
   
  -class XMLUTIL_EXPORT OpFactory {
  -
  +class XMLUTIL_EXPORT OpFactory : public XMemory
  +{
   public:
   	// -----------------------------------------------------------------------
       //  Constructors and destructors
  @@ -146,6 +146,7 @@
       //      Contains Op objects. Used for memory cleanup.
       // -----------------------------------------------------------------------
       RefVectorOf<Op>* fOpVector;
  +    MemoryManager*   fMemoryManager;
   };
   
   // ---------------------------------------------------------------------------
  
  
  
  1.6       +6 -2      xml-xerces/c/src/xercesc/util/regx/ParserForXMLSchema.cpp
  
  Index: ParserForXMLSchema.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/regx/ParserForXMLSchema.cpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ParserForXMLSchema.cpp	18 Mar 2003 19:38:28 -0000	1.5
  +++ ParserForXMLSchema.cpp	15 May 2003 18:42:54 -0000	1.6
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.6  2003/05/15 18:42:54  knoaman
  + * Partial implementation of the configurable memory manager.
  + *
    * Revision 1.5  2003/03/18 19:38:28  knoaman
    * Schema Errata E2-18 + misc. regex fixes.
    *
  @@ -114,14 +117,15 @@
   #include <xercesc/util/regx/RegxDefs.hpp>
   #include <xercesc/util/ParseException.hpp>
   #include <xercesc/util/RuntimeException.hpp>
  +#include <xercesc/util/PlatformUtils.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
   // ---------------------------------------------------------------------------
   //  ParserForXMLSchema: Constructors and Destructors
   // ---------------------------------------------------------------------------
  -ParserForXMLSchema::ParserForXMLSchema()
  -    : RegxParser()
  +ParserForXMLSchema::ParserForXMLSchema(MemoryManager* const manager)
  +    : RegxParser(manager)
   {
   
   }
  
  
  
  1.4       +2 -2      xml-xerces/c/src/xercesc/util/regx/ParserForXMLSchema.hpp
  
  Index: ParserForXMLSchema.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/regx/ParserForXMLSchema.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ParserForXMLSchema.hpp	7 Mar 2003 18:13:58 -0000	1.3
  +++ ParserForXMLSchema.hpp	15 May 2003 18:42:54 -0000	1.4
  @@ -79,7 +79,7 @@
       // -----------------------------------------------------------------------
       //  Public Constructors and Destructor
       // -----------------------------------------------------------------------
  -    ParserForXMLSchema();
  +    ParserForXMLSchema(MemoryManager* const manager);
       ~ParserForXMLSchema();
   
       // -----------------------------------------------------------------------
  
  
  
  1.4       +5 -5      xml-xerces/c/src/xercesc/util/regx/RangeFactory.hpp
  
  Index: RangeFactory.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/regx/RangeFactory.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RangeFactory.hpp	7 Mar 2003 18:13:58 -0000	1.3
  +++ RangeFactory.hpp	15 May 2003 18:42:54 -0000	1.4
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -64,12 +64,12 @@
   // ---------------------------------------------------------------------------
   //  Includes
   // ---------------------------------------------------------------------------
  -#include <xercesc/util/XercesDefs.hpp>
  +#include <xercesc/util/XMemory.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  -class XMLUTIL_EXPORT RangeFactory {
  -
  +class XMLUTIL_EXPORT RangeFactory : public XMemory
  +{
   public:
       // -----------------------------------------------------------------------
       //  Constructors and destructors
  
  
  
  1.5       +8 -7      xml-xerces/c/src/xercesc/util/regx/RangeTokenMap.hpp
  
  Index: RangeTokenMap.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/regx/RangeTokenMap.hpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- RangeTokenMap.hpp	7 Mar 2003 18:13:58 -0000	1.4
  +++ RangeTokenMap.hpp	15 May 2003 18:42:54 -0000	1.5
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -64,8 +64,8 @@
   // ---------------------------------------------------------------------------
   //  Includes
   // ---------------------------------------------------------------------------
  -#include <xercesc/util/StringPool.hpp>
   #include <xercesc/util/Mutexes.hpp>
  +#include <xercesc/util/RefHashTableOf.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  @@ -75,9 +75,10 @@
   class RangeToken;
   class RangeFactory;
   class TokenFactory;
  +class XMLStringPool;
   
  -
  -class XMLUTIL_EXPORT RangeTokenElemMap {
  +class XMLUTIL_EXPORT RangeTokenElemMap : public XMemory
  +{
   
   public:
       RangeTokenElemMap(unsigned int categoryId);
  @@ -109,8 +110,8 @@
   };
   
   
  -class XMLUTIL_EXPORT RangeTokenMap {
  -
  +class XMLUTIL_EXPORT RangeTokenMap : public XMemory
  +{
   public:
       // -----------------------------------------------------------------------
       //  Putter methods
  
  
  
  1.8       +5 -1      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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- RegularExpression.cpp	12 May 2003 10:08:22 -0000	1.7
  +++ RegularExpression.cpp	15 May 2003 18:42:54 -0000	1.8
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.8  2003/05/15 18:42:54  knoaman
  + * Partial implementation of the configurable memory manager.
  + *
    * Revision 1.7  2003/05/12 10:08:22  gareth
    * The correct file this time.
    *
  @@ -119,6 +122,7 @@
   #include <xercesc/util/regx/ParserForXMLSchema.hpp>
   #include <xercesc/util/Janitor.hpp>
   #include <xercesc/util/ParseException.hpp>
  +#include <xercesc/util/IllegalArgumentException.hpp>
   #include <xercesc/framework/XMLBuffer.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
  @@ -357,7 +361,7 @@
   	fPattern = XMLString::replicate(pattern);
   
   	RegxParser* regxParser = isSet(fOptions, XMLSCHEMA_MODE)
  -		? new ParserForXMLSchema() : new RegxParser();
  +		? new ParserForXMLSchema(XMLPlatformUtils::fgMemoryManager) : new RegxParser(XMLPlatformUtils::fgMemoryManager);
   
       if (regxParser) {
           regxParser->setTokenFactory(fTokenFactory);
  
  
  
  1.7       +7 -10     xml-xerces/c/src/xercesc/util/regx/RegularExpression.hpp
  
  Index: RegularExpression.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/regx/RegularExpression.hpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- RegularExpression.hpp	7 Mar 2003 18:13:58 -0000	1.6
  +++ RegularExpression.hpp	15 May 2003 18:42:54 -0000	1.7
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -64,14 +64,13 @@
   // ---------------------------------------------------------------------------
   //  Includes
   // ---------------------------------------------------------------------------
  -#include <xercesc/util/XMLUniDefs.hpp>
   #include <xercesc/util/RefArrayVectorOf.hpp>
   #include <xercesc/util/XMLString.hpp>
  +#include <xercesc/util/Janitor.hpp>
  +#include <xercesc/util/Mutexes.hpp>
   #include <xercesc/util/regx/Op.hpp>
   #include <xercesc/util/regx/TokenFactory.hpp>
   #include <xercesc/util/regx/BMPattern.hpp>
  -#include <xercesc/util/Janitor.hpp>
  -#include <xercesc/util/Mutexes.hpp>
   #include <xercesc/util/regx/ModifierToken.hpp>
   #include <xercesc/util/regx/ConditionToken.hpp>
   #include <xercesc/util/regx/OpFactory.hpp>
  @@ -81,13 +80,11 @@
   // ---------------------------------------------------------------------------
   //  Forward Declaration
   // ---------------------------------------------------------------------------
  -class Token;
  -class BMPattern;
   class RangeToken;
   class Match;
  -class TokenFactory;
   
  -class XMLUTIL_EXPORT RegularExpression {
  +class XMLUTIL_EXPORT RegularExpression : public XMemory
  +{
   public:
       // -----------------------------------------------------------------------
       //  Public Constructors and Destructor
  @@ -168,7 +165,7 @@
       // -----------------------------------------------------------------------
       //  Private data types
       // -----------------------------------------------------------------------
  -    class XMLUTIL_EXPORT Context
  +    class XMLUTIL_EXPORT Context : public XMemory
       {
           public :
               Context();
  
  
  
  1.7       +30 -19    xml-xerces/c/src/xercesc/util/regx/RegxParser.cpp
  
  Index: RegxParser.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/regx/RegxParser.cpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- RegxParser.cpp	18 Mar 2003 19:38:28 -0000	1.6
  +++ RegxParser.cpp	15 May 2003 18:42:55 -0000	1.7
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.7  2003/05/15 18:42:55  knoaman
  + * Partial implementation of the configurable memory manager.
  + *
    * Revision 1.6  2003/03/18 19:38:28  knoaman
    * Schema Errata E2-18 + misc. regex fixes.
    *
  @@ -122,14 +125,13 @@
   //  Includes
   // ---------------------------------------------------------------------------
   #include <xercesc/util/regx/RegxParser.hpp>
  -#include <xercesc/util/PlatformUtils.hpp>
   #include <xercesc/util/XMLString.hpp>
  +#include <xercesc/util/ParseException.hpp>
   #include <xercesc/util/regx/RegularExpression.hpp>
   #include <xercesc/util/regx/RegxUtil.hpp>
   #include <xercesc/util/regx/RegxDefs.hpp>
   #include <xercesc/util/regx/TokenInc.hpp>
   #include <xercesc/framework/XMLErrorCodes.hpp>
  -#include <xercesc/util/ParseException.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  @@ -144,7 +146,7 @@
   //  RegxParser::ReferencePostion: Constructors and Destructor
   // ---------------------------------------------------------------------------
   RegxParser::ReferencePosition::ReferencePosition(const int refNo,
  -												 const int position)
  +						 const int position)
   	:fReferenceNo(refNo)
   	, fPosition(position)
   {
  @@ -154,8 +156,9 @@
   // ---------------------------------------------------------------------------
   //  RegxParser: Constructors and Destructors
   // ---------------------------------------------------------------------------
  -RegxParser::RegxParser()
  -    :fHasBackReferences(false),
  +RegxParser::RegxParser(MemoryManager* const manager)
  +    :fMemoryManager(manager),
  +     fHasBackReferences(false),
        fOptions(0),
        fOffset(0),
        fNoGroups(1),
  @@ -171,7 +174,7 @@
   
   RegxParser::~RegxParser() {
   
  -	delete [] fString;
  +	fMemoryManager->deallocate(fString);//delete [] fString;
   	delete fReferences;
   }
   
  @@ -193,13 +196,15 @@
   	fNoGroups = 1;
   	fHasBackReferences = false;
   	setParseContext(S_NORMAL);
  -	delete [] fString;
  -	fString = XMLString::replicate(regxStr);
  +	if (fString)
  +        fMemoryManager->deallocate(fString);//delete [] fString;
  +	fString = XMLString::replicate(regxStr, fMemoryManager);
   
   	if (isSet(RegularExpression::EXTENDED_COMMENT)) {
   
  -        delete [] fString;
  -		fString = RegxUtil::stripExtendedComment(regxStr);
  +        if (fString)
  +            fMemoryManager->deallocate(fString);//delete [] fString;
  +		fString = RegxUtil::stripExtendedComment(regxStr, fMemoryManager);
       }
   
       fStringLen = XMLString::stringLen(fString);
  @@ -648,10 +653,10 @@
           fHasBackReferences =  true;
   
           if (fReferences == 0) {
  -            this->fReferences = new RefVectorOf<ReferencePosition>(8, true);
  +            this->fReferences = new (fMemoryManager) RefVectorOf<ReferencePosition>(8, true);
           }
   
  -        fReferences->addElement(new ReferencePosition(refNo, fOffset));
  +        fReferences->addElement(new (fMemoryManager) ReferencePosition(refNo, fOffset));
           fOffset++;
   
           if (fString[fOffset] != chCloseParen)
  @@ -840,10 +845,10 @@
   
       fHasBackReferences = true;
       if (fReferences == 0) {
  -        fReferences = new RefVectorOf<ReferencePosition>(8, true);
  +        fReferences = new (fMemoryManager) RefVectorOf<ReferencePosition>(8, true);
       }
   
  -    fReferences->addElement(new ReferencePosition(refNo, fOffset - 2));
  +    fReferences->addElement(new (fMemoryManager) ReferencePosition(refNo, fOffset - 2));
       processNext();
       return tok;
   }
  @@ -1090,8 +1095,11 @@
           ThrowXML(ParseException,XMLExcepts::Parser_Atom3);
       
       fOffset = nameEnd + 1;
  -    XMLCh* rangeName = new XMLCh[(nameEnd - nameStart) + 1];
  -    ArrayJanitor<XMLCh> janRangeName(rangeName);
  +    XMLCh* rangeName = (XMLCh*) fMemoryManager->allocate
  +    (
  +        (nameEnd - nameStart + 1) * sizeof(XMLCh)
  +    );//new XMLCh[(nameEnd - nameStart) + 1];
  +    ArrayJanitor<XMLCh> janRangeName(rangeName, fMemoryManager);
       XMLString::subString(rangeName, fString, nameStart, nameEnd);
   
       return  fTokenFactory->getRange(rangeName, !(ch == chLatin_p));
  @@ -1199,8 +1207,11 @@
                   positive = false;
               }
   
  -			XMLCh* name = new XMLCh[(nameEnd - fOffset) + 1];
  -			ArrayJanitor<XMLCh> janName(name);
  +			XMLCh* name = (XMLCh*) fMemoryManager->allocate
  +            (
  +                (nameEnd - fOffset + 1) * sizeof(XMLCh)
  +            );//new XMLCh[(nameEnd - fOffset) + 1];
  +			ArrayJanitor<XMLCh> janName(name, fMemoryManager);
   
   			XMLString::subString(name, fString, fOffset, nameEnd);
               RangeToken* rangeTok = fTokenFactory->getRange(name, !positive);
  
  
  
  1.5       +7 -5      xml-xerces/c/src/xercesc/util/regx/RegxParser.hpp
  
  Index: RegxParser.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/regx/RegxParser.hpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- RegxParser.hpp	18 Mar 2003 19:38:28 -0000	1.4
  +++ RegxParser.hpp	15 May 2003 18:42:55 -0000	1.5
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -80,7 +80,8 @@
   class RangeToken;
   class TokenFactory;
   
  -class XMLUTIL_EXPORT RegxParser {
  +class XMLUTIL_EXPORT RegxParser : public XMemory
  +{
   public:
   
   	// -----------------------------------------------------------------------
  @@ -122,7 +123,7 @@
   	// -----------------------------------------------------------------------
       //  Public Constructors and Destructor
       // -----------------------------------------------------------------------
  -	RegxParser();
  +	RegxParser(MemoryManager* const manager);
   	virtual ~RegxParser();
   
       // -----------------------------------------------------------------------
  @@ -206,7 +207,7 @@
   	// -----------------------------------------------------------------------
       //  Private data types
       // -----------------------------------------------------------------------
  -    class ReferencePosition
  +    class ReferencePosition : public XMemory
       {
           public :
               ReferencePosition(const int refNo, const int position);
  @@ -224,6 +225,7 @@
   	// -----------------------------------------------------------------------
       //  Private data members
   	// -----------------------------------------------------------------------
  +    MemoryManager*                  fMemoryManager;
   	bool                            fHasBackReferences;
   	int                             fOptions;
   	int                             fOffset;
  
  
  
  1.3       +44 -40    xml-xerces/c/src/xercesc/util/regx/RegxUtil.cpp
  
  Index: RegxUtil.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/regx/RegxUtil.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RegxUtil.cpp	4 Nov 2002 15:17:00 -0000	1.2
  +++ RegxUtil.cpp	15 May 2003 18:42:55 -0000	1.3
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.3  2003/05/15 18:42:55  knoaman
  + * Partial implementation of the configurable memory manager.
  + *
    * Revision 1.2  2002/11/04 15:17:00  tng
    * C++ Namespace Support.
    *
  @@ -77,7 +80,7 @@
   //  Includes
   // ---------------------------------------------------------------------------
   #include <xercesc/util/regx/RegxUtil.hpp>
  -#include <xercesc/framework/XMLBuffer.hpp>
  +#include <xercesc/util/XMLString.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  @@ -94,59 +97,60 @@
   }
   
   
  -XMLCh* RegxUtil::stripExtendedComment(const XMLCh* const expression) {
  +XMLCh* RegxUtil::stripExtendedComment(const XMLCh* const expression,
  +                                      MemoryManager* const manager) {
   
  -	unsigned int strLen = XMLString::stringLen(expression);
  +    XMLCh* buffer = (manager) ? XMLString::replicate(expression)
  +                              : XMLString::replicate(expression, manager);
   
  -	if (strLen == 0)
  -		return 0;
  +    if (buffer)
  +    {
  +        const XMLCh* inPtr = expression;
  +        XMLCh* outPtr = buffer;
   
  -	XMLBuffer buffer;
  -	unsigned int offset = 0;
  +        while (*inPtr) {
   
  -	while (offset < strLen) {
  +            XMLCh ch = *inPtr++;
   
  -		XMLCh ch = expression[offset++];
  +            if (ch == chFF || ch == chCR || ch == chLF
  +                || ch == chSpace || ch == chHTab) {
  +                continue;
  +            }
   
  -		if (ch == chFF || ch == chCR || ch == chLF
  -			|| ch == chSpace || ch == chHTab) {
  -			continue;
  -		}
  +		    // Skips chracters between '#' and a line end.
  +		    if (ch == chPound) {
   
  -		// Skips chracters between '#' and a line end.
  -		if (ch == chPound) {
  +                while (*inPtr) {
   
  -			while (offset < strLen) {
  +                    ch = *inPtr++;
  +                    if (ch == chLF || ch == chCR)
  +                        break;
  +                }
   
  -				ch = expression[offset++];
  -				if (ch == chLF || ch == chCR)
  -					break;
  -			}
  -			continue;
  -		}
  +                continue;
  +            }
   
  -		XMLCh next;
  -		if (ch == chBackSlash && offset < strLen) {
  +            if (ch == chBackSlash && *inPtr) {
   
  -			if ((next = expression[offset]) == chPound
  -				|| next == chHTab || next == chLF || next == chFF
  -				|| next == chCR || next == chSpace) {
  +			    if ((ch = *inPtr++) == chPound || ch == chHTab || ch == chLF
  +                    || ch == chFF || ch == chCR || ch == chSpace) {
  +                    *outPtr++ = ch;
  +                }
  +                else { // Other escaped character.
   
  -				buffer.append(next);
  -				offset++;
  -			} else {                         // Other escaped character.
  +                    *outPtr++ = chBackSlash;
  +                    *outPtr++ = ch;
  +                }
  +            }
  +            else { // As is.
  +                *outPtr++ = ch;
  +            }
  +        }
   
  -				buffer.append(chBackSlash);
  -				buffer.append(next);
  -				offset++;
  -			}
  -		}
  -		else {                             // As is.
  -			buffer.append(ch);
  -		}
  -	}
  +        *outPtr = chNull; // null terminate
  +    }
   
  -	return XMLString::replicate(buffer.getRawBuffer());
  +    return buffer;
   }
   
   XERCES_CPP_NAMESPACE_END
  
  
  
  1.3       +6 -3      xml-xerces/c/src/xercesc/util/regx/RegxUtil.hpp
  
  Index: RegxUtil.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/regx/RegxUtil.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RegxUtil.hpp	4 Nov 2002 15:17:00 -0000	1.2
  +++ RegxUtil.hpp	15 May 2003 18:42:55 -0000	1.3
  @@ -64,11 +64,13 @@
   // ---------------------------------------------------------------------------
   //  Includes
   // ---------------------------------------------------------------------------
  -#include <xercesc/util/XMLString.hpp>
   #include <xercesc/util/XMLUniDefs.hpp>
   
  +
   XERCES_CPP_NAMESPACE_BEGIN
   
  +class MemoryManager;
  +
   class XMLUTIL_EXPORT RegxUtil {
   public:
   
  @@ -83,7 +85,8 @@
   	static bool isLowSurrogate(const XMLCh ch);
   	static bool isHighSurrogate(const XMLCh ch);
   	static XMLCh* decomposeToSurrogates(XMLInt32 ch);
  -	static XMLCh* stripExtendedComment(const XMLCh* const expression);
  +	static XMLCh* stripExtendedComment(const XMLCh* const expression,
  +                                       MemoryManager* const manager = 0);
   
   private:
   	// -----------------------------------------------------------------------
  
  
  
  1.6       +4 -4      xml-xerces/c/src/xercesc/util/regx/Token.hpp
  
  Index: Token.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/regx/Token.hpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Token.hpp	7 Mar 2003 18:13:58 -0000	1.5
  +++ Token.hpp	15 May 2003 18:42:55 -0000	1.6
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -64,7 +64,6 @@
   // ---------------------------------------------------------------------------
   //  Includes
   // ---------------------------------------------------------------------------
  -#include <xercesc/util/XercesDefs.hpp>
   #include <xercesc/util/RuntimeException.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
  @@ -76,7 +75,8 @@
   class TokenFactory;
   
   
  -class XMLUTIL_EXPORT Token {
  +class XMLUTIL_EXPORT Token : public XMemory
  +{
   public:
   	// -----------------------------------------------------------------------
       //  Public Constructors and Destructor
  
  
  
  1.5       +4 -5      xml-xerces/c/src/xercesc/util/regx/TokenFactory.hpp
  
  Index: TokenFactory.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/regx/TokenFactory.hpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TokenFactory.hpp	7 Mar 2003 18:13:58 -0000	1.4
  +++ TokenFactory.hpp	15 May 2003 18:42:55 -0000	1.5
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -64,8 +64,6 @@
   // ---------------------------------------------------------------------------
   //  Includes
   // ---------------------------------------------------------------------------
  -#include <xercesc/util/XMLUniDefs.hpp>
  -#include <xercesc/util/RefHashTableOf.hpp>
   #include <xercesc/util/RefVectorOf.hpp>
   #include <xercesc/util/regx/Token.hpp>
   #include <xercesc/util/Mutexes.hpp>
  @@ -85,7 +83,8 @@
   class StringToken;
   class UnionToken;
   
  -class XMLUTIL_EXPORT TokenFactory {
  +class XMLUTIL_EXPORT TokenFactory : public XMemory
  +{
   
   public:
   	// -----------------------------------------------------------------------
  
  
  

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