[Compbench-devel] CompBenchmarks++/libcompbenchmarks/Compiler Compiler.cpp, 1.5, 1.6 Compiler.h, 1.
Brought to you by:
xfred
From: Frederic T. <xf...@us...> - 2007-03-18 22:59:37
|
Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Compiler In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv3200 Modified Files: Compiler.cpp Compiler.h Compiler-Option-Description.cpp Compiler-Option-Description.h Log Message: Look for compiler's versions (with bootstrap.xml) to get correct description.xml file. Index: Compiler.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Compiler/Compiler.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Compiler.h 14 Mar 2007 20:35:40 -0000 1.6 --- Compiler.h 18 Mar 2007 21:47:59 -0000 1.7 *************** *** 73,78 **** /** Gets compiler's version * \return std::string containing the version of the compiler ! * \sa getCompilerVersion() */ virtual std::string getCompilerVersion(void) = 0; public: virtual void setPlan(CBM_PLAN *_plan, int modifyPlanObject); --- 73,88 ---- /** Gets compiler's version * \return std::string containing the version of the compiler ! * \sa Version() ! * \sa vanillaVersion() ! */ virtual std::string getCompilerVersion(void) = 0; + + /** Gets vanilla version + * Removes extra characters from getCompilerVersion() and just keeps + * something like <M>.<m>.<p> or <M>.<m> + * \return 'Simplified' version + * \sa Version() */ + virtual std::string vanillaVersion(void); + public: virtual void setPlan(CBM_PLAN *_plan, int modifyPlanObject); Index: Compiler-Option-Description.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Compiler/Compiler-Option-Description.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Compiler-Option-Description.cpp 14 Mar 2007 19:45:38 -0000 1.2 --- Compiler-Option-Description.cpp 18 Mar 2007 21:47:59 -0000 1.3 *************** *** 9,12 **** --- 9,18 ---- #include <Compiler/Compiler-Option-Description.h> #include <CEL/CEL-Include.h> + #include <CEL/CEL-Reader.h> + #include <CEL/CEL-Stack.h> + #include <CEL/CEL-Function.h> + #include <CEL/CEL-Block.h> + #include <CEL/CEL-Str.h> + #include <Base/XMLReader.h> *************** *** 60,66 **** } ! CompilerOptionDescriptions::CompilerOptionDescriptions(std::string _compilerId) { ! parse(_compilerId); } --- 66,135 ---- } ! CompilerOptionDescriptions::CompilerOptionDescriptions(std::string _compilerId, ! std::string _compilerVanillaVersion) { ! std::string file = compilerDescriptionBootstrap(_compilerId, ! _compilerVanillaVersion); ! ! parse(file); ! } ! ! std::string CompilerOptionDescriptions::compilerDescriptionBootstrap(std::string _compilerId, ! std::string _compilerVanillaVersion) ! { ! std::string bootstrapFilename; ! CBM::CelAtom *bootstrapRoot; ! CBM::CelReader *R; ! ! CBM::CelBlock *Call_B; ! CBM::CelStackPush *Call_P0; ! CBM::CelStackPush *Call_P1; ! CBM::CelStr *Call_CID; ! CBM::CelStr *Call_V; ! CBM::CelStr *Call_FName; ! CBM::CelFunctionCall *Call; ! ! std::string result; ! ! bootstrapFilename=_compilerId; ! bootstrapFilename+="/bootstrap.xml"; ! ! bootstrapFilename=CBM::CelFullIncludeName(bootstrapFilename); ! ! R=new CBM::CelReader(bootstrapFilename); ! ! bootstrapRoot=R->parse(); ! if (!bootstrapRoot) { ! delete(R); ! return(""); ! } ! ! bootstrapRoot->Evaluate(); ! ! Call_B=new CBM::CelBlock(); ! ! Call_CID=new CBM::CelStr(_compilerId); ! Call_V=new CBM::CelStr(_compilerVanillaVersion); ! ! Call_P0=new CBM::CelStackPush(); ! Call_P1=new CBM::CelStackPush(); ! ! Call_P0->add(Call_CID); ! Call_P1->add(Call_V); ! ! Call_B->add(Call_P0); ! Call_B->add(Call_P1); ! ! Call=new CBM::CelFunctionCall(); ! Call_B->add(Call); ! Call_FName=new CBM::CelStr("kb-bootstrap-description-filename"); ! Call->add(Call_FName); ! ! result=Call_B->Evaluate(); ! CBM::CELFunctionUndef("kb-bootstrap-description-filename"); ! delete(Call_B); ! delete(bootstrapRoot); ! ! return(result); } *************** *** 75,79 **** XMLAttribute *A; ! _fileName+="/description.xml"; _fileName=CBM::CelFullIncludeName(_fileName); --- 144,148 ---- XMLAttribute *A; ! std::string tmp; _fileName=CBM::CelFullIncludeName(_fileName); *************** *** 100,105 **** if (N->Name() == "include") { A=N->getAttribute("description-path"); ! if (A) ! parse(A->Value()); } } --- 169,177 ---- if (N->Name() == "include") { A=N->getAttribute("description-path"); ! if (A) { ! tmp=A->Value(); ! tmp+="/description.xml"; ! parse(tmp); ! } } } Index: Compiler-Option-Description.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Compiler/Compiler-Option-Description.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Compiler-Option-Description.h 14 Mar 2007 19:45:38 -0000 1.2 --- Compiler-Option-Description.h 18 Mar 2007 21:47:59 -0000 1.3 *************** *** 61,68 **** protected: virtual void parse(std::string _fileName); public: ! CompilerOptionDescriptions(std::string _compilerId); virtual int DescriptionNumber(void); --- 61,72 ---- protected: + virtual std::string compilerDescriptionBootstrap(std::string _compilerId, + std::string _compilerVanillaVersion); + virtual void parse(std::string _fileName); public: ! CompilerOptionDescriptions(std::string _compilerId, ! std::string _compilerVanillaVersion); virtual int DescriptionNumber(void); Index: Compiler.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Compiler/Compiler.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Compiler.cpp 14 Mar 2007 20:35:40 -0000 1.5 --- Compiler.cpp 18 Mar 2007 21:47:59 -0000 1.6 *************** *** 59,65 **** } CBM::CompilerOptionDescriptions *Compiler::OptionDescriptions(void) { ! return(new CBM::CompilerOptionDescriptions(compiler())); } --- 59,113 ---- } + std::string Compiler::vanillaVersion(void) + { + std::string v = Version(); + std::string tmp; + std::string r; + + unsigned int d0; + unsigned int d1; + unsigned int d2; + + if (v.find(' ')>0) { + tmp=cbmSystem->Split(v, ".", 0); + if (!tmp.empty()) { + r+=tmp; + tmp=cbmSystem->Split(v, ".", 1); + d0=v.find('.', 0); + if (!tmp.empty()) { + r+="."; + r+=tmp; + d1=v.find('.', d0); + if (d1-d0>3) + return("can't find 2d number for version"); + + tmp=cbmSystem->Split(v, ".", 2); + d2=v.find('.', d1); + if (!tmp.empty()) { + r+="."; + r+=tmp; + d2=v.find('.', d1); + if (d2-d1>3) + return("can't find 3rd number for version"); + } else + return(r); + } else { + return("can't find first number for version"); + } + } else { + return("can't find first number for version"); + } + } else { + return(v); + } + return("can't find first number for version"); + } + CBM::CompilerOptionDescriptions *Compiler::OptionDescriptions(void) { ! std::string vanilla = vanillaVersion(); ! ! return(new CBM::CompilerOptionDescriptions(compiler(), ! vanilla)); } |