aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext
diff options
context:
space:
mode:
Diffstat (limited to 'externals/grill/flext')
-rw-r--r--externals/grill/flext/source/flattr.cpp77
-rw-r--r--externals/grill/flext/source/flattr_ed.cpp365
-rw-r--r--externals/grill/flext/source/flbind.cpp18
-rw-r--r--externals/grill/flext/source/flclass.h130
-rw-r--r--externals/grill/flext/source/flext.cpp10
-rwxr-xr-xexternals/grill/flext/source/flitem.cpp40
-rwxr-xr-xexternals/grill/flext/source/flmeth.cpp14
-rwxr-xr-xexternals/grill/flext/source/flmsg.cpp28
8 files changed, 420 insertions, 262 deletions
diff --git a/externals/grill/flext/source/flattr.cpp b/externals/grill/flext/source/flattr.cpp
index 660743f5..97c1dd34 100644
--- a/externals/grill/flext/source/flattr.cpp
+++ b/externals/grill/flext/source/flattr.cpp
@@ -22,43 +22,43 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#define STD
#endif
-flext_base::attritem::attritem(const t_symbol *t,metharg tp,methfun f,int fl):
- item(t,0,NULL),
+flext_base::AttrItem::AttrItem(const t_symbol *t,metharg tp,methfun f,int fl):
+ Item(t,0,NULL),
flags(fl),argtp(tp),fun(f)
{}
-flext_base::attritem::~attritem()
+flext_base::AttrItem::~AttrItem()
{
// if(nxt) delete nxt;
}
//! Add get and set attributes
-void flext_base::AddAttrib(itemarr *aa,itemarr *ma,const char *attr,metharg tp,methfun gfun,methfun sfun)
+void flext_base::AddAttrib(ItemCont *aa,ItemCont *ma,const char *attr,metharg tp,methfun gfun,methfun sfun)
{
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,attritem::afl_bothexist|attritem::afl_set);
+ AttrItem *a = new AttrItem(asym,tp,sfun,AttrItem::afl_bothexist|AttrItem::afl_set);
aa->Add(a);
// bind attribute to a method
- methitem *mi = new methitem(0,asym,a);
+ MethItem *mi = new MethItem(0,asym,a);
mi->SetArgs(sfun,1,new metharg(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,attritem::afl_bothexist|attritem::afl_get);
+ AttrItem *a = new AttrItem(asym,tp,gfun,AttrItem::afl_bothexist|AttrItem::afl_get);
aa->Add(a);
static char tmp[256] = "get";
strcpy(tmp+3,attr);
// bind attribute to a method
- methitem *mi = new methitem(0,MakeSymbol(tmp),a);
+ MethItem *mi = new MethItem(0,MakeSymbol(tmp),a);
mi->SetArgs(gfun,0,NULL);
ma->Add(mi);
}
@@ -92,12 +92,11 @@ int flext_base::ListAttrib(AtomList &la) const
int ix = 0;
for(int i = 0; i <= 1; ++i) {
- itemarr *a = i?attrhead:clattrhead;
+ ItemCont *a = i?attrhead:clattrhead;
if(a) {
for(int ai = 0; ai < a->Size(); ++ai) {
- for(item *l = a->Item(ai); l; l = l->nxt)
- {
- attritem *aa = (attritem *)l;
+ for(Item *l = a->GetItem(ai); l; l = l->nxt) {
+ AttrItem *aa = (AttrItem *)l;
// only list once!
if(!aa->BothExist() || aa->IsGet())
@@ -119,12 +118,11 @@ int flext_base::ListMethods(AtomList &la,int inlet) const
int ix = 0;
for(int i = 0; i <= 1; ++i) {
- itemarr *a = i?methhead:clmethhead;
+ ItemCont *a = i?methhead:clmethhead;
if(a) {
for(int ai = 0; ai < a->Size(); ++ai) {
- for(item *l = a->Item(ai); l; l = l->nxt)
- {
- methitem *aa = (methitem *)l;
+ for(Item *l = a->GetItem(ai); l; l = l->nxt) {
+ MethItem *aa = (MethItem *)l;
// match inlet and see that it's not related to an attribute
if(aa->inlet == inlet && !aa->IsAttr())
@@ -156,10 +154,17 @@ bool flext_base::InitAttrib(int argc,const t_atom *argv)
if(IsString(argv[nxt]) && *GetString(argv[nxt]) == '@') break;
const t_symbol *tag = MakeSymbol(GetString(argv[cur])+1);
- attritem *attr = FindAttrib(tag,false,true);
+
+ // find puttable attribute
+ AttrItem *attr = FindAttrib(tag,false,true);
if(attr) {
- if(SetAttrib(attr,nxt-cur-1,argv+cur+1))
- SetAttribSave(attr,true);
+ // make an entry (there are none beforehand...)
+ AttrData &a = (*attrdata)[tag];
+ a.SetInit(true);
+ a.SetInitValue(nxt-cur-1,argv+cur+1);
+
+ // pass value to object
+ SetAttrib(attr,a.GetInitValue());
}
}
return true;
@@ -197,16 +202,16 @@ bool flext_base::cb_ListMethods(flext_base *c,int argc,const t_atom *argv)
return false;
}
-flext_base::attritem *flext_base::FindAttrib(const t_symbol *tag,bool get,bool msg) const
+flext_base::AttrItem *flext_base::FindAttrib(const t_symbol *tag,bool get,bool msg) const
{
// first search within object scope
- attritem *a = (attritem *)attrhead->Find(tag);
- while(a && (a->tag != tag || a->inlet != 0 || (get?a->IsSet():a->IsGet()))) a = (attritem *)a->nxt;
+ AttrItem *a = (AttrItem *)attrhead->Find(tag);
+ while(a && (a->tag != tag || a->inlet != 0 || (get?a->IsSet():a->IsGet()))) a = (AttrItem *)a->nxt;
// then (if nothing found) search within class scope
if(!a) {
- a = (attritem *)clattrhead->Find(tag);
- while(a && (a->tag != tag || a->inlet != 0 || (get?a->IsSet():a->IsGet()))) a = (attritem *)a->nxt;
+ a = (AttrItem *)clattrhead->Find(tag);
+ while(a && (a->tag != tag || a->inlet != 0 || (get?a->IsSet():a->IsGet()))) a = (AttrItem *)a->nxt;
}
if(!a && msg) {
@@ -219,14 +224,14 @@ flext_base::attritem *flext_base::FindAttrib(const t_symbol *tag,bool get,bool m
bool flext_base::SetAttrib(const t_symbol *tag,int argc,const t_atom *argv)
{
// search for matching attribute
- attritem *a = FindAttrib(tag,false,true);
+ AttrItem *a = FindAttrib(tag,false,true);
if(a)
return SetAttrib(a,argc,argv);
else
return true;
}
-bool flext_base::SetAttrib(attritem *a,int argc,const t_atom *argv)
+bool flext_base::SetAttrib(AttrItem *a,int argc,const t_atom *argv)
{
if(a->fun) {
bool ok = true;
@@ -272,7 +277,7 @@ bool flext_base::SetAttrib(attritem *a,int argc,const t_atom *argv)
}
-bool flext_base::GetAttrib(attritem *a,AtomList &la) const
+bool flext_base::GetAttrib(AttrItem *a,AtomList &la) const
{
bool ok = true;
// main attribute tag
@@ -320,7 +325,7 @@ bool flext_base::GetAttrib(attritem *a,AtomList &la) const
return ok;
}
-bool flext_base::GetAttrib(attritem *a)
+bool flext_base::GetAttrib(AttrItem *a)
{
AtomList la;
bool ret = GetAttrib(a,la);
@@ -330,25 +335,13 @@ bool flext_base::GetAttrib(attritem *a)
bool flext_base::GetAttrib(const t_symbol *s,AtomList &a) const
{
- attritem *attr = FindAttrib(s,true);
+ AttrItem *attr = FindAttrib(s,true);
return attr && GetAttrib(attr,a);
}
bool flext_base::DumpAttrib(const t_symbol *attr) const
{
- attritem *item = FindAttrib(attr,true);
+ AttrItem *item = FindAttrib(attr,true);
return item && const_cast<flext_base *>(this)->GetAttrib(item);
}
-
-void flext_base::SetAttribSave(attritem *a,bool save)
-{
- a->SetSave(save);
- if(a->BothExist()) {
- // find opposite attribute item
- attritem *b = FindAttrib(a->tag,!a->IsGet());
- FLEXT_ASSERT(b != NULL);
-
- b->SetSave(save);
- }
-}
diff --git a/externals/grill/flext/source/flattr_ed.cpp b/externals/grill/flext/source/flattr_ed.cpp
index 4f851f36..be86e04a 100644
--- a/externals/grill/flext/source/flattr_ed.cpp
+++ b/externals/grill/flext/source/flattr_ed.cpp
@@ -21,6 +21,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#endif
// This is problematic... non-public headers!
+// compilation may be specific for one version of PD!!
#include <m_imp.h>
#include <g_canvas.h>
@@ -56,33 +57,45 @@ void flext_base::SetAttrEditor(t_classid c)
// make a list of the attribute values (including save flags)
"set lst {}\n"
- "for {set ix 0} {$ix < $alen} {incr ix} {\n"
+ "for {set ix 1} {$ix <= $alen} {incr ix} {\n"
"set var_attr_name [concat [concat var_name_$ix]_$vid ]\n"
"global $var_attr_name\n"
+ "set var_attr_init [concat [concat var_init_$ix]_$vid ]\n"
+ "global $var_attr_init\n"
"set var_attr_val [concat [concat var_val_$ix]_$vid ]\n"
"global $var_attr_val\n"
"set var_attr_save [concat [concat var_save_$ix]_$vid ]\n"
"global $var_attr_save\n"
"lappend lst [eval concat $$var_attr_name]\n"
- // see if it's a list
+
+ // process current value
"set len [llength [expr $$var_attr_val]]\n"
+ // see if it's a list
"if { $len > 1 } {\n"
- "set lst [concat $lst \"list\" $len [expr $$var_attr_val]]\n"
+ "set lst [concat $lst {list} $len [expr $$var_attr_val]]\n"
"} else {\n"
"lappend lst [expr $$var_attr_val]\n"
"}\n"
+
+ // process init value
+ "set len [llength [expr $$var_attr_init]]\n"
+ // see if it's a list
+ "if { $len > 1 } {\n"
+ "set lst [concat $lst {list} $len [expr $$var_attr_init]]\n"
+ "} else {\n"
+ "lappend lst [expr $$var_attr_init]\n"
+ "}\n"
+
"lappend lst [eval concat $$var_attr_save]\n"
"}\n"
"set cmd [concat $id attributedialog $lst \\;]\n"
- // puts stderr $cmd
"pd $cmd\n"
"}\n"
"proc flext_cancel {id} {\n"
"set cmd [concat $id cancel \\;]\n"
- // puts stderr $cmd
"pd $cmd\n"
"}\n"
@@ -91,43 +104,61 @@ void flext_base::SetAttrEditor(t_classid c)
"flext_cancel $id\n"
"}\n"
- "proc pdtk_flext_dialog {id attrlist} {\n"
+ "proc flext_copyval {dst src} {\n"
+ "global $src\n"
+ "global $dst\n"
+ "set $dst [expr $$src]\n"
+ "}\n"
+
+ "proc pdtk_flext_dialog {id title attrlist} {\n"
"set vid [string trimleft $id .]\n"
- "set alen [expr [llength $attrlist] / 4 ]\n"
+ "set alen [expr [llength $attrlist] / 5 ]\n"
"toplevel $id\n"
- "wm title $id {object attributes}\n"
+ "wm title $id $title\n"
"wm protocol $id WM_DELETE_WINDOW [concat flext_cancel $id]\n"
-/*
- "label $id.label -text {Attributes}\n"
- "pack $id.label -side top\n"
-*/
- "set ix 0\n"
- "foreach {an av asv afl} $attrlist {\n"
- // generate variable name
- "set nm [concat $id.nm-$ix]\n"
+ "set row 0\n"
+ // set column labels
+ "label $id.label -text {attribute} -height 2 -font {Helvetica 9 bold}\n"
+ "label $id.init -text {initial value} -height 2 -font {Helvetica 9 bold}\n"
+ "label $id.copy -text {copy} -height 2 -font {Helvetica 9 bold}\n"
+ "label $id.val -text {current value} -height 2 -font {Helvetica 9 bold}\n"
+ "foreach {i txt} {0 {don't\rsave} 1 {do\rinit} 2 {always\rsave} } {\n"
+ "label $id.b$i -text $txt -height 2 -font {Helvetica 9 bold}\n"
+ "}\n"
+// "label $id.options -text {options} -height 2\n"
+
+ "grid config $id.label -column 0 -row $row \n"
+ "grid config $id.init -column 1 -row $row \n"
+ "grid config $id.copy -column 2 -columnspan 2 -row $row \n"
+ "grid config $id.val -column 4 -row $row \n"
+ "foreach i {0 1 2} { grid config $id.b$i -column [expr $i + 5] -row $row }\n"
+// "grid config $id.options -column 3 -row 0 \n"
+ "incr row\n"
+
+ // Separator
+ "frame $id.sep -relief ridge -bd 1 -height 2\n"
+ "grid config $id.sep -column 0 -columnspan 8 -row $row -pady 2 -sticky {snew}\n"
+ "incr row\n"
+
+ "set ix 1\n"
+ "foreach {an av ai asv afl} $attrlist {\n"
// get attribute name
"set var_attr_name [concat [concat var_name_$ix]_$vid ]\n"
"global $var_attr_name\n"
"set $var_attr_name $an\n"
+ // get attribute init value (list)
+ "set var_attr_init [concat [concat var_init_$ix]_$vid ]\n"
+ "global $var_attr_init\n"
+ "set $var_attr_init $ai\n"
+
// get attribute value (list)
"set var_attr_val [concat [concat var_val_$ix]_$vid ]\n"
"global $var_attr_val\n"
-
- // format value list
- "set $var_attr_val {}\n"
- "foreach i $av {\n"
- "if { [string is double $i] } {\n"
- // it's a number.. take as many digits as necessary
- "lappend $var_attr_val [format %g $i]\n"
- "} else {\n"
- // it's a string, append unchanged
- "lappend $var_attr_val $i\n"
- "}\n"
- "}\n"
+ "set $var_attr_val $av\n"
// get save flag
"set var_attr_save [concat [concat var_save_$ix]_$vid ]\n"
@@ -135,90 +166,150 @@ void flext_base::SetAttrEditor(t_classid c)
"set $var_attr_save $asv\n"
// add dialog elements to window
- "frame $nm\n"
- "pack $nm -side top\n"
- "label $nm.lwidth -text \"$an :\"\n"
- "entry $nm.width -textvariable $var_attr_val -width 20\n"
- "bind $nm.width <KeyPress-Return> [concat flext_ok $id $alen]\n"
-
- "foreach i {0 1 2} { radiobutton $nm.b$i -value $i -variable $var_attr_save }\n"
- "pack $nm.lwidth $nm.width $nm.b0 $nm.b1 $nm.b2 -side left\n"
+ // attribute label
+ "label $id.label-$ix -text \"$an :\" -font {Helvetica 8 bold}\n"
+ "grid config $id.label-$ix -column 0 -row $row -padx 5 -sticky {e}\n"
+ // entry field for initial value
+ "entry $id.init-$ix -textvariable $var_attr_init\n"
+ "grid config $id.init-$ix -column 1 -row $row -padx 5 -sticky {ew}\n"
+
+ "button $id.b2i-$ix -text {<-} -height 1 -command \" flext_copyval $var_attr_init $var_attr_val \"\n"
+ "grid config $id.b2i-$ix -column 2 -row $row -sticky {ew}\n"
+ "button $id.b2c-$ix -text {->} -height 1 -command \" flext_copyval $var_attr_val $var_attr_init \"\n"
+ "grid config $id.b2c-$ix -column 3 -row $row -sticky {ew}\n"
+
+ // entry field for current value
+ "entry $id.val-$ix -textvariable $var_attr_val\n"
+ "grid config $id.val-$ix -column 4 -row $row -padx 5 -sticky {ew}\n"
+
+// "tk_optionMenu $id.opt-$ix $var_attr_save {don't save} {initialize} {always save}\n"
+// "grid config $id.opt-$ix -column 5 -row $ix \n"
+
+ // radiobuttons
+ "foreach {i c} {0 black 1 blue 2 red} {\n"
+ "radiobutton $id.b$i-$ix -value $i -foreground $c -variable $var_attr_save \n"
+ "grid config $id.b$i-$ix -column [expr $i + 5] -row $row \n"
+ "}\n"
// increase counter
"incr ix\n"
+ "incr row\n"
"}\n"
-// "focus $id.1-rangef.width\n"
-
+ // Separator
+ "frame $id.sep2 -relief ridge -bd 1 -height 2\n"
+ "grid config $id.sep2 -column 0 -columnspan 8 -row $row -pady 5 -sticky {snew}\n"
+ "incr row\n"
// Buttons
-
"frame $id.buttonframe\n"
- "pack $id.buttonframe -side bottom -fill x -pady 2m\n"
+ "pack $id.buttonframe -side bottom -fill x\n"
- "button $id.buttonframe.cancel -text {Cancel} -command \"flext_cancel $id\"\n"
- "button $id.buttonframe.apply -text {Apply} -command \"flext_apply $id $alen\"\n"
- "button $id.buttonframe.ok -text {OK} -command \"flext_ok $id $alen\"\n"
+ "button $id.buttonframe.cancel -text {Cancel} -width 20 -command \" flext_cancel $id \"\n"
+ "button $id.buttonframe.apply -text {Apply} -width 20 -command \" flext_apply $id $alen \"\n"
+ "button $id.buttonframe.ok -text {OK} -width 20 -command \" flext_ok $id $alen \"\n"
"pack $id.buttonframe.cancel -side left -expand 1\n"
"pack $id.buttonframe.apply -side left -expand 1\n"
"pack $id.buttonframe.ok -side left -expand 1\n"
+ "grid config $id.buttonframe -column 0 -columnspan 8 -row $row -pady 5 -sticky {ew}\n"
+
+ // Key bindings
+ "bind $id {<KeyPress-Escape>} \" flext_cancel $id \"\n"
+ "bind $id {<KeyPress-Return>} \" flext_ok $id $alen \"\n"
+ "bind $id {<Shift-KeyPress-Return>} \" flext_apply $id $alen \"\n"
"}\n"
);
}
+static int PrintList(char *buf,int argc,const t_atom *argv)
+{
+ char *b = buf;
+ for(int j = 0; j < argc; ++j) {
+ const t_atom &at = argv[j];
+ if(flext::IsString(at))
+ STD::sprintf(b,"%s",flext::GetString(at));
+ else if(flext::IsFloat(at))
+ STD::sprintf(b,"%g",flext::GetFloat(at));
+ else if(flext::IsInt(at))
+ STD::sprintf(b,"%i",flext::GetInt(at));
+ else
+ FLEXT_ASSERT(false);
+ b += strlen(b);
+
+ if(j < argc-1) *(b++) = ' ';
+ }
+ return b-buf;
+}
void flext_base::cb_GfxProperties(t_gobj *c, t_glist *)
{
flext_base *th = thisObject(c);
- char buf[1000],*b = buf;
+ char buf[10000],*b = buf;
+
+ STD::sprintf(b, "pdtk_flext_dialog %%s { "); b += strlen(b);
+
+ t_text *x = (t_text *)c;
+ FLEXT_ASSERT(x->te_binbuf);
+
+ int argc = binbuf_getnatom(x->te_binbuf);
+ t_atom *argv = binbuf_getvec(x->te_binbuf);
+ b += PrintList(b,argc,argv);
+
+ STD::sprintf(b, " } { "); b += strlen(b);
AtomList la;
int cnt = th->ListAttrib(la);
- STD::sprintf(b, "pdtk_flext_dialog %%s { "); b += strlen(b);
-
for(int i = 0; i < cnt; ++i) {
- STD::sprintf(b,"%s {",GetString(la[i])); b += strlen(b);
+ const t_symbol *sym = GetSymbol(la[i]);
+
+ // get flags
+ int sv;
+ const AtomList *initdata;
+ AttrDataCont::iterator it = th->attrdata->find(sym);
+ if(it == th->attrdata->end())
+ sv = 0,initdata = NULL;
+ else {
+ const AttrData &a = it->second;
+ if(a.IsSaved())
+ sv = 2;
+ else if(a.IsInit())
+ sv = 1;
+ else
+ sv = 0;
+
+ initdata = a.IsInitValue()?&a.GetInitValue():NULL;
+ }
- bool sv;
+ STD::sprintf(b,"%s {",GetString(sym)); b += strlen(b);
// get attribute
- attritem *attr = th->FindAttrib(GetSymbol(la[i]),true);
+ AttrItem *gattr = th->FindAttrib(sym,true);
- if(attr) {
- // Attribute is gettable
-
- // Get attribute value
- AtomList lv;
- th->GetAttrib(attr,lv);
-
- sv = th->GetAttribSave(attr);
-
- for(int j = 0; j < lv.Count(); ++j) {
- if(IsString(lv[j]))
- STD::sprintf(b,"%s",GetString(lv[j]));
- else if(IsFloat(lv[j]))
- STD::sprintf(b,"%f",GetFloat(lv[j]));
- else if(IsInt(lv[j]))
- STD::sprintf(b,"%i",GetInt(lv[j]));
- else
- FLEXT_ASSERT(false);
- b += strlen(b);
-
- if(j < lv.Count()-1) *(b++) = ' ';
- }
+ AtomList lv;
+ if(gattr) { // gettable attribute is present
+ // Retrieve attribute value
+ th->GetAttrib(gattr,lv);
+
+ b += PrintList(b,lv.Count(),lv.Atoms());
}
- else {
- // Attribute is not gettable
- sv = false;
- // \TODO set flag for tcl/tk dialog
+ STD::sprintf(b, "} {"); b += strlen(b);
+
+ // get puttable attribute
+ AttrItem *pattr = th->FindAttrib(GetSymbol(la[i]),false);
+
+ if(pattr) {
+ // if there is initialization data take this, otherwise take the current data
+ const AtomList &lp = initdata?*initdata:lv;
+
+ b += PrintList(b,lp.Count(),lp.Atoms());
}
- STD::sprintf(b, "} %i %i ", sv?1:0,attr?(attr->BothExist()?2:1):0); b += strlen(b);
+ STD::sprintf(b, "} %i %i ", sv,pattr?(pattr->BothExist()?2:1):0); b += strlen(b);
}
strcpy(b, " }\n");
@@ -247,6 +338,18 @@ void flext_base::cb_GfxVis(t_gobj *c, t_glist *gl, int vis)
ori_vis(c,gl,vis);
}
+static void BinbufAdd(t_binbuf *b,const t_atom &at)
+{
+ if(flext::IsString(at))
+ binbuf_addv(b,"s",flext::GetSymbol(at));
+ else if(flext::IsFloat(at))
+ binbuf_addv(b,"f",flext::GetFloat(at));
+ else if(flext::IsInt(at))
+ binbuf_addv(b,"i",flext::GetInt(at));
+ else
+ FLEXT_ASSERT(false);
+}
+
void flext_base::cb_GfxSave(t_gobj *c, t_binbuf *b)
{
flext_base *th = thisObject(c);
@@ -258,16 +361,7 @@ void flext_base::cb_GfxSave(t_gobj *c, t_binbuf *b)
int cnt = CheckAttrib(argc,argv);
// process the creation arguments
- for(int i = 1; i < cnt; ++i) {
- if(IsString(argv[i]))
- binbuf_addv(b,"s",GetSymbol(argv[i]));
- else if(IsFloat(argv[i]))
- binbuf_addv(b,"f",GetFloat(argv[i]));
- else if(IsInt(argv[i]))
- binbuf_addv(b,"i",GetInt(argv[i]));
- else
- FLEXT_ASSERT(false);
- }
+ for(int i = 1; i < cnt; ++i) BinbufAdd(b,argv[i]);
// process the attributes
AtomList la;
@@ -275,28 +369,35 @@ void flext_base::cb_GfxSave(t_gobj *c, t_binbuf *b)
char attrname[100];
*attrname= '@';
- for(int i = 0; i < cnt; ++i) {
- // must be both settable and gettable....
- attritem *attr = th->FindAttrib(GetSymbol(la[i]),true);
- if(attr && attr->BothExist() && th->GetAttribSave(attr)) {
- // Get attribute value
- AtomList lv;
- th->GetAttrib(attr,lv);
+ for(int i = 0; i < cnt; ++i) {
+ const t_symbol *sym = GetSymbol(la[i]);
+ AtomList lv;
+ const AtomList *lref = NULL;
+ AttrDataCont::iterator it = th->attrdata->find(sym);
+
+ if(it != th->attrdata->end()) {
+ const AttrData &a = it->second;
+ if(a.IsInit() && a.IsInitValue())
+ lref = &a.GetInitValue();
+ else if(a.IsSaved()) {
+ AttrItem *attr = th->FindAttrib(sym,true);
+
+ // attribute must be gettable (so that the data can be retrieved) and puttable (so that the data can be inited)
+ if(attr && attr->BothExist()) {
+ th->GetAttrib(attr,lv);
+ lref = &lv;
+ }
+ }
+ }
- strcpy(attrname+1,GetString(la[i]));
+ if(lref) {
+ // store name
+ strcpy(attrname+1,GetString(sym));
binbuf_addv(b,"s",MakeSymbol(attrname));
- for(int j = 0; j < lv.Count(); ++j) {
- if(IsString(lv[j]))
- binbuf_addv(b,"s",GetSymbol(lv[j]));
- else if(IsFloat(lv[j]))
- binbuf_addv(b,"f",GetFloat(lv[j]));
- else if(IsInt(lv[j]))
- binbuf_addv(b,"i",GetInt(lv[j]));
- else
- FLEXT_ASSERT(false);
- }
+ // store value
+ for(int j = 0; j < lref->Count(); ++j) BinbufAdd(b,(*lref)[j]);
}
}
@@ -311,31 +412,68 @@ bool flext_base::cb_AttrDialog(flext_base *th,int argc,const t_atom *argv)
for(; i < argc; ) {
FLEXT_ASSERT(IsSymbol(argv[i]));
+ // get name
const t_symbol *aname = GetSymbol(argv[i]);
i++;
- int cnt,offs;
+ // get current value
+ int ccnt,coffs;
if(IsSymbol(argv[i]) && GetSymbol(argv[i]) == sym_list) {
i++;
FLEXT_ASSERT(CanbeInt(argv[i]));
- cnt = GetAInt(argv[i]);
- offs = ++i;
+ ccnt = GetAInt(argv[i]);
+ coffs = ++i;
}
else
- offs = i,cnt = 1;
+ coffs = i,ccnt = 1;
+ i += ccnt;
- i += cnt;
+ // get init value
+ int icnt,ioffs;
+ if(IsSymbol(argv[i]) && GetSymbol(argv[i]) == sym_list) {
+ i++;
+ FLEXT_ASSERT(CanbeInt(argv[i]));
+ icnt = GetAInt(argv[i]);
+ ioffs = ++i;
+ }
+ else
+ ioffs = i,icnt = 1;
+ i += icnt;
FLEXT_ASSERT(i < argc);
int sv = GetAInt(argv[i]);
++i;
- // find settable attribute
- attritem *attr = th->FindAttrib(aname,false);
+ // find puttable attribute
+ AttrItem *attr = th->FindAttrib(aname,false);
if(attr) {
- th->SetAttribSave(attr,sv != 0);
- bool ret = th->SetAttrib(attr,cnt,argv+offs);
+ bool ret = th->SetAttrib(attr,ccnt,argv+coffs);
FLEXT_ASSERT(ret);
+
+ AttrDataCont::iterator it = th->attrdata->find(aname);
+
+ if(sv >= 1) {
+ // if data not present create it
+ if(it == th->attrdata->end()) {
+ AttrDataPair pair; pair.first = aname;
+ it = th->attrdata->insert(th->attrdata->begin(),pair);
+ }
+
+ AttrData &a = it->second;
+ a.SetSave(sv == 2);
+ a.SetInit(true);
+ a.SetInitValue(icnt,argv+ioffs);
+ }
+ else {
+ if(it != th->attrdata->end()) {
+ AttrData &a = it->second;
+ // if data is present reset flags
+ a.SetSave(false);
+ a.SetInit(false);
+
+ // let init data as is
+ }
+ }
}
else {
post("%s - Attribute %s can't be set",th->thisName(),GetString(aname));
@@ -344,5 +482,4 @@ bool flext_base::cb_AttrDialog(flext_base *th,int argc,const t_atom *argv)
return true;
}
-
#endif // FLEXT_SYS_PD
diff --git a/externals/grill/flext/source/flbind.cpp b/externals/grill/flext/source/flbind.cpp
index 4422eac6..a74ed33b 100644
--- a/externals/grill/flext/source/flbind.cpp
+++ b/externals/grill/flext/source/flbind.cpp
@@ -56,11 +56,11 @@ void flext_base::SetupBindProxy()
}
-flext_base::binditem::binditem(int in,const t_symbol *sym,bool (*f)(flext_base *,t_symbol *s,int,t_atom *,void *data),pxbnd_object *p):
- item(sym,0,NULL),fun(f),px(p)
+flext_base::BindItem::BindItem(int in,const t_symbol *sym,bool (*f)(flext_base *,t_symbol *s,int,t_atom *,void *data),pxbnd_object *p):
+ Item(sym,0,NULL),fun(f),px(p)
{}
-flext_base::binditem::~binditem()
+flext_base::BindItem::~BindItem()
{
if(px) {
#if FLEXT_SYS == FLEXT_SYS_PD
@@ -92,7 +92,7 @@ flext_base::binditem::~binditem()
bool flext_base::BindMethod(const t_symbol *sym,bool (*fun)(flext_base *,t_symbol *s,int argc,t_atom *argv,void *data),void *data)
{
if(!bindhead)
- bindhead = new itemarr;
+ bindhead = new ItemCont;
else {
// Search for symbol
if(bindhead->Find(sym,0)) {
@@ -117,7 +117,7 @@ bool flext_base::BindMethod(const t_symbol *sym,bool (*fun)(flext_base *,t_symbo
#endif
if(px) {
- binditem *mi = new binditem(0,sym,fun,px);
+ BindItem *mi = new BindItem(0,sym,fun,px);
bindhead->Add(mi);
px->init(this,mi,data);
@@ -145,9 +145,9 @@ bool flext_base::UnbindMethod(const t_symbol *sym,bool (*fun)(flext_base *,t_sym
bool ok = false;
if(bindhead) {
- binditem *it = NULL;
+ BindItem *it = NULL;
if(sym) {
- it = (binditem *)bindhead->Find(sym,0);
+ it = (BindItem *)bindhead->Find(sym,0);
while(it) {
if(it->tag == sym && (!fun || it->fun == fun)) break;
}
@@ -157,7 +157,7 @@ bool flext_base::UnbindMethod(const t_symbol *sym,bool (*fun)(flext_base *,t_sym
if(!sz) sz = 1;
for(int i = 0; i < sz; ++i) {
- for(it = (binditem *)bindhead->Item(i); it; it = (binditem *)it->nxt) {
+ for(it = (BindItem *)bindhead->GetItem(i); it; it = (BindItem *)it->nxt) {
if(it->tag == sym && (!fun || it->fun == fun)) break;
}
if(it) break;
@@ -180,7 +180,7 @@ bool flext_base::UnbindAll()
if(!sz) sz = 1;
for(int i = 0; i < sz; ++i) {
- for(binditem *it = (binditem *)bindhead->Item(i); it; it = (binditem *)it->nxt) {
+ for(BindItem *it = (BindItem *)bindhead->GetItem(i); it; it = (BindItem *)it->nxt) {
// if(it->px->data) memleak = true;
if(bindhead->Remove(it)) delete it;
}
diff --git a/externals/grill/flext/source/flclass.h b/externals/grill/flext/source/flclass.h
index 6536590f..689767d2 100644
--- a/externals/grill/flext/source/flclass.h
+++ b/externals/grill/flext/source/flclass.h
@@ -20,6 +20,9 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include "flbase.h"
#include "flsupport.h"
+#include <map>
+#include <set>
+#include <list>
#ifdef _MSC_VER
#pragma warning(disable: 4786)
@@ -573,33 +576,33 @@ protected:
public:
- class attritem;
+ class AttrItem;
- class item {
+ class Item {
public:
- item(const t_symbol *t,int inl,attritem *a);
- virtual ~item();
+ Item(const t_symbol *t,int inl,AttrItem *a);
+ virtual ~Item();
bool IsAttr() const { return attr != NULL; }
const t_symbol *tag;
int inlet;
- attritem *attr;
- item *nxt;
+ AttrItem *attr;
+ Item *nxt;
};
//! This class holds hashed item entries
- class itemarr {
+ class ItemCont {
public:
- itemarr();
- ~itemarr();
+ ItemCont();
+ ~ItemCont();
//! Add an entry
- void Add(item *it);
+ void Add(Item *it);
//! Remove an entry
- bool Remove(item *it);
- //! Find an entry in the item array
- item *Find(const t_symbol *tag,int inlet = 0) const;
+ bool Remove(Item *it);
+ //! Find an entry in the Item array
+ Item *Find(const t_symbol *tag,int inlet = 0) const;
//! Create hash table out of the preliminary linked lists
void Finalize();
@@ -612,22 +615,22 @@ protected:
int Size() const { return bits?1<<bits:0; }
//! Get an array slot
- item *Item(int ix) { return arr[ix]; }
+ Item *GetItem(int ix) { return arr[ix]; }
protected:
//! Calculate a hash value
static int Hash(const t_symbol *,int inlet,int bits);
- item **arr;
+ Item **arr;
int cnt,bits;
};
//! \brief This represents an item of the method list
- class methitem:
- public item {
+ class MethItem:
+ public Item {
public:
- methitem(int inlet,const t_symbol *tg,attritem *conn = NULL);
- virtual ~methitem();
+ MethItem(int inlet,const t_symbol *tg,AttrItem *conn = NULL);
+ virtual ~MethItem();
void SetArgs(methfun fun,int argc,metharg *args);
@@ -637,29 +640,50 @@ protected:
};
//! \brief This represents an item of the attribute list
- class attritem:
- public item {
+ class AttrItem:
+ public Item {
public:
- attritem(const t_symbol *tag,metharg tp,methfun fun,int flags);
- virtual ~attritem();
+ AttrItem(const t_symbol *tag,metharg tp,methfun fun,int flags);
+ virtual ~AttrItem();
enum {
afl_getset = 0x01, afl_get = 0x00, afl_set = 0x01,
afl_bothexist = 0x02,
- afl_save = 0x04
+ afl_save = 0x04,afl_init = 0x08,afl_inited = 0x10
};
bool IsGet() const { return (flags&afl_getset) == afl_get; }
bool IsSet() const { return (flags&afl_getset) == afl_set; }
bool BothExist() const { return (flags&afl_bothexist) != 0; }
- void SetSave(bool s) { if(s) flags |= afl_save; else flags &= ~afl_save; }
- bool IsSaved() const { return (flags&afl_save) != 0; }
int flags;
metharg argtp;
methfun fun;
};
+ //! Represent a data value of an attribute
+ class AttrData
+ {
+ public:
+ enum { afl_save = 0x01,afl_init = 0x02,afl_inited = 0x04 };
+
+ void SetSave(bool s) { if(s) flags |= afl_save; else flags &= ~afl_save; }
+ bool IsSaved() const { return (flags&afl_save) != 0; }
+ void SetInit(bool s) { if(s) flags |= afl_init; else flags &= ~afl_init; }
+ bool IsInit() const { return (flags&afl_init) != 0; }
+ void SetInitValue(int argc,const t_atom *argv) { init(argc,argv); flags |= afl_inited; }
+ void SetInitValue(const AtomList &l) { SetInitValue(l.Count(),l.Atoms()); }
+ bool IsInitValue() const { return (flags&afl_inited) != 0; }
+ const AtomList &GetInitValue() const { return init; }
+
+ AtomList init;
+ int flags;
+ };
+
+ typedef std::map<const t_symbol *,AttrData> AttrDataCont;
+ typedef std::pair<const t_symbol *,AttrData> AttrDataPair;
+
+
// these outlet functions don't check for thread but send directly to the real-time system
void ToSysBang(int n) const;
void ToSysFloat(int n,float f) const;
@@ -674,11 +698,12 @@ private:
public:
//! \brief This represents an item of the symbol-bound method list
- class binditem:
- public item {
+ class BindItem
+ :public Item
+ {
public:
- binditem(int inlet,const t_symbol *sym,bool (*f)(flext_base *,t_symbol *s,int,t_atom *,void *),pxbnd_object *px);
- virtual ~binditem();
+ BindItem(int inlet,const t_symbol *sym,bool (*f)(flext_base *,t_symbol *s,int,t_atom *,void *),pxbnd_object *px);
+ virtual ~BindItem();
bool (*fun)(flext_base *,t_symbol *s,int,t_atom *,void *);
pxbnd_object *px;
@@ -686,15 +711,15 @@ public:
//! @} FLEXT_CLASS
- itemarr *ThMeths() { return methhead; }
- static itemarr *ClMeths(t_classid c) { return GetClassArr(c,0); }
+ ItemCont *ThMeths() { return methhead; }
+ static ItemCont *ClMeths(t_classid c) { return GetClassArr(c,0); }
- static void AddMethod(itemarr *ma,int inlet,const char *tag,methfun fun,metharg tp,...);
+ static void AddMethod(ItemCont *ma,int inlet,const char *tag,methfun fun,metharg tp,...);
- itemarr *ThAttrs() { return attrhead; }
- static itemarr *ClAttrs(t_classid c) { return GetClassArr(c,1); }
+ ItemCont *ThAttrs() { return attrhead; }
+ static ItemCont *ClAttrs(t_classid c) { return GetClassArr(c,1); }
- static void AddAttrib(itemarr *aa,itemarr *ma,const char *attr,metharg tp,methfun gfun,methfun sfun);
+ static void AddAttrib(ItemCont *aa,ItemCont *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_classid c,const char *attr,metharg tp,methfun gfun,methfun sfun);
@@ -732,33 +757,32 @@ private:
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 &);
- static itemarr *GetClassArr(t_classid,int ix);
+ static ItemCont *GetClassArr(t_classid,int ix);
- itemarr *methhead,*clmethhead;
- itemarr *bindhead;
+ ItemCont *methhead,*clmethhead;
+ ItemCont *bindhead;
- bool CallMeth(const methitem &m,int argc,const t_atom *argv);
+ 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);
+ 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;
+ ItemCont *attrhead,*clattrhead;
+ AttrDataCont *attrdata;
- attritem *FindAttrib(const t_symbol *tag,bool get,bool msg = false) const;
+ AttrItem *FindAttrib(const t_symbol *tag,bool get,bool msg = false) const;
static int CheckAttrib(int argc,const t_atom *argv);
bool InitAttrib(int argc,const t_atom *argv);
bool ListMethods(int inlet = 0) const;
bool ListAttrib() const;
- bool GetAttrib(attritem *a);
- bool GetAttrib(attritem *a,AtomList &l) const;
+ bool GetAttrib(AttrItem *a);
+ bool GetAttrib(AttrItem *a,AtomList &l) const;
bool SetAttrib(const t_symbol *s,int argc,const t_atom *argv);
- bool SetAttrib(attritem *a,int argc,const t_atom *argv);
-
- void SetAttribSave(attritem *a,bool save);
- bool GetAttribSave(attritem *a) const { return a->IsSaved(); }
+ bool SetAttrib(AttrItem *a,int argc,const t_atom *argv);
+ bool SetAttrib(AttrItem *a,const AtomList &l) { return SetAttrib(a,l.Count(),l.Atoms()); }
static bool cb_ListMethods(flext_base *c,int argc,const t_atom *argv);
static bool cb_ListAttrib(flext_base *c) { return c->ListAttrib(); }
@@ -839,10 +863,10 @@ private:
public:
t_object obj; // MUST reside at memory offset 0
flext_base *base;
- binditem *item;
+ BindItem *item;
void *data;
- void init(flext_base *b,binditem *it,void *d) { base = b; item = it; data = d; }
+ void init(flext_base *b,BindItem *it,void *d) { base = b; item = it; data = d; }
static void px_method(pxbnd_object *c,const t_symbol *s,int argc,t_atom *argv);
};
diff --git a/externals/grill/flext/source/flext.cpp b/externals/grill/flext/source/flext.cpp
index b75e5472..a6b651aa 100644
--- a/externals/grill/flext/source/flext.cpp
+++ b/externals/grill/flext/source/flext.cpp
@@ -37,16 +37,19 @@ flext_base::FLEXT_CLASSDEF(flext_base)():
t_classid clid = thisClassId();
clmethhead = ClMeths(clid);
- methhead = new itemarr;
+ methhead = new ItemCont;
bindhead = NULL;
if(procattr) {
// initialize when attribute processing is enabled
- attrhead = new itemarr;
+ attrhead = new ItemCont;
clattrhead = ClAttrs(clid);
+ attrdata = new AttrDataCont;
}
- else
+ else {
attrhead = clattrhead = NULL;
+ attrdata = NULL;
+ }
}
flext_base::~FLEXT_CLASSDEF(flext_base)()
@@ -68,6 +71,7 @@ flext_base::~FLEXT_CLASSDEF(flext_base)()
if(methhead) delete methhead;
if(bindhead) delete bindhead; // ATTENTION: the object must free all memory associated to bindings itself
if(attrhead) delete attrhead;
+ if(attrdata) delete attrdata;
// destroy inlets and outlets and their proxy objects
if(inlist) delete inlist;
diff --git a/externals/grill/flext/source/flitem.cpp b/externals/grill/flext/source/flitem.cpp
index 1980f26c..c2b36057 100755
--- a/externals/grill/flext/source/flitem.cpp
+++ b/externals/grill/flext/source/flitem.cpp
@@ -16,23 +16,23 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include <string.h>
-flext_base::item::item(const t_symbol *t,int inl,attritem *a):
+flext_base::Item::Item(const t_symbol *t,int inl,AttrItem *a):
tag(t),inlet(inl),attr(a),nxt(NULL)
{}
-flext_base::item::~item()
+flext_base::Item::~Item()
{
if(nxt) delete nxt;
}
-flext_base::itemarr::itemarr():
- arr(new item *[2]),cnt(0),bits(-1)
+flext_base::ItemCont::ItemCont():
+ arr(new Item *[2]),cnt(0),bits(-1)
{
arr[0] = arr[1] = NULL;
}
-flext_base::itemarr::~itemarr()
+flext_base::ItemCont::~ItemCont()
{
if(Ready()) {
// if finalized, the array has several slots
@@ -47,7 +47,7 @@ flext_base::itemarr::~itemarr()
delete[] arr;
}
-void flext_base::itemarr::Add(item *it)
+void flext_base::ItemCont::Add(Item *it)
{
if(Ready()) {
// retrieve array index
@@ -55,7 +55,7 @@ void flext_base::itemarr::Add(item *it)
// add to array slot
if(arr[ix]) {
- item *a = arr[ix];
+ Item *a = arr[ix];
while(a->nxt) a = a->nxt;
a->nxt = it;
}
@@ -72,7 +72,7 @@ void flext_base::itemarr::Add(item *it)
}
}
-bool flext_base::itemarr::Remove(item *it)
+bool flext_base::ItemCont::Remove(Item *it)
{
if(Ready()) {
// retrieve array index
@@ -80,7 +80,7 @@ bool flext_base::itemarr::Remove(item *it)
// remove from array slot
if(arr[ix]) {
- item *a1 = NULL,*a = arr[ix];
+ Item *a1 = NULL,*a = arr[ix];
while(a && a != it) a1 = a,a = a->nxt;
if(a) { // found (a == it)
if(a1) a1->nxt = it->nxt;
@@ -99,7 +99,7 @@ bool flext_base::itemarr::Remove(item *it)
if(!arr[0])
return false;
else {
- item *a1 = NULL,*a = arr[0];
+ Item *a1 = NULL,*a = arr[0];
while(a && a != it) a1 = a,a = a->nxt;
if(a) { // found (a == it)
if(a1) a1->nxt = it->nxt;
@@ -115,7 +115,7 @@ bool flext_base::itemarr::Remove(item *it)
}
}
-void flext_base::itemarr::Finalize()
+void flext_base::ItemCont::Finalize()
{
if(!Ready())
{
@@ -126,14 +126,14 @@ void flext_base::itemarr::Finalize()
int sz = Size();
// save stored item list
- item *lst = arr[0];
+ Item *lst = arr[0];
delete[] arr;
- arr = new item *[sz];
+ arr = new Item *[sz];
memset(arr,0,sz*sizeof(*arr));
while(lst) {
- item *l = lst;
+ Item *l = lst;
lst = lst->nxt;
l->nxt = NULL;
@@ -157,9 +157,9 @@ void flext_base::itemarr::Finalize()
}
}
-flext_base::item *flext_base::itemarr::Find(const t_symbol *tag,int inlet) const
+flext_base::Item *flext_base::ItemCont::Find(const t_symbol *tag,int inlet) const
{
- item *a;
+ Item *a;
if(!Ready())
a = arr[0];
else if(Count()) {
@@ -176,7 +176,7 @@ flext_base::item *flext_base::itemarr::Find(const t_symbol *tag,int inlet) const
return a;
}
-int flext_base::itemarr::Hash(const t_symbol *tag,int inlet,int bits)
+int flext_base::ItemCont::Hash(const t_symbol *tag,int inlet,int bits)
{
unsigned long h = ((reinterpret_cast<unsigned long>(tag)&~7L)<<1)+inlet;
return FoldBits(h,bits);
@@ -199,14 +199,14 @@ public:
flext_obj::t_classid clid;
int ix;
- flext_base::itemarr *arr;
+ flext_base::ItemCont *arr;
_itemarr *nxt;
};
_itemarr::_itemarr(flext_obj::t_classid c,int i):
clid(c),ix(i),
- arr(new flext_base::itemarr),
+ arr(new flext_base::ItemCont),
nxt(NULL)
{}
@@ -230,7 +230,7 @@ int _itemarr::Hash(flext_obj::t_classid c,int ix)
static _itemarr **_arrs = NULL;
-flext_base::itemarr *flext_base::GetClassArr(t_classid c,int ix)
+flext_base::ItemCont *flext_base::GetClassArr(t_classid c,int ix)
{
if(!_arrs) {
_arrs = new _itemarr *[_itemarr::HASHSIZE];
diff --git a/externals/grill/flext/source/flmeth.cpp b/externals/grill/flext/source/flmeth.cpp
index 5e6a86b4..3637529e 100755
--- a/externals/grill/flext/source/flmeth.cpp
+++ b/externals/grill/flext/source/flmeth.cpp
@@ -17,18 +17,18 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include <stdarg.h>
#include "flinternal.h"
-flext_base::methitem::methitem(int in,const t_symbol *tg,attritem *conn):
- item(tg,in,conn),
+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()
+flext_base::MethItem::~MethItem()
{
if(args) delete[] args;
}
-void flext_base::methitem::SetArgs(methfun _fun,int _argc,metharg *_args)
+void flext_base::MethItem::SetArgs(methfun _fun,int _argc,metharg *_args)
{
fun = _fun;
if(args) delete[] args;
@@ -38,12 +38,12 @@ void flext_base::methitem::SetArgs(methfun _fun,int _argc,metharg *_args)
void flext_base::AddMethodDef(int inlet,const char *tag)
{
- methhead->Add(new methitem(inlet,tag?MakeSymbol(tag):NULL));
+ 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,...)
+void flext_base::AddMethod(ItemCont *ma,int inlet,const char *tag,methfun fun,metharg tp,...)
{
va_list marker;
@@ -81,7 +81,7 @@ void flext_base::AddMethod(itemarr *ma,int inlet,const char *tag,methfun fun,met
va_end(marker);
}
- methitem *mi = new methitem(inlet,MakeSymbol(tag));
+ MethItem *mi = new MethItem(inlet,MakeSymbol(tag));
mi->SetArgs(fun,argc,args);
diff --git a/externals/grill/flext/source/flmsg.cpp b/externals/grill/flext/source/flmsg.cpp
index c558a270..9b1eba40 100755
--- a/externals/grill/flext/source/flmsg.cpp
+++ b/externals/grill/flext/source/flmsg.cpp
@@ -14,7 +14,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include "flext.h"
-bool flext_base::CallMeth(const methitem &m,int argc,const t_atom *argv)
+bool flext_base::CallMeth(const MethItem &m,int argc,const t_atom *argv)
{
bool ret = false;
int ix;
@@ -72,7 +72,7 @@ bool flext_base::CallMeth(const methitem &m,int argc,const t_atom *argv)
return ret;
}
-bool flext_base::TryMethTag(const methitem *m,int inlet,const t_symbol *t,int argc,const t_atom *argv)
+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) {
@@ -99,11 +99,11 @@ bool flext_base::TryMethTag(const methitem *m,int inlet,const t_symbol *t,int ar
if(argc == m->argc && CallMeth(*m,argc,argv)) return true;
}
}
- } while((m = (const methitem *)m->nxt) != NULL);
+ } 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)
+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) {
@@ -112,11 +112,11 @@ bool flext_base::TryMethSym(const methitem *m,int inlet,const t_symbol *t,const
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);
+ } 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)
+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) {
@@ -124,7 +124,7 @@ bool flext_base::TryMethAny(const methitem *m,int inlet,const t_symbol *t,const
if(((methfun_A)m->fun)(this,s,argc,const_cast<t_atom *>(argv))) return true;
}
- } while((m = (const methitem *)m->nxt) != NULL);
+ } while((m = (const MethItem *)m->nxt) != NULL);
return false;
}
@@ -133,21 +133,21 @@ bool flext_base::TryMethAny(const methitem *m,int inlet,const t_symbol *t,const
*/
bool flext_base::FindMeth(int inlet,const t_symbol *s,int argc,const t_atom *argv)
{
- methitem *m;
+ 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((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;
+ 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((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);