From 8248ce3d66a19f77ffe10ded4b922cf0606f47a4 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Sun, 20 Apr 2003 02:36:20 +0000 Subject: "" svn path=/trunk/; revision=579 --- externals/grill/flext/changes.txt | 270 +++++ externals/grill/flext/readme.txt | 259 ----- externals/grill/flext/source/fldefs.h | 1285 +----------------------- externals/grill/flext/source/fldefs_attradd.h | 119 +++ externals/grill/flext/source/fldefs_attrcb.h | 147 +++ externals/grill/flext/source/fldefs_attrvar.h | 147 +++ externals/grill/flext/source/fldefs_hdr.h | 53 + externals/grill/flext/source/fldefs_methadd.h | 227 +++++ externals/grill/flext/source/fldefs_methbind.h | 41 + externals/grill/flext/source/fldefs_methcall.h | 77 ++ externals/grill/flext/source/fldefs_methcb.h | 128 +++ externals/grill/flext/source/fldefs_meththr.h | 273 +++++ externals/grill/flext/source/fldefs_setup.h | 259 +++++ 13 files changed, 1754 insertions(+), 1531 deletions(-) create mode 100644 externals/grill/flext/changes.txt create mode 100644 externals/grill/flext/source/fldefs_attradd.h create mode 100644 externals/grill/flext/source/fldefs_attrcb.h create mode 100644 externals/grill/flext/source/fldefs_attrvar.h create mode 100644 externals/grill/flext/source/fldefs_hdr.h create mode 100644 externals/grill/flext/source/fldefs_methadd.h create mode 100644 externals/grill/flext/source/fldefs_methbind.h create mode 100644 externals/grill/flext/source/fldefs_methcall.h create mode 100644 externals/grill/flext/source/fldefs_methcb.h create mode 100644 externals/grill/flext/source/fldefs_meththr.h create mode 100644 externals/grill/flext/source/fldefs_setup.h diff --git a/externals/grill/flext/changes.txt b/externals/grill/flext/changes.txt new file mode 100644 index 00000000..0a340da5 --- /dev/null +++ b/externals/grill/flext/changes.txt @@ -0,0 +1,270 @@ +flext - C++ layer for Max/MSP and pd (pure data) externals + +Copyright (c) 2001-2003 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. + +This package seeks to encourage the development of open source software +for the pd and Max/MSP platforms. + +Donations for further development of the package are highly appreciated. + +---------------------------------------------------------------------------- + +Version history: + +0.4.4: +- fixed deadly bug for Max/MSP method-to-symbol-binding proxies +- some fixes for CodeWarrior Mach-O compilation +- fixed destruction bug for hashed "item arrays" + +0.4.3: +- added forgotten flext_base::ToQueueString method +- added timer functions and flext::Timer class +- added functions for SIMD support +- fixed race condition when using LaunchThread in a setup function (now waiting for thread helper to initialize) +- added flext::Forward function to send messages to bound symbols +- added "zero" flag to flext::buffer resize operation +- fixed bug for Max/MSP buffer resize with preservation of contents +- fixed bug with thread initialization (caused PD@OSX to crash on startup) +- flext::setup is only run once now +- fixed creation bug with objects that have attributes but no outlets +- added FLEXT_BINDMETHOD,FLEXT_UNBINDMETHOD to bind a method to a symbol +- fixed bug with hard thread termination (of incooperative threads) + +0.4.2: +- started port for jMax +- moved CLASS_MAINSIGNALIN to class scope (fixed "float method overwritten" warning) +- unix makefiles: CXX should be commented out if standard (to enable environmental settings) +- introduced default returns for the different flext::GetA* functions +- pragma for Metrowerks compilers: enumsalwaysint on, bool on +- MaxMSP: added assist string for attribute outlets +- added new POSIX for ThrCond::TimedWait (but still have to find out when to enable it....) +- added CopySamples and ZeroSamples +- fixed bug for DSP object with zero signal inlets in PD +- added validity check for sample buffers + +0.4.1: +- full port for Max@OSX +- completely redesigned message and attribute handling: now hashed and much more efficient +- greatly enhanced object creation and destruction (esp. for library objects) +- class setup functions now take t_classid type arg... this is BACKWARDS-INCOMPATIBLE for Max/MSP +- added some prerequisites for usage of flext as a shared library +- completed Max/MSPs inlet/outlet assist description functionality +- Max/MSP signal objects: fixed bug of reporting wrong number of inlets +- put overloaded new/delete into flext support class +- introduced "Finalize" virtual method, called after all "Init" methods +- 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 &), flext::ZeroMem +- put the clock_delay for the message queue inside the thread-locked area + Ok for the actual object, but PD has to be thread-safe here as well +- BACKWARDS-INCOMPATIBLE CHANGE: flext_base::m_methodmain and flext_base::m_method_ have got + const modifiers.... these virtual methods are used rarely (except for example in py/pyext) +- now MUCH cleaner platform identification... FLEXT_SYS,FLEXT_OS,FLEXT_CPU definitions +- also FLEXT_DEBUG for debug build +- SndObjs: virtual FreeObject routine is now called at destruction (by parent class), derived class doesn't need to call it! +- SndObjs: fixed typo (numbers of output slots was wrong) and init bug +- STK: added support for STK object classes (flstk.{h,cpp}) +- introduced a helper thread for launching flext threads in the background +- threads are now handled on class (as opposed to object) level +- threads can now be terminated separately +- put more flext functions into flext static class +- replaced ChangePriority by RefPriority +- fixed setting of priorities... problems were caused by a compiler bug (MSVC 6) +- made a portable threading interface with support for threading libraries other than pthreads (FLEXT_THREADS defined as FLEXT_THR_*) +- implemented threading support with the MacOS MP thread library +- stripped the ThrMutex and ThrCond classes of non-portable (and irrelevant) functionality +- simplified "ToQueue*" and threaded "ToOut*" message queue mechanism for Max/MSP +- deprecated FLEXT_ADDMETHOD_V and FLEXT_ADDMETHOD_A definitions which only lead to confusion +- BACKWARDS-INCOMPATIBLE CHANGE: flext_sndobj::NewObjs must return a boolean!! + +0.4.0: +- the use of the const keyword is enforced (e.g. the preferred type for symbols is now "const t_symbol *") + - there _might_ be some problems with sensitive compilers +- introduced Max/Jitter-like attribute functionality ("@value" command line, "getvalue" get and "value" set functions) +- introduced a flext static class for general flext functions (to clean up the flext_base class) +- creation argument handling is now done by flext + no more weird PD re-ordering of arguments +- no more support for the Apple MPW compiler - MacOS9 is dying anyway... +- calling SetupInOut() has become obsolete + - flext creates all inlets/outlets by itself after the constructor has finished + - this implies that CntIn(),CntOut() and the outlet pointers are not valid in the constructor + - there is a virtual bool Init() function that may be used for such initialization +- completely redesigned FLEXT_NEW macros, usage of dynamic classes (in fllib.cpp) +- added ToQueue* functions - like ToOut* but messages or not directly sent (well suited for deadlock situations) +- introduced additional per-class methods and attributes (just like it ever was in Max and PD) +- fixed potentially dangerous typo in flext.cpp - (was: FLEXT_THREAD instead of FLEXT_THREADS) +- added OSX/darwin support (originally done by Adam T. Lindsay) +- SndObj interface now also available for cygwin and BCC +- added prepend and append functions to AtomList class +- added IsNothing, SetNothing, CanbeBool and GetABool functions +- eliminated the remaining Get*Flint and Set*Flint functions +- added/completed Is/Canbe/Get/Set for pointer atoms +- added print/scan functions for atoms +- fixed anything outlets for Max/MSP... for some strange reason this severe bug has not had severe consequences.... + +0.3.3: +- PD: fixed bug for DSP objects having no signal inlets + this also enables floats into a non-signal leftmost inlet +- revisited priority stuff for detached threads +- Bind/unbind functions for flext classes (in MaxMSP only one object can be bound) +- made "t_symtype" another synonym for "t_symbol *" +- added forgotten dsp_free function for MaxMSP +- fixed forgotten __class__ member for MaxMSP libraries +- changed basic MaxMSP object to t_pxbox (ok, a bit more memory is used....) +- MaxMSP library can now be loaded from startup folder (but can't use aliases) +- if no handler is found for pure anything (just symbol, no args...) try list handler +- added interface for SndObj (http://www.may.ie/academic/music/musictec/SndObj/ ) + +0.3.2: +- Doxygen generated inline documentation / functional reference +- added some more functionality to the AtomAnything class +- bugfix for threaded methods with var list or anything arguments +- added threaded method for arbitrary (void *) data structs +- ThrMutex: added lock count functions Push() and Pop() +- eliminated potentially dangerous SetThing,GetThing and introduced DoBind,DoUnbind,GetBound instead +- fixed severe bug with the current threads list +- add path specification possibility for help symbols (in FLEXT_NEW*) +- use pthread_attr and DETACHED flag + +0.3.1: +- added some more functionality to the AtomList class +- fixed forgotten Sleep implementation in pd@unix +- reorganized file structure and config/make procedures + +0.3.0: +- added CYGWIN support + +- added threaded methods along with a message queue for ToOut* functions (very unstable for MaxMSP!) + to use threads compile flext with FLEXT_THREADS definition +- check/update function for buffer change (resize etc.) +- description text for inlets/outlets (e.g. for MaxMSPs assist function) - not fully implemented +- added buffer resize functions flext_base::buffer::Frames(int,bool) +- added some utility functions: Sleep, CopyAtom, CopyList +- added List manipulation classes: AtomList, AtomAnything +- Alias object names (simply specify with FLEXT_NEW*, separated by whitespace) +- float messages - int method is called if there is no float method +- MaxMSP: int messages - float method is called if there is no int method +- fixed type warning for class constructors with int arguments in PD +- fixed severe bug concerning symbol methods +- MaxMSP: use critical sections for message output (for more safety in overdrive mode) +- PD: default/manual definition of help file by flext_base::DefineHelp +- added GetThing/SetThing to access t_symbol's s_thing data member + +- introduced FLEXT_NEW_DSP* and FLEXT_LIB_DSP* for FLEXT_NEW_TILDE* and FLEXT_LIB_TILDE* (the latter become deprecated) +- all variable argument defs (aka gimme) now have a V instead of G (e.g. FLEXT_NEW_V) + +0.2.3: +- restructured files and started usable inline documentation +- found that there was no method to output a bang?! Ugh! -> corrected +- finally eliminated awful t_flint type and all other schizophrenic flint functions (float and int exist now equally) +- now (finally) using type t_sample for sample values (should just be identical to float) +- added AddInBang/AddOutBang (same as Add*Symbol - unchecked) +- buffer class: added "bool Ok()" check function +- switched on error posting for unhandled messages +- added XletCode and AddInlets/AddOutlets for multiple Inlet/Outlet addition (max. 9 inlets/outlets) +- if float or int message is not handled explicitly then [list float/int( is tried + +0.2.2: +- added xgimme argument type (supplies method handlers with symbol+gimme) +- more information on DSP system with flext_dsp object (block size,number of audio inputs and outputs) +- cleaner gcc makefile +- made NewAligned/FreeAligned static functions +- introduced FLEXT(_TILDE)_SETUP for class setup in a library setup function +- introduced external libraries for MaxMSP, changed library setup behavior (now via FLEXT_LIB_SETUP) +- included MaxMsp's inofficial buffer.h with consent by David Zicarelli +- changed dynamic casts in callback functions to static as gcc 3.0.4 has obvious bugs + +0.2.1: +- fixed bug in message parsing code (anything messages were not correctly mapped to inlets) +- changed t_symtype to t_symptr (= t_symbol *), needed for method argument lists +- eliminated flint type (t_flint remains) + +0.2.0: +- internal proxy objects for any non-leftmost inlets +- Max/MSP: all signal inlets can receive messages +- method/argument parsing is done by flext - float/int are not distinguished, the first handler wins +- integrated more system functions into flext_base & eliminated superfluous #defines +- distribute list (into inlet 0) elements over inlets (right to left) +- added outlets for anythings +- defines for callback-to-method functions and method setup (FLEXT_CALLBACK*, FLEXT_ADD*) +- uses PD's or Max's memory allocation functions (for safety in Max's overdrive) +- no support for default arguments (A_DEFFLOAT and A_DEFSYMBOL).. use GIMME instead! +- better graphics update behavior for PD +- improved behavior for invalid/undefined buffers/arrays +- use MaxMSP internal z_disabled flag with flext_dsp for pausing/resuming dsp processing +- included CHECK_TILDE, a test whether a tilde object (defined as FLEXT_TILDE_*) has a trailing ~. (debug mode only) +- changed notation of flext functions from to_out_float like to ToOutFloat like +- eliminated trivial shortcuts (F,I,V,...) for built-in types +- MaxMSP is only capable of 3 creation arguments... that should be sufficient - otherwise use GIMME +- Methods for aligned memory (NewAligned, FreeAligned) + +0.1.1: +- documentation for flext.h +- more emancipation from GEM code +- virtually everything renamed +- abstraction for dsp processing +- makefile for BCC +- manual call of extern_setup or main unnecessary for single objects - only in pd libraries +- delayed buffer init (only name is set beforehand) +- loadbang also in PD +- introduced "compatibility mode" which denies platform-specific features +- fixed severe dsp bug (symptom: "float method overwritten" warning in pd) +- fixed bug: wrong return code from buffer::Set + +0.1.0: +- max-pd 0.2 becomes flext 0.1.0 +- heavy usage of unchanged GEM code + + +---------------------------------------------------------------------------- + +Notes: +- no support for default object arguments (A_DEFFLOAT, A_DEFSYMBOL) -> use variable argument lists instead + +Platform specific: +- PD does not allow signal and message to go into the same inlet + +Restrictions in compatibility mode: +- Max allows only 9 float/int inlets + +Porting to new compilers/platforms: +- enums must be int-sized!!! +- compiler must support bool type +- no need of C++ exceptions or RTTI (RTTI only for GUI objects) + BUT: some libraries could use RTTI and then need run-time type information from the library! (this is known for gcc compiles) + +---------------------------------------------------------------------------- + +TODO list: + +general: +- documentation +- add log messages for debugging version +- MaxMSP: how to call separate help files for objects in a library? -> object mappings (in OSX) +- use PD's t_float type for floating point values (and what about t_int?) + +bugs: +- PD: problems with timed buffer redrawing (takes a lot of cpu time) +- hard thread termination upon object destruction doesn't seem to work properly -> crash +- Max rounding bug ... buffer resize could be one sample less! +- flext_dsp: Max/MSP doesn't correctly report in/out channel counts + +tests: +- PD: figure out what "pointer" messages do and where they occur +- some more mutexes needed for thread safety? +- buffer resize: flext_base::buffer::Frames(): should we use buffer or system sample rate? + +- what about FLEXT_ADDMETHOD_V (for var arg lists) and FLEXT_ADDMETHOD_A (anythings)... nonsense? + -> yes, these definitions obscure the meaning of _ as an indication for usage of a message tag + +- check whether m_dsp gets called upon deletion of a used buffer (PD and MaxMSP may behave differently). + + +features: +- manage running threads individually (stop, isrunning?, priority etc.) + + + + diff --git a/externals/grill/flext/readme.txt b/externals/grill/flext/readme.txt index 177a7f35..132b6d08 100644 --- a/externals/grill/flext/readme.txt +++ b/externals/grill/flext/readme.txt @@ -110,262 +110,3 @@ cons: see flext.h, fldefs.h and flclass.h for the documented base definitions and classes ----------------------------------------------------------------------------- - -Version history: - -0.4.4: -- fixed deadly bug for Max/MSP method-to-symbol-binding proxies -- some fixes for CodeWarrior Mach-O compilation -- fixed destruction bug for hashed "item arrays" - -0.4.3: -- added forgotten flext_base::ToQueueString method -- added timer functions and flext::Timer class -- added functions for SIMD support -- fixed race condition when using LaunchThread in a setup function (now waiting for thread helper to initialize) -- added flext::Forward function to send messages to bound symbols -- added "zero" flag to flext::buffer resize operation -- fixed bug for Max/MSP buffer resize with preservation of contents -- fixed bug with thread initialization (caused PD@OSX to crash on startup) -- flext::setup is only run once now -- fixed creation bug with objects that have attributes but no outlets -- added FLEXT_BINDMETHOD,FLEXT_UNBINDMETHOD to bind a method to a symbol -- fixed bug with hard thread termination (of incooperative threads) - -0.4.2: -- started port for jMax -- moved CLASS_MAINSIGNALIN to class scope (fixed "float method overwritten" warning) -- unix makefiles: CXX should be commented out if standard (to enable environmental settings) -- introduced default returns for the different flext::GetA* functions -- pragma for Metrowerks compilers: enumsalwaysint on, bool on -- MaxMSP: added assist string for attribute outlets -- added new POSIX for ThrCond::TimedWait (but still have to find out when to enable it....) -- added CopySamples and ZeroSamples -- fixed bug for DSP object with zero signal inlets in PD -- added validity check for sample buffers - -0.4.1: -- full port for Max@OSX -- completely redesigned message and attribute handling: now hashed and much more efficient -- greatly enhanced object creation and destruction (esp. for library objects) -- class setup functions now take t_classid type arg... this is BACKWARDS-INCOMPATIBLE for Max/MSP -- added some prerequisites for usage of flext as a shared library -- completed Max/MSPs inlet/outlet assist description functionality -- Max/MSP signal objects: fixed bug of reporting wrong number of inlets -- put overloaded new/delete into flext support class -- introduced "Finalize" virtual method, called after all "Init" methods -- 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 &), flext::ZeroMem -- put the clock_delay for the message queue inside the thread-locked area - Ok for the actual object, but PD has to be thread-safe here as well -- BACKWARDS-INCOMPATIBLE CHANGE: flext_base::m_methodmain and flext_base::m_method_ have got - const modifiers.... these virtual methods are used rarely (except for example in py/pyext) -- now MUCH cleaner platform identification... FLEXT_SYS,FLEXT_OS,FLEXT_CPU definitions -- also FLEXT_DEBUG for debug build -- SndObjs: virtual FreeObject routine is now called at destruction (by parent class), derived class doesn't need to call it! -- SndObjs: fixed typo (numbers of output slots was wrong) and init bug -- STK: added support for STK object classes (flstk.{h,cpp}) -- introduced a helper thread for launching flext threads in the background -- threads are now handled on class (as opposed to object) level -- threads can now be terminated separately -- put more flext functions into flext static class -- replaced ChangePriority by RefPriority -- fixed setting of priorities... problems were caused by a compiler bug (MSVC 6) -- made a portable threading interface with support for threading libraries other than pthreads (FLEXT_THREADS defined as FLEXT_THR_*) -- implemented threading support with the MacOS MP thread library -- stripped the ThrMutex and ThrCond classes of non-portable (and irrelevant) functionality -- simplified "ToQueue*" and threaded "ToOut*" message queue mechanism for Max/MSP -- deprecated FLEXT_ADDMETHOD_V and FLEXT_ADDMETHOD_A definitions which only lead to confusion -- BACKWARDS-INCOMPATIBLE CHANGE: flext_sndobj::NewObjs must return a boolean!! - -0.4.0: -- the use of the const keyword is enforced (e.g. the preferred type for symbols is now "const t_symbol *") - - there _might_ be some problems with sensitive compilers -- introduced Max/Jitter-like attribute functionality ("@value" command line, "getvalue" get and "value" set functions) -- introduced a flext static class for general flext functions (to clean up the flext_base class) -- creation argument handling is now done by flext - no more weird PD re-ordering of arguments -- no more support for the Apple MPW compiler - MacOS9 is dying anyway... -- calling SetupInOut() has become obsolete - - flext creates all inlets/outlets by itself after the constructor has finished - - this implies that CntIn(),CntOut() and the outlet pointers are not valid in the constructor - - there is a virtual bool Init() function that may be used for such initialization -- completely redesigned FLEXT_NEW macros, usage of dynamic classes (in fllib.cpp) -- added ToQueue* functions - like ToOut* but messages or not directly sent (well suited for deadlock situations) -- introduced additional per-class methods and attributes (just like it ever was in Max and PD) -- fixed potentially dangerous typo in flext.cpp - (was: FLEXT_THREAD instead of FLEXT_THREADS) -- added OSX/darwin support (originally done by Adam T. Lindsay) -- SndObj interface now also available for cygwin and BCC -- added prepend and append functions to AtomList class -- added IsNothing, SetNothing, CanbeBool and GetABool functions -- eliminated the remaining Get*Flint and Set*Flint functions -- added/completed Is/Canbe/Get/Set for pointer atoms -- added print/scan functions for atoms -- fixed anything outlets for Max/MSP... for some strange reason this severe bug has not had severe consequences.... - -0.3.3: -- PD: fixed bug for DSP objects having no signal inlets - this also enables floats into a non-signal leftmost inlet -- revisited priority stuff for detached threads -- Bind/unbind functions for flext classes (in MaxMSP only one object can be bound) -- made "t_symtype" another synonym for "t_symbol *" -- added forgotten dsp_free function for MaxMSP -- fixed forgotten __class__ member for MaxMSP libraries -- changed basic MaxMSP object to t_pxbox (ok, a bit more memory is used....) -- MaxMSP library can now be loaded from startup folder (but can't use aliases) -- if no handler is found for pure anything (just symbol, no args...) try list handler -- added interface for SndObj (http://www.may.ie/academic/music/musictec/SndObj/ ) - -0.3.2: -- Doxygen generated inline documentation / functional reference -- added some more functionality to the AtomAnything class -- bugfix for threaded methods with var list or anything arguments -- added threaded method for arbitrary (void *) data structs -- ThrMutex: added lock count functions Push() and Pop() -- eliminated potentially dangerous SetThing,GetThing and introduced DoBind,DoUnbind,GetBound instead -- fixed severe bug with the current threads list -- add path specification possibility for help symbols (in FLEXT_NEW*) -- use pthread_attr and DETACHED flag - -0.3.1: -- added some more functionality to the AtomList class -- fixed forgotten Sleep implementation in pd@unix -- reorganized file structure and config/make procedures - -0.3.0: -- added CYGWIN support - -- added threaded methods along with a message queue for ToOut* functions (very unstable for MaxMSP!) - to use threads compile flext with FLEXT_THREADS definition -- check/update function for buffer change (resize etc.) -- description text for inlets/outlets (e.g. for MaxMSPs assist function) - not fully implemented -- added buffer resize functions flext_base::buffer::Frames(int,bool) -- added some utility functions: Sleep, CopyAtom, CopyList -- added List manipulation classes: AtomList, AtomAnything -- Alias object names (simply specify with FLEXT_NEW*, separated by whitespace) -- float messages - int method is called if there is no float method -- MaxMSP: int messages - float method is called if there is no int method -- fixed type warning for class constructors with int arguments in PD -- fixed severe bug concerning symbol methods -- MaxMSP: use critical sections for message output (for more safety in overdrive mode) -- PD: default/manual definition of help file by flext_base::DefineHelp -- added GetThing/SetThing to access t_symbol's s_thing data member - -- introduced FLEXT_NEW_DSP* and FLEXT_LIB_DSP* for FLEXT_NEW_TILDE* and FLEXT_LIB_TILDE* (the latter become deprecated) -- all variable argument defs (aka gimme) now have a V instead of G (e.g. FLEXT_NEW_V) - -0.2.3: -- restructured files and started usable inline documentation -- found that there was no method to output a bang?! Ugh! -> corrected -- finally eliminated awful t_flint type and all other schizophrenic flint functions (float and int exist now equally) -- now (finally) using type t_sample for sample values (should just be identical to float) -- added AddInBang/AddOutBang (same as Add*Symbol - unchecked) -- buffer class: added "bool Ok()" check function -- switched on error posting for unhandled messages -- added XletCode and AddInlets/AddOutlets for multiple Inlet/Outlet addition (max. 9 inlets/outlets) -- if float or int message is not handled explicitly then [list float/int( is tried - -0.2.2: -- added xgimme argument type (supplies method handlers with symbol+gimme) -- more information on DSP system with flext_dsp object (block size,number of audio inputs and outputs) -- cleaner gcc makefile -- made NewAligned/FreeAligned static functions -- introduced FLEXT(_TILDE)_SETUP for class setup in a library setup function -- introduced external libraries for MaxMSP, changed library setup behavior (now via FLEXT_LIB_SETUP) -- included MaxMsp's inofficial buffer.h with consent by David Zicarelli -- changed dynamic casts in callback functions to static as gcc 3.0.4 has obvious bugs - -0.2.1: -- fixed bug in message parsing code (anything messages were not correctly mapped to inlets) -- changed t_symtype to t_symptr (= t_symbol *), needed for method argument lists -- eliminated flint type (t_flint remains) - -0.2.0: -- internal proxy objects for any non-leftmost inlets -- Max/MSP: all signal inlets can receive messages -- method/argument parsing is done by flext - float/int are not distinguished, the first handler wins -- integrated more system functions into flext_base & eliminated superfluous #defines -- distribute list (into inlet 0) elements over inlets (right to left) -- added outlets for anythings -- defines for callback-to-method functions and method setup (FLEXT_CALLBACK*, FLEXT_ADD*) -- uses PD's or Max's memory allocation functions (for safety in Max's overdrive) -- no support for default arguments (A_DEFFLOAT and A_DEFSYMBOL).. use GIMME instead! -- better graphics update behavior for PD -- improved behavior for invalid/undefined buffers/arrays -- use MaxMSP internal z_disabled flag with flext_dsp for pausing/resuming dsp processing -- included CHECK_TILDE, a test whether a tilde object (defined as FLEXT_TILDE_*) has a trailing ~. (debug mode only) -- changed notation of flext functions from to_out_float like to ToOutFloat like -- eliminated trivial shortcuts (F,I,V,...) for built-in types -- MaxMSP is only capable of 3 creation arguments... that should be sufficient - otherwise use GIMME -- Methods for aligned memory (NewAligned, FreeAligned) - -0.1.1: -- documentation for flext.h -- more emancipation from GEM code -- virtually everything renamed -- abstraction for dsp processing -- makefile for BCC -- manual call of extern_setup or main unnecessary for single objects - only in pd libraries -- delayed buffer init (only name is set beforehand) -- loadbang also in PD -- introduced "compatibility mode" which denies platform-specific features -- fixed severe dsp bug (symptom: "float method overwritten" warning in pd) -- fixed bug: wrong return code from buffer::Set - -0.1.0: -- max-pd 0.2 becomes flext 0.1.0 -- heavy usage of unchanged GEM code - - ----------------------------------------------------------------------------- - -Notes: -- no support for default object arguments (A_DEFFLOAT, A_DEFSYMBOL) -> use variable argument lists instead - -Platform specific: -- PD does not allow signal and message to go into the same inlet - -Restrictions in compatibility mode: -- Max allows only 9 float/int inlets - -Porting to new compilers/platforms: -- enums must be int-sized!!! -- compiler must support bool type -- no need of C++ exceptions or RTTI (RTTI only for GUI objects) - BUT: some libraries could use RTTI and then need run-time type information from the library! (this is known for gcc compiles) - ----------------------------------------------------------------------------- - -TODO list: - -general: -- documentation -- add log messages for debugging version -- MaxMSP: how to call separate help files for objects in a library? -> object mappings (in OSX) -- use PD's t_float type for floating point values (and what about t_int?) - -bugs: -- PD: problems with timed buffer redrawing (takes a lot of cpu time) -- hard thread termination upon object destruction doesn't seem to work properly -> crash -- Max rounding bug ... buffer resize could be one sample less! -- flext_dsp: Max/MSP doesn't correctly report in/out channel counts - -tests: -- PD: figure out what "pointer" messages do and where they occur -- some more mutexes needed for thread safety? -- buffer resize: flext_base::buffer::Frames(): should we use buffer or system sample rate? - -- what about FLEXT_ADDMETHOD_V (for var arg lists) and FLEXT_ADDMETHOD_A (anythings)... nonsense? - -> yes, these definitions obscure the meaning of _ as an indication for usage of a message tag - -- check whether m_dsp gets called upon deletion of a used buffer (PD and MaxMSP may behave differently). - - -features: -- manage running threads individually (stop, isrunning?, priority etc.) - - - - diff --git a/externals/grill/flext/source/fldefs.h b/externals/grill/flext/source/fldefs.h index 19e9891d..66d50c17 100644 --- a/externals/grill/flext/source/fldefs.h +++ b/externals/grill/flext/source/fldefs.h @@ -9,8 +9,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. */ /*! \file fldefs.h - \brief This file contains all #defines for actual usage - + \brief This file includes all the #define header files */ #ifndef __FLEXT_DEFS_H @@ -30,278 +29,10 @@ WARRANTIES, see the file, "license.txt," in this distribution. #define FLEXT_CAST static_cast #endif -/*! \defgroup FLEXT_D_HEADER Flext class header - \note One (and only one!) of these definitions is compulsory for the class declaration. - \note It has to be placed somewhere in the class definition (not necessarily in a public section). - - @{ -*/ - -/*! \brief Plain flext class header - \param NEW_CLASS name of the current C++ class - \param PARENT_CLASS name of the base C++ class (e.g. flext_base or flext_dsp) -*/ -#define FLEXT_HEADER(NEW_CLASS,PARENT_CLASS) \ -\ -FLEXT_REALHDR(NEW_CLASS, PARENT_CLASS) - -/*! \brief Flext class header with setup function - \param NEW_CLASS name of the current C++ class - \param PARENT_CLASS name of the base C++ class (e.g. flext_base or flext_dsp) - \param SETUPFUN setup function, of type "void (*setupfn)(t_class *)" - - The setup function is called after class creation. It corresponds to the - original PD "[object]_setup" function, apart from the - fact that all necessary class initializations have already been taken care of by flext. - The setup function can e.g. be used for a message to the console upon first creation of an object. -*/ -#define FLEXT_HEADER_S(NEW_CLASS, PARENT_CLASS, SETUPFUN)\ -\ -FLEXT_REALHDR_S(NEW_CLASS, PARENT_CLASS, SETUPFUN) - - -//! @} FLEXT_D_HEADER - - - -// ==================================================================================== - -/*! \defgroup FLEXT_D_INSTANCE Class instantiation - \note The name of your class is of importance! It must be the same as the external - \note (excluded an eventual ~ (tilde)) -*/ - - -/*! \defgroup FLEXT_D_NEW Stand-alone class instantiation - Makes an actual instance of a stand-alone class. -*/ - -/*! \defgroup FLEXT_D_NEW_DSP Dsp class instantiation - Makes an actual instance of a dsp (aka "tilde") class (with signal processing). -*/ - -/*! \defgroup FLEXT_D_LIB Library class instantiation - Makes an actual instance of a class which is part of an object library (and not stand-alone). -*/ - -/*! \defgroup FLEXT_D_LIB_DSP Dsp library class instantiation - Makes an actual instance of a dsp (aka "tilde") class with signal processing - which is part of an object library (and not stand-alone). -*/ - -// NO ARGUMENTS -// ---------------------------------------- - -/*! \brief Implementation of a flext class with no arguments - \ingroup FLEXT_D_NEW - \param NAME the object's actual name(s) as a string (like "*", "trigger", "noise~", etc.) - \param NEW_CLASS the object's C++ class name -*/ -#define FLEXT_NEW(NAME,NEW_CLASS) \ -\ -REAL_NEW(NAME,NEW_CLASS,0,0) - -/*! \brief Implementation of a flext dsp class with no arguments - \ingroup FLEXT_D_NEW_DSP -*/ -#define FLEXT_NEW_DSP(NAME,NEW_CLASS) \ -\ -REAL_NEW(NAME,NEW_CLASS,1,0) - -/*! \brief Implementation of a flext class (part of a library) with no arguments - \ingroup FLEXT_D_LIB -*/ -#define FLEXT_LIB(NAME,NEW_CLASS) \ -\ -REAL_NEW(NAME,NEW_CLASS,0,1) - -/*! \brief Implementation of a flext dsp class (part of a library) with no arguments - \ingroup FLEXT_D_LIB_DSP -*/ -#define FLEXT_LIB_DSP(NAME,NEW_CLASS) \ -\ -REAL_NEW(NAME,NEW_CLASS,1,1) - - -// VARIABLE ARGUMENT LIST -// ---------------------------------------- - -/*! \brief Implementation of a flext class with a variable argument list - \ingroup FLEXT_D_NEW -*/ -#define FLEXT_NEW_V(NAME,NEW_CLASS) \ -\ -REAL_NEW_V(NAME,NEW_CLASS,0,0) \ - -/*! \brief Implementation of a flext dsp class with a variable argument list - \ingroup FLEXT_D_NEW_DSP -*/ -#define FLEXT_NEW_DSP_V(NAME,NEW_CLASS) \ -\ -REAL_NEW_V(NAME,NEW_CLASS,1,0) \ - -/*! \brief Implementation of a flext class (part of a library) with a variable argument list - \ingroup FLEXT_D_LIB -*/ -#define FLEXT_LIB_V(NAME,NEW_CLASS) \ -\ -REAL_NEW_V(NAME,NEW_CLASS, 0,1) - -/*! \brief Implementation of a flext dsp class (part of a library) with a variable argument list - \ingroup FLEXT_D_LIB_DSP -*/ -#define FLEXT_LIB_DSP_V(NAME,NEW_CLASS) \ -\ -REAL_NEW_V(NAME,NEW_CLASS, 1,1) - - -// ONE ARGUMENT -// ---------------------------------------- - -/*! \brief Implementation of a flext class with one argument - \ingroup FLEXT_D_NEW -*/ -#define FLEXT_NEW_1(NAME,NEW_CLASS, TYPE) \ -\ -REAL_NEW_1(NAME,NEW_CLASS, 0, 0,TYPE) \ - -/*! \brief Implementation of a flext dsp class with one argument - \ingroup FLEXT_D_NEW_DSP -*/ -#define FLEXT_NEW_DSP_1(NAME,NEW_CLASS, TYPE) \ -\ -REAL_NEW_1(NAME,NEW_CLASS, 1, 0,TYPE) \ - -/*! \brief Implementation of a flext class (part of a library) with one argument - \ingroup FLEXT_D_LIB -*/ -#define FLEXT_LIB_1(NAME,NEW_CLASS, TYPE) \ -\ -REAL_NEW_1(NAME,NEW_CLASS, 0,1,TYPE) - -/*! \brief Implementation of a flext dsp class (part of a library) with one argument - \ingroup FLEXT_D_LIB_DSP -*/ -#define FLEXT_LIB_DSP_1(NAME,NEW_CLASS, TYPE) \ -\ -REAL_NEW_1(NAME,NEW_CLASS, 1,1, TYPE) - - -// TWO ARGUMENTS -// ---------------------------------------- - -/*! \brief Implementation of a flext class with 2 arguments - \ingroup FLEXT_D_NEW -*/ -#define FLEXT_NEW_2(NAME,NEW_CLASS, TYPE1, TYPE2) \ -\ -REAL_NEW_2(NAME,NEW_CLASS, 0,0, TYPE1, TYPE2) \ - -/*! \brief Implementation of a flext dsp class with 2 arguments - \ingroup FLEXT_D_NEW_DSP -*/ -#define FLEXT_NEW_DSP_2(NAME,NEW_CLASS, TYPE1, TYPE2) \ -\ -REAL_NEW_2(NAME,NEW_CLASS, 1,0, TYPE1, TYPE2) \ - -/*! \brief Implementation of a flext class (part of a library) with 2 arguments - \ingroup FLEXT_D_LIB -*/ -#define FLEXT_LIB_2(NAME,NEW_CLASS, TYPE1, TYPE2) \ -\ -REAL_NEW_2(NAME,NEW_CLASS, 0,1, TYPE1, TYPE2) - -/*! \brief Implementation of a flext dsp class (part of a library) with 2 arguments - \ingroup FLEXT_D_LIB_DSP -*/ -#define FLEXT_LIB_DSP_2(NAME,NEW_CLASS, TYPE1, TYPE2) \ -\ -REAL_NEW_2(NAME,NEW_CLASS, 1,1, TYPE1, TYPE2) - - -// THREE ARGUMENTS -// ---------------------------------------- - -/*! \brief Implementation of a flext class with 3 arguments - \ingroup FLEXT_D_NEW -*/ -#define FLEXT_NEW_3(NAME,NEW_CLASS, TYPE1, TYPE2, TYPE3) \ -\ -REAL_NEW_3(NAME,NEW_CLASS, 0,0, TYPE1, TYPE2, TYPE3) \ - -/*! \brief Implementation of a flext dsp class with 3 arguments - \ingroup FLEXT_D_NEW_DSP -*/ -#define FLEXT_NEW_DSP_3(NAME,NEW_CLASS, TYPE1, TYPE2, TYPE3) \ -\ -REAL_NEW_3(NAME,NEW_CLASS, 1,0, TYPE1, TYPE2, TYPE3) \ - -/*! \brief Implementation of a flext class (part of a library) with 3 arguments - \ingroup FLEXT_D_LIB -*/ -#define FLEXT_LIB_3(NAME,NEW_CLASS, TYPE1, TYPE2, TYPE3) \ -\ -REAL_NEW_3(NAME,NEW_CLASS, 0,1,TYPE1, TYPE2, TYPE3) - -/*! \brief Implementation of a flext dsp class (part of a library) with 3 arguments - \ingroup FLEXT_D_LIB_DSP -*/ -#define FLEXT_LIB_DSP_3(NAME,NEW_CLASS, TYPE1, TYPE2, TYPE3) \ -\ -REAL_NEW_3(NAME,NEW_CLASS, 1,1, TYPE1, TYPE2, TYPE3) - - -// deprecated stuff - -/*! \defgroup FLEXT_D_DEPRECATED Deprecated definitions - \deprecated - @{ -*/ - -#define FLEXT_NEW_G FLEXT_NEW_V - -#define FLEXT_NEW_TILDE FLEXT_NEW_DSP -#define FLEXT_NEW_TILDE_G FLEXT_NEW_DSP_V -#define FLEXT_NEW_TILDE_1 FLEXT_NEW_DSP_1 -#define FLEXT_NEW_TILDE_2 FLEXT_NEW_DSP_2 -#define FLEXT_NEW_TILDE_3 FLEXT_NEW_DSP_3 - -#define FLEXT_LIB_G FLEXT_LIB_V - -#define FLEXT_LIB_TILDE FLEXT_LIB_DSP -#define FLEXT_LIB_TILDE_G FLEXT_LIB_DSP_V -#define FLEXT_LIB_TILDE_1 FLEXT_LIB_DSP_1 -#define FLEXT_LIB_TILDE_2 FLEXT_LIB_DSP_2 -#define FLEXT_LIB_TILDE_3 FLEXT_LIB_DSP_3 - -#define FLEXT_TILDE_SETUP FLEXT_DSP_SETUP - -//! @} FLEXT_D_DEPRECATED +#include "fldefs_hdr.h" +#include "fldefs_setup.h" -/*! \defgroup FLEXT_D_LIBRARY Definitions for library objects - @{ -*/ - -/*! \brief Specify that to declare the library itself. - \note If you have a library this is compulsory (to register all the objects of the library) -*/ -#define FLEXT_LIB_SETUP(NAME,SETUPFUN) REAL_LIB_SETUP(NAME,SETUPFUN) - -/*! \brief Register an object in the library. - \note This is used in the library setup function -*/ -#define FLEXT_SETUP(cl) REAL_SETUP(cl,0) - -/*! \brief Register a DSP object in the library. - \note This is used in the library setup function -*/ -#define FLEXT_DSP_SETUP(cl) REAL_SETUP(cl,1) - -//! @} FLEXT_D_LIBRARY - - -//! @} FLEXT_D_INSTANCE // ==================================================================================== @@ -309,662 +40,16 @@ REAL_NEW_3(NAME,NEW_CLASS, 1,1, TYPE1, TYPE2, TYPE3) @{ */ - -/*! \defgroup FLEXT_D_CALLBACK Declare callbacks for class methods - @{ -*/ - -//! Set up a method callback with no arguments -#define FLEXT_CALLBACK(M_FUN) \ -static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c) \ -{ FLEXT_CAST(c)->M_FUN(); return true; } - -//! Set up a method callback for an anything argument -#define FLEXT_CALLBACK_A(M_FUN) \ -static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,t_symbol *s,int argc,t_atom *argv) \ -{ FLEXT_CAST(c)->M_FUN(s,argc,argv); return true; } - -//! Set up a method callback for a variable argument list -#define FLEXT_CALLBACK_V(M_FUN) \ -static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,int argc,t_atom *argv) \ -{ FLEXT_CAST(c)->M_FUN(argc,argv); return true; } - -//! Set up a method callback for a data package (void *) argument -#define FLEXT_CALLBACK_X(M_FUN) \ -static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,void *data) \ -{ FLEXT_CAST(c)->M_FUN(data); return true; } - -//! Set up a method callback for an anything argument and a data package (e.g. for symbol-bound methods). -#define FLEXT_CALLBACK_AX(M_FUN) \ -static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,t_symbol *s,int argc,t_atom *argv,void *data) \ -{ FLEXT_CAST(c)->M_FUN(s,argc,argv,data); return true; } - -//! Set up a timer callback -#define FLEXT_CALLBACK_T(M_FUN) \ -\ -FLEXT_CALLBACK_X(M_FUN) - -//! Set up a method callback for a boolean argument -#define FLEXT_CALLBACK_B(M_FUN) \ -static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,int &arg1) \ -{ FLEXT_CAST(c)->M_FUN(arg1 != 0); return true; } - -//! Set up a method callback for 1 argument -#define FLEXT_CALLBACK_1(M_FUN,TP1) \ -static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,TP1 &arg1) \ -{ FLEXT_CAST(c)->M_FUN(arg1); return true; } - -//! Set up a method callback for 2 arguments -#define FLEXT_CALLBACK_2(M_FUN,TP1,TP2) \ -static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,TP1 &arg1,TP2 &arg2) \ -{ FLEXT_CAST(c)->M_FUN(arg1,arg2); return true; } - -//! Set up a method callback for 3 arguments -#define FLEXT_CALLBACK_3(M_FUN,TP1,TP2,TP3) \ -static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,TP1 &arg1,TP2 &arg2,TP3 &arg3) \ -{ FLEXT_CAST(c)->M_FUN(arg1,arg2,arg3); return true; } - -//! Set up a method callback for 4 arguments -#define FLEXT_CALLBACK_4(M_FUN,TP1,TP2,TP3,TP4) \ -static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,TP1 &arg1,TP2 &arg2,TP3 &arg3,TP4 &arg4) \ -{ FLEXT_CAST(c)->M_FUN(arg1,arg2,arg3,arg4); return true; } - -//! Set up a method callback for 5 arguments -#define FLEXT_CALLBACK_5(M_FUN,TP1,TP2,TP3,TP4,TP5) \ -static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,TP1 &arg1,TP2 &arg2,TP3 &arg3,TP4 &arg4,TP5 &arg5) \ -{ FLEXT_CAST(c)->M_FUN(arg1,arg2,arg3,arg4,arg5); return true; } - - -// Shortcuts - -//! Set up a method callback for 1 float argument -#define FLEXT_CALLBACK_F(M_FUN) \ -\ -FLEXT_CALLBACK_1(M_FUN,float) - -//! Set up a method callback for 2 float arguments -#define FLEXT_CALLBACK_FF(M_FUN) \ -\ -FLEXT_CALLBACK_2(M_FUN,float,float) - -//! Set up a method callback for 3 float arguments -#define FLEXT_CALLBACK_FFF(M_FUN) \ -\ -FLEXT_CALLBACK_3(M_FUN,float,float,float) - -//! Set up a method callback for 1 integer argument -#define FLEXT_CALLBACK_I(M_FUN) \ -\ -FLEXT_CALLBACK_1(M_FUN,int) - -//! Set up a method callback for 2 integer arguments -#define FLEXT_CALLBACK_II(M_FUN) \ -\ -FLEXT_CALLBACK_2(M_FUN,int,int) - -//! Set up a method callback for 3 integer arguments -#define FLEXT_CALLBACK_III(M_FUN) \ -\ -FLEXT_CALLBACK_3(M_FUN,int,int,int) - -//! Set up a method callback for 1 symbol argument -#define FLEXT_CALLBACK_S(M_FUN) \ -\ -FLEXT_CALLBACK_1(M_FUN,t_symptr) - - -//! \deprecated -#define FLEXT_CALLBACK_G FLEXT_CALLBACK_V - -//! @} FLEXT_D_CALLBACK - - - -/*! \defgroup FLEXT_D_THREAD Declare threaded method callbacks - @{ -*/ - -#ifdef FLEXT_THREADS - -//! Set up a threaded method callback with no arguments -#define FLEXT_THREAD(M_FUN) \ -static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c) { \ - thr_params *p = new thr_params; \ - return c->StartThread(FLEXT_THR_PRE(M_FUN),p,#M_FUN); \ -} \ -static void FLEXT_THR_PRE(M_FUN)(thr_params *p) { \ - thisType *th = FLEXT_CAST(p->cl); \ - bool ok = th->PushThread(); \ - delete p; \ - if(ok) { \ - th->M_FUN(); \ - th->PopThread(); \ - } \ -} - -//! Set up a threaded method callback for an anything argument -#define FLEXT_THREAD_A(M_FUN) \ -static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,t_symbol *s,int argc,t_atom *argv) { \ - thr_params *p = new thr_params; p->set_any(s,argc,argv); \ - return c->StartThread(FLEXT_THR_PRE(M_FUN),p,#M_FUN); \ -} \ -static void FLEXT_THR_PRE(M_FUN)(thr_params *p) { \ - thisType *th = FLEXT_CAST(p->cl); \ - bool ok = th->PushThread(); \ - AtomAnything *args = p->var[0]._any.args; \ - delete p; \ - if(ok) { \ - th->M_FUN(args->Header(),args->Count(),args->Atoms()); \ - th->PopThread(); \ - } \ - delete args; \ -} - -//! Set up a threaded method callback for a variable argument list -#define FLEXT_THREAD_V(M_FUN) \ -static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,int argc,t_atom *argv) { \ - thr_params *p = new thr_params; p->set_list(argc,argv); \ - return c->StartThread(FLEXT_THR_PRE(M_FUN),p,#M_FUN); \ -} \ -static void FLEXT_THR_PRE(M_FUN)(thr_params *p) { \ - thisType *th = FLEXT_CAST(p->cl); \ - bool ok = th->PushThread(); \ - AtomList *args = p->var[0]._list.args; \ - delete p; \ - if(ok) { \ - th->M_FUN(args->Count(),args->Atoms()); \ - th->PopThread(); \ - } \ - delete args; \ -} - -/*! \brief Set up a threaded method callback for an arbitrary data struct. - \note Data is pure... no destructor is called upon delete -*/ -#define FLEXT_THREAD_X(M_FUN) \ -static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,void *data) { \ - thr_params *p = new thr_params; p->var[0]._ext.data = data; \ - return c->StartThread(FLEXT_THR_PRE(M_FUN),p,#M_FUN); \ -} \ -static void FLEXT_THR_PRE(M_FUN)(thr_params *p) { \ - thisType *th = FLEXT_CAST(p->cl); \ - bool ok = th->PushThread(); \ - void *data = p->var[0]._ext.data; \ - delete p; \ - if(ok) { \ - th->M_FUN(data); \ - th->PopThread(); \ - } \ - delete (char *)data; \ -} - -//! Set up a threaded method callback for a boolean argument -#define FLEXT_THREAD_B(M_FUN) \ -static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,int &arg1) { \ - thr_params *p = new thr_params; p->var[0]._bool = arg1 != 0; \ - return c->StartThread(FLEXT_THR_PRE(M_FUN),p,#M_FUN); \ -} \ -static void FLEXT_THR_PRE(M_FUN)(thr_params *p) { \ - thisType *th = FLEXT_CAST(p->cl); \ - bool ok = th->PushThread(); \ - bool b = p->var[0]._bool; \ - delete p; \ - if(ok) { \ - th->M_FUN(b); \ - th->PopThread(); \ - } \ -} - -//! Set up a threaded method callback for 1 argument -#define FLEXT_THREAD_1(M_FUN,TP1) \ -static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,TP1 &arg1) { \ - thr_params *p = new thr_params(1); \ - p->var[0]._ ## TP1 = arg1; \ - return c->StartThread(FLEXT_THR_PRE(M_FUN),p,#M_FUN); \ -} \ -static void FLEXT_THR_PRE(M_FUN)(thr_params *p) { \ - thisType *th = FLEXT_CAST(p->cl); \ - bool ok = th->PushThread(); \ - const TP1 v1 = p->var[0]._ ## TP1; \ - delete p; \ - if(ok) { \ - th->M_FUN(v1); \ - th->PopThread(); \ - } \ -} - -//! Set up a threaded method callback for 2 arguments -#define FLEXT_THREAD_2(M_FUN,TP1,TP2) \ -static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,TP1 &arg1,TP2 &arg2) { \ - thr_params *p = new thr_params(2); \ - p->var[0]._ ## TP1 = arg1; \ - p->var[1]._ ## TP2 = arg2; \ - return c->StartThread(FLEXT_THR_PRE(M_FUN),p,#M_FUN); \ -} \ -static void FLEXT_THR_PRE(M_FUN)(thr_params *p) { \ - thisType *th = FLEXT_CAST(p->cl); \ - bool ok = th->PushThread(); \ - const TP1 v1 = p->var[0]._ ## TP1; \ - const TP1 v2 = p->var[1]._ ## TP2; \ - delete p; \ - if(ok) { \ - th->M_FUN(v1,v2); \ - th->PopThread(); \ - } \ -} - -//! Set up a threaded method callback for 3 arguments -#define FLEXT_THREAD_3(M_FUN,TP1,TP2,TP3) \ -static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,TP1 &arg1,TP2 &arg2,TP3 &arg3) { \ - thr_params *p = new thr_params(3); \ - p->var[0]._ ## TP1 = arg1; \ - p->var[1]._ ## TP2 = arg2; \ - p->var[2]._ ## TP3 = arg3; \ - return c->StartThread(FLEXT_THR_PRE(M_FUN),p,#M_FUN); \ -} \ -static void FLEXT_THR_PRE(M_FUN)(thr_params *p) { \ - thisType *th = FLEXT_CAST(p->cl); \ - bool ok = th->PushThread(); \ - const TP1 v1 = p->var[0]._ ## TP1; \ - const TP2 v2 = p->var[1]._ ## TP2; \ - const TP3 v3 = p->var[2]._ ## TP3; \ - delete p; \ - if(ok) { \ - th->M_FUN(v1,v2,v3); \ - th->PopThread(); \ - } \ -} - -//! Set up a threaded method callback for 4 arguments -#define FLEXT_THREAD_4(M_FUN,TP1,TP2,TP3,TP4) \ -static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,TP1 &arg1,TP2 &arg2,TP3 &arg3,TP4 &arg4) { \ - thr_params *p = new thr_params(4); \ - p->var[0]._ ## TP1 = arg1; \ - p->var[1]._ ## TP2 = arg2; \ - p->var[2]._ ## TP3 = arg3; \ - p->var[3]._ ## TP4 = arg4; \ - return c->StartThread(FLEXT_THR_PRE(M_FUN),p,#M_FUN); \ -} \ -static void FLEXT_THR_PRE(M_FUN)(thr_params *p) { \ - thisType *th = FLEXT_CAST(p->cl); \ - bool ok = th->PushThread(); \ - const TP1 v1 = p->var[0]._ ## TP1; \ - const TP2 v2 = p->var[1]._ ## TP2; \ - const TP3 v3 = p->var[2]._ ## TP3; \ - const TP4 v4 = p->var[3]._ ## TP4; \ - delete p; \ - if(ok) { \ - th->M_FUN(v1,v2,v3,v4); \ - th->PopThread(); \ - } \ -} - -//! Set up a threaded method callback for 5 arguments -#define FLEXT_THREAD_5(M_FUN,TP1,TP2,TP3,TP4,TP5) \ -static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,TP1 &arg1,TP2 &arg2,TP3 &arg3,TP4 &arg4,TP5 &arg5) { \ - thr_params *p = new thr_params(5); \ - p->var[0]._ ## TP1 = arg1; \ - p->var[1]._ ## TP2 = arg2; \ - p->var[2]._ ## TP3 = arg3; \ - p->var[3]._ ## TP4 = arg4; \ - p->var[4]._ ## TP5 = arg5; \ - return c->StartThread(FLEXT_THR_PRE(M_FUN),p,#M_FUN); \ -} \ -static void FLEXT_THR_PRE(M_FUN)(thr_params *p) { \ - thisType *th = FLEXT_CAST(p->cl); \ - bool ok = th->PushThread(); \ - const TP1 v1 = p->var[0]._ ## TP1; \ - const TP2 v2 = p->var[1]._ ## TP2; \ - const TP3 v3 = p->var[2]._ ## TP3; \ - const TP4 v4 = p->var[3]._ ## TP4; \ - const TP5 v5 = p->var[4]._ ## TP5; \ - delete p; \ - if(ok) { \ - th->M_FUN(v1,v2,v3,v4,v5); \ - th->PopThread(); \ - } \ -} - - -//! Shortcuts - -//! Set up a threaded method callback for 1 float argument -#define FLEXT_THREAD_F(M_FUN) \ -\ -FLEXT_THREAD_1(M_FUN,float) - -//! Set up a threaded method callback for 2 float arguments -#define FLEXT_THREAD_FF(M_FUN) \ -\ -FLEXT_THREAD_2(M_FUN,float,float) - -//! Set up a threaded method callback for 3 float arguments -#define FLEXT_THREAD_FFF(M_FUN) \ -\ -FLEXT_THREAD_3(M_FUN,float,float,float) - -//! Set up a threaded method callback for 1 integer argument -#define FLEXT_THREAD_I(M_FUN) \ -\ -FLEXT_THREAD_1(M_FUN,int) - -//! Set up a threaded method callback for 2 integer arguments -#define FLEXT_THREAD_II(M_FUN) \ -\ -FLEXT_THREAD_2(M_FUN,int,int) - -//! Set up a threaded method callback for 3 integer arguments -#define FLEXT_THREAD_III(M_FUN) \ -\ -FLEXT_THREAD_3(M_FUN,int,int,int) - -//! Set up a threaded method callback for 1 symbol argument -#define FLEXT_THREAD_S(M_FUN) \ -\ -FLEXT_THREAD_1(M_FUN,t_symptr) - -// deprecated -#define FLEXT_THREAD_G FLEXT_THREAD_V - -#endif // FLEXT_THREAD - -//! @} FLEXT_D_THREAD - - - -// ==================================================================================== - -/*! \defgroup FLEXT_D_CADDMETHOD Add flext methods within class scope - \note These can only be used at class construction time - @{ -*/ - -//! Add a method handler for bang -#define FLEXT_CADDBANG(CL,IX,M_FUN) \ -\ -AddMethod(CL,IX,"bang",FLEXT_CALL_PRE(M_FUN)) - -//! Add a handler for a method with either no, list or anything arguments -#define FLEXT_CADDMETHOD(CL,IX,M_FUN) \ -AddMethod(CL,IX,FLEXT_CALL_PRE(M_FUN)) - -//! Add a a handler for a method with implicit arguments -#define FLEXT_CADDMETHOD_(CL,IX,M_TAG,M_FUN) \ -\ -AddMethod(CL,IX,M_TAG,FLEXT_CALL_PRE(M_FUN)) - -//! Add a handler for a method with 1 enum type argument -#define FLEXT_CADDMETHOD_E(CL,IX,M_TAG,M_FUN) \ -\ -AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),a_int,a_null) - -//! Add a handler for a method with 1 argument -#define FLEXT_CADDMETHOD_1(CL,IX,M_TAG,M_FUN,TP1) \ -\ -AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),a_null) - -//! Add a handler for a method with 2 arguments -#define FLEXT_CADDMETHOD_2(CL,IX,M_TAG,M_FUN,TP1,TP2) \ -\ -AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),a_null) - -//! Add a handler for a method with 3 arguments -#define FLEXT_CADDMETHOD_3(CL,IX,M_TAG,M_FUN,TP1,TP2,TP3) \ -\ -AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),a_null) - -//! Add a handler for a method with 4 arguments -#define FLEXT_CADDMETHOD_4(CL,IX,M_TAG,M_FUN,TP1,TP2,TP3,TP4) \ -\ -AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),FLEXTARG(TP4),a_null) - -//! Add a handler for a method with 5 arguments -#define FLEXT_CADDMETHOD_5(CL,IX,M_TAG,M_FUN,TP1,TP2,TP3,TP4,TP5) \ -\ -AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),FLEXTARG(TP4),FLEXTARG(TP5),a_null) - - -// Shortcuts - -//! Add a handler for a method with a boolean argument -#define FLEXT_CADDMETHOD_B(CL,IX,M_TAG,M_FUN) \ -\ -FLEXT_CADDMETHOD_1(CL,IX,M_TAG,M_FUN,bool) - -//! Add a handler for a method with 1 float argument -#define FLEXT_CADDMETHOD_F(CL,IX,M_TAG,M_FUN) \ -\ -FLEXT_CADDMETHOD_1(CL,IX,M_TAG,M_FUN,float) - -//! Add a handler for a method with 2 float arguments -#define FLEXT_CADDMETHOD_FF(CL,IX,M_TAG,M_FUN) \ -\ -FLEXT_CADDMETHOD_2(CL,IX,M_TAG,M_FUN,float,float) - -//! Add a handler for a method with 3 float arguments -#define FLEXT_CADDMETHOD_FFF(CL,IX,M_TAG,M_FUN) \ -\ -FLEXT_CADDMETHOD_3(CL,IX,M_TAG,M_FUN,float,float,float) - -//! Add a handler for a method with 1 integer argument -#define FLEXT_CADDMETHOD_I(CL,IX,M_TAG,M_FUN) \ -\ -FLEXT_CADDMETHOD_1(CL,IX,M_TAG,M_FUN,int) - -//! Add a handler for a method with 2 integer arguments -#define FLEXT_CADDMETHOD_II(CL,IX,M_TAG,M_FUN) \ -\ -FLEXT_CADDMETHOD_2(CL,IX,M_TAG,M_FUN,int,int) - -//! Add a handler for a method with 3 integer arguments -#define FLEXT_CADDMETHOD_III(CL,IX,M_TAG,M_FUN) \ -\ -FLEXT_CADDMETHOD_3(CL,IX,M_TAG,M_FUN,int,int,int) - -//! @} FLEXT_D_CADDMETHOD - - -/*! \defgroup FLEXT_D_ADDMETHOD Add flext methods - \note These can only be used at object construction time - \note (in constructor or in Init() function before call to parent's Init()) - @{ -*/ - -//! Set timer callback -#define FLEXT_ADDTIMER(TMR,M_FUN) \ -\ -TMR.SetCallback(*this,FLEXT_CALL_PRE(M_FUN)) - -//! Enable list element distribution over inlets (if no better handler found) -#define FLEXT_ADDDIST() \ -\ -SetDist(true) - -//! Add a method handler for bang -#define FLEXT_ADDBANG(IX,M_FUN) \ -\ -AddMethod(IX,"bang",FLEXT_CALL_PRE(M_FUN)) - -//! Add a handler for a method with either no, list or anything arguments -#define FLEXT_ADDMETHOD(IX,M_FUN) \ -AddMethod(IX,FLEXT_CALL_PRE(M_FUN)) - -/*! \brief Add a handler for a method with a (variable argument) list - \deprecated This definition obscures that _ indicates the usage of a message tag - use FLEXT_ADDMETHOD instead - \note This is already covered by FLEXT_ADDMETHOD, but here for the sake of clarity -*/ -#define FLEXT_ADDMETHOD_V(IX,M_FUN) \ -\ -AddMethod(IX,FLEXT_CALL_PRE(M_FUN)) - -/*! \brief Add a handler for a method with an anything argument - \deprecated This definition obscures that _ indicates the usage of a message tag - use FLEXT_ADDMETHOD instead - \note This is already covered by FLEXT_ADDMETHOD, but here for the sake of clarity -*/ -#define FLEXT_ADDMETHOD_A(IX,M_FUN) \ -\ -AddMethod(IX,FLEXT_CALL_PRE(M_FUN)) - -//! Add a a handler for a tagged method with implicit arguments -#define FLEXT_ADDMETHOD_(IX,M_TAG,M_FUN) \ -\ -AddMethod(IX,M_TAG,FLEXT_CALL_PRE(M_FUN)) - -//! Add a handler for a method with 1 enum type argument -#define FLEXT_ADDMETHOD_E(IX,M_TAG,M_FUN) \ -\ -AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),a_int,a_null) - -//! Add a handler for a method with 1 argument -#define FLEXT_ADDMETHOD_1(IX,M_TAG,M_FUN,TP1) \ -\ -AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),a_null) - -//! Add a handler for a method with 2 arguments -#define FLEXT_ADDMETHOD_2(IX,M_TAG,M_FUN,TP1,TP2) \ -\ -AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),a_null) - -//! Add a handler for a method with 3 arguments -#define FLEXT_ADDMETHOD_3(IX,M_TAG,M_FUN,TP1,TP2,TP3) \ -\ -AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),a_null) - -//! Add a handler for a method with 4 arguments -#define FLEXT_ADDMETHOD_4(IX,M_TAG,M_FUN,TP1,TP2,TP3,TP4) \ -\ -AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),FLEXTARG(TP4),a_null) - -//! Add a handler for a method with 5 arguments -#define FLEXT_ADDMETHOD_5(IX,M_TAG,M_FUN,TP1,TP2,TP3,TP4,TP5) \ -\ -AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),FLEXTARG(TP4),FLEXTARG(TP5),a_null) - - -// Shortcuts - -//! Add a handler for a method with a boolean argument -#define FLEXT_ADDMETHOD_B(IX,M_TAG,M_FUN) \ -\ -FLEXT_ADDMETHOD_1(IX,M_TAG,M_FUN,bool) - -//! Add a handler for a method with 1 float argument -#define FLEXT_ADDMETHOD_F(IX,M_TAG,M_FUN) \ -\ -FLEXT_ADDMETHOD_1(IX,M_TAG,M_FUN,float) - -//! Add a handler for a method with 2 float arguments -#define FLEXT_ADDMETHOD_FF(IX,M_TAG,M_FUN) \ -\ -FLEXT_ADDMETHOD_2(IX,M_TAG,M_FUN,float,float) - -//! Add a handler for a method with 3 float arguments -#define FLEXT_ADDMETHOD_FFF(IX,M_TAG,M_FUN) \ -\ -FLEXT_ADDMETHOD_3(IX,M_TAG,M_FUN,float,float,float) - -//! Add a handler for a method with 1 integer argument -#define FLEXT_ADDMETHOD_I(IX,M_TAG,M_FUN) \ -\ -FLEXT_ADDMETHOD_1(IX,M_TAG,M_FUN,int) - -//! Add a handler for a method with 2 integer arguments -#define FLEXT_ADDMETHOD_II(IX,M_TAG,M_FUN) \ -\ -FLEXT_ADDMETHOD_2(IX,M_TAG,M_FUN,int,int) - -//! Add a handler for a method with 3 integer arguments -#define FLEXT_ADDMETHOD_III(IX,M_TAG,M_FUN) \ -\ -FLEXT_ADDMETHOD_3(IX,M_TAG,M_FUN,int,int,int) - - -//! @} FLEXT_D_ADDMETHOD - - - -/*! \defgroup FLEXT_D_BINDMETHOD Bind flext methods to symbols - @{ -*/ - -/*! \brief Bind a handler for a method with an anything argument to a symbol -*/ -#define FLEXT_BINDMETHOD(SYM,M_FUN,DATA) \ -\ -BindMethod(SYM,FLEXT_CALL_PRE(M_FUN),DATA) - -/*! \brief Unbind any handler for a method from a symbol - \note Memory associated to the DATA parameter of FLEXT_BINDMETHOD will *not* be freed here. -*/ -#define FLEXT_UNBINDMETHOD(SYM) \ -\ -UnbindMethod(SYM) - - -//! @} FLEXT_D_BINDMETHOD - - - -/*! \defgroup FLEXT_D_CALLMETHOD Call flext methods manually - @{ -*/ - -//! Call a (already defined) method with no arguments -#define FLEXT_CALLMETHOD(M_FUN) \ -\ -FLEXT_CALL_PRE(M_FUN)(this) - -//! Call a (already defined) method with variable list arguments -#define FLEXT_CALLMETHOD_V(M_FUN,ARGC,ARGV) \ -\ -FLEXT_CALL_PRE(M_FUN)(this,ARGC,(t_atom *)(ARGV)) - -//! Call a (already defined) method with anything arguments -#define FLEXT_CALLMETHOD_A(M_FUN,HDR,ARGC,ARGV) \ -\ -FLEXT_CALL_PRE(M_FUN)(this,(t_symbol *)(HDR),ARGC,(t_atom *)(ARGV)) - -//! Call a (already defined) method with a data package (void *) -#define FLEXT_CALLMETHOD_X(M_FUN,DATA) \ -\ -FLEXT_CALL_PRE(M_FUN)(this,DATA) - -//! Call a (already defined) method with 1 enum type argument -#define FLEXT_CALLMETHOD_E(M_FUN,ARG) \ -\ -FLEXT_CALL_PRE(M_FUN)(this,ARG) - -//! Call a (already defined) method with 1 argument -#define FLEXT_CALLMETHOD_1(M_FUN,ARG) \ -\ -FLEXT_CALL_PRE(M_FUN)(this,ARG) - -//! Call a (already defined) method with 2 arguments -#define FLEXT_CALLMETHOD_2(M_FUN,ARG1,ARG2) \ -\ -FLEXT_CALL_PRE(M_FUN)(this,ARG1,ARG2) - -//! Call a (already defined) method with 3 arguments -#define FLEXT_CALLMETHOD_3(M_FUN,ARG1,ARG2,ARG3) \ -\ -FLEXT_CALL_PRE(M_FUN)(this,ARG1,ARG2,ARG3) - -//! Call a (already defined) method with 4 arguments -#define FLEXT_CALLMETHOD_4(M_FUN,ARG1,ARG2,ARG3,ARG4) \ -\ -FLEXT_CALL_PRE(M_FUN)(this,ARG1,ARG2,ARG3,ARG4) - -//! Call a (already defined) method with 5 arguments -#define FLEXT_CALLMETHOD_5(M_FUN,ARG1,ARG2,ARG3,ARG4,ARG5) \ -\ -FLEXT_CALL_PRE(M_FUN)(this,ARG1,ARG2,ARG3,ARG4,ARG5) - -//! @} FLEXT_D_CALLMETHOD - +#include "fldefs_methcb.h" +#include "fldefs_meththr.h" +#include "fldefs_methadd.h" +#include "fldefs_methbind.h" +#include "fldefs_methcall.h" //! @} FLEXT_D_METHOD + #ifdef FLEXT_ATTRIBUTES /*! \defgroup FLEXT_D_ATTRIB Attribute definition @@ -972,360 +57,16 @@ FLEXT_CALL_PRE(M_FUN)(this,ARG1,ARG2,ARG3,ARG4,ARG5) @{ */ -/*! \brief Declare a attribute set function - \internal -*/ -#define FLEXT_CALLSET_(FUN,TP) \ -static bool FLEXT_SET_PRE(FUN)(flext_base *c,TP &arg) \ -{ FLEXT_CAST(c)->FUN(arg); return true; } - -/*! \brief Declare a attribute get function - \internal -*/ -#define FLEXT_CALLGET_(FUN,TP) \ -static bool FLEXT_GET_PRE(FUN)(flext_base *c,TP &arg) \ -{ FLEXT_CAST(c)->FUN(arg); return true; } - -/*! \brief Declare an implicite attribute set function - \internal -*/ -#define FLEXT_ATTRSET_(VAR,TP) \ -static bool FLEXT_SET_PRE(VAR)(flext_base *c,TP &arg) \ -{ FLEXT_CAST(c)->VAR = arg; return true; } - -/*! \brief Declare an implicite attribute get function - \internal -*/ -#define FLEXT_ATTRGET_(VAR,TP) \ -static bool FLEXT_GET_PRE(VAR)(flext_base *c,TP &arg) \ -{ arg = (TP)FLEXT_CAST(c)->VAR; return true; } - - -/*! \defgroup FLEXT_DA_CALLSET Definition of attribute set handlers - @{ -*/ - -//! Declare a set function for a float attribute -#define FLEXT_CALLSET_F(SFUN) \ -\ -FLEXT_CALLSET_(SFUN,float) - -//! Declare a set function for an integer attribute -#define FLEXT_CALLSET_I(SFUN) \ -\ -FLEXT_CALLSET_(SFUN,int) - -//! Declare a set function for a boolean attribute -#define FLEXT_CALLSET_B(FUN) \ -static bool FLEXT_SET_PRE(FUN)(flext_base *c,int &arg) \ -{ bool b = arg != 0; FLEXT_CAST(c)->FUN(b); return true; } - -//! Declare a set function for an enum attribute -#define FLEXT_CALLSET_E(SFUN,TP) \ -\ -FLEXT_CALLSET_(SFUN,TP) - -//! Declare a set function for a symbol attribute -#define FLEXT_CALLSET_S(FUN) \ -static bool FLEXT_SET_PRE(FUN)(flext_base *c,const t_symbol *&arg) \ -{ FLEXT_CAST(c)->FUN(arg); return true; } - -//! Declare a set function for a variable list attribute -#define FLEXT_CALLSET_V(FUN) \ -static bool FLEXT_SET_PRE(FUN)(flext_base *c,AtomList *&arg) \ -{ FLEXT_CAST(c)->FUN(*arg); return true; } - -//! @} FLEXT_DA_CALLSET - -/*! \defgroup FLEXT_DA_CALLGET Definition of attribute get handlers - @{ -*/ - -//! Declare a get function for a float attribute -#define FLEXT_CALLGET_F(GFUN) \ -\ -FLEXT_CALLGET_(GFUN,float) - -//! Declare a get function for an integer attribute -#define FLEXT_CALLGET_I(GFUN) \ -\ -FLEXT_CALLGET_(GFUN,int) - -//! Declare a get function for a boolean attribute -#define FLEXT_CALLGET_B(FUN) \ -static bool FLEXT_GET_PRE(FUN)(flext_base *c,int &arg) \ -{ bool b; FLEXT_CAST(c)->FUN(b); arg = b?1:0; return true; } - -//! Declare a get function for an enum attribute -#define FLEXT_CALLGET_E(GFUN,TP) \ -\ -FLEXT_CALLGET_(GFUN,TP) - -//! Declare a get function for a symbol attribute -#define FLEXT_CALLGET_S(FUN) \ -static bool FLEXT_GET_PRE(FUN)(flext_base *c,const t_symbol *&arg) \ -{ FLEXT_CAST(c)->FUN(arg); return true; } - -//! Declare a get function for a variable list attribute -#define FLEXT_CALLGET_V(FUN) \ -static bool FLEXT_GET_PRE(FUN)(flext_base *c,AtomList *&arg) \ -{ FLEXT_CAST(c)->FUN(*arg); return true; } - -//! @} FLEXT_DA_CALLGET - - -/*! \defgroup FLEXT_DA_CALLVAR Definition of attribute transfer handlers (both get and set) - @{ -*/ - -//! Declare both get and set functions for a float attribute -#define FLEXT_CALLVAR_F(GFUN,SFUN) \ -\ -FLEXT_CALLGET_F(GFUN) FLEXT_CALLSET_F(SFUN) - -//! Declare both get and set functions for an integer attribute -#define FLEXT_CALLVAR_I(GFUN,SFUN) \ -\ -FLEXT_CALLGET_I(GFUN) FLEXT_CALLSET_I(SFUN) - -//! Declare both get and set functions for a symbol attribute -#define FLEXT_CALLVAR_S(GFUN,SFUN) \ -\ -FLEXT_CALLGET_S(GFUN) FLEXT_CALLSET_S(SFUN) - -//! Declare both get and set functions for a boolean attribute -#define FLEXT_CALLVAR_B(GFUN,SFUN) \ -\ -FLEXT_CALLGET_B(GFUN) FLEXT_CALLSET_B(SFUN) - -//! Declare both get and set functions for an enum attribute -#define FLEXT_CALLVAR_E(GFUN,SFUN,TP) \ -\ -FLEXT_CALLGET_E(GFUN,TP) FLEXT_CALLSET_E(SFUN,TP) - -//! Declare both get and set functions for a variable list attribute -#define FLEXT_CALLVAR_V(GFUN,SFUN) \ -\ -FLEXT_CALLGET_V(GFUN) FLEXT_CALLSET_V(SFUN) - -//! @} FLEXT_DA_CALLVAR - - -/*! \defgroup FLEXT_DA_ATTRSET Definition of implicite attribute set handlers - @{ -*/ - -//! Declare an implicite set function for a float attribute -#define FLEXT_ATTRSET_F(VAR) \ -\ -FLEXT_ATTRSET_(VAR,float) - -//! Declare an implicite set function for an integer attribute -#define FLEXT_ATTRSET_I(VAR) \ -\ -FLEXT_ATTRSET_(VAR,int) - -//! Declare an implicite set function for a symbol attribute -#define FLEXT_ATTRSET_S(VAR) \ -\ -FLEXT_ATTRSET_(VAR,t_symptr) - -//! Declare an implicite set function for a boolean attribute -#define FLEXT_ATTRSET_B(VAR) \ -static bool FLEXT_SET_PRE(VAR)(flext_base *c,int &arg) \ -{ FLEXT_CAST(c)->VAR = arg != 0; return true; } - -//! Declare an implicite set function for an enum attribute -#define FLEXT_ATTRSET_E(VAR,TP) \ -\ -FLEXT_ATTRSET_(VAR,TP) - -//! Declare an implicite set function for a variable list attribute -#define FLEXT_ATTRSET_V(VAR) \ -static bool FLEXT_SET_PRE(VAR)(flext_base *c,AtomList *&arg) \ -{ FLEXT_CAST(c)->VAR = *arg; return true; } - -//! @} FLEXT_DA_ATTRSET - -/*! \defgroup FLEXT_DA_ATTRGET Definition of implicite attribute get handlers - @{ -*/ - -//! Declare an implicite get function for a float attribute -#define FLEXT_ATTRGET_F(VAR) \ -\ -FLEXT_ATTRGET_(VAR,float) - -//! Declare an implicite get function for an integer attribute -#define FLEXT_ATTRGET_I(VAR) \ -\ -FLEXT_ATTRGET_(VAR,int) - -//! Declare an implicite get function for a symbol attribute -#define FLEXT_ATTRGET_S(VAR) \ -\ -FLEXT_ATTRGET_(VAR,t_symptr) - -//! Declare an implicite get function for a boolean attribute -#define FLEXT_ATTRGET_B(VAR) \ -static bool FLEXT_GET_PRE(VAR)(flext_base *c,int &arg) \ -{ arg = FLEXT_CAST(c)->VAR?1:0; return true; } - -//! Declare an implicite get function for an enum attribute -#define FLEXT_ATTRGET_E(VAR,TP) \ -\ -FLEXT_ATTRGET_(VAR,TP) - -//! Declare an implicite get function for a variable list attribute -#define FLEXT_ATTRGET_V(VAR) \ -static bool FLEXT_GET_PRE(VAR)(flext_base *c,AtomList *&arg) \ -{ *arg = FLEXT_CAST(c)->VAR; return true; } - -//! @} FLEXT_DA_ATTRGET - - -/*! \defgroup FLEXT_DA_ATTRVAR Definition of implicite attribute transfer handlers (both get and set) - @{ -*/ - -//! Declare both implicite get and set functions for a float attribute -#define FLEXT_ATTRVAR_F(VAR) \ -\ -FLEXT_ATTRGET_F(VAR) FLEXT_ATTRSET_F(VAR) - -//! Declare both implicite get and set functions for an integer attribute -#define FLEXT_ATTRVAR_I(VAR) \ -\ -FLEXT_ATTRGET_I(VAR) FLEXT_ATTRSET_I(VAR) - -//! Declare both implicite get and set functions for a symbol attribute -#define FLEXT_ATTRVAR_S(VAR) \ -\ -FLEXT_ATTRGET_S(VAR) FLEXT_ATTRSET_S(VAR) - -//! Declare both implicite get and set functions for a boolean attribute -#define FLEXT_ATTRVAR_B(VAR) \ -\ -FLEXT_ATTRGET_B(VAR) FLEXT_ATTRSET_B(VAR) - -//! Declare both implicite get and set functions for an enum attribute -#define FLEXT_ATTRVAR_E(VAR,TP) \ -\ -FLEXT_ATTRGET_(VAR,TP) FLEXT_ATTRSET_(VAR,TP) - -//! Declare both implicite get and set functions for a variable list attribute -#define FLEXT_ATTRVAR_V(VAR) \ -\ -FLEXT_ATTRGET_V(VAR) FLEXT_ATTRSET_V(VAR) - - -//! @} FLEXT_DA_ATTRVAR - - -/*! \defgroup FLEXT_D_CADDATTR Announce object attributes at class scope - \note These can only be used at class construction time - @{ -*/ - -//! Add handler for a gettable attribute -#define FLEXT_CADDATTR_GET(CL,NAME,GFUN) \ -\ -AddAttrib(CL,NAME,(FLEXT_GET_PRE(GFUN)),NULL) - -//! Add handler for a settable attribute -#define FLEXT_CADDATTR_SET(CL,NAME,SFUN) \ -\ -AddAttrib(CL,NAME,NULL,(FLEXT_SET_PRE(SFUN))) - -//! Add handlers for a both get- and settable attribute -#define FLEXT_CADDATTR_VAR(CL,NAME,GFUN,SFUN) \ -\ -AddAttrib(CL,NAME,(FLEXT_GET_PRE(GFUN)),(FLEXT_SET_PRE(SFUN))) - -//! Add handlers for a both get- and settable attribute -#define FLEXT_CADDATTR_VAR1(CL,NAME,FUN) \ -\ -AddAttrib(CL,NAME,(FLEXT_GET_PRE(FUN)),(FLEXT_SET_PRE(FUN))) - - -//! Add handler for a gettable enum attribute -#define FLEXT_CADDATTR_GET_E(CL,NAME,GFUN) \ -\ -AddAttrib(CL,NAME,(bool (*)(flext_base *,int &))(FLEXT_GET_PRE(GFUN)),NULL) - -//! Add handler for a settable enum attribute -#define FLEXT_CADDATTR_SET_E(CL,NAME,SFUN) \ -\ -AddAttrib(CL,NAME,NULL,(bool (*)(flext_base *,int &))(FLEXT_SET_PRE(SFUN))) - -//! Add handlers for a both get- and settable enum attribute -#define FLEXT_CADDATTR_VAR_E(CL,NAME,GFUN,SFUN) \ -\ -AddAttrib(CL,NAME,(bool (*)(flext_base *,int &))(FLEXT_GET_PRE(GFUN)),(bool (*)(flext_base *,int &))(FLEXT_SET_PRE(SFUN))) - -//! Add handlers for a both get- and settable enum attribute -#define FLEXT_CADDATTR_VAR1_E(CL,NAME,FUN) \ -\ -AddAttrib(CL,NAME,(bool (*)(flext_base *,int &))(FLEXT_GET_PRE(FUN)),(bool (*)(flext_base *,int &))(FLEXT_SET_PRE(FUN))) - -//! @} FLEXT_D_CADDATTR - - -/*! \defgroup FLEXT_D_ADDATTR Announce object attributes - \note These can only be used at object construction time - \note (in constructor or in Init() function before call to parent's Init()) - @{ -*/ - -//! Add handler for a gettable attribute -#define FLEXT_ADDATTR_GET(NAME,GFUN) \ -\ -AddAttrib(NAME,(FLEXT_GET_PRE(GFUN)),NULL) - -//! Add handler for a settable attribute -#define FLEXT_ADDATTR_SET(NAME,SFUN) \ -\ -AddAttrib(NAME,NULL,(FLEXT_SET_PRE(SFUN))) - -//! Add handlers for a both get- and settable attribute -#define FLEXT_ADDATTR_VAR(NAME,GFUN,SFUN) \ -\ -AddAttrib(NAME,(FLEXT_GET_PRE(GFUN)),(FLEXT_SET_PRE(SFUN))) - -//! Add handlers for a both get- and settable attribute -#define FLEXT_ADDATTR_VAR1(NAME,FUN) \ -\ -AddAttrib(NAME,(FLEXT_GET_PRE(FUN)),(FLEXT_SET_PRE(FUN))) - - -//! Add handler for a gettable enum attribute -#define FLEXT_ADDATTR_GET_E(NAME,GFUN) \ -\ -AddAttrib(NAME,(bool (*)(flext_base *,int &))(FLEXT_GET_PRE(GFUN)),NULL) - -//! Add handler for a settable enum attribute -#define FLEXT_ADDATTR_SET_E(NAME,SFUN) \ -\ -AddAttrib(NAME,NULL,(bool (*)(flext_base *,int &))(FLEXT_SET_PRE(SFUN))) - -//! Add handlers for a both get- and settable enum attribute -#define FLEXT_ADDATTR_VAR_E(NAME,GFUN,SFUN) \ -\ -AddAttrib(NAME,(bool (*)(flext_base *,int &))(FLEXT_GET_PRE(GFUN)),(bool (*)(flext_base *,int &))(FLEXT_SET_PRE(SFUN))) - -//! Add handlers for a both get- and settable enum attribute -#define FLEXT_ADDATTR_VAR1_E(NAME,FUN) \ -\ -AddAttrib(NAME,(bool (*)(flext_base *,int &))(FLEXT_GET_PRE(FUN)),(bool (*)(flext_base *,int &))(FLEXT_SET_PRE(FUN))) - -//! @} FLEXT_D_ADDATTR - +#include "fldefs_attrcb.h" +#include "fldefs_attrvar.h" +#include "fldefs_attradd.h" //! @} FLEXT_D_ATTRIB #endif // FLEXT_ATTRIBUTES + //! @} FLEXT_DEFS #endif // __FLEXT_DEFS_H diff --git a/externals/grill/flext/source/fldefs_attradd.h b/externals/grill/flext/source/fldefs_attradd.h new file mode 100644 index 00000000..db0ce82b --- /dev/null +++ b/externals/grill/flext/source/fldefs_attradd.h @@ -0,0 +1,119 @@ +/* + +flext - C++ layer for Max/MSP and pd (pure data) externals + +Copyright (c) 2001-2003 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 fldefs_attradd.h + \brief This file contains all #defines for actual usage + +*/ + +#ifndef __FLEXT_DEFS_ATTRADD_H +#define __FLEXT_DEFS_ATTRADD_H + + +/*! \defgroup FLEXT_D_CADDATTR Announce object attributes at class scope + \note These can only be used at class construction time + @{ +*/ + +//! Add handler for a gettable attribute +#define FLEXT_CADDATTR_GET(CL,NAME,GFUN) \ +\ +AddAttrib(CL,NAME,(FLEXT_GET_PRE(GFUN)),NULL) + +//! Add handler for a settable attribute +#define FLEXT_CADDATTR_SET(CL,NAME,SFUN) \ +\ +AddAttrib(CL,NAME,NULL,(FLEXT_SET_PRE(SFUN))) + +//! Add handlers for a both get- and settable attribute +#define FLEXT_CADDATTR_VAR(CL,NAME,GFUN,SFUN) \ +\ +AddAttrib(CL,NAME,(FLEXT_GET_PRE(GFUN)),(FLEXT_SET_PRE(SFUN))) + +//! Add handlers for a both get- and settable attribute +#define FLEXT_CADDATTR_VAR1(CL,NAME,FUN) \ +\ +AddAttrib(CL,NAME,(FLEXT_GET_PRE(FUN)),(FLEXT_SET_PRE(FUN))) + + +//! Add handler for a gettable enum attribute +#define FLEXT_CADDATTR_GET_E(CL,NAME,GFUN) \ +\ +AddAttrib(CL,NAME,(bool (*)(flext_base *,int &))(FLEXT_GET_PRE(GFUN)),NULL) + +//! Add handler for a settable enum attribute +#define FLEXT_CADDATTR_SET_E(CL,NAME,SFUN) \ +\ +AddAttrib(CL,NAME,NULL,(bool (*)(flext_base *,int &))(FLEXT_SET_PRE(SFUN))) + +//! Add handlers for a both get- and settable enum attribute +#define FLEXT_CADDATTR_VAR_E(CL,NAME,GFUN,SFUN) \ +\ +AddAttrib(CL,NAME,(bool (*)(flext_base *,int &))(FLEXT_GET_PRE(GFUN)),(bool (*)(flext_base *,int &))(FLEXT_SET_PRE(SFUN))) + +//! Add handlers for a both get- and settable enum attribute +#define FLEXT_CADDATTR_VAR1_E(CL,NAME,FUN) \ +\ +AddAttrib(CL,NAME,(bool (*)(flext_base *,int &))(FLEXT_GET_PRE(FUN)),(bool (*)(flext_base *,int &))(FLEXT_SET_PRE(FUN))) + +//! @} FLEXT_D_CADDATTR + + +/*! \defgroup FLEXT_D_ADDATTR Announce object attributes + \note These can only be used at object construction time + \note (in constructor or in Init() function before call to parent's Init()) + @{ +*/ + +//! Add handler for a gettable attribute +#define FLEXT_ADDATTR_GET(NAME,GFUN) \ +\ +AddAttrib(NAME,(FLEXT_GET_PRE(GFUN)),NULL) + +//! Add handler for a settable attribute +#define FLEXT_ADDATTR_SET(NAME,SFUN) \ +\ +AddAttrib(NAME,NULL,(FLEXT_SET_PRE(SFUN))) + +//! Add handlers for a both get- and settable attribute +#define FLEXT_ADDATTR_VAR(NAME,GFUN,SFUN) \ +\ +AddAttrib(NAME,(FLEXT_GET_PRE(GFUN)),(FLEXT_SET_PRE(SFUN))) + +//! Add handlers for a both get- and settable attribute +#define FLEXT_ADDATTR_VAR1(NAME,FUN) \ +\ +AddAttrib(NAME,(FLEXT_GET_PRE(FUN)),(FLEXT_SET_PRE(FUN))) + + +//! Add handler for a gettable enum attribute +#define FLEXT_ADDATTR_GET_E(NAME,GFUN) \ +\ +AddAttrib(NAME,(bool (*)(flext_base *,int &))(FLEXT_GET_PRE(GFUN)),NULL) + +//! Add handler for a settable enum attribute +#define FLEXT_ADDATTR_SET_E(NAME,SFUN) \ +\ +AddAttrib(NAME,NULL,(bool (*)(flext_base *,int &))(FLEXT_SET_PRE(SFUN))) + +//! Add handlers for a both get- and settable enum attribute +#define FLEXT_ADDATTR_VAR_E(NAME,GFUN,SFUN) \ +\ +AddAttrib(NAME,(bool (*)(flext_base *,int &))(FLEXT_GET_PRE(GFUN)),(bool (*)(flext_base *,int &))(FLEXT_SET_PRE(SFUN))) + +//! Add handlers for a both get- and settable enum attribute +#define FLEXT_ADDATTR_VAR1_E(NAME,FUN) \ +\ +AddAttrib(NAME,(bool (*)(flext_base *,int &))(FLEXT_GET_PRE(FUN)),(bool (*)(flext_base *,int &))(FLEXT_SET_PRE(FUN))) + +//! @} FLEXT_D_ADDATTR + + +#endif diff --git a/externals/grill/flext/source/fldefs_attrcb.h b/externals/grill/flext/source/fldefs_attrcb.h new file mode 100644 index 00000000..4e2fc700 --- /dev/null +++ b/externals/grill/flext/source/fldefs_attrcb.h @@ -0,0 +1,147 @@ +/* + +flext - C++ layer for Max/MSP and pd (pure data) externals + +Copyright (c) 2001-2003 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 fldefs_attrcb.h + \brief This file contains all #defines for actual usage + +*/ + +#ifndef __FLEXT_DEFS_ATTRCB_H +#define __FLEXT_DEFS_ATTRCB_H + + + +/*! \brief Declare a attribute set function + \internal +*/ +#define FLEXT_CALLSET_(FUN,TP) \ +static bool FLEXT_SET_PRE(FUN)(flext_base *c,TP &arg) \ +{ FLEXT_CAST(c)->FUN(arg); return true; } + +/*! \brief Declare a attribute get function + \internal +*/ +#define FLEXT_CALLGET_(FUN,TP) \ +static bool FLEXT_GET_PRE(FUN)(flext_base *c,TP &arg) \ +{ FLEXT_CAST(c)->FUN(arg); return true; } + + + +/*! \defgroup FLEXT_DA_CALLSET Definition of attribute set handlers + @{ +*/ + +//! Declare a set function for a float attribute +#define FLEXT_CALLSET_F(SFUN) \ +\ +FLEXT_CALLSET_(SFUN,float) + +//! Declare a set function for an integer attribute +#define FLEXT_CALLSET_I(SFUN) \ +\ +FLEXT_CALLSET_(SFUN,int) + +//! Declare a set function for a boolean attribute +#define FLEXT_CALLSET_B(FUN) \ +static bool FLEXT_SET_PRE(FUN)(flext_base *c,int &arg) \ +{ bool b = arg != 0; FLEXT_CAST(c)->FUN(b); return true; } + +//! Declare a set function for an enum attribute +#define FLEXT_CALLSET_E(SFUN,TP) \ +\ +FLEXT_CALLSET_(SFUN,TP) + +//! Declare a set function for a symbol attribute +#define FLEXT_CALLSET_S(FUN) \ +static bool FLEXT_SET_PRE(FUN)(flext_base *c,const t_symbol *&arg) \ +{ FLEXT_CAST(c)->FUN(arg); return true; } + +//! Declare a set function for a variable list attribute +#define FLEXT_CALLSET_V(FUN) \ +static bool FLEXT_SET_PRE(FUN)(flext_base *c,AtomList *&arg) \ +{ FLEXT_CAST(c)->FUN(*arg); return true; } + +//! @} FLEXT_DA_CALLSET + +/*! \defgroup FLEXT_DA_CALLGET Definition of attribute get handlers + @{ +*/ + +//! Declare a get function for a float attribute +#define FLEXT_CALLGET_F(GFUN) \ +\ +FLEXT_CALLGET_(GFUN,float) + +//! Declare a get function for an integer attribute +#define FLEXT_CALLGET_I(GFUN) \ +\ +FLEXT_CALLGET_(GFUN,int) + +//! Declare a get function for a boolean attribute +#define FLEXT_CALLGET_B(FUN) \ +static bool FLEXT_GET_PRE(FUN)(flext_base *c,int &arg) \ +{ bool b; FLEXT_CAST(c)->FUN(b); arg = b?1:0; return true; } + +//! Declare a get function for an enum attribute +#define FLEXT_CALLGET_E(GFUN,TP) \ +\ +FLEXT_CALLGET_(GFUN,TP) + +//! Declare a get function for a symbol attribute +#define FLEXT_CALLGET_S(FUN) \ +static bool FLEXT_GET_PRE(FUN)(flext_base *c,const t_symbol *&arg) \ +{ FLEXT_CAST(c)->FUN(arg); return true; } + +//! Declare a get function for a variable list attribute +#define FLEXT_CALLGET_V(FUN) \ +static bool FLEXT_GET_PRE(FUN)(flext_base *c,AtomList *&arg) \ +{ FLEXT_CAST(c)->FUN(*arg); return true; } + +//! @} FLEXT_DA_CALLGET + + +/*! \defgroup FLEXT_DA_CALLVAR Definition of attribute transfer handlers (both get and set) + @{ +*/ + +//! Declare both get and set functions for a float attribute +#define FLEXT_CALLVAR_F(GFUN,SFUN) \ +\ +FLEXT_CALLGET_F(GFUN) FLEXT_CALLSET_F(SFUN) + +//! Declare both get and set functions for an integer attribute +#define FLEXT_CALLVAR_I(GFUN,SFUN) \ +\ +FLEXT_CALLGET_I(GFUN) FLEXT_CALLSET_I(SFUN) + +//! Declare both get and set functions for a symbol attribute +#define FLEXT_CALLVAR_S(GFUN,SFUN) \ +\ +FLEXT_CALLGET_S(GFUN) FLEXT_CALLSET_S(SFUN) + +//! Declare both get and set functions for a boolean attribute +#define FLEXT_CALLVAR_B(GFUN,SFUN) \ +\ +FLEXT_CALLGET_B(GFUN) FLEXT_CALLSET_B(SFUN) + +//! Declare both get and set functions for an enum attribute +#define FLEXT_CALLVAR_E(GFUN,SFUN,TP) \ +\ +FLEXT_CALLGET_E(GFUN,TP) FLEXT_CALLSET_E(SFUN,TP) + +//! Declare both get and set functions for a variable list attribute +#define FLEXT_CALLVAR_V(GFUN,SFUN) \ +\ +FLEXT_CALLGET_V(GFUN) FLEXT_CALLSET_V(SFUN) + +//! @} FLEXT_DA_CALLVAR + + +#endif diff --git a/externals/grill/flext/source/fldefs_attrvar.h b/externals/grill/flext/source/fldefs_attrvar.h new file mode 100644 index 00000000..876f49f2 --- /dev/null +++ b/externals/grill/flext/source/fldefs_attrvar.h @@ -0,0 +1,147 @@ +/* + +flext - C++ layer for Max/MSP and pd (pure data) externals + +Copyright (c) 2001-2003 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 fldefs_attrvar.h + \brief This file contains all #defines for actual usage + +*/ + +#ifndef __FLEXT_DEFS_ATTRVAR_H +#define __FLEXT_DEFS_ATTRVAR_H + + +/*! \brief Declare an implicite attribute set function + \internal +*/ +#define FLEXT_ATTRSET_(VAR,TP) \ +static bool FLEXT_SET_PRE(VAR)(flext_base *c,TP &arg) \ +{ FLEXT_CAST(c)->VAR = arg; return true; } + +/*! \brief Declare an implicite attribute get function + \internal +*/ +#define FLEXT_ATTRGET_(VAR,TP) \ +static bool FLEXT_GET_PRE(VAR)(flext_base *c,TP &arg) \ +{ arg = (TP)FLEXT_CAST(c)->VAR; return true; } + + + +/*! \defgroup FLEXT_DA_ATTRSET Definition of implicite attribute set handlers + @{ +*/ + +//! Declare an implicite set function for a float attribute +#define FLEXT_ATTRSET_F(VAR) \ +\ +FLEXT_ATTRSET_(VAR,float) + +//! Declare an implicite set function for an integer attribute +#define FLEXT_ATTRSET_I(VAR) \ +\ +FLEXT_ATTRSET_(VAR,int) + +//! Declare an implicite set function for a symbol attribute +#define FLEXT_ATTRSET_S(VAR) \ +\ +FLEXT_ATTRSET_(VAR,t_symptr) + +//! Declare an implicite set function for a boolean attribute +#define FLEXT_ATTRSET_B(VAR) \ +static bool FLEXT_SET_PRE(VAR)(flext_base *c,int &arg) \ +{ FLEXT_CAST(c)->VAR = arg != 0; return true; } + +//! Declare an implicite set function for an enum attribute +#define FLEXT_ATTRSET_E(VAR,TP) \ +\ +FLEXT_ATTRSET_(VAR,TP) + +//! Declare an implicite set function for a variable list attribute +#define FLEXT_ATTRSET_V(VAR) \ +static bool FLEXT_SET_PRE(VAR)(flext_base *c,AtomList *&arg) \ +{ FLEXT_CAST(c)->VAR = *arg; return true; } + +//! @} FLEXT_DA_ATTRSET + +/*! \defgroup FLEXT_DA_ATTRGET Definition of implicite attribute get handlers + @{ +*/ + +//! Declare an implicite get function for a float attribute +#define FLEXT_ATTRGET_F(VAR) \ +\ +FLEXT_ATTRGET_(VAR,float) + +//! Declare an implicite get function for an integer attribute +#define FLEXT_ATTRGET_I(VAR) \ +\ +FLEXT_ATTRGET_(VAR,int) + +//! Declare an implicite get function for a symbol attribute +#define FLEXT_ATTRGET_S(VAR) \ +\ +FLEXT_ATTRGET_(VAR,t_symptr) + +//! Declare an implicite get function for a boolean attribute +#define FLEXT_ATTRGET_B(VAR) \ +static bool FLEXT_GET_PRE(VAR)(flext_base *c,int &arg) \ +{ arg = FLEXT_CAST(c)->VAR?1:0; return true; } + +//! Declare an implicite get function for an enum attribute +#define FLEXT_ATTRGET_E(VAR,TP) \ +\ +FLEXT_ATTRGET_(VAR,TP) + +//! Declare an implicite get function for a variable list attribute +#define FLEXT_ATTRGET_V(VAR) \ +static bool FLEXT_GET_PRE(VAR)(flext_base *c,AtomList *&arg) \ +{ *arg = FLEXT_CAST(c)->VAR; return true; } + +//! @} FLEXT_DA_ATTRGET + + +/*! \defgroup FLEXT_DA_ATTRVAR Definition of implicite attribute transfer handlers (both get and set) + @{ +*/ + +//! Declare both implicite get and set functions for a float attribute +#define FLEXT_ATTRVAR_F(VAR) \ +\ +FLEXT_ATTRGET_F(VAR) FLEXT_ATTRSET_F(VAR) + +//! Declare both implicite get and set functions for an integer attribute +#define FLEXT_ATTRVAR_I(VAR) \ +\ +FLEXT_ATTRGET_I(VAR) FLEXT_ATTRSET_I(VAR) + +//! Declare both implicite get and set functions for a symbol attribute +#define FLEXT_ATTRVAR_S(VAR) \ +\ +FLEXT_ATTRGET_S(VAR) FLEXT_ATTRSET_S(VAR) + +//! Declare both implicite get and set functions for a boolean attribute +#define FLEXT_ATTRVAR_B(VAR) \ +\ +FLEXT_ATTRGET_B(VAR) FLEXT_ATTRSET_B(VAR) + +//! Declare both implicite get and set functions for an enum attribute +#define FLEXT_ATTRVAR_E(VAR,TP) \ +\ +FLEXT_ATTRGET_(VAR,TP) FLEXT_ATTRSET_(VAR,TP) + +//! Declare both implicite get and set functions for a variable list attribute +#define FLEXT_ATTRVAR_V(VAR) \ +\ +FLEXT_ATTRGET_V(VAR) FLEXT_ATTRSET_V(VAR) + + +//! @} FLEXT_DA_ATTRVAR + + +#endif diff --git a/externals/grill/flext/source/fldefs_hdr.h b/externals/grill/flext/source/fldefs_hdr.h new file mode 100644 index 00000000..99e15872 --- /dev/null +++ b/externals/grill/flext/source/fldefs_hdr.h @@ -0,0 +1,53 @@ +/* + +flext - C++ layer for Max/MSP and pd (pure data) externals + +Copyright (c) 2001-2003 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 fldefs_hdr.h + \brief This file contains all #defines for actual usage + +*/ + +#ifndef __FLEXT_DEFS_HEADER_H +#define __FLEXT_DEFS_HEADER_H + + +/*! \defgroup FLEXT_D_HEADER Flext class header + \note One (and only one!) of these definitions is compulsory for the class declaration. + \note It has to be placed somewhere in the class definition (not necessarily in a public section). + + @{ +*/ + +/*! \brief Plain flext class header + \param NEW_CLASS name of the current C++ class + \param PARENT_CLASS name of the base C++ class (e.g. flext_base or flext_dsp) +*/ +#define FLEXT_HEADER(NEW_CLASS,PARENT_CLASS) \ +\ +FLEXT_REALHDR(NEW_CLASS, PARENT_CLASS) + +/*! \brief Flext class header with setup function + \param NEW_CLASS name of the current C++ class + \param PARENT_CLASS name of the base C++ class (e.g. flext_base or flext_dsp) + \param SETUPFUN setup function, of type "void (*setupfn)(t_class *)" + + The setup function is called after class creation. It corresponds to the + original PD "[object]_setup" function, apart from the + fact that all necessary class initializations have already been taken care of by flext. + The setup function can e.g. be used for a message to the console upon first creation of an object. +*/ +#define FLEXT_HEADER_S(NEW_CLASS, PARENT_CLASS, SETUPFUN)\ +\ +FLEXT_REALHDR_S(NEW_CLASS, PARENT_CLASS, SETUPFUN) + + +//! @} FLEXT_D_HEADER + + +#endif diff --git a/externals/grill/flext/source/fldefs_methadd.h b/externals/grill/flext/source/fldefs_methadd.h new file mode 100644 index 00000000..f2f2d62b --- /dev/null +++ b/externals/grill/flext/source/fldefs_methadd.h @@ -0,0 +1,227 @@ +/* + +flext - C++ layer for Max/MSP and pd (pure data) externals + +Copyright (c) 2001-2003 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 fldefs_methadd.h + \brief This file contains all #defines for actual usage + +*/ + +#ifndef __FLEXT_DEFS_METHADD_H +#define __FLEXT_DEFS_METHADD_H + + +/*! \defgroup FLEXT_D_CADDMETHOD Add flext methods within class scope + \note These can only be used at class construction time + @{ +*/ + +//! Add a method handler for bang +#define FLEXT_CADDBANG(CL,IX,M_FUN) \ +\ +AddMethod(CL,IX,"bang",FLEXT_CALL_PRE(M_FUN)) + +//! Add a handler for a method with either no, list or anything arguments +#define FLEXT_CADDMETHOD(CL,IX,M_FUN) \ +AddMethod(CL,IX,FLEXT_CALL_PRE(M_FUN)) + +//! Add a a handler for a method with implicit arguments +#define FLEXT_CADDMETHOD_(CL,IX,M_TAG,M_FUN) \ +\ +AddMethod(CL,IX,M_TAG,FLEXT_CALL_PRE(M_FUN)) + +//! Add a handler for a method with 1 enum type argument +#define FLEXT_CADDMETHOD_E(CL,IX,M_TAG,M_FUN) \ +\ +AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),a_int,a_null) + +//! Add a handler for a method with 1 argument +#define FLEXT_CADDMETHOD_1(CL,IX,M_TAG,M_FUN,TP1) \ +\ +AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),a_null) + +//! Add a handler for a method with 2 arguments +#define FLEXT_CADDMETHOD_2(CL,IX,M_TAG,M_FUN,TP1,TP2) \ +\ +AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),a_null) + +//! Add a handler for a method with 3 arguments +#define FLEXT_CADDMETHOD_3(CL,IX,M_TAG,M_FUN,TP1,TP2,TP3) \ +\ +AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),a_null) + +//! Add a handler for a method with 4 arguments +#define FLEXT_CADDMETHOD_4(CL,IX,M_TAG,M_FUN,TP1,TP2,TP3,TP4) \ +\ +AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),FLEXTARG(TP4),a_null) + +//! Add a handler for a method with 5 arguments +#define FLEXT_CADDMETHOD_5(CL,IX,M_TAG,M_FUN,TP1,TP2,TP3,TP4,TP5) \ +\ +AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),FLEXTARG(TP4),FLEXTARG(TP5),a_null) + + +// Shortcuts + +//! Add a handler for a method with a boolean argument +#define FLEXT_CADDMETHOD_B(CL,IX,M_TAG,M_FUN) \ +\ +FLEXT_CADDMETHOD_1(CL,IX,M_TAG,M_FUN,bool) + +//! Add a handler for a method with 1 float argument +#define FLEXT_CADDMETHOD_F(CL,IX,M_TAG,M_FUN) \ +\ +FLEXT_CADDMETHOD_1(CL,IX,M_TAG,M_FUN,float) + +//! Add a handler for a method with 2 float arguments +#define FLEXT_CADDMETHOD_FF(CL,IX,M_TAG,M_FUN) \ +\ +FLEXT_CADDMETHOD_2(CL,IX,M_TAG,M_FUN,float,float) + +//! Add a handler for a method with 3 float arguments +#define FLEXT_CADDMETHOD_FFF(CL,IX,M_TAG,M_FUN) \ +\ +FLEXT_CADDMETHOD_3(CL,IX,M_TAG,M_FUN,float,float,float) + +//! Add a handler for a method with 1 integer argument +#define FLEXT_CADDMETHOD_I(CL,IX,M_TAG,M_FUN) \ +\ +FLEXT_CADDMETHOD_1(CL,IX,M_TAG,M_FUN,int) + +//! Add a handler for a method with 2 integer arguments +#define FLEXT_CADDMETHOD_II(CL,IX,M_TAG,M_FUN) \ +\ +FLEXT_CADDMETHOD_2(CL,IX,M_TAG,M_FUN,int,int) + +//! Add a handler for a method with 3 integer arguments +#define FLEXT_CADDMETHOD_III(CL,IX,M_TAG,M_FUN) \ +\ +FLEXT_CADDMETHOD_3(CL,IX,M_TAG,M_FUN,int,int,int) + +//! @} FLEXT_D_CADDMETHOD + + +/*! \defgroup FLEXT_D_ADDMETHOD Add flext methods + \note These can only be used at object construction time + \note (in constructor or in Init() function before call to parent's Init()) + @{ +*/ + +//! Set timer callback +#define FLEXT_ADDTIMER(TMR,M_FUN) \ +\ +TMR.SetCallback(*this,FLEXT_CALL_PRE(M_FUN)) + +//! Enable list element distribution over inlets (if no better handler found) +#define FLEXT_ADDDIST() \ +\ +SetDist(true) + +//! Add a method handler for bang +#define FLEXT_ADDBANG(IX,M_FUN) \ +\ +AddMethod(IX,"bang",FLEXT_CALL_PRE(M_FUN)) + +//! Add a handler for a method with either no, list or anything arguments +#define FLEXT_ADDMETHOD(IX,M_FUN) \ +AddMethod(IX,FLEXT_CALL_PRE(M_FUN)) + +/*! \brief Add a handler for a method with a (variable argument) list + \deprecated This definition obscures that _ indicates the usage of a message tag - use FLEXT_ADDMETHOD instead + \note This is already covered by FLEXT_ADDMETHOD, but here for the sake of clarity +*/ +#define FLEXT_ADDMETHOD_V(IX,M_FUN) \ +\ +AddMethod(IX,FLEXT_CALL_PRE(M_FUN)) + +/*! \brief Add a handler for a method with an anything argument + \deprecated This definition obscures that _ indicates the usage of a message tag - use FLEXT_ADDMETHOD instead + \note This is already covered by FLEXT_ADDMETHOD, but here for the sake of clarity +*/ +#define FLEXT_ADDMETHOD_A(IX,M_FUN) \ +\ +AddMethod(IX,FLEXT_CALL_PRE(M_FUN)) + +//! Add a a handler for a tagged method with implicit arguments +#define FLEXT_ADDMETHOD_(IX,M_TAG,M_FUN) \ +\ +AddMethod(IX,M_TAG,FLEXT_CALL_PRE(M_FUN)) + +//! Add a handler for a method with 1 enum type argument +#define FLEXT_ADDMETHOD_E(IX,M_TAG,M_FUN) \ +\ +AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),a_int,a_null) + +//! Add a handler for a method with 1 argument +#define FLEXT_ADDMETHOD_1(IX,M_TAG,M_FUN,TP1) \ +\ +AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),a_null) + +//! Add a handler for a method with 2 arguments +#define FLEXT_ADDMETHOD_2(IX,M_TAG,M_FUN,TP1,TP2) \ +\ +AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),a_null) + +//! Add a handler for a method with 3 arguments +#define FLEXT_ADDMETHOD_3(IX,M_TAG,M_FUN,TP1,TP2,TP3) \ +\ +AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),a_null) + +//! Add a handler for a method with 4 arguments +#define FLEXT_ADDMETHOD_4(IX,M_TAG,M_FUN,TP1,TP2,TP3,TP4) \ +\ +AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),FLEXTARG(TP4),a_null) + +//! Add a handler for a method with 5 arguments +#define FLEXT_ADDMETHOD_5(IX,M_TAG,M_FUN,TP1,TP2,TP3,TP4,TP5) \ +\ +AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),FLEXTARG(TP4),FLEXTARG(TP5),a_null) + + +// Shortcuts + +//! Add a handler for a method with a boolean argument +#define FLEXT_ADDMETHOD_B(IX,M_TAG,M_FUN) \ +\ +FLEXT_ADDMETHOD_1(IX,M_TAG,M_FUN,bool) + +//! Add a handler for a method with 1 float argument +#define FLEXT_ADDMETHOD_F(IX,M_TAG,M_FUN) \ +\ +FLEXT_ADDMETHOD_1(IX,M_TAG,M_FUN,float) + +//! Add a handler for a method with 2 float arguments +#define FLEXT_ADDMETHOD_FF(IX,M_TAG,M_FUN) \ +\ +FLEXT_ADDMETHOD_2(IX,M_TAG,M_FUN,float,float) + +//! Add a handler for a method with 3 float arguments +#define FLEXT_ADDMETHOD_FFF(IX,M_TAG,M_FUN) \ +\ +FLEXT_ADDMETHOD_3(IX,M_TAG,M_FUN,float,float,float) + +//! Add a handler for a method with 1 integer argument +#define FLEXT_ADDMETHOD_I(IX,M_TAG,M_FUN) \ +\ +FLEXT_ADDMETHOD_1(IX,M_TAG,M_FUN,int) + +//! Add a handler for a method with 2 integer arguments +#define FLEXT_ADDMETHOD_II(IX,M_TAG,M_FUN) \ +\ +FLEXT_ADDMETHOD_2(IX,M_TAG,M_FUN,int,int) + +//! Add a handler for a method with 3 integer arguments +#define FLEXT_ADDMETHOD_III(IX,M_TAG,M_FUN) \ +\ +FLEXT_ADDMETHOD_3(IX,M_TAG,M_FUN,int,int,int) + + +//! @} FLEXT_D_ADDMETHOD + +#endif diff --git a/externals/grill/flext/source/fldefs_methbind.h b/externals/grill/flext/source/fldefs_methbind.h new file mode 100644 index 00000000..977e22f8 --- /dev/null +++ b/externals/grill/flext/source/fldefs_methbind.h @@ -0,0 +1,41 @@ +/* + +flext - C++ layer for Max/MSP and pd (pure data) externals + +Copyright (c) 2001-2003 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 fldefs_methbind.h + \brief This file contains all #defines for actual usage + +*/ + +#ifndef __FLEXT_DEFS_METHBIND_H +#define __FLEXT_DEFS_METHBIND_H + + +/*! \defgroup FLEXT_D_BINDMETHOD Bind flext methods to symbols + @{ +*/ + +/*! \brief Bind a handler for a method with an anything argument to a symbol +*/ +#define FLEXT_BINDMETHOD(SYM,M_FUN,DATA) \ +\ +BindMethod(SYM,FLEXT_CALL_PRE(M_FUN),DATA) + +/*! \brief Unbind any handler for a method from a symbol + \note Memory associated to the DATA parameter of FLEXT_BINDMETHOD will *not* be freed here. +*/ +#define FLEXT_UNBINDMETHOD(SYM) \ +\ +UnbindMethod(SYM) + + +//! @} FLEXT_D_BINDMETHOD + + +#endif diff --git a/externals/grill/flext/source/fldefs_methcall.h b/externals/grill/flext/source/fldefs_methcall.h new file mode 100644 index 00000000..8085e9d9 --- /dev/null +++ b/externals/grill/flext/source/fldefs_methcall.h @@ -0,0 +1,77 @@ +/* + +flext - C++ layer for Max/MSP and pd (pure data) externals + +Copyright (c) 2001-2003 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 fldefs_methbind.h + \brief This file contains all #defines for actual usage + +*/ + +#ifndef __FLEXT_DEFS_METHCALL_H +#define __FLEXT_DEFS_METHCALL_H + + +/*! \defgroup FLEXT_D_CALLMETHOD Call flext methods manually + @{ +*/ + +//! Call a (already defined) method with no arguments +#define FLEXT_CALLMETHOD(M_FUN) \ +\ +FLEXT_CALL_PRE(M_FUN)(this) + +//! Call a (already defined) method with variable list arguments +#define FLEXT_CALLMETHOD_V(M_FUN,ARGC,ARGV) \ +\ +FLEXT_CALL_PRE(M_FUN)(this,ARGC,(t_atom *)(ARGV)) + +//! Call a (already defined) method with anything arguments +#define FLEXT_CALLMETHOD_A(M_FUN,HDR,ARGC,ARGV) \ +\ +FLEXT_CALL_PRE(M_FUN)(this,(t_symbol *)(HDR),ARGC,(t_atom *)(ARGV)) + +//! Call a (already defined) method with a data package (void *) +#define FLEXT_CALLMETHOD_X(M_FUN,DATA) \ +\ +FLEXT_CALL_PRE(M_FUN)(this,DATA) + +//! Call a (already defined) method with 1 enum type argument +#define FLEXT_CALLMETHOD_E(M_FUN,ARG) \ +\ +FLEXT_CALL_PRE(M_FUN)(this,ARG) + +//! Call a (already defined) method with 1 argument +#define FLEXT_CALLMETHOD_1(M_FUN,ARG) \ +\ +FLEXT_CALL_PRE(M_FUN)(this,ARG) + +//! Call a (already defined) method with 2 arguments +#define FLEXT_CALLMETHOD_2(M_FUN,ARG1,ARG2) \ +\ +FLEXT_CALL_PRE(M_FUN)(this,ARG1,ARG2) + +//! Call a (already defined) method with 3 arguments +#define FLEXT_CALLMETHOD_3(M_FUN,ARG1,ARG2,ARG3) \ +\ +FLEXT_CALL_PRE(M_FUN)(this,ARG1,ARG2,ARG3) + +//! Call a (already defined) method with 4 arguments +#define FLEXT_CALLMETHOD_4(M_FUN,ARG1,ARG2,ARG3,ARG4) \ +\ +FLEXT_CALL_PRE(M_FUN)(this,ARG1,ARG2,ARG3,ARG4) + +//! Call a (already defined) method with 5 arguments +#define FLEXT_CALLMETHOD_5(M_FUN,ARG1,ARG2,ARG3,ARG4,ARG5) \ +\ +FLEXT_CALL_PRE(M_FUN)(this,ARG1,ARG2,ARG3,ARG4,ARG5) + +//! @} FLEXT_D_CALLMETHOD + + +#endif diff --git a/externals/grill/flext/source/fldefs_methcb.h b/externals/grill/flext/source/fldefs_methcb.h new file mode 100644 index 00000000..de279d92 --- /dev/null +++ b/externals/grill/flext/source/fldefs_methcb.h @@ -0,0 +1,128 @@ +/* + +flext - C++ layer for Max/MSP and pd (pure data) externals + +Copyright (c) 2001-2003 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 fldefs_methcb.h + \brief This file contains all #defines for actual usage + +*/ + +#ifndef __FLEXT_DEFS_METHCB_H +#define __FLEXT_DEFS_METHCB_H + + +/*! \defgroup FLEXT_D_CALLBACK Declare callbacks for class methods + @{ +*/ + +//! Set up a method callback with no arguments +#define FLEXT_CALLBACK(M_FUN) \ +static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c) \ +{ FLEXT_CAST(c)->M_FUN(); return true; } + +//! Set up a method callback for an anything argument +#define FLEXT_CALLBACK_A(M_FUN) \ +static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,t_symbol *s,int argc,t_atom *argv) \ +{ FLEXT_CAST(c)->M_FUN(s,argc,argv); return true; } + +//! Set up a method callback for a variable argument list +#define FLEXT_CALLBACK_V(M_FUN) \ +static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,int argc,t_atom *argv) \ +{ FLEXT_CAST(c)->M_FUN(argc,argv); return true; } + +//! Set up a method callback for a data package (void *) argument +#define FLEXT_CALLBACK_X(M_FUN) \ +static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,void *data) \ +{ FLEXT_CAST(c)->M_FUN(data); return true; } + +//! Set up a method callback for an anything argument and a data package (e.g. for symbol-bound methods). +#define FLEXT_CALLBACK_AX(M_FUN) \ +static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,t_symbol *s,int argc,t_atom *argv,void *data) \ +{ FLEXT_CAST(c)->M_FUN(s,argc,argv,data); return true; } + +//! Set up a timer callback +#define FLEXT_CALLBACK_T(M_FUN) \ +\ +FLEXT_CALLBACK_X(M_FUN) + +//! Set up a method callback for a boolean argument +#define FLEXT_CALLBACK_B(M_FUN) \ +static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,int &arg1) \ +{ FLEXT_CAST(c)->M_FUN(arg1 != 0); return true; } + +//! Set up a method callback for 1 argument +#define FLEXT_CALLBACK_1(M_FUN,TP1) \ +static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,TP1 &arg1) \ +{ FLEXT_CAST(c)->M_FUN(arg1); return true; } + +//! Set up a method callback for 2 arguments +#define FLEXT_CALLBACK_2(M_FUN,TP1,TP2) \ +static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,TP1 &arg1,TP2 &arg2) \ +{ FLEXT_CAST(c)->M_FUN(arg1,arg2); return true; } + +//! Set up a method callback for 3 arguments +#define FLEXT_CALLBACK_3(M_FUN,TP1,TP2,TP3) \ +static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,TP1 &arg1,TP2 &arg2,TP3 &arg3) \ +{ FLEXT_CAST(c)->M_FUN(arg1,arg2,arg3); return true; } + +//! Set up a method callback for 4 arguments +#define FLEXT_CALLBACK_4(M_FUN,TP1,TP2,TP3,TP4) \ +static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,TP1 &arg1,TP2 &arg2,TP3 &arg3,TP4 &arg4) \ +{ FLEXT_CAST(c)->M_FUN(arg1,arg2,arg3,arg4); return true; } + +//! Set up a method callback for 5 arguments +#define FLEXT_CALLBACK_5(M_FUN,TP1,TP2,TP3,TP4,TP5) \ +static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,TP1 &arg1,TP2 &arg2,TP3 &arg3,TP4 &arg4,TP5 &arg5) \ +{ FLEXT_CAST(c)->M_FUN(arg1,arg2,arg3,arg4,arg5); return true; } + + +// Shortcuts + +//! Set up a method callback for 1 float argument +#define FLEXT_CALLBACK_F(M_FUN) \ +\ +FLEXT_CALLBACK_1(M_FUN,float) + +//! Set up a method callback for 2 float arguments +#define FLEXT_CALLBACK_FF(M_FUN) \ +\ +FLEXT_CALLBACK_2(M_FUN,float,float) + +//! Set up a method callback for 3 float arguments +#define FLEXT_CALLBACK_FFF(M_FUN) \ +\ +FLEXT_CALLBACK_3(M_FUN,float,float,float) + +//! Set up a method callback for 1 integer argument +#define FLEXT_CALLBACK_I(M_FUN) \ +\ +FLEXT_CALLBACK_1(M_FUN,int) + +//! Set up a method callback for 2 integer arguments +#define FLEXT_CALLBACK_II(M_FUN) \ +\ +FLEXT_CALLBACK_2(M_FUN,int,int) + +//! Set up a method callback for 3 integer arguments +#define FLEXT_CALLBACK_III(M_FUN) \ +\ +FLEXT_CALLBACK_3(M_FUN,int,int,int) + +//! Set up a method callback for 1 symbol argument +#define FLEXT_CALLBACK_S(M_FUN) \ +\ +FLEXT_CALLBACK_1(M_FUN,t_symptr) + + +//! \deprecated +#define FLEXT_CALLBACK_G FLEXT_CALLBACK_V + +//! @} FLEXT_D_CALLBACK + +#endif diff --git a/externals/grill/flext/source/fldefs_meththr.h b/externals/grill/flext/source/fldefs_meththr.h new file mode 100644 index 00000000..f0fc6ef0 --- /dev/null +++ b/externals/grill/flext/source/fldefs_meththr.h @@ -0,0 +1,273 @@ +/* + +flext - C++ layer for Max/MSP and pd (pure data) externals + +Copyright (c) 2001-2003 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 fldefs_meththr.h + \brief This file contains all #defines for actual usage + +*/ + +#ifndef __FLEXT_DEFS_METHTHR_H +#define __FLEXT_DEFS_METHTHR_H + + +#ifdef FLEXT_THREADS + + +/*! \defgroup FLEXT_D_THREAD Declare threaded method callbacks + @{ +*/ + +//! Set up a threaded method callback with no arguments +#define FLEXT_THREAD(M_FUN) \ +static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c) { \ + thr_params *p = new thr_params; \ + return c->StartThread(FLEXT_THR_PRE(M_FUN),p,#M_FUN); \ +} \ +static void FLEXT_THR_PRE(M_FUN)(thr_params *p) { \ + thisType *th = FLEXT_CAST(p->cl); \ + bool ok = th->PushThread(); \ + delete p; \ + if(ok) { \ + th->M_FUN(); \ + th->PopThread(); \ + } \ +} + +//! Set up a threaded method callback for an anything argument +#define FLEXT_THREAD_A(M_FUN) \ +static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,t_symbol *s,int argc,t_atom *argv) { \ + thr_params *p = new thr_params; p->set_any(s,argc,argv); \ + return c->StartThread(FLEXT_THR_PRE(M_FUN),p,#M_FUN); \ +} \ +static void FLEXT_THR_PRE(M_FUN)(thr_params *p) { \ + thisType *th = FLEXT_CAST(p->cl); \ + bool ok = th->PushThread(); \ + AtomAnything *args = p->var[0]._any.args; \ + delete p; \ + if(ok) { \ + th->M_FUN(args->Header(),args->Count(),args->Atoms()); \ + th->PopThread(); \ + } \ + delete args; \ +} + +//! Set up a threaded method callback for a variable argument list +#define FLEXT_THREAD_V(M_FUN) \ +static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,int argc,t_atom *argv) { \ + thr_params *p = new thr_params; p->set_list(argc,argv); \ + return c->StartThread(FLEXT_THR_PRE(M_FUN),p,#M_FUN); \ +} \ +static void FLEXT_THR_PRE(M_FUN)(thr_params *p) { \ + thisType *th = FLEXT_CAST(p->cl); \ + bool ok = th->PushThread(); \ + AtomList *args = p->var[0]._list.args; \ + delete p; \ + if(ok) { \ + th->M_FUN(args->Count(),args->Atoms()); \ + th->PopThread(); \ + } \ + delete args; \ +} + +/*! \brief Set up a threaded method callback for an arbitrary data struct. + \note Data is pure... no destructor is called upon delete +*/ +#define FLEXT_THREAD_X(M_FUN) \ +static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,void *data) { \ + thr_params *p = new thr_params; p->var[0]._ext.data = data; \ + return c->StartThread(FLEXT_THR_PRE(M_FUN),p,#M_FUN); \ +} \ +static void FLEXT_THR_PRE(M_FUN)(thr_params *p) { \ + thisType *th = FLEXT_CAST(p->cl); \ + bool ok = th->PushThread(); \ + void *data = p->var[0]._ext.data; \ + delete p; \ + if(ok) { \ + th->M_FUN(data); \ + th->PopThread(); \ + } \ + delete (char *)data; \ +} + +//! Set up a threaded method callback for a boolean argument +#define FLEXT_THREAD_B(M_FUN) \ +static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,int &arg1) { \ + thr_params *p = new thr_params; p->var[0]._bool = arg1 != 0; \ + return c->StartThread(FLEXT_THR_PRE(M_FUN),p,#M_FUN); \ +} \ +static void FLEXT_THR_PRE(M_FUN)(thr_params *p) { \ + thisType *th = FLEXT_CAST(p->cl); \ + bool ok = th->PushThread(); \ + bool b = p->var[0]._bool; \ + delete p; \ + if(ok) { \ + th->M_FUN(b); \ + th->PopThread(); \ + } \ +} + +//! Set up a threaded method callback for 1 argument +#define FLEXT_THREAD_1(M_FUN,TP1) \ +static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,TP1 &arg1) { \ + thr_params *p = new thr_params(1); \ + p->var[0]._ ## TP1 = arg1; \ + return c->StartThread(FLEXT_THR_PRE(M_FUN),p,#M_FUN); \ +} \ +static void FLEXT_THR_PRE(M_FUN)(thr_params *p) { \ + thisType *th = FLEXT_CAST(p->cl); \ + bool ok = th->PushThread(); \ + const TP1 v1 = p->var[0]._ ## TP1; \ + delete p; \ + if(ok) { \ + th->M_FUN(v1); \ + th->PopThread(); \ + } \ +} + +//! Set up a threaded method callback for 2 arguments +#define FLEXT_THREAD_2(M_FUN,TP1,TP2) \ +static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,TP1 &arg1,TP2 &arg2) { \ + thr_params *p = new thr_params(2); \ + p->var[0]._ ## TP1 = arg1; \ + p->var[1]._ ## TP2 = arg2; \ + return c->StartThread(FLEXT_THR_PRE(M_FUN),p,#M_FUN); \ +} \ +static void FLEXT_THR_PRE(M_FUN)(thr_params *p) { \ + thisType *th = FLEXT_CAST(p->cl); \ + bool ok = th->PushThread(); \ + const TP1 v1 = p->var[0]._ ## TP1; \ + const TP1 v2 = p->var[1]._ ## TP2; \ + delete p; \ + if(ok) { \ + th->M_FUN(v1,v2); \ + th->PopThread(); \ + } \ +} + +//! Set up a threaded method callback for 3 arguments +#define FLEXT_THREAD_3(M_FUN,TP1,TP2,TP3) \ +static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,TP1 &arg1,TP2 &arg2,TP3 &arg3) { \ + thr_params *p = new thr_params(3); \ + p->var[0]._ ## TP1 = arg1; \ + p->var[1]._ ## TP2 = arg2; \ + p->var[2]._ ## TP3 = arg3; \ + return c->StartThread(FLEXT_THR_PRE(M_FUN),p,#M_FUN); \ +} \ +static void FLEXT_THR_PRE(M_FUN)(thr_params *p) { \ + thisType *th = FLEXT_CAST(p->cl); \ + bool ok = th->PushThread(); \ + const TP1 v1 = p->var[0]._ ## TP1; \ + const TP2 v2 = p->var[1]._ ## TP2; \ + const TP3 v3 = p->var[2]._ ## TP3; \ + delete p; \ + if(ok) { \ + th->M_FUN(v1,v2,v3); \ + th->PopThread(); \ + } \ +} + +//! Set up a threaded method callback for 4 arguments +#define FLEXT_THREAD_4(M_FUN,TP1,TP2,TP3,TP4) \ +static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,TP1 &arg1,TP2 &arg2,TP3 &arg3,TP4 &arg4) { \ + thr_params *p = new thr_params(4); \ + p->var[0]._ ## TP1 = arg1; \ + p->var[1]._ ## TP2 = arg2; \ + p->var[2]._ ## TP3 = arg3; \ + p->var[3]._ ## TP4 = arg4; \ + return c->StartThread(FLEXT_THR_PRE(M_FUN),p,#M_FUN); \ +} \ +static void FLEXT_THR_PRE(M_FUN)(thr_params *p) { \ + thisType *th = FLEXT_CAST(p->cl); \ + bool ok = th->PushThread(); \ + const TP1 v1 = p->var[0]._ ## TP1; \ + const TP2 v2 = p->var[1]._ ## TP2; \ + const TP3 v3 = p->var[2]._ ## TP3; \ + const TP4 v4 = p->var[3]._ ## TP4; \ + delete p; \ + if(ok) { \ + th->M_FUN(v1,v2,v3,v4); \ + th->PopThread(); \ + } \ +} + +//! Set up a threaded method callback for 5 arguments +#define FLEXT_THREAD_5(M_FUN,TP1,TP2,TP3,TP4,TP5) \ +static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,TP1 &arg1,TP2 &arg2,TP3 &arg3,TP4 &arg4,TP5 &arg5) { \ + thr_params *p = new thr_params(5); \ + p->var[0]._ ## TP1 = arg1; \ + p->var[1]._ ## TP2 = arg2; \ + p->var[2]._ ## TP3 = arg3; \ + p->var[3]._ ## TP4 = arg4; \ + p->var[4]._ ## TP5 = arg5; \ + return c->StartThread(FLEXT_THR_PRE(M_FUN),p,#M_FUN); \ +} \ +static void FLEXT_THR_PRE(M_FUN)(thr_params *p) { \ + thisType *th = FLEXT_CAST(p->cl); \ + bool ok = th->PushThread(); \ + const TP1 v1 = p->var[0]._ ## TP1; \ + const TP2 v2 = p->var[1]._ ## TP2; \ + const TP3 v3 = p->var[2]._ ## TP3; \ + const TP4 v4 = p->var[3]._ ## TP4; \ + const TP5 v5 = p->var[4]._ ## TP5; \ + delete p; \ + if(ok) { \ + th->M_FUN(v1,v2,v3,v4,v5); \ + th->PopThread(); \ + } \ +} + + +//! Shortcuts + +//! Set up a threaded method callback for 1 float argument +#define FLEXT_THREAD_F(M_FUN) \ +\ +FLEXT_THREAD_1(M_FUN,float) + +//! Set up a threaded method callback for 2 float arguments +#define FLEXT_THREAD_FF(M_FUN) \ +\ +FLEXT_THREAD_2(M_FUN,float,float) + +//! Set up a threaded method callback for 3 float arguments +#define FLEXT_THREAD_FFF(M_FUN) \ +\ +FLEXT_THREAD_3(M_FUN,float,float,float) + +//! Set up a threaded method callback for 1 integer argument +#define FLEXT_THREAD_I(M_FUN) \ +\ +FLEXT_THREAD_1(M_FUN,int) + +//! Set up a threaded method callback for 2 integer arguments +#define FLEXT_THREAD_II(M_FUN) \ +\ +FLEXT_THREAD_2(M_FUN,int,int) + +//! Set up a threaded method callback for 3 integer arguments +#define FLEXT_THREAD_III(M_FUN) \ +\ +FLEXT_THREAD_3(M_FUN,int,int,int) + +//! Set up a threaded method callback for 1 symbol argument +#define FLEXT_THREAD_S(M_FUN) \ +\ +FLEXT_THREAD_1(M_FUN,t_symptr) + +// deprecated +#define FLEXT_THREAD_G FLEXT_THREAD_V + +//! @} FLEXT_D_THREAD + + +#endif // FLEXT_THREADS + + +#endif diff --git a/externals/grill/flext/source/fldefs_setup.h b/externals/grill/flext/source/fldefs_setup.h new file mode 100644 index 00000000..b1a1f00d --- /dev/null +++ b/externals/grill/flext/source/fldefs_setup.h @@ -0,0 +1,259 @@ +/* + +flext - C++ layer for Max/MSP and pd (pure data) externals + +Copyright (c) 2001-2003 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 fldef_setup.h + \brief This file contains all #defines for actual usage + +*/ + +#ifndef __FLEXT_DEFS_SETUP_H +#define __FLEXT_DEFS_SETUP_H + +// ==================================================================================== + +/*! \defgroup FLEXT_D_INSTANCE Class instantiation + \note The name of your class is of importance! It must be the same as the external + \note (excluded an eventual ~ (tilde)) +*/ + + +/*! \defgroup FLEXT_D_NEW Stand-alone class instantiation + Makes an actual instance of a stand-alone class. +*/ + +/*! \defgroup FLEXT_D_NEW_DSP Dsp class instantiation + Makes an actual instance of a dsp (aka "tilde") class (with signal processing). +*/ + +/*! \defgroup FLEXT_D_LIB Library class instantiation + Makes an actual instance of a class which is part of an object library (and not stand-alone). +*/ + +/*! \defgroup FLEXT_D_LIB_DSP Dsp library class instantiation + Makes an actual instance of a dsp (aka "tilde") class with signal processing + which is part of an object library (and not stand-alone). +*/ + +// NO ARGUMENTS +// ---------------------------------------- + +/*! \brief Implementation of a flext class with no arguments + \ingroup FLEXT_D_NEW + \param NAME the object's actual name(s) as a string (like "*", "trigger", "noise~", etc.) + \param NEW_CLASS the object's C++ class name +*/ +#define FLEXT_NEW(NAME,NEW_CLASS) \ +\ +REAL_NEW(NAME,NEW_CLASS,0,0) + +/*! \brief Implementation of a flext dsp class with no arguments + \ingroup FLEXT_D_NEW_DSP +*/ +#define FLEXT_NEW_DSP(NAME,NEW_CLASS) \ +\ +REAL_NEW(NAME,NEW_CLASS,1,0) + +/*! \brief Implementation of a flext class (part of a library) with no arguments + \ingroup FLEXT_D_LIB +*/ +#define FLEXT_LIB(NAME,NEW_CLASS) \ +\ +REAL_NEW(NAME,NEW_CLASS,0,1) + +/*! \brief Implementation of a flext dsp class (part of a library) with no arguments + \ingroup FLEXT_D_LIB_DSP +*/ +#define FLEXT_LIB_DSP(NAME,NEW_CLASS) \ +\ +REAL_NEW(NAME,NEW_CLASS,1,1) + + +// VARIABLE ARGUMENT LIST +// ---------------------------------------- + +/*! \brief Implementation of a flext class with a variable argument list + \ingroup FLEXT_D_NEW +*/ +#define FLEXT_NEW_V(NAME,NEW_CLASS) \ +\ +REAL_NEW_V(NAME,NEW_CLASS,0,0) \ + +/*! \brief Implementation of a flext dsp class with a variable argument list + \ingroup FLEXT_D_NEW_DSP +*/ +#define FLEXT_NEW_DSP_V(NAME,NEW_CLASS) \ +\ +REAL_NEW_V(NAME,NEW_CLASS,1,0) \ + +/*! \brief Implementation of a flext class (part of a library) with a variable argument list + \ingroup FLEXT_D_LIB +*/ +#define FLEXT_LIB_V(NAME,NEW_CLASS) \ +\ +REAL_NEW_V(NAME,NEW_CLASS, 0,1) + +/*! \brief Implementation of a flext dsp class (part of a library) with a variable argument list + \ingroup FLEXT_D_LIB_DSP +*/ +#define FLEXT_LIB_DSP_V(NAME,NEW_CLASS) \ +\ +REAL_NEW_V(NAME,NEW_CLASS, 1,1) + + +// ONE ARGUMENT +// ---------------------------------------- + +/*! \brief Implementation of a flext class with one argument + \ingroup FLEXT_D_NEW +*/ +#define FLEXT_NEW_1(NAME,NEW_CLASS, TYPE) \ +\ +REAL_NEW_1(NAME,NEW_CLASS, 0, 0,TYPE) \ + +/*! \brief Implementation of a flext dsp class with one argument + \ingroup FLEXT_D_NEW_DSP +*/ +#define FLEXT_NEW_DSP_1(NAME,NEW_CLASS, TYPE) \ +\ +REAL_NEW_1(NAME,NEW_CLASS, 1, 0,TYPE) \ + +/*! \brief Implementation of a flext class (part of a library) with one argument + \ingroup FLEXT_D_LIB +*/ +#define FLEXT_LIB_1(NAME,NEW_CLASS, TYPE) \ +\ +REAL_NEW_1(NAME,NEW_CLASS, 0,1,TYPE) + +/*! \brief Implementation of a flext dsp class (part of a library) with one argument + \ingroup FLEXT_D_LIB_DSP +*/ +#define FLEXT_LIB_DSP_1(NAME,NEW_CLASS, TYPE) \ +\ +REAL_NEW_1(NAME,NEW_CLASS, 1,1, TYPE) + + +// TWO ARGUMENTS +// ---------------------------------------- + +/*! \brief Implementation of a flext class with 2 arguments + \ingroup FLEXT_D_NEW +*/ +#define FLEXT_NEW_2(NAME,NEW_CLASS, TYPE1, TYPE2) \ +\ +REAL_NEW_2(NAME,NEW_CLASS, 0,0, TYPE1, TYPE2) \ + +/*! \brief Implementation of a flext dsp class with 2 arguments + \ingroup FLEXT_D_NEW_DSP +*/ +#define FLEXT_NEW_DSP_2(NAME,NEW_CLASS, TYPE1, TYPE2) \ +\ +REAL_NEW_2(NAME,NEW_CLASS, 1,0, TYPE1, TYPE2) \ + +/*! \brief Implementation of a flext class (part of a library) with 2 arguments + \ingroup FLEXT_D_LIB +*/ +#define FLEXT_LIB_2(NAME,NEW_CLASS, TYPE1, TYPE2) \ +\ +REAL_NEW_2(NAME,NEW_CLASS, 0,1, TYPE1, TYPE2) + +/*! \brief Implementation of a flext dsp class (part of a library) with 2 arguments + \ingroup FLEXT_D_LIB_DSP +*/ +#define FLEXT_LIB_DSP_2(NAME,NEW_CLASS, TYPE1, TYPE2) \ +\ +REAL_NEW_2(NAME,NEW_CLASS, 1,1, TYPE1, TYPE2) + + +// THREE ARGUMENTS +// ---------------------------------------- + +/*! \brief Implementation of a flext class with 3 arguments + \ingroup FLEXT_D_NEW +*/ +#define FLEXT_NEW_3(NAME,NEW_CLASS, TYPE1, TYPE2, TYPE3) \ +\ +REAL_NEW_3(NAME,NEW_CLASS, 0,0, TYPE1, TYPE2, TYPE3) \ + +/*! \brief Implementation of a flext dsp class with 3 arguments + \ingroup FLEXT_D_NEW_DSP +*/ +#define FLEXT_NEW_DSP_3(NAME,NEW_CLASS, TYPE1, TYPE2, TYPE3) \ +\ +REAL_NEW_3(NAME,NEW_CLASS, 1,0, TYPE1, TYPE2, TYPE3) \ + +/*! \brief Implementation of a flext class (part of a library) with 3 arguments + \ingroup FLEXT_D_LIB +*/ +#define FLEXT_LIB_3(NAME,NEW_CLASS, TYPE1, TYPE2, TYPE3) \ +\ +REAL_NEW_3(NAME,NEW_CLASS, 0,1,TYPE1, TYPE2, TYPE3) + +/*! \brief Implementation of a flext dsp class (part of a library) with 3 arguments + \ingroup FLEXT_D_LIB_DSP +*/ +#define FLEXT_LIB_DSP_3(NAME,NEW_CLASS, TYPE1, TYPE2, TYPE3) \ +\ +REAL_NEW_3(NAME,NEW_CLASS, 1,1, TYPE1, TYPE2, TYPE3) + + +// deprecated stuff + +/*! \defgroup FLEXT_D_DEPRECATED Deprecated definitions + \deprecated + @{ +*/ + +#define FLEXT_NEW_G FLEXT_NEW_V + +#define FLEXT_NEW_TILDE FLEXT_NEW_DSP +#define FLEXT_NEW_TILDE_G FLEXT_NEW_DSP_V +#define FLEXT_NEW_TILDE_1 FLEXT_NEW_DSP_1 +#define FLEXT_NEW_TILDE_2 FLEXT_NEW_DSP_2 +#define FLEXT_NEW_TILDE_3 FLEXT_NEW_DSP_3 + +#define FLEXT_LIB_G FLEXT_LIB_V + +#define FLEXT_LIB_TILDE FLEXT_LIB_DSP +#define FLEXT_LIB_TILDE_G FLEXT_LIB_DSP_V +#define FLEXT_LIB_TILDE_1 FLEXT_LIB_DSP_1 +#define FLEXT_LIB_TILDE_2 FLEXT_LIB_DSP_2 +#define FLEXT_LIB_TILDE_3 FLEXT_LIB_DSP_3 + +#define FLEXT_TILDE_SETUP FLEXT_DSP_SETUP + +//! @} FLEXT_D_DEPRECATED + + +/*! \defgroup FLEXT_D_LIBRARY Definitions for library objects + @{ +*/ + +/*! \brief Specify that to declare the library itself. + \note If you have a library this is compulsory (to register all the objects of the library) +*/ +#define FLEXT_LIB_SETUP(NAME,SETUPFUN) REAL_LIB_SETUP(NAME,SETUPFUN) + +/*! \brief Register an object in the library. + \note This is used in the library setup function +*/ +#define FLEXT_SETUP(cl) REAL_SETUP(cl,0) + +/*! \brief Register a DSP object in the library. + \note This is used in the library setup function +*/ +#define FLEXT_DSP_SETUP(cl) REAL_SETUP(cl,1) + +//! @} FLEXT_D_LIBRARY + + +//! @} FLEXT_D_INSTANCE + + +#endif -- cgit v1.2.1