[Compbench-devel] CompBenchmarks++/libcompbenchmarks/System System-Thread-CompilerAutodetect.cpp, N
Brought to you by:
xfred
From: Frederic T. <xf...@us...> - 2007-09-27 17:20:39
|
Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/System In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv11816 Added Files: System-Thread-CompilerAutodetect.cpp System-Thread-CompilerAutodetect.h Log Message: First import. --- NEW FILE: System-Thread-CompilerAutodetect.h --- /* ---------------------------------------------------------------------------- $Id: System-Thread-CompilerAutodetect.h,v 1.1 2007/09/27 17:20:34 xfred Exp $ This is free software. For details, see the GNU Public License in the COPYING file, or Look http://www.fsf.org ------------------------------------------------------------------------- */ #ifndef H_CBMSYSTEM_COMPILER_AUTODETECT #define H_CBMSYSTEM_COMPILER_AUTODETECT 1 #include <Base/Thread.h> #include <Compiler/Compiler.h> #include <string> namespace CBM { class SystemThreadCompilerAutodetectManager { protected: SystemThreadCompilerAutodetectManager(); public: virtual void compilerRegister(CBM::Compiler *C) = 0; virtual ~SystemThreadCompilerAutodetectManager(); }; class SystemThreadCompilerAutodetect : public ThreadAction { private: int total; int current; SystemThreadCompilerAutodetectManager *manager; protected: virtual void routine(void); public: SystemThreadCompilerAutodetect(SystemThreadCompilerAutodetectManager *_manager); virtual float Progress(void); ~SystemThreadCompilerAutodetect(); }; } #endif --- NEW FILE: System-Thread-CompilerAutodetect.cpp --- /* ---------------------------------------------------------------------------- $Id: System-Thread-CompilerAutodetect.cpp,v 1.1 2007/09/27 17:20:34 xfred Exp $ This is free software. For details, see the GNU Public License in the COPYING file, or Look http://www.fsf.org ------------------------------------------------------------------------- */ #include <System/System-Thread-CompilerAutodetect.h> #include <UI/UI-Msg.h> #include <UI/UI.h> #include <System/System.h> using namespace CBM; SystemThreadCompilerAutodetectManager::SystemThreadCompilerAutodetectManager() { } SystemThreadCompilerAutodetectManager::~SystemThreadCompilerAutodetectManager() { } SystemThreadCompilerAutodetect::SystemThreadCompilerAutodetect(SystemThreadCompilerAutodetectManager *_manager) { total=24; current=0; manager=_manager; } void SystemThreadCompilerAutodetect::routine(void) { const char *known_compilers[] = {"/usr/bin/gcc", "/usr/bin/tcc", "gcc-2.95", "gcc-2.96", "gcc-3.1", "gcc-3.2", "gcc-3.3", "gcc-3.4", "gcc-4.0", "gcc-4.1", "gcc-4.2", "/usr/local/bin/gcc", "/usr/local/bin/tcc", "/usr/bin/g++", "g++-2.95", "g++-2.96", "g++-3.1", "g++-3.2", "g++-3.3", "g++-3.4", "g++-4.0", "g++-4.1", "g++-4.2", "/usr/local/bin/g++"}; P(); current=0; R(); CBM::CompilerSelector SC(cbmSystem); CBM::Compiler *C; CBM::UIMsg *msg; int i; msg=cbmUI->msgCompilerAutodetect(); for(i=0; i<total; i++) { P(); current=i; R(); C=SC.select(known_compilers[i]); if (C) manager->compilerRegister(C); P(); msg->setProgress((float) ((current*100.0)/total)); R(); } cbmUI->outputOK(); } float SystemThreadCompilerAutodetect::Progress(void) { int i; P(); i=current; R(); return((i*100.0)/total); } SystemThreadCompilerAutodetect::~SystemThreadCompilerAutodetect() { delete(manager); } |