diff options
Diffstat (limited to 'externals/grill')
-rw-r--r-- | externals/grill/flext/flext.cw | bin | 163616 -> 200817 bytes | |||
-rw-r--r-- | externals/grill/flext/readme.txt | 1 | ||||
-rw-r--r-- | externals/grill/flext/source/flext.h | 4 | ||||
-rwxr-xr-x | externals/grill/flext/source/flprefix.h | 103 | ||||
-rw-r--r-- | externals/grill/flext/source/flsupport.h | 2 | ||||
-rw-r--r-- | externals/grill/flext/source/flthr.cpp | 10 | ||||
-rw-r--r-- | externals/grill/flext/source/flutil.cpp | 5 | ||||
-rw-r--r-- | externals/grill/flext/tutorial/thread1/thread1.cw | bin | 67826 -> 68426 bytes | |||
-rwxr-xr-x | externals/grill/flext/tutorial/thread2/thread2.cw | bin | 67800 -> 68426 bytes |
9 files changed, 123 insertions, 2 deletions
diff --git a/externals/grill/flext/flext.cw b/externals/grill/flext/flext.cw Binary files differindex 75210fc4..8c9bbb41 100644 --- a/externals/grill/flext/flext.cw +++ b/externals/grill/flext/flext.cw diff --git a/externals/grill/flext/readme.txt b/externals/grill/flext/readme.txt index 12afcdd0..e877acc0 100644 --- a/externals/grill/flext/readme.txt +++ b/externals/grill/flext/readme.txt @@ -98,6 +98,7 @@ Version history: - fixed crash issue in flext_dsp when there are NO signal inlets or outlets defined (this is possibly only a problem for the signal2 tutorial example) - added flext::GetType(t_atom &) +- added flext::ZeroMem 0.4.0: - the use of the const keyword is enforced (e.g. the preferred type for symbols is now "const t_symbol *") diff --git a/externals/grill/flext/source/flext.h b/externals/grill/flext/source/flext.h index c1cd7597..4933c91d 100644 --- a/externals/grill/flext/source/flext.h +++ b/externals/grill/flext/source/flext.h @@ -30,11 +30,11 @@ WARRANTIES, see the file, "license.txt," in this distribution. //! @} - - #ifdef FLEXT_THREADS +extern "C" { #include <pthread.h> #include <sched.h> +} #endif diff --git a/externals/grill/flext/source/flprefix.h b/externals/grill/flext/source/flprefix.h new file mode 100755 index 00000000..973a6966 --- /dev/null +++ b/externals/grill/flext/source/flprefix.h @@ -0,0 +1,103 @@ +/* + +flext - C++ layer for Max/MSP and pd (pure data) externals + +Copyright (c) 2001,2002 Thomas Grill (xovo@gmx.net) +For information on usage and redistribution, and for a DISCLAIMER OF ALL +WARRANTIES, see the file, "license.txt," in this distribution. + +*/ + +/*! \file flprefix.h + \brief Try to find out the platform. +*/ + +#ifndef __FLEXT_PREFIX_H +#define __FLEXT_PREFIX_H + +// definitions for FLEXT_SYS +#define FLEXT_SYS_UNKNOWN 0 +#define FLEXT_SYS_MAX 1 +#define FLEXT_SYS_PD 2 + +// definitions for FLEXT_OS +#define FLEXT_OS_UNKNOWN 0 +#define FLEXT_OS_WIN 1 +#define FLEXT_OS_MACOS9 2 +#define FLEXT_OS_MACOSX 3 +#define FLEXT_OS_LINUX 4 +#define FLEXT_OS_IRIX 5 + +// definitions for FLEXT_CPU +#define FLEXT_CPU_UNKNOWN 0 +#define FLEXT_CPU_INTEL 1 +#define FLEXT_CPU_PPC 2 +#define FLEXT_CPU_MIPS 3 + + +// Old definitions +#if defined(MAXMSP) + #define FLEXT_SYS FLEXT_SYS_MAX + #undef MAXMSP +#elif defined(PD) + #define FLEXT_SYS FLEXT_SYS_PD + #undef PD + #undef NT +#endif + +// Definition of supported real-time systems +#if FLEXT_SYS == FLEXT_SYS_MAX +#elif FLEXT_SYS == FLEXT_SYS_PD + #define PD +#else + #error "System must be defined by either FLEXT_SYS_MAX or FLEXT_SYS_PD" +#endif + +// Definition of OS/CPU +#if defined(_MSC_VER) + // Microsoft C++ + +#elif defined(__MWERKS__) + // Metrowerks CodeWarrior + + #if defined(__INTEL__) + #define FLEXT_CPU FLEXT_CPU_INTEL + #elif defined(__POWERPC__) + #define FLEXT_CPU FLEXT_CPU_PPC + #elif defined(__MIPS__) + #define FLEXT_CPU FLEXT_CPU_MIPS + #elif defined(__POWERPC__) + #define FLEXT_CPU FLEXT_CPU_UNKNOWN + #endif + +#elif defined(__GNUG__) + // GNU C++ + +#endif + + +#if FLEXT_OS == FLEXT_OS_WIN + #if FLEXT_SYS == FLEXT_SYS_MAX + #define WIN_VERSION 1 + #elif FLEXT_SYS == FLEXT_SYS_PD + #define NT + #endif +#elif FLEXT_OS == FLEXT_OS_LINUX + #if FLEXT_SYS == FLEXT_SYS_MAX + #error "Flext SYS/OS combination unknown" + #endif +#elif FLEXT_OS == FLEXT_OS_IRIX + #if FLEXT_SYS == FLEXT_SYS_MAX + #error "Flext SYS/OS combination unknown" + #endif +#elif FLEXT_OS == FLEXT_OS_MACOS9 + #if FLEXT_SYS == FLEXT_SYS_PD + #error "Flext SYS/OS combination unknown" + #endif +#elif FLEXT_OS == FLEXT_OS_MACOSX +#else + #error "Operating system could not be determined" +#endif + + +#endif diff --git a/externals/grill/flext/source/flsupport.h b/externals/grill/flext/source/flsupport.h index d8dce68d..022aaae9 100644 --- a/externals/grill/flext/source/flsupport.h +++ b/externals/grill/flext/source/flsupport.h @@ -121,6 +121,8 @@ public: static t_atom *CopyList(int argc,const t_atom *argv); //! Copy a memory region static void CopyMem(void *dst,const void *src,int bytes); + //! Zero a memory region + static void ZeroMem(void *dst,int bytes); //! Sleep for an amount of time static void Sleep(float s); diff --git a/externals/grill/flext/source/flthr.cpp b/externals/grill/flext/source/flthr.cpp index 705f1631..2a3ad3df 100644 --- a/externals/grill/flext/source/flthr.cpp +++ b/externals/grill/flext/source/flthr.cpp @@ -54,6 +54,8 @@ bool flext_base::StartThread(void *(*meth)(thr_params *p),thr_params *p,char *me parm.sched_priority = prio-1; pthread_setschedparam(id,policy,&parm); } + +// post("Create thread"); pthread_t thrid; int ret = pthread_create (&thrid,&attr,(void *(*)(void *))meth,p); @@ -66,6 +68,8 @@ bool flext_base::StartThread(void *(*meth)(thr_params *p),thr_params *p,char *me #ifdef _DEBUG error((char *)(ret == EAGAIN?"%s - Unsufficient resources to launch thread!":"%s - Could not launch method!"),methname); #endif + error((char *)("%s - Could not launch method!"),methname); + delete p; return false; } @@ -73,6 +77,8 @@ bool flext_base::StartThread(void *(*meth)(thr_params *p),thr_params *p,char *me #ifdef MAXMSP sched_yield(); #endif +// post("Create thread: OK"); + return true; } } @@ -81,6 +87,8 @@ bool flext_base::PushThread() { tlmutex.Lock(); +// post("Push thread"); + // make an entry into thread list thr_entry *nt = new thr_entry; if(thrtail) thrtail->nxt = nt; @@ -130,6 +138,8 @@ void flext_base::PopThread() { tlmutex.Lock(); +// post("Pop thread"); + pthread_t id = pthread_self(); thr_entry *prv = NULL,*ti; diff --git a/externals/grill/flext/source/flutil.cpp b/externals/grill/flext/source/flutil.cpp index 284ce35c..5307b820 100644 --- a/externals/grill/flext/source/flutil.cpp +++ b/externals/grill/flext/source/flutil.cpp @@ -45,6 +45,11 @@ void flext::CopyMem(void *dst,const void *src,int bytes) #endif } +void flext::ZeroMem(void *dst,int bytes) +{ + memset(dst,0,bytes); +} + void flext::Sleep(float s) { #ifdef NT diff --git a/externals/grill/flext/tutorial/thread1/thread1.cw b/externals/grill/flext/tutorial/thread1/thread1.cw Binary files differindex a50b78a7..f5cb4b53 100644 --- a/externals/grill/flext/tutorial/thread1/thread1.cw +++ b/externals/grill/flext/tutorial/thread1/thread1.cw diff --git a/externals/grill/flext/tutorial/thread2/thread2.cw b/externals/grill/flext/tutorial/thread2/thread2.cw Binary files differindex cf05a499..af968e69 100755 --- a/externals/grill/flext/tutorial/thread2/thread2.cw +++ b/externals/grill/flext/tutorial/thread2/thread2.cw |