[Compbench-devel] CompBenchmarks++/libcompbenchmarks/Compiler Compiler-Options.cpp, 1.5, 1.6 Compil
Brought to you by:
xfred
From: Frederic T. <xf...@us...> - 2007-07-31 17:23:20
|
Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Compiler In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv28117 Modified Files: Compiler-Options.cpp Compiler-Options.h Log Message: Options' handling (add/remove) improved. Index: Compiler-Options.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Compiler/Compiler-Options.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Compiler-Options.h 30 May 2007 17:01:12 -0000 1.4 --- Compiler-Options.h 31 Jul 2007 17:23:13 -0000 1.5 *************** *** 33,36 **** --- 33,39 ---- virtual void remove(CBM::CompilerOption *_option); + virtual int addSingle(std::string _option); + virtual int removeSingle(std::string _option); + public: /** Constructor *************** *** 47,52 **** virtual int optionNumber(void); ! virtual void add(std::string _option); ! virtual void remove(std::string _option); /** Retrives options --- 50,55 ---- virtual int optionNumber(void); ! virtual int add(std::string _options); ! virtual int remove(std::string _options); /** Retrives options Index: Compiler-Options.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Compiler/Compiler-Options.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Compiler-Options.cpp 30 May 2007 17:01:12 -0000 1.5 --- Compiler-Options.cpp 31 Jul 2007 17:23:13 -0000 1.6 *************** *** 15,34 **** std::string _options) { - std::string o = "!"; - int i = 0; - id=_id; ! if (_options=="") ! return; ! ! while (o!="") { ! o=cbmSystem->Split(_options, " ", i++); ! if ((o=="") && (i==1)) { ! add(_options); ! } ! if (o!="") { ! add(o); ! } ! } } --- 15,20 ---- std::string _options) { id=_id; ! add(_options); } *************** *** 61,64 **** --- 47,72 ---- } + int CompilerOptions::addSingle(std::string _option) + { + if (!Option(_option)) { + add(new CompilerOption(_option)); + return(1); + } else { + return(0); + } + } + + int CompilerOptions::removeSingle(std::string _option) + { + CBM::CompilerOption *O = Option(_option); + + if (O) { + remove(O); + return(1); + } else { + return(0); + } + } + CompilerOption *CompilerOptions::Option(std::string _id) { *************** *** 88,103 **** } ! void CompilerOptions::add(std::string _option) { ! if (!Option(_option)) ! add(new CompilerOption(_option)); } ! void CompilerOptions::remove(std::string _option) { ! CBM::CompilerOption *O = Option(_option); ! if (O) ! remove(O); } --- 96,139 ---- } ! int CompilerOptions::add(std::string _options) { ! std::string o = "!"; ! int i = 0; ! int r = 0; ! ! if (_options=="") ! return(0); ! ! while (o!="") { ! o=cbmSystem->Split(_options, " ", i++); ! if ((o=="") && (i==1)) { ! r+=addSingle(_options); ! } ! if (o!="") { ! r+=addSingle(o); ! } ! } ! return(r); } ! int CompilerOptions::remove(std::string _options) { ! std::string o = "!"; ! int i = 0; ! int r = 0; ! if (_options=="") ! return(0); ! ! while (o!="") { ! o=cbmSystem->Split(_options, " ", i++); ! if ((o=="") && (i==1)) { ! r+=removeSingle(_options); ! } ! if (o!="") { ! r+=removeSingle(o); ! } ! } ! return(r); } |