[PD-dev] [PATCH 1/3] use platform auto macros: USEAPI_* macros instead of UNIX macro so that

Hans-Christoph Steiner hans at at.or.at
Mon Jul 19 19:41:22 CEST 2010


---
 extra/pd~/pd~.c           |    2 +-
 extra/sigmund~/sigmund~.c |    4 ++--
 src/Makefile.am           |    8 +-------
 src/m_glob.c              |    2 +-
 src/s_file.c              |    2 +-
 src/s_stuff.h             |    3 +--
 6 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/extra/pd~/pd~.c b/extra/pd~/pd~.c
index 204a6ab..dc2eca4 100644
--- a/extra/pd~/pd~.c
+++ b/extra/pd~/pd~.c
@@ -15,7 +15,7 @@
 #include <sys/stat.h>
 #include <sys/wait.h>
 
-#ifdef NT
+#ifdef _MSC_VER
 #pragma warning (disable: 4305 4244)
 #endif
 
diff --git a/extra/sigmund~/sigmund~.c b/extra/sigmund~/sigmund~.c
index c0cd67b..04f9490 100644
--- a/extra/sigmund~/sigmund~.c
+++ b/extra/sigmund~/sigmund~.c
@@ -13,7 +13,7 @@
 and usable in other contexts.  The one external requirement is a real
 single-precision FFT, invoked as in the Mayer one: */
 
-#ifdef NT
+#ifdef _MSC_VER /* this is only needed with Microsoft's compiler */
 __declspec(dllimport) extern
 #endif
 void mayer_realfft(int npoints, float *buf);
@@ -28,7 +28,7 @@ for example, defines this in the file d_fft_mayer.c or d_fft_fftsg.c. */
 #include <string.h>
 #ifdef _WIN32
 #include <malloc.h>
-#else
+#elif ! defined(_MSC_VER)
 #include <alloca.h>
 #endif
 #include <stdlib.h>
diff --git a/src/Makefile.am b/src/Makefile.am
index 4161a06..c090db0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -77,7 +77,7 @@ endif
 # handle a single MIDI API
 if OSS
 if !WINDOWS
-pd_CFLAGS += -DUSEAPI_OSS -DUNIX
+pd_CFLAGS += -DUSEAPI_OSS
 pd_SOURCES += s_audio_oss.c s_midi_oss.c
 endif
 endif
@@ -104,12 +104,6 @@ pd_SOURCES += s_midi_dummy.c
 endif
 
 if LINUX 
-# kludge, should use auto macros like __linux__. The UNIX macro seems
-# to mean "things that have been implemented with GNU/Linux in mind, but the
-# watchdog should work on Mac OS X and Cygwin, and OSS can work on FreeBSD,
-# Cygwin, etc.
-pd_CFLAGS += -DUNIX 
-
 libpdbindir = $(pkglibdir)/bin
 libpdbin_DATA = $(TCL_FILES)
 # this flag has to have a single leading "-" for libtool, even though ld uses
diff --git a/src/m_glob.c b/src/m_glob.c
index ca3b5d1..613603a 100644
--- a/src/m_glob.c
+++ b/src/m_glob.c
@@ -130,7 +130,7 @@ void glob_init(void)
         gensym("version"), A_FLOAT, 0);
     class_addmethod(glob_pdobject, (t_method)glob_perf,
         gensym("perf"), A_FLOAT, 0);
-#ifdef UNIX
+#if defined(__linux__) || defined(IRIX) || defined(__FreeBSD_kernel__)
     class_addmethod(glob_pdobject, (t_method)glob_watchdog,
         gensym("watchdog"), 0);
 #endif
diff --git a/src/s_file.c b/src/s_file.c
index bca3e09..2fca46c 100644
--- a/src/s_file.c
+++ b/src/s_file.c
@@ -159,7 +159,7 @@ static void sys_donesavepreferences( void)
     }
 }
 
-#endif /* UNIX */
+#endif /* __linux__ || __CYGWIN__ || __FreeBSD_kernel__ || __GNU__ */
 
 #ifdef _WIN32
 
diff --git a/src/s_stuff.h b/src/s_stuff.h
index 57466ee..5e8b5e3 100644
--- a/src/s_stuff.h
+++ b/src/s_stuff.h
@@ -171,9 +171,8 @@ EXTERN void sys_closesocket(int fd);
 typedef void (*t_fdpollfn)(void *ptr, int fd);
 EXTERN void sys_addpollfn(int fd, t_fdpollfn fn, void *ptr);
 EXTERN void sys_rmpollfn(int fd);
-#ifdef UNIX
+#if defined(USEAPI_OSS) || defined(USEAPI_ALSA)
 void sys_setalarm(int microsec);
-void sys_setvirtualalarm( void);
 #endif
 
 #define API_NONE 0
-- 
1.6.1




More information about the Pd-dev mailing list