aboutsummaryrefslogtreecommitdiff
path: root/externals
diff options
context:
space:
mode:
Diffstat (limited to 'externals')
-rw-r--r--externals/grill/flext/changes.txt1
-rw-r--r--externals/grill/flext/source/flattr.cpp16
-rw-r--r--externals/grill/flext/source/flattr_ed.cpp24
-rw-r--r--externals/grill/flext/source/flbase.cpp37
-rw-r--r--externals/grill/flext/source/flbase.h9
-rw-r--r--externals/grill/flext/source/flclass.h2
-rwxr-xr-xexternals/grill/flext/source/fllib.cpp22
7 files changed, 90 insertions, 21 deletions
diff --git a/externals/grill/flext/changes.txt b/externals/grill/flext/changes.txt
index 066011b6..207bb364 100644
--- a/externals/grill/flext/changes.txt
+++ b/externals/grill/flext/changes.txt
@@ -32,6 +32,7 @@ Version history:
- explicit boolean attributes (great for attribute editor layout!)
- added flext::NewLarge and flext::FreeLarge memory allocation functions which use the C-Library heap and should mainly be used in secondary threads
- flext_dsp reported wrong inlet/outlet count (CntInSig, CntOutSig functions)
+- added support for patcher arguments for attributes (use # instead of $ to save them with a patch)
0.4.4:
- fixed deadly bug for Max/MSP method-to-symbol-binding proxies
diff --git a/externals/grill/flext/source/flattr.cpp b/externals/grill/flext/source/flattr.cpp
index 6a8dafeb..10c46af0 100644
--- a/externals/grill/flext/source/flattr.cpp
+++ b/externals/grill/flext/source/flattr.cpp
@@ -14,6 +14,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include "flext.h"
#include <string.h>
+#include <ctype.h>
#include <set>
@@ -223,7 +224,6 @@ bool flext_base::SetAttrib(AttrItem *a,int argc,const t_atom *argv)
if(a->fun) {
bool ok = true;
- AtomList la;
t_any any;
switch(a->argtp) {
case a_float:
@@ -242,7 +242,7 @@ bool flext_base::SetAttrib(AttrItem *a,int argc,const t_atom *argv)
break;
case a_symbol:
if(argc == 1 && IsSymbol(argv[0])) {
- any.st = GetSymbol(argv[0]);
+ any.st = const_cast<t_symbol *>(GetParamSym(GetSymbol(argv[0]),thisCanvas()));
((methfun_1)a->fun)(this,any);
}
else ok = false;
@@ -254,10 +254,18 @@ bool flext_base::SetAttrib(AttrItem *a,int argc,const t_atom *argv)
}
else ok = false;
break;
- case a_LIST:
- any.vt = &(la(argc,argv));
+ case a_LIST: {
+ AtomList la(argc);
+ for(int i = 0; i < argc; ++i)
+ if(IsSymbol(argv[i]))
+ SetSymbol(la[i],GetParamSym(GetSymbol(argv[i]),thisCanvas()));
+ else
+ la[i] = argv[i];
+
+ any.vt = &la;
((methfun_1)a->fun)(this,any);
break;
+ }
default:
ERRINTERNAL();
}
diff --git a/externals/grill/flext/source/flattr_ed.cpp b/externals/grill/flext/source/flattr_ed.cpp
index 2153a485..fddbb69b 100644
--- a/externals/grill/flext/source/flattr_ed.cpp
+++ b/externals/grill/flext/source/flattr_ed.cpp
@@ -467,9 +467,6 @@ void flext_base::cb_GfxSave(t_gobj *c, t_binbuf *b)
AtomList la;
th->ListAttrib(la);
cnt = la.Count();
- char attrname[100];
- *attrname= '@';
-
for(int i = 0; i < cnt; ++i) {
const t_symbol *sym = GetSymbol(la[i]);
@@ -479,8 +476,26 @@ void flext_base::cb_GfxSave(t_gobj *c, t_binbuf *b)
if(it != th->attrdata->end()) {
const AttrData &a = it->second;
- if(a.IsInit() && a.IsInitValue())
+ if(a.IsInit() && a.IsInitValue()) {
lref = &a.GetInitValue();
+/*
+ // check for $-parameters
+ lv = lref->Count();
+ for(int j = 0; j < lref->Count(); ++j) {
+ const char *s = IsSymbol((*lref)[j])?GetString((*lref)[j]):NULL;
+ if(s && s[0] == '$') { // TODO: More refined checking?
+ // prepend a "\"
+ char tmp[256]; *tmp = '\\';
+ strcpy(tmp+1,s);
+ SetString(lv[j],tmp);
+ }
+ else
+ lv[i] = (*lref)[j];
+ }
+
+ lref = &lv;
+*/
+ }
else if(a.IsSaved()) {
AttrItem *attr = th->FindAttrib(sym,true);
@@ -493,6 +508,7 @@ void flext_base::cb_GfxSave(t_gobj *c, t_binbuf *b)
}
if(lref) {
+ char attrname[256]; *attrname= '@';
// store name
strcpy(attrname+1,GetString(sym));
binbuf_addv(b,"s",MakeSymbol(attrname));
diff --git a/externals/grill/flext/source/flbase.cpp b/externals/grill/flext/source/flbase.cpp
index 525cb294..bbd4cc1c 100644
--- a/externals/grill/flext/source/flbase.cpp
+++ b/externals/grill/flext/source/flbase.cpp
@@ -17,6 +17,19 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include "flext.h"
#include "flinternal.h"
#include <string.h>
+#include <ctype.h>
+
+#if FLEXT_SYS == FLEXT_SYS_PD
+#ifdef _MSC_VER
+ #pragma warning (push)
+ #pragma warning (disable:4091)
+#endif
+#include <g_canvas.h>
+#ifdef _MSC_VER
+ #pragma warning (pop)
+#endif
+#endif
+
/////////////////////////////////////////////////////////
//
@@ -82,7 +95,27 @@ void flext_obj::DefineHelp(t_classid c,const char *ref,const char *dir,bool addt
#endif
}
+const t_symbol *flext_obj::GetParamSym(const t_symbol *sym,t_canvas *c)
+{
+ if(!c) c = canvas_getcurrent();
-
-
+#if FLEXT_SYS == FLEXT_SYS_PD
+ const char *s = GetString(sym);
+ if((s[0] == '$' || s[0] == '#') && isdigit(s[1])) {
+ // patcher parameter detected... get value!
+ if(s[0] != '$') {
+ char tmp[MAXPDSTRING];
+ strcpy(tmp,s);
+ tmp[0] = '$';
+ return canvas_realizedollar(c,const_cast<t_symbol *>(MakeSymbol(tmp)));
+ }
+ else
+ return canvas_realizedollar(c,const_cast<t_symbol *>(sym));
+ }
+ else
+#else
+ #pragma warning("Not implemented")
+#endif
+ return sym;
+}
diff --git a/externals/grill/flext/source/flbase.h b/externals/grill/flext/source/flbase.h
index 0587f919..789a0855 100644
--- a/externals/grill/flext/source/flbase.h
+++ b/externals/grill/flext/source/flbase.h
@@ -136,7 +136,7 @@ class FLEXT_SHARE FLEXT_CLASSDEF(flext_obj):
*/
//! Get the object's canvas
- t_canvas *thisCanvas() { return m_canvas; }
+ t_canvas *thisCanvas() const { return m_canvas; }
//! Get the PD or Max/MSP object
t_sigobj *thisHdr() { return &x_obj->obj; }
@@ -205,7 +205,7 @@ class FLEXT_SHARE FLEXT_CLASSDEF(flext_obj):
protected:
//! The object header
- flext_hdr *x_obj;
+ mutable flext_hdr *x_obj;
//! Flag for attribute procession
bool procattr;
@@ -215,7 +215,7 @@ class FLEXT_SHARE FLEXT_CLASSDEF(flext_obj):
private:
//! The canvas (patcher) that the object is in
- t_canvas *m_canvas;
+ mutable t_canvas *m_canvas;
//! Flag for successful object construction
bool init_ok;
@@ -258,6 +258,9 @@ class FLEXT_SHARE FLEXT_CLASSDEF(flext_obj):
static void obj_free(flext_hdr *o);
#endif
+ //! Convert $0 or #0 symbol into appropriate value
+ static const t_symbol *GetParamSym(const t_symbol *s,t_canvas *c);
+
//! @} FLEXT_O_INTERNAL
//! @} FLEXT_OBJCLASS
diff --git a/externals/grill/flext/source/flclass.h b/externals/grill/flext/source/flclass.h
index 20f5117c..6bdd55d5 100644
--- a/externals/grill/flext/source/flclass.h
+++ b/externals/grill/flext/source/flclass.h
@@ -450,7 +450,7 @@ public:
//! @} FLEXT_C_BIND
-// --- thread stuff -----------------------------------------------
+ // --- thread stuff -----------------------------------------------
#ifdef FLEXT_THREADS
/*! \defgroup FLEXT_C_THREAD Thread handling
diff --git a/externals/grill/flext/source/fllib.cpp b/externals/grill/flext/source/fllib.cpp
index e1fc89c1..65d71cc5 100755
--- a/externals/grill/flext/source/fllib.cpp
+++ b/externals/grill/flext/source/fllib.cpp
@@ -363,18 +363,18 @@ flext_hdr *flext_obj::obj_new(const t_symbol *s,int _argc_,t_atom *argv)
switch(lo->argv[i]) {
#if FLEXT_SYS != FLEXT_SYS_PD
case FLEXTTPN_INT:
- if(flext::IsInt(argv[i])) args[i] = argv[i];
+ if(IsInt(argv[i])) args[i] = argv[i];
else if(flext::IsFloat(argv[i])) flext::SetInt(args[i],(int)flext::GetFloat(argv[i]));
else ok = false;
break;
#endif
case FLEXTTPN_FLOAT:
- if(flext::IsInt(argv[i])) flext::SetFloat(args[i],(float)flext::GetInt(argv[i]));
+ if(IsInt(argv[i])) flext::SetFloat(args[i],(float)flext::GetInt(argv[i]));
else if(flext::IsFloat(argv[i])) args[i] = argv[i];
else ok = false;
break;
case FLEXTTPN_SYM:
- if(flext::IsSymbol(argv[i])) args[i] = argv[i];
+ if(IsSymbol(argv[i])) SetSymbol(args[i],GetParamSym(GetSymbol(argv[i]),NULL));
else ok = false;
break;
}
@@ -411,10 +411,18 @@ flext_hdr *flext_obj::obj_new(const t_symbol *s,int _argc_,t_atom *argv)
// get actual flext object (newfun calls "new flext_obj()")
if(lo->argc >= 0)
- // for interpreted arguments
+ // for interpreted arguments (patcher parameters have already been converted)
obj->data = lo->newfun(lo->argc,args);
- else
- obj->data = lo->newfun(argc,(t_atom *)argv);
+ else {
+ // convert eventual patcher parameters
+ for(int i = 0; i < argc; ++i)
+ if(IsSymbol(argv[i]))
+ SetSymbol(args[i],GetParamSym(GetSymbol(argv[i]),NULL));
+ else
+ args[i] = argv[i];
+
+ obj->data = lo->newfun(argc,args);
+ }
flext_obj::m_holder = NULL;
flext_obj::m_holdname = NULL;
@@ -450,7 +458,7 @@ flext_hdr *flext_obj::obj_new(const t_symbol *s,int _argc_,t_atom *argv)
#ifdef FLEXT_DEBUG
else
#if FLEXT_SYS == FLEXT_SYS_MAX
- // in Max/MSP an object with the name of the library exists, even if not explicitely declared!
+ // in Max/MSP an object with the name of the library exists, even if not explicitly declared!
if(s != lib_name)
#endif
error("Class %s not found in library!",s->s_name);