aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/source
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2003-04-22 02:38:13 +0000
committerThomas Grill <xovo@users.sourceforge.net>2003-04-22 02:38:13 +0000
commitfcf490af444f26010c6ea950af9b5f4b36984ace (patch)
tree12bcf3ccea68268e422c0e0cc47da5821c39e5f8 /externals/grill/flext/source
parent8248ce3d66a19f77ffe10ded4b922cf0606f47a4 (diff)
""
svn path=/trunk/; revision=582
Diffstat (limited to 'externals/grill/flext/source')
-rw-r--r--externals/grill/flext/source/flbind.cpp2
-rw-r--r--externals/grill/flext/source/flbuf.cpp6
-rw-r--r--externals/grill/flext/source/flclass.h81
-rw-r--r--externals/grill/flext/source/flcwmax.h3
-rwxr-xr-xexternals/grill/flext/source/flqueue.cpp95
5 files changed, 128 insertions, 59 deletions
diff --git a/externals/grill/flext/source/flbind.cpp b/externals/grill/flext/source/flbind.cpp
index 9f840f34..fe1846e2 100644
--- a/externals/grill/flext/source/flbind.cpp
+++ b/externals/grill/flext/source/flbind.cpp
@@ -69,7 +69,7 @@ flext_base::binditem::~binditem()
if(tag->s_thing == (t_object *)px)
const_cast<t_symbol *>(tag)->s_thing = NULL;
else
- error("%s - Binding not found",thisName());
+ error("flext - Binding to symbol %s not found",tag->s_name);
#else
# pragma warning("Not implemented")
#endif
diff --git a/externals/grill/flext/source/flbuf.cpp b/externals/grill/flext/source/flbuf.cpp
index 5d004e4d..89258b11 100644
--- a/externals/grill/flext/source/flbuf.cpp
+++ b/externals/grill/flext/source/flbuf.cpp
@@ -73,7 +73,7 @@ int flext::buffer::Set(const t_symbol *s,bool nameonly)
arr = (t_garray *)pd_findbyclass(const_cast<t_symbol *>(sym), garray_class);
if(!arr)
{
- if (*GetString(sym)) error("buffer: no such array '%s'",GetString(sym));
+ if (*GetString(sym)) FLEXT_LOG1("buffer: no such array '%s'",GetString(sym));
sym = NULL;
if(valid) ret = -1;
}
@@ -108,7 +108,7 @@ int flext::buffer::Set(const t_symbol *s,bool nameonly)
}
}
else {
- error("buffer: symbol '%s' not defined", GetString(sym));
+ FLEXT_LOG1("buffer: symbol '%s' not defined", GetString(sym));
if(valid) ret = -1;
}
#else
@@ -261,7 +261,7 @@ void flext::buffer::Dirty(bool force)
}
}
else {
- error("buffer: symbol '%s' not defined",sym->s_name);
+ FLEXT_LOG1("buffer: symbol '%s' not defined",sym->s_name);
}
#else
#error
diff --git a/externals/grill/flext/source/flclass.h b/externals/grill/flext/source/flclass.h
index 7296c223..fc0ff0f8 100644
--- a/externals/grill/flext/source/flclass.h
+++ b/externals/grill/flext/source/flclass.h
@@ -200,41 +200,27 @@ public:
// output messages
- //! Output bang (to appointed outlet)
-// void ToOutBang(outlet *o) const;
//! Output bang (index n starts with 0)
- void ToOutBang(int n) const; // { outlet *o = GetOut(n); if(o) ToOutBang(o); }
+ void ToOutBang(int n) const;
- //! Output float (to appointed outlet)
-// void ToOutFloat(outlet *o,float f) const;
//! Output float (index n starts with 0)
- void ToOutFloat(int n,float f) const; // { outlet *o = GetOut(n); if(o) ToOutFloat(o,f); }
+ void ToOutFloat(int n,float f) const;
- //! Output integer (to appointed outlet)
-// void ToOutInt(outlet *o,int f) const;
//! Output integer (index n starts with 0)
- void ToOutInt(int n,int f) const; // { outlet *o = GetOut(n); if(o) ToOutInt(o,f); }
+ void ToOutInt(int n,int f) const;
- //! Output symbol (to appointed outlet)
-// void ToOutSymbol(outlet *o,const t_symbol *s) const;
//! Output symbol (index n starts with 0)
- void ToOutSymbol(int n,const t_symbol *s) const; // { outlet *o = GetOut(n); if(o) ToOutSymbol(o,s); }
- //! Output string aka symbol (to appointed outlet)
-// void ToOutString(outlet *o,const char *s) const { ToOutSymbol(o,MakeSymbol(s)); }
+ void ToOutSymbol(int n,const t_symbol *s) const;
//! Output string aka symbol (index n starts with 0)
void ToOutString(int n,const char *s) const { ToOutSymbol(n,MakeSymbol(s)); }
- //! Output list (to appointed outlet)
-// void ToOutList(outlet *o,int argc,const t_atom *argv) const;
//! Output list (index n starts with 0)
- void ToOutList(int n,int argc,const t_atom *argv) const; // { outlet *o = GetOut(n); if(o) ToOutList(o,argc,argv); }
+ void ToOutList(int n,int argc,const t_atom *argv) const;
//! Output list (index n starts with 0)
void ToOutList(int n,const AtomList &list) const { ToOutList(n,list.Count(),list.Atoms()); }
- //! Output anything (to appointed outlet)
-// void ToOutAnything(outlet *o,const t_symbol *s,int argc,const t_atom *argv) const;
//! Output anything (index n starts with 0)
- void ToOutAnything(int n,const t_symbol *s,int argc,const t_atom *argv) const; // { outlet *o = GetOut(n); if(o) ToOutAnything(o,const_cast<t_symbol *>(s),argc,argv); }
+ void ToOutAnything(int n,const t_symbol *s,int argc,const t_atom *argv) const;
//! Output anything (index n starts with 0)
void ToOutAnything(int n,const AtomAnything &any) const { ToOutAnything(n,any.Header(),any.Count(),any.Atoms()); }
@@ -244,48 +230,55 @@ public:
@{
*/
- //! Output bang (to appointed outlet)
-// void ToQueueBang(outlet *o) const;
//! Output bang (index n starts with 0)
- void ToQueueBang(int n) const; // { outlet *o = GetOut(n); if(o) ToQueueBang(o); }
+ void ToQueueBang(int n) const;
- //! Output float (to appointed outlet)
-// void ToQueueFloat(outlet *o,float f) const;
//! Output float (index n starts with 0)
- void ToQueueFloat(int n,float f) const; // { outlet *o = GetOut(n); if(o) ToQueueFloat(o,f); }
+ void ToQueueFloat(int n,float f) const;
- //! Output integer (to appointed outlet)
-// void ToQueueInt(outlet *o,int f) const;
//! Output integer (index n starts with 0)
- void ToQueueInt(int n,int f) const; // { outlet *o = GetOut(n); if(o) ToQueueInt(o,f); }
+ void ToQueueInt(int n,int f) const;
- //! Output symbol (to appointed outlet)
-// void ToQueueSymbol(outlet *o,const t_symbol *s) const;
//! Output symbol (index n starts with 0)
- void ToQueueSymbol(int n,const t_symbol *s) const; // { outlet *o = GetOut(n); if(o) ToQueueSymbol(o,s); }
- //! Output string aka symbol (to appointed outlet)
-// void ToQueueString(outlet *o,const char *s) const { ToQueueSymbol(o,MakeSymbol(s)); }
+ void ToQueueSymbol(int n,const t_symbol *s) const;
//! Output string aka symbol (to appointed outlet)
void ToQueueString(int n,const char *s) const { ToQueueSymbol(n,MakeSymbol(s)); }
- //! Output list (to appointed outlet)
-// void ToQueueList(outlet *o,int argc,const t_atom *argv) const;
- //! Output list (to appointed outlet)
-// void ToQueueList(outlet *o,const AtomList &list) const { ToQueueList(o,list.Count(),list.Atoms()); }
//! Output list (index n starts with 0)
- void ToQueueList(int n,int argc,const t_atom *argv) const; // { outlet *o = GetOut(n); if(o) ToQueueList(o,argc,argv); }
+ void ToQueueList(int n,int argc,const t_atom *argv) const;
//! Output list (index n starts with 0)
void ToQueueList(int n,const AtomList &list) const { ToQueueList(n,list.Count(),list.Atoms()); }
- //! Output anything (to appointed outlet)
-// void ToQueueAnything(outlet *o,const t_symbol *s,int argc,const t_atom *argv) const;
- //! Output anything (to appointed outlet)
-// void ToQueueAnything(outlet *o,const AtomAnything &any) const { ToQueueAnything(o,any.Header(),any.Count(),any.Atoms()); }
//! Output anything (index n starts with 0)
- void ToQueueAnything(int n,const t_symbol *s,int argc,const t_atom *argv) const; // { outlet *o = GetOut(n); if(o) ToQueueAnything(o,s,argc,argv); }
+ void ToQueueAnything(int n,const t_symbol *s,int argc,const t_atom *argv) const;
//! Output anything (index n starts with 0)
void ToQueueAnything(int n,const AtomAnything &any) const { ToQueueAnything(n,any.Header(),any.Count(),any.Atoms()); }
+
+ //! Send bang to self (inlet n)
+ void ToSelfBang(int n) const;
+
+ //! Send float to self (inlet n)
+ void ToSelfFloat(int n,float f) const;
+
+ //! Send integer to self (inlet n)
+ void ToSelfInt(int n,int f) const;
+
+ //! Send symbol to self (inlet n)
+ void ToSelfSymbol(int n,const t_symbol *s) const;
+ //! Send string aka symbol to self (inlet 0)
+ void ToSelfString(int n,const char *s) const { ToSelfSymbol(n,MakeSymbol(s)); }
+
+ //! Send list to self (inlet n)
+ void ToSelfList(int n,int argc,const t_atom *argv) const;
+ //! Send list to self (inlet n)
+ void ToSelfList(int n,const AtomList &list) const { ToSelfList(n,list.Count(),list.Atoms()); }
+
+ //! Send anything to self (inlet n)
+ void ToSelfAnything(int n,const t_symbol *s,int argc,const t_atom *argv) const;
+ //! Send anything to self (inlet n)
+ void ToSelfAnything(int n,const AtomAnything &any) const { ToSelfAnything(n,any.Header(),any.Count(),any.Atoms()); }
+
//! @} FLEXT_C_IO_QUEUE
//! @} FLEXT_C_INOUT
diff --git a/externals/grill/flext/source/flcwmax.h b/externals/grill/flext/source/flcwmax.h
index 87653e3b..a0c17832 100644
--- a/externals/grill/flext/source/flcwmax.h
+++ b/externals/grill/flext/source/flcwmax.h
@@ -25,7 +25,8 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include <MacHeaders.h>
#endif
-#if __option(sym) || !__option(opt_dead_code)
+#if /*__option(sym) ||*/ !__option(opt_dead_code)
+ #pragma message("Optimization disabled -> Compiling a debug version (with FLEXT_DEBUG)")
#define FLEXT_DEBUG
#endif
diff --git a/externals/grill/flext/source/flqueue.cpp b/externals/grill/flext/source/flqueue.cpp
index 13cada78..92045fbf 100755
--- a/externals/grill/flext/source/flqueue.cpp
+++ b/externals/grill/flext/source/flqueue.cpp
@@ -10,6 +10,8 @@ WARRANTIES, see the file, "license.txt," in this distribution.
/*! \file flqueue.cpp
\brief Implementation of the flext message queuing functionality.
+
+ \todo Let's see if queuing can be implemented for Max/MSP with defer_low
*/
#include "flext.h"
@@ -79,17 +81,59 @@ void flext_base::QTick(flext_base *th)
qmsg *m = th->qhead;
if(!m) break;
- 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();
+ if(m->out < 0) {
+ // message to self
+
+ const int n = -1-m->out;
+ t_atom tmp;
+
+ switch(m->tp) {
+ case qmsg::tp_bang:
+ th->m_methodmain(n,sym_bang,0,&tmp);
+ break;
+ case qmsg::tp_float:
+ SetFloat(tmp,m->_float);
+ th->m_methodmain(n,sym_float,1,&tmp);
+ break;
+ case qmsg::tp_int:
+ SetInt(tmp,m->_int);
+#if FLEXT_SYS == FLEXT_SYS_PD
+ th->m_methodmain(n,sym_float,1,&tmp);
+#elif FLEXT_SYS == FLEXT_SYS_MAX
+ th->m_methodmain(n,sym_int,1,&tmp);
+#else
+#error Not implemented!
#endif
- }
+ case qmsg::tp_sym:
+ SetSymbol(tmp,m->_sym);
+ th->m_methodmain(n,sym_symbol,1,&tmp);
+ break;
+ case qmsg::tp_list:
+ th->m_methodmain(n,sym_list,m->_list.argc,m->_list.argv);
+ break;
+ case qmsg::tp_any:
+ th->m_methodmain(n,m->_any.s,m->_any.argc,m->_any.argv);
+ break;
+ #ifdef FLEXT_DEBUG
+ default: ERRINTERNAL();
+ #endif
+ }
+ }
+ else {
+ // message to outlet
+
+ 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
+ }
+ }
th->qhead = m->nxt;
if(!th->qhead) th->qtail = NULL;
@@ -169,3 +213,34 @@ void flext_base::ToQueueAnything(int o,const t_symbol *s,int argc,const t_atom *
const_cast<flext_base &>(*this).Queue(m);
}
+
+void flext_base::ToSelfBang(int n) const
+{
+ ToQueueBang(-1-n);
+}
+
+void flext_base::ToSelfFloat(int n,float f) const
+{
+ ToQueueFloat(-1-n,f);
+}
+
+void flext_base::ToSelfInt(int n,int f) const
+{
+ ToQueueInt(-1-n,f);
+}
+
+void flext_base::ToSelfSymbol(int n,const t_symbol *s) const
+{
+ ToQueueSymbol(-1-n,s);
+}
+
+void flext_base::ToSelfList(int n,int argc,const t_atom *argv) const
+{
+ ToQueueList(-1-n,argc,argv);
+}
+
+void flext_base::ToSelfAnything(int n,const t_symbol *s,int argc,const t_atom *argv) const
+{
+ ToQueueAnything(-1-n,s,argc,argv);
+}
+