From 02a91a1c1287fea5932bde76ceaece20cb69d1e1 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Tue, 24 Aug 2004 02:34:30 +0000 Subject: "" svn path=/trunk/; revision=1972 --- externals/grill/flext/source/flattr.cpp | 2 +- externals/grill/flext/source/flprefix.h | 4 ++-- externals/grill/flext/source/flstdc.h | 16 +++++++++++----- externals/grill/flext/source/flthr.cpp | 31 +------------------------------ 4 files changed, 15 insertions(+), 38 deletions(-) (limited to 'externals/grill/flext/source') diff --git a/externals/grill/flext/source/flattr.cpp b/externals/grill/flext/source/flattr.cpp index 4890e62a..30b8fea1 100644 --- a/externals/grill/flext/source/flattr.cpp +++ b/externals/grill/flext/source/flattr.cpp @@ -169,7 +169,7 @@ bool flext_base::InitAttrib(int argc,const t_atom *argv) bool flext_base::ListAttrib() const { - if(procattr) { + if(procattr) { AtomList la; ListAttrib(la); ToOutAnything(GetOutAttr(),MakeSymbol("attributes"),la.Count(),la.Atoms()); diff --git a/externals/grill/flext/source/flprefix.h b/externals/grill/flext/source/flprefix.h index 626ff70a..ba9b4b50 100755 --- a/externals/grill/flext/source/flprefix.h +++ b/externals/grill/flext/source/flprefix.h @@ -340,8 +340,8 @@ WARRANTIES, see the file, "license.txt," in this distribution. #ifdef FLEXT_THREADS #undef FLEXT_THREADS - #if FLEXT_OS == FLEXT_OS_MAC && FLEXT_SYS == FLEXT_SYS_MAX - // Max crashes with posix threads (because it's in the CFM model) + #if FLEXT_SYS == FLEXT_SYS_MAX && FLEXT_OS == FLEXT_OS_MAC && FLEXT_OSAPI != FLEXT_OSAPI_MAC_MACH + // Max for CFM doesn't like posix threads #define FLEXT_THREADS FLEXT_THR_MP #elif FLEXT_SYS == FLEXT_SYS_MAX && FLEXT_OS == FLEXT_OS_WIN // for wmax use native Windows threads diff --git a/externals/grill/flext/source/flstdc.h b/externals/grill/flext/source/flstdc.h index 5f503f1f..97dacd54 100644 --- a/externals/grill/flext/source/flstdc.h +++ b/externals/grill/flext/source/flstdc.h @@ -96,12 +96,18 @@ typedef t_clock t_qelem; // Include the relevant Max/MSP header files #if FLEXT_OS == FLEXT_OS_MAC - #ifndef __MRC__ - #define powerc - #endif - #define __MOTO__ 0 + #if FLEXT_OSAPI == FLEXT_OSAPI_MAC_MACH + // MachO version - must insert prefix header + #include + #else + // CFM version + #ifndef __MRC__ + #define powerc + #endif + #define __MOTO__ 0 - #include + #include + #endif #elif FLEXT_OS == FLEXT_OS_WIN #define WIN_VERSION 1 #endif diff --git a/externals/grill/flext/source/flthr.cpp b/externals/grill/flext/source/flthr.cpp index d6bc9276..8a7a841f 100644 --- a/externals/grill/flext/source/flthr.cpp +++ b/externals/grill/flext/source/flthr.cpp @@ -50,29 +50,6 @@ static bool thrhelpexit = false; static flext::ThrCond *thrhelpcond = NULL; -#if defined(FLEXT_THREADS) && FLEXT_SYS == FLEXT_SYS_MAX && FLEXT_OS == FLEXT_OS_MAC && FLEXT_THREADS == FLEXT_THR_POSIX -// utility code taken from from Apple's CFM_MachO_CFM example: -// -// This function allocates a block of CFM glue code which contains the instructions to call CFM routines -// -(void (*)(void *))MachOFunctionPointerForCFMFunctionPointer( (void (*)(void *))cfmfp ) -{ - // Apple utility code for CFM callback glue - static const UInt32 tmpl[6] = {0x3D800000, 0x618C0000, 0x800C0000, 0x804C0004, 0x7C0903A6, 0x4E800420}; - UInt32 *mfp = (UInt32*) NewPtr( sizeof(tmpl) ); // Must later dispose of allocated memory - // (this is freed with app heap in this object) - mfp[0] = tmpl[0] | ((UInt32)cfmfp >> 16); - mfp[1] = tmpl[1] | ((UInt32)cfmfp & 0xFFFF); - mfp[2] = tmpl[2]; - mfp[3] = tmpl[3]; - mfp[4] = tmpl[4]; - mfp[5] = tmpl[5]; - MakeDataExecutable( mfp, sizeof(tmpl) ); - return (void (*)(void *))mfp; -} -#endif - - flext::thrid_t flext::GetSysThreadId() { return thrid; } @@ -100,13 +77,7 @@ bool flext::StartHelper() pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_DETACHED); thrhelpexit = false; -#if FLEXT_SYS == FLEXT_SYS_MAX && FLEXT_OS == FLEXT_OS_MAC - void (*CFMThrHelper)(void *) = MachOFunctionPointerForCFMFunctionPointer(ThrHelper); - int ret = pthread_create (&thrhelpid,&attr,(void *(*)(void *))CFMThrHelper,NULL); -#else - int ret = pthread_create (&thrhelpid,&attr,(void *(*)(void *))ThrHelper,NULL); -#endif - ok = !ret; + ok = pthread_create (&thrhelpid,&attr,(void *(*)(void *))ThrHelper,NULL) == 0; #elif FLEXT_THREADS == FLEXT_THR_MP if(!MPLibraryIsLoaded()) error("Thread library is not loaded"); -- cgit v1.2.1