From 8160212499c40c74f1c1c396f02332336ec4e8ae Mon Sep 17 00:00:00 2001 From: meta Date: Tue, 18 Jan 2011 00:02:56 +0100 Subject: add C99 math for win32 diff --git a/src/dxfdata.cc b/src/dxfdata.cc index dc3e8a1..0579389 100644 --- a/src/dxfdata.cc +++ b/src/dxfdata.cc @@ -32,7 +32,7 @@ #include #include #include -#include +#include "mathc99.h" #include struct Line { diff --git a/src/dxfdim.cc b/src/dxfdim.cc index 02a1274..a45768d 100644 --- a/src/dxfdim.cc +++ b/src/dxfdim.cc @@ -31,7 +31,7 @@ #include "printutils.h" #include "context.h" -#include +#include "mathc99.h" #include #include #include diff --git a/src/dxftess-glu.cc b/src/dxftess-glu.cc index ca12ea9..63fa2e5 100644 --- a/src/dxftess-glu.cc +++ b/src/dxftess-glu.cc @@ -9,7 +9,7 @@ # include #endif #include -#include +#include "mathc99.h" #ifdef WIN32 # define STDCALL __stdcall diff --git a/src/func.cc b/src/func.cc index e8ff54a..46b29a8 100644 --- a/src/func.cc +++ b/src/func.cc @@ -28,7 +28,7 @@ #include "context.h" #include "dxfdim.h" #include "builtin.h" -#include +#include "mathc99.h" AbstractFunction::~AbstractFunction() { diff --git a/src/glview.cc b/src/glview.cc index d51714b..0b161c8 100644 --- a/src/glview.cc +++ b/src/glview.cc @@ -31,7 +31,7 @@ #include #include #include -#include +#include "mathc99.h" #include #define FAR_FAR_AWAY 100000.0 diff --git a/src/grid.h b/src/grid.h index 572bc66..306751f 100644 --- a/src/grid.h +++ b/src/grid.h @@ -1,7 +1,7 @@ #ifndef GRID_H_ #define GRID_H_ -#include +#include "mathc99.h" #include #include #include diff --git a/src/mathc99.cc b/src/mathc99.cc new file mode 100644 index 0000000..db71059 --- /dev/null +++ b/src/mathc99.cc @@ -0,0 +1,5 @@ +#include "mathc99.h" + +double found(double a) { + return a > 0 ? floor(a+0.5) : ceil(a-0.5); +} diff --git a/src/mathc99.h b/src/mathc99.h new file mode 100644 index 0000000..4d5d3be --- /dev/null +++ b/src/mathc99.h @@ -0,0 +1,16 @@ +#ifndef MATHC99_H_ +#define MATHC99_H_ + +#ifdef WIN32 + +#include +//for native win32 builds we need to provide C99 math functions by ourselves +double round(double a); + +#else + +#include + +#endif + +#endif diff --git a/src/value.cc b/src/value.cc index a237c5a..3931755 100644 --- a/src/value.cc +++ b/src/value.cc @@ -24,7 +24,7 @@ */ #include "value.h" -#include +#include "mathc99.h" Value::Value() { -- cgit v0.10.1