aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/source
diff options
context:
space:
mode:
Diffstat (limited to 'externals/grill/flext/source')
-rwxr-xr-xexternals/grill/flext/source/Makefile.am129
-rw-r--r--externals/grill/flext/source/flatom.cpp165
-rw-r--r--externals/grill/flext/source/flatom_part.cpp37
-rw-r--r--externals/grill/flext/source/flatom_pr.cpp119
-rw-r--r--externals/grill/flext/source/flattr.cpp445
-rw-r--r--externals/grill/flext/source/flattr_ed.cpp872
-rw-r--r--externals/grill/flext/source/flbase.cpp204
-rw-r--r--externals/grill/flext/source/flbase.h575
-rw-r--r--externals/grill/flext/source/flbind.cpp261
-rw-r--r--externals/grill/flext/source/flbuf.cpp348
-rw-r--r--externals/grill/flext/source/flclass.h1098
-rw-r--r--externals/grill/flext/source/flcontainers.h473
-rw-r--r--externals/grill/flext/source/flcwmax-thr.h31
-rw-r--r--externals/grill/flext/source/flcwmax-x-thr.h31
-rw-r--r--externals/grill/flext/source/flcwmax-x.h24
-rw-r--r--externals/grill/flext/source/flcwmax.h36
-rw-r--r--externals/grill/flext/source/flcwpd-x-thr.h31
-rw-r--r--externals/grill/flext/source/flcwpd-x.h37
-rw-r--r--externals/grill/flext/source/fldefs.h70
-rw-r--r--externals/grill/flext/source/fldefs_attradd.h121
-rw-r--r--externals/grill/flext/source/fldefs_attrcb.h158
-rw-r--r--externals/grill/flext/source/fldefs_attrvar.h158
-rw-r--r--externals/grill/flext/source/fldefs_hdr.h61
-rw-r--r--externals/grill/flext/source/fldefs_methadd.h232
-rw-r--r--externals/grill/flext/source/fldefs_methbind.h48
-rw-r--r--externals/grill/flext/source/fldefs_methcall.h78
-rw-r--r--externals/grill/flext/source/fldefs_methcb.h129
-rw-r--r--externals/grill/flext/source/fldefs_meththr.h273
-rw-r--r--externals/grill/flext/source/fldefs_setup.h337
-rw-r--r--externals/grill/flext/source/fldoxygen.h216
-rw-r--r--externals/grill/flext/source/fldsp.cpp118
-rw-r--r--externals/grill/flext/source/fldsp.h184
-rw-r--r--externals/grill/flext/source/flext.cpp261
-rw-r--r--externals/grill/flext/source/flext.h68
-rw-r--r--externals/grill/flext/source/flfeatures.h34
-rw-r--r--externals/grill/flext/source/flinternal.h119
-rw-r--r--externals/grill/flext/source/flitem.cpp127
-rw-r--r--externals/grill/flext/source/fllib.cpp578
-rw-r--r--externals/grill/flext/source/flmap.cpp249
-rw-r--r--externals/grill/flext/source/flmap.h255
-rw-r--r--externals/grill/flext/source/flmeth.cpp132
-rw-r--r--externals/grill/flext/source/flmsg.cpp295
-rw-r--r--externals/grill/flext/source/flmspbuffer.h83
-rw-r--r--externals/grill/flext/source/flout.cpp332
-rw-r--r--externals/grill/flext/source/flprefix.h433
-rw-r--r--externals/grill/flext/source/flproxy.cpp222
-rw-r--r--externals/grill/flext/source/flqueue.cpp559
-rw-r--r--externals/grill/flext/source/flsimd.cpp2002
-rw-r--r--externals/grill/flext/source/flsndobj.cpp132
-rw-r--r--externals/grill/flext/source/flsndobj.h95
-rw-r--r--externals/grill/flext/source/flstdc.h311
-rw-r--r--externals/grill/flext/source/flstk.cpp117
-rw-r--r--externals/grill/flext/source/flstk.h103
-rw-r--r--externals/grill/flext/source/flsupport.cpp316
-rw-r--r--externals/grill/flext/source/flsupport.h1285
-rw-r--r--externals/grill/flext/source/flthr.cpp646
-rw-r--r--externals/grill/flext/source/fltimer.cpp275
-rw-r--r--externals/grill/flext/source/flutil.cpp48
-rw-r--r--externals/grill/flext/source/flxlet.cpp112
59 files changed, 0 insertions, 16288 deletions
diff --git a/externals/grill/flext/source/Makefile.am b/externals/grill/flext/source/Makefile.am
deleted file mode 100755
index a07525a2..00000000
--- a/externals/grill/flext/source/Makefile.am
+++ /dev/null
@@ -1,129 +0,0 @@
-#
-# automake template
-# added by tim blechmann
-#
-
-lib_LIBRARIES = libflext-pd_s.a libflext-pd_sd.a libflext-pd_t.a libflext-pd_td.a
-
-SRCS_FLEXT = \
- flbase.cpp \
- flext.cpp \
- flbuf.cpp \
- fldsp.cpp \
- fllib.cpp \
- flxlet.cpp \
- flattr.cpp \
- flattr_ed.cpp \
- flsupport.cpp \
- flutil.cpp \
- flatom.cpp \
- flatom_pr.cpp \
- flthr.cpp \
- fltimer.cpp \
- flsimd.cpp \
- flout.cpp \
- flatom_app.cpp \
- flatom_part.cpp \
- flitem.cpp \
- flmeth.cpp \
- flmsg.cpp \
- flproxy.cpp \
- flqueue.cpp \
- flbind.cpp \
- flmap.cpp
-
-pkginclude_HEADERS = \
- flprefix.h \
- flstdc.h \
- flbase.h \
- flclass.h \
- flext.h \
- flsupport.h \
- flmap.h \
- fldsp.h \
- flinternal.h \
- fldefs.h \
- fldefs_hdr.h \
- fldefs_setup.h \
- fldefs_methcb.h \
- fldefs_meththr.h \
- fldefs_methadd.h \
- fldefs_methbind.h \
- fldefs_methcall.h \
- fldefs_attrcb.h \
- fldefs_attrvar.h \
- fldefs_attradd.h
-
-
-# handling for stk / sndobj
-SRCS_STK = flstk.cpp
-HDRS_STK = flstk.cpp
-
-SRCS_SNDOBJ = flsndobj.cpp
-HDRS_SNDOBJ = flsndobj.cpp
-
-if SNDOBJ
-SRCS_FLEXT += $(SRCS_SNDOBJ)
-pkginclude_HEADERS += $(HDRS_SNDOBJ)
-LIB_SNDOBJ = -lsndobj
-endif
-
-if STK
-SRCS_FLEXT += $(SRCS_STK)
-pkginclude_HEADERS += $(HDRS_STK)
-LIB_STK = -lstk
-endif
-
-FRAMEWORKS = @FRAMEWORKS@
-
-# for static libraries we can use automake
-libflext_pd_s_a_SOURCES = $(SRCS_FLEXT)
-libflext_pd_sd_a_SOURCES = $(SRCS_FLEXT)
-libflext_pd_t_a_SOURCES = $(SRCS_FLEXT)
-libflext_pd_td_a_SOURCES = $(SRCS_FLEXT)
-
-libflext_pd_s_a_CXXFLAGS = @OPT_FLAGS@ @INCLUDEDIR@
-libflext_pd_sd_a_CXXFLAGS = @INCLUDEDIR@ -g -DFLEXT_DEBUG
-libflext_pd_t_a_CXXFLAGS = @OPT_FLAGS@ @INCLUDEDIR@ -DFLEXT_THREADS
-libflext_pd_td_a_CXXFLAGS = @INCLUDEDIR@ -g -DFLEXT_DEBUG -DFLEXT_THREADS
-
-libflext_pd_s_a_LDFLAGS = @OPT_FLAGS@ @INCLUDEDIR@ \
- $(patsubst %,-framework %,$(FRAMEWORKS))
-libflext_pd_sd_a_LDFLAGS = @INCLUDEDIR@ -g -DFLEXT_DEBUG \
- $(patsubst %,-framework %,$(FRAMEWORKS))
-libflext_pd_t_a_LDFLAGS = @OPT_FLAGS@ @INCLUDEDIR@ -DFLEXT_THREADS \
- $(patsubst %,-framework %,$(FRAMEWORKS))
-libflext_pd_td_a_LDFLAGS = @INCLUDEDIR@ -g -DFLEXT_DEBUG -DFLEXT_THREADS \
- $(patsubst %,-framework %,$(FRAMEWORKS))
-
-# for shared libraries, we can't ...
-libflext_pd_la_CXXFLAGS = @OPT_FLAGS@ @INCLUDEDIR@ -DFLEXT_SHARED \
- -DFLEXT_EXPORTS $(DEFS)
-libflext_pd_d_la_CXXFLAGS = @INCLUDEDIR@ -g -DFLEXT_DEBUG -DFLEXT_SHARED \
- -DFLEXT_EXPORTS $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES)
-libflext_pd_la_LDFLAGS = @DYNAMIC_LDFLAGS@ $(LIB_STK) $(LIB_SNDOBJ) $(LDFLAGS) \
- $(patsubst %,-framework %,$(FRAMEWORKS))
-libflext_pd_d_la_LDFLAGS = @DYNAMIC_LDFLAGS@ $(LIB_STK) $(LIB_SNDOBJ) $(LDFLAGS)
- $(patsubst %,-framework %,$(FRAMEWORKS))
-
-libflext_pd_la_NAME = libflext-pd.@SOEXT@
-libflext_pd_d_la_NAME = libflext-pd_d.@SOEXT@
-
-all-local: $(libflext_pd_la_NAME) $(libflext_pd_d_la_NAME)
-
-$(libflext_pd_la_NAME): $(patsubst %.cpp,libflext_pd_la-%.o,$(SRCS_FLEXT))
- $(CXX) $(libflext_pd_la_LDFLAGS) $(LIBS) -o $(libflext_pd_la_NAME) $^
-
-libflext_pd_la-%.o : %.cpp
- $(CXX) -c $(libflext_pd_la_CXXFLAGS) $< -o $@
-
-$(libflext_pd_d_la_NAME): $(patsubst %.cpp,libflext_pd_d_la-%.o,$(SRCS_FLEXT))
- $(CXX) $(libflext_pd_d_la_LDFLAGS) $(LIBS) -o $(libflext_pd_d_la_NAME) $^
-
-libflext_pd_d_la-%.o: %.cpp
- $(CXX) -c $(libflext_pd_d_la_CXXFLAGS) $< -o $@
-
-install-exec-local:
- $(libLIBRARIES_INSTALL) $(libflext_pd_la_NAME) $(DESTDIR)$(libdir)
- $(libLIBRARIES_INSTALL) $(libflext_pd_d_la_NAME) $(DESTDIR)$(libdir)
-
diff --git a/externals/grill/flext/source/flatom.cpp b/externals/grill/flext/source/flatom.cpp
deleted file mode 100644
index ea0191c1..00000000
--- a/externals/grill/flext/source/flatom.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2006 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file flatom.cpp
- \brief Definitions for handling the t_atom type and lists thereof.
-*/
-
-#include "flext.h"
-#include <string.h> // for memcpy
-
-#if FLEXT_SYS != FLEXT_SYS_JMAX
-int flext::CmpAtom(const t_atom &a,const t_atom &b)
-{
- if(GetType(a) == GetType(b)) {
- switch(GetType(a)) {
- case A_FLOAT: return GetFloat(a) == GetFloat(b)?0:(GetFloat(a) < GetFloat(b)?-1:1);
-#if FLEXT_SYS == FLEXT_SYS_MAX
- case A_INT: return GetInt(a) == GetInt(b)?0:(GetInt(a) < GetInt(b)?-1:1);
-#endif
- case A_SYMBOL: return GetSymbol(a) == GetSymbol(b)?0:strcmp(GetString(a),GetString(b));
-#if FLEXT_SYS == FLEXT_SYS_PD
- case A_POINTER: return GetPointer(a) == GetPointer(b)?0:(GetPointer(a) < GetPointer(b)?-1:1);
-#endif
- default:
- // can't be compared.....
- FLEXT_ASSERT(false);
- return 0;
- }
- }
- else
- return GetType(a) < GetType(b)?-1:1;
-}
-#else
-#error Not implemented
-#endif
-
-t_atom *flext::CopyList(int argc,const t_atom *argv)
-{
- t_atom *dst = new t_atom[argc];
- memcpy(dst,argv,argc*sizeof(t_atom));
- return dst;
-}
-
-void flext::CopyAtoms(int cnt,t_atom *dst,const t_atom *src)
-{
- if(dst < src)
- // forward
- memcpy(dst,src,cnt*sizeof(t_atom));
- else
- // backwards
- while(cnt--) dst[cnt] = src[cnt];
-}
-
-void flext::AtomList::Alloc(int sz,int keepix,int keeplen,int keepto)
-{
- if(lst) {
- if(cnt == sz) {
- if(keepix >= 0 && keepix != keepto) {
- int c = keeplen >= 0?keeplen:cnt;
- FLEXT_ASSERT(c+keepto <= cnt);
- FLEXT_ASSERT(c+keepix <= cnt);
- CopyAtoms(c,lst+keepto,lst+keepix);
- }
-
- return; // no change
- }
-
- t_atom *l;
- if(sz) {
- l = new t_atom[sz];
- if(keepix >= 0) {
- // keep contents
- int c = keeplen >= 0?keeplen:(cnt > sz?sz:cnt);
- FLEXT_ASSERT(c+keepto <= sz);
- FLEXT_ASSERT(c+keepix <= cnt);
- CopyAtoms(c,l+keepto,lst+keepix);
- }
- }
- else
- l = NULL;
-
- Free();
- lst = l,cnt = sz;
- }
- else {
- FLEXT_ASSERT(cnt == 0);
- if(sz) lst = new t_atom[cnt = sz];
- }
-}
-
-flext::AtomList::~AtomList() { Free(); }
-
-void flext::AtomList::Free()
-{
- if(lst) {
- delete[] lst; lst = NULL;
- cnt = 0;
- }
- else
- FLEXT_ASSERT(cnt == 0);
-}
-
-flext::AtomList &flext::AtomList::Set(int argc,const t_atom *argv,int offs,bool resize)
-{
- int ncnt = argc+offs;
- if(resize) Alloc(ncnt);
-
- // argv can be NULL independently from argc
- if(argv) CopyAtoms(argc,lst+offs,argv);
-
- return *this;
-}
-
-int flext::AtomList::Compare(const AtomList &a) const
-{
- if(Count() == a.Count()) {
- for(int i = 0; i < Count(); ++i) {
- int cmp = CmpAtom(lst[i],a[i]);
- if(cmp) return cmp;
- }
- return 0;
- }
- else
- return Count() < a.Count()?-1:1;
-}
-
-flext::AtomListStaticBase::~AtomListStaticBase() { Free(); }
-
-void flext::AtomListStaticBase::Alloc(int sz,int keepix,int keeplen,int keepto)
-{
- if(sz <= precnt) {
- // small enough for pre-allocated space
-
- if(lst != predata && lst) {
- // currently allocated memory is larger than what we need
-
- if(keepix >= 0) {
- // keep contents
- int c = keeplen >= 0?keeplen:(cnt > sz?sz:cnt);
- FLEXT_ASSERT(c+keepto <= precnt);
- FLEXT_ASSERT(c+keepix <= cnt);
- CopyAtoms(c,predata+keepto,lst+keepix);
- }
-
- // free allocated memory
- AtomList::Free();
- }
- lst = predata,cnt = sz;
- }
- else
- AtomList::Alloc(sz,keepix,keeplen,keepto);
-}
-
-void flext::AtomListStaticBase::Free()
-{
- if(lst != predata) AtomList::Free();
- else lst = NULL,cnt = 0;
-}
diff --git a/externals/grill/flext/source/flatom_part.cpp b/externals/grill/flext/source/flatom_part.cpp
deleted file mode 100644
index b6d4661c..00000000
--- a/externals/grill/flext/source/flatom_part.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file flatom_part.cpp
- \brief Definitions for handling the t_atom type and lists thereof.
-*/
-
-#include "flext.h"
-
-int flext::AtomList::Get(t_atom *argv,int mxsz) const
-{
- int argc = Count();
- if(mxsz >= 0 && argc > mxsz) argc = mxsz;
-
- for(int i = 0; i < argc; ++i) SetAtom(argv[i],lst[i]);
-
- return argc;
-}
-
-
-void flext::AtomList::GetPart(int offs,int len,AtomList &ret) const
-{
- if(offs+len > Count()) {
- len = Count()-offs;
- if(len < 0) len = 0;
- }
-
- ret(len,Atoms()+offs);
-}
-
diff --git a/externals/grill/flext/source/flatom_pr.cpp b/externals/grill/flext/source/flatom_pr.cpp
deleted file mode 100644
index 9b9231ed..00000000
--- a/externals/grill/flext/source/flatom_pr.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2006 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file flatom_pr.cpp
- \brief Definitions for printing and scanning the t_atom type.
-*/
-
-#include "flext.h"
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-#ifdef _MSC_VER
-#define snprintf _snprintf
-#endif
-
-// \TODO take bufsz into account!
-bool flext::PrintAtom(const t_atom &a,char *buf,size_t bufsz)
-{
- bool ok = true;
- if(IsFloat(a)) {
- ok = STD::snprintf(buf,bufsz,"%g",GetFloat(a)) > 0;
- }
- else if(IsInt(a)) {
- ok = STD::snprintf(buf,bufsz,"%i",GetInt(a)) > 0;
- }
- else if(IsSymbol(a)) {
- const char *c = GetString(a);
- size_t len = strlen(c);
- if(len < bufsz) {
- memcpy(buf,c,len); buf[len] = 0;
- ok = true;
- }
- else
- ok = false;
- }
-#if FLEXT_SYS == FLEXT_SYS_PD
-#ifndef FLEXT_COMPATIBLE
- else if(IsPointer(a)) {
- ok = STD::snprintf(buf,bufsz,"%p",GetPointer(a)) > 0;
- }
-#endif
- else if(a.a_type == A_DOLLAR) {
- ok = STD::snprintf(buf,bufsz,"$%d",a.a_w.w_index) > 0;
- }
- else if(a.a_type == A_DOLLSYM) {
- ok = STD::snprintf(buf,bufsz,"$%s",GetString(a)) > 0;
- }
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- else if(a.a_type == A_DOLLAR) {
- ok = STD::snprintf(buf,bufsz,"$%d",a.a_w.w_long) > 0;
- }
-#else
-//#pragma message("Not implemented")
-#endif
- else {
- error("flext: atom type unknown");
- ok = false;
- }
- return ok;
-}
-
-bool flext::PrintList(int argc,const t_atom *argv,char *buf,size_t bufsz)
-{
- bool ok = true;
- for(int i = 0; ok && i < argc && bufsz > 0; ++i) {
- if(i) { *(buf++) = ' '; --bufsz; } // prepend space
-
- if(PrintAtom(argv[i],buf,bufsz)) {
- size_t len = strlen(buf);
- buf += len,bufsz -= len;
- }
- else
- ok = false;
- }
- *buf = 0;
- return ok;
-}
-
-
-const char *flext::ScanAtom(t_atom &a,const char *c)
-{
- // skip leading whitespace
- while(*c && isspace(*c)) ++c;
- if(!*c) return NULL;
-
- // go to next space and save character
- char *end = const_cast<char *>(c);
- while(*end && !isspace(*end)) ++end;
- char sv = *end;
-
- float fres;
- // first try float
- char *endp;
- // see if it's a float - thanks to Frank Barknecht
- fres = (float)strtod(c,&endp);
- if(!*c && endp != c) {
- int ires = (int)fres; // try a cast
- if(fres == ires)
- SetInt(a,ires);
- else
- SetFloat(a,fres);
- }
- // no, it's a symbol
- else
- SetString(a,c);
-
- *end = sv;
-
- return c;
-}
diff --git a/externals/grill/flext/source/flattr.cpp b/externals/grill/flext/source/flattr.cpp
deleted file mode 100644
index 2054f7d4..00000000
--- a/externals/grill/flext/source/flattr.cpp
+++ /dev/null
@@ -1,445 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file flattr.cpp
- \brief Attribute handling for the flext base class
-*/
-
-#include "flext.h"
-#include <string.h>
-#include <ctype.h>
-
-#include <set>
-
-
-#ifdef __MWERKS__
-#define STD std
-#else
-#define STD
-#endif
-
-flext_base::AttrItem::AttrItem(const t_symbol *t,metharg tp,methfun f,int fl):
- Item(NULL),index(0),
- flags(fl|afl_shown),
- argtp(tp),fun(f),
- counter(NULL),tag(t)
-{}
-
-
-/*
-flext_base::AttrDataCont::AttrDataCont() {}
-
-flext_base::AttrDataCont::~AttrDataCont()
-{
- for(iterator it = begin(); it != end(); ++it)
- if(it.data()) delete it.data();
-}
-*/
-
-flext_base::AttrDataCont::~AttrDataCont() { clear(); }
-
-void flext_base::AttrDataCont::clear()
-{
- for(iterator it(*this); it; ++it) delete it.data();
- TablePtrMap<const t_symbol *,AttrData *,8>::clear();
-}
-
-//! Add get and set attributes
-void flext_base::AddAttrib(ItemCont *aa,ItemCont *ma,const t_symbol *asym,metharg tp,methfun gfun,methfun sfun)
-{
- AttrItem *a,*b;
-
- FLEXT_ASSERT(asym != sym__ && asym != sym_list && asym != sym_float && asym != sym_symbol && asym != sym_anything);
-
- if(sfun) // if commented out, there will be a warning at run-time (more user-friendly)
- {
- a = new AttrItem(asym,tp,sfun,AttrItem::afl_set);
- a->index = aa->Members();
- aa->Add(a,asym);
-
- // bind attribute to a method
- MethItem *mi = new MethItem(a);
- mi->SetArgs(sfun,1,new metharg(tp));
- ma->Add(mi,asym);
- }
- else
- a = NULL;
-
- if(gfun) // if commented out, there will be a warning at run-time (more user-friendly)
- {
- b = new AttrItem(asym,tp,gfun,AttrItem::afl_get);
- b->index = aa->Members();
- aa->Add(b,asym);
-
- static char tmp[256] = "get";
- strcpy(tmp+3,GetString(asym));
-
- // bind attribute to a method
- MethItem *mi = new MethItem(b);
- mi->SetArgs(gfun,0,NULL);
- ma->Add(mi,MakeSymbol(tmp));
- }
- else
- b = NULL;
-
- if(a && b) {
- a->counter = b;
- b->counter = a;
- }
-}
-
-void flext_base::AddAttrib(const t_symbol *attr,metharg tp,methfun gfun,methfun sfun)
-{
- if(HasAttributes())
- AddAttrib(ThAttrs(),ThMeths(),attr,tp,gfun,sfun);
- else
- error("%s - attribute procession is not enabled!",thisName());
-}
-
-void flext_base::AddAttrib(t_classid c,const t_symbol *attr,metharg tp,methfun gfun,methfun sfun)
-{
- AddAttrib(ClAttrs(c),ClMeths(c),attr,tp,gfun,sfun);
-}
-
-void flext_base::ListAttrib(AtomList &la) const
-{
- typedef TablePtrMap<int,const t_symbol *,32> AttrList;
- AttrList list[2];
- ItemCont *clattrhead = ClAttrs(thisClassId());
-
- int i;
- for(i = 0; i <= 1; ++i) {
- ItemCont *a = i?attrhead:clattrhead;
- if(a && a->Contained(0)) {
- ItemSet &ai = a->GetInlet();
- for(ItemSet::iterator as(ai); as; ++as) {
- for(Item *al = as.data(); al; al = al->nxt) {
- AttrItem *aa = (AttrItem *)al;
- list[i].insert(aa->index,as.key());
- break;
- }
- }
- }
- }
-
- la((int)(list[0].size()+list[1].size()));
- int ix = 0;
- for(i = 0; i <= 1; ++i)
- for(AttrList::iterator it(list[i]); it; ++it)
- SetSymbol(la[ix++],it.data());
-}
-
-int flext_base::CheckAttrib(int argc,const t_atom *argv)
-{
- int offs = 0;
- for(; offs < argc; ++offs)
- if(IsString(argv[offs]) && *GetString(argv[offs]) == '@') break;
- return offs;
-}
-
-bool flext_base::InitAttrib(int argc,const t_atom *argv)
-{
- int cur,nxt;
- for(cur = 0; cur < argc; cur = nxt) {
- // find next @symbol
- for(nxt = cur+1; nxt < argc; ++nxt)
- if(IsString(argv[nxt]) && *GetString(argv[nxt]) == '@') break;
-
- const t_symbol *tag = MakeSymbol(GetString(argv[cur])+1);
-
- // find puttable attribute
- AttrItem *attr = FindAttrib(tag,false,true);
- if(attr) {
- // make an entry (there are none beforehand...)
-/*
- AttrDataCont::iterator it = attrdata->find(tag);
- if(it == attrdata->end()) {
- AttrDataCont::pair pair;
- pair.key() = tag;
- pair.data() = new AttrData;
- it = attrdata->insert(attrdata->begin(),pair);
- }
-
- AttrData &a = *it.data();
- a.SetInit(true);
- a.SetInitValue(nxt-cur-1,argv+cur+1);
-
- // pass value to object
- SetAttrib(tag,attr,a.GetInitValue());
-*/
- AttrData *a = attrdata->find(tag);
- if(!a) {
- AttrData *old = attrdata->insert(tag,a = new AttrData);
- FLEXT_ASSERT(!old);
- }
-
- a->SetInit(true);
- a->SetInitValue(nxt-cur-1,argv+cur+1);
-
- // pass value to object
- SetAttrib(tag,attr,a->GetInitValue());
- }
- }
- return true;
-}
-
-bool flext_base::ListAttrib() const
-{
- if(HasAttributes()) {
- // defined in flsupport.cpp
- AtomListStatic<32> la;
- ListAttrib(la);
- ToOutAnything(GetOutAttr(),sym_attributes,la.Count(),la.Atoms());
- return true;
- }
- else
- return false;
-}
-
-flext_base::AttrItem *flext_base::FindAttrib(const t_symbol *tag,bool get,bool msg) const
-{
- ItemCont *clattrhead = ClAttrs(thisClassId());
-
- // first search within object scope
- AttrItem *a = NULL;
- {
- for(Item *lst = attrhead->FindList(tag); lst; lst = lst->nxt) {
- AttrItem *b = (AttrItem *)lst;
- if(get?b->IsGet():b->IsSet()) { a = b; break; }
- }
- }
-
- // then (if nothing found) search within class scope
- if(!a) {
- for(Item *lst = clattrhead->FindList(tag); lst; lst = lst->nxt) {
- AttrItem *b = (AttrItem *)lst;
- if(get?b->IsGet():b->IsSet()) { a = b; break; }
- }
- }
-
- if(!a && msg) {
- // print a message
- error("%s - %s: attribute not found",thisName(),GetString(tag));
- }
- return a;
-}
-
-bool flext_base::SetAttrib(const t_symbol *tag,int argc,const t_atom *argv)
-{
- // search for matching attribute
- AttrItem *a = FindAttrib(tag,false,true);
- return a && SetAttrib(tag,a,argc,argv);
-}
-
-bool flext_base::SetAttrib(const t_symbol *tag,AttrItem *a,int argc,const t_atom *argv)
-{
- if(a->fun) {
- bool ok = true;
-
- t_any any;
- switch(a->argtp) {
- case a_float:
- if(argc == 1 && CanbeFloat(argv[0])) {
- any.ft = GetAFloat(argv[0]);
- ((methfun_1)a->fun)(this,any);
- }
- else ok = false;
- break;
- case a_int:
- if(argc == 1 && CanbeInt(argv[0])) {
- any.it = GetAInt(argv[0]);
- ((methfun_1)a->fun)(this,any);
- }
- else ok = false;
- break;
- case a_symbol:
- if(argc == 1 && IsSymbol(argv[0])) {
- t_atom at;
- GetParamSym(at,GetSymbol(argv[0]),thisCanvas());
- any.st = const_cast<t_symbol *>(GetSymbol(at));
- ((methfun_1)a->fun)(this,any);
- }
- else ok = false;
- break;
- case a_bool:
- if(argc == 1 && CanbeBool(argv[0])) {
- any.bt = GetABool(argv[0]);
- ((methfun_1)a->fun)(this,any);
- }
- else ok = false;
- break;
- case a_LIST: {
- AtomListStatic<16> la(argc);
- for(int i = 0; i < argc; ++i)
- if(IsSymbol(argv[i]))
- GetParamSym(la[i],GetSymbol(argv[i]),thisCanvas());
- else
- la[i] = argv[i];
-
- any.vt = &la;
- ((methfun_1)a->fun)(this,any);
- break;
- }
- default:
- ERRINTERNAL();
- }
-
- if(!ok)
- post("%s - wrong arguments for attribute %s",thisName(),GetString(tag));
- }
- else
- post("%s - attribute %s has no get method",thisName(),GetString(tag));
- return true;
-}
-
-
-bool flext_base::GetAttrib(const t_symbol *tag,AttrItem *a,AtomList &la) const
-{
- bool ok = true;
- // main attribute tag
- if(a) {
- if(a->fun) {
- t_any any;
- switch(a->argtp) {
- case a_float: {
- ((methfun_1)a->fun)(const_cast<flext_base *>(this),any);
- la(1);
- SetFloat(la[0],any.ft);
- break;
- }
- case a_int: {
- ((methfun_1)a->fun)(const_cast<flext_base *>(this),any);
- la(1);
- SetInt(la[0],any.it);
- break;
- }
- case a_bool: {
- ((methfun_1)a->fun)(const_cast<flext_base *>(this),any);
- la(1);
- SetBool(la[0],any.bt);
- break;
- }
- case a_symbol: {
- ((methfun_1)a->fun)(const_cast<flext_base *>(this),any);
- la(1);
- SetSymbol(la[0],any.st);
- break;
- }
- case a_LIST: {
- any.vt = &la;
- ((methfun_1)a->fun)(const_cast<flext_base *>(this),any);
- break;
- }
- default:
- ERRINTERNAL();
- ok = false;
- }
- }
- else {
- post("%s - attribute %s has no get method",thisName(),GetString(tag));
- ok = false;
- }
- }
- else {
- error("%s - %s: attribute not found",thisName(),GetString(tag));
- ok = false;
- }
- return ok;
-}
-
-bool flext_base::GetAttrib(const t_symbol *s,AtomList &a) const
-{
- AttrItem *attr = FindAttrib(s,true);
- return attr && GetAttrib(s,attr,a);
-}
-
-//! \param tag symbol "get[attribute]"
-bool flext_base::DumpAttrib(const t_symbol *tag,AttrItem *a) const
-{
- AtomListStatic<16> la;
- bool ret = GetAttrib(tag,a,la);
- if(ret) {
- ToOutAnything(GetOutAttr(),a->tag,la.Count(),la.Atoms());
- }
- return ret;
-}
-
-bool flext_base::DumpAttrib(const t_symbol *attr) const
-{
- AttrItem *item = FindAttrib(attr,true);
- return item && DumpAttrib(attr,item);
-}
-
-bool flext_base::BangAttrib(const t_symbol *attr,AttrItem *item)
-{
- AtomListStatic<16> val;
- AttrItem *item2;
- if(!item->IsGet())
- item = item->Counterpart();
- if(item) {
- item2 = item->Counterpart();
- return item2 && GetAttrib(attr,item,val) && SetAttrib(attr,item2,val);
- }
- else
- return false;
-}
-
-bool flext_base::BangAttrib(const t_symbol *attr)
-{
- AttrItem *item = FindAttrib(attr,true);
- return item && BangAttrib(attr,item);
-}
-
-bool flext_base::BangAttribAll()
-{
- ItemCont *clattrhead = ClAttrs(thisClassId());
-
- for(int i = 0; i <= 1; ++i) {
- ItemCont *a = i?attrhead:clattrhead;
- if(a) {
- ItemSet &ai = a->GetInlet(); // \todo need to check for presence of inlet 0?
-/*
- for(ItemSet::iterator as = ai.begin(); as != ai.end(); ++as) {
- for(Item *al = as.data(); al; al = al->nxt) {
- AttrItem *a = (AttrItem *)al;
- if(a->IsGet() && a->BothExist()) BangAttrib(as.key(),a);
- }
- }
-*/
- for(ItemSet::iterator as(ai); as; ++as) {
- for(Item *al = as.data(); al; al = al->nxt) {
- AttrItem *a = (AttrItem *)al;
- if(a->IsGet() && a->BothExist()) BangAttrib(as.key(),a);
- }
- }
- }
- }
- return true;
-}
-
-bool flext_base::ShowAttrib(AttrItem *a,bool show) const
-{
- if(show) a->flags |= AttrItem::afl_shown;
- else a->flags &= ~AttrItem::afl_shown;
-
- // also change counterpart, if present
- AttrItem *ca = a->Counterpart();
- if(ca) {
- if(show) ca->flags |= AttrItem::afl_shown;
- else ca->flags &= ~AttrItem::afl_shown;
- }
- return true;
-}
-
-bool flext_base::ShowAttrib(const t_symbol *attr,bool show) const
-{
- AttrItem *item = FindAttrib(attr,true);
- return item && ShowAttrib(item,show);
-}
diff --git a/externals/grill/flext/source/flattr_ed.cpp b/externals/grill/flext/source/flattr_ed.cpp
deleted file mode 100644
index 115dad13..00000000
--- a/externals/grill/flext/source/flattr_ed.cpp
+++ /dev/null
@@ -1,872 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file flattr_ed.cpp
- \brief Attribute editor (property dialog) for PD
-*/
-
-#include "flext.h"
-
-#if FLEXT_SYS == FLEXT_SYS_PD
-
-#ifdef _MSC_VER
-#pragma warning( disable : 4091 )
-#endif
-
-
-#if defined(FLEXT_ATTRHIDE) || PD_MINOR_VERSION < 37
-#define __FLEXT_WIDGETBEHAVIOR
-#endif
-
-//////////////////////////////////////////////////////
-#ifdef __FLEXT_WIDGETBEHAVIOR
-// we need non-public headers!
-#pragma message("Attention: non-public headers used - binary is bound to a specific version")
-
-#include <g_canvas.h>
-
-/*
-#ifdef PD_DEVEL_VERSION
-#define __FLEXT_CLONEWIDGET
-#endif
-*/
-
-#ifndef __FLEXT_CLONEWIDGET
-#include <m_imp.h>
-#endif
-
-#endif
-//////////////////////////////////////////////////////
-
-
-#include <string.h>
-#include <stdio.h>
-
-
-#ifdef FLEXT_ATTRHIDE
-#ifndef __FLEXT_CLONEWIDGET
-static t_visfn ori_vis = NULL;
-static t_selectfn ori_select = NULL;
-#endif
-#endif
-
-
-#ifdef FLEXT_ATTRHIDE
-#define ST_DISABLED ""
-#else
-#define ST_DISABLED " -state disabled"
-#endif
-
-
-#ifndef FLEXT_NOATTREDIT
-
-//! generate the script for the property dialog
-static void tclscript()
-{
- static bool havecode = false;
- if(havecode) return;
- else havecode = true;
-
- sys_vgui(
- "proc flext_escatoms {lst} {\n"
- "set tmp {}\n"
- "foreach a $lst {\n"
-// "set a [regsub {\\\\} $a \\\\\\\\]\n" // replace \ with \\ ... must be first
- "set a [regsub {\\$} $a \\\\$]\n" // replace $ with \$
-// "set a [regsub {\\{} $a \\\\\\{]\n" // replace { with \{
-// "set a [regsub {\\}} $a \\\\\\}]\n" // replace } with \}
-// "set a [regsub {\\ } $a \\\\\\ ]\n" // replace space with \space
- "set a [regsub {,} $a \\\\,]\n" // replace , with \,
- "set a [regsub {;} $a \\\\\\;]\n" // replace ; with \;
- "lappend tmp $a\n"
- "}\n"
- "return $tmp\n"
- "}\n"
- );
- sys_vgui(
- "proc flext_makevalue {id ix} {\n"
- // strip "." from the TK id to make a variable name suffix
- "set vid [string trimleft $id .]\n"
-
- "set var_attr_name [concat [concat var_name_$ix]_$vid ]\n"
- "set var_attr_init [concat [concat var_init_$ix]_$vid ]\n"
- "set var_attr_val [concat [concat var_val_$ix]_$vid ]\n"
- "set var_attr_save [concat [concat var_save_$ix]_$vid ]\n"
- "set var_attr_type [concat [concat var_type_$ix]_$vid ]\n"
-
- "global $var_attr_name $var_attr_init $var_attr_val $var_attr_save $var_attr_type\n"
-
- "set lst {}\n"
-
- "if { [expr $$var_attr_type] != 0 } {\n"
- // attribute is puttable
-
- "lappend lst [eval concat $$var_attr_name]\n"
-
- // process current value
- "set tmp [flext_escatoms [eval concat $$var_attr_val]]\n"
- "set lst [concat $lst [llength $tmp] $tmp]\n"
-
- // process init value
- "set tmp [flext_escatoms [eval concat $$var_attr_init]]\n"
- "set lst [concat $lst [llength $tmp] $tmp]\n"
-
- "lappend lst [eval concat $$var_attr_save]\n"
- "}\n"
-
- // return list
- "return $lst\n"
- "}\n"
- );
- sys_vgui(
- "proc flext_apply {id ix} {\n"
- "set lst [flext_makevalue $id $ix]\n"
- "set lst [eval concat $lst]\n" // remove curly braces from character escaping
- "pd [concat $id attributedialog $lst \\;]\n"
- "}\n"
-
- "proc flext_applyall {id alen} {\n"
- // make a list of the attribute values (including save flags)
-
- "set lst {}\n"
- "for {set ix 1} {$ix <= $alen} {incr ix} {\n"
- "set lst [concat $lst [flext_makevalue $id $ix]]\n"
- "}\n"
- "set lst [eval concat $lst]\n" // remove curly braces from character escaping
-
- "pd [concat $id attributedialog $lst \\;]\n"
- "}\n"
-
- "proc flext_cancel {id} {\n"
- "pd [concat $id cancel \\;]\n"
- "}\n"
-
- "proc flext_ok {id alen} {\n"
- "flext_applyall $id $alen\n"
- "flext_cancel $id\n"
- "}\n"
- );
- sys_vgui(
- "proc flext_help {id} {\n"
- "toplevel $id.hw\n"
- "wm title $id.hw \"Flext attribute editor help\"\n"
-
- "frame $id.hw.buttons\n"
- "pack $id.hw.buttons -side bottom -fill x -pady 2m\n"
-
- "text $id.hw.text -relief sunken -bd 2 -yscrollcommand \"$id.hw.scroll set\" -setgrid 1 -width 80 -height 10 -wrap word\n"
- "scrollbar $id.hw.scroll -command \"$id.hw.text yview\"\n"
- "pack $id.hw.scroll -side right -fill y\n"
- "pack $id.hw.text -expand yes -fill both\n"
-
- "button $id.hw.buttons.ok -text OK -command \"destroy $id.hw\"\n"
- "pack $id.hw.buttons.ok -side left -expand 1\n"
- "bind $id.hw {<KeyPress-Escape>} \"destroy $id.hw\"\n"
-
- "$id.hw.text tag configure big -font {Arial 10 bold}\n"
- "$id.hw.text configure -font {Arial 8 bold}\n"
- "$id.hw.text insert end \""
- "The flext attribute editor lets you query or change attribute values exposed by an external object. \" big \"\n\n"
- "Local variable names ($-values) will only be saved as such for init values. "
- "Alternatively, # can be used instead of $.\n"
- "Ctrl-Button on a text field will open an editor window where text can be entered more comfortably.\n"
- "\"\n"
- "$id.hw.text configure -state disabled\n"
- "}\n"
- );
- sys_vgui(
- "proc flext_copyval {dst src} {\n"
- "global $src $dst\n"
- "set $dst [expr $$src]\n"
- "}\n"
-
- "proc flext_textcopy {id idtxt var} {\n"
- "global $var\n"
- "set txt [eval $idtxt get 0.0 end]\n"
- // strip newline characters
- "set tmp {}\n"
- "foreach t $txt { lappend tmp [string trim $t] }\n"
- "set $var $tmp\n"
- "destroy $id\n"
- "}\n"
- );
- sys_vgui(
- "proc flext_textzoom {id var title attr edit} {\n"
- "global $var\n"
- "toplevel $id.w\n"
- "wm title $id.w [concat $title \" @\" $attr]\n"
-// "wm iconname $w \"text\"\n"
-// "positionWindow $id.w\n"
-
- "frame $id.w.buttons\n"
- "pack $id.w.buttons -side bottom -fill x -pady 2m\n"
-
- "text $id.w.text -relief sunken -bd 2 -yscrollcommand \"$id.w.scroll set\" -setgrid 1 -width 80 -height 20\n"
- "scrollbar $id.w.scroll -command \"$id.w.text yview\"\n"
- "pack $id.w.scroll -side right -fill y\n"
- "pack $id.w.text -expand yes -fill both\n"
-
- // insert text with newlines
- "set txt [split [expr $$var] ,]\n"
- "set lines [llength $txt]\n"
- "for {set ix 0} {$ix < ($lines-1)} {incr ix} {\n"
- "$id.w.text insert end [string trim [lindex $txt $ix] ]\n"
- "$id.w.text insert end \" ,\\n\"\n"
- "}\n"
- "$id.w.text insert end [string trim [lindex $txt end] ]\n"
-
- "$id.w.text mark set insert 0.0\n"
-
- "if { $edit != 0 } then {\n"
- "button $id.w.buttons.ok -text OK -command \"flext_textcopy $id.w $id.w.text $var\"\n"
- "pack $id.w.buttons.ok -side left -expand 1\n"
-// "bind $id.w {<Shift-KeyPress-Return>} \"flext_textcopy $id.w $id.w.text $var\"\n"
- "} "
- "else { $id.w.text configure -state disabled }\n"
-
- "button $id.w.buttons.cancel -text Cancel -command \"destroy $id.w\"\n"
- "pack $id.w.buttons.cancel -side left -expand 1\n"
- "bind $id.w {<KeyPress-Escape>} \"destroy $id.w\"\n"
- "}\n"
- );
- sys_vgui(
- "proc pdtk_flext_dialog {id title attrlist} {\n"
- "set vid [string trimleft $id .]\n"
- "set alen [expr [llength $attrlist] / 6 ]\n"
-
- "toplevel $id\n"
- "wm title $id $title\n"
- "wm protocol $id WM_DELETE_WINDOW [concat flext_cancel $id]\n"
-
- "frame $id.frame\n"
- "set row 0\n"
-
- // set grow parameters
- "grid columnconfigure $id.frame 0 -weight 1\n" // label
- "grid columnconfigure $id.frame {1 4} -weight 3\n" // value entry
- "grid columnconfigure $id.frame {2 3} -weight 0\n" // copy buttons
- "grid columnconfigure $id.frame 5 -weight 1\n" // apply button
- "grid columnconfigure $id.frame {6 7 8} -weight 0\n" // radio buttons
-
- "grid rowconfigure $id.frame {0 1} -weight 0\n"
-
- // set column labels
- "label $id.frame.label -text {attribute} -font {Helvetica 9 bold}\n"
- "label $id.frame.init -text {initial value} -font {Helvetica 9 bold}\n"
- "label $id.frame.copy -text {copy} -font {Helvetica 9 bold}\n"
- "label $id.frame.val -text {current value} -font {Helvetica 9 bold}\n"
- "label $id.frame.apply -text {} -font {Helvetica 9 bold}\n" // why must this be empty?
- "foreach {i txt} {0 {don't\rsave} 1 {do\rinit} 2 {always\rsave} } {\n"
- "label $id.frame.b$i -text $txt -font {Helvetica 7 bold}\n"
- "}\n"
-
- "grid config $id.frame.label -column 0 -row $row \n"
- "grid config $id.frame.init -column 1 -row $row \n"
- "grid config $id.frame.copy -column 2 -columnspan 2 -row $row \n"
- "grid config $id.frame.val -column 4 -row $row \n"
- "grid config $id.frame.apply -column 5 -row $row \n"
- "foreach i {0 1 2} { grid config $id.frame.b$i -column [expr $i + 6] -row $row }\n"
- "incr row\n"
-
- // Separator
- "frame $id.frame.sep -relief ridge -bd 1 -height 2\n"
- "grid config $id.frame.sep -column 0 -columnspan 9 -row $row -pady 2 -sticky {snew}\n"
- "incr row\n"
- );
- sys_vgui(
- "set ix 1\n"
- "foreach {an av ai atp asv afl} $attrlist {\n"
- "grid rowconfigure $id.frame $row -weight 1\n"
-
- // get attribute name
- "set var_attr_name [concat [concat var_name_$ix]_$vid ]\n"
- "global $var_attr_name\n"
- "set $var_attr_name $an\n"
-
- // get attribute init value (list)
- "set var_attr_init [concat [concat var_init_$ix]_$vid ]\n"
- "global $var_attr_init\n"
- "set $var_attr_init $ai\n"
-
- // get attribute value (list)
- "set var_attr_val [concat [concat var_val_$ix]_$vid ]\n"
- "global $var_attr_val\n"
- "set $var_attr_val $av\n"
-
- // get save flag
- "set var_attr_save [concat [concat var_save_$ix]_$vid ]\n"
- "global $var_attr_save\n"
- "set $var_attr_save $asv\n"
-
- // get type flag
- "set var_attr_type [concat [concat var_type_$ix]_$vid ]\n"
- "global $var_attr_type\n"
- "set $var_attr_type $afl\n"
-
- // add dialog elements to window
-
- // attribute label
- "label $id.frame.label-$ix -text \"$an :\" -font {Helvetica 8 bold}\n"
- "grid config $id.frame.label-$ix -column 0 -row $row -padx 5 -sticky {e}\n"
- );
- sys_vgui(
- "if { $afl != 0 } {\n"
- // attribute is puttable
-
- // entry field for initial value
- // entry field for current value
-
- // choose entry field type
- "switch $atp {\n"
- "0 - 1 {\n" // int or float
- "entry $id.frame.init-$ix -textvariable $var_attr_init" ST_DISABLED "\n"
- "entry $id.frame.val-$ix -textvariable $var_attr_val\n"
- "}\n"
- "2 {\n" // boolean
- "checkbutton $id.frame.init-$ix -variable $var_attr_init" ST_DISABLED "\n"
- "checkbutton $id.frame.val-$ix -variable $var_attr_val\n"
- "}\n"
- "3 {\n" // symbol
- "entry $id.frame.init-$ix -textvariable $var_attr_init" ST_DISABLED "\n"
- "entry $id.frame.val-$ix -textvariable $var_attr_val\n"
- "}\n"
- "4 - 5 {\n" // list or unknown
- "entry $id.frame.init-$ix -textvariable $var_attr_init" ST_DISABLED "\n"
- "bind $id.frame.init-$ix {<Control-Button-1>} \" flext_textzoom $id.frame.init-$ix $var_attr_init { $title } $an 1\"\n"
- "entry $id.frame.val-$ix -textvariable $var_attr_val\n"
- "bind $id.frame.val-$ix {<Control-Button-1>} \" flext_textzoom $id.frame.val-$ix $var_attr_val { $title } $an 1\"\n"
- "}\n"
- "}\n"
-
- "grid config $id.frame.init-$ix -column 1 -row $row -padx 5 -sticky {ew}\n"
- "grid config $id.frame.val-$ix -column 4 -row $row -padx 5 -sticky {ew}\n"
-
- // copy buttons
- "button $id.frame.b2i-$ix -text {<-} -height 1 -command \" flext_copyval $var_attr_init $var_attr_val \"" ST_DISABLED "\n"
- "grid config $id.frame.b2i-$ix -column 2 -row $row -sticky {ew}\n"
- "button $id.frame.b2c-$ix -text {->} -height 1 -command \" flext_copyval $var_attr_val $var_attr_init \"\n"
- "grid config $id.frame.b2c-$ix -column 3 -row $row -sticky {ew}\n"
-
- // apply button
- "button $id.frame.apply-$ix -text {Apply} -height 1 -command \" flext_apply $id $ix \"\n"
- "grid config $id.frame.apply-$ix -column 5 -row $row -sticky {ew}\n"
-
- // radiobuttons
- "foreach {i c} {0 black 1 blue 2 red} {\n"
- "radiobutton $id.frame.b$i-$ix -value $i -foreground $c -variable $var_attr_save" ST_DISABLED "\n"
- "grid config $id.frame.b$i-$ix -column [expr $i + 6] -row $row\n"
- "}\n"
- );
- sys_vgui(
- "} else {\n"
- // attribute is gettable only
-
- // entry field for current value (read-only)
-
- // choose display field type
- "switch $atp {\n"
- "0 - 1 {\n" // int or float
- "entry $id.frame.val-$ix -textvariable $var_attr_val -state disabled\n"
- "}\n"
- "2 {\n" // boolean
- "checkbutton $id.frame.val-$ix -variable $var_attr_val -state disabled\n"
- "}\n"
- "3 {\n" // symbol
- "entry $id.frame.val-$ix -textvariable $var_attr_val -state disabled\n"
- "}\n"
- "4 - 5 {\n" // list or unknown
- "entry $id.frame.val-$ix -textvariable $var_attr_val -state disabled\n"
- "bind $id.frame.val-$ix {<Control-Button-1>} \" flext_textzoom $id.frame.val-$ix $var_attr_val { $title } $an 0\"\n"
- "}\n"
- "}\n"
-
-// "entry $id.fval.val-$ix -textvariable $var_attr_val -state disabled\n"
- "grid config $id.frame.val-$ix -column 4 -row $row -padx 5 -sticky {ew}\n"
-
- "label $id.frame.readonly-$ix -text \"read-only\"\n"
- "grid config $id.frame.readonly-$ix -column 6 -columnspan 3 -row $row -padx 5 -sticky {ew}\n"
- "}\n"
-
- // increase counter
- "incr ix\n"
- "incr row\n"
- "}\n"
-
- // empty space
- "grid rowconfigure $id.frame $row -weight 1\n"
- "frame $id.frame.dummy\n"
- "grid config $id.frame.dummy -column 0 -columnspan 9 -row $row\n"
- "incr row\n"
- );
- sys_vgui(
- // Separator
- "frame $id.sep2 -relief ridge -bd 1 -height 2\n"
-
- // Buttons
- "frame $id.buttonframe\n"
-
- "button $id.buttonframe.cancel -text {Leave} -width 20 -command \" flext_cancel $id \"\n"
- "button $id.buttonframe.apply -text {Apply all} -width 20 -command \" flext_applyall $id $alen \"\n"
- "button $id.buttonframe.ok -text {Apply & Leave} -width 20 -command \" flext_ok $id $alen \"\n"
- "button $id.buttonframe.help -text {Help} -width 10 -command \" flext_help $id \"\n"
-
- "grid columnconfigure $id.buttonframe {0 1 2 3} -weight 1\n"
- "grid config $id.buttonframe.cancel $id.buttonframe.apply $id.buttonframe.ok $id.buttonframe.help -padx 2 -sticky {snew}\n"
-
-// "scrollbar $id.scroll -command \"$id.frame yview\"\n"
-
- "pack $id.buttonframe $id.sep2 -pady 2 -expand 0 -side bottom -fill x\n"
-// "pack $id.scroll -side right -fill y\n"
- "pack $id.frame -expand 1 -side top -fill both\n"
-
- // Key bindings
- "bind $id {<KeyPress-Escape>} \" flext_cancel $id \"\n"
- "bind $id {<KeyPress-Return>} \" flext_ok $id $alen \"\n"
- "bind $id {<Shift-KeyPress-Return>} \" flext_applyall $id $alen \"\n"
- "}\n"
- );
-}
-
-#endif
-
-
-#ifdef __FLEXT_WIDGETBEHAVIOR
-static t_widgetbehavior widgetbehavior;
-#endif
-
-void flext_base::SetGfx(t_classid c)
-{
- t_class *cl = getClass(c);
- // widgetbehavior struct MUST be resident... (static is just ok here)
-
-#ifdef __FLEXT_WIDGETBEHAVIOR
-#ifndef __FLEXT_CLONEWIDGET
- widgetbehavior.w_visfn = cl->c_wb->w_visfn;
- widgetbehavior.w_selectfn = cl->c_wb->w_selectfn;
- widgetbehavior.w_getrectfn = cl->c_wb->w_getrectfn;
- widgetbehavior.w_displacefn = cl->c_wb->w_displacefn;
- widgetbehavior.w_activatefn = cl->c_wb->w_activatefn;
- widgetbehavior.w_deletefn = cl->c_wb->w_deletefn;
- widgetbehavior.w_selectfn = cl->c_wb->w_selectfn;
- widgetbehavior.w_clickfn = cl->c_wb->w_clickfn;
-#else
- widgetbehavior.w_visfn = text_widgetbehavior.w_visfn;
- widgetbehavior.w_selectfn = text_widgetbehavior.w_selectfn;
- widgetbehavior.w_getrectfn = text_widgetbehavior.w_getrectfn;
- widgetbehavior.w_displacefn = text_widgetbehavior.w_displacefn;
- widgetbehavior.w_activatefn = text_widgetbehavior.w_activatefn;
- widgetbehavior.w_deletefn = text_widgetbehavior.w_deletefn;
- widgetbehavior.w_selectfn = text_widgetbehavior.w_selectfn;
- widgetbehavior.w_clickfn = text_widgetbehavior.w_clickfn;
-#endif
-#endif
-
-#ifdef FLEXT_ATTRHIDE
-
-#ifndef __FLEXT_CLONEWIDGET
- ori_vis = widgetbehavior.w_visfn;
- ori_select = widgetbehavior.w_selectfn;
-#endif
- widgetbehavior.w_visfn = (t_visfn)cb_GfxVis;
- widgetbehavior.w_selectfn = (t_selectfn)cb_GfxSelect;
-
-#if PD_MINOR_VERSION >= 37
- class_setsavefn(cl,(t_savefn)cb_GfxSave);
-#else
- widgetbehavior.w_savefn = (t_savefn)cb_GfxSave;
-#endif
-
-#endif // FLEXT_ATTRHIDE
-
-
-#ifndef FLEXT_NOATTREDIT
-
-#if PD_MINOR_VERSION >= 37
- class_setpropertiesfn(cl,(t_propertiesfn)cb_GfxProperties);
-#else
- widgetbehavior.w_propertiesfn = (t_propertiesfn)cb_GfxProperties;
-#endif
-
- tclscript();
-#endif // FLEXT_NOATTREDIT
-
-#ifdef __FLEXT_WIDGETBEHAVIOR
- class_setwidget(cl, &widgetbehavior);
-#endif
-}
-
-
-#ifndef FLEXT_NOATTREDIT
-
-static size_t escapeit(char *dst,size_t maxlen,const char *src)
-{
- char *d;
- for(d = dst; *src && (d-dst) < (int)maxlen; ++src) {
- if(*src == '%')
- *(d++) = '%',*(d++) = '%';
- else
- *(d++) = *src;
- }
- *d = 0;
- return d-dst;
-}
-
-void flext_base::cb_GfxProperties(flext_hdr *c, t_glist *)
-{
- flext_base *th = thisObject(c);
- char buf[1000];
-
- // beginning of proc
- sys_vgui("proc pdtk_flext_dialog_%p {title} {\n",th);
-
- sys_vgui("pdtk_flext_dialog $title {\n");
-
- // add title
- t_text *x = (t_text *)c;
- FLEXT_ASSERT(x->te_binbuf);
-
- int argc = binbuf_getnatom(x->te_binbuf);
- t_atom *argv = binbuf_getvec(x->te_binbuf);
-
- PrintList(argc,argv,buf,sizeof(buf));
- sys_vgui("%s } {\n",buf);
-
- AtomListStatic<32> la;
- th->ListAttrib(la);
- int cnt = la.Count();
-
- for(int i = 0; i < cnt; ++i) {
- const t_symbol *sym = GetSymbol(la[i]);
-
- // get attribute
- AttrItem *gattr = th->FindAttrib(sym,true);
- // get puttable attribute
- AttrItem *pattr = gattr?gattr->Counterpart():th->FindAttrib(sym,false);
-
- // get flags
- int sv;
- const AtomList *initdata;
- const AttrData *a = th->attrdata->find(sym);
-// AttrDataCont::iterator it = th->attrdata->find(sym);
-// if(it == th->attrdata->end())
- if(!a)
- sv = 0,initdata = NULL;
- else {
-// const AttrData &a = *it.data();
- if(a->IsSaved())
- sv = 2;
- else if(a->IsInit())
- sv = 1;
- else
- sv = 0;
- initdata = a->IsInitValue()?&a->GetInitValue():NULL;
- }
-
- // get attribute type
- int tp;
- bool list;
- switch((gattr?gattr:pattr)->argtp) {
- case a_int: tp = 0; list = false; break;
- case a_float: tp = 1; list = false; break;
- case a_bool: tp = 2; list = false; break;
- case a_symbol: tp = 3; list = true; break;
- case a_list:
- case a_LIST: tp = 4; list = true; break;
- default:
- tp = 5; list = true;
- FLEXT_ASSERT(false);
- }
-
- sys_vgui(const_cast<char *>(list?"%s {":"%s "),GetString(sym));
-
- AtomListStatic<32> lv;
- if(gattr) { // gettable attribute is present
- // Retrieve attribute value
- th->GetAttrib(sym,gattr,lv);
-
- char *b = buf; *b = 0;
- for(int i = 0; i < lv.Count(); ++i) {
- char tmp[100];
- PrintAtom(lv[i],tmp,sizeof tmp);
- b += escapeit(b,sizeof(buf)+buf-b,tmp);
- if(i < lv.Count()-1) { *(b++) = ' '; *b = 0; }
- }
- sys_vgui("%s",buf);
- }
- else
- sys_vgui("{}");
-
- sys_vgui(const_cast<char *>(list?"} {":" "));
-
- if(pattr) {
- // if there is initialization data take this, otherwise take the current data
- const AtomList &lp = initdata?*initdata:static_cast<const AtomList &>(lv);
-
- char *b = buf; *b = 0;
- for(int i = 0; i < lp.Count(); ++i) {
- char tmp[256];
- PrintAtom(lp[i],tmp,sizeof(tmp));
- b += escapeit(b,sizeof(buf)+buf-b,tmp);
- if(i < lp.Count()-1) { *(b++) = ' '; *b = 0; }
- }
- sys_vgui("%s",buf);
- }
- else
- sys_vgui("{}");
-
-
- sys_vgui(const_cast<char *>(list?"} %i %i %i \n":" %i %i %i \n"),tp,sv,pattr?(pattr->BothExist()?2:1):0);
- }
-
- sys_vgui(" } }\n"); // end of proc
-
- STD::sprintf(buf,"pdtk_flext_dialog_%p %%s\n",th);
- gfxstub_new((t_pd *)th->thisHdr(), th->thisHdr(),buf);
-
- //! \todo delete proc in TCL space
-}
-
-bool flext_base::cb_AttrDialog(flext_base *th,int argc,const t_atom *argv)
-{
- for(int i = 0; i < argc; ) {
- FLEXT_ASSERT(IsSymbol(argv[i]));
-
- // get name
- const t_symbol *aname = GetSymbol(argv[i]);
- i++;
-
- // get current value
- FLEXT_ASSERT(CanbeInt(argv[i]));
- int ccnt,coffs;
- ccnt = GetAInt(argv[i]);
- coffs = ++i;
- i += ccnt;
-
- // get init value
- FLEXT_ASSERT(CanbeInt(argv[i]));
- int icnt,ioffs;
- icnt = GetAInt(argv[i]);
- ioffs = ++i;
- i += icnt;
-
- FLEXT_ASSERT(i < argc);
- int sv = GetAInt(argv[i]);
- ++i;
-
- // find puttable attribute
- AttrItem *attr = th->FindAttrib(aname,false);
- if(attr) {
- bool ret = th->SetAttrib(aname,attr,ccnt,argv+coffs);
- FLEXT_ASSERT(ret);
-
- AttrData *a = th->attrdata->find(aname);
- if(sv >= 1) {
- // if data not present create it
- if(!a) {
- AttrData *old = th->attrdata->insert(aname,a = new AttrData);
- FLEXT_ASSERT(!old);
- }
-
- a->SetSave(sv == 2);
- a->SetInit(true);
- a->SetInitValue(icnt,argv+ioffs);
- }
- else {
- if(a) {
- // if data is present reset flags
- a->SetSave(false);
- a->SetInit(false);
-
- // let init data as is
- }
- }
- }
- else {
- post("%s - Attribute %s can't be set",th->thisName(),GetString(aname));
- }
- }
- return true;
-}
-
-#endif // FLEXT_NOATTREDIT
-
-
-#ifdef FLEXT_ATTRHIDE
-
-static void BinbufAdd(t_binbuf *b,const t_atom &at,bool transdoll)
-{
- if(transdoll && at.a_type == A_DOLLAR) {
- char tbuf[MAXPDSTRING];
- sprintf(tbuf, "$%d", at.a_w.w_index);
- binbuf_addv(b,"s",flext::MakeSymbol(tbuf));
- }
- else if(transdoll && at.a_type == A_DOLLSYM) {
- char tbuf[MAXPDSTRING];
- sprintf(tbuf, "$%s", at.a_w.w_symbol->s_name);
- binbuf_addv(b,"s",flext::MakeSymbol(tbuf));
- }
- else
- binbuf_add(b,1,const_cast<t_atom *>(&at));
-}
-
-void flext_base::BinbufArgs(t_binbuf *b,t_binbuf *args,bool withname,bool transdoll)
-{
- int argc = binbuf_getnatom(args);
- t_atom *argv = binbuf_getvec(args);
- int i,cnt = CheckAttrib(argc,argv);
- // process the creation arguments
- for(i = withname?0:1; i < cnt; ++i) BinbufAdd(b,argv[i],transdoll);
-}
-
-void flext_base::BinbufAttr(t_binbuf *b,bool transdoll)
-{
- // process the attributes
- AtomListStatic<32> la,lv;
- ListAttrib(la);
- int i,cnt = la.Count();
-
- for(i = 0; i < cnt; ++i) {
- const t_symbol *sym = GetSymbol(la[i]);
- const AtomList *lref = NULL;
-
- AttrData *a = attrdata->find(sym);
- if(a) {
- if(a->IsInit() && a->IsInitValue()) {
- lref = &a->GetInitValue();
-
-#if 0 /////////////////////////////////////////////////////////////
- // check for $-parameters
- lv = lref->Count();
- for(int j = 0; j < lref->Count(); ++j) {
- const char *s = IsSymbol((*lref)[j])?GetString((*lref)[j]):NULL;
- if(s && s[0] == '$') { // TODO: More refined checking?
- // prepend a "\"
- char tmp[256]; *tmp = '\\';
- strcpy(tmp+1,s);
- SetString(lv[j],tmp);
- }
- else
- lv[i] = (*lref)[j];
- }
-
- lref = &lv;
-#endif /////////////////////////////////////////////////////////////
- }
-// else if(a.IsSaved()) {
- else if(a->IsSaved()) {
- AttrItem *attr = FindAttrib(sym,true);
-
- // attribute must be gettable (so that the data can be retrieved) and puttable (so that the data can be inited)
- if(attr && attr->BothExist()) {
- GetAttrib(sym,attr,lv);
- lref = &lv;
- }
- }
- }
-
- if(lref) {
- char attrname[256]; *attrname= '@';
- // store name
- strcpy(attrname+1,GetString(sym));
- binbuf_addv(b,"s",MakeSymbol(attrname));
-
- // store value
- for(int j = 0; j < lref->Count(); ++j) BinbufAdd(b,(*lref)[j],transdoll);
- }
- }
-}
-
-//! Strip the attributes off the object command line
-void flext_base::cb_GfxVis(flext_hdr *c, t_glist *gl, int vis)
-{
- if(!gl->gl_isgraph || gl->gl_havewindow) {
- // show object if it's not inside a GOP
-
- flext_base *th = thisObject(c);
- t_text *x = (t_text *)c;
- FLEXT_ASSERT(x->te_binbuf);
-
- t_binbuf *b = binbuf_new();
- th->BinbufArgs(b,x->te_binbuf,true,false);
-
- // delete old object box text
- binbuf_free(x->te_binbuf);
- // set new one
- x->te_binbuf = b;
-
- t_rtext *rt = glist_findrtext(gl,x);
- rtext_retext(rt);
-
- // now display the changed text with the normal drawing function
- #ifdef __FLEXT_CLONEWIDGET
- text_widgetbehavior.w_visfn((t_gobj *)c,gl,vis);
- #else
- ori_vis((t_gobj *)c,gl,vis);
- #endif
- }
- // else don't show
-}
-
-void flext_base::cb_GfxSelect(flext_hdr *c,t_glist *gl,int state)
-{
- t_text *x = (t_text *)c;
- flext_base *th = thisObject(c);
-
- if(!gl->gl_isgraph || gl->gl_havewindow) {
- if(state || !gl->gl_editor->e_textdirty) {
- // change text only on selection
- // OR if text has _not_ been changed
- // -> since object will not be recreated we have to get rid
- // of the attribute text
-
- FLEXT_ASSERT(x->te_binbuf);
-
- t_binbuf *b = binbuf_new();
- th->BinbufArgs(b,x->te_binbuf,true,false);
- if(state) th->BinbufAttr(b,false);
-
- // delete old object box text
- binbuf_free(x->te_binbuf);
- // set new one
- x->te_binbuf = b;
-
- t_rtext *rt = glist_findrtext(gl,x);
- rtext_retext(rt);
-
- // fix lines
- canvas_fixlinesfor(gl,x);
- }
-
- // call original function
- #ifdef __FLEXT_CLONEWIDGET
- text_widgetbehavior.w_selectfn((t_gobj *)c,gl,state);
- #else
- ori_select((t_gobj *)c,gl,state);
- #endif
- }
-}
-
-void flext_base::cb_GfxSave(flext_hdr *c, t_binbuf *b)
-{
- flext_base *th = thisObject(c);
- t_text *t = (t_text *)c;
- binbuf_addv(b, "ssiis", gensym("#X"),gensym("obj"), t->te_xpix, t->te_ypix,MakeSymbol(th->thisName()));
-
- // process the object arguments
- th->BinbufArgs(b,t->te_binbuf,false,true);
- // process the attributes
- th->BinbufAttr(b,true);
- // add end sign
- binbuf_addv(b, ";");
-}
-
-#endif // FLEXT_ATTRHIDE
-
-#endif // FLEXT_SYS_PD
diff --git a/externals/grill/flext/source/flbase.cpp b/externals/grill/flext/source/flbase.cpp
deleted file mode 100644
index 404588d9..00000000
--- a/externals/grill/flext/source/flbase.cpp
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file flbase.cpp
- \brief Implementation of the internal flext base classes.
-
- \remark This is all derived from GEM by Mark Danks
-*/
-
-#include "flext.h"
-#include "flinternal.h"
-#include <string.h>
-#include <ctype.h>
-#include <stdlib.h>
-
-#if FLEXT_SYS == FLEXT_SYS_PD
-#ifdef _MSC_VER
- #pragma warning (push)
- #pragma warning (disable:4091)
-#endif
-// for canvas_realizedollar (should be noon-critical)
-#include <g_canvas.h>
-#ifdef _MSC_VER
- #pragma warning (pop)
-#endif
-#endif
-
-
-/////////////////////////////////////////////////////////
-//
-// flext_obj
-//
-/////////////////////////////////////////////////////////
-
-flext_hdr *flext_obj::m_holder = NULL;
-const t_symbol *flext_obj::m_holdname = NULL;
-flext_class *flext_obj::m_holdclass = NULL;
-int flext_obj::m_holdaargc = 0;
-const t_atom *flext_obj::m_holdaargv = NULL;
-//bool flext_obj::process_attributes = false;
-
-bool flext_obj::initing = false;
-bool flext_obj::exiting = false;
-bool flext_obj::init_ok;
-
-//void flext_obj::ProcessAttributes(bool attr) { process_attributes = attr; }
-
-#if FLEXT_SYS == FLEXT_SYS_MAX
-static const t_symbol *sym__shP = NULL;
-#endif
-
-/////////////////////////////////////////////////////////
-// Constructor
-//
-/////////////////////////////////////////////////////////
-flext_obj :: FLEXT_CLASSDEF(flext_obj)()
- : x_obj(m_holder)
- , clss(m_holdclass)
- , m_name(m_holdname)
-{
-#if FLEXT_SYS == FLEXT_SYS_PD
- m_canvas = canvas_getcurrent();
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- m_canvas = (t_patcher *)sym__shP->s_thing;
- x_obj->curinlet = 0;
-#endif
-}
-
-/////////////////////////////////////////////////////////
-// Destructor
-//
-/////////////////////////////////////////////////////////
-flext_obj :: ~FLEXT_CLASSDEF(flext_obj)()
-{
- x_obj = NULL;
-}
-
-void flext_obj::__setup__(t_classid)
-{
-#if FLEXT_SYS == FLEXT_SYS_MAX
- sym__shP = MakeSymbol("#P");
-#endif
- flext::Setup();
-}
-
-bool flext_obj::Init() { return true; }
-bool flext_obj::Finalize() { return true; }
-void flext_obj::Exit() {}
-
-void flext_obj::DefineHelp(t_classid c,const char *ref,const char *dir,bool addtilde)
-{
-#if FLEXT_SYS == FLEXT_SYS_PD
- char tmp[256];
- if(dir && *dir) {
- strcpy(tmp,dir);
- char *last = tmp+strlen(tmp)-1;
- if(*last != '/') strcat(last,"/");
- strcat(last,ref);
- }
- else
- strcpy(tmp,ref);
- if(addtilde) strcat(tmp,"~");
-
- ::class_sethelpsymbol(getClass(c),gensym(const_cast<char *>(tmp)));
-#else
- // no solution for Max/MSP yet
-#endif
-}
-
-bool flext_obj::GetParamSym(t_atom &dst,const t_symbol *sym,t_canvas *c)
-{
-#if FLEXT_SYS == FLEXT_SYS_PD && defined(PD_MINOR_VERSION) && PD_MINOR_VERSION >= 37
- if(!c) c = canvas_getcurrent();
-
- const char *s = GetString(sym);
- if((s[0] == '$' || s[0] == '#') && isdigit(s[1])) {
- const t_symbol *res;
- // patcher parameter detected... get value!
- if(s[0] != '$') {
- char tmp[MAXPDSTRING];
- strcpy(tmp,s);
- tmp[0] = '$';
- res = canvas_realizedollar(c,const_cast<t_symbol *>(MakeSymbol(tmp)));
- }
- else
- res = canvas_realizedollar(c,const_cast<t_symbol *>(sym));
-
- // check for number
- const char *c = GetString(res);
- while(*c && (isdigit(*c) || *c == '.')) ++c;
-
- if(!*c)
- SetFloat(dst,(float)atof(GetString(res)));
- else
- SetSymbol(dst,res);
- return true;
- }
- else
-#else
- #pragma message("Not implemented")
-#endif
- SetSymbol(dst,sym);
- return true;
-}
-
-
-#if FLEXT_SYS == FLEXT_SYS_PD
-// this declaration is missing in m_pd.h (0.37-0 and -1)
-// but it is there in 0.37-2 (but how to tell which micro-version?)
-extern "C"
-#ifdef _MSC_VER
-__declspec(dllimport)
-#endif
-void canvas_getargs(int *argcp, t_atom **argvp);
-#endif
-
-
-void flext_obj::GetCanvasArgs(AtomList &args) const
-{
-#if FLEXT_SYS == FLEXT_SYS_PD
- int argc;
- t_atom *argv;
- canvas_getargs(&argc,&argv);
- args(argc,argv);
-#else
- #pragma message("Not implemented")
- args(0);
-#endif
-}
-
-
-#if FLEXT_SYS == FLEXT_SYS_MAX
-static short patcher_myvol(t_patcher *x)
-{
- t_box *w;
- if(x->p_vol)
- return x->p_vol;
- else if((w = (t_box *)x->p_vnewobj) != NULL)
- return patcher_myvol(w->b_patcher);
- else
- return 0;
-}
-#endif
-
-void flext_obj::GetCanvasDir(char *buf,size_t bufsz) const
-{
-#if FLEXT_SYS == FLEXT_SYS_PD
- const char *c = GetString(canvas_getdir(thisCanvas()));
- strncpy(buf,c,bufsz);
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- short path = patcher_myvol(thisCanvas());
- // \TODO dangerous!! no check for path length (got to be long enough... like 1024 chars)
- path_topathname(path,NULL,buf);
-#else
-#error Not implemented
-#endif
-}
diff --git a/externals/grill/flext/source/flbase.h b/externals/grill/flext/source/flbase.h
deleted file mode 100644
index 640a4688..00000000
--- a/externals/grill/flext/source/flbase.h
+++ /dev/null
@@ -1,575 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2006 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file flbase.h
- \brief Internal flext base classes
-
- \remark This uses some ideas of GEM invented by Mark Danks
-*/
-
-#ifndef __FLEXT_BASE_H
-#define __FLEXT_BASE_H
-
-#include "flstdc.h"
-#include "flsupport.h"
-
-
-class FLEXT_SHARE FLEXT_CLASSDEF(flext_obj);
-typedef class FLEXT_CLASSDEF(flext_obj) flext_obj;
-
-// ----------------------------------------------------------------------------
-/*! \brief The obligatory PD or Max/MSP object header
- \internal
-
- This is in a separate struct to assure that obj is the very first thing.
- If it were the first thing in flext_obj, then there could be problems with
- the virtual table of the C++ class.
-*/
-// ----------------------------------------------------------------------------
-
-struct FLEXT_SHARE flext_hdr
-{
- /*! \defgroup FLEXT_OBJHEADER Actual PD or Max/MSP object
- \internal
- @{
- */
-
- /*! \brief The obligatory object header
- \note MUST reside at memory offset 0 (no virtual table possible)
- */
- t_sigobj obj;
-
-#if FLEXT_SYS == FLEXT_SYS_PD
- //! PD only: float signal holder for pd
- float defsig;
-#endif
-
-#if FLEXT_SYS == FLEXT_SYS_MAX
- //! Max/MSP only: current inlet used by proxy objects
- long curinlet;
-#endif
-
- /*! \brief This points to the actual polymorphic C++ class
- */
- FLEXT_CLASSDEF(flext_obj) *data;
-
- //! @} FLEXT_OBJHEADER
-};
-
-
-class flext_class;
-
-// ----------------------------------------------------------------------------
-/*! \brief The mother of base classes for all flext external objects
-
- Each extern which is written in C++ needs to use the #defines at the
- end of this header file.
-
- The define
-
- FLEXT_HEADER(NEW_CLASS, PARENT_CLASS)
-
- should be somewhere in your header file.
- One of the defines like
-
- FLEXT_NEW(NEW_CLASS)
- or
- FLEXT_NEW_2(NEW_CLASS, float, float)
-
- should be the first thing in your implementation file.
- NEW_CLASS is the name of your class and PARENT_CLASS is the
- parent of your class.
-*/
-// ----------------------------------------------------------------------------
-
-class FLEXT_SHARE FLEXT_CLASSDEF(flext_obj):
- public flext
-{
- public:
-
-// --- creation -------------------------------------------------------
-
- /*! \defgroup FLEXT_OBJ_CREATION Object creation/destruction functionality
- @{
- */
-
- //! Constructor
- FLEXT_CLASSDEF(flext_obj)();
-
- //! Destructor
- virtual ~FLEXT_CLASSDEF(flext_obj)();
-
- /*! \brief Signal a construction problem
- \note This should only be used in the constructor. Object creation will be aborted.
- */
- static void InitProblem() { init_ok = false; }
-
- /*! \brief Enable/disable attribute procession (default = false)
- \note Use that in the static class setup function (also library setup function)
- */
-// static void ProcessAttributes(bool attr); //{ process_attributes = attr; }
-
- //! Virtual function called at creation time (but after the constructor)
- // this also guarantees that there are no instances of flext_obj
- virtual bool Init();
-
- //! Virtual function called after Init() has succeeded
- virtual bool Finalize();
-
- //! Virtual function called at destruction (before the destructor)
- virtual void Exit();
-
- //! @} FLEXT_OBJ_CREATION
-
-// --- info -------------------------------------------------------
-
- /*! \defgroup FLEXT_OBJ_INFO Get various information
- @{
- */
-
- //! Get the object's canvas
- t_canvas *thisCanvas() const { return m_canvas; }
-
- //! Get the PD or Max/MSP object
- t_sigobj *thisHdr() { FLEXT_ASSERT(x_obj); return &x_obj->obj; }
- const t_sigobj *thisHdr() const { FLEXT_ASSERT(x_obj); return &x_obj->obj; }
- //! Get the class name (as a string)
- const char *thisName() const { return GetString(m_name); }
- //! Get the class name (as a symbol)
- const t_symbol *thisNameSym() const { return m_name; }
- //! Get the class pointer
- t_class *thisClass() const;
-
- //! Typedef for unique class identifier
- typedef flext_class *t_classid;
-
- //! Get unique id for object class
- t_classid thisClassId() const { return clss; }
-
- //! Get class pointer from class id
- static t_class *getClass(t_classid id);
-
- static bool HasAttributes(t_classid id);
- static bool IsDSP(t_classid id);
- static bool HasDSPIn(t_classid id);
- static bool IsLib(t_classid id);
-
- bool HasAttributes() const;
- bool IsLib() const;
- bool IsDSP() const;
- bool HasDSPIn() const;
-
-#if FLEXT_SYS == FLEXT_SYS_MAX
- // under Max/MSP it could be necessary to activate DSP also for message objects
- // namely for those coexisting with DSP objects in a library
- bool NeedDSP() const;
-#endif
-
- //! @} FLEXT_OBJ_INFO
-
-// --- help -------------------------------------------------------
-
- /*! \defgroup FLEXT_OBJ_HELP Help/assistance functionality
- \remark This is still PD only
- @{
- */
-
- /*! Define the help reference symbol for a class
- \internal
- */
- static void DefineHelp(t_classid c,const char *ref,const char *dir = NULL,bool addtilde = false);
-
- //! Define the help reference symbol for a class
- void DefineHelp(const char *ref,const char *dir = NULL,bool addtilde = false) { DefineHelp(thisClassId(),ref,dir,addtilde); }
-
- //! @} FLEXT_OBJ_HELP
-
-
-// --- internal stuff -------------------------------------------------------
-
- /*! \defgroup FLEXT_OBJ_INTERNAL Internal stuff
- \internal
- @{
- */
-
- protected:
-
- //! backpointer to object header
- mutable flext_hdr *x_obj;
-
- //! pointer to flext class definition
- flext_class *clss;
-
-// static bool process_attributes;
-
- private:
-
- //! The canvas (patcher) that the object is in
- mutable t_canvas *m_canvas;
-
- //! Flag for successful object construction
- static bool init_ok;
-
- // flags for init and exit procedure;
- static bool initing;
- static bool exiting;
-
- public:
-
- //! Creation callback
- static void __setup__(t_classid);
-
- /*! \brief This is a temporary holder
- \warning don't touch it!
- */
- static flext_hdr *m_holder;
- //! Hold object's class during construction
- static flext_class *m_holdclass;
- //! Hold object's name during construction
- static const t_symbol *m_holdname;
-
- //! Holders for attribute procession flag
- static int m_holdaargc;
- static const t_atom *m_holdaargv;
-
- /*! The object's name in the patcher
- \note objects of the same class can have various alias names!
- */
- const t_symbol *m_name;
-
- /*! Return true if in object initialization phase
- true when in constructor or Init, false when in Finalize
- */
- static bool Initing() { return initing; }
-
- //! Return true if in object destruction phase (Exit or destructor)
- static bool Exiting() { return exiting; }
-
- // Definitions for library objects
- static void lib_init(const char *name,void setupfun());
- static void obj_add(bool lib,bool dsp,bool noi,bool attr,const char *idname,const char *names,void setupfun(t_classid),FLEXT_CLASSDEF(flext_obj) *(*newfun)(int,t_atom *),void (*freefun)(flext_hdr *),int argtp1,...);
-#if FLEXT_SYS == FLEXT_SYS_MAX
- static flext_hdr *obj_new(const t_symbol *s,short argc,t_atom *argv);
-#else
- static flext_hdr *obj_new(const t_symbol *s,int argc,t_atom *argv);
-#endif
- static void obj_free(flext_hdr *o);
-
- //! Convert $0 or #0 symbol into appropriate value
- static bool GetParamSym(t_atom &dst,const t_symbol *s,t_canvas *c);
-
- //! Get the canvas arguments
- void GetCanvasArgs(AtomList &args) const;
-
- //! Get the canvas/patcher directory
- void GetCanvasDir(char *buf,size_t bufsz) const;
-
- //! @} FLEXT_OBJ_INTERNAL
-};
-
-
-// max. 4 creation args (see the following macros)
-#define FLEXT_MAXNEWARGS 4
-
-// max. 5 method args (see the following macros)
-#define FLEXT_MAXMETHARGS 5
-
-// prefixes for the macro generated handler functions
-#define FLEXT_CALL_PRE(F) flext_c_##F
-#define FLEXT_THR_PRE(F) flext_t_##F
-#define FLEXT_GET_PRE(F) flext_g_##F
-#define FLEXT_SET_PRE(F) flext_s_##F
-
-
-#ifndef FLEXT_ATTRIBUTES
-/*! \brief Switch for global attribute processing
- \note Should be set to 1 or 0 (or not be defined)
- \ingroup FLEXT_DEFS
-*/
-#define FLEXT_ATTRIBUTES \
-\
-0
-
-
-#elif FLEXT_ATTRIBUTES != 0 && FLEXT_ATTRIBUTES != 1
-#error "FLEXT_ATTRIBUTES must be 0 or 1"
-#endif
-
-// ----------------------------------------
-// These should be used in the header
-// ----------------------------------------
-
-
-#define FLEXT_REALHDR(NEW_CLASS, PARENT_CLASS) \
-public: \
-typedef NEW_CLASS thisType; \
-typedef PARENT_CLASS thisParent; \
-static FLEXT_CLASSDEF(flext_obj) *__init__(int argc,t_atom *argv); \
-static void __free__(flext_hdr *hdr) { \
- FLEXT_CLASSDEF(flext_obj) *mydata = hdr->data; delete mydata; \
- hdr->flext_hdr::~flext_hdr(); \
-} \
-static void __setup__(t_classid classid) { thisParent::__setup__(classid); }
-
-
-#define FLEXT_REALHDR_S(NEW_CLASS, PARENT_CLASS,SETUPFUN) \
-public: \
-typedef NEW_CLASS thisType; \
-typedef PARENT_CLASS thisParent; \
-static FLEXT_CLASSDEF(flext_obj) *__init__(int argc,t_atom *argv); \
-static void __free__(flext_hdr *hdr) { \
- FLEXT_CLASSDEF(flext_obj) *mydata = hdr->data; delete mydata; \
- hdr->flext_hdr::~flext_hdr(); \
-} \
-static void __setup__(t_classid classid) { \
- thisParent::__setup__(classid); \
- thisType::SETUPFUN(classid); \
-}
-
-#define FLEXT_REALHDR_T(NEW_CLASS, PARENT_CLASS) \
-public: \
-typedef NEW_CLASS thisType; \
-typedef PARENT_CLASS thisParent; \
-typedef typename thisParent::t_classid t_classid; \
-static FLEXT_CLASSDEF(flext_obj) *__init__(int argc,t_atom *argv); \
-static void __free__(flext_hdr *hdr) { \
- FLEXT_CLASSDEF(flext_obj) *mydata = hdr->data; delete mydata; \
- hdr->flext_hdr::~flext_hdr(); \
-} \
-static void __setup__(t_classid classid) { thisParent::__setup__(classid); }
-
-
-#define FLEXT_REALHDR_TS(NEW_CLASS, PARENT_CLASS,SETUPFUN) \
-public: \
-typedef NEW_CLASS thisType; \
-typedef PARENT_CLASS thisParent; \
-typedef typename thisParent::t_classid t_classid; \
-static FLEXT_CLASSDEF(flext_obj) *__init__(int argc,t_atom *argv); \
-static void __free__(flext_hdr *hdr) { \
- FLEXT_CLASSDEF(flext_obj) *mydata = hdr->data; delete mydata; \
- hdr->flext_hdr::~flext_hdr(); \
-} \
-static void __setup__(t_classid classid) { \
- thisParent::__setup__(classid); \
- thisType::SETUPFUN(classid); \
-}
-
-
-// generate name of dsp/non-dsp setup function
-#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
- #define FLEXT_STPF_0(NAME) NAME##_setup
- #define FLEXT_STPF_1(NAME) NAME##_tilde_setup
-#else
-#error Platform not supported
-#endif
-
-#define FLEXT_STPF_(DSP) FLEXT_STPF_##DSP
-#define FLEXT_STPF(NAME,DSP) FLEXT_STPF_(DSP)(NAME)
-
-
-// --------------------------------------------------------------------------------------
-
-
-// used in library setup functions to register the individual objects in the library
-#define REAL_SETUP(cl,DSP) extern void FLEXT_STPF(cl,DSP)(); FLEXT_STPF(cl,DSP)();
-
-// specify that to define the library itself
-#if FLEXT_SYS == FLEXT_SYS_PD
-#define REAL_LIB_SETUP(NAME,SETUPFUN) extern "C" FLEXT_EXT void NAME##_setup() { flext_obj::lib_init(#NAME,SETUPFUN); }
-#elif FLEXT_SYS == FLEXT_SYS_MAX
-#define REAL_LIB_SETUP(NAME,SETUPFUN) extern "C" FLEXT_EXT int main() { flext_obj::lib_init(#NAME,SETUPFUN); return 0; }
-#else
-#error Platform not supported
-#endif
-
-
-// --------------------------------------------------
-
-
-#define FLEXT_EXP_0 extern "C" FLEXT_EXT
-#define FLEXT_EXP_1
-#define FLEXT_EXP(LIB) FLEXT_EXP_##LIB
-
-#if FLEXT_SYS == FLEXT_SYS_PD
-#define FLEXT_OBJ_SETUP_0(NEW_CLASS,DSP)
-#elif FLEXT_SYS == FLEXT_SYS_MAX
-#define FLEXT_OBJ_SETUP_0(NEW_CLASS,DSP) extern "C" FLEXT_EXT int main() { FLEXT_STPF(NEW_CLASS,DSP)(); return 0; }
-#else
-#error not implemented
-#endif
-
-#define FLEXT_OBJ_SETUP_1(NEW_CLASS,DSP)
-
-#define FLEXT_OBJ_SETUP(NEW_CLASS,DSP,LIB) FLEXT_OBJ_SETUP_##LIB(NEW_CLASS,DSP)
-
-
-
-// ----------------------------------------
-// These definitions are used below
-// ----------------------------------------
-
-#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
- // maybe that's not necessary
- #define FLEXTTPN_NULL A_NULL
- #if FLEXT_SYS == FLEXT_SYS_PD
- #define FLEXTTPN_PTR A_POINTER
- #else
- #define FLEXTTPN_INT A_INT
- #define FLEXTTPN_DEFINT A_DEFINT
- #endif
- #define FLEXTTPN_FLOAT A_FLOAT
- #define FLEXTTPN_DEFFLOAT A_DEFFLOAT
- #define FLEXTTPN_SYM A_SYMBOL
- #define FLEXTTPN_DEFSYM A_DEFSYMBOL
- #define FLEXTTPN_VAR A_GIMME
-#else
- #define FLEXTTPN_NULL 0
- #define FLEXTTPN_PTR 1
- #define FLEXTTPN_INT 2
- #define FLEXTTPN_FLOAT 3
- #define FLEXTTPN_SYM 4
- #define FLEXTTPN_VAR 5
- #define FLEXTTPN_DEFINT 6
- #define FLEXTTPN_DEFFLOAT 7
- #define FLEXTTPN_DEFSYM 8
-#endif
-
-// Shortcuts for PD/Max type arguments
-#define FLEXTTYPE_void FLEXTTPN_NULL
-#define CALLBTYPE_void void
-#define FLEXTTYPE_float FLEXTTPN_FLOAT
-#define FLEXTTYPE_float0 FLEXTTPN_DEFFLOAT
-#define CALLBTYPE_float float
-#define FLEXTTYPE_t_float FLEXTTPN_FLOAT
-#define CALLBTYPE_t_float t_float
-
-#if FLEXT_SYS == FLEXT_SYS_PD
-#define FLEXTTYPE_int FLEXTTPN_FLOAT
-#define FLEXTTYPE_int0 FLEXTTPN_DEFFLOAT
-#define CALLBTYPE_int float
-#define FLEXTTYPE_bool FLEXTTPN_FLOAT
-#define FLEXTTYPE_bool0 FLEXTTPN_DEFFLOAT
-#define CALLBTYPE_bool float
-#elif FLEXT_SYS == FLEXT_SYS_MAX
-#define FLEXTTYPE_int FLEXTTPN_INT
-#define FLEXTTYPE_int0 FLEXTTPN_DEFINT
-#define CALLBTYPE_int int
-#define FLEXTTYPE_bool FLEXTTPN_INT
-#define FLEXTTYPE_bool0 FLEXTTPN_DEFINT
-#define CALLBTYPE_bool int
-#else
-#error Platform not supported
-#endif
-
-#define FLEXTTYPE_t_symptr FLEXTTPN_SYM
-#define FLEXTTYPE_t_symptr0 FLEXTTPN_DEFSYM
-#define CALLBTYPE_t_symptr t_symptr
-#define FLEXTTYPE_t_symtype FLEXTTYPE_t_symptr
-#define FLEXTTYPE_t_symtype0 FLEXTTYPE_t_symptr0
-#define CALLBTYPE_t_symtype t_symptr
-#define FLEXTTYPE_t_ptrtype FLEXTTPN_PTR
-#define CALLBTYPE_t_ptrtype t_ptrtype
-
-#define FLEXTTP(TP) FLEXTTYPE_ ## TP
-#define CALLBTP(TP) CALLBTYPE_ ## TP
-
-
-#define ARGMEMBER_bool(a) GetBool(a)
-#define ARGMEMBER_bool0(a) ARGMEMBER_bool(a)
-#define ARGMEMBER_int(a) GetInt(a)
-#define ARGMEMBER_int0(a) ARGMEMBER_int(a)
-#define ARGMEMBER_float(a) GetFloat(a)
-#define ARGMEMBER_float0(a) ARGMEMBER_float(a)
-#define ARGMEMBER_t_symptr(a) GetSymbol(a)
-#define ARGMEMBER_t_symptr0(a) ARGMEMBER_t_symptr(a)
-#define ARGMEMBER_t_symtype(a) ARGMEMBER_t_symptr(a)
-#define ARGMEMBER_t_symtype0(a) ARGMEMBER_t_symptr0(a)
-#define ARGCAST(a,tp) ARGMEMBER_##tp(a)
-
-#define REAL_NEW(NAME,NEW_CLASS,DSP,NOI,LIB) \
-flext_obj *NEW_CLASS::__init__(int ,t_atom *) \
-{ \
- return new NEW_CLASS; \
-} \
-FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \
-{ \
- flext_obj::obj_add(LIB,DSP,NOI,FLEXT_ATTRIBUTES,#NEW_CLASS,NAME,NEW_CLASS::__setup__,NEW_CLASS::__init__,&NEW_CLASS::__free__,FLEXTTPN_NULL); \
-} \
-FLEXT_OBJ_SETUP(NEW_CLASS,DSP,LIB)
-
-#define REAL_NEW_V(NAME,NEW_CLASS,DSP,NOI,LIB) \
-flext_obj *NEW_CLASS::__init__(int argc,t_atom *argv) \
-{ \
- return new NEW_CLASS(argc,argv); \
-} \
-FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \
-{ \
- flext_obj::obj_add(LIB,DSP,NOI,FLEXT_ATTRIBUTES,#NEW_CLASS,NAME,NEW_CLASS::__setup__,NEW_CLASS::__init__,&NEW_CLASS::__free__,FLEXTTPN_VAR,FLEXTTPN_NULL); \
-} \
-FLEXT_OBJ_SETUP(NEW_CLASS,DSP,LIB)
-
-#define REAL_NEW_1(NAME,NEW_CLASS,DSP,NOI,LIB, TYPE1) \
-flext_obj *NEW_CLASS::__init__(int,t_atom *argv) \
-{ \
- return new NEW_CLASS(ARGCAST(argv[0],TYPE1)); \
-} \
-FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \
-{ \
- flext_obj::obj_add(LIB,DSP,NOI,FLEXT_ATTRIBUTES,#NEW_CLASS,NAME,NEW_CLASS::__setup__,NEW_CLASS::__init__,NEW_CLASS::__free__,FLEXTTP(TYPE1),FLEXTTPN_NULL); \
-} \
-FLEXT_OBJ_SETUP(NEW_CLASS,DSP,LIB)
-
-#define REAL_NEW_2(NAME,NEW_CLASS,DSP,NOI,LIB, TYPE1,TYPE2) \
-flext_obj *NEW_CLASS::__init__(int,t_atom *argv) \
-{ \
- return new NEW_CLASS(ARGCAST(argv[0],TYPE1),ARGCAST(argv[1],TYPE2)); \
-} \
-FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \
-{ \
- flext_obj::obj_add(LIB,DSP,NOI,FLEXT_ATTRIBUTES,#NEW_CLASS,NAME,NEW_CLASS::__setup__,NEW_CLASS::__init__,NEW_CLASS::__free__,FLEXTTP(TYPE1),FLEXTTP(TYPE2),FLEXTTPN_NULL); \
-} \
-FLEXT_OBJ_SETUP(NEW_CLASS,DSP,LIB)
-
-#define REAL_NEW_3(NAME,NEW_CLASS,DSP,NOI,LIB, TYPE1, TYPE2, TYPE3) \
-flext_obj *NEW_CLASS::__init__(int,t_atom *argv) \
-{ \
- return new NEW_CLASS(ARGCAST(argv[0],TYPE1),ARGCAST(argv[1],TYPE2),ARGCAST(argv[2],TYPE3)); \
-} \
-FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \
-{ \
- flext_obj::obj_add(LIB,DSP,NOI,FLEXT_ATTRIBUTES,#NEW_CLASS,NAME,NEW_CLASS::__setup__,NEW_CLASS::__init__,NEW_CLASS::__free__,FLEXTTP(TYPE1),FLEXTTP(TYPE2),FLEXTTP(TYPE3),FLEXTTPN_NULL); \
-} \
-FLEXT_OBJ_SETUP(NEW_CLASS,DSP,LIB)
-
-#define REAL_NEW_4(NAME,NEW_CLASS,DSP,NOI,LIB, TYPE1,TYPE2, TYPE3, TYPE4) \
-flext_obj *NEW_CLASS::__init__(int,t_atom *argv) \
-{ \
- return new NEW_CLASS(ARGCAST(argv[0],TYPE1),ARGCAST(argv[1],TYPE2),ARGCAST(argv[2],TYPE3),ARGCAST(argv[3],TYPE4)); \
-} \
-FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \
-{ \
- flext_obj::obj_add(LIB,DSP,NOI,FLEXT_ATTRIBUTES,#NEW_CLASS,NAME,NEW_CLASS::__setup__,NEW_CLASS::__init__,NEW_CLASS::__free__,FLEXTTP(TYPE1),FLEXTTP(TYPE2),FLEXTTP(TYPE3),FLEXTTP(TYPE4),FLEXTTPN_NULL); \
-} \
-FLEXT_OBJ_SETUP(NEW_CLASS,DSP,LIB)
-
-
-// Shortcuts for method arguments:
-#define FLEXTARG_float a_float
-#define FLEXTARG_int a_int
-#define FLEXTARG_bool a_int
-#define FLEXTARG_t_float a_float
-#define FLEXTARG_t_symtype a_symbol
-#define FLEXTARG_t_symptr a_symbol
-#define FLEXTARG_t_ptrtype a_pointer
-
-#define FLEXTARG(TP) FLEXTARG_ ## TP
-
-
-#endif
diff --git a/externals/grill/flext/source/flbind.cpp b/externals/grill/flext/source/flbind.cpp
deleted file mode 100644
index 8f78c300..00000000
--- a/externals/grill/flext/source/flbind.cpp
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file flbind.cpp
- \brief Functionality for symbol-bound methods.
-*/
-
-#include "flext.h"
-#include "flinternal.h"
-
-
-t_class *flext_base::pxbnd_class = NULL;
-
-#if FLEXT_SYS == FLEXT_SYS_MAX
-t_object *px_freelist = NULL;
-t_messlist px_messlist[3];
-#endif
-
-/*! \brief Set up the proxy class for symbol-bound methods
-*/
-void flext_base::SetupBindProxy()
-{
- // already initialized?
- if(!pxbnd_class) {
-#if FLEXT_SYS == FLEXT_SYS_PD
- pxbnd_class = class_new(gensym("flext_base bind proxy"),NULL,NULL,sizeof(pxbnd_object),CLASS_PD|CLASS_NOINLET, A_NULL);
- add_anything(pxbnd_class,pxbnd_object::px_method); // for symbol-bound methods
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- pxbnd_class = new t_class;
-
- pxbnd_class->c_sym = const_cast<t_symbol *>(sym__);
- pxbnd_class->c_freelist = &px_freelist;
- pxbnd_class->c_freefun = NULL;
- pxbnd_class->c_size = sizeof(pxbnd_object);
- pxbnd_class->c_tiny = 0;
- pxbnd_class->c_noinlet = 1;
- px_messlist[0].m_sym = (t_symbol *)pxbnd_class;
-
- px_messlist[1].m_sym = const_cast<t_symbol *>(sym_anything);
- px_messlist[1].m_fun = (method)pxbnd_object::px_method;
- px_messlist[1].m_type[0] = A_GIMME;
- px_messlist[1].m_type[1] = 0;
-
- px_messlist[2].m_sym = 0;
-#else
-#pragma warning("Not implemented!")
-#endif
- }
-}
-
-
-flext_base::BindItem::BindItem(bool (*f)(flext_base *,t_symbol *s,int,t_atom *,void *data),pxbnd_object *p):
- Item(NULL),fun(f),px(p)
-{}
-
-flext_base::BindItem::~BindItem()
-{
- if(px) {
- FLEXT_ASSERT(!fun); // check if already unbound
- object_free(&px->obj);
- }
-}
-
-void flext_base::BindItem::Unbind(const t_symbol *tag)
-{
- if(px) {
- FLEXT_ASSERT(fun);
-
-#if FLEXT_SYS == FLEXT_SYS_PD
- pd_unbind(&px->obj.ob_pd,const_cast<t_symbol *>(tag));
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- if(tag->s_thing == (t_object *)px)
- const_cast<t_symbol *>(tag)->s_thing = NULL;
- else
- error("flext - Binding to symbol %s not found",tag->s_name);
-#else
-# pragma warning("Not implemented")
-#endif
-
- fun = NULL;
- }
-}
-
-#if FLEXT_SYS == FLEXT_SYS_PD
- //! Bind object to a symbol
- bool flext_base::Bind(const t_symbol *sym) { pd_bind(&thisHdr()->ob_pd,const_cast<t_symbol *>(sym)); return true; }
- //! Unbind object from a symbol
- bool flext_base::Unbind(const t_symbol *sym) { pd_unbind(&thisHdr()->ob_pd,const_cast<t_symbol *>(sym)); return true; }
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- //! Bind object to a symbol
- bool flext_base::Bind(const t_symbol *sym) { if(sym->s_thing) return false; else { const_cast<t_symbol *>(sym)->s_thing = (t_object *)thisHdr(); return true; } }
- //! Unbind object from a symbol
- bool flext_base::Unbind(const t_symbol *sym) { if(sym->s_thing != (t_object *)thisHdr()) return false; else { const_cast<t_symbol *>(sym)->s_thing = NULL; return true; } }
-#endif
-
-bool flext_base::BindMethod(const t_symbol *sym,bool (*fun)(flext_base *,t_symbol *s,int argc,t_atom *argv,void *data),void *data)
-{
- if(!bindhead)
- bindhead = new ItemCont;
- else {
- // Search for symbol
- for(Item *it = bindhead->FindList(sym); it; it = it->nxt) {
- BindItem *item = (BindItem *)it;
-
- // go through all items with matching tag
- if(item->fun == fun) {
- // function already registered -> bail out!
- post("%s - Symbol already bound with this method",thisName());
- return false;
- }
- }
- }
-
- SetupBindProxy();
-
-#if FLEXT_SYS == FLEXT_SYS_PD
- pxbnd_object *px = (pxbnd_object *)object_new(pxbnd_class);
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- pxbnd_object *px = (pxbnd_object *)newobject(px_messlist);
-#else
-#pragma warning("Not implemented!")
-#endif
-
- if(px) {
- BindItem *mi = new BindItem(fun,px);
- bindhead->Add(mi,sym);
-
- px->init(this,mi,data);
-
-#if FLEXT_SYS == FLEXT_SYS_PD
- pd_bind(&px->obj.ob_pd,const_cast<t_symbol *>(sym));
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- if(!sym->s_thing)
- const_cast<t_symbol *>(sym)->s_thing = (t_object *)px;
- else
- error("%s - Symbol is already bound",thisName());
-#else
-# pragma warning("Not implemented")
-#endif
- }
- else
- error("%s - Symbol proxy could not be created",thisName());
-
- return true;
-}
-
-bool flext_base::UnbindMethod(const t_symbol *sym,bool (*fun)(flext_base *,t_symbol *s,int argc,t_atom *argv,void *data),void **data)
-{
- bool ok = false;
-
- if(bindhead && bindhead->Contained(0)) {
- ItemSet &set = bindhead->GetInlet();
-
-/*
- ItemSet::iterator it1,it2;
- if(sym) {
- // specific tag
- it1 = it2 = set.find(sym); it2++;
- }
- else {
- // any tag
- it1 = set.begin(),it2 = set.end();
- }
-
- BindItem *it = NULL;
- for(ItemSet::iterator si = it1; si != it2 && !it; ++si) {
- for(Item *i = si.data(); i; i = i->nxt) {
- BindItem *item = (BindItem *)i;
- if(!fun || item->fun == fun)
- {
- it = item;
- if(!sym) sym = si.key();
- break;
- }
- }
- }
-*/
- BindItem *item = NULL;
- if(sym) {
- // symbol is given
- Item *it = set.find(sym);
- if(fun) {
- // check if function matches
- for(; it && static_cast<BindItem *>(it)->fun != fun; it = it->nxt) {}
- }
- item = static_cast<BindItem *>(it);
- }
- else {
- // take any entry that matches
- for(ItemSet::iterator si(set); si && !item; ++si) {
- for(Item *i = si.data(); i; i = i->nxt) {
- BindItem *bit = (BindItem *)i;
- if(!fun || bit->fun == fun) {
- item = bit;
- if(!sym) sym = si.key();
- break;
- }
- }
- }
- }
-
- if(item) {
- if(data) *data = item->px->data;
- ok = bindhead->Remove(item,sym,0,false);
- if(ok) {
- item->Unbind(sym);
- delete item;
- }
- }
- }
- return ok;
-}
-
-bool flext_base::GetBoundMethod(const t_symbol *sym,bool (*fun)(flext_base *,t_symbol *s,int argc,t_atom *argv,void *data),void *&data)
-{
- if(bindhead) {
- // Search for symbol
- for(Item *it = bindhead->FindList(sym); it; it = it->nxt) {
- BindItem *item = (BindItem *)it;
-
- // go through all items with matching tag
- if(item->fun == fun) {
- data = item->px->data;
- return true;
- }
- }
- }
- return false;
-}
-
-bool flext_base::UnbindAll()
-{
- if(bindhead && bindhead->Contained(0)) {
- ItemSet &set = bindhead->GetInlet();
-// for(ItemSet::iterator si = set.begin(); si != set.end(); ++si) {
- for(ItemSet::iterator si(set); si; ++si) {
- Item *lst = si.data();
- while(lst) {
- Item *nxt = lst->nxt;
- BindItem *it = (BindItem *)lst;
- it->Unbind(si.key());
- delete it;
- lst = nxt;
- }
- }
- set.clear();
- }
- return true;
-}
-
-void flext_base::pxbnd_object::px_method(pxbnd_object *c,const t_symbol *s,int argc,t_atom *argv)
-{
- c->item->fun(c->base,(t_symbol *)s,argc,(t_atom *)argv,c->data);
-}
diff --git a/externals/grill/flext/source/flbuf.cpp b/externals/grill/flext/source/flbuf.cpp
deleted file mode 100644
index a807c20b..00000000
--- a/externals/grill/flext/source/flbuf.cpp
+++ /dev/null
@@ -1,348 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file flbuf.cpp
- \brief Implementation of the buffer abstraction class.
-*/
-
-#include "flext.h"
-#include "flfeatures.h"
-
-#if FLEXT_SYS != FLEXT_SYS_JMAX
-
-#if FLEXT_SYS == FLEXT_SYS_PD
-#define DIRTY_INTERVAL 0 // buffer dirty check in msec
-#endif
-
-#if FLEXT_SYS == FLEXT_SYS_MAX
-// defined in flsupport.cpp
-extern const t_symbol *sym_buffer,*sym_size;
-#endif
-
-flext::buffer::buffer(const t_symbol *bn,bool delayed):
- sym(NULL),data(NULL),
- chns(0),frames(0)
-{
-#if FLEXT_SYS == FLEXT_SYS_PD
- arr = NULL;
- interval = DIRTY_INTERVAL;
- isdirty = false;
- ticking = false;
- tick = clock_new(this,(t_method)cb_tick);
-#endif
-
- if(bn) Set(bn,delayed);
-
- ClearDirty();
-}
-
-flext::buffer::~buffer()
-{
-#if FLEXT_SYS == FLEXT_SYS_PD
- clock_free(tick);
-#endif
-}
-
-int flext::buffer::Set(const t_symbol *s,bool nameonly)
-{
- int ret = 0;
- bool valid = data != NULL; // valid now? (before change)
-
- if(s && sym != s) {
- ret = 1;
- data = NULL;
- frames = 0;
- chns = 0;
- }
-
- if(s && *GetString(s)) sym = s;
-
- if(!sym) {
- if(valid) ret = -1;
- }
- else if(!nameonly) {
-#if FLEXT_SYS == FLEXT_SYS_PD
- int frames1;
- t_sample *data1;
-
- arr = (t_garray *)pd_findbyclass(const_cast<t_symbol *>(sym), garray_class);
- if(!arr)
- {
- if (*GetString(sym)) FLEXT_LOG1("buffer: no such array '%s'",GetString(sym));
-// sym = NULL;
- if(valid) ret = -1;
- }
- else if(!garray_getfloatarray(arr, &frames1, &data1))
- {
- error("buffer: bad template '%s'",GetString(sym));
- data = NULL;
- frames = 0;
- if(valid) ret = -1;
- }
- else {
- ret = 0;
- garray_usedindsp(arr);
- if(frames != frames1) { frames = frames1; if(!ret) ret = 1; }
- if(data != data1) { data = data1; if(!ret) ret = 1; }
- chns = 1;
- }
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- if(sym->s_thing) {
- const t_buffer *p = (const t_buffer *)sym->s_thing;
-
- FLEXT_ASSERT(!NOGOOD(p));
-
- if(ob_sym(p) != sym_buffer) {
- post("buffer: object '%s' not valid (type %s)",GetString(sym),GetString(ob_sym(p)));
- if(valid) ret = -2;
- }
- else {
-#ifdef FLEXT_DEBUG
-// post("flext: buffer object '%s' - valid:%i samples:%i channels:%i frames:%i",GetString(sym),p->b_valid,p->b_frames,p->b_nchans,p->b_frames);
-#endif
- if(data != p->b_samples) { data = p->b_samples; if(!ret) ret = 1; }
- if(chns != p->b_nchans) { chns = p->b_nchans; if(!ret) ret = 1; }
- if(frames != p->b_frames) { frames = p->b_frames; if(!ret) ret = 1; }
- }
- }
- else {
- FLEXT_LOG1("buffer: symbol '%s' not defined", GetString(sym));
- /*if(valid)*/ ret = -1;
- }
-#else
-#error not implemented
-#endif
- }
-
- return ret;
-}
-
-bool flext::buffer::Update()
-{
- FLEXT_ASSERT(sym);
-
- bool upd = false;
-
-#if FLEXT_SYS == FLEXT_SYS_PD
- if(!arr) return data == NULL;
-
- int frames1;
- t_sample *data1;
- if(!garray_getfloatarray(arr, &frames1, &data1)) {
- data = NULL;
- chns = 0;
- frames = 0;
- upd = true;
- }
- else if(data != data1 || frames != frames1) {
- data = data1;
- frames = frames1;
- upd = true;
- }
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- const t_buffer *p = (const t_buffer *)sym->s_thing;
- if(p) {
- FLEXT_ASSERT(!NOGOOD(p) && ob_sym(p) == sym_buffer);
-
- if(data != p->b_samples || chns != p->b_nchans || frames != p->b_frames) {
- data = p->b_samples;
- chns = p->b_nchans;
- frames = p->b_frames;
- upd = true;
- }
- }
- else {
- // buffer~ has e.g. been renamed
- data = NULL;
- chns = 0;
- frames = 0;
- upd = true;
- }
-#else
-#error not implemented
-#endif
- return upd;
-}
-
-flext::buffer::lock_t flext::buffer::Lock()
-{
- FLEXT_ASSERT(sym);
-#if FLEXT_SYS == FLEXT_SYS_PD
- FLEXT_ASSERT(arr);
-#ifdef _FLEXT_HAVE_PD_GARRAYLOCKS
- garray_lock(arr);
-#endif
- return false;
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- t_buffer *p = (t_buffer *)sym->s_thing;
- FLEXT_ASSERT(p);
-#ifdef _FLEXT_HAVE_MAX_INUSEFLAG
- long old = p->b_inuse;
- p->b_inuse = 1;
- return old;
-#else
- return 0;
-#endif
-#else
-#error not implemented
-#endif
-}
-
-void flext::buffer::Unlock(flext::buffer::lock_t prv)
-{
- FLEXT_ASSERT(sym);
-#if FLEXT_SYS == FLEXT_SYS_PD
- FLEXT_ASSERT(arr);
-#ifdef _FLEXT_HAVE_PD_GARRAYLOCKS
- garray_unlock(arr);
-#endif
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- t_buffer *p = (t_buffer *)sym->s_thing;
- FLEXT_ASSERT(p);
-#ifdef _FLEXT_HAVE_MAX_INUSEFLAG
- p->b_inuse = prv;
-#endif
-#else
-#error not implemented
-#endif
-}
-
-void flext::buffer::Frames(int fr,bool keep,bool zero)
-{
- FLEXT_ASSERT(sym);
-#if FLEXT_SYS == FLEXT_SYS_PD
- // is this function guaranteed to keep memory and set rest to zero?
- ::garray_resize(arr,(float)fr);
- Update();
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- t_sample *tmp = NULL;
- int sz = frames;
- if(fr < sz) sz = fr;
-
- if(keep) {
- // copy buffer data to tmp storage
- tmp = (t_sample *)NewAligned(sz*sizeof(t_sample));
- FLEXT_ASSERT(tmp);
- CopySamples(tmp,data,sz);
- }
-
- t_atom msg;
- t_buffer *buf = (t_buffer *)sym->s_thing;
- // b_msr reflects buffer sample rate... is this what we want?
- // Max bug: adding half a sample to prevent roundoff errors....
- float ms = (fr+0.5)/buf->b_msr;
-
- SetFloat(msg,ms);
- ::typedmess((object *)buf,(t_symbol *)sym_size,1,&msg);
-
- Update();
-
- if(tmp) {
- // copy data back
- CopySamples(data,tmp,sz);
- FreeAligned(tmp);
- if(zero && sz < fr) ZeroSamples(data+sz,fr-sz);
- }
- else
- if(zero) ZeroSamples(data,fr);
-#else
-#error
-#endif
-}
-
-
-#if FLEXT_SYS == FLEXT_SYS_PD
-void flext::buffer::SetRefrIntv(float intv)
-{
- interval = intv;
- if(interval == 0 && ticking) {
- clock_unset(tick);
- ticking = false;
- }
-}
-#elif FLEXT_SYS == FLEXT_SYS_MAX
-void flext::buffer::SetRefrIntv(float) {}
-#else
-#error
-#endif
-
-
-void flext::buffer::Dirty(bool force)
-{
- FLEXT_ASSERT(sym);
-#if FLEXT_SYS == FLEXT_SYS_PD
- if((!ticking) && (interval || force)) {
- ticking = true;
- cb_tick(this); // immediately redraw
- }
- else {
- if(force) clock_delay(tick,0);
- isdirty = true;
- }
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- t_buffer *p = (t_buffer *)sym->s_thing;
- FLEXT_ASSERT(p && !NOGOOD(p));
- p->b_modtime = gettime();
-#else
-#error Not implemented
-#endif
-}
-
-#if FLEXT_SYS == FLEXT_SYS_PD
-void flext::buffer::cb_tick(buffer *b)
-{
- if(b->arr) garray_redraw(b->arr);
-#ifdef FLEXT_DEBUG
- else error("buffer: array is NULL");
-#endif
-
- if(b->isdirty && b->interval) {
- b->isdirty = false;
- b->ticking = true;
- clock_delay(b->tick,b->interval);
- }
- else
- b->ticking = false;
-}
-#endif
-
-void flext::buffer::ClearDirty()
-{
-#if FLEXT_SYS == FLEXT_SYS_PD
- cleantime = clock_getlogicaltime();
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- cleantime = gettime();
-#else
-#error Not implemented
-#endif
-}
-
-bool flext::buffer::IsDirty() const
-{
- if(!sym) return false;
-#if FLEXT_SYS == FLEXT_SYS_PD
- #ifdef _FLEXT_HAVE_PD_GARRAYUPDATETIME
- return arr && (isdirty || garray_updatetime(arr) > cleantime);
- #else
- // Don't know.... (no method in PD judging whether buffer has been changed from outside flext...)
- return true;
- #endif
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- t_buffer *p = (t_buffer *)sym->s_thing;
- FLEXT_ASSERT(p && !NOGOOD(p));
- return p->b_modtime > cleantime;
-#else
-#error Not implemented
-#endif
-}
-
-#endif // Jmax
-
-
diff --git a/externals/grill/flext/source/flclass.h b/externals/grill/flext/source/flclass.h
deleted file mode 100644
index 3da63719..00000000
--- a/externals/grill/flext/source/flclass.h
+++ /dev/null
@@ -1,1098 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2006 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file flclass.h
- \brief User accessible flext base classes
-
-*/
-
-#ifndef __FLCLASS_H
-#define __FLCLASS_H
-
-// include the header file declaring the base classes
-#include "flbase.h"
-#include "flsupport.h"
-#include "flmap.h"
-#include "flinternal.h"
-
-#ifdef _MSC_VER
-#pragma warning(disable: 4786)
-#endif
-
-#ifdef __BORLANDC__
-#pragma warn -8008 // Condition is always false
-#pragma warn -8057 // Parameter is never used
-#pragma warn -8066 // Unreachable code
-#endif
-
-
-// === flext_base ==================================================
-
-/*! \brief Flext message only base object
-
- This is the base class from which typical external objects derive.
- DSP objects should use the flext_dsp class which inherits from flext_base and
- provides the necessary functionality.
-
- For a valid external object class you would also need FLEXT_HEADER, also if it's only
- a base class without instantiated objects again.
- To make an instance of an object class you would typically use FLEXT_NEW or
- its companions.
-
- See the flext_obj class for additional information.
-*/
-
-
-class FLEXT_SHARE FLEXT_CLASSDEF(flext_base);
-typedef class FLEXT_SHARE FLEXT_CLASSDEF(flext_base) flext_base;
-
-class FLEXT_SHARE FLEXT_CLASSDEF(flext_base):
- public flext_obj
-{
- FLEXT_HEADER_S(FLEXT_CLASSDEF(flext_base),flext_obj,Setup)
-
- friend class FLEXT_SHARE FLEXT_CLASSDEF(flext_obj);
-
-public:
-
-// --- inheritable virtual methods --------------------------------
-
- /*! \defgroup FLEXT_C_VIRTUAL Virtual base class functions
-
- @{
- */
-
- //! called on patcher load (not on mere object creation!)
- virtual void CbLoadbang();
- virtual void m_loadbang();
-
- //! called on (double-)click into object box
- virtual void CbClick();
-
- /*! \brief Called for every incoming message.
- All method handling is done in there
- \return True if a handler was found and called
- */
- virtual bool CbMethodHandler(int inlet,const t_symbol *s,int argc,const t_atom *argv);
-
- /*! \brief Called for every unhandled message (by CbMethodHandler)
- */
- virtual bool CbMethodResort(int inlet,const t_symbol *s,int argc,const t_atom *argv);
- virtual bool m_method_(int inlet,const t_symbol *s,int argc,const t_atom *argv);
-
-//! @} FLEXT_C_VIRTUAL
-
-
-// --- inlet/outlet stuff -----------------------------------------
-
- /*! \defgroup FLEXT_C_INOUT Flext in-/outlet functions
- \note These must be called in the class' constructor
- \note All (also default) inlets must be defined
- @{
- */
-
- /*! \defgroup FLEXT_C_IO_ADD Announce in-/outlet functions
- @{
- */
-
- // argument m specifies multiple inlet/outlet count
-
-// void AddInDef() { AddInlet(xlet_def,1); }
-
- /*! \brief Add inlet(s) for anythings
- \remark That's the one to choose for the left-most (first) inlet unless it's a signal inlet.
- */
- void AddInAnything(int m = 1) { AddInlet(xlet_any,m); }
- /*! \brief Add inlet(s) for anythings (with description)
- \remark That's the one to choose for the left-most (first) inlet unless it's a signal inlet.
- */
- void AddInAnything(const char *desc,int m = 1) { AddInlet(xlet_any,m,desc); }
- //! Add inlet(s) for floats
- void AddInFloat(int m = 1) { AddInlet(xlet_float,m); }
- //! Add inlet(s) for floats (with description)
- void AddInFloat(const char *desc,int m = 1) { AddInlet(xlet_float,m,desc); }
- //! Add inlet(s) for integers
- void AddInInt(int m = 1) { AddInlet(xlet_int,m); }
- //! Add inlet(s) for integers (with description)
- void AddInInt(const char *desc,int m = 1) { AddInlet(xlet_int,m,desc); }
- //! Add inlet(s) for symbols
- void AddInSymbol(int m = 1) { AddInlet(xlet_sym,m); }
- //! Add inlet(s) for symbol (with description)
- void AddInSymbol(const char *desc,int m = 1) { AddInlet(xlet_sym,m,desc); }
- //! Add inlet(s) for bang
- void AddInBang(int m = 1) { AddInlet(xlet_sym,m); }
- //! Add inlet(s) for bangs (with description)
- void AddInBang(const char *desc,int m = 1) { AddInlet(xlet_sym,m,desc); }
- //! Add inlet(s) for lists
- void AddInList(int m = 1) { AddInlet(xlet_list,m); }
- //! Add inlet(s) for lists (with description)
- void AddInList(const char *desc,int m = 1) { AddInlet(xlet_list,m,desc); }
-
- //! Add outlet(s) for anythings
- void AddOutAnything(int m = 1) { AddOutlet(xlet_any,m); }
- //! Add outlet(s) for anythings (with description)
- void AddOutAnything(const char *desc,int m = 1) { AddOutlet(xlet_any,m,desc); }
- //! Add outlet(s) for floats
- void AddOutFloat(int m = 1) { AddOutlet(xlet_float,m); }
- //! Add outlet(s) for floats (with description)
- void AddOutFloat(const char *desc,int m = 1) { AddOutlet(xlet_float,m,desc); }
- //! Add outlet(s) for integers
- void AddOutInt(int m = 1) { AddOutlet(xlet_int,m); }
- //! Add outlet(s) for integers (with description)
- void AddOutInt(const char *desc,int m = 1) { AddOutlet(xlet_int,m,desc); }
- //! Add outlet(s) for symbols
- void AddOutSymbol(int m = 1) { AddOutlet(xlet_sym,m); }
- //! Add outlet(s) for symbols (with description)
- void AddOutSymbol(const char *desc,int m = 1) { AddOutlet(xlet_sym,m,desc); }
- //! Add outlet(s) for bangs
- void AddOutBang(int m = 1) { AddOutlet(xlet_sym,m); }
- //! Add outlet(s) for bangs (with description)
- void AddOutBang(const char *desc,int m = 1) { AddOutlet(xlet_sym,m,desc); }
- //! Add outlet(s) for lists
- void AddOutList(int m = 1) { AddOutlet(xlet_list,m); }
- //! Add outlet(s) for lists (with description)
- void AddOutList(const char *desc,int m = 1) { AddOutlet(xlet_list,m,desc); }
-
- //! \deprecated inlets and outlets are now set up automatically
- bool SetupInOut() { return true; }
-
- //! @} FLEXT_C_IO_ADD
-
- /*! \defgroup FLEXT_C_IO_MISC Miscellanous in-/outlet functionality
- @{
- */
-
- //! Get number of inlets
- int CntIn() const { return incnt; }
- //! Get number of outlets
- int CntOut() const { return outcnt; }
- //! Get number of signal inlets
- int CntInSig() const { return insigs; }
- //! Get number of signal outlets
- int CntOutSig() const { return outsigs; }
-
-
- //! Retrieve currently processed message tag (NULL if no message processing)
- static const t_symbol *thisTag() { return curtag; }
-
- class outlet;
-
- //! Get pointer to outlet (not in the constructor!)
- outlet *GetOut(int ix) const { return outlets[ix]; }
-
- int GetOutAttr() const { return HasAttributes()?CntOut():0; }
-
- //! @} FLEXT_C_IO_MISC
-
- /*! \defgroup FLEXT_C_IO_OUT Output data to inlets/outlets
- @{
- */
-
- // output messages
-
- //! Output bang (index n starts with 0)
- void ToOutBang(int n) const;
-
- //! Output float (index n starts with 0)
- void ToOutFloat(int n,float f) const;
-
- //! Output integer (index n starts with 0)
- void ToOutInt(int n,int f) const;
-
- //! Output boolean (index n starts with 0)
- void ToOutBool(int n,bool f) const { ToOutInt(n,f?1:0); }
-
- //! Output symbol (index n starts with 0)
- void ToOutSymbol(int n,const t_symbol *s) const;
- //! Output string aka symbol (index n starts with 0)
- void ToOutString(int n,const char *s) const { ToOutSymbol(n,MakeSymbol(s)); }
-
- //! Output atom (index n starts with 0)
- void ToOutAtom(int n,const t_atom &at) const;
-
- //! Output list (index n starts with 0)
- void ToOutList(int n,int argc,const t_atom *argv) const;
- //! Output list (index n starts with 0)
- void ToOutList(int n,const AtomList &list) const { ToOutList(n,list.Count(),list.Atoms()); }
-
- //! Output anything (index n starts with 0)
- void ToOutAnything(int n,const t_symbol *s,int argc,const t_atom *argv) const;
- //! Output anything (index n starts with 0)
- void ToOutAnything(int n,const AtomAnything &any) const { ToOutAnything(n,any.Header(),any.Count(),any.Atoms()); }
- //! Output anything (index n starts with 0)
- void ToOutAnything(int n,const t_symbol *s,const AtomList &list) const { ToOutAnything(n,s,list.Count(),list.Atoms()); }
-
- //! @} FLEXT_C_IO_OUT
-
- /*! \defgroup FLEXT_C_IO_QUEUE Low-priority output of data to inlets/outlets
- @{
- */
-
- //! Output low priority bang (index n starts with 0)
- void ToQueueBang(int n) const;
-
- //! Output low priority float (index n starts with 0)
- void ToQueueFloat(int n,float f) const;
-
- //! Output low priority integer (index n starts with 0)
- void ToQueueInt(int n,int f) const;
-
- //! Output low priority boolean (index n starts with 0)
- void ToQueueBool(int n,bool f) const { ToQueueInt(n,f?1:0); }
-
- //! Output low priority symbol (index n starts with 0)
- void ToQueueSymbol(int n,const t_symbol *s) const;
- //! Output low priority string aka symbol (to appointed outlet)
- void ToQueueString(int n,const char *s) const { ToQueueSymbol(n,MakeSymbol(s)); }
-
- //! Output low priority atom (index n starts with 0)
- void ToQueueAtom(int n,const t_atom &at) const;
-
- //! Output low priority list (index n starts with 0)
- void ToQueueList(int n,int argc,const t_atom *argv) const;
- //! Output low priority list (index n starts with 0)
- void ToQueueList(int n,const AtomList &list) const { ToQueueList(n,list.Count(),list.Atoms()); }
-
- //! Output low priority anything (index n starts with 0)
- void ToQueueAnything(int n,const t_symbol *s,int argc,const t_atom *argv) const;
- //! Output low priority anything (index n starts with 0)
- void ToQueueAnything(int n,const AtomAnything &any) const { ToQueueAnything(n,any.Header(),any.Count(),any.Atoms()); }
-
- //! @} FLEXT_C_IO_QUEUE
-
-
- /*! \defgroup FLEXT_C_IO_SELF Output of data to inlets/outlets of this object
- @{
- */
-
- //! Send bang to self (inlet n)
- void ToSelfBang(int n) const { ToQueueBang(-1-n); }
-
- //! Send float to self (inlet n)
- void ToSelfFloat(int n,float f) const { ToQueueFloat(-1-n,f); }
-
- //! Send integer to self (inlet n)
- void ToSelfInt(int n,int f) const { ToQueueInt(-1-n,f); }
-
- //! Send boolean to self (inlet n)
- void ToSelfBool(int n,bool f) const { ToSelfInt(n,f?1:0); }
-
- //! Send symbol to self (inlet n)
- void ToSelfSymbol(int n,const t_symbol *s) const { ToQueueSymbol(-1-n,s); }
- //! Send string aka symbol to self (inlet 0)
- void ToSelfString(int n,const char *s) const { ToSelfSymbol(n,MakeSymbol(s)); }
-
- //! Output atom (index n starts with 0)
- void ToSelfAtom(int n,const t_atom &at) const { ToQueueAtom(-1-n,at); }
-
- //! Send list to self (inlet n)
- void ToSelfList(int n,int argc,const t_atom *argv) const { ToQueueList(-1-n,argc,argv); }
- //! Send list to self (inlet n)
- void ToSelfList(int n,const AtomList &list) const { ToSelfList(n,list.Count(),list.Atoms()); }
-
- //! Send anything to self (inlet n)
- void ToSelfAnything(int n,const t_symbol *s,int argc,const t_atom *argv) const { ToQueueAnything(-1-n,s,argc,argv); }
- //! Send anything to self (inlet n)
- void ToSelfAnything(int n,const AtomAnything &any) const { ToSelfAnything(n,any.Header(),any.Count(),any.Atoms()); }
-
- //! @} FLEXT_C_IO_SELF
-
-
- /*! \defgroup FLEXT_C_IO_MESSAGEBUNDLE Output of data via message bundles
-
- These are used to assure the sending of several messages from a second thread to the same logical time
-
- @{
- */
-
- //! Output bang (index n starts with 0)
- void MsgAddBang(MsgBundle *mb,int n) const;
-
- //! Output float (index n starts with 0)
- void MsgAddFloat(MsgBundle *mb,int n,float f) const;
-
- //! Output integer (index n starts with 0)
- void MsgAddInt(MsgBundle *mb,int n,int f) const;
-
- //! Output boolean (index n starts with 0)
- void MsgAddBool(MsgBundle *mb,int n,bool f) const { MsgAddInt(mb,n,f?1:0); }
-
- //! Output symbol (index n starts with 0)
- void MsgAddSymbol(MsgBundle *mb,int n,const t_symbol *s) const;
- //! Output string aka symbol (to appointed outlet)
- void MsgAddString(MsgBundle *mb,int n,const char *s) const { MsgAddSymbol(mb,n,MakeSymbol(s)); }
-
- //! Output atom (index n starts with 0)
- void MsgAddAtom(MsgBundle *mb,int n,const t_atom &at) const;
-
- //! Output list (index n starts with 0)
- void MsgAddList(MsgBundle *mb,int n,int argc,const t_atom *argv) const;
- //! Output list (index n starts with 0)
- void MsgAddList(MsgBundle *mb,int n,const AtomList &list) const { MsgAddList(mb,n,list.Count(),list.Atoms()); }
-
- //! Output anything (index n starts with 0)
- void MsgAddAnything(MsgBundle *mb,int n,const t_symbol *s,int argc,const t_atom *argv) const;
- //! Output anything (index n starts with 0)
- void MsgAddAnything(MsgBundle *mb,int n,const AtomAnything &any) const { MsgAddAnything(mb,n,any.Header(),any.Count(),any.Atoms()); }
-
- void MsgSelfBang(MsgBundle *mb,int n) const { MsgAddBang(mb,-1-n); }
-
- //! Send float to self (inlet n)
- void MsgSelfFloat(MsgBundle *mb,int n,float f) const { MsgAddFloat(mb,-1-n,f); }
-
- //! Send integer to self (inlet n)
- void MsgSelfInt(MsgBundle *mb,int n,int f) const { MsgAddInt(mb,-1-n,f); }
-
- //! Send boolean to self (inlet n)
- void MsgSelfBool(MsgBundle *mb,int n,bool f) const { MsgSelfInt(mb,n,f?1:0); }
-
- //! Send symbol to self (inlet n)
- void MsgSelfSymbol(MsgBundle *mb,int n,const t_symbol *s) const { MsgAddSymbol(mb,-1-n,s); }
- //! Send string aka symbol to self (inlet 0)
- void MsgSelfString(MsgBundle *mb,int n,const char *s) const { MsgSelfSymbol(mb,n,MakeSymbol(s)); }
-
- //! Output atom (index n starts with 0)
- void MsgSelfAtom(MsgBundle *mb,int n,const t_atom &at) const { MsgAddAtom(mb,-1-n,at); }
-
- //! Send list to self (inlet n)
- void MsgSelfList(MsgBundle *mb,int n,int argc,const t_atom *argv) const { MsgAddList(mb,-1-n,argc,argv); }
- //! Send list to self (inlet n)
- void MsgSelfList(MsgBundle *mb,int n,const AtomList &list) const { MsgSelfList(mb,n,list.Count(),list.Atoms()); }
-
- //! Send anything to self (inlet n)
- void MsgSelfAnything(MsgBundle *mb,int n,const t_symbol *s,int argc,const t_atom *argv) const { MsgAddAnything(mb,-1-n,s,argc,argv); }
- //! Send anything to self (inlet n)
- void MsgSelfAnything(MsgBundle *mb,int n,const AtomAnything &any) const { MsgSelfAnything(mb,n,any.Header(),any.Count(),any.Atoms()); }
-
- //! @} FLEXT_C_IO_MESSAGEBUNDLE
-
-//! @} FLEXT_C_INOUT
-
-
-// --- message handling -------------------------------------------
-
- enum metharg {
- a_null = 0,
- a_float,a_int,a_bool,
- a_symbol,a_pointer,
- a_list,a_any, // (t_symbol *) / int / t_atom *
- a_LIST,a_ANY // AtomList, AtomAnything
- };
-
- typedef bool (*methfun)(flext_base *c);
-
- /*! \defgroup FLEXT_C_ADDMETHOD Method handling (object scope)
- \internal
- @{
- */
-
- void AddMethodDef(int inlet,const t_symbol *tag = NULL) { ThMeths()->Add(new MethItem,tag,inlet); }
- void AddMethodDef(int inlet,const char *tag = NULL) { AddMethodDef(inlet,MakeSymbol(tag)); }
-
- void AddMethod(int inlet,bool (*m)(flext_base *)) { AddMethod(ThMeths(),inlet,sym_bang,(methfun)m,a_null); }
- void AddMethod(int inlet,bool (*m)(flext_base *,int,t_atom *)) { AddMethod(ThMeths(),inlet,sym_list,(methfun)m,a_list,a_null); }
- void AddMethod(int inlet,bool (*m)(flext_base *,int,const t_atom *)) { AddMethod(ThMeths(),inlet,sym_list,(methfun)m,a_list,a_null); }
- void AddMethod(int inlet,const t_symbol *tag,bool (*m)(flext_base *)) { AddMethod(ThMeths(),inlet,tag,(methfun)m,a_null); } // pure method
- void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *)) { AddMethod(inlet,MakeSymbol(tag),m); }
- void AddMethod(int inlet,bool (*m)(flext_base *,t_symbol *,int,t_atom *)) { AddMethod(ThMeths(),inlet,sym_anything,(methfun)m,a_any,a_null); } // anything
- void AddMethod(int inlet,bool (*m)(flext_base *,const t_symbol *,int,const t_atom *)) { AddMethod(ThMeths(),inlet,sym_anything,(methfun)m,a_any,a_null); } // anything
- void AddMethod(int inlet,bool (*m)(flext_base *,t_symbol *&)) { AddMethod(ThMeths(),inlet,sym_symbol,(methfun)m,a_symbol,a_null); } // single symbol
- void AddMethod(int inlet,bool (*m)(flext_base *,const t_symbol *&)) { AddMethod(ThMeths(),inlet,sym_symbol,(methfun)m,a_symbol,a_null); } // single symbol
- void AddMethod(int inlet,bool (*m)(flext_base *,float &)) { AddMethod(ThMeths(),inlet,sym_float,(methfun)m,a_float,a_null); } // single float
- void AddMethod(int inlet,bool (*m)(flext_base *,float &,float &)) { AddMethod(ThMeths(),inlet,sym_list,(methfun)m,a_float,a_float,a_null); } // list of 2 floats
- void AddMethod(int inlet,bool (*m)(flext_base *,float &,float &,float &)) { AddMethod(ThMeths(),inlet,sym_list,(methfun)m,a_float,a_float,a_float,a_null); } // list of 3 floats
-#if FLEXT_SYS == FLEXT_SYS_PD
- void AddMethod(int inlet,bool (*m)(flext_base *,int &)) { AddMethod(ThMeths(),inlet,sym_float,(methfun)m,a_int,a_null); } // single float
-#else
- void AddMethod(int inlet,bool (*m)(flext_base *,int &)) { AddMethod(ThMeths(),inlet,sym_int,(methfun)m,a_int,a_null); } // single float
-#endif
- void AddMethod(int inlet,bool (*m)(flext_base *,int &,int &)) { AddMethod(ThMeths(),inlet,sym_list,(methfun)m,a_int,a_int,a_null); } // list of 2 floats
- void AddMethod(int inlet,bool (*m)(flext_base *,int &,int &,int &)) { AddMethod(ThMeths(),inlet,sym_list,(methfun)m,a_int,a_int,a_int,a_null); } // list of 3 floats
- void AddMethod(int inlet,const t_symbol *tag,bool (*m)(flext_base *,int,t_atom *)) { AddMethod(ThMeths(),inlet,tag,(methfun)m,a_list,a_null); } // method+gimme
- void AddMethod(int inlet,const t_symbol *tag,bool (*m)(flext_base *,int,const t_atom *)) { AddMethod(ThMeths(),inlet,tag,(methfun)m,a_list,a_null); } // method+gimme
- void AddMethod(int inlet,const t_symbol *tag,bool (*m)(flext_base *,t_symbol *,int,t_atom *)) { AddMethod(ThMeths(),inlet,tag,(methfun)m,a_any,a_null); } // method+gimme
- void AddMethod(int inlet,const t_symbol *tag,bool (*m)(flext_base *,const t_symbol *,int,const t_atom *)) { AddMethod(ThMeths(),inlet,tag,(methfun)m,a_any,a_null); } // method+gimme
- void AddMethod(int inlet,const t_symbol *tag,bool (*m)(flext_base *,t_symbol *&)) { AddMethod(ThMeths(),inlet,tag,(methfun)m,a_symbol,a_null); } // method+symbol
- void AddMethod(int inlet,const t_symbol *tag,bool (*m)(flext_base *,const t_symbol *&)) { AddMethod(ThMeths(),inlet,tag,(methfun)m,a_symbol,a_null); } // method+symbol
- void AddMethod(int inlet,const t_symbol *tag,bool (*m)(flext_base *,float &)) { AddMethod(ThMeths(),inlet,tag,(methfun)m,a_float,a_null); } // method+float
- void AddMethod(int inlet,const t_symbol *tag,bool (*m)(flext_base *,int &)) { AddMethod(ThMeths(),inlet,tag,(methfun)m,a_int,a_null); } // method+int
- void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *,int,t_atom *)) { AddMethod(inlet,MakeSymbol(tag),m); }
- void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *,int,const t_atom *)) { AddMethod(inlet,MakeSymbol(tag),m); }
- void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *,t_symbol *,int,t_atom *)) { AddMethod(inlet,MakeSymbol(tag),m); }
- void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *,const t_symbol *,int,const t_atom *)) { AddMethod(inlet,MakeSymbol(tag),m); }
- void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *,t_symbol *&)) { AddMethod(inlet,MakeSymbol(tag),m); }
- void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *,const t_symbol *&)) { AddMethod(inlet,MakeSymbol(tag),m); }
- void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *,float &)) { AddMethod(inlet,MakeSymbol(tag),m); }
- void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *,int &)) { AddMethod(inlet,MakeSymbol(tag),m); }
-
- //! Set Max/MSP style of distributing list elements over (message) inlets
- static void SetDist(t_classid c,bool d = true);
- //! Query whether lists are distributed
- bool DoDist() const;
-
-
-//! @} FLEXT_C_ADDMETHOD
-
- /*! \defgroup FLEXT_C_CADDMETHOD Method handling (class scope)
- \internal
- @{
- */
-
- static void AddMethod(t_classid c,int inlet,bool (*m)(flext_base *)) { AddMethod(ClMeths(c),inlet,sym_bang,(methfun)m,a_null); }
- static void AddMethod(t_classid c,int inlet,bool (*m)(flext_base *,int,t_atom *)) { AddMethod(ClMeths(c),inlet,sym_list,(methfun)m,a_list,a_null); }
- static void AddMethod(t_classid c,int inlet,bool (*m)(flext_base *,int,const t_atom *)) { AddMethod(ClMeths(c),inlet,sym_list,(methfun)m,a_list,a_null); }
- static void AddMethod(t_classid c,int inlet,const t_symbol *tag,bool (*m)(flext_base *)) { AddMethod(ClMeths(c),inlet,tag,(methfun)m,a_null); } // pure method
- static void AddMethod(t_classid c,int inlet,const char *tag,bool (*m)(flext_base *)) { AddMethod(c,inlet,MakeSymbol(tag),m); }
- static void AddMethod(t_classid c,int inlet,bool (*m)(flext_base *,t_symbol *,int,t_atom *)) { AddMethod(ClMeths(c),inlet,sym_anything,(methfun)m,a_any,a_null); } // anything
- static void AddMethod(t_classid c,int inlet,bool (*m)(flext_base *,const t_symbol *,int,const t_atom *)) { AddMethod(ClMeths(c),inlet,sym_anything,(methfun)m,a_any,a_null); } // anything
- static void AddMethod(t_classid c,int inlet,bool (*m)(flext_base *,t_symbol *&)) { AddMethod(ClMeths(c),inlet,sym_symbol,(methfun)m,a_symbol,a_null); } // single symbol
- static void AddMethod(t_classid c,int inlet,bool (*m)(flext_base *,const t_symbol *&)) { AddMethod(ClMeths(c),inlet,sym_symbol,(methfun)m,a_symbol,a_null); } // single symbol
- static void AddMethod(t_classid c,int inlet,bool (*m)(flext_base *,float &)) { AddMethod(ClMeths(c),inlet,sym_float,(methfun)m,a_float,a_null); } // single float
- static void AddMethod(t_classid c,int inlet,bool (*m)(flext_base *,float &,float &)) { AddMethod(ClMeths(c),inlet,sym_list,(methfun)m,a_float,a_float,a_null); } // list of 2 floats
- static void AddMethod(t_classid c,int inlet,bool (*m)(flext_base *,float &,float &,float &)) { AddMethod(ClMeths(c),inlet,sym_list,(methfun)m,a_float,a_float,a_float,a_null); } // list of 3 floats
-#if FLEXT_SYS == FLEXT_SYS_PD
- static void AddMethod(t_classid c,int inlet,bool (*m)(flext_base *,int &)) { AddMethod(ClMeths(c),inlet,sym_float,(methfun)m,a_int,a_null); } // single integer
-#else
- static void AddMethod(t_classid c,int inlet,bool (*m)(flext_base *,int &)) { AddMethod(ClMeths(c),inlet,sym_int,(methfun)m,a_int,a_null); } // single integer
-#endif
- static void AddMethod(t_classid c,int inlet,bool (*m)(flext_base *,int &,int &)) { AddMethod(ClMeths(c),inlet,sym_list,(methfun)m,a_int,a_int,a_null); } // list of 2 floats
- static void AddMethod(t_classid c,int inlet,bool (*m)(flext_base *,int &,int &,int &)) { AddMethod(ClMeths(c),inlet,sym_list,(methfun)m,a_int,a_int,a_int,a_null); } // list of 3 floats
- static void AddMethod(t_classid c,int inlet,const t_symbol *tag,bool (*m)(flext_base *,int,t_atom *)) { AddMethod(ClMeths(c),inlet,tag,(methfun)m,a_list,a_null); } // method+gimme
- static void AddMethod(t_classid c,int inlet,const t_symbol *tag,bool (*m)(flext_base *,int,const t_atom *)) { AddMethod(ClMeths(c),inlet,tag,(methfun)m,a_list,a_null); } // method+gimme
- static void AddMethod(t_classid c,int inlet,const t_symbol *tag,bool (*m)(flext_base *,t_symbol *,int,t_atom *)) { AddMethod(ClMeths(c),inlet,tag,(methfun)m,a_any,a_null); } // method+gimme
- static void AddMethod(t_classid c,int inlet,const t_symbol *tag,bool (*m)(flext_base *,const t_symbol *,int,const t_atom *)) { AddMethod(ClMeths(c),inlet,tag,(methfun)m,a_any,a_null); } // method+gimme
- static void AddMethod(t_classid c,int inlet,const t_symbol *tag,bool (*m)(flext_base *,t_symbol *&)) { AddMethod(ClMeths(c),inlet,tag,(methfun)m,a_symbol,a_null); } // method+symbol
- static void AddMethod(t_classid c,int inlet,const t_symbol *tag,bool (*m)(flext_base *,const t_symbol *&)) { AddMethod(ClMeths(c),inlet,tag,(methfun)m,a_symbol,a_null); } // method+symbol
- static void AddMethod(t_classid c,int inlet,const t_symbol *tag,bool (*m)(flext_base *,float &)) { AddMethod(ClMeths(c),inlet,tag,(methfun)m,a_float,a_null); } // method+float
- static void AddMethod(t_classid c,int inlet,const t_symbol *tag,bool (*m)(flext_base *,int &)) { AddMethod(ClMeths(c),inlet,tag,(methfun)m,a_int,a_null); } // method+int
- static void AddMethod(t_classid c,int inlet,const char *tag,bool (*m)(flext_base *,int,t_atom *)) { AddMethod(c,inlet,MakeSymbol(tag),m); }
- static void AddMethod(t_classid c,int inlet,const char *tag,bool (*m)(flext_base *,int,const t_atom *)) { AddMethod(c,inlet,MakeSymbol(tag),m); }
- static void AddMethod(t_classid c,int inlet,const char *tag,bool (*m)(flext_base *,t_symbol *,int,t_atom *)) { AddMethod(c,inlet,MakeSymbol(tag),m); }
- static void AddMethod(t_classid c,int inlet,const char *tag,bool (*m)(flext_base *,const t_symbol *,int,const t_atom *)) { AddMethod(c,inlet,MakeSymbol(tag),m); }
- static void AddMethod(t_classid c,int inlet,const char *tag,bool (*m)(flext_base *,t_symbol *&)) { AddMethod(c,inlet,MakeSymbol(tag),m); }
- static void AddMethod(t_classid c,int inlet,const char *tag,bool (*m)(flext_base *,const t_symbol *&)) { AddMethod(c,inlet,MakeSymbol(tag),m); }
- static void AddMethod(t_classid c,int inlet,const char *tag,bool (*m)(flext_base *,float &)) { AddMethod(c,inlet,MakeSymbol(tag),m); }
- static void AddMethod(t_classid c,int inlet,const char *tag,bool (*m)(flext_base *,int &)) { AddMethod(c,inlet,MakeSymbol(tag),m); }
-
-//! @} FLEXT_C_CADDMETHOD
-
-// --- bind/unbind ---------------------------------------
-
- /*! \defgroup FLEXT_C_BIND Methods for binding a flext class to a symbol
-
- @{
- */
-
- //! Bind object to a symbol
- bool Bind(const t_symbol *sym);
- //! Unbind object from a symbol
- bool Unbind(const t_symbol *sym);
-
- //! Bind object to a symbol (as string)
- bool Bind(const char *sym) { return Bind(MakeSymbol(sym)); }
- //! Unbind object from a symbol (as string)
- bool Unbind(const char *sym) { return Unbind(MakeSymbol(sym)); }
-
- /*! \brief Bind a method to a symbol
- \param sym Symbol to bind to
- \param meth Function to bind
- \param data User data that is passed to the function
- \return true on success
- */
- bool BindMethod(const t_symbol *sym,bool (*meth)(flext_base *obj,t_symbol *sym,int argc,t_atom *argv,void *data),void *data = NULL);
- /*! \brief Unbind a method from a symbol
- \param sym Symbol to unbind from (if NULL... unbind all functions)
- \param meth Method to unbind (if NULL ... unbind all functions bound to symbol)
- \param data returns data pointer specified with BindMethod
- \return true on success
- */
- bool UnbindMethod(const t_symbol *sym,bool (*meth)(flext_base *obj,t_symbol *sym,int argc,t_atom *argv,void *data) = NULL,void **data = NULL);
- /*! \brief Get data of bound method of a symbol
- \param sym Symbol to bind to
- \param meth Function to bind
- \param data Reference to returned user data
- \return true on success (symbol/method combination was found)
- */
- bool GetBoundMethod(const t_symbol *sym,bool (*meth)(flext_base *obj,t_symbol *sym,int argc,t_atom *argv,void *data),void *&data);
-
- //! \brief Bind a method to a symbol (as string)
- bool BindMethod(const char *sym,bool (*meth)(flext_base *obj,t_symbol *sym,int argc,t_atom *argv,void *data),void *data = NULL) { return BindMethod(MakeSymbol(sym),meth,data); }
- //! \brief Unbind a method from a symbol (as string)
- bool UnbindMethod(const char *sym,bool (*meth)(flext_base *obj,t_symbol *sym,int argc,t_atom *argv,void *data) = NULL,void **data = NULL) { return UnbindMethod(MakeSymbol(sym),meth,data); }
- //! \brief Get data of bound method of a symbol (as string)
- bool GetBoundMethod(const char *sym,bool (*meth)(flext_base *obj,t_symbol *sym,int argc,t_atom *argv,void *data),void *&data) { return GetBoundMethod(MakeSymbol(sym),meth,data); }
-
- /*! Unbind all symbol bindings
- \note Memory associated to data pointers passed by BindMethod will not be freed!
- */
- bool UnbindAll();
-
-//! @} FLEXT_C_BIND
-
- // --- thread stuff -----------------------------------------------
-
-#ifdef FLEXT_THREADS
- /*! \defgroup FLEXT_C_THREAD Thread handling
-
- @{
- */
-
- //! Start a thread for this object
- bool StartThread(void (*meth)(thr_params *p),thr_params *p,const char * = NULL) { p->cl = this; return flext::LaunchThread(meth,p); }
-
- //! Terminate all threads of this object
- bool StopThreads();
-#endif // FLEXT_THREADS
-
-//! @} FLEXT_C_THREAD
-
-// xxx internal stuff xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-
-public: // needed by VC++ 6
-
- enum xlettype {
- xlet_none = 0,
- xlet_float,xlet_int,xlet_sym,xlet_list,xlet_any,
- xlet_LIST,xlet_ANY, // use AtomList and AtomAnything
- xlet_sig
- };
-
-protected:
-
- FLEXT_CLASSDEF(flext_base)();
-
- /*! \brief Set up inlets and outlets, method and attribute lists
- */
- virtual bool Init();
-
- /*! \brief Deallocate all kinds of stuff
- */
- virtual void Exit();
-
-
- /*! \defgroup FLEXT_C_ATTR Attribute handling methods (object scope)
- @{
- */
-
- void AddAttrib(const t_symbol *attr,bool (*get)(flext_base *,float &),bool (*set)(flext_base *,float &)) { AddAttrib(attr,a_float,(methfun)get,(methfun)set); }
- void AddAttrib(const t_symbol *attr,bool (*get)(flext_base *,int &),bool (*set)(flext_base *,int &)) { AddAttrib(attr,a_int,(methfun)get,(methfun)set); }
- void AddAttrib(const t_symbol *attr,bool (*get)(flext_base *,bool &),bool (*set)(flext_base *,bool &)) { AddAttrib(attr,a_bool,(methfun)get,(methfun)set); }
- void AddAttrib(const t_symbol *attr,bool (*get)(flext_base *,const t_symbol *&),bool (*set)(flext_base *,const t_symbol *&)) { AddAttrib(attr,a_symbol,(methfun)get,(methfun)set); }
- void AddAttrib(const t_symbol *attr,bool (*get)(flext_base *,t_symptr &),bool (*set)(flext_base *,t_symptr &)) { AddAttrib(attr,a_symbol,(methfun)get,(methfun)set); }
- void AddAttrib(const t_symbol *attr,bool (*get)(flext_base *,AtomList *&),bool (*set)(flext_base *,AtomList *&)) { AddAttrib(attr,a_LIST,(methfun)get,(methfun)set); }
- void AddAttrib(const t_symbol *attr,bool (*get)(flext_base *,AtomAnything *&),bool (*set)(flext_base *,AtomAnything *&)) { AddAttrib(attr,a_ANY,(methfun)get,(methfun)set); }
- void AddAttrib(const char *attr,bool (*get)(flext_base *,float &),bool (*set)(flext_base *,float &)) { AddAttrib(MakeSymbol(attr),get,set); }
- void AddAttrib(const char *attr,bool (*get)(flext_base *,int &),bool (*set)(flext_base *,int &)) { AddAttrib(MakeSymbol(attr),get,set); }
- void AddAttrib(const char *attr,bool (*get)(flext_base *,bool &),bool (*set)(flext_base *,bool &)) { AddAttrib(MakeSymbol(attr),get,set); }
- void AddAttrib(const char *attr,bool (*get)(flext_base *,const t_symbol *&),bool (*set)(flext_base *,const t_symbol *&)) { AddAttrib(MakeSymbol(attr),get,set); }
- void AddAttrib(const char *attr,bool (*get)(flext_base *,t_symptr &),bool (*set)(flext_base *,t_symptr &)) { AddAttrib(MakeSymbol(attr),get,set); }
- void AddAttrib(const char *attr,bool (*get)(flext_base *,AtomList *&),bool (*set)(flext_base *,AtomList *&)) { AddAttrib(MakeSymbol(attr),get,set); }
- void AddAttrib(const char *attr,bool (*get)(flext_base *,AtomAnything *&),bool (*set)(flext_base *,AtomAnything *&)) { AddAttrib(MakeSymbol(attr),get,set); }
-
-//! @} FLEXT_C_ATTR
-
- /*! \defgroup FLEXT_C_CATTR Attribute handling methods (class scope)
- @{
- */
-
- static void AddAttrib(t_classid c,const t_symbol *attr,bool (*get)(flext_base *,float &),bool (*set)(flext_base *,float &)) { AddAttrib(c,attr,a_float,(methfun)get,(methfun)set); }
- static void AddAttrib(t_classid c,const t_symbol *attr,bool (*get)(flext_base *,int &),bool (*set)(flext_base *,int &)) { AddAttrib(c,attr,a_int,(methfun)get,(methfun)set); }
- static void AddAttrib(t_classid c,const t_symbol *attr,bool (*get)(flext_base *,bool &),bool (*set)(flext_base *,bool &)) { AddAttrib(c,attr,a_bool,(methfun)get,(methfun)set); }
- static void AddAttrib(t_classid c,const t_symbol *attr,bool (*get)(flext_base *,const t_symbol *&),bool (*set)(flext_base *,const t_symbol *&)) { AddAttrib(c,attr,a_symbol,(methfun)get,(methfun)set); }
- static void AddAttrib(t_classid c,const t_symbol *attr,bool (*get)(flext_base *,t_symptr &),bool (*set)(flext_base *,t_symptr &)) { AddAttrib(c,attr,a_symbol,(methfun)get,(methfun)set); }
- static void AddAttrib(t_classid c,const t_symbol *attr,bool (*get)(flext_base *,AtomList *&),bool (*set)(flext_base *,AtomList *&)) { AddAttrib(c,attr,a_LIST,(methfun)get,(methfun)set); }
- static void AddAttrib(t_classid c,const t_symbol *attr,bool (*get)(flext_base *,AtomAnything *&),bool (*set)(flext_base *,AtomAnything *&)) { AddAttrib(c,attr,a_ANY,(methfun)get,(methfun)set); }
- static void AddAttrib(t_classid c,const char *attr,bool (*get)(flext_base *,float &),bool (*set)(flext_base *,float &)) { AddAttrib(c,MakeSymbol(attr),get,set); }
- static void AddAttrib(t_classid c,const char *attr,bool (*get)(flext_base *,int &),bool (*set)(flext_base *,int &)) { AddAttrib(c,MakeSymbol(attr),get,set); }
- static void AddAttrib(t_classid c,const char *attr,bool (*get)(flext_base *,bool &),bool (*set)(flext_base *,bool &)) { AddAttrib(c,MakeSymbol(attr),get,set); }
- static void AddAttrib(t_classid c,const char *attr,bool (*get)(flext_base *,const t_symbol *&),bool (*set)(flext_base *,const t_symbol *&)) { AddAttrib(c,MakeSymbol(attr),get,set); }
- static void AddAttrib(t_classid c,const char *attr,bool (*get)(flext_base *,t_symptr &),bool (*set)(flext_base *,t_symptr &)) { AddAttrib(c,MakeSymbol(attr),get,set); }
- static void AddAttrib(t_classid c,const char *attr,bool (*get)(flext_base *,AtomList *&),bool (*set)(flext_base *,AtomList *&)) { AddAttrib(c,MakeSymbol(attr),get,set); }
- static void AddAttrib(t_classid c,const char *attr,bool (*get)(flext_base *,AtomAnything *&),bool (*set)(flext_base *,AtomAnything *&)) { AddAttrib(c,MakeSymbol(attr),get,set); }
-
-//! @} FLEXT_C_CATTR
-
- //! Dump an attribute to the attribute outlet
- bool DumpAttrib(const t_symbol *attr) const;
- //! Dump an attribute to the attribute outlet
- bool DumpAttrib(const char *attr) const { return DumpAttrib(MakeSymbol(attr)); }
-
- // check for attribute symbol @
- static int CheckAttrib(int argc,const t_atom *argv);
- // check for attribute symbol @
- static int CheckAttrib(const AtomList &args,int offset = 0) { return CheckAttrib(args.Count()-offset,args.Atoms()+offset)+offset; }
-
- //! List attributes
- bool ListAttrib() const;
- //! List attributes
- void ListAttrib(AtomList &a) const;
- //! Get an attribute value
- bool GetAttrib(const t_symbol *s,AtomList &a) const;
- //! Set an attribute value
- bool SetAttrib(const t_symbol *s,int argc,const t_atom *argv);
- //! Set an attribute value
- bool SetAttrib(const t_symbol *s,const AtomList &a) { return SetAttrib(s,a.Count(),a.Atoms()); }
-
- // get and set the attribute
- bool BangAttrib(const t_symbol *a);
- // get and set the attribute
- bool BangAttrib(const char *a) { return BangAttrib(MakeSymbol(a)); }
- // get and set all (both get- and settables)
- bool BangAttribAll();
- // show/hide the attribute
- bool ShowAttrib(const t_symbol *a,bool show) const;
- // show/hide the attribute
- bool ShowAttrib(const char *a,bool show) { return ShowAttrib(MakeSymbol(a),show); }
-
- //! List methods
- void ListMethods(AtomList &a,int inlet = 0) const;
-
-/*! \addtogroup FLEXT_C_INOUT
- @{
-*/
-
- //! \brief get a code for a list of inlets or outlets
- unsigned long XletCode(xlettype tp = xlet_none,...); // end list with 0 (= tp_none) !!
-
- /*! \brief Add some inlets by a special code representing the types
- \remark use XletCode function to get code value
- */
- void AddInlets(unsigned long code);
-
- //! \brief Add one or more inlet(s)
- void AddInlet(xlettype tp,int mult = 1,const char *desc = NULL);
-
- /*! \brief Add some inlets by a special code representing the types
- \remark use XletCode function to get code value
- */
- void AddOutlets(unsigned long code);
-
- //! \brief Add one or more outlet(s)
- void AddOutlet(xlettype tp,int mult = 1,const char *desc = NULL);
-
- //! \brief Set the description of an indexed inlet
- void DescInlet(int ix,const char *desc);
-
- //! \brief Set the description of an indexed outlet
- void DescOutlet(int ix,const char *desc);
-
-//! @} FLEXT_C_INOUT
-
-
-// method handling
-
- public:
-
- class AttrItem;
-
- class Item
- {
- public:
- Item(AttrItem *a): attr(a),nxt(NULL) {}
- virtual ~Item();
-
- bool IsAttr() const { return attr != NULL; }
-
- AttrItem *attr;
- Item *nxt;
- };
-
- class ItemSet
- :public TablePtrMap<const t_symbol *,Item *,8>
- {
- public:
- virtual ~ItemSet();
- virtual void clear();
- };
-
- /*! This class holds hashed item entries
- \note not thread-safe!
- */
- class FLEXT_SHARE ItemCont
- {
- public:
- ItemCont();
- ~ItemCont();
-
- int Min() const { return -1; }
- int Max() const { return size-2; }
-
- bool Contained(int i) const { return i+1 < size; }
-
- //! Add an entry
- void Add(Item *it,const t_symbol *tag,int inlet = 0);
- //! Remove an entry
- bool Remove(Item *it,const t_symbol *tag,int inlet,bool free);
- //! Find an entry list in the Item array
- Item *FindList(const t_symbol *tag,int inlet = 0);
-
- //! Get list for an inlet
- ItemSet &GetInlet(int inlet = 0)
- {
- FLEXT_ASSERT(inlet >= Min() && inlet <= Max());
- return *cont[inlet+1];
- }
-
- //! Get counter for total members (for index of new item)
- int Members() const { return members; }
-
- protected:
-
- void Resize(int nsz);
-
- int members;
- int memsize,size;
- ItemSet **cont;
- };
-
- //! \brief This represents an item of the method list
- class MethItem:
- public Item
- {
- public:
- MethItem(AttrItem *conn = NULL);
- virtual ~MethItem();
-
- void SetArgs(methfun fun,int argc,metharg *args);
-
- int index;
- int argc;
- metharg *args;
- methfun fun;
- };
-
- //! \brief This represents an item of the attribute list
- class AttrItem:
- public Item
- {
- public:
- AttrItem(const t_symbol *tag,metharg tp,methfun fun,int flags);
-
- enum {
- afl_get = 0x01, afl_set = 0x02,
- afl_getset = afl_get|afl_set,
- afl_shown = 0x08
- };
-
- bool IsGet() const { return (flags&afl_getset) == afl_get; }
- bool IsSet() const { return (flags&afl_getset) == afl_set; }
- bool IsShown() const { return (flags&afl_shown) != 0; }
- bool BothExist() const { return counter != NULL; }
- AttrItem *Counterpart() { return counter; }
-
- int index;
- int flags;
- metharg argtp;
- methfun fun;
- AttrItem *counter;
- const t_symbol *tag;
- };
-
- //! Represent a data value of an attribute
- class AttrData:
- public flext_root
- {
- public:
- AttrData(): flags(0) {}
-
- enum { afl_save = 0x01,afl_init = 0x02,afl_inited = 0x04 };
-
- void SetSave(bool s) { if(s) flags |= afl_save; else flags &= ~afl_save; }
- bool IsSaved() const { return (flags&afl_save) != 0; }
- void SetInit(bool s) { if(s) flags |= afl_init; else flags &= ~afl_init; }
- bool IsInit() const { return (flags&afl_init) != 0; }
- void SetInitValue(int argc,const t_atom *argv) { init(argc,argv); flags |= afl_inited; }
- void SetInitValue(const AtomList &l) { SetInitValue(l.Count(),l.Atoms()); }
- bool IsInitValue() const { return (flags&afl_inited) != 0; }
- const AtomList &GetInitValue() const { return init; }
-
- AtomList init;
- int flags;
- };
-
- class AttrDataCont
- :public TablePtrMap<const t_symbol *,AttrData *,8>
- {
- public:
- virtual ~AttrDataCont();
- virtual void clear();
- };
-
- // these outlet functions don't check for thread but send directly to the real-time system
- void ToSysBang(int n) const { outlet *o = GetOut(n); if(o) { CRITON(); outlet_bang((t_outlet *)o); CRITOFF(); } }
- void ToSysFloat(int n,float f) const { outlet *o = GetOut(n); if(o) { CRITON(); outlet_float((t_outlet *)o,f); CRITOFF(); } }
- void ToSysInt(int n,int f) const { outlet *o = GetOut(n); if(o) { CRITON(); outlet_flint((t_outlet *)o,f); CRITOFF(); } }
- void ToSysSymbol(int n,const t_symbol *s) const { outlet *o = GetOut(n); if(o) { CRITON(); outlet_symbol((t_outlet *)o,const_cast<t_symbol *>(s)); CRITOFF(); } }
- void ToSysString(int n,const char *s) const { ToSysSymbol(n,MakeSymbol(s)); }
- void ToSysList(int n,int argc,const t_atom *argv) const { outlet *o = GetOut(n); if(o) { CRITON(); outlet_list((t_outlet *)o,const_cast<t_symbol *>(sym_list),argc,(t_atom *)argv); CRITOFF(); } }
- void ToSysList(int n,const AtomList &list) const { ToSysList(n,list.Count(),list.Atoms()); }
- void ToSysAnything(int n,const t_symbol *s,int argc,const t_atom *argv) const { outlet *o = GetOut(n); if(o) { CRITON(); outlet_anything((t_outlet *)o,const_cast<t_symbol *>(s),argc,(t_atom *)argv); CRITOFF(); } }
- void ToSysAnything(int n,const AtomAnything &any) const { ToSysAnything(n,any.Header(),any.Count(),any.Atoms()); }
- void ToSysAnything(int n,const t_symbol *s,const AtomList &list) const { ToSysAnything(n,s,list.Count(),list.Atoms()); }
-
- void ToSysBool(int n,bool f) const { ToSysInt(n,f?1:0); }
- void ToSysAtom(int n,const t_atom &at) const;
-
- static void ToSysMsg(MsgBundle *mb);
-
- // add class method handlers
- static void AddMessageMethods(t_class *c,bool dsp,bool dspin);
-
-private:
- class pxbnd_object;
-public:
-
- //! \brief This represents an item of the symbol-bound method list
- class BindItem:
- public Item
- {
- public:
- BindItem(bool (*f)(flext_base *,t_symbol *s,int,t_atom *,void *),pxbnd_object *px);
- virtual ~BindItem();
-
- void Unbind(const t_symbol *s);
-
- bool (*fun)(flext_base *,t_symbol *s,int,t_atom *,void *);
- pxbnd_object *px;
- };
-
- ItemCont *ThMeths() { if(!methhead) methhead = new ItemCont; return methhead; }
- static ItemCont *ClMeths(t_classid c);
-
- //! \brief This is the central function to add message handlers. It is used by all other AddMethod incarnations.
- static void AddMethod(ItemCont *ma,int inlet,const t_symbol *tag,methfun fun,metharg tp,...);
-
- ItemCont *ThAttrs() { return attrhead; }
- static ItemCont *ClAttrs(t_classid c);
-
- static void AddAttrib(ItemCont *aa,ItemCont *ma,const t_symbol *attr,metharg tp,methfun gfun,methfun sfun);
- void AddAttrib(const t_symbol *attr,metharg tp,methfun gfun,methfun sfun);
- static void AddAttrib(t_classid c,const t_symbol *attr,metharg tp,methfun gfun,methfun sfun);
-
-private:
-
- static inline flext_base *thisObject(flext_hdr *c) { return FLEXT_CAST<flext_base *>(c->data); }
-
- static void Setup(t_classid c);
-
- //! \brief This represents either an inlet or outlet during construction
- class FLEXT_SHARE xlet {
- public:
- xlet();
- ~xlet();
-
- xlettype tp;
- char *desc;
-
- void Desc(const char *c);
- };
-
- static xlet inlist[];
- static xlet outlist[];
-
- //! current message tag
- static const t_symbol *curtag;
- //! number of message and signal inlets/outlets
- unsigned char incnt,outcnt,insigs,outsigs;
-
- outlet **outlets;
-
- union t_any {
- float ft;
- int it;
- bool bt;
- t_symbol *st;
-#if FLEXT_SYS == FLEXT_SYS_PD
- t_gpointer *pt;
-#endif
- void *vt;
- };
-
- typedef bool (*methfun_V)(flext_base *c,int argc,t_atom *argv);
- typedef bool (*methfun_A)(flext_base *c,const t_symbol *s,int argc,t_atom *argv);
- typedef bool (*methfun_0)(flext_base *c);
- typedef bool (*methfun_1)(flext_base *c,t_any &);
- typedef bool (*methfun_2)(flext_base *c,t_any &,t_any &);
- typedef bool (*methfun_3)(flext_base *c,t_any &,t_any &,t_any &);
- typedef bool (*methfun_4)(flext_base *c,t_any &,t_any &,t_any &,t_any &);
- typedef bool (*methfun_5)(flext_base *c,t_any &,t_any &,t_any &,t_any &,t_any &);
-
- mutable ItemCont *methhead;
- mutable ItemCont *bindhead;
-
- bool FindMeth(int inlet,const t_symbol *s,int argc,const t_atom *argv);
- bool FindMethAny(int inlet,const t_symbol *s,int argc,const t_atom *argv);
- bool TryMethTag(Item *lst,const t_symbol *tag,int argc,const t_atom *argv);
- bool TryMethSym(Item *lst,const t_symbol *s);
- bool TryMethAny(Item *lst,const t_symbol *s,int argc,const t_atom *argv);
-
- mutable ItemCont *attrhead;
- mutable AttrDataCont *attrdata;
-
- AttrItem *FindAttrib(const t_symbol *tag,bool get,bool msg = false) const;
-
- bool InitAttrib(int argc,const t_atom *argv);
-
- bool DumpAttrib(const t_symbol *tag,AttrItem *a) const;
- bool GetAttrib(const t_symbol *tag,AttrItem *a,AtomList &l) const;
- bool SetAttrib(const t_symbol *tag,AttrItem *a,int argc,const t_atom *argv);
- bool SetAttrib(const t_symbol *tag,AttrItem *a,const AtomList &l) { return SetAttrib(tag,a,l.Count(),l.Atoms()); }
- // get and set the attribute
- bool BangAttrib(const t_symbol *tag,AttrItem *a);
- // show/hide the attribute
- bool ShowAttrib(AttrItem *a,bool show) const;
-
- static bool cb_ListMethods(flext_base *c,int argc,const t_atom *argv);
- static bool cb_ListAttrib(flext_base *c) { return c->ListAttrib(); }
-
- // queue stuff
-
- //! Start message queue
- static void StartQueue();
-#if FLEXT_QMODE == 2
- //! Queue worker function
- static void QWorker(thr_params *);
-#endif
- //! Flush messages in the queue
- static void QFlush(flext_base *th = NULL);
-
-#if FLEXT_SYS == FLEXT_SYS_PD
-
- static void SetGfx(t_classid c);
-
-#ifndef FLEXT_NOATTREDIT
- // attribute editor
- static bool cb_AttrDialog(flext_base *c,int argc,const t_atom *argv);
- static void cb_GfxProperties(flext_hdr *c, t_glist *);
-#endif
-
-#ifdef FLEXT_ATTRHIDE
- static void cb_GfxVis(flext_hdr *c, t_glist *gl, int vis);
- static void cb_GfxSave(flext_hdr *c, t_binbuf *b);
- static void cb_GfxSelect(flext_hdr *x, struct _glist *glist, int state);
-
- void BinbufArgs(t_binbuf *b,t_binbuf *args,bool withname,bool transdoll);
- void BinbufAttr(t_binbuf *b,bool transdoll);
-#endif
-
- static void cb_bang(flext_hdr *c);
- static void cb_float(flext_hdr *c,t_float f);
- static void cb_symbol(flext_hdr *c,const t_symbol *s);
-// static void cb_pointer(fltext_hdr *c,const t_gpointer *p);
- static void cb_anything(flext_hdr *c,const t_symbol *s,int argc,t_atom *argv);
-
- // proxy object (for additional inlets)
- static t_class *px_class;
-
- struct px_object // no virtual table!
- {
- t_object obj; // MUST reside at memory offset 0
- flext_base *base;
- int index;
-
- void init(flext_base *b,int ix) { base = b; index = ix; }
- static void px_bang(px_object *c);
- static void px_float(px_object *c,t_float f);
- static void px_symbol(px_object *c,const t_symbol *s);
-// static void px_pointer(px_object *c,const t_gpointer *p);
- static void px_anything(px_object *c,const t_symbol *s,int argc,t_atom *argv);
- };
-
- static void cb_px_ft1(flext_hdr *c,t_float f);
- static void cb_px_ft2(flext_hdr *c,t_float f);
- static void cb_px_ft3(flext_hdr *c,t_float f);
- static void cb_px_ft4(flext_hdr *c,t_float f);
- static void cb_px_ft5(flext_hdr *c,t_float f);
- static void cb_px_ft6(flext_hdr *c,t_float f);
- static void cb_px_ft7(flext_hdr *c,t_float f);
- static void cb_px_ft8(flext_hdr *c,t_float f);
- static void cb_px_ft9(flext_hdr *c,t_float f);
-
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- typedef object px_object;
- static void cb_bang(flext_hdr *c);
- static void cb_float(flext_hdr *c,double f);
- static void cb_int(flext_hdr *c,long v);
- static void cb_anything(flext_hdr *c,const t_symbol *s,short argc,t_atom *argv);
-
- static void cb_px_in1(flext_hdr *c,long v);
- static void cb_px_in2(flext_hdr *c,long v);
- static void cb_px_in3(flext_hdr *c,long v);
- static void cb_px_in4(flext_hdr *c,long v);
- static void cb_px_in5(flext_hdr *c,long v);
- static void cb_px_in6(flext_hdr *c,long v);
- static void cb_px_in7(flext_hdr *c,long v);
- static void cb_px_in8(flext_hdr *c,long v);
- static void cb_px_in9(flext_hdr *c,long v);
-
- static void cb_px_ft1(flext_hdr *c,double f);
- static void cb_px_ft2(flext_hdr *c,double f);
- static void cb_px_ft3(flext_hdr *c,double f);
- static void cb_px_ft4(flext_hdr *c,double f);
- static void cb_px_ft5(flext_hdr *c,double f);
- static void cb_px_ft6(flext_hdr *c,double f);
- static void cb_px_ft7(flext_hdr *c,double f);
- static void cb_px_ft8(flext_hdr *c,double f);
- static void cb_px_ft9(flext_hdr *c,double f);
-#endif
-
- px_object **inlets;
-
- // --------- symbol-bound proxy
-
- static t_class *pxbnd_class;
-
- class pxbnd_object:
- public flext_root
- // no virtual table!
- {
- public:
- t_object obj; // MUST reside at memory offset 0
- flext_base *base;
- BindItem *item;
- void *data;
-
- void init(flext_base *b,BindItem *it,void *d) { base = b; item = it; data = d; }
- static void px_method(pxbnd_object *c,const t_symbol *s,int argc,t_atom *argv);
- };
-
- //! create proxy class for symbol binding
- static void SetupBindProxy();
-
- // ---------
-
- //! set up inlet proxies
- static void SetProxies(t_class *c,bool dsp);
-
- //! initialize inlets (according to class or object constructor definitions)
- bool InitInlets();
-
- //! initialize outlets (according to class or object constructor definitions)
- bool InitOutlets();
-
- // callback functions
-
- static void cb_loadbang(flext_hdr *c);
-
-#if FLEXT_SYS == FLEXT_SYS_MAX
- char **indesc,**outdesc;
-
- static void cb_assist(flext_hdr *c,void *b,long msg,long arg,char *s);
- static void cb_click (flext_hdr *c, Point pt, short mods);
-
- static void cb_dsp(flext_hdr *c,t_signal **s,short *count);
-#elif FLEXT_SYS == FLEXT_SYS_PD
- static void cb_click(flext_hdr *z,t_floatarg xpos,t_floatarg ypos,t_floatarg shift,t_floatarg ctrl,t_floatarg alt);
-
- static void cb_dsp(flext_hdr *c,t_signal **s);
-#endif
-};
-
-#endif
diff --git a/externals/grill/flext/source/flcontainers.h b/externals/grill/flext/source/flcontainers.h
deleted file mode 100644
index 2b33c4e5..00000000
--- a/externals/grill/flext/source/flcontainers.h
+++ /dev/null
@@ -1,473 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2006 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file flcontainers.h
- \brief Lock-free container classes
-
- This code has been adapted from the MidiShare project (c)Grame
- http://midishare.sourceforge.net
-*/
-
-#ifndef __FLCONTAINERS_H
-#define __FLCONTAINERS_H
-
-
-#include "flprefix.h"
-
-
-// define that precautiously...
-// it's faster without that but we can't really know...
-#define __SMP__
-
-
-class FLEXT_SHARE Lifo
-{
-public:
- class Cell
- {
- friend class Lifo;
- friend class Fifo;
- private:
- Cell *link;
- };
-
- inline Lifo() { Init(); }
-
- inline void Init() { ic = oc = 0; top = NULL; }
-
- inline Cell *Avail() { return (Cell *)top; }
-
-#if defined(_MSC_VER) && FLEXT_CPU == FLEXT_CPU_IA32
- #ifdef __SMP__
- #define LOCK lock
- #else
- #define LOCK
- #endif
-
- inline void Push(Cell *cell)
- {
- __asm
- {
- push eax
- push ebx
- push ecx
- push edx
- push esi
- mov esi, this
- mov eax, dword ptr [esi]
- mov ecx, cell
- mov edx, dword ptr [esi+4]
- _loop:
- mov ebx, eax
- inc ebx
- mov [ecx], edx
- LOCK cmpxchg8b qword ptr [esi]
- jnz _loop
- pop esi
- pop edx
- pop ecx
- pop ebx
- pop eax
- }
- }
-
- inline Cell *Pop()
- {
- __asm
- {
- push ebx
- push ecx
- push edx
- push esi
- mov esi, this
- add esi, 4 /* point to top */
- mov edx, dword ptr [esi+4]
- mov eax, dword ptr [esi]
- test eax, eax
- jz _end
- _loop:
- mov ebx, dword ptr [eax]
- mov ecx, edx
- inc ecx
- LOCK cmpxchg8b qword ptr [esi]
- jz _end
- test eax, eax
- jnz _loop
- _end:
- pop esi
- pop edx
- pop ecx
- pop ebx
- }
- }
-
- inline size_t Size() const { return ic-oc; }
-#elif defined(__GNUC__) && FLEXT_CPU == FLEXT_CPU_IA32
- #ifndef SMPLOCK
- # ifdef __SMP__
- # define SMPLOCK "lock ; "
- # else
- # define SMPLOCK ""
- # endif
- #endif
-
- inline void Push(Cell *cl)
- {
- __asm__ __volatile__ (
- "# LFPUSH \n\t"
- "pushl %%ebx \n\t"
- "pushl %%ecx \n\t"
- "movl 0(%%esi), %%eax \n\t"
- "movl 4(%%esi), %%edx \n"
- "1: \t"
- "movl %%eax, %%ebx \n\t"
- "incl %%ebx \n\t"
- "movl %%edx, (%%ecx) \n\t"
- SMPLOCK "cmpxchg8b (%%esi) \n\t"
- "jnz 1b \n\t"
- "popl %%ecx \n\t"
- "popl %%ebx \n\t"
- :/* no output */
- :"S" (this), "c" (cl)
- :"memory", "eax", "edx");
- }
-
- inline Cell *Pop()
- {
- Cell *v=0;
- __asm__ __volatile__ (
- "# LFPOP \n\t"
- "pushl %%ebx \n\t"
- "pushl %%ecx \n\t"
- "movl 4(%%esi), %%edx \n\t"
- "movl (%%esi), %%eax \n\t"
- "testl %%eax, %%eax \n\t"
- "jz 2f \n"
- "1: \t"
- "movl (%%eax), %%ebx \n\t"
- "movl %%edx, %%ecx \n\t"
- "incl %%ecx \n\t"
- SMPLOCK "cmpxchg8b (%%esi) \n\t"
- "jz 2f \n\t"
- "testl %%eax, %%eax \n\t"
- "jnz 1b \n"
- "2: \t"
- "popl %%ecx \n\t"
- "popl %%ebx \n\t"
- :"=a" (v)
- :"S" (&this->top)
- :"memory", "edx");
- return v;
- }
-
- inline size_t Size() const
- {
- size_t n;
- __asm__ __volatile__ (
- "# LFSIZE \n\t"
- "movl 8(%%esi), %%edx \n\t"
- "movl (%%esi), %%eax \n\t"
- "subl %%edx, %%eax \n\t"
- :"=a" (n)
- :"S" (this)
- :"memory", "edx");
- return n;
- }
-#elif 0 //defined(__GNUC__) && FLEXT_CPU == FLEXT_CPU_X86_64
-/* attention - this only works for EMT64 or newer revisions of AMD 64-bit cpus */
- #ifndef SMPLOCK
- # ifdef __SMP__
- # define SMPLOCK "lock ; "
- # else
- # define SMPLOCK ""
- # endif
- #endif
-
- inline void Push(Cell *cl)
- {
- __asm__ __volatile__ (
- "# LFPUSH \n\t"
- "push %%rbx \n\t"
- "push %%rcx \n\t"
- "mov 0(%%rsi), %%rax \n\t"
- "mov 8(%%rsi), %%rdx \n"
- "1: \t"
- "mov %%rax, %%rbx \n\t"
- "inc %%rbx \n\t"
- "mov %%rdx, (%%rcx) \n\t"
- SMPLOCK "cmpxchg16b (%%rsi) \n\t"
- "jnz 1b \n\t"
- "pop %%rcx \n\t"
- "pop %%rbx \n\t"
- :/* no output */
- :"S" (this), "c" (cl)
- :"memory", "rax", "rdx");
- }
-
- inline Cell *Pop()
- {
- Cell *v=0;
- __asm__ __volatile__ (
- "# LFPOP \n\t"
- "push %%rbx \n\t"
- "push %%rcx \n\t"
- "mov 8(%%rsi), %%rdx \n\t"
- "mov (%%rsi), %%rax \n\t"
- "test %%rax, %%rax \n\t"
- "jz 2f \n"
- "1: \t"
- "mov (%%rax), %%rbx \n\t"
- "mov %%rdx, %%rcx \n\t"
- "inc %%rcx \n\t"
- SMPLOCK "cmpxchg16b (%%rsi) \n\t"
- "jz 2f \n\t"
- "test %%rax, %%rax \n\t"
- "jnz 1b \n"
- "2: \t"
- "pop %%rcx \n\t"
- "pop %%rbx \n\t"
- :"=a" (v)
- :"S" (&this->top)
- :"memory", "rdx");
- return v;
- }
-
- inline size_t Size() const
- {
- size_t n;
- __asm__ __volatile__ (
- "# LFSIZE \n\t"
- "mov 16(%%rsi), %%rdx \n\t"
- "mov (%%rsi), %%rax \n\t"
- "sub %%rdx, %%rax \n\t"
- :"=a" (n)
- :"S" (this)
- :"memory", "rdx");
- return n;
- }
-
-#elif defined(__GNUC__) && FLEXT_CPU == FLEXT_CPU_PPC
- inline void Push(register Cell *cl)
- {
- register volatile long t1;
- register long t2=0;
- asm volatile (
- "# LFPUSH \n"
- "0: \n"
- " lwarx %0, %3, %1 \n"
- " stw %0, 0(%2) \n"
- " sync \n"
- " stwcx. %2, %3, %1 \n"
- " bne- 0b \n"
- "0: \n"
- " lwarx %0, %3, %4 \n"
- " addi %0, %0, 1 \n"
- " sync \n"
- " stwcx. %0, %3, %4 \n"
- " bne- 0b \n"
- : "=r" (t1)
- : "r" (&this->top), "r" (cl), "r" (t2), "r" (&this->oc), "0" (t1)
- : "r0" /* prevents using r0 because of the ambiguity of 'addi' coding: */
- /* gcc version 2.95.3 20010315 (release - Linux-Mandrake 8.0 for PPC) */
- /* compiles the instruction "addi 0, 0, n" as li 0, n */
- );
- }
-
- inline Cell *Pop()
- {
- register Cell *result;
- register volatile long a, b;
- register long c=0;
- asm volatile (
- "# LFPOP \n"
- "0: \n"
- " lwarx %4, %1, %2 \n" /* creates a reservation on lf */
- " cmpwi %4, 0 \n" /* test if the lifo is empty */
- " beq- 1f \n"
- " lwz %5, 0(%4) \n" /* next cell in b */
- " sync \n" /* synchronize instructions */
- " stwcx. %5, %1, %2 \n" /* if the reservation is not altered */
- /* modify lifo top */
- " bne- 0b \n" /* otherwise: loop and try again */
- "0: \n"
- " lwarx %5, %1, %3 \n" /* creates a reservation on lf->count */
- " addi %5, %5, -1 \n" /* dec count */
- " sync \n" /* synchronize instructions */
- " stwcx. %5, %1, %3 \n" /* conditionnal store */
- " bne- 0b \n"
- "1: \n"
- " mr %0, %4 \n"
- :"=r" (result), "=r" (c)
- : "r" (&this->top), "r" (&this->oc), "r" (a), "r" (b), "1" (c)
- : "r0" /* prevents using r0 because of the ambiguity of 'addi' coding: */
- /* gcc version 2.95.3 20010315 (release - Linux-Mandrake 8.0 for PPC) */
- /* compiles the instruction "addi 0, 0, n" as li 0, n */
- );
- return result;
- }
-
- inline size_t Size() const { return oc; }
-
-#else
- // no lock free code available for this compiler/platform
-
- inline void Push(Cell *c)
- {
-#ifdef FLEXT_THREADS
- mutex.Lock();
-#endif
- c->link = (Cell *)top;
- top = c;
- ++oc;
-#ifdef FLEXT_THREADS
- mutex.Unlock();
-#endif
- }
-
- inline Cell *Pop()
- {
- if(top) {
- Cell *r;
-#ifdef FLEXT_THREADS
- mutex.Lock();
-#endif
- r = (Cell *)top;
- top = r->link;
- --oc;
-#ifdef FLEXT_THREADS
- mutex.Unlock();
-#endif
- return r;
- }
- else
- return NULL;
- }
-
- inline size_t Size() const { return oc; }
-
-private:
-#ifdef FLEXT_THREADS
- flext::ThrMutex mutex;
-#endif
-
-#endif
-
-private:
- // don't change order!
- volatile size_t ic; // input (push) count
- volatile Cell *top; // top of the stack
- volatile size_t oc; // output (pop) count
-#ifdef __POWERPC__
- size_t unused[5]; // lifo size must be at least 32 bytes
- // to avoid livelock in multiprocessor
-#endif
-};
-
-template <typename T>
-class TypedLifo
- : public Lifo
-{
-public:
- inline T *Avail() { return static_cast<T *>(Lifo::Avail()); }
- inline void Push(T *c) { Lifo::Push(static_cast<T *>(c)); }
- inline T *Pop() { return static_cast<T *>(Lifo::Pop()); }
-};
-
-template <typename T,int M = 2,int O = 1>
-class PooledLifo
- : public TypedLifo<T>
-{
-public:
- inline T *New() { T *n = reuse.Pop(); return n?n:new T; }
- inline size_t Size() const { return TypedLifo<T>::Size(); }
- inline void Free(T *p) { if(reuse.Size() < Size()*M+O) reuse.Push(p); else delete p; }
-private:
- TypedLifo<T> reuse;
-};
-
-
-class FLEXT_SHARE Fifo
-{
-public:
- typedef Lifo::Cell Cell;
-
- void Init() { in.Init(); out.Init(); }
-
- inline size_t Size() const { return in.Size()+out.Size(); }
-
- inline void Put(Cell *cl) { in.Push(cl); }
-
- Cell *Get()
- {
- Cell *v1 = out.Pop();
- if(!v1) {
- v1 = in.Pop();
- if(v1)
- for(Cell *v2; (v2 = in.Pop()) != NULL; v1 = v2)
- out.Push(v1);
- }
- return v1;
- }
-
- Cell *Avail()
- {
- Cell *v1 = out.Avail();
- if(v1)
- return v1;
- else {
- for(Cell *v2; (v2 = in.Pop()) != NULL; )
- out.Push(v2);
- return out.Avail();
- }
- }
-
- Cell *Clear()
- {
- Cell *first = Get();
- if(!first) return NULL;
-
- Cell *next,*cur = first;
- while((next = Get()) != NULL) {
- cur->link = next;
- cur = next;
- }
- cur->link = NULL;
-
- Init();
- return first;
- }
-
- Lifo in,out;
-};
-
-template <typename T>
-class TypedFifo
- : public Fifo
-{
-public:
- inline T *Avail() { return static_cast<T *>(Fifo::Avail()); }
- inline void Put(T *c) { Fifo::Put(static_cast<T *>(c)); }
- inline T *Get() { return static_cast<T *>(Fifo::Get()); }
- inline T *Clear() { return static_cast<T *>(Fifo::Clear()); }
-};
-
-template <typename T,int M = 2,int O = 1>
-class PooledFifo
- : public TypedFifo<T>
-{
-public:
- inline T *New() { T *n = reuse.Pop(); return n?n:new T; }
- inline size_t Size() const { return TypedFifo<T>::Size(); }
- inline void Free(T *p) { if(reuse.Size() < Size()*M+O) reuse.Push(p); else delete p; }
-private:
- TypedLifo<T> reuse;
-};
-
-#endif
diff --git a/externals/grill/flext/source/flcwmax-thr.h b/externals/grill/flext/source/flcwmax-thr.h
deleted file mode 100644
index 4167be9f..00000000
--- a/externals/grill/flext/source/flcwmax-thr.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-
-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 flcwmax-thr.h
- \brief Prefix file for CodeWarrior projects - OS 9 threaded version.
-*/
-
-#ifndef _FLEXT_CW_MAX_THR_H
-#define _FLEXT_CW_MAX_THR_H
-
-#define FLEXT_THREADS
-
-/*
- old CodeWarrior version (<= 6) don't have sigset_t defined which
- is needed for pthreads
-*/
-#if defined(__MWERKS__) && (__MWERKS__ == 1) // read __MWERKS__ numbering starts with CW7
- typedef unsigned int sigset_t;
- #define _CW_NOPRECOMP // no precompiled headers
-#endif
-
-#include "flcwmax.h"
-
-#endif
diff --git a/externals/grill/flext/source/flcwmax-x-thr.h b/externals/grill/flext/source/flcwmax-x-thr.h
deleted file mode 100644
index 93b78289..00000000
--- a/externals/grill/flext/source/flcwmax-x-thr.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-
-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 flcwmax-x-thr.h
- \brief Prefix file for CodeWarrior projects - OS X threaded version.
-*/
-
-#ifndef _FLEXT_CW_MAX_X_THR_H
-#define _FLEXT_CW_MAX_X_THR_H
-
-#define FLEXT_THREADS
-
-/*
- old CodeWarrior version (<= 6) don't have sigset_t defined which
- is needed for pthreads
-*/
-#if defined(__MWERKS__) && (__MWERKS__ == 1) // read __MWERKS__ numbering starts with CW7
- typedef unsigned int sigset_t;
- #define _CW_NOPRECOMP // no precompiled headers
-#endif
-
-#include "flcwmax-x.h"
-
-#endif
diff --git a/externals/grill/flext/source/flcwmax-x.h b/externals/grill/flext/source/flcwmax-x.h
deleted file mode 100644
index e1e340d2..00000000
--- a/externals/grill/flext/source/flcwmax-x.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
-
-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 flcwmax-x.h
- \brief Prefix file for CodeWarrior projects - OS X version.
-*/
-
-#ifndef _FLEXT_CW_MAX_X_H
-#define _FLEXT_CW_MAX_X_H
-
-//#define TARGET_API_MAC_CARBON 1
-#define _POSIX_C_SOURCE
-#define _POSIX_SOURCE
-
-#include "flcwmax.h"
-
-#endif
diff --git a/externals/grill/flext/source/flcwmax.h b/externals/grill/flext/source/flcwmax.h
deleted file mode 100644
index 4d108e2e..00000000
--- a/externals/grill/flext/source/flcwmax.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-
-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 flcwmax.h
- \brief Prefix file for CodeWarrior projects - OS 9 version.
-*/
-
-#ifndef _FLEXT_CW_MAX_H
-#define _FLEXT_CW_MAX_H
-
-#ifndef __MWERKS__
- #error "This header file is for CodeWarrior only."
-#endif
-
-#define FLEXT_SYS 1
-#define FLEXT_USE_SIMD
-
-#ifndef _CW_NOPRECOMP
- #include <MacHeaders.h>
-#endif
-
-#if /*__option(sym) ||*/ !__option(opt_dead_code)
- #pragma message("Optimization disabled -> Compiling a debug version (with FLEXT_DEBUG)")
- #define FLEXT_DEBUG
-#endif
-
-/* #define _LOG */
-
-#endif
diff --git a/externals/grill/flext/source/flcwpd-x-thr.h b/externals/grill/flext/source/flcwpd-x-thr.h
deleted file mode 100644
index d3075069..00000000
--- a/externals/grill/flext/source/flcwpd-x-thr.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-
-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 is the prefix file for CodeWarrior projects - OS X version */
-
-#ifndef _FLEXT_CW_PD_X_THR_H
-#define _FLEXT_CW_PD_X_THR_H
-
-#define FLEXT_THREADS
-
-#if 0
-/*
- old CodeWarrior version (<= 6) don't have sigset_t defined which
- is needed for pthreads
-*/
-#if defined(__MWERKS__) && (__MWERKS__ <= 0x6000)
- typedef unsigned int sigset_t;
- #define _CW_NOPRECOMP // no precompiled headers
-#endif
-#endif
-
-#include "flcwpd-x.h"
-
-#endif
diff --git a/externals/grill/flext/source/flcwpd-x.h b/externals/grill/flext/source/flcwpd-x.h
deleted file mode 100644
index f6b5192b..00000000
--- a/externals/grill/flext/source/flcwpd-x.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-
-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 is the prefix file for CodeWarrior projects - OS X version */
-
-#ifndef _FLEXT_CW_PD_X_H
-#define _FLEXT_CW_PD_X_H
-
-#ifndef __MWERKS__
- #error "This header file is for CodeWarrior only."
-#endif
-
-#define FLEXT_SYS 2
-#define FLEXT_USE_SIMD
-
-#define TARGET_API_MAC_CARBON 1
-#define _POSIX_C_SOURCE
-
-#ifndef _CW_NOPRECOMP
-// #include <MacHeadersMach-O.h>
-// #include <MSL MacHeadersMach-O.h>
-#endif
-
-#if __option(sym) || !__option(opt_dead_code)
- #define FLEXT_DEBUG
-#endif
-
-/* #define _LOG */
-
-#endif
diff --git a/externals/grill/flext/source/fldefs.h b/externals/grill/flext/source/fldefs.h
deleted file mode 100644
index fd31506b..00000000
--- a/externals/grill/flext/source/fldefs.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file fldefs.h
- \brief This file includes all the #define header files
-*/
-
-#ifndef __FLEXT_DEFS_H
-#define __FLEXT_DEFS_H
-
-/*! \defgroup FLEXT_DEFS Definitions for basic flext functionality
- @{
-*/
-
-/*! \brief Switch for compilation of derived virtual classes
- \remark These need dynamic type casts (and RTTI, naturally)
- \ingroup FLEXT_GLOBALS
-*/
-#ifdef FLEXT_VIRT
-#define FLEXT_CAST dynamic_cast
-#else
-#define FLEXT_CAST static_cast
-#endif
-
-//! @} FLEXT_DEFS
-
-#include "fldefs_hdr.h"
-
-#include "fldefs_setup.h"
-
-
-// ====================================================================================
-
-/*! \defgroup FLEXT_D_METHOD Declarations for flext methods
- @{
-*/
-
-#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
- \note These have to reside inside the class declaration
- @{
-*/
-
-#include "fldefs_attrcb.h"
-#include "fldefs_attrvar.h"
-#include "fldefs_attradd.h"
-
-//! @} FLEXT_D_ATTRIB
-
-#endif // FLEXT_ATTRIBUTES
-
-#endif // __FLEXT_DEFS_H
diff --git a/externals/grill/flext/source/fldefs_attradd.h b/externals/grill/flext/source/fldefs_attradd.h
deleted file mode 100644
index de48b0a4..00000000
--- a/externals/grill/flext/source/fldefs_attradd.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file 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
- \ingroup FLEXT_D_ATTRIB
- \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,flext::MakeSymbol(NAME),(FLEXT_GET_PRE(GFUN)),NULL)
-
-//! Add handler for a settable attribute
-#define FLEXT_CADDATTR_SET(CL,NAME,SFUN) \
-\
-AddAttrib(CL,flext::MakeSymbol(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,flext::MakeSymbol(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,flext::MakeSymbol(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,flext::MakeSymbol(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,flext::MakeSymbol(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,flext::MakeSymbol(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,flext::MakeSymbol(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
- \ingroup FLEXT_D_ATTRIB
- \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(flext::MakeSymbol(NAME),(FLEXT_GET_PRE(GFUN)),NULL)
-
-//! Add handler for a settable attribute
-#define FLEXT_ADDATTR_SET(NAME,SFUN) \
-\
-AddAttrib(flext::MakeSymbol(NAME),NULL,(FLEXT_SET_PRE(SFUN)))
-
-//! Add handlers for a both get- and settable attribute
-#define FLEXT_ADDATTR_VAR(NAME,GFUN,SFUN) \
-\
-AddAttrib(flext::MakeSymbol(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(flext::MakeSymbol(NAME),(FLEXT_GET_PRE(FUN)),(FLEXT_SET_PRE(FUN)))
-
-
-//! Add handler for a gettable enum attribute
-#define FLEXT_ADDATTR_GET_E(NAME,GFUN) \
-\
-AddAttrib(flext::MakeSymbol(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(flext::MakeSymbol(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(flext::MakeSymbol(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(flext::MakeSymbol(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
deleted file mode 100644
index 13ca8014..00000000
--- a/externals/grill/flext/source/fldefs_attrcb.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file 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<thisType *>(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<thisType *>(c)->FUN(arg); return true; }
-
-
-
-/*! \defgroup FLEXT_DA_CALLSET Definition of attribute set handlers
- \ingroup FLEXT_D_ATTRIB
- @{
-*/
-
-//! 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(SFUN) \
-\
-FLEXT_CALLSET_(SFUN,bool)
-/*
-static bool FLEXT_SET_PRE(FUN)(flext_base *c,int &arg) \
-{ bool b = arg != 0; FLEXT_CAST<thisType *>(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<thisType *>(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<thisType *>(c)->FUN(*arg); return true; }
-
-//! @} FLEXT_DA_CALLSET
-
-/*! \defgroup FLEXT_DA_CALLGET Definition of attribute get handlers
- \ingroup FLEXT_D_ATTRIB
- @{
-*/
-
-//! 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(GFUN) \
-\
-FLEXT_CALLGET_(GFUN,bool)
-/*
-static bool FLEXT_GET_PRE(FUN)(flext_base *c,int &arg) \
-{ bool b; FLEXT_CAST<thisType *>(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<thisType *>(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<thisType *>(c)->FUN(*arg); return true; }
-
-//! @} FLEXT_DA_CALLGET
-
-
-/*! \defgroup FLEXT_DA_CALLVAR Definition of attribute transfer handlers (both get and set)
- \ingroup FLEXT_D_ATTRIB
- @{
-*/
-
-//! 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
deleted file mode 100644
index e996b460..00000000
--- a/externals/grill/flext/source/fldefs_attrvar.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file 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 implicit attribute set function
- \internal
-*/
-#define FLEXT_ATTRSET_(VAR,TP) \
-static bool FLEXT_SET_PRE(VAR)(flext_base *c,TP &arg) \
-{ FLEXT_CAST<thisType *>(c)->VAR = arg; return true; }
-
-/*! \brief Declare an implicit attribute get function
- \internal
-*/
-#define FLEXT_ATTRGET_(VAR,TP) \
-static bool FLEXT_GET_PRE(VAR)(flext_base *c,TP &arg) \
-{ arg = (TP)FLEXT_CAST<thisType *>(c)->VAR; return true; }
-
-
-
-/*! \defgroup FLEXT_DA_ATTRSET Definition of implicit attribute set handlers
- \ingroup FLEXT_D_ATTRIB
- @{
-*/
-
-//! Declare an implicit set function for a float attribute
-#define FLEXT_ATTRSET_F(VAR) \
-\
-FLEXT_ATTRSET_(VAR,float)
-
-//! Declare an implicit set function for an integer attribute
-#define FLEXT_ATTRSET_I(VAR) \
-\
-FLEXT_ATTRSET_(VAR,int)
-
-//! Declare an implicit set function for a symbol attribute
-#define FLEXT_ATTRSET_S(VAR) \
-\
-FLEXT_ATTRSET_(VAR,const t_symbol *)
-
-//! Declare an implicit set function for a boolean attribute
-#define FLEXT_ATTRSET_B(VAR) \
-\
-FLEXT_ATTRSET_(VAR,bool)
-/*
-static bool FLEXT_SET_PRE(VAR)(flext_base *c,int &arg) \
-{ FLEXT_CAST<thisType *>(c)->VAR = arg != 0; return true; }
-*/
-
-//! Declare an implicit set function for an enum attribute
-#define FLEXT_ATTRSET_E(VAR,TP) \
-\
-FLEXT_ATTRSET_(VAR,TP)
-
-//! Declare an implicit 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<thisType *>(c)->VAR = *arg; return true; }
-
-//! @} FLEXT_DA_ATTRSET
-
-/*! \defgroup FLEXT_DA_ATTRGET Definition of implicit attribute get handlers
- \ingroup FLEXT_D_ATTRIB
- @{
-*/
-
-//! Declare an implicit get function for a float attribute
-#define FLEXT_ATTRGET_F(VAR) \
-\
-FLEXT_ATTRGET_(VAR,float)
-
-//! Declare an implicit get function for an integer attribute
-#define FLEXT_ATTRGET_I(VAR) \
-\
-FLEXT_ATTRGET_(VAR,int)
-
-//! Declare an implicit get function for a symbol attribute
-#define FLEXT_ATTRGET_S(VAR) \
-\
-FLEXT_ATTRGET_(VAR,const t_symbol *)
-
-//! Declare an implicit get function for a boolean attribute
-#define FLEXT_ATTRGET_B(VAR) \
-\
-FLEXT_ATTRGET_(VAR,bool)
-/*
-static bool FLEXT_GET_PRE(VAR)(flext_base *c,int &arg) \
-{ arg = FLEXT_CAST<thisType *>(c)->VAR?1:0; return true; }
-*/
-
-//! Declare an implicit get function for an enum attribute
-#define FLEXT_ATTRGET_E(VAR,TP) \
-\
-FLEXT_ATTRGET_(VAR,TP)
-
-//! Declare an implicit 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<thisType *>(c)->VAR; return true; }
-
-//! @} FLEXT_DA_ATTRGET
-
-
-/*! \defgroup FLEXT_DA_ATTRVAR Definition of implicit attribute transfer handlers (both get and set)
- \ingroup FLEXT_D_ATTRIB
- @{
-*/
-
-//! Declare both implicit get and set functions for a float attribute
-#define FLEXT_ATTRVAR_F(VAR) \
-\
-FLEXT_ATTRGET_F(VAR) FLEXT_ATTRSET_F(VAR)
-
-//! Declare both implicit get and set functions for an integer attribute
-#define FLEXT_ATTRVAR_I(VAR) \
-\
-FLEXT_ATTRGET_I(VAR) FLEXT_ATTRSET_I(VAR)
-
-//! Declare both implicit get and set functions for a symbol attribute
-#define FLEXT_ATTRVAR_S(VAR) \
-\
-FLEXT_ATTRGET_S(VAR) FLEXT_ATTRSET_S(VAR)
-
-//! Declare both implicit get and set functions for a boolean attribute
-#define FLEXT_ATTRVAR_B(VAR) \
-\
-FLEXT_ATTRGET_B(VAR) FLEXT_ATTRSET_B(VAR)
-
-//! Declare both implicit get and set functions for an enum attribute
-#define FLEXT_ATTRVAR_E(VAR,TP) \
-\
-FLEXT_ATTRGET_(VAR,TP) FLEXT_ATTRSET_(VAR,TP)
-
-//! Declare both implicit 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
deleted file mode 100644
index 01bcd477..00000000
--- a/externals/grill/flext/source/fldefs_hdr.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file 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)
-
-#define FLEXT_HEADER_T(NEW_CLASS,PARENT_CLASS) \
-\
-FLEXT_REALHDR_T(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)
-
-#define FLEXT_HEADER_TS(NEW_CLASS, PARENT_CLASS, SETUPFUN)\
-\
-FLEXT_REALHDR_TS(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
deleted file mode 100644
index 0798f702..00000000
--- a/externals/grill/flext/source/fldefs_methadd.h
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file 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
- \ingroup FLEXT_D_METHOD
- \note These can only be used at class construction time
- @{
-*/
-
-/*! Add a method handler for bang
- \note This is for compatibility - better use the method below
-*/
-#define FLEXT_CADDBANG(CL,IX,M_FUN) \
-\
-AddMethod(CL,IX,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,flext::MakeSymbol(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,flext::MakeSymbol(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,flext::MakeSymbol(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,flext::MakeSymbol(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,flext::MakeSymbol(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,flext::MakeSymbol(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,flext::MakeSymbol(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,flext::MakeSymbol(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,flext::MakeSymbol(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,flext::MakeSymbol(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,flext::MakeSymbol(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,flext::MakeSymbol(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,flext::MakeSymbol(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,flext::MakeSymbol(M_TAG),M_FUN,int,int,int)
-
-//! @} FLEXT_D_CADDMETHOD
-
-
-/*! \defgroup FLEXT_D_ADDMETHOD Add flext methods
- \ingroup FLEXT_D_METHOD
- \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,flext::MakeSymbol(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,flext::MakeSymbol(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,flext::MakeSymbol(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,flext::MakeSymbol(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,flext::MakeSymbol(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,flext::MakeSymbol(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,flext::MakeSymbol(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,flext::MakeSymbol(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,flext::MakeSymbol(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,flext::MakeSymbol(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,flext::MakeSymbol(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,flext::MakeSymbol(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,flext::MakeSymbol(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,flext::MakeSymbol(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
deleted file mode 100644
index 46dd8186..00000000
--- a/externals/grill/flext/source/fldefs_methbind.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file 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)
-
-/*! \brief Unbind any handler for a method from a symbol and return user data pointer by DATA
- \note Memory associated to the DATA parameter of FLEXT_BINDMETHOD will *not* be freed here.
-*/
-#define FLEXT_UNBINDMETHOD_X(SYM,DATA) \
-\
-UnbindMethod(SYM,&DATA)
-
-
-//! @} FLEXT_D_BINDMETHOD
-
-
-#endif
diff --git a/externals/grill/flext/source/fldefs_methcall.h b/externals/grill/flext/source/fldefs_methcall.h
deleted file mode 100644
index 1602faf0..00000000
--- a/externals/grill/flext/source/fldefs_methcall.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file 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
- \ingroup FLEXT_D_METHOD
- @{
-*/
-
-//! 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
deleted file mode 100644
index c1112b85..00000000
--- a/externals/grill/flext/source/fldefs_methcb.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file 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
- \ingroup FLEXT_D_METHOD
- @{
-*/
-
-//! 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<thisType *>(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<thisType *>(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<thisType *>(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<thisType *>(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<thisType *>(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<thisType *>(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<thisType *>(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<thisType *>(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<thisType *>(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<thisType *>(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<thisType *>(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
deleted file mode 100644
index f68aa507..00000000
--- a/externals/grill/flext/source/fldefs_meththr.h
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file 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<thisType *>(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<thisType *>(p->cl); \
- bool ok = th->PushThread(); \
- AtomAnything *args = p->var[0]._any; \
- 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<thisType *>(p->cl); \
- bool ok = th->PushThread(); \
- AtomList *args = p->var[0]._list; \
- 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; \
- 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<thisType *>(p->cl); \
- bool ok = th->PushThread(); \
- void *data = p->var[0]._ext; \
- 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<thisType *>(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<thisType *>(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<thisType *>(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<thisType *>(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<thisType *>(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<thisType *>(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
deleted file mode 100644
index 17455b39..00000000
--- a/externals/grill/flext/source/fldefs_setup.h
+++ /dev/null
@@ -1,337 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file fldefs_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 For stand-alone externals (not part of a library) the name of your class
- \note is of importance! It must be the same as the external (excluded an eventual ~ (tilde))
-
- There are additional parameters that can be included in the NAME field of FLEXT_NEW etc.:
-
- - There may be additional names (aliases) appened, separated by spaces
- - There may be a help path prepended, separated by a colon
- - This help path doesn't work for Max/MSP. There you'll have to use a object mapping file (Max/MSP version >= 4.2)
-
- @{
-*/
-
-
-/*! \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,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,0)
-
-/*! \brief Implementation of a flext dsp class with no arguments and no dsp inlet
- \ingroup FLEXT_D_NEW_DSP
-*/
-#define FLEXT_NEW_DSP0(NAME,NEW_CLASS) \
-\
-REAL_NEW(NAME,NEW_CLASS,1,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,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,0,1)
-
-/*! \brief Implementation of a flext dsp class (part of a library) with no arguments and no dsp inlet
- \ingroup FLEXT_D_LIB_DSP
-*/
-#define FLEXT_LIB_DSP0(NAME,NEW_CLASS) \
-\
-REAL_NEW(NAME,NEW_CLASS,1,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,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,0)
-
-/*! \brief Implementation of a flext dsp class with a variable argument list and no dsp inlet
- \ingroup FLEXT_D_NEW_DSP
-*/
-#define FLEXT_NEW_DSP0_V(NAME,NEW_CLASS) \
-\
-REAL_NEW_V(NAME,NEW_CLASS,1,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,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,0,1)
-
-/*! \brief Implementation of a flext dsp class (part of a library) with a variable argument list and no dsp inlet
- \ingroup FLEXT_D_LIB_DSP
-*/
-#define FLEXT_LIB_DSP0_V(NAME,NEW_CLASS) \
-\
-REAL_NEW_V(NAME,NEW_CLASS, 1,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,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,0, TYPE)
-
-/*! \brief Implementation of a flext dsp class with one argument and no dsp inlet
- \ingroup FLEXT_D_NEW_DSP
-*/
-#define FLEXT_NEW_DSP0_1(NAME,NEW_CLASS, TYPE) \
-\
-REAL_NEW_1(NAME,NEW_CLASS, 1,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,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,0,1, TYPE)
-
-/*! \brief Implementation of a flext dsp class (part of a library) with one argument and no dsp inlet
- \ingroup FLEXT_D_LIB_DSP
-*/
-#define FLEXT_LIB_DSP0_1(NAME,NEW_CLASS, TYPE) \
-\
-REAL_NEW_1(NAME,NEW_CLASS, 1,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,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,0, TYPE1, TYPE2)
-
-/*! \brief Implementation of a flext dsp class with 2 arguments and no dsp inlet
- \ingroup FLEXT_D_NEW_DSP
-*/
-#define FLEXT_NEW_DSP0_2(NAME,NEW_CLASS, TYPE1, TYPE2) \
-\
-REAL_NEW_2(NAME,NEW_CLASS, 1,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,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,0,1, TYPE1, TYPE2)
-
-/*! \brief Implementation of a flext dsp class (part of a library) with 2 arguments and no dsp inlet
- \ingroup FLEXT_D_LIB_DSP
-*/
-#define FLEXT_LIB_DSP0_2(NAME,NEW_CLASS, TYPE1, TYPE2) \
-\
-REAL_NEW_2(NAME,NEW_CLASS, 1,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,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,0, TYPE1, TYPE2, TYPE3)
-
-/*! \brief Implementation of a flext dsp class with 3 arguments and no dsp inlet
- \ingroup FLEXT_D_NEW_DSP
-*/
-#define FLEXT_NEW_DSP0_3(NAME,NEW_CLASS, TYPE1, TYPE2, TYPE3) \
-\
-REAL_NEW_3(NAME,NEW_CLASS, 1,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,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,0,1, TYPE1, TYPE2, TYPE3)
-
-/*! \brief Implementation of a flext dsp class (part of a library) with 3 arguments and no dsp inlet
- \ingroup FLEXT_D_LIB_DSP
-*/
-#define FLEXT_LIB_DSP0_3(NAME,NEW_CLASS, TYPE1, TYPE2, TYPE3) \
-\
-REAL_NEW_3(NAME,NEW_CLASS, 1,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
diff --git a/externals/grill/flext/source/fldoxygen.h b/externals/grill/flext/source/fldoxygen.h
deleted file mode 100644
index 96343528..00000000
--- a/externals/grill/flext/source/fldoxygen.h
+++ /dev/null
@@ -1,216 +0,0 @@
-#ifndef __FLEXT_DOXYGEN_H
-#define __FLEXT_DOXYGEN_H
-
-/*! \file fldoxygen.h
- \brief Doxygen definitions
- \remark There is no code in here, just documentation stuff.
-*/
-
-/*!
-
-\mainpage flext - a C++ layer for cross-platform development of PD and Max/MSP objects
-
-\section INTRO Introduction
-
-Currently there exist two widely used modular systems for real-time audio that can be
-extended by self-written objects (so called "externals"):<br>
-Max/MSP (http://www.cycling74.com) and Pure Data (http://www.pure-data.org) .
-
-Both come with APIs that are not very different (as they share their origin), but as well not quite the same.
-Flext seeks to provide a unifying interface for the APIs of those real-time systems while also
-concentrating on making use of the advantages of the object orientation of the C++ language.
-
-Consequently, flext allows to write externals (or libraries of a number of these), that can
-be compiled for both systems (with various compilers on a few platforms) without changes to the
-source code.
-Flext also tries to overcome some limitations of the real-time systems and introduces new features.
-
-The advantages of flext are:
-<ul>
-<li>Identical source code for PD and Max/MSP objects on a number of platforms
-<li>Better readability of code compared to straight C externals
-<li>Faster development, more robust coding
-<li>Sharing of common methods and data by using base classes
-<li>Transparent use of threads for methods
-<li>Libraries of externals in Max/MSP
-<li>More than 3 typed creation arguments possible for Max/MSP
-<li>Any input to any object's inlet (with the exception of signal streams)
-<li>Control of the object state by use of Max/Jitter-like "attributes"
-</ul>
-
-Naturally there are some cons, too:
-<ul>
-<li>Introduces a small overhead to speed of message handling
-<li>Overhead in object size (due to possibly unneeded library code) when statically linked
-</ul>
-
-Currently, flext supports
-<ul>
-<li>PD on Windows with Microsoft Visual C++, Borland C++ and gcc(cygwin) compilers
-<li>PD on Linux with gcc
-<li>PD on Mac OSX with gcc (makefile or Xcode)
-<li>Max/MSP on Mac OS9 and OSX with Metrowerks CodeWarrior
-</ul>
-
-\section LICENSE License
-
-Flext is covered by the GPL.
-
-flext - C++ layer for Max/MSP and pd (pure data) externals<BR>
-Copyright (C) 2001-2005 Thomas Grill
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.<BR>
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.<BR>
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-In the official flext distribution, the GNU General Public License is
-in the file gpl.txt<BR>
-Also see the file license.txt for notes on
-referenced works and their license texts.
-
-\section DOWNLOAD Download
-
-Download the latest flext version from http://grrrr.org/ext/flext .<br>
-Alternatively, you can check out the cvs version from http://sourceforge.net/projects/pure-data .
-
-\section USAGE Usage
-
-As a developer, you should know the C++ language, how to use a makefile (especially necessary for linux)
-and how to steer your compiler.<br>
-Flext can be compiled as a static library which has then to be linked to the code of your external.
-For most applications you won't have to use any of the native PD or Max/MSP API functions as they are all
-encapsulated by flext.
-
-So let's come to the point... how does a typical flext object look like?
-
-This is the object "attr1", one of the flext tutorial examples:
-
-\verbatim
-// enable attribute processing
-#define FLEXT_ATTRIBUTES 1
-
-// include flext header
-#include <flext.h>
-
-// check for appropriate flext version
-#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 400)
-#error You need at least flext version 0.4.0
-#endif
-\endverbatim
-
-With these lines, all the necessary definitions from the flext package have been included.
-
-\verbatim
-class attr1:
- public flext_base
-{
- FLEXT_HEADER(attr1,flext_base)
-\endverbatim
-
-A flext class is simply defined by inheriting from the flext_base (see also \ref FLEXT_CLASS)
-or flext_dsp (see also \ref FLEXT_DSP) classes.
-Additionally some information has to be added using FLEXT_HEADER (see \ref FLEXT_D_HEADER)
-
-\verbatim
-public:
- // constructor
- attr1();
-\endverbatim
-
-Normally the constructor takes the creation arguments of an object. Here there are none.
-
-\verbatim
-protected:
- void m_trigger(float f);
-
- // stored argument
- float arg;
-\endverbatim
-
-These are methods and data elements for internal class usage. Flext doesn't know about them
-as long as they are not registered.
-
-\verbatim
-private:
- // callback for method "m_trigger" (with one float argument)
- FLEXT_CALLBACK_F(m_trigger);
-
- // define attribute callbacks for variable "arg" (with GET and SET properties)
- FLEXT_ATTRVAR_F(arg);
-};
-\endverbatim
-
-For each method that shall be exposed to the realtime-system (for receiving messages) and
-every attribute (for setting and getting values) callbacks have to be set up.
-The functions in the groups \ref FLEXT_D_CALLBACK and \ref FLEXT_D_ATTRIB allow for their
-convenient definition.
-
-\verbatim
-// instantiate the class
-FLEXT_NEW("attr1",attr1)
-\endverbatim
-
-With FLEXT_NEW the class is registered for the real-time system.
-The number of creation arguments and their types must be taken into account here.
-There are several variants depending on whether a message oriented (see \ref FLEXT_D_NEW)
-or a DSP object (see \ref FLEXT_D_NEW_DSP) is created and whether it resides in a object library
-(see \ref FLEXT_D_LIB and \ref FLEXT_D_LIB_DSP).<BR>
-
-\verbatim
-attr1::attr1():
- arg(0) // initialize argument
-{
- // define inlets
- AddInAnything(); // first inlet of type anything (index 0)
-
- // define outlets
- AddOutFloat(); // one float outlet (has index 0)
-\endverbatim
-
-Every inlet and outlet that the object shall have has to be registered.
-This is done with the functions in \ref FLEXT_C_IO_ADD.
-
-\verbatim
- // register methods
- FLEXT_ADDMETHOD(0,m_trigger); // register method (for floats) "m_trigger" for inlet 0
-
- FLEXT_ADDATTR_VAR1("arg",arg); // register attribute "arg" with variable arg
-}
-\endverbatim
-
-Likewise, every method (called by a message) (see \ref FLEXT_D_ADDMETHOD) and every
-attribute (see \ref FLEXT_D_ADDATTR) exposed to the system has to be registered.
-Here the registration at instance creation is shown - there's another way by registering at
-class setup level, which is more efficient but can only be used if the methods or attributes
-used are known beforehand (see \ref FLEXT_D_CADDMETHOD and \ref FLEXT_D_CADDATTR).
-
-\verbatim
-void attr1::m_trigger(float f)
-{
- float res = arg+f;
-
- // output value to outlet
- ToOutFloat(0,res); // (0 stands for the outlet index 0)
-}
-\endverbatim
-
-This is a method that is triggered with a message. It does some calculation and then outputs
-a value to an outlet. There are numerous functions (see \ref FLEXT_C_IO_OUT) supporting
-that functionality.
-
-Be sure to work through the examples provided with the flext tutorial. These should give you
-an overview about the possibilities of flext.
-The "modules" link at the top of the page leads to a complete reference
-of flext functions and classes.
-
-*/
-
-#endif
diff --git a/externals/grill/flext/source/fldsp.cpp b/externals/grill/flext/source/fldsp.cpp
deleted file mode 100644
index e741c22a..00000000
--- a/externals/grill/flext/source/fldsp.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2006 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file fldsp.cpp
- \brief Implementation of the flext dsp base class.
-*/
-
-#include "flext.h"
-#include "flinternal.h"
-#include <string.h>
-
-// === flext_dsp ==============================================
-
-void flext_dsp::Setup(t_classid id)
-{
-#if FLEXT_SYS == FLEXT_SYS_PD
-// add_method1(c,cb_enable,"enable",A_FLOAT);
- AddMethod(id,0,MakeSymbol("enable"),&cb_enable);
-#endif
-}
-
-flext_dsp::FLEXT_CLASSDEF(flext_dsp)()
- : srate(sys_getsr()),blksz(sys_getblksize())
- , vecs(NULL)
-#if FLEXT_SYS != FLEXT_SYS_MAX
- , dspon(true)
-#endif
-{}
-
-void flext_dsp::Exit()
-{
- flext_base::Exit();
-
- if(vecs) delete[] vecs;
-}
-
-
-t_int *flext_dsp::dspmeth(t_int *w)
-{
- flext_dsp *obj = (flext_dsp *)(size_t)w[1];
-
-#if FLEXT_SYS == FLEXT_SYS_MAX
- if(!obj->thisHdr()->z_disabled)
-#else
- if(LIKELY(obj->dspon))
-#endif
- {
- flext_base::indsp = true;
- obj->CbSignal();
- flext_base::indsp = false;
- }
- return w+2;
-}
-
-void flext_dsp::SetupDsp(t_signal **sp)
-{
- int i;
- int in = CntInSig();
- int out = CntOutSig();
-#if FLEXT_SYS == FLEXT_SYS_PD
- // min. 1 input channel! (CLASS_MAININLET in pd...)
- if(!in) in = 1;
-#endif
-
- // store current dsp parameters
- srate = sp[0]->s_sr;
- blksz = sp[0]->s_n; // is this guaranteed to be the same as sys_getblksize() ?
-
- // store in and out signal vectors
-
- if((in+out) && !vecs)
- vecs = new t_signalvec[in+out];
-
- for(i = 0; i < in; ++i)
- vecs[i] = sp[i]->s_vec;
- for(i = 0; i < out; ++i)
- vecs[in+i] = sp[in+i]->s_vec;
-
- // with the following call derived classes can do their eventual DSP setup
- if(CbDsp()) {
- // set the DSP function
- dsp_add((t_dspmethod)dspmeth,1,this);
- }
-}
-
-void flext_dsp::m_dsp(int /*n*/,t_signalvec const * /*insigs*/,t_signalvec const * /*outsigs*/) {}
-
-bool flext_dsp::CbDsp()
-{
- // invoke legacy method
- m_dsp(Blocksize(),InSig(),OutSig());
- return true;
-}
-
-// this function will be overridden anyway - the probably useless default is clearing all outputs
-void flext_dsp::m_signal(int n,t_sample *const * /*insigs*/,t_sample *const *outs)
-{
- for(int i = 0; i < CntOutSig(); ++i) ZeroSamples(outs[i],n);
-}
-
-void flext_dsp::CbSignal()
-{
- // invoke legacy method
- m_signal(Blocksize(),InSig(),OutSig());
-}
-
-
-#if FLEXT_SYS == FLEXT_SYS_PD
-//void flext_dsp::cb_enable(flext_hdr *c,t_float on) { thisObject(c)->dspon = on != 0; }
-bool flext_dsp::cb_enable(flext_base *b,float &on) { static_cast<flext_dsp *>(b)->dspon = on != 0; return true; }
-#endif
diff --git a/externals/grill/flext/source/fldsp.h b/externals/grill/flext/source/fldsp.h
deleted file mode 100644
index f4c6f470..00000000
--- a/externals/grill/flext/source/fldsp.h
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2006 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file fldsp.h
- \brief Declares the flext dsp class
-
-*/
-
-#ifndef __FLDSP_H
-#define __FLDSP_H
-
-// include the header file declaring the base classes
-#include "flext.h"
-
-
-// === flext_dsp ==================================================
-
-class FLEXT_SHARE FLEXT_CLASSDEF(flext_dsp);
-typedef class FLEXT_SHARE FLEXT_CLASSDEF(flext_dsp) flext_dsp;
-
-
-/*! \brief Flext dsp enabled base object
-*/
-class FLEXT_SHARE FLEXT_CLASSDEF(flext_dsp):
- public flext_base
-{
- FLEXT_HEADER_S(FLEXT_CLASSDEF(flext_dsp),flext_base,Setup)
-
- friend class FLEXT_SHARE FLEXT_CLASSDEF(flext_base);
-
-public:
-
-/*! \defgroup FLEXT_DSP Flext dsp class
-
- @{
-*/
-
-/*! \defgroup FLEXT_C_DSP Basic dsp functionality
-
- @{
-*/
-
- //! returns current sample rate
- float Samplerate() const { return srate; }
-
- //! returns current block (aka vector) size
- int Blocksize() const { return blksz; }
-
- //! returns array of input vectors (CntInSig() vectors)
- t_sample *const *InSig() const { return vecs; }
-
- //! returns input vector
- t_sample *InSig(int i) const { return InSig()[i]; }
-
- //! returns array of output vectors (CntOutSig() vectors)
- // \todo cache that returned pointer
- t_sample *const *OutSig() const
- {
- int i = CntInSig();
- // in PD we have at least one actual dsp in vector
-#if FLEXT_SYS == FLEXT_SYS_PD
- return vecs+(i?i:1);
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- return vecs+i;
-#else
-#error
-#endif
- }
-
- //! returns output vector
- t_sample *OutSig(int i) const { return OutSig()[i]; }
-
- //! typedef describing a signal vector
- typedef t_sample *t_signalvec;
-
-//! @}
-
-// --- inheritable virtual methods --------------------------------
-
-/*! \defgroup FLEXT_C_DSP_VIRTUAL Flext virtual dsp functions
-
- @{
-*/
- /*! \brief Called on every dsp init.
- \note Don't expect any valid data in the signal vectors!
- flext_dsp::CbDsp should not be called by the derived class
-
- \return true (default)... use DSP, false, don't use DSP
- */
- virtual bool CbDsp();
-
- /*! \brief Called with every signal vector - here you do the dsp calculation
- flext_dsp::CbSignal fills all output vectors with silence
- */
- virtual void CbSignal();
-
-
- /*! \brief Deprecated method for CbSignal
- \deprecated
- \param n: frames (aka samples) in one signal vector
- \param insigs: array of input vectors (get number with function CntInSig())
- \param outsigs: array of output vectors (get number with function CntOutSig())
- */
- virtual void m_dsp(int n,t_signalvec const *insigs,t_signalvec const *outsigs);
-
- /*! \brief Deprecated method for CbSignal
- \deprecated
- \param n: frames (aka samples) in one signal vector
- \param insigs: array of input vectors (get number with function CntInSig())
- \param outsigs: array of output vectors (get number with function CntOutSig())
- */
- virtual void m_signal(int n,t_sample *const *insigs,t_sample *const *outsigs);
-
-//! @}
-
-
-/*! \defgroup FLEXT_C_DSP_INOUT Flext dsp in-/outlet functions
- \note These must be called in the class' constructor
-
- @{
-*/
-// --- inlet/outlet stuff -----------------------------------------
-
- /*! \brief Add signal inlet(s)
- \param m Number of inlets to add
- */
- void AddInSignal(int m = 1) { AddInlet(xlet_sig,m); }
-
- /*! \brief Add signal inlet (with description)
- \param desc Description of inlet
- */
- void AddInSignal(const char *desc) { AddInlet(xlet_sig,1,desc); }
-
- /*! \brief Add signal outlet(s)
- \param m Number of inlets to add
- */
- void AddOutSignal(int m = 1) { AddOutlet(xlet_sig,m); }
-
- /*! \brief Add signal outlet (with description)
- \param desc Description of outlet
- */
- void AddOutSignal(const char *desc) { AddOutlet(xlet_sig,1,desc); }
-
-//! @}
-
-//! @}
-
-protected:
-
- FLEXT_CLASSDEF(flext_dsp)();
-
- virtual void Exit();
-
-private:
-
- // not static, could be different in different patchers..
- float srate;
- int blksz;
- t_signalvec *vecs;
-
- // setup function
- static void Setup(t_classid c);
-
-#if FLEXT_SYS == FLEXT_SYS_PD
- static bool cb_enable(flext_base *c,float &on);
- bool dspon;
-#endif
-
- static inline flext_dsp *thisObject(flext_hdr *c) { return FLEXT_CAST<flext_dsp *>(c->data); }
-
- void SetupDsp(t_signal **sp);
-
- // dsp stuff
- static t_int *dspmeth(t_int *w);
-};
-
-#endif
diff --git a/externals/grill/flext/source/flext.cpp b/externals/grill/flext/source/flext.cpp
deleted file mode 100644
index 4a8e65e2..00000000
--- a/externals/grill/flext/source/flext.cpp
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2006 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file flext.cpp
- \brief Implementation of the flext base class.
-*/
-
-#include "flext.h"
-#include "flinternal.h"
-#include "fldsp.h"
-#include <string.h>
-
-// === flext_base ============================================
-
-const t_symbol *flext_base::curtag = NULL;
-
-flext_base::FLEXT_CLASSDEF(flext_base)()
- : incnt(0),outcnt(0)
- , insigs(0),outsigs(0)
-#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
- ,outlets(NULL),inlets(NULL)
-#endif
-#if FLEXT_SYS == FLEXT_SYS_MAX
- ,indesc(NULL),outdesc(NULL)
-#endif
-{
- FLEXT_LOG1("%s - flext logging is on",thisName());
-
- methhead = NULL;
- bindhead = NULL;
-
- if(HasAttributes()) {
- // initialize when attribute processing is enabled
- attrhead = new ItemCont;
- attrdata = new AttrDataCont;
- }
- else {
- attrhead = NULL;
- attrdata = NULL;
- }
-}
-
-/*! This virtual function is called after the object has been created, that is,
- after the constructor has been processed.
- It creates the inlets and outlets and the message and attribute lists.
- \note You can override it in your own class, but be sure to call it,
- \note otherwise no inlets/outlets will be created
- \note All inlet, outlets, method and attribute declarations must be made before a call to Init!
- \remark Creation of inlets/outlets can't be done upon declaration, as Max/MSP needs creation
- \remark in reverse.
-*/
-bool flext_base::Init()
-{
- bool ok = flext_obj::Init();
-
- if(ok) ok = InitInlets() && InitOutlets();
-
- if(ok) {
-#if FLEXT_SYS == FLEXT_SYS_MAX
- // according to the Max/MSP SDK this should be prior to any inlet creation, BUT
- // that doesn't seem to be true... multiple signal ins and additional inlets don't seem to work then
- if(NeedDSP()) dsp_setup(thisHdr(),CntInSig()); // signal inlets
-#endif
-
- if(HasAttributes() && m_holdaargc && m_holdaargv) {
- // initialize creation attributes
- ok = InitAttrib(m_holdaargc,m_holdaargv);
- }
- }
-
- return ok;
-}
-
-
-/*! This virtual function is called before the destructor.
- We do this because here we can still call virtual methods.
-*/
-void flext_base::Exit()
-{
-#if FLEXT_SYS == FLEXT_SYS_MAX
- // according to David Z. one should do that first...
- if(NeedDSP()) dsp_free(thisHdr());
-#endif
-
-#if FLEXT_SYS == FLEXT_SYS_PD && !defined(FLEXT_NOATTREDIT)
- // attribute editor window may still be open -> close it
- gfxstub_deleteforkey(thisHdr());
-#endif
-
-#ifdef FLEXT_THREADS
- StopThreads();
-#endif
-
- // send remaining pending messages for this object
- QFlush(this);
-
- // delete message lists
- if(bindhead) delete bindhead; // ATTENTION: the object must free all memory associated to bindings itself
- if(methhead) delete methhead;
- if(attrhead) delete attrhead;
- if(attrdata) delete attrdata;
-
-#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
- if(outlets) delete[] outlets;
-
- if(inlets) {
- FLEXT_ASSERT(incnt > 1);
- for(int ix = 1; ix < incnt; ++ix)
- if(inlets[ix-1]) {
- // release proxy object
-#if FLEXT_SYS == FLEXT_SYS_PD
- pd_free(&inlets[ix-1]->obj.ob_pd);
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- freeobject((object *)inlets[ix-1]);
-#endif
- }
- delete[] inlets;
- }
-#endif
-
-#if FLEXT_SYS == FLEXT_SYS_MAX
- if(indesc) {
- for(int i = 0; i < incnt; ++i) if(indesc[i]) delete[] indesc[i];
- delete[] indesc;
- }
- if(outdesc) {
- for(int i = 0; i < outcnt; ++i) if(outdesc[i]) delete[] outdesc[i];
- delete[] outdesc;
- }
-#endif
-
- flext_obj::Exit();
-}
-
-
-void flext_base::AddMessageMethods(t_class *c,bool dsp,bool dspin)
-{
- add_loadbang(c,cb_loadbang);
-
-#if FLEXT_SYS == FLEXT_SYS_PD
- class_addmethod(c,(t_method)cb_click,gensym("click"),A_FLOAT,A_FLOAT,A_FLOAT,A_FLOAT,A_FLOAT,A_NULL);
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- add_assist(c,cb_assist);
- add_dblclick(c,cb_click);
-#endif
-
- SetProxies(c,dsp);
- StartQueue();
-
- if(dsp) {
-#if FLEXT_SYS == FLEXT_SYS_MAX
- add_dsp(c,cb_dsp);
- dsp_initclass();
-#elif FLEXT_SYS == FLEXT_SYS_PD
- if(dspin)
- CLASS_MAINSIGNALIN(c,flext_hdr,defsig); // float messages going into the left inlet are converted to signal
- add_dsp(c,cb_dsp);
-#else
-#error Platform not supported!
-#endif
- }
-}
-
-
-/*! Set up proxy classes and basic methods at class creation time
- This ensures that they are processed before the registered flext messages
-*/
-void flext_base::Setup(t_classid id)
-{
- t_class *c = getClass(id);
-
-#if FLEXT_SYS == FLEXT_SYS_MAX
- if(!IsLib(id))
-#endif
- AddMessageMethods(c,IsDSP(id),HasDSPIn(id));
-
- if(HasAttributes(id)) {
- AddMethod(id,0,"getattributes",cb_ListAttrib);
- AddMethod(id,0,"getmethods",cb_ListMethods);
-
-#if FLEXT_SYS == FLEXT_SYS_PD && !defined(FLEXT_NOATTREDIT)
- AddMethod(id,0,"attributedialog",cb_AttrDialog);
-#endif
- }
-
-#if FLEXT_SYS == FLEXT_SYS_PD
- SetGfx(id);
-#endif
-}
-
-void flext_base::cb_loadbang(flext_hdr *c) { thisObject(c)->CbLoadbang(); }
-
-void flext_base::m_loadbang() {}
-void flext_base::CbLoadbang() { m_loadbang(); }
-
-void flext_base::CbClick() {}
-
-#if FLEXT_SYS == FLEXT_SYS_PD
-void flext_base::cb_click(flext_hdr *c,t_floatarg xpos,t_floatarg ypos,t_floatarg shift,t_floatarg ctrl,t_floatarg alt)
-{
- if(shift) thisObject(c)->CbClick();
-}
-#endif
-
-#if FLEXT_SYS == FLEXT_SYS_MAX
-void flext_base::cb_click(flext_hdr *c, Point pt, short mods)
-{
- thisObject(c)->CbClick();
-}
-
-void flext_base::cb_assist(flext_hdr *c,void * /*b*/,long msg,long arg,char *s)
-{
- flext_base *th = thisObject(c);
-
- switch(msg) {
- case 1: //ASSIST_INLET:
- if(arg < th->incnt && th->indesc[arg]) strcpy(s,th->indesc[arg]);
- break;
- case 2: //ASSIST_OUTLET:
- if(arg < th->outcnt) {
- if(th->outdesc[arg]) strcpy(s,th->outdesc[arg]);
- }
- else
- if(arg == th->outcnt && th->HasAttributes()) strcpy(s,"Attributes");
- break;
- }
-}
-#endif
-
-#if FLEXT_SYS == FLEXT_SYS_MAX
-void flext_base::cb_dsp(flext_hdr *c,t_signal **sp,short *count)
-#else
-void flext_base::cb_dsp(flext_hdr *c,t_signal **sp)
-#endif
-{
- flext_base *bobj = thisObject(c);
-
-#if FLEXT_SYS == FLEXT_SYS_MAX
- // we must extra-check here if it is really a DSP object
- // obviously, for objects that are part of a library, one dsp_initclass enables DSP for all
- if(!bobj->IsDSP()) return;
-#endif
-
- flext_dsp *obj;
-#ifdef FLEXT_DEBUG
- obj = dynamic_cast<flext_dsp *>(bobj);
-#else
- obj = static_cast<flext_dsp *>(bobj);
-#endif
-
- FLEXT_ASSERT(obj);
- obj->SetupDsp(sp);
-}
-
diff --git a/externals/grill/flext/source/flext.h b/externals/grill/flext/source/flext.h
deleted file mode 100644
index 71a35ea6..00000000
--- a/externals/grill/flext/source/flext.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2006 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file flext.h
- \brief This is the main flext include file.
-
- The basic definitions are set here and the necessary header files are included
-*/
-
-#ifndef __FLEXT_H
-#define __FLEXT_H
-
-
-/*! \defgroup FLEXT_GLOBAL Flext global definitions
- @{
-*/
-
-//! \brief flext version number
-#define FLEXT_VERSION 501
-
-//! \brief flext version string
-#define FLEXT_VERSTR "0.5.1pre"
-
-//! @}
-
-
-// determine System/OS/CPU
-#include "flprefix.h"
-
-// include headers necessary for multi-threading
-#ifdef FLEXT_THREADS
- #if FLEXT_THREADS == FLEXT_THR_POSIX
- extern "C" {
- #include <pthread.h>
- #include <sched.h>
- }
- #elif FLEXT_THREADS == FLEXT_THR_MP
- #include <multiprocessing.h>
- #elif FLEXT_THREADS == FLEXT_THR_WIN32
- #if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x500
- #include <windows.h>
- #include <process.h>
- #else
- #error "Win32 threading model only supported for Win2000/XP or newer"
- #endif
- #else
- #error "Thread model not supported"
- #endif
-#endif
-
-
-// include all the flext interface definitions
-#include "fldefs.h"
-
-// include the basic flext object classes
-#include "flclass.h"
-
-// include the flext dsp class
-#include "fldsp.h"
-
-#endif // FLEXT_H
diff --git a/externals/grill/flext/source/flfeatures.h b/externals/grill/flext/source/flfeatures.h
deleted file mode 100644
index efb198d0..00000000
--- a/externals/grill/flext/source/flfeatures.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file flfeatures.h
- \brief Detect version-specific features.
-*/
-
-#ifndef __FLFEATURES_H
-#define __FLFEATURES_H
-
-// check if PD API supports buffer dirty time
-#if defined(PD_DEVEL_VERSION) && defined(PD_MAJOR_VERSION) && defined(PD_MINOR_VERSION)
-#if PD_MINOR_VERSION >= 36 && PD_MINOR_VERSION <= 38
-// array locks have been removed in devel_0_39
- #define _FLEXT_HAVE_PD_GARRAYLOCKS
-#endif
-#if PD_MINOR_VERSION >= 36
- #define _FLEXT_HAVE_PD_GARRAYUPDATETIME
-#endif
-#endif
-
-#if defined(MAC_VERSION) || defined(WIN_VERSION)
- // not for OS9
- #define _FLEXT_HAVE_MAX_INUSEFLAG
-#endif
-
-#endif
diff --git a/externals/grill/flext/source/flinternal.h b/externals/grill/flext/source/flinternal.h
deleted file mode 100644
index d0d76eba..00000000
--- a/externals/grill/flext/source/flinternal.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file flinternal.h
- \brief Definitions for internal flext usage
- \internal
-
- Here, a few shortcuts for common Max/MSP or PD library calls and type definitions
- are declared
-*/
-
-#ifndef __FLEXT_INTERNALS_H
-#define __FLEXT_INTERNALS_H
-
-#include "flstdc.h"
-
-
-#if FLEXT_SYS == FLEXT_SYS_PD
-
-#define object_new(clss) pd_new(clss)
-#define object_free(obj) pd_free(&(obj)->ob_pd)
-
-
-
-#define add_dsp(clss,meth) class_addmethod(clss, (t_method)meth,gensym("dsp"),A_NULL)
-#define add_bang(clss,meth) class_addbang(clss, (t_method)meth)
-#define add_float(clss,meth) class_addfloat(clss, (t_method)meth)
-#define add_floatn(clss,meth,n) class_addmethod(clss, (t_method)meth,gensym("ft" #n),A_FLOAT,A_NULL)
-#define add_flint(clss,meth) class_addfloat(clss, (t_method)meth)
-#define add_flintn(clss,meth,n) class_addmethod(clss, (t_method)meth,gensym("ft" #n),A_FLOAT,A_NULL)
-#define add_method(clss,meth,text) class_addmethod(clss, (t_method)meth, gensym(text), A_NULL)
-#define add_methodG(clss,meth,text) class_addmethod(clss, (t_method)meth, gensym(text), A_GIMME,A_NULL)
-#define add_method1(clss,meth,text,a1) class_addmethod(clss, (t_method)meth, gensym(text), a1,A_NULL)
-#define add_method2(clss,meth,text,a1,a2) class_addmethod(clss, (t_method)meth, gensym(text), a1,a2,A_NULL)
-#define add_method3(clss,meth,text,a1,a2,a3) class_addmethod(clss, (t_method)meth, gensym(text), a1,a2,a3,A_NULL)
-#define add_method4(clss,meth,text,a1,a2,a3,a4) class_addmethod(clss, (t_method)meth, gensym(text), a1,a2,a3,a4,A_NULL)
-#define add_method5(clss,meth,text,a1,a2,a3,a5) class_addmethod(clss, (t_method)meth, gensym(text), a1,a2,a3,a4,a5,A_NULL)
-#define add_loadbang(clss,meth) class_addmethod(clss,(t_method)meth, gensym("loadbang"), A_CANT, A_NULL)
-#define add_anything(clss,meth) class_addanything(clss,meth)
-
-
-#define newout_signal(clss) outlet_new(clss,const_cast<t_symbol *>(flext::sym_signal))
-#define newout_float(clss) outlet_new(clss,const_cast<t_symbol *>(flext::sym_float))
-#define newout_flint(clss) outlet_new(clss,const_cast<t_symbol *>(flext::sym_float))
-#define newout_list(clss) outlet_new(clss,const_cast<t_symbol *>(flext::sym_list))
-#define newout_symbol(clss) outlet_new(clss,const_cast<t_symbol *>(flext::sym_symbol))
-#define newout_anything(clss) outlet_new(clss,const_cast<t_symbol *>(flext::sym_anything))
-
-#define outlet_flint(o,v) outlet_float(o,(float)(v))
-
-typedef t_perfroutine t_dspmethod;
-
-#define qelem_new clock_new
-#define qelem_free clock_free
-#define qelem_set clock_delay
-#define qelem_front clock_delay
-#define qelem_unset clock_unset
-
-#define CRITON()
-#define CRITOFF()
-
-
-#elif FLEXT_SYS == FLEXT_SYS_MAX
-
-typedef void t_outlet;
-
-
-#define object_new(clss) newobject(clss)
-#define object_free(obj) freeobject((object *)(obj))
-
-#define add_dsp(clss,meth) addmess((method)meth,"dsp",A_CANT,A_NOTHING)
-#define add_bang(clss,meth) addbang((method)meth)
-#define add_float(clss,meth) addfloat((method)meth)
-#define add_floatn(clss,meth,n) addftx((method)meth,n)
-#define add_flint(clss,meth) addint((method)meth)
-#define add_flintn(clss,meth,n) addinx((method)meth,n)
-#define add_method(clss,meth,text) addmess((method)meth, text, A_NOTHING)
-#define add_methodG(clss,meth,text) addmess((method)meth, text, A_GIMME,A_NOTHING)
-#define add_method1(clss,meth,text,a1) addmess((method)meth, text, a1,A_NOTHING)
-#define add_method2(clss,meth,text,a1,a2) addmess((method)meth, text, a1,a2,A_NOTHING)
-#define add_method3(clss,meth,text,a1,a2,a3) addmess((method)meth, text, a1,a2,a3,A_NOTHING)
-#define add_method4(clss,meth,text,a1,a2,a3,a4) addmess((method)meth, text, a1,a2,a3,a4,A_NOTHING)
-#define add_method5(clss,meth,text,a1,a2,a3,a5) addmess((method)meth, text, a1,a2,a3,a4,a5,A_NOTHING)
-#define add_anything(clss,meth) addmess((method)meth, "anything", A_GIMME,A_NOTHING)
-
-#define add_assist(clss,meth) addmess((method)meth, "assist", A_CANT, A_NULL)
-#define add_loadbang(clss,meth) addmess((method)meth, "loadbang", A_CANT, A_NULL)
-#define add_dblclick(clss,meth) addmess((method)meth, "dblclick", A_CANT, A_NULL)
-
-#define newout_signal(clss) outlet_new(clss,"signal")
-#define newout_float(clss) outlet_new(clss,"float")
-#define newout_flint(clss) outlet_new(clss,"int")
-#define newout_list(clss) outlet_new(clss,"list")
-#define newout_symbol(clss) outlet_new(clss,"symbol")
-#define newout_anything(clss) outlet_new(clss,0)
-
-#define outlet_flint(o,v) outlet_int(o,(int)(v))
-#define outlet_symbol(o,s) outlet_anything(o,s,0,NULL)
-
-typedef t_perfroutine t_dspmethod;
-
-#define CRITON() short state = lockout_set(1)
-#define CRITOFF() lockout_set(state)
-
-
-#elif FLEXT_SYS == FLEXT_SYS_JMAX
-
-
-#endif
-
-
-#endif
diff --git a/externals/grill/flext/source/flitem.cpp b/externals/grill/flext/source/flitem.cpp
deleted file mode 100644
index 1ae65fa8..00000000
--- a/externals/grill/flext/source/flitem.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file flitem.cpp
- \brief Processing of method and attribute lists.
-*/
-
-#include "flext.h"
-#include <string.h>
-
-flext_base::ItemSet::~ItemSet() { clear(); }
-
-void flext_base::ItemSet::clear()
-{
- for(iterator it(*this); it; ++it) delete it.data();
- TablePtrMap<const t_symbol *,Item *,8>::clear();
-}
-
-
-flext_base::Item::~Item()
-{
- if(nxt) delete nxt;
-}
-
-flext_base::ItemCont::ItemCont():
- members(0),memsize(0),size(0),cont(NULL)
-{}
-
-flext_base::ItemCont::~ItemCont()
-{
- if(cont) {
- for(int i = 0; i < size; ++i) delete cont[i];
- delete[] cont;
- }
-}
-
-void flext_base::ItemCont::Resize(int nsz)
-{
- if(nsz > memsize) {
- int nmemsz = nsz+10; // increment maximum allocation size
- ItemSet **ncont = new ItemSet *[nmemsz]; // make new array
- if(cont) {
- memcpy(ncont,cont,size*sizeof(*cont)); // copy existing entries
- delete[] cont;
- }
- cont = ncont; // set current array
- memsize = nmemsz; // set new allocation size
- }
-
- // make new items
- while(size < nsz) cont[size++] = new ItemSet;
-}
-
-void flext_base::ItemCont::Add(Item *item,const t_symbol *tag,int inlet)
-{
- FLEXT_ASSERT(tag);
-
- if(!Contained(inlet)) Resize(inlet+2);
- ItemSet &set = GetInlet(inlet);
- Item *lst = set.find(tag);
- if(!lst) {
- Item *old = set.insert(tag,lst = item);
- FLEXT_ASSERT(!old);
- }
- else
- for(;;)
- if(!lst->nxt) { lst->nxt = item; break; }
- else lst = lst->nxt;
- members++;
-}
-
-bool flext_base::ItemCont::Remove(Item *item,const t_symbol *tag,int inlet,bool free)
-{
- FLEXT_ASSERT(tag);
-
- if(Contained(inlet)) {
- ItemSet &set = GetInlet(inlet);
- Item *lit = set.find(tag);
- for(Item *prv = NULL; lit; prv = lit,lit = lit->nxt) {
- if(lit == item) {
- if(prv) prv->nxt = lit->nxt;
- else if(lit->nxt) {
- Item *old = set.insert(tag,lit->nxt);
- FLEXT_ASSERT(!old);
- }
- else {
- Item *l = set.remove(tag);
- FLEXT_ASSERT(l == lit);
- }
-
- lit->nxt = NULL;
- if(free) delete lit;
- return true;
- }
- }
- }
- return false;
-}
-
-flext_base::Item *flext_base::ItemCont::FindList(const t_symbol *tag,int inlet)
-{
- FLEXT_ASSERT(tag);
- return Contained(inlet)?GetInlet(inlet).find(tag):NULL;
-}
-
-// --- class item lists (methods and attributes) ----------------
-
-/*
-typedef TablePtrMap<flext_base::t_classid,flext_base::ItemCont *,8> ClassMap;
-
-static ClassMap classarr[2];
-
-flext_base::ItemCont *flext_base::GetClassArr(t_classid c,int ix)
-{
- ClassMap &map = classarr[ix];
- ItemCont *cont = map.find(c);
- if(!cont) map.insert(c,cont = new ItemCont);
- return cont;
-}
-*/
diff --git a/externals/grill/flext/source/fllib.cpp b/externals/grill/flext/source/fllib.cpp
deleted file mode 100644
index 3b196f55..00000000
--- a/externals/grill/flext/source/fllib.cpp
+++ /dev/null
@@ -1,578 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2006 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file fllib.cpp
- \brief Code for handling of object (and library) creation functions.
-*/
-
-#include "flext.h"
-#include "flinternal.h"
-
-#include <stdarg.h>
-#include <string.h>
-#include <ctype.h>
-#include <map>
-
-#define ALIASDEL ','
-
-#define ALIASSLASHES ":/\\"
-#if FLEXT_OS == FLEXT_OS_MAC
- #define ALIASSLASH ':'
-#elif FLEXT_OS == FLEXT_OS_WIN
- #if FLEXT_SYS == FLEXT_SYS_PD
- #define ALIASSLASH '/'
- #elif FLEXT_SYS == FLEXT_SYS_MAX
- #define ALIASSLASH '/'
- #else
- #error "Undefined"
- #endif
-#else
- // default to "/"
- #define ALIASSLASH '/'
-#endif
-
-//! Extract space-delimited words from a string
-static const char *extract(const char *name,int ix = 0)
-{
- char tmp[1024];
- const char *n = name;
-
- const char *del = strchr(name,ALIASDEL);
-
- if(del) {
-#if 0
- char *t = tmp;
- while(n < del && (isspace(*n) || strchr(ALIASSLASHES,*n))) ++n;
- while(n < del && !isspace(*n)) {
- char c = *(n++);
- *(t++) = strchr(ALIASSLASHES,c)?ALIASSLASH:c;
- }
- while(*t == ALIASSLASH && t > tmp) --t;
- *t = 0;
-#endif
- if(ix < 0) {
- // eat white space in front of help definition
- ++del;
- while(*del && isspace(*del)) ++del;
- return del;
- }
-
- strncpy(tmp,name,del-name);
- tmp[del-name] = 0;
- n = tmp;
- }
- else if(ix < 0)
- return NULL; // no explicit help name
-
- while(*n && isspace(*n)) ++n;
-
- for(int i = 0; n && *n; ++i) {
- if(i == ix) {
- char *t = tmp;
-
- for(; *n && !isspace(*n); ++t,++n) *t = *n;
- *t = 0;
- return *tmp?tmp:NULL;
- }
- else {
- while(*n && !isspace(*n)) ++n;
- while(*n && isspace(*n)) ++n;
- }
- }
-
- return NULL;
-}
-
-
-//! Check if object's name ends with a tilde
-bool flext::chktilde(const char *objname)
-{
-// int stplen = strlen(setupfun);
- bool tilde = true; //!strncmp(setupfun,"_tilde",6);
-
- if((objname[strlen(objname)-1] == '~'?1:0)^(tilde?1:0)) {
- if(tilde)
- error("flext: %s (no trailing ~) is defined as a tilde object",objname);
- else
- error("flext::check_tilde: %s is no tilde object",objname);
- return true;
- }
- else
- return false;
-}
-
-// this class stands for one library of objects
-// there can be more if flext is a shared library
-class flext_library
-{
-public:
- flext_library(const t_symbol *nm)
- : name(nm)
-#if FLEXT_SYS == FLEXT_SYS_MAX
- , clss(NULL),dsp(false)
-#endif
- {}
-
- const t_symbol *name;
-#if FLEXT_SYS == FLEXT_SYS_MAX
- t_class *clss;
- bool dsp;
-#endif
-};
-
-// this class stands for one registered object
-// it holds the class, type flags, constructor and destructor of the object and the creation arg types
-// it will never be destroyed
-class flext_class:
- public flext_root
-{
-public:
- flext_class(t_class *&cl,flext_obj *(*newf)(int,t_atom *),void (*freef)(flext_hdr *));
-
- t_class *const &clss;
-
- flext_obj *(*newfun)(int,t_atom *);
- void (*freefun)(flext_hdr *c);
-
- int argc;
- int *argv;
-
- flext_library *lib;
- bool dsp:1,noi:1,attr:1,dist:1;
-
- flext_base::ItemCont meths,attrs;
-};
-
-flext_class::flext_class(t_class *&cl,flext_obj *(*newf)(int,t_atom *),void (*freef)(flext_hdr *)):
- clss(cl),
- newfun(newf),freefun(freef),
- argc(0),argv(NULL)
- , dist(false)
-{}
-
-typedef TablePtrMap<const t_symbol *,flext_class *,8> LibMap;
-// static initialization (with constructor) doesn't work for Codewarrior
-static LibMap *libnames = NULL;
-
-//! Store or retrieve registered classes
-static flext_class *FindName(const t_symbol *s,flext_class *o = NULL)
-{
- if(!libnames) libnames = new LibMap;
- flext_class *cl = libnames->find(s);
- if(!cl && o)
- libnames->insert(s,cl = o);
- return cl;
-}
-
-
-t_class *flext_obj::getClass(t_classid cl) { return cl->clss; }
-bool flext_obj::HasAttributes(t_classid cl) { return cl->attr; }
-bool flext_obj::IsDSP(t_classid cl) { return cl->dsp; }
-bool flext_obj::HasDSPIn(t_classid cl) { return !cl->noi; }
-bool flext_obj::IsLib(t_classid cl) { return cl->lib != NULL; }
-
-bool flext_obj::HasAttributes() const { return clss->attr; }
-bool flext_obj::IsDSP() const { return clss->dsp; }
-bool flext_obj::HasDSPIn() const { return !clss->noi; }
-bool flext_obj::IsLib() const { return clss->lib != NULL; }
-
-#if FLEXT_SYS == FLEXT_SYS_MAX
-bool flext_obj::NeedDSP() const { return clss->dsp || (clss->lib && clss->lib->dsp); }
-#endif
-
-static flext_library *curlib = NULL;
-
-void flext_obj::lib_init(const char *name,void setupfun())
-{
- // make new library instance
- curlib = new flext_library(MakeSymbol(name));
-
- flext::Setup();
-
- // first register all classes
- try {
- setupfun();
- }
- catch(std::exception &x) {
- error("%s - %s",name,x.what());
- return;
- }
- catch(char *txt) {
- error("%s - %s",name,txt);
- return;
- }
- catch(...) {
- error("%s - Unknown exception at library setup",name);
- return;
- }
-
-#if FLEXT_SYS == FLEXT_SYS_MAX
- // then see if we got DSP classes
-
- // for Max/MSP, the library is represented by a special object (class) registered at startup
- // all objects in the library are clones of that library object - they share the same class
- ::setup(
- (t_messlist **)&curlib->clss,
- (t_newmethod)obj_new,(t_method)obj_free,
- sizeof(flext_hdr),NULL,A_GIMME,A_NULL);
-
- // for all classes in library add methods
- flext_base::AddMessageMethods(curlib->clss,curlib->dsp,true);
-#endif
-
- curlib = NULL;
-}
-
-void flext_obj::obj_add(bool lib,bool dsp,bool noi,bool attr,const char *idname,const char *names,void setupfun(t_classid),flext_obj *(*newfun)(int,t_atom *),void (*freefun)(flext_hdr *),int argtp1,...)
-{
- // get first possible object name
- const t_symbol *nsym = MakeSymbol(extract(names));
-
-#ifdef FLEXT_DEBUG
- if(dsp) chktilde(GetString(nsym));
-#endif
-
- if(lib) {
- FLEXT_ASSERT(curlib);
-#if FLEXT_SYS == FLEXT_SYS_MAX
- curlib->dsp |= dsp;
-#endif
- }
- else {
- FLEXT_ASSERT(!curlib);
-// process_attributes = attr;
- }
-
- // set dynamic class pointer
- t_class **cl =
-#if FLEXT_SYS == FLEXT_SYS_MAX
- lib?&curlib->clss:
-#endif
- new t_class *;
-
- // register object class
-#if FLEXT_SYS == FLEXT_SYS_PD
- *cl = ::class_new(
- (t_symbol *)nsym,
- (t_newmethod)obj_new,(t_method)obj_free,
- sizeof(flext_hdr),CLASS_DEFAULT,A_GIMME,A_NULL);
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- if(!lib) {
- ::setup(
- (t_messlist **)cl,
- (t_newmethod)obj_new,(t_method)obj_free,
- sizeof(flext_hdr),NULL,A_GIMME,A_NULL);
- // attention: in Max/MSP the *cl variable is not initialized after that call.
- // just the address is stored, the initialization then occurs with the first object instance!
- }
-#else
-#error Platform not implemented
-#endif
-
- // make new dynamic object
- flext_class *lo = new flext_class(*cl,newfun,freefun);
- lo->lib = curlib;
- lo->dsp = dsp;
- lo->noi = noi;
- lo->attr = attr;
-
-// post("ADDCLASS %s,%s = %p -> LIBOBJ %p -> %p (lib=%i,dsp=%i)",idname,names,*cl,lo,lo->clss,lib?1:0,dsp?1:0);
-
- // parse the argument type list and store it with the object
- if(argtp1 == FLEXTTPN_VAR)
- lo->argc = -1;
- else {
- int argtp,i;
- va_list marker;
-
- // parse a first time and count only
- va_start(marker,argtp1);
- for(argtp = argtp1; argtp != FLEXTTPN_NULL; ++lo->argc) argtp = (int)va_arg(marker,int);
- va_end(marker);
-
- lo->argv = new int[lo->argc];
-
- // now parse and store
- va_start(marker,argtp1);
- for(argtp = argtp1,i = 0; i < lo->argc; ++i) {
- lo->argv[i] = argtp;
- argtp = (int)va_arg(marker,int);
- }
- va_end(marker);
- }
-
- // get unique class id
- t_classid clid = lo;
-
- // make help reference
- const char *helptxt = extract(names,-1);
- if(helptxt) {
- const char *sl = strchr(helptxt,'/');
- if(sl && !sl[1])
- // helptxt is only the path (path with trailing /)
- flext_obj::DefineHelp(clid,idname,helptxt,dsp);
- else
- // helptxt is path and patch name
- flext_obj::DefineHelp(clid,helptxt,NULL,dsp);
- }
-
- for(int ix = 0; ; ++ix) {
- // in this loop register all the possible aliases of the object
-
- const char *c = ix?extract(names,ix):GetString(nsym);
- if(!c || !*c) break;
-
- // add to name list
- const t_symbol *lsym = MakeSymbol(c);
- FindName(lsym,lo);
-
-#if FLEXT_SYS == FLEXT_SYS_PD
- if(ix > 0)
- // in PD the first name is already registered with class creation
- ::class_addcreator((t_newmethod)obj_new,(t_symbol *)lsym,A_GIMME,A_NULL);
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- if(ix > 0 || lib)
- // in Max/MSP the first alias gets its name from the name of the object file,
- // unless it is a library (then the name can be different)
- ::alias(const_cast<char *>(c));
-#else
-#error
-#endif
- }
-
- try {
- // call class setup function
- setupfun(clid);
- }
- catch(std::exception &x) {
- error("%s: %s",idname,x.what());
- }
- catch(char *txt) {
- error("%s: %s",idname,txt);
- }
- catch(...) {
- error("%s - Unknown exception while initializing class",idname);
- }
-}
-
-
-#define NEWARGS 256 // must be larger than FLEXT_NEWARGS = 5
-
-typedef flext_obj *(*libfun)(int,t_atom *);
-
-#if FLEXT_SYS == FLEXT_SYS_MAX
-flext_hdr *flext_obj::obj_new(const t_symbol *s,short _argc_,t_atom *argv)
-#else
-flext_hdr *flext_obj::obj_new(const t_symbol *s,int _argc_,t_atom *argv)
-#endif
-{
- flext_hdr *obj = NULL;
- flext_class *lo = FindName(s);
- if(lo) {
-// post("NEWOBJ %s = %p -> %p",GetString(s),lo,lo->clss);
-
- bool ok = true;
- t_atom args[NEWARGS];
-
- int argc = _argc_;
- if(lo->attr) {
- argc = flext_base::CheckAttrib(argc,argv);
- }
-
- if(lo->argc >= 0) {
-#ifdef FLEXT_DEBUG
- if(lo->argc > FLEXT_MAXNEWARGS) { ERRINTERNAL(); ok = false; }
-#endif
-
- int misnum = 0;
- if(argc > lo->argc) { ok = false; misnum = 1; }
-
- for(int i = 0; ok && i < lo->argc; ++i) {
- switch(lo->argv[i]) {
-#if FLEXT_SYS != FLEXT_SYS_PD
- case FLEXTTPN_INT:
- case FLEXTTPN_DEFINT:
- if(i >= argc)
- if(lo->argv[i] == FLEXTTPN_DEFINT) SetInt(args[i],0);
- else { misnum = -1,ok = false; break; }
- else if(IsInt(argv[i])) args[i] = argv[i];
- else if(IsFloat(argv[i])) SetInt(args[i],(int)GetFloat(argv[i]));
- else ok = false;
- break;
-#endif
- case FLEXTTPN_FLOAT:
- case FLEXTTPN_DEFFLOAT:
- if(i >= argc)
- if(lo->argv[i] == FLEXTTPN_DEFFLOAT) SetFloat(args[i],0);
- else { misnum = -1,ok = false; break; }
- else if(IsInt(argv[i])) SetFloat(args[i],(float)GetInt(argv[i]));
- else if(IsFloat(argv[i])) args[i] = argv[i];
- else ok = false;
- break;
- case FLEXTTPN_SYM:
- case FLEXTTPN_DEFSYM:
- // \todo shall we analyze the patcher args????... should already be done!
- if(i >= argc)
- if(lo->argv[i] == FLEXTTPN_DEFSYM) SetSymbol(args[i],sym__);
- else { misnum = -1,ok = false; break; }
- else if(IsSymbol(argv[i]))
-// SetSymbol(args[i],GetParamSym(GetSymbol(argv[i]),NULL));
- args[i] = argv[i];
- else ok = false;
- break;
- }
- }
-
- if(!ok)
- if(misnum)
- error("%s: %s creation arguments",GetString(s),misnum < 0?"Not enough":"Too many");
- else
- error("%s: Creation arguments do not match",GetString(s));
- }
-
-
- if(ok) {
- try {
-#if FLEXT_SYS == FLEXT_SYS_PD
- obj = (flext_hdr *)::pd_new(lo->clss);
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- obj = (flext_hdr *)::newobject(lo->clss);
-#else
-#error
-#endif
-
- flext_obj::m_holder = obj;
- flext_obj::m_holdclass = lo;
- flext_obj::m_holdname = s;
- flext_obj::initing = true;
- flext_obj::init_ok = true;
-
- // get actual flext object (newfun calls "new flext_obj()")
- if(lo->argc >= 0)
- obj->data = lo->newfun(lo->argc,args);
- else
- obj->data = lo->newfun(argc,argv);
-
- flext_obj::m_holder = NULL;
- flext_obj::m_holdclass = NULL;
- flext_obj::m_holdname = NULL;
-
- ok = obj->data &&
- // check constructor exit flag
- flext_obj::init_ok;
-
- if(ok) {
- if(lo->attr) {
- // DON'T convert eventual patcher args here... this is done by the actual attribute stuff
- // so that the initial $- or #- be preserved!
-
- // store creation args for attribute initialization (inside flext_base::Init())
- flext_obj::m_holdaargc = _argc_-argc;
- flext_obj::m_holdaargv = argv+argc;
- }
- else {
- flext_obj::m_holdaargc = 0;
- flext_obj::m_holdaargv = NULL;
- }
-
- // call virtual init function
- // here, inlets, outlets, methods and attributes can be set up
- ok = obj->data->Init();
-
- flext_obj::initing = false;
-
- // call another virtual init function
- if(ok) ok = obj->data->Finalize();
-
- flext_obj::m_holdaargc = 0;
- flext_obj::m_holdaargv = NULL;
- }
-
- } //try
- catch(std::exception &x) {
- error("%s - Exception while creating object: %s",GetString(s),x.what());
- ok = false;
- }
- catch(char *txt) {
- error("%s - Exception while creating object: %s",GetString(s),txt);
- ok = false;
- }
- catch(...) {
- error("%s - Unknown exception while creating object",GetString(s));
- ok = false;
- }
-
- flext_obj::initing = false;
-
- if(!ok) {
- // there was some init error, free object
- lo->freefun(obj);
- obj = NULL;
- }
- }
- }
-#ifdef FLEXT_DEBUG
- else
-#if FLEXT_SYS == FLEXT_SYS_MAX
- // in Max/MSP an object with the name of the library exists, even if not explicitly declared!
-// if(!lo->lib || s != lo->lib->name)
-#endif
- error("Class %s not found in library!",s->s_name);
-#endif
-
- return obj;
-}
-
-void flext_obj::obj_free(flext_hdr *h)
-{
- flext_hdr *hdr = (flext_hdr *)h;
- const t_symbol *name = hdr->data->thisNameSym();
- flext_class *lcl = FindName(name);
-
- if(lcl) {
- try {
- flext_obj::exiting = true;
-
- // call virtual exit function
- hdr->data->Exit();
-
- // now call object destructor and deallocate
- lcl->freefun(hdr);
- } //try
- catch(std::exception &x) {
- error("%s - Exception while destroying object: %s",GetString(name),x.what());
- }
- catch(char *txt) {
- error("%s - Exception while destroying object: %s",GetString(name),txt);
- }
- catch(...) {
- error("%s - Unknown exception while destroying object",GetString(name));
- }
-
- flext_obj::exiting = false;
- }
-#ifdef FLEXT_DEBUG
- else
-#if FLEXT_SYS == FLEXT_SYS_MAX
- // in Max/MSP an object with the name of the library exists, even if not explicitely declared!
-// if(!lo->lib || s != lo->lib->name)
-#endif
- error("Class %s not found in library!",name);
-#endif
-}
-
-
-t_class *flext_obj::thisClass() const { FLEXT_ASSERT(x_obj); return thisClassId()->clss; }
-
-void flext_base::SetDist(t_classid c,bool d) { c->dist = d; }
-bool flext_base::DoDist() const { return thisClassId()->dist; }
-
-flext_base::ItemCont *flext_base::ClMeths(t_classid c) { return &c->meths; }
-flext_base::ItemCont *flext_base::ClAttrs(t_classid c) { return &c->attrs; }
diff --git a/externals/grill/flext/source/flmap.cpp b/externals/grill/flext/source/flmap.cpp
deleted file mode 100644
index 5afcf51c..00000000
--- a/externals/grill/flext/source/flmap.cpp
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file flmap.cpp
- \brief flext container classes.
-*/
-
-#include "flext.h"
-#include "flmap.h"
-
-TableAnyMap::~TableAnyMap() { clear(); }
-
-void TableAnyMap::clear()
-{
- if(left) { _delmap(left); left = NULL; }
- if(right) { _delmap(right); right = NULL; }
- n = 0;
-}
-
-
-void *TableAnyMap::_set(int tsize,size_t k,void *t)
-{
- FLEXT_ASSERT(n);
-
- if(n < tsize) {
- // fall through
- }
- else if(k < data[0].key)
- return _toleft(tsize,k,t);
- else if(k > data[tsize-1].key)
- return _toright(tsize,k,t);
-
- int ix = _tryix(k);
- if(ix >= n) {
- FLEXT_ASSERT(ix == n);
- // after last entry
- data[n++](k,t);
- return NULL;
- }
-
- size_t dk = data[ix].key;
- if(k == dk) {
- // update data in existing slot (same key)
- void *a = data[ix].value;
- data[ix] = t;
- return a;
- }
- else {
- // insert new slot by shifting the higher ones
- FLEXT_ASSERT(k < dk);
- void *a;
- if(n == tsize)
- a = _toright(tsize,data[tsize-1]);
- else {
- ++n;
- a = NULL;
- }
-
- Data *tg = data+ix;
- for(Data *d = data+n-1; d > tg; d--) d[0] = d[-1];
- (*tg)(k,t);
- return a;
- }
-}
-
-void *TableAnyMap::_find(int tsize,size_t k) const
-{
- FLEXT_ASSERT(n);
- if(n < tsize) {
- // fall through
- }
- else if(k < data[0].key)
- return left?left->_find(tsize,k):NULL;
- else if(k > data[n-1].key)
- return right?right->_find(tsize,k):NULL;
-
- const int ix = _tryix(k);
- return ix < n && data[ix].key == k?data[ix].value:NULL;
-}
-
-#ifdef FLEXT_DEBUG
-void TableAnyMap::_check(int tsize)
-{
- FLEXT_ASSERT(n);
-
- size_t k = data[0].key;
- for(int i = 1; i < n; ++i) {
- size_t k2 = data[i].key;
- FLEXT_ASSERT(k < k2);
- k = k2;
- }
-
- if(left || right) FLEXT_ASSERT(n == tsize);
-
- if(left) {
- FLEXT_ASSERT(flext::MemCheck(left));
- left->_check(tsize);
- }
- if(right) {
- FLEXT_ASSERT(flext::MemCheck(right));
- right->_check(tsize);
- }
-}
-#endif
-
-void *TableAnyMap::_remove(int tsize,size_t k)
-{
- FLEXT_ASSERT(n);
- if(n < tsize) {
- // fall through
- }
- else if(k < data[0].key) {
- void *r = left?left->_remove(tsize,k):NULL;
- if(r) _eraseempty(left);
- return r;
- }
- else if(k > data[n-1].key) {
- void *r = right?right->_remove(tsize,k):NULL;
- if(r) _eraseempty(right);
- return r;
- }
-
- const int ix = _tryix(k);
- if(ix >= n || data[ix].key != k)
- return NULL;
- else {
- // found key in this map
- void *ret = data[ix].value;
-
- Data dt;
- bool fnd,ins = false;
- if(n >= tsize) {
- // if this table is full get fill-in elements from branches
- if(left) {
- // try to get biggest element from left branch
- left->_getbig(dt);
- _eraseempty(left);
- fnd = true,ins = true;
- }
- else if(right) {
- // try to get smallest element from right branch
- right->_getsmall(dt);
- _eraseempty(right);
- fnd = true;
- }
- else
- fnd = false;
- }
- else fnd = false;
-
- if(ins) {
- // insert smaller element from left
- for(int i = ix; i; --i) data[i] = data[i-1];
- data[0] = dt;
- }
- else {
- // shift elements
- for(int i = ix+1; i < n; ++i) data[i-1] = data[i];
- // insert bigger element from right or reduce table size
- if(fnd)
- data[n-1] = dt;
- else
- --n;
- }
-
- return ret;
- }
-}
-
-void TableAnyMap::_getbig(Data &dt)
-{
- FLEXT_ASSERT(n);
-
- if(right) {
- right->_getbig(dt);
- _eraseempty(right);
- }
- else {
- dt = data[n-1];
- if(left) {
- for(int i = n-1; i; --i) data[i] = data[i-1];
- left->_getbig(data[0]);
- _eraseempty(left);
- }
- else
- --n;
- }
-}
-
-void TableAnyMap::_getsmall(Data &dt)
-{
- FLEXT_ASSERT(n);
-
- if(left) {
- left->_getsmall(dt);
- _eraseempty(left);
- }
- else {
- dt = data[0];
- for(int i = 1; i < n; ++i) data[i-1] = data[i];
- if(right) {
- right->_getsmall(data[n-1]);
- _eraseempty(right);
- }
- else
- --n;
- }
-}
-
-void TableAnyMap::iterator::forward()
-{
- FLEXT_ASSERT(map || ix >= map->n);
-
- if(++ix >= map->n) {
- TableAnyMap *nmap;
-
- // we reached the end of the slots
- if(map->right) {
- // climb up one
- map = map->right;
- leftmost();
- ix = 0;
- }
- else {
- // fall back
- for(;;) {
- nmap = map->parent;
- if(!nmap) break; // no parent
- if(nmap->left == map) {
- // ok, we are in front of the slots now
- ix = 0;
- map = nmap;
- break;
- }
- else {
- FLEXT_ASSERT(nmap->right == map);
- ix = (map = nmap)->n;
- }
- }
- }
- }
-}
diff --git a/externals/grill/flext/source/flmap.h b/externals/grill/flext/source/flmap.h
deleted file mode 100644
index 796e9549..00000000
--- a/externals/grill/flext/source/flmap.h
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file flmap.h
- \brief special map class (faster and less memory-consuming than std::map)
-*/
-
-#ifndef __FLMAP_H
-#define __FLMAP_H
-
-#include "flprefix.h"
-
-/*! \defgroup FLEXT_SUPPORT Flext support classes
- @{
-*/
-
-class FLEXT_SHARE TableAnyMap
-{
-public:
-
- virtual TableAnyMap *_newmap(TableAnyMap *parent) = 0;
- virtual void _delmap(TableAnyMap *map) = 0;
-
- struct Data {
- void operator()(size_t k,void *v) { key = k,value = v; }
- void operator =(void *v) { value = v; }
-
- size_t key;
- void *value;
- };
-
-protected:
- // constructor and destructor are protected so that they can't be directly instantiated
-
- TableAnyMap(TableAnyMap *p,Data *dt)
- : data(dt)
- , parent(p),left(0),right(0)
- , n(0)
- {}
-
- virtual ~TableAnyMap();
-
-public:
-
-#if 0 // set 1 for asserting the map structure (very cpu-intensive!)
- void check(int tsize) { if(n) _check(tsize); }
-#else
-// void check(int tsize) {}
-#endif
-
- void *insert(int tsize,size_t k,void *t)
- {
- void *r;
- if(LIKELY(n))
- r = _set(tsize,k,t);
- else {
- data[n++](k,t);
- r = 0;
- }
-// check(tsize);
- return r;
- }
-
- void *find(int tsize,size_t k) const { return LIKELY(n)?_find(tsize,k):0; }
-
- void *remove(int tsize,size_t k)
- {
- void *r = LIKELY(n)?_remove(tsize,k):0;
-// check(tsize);
- return r;
- }
-
- virtual void clear();
-
- class FLEXT_SHARE iterator
- {
- public:
- iterator(): map(0) {}
- iterator(const TableAnyMap &m): map(&m),ix(0) { leftmost(); }
- iterator(const iterator &it): map(it.map),ix(it.ix) {}
-
- iterator &operator =(const iterator &it) { map = it.map,ix = it.ix; return *this; }
-
- operator bool() const { return map && ix < map->n; }
-
- // no checking here!
- void *data() const { return map->data[ix].value; }
- size_t key() const { return map->data[ix].key; }
-
- iterator &operator ++() { forward(); return *this; }
-
- protected:
- void leftmost()
- {
- // search smallest branch (go left as far as possible)
- const TableAnyMap *nmap;
- while((nmap = map->left) != 0) map = nmap;
- }
-
- void forward();
-
- // pointers to map and index within
- const TableAnyMap *map;
- int ix;
- };
-
- void _init(size_t k,void *t) { data[0](k,t); n = 1; }
-
- void *_toleft(int tsize,size_t k,void *t)
- {
- if(left)
- return left->_set(tsize,k,t);
- else {
- (left = _newmap(this))->_init(k,t);
- return 0;
- }
- }
-
- void *_toright(int tsize,size_t k,void *t)
- {
- if(right)
- return right->_set(tsize,k,t);
- else {
- (right = _newmap(this))->_init(k,t);
- return 0;
- }
- }
-
- void *_toleft(int tsize,Data &v) { return _toleft(tsize,v.key,v.value); }
- void *_toright(int tsize,Data &v) { return _toright(tsize,v.key,v.value); }
-
- void *_set(int tsize,size_t k,void *t);
- void *_find(int tsize,size_t k) const;
- void *_remove(int tsize,size_t k);
-
-#ifdef FLEXT_DEBUG
- void _check(int tsize);
-#endif
-
- Data *data;
- TableAnyMap *parent,*left,*right;
- int n;
-
- //! return index of data item with key <= k
- //! \note index can point past the last item!
- unsigned int _tryix(size_t k) const
- {
- unsigned int ix = 0,b = n;
- while(ix != b) {
- const unsigned int c = (ix+b)>>1;
- const size_t dk = data[c].key;
- if(k == dk)
- return c;
- else if(k < dk)
- b = c;
- else if(ix < c)
- ix = c;
- else
- return b;
- }
- return ix;
- }
-
- void _eraseempty(TableAnyMap *&b)
- {
- if(!b->n) {
- // remove empty branch
- _delmap(b); b = 0;
- }
- }
-
- void _getsmall(Data &dt);
- void _getbig(Data &dt);
-
-private:
- // hide, so that it can't be used.....
- explicit TableAnyMap(const TableAnyMap &): data(NULL) {}
- TableAnyMap &operator =(const TableAnyMap &) { return *this; }
-};
-
-template <typename K,typename T,int N = 8>
-class TablePtrMap
- :
-#if (defined(_MSC_VER) && _MSC_VER < 1300) || defined(__BORLANDC__) || defined(__MWERKS__)
- public // necessary for VC6
-#endif
- TableAnyMap
-{
-public:
- TablePtrMap(): TableAnyMap(0,slots),count(0) {}
- virtual ~TablePtrMap() { clear(); }
-
- virtual void clear() { TableAnyMap::clear(); count = 0; }
-
- inline int size() const { return count; }
-
- inline T insert(K k,T t)
- {
- void *d = TableAnyMap::insert(N,*(size_t *)&k,(void *)t);
- if(!d) ++count;
- return (T)d;
- }
-
- inline T find(K k) const { return (T)TableAnyMap::find(N,*(size_t *)&k); }
-
- inline T remove(K k)
- {
- void *d = TableAnyMap::remove(N,*(size_t *)&k);
- if(LIKELY(d)) --count;
- return (T)d;
- }
-
-
- class iterator
- : TableAnyMap::iterator
- {
- public:
- iterator() {}
- iterator(const TablePtrMap &m): TableAnyMap::iterator(m) {}
- iterator(const iterator &it): TableAnyMap::iterator(it) {}
-
- // this ugly syntax (cast to parent class) is needed for MSVC6
-
- inline iterator &operator =(const iterator &it) { ((TableAnyMap::iterator &)*this) = it; return *this; }
-
- inline operator bool() const { return (bool)((TableAnyMap::iterator &)*this); }
- inline T data() const { return (T)(((TableAnyMap::iterator &)*this).data()); }
- inline K key() const { return (K)(((TableAnyMap::iterator &)*this).key()); }
-
- inline iterator &operator ++() { ++((TableAnyMap::iterator &)*this); return *this; }
- };
-
-protected:
- TablePtrMap(TableAnyMap *p): TableAnyMap(p,slots),count(0) {}
-
- virtual TableAnyMap *_newmap(TableAnyMap *parent) { return new TablePtrMap(parent); }
- virtual void _delmap(TableAnyMap *map) { delete (TablePtrMap *)map; }
-
- int count;
- Data slots[N];
-
-private:
- explicit TablePtrMap(const TableAnyMap &p) {}
-};
-
-//! @} // FLEXT_SUPPORT
-
-#endif
diff --git a/externals/grill/flext/source/flmeth.cpp b/externals/grill/flext/source/flmeth.cpp
deleted file mode 100644
index 6355dd08..00000000
--- a/externals/grill/flext/source/flmeth.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2006 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file flmeth.cpp
- \brief Method processing of flext base class.
-*/
-
-#include "flext.h"
-#include <string.h>
-#include <stdarg.h>
-#include "flinternal.h"
-
-flext_base::MethItem::MethItem(AttrItem *conn):
- Item(conn),index(0),
- argc(0),args(NULL)
- ,fun(NULL)
-{}
-
-flext_base::MethItem::~MethItem()
-{
- if(args) delete[] args;
-}
-
-void flext_base::MethItem::SetArgs(methfun _fun,int _argc,metharg *_args)
-{
- fun = _fun;
- if(args) delete[] args;
- argc = _argc,args = _args;
-}
-
-/*! \brief Add a method to the queue
-*/
-void flext_base::AddMethod(ItemCont *ma,int inlet,const t_symbol *tag,methfun fun,metharg tp,...)
-{
-#ifdef FLEXT_LOG_MSGS
- post("addmethod %i:%s",inlet,GetString(tag));
-#endif
-
- va_list marker;
-
- // at first just count the arg type list (in argc)
- int argc = 0;
- va_start(marker,tp);
- metharg *args = NULL,arg = tp;
- for(; arg != a_null; ++argc) arg = (metharg)va_arg(marker,int); //metharg);
- va_end(marker);
-
- if(argc > 0) {
- if(argc > FLEXT_MAXMETHARGS) {
- error("flext - method %s: only %i arguments are type-checkable: use variable argument list for more",tag?GetString(tag):"?",FLEXT_MAXMETHARGS);
- argc = FLEXT_MAXMETHARGS;
- }
-
- args = new metharg[argc];
-
- va_start(marker,tp);
- metharg a = tp;
- for(int ix = 0; ix < argc; ++ix) {
-#ifdef FLEXT_DEBUG
- if(a == a_list && ix > 0) {
- ERRINTERNAL();
- }
-#endif
-#if FLEXT_SYS == FLEXT_SYS_PD && defined(FLEXT_COMPATIBLE)
- if(a == a_pointer) {
- post("Pointer arguments are not allowed in compatibility mode");
- }
-#endif
- args[ix] = a;
- a = (metharg)va_arg(marker,int); //metharg);
- }
- va_end(marker);
- }
-
- MethItem *mi = new MethItem;
- mi->index = ma->Members();
- mi->SetArgs(fun,argc,args);
- ma->Add(mi,tag,inlet);
-}
-
-void flext_base::ListMethods(AtomList &la,int inlet) const
-{
- typedef TablePtrMap<int,const t_symbol *,32> MethList;
- MethList list[2];
- ItemCont *clmethhead = ClMeths(thisClassId());
-
- int i;
- for(i = 0; i <= 1; ++i) {
- ItemCont *a = i?methhead:clmethhead;
- if(a && a->Contained(inlet)) {
- ItemSet &ai = a->GetInlet(inlet);
- for(ItemSet::iterator as(ai); as; ++as) {
- for(Item *al = as.data(); al; al = al->nxt) {
- MethItem *aa = (MethItem *)al;
- // check it's not related to an attribute
- if(!aa->IsAttr()) {
- list[i].insert(aa->index,as.key());
- break;
- }
- }
- }
- }
- }
-
- la((int)list[0].size()+(int)list[1].size());
- int ix = 0;
- for(i = 0; i <= 1; ++i)
- for(MethList::iterator it(list[i]); it; ++it)
- SetSymbol(la[ix++],it.data());
-}
-
-bool flext_base::cb_ListMethods(flext_base *c,int argc,const t_atom *argv)
-{
- if(c->HasAttributes() && (argc == 0 || (argc == 1 && CanbeInt(argv[0])))) {
- // defined in flsupport.cpp
- int inlet = argc?GetAInt(argv[0]):0;
- AtomListStatic<32> la;
- c->ListMethods(la,inlet);
- c->ToOutAnything(c->GetOutAttr(),sym_methods,la.Count(),la.Atoms());
- return true;
- }
- else
- return false;
-}
-
diff --git a/externals/grill/flext/source/flmsg.cpp b/externals/grill/flext/source/flmsg.cpp
deleted file mode 100644
index 1d42b5fb..00000000
--- a/externals/grill/flext/source/flmsg.cpp
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2006 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file flmsg.cpp
- \brief Message processing of flext base class.
-*/
-
-#include "flext.h"
-
-
-bool flext_base::TryMethTag(Item *lst,const t_symbol *tag,int argc,const t_atom *argv)
-{
- for(; lst; lst = lst->nxt) {
- MethItem *m = (MethItem *)lst;
-
-// FLEXT_LOG3("found method tag %s: inlet=%i, argc=%i",GetString(tag),m->inlet,argc);
-
- if(m->attr) {
- // attributes are treated differently
-
- if(m->attr->IsGet())
- return DumpAttrib(tag,m->attr);
- else
- return SetAttrib(tag,m->attr,argc,argv);
- }
- else {
- if(m->argc == 1) {
- if(m->args[0] == a_list) {
- // try list
- if(((methfun_V)m->fun)(this,argc,const_cast<t_atom *>(argv))) return true;
- }
- else if(m->args[0] == a_any) {
- // try anything
- if(((methfun_A)m->fun)(this,tag,argc,const_cast<t_atom *>(argv))) return true;
- }
- }
-
- // try matching number of args
- if(m->argc == argc) {
- int ix;
- t_any aargs[FLEXT_MAXMETHARGS];
- bool ok = true;
- for(ix = 0; ix < argc && ok; ++ix) {
- switch(m->args[ix]) {
- case a_float: {
- if(IsFloat(argv[ix])) aargs[ix].ft = GetFloat(argv[ix]);
- else if(IsInt(argv[ix])) aargs[ix].ft = (float)GetInt(argv[ix]);
- else ok = false;
-
- if(ok) FLEXT_LOG2("int arg %i = %f",ix,aargs[ix].ft);
- break;
- }
- case a_int: {
- if(IsFloat(argv[ix])) aargs[ix].it = (int)GetFloat(argv[ix]);
- else if(IsInt(argv[ix])) aargs[ix].it = GetInt(argv[ix]);
- else ok = false;
-
- if(ok) FLEXT_LOG2("float arg %i = %i",ix,aargs[ix].it);
- break;
- }
- case a_symbol: {
- if(IsSymbol(argv[ix])) aargs[ix].st = GetSymbol(argv[ix]);
- else ok = false;
-
- if(ok) FLEXT_LOG2("symbol arg %i = %s",ix,GetString(aargs[ix].st));
- break;
- }
-#if FLEXT_SYS == FLEXT_SYS_PD
- case a_pointer: {
- if(IsPointer(argv[ix])) aargs[ix].pt = (t_gpointer *)GetPointer(argv[ix]);
- else ok = false;
- break;
- }
-#endif
- default:
- error("Argument type illegal");
- ok = false;
- }
- }
-
- if(ok && ix == argc) {
- switch(argc) {
- case 0: return ((methfun_0)m->fun)(this);
- case 1: return ((methfun_1)m->fun)(this,aargs[0]);
- case 2: return ((methfun_2)m->fun)(this,aargs[0],aargs[1]);
- case 3: return ((methfun_3)m->fun)(this,aargs[0],aargs[1],aargs[2]);
- case 4: return ((methfun_4)m->fun)(this,aargs[0],aargs[1],aargs[2],aargs[3]);
- case 5: return ((methfun_5)m->fun)(this,aargs[0],aargs[1],aargs[2],aargs[3],aargs[4]);
- default:
- FLEXT_ASSERT(false);
- }
- }
- }
- }
- }
- return false;
-}
-
-
-bool flext_base::TryMethAny(Item *lst,const t_symbol *s,int argc,const t_atom *argv)
-{
- for(; lst; lst = lst->nxt) {
- MethItem *m = (MethItem *)lst;
-
- if(!m->IsAttr() && m->argc == 1 && m->args[0] == a_any) {
-// FLEXT_LOG4("found any method for %s: inlet=%i, symbol=%s, argc=%i",GetString(m->tag),m->inlet,GetString(s),argc);
-
- if(((methfun_A)m->fun)(this,s,argc,const_cast<t_atom *>(argv))) return true;
- }
- }
- return false;
-}
-
-/*! \brief Find a method item for a specific tag and arguments
- \remark All attributes are also stored in the method list and retrieved by a member of the method item
-*/
-bool flext_base::FindMeth(int inlet,const t_symbol *s,int argc,const t_atom *argv)
-{
- Item *lst;
- ItemCont *clmethhead = ClMeths(thisClassId());
-
- // search for exactly matching tag
- if(UNLIKELY(methhead) && (lst = methhead->FindList(s,inlet)) != NULL && TryMethTag(lst,s,argc,argv)) return true;
- if((lst = clmethhead->FindList(s,inlet)) != NULL && TryMethTag(lst,s,argc,argv)) return true;
-
- // if nothing found try any inlet
- if(UNLIKELY(methhead) && (lst = methhead->FindList(s,-1)) != NULL && TryMethTag(lst,s,argc,argv)) return true;
- if((lst = clmethhead->FindList(s,-1)) != NULL && TryMethTag(lst,s,argc,argv)) return true;
-
- return false;
-}
-
-bool flext_base::FindMethAny(int inlet,const t_symbol *s,int argc,const t_atom *argv)
-{
- Item *lst;
- ItemCont *clmethhead = ClMeths(thisClassId());
-
- if(UNLIKELY(methhead) && (lst = methhead->FindList(sym_anything,inlet)) != NULL && TryMethAny(lst,s,argc,argv)) return true;
- if((lst = clmethhead->FindList(sym_anything,inlet)) != NULL && TryMethAny(lst,s,argc,argv)) return true;
-
- // if nothing found try any inlet
- if(UNLIKELY(methhead) && (lst = methhead->FindList(sym_anything,-1)) != NULL && TryMethAny(lst,s,argc,argv)) return true;
- if((lst = clmethhead->FindList(sym_anything,-1)) != NULL && TryMethAny(lst,s,argc,argv)) return true;
-
- return false;
-}
-
-/*! \brief All the message processing
- The messages of all the inlets go here and are promoted to the registered callback functions
-*/
-bool flext_base::CbMethodHandler(int inlet,const t_symbol *s,int argc,const t_atom *argv)
-{
- static bool trap = false;
- bool ret;
-
- curtag = s;
-
-#ifdef FLEXT_LOG_MSGS
- post("methodmain inlet:%i args:%i symbol:%s",inlet,argc,s?GetString(s):"");
-#endif
-
- try {
- ret = FindMeth(inlet,s,argc,argv);
-#ifdef FLEXT_LOG_MSGS
- if(ret) post("found %s message in %s,%i",GetString(s),__FILE__,__LINE__);
-#endif
- if(ret) goto end;
-
- if(argc == 1) {
- if(s == sym_list) {
- // for 1-element lists try the single atom (this is the format output by [route])
- if(IsFloat(argv[0]))
- ret = FindMeth(inlet,sym_float,1,argv);
- else if(IsInt(argv[0]))
- ret = FindMeth(inlet,sym_int,1,argv);
- else if(IsSymbol(argv[0]))
- ret = FindMeth(inlet,sym_symbol,1,argv);
- #if FLEXT_SYS == FLEXT_SYS_PD && !defined(FLEXT_COMPATIBLE)
- else if(IsPointer(argv[0]))
- ret = FindMeth(inlet,sym_pointer,1,argv);
- #endif
- if(ret) goto end;
- }
- else {
- if(s == sym_float) {
- #if FLEXT_SYS == FLEXT_SYS_MAX
- t_atom at;
- // If float message is not explicitly handled: try int handler instead
- SetInt(at,(int)GetFloat(argv[0]));
- ret = FindMeth(inlet,sym_int,1,&at);
- if(ret) goto end;
- #endif
- // If not explicitly handled: try list handler instead
- ret = FindMeth(inlet,sym_list,1,argv);
- if(ret) goto end;
- }
- #if FLEXT_SYS == FLEXT_SYS_MAX
- else if(s == sym_int) {
- t_atom at;
- // If int message is not explicitly handled: try float handler instead
- SetFloat(at,(float)GetInt(argv[0]));
- ret = FindMeth(inlet,sym_float,1,&at);
- if(ret) goto end;
- // If not explicitly handled: try list handler instead
- ret = FindMeth(inlet,sym_list,1,argv);
- if(ret) goto end;
- }
- #endif
- else if(s == sym_symbol) {
- ret = FindMeth(inlet,sym_list,1,argv);
- if(ret) goto end;
- }
- #if FLEXT_SYS == FLEXT_SYS_PD && !defined(FLEXT_COMPATIBLE)
- else if(s == sym_pointer) {
- ret = FindMeth(inlet,sym_list,1,argv);
- if(ret) goto end;
- }
- #endif
- }
- }
- else if(argc == 0) {
- // If symbol message (pure anything without args) is not explicitly handled: try list handler instead
- t_atom at;
- SetSymbol(at,s);
- ret = FindMeth(inlet,sym_list,1,&at);
-#ifdef FLEXT_LOG_MSGS
- if(ret) post("found %s message in %s,%i",GetString(sym_list),__FILE__,__LINE__);
-#endif
- if(ret) goto end;
- }
-
- // if distmsgs is switched on then distribute list elements over inlets (Max/MSP behavior)
- if(DoDist() && inlet == 0 && s == sym_list && insigs <= 1 && !trap) {
- int i = incnt;
- if(i > argc) i = argc;
- for(--i; i >= 0; --i) { // right to left distribution
- const t_symbol *sym = NULL;
- if(IsFloat(argv[i])) sym = sym_float;
- else if(IsInt(argv[i])) sym = sym_int;
- else if(IsSymbol(argv[i])) sym = sym_symbol;
- #if FLEXT_SYS == FLEXT_SYS_PD && !defined(FLEXT_COMPATIBLE)
- else if(IsPointer(argv[i])) sym = sym_pointer; // can pointer atoms occur here?
- #endif
-
- if(sym) {
- trap = true;
- CbMethodHandler(i,sym,1,argv+i);
- trap = false;
- }
- }
-
- goto end;
- }
-
- ret = FindMethAny(inlet,s,argc,argv);
-
- if(!ret) ret = CbMethodResort(inlet,s,argc,argv);
- }
- catch(std::exception &x) {
- error("%s - %s: %s",thisName(),GetString(s),x.what());
- ret = false;
- }
- catch(const char *txt) {
- error("%s - %s: %s",thisName(),GetString(s),txt);
- ret = false;
- }
- catch(...) {
- error("%s - %s : Unknown exception while processing method",thisName(),GetString(s));
- ret = false;
- }
-
-end:
- curtag = NULL;
-
- return ret; // true if appropriate handler was found and called
-}
-
-bool flext_base::m_method_(int inlet,const t_symbol *s,int argc,const t_atom *argv)
-{
- post("%s: message unhandled - inlet:%i args:%i symbol:%s",thisName(),inlet,argc,s?GetString(s):"");
- return false;
-}
-
-bool flext_base::CbMethodResort(int inlet,const t_symbol *s,int argc,const t_atom *argv)
-{
- // call deprecated version
- return m_method_(inlet,s,argc,argv);
-}
diff --git a/externals/grill/flext/source/flmspbuffer.h b/externals/grill/flext/source/flmspbuffer.h
deleted file mode 100644
index 7810e7bc..00000000
--- a/externals/grill/flext/source/flmspbuffer.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file flmspbuffer.h
- \brief Definition of the Max/MSP buffer structure
- \internal
-
- This file comes from David Zicarellis inofficial package index.sit
- The latter is not easily found so i included the original file buffer.h with flext
-*/
-
-#if (FLEXT_SYS == FLEXT_SYS_MAX) && !defined(__FLEXT_MSPBUFFER_H)
-#define __FLEXT_MSPBUFFER_H
-
-enum {
- MAXCHAN = 4
-};
-
-enum {
- bi_basefreq = 0,
- bi_detune,
- bi_lowfreq,
- bi_hifreq,
- bi_lowvel,
- bi_hivel,
- bi_gain,
- bi_numparams
-};
-
-typedef struct _buffer
-{
- t_object b_obj; // doesn't have any signals so it doesn't need to be pxobject
- long b_valid; // flag is off during read replacement or editing operation
- float *b_samples; // stored with interleaved channels if multi-channel
- long b_frames; // number of sample frames (each one is sizeof(float) * b_nchans bytes)
- long b_nchans; // number of channels
- long b_size; // size of buffer in floats
- float b_sr; // sampling rate of the buffer
- float b_1oversr; // 1 / sr
- float b_msr; // sr * .001
- // Mac-specific stuff
- float *b_memory; // pointer to where memory starts (initial padding for interp)
- t_symbol *b_name;
- short b_vol;
- short b_space;
- // looping info (from AIFF file)
- long b_susloopstart; // in samples
- long b_susloopend; // in samples
- long b_relloopstart; // in samples
- long b_relloopend; // in samples
- // instrument info (from AIFF file)
- short b_inst[bi_numparams];
- // window stuff
- void *b_wind;
- double b_pixperfr;
- double b_frperpix;
- long b_imagesize;
- Point b_scroll;
- long b_scrollscale;
- long b_selbegin[MAXCHAN];
- long b_selend[MAXCHAN];
- long b_zoom;
- long b_zim[11];
- void *b_mouseout;
- long b_format; // 'AIFF' or 'Sd2f'
- t_symbol *b_filename; // last file read (not written) for readagain message
- long b_oldnchans; // used for resizing window in case of # of channels change
- void *b_doneout;
- long b_outputbytes; // number of bytes used for output sample (1-4)
- long b_modtime; // last modified time ("dirty" method)
-} t_buffer;
-
-#define BUFWIND(x) ((t_wind *)(x->b_wind))
-
-
-#endif
diff --git a/externals/grill/flext/source/flout.cpp b/externals/grill/flext/source/flout.cpp
deleted file mode 100644
index dae256a7..00000000
--- a/externals/grill/flext/source/flout.cpp
+++ /dev/null
@@ -1,332 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2006 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file flout.cpp
- \brief Implementation of the flext outlet functionality.
-*/
-
-#include "flext.h"
-#include "flinternal.h"
-#include <string.h>
-
-#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
-void flext_base::ToSysAtom(int n,const t_atom &at) const
-{
- outlet *o = GetOut(n);
- if(LIKELY(o)) {
- CRITON();
- if(IsSymbol(at))
- outlet_symbol((t_outlet *)o,const_cast<t_symbol *>(GetSymbol(at)));
- else if(IsFloat(at))
- outlet_float((t_outlet *)o,GetFloat(at));
-#if FLEXT_SYS == FLEXT_SYS_MAX
- else if(IsInt(at))
- outlet_flint((t_outlet *)o,GetInt(at));
-#endif
-#if FLEXT_SYS == FLEXT_SYS_PD
- else if(IsPointer(at))
- outlet_pointer((t_outlet *)o,GetPointer(at));
-#endif
- else
- error("Atom type not supported");
- CRITOFF();
- }
-}
-#else
-#error Not implemented
-#endif
-
-#if defined(FLEXT_THREADS)
- #if FLEXT_QMODE == 2
- #define CHKTHR() (LIKELY((IsSystemThread() || IsThread(flext::thrmsgid)) && !InDSP()))
- #else
- #define CHKTHR() (LIKELY(IsSystemThread() && !InDSP()))
- #endif
-#else
- #define CHKTHR() (LIKELY(!InDSP()))
-#endif
-
-void flext_base::ToOutBang(int n) const { if(CHKTHR()) ToSysBang(n); else ToQueueBang(n); }
-void flext_base::ToOutFloat(int n,float f) const { if(CHKTHR()) ToSysFloat(n,f); else ToQueueFloat(n,f); }
-void flext_base::ToOutInt(int n,int f) const { if(CHKTHR()) ToSysInt(n,f); else ToQueueInt(n,f); }
-void flext_base::ToOutSymbol(int n,const t_symbol *s) const { if(CHKTHR()) ToSysSymbol(n,s); else ToQueueSymbol(n,s); }
-void flext_base::ToOutAtom(int n,const t_atom &at) const { if(CHKTHR()) ToSysAtom(n,at); else ToQueueAtom(n,at); }
-void flext_base::ToOutList(int n,int argc,const t_atom *argv) const { if(CHKTHR()) ToSysList(n,argc,argv); else ToQueueList(n,argc,argv); }
-void flext_base::ToOutAnything(int n,const t_symbol *s,int argc,const t_atom *argv) const { if(CHKTHR()) ToSysAnything(n,s,argc,argv); else ToQueueAnything(n,s,argc,argv); }
-
-void flext::ToOutMsg(MsgBundle *mb) { if(CHKTHR()) ToSysMsg(mb); else ToQueueMsg(mb); }
-
-bool flext::Forward(const t_symbol *recv,const t_symbol *s,int argc,const t_atom *argv)
-{
- return CHKTHR()?SysForward(recv,s,argc,argv):QueueForward(recv,s,argc,argv);
-}
-
-
-bool flext_base::InitInlets()
-{
- bool ok = true;
-
- // incnt has number of inlets (any type)
- // insigs should be 0
-
- FLEXT_ASSERT(!insigs && !inlets);
-
- // ----------------------------------
- // create inlets
- // ----------------------------------
-
-#if FLEXT_SYS == FLEXT_SYS_MAX
- // copy inlet descriptions
- indesc = new char *[incnt];
- for(int i = 0; i < incnt; ++i) {
- xlet &x = inlist[i];
- indesc[i] = x.desc;
- x.desc = NULL;
- }
-#endif
-
-#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
- inlets = incnt > 1?new px_object *[incnt]:NULL;
-#endif
-
- // type info is now in list array
-#if FLEXT_SYS == FLEXT_SYS_PD
- {
- int cnt = 0;
- if(incnt >= 1) {
- xlet &xi = inlist[0]; // points to first inlet
- if(xi.tp == xlet_sig) ++insigs;
- // else leftmost inlet is already there...
- ++cnt;
-
-#if PD_MINOR_VERSION >= 37 && defined(PD_DEVEL_VERSION)
- // set tooltip
-// this is on a per-class basis... we cannot really use it here
-// if(xi.desc && *xi.desc) class_settip(thisClass(),gensym(xi.desc));
-#endif
- }
-
- for(int ix = 1; ix < incnt; ++ix,++cnt) {
- xlet &xi = inlist[ix]; // points to first inlet
- t_inlet *in = NULL;
- switch(xi.tp) {
- case xlet_float:
- case xlet_int: {
- if(ix > 9) {
- // proxy inlet needed
- (inlets[ix-1] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages
- in = inlet_new(&x_obj->obj,&inlets[ix-1]->obj.ob_pd, (t_symbol *)sym_float, (t_symbol *)sym_float);
- }
- else {
- inlets[ix-1] = NULL;
- static char sym[] = " ft ?";
- sym[4] = '0'+ix;
- in = inlet_new(&x_obj->obj, &x_obj->obj.ob_pd, (t_symbol *)sym_float, gensym(sym));
- }
- break;
- }
- case xlet_sym:
- (inlets[ix-1] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages
- in = inlet_new(&x_obj->obj,&inlets[ix-1]->obj.ob_pd, (t_symbol *)sym_symbol, (t_symbol *)sym_symbol);
- break;
- case xlet_list:
- (inlets[ix-1] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages
- in = inlet_new(&x_obj->obj,&inlets[ix-1]->obj.ob_pd, (t_symbol *)sym_list, (t_symbol *)sym_list);
- break;
- case xlet_any:
- (inlets[ix-1] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages
- in = inlet_new(&x_obj->obj,&inlets[ix-1]->obj.ob_pd, 0, 0);
- break;
- case xlet_sig:
- inlets[ix-1] = NULL;
-#ifdef FLEXT_COMPATIBLE
- if(inlist[ix-1].tp != xlet_sig) {
- post("%s: All signal inlets must be left-aligned in compatibility mode",thisName());
- ok = false;
- }
- else
-#endif
- {
- // pd is not able to handle signals and messages into the same inlet...
- in = inlet_new(&x_obj->obj, &x_obj->obj.ob_pd, (t_symbol *)sym_signal, (t_symbol *)sym_signal);
- ++insigs;
- }
- break;
- default:
- inlets[ix-1] = NULL;
- error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)inlist[ix].tp);
- ok = false;
- }
-
-#if PD_MINOR_VERSION >= 37 && defined(PD_DEVEL_VERSION)
- // set tooltip
- if(in && xi.desc && *xi.desc) inlet_settip(in,gensym(xi.desc));
-#endif
- }
-
- incnt = cnt;
- }
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- {
- int ix,cnt;
- // count leftmost signal inlets
- while(insigs < incnt && inlist[insigs].tp == xlet_sig) ++insigs;
-
- for(cnt = 0,ix = incnt-1; ix >= insigs; --ix,++cnt) {
- xlet &xi = inlist[ix];
- if(ix == 0) {
- if(xi.tp != xlet_any) {
- error("%s: Leftmost inlet must be of type signal or anything",thisName());
- ok = false;
- }
- }
- else {
- switch(xi.tp) {
- case xlet_sig:
- inlets[ix-1] = NULL;
- error("%s: All signal inlets must be left-aligned",thisName());
- ok = false;
- break;
- case xlet_float: {
- if(ix < 10) {
- inlets[ix-1] = NULL;
- floatin(x_obj,ix);
- break;
- }
- else
- goto makeproxy;
- }
- case xlet_int: {
- if(ix < 10) {
- inlets[ix-1] = NULL;
- intin(x_obj,ix);
- break;
- }
- else
- goto makeproxy;
- }
- makeproxy:
- case xlet_any: // non-leftmost
- case xlet_sym:
- case xlet_list:
- inlets[ix-1] = (px_object *)proxy_new(x_obj,ix,&((flext_hdr *)x_obj)->curinlet);
- break;
- default:
- inlets[ix-1] = NULL;
- error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)xi.tp);
- ok = false;
- }
- }
- }
-
- while(ix > 0) inlets[ix--] = NULL;
- }
-#else
-#error
-#endif
-
- return ok;
-}
-
-bool flext_base::InitOutlets()
-{
- bool ok = true;
- int procattr = HasAttributes()?1:0;
-
- // outcnt has number of inlets (any type)
- // outsigs should be 0
-
- FLEXT_ASSERT(outsigs == 0);
-
- // ----------------------------------
- // create outlets
- // ----------------------------------
-
-#if FLEXT_SYS == FLEXT_SYS_MAX
- // for Max/MSP the rightmost outlet has to be created first
- outlet *attrtmp = NULL;
- if(procattr)
- attrtmp = (outlet *)newout_anything(thisHdr());
-#endif
-
-#if FLEXT_SYS == FLEXT_SYS_MAX
- // copy outlet descriptions
- outdesc = new char *[outcnt];
- for(int i = 0; i < outcnt; ++i) {
- xlet &xi = outlist[i];
- outdesc[i] = xi.desc;
- xi.desc = NULL;
- }
-#endif
-
-#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
- if(outcnt+procattr)
- outlets = new outlet *[outcnt+procattr];
- else
- outlets = NULL;
-
- // type info is now in list array
-#if FLEXT_SYS == FLEXT_SYS_PD
- for(int ix = 0; ix < outcnt; ++ix)
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- for(int ix = outcnt-1; ix >= 0; --ix)
-#else
-#error
-#endif
- {
- switch(outlist[ix].tp) {
- case xlet_float:
- outlets[ix] = (outlet *)newout_float(&x_obj->obj);
- break;
- case xlet_int:
- outlets[ix] = (outlet *)newout_flint(&x_obj->obj);
- break;
- case xlet_sig:
- outlets[ix] = (outlet *)newout_signal(&x_obj->obj);
- ++outsigs;
- break;
- case xlet_sym:
- outlets[ix] = (outlet *)newout_symbol(&x_obj->obj);
- break;
- case xlet_list:
- outlets[ix] = (outlet *)newout_list(&x_obj->obj);
- break;
- case xlet_any:
- outlets[ix] = (outlet *)newout_anything(&x_obj->obj);
- break;
-#ifdef FLEXT_DEBUG
- default:
- ERRINTERNAL();
- ok = false;
-#endif
- }
- }
-#else
-#error
-#endif
-
-#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
- if(procattr) {
- // attribute dump outlet is the last one
- outlets[outcnt] =
-#if FLEXT_SYS == FLEXT_SYS_PD
- // attribute dump outlet is the last one
- (outlet *)newout_anything(&x_obj->obj);
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- attrtmp;
-#endif
-
- }
-#endif
-
- return ok;
-}
-
-
diff --git a/externals/grill/flext/source/flprefix.h b/externals/grill/flext/source/flprefix.h
deleted file mode 100644
index 094dacf7..00000000
--- a/externals/grill/flext/source/flprefix.h
+++ /dev/null
@@ -1,433 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2006 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file flprefix.h
- \brief Try to find out the platform.
-*/
-
-#ifndef __FLEXT_PREFIX_H
-#define __FLEXT_PREFIX_H
-
-// --- definitions for FLEXT_SYS ---------------------
-#define FLEXT_SYS_UNKNOWN 0
-
-#ifndef FLEXT_SYS_MAX
- #define FLEXT_SYS_MAX 1
-#else
- // already defined
- #undef FLEXT_SYS_MAX
- #define FLEXT_SYS_MAX 1
- #define FLEXT_SYS FLEXT_SYS_MAX
-#endif
-
-#ifndef FLEXT_SYS_PD
- #define FLEXT_SYS_PD 2
-#else
- // already defined
- #undef FLEXT_SYS_PD
- #define FLEXT_SYS_PD 2
- #define FLEXT_SYS FLEXT_SYS_PD
-#endif
-
-#ifndef FLEXT_SYS_JMAX
- #define FLEXT_SYS_JMAX 3
-#else
- // already defined
- #undef FLEXT_SYS_JMAX
- #define FLEXT_SYS_JMAX 3
- #define FLEXT_SYS FLEXT_SYS_JMAX
-#endif
-
-// --- definitions for FLEXT_OS ----------------------
-#define FLEXT_OS_UNKNOWN 0
-#define FLEXT_OS_WIN 1
-#define FLEXT_OS_MAC 2
-#define FLEXT_OS_LINUX 3
-#define FLEXT_OS_IRIX 4
-
-// --- definitions for FLEXT_OS_API ---------------------
-#define FLEXT_OSAPI_UNKNOWN 0
-
-#define FLEXT_OSAPI_UNIX_POSIX 1
-
-#define FLEXT_OSAPI_MAC_CLASSIC 2
-#define FLEXT_OSAPI_MAC_CARBON 3
-#define FLEXT_OSAPI_MAC_MACH 4
-
-#define FLEXT_OSAPI_WIN_NATIVE 5 // WIN32 Platform
-#define FLEXT_OSAPI_WIN_POSIX 6 // POSIX API (e.g. cygwin)
-
-// --- definitions for FLEXT_CPU ---------------------
-#define FLEXT_CPU_UNKNOWN 0
-#define FLEXT_CPU_IA32 1
-#define FLEXT_CPU_PPC 2
-#define FLEXT_CPU_MIPS 3
-#define FLEXT_CPU_ALPHA 4
-
-#define FLEXT_CPU_IA64 5 // Itanium
-#define FLEXT_CPU_X86_64 6 // AMD-K8, EMT64
-
-// compatibility
-#define FLEXT_CPU_INTEL FLEXT_CPU_IA32
-
-// --- definitions for FLEXT_THREADS -----------------
-#define FLEXT_THR_POSIX 1 // pthreads
-#define FLEXT_THR_WIN32 2 // Win32 native
-#define FLEXT_THR_MP 3 // MacOS MPThreads
-
-// ---------------------------------------------------
-// support old definitions
-
-#ifndef FLEXT_SYS
- #if defined(MAXMSP)
- #define FLEXT_SYS FLEXT_SYS_MAX
- // #undef MAXMSP
- #elif defined(PD)
- #define FLEXT_SYS FLEXT_SYS_PD
- // #undef PD
- // #undef NT
- #endif
-#endif
-
-#if defined(_DEBUG) && !defined(FLEXT_DEBUG)
- #define FLEXT_DEBUG
-#endif
-
-// ---------------------------------------------------
-
-// Definition of supported real-time systems
-#if FLEXT_SYS == FLEXT_SYS_MAX
-#elif FLEXT_SYS == FLEXT_SYS_PD
-#elif FLEXT_SYS == FLEXT_SYS_JMAX
-#else
- #error "System must be defined by either FLEXT_SYS_MAX, FLEXT_SYS_PD or FLEXT_SYS_JMAX"
-#endif
-
-// Definition of OS/CPU
-#if defined(_MSC_VER) || (defined(__ICC) && (FLEXT_OS == FLEXT_OS_WIN || defined(_WIN32)))
- // Microsoft C++
- // and Intel C++ (as guessed)
-
- #ifndef FLEXT_CPU
- #if defined(_M_AMD64)
- #define FLEXT_CPU FLEXT_CPU_X86_64
- #elif defined(_M_IA64)
- #define FLEXT_CPU FLEXT_CPU_IA64
- #elif defined(_M_IX86)
- #define FLEXT_CPU FLEXT_CPU_IA32
- #elif defined(_M_PPC)
- #define FLEXT_CPU FLEXT_CPU_PPC
- #elif defined(_M_MRX000)
- #define FLEXT_CPU FLEXT_CPU_MIPS
- #elif defined(_M_ALPHA)
- #define FLEXT_CPU FLEXT_CPU_ALPHA
- #else
- #define FLEXT_CPU FLEXT_CPU_UNKNOWN
- #endif
- #endif
-
- #ifndef FLEXT_OS
- #if defined(_WIN32) || defined(_WIN64)
- #define FLEXT_OS FLEXT_OS_WIN
- #define FLEXT_OSAPI FLEXT_OSAPI_WIN_NATIVE
- #else
- #define FLEXT_OS FLEXT_OS_UNKNOWN
- #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN
- #endif
- #endif
-
-
-#elif defined(__BORLANDC__)
- // Borland C++
-
- #ifndef FLEXT_CPU
- #define FLEXT_CPU FLEXT_CPU_INTEL
- #endif
- #ifndef FLEXT_OS
- #define FLEXT_OS FLEXT_OS_WIN
- #define FLEXT_OSAPI FLEXT_OSAPI_WIN_NATIVE
- #else
- #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN
- #endif
-
-
-#elif defined(__MWERKS__)
- // Metrowerks CodeWarrior
-
- #ifdef __MACH__
- // quick fix for OSX Mach-O
- #define TARGET_CPU_PPC 1
- #define TARGET_OS_MAC 1
- #define TARGET_API_MAC_OSX 1
- #else
- #ifndef __CONDITIONALMACROS__
- #include <ConditionalMacros.h>
- #endif
- #endif
-
- #ifndef FLEXT_CPU
- #if TARGET_CPU_X86
- #define FLEXT_CPU FLEXT_CPU_INTEL
- #elif TARGET_CPU_PPC
- #define FLEXT_CPU FLEXT_CPU_PPC
- #elif TARGET_CPU_MIPS
- #define FLEXT_CPU FLEXT_CPU_MIPS
- #elif TARGET_CPU_ALPHA
- #define FLEXT_CPU FLEXT_CPU_ALPHA
- #else
- #define FLEXT_CPU FLEXT_CPU_UNKNOWN
- #endif
- #endif
-
- #ifndef FLEXT_OS
- #if TARGET_OS_MAC
- #define FLEXT_OS FLEXT_OS_MAC
- #elif TARGET_OS_WIN32
- // assume Windows
- #define FLEXT_OS FLEXT_OS_WIN
- #else
- #define FLEXT_OS FLEXT_OS_UNKNOWN
- #endif
- #endif
-
- #ifndef FLEXT_OSAPI
- #if TARGET_API_MAC_MACH
- // this is for Mach-O
- // this has the precedence (MACH also supports Carbon, of course)
- #define FLEXT_OSAPI FLEXT_OSAPI_MAC_MACH
- #elif TARGET_API_MAC_CARBON
- // this is for CFM
- #define FLEXT_OSAPI FLEXT_OSAPI_MAC_CARBON
- #else
- #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN
- #endif
- #endif
-
- // This is important for method and attribute callbacks
- #pragma enumsalwaysint on
- // This is important for everything
- #pragma bool on
-
-#elif defined(__GNUG__) || (defined(__ICC) && (FLEXT_OS == FLEXT_OS_LINUX || defined(linux) || defined(__linux__)))
-
- // GNU C++
- // and Intel (as suggested by Tim Blechmann)
-
- #ifndef FLEXT_CPU
- #if defined(__x86_64__) // not sure about this one
- #define FLEXT_CPU FLEXT_CPU_X86_64
- #elif defined(_X86_) || defined(__i386__) || defined(__i586__) || defined(__i686__)
- #define FLEXT_CPU FLEXT_CPU_IA32
- #elif defined(__POWERPC__)
- #define FLEXT_CPU FLEXT_CPU_PPC
- #elif defined(__MIPS__)
- #define FLEXT_CPU FLEXT_CPU_MIPS
- #else
- #define FLEXT_CPU FLEXT_CPU_UNKNOWN
- #endif
- #endif
-
- #ifndef FLEXT_OS
- #if defined(linux) || defined(__linux__)
- #define FLEXT_OS FLEXT_OS_LINUX
- #elif defined(__CYGWIN__) || defined(__CYGWIN32__) || defined(__MINGW32__)
- #define FLEXT_OS FLEXT_OS_WIN
- #elif defined(__APPLE__) && defined(__MACH__)
- #define FLEXT_OS FLEXT_OS_MAC
- // how about IRIX??
- #else
- #define FLEXT_OS FLEXT_OS_UNKNOWN
- #endif
- #endif
-
- #ifndef FLEXT_OSAPI
- #if FLEXT_OS == FLEXT_OS_MAC
- #define FLEXT_OSAPI FLEXT_OSAPI_MAC_MACH
- #elif FLEXT_OS == FLEXT_OS_WIN
- #if defined(__MINGW32__)
- #define FLEXT_OSAPI FLEXT_OSAPI_WIN_NATIVE
- #else
- #define FLEXT_OSAPI FLEXT_OSAPI_WIN_POSIX
- #endif
- #elif FLEXT_OS == FLEXT_OS_LINUX || FLEXT_OS == FLEXT_OS_IRIX
- #define FLEXT_OSAPI FLEXT_OSAPI_UNIX_POSIX
- #else
- #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN
- #endif
- #endif
-
-#elif defined(__MRC__) && defined(MPW_CPLUS)
- // Apple MPW MrCpp
-
- #if __MRC__ < 0x500
- #error Apple MPW MrCpp v.5.0.0 or later compiler required
- #endif
-
- #ifndef FLEXT_CPU
- #if defined(__POWERPC__)
- #define FLEXT_CPU FLEXT_CPU_PPC
- #else
- #define FLEXT_CPU FLEXT_CPU_UNKNOWN
- #endif
- #endif
-
- #ifndef FLEXT_OS
- #if defined(macintosh)
- #define FLEXT_OS FLEXT_OS_MAC
- #else
- #define FLEXT_OS FLEXT_OS_UNKNOWN
- #endif
- #endif
-
- #ifndef FLEXT_OSAPI
- #if FLEXT_OS == FLEXT_OS_MAC
- #define FLEXT_OSAPI FLEXT_OSAPI_MAC_CLASSIC
- #else
- #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN
- #endif
- #endif
-#endif
-
-
-
-#if FLEXT_OS == FLEXT_OS_WIN
-// #pragma message("Compiling for Windows")
-
- #if FLEXT_SYS == FLEXT_SYS_MAX
-// #define WIN_VERSION 1
- #elif FLEXT_SYS == FLEXT_SYS_PD
-// #define PD
-// #define NT
- #endif
-#elif FLEXT_OS == FLEXT_OS_LINUX
-// #pragma message("Compiling for Linux")
-
- #if FLEXT_SYS == FLEXT_SYS_PD
-// #define PD
- #else
- #error "Flext SYS/OS combination unknown"
- #endif
-#elif FLEXT_OS == FLEXT_OS_IRIX
-// #pragma message("Compiling for Irix")
-
- #if FLEXT_SYS == FLEXT_SYS_PD
-// #define PD
- #else
- #error "Flext SYS/OS combination unknown"
- #endif
-#elif FLEXT_OS == FLEXT_OS_MAC
-// #pragma message("Compiling for MacOS")
-
- #if FLEXT_SYS == FLEXT_SYS_PD
-// #define PD
- #endif
-#else
- #error "Operating system could not be determined"
-#endif
-
-#if FLEXT_SYS == FLEXT_SYS_MAX
-// #pragma message("Compiling for Max/MSP")
-#elif FLEXT_SYS == FLEXT_SYS_PD
-// #pragma message("Compiling for PD")
-#endif
-
-// ----- set threading model -----
-// shared builds are always threaded
-#ifdef FLEXT_SHARED
- #undef FLEXT_THREADS
- #define FLEXT_THREADS
-#endif
-
-#ifdef FLEXT_THREADS
- #undef FLEXT_THREADS
- #if FLEXT_SYS == FLEXT_SYS_MAX && FLEXT_OS == FLEXT_OS_MAC && FLEXT_OSAPI != FLEXT_OSAPI_MAC_MACH
- // Max for CFM doesn't like posix threads
- #define FLEXT_THREADS FLEXT_THR_MP
- #elif FLEXT_SYS == FLEXT_SYS_MAX && FLEXT_OS == FLEXT_OS_WIN
- // for wmax use native Windows threads
- #define FLEXT_THREADS FLEXT_THR_WIN32
- #else
- #define FLEXT_THREADS FLEXT_THR_POSIX
- #endif
-#endif
-
-// ----- macros for class names -----
-/*
- With linux (flat linker namespace) and more than one flext-based external loaded all calls to static
- exported functions refer to the first instance loaded!
- Therefore different class names are used so that the correct type of flext function is called.
-*/
-#ifdef __DOXYGEN__
- #define FLEXT_CLASSDEF(CL) CL
-#elif defined(FLEXT_DEBUG)
- #if defined(FLEXT_SHARED)
- #define FLEXT_CLASSDEF(CL) CL##_shared_d
- #elif defined(FLEXT_THREADS)
- #define FLEXT_CLASSDEF(CL) CL##_multi_d
- #else
- #define FLEXT_CLASSDEF(CL) CL##_single_d
- #endif
-#else
- #if defined(FLEXT_SHARED)
- #define FLEXT_CLASSDEF(CL) CL##_shared
- #elif defined(FLEXT_THREADS)
- #define FLEXT_CLASSDEF(CL) CL##_multi
- #else
- #define FLEXT_CLASSDEF(CL) CL##_single
- #endif
-#endif
-
-
-/* Set the right calling convention (and exporting) for the OS */
-
-#if defined(_WIN32)
- #ifdef FLEXT_SHARED
- // for compiling a shared flext library FLEXT_EXPORTS must be defined
- #ifdef FLEXT_EXPORTS
- #define FLEXT_SHARE __declspec(dllexport)
- #else
- #define FLEXT_SHARE __declspec(dllimport)
- #endif
- #else
- #define FLEXT_SHARE
- #endif
- #define FLEXT_EXT __declspec(dllexport)
-#else // other OS's
- #define FLEXT_SHARE
- #define FLEXT_EXT
-#endif
-
-
-// std namespace
-#ifdef __MWERKS__
-# define STD std
-#else
-# define STD
-#endif
-
-// branching hints
-#ifdef __GNUC__
-# ifndef LIKELY
-# define LIKELY(expression) (__builtin_expect(!!(expression), 1))
-# endif
-# ifndef UNLIKELY
-# define UNLIKELY(expression) (__builtin_expect(!!(expression), 0))
-# endif
-#else
-# ifndef LIKELY
-# define LIKELY(expression) (expression)
-# endif
-# ifndef UNLIKELY
-# define UNLIKELY(expression) (expression)
-# endif
-#endif
-
-
-#endif // __FLEXT_PREFIX_H
diff --git a/externals/grill/flext/source/flproxy.cpp b/externals/grill/flext/source/flproxy.cpp
deleted file mode 100644
index 6126d4b7..00000000
--- a/externals/grill/flext/source/flproxy.cpp
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2006 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file flproxy.cpp
- \brief Proxy classes for the flext base class.
-*/
-
-#include "flext.h"
-#include "flinternal.h"
-
-
-// === proxy class for flext_base ============================
-
-#if FLEXT_SYS == FLEXT_SYS_PD
-
-t_class *flext_base::px_class = NULL;
-
-void flext_base::px_object::px_bang(px_object *obj)
-{
- obj->base->CbMethodHandler(obj->index,sym_bang,0,NULL);
-}
-
-void flext_base::px_object::px_float(px_object *obj,t_float f)
-{
- t_atom a; SetFloat(a,f);
- obj->base->CbMethodHandler(obj->index,sym_float,1,&a);
-}
-
-void flext_base::px_object::px_symbol(px_object *obj,const t_symbol *s)
-{
- t_atom a; SetSymbol(a,s);
- obj->base->CbMethodHandler(obj->index,sym_symbol,1,&a);
-}
-
-/*
-void flext_base::px_object::px_pointer(px_object *obj,const t_gpointer *p)
-{
- t_atom a; SetPointer(a,p);
- obj->base->CbMethodHandler(obj->index,sym_pointer,1,&a);
-}
-*/
-
-void flext_base::px_object::px_anything(px_object *obj,const t_symbol *s,int argc,t_atom *argv)
-{
- obj->base->CbMethodHandler(obj->index,s,argc,argv);
-}
-
-void flext_base::cb_bang(flext_hdr *c)
-{
- thisObject(c)->CbMethodHandler(0,sym_bang,0,NULL);
-}
-
-void flext_base::cb_float(flext_hdr *c,t_float f)
-{
- t_atom a; SetFloat(a,f);
- thisObject(c)->CbMethodHandler(0,sym_float,1,&a);
-}
-
-void flext_base::cb_symbol(flext_hdr *c,const t_symbol *s)
-{
- t_atom a; SetSymbol(a,s);
- thisObject(c)->CbMethodHandler(0,sym_symbol,1,&a);
-}
-
-/*
-void flext_base::cb_pointer(flext_hdr *c,const t_gpointer *p)
-{
- t_atom a; SetPointer(a,p);
- thisObject(c)->CbMethodHandler(0,sym_pointer,1,&a);
-}
-*/
-
-void flext_base::cb_anything(flext_hdr *c,const t_symbol *s,int argc,t_atom *argv)
-{
- if(UNLIKELY(!s)) {
- // apparently, this happens only in one case... object is a DSP object, but has no main DSP inlet...
-
- // interpret tag from args
- if(!argc)
- s = sym_bang;
- else if(argc == 1) {
- if(IsFloat(*argv))
- s = sym_float;
- else if(IsSymbol(*argv))
- s = sym_symbol;
- else if(IsPointer(*argv))
- s = sym_pointer;
- else
- FLEXT_ASSERT(false);
- }
- else
- s = sym_list;
- }
-
- thisObject(c)->CbMethodHandler(0,s,argc,argv);
-}
-
-#define DEF_PROXYMSG(IX) \
-void flext_base::cb_px_ft ## IX(flext_hdr *c,t_float v) { t_atom atom; SetFloat(atom,v); thisObject(c)->CbMethodHandler(IX,sym_float,1,&atom); }
-
-#define ADD_PROXYMSG(c,IX) \
-add_method1(c,cb_px_ft ## IX," ft " #IX,A_FLOAT)
-
-//AddMethod(c,0,flext::MakeSymbol("ft" #IX),cb_px_ft ## IX)
-
-
-#elif FLEXT_SYS == FLEXT_SYS_MAX
-
-void flext_base::cb_anything(flext_hdr *c,const t_symbol *s,short argc,t_atom *argv)
-{
- int ci = ((flext_hdr *)c)->curinlet;
- thisObject(c)->CbMethodHandler(ci,s,argc,argv);
-}
-
-void flext_base::cb_int(flext_hdr *c,long v)
-{
- t_atom atom; SetInt(atom,v);
- int ci = ((flext_hdr *)c)->curinlet;
- thisObject(c)->CbMethodHandler(ci,sym_int,1,&atom);
-}
-
-void flext_base::cb_float(flext_hdr *c,double v)
-{
- t_atom atom; SetFloat(atom,v);
- int ci = ((flext_hdr *)c)->curinlet;
- thisObject(c)->CbMethodHandler(ci,sym_float,1,&atom);
-}
-
-void flext_base::cb_bang(flext_hdr *c)
-{
- int ci = ((flext_hdr *)c)->curinlet;
- thisObject(c)->CbMethodHandler(ci,sym_bang,0,NULL);
-}
-
-
-#define DEF_PROXYMSG(IX) \
-void flext_base::cb_px_in ## IX(flext_hdr *c,long v) { t_atom atom; SetInt(atom,v); thisObject(c)->CbMethodHandler(IX,sym_int,1,&atom); } \
-void flext_base::cb_px_ft ## IX(flext_hdr *c,double v) { t_atom atom; SetFloat(atom,v); thisObject(c)->CbMethodHandler(IX,sym_float,1,&atom); }
-
-/*
-void flext_base::cb_px_in ## IX(flext_hdr *c,long v) { t_atom atom; SetInt(atom,v); thisObject(c)->CbMethodHandler(IX,sym_int,1,&atom); } \
-void flext_base::cb_px_ft ## IX(flext_hdr *c,double v) { t_atom atom; SetFloat(atom,v); thisObject(c)->CbMethodHandler(IX,sym_float,1,&atom); }
-*/
-
-#define ADD_PROXYMSG(c,IX) \
-addinx((method)(cb_px_in ## IX),IX); \
-addftx((method)(cb_px_ft ## IX),IX)
-
-/*
-add_method1(c,cb_px_in ## IX,"in" #IX,A_INT); \
-add_method1(c,cb_px_ft ## IX,"ft" #IX,A_FLOAT)
-
-AddMethod(c,0,flext::MakeSymbol("in" #IX),cb_px_in ## IX); \
-AddMethod(c,0,flext::MakeSymbol("ft" #IX),cb_px_ft ## IX)
-*/
-
-#endif
-
-#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
-
-DEF_PROXYMSG(1)
-DEF_PROXYMSG(2)
-DEF_PROXYMSG(3)
-DEF_PROXYMSG(4)
-DEF_PROXYMSG(5)
-DEF_PROXYMSG(6)
-DEF_PROXYMSG(7)
-DEF_PROXYMSG(8)
-DEF_PROXYMSG(9)
-
-
-void flext_base::SetProxies(t_class *c,bool dsp)
-{
-#if FLEXT_SYS == FLEXT_SYS_PD
- // for leftmost inlet
- class_addbang(c,cb_bang);
- if(!dsp) class_addfloat(c,cb_float);
- class_addsymbol(c,cb_symbol);
-// class_addpointer(c,cb_pointer);
- class_addlist(c,cb_anything);
- class_addanything(c,cb_anything);
-
- // proxy for extra inlets
- if(!px_class) {
- // only once
- px_class = class_new(gensym(" flext_base proxy "),NULL,NULL,sizeof(px_object),CLASS_PD|CLASS_NOINLET, A_NULL);
- class_addbang(px_class,px_object::px_bang); // for other inlets
- class_addfloat(px_class,px_object::px_float); // for other inlets
- class_addsymbol(px_class,px_object::px_symbol); // for other inlets
-// class_addpointer(px_class,px_object::px_pointer); // for other inlets
- class_addlist(px_class,px_object::px_anything); // for other inlets
- class_addanything(px_class,px_object::px_anything); // for other inlets
- }
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- addbang((method)cb_bang);
- addint((method)cb_int);
- addfloat((method)cb_float);
- addmess((method)cb_anything,"list",A_GIMME,A_NOTHING); // must be explicitly given, otherwise list elements are distributes over inlets
- addmess((method)cb_anything,"anything",A_GIMME,A_NOTHING);
-#else
-#error Not implemented!
-#endif
-
- // setup non-leftmost ints and floats
- ADD_PROXYMSG(c,1);
- ADD_PROXYMSG(c,2);
- ADD_PROXYMSG(c,3);
- ADD_PROXYMSG(c,4);
- ADD_PROXYMSG(c,5);
- ADD_PROXYMSG(c,6);
- ADD_PROXYMSG(c,7);
- ADD_PROXYMSG(c,8);
- ADD_PROXYMSG(c,9);
-}
-#endif
diff --git a/externals/grill/flext/source/flqueue.cpp b/externals/grill/flext/source/flqueue.cpp
deleted file mode 100644
index c3abbc52..00000000
--- a/externals/grill/flext/source/flqueue.cpp
+++ /dev/null
@@ -1,559 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file flqueue.cpp
- \brief Implementation of the flext message queuing functionality.
-
- \todo Let's see if queuing can be implemented for Max/MSP with defer_low
-
- if FLEXT_PDLOCK is defined, the new PD thread lock functions are used
-*/
-
-#include "flext.h"
-#include "flinternal.h"
-#include "flcontainers.h"
-#include <string.h> // for memcpy
-
-#ifdef FLEXT_THREADS
-//! Thread id of message queue thread
-flext::thrid_t flext::thrmsgid;
-#endif
-
-static bool qustarted = false;
-
-#ifdef FLEXT_SHARED
-/*
- For the shared version it _should_ be possible to have only one queue for all externals.
- Yet I don't know how to do this cross-platform
-*/
-#define PERMANENTIDLE
-#endif
-
-static void Trigger();
-
-
-class flext::MsgBundle;
-
-typedef PooledFifo<flext::MsgBundle> QueueFifo;
-
-class Queue:
- public flext,
- public QueueFifo
-{
-public:
- inline bool Empty() const { return Size() == 0; }
-
- inline void Push(MsgBundle *m); // defined after MsgBundle (gcc 3.3. won't take it otherwise...)
-};
-
-static Queue queue;
-
-
-#define STATSIZE 8
-
-class flext::MsgBundle:
- public flext,
- public Fifo::Cell
-{
-public:
- static MsgBundle *New()
- {
- MsgBundle *m = queue.New();
- m->msg.Init();
- return m;
- }
-
- static void Free(MsgBundle *m)
- {
- for(Msg *mi = m->msg.nxt; mi; ) {
- Msg *mn = mi->nxt;
- mi->Free();
- delete mi;
- mi = mn;
- }
- m->msg.Free();
- queue.Free(m);
- }
-
- inline MsgBundle &Add(flext_base *t,int o,const t_symbol *s,int ac,const t_atom *av)
- {
- Get()->Set(t,o,s,ac,av);
- return *this;
- }
-
- inline MsgBundle &Add(const t_symbol *r,const t_symbol *s,int ac,const t_atom *av)
- {
- Get()->Set(r,s,ac,av);
- return *this;
- }
-
- inline MsgBundle &Add(flext_base *th,int o) // bang
- {
- return Add(th,o,sym_bang,0,NULL);
- }
-
- inline MsgBundle &Add(flext_base *th,int o,float dt)
- {
- t_atom at;
- SetFloat(at,dt);
- return Add(th,o,sym_float,1,&at);
- }
-
- inline MsgBundle &Add(flext_base *th,int o,int dt)
- {
- t_atom at;
- SetInt(at,dt);
- const t_symbol *sym;
-#if FLEXT_SYS == FLEXT_SYS_PD
- sym = sym_float;
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- sym = sym_int;
-#else
-#error Not implemented!
-#endif
- return Add(th,o,sym,1,&at);
- }
-
- inline MsgBundle &Add(flext_base *th,int o,const t_symbol *dt)
- {
- t_atom at;
- SetSymbol(at,dt);
- return Add(th,o,sym_symbol,1,&at);
- }
-
- inline MsgBundle &Add(flext_base *th,int o,const t_atom &a)
- {
- const t_symbol *sym;
- if(IsSymbol(a))
- sym = sym_symbol;
- else if(IsFloat(a))
- sym = sym_float;
-#if FLEXT_SYS == FLEXT_SYS_MAX
- else if(IsInt(a))
- sym = sym_int;
-#endif
-#if FLEXT_SYS == FLEXT_SYS_PD
- else if(IsPointer(a))
- sym = sym_pointer;
-#endif
- else {
- error("atom type not supported");
- return *this;
- }
- return Add(th,o,sym,1,&a);
- }
-
- inline MsgBundle &Add(flext_base *th,int o,int argc,const t_atom *argv)
- {
- return Add(th,o,sym_list,argc,argv);
- }
-
- // \note PD sys lock must already be held by caller
- inline void Send() const
- {
- if(!msg.Ok()) return; // Empty!
-
- const Msg *m = &msg;
- do {
- m->Send();
- m = m->nxt;
- } while(m);
- }
-
-private:
-
- class Msg {
- public:
- inline bool Ok() const { return th || recv; }
-
- void Init()
- {
- th = NULL;
- recv = NULL;
- nxt = NULL;
- argc = 0;
- }
-
- void Free()
- {
- if(argc > STATSIZE) {
- FLEXT_ASSERT(argv);
- delete[] argv;
- }
- }
-
- void Set(flext_base *t,int o,const t_symbol *s,int ac,const t_atom *av)
- {
- FLEXT_ASSERT(t);
- th = t;
- out = o;
- SetMsg(s,ac,av);
-}
-
- void Set(const t_symbol *r,const t_symbol *s,int ac,const t_atom *av)
- {
- FLEXT_ASSERT(r);
- th = NULL;
- recv = r;
- SetMsg(s,ac,av);
- }
-
- void Send() const
- {
- if(th) {
- if(UNLIKELY(out < 0))
- // message to self
- th->CbMethodHandler(-1-out,sym,argc,argc > STATSIZE?argv:argl);
- else
- // message to outlet
- th->ToSysAnything(out,sym,argc,argc > STATSIZE?argv:argl);
- }
- else
- flext::SysForward(recv,sym,argc,argc > STATSIZE?argv:argl);
- }
-
- Msg *nxt;
-
- protected:
- flext_base *th;
- union {
- int out;
- const t_symbol *recv;
- };
- const t_symbol *sym;
- int argc;
- union {
- t_atom *argv;
- t_atom argl[STATSIZE];
- };
-
- void SetMsg(const t_symbol *s,int cnt,const t_atom *lst)
- {
- sym = s;
- argc = cnt;
- if(UNLIKELY(cnt > STATSIZE)) {
- argv = new t_atom[cnt];
- flext::CopyAtoms(cnt,argv,lst);
- }
- else
- flext::CopyAtoms(cnt,argl,lst);
- }
-
- } msg;
-
- Msg *Get()
- {
- Msg *m = &msg;
- if(LIKELY(m->Ok())) {
- for(; m->nxt; m = m->nxt) {}
- m = m->nxt = new Msg;
- m->Init();
- }
- return m;
- }
-};
-
-inline void Queue::Push(MsgBundle *m)
-{
- if(LIKELY(m)) {
- Put(m);
- Trigger();
- }
-}
-
-#if FLEXT_QMODE == 2
-static flext::ThrCond qthrcond;
-#elif FLEXT_QMODE == 0
-//static t_qelem *qclk = NULL;
-static t_clock *qclk = NULL;
-#endif
-
-
-#define CHUNK 10
-
-static void QWork(bool syslock)
-{
- for(;;) {
- // Since qcnt can only be increased from any other function than QWork
- // qc will be a minimum guaranteed number of present queue elements.
- // On the other hand, if new queue elements are added by the methods called
- // in the loop, these will be sent in the next tick to avoid recursion overflow.
- size_t qc = queue.Size();
- if(!qc) break;
-
- #if FLEXT_QMODE == 2
- if(syslock) flext::Lock();
- #endif
-
- flext::MsgBundle *q;
- while((q = queue.Get()) != NULL) {
- q->Send();
- flext::MsgBundle::Free(q);
- }
-
- #if FLEXT_QMODE == 2
- if(syslock) flext::Unlock();
- #endif
-
- }
-}
-
-#if FLEXT_QMODE == 0
-#if FLEXT_SYS == FLEXT_SYS_JMAX
-static void QTick(fts_object_t *c,int winlet, fts_symbol_t s, int ac, const fts_atom_t *at)
-{
-#else
-static void QTick(flext_base *c)
-{
-#endif
-#ifdef FLEXT_THREADS
- FLEXT_ASSERT(flext::IsSystemThread());
-#endif
- QWork(false);
-}
-
-#elif FLEXT_QMODE == 1
-#ifndef PERMANENTIDLE
-static bool qtickactive = false;
-#endif
-static t_int QTick(t_int *)
-{
-#ifndef PERMANENTIDLE
- qtickactive = false;
-#endif
-
- QWork(false);
-
-#ifdef PERMANENTIDLE
- // will be run in the next idle cycle
- return 2;
-#else
- // won't be run again
- // for non-shared externals assume that there's rarely a message waiting
- // so it's better to delete the callback meanwhile
- return 0;
-#endif
-}
-#endif
-
-/*
-It would be sufficient to only flush messages belonging to object th
-But then the order of sent messages is not as intended
-*/
-void flext_base::QFlush(flext_base *th)
-{
-#ifdef FLEXT_THREADS
- if(!IsSystemThread()) {
- error("flext - Queue flush called by wrong thread!");
- return;
- }
-#endif
-
- while(!queue.Empty()) QWork(false);
-}
-
-static void Trigger()
-{
-#if FLEXT_SYS == FLEXT_SYS_PD
- #if FLEXT_QMODE == 2
- // wake up worker thread
- qthrcond.Signal();
- #elif FLEXT_QMODE == 1 && !defined(PERMANENTIDLE)
- if(!qtickactive) {
- sys_callback(QTick,NULL,0);
- qtickactive = true;
- }
- #elif FLEXT_QMODE == 0
- clock_delay(qclk,0);
- #endif
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- #if FLEXT_QMODE == 0
-// qelem_front(qclk);
- clock_delay(qclk,0);
- #endif
-#else
-#error Not implemented
-#endif
-}
-
-#if FLEXT_QMODE == 2
-void flext_base::QWorker(thr_params *)
-{
- thrmsgid = GetThreadId();
- qustarted = true;
- for(;;) {
- qthrcond.Wait();
- QWork(true);
- }
-}
-#endif
-
-void flext_base::StartQueue()
-{
- if(qustarted) return;
-#if FLEXT_QMODE == 1
-#ifdef PERMANENTIDLE
- sys_callback(QTick,NULL,0);
- qustarted = true;
-#endif
-#elif FLEXT_QMODE == 2
- LaunchThread(QWorker,NULL);
- // very unelegant... but waiting should be ok, since happens only on loading
- while(!qustarted) Sleep(0.001);
-#elif FLEXT_QMODE == 0 && (FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX)
-// qclk = (t_qelem *)(qelem_new(NULL,(t_method)QTick));
- qclk = (t_clock *)(clock_new(NULL,(t_method)QTick));
- qustarted = true;
-#else
-#error Not implemented!
-#endif
-}
-
-
-flext::MsgBundle *flext::MsgNew()
-{
- return MsgBundle::New();
-}
-
-void flext::MsgFree(MsgBundle *m)
-{
- MsgBundle::Free(m);
-}
-
-void flext::ToSysMsg(MsgBundle *m)
-{
- m->Send();
- queue.Free(m);
-}
-
-void flext::ToQueueMsg(MsgBundle *m)
-{
- queue.Push(m);
-}
-
-
-
-void flext_base::ToQueueBang(int o) const
-{
- MsgBundle *m = MsgBundle::New();
- m->Add(const_cast<flext_base *>(this),o);
- queue.Push(m);
-}
-
-void flext_base::ToQueueFloat(int o,float f) const
-{
- MsgBundle *m = MsgBundle::New();
- m->Add(const_cast<flext_base *>(this),o,f);
- queue.Push(m);
-}
-
-void flext_base::ToQueueInt(int o,int f) const
-{
- MsgBundle *m = MsgBundle::New();
- m->Add(const_cast<flext_base *>(this),o,f);
- queue.Push(m);
-}
-
-void flext_base::ToQueueSymbol(int o,const t_symbol *s) const
-{
- MsgBundle *m = MsgBundle::New();
- m->Add(const_cast<flext_base *>(this),o,s);
- queue.Push(m);
-}
-
-void flext_base::ToQueueAtom(int o,const t_atom &at) const
-{
- MsgBundle *m = MsgBundle::New();
- m->Add(const_cast<flext_base *>(this),o,at);
- queue.Push(m);
-}
-
-void flext_base::ToQueueList(int o,int argc,const t_atom *argv) const
-{
- MsgBundle *m = MsgBundle::New();
- m->Add(const_cast<flext_base *>(this),o,argc,argv);
- queue.Push(m);
-}
-
-void flext_base::ToQueueAnything(int o,const t_symbol *s,int argc,const t_atom *argv) const
-{
- MsgBundle *m = MsgBundle::New();
- m->Add(const_cast<flext_base *>(this),o,s,argc,argv);
- queue.Push(m);
-}
-
-
-void flext_base::MsgAddBang(MsgBundle *m,int n) const
-{
- m->Add(const_cast<flext_base *>(this),n);
-}
-
-void flext_base::MsgAddFloat(MsgBundle *m,int n,float f) const
-{
- m->Add(const_cast<flext_base *>(this),n,f);
-}
-
-void flext_base::MsgAddInt(MsgBundle *m,int n,int f) const
-{
- m->Add(const_cast<flext_base *>(this),n,f);
-}
-
-void flext_base::MsgAddSymbol(MsgBundle *m,int n,const t_symbol *s) const
-{
- m->Add(const_cast<flext_base *>(this),n,s);
-}
-
-void flext_base::MsgAddAtom(MsgBundle *m,int n,const t_atom &at) const
-{
- m->Add(const_cast<flext_base *>(this),n,at);
-}
-
-void flext_base::MsgAddList(MsgBundle *m,int n,int argc,const t_atom *argv) const
-{
- m->Add(const_cast<flext_base *>(this),n,argc,argv);
-}
-
-void flext_base::MsgAddAnything(MsgBundle *m,int n,const t_symbol *s,int argc,const t_atom *argv) const
-{
- m->Add(const_cast<flext_base *>(this),n,s,argc,argv);
-}
-
-
-
-
-bool flext::SysForward(const t_symbol *recv,const t_symbol *s,int argc,const t_atom *argv)
-{
- void *cl = recv->s_thing;
- if(UNLIKELY(!cl)) return false;
-
-#if FLEXT_SYS == FLEXT_SYS_PD
- pd_typedmess((t_class **)cl,(t_symbol *)s,argc,(t_atom *)argv);
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- typedmess(recv->s_thing,(t_symbol *)s,argc,(t_atom *)argv);
-#else
-#error Not implemented
-#endif
- return true;
-}
-
-bool flext::QueueForward(const t_symbol *recv,const t_symbol *s,int argc,const t_atom *argv)
-{
- MsgBundle *m = MsgBundle::New();
- m->Add(recv,s,argc,argv);
- // send over queue
- queue.Push(m);
- return true;
-}
-
-bool flext::MsgForward(MsgBundle *m,const t_symbol *recv,const t_symbol *s,int argc,const t_atom *argv)
-{
- m->Add(recv,s,argc,argv);
- return true;
-}
diff --git a/externals/grill/flext/source/flsimd.cpp b/externals/grill/flext/source/flsimd.cpp
deleted file mode 100644
index 8ed13a4a..00000000
--- a/externals/grill/flext/source/flsimd.cpp
+++ /dev/null
@@ -1,2002 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file flsimd.cpp
- \brief flext SIMD support functions
-
- If FLEXT_USE_SIMD is defined at compilation, SIMD instructions are used wherever feasible.
- If used with MSVC++ 6 the "Processor Pack" must be installed.
-
- If FLEXT_USE_IPP is defined the Intel Performance Package is used.
-*/
-
-#include "flext.h"
-#include <string.h>
-
-#if FLEXT_OS == FLEXT_OS_WIN
-#include <windows.h>
-#endif
-
-#ifdef FLEXT_USE_IPP
-#include <ipps.h>
-#endif
-
-#ifdef FLEXT_USE_SIMD
- #ifdef _MSC_VER
- // include MSVC SIMD header files
- #include <mmintrin.h> // MMX
- #include <xmmintrin.h> // SSE
- #include <emmintrin.h> // SSE2
- #include <mm3dnow.h> // 3DNow!
- #elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__MWERKS__) && defined(__VEC__)
- #if FLEXT_OSAPI == FLEXT_OSAPI_MAC_MACH
- #include <sys/sysctl.h>
- #include <vDSP.h>
- #else
- #include <Gestalt.h>
- #endif
-
- #pragma altivec_model on
-
- #include <altivec.h>
- #include <vectorOps.h>
- #elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__GNUC__) && defined(__VEC__)
- #include <sys/sysctl.h>
- #include <vecLib/vecLib.h>
- #endif
-
-#endif // FLEXT_USE_SIMD
-
-static unsigned long setsimdcaps();
-
-/*! \brief Holds SIMD capability flags
- \internal
-*/
-unsigned long flext::simdcaps = setsimdcaps();
-
-unsigned long flext::GetSIMDCapabilities() { return simdcaps; }
-
-
-#ifdef FLEXT_USE_SIMD
-
-#if FLEXT_CPU == FLEXT_CPU_IA32 || FLEXT_CPU == FLEXT_CPU_X84_64
-
-#define _CPU_FEATURE_MMX 0x0001
-#define _CPU_FEATURE_SSE 0x0002
-#define _CPU_FEATURE_SSE2 0x0004
-#define _CPU_FEATURE_3DNOW 0x0008
-
-typedef struct _processor_info {
- int family; // family of the processor
- // e.g. 6 = Pentium-Pro architecture
- int model; // model of processor
- // e.g. 1 = Pentium-Pro for family = 6
- int stepping; // processor revision number
- int feature; // processor feature
- // (same as return value from _cpuid)
- int os_support; // does OS Support the feature?
- int checks; // mask of checked bits in feature
- // and os_support fields
-} _p_info;
-
-// These are the bit flags that get set on calling cpuid
-// with register eax set to 1
-#define _MMX_FEATURE_BIT 0x00800000
-#define _SSE_FEATURE_BIT 0x02000000
-#define _SSE2_FEATURE_BIT 0x04000000
-
-// This bit is set when cpuid is called with
-// register set to 80000001h (only applicable to AMD)
-#define _3DNOW_FEATURE_BIT 0x80000000
-
-#ifdef _MSC_VER
-static int IsCPUID()
-{
- __try {
- _asm {
- xor eax, eax
- cpuid
- }
- }
- __except (EXCEPTION_EXECUTE_HANDLER) {
- return 0;
- }
- return 1;
-}
-
-static int _os_support(int feature)
-{
- __try {
- switch (feature) {
- case _CPU_FEATURE_SSE:
- __asm {
- xorps xmm0, xmm0 // executing SSE instruction
- }
- break;
- case _CPU_FEATURE_SSE2:
- __asm {
- xorpd xmm0, xmm0 // executing SSE2 instruction
- }
- break;
- case _CPU_FEATURE_3DNOW:
- __asm {
- pfrcp mm0, mm0 // executing 3DNow! instruction
- emms
- }
- break;
- case _CPU_FEATURE_MMX:
- __asm {
- pxor mm0, mm0 // executing MMX instruction
- emms
- }
- break;
- }
- }
- __except (EXCEPTION_EXECUTE_HANDLER) {
- if (_exception_code() == STATUS_ILLEGAL_INSTRUCTION) {
- return 0;
- }
- return 0;
- }
- return 1;
-}
-
-static int _cpuid (_p_info *pinfo)
-{
- DWORD dwStandard = 0;
- DWORD dwFeature = 0;
- DWORD dwMax = 0;
- DWORD dwExt = 0;
- int feature = 0;
- int os_support = 0;
- union {
- struct {
- DWORD dw0;
- DWORD dw1;
- DWORD dw2;
- } s;
- } Ident;
-
- if (!IsCPUID()) {
- return 0;
- }
-
- _asm {
- push ebx
- push ecx
- push edx
-
- // get the vendor string
- xor eax, eax
- cpuid
- mov dwMax, eax
- mov Ident.s.dw0, ebx
- mov Ident.s.dw1, edx
- mov Ident.s.dw2, ecx
-
- // get the Standard bits
- mov eax, 1
- cpuid
- mov dwStandard, eax
- mov dwFeature, edx
-
- // get AMD-specials
- mov eax, 80000000h
- cpuid
- cmp eax, 80000000h
- jc notamd
- mov eax, 80000001h
- cpuid
- mov dwExt, edx
-
-notamd:
- pop ecx
- pop ebx
- pop edx
- }
-
- if (dwFeature & _MMX_FEATURE_BIT) {
- feature |= _CPU_FEATURE_MMX;
- if (_os_support(_CPU_FEATURE_MMX))
- os_support |= _CPU_FEATURE_MMX;
- }
- if (dwExt & _3DNOW_FEATURE_BIT) {
- feature |= _CPU_FEATURE_3DNOW;
- if (_os_support(_CPU_FEATURE_3DNOW))
- os_support |= _CPU_FEATURE_3DNOW;
- }
- if (dwFeature & _SSE_FEATURE_BIT) {
- feature |= _CPU_FEATURE_SSE;
- if (_os_support(_CPU_FEATURE_SSE))
- os_support |= _CPU_FEATURE_SSE;
- }
- if (dwFeature & _SSE2_FEATURE_BIT) {
- feature |= _CPU_FEATURE_SSE2;
- if (_os_support(_CPU_FEATURE_SSE2))
- os_support |= _CPU_FEATURE_SSE2;
- }
-
- if (pinfo) {
- memset(pinfo, 0, sizeof(_p_info));
-
- pinfo->os_support = os_support;
- pinfo->feature = feature;
- pinfo->family = (dwStandard >> 8) & 0xF; // retrieve family
- if (pinfo->family == 15) { // retrieve extended family
- pinfo->family |= (dwStandard >> 16) & 0xFF0;
- }
- pinfo->model = (dwStandard >> 4) & 0xF; // retrieve model
- if (pinfo->model == 15) { // retrieve extended model
- pinfo->model |= (dwStandard >> 12) & 0xF;
- }
- pinfo->stepping = (dwStandard) & 0xF; // retrieve stepping
-
- pinfo->checks = _CPU_FEATURE_MMX |
- _CPU_FEATURE_SSE |
- _CPU_FEATURE_SSE2 |
- _CPU_FEATURE_3DNOW;
- }
-
- return feature;
-}
-
-inline bool IsVectorAligned(const void *where)
-{
- return (reinterpret_cast<size_t>(where)&(__alignof(__m128)-1)) == 0;
-}
-
-inline bool VectorsAligned(const void *v1,const void *v2)
-{
- return (
- (reinterpret_cast<size_t>(v1)|reinterpret_cast<size_t>(v2))
- &(__alignof(__m128)-1)
- ) == 0;
-}
-
-inline bool VectorsAligned(const void *v1,const void *v2,const void *v3)
-{
- return (
- (reinterpret_cast<size_t>(v1)|reinterpret_cast<size_t>(v2)|reinterpret_cast<size_t>(v3))
- &(__alignof(__m128)-1)
- ) == 0;
-}
-
-inline bool VectorsAligned(const void *v1,const void *v2,const void *v3,const void *v4)
-{
- return (
- (reinterpret_cast<size_t>(v1)|reinterpret_cast<size_t>(v2)|reinterpret_cast<size_t>(v3)|reinterpret_cast<size_t>(v4))
- &(__alignof(__m128)-1)
- ) == 0;
-}
-
-#else
-// not MSVC
-static int _cpuid (_p_info *pinfo)
-{
- if(pinfo) memset(pinfo,0,sizeof *pinfo);
- return 0;
-}
-#endif
-
-#endif
-
-
-/*! \brief Determine SIMD capabilities
- \internal
-*/
-static unsigned long setsimdcaps()
-{
- unsigned long simdflags = flext::simd_none;
-#if FLEXT_CPU == FLEXT_CPU_IA32 || FLEXT_CPU == FLEXT_CPU_AMD64
- _p_info cpuinfo;
- int feature = _cpuid(&cpuinfo);
- if(cpuinfo.os_support&_CPU_FEATURE_MMX) simdflags += flext::simd_mmx;
- if(cpuinfo.os_support&_CPU_FEATURE_3DNOW) simdflags += flext::simd_3dnow;
- if(cpuinfo.os_support&_CPU_FEATURE_SSE) simdflags += flext::simd_sse;
- if(cpuinfo.os_support&_CPU_FEATURE_SSE2) simdflags += flext::simd_sse2;
-#elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__VEC__)
- #if FLEXT_OSAPI == FLEXT_OSAPI_MAC_MACH
-
- int selectors[2] = { CTL_HW, HW_VECTORUNIT };
- int hasVectorUnit = 0;
- size_t length = sizeof(hasVectorUnit);
- int error = sysctl(selectors, 2, &hasVectorUnit, &length, NULL, 0);
-
- if(!error && hasVectorUnit != 0) simdflags += flext::simd_altivec;
-
- #else
-
- long cpuAttributes;
- Boolean hasAltiVec = false;
- OSErr err = Gestalt( gestaltPowerPCProcessorFeatures, &cpuAttributes );
-
- if( noErr == err )
- if(( 1 << gestaltPowerPCHasVectorInstructions) & cpuAttributes) simdflags += flext::simd_altivec;
-
- #endif
-#endif
- return simdflags;
-}
-
-
-#if FLEXT_CPU == FLEXT_CPU_PPC && defined(__VEC__)
-
-/* functions for misaligned vector data - taken from the Altivec tutorial of Ian Ollmann, Ph.D. */
-
-//! Load a vector from an unaligned location in memory
-inline vector unsigned char LoadUnaligned( vector unsigned char *v )
-{
- vector unsigned char permuteVector = vec_lvsl( 0, (int*) v );
- vector unsigned char low = vec_ld( 0, v );
- vector unsigned char high = vec_ld( 15, v );
- return vec_perm( low, high, permuteVector );
-}
-
-/*
-//! Store a vector to an unaligned location in memory
-inline void StoreUnaligned( vector unsigned char v, vector unsigned char *where)
-{
- // Load the surrounding area
- vector unsigned char low = vec_ld( 0, where );
- vector unsigned char high = vec_ld( 16, where );
- // Prepare the constants that we need
- vector unsigned char permuteVector = vec_lvsr( 0, (int*) where );
-
- vector unsigned char oxFF = (vector unsigned char)vec_splat_s8( -1 );
- vector unsigned char ox00 = (vector unsigned char)vec_splat_s8( 0 );
- // Make a mask for which parts of the vectors to swap out
- vector unsigned char mask = vec_perm( ox00, oxFF, permuteVector );
- // Right rotate our input data
- v = vec_perm( v, v, permuteVector );
- // Insert our data into the low and high vectors
- low = vec_sel( v, low, mask );
- high = vec_sel( high, v, mask );
- // Store the two aligned result vectors
- vec_st( low, 0, where );
- vec_st( high, 16, where );
-}
-*/
-
-inline vector float LoadUnaligned(const float *v )
-{
- return (vector float)LoadUnaligned((vector unsigned char *)v);
-}
-
-/*
-inline void StoreUnaligned( vector float v,float *where)
-{
- return StoreUnaligned((vector unsigned char)v,(vector unsigned char *)where);
-}
-*/
-
-inline bool IsVectorAligned(const void *where)
-{
- return (reinterpret_cast<size_t>(where)&(sizeof(vector float)-1)) == 0;
-}
-
-inline bool VectorsAligned(const void *v1,const void *v2)
-{
- return (
- (reinterpret_cast<size_t>(v1)|reinterpret_cast<size_t>(v2))
- &(sizeof(vector float)-1)
- ) == 0;
-}
-
-inline bool VectorsAligned(const void *v1,const void *v2,const void *v3)
-{
- return (
- (reinterpret_cast<size_t>(v1)|reinterpret_cast<size_t>(v2)|reinterpret_cast<size_t>(v3))
- &(sizeof(vector float)-1)
- ) == 0;
-}
-
-inline bool VectorsAligned(const void *v1,const void *v2,const void *v3,const void *v4)
-{
- return (
- (reinterpret_cast<size_t>(v1)|reinterpret_cast<size_t>(v2)|reinterpret_cast<size_t>(v3)|reinterpret_cast<size_t>(v4))
- &(sizeof(vector float)-1)
- ) == 0;
-}
-
-inline vector float LoadValue(const float &f)
-{
- return vec_splat(IsVectorAligned(&f)?vec_ld(0,(vector float *)&f):LoadUnaligned(&f),0);
-}
-#endif
-
-
-#else // FLEXT_USE_SIMD
-static unsigned long setsimdcaps() { return 0; }
-#endif // FLEXT_USE_SIMD
-
-
-void flext::CopySamples(t_sample *dst,const t_sample *src,int cnt)
-{
-#ifdef FLEXT_USE_IPP
- if(sizeof(t_sample) == 4)
- ippsCopy_32f((const float *)src,(float *)dst,cnt);
- else if(sizeof(t_sample) == 8)
- ippsCopy_64f((const double *)src,(double *)dst,cnt);
- else
- ERRINTERNAL();
-#else
-#ifdef FLEXT_USE_SIMD
-#ifdef _MSC_VER
- if(GetSIMDCapabilities()&simd_sse) {
- // single precision
-
- int n = cnt>>4;
- if(!n) goto zero;
- cnt -= n<<4;
-
- __asm {
- mov eax,dword ptr [src]
- prefetcht0 [eax+0]
- prefetcht0 [eax+32]
- }
-
- if(IsVectorAligned(src)) {
- if(IsVectorAligned(dst)) {
- // aligned src, aligned dst
- __asm {
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
- mov ecx,[n]
-loopaa:
- prefetcht0 [eax+64]
- prefetcht0 [eax+96]
- movaps xmm0,xmmword ptr[eax]
- movaps xmmword ptr[edx],xmm0
- movaps xmm1,xmmword ptr[eax+4*4]
- movaps xmmword ptr[edx+4*4],xmm1
- movaps xmm2,xmmword ptr[eax+8*4]
- movaps xmmword ptr[edx+8*4],xmm2
- movaps xmm3,xmmword ptr[eax+12*4]
- movaps xmmword ptr[edx+12*4],xmm3
-
- add eax,16*4
- add edx,16*4
- loop loopaa
- }
- }
- else {
- // aligned src, unaligned dst
- __asm {
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
- mov ecx,[n]
-loopau:
- prefetcht0 [eax+64]
- prefetcht0 [eax+96]
- movaps xmm0,xmmword ptr[eax]
- movups xmmword ptr[edx],xmm0
- movaps xmm1,xmmword ptr[eax+4*4]
- movups xmmword ptr[edx+4*4],xmm1
- movaps xmm2,xmmword ptr[eax+8*4]
- movups xmmword ptr[edx+8*4],xmm2
- movaps xmm3,xmmword ptr[eax+12*4]
- movups xmmword ptr[edx+12*4],xmm3
-
- add eax,16*4
- add edx,16*4
- loop loopau
- }
- }
- }
- else {
- if(IsVectorAligned(dst)) {
- // unaligned src, aligned dst
- __asm {
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
- mov ecx,[n]
-loopua:
- prefetcht0 [eax+64]
- prefetcht0 [eax+96]
- movups xmm0,xmmword ptr[eax]
- movaps xmmword ptr[edx],xmm0
- movups xmm1,xmmword ptr[eax+4*4]
- movaps xmmword ptr[edx+4*4],xmm1
- movups xmm2,xmmword ptr[eax+8*4]
- movaps xmmword ptr[edx+8*4],xmm2
- movups xmm3,xmmword ptr[eax+12*4]
- movaps xmmword ptr[edx+12*4],xmm3
-
- add eax,16*4
- add edx,16*4
- loop loopua
- }
- }
- else {
- // unaligned src, unaligned dst
- __asm {
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
- mov ecx,[n]
-loopuu:
- prefetcht0 [eax+64]
- prefetcht0 [eax+96]
- movups xmm0,xmmword ptr[eax]
- movups xmmword ptr[edx],xmm0
- movups xmm1,xmmword ptr[eax+4*4]
- movups xmmword ptr[edx+4*4],xmm1
- movups xmm2,xmmword ptr[eax+8*4]
- movups xmmword ptr[edx+8*4],xmm2
- movups xmm3,xmmword ptr[eax+12*4]
- movups xmmword ptr[edx+12*4],xmm3
-
- add eax,16*4
- add edx,16*4
- loop loopuu
- }
- }
- }
-
- src += n<<4,dst += n<<4;
-zero:
- while(cnt--) *(dst++) = *(src++);
- }
- else
-#elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__VECTOROPS__)
- if(true) {
- int n = cnt>>2,n4 = n<<2;
- vScopy(n4,(vector float *)src,(vector float *)dst);
- cnt -= n4,src += n4,dst += n4;
- while(cnt--) *(dst++) = *(src++);
- }
- else
-#endif // _MSC_VER
-#endif // FLEXT_USE_SIMD
- {
- int n = cnt>>3;
- cnt -= n<<3;
- while(n--) {
- dst[0] = src[0]; dst[1] = src[1]; dst[2] = src[2]; dst[3] = src[3];
- dst[4] = src[4]; dst[5] = src[5]; dst[6] = src[6]; dst[7] = src[7];
- src += 8,dst += 8;
- }
- while(cnt--) *(dst++) = *(src++);
- }
-#endif
-}
-
-#if defined(FLEXT_USE_SIMD) && FLEXT_CPU == FLEXT_CPU_PPC && defined(__VEC__)
-// because of some frame code Altivec stuff should be in seperate functions....
-
-static const vector float zero = (vector float)(0);
-
-static void SetAltivec(t_sample *dst,int cnt,t_sample s)
-{
- vector float svec = LoadValue(s);
- int n = cnt>>4;
- cnt -= n<<4;
-
- while(n--) {
- vec_st(svec,0,dst);
- vec_st(svec,16,dst);
- vec_st(svec,32,dst);
- vec_st(svec,48,dst);
- dst += 16;
- }
-
- while(cnt--) *(dst++) = s;
-}
-
-static void MulAltivec(t_sample *dst,const t_sample *src,t_sample op,int cnt)
-{
- const vector float arg = LoadValue(op);
- int n = cnt>>4;
- cnt -= n<<4;
-
- for(; n--; src += 16,dst += 16) {
- vector float a1 = vec_ld( 0,src);
- vector float a2 = vec_ld(16,src);
- vector float a3 = vec_ld(32,src);
- vector float a4 = vec_ld(48,src);
-
- a1 = vec_madd(a1,arg,zero);
- a2 = vec_madd(a2,arg,zero);
- a3 = vec_madd(a3,arg,zero);
- a4 = vec_madd(a4,arg,zero);
-
- vec_st(a1, 0,dst);
- vec_st(a2,16,dst);
- vec_st(a3,32,dst);
- vec_st(a4,48,dst);
- }
-
- while(cnt--) *(dst++) = *(src++)*op;
-}
-
-static void MulAltivec(t_sample *dst,const t_sample *src,const t_sample *op,int cnt)
-{
- int n = cnt>>4;
- cnt -= n<<4;
-
- for(; n--; src += 16,op += 16,dst += 16) {
- vector float a1 = vec_ld( 0,src),b1 = vec_ld( 0,op);
- vector float a2 = vec_ld(16,src),b2 = vec_ld(16,op);
- vector float a3 = vec_ld(32,src),b3 = vec_ld(32,op);
- vector float a4 = vec_ld(48,src),b4 = vec_ld(48,op);
-
- a1 = vec_madd(a1,b1,zero);
- a2 = vec_madd(a2,b2,zero);
- a3 = vec_madd(a3,b3,zero);
- a4 = vec_madd(a4,b4,zero);
-
- vec_st(a1, 0,dst);
- vec_st(a2,16,dst);
- vec_st(a3,32,dst);
- vec_st(a4,48,dst);
- }
- while(cnt--) *(dst++) = *(src++) * *(op++);
-}
-
-static void AddAltivec(t_sample *dst,const t_sample *src,t_sample op,int cnt)
-{
- const vector float arg = LoadValue(op);
- int n = cnt>>4;
- cnt -= n<<4;
-
- for(; n--; src += 16,dst += 16) {
- vector float a1 = vec_ld( 0,src);
- vector float a2 = vec_ld(16,src);
- vector float a3 = vec_ld(32,src);
- vector float a4 = vec_ld(48,src);
-
- a1 = vec_add(a1,arg);
- a2 = vec_add(a2,arg);
- a3 = vec_add(a3,arg);
- a4 = vec_add(a4,arg);
-
- vec_st(a1, 0,dst);
- vec_st(a2,16,dst);
- vec_st(a3,32,dst);
- vec_st(a4,48,dst);
- }
-
- while(cnt--) *(dst++) = *(src++)+op;
-}
-
-static void AddAltivec(t_sample *dst,const t_sample *src,const t_sample *op,int cnt)
-{
- int n = cnt>>4;
- cnt -= n<<4;
-
- for(; n--; src += 16,op += 16,dst += 16) {
- vector float a1 = vec_ld( 0,src),b1 = vec_ld( 0,op);
- vector float a2 = vec_ld(16,src),b2 = vec_ld(16,op);
- vector float a3 = vec_ld(32,src),b3 = vec_ld(32,op);
- vector float a4 = vec_ld(48,src),b4 = vec_ld(48,op);
-
- a1 = vec_add(a1,b1);
- a2 = vec_add(a2,b2);
- a3 = vec_add(a3,b3);
- a4 = vec_add(a4,b4);
-
- vec_st(a1, 0,dst);
- vec_st(a2,16,dst);
- vec_st(a3,32,dst);
- vec_st(a4,48,dst);
- }
- while(cnt--) *(dst++) = *(src++) + *(op++);
-}
-
-static void ScaleAltivec(t_sample *dst,const t_sample *src,t_sample opmul,t_sample opadd,int cnt)
-{
- const vector float argmul = LoadValue(opmul);
- const vector float argadd = LoadValue(opadd);
- int n = cnt>>4;
- cnt -= n<<4;
-
- for(; n--; src += 16,dst += 16) {
- vec_st(vec_madd(vec_ld( 0,src),argmul,argadd), 0,dst);
- vec_st(vec_madd(vec_ld(16,src),argmul,argadd),16,dst);
- vec_st(vec_madd(vec_ld(32,src),argmul,argadd),32,dst);
- vec_st(vec_madd(vec_ld(48,src),argmul,argadd),48,dst);
- }
-
- while(cnt--) *(dst++) = *(src++)*opmul+opadd;
-}
-
-static void ScaleAltivec(t_sample *dst,const t_sample *src,t_sample opmul,const t_sample *add,int cnt)
-{
- const vector float argmul = LoadValue(opmul);
- int n = cnt>>4;
- cnt -= n<<4;
-
- for(; n--; src += 16,dst += 16,add += 16) {
- vec_st(vec_madd(vec_ld( 0,src),argmul,vec_ld( 0,add)), 0,dst);
- vec_st(vec_madd(vec_ld(16,src),argmul,vec_ld(16,add)),16,dst);
- vec_st(vec_madd(vec_ld(32,src),argmul,vec_ld(32,add)),32,dst);
- vec_st(vec_madd(vec_ld(48,src),argmul,vec_ld(48,add)),48,dst);
- }
-
- while(cnt--) *(dst++) = *(src++) * opmul + *(add++);
-}
-
-static void ScaleAltivec(t_sample *dst,const t_sample *src,const t_sample *mul,const t_sample *add,int cnt)
-{
- int n = cnt>>4;
- cnt -= n<<4;
-
- for(; n--; src += 16,dst += 16,mul += 16,add += 16) {
- vec_st(vec_madd(vec_ld( 0,src),vec_ld( 0,mul),vec_ld( 0,add)), 0,dst);
- vec_st(vec_madd(vec_ld(16,src),vec_ld(16,mul),vec_ld(16,add)),16,dst);
- vec_st(vec_madd(vec_ld(32,src),vec_ld(32,mul),vec_ld(32,add)),32,dst);
- vec_st(vec_madd(vec_ld(48,src),vec_ld(48,mul),vec_ld(48,add)),48,dst);
- }
-
- while(cnt--) *(dst++) = *(src++) * *(mul++) + *(add++);
-}
-#endif
-
-void flext::SetSamples(t_sample *dst,int cnt,t_sample s)
-{
-#ifdef FLEXT_USE_IPP
- if(sizeof(t_sample) == 4)
- ippsSet_32f((float)s,(float *)dst,cnt);
- else if(sizeof(t_sample) == 8)
- ippsSet_64f((double)s,(double *)dst,cnt);
- else
- ERRINTERNAL();
-#else
-#ifdef FLEXT_USE_SIMD
-#ifdef _MSC_VER
- if(GetSIMDCapabilities()&simd_sse) {
- // single precision
-
- int n = cnt>>4;
- if(!n) goto zero;
- cnt -= n<<4;
-
- __asm {
- movss xmm0,xmmword ptr [s]
- shufps xmm0,xmm0,0
- }
-
- if(IsVectorAligned(dst)) {
- // aligned version
- __asm {
- mov ecx,[n]
- mov edx,dword ptr [dst]
-loopa:
- movaps xmmword ptr[edx],xmm0
- movaps xmmword ptr[edx+4*4],xmm0
- movaps xmmword ptr[edx+8*4],xmm0
- movaps xmmword ptr[edx+12*4],xmm0
-
- add edx,16*4
- loop loopa
- }
- }
- else {
- // unaligned version
- __asm {
- mov ecx,[n]
- mov edx,dword ptr [dst]
-loopu:
- movups xmmword ptr[edx],xmm0
- movups xmmword ptr[edx+4*4],xmm0
- movups xmmword ptr[edx+8*4],xmm0
- movups xmmword ptr[edx+12*4],xmm0
-
- add edx,16*4
- loop loopu
- }
- }
-
- dst += n<<4;
-zero:
- while(cnt--) *(dst++) = s;
- }
- else
-#elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__VEC__)
- if(GetSIMDCapabilities()&simd_altivec && IsVectorAligned(dst))
- SetAltivec(dst,cnt,s);
- else
-#endif
-#endif // FLEXT_USE_SIMD
- {
- int n = cnt>>3;
- cnt -= n<<3;
- while(n--) {
- dst[0] = dst[1] = dst[2] = dst[3] = dst[4] = dst[5] = dst[6] = dst[7] = s;
- dst += 8;
- }
-
- while(cnt--) *(dst++) = s;
- }
-#endif
-}
-
-
-void flext::MulSamples(t_sample *dst,const t_sample *src,t_sample op,int cnt)
-{
-#ifdef FLEXT_USE_IPP
- if(sizeof(t_sample) == 4) {
- ippsMulC_32f((const float *)src,(float)op,(float *)dst,cnt);
- }
- else if(sizeof(t_sample) == 8) {
- ippsMulC_64f((const double *)src,(double)op,(double *)dst,cnt);
- }
- else
- ERRINTERNAL();
-#else
-#ifdef FLEXT_USE_SIMD
-#ifdef _MSC_VER
- if(GetSIMDCapabilities()&simd_sse) {
- // single precision
- __m128 a = _mm_load1_ps(&op);
-
- int n = cnt>>4;
- if(!n) goto zero;
- cnt -= n<<4;
-
- __asm {
- mov eax,dword ptr [src]
- prefetcht0 [eax+0]
- prefetcht0 [eax+32]
-
- movss xmm0,xmmword ptr [op]
- shufps xmm0,xmm0,0
- }
-
- if(VectorsAligned(src,dst)) {
- // aligned version
- __asm {
- mov ecx,[n]
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
-loopa:
- prefetcht0 [eax+64]
- prefetcht0 [eax+96]
-
- movaps xmm1,xmmword ptr[eax]
- mulps xmm1,xmm0
- movaps xmmword ptr[edx],xmm1
-
- movaps xmm2,xmmword ptr[eax+4*4]
- mulps xmm2,xmm0
- movaps xmmword ptr[edx+4*4],xmm2
-
- movaps xmm3,xmmword ptr[eax+8*4]
- mulps xmm3,xmm0
- movaps xmmword ptr[edx+8*4],xmm3
-
- movaps xmm4,xmmword ptr[eax+12*4]
- mulps xmm4,xmm0
- movaps xmmword ptr[edx+12*4],xmm4
-
- add eax,16*4
- add edx,16*4
- loop loopa
- }
- }
- else {
- // unaligned version
- __asm {
- mov ecx,[n]
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
-loopu:
- prefetcht0 [eax+64]
- prefetcht0 [eax+96]
-
- movups xmm1,xmmword ptr[eax]
- mulps xmm1,xmm0
- movups xmmword ptr[edx],xmm1
-
- movups xmm2,xmmword ptr[eax+4*4]
- mulps xmm2,xmm0
- movups xmmword ptr[edx+4*4],xmm2
-
- movups xmm3,xmmword ptr[eax+8*4]
- mulps xmm3,xmm0
- movups xmmword ptr[edx+8*4],xmm3
-
- movups xmm4,xmmword ptr[eax+12*4]
- mulps xmm4,xmm0
- movups xmmword ptr[edx+12*4],xmm4
-
- add eax,16*4
- add edx,16*4
- loop loopu
- }
- }
-
- src += n<<4,dst += n<<4;
-zero:
- while(cnt--) *(dst++) = *(src++)*op;
- }
- else
-#elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__VDSP__)
- if(true) {
- vsmul(src,1,&op,dst,1,cnt);
- }
- else
-#elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__VEC__)
- if(GetSIMDCapabilities()&simd_altivec && VectorsAligned(src,dst))
- MulAltivec(dst,src,op,cnt);
- else
-#endif // _MSC_VER
-#endif // FLEXT_USE_SIMD
- {
- int n = cnt>>3;
- cnt -= n<<3;
-
- if(src == dst) {
- while(n--) {
- dst[0] *= op; dst[1] *= op; dst[2] *= op; dst[3] *= op;
- dst[4] *= op; dst[5] *= op; dst[6] *= op; dst[7] *= op;
- dst += 8;
- }
- while(cnt--) *(dst++) *= op;
- }
- else {
- while(n--) {
- dst[0] = src[0]*op; dst[1] = src[1]*op;
- dst[2] = src[2]*op; dst[3] = src[3]*op;
- dst[4] = src[4]*op; dst[5] = src[5]*op;
- dst[6] = src[6]*op; dst[7] = src[7]*op;
- src += 8,dst += 8;
- }
- while(cnt--) *(dst++) = *(src++)*op;
- }
- }
-#endif
-}
-
-
-void flext::MulSamples(t_sample *dst,const t_sample *src,const t_sample *op,int cnt)
-{
-#ifdef FLEXT_USE_IPP
- if(sizeof(t_sample) == 4) {
- ippsMul_32f((const float *)src,(const float *)op,(float *)dst,cnt);
- }
- else if(sizeof(t_sample) == 8) {
- ippsMul_32f((const double *)src,(const double *)op,(double *)dst,cnt);
- }
- else
- ERRINTERNAL();
-#else
-#ifdef FLEXT_USE_SIMD
-#ifdef _MSC_VER
- if(GetSIMDCapabilities()&simd_sse) {
- // single precision
- int n = cnt>>4;
- if(!n) goto zero;
- cnt -= n<<4;
-
- __asm {
- mov eax,[src]
- mov ebx,[op]
- prefetcht0 [eax+0]
- prefetcht0 [ebx+0]
- prefetcht0 [eax+32]
- prefetcht0 [ebx+32]
- }
-
- if(VectorsAligned(src,dst)) {
- if(IsVectorAligned(op)) {
- __asm {
- mov ecx,[n]
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
- mov ebx,dword ptr [op]
- loopaa:
- prefetcht0 [eax+64]
- prefetcht0 [ebx+64]
- prefetcht0 [eax+96]
- prefetcht0 [ebx+96]
-
- movaps xmm0,xmmword ptr[eax]
- movaps xmm1,xmmword ptr[ebx]
- mulps xmm0,xmm1
- movaps xmmword ptr[edx],xmm0
-
- movaps xmm2,xmmword ptr[eax+4*4]
- movaps xmm3,xmmword ptr[ebx+4*4]
- mulps xmm2,xmm3
- movaps xmmword ptr[edx+4*4],xmm2
-
- movaps xmm4,xmmword ptr[eax+8*4]
- movaps xmm5,xmmword ptr[ebx+8*4]
- mulps xmm4,xmm5
- movaps xmmword ptr[edx+8*4],xmm4
-
- movaps xmm6,xmmword ptr[eax+12*4]
- movaps xmm7,xmmword ptr[ebx+12*4]
- mulps xmm6,xmm7
- movaps xmmword ptr[edx+12*4],xmm6
-
- add eax,16*4
- add ebx,16*4
- add edx,16*4
- loop loopaa
- }
- }
- else {
- __asm {
- mov ecx,[n]
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
- mov ebx,dword ptr [op]
- loopau:
- prefetcht0 [eax+64]
- prefetcht0 [ebx+64]
- prefetcht0 [eax+96]
- prefetcht0 [ebx+96]
-
- movaps xmm0,xmmword ptr[eax]
- movups xmm1,xmmword ptr[ebx]
- mulps xmm0,xmm1
- movaps xmmword ptr[edx],xmm0
-
- movaps xmm2,xmmword ptr[eax+4*4]
- movups xmm3,xmmword ptr[ebx+4*4]
- mulps xmm2,xmm3
- movaps xmmword ptr[edx+4*4],xmm2
-
- movaps xmm4,xmmword ptr[eax+8*4]
- movups xmm5,xmmword ptr[ebx+8*4]
- mulps xmm4,xmm5
- movaps xmmword ptr[edx+8*4],xmm4
-
- movaps xmm6,xmmword ptr[eax+12*4]
- movups xmm7,xmmword ptr[ebx+12*4]
- mulps xmm6,xmm7
- movaps xmmword ptr[edx+12*4],xmm6
-
- add eax,16*4
- add ebx,16*4
- add edx,16*4
- loop loopau
- }
- }
- }
- else {
- if(IsVectorAligned(op)) {
- __asm {
- mov ecx,[n]
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
- mov ebx,dword ptr [op]
- loopua:
- prefetcht0 [eax+64]
- prefetcht0 [ebx+64]
- prefetcht0 [eax+96]
- prefetcht0 [ebx+96]
-
- movups xmm0,xmmword ptr[eax]
- movaps xmm1,xmmword ptr[ebx]
- mulps xmm0,xmm1
- movups xmmword ptr[edx],xmm0
-
- movups xmm2,xmmword ptr[eax+4*4]
- movaps xmm3,xmmword ptr[ebx+4*4]
- mulps xmm2,xmm3
- movups xmmword ptr[edx+4*4],xmm2
-
- movups xmm4,xmmword ptr[eax+8*4]
- movaps xmm5,xmmword ptr[ebx+8*4]
- mulps xmm4,xmm5
- movups xmmword ptr[edx+8*4],xmm4
-
- movups xmm6,xmmword ptr[eax+12*4]
- movaps xmm7,xmmword ptr[ebx+12*4]
- mulps xmm6,xmm7
- movups xmmword ptr[edx+12*4],xmm6
-
- add eax,16*4
- add ebx,16*4
- add edx,16*4
- loop loopua
- }
- }
- else {
- __asm {
- mov ecx,[n]
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
- mov ebx,dword ptr [op]
-loopuu:
- prefetcht0 [eax+64]
- prefetcht0 [ebx+64]
- prefetcht0 [eax+96]
- prefetcht0 [ebx+96]
-
- movups xmm0,xmmword ptr[eax]
- movups xmm1,xmmword ptr[ebx]
- mulps xmm0,xmm1
- movups xmmword ptr[edx],xmm0
-
- movups xmm2,xmmword ptr[eax+4*4]
- movups xmm3,xmmword ptr[ebx+4*4]
- mulps xmm2,xmm3
- movups xmmword ptr[edx+4*4],xmm2
-
- movups xmm4,xmmword ptr[eax+8*4]
- movups xmm5,xmmword ptr[ebx+8*4]
- mulps xmm4,xmm5
- movups xmmword ptr[edx+8*4],xmm4
-
- movups xmm6,xmmword ptr[eax+12*4]
- movups xmm7,xmmword ptr[ebx+12*4]
- mulps xmm6,xmm7
- movups xmmword ptr[edx+12*4],xmm6
-
- add eax,16*4
- add ebx,16*4
- add edx,16*4
- loop loopuu
- }
- }
- }
-
- src += n<<4,dst += n<<4,op += n<<4;
-zero:
- while(cnt--) *(dst++) = *(src++) * *(op++);
- }
- else
-#elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__VDSP__)
- if(true) {
- vmul(src,1,op,1,dst,1,cnt);
- }
- else
-#elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__VEC__)
- if(GetSIMDCapabilities()&simd_altivec && VectorsAligned(src,op,dst))
- MulAltivec(dst,src,op,cnt);
- else
-#endif // _MSC_VER
-#endif // FLEXT_USE_SIMD
- {
- int n = cnt>>3;
- cnt -= n<<3;
-
- if(src == dst) {
- while(n--) {
- dst[0] *= op[0]; dst[1] *= op[1];
- dst[2] *= op[2]; dst[3] *= op[3];
- dst[4] *= op[4]; dst[5] *= op[5];
- dst[6] *= op[6]; dst[7] *= op[7];
- dst += 8,op += 8;
- }
- while(cnt--) *(dst++) *= *(op++);
- }
- else {
- while(n--) {
- dst[0] = src[0]*op[0]; dst[1] = src[1]*op[1];
- dst[2] = src[2]*op[2]; dst[3] = src[3]*op[3];
- dst[4] = src[4]*op[4]; dst[5] = src[5]*op[5];
- dst[6] = src[6]*op[6]; dst[7] = src[7]*op[7];
- src += 8,dst += 8,op += 8;
- }
- while(cnt--) *(dst++) = *(src++) * *(op++);
- }
- }
-#endif
-}
-
-
-void flext::AddSamples(t_sample *dst,const t_sample *src,t_sample op,int cnt)
-{
-#ifdef FLEXT_USE_IPP
- if(sizeof(t_sample) == 4) {
- ippsAddC_32f((const float *)src,(float)op,(float *)dst,cnt);
- }
- else if(sizeof(t_sample) == 8) {
- ippsAddC_64f_I((const double *)src,(double)op,(double *)dst,cnt);
- }
- else
- ERRINTERNAL();
-#else
-#ifdef FLEXT_USE_SIMD
-#ifdef _MSC_VER
- if(GetSIMDCapabilities()&simd_sse) {
- // single precision
- int n = cnt>>4;
- if(!n) goto zero;
- cnt -= n<<4;
-
- __asm {
- mov eax,[src]
- prefetcht0 [eax+0]
- prefetcht0 [eax+32]
-
- movss xmm0,xmmword ptr [op]
- shufps xmm0,xmm0,0
- }
-
- if(VectorsAligned(src,dst)) {
- // aligned version
- __asm {
- mov ecx,[n]
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
-loopa:
- prefetcht0 [eax+64]
- prefetcht0 [eax+96]
-
- movaps xmm1,xmmword ptr[eax]
- addps xmm1,xmm0
- movaps xmmword ptr[edx],xmm1
-
- movaps xmm2,xmmword ptr[eax+4*4]
- addps xmm2,xmm0
- movaps xmmword ptr[edx+4*4],xmm2
-
- movaps xmm3,xmmword ptr[eax+8*4]
- addps xmm3,xmm0
- movaps xmmword ptr[edx+8*4],xmm3
-
- movaps xmm4,xmmword ptr[eax+12*4]
- addps xmm4,xmm0
- movaps xmmword ptr[edx+12*4],xmm4
-
- add eax,16*4
- add edx,16*4
- loop loopa
- }
- }
- else {
- // unaligned version
- __asm {
- mov ecx,[n]
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
-loopu:
- prefetcht0 [eax+64]
- prefetcht0 [eax+96]
-
- movups xmm1,xmmword ptr[eax]
- addps xmm1,xmm0
- movups xmmword ptr[edx],xmm1
-
- movups xmm2,xmmword ptr[eax+4*4]
- addps xmm2,xmm0
- movups xmmword ptr[edx+4*4],xmm2
-
- movups xmm3,xmmword ptr[eax+8*4]
- addps xmm3,xmm0
- movups xmmword ptr[edx+8*4],xmm3
-
- movups xmm4,xmmword ptr[eax+12*4]
- addps xmm4,xmm0
- movups xmmword ptr[edx+12*4],xmm4
-
- add eax,16*4
- add edx,16*4
- loop loopu
- }
- }
- src += n<<4,dst += n<<4,op += n<<4;
-zero:
- while(cnt--) *(dst++) = *(src++)+op;
- }
- else
-#elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__VEC__)
- if(GetSIMDCapabilities()&simd_altivec && VectorsAligned(src,dst))
- AddAltivec(dst,src,op,cnt);
- else
-#endif // _MSC_VER
-#endif // FLEXT_USE_SIMD
- {
- int n = cnt>>3;
- cnt -= n<<3;
-
- if(src == dst) {
- while(n--) {
- dst[0] += op; dst[1] += op; dst[2] += op; dst[3] += op;
- dst[4] += op; dst[5] += op; dst[6] += op; dst[7] += op;
- dst += 8;
- }
- while(cnt--) *(dst++) += op;
- }
- else {
- while(n--) {
- dst[0] = src[0]+op; dst[1] = src[1]+op;
- dst[2] = src[2]+op; dst[3] = src[3]+op;
- dst[4] = src[4]+op; dst[5] = src[5]+op;
- dst[6] = src[6]+op; dst[7] = src[7]+op;
- src += 8,dst += 8;
- }
- while(cnt--) *(dst++) = *(src++)+op;
- }
- }
-#endif
-}
-
-
-void flext::AddSamples(t_sample *dst,const t_sample *src,const t_sample *op,int cnt)
-{
-#ifdef FLEXT_USE_IPP
- if(sizeof(t_sample) == 4) {
- ippsAdd_32f((const float *)src,(const float *)op,(float *)dst,cnt);
- }
- else if(sizeof(t_sample) == 8) {
- ippsAdd_64f((const double *)src,(const double *)op,(double *)dst,cnt);
- }
- else
- ERRINTERNAL();
-#else
-#ifdef FLEXT_USE_SIMD
-#ifdef _MSC_VER
- if(GetSIMDCapabilities()&simd_sse) {
- // Prefetch cache
- __asm {
- mov eax,dword ptr [src]
- mov ebx,dword ptr [op]
- prefetcht0 [eax]
- prefetcht0 [ebx]
- prefetcht0 [eax+32]
- prefetcht0 [ebx+32]
- }
-
- // single precision
- int n = cnt>>4;
- if(!n) goto zero;
- cnt -= n<<4;
-
- if(VectorsAligned(src,dst)) {
- if(IsVectorAligned(op)) {
- __asm {
- mov ecx,dword ptr [n]
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
- mov ebx,dword ptr [op]
- loopaa:
- prefetcht0 [eax+64]
- prefetcht0 [ebx+64]
- prefetcht0 [eax+96]
- prefetcht0 [ebx+96]
-
- movaps xmm0,xmmword ptr[eax]
- movaps xmm1,xmmword ptr[ebx]
- addps xmm0,xmm1
- movaps xmmword ptr[edx],xmm0
-
- movaps xmm2,xmmword ptr[eax+4*4]
- movaps xmm3,xmmword ptr[ebx+4*4]
- addps xmm2,xmm3
- movaps xmmword ptr[edx+4*4],xmm2
-
- movaps xmm4,xmmword ptr[eax+8*4]
- movaps xmm5,xmmword ptr[ebx+8*4]
- addps xmm4,xmm5
- movaps xmmword ptr[edx+8*4],xmm4
-
- movaps xmm6,xmmword ptr[eax+12*4]
- movaps xmm7,xmmword ptr[ebx+12*4]
- addps xmm6,xmm7
- movaps xmmword ptr[edx+12*4],xmm6
-
- add eax,16*4
- add ebx,16*4
- add edx,16*4
- loop loopaa
- }
- }
- else {
- __asm {
- mov ecx,dword ptr [n]
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
- mov ebx,dword ptr [op]
- loopau:
- prefetcht0 [eax+64]
- prefetcht0 [ebx+64]
- prefetcht0 [eax+96]
- prefetcht0 [ebx+96]
-
- movaps xmm0,xmmword ptr[eax]
- movups xmm1,xmmword ptr[ebx]
- addps xmm0,xmm1
- movaps xmmword ptr[edx],xmm0
-
- movaps xmm2,xmmword ptr[eax+4*4]
- movups xmm3,xmmword ptr[ebx+4*4]
- addps xmm2,xmm3
- movaps xmmword ptr[edx+4*4],xmm2
-
- movaps xmm4,xmmword ptr[eax+8*4]
- movups xmm5,xmmword ptr[ebx+8*4]
- addps xmm4,xmm5
- movaps xmmword ptr[edx+8*4],xmm4
-
- movaps xmm6,xmmword ptr[eax+12*4]
- movups xmm7,xmmword ptr[ebx+12*4]
- addps xmm6,xmm7
- movaps xmmword ptr[edx+12*4],xmm6
-
- add eax,16*4
- add ebx,16*4
- add edx,16*4
- loop loopau
- }
- }
- }
- else {
- if(IsVectorAligned(op)) {
- __asm {
- mov ecx,dword ptr [n]
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
- mov ebx,dword ptr [op]
- loopua:
- prefetcht0 [eax+64]
- prefetcht0 [ebx+64]
- prefetcht0 [eax+96]
- prefetcht0 [ebx+96]
-
- movups xmm0,xmmword ptr[eax]
- movaps xmm1,xmmword ptr[ebx]
- addps xmm0,xmm1
- movups xmmword ptr[edx],xmm0
-
- movups xmm2,xmmword ptr[eax+4*4]
- movaps xmm3,xmmword ptr[ebx+4*4]
- addps xmm2,xmm3
- movups xmmword ptr[edx+4*4],xmm2
-
- movups xmm4,xmmword ptr[eax+8*4]
- movaps xmm5,xmmword ptr[ebx+8*4]
- addps xmm4,xmm5
- movups xmmword ptr[edx+8*4],xmm4
-
- movups xmm6,xmmword ptr[eax+12*4]
- movaps xmm7,xmmword ptr[ebx+12*4]
- addps xmm6,xmm7
- movups xmmword ptr[edx+12*4],xmm6
-
- add eax,16*4
- add ebx,16*4
- add edx,16*4
- loop loopua
- }
- }
- else {
- __asm {
- mov ecx,dword ptr [n]
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
- mov ebx,dword ptr [op]
- loopuu:
- prefetcht0 [eax+64]
- prefetcht0 [ebx+64]
- prefetcht0 [eax+96]
- prefetcht0 [ebx+96]
-
- movups xmm0,xmmword ptr[eax]
- movups xmm1,xmmword ptr[ebx]
- addps xmm0,xmm1
- movups xmmword ptr[edx],xmm0
-
- movups xmm2,xmmword ptr[eax+4*4]
- movups xmm3,xmmword ptr[ebx+4*4]
- addps xmm2,xmm3
- movups xmmword ptr[edx+4*4],xmm2
-
- movups xmm4,xmmword ptr[eax+8*4]
- movups xmm5,xmmword ptr[ebx+8*4]
- addps xmm4,xmm5
- movups xmmword ptr[edx+8*4],xmm4
-
- movups xmm6,xmmword ptr[eax+12*4]
- movups xmm7,xmmword ptr[ebx+12*4]
- addps xmm6,xmm7
- movups xmmword ptr[edx+12*4],xmm6
-
- add eax,16*4
- add ebx,16*4
- add edx,16*4
- loop loopuu
- }
- }
- }
-
- src += n<<4,dst += n<<4,op += n<<4;
-zero:
- while(cnt--) *(dst++) = *(src++) + *(op++);
- }
- else
-#elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__VDSP__)
- if(true) {
- vadd(src,1,op,1,dst,1,cnt);
- }
- else
-#elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__VEC__)
- if(GetSIMDCapabilities()&simd_altivec && VectorsAligned(src,op,dst))
- AddAltivec(dst,src,op,cnt);
- else
-#endif // _MSC_VER
-#endif // FLEXT_USE_SIMD
- {
- int n = cnt>>3;
- cnt -= n<<3;
-
- if(dst == src) {
- while(n--) {
- dst[0] += op[0]; dst[1] += op[1];
- dst[2] += op[2]; dst[3] += op[3];
- dst[4] += op[4]; dst[5] += op[5];
- dst[6] += op[6]; dst[7] += op[7];
- dst += 8,op += 8;
- }
- while(cnt--) *(dst++) += *(op++);
- }
- else {
- while(n--) {
- dst[0] = src[0]+op[0]; dst[1] = src[1]+op[1];
- dst[2] = src[2]+op[2]; dst[3] = src[3]+op[3];
- dst[4] = src[4]+op[4]; dst[5] = src[5]+op[5];
- dst[6] = src[6]+op[6]; dst[7] = src[7]+op[7];
- src += 8,dst += 8,op += 8;
- }
- while(cnt--) *(dst++) = *(src++) + *(op++);
- }
- }
-#endif
-}
-
-
-void flext::ScaleSamples(t_sample *dst,const t_sample *src,t_sample opmul,t_sample opadd,int cnt)
-{
-#ifdef FLEXT_USE_IPP
- if(sizeof(t_sample) == 4) {
- ippsMulC_32f((const float *)src,(float)opmul,(float *)dst,cnt);
- ippsAddC_32f_I((float)opadd,(float *)dst,cnt);
- }
- else if(sizeof(t_sample) == 8) {
- ippsMulC_64f((const double *)src,(double)opmul,(double *)dst,cnt);
- ippsAddC_64f_I((double)opadd,(double *)dst,cnt);
- }
- else
- ERRINTERNAL();
-#else
-#ifdef FLEXT_USE_SIMD
-#ifdef _MSC_VER
- if(GetSIMDCapabilities()&simd_sse) {
- // single precision
- int n = cnt>>4;
- if(!n) goto zero;
- cnt -= n<<4;
-
- __asm {
- mov eax,dword ptr [src]
- prefetcht0 [eax+0]
- prefetcht0 [eax+32]
-
- movss xmm0,xmmword ptr [opadd]
- shufps xmm0,xmm0,0
- movss xmm1,xmmword ptr [opmul]
- shufps xmm1,xmm1,0
- }
-
- if(VectorsAligned(src,dst)) {
- // aligned version
- __asm {
- mov ecx,dword ptr [n]
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
-loopa:
- prefetcht0 [eax+64]
- prefetcht0 [eax+96]
-
- movaps xmm2,xmmword ptr[eax]
- mulps xmm2,xmm1
- addps xmm2,xmm0
- movaps xmmword ptr[edx],xmm2
-
- movaps xmm3,xmmword ptr[eax+4*4]
- mulps xmm3,xmm1
- addps xmm3,xmm0
- movaps xmmword ptr[edx+4*4],xmm3
-
- movaps xmm4,xmmword ptr[eax+8*4]
- mulps xmm4,xmm1
- addps xmm4,xmm0
- movaps xmmword ptr[edx+8*4],xmm4
-
- movaps xmm5,xmmword ptr[eax+12*4]
- mulps xmm5,xmm1
- addps xmm5,xmm0
- movaps xmmword ptr[edx+12*4],xmm5
-
- add eax,16*4
- add edx,16*4
- loop loopa
- }
- }
- else {
- // unaligned version
- __asm {
- mov ecx,dword ptr [n]
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
-loopu:
- prefetcht0 [eax+64]
- prefetcht0 [eax+96]
-
- movups xmm2,xmmword ptr[eax]
- mulps xmm2,xmm1
- addps xmm2,xmm0
- movups xmmword ptr[edx],xmm2
-
- movups xmm3,xmmword ptr[eax+4*4]
- mulps xmm3,xmm1
- addps xmm3,xmm0
- movups xmmword ptr[edx+4*4],xmm3
-
- movups xmm4,xmmword ptr[eax+8*4]
- mulps xmm4,xmm1
- addps xmm4,xmm0
- movups xmmword ptr[edx+8*4],xmm4
-
- movups xmm5,xmmword ptr[eax+12*4]
- mulps xmm5,xmm1
- addps xmm5,xmm0
- movups xmmword ptr[edx+12*4],xmm5
-
- add eax,16*4
- add edx,16*4
- loop loopu
- }
- }
-
- src += n<<4,dst += n<<4;
-zero:
- while(cnt--) *(dst++) = *(src++)*opmul+opadd;
- }
- else
-#elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__VEC__)
- if(GetSIMDCapabilities()&simd_altivec && VectorsAligned(src,dst))
- ScaleAltivec(dst,src,opmul,opadd,cnt);
- else
-#endif // _MSC_VER
-#endif // FLEXT_USE_SIMD
- {
- int n = cnt>>3;
- cnt -= n<<3;
- while(n--) {
- dst[0] = src[0]*opmul+opadd; dst[1] = src[1]*opmul+opadd;
- dst[2] = src[2]*opmul+opadd; dst[3] = src[3]*opmul+opadd;
- dst[4] = src[4]*opmul+opadd; dst[5] = src[5]*opmul+opadd;
- dst[6] = src[6]*opmul+opadd; dst[7] = src[7]*opmul+opadd;
- src += 8,dst += 8;
- }
- while(cnt--) *(dst++) = *(src++)*opmul+opadd;
- }
-#endif
-}
-
-void flext::ScaleSamples(t_sample *dst,const t_sample *src,t_sample opmul,const t_sample *opadd,int cnt)
-{
-#ifdef FLEXT_USE_IPP
- if(sizeof(t_sample) == 4) {
- ippsMulC_32f((const float *)src,(float)opmul,(float *)dst,cnt);
- ippsAdd_32f_I((float *)opadd,(float *)dst,cnt);
- }
- else if(sizeof(t_sample) == 8) {
- ippsMulC_64f((const double *)src,(double)opmul,(double *)dst,cnt);
- ippsAdd_64f_I((double *)opadd,(double *)dst,cnt);
- }
- else
- ERRINTERNAL();
-#else
-#ifdef FLEXT_USE_SIMD
-#ifdef _MSC_VER
- if(GetSIMDCapabilities()&simd_sse) {
- // single precision
- int n = cnt>>4;
- if(!n) goto zero;
- cnt -= n<<4;
-
- __asm {
- mov eax,dword ptr [src]
- prefetcht0 [eax+0]
- prefetcht0 [eax+32]
-
- movss xmm0,xmmword ptr [opmul]
- shufps xmm0,xmm0,0
- }
-
- if(VectorsAligned(src,dst,opadd)) {
- // aligned version
- __asm {
- mov ecx,dword ptr [n]
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
- mov ebx,dword ptr [opadd]
-loopa:
- prefetcht0 [eax+64]
- prefetcht0 [ebx+64]
- prefetcht0 [eax+96]
- prefetcht0 [ebx+96]
-
- movaps xmm2,xmmword ptr[eax]
- movaps xmm1,xmmword ptr[ebx]
- mulps xmm2,xmm0
- addps xmm2,xmm1
- movaps xmmword ptr[edx],xmm2
-
- movaps xmm3,xmmword ptr[eax+4*4]
- movaps xmm1,xmmword ptr[ebx+4*4]
- mulps xmm3,xmm0
- addps xmm3,xmm1
- movaps xmmword ptr[edx+4*4],xmm3
-
- movaps xmm4,xmmword ptr[eax+8*4]
- movaps xmm1,xmmword ptr[ebx+8*4]
- mulps xmm4,xmm0
- addps xmm4,xmm1
- movaps xmmword ptr[edx+8*4],xmm4
-
- movaps xmm5,xmmword ptr[eax+12*4]
- movaps xmm1,xmmword ptr[ebx+12*4]
- mulps xmm5,xmm0
- addps xmm5,xmm1
- movaps xmmword ptr[edx+12*4],xmm5
-
- add eax,16*4
- add edx,16*4
- add ebx,16*4
- loop loopa
- }
- }
- else {
- // unaligned version
- __asm {
- mov ecx,dword ptr [n]
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
- mov ebx,dword ptr [opadd]
-loopu:
- prefetcht0 [eax+64]
- prefetcht0 [ebx+64]
- prefetcht0 [eax+96]
- prefetcht0 [ebx+96]
-
- movups xmm2,xmmword ptr[eax]
- movups xmm1,xmmword ptr[ebx]
- mulps xmm2,xmm0
- addps xmm2,xmm1
- movups xmmword ptr[edx],xmm2
-
- movups xmm3,xmmword ptr[eax+4*4]
- movups xmm1,xmmword ptr[ebx+4*4]
- mulps xmm3,xmm0
- addps xmm3,xmm1
- movups xmmword ptr[edx+4*4],xmm3
-
- movups xmm4,xmmword ptr[eax+8*4]
- movups xmm1,xmmword ptr[ebx+8*4]
- mulps xmm4,xmm0
- addps xmm4,xmm1
- movups xmmword ptr[edx+8*4],xmm4
-
- movups xmm5,xmmword ptr[eax+12*4]
- movups xmm1,xmmword ptr[ebx+12*4]
- mulps xmm5,xmm0
- addps xmm5,xmm1
- movups xmmword ptr[edx+12*4],xmm5
-
- add eax,16*4
- add edx,16*4
- add ebx,16*4
- loop loopu
- }
- }
-
- src += n<<4,dst += n<<4,opadd += n<<4;
-zero:
- while(cnt--) *(dst++) = *(src++) * opmul + *(opadd++);
- }
- else
-#elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__VEC__)
- if(GetSIMDCapabilities()&simd_altivec && VectorsAligned(src,dst,opadd))
- ScaleAltivec(dst,src,opmul,opadd,cnt);
- else
-#endif // _MSC_VER
-#endif // FLEXT_USE_SIMD
- {
- int n = cnt>>3;
- cnt -= n<<3;
- if(dst == opadd) {
- while(n--) {
- dst[0] += src[0]*opmul; dst[1] += src[1]*opmul;
- dst[2] += src[2]*opmul; dst[3] += src[3]*opmul;
- dst[4] += src[4]*opmul; dst[5] += src[5]*opmul;
- dst[6] += src[6]*opmul; dst[7] += src[7]*opmul;
- src += 8,dst += 8;
- }
- while(cnt--) *(dst++) += *(src++)*opmul;
- }
- else {
- while(n--) {
- dst[0] = src[0]*opmul+opadd[0]; dst[1] = src[1]*opmul+opadd[1];
- dst[2] = src[2]*opmul+opadd[2]; dst[3] = src[3]*opmul+opadd[3];
- dst[4] = src[4]*opmul+opadd[4]; dst[5] = src[5]*opmul+opadd[5];
- dst[6] = src[6]*opmul+opadd[6]; dst[7] = src[7]*opmul+opadd[7];
- src += 8,dst += 8,opadd += 8;
- }
- while(cnt--) *(dst++) = *(src++)*opmul+*(opadd++);
- }
- }
-#endif
-}
-
-void flext::ScaleSamples(t_sample *dst,const t_sample *src,const t_sample *opmul,const t_sample *opadd,int cnt)
-{
-#ifdef FLEXT_USE_IPP
- if(sizeof(t_sample) == 4) {
- ippsMul_32f((const float *)src,(const float *)opmul,(float *)dst,cnt);
- ippsAdd_32f_I((const float *)opadd,(float *)dst,cnt);
- }
- else if(sizeof(t_sample) == 8) {
- ippsMul_64f((const double *)src,(const double *)opmul,(double *)dst,cnt);
- ippsAdd_64f_I((const double *)opadd,(double *)dst,cnt);
- }
- else
- ERRINTERNAL();
-#else
-#ifdef FLEXT_USE_SIMD
-#ifdef _MSC_VER
- if(GetSIMDCapabilities()&simd_sse) {
- // single precision
- int n = cnt>>4;
- if(!n) goto zero;
- cnt -= n<<4;
-
- __asm {
- mov eax,dword ptr [src]
- prefetcht0 [eax+0]
- prefetcht0 [eax+32]
- }
-
- if(VectorsAligned(src,dst,opmul,opadd)) {
- // aligned version
- __asm {
- mov ecx,dword ptr [n]
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
- mov esi,dword ptr [opmul]
- mov ebx,dword ptr [opadd]
-loopa:
- prefetcht0 [eax+64]
- prefetcht0 [ebx+64]
- prefetcht0 [esi+64]
- prefetcht0 [eax+96]
- prefetcht0 [ebx+96]
- prefetcht0 [esi+96]
-
- movaps xmm2,xmmword ptr[eax]
- movaps xmm0,xmmword ptr[esi]
- movaps xmm1,xmmword ptr[ebx]
- mulps xmm2,xmm0
- addps xmm2,xmm1
- movaps xmmword ptr[edx],xmm2
-
- movaps xmm3,xmmword ptr[eax+4*4]
- movaps xmm0,xmmword ptr[esi+4*4]
- movaps xmm1,xmmword ptr[ebx+4*4]
- mulps xmm3,xmm0
- addps xmm3,xmm1
- movaps xmmword ptr[edx+4*4],xmm3
-
- movaps xmm4,xmmword ptr[eax+8*4]
- movaps xmm0,xmmword ptr[esi+8*4]
- movaps xmm1,xmmword ptr[ebx+8*4]
- mulps xmm4,xmm0
- addps xmm4,xmm1
- movaps xmmword ptr[edx+8*4],xmm4
-
- movaps xmm5,xmmword ptr[eax+12*4]
- movaps xmm0,xmmword ptr[esi+12*4]
- movaps xmm1,xmmword ptr[ebx+12*4]
- mulps xmm5,xmm0
- addps xmm5,xmm1
- movaps xmmword ptr[edx+12*4],xmm5
-
- add eax,16*4
- add edx,16*4
- add ebx,16*4
- add esi,16*4
- loop loopa
- }
- }
- else {
- // unaligned version
- __asm {
- mov ecx,dword ptr [n]
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
- mov esi,dword ptr [opmul]
- mov ebx,dword ptr [opadd]
-loopu:
- prefetcht0 [eax+64]
- prefetcht0 [ebx+64]
- prefetcht0 [esi+64]
- prefetcht0 [eax+96]
- prefetcht0 [ebx+96]
- prefetcht0 [esi+96]
-
- movups xmm2,xmmword ptr[eax]
- movups xmm0,xmmword ptr[esi]
- movups xmm1,xmmword ptr[ebx]
- mulps xmm2,xmm0
- addps xmm2,xmm1
- movups xmmword ptr[edx],xmm2
-
- movups xmm3,xmmword ptr[eax+4*4]
- movups xmm0,xmmword ptr[esi+4*4]
- movups xmm1,xmmword ptr[ebx+4*4]
- mulps xmm3,xmm0
- addps xmm3,xmm1
- movups xmmword ptr[edx+4*4],xmm3
-
- movups xmm4,xmmword ptr[eax+8*4]
- movups xmm0,xmmword ptr[esi+8*4]
- movups xmm1,xmmword ptr[ebx+8*4]
- mulps xmm4,xmm0
- addps xmm4,xmm1
- movups xmmword ptr[edx+8*4],xmm4
-
- movups xmm5,xmmword ptr[eax+12*4]
- movups xmm0,xmmword ptr[esi+12*4]
- movups xmm1,xmmword ptr[ebx+12*4]
- mulps xmm5,xmm0
- addps xmm5,xmm1
- movups xmmword ptr[edx+12*4],xmm5
-
- add eax,16*4
- add edx,16*4
- add ebx,16*4
- add esi,16*4
- loop loopu
- }
- }
- src += n<<4,dst += n<<4,opmul += n<<4,opadd += n<<4;
-zero:
- while(cnt--) *(dst++) = *(src++) * *(opmul++) + *(opadd++);
- }
- else
-#elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__VEC__)
- if(GetSIMDCapabilities()&simd_altivec && VectorsAligned(src,dst,opmul,opadd))
- ScaleAltivec(dst,src,opmul,opadd,cnt);
- else
-#endif // _MSC_VER
-#endif // FLEXT_USE_SIMD
- {
- int n = cnt>>3;
- cnt -= n<<3;
- if(dst == opadd) {
- while(n--) {
- dst[0] += src[0]*opmul[0]; dst[1] += src[1]*opmul[1];
- dst[2] += src[2]*opmul[2]; dst[3] += src[3]*opmul[3];
- dst[4] += src[4]*opmul[4]; dst[5] += src[5]*opmul[5];
- dst[6] += src[6]*opmul[6]; dst[7] += src[7]*opmul[7];
- src += 8,dst += 8,opmul += 8;
- }
- while(cnt--) *(dst++) += *(src++) * *(opmul++);
- }
- else {
- while(n--) {
- dst[0] = src[0]*opmul[0]+opadd[0]; dst[1] = src[1]*opmul[1]+opadd[1];
- dst[2] = src[2]*opmul[2]+opadd[2]; dst[3] = src[3]*opmul[3]+opadd[3];
- dst[4] = src[4]*opmul[4]+opadd[4]; dst[5] = src[5]*opmul[5]+opadd[5];
- dst[6] = src[6]*opmul[6]+opadd[6]; dst[7] = src[7]*opmul[7]+opadd[7];
- src += 8,dst += 8,opmul += 8,opadd += 8;
- }
- while(cnt--) *(dst++) = *(src++)* *(opmul++) + *(opadd++);
- }
- }
-#endif
-}
diff --git a/externals/grill/flext/source/flsndobj.cpp b/externals/grill/flext/source/flsndobj.cpp
deleted file mode 100644
index b884ce73..00000000
--- a/externals/grill/flext/source/flsndobj.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-#include "flext.h"
-#include "flsndobj.h"
-
-
-flext_sndobj::flext_sndobj():
- inobjs(0),outobjs(0),
- inobj(NULL),tmpobj(NULL),outobj(NULL),
- smprt(0),blsz(0)
-{}
-
-bool flext_sndobj::Init()
-{
- bool ret = flext_dsp::Init();
- inobjs = CntInSig();
- outobjs = CntOutSig();
- return ret;
-}
-
-void flext_sndobj::Exit()
-{
- ClearObjs();
- flext_dsp::Exit();
-}
-
-void flext_sndobj::ClearObjs()
-{
- FreeObjs();
-
- if(inobj) {
- for(int i = 0; i < inobjs; ++i) delete inobj[i];
- delete[] inobj; inobj = NULL;
- }
- if(tmpobj) {
- for(int i = 0; i < inobjs; ++i) delete tmpobj[i];
- delete[] tmpobj; tmpobj = NULL;
- }
- if(outobj) {
- for(int i = 0; i < outobjs; ++i) delete outobj[i];
- delete[] outobj; outobj = NULL;
- }
-}
-
-bool flext_sndobj::CbDsp()
-{
- // called on every rebuild of the dsp chain
-
- int i;
- if(Blocksize() != blsz || Samplerate() != smprt) {
- // block size or sample rate has changed... rebuild all objects
-
- ClearObjs();
-
- blsz = Blocksize();
- smprt = Samplerate();
-
- // set up sndobjs for inlets and outlets
- if(inobjs) {
- inobj = new Inlet *[inobjs];
- tmpobj = new SndObj *[inobjs];
- for(i = 0; i < inobjs; ++i) {
- inobj[i] = new Inlet(InSig(i),blsz,smprt);
- tmpobj[i] = new SndObj(NULL,blsz,smprt);
- }
- }
- if(outobjs) {
- outobj = new Outlet *[outobjs];
- for(i = 0; i < outobjs; ++i) outobj[i] = new Outlet(OutSig(i),blsz,smprt);
- }
-
- if(!NewObjs()) ClearObjs();
- }
- else {
- // assign changed input/output vectors
-
- for(i = 0; i < inobjs; ++i) inobj[i]->SetBuf(InSig(i));
- for(i = 0; i < outobjs; ++i) outobj[i]->SetBuf(OutSig(i));
- }
- return true;
-}
-
-void flext_sndobj::CbSignal()
-{
- for(int i = 0; i < inobjs; ++i) *tmpobj[i] << *inobj[i];
- ProcessObjs();
-}
-
-
-flext_sndobj::Inlet::Inlet(const t_sample *b,int vecsz,float sr):
- SndIO(1,sizeof(t_sample)*8,NULL,vecsz,sr),buf(b)
-{}
-
-short flext_sndobj::Inlet::Read()
-{
- if(!m_error) {
- for(m_vecpos = 0; m_vecpos < m_samples; m_vecpos++)
- m_output[m_vecpos] = buf[m_vecpos];
- return 1;
- }
- else return 0;
-}
-
-short flext_sndobj::Inlet::Write() { return 0; }
-
-
-flext_sndobj::Outlet::Outlet(t_sample *b,int vecsz,float sr):
- SndIO(1,sizeof(t_sample)*8,NULL,vecsz,sr),buf(b)
-{}
-
-short flext_sndobj::Outlet::Read() { return 0; }
-
-short flext_sndobj::Outlet::Write()
-{
- if(!m_error) {
- if(m_IOobjs[0])
- for(m_vecpos = 0; m_vecpos < m_samples; m_vecpos++)
- buf[m_vecpos] = m_IOobjs[0]->Output(m_vecpos);
- return 1;
- }
- else return 0;
-}
-
-
diff --git a/externals/grill/flext/source/flsndobj.h b/externals/grill/flext/source/flsndobj.h
deleted file mode 100644
index c62b87d5..00000000
--- a/externals/grill/flext/source/flsndobj.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2007 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-#ifndef __FLSNDOBJ_H
-#define __FLSNDOBJ_H
-
-#include "flext.h"
-
-// PI is defined in the Max/MSP SDK, but clashes with SndObj.h
-#ifdef PI
-#undef PI
-#endif
-
-#ifndef FLEXT_THREADS
-#define NOPTHREAD
-#endif
-#include <SndObj.h>
-#include <SndIO.h>
-#undef NOPTHREAD
-
-
-class FLEXT_SHARE flext_sndobj:
- public flext_dsp
-{
- FLEXT_HEADER(flext_sndobj,flext_dsp)
-
-public:
- flext_sndobj();
-
- // these have to be overridden in child classes
- virtual bool NewObjs() { return true; }
- virtual void FreeObjs() {}
- virtual void ProcessObjs() {}
-
- // inputs and outputs
- SndObj &InObj(int i) { return *tmpobj[i]; }
- SndIO &OutObj(int i) { return *outobj[i]; }
-
-protected:
- virtual bool Init();
- virtual void Exit();
-
-private:
- //! SndObj for reading from inlet buffer
- class Inlet:
- public SndIO
- {
- public:
- Inlet(const t_sample *b,int vecsz,float sr);
- virtual short Read();
- virtual short Write();
-
- void SetBuf(const t_sample *b) { buf = b; }
-
- private:
- const t_sample *buf;
- };
-
- //! SndObj for writing to outlet buffer
- class Outlet:
- public SndIO
- {
- public:
- Outlet(t_sample *b,int vecsz,float sr);
- virtual short Read();
- virtual short Write();
-
- void SetBuf(t_sample *b) { buf = b; }
-
- private:
- t_sample *buf;
- };
-
- virtual bool CbDsp();
- virtual void CbSignal();
-
- void ClearObjs();
-
- int inobjs,outobjs;
- SndObj **tmpobj;
- Inlet **inobj;
- Outlet **outobj;
-
- float smprt;
- int blsz;
-};
-
-#endif
diff --git a/externals/grill/flext/source/flstdc.h b/externals/grill/flext/source/flstdc.h
deleted file mode 100644
index 13ac271c..00000000
--- a/externals/grill/flext/source/flstdc.h
+++ /dev/null
@@ -1,311 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file flstdc.h
- \brief Definitions to unite Max/MSP and PD notions
-
- This file contains a few definitions to unite a few of the notions that
- once drifted apart in Max and PD. It is not elegant but helps.
-*/
-
-#ifndef __FLEXT_STDC_H
-#define __FLEXT_STDC_H
-
-#if defined(_MSC_VER) && (_MSC_VER < 0x1300)
-/*
- include math.h here - when included with PD or Max/MSP headers,
- C linkage would be used which disturbs MSVC6
-*/
-#include <math.h>
-#endif
-
-#ifdef _MSC_VER
-#include <crtdbg.h>
-#else
-#include <assert.h>
-#endif
-
-// PD stuff
-
-#if FLEXT_SYS == FLEXT_SYS_PD
-
-/* PD definitions start here */
-
-#ifdef _MSC_VER
- #pragma warning (push)
- #pragma warning (disable:4091 4005)
-#endif
-
-#if FLEXT_OS == FLEXT_OS_WIN && !defined(NT)
-#define NT
-#endif
-
-extern "C" {
- // Include the relevant PD header files
- #ifdef FLEXT_DEBUG
- /* PD header file structure has changed with version 0.37
- from then on m_imp.h needs m_pd.h to be included before
- on the other hand versions < 0.37 don't like that....
- (they want m_imp.h solely as m_pd.h is included therein)
- So better use the m_pd.h here also for the debug version.
- Change that if really needed for debugging PD internals...
- */
-
- #ifndef PD_VERSION
- // include only if not already included
- #include <m_pd.h>
- #endif
-// #include <m_imp.h> // for easier debugging
- #else
- #ifndef PD_VERSION
- // include only if not already included
- #include <m_pd.h>
- #endif
- #endif
-}
-
-#ifdef _MSC_VER
- #pragma warning (pop)
-#endif
-
-#ifdef cabs
-#undef cabs // this is defined in m_pd.h (clashes with math.h in MacOSX)
-#endif
-
-typedef t_object t_sigobj;
-typedef t_gpointer *t_ptrtype;
-
-typedef t_float t_flint;
-typedef t_symbol *t_symtype;
-typedef t_class **t_thing;
-
-typedef t_clock t_qelem;
-
-#define A_NOTHING A_NULL
-#define A_FLINT A_FLOAT
-#define A_DEFFLINT A_DEFFLOAT
-#define A_DEFSYMBOL A_DEFSYM
-
-
-#elif FLEXT_SYS == FLEXT_SYS_MAX
-
-/* Max/MSP definitions start here */
-
-// 2-byte alignment for Max/MSP structures
-#ifdef _MSC_VER
-#pragma pack(push,flext_maxsdk)
-#pragma pack(2)
-#endif
-
-// Include the relevant Max/MSP header files
-
-#if FLEXT_OS == FLEXT_OS_MAC
- #if FLEXT_OSAPI == FLEXT_OSAPI_MAC_MACH
- // MachO version - must insert prefix header
- #include <ext_carbon_prefix.h>
- #else
- // CFM version
- #ifndef __MRC__
- #define powerc
- #endif
- #define __MOTO__ 0
-
- #include <MacTypes.h>
- #endif
-#elif FLEXT_OS == FLEXT_OS_WIN
- #define WIN_VERSION 1
- #define WIN_EXT_VERSION 1
-#endif
-
-// necessary for the old OS9 SDK
-extern "C" {
-
-#include "ext.h"
-#include "ext_user.h"
-#if FLEXT_OS != FLEXT_OS_MAC || defined(MAC_VERSION)
-// doesn't exist for OS9
-#include "ext_critical.h"
-#include "buffer.h"
-#else
-// for OS9 include "inofficial" header file
-#include "flmspbuffer.h"
-#endif
-#include "z_dsp.h"
-
-} // extern "C"
-
-#undef WIN_VERSION
-
-typedef t_pxobject t_sigobj; // that's the all-in-one object type of Max/MSP (not very memory-efficent, i guess)
-typedef t_patcher t_canvas;
-
-typedef t_int t_flint;
-typedef t_symbol *t_symtype;
-typedef t_object *t_thing;
-
-// for the following to work you should have the latest SDK
-#if FLEXT_OS == FLEXT_OS_MAC //&& !defined(MAC_VERSION)
-typedef struct qelem t_qelem;
-#else
-typedef void *t_qelem;
-#endif
-
-typedef method t_method;
-typedef method t_newmethod;
-typedef int t_atomtype;
-
-typedef struct clock t_clock;
-typedef void t_binbuf;
-
-#undef clock_free
-#define clock_free(tick) freeobject((object *)tick)
-
-#define A_NULL A_NOTHING
-#define A_DEFFLINT A_DEFLONG
-
-#ifndef A_INT
-#define A_INT A_LONG
-#endif
-
-#ifndef A_DEFINT
-#define A_DEFINT A_DEFLONG
-#endif
-
-#ifndef A_SYMBOL
-#define A_SYMBOL A_SYM
-#endif
-
-#ifndef A_DEFSYMBOL
-#define A_DEFSYMBOL A_DEFSYM
-#endif
-
-#if FLEXT_OS == FLEXT_OS_MAC && !defined(MAC_VERSION)
-// simulate non-existing functions for OS9
-#define critical_enter(N)
-#define critical_exit(N)
-#endif
-
-#ifdef _MSC_VER
-#pragma pack(pop,flext_maxsdk)
-#endif
-
-#else
-#error Platform not supported
-#endif // FLEXT_SYS
-
-
-// general definitions
-
-typedef t_symbol *t_symptr;
-
-
-// -------------------------
-
-#ifdef FLEXT_LOGGING
-/* If FLEXT_LOGGING is defined implement logging */
-
-#ifdef _MSC_VER
-#define FLEXT_LOG(s) _CrtDbgReport(_CRT_WARN,__FILE__,__LINE__,"flext",s)
-#define FLEXT_LOG1(s,v1) _CrtDbgReport(_CRT_WARN,__FILE__,__LINE__,"flext",s,v1)
-#define FLEXT_LOG2(s,v1,v2) _CrtDbgReport(_CRT_WARN,__FILE__,__LINE__,"flext",s,v1,v2)
-#define FLEXT_LOG3(s,v1,v2,v3) _CrtDbgReport(_CRT_WARN,__FILE__,__LINE__,"flext",s,v1,v2,v3)
-#define FLEXT_LOG4(s,v1,v2,v3,v4) _CrtDbgReport(_CRT_WARN,__FILE__,__LINE__,"flext",s,v1,v2,v3,v4)
-#define FLEXT_LOG5(s,v1,v2,v3,v4,v5) _CrtDbgReport(_CRT_WARN,__FILE__,__LINE__,"flext",s,v1,v2,v3,v4,v5)
-#define FLEXT_LOG6(s,v1,v2,v3,v4,v5,v6) _CrtDbgReport(_CRT_WARN,__FILE__,__LINE__,"flext",s,v1,v2,v3,v4,v5,v6)
-#define FLEXT_LOG7(s,v1,v2,v3,v4,v5,v6,v7) _CrtDbgReport(_CRT_WARN,__FILE__,__LINE__,"flext",s,v1,v2,v3,v4,v5,v6,v7)
-#define FLEXT_LOG8(s,v1,v2,v3,v4,v5,v6,v7,v8) _CrtDbgReport(_CRT_WARN,__FILE__,__LINE__,"flext",s,v1,v2,v3,v4,v5,v6,v7,v8)
-#define FLEXT_LOG9(s,v1,v2,v3,v4,v5,v6,v7,v8,v9) _CrtDbgReport(_CRT_WARN,__FILE__,__LINE__,"flext",s,v1,v2,v3,v4,v5,v6,v7,v8,v9)
-#else
-#define FLEXT_LOG(s) post(s)
-#define FLEXT_LOG1(s,v1) post(s,v1)
-#define FLEXT_LOG2(s,v1,v2) post(s,v1,v2)
-#define FLEXT_LOG3(s,v1,v2,v3) post(s,v1,v2,v3)
-#define FLEXT_LOG4(s,v1,v2,v3,v4) post(s,v1,v2,v3,v4)
-#define FLEXT_LOG5(s,v1,v2,v3,v4,v5) post(s,v1,v2,v3,v4,v5)
-#define FLEXT_LOG6(s,v1,v2,v3,v4,v5,v6) post(s,v1,v2,v3,v4,v5,v6)
-#define FLEXT_LOG7(s,v1,v2,v3,v4,v5,v6,v7) post(s,v1,v2,v3,v4,v5,v6,v7)
-#define FLEXT_LOG8(s,v1,v2,v3,v4,v5,v6,v7,v8) post(s,v1,v2,v3,v4,v5,v6,v7,v8)
-#define FLEXT_LOG9(s,v1,v2,v3,v4,v5,v6,v7,v8,v9) post(s,v1,v2,v3,v4,v5,v6,v7,v8,v9)
-#endif
-
-#else
-
-/* If FLEXT_LOGGING is not defined avoid logging */
-#define FLEXT_LOG(s) ((void)0)
-#define FLEXT_LOG1(s,v1) ((void)0)
-#define FLEXT_LOG2(s,v1,v2) ((void)0)
-#define FLEXT_LOG3(s,v1,v2,v3) ((void)0)
-#define FLEXT_LOG4(s,v1,v2,v3,v4) ((void)0)
-#define FLEXT_LOG5(s,v1,v2,v3,v4,v5) ((void)0)
-#define FLEXT_LOG6(s,v1,v2,v3,v4,v5,v6) ((void)0)
-#define FLEXT_LOG7(s,v1,v2,v3,v4,v5,v6,v7) ((void)0)
-#define FLEXT_LOG8(s,v1,v2,v3,v4,v5,v6,v7,v8) ((void)0)
-#define FLEXT_LOG9(s,v1,v2,v3,v4,v5,v6,v7,v8,v9) ((void)0)
-
-#endif
-
-#ifdef FLEXT_DEBUG
-#ifdef _MSC_VER
-#define FLEXT_ASSERT(b) do { if(!(b)) _CrtDbgReport(_CRT_ASSERT,__FILE__,__LINE__,"flext",#b); } while(false)
-#define FLEXT_WARN(str) _CrtDbgReport(_CRT_WARN,__FILE__,__LINE__,"flext",NULL)
-#define FLEXT_ERROR(str) _CrtDbgReport(_CRT_ERROR,__FILE__,__LINE__,"flext",NULL)
-#else
-#define FLEXT_ASSERT(b) assert(b)
-//#define FLEXT_ASSERT(b) do { if(!(b)) error("Assertion failed: " #b " - in " __FILE__ " line %i",(int)__LINE__); } while(false)
-#define FLEXT_WARN(str) error("Warning: in " __FILE__ " line %i",(int)__LINE__)
-#define FLEXT_ERROR(str) error("Error: in " __FILE__ " line %i",(int)__LINE__)
-#endif
-#else
-#define FLEXT_ASSERT(b) (1)
-#define FLEXT_WARN(str) (1)
-#define FLEXT_ERROR(str) error("Error: in " __FILE__ " line %i",(int)__LINE__)
-#endif
-
-#define ERRINTERNAL() error("flext: Internal error in file " __FILE__ ", line %i - please report",(int)__LINE__)
-
-
-// ----- disable attribute editor for PD version < devel_0_36 or 0.37
-#ifndef PD_MAJOR_VERSION
-#undef FLEXT_NOATTREDIT
-#define FLEXT_NOATTREDIT
-#endif
-
-
-// ----- set message queue mode -----
-#if FLEXT_SYS == FLEXT_SYS_PD && PD_MINOR_VERSION >= 37
- // for PD version >= 0.37test10 FLEXT_PDLOCK is standard
- #undef FLEXT_PDLOCK
- #define FLEXT_PDLOCK
-#endif
-
-#if FLEXT_SYS == FLEXT_SYS_PD && PD_MINOR_VERSION >= 38 && defined(PD_DEVEL_VERSION)
- // use idle callback
- #define FLEXT_QMODE 1
-#elif defined(FLEXT_PDLOCK)
- // new PD thread locking functionality shall be used
- #if FLEXT_SYS == FLEXT_SYS_PD
- #ifdef FLEXT_THREADS
- // can only be used with PD and threaded build
- #define FLEXT_QMODE 2
- #else
- #define FLEXT_QMODE 0
- #endif
- #else
- #error FLEXT_PDLOCK can only be defined with PD
- #endif
-#else
- #define FLEXT_QMODE 0
-#endif
-
-#ifndef FLEXT_QMODE
-#error Internal error: Queueing mode not defined
-#endif
-
-#endif
diff --git a/externals/grill/flext/source/flstk.cpp b/externals/grill/flext/source/flstk.cpp
deleted file mode 100644
index f3161565..00000000
--- a/externals/grill/flext/source/flstk.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-#include "flext.h"
-#include "flstk.h"
-
-flext_stk::flext_stk():
- inobjs(0),outobjs(0),
- inobj(NULL),outobj(NULL),
- smprt(0),blsz(0)
-{}
-
-bool flext_stk::Init()
-{
- bool ret = flext_dsp::Init();
- inobjs = CntInSig();
- outobjs = CntOutSig();
- return ret;
-}
-
-void flext_stk::Exit()
-{
- ClearObjs();
- flext_dsp::Exit();
-}
-
-void flext_stk::ClearObjs()
-{
- FreeObjs();
-
- if(inobj) {
- for(int i = 0; i < inobjs; ++i) delete inobj[i];
- delete[] inobj; inobj = NULL;
- }
- if(outobj) {
- for(int i = 0; i < outobjs; ++i) delete outobj[i];
- delete[] outobj; outobj = NULL;
- }
-}
-
-bool flext_stk::CbDsp()
-{
- // called on every rebuild of the dsp chain
-
- int i;
-
- if(Blocksize() != blsz || Samplerate() != smprt) {
- // block size or sample rate has changed... rebuild all objects
-
- ClearObjs();
-
- smprt = Samplerate();
- blsz = Blocksize();
- Stk::setSampleRate(smprt);
-
- // set up sndobjs for inlets and outlets
- if(inobjs) {
- inobj = new Input *[inobjs];
- for(i = 0; i < inobjs; ++i)
- inobj[i] = new Input(InSig(i),blsz);
- }
- if(outobjs) {
- outobj = new Output *[outobjs];
- for(i = 0; i < outobjs; ++i)
- outobj[i] = new Output(OutSig(i),blsz);
- }
-
- if(!NewObjs()) ClearObjs();
- }
- else {
- // assign changed input/output vectors
-
- for(i = 0; i < inobjs; ++i) inobj[i]->SetBuf(InSig(i));
- for(i = 0; i < outobjs; ++i) outobj[i]->SetBuf(OutSig(i));
- }
- return true;
-}
-
-void flext_stk::CbSignal()
-{
- if(inobjs || outobjs) ProcessObjs(blsz);
-}
-
-
-// inlet class
-
-flext_stk::Input::Input(const t_sample *b,int v):
- buf(b),vecsz(v),
- index(0)
-{}
-
-MY_FLOAT *flext_stk::Input::tick(MY_FLOAT *vector,unsigned int vectorSize)
-{
- for(unsigned int i = 0; i < vectorSize; i++) vector[i] = tick();
- return vector;
-}
-
-
-// outlet class
-
-flext_stk::Output::Output(t_sample *b,int v):
- buf(b),vecsz(v),
- index(0)
-{}
-
-void flext_stk::Output::tick(const MY_FLOAT *vector,unsigned int vectorSize)
-{
- for(unsigned int i = 0; i < vectorSize; i++) tick(vector[i]);
-}
-
diff --git a/externals/grill/flext/source/flstk.h b/externals/grill/flext/source/flstk.h
deleted file mode 100644
index c3376cb5..00000000
--- a/externals/grill/flext/source/flstk.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2007 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-#ifndef __FLSTK_H
-#define __FLSTK_H
-
-#include "flext.h"
-
-// PI is defined in the Max/MSP SDK, but clashes with Stk.h
-#ifdef PI
-#undef PI
-#endif
-
-#include <Stk.h>
-
-class FLEXT_SHARE flext_stk:
- public flext_dsp
-{
- FLEXT_HEADER(flext_stk,flext_dsp)
-
-public:
- flext_stk();
-
- // these have to be overridden in child classes
- virtual bool NewObjs() { return true; }
- virtual void FreeObjs() {}
- virtual void ProcessObjs(int blocksize) {}
-
-protected:
- virtual bool Init();
- virtual void Exit();
-
- //! STK object for reading from inlet buffer
- class Input:
- public Stk
- {
- public:
- Input(const t_sample *b,int vecsz);
-
- inline MY_FLOAT lastOut() const { return (MY_FLOAT)buf[index]; }
-
- inline MY_FLOAT tick()
- {
- if(++index >= vecsz) index = 0;
- return lastOut();
- }
-
- MY_FLOAT *tick(MY_FLOAT *vector,unsigned int vectorSize);
-
- inline void SetBuf(const t_sample *b) { buf = b; }
-
- private:
- const t_sample *buf;
- int vecsz,index;
- };
-
- //! STK object for writing to outlet buffer
- class Output:
- public Stk
- {
- public:
- Output(t_sample *b,int vecsz);
-
- inline void tick(MY_FLOAT s)
- {
- buf[index] = (t_sample)s;
- if(++index >= vecsz) index = 0;
- }
-
- void tick(const MY_FLOAT *vector,unsigned int vectorSize);
-
- inline void SetBuf(t_sample *b) { buf = b; }
-
- private:
- t_sample *buf;
- int vecsz,index;
- };
-
- Input &Inlet(int ix) { return *inobj[ix]; }
- Output &Outlet(int ix) { return *outobj[ix]; }
-
-private:
- virtual bool CbDsp();
- virtual void CbSignal();
-
- void ClearObjs();
-
- int inobjs,outobjs;
- Input **inobj;
- Output **outobj;
-
- float smprt;
- int blsz;
-};
-
-#endif
diff --git a/externals/grill/flext/source/flsupport.cpp b/externals/grill/flext/source/flsupport.cpp
deleted file mode 100644
index b77729e6..00000000
--- a/externals/grill/flext/source/flsupport.cpp
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file flsupport.cpp
- \brief flext support functions and classes.
-*/
-
-#include "flext.h"
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <string.h>
-#include <new>
-
-#ifdef _MSC_VER
-#define vsnprintf _vsnprintf
-#define snprintf _snprintf
-#endif
-
-const t_symbol *flext::sym__ = NULL;
-const t_symbol *flext::sym_float = NULL;
-const t_symbol *flext::sym_symbol = NULL;
-const t_symbol *flext::sym_bang = NULL;
-const t_symbol *flext::sym_list = NULL;
-const t_symbol *flext::sym_pointer = NULL;
-const t_symbol *flext::sym_int = NULL;
-const t_symbol *flext::sym_signal = NULL;
-
-const t_symbol *flext::sym_anything = NULL;
-
-const t_symbol *flext::sym_buffer = NULL;
-const t_symbol *flext::sym_size = NULL;
-
-const t_symbol *flext::sym_attributes = NULL;
-const t_symbol *flext::sym_methods = NULL;
-
-bool flext::indsp = false;
-
-
-int flext::Version() { return FLEXT_VERSION; }
-const char *flext::VersionStr() { return FLEXT_VERSTR; }
-
-
-void flext::Setup()
-{
- static bool issetup = false;
- if(issetup)
- return;
- else issetup = true;
-
-#if FLEXT_SYS == FLEXT_SYS_PD
- sym__ = &s_;
- sym_anything = &s_anything;
- sym_pointer = &s_pointer;
- sym_float = &s_float;
- sym_symbol = &s_symbol;
- sym_bang = &s_bang;
- sym_list = &s_list;
- sym_signal = &s_signal;
- sym_int = gensym("int");
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- sym__ = gensym("");
- sym_int = gensym("int");
- sym_float = gensym("float");
- sym_symbol = gensym("symbol");
- sym_bang = gensym("bang");
- sym_list = gensym("list");
- sym_anything = gensym("anything");
- sym_signal = gensym("signal");
-
- sym_buffer = flext::MakeSymbol("buffer~");
- sym_size = flext::MakeSymbol("size");
-#endif
-
- sym_attributes = flext::MakeSymbol("attributes");
- sym_methods = flext::MakeSymbol("methods");
-
-#ifdef FLEXT_THREADS
- thrid = GetThreadId();
- StartHelper();
-#endif
-}
-
-
-#if FLEXT_SYS == FLEXT_SYS_PD && defined(FLEXT_THREADED) && defined(FLEXT_PDLOCK)
-#define SYSLOCK() sys_lock()
-#define SYSUNLOCK() sys_unlock()
-#else
-#define SYSLOCK() (void)0
-#define SYSUNLOCK() (void)0
-#endif
-
-
-/////////////////////////////////////////////////////////
-// overloaded new/delete memory allocation methods
-//
-/////////////////////////////////////////////////////////
-
-#define LARGEALLOC 32000
-
-#ifndef FLEXT_USE_CMEM
-
-#ifdef FLEXT_DEBUGMEM
-static const size_t memtest = 0x12345678L;
-#endif
-
-void *flext_root::operator new(size_t bytes)
-{
- bytes += sizeof(size_t);
-#ifdef FLEXT_DEBUGMEM
- bytes += sizeof(memtest)*2;
-#endif
- char *blk;
- if(UNLIKELY(bytes >= LARGEALLOC)) {
-#if FLEXT_SYS == FLEXT_SYS_MAX && defined(_SYSMEM_H_)
- blk = (char *)::sysmem_newptr(bytes);
-#else
- // use C library function for large memory blocks
- blk = (char *)::malloc(bytes);
-#endif
- }
- else {
- //! We need system locking here for secondary threads!
- SYSLOCK();
-
-#if defined(FLEXT_USE_CMEM)
- blk = (char *)::malloc(bytes);
-#else
- blk = (char *)::getbytes(bytes);
-#endif
- SYSUNLOCK();
- }
-
- FLEXT_ASSERT(blk);
-
- *(size_t *)blk = bytes;
-#ifdef FLEXT_DEBUGMEM
- *(size_t *)(blk+sizeof(size_t)) = memtest;
- *(size_t *)(blk+bytes-sizeof(memtest)) = memtest;
- return blk+sizeof(size_t)+sizeof(memtest);
-#else
- return blk+sizeof(size_t);
-#endif
-}
-
-void flext_root::operator delete(void *blk)
-{
- FLEXT_ASSERT(blk);
- FLEXT_ASSERT(MemCheck(blk));
-
-#ifdef FLEXT_DEBUGMEM
- char *ori = (char *)blk-sizeof(size_t)-sizeof(memtest);
-#else
- char *ori = (char *)blk-sizeof(size_t);
-#endif
- size_t bytes = *(size_t *)ori;
-
- if(UNLIKELY(bytes >= LARGEALLOC)) {
-#if FLEXT_SYS == FLEXT_SYS_MAX && defined(_SYSMEM_H_)
- ::sysmem_freeptr(ori);
-#else
- // use C library function for large memory blocks
- ::free(ori);
-#endif
- }
- else {
- //! We need system locking here for secondary threads!
- SYSLOCK();
-
-#if defined(FLEXT_USE_CMEM)
- ::free(ori);
-#else
- ::freebytes(ori,bytes);
-#endif
- SYSUNLOCK();
- }
-}
-
-#ifdef FLEXT_DEBUGMEM
-bool flext_root::MemCheck(void *blk)
-{
- char *ori = (char *)blk-sizeof(size_t)-sizeof(memtest);
- size_t bytes = *(size_t *)ori;
-
- return
- *(size_t *)((char *)ori+sizeof(size_t)) == memtest &&
- *(size_t *)((char *)ori+bytes-sizeof(memtest)) == memtest;
-}
-#endif
-
-#endif
-
-void *flext_root::NewAligned(size_t bytes,int bitalign)
-{
- const size_t ovh = sizeof(size_t)+sizeof(char *);
- const size_t alignovh = bitalign/8-1;
- bytes += ovh+alignovh;
-
- char *blk;
- if(UNLIKELY(bytes >= LARGEALLOC)) {
-#if FLEXT_SYS == FLEXT_SYS_MAX && defined(_SYSMEM_H_)
- blk = (char *)::sysmem_newptr(bytes);
-#else
- // use C library function for large memory blocks
- blk = (char *)::malloc(bytes);
-#endif
- }
- else {
- //! We need system locking here for secondary threads!
- SYSLOCK();
-
-#if defined(FLEXT_USE_CMEM)
- blk = (char *)::malloc(bytes);
-#else
- blk = (char *)::getbytes(bytes);
-#endif
- SYSUNLOCK();
- }
- FLEXT_ASSERT(blk);
-
- char *ablk = reinterpret_cast<char *>((reinterpret_cast<size_t>(blk)+ovh+alignovh) & ~alignovh);
- *(char **)(ablk-sizeof(size_t)-sizeof(char *)) = blk;
- *(size_t *)(ablk-sizeof(size_t)) = bytes;
- return ablk;
-}
-
-void flext_root::FreeAligned(void *blk)
-{
- FLEXT_ASSERT(blk);
-
- char *ori = *(char **)((char *)blk-sizeof(size_t)-sizeof(char *));
- size_t bytes = *(size_t *)((char *)blk-sizeof(size_t));
-
- if(UNLIKELY(bytes >= LARGEALLOC)) {
-#if FLEXT_SYS == FLEXT_SYS_MAX && defined(_SYSMEM_H_)
- ::sysmem_freeptr(ori);
-#else
- // use C library function for large memory blocks
- ::free(ori);
-#endif
- }
- else {
- //! We need system locking here for secondary threads!
- SYSLOCK();
-
-#if defined(FLEXT_USE_CMEM)
- ::free(ori);
-#else
- ::freebytes(ori,bytes);
-#endif
- SYSUNLOCK();
- }
-}
-
-// ------------------------------------------
-
-/*! \todo there is probably also a shortcut for Max and jMax
- \todo size checking
-*/
-void flext::GetAString(const t_atom &a,char *buf,size_t szbuf)
-{
-#if FLEXT_SYS == FLEXT_SYS_PD
- atom_string(const_cast<t_atom *>(&a),buf,(int)szbuf);
-#else
- if(IsSymbol(a)) STD::strncpy(buf,GetString(a),szbuf);
- else if(IsFloat(a)) STD::snprintf(buf,szbuf,"%f",GetFloat(a));
- else if(IsInt(a)) STD::snprintf(buf,szbuf,"%i",GetInt(a));
- else *buf = 0;
-#endif
-}
-
-unsigned long flext::AtomHash(const t_atom &a)
-{
-#if FLEXT_SYS == FLEXT_SYS_MAX || FLEXT_SYS == FLEXT_SYS_PD
- return ((unsigned long)a.a_type<<28)^*(unsigned long *)&a.a_w;
-#else
-#error Not implemented
-#endif
-}
-
-void flext_root::post(const char *fmt, ...)
-{
- va_list ap;
- va_start(ap, fmt);
-
- char buf[1024];
- vsnprintf(buf,sizeof buf,fmt, ap);
- buf[sizeof buf-1] = 0; // in case of full buffer
- ::post(buf);
-
- va_end(ap);
-}
-
-void flext_root::error(const char *fmt,...)
-{
- va_list ap;
- va_start(ap, fmt);
-
- char buf[1024];
- STD::strcpy(buf,"error: ");
- vsnprintf(buf+7,sizeof buf-7,fmt, ap);
- buf[sizeof buf-1] = 0; // in case of full buffer
- ::post(buf);
-
- va_end(ap);
-}
-
-
diff --git a/externals/grill/flext/source/flsupport.h b/externals/grill/flext/source/flsupport.h
deleted file mode 100644
index f26437df..00000000
--- a/externals/grill/flext/source/flsupport.h
+++ /dev/null
@@ -1,1285 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2006 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file flsupport.h
- \brief flext support functions and classes
-*/
-
-#ifndef __FLSUPPORT_H
-#define __FLSUPPORT_H
-
-#include "flstdc.h"
-#include <new>
-#include <string.h>
-
-/*! \defgroup FLEXT_SUPPORT Flext support classes
- @{
-*/
-
-class FLEXT_SHARE FLEXT_CLASSDEF(flext_root);
-typedef class FLEXT_CLASSDEF(flext_root) flext_root;
-
-/*! \brief Flext root support class
-
- Moved memory functions and console output here so that all the classes
- contained in flext can use them
-*/
-class FLEXT_SHARE FLEXT_CLASSDEF(flext_root) {
-public:
-// --- console output -----------------------------------------------
-
- //! post message to console, with line feed (limited to 1k chars!)
- static void post(const char *fmt,...);
- //! post error message to console (limited to 1k chars!)
- static void error(const char *fmt,...);
-
-// --- memory -------------------------------------------------------
-
- /*! \defgroup FLEXT_S_MEMORY Memory allocation functions
- @{
- */
-
-#ifdef FLEXT_NOGLOBALNEW
-#error FLEXT_NOGLOBALNEW is deprecated, define FLEXT_USE_CMEM instead
-#define FLEXT_USE_CMEM
-#endif
-
-#ifdef FLEXT_USE_CMEM
- inline void *operator new(size_t bytes) { return ::operator new(bytes); }
- inline void operator delete(void *blk) { ::operator delete(blk); }
-
- inline void *operator new[](size_t bytes) { return ::operator new[](bytes); }
- inline void operator delete[](void *blk) { ::operator delete[](blk); }
-
- static bool MemCheck(void *) { return true; }
-#else
- /*! Overloaded new memory allocation method
- \note this uses a fast allocation method of the real-time system
- \warning Max/MSP (or MacOS) allows only 32K in overdrive mode!
- */
- void *operator new(size_t bytes);
- //! Overloaded delete method
- void operator delete(void *blk);
-
-#ifndef __MRC__ // doesn't allow new[] overloading?!
- inline void *operator new[](size_t bytes) { return operator new(bytes); }
- inline void operator delete[](void *blk) { operator delete(blk); }
-#endif
-
-#ifdef FLEXT_DEBUGMEM
- static bool MemCheck(void *blk);
-#else
- static bool MemCheck(void *) { return true; }
-#endif
-
-#endif // USECMEM
-
-#ifndef __BORLANDC__
- inline void *operator new(size_t,void *p) { return p; }
- inline void operator delete(void *,void *) {}
-#ifndef __MRC__
- inline void *operator new[](size_t,void *p) { return p; }
- inline void operator delete[](void *,void *) {}
-#endif
-#endif
-
- //! Get an aligned memory block
- static void *NewAligned(size_t bytes,int bitalign = 128);
- // same with templated type
- template<typename T>
- static T *NewAligned(size_t times,int bitalign = 128) { return static_cast<T *>(NewAligned(times*sizeof(T),bitalign)); }
- //! Free an aligned memory block
- static void FreeAligned(void *blk);
- //! Test for alignment
- static bool IsAligned(void *ptr,int bitalign = 128) {
- return (reinterpret_cast<size_t>(ptr)&(bitalign-1)) == 0;
- }
- //! @} FLEXT_S_MEMORY
-};
-
-#ifndef FLEXT_USE_CMEM
-/************************************************************************/
-// MFC doesn't like global overloading of allocators
-// anyway, who likes MFC
-
-#if !defined(_MSC_VER) && !defined(__BORLANDC__)
-#define NEWTHROW throw(std::bad_alloc)
-#define DELTHROW throw()
-#else
-#define NEWTHROW
-#define DELTHROW
-#endif
-
-// define global new/delete operators
-inline void *operator new(size_t bytes) NEWTHROW { return flext_root::operator new(bytes); }
-inline void operator delete(void *blk) DELTHROW { flext_root::operator delete(blk); }
-#ifndef __MRC__ // doesn't allow new[] overloading?!
-inline void *operator new[](size_t bytes) NEWTHROW { return flext_root::operator new[](bytes); }
-inline void operator delete[](void *blk) DELTHROW { flext_root::operator delete[](blk); }
-#endif
-
-#endif // FLEXT_USE_CMEM
-
-/************************************************************************/
-
-
-class FLEXT_SHARE FLEXT_CLASSDEF(flext);
-typedef class FLEXT_CLASSDEF(flext) flext;
-
-class FLEXT_SHARE FLEXT_CLASSDEF(flext_base);
-
-/*! \brief Flext support class
-
- A number of methods (most are static functions) are defined here for convenience.
- This class doesn't define any data members, hence it can be inherited to all
- classes (not only PD objects) to profit from the cross-platform functionality.
- Examples are the overloaded memory allocation, atom and atom list functions,
- thread functions and classes, the sample buffer class and others.
-
- This class can also be used for a non-object class (not representing an external object)
- and won't give any extra burden to it.
-*/
-
-class FLEXT_SHARE FLEXT_CLASSDEF(flext):
- public flext_root
-{
-
- /*! \defgroup FLEXT_SUPPORT Flext support class
- @{
- */
-public:
-
-// --- version -----------------------------------------------
-
- /*! \brief Flext version number
-
- Return the version number of the flext library.
- For statically linked flext this is identical to the header definition FLEXT_VERSION,
- otherwise it reflects the version number of the shared flext library.
- */
- static int Version();
-
- //! Flext version string
- static const char *VersionStr();
-
-// --- special typedefs ---------------------------------------------
-
-// later!
-#if 0
- typedef t_float Float;
- typedef t_int Int;
- typedef t_sample Sample;
- typedef const t_symbol *Symbol;
- typedef t_atom Atom;
-#endif
-
-// --- buffer/array stuff -----------------------------------------
-
- /*! \defgroup FLEXT_S_BUFFER Buffer handling
- @{
- */
-
- //! Class for platform independent buffer handling
- class FLEXT_SHARE buffer:
- public flext_root
- {
- public:
-
-#if FLEXT_SYS == FLEXT_SYS_PD
- typedef bool lock_t;
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- typedef long lock_t;
-#else
-#error Not implemented
-#endif
-
- /*! \brief Construct buffer.
- \param s: symbol name, can be NULL
- \param delayed = true: only sets name, needs another Set(NULL) to really initialize the buffer
- \remark As externals can be created prior to the buffer objects they are pointing to, initialization should be done at loadbang!
- */
- buffer(const t_symbol *s = NULL,bool delayed = false);
-
- //! Destroy buffer
- ~buffer();
-
- /*! \brief Check if the buffer is valid for use
- \note This must be true to use any of the other functions except set
- */
- bool Ok() const
- {
- return sym
-#if FLEXT_SYS == FLEXT_SYS_PD
- && arr
-#endif
- && data;
- }
-
- /*! \brief Check if buffer content is valid (not in state of content change)
- \note buffer must be Ok()
- */
- bool Valid() const
- {
- FLEXT_ASSERT(sym);
-#if FLEXT_SYS == FLEXT_SYS_PD
- return true;
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- const t_buffer *p = (const t_buffer *)sym->s_thing;
- return p && p->b_valid;
-#else
-#error not implemented
-#endif
- }
-
- /*! \brief Check and update if the buffer has been changed (e.g. resized)
- \note buffer must be Ok()
- */
- bool Update();
-
- /*! \brief Lock buffer
- \return previous state (needed for Unlock)
- \note buffer must be Ok()
- */
- lock_t Lock();
-
- /*! \brief Unlock buffer
- \param prv: Previous state is returned by Lock()
- \note buffer must be Ok()
- */
- void Unlock(lock_t prv);
-
- /*! \brief Set to specified buffer.
- \param nameonly: if true sets name only, but doesn't look at buffer actually
- \return -1 on failure, 0 on success, 1 if parameters (length, data ptr, channels) have changed
- */
- int Set(const t_symbol *s = NULL,bool nameonly = false);
-
- /*! \brief Declare buffer content as dirty.
- \param refr: if true forces immediate graphics refresh
- */
- void Dirty(bool refr = false);
-
- //! Clear the dirty flag.
- void ClearDirty();
-
- /*! Query whether the buffer content has been changed since the last ClearDirty()
- \note With mainstream versions of PD this will always return true, since the dirtiness can't be judged
- */
- bool IsDirty() const;
-
- //! Get symbol of buffer
- const t_symbol *Symbol() const { return sym; }
-
- //! Get literal name of buffer
- const char *Name() const { return sym?GetString(sym):""; }
-
- /*! \brief Get pointer to buffer, channel and frame count.
- \remark Channels are interleaved
- */
- t_sample *Data() { return data; }
-
- //! Get channel count
- int Channels() const { return chns; }
- //! Get frame count
- int Frames() const { return frames; }
- //! Set frame count
- void Frames(int fr,bool keep = false,bool zero = true);
-
- //! Graphic auto refresh interval
- void SetRefrIntv(float intv);
-
- protected:
- //! buffer name
- const t_symbol *sym;
- //! array holding audio data
- t_sample *data;
- //! number of audio channels
- int chns;
- //! number of frames (multiplied by chns for the number of samples)
- int frames;
-#if FLEXT_SYS == FLEXT_SYS_PD
- //! pointer to the PD array structure
- t_garray *arr;
- //! update interval
- float interval;
- //! flag signaling that the data has been changed
- bool isdirty;
- //! flag showing that the update clock is active
- bool ticking;
- //! update clock
- t_clock *tick;
- //! last time the dirty flag was cleared (using the clock_getlogicaltime function)
- double cleantime;
-
- private:
- //! update clock callback
- static void cb_tick(buffer *b);
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- //! last time the dirty flag was cleared (using the gettime function)
- long cleantime;
-#endif
- };
-
-
-//! @} FLEXT_S_BUFFER
-
-// --- utilities --------------------------------------------------
-
- /*! \defgroup FLEXT_S_UTIL Utility functions
- @{
- */
-
- //! Copy an atom
- static void CopyAtom(t_atom *dst,const t_atom *src) { *dst = *src; }
-
- //! Copy atoms
- static void CopyAtoms(int cnt,t_atom *dst,const t_atom *src);
-
- //! Print an atom
- static bool PrintAtom(const t_atom &a,char *buf,size_t bufsz);
-
- /*! Scan an atom until whitespace
- \return next token position, or NULL on failure
- */
- static const char *ScanAtom(t_atom &a,const char *buf);
-
- //! Copy a list of atoms
- static t_atom *CopyList(int argc,const t_atom *argv);
- //! Print an atom list
- static bool PrintList(int argc,const t_atom *argv,char *buf,size_t bufsz);
-
- //! Copy a memory region
- static void CopyMem(void *dst,const void *src,int bytes);
- //! Copy a sample array
- static void CopySamples(t_sample *dst,const t_sample *src,int cnt);
- //! Set a memory region
- static void ZeroMem(void *dst,int bytes);
- //! Set a sample array to a fixed value
- static void SetSamples(t_sample *dst,int cnt,t_sample s);
- //! Set a sample array to 0
- static void ZeroSamples(t_sample *dst,int cnt) { SetSamples(dst,cnt,0); }
-
-
- //! Get a 32 bit hash value from an atom
- static unsigned long AtomHash(const t_atom &a);
-
-//! @} FLEXT_S_UTIL
-
-// --- various symbols --------------------------------------------
-
- /*! \defgroup FLEXT_S_ATOM Atom/list handling
- @{
- */
-
- //! Symbol constant for ""
- static const t_symbol *sym__;
- //! Symbol constant for "float"
- static const t_symbol *sym_float;
- //! Symbol constant for "symbol"
- static const t_symbol *sym_symbol;
- //! Symbol constant for "bang"
- static const t_symbol *sym_bang;
- //! Symbol constant for "list"
- static const t_symbol *sym_list;
- //! Symbol constant for "anything"
- static const t_symbol *sym_anything;
-
- /*! \brief Symbol constant for "int"
- \note Only the Max/MSP system has this defined as an internal type
- */
- static const t_symbol *sym_int;
-
- /*! Symbol constant for "pointer"
- \note Only PD has this defined as an internal type
- */
- static const t_symbol *sym_pointer;
-
- //! Symbol constant for "signal"
- static const t_symbol *sym_signal;
-
- //! \note This is used in macros where the type of the arg is not clear
- static const t_symbol *MakeSymbol(const t_symbol *s) { return s; }
-
- //! Make a symbol from a string
- static const t_symbol *MakeSymbol(const char *s) { return ::gensym(const_cast<char *>(s)); }
- //! Get symbol string
- static const char *GetString(const t_symbol *s) { return s->s_name; }
- //! Check for symbol and get string
- static const char *GetAString(const t_symbol *s,const char *def = NULL) { return s?GetString(s):def; }
-
-// --- atom stuff ----------------------------------------
-
- //! Set atom from another atom
- static void SetAtom(t_atom &a,const t_atom &b) { CopyAtom(&a,&b); }
- //! Compare two atoms
- static int CmpAtom(const t_atom &a,const t_atom &b);
-
- // there are some more comparison functions for t_atom types outside the class
-
- //! Set atom from another atom
- static int GetType(const t_atom &a) { return a.a_type; }
-
- //! Check whether the atom is nothing
- static bool IsNothing(const t_atom &a) { return a.a_type == A_NULL; }
- //! Set the atom to represent nothing
- static void SetNothing(t_atom &a) { a.a_type = A_NULL; }
-
- //! Check whether the atom is a float
- static bool IsFloat(const t_atom &a) { return a.a_type == A_FLOAT; }
-
- //! Check whether the atom can be represented as a float
- static bool CanbeFloat(const t_atom &a) { return IsFloat(a) || IsInt(a); }
-
- //! Access the float value (without type check)
- static float GetFloat(const t_atom &a) { return a.a_w.w_float; }
- //! Set the atom to represent a float
- static void SetFloat(t_atom &a,float v) { a.a_type = A_FLOAT; a.a_w.w_float = v; }
-
- //! Check whether the atom is a symbol
- static bool IsSymbol(const t_atom &a) { return a.a_type == A_SYMBOL; }
-
-#if FLEXT_SYS == FLEXT_SYS_PD
- //! Access the symbol value (without type check)
- static t_symbol *GetSymbol(const t_atom &a) { return a.a_w.w_symbol; }
- //! Set the atom to represent a symbol
- static void SetSymbol(t_atom &a,const t_symbol *s) { a.a_type = A_SYMBOL; a.a_w.w_symbol = const_cast<t_symbol *>(s); }
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- //! Access the symbol value (without type check)
- static t_symbol *GetSymbol(const t_atom &a) { return a.a_w.w_sym; }
- //! Set the atom to represent a symbol
- static void SetSymbol(t_atom &a,const t_symbol *s) { a.a_type = A_SYMBOL; a.a_w.w_sym = const_cast<t_symbol *>(s); }
-#else
-#error
-#endif
- //! Check for a symbol and get its value
- static t_symbol *GetASymbol(const t_atom &a,t_symbol *def = NULL) { return IsSymbol(a)?GetSymbol(a):def; } // NULL or empty symbol?
-
- //! Check whether the atom is a string
- static bool IsString(const t_atom &a) { return IsSymbol(a); }
- //! Access the string value (without type check)
- static const char *GetString(const t_atom &a) { t_symbol *s = GetSymbol(a); return s?GetString(s):NULL; }
- //! Check for a string and get its value
- static const char *GetAString(const t_atom &a,const char *def = NULL) { return IsSymbol(a)?GetAString(GetSymbol(a),def):def; }
- //! Check for a string and get its value
- static void GetAString(const t_atom &a,char *buf,size_t szbuf);
- //! Set the atom to represent a string
- static void SetString(t_atom &a,const char *c) { SetSymbol(a,MakeSymbol(c)); }
-
- //! Check whether the atom can be represented as an integer
- static bool CanbeInt(const t_atom &a) { return IsFloat(a) || IsInt(a); }
-
-#if FLEXT_SYS == FLEXT_SYS_PD
- //! Check for a float and get its value
- static float GetAFloat(const t_atom &a,float def = 0) { return IsFloat(a)?GetFloat(a):def; }
-
- //! Check whether the atom is an integer
- static bool IsInt(const t_atom &) { return false; }
- //! Access the integer value (without type check)
- static int GetInt(const t_atom &a) { return (int)GetFloat(a); }
- //! Check for an integer and get its value
- static int GetAInt(const t_atom &a,int def = 0) { return (int)GetAFloat(a,(float)def); }
- //! Set the atom to represent a integer (depending on the system)
- static void SetInt(t_atom &a,int v) { a.a_type = A_FLOAT; a.a_w.w_float = (float)v; }
-
-#ifndef FLEXT_COMPATIBLE
- //! Check whether the atom strictly is a pointer
- static bool IsPointer(const t_atom &a) { return a.a_type == A_POINTER; }
- //! Check whether the atom can be a pointer
- static bool CanbePointer(const t_atom &a) { return IsPointer(a); }
- //! Access the pointer value (without type check)
- static t_gpointer *GetPointer(const t_atom &a) { return a.a_w.w_gpointer; }
- //! Check for a pointer and get its value
- static t_gpointer *GetAPointer(const t_atom &a,t_gpointer *def = NULL) { return IsPointer(a)?GetPointer(a):def; }
- //! Set the atom to represent a pointer
- static void SetPointer(t_atom &a,t_gpointer *p) { a.a_type = A_POINTER; a.a_w.w_gpointer = (t_gpointer *)p; }
-#endif
-
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- //! Check for a float and get its value
- static float GetAFloat(const t_atom &a,float def = 0) { return IsFloat(a)?GetFloat(a):(IsInt(a)?GetInt(a):def); }
-
- //! Check whether the atom is an int
- static bool IsInt(const t_atom &a) { return a.a_type == A_INT; }
- //! Access the integer value (without type check)
- static int GetInt(const t_atom &a) { return a.a_w.w_long; }
- //! Check for an integer and get its value
- static int GetAInt(const t_atom &a,int def = 0) { return IsInt(a)?GetInt(a):(IsFloat(a)?(int)GetFloat(a):def); }
- //! Set the atom to represent an integer
- static void SetInt(t_atom &a,int v) { a.a_type = A_INT; a.a_w.w_long = v; }
-#else
-#error "Platform not supported"
-#endif
-
- //! Set the atom to represent a boolean
- static void SetBool(t_atom &a,bool v) { SetInt(a,v?1:0); }
- //! Check whether the atom can be represented as a boolean
- static bool CanbeBool(const t_atom &a) { return CanbeInt(a); }
- //! Check for an boolean and get its value
- static bool GetABool(const t_atom &a) { return GetAInt(a) != 0; }
- //! Check for an boolean and get its value
- static bool GetBool(const t_atom &a) { return GetInt(a) != 0; }
-
-// --- atom list stuff -------------------------------------------
-
- //! Class representing a list of atoms
- class FLEXT_SHARE AtomList
- : public flext_root
- {
- public:
- //! Construct list
- AtomList(): cnt(0),lst(NULL) {}
- //! Construct list
- explicit AtomList(int argc,const t_atom *argv = NULL): cnt(0),lst(NULL) { operator()(argc,argv); }
- //! Construct list
- AtomList(const AtomList &a): cnt(0),lst(NULL) { operator =(a); }
- //! Destroy list
- virtual ~AtomList();
-
- //! Clear list
- AtomList &Clear() { return operator()(); }
-
- //! Set list
- AtomList &Set(int argc,const t_atom *argv,int offs = 0,bool resize = false);
- //! Get list
- int Get(t_atom *argv,int mxsz = -1) const;
-
- //! Set list
- AtomList &operator()(int argc = 0,const t_atom *argv = NULL) { return Set(argc,argv,0,true); }
- //! Set list by another AtomList
- AtomList &operator =(const AtomList &a) { return operator()(a.Count(),a.Atoms()); }
-
- //! Compare list to another AtomList ( -1..< , 0..==, 1...> )
- int Compare(const AtomList &a) const;
-
- bool operator <(const AtomList &a) const { return Compare(a) < 0; }
- bool operator <=(const AtomList &a) const { return Compare(a) <= 0; }
- bool operator >(const AtomList &a) const { return Compare(a) > 0; }
- bool operator >=(const AtomList &a) const { return Compare(a) >= 0; }
- bool operator ==(const AtomList &a) const { return Compare(a) == 0; }
- bool operator !=(const AtomList &a) const { return Compare(a) != 0; }
-
- //! Get number of atoms in the list
- int Count() const { return cnt; }
- //! Get a reference to an indexed atom
- t_atom &operator [](int ix) { return lst[ix]; }
- //! Get a reference to an indexed atom
- const t_atom &operator [](int ix) const { return lst[ix]; }
-
- //! Get a pointer to the list of atoms
- t_atom *Atoms() { return lst; }
- //! Get a pointer to the list of atoms
- const t_atom *Atoms() const { return lst; }
-
- //! Append an atom list to the list
- AtomList &Append(int argc,const t_atom *argv = NULL)
- {
- int c = Count();
- Alloc(c+argc,0,c);
- Set(argc,argv,c);
- return *this;
- }
-
- //! Prepend an atom list to the list
- AtomList &Prepend(int argc,const t_atom *argv = NULL)
- {
- int c = Count();
- Alloc(c+argc,0,c,argc);
- Set(argc,argv);
- return *this;
- }
-
- //! Append an atom to the list
- AtomList &Append(const t_atom &a) { return Append(1,&a); }
- //! Append an atom list to the list
- AtomList &Append(const AtomList &a) { return Append(a.Count(),a.Atoms()); }
- //! Prepend an atom to the list
- AtomList &Prepend(const t_atom &a) { return Prepend(1,&a); }
- //! Prepend an atom list to the list
- AtomList &Prepend(const AtomList &a) { return Prepend(a.Count(),a.Atoms()); }
-
- //! Get a part of the list
- void GetPart(int offs,int len,AtomList &ret) const;
- //! Set to a part of the list
- AtomList &Part(int offs,int len) { GetPart(offs,len,*this); return *this; }
-
- //! Represent as a string
- bool Print(char *buffer,int buflen) const { return flext::PrintList(Count(),Atoms(),buffer,buflen); }
-
- protected:
- virtual void Alloc(int sz,int keepix = -1,int keeplen = -1,int keepto = 0);
- virtual void Free();
-
- int cnt;
- t_atom *lst;
- };
-
- class FLEXT_SHARE AtomListStaticBase
- : public AtomList
- {
- protected:
- explicit AtomListStaticBase(int pc,t_atom *dt): precnt(pc),predata(dt) {}
- virtual ~AtomListStaticBase();
- virtual void Alloc(int sz,int keepix = -1,int keeplen = -1,int keepto = 0);
- virtual void Free();
-
- AtomListStaticBase &operator =(const AtomList &a) { AtomList::operator =(a); return *this; }
- AtomListStaticBase &operator =(const AtomListStaticBase &a) { AtomList::operator =(a); return *this; }
-
- const int precnt;
- t_atom *const predata;
- };
-
- template<int PRE>
- class AtomListStatic
- : public AtomListStaticBase
- {
- public:
- //! Construct list
- explicit AtomListStatic(): AtomListStaticBase(PRE,pre) {}
- //! Construct list
- explicit AtomListStatic(int argc,const t_atom *argv = NULL): AtomListStaticBase(PRE,pre) { operator()(argc,argv); }
- //! Construct list
- explicit AtomListStatic(const AtomList &a): AtomListStaticBase(PRE,pre) { operator =(a); }
-
- //! Set list by another AtomList
- AtomListStatic &operator =(const AtomList &a) { AtomListStaticBase::operator =(a); return *this; }
- AtomListStatic &operator =(const AtomListStatic &a) { AtomListStaticBase::operator =(a); return *this; }
- protected:
- t_atom pre[PRE];
- };
-
- //! Class representing an "anything"
- class FLEXT_SHARE AtomAnything:
- public AtomList
- {
- public:
- explicit AtomAnything(): hdr(NULL) {}
-
- //! Construct anything
- explicit AtomAnything(const t_symbol *h,int argc = 0,const t_atom *argv = NULL)
- : AtomList(argc,argv),hdr(h?h:sym__)
- {}
-
- //! Construct anything
- explicit AtomAnything(const char *h,int argc = 0,const t_atom *argv = NULL)
- : AtomList(argc,argv),hdr(MakeSymbol(h))
- {}
-
- //! Construct anything
- AtomAnything(const AtomAnything &a)
- : AtomList(a),hdr(a.hdr)
- {}
-
- //! Clear anything
- AtomAnything &Clear() { return operator()(); }
-
- //! Get header symbol of anything
- const t_symbol *Header() const { return hdr; }
-
- //! Set header symbol of anything
- void Header(const t_symbol *h) { hdr = h; }
-
- //! Set anything
- AtomAnything &operator()(const t_symbol *h = NULL,int argc = 0,const t_atom *argv = NULL)
- {
- hdr = h; AtomList::operator()(argc,argv);
- return *this;
- }
-
- //! Set list by another AtomAnything
- AtomAnything &operator =(const AtomAnything &a) { return operator()(a.Header(),a.Count(),a.Atoms()); }
-
- protected:
- const t_symbol *hdr;
- };
-
-
- //! @} FLEXT_S_ATOM
-
-
-// --- messages -------------------------------------------------------
-
- /*! \defgroup FLEXT_S_MSGBUNDLE Flext message handling
- @{
- */
-
- class MsgBundle;
-
- //! Make new message bundle
- static MsgBundle *MsgNew();
-
- //! Destroy message bundle
- static void MsgFree(MsgBundle *mb);
-
- //! Send (and destroy) message bundle
- static void ToSysMsg(MsgBundle *mb);
-
- //! Send (and destroy) message bundle
- static void ToOutMsg(MsgBundle *mb);
-
- //! Send low priority (and destroy) message bundle
- static void ToQueueMsg(MsgBundle *mb);
-
- //! @} FLEXT_S_MSGBUNDLE
-
-
- /*! \defgroup FLEXT_S_MSG Flext message handling
- @{
- */
-
- static bool Forward(const t_symbol *sym,const t_symbol *s,int argc,const t_atom *argv);
- static bool Forward(const t_symbol *sym,const AtomAnything &args) { return Forward(sym,args.Header(),args.Count(),args.Atoms()); }
- static bool Forward(const char *sym,const AtomAnything &args) { return Forward(MakeSymbol(sym),args.Header(),args.Count(),args.Atoms()); }
- static bool Forward(const t_symbol *sym,int argc,const t_atom *argv) { return Forward(sym,sym_list,argc,argv); }
- static bool Forward(const t_symbol *sym,const AtomList &args) { return Forward(sym,args.Count(),args.Atoms()); }
- static bool Forward(const char *sym,const AtomList &args) { return Forward(MakeSymbol(sym),args.Count(),args.Atoms()); }
-
- static bool SysForward(const t_symbol *sym,const t_symbol *s,int argc,const t_atom *argv);
- static bool SysForward(const t_symbol *sym,const AtomAnything &args) { return SysForward(sym,args.Header(),args.Count(),args.Atoms()); }
- static bool SysForward(const char *sym,const AtomAnything &args) { return SysForward(MakeSymbol(sym),args.Header(),args.Count(),args.Atoms()); }
- static bool SysForward(const t_symbol *sym,int argc,const t_atom *argv) { return SysForward(sym,sym_list,argc,argv); }
- static bool SysForward(const t_symbol *sym,const AtomList &args) { return SysForward(sym,args.Count(),args.Atoms()); }
- static bool SysForward(const char *sym,const AtomList &args) { return SysForward(MakeSymbol(sym),args.Count(),args.Atoms()); }
-
- static bool QueueForward(const t_symbol *sym,const t_symbol *s,int argc,const t_atom *argv);
- static bool QueueForward(const t_symbol *sym,const AtomAnything &args) { return QueueForward(sym,args.Header(),args.Count(),args.Atoms()); }
- static bool QueueForward(const char *sym,const AtomAnything &args) { return QueueForward(MakeSymbol(sym),args.Header(),args.Count(),args.Atoms()); }
- static bool QueueForward(const t_symbol *sym,int argc,const t_atom *argv) { return QueueForward(sym,sym_list,argc,argv); }
- static bool QueueForward(const t_symbol *sym,const AtomList &args) { return QueueForward(sym,args.Count(),args.Atoms()); }
- static bool QueueForward(const char *sym,const AtomList &args) { return QueueForward(MakeSymbol(sym),args.Count(),args.Atoms()); }
-
- static bool MsgForward(MsgBundle *mb,const t_symbol *sym,const t_symbol *s,int argc,const t_atom *argv);
- static bool MsgForward(MsgBundle *mb,const t_symbol *sym,const AtomAnything &args) { return MsgForward(mb,sym,args.Header(),args.Count(),args.Atoms()); }
- static bool MsgForward(MsgBundle *mb,const char *sym,const AtomAnything &args) { return MsgForward(mb,MakeSymbol(sym),args.Header(),args.Count(),args.Atoms()); }
- static bool MsgForward(MsgBundle *mb,const t_symbol *sym,int argc,const t_atom *argv) { return MsgForward(mb,sym,sym_list,argc,argv); }
- static bool MsgForward(MsgBundle *mb,const t_symbol *sym,const AtomList &args) { return MsgForward(mb,sym,args.Count(),args.Atoms()); }
- static bool MsgForward(MsgBundle *mb,const char *sym,const AtomList &args) { return MsgForward(mb,MakeSymbol(sym),args.Count(),args.Atoms()); }
-
- //! @} FLEXT_S_MSG
-
-
-
-// --- thread stuff -----------------------------------------------
-
- /*! \defgroup FLEXT_S_LOCK Global system locking
- @{
- */
-
-#if FLEXT_SYS == FLEXT_SYS_PD
- #if PD_MINOR_VERSION >= 38 || (PD_MINOR_VERSION >= 37 && defined(PD_DEVEL_VERSION))
- static void Lock() { sys_lock(); }
- static void Unlock() { sys_unlock(); }
- #else
- // no system locking for old PD versions
- static void Lock() {}
- static void Unlock() {}
- #endif
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- // Max 4.2 upwards!
- static void Lock() { critical_enter(0); }
- static void Unlock() { critical_exit(0); }
-#else
-#error
-#endif
-
-//! @} FLEXT_S_LOCK
-
- /*! \defgroup FLEXT_S_THREAD Flext thread handling
- @{
- */
-
- //! Check if current thread is the realtime system's thread
- static bool IsSystemThread() {
-#ifdef FLEXT_THREADS
- return IsThread(GetSysThreadId());
-#else
- return true;
-#endif
- }
-
-#ifdef FLEXT_THREADS
-
- //! thread type
-#if FLEXT_THREADS == FLEXT_THR_MP
- typedef MPTaskID thrid_t;
-#elif FLEXT_THREADS == FLEXT_THR_POSIX
- typedef pthread_t thrid_t;
-#elif FLEXT_THREADS == FLEXT_THR_WIN32
- typedef DWORD thrid_t;
-#else
-#error
-#endif
-
- /*! \brief Get current thread id
- */
- static thrid_t GetThreadId() {
-#if FLEXT_THREADS == FLEXT_THR_POSIX
- return pthread_self();
-#elif FLEXT_THREADS == FLEXT_THR_MP
- return MPCurrentTaskID();
-#elif FLEXT_THREADS == FLEXT_THR_WIN32
- return GetCurrentThreadId();
-#else
-#error
-#endif
- }
-
- /*! \brief Get system thread id
- */
- static thrid_t GetSysThreadId() { return thrid; }
-
- //! Check if current thread should terminate
- static bool ShouldExit();
-
- //! Check if current thread is the realtime system's thread
- static bool IsThread(thrid_t t,thrid_t ref = GetThreadId()) {
-#if FLEXT_THREADS == FLEXT_THR_POSIX
- return pthread_equal(ref,t) != 0;
-#else
- return ref == t;
-#endif
- }
-
-
- /*! \brief Thread parameters
- \internal
- */
- class FLEXT_SHARE thr_params:
- public flext_root
- {
- public:
- thr_params(int n = 1);
- ~thr_params();
-
- void set_any(const t_symbol *s,int argc,const t_atom *argv);
- void set_list(int argc,const t_atom *argv);
-
- FLEXT_CLASSDEF(flext_base) *cl;
- union _data {
- bool _bool;
- float _float;
- int _int;
- t_symptr _t_symptr;
- AtomAnything *_any;
- AtomList *_list;
- void *_ext;
- } *var;
- };
-
-protected:
-
- static thrid_t thrhelpid;
- static thrid_t thrmsgid;
- static void ThrHelper(void *);
-
- //! the system's thread id
- static thrid_t thrid; // the system thread
-
-private:
- static bool StartHelper(); // used in flext::Setup()
-
-public:
-
- /*! \brief Yield to other threads
- \remark A call to this is only needed for systems with cooperative multitasking like MacOS<=9
- */
- static void ThrYield() {
-#if FLEXT_THREADS == FLEXT_THR_POSIX
- // for a preemptive system this should do nothing
- sched_yield();
-#elif FLEXT_THREADS == FLEXT_THR_MP
- MPYield();
-#elif FLEXT_THREADS == FLEXT_THR_WIN32
- SwitchToThread();
-#else
-#error
-#endif
- }
-
- /*! \brief Query whether task is preemptive
- */
- static bool IsThreadPreemptive(thrid_t t = GetThreadId()) {
-#if FLEXT_THREADS == FLEXT_THR_POSIX || FLEXT_THREADS == FLEXT_THR_WIN32
- return true;
-#elif FLEXT_THREADS == FLEXT_THR_MP
- return MPTaskIsPreemptive(t);
-#else
-#error
-#endif
- }
-
-
- /*! \brief Increase/Decrease priority of a thread
- */
- static bool RelPriority(int dp,thrid_t ref = GetSysThreadId(),thrid_t thr = GetThreadId());
-
- /*! \brief Get priority of a thread
- */
- static int GetPriority(thrid_t thr = GetThreadId());
-
- /*! \brief Set priority of a thread
- */
- static bool SetPriority(int p,thrid_t thr = GetThreadId());
-
- /*! \brief Thread mutex
- \sa pthreads documentation
- */
- class FLEXT_SHARE ThrMutex:
- public flext_root
-#if FLEXT_THREADS == FLEXT_THR_POSIX
- {
- public:
- //! Construct thread mutex
- ThrMutex() { pthread_mutex_init(&mutex,NULL); }
- //! Destroy thread mutex
- ~ThrMutex() { pthread_mutex_destroy(&mutex); }
-
- //! Lock thread mutex
- bool Lock() { return pthread_mutex_lock(&mutex) == 0; }
- /*! Wait to lock thread mutex.
- \todo Implement!
- */
-// bool WaitForLock(double tm) { return pthread_mutex_lock(&mutex) == 0; }
- //! Try to lock, but don't wait
- bool TryLock() { return pthread_mutex_trylock(&mutex) == 0; }
- //! Unlock thread mutex
- bool Unlock() { return pthread_mutex_unlock(&mutex) == 0; }
-
- protected:
- pthread_mutex_t mutex;
-// int cnt;
- };
-#elif FLEXT_THREADS == FLEXT_THR_WIN32
- {
- public:
- //! Construct thread mutex
- ThrMutex() { ::InitializeCriticalSection(&mutex); }
- //! Destroy thread mutex
- ~ThrMutex() { ::DeleteCriticalSection(&mutex); }
-
- //! Lock thread mutex
- bool Lock() { ::EnterCriticalSection(&mutex); return true; }
- /*! Wait to lock thread mutex.
- \todo Implement!
- */
-// bool WaitForLock(double tm) { return pthread_mutex_lock(&mutex) == 0; }
- //! Try to lock, but don't wait
- bool TryLock() { return ::TryEnterCriticalSection(&mutex) != 0; }
- //! Unlock thread mutex
- bool Unlock() { ::LeaveCriticalSection(&mutex); return true; }
-
- protected:
- CRITICAL_SECTION mutex;
- };
-#elif FLEXT_THREADS == FLEXT_THR_MP
- {
- public:
- //! Construct thread mutex
- ThrMutex() { MPCreateCriticalRegion(&crit); }
- //! Destroy thread mutex
- ~ThrMutex() { MPDeleteCriticalRegion(crit); }
-
- //! Lock thread mutex
- bool Lock() { return MPEnterCriticalRegion(crit,kDurationForever) == noErr; }
- //! Wait to lock thread mutex
-// bool WaitForLock(double tm) { return MPEnterCriticalRegion(crit,tm*kDurationMicrosecond*1.e6) == noErr; }
- //! Try to lock, but don't wait
- bool TryLock() { return MPEnterCriticalRegion(crit,kDurationImmediate) == noErr; }
- //! Unlock thread mutex
- bool Unlock() { return MPExitCriticalRegion(crit) == noErr; }
-
- protected:
- MPCriticalRegionID crit;
- };
-#else
-#error "Not implemented"
-#endif
-
- /*! \brief Thread conditional
- \sa pthreads documentation
- */
- class FLEXT_SHARE ThrCond
-#if FLEXT_THREADS == FLEXT_THR_POSIX
- :public ThrMutex
- {
- public:
- //! Construct thread conditional
- ThrCond() { pthread_cond_init(&cond,NULL); }
- //! Destroy thread conditional
- ~ThrCond() { pthread_cond_destroy(&cond); }
-
- //! Wait for condition
- bool Wait();
-
- /*! Wait for condition (for a certain time).
- \param ftime Wait time in seconds
- \ret true = signalled, false = timed out
- \remark If ftime = 0 this may suck away your cpu if used in a signalled loop.
- \remark The time resolution of the implementation is required to be at least ms.
- */
- bool TimedWait(double ftime);
-
- //! Signal condition
- bool Signal() { return pthread_cond_signal(&cond) == 0; }
-
- protected:
- pthread_cond_t cond;
- };
-#elif FLEXT_THREADS == FLEXT_THR_WIN32
- {
- public:
- //! Construct thread conditional
- ThrCond() { cond = CreateEvent(NULL,FALSE,FALSE,NULL); }
- //! Destroy thread conditional
- ~ThrCond() { CloseHandle(cond); }
-
- //! Wait for condition
- bool Wait() { return WaitForSingleObject(cond,INFINITE) == WAIT_OBJECT_0; }
-
- /*! Wait for condition (for a certain time).
- \param ftime Wait time in seconds
- \ret true = signalled, false = timed out
- \remark If ftime = 0 this may suck away your cpu if used in a signalled loop.
- \remark The time resolution of the implementation is required to be at least ms.
- */
- bool TimedWait(double ftime) { return WaitForSingleObject(cond,(LONG)(ftime*1000)) == WAIT_OBJECT_0; }
-
- //! Signal condition
- bool Signal() { return SetEvent(cond) != 0; }
-
- protected:
- HANDLE cond;
- };
-#elif FLEXT_THREADS == FLEXT_THR_MP
- {
- public:
- //! Construct thread conditional
- ThrCond() { MPCreateEvent(&ev); }
- //! Destroy thread conditional
- ~ThrCond() { MPDeleteEvent(ev); }
-
- //! Wait for condition
- bool Wait() { return MPWaitForEvent(ev,NULL,kDurationForever) == noErr; }
-
- /*! \brief Wait for condition (for a certain time).
- \param time Wait time in seconds
- */
- bool TimedWait(double tm) { return MPWaitForEvent(ev,NULL,tm*kDurationMicrosecond*1.e6) == noErr; }
-
- //! Signal condition
- bool Signal() { return MPSetEvent(ev,1) == noErr; } // one bit needs to be set at least
-
- protected:
- MPEventID ev;
- };
-#else
-#error "Not implemented"
-#endif
-
- /*! \brief Add current thread to list of active threads.
- \return true on success
- \internal
- */
- static bool PushThread();
-
- /*! \brief Remove current thread from list of active threads.
- \internal
- */
- static void PopThread();
-
- /*! \brief Launch a thread.
- \param meth Thread function
- \param params Parameters to pass to the thread, may be NULL if not needed.
- \return Thread id on success, NULL on failure
- */
- static bool LaunchThread(void (*meth)(thr_params *p),thr_params *params = NULL);
-
- /*! \brief Terminate a thread.
- \param meth Thread function
- \param params Parameters to pass to the thread, may be NULL if not needed.
- \return True if at least one matching thread has been found.
- \remark Terminates all running threads with matching meth and params.
- \note Function doesn NOT wait for termination
- */
- static bool StopThread(void (*meth)(thr_params *p),thr_params *params = NULL,bool wait = false);
-
-#endif // FLEXT_THREADS
-
-//! @} FLEXT_S_THREAD
-
-
-// --- timer stuff -----------------------------------------------
-
-/*! \defgroup FLEXT_S_TIMER Flext timer handling
- @{
-
- \remark The clock of the real-time system is used for most of these functions.
- \remark Since this clock can be synchronized to an external clock (or e.g. the audio card)
- \remark it may differ from the clock of the operating system
-*/
-
- /*! \brief Get time since real-time system startup.
- \note This is not the time of the operating system but of the real-time system.
- \note It may depend on the time source the system is synchronized to (e.g. audio sample rate).
- */
- static double GetTime()
- {
- #if FLEXT_SYS == FLEXT_SYS_PD
- return clock_gettimesince(0)*0.001;
- #elif FLEXT_SYS == FLEXT_SYS_MAX
- double tm;
- clock_getftime(&tm);
- return tm*0.001;
- #else
- #error Not implemented
- #endif
- }
-
- /*! \brief Get time granularity of the GetTime function.
- \note This can be zero if not determined.
- */
- static double GetTimeGrain()
- {
- #if FLEXT_SYS == FLEXT_SYS_PD
- return 0;
- #elif FLEXT_SYS == FLEXT_SYS_MAX
- return 0.001;
- #else
- #error Not implemented
- #endif
- }
-
- /*! \brief Get operating system time since flext startup.
- */
- static double GetOSTime();
-
- /*! \brief Sleep for an amount of time.
- \remark The OS clock is used for that.
- \note Clearly in a real-time system this should only be used in a detached thread.
- */
- static void Sleep(double s);
-
- /*! \brief Class encapsulating a timer with callback functionality.
- This class can either be used with FLEXT_ADDTIMER or used as a base class with an overloaded virtual Work function.
- */
- class FLEXT_SHARE Timer:
- public flext_root
- {
- public:
- Timer(bool queued = false);
- virtual ~Timer();
-
- //! Set timer callback function.
- void SetCallback(void (*cb)(void *data)) { clss = NULL,cback = cb; }
- //! Set timer callback function (with class pointer).
- void SetCallback(FLEXT_CLASSDEF(flext_base) &th,bool (*cb)(FLEXT_CLASSDEF(flext_base) *th,void *data)) { clss = &th,cback = (void (*)(void *))cb; }
-
- //! Clear timer.
- bool Reset();
- //! Trigger a one shot at an absolute time.
- bool At(double time,void *data = NULL,bool dopast = true);
- //! Trigger a one shot interval.
- bool Delay(double time,void *data = NULL);
- //! Trigger a periodic interval.
- bool Periodic(double time,void *data = NULL);
- //! Trigger immediately.
- bool Now(void *data = NULL) { return Delay(0,data); }
-
- //! Worker function, called on every timer event.
- virtual void Work();
-
- protected:
- static void callback(Timer *tmr);
-
-#if FLEXT_SYS == FLEXT_SYS_PD
- t_clock *clk;
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- static void queuefun(Timer *tmr);
- t_clock *clk;
- t_qelem *qelem;
-#else
-#error Not implemented
-#endif
-
- const bool queued;
- void (*cback)(void *data);
- FLEXT_CLASSDEF(flext_base) *clss;
- void *userdata;
- double period;
- };
-
-//! @} FLEXT_S_TIMER
-
- //! Check if we are in DSP time
- static bool InDSP() { return indsp; }
-
-// --- SIMD functionality -----------------------------------------------
-
-/*! \defgroup FLEXT_S_SIMD Cross platform SIMD support for modern CPUs
- @{
-*/
- enum simd_type {
- simd_none = 0,
- simd_mmx = 0x01,
- simd_3dnow = 0x02,
- simd_sse = 0x04,
- simd_sse2 = 0x08,
- simd_altivec = 0x10
- };
-
- /*! Check for SIMD capabilities of the CPU */
- static unsigned long GetSIMDCapabilities();
-
-
- static void MulSamples(t_sample *dst,const t_sample *src,t_sample mul,int cnt);
- static void MulSamples(t_sample *dst,const t_sample *src,const t_sample *mul,int cnt);
- static void AddSamples(t_sample *dst,const t_sample *src,t_sample add,int cnt);
- static void AddSamples(t_sample *dst,const t_sample *src,const t_sample *add,int cnt);
- static void ScaleSamples(t_sample *dst,const t_sample *src,t_sample mul,t_sample add,int cnt);
- static void ScaleSamples(t_sample *dst,const t_sample *src,t_sample mul,const t_sample *add,int cnt);
- static void ScaleSamples(t_sample *dst,const t_sample *src,const t_sample *mul,const t_sample *add,int cnt);
-
-//! @} FLEXT_S_SIMD
-
-
-//! @} FLEXT_SUPPORT
-
-protected:
-#ifdef __MRC__
- friend class flext_obj;
-#endif
-
- static void Setup();
-
- static bool chktilde(const char *objname);
-
- static unsigned long simdcaps;
-
- static const t_symbol *sym_buffer;
- static const t_symbol *sym_size;
- static const t_symbol *sym_attributes;
- static const t_symbol *sym_methods;
-
- //! flag if we are within DSP
- static bool indsp;
-};
-
-
-// gcc doesn't like these to be included into the flext class (even if static)
-inline bool operator ==(const t_atom &a,const t_atom &b) { return flext::CmpAtom(a,b) == 0; }
-inline bool operator !=(const t_atom &a,const t_atom &b) { return flext::CmpAtom(a,b) != 0; }
-inline bool operator <(const t_atom &a,const t_atom &b) { return flext::CmpAtom(a,b) < 0; }
-inline bool operator <=(const t_atom &a,const t_atom &b) { return flext::CmpAtom(a,b) <= 0; }
-inline bool operator >(const t_atom &a,const t_atom &b) { return flext::CmpAtom(a,b) > 0; }
-inline bool operator >=(const t_atom &a,const t_atom &b) { return flext::CmpAtom(a,b) >= 0; }
-
-//! @} // FLEXT_SUPPORT
-
-#endif
diff --git a/externals/grill/flext/source/flthr.cpp b/externals/grill/flext/source/flthr.cpp
deleted file mode 100644
index 36559997..00000000
--- a/externals/grill/flext/source/flthr.cpp
+++ /dev/null
@@ -1,646 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file flthr.cpp
- \brief Implementation of the flext thread functionality.
-*/
-
-#include "flext.h"
-
-#ifdef FLEXT_THREADS
-
-// maximum wait time for threads to finish (in ms)
-#define MAXIMUMWAIT 100
-
-
-#include "flinternal.h"
-#include "flcontainers.h"
-
-#include <time.h>
-
-#if FLEXT_OSAPI == FLEXT_OSAPI_MAC_MACH || FLEXT_OSAPI == FLEXT_OSAPI_UNIX_POSIX || FLEXT_OSAPI == FLEXT_OSAPI_WIN_POSIX
-#include <sys/time.h>
-#include <unistd.h>
-#elif FLEXT_OS == FLEXT_OS_WIN
-#include <sys/timeb.h>
-#endif
-
-#if FLEXT_THREADS == FLEXT_THR_WIN32 && WINVER < 0x0500
-#error WIN32 threads need Windows SDK version >= 0x500
-#endif
-
-#include <errno.h>
-
-//! Thread id of system thread - will be initialized in flext::Setup
-flext::thrid_t flext::thrid;
-
-//! Thread id of helper thread - will be initialized in flext::Setup
-flext::thrid_t flext::thrhelpid;
-
-
-//! \brief This represents an entry to the list of active method threads
-class thr_entry
- : public flext
- , public Fifo::Cell
-{
-public:
- void Set(void (*m)(thr_params *),thr_params *p,thrid_t id = GetThreadId())
- {
- th = p?p->cl:NULL;
- meth = m,params = p,thrid = id;
- shouldexit = false;
-#if FLEXT_THREADS == FLEXT_THR_MP
- weight = 100; // MP default weight
-#endif
- }
-
- //! \brief Check if this class represents the current thread
- bool Is(thrid_t id = GetThreadId()) const { return IsThread(thrid,id); }
-
- FLEXT_CLASSDEF(flext_base) *This() const { return th; }
- thrid_t Id() const { return thrid; }
-
- FLEXT_CLASSDEF(flext_base) *th;
- void (*meth)(thr_params *);
- thr_params *params;
- thrid_t thrid;
- bool shouldexit;
-#if FLEXT_THREADS == FLEXT_THR_MP
- int weight;
-#endif
-};
-
-template<class T>
-class ThrFinder:
- public T
-{
-public:
- void Push(thr_entry *e) { T::Push(e); }
- thr_entry *Pop() { return T::Pop(); }
-
- thr_entry *Find(flext::thrid_t id,bool pop = false)
- {
- TypedLifo<thr_entry> qutmp;
- thr_entry *fnd;
- while((fnd = Pop()) && !fnd->Is(id)) qutmp.Push(fnd);
- // put back entries
- for(thr_entry *ti; (ti = qutmp.Pop()) != NULL; ) Push(ti);
- if(fnd && !pop) Push(fnd);
- return fnd;
- }
-};
-
-static ThrFinder< PooledLifo<thr_entry,1,10> > thrpending;
-static ThrFinder< TypedLifo<thr_entry> > thractive,thrstopped;
-
-//! Helper thread conditional
-static flext::ThrCond *thrhelpcond = NULL;
-
-
-static void LaunchHelper(thr_entry *e)
-{
- e->thrid = flext::GetThreadId();
- e->meth(e->params);
-}
-
-bool initialized = false;
-
-//! Start helper thread
-bool flext::StartHelper()
-{
- bool ok = false;
- initialized = false;
-#if FLEXT_THREADS == FLEXT_THR_POSIX
- pthread_attr_t attr;
- pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_DETACHED);
-
- pthread_t tmp;
- ok = pthread_create (&tmp,&attr,(void *(*)(void *))ThrHelper,NULL) == 0;
-#elif FLEXT_THREADS == FLEXT_THR_MP
- if(!MPLibraryIsLoaded())
- error("Thread library is not loaded");
- else {
- MPTaskID tmp;
- OSStatus ret = MPCreateTask((TaskProc)ThrHelper,NULL,0,0,0,0,0,&tmp);
- ok = ret == noErr;
- }
-#elif FLEXT_THREADS == FLEXT_THR_WIN32
- ok = _beginthread(ThrHelper,0,NULL) >= 0;
-#else
-#error
-#endif
- if(!ok)
- error("flext - Could not launch helper thread!");
- else {
- // now we have to wait for thread helper to initialize
- while(!initialized) Sleep(0.001);
-
- // we are ready for threading now!
- }
-
-#if FLEXT_THREADS == FLEXT_THR_POSIX
- pthread_attr_destroy(&attr);
-#endif
- return ok;
-}
-
-//! Static helper thread function
-void flext::ThrHelper(void *)
-{
- thrhelpid = GetThreadId();
-
-#if FLEXT_THREADS == FLEXT_THR_POSIX
- // set prototype thread attributes
- pthread_attr_t attr;
- pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_DETACHED);
-#endif
-
- // set thread priority one point below normal
- // so thread construction won't disturb real-time audio
- RelPriority(-1);
-
- thrhelpcond = new ThrCond;
-
- initialized = true;
-
- // helper loop
- for(;;) {
- thrhelpcond->Wait();
-
- // start all inactive threads
- thr_entry *ti;
- while((ti = thrpending.Pop()) != NULL) {
- bool ok;
-
- #if FLEXT_THREADS == FLEXT_THR_POSIX
- thrid_t dummy;
- ok = pthread_create (&dummy,&attr,(void *(*)(void *))LaunchHelper,ti) == 0;
- #elif FLEXT_THREADS == FLEXT_THR_MP
- thrid_t dummy;
- ok = MPCreateTask((TaskProc)LaunchHelper,ti,0,0,0,0,0,&dummy) == noErr;
- #elif FLEXT_THREADS == FLEXT_THR_WIN32
- ok = _beginthread((void (*)(void *))LaunchHelper,0,ti) >= 0;
- #else
- #error
- #endif
- if(!ok) {
- error("flext - Could not launch thread!");
- thrpending.Free(ti); ti = NULL;
- }
- else
- // insert into queue of active threads
- thractive.Push(ti);
- }
- }
-
- FLEXT_ASSERT(false);
-/*
- // Never reached!
-
- delete thrhelpcond;
- thrhelpcond = NULL;
-
-#if FLEXT_THREADS == FLEXT_THR_POSIX
- pthread_attr_destroy(&attr);
-#endif
-*/
-}
-
-
-bool flext::LaunchThread(void (*meth)(thr_params *p),thr_params *p)
-{
- FLEXT_ASSERT(thrhelpcond);
-
- // make an entry into thread list
- thr_entry *e = thrpending.New();
- e->Set(meth,p);
- thrpending.Push(e);
- // signal thread helper
- thrhelpcond->Signal();
-
- return true;
-}
-
-static bool waitforstopped(TypedFifo<thr_entry> &qufnd,float wait = 0)
-{
- TypedLifo<thr_entry> qutmp;
-
- double until;
- if(wait) until = flext::GetOSTime()+wait;
-
- for(;;) {
- thr_entry *fnd = qufnd.Get();
- if(!fnd) break; // no more entries -> done!
-
- thr_entry *ti;
- // search for entry
- while((ti = thrstopped.Pop()) != NULL && ti != fnd) qutmp.Push(ti);
- // put back entries
- while((ti = qutmp.Pop()) != NULL) thrstopped.Push(ti);
-
- if(ti) {
- // still in thrstopped queue
- qufnd.Put(fnd);
- // yield to other threads
- flext::ThrYield();
-
- if(wait && flext::GetOSTime() > until)
- // not successful -> remaining thread are still in qufnd queue
- return false;
- }
- }
- return true;
-}
-
-bool flext::StopThread(void (*meth)(thr_params *p),thr_params *p,bool wait)
-{
- FLEXT_ASSERT(thrhelpcond);
-
- TypedLifo<thr_entry> qutmp;
- thr_entry *ti;
-
- // first search pending queue
- // --------------------------
-
- {
- bool found = false;
- while((ti = thrpending.Pop()) != NULL)
- if(ti->meth == meth && ti->params == p) {
- // found -> thread hasn't started -> just delete
- thrpending.Free(ti);
- found = true;
- }
- else
- qutmp.Push(ti);
-
- // put back into pending queue (order doesn't matter)
- while((ti = qutmp.Pop()) != NULL) thrpending.Push(ti);
-
- if(found) return true;
- }
-
- // now search active queue
- // -----------------------
-
- TypedFifo<thr_entry> qufnd;
-
- while((ti = thractive.Pop()) != NULL)
- if(ti->meth == meth && ti->params == p) {
- thrstopped.Push(ti);
- thrhelpcond->Signal();
- qufnd.Put(ti);
- }
- else
- qutmp.Push(ti);
-
- // put back into pending queue (order doesn't matter)
- while((ti = qutmp.Pop()) != NULL) thractive.Push(ti);
-
- // wakeup helper thread
- thrhelpcond->Signal();
-
- // now wait for entries in qufnd to have vanished from thrstopped
- if(wait)
- return waitforstopped(qufnd);
- else
- return qufnd.Size() == 0;
-}
-
-bool flext::ShouldExit()
-{
- return thrstopped.Find(GetThreadId()) != NULL;
-}
-
-bool flext::PushThread()
-{
- // set priority of newly created thread one point below the system thread's
- RelPriority(-1);
- return true;
-}
-
-void flext::PopThread()
-{
- thrid_t id = GetThreadId();
- thr_entry *fnd = thrstopped.Find(id,true);
- if(!fnd) fnd = thractive.Find(id,true);
-
- if(fnd)
- thrpending.Free(fnd);
-#ifdef FLEXT_DEBUG
- else
- post("flext - INTERNAL ERROR: Thread not found!");
-#endif
-}
-
-//! Terminate all object threads
-bool flext_base::StopThreads()
-{
- FLEXT_ASSERT(thrhelpcond);
-
- TypedLifo<thr_entry> qutmp;
- thr_entry *ti;
-
- // first search pending queue
- // --------------------------
-
- while((ti = thrpending.Pop()) != NULL)
- if(ti->This() == this)
- // found -> thread hasn't started -> just delete
- thrpending.Free(ti);
- else
- qutmp.Push(ti);
-
- // put back into pending queue (order doesn't matter)
- while((ti = qutmp.Pop()) != NULL) thrpending.Push(ti);
-
- // now search active queue
- // -----------------------
-
- TypedFifo<thr_entry> qufnd;
-
- while((ti = thractive.Pop()) != NULL)
- if(ti->This() == this) {
- thrstopped.Push(ti);
- thrhelpcond->Signal();
- qufnd.Put(ti);
- }
- else
- qutmp.Push(ti);
-
- // put back into pending queue (order doesn't matter)
- while((ti = qutmp.Pop()) != NULL) thractive.Push(ti);
-
- // wakeup helper thread
- thrhelpcond->Signal();
-
- // now wait for entries in qufnd to have vanished from thrstopped
- if(!waitforstopped(qufnd,MAXIMUMWAIT*0.001f)) {
-#ifdef FLEXT_DEBUG
- post("flext - doing hard thread termination");
-#endif
-
- // timeout -> hard termination
- while((ti = qufnd.Get()) != NULL) {
-#if FLEXT_THREADS == FLEXT_THR_POSIX
- if(pthread_cancel(ti->thrid))
- post("%s - Thread could not be terminated!",thisName());
-#elif FLEXT_THREADS == FLEXT_THR_MP
- MPTerminateTask(ti->thrid,0);
- // here, we should use a task queue to check whether the task has really terminated!!
-#elif FLEXT_THREADS == FLEXT_THR_WIN32
- // can't use the c library function _endthread.. memory leaks will occur
- HANDLE hnd = OpenThread(THREAD_ALL_ACCESS,TRUE,ti->thrid);
- TerminateThread(hnd,0);
-#else
-#error Not implemented
-#endif
- thrpending.Free(ti);
- }
- return false;
- }
- else
- return true;
-}
-
-bool flext::RelPriority(int dp,thrid_t ref,thrid_t id)
-{
-#if FLEXT_THREADS == FLEXT_THR_POSIX
- sched_param parm;
- int policy;
- if(pthread_getschedparam(ref,&policy,&parm) < 0) {
-#ifdef FLEXT_DEBUG
- post("flext - failed to get thread priority");
-#endif
- return false;
- }
- else {
- parm.sched_priority += dp;
-
- // MSVC++ 6 produces wrong code with the following lines!!!
-// int schmin = sched_get_priority_min(policy);
-// int schmax = sched_get_priority_max(policy);
-
- if(parm.sched_priority < sched_get_priority_min(policy)) {
-#ifdef FLEXT_DEBUG
- post("flext - minimum thread priority reached");
-#endif
- parm.sched_priority = sched_get_priority_min(policy);
- }
- else if(parm.sched_priority > sched_get_priority_max(policy)) {
-#ifdef FLEXT_DEBUG
- post("flext - maximum thread priority reached");
-#endif
- parm.sched_priority = sched_get_priority_max(policy);
- }
-
- if(pthread_setschedparam(id,policy,&parm) < 0) {
-#ifdef FLEXT_DEBUG
- post("flext - failed to change thread priority");
-#endif
- return false;
- }
- }
- return true;
-
-#elif FLEXT_THREADS == FLEXT_THR_WIN32
- HANDLE href = OpenThread(THREAD_ALL_ACCESS,TRUE,ref);
- HANDLE hid = OpenThread(THREAD_ALL_ACCESS,TRUE,id);
- int pr = GetThreadPriority(href);
-
- if(pr == THREAD_PRIORITY_ERROR_RETURN) {
-#ifdef FLEXT_DEBUG
- post("flext - failed to get thread priority");
-#endif
- return false;
- }
-
- pr += dp;
- if(pr < THREAD_PRIORITY_IDLE) {
-#ifdef FLEXT_DEBUG
- post("flext - minimum thread priority reached");
-#endif
- pr = THREAD_PRIORITY_IDLE;
- }
- else if(pr > THREAD_PRIORITY_TIME_CRITICAL) {
-#ifdef FLEXT_DEBUG
- post("flext - maximum thread priority reached");
-#endif
- pr = THREAD_PRIORITY_TIME_CRITICAL;
- }
-
- if(SetThreadPriority(hid,pr) == 0) {
-#ifdef FLEXT_DEBUG
- post("flext - failed to change thread priority");
-#endif
- return false;
- }
- return true;
-
-#elif FLEXT_THREADS == FLEXT_THR_MP
- thr_entry *ti = thrpending.Find(id);
- if(!ti) ti = thractive.Find(id);
- if(ti) {
- // thread found in list
- int w = GetPriority(id);
- if(dp < 0) w /= 1<<(-dp);
- else w *= 1<<dp;
- if(w < 1) {
- #ifdef FLEXT_DEBUG
- post("flext - minimum thread priority reached");
- #endif
- w = 1;
- }
- else if(w > 10000) {
- #ifdef FLEXT_DEBUG
- post("flext - maximum thread priority reached");
- #endif
- w = 10000;
- }
- ti->weight = w;
- return MPSetTaskWeight(id,w) == noErr;
- }
- else return false;
-#else
-#error
-#endif
-}
-
-
-int flext::GetPriority(thrid_t id)
-{
-#if FLEXT_THREADS == FLEXT_THR_POSIX
- sched_param parm;
- int policy;
- if(pthread_getschedparam(id,&policy,&parm) < 0) {
-#ifdef FLEXT_DEBUG
- post("flext - failed to get parms");
-#endif
- return -1;
- }
- return parm.sched_priority;
-
-#elif FLEXT_THREADS == FLEXT_THR_WIN32
- HANDLE hid = OpenThread(THREAD_ALL_ACCESS,TRUE,id);
- int pr = GetThreadPriority(hid);
-
- if(pr == THREAD_PRIORITY_ERROR_RETURN) {
-#ifdef FLEXT_DEBUG
- post("flext - failed to get thread priority");
-#endif
- return -1;
- }
- return pr;
-
-#elif FLEXT_THREADS == FLEXT_THR_MP
- thr_entry *ti = thrpending.Find(id);
- if(!ti) ti = thractive.Find(id);
- return ti?ti->weight:-1;
-#else
-#error
-#endif
-}
-
-
-bool flext::SetPriority(int p,thrid_t id)
-{
-#if FLEXT_THREADS == FLEXT_THR_POSIX
- sched_param parm;
- int policy;
- if(pthread_getschedparam(id,&policy,&parm) < 0) {
-#ifdef FLEXT_DEBUG
- post("flext - failed to get parms");
-#endif
- return false;
- }
- else {
- parm.sched_priority = p;
- if(pthread_setschedparam(id,policy,&parm) < 0) {
-#ifdef FLEXT_DEBUG
- post("flext - failed to change priority");
-#endif
- return false;
- }
- }
- return true;
-
-#elif FLEXT_THREADS == FLEXT_THR_WIN32
- HANDLE hid = OpenThread(THREAD_ALL_ACCESS,TRUE,id);
- if(SetThreadPriority(hid,p) == 0) {
-#ifdef FLEXT_DEBUG
- post("flext - failed to change thread priority");
-#endif
- return false;
- }
- return true;
-
-#elif FLEXT_THREADS == FLEXT_THR_MP
- thr_entry *ti = thrpending.Find(id);
- if(!ti) ti = thractive.Find(id);
- return ti && MPSetTaskWeight(id,ti->weight = p) == noErr;
-#else
-#error
-#endif
-}
-
-
-flext_base::thr_params::thr_params(int n): cl(NULL),var(new _data[n]) {}
-flext_base::thr_params::~thr_params() { if(var) delete[] var; }
-
-void flext_base::thr_params::set_any(const t_symbol *s,int argc,const t_atom *argv) { var[0]._any = new AtomAnything(s,argc,argv); }
-void flext_base::thr_params::set_list(int argc,const t_atom *argv) { var[0]._list = new AtomList(argc,argv); }
-
-
-#if FLEXT_THREADS == FLEXT_THR_POSIX
-bool flext::ThrCond::Wait() {
- Lock();
- bool ret = pthread_cond_wait(&cond,&mutex) == 0;
- Unlock();
- return ret;
-}
-
-bool flext::ThrCond::TimedWait(double ftm)
-{
- timespec tm;
-#if FLEXT_OS == FLEXT_OS_WIN && FLEXT_OSAPI == FLEXT_OSAPI_WIN_NATIVE
-#ifdef _MSC_VER
- _timeb tmb;
- _ftime(&tmb);
-#else
- timeb tmb;
- ftime(&tmb);
-#endif
- tm.tv_nsec = tmb.millitm*1000000;
- tm.tv_sec = (long)tmb.time;
-#else // POSIX
-#if 0 // find out when the following is defined
- clock_gettime(CLOCK_REALTIME,tm);
-#else
- struct timeval tp;
- gettimeofday(&tp, NULL);
- tm.tv_nsec = tp.tv_usec*1000;
- tm.tv_sec = tp.tv_sec;
-#endif
-#endif
-
- tm.tv_nsec += (long)((ftm-(long)ftm)*1.e9);
- long nns = tm.tv_nsec%1000000000;
- tm.tv_sec += (long)ftm+(tm.tv_nsec-nns)/1000000000;
- tm.tv_nsec = nns;
-
- Lock();
- bool ret = pthread_cond_timedwait(&cond,&mutex,&tm) == 0;
- Unlock();
- return ret;
-}
-#endif
-
-#endif // FLEXT_THREADS
diff --git a/externals/grill/flext/source/fltimer.cpp b/externals/grill/flext/source/fltimer.cpp
deleted file mode 100644
index 6f13999f..00000000
--- a/externals/grill/flext/source/fltimer.cpp
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file fltimer.cpp
- \brief flext timer functions and classes
-*/
-
-#include "flext.h"
-
-#if FLEXT_OS == FLEXT_OS_WIN
-#include <windows.h>
-#elif FLEXT_OS == FLEXT_OS_LINUX || FLEXT_OS == FLEXT_OS_IRIX || FLEXT_OSAPI == FLEXT_OSAPI_MAC_MACH
-#include <unistd.h>
-#include <sys/time.h>
-#elif FLEXT_OS == FLEXT_OS_MAC
-#include <Timer.h>
-#include <Threads.h>
-#endif
-
-
-#if FLEXT_OS == FLEXT_OS_WIN
-static double perffrq = 0;
-#endif
-
-static double getstarttime();
-static double starttime = getstarttime();
-
-static double getstarttime()
-{
-#if FLEXT_OS == FLEXT_OS_WIN
- LARGE_INTEGER frq;
- if(QueryPerformanceFrequency(&frq)) perffrq = (double)frq.QuadPart;
-#endif
-
- starttime = 0;
- return flext::GetOSTime();
-}
-
-double flext::GetOSTime()
-{
- double tm;
-
-#if FLEXT_OS == FLEXT_OS_WIN
- LARGE_INTEGER cnt;
- if(perffrq && QueryPerformanceCounter(&cnt))
- tm = cnt.QuadPart/perffrq;
- else {
- SYSTEMTIME systm;
- FILETIME fltm;
- GetSystemTime(&systm);
- SystemTimeToFileTime(&systm,&fltm);
- tm = ((LARGE_INTEGER *)&fltm)->QuadPart*1.e-7;
- }
-#elif FLEXT_OS == FLEXT_OS_LINUX || FLEXT_OS == FLEXT_OS_IRIX || FLEXT_OSAPI == FLEXT_OSAPI_MAC_MACH // POSIX
- timeval tmv;
- gettimeofday(&tmv,NULL);
- tm = tmv.tv_sec+tmv.tv_usec*1.e-6;
-#elif FLEXT_OS == FLEXT_OS_MAC // that's just for OS9 & Carbon!
- UnsignedWide tick;
- Microseconds(&tick);
- tm = (tick.hi*((double)(1L<<((sizeof tick.lo)*4))*(double)(1L<<((sizeof tick.lo)*4)))+tick.lo)*1.e-6;
-#else
- #error Not implemented
-#endif
- return tm-starttime;
-}
-
-void flext::Sleep(double s)
-{
- if(s <= 0) return;
-#if FLEXT_OS == FLEXT_OS_WIN
-#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x400
-#if 0
- LARGE_INTEGER liDueTime;
- liDueTime.QuadPart = (LONGLONG)(-1.e7*s);
-
- // Create a waitable timer.
- HANDLE hTimer = CreateWaitableTimer(NULL,TRUE,NULL);
- if(hTimer) {
- if(SetWaitableTimer(hTimer,&liDueTime,0,NULL,NULL,0))
- // Wait for the timer.
- WaitForSingleObject(hTimer,INFINITE); // != WAIT_OBJECT_0)
- else
- ::Sleep((long)(s*1000.));
- CloseHandle(hTimer);
- }
- else
-#else
- LARGE_INTEGER cnt;
- if(perffrq && QueryPerformanceCounter(&cnt)) {
- LONGLONG dst = (LONGLONG)(cnt.QuadPart+perffrq*s);
- for(;;) {
- SwitchToThread(); // while waiting switch to another thread
- QueryPerformanceCounter(&cnt);
- if(cnt.QuadPart > dst) break;
- }
- }
- else
-#endif
-#endif
- // last resort....
- ::Sleep((long)(s*1000.));
-#elif FLEXT_OS == FLEXT_OS_LINUX || FLEXT_OS == FLEXT_OS_IRIX || FLEXT_OSAPI == FLEXT_OSAPI_MAC_MACH // POSIX
- usleep((long)(s*1000000.));
-#elif FLEXT_OS == FLEXT_OS_MAC // that's just for OS9 & Carbon!
- UnsignedWide tick;
- Microseconds(&tick);
- double target = tick.hi*((double)(1L<<((sizeof tick.lo)*4))*(double)(1L<<((sizeof tick.lo)*4)))+tick.lo+s*1.e6;
- for(;;) {
- // this is just a loop running until the time has passed - stone age (but we yield at least)
- Microseconds(&tick);
- if(target <= tick.hi*((double)(1L<<((sizeof tick.lo)*4))*(double)(1L<<((sizeof tick.lo)*4)))+tick.lo) break;
- YieldToAnyThread(); // yielding surely reduces the timing precision (but we're civilized)
- }
-#else
- #error Not implemented
-#endif
-}
-
-/* \param qu determines whether timed messages should be queued (low priority - only when supported by the system).
-*/
-flext::Timer::Timer(bool qu):
- queued(qu),
- clss(NULL),userdata(NULL),
- period(0)
-{
-#if FLEXT_SYS == FLEXT_SYS_PD
- clk = (t_clock *)clock_new(this,(t_method)callback);
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- clk = (t_clock *)clock_new(this,(t_method)callback);
- if(queued) qelem = (t_qelem *)qelem_new(this,(method)queuefun);
-#else
- #error Not implemented
-#endif
-}
-
-flext::Timer::~Timer()
-{
-#if FLEXT_SYS == FLEXT_SYS_PD
- clock_free(clk);
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- clock_free(clk);
- if(queued) ::qelem_free(qelem);
-#else
- #error Not implemented
-#endif
-}
-
-bool flext::Timer::Reset()
-{
-#if FLEXT_SYS == FLEXT_SYS_PD
- clock_unset(clk);
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- clock_unset(clk);
- if(queued) ::qelem_unset(qelem);
-#else
- #error Not implemented
-#endif
- return true;
-}
-
-/*! \param tm absolute time (in seconds)
- \param data user data
- \param dopast if set events with times lying in the past will be triggered immediately, if not set they are ignored
- \return true on success
-*/
-bool flext::Timer::At(double tm,void *data,bool dopast)
-{
- userdata = data;
- period = 0;
-#if FLEXT_SYS == FLEXT_SYS_PD
- const double systm = clock_gettimesince(0);
- double df = tm*1000.-systm;
- if(dopast && df < 0) df = 0;
- if(df >= 0)
- clock_delay(clk,df);
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- const double ms = tm*1000.;
- double cur;
- clock_getftime(&cur);
- if(cur <= ms)
- clock_fdelay(clk,ms-cur);
- else if(dopast) // trigger timer is past
- clock_fdelay(clk,0);
-#else
- #error Not implemented
-#endif
- return true;
-}
-
-/*! \param tm relative time (in seconds)
- \param data user data
- \return true on success
-*/
-bool flext::Timer::Delay(double tm,void *data)
-{
- userdata = data;
- period = 0;
-#if FLEXT_SYS == FLEXT_SYS_PD
- clock_delay(clk,tm*1000);
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- clock_fdelay(clk,tm*1000.);
-#else
- #error Not implemented
-#endif
- return true;
-}
-
-/*! \param tm relative time between periodic events (in seconds)
- \param data user data
- \return true on success
- \note the first event will be delayed by tm
-*/
-bool flext::Timer::Periodic(double tm,void *data)
-{
- userdata = data;
- period = tm;
-#if FLEXT_SYS == FLEXT_SYS_PD
- clock_delay(clk,tm*1000.);
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- clock_fdelay(clk,tm*1000.);
-#else
- #error Not implemented
-#endif
- return true;
-}
-
-//! \brief Callback function for system clock.
-void flext::Timer::callback(Timer *tmr)
-{
-#if FLEXT_SYS == FLEXT_SYS_MAX
- if(tmr->queued)
- qelem_set(tmr->qelem);
- else
-#endif
- tmr->Work();
-
- if(tmr->period) {
- // reschedule
-#if FLEXT_SYS == FLEXT_SYS_PD
- clock_delay(tmr->clk,tmr->period*1000.);
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- clock_fdelay(tmr->clk,tmr->period*1000.);
-#else
- #error Not implemented
-#endif
- }
-}
-
-#if FLEXT_SYS == FLEXT_SYS_MAX
-/*! \brief Callback function for low priority clock (for queued messages).
-*/
-void flext::Timer::queuefun(Timer *tmr) { tmr->Work(); }
-#endif
-
-/*! \brief Virtual worker function - by default it calls the user callback function.
- \remark The respective callback parameter format is chosen depending on whether clss is defined or not.
-*/
-void flext::Timer::Work()
-{
- if(cback) {
- if(clss)
- ((bool (*)(flext_base *,void *))cback)(clss,userdata);
- else
- cback(userdata);
- }
-}
-
diff --git a/externals/grill/flext/source/flutil.cpp b/externals/grill/flext/source/flutil.cpp
deleted file mode 100644
index 3437ee75..00000000
--- a/externals/grill/flext/source/flutil.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file flutil.cpp
- \brief Implementation of the various utility functions.
-*/
-
-#include "flext.h"
-#include <string.h>
-
-#if FLEXT_OS == FLEXT_OS_WIN
-#include <windows.h>
-#elif FLEXT_OS == FLEXT_OS_MAC
- #if FLEXT_OSAPI != FLEXT_OSAPI_MAC_MACH
- #include <MacMemory.h>
- #else
- #include <Carbon/Carbon.h>
- #endif
-#endif
-
-void flext::CopyMem(void *dst,const void *src,int bytes)
-{
-#if FLEXT_OS == FLEXT_OS_WIN
- MoveMemory(dst,src,bytes);
-#elif FLEXT_OS == FLEXT_OS_MAC
- BlockMoveData(src,dst,bytes);
-#else
- memcpy(dst,src,bytes);
-#endif
-}
-
-void flext::ZeroMem(void *dst,int bytes)
-{
-#if FLEXT_OS == FLEXT_OS_WIN
- ZeroMemory(dst,bytes);
-#elif FLEXT_OS == FLEXT_OS_MAC
- BlockZero(dst,bytes);
-#else
- memset(dst,0,bytes);
-#endif
-}
diff --git a/externals/grill/flext/source/flxlet.cpp b/externals/grill/flext/source/flxlet.cpp
deleted file mode 100644
index 9fa9486a..00000000
--- a/externals/grill/flext/source/flxlet.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-/*! \file flxlet.cpp
- \brief Implementation of the variable inlet/outlet functionality.
-*/
-
-#include "flext.h"
-#include "flinternal.h"
-#include <string.h>
-#include <stdarg.h>
-
-#define MAXLETS 256
-
-flext_base::xlet flext_base::inlist[MAXLETS],flext_base::outlist[MAXLETS];
-
-flext_base::xlet::xlet(): tp(xlet_none),desc(NULL) {}
-flext_base::xlet::~xlet() { if(desc) delete[] desc; }
-
-void flext_base::xlet::Desc(const char *c)
-{
- if(desc) delete[] desc;
- if(c) {
- size_t l = strlen(c);
- desc = new char[l+1];
- memcpy(desc,c,l+1);
- }
- else
- desc = NULL;
-}
-
-void flext_base::AddInlet(xlettype tp,int mult,const char *desc)
-{
- if(UNLIKELY(incnt+mult >= MAXLETS))
- post("%s - too many inlets",thisName());
- else
- for(int i = 0; i < mult; ++i) {
- xlet &x = inlist[incnt++];
- x.tp = tp;
- x.Desc(desc);
- }
-}
-
-void flext_base::AddOutlet(xlettype tp,int mult,const char *desc)
-{
- if(UNLIKELY(outcnt+mult >= MAXLETS))
- post("%s - too many outlets",thisName());
- else
- for(int i = 0; i < mult; ++i) {
- xlet &x = outlist[outcnt++];
- x.tp = tp;
- x.Desc(desc);
- }
-}
-
-void flext_base::DescInlet(int ix,const char *d)
-{
- if(UNLIKELY(ix >= incnt))
- post("%s - inlet %i not found",thisName(),ix);
- else
- inlist[ix].Desc(d);
-}
-
-void flext_base::DescOutlet(int ix,const char *d)
-{
- if(UNLIKELY(ix >= incnt))
- post("%s - outlet %i not found",thisName(),ix);
- else
- outlist[ix].Desc(d);
-}
-
-unsigned long flext_base::XletCode(xlettype tp,...)
-{
- unsigned long code = 0;
-
- va_list marker;
- va_start(marker,tp);
- int cnt = 0;
- xlettype arg = tp;
- for(; arg; ++cnt) {
-#ifdef FLEXT_DEBUG
- if(cnt > 9) {
- error("%s - Too many in/outlets defined - truncated to 9",thisName());
- break;
- }
-#endif
-
- code = code*10+(int)arg;
- arg = (xlettype)va_arg(marker,int);
- }
- va_end(marker);
-
- return code;
-}
-
-void flext_base::AddInlets(unsigned long code)
-{
- for(; code; code /= 10) AddInlet((xlettype)(code%10));
-}
-
-void flext_base::AddOutlets(unsigned long code)
-{
- for(; code; code /= 10) AddOutlet((xlettype)(code%10));
-}
-