From 4544c97f2699490bdfef560e6dbcd71de09db7b2 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/trunk/program@2095 a5681a0c-68f1-0310-ab6d-d61299d08faa --- NEWS | 5 + bindings/dotnet/Properties/AssemblyInfo.cs | 36 + bindings/dotnet/dnrrd_binding_test.csproj | 69 ++ bindings/dotnet/dnrrdlib.csproj | 63 + bindings/dotnet/favicon.ico | Bin 0 -> 1403 bytes bindings/dotnet/rrd_binding_test.cs | 370 ++++++ bindings/dotnet/rrdlib.cs | 407 ++++++ bindings/dotnet/rrdlib.sln | 26 + 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 +++++--- 20 files changed, 2574 insertions(+), 1328 deletions(-) create mode 100644 bindings/dotnet/Properties/AssemblyInfo.cs create mode 100644 bindings/dotnet/dnrrd_binding_test.csproj create mode 100644 bindings/dotnet/dnrrdlib.csproj create mode 100644 bindings/dotnet/favicon.ico create mode 100644 bindings/dotnet/rrd_binding_test.cs create mode 100644 bindings/dotnet/rrdlib.cs create mode 100644 bindings/dotnet/rrdlib.sln diff --git a/NEWS b/NEWS index 16742f2..f9a2468 100644 --- a/NEWS +++ b/NEWS @@ -21,10 +21,15 @@ RRDcached * New FETCH command allowing rrd_fetch to operate through the daemon and thus work remotely. By Florian Forster + API --- * exported rrd_update_v_r for theadsave rrd_update calls +Bindings +-------- +* dotnet by Euphoria Audio + ##################################### Major Changes between 1.3.x and 1.4.x diff --git a/bindings/dotnet/Properties/AssemblyInfo.cs b/bindings/dotnet/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..3982939 --- /dev/null +++ b/bindings/dotnet/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("rrdlib")] +[assembly: AssemblyDescription(".NET bindings for rrdlib")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Euphoria Audio, LLC")] +[assembly: AssemblyProduct("RRDLib Dot Net Binding")] +[assembly: AssemblyCopyright("Copyright © Chris Larsen 2010")] +[assembly: AssemblyTrademark("rrdlib by Tobias Oetiker")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("841fc684-688e-4f72-9e7e-1f367f53b227")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("0.9.1.5")] +[assembly: AssemblyFileVersion("0.9.1.5")] diff --git a/bindings/dotnet/dnrrd_binding_test.csproj b/bindings/dotnet/dnrrd_binding_test.csproj new file mode 100644 index 0000000..5c8bdd0 --- /dev/null +++ b/bindings/dotnet/dnrrd_binding_test.csproj @@ -0,0 +1,69 @@ + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {2BB82CAE-A379-46D9-B2B5-13DC4DB3209C} + Exe + Properties + dnrrd_binding_test + dnrrd_binding_test + v3.5 + 512 + favicon.ico + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + 3.5 + + + 3.5 + + + 3.5 + + + + + + + + + + + {0688ED86-0E5F-4469-A7DB-D51024DE99E9} + dnrrdlib + + + + + + + + \ No newline at end of file diff --git a/bindings/dotnet/dnrrdlib.csproj b/bindings/dotnet/dnrrdlib.csproj new file mode 100644 index 0000000..41efc81 --- /dev/null +++ b/bindings/dotnet/dnrrdlib.csproj @@ -0,0 +1,63 @@ + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {0688ED86-0E5F-4469-A7DB-D51024DE99E9} + Library + Properties + dnrrdlib + dnrrdlib + v3.5 + 512 + favicon.ico + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + 3.5 + + + 3.5 + + + 3.5 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bindings/dotnet/favicon.ico b/bindings/dotnet/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..886aa73dc53705d702cbee1677beb681f7de9b38 GIT binary patch literal 1403 zcmZQzU<5(|0R}M0U}azs1F|%L7$l?s#Ec9aK$3yMfe}n$5dZ)GXIPsX&Jbi}$e^gG z$WY>A&oDLKm%&0?jUmO^f 0) + info = (rrd_info_t)Marshal.PtrToStructure(((rrd_info_t)info).next, typeof(rrd_info_t)); + else + info = null; + } + Console.WriteLine("Test Info: Successful!"); + //Console.WriteLine("Printing information..."); + //Info_Print(((rrd_info_t)info)); + } + static void Test_Update() + { + Console.WriteLine("Updating RRD..."); + ArrayList al = new ArrayList(); + + // set to false if you want to use random values + if (true) + { + al.Add("920804700:12345"); + al.Add("920805000:12357"); + al.Add("920805300:12363"); + al.Add("920805600:12363"); + al.Add("920805900:12363"); + al.Add("920806200:12373"); + al.Add("920806500:12383"); + al.Add("920806800:12393"); + al.Add("920807100:12399"); + al.Add("920807400:12405"); + al.Add("920807700:12411"); + al.Add("920808000:12415"); + al.Add("920808300:12420"); + al.Add("920808600:12422"); + al.Add("920808900:12423"); + } + else + { + UInt32 ts = 920804700; + for (int i = 0; i < 15; i++) + { + al.Add(ts.ToString() + ":" + rrd.Random()); + ts += 300; + } + } + int ret = rrd.Update(path + "test_a.rrd", null, (string[])al.ToArray(typeof(string))); + if (ret < 0) + Console.WriteLine("Error: " + rrd.Get_Error()); + else + Console.WriteLine("Test update: Successful!"); + } + static void Test_Fetch() + { + // FETCH + Console.WriteLine("Attempting Fetch..."); + ArrayList al = new ArrayList(); + al.Add("fetch"); + al.Add(path + "test_a.rrd"); + al.Add("AVERAGE"); + al.Add("--start"); + al.Add("920804400"); + al.Add("--end"); + al.Add("920809200"); + IntPtr data = new IntPtr(); + string[] rrds = new string[0]; + Int32 start = 0; + Int32 end = 0; + UInt32 step = 0; + UInt32 dscnt = 0; + int ret = rrd.Fetch((string[])al.ToArray(typeof(string)), ref start, ref end, + ref step, ref dscnt, ref rrds, ref data); + + if (end > start) + { + for (Int32 ti = start + (Int32)step; ti <= end; ti += (Int32)step) + { + Console.Write(ti + ": "); + for (Int32 i = 0; i < (Int32)dscnt; i++) + { + Console.Write(((double)Marshal.PtrToStructure(data, typeof(double))).ToString(" 0.0000000000e+00")); + data = new IntPtr(data.ToInt64() + sizeof(double)); + } + Console.Write(Environment.NewLine); + } + } + + if (ret < 0) + Console.WriteLine("Error: " + rrd.Get_Error()); + else + Console.WriteLine("Test fetch: Successful!"); + } + static void Test_Graph() + { + Console.WriteLine("Creating graph..."); + ArrayList al = new ArrayList(); + al.Add("graph"); + al.Add(path + "graph_simple.png"); + al.Add("--start"); + al.Add("920804400"); + al.Add("--end"); + al.Add("920808000"); + al.Add("DEF:myspeed=" + path.Replace(":", "\\:") + "test_a.rrd:speed:AVERAGE"); + al.Add("LINE2:myspeed#00004D"); + int ret = rrd.Graph((string[])al.ToArray(typeof(string))); + if (ret < 0) + Console.WriteLine("Error: " + rrd.Get_Error()); + else + Console.WriteLine("Test graph: Successful!"); + } + static void Test_Graph_Math() + { + Console.WriteLine("Creating graph..."); + ArrayList al = new ArrayList(); + al.Add("graph"); + al.Add(path + "graph_math.png"); + al.Add("--start"); + al.Add("920804400"); + al.Add("--end"); + al.Add("920808000"); + al.Add("--vertical-label"); + al.Add("m/s"); + al.Add("DEF:myspeed=" + path.Replace(":", "\\:") + "test_a.rrd:speed:AVERAGE"); + al.Add("CDEF:realspeed=myspeed,1000,*"); + al.Add("LINE2:realspeed#00004D"); + int ret = rrd.Graph((string[])al.ToArray(typeof(string))); + if (ret < 0) + Console.WriteLine("Error: " + rrd.Get_Error()); + else + Console.WriteLine("Test graph: Successful!"); + } + static void Test_Graph_Math2() + { + Console.WriteLine("Creating graph..."); + ArrayList al = new ArrayList(); + al.Add("graph"); + al.Add(path + "graph_math2.png"); + al.Add("--start"); + al.Add("920804400"); + al.Add("--end"); + al.Add("920808000"); + al.Add("--vertical-label"); + al.Add("m/s"); + al.Add("DEF:myspeed=" + path.Replace(":", "\\:") + "test_a.rrd:speed:AVERAGE"); + al.Add("CDEF:kmh=myspeed,3600,*"); + al.Add("CDEF:fast=kmh,100,GT,kmh,0,IF"); + al.Add("CDEF:good=kmh,100,GT,0,kmh,IF"); + al.Add("HRULE:100#0000FF:\"Maximum allowed\""); + al.Add("AREA:good#00FF00:\"Good speed\""); + al.Add("AREA:fast#FF0000:\"Too fast\""); + int ret = rrd.Graph((string[])al.ToArray(typeof(string))); + if (ret < 0) + Console.WriteLine("Error: " + rrd.Get_Error()); + else + Console.WriteLine("Test graph: Successful!"); + } + static void Test_Graph_Math3() + { + Console.WriteLine("Creating graph..."); + ArrayList al = new ArrayList(); + al.Add("graph"); + al.Add(path + "graph_math3.png"); + al.Add("--start"); + al.Add("920804400"); + al.Add("--end"); + al.Add("920808000"); + al.Add("--vertical-label"); + al.Add("m/s"); + al.Add("DEF:myspeed=" + path.Replace(":", "\\:") + "test_a.rrd:speed:AVERAGE"); + al.Add("CDEF:nonans=myspeed,UN,0,myspeed,IF"); + al.Add("CDEF:kmh=nonans,3600,*"); + al.Add("CDEF:fast=kmh,100,GT,100,0,IF"); + al.Add("CDEF:over=kmh,100,GT,kmh,100,-,0,IF"); + al.Add("CDEF:good=kmh,100,GT,0,kmh,IF"); + al.Add("HRULE:100#0000FF:\"Maximum allowed\""); + al.Add("AREA:good#00FF00:\"Good speed\""); + al.Add("AREA:fast#550000:\"Too fast\""); + al.Add("STACK:over#FF0000:\"Over speed\""); + int ret = rrd.Graph((string[])al.ToArray(typeof(string))); + if (ret < 0) + Console.WriteLine("Error: " + rrd.Get_Error()); + else + Console.WriteLine("Test graph: Successful!"); + } + static void Test_First_Last() + { + Console.WriteLine("Testing values..."); + Console.WriteLine("First Value: " + rrd.First(path + "test_a.rrd", 0)); + string err = rrd.Get_Error(); + if (err.Length > 1) + Console.WriteLine("Error: " + err); + Console.WriteLine("Last Value: " + rrd.Last(path + "test_a.rrd", 0)); + err = rrd.Get_Error(); + if (err.Length > 1) + Console.WriteLine("Error: " + err); + + Int32 last_update = 0; + UInt32 ds_count = 0; + string[] ds_names = new string[0]; + string[] last_ds = new string[0]; + rrd.Last_Update(path + "test_a.rrd", ref last_update, ref ds_count, ref ds_names, ref last_ds); + Console.WriteLine("Last Update: " + last_update); + Console.WriteLine("Value testing successful!"); + } + static void Test_Dump() + { + Console.WriteLine("Dumping RRD..."); + int ret = rrd.Dump(path + "test_a.rrd", path + "test_a.xml"); + if (ret < 0) + Console.WriteLine("Error: " + rrd.Get_Error()); + else + Console.WriteLine("Test Dump: Successful!"); + } + static void Test_Xport() + { + Console.WriteLine("Exporting RRD..."); + ArrayList al = new ArrayList(); + al.Add("xport"); + al.Add("--start"); + al.Add("920804400"); + al.Add("--end"); + al.Add("920808000"); + al.Add("DEF:myspeed=" + path.Replace(":", "\\:") + "test_a.rrd:speed:AVERAGE"); + al.Add("XPORT:myspeed:\"MySpeed\""); + IntPtr data = new IntPtr(); + string[] legends = new string[0]; + Int32 start = 0; + Int32 end = 0; + UInt32 step = 0; + UInt32 col_cnt = 0; + int ret = rrd.Xport((string[])al.ToArray(typeof(string)), ref start, ref end, + ref step, ref col_cnt, ref legends, ref data); + + if (end > start) + { + for (Int32 ti = start + (Int32)step; ti <= end; ti += (Int32)step) + { + Console.Write(ti + ": "); + for (Int32 i = 0; i < (Int32)col_cnt; i++) + { + Console.Write(((double)Marshal.PtrToStructure(data, typeof(double))).ToString(" 0.0000000000e+00")); + data = new IntPtr(data.ToInt64() + sizeof(double)); + } + Console.Write(Environment.NewLine); + } + } + if (ret < 0) + Console.WriteLine("Error: " + rrd.Get_Error()); + else + Console.WriteLine("Test xport: Successful!"); + } + static void Test_Restore() + { + Console.WriteLine("Restoring RRD..."); + ArrayList al = new ArrayList(); + al.Add("restore"); + al.Add(path + "test_a.xml"); + al.Add(path + "restored_a.rrd"); + int ret = rrd.Restore((string[])al.ToArray(typeof(string))); + if (ret < 0) + Console.WriteLine("Error: " + rrd.Get_Error()); + else + Console.WriteLine("Test restore: Successful!"); + } + static void Test_Tune() + { + Console.WriteLine("Tuning RRD..."); + ArrayList al = new ArrayList(); + al.Add("tune"); + al.Add(path + "restored_a.rrd"); + al.Add("-h"); + al.Add("speed:650"); + int ret = rrd.Tune((string[])al.ToArray(typeof(string))); + if (ret < 0) + Console.WriteLine("Error: " + rrd.Get_Error()); + else + Console.WriteLine("Test tune: Successful!"); + } + } +} diff --git a/bindings/dotnet/rrdlib.cs b/bindings/dotnet/rrdlib.cs new file mode 100644 index 0000000..d6f9079 --- /dev/null +++ b/bindings/dotnet/rrdlib.cs @@ -0,0 +1,407 @@ +/***************************************************************************** + * RRDLIB .NET Binding + ***************************************************************************** + * Created 2010/06/29 by Chris Larsen + * + * This .NET interface allows the use of Tobias Oetiker's awesome RRDtool + * functions in .NET projects using the PInvoke method to load the rrdlib.dll + * To use, please make sure that you place the rrdlib.dll in the same + * directory as this dll, or change the "const string dll" to point to the + * proper location. For documentation, please see the RRDtool website at: + * http://oss.oetiker.ch/rrdtool/ + * For useage examples, please see the rrd_binding_test project. + ****************************************************************************/ +using System; +using System.Runtime.InteropServices; + +/// +/// Contains data structures and methods for working with round robin databases. +/// +namespace dnrrdlib +{ + /// + /// Information about a particular RRD parameter. The key is the name of the parameter, + /// type determines what kind of value we have, value is the value, and next is a + /// pointer to another info object. + /// + [StructLayout(LayoutKind.Explicit, Pack = 1)] + public struct rrd_info_t + { + [FieldOffset(0), MarshalAs(UnmanagedType.LPStr)] + public string key; + [FieldOffset(4)] // for 64 bit, set this to 8 and increment everyone else by 4 + public rrd_info_type_t type; + [FieldOffset(8)] + public rrd_infoval_t value; + [FieldOffset(16)] + public IntPtr next; + } + + /// + /// This is a chunk of data returned from an RRD object + /// + [StructLayout(LayoutKind.Sequential)] + public struct rrd_blob_t + { + public UInt32 size; /* size of the blob */ + public IntPtr ptr; /* pointer */ + }; + + /// + /// This contains the actual data values for an rrd_info_t structure. + /// NOTE: Only one of these will be valid per instance. Use the containing info_t's + /// type field to deteremine which of these to read. + /// NOTE: If the type is RD_I_STR, you have to marshal the string value yourself + /// + [StructLayout(LayoutKind.Explicit)] + public struct rrd_infoval_t + { + [FieldOffset(0)] + public UInt32 u_cnt; + [FieldOffset(0)] + public double u_val; + [FieldOffset(0)] + public IntPtr u_str; + [FieldOffset(0)] + public Int32 u_int; + [FieldOffset(0)] + public rrd_blob_t u_blo; + }; + + /// + /// Different rrd_info_t value types + /// + public enum rrd_info_type_t + { + RD_I_VAL = 0, + RD_I_CNT, + RD_I_STR, + RD_I_INT, + RD_I_BLO + }; + + /// + /// Direct bindings to the RRD Library for .NET applications. Uses the PInvoke method + /// of accessing the rrdlib.dll file. + /// + public class rrd + { + // Set this path to the location of your "rrdlib.dll" file + const string dll = @"rrdlib.dll"; + + // IMPORTS - Main methods + [DllImport(dll)] static extern Int32 rrd_create(Int32 argc, string[] argv); + [DllImport(dll)] static extern Int32 rrd_create_r([MarshalAs(UnmanagedType.LPStr)] string filename, + UInt32 pdp_step, Int32 last_up, Int32 argc, [MarshalAs(UnmanagedType.LPArray)] string[] argv); + [DllImport(dll)] static extern IntPtr rrd_info_r(string filename); + [DllImport(dll)] static extern void rrd_info_print(IntPtr data); + [DllImport(dll)] static extern Int32 rrd_update(Int32 argc, string[] argv); + [DllImport(dll)] static extern IntPtr rrd_update_v(Int32 argc, string[] argv); + [DllImport(dll)] static extern Int32 rrd_update_r(string filename, string template, Int32 argc, + string[] argv); + /* Do not use this until someone adds the FILE structure */ + [DllImport(dll)] static extern Int32 rrd_graph(Int32 argc, string[] argv, ref string[] prdata, + ref Int32 xsize, ref Int32 ysize, /* TODO - FILE, */ ref double ymin, ref double ymax); + [DllImport(dll)] static extern Int32 rrd_graph_v(Int32 argc, string[] argv); + [DllImport(dll)] static extern Int32 rrd_fetch(Int32 argc, string[] argv, ref Int32 start, + ref Int32 end, ref UInt32 step, ref UInt32 ds_cnt, ref string[] ds_namv, ref IntPtr data); + [DllImport(dll)] static extern Int32 rrd_first(Int32 argc, string[] argv); + [DllImport(dll)] static extern Int32 rrd_first_r(string filename, Int32 rraindex); + [DllImport(dll)] static extern Int32 rrd_last(Int32 argc, string[] argv); + [DllImport(dll)] static extern Int32 rrd_last_r(string filename, Int32 rraindex); + [DllImport(dll)] static extern Int32 rrd_lastupdate(Int32 argc, string[] argv); + [DllImport(dll)] static extern Int32 rrd_lastupdate_r(string filename, ref Int32 ret_last_update, + ref UInt32 ret_ds_count, ref string[] ret_ds_names, ref string[] ret_last_ds); + [DllImport(dll)] static extern Int32 rrd_dump(Int32 argc, string[] argv); + [DllImport(dll)] static extern Int32 rrd_dump_r(string filename, string outname); + [DllImport(dll)] static extern Int32 rrd_xport(Int32 argc, string[] argv, Int32 unused, + ref Int32 start, ref Int32 end, ref UInt32 step, ref UInt32 col_cnt, + ref string[] leggend_v, ref IntPtr data); + [DllImport(dll)] static extern Int32 rrd_restore(Int32 argc, string[] argv); + [DllImport(dll)] static extern Int32 rrd_resize(Int32 argc, string[] argv); + [DllImport(dll)] static extern Int32 rrd_tune(Int32 argc, string[] argv); + + // IMPORTS - Utility methods + [DllImport(dll)] static extern string rrd_strversion(); + [DllImport(dll)] static extern Int32 rrd_random(); + [DllImport(dll)] static extern string rrd_get_error(); + + // MAIN FUNCTIONS + + /// + /// The create function of RRDtool lets you set up new Round Robin Database (RRD) files. + /// The file is created at its final, full size and filled with *UNKNOWN* data. + /// + /// String array of command line arguments + /// 0 if successful, -1 if an error occurred + public static int Create(string[] argv) + { + return rrd_create(argv.GetUpperBound(0) + 1, argv); + } + + /// + /// The create function of RRDtool lets you set up new Round Robin Database (RRD) files. + /// The file is created at its final, full size and filled with *UNKNOWN* data. + /// + /// A full path to the location where you want the rrd to reside + /// Specifies the base interval in seconds with which data will be fed into the RRD + /// Timestamp of the last update + /// String array of command line arguments + /// 0 if successful, -1 if an error occurred + public static int Create(string filename, UInt32 pdp_step, Int32 last_up, string[] argv) + { + return rrd_create_r(filename, pdp_step, last_up, argv.GetUpperBound(0)+1, argv); + } + + /// + /// Returns a linked list of rrd_info_t objects that describe the rrd file. + /// + /// Full path to the rrd file + /// An rrd_info_t object + public static rrd_info_t Info(string filename) + { + if (filename.Length < 1) + throw new Exception("Empty filename"); + IntPtr ptr = rrd_info_r(filename); + if (ptr == IntPtr.Zero || (int)ptr < 1) + throw new Exception("Unable to extract information from rrd"); + return (rrd_info_t)Marshal.PtrToStructure(ptr, typeof(rrd_info_t)); + } + + /// + /// The update function feeds new data values into an RRD. The data is time aligned (interpolated) + /// according to the properties of the RRD to which the data is written. + /// + /// String array of command line arguments + /// 0 if successful, -1 if an error occurred + public static Int32 Update(string[] argv) + { + return rrd_update(argv.GetUpperBound(0) + 1, argv); + } + + /// + /// The update function feeds new data values into an RRD. The data is time aligned (interpolated) + /// according to the properties of the RRD to which the data is written. + /// + /// String array of command line arguments + /// An rrd_info_t pointer with information about the update + public static IntPtr Update2(string[] argv) + { + return rrd_update_v(argv.GetUpperBound(0) + 1, argv); + } + + /// + /// The update function feeds new data values into an RRD. The data is time aligned (interpolated) + /// according to the properties of the RRD to which the data is written. + /// + /// Full path to the rrd to update + /// List of data sources to update and in which order + /// String array of command line arguments + /// 0 if successful, -1 if an error occurred + public static Int32 Update(string filename, string template, string[] argv) + { + return rrd_update_r(filename, template, argv.GetUpperBound(0)+1, argv); + } + + /// + /// Generate a graph from an RRD file. Specify all the graph options in the string array as you + /// normally would with the command line version. + /// + /// String array of command line arguments + /// 0 if successful, -1 if an error occurred + public static Int32 Graph(string[] argv) + { + return rrd_graph_v(argv.GetUpperBound(0) + 1, argv); + } + + /// + /// Returns an array of values for the period specified from a given rrd. + /// Specify your parameters in the argv array and check the referenced parameters for + /// values returned from the rrd + /// + /// String array of command line arguments (must include the filename) + /// Starting timestamp found in the rrd + /// Ending timestamp found in the rrd + /// The rrd's step value + /// Number of data sources found + /// Names of data sources found + /// Values found (in double type) + /// 0 if successful, -1 if an error occurred + public static Int32 Fetch(string[] argv, ref Int32 start, ref Int32 end, ref UInt32 step, + ref UInt32 ds_cnt, ref string[] ds_namv, ref IntPtr data) + { + return rrd_fetch(argv.GetUpperBound(0) + 1, argv, ref start, ref end, ref step, ref ds_cnt, + ref ds_namv, ref data); + } + + /// + /// Returns the timestamp of the first value in the rrd given the rra index + /// + /// Full path to the rrd file + /// 0 based index of the rra to get a value for + /// Unix timestamp if successful, -1 if an error occurred + public static Int32 First(string filename, int rraindex) + { + return rrd_first_r(filename, rraindex); + } + + /// + /// Returns the timestamp of the first value in the rrd + /// + /// String array of command line arguments + /// Unix timestamp if successful, -1 if an error occurred + public static Int32 First(string[] argv) + { + return rrd_first(argv.GetUpperBound(0) + 1, argv); + } + + /// + /// Returns the timestamp of the last value in the rrd given the rra index + /// + /// + /// Full path to the rrd file + /// 0 based index of the rra to get a value for + /// Unix timestamp if successful, -1 if an error occurred + public static Int32 Last(string filename, int rraindex) + { + return rrd_last_r(filename, rraindex); + } + + /// + /// Returns the timestamp of the last value in the rrd + /// + /// String array of command line arguments + /// Unix timestamp if successful, -1 if an error occurred + public static Int32 Last(string[] argv) + { + return rrd_last(argv.GetUpperBound(0) + 1, argv); + } + + /// + /// Finds the timestamp of the last updated value in the rrd + /// + /// Full path to the rrd file + /// Unix timestamp of the last update + /// Number of data sources found + /// Names of the data sources found + /// Name of the last data source found + /// 0 if successful, -1 if an error occurred + public static Int32 Last_Update(string filename, ref Int32 ret_last_update, ref UInt32 ret_ds_count, + ref string[] ret_ds_names, ref string[] ret_last_ds) + { + return rrd_lastupdate_r(filename, ref ret_last_update, ref ret_ds_count, ref ret_ds_names, + ref ret_last_ds); + } + + /// + /// Writes the contents of an rrd file to an XML file + /// + /// Full path to the rrd file + /// Full path to write the XML output + /// 0 if successful, -1 if an error occurred + public static Int32 Dump(string filename, string outname) + { + return rrd_dump_r(filename, outname); + } + + /// + /// Writes the contents of an rrd file to an XML file + /// + /// String array of command line arguments + /// 0 if successful, -1 if an error occurred + public static Int32 Dump(string[] argv) + { + return rrd_dump(argv.GetUpperBound(0) + 1, argv); + } + + /// + /// Grabs the values from an rrd. Similar to fetch but enables merging of multiple + /// rrds and calculations + /// + /// String array of command line arguments + /// Starting timestamp found in the rrd + /// Ending timestamp found in the rrd + /// Step size found in the rrd + /// Number of data sources found in the rrd + /// Add a legend + /// Values from the rrd as double type + /// 0 if successful, -1 if an error occurred + public static Int32 Xport(string[] argv, ref Int32 start, ref Int32 end, ref UInt32 step, + ref UInt32 col_cnt, ref string[] leggend_v, ref IntPtr data) + { + return rrd_xport(argv.GetUpperBound(0) + 1, argv, 0, ref start, ref end, ref step, ref col_cnt, + ref leggend_v, ref data); + } + + /// + /// Creates an rrd from an XML data dump + /// + /// String array of command line arguments + /// 0 if successful, -1 if an error occurred + public static Int32 Restore(string[] argv) + { + return rrd_restore(argv.GetUpperBound(0) + 1, argv); + } + + /// + /// Alters the size of an RRA and creates a new rrd in the dll's directory + /// NOTE: The new rrd may return unexpected results if you are not very careful + /// NOTE: This may crash in version 1.4.3 + /// + /// String array of command line arguments + /// 0 if successful, -1 if an error occurred + public static Int32 Resize(string[] argv) + { + return rrd_resize(argv.GetUpperBound(0) + 1, argv); + } + + /// + /// Modify the characteristics of an rrd + /// + /// String array of command line arguments + /// 0 if successful, -1 if an error occurred + public static Int32 Tune(string[] argv) + { + return rrd_tune(argv.GetUpperBound(0) + 1, argv); + } + + // UTILITIES + /// + /// Returns a string with the numeric version of the rrdlib build version + /// + /// A string with version information + public static string Version() + { + return rrd_strversion(); + } + + /// + /// Generates a random number for testing rrdlib + /// + /// A random integer + public static int Random() + { + return rrd_random(); + } + + /// + /// Returns the latest error from rrdlib + /// + /// A string with the error message, or an emtpy string if no error occurred + public static string Get_Error() + { + return rrd_get_error(); + } + + /// + /// Formats and prints information in the object to the standard output + /// + /// rrd_info_t object with data to print + public static void Info_Print(rrd_info_t info) + { + IntPtr newptr = Marshal.AllocHGlobal(Marshal.SizeOf(info)); + Marshal.StructureToPtr(info, newptr, true); + rrd_info_print(newptr); + } + } +} diff --git a/bindings/dotnet/rrdlib.sln b/bindings/dotnet/rrdlib.sln new file mode 100644 index 0000000..4ae8ffe --- /dev/null +++ b/bindings/dotnet/rrdlib.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dnrrdlib", "dnrrdlib.csproj", "{0688ED86-0E5F-4469-A7DB-D51024DE99E9}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dnrrd_binding_test", "dnrrd_binding_test.csproj", "{2BB82CAE-A379-46D9-B2B5-13DC4DB3209C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0688ED86-0E5F-4469-A7DB-D51024DE99E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0688ED86-0E5F-4469-A7DB-D51024DE99E9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0688ED86-0E5F-4469-A7DB-D51024DE99E9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0688ED86-0E5F-4469-A7DB-D51024DE99E9}.Release|Any CPU.Build.0 = Release|Any CPU + {2BB82CAE-A379-46D9-B2B5-13DC4DB3209C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2BB82CAE-A379-46D9-B2B5-13DC4DB3209C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2BB82CAE-A379-46D9-B2B5-13DC4DB3209C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2BB82CAE-A379-46D9-B2B5-13DC4DB3209C}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/rrd.h b/src/rrd.h index 91bf660..fa02952 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 0415815..5c97b80 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 1101627..e4252db 100644 --- a/src/rrd_update.c +++ b/src/rrd_update.c @@ -1558,7 +1558,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 6853c66..3c4930f 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) { @@ -171,7 +176,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; @@ -183,8 +192,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