aboutsummaryrefslogtreecommitdiff
path: root/externals
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2002-12-28 04:37:42 +0000
committerThomas Grill <xovo@users.sourceforge.net>2002-12-28 04:37:42 +0000
commit562dcc336797951b2a8707413aa44177484c9f2a (patch)
tree162adc736d99b6edf4c03e50061831006ac0f5c4 /externals
parent7b0d76e0a6c7b58f6a7a373755c46bde52ebea79 (diff)
""
svn path=/trunk/; revision=309
Diffstat (limited to 'externals')
-rwxr-xr-xexternals/grill/deljoin/main.cpp77
-rwxr-xr-xexternals/grill/delsplit/main.cpp61
-rw-r--r--externals/grill/flext/flext.cwbin204177 -> 205457 bytes
-rw-r--r--externals/grill/flext/flext.dsp90
-rw-r--r--externals/grill/flext/make-files.txt4
-rw-r--r--externals/grill/flext/readme.txt3
-rw-r--r--externals/grill/flext/source/flatom.cpp80
-rwxr-xr-xexternals/grill/flext/source/flatom_app.cpp76
-rwxr-xr-xexternals/grill/flext/source/flatom_part.cpp37
-rw-r--r--externals/grill/flext/source/flattr.cpp212
-rw-r--r--externals/grill/flext/source/flbase.cpp4
-rw-r--r--externals/grill/flext/source/flbase.h7
-rw-r--r--externals/grill/flext/source/flclass.h211
-rw-r--r--externals/grill/flext/source/fldefs.h177
-rw-r--r--externals/grill/flext/source/flext.cpp670
-rw-r--r--externals/grill/flext/source/flinternal.h6
-rwxr-xr-xexternals/grill/flext/source/flitem.cpp209
-rwxr-xr-xexternals/grill/flext/source/fllib.cpp4
-rwxr-xr-xexternals/grill/flext/source/flmeth.cpp120
-rwxr-xr-xexternals/grill/flext/source/flmsg.cpp256
-rw-r--r--externals/grill/flext/source/flout.cpp357
-rwxr-xr-xexternals/grill/flext/source/flproxy.cpp132
-rwxr-xr-xexternals/grill/flext/source/flqueue.cpp167
-rw-r--r--externals/grill/flext/source/flsupport.cpp18
-rw-r--r--externals/grill/flext/source/flsupport.h18
-rw-r--r--externals/grill/flext/source/flthr.cpp6
-rw-r--r--externals/grill/idelay/delay.cpp5
-rw-r--r--externals/grill/pool/main.cpp107
-rwxr-xr-xexternals/grill/pool/pool.cwbin131746 -> 131746 bytes
-rw-r--r--externals/grill/pool/pool.pd413
-rw-r--r--externals/grill/pool/readme.txt2
-rw-r--r--externals/grill/prepend/main.cpp27
-rw-r--r--externals/grill/py/pd/thread-1.pd94
-rw-r--r--externals/grill/py/readme.txt3
-rw-r--r--externals/grill/py/source/main.h2
-rw-r--r--externals/grill/py/source/py.cpp38
-rw-r--r--externals/grill/py/source/pyext.cpp22
-rw-r--r--externals/grill/py/source/pyext.h4
-rw-r--r--externals/grill/vasp/pd-ex/freeze1.pd6
-rw-r--r--externals/grill/vasp/source/classes.cpp78
-rw-r--r--externals/grill/vasp/source/classes.h16
-rwxr-xr-xexternals/grill/vasp/source/obj_chns.cpp10
-rw-r--r--externals/grill/vasp/source/obj_frames.cpp17
-rw-r--r--externals/grill/vasp/source/obj_imm.cpp9
-rw-r--r--externals/grill/vasp/source/obj_offs.cpp9
-rw-r--r--externals/grill/vasp/source/obj_part.cpp11
-rw-r--r--externals/grill/vasp/source/obj_peaks.cpp9
-rw-r--r--externals/grill/vasp/source/obj_radio.cpp7
-rw-r--r--externals/grill/vasp/source/obj_size.cpp18
-rw-r--r--externals/grill/vasp/source/obj_split.cpp20
-rw-r--r--externals/grill/vasp/source/obj_sync.cpp15
-rw-r--r--externals/grill/vasp/source/obj_vasp.cpp13
-rw-r--r--externals/grill/vasp/source/obj_vecs.cpp9
-rw-r--r--externals/grill/vasp/source/ops_rearr.cpp7
-rw-r--r--externals/grill/vasp/source/ops_resmp.cpp9
-rw-r--r--externals/grill/vasp/source/ops_search.cpp9
-rw-r--r--externals/grill/xsample/readme.txt2
-rw-r--r--externals/grill/xsample/source/groove.cpp41
-rw-r--r--externals/grill/xsample/source/main.cpp33
-rw-r--r--externals/grill/xsample/source/main.h3
-rw-r--r--externals/grill/xsample/source/play.cpp11
-rw-r--r--externals/grill/xsample/source/record.cpp35
62 files changed, 2525 insertions, 1591 deletions
diff --git a/externals/grill/deljoin/main.cpp b/externals/grill/deljoin/main.cpp
index b52303cb..5dfdff5f 100755
--- a/externals/grill/deljoin/main.cpp
+++ b/externals/grill/deljoin/main.cpp
@@ -10,8 +10,8 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include <flext.h>
-#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 400)
-#error You need at least flext version 0.4.0
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 401)
+#error You need at least flext version 0.4.1
#endif
#include <string.h>
@@ -26,7 +26,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#define C char
#define BL bool
-#define VERSION "0.1.1"
+#define VERSION "0.1.2"
#ifdef __MWERKS__
#define STD std
@@ -38,7 +38,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
class deljoin:
public flext_base
{
- FLEXT_HEADER(deljoin,flext_base)
+ FLEXT_HEADER_S(deljoin,flext_base,Setup)
public:
deljoin(I argc,const t_atom *argv);
@@ -53,6 +53,8 @@ protected:
virtual void m_assist(long /*msg*/,long /*arg*/,char * /*s*/);
private:
+ static V Setup(t_class *c);
+
FLEXT_CALLBACK_A(m_list)
FLEXT_CALLBACK_S(m_del)
};
@@ -60,6 +62,12 @@ private:
FLEXT_NEW_V("deljoin",deljoin)
+V deljoin::Setup(t_class *c)
+{
+ FLEXT_CADDMETHOD_A(c,0,m_list);
+ FLEXT_CADDMETHOD(c,1,m_del);
+}
+
deljoin::deljoin(I argc,const t_atom *argv):
delim(NULL)
{
@@ -67,9 +75,6 @@ deljoin::deljoin(I argc,const t_atom *argv):
AddInSymbol();
AddOutSymbol();
- FLEXT_ADDMETHOD_A(0,m_list);
- FLEXT_ADDMETHOD(1,m_del);
-
if(argc && IsSymbol(argv[0])) delim = GetSymbol(argv[0]);
}
@@ -104,36 +109,40 @@ V deljoin::m_assist(long msg,long arg,char *s)
*/
V deljoin::m_list(const t_symbol *s,int argc,const t_atom *argv)
{
- C tmp[1024],*t = tmp;
- const C *sdel = GetString(delim);
- I ldel = strlen(sdel);
-
- if(s && s != sym_list && s != sym_float && s != sym_int) {
- strcpy(t,GetString(s));
- t += strlen(t);
- }
-
- for(int i = 0; i < argc; ++i) {
- if(t != tmp) {
- strcpy(t,sdel);
- t += ldel;
- }
-
- const t_atom &a = argv[i];
- if(IsSymbol(a))
- strcpy(t,GetString(a));
- else if(IsInt(a)) {
- STD::sprintf(t,"%i",GetInt(a),10);
+ if(delim) {
+ C tmp[1024],*t = tmp;
+ const C *sdel = GetString(delim);
+ I ldel = strlen(sdel);
+
+ if(s && s != sym_list && s != sym_float && s != sym_int) {
+ strcpy(t,GetString(s));
+ t += strlen(t);
}
- else if(IsFloat(a)) {
- STD::sprintf(t,"%f",GetFloat(a),10);
+
+ for(int i = 0; i < argc; ++i) {
+ if(t != tmp) {
+ strcpy(t,sdel);
+ t += ldel;
+ }
+
+ const t_atom &a = argv[i];
+ if(IsSymbol(a))
+ strcpy(t,GetString(a));
+ else if(IsInt(a)) {
+ STD::sprintf(t,"%i",GetInt(a),10);
+ }
+ else if(IsFloat(a)) {
+ STD::sprintf(t,"%f",GetFloat(a),10);
+ }
+ // else do nothing
+
+ t += strlen(t);
}
-// else do nothing
-
- t += strlen(t);
+
+ ToOutString(0,tmp);
}
-
- ToOutString(0,tmp);
+ else
+ post("%s - No delimiter defined",thisName());
}
V deljoin::m_del(const t_symbol *s)
diff --git a/externals/grill/delsplit/main.cpp b/externals/grill/delsplit/main.cpp
index 17e30bc3..a7369dc7 100755
--- a/externals/grill/delsplit/main.cpp
+++ b/externals/grill/delsplit/main.cpp
@@ -10,8 +10,8 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include <flext.h>
-#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 400)
-#error You need at least flext version 0.4.0
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 401)
+#error You need at least flext version 0.4.1
#endif
#include <string.h>
@@ -27,7 +27,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#define C char
#define BL bool
-#define VERSION "0.1.1"
+#define VERSION "0.1.2"
#ifdef __MWERKS__
#define STD std
@@ -39,7 +39,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
class delsplit:
public flext_base
{
- FLEXT_HEADER(delsplit,flext_base)
+ FLEXT_HEADER_S(delsplit,flext_base,Setup)
public:
delsplit(I argc,const t_atom *argv);
@@ -55,6 +55,8 @@ protected:
static V SetAtom(t_atom &l,const C *s);
private:
+ static V Setup(t_class *c);
+
FLEXT_CALLBACK_S(m_list)
FLEXT_CALLBACK_S(m_del)
};
@@ -62,6 +64,12 @@ private:
FLEXT_NEW_V("delsplit",delsplit)
+V delsplit::Setup(t_class *c)
+{
+ FLEXT_CADDMETHOD(c,0,m_list);
+ FLEXT_CADDMETHOD(c,1,m_del);
+}
+
delsplit::delsplit(I argc,const t_atom *argv):
delim(NULL)
{
@@ -69,9 +77,6 @@ delsplit::delsplit(I argc,const t_atom *argv):
AddInSymbol();
AddOutList();
- FLEXT_ADDMETHOD(0,m_list);
- FLEXT_ADDMETHOD(1,m_del);
-
if(argc && IsSymbol(argv[0])) delim = GetSymbol(argv[0]);
}
@@ -128,27 +133,31 @@ V delsplit::SetAtom(t_atom &l,const C *s)
V delsplit::m_list(const t_symbol *sym)
{
- t_atom lst[256];
- int cnt = 0;
- const C *sdel = GetString(delim);
- I ldel = strlen(sdel);
- C str[1024];
- strcpy(str,GetString(sym));
-
- for(const char *s = str; *s; ) {
- C *e = strstr(s,sdel);
- if(!e) {
- SetAtom(lst[cnt++],s);
- break;
- }
- else {
- *e = 0;
- SetAtom(lst[cnt++],s);
- s = e+ldel;
+ if(delim) {
+ t_atom lst[256];
+ int cnt = 0;
+ const C *sdel = GetString(delim);
+ I ldel = strlen(sdel);
+ C str[1024];
+ strcpy(str,GetString(sym));
+
+ for(const char *s = str; *s; ) {
+ C *e = strstr(s,sdel);
+ if(!e) {
+ SetAtom(lst[cnt++],s);
+ break;
+ }
+ else {
+ *e = 0;
+ SetAtom(lst[cnt++],s);
+ s = e+ldel;
+ }
}
+
+ ToOutList(0,cnt,lst);
}
-
- ToOutList(0,cnt,lst);
+ else
+ post("%s - No delimiter defined",thisName());
}
V delsplit::m_del(const t_symbol *s)
diff --git a/externals/grill/flext/flext.cw b/externals/grill/flext/flext.cw
index 21096612..488b8fc2 100644
--- a/externals/grill/flext/flext.cw
+++ b/externals/grill/flext/flext.cw
Binary files differ
diff --git a/externals/grill/flext/flext.dsp b/externals/grill/flext/flext.dsp
index d13680e9..8ebb264f 100644
--- a/externals/grill/flext/flext.dsp
+++ b/externals/grill/flext/flext.dsp
@@ -146,29 +146,36 @@ SOURCE=".\make-files.txt"
SOURCE=.\readme.txt
# End Source File
# End Group
+# Begin Group "Atom"
+
+# PROP Default_Filter ""
# Begin Source File
SOURCE=.\source\flatom.cpp
# End Source File
# Begin Source File
-SOURCE=.\source\flatom_pr.cpp
+SOURCE=.\source\flatom_app.cpp
# End Source File
# Begin Source File
-SOURCE=.\source\flattr.cpp
+SOURCE=.\source\flatom_part.cpp
# End Source File
# Begin Source File
-SOURCE=.\source\flbase.cpp
+SOURCE=.\source\flatom_pr.cpp
# End Source File
+# End Group
+# Begin Group "Base"
+
+# PROP Default_Filter ""
# Begin Source File
-SOURCE=.\source\flbase.h
+SOURCE=.\source\flbase.cpp
# End Source File
# Begin Source File
-SOURCE=.\source\flbuf.cpp
+SOURCE=.\source\flbase.h
# End Source File
# Begin Source File
@@ -180,31 +187,51 @@ SOURCE=.\source\fldefs.h
# End Source File
# Begin Source File
-SOURCE=.\source\fldsp.cpp
+SOURCE=.\source\flext.cpp
# End Source File
# Begin Source File
-SOURCE=.\source\fldsp.h
+SOURCE=.\source\flext.h
# End Source File
# Begin Source File
-SOURCE=.\source\flext.cpp
+SOURCE=.\source\flinternal.h
# End Source File
# Begin Source File
-SOURCE=.\source\flext.h
+SOURCE=.\source\fllib.cpp
# End Source File
# Begin Source File
-SOURCE=.\source\flinternal.h
+SOURCE=.\source\flprefix.h
# End Source File
# Begin Source File
-SOURCE=.\source\fllib.cpp
+SOURCE=.\source\flstdc.h
# End Source File
# Begin Source File
-SOURCE=.\source\flmspbuffer.h
+SOURCE=.\source\flthr.cpp
+# End Source File
+# End Group
+# Begin Group "IO"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\source\flattr.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\source\flitem.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\source\flmeth.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\source\flmsg.cpp
# End Source File
# Begin Source File
@@ -212,19 +239,27 @@ SOURCE=.\source\flout.cpp
# End Source File
# Begin Source File
-SOURCE=.\source\flprefix.h
+SOURCE=.\source\flproxy.cpp
# End Source File
# Begin Source File
-SOURCE=.\source\flsndobj.cpp
+SOURCE=.\source\flqueue.cpp
# End Source File
# Begin Source File
-SOURCE=.\source\flsndobj.h
+SOURCE=.\source\flxlet.cpp
# End Source File
+# End Group
+# Begin Group "Util"
+
+# PROP Default_Filter ""
# Begin Source File
-SOURCE=.\source\flstdc.h
+SOURCE=.\source\flbuf.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\source\flmspbuffer.h
# End Source File
# Begin Source File
@@ -236,15 +271,32 @@ SOURCE=.\source\flsupport.h
# End Source File
# Begin Source File
-SOURCE=.\source\flthr.cpp
+SOURCE=.\source\flutil.cpp
# End Source File
+# End Group
+# Begin Group "Dsp"
+
+# PROP Default_Filter ""
# Begin Source File
-SOURCE=.\source\flutil.cpp
+SOURCE=.\source\fldsp.cpp
# End Source File
# Begin Source File
-SOURCE=.\source\flxlet.cpp
+SOURCE=.\source\fldsp.h
# End Source File
+# End Group
+# Begin Group "SndObj"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\source\flsndobj.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\source\flsndobj.h
+# End Source File
+# End Group
# End Target
# End Project
diff --git a/externals/grill/flext/make-files.txt b/externals/grill/flext/make-files.txt
index cb60d388..c6228eeb 100644
--- a/externals/grill/flext/make-files.txt
+++ b/externals/grill/flext/make-files.txt
@@ -1,5 +1,7 @@
SRCS=flbase.cpp flext.cpp flbuf.cpp fldsp.cpp fllib.cpp flxlet.cpp flattr.cpp flsupport.cpp \
-flutil.cpp flatom.cpp flatom_pr.cpp flthr.cpp flout.cpp
+flutil.cpp flatom.cpp flatom_pr.cpp flthr.cpp flout.cpp \
+flatom_app.cpp flatom_part.cpp flitem.cpp flmeth.cpp flmsg.cpp \
+flproxy.cpp flqueue.cpp
HDRS=flprefix.h flstdc.h flbase.h flclass.h fldefs.h flext.h flsupport.h fldsp.h flinternal.h
SRCS_SNDOBJ=flsndobj.cpp
HDRS_SNDOBJ=flsndobj.h
diff --git a/externals/grill/flext/readme.txt b/externals/grill/flext/readme.txt
index eefd0260..1f6f8fee 100644
--- a/externals/grill/flext/readme.txt
+++ b/externals/grill/flext/readme.txt
@@ -101,6 +101,8 @@ Version history:
0.4.1:
- full port for Max@OSX
+- completely redesigned message and attribute handling: now hashed and a much more efficient
+- introduced "Finalize" virtual method, called after all "Init" methods
- fixed crash issue in flext_dsp when there are NO signal inlets or outlets defined
(this is possibly only a problem for the signal2 tutorial example)
- added flext::GetType(t_atom &), flext::ZeroMem
@@ -299,7 +301,6 @@ tests:
- some more mutexes needed for thread safety?
- buffer resize: flext_base::buffer::Frames(): should we use buffer or system sample rate?
- what about FLEXT_ADDMETHOD_V (for var arg lists) and FLEXT_ADDMETHOD_A (anythings)... nonsense?
-- queued messages... triggering timer should not be necessary for MaxMSP qmsg
features:
- abstraction for clock functions
diff --git a/externals/grill/flext/source/flatom.cpp b/externals/grill/flext/source/flatom.cpp
index 0efb79f4..3d5db8f2 100644
--- a/externals/grill/flext/source/flatom.cpp
+++ b/externals/grill/flext/source/flatom.cpp
@@ -36,6 +36,7 @@ flext::AtomList::AtomList(const AtomList &a):
flext::AtomList::~AtomList() { Clear(); }
+
flext::AtomList &flext::AtomList::Set(int argc,const t_atom *argv,int offs,bool resize)
{
int ncnt = argc+offs;
@@ -51,85 +52,6 @@ flext::AtomList &flext::AtomList::Set(int argc,const t_atom *argv,int offs,bool
return *this;
}
-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;
-}
-
-
-flext::AtomList &flext::AtomList::Append(const t_atom &a)
-{
- t_atom *nlst = new t_atom[cnt+1];
- for(int i = 0; i < cnt; ++i) SetAtom(nlst[i],lst[i]);
- SetAtom(nlst[cnt],a);
-
- if(lst) delete[] lst;
- lst = nlst;
- ++cnt;
-
- return *this;
-}
-
-flext::AtomList &flext::AtomList::Append(int argc,const t_atom *argv)
-{
- if(argc) {
- t_atom *nlst = new t_atom[cnt+argc];
- int i;
- for(i = 0; i < cnt; ++i) SetAtom(nlst[i],lst[i]);
- if(argv)
- for(i = 0; i < argc; ++i) SetAtom(nlst[cnt+i],argv[i]);
-
- if(lst) delete[] lst;
- lst = nlst;
- cnt += argc;
- }
- return *this;
-}
-
-flext::AtomList &flext::AtomList::Prepend(const t_atom &a)
-{
- t_atom *nlst = new t_atom[cnt+1];
- for(int i = 0; i < cnt; ++i) SetAtom(nlst[i+1],lst[i]);
- SetAtom(nlst[0],a);
-
- if(lst) delete[] lst;
- lst = nlst;
- ++cnt;
-
- return *this;
-}
-
-flext::AtomList &flext::AtomList::Prepend(int argc,const t_atom *argv)
-{
- if(argc) {
- t_atom *nlst = new t_atom[cnt+argc];
- int i;
-
- if(argv)
- for(i = 0; i < argc; ++i) SetAtom(nlst[i],argv[i]);
- for(i = 0; i < cnt; ++i) SetAtom(nlst[argc+i],lst[i]);
-
- if(lst) delete[] lst;
- lst = nlst;
- cnt += argc;
- }
- return *this;
-}
-
-flext::AtomList flext::AtomList::GetPart(int offs,int len) const
-{
- if(offs+len > Count()) {
- len = Count()-offs;
- if(len < 0) len = 0;
- }
-
- return AtomList(len,Atoms()+offs);
-}
flext::AtomAnything::AtomAnything(const t_symbol *h,int argc,const t_atom *argv):
diff --git a/externals/grill/flext/source/flatom_app.cpp b/externals/grill/flext/source/flatom_app.cpp
new file mode 100755
index 00000000..aedaadcd
--- /dev/null
+++ b/externals/grill/flext/source/flatom_app.cpp
@@ -0,0 +1,76 @@
+/*
+
+flext - C++ layer for Max/MSP and pd (pure data) externals
+
+Copyright (c) 2001,2002 Thomas Grill (xovo@gmx.net)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+
+*/
+
+/*! \file flatom_app.cpp
+ \brief Definitions for handling the t_atom type and lists thereof.
+*/
+
+#include "flext.h"
+
+
+flext::AtomList &flext::AtomList::Append(const t_atom &a)
+{
+ t_atom *nlst = new t_atom[cnt+1];
+ for(int i = 0; i < cnt; ++i) SetAtom(nlst[i],lst[i]);
+ SetAtom(nlst[cnt],a);
+
+ if(lst) delete[] lst;
+ lst = nlst;
+ ++cnt;
+
+ return *this;
+}
+
+flext::AtomList &flext::AtomList::Append(int argc,const t_atom *argv)
+{
+ if(argc) {
+ t_atom *nlst = new t_atom[cnt+argc];
+ int i;
+ for(i = 0; i < cnt; ++i) SetAtom(nlst[i],lst[i]);
+ if(argv)
+ for(i = 0; i < argc; ++i) SetAtom(nlst[cnt+i],argv[i]);
+
+ if(lst) delete[] lst;
+ lst = nlst;
+ cnt += argc;
+ }
+ return *this;
+}
+
+flext::AtomList &flext::AtomList::Prepend(const t_atom &a)
+{
+ t_atom *nlst = new t_atom[cnt+1];
+ for(int i = 0; i < cnt; ++i) SetAtom(nlst[i+1],lst[i]);
+ SetAtom(nlst[0],a);
+
+ if(lst) delete[] lst;
+ lst = nlst;
+ ++cnt;
+
+ return *this;
+}
+
+flext::AtomList &flext::AtomList::Prepend(int argc,const t_atom *argv)
+{
+ if(argc) {
+ t_atom *nlst = new t_atom[cnt+argc];
+ int i;
+
+ if(argv)
+ for(i = 0; i < argc; ++i) SetAtom(nlst[i],argv[i]);
+ for(i = 0; i < cnt; ++i) SetAtom(nlst[argc+i],lst[i]);
+
+ if(lst) delete[] lst;
+ lst = nlst;
+ cnt += argc;
+ }
+ return *this;
+}
+
diff --git a/externals/grill/flext/source/flatom_part.cpp b/externals/grill/flext/source/flatom_part.cpp
new file mode 100755
index 00000000..b736666a
--- /dev/null
+++ b/externals/grill/flext/source/flatom_part.cpp
@@ -0,0 +1,37 @@
+/*
+
+flext - C++ layer for Max/MSP and pd (pure data) externals
+
+Copyright (c) 2001,2002 Thomas Grill (xovo@gmx.net)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+
+*/
+
+/*! \file 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;
+}
+
+
+flext::AtomList flext::AtomList::GetPart(int offs,int len) const
+{
+ if(offs+len > Count()) {
+ len = Count()-offs;
+ if(len < 0) len = 0;
+ }
+
+ return AtomList(len,Atoms()+offs);
+}
+
diff --git a/externals/grill/flext/source/flattr.cpp b/externals/grill/flext/source/flattr.cpp
index 44dc0d28..5612ab33 100644
--- a/externals/grill/flext/source/flattr.cpp
+++ b/externals/grill/flext/source/flattr.cpp
@@ -21,41 +21,80 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#define STD
#endif
-flext_base::attritem::attritem(const t_symbol *t,const t_symbol *gt,metharg tp,methfun gf,methfun sf):
- tag(t),gtag(gt),argtp(tp),gfun(gf),sfun(sf),nxt(NULL)
-{}
+flext_base::attritem::attritem(const t_symbol *t,metharg tp,methfun f,bool g):
+ item(t,0,NULL),argtp(tp),
+ fun(f),isget(g)
+{
+}
flext_base::attritem::~attritem()
{
- if(nxt) delete nxt;
+// if(nxt) delete nxt;
}
+/*
void flext_base::AddAttrItem(attritem *m)
{
- if(attrhead) {
+ int ix = m->Hash();
+ post("attr index %x",ix);
+ attritem *&aix = attrhead[ix];
+
+ if(aix) {
attritem *mi;
- for(mi = attrhead; mi->nxt; mi = mi->nxt) {}
+ for(mi = aix; mi->nxt; mi = mi->nxt) {}
mi->nxt = m;
}
else
- attrhead = m;
- attrcnt++;
+ aix = m;
+// m->th->attrcnt++;
}
+*/
-void flext_base::AddAttrib(const char *attr,metharg tp,methfun gfun,methfun sfun)
+//! Add get and set attributes
+void flext_base::AddAttrib(itemarr *aa,itemarr *ma,const char *attr,metharg tp,methfun gfun,methfun sfun)
{
- if(procattr) {
- char tmp[256] = "get";
+ const t_symbol *asym = MakeSymbol(attr);
+
+// if(sfun) // if commented out, there will be a warning at run-time (more user-friendly)
+ {
+ attritem *a = new attritem(asym,tp,sfun,false);
+ aa->Add(a);
+
+ // bind attribute to a method
+ methitem *mi = new methitem(0,asym,a);
+ mi->SetArgs(sfun,1,&tp);
+ ma->Add(mi);
+ }
+
+// if(gfun) // if commented out, there will be a warning at run-time (more user-friendly)
+ {
+ attritem *a = new attritem(asym,tp,gfun,true);
+ aa->Add(a);
+
+ static char tmp[256] = "get";
strcpy(tmp+3,attr);
- AddAttrItem(new attritem(MakeSymbol(attr),MakeSymbol(tmp),tp,gfun,sfun));
- AddMethod(0,attr,(methfun)cb_SetAttrib,a_any,a_null);
- AddMethod(0,tmp,(methfun)cb_GetAttrib,a_any,a_null);
+ // bind attribute to a method
+ methitem *mi = new methitem(0,MakeSymbol(tmp),a);
+ mi->SetArgs(gfun,0,NULL);
+ ma->Add(mi);
}
+}
+
+void flext_base::AddAttrib(const char *attr,metharg tp,methfun gfun,methfun sfun)
+{
+ if(procattr)
+ AddAttrib(ThAttrs(),ThMeths(),attr,tp,gfun,sfun);
else
error("%s - attribute procession is not enabled!",thisName());
}
+void flext_base::AddAttrib(t_class *c,const char *attr,metharg tp,methfun gfun,methfun sfun)
+{
+ AddAttrib(ClAttrs(c),ClMeths(c),attr,tp,gfun,sfun);
+}
+
+
int flext_base::CheckAttrib(int argc,const t_atom *argv)
{
int offs = 0;
@@ -81,9 +120,19 @@ bool flext_base::InitAttrib(int argc,const t_atom *argv)
bool flext_base::ListAttrib()
{
if(outattr) {
- AtomList la(attrcnt);
- attritem *a = attrhead;
- for(int i = 0; i < attrcnt; ++i,a = a->nxt) SetSymbol(la[i],a->tag);
+ int cnt = attrhead?attrhead->Count():0;
+ int ccnt = clattrhead?clattrhead->Count():0;
+ AtomList la(ccnt+cnt);
+
+ for(int i = 0,ix = 0; i <= 1; ++i) {
+ itemarr *a = i?attrhead:clattrhead;
+ if(a) {
+ for(int ai = 0; ai < a->Size(); ++ai) {
+ for(item *l = a->Item(ai); l; l = l->nxt)
+ SetSymbol(la[ix++],l->tag);
+ }
+ }
+ }
ToOutAnything(outattr,MakeSymbol("attributes"),la.Count(),la.Atoms());
return true;
@@ -94,90 +143,117 @@ bool flext_base::ListAttrib()
bool flext_base::SetAttrib(const t_symbol *tag,int argc,const t_atom *argv)
{
- attritem *a = attrhead;
- for(; a && a->tag != tag; a = a->nxt) {}
+ // search for matching attribute
+ attritem *a = (attritem *)attrhead->Find(tag);
+ while(a && (a->tag != tag || a->inlet != 0 || a->isget)) a = (attritem *)a->nxt;
+ if(!a) {
+ a = (attritem *)clattrhead->Find(tag);
+ while(a && (a->tag != tag || a->inlet != 0 || a->isget)) a = (attritem *)a->nxt;
+ }
- if(a) {
- if(a->sfun) {
- bool ok = true;
+ if(a)
+ return SetAttrib(a,argc,argv);
+ else {
+ error("%s - %s: attribute not found",thisName(),GetString(tag));
+ return true;
+ }
+}
- AtomList la;
- t_any any;
- switch(a->argtp) {
- case a_float:
- if(argc == 1 && CanbeFloat(argv[0])) {
- any.ft = GetAFloat(argv[0]);
- ((methfun_1)a->sfun)(this,any);
- }
- else ok = false;
- break;
- case a_int:
- if(argc == 1 && CanbeInt(argv[0])) {
- any.it = GetAInt(argv[0]);
- ((methfun_1)a->sfun)(this,any);
- }
- else ok = false;
- break;
- case a_symbol:
- if(argc == 1 && IsSymbol(argv[0])) {
- any.st = GetSymbol(argv[0]);
- ((methfun_1)a->sfun)(this,any);
- }
- else ok = false;
- break;
- case a_LIST:
- any.vt = &(la(argc,argv));
- ((methfun_1)a->sfun)(this,any);
- break;
- default:
- ERRINTERNAL();
- }
+bool flext_base::SetAttrib(attritem *a,int argc,const t_atom *argv)
+{
+ if(a->fun) {
+ bool ok = true;
- if(!ok)
- post("%s - wrong arguments for attribute %s",thisName(),GetString(tag));
+ AtomList la;
+ 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])) {
+ any.st = GetSymbol(argv[0]);
+ ((methfun_1)a->fun)(this,any);
+ }
+ else ok = false;
+ break;
+ case a_LIST:
+ any.vt = &(la(argc,argv));
+ ((methfun_1)a->fun)(this,any);
+ break;
+ default:
+ ERRINTERNAL();
}
- else
- post("%s - attribute %s has no get method",thisName(),GetString(tag));
+
+ if(!ok)
+ post("%s - wrong arguments for attribute %s",thisName(),GetString(a->tag));
}
else
- error("%s - %s: attribute not found",thisName(),GetString(tag));
+ post("%s - attribute %s has no get method",thisName(),GetString(a->tag));
return true;
}
-bool flext_base::GetAttrib(const t_symbol *tag,int argc,const t_atom *argv)
+/*
+bool flext_base::GetAttrib(const t_symbol *tag)
{
if(argc)
post("%s - %s: arguments ignored",thisName(),GetString(tag));
- attritem *a = attrhead;
- for(; a && a->gtag != tag; a = a->nxt) {}
+#ifdef FLEXT_DEBUG
+ if(strncmp(GetString(tag),"get",3)) {
+ post("%s - %s: tag has no 'get' prefix",thisName(),GetString(tag));
+ return false;
+ }
+#endif
+
+ const t_symbol *mtag = MakeSymbol(GetString(a->tag)+3);
+ // search for attribute
+ attritem *a = (attritem *)attrhead->Find(mtag);
+ if(!a) a = (attritem *)clattrhead->Find(mtag);
+}
+*/
+
+bool flext_base::GetAttrib(attritem *a)
+{
+ // main attribute tag
if(a) {
- if(a->gfun) {
+ if(a->fun) {
AtomList la;
t_any any;
switch(a->argtp) {
case a_float: {
- ((methfun_1)a->gfun)(this,any);
+ ((methfun_1)a->fun)(this,any);
la(1);
SetFloat(la[0],any.ft);
break;
}
case a_int: {
- ((methfun_1)a->gfun)(this,any);
+ ((methfun_1)a->fun)(this,any);
la(1);
SetInt(la[0],any.it);
break;
}
case a_symbol: {
- ((methfun_1)a->gfun)(this,any);
+ ((methfun_1)a->fun)(this,any);
la(1);
SetSymbol(la[0],any.st);
break;
}
case a_LIST: {
any.vt = &la;
- ((methfun_1)a->gfun)(this,any);
+ ((methfun_1)a->fun)(this,any);
break;
}
default:
@@ -186,10 +262,10 @@ bool flext_base::GetAttrib(const t_symbol *tag,int argc,const t_atom *argv)
ToOutAnything(outattr,a->tag,la.Count(),la.Atoms());
}
else
- post("%s - attribute %s has no set method",thisName(),GetString(tag));
+ post("%s - attribute %s has no set method",thisName(),GetString(a->tag));
}
else
- error("%s - %s: attribute not found",thisName(),GetString(tag));
+ error("%s - %s: attribute not found",thisName(),GetString(a->tag));
return true;
}
diff --git a/externals/grill/flext/source/flbase.cpp b/externals/grill/flext/source/flbase.cpp
index f1791884..3b43c1fe 100644
--- a/externals/grill/flext/source/flbase.cpp
+++ b/externals/grill/flext/source/flbase.cpp
@@ -56,6 +56,10 @@ flext_obj :: flext_obj()
flext_obj :: ~flext_obj() {}
+bool flext_obj::Init() { return true; }
+bool flext_obj::Finalize() { return true; }
+void flext_obj::Exit() {}
+
void flext_obj::DefineHelp(t_class *c,const char *ref,const char *dir,bool addtilde)
{
#if FLEXT_SYS == FLEXT_SYS_PD
diff --git a/externals/grill/flext/source/flbase.h b/externals/grill/flext/source/flbase.h
index 79128e53..96a89d30 100644
--- a/externals/grill/flext/source/flbase.h
+++ b/externals/grill/flext/source/flbase.h
@@ -117,10 +117,13 @@ class FLEXT_EXT flext_obj:
//! Virtual function called at creation time (but after the constructor)
// this also guarantees that there are no instances of flext_obj
- virtual bool Init() = 0;
+ virtual bool Init();
+
+ //! Virtual function called after Init() has succeeded
+ virtual bool Finalize();
//! Virtual function called at destruction (before the destructor)
- virtual void Exit() {}
+ virtual void Exit();
//! @} FLEXT_O_CREATION
diff --git a/externals/grill/flext/source/flclass.h b/externals/grill/flext/source/flclass.h
index ab90667a..b0376ed3 100644
--- a/externals/grill/flext/source/flclass.h
+++ b/externals/grill/flext/source/flclass.h
@@ -77,10 +77,10 @@ public:
virtual void m_help();
//! called on patcher load (not on mere object creation!)
- virtual void m_loadbang() {}
+ virtual void m_loadbang();
//! quickhelp for inlets/outlets (gets called in Max/MSP only)
- virtual void m_assist(long /*msg*/,long /*arg*/,char * /*s*/) {}
+ virtual void m_assist(long /*msg*/,long /*arg*/,char * /*s*/);
/*! \brief Called for every incoming message.
All method handling is done in there
@@ -313,35 +313,63 @@ public:
*/
void AddMethodDef(int inlet,const char *tag = NULL); // call virtual function for tag && inlet
- void AddMethod(int inlet,const char *tag,methfun fun,metharg tp,...);
-
- void AddMethod(int inlet,bool (*m)(flext_base *,int,t_atom *)) { AddMethod(inlet,"list",(methfun)m,a_list,a_null); }
- void AddMethod(int inlet,bool (*m)(flext_base *,int,const t_atom *)) { AddMethod(inlet,"list",(methfun)m,a_list,a_null); }
- void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *)) { AddMethod(inlet,tag,(methfun)m,a_null); } // pure method
- void AddMethod(int inlet,bool (*m)(flext_base *,t_symbol *,int,t_atom *)) { AddMethod(inlet,"anything",(methfun)m,a_any,a_null); } // anything
- void AddMethod(int inlet,bool (*m)(flext_base *,const t_symbol *,int,const t_atom *)) { AddMethod(inlet,"anything",(methfun)m,a_any,a_null); } // anything
- void AddMethod(int inlet,bool (*m)(flext_base *,t_symbol *&)) { AddMethod(inlet,"symbol",(methfun)m,a_symbol,a_null); } // single symbol
- void AddMethod(int inlet,bool (*m)(flext_base *,const t_symbol *&)) { AddMethod(inlet,"symbol",(methfun)m,a_symbol,a_null); } // single symbol
- void AddMethod(int inlet,bool (*m)(flext_base *,float &)) { AddMethod(inlet,"float",(methfun)m,a_float,a_null); } // single float
- void AddMethod(int inlet,bool (*m)(flext_base *,float &,float &)) { AddMethod(inlet,"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(inlet,"list",(methfun)m,a_float,a_float,a_float,a_null); } // list of 3 floats
+
+ void AddMethod(int inlet,bool (*m)(flext_base *,int,t_atom *)) { AddMethod(ThMeths(),inlet,"list",(methfun)m,a_list,a_null); }
+ void AddMethod(int inlet,bool (*m)(flext_base *,int,const t_atom *)) { AddMethod(ThMeths(),inlet,"list",(methfun)m,a_list,a_null); }
+ void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *)) { AddMethod(ThMeths(),inlet,tag,(methfun)m,a_null); } // pure method
+ void AddMethod(int inlet,bool (*m)(flext_base *,t_symbol *,int,t_atom *)) { AddMethod(ThMeths(),inlet,"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,"anything",(methfun)m,a_any,a_null); } // anything
+ void AddMethod(int inlet,bool (*m)(flext_base *,t_symbol *&)) { AddMethod(ThMeths(),inlet,"symbol",(methfun)m,a_symbol,a_null); } // single symbol
+ void AddMethod(int inlet,bool (*m)(flext_base *,const t_symbol *&)) { AddMethod(ThMeths(),inlet,"symbol",(methfun)m,a_symbol,a_null); } // single symbol
+ void AddMethod(int inlet,bool (*m)(flext_base *,float &)) { AddMethod(ThMeths(),inlet,"float",(methfun)m,a_float,a_null); } // single float
+ void AddMethod(int inlet,bool (*m)(flext_base *,float &,float &)) { AddMethod(ThMeths(),inlet,"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,"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(inlet,"float",(methfun)m,a_int,a_null); } // single float
+ void AddMethod(int inlet,bool (*m)(flext_base *,int &)) { AddMethod(ThMeths(),inlet,"float",(methfun)m,a_int,a_null); } // single float
#elif FLEXT_SYS == FLEXT_SYS_MAX
- void AddMethod(int inlet,bool (*m)(flext_base *,int &)) { AddMethod(inlet,"int",(methfun)m,a_int,a_null); } // single float
+ void AddMethod(int inlet,bool (*m)(flext_base *,int &)) { AddMethod(ThMeths(),inlet,"int",(methfun)m,a_int,a_null); } // single float
#else
#error
#endif
- void AddMethod(int inlet,bool (*m)(flext_base *,int &,int &)) { AddMethod(inlet,"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(inlet,"list",(methfun)m,a_int,a_int,a_int,a_null); } // list of 3 floats
- void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *,int,t_atom *)) { AddMethod(inlet,tag,(methfun)m,a_list,a_null); } // method+gimme
- void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *,int,const t_atom *)) { AddMethod(inlet,tag,(methfun)m,a_list,a_null); } // method+gimme
- void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *,t_symbol *,int,t_atom *)) { AddMethod(inlet,tag,(methfun)m,a_any,a_null); } // method+gimme
- void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *,const t_symbol *,int,const t_atom *)) { AddMethod(inlet,tag,(methfun)m,a_any,a_null); } // method+gimme
- void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *,t_symbol *&)) { AddMethod(inlet,tag,(methfun)m,a_symbol,a_null); } // method+symbol
- void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *,const t_symbol *&)) { AddMethod(inlet,tag,(methfun)m,a_symbol,a_null); } // method+symbol
- void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *,float &)) { AddMethod(inlet,tag,(methfun)m,a_float,a_null); } // method+float
- void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *,int &)) { AddMethod(inlet,tag,(methfun)m,a_int,a_null); } // method+int
+ void AddMethod(int inlet,bool (*m)(flext_base *,int &,int &)) { AddMethod(ThMeths(),inlet,"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,"list",(methfun)m,a_int,a_int,a_int,a_null); } // list of 3 floats
+ void AddMethod(int inlet,const char *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 char *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 char *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 char *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 char *tag,bool (*m)(flext_base *,t_symbol *&)) { AddMethod(ThMeths(),inlet,tag,(methfun)m,a_symbol,a_null); } // method+symbol
+ void AddMethod(int inlet,const char *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 char *tag,bool (*m)(flext_base *,float &)) { AddMethod(ThMeths(),inlet,tag,(methfun)m,a_float,a_null); } // method+float
+ void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *,int &)) { AddMethod(ThMeths(),inlet,tag,(methfun)m,a_int,a_null); } // method+int
+
+ static void AddMethod(t_class *c,int inlet,bool (*m)(flext_base *,int,t_atom *)) { AddMethod(ClMeths(c),inlet,"list",(methfun)m,a_list,a_null); }
+ static void AddMethod(t_class *c,int inlet,bool (*m)(flext_base *,int,const t_atom *)) { AddMethod(ClMeths(c),inlet,"list",(methfun)m,a_list,a_null); }
+ static void AddMethod(t_class *c,int inlet,const char *tag,bool (*m)(flext_base *)) { AddMethod(ClMeths(c),inlet,tag,(methfun)m,a_null); } // pure method
+ static void AddMethod(t_class *c,int inlet,bool (*m)(flext_base *,t_symbol *,int,t_atom *)) { AddMethod(ClMeths(c),inlet,"anything",(methfun)m,a_any,a_null); } // anything
+ static void AddMethod(t_class *c,int inlet,bool (*m)(flext_base *,const t_symbol *,int,const t_atom *)) { AddMethod(ClMeths(c),inlet,"anything",(methfun)m,a_any,a_null); } // anything
+ static void AddMethod(t_class *c,int inlet,bool (*m)(flext_base *,t_symbol *&)) { AddMethod(ClMeths(c),inlet,"symbol",(methfun)m,a_symbol,a_null); } // single symbol
+ static void AddMethod(t_class *c,int inlet,bool (*m)(flext_base *,const t_symbol *&)) { AddMethod(ClMeths(c),inlet,"symbol",(methfun)m,a_symbol,a_null); } // single symbol
+ static void AddMethod(t_class *c,int inlet,bool (*m)(flext_base *,float &)) { AddMethod(ClMeths(c),inlet,"float",(methfun)m,a_float,a_null); } // single float
+ static void AddMethod(t_class *c,int inlet,bool (*m)(flext_base *,float &,float &)) { AddMethod(ClMeths(c),inlet,"list",(methfun)m,a_float,a_float,a_null); } // list of 2 floats
+ static void AddMethod(t_class *c,int inlet,bool (*m)(flext_base *,float &,float &,float &)) { AddMethod(ClMeths(c),inlet,"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_class *c,int inlet,bool (*m)(flext_base *,int &)) { AddMethod(ClMeths(c),inlet,"float",(methfun)m,a_int,a_null); } // single float
+#elif FLEXT_SYS == FLEXT_SYS_MAX
+ static void AddMethod(t_class *c,int inlet,bool (*m)(flext_base *,int &)) { AddMethod(ClMeths(c),inlet,"int",(methfun)m,a_int,a_null); } // single float
+#else
+#error
+#endif
+ static void AddMethod(t_class *c,int inlet,bool (*m)(flext_base *,int &,int &)) { AddMethod(ClMeths(c),inlet,"list",(methfun)m,a_int,a_int,a_null); } // list of 2 floats
+ static void AddMethod(t_class *c,int inlet,bool (*m)(flext_base *,int &,int &,int &)) { AddMethod(ClMeths(c),inlet,"list",(methfun)m,a_int,a_int,a_int,a_null); } // list of 3 floats
+ static void AddMethod(t_class *c,int inlet,const char *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_class *c,int inlet,const char *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_class *c,int inlet,const char *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_class *c,int inlet,const char *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_class *c,int inlet,const char *tag,bool (*m)(flext_base *,t_symbol *&)) { AddMethod(ClMeths(c),inlet,tag,(methfun)m,a_symbol,a_null); } // method+symbol
+ static void AddMethod(t_class *c,int inlet,const char *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_class *c,int inlet,const char *tag,bool (*m)(flext_base *,float &)) { AddMethod(ClMeths(c),inlet,tag,(methfun)m,a_float,a_null); } // method+float
+ static void AddMethod(t_class *c,int inlet,const char *tag,bool (*m)(flext_base *,int &)) { AddMethod(ClMeths(c),inlet,tag,(methfun)m,a_int,a_null); } // method+int
+
//! Set Max/MSP style of distributing list elements over (message) inlets
void SetDist(bool d = true) { distmsgs = d; }
@@ -412,14 +440,10 @@ protected:
flext_base();
virtual ~flext_base();
-// inlets and outlets
-
- /*! \brief Set up inlets and outlets
- \ingroup FLEXT_C_INOUT
- \return True on successful creation of all inlets and outlets
+ /*! \brief Set up inlets and outlets, method and attribute lists
*/
virtual bool Init();
-
+
//! \brief This represents either an inlet or outlet
struct xlet {
enum type {
@@ -448,6 +472,13 @@ protected:
void AddAttrib(const char *attr,bool (*get)(flext_base *,AtomList *&),bool (*set)(flext_base *,AtomList *&)) { AddAttrib(attr,a_LIST,(methfun)get,(methfun)set); }
void AddAttrib(const char *attr,bool (*get)(flext_base *,AtomAnything *&),bool (*set)(flext_base *,AtomAnything *&)) { AddAttrib(attr,a_ANY,(methfun)get,(methfun)set); }
+ static void AddAttrib(t_class *c,const char *attr,bool (*get)(flext_base *,float &),bool (*set)(flext_base *,float &)) { AddAttrib(c,attr,a_float,(methfun)get,(methfun)set); }
+ static void AddAttrib(t_class *c,const char *attr,bool (*get)(flext_base *,int &),bool (*set)(flext_base *,int &)) { AddAttrib(c,attr,a_int,(methfun)get,(methfun)set); }
+ static void AddAttrib(t_class *c,const char *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_class *c,const char *attr,bool (*get)(flext_base *,t_symbol *&),bool (*set)(flext_base *,t_symbol *&)) { AddAttrib(c,attr,a_symbol,(methfun)get,(methfun)set); }
+ static void AddAttrib(t_class *c,const char *attr,bool (*get)(flext_base *,AtomList *&),bool (*set)(flext_base *,AtomList *&)) { AddAttrib(c,attr,a_LIST,(methfun)get,(methfun)set); }
+ static void AddAttrib(t_class *c,const char *attr,bool (*get)(flext_base *,AtomAnything *&),bool (*set)(flext_base *,AtomAnything *&)) { AddAttrib(c,attr,a_ANY,(methfun)get,(methfun)set); }
+
//! @} FLEXT_C_ATTR
/*! \addtogroup FLEXT_C_INOUT
@@ -483,38 +514,84 @@ protected:
// method handling
- //! \brief This represents an item of the method list
- class methitem {
public:
- methitem(int inlet,const t_symbol *t);
- ~methitem();
- void SetArgs(methfun fun,int argc,metharg *args);
+ class attritem;
+
+ class item {
+ public:
+ item(const t_symbol *t,int inl,attritem *a);
+ ~item();
+
+ bool IsAttr() const { return attr != NULL; }
const t_symbol *tag;
int inlet;
+ attritem *attr;
+ item *nxt;
+ };
+
+ class itemarr {
+ public:
+ itemarr();
+ ~itemarr();
+
+ void Add(item *it);
+ item *Find(const t_symbol *tag,int inlet = 0) const;
+ void Finalize();
+
+ bool Ready() const { return bits >= 0; }
+ int Count() const { return cnt; }
+ int Size() const { return bits?1<<bits:0; }
+ item *Item(int ix) { return arr[ix]; }
+
+ protected:
+ static int Hash(const t_symbol *,int inlet,int bits);
+
+ item **arr;
+ int cnt,bits;
+ };
+
+ //! \brief This represents an item of the method list
+ class methitem:
+ public item {
+ public:
+ methitem(int inlet,const t_symbol *tg,attritem *conn = NULL);
+ ~methitem();
+
+ void SetArgs(methfun fun,int argc,metharg *args);
+
int argc;
metharg *args;
methfun fun;
-
- methitem *nxt;
};
//! \brief This represents an item of the attribute list
- class attritem {
+ class attritem:
+ public item {
public:
- attritem(const t_symbol *tag,const t_symbol *gtag,metharg tp,methfun gfun,methfun sfun);
+ attritem(const t_symbol *tag,metharg tp,methfun fun,bool get);
~attritem();
- const t_symbol *tag,*gtag;
+ bool isget;
metharg argtp;
- methfun gfun,sfun;
-
- attritem *nxt;
+ methfun fun;
};
//! @} FLEXT_CLASS
+ itemarr *ThMeths() { return methhead; }
+ static itemarr *ClMeths(t_class *c) { return GetClassArr(c,0); }
+
+ static void AddMethod(itemarr *ma,int inlet,const char *tag,methfun fun,metharg tp,...);
+
+ itemarr *ThAttrs() { return attrhead; }
+ static itemarr *ClAttrs(t_class *c) { return GetClassArr(c,1); }
+
+ static void AddAttrib(itemarr *aa,itemarr *ma,const char *attr,metharg tp,methfun gfun,methfun sfun);
+ void AddAttrib(const char *attr,metharg tp,methfun gfun,methfun sfun);
+ static void AddAttrib(t_class *c,const char *attr,metharg tp,methfun gfun,methfun sfun);
+
private:
static void Setup(t_class *c);
@@ -546,27 +623,31 @@ private:
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 &);
-
- methitem *methhead;
- void AddMethItem(methitem *m);
- attritem *attrhead;
- int attrcnt;
- void AddAttrItem(attritem *m);
+ static itemarr *GetClassArr(t_class *c,int ix);
- void AddAttrib(const char *attr,metharg tp,methfun gfun,methfun sfun);
+ itemarr *methhead,*clmethhead;
+
+ bool CallMeth(const methitem &m,int argc,const t_atom *argv);
+ bool FindMeth(int inlet,const t_symbol *s,int argc,const t_atom *argv);
+ bool TryMethTag(const methitem *m,int inlet,const t_symbol *t,int argc,const t_atom *argv);
+ bool TryMethSym(const methitem *m,int inlet,const t_symbol *t,const t_symbol *s);
+ bool TryMethAny(const methitem *m,int inlet,const t_symbol *t,const t_symbol *s,int argc,const t_atom *argv);
+
+ itemarr *attrhead,*clattrhead;
static int CheckAttrib(int argc,const t_atom *argv);
bool InitAttrib(int argc,const t_atom *argv);
bool ListAttrib();
- bool GetAttrib(const t_symbol *s,int argc,const t_atom *argv);
+// bool GetAttrib(const t_symbol *s);
+ bool GetAttrib(attritem *a);
bool SetAttrib(const t_symbol *s,int argc,const t_atom *argv);
+ bool SetAttrib(attritem *a,int argc,const t_atom *argv);
static bool cb_ListAttrib(flext_base *c) { return c->ListAttrib(); }
- static bool cb_GetAttrib(flext_base *c,const t_symbol *s,int argc,const t_atom *argv) { return c->GetAttrib(s,argc,argv); }
- static bool cb_SetAttrib(flext_base *c,const t_symbol *s,int argc,const t_atom *argv) { return c->SetAttrib(s,argc,argv); }
-
+// static bool cb_GetAttrib(flext_base *c,const t_symbol *s,int argc,const t_atom *argv) { return c->GetAttrib(s,argc,argv); }
+// static bool cb_SetAttrib(flext_base *c,const t_symbol *s,int argc,const t_atom *argv) { return c->SetAttrib(s,argc,argv); }
// queue stuff
@@ -582,7 +663,18 @@ private:
#if FLEXT_SYS == FLEXT_SYS_PD
// proxy object (for additional inlets) stuff
- struct px_object;
+ 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_method(px_object *c,const t_symbol *s,int argc,t_atom *argv);
+ };
+
friend struct px_object;
#elif FLEXT_SYS == FLEXT_SYS_MAX
typedef object px_object;
@@ -616,6 +708,11 @@ private:
px_object **inlets;
+ static void SetProxies(t_class *c);
+
+ bool InitInlets();
+ bool InitOutlets();
+
// callback functions
static void cb_help(t_class *c);
diff --git a/externals/grill/flext/source/fldefs.h b/externals/grill/flext/source/fldefs.h
index 353752f7..49f44366 100644
--- a/externals/grill/flext/source/fldefs.h
+++ b/externals/grill/flext/source/fldefs.h
@@ -251,6 +251,9 @@ REAL_NEW_3(NAME,NEW_CLASS, 1,1, TYPE1, TYPE2, TYPE3)
// deprecated stuff
+/*! \defgroup FLEXT_D_DEPRECATED Deprecated definitions
+ @{
+
#define FLEXT_NEW_G FLEXT_NEW_V
#define FLEXT_NEW_TILDE FLEXT_NEW_DSP
@@ -268,6 +271,10 @@ REAL_NEW_3(NAME,NEW_CLASS, 1,1, TYPE1, TYPE2, TYPE3)
#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
@{
@@ -288,9 +295,6 @@ REAL_NEW_3(NAME,NEW_CLASS, 1,1, TYPE1, TYPE2, TYPE3)
*/
#define FLEXT_DSP_SETUP(cl) REAL_SETUP(cl,1)
-//! \deprecated
-#define FLEXT_TILDE_SETUP FLEXT_DSP_SETUP
-
//! @} FLEXT_D_LIBRARY
@@ -657,10 +661,109 @@ FLEXT_THREAD_1(M_FUN,t_symptr)
// ====================================================================================
+/*! \defgroup FLEXT_D_CADDMETHOD Add flext methods within class scope
+ \note These can only be used at class construction time
+ @{
+*/
+
+//! Add a method handler for bang
+#define FLEXT_CADDBANG(CL,IX,M_FUN) \
+\
+AddMethod(CL,IX,"bang",FLEXT_CALL_PRE(M_FUN))
+
+//! Add a handler for a method with no arguments
+#define FLEXT_CADDMETHOD(CL,IX,M_FUN) \
+AddMethod(CL,IX,FLEXT_CALL_PRE(M_FUN))
+
+//! Add a handler for a method with a (variable argument) list
+#define FLEXT_CADDMETHOD_V(CL,IX,M_FUN) \
+\
+AddMethod(CL,IX,FLEXT_CALL_PRE(M_FUN))
+
+//! Add a handler for a method with an anything argument
+#define FLEXT_CADDMETHOD_A(CL,IX,M_FUN) \
+\
+AddMethod(CL,IX,FLEXT_CALL_PRE(M_FUN))
+
+//! Add a a handler for a method with implicit arguments
+#define FLEXT_CADDMETHOD_(CL,IX,M_TAG,M_FUN) \
+\
+AddMethod(CL,IX,M_TAG,FLEXT_CALL_PRE(M_FUN))
+
+//! Add a handler for a method with 1 enum type argument
+#define FLEXT_CADDMETHOD_E(CL,IX,M_TAG,M_FUN) \
+\
+AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),a_int,a_null)
+
+//! Add a handler for a method with 1 argument
+#define FLEXT_CADDMETHOD_1(CL,IX,M_TAG,M_FUN,TP1) \
+\
+AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),a_null)
+
+//! Add a handler for a method with 2 arguments
+#define FLEXT_CADDMETHOD_2(CL,IX,M_TAG,M_FUN,TP1,TP2) \
+\
+AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),a_null)
+
+//! Add a handler for a method with 3 arguments
+#define FLEXT_CADDMETHOD_3(CL,IX,M_TAG,M_FUN,TP1,TP2,TP3) \
+\
+AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),a_null)
+
+//! Add a handler for a method with 4 arguments
+#define FLEXT_CADDMETHOD_4(CL,IX,M_TAG,M_FUN,TP1,TP2,TP3,TP4) \
+\
+AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),FLEXTARG(TP4),a_null)
+
+//! Add a handler for a method with 5 arguments
+#define FLEXT_CADDMETHOD_5(CL,IX,M_TAG,M_FUN,TP1,TP2,TP3,TP4,TP5) \
+\
+AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),FLEXTARG(TP4),FLEXTARG(TP5),a_null)
+
+
+// Shortcuts
+
+//! Add a handler for a method with a boolean argument
+#define FLEXT_CADDMETHOD_B(CL,IX,M_TAG,M_FUN) \
+\
+FLEXT_CADDMETHOD_1(CL,IX,M_TAG,M_FUN,bool)
+
+//! Add a handler for a method with 1 float argument
+#define FLEXT_CADDMETHOD_F(CL,IX,M_TAG,M_FUN) \
+\
+FLEXT_CADDMETHOD_1(CL,IX,M_TAG,M_FUN,float)
+
+//! Add a handler for a method with 2 float arguments
+#define FLEXT_CADDMETHOD_FF(CL,IX,M_TAG,M_FUN) \
+\
+FLEXT_CADDMETHOD_2(CL,IX,M_TAG,M_FUN,float,float)
+
+//! Add a handler for a method with 3 float arguments
+#define FLEXT_CADDMETHOD_FFF(CL,IX,M_TAG,M_FUN) \
+\
+FLEXT_CADDMETHOD_3(CL,IX,M_TAG,M_FUN,float,float,float)
+
+//! Add a handler for a method with 1 integer argument
+#define FLEXT_CADDMETHOD_I(CL,IX,M_TAG,M_FUN) \
+\
+FLEXT_CADDMETHOD_1(CL,IX,M_TAG,M_FUN,int)
+
+//! Add a handler for a method with 2 integer arguments
+#define FLEXT_CADDMETHOD_II(CL,IX,M_TAG,M_FUN) \
+\
+FLEXT_CADDMETHOD_2(CL,IX,M_TAG,M_FUN,int,int)
+
+//! Add a handler for a method with 3 integer arguments
+#define FLEXT_CADDMETHOD_III(CL,IX,M_TAG,M_FUN) \
+\
+FLEXT_CADDMETHOD_3(CL,IX,M_TAG,M_FUN,int,int,int)
+
+//! @} FLEXT_D_CADDMETHOD
/*! \defgroup FLEXT_D_ADDMETHOD Add flext methods
- \note These can only be used at class construction time
+ \note These can only be used at object construction time
+ \note (in constructor or in Init() function before call to parent's Init())
@{
*/
@@ -696,32 +799,32 @@ AddMethod(IX,M_TAG,FLEXT_CALL_PRE(M_FUN))
//! Add a handler for a method with 1 enum type argument
#define FLEXT_ADDMETHOD_E(IX,M_TAG,M_FUN) \
\
-AddMethod(IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),a_int,a_null)
+AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),a_int,a_null)
//! Add a handler for a method with 1 argument
#define FLEXT_ADDMETHOD_1(IX,M_TAG,M_FUN,TP1) \
\
-AddMethod(IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),a_null)
+AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),a_null)
//! Add a handler for a method with 2 arguments
#define FLEXT_ADDMETHOD_2(IX,M_TAG,M_FUN,TP1,TP2) \
\
-AddMethod(IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),a_null)
+AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),a_null)
//! Add a handler for a method with 3 arguments
#define FLEXT_ADDMETHOD_3(IX,M_TAG,M_FUN,TP1,TP2,TP3) \
\
-AddMethod(IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),a_null)
+AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),a_null)
//! Add a handler for a method with 4 arguments
#define FLEXT_ADDMETHOD_4(IX,M_TAG,M_FUN,TP1,TP2,TP3,TP4) \
\
-AddMethod(IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),FLEXTARG(TP4),a_null)
+AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),FLEXTARG(TP4),a_null)
//! Add a handler for a method with 5 arguments
#define FLEXT_ADDMETHOD_5(IX,M_TAG,M_FUN,TP1,TP2,TP3,TP4,TP5) \
\
-AddMethod(IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),FLEXTARG(TP4),FLEXTARG(TP5),a_null)
+AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),FLEXTARG(TP4),FLEXTARG(TP5),a_null)
// Shortcuts
@@ -761,8 +864,8 @@ FLEXT_ADDMETHOD_2(IX,M_TAG,M_FUN,int,int)
\
FLEXT_ADDMETHOD_3(IX,M_TAG,M_FUN,int,int,int)
-//! @} FLEXT_D_ADDMETHOD
+//! @} FLEXT_D_ADDMETHOD
/*! \defgroup FLEXT_D_CALLMETHOD Call flext methods manually
@@ -1082,12 +1185,62 @@ FLEXT_ATTRGET_V(VAR) FLEXT_ATTRSET_V(VAR)
//! @} FLEXT_DA_ATTRVAR
-/*! \defgroup FLEXT_D_ADDATTR Announce object attributes
+/*! \defgroup FLEXT_D_CADDATTR Announce object attributes at class scope
\note These can only be used at class construction time
@{
*/
//! Add handler for a gettable attribute
+#define FLEXT_CADDATTR_GET(CL,NAME,GFUN) \
+\
+AddAttrib(CL,NAME,(FLEXT_GET_PRE(GFUN)),NULL)
+
+//! Add handler for a settable attribute
+#define FLEXT_CADDATTR_SET(CL,NAME,SFUN) \
+\
+AddAttrib(CL,NAME,NULL,(FLEXT_SET_PRE(SFUN)))
+
+//! Add handlers for a both get- and settable attribute
+#define FLEXT_CADDATTR_VAR(CL,NAME,GFUN,SFUN) \
+\
+AddAttrib(CL,NAME,(FLEXT_GET_PRE(GFUN)),(FLEXT_SET_PRE(SFUN)))
+
+//! Add handlers for a both get- and settable attribute
+#define FLEXT_CADDATTR_VAR1(CL,NAME,FUN) \
+\
+AddAttrib(CL,NAME,(FLEXT_GET_PRE(FUN)),(FLEXT_SET_PRE(FUN)))
+
+
+//! Add handler for a gettable enum attribute
+#define FLEXT_CADDATTR_GET_E(CL,NAME,GFUN) \
+\
+AddAttrib(CL,NAME,(bool (*)(flext_base *,int &))(FLEXT_GET_PRE(GFUN)),NULL)
+
+//! Add handler for a settable enum attribute
+#define FLEXT_CADDATTR_SET_E(CL,NAME,SFUN) \
+\
+AddAttrib(CL,NAME,NULL,(bool (*)(flext_base *,int &))(FLEXT_SET_PRE(SFUN)))
+
+//! Add handlers for a both get- and settable enum attribute
+#define FLEXT_CADDATTR_VAR_E(CL,NAME,GFUN,SFUN) \
+\
+AddAttrib(CL,NAME,(bool (*)(flext_base *,int &))(FLEXT_GET_PRE(GFUN)),(bool (*)(flext_base *,int &))(FLEXT_SET_PRE(SFUN)))
+
+//! Add handlers for a both get- and settable enum attribute
+#define FLEXT_CADDATTR_VAR1_E(CL,NAME,FUN) \
+\
+AddAttrib(CL,NAME,(bool (*)(flext_base *,int &))(FLEXT_GET_PRE(FUN)),(bool (*)(flext_base *,int &))(FLEXT_SET_PRE(FUN)))
+
+//! @} FLEXT_D_CADDATTR
+
+
+/*! \defgroup FLEXT_D_ADDATTR Announce object attributes
+ \note These can only be used at object construction time
+ \note (in constructor or in Init() function before call to parent's Init())
+ @{
+*/
+
+//! Add handler for a gettable attribute
#define FLEXT_ADDATTR_GET(NAME,GFUN) \
\
AddAttrib(NAME,(FLEXT_GET_PRE(GFUN)),NULL)
diff --git a/externals/grill/flext/source/flext.cpp b/externals/grill/flext/source/flext.cpp
index f74d11c6..5ffaaae4 100644
--- a/externals/grill/flext/source/flext.cpp
+++ b/externals/grill/flext/source/flext.cpp
@@ -14,104 +14,6 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include "flext.h"
#include "flinternal.h"
-#include <string.h>
-#include <stdarg.h>
-
-
-// === proxy class for flext_base ============================
-
-#if FLEXT_SYS == FLEXT_SYS_PD
-
-static t_class *px_class;
-
-struct flext_base::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_method(px_object *c,const t_symbol *s,int argc,t_atom *argv);
-};
-
-
-void flext_base::px_object::px_method(px_object *obj,const t_symbol *s,int argc,t_atom *argv)
-{
- obj->base->m_methodmain(obj->index,s,argc,argv);
-}
-
-void flext_base::cb_px_anything(t_class *c,const t_symbol *s,int argc,t_atom *argv)
-{
- thisObject(c)->m_methodmain(0,s,argc,argv);
-}
-
-#define DEF_IN_FT(IX) \
-void flext_base::cb_px_ft ## IX(t_class *c,float v) { \
- t_atom atom; SETFLOAT(&atom,v); \
- thisObject(c)->m_methodmain(IX,&s_float,1,&atom); \
-}
-
-#define ADD_IN_FT(IX) \
-add_method1(c,cb_px_ft ## IX,"ft" #IX,A_FLOAT)
-
-#elif FLEXT_SYS == FLEXT_SYS_MAX
-
-void flext_base::cb_px_anything(t_class *c,const t_symbol *s,int argc,t_atom *argv)
-{
- // check if inlet allows anything (or list)
-
- flext_base *o = thisObject(c);
- int ci = ((flext_hdr *)o->x_obj)->curinlet;
-
- o->m_methodmain(ci,s,argc,argv);
-}
-
-void flext_base::cb_px_int(t_class *c,int v)
-{
- // check if inlet allows int type
- t_atom atom;
- SetInt(atom,v);
- cb_px_anything(c,sym_int,1,&atom);
-}
-
-void flext_base::cb_px_float(t_class *c,float v)
-{
- // check if inlet allows float type
- t_atom atom;
- SetFloat(atom,v);
- cb_px_anything(c,sym_float,1,&atom);
-}
-
-void flext_base::cb_px_bang(t_class *c)
-{
- // check if inlet allows bang
- cb_px_anything(c,sym_bang,0,NULL);
-}
-
-
-#define DEF_IN_FT(IX) \
-void flext_base::cb_px_in ## IX(t_class *c,int v) { long &ci = ((flext_hdr *)thisObject(c)->x_obj)->curinlet; ci = IX; cb_px_int(c,v); ci = 0; } \
-void flext_base::cb_px_ft ## IX(t_class *c,float v) { long &ci = ((flext_hdr *)thisObject(c)->x_obj)->curinlet; ci = IX; cb_px_float(c,v); ci = 0; }
-
-#define ADD_IN_FT(IX) \
-add_method1(c,cb_px_in ## IX,"in" #IX,A_INT); \
-add_method1(c,cb_px_ft ## IX,"ft" #IX,A_FLOAT)
-
-#else
-#error // Other system
-#endif
-
-
-DEF_IN_FT(1)
-DEF_IN_FT(2)
-DEF_IN_FT(3)
-DEF_IN_FT(4)
-DEF_IN_FT(5)
-DEF_IN_FT(6)
-DEF_IN_FT(7)
-DEF_IN_FT(8)
-DEF_IN_FT(9)
-
// === flext_base ============================================
@@ -125,15 +27,15 @@ flext_base::flext_base():
insigs(0),outsigs(0),
outlets(NULL),outattr(NULL),
distmsgs(false),
- methhead(NULL),attrhead(NULL),attrcnt(0),
+ methhead(new itemarr),attrhead(new itemarr), //attrcnt(0),
+ clmethhead(ClMeths(thisClass())),clattrhead(ClAttrs(thisClass())),
inlets(NULL)
{
LOG1("%s - flext logging is on",thisName());
+ // message queue ticker
qhead = qtail = NULL;
qclk = (t_qelem *)(qelem_new(this,(t_method)QTick));
-
- AddMethod(0,"getattributes",(methfun)cb_ListAttrib);
}
flext_base::~flext_base()
@@ -142,10 +44,15 @@ flext_base::~flext_base()
StopThreads();
#endif
- // send remaining pending messages
+ // send remaining pending messages and destroy queue ticker
while(qhead) QTick(this);
qelem_free((t_qelem *)qclk);
+ // delete message lists
+ if(methhead) delete methhead;
+ if(attrhead) delete attrhead;
+
+ // destroy inlets and outlets and their proxy objects
if(inlist) delete inlist;
if(outlist) delete outlist;
if(outlets) delete[] outlets;
@@ -153,6 +60,7 @@ flext_base::~flext_base()
if(inlets) {
for(int ix = 0; ix < incnt; ++ix)
if(inlets[ix]) {
+ // release proxy object
#if FLEXT_SYS == FLEXT_SYS_PD
pd_free(&inlets[ix]->obj.ob_pd);
#elif FLEXT_SYS == FLEXT_SYS_MAX
@@ -161,258 +69,44 @@ flext_base::~flext_base()
}
delete[] inlets;
}
-
+
#if FLEXT_SYS == FLEXT_SYS_MAX
// if(insigs) dsp_free(thisHdr());
if(insigs) dsp_freebox(thisHdr());
#endif
-
- if(methhead) delete methhead;
- if(attrhead) delete attrhead;
}
-/*! This virtual function is created after the object has been created, that is,
- after the constructor has been processed. It creates the inlets and outlets.
+/*! 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
+ \mote 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 = true;
-
- // ----------------------------------
- // create inlets
- // ----------------------------------
-
- incnt = insigs = 0;
-
- if(inlist) {
- xlet *xi;
- incnt = 0;
- for(xi = inlist; xi; xi = xi->nxt) ++incnt;
- xlet::type *list = new xlet::type[incnt];
- int i;
- for(xi = inlist,i = 0; xi; xi = xi->nxt,++i) list[i] = xi->tp;
- delete inlist; inlist = NULL;
-
- inlets = new px_object *[incnt];
- for(i = 0; i < incnt; ++i) inlets[i] = NULL;
-
- // type info is now in list array
-#if FLEXT_SYS == FLEXT_SYS_PD
- {
- int cnt = 0;
-
- if(incnt >= 1) {
- switch(list[0]) {
- case xlet::tp_sig:
- CLASS_MAINSIGNALIN(thisClass(),flext_hdr,defsig);
- ++insigs;
- break;
- default:
- // leftmost inlet is already there...
- break;
- }
- ++cnt;
- }
-
- for(int ix = 1; ix < incnt; ++ix,++cnt) {
- switch(list[ix]) {
- case xlet::tp_float:
- case xlet::tp_int: {
- char sym[] = "ft??";
- if(ix >= 10) {
- if(compatibility) {
- // Max allows max. 9 inlets
- post("%s: Only 9 float/int inlets allowed in compatibility mode",thisName());
- ok = false;
- }
- else {
- if(ix > 99)
- post("%s: Inlet index > 99 not allowed for float/int inlets",thisName());
- sym[2] = '0'+ix/10,sym[3] = '0'+ix%10;
- }
- }
- else
- sym[2] = '0'+ix,sym[3] = 0;
- if(ok) inlet_new(&x_obj->obj, &x_obj->obj.ob_pd, &s_float, gensym(sym));
- break;
- }
- case xlet::tp_sym:
- (inlets[ix] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages
- inlet_new(&x_obj->obj,&inlets[ix]->obj.ob_pd, &s_symbol, &s_symbol);
- break;
- case xlet::tp_list:
- (inlets[ix] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages
- inlet_new(&x_obj->obj,&inlets[ix]->obj.ob_pd, &s_list, &s_list);
- break;
- case xlet::tp_any:
- (inlets[ix] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages
- inlet_new(&x_obj->obj,&inlets[ix]->obj.ob_pd, 0, 0);
- break;
- case xlet::tp_sig:
- if(compatibility && list[ix-1] != xlet::tp_sig) {
- post("%s: All signal inlets must be left-aligned in compatibility mode",thisName());
- ok = false;
- }
- else {
- // pd doesn't seem to be able to handle signals and messages into the same inlet...
-
- inlet_new(&x_obj->obj, &x_obj->obj.ob_pd, &s_signal, &s_signal);
- ++insigs;
- }
- break;
- default:
- error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)list[ix]);
- ok = false;
- }
- }
-
- incnt = cnt;
- }
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- {
- int ix,cnt;
- // count leftmost signal inlets
- while(insigs < incnt && list[insigs] == xlet::tp_sig) ++insigs;
-
- for(cnt = 0,ix = incnt-1; ix >= insigs; --ix,++cnt) {
- if(ix == 0) {
- if(list[ix] != xlet::tp_any) {
- error("%s: Leftmost inlet must be of type signal or default",thisName());
- ok = false;
- }
- }
- else {
- switch(list[ix]) {
- case xlet::tp_sig:
- error("%s: All signal inlets must be at the left side",thisName());
- ok = false;
- break;
- case xlet::tp_float:
- if(ix >= 10) {
- post("%s: Only 9 float inlets possible",thisName());
- ok = false;
- }
- else
- floatin(x_obj,ix);
- break;
- case xlet::tp_int:
- if(ix >= 10) {
- post("%s: Only 9 int inlets possible",thisName());
- ok = false;
- }
- else
- intin(x_obj,ix);
- break;
- case xlet::tp_any: // non-leftmost
- case xlet::tp_sym:
- case xlet::tp_list:
- inlets[ix] = (px_object *)proxy_new(x_obj,ix,&((flext_hdr *)x_obj)->curinlet);
- break;
- default:
- error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)list[ix]);
- ok = false;
- }
- }
- }
-
- incnt = cnt;
-
- if(insigs)
-// dsp_setup(thisHdr(),insigs); // signal inlets
- dsp_setupbox(thisHdr(),insigs); // signal inlets
- }
-#else
-#error
-#endif
+ bool ok = flext_obj::Init();
- delete[] list;
- }
-
-/*
- if(outlets) { delete[] outlets; outlets = NULL; }
-*/
- // ----------------------------------
- // create outlets
- // ----------------------------------
+ if(ok) ok = InitInlets() && InitOutlets();
- outcnt = outsigs = 0;
-
-#if FLEXT_SYS == FLEXT_SYS_MAX
- // for Max/MSP the rightmost outlet has to be created first
- if(procattr)
- outattr = (outlet *)newout_anything(&x_obj->obj);
-#endif
-
- if(outlist) {
- xlet *xi;
-
- // count outlets
- outcnt = 0;
- for(xi = outlist; xi; xi = xi->nxt) ++outcnt;
-
- xlet::type *list = new xlet::type[outcnt];
- int i;
- for(xi = outlist,i = 0; xi; xi = xi->nxt,++i) list[i] = xi->tp;
- delete outlist; outlist = NULL;
+ if(ok) {
+ // initialize method lists
+ if(methhead) methhead->Finalize();
+ if(clmethhead) clmethhead->Finalize();
- outlets = new outlet *[outcnt];
-
- // 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(list[ix]) {
- case xlet::tp_float:
- outlets[ix] = (outlet *)newout_float(&x_obj->obj);
- break;
- case xlet::tp_int:
- outlets[ix] = (outlet *)newout_flint(&x_obj->obj);
- break;
- case xlet::tp_sig:
- outlets[ix] = (outlet *)newout_signal(&x_obj->obj);
- ++outsigs;
- break;
- case xlet::tp_sym:
- outlets[ix] = (outlet *)newout_symbol(&x_obj->obj);
- break;
- case xlet::tp_list:
- outlets[ix] = (outlet *)newout_list(&x_obj->obj);
- break;
- case xlet::tp_any:
- outlets[ix] = (outlet *)newout_anything(&x_obj->obj);
- break;
-#ifdef FLEXT_DEBUG
- default:
- ERRINTERNAL();
- ok = false;
-#endif
- }
+ if(procattr) {
+ // initialize attribute lists
+ if(attrhead) attrhead->Finalize();
+ if(clattrhead) clattrhead->Finalize();
+
+ // initialize creation attributes
+ if(m_holdaargc && m_holdaargv)
+ ok = InitAttrib(m_holdaargc,m_holdaargv);
}
-
- delete[] list;
}
- if(procattr) {
-#if FLEXT_SYS == FLEXT_SYS_PD
- // attribute dump outlet is the last one
- outattr = (outlet *)newout_anything(&x_obj->obj);
-#endif
-
- // initialize creation attributes
- if(m_holdaargc && m_holdaargv)
- ok = InitAttrib(m_holdaargc,m_holdaargv);
- }
-
-
return ok;
}
@@ -427,35 +121,13 @@ void flext_base::Setup(t_class *c)
add_assist(c,cb_assist);
#endif
- // proxy for extra inlets
-#if FLEXT_SYS == FLEXT_SYS_PD
- add_anything(c,cb_px_anything); // for leftmost inlet
- px_class = class_new(gensym("flext_base proxy"),NULL,NULL,sizeof(px_object),CLASS_PD|CLASS_NOINLET, A_NULL);
- add_anything(px_class,px_object::px_method); // for other inlets
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- add_bang(c,cb_px_bang);
- add_method1(c,cb_px_int,"int",A_INT);
- add_method1(c,cb_px_float,"float",A_FLOAT);
- add_methodG(c,cb_px_anything,"list");
- add_anything(c,cb_px_anything);
-#else
-#error
-#endif
+ if(process_attributes)
+ AddMethod(c,0,"getattributes",(methfun)cb_ListAttrib);
- // setup non-leftmost ints and floats
- ADD_IN_FT(1);
- ADD_IN_FT(2);
- ADD_IN_FT(3);
- ADD_IN_FT(4);
- ADD_IN_FT(5);
- ADD_IN_FT(6);
- ADD_IN_FT(7);
- ADD_IN_FT(8);
- ADD_IN_FT(9);
+ SetProxies(c);
#ifdef FLEXT_THREADS
thrid = GetThreadId();
-
StartHelper();
#endif
}
@@ -473,282 +145,8 @@ void flext_base::m_help()
post("%s (using flext " FLEXT_VERSTR ") - compiled on %s %s",thisName(),__DATE__,__TIME__);
}
-/*! \brief All the message processing
- The messages of all the inlets go here and are promoted to the registered callback functions
-*/
-bool flext_base::m_methodmain(int inlet,const t_symbol *s,int argc,const t_atom *argv)
-{
- static bool trap = false;
- bool ret = false;
-
- curtag = s;
-
- LOG3("methodmain inlet:%i args:%i symbol:%s",inlet,argc,s?s->s_name:"");
-
- for(const methitem *m = methhead; m && !ret; m = m->nxt) {
- if(m->tag == s && (inlet == m->inlet || m->inlet < 0 )) {
- // tag fits
- LOG4("found method tag %s: inlet=%i, symbol=%s, argc=%i",m->tag->s_name,inlet,s->s_name,argc);
-
- if(m->argc == 1 && m->args[0] == a_list) {
- ret = ((methfun_V)m->fun)(this,argc,const_cast<t_atom *>(argv));
- }
- else if(m->argc == 1 && m->args[0] == a_any) {
- ret = ((methfun_A)m->fun)(this,s,argc,const_cast<t_atom *>(argv));
- }
- else if(argc == m->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) 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) 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) 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 = GetPointer(argv[ix]);
- else ok = false;
- break;
- }
-#endif
- default:
- error("Argument type illegal");
- ok = false;
- }
- }
-
- if(ok && ix == argc) {
- switch(argc) {
- case 0: ret = ((methfun_0)m->fun)(this); break;
- case 1: ret = ((methfun_1)m->fun)(this,aargs[0]); break;
- case 2: ret = ((methfun_2)m->fun)(this,aargs[0],aargs[1]); break;
- case 3: ret = ((methfun_3)m->fun)(this,aargs[0],aargs[1],aargs[2]); break;
- case 4: ret = ((methfun_4)m->fun)(this,aargs[0],aargs[1],aargs[2],aargs[3]); break;
- case 5: ret = ((methfun_5)m->fun)(this,aargs[0],aargs[1],aargs[2],aargs[3],aargs[4]); break;
- }
- }
- }
- }
- else if(m->tag == sym_symbol && !argc && (inlet == m->inlet || m->inlet < 0 )) {
- // symbol
- LOG3("found symbol method for %s: inlet=%i, symbol=%s",m->tag->s_name,inlet,s->s_name);
-
- t_any sym; sym.st = const_cast<t_symbol *>(s);
- ret = ((methfun_1)m->fun)(this,sym);
- }
- else if(m->tag == sym_anything && (inlet == m->inlet || m->inlet < 0) && m->argc == 1 && m->args[0] == a_any) {
- // any
- LOG4("found any method for %s: inlet=%i, symbol=%s, argc=%i",m->tag->s_name,inlet,s->s_name,argc);
-
- ret = ((methfun_A)m->fun)(this,s,argc,const_cast<t_atom *>(argv));
- }
- }
-
-#if FLEXT_SYS == FLEXT_SYS_MAX
- // If float message is not explicitly handled: try int handler instead
- if(!ret && argc == 1 && s == sym_float && !trap) {
- t_atom fl;
- SetInt(fl,GetAInt(argv[0]));
- trap = true;
- ret = m_methodmain(inlet,sym_int,1,&fl);
- trap = false;
- }
-
- // If int message is not explicitly handled: try float handler instead
- if(!ret && argc == 1 && s == sym_int && !trap) {
- t_atom fl;
- SetFloat(fl,GetAFloat(argv[0]));
- trap = true;
- ret = m_methodmain(inlet,sym_float,1,&fl);
- trap = false;
- }
-#endif
-
- // If float or int message is not explicitly handled: try list handler instead
- if(!ret && !trap && argc == 1 && (s == sym_float
-#if FLEXT_SYS == FLEXT_SYS_MAX
- || s == sym_int
-#endif
- )) {
- t_atom list;
- if(s == sym_float)
- SetFloat(list,GetFloat(argv[0]));
-#if FLEXT_SYS == FLEXT_SYS_MAX
- else if(s == sym_int)
- SetInt(list,GetInt(argv[0]));
-#endif
-
- trap = true;
- ret = m_methodmain(inlet,sym_list,1,&list);
- trap = false;
- }
-
- // If symbol message (pure anything without args) is not explicitly handled: try list handler instead
- if(!ret && !trap && argc == 0) {
- t_atom list;
- SetSymbol(list,s);
- trap = true;
- ret = m_methodmain(inlet,sym_list,1,&list);
- trap = false;
- }
+void flext_base::m_loadbang() {}
- // if distmsgs is switched on then distribute list elements over inlets (Max/MSP behavior)
- if(!ret && distmsgs && !trap && inlet == 0 && s == sym_list && insigs <= 1) {
- 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
- else if(IsPointer(argv[i])) sym = sym_pointer; // can pointer atoms occur here?
-#endif
- if(sym) {
- trap = true;
- m_methodmain(i,sym,1,argv+i);
- trap = false;
- }
- }
-
- ret = true;
- }
-
- if(!ret && !trap) ret = m_method_(inlet,s,argc,argv);
-
- 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)
-{
-//#ifdef FLEXT_DEBUG
- post("%s: message unhandled - inlet:%i args:%i symbol:%s",thisName(),inlet,argc,s?s->s_name:"");
-//#endif
- return false;
-}
-
-
-flext_base::methitem::methitem(int in,const t_symbol *t):
- tag(t),inlet(in),
- argc(0),args(NULL),
- fun(NULL),
- nxt(NULL)
-{}
-
-flext_base::methitem::~methitem()
-{
- if(nxt) delete nxt;
- 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;
-}
-
-
-
-void flext_base::AddMethItem(methitem *m)
-{
- if(methhead) {
- methitem *mi;
- for(mi = methhead; mi->nxt; mi = mi->nxt) {}
- mi->nxt = m;
- }
- else
- methhead = m;
-}
-/*
-const flext_base::methitem *flext_base::FindMethItem(int inlet,const t_symbol *tag,const methitem *st)
-{
- const methitem *mi = st?st:mlst;
- if(inlet < 0) {
- for(; mi; mi = mi->nxt)
- if(mi->tag == tag) break;
- }
- else {
- for(; mi; mi = mi->nxt)
- if(mi->inlet == inlet && mi->tag == tag) break;
- }
- return mi;
-}
-*/
-
-void flext_base::AddMethodDef(int inlet,const char *tag)
-{
- AddMethItem(new methitem(inlet,tag?MakeSymbol(tag):NULL));
-}
-
-/*! \brief Add a method to the queue
-*/
-void flext_base::AddMethod(int inlet,const char *tag,methfun fun,metharg tp,...)
-{
- methitem *mi = new methitem(inlet,MakeSymbol(tag));
-
- 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("%s - method %s: only %i arguments are type-checkable: use variable argument list for more",thisName(),tag?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
- if(a == a_pointer && flext_base::compatibility) {
- post("Pointer arguments are not allowed in compatibility mode");
- }
-#endif
- args[ix] = a;
- a = (metharg)va_arg(marker,int); //metharg);
- }
- va_end(marker);
- }
-
- mi->SetArgs(fun,argc,args);
-
- AddMethItem(mi);
-}
+void flext_base::m_assist(long /*msg*/,long /*arg*/,char * /*s*/) {}
diff --git a/externals/grill/flext/source/flinternal.h b/externals/grill/flext/source/flinternal.h
index 09b8cbd1..87f04882 100644
--- a/externals/grill/flext/source/flinternal.h
+++ b/externals/grill/flext/source/flinternal.h
@@ -62,6 +62,9 @@ typedef t_perfroutine t_dspmethod;
#define qelem_set clock_set
#define qelem_unset clock_unset
+#define CRITON()
+#define CRITOFF()
+
#elif FLEXT_SYS == FLEXT_SYS_MAX
@@ -106,6 +109,9 @@ typedef void t_outlet;
typedef t_perfroutine t_dspmethod;
+#define CRITON() short state = lockout_set(1)
+#define CRITOFF() lockout_set(state)
+
#endif
diff --git a/externals/grill/flext/source/flitem.cpp b/externals/grill/flext/source/flitem.cpp
new file mode 100755
index 00000000..cd5aed9e
--- /dev/null
+++ b/externals/grill/flext/source/flitem.cpp
@@ -0,0 +1,209 @@
+/*
+
+flext - C++ layer for Max/MSP and pd (pure data) externals
+
+Copyright (c) 2001,2002 Thomas Grill (xovo@gmx.net)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+
+*/
+
+/*! \file flitem.cpp
+ \brief Processing of method and attribute lists.
+*/
+
+#include "flext.h"
+#include <string.h>
+
+
+flext_base::item::item(const t_symbol *t,int inl,attritem *a):
+ inlet(inl),tag(t),attr(a),nxt(NULL)
+{}
+
+flext_base::item::~item()
+{
+ if(nxt) delete nxt;
+}
+
+
+flext_base::itemarr::itemarr():
+ arr(new item *[2]),cnt(0),bits(-1)
+{
+ arr[0] = arr[1] = NULL;
+}
+
+flext_base::itemarr::~itemarr()
+{
+ int c = Ready()?Size():2;
+
+ for(int i = 0; i < c; ++i)
+ if(arr[i]) delete arr[i];
+ delete[] arr;
+}
+
+void flext_base::itemarr::Add(item *it)
+{
+ if(Ready()) {
+ // retrieve array index
+ int ix = Hash(it->tag,it->inlet,bits);
+
+ // add to array slot
+ if(arr[ix]) {
+ item *a = arr[ix];
+ while(a->nxt) a = a->nxt;
+ a->nxt = it;
+ }
+ else arr[ix] = it;
+ }
+ else {
+// post("ADD %i,%s",it->inlet,GetString(it->tag));
+
+ if(arr[0]) arr[1] = arr[1]->nxt = it;
+ else arr[0] = arr[1] = it;
+ ++cnt;
+ }
+}
+
+void flext_base::itemarr::Finalize()
+{
+ if(!Ready())
+ {
+ bits = Int2Bits(cnt); // at least enough bits to hold all items
+
+ int sz = Size();
+
+ // save stored item list
+ item *lst = arr[0];
+
+ delete[] arr;
+ arr = new item *[sz];
+ memset(arr,0,sz*sizeof(*arr));
+
+ while(lst) {
+ item *l = lst;
+ lst = lst->nxt;
+ l->nxt = NULL;
+
+ Add(l);
+/*
+ // retrieve array index
+ int ix = Hash(l->tag,l->inlet,bits);
+
+// post("ADD %i,%s -> index %i",l->inlet,GetString(l->tag),ix);
+
+ // add to array slot
+ if(arr[ix]) {
+ item *a = arr[ix];
+ while(a->nxt) a = a->nxt;
+ a->nxt = l;
+ }
+ else arr[ix] = l;
+*/
+ }
+
+#if 0
+ post("count=%i, bit=%i size=%i",Count(),bits,sz);
+
+ if(Count()) {
+ static char usage[1024];
+ int c = 0,i;
+ for(i = 0; i < sz; ++i) {
+ usage[i] = arr[i]?'x':'.';
+ if(arr[i]) ++c;
+ }
+ usage[i] = 0;
+ post("USAGE %i/%i - sparse=%i%% %s",c,Count(),(int)((float)c/Count()*100.),usage);
+ }
+#endif
+ }
+}
+
+flext_base::item *flext_base::itemarr::Find(const t_symbol *tag,int inlet) const
+{
+ item *a;
+ if(!Ready())
+ a = arr[0];
+ else if(Count()) {
+ int ix = Hash(tag,inlet,bits);
+ a = arr[ix];
+ }
+ else
+ a = NULL;
+
+ // Search first matching entry
+ while(a && (a->tag != tag || a->inlet != inlet)) a = a->nxt;
+ return a;
+}
+
+int flext_base::itemarr::Hash(const t_symbol *tag,int inlet,int bits)
+{
+ unsigned long h = ((reinterpret_cast<unsigned long>(tag)&~7L)<<1)+inlet;
+ return FoldBits(h,bits);
+}
+
+// --- class item lists (methods and attributes) ----------------
+
+class _itemarr
+{
+public:
+ enum { HASHBITS=7, HASHSIZE=1<<HASHBITS };
+
+ _itemarr(t_class *c,int i);
+ ~_itemarr(); // will never be called
+
+ static int Hash(t_class *c,int ix);
+
+ int Hash() const { return Hash(cl,ix); }
+ void Add(_itemarr *a);
+
+ t_class *cl;
+ int ix;
+ flext_base::itemarr *arr;
+
+ _itemarr *nxt;
+};
+
+_itemarr::_itemarr(t_class *c,int i):
+ cl(c),ix(i),
+ arr(new flext_base::itemarr),
+ nxt(NULL)
+{}
+
+void _itemarr::Add(_itemarr *a)
+{
+ if(nxt) nxt->Add(a);
+ else nxt = a;
+}
+
+int _itemarr::Hash(t_class *c,int ix)
+{
+ unsigned long h = (reinterpret_cast<unsigned long>(c)&~3L)+ix;
+ return flext::FoldBits(h,HASHBITS);
+}
+
+static _itemarr **_arrs = NULL;
+
+flext_base::itemarr *flext_base::GetClassArr(t_class *c,int ix)
+{
+ if(!_arrs) {
+ _arrs = new _itemarr *[_itemarr::HASHSIZE];
+ memset(_arrs,0,_itemarr::HASHSIZE*sizeof(*_arrs));
+ }
+
+ int hash = _itemarr::Hash(c,ix);
+ _itemarr *a = _arrs[hash];
+ _itemarr *pa = NULL;
+ while(a && (a->cl != c || a->ix != ix)) pa = a,a = a->nxt;
+
+ if(!a) {
+ a = new _itemarr(c,ix);
+ if(pa)
+ // previous entry... extend
+ a->nxt = pa->nxt,pa->nxt = a;
+ else
+ // new singular entry
+ _arrs[hash] = a;
+ }
+
+ return a->arr;
+}
diff --git a/externals/grill/flext/source/fllib.cpp b/externals/grill/flext/source/fllib.cpp
index 77f85dbc..4c66d0b5 100755
--- a/externals/grill/flext/source/fllib.cpp
+++ b/externals/grill/flext/source/fllib.cpp
@@ -354,8 +354,12 @@ flext_hdr *flext_obj::obj_new(const t_symbol *s,int _argc_,t_atom *argv)
flext_obj::m_holdaargv = argv+argc;
// call virtual init function
+ // here, inlets, outlets, methods and attributes can be set up
ok = obj->data->Init();
+ // call another virtual init function
+ if(ok) ok = obj->data->Finalize();
+
flext_obj::m_holdaargc = 0;
flext_obj::m_holdaargv = NULL;
}
diff --git a/externals/grill/flext/source/flmeth.cpp b/externals/grill/flext/source/flmeth.cpp
new file mode 100755
index 00000000..c5b4499b
--- /dev/null
+++ b/externals/grill/flext/source/flmeth.cpp
@@ -0,0 +1,120 @@
+/*
+
+flext - C++ layer for Max/MSP and pd (pure data) externals
+
+Copyright (c) 2001,2002 Thomas Grill (xovo@gmx.net)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+
+*/
+
+/*! \file flmeth.cpp
+ \brief Method processing of flext base class.
+*/
+
+#include "flext.h"
+#include <string.h>
+#include <stdarg.h>
+
+flext_base::methitem::methitem(int in,const t_symbol *tg,attritem *conn):
+ item(tg,in,conn),
+ 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;
+}
+
+/*
+void flext_base::AddMethItem(methitem *m)
+{
+ int ix = m->Hash();
+ post("method index %x",ix);
+ methitem *&mix = methhead[ix];
+
+ if(mix) {
+ methitem *mi;
+ for(mi = mix; mi->nxt; mi = mi->nxt) {}
+ mi->nxt = m;
+ }
+ else
+ mix = m;
+}
+*/
+/*
+const flext_base::methitem *flext_base::FindMethItem(int inlet,const t_symbol *tag,const methitem *st)
+{
+ const methitem *mi = st?st:mlst;
+ if(inlet < 0) {
+ for(; mi; mi = mi->nxt)
+ if(mi->tag == tag) break;
+ }
+ else {
+ for(; mi; mi = mi->nxt)
+ if(mi->inlet == inlet && mi->tag == tag) break;
+ }
+ return mi;
+}
+*/
+
+void flext_base::AddMethodDef(int inlet,const char *tag)
+{
+ methhead->Add(new methitem(inlet,tag?MakeSymbol(tag):NULL));
+}
+
+/*! \brief Add a method to the queue
+*/
+void flext_base::AddMethod(itemarr *ma,int inlet,const char *tag,methfun fun,metharg tp,...)
+{
+ 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?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
+ if(a == a_pointer && flext_base::compatibility) {
+ 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(inlet,MakeSymbol(tag));
+
+ mi->SetArgs(fun,argc,args);
+
+ ma->Add(mi);
+}
+
diff --git a/externals/grill/flext/source/flmsg.cpp b/externals/grill/flext/source/flmsg.cpp
new file mode 100755
index 00000000..a1c049d2
--- /dev/null
+++ b/externals/grill/flext/source/flmsg.cpp
@@ -0,0 +1,256 @@
+/*
+
+flext - C++ layer for Max/MSP and pd (pure data) externals
+
+Copyright (c) 2001,2002 Thomas Grill (xovo@gmx.net)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+
+*/
+
+/*! \file flmsg.cpp
+ \brief Message processing of flext base class.
+*/
+
+#include "flext.h"
+
+bool flext_base::CallMeth(const methitem &m,int argc,const t_atom *argv)
+{
+ bool ret = false;
+ 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) 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) 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) 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 = GetPointer(argv[ix]);
+ else ok = false;
+ break;
+ }
+#endif
+ default:
+ error("Argument type illegal");
+ ok = false;
+ }
+ }
+
+ if(ok && ix == argc) {
+ switch(argc) {
+ case 0: ret = ((methfun_0)m.fun)(this); break;
+ case 1: ret = ((methfun_1)m.fun)(this,aargs[0]); break;
+ case 2: ret = ((methfun_2)m.fun)(this,aargs[0],aargs[1]); break;
+ case 3: ret = ((methfun_3)m.fun)(this,aargs[0],aargs[1],aargs[2]); break;
+ case 4: ret = ((methfun_4)m.fun)(this,aargs[0],aargs[1],aargs[2],aargs[3]); break;
+ case 5: ret = ((methfun_5)m.fun)(this,aargs[0],aargs[1],aargs[2],aargs[3],aargs[4]); break;
+ }
+ }
+
+ return ret;
+}
+
+bool flext_base::TryMethTag(const methitem *m,int inlet,const t_symbol *t,int argc,const t_atom *argv)
+{
+ do {
+ if(m->inlet == inlet && m->tag == t) {
+ LOG3("found method tag %s: inlet=%i, argc=%i",GetString(m->tag),m->inlet,argc);
+
+ if(m->attr) {
+ // attributes are treated differently
+
+ if(m->attr->isget)
+ return GetAttrib(m->attr);
+ else
+ return SetAttrib(m->attr,argc,argv);
+ }
+ else {
+ if(m->argc == 1) {
+ // try list
+ if(m->args[0] == a_list && ((methfun_V)m->fun)(this,argc,const_cast<t_atom *>(argv))) return true;
+
+ // try anything
+ if(m->args[0] == a_any && ((methfun_A)m->fun)(this,m->tag,argc,const_cast<t_atom *>(argv))) return true;
+ }
+
+ // try matching number of args
+ if(argc == m->argc && CallMeth(*m,argc,argv)) return true;
+ }
+ }
+ } while((m = (const methitem *)m->nxt) != NULL);
+ return false;
+}
+
+bool flext_base::TryMethSym(const methitem *m,int inlet,const t_symbol *t,const t_symbol *s)
+{
+ do {
+ if(!m->IsAttr() && m->inlet == inlet && m->tag == t) {
+ LOG3("found symbol method for %s: inlet=%i, symbol=%s",GetString(m->tag),m->inlet,GetString(s));
+
+ t_any sym; sym.st = const_cast<t_symbol *>(s);
+ if(((methfun_1)m->fun)(this,sym)) return true;
+ }
+ } while((m = (const methitem *)m->nxt) != NULL);
+ return false;
+}
+
+bool flext_base::TryMethAny(const methitem *m,int inlet,const t_symbol *t,const t_symbol *s,int argc,const t_atom *argv)
+{
+ do {
+ if(!m->IsAttr() && m->inlet == inlet && m->tag == t) {
+ 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;
+ }
+ } while((m = (const methitem *)m->nxt) != NULL);
+ return false;
+}
+
+bool flext_base::FindMeth(int inlet,const t_symbol *s,int argc,const t_atom *argv)
+{
+ methitem *m;
+
+ // search for exactly matching tag
+ if((m = (methitem *)methhead->Find(s,inlet)) != NULL && TryMethTag(m,inlet,s,argc,argv)) return true;
+ if((m = (methitem *)clmethhead->Find(s,inlet)) != NULL && TryMethTag(m,inlet,s,argc,argv)) return true;
+
+ // if no list args, then search for pure symbol
+ if(!argc) {
+ if((m = (methitem *)methhead->Find(sym_symbol,inlet)) != NULL && TryMethSym(m,inlet,sym_symbol,s)) return true;
+ if((m = (methitem *)clmethhead->Find(sym_symbol,inlet)) != NULL && TryMethSym(m,inlet,sym_symbol,s)) return true;
+ }
+
+ // otherwise search for anything
+ if((m = (methitem *)methhead->Find(sym_anything,inlet)) != NULL && m->argc == 1 && m->args[0] == a_any && TryMethAny(m,inlet,sym_anything,s,argc,argv)) return true;
+ if((m = (methitem *)clmethhead->Find(sym_anything,inlet)) != NULL && m->argc == 1 && m->args[0] == a_any && TryMethAny(m,inlet,sym_anything,s,argc,argv)) return true;
+
+ // if nothing found try any inlet
+ return inlet >= 0 && FindMeth(-1,s,argc,argv);
+}
+
+/*! \brief All the message processing
+ The messages of all the inlets go here and are promoted to the registered callback functions
+*/
+bool flext_base::m_methodmain(int inlet,const t_symbol *s,int argc,const t_atom *argv)
+{
+ static bool trap = false;
+
+ curtag = s;
+
+ LOG3("methodmain inlet:%i args:%i symbol:%s",inlet,argc,s?GetString(s):"");
+
+ bool ret = FindMeth(inlet,s,argc,argv);
+ if(ret) goto end;
+
+#if FLEXT_SYS == FLEXT_SYS_MAX
+ // If float message is not explicitly handled: try int handler instead
+ if(argc == 1 && s == sym_float && !trap) {
+ t_atom fl;
+ SetInt(fl,GetAInt(argv[0]));
+ trap = true;
+ ret = m_methodmain(inlet,sym_int,1,&fl);
+ trap = false;
+ }
+ if(ret) goto end;
+
+ // If int message is not explicitly handled: try float handler instead
+ if(argc == 1 && s == sym_int && !trap) {
+ t_atom fl;
+ SetFloat(fl,GetAFloat(argv[0]));
+ trap = true;
+ ret = m_methodmain(inlet,sym_float,1,&fl);
+ trap = false;
+ }
+ if(ret) goto end;
+#endif
+
+ // If float or int message is not explicitly handled: try list handler instead
+ if(!trap && argc == 1 && (s == sym_float
+#if FLEXT_SYS == FLEXT_SYS_MAX
+ || s == sym_int
+#endif
+ )) {
+ t_atom list;
+ if(s == sym_float)
+ SetFloat(list,GetFloat(argv[0]));
+#if FLEXT_SYS == FLEXT_SYS_MAX
+ else if(s == sym_int)
+ SetInt(list,GetInt(argv[0]));
+#endif
+
+ trap = true;
+ ret = m_methodmain(inlet,sym_list,1,&list);
+ trap = false;
+ }
+ if(ret) goto end;
+
+ // If symbol message (pure anything without args) is not explicitly handled: try list handler instead
+ if(!trap && argc == 0) {
+ t_atom list;
+ SetSymbol(list,s);
+ trap = true;
+ ret = m_methodmain(inlet,sym_list,1,&list);
+ trap = false;
+ }
+ if(ret) goto end;
+
+ // if distmsgs is switched on then distribute list elements over inlets (Max/MSP behavior)
+ if(distmsgs && !trap && inlet == 0 && s == sym_list && insigs <= 1) {
+ 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
+ else if(IsPointer(argv[i])) sym = sym_pointer; // can pointer atoms occur here?
+#endif
+ if(sym) {
+ trap = true;
+ m_methodmain(i,sym,1,argv+i);
+ trap = false;
+ }
+ }
+
+ ret = true;
+ }
+
+ if(!ret && !trap) ret = m_method_(inlet,s,argc,argv);
+
+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)
+{
+//#ifdef FLEXT_DEBUG
+ post("%s: message unhandled - inlet:%i args:%i symbol:%s",thisName(),inlet,argc,s?GetString(s):"");
+//#endif
+ return false;
+}
+
diff --git a/externals/grill/flext/source/flout.cpp b/externals/grill/flext/source/flout.cpp
index 9dbda7f1..e8341e9e 100644
--- a/externals/grill/flext/source/flout.cpp
+++ b/externals/grill/flext/source/flout.cpp
@@ -16,14 +16,6 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include "flinternal.h"
-#if FLEXT_SYS == FLEXT_SYS_MAX
-#define CRITON() short state = lockout_set(1)
-#define CRITOFF() lockout_set(state)
-#else
-#define CRITON()
-#define CRITOFF()
-#endif
-
#ifndef FLEXT_THREADS
void flext_base::ToOutBang(outlet *o) const { CRITON(); outlet_bang((t_outlet *)o); CRITOFF(); }
void flext_base::ToOutFloat(outlet *o,float f) const { CRITON(); outlet_float((t_outlet *)o,f); CRITOFF(); }
@@ -41,153 +33,242 @@ void flext_base::ToOutAnything(outlet *o,const t_symbol *s,int argc,const t_atom
#endif
-class flext_base::qmsg
+bool flext_base::InitInlets()
{
-public:
- qmsg(): nxt(NULL),tp(tp_none) {}
- ~qmsg();
-
- qmsg *nxt;
-
- void Clear();
-
- void SetBang(outlet *o) { Clear(); out = o; tp = tp_bang; }
- void SetFloat(outlet *o,float f) { Clear(); out = o; tp = tp_float; _float = f; }
- void SetInt(outlet *o,int i) { Clear(); out = o; tp = tp_int; _int = i; }
- void SetSymbol(outlet *o,const t_symbol *s) { Clear(); out = o; tp = tp_sym; _sym = s; }
- void SetList(outlet *o,int argc,const t_atom *argv) { Clear(); out = o; tp = tp_list; _list.argc = argc,_list.argv = CopyList(argc,argv); }
- void SetAny(outlet *o,const t_symbol *s,int argc,const t_atom *argv) { Clear(); out = o; tp = tp_any; _any.s = s,_any.argc = argc,_any.argv = CopyList(argc,argv); }
-
- outlet *out;
- enum { tp_none,tp_bang,tp_float,tp_int,tp_sym,tp_list,tp_any } tp;
- union {
- float _float;
- int _int;
- const t_symbol *_sym;
- struct { int argc; t_atom *argv; } _list;
- struct { const t_symbol *s; int argc; t_atom *argv; } _any;
- };
-};
-
-flext_base::qmsg::~qmsg()
-{
- Clear();
- if(nxt) delete nxt;
-}
+ bool ok = true;
+
+ // ----------------------------------
+ // create inlets
+ // ----------------------------------
+
+ incnt = insigs = 0;
+
+ if(inlist) {
+ xlet *xi;
+ incnt = 0;
+ for(xi = inlist; xi; xi = xi->nxt) ++incnt;
+ xlet::type *list = new xlet::type[incnt];
+ int i;
+ for(xi = inlist,i = 0; xi; xi = xi->nxt,++i) list[i] = xi->tp;
+ delete inlist; inlist = NULL;
+
+ inlets = new px_object *[incnt];
+ for(i = 0; i < incnt; ++i) inlets[i] = NULL;
+
+ // type info is now in list array
+#if FLEXT_SYS == FLEXT_SYS_PD
+ {
+ int cnt = 0;
+
+ if(incnt >= 1) {
+ switch(list[0]) {
+ case xlet::tp_sig:
+ CLASS_MAINSIGNALIN(thisClass(),flext_hdr,defsig);
+ ++insigs;
+ break;
+ default:
+ // leftmost inlet is already there...
+ break;
+ }
+ ++cnt;
+ }
+
+ for(int ix = 1; ix < incnt; ++ix,++cnt) {
+ switch(list[ix]) {
+ case xlet::tp_float:
+ case xlet::tp_int: {
+ char sym[] = "ft??";
+ if(ix >= 10) {
+ if(compatibility) {
+ // Max allows max. 9 inlets
+ post("%s: Only 9 float/int inlets allowed in compatibility mode",thisName());
+ ok = false;
+ }
+ else {
+ if(ix > 99)
+ post("%s: Inlet index > 99 not allowed for float/int inlets",thisName());
+ sym[2] = '0'+ix/10,sym[3] = '0'+ix%10;
+ }
+ }
+ else
+ sym[2] = '0'+ix,sym[3] = 0;
+ if(ok) inlet_new(&x_obj->obj, &x_obj->obj.ob_pd, &s_float, gensym(sym));
+ break;
+ }
+ case xlet::tp_sym:
+ (inlets[ix] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages
+ inlet_new(&x_obj->obj,&inlets[ix]->obj.ob_pd, &s_symbol, &s_symbol);
+ break;
+ case xlet::tp_list:
+ (inlets[ix] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages
+ inlet_new(&x_obj->obj,&inlets[ix]->obj.ob_pd, &s_list, &s_list);
+ break;
+ case xlet::tp_any:
+ (inlets[ix] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages
+ inlet_new(&x_obj->obj,&inlets[ix]->obj.ob_pd, 0, 0);
+ break;
+ case xlet::tp_sig:
+ if(compatibility && list[ix-1] != xlet::tp_sig) {
+ post("%s: All signal inlets must be left-aligned in compatibility mode",thisName());
+ ok = false;
+ }
+ else {
+ // pd doesn't seem to be able to handle signals and messages into the same inlet...
+
+ inlet_new(&x_obj->obj, &x_obj->obj.ob_pd, &s_signal, &s_signal);
+ ++insigs;
+ }
+ break;
+ default:
+ error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)list[ix]);
+ ok = false;
+ }
+ }
+
+ incnt = cnt;
+ }
+#elif FLEXT_SYS == FLEXT_SYS_MAX
+ {
+ int ix,cnt;
+ // count leftmost signal inlets
+ while(insigs < incnt && list[insigs] == xlet::tp_sig) ++insigs;
+
+ for(cnt = 0,ix = incnt-1; ix >= insigs; --ix,++cnt) {
+ if(ix == 0) {
+ if(list[ix] != xlet::tp_any) {
+ error("%s: Leftmost inlet must be of type signal or default",thisName());
+ ok = false;
+ }
+ }
+ else {
+ switch(list[ix]) {
+ case xlet::tp_sig:
+ error("%s: All signal inlets must be at the left side",thisName());
+ ok = false;
+ break;
+ case xlet::tp_float:
+ if(ix >= 10) {
+ post("%s: Only 9 float inlets possible",thisName());
+ ok = false;
+ }
+ else
+ floatin(x_obj,ix);
+ break;
+ case xlet::tp_int:
+ if(ix >= 10) {
+ post("%s: Only 9 int inlets possible",thisName());
+ ok = false;
+ }
+ else
+ intin(x_obj,ix);
+ break;
+ case xlet::tp_any: // non-leftmost
+ case xlet::tp_sym:
+ case xlet::tp_list:
+ inlets[ix] = (px_object *)proxy_new(x_obj,ix,&((flext_hdr *)x_obj)->curinlet);
+ break;
+ default:
+ error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)list[ix]);
+ ok = false;
+ }
+ }
+ }
+
+ incnt = cnt;
+
+ if(insigs)
+// dsp_setup(thisHdr(),insigs); // signal inlets
+ dsp_setupbox(thisHdr(),insigs); // signal inlets
+ }
+#else
+#error
+#endif
+
+ delete[] list;
+ }
-void flext_base::qmsg::Clear()
-{
- if(tp == tp_list) { if(_list.argv) delete[] _list.argv; }
- else if(tp == tp_any) { if(_any.argv) delete[] _any.argv; }
- tp = tp_none;
+ return ok;
}
-void flext_base::QTick(flext_base *th)
+bool flext_base::InitOutlets()
{
-// post("qtick");
-#if defined(FLEXT_THREADS) && defined(FLEXT_DEBUG)
- if(!th->IsSystemThread()) {
- error("flext - Queue tick called by wrong thread!");
- return;
- }
-#endif
-
-#ifdef FLEXT_THREADS
- th->qmutex.Lock();
-#endif
- for(;;) {
- qmsg *m = th->qhead;
- if(!m) break;
-
- CRITON();
-
- switch(m->tp) {
- case qmsg::tp_bang: th->ToOutBang(m->out); break;
- case qmsg::tp_float: th->ToOutFloat(m->out,m->_float); break;
- case qmsg::tp_int: th->ToOutInt(m->out,m->_int); break;
- case qmsg::tp_sym: th->ToOutSymbol(m->out,m->_sym); break;
- case qmsg::tp_list: th->ToOutList(m->out,m->_list.argc,m->_list.argv); break;
- case qmsg::tp_any: th->ToOutAnything(m->out,m->_any.s,m->_any.argc,m->_any.argv); break;
-#ifdef FLEXT_DEBUG
- default: ERRINTERNAL();
-#endif
- }
+ bool ok = true;
- CRITOFF();
+ // ----------------------------------
+ // create outlets
+ // ----------------------------------
- th->qhead = m->nxt;
- if(!th->qhead) th->qtail = NULL;
- m->nxt = NULL;
- delete m;
- }
-#ifdef FLEXT_THREADS
- th->qmutex.Unlock();
+ outcnt = outsigs = 0;
+
+#if FLEXT_SYS == FLEXT_SYS_MAX
+ // for Max/MSP the rightmost outlet has to be created first
+ if(procattr)
+ outattr = (outlet *)newout_anything(&x_obj->obj);
#endif
-}
-void flext_base::Queue(qmsg *m)
-{
-// post("Queue");
+ if(outlist) {
+ xlet *xi;
-#ifdef FLEXT_THREADS
- qmutex.Lock();
-#endif
- if(qtail) qtail->nxt = m;
- else qhead = m;
- qtail = m;
-#ifdef FLEXT_THREADS
- qmutex.Unlock();
-#endif
+ // count outlets
+ outcnt = 0;
+ for(xi = outlist; xi; xi = xi->nxt) ++outcnt;
+
+ xlet::type *list = new xlet::type[outcnt];
+ int i;
+ for(xi = outlist,i = 0; xi; xi = xi->nxt,++i) list[i] = xi->tp;
+ delete outlist; outlist = NULL;
+
+ outlets = new outlet *[outcnt];
+ // type info is now in list array
#if FLEXT_SYS == FLEXT_SYS_PD
- clock_delay(qclk,0);
+ for(int ix = 0; ix < outcnt; ++ix)
#elif FLEXT_SYS == FLEXT_SYS_MAX
- qelem_set(qclk);
+ for(int ix = outcnt-1; ix >= 0; --ix)
#else
-#error
+#error
#endif
+ {
+ switch(list[ix]) {
+ case xlet::tp_float:
+ outlets[ix] = (outlet *)newout_float(&x_obj->obj);
+ break;
+ case xlet::tp_int:
+ outlets[ix] = (outlet *)newout_flint(&x_obj->obj);
+ break;
+ case xlet::tp_sig:
+ outlets[ix] = (outlet *)newout_signal(&x_obj->obj);
+ ++outsigs;
+ break;
+ case xlet::tp_sym:
+ outlets[ix] = (outlet *)newout_symbol(&x_obj->obj);
+ break;
+ case xlet::tp_list:
+ outlets[ix] = (outlet *)newout_list(&x_obj->obj);
+ break;
+ case xlet::tp_any:
+ outlets[ix] = (outlet *)newout_anything(&x_obj->obj);
+ break;
+#ifdef FLEXT_DEBUG
+ default:
+ ERRINTERNAL();
+ ok = false;
+#endif
+ }
+ }
+
+ delete[] list;
+ }
-}
-
-void flext_base::ToQueueBang(outlet *o) const
-{
- qmsg *m = new qmsg();
- m->SetBang(o);
- const_cast<flext_base &>(*this).Queue(m);
-}
-
-void flext_base::ToQueueFloat(outlet *o,float f) const
-{
- qmsg *m = new qmsg;
- m->SetFloat(o,f);
- const_cast<flext_base &>(*this).Queue(m);
-}
-
-void flext_base::ToQueueInt(outlet *o,int f) const
-{
- qmsg *m = new qmsg;
- m->SetInt(o,f);
- const_cast<flext_base &>(*this).Queue(m);
-}
-
-void flext_base::ToQueueSymbol(outlet *o,const t_symbol *s) const
-{
- qmsg *m = new qmsg;
- m->SetSymbol(o,s);
- const_cast<flext_base &>(*this).Queue(m);
-}
+ if(procattr) {
+#if FLEXT_SYS == FLEXT_SYS_PD
+ // attribute dump outlet is the last one
+ outattr = (outlet *)newout_anything(&x_obj->obj);
+#endif
-void flext_base::ToQueueList(outlet *o,int argc,const t_atom *argv) const
-{
- qmsg *m = new qmsg;
- m->SetList(o,argc,argv);
- const_cast<flext_base &>(*this).Queue(m);
+ }
+
+ return ok;
}
-void flext_base::ToQueueAnything(outlet *o,const t_symbol *s,int argc,const t_atom *argv) const
-{
- qmsg *m = new qmsg;
- m->SetAny(o,s,argc,argv);
- const_cast<flext_base &>(*this).Queue(m);
-}
diff --git a/externals/grill/flext/source/flproxy.cpp b/externals/grill/flext/source/flproxy.cpp
new file mode 100755
index 00000000..c1a6930c
--- /dev/null
+++ b/externals/grill/flext/source/flproxy.cpp
@@ -0,0 +1,132 @@
+/*
+
+flext - C++ layer for Max/MSP and pd (pure data) externals
+
+Copyright (c) 2001,2002 Thomas Grill (xovo@gmx.net)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+
+*/
+
+/*! \file 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_method(px_object *obj,const t_symbol *s,int argc,t_atom *argv)
+{
+ obj->base->m_methodmain(obj->index,s,argc,argv);
+}
+
+void flext_base::cb_px_anything(t_class *c,const t_symbol *s,int argc,t_atom *argv)
+{
+ thisObject(c)->m_methodmain(0,s,argc,argv);
+}
+
+#define DEF_IN_FT(IX) \
+void flext_base::cb_px_ft ## IX(t_class *c,float v) { \
+ t_atom atom; SETFLOAT(&atom,v); \
+ thisObject(c)->m_methodmain(IX,&s_float,1,&atom); \
+}
+
+#define ADD_IN_FT(IX) \
+add_method1(c,cb_px_ft ## IX,"ft" #IX,A_FLOAT)
+
+#elif FLEXT_SYS == FLEXT_SYS_MAX
+
+void flext_base::cb_px_anything(t_class *c,const t_symbol *s,int argc,t_atom *argv)
+{
+ // check if inlet allows anything (or list)
+
+ flext_base *o = thisObject(c);
+ int ci = ((flext_hdr *)o->x_obj)->curinlet;
+
+ o->m_methodmain(ci,s,argc,argv);
+}
+
+void flext_base::cb_px_int(t_class *c,int v)
+{
+ // check if inlet allows int type
+ t_atom atom;
+ SetInt(atom,v);
+ cb_px_anything(c,sym_int,1,&atom);
+}
+
+void flext_base::cb_px_float(t_class *c,float v)
+{
+ // check if inlet allows float type
+ t_atom atom;
+ SetFloat(atom,v);
+ cb_px_anything(c,sym_float,1,&atom);
+}
+
+void flext_base::cb_px_bang(t_class *c)
+{
+ // check if inlet allows bang
+ cb_px_anything(c,sym_bang,0,NULL);
+}
+
+
+#define DEF_IN_FT(IX) \
+void flext_base::cb_px_in ## IX(t_class *c,int v) { long &ci = ((flext_hdr *)thisObject(c)->x_obj)->curinlet; ci = IX; cb_px_int(c,v); ci = 0; } \
+void flext_base::cb_px_ft ## IX(t_class *c,float v) { long &ci = ((flext_hdr *)thisObject(c)->x_obj)->curinlet; ci = IX; cb_px_float(c,v); ci = 0; }
+
+#define ADD_IN_FT(IX) \
+add_method1(c,cb_px_in ## IX,"in" #IX,A_INT); \
+add_method1(c,cb_px_ft ## IX,"ft" #IX,A_FLOAT)
+
+#else
+#error // Other system
+#endif
+
+
+DEF_IN_FT(1)
+DEF_IN_FT(2)
+DEF_IN_FT(3)
+DEF_IN_FT(4)
+DEF_IN_FT(5)
+DEF_IN_FT(6)
+DEF_IN_FT(7)
+DEF_IN_FT(8)
+DEF_IN_FT(9)
+
+
+void flext_base::SetProxies(t_class *c)
+{
+ // proxy for extra inlets
+#if FLEXT_SYS == FLEXT_SYS_PD
+ add_anything(c,cb_px_anything); // for leftmost inlet
+ px_class = class_new(gensym("flext_base proxy"),NULL,NULL,sizeof(px_object),CLASS_PD|CLASS_NOINLET, A_NULL);
+ add_anything(px_class,px_object::px_method); // for other inlets
+#elif FLEXT_SYS == FLEXT_SYS_MAX
+ add_bang(c,cb_px_bang);
+ add_method1(c,cb_px_int,"int",A_INT);
+ add_method1(c,cb_px_float,"float",A_FLOAT);
+ add_methodG(c,cb_px_anything,"list");
+ add_anything(c,cb_px_anything);
+#else
+#error
+#endif
+
+ // setup non-leftmost ints and floats
+ ADD_IN_FT(1);
+ ADD_IN_FT(2);
+ ADD_IN_FT(3);
+ ADD_IN_FT(4);
+ ADD_IN_FT(5);
+ ADD_IN_FT(6);
+ ADD_IN_FT(7);
+ ADD_IN_FT(8);
+ ADD_IN_FT(9);
+}
+
+
diff --git a/externals/grill/flext/source/flqueue.cpp b/externals/grill/flext/source/flqueue.cpp
new file mode 100755
index 00000000..537101bc
--- /dev/null
+++ b/externals/grill/flext/source/flqueue.cpp
@@ -0,0 +1,167 @@
+/*
+
+flext - C++ layer for Max/MSP and pd (pure data) externals
+
+Copyright (c) 2001,2002 Thomas Grill (xovo@gmx.net)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+
+*/
+
+/*! \file flqueue.cpp
+ \brief Implementation of the flext message queuing functionality.
+*/
+
+#include "flext.h"
+#include "flinternal.h"
+
+class flext_base::qmsg
+{
+public:
+ qmsg(): nxt(NULL),tp(tp_none) {}
+ ~qmsg();
+
+ qmsg *nxt;
+
+ void Clear();
+
+ void SetBang(outlet *o) { Clear(); out = o; tp = tp_bang; }
+ void SetFloat(outlet *o,float f) { Clear(); out = o; tp = tp_float; _float = f; }
+ void SetInt(outlet *o,int i) { Clear(); out = o; tp = tp_int; _int = i; }
+ void SetSymbol(outlet *o,const t_symbol *s) { Clear(); out = o; tp = tp_sym; _sym = s; }
+ void SetList(outlet *o,int argc,const t_atom *argv) { Clear(); out = o; tp = tp_list; _list.argc = argc,_list.argv = CopyList(argc,argv); }
+ void SetAny(outlet *o,const t_symbol *s,int argc,const t_atom *argv) { Clear(); out = o; tp = tp_any; _any.s = s,_any.argc = argc,_any.argv = CopyList(argc,argv); }
+
+ outlet *out;
+ enum { tp_none,tp_bang,tp_float,tp_int,tp_sym,tp_list,tp_any } tp;
+ union {
+ float _float;
+ int _int;
+ const t_symbol *_sym;
+ struct { int argc; t_atom *argv; } _list;
+ struct { const t_symbol *s; int argc; t_atom *argv; } _any;
+ };
+};
+
+flext_base::qmsg::~qmsg()
+{
+ Clear();
+ if(nxt) delete nxt;
+}
+
+void flext_base::qmsg::Clear()
+{
+ if(tp == tp_list) { if(_list.argv) delete[] _list.argv; }
+ else if(tp == tp_any) { if(_any.argv) delete[] _any.argv; }
+ tp = tp_none;
+}
+
+void flext_base::QTick(flext_base *th)
+{
+// post("qtick");
+#if defined(FLEXT_THREADS) && defined(FLEXT_DEBUG)
+ if(!th->IsSystemThread()) {
+ error("flext - Queue tick called by wrong thread!");
+ return;
+ }
+#endif
+
+#ifdef FLEXT_THREADS
+ th->qmutex.Lock();
+#endif
+ for(;;) {
+ qmsg *m = th->qhead;
+ if(!m) break;
+
+ CRITON();
+
+ switch(m->tp) {
+ case qmsg::tp_bang: th->ToOutBang(m->out); break;
+ case qmsg::tp_float: th->ToOutFloat(m->out,m->_float); break;
+ case qmsg::tp_int: th->ToOutInt(m->out,m->_int); break;
+ case qmsg::tp_sym: th->ToOutSymbol(m->out,m->_sym); break;
+ case qmsg::tp_list: th->ToOutList(m->out,m->_list.argc,m->_list.argv); break;
+ case qmsg::tp_any: th->ToOutAnything(m->out,m->_any.s,m->_any.argc,m->_any.argv); break;
+#ifdef FLEXT_DEBUG
+ default: ERRINTERNAL();
+#endif
+ }
+
+ CRITOFF();
+
+ th->qhead = m->nxt;
+ if(!th->qhead) th->qtail = NULL;
+ m->nxt = NULL;
+ delete m;
+ }
+#ifdef FLEXT_THREADS
+ th->qmutex.Unlock();
+#endif
+}
+
+void flext_base::Queue(qmsg *m)
+{
+// post("Queue");
+
+#ifdef FLEXT_THREADS
+ qmutex.Lock();
+#endif
+ if(qtail) qtail->nxt = m;
+ else qhead = m;
+ qtail = m;
+#ifdef FLEXT_THREADS
+ qmutex.Unlock();
+#endif
+
+#if FLEXT_SYS == FLEXT_SYS_PD
+ clock_delay(qclk,0);
+#elif FLEXT_SYS == FLEXT_SYS_MAX
+ qelem_set(qclk);
+#else
+#error
+#endif
+
+}
+
+void flext_base::ToQueueBang(outlet *o) const
+{
+ qmsg *m = new qmsg();
+ m->SetBang(o);
+ const_cast<flext_base &>(*this).Queue(m);
+}
+
+void flext_base::ToQueueFloat(outlet *o,float f) const
+{
+ qmsg *m = new qmsg;
+ m->SetFloat(o,f);
+ const_cast<flext_base &>(*this).Queue(m);
+}
+
+void flext_base::ToQueueInt(outlet *o,int f) const
+{
+ qmsg *m = new qmsg;
+ m->SetInt(o,f);
+ const_cast<flext_base &>(*this).Queue(m);
+}
+
+void flext_base::ToQueueSymbol(outlet *o,const t_symbol *s) const
+{
+ qmsg *m = new qmsg;
+ m->SetSymbol(o,s);
+ const_cast<flext_base &>(*this).Queue(m);
+}
+
+void flext_base::ToQueueList(outlet *o,int argc,const t_atom *argv) const
+{
+ qmsg *m = new qmsg;
+ m->SetList(o,argc,argv);
+ const_cast<flext_base &>(*this).Queue(m);
+}
+
+void flext_base::ToQueueAnything(outlet *o,const t_symbol *s,int argc,const t_atom *argv) const
+{
+ qmsg *m = new qmsg;
+ m->SetAny(o,s,argc,argv);
+ const_cast<flext_base &>(*this).Queue(m);
+}
+
diff --git a/externals/grill/flext/source/flsupport.cpp b/externals/grill/flext/source/flsupport.cpp
index 85ebae79..cd57dfd8 100644
--- a/externals/grill/flext/source/flsupport.cpp
+++ b/externals/grill/flext/source/flsupport.cpp
@@ -58,3 +58,21 @@ void flext::GetAString(const t_atom &a,char *buf,int szbuf)
else if(IsInt(a)) sprintf(buf,"%i",GetInt(a));
#endif
}
+
+int flext::FoldBits(unsigned long h,int bits)
+{
+ if(!bits) return 0;
+ const int hmax = (1<<bits)-1;
+ int ret = 0;
+ for(int i = 0; i < sizeof(h)*8; i += bits)
+ ret = ret^((h>>i)&hmax);
+ return ret;
+}
+
+int flext::Int2Bits(unsigned long n)
+{
+ int b;
+ for(b = 0; n; ++b) n >>= 1;
+ return b;
+}
+
diff --git a/externals/grill/flext/source/flsupport.h b/externals/grill/flext/source/flsupport.h
index ad7158f9..6eef5bd5 100644
--- a/externals/grill/flext/source/flsupport.h
+++ b/externals/grill/flext/source/flsupport.h
@@ -373,6 +373,24 @@ public:
//! @} FLEXT_S_ATOM
+
+// --- utilities ------------------------------------------------
+
+ /*! \defgroup FLEXT_S_UTIL Flext utility functions
+ @{
+ */
+
+ /*! \brief Fold value to a number of bits
+ \remark Good for hash generation
+ */
+ static int FoldBits(unsigned long h,int bits);
+
+ //! \brief How many bits are necessary to represent n
+ static int Int2Bits(unsigned long n);
+
+//! @} FLEXT_S_UTIL
+
+
// --- clock stuff ------------------------------------------------
diff --git a/externals/grill/flext/source/flthr.cpp b/externals/grill/flext/source/flthr.cpp
index e8834b76..a9a68471 100644
--- a/externals/grill/flext/source/flthr.cpp
+++ b/externals/grill/flext/source/flthr.cpp
@@ -20,10 +20,10 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include <errno.h>
//! Thread id of system thread
-flext::thrid_t flext::thrid;
+flext::thrid_t flext::thrid = 0;
//! Thread id of helper thread
-flext::thrid_t flext::thrhelpid;
+flext::thrid_t flext::thrhelpid = 0;
/*
flext::thr_entry *flext::thrhead = NULL,*flext::thrtail = NULL;
@@ -42,6 +42,8 @@ static flext::ThrCond *thrhelpcond = NULL;
//! Start helper thread
bool flext::StartHelper()
{
+ if(thrhelpid) return true;
+
bool ok = false;
#if FLEXT_THREADS == FLEXT_THR_POSIX
pthread_attr_t attr;
diff --git a/externals/grill/idelay/delay.cpp b/externals/grill/idelay/delay.cpp
index b126ebce..a922a8f8 100644
--- a/externals/grill/idelay/delay.cpp
+++ b/externals/grill/idelay/delay.cpp
@@ -16,8 +16,8 @@ Watch out for Doppler effects!
#include <flext.h>
-#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 400)
-#error You need at least flext version 0.4.0
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 401)
+#error You need at least flext version 0.4.1
#endif
// template class for delay line
@@ -51,7 +51,6 @@ idelay::idelay(F maxmsec)
AddInSignal(2); // audio in & delay signals
AddOutSignal(); // audio out
- SetupInOut(); // set up inlets and outlets
}
idelay::~idelay()
diff --git a/externals/grill/pool/main.cpp b/externals/grill/pool/main.cpp
index 57773742..07d96e20 100644
--- a/externals/grill/pool/main.cpp
+++ b/externals/grill/pool/main.cpp
@@ -172,13 +172,61 @@ FLEXT_NEW_V("pool",pool);
pooldata *pool::head,*pool::tail;
-V pool::setup(t_class *)
+V pool::setup(t_class *c)
{
post("");
post("pool %s - hierarchical storage object, (C)2002 Thomas Grill",POOL_VERSION);
post("");
head = tail = NULL;
+
+ FLEXT_CADDATTR_VAR(c,"pool",mg_pool,ms_pool);
+ FLEXT_CADDATTR_VAR1(c,"absdir",absdir);
+ FLEXT_CADDATTR_VAR1(c,"echodir",echo);
+ FLEXT_CADDATTR_GET(c,"private",priv);
+
+ FLEXT_CADDMETHOD_(c,0,"reset",m_reset);
+ FLEXT_CADDMETHOD_(c,0,"set",m_set);
+ FLEXT_CADDMETHOD_(c,0,"add",m_add);
+ FLEXT_CADDMETHOD_(c,0,"getdir",m_getdir);
+ FLEXT_CADDMETHOD_(c,0,"mkdir",m_mkdir);
+ FLEXT_CADDMETHOD_(c,0,"chdir",m_chdir);
+ FLEXT_CADDMETHOD_(c,0,"rmdir",m_rmdir);
+ FLEXT_CADDMETHOD_(c,0,"updir",m_updir);
+ FLEXT_CADDMETHOD_(c,0,"mksub",m_mksub);
+ FLEXT_CADDMETHOD_(c,0,"chsub",m_chsub);
+ FLEXT_CADDMETHOD_(c,0,"rmsub",m_rmsub);
+
+ FLEXT_CADDMETHOD_(c,0,"set",m_set);
+ FLEXT_CADDMETHOD_(c,0,"clr",m_clr);
+ FLEXT_CADDMETHOD_(c,0,"clrall",m_clrall);
+ FLEXT_CADDMETHOD_(c,0,"clrrec",m_clrrec);
+ FLEXT_CADDMETHOD_(c,0,"clrsub",m_clrsub);
+ FLEXT_CADDMETHOD_(c,0,"get",m_get);
+ FLEXT_CADDMETHOD_(c,0,"geti",m_geti);
+ FLEXT_CADDMETHOD_(c,0,"getall",m_getall);
+ FLEXT_CADDMETHOD_(c,0,"getrec",m_getrec);
+ FLEXT_CADDMETHOD_(c,0,"getsub",m_getsub);
+ FLEXT_CADDMETHOD_(c,0,"cntall",m_cntall);
+ FLEXT_CADDMETHOD_(c,0,"cntrec",m_cntrec);
+ FLEXT_CADDMETHOD_(c,0,"cntsub",m_cntsub);
+
+ FLEXT_CADDMETHOD_(c,0,"paste",m_paste);
+ FLEXT_CADDMETHOD_(c,0,"pasteadd",m_pasteadd);
+ FLEXT_CADDMETHOD_(c,0,"clrclip",m_clrclip);
+ FLEXT_CADDMETHOD_(c,0,"cut",m_cut);
+ FLEXT_CADDMETHOD_(c,0,"copy",m_copy);
+ FLEXT_CADDMETHOD_(c,0,"cutall",m_cutall);
+ FLEXT_CADDMETHOD_(c,0,"copyall",m_copyall);
+ FLEXT_CADDMETHOD_(c,0,"cutrec",m_cutrec);
+ FLEXT_CADDMETHOD_(c,0,"copyrec",m_copyrec);
+
+ FLEXT_CADDMETHOD_(c,0,"load",m_load);
+ FLEXT_CADDMETHOD_(c,0,"save",m_save);
+ FLEXT_CADDMETHOD_(c,0,"lddir",m_lddir);
+ FLEXT_CADDMETHOD_(c,0,"ldrec",m_ldrec);
+ FLEXT_CADDMETHOD_(c,0,"svdir",m_svdir);
+ FLEXT_CADDMETHOD_(c,0,"svrec",m_svrec);
}
pool::pool(I argc,const A *argv):
@@ -192,54 +240,6 @@ pool::pool(I argc,const A *argv):
AddOutAnything();
AddOutList();
AddOutAnything();
-
- FLEXT_ADDATTR_VAR("pool",mg_pool,ms_pool);
- FLEXT_ADDATTR_VAR1("absdir",absdir);
- FLEXT_ADDATTR_VAR1("echodir",echo);
- FLEXT_ADDATTR_GET("private",priv);
-
- FLEXT_ADDMETHOD_(0,"reset",m_reset);
- FLEXT_ADDMETHOD_(0,"set",m_set);
- FLEXT_ADDMETHOD_(0,"add",m_add);
- FLEXT_ADDMETHOD_(0,"getdir",m_getdir);
- FLEXT_ADDMETHOD_(0,"mkdir",m_mkdir);
- FLEXT_ADDMETHOD_(0,"chdir",m_chdir);
- FLEXT_ADDMETHOD_(0,"rmdir",m_rmdir);
- FLEXT_ADDMETHOD_(0,"updir",m_updir);
- FLEXT_ADDMETHOD_(0,"mksub",m_mksub);
- FLEXT_ADDMETHOD_(0,"chsub",m_chsub);
- FLEXT_ADDMETHOD_(0,"rmsub",m_rmsub);
-
- FLEXT_ADDMETHOD_(0,"set",m_set);
- FLEXT_ADDMETHOD_(0,"clr",m_clr);
- FLEXT_ADDMETHOD_(0,"clrall",m_clrall);
- FLEXT_ADDMETHOD_(0,"clrrec",m_clrrec);
- FLEXT_ADDMETHOD_(0,"clrsub",m_clrsub);
- FLEXT_ADDMETHOD_(0,"get",m_get);
- FLEXT_ADDMETHOD_(0,"geti",m_geti);
- FLEXT_ADDMETHOD_(0,"getall",m_getall);
- FLEXT_ADDMETHOD_(0,"getrec",m_getrec);
- FLEXT_ADDMETHOD_(0,"getsub",m_getsub);
- FLEXT_ADDMETHOD_(0,"cntall",m_cntall);
- FLEXT_ADDMETHOD_(0,"cntrec",m_cntrec);
- FLEXT_ADDMETHOD_(0,"cntsub",m_cntsub);
-
- FLEXT_ADDMETHOD_(0,"paste",m_paste);
- FLEXT_ADDMETHOD_(0,"pasteadd",m_pasteadd);
- FLEXT_ADDMETHOD_(0,"clrclip",m_clrclip);
- FLEXT_ADDMETHOD_(0,"cut",m_cut);
- FLEXT_ADDMETHOD_(0,"copy",m_copy);
- FLEXT_ADDMETHOD_(0,"cutall",m_cutall);
- FLEXT_ADDMETHOD_(0,"copyall",m_copyall);
- FLEXT_ADDMETHOD_(0,"cutrec",m_cutrec);
- FLEXT_ADDMETHOD_(0,"copyrec",m_copyrec);
-
- FLEXT_ADDMETHOD_(0,"load",m_load);
- FLEXT_ADDMETHOD_(0,"save",m_save);
- FLEXT_ADDMETHOD_(0,"lddir",m_lddir);
- FLEXT_ADDMETHOD_(0,"ldrec",m_ldrec);
- FLEXT_ADDMETHOD_(0,"svdir",m_svdir);
- FLEXT_ADDMETHOD_(0,"svrec",m_svrec);
}
pool::~pool()
@@ -453,11 +453,14 @@ V pool::m_get(I argc,const A *argv)
ToOutList(2,curdir);
else
ToOutList(2,0,NULL);
- ToOutAtom(1,r->key);
- if(r)
+ if(r) {
+ ToOutAtom(1,r->key);
ToOutList(0,*r->data);
- else
+ }
+ else {
+ ToOutBang(1);
ToOutBang(0);
+ }
}
echodir();
diff --git a/externals/grill/pool/pool.cw b/externals/grill/pool/pool.cw
index 52435a6a..068876a4 100755
--- a/externals/grill/pool/pool.cw
+++ b/externals/grill/pool/pool.cw
Binary files differ
diff --git a/externals/grill/pool/pool.pd b/externals/grill/pool/pool.pd
index 0726e6f6..cdf0f6e6 100644
--- a/externals/grill/pool/pool.pd
+++ b/externals/grill/pool/pool.pd
@@ -1,201 +1,212 @@
-#N canvas 25 23 974 677 12;
-#X obj 260 478 pool;
-#X msg 295 108 set 1 2 3;
-#X obj 272 600 print K;
-#X msg 607 211 getall;
-#X msg 295 137 set A k g;
-#X obj 251 631 print V;
-#X obj 290 569 print D;
-#X msg 295 167 set A l m;
-#X msg 298 196 set 2 34;
-#X msg 297 227 set 3 17;
-#X msg 428 105 clr A;
-#X msg 432 181 get A;
-#X msg 432 213 get 2;
-#X msg 40 132 echodir \$1;
-#X obj 40 111 tgl 15 0 empty empty empty 0 -6 32 8 -262144 -1 -1 0
-1;
-#X obj 40 213 tgl 15 0 empty empty empty 0 -6 32 8 -262144 -1 -1 0
-1;
-#X msg 40 234 absdir \$1;
-#X text 427 85 clear value;
-#X text 428 159 get value;
-#X obj 309 542 print C;
-#X text 381 542 command;
-#X text 363 569 directory (abs or rel to current);
-#X text 326 632 data value;
-#X text 344 600 data key;
-#X msg 41 314 pool pool1;
-#X msg 42 343 pool;
-#X text 86 343 set to private;
-#X msg 42 405 reset;
-#X text 41 384 clear all pool data;
-#X msg 613 111 clrall;
-#X text 604 89 clear all values in dir;
-#X text 607 190 get all values in dir;
-#X text 314 479 pool name can be given as argument;
-#X text 603 136 clear all values and dirs;
-#X msg 611 158 clrrec;
-#X msg 605 258 getrec;
-#X text 605 236 get all values in dir and subdirs;
-#X text 670 289 bang at EOL;
-#X text 673 208 bang at EOL;
-#X text 670 257 depth may be given;
-#X text 43 291 set pool name;
-#X text 40 89 at each command;
-#X text 40 73 echo current dir;
-#X text 292 83 set values;
-#X text 35 194 (default on);
-#X text 27 178 report absolute dirs;
-#X msg 43 452 help;
-#X text 86 453 get some info;
-#X text 670 274 default=-1 (= infinite);
-#X msg 609 338 cntall;
-#X text 675 336 count all values in dir;
-#X msg 609 364 cntrec;
-#X text 677 362 ... and subdirs;
-#X text 673 376 (depth may be given);
-#X msg 296 282 add 3 14;
-#X text 294 261 set but don't replace;
-#N canvas 0 0 510 536 dirs 0;
-#X msg 109 27 mkdir fld1;
-#X msg 111 122 chdir;
-#X msg 110 217 updir;
-#X msg 111 354 getsub -1;
-#X text 110 7 make absolute dir;
-#X text 109 51 make relative dir;
-#X msg 110 72 mksub fld2;
-#X text 109 104 change to absolute dir;
-#X msg 110 165 chsub fld2;
-#X text 108 146 change to relative dir;
-#X text 106 198 change to upper dir;
-#X text 107 250 remove absolute dir;
-#X msg 108 269 rmdir fld1;
-#X msg 110 308 rmsub fld2;
-#X text 109 289 remove relative dir;
-#X text 109 336 get subdirs;
-#X text 251 380 -1 ... infinite;
-#X text 167 213 depth may be given;
-#X text 168 229 default=1;
-#X text 209 349 depth may be given;
-#X text 207 365 default=1;
-#X text 108 377 count subdirs;
-#X msg 111 398 cntsub -1;
-#X msg 111 458 getdir;
-#X text 110 438 get current dir;
-#X text 176 458 always absolute;
-#X obj 11 239 s \$0-pool;
-#X connect 0 0 26 0;
-#X connect 1 0 26 0;
-#X connect 2 0 26 0;
-#X connect 3 0 26 0;
-#X connect 6 0 26 0;
-#X connect 8 0 26 0;
-#X connect 12 0 26 0;
-#X connect 13 0 26 0;
-#X connect 22 0 26 0;
-#X connect 23 0 26 0;
-#X restore 718 511 pd dirs;
-#X text 715 485 directory operations;
-#N canvas 0 0 469 436 file 0;
-#X text 117 207 save dir and subdirs;
-#X text 117 165 save data in current dir;
-#X msg 117 184 svdir c:/temp/pool.dat;
-#X msg 117 226 svrec c:/temp/pool.dat;
-#X msg 116 272 lddir c:/temp/pool.dat;
-#X msg 116 319 ldrec c:/temp/pool.dat;
-#X text 117 253 load data into current dir;
-#X text 115 300 load data into current dir and below;
-#X text 132 340 depth (default -1) and;
-#X text 134 356 mkdir flag (default 1) can be given;
-#X text 117 37 save all;
-#X text 117 81 load all (add to existing data);
-#X msg 118 100 load c:/temp/pool.dat;
-#X msg 120 54 save c:/temp/pool.dat;
-#X text 22 12 file operations;
-#X obj 22 188 s \$0-pool;
-#X connect 2 0 15 0;
-#X connect 3 0 15 0;
-#X connect 4 0 15 0;
-#X connect 5 0 15 0;
-#X connect 12 0 15 0;
-#X connect 13 0 15 0;
-#X restore 719 566 pd file;
-#X text 717 543 file operations;
-#X text 717 600 clipboard operations;
-#N canvas 0 0 535 583 clip 0;
-#X text 97 56 copy value associated to key into clipboard;
-#X msg 100 77 copy A;
-#X msg 98 119 cut B;
-#X text 96 101 cut value associated to key into clipboard;
-#X msg 96 401 paste;
-#X msg 98 179 copyall;
-#X text 95 158 copy all values in current dir into clipboard;
-#X msg 97 221 cutall;
-#X text 95 201 cut all values in current dir into clipboard;
-#X text 94 263 copy all values in current dir into clipboard;
-#X text 94 306 cut all values in current dir into clipboard;
-#X msg 97 284 copyrec;
-#X text 194 285 depth may be given (default=-1);
-#X text 193 326 depth may be given (default=-1);
-#X msg 96 326 cutrec 1;
-#X text 194 345 1..only with first level subdirs;
-#X text 96 379 paste clipboard contents into current directory;
-#X text 167 397 depth (default -1) and;
-#X text 169 413 mkdir flag (default 1) can be given;
-#X text 183 448 depth (default -1) and;
-#X text 185 466 mkdir flag (default 1) can be given;
-#X msg 95 453 pasteadd;
-#X text 95 431 paste but don't replace;
-#X msg 94 521 clrclip;
-#X text 171 520 clear clipboard (free memory);
-#X text 22 12 clipboard operations (this is an internal clipboard...)
-;
-#X obj 4 193 s \$0-pool;
-#X connect 1 0 26 0;
-#X connect 2 0 26 0;
-#X connect 4 0 26 0;
-#X connect 5 0 26 0;
-#X connect 7 0 26 0;
-#X connect 11 0 26 0;
-#X connect 14 0 26 0;
-#X connect 21 0 26 0;
-#X connect 23 0 26 0;
-#X restore 719 623 pd clip;
-#X text 717 454 more commands:;
-#X obj 349 429 r \$0-pool;
-#X text 174 500 data is shared among pool objects with the same name
-;
-#X obj 26 10 cnv 15 850 40 empty empty pool 10 22 32 24 -260818 -1
-0;
-#X text 337 32 http://www.parasitaere-kapazitaeten.net;
-#X text 337 12 a hierarchical storage object \, (C)2002 Thomas Grill
-;
-#X connect 0 0 5 0;
-#X connect 0 1 2 0;
-#X connect 0 2 6 0;
-#X connect 0 3 19 0;
-#X connect 1 0 0 0;
-#X connect 3 0 0 0;
-#X connect 4 0 0 0;
-#X connect 7 0 0 0;
-#X connect 8 0 0 0;
-#X connect 9 0 0 0;
-#X connect 10 0 0 0;
-#X connect 11 0 0 0;
-#X connect 12 0 0 0;
-#X connect 13 0 0 0;
-#X connect 14 0 13 0;
-#X connect 15 0 16 0;
-#X connect 16 0 0 0;
-#X connect 24 0 0 0;
-#X connect 25 0 0 0;
-#X connect 27 0 0 0;
-#X connect 29 0 0 0;
-#X connect 34 0 0 0;
-#X connect 35 0 0 0;
-#X connect 46 0 0 0;
-#X connect 49 0 0 0;
-#X connect 51 0 0 0;
-#X connect 54 0 0 0;
-#X connect 63 0 0 0;
+#N canvas 25 23 976 679 12;
+#X obj 260 478 pool;
+#X msg 295 108 set 1 2 3;
+#X obj 254 615 print K;
+#X msg 607 211 getall;
+#X msg 295 137 set A k g;
+#X obj 233 646 print V;
+#X obj 272 584 print D;
+#X msg 295 167 set A l m;
+#X msg 298 196 set 2 34;
+#X msg 297 227 set 3 17;
+#X msg 428 105 clr A;
+#X msg 432 181 get A;
+#X msg 432 213 get 2;
+#X msg 40 132 echodir \$1;
+#X obj 40 111 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1
+;
+#X obj 40 213 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1
+;
+#X msg 40 234 absdir \$1;
+#X text 427 85 clear value;
+#X text 428 159 get value;
+#X obj 291 557 print C;
+#X text 363 557 command;
+#X text 345 584 directory (abs or rel to current);
+#X text 308 647 data value;
+#X text 326 615 data key;
+#X msg 41 314 pool pool1;
+#X msg 42 343 pool;
+#X text 86 343 set to private;
+#X msg 42 405 reset;
+#X text 41 384 clear all pool data;
+#X msg 613 111 clrall;
+#X text 604 89 clear all values in dir;
+#X text 607 190 get all values in dir;
+#X text 314 479 pool name can be given as argument;
+#X text 603 136 clear all values and dirs;
+#X msg 611 158 clrrec;
+#X msg 605 258 getrec;
+#X text 605 236 get all values in dir and subdirs;
+#X text 670 289 bang at EOL;
+#X text 673 208 bang at EOL;
+#X text 670 257 depth may be given;
+#X text 43 291 set pool name;
+#X text 40 89 at each command;
+#X text 40 73 echo current dir;
+#X text 292 83 set values;
+#X text 35 194 (default on);
+#X text 27 178 report absolute dirs;
+#X msg 43 452 help;
+#X text 86 453 get some info;
+#X text 670 274 default=-1 (= infinite);
+#X msg 609 338 cntall;
+#X text 675 336 count all values in dir;
+#X msg 609 364 cntrec;
+#X text 677 362 ... and subdirs;
+#X text 673 376 (depth may be given);
+#X msg 296 282 add 3 14;
+#X text 294 261 set but don't replace;
+#N canvas 0 0 510 536 dirs 0;
+#X msg 109 27 mkdir fld1;
+#X msg 111 122 chdir;
+#X msg 110 217 updir;
+#X msg 111 354 getsub -1;
+#X text 110 7 make absolute dir;
+#X text 109 51 make relative dir;
+#X msg 110 72 mksub fld2;
+#X text 109 104 change to absolute dir;
+#X msg 110 165 chsub fld2;
+#X text 108 146 change to relative dir;
+#X text 106 198 change to upper dir;
+#X text 107 250 remove absolute dir;
+#X msg 108 269 rmdir fld1;
+#X msg 110 308 rmsub fld2;
+#X text 109 289 remove relative dir;
+#X text 109 336 get subdirs;
+#X text 251 380 -1 ... infinite;
+#X text 167 213 depth may be given;
+#X text 168 229 default=1;
+#X text 209 349 depth may be given;
+#X text 207 365 default=1;
+#X text 108 377 count subdirs;
+#X msg 111 398 cntsub -1;
+#X msg 111 458 getdir;
+#X text 110 438 get current dir;
+#X text 176 458 always absolute;
+#X obj 11 239 s \$0-pool;
+#X connect 0 0 26 0;
+#X connect 1 0 26 0;
+#X connect 2 0 26 0;
+#X connect 3 0 26 0;
+#X connect 6 0 26 0;
+#X connect 8 0 26 0;
+#X connect 12 0 26 0;
+#X connect 13 0 26 0;
+#X connect 22 0 26 0;
+#X connect 23 0 26 0;
+#X restore 718 511 pd dirs;
+#X text 715 485 directory operations;
+#N canvas 0 0 469 436 file 0;
+#X text 117 207 save dir and subdirs;
+#X text 117 165 save data in current dir;
+#X msg 117 184 svdir c:/temp/pool.dat;
+#X msg 117 226 svrec c:/temp/pool.dat;
+#X msg 116 272 lddir c:/temp/pool.dat;
+#X msg 116 319 ldrec c:/temp/pool.dat;
+#X text 117 253 load data into current dir;
+#X text 115 300 load data into current dir and below;
+#X text 132 340 depth (default -1) and;
+#X text 134 356 mkdir flag (default 1) can be given;
+#X text 117 37 save all;
+#X text 117 81 load all (add to existing data);
+#X msg 118 100 load c:/temp/pool.dat;
+#X msg 120 54 save c:/temp/pool.dat;
+#X text 22 12 file operations;
+#X obj 22 188 s \$0-pool;
+#X connect 2 0 15 0;
+#X connect 3 0 15 0;
+#X connect 4 0 15 0;
+#X connect 5 0 15 0;
+#X connect 12 0 15 0;
+#X connect 13 0 15 0;
+#X restore 719 566 pd file;
+#X text 717 543 file operations;
+#X text 717 600 clipboard operations;
+#N canvas 0 0 535 583 clip 0;
+#X text 97 56 copy value associated to key into clipboard;
+#X msg 100 77 copy A;
+#X msg 98 119 cut B;
+#X text 96 101 cut value associated to key into clipboard;
+#X msg 96 401 paste;
+#X msg 98 179 copyall;
+#X text 95 158 copy all values in current dir into clipboard;
+#X msg 97 221 cutall;
+#X text 95 201 cut all values in current dir into clipboard;
+#X text 94 263 copy all values in current dir into clipboard;
+#X text 94 306 cut all values in current dir into clipboard;
+#X msg 97 284 copyrec;
+#X text 194 285 depth may be given (default=-1);
+#X text 193 326 depth may be given (default=-1);
+#X msg 96 326 cutrec 1;
+#X text 194 345 1..only with first level subdirs;
+#X text 96 379 paste clipboard contents into current directory;
+#X text 167 397 depth (default -1) and;
+#X text 169 413 mkdir flag (default 1) can be given;
+#X text 183 448 depth (default -1) and;
+#X text 185 466 mkdir flag (default 1) can be given;
+#X msg 95 453 pasteadd;
+#X text 95 431 paste but don't replace;
+#X msg 94 521 clrclip;
+#X text 171 520 clear clipboard (free memory);
+#X text 22 12 clipboard operations (this is an internal clipboard...)
+;
+#X obj 4 193 s \$0-pool;
+#X connect 1 0 26 0;
+#X connect 2 0 26 0;
+#X connect 4 0 26 0;
+#X connect 5 0 26 0;
+#X connect 7 0 26 0;
+#X connect 11 0 26 0;
+#X connect 14 0 26 0;
+#X connect 21 0 26 0;
+#X connect 23 0 26 0;
+#X restore 719 623 pd clip;
+#X text 717 454 more commands:;
+#X obj 349 429 r \$0-pool;
+#X text 174 500 data is shared among pool objects with the same name
+;
+#X obj 26 10 cnv 15 850 40 empty empty pool 10 22 0 24 -260818 -1 0
+;
+#X text 337 32 http://www.parasitaere-kapazitaeten.net;
+#X text 337 12 a hierarchical storage object \, (C)2002 Thomas Grill
+;
+#X obj 317 529 print A;
+#X text 382 529 attributes;
+#X msg 43 490 getattributes;
+#X msg 136 132 getechodir;
+#X msg 132 232 getabsdir;
+#X msg 146 313 getpool;
+#X connect 0 0 5 0;
+#X connect 0 1 2 0;
+#X connect 0 2 6 0;
+#X connect 0 3 19 0;
+#X connect 0 4 68 0;
+#X connect 1 0 0 0;
+#X connect 3 0 0 0;
+#X connect 4 0 0 0;
+#X connect 7 0 0 0;
+#X connect 8 0 0 0;
+#X connect 9 0 0 0;
+#X connect 10 0 0 0;
+#X connect 11 0 0 0;
+#X connect 12 0 0 0;
+#X connect 13 0 0 0;
+#X connect 14 0 13 0;
+#X connect 15 0 16 0;
+#X connect 16 0 0 0;
+#X connect 24 0 0 0;
+#X connect 25 0 0 0;
+#X connect 27 0 0 0;
+#X connect 29 0 0 0;
+#X connect 34 0 0 0;
+#X connect 35 0 0 0;
+#X connect 46 0 0 0;
+#X connect 49 0 0 0;
+#X connect 51 0 0 0;
+#X connect 54 0 0 0;
+#X connect 63 0 0 0;
+#X connect 70 0 0 0;
+#X connect 71 0 0 0;
+#X connect 72 0 0 0;
+#X connect 73 0 0 0;
diff --git a/externals/grill/pool/readme.txt b/externals/grill/pool/readme.txt
index 6bf4c969..e8053aed 100644
--- a/externals/grill/pool/readme.txt
+++ b/externals/grill/pool/readme.txt
@@ -55,6 +55,8 @@ Version history:
0.1.1:
- attributes (pool,private,echodir,absdir)
- added "geti" message for retrieval of a value at an index
+- fixed bug in "get" message if key not present
+- adapted source to flext 0.4.1 - register methods at class creation
0.1.0:
- first public release
diff --git a/externals/grill/prepend/main.cpp b/externals/grill/prepend/main.cpp
index 466ae70f..91a9a5ff 100644
--- a/externals/grill/prepend/main.cpp
+++ b/externals/grill/prepend/main.cpp
@@ -10,16 +10,16 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include <flext.h>
-#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 202)
-#error You need at least flext version 0.2.2
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 401)
+#error You need at least flext version 0.4.1
#endif
-#define PREPEND_VERSION "0.0.2"
+#define PREPEND_VERSION "0.0.3"
class prepend:
public flext_base
{
- FLEXT_HEADER(prepend, flext_base)
+ FLEXT_HEADER_S(prepend, flext_base, Setup)
public:
prepend(int argc,t_atom *argv);
@@ -34,6 +34,8 @@ protected:
private:
+ static void Setup(t_class *c);
+
class reg_t
{
public:
@@ -49,12 +51,12 @@ private:
} reg[2];
FLEXT_CALLBACK(m_bang)
- FLEXT_CALLBACK_G(m_set)
+ FLEXT_CALLBACK_V(m_set)
FLEXT_CALLBACK_A(m_any0)
FLEXT_CALLBACK_A(m_any1)
};
-FLEXT_NEW_G("prepend",prepend)
+FLEXT_NEW_V("prepend",prepend)
@@ -62,16 +64,17 @@ prepend::prepend(int argc,t_atom *argv)
{
AddInAnything(2);
AddOutAnything();
- SetupInOut(); // set up inlets and outlets
-
- FLEXT_ADDMETHOD_(0,"bang",m_bang);
-// FLEXT_ADDMETHOD_(0,"set",m_set);
- FLEXT_ADDMETHOD(0,m_any0);
- FLEXT_ADDMETHOD(1,m_any1);
m_set(argc,argv);
}
+void prepend::Setup(t_class *c)
+{
+ FLEXT_CADDMETHOD_(c,0,"bang",m_bang);
+// FLEXT_CADDMETHOD_(c,0,"set",m_set);
+ FLEXT_CADDMETHOD(c,0,m_any0);
+ FLEXT_CADDMETHOD(c,1,m_any1);
+}
void prepend::reg_t::Store(const t_symbol *s,int argc,t_atom *argv)
{
diff --git a/externals/grill/py/pd/thread-1.pd b/externals/grill/py/pd/thread-1.pd
index 9a873781..5a9545e2 100644
--- a/externals/grill/py/pd/thread-1.pd
+++ b/externals/grill/py/pd/thread-1.pd
@@ -1,47 +1,47 @@
-#N canvas 440 61 586 398 12;
-#X msg 38 265 help;
-#X msg 37 290 doc;
-#X msg 73 291 doc+;
-#X floatatom 145 323 5 0 0;
-#X text 16 14 py/pyext - Python script objects \, (C)2002 Thomas Grill
-;
-#X text 14 44 This demonstrates threading. See the threads.py file.
-;
-#X obj 140 216 tgl 15 0 empty empty empty 0 -6 32 8 -262144 -1 -1 0
-1;
-#X msg 140 236 detach \$1;
-#X floatatom 253 324 5 0 0;
-#X obj 275 123 bng 15 250 50 0 empty empty empty 0 -6 32 8 -258699
--1 -1;
-#X obj 146 127 bng 15 250 50 0 empty empty empty 0 -6 32 8 -258699
--1 -1;
-#X obj 146 154 t b b b;
-#X obj 275 150 t b b b;
-#X obj 289 179 1;
-#X obj 160 181 0;
-#X text 87 87 without threads;
-#X text 251 85 with threads;
-#X text 252 102 non-blocking;
-#X text 178 345 watch that!;
-#X msg 414 127 stop;
-#X text 384 106 you can even stop it;
-#X text 115 102 blocking;
-#X obj 145 279 pyext threads ex1;
-#X connect 0 0 22 0;
-#X connect 1 0 22 0;
-#X connect 2 0 22 0;
-#X connect 6 0 7 0;
-#X connect 7 0 22 0;
-#X connect 9 0 12 0;
-#X connect 10 0 11 0;
-#X connect 11 0 22 1;
-#X connect 11 1 22 2;
-#X connect 11 2 14 0;
-#X connect 12 0 22 1;
-#X connect 12 1 22 2;
-#X connect 12 2 13 0;
-#X connect 13 0 6 0;
-#X connect 14 0 6 0;
-#X connect 19 0 22 0;
-#X connect 22 0 3 0;
-#X connect 22 1 8 0;
+#N canvas 440 61 588 400 12;
+#X msg 38 265 help;
+#X msg 37 290 doc;
+#X msg 73 291 doc+;
+#X floatatom 145 323 5 0 0 0 - - -;
+#X text 16 14 py/pyext - Python script objects \, (C)2002 Thomas Grill
+;
+#X text 14 44 This demonstrates threading. See the threads.py file.
+;
+#X obj 140 216 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1
+1;
+#X msg 140 236 detach \$1;
+#X floatatom 253 324 5 0 0 0 - - -;
+#X obj 275 123 bng 15 250 50 0 empty empty empty 0 -6 0 8 -258699 -1
+-1;
+#X obj 146 127 bng 15 250 50 0 empty empty empty 0 -6 0 8 -258699 -1
+-1;
+#X obj 146 154 t b b b;
+#X obj 275 150 t b b b;
+#X obj 289 179 1;
+#X obj 160 181 0;
+#X text 87 87 without threads;
+#X text 251 85 with threads;
+#X text 252 102 non-blocking;
+#X text 178 345 watch that!;
+#X msg 414 127 stop;
+#X text 384 106 you can even stop it;
+#X obj 145 279 pyext threads ex1;
+#X text 93 101 - blocking!! -;
+#X connect 0 0 21 0;
+#X connect 1 0 21 0;
+#X connect 2 0 21 0;
+#X connect 6 0 7 0;
+#X connect 7 0 21 0;
+#X connect 9 0 12 0;
+#X connect 10 0 11 0;
+#X connect 11 0 21 1;
+#X connect 11 1 21 2;
+#X connect 11 2 14 0;
+#X connect 12 0 21 1;
+#X connect 12 1 21 2;
+#X connect 12 2 13 0;
+#X connect 13 0 6 0;
+#X connect 14 0 6 0;
+#X connect 19 0 21 0;
+#X connect 21 0 3 0;
+#X connect 21 1 8 0;
diff --git a/externals/grill/py/readme.txt b/externals/grill/py/readme.txt
index 3173ce04..82d88985 100644
--- a/externals/grill/py/readme.txt
+++ b/externals/grill/py/readme.txt
@@ -73,6 +73,9 @@ o GCC: edit "config-pd-darwin.txt" & run "sh build-pd-darwin.sh"
Version history:
+0.1.2:
+- CHANGE: updates for flext 0.4.1 - method registering within class scope
+
0.1.1:
- CHANGE: updates for flext 0.4.0
- FIX: crash when module couldn't be loaded
diff --git a/externals/grill/py/source/main.h b/externals/grill/py/source/main.h
index eaa9f7b6..721a1d43 100644
--- a/externals/grill/py/source/main.h
+++ b/externals/grill/py/source/main.h
@@ -22,7 +22,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#error You need at least flext version 0.4.1
#endif
-#define PY__VERSION "0.1.1"
+#define PY__VERSION "0.1.2pre"
#define PYEXT_MODULE "pyext" // name for module
diff --git a/externals/grill/py/source/py.cpp b/externals/grill/py/source/py.cpp
index f6127716..00f1f992 100644
--- a/externals/grill/py/source/py.cpp
+++ b/externals/grill/py/source/py.cpp
@@ -14,7 +14,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
class pyobj:
public py
{
- FLEXT_HEADER(pyobj,py)
+ FLEXT_HEADER_S(pyobj,py,Setup)
public:
pyobj(I argc,const t_atom *argv);
@@ -50,6 +50,7 @@ protected:
V ResetFunction();
private:
+ static void Setup(t_class *c);
FLEXT_CALLBACK(m_bang)
FLEXT_CALLBACK(m_reload)
@@ -72,6 +73,25 @@ private:
FLEXT_LIB_V("py",pyobj)
+void pyobj::Setup(t_class *c)
+{
+ FLEXT_CADDBANG(c,0,m_bang);
+ FLEXT_CADDMETHOD_(c,0,"reload",m_reload_);
+ FLEXT_CADDMETHOD_(c,0,"reload.",m_reload);
+ FLEXT_CADDMETHOD_(c,0,"set",m_set);
+ FLEXT_CADDMETHOD_(c,0,"doc",m_doc);
+ FLEXT_CADDMETHOD_(c,0,"doc+",m_doc_);
+#ifdef FLEXT_THREADS
+ FLEXT_CADDMETHOD_(c,0,"detach",m_detach);
+ FLEXT_CADDMETHOD_(c,0,"stop",m_stop);
+#endif
+
+ FLEXT_CADDMETHOD_(c,1,"float",m_py_float);
+ FLEXT_CADDMETHOD_(c,1,"int",m_py_int);
+ FLEXT_CADDMETHOD(c,1,m_py_list);
+ FLEXT_CADDMETHOD(c,1,m_py_any);
+}
+
pyobj::pyobj(I argc,const t_atom *argv):
function(NULL),funname(NULL)
{
@@ -80,22 +100,6 @@ pyobj::pyobj(I argc,const t_atom *argv):
AddInAnything(2);
AddOutAnything();
- FLEXT_ADDBANG(0,m_bang);
- FLEXT_ADDMETHOD_(0,"reload",m_reload_);
- FLEXT_ADDMETHOD_(0,"reload.",m_reload);
- FLEXT_ADDMETHOD_(0,"set",m_set);
- FLEXT_ADDMETHOD_(0,"doc",m_doc);
- FLEXT_ADDMETHOD_(0,"doc+",m_doc_);
-#ifdef FLEXT_THREADS
- FLEXT_ADDMETHOD_(0,"detach",m_detach);
- FLEXT_ADDMETHOD_(0,"stop",m_stop);
-#endif
-
- FLEXT_ADDMETHOD_(1,"float",m_py_float);
- FLEXT_ADDMETHOD_(1,"int",m_py_int);
- FLEXT_ADDMETHOD(1,m_py_list);
- FLEXT_ADDMETHOD(1,m_py_any);
-
if(argc > 2)
SetArgs(argc-2,argv+2);
else
diff --git a/externals/grill/py/source/pyext.cpp b/externals/grill/py/source/pyext.cpp
index 8bff5913..958f1882 100644
--- a/externals/grill/py/source/pyext.cpp
+++ b/externals/grill/py/source/pyext.cpp
@@ -14,12 +14,22 @@ WARRANTIES, see the file, "license.txt," in this distribution.
FLEXT_LIB_V("pyext",pyext)
-V pyext::setup(t_class *)
+V pyext::Setup(t_class *c)
{
px_head = px_tail = NULL;
px_class = class_new(gensym("pyext proxy"),NULL,NULL,sizeof(py_proxy),CLASS_PD|CLASS_NOINLET, A_NULL);
::add_anything(px_class,py_proxy::px_method); // for other inlets
+
+ FLEXT_CADDMETHOD_(c,0,"reload.",m_reload);
+ FLEXT_CADDMETHOD_(c,0,"reload",m_reload_);
+ FLEXT_CADDMETHOD_(c,0,"doc",m_doc);
+ FLEXT_CADDMETHOD_(c,0,"doc+",m_doc_);
+
+#ifdef FLEXT_THREADS
+ FLEXT_CADDMETHOD_(c,0,"detach",m_detach);
+ FLEXT_CADDMETHOD_(c,0,"stop",m_stop);
+#endif
}
pyext *pyext::GetThis(PyObject *self)
@@ -165,16 +175,6 @@ pyext::pyext(I argc,const t_atom *argv):
AddInAnything(1+inlets);
AddOutAnything(outlets);
- FLEXT_ADDMETHOD_(0,"reload.",m_reload);
- FLEXT_ADDMETHOD_(0,"reload",m_reload_);
- FLEXT_ADDMETHOD_(0,"doc",m_doc);
- FLEXT_ADDMETHOD_(0,"doc+",m_doc_);
-
-#ifdef FLEXT_THREADS
- FLEXT_ADDMETHOD_(0,"detach",m_detach);
- FLEXT_ADDMETHOD_(0,"stop",m_stop);
-#endif
-
if(!pyobj)
InitProblem();
}
diff --git a/externals/grill/py/source/pyext.h b/externals/grill/py/source/pyext.h
index d804d825..4d35e0a4 100644
--- a/externals/grill/py/source/pyext.h
+++ b/externals/grill/py/source/pyext.h
@@ -16,7 +16,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
class pyext:
public py
{
- FLEXT_HEADER_S(pyext,py,setup)
+ FLEXT_HEADER_S(pyext,py,Setup)
public:
pyext(I argc,const t_atom *argv);
@@ -53,7 +53,7 @@ protected:
I inlets,outlets;
private:
- static V setup(t_class *);
+ static V Setup(t_class *);
static pyext *GetThis(PyObject *self);
V ClearBinding();
diff --git a/externals/grill/vasp/pd-ex/freeze1.pd b/externals/grill/vasp/pd-ex/freeze1.pd
index b8f74dad..c24eeb61 100644
--- a/externals/grill/vasp/pd-ex/freeze1.pd
+++ b/externals/grill/vasp/pd-ex/freeze1.pd
@@ -1,4 +1,4 @@
-#N canvas 33 61 969 505 12;
+#N canvas 33 61 975 511 12;
#N canvas 387 42 567 656 freeze 0;
#X obj 26 130 vasp.split 2;
#X obj 27 404 vasp.join 2;
@@ -186,7 +186,7 @@
#X obj 105 115 nbx 12 18 0 1e+008 0 1 empty empty length(frames) 0
-8 0 12 -225271 -1 -1 1e+006 256;
#X obj 85 368 nbx 9 14 -1e+037 1e+037 0 0 empty empty spectral_density
-0 -6 0 10 -262131 -1 -1 0.054238 256;
+0 -6 0 10 -262131 -1 -1 0.009812 256;
#X obj 332 197 cnv 15 100 20 empty empty play_src 5 8 0 10 -261681
-66577 0;
#X obj 447 197 cnv 15 100 20 empty empty read_src 5 8 0 10 -261681
@@ -250,7 +250,7 @@
#X connect 3 0 0 1;
#X connect 3 1 4 0;
#X restore 614 251 pd playdst;
-#N canvas 249 202 519 462 copy 0;
+#N canvas 249 202 527 470 copy 0;
#X obj 27 26 inlet;
#X obj 27 51 t b b;
#X obj 316 19 inlet;
diff --git a/externals/grill/vasp/source/classes.cpp b/externals/grill/vasp/source/classes.cpp
index 78c6a0ca..801826dd 100644
--- a/externals/grill/vasp/source/classes.cpp
+++ b/externals/grill/vasp/source/classes.cpp
@@ -24,7 +24,7 @@ const t_symbol *vasp_base::sym_double;
const t_symbol *vasp_base::sym_complex;
const t_symbol *vasp_base::sym_vector;
-V vasp_base::setup(t_class *)
+V vasp_base::Setup(t_class *c)
{
sym_radio = MakeSymbol("radio");
sym_vasp = MakeSymbol("vasp");
@@ -32,22 +32,22 @@ V vasp_base::setup(t_class *)
sym_double = MakeSymbol("double");
sym_complex = MakeSymbol("complex");
sym_vector = MakeSymbol("vector");
-}
-vasp_base::vasp_base():
- refresh(false),argchk(false),
- unit(xsu_sample),loglvl(0)
-{
- FLEXT_ADDMETHOD_(0,"radio",m_radio);
+ FLEXT_CADDMETHOD_(c,0,"radio",m_radio);
// LATER!
/*
- FLEXT_ADDATTR_VAR1("argchk",argchk);
- FLEXT_ADDATTR_VAR1("loglvl",loglvl);
- FLEXT_ADDATTR_VAR1_E("unit",unit);
+ FLEXT_CADDATTR_VAR1(c,"argchk",argchk);
+ FLEXT_CADDATTR_VAR1(c,"loglvl",loglvl);
+ FLEXT_CADDATTR_VAR1_E(c,"unit",unit);
*/
}
+vasp_base::vasp_base():
+ refresh(false),argchk(false),
+ unit(xsu_sample),loglvl(0)
+{}
+
vasp_base::~vasp_base() {}
@@ -91,20 +91,24 @@ vasp_op::vasp_op(BL op)
// ,thrid(0)
#endif
{
- FLEXT_ADDBANG(0,m_dobang);
- FLEXT_ADDMETHOD_(0,"vasp",m_vasp);
- FLEXT_ADDMETHOD_(0,"set",m_set);
-
- FLEXT_ADDATTR_VAR("ref",m_getref,m_setref);
if(op) FLEXT_ADDATTR_VAR("to",m_getto,m_setto);
+}
+
+V vasp_op::Setup(t_class *c)
+{
+ FLEXT_CADDBANG(c,0,m_dobang);
+ FLEXT_CADDMETHOD_(c,0,"vasp",m_vasp);
+ FLEXT_CADDMETHOD_(c,0,"set",m_set);
+
+ FLEXT_CADDATTR_VAR(c,"ref",m_getref,m_setref);
- FLEXT_ADDMETHOD_(0,"stop",m_stop);
+ FLEXT_CADDMETHOD_(c,0,"stop",m_stop);
- FLEXT_ADDATTR_VAR("update",m_getupd,m_setupd);
+ FLEXT_CADDATTR_VAR(c,"update",m_getupd,m_setupd);
#ifdef FLEXT_THREADS
- FLEXT_ADDATTR_VAR1("detach",detach);
- FLEXT_ADDATTR_VAR1("prior",prior);
+ FLEXT_CADDATTR_VAR1(c,"detach",detach);
+ FLEXT_CADDATTR_VAR1(c,"prior",prior);
#endif
}
@@ -252,18 +256,21 @@ vasp_binop::vasp_binop(I argc,const t_atom *argv,const Argument &def,BL op,UL ou
AddInAnything(2);
AddOutAnything(1);
AddOutlets(outcode);
+}
- FLEXT_ADDMETHOD(1,a_list);
- FLEXT_ADDMETHOD_(1,"vasp",a_vasp);
- FLEXT_ADDMETHOD_(1,"env",a_env);
- FLEXT_ADDMETHOD_(1,"float",a_float);
- FLEXT_ADDMETHOD_(1,"double",a_double);
- FLEXT_ADDMETHOD_(1,"int",a_int);
- FLEXT_ADDMETHOD_(1,"complex",a_complex);
- FLEXT_ADDMETHOD_(1,"vector",a_vector);
- FLEXT_ADDMETHOD_(1,"radio",a_radio);
-
- FLEXT_ADDATTR_VAR("arg",m_getarg,m_setarg);
+V vasp_binop::Setup(t_class *c)
+{
+ FLEXT_CADDMETHOD(c,1,a_list);
+ FLEXT_CADDMETHOD_(c,1,"vasp",a_vasp);
+ FLEXT_CADDMETHOD_(c,1,"env",a_env);
+ FLEXT_CADDMETHOD_(c,1,"float",a_float);
+ FLEXT_CADDMETHOD_(c,1,"double",a_double);
+ FLEXT_CADDMETHOD_(c,1,"int",a_int);
+ FLEXT_CADDMETHOD_(c,1,"complex",a_complex);
+ FLEXT_CADDMETHOD_(c,1,"vector",a_vector);
+ FLEXT_CADDMETHOD_(c,1,"radio",a_radio);
+
+ FLEXT_CADDATTR_VAR(c,"arg",m_getarg,m_setarg);
}
V vasp_binop::a_list(I argc,const t_atom *argv)
@@ -374,12 +381,15 @@ vasp_anyop::vasp_anyop(I argc,const t_atom *argv,const Argument &def,BL op,UL ou
AddInAnything(2);
AddOutAnything(1);
AddOutlets(outcode);
+}
- FLEXT_ADDMETHOD(1,a_list);
- FLEXT_ADDMETHOD_(1,"vasp",a_list);
- FLEXT_ADDMETHOD_(1,"radio",a_radio);
+V vasp_anyop::Setup(t_class *c)
+{
+ FLEXT_CADDMETHOD(c,1,a_list);
+ FLEXT_CADDMETHOD_(c,1,"vasp",a_list);
+ FLEXT_CADDMETHOD_(c,1,"radio",a_radio);
- FLEXT_ADDATTR_VAR("arg",m_getarg,m_setarg);
+ FLEXT_CADDATTR_VAR(c,"arg",m_getarg,m_setarg);
}
V vasp_anyop::a_list(I argc,const t_atom *argv)
diff --git a/externals/grill/vasp/source/classes.h b/externals/grill/vasp/source/classes.h
index c032abd7..1ef17a3f 100644
--- a/externals/grill/vasp/source/classes.h
+++ b/externals/grill/vasp/source/classes.h
@@ -18,7 +18,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
class vasp_base:
public flext_base
{
- FLEXT_HEADER_S(vasp_base,flext_base,setup)
+ FLEXT_HEADER_S(vasp_base,flext_base,Setup)
public:
enum xs_unit {
@@ -54,7 +54,7 @@ protected:
BL ToOutVasp(I outlet,Vasp &v);
private:
- static V setup(t_class *);
+ static V Setup(t_class *);
FLEXT_CALLBACK_V(m_radio)
@@ -67,7 +67,7 @@ private:
class vasp_op:
public vasp_base
{
- FLEXT_HEADER(vasp_op,vasp_base)
+ FLEXT_HEADER_S(vasp_op,vasp_base,Setup)
protected:
vasp_op(BL withto = false);
@@ -128,6 +128,8 @@ protected:
#endif
private:
+ static V Setup(t_class *);
+
virtual V m_bang() = 0; // do! and output current Vasp
};
@@ -173,7 +175,7 @@ protected:
class vasp_binop:
public vasp_tx
{
- FLEXT_HEADER(vasp_binop,vasp_tx)
+ FLEXT_HEADER_S(vasp_binop,vasp_tx,Setup)
protected:
vasp_binop(I argc,const t_atom *argv,const Argument &def = Argument(),BL withto = false,UL outcode = 0);
@@ -199,6 +201,8 @@ protected:
V m_getarg(AtomList &l) { arg.MakeList(l); }
private:
+ static V Setup(t_class *);
+
FLEXT_CALLBACK_V(a_list)
FLEXT_CALLBACK_V(a_vasp)
FLEXT_CALLBACK_V(a_env)
@@ -218,7 +222,7 @@ private:
class vasp_anyop:
public vasp_tx
{
- FLEXT_HEADER(vasp_anyop,vasp_tx)
+ FLEXT_HEADER_S(vasp_anyop,vasp_tx,Setup)
protected:
vasp_anyop(I argc,const t_atom *argv,const Argument &def = Argument(),BL withto = false,UL outcode = 0);
@@ -237,6 +241,8 @@ protected:
V m_getarg(AtomList &l) { arg.MakeList(l); }
private:
+ static V Setup(t_class *);
+
FLEXT_CALLBACK_V(a_list)
FLEXT_CALLBACK_V(a_radio)
diff --git a/externals/grill/vasp/source/obj_chns.cpp b/externals/grill/vasp/source/obj_chns.cpp
index facfe5fe..b8c2affc 100755
--- a/externals/grill/vasp/source/obj_chns.cpp
+++ b/externals/grill/vasp/source/obj_chns.cpp
@@ -26,7 +26,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
class vasp_channel:
public vasp_tx
{
- FLEXT_HEADER(vasp_channel,vasp_tx)
+ FLEXT_HEADER_S(vasp_channel,vasp_tx,Setup)
public:
vasp_channel(I argc,t_atom *argv):
@@ -39,9 +39,12 @@ public:
AddInAnything(2);
AddOutAnything();
+ }
- FLEXT_ADDMETHOD(1,m_ix);
- FLEXT_ADDATTR_VAR("index",ix,m_ix);
+ static V Setup(t_class *c)
+ {
+ FLEXT_CADDMETHOD(c,1,m_ix);
+ FLEXT_CADDATTR_VAR(c,"index",ix,m_ix);
}
V m_ix(I i) { ix = i; }
@@ -90,7 +93,6 @@ public:
{
AddInAnything();
AddOutInt();
- SetupInOut();
}
virtual V m_bang()
diff --git a/externals/grill/vasp/source/obj_frames.cpp b/externals/grill/vasp/source/obj_frames.cpp
index c50d5019..9f6b54a7 100644
--- a/externals/grill/vasp/source/obj_frames.cpp
+++ b/externals/grill/vasp/source/obj_frames.cpp
@@ -29,7 +29,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
class vasp_frames:
public vasp_tx
{
- FLEXT_HEADER(vasp_frames,vasp_tx)
+ FLEXT_HEADER_S(vasp_frames,vasp_tx,Setup)
public:
vasp_frames(I argc,t_atom *argv,BL abs = true):
@@ -45,10 +45,14 @@ public:
AddInFloat();
AddOutAnything();
- FLEXT_ADDMETHOD(1,m_arg);
if(abs) FLEXT_ADDATTR_VAR("frames",frms,m_arg);
}
+ static V Setup(t_class *c)
+ {
+ FLEXT_CADDMETHOD(c,1,m_arg);
+ }
+
virtual V m_arg(F f)
{
frms = (I)f; //! \todo unit processing
@@ -127,14 +131,18 @@ FLEXT_LIB_V("vasp, vasp.frames+ vasp.f+",vasp_dframes)
class vasp_mframes:
public vasp_frames
{
- FLEXT_HEADER(vasp_mframes,vasp_frames)
+ FLEXT_HEADER_S(vasp_mframes,vasp_frames,Setup)
public:
vasp_mframes(I argc,t_atom *argv):
vasp_frames(argc,argv,false)
{
if(argc && CanbeFloat(argv[0])) m_arg(GetAFloat(argv[0]));
- FLEXT_ADDATTR_VAR("factor",factor,m_arg);
+ }
+
+ static V Setup(t_class *c)
+ {
+ FLEXT_CADDATTR_VAR(c,"factor",factor,m_arg);
}
virtual Vasp *x_work()
@@ -221,7 +229,6 @@ public:
{
AddInAnything();
AddOutInt();
- SetupInOut();
}
virtual V m_bang() { ToOutInt(0,ref.ChkFrames()); } //! \todo unit processing
diff --git a/externals/grill/vasp/source/obj_imm.cpp b/externals/grill/vasp/source/obj_imm.cpp
index 9ea9791a..4d4000d2 100644
--- a/externals/grill/vasp/source/obj_imm.cpp
+++ b/externals/grill/vasp/source/obj_imm.cpp
@@ -34,7 +34,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
class vasp_imm:
public vasp_op
{
- FLEXT_HEADER(vasp_imm,vasp_op)
+ FLEXT_HEADER_S(vasp_imm,vasp_op,Setup)
public:
vasp_imm(I argc,t_atom *argv):
@@ -48,9 +48,12 @@ public:
AddInAnything();
AddInInt();
AddOutAnything();
+ }
- FLEXT_ADDMETHOD(1,m_frames);
- FLEXT_ADDATTR_VAR("frames",frms,m_frames);
+ static V Setup(t_class *c)
+ {
+ FLEXT_CADDMETHOD(c,1,m_frames);
+ FLEXT_CADDATTR_VAR(c,"frames",frms,m_frames);
}
V m_frames(I n) { frms = n; }
diff --git a/externals/grill/vasp/source/obj_offs.cpp b/externals/grill/vasp/source/obj_offs.cpp
index 07bf1982..6ecfeefd 100644
--- a/externals/grill/vasp/source/obj_offs.cpp
+++ b/externals/grill/vasp/source/obj_offs.cpp
@@ -30,7 +30,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
class vasp_offset:
public vasp_tx
{
- FLEXT_HEADER(vasp_offset,vasp_tx)
+ FLEXT_HEADER_S(vasp_offset,vasp_tx,Setup)
public:
vasp_offset(I argc,t_atom *argv):
@@ -44,9 +44,12 @@ public:
AddInAnything();
AddInFloat();
AddOutAnything();
+ }
- FLEXT_ADDMETHOD(1,m_offs);
- FLEXT_ADDATTR_VAR("frames",offs,m_offs);
+ static V Setup(t_class *c)
+ {
+ FLEXT_CADDMETHOD(c,1,m_offs);
+ FLEXT_CADDATTR_VAR(c,"frames",offs,m_offs);
}
V m_offs(F o)
diff --git a/externals/grill/vasp/source/obj_part.cpp b/externals/grill/vasp/source/obj_part.cpp
index f1ecf354..5f0e652b 100644
--- a/externals/grill/vasp/source/obj_part.cpp
+++ b/externals/grill/vasp/source/obj_part.cpp
@@ -31,7 +31,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
class vasp_part:
public vasp_op
{
- FLEXT_HEADER(vasp_part,vasp_op)
+ FLEXT_HEADER_S(vasp_part,vasp_op,Setup)
public:
vasp_part(I argc,t_atom *argv):
@@ -41,13 +41,16 @@ public:
AddInAnything(2);
AddOutAnything(2);
-
- FLEXT_ADDMETHOD_(1,"list",m_part);
- FLEXT_ADDATTR_VAR("parts",m_getpart,m_setpart);
}
~vasp_part() { if(part) delete[] part; }
+ static V Setup(t_class *c)
+ {
+ FLEXT_CADDMETHOD_(c,1,"list",m_part);
+ FLEXT_CADDATTR_VAR(c,"parts",m_getpart,m_setpart);
+ }
+
V m_part(I argc,const t_atom *argv)
{
if(part) delete[] part; parts = 0;
diff --git a/externals/grill/vasp/source/obj_peaks.cpp b/externals/grill/vasp/source/obj_peaks.cpp
index bade1ff1..003acfaa 100644
--- a/externals/grill/vasp/source/obj_peaks.cpp
+++ b/externals/grill/vasp/source/obj_peaks.cpp
@@ -31,7 +31,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
class vasp_qpeaks:
public vasp_op
{
- FLEXT_HEADER(vasp_qpeaks,vasp_op)
+ FLEXT_HEADER_S(vasp_qpeaks,vasp_op,Setup)
public:
vasp_qpeaks(I argc,t_atom *argv):
@@ -45,9 +45,12 @@ public:
AddInAnything();
AddInInt();
AddOutAnything(2);
+ }
- FLEXT_ADDMETHOD(1,m_peaks);
- FLEXT_ADDATTR_VAR("peaks",peaks,m_peaks);
+ static V Setup(t_class *c)
+ {
+ FLEXT_CADDMETHOD(c,1,m_peaks);
+ FLEXT_CADDATTR_VAR(c,"peaks",peaks,m_peaks);
}
V m_peaks(I n) { peaks = n; }
diff --git a/externals/grill/vasp/source/obj_radio.cpp b/externals/grill/vasp/source/obj_radio.cpp
index d0c2452e..a3fde97c 100644
--- a/externals/grill/vasp/source/obj_radio.cpp
+++ b/externals/grill/vasp/source/obj_radio.cpp
@@ -27,7 +27,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
class vasp_radio:
public flext_base
{
- FLEXT_HEADER(vasp_radio,flext_base)
+ FLEXT_HEADER_S(vasp_radio,flext_base,Setup)
public:
@@ -35,8 +35,11 @@ public:
{
AddInAnything();
AddOutAnything(2);
+ }
- FLEXT_ADDMETHOD(0,m_any);
+ static V Setup(t_class *c)
+ {
+ FLEXT_CADDMETHOD(c,0,m_any);
}
virtual V m_any(const t_symbol *s,I argc,t_atom *argv);
diff --git a/externals/grill/vasp/source/obj_size.cpp b/externals/grill/vasp/source/obj_size.cpp
index 1d28b1cb..b061824b 100644
--- a/externals/grill/vasp/source/obj_size.cpp
+++ b/externals/grill/vasp/source/obj_size.cpp
@@ -30,7 +30,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
class vasp_size:
public vasp_tx
{
- FLEXT_HEADER(vasp_size,vasp_tx)
+ FLEXT_HEADER_S(vasp_size,vasp_tx,Setup)
public:
vasp_size(I argc,t_atom *argv,BL abs = true):
@@ -45,9 +45,13 @@ public:
AddInFloat();
AddOutAnything();
- FLEXT_ADDMETHOD(1,m_arg);
if(abs) FLEXT_ADDATTR_VAR("frames",size,m_arg);
- FLEXT_ADDATTR_VAR1("keep",keep);
+ }
+
+ static V Setup(t_class *c)
+ {
+ FLEXT_CADDMETHOD(c,1,m_arg);
+ FLEXT_CADDATTR_VAR1(c,"keep",keep);
}
virtual V m_arg(F s)
@@ -129,14 +133,18 @@ FLEXT_LIB_V("vasp, vasp.size+ vasp.s+",vasp_dsize)
class vasp_msize:
public vasp_size
{
- FLEXT_HEADER(vasp_msize,vasp_size)
+ FLEXT_HEADER_S(vasp_msize,vasp_size,Setup)
public:
vasp_msize(I argc,t_atom *argv):
vasp_size(argc,argv,false)
{
if(argc && CanbeFloat(argv[0])) m_arg(GetAFloat(argv[0]));
- FLEXT_ADDATTR_VAR("factor",factor,m_arg);
+ }
+
+ static V Setup(t_class *c)
+ {
+ FLEXT_CADDATTR_VAR(c,"factor",factor,m_arg);
}
virtual Vasp *x_work()
diff --git a/externals/grill/vasp/source/obj_split.cpp b/externals/grill/vasp/source/obj_split.cpp
index e308e19c..8a3dda94 100644
--- a/externals/grill/vasp/source/obj_split.cpp
+++ b/externals/grill/vasp/source/obj_split.cpp
@@ -95,7 +95,7 @@ FLEXT_LIB_V("vasp, vasp.split",vasp_split)
class vasp_join:
public vasp_tx
{
- FLEXT_HEADER(vasp_join,vasp_tx)
+ FLEXT_HEADER_S(vasp_join,vasp_tx,Setup)
public:
vasp_join(I argc,t_atom *argv):
@@ -115,12 +115,15 @@ public:
AddInAnything(cnt);
AddOutAnything();
-
- FLEXT_ADDMETHOD_(0,"reset",m_reset);
}
~vasp_join() { if(vi) delete[] vi; }
+ static V Setup(t_class *c)
+ {
+ FLEXT_CADDMETHOD_(c,0,"reset",m_reset);
+ }
+
virtual Vasp *x_work() {
CVasp *ret = new CVasp(ref);
for(I i = 0; i < cnt-1; ++i) if(vi[i]) *ret += *vi[i];
@@ -231,7 +234,7 @@ FLEXT_LIB_V("vasp, vasp.spit",vasp_spit)
class vasp_gather:
public vasp_tx
{
- FLEXT_HEADER(vasp_gather,vasp_tx)
+ FLEXT_HEADER_S(vasp_gather,vasp_tx,Setup)
public:
vasp_gather(I argc,t_atom *argv)
@@ -246,12 +249,13 @@ public:
AddInAnything(2);
AddOutAnything();
-
- FLEXT_ADDMETHOD_(0,"reset",m_reset);
- FLEXT_ADDMETHOD_(1,"vasp",m_add);
}
- ~vasp_gather() { }
+ static V Setup(t_class *c)
+ {
+ FLEXT_CADDMETHOD_(c,0,"reset",m_reset);
+ FLEXT_CADDMETHOD_(c,1,"vasp",m_add);
+ }
virtual Vasp *x_work()
{
diff --git a/externals/grill/vasp/source/obj_sync.cpp b/externals/grill/vasp/source/obj_sync.cpp
index 9d6e3610..a8726328 100644
--- a/externals/grill/vasp/source/obj_sync.cpp
+++ b/externals/grill/vasp/source/obj_sync.cpp
@@ -31,7 +31,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
class vasp_sync:
public vasp_op
{
- FLEXT_HEADER(vasp_sync,vasp_op)
+ FLEXT_HEADER_S(vasp_sync,vasp_op,Setup)
public:
vasp_sync(I argc,t_atom *argv):
@@ -52,12 +52,19 @@ public:
AddInAnything(cnt);
AddOutAnything(cnt);
+ }
- FLEXT_ADDMETHOD_(0,"reset",m_reset);
-
+ static V Setup(t_class *c)
+ {
+ FLEXT_CADDMETHOD_(c,0,"reset",m_reset);
}
- virtual BL Init() { BL ret = vasp_op::Init(); m_reset(); return ret; }
+ virtual BL Init()
+ {
+ BL ret = vasp_op::Init();
+ m_reset();
+ return ret;
+ }
~vasp_sync()
{
diff --git a/externals/grill/vasp/source/obj_vasp.cpp b/externals/grill/vasp/source/obj_vasp.cpp
index 680bede7..2b4319c3 100644
--- a/externals/grill/vasp/source/obj_vasp.cpp
+++ b/externals/grill/vasp/source/obj_vasp.cpp
@@ -32,7 +32,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
class vasp_v:
public vasp_tx
{
- FLEXT_HEADER(vasp_v,vasp_tx)
+ FLEXT_HEADER_S(vasp_v,vasp_tx,Setup)
public:
@@ -42,12 +42,15 @@ public:
AddInAnything(2);
AddOutAnything();
+ }
- FLEXT_ADDMETHOD_(0,"list",m_vasp);
+ static V Setup(t_class *c)
+ {
+ FLEXT_CADDMETHOD_(c,0,"list",m_vasp);
- FLEXT_ADDMETHOD_(1,"list",m_set);
- FLEXT_ADDMETHOD_(1,"vasp",m_set);
- FLEXT_ADDMETHOD_(1,"radio",a_radio);
+ FLEXT_CADDMETHOD_(c,1,"list",m_set);
+ FLEXT_CADDMETHOD_(c,1,"vasp",m_set);
+ FLEXT_CADDMETHOD_(c,1,"radio",a_radio);
}
V a_radio(I,t_atom *) {}
diff --git a/externals/grill/vasp/source/obj_vecs.cpp b/externals/grill/vasp/source/obj_vecs.cpp
index 3c0db9f5..2806a806 100644
--- a/externals/grill/vasp/source/obj_vecs.cpp
+++ b/externals/grill/vasp/source/obj_vecs.cpp
@@ -30,7 +30,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
class vasp_vector:
public vasp_tx
{
- FLEXT_HEADER(vasp_vector,vasp_tx)
+ FLEXT_HEADER_S(vasp_vector,vasp_tx,Setup)
public:
vasp_vector(I argc,t_atom *argv):
@@ -43,9 +43,12 @@ public:
AddInAnything(2);
AddOutAnything();
+ }
- FLEXT_ADDMETHOD(1,m_ix);
- FLEXT_ADDATTR_VAR("index",ix,m_ix);
+ static V Setup(t_class *c)
+ {
+ FLEXT_CADDMETHOD(c,1,m_ix);
+ FLEXT_CADDATTR_VAR(c,"index",ix,m_ix);
}
V m_ix(I i) { ix = i; }
diff --git a/externals/grill/vasp/source/ops_rearr.cpp b/externals/grill/vasp/source/ops_rearr.cpp
index 0da06cfd..b7712115 100644
--- a/externals/grill/vasp/source/ops_rearr.cpp
+++ b/externals/grill/vasp/source/ops_rearr.cpp
@@ -99,14 +99,17 @@ BL VecOp::d_shift(OpParam &p)
class vasp_shift:
public vasp_anyop
{
- FLEXT_HEADER(vasp_shift,vasp_anyop)
+ FLEXT_HEADER_S(vasp_shift,vasp_anyop,Setup)
public:
vasp_shift(I argc,const t_atom *argv):
vasp_anyop(argc,argv,VASP_ARG_I(0),true),
fill(xsf_zero)
+ {}
+
+ static V Setup(t_class *c)
{
- FLEXT_ADDATTR_VAR1_E("fill",fill);
+ FLEXT_CADDATTR_VAR1_E(c,"fill",fill);
}
enum xs_fill {
diff --git a/externals/grill/vasp/source/ops_resmp.cpp b/externals/grill/vasp/source/ops_resmp.cpp
index 0c578284..e7e33bb9 100644
--- a/externals/grill/vasp/source/ops_resmp.cpp
+++ b/externals/grill/vasp/source/ops_resmp.cpp
@@ -201,15 +201,18 @@ Vasp *VaspOp::m_tilt(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,BL sym
class vasp_tilt:
public vasp_anyop
{
- FLEXT_HEADER(vasp_tilt,vasp_anyop)
+ FLEXT_HEADER_S(vasp_tilt,vasp_anyop,Setup)
public:
vasp_tilt(I argc,t_atom *argv):
vasp_anyop(argc,argv,VASP_ARG_R(1),true),
fill(xtf_zero),inter(xti_4p)
+ {}
+
+ static V Setup(t_class *c)
{
- FLEXT_ADDATTR_VAR1_E("fill",fill);
- FLEXT_ADDATTR_VAR1_E("inter",inter);
+ FLEXT_CADDATTR_VAR1_E(c,"fill",fill);
+ FLEXT_CADDATTR_VAR1_E(c,"inter",inter);
}
enum xt_fill {
diff --git a/externals/grill/vasp/source/ops_search.cpp b/externals/grill/vasp/source/ops_search.cpp
index 6401f558..580a4d1b 100644
--- a/externals/grill/vasp/source/ops_search.cpp
+++ b/externals/grill/vasp/source/ops_search.cpp
@@ -128,15 +128,18 @@ Vasp *VaspOp::m_search(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,BL s
class vasp_search:
public vasp_anyop
{
- FLEXT_HEADER(vasp_search,vasp_anyop)
+ FLEXT_HEADER_S(vasp_search,vasp_anyop,Setup)
public:
vasp_search(I argc,t_atom *argv):
vasp_anyop(argc,argv,VASP_ARG_R(0),false,XletCode(xlet::tp_float,0)),
slope(0),dir(0)
+ {}
+
+ static V Setup(t_class *c)
{
- FLEXT_ADDATTR_VAR1("dir",dir);
- FLEXT_ADDATTR_VAR1("slope",slope);
+ FLEXT_CADDATTR_VAR1(c,"dir",dir);
+ FLEXT_CADDATTR_VAR1(c,"slope",slope);
}
virtual Vasp *do_work(OpParam &p) = 0;
diff --git a/externals/grill/xsample/readme.txt b/externals/grill/xsample/readme.txt
index 425b6a7a..a5599f5b 100644
--- a/externals/grill/xsample/readme.txt
+++ b/externals/grill/xsample/readme.txt
@@ -76,7 +76,7 @@ Version history:
- xgroove~, xrecord~: introduced a loop/end bang outlet
- added MaxMSP buffer resize recognition
- xgroove~: introduced a crossfading loop zone
-- adapted source for flext 0.4.1
+- adapted source for flext 0.4.1 - most methods within class scope
- introduced attributes
0.2.4:
diff --git a/externals/grill/xsample/source/groove.cpp b/externals/grill/xsample/source/groove.cpp
index 795eb654..e756f28a 100644
--- a/externals/grill/xsample/source/groove.cpp
+++ b/externals/grill/xsample/source/groove.cpp
@@ -22,8 +22,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
class xgroove:
public xinter
{
-// FLEXT_HEADER_S(xgroove,xinter,setup)
- FLEXT_HEADER(xgroove,xinter)
+ FLEXT_HEADER_S(xgroove,xinter,setup)
public:
xgroove(I argc,const t_atom *argv);
@@ -87,7 +86,7 @@ protected:
V mg_pos(F &v) const { v = curpos*s2u; }
private:
-// static V setup(t_class *c);
+ static V setup(t_class *c);
virtual V s_dsp();
@@ -129,14 +128,24 @@ private:
FLEXT_LIB_DSP_V("xgroove~",xgroove)
-/*
-V xgroove::setup(t_class *)
+
+V xgroove::setup(t_class *c)
{
-#ifndef PD
- post("loaded xgroove~ - part of xsample objects, version " XSAMPLE_VERSION " - (C) Thomas Grill, 2001-2002");
-#endif
+ FLEXT_CADDMETHOD_(c,0,"all",m_all);
+ FLEXT_CADDMETHOD(c,1,m_min);
+ FLEXT_CADDMETHOD(c,2,m_max);
+
+ FLEXT_CADDATTR_VAR(c,"min",mg_min,m_min);
+ FLEXT_CADDATTR_VAR(c,"max",mg_max,m_max);
+ FLEXT_CADDATTR_VAR(c,"pos",mg_pos,m_pos);
+
+ FLEXT_CADDATTR_VAR_E(c,"loop",loopmode,m_loop);
+
+ FLEXT_CADDMETHOD_F(c,0,"xzone",m_xzone);
+ FLEXT_CADDMETHOD_F(c,0,"xsymm",m_xsymm);
+ FLEXT_CADDMETHOD_(c,0,"xshape",m_xshape);
+ FLEXT_CADDMETHOD_B(c,0,"xkeep",m_xkeep);
}
-*/
xgroove::xgroove(I argc,const t_atom *argv):
loopmode(xsl_loop),curpos(0),
@@ -175,20 +184,6 @@ xgroove::xgroove(I argc,const t_atom *argv):
AddOutFloat(2); // play min & max
AddOutBang(); // loop bang
- FLEXT_ADDMETHOD_(0,"all",m_all);
- FLEXT_ADDMETHOD(1,m_min);
- FLEXT_ADDMETHOD(2,m_max);
-
- FLEXT_ADDATTR_VAR("min",mg_min,m_min);
- FLEXT_ADDATTR_VAR("max",mg_max,m_max);
- FLEXT_ADDATTR_VAR("pos",mg_pos,m_pos);
-
- FLEXT_ADDATTR_VAR_E("loop",loopmode,m_loop);
-
- FLEXT_ADDMETHOD_F(0,"xzone",m_xzone);
- FLEXT_ADDMETHOD_F(0,"xsymm",m_xsymm);
- FLEXT_ADDMETHOD_(0,"xshape",m_xshape);
- FLEXT_ADDMETHOD_B(0,"xkeep",m_xkeep);
znbuf = new S *[outchns];
for(I i = 0; i < outchns; ++i) znbuf[i] = new S[0];
diff --git a/externals/grill/xsample/source/main.cpp b/externals/grill/xsample/source/main.cpp
index d8182f57..4097ed98 100644
--- a/externals/grill/xsample/source/main.cpp
+++ b/externals/grill/xsample/source/main.cpp
@@ -36,6 +36,23 @@ FLEXT_LIB_SETUP(xsample,lib_setup)
// ------------------------------
+void xsample::setup(t_class *c)
+{
+ FLEXT_CADDBANG(c,0,m_start);
+ FLEXT_CADDMETHOD_(c,0,"start",m_start);
+ FLEXT_CADDMETHOD_(c,0,"stop",m_stop);
+
+ FLEXT_CADDMETHOD_(c,0,"set",m_set);
+ FLEXT_CADDMETHOD_(c,0,"print",m_print);
+ FLEXT_CADDMETHOD_(c,0,"refresh",m_refresh);
+ FLEXT_CADDMETHOD_(c,0,"reset",m_reset);
+
+ FLEXT_CADDATTR_VAR(c,"buffer",mg_buffer,ms_buffer);
+ FLEXT_CADDATTR_VAR_E(c,"units",unitmode,m_units);
+ FLEXT_CADDATTR_VAR_E(c,"sclmode",sclmode,m_sclmode);
+ FLEXT_CADDATTR_GET(c,"scale",s2u);
+}
+
xsample::xsample():
buf(NULL),
#if FLEXT_SYS == FLEXT_SYS_MAX
@@ -45,21 +62,7 @@ xsample::xsample():
#endif
sclmode(xss_unitsinbuf),
curmin(0),curmax(1<<30)
-{
- FLEXT_ADDBANG(0,m_start);
- FLEXT_ADDMETHOD_(0,"start",m_start);
- FLEXT_ADDMETHOD_(0,"stop",m_stop);
-
- FLEXT_ADDMETHOD_(0,"set",m_set);
- FLEXT_ADDMETHOD_(0,"print",m_print);
- FLEXT_ADDMETHOD_(0,"refresh",m_refresh);
- FLEXT_ADDMETHOD_(0,"reset",m_reset);
-
- FLEXT_ADDATTR_VAR("buffer",mg_buffer,ms_buffer);
- FLEXT_ADDATTR_VAR_E("units",unitmode,m_units);
- FLEXT_ADDATTR_VAR_E("sclmode",sclmode,m_sclmode);
- FLEXT_ADDATTR_GET("scale",s2u);
-}
+{}
xsample::~xsample()
{
diff --git a/externals/grill/xsample/source/main.h b/externals/grill/xsample/source/main.h
index f0c1bff9..dfc8147c 100644
--- a/externals/grill/xsample/source/main.h
+++ b/externals/grill/xsample/source/main.h
@@ -64,7 +64,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
class xsample:
public flext_dsp
{
- FLEXT_HEADER(xsample,flext_dsp)
+ FLEXT_HEADER_S(xsample,flext_dsp,setup)
public:
xsample();
@@ -126,6 +126,7 @@ protected:
V mg_max(F &v) const { v = curmax*s2u; }
private:
+ static V setup(t_class *c);
FLEXT_CALLBACK(m_start)
FLEXT_CALLBACK(m_stop)
diff --git a/externals/grill/xsample/source/play.cpp b/externals/grill/xsample/source/play.cpp
index 3b934ecb..c2e6ef41 100644
--- a/externals/grill/xsample/source/play.cpp
+++ b/externals/grill/xsample/source/play.cpp
@@ -18,7 +18,6 @@ WARRANTIES, see the file, "license.txt," in this distribution.
class xplay:
public xinter
{
-// FLEXT_HEADER_S(xplay,xinter,setup)
FLEXT_HEADER(xplay,xinter)
public:
@@ -34,8 +33,6 @@ public:
virtual V m_print();
private:
-// static V setup(t_class *c);
-
virtual V m_signal(I n,S *const *in,S *const *out)
{
bufchk();
@@ -45,14 +42,6 @@ private:
FLEXT_LIB_DSP_V("xplay~",xplay)
-/*
-V xplay::setup(t_class *)
-{
-#ifndef PD
- post("loaded xplay~ - part of xsample objects, version " XSAMPLE_VERSION " - (C) Thomas Grill, 2001-2002");
-#endif
-}
-*/
xplay::xplay(I argc,const t_atom *argv)
{
diff --git a/externals/grill/xsample/source/record.cpp b/externals/grill/xsample/source/record.cpp
index d3ce5cee..318e01d2 100644
--- a/externals/grill/xsample/source/record.cpp
+++ b/externals/grill/xsample/source/record.cpp
@@ -18,8 +18,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
class xrecord:
public xsample
{
-// FLEXT_HEADER_S(xrecord,xsample,setup)
- FLEXT_HEADER(xrecord,xsample)
+ FLEXT_HEADER_S(xrecord,xsample,setup)
public:
xrecord(I argc,const t_atom *argv);
@@ -67,7 +66,7 @@ protected:
V outputmax() { ToOutFloat(outmax,curmax*s2u); }
private:
-// static V setup(t_class *c);
+ static V setup(t_class *c);
virtual V s_dsp();
@@ -97,14 +96,21 @@ private:
FLEXT_LIB_DSP_V("xrecord~",xrecord)
-/*
-V xrecord::setup(t_class *)
+
+V xrecord::setup(t_class *c)
{
-#ifndef PD
- post("loaded xrecord~ - part of xsample objects, version " XSAMPLE_VERSION " - (C) Thomas Grill, 2001-2002");
-#endif
+ FLEXT_CADDMETHOD_F(c,0,"pos",m_pos);
+ FLEXT_CADDMETHOD_F(c,0,"min",m_min);
+ FLEXT_CADDMETHOD_F(c,0,"max",m_max);
+ FLEXT_CADDMETHOD_(c,0,"all",m_all);
+
+ FLEXT_CADDMETHOD_(c,0,"draw",m_draw);
+
+ FLEXT_CADDATTR_VAR1(c,"loop",doloop);
+ FLEXT_CADDATTR_VAR1(c,"mixmode",mixmode);
+ FLEXT_CADDATTR_VAR1(c,"sigmode",sigmode);
+ FLEXT_CADDATTR_VAR(c,"append",appmode,m_append);
}
-*/
xrecord::xrecord(I argc,const t_atom *argv):
dorec(false),
@@ -144,19 +150,8 @@ xrecord::xrecord(I argc,const t_atom *argv):
AddOutFloat(2); // min & max
AddOutBang(); // loop bang
- FLEXT_ADDMETHOD_F(0,"pos",m_pos);
FLEXT_ADDMETHOD(inchns+1,m_min);
FLEXT_ADDMETHOD(inchns+2,m_max);
- FLEXT_ADDMETHOD_F(0,"min",m_min);
- FLEXT_ADDMETHOD_F(0,"max",m_max);
- FLEXT_ADDMETHOD_(0,"all",m_all);
-
- FLEXT_ADDMETHOD_(0,"draw",m_draw);
-
- FLEXT_ADDATTR_VAR1("loop",doloop);
- FLEXT_ADDATTR_VAR1("mixmode",mixmode);
- FLEXT_ADDATTR_VAR1("sigmode",sigmode);
- FLEXT_ADDATTR_VAR("append",appmode,m_append);
}