diff options
author | Thomas Grill <xovo@users.sourceforge.net> | 2004-12-17 05:01:18 +0000 |
---|---|---|
committer | Thomas Grill <xovo@users.sourceforge.net> | 2004-12-17 05:01:18 +0000 |
commit | f688c9de1efee2e09fbb9b39a715853b23fadcb3 (patch) | |
tree | 406b8c29f9957621fa82bfe7415a33bc0c8240ab /externals | |
parent | 1be9429281d7eb7a0cae509b23ed4482768a68f1 (diff) |
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
svn path=/trunk/; revision=2394
Diffstat (limited to 'externals')
19 files changed, 365 insertions, 23 deletions
diff --git a/externals/grill/flext/build/config-win-max-msvc.def b/externals/grill/flext/build/config-win-max-msvc.def new file mode 100644 index 00000000..c1192ad4 --- /dev/null +++ b/externals/grill/flext/build/config-win-max-msvc.def @@ -0,0 +1,22 @@ +# where are the Max/MSP SDK header files?
+# you should have the latest version!
+MAXSDKPATH="c:\data\prog\audio\maxmspsdk_win\4.5 headers\c74support"
+
+# where do the flext libraries reside?
+FLEXTPATH="%CommonProgramFiles%\Cycling '74\flext"
+
+# where is MS VC++?
+# (need not be defined if the build is started with the compiler environment set)
+# MSVCPATH="c:\programme\prog\microsoft visual studio\VC98"
+
+# where should the external be built?
+# (path for temporary files)
+OUTPATH=max-msvc
+
+# where should the external be installed?
+# (leave blank to omit installation)
+INSTPATH="%CommonProgramFiles%\Cycling '74\externals\flext"
+
+# some user-definable flags
+# (check if they match your system!)
+UFLAGS=/G6 /Ox /arch:SSE
diff --git a/externals/grill/flext/build/config-win-max-msvc.txt b/externals/grill/flext/build/config-win-max-msvc.txt new file mode 100644 index 00000000..c1192ad4 --- /dev/null +++ b/externals/grill/flext/build/config-win-max-msvc.txt @@ -0,0 +1,22 @@ +# where are the Max/MSP SDK header files?
+# you should have the latest version!
+MAXSDKPATH="c:\data\prog\audio\maxmspsdk_win\4.5 headers\c74support"
+
+# where do the flext libraries reside?
+FLEXTPATH="%CommonProgramFiles%\Cycling '74\flext"
+
+# where is MS VC++?
+# (need not be defined if the build is started with the compiler environment set)
+# MSVCPATH="c:\programme\prog\microsoft visual studio\VC98"
+
+# where should the external be built?
+# (path for temporary files)
+OUTPATH=max-msvc
+
+# where should the external be installed?
+# (leave blank to omit installation)
+INSTPATH="%CommonProgramFiles%\Cycling '74\externals\flext"
+
+# some user-definable flags
+# (check if they match your system!)
+UFLAGS=/G6 /Ox /arch:SSE
diff --git a/externals/grill/flext/build/config-win-pd-msvc.def b/externals/grill/flext/build/config-win-pd-msvc.def new file mode 100644 index 00000000..bdce5879 --- /dev/null +++ b/externals/grill/flext/build/config-win-pd-msvc.def @@ -0,0 +1,20 @@ +# where is PD?
+PDPATH=c:\programme\audio\pd
+
+# where do the flext libraries reside?
+FLEXTPATH=$(PDPATH)\flext
+
+# where is MS VC++?
+# (not necessary if the build is run with the compiler environment)
+# MSVCPATH=C:\Programme\Microsoft Visual Studio .NET 2003\Vc7
+
+# where should the external be built?
+OUTPATH=pd-msvc
+
+# where should the external be installed?
+# (leave blank to omit installation)
+INSTPATH=$(PDPATH)\extra
+
+# user defined compiler flags
+# (check if they match your system!)
+UFLAGS=/G6 /Ox /arch:SSE
diff --git a/externals/grill/flext/build/config-win-pd-msvc.txt b/externals/grill/flext/build/config-win-pd-msvc.txt new file mode 100644 index 00000000..bdce5879 --- /dev/null +++ b/externals/grill/flext/build/config-win-pd-msvc.txt @@ -0,0 +1,20 @@ +# where is PD?
+PDPATH=c:\programme\audio\pd
+
+# where do the flext libraries reside?
+FLEXTPATH=$(PDPATH)\flext
+
+# where is MS VC++?
+# (not necessary if the build is run with the compiler environment)
+# MSVCPATH=C:\Programme\Microsoft Visual Studio .NET 2003\Vc7
+
+# where should the external be built?
+OUTPATH=pd-msvc
+
+# where should the external be installed?
+# (leave blank to omit installation)
+INSTPATH=$(PDPATH)\extra
+
+# user defined compiler flags
+# (check if they match your system!)
+UFLAGS=/G6 /Ox /arch:SSE
diff --git a/externals/grill/flext/build/make-win-gen-msvc.inc b/externals/grill/flext/build/make-win-gen-msvc.inc new file mode 100644 index 00000000..0538f63e --- /dev/null +++ b/externals/grill/flext/build/make-win-gen-msvc.inc @@ -0,0 +1,67 @@ +INCPATH=$(INCPATH) /I$(FLEXTPATH)
+LIBPATH=$(LIBPATH) /LIBPATH:$(FLEXTPATH)
+
+!ifdef MSVCPATH
+INCPATH=$(INCPATH) /I$(MSVCPATH)\include
+LIBPATH=$(LIBPATH) /LIBPATH:$(MSVCPATH)\lib
+!endif
+
+# add user flags
+CFLAGS=$(UFLAGS)
+
+# for VC7 - exception handling
+CFLAGS=$(CFLAGS) /EHsc
+
+##############################################
+
+# use multithreaded static libraries
+!ifdef _DEBUG
+CFLAGS=$(CFLAGS) /DMTd
+!else
+CFLAGS=$(CFLAGS) /DMT
+!endif
+
+!ifdef FLEXT_SHARED
+# --- shared ---
+DEFS=$(DEFS) /DFLEXT_SHARED
+
+!elseifdef FLEXT_THREADED
+# --- static multi-threaded ---
+DEFS=$(DEFS) /DFLEXT_THREADS
+
+!else
+# --- static single-threaded ---
+
+!endif
+
+##############################################
+
+all: $(OUTPATH) $(OUTPATH)\$(NAME).$(EXT)
+
+# remove build
+clean:
+ -del /q $(OUTPATH) > nul
+ -rmdir $(OUTPATH) > nul
+
+OBJS= $(SRCS:.c=.obj)
+OBJS= $(OBJS:.objpp=.obj)
+
+$(OUTPATH):
+ -mkdir $(OUTPATH) > nul
+
+{$(SRCDIR)}.cpp{}.obj:
+ cl /c /LD $(CFLAGS) $(DEFS) $(INCPATH) $** /Fo$(OUTPATH)\$@
+
+{$(SRCDIR)}.c{}.obj:
+ cl /c /LD $(CFLAGS) $(DEFS) $(INCPATH) $** /Fo$(OUTPATH)\$@
+
+$(OUTPATH)\$(NAME).$(EXT): $(OBJS)
+ cd $(OUTPATH)
+ link /DLL $(LDFLAGS) /out:$(NAME).$(EXT) /INCREMENTAL:NO $** $(LIBS) $(LIBPATH)
+ @-del *.exp
+ @-del *.lib
+ cd ..
+!ifdef INSTPATH
+ @-if not exist $(INSTPATH) mkdir $(INSTPATH)
+ copy $@ $(INSTPATH) > nul
+!endif
diff --git a/externals/grill/flext/build/make-win-max-msvc.inc b/externals/grill/flext/build/make-win-max-msvc.inc new file mode 100644 index 00000000..eb03a828 --- /dev/null +++ b/externals/grill/flext/build/make-win-max-msvc.inc @@ -0,0 +1,35 @@ +DEFS=$(DEFS) /DFLEXT_SYS=1
+CFLAGS=$(CFLAGS) /Zp2
+
+INCPATH=$(INCPATH) /I$(MAXSDKPATH)\max-includes /I$(MAXSDKPATH)\msp-includes
+LIBPATH=$(LIBPATH) /LIBPATH:$(MAXSDKPATH)\max-includes /LIBPATH:$(MAXSDKPATH)\msp-includes
+
+# these are both in MAXSDKPATH
+LIBS=$(LIBS) maxapi.lib maxaudio.lib
+
+EXT=mxe
+
+#########################################
+
+!ifdef FLEXT_SHARED
+# --- shared ---
+
+!elseifdef FLEXT_THREADED
+# --- static multi-threaded ---
+
+!ifdef _DEBUG
+LIBS=$(LIBS) flext_td-maxwin.lib
+!else
+LIBS=$(LIBS) flext_t-maxwin.lib
+!endif
+
+!else
+# --- static single-threaded ---
+
+!ifdef _DEBUG
+LIBS=$(LIBS) flext_d-maxwin.lib
+!else
+LIBS=$(LIBS) flext-maxwin.lib
+!endif
+
+!endif
diff --git a/externals/grill/flext/build/make-win-msvc.inc b/externals/grill/flext/build/make-win-msvc.inc new file mode 100644 index 00000000..56b4deee --- /dev/null +++ b/externals/grill/flext/build/make-win-msvc.inc @@ -0,0 +1,22 @@ +!ifdef $(MAX)
+# Max/MSP
+!include config-pd-msvc.txt
+!include makefile-msvc.txt
+!include ..\flext\build\make-win-max-msvc.inc
+
+!elseifdef $(PD)
+# PD
+!include config-pd-msvc.txt
+!include makefile-msvc.txt
+!include ..\flext\build\make-win-pd-msvc.inc
+
+!else
+!error Platform not supported
+!endif
+
+# all the source files from the package
+!include make-files.txt
+
+# now build
+!include ..\flext\build\make-win-gen-msvc.inc
+
diff --git a/externals/grill/flext/build/make-win-pd-msvc.inc b/externals/grill/flext/build/make-win-pd-msvc.inc new file mode 100644 index 00000000..41cbfd20 --- /dev/null +++ b/externals/grill/flext/build/make-win-pd-msvc.inc @@ -0,0 +1,34 @@ +DEFS=$(DEFS) /DFLEXT_SYS=2
+
+INCPATH=$(INCPATH) /I$(PDPATH)\src
+LIBPATH=$(LIBPATH) /LIBPATH:$(PDPATH)\bin
+
+# these are both in PDPATH
+LIBS=$(LIBS) pd.lib pthreadVC.lib
+
+EXT=dll
+
+#########################################
+
+!ifdef FLEXT_SHARED
+# --- shared ---
+
+!elseifdef FLEXT_THREADED
+# --- static multi-threaded ---
+
+!ifdef _DEBUG
+LIBS=$(LIBS) flext_td-pdwin.lib
+!else
+LIBS=$(LIBS) flext_t-pdwin.lib
+!endif
+
+!else
+# --- static single-threaded ---
+
+!ifdef _DEBUG
+LIBS=$(LIBS) flext_d-pdwin.lib
+!else
+LIBS=$(LIBS) flext-pdwin.lib
+!endif
+
+!endif
diff --git a/externals/grill/flext/changes.txt b/externals/grill/flext/changes.txt index e31d9add..e073de04 100644 --- a/externals/grill/flext/changes.txt +++ b/externals/grill/flext/changes.txt @@ -21,6 +21,9 @@ Version history: - show saveable attributes on object select - fix for long attribute dialogs - dropped support for Max UI objects +- added global system locking +- added general atom outlet functions To{Sys,Out,Queue}Atom +- added build system for flext-based externals 0.4.7: - added flext::GetBool (just because flext::GetInt has been there for a while) diff --git a/externals/grill/flext/config-max-msvc.txt b/externals/grill/flext/config-max-msvc.txt index 88fceca8..a1d62c63 100644 --- a/externals/grill/flext/config-max-msvc.txt +++ b/externals/grill/flext/config-max-msvc.txt @@ -3,7 +3,7 @@ # # where is the Max SDK? -MAXSDKPATH="F:\prog\audio\maxmspsdk_win\4.5 headers\c74support" +MAXSDKPATH="C:\data\prog\audio\maxmspsdk_win\4.5 headers\c74support" # where is MS VC++? # (should be commented out when called from the Visual Studio Command prompt) diff --git a/externals/grill/flext/config-pd-msvc.txt b/externals/grill/flext/config-pd-msvc.txt index 23ce4083..fdbe841c 100644 --- a/externals/grill/flext/config-pd-msvc.txt +++ b/externals/grill/flext/config-pd-msvc.txt @@ -1,5 +1,5 @@ # flext - C++ layer for Max/MSP and pd (pure data) externals -# Copyright (c) 2001-2003 Thomas Grill (xovo@gmx.net) +# Copyright (c) 2001-2004 Thomas Grill (gr@grrrr.org) # # where is PD? @@ -7,7 +7,7 @@ PDPATH=c:\programme\audio\pd # where is the pthreads package? # (comment out if you use the standard pd package where pthreads are included) -# PTHREADS=F:\prog\packs\pthreads +# PTHREADS=c:\data\prog\packs\pthreads # where is MS VC++? # (should be commented out when called from the Visual Studio Command prompt) @@ -16,12 +16,12 @@ PDPATH=c:\programme\audio\pd # where is the SndObj directory? # headers are searched in SNDOBJ/include, the sndobj.lib in SNDOBJ/lib # (leave blank or comment out to disable SndObj support) -SNDOBJ=f:\prog\audio\sndobj +SNDOBJ=c:\data\prog\audio\sndobj # where is the STK include directory? # headers are searched in STK/include, the stk.lib in STK/lib # (leave blank or comment out to disable STK support) -STK=f:\prog\audio\stk +STK=c:\data\prog\audio\stk # where should flext libraries be built? # object files will be placed in subfolders diff --git a/externals/grill/flext/flext.vcproj b/externals/grill/flext/flext.vcproj index 7a1938ea..c4426b2d 100644 --- a/externals/grill/flext/flext.vcproj +++ b/externals/grill/flext/flext.vcproj @@ -121,7 +121,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories="c:\programme\audio\pd\src,f:\prog\audio\sndobj\include,f:\prog\audio\stk\include" + AdditionalIncludeDirectories="c:\programme\audio\pd\src;c:\data\prog\audio\sndobj\include;c:\data\prog\audio\stk\include" PreprocessorDefinitions="WIN32;_DEBUG;_LIB;FLEXT_SYS_PD;FLEXT_THREADS;FLEXT_USE_SIMD" BasicRuntimeChecks="3" RuntimeLibrary="1" @@ -223,7 +223,7 @@ Name="VCCLCompilerTool" Optimization="2" InlineFunctionExpansion="1" - AdditionalIncludeDirectories="c:\programme\audio\pd\src,f:\prog\audio\sndobj\include,f:\prog\audio\stk\include" + AdditionalIncludeDirectories="c:\programme\audio\pd\src;c:\data\prog\audio\sndobj\include;c:\data\prog\audio\stk\include" PreprocessorDefinitions="WIN32;NDEBUG;_LIB;FLEXT_SYS=2;FLEXT_THREADS;FLEXT_USE_SIMD" StringPooling="TRUE" RuntimeLibrary="0" @@ -698,7 +698,7 @@ copy F:\prog\max\flext\max-msvc\flext.max.dll f:\prog\dll InlineFunctionExpansion="0" FavorSizeOrSpeed="0" EnableFiberSafeOptimizations="FALSE" - AdditionalIncludeDirectories="F:\prog\audio\MaxWinSDK\c74support\max-includes,F:\prog\audio\MaxWinSDK\c74support\msp-includes,f:\prog\packs\pthreads,f:\prog\audio\sndobj\include,f:\prog\audio\stk\include" + AdditionalIncludeDirectories=""C:\data\prog\audio\maxmspsdk_win\4.5 headers\c74support\max-includes";"C:\data\prog\audio\maxmspsdk_win\4.5 headers\c74support\msp-includes";c:\data\prog\audio\sndobj\include;c:\data\prog\audio\stk\include" PreprocessorDefinitions="WIN32;_DEBUG;_LIB;FLEXT_SYS_MAX;FLEXT_THREADS;FLEXT_USE_SIMD;FLEXT_EXPORTS" StringPooling="TRUE" RuntimeLibrary="1" @@ -753,7 +753,7 @@ copy F:\prog\max\flext\max-msvc\flext.max.dll f:\prog\dll InlineFunctionExpansion="2" FavorSizeOrSpeed="0" EnableFiberSafeOptimizations="FALSE" - AdditionalIncludeDirectories="F:\prog\audio\MaxWinSDK\c74support\max-includes,F:\prog\audio\MaxWinSDK\c74support\msp-includes,f:\prog\packs\pthreads,f:\prog\audio\sndobj\include,f:\prog\audio\stk\include" + AdditionalIncludeDirectories=""C:\data\prog\audio\maxmspsdk_win\4.5 headers\c74support\max-includes";"C:\data\prog\audio\maxmspsdk_win\4.5 headers\c74support\msp-includes";c:\data\prog\audio\sndobj\include;c:\data\prog\audio\stk\include" PreprocessorDefinitions="WIN32;_LIB;FLEXT_SYS_MAX;FLEXT_USE_SIMD;FLEXT_EXPORTS;FLEXT_THREADS" StringPooling="TRUE" RuntimeLibrary="0" @@ -4042,7 +4042,8 @@ copy F:\prog\max\flext\max-msvc\flext.max.dll f:\prog\dll PreprocessorDefinitions=""/> </FileConfiguration> <FileConfiguration - Name="PD Threads Debug|Win32"> + Name="PD Threads Debug|Win32" + ExcludedFromBuild="TRUE"> <Tool Name="VCCLCompilerTool" Optimization="0" @@ -4062,7 +4063,8 @@ copy F:\prog\max\flext\max-msvc\flext.max.dll f:\prog\dll BrowseInformation="1"/> </FileConfiguration> <FileConfiguration - Name="PD Threads Release|Win32"> + Name="PD Threads Release|Win32" + ExcludedFromBuild="TRUE"> <Tool Name="VCCLCompilerTool" Optimization="2" @@ -4242,7 +4244,8 @@ copy F:\prog\max\flext\max-msvc\flext.max.dll f:\prog\dll PreprocessorDefinitions=""/> </FileConfiguration> <FileConfiguration - Name="PD Threads Debug|Win32"> + Name="PD Threads Debug|Win32" + ExcludedFromBuild="TRUE"> <Tool Name="VCCLCompilerTool" Optimization="0" @@ -4262,7 +4265,8 @@ copy F:\prog\max\flext\max-msvc\flext.max.dll f:\prog\dll BrowseInformation="1"/> </FileConfiguration> <FileConfiguration - Name="PD Threads Release|Win32"> + Name="PD Threads Release|Win32" + ExcludedFromBuild="TRUE"> <Tool Name="VCCLCompilerTool" Optimization="2" diff --git a/externals/grill/flext/make-inc.max-msvc b/externals/grill/flext/make-inc.max-msvc index ffbbb544..d91b2b29 100644 --- a/externals/grill/flext/make-inc.max-msvc +++ b/externals/grill/flext/make-inc.max-msvc @@ -68,10 +68,10 @@ OBJPATH=td !else !ifndef _DEBUG -CFLAGS=$(CFLAGS) $(OFLAGS) /ML +CFLAGS=$(CFLAGS) $(OFLAGS) /MT OBJPATH=s !else -CFLAGS=$(CFLAGS) $(DFLAGS) /MLd +CFLAGS=$(CFLAGS) $(DFLAGS) /MTd OBJPATH=sd !endif diff --git a/externals/grill/flext/make-inc.pd-msvc b/externals/grill/flext/make-inc.pd-msvc index 5aa431f6..665eca2c 100644 --- a/externals/grill/flext/make-inc.pd-msvc +++ b/externals/grill/flext/make-inc.pd-msvc @@ -75,10 +75,10 @@ OBJPATH=td !else !ifndef _DEBUG -CFLAGS=$(CFLAGS) $(OFLAGS) /ML +CFLAGS=$(CFLAGS) $(OFLAGS) /MT OBJPATH=s !else -CFLAGS=$(CFLAGS) $(DFLAGS) /MLd +CFLAGS=$(CFLAGS) $(DFLAGS) /MTd OBJPATH=sd !endif diff --git a/externals/grill/flext/source/flclass.h b/externals/grill/flext/source/flclass.h index 12f274bd..7f19e6cf 100644 --- a/externals/grill/flext/source/flclass.h +++ b/externals/grill/flext/source/flclass.h @@ -231,6 +231,9 @@ public: //! Output string aka symbol (index n starts with 0) 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; //! Output list (index n starts with 0) @@ -264,6 +267,9 @@ public: //! Output string aka symbol (to appointed outlet) 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; //! Output list (index n starts with 0) @@ -292,6 +298,9 @@ public: //! Send string aka symbol to self (inlet 0) 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); } //! Send list to self (inlet n) @@ -736,6 +745,7 @@ protected: void ToSysInt(int n,int f) const; 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; diff --git a/externals/grill/flext/source/flout.cpp b/externals/grill/flext/source/flout.cpp index 922dc59f..c0d72ac7 100644 --- a/externals/grill/flext/source/flout.cpp +++ b/externals/grill/flext/source/flout.cpp @@ -25,6 +25,29 @@ void flext_base::ToSysSymbol(int n,const t_symbol *s) const { outlet *o = GetOut void flext_base::ToSysList(int n,int argc,const t_atom *argv) const { outlet *o = GetOut(n); if(o) { CRITON(); outlet_list((t_outlet *)o,const_cast<t_symbol *>(sym_list),argc,(t_atom *)argv); CRITOFF(); } } 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 void flext_base::ToSysBang(int n) const { fts_outlet_bang((fts_object *)thisHdr(),n); } @@ -52,6 +75,7 @@ void flext_base::ToOutBang(int n) const { if(CHKTHR()) ToSysBang(n); else ToQueu void flext_base::ToOutFloat(int n,float f) const { if(CHKTHR()) ToSysFloat(n,f); else ToQueueFloat(n,f); } 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); } diff --git a/externals/grill/flext/source/flqueue.cpp b/externals/grill/flext/source/flqueue.cpp index 41b201d7..9277887b 100755 --- a/externals/grill/flext/source/flqueue.cpp +++ b/externals/grill/flext/source/flqueue.cpp @@ -32,7 +32,11 @@ flext::thrid_t flext::thrmsgid = 0; class qmsg { 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; } + 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 void Send() const @@ -98,10 +102,11 @@ public: { t_atom *at = GetAtoms(1); SetInt(*at,dt); + const t_symbol *sym; #if FLEXT_SYS == FLEXT_SYS_PD - const t_symbol *sym = sym_float; + sym = sym_float; #elif FLEXT_SYS == FLEXT_SYS_MAX - const t_symbol *sym = sym_int; + sym = sym_int; #else #error Not implemented! #endif @@ -115,6 +120,30 @@ public: Set(th,o,sym_symbol,1,at); } + 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) { t_atom *at = GetAtoms(argc); @@ -312,6 +341,12 @@ void flext_base::ToQueueSymbol(int o,const t_symbol *s) const Trigger(); } +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 { queue.Push(const_cast<flext_base *>(this),o,argc,argv); diff --git a/externals/grill/flext/source/flstdc.h b/externals/grill/flext/source/flstdc.h index 0bc70cd3..0a63111e 100644 --- a/externals/grill/flext/source/flstdc.h +++ b/externals/grill/flext/source/flstdc.h @@ -118,6 +118,7 @@ extern "C" { #include "ext.h" #include "ext_user.h" +#include "ext_critical.h" #include "z_dsp.h" } // extern "C" diff --git a/externals/grill/flext/source/flsupport.h b/externals/grill/flext/source/flsupport.h index be64b1e2..31b64f2a 100644 --- a/externals/grill/flext/source/flsupport.h +++ b/externals/grill/flext/source/flsupport.h @@ -437,11 +437,11 @@ public: //! Check whether the atom can be a pointer 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; } + static t_gpointer *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; } + 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,void *p) { a.a_type = A_POINTER; a.a_w.w_gpointer = (t_gpointer *)p; } + 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 //! Check for a float and get its value @@ -645,6 +645,29 @@ public: // --- 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 @{ |