Update gauger C binding for W32
authorLRN <lrn1986@gmail.com>
Sat, 10 Nov 2012 05:51:20 +0000 (05:51 +0000)
committerLRN <lrn1986@gmail.com>
Sat, 10 Nov 2012 05:51:20 +0000 (05:51 +0000)
src/include/gauger.h

index 175837c3d72013f15071239ffa6e313c7db32687..c8b4c0e2c3b5e91c225fb789de1b4b7f9015a90b 100644 (file)
     }\
 }
 
-#else
+#else /* WINDOWS */
 
-#define GAUGER_ID(category, counter, value, unit, id) {}
-#define GAUGER(category, counter, value, unit) {}
+#include <stdlib.h>
+#include <stdio.h>
+#include <windef.h>
+
+#define GAUGER(category, counter, value, unit)\
+{\
+    char __gauger_commandline[MAX_PATH];\
+    \
+    snprintf (__gauger_commandline, MAX_PATH, "gauger.py -n %s -d %Lf -u %s -c %s",\
+        counter, (long double) (value), unit, category);\
+    __gauger_commandline[MAX_PATH - 1] = '\0';\
+    system (__gauger_commandline);\
+}
+
+#define GAUGER_ID(category, counter, value, unit, id)\
+{\
+    char __gauger_commandline[MAX_PATH];\
+    \
+    snprintf (__gauger_commandline, MAX_PATH, "gauger.py -n %s -d %Lf -u %s -i %s -c %s",\
+        counter, (long double) (value), unit, id, category);\
+    __gauger_commandline[MAX_PATH - 1] = '\0';\
+    system (__gauger_commandline);\
+}
 
 #endif // WINDOWS