# HG changeset patch # User Alpar Juttner # Date 1430237559 -7200 # Node ID 5c247b4dc7082b05ba8d385f16b71190ed9574f3 # Parent f28af6829e54644bf7180af60dde56dfa5338052# Parent c199e9976d936d9cf65193c0d5d9d55edb296bec Merge bugfix #595 to branch 1.3 diff -r f28af6829e54 -r 5c247b4dc708 CMakeLists.txt --- a/CMakeLists.txt Thu Apr 02 14:08:38 2015 +0200 +++ b/CMakeLists.txt Tue Apr 28 18:12:39 2015 +0200 @@ -66,6 +66,10 @@ FIND_PACKAGE(Doxygen) FIND_PACKAGE(Ghostscript) +IF(WIN32) + SET(LEMON_WIN32 TRUE) +ENDIF(WIN32) + SET(LEMON_ENABLE_GLPK YES CACHE STRING "Enable GLPK solver backend.") SET(LEMON_ENABLE_ILOG YES CACHE STRING "Enable ILOG (CPLEX) solver backend.") SET(LEMON_ENABLE_COIN YES CACHE STRING "Enable COIN solver backend.") diff -r f28af6829e54 -r 5c247b4dc708 lemon/bits/windows.cc --- a/lemon/bits/windows.cc Thu Apr 02 14:08:38 2015 +0200 +++ b/lemon/bits/windows.cc Tue Apr 28 18:12:39 2015 +0200 @@ -21,7 +21,11 @@ #include -#ifdef WIN32 +#if defined(LEMON_WIN32) && defined(__GNUC__) +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + +#ifdef LEMON_WIN32 #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif @@ -40,7 +44,7 @@ #else #include #include -#ifndef WIN32 +#ifndef LEMON_WIN32 #include #endif #include @@ -55,7 +59,7 @@ double &utime, double &stime, double &cutime, double &cstime) { -#ifdef WIN32 +#ifdef LEMON_WIN32 static const double ch = 4294967296.0e-7; static const double cl = 1.0e-7; @@ -94,11 +98,11 @@ std::string getWinFormattedDate() { std::ostringstream os; -#ifdef WIN32 +#ifdef LEMON_WIN32 SYSTEMTIME time; GetSystemTime(&time); char buf1[11], buf2[9], buf3[5]; - if (GetDateFormat(MY_LOCALE, 0, &time, + if (GetDateFormat(MY_LOCALE, 0, &time, ("ddd MMM dd"), buf1, 11) && GetTimeFormat(MY_LOCALE, 0, &time, ("HH':'mm':'ss"), buf2, 9) && @@ -120,7 +124,7 @@ int getWinRndSeed() { -#ifdef WIN32 +#ifdef LEMON_WIN32 FILETIME time; GetSystemTimeAsFileTime(&time); return GetCurrentProcessId() + time.dwHighDateTime + time.dwLowDateTime; @@ -132,7 +136,7 @@ } WinLock::WinLock() { -#ifdef WIN32 +#ifdef LEMON_WIN32 CRITICAL_SECTION *lock = new CRITICAL_SECTION; InitializeCriticalSection(lock); _repr = lock; @@ -142,7 +146,7 @@ } WinLock::~WinLock() { -#ifdef WIN32 +#ifdef LEMON_WIN32 CRITICAL_SECTION *lock = static_cast(_repr); DeleteCriticalSection(lock); delete lock; @@ -150,14 +154,14 @@ } void WinLock::lock() { -#ifdef WIN32 +#ifdef LEMON_WIN32 CRITICAL_SECTION *lock = static_cast(_repr); EnterCriticalSection(lock); #endif } void WinLock::unlock() { -#ifdef WIN32 +#ifdef LEMON_WIN32 CRITICAL_SECTION *lock = static_cast(_repr); LeaveCriticalSection(lock); #endif diff -r f28af6829e54 -r 5c247b4dc708 lemon/bits/windows.h --- a/lemon/bits/windows.h Thu Apr 02 14:08:38 2015 +0200 +++ b/lemon/bits/windows.h Tue Apr 28 18:12:39 2015 +0200 @@ -19,6 +19,7 @@ #ifndef LEMON_BITS_WINDOWS_H #define LEMON_BITS_WINDOWS_H +#include #include namespace lemon { @@ -34,7 +35,7 @@ WinLock(); ~WinLock(); void lock(); - void unlock(); + void unlock();\ private: void *_repr; }; diff -r f28af6829e54 -r 5c247b4dc708 lemon/config.h.in --- a/lemon/config.h.in Thu Apr 02 14:08:38 2015 +0200 +++ b/lemon/config.h.in Tue Apr 28 18:12:39 2015 +0200 @@ -1,6 +1,11 @@ +#ifndef LEMON_CONFIG_H +#define LEMON_CONFIG_H + #define LEMON_VERSION "@PROJECT_VERSION@" #cmakedefine LEMON_HAVE_LONG_LONG 1 +#cmakedefine LEMON_WIN32 1 + #cmakedefine LEMON_HAVE_LP 1 #cmakedefine LEMON_HAVE_MIP 1 #cmakedefine LEMON_HAVE_GLPK 1 @@ -9,14 +14,16 @@ #cmakedefine LEMON_HAVE_CLP 1 #cmakedefine LEMON_HAVE_CBC 1 -#define _LEMON_CPLEX 1 -#define _LEMON_CLP 2 -#define _LEMON_GLPK 3 -#define _LEMON_SOPLEX 4 -#define _LEMON_CBC 5 +#define LEMON_CPLEX_ 1 +#define LEMON_CLP_ 2 +#define LEMON_GLPK_ 3 +#define LEMON_SOPLEX_ 4 +#define LEMON_CBC_ 5 -#cmakedefine LEMON_DEFAULT_LP _LEMON_@LEMON_DEFAULT_LP@ -#cmakedefine LEMON_DEFAULT_MIP _LEMON_@LEMON_DEFAULT_MIP@ +#cmakedefine LEMON_DEFAULT_LP LEMON_@LEMON_DEFAULT_LP@_ +#cmakedefine LEMON_DEFAULT_MIP LEMON_@LEMON_DEFAULT_MIP@_ #cmakedefine LEMON_USE_PTHREAD 1 #cmakedefine LEMON_USE_WIN32_THREADS 1 + +#endif diff -r f28af6829e54 -r 5c247b4dc708 lemon/core.h --- a/lemon/core.h Thu Apr 02 14:08:38 2015 +0200 +++ b/lemon/core.h Tue Apr 28 18:12:39 2015 +0200 @@ -19,13 +19,12 @@ #ifndef LEMON_CORE_H #define LEMON_CORE_H -#include -#include - -#include -#include -#include -#include +///\file +///\brief LEMON core utilities. +/// +///This header file contains core utilities for LEMON. +///It is automatically included by all graph types, therefore it usually +///do not have to be included directly. // Disable the following warnings when compiling with MSVC: // C4250: 'class1' : inherits 'class2::member' via dominance @@ -43,12 +42,15 @@ #pragma GCC diagnostic ignored "-Wunused-local-typedefs" #endif -///\file -///\brief LEMON core utilities. -/// -///This header file contains core utilities for LEMON. -///It is automatically included by all graph types, therefore it usually -///do not have to be included directly. +#include +#include + +#include +#include +#include +#include + + namespace lemon { diff -r f28af6829e54 -r 5c247b4dc708 lemon/graph_to_eps.h --- a/lemon/graph_to_eps.h Thu Apr 02 14:08:38 2015 +0200 +++ b/lemon/graph_to_eps.h Tue Apr 28 18:12:39 2015 +0200 @@ -25,7 +25,7 @@ #include #include -#ifndef WIN32 +#ifndef LEMON_WIN32 #include #include #else @@ -674,7 +674,7 @@ { os << "%%CreationDate: "; -#ifndef WIN32 +#ifndef LEMON_WIN32 timeval tv; gettimeofday(&tv, 0); diff -r f28af6829e54 -r 5c247b4dc708 lemon/lp.h --- a/lemon/lp.h Thu Apr 02 14:08:38 2015 +0200 +++ b/lemon/lp.h Tue Apr 28 18:12:39 2015 +0200 @@ -22,19 +22,19 @@ #include -#if LEMON_DEFAULT_LP == _LEMON_GLPK || LEMON_DEFAULT_MIP == _LEMON_GLPK +#if LEMON_DEFAULT_LP == LEMON_GLPK_ || LEMON_DEFAULT_MIP == LEMON_GLPK_ #include #endif -#if LEMON_DEFAULT_LP == _LEMON_CPLEX || LEMON_DEFAULT_MIP == _LEMON_CPLEX +#if LEMON_DEFAULT_LP == LEMON_CPLEX_ || LEMON_DEFAULT_MIP == LEMON_CPLEX_ #include #endif -#if LEMON_DEFAULT_LP == _LEMON_SOPLEX +#if LEMON_DEFAULT_LP == LEMON_SOPLEX_ #include #endif -#if LEMON_DEFAULT_LP == _LEMON_CLP +#if LEMON_DEFAULT_LP == LEMON_CLP_ #include #endif -#if LEMON_DEFAULT_MIP == _LEMON_CBC +#if LEMON_DEFAULT_MIP == LEMON_CBC_ #include #endif @@ -49,8 +49,8 @@ ///The default LP solver identifier. ///\ingroup lp_group /// - ///Currently, the possible values are \c _LEMON_GLPK, \c LEMON__CPLEX, - ///\c _LEMON_SOPLEX or \c LEMON__CLP + ///Currently, the possible values are \c LEMON_GLPK_, \c LEMON_CPLEX_, + ///\c LEMON_SOPLEX_ or \c LEMON_CLP_ #define LEMON_DEFAULT_LP SOLVER ///The default LP solver @@ -65,8 +65,8 @@ ///The default MIP solver identifier. ///\ingroup lp_group /// - ///Currently, the possible values are \c _LEMON_GLPK, \c LEMON__CPLEX - ///or \c _LEMON_CBC + ///Currently, the possible values are \c LEMON_GLPK_, \c LEMON_CPLEX_ + ///or \c LEMON_CBC_ #define LEMON_DEFAULT_MIP SOLVER ///The default MIP solver. @@ -76,20 +76,20 @@ ///Currently, it is either \c GlpkMip, \c CplexMip , \c CbcMip typedef GlpkMip Mip; #else -#if LEMON_DEFAULT_LP == _LEMON_GLPK +#if LEMON_DEFAULT_LP == LEMON_GLPK_ typedef GlpkLp Lp; -#elif LEMON_DEFAULT_LP == _LEMON_CPLEX +#elif LEMON_DEFAULT_LP == LEMON_CPLEX_ typedef CplexLp Lp; -#elif LEMON_DEFAULT_LP == _LEMON_SOPLEX +#elif LEMON_DEFAULT_LP == LEMON_SOPLEX_ typedef SoplexLp Lp; -#elif LEMON_DEFAULT_LP == _LEMON_CLP +#elif LEMON_DEFAULT_LP == LEMON_CLP_ typedef ClpLp Lp; #endif -#if LEMON_DEFAULT_MIP == _LEMON_GLPK +#if LEMON_DEFAULT_MIP == LEMON_GLPK_ typedef GlpkMip Mip; -#elif LEMON_DEFAULT_MIP == _LEMON_CPLEX +#elif LEMON_DEFAULT_MIP == LEMON_CPLEX_ typedef CplexMip Mip; -#elif LEMON_DEFAULT_MIP == _LEMON_CBC +#elif LEMON_DEFAULT_MIP == LEMON_CBC_ typedef CbcMip Mip; #endif #endif diff -r f28af6829e54 -r 5c247b4dc708 lemon/random.h --- a/lemon/random.h Thu Apr 02 14:08:38 2015 +0200 +++ b/lemon/random.h Tue Apr 28 18:12:39 2015 +0200 @@ -62,6 +62,8 @@ #ifndef LEMON_RANDOM_H #define LEMON_RANDOM_H +#include + #include #include #include @@ -71,7 +73,7 @@ #include #include -#ifndef WIN32 +#ifndef LEMON_WIN32 #include #include #include @@ -605,7 +607,7 @@ /// it uses the \c seedFromTime(). /// \return Currently always \c true. bool seed() { -#ifndef WIN32 +#ifndef LEMON_WIN32 if (seedFromFile("/dev/urandom", 0)) return true; #endif if (seedFromTime()) return true; @@ -625,7 +627,7 @@ /// \param file The source file /// \param offset The offset, from the file read. /// \return \c true when the seeding successes. -#ifndef WIN32 +#ifndef LEMON_WIN32 bool seedFromFile(const std::string& file = "/dev/urandom", int offset = 0) #else bool seedFromFile(const std::string& file = "", int offset = 0) @@ -647,7 +649,7 @@ /// random sequence. /// \return Currently always \c true. bool seedFromTime() { -#ifndef WIN32 +#ifndef LEMON_WIN32 timeval tv; gettimeofday(&tv, 0); seed(getpid() + tv.tv_sec + tv.tv_usec); diff -r f28af6829e54 -r 5c247b4dc708 lemon/time_measure.h --- a/lemon/time_measure.h Thu Apr 02 14:08:38 2015 +0200 +++ b/lemon/time_measure.h Tue Apr 28 18:12:39 2015 +0200 @@ -23,7 +23,9 @@ ///\file ///\brief Tools for measuring cpu usage -#ifdef WIN32 +#include + +#ifdef LEMON_WIN32 #include #else #include @@ -102,7 +104,7 @@ ///Read the current time values of the process void stamp() { -#ifndef WIN32 +#ifndef LEMON_WIN32 timeval tv; gettimeofday(&tv, 0); rtime=tv.tv_sec+double(tv.tv_usec)/1e6; diff -r f28af6829e54 -r 5c247b4dc708 test/radix_sort_test.cc --- a/test/radix_sort_test.cc Thu Apr 02 14:08:38 2015 +0200 +++ b/test/radix_sort_test.cc Tue Apr 28 18:12:39 2015 +0200 @@ -16,6 +16,8 @@ * */ +#include + #include #include #include