You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by dm...@apache.org on 2004/11/10 20:11:25 UTC

cvs commit: xml-xalan/c/Tests/Performance perf.cpp

dmitryh     2004/11/10 11:11:25

  Modified:    c/Tests/Dom2Dom dom2dom.cpp
               c/Tests/Errortests Errortests.cpp
               c/Tests/Performance perf.cpp
  Log:
  Fix for building some tests with the fixed APIs
  
  Revision  Changes    Path
  1.18      +54 -32    xml-xalan/c/Tests/Dom2Dom/dom2dom.cpp
  
  Index: dom2dom.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/Tests/Dom2Dom/dom2dom.cpp,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- dom2dom.cpp	5 Aug 2004 23:36:19 -0000	1.17
  +++ dom2dom.cpp	10 Nov 2004 19:11:25 -0000	1.18
  @@ -111,6 +111,8 @@
   			XalanDOMString&		basedir,
   			XalanDOMString&		outdir)
   {
  +    MemoryManagerType& theManager = XalanMemMgrs::getDefaultXercesMemMgr();
  +
   	bool fSuccess = true;	// Used to continue argument loop
   	bool fSetOut = true;	// Set default output directory
   
  @@ -122,9 +124,11 @@
   	}
   	else
   	{
  -		if (f.checkDir(XalanFileUtility::s_pathSep + XalanDOMString(argv[1])))
  +        XalanDOMString dir(XalanFileUtility::s_pathSep, theManager);
  +        dir += XalanDOMString(argv[1], theManager);
  +		if (f.checkDir( dir ))
   		{
  -			assign(basedir, XalanDOMString(argv[1]));
  +			assign(basedir, XalanDOMString(argv[1], theManager));
   			insert(basedir, 0, XalanFileUtility::s_pathSep);
   		}
   		else
  @@ -143,9 +147,9 @@
   			++i;
   			if(i < argc && argv[i][0] != '-')
   			{
  -				assign(outdir, XalanDOMString(argv[i]));
  -				insert(outdir, 0, XalanDOMString("\\"));
  -				append(outdir, XalanDOMString("\\"));
  +				assign(outdir, XalanDOMString(argv[i],theManager));
  +				insert(outdir, 0, XalanDOMString("\\",theManager));
  +				append(outdir, XalanDOMString("\\",theManager));
   				f.checkAndCreateDir(outdir);
   				fSetOut = false;
   			}
  @@ -167,7 +171,7 @@
   	if (fSetOut)
   	{
   		unsigned int ii = lastIndexOf(basedir, XalanFileUtility::s_pathSep[0]);
  -		outdir = substring(basedir, 0, ii+1);
  +        substring(basedir,outdir, 0, ii+1 );
   		append(outdir, "Dom2Dom-RESULTS\\");
   		f.checkAndCreateDir(outdir);
   	}
  @@ -200,12 +204,13 @@
   
   		if (stylesheet != 0)
   		{
  -			version = stylesheet->getOutputVersion();
   
  -			mediatype = stylesheet->getOutputMediaType();
  -			doctypeSystem = stylesheet->getOutputDoctypeSystem();
  -			doctypePublic = stylesheet->getOutputDoctypePublic();
  -			standalone = stylesheet->getOutputStandalone();
  +            stylesheet->getOutputVersion(version);
  +
  +            stylesheet->getOutputMediaType(mediatype);
  +			stylesheet->getOutputDoctypeSystem(doctypeSystem);
  +			stylesheet->getOutputDoctypePublic(doctypePublic);
  +			stylesheet->getOutputStandalone(standalone);
   		}
   
   		FormatterToXML* const	fToXML =
  @@ -236,44 +241,53 @@
   		  int		argc,
   		  char*		argv[])
   {
  -	XalanFileUtility	f;
  +    MemoryManagerType&  theManager = XalanMemMgrs::getDefaultXercesMemMgr();
  +
  +	XalanFileUtility	f(theManager);
   
  -	XalanDOMString  category;	// Test all of base dir by default
  -	XalanDOMString  baseDir;	
  -	XalanDOMString  outputRoot;
  +	XalanDOMString  category(theManager);	// Test all of base dir by default
  +	XalanDOMString  baseDir(theManager);	
  +	XalanDOMString  outputRoot(theManager);
   	
   	if (getParams(argc, argv, f, baseDir, outputRoot) == true)
   	{
   		typedef XalanFileUtility::FileNameVectorType		FileNameVectorType;
   
   		// Get the list of Directories that are below perf
  -		const FileNameVectorType	dirs = f.getDirectoryNames(baseDir);
  +		FileNameVectorType	dirs(theManager);
  +        f.getDirectoryNames(baseDir, dirs);
   
   		// Generate Unique Run id. (Only used to name the result logfile.)
  -		const XalanDOMString UniqRunid = f.generateUniqRunid();
  +		XalanDOMString UniqRunid(theManager);
  +        f.generateUniqRunid(UniqRunid);
   
   		// Defined basic constants for file manipulation 
   
  -		const XalanDOMString  resultFilePrefix("dom2dom");
  -		const XalanDOMString  resultsFile(outputRoot + resultFilePrefix + UniqRunid + XalanFileUtility::s_xmlSuffix);
  +		const XalanDOMString  resultFilePrefix("dom2dom", theManager);
  +		XalanDOMString  resultsFile(outputRoot, theManager);
  +        resultsFile += resultFilePrefix;
  +        resultsFile += UniqRunid;
  +        resultsFile += XalanFileUtility::s_xmlSuffix;
   		
  -		XalanXMLFileReporter    logFile(resultsFile);
  +		XalanXMLFileReporter    logFile(theManager, resultsFile);
   		logFile.logTestFileInit("Dom2Dom Testing: Treating all inputs and outputs as DOM's. ");
   
   		try
   		{
  -			XalanTransformer		transformEngine;
  +			XalanTransformer		transformEngine(theManager);
   						
  -			XercesDOMSupport domSupport;
  -			XercesParserLiaison parserLiaison(domSupport);
  +			XercesDOMSupport domSupport(theManager);
  +			XercesParserLiaison parserLiaison(theManager, domSupport);
   					
   			// Specify the "test" directory for both input and output.
   			const XalanDOMString  xMan("dtod");
  -			const XalanDOMString  theOutputDir = outputRoot + xMan;
  +			XalanDOMString  theOutputDir(outputRoot, theManager);
  +            theOutputDir += xMan;
   			f.checkAndCreateDir(theOutputDir);
   
   			// Get the files found in the test directory
  -			const FileNameVectorType	files = f.getTestFileNames(baseDir, xMan,true);
  +			FileNameVectorType	files(theManager);
  +            f.getTestFileNames(baseDir, xMan,true, files);
   
   			for(FileNameVectorType::size_type i = 0; i < files.size(); ++i)
   			{
  @@ -282,10 +296,18 @@
   				cout << files[i] << endl;
   
   				// Set up the input/output files.
  -				const XalanDOMString  theXSLFile= baseDir + xMan + XalanFileUtility::s_pathSep + files[i];
  -				const XalanDOMString  theXMLFile = f.generateFileName(theXSLFile,"xml");
  -				const XalanDOMString  theOutput =  outputRoot + xMan + XalanFileUtility::s_pathSep + files[i]; 
  -				const XalanDOMString  theOutputFile = f.generateFileName(theOutput, "out");
  +				XalanDOMString  theXSLFile( baseDir, theManager);
  +                theXSLFile += xMan;
  +                theXSLFile += XalanFileUtility::s_pathSep;
  +                theXSLFile += files[i];
  +				XalanDOMString  theXMLFile(theManager);
  +                f.generateFileName(theXSLFile,"xml", theXMLFile);
  +				XalanDOMString  theOutput (outputRoot, theManager);
  +                theOutput += xMan ;
  +                theOutput += XalanFileUtility::s_pathSep;
  +                theOutput += files[i]; 
  +				XalanDOMString  theOutputFile(theManager);
  +                f.generateFileName(theOutput, "out", theOutputFile);
   
   				XALAN_USING_XERCES(DOMDocument)
   				XALAN_USING_XERCES(DOMImplementation)
  @@ -325,10 +347,10 @@
   					}
   					else
   					{
  -						const XalanDOMString	mimeEncoding(XALAN_STATIC_UCODE_STRING("UTF-8"));
  -						const XalanDOMString	encoding(XALAN_STATIC_UCODE_STRING("UTF-8"));
  +						const XalanDOMString	mimeEncoding(XALAN_STATIC_UCODE_STRING("UTF-8"), theManager);
  +						const XalanDOMString	encoding(XALAN_STATIC_UCODE_STRING("UTF-8"), theManager);
   
  -						XalanFileOutputStream myOutput(theOutputFile);
  +						XalanFileOutputStream myOutput(theOutputFile, theManager);
   						XalanOutputStreamPrintWriter myResultWriter(myOutput);
   						FormatterListener* theFormatter = getXMLFormatter(true,true,true,
   																		myResultWriter,0,
  
  
  
  1.21      +44 -18    xml-xalan/c/Tests/Errortests/Errortests.cpp
  
  Index: Errortests.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/Tests/Errortests/Errortests.cpp,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- Errortests.cpp	5 Aug 2004 23:36:19 -0000	1.20
  +++ Errortests.cpp	10 Nov 2004 19:11:25 -0000	1.21
  @@ -115,7 +115,12 @@
   			int		argc,
   			char*	argv[])
   {
  -	XalanFileUtility	h;
  +    XALAN_USING_XALAN(MemoryManagerType)
  +    XALAN_USING_XALAN(XalanMemMgrs)
  +
  +    MemoryManagerType& theManager = XalanMemMgrs::getDefaultXercesMemMgr();
  +
  +	XalanFileUtility	h(theManager);
   
   	// Set the program help string,  then get the command line parameters.
   	//
  @@ -138,13 +143,17 @@
   		domSupport.setParserLiaison(&parserLiaison);
   
   		// Generate Unique Run id and processor info
  -		const XalanDOMString UniqRunid = h.generateUniqRunid();
  +		XalanDOMString UniqRunid(theManager);
  +        h.generateUniqRunid(UniqRunid);
   
   		// Defined basic constants for file manipulation and open results file
  -		const XalanDOMString  resultFilePrefix("cpperr");
  -		const XalanDOMString  resultsFile(h.args.output + resultFilePrefix + UniqRunid + XalanFileUtility::s_xmlSuffix);
  +		const XalanDOMString  resultFilePrefix("cpperr", theManager);
  +		XalanDOMString  resultsFile(h.args.output, theManager);
  +        resultsFile += resultFilePrefix;
  +        resultsFile += UniqRunid;
  +        resultsFile += XalanFileUtility::s_xmlSuffix;
   
  -		XalanXMLFileReporter    logFile(resultsFile);
  +		XalanXMLFileReporter    logFile(theManager, resultsFile);
   
   		logFile.logTestFileInit("Error Testing:");
   
  @@ -153,12 +162,14 @@
   
   		typedef XalanFileUtility::FileNameVectorType    FileNameVectorType;
   
  -		const FileNameVectorType	dirs = h.getDirectoryNames(h.args.base);
  +		FileNameVectorType	dirs(theManager); 
  +        h.getDirectoryNames(h.args.base, dirs);
   
   		for(FileNameVectorType::size_type	j = 0; j < dirs.size(); ++j)
   		{
   			// If conformance directory structure does not exist, it needs to be created.
  -			const XalanDOMString  confSubdir = h.args.output + dirs[j];
  +			XalanDOMString  confSubdir(h.args.output, theManager);
  +            confSubdir += dirs[j];
   			h.checkAndCreateDir(confSubdir);
   
   				// Set up to get files from the associated error directories
  @@ -168,7 +179,8 @@
   				if (h.args.sub.empty() == true || currentDir == h.args.sub)
   				{
   					// Check that output directory is there.
  -					const XalanDOMString  theOutputDir = h.args.output + currentDir;
  +					XalanDOMString  theOutputDir( h.args.output , theManager);
  +                    theOutputDir += currentDir;
   					h.checkAndCreateDir(theOutputDir);
   
   					
  @@ -176,7 +188,8 @@
   					foundDir = true;
   					logFile.logTestCaseInit(currentDir);
   
  -					const FileNameVectorType files = h.getTestFileNames(h.args.base, currentDir, false);
  +					FileNameVectorType files(theManager); 
  +                    h.getTestFileNames(h.args.base, currentDir, false, files);
   
   					for(FileNameVectorType::size_type i = 0; i < files.size(); i++)
   					{
  @@ -185,21 +198,34 @@
   						XALAN_USING_XALAN(XalanCompiledStylesheet)
   						XALAN_USING_XALAN(XalanParsedSource)
   
  -						XalanXMLFileReporter::Hashtable     attrs;
  +						XalanXMLFileReporter::Hashtable     attrs(theManager);
   
  -						const XalanDOMString currentFile(files[i]);
  +						const XalanDOMString currentFile(files[i], theManager);
   						h.data.testOrFile = currentFile;
   
   						if (checkForExclusion(currentFile))
   							continue;
   
  -						const XalanDOMString  theXSLFile= h.args.base + currentDir + XalanFileUtility::s_pathSep + currentFile;
  -						const XalanDOMString  theXMLFile = h.generateFileName(theXSLFile,"xml");
  -						XalanDOMString  theGoldFile = h.args.gold + currentDir + XalanFileUtility::s_pathSep + currentFile;
  -						theGoldFile = h.generateFileName(theGoldFile, "out");
  -
  -						const XalanDOMString  outbase =  h.args.output + currentDir + XalanFileUtility::s_pathSep + currentFile; 
  -						const XalanDOMString  theOutputFile = h.generateFileName(outbase, "out");
  +						XalanDOMString  theXSLFile( h.args.base, theManager);
  +                        theXSLFile += currentDir;
  +                        theXSLFile += XalanFileUtility::s_pathSep;
  +                        theXSLFile += currentFile;
  +						XalanDOMString  theXMLFile(theManager);
  +                        h.generateFileName(theXSLFile,"xml", theXMLFile);
  +						XalanDOMString  theGoldFile( h.args.gold, theManager);
  +                        theGoldFile += currentDir;
  +                        theGoldFile +=  XalanFileUtility::s_pathSep;
  +                        theGoldFile += currentFile;
  +
  +
  +                        h.generateFileName(theGoldFile, "out", theGoldFile);
  +
  +						XalanDOMString  outbase(h.args.output, theManager);
  +                        outbase += currentDir;
  +                        outbase += XalanFileUtility::s_pathSep;
  +                        outbase +=  currentFile; 
  +						XalanDOMString  theOutputFile(theManager);
  +                        h.generateFileName(outbase, "out", theOutputFile);
   
   						const XSLTInputSource	xslInputSource(theXSLFile);
   						const XSLTInputSource	xmlInputSource(theXMLFile);
  
  
  
  1.41      +8 -6      xml-xalan/c/Tests/Performance/perf.cpp
  
  Index: perf.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/Tests/Performance/perf.cpp,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- perf.cpp	5 Aug 2004 23:36:20 -0000	1.40
  +++ perf.cpp	10 Nov 2004 19:11:25 -0000	1.41
  @@ -254,24 +254,26 @@
   	_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
   #endif
   
  +    MemoryManagerType& theManager = XalanMemMgrs::getDefaultXercesMemMgr();
   
  -	const XalanDOMString	processorType(XALAN_STATIC_UCODE_STRING("XalanC"));
  +	const XalanDOMString	processorType(XALAN_STATIC_UCODE_STRING("XalanC"), theManager);
   	bool skip = true;		// Default will skip long tests
   	bool setGold = false;
   
  -	XalanFileUtility	h;
  +	XalanFileUtility	h(theManager);
   
   	// Set the program help string,  then get the command line parameters.
   	//
  -	setHelp(h);
  +	setHelp(h, theManager);
   
   	if (h.getParams(argc, argv, "PERF-RESULTS", setGold) == true)
   	{
   
   		// Generate Unique Run id and processor info
  -		const XalanDOMString	UniqRunid = h.generateUniqRunid();
  -		const XalanDOMString	resultFilePrefix(XalanDOMString("cpp"));
  -		const XalanDOMString	resultsFile(h.args.output + resultFilePrefix + UniqRunid + XalanFileUtility::s_xmlSuffix);
  +		XalanDOMString	UniqRunid(theManager);
  +        h.generateUniqRunid(theManager);
  +		const XalanDOMString	resultFilePrefix(XalanDOMString("cpp"), theManager);
  +		const XalanDOMString	resultsFile(h.args.output,  + resultFilePrefix + UniqRunid + XalanFileUtility::s_xmlSuffix);
   
   		XalanXMLFileReporter	logFile(resultsFile);
   
  
  
  

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