Update of /cvsroot/pure-data/externals/grill/flext/source
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8452/source
Modified Files:
flclass.h flout.cpp flqueue.cpp flstdc.h flsupport.h
Log Message:
global system lock functions
fixed a thread sensitive spot
fix for _long_ attribute dialogs
build system for flext-based externals
typo fixed in attribute editor
atom outlet functions
Index: flqueue.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flqueue.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** flqueue.cpp 9 Nov 2004 03:31:34 -0000 1.21
--- flqueue.cpp 17 Dec 2004 05:01:18 -0000 1.22
***************
*** 33,37 ****
{
public:
! void Set(flext_base *t,int o,const t_symbol *s,int ac,const t_atom *av) { th = t,out = o,sym = s,argc = ac,argv = av; }
// \note PD sys lock must already be held by caller
--- 33,41 ----
{
public:
! void Set(flext_base *t,int o,const t_symbol *s,int ac,const t_atom *av)
! {
! th = t; out = o;
! sym = s,argc = ac,argv = av;
! }
// \note PD sys lock must already be held by caller
***************
*** 99,106 ****
t_atom *at = GetAtoms(1);
SetInt(*at,dt);
#if FLEXT_SYS == FLEXT_SYS_PD
! const t_symbol *sym = sym_float;
#elif FLEXT_SYS == FLEXT_SYS_MAX
! const t_symbol *sym = sym_int;
#else
#error Not implemented!
--- 103,111 ----
t_atom *at = GetAtoms(1);
SetInt(*at,dt);
+ const t_symbol *sym;
#if FLEXT_SYS == FLEXT_SYS_PD
! sym = sym_float;
#elif FLEXT_SYS == FLEXT_SYS_MAX
! sym = sym_int;
#else
#error Not implemented!
***************
*** 116,119 ****
--- 121,148 ----
}
+ void Push(flext_base *th,int o,const t_atom &a)
+ {
+ t_atom *at = GetAtoms(1);
+ *at = a;
+ const t_symbol *sym;
+ if(IsSymbol(a))
+ sym = sym_symbol;
+ else if(IsFloat(a))
+ sym = sym_float;
+ #if FLEXT_SYS == FLEXT_SYS_MAX
+ else if(IsInt(a))
+ sym = sym_int;
+ #endif
+ #if FLEXT_SYS == FLEXT_SYS_PD
+ else if(IsPointer(a))
+ sym = sym_pointer;
+ #endif
+ else {
+ error("atom type not supported");
+ return;
+ }
+ Set(th,o,sym,1,at);
+ }
+
void Push(flext_base *th,int o,int argc,const t_atom *argv)
{
***************
*** 313,316 ****
--- 342,351 ----
}
+ void flext_base::ToQueueAtom(int o,const t_atom &at) const
+ {
+ queue.Push(const_cast<flext_base *>(this),o,at);
+ Trigger();
+ }
+
void flext_base::ToQueueList(int o,int argc,const t_atom *argv) const
{
Index: flstdc.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flstdc.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** flstdc.h 16 Dec 2004 05:01:07 -0000 1.27
--- flstdc.h 17 Dec 2004 05:01:18 -0000 1.28
***************
*** 119,122 ****
--- 119,123 ----
#include "ext.h"
#include "ext_user.h"
+ #include "ext_critical.h"
#include "z_dsp.h"
Index: flout.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flout.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** flout.cpp 16 Dec 2004 05:01:07 -0000 1.18
--- flout.cpp 17 Dec 2004 05:01:18 -0000 1.19
***************
*** 26,29 ****
--- 26,52 ----
void flext_base::ToSysAnything(int n,const t_symbol *s,int argc,const t_atom *argv) const { outlet *o = GetOut(n); if(o) { CRITON(); outlet_anything((t_outlet *)o,const_cast<t_symbol *>(s),argc,(t_atom *)argv); CRITOFF(); } }
+ void flext_base::ToSysAtom(int n,const t_atom &at) const
+ {
+ outlet *o = GetOut(n);
+ if(o) {
+ CRITON();
+ if(IsSymbol(at))
+ outlet_symbol((t_outlet *)o,const_cast<t_symbol *>(GetSymbol(at)));
+ else if(IsFloat(at))
+ outlet_float((t_outlet *)o,GetFloat(at));
+ #if FLEXT_SYS == FLEXT_SYS_MAX
+ else if(IsInt(at))
+ outlet_flint((t_outlet *)o,GetInt(at));
+ #endif
+ #if FLEXT_SYS == FLEXT_SYS_PD
+ else if(IsPointer(at))
+ outlet_pointer((t_outlet *)o,GetPointer(at));
+ #endif
+ else
+ error("Atom type not supported");
+ CRITOFF();
+ }
+ }
+
#elif FLEXT_SYS == FLEXT_SYS_JMAX
***************
*** 53,56 ****
--- 76,80 ----
void flext_base::ToOutInt(int n,int f) const { if(CHKTHR()) ToSysInt(n,f); else ToQueueInt(n,f); }
void flext_base::ToOutSymbol(int n,const t_symbol *s) const { if(CHKTHR()) ToSysSymbol(n,s); else ToQueueSymbol(n,s); }
+ void flext_base::ToOutAtom(int n,const t_atom &at) const { if(CHKTHR()) ToSysAtom(n,at); else ToQueueAtom(n,at); }
void flext_base::ToOutList(int n,int argc,const t_atom *argv) const { if(CHKTHR()) ToSysList(n,argc,argv); else ToQueueList(n,argc,argv); }
void flext_base::ToOutAnything(int n,const t_symbol *s,int argc,const t_atom *argv) const { if(CHKTHR()) ToSysAnything(n,s,argc,argv); else ToQueueAnything(n,s,argc,argv); }
Index: flsupport.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flsupport.h,v
retrieving revision 1.72
retrieving revision 1.73
diff -C2 -d -r1.72 -r1.73
*** flsupport.h 28 Nov 2004 05:01:00 -0000 1.72
--- flsupport.h 17 Dec 2004 05:01:18 -0000 1.73
***************
*** 438,446 ****
static bool CanbePointer(const t_atom &a) { return IsPointer(a); }
//! Access the pointer value (without type check)
! static void *GetPointer(const t_atom &a) { return a.a_w.w_gpointer; }
//! Check for a pointer and get its value
! static void *GetAPointer(const t_atom &a,void *def = NULL) { return IsPointer(a)?GetPointer(a):def; }
//! Set the atom to represent a pointer
! static void SetPointer(t_atom &a,void *p) { a.a_type = A_POINTER; a.a_w.w_gpointer = (t_gpointer *)p; }
#elif FLEXT_SYS == FLEXT_SYS_MAX
--- 438,446 ----
static bool CanbePointer(const t_atom &a) { return IsPointer(a); }
//! Access the pointer value (without type check)
! static t_gpointer *GetPointer(const t_atom &a) { return a.a_w.w_gpointer; }
//! Check for a pointer and get its value
! static t_gpointer *GetAPointer(const t_atom &a,t_gpointer *def = NULL) { return IsPointer(a)?GetPointer(a):def; }
//! Set the atom to represent a pointer
! static void SetPointer(t_atom &a,t_gpointer *p) { a.a_type = A_POINTER; a.a_w.w_gpointer = (t_gpointer *)p; }
#elif FLEXT_SYS == FLEXT_SYS_MAX
***************
*** 646,649 ****
--- 646,672 ----
// --- thread stuff -----------------------------------------------
+ /*! \defgroup FLEXT_S_LOCK Global system locking
+ @{
+ */
+
+ #if FLEXT_SYS == FLEXT_SYS_PD
+ #if PD_MINOR_VERSION >= 38 || (PD_MINOR_VERSION >= 37 && defined(PD_DEVEL_VERSION))
+ static void Lock() { sys_lock(); }
+ static void Unlock() { sys_unlock(); }
+ #else
+ // no system locking for old PD versions
+ static void Lock() {}
+ static void Unlock() {}
+ #endif
+ #elif FLEXT_SYS == FLEXT_SYS_MAX
+ // Max 4.2 upwards!
+ static void Lock() { critical_enter(0); }
+ static void Unlock() { critical_exit(0); }
+ #else
+ #error
+ #endif
+
+ //! @} FLEXT_S_LOCK
+
#ifdef FLEXT_THREADS
/*! \defgroup FLEXT_S_THREAD Flext thread handling
Index: flclass.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flclass.h,v
retrieving revision 1.47
retrieving revision 1.48
diff -C2 -d -r1.47 -r1.48
*** flclass.h 15 Nov 2004 03:30:59 -0000 1.47
--- flclass.h 17 Dec 2004 05:01:17 -0000 1.48
***************
*** 232,235 ****
--- 232,238 ----
void ToOutString(int n,const char *s) const { ToOutSymbol(n,MakeSymbol(s)); }
+ //! Output atom (index n starts with 0)
+ void ToOutAtom(int n,const t_atom &at) const;
+
//! Output list (index n starts with 0)
void ToOutList(int n,int argc,const t_atom *argv) const;
***************
*** 265,268 ****
--- 268,274 ----
void ToQueueString(int n,const char *s) const { ToQueueSymbol(n,MakeSymbol(s)); }
+ //! Output atom (index n starts with 0)
+ void ToQueueAtom(int n,const t_atom &at) const;
+
//! Output list (index n starts with 0)
void ToQueueList(int n,int argc,const t_atom *argv) const;
***************
*** 293,296 ****
--- 299,305 ----
void ToSelfString(int n,const char *s) const { ToSelfSymbol(n,MakeSymbol(s)); }
+ //! Output atom (index n starts with 0)
+ void ToSelfAtom(int n,const t_atom &at) const { ToQueueAtom(-1-n,at); }
+
//! Send list to self (inlet n)
void ToSelfList(int n,int argc,const t_atom *argv) const { ToQueueList(-1-n,argc,argv); }
***************
*** 737,740 ****
--- 746,750 ----
void ToSysBool(int n,bool f) const { ToSysInt(n,f?1:0); }
void ToSysSymbol(int n,const t_symbol *s) const;
+ void ToSysAtom(int n,const t_atom &at) const;
void ToSysList(int n,int argc,const t_atom *argv) const;
void ToSysAnything(int n,const t_symbol *s,int argc,const t_atom *argv) const;