diff options
Diffstat (limited to 'externals/grill/flext/source')
-rw-r--r-- | externals/grill/flext/source/flbuf.cpp | 22 | ||||
-rw-r--r-- | externals/grill/flext/source/flfeatures.h | 34 |
2 files changed, 40 insertions, 16 deletions
diff --git a/externals/grill/flext/source/flbuf.cpp b/externals/grill/flext/source/flbuf.cpp index c19909b8..529d32d0 100644 --- a/externals/grill/flext/source/flbuf.cpp +++ b/externals/grill/flext/source/flbuf.cpp @@ -13,6 +13,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. */ #include "flext.h" +#include "flfeatures.h" #if FLEXT_SYS != FLEXT_SYS_JMAX @@ -20,15 +21,6 @@ WARRANTIES, see the file, "license.txt," in this distribution. #define DIRTY_INTERVAL 0 // buffer dirty check in msec #endif -// check if PD API supports buffer dirty time -#if defined(PD_DEVEL_VERSION) && defined(PD_MAJOR_VERSION) && defined(PD_MINOR_VERSION) -#if PD_MINOR_VERSION >= 36 && PD_MINOR_VERSION <= 38 -// garray_updatetime has been removed in devel_0_39 - #define FLEXT_HAVE_GARRAYUPDATETIME - #define FLEXT_HAVE_GARRAYLOCKS -#endif -#endif - #if FLEXT_SYS == FLEXT_SYS_MAX // defined in flsupport.cpp extern const t_symbol *sym_buffer,*sym_size; @@ -184,19 +176,18 @@ flext::buffer::lock_t flext::buffer::Lock() FLEXT_ASSERT(sym); #if FLEXT_SYS == FLEXT_SYS_PD FLEXT_ASSERT(arr); -#ifdef FLEXT_HAVE_GARRAYLOCKS +#ifdef _FLEXT_HAVE_PD_GARRAYLOCKS garray_lock(arr); #endif return false; #elif FLEXT_SYS == FLEXT_SYS_MAX t_buffer *p = (t_buffer *)sym->s_thing; FLEXT_ASSERT(p); -#if defined(MAC_VERSION) || defined(WIN_VERSION) +#ifdef _FLEXT_HAVE_MAX_INUSEFLAG long old = p->b_inuse; p->b_inuse = 1; return old; #else - // undefined for OS9 return 0; #endif #else @@ -209,14 +200,13 @@ void flext::buffer::Unlock(flext::buffer::lock_t prv) FLEXT_ASSERT(sym); #if FLEXT_SYS == FLEXT_SYS_PD FLEXT_ASSERT(arr); -#ifdef FLEXT_HAVE_GARRAYLOCKS +#ifdef _FLEXT_HAVE_PD_GARRAYLOCKS garray_unlock(arr); #endif #elif FLEXT_SYS == FLEXT_SYS_MAX t_buffer *p = (t_buffer *)sym->s_thing; FLEXT_ASSERT(p); -#if defined(MAC_VERSION) || defined(WIN_VERSION) - // not for OS9 +#ifdef _FLEXT_HAVE_MAX_INUSEFLAG p->b_inuse = prv; #endif #else @@ -339,7 +329,7 @@ bool flext::buffer::IsDirty() const FLEXT_ASSERT(sym); #if FLEXT_SYS == FLEXT_SYS_PD FLEXT_ASSERT(arr); - #ifdef FLEXT_HAVE_GARRAYUPDATETIME + #ifdef _FLEXT_HAVE_PD_GARRAYUPDATETIME return isdirty || garray_updatetime(arr) > cleantime; #else // Don't know.... (no method in PD judging whether buffer has been changed from outside flext...) diff --git a/externals/grill/flext/source/flfeatures.h b/externals/grill/flext/source/flfeatures.h new file mode 100644 index 00000000..915f44a9 --- /dev/null +++ b/externals/grill/flext/source/flfeatures.h @@ -0,0 +1,34 @@ +/*
+
+flext - C++ layer for Max/MSP and pd (pure data) externals
+
+Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+
+*/
+
+/*! \file flfeatures.h
+ \brief Detect version-specific features.
+*/
+
+#ifndef __FLFEATURES_H
+#define __FLFEATURES_H
+
+// check if PD API supports buffer dirty time
+#if defined(PD_DEVEL_VERSION) && defined(PD_MAJOR_VERSION) && defined(PD_MINOR_VERSION)
+#if PD_MINOR_VERSION >= 36 && PD_MINOR_VERSION <= 38
+// array locks have been removed in devel_0_39
+ #define _FLEXT_HAVE_PD_GARRAYLOCKS
+#endif
+#if PD_MINOR_VERSION >= 36
+ #define _FLEXT_HAVE_PD_GARRAYUPDATETIME
+#endif
+#endif
+
+#if defined(MAC_VERSION) || defined(WIN_VERSION)
+ // not for OS9
+ #define _FLEXT_HAVE_MAX_INUSEFLAG
+#endif
+
+#endif
|