* Most of tools:
- Bug: In top CMakeLists.txt the SETUP_PROJECT_PATHS was not inserting X_USER_TOP *before* X_TOP, thus potentially allowing an obsolete system-wide configuration to shadow an up-to-date local one. * ./crlcore: - New: In Utilities, The Dots class which allow nice pretty printing on a terminal (like lines of books summaries).
This commit is contained in:
parent
92422cb683
commit
245185de14
|
@ -11,15 +11,6 @@ ENDIF(COMMAND CMAKE_POLICY)
|
|||
# This macro has to be included in all the tools CMakeLists.txt as it's
|
||||
# the sole means of localizing other tools/projects.
|
||||
MACRO(SETUP_PROJECT_PATHS project)
|
||||
IF( NOT("$ENV{${project}_USER_TOP}" STREQUAL "") )
|
||||
MESSAGE("-- ${project}_USER_TOP is set to $ENV{${project}_USER_TOP}")
|
||||
SET(PROJECT_MODULE_PATH "$ENV{${project}_USER_TOP}/share/cmake_modules/")
|
||||
LIST(FIND CMAKE_MODULE_PATH "${PROJECT_MODULE_PATH}" DIR_INDEX)
|
||||
IF( DIR_INDEX LESS 0)
|
||||
LIST(INSERT CMAKE_MODULE_PATH 0 "${PROJECT_MODULE_PATH}")
|
||||
ENDIF( DIR_INDEX LESS 0)
|
||||
ENDIF( NOT("$ENV{${project}_USER_TOP}" STREQUAL "") )
|
||||
|
||||
IF( NOT("$ENV{${project}_TOP}" STREQUAL "") )
|
||||
MESSAGE("-- ${project}_TOP is set to $ENV{${project}_TOP}")
|
||||
SET(PROJECT_MODULE_PATH "$ENV{${project}_TOP}/share/cmake_modules/")
|
||||
|
@ -28,6 +19,15 @@ MACRO(SETUP_PROJECT_PATHS project)
|
|||
LIST(INSERT CMAKE_MODULE_PATH 0 "${PROJECT_MODULE_PATH}")
|
||||
ENDIF( DIR_INDEX LESS 0)
|
||||
ENDIF( NOT("$ENV{${project}_TOP}" STREQUAL "") )
|
||||
|
||||
IF( NOT("$ENV{${project}_USER_TOP}" STREQUAL "") )
|
||||
MESSAGE("-- ${project}_USER_TOP is set to $ENV{${project}_USER_TOP}")
|
||||
SET(PROJECT_MODULE_PATH "$ENV{${project}_USER_TOP}/share/cmake_modules/")
|
||||
LIST(FIND CMAKE_MODULE_PATH "${PROJECT_MODULE_PATH}" DIR_INDEX)
|
||||
IF( DIR_INDEX LESS 0)
|
||||
LIST(INSERT CMAKE_MODULE_PATH 0 "${PROJECT_MODULE_PATH}")
|
||||
ENDIF( DIR_INDEX LESS 0)
|
||||
ENDIF( NOT("$ENV{${project}_USER_TOP}" STREQUAL "") )
|
||||
ENDMACRO(SETUP_PROJECT_PATHS project)
|
||||
|
||||
SETUP_PROJECT_PATHS(IO)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
|
||||
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
|
||||
//
|
||||
// ===================================================================
|
||||
//
|
||||
|
@ -27,10 +27,12 @@
|
|||
#include <csignal>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <iomanip>
|
||||
|
||||
#include "crlcore/Utilities.h"
|
||||
|
||||
|
||||
int tty::_width = 80;
|
||||
bool tty::_enabled = true;
|
||||
unsigned int mstream::_activeMask = mstream::Verbose0;
|
||||
|
||||
|
@ -40,6 +42,54 @@ mstream cmess2 ( mstream::Verbose2, std::cout );
|
|||
mstream cinfo ( mstream::Info , std::cout );
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "::Dots".
|
||||
|
||||
|
||||
Dots::Dots ( const std::string& left, const std::string& right ) : _left(left), _right(right) { }
|
||||
|
||||
|
||||
Dots Dots::asPercentage ( const std::string& left, float value )
|
||||
{
|
||||
std::ostringstream right;
|
||||
right << std::setprecision(3) << value << "%";
|
||||
return Dots(left,right.str());
|
||||
}
|
||||
|
||||
|
||||
Dots Dots::asUInt ( const std::string& left, unsigned int value )
|
||||
{ std::ostringstream right; right << value; return Dots(left,right.str()); }
|
||||
|
||||
|
||||
Dots Dots::asULong ( const std::string& left, unsigned long value )
|
||||
{ std::ostringstream right; right << value; return Dots(left,right.str()); }
|
||||
|
||||
|
||||
Dots Dots::asSizet ( const std::string& left, size_t value )
|
||||
{ std::ostringstream right; right << value; return Dots(left,right.str()); }
|
||||
|
||||
|
||||
Dots Dots::asDouble ( const std::string& left, double value )
|
||||
{ std::ostringstream right; right << value; return Dots(left,right.str()); }
|
||||
|
||||
|
||||
Dots Dots::asIdentifier ( const std::string& left, const std::string& value )
|
||||
{ std::ostringstream right; right << "<" << value << ">"; return Dots(left,right.str()); }
|
||||
|
||||
|
||||
Dots Dots::asString ( const std::string& left, const std::string& value )
|
||||
{ return Dots(left,value); }
|
||||
|
||||
|
||||
std::ostream& operator<< ( std::ostream& out, const Dots& dots )
|
||||
{
|
||||
int count = tty::getWidth() - 2 - dots._left.length() - dots._right.length();
|
||||
out << dots._left << " "; while ( count-- > 0 ) out << "."; out << " " << dots._right;
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
|
||||
namespace CRL {
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
|
||||
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
|
||||
//
|
||||
// ===================================================================
|
||||
//
|
||||
|
@ -178,6 +178,8 @@ class tty {
|
|||
, TypeMask = 0xF0
|
||||
};
|
||||
public:
|
||||
inline static void setWidth ( int );
|
||||
inline static int getWidth ();
|
||||
inline static void enable ();
|
||||
inline static void disable ();
|
||||
inline static bool enabled ();
|
||||
|
@ -202,9 +204,11 @@ class tty {
|
|||
private:
|
||||
static bool _enabled;
|
||||
static const char* _intensity[4];
|
||||
static int _width;
|
||||
};
|
||||
|
||||
|
||||
inline void tty::setWidth ( int width ) { _width=width; }
|
||||
inline int tty::getWidth () { return _width; }
|
||||
inline void tty::enable () { _enabled=true; }
|
||||
inline void tty::disable () { _enabled=false; }
|
||||
inline bool tty::enabled () { return _enabled; }
|
||||
|
@ -327,13 +331,36 @@ inline std::string tty::bgcolor ( unsigned int mask )
|
|||
MSTREAM_PR_SUPPORT(std::string);
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Shared objects.
|
||||
// -------------------------------------------------------------------
|
||||
// Shared objects.
|
||||
|
||||
extern mstream cmess0;
|
||||
extern mstream cmess1;
|
||||
extern mstream cmess2;
|
||||
extern mstream cinfo;
|
||||
|
||||
extern mstream cmess0;
|
||||
extern mstream cmess1;
|
||||
extern mstream cmess2;
|
||||
extern mstream cinfo;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "::Dots".
|
||||
|
||||
|
||||
class Dots {
|
||||
public:
|
||||
static Dots asPercentage ( const std::string& left, float );
|
||||
static Dots asUInt ( const std::string& left, unsigned int );
|
||||
static Dots asULong ( const std::string& left, unsigned long );
|
||||
static Dots asSizet ( const std::string& left, size_t );
|
||||
static Dots asDouble ( const std::string& left, double );
|
||||
static Dots asIdentifier ( const std::string& left, const std::string& );
|
||||
static Dots asString ( const std::string& left, const std::string& );
|
||||
private:
|
||||
Dots ( const std::string& left, const std::string& right );
|
||||
friend std::ostream& operator<< ( std::ostream&, const Dots& );
|
||||
private:
|
||||
const std::string _left;
|
||||
const std::string _right;
|
||||
};
|
||||
|
||||
|
||||
# endif
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
|
||||
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
|
||||
//
|
||||
// ===================================================================
|
||||
//
|
||||
|
@ -202,10 +202,11 @@ int main ( int argc, char *argv[] )
|
|||
// cerr << "Selecting: " << occurrence << endl;
|
||||
// }
|
||||
// }
|
||||
// if ( cell && cell->getName() == "inv_x1" ) {
|
||||
// Box box = cell->getAbutmentBox();
|
||||
// DemoGo::create ( cell, box.inflate(DbU::lambda(2)) );
|
||||
// }
|
||||
if ( cell && cell->getName() == "inv_x1" ) {
|
||||
// Box box = cell->getAbutmentBox();
|
||||
// DemoGo::create ( cell, box.inflate(DbU::lambda(2)) );
|
||||
Reference::create ( cell, "Label", DbU::lambda(0.0), DbU::lambda(0.0), Reference::Label );
|
||||
}
|
||||
|
||||
dbo_ptr<Cyclop> cyclop ( Cyclop::create() );
|
||||
cmess1 << cyclop->getBanner() << endl;;
|
||||
|
@ -218,6 +219,10 @@ int main ( int argc, char *argv[] )
|
|||
returnCode = qa->exec();
|
||||
}
|
||||
}
|
||||
catch ( poptions::error& e ) {
|
||||
cerr << "[ERROR] " << e.what() << endl;
|
||||
exit ( 1 );
|
||||
}
|
||||
catch ( Error& e ) {
|
||||
cerr << e.what() << endl;
|
||||
exit ( 1 );
|
||||
|
|
Loading…
Reference in New Issue