]> granicus.if.org Git - graphviz/commitdiff
support building with Visual Studio 2005+
authorglenlow <devnull@localhost>
Mon, 25 May 2009 06:26:56 +0000 (06:26 +0000)
committerglenlow <devnull@localhost>
Mon, 25 May 2009 06:26:56 +0000 (06:26 +0000)
plugin/visio/VisioGraphic.cpp
plugin/visio/VisioRender.cpp
plugin/visio/gvrender_visio_vdx.cpp

index d4af21712cd62bf271ce0818b01b7d2947e44fa7..928b575c72b9e52af4eab75be4a97174ea315499 100644 (file)
 
 #include <algorithm>
 
+#ifdef _MSC_VER
+#include <cfloat>
+#define isfinite _finite
+#endif
+
+#ifdef __GNUC__
+#include <cmath>
+#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, "<MoveTo>");
@@ -225,7 +236,7 @@ namespace Visio
                                gvprintf(job, "<Y F='Height*%f'/>", (_points[_pointCount - 1].y - first.y) * yscale);
                                
                                /* Knot[P-1] */
-                               gvprintf(job, "<A>%d</A>", std::max(_pointCount - 4, 0));
+                               gvprintf(job, "<A>%d</A>", max(_pointCount - 4, 0));
                                
                                /* Ctl[P-1].Weight */
                                gvputs(job, "<B>1</B>");        
@@ -237,13 +248,13 @@ namespace Visio
                                gvputs(job, "<D>1</D>");        
                                
                                /* Knot[P], Degree, XType, YType */
-                               gvprintf(job, "<E F='NURBS(%d, 3, 0, 0", std::max(_pointCount - 3, 0));                         
+                               gvprintf(job, "<E F='NURBS(%d, 3, 0, 0", max(_pointCount - 3, 0));                              
                                for (int i = 1; i < _pointCount; ++i)
                                /* Ctl[i].X, Ctl[i].Y, Knot[i], Ctl[i].Weight */
                                        gvprintf(job, ", %f, %f, %d, 1",                                        
                                                         (_points[i].x - first.x) * xscale,
                                                         (_points[i].y - first.y) * yscale,
-                                                        std::max(i - 3, 0));   
+                                                        max(i - 3, 0));        
                                gvputs(job, ")'/>");
                                
                                gvputs(job, "</NURBSTo>\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, "<MoveTo>");
@@ -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, "<MoveTo>");
index 9066fc53cb1d648748bc0a8265336d3c7b63ea0d..b83c3231e071d4a021ae2c7ed76268a5494f2257 100644 (file)
  *              AT&T Research, Florham Park NJ             *
  **********************************************************/
 
+#ifdef _MSC_VER
+#include <cfloat>
+#define isfinite _finite
+#endif
+
+#ifdef __GNUC__
+#include <cmath>
+#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, "<Shape ID='%d' Type='Shape'>\n", ++_shapeId);
index 2f8ab348439beee9e1eec27360dee472948a3297..cae9cb9d44c2c71972a8a4d38caa17174031dfaf 100644 (file)
@@ -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}
 };
+}