From a6bee3919e3bfa601dd51429387321412fda4660 Mon Sep 17 00:00:00 2001 From: oetiker Date: Thu, 1 Jul 2010 20:49:42 +0000 Subject: [PATCH] * patches to make rrdtool compile on win32 (trunk and 1.4) * dotnet bindings (trunk) by Euphoria Audio git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.4/program@2095 a5681a0c-68f1-0310-ab6d-d61299d08faa --- src/rrd.h | 4 + src/rrd_graph.h | 4 + src/rrd_rpncalc.c | 2 +- src/rrd_tool.c | 2 + src/rrd_update.c | 2 +- src/rrd_utils.c | 18 +- win32/config.h | 7 +- win32/rrd.sln | 68 +- win32/rrd.vcproj | 1296 +++++++++++++++++++-------------------- win32/rrd_config.h.msvc | 126 ++-- win32/rrdlib.vcproj | 902 ++++++++++++++++----------- win32/rrdtool.vcproj | 495 +++++++++------ 12 files changed, 1598 insertions(+), 1328 deletions(-) diff --git a/src/rrd.h b/src/rrd.h index 31148c8..cf0163a 100644 --- a/src/rrd.h +++ b/src/rrd.h @@ -57,6 +57,10 @@ extern "C" { #ifndef WIN32 #include /* for off_t */ #else +#ifdef _MSC_VER + typedef int mode_t; + #define strtoll _strtoi64 +#endif typedef size_t ssize_t; typedef long off_t; #endif diff --git a/src/rrd_graph.h b/src/rrd_graph.h index 8e28f63..b2b03f7 100644 --- a/src/rrd_graph.h +++ b/src/rrd_graph.h @@ -7,7 +7,11 @@ /* this may configure __EXTENSIONS__ without which pango will fail to compile so load this early */ +#ifdef HAVE_CONFIG_H #include "../rrd_config.h" +#elif defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__) +#include "../win32/config.h" +#endif #include #include diff --git a/src/rrd_rpncalc.c b/src/rrd_rpncalc.c index dca2ae1..b563db4 100644 --- a/src/rrd_rpncalc.c +++ b/src/rrd_rpncalc.c @@ -77,7 +77,7 @@ rpnp_t *rpn_expand( return NULL; } for (i = 0; rpnc[i].op != OP_END; ++i) { - rpnp[i].op = rpnc[i].op; + rpnp[i].op = (op_en)rpnc[i].op; if (rpnp[i].op == OP_NUMBER) { rpnp[i].val = (double) rpnc[i].val; } else if (rpnp[i].op == OP_VARIABLE || rpnp[i].op == OP_PREV_OTHER) { diff --git a/src/rrd_tool.c b/src/rrd_tool.c index d860abe..5c717f9 100644 --- a/src/rrd_tool.c +++ b/src/rrd_tool.c @@ -815,8 +815,10 @@ int HandleInputLine( } else if (strcmp("tune", argv[1]) == 0) rrd_tune(argc - 1, &argv[1]); +#ifndef WIN32 else if (strcmp("flushcached", argv[1]) == 0) rrd_flushcached(argc - 1, &argv[1]); +#endif else { rrd_set_error("unknown function '%s'", argv[1]); } diff --git a/src/rrd_update.c b/src/rrd_update.c index 0335a9e..23c072c 100644 --- a/src/rrd_update.c +++ b/src/rrd_update.c @@ -1548,7 +1548,7 @@ static int update_cdp_prep( if (elapsed_pdp_st > 2) { reset_cdp(rrd, elapsed_pdp_st, pdp_temp, last_seasonal_coef, seasonal_coef, rra_idx, ds_idx, cdp_idx, - current_cf); + (cf_en)current_cf); } } diff --git a/src/rrd_utils.c b/src/rrd_utils.c index 3936cff..31e53e2 100644 --- a/src/rrd_utils.c +++ b/src/rrd_utils.c @@ -25,19 +25,24 @@ #include #include -#include #include #include #include #include +#ifndef _MSC_VER +#include #include - +#endif #ifdef WIN32 # define random() rand() # define srandom(x) srand(x) # define getpid() 0 #endif /* WIN32 */ +#ifndef S_ISDIR +#define S_ISDIR(x) (((x) & S_IFMT) == S_IFDIR) +#endif + /* make sure that the random number generator seeded EXACTLY ONCE */ long rrd_random(void) { @@ -140,7 +145,11 @@ int rrd_mkdir_p(const char *pathname, mode_t mode) if (NULL == (pathname_copy = strdup(pathname))) return -1; +#ifndef _MSC_VER base_dir = dirname(pathname_copy); +#else + _splitpath(pathname_copy, NULL, base_dir, NULL, NULL); +#endif if (0 != rrd_mkdir_p(base_dir, mode)) { int orig_errno = errno; @@ -152,8 +161,13 @@ int rrd_mkdir_p(const char *pathname, mode_t mode) free(pathname_copy); /* keep errno as set by mkdir() */ +#ifdef _MSC_VER + if (0 != mkdir(pathname)) + return -1; +#else if (0 != mkdir(pathname, mode)) return -1; +#endif return 0; } /* rrd_mkdir_p */ diff --git a/win32/config.h b/win32/config.h index 6199234..7855b2d 100644 --- a/win32/config.h +++ b/win32/config.h @@ -5,6 +5,7 @@ #include #include #include +#include /* realloc does not support NULL as argument */ @@ -28,9 +29,9 @@ /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 -#define NUMVERS 1.3020 +#define NUMVERS 1.4030 #define PACKAGE_NAME "rrdtool" -#define PACKAGE_VERSION "1.3.2" +#define PACKAGE_VERSION "1.4.3" #define PACKAGE_STRING PACKAGE_NAME " " PACKAGE_VERSION #define isinf(a) (_fpclass(a) == _FPCLASS_NINF || _fpclass(a) == _FPCLASS_PINF) @@ -54,4 +55,6 @@ /* #define DEBUG 1 */ +__inline int round(double a){int x = (a + 0.5); return x;} + #endif /* CONFIG_H */ diff --git a/win32/rrd.sln b/win32/rrd.sln index 7f07ad3..16ff6c1 100644 --- a/win32/rrd.sln +++ b/win32/rrd.sln @@ -1,29 +1,39 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rrdlib", "rrdlib.vcproj", "{CC158E1D-1364-43CA-9B2D-4AF54225C7CA}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rrdtool", "rrdtool.vcproj", "{11CD05F8-E5E1-476E-A75F-A112655D4E94}" - ProjectSection(ProjectDependencies) = postProject - {CC158E1D-1364-43CA-9B2D-4AF54225C7CA} = {CC158E1D-1364-43CA-9B2D-4AF54225C7CA} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {CC158E1D-1364-43CA-9B2D-4AF54225C7CA}.Debug|Win32.ActiveCfg = Debug|Win32 - {CC158E1D-1364-43CA-9B2D-4AF54225C7CA}.Debug|Win32.Build.0 = Debug|Win32 - {CC158E1D-1364-43CA-9B2D-4AF54225C7CA}.Release|Win32.ActiveCfg = Release|Win32 - {CC158E1D-1364-43CA-9B2D-4AF54225C7CA}.Release|Win32.Build.0 = Release|Win32 - {11CD05F8-E5E1-476E-A75F-A112655D4E94}.Debug|Win32.ActiveCfg = Debug|Win32 - {11CD05F8-E5E1-476E-A75F-A112655D4E94}.Debug|Win32.Build.0 = Debug|Win32 - {11CD05F8-E5E1-476E-A75F-A112655D4E94}.Release|Win32.ActiveCfg = Release|Win32 - {11CD05F8-E5E1-476E-A75F-A112655D4E94}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rrdlib", "rrdlib.vcproj", "{CC158E1D-1364-43CA-9B2D-4AF54225C7CA}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rrdtool", "rrdtool.vcproj", "{11CD05F8-E5E1-476E-A75F-A112655D4E94}" + ProjectSection(ProjectDependencies) = postProject + {CC158E1D-1364-43CA-9B2D-4AF54225C7CA} = {CC158E1D-1364-43CA-9B2D-4AF54225C7CA} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + DebugDLL|Win32 = DebugDLL|Win32 + Release|Win32 = Release|Win32 + Static Debug|Win32 = Static Debug|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CC158E1D-1364-43CA-9B2D-4AF54225C7CA}.Debug|Win32.ActiveCfg = Debug|Win32 + {CC158E1D-1364-43CA-9B2D-4AF54225C7CA}.Debug|Win32.Build.0 = Debug|Win32 + {CC158E1D-1364-43CA-9B2D-4AF54225C7CA}.DebugDLL|Win32.ActiveCfg = DebugDLL|Win32 + {CC158E1D-1364-43CA-9B2D-4AF54225C7CA}.DebugDLL|Win32.Build.0 = DebugDLL|Win32 + {CC158E1D-1364-43CA-9B2D-4AF54225C7CA}.Release|Win32.ActiveCfg = Release|Win32 + {CC158E1D-1364-43CA-9B2D-4AF54225C7CA}.Release|Win32.Build.0 = Release|Win32 + {CC158E1D-1364-43CA-9B2D-4AF54225C7CA}.Static Debug|Win32.ActiveCfg = Static Debug|Win32 + {CC158E1D-1364-43CA-9B2D-4AF54225C7CA}.Static Debug|Win32.Build.0 = Static Debug|Win32 + {11CD05F8-E5E1-476E-A75F-A112655D4E94}.Debug|Win32.ActiveCfg = Debug|Win32 + {11CD05F8-E5E1-476E-A75F-A112655D4E94}.Debug|Win32.Build.0 = Debug|Win32 + {11CD05F8-E5E1-476E-A75F-A112655D4E94}.DebugDLL|Win32.ActiveCfg = Debug|Win32 + {11CD05F8-E5E1-476E-A75F-A112655D4E94}.DebugDLL|Win32.Build.0 = Debug|Win32 + {11CD05F8-E5E1-476E-A75F-A112655D4E94}.Release|Win32.ActiveCfg = Release|Win32 + {11CD05F8-E5E1-476E-A75F-A112655D4E94}.Release|Win32.Build.0 = Release|Win32 + {11CD05F8-E5E1-476E-A75F-A112655D4E94}.Static Debug|Win32.ActiveCfg = Static Debug|Win32 + {11CD05F8-E5E1-476E-A75F-A112655D4E94}.Static Debug|Win32.Build.0 = Static Debug|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/win32/rrd.vcproj b/win32/rrd.vcproj index b9822a9..8afaf81 100644 --- a/win32/rrd.vcproj +++ b/win32/rrd.vcproj @@ -1,648 +1,648 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/win32/rrd_config.h.msvc b/win32/rrd_config.h.msvc index 7c55d5a..7855b2d 100644 --- a/win32/rrd_config.h.msvc +++ b/win32/rrd_config.h.msvc @@ -1,66 +1,60 @@ -/* rrd_config.h.msvc. Hand-tweaked rrd_config.h for MSVC compiler. */ -#ifndef WIN32 -#error This rrd_config.h is created for Win32 platform! -#endif -#ifndef RRD_CONFIG_H -#define RRD_CONFIG_H - -#include -#include -#include - -/* the placeholders will be filled in by get_ver.awk */ -/* http://cm.bell-labs.com/cm/cs/awkbook/index.html */ -#define NUMVERS @@NUMVERS@@ -#define PACKAGE_VERSION "@@PACKAGE_VERSION@@" - -#define PACKAGE_NAME "rrdtool" -#define PACKAGE_STRING PACKAGE_NAME " " PACKAGE_VERSION - -#define HAVE_STRFTIME 1 -#define HAVE_TIME_H 1 -#define HAVE_LOCALE_H 1 -#define HAVE_TZSET 1 -#define HAVE_SETLOCALE 1 -#define HAVE_MATH_H 1 -#define HAVE_FLOAT_H 1 -#define HAVE_MEMMOVE 1 -#define HAVE_MALLOC_H 1 -#define HAVE_MKTIME 1 -#define HAVE_STRFTIME 1 -#define HAVE_STRING_H 1 -#define HAVE_VSNPRINTF 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -#define isinf(a) (_fpclass(a) == _FPCLASS_NINF || _fpclass(a) == _FPCLASS_PINF) -#define isnan _isnan -#define finite _finite -#define snprintf _snprintf -#define vsnprintf _vsnprintf -#define strftime strftime_ -#define strtoll(p, e, b) _strtoi64(p, e, b) - -/* realloc does not support NULL as argument */ -#define NO_NULL_REALLOC 1 -#if NO_NULL_REALLOC -# define rrd_realloc(a,b) ( (a) == NULL ? malloc( (b) ) : realloc( (a) , (b) )) -#else -# define rrd_realloc(a,b) realloc((a), (b)) -#endif - -/* Vertical label angle: 90.0 (default) or 270.0 */ -#define RRDGRAPH_YLEGEND_ANGLE 90.0 - -#define RRD_DEFAULT_FONT "arial.ttf" -/* #define RRD_DEFAULT_FONT "DejaVuSansMono-Roman.ttf" */ - -/* #define WITH_PIECHART 1 */ - -/* #define DEBUG 1 */ - -#endif /* RRD_CONFIG_H */ - +/* config.h.msvc. Hand-tweaked config.h for MSVC compiler. */ +#ifndef CONFIG_H +#define CONFIG_H + +#include +#include +#include +#include + +/* realloc does not support NULL as argument */ + +#define HAVE_STRFTIME 1 +#define HAVE_TIME_H 1 +#define HAVE_LOCALE_H 1 +#define HAVE_TZSET 1 +#define HAVE_SETLOCALE 1 +#define HAVE_MATH_H 1 +#define HAVE_FLOAT_H 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MALLOC_H 1 +#define HAVE_MKTIME 1 +#define HAVE_STRFTIME 1 +#define HAVE_STRING_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_VSNPRINTF 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +#define NUMVERS 1.4030 +#define PACKAGE_NAME "rrdtool" +#define PACKAGE_VERSION "1.4.3" +#define PACKAGE_STRING PACKAGE_NAME " " PACKAGE_VERSION + +#define isinf(a) (_fpclass(a) == _FPCLASS_NINF || _fpclass(a) == _FPCLASS_PINF) +#define isnan _isnan +#define finite _finite +#define snprintf _snprintf +//#define vsnprintf _vsnprintf +//#define strftime strftime_ + +#define NO_NULL_REALLOC 1 +#if NO_NULL_REALLOC +# define rrd_realloc(a,b) ( (a) == NULL ? malloc( (b) ) : realloc( (a) , (b) )) +#else +# define rrd_realloc(a,b) realloc((a), (b)) +#endif + +/* Vertical label angle: 90.0 (default) or 270.0 */ +#define RRDGRAPH_YLEGEND_ANGLE 90.0 + +#define RRD_DEFAULT_FONT "Courier" + +/* #define DEBUG 1 */ + +__inline int round(double a){int x = (a + 0.5); return x;} + +#endif /* CONFIG_H */ diff --git a/win32/rrdlib.vcproj b/win32/rrdlib.vcproj index dd5947e..9ea6bbf 100644 --- a/win32/rrdlib.vcproj +++ b/win32/rrdlib.vcproj @@ -1,375 +1,527 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/win32/rrdtool.vcproj b/win32/rrdtool.vcproj index e98dd8b..7139414 100644 --- a/win32/rrdtool.vcproj +++ b/win32/rrdtool.vcproj @@ -1,204 +1,291 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- 2.30.2