From: glenlow Date: Mon, 25 May 2009 06:26:56 +0000 (+0000) Subject: support building with Visual Studio 2005+ X-Git-Tag: LAST_LIBGRAPH~32^2~2030 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c87564782699cf50957d8f41dfce17218f074106;p=graphviz support building with Visual Studio 2005+ --- diff --git a/plugin/visio/VisioGraphic.cpp b/plugin/visio/VisioGraphic.cpp index d4af21712..928b575c7 100644 --- a/plugin/visio/VisioGraphic.cpp +++ b/plugin/visio/VisioGraphic.cpp @@ -16,6 +16,15 @@ #include +#ifdef _MSC_VER +#include +#define isfinite _finite +#endif + +#ifdef __GNUC__ +#include +#endif + #include "VisioGraphic.h" #include "gvcjob.h" @@ -23,6 +32,8 @@ namespace Visio { + using namespace std; + static const float INCHES_PER_POINT = 1.0 / 72.0; Fill::Fill(unsigned char red, unsigned char green, unsigned char blue, double transparency): @@ -199,9 +210,9 @@ namespace Visio { double xscale = 1.0 / (last.x - first.x); double yscale = 1.0 / (last.y - first.y); - if (isinf(xscale)) + if (isfinite(xscale) == 0) xscale = 0.0; - if (isinf(yscale)) + if (isfinite(yscale) == 0) yscale = 0.0; gvputs(job, ""); @@ -225,7 +236,7 @@ namespace Visio gvprintf(job, "", (_points[_pointCount - 1].y - first.y) * yscale); /* Knot[P-1] */ - gvprintf(job, "%d", std::max(_pointCount - 4, 0)); + gvprintf(job, "%d", max(_pointCount - 4, 0)); /* Ctl[P-1].Weight */ gvputs(job, "1"); @@ -237,13 +248,13 @@ namespace Visio gvputs(job, "1"); /* Knot[P], Degree, XType, YType */ - gvprintf(job, ""); gvputs(job, "\n"); @@ -298,9 +309,9 @@ namespace Visio /* compute scale. if infinite, scale by 0 instead */ double xscale = 1.0 / (last.x - first.x); double yscale = 1.0 / (last.y - first.y); - if (isinf(xscale)) + if (isfinite(xscale) == 0) xscale = 0.0; - if (isinf(yscale)) + if (isfinite(yscale) == 0) yscale = 0.0; gvputs(job, ""); @@ -350,9 +361,9 @@ namespace Visio /* compute scale. if infinite, scale by 0 instead */ double xscale = 1.0 / (last.x - first.x); double yscale = 1.0 / (last.y - first.y); - if (isinf(xscale)) + if (isfinite(xscale) == 0) xscale = 0.0; - if (isinf(yscale)) + if (isfinite(yscale) == 0) yscale = 0.0; gvputs(job, ""); diff --git a/plugin/visio/VisioRender.cpp b/plugin/visio/VisioRender.cpp index 9066fc53c..b83c3231e 100644 --- a/plugin/visio/VisioRender.cpp +++ b/plugin/visio/VisioRender.cpp @@ -14,6 +14,15 @@ * AT&T Research, Florham Park NJ * **********************************************************/ +#ifdef _MSC_VER +#include +#define isfinite _finite +#endif + +#ifdef __GNUC__ +#include +#endif + #include "VisioRender.h" #include "const.h" @@ -23,6 +32,8 @@ namespace Visio { + using namespace std; + static const float INCHES_PER_POINT = 1.0 / 72.0; static const float ZERO_ADJUST = 0.125; @@ -304,9 +315,9 @@ namespace Visio /* compute scale. if infinite, scale by 0 instead */ double xscale = 1.0 / (outerBounds.UR.x - outerBounds.LL.x); double yscale = 1.0 / (outerBounds.UR.y - outerBounds.LL.y); - if (isinf(xscale)) + if (isfinite(xscale) == 0) xscale = 0.0; - if (isinf(yscale)) + if (isfinite(yscale) == 0) yscale = 0.0; gvprintf(job, "\n", ++_shapeId); diff --git a/plugin/visio/gvrender_visio_vdx.cpp b/plugin/visio/gvrender_visio_vdx.cpp index 2f8ab3484..cae9cb9d4 100644 --- a/plugin/visio/gvrender_visio_vdx.cpp +++ b/plugin/visio/gvrender_visio_vdx.cpp @@ -191,6 +191,8 @@ gvdevice_features_t device_features_vdx = { {72.,72.}, /* default dpi */ }; +extern "C" +{ gvplugin_installed_t gvrender_vdx_types[] = { {0, "visio", 1, &vdxgen_engine, &render_features_vdx}, {0, NULL, 0, NULL, NULL} @@ -200,3 +202,4 @@ gvplugin_installed_t gvdevice_vdx_types[] = { {FORMAT_VDX, "vdx:visio", 1, NULL, &device_features_vdx}, {0, NULL, 0, NULL, NULL} }; +}