[Lemon-commits] Alpar Juttner: Merge
Lemon HG
hg at lemon.cs.elte.hu
Fri Feb 13 18:55:58 CET 2009
details: http://lemon.cs.elte.hu/hg/lemon/rev/2a136de8e3f2
changeset: 518:2a136de8e3f2
user: Alpar Juttner <alpar [at] cs.elte.hu>
date: Fri Feb 13 16:05:21 2009 +0000
description:
Merge
diffstat:
5 files changed, 37 insertions(+), 14 deletions(-)
lemon/graph_to_eps.h | 26 +++++++++++++++++++++-----
lemon/lp_base.cc | 6 ++++--
lemon/lp_base.h | 12 ++++++------
lemon/math.h | 2 +-
lemon/time_measure.h | 5 +++++
diffs (152 lines):
diff --git a/lemon/graph_to_eps.h b/lemon/graph_to_eps.h
--- a/lemon/graph_to_eps.h
+++ b/lemon/graph_to_eps.h
@@ -29,8 +29,12 @@
#include<sys/time.h>
#include<ctime>
#else
+#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
+#endif
+#ifndef NOMINMAX
#define NOMINMAX
+#endif
#include<windows.h>
#endif
@@ -688,18 +692,30 @@
os << "%%CreationDate: " << cbuf;
#else
SYSTEMTIME time;
- char buf1[11], buf2[9], buf3[5];
-
GetSystemTime(&time);
+#if defined(_MSC_VER) && (_MSC_VER < 1500)
+ LPWSTR buf1, buf2, buf3;
if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
- "ddd MMM dd", buf1, 11) &&
+ L"ddd MMM dd", buf1, 11) &&
GetTimeFormat(LOCALE_USER_DEFAULT, 0, &time,
- "HH':'mm':'ss", buf2, 9) &&
+ L"HH':'mm':'ss", buf2, 9) &&
GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
- "yyyy", buf3, 5)) {
+ L"yyyy", buf3, 5)) {
os << "%%CreationDate: " << buf1 << ' '
<< buf2 << ' ' << buf3 << std::endl;
}
+#else
+ char buf1[11], buf2[9], buf3[5];
+ if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
+ "ddd MMM dd", buf1, 11) &&
+ GetTimeFormat(LOCALE_USER_DEFAULT, 0, &time,
+ "HH':'mm':'ss", buf2, 9) &&
+ GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
+ "yyyy", buf3, 5)) {
+ os << "%%CreationDate: " << buf1 << ' '
+ << buf2 << ' ' << buf3 << std::endl;
+ }
+#endif
#endif
}
diff --git a/lemon/lp_base.cc b/lemon/lp_base.cc
--- a/lemon/lp_base.cc
+++ b/lemon/lp_base.cc
@@ -22,7 +22,9 @@
#include <lemon/lp_base.h>
namespace lemon {
- const LpBase::Value LpBase::INF = std::numeric_limits<Value>::infinity();
- const LpBase::Value LpBase::NaN = std::numeric_limits<Value>::quiet_NaN();
+ const LpBase::Value LpBase::INF =
+ std::numeric_limits<LpBase::Value>::infinity();
+ const LpBase::Value LpBase::NaN =
+ std::numeric_limits<LpBase::Value>::quiet_NaN();
} //namespace lemon
diff --git a/lemon/lp_base.h b/lemon/lp_base.h
--- a/lemon/lp_base.h
+++ b/lemon/lp_base.h
@@ -597,11 +597,11 @@
const Value &upperBound() const { return _ub; }
///Is the constraint lower bounded?
bool lowerBounded() const {
- return _lb != -INF && !isnan(_lb);
+ return _lb != -INF && !isNaN(_lb);
}
///Is the constraint upper bounded?
bool upperBounded() const {
- return _ub != INF && !isnan(_ub);
+ return _ub != INF && !isNaN(_ub);
}
};
@@ -1666,7 +1666,7 @@
inline LpBase::Constr operator<=(const LpBase::Value &n,
const LpBase::Constr &c) {
LpBase::Constr tmp(c);
- LEMON_ASSERT(isnan(tmp.lowerBound()), "Wrong LP constraint");
+ LEMON_ASSERT(isNaN(tmp.lowerBound()), "Wrong LP constraint");
tmp.lowerBound()=n;
return tmp;
}
@@ -1678,7 +1678,7 @@
const LpBase::Value &n)
{
LpBase::Constr tmp(c);
- LEMON_ASSERT(isnan(tmp.upperBound()), "Wrong LP constraint");
+ LEMON_ASSERT(isNaN(tmp.upperBound()), "Wrong LP constraint");
tmp.upperBound()=n;
return tmp;
}
@@ -1690,7 +1690,7 @@
inline LpBase::Constr operator>=(const LpBase::Value &n,
const LpBase::Constr &c) {
LpBase::Constr tmp(c);
- LEMON_ASSERT(isnan(tmp.upperBound()), "Wrong LP constraint");
+ LEMON_ASSERT(isNaN(tmp.upperBound()), "Wrong LP constraint");
tmp.upperBound()=n;
return tmp;
}
@@ -1702,7 +1702,7 @@
const LpBase::Value &n)
{
LpBase::Constr tmp(c);
- LEMON_ASSERT(isnan(tmp.lowerBound()), "Wrong LP constraint");
+ LEMON_ASSERT(isNaN(tmp.lowerBound()), "Wrong LP constraint");
tmp.lowerBound()=n;
return tmp;
}
diff --git a/lemon/math.h b/lemon/math.h
--- a/lemon/math.h
+++ b/lemon/math.h
@@ -60,7 +60,7 @@
///This function checks whether the parameter is NaN or not.
///Is should be equivalent with std::isnan(), but it is not
///provided by all compilers.
- inline bool isnan(double v)
+ inline bool isNaN(double v)
{
return v!=v;
}
diff --git a/lemon/time_measure.h b/lemon/time_measure.h
--- a/lemon/time_measure.h
+++ b/lemon/time_measure.h
@@ -24,11 +24,16 @@
///\brief Tools for measuring cpu usage
#ifdef WIN32
+#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
+#endif
+#ifndef NOMINMAX
#define NOMINMAX
+#endif
#include <windows.h>
#include <cmath>
#else
+#include <unistd.h>
#include <sys/times.h>
#include <sys/time.h>
#endif
More information about the Lemon-commits
mailing list