ChangeLog: update for 0.4.4
[aubio.git] / tests / utils_tests.h
index 8ab5fe7..97d5297 100644 (file)
@@ -5,12 +5,28 @@
 #include <assert.h>
 #include "config.h"
 
+#ifdef HAVE_C99_VARARGS_MACROS
+#define PRINT_ERR(...)   fprintf(stderr, "AUBIO-TESTS ERROR: " __VA_ARGS__)
+#define PRINT_MSG(...)   fprintf(stdout, __VA_ARGS__)
+#define PRINT_DBG(...)   fprintf(stderr, __VA_ARGS__)
+#define PRINT_WRN(...)   fprintf(stderr, "AUBIO-TESTS WARNING: " __VA_ARGS__)
+#else
 #define PRINT_ERR(format, args...)   fprintf(stderr, "AUBIO-TESTS ERROR: " format , ##args)
 #define PRINT_MSG(format, args...)   fprintf(stdout, format , ##args)
 #define PRINT_DBG(format, args...)   fprintf(stderr, format , ##args)
 #define PRINT_WRN(format, args...)   fprintf(stderr, "AUBIO-TESTS WARNING: " format, ##args)
+#endif
+
+#ifndef M_PI
+#define M_PI         (3.14159265358979323846)
+#endif
 
-#ifdef HAVE_WIN_HACKS
+#ifndef RAND_MAX
+#define RAND_MAX 32767
+#endif
+
+// are we on windows ? or are we using -std=c99 ?
+#if defined(HAVE_WIN_HACKS) || defined(__STRICT_ANSI__)
 // http://en.wikipedia.org/wiki/Linear_congruential_generator
 // no srandom/random on win32
 
@@ -26,7 +42,9 @@ uint_t random(void) {
 }
 #endif
 
-void utils_init_random () {
+void utils_init_random (void);
+
+void utils_init_random (void) {
   time_t now = time(0);
   struct tm *tm_struct = localtime(&now);
   int seed = tm_struct->tm_sec;