aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/dyn
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2004-10-27 18:19:51 +0000
committerThomas Grill <xovo@users.sourceforge.net>2004-10-27 18:19:51 +0000
commit1471f1a6b3cf6169c6aae49f2cef643bc3c3c872 (patch)
tree50ae6f3e94d60b611cfd9f6cdad98b7eed180645 /externals/grill/dyn
parent89ca5ec0c49ae8923a206668ef9284257c56a104 (diff)
fixes for dsp and abstraction inlets
a few fixes dyn documentation more functionality only one dyn_id type for clarity better interface for listeners dyn_Finish instead of dyn_Flush all the major things are working in dyn! OSX checkin name changes for svn repository small fixes doesn't really work, but should compile dyn python module checkin now able to have real root patchers initial coding a few more things deleted test/mar patches (moved to /doc branch) dyn SWIG module dyn additions a _few_ changes in UIUI, establishing node groups made API headers monolithic first working dyn! updated todo list svn path=/trunk/; revision=2173
Diffstat (limited to 'externals/grill/dyn')
-rw-r--r--externals/grill/dyn/build-pd-darwin.sh2
-rw-r--r--externals/grill/dyn/build-pd-linux.sh11
-rw-r--r--externals/grill/dyn/build-pd-msvc.bat4
-rw-r--r--externals/grill/dyn/config-pd-darwin.txt30
-rw-r--r--externals/grill/dyn/config-pd-linux.txt35
-rw-r--r--externals/grill/dyn/config-pd-msvc.txt23
-rw-r--r--externals/grill/dyn/dyn.h399
-rw-r--r--externals/grill/dyn/dyn.vcproj227
-rw-r--r--externals/grill/dyn/dyn.vcproj.vspscc10
-rw-r--r--externals/grill/dyn/dyn_api.cpp269
-rw-r--r--externals/grill/dyn/dyn_base.cpp23
-rw-r--r--externals/grill/dyn/dyn_conn.cpp40
-rw-r--r--externals/grill/dyn/dyn_create.cpp246
-rw-r--r--externals/grill/dyn/dyn_data.h192
-rw-r--r--externals/grill/dyn/dyn_listen.cpp68
-rw-r--r--externals/grill/dyn/dyn_main.cpp85
-rw-r--r--externals/grill/dyn/dyn_message.cpp10
-rw-r--r--externals/grill/dyn/dyn_object.cpp9
-rw-r--r--externals/grill/dyn/dyn_patchable.cpp101
-rw-r--r--externals/grill/dyn/dyn_patcher.cpp24
-rw-r--r--externals/grill/dyn/dyn_pd.h30
-rw-r--r--externals/grill/dyn/dyn_proto.h29
-rw-r--r--externals/grill/dyn/dyn_proxy.cpp96
-rw-r--r--externals/grill/dyn/dyn_proxy.h74
-rw-r--r--externals/grill/dyn/dyn_send.cpp80
-rw-r--r--externals/grill/dyn/dyn_text.cpp9
-rw-r--r--externals/grill/dyn/gpl.txt346
-rw-r--r--externals/grill/dyn/license.txt50
-rw-r--r--externals/grill/dyn/make-files.txt16
-rw-r--r--externals/grill/dyn/makefile.pd-darwin88
-rw-r--r--externals/grill/dyn/makefile.pd-linux98
-rw-r--r--externals/grill/dyn/makefile.pd-msvc60
-rw-r--r--externals/grill/dyn/readme.txt70
-rwxr-xr-xexternals/grill/dyn/todo.txt8
34 files changed, 1938 insertions, 924 deletions
diff --git a/externals/grill/dyn/build-pd-darwin.sh b/externals/grill/dyn/build-pd-darwin.sh
index edd03207..1755372b 100644
--- a/externals/grill/dyn/build-pd-darwin.sh
+++ b/externals/grill/dyn/build-pd-darwin.sh
@@ -4,7 +4,7 @@
make -f makefile.pd-darwin &&
{
- if [ $INSTPATH != "" ]; then
+ if [ $INSTDIR != "" ]; then
echo Now install as root
sudo make -f makefile.pd-darwin install
fi
diff --git a/externals/grill/dyn/build-pd-linux.sh b/externals/grill/dyn/build-pd-linux.sh
deleted file mode 100644
index 413650f7..00000000
--- a/externals/grill/dyn/build-pd-linux.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-
-. config-pd-linux.txt
-
-make -f makefile.pd-linux &&
-{
- if [ $INSTPATH != "" ]; then
- echo Now install as root
- su -c "make -f makefile.pd-linux install"
- fi
-}
diff --git a/externals/grill/dyn/build-pd-msvc.bat b/externals/grill/dyn/build-pd-msvc.bat
deleted file mode 100644
index d6187f08..00000000
--- a/externals/grill/dyn/build-pd-msvc.bat
+++ /dev/null
@@ -1,4 +0,0 @@
-@echo --- Building with MS Visual C++ ---
-
-nmake -f makefile.pd-msvc clean
-nmake -f makefile.pd-msvc
diff --git a/externals/grill/dyn/config-pd-darwin.txt b/externals/grill/dyn/config-pd-darwin.txt
index 7494d33b..4c3c54c0 100644
--- a/externals/grill/dyn/config-pd-darwin.txt
+++ b/externals/grill/dyn/config-pd-darwin.txt
@@ -1,35 +1,17 @@
-# dyn~ - dynamic object management for PD
-#
-# Copyright (c)Thomas Grill (xovo@gmx.net)
-# For information on usage and redistribution, and for a DISCLAIMER OF ALL
-# WARRANTIES, see the file, "license.txt," in this distribution.
-#
-# your c++ compiler (define only if not g++)
-# CXX=gcc-3.3
+# your c++ compiler (define only if it's different than g++)
+# CXX=g++-3.3
-# where are the PD header files?
-# leave it blank if it is a system directory (like /usr/local/include),
-# since gcc 3.2 complains about it
-PDPATH=../../../pd/src
-
-# where is the PD executable?
-PD=/usr/local/bin/pd
-
-# where do the flext libraries reside?
-FLEXTPATH=/usr/local/lib/pd/flext
+# where are the PD header files? (m_pd.h, m_imp.h, g_canvas.h)
+PDPATH=/Volumes/Daten/Prog/pd-0.37-4/src
# where should flext libraries be built?
TARGDIR=./pd-darwin
-# where should dyn be installed?
+# where should the dyn library and header be installed?
# (leave blank to omit installation)
-INSTPATH=/usr/local/lib/pd/extra
+PREFIX=/usr/local
# additional compiler flags
# (check if they fit for your system!)
UFLAGS=-malign-power -maltivec -faltivec
-
-# build with a shared flext library
-FLEXT_SHARED=1
-
diff --git a/externals/grill/dyn/config-pd-linux.txt b/externals/grill/dyn/config-pd-linux.txt
deleted file mode 100644
index 8cb605be..00000000
--- a/externals/grill/dyn/config-pd-linux.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-# dyn~ - dynamic object management for PD
-#
-# Copyright (c)Thomas Grill (xovo@gmx.net)
-# For information on usage and redistribution, and for a DISCLAIMER OF ALL
-# WARRANTIES, see the file, "license.txt," in this distribution.
-#
-
-# your c++ compiler (define only if not g++)
-# CXX=
-
-# where are the PD source files?
-# (the normal header file doesn't work as g_canvas.h is not there)
-# please note that currently the development branch (e.g devel_0_36) is needed
-#
-PDPATH=/usr/src/pd-0.37-0/src
-
-# where do the flext libraries reside?
-FLEXTPATH=/usr/local/lib/pd/flext
-
-# where should flext libraries be built?
-TARGDIR=./pd-linux
-
-# where should the external be installed?
-# (leave blank to omit installation)
-INSTPATH=/usr/local/lib/pd/extra
-
-
-# additional compiler flags
-# (check if they fit for your system!)
-# UFLAGS=-mcpu=pentiumpro # gcc 2.95
-# UFLAGS=-mcpu=pentium3 -msse # gcc 3.2
-
-# define for shared build
-#FLEXT_SHARED=1
-
diff --git a/externals/grill/dyn/config-pd-msvc.txt b/externals/grill/dyn/config-pd-msvc.txt
deleted file mode 100644
index e163ffd3..00000000
--- a/externals/grill/dyn/config-pd-msvc.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-# dyn~ - dynamic object management for PD
-#
-# Copyright (c)Thomas Grill (xovo@gmx.net)
-# For information on usage and redistribution, and for a DISCLAIMER OF ALL
-# WARRANTIES, see the file, "license.txt," in this distribution.
-#
-
-# where is PD?
-PDPATH=c:\programme\audio\pd
-
-# where do the flext libraries reside?
-FLEXTPATH=$(PDPATH)\flext
-
-# where is MS VC++ installed?
-# if the VC++ command prompt is used VCINSTALLDIR should already be set correctly
-MSVCDIR=$(VCINSTALLDIR)
-
-# where should the external be built?
-OUTPATH=pd-msvc
-
-# where should the external be installed?
-# (leave blank to omit installation)
-INSTPATH=$(PDPATH)\extra
diff --git a/externals/grill/dyn/dyn.h b/externals/grill/dyn/dyn.h
new file mode 100644
index 00000000..3f593fe9
--- /dev/null
+++ b/externals/grill/dyn/dyn.h
@@ -0,0 +1,399 @@
+/*
+dyn - dynamical object management
+
+Copyright (c)2003-2004 Thomas Grill (gr@grrrr.org)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+*/
+
+#ifndef __DYN_H
+#define __DYN_H
+
+
+#define DYN_VERSION_MAJOR 0
+#define DYN_VERSION_MINOR 2
+
+#define DYN_VERSION (DYN_VERSION_MAJOR*100+DYN_VERSION_MINOR)
+
+
+#ifdef _MSC_VER
+ #ifdef DYN_EXPORTS
+ #define DYN_EXPORT __declspec(dllexport)
+ #else
+ #define DYN_EXPORT __declspec(dllimport)
+ #endif
+#else
+ #define DYN_EXPORT extern
+#endif
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* include PD public header for some type definitions */
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable: 4091 4244)
+#endif
+#include "m_pd.h"
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+
+#define DYN_ID_NONE 0
+
+
+/* error codes */
+#define DYN_ERROR_NONE 0 /* no error -> OK! */
+
+#define DYN_ERROR_GENERAL -1
+#define DYN_ERROR_TYPEMISMATCH -2
+#define DYN_ERROR_NOTFOUND -3
+#define DYN_ERROR_NOTCREATED -4 /* error creating object */
+
+#define DYN_ERROR_PARAMS -101 /* wrong parameters */
+#define DYN_ERROR_NOOBJ -102 /* object not found */
+#define DYN_ERROR_NOSUB -103 /* sub-patcher not found */
+#define DYN_ERROR_NOIN -104 /* inlet out of range */
+#define DYN_ERROR_NOOUT -105 /* outlet out of range */
+
+#define DYN_ERROR_CONN_GENERAL -200 /* could not connect/disconnect */
+#define DYN_ERROR_CONN_PATCHER -201 /* objects to connect have different owners */
+
+
+/*! Constants for message scheduling */
+#define DYN_SCHED_AUTO -1
+#define DYN_SCHED_NOW 1
+#define DYN_SCHED_QUEUE 0
+
+
+/* object types */
+#define DYN_TYPE_PATCHER 1 /* object is a (sub-)patcher */
+#define DYN_TYPE_OBJECT 2 /* object is a real object */
+#define DYN_TYPE_MESSAGE 3 /* object is a message object */
+#define DYN_TYPE_TEXT 4 /* object is text comment */
+#define DYN_TYPE_CONN 5 /* object is a connection */
+#define DYN_TYPE_LISTENER 6 /* object is a listener to an outlet */
+
+
+/* inlet/outlet types */
+#define DYN_INOUT_MESSAGE 0 /* message inlet/outlet */
+#define DYN_INOUT_SIGNAL 1 /* signal inlet/outlet */
+
+/* callback signals */
+#define DYN_SIGNAL_NEW 0 /* object has been created */
+#define DYN_SIGNAL_FREE 1 /* object has been destroyed */
+#define DYN_SIGNAL_DISCONN 2 /* object has been disconnected */
+
+
+/*! Type definition for any dyn object identifier */
+struct dyn_ident;
+typedef dyn_ident *dyn_id;
+
+
+/*! Type of an object enumeration function
+ \param id Object ID
+ \return 0 -> stop enumeration, != 0 -> go on
+*/
+typedef int dyn_enumfun(dyn_id id,void *data);
+
+/* Type of an object callback function
+ \param id Object id
+ \param signal Type of signal (DYN_SIGNAL_* constant)
+ \param data User defined data, passed at object creation
+*/
+typedef void dyn_callback(dyn_id id,int signal,void *data);
+
+/* Type of a listener function
+ \param lid Listener object ID
+ \param id Object ID
+ \param outlet Outlet index
+ \param sym Message tag
+ \param argc Message atom count
+ \param argv Message atom list
+*/
+typedef void dyn_listener(dyn_id lid,dyn_id id,int outlet,const t_symbol *sym,int argc,const t_atom *argv,void *data);
+
+
+
+/*! Get dyn version number
+ \return version number major*100+minor
+*/
+DYN_EXPORT int dyn_Version();
+
+/*! Restrict dyn operation to the calling thread
+ \return ok = 0, error code < 0
+*/
+DYN_EXPORT int dyn_Lock();
+
+/*! Unrestrict dyn operation
+ \return ok = 0, error code < 0
+*/
+DYN_EXPORT int dyn_Unlock();
+
+
+/*! Get number of pending scheduled operations
+ \return number of commands, error code < 0
+*/
+DYN_EXPORT int dyn_Pending();
+
+
+/*! Wait for all pending operations to finish
+ \return ok = 0, error code < 0
+*/
+DYN_EXPORT int dyn_Finish();
+
+
+/*! Clear all objects
+ \return ok = 0, error code < 0
+*/
+DYN_EXPORT int dyn_Reset();
+
+
+/*! Enumerate all objects in a patcher
+ \param pid Patcher object ID
+ \param fun Enumeration function
+ \param data User defined data
+ \return ok = 0, error code < 0
+*/
+DYN_EXPORT int dyn_EnumObjects(dyn_id pid,dyn_enumfun fun,void *data);
+
+
+/*! Create a new sub-patcher
+ \param sched Scheduling constant (DYN_SCHED_*)
+ \param id Pointer to new object id (returned on success)
+ \param cb Callback function
+ \param pid Pointer to parent patcher where the new object shall be created
+ \return ok = 0, error code < 0
+
+ \note If this command is queued, the object may not have been created on function return
+*/
+DYN_EXPORT int dyn_NewPatcher(int sched,dyn_id *id,dyn_callback cb,dyn_id pid);
+
+
+/*! Create a new object
+ \param sched Scheduling constant (DYN_SCHED_*)
+ \param id Pointer to new object id (returned on success)
+ \param cb Callback function
+ \param pid Pointer to parent patcher where the new object shall be created
+ \param obj Object name (symbol tag)
+ \param argc Number of argument atoms
+ \param argv Array of atoms
+ \return ok = 0, error code < 0
+
+ \note If this command is queued, the object may not have been created on function return
+*/
+DYN_EXPORT int dyn_NewObject(int sched,dyn_id *id,dyn_callback cb,dyn_id pid,const t_symbol *obj,int argc,const t_atom *argv);
+
+/*! Create a new object (with string command line)
+ \param sched Scheduling constant (DYN_SCHED_*)
+ \param id Pointer to new object id (returned on success)
+ \param cb Callback function
+ \param pid Pointer to parent patcher where the new object shall be created
+ \param args String of object name and arguments
+ \return ok = 0, error code < 0
+
+ \note If this command is queued, the object may not have been created on function return
+*/
+DYN_EXPORT int dyn_NewObjectStr(int sched,dyn_id *id,dyn_callback cb,dyn_id pid,const char *args);
+
+
+/*! Create a new message object
+ \param sched Scheduling constant (DYN_SCHED_*)
+ \param id Pointer to new object id (returned on success)
+ \param cb Callback function
+ \param pid Pointer to parent patcher where the new object shall be created
+ \param argc Number of argument atoms
+ \param argv Array of atoms
+ \return ok = 0, error code < 0
+
+ \note If this command is queued, the object may not have been created on function return
+*/
+DYN_EXPORT int dyn_NewMessage(int sched,dyn_id *id,dyn_callback cb,dyn_id pid,int argc,t_atom *argv);
+
+/*! Create a new message object (with string message)
+ \param sched Scheduling constant (DYN_SCHED_*)
+ \param id Pointer to new object id (returned on success)
+ \param cb Callback function
+ \param pid Pointer to parent patcher where the new object shall be created
+ \param msg String of message text
+ \return ok = 0, error code < 0
+
+ \note If this command is queued, the object may not have been created on function return
+*/
+DYN_EXPORT int dyn_NewMessageStr(int sched,dyn_id *id,dyn_callback cb,dyn_id pid,const char *msg);
+
+
+/*! Connect two dyn objects
+ \param sched Scheduling constant (DYN_SCHED_*)
+ \param id return pointer to newly created connection object
+ \param cb Callback function
+ \param sid Source Object id (already present in dyn)
+ \param outlet Source outlet index
+ \param did Drain Object id (already present in dyn)
+ \param outlet Drain inlet index
+ \return ok = 0, error code < 0
+
+ \note If this command is queued, the object may not have been created on function return
+*/
+DYN_EXPORT int dyn_NewConnection(int sched,dyn_id *id,dyn_callback cb,dyn_id sid,int outlet,dyn_id did,int inlet);
+
+
+/*! Delete a formerly created dyn object
+ \note This can be any dyn object of type DYN_TYPE_*
+ \note The ID will become invalid at function call
+
+ \param sched Scheduling constant (DYN_SCHED_*)
+ \param id Object id (already present in dyn)
+ \return ok = 0, error code < 0
+*/
+DYN_EXPORT int dyn_Free(int sched,dyn_id id);
+
+
+/*! Attach a data packet to a dyn object
+ \param id Object ID (already present and valid)
+ \param data Pointer to data packet
+ \return ok = 0, error code < 0
+
+ \note This is executed immediately without scheduling
+*/
+DYN_EXPORT int dyn_SetData(dyn_id id,void *data);
+
+
+/*! Retrieve a data packet from a dyn object
+ \param id Object ID (already present and valid)
+ \param data Pointer to data packet
+ \return ok = 0, error code < 0
+
+ \note This is executed immediately without scheduling
+*/
+DYN_EXPORT int dyn_GetData(dyn_id id,void **data);
+
+
+/*! Retrieve the object type
+ \param id Object ID (already present and valid)
+ \return object type (DYN_TYPE_*) >= 0, error code < 0
+
+ \note This is executed immediately without scheduling
+*/
+DYN_EXPORT int dyn_GetType(dyn_id id);
+
+
+/*! Get number of inlets
+ \param id Object ID (already present and valid)
+ \return Number of inlets >= 0, error code < 0
+ \note This is executed immediately without scheduling
+*/
+DYN_EXPORT int dyn_GetInletCount(dyn_id id);
+
+/*! Get number of outlets
+ \param id Object ID (already present and valid)
+ \return Number of outlets >= 0, error code < 0
+ \note This is executed immediately without scheduling
+*/
+DYN_EXPORT int dyn_GetOutletCount(dyn_id id);
+
+
+/*! Get inlet type
+ \param id Object ID (already present and valid)
+ \param inlet Inlet index
+ \return Inlet type >= 0 (DYN_INOUT_MESSAGE or DYN_INOUT_SIGNAL), error code < 0
+ \note This is executed immediately without scheduling
+*/
+DYN_EXPORT int dyn_GetInletType(dyn_id id,int inlet);
+
+/*! Get outlet type
+ \param id Object ID (already present and valid)
+ \param outlet Outlet index
+ \return Outlet type >= 0 (DYN_INOUT_MESSAGE or DYN_INOUT_SIGNAL), error code < 0
+ \note This is executed immediately without scheduling
+*/
+DYN_EXPORT int dyn_GetOutletType(dyn_id id,int outlet);
+
+
+/*! Enumerate connections to inlet
+ \param id Object ID (already present and valid)
+ \param inlet Inlet index
+ \param fun Enumeration function
+ \param data User data
+ \return ok = 0, error code < 0
+ \note This is executed immediately without scheduling
+*/
+DYN_EXPORT int dyn_EnumInletConnections(dyn_id id,int inlet,dyn_enumfun fun,void *data);
+
+/*! Enumerate connections from outlet
+ \param id Object ID (already present and valid)
+ \param outlet Outlet index
+ \param fun Enumeration function
+ \param data User data
+ \return ok = 0, error code < 0
+ \note This is executed immediately without scheduling
+*/
+DYN_EXPORT int dyn_EnumOutletConnections(dyn_id id,int outlet,dyn_enumfun fun,void *data);
+
+
+/*! Get source object of a connection
+ \param cid Connection object ID
+ \param oid Return pointer for connected object ID (may be NULL if not needed)
+ \param outlet Return int for outlet index (may be NULL if not needed)
+ \return ok = 0, error code < 0
+ \note This is executed immediately without scheduling
+*/
+DYN_EXPORT int dyn_GetConnectionSource(dyn_id cid,dyn_id *oid,int *outlet);
+
+/*! Get drain object of a connection
+ \param cid Connection object ID
+ \param oid Return pointer for connected object ID (may be NULL if not needed)
+ \param inlet Return int for inlet index (may be NULL if not needed)
+ \return ok = 0, error code < 0
+ \note This is executed immediately without scheduling
+*/
+DYN_EXPORT int dyn_GetConnectionDrain(dyn_id cid,dyn_id *oid,int *inlet);
+
+
+/*! Send a message to a dyn object
+ \remark This often avoids the need for a connection to the respective object
+
+ \param sched Scheduling constant (DYN_SCHED_*)
+ \param id Object ID
+ \param inlet Inlet index to send message to
+ \param sym Message tag
+ \param argc Message atom count
+ \param argv Message atom list
+ \return ok = 0, error code < 0
+*/
+DYN_EXPORT int dyn_Send(int sched,dyn_id id,int inlet,const t_symbol *sym,int argc,const t_atom *argv);
+
+/*! Send a message (as a string) to a dyn object
+ \remark This often avoids the need for a connection to the respective object
+
+ \param sched Scheduling constant (DYN_SCHED_*)
+ \param id Object ID
+ \param inlet Inlet index to send message to
+ \param msg Message string
+ \return ok = 0, error code < 0
+*/
+DYN_EXPORT int dyn_SendStr(int sched,dyn_id id,int inlet,const char *msg);
+
+/*! Listen to the outlet of a dyn object
+ \remark This often avoids the need for a connection to the respective object
+
+ \param sched Scheduling constant (DYN_SCHED_*)
+ \param id Backpointer to created listener object ID
+ \param oid Object ID to listen to
+ \param outlet Outlet index to listen to
+ \param cb Listener callback function
+ \param data User data
+ \return ok = 0, error code < 0
+*/
+DYN_EXPORT int dyn_Listen(int sched,dyn_id *id,dyn_id oid,int outlet,dyn_listener cb,void *data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* __DYN_H */
diff --git a/externals/grill/dyn/dyn.vcproj b/externals/grill/dyn/dyn.vcproj
index 78c3061a..a6789115 100644
--- a/externals/grill/dyn/dyn.vcproj
+++ b/externals/grill/dyn/dyn.vcproj
@@ -3,19 +3,16 @@
ProjectType="Visual C++"
Version="7.10"
Name="dyn"
- SccProjectName="dyn"
- SccAuxPath=""
- SccLocalPath="."
- SccProvider="MSSCCI:Jalindi Igloo">
+ ProjectGUID="{0176D72E-797E-4221-BB4A-0A37BB0860AC}">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
- Name="Debug|Win32"
- OutputDirectory=".\pd-msvc/d"
- IntermediateDirectory=".\pd-msvc/d"
+ Name="PD Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
@@ -23,32 +20,29 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="c:\programme\audio\pd\src,f:\prog\max\flext\source"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PD"
+ AdditionalIncludeDirectories="f:\prog\pd\pd-cvs\src"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;DYN_EXPORTS;NT;PD"
BasicRuntimeChecks="3"
- RuntimeLibrary="5"
+ RuntimeLibrary="3"
+ RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="2"
- PrecompiledHeaderFile=".\pd-msvc/d/dyn.pch"
- AssemblerListingLocation=".\pd-msvc/d/"
- ObjectFile=".\pd-msvc/d/"
- ProgramDataBaseFileName=".\pd-msvc/d/"
- BrowseInformation="1"
+ PrecompiledHeaderFile=".\Debug/dyn.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
- DebugInformationFormat="4"
- CompileAs="0"/>
+ DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="pd.lib flext_d-pdwin.lib pthreadVC.lib"
- OutputFile="$(outdir)/dyn~.dll"
+ OutputFile="../../debug/dyn.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
- AdditionalLibraryDirectories="c:\programme\audio\pd/bin,..\flext\pd-msvc"
GenerateDebugInformation="TRUE"
- ProgramDatabaseFile=".\pd-msvc/d/dyn~.pdb"
- ImportLibrary=".\pd-msvc/d/dyn~.lib"
+ ProgramDatabaseFile=".\Debug/dyn.pdb"
+ ImportLibrary=".\Debug/dyn.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
@@ -56,7 +50,7 @@
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
- TypeLibraryName=".\pd-msvc/d/dyn.tlb"
+ TypeLibraryName=".\Debug/dyn.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
@@ -80,9 +74,9 @@
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
- Name="Release|Win32"
- OutputDirectory=".\pd-msvc/r"
- IntermediateDirectory=".\pd-msvc/r"
+ Name="PD Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
@@ -91,97 +85,30 @@
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="c:\programme\audio\pd\src,f:\prog\max\flext\source"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PD"
- StringPooling="TRUE"
- RuntimeLibrary="4"
- EnableFunctionLevelLinking="TRUE"
- UsePrecompiledHeader="2"
- PrecompiledHeaderFile=".\pd-msvc/r/dyn.pch"
- AssemblerListingLocation=".\pd-msvc/r/"
- ObjectFile=".\pd-msvc/r/"
- ProgramDataBaseFileName=".\pd-msvc/r/"
- WarningLevel="3"
- SuppressStartupBanner="TRUE"
- CompileAs="0"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="pd.lib flext-pdwin.lib pthreadVC.lib"
- OutputFile="pd-msvc/dyn~.dll"
- LinkIncremental="1"
- SuppressStartupBanner="TRUE"
- AdditionalLibraryDirectories="c:\programme\audio\pd/bin,..\flext\pd-msvc"
- ProgramDatabaseFile=".\pd-msvc/r/dyn~.pdb"
- ImportLibrary=".\pd-msvc/r/dyn~.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="NDEBUG"
- MkTypLibCompatible="TRUE"
- SuppressStartupBanner="TRUE"
- TargetEnvironment="1"
- TypeLibraryName=".\pd-msvc/r/dyn.tlb"
- HeaderFileName=""/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
- Culture="3079"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="PD Shared Release|Win32"
- OutputDirectory="./pd-msvc/sr"
- IntermediateDirectory="./pd-msvc/sr"
- ConfigurationType="2"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="FALSE"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="3"
- GlobalOptimizations="TRUE"
- InlineFunctionExpansion="2"
- FavorSizeOrSpeed="2"
- OmitFramePointers="TRUE"
- OptimizeForProcessor="3"
- AdditionalIncludeDirectories="f:\prog\pd\pd-cvs\src,f:\prog\max\flext\source;f:\prog\packs\pthreads"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FLEXT_SYS=2;FLEXT_SHARED"
+ AdditionalIncludeDirectories="f:\prog\pd\pd-cvs\src"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;DYN_EXPORTS,PD,NT"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
- EnableEnhancedInstructionSet="1"
+ RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="2"
- PrecompiledHeaderFile="$(outdir)/dyn.pch"
+ PrecompiledHeaderFile=".\Release/dyn.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="pd.lib pthreadVC.lib"
- OutputFile="$(outdir)/dyn~.dll"
+ AdditionalDependencies="pd.lib"
+ OutputFile="../../Release/dyn.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
- AdditionalLibraryDirectories="f:\prog\pd\pd-cvs/bin,..\flext\pd-msvc,f:\prog\packs\pthreads"
- ProgramDatabaseFile="$(outdir)/dyn~.pdb"
- ImportLibrary="$(outdir)/dyn~.lib"
+ AdditionalLibraryDirectories="../..\api\lib"
+ ProgramDatabaseFile=".\Release/dyn.pdb"
+ ImportLibrary="..\..\api\lib\dyn.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
@@ -189,10 +116,14 @@
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
- TypeLibraryName=".\pd-msvc/r/dyn.tlb"
+ TypeLibraryName=".\Release/dyn.tlb"
HeaderFileName=""/>
<Tool
- Name="VCPostBuildEventTool"/>
+ Name="VCPostBuildEventTool"
+ Description="copy API"
+ CommandLine="
+copy dyn.h ..\..\api\include
+"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
@@ -217,42 +148,66 @@
</References>
<Files>
<Filter
- Name="doc"
+ Name="objects"
+ Filter="">
+ <File
+ RelativePath=".\dyn_base.cpp">
+ </File>
+ <File
+ RelativePath=".\dyn_conn.cpp">
+ </File>
+ <File
+ RelativePath=".\dyn_message.cpp">
+ </File>
+ <File
+ RelativePath=".\dyn_object.cpp">
+ </File>
+ <File
+ RelativePath=".\dyn_patchable.cpp">
+ </File>
+ <File
+ RelativePath=".\dyn_patcher.cpp">
+ </File>
+ <File
+ RelativePath=".\dyn_text.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="io"
Filter="">
<File
- RelativePath="make-files.txt">
+ RelativePath=".\dyn_create.cpp">
+ </File>
+ <File
+ RelativePath=".\dyn_listen.cpp">
+ </File>
+ <File
+ RelativePath=".\dyn_proxy.cpp">
+ </File>
+ <File
+ RelativePath=".\dyn_proxy.h">
</File>
<File
- RelativePath="readme.txt">
+ RelativePath=".\dyn_send.cpp">
</File>
</Filter>
<File
- RelativePath="src\main.cpp">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;PD;$(NoInherit)"
- BasicRuntimeChecks="3"
- BrowseInformation="1"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;PD;$(NoInherit)"/>
- </FileConfiguration>
- <FileConfiguration
- Name="PD Shared Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""/>
- </FileConfiguration>
+ RelativePath="dyn.h">
+ </File>
+ <File
+ RelativePath=".\dyn_api.cpp">
+ </File>
+ <File
+ RelativePath=".\dyn_data.h">
+ </File>
+ <File
+ RelativePath=".\dyn_main.cpp">
+ </File>
+ <File
+ RelativePath=".\dyn_pd.h">
+ </File>
+ <File
+ RelativePath=".\dyn_proto.h">
</File>
</Files>
<Globals>
diff --git a/externals/grill/dyn/dyn.vcproj.vspscc b/externals/grill/dyn/dyn.vcproj.vspscc
deleted file mode 100644
index 6cb031bc..00000000
--- a/externals/grill/dyn/dyn.vcproj.vspscc
+++ /dev/null
@@ -1,10 +0,0 @@
-""
-{
-"FILE_VERSION" = "9237"
-"ENLISTMENT_CHOICE" = "NEVER"
-"PROJECT_FILE_RELATIVE_PATH" = ""
-"NUMBER_OF_EXCLUDED_FILES" = "0"
-"ORIGINAL_PROJECT_FILE_PATH" = ""
-"NUMBER_OF_NESTED_PROJECTS" = "0"
-"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT"
-}
diff --git a/externals/grill/dyn/dyn_api.cpp b/externals/grill/dyn/dyn_api.cpp
new file mode 100644
index 00000000..c1ecbf72
--- /dev/null
+++ b/externals/grill/dyn/dyn_api.cpp
@@ -0,0 +1,269 @@
+/*
+dyn - dynamical object management
+
+Copyright (c)2003-2004 Thomas Grill (gr@grrrr.org)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+*/
+
+#include "dyn_proto.h"
+
+DYN_EXPORT int dyn_EnumObjects(dyn_id id,dyn_enumfun fun,void *data)
+{
+ dyn_patcher *p;
+ if(id && (p = id->Patcher())) {
+ p->Enumerate(fun,data);
+ return DYN_ERROR_NONE;
+ }
+ else
+ return DYN_ERROR_NOTFOUND;
+}
+
+DYN_EXPORT int dyn_NewPatcher(int sched,dyn_id *sid,dyn_callback cb,dyn_id psid /*,const char *name*/)
+{
+ try {
+ ASSERT(sid);
+ *sid = NewObject(DYN_TYPE_PATCHER,cb,psid,NULL);
+ return *sid?DYN_ERROR_NONE:DYN_ERROR_GENERAL;
+ }
+ catch(int err) { return err; }
+}
+
+DYN_EXPORT int dyn_NewObject(int sched,dyn_id *oid,dyn_callback cb,dyn_id sid,const t_symbol *obj,int argc,const t_atom *argv)
+{
+ try {
+ ASSERT(oid);
+ *oid = NewObject(DYN_TYPE_OBJECT,cb,sid,obj,argc,argv);
+ return *oid?DYN_ERROR_NONE:DYN_ERROR_GENERAL;
+ }
+ catch(int err) { return err; }
+}
+
+DYN_EXPORT int dyn_NewObjectStr(int sched,dyn_id *oid,dyn_callback cb,dyn_id sid,const char *args)
+{
+ t_binbuf *b = binbuf_new();
+ binbuf_text(b,(char *)args,strlen(args));
+ int argc = binbuf_getnatom(b);
+ t_atom *argv = binbuf_getvec(b);
+ int ret;
+ if(argc) {
+ t_symbol *sym;
+ if(argv->a_type == A_SYMBOL) { sym = atom_getsymbol(argv); argc--,argv++; }
+ else sym = &s_list;
+ ret = dyn_NewObject(sched,oid,cb,sid,sym,argc,argv);
+ }
+ else
+ ret = DYN_ERROR_PARAMS;
+ binbuf_free(b);
+ return ret;
+}
+
+DYN_EXPORT int dyn_NewMessage(int sched,dyn_id *oid,dyn_callback cb,dyn_id sid,int argc,t_atom *argv)
+{
+ try {
+ ASSERT(oid);
+ *oid = NewObject(DYN_TYPE_MESSAGE,cb,sid,NULL,argc,argv);
+ return *oid?DYN_ERROR_NONE:DYN_ERROR_GENERAL;
+ }
+ catch(int err) { return err; }
+}
+
+DYN_EXPORT int dyn_NewMessageStr(int sched,dyn_id *oid,dyn_callback cb,dyn_id sid,const char *msg)
+{
+ t_binbuf *b = binbuf_new();
+ binbuf_text(b,(char *)msg,strlen(msg));
+ int argc = binbuf_getnatom(b);
+ t_atom *argv = binbuf_getvec(b);
+ int ret = dyn_NewMessage(sched,oid,cb,sid,argc,argv);
+ binbuf_free(b);
+ return ret;
+}
+
+DYN_EXPORT int dyn_NewConnection(int sched,dyn_id *cid,dyn_callback cb,dyn_id soid,int outlet,dyn_id doid,int inlet)
+{
+ ASSERT(cid);
+ ASSERT(soid && inlet >= 0);
+ ASSERT(doid && outlet >= 0);
+
+ dyn_patchable *sobj = soid->Patchable();
+ dyn_patchable *dobj = doid->Patchable();
+
+ int ret = DYN_ERROR_NONE;
+ dyn_id conn = DYN_ID_NONE;
+
+ if(!sobj || !dobj) {
+ ret = DYN_ERROR_TYPEMISMATCH;
+ goto error;
+ }
+
+ if(sobj->owner != dobj->owner) {
+ ret = DYN_ERROR_CONN_PATCHER;
+ goto error;
+ }
+
+ {
+ dyn_patcher *patcher = sobj->owner;
+ ASSERT(patcher);
+
+ // sys_lock();
+
+ canvas_setcurrent(patcher->glist());
+ bool ok =
+ !canvas_isconnected(patcher->glist(),(t_text *)sobj->pdobj,outlet,(t_text *)dobj->pdobj,inlet) &&
+ obj_connect((t_object *)sobj->pdobj, outlet,(t_object *)dobj->pdobj,inlet);
+ canvas_unsetcurrent(patcher->glist());
+ // sys_unlock();
+
+ if(!ok) {
+ ret = DYN_ERROR_CONN_GENERAL;
+ goto error;
+ }
+ }
+
+ conn = new dyn_ident(DYN_TYPE_CONN,cb);
+ conn->Set(new dyn_conn(conn,soid,outlet,doid,inlet));
+
+ // add connection to object lists
+ sobj->AddOutlet(conn->Conn());
+ dobj->AddInlet(conn->Conn());
+
+ *cid = conn;
+ return ret;
+
+error:
+ if(conn != DYN_ID_NONE) delete conn;
+ return ret;
+}
+
+DYN_EXPORT int dyn_Free(int sched,dyn_id oid)
+{
+ try {
+ DelObject(oid);
+ return DYN_ERROR_NONE;
+ }
+ catch(int err) { return err; }
+}
+
+// NOT IMPLEMENTED
+DYN_EXPORT int dyn_Reset()
+{
+ return DYN_ERROR_GENERAL;
+}
+
+
+DYN_EXPORT int dyn_SetData(dyn_id oid,void *data)
+{
+ if(oid) {
+ oid->userdata = data;
+ return DYN_ERROR_NONE;
+ }
+ else
+ return DYN_ERROR_NOTFOUND;
+}
+
+DYN_EXPORT int dyn_GetData(dyn_id oid,void **data)
+{
+ ASSERT(data);
+ if(oid) {
+ *data = oid->userdata;
+ return DYN_ERROR_NONE;
+ }
+ else
+ return DYN_ERROR_NOTFOUND;
+}
+
+
+DYN_EXPORT int dyn_GetType(dyn_id oid)
+{
+ if(oid)
+ return oid->type;
+ else
+ return DYN_ERROR_NOTFOUND;
+}
+
+
+DYN_EXPORT int dyn_GetInletCount(dyn_id id)
+{
+ dyn_patchable *p;
+ if(id && (p = id->Patchable()))
+ return p->GetInletCount();
+ else
+ return DYN_ERROR_NOTFOUND;
+}
+
+DYN_EXPORT int dyn_GetOutletCount(dyn_id id)
+{
+ dyn_patchable *p;
+ if(id && (p = id->Patchable()))
+ return p->GetOutletCount();
+ else
+ return DYN_ERROR_NOTFOUND;
+}
+
+DYN_EXPORT int dyn_GetInletType(dyn_id id,int inlet)
+{
+ dyn_patchable *p;
+ if(id && (p = id->Patchable()))
+ return p->GetInletType(inlet);
+ else
+ return DYN_ERROR_NOTFOUND;
+}
+
+DYN_EXPORT int dyn_GetOutletType(dyn_id id,int outlet)
+{
+ dyn_patchable *p;
+ if(id && (p = id->Patchable()))
+ return p->GetOutletType(outlet);
+ else
+ return DYN_ERROR_NOTFOUND;
+}
+
+
+DYN_EXPORT int dyn_GetConnectionSource(dyn_id cid,dyn_id *soid,int *outlet)
+{
+ ASSERT(soid && outlet);
+ dyn_conn *c;
+ if(cid && (c = cid->Conn())) {
+ *soid = c->src;
+ *outlet = c->slet;
+ return DYN_ERROR_NONE;
+ }
+ else
+ return DYN_ERROR_NOTFOUND;
+}
+
+DYN_EXPORT int dyn_GetConnectionDrain(dyn_id cid,dyn_id *doid,int *inlet)
+{
+ ASSERT(doid && inlet);
+ dyn_conn *c;
+ if(cid && (c = cid->Conn())) {
+ *doid = c->dst;
+ *inlet = c->dlet;
+ return DYN_ERROR_NONE;
+ }
+ else
+ return DYN_ERROR_NOTFOUND;
+}
+
+
+DYN_EXPORT int dyn_EnumInletConnections(dyn_id id,int inlet,dyn_enumfun fun,void *data)
+{
+ dyn_patchable *p;
+ if(id && (p = id->Patchable())) {
+ p->EnumInlet(inlet,fun,data);
+ return DYN_ERROR_NONE;
+ }
+ else
+ return DYN_ERROR_NOTFOUND;
+}
+
+DYN_EXPORT int dyn_EnumOutletConnections(dyn_id id,int outlet,dyn_enumfun fun,void *data)
+{
+ dyn_patchable *p;
+ if(id && (p = id->Patchable())) {
+ p->EnumOutlet(outlet,fun,data);
+ return DYN_ERROR_NONE;
+ }
+ else
+ return DYN_ERROR_NOTFOUND;
+}
diff --git a/externals/grill/dyn/dyn_base.cpp b/externals/grill/dyn/dyn_base.cpp
new file mode 100644
index 00000000..72ee90f0
--- /dev/null
+++ b/externals/grill/dyn/dyn_base.cpp
@@ -0,0 +1,23 @@
+/*
+dyn - dynamical object management
+
+Copyright (c)2003-2004 Thomas Grill (gr@grrrr.org)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+*/
+
+#include "dyn_proto.h"
+
+dyn_base::dyn_base(dyn_id id)
+ : ident(id)
+{
+ ident->Callback(DYN_SIGNAL_NEW);
+}
+
+dyn_base::~dyn_base()
+{
+ // ident should already have been anonymized...
+ ASSERT(!ident->data);
+
+ ident->Callback(DYN_SIGNAL_FREE);
+}
diff --git a/externals/grill/dyn/dyn_conn.cpp b/externals/grill/dyn/dyn_conn.cpp
new file mode 100644
index 00000000..4300062c
--- /dev/null
+++ b/externals/grill/dyn/dyn_conn.cpp
@@ -0,0 +1,40 @@
+/*
+dyn - dynamical object management
+
+Copyright (c)2003-2004 Thomas Grill (gr@grrrr.org)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+*/
+
+#include "dyn_proto.h"
+
+dyn_conn::~dyn_conn()
+{
+ dyn_patchable *sobj = NULL,*dobj = NULL;
+ if(src != DYN_ID_NONE && (sobj = src->Patchable()))
+ sobj->RmvOutlet(this);
+
+ if(dst != DYN_ID_NONE && (dobj = dst->Patchable()))
+ dobj->RmvInlet(this);
+
+ if(sobj || dobj) {
+ src = dst = DYN_ID_NONE;
+ ident->Callback(DYN_SIGNAL_DISCONN);
+ }
+
+ if(sobj && dobj) {
+// sys_lock();
+ obj_disconnect((t_object *)sobj->pdobj,slet,(t_object *)dobj->pdobj,dlet);
+// sys_unlock();
+ }
+}
+
+/*
+void dyn_conn::Invalidate()
+{
+ if(src != DYN_ID_NONE || dst != DYN_ID_NONE) {
+ src = dst = DYN_ID_NONE;
+ ident->Callback(DYN_SIGNAL_DISCONN);
+ }
+}
+*/ \ No newline at end of file
diff --git a/externals/grill/dyn/dyn_create.cpp b/externals/grill/dyn/dyn_create.cpp
new file mode 100644
index 00000000..b53ed89a
--- /dev/null
+++ b/externals/grill/dyn/dyn_create.cpp
@@ -0,0 +1,246 @@
+/*
+dyn - dynamical object management
+
+Copyright (c)2003-2004 Thomas Grill (gr@grrrr.org)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+*/
+
+#include "dyn_proto.h"
+#include <list>
+
+static const t_symbol *k_obj = gensym("obj");
+static const t_symbol *k_msg = gensym("msg");
+static const t_symbol *k_text = gensym("text");
+
+static const t_symbol *sym_vis = gensym("vis");
+static const t_symbol *sym_loadbang = gensym("loadbang");
+static const t_symbol *sym_pd = gensym("pd");
+static const t_symbol *sym_dsp = gensym("dsp");
+
+static const t_symbol *sym_dyn = gensym("dyn");
+static const t_symbol *sym_dot = gensym(".");
+
+
+static t_gobj *getlast(t_glist *gl)
+{
+ t_gobj *go = gl->gl_list;
+ if(go)
+ while(go->g_next) go = go->g_next;
+ return go;
+}
+
+
+void *NewPDObject(int type,t_glist *glist,const t_symbol *hdr,int _argc_,const t_atom *_argv_)
+{
+// sys_lock();
+
+ const t_symbol *kind;
+ switch(type) {
+ case DYN_TYPE_PATCHER:
+ hdr = sym_pd;
+ // fall through
+ case DYN_TYPE_OBJECT:
+ kind = k_obj;
+ break;
+ case DYN_TYPE_MESSAGE:
+ kind = k_msg;
+ ASSERT(hdr == NULL);
+ break;
+ case DYN_TYPE_TEXT:
+ kind = k_text;
+ ASSERT(hdr == NULL);
+ break;
+ }
+
+ void *newest = NULL;
+ t_gobj *last = NULL;
+
+ if(type == DYN_TYPE_PATCHER && !glist) {
+ /*
+ For a dyn root canvas we can not simply put a [pd] into canvas_getcurrent
+ because the [pd] would be visible in this canvas then.
+
+ On the other hand, we can also not simply create a new canvas with
+ canvas_getcurrent active because it would not be on the list of root dsp canvases
+ then.
+
+ Hence, we have to pop all current canvases to be at the root, create our canvas
+ to be a real root canvas and then push back all the canvases.
+ */
+
+ /*
+ remember current directory -
+ abstractions residing in the directory of the current canvas
+ (which normally is the one hosting dyn) will be found
+ */
+ t_symbol *dir;
+ if(canvas_getcurrent()) dir = canvas_getcurrentdir();
+ else dir = const_cast<t_symbol *>(sym_dot);
+
+ // pop current canvases
+ std::list<t_glist *> glstack;
+ for(;;) {
+ t_glist *gl = canvas_getcurrent();
+ if(!gl) break;
+ glstack.push_front(gl);
+ canvas_unsetcurrent(gl);
+ }
+
+ // set canvas environment
+ // this must be done manually if there is no owner
+ glob_setfilename(NULL,const_cast<t_symbol *>(sym_dyn),dir);
+
+ t_atom arg[6];
+ SETFLOAT(arg+0,0); // xpos
+ SETFLOAT(arg+1,0); // ypos
+ SETFLOAT(arg+2,1000); // xwidth
+ SETFLOAT(arg+3,1000); // xwidth
+ SETSYMBOL(arg+4,const_cast<t_symbol *>(sym_dyncanvas)); // canvas name
+ SETFLOAT(arg+5,0); // invisible
+
+ t_glist *canvas = canvas_new(NULL,NULL,6,arg);
+ /* or, alternatively - but this needs some message processing
+ pd_typedmess(&pd_canvasmaker,gensym("canvas"),6,arg);
+ t_glist *canvas = canvas_getcurrent();
+ */
+
+ // must do that....
+ canvas_unsetcurrent(canvas);
+
+ // push back all the canvases
+ for(std::list<t_glist *>::iterator it = glstack.begin(); it != glstack.end(); ++it)
+ canvas_setcurrent(*it);
+
+ // clear environment
+ glob_setfilename(NULL,&s_,&s_);
+
+ newest = canvas;
+ }
+ else {
+ ASSERT(glist);
+
+ int argc = _argc_+(hdr?3:2);
+ t_atom *argv = new t_atom[argc];
+
+ // position x/y = 0/0
+ t_atom *a = argv;
+ SETFLOAT(a,0); a++;
+ SETFLOAT(a,0); a++;
+ if(hdr) { SETSYMBOL(a,const_cast<t_symbol *>(hdr)); a++; }
+ memcpy(a,_argv_,_argc_*sizeof(t_atom));
+
+ last = getlast(glist);
+
+ // set selected canvas as current
+ pd_typedmess((t_pd *)glist,(t_symbol *)kind,argc,argv);
+// canvas_obj(glist,(t_symbol *)kind,argc,argv);
+ newest = getlast(glist);
+
+ delete[] argv;
+ }
+
+ if(kind == k_obj && glist) {
+ // check for created objects and abstractions
+
+ t_object *o = (t_object *)pd_newest();
+
+ if(!o) {
+ // PD creates a text object when the intended object could not be created
+ t_gobj *trash = getlast(glist);
+
+ // Test for newly created object....
+ if(trash && last != trash) {
+ // Delete it!
+ glist_delete(glist,trash);
+ }
+ newest = NULL;
+ }
+ else
+ newest = &o->te_g;
+ }
+
+ // look for latest created object
+ if(newest) {
+// if(glist) canvas_setcurrent(glist);
+
+ // send loadbang (if it is an abstraction)
+ if(pd_class(&((t_gobj *)newest)->g_pd) == canvas_class) {
+ // hide the sub-canvas
+ pd_vmess((t_pd *)newest,const_cast<t_symbol *>(sym_vis),"i",0);
+
+ // loadbang the abstraction
+ pd_vmess((t_pd *)newest,const_cast<t_symbol *>(sym_loadbang),"");
+ }
+
+ // restart dsp - that's necessary because ToCanvas is called manually
+ canvas_update_dsp();
+
+ // pop the current canvas
+// if(glist) canvas_unsetcurrent(glist);
+ }
+
+// sys_unlock();
+
+ return newest;
+}
+
+dyn_patcher *root = NULL;
+
+dyn_ident *NewObject(int type,dyn_callback cb,dyn_ident *owner,const t_symbol *hdr,int argc,const t_atom *argv)
+{
+ int err = DYN_ERROR_NONE;
+ dyn_ident *ret = NULL;
+
+ dyn_patcher *p;
+ if(owner == DYN_ID_NONE) {
+ if(!root) {
+ void *newobj = NewPDObject(DYN_TYPE_PATCHER,NULL,NULL);
+ dyn_ident *id = new dyn_ident(DYN_TYPE_PATCHER,NULL);
+ root = new dyn_patcher(id,NULL,(t_glist *)newobj);
+ }
+ p = root;
+ }
+ else
+ p = owner->Patcher();
+
+ if(p) {
+ void *newobj = NewPDObject(type,p->glist(),hdr,argc,argv);
+ if(newobj) {
+ ret = new dyn_ident(type,cb);
+
+ switch(type) {
+ case DYN_TYPE_PATCHER:
+ ret->Set(new dyn_patcher(ret,p,(t_glist *)newobj));
+ break;
+ case DYN_TYPE_OBJECT:
+ ret->Set(new dyn_object(ret,p,(t_gobj *)newobj));
+ break;
+ case DYN_TYPE_MESSAGE:
+ ret->Set(new dyn_message(ret,p,(t_gobj *)newobj));
+ break;
+ case DYN_TYPE_TEXT:
+ ret->Set(new dyn_text(ret,p,(t_gobj *)newobj));
+ break;
+ }
+ }
+ else
+ err = DYN_ERROR_NOTCREATED;
+ }
+ else
+ err = DYN_ERROR_NOSUB;
+
+ if(err != DYN_ERROR_NONE) {
+ if(ret) delete ret;
+ throw err;
+ }
+ else
+ return ret;
+}
+
+void DelObject(dyn_ident *obj)
+{
+ ASSERT(obj);
+ if(obj->data) Destroy(obj->data); // delete database object
+ delete obj; // delete ID
+}
diff --git a/externals/grill/dyn/dyn_data.h b/externals/grill/dyn/dyn_data.h
new file mode 100644
index 00000000..e3cc7486
--- /dev/null
+++ b/externals/grill/dyn/dyn_data.h
@@ -0,0 +1,192 @@
+/*
+dyn - dynamical object management
+
+Copyright (c)2003-2004 Thomas Grill (gr@grrrr.org)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+*/
+
+#ifndef __DYN_DATA_H
+#define __DYN_DATA_H
+
+#include "dyn_proxy.h"
+
+#include <map>
+#include <set>
+
+
+class dyn_patcher;
+class dyn_conn;
+
+
+class dyn_base
+{
+public:
+ dyn_base(dyn_id id);
+
+ dyn_id ident;
+
+ friend void Destroy(dyn_base *b);
+protected:
+ virtual ~dyn_base();
+};
+
+
+typedef std::set<dyn_base *> Objects;
+typedef std::set<dyn_conn *> Connections;
+typedef std::map<int,proxy *> Proxies;
+
+
+class dyn_patchable:
+ public dyn_base
+{
+public:
+ dyn_patchable(dyn_id id,dyn_patcher *o,t_gobj *obj);
+
+ void AddProxyIn(int inlet,proxyin *o) { pxin[inlet] = o; }
+ void RmvProxyIn(int inlet) { pxin.erase(inlet); }
+ proxyin *GetProxyIn(int inlet) { Proxies::iterator it = pxin.find(inlet); return it != pxin.end()?(proxyin *)it->second:NULL; }
+ void AddProxyOut(int outlet,proxyout *o) { pxout[outlet] = o; }
+ void RmvProxyOut(int outlet) { pxout.erase(outlet); }
+ proxyout *GetProxyOut(int outlet) { Proxies::iterator it = pxout.find(outlet); return it != pxout.end()?(proxyout *)it->second:NULL; }
+
+ int GetInletCount() const { return obj_ninlets((t_object *)pdobj); }
+ int GetOutletCount() const { return obj_noutlets((t_object *)pdobj); }
+ int GetInletType(int ix) const { return obj_issignalinlet((t_object *)pdobj,ix)?DYN_INOUT_SIGNAL:DYN_INOUT_MESSAGE; }
+ int GetOutletType(int ix) const { return obj_issignaloutlet((t_object *)pdobj,ix)?DYN_INOUT_SIGNAL:DYN_INOUT_MESSAGE; }
+
+ void AddInlet(dyn_conn *o);
+ void RmvInlet(dyn_conn *o);
+ void AddOutlet(dyn_conn *o);
+ void RmvOutlet(dyn_conn *o);
+
+ void EnumInlet(int ix,dyn_enumfun fun,void *data);
+ void EnumOutlet(int ix,dyn_enumfun fun,void *data);
+
+ t_gobj *pdobj; // PD object
+ dyn_patcher *owner; // patcher
+
+protected:
+ virtual ~dyn_patchable();
+
+ Proxies pxin,pxout;
+ Connections inconns,outconns;
+};
+
+class dyn_patcher:
+ public dyn_patchable
+{
+public:
+ dyn_patcher(dyn_id id,dyn_patcher *o,t_glist *obj): dyn_patchable(id,o,(t_gobj *)obj) {}
+ virtual ~dyn_patcher();
+
+ t_glist *glist() { return (t_glist *)pdobj; }
+
+ void Add(dyn_base *o) { objs.insert(o); }
+ void Remove(dyn_base *o) { objs.erase(o); }
+
+ void Enumerate(dyn_enumfun fun,void *data);
+
+protected:
+ Objects objs;
+};
+
+class dyn_object:
+ public dyn_patchable
+{
+public:
+ dyn_object(dyn_id id,dyn_patcher *o,t_gobj *obj): dyn_patchable(id,o,obj) {}
+};
+
+class dyn_message:
+ public dyn_patchable
+{
+public:
+ dyn_message(dyn_id id,dyn_patcher *o,t_gobj *obj): dyn_patchable(id,o,obj) {}
+};
+
+class dyn_text:
+ public dyn_patchable
+{
+public:
+ dyn_text(dyn_id id,dyn_patcher *o,t_gobj *obj): dyn_patchable(id,o,obj) {}
+};
+
+
+class dyn_conn:
+ public dyn_base
+{
+public:
+ dyn_conn(dyn_id id,dyn_id s,int six,dyn_id d,int dix)
+ : dyn_base(id)
+ , src(s),slet(six),dst(d),dlet(dix)
+ {}
+
+ dyn_id src,dst; // connected objects
+ int slet,dlet;
+
+protected:
+ virtual ~dyn_conn();
+};
+
+class dyn_listen:
+ public dyn_base
+{
+public:
+ dyn_listen(dyn_id id,proxyout *p,dyn_listener cb,void *dt)
+ : dyn_base(id),px(p)
+ , callback(cb),userdata(dt)
+ {}
+
+ void Callback(int outlet,const t_symbol *sym,int argc,const t_atom *argv)
+ {
+ if(callback) callback(ident,px->object->ident,outlet,sym,argc,argv,userdata);
+ }
+
+ proxyout *px;
+ dyn_listener *callback;
+ void *userdata;
+protected:
+ virtual ~dyn_listen();
+};
+
+
+struct dyn_ident
+{
+ dyn_ident(int tp,dyn_callback cb,void *dt = NULL):
+ type(tp),data(NULL),
+ callback(cb),userdata(dt)
+ {}
+
+ ~dyn_ident()
+ {
+ // data should already have been cleared by the objects
+ ASSERT(!data);
+ }
+
+ void Set(dyn_base *obj) { data = obj; }
+
+ void Callback(int signal) { if(callback) callback(this,signal,userdata); }
+
+ dyn_patcher *Patcher() { return dynamic_cast<dyn_patcher *>(data); }
+ dyn_object *Object() { return dynamic_cast<dyn_object *>(data); }
+ dyn_message *Message() { return dynamic_cast<dyn_message *>(data); }
+ dyn_text *Text() { return dynamic_cast<dyn_text *>(data); }
+ dyn_conn *Conn() { return dynamic_cast<dyn_conn *>(data); }
+ dyn_patchable *Patchable() { return dynamic_cast<dyn_patchable *>(data); }
+ dyn_listen *Listen() { return dynamic_cast<dyn_listen *>(data); }
+
+ int type;
+ dyn_base *data;
+
+ dyn_callback *callback;
+ void *userdata;
+};
+
+inline void Destroy(dyn_base *b)
+{
+ b->ident->data = NULL;
+ delete b;
+}
+
+#endif
diff --git a/externals/grill/dyn/dyn_listen.cpp b/externals/grill/dyn/dyn_listen.cpp
new file mode 100644
index 00000000..beb5d7fc
--- /dev/null
+++ b/externals/grill/dyn/dyn_listen.cpp
@@ -0,0 +1,68 @@
+/*
+dyn - dynamical object management
+
+Copyright (c)2003-2004 Thomas Grill (gr@grrrr.org)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+*/
+
+#include "dyn_proto.h"
+
+DYN_EXPORT int dyn_Listen(int sched,dyn_id *id,dyn_id oid,int outlet,dyn_listener cb,void *data)
+{
+ ASSERT(id);
+
+ if(oid == DYN_ID_NONE) return DYN_ERROR_NOTFOUND;
+
+ dyn_patchable *obj = oid->Patchable();
+ if(obj) {
+ proxyout *px = obj->GetProxyOut(outlet);
+ if(!px) {
+ dyn_patcher *patcher = obj->owner;
+ ASSERT(patcher);
+
+ // put proxy on the same canvas as this object for it can be connected to it!
+ px = (proxyout *)NewPDObject(DYN_TYPE_OBJECT,patcher->glist(),sym_dynpxout);
+ if(px) {
+ px->init(obj,outlet);
+
+// sys_lock();
+
+// canvas_setcurrent(patcher->glist());
+ // connect to associated object
+ if(obj_connect((t_object *)obj->pdobj,outlet,&px->pdobj,0)) {
+ obj->AddProxyOut(outlet,px);
+ }
+ else {
+ // delete object;
+ glist_delete(patcher->glist(),(t_gobj *)px);
+ px = NULL;
+
+ // could not connect
+ post("Couldn't connect proxy object");
+ }
+// canvas_unsetcurrent(patcher->glist());
+
+// sys_unlock();
+ }
+ }
+
+ if(px) {
+ dyn_ident *nid = new dyn_ident(DYN_TYPE_LISTENER,oid->callback,data);
+ dyn_listen *l = new dyn_listen(nid,px,cb,data);
+ proxyout::Add(px,l);
+ nid->Set(l);
+ *id = nid;
+ return DYN_ERROR_NONE;
+ }
+ else
+ return DYN_ERROR_GENERAL;
+ }
+ else
+ return DYN_ERROR_TYPEMISMATCH;
+}
+
+dyn_listen::~dyn_listen()
+{
+ proxyout::Rmv(px,this);
+}
diff --git a/externals/grill/dyn/dyn_main.cpp b/externals/grill/dyn/dyn_main.cpp
new file mode 100644
index 00000000..232a1420
--- /dev/null
+++ b/externals/grill/dyn/dyn_main.cpp
@@ -0,0 +1,85 @@
+/*
+dyn - dynamical object management
+
+Copyright (c)2003-2004 Thomas Grill (gr@grrrr.org)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+*/
+
+#include "dyn_proto.h"
+
+t_class *pxin_class,*pxout_class;
+t_class *pxins_class,*pxouts_class;
+
+static t_object *pxin_new() { return (t_object *)pd_new(pxin_class); }
+static t_object *pxins_new() { return (t_object *)pd_new(pxins_class); }
+static t_object *pxout_new() { return (t_object *)pd_new(pxout_class); }
+static t_object *pxouts_new() { return (t_object *)pd_new(pxouts_class); }
+
+
+const t_symbol *sym_dyncanvas = gensym(" dyn canvas ");
+const t_symbol *sym_dynsxin = gensym(" dyn in~ ");
+const t_symbol *sym_dynsxout = gensym(" dyn out~ ");
+const t_symbol *sym_dynpxin = gensym(" dyn in ");
+const t_symbol *sym_dynpxout = gensym(" dyn out ");
+
+static const t_symbol *sym_dsp = gensym("dsp");
+
+
+static bool dyn_init()
+{
+ // set up proxy class for inbound messages
+ pxin_class = class_new(const_cast<t_symbol *>(sym_dynpxin),(t_newmethod)pxin_new,(t_method)proxy::px_exit,sizeof(proxyin),0, A_NULL);
+ class_addanything(pxin_class,proxyin::px_method);
+
+ // set up proxy class for inbound signals
+ pxins_class = class_new(const_cast<t_symbol *>(sym_dynsxin),(t_newmethod)pxins_new,(t_method)proxy::px_exit,sizeof(proxyin),0, A_NULL);
+ class_addmethod(pxins_class,(t_method)proxyin::dsp,const_cast<t_symbol *>(sym_dsp),A_NULL);
+ CLASS_MAINSIGNALIN(pxins_class,proxyin,defsig);
+
+ // set up proxy class for outbound messages
+ pxout_class = class_new(const_cast<t_symbol *>(sym_dynpxout),(t_newmethod)pxout_new,(t_method)proxy::px_exit,sizeof(proxyout),0, A_NULL);
+ class_addanything(pxout_class,proxyout::px_method);
+
+ // set up proxy class for outbound signals
+ pxouts_class = class_new(const_cast<t_symbol *>(sym_dynsxout),(t_newmethod)pxouts_new,(t_method)proxy::px_exit,sizeof(proxyout),0, A_NULL);
+ class_addmethod(pxouts_class,(t_method)proxyout::dsp,const_cast<t_symbol *>(sym_dsp),A_NULL);
+ CLASS_MAINSIGNALIN(pxouts_class,proxyout,defsig);
+
+ return true;
+}
+
+// static variables are hopefully initialized in order of appearance
+// dyn_init depends on the symbols above
+static bool init = dyn_init();
+
+
+DYN_EXPORT int dyn_Version()
+{
+ return DYN_VERSION;
+}
+
+// \todo Implement
+DYN_EXPORT int dyn_Lock()
+{
+ return DYN_ERROR_GENERAL;
+}
+
+// \todo Implement
+DYN_EXPORT int dyn_Unlock()
+{
+ return DYN_ERROR_GENERAL;
+}
+
+// \todo Implement
+DYN_EXPORT int dyn_Pending()
+{
+ return 0;
+}
+
+// \todo Implement
+DYN_EXPORT int dyn_Finish()
+{
+ return DYN_ERROR_GENERAL;
+}
+
diff --git a/externals/grill/dyn/dyn_message.cpp b/externals/grill/dyn/dyn_message.cpp
new file mode 100644
index 00000000..1a5120b6
--- /dev/null
+++ b/externals/grill/dyn/dyn_message.cpp
@@ -0,0 +1,10 @@
+/*
+dyn - dynamical object management
+
+Copyright (c)2003-2004 Thomas Grill (gr@grrrr.org)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+*/
+
+#include "dyn_proto.h"
+
diff --git a/externals/grill/dyn/dyn_object.cpp b/externals/grill/dyn/dyn_object.cpp
new file mode 100644
index 00000000..8bcf8c4c
--- /dev/null
+++ b/externals/grill/dyn/dyn_object.cpp
@@ -0,0 +1,9 @@
+/*
+dyn - dynamical object management
+
+Copyright (c)2003-2004 Thomas Grill (gr@grrrr.org)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+*/
+
+#include "dyn_proto.h"
diff --git a/externals/grill/dyn/dyn_patchable.cpp b/externals/grill/dyn/dyn_patchable.cpp
new file mode 100644
index 00000000..a61930e7
--- /dev/null
+++ b/externals/grill/dyn/dyn_patchable.cpp
@@ -0,0 +1,101 @@
+/*
+dyn - dynamical object management
+
+Copyright (c)2003-2004 Thomas Grill (gr@grrrr.org)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+*/
+
+#include "dyn_proto.h"
+
+dyn_patchable::dyn_patchable(dyn_id id,dyn_patcher *o,t_gobj *obj)
+ : dyn_base(id)
+ , pdobj(obj),owner(o)
+{
+ if(owner) owner->Add(this);
+}
+
+dyn_patchable::~dyn_patchable()
+{
+ if(owner) {
+ // if no owner, it must be a "root" patcher, which is not connectable
+
+ owner->Remove(this);
+
+ t_glist *glist = owner->glist();
+
+ // canvas_setcurrent(glist);
+
+ // delete object itself
+ glist_delete(glist,pdobj);
+
+ // delete proxies
+ for(Proxies::iterator iit = pxin.begin(); iit != pxin.end(); ++iit) {
+ proxyin *px = (proxyin *)iit->second;
+ glist_delete(glist,(t_gobj *)px);
+ }
+
+ for(Proxies::iterator oit = pxout.begin(); oit != pxout.end(); ++oit) {
+ proxyout *px = (proxyout *)oit->second;
+ glist_delete(glist,(t_gobj *)px);
+ }
+
+ // canvas_unsetcurrent(glist);
+
+ // invalidate all associated connection objects
+ // the connection objects will not be deleted here!
+ Connections::iterator cit;
+ for(cit = inconns.begin(); cit != inconns.end(); ++cit)
+ Destroy(*cit);
+
+ for(cit = outconns.begin(); cit != outconns.end(); ++cit)
+ Destroy(*cit);
+ }
+ else {
+ dyn_patcher *p = dynamic_cast<dyn_patcher *>(this);
+ ASSERT(p);
+
+ // delete "root"-patcher
+ canvas_free(p->glist());
+ }
+}
+
+void dyn_patchable::AddInlet(dyn_conn *o)
+{
+ ASSERT(inconns.find(o) == inconns.end());
+ inconns.insert(o);
+}
+
+void dyn_patchable::RmvInlet(dyn_conn *o)
+{
+ ASSERT(inconns.find(o) != inconns.end());
+ inconns.erase(o);
+}
+
+void dyn_patchable::AddOutlet(dyn_conn *o)
+{
+ ASSERT(outconns.find(o) == outconns.end());
+ outconns.insert(o);
+}
+
+void dyn_patchable::RmvOutlet(dyn_conn *o)
+{
+ ASSERT(outconns.find(o) != outconns.end());
+ outconns.erase(o);
+}
+
+void dyn_patchable::EnumInlet(int ix,dyn_enumfun fun,void *data)
+{
+ for(Connections::const_iterator it = inconns.begin(); it != inconns.end(); ++it) {
+ const dyn_conn *c = *it;
+ if(c->dlet == ix && !fun(c->ident,data)) break;
+ }
+}
+
+void dyn_patchable::EnumOutlet(int ix,dyn_enumfun fun,void *data)
+{
+ for(Connections::const_iterator it = outconns.begin(); it != outconns.end(); ++it) {
+ const dyn_conn *c = *it;
+ if(c->slet == ix && !fun(c->ident,data)) break;
+ }
+}
diff --git a/externals/grill/dyn/dyn_patcher.cpp b/externals/grill/dyn/dyn_patcher.cpp
new file mode 100644
index 00000000..820a3c14
--- /dev/null
+++ b/externals/grill/dyn/dyn_patcher.cpp
@@ -0,0 +1,24 @@
+/*
+dyn - dynamical object management
+
+Copyright (c)2003-2004 Thomas Grill (gr@grrrr.org)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+*/
+
+#include "dyn_proto.h"
+
+dyn_patcher::~dyn_patcher()
+{
+ // delete sub-objects
+ while(!objs.empty()) {
+ // objects delete themselves from the container!
+ Destroy(*objs.begin());
+ }
+}
+
+void dyn_patcher::Enumerate(dyn_enumfun fun,void *data)
+{
+ for(Objects::const_iterator it = objs.begin(); it != objs.end(); ++it)
+ if(fun((*it)->ident,data)) break;
+}
diff --git a/externals/grill/dyn/dyn_pd.h b/externals/grill/dyn/dyn_pd.h
new file mode 100644
index 00000000..1b0ea161
--- /dev/null
+++ b/externals/grill/dyn/dyn_pd.h
@@ -0,0 +1,30 @@
+/*
+dyn - dynamical object management
+
+Copyright (c)2003-2004 Thomas Grill (gr@grrrr.org)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+*/
+
+#ifndef __DYN_PD_H
+#define __DYN_PD_H
+
+#include "dyn.h"
+
+#ifdef _MSC_VER
+#pragma warning(disable: 4091 4244)
+#endif
+extern "C" {
+#include "m_imp.h"
+#include "g_canvas.h"
+}
+
+#include <assert.h>
+#ifdef _MSC_VER
+#include <crtdbg.h>
+#define ASSERT _ASSERTE
+#else
+#define ASSERT assert
+#endif
+
+#endif \ No newline at end of file
diff --git a/externals/grill/dyn/dyn_proto.h b/externals/grill/dyn/dyn_proto.h
new file mode 100644
index 00000000..b2b82710
--- /dev/null
+++ b/externals/grill/dyn/dyn_proto.h
@@ -0,0 +1,29 @@
+/*
+dyn - dynamical object management
+
+Copyright (c)2003-2004 Thomas Grill (gr@grrrr.org)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+*/
+
+#ifndef __DYN_PROTO_H
+#define __DYN_PROTO_H
+
+#include "dyn_data.h"
+
+// \todo really align..
+inline void *NewAligned(int n) { return new char[n]; }
+inline void FreeAligned(void *b) { delete[] (char *)b; }
+
+extern t_class *pxin_class,*pxout_class;
+extern t_class *pxins_class,*pxouts_class;
+
+extern const t_symbol *sym_dyncanvas;
+extern const t_symbol *sym_dynsxin,*sym_dynsxout,*sym_dynpxin,*sym_dynpxout;
+
+
+void *NewPDObject(int type,t_glist *glist,const t_symbol *hdr,int argc = 0,const t_atom *argv = NULL);
+dyn_ident *NewObject(int type,dyn_callback cb,dyn_ident *owner,const t_symbol *hdr,int argc = 0,const t_atom *argv = NULL);
+void DelObject(dyn_ident *obj);
+
+#endif
diff --git a/externals/grill/dyn/dyn_proxy.cpp b/externals/grill/dyn/dyn_proxy.cpp
new file mode 100644
index 00000000..f2b85a91
--- /dev/null
+++ b/externals/grill/dyn/dyn_proxy.cpp
@@ -0,0 +1,96 @@
+/*
+dyn - dynamical object management
+
+Copyright (c)2003-2004 Thomas Grill (gr@grrrr.org)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+*/
+
+#include "dyn_proto.h"
+
+// proxy
+
+void proxy::px_exit(proxy *px)
+{
+ if(px->buf) FreeAligned(px->buf);
+}
+
+
+// proxyin
+
+void proxyin::init(dyn_patchable *obj,bool s)
+{
+ proxy::init(obj);
+ outlet = outlet_new(&pdobj,s?&s_signal:&s_anything);
+}
+
+void proxyin::px_method(proxyin *th,const t_symbol *s,int argc,const t_atom *argv)
+{
+ // send to connected object
+ outlet_anything(th->outlet,(t_symbol *)s,argc,(t_atom *)argv);
+}
+
+void proxyin::dsp(proxyin *x, t_signal **sp)
+{
+ int n = sp[0]->s_n;
+ if(n != x->n) {
+ // if vector size has changed make new buffer
+ if(x->buf) FreeAligned(x->buf);
+ x->buf = (t_sample *)NewAligned(sizeof(t_sample)*(x->n = n));
+ }
+ dsp_add_copy(x->buf,sp[0]->s_vec,n);
+}
+
+
+// proxyout
+
+void proxyout::init(dyn_patchable *obj,int o,bool s)
+{
+ proxy::init(obj);
+ listeners = new Listeners;
+ outlet = o;
+ if(s) outlet_new(&pdobj,&s_signal);
+}
+
+void proxyout::exit()
+{
+ // invalidate all listeners
+ for(Listeners::const_iterator it = listeners->begin(); it != listeners->end(); ++it)
+ Destroy(*it);
+ // delete container
+ delete listeners;
+}
+
+void proxyout::Rmv(proxyout *px,dyn_listen *l)
+{
+ px->listeners->erase(l);
+
+ // if there are no more listeners we can delete the object!
+ if(px->listeners->empty()) {
+ dyn_patcher *p = px->object->owner;
+
+ // remove reference
+ px->object->RmvProxyOut(px->outlet);
+
+ // delete PD object
+ glist_delete(p->glist(),(t_gobj *)px);
+ }
+}
+
+void proxyout::px_method(proxyout *th,const t_symbol *s,int argc,const t_atom *argv)
+{
+ // call attached responders
+ for(Listeners::const_iterator it = th->listeners->begin(); it != th->listeners->end(); ++it)
+ (*it)->Callback(th->outlet,s,argc,argv);
+}
+
+void proxyout::dsp(proxyout *x, t_signal **sp)
+{
+ int n = sp[0]->s_n;
+ if(n != x->n) {
+ // if vector size has changed make new buffer
+ if(x->buf) FreeAligned(x->buf);
+ x->buf = (t_sample *)NewAligned(sizeof(t_sample)*(x->n = n));
+ }
+ dsp_add_copy(sp[0]->s_vec,x->buf,n);
+}
diff --git a/externals/grill/dyn/dyn_proxy.h b/externals/grill/dyn/dyn_proxy.h
new file mode 100644
index 00000000..9430d390
--- /dev/null
+++ b/externals/grill/dyn/dyn_proxy.h
@@ -0,0 +1,74 @@
+/*
+dyn - dynamical object management
+
+Copyright (c)2003-2004 Thomas Grill (gr@grrrr.org)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+*/
+
+#ifndef __DYN_PROXY_H
+#define __DYN_PROXY_H
+
+#include "dyn.h"
+#include "dyn_pd.h"
+
+#include <set>
+
+class dyn_patchable;
+class dyn_listen;
+
+// attention... no virtual table allowed!
+class proxy
+{
+public:
+ t_object pdobj; // must be first
+ dyn_patchable *object;
+ int n;
+ t_sample *buf;
+ t_sample defsig;
+
+ void init(dyn_patchable *o) { object = o,n = 0,buf = NULL,defsig = 0; }
+
+ static void px_exit(proxy *px);
+};
+
+// proxy for inbound messages
+class proxyin:
+ public proxy
+{
+public:
+ t_outlet *outlet;
+
+ void Message(const t_symbol *s,int argc,const t_atom *argv)
+ {
+ typedmess((t_pd *)&pdobj,(t_symbol *)s,argc,(t_atom *)argv);
+ }
+
+ void init(dyn_patchable *obj,bool s = false);
+ void exit() { outlet = NULL; }
+
+ static void px_method(proxyin *obj,const t_symbol *s,int argc,const t_atom *argv);
+ static void dsp(proxyin *x, t_signal **sp);
+};
+
+typedef std::set<dyn_listen *> Listeners;
+
+// proxy for outbound messages
+class proxyout:
+ public proxy
+{
+public:
+ int outlet;
+ Listeners *listeners; // this is initialized in init
+
+ static void Add(proxyout *px,dyn_listen *l) { px->listeners->insert(l); }
+ static void Rmv(proxyout *px,dyn_listen *l);
+
+ void init(dyn_patchable *obj,int o,bool s = false);
+ void exit();
+
+ static void px_method(proxyout *obj,const t_symbol *s,int argc,const t_atom *argv);
+ static void dsp(proxyout *x, t_signal **sp);
+};
+
+#endif
diff --git a/externals/grill/dyn/dyn_send.cpp b/externals/grill/dyn/dyn_send.cpp
new file mode 100644
index 00000000..efd36849
--- /dev/null
+++ b/externals/grill/dyn/dyn_send.cpp
@@ -0,0 +1,80 @@
+/*
+dyn - dynamical object management
+
+Copyright (c)2003-2004 Thomas Grill (gr@grrrr.org)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+*/
+
+#include "dyn_proto.h"
+
+DYN_EXPORT int dyn_Send(int sched,dyn_id oid,int inlet,const t_symbol *sym,int argc,const t_atom *argv)
+{
+ ASSERT(oid);
+ dyn_patchable *obj = oid->Patchable();
+
+ if(obj) {
+ /*
+ It seems that we need connections (and proxy objects) for all inlets.
+ Sending typed messages to the 0-inlet doesn't work for abstractions.
+ */
+
+ proxyin *px = obj->GetProxyIn(inlet);
+ if(!px) {
+ dyn_patcher *patcher = obj->owner;
+ ASSERT(patcher);
+
+ px = (proxyin *)NewPDObject(DYN_TYPE_OBJECT,patcher->glist(),sym_dynpxin);
+ if(px) {
+ px->init(obj);
+
+// sys_lock();
+
+// canvas_setcurrent(patcher->glist());
+ // connect to associated object
+ if(obj_connect(&px->pdobj,0,(t_object *)obj->pdobj,inlet)) {
+ obj->AddProxyIn(inlet,px);
+ }
+ else {
+ glist_delete(patcher->glist(),(t_gobj *)px);
+ px = NULL;
+
+ // could not connect
+ post("Couldn't connect proxy object");
+ }
+// canvas_unsetcurrent(patcher->glist());
+// sys_unlock();
+ }
+ }
+
+ if(px) {
+// sys_lock();
+ px->Message(sym,argc,argv);
+// sys_unlock();
+ return DYN_ERROR_NONE;
+ }
+ else
+ return DYN_ERROR_GENERAL;
+ }
+ else
+ return DYN_ERROR_TYPEMISMATCH;
+}
+
+DYN_EXPORT int dyn_SendStr(int sched,dyn_id id,int inlet,const char *msg)
+{
+ t_binbuf *b = binbuf_new();
+ binbuf_text(b,(char *)msg,strlen(msg));
+ int argc = binbuf_getnatom(b);
+ t_atom *argv = binbuf_getvec(b);
+ int ret;
+ if(argc) {
+ t_symbol *sym;
+ if(argv->a_type == A_SYMBOL) { sym = atom_getsymbol(argv); argc--,argv++; }
+ else sym = &s_list;
+ ret = dyn_Send(sched,id,inlet,sym,argc,argv);
+ }
+ else
+ ret = DYN_ERROR_PARAMS;
+ binbuf_free(b);
+ return ret;
+}
diff --git a/externals/grill/dyn/dyn_text.cpp b/externals/grill/dyn/dyn_text.cpp
new file mode 100644
index 00000000..8bcf8c4c
--- /dev/null
+++ b/externals/grill/dyn/dyn_text.cpp
@@ -0,0 +1,9 @@
+/*
+dyn - dynamical object management
+
+Copyright (c)2003-2004 Thomas Grill (gr@grrrr.org)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+*/
+
+#include "dyn_proto.h"
diff --git a/externals/grill/dyn/gpl.txt b/externals/grill/dyn/gpl.txt
deleted file mode 100644
index 5ea29a7d..00000000
--- a/externals/grill/dyn/gpl.txt
+++ /dev/null
@@ -1,346 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) 19yy <name of author>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) 19yy name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
-
diff --git a/externals/grill/dyn/license.txt b/externals/grill/dyn/license.txt
deleted file mode 100644
index 4a10fba2..00000000
--- a/externals/grill/dyn/license.txt
+++ /dev/null
@@ -1,50 +0,0 @@
-dyn~ - dynamic object management for PD
-Copyright (c) Thomas Grill (xovo@gmx.net)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-In the official dyn~ distribution, the GNU General Public License is
-in the file gpl.txt
-
----------------------------------------------------------
-
- OTHER COPYRIGHT NOTICES
-
----------------------------------------------------------
-This package uses the flext C++ layer - See its license text below:
-
-
---- flext ----------------------------------------------
-flext - C++ layer for Max/MSP and pd (pure data) externals
-Copyright (C) 2001-2003 Thomas Grill
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-In the official flext distribution, the GNU General Public License is
-in the file gpl.txt
-
-
diff --git a/externals/grill/dyn/make-files.txt b/externals/grill/dyn/make-files.txt
index 0538f6b7..69dac97f 100644
--- a/externals/grill/dyn/make-files.txt
+++ b/externals/grill/dyn/make-files.txt
@@ -1,8 +1,10 @@
-NAME=dyn~
-
-# all the source files from the package
-DIR=src
-
-SRCS= main.cpp
-HDRS=
+NAME=dyn
+SRCDIR=.
+SRCS= \
+ dyn_api.cpp dyn_base.cpp dyn_conn.cpp dyn_create.cpp \
+ dyn_listen.cpp dyn_main.cpp dyn_message.cpp dyn_object.cpp \
+ dyn_patchable.cpp dyn_patcher.cpp dyn_proxy.cpp dyn_send.cpp \
+ dyn_text.cpp
+PHDRS= dyn.h
+IHDRS= dyn_data.h dyn_pd.h dyn_proto.h dyn_proxy.h
diff --git a/externals/grill/dyn/makefile.pd-darwin b/externals/grill/dyn/makefile.pd-darwin
index f7588e29..dec7743b 100644
--- a/externals/grill/dyn/makefile.pd-darwin
+++ b/externals/grill/dyn/makefile.pd-darwin
@@ -1,12 +1,5 @@
-# dyn~ - dynamic object management for PD
+# Makefile for gcc @ darwin
#
-# Copyright (c)Thomas Grill (xovo@gmx.net)
-# For information on usage and redistribution, and for a DISCLAIMER OF ALL
-# WARRANTIES, see the file, "license.txt," in this distribution.
-#
-#
-# Makefile for gcc @ darwin (OSX)
-#
# usage:
# to build run "make -f makefile.pd-darwin"
# to install (as root), do "make -f makefile.pd-darwin install"
@@ -14,73 +7,70 @@
CONFIG=config-pd-darwin.txt
-include $(CONFIG)
+include ${CONFIG}
-# compiler+linker stuff
-INCLUDES=$(PDPATH)
-LIBPATH=
-FLAGS=-DFLEXT_SYS=2
-CFLAGS=-O2 ${UFLAGS} -Wno-unused -Wno-parentheses -Wno-switch -Wstrict-prototypes
-LIBS=m
-FRAMEWORKS=vecLib
-LDFLAGS+=-Wl,-x -Wl,-S -bundle -bundle_loader $(PD)
+# compiler+linker stuff
+INCLUDES=${PDPATH}
+FLAGS=${UFLAGS}
-ifdef FLEXT_SHARED
-CFLAGS+=-DFLEXT_SHARED
-LDFLAGS+=-L$(FLEXTPATH)
-FLEXTLIB=-lflext
+# compiler flags for optimized build
+CFLAGS=-O2
-else
+# compiler flags for debug build
+CFLAGS_D=-g
-FLEXTLIB=$(FLEXTPATH)/libflext.a
+# flags for shared linking
+LSHFLAGS= -dylib -dynamic -flat_namespace -undefined suppress
-endif
+# frameworks
+#FRAMEWORKS=Carbon veclib
-# ---------------------------------------------
+# ----------------------------------------------
# the rest can stay untouched
# ----------------------------------------------
# all the source files from the package
include make-files.txt
-TARGET=$(TARGDIR)/$(NAME).pd_darwin
+MAKEFILE=makefile.pd-darwin
-# default target
-all: $(TARGDIR) $(TARGET)
+TARGET=$(TARGDIR)/lib$(NAME).dylib
+TARGET_D=$(TARGDIR)/lib$(NAME)_d.dylib
+HDRS=$(PHDRS) $(IHDRS)
-$(patsubst %,$(DIR)/%,$(SRCS)): $(patsubst %,$(DIR)/%,$(HDRS)) $(CONFIG)
- touch $@
+
+all: $(TARGDIR) $(TARGET) $(TARGET_D)
$(TARGDIR):
mkdir $(TARGDIR)
-$(TARGDIR)/%.o : $(DIR)/%.cpp
- $(CXX) -c $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(FLEXTPATH)) $< -o $@
+$(patsubst %,$(SRCDIR)/%,$(SRCS)): $(patsubst %,$(SRCDIR)/%,$(HDRS)) $(patsubst %,$(SRCDIR)/%,$(IHDRS)) $(MAKEFILE) $(CONFIG)
+ touch $@
-$(TARGET) : $(patsubst %.cpp,$(TARGDIR)/%.o,$(SRCS))
- $(CXX) $(LDFLAGS) $^ $(patsubst %,-L%,$(LIBPATH)) $(patsubst %,-l%,$(LIBS)) $(patsubst %,-framework %,$(FRAMEWORKS)) $(FLEXTLIB) -o $@
- chmod 755 $@
+$(TARGDIR)/%.o : $(SRCDIR)/%.cpp
+ $(CXX) -c -dynamic $(CFLAGS) $(CFLAGS_T) $(CFLAGS_S) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $(patsubst %,-F%,$(FRAMEWORKS)) $< -o $@
-$(INSTPATH):
- mkdir $(INSTPATH)
+$(TARGDIR)/%.do : $(SRCDIR)/%.cpp
+ $(CXX) -c -dynamic $(CFLAGS_D) $(CFLAGS_T) $(CFLAGS_S) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $(patsubst %,-F%,$(FRAMEWORKS)) $< -o $@
-install:: $(INSTPATH)
+$(TARGET) : $(patsubst %.cpp,$(TARGDIR)/%.o,$(SRCS))
+ ld $(LSHFLAGS) -o $@ $^ -ldylib1.o -lgcc -lstdc++ $(patsubst %,-framework %,$(FRAMEWORKS))
-install:: $(TARGET)
- cp $^ $(INSTPATH)
-# chown root.root $(patsubst %,$(INSTPATH)/%,$(notdir $^))
-# chmod 755 $(patsubst %,$(INSTPATH)/%,$(notdir $^))
+$(TARGET_D) : $(patsubst %.cpp,$(TARGDIR)/%.do,$(SRCS))
+ ld $(LSHFLAGS) -o $@ $^ -ldylib1.o -lgcc -lstdc++ $(patsubst %,-framework %,$(FRAMEWORKS))
+
+.PHONY: clean install
-.PHONY: clean
clean:
- rm -f $(TARGDIR)/*.o $(TARGET)
+ rm -f $(TARGDIR)/*.{o,do} $(TARGET) $(TARGET_D)
+ifdef PREFIX
+install:: $(PREFIX)
+endif
-
-
-
-
-
+install:: $(TARGET) $(TARGET_D)
+# cp $(patsubst %,$(SRCDIR)/%,$(PHDRS)) $(PREFIX)/include
+ cp $(TARGDIR)/lib*.dylib $(PREFIX)/lib
diff --git a/externals/grill/dyn/makefile.pd-linux b/externals/grill/dyn/makefile.pd-linux
deleted file mode 100644
index 9d401053..00000000
--- a/externals/grill/dyn/makefile.pd-linux
+++ /dev/null
@@ -1,98 +0,0 @@
-# dyn~ - dynamic object management for PD
-#
-# Copyright (c)Thomas Grill (xovo@gmx.net)
-# For information on usage and redistribution, and for a DISCLAIMER OF ALL
-# WARRANTIES, see the file, "license.txt," in this distribution.
-#
-#
-# Makefile for gcc @ linux
-#
-# usage:
-# to build run "make -f makefile.pd-linux"
-# to install (as root), do "make -f makefile.pd-linux install"
-#
-
-CONFIG=config-pd-linux.txt
-
-include $(CONFIG)
-
-
-# compiler+linker stuff
-INCLUDES=$(PDPATH)
-LIBPATH=
-FLAGS=-DFLEXT_SYS=2
-CFLAGS=-O2 $(UFLAGS)
-LDFLAGS=$(UFLAGS) # needed by icc
-LIBS=stdc++
-
-
-ifdef FLEXT_SHARED
-CFLAGS+=-shared -DFLEXT_SHARED
-LDFLAGS+=-L $(FLEXTPATH)
-LIBFLEXT=-lflext
-
-ifeq ($(CXX),icc)
-LDFLAGS+=-i_dynamic
-else
-LDFLAGS+=-Wl,-Bdynamic
-endif
-
-else
-
-LIBFLEXT=$(FLEXTPATH)/libflext.a
-
-endif
-
-
-# ---------------------------------------------
-# the rest can stay untouched
-# ----------------------------------------------
-
-NAME=dyn~
-
-# all the source files from the package
-include make-files.txt
-
-
-
-TARGET=$(TARGDIR)/$(NAME).pd_linux
-
-# default target
-all: $(TARGDIR) $(TARGET)
-
-$(patsubst %,$(DIR)/%,$(SRCS)): $(patsubst %,$(DIR)/%,$(HDRS)) $(MAKEFILE) $(CONFIG)
- touch $@
-
-$(TARGDIR):
- -mkdir $(TARGDIR)
-
-$(TARGDIR)/%.o : $(DIR)/%.cpp
- $(CXX) -c $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(FLEXTPATH)) $< -o $@
-
-$(TARGET) : $(patsubst %.cpp,$(TARGDIR)/%.o,$(SRCS))
- $(CXX) -shared $(LDFLAGS) -o $@ $^ $(LIBFLEXT) $(patsubst %,-L%,$(LIBPATH)) $(patsubst %,-l%,$(LIBS))
- strip --strip-unneeded $@
- chmod 755 $@
-
-$(INSTPATH):
- -mkdir $(INSTPATH)
-
-install:: $(INSTPATH)
-
-install:: $(TARGET)
- cp $^ $(INSTPATH)
- chown root.root $(patsubst %,$(INSTPATH)/%,$(notdir $^))
- chmod 755 $(patsubst %,$(INSTPATH)/%,$(notdir $^))
-
-.PHONY: clean
-clean:
- rm -f $(TARGDIR)/*.o $(TARGET)
-
-
-
-
-
-
-
-
-
diff --git a/externals/grill/dyn/makefile.pd-msvc b/externals/grill/dyn/makefile.pd-msvc
deleted file mode 100644
index 94561b3e..00000000
--- a/externals/grill/dyn/makefile.pd-msvc
+++ /dev/null
@@ -1,60 +0,0 @@
-# dyn~ - dynamic object management for PD
-#
-# Copyright (c)Thomas Grill (xovo@gmx.net)
-# For information on usage and redistribution, and for a DISCLAIMER OF ALL
-# WARRANTIES, see the file, "license.txt," in this distribution.
-#
-#
-# Makefile for MSVC++ 7
-#
-# usage:
-# to build run "make -f makefile.pd-msvc"
-#
-
-!include config-pd-msvc.txt
-
-# includes
-INCPATH=/I"$(MSVCPATH)\include" /I"$(PDPATH)\src" /I"$(FLEXTPATH)"
-LIBPATH=/LIBPATH:"$(MSVCPATH)\lib" /LIBPATH:"$(PDPATH)\bin" /LIBPATH:"$(FLEXTPATH)"
-LIBS=pd.lib flext-pdwin.lib
-
-# compiler definitions and flags
-DEFS=/DFLEXT_SYS=2
-
-CFLAGS=/EHsc /G6 /Ox /ML
-
-# the rest can stay untouched
-# ----------------------------------------------
-
-# all the source files from the package
-!include make-files.txt
-
-# -----------------------------------------------
-
-NAME=dyn~
-
-all: $(OUTPATH) $(OUTPATH)\$(NAME).dll
-
-# remove build
-clean:
- -del /q $(OUTPATH) > nul
- -rmdir $(OUTPATH) > nul
-
-OBJS= $(SRCS:.cpp=.obj)
-
-$(OUTPATH):
- -mkdir $(OUTPATH) > nul
-
-{$(DIR)}.cpp{}.obj:
- cl /c /LD $(CFLAGS) $(DEFS) $(INCPATH) $** /Fo$(OUTPATH)\$@
-
-$(OUTPATH)\$(NAME).dll: $(OBJS)
- cd $(OUTPATH)
- link /DLL /out:$(NAME).dll /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/dyn/readme.txt b/externals/grill/dyn/readme.txt
deleted file mode 100644
index 2942d4e6..00000000
--- a/externals/grill/dyn/readme.txt
+++ /dev/null
@@ -1,70 +0,0 @@
-dyn~ - dynamic object management for PD
-
-Copyright (c)Thomas Grill (xovo@gmx.net)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-
-----------------------------------------------------------------------------
-
-You will need the flext C++ layer for PD and Max/MSP externals to compile this.
-see http://www.parasitaere-kapazitaeten.net/ext
-
-----------------------------------------------------------------------------
-
-The package should at least compile (and is tested) with the following compilers/platforms:
-
-pd - Windows:
--------------
-o Microsoft Visual C++: edit "config-pd-msvc.txt" & run "build-pd-msvc.bat"
-
-
-pd - linux:
------------
-o GCC: edit "config-pd-linux.txt" & run "sh build-pd-linux.sh"
-
-
-pd - MacOSX:
------------
-o GCC: edit "config-pd-darwin.txt" & run "sh build-pd-darwin.sh"
-
-----------------------------------------------------------------------------
-
-BUGS:
------
-
-- deletion of subcanvases and objects therein is crashy
-
-
-CHANGES:
---------
-
-0.1.1:
-- using aligned memory
-- cached several symbols
-
-0.1.0:
-- first release: PD 0.37 supports all necessary functionality
-- cleaner message-based object creation
-- also messages and comments can be created now
-- handle sub-canvases
-
-0.0.2:
-- give the dyn~ subcanvas a name (hard to access - for the wild scripters out there),
- so that it is different from the canvas where dyn~ is in
-- corrected names of message in- and out-proxies.
-- manually retrigger DSP after loading an abstraction
-
-0.0.1:
-- send loadbangs for loaded abstractions
-- now use "dsp" message to enable dsp in sub-canvas (no need of canvas_addtolist, canvas_takefromlist any more)
-
-
-0.0.0 - initial cvs version
-
-
-
-TODO:
---------
-- Hash table for object tags
-- add mute attribute
diff --git a/externals/grill/dyn/todo.txt b/externals/grill/dyn/todo.txt
new file mode 100755
index 00000000..21fd62b4
--- /dev/null
+++ b/externals/grill/dyn/todo.txt
@@ -0,0 +1,8 @@
+TODO:
+- PD could destroy present connections of objects connected to a sub-patcher when deleting inlet objects therein.
+ -> how to deal with that?
+
+- what happens if an error occurs during object creation (as it is only scheduled, not immediately executed).... callback with error message?
+
+- define search path for objects/abstractions
+