diff options
Diffstat (limited to 'externals/grill')
24 files changed, 1245 insertions, 1215 deletions
diff --git a/externals/grill/flext/build/config-win.def b/externals/grill/flext/build/config-win.def index cddb322f..628831b2 100644 --- a/externals/grill/flext/build/config-win.def +++ b/externals/grill/flext/build/config-win.def @@ -1,10 +1,2 @@ # use SIMD instructions (Intel SSE)? SIMD=1 - -# where is the STK installation? -# (uncomment the line with # to disable STK support) -#STK=c:\data\prog\audio\stk - -# where is the Sndobjs installation? -# (uncomment the line with # to disable SNDOBJ support) -#SNDOBJ=c:\data\prog\audio\sndobj diff --git a/externals/grill/flext/build/nmake-win-msvc.inc b/externals/grill/flext/build/nmake-win-msvc.inc index a54bb367..9dee194d 100644 --- a/externals/grill/flext/build/nmake-win-msvc.inc +++ b/externals/grill/flext/build/nmake-win-msvc.inc @@ -1,17 +1,3 @@ !ifdef SIMD DEFS=$(DEFS) /DFLEXT_USE_SIMD !endif - -!ifdef SNDOBJ -SRCS=$(SRCS) $(SRCS_SNDOBJ) -HDRS=$(HDRS) $(HDRS_SNDOBJ) -INCPATH=$(INCPATH) /I$(SNDOBJ)\include -LIBS=$(LIBS) $(SNDOBJ)\lib\sndobj.lib -!endif - -!ifdef STK -SRCS=$(SRCS) $(SRCS_STK) -HDRS=$(HDRS) $(HDRS_STK) -INCPATH=$(INCPATH) /I$(STK)\include -LIBS=$(LIBS) $(STK)\lib\stk.lib -!endif diff --git a/externals/grill/flext/buildsys/gnumake-ext.inc b/externals/grill/flext/buildsys/gnumake-ext.inc index d959aaca..1455c83e 100644 --- a/externals/grill/flext/buildsys/gnumake-ext.inc +++ b/externals/grill/flext/buildsys/gnumake-ext.inc @@ -1 +1 @@ -OUTNAME=$(NAME)
+OUTNAME=$(NAME) diff --git a/externals/grill/flext/buildsys/gnumake-flext.inc b/externals/grill/flext/buildsys/gnumake-flext.inc index f6ec8f65..64204656 100644 --- a/externals/grill/flext/buildsys/gnumake-flext.inc +++ b/externals/grill/flext/buildsys/gnumake-flext.inc @@ -1,3 +1,3 @@ -DEFS+=-DFLEXT_EXPORTS
-
-OUTNAME=lib$(FLEXTNAME)
+DEFS+=-DFLEXT_EXPORTS + +OUTNAME=lib$(FLEXTNAME) diff --git a/externals/grill/flext/buildsys/gnumake.inc b/externals/grill/flext/buildsys/gnumake.inc index 93203f36..4d8a9b7f 100644 --- a/externals/grill/flext/buildsys/gnumake.inc +++ b/externals/grill/flext/buildsys/gnumake.inc @@ -1,70 +1,70 @@ -##############################################
-# some compiler definitions
-##############################################
-
-CFLAGS += $(UFLAGS)
-
-ifdef DEBUG
-CFLAGS += -D_DEBUG $(DFLAGS)
-else
-ifdef PROFILE
-CFLAGS += -DNDEBUG $(OFLAGS)
-else
-CFLAGS += -DNDEBUG $(OFLAGS)
-endif
-endif
-
-
-ifdef SHARED
-# --- shared ---
-DEFS+=-DFLEXT_SHARED
-
-else
-ifdef THREADED
-# --- static multi-threaded ---
-DEFS+=-DFLEXT_THREADS
-
-else
-# --- static single-threaded ---
-
-endif
-endif
-
-##############################################
-# name of flext library
-##############################################
-
-ifdef SHARED
-TYPEEXT=_
-else
-ifdef THREADED
-TYPEEXT=_t
-else
-TYPEEXT=_s
-endif
-endif
-
-ifdef DEBUG
-MODEEXT=d
-else
-ifdef PROFILE
-MODEEXT=p
-else
-MODEEXT=
-ifdef SHARED
-TYPEEXT=
-endif
-endif
-endif
-
-FLEXTNAME=flext-$(RTSYS)$(TYPEEXT)$(MODEEXT)
-
-##############################################
-# product name and folder
-##############################################
-
-ifndef SRCDIR
-SRCDIR=.
-endif
-
-OUTSUB=$(TARGETMODE)-$(TARGETTYPE)
+############################################## +# some compiler definitions +############################################## + +CFLAGS += $(UFLAGS) + +ifdef DEBUG +CFLAGS += -D_DEBUG $(DFLAGS) +else +ifdef PROFILE +CFLAGS += -DNDEBUG $(OFLAGS) +else +CFLAGS += -DNDEBUG $(OFLAGS) +endif +endif + + +ifdef SHARED +# --- shared --- +DEFS+=-DFLEXT_SHARED + +else +ifdef THREADED +# --- static multi-threaded --- +DEFS+=-DFLEXT_THREADS + +else +# --- static single-threaded --- + +endif +endif + +############################################## +# name of flext library +############################################## + +ifdef SHARED +TYPEEXT=_ +else +ifdef THREADED +TYPEEXT=_t +else +TYPEEXT=_s +endif +endif + +ifdef DEBUG +MODEEXT=d +else +ifdef PROFILE +MODEEXT=p +else +MODEEXT= +ifdef SHARED +TYPEEXT= +endif +endif +endif + +FLEXTNAME=flext-$(RTSYS)$(TYPEEXT)$(MODEEXT) + +############################################## +# product name and folder +############################################## + +ifndef SRCDIR +SRCDIR=. +endif + +OUTSUB=$(TARGETMODE)-$(TARGETTYPE) diff --git a/externals/grill/flext/buildsys/nmake-ext.inc b/externals/grill/flext/buildsys/nmake-ext.inc index d959aaca..1455c83e 100644 --- a/externals/grill/flext/buildsys/nmake-ext.inc +++ b/externals/grill/flext/buildsys/nmake-ext.inc @@ -1 +1 @@ -OUTNAME=$(NAME)
+OUTNAME=$(NAME) diff --git a/externals/grill/flext/buildsys/nmake-flext.inc b/externals/grill/flext/buildsys/nmake-flext.inc index 8d3f177c..2e7faf0c 100644 --- a/externals/grill/flext/buildsys/nmake-flext.inc +++ b/externals/grill/flext/buildsys/nmake-flext.inc @@ -1,3 +1,3 @@ -DEFS=$(DEFS) /DFLEXT_EXPORTS
-
-OUTNAME=$(FLEXTNAME)
+DEFS=$(DEFS) /DFLEXT_EXPORTS + +OUTNAME=$(FLEXTNAME) diff --git a/externals/grill/flext/buildsys/nmake-shlib.inc b/externals/grill/flext/buildsys/nmake-shlib.inc index d959aaca..1455c83e 100644 --- a/externals/grill/flext/buildsys/nmake-shlib.inc +++ b/externals/grill/flext/buildsys/nmake-shlib.inc @@ -1 +1 @@ -OUTNAME=$(NAME)
+OUTNAME=$(NAME) diff --git a/externals/grill/flext/buildsys/nmake.inc b/externals/grill/flext/buildsys/nmake.inc index 888d5328..fd1bb50d 100644 --- a/externals/grill/flext/buildsys/nmake.inc +++ b/externals/grill/flext/buildsys/nmake.inc @@ -1,64 +1,64 @@ -##############################################
-# flext defines
-##############################################
-
-CFLAGS=$(CFLAGS) $(UFLAGS)
-
-!ifdef DEBUG
-CFLAGS=$(CFLAGS) /D_DEBUG $(DFLAGS)
-!else
-CFLAGS=$(CFLAGS) /DNDEBUG $(OFLAGS)
-!endif
-
-
-!ifdef SHARED
-# --- shared ---
-DEFS=$(DEFS) /DFLEXT_SHARED
-
-!elseifdef THREADED
-# --- static multi-threaded ---
-DEFS=$(DEFS) /DFLEXT_THREADS
-
-!else
-# --- static single-threaded ---
-
-!endif
-
-##############################################
-# name of flext library
-##############################################
-
-!ifdef SHARED
-TYPEEXT=_
-!else
-!ifdef THREADED
-TYPEEXT=_t
-!else
-TYPEEXT=_s
-!endif
-!endif
-
-!ifdef DEBUG
-MODEEXT=d
-!else
-!ifdef PROFILE
-MODEEXT=p
-!else
-MODEEXT=
-!ifdef SHARED
-TYPEEXT=
-!endif
-!endif
-!endif
-
-FLEXTNAME=flext-$(RTSYS)$(TYPEEXT)$(MODEEXT)
-
-##############################################
-# product name and folder
-##############################################
-
-!ifndef SRCDIR
-SRCDIR=.
-!endif
-
-OUTSUB=$(TARGETMODE)-$(TARGETTYPE)
+############################################## +# flext defines +############################################## + +CFLAGS=$(CFLAGS) $(UFLAGS) + +!ifdef DEBUG +CFLAGS=$(CFLAGS) /D_DEBUG $(DFLAGS) +!else +CFLAGS=$(CFLAGS) /DNDEBUG $(OFLAGS) +!endif + + +!ifdef SHARED +# --- shared --- +DEFS=$(DEFS) /DFLEXT_SHARED + +!elseifdef THREADED +# --- static multi-threaded --- +DEFS=$(DEFS) /DFLEXT_THREADS + +!else +# --- static single-threaded --- + +!endif + +############################################## +# name of flext library +############################################## + +!ifdef SHARED +TYPEEXT=_ +!else +!ifdef THREADED +TYPEEXT=_t +!else +TYPEEXT=_s +!endif +!endif + +!ifdef DEBUG +MODEEXT=d +!else +!ifdef PROFILE +MODEEXT=p +!else +MODEEXT= +!ifdef SHARED +TYPEEXT= +!endif +!endif +!endif + +FLEXTNAME=flext-$(RTSYS)$(TYPEEXT)$(MODEEXT) + +############################################## +# product name and folder +############################################## + +!ifndef SRCDIR +SRCDIR=. +!endif + +OUTSUB=$(TARGETMODE)-$(TARGETTYPE) diff --git a/externals/grill/flext/buildsys/readme.txt b/externals/grill/flext/buildsys/readme.txt index 434f479e..4fa74ad4 100644 --- a/externals/grill/flext/buildsys/readme.txt +++ b/externals/grill/flext/buildsys/readme.txt @@ -1,180 +1,180 @@ -flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 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.
-
-----------------------------------------------------------------------------
-
-At the moment this is more like a sketchboard, but i'll promise to bring some
-order into it some fine day in the not too distant future.
-
-----------------------------------------------------------------------------
-
-Build scripts
-=============
-
-Depending on platform the build process is run with
-build.sh
-or
-build.bat
-
-
-Arguments: PLATFORM SYSTEM COMPILER {TARGET} {definitions}
-
-PLATFORM: win / lnx / mac
-SYSTEM: pd / max
-COMPILER: msvc / gcc / mingw / cygwin / bcc / icc
-
-TARGET: (default is all)
- all, build - build package in default style
- install - install package
- clean - clean build products
-
- config - test if configuration needs refreshing
-
-or
- build-MODE-TYPE
- install-MODE-TYPE
- clean-MODE-TYPE
-
-with
- MODE: default, all, release, debug, profile
- TYPE: default, all, single, multi, shared
-
-
-Additional definitions can be passed to the make program
-like
- "PKGINFO=info.txt" (defines new filename for package information)
-or
- "PKGINFO=" (package information will be skipped - only for config target)
-
-For more macro names, see below
-
-
-For each of the supported combinations of PLATFORM, SYSTEM and COMPILER
-a MAKE program has been chosen, normally the one that comes with the compiler.
-
-For gcc it is GNU make (gnumake)
-For msvc it is Microsoft make (nmake)
-For bcc it is Borland make (bmake)
-
-
-
-Package info (package.txt)
-==========================
-
-Package information contains vital information for the build process.
-Obligatory are only:
-
-NAME: resulting filename of the build product
-SRCS: list of source files
-
-
-Normally also used are:
-
-HDRS: used header files, which SRCS files are dependent upon
-SRCDIR: source folder (relative to project folder), default is .
-
-
-Other settings:
-
-PRECOMPILE: prefix header file (in SRCDIR) for all source files,
- will be precompiled if supported by the compiler
-
-BUILDCLASS: can currently be flext or ext, default is ext.
- flext will build the flext system
- ext will build a flext-based external
-
-BUILDMODE: release or debug, default is release
- if release, optimization flags will be used
- if debug, debug information will be generated
- if profile, profiling information will be generated (with debug info and optimization)
-
-BUILDTYPE: single, multi or shared, default is single
- if single, it will be linked against the single-threaded static flext library
- if multi, it will be linked against the multi-threaded static flext library
- if shared, it will be linked against the shared flext library
-
-BUILDDIR: relative folder with additional build settings
-
-
-
-Additional build settings (BUILDDIR)
-====================================
-
-If BUILDDIR is defined, all PLATFORM-SYSTEM-COMPILER combinations to support
-must are mirrored by the respective .def and .inc files in the BUILDDIR.
-
-
-config-PLATFORM.def files (e.g. config-lnx.def) :
-
- These files can contain additional macro definitions, that are private
- to the project.
- The definitions should be strictly in the form SETTING=value, without any
- make-specific macros etc.
- The .def files work as templates that get copied to a user-editable
- config.txt file when the build process is first started.
-
-
-MAKE-PLATFORM-COMPILER.inc files
-(e.g. gnumake-lnx-gcc.inc or nmake-win-msvc.inc):
-
- These files (which are no considered to be edited by the user) can contain
- specific modifications to compiler flags, include file paths etc.
-
- For gnumake this would e.g. be
- INCPATH += -I/usr/local/include/python2.3
-
- for nmake or bmake e.g.
- INCPATH = $(INCPATH) -I"c:\program files\Python2.3\include"
-
-
-Structure of build system
-=========================
-
-The build system has several levels of information, which are evaluated in the
-following order (see also buildsys/MAKE-sub.mak)
-
-Project level:
-- PKGINFO file (e.g. package.txt)
-- USRCONFIG file (e.g. config.txt)
-- USRMAKE file (e.g. build/gnumake-lnx-gcc.inc)
-
-General definitions (in buildsys):
-
-- MAKE.inc (e.g. buildsys/gnumake.inc)
- contains evaluation of flext library name, build directory etc.
-- MAKE-BUILDCLASS.inc (e.g. buildsys/gnumake-ext.inc)
- contains some more flag settings
-
-Real-time-system-dependent definitions (in buildsys/PLATFORM/SYSTEM):
-
-- MAKE-COMPILER.inc (e.g. buildsys/lnx/pd/gnumake-gcc.inc)
- contains general real-time-system dependent info (e.g. paths, FLEXT_SYS setting)
-- MAKE-COMPILER-BUILDCLASS.inc (e.g. buildsys/lnx/pd/gnumake-gcc-ext.inc)
- contains specific real-time-system dependent info (e.g. extension of binary)
-
-Platform-dependent definitions (in buildsys/PLATFORM):
-
-- MAKE-COMPILER.inc (e.g. buildsys/lnx/gnumake-gcc.inc)
- contains general platform-specific flags
-- MAKE-COMPILER-BUILDCLASS.inc (e.g. buildsys/lnx/gnumake-gcc-ext.inc)
- contains the actual make targets (_build_,_clean_ and _install_)
-
-
-Macro names
-===============
-
-PKGINFO - filename for package information (must reside in project folder)
-
-UFLAGS - user defined compiler flags
-OFLAGS - user defined optimization flags (not used in debug builds)
-
-CFLAGS - compiler flags
-LDFLAGS - linker flags
-
-INCPATH - include file path (must come with e.g. -I )
-LIBPATH - library path (must come with e.g. -L )
-
-LIBS - libraries to link in (must come with e.g. -l )
+flext - C++ layer for Max/MSP and pd (pure data) externals + +Copyright (c) 2001-2005 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. + +---------------------------------------------------------------------------- + +At the moment this is more like a sketchboard, but i'll promise to bring some +order into it some fine day in the not too distant future. + +---------------------------------------------------------------------------- + +Build scripts +============= + +Depending on platform the build process is run with +build.sh +or +build.bat + + +Arguments: PLATFORM SYSTEM COMPILER {TARGET} {definitions} + +PLATFORM: win / lnx / mac +SYSTEM: pd / max +COMPILER: msvc / gcc / mingw / cygwin / bcc / icc + +TARGET: (default is all) + all, build - build package in default style + install - install package + clean - clean build products + + config - test if configuration needs refreshing + +or + build-MODE-TYPE + install-MODE-TYPE + clean-MODE-TYPE + +with + MODE: default, all, release, debug, profile + TYPE: default, all, single, multi, shared + + +Additional definitions can be passed to the make program +like + "PKGINFO=info.txt" (defines new filename for package information) +or + "PKGINFO=" (package information will be skipped - only for config target) + +For more macro names, see below + + +For each of the supported combinations of PLATFORM, SYSTEM and COMPILER +a MAKE program has been chosen, normally the one that comes with the compiler. + +For gcc it is GNU make (gnumake) +For msvc it is Microsoft make (nmake) +For bcc it is Borland make (bmake) + + + +Package info (package.txt) +========================== + +Package information contains vital information for the build process. +Obligatory are only: + +NAME: resulting filename of the build product +SRCS: list of source files + + +Normally also used are: + +HDRS: used header files, which SRCS files are dependent upon +SRCDIR: source folder (relative to project folder), default is . + + +Other settings: + +PRECOMPILE: prefix header file (in SRCDIR) for all source files, + will be precompiled if supported by the compiler + +BUILDCLASS: can currently be flext or ext, default is ext. + flext will build the flext system + ext will build a flext-based external + +BUILDMODE: release or debug, default is release + if release, optimization flags will be used + if debug, debug information will be generated + if profile, profiling information will be generated (with debug info and optimization) + +BUILDTYPE: single, multi or shared, default is single + if single, it will be linked against the single-threaded static flext library + if multi, it will be linked against the multi-threaded static flext library + if shared, it will be linked against the shared flext library + +BUILDDIR: relative folder with additional build settings + + + +Additional build settings (BUILDDIR) +==================================== + +If BUILDDIR is defined, all PLATFORM-SYSTEM-COMPILER combinations to support +must are mirrored by the respective .def and .inc files in the BUILDDIR. + + +config-PLATFORM.def files (e.g. config-lnx.def) : + + These files can contain additional macro definitions, that are private + to the project. + The definitions should be strictly in the form SETTING=value, without any + make-specific macros etc. + The .def files work as templates that get copied to a user-editable + config.txt file when the build process is first started. + + +MAKE-PLATFORM-COMPILER.inc files +(e.g. gnumake-lnx-gcc.inc or nmake-win-msvc.inc): + + These files (which are no considered to be edited by the user) can contain + specific modifications to compiler flags, include file paths etc. + + For gnumake this would e.g. be + INCPATH += -I/usr/local/include/python2.3 + + for nmake or bmake e.g. + INCPATH = $(INCPATH) -I"c:\program files\Python2.3\include" + + +Structure of build system +========================= + +The build system has several levels of information, which are evaluated in the +following order (see also buildsys/MAKE-sub.mak) + +Project level: +- PKGINFO file (e.g. package.txt) +- USRCONFIG file (e.g. config.txt) +- USRMAKE file (e.g. build/gnumake-lnx-gcc.inc) + +General definitions (in buildsys): + +- MAKE.inc (e.g. buildsys/gnumake.inc) + contains evaluation of flext library name, build directory etc. +- MAKE-BUILDCLASS.inc (e.g. buildsys/gnumake-ext.inc) + contains some more flag settings + +Real-time-system-dependent definitions (in buildsys/PLATFORM/SYSTEM): + +- MAKE-COMPILER.inc (e.g. buildsys/lnx/pd/gnumake-gcc.inc) + contains general real-time-system dependent info (e.g. paths, FLEXT_SYS setting) +- MAKE-COMPILER-BUILDCLASS.inc (e.g. buildsys/lnx/pd/gnumake-gcc-ext.inc) + contains specific real-time-system dependent info (e.g. extension of binary) + +Platform-dependent definitions (in buildsys/PLATFORM): + +- MAKE-COMPILER.inc (e.g. buildsys/lnx/gnumake-gcc.inc) + contains general platform-specific flags +- MAKE-COMPILER-BUILDCLASS.inc (e.g. buildsys/lnx/gnumake-gcc-ext.inc) + contains the actual make targets (_build_,_clean_ and _install_) + + +Macro names +=============== + +PKGINFO - filename for package information (must reside in project folder) + +UFLAGS - user defined compiler flags +OFLAGS - user defined optimization flags (not used in debug builds) + +CFLAGS - compiler flags +LDFLAGS - linker flags + +INCPATH - include file path (must come with e.g. -I ) +LIBPATH - library path (must come with e.g. -L ) + +LIBS - libraries to link in (must come with e.g. -l ) diff --git a/externals/grill/flext/buildsys/targets-ext.inc b/externals/grill/flext/buildsys/targets-ext.inc index bd9d733e..b8031522 100644 --- a/externals/grill/flext/buildsys/targets-ext.inc +++ b/externals/grill/flext/buildsys/targets-ext.inc @@ -1,51 +1,51 @@ -build-default-default: build-$(BUILDMODE)-$(BUILDTYPE)
-
-build-all-default: build-all-$(BUILDTYPE)
-
-build-release-default: build-release-$(BUILDTYPE)
-
-build-debug-default: build-debug-$(BUILDTYPE)
-
-build-profile-default: build-profile-$(BUILDTYPE)
-
-build-default-all: build-$(BUILDMODE)-all
-
-build-default-single: build-$(BUILDMODE)-single
-
-build-default-multi: build-$(BUILDMODE)-multi
-
-build-default-shared: build-$(BUILDMODE)-shared
-
-
-install-default-default: install-$(BUILDMODE)-$(BUILDTYPE)
-
-install-all-default: install-all-$(BUILDTYPE)
-
-install-release-default: install-release-$(BUILDTYPE)
-
-install-debug-default: install-debug-$(BUILDTYPE)
-
-install-default-all: install-$(BUILDMODE)-all
-
-install-default-single: install-$(BUILDMODE)-single
-
-install-default-multi: install-$(BUILDMODE)-multi
-
-install-default-shared: install-$(BUILDMODE)-shared
-
-
-clean-default-default: clean-$(BUILDMODE)-$(BUILDTYPE)
-
-clean-all-default: clean-all-$(BUILDTYPE)
-
-clean-release-default: clean-release-$(BUILDTYPE)
-
-clean-debug-default: clean-debug-$(BUILDTYPE)
-
-clean-default-all: clean-$(BUILDMODE)-all
-
-clean-default-single: clean-$(BUILDMODE)-single
-
-clean-default-multi: clean-$(BUILDMODE)-multi
-
-clean-default-shared: clean-$(BUILDMODE)-shared
+build-default-default: build-$(BUILDMODE)-$(BUILDTYPE) + +build-all-default: build-all-$(BUILDTYPE) + +build-release-default: build-release-$(BUILDTYPE) + +build-debug-default: build-debug-$(BUILDTYPE) + +build-profile-default: build-profile-$(BUILDTYPE) + +build-default-all: build-$(BUILDMODE)-all + +build-default-single: build-$(BUILDMODE)-single + +build-default-multi: build-$(BUILDMODE)-multi + +build-default-shared: build-$(BUILDMODE)-shared + + +install-default-default: install-$(BUILDMODE)-$(BUILDTYPE) + +install-all-default: install-all-$(BUILDTYPE) + +install-release-default: install-release-$(BUILDTYPE) + +install-debug-default: install-debug-$(BUILDTYPE) + +install-default-all: install-$(BUILDMODE)-all + +install-default-single: install-$(BUILDMODE)-single + +install-default-multi: install-$(BUILDMODE)-multi + +install-default-shared: install-$(BUILDMODE)-shared + + +clean-default-default: clean-$(BUILDMODE)-$(BUILDTYPE) + +clean-all-default: clean-all-$(BUILDTYPE) + +clean-release-default: clean-release-$(BUILDTYPE) + +clean-debug-default: clean-debug-$(BUILDTYPE) + +clean-default-all: clean-$(BUILDMODE)-all + +clean-default-single: clean-$(BUILDMODE)-single + +clean-default-multi: clean-$(BUILDMODE)-multi + +clean-default-shared: clean-$(BUILDMODE)-shared diff --git a/externals/grill/flext/buildsys/targets-flext.inc b/externals/grill/flext/buildsys/targets-flext.inc index 83772b94..e0e984cf 100644 --- a/externals/grill/flext/buildsys/targets-flext.inc +++ b/externals/grill/flext/buildsys/targets-flext.inc @@ -1,52 +1,52 @@ -build-default-default: build-all-all
-
-build-all-default: build-all-all
-
-build-release-default: build-release-all
-
-build-debug-default: build-debug-all
-
-build-profile-default: build-profile-all
-
-build-default-all: build-all-all
-
-build-default-single: build-all-single
-
-build-default-multi: build-all-multi
-
-build-default-shared: build-all-shared
-
-
-install-default-default: install-all-all
-
-install-all-default: install-all-all
-
-install-release-default: install-release-all
-
-install-debug-default: install-debug-all
-
-install-default-all: install-all-all
-
-install-default-single: install-all-single
-
-install-default-multi: install-all-multi
-
-install-default-shared: install-all-shared
-
-
-clean-default-default: clean-all-all
-
-clean-all-default: clean-all-all
-
-clean-release-default: clean-release-all
-
-clean-debug-default: clean-debug-all
-
-clean-default-all: clean-all-all
-
-clean-default-single: clean-all-single
-
-clean-default-multi: clean-all-multi
-
-clean-default-shared: clean-all-shared
-
+build-default-default: build-all-all + +build-all-default: build-all-all + +build-release-default: build-release-all + +build-debug-default: build-debug-all + +build-profile-default: build-profile-all + +build-default-all: build-all-all + +build-default-single: build-all-single + +build-default-multi: build-all-multi + +build-default-shared: build-all-shared + + +install-default-default: install-all-all + +install-all-default: install-all-all + +install-release-default: install-release-all + +install-debug-default: install-debug-all + +install-default-all: install-all-all + +install-default-single: install-all-single + +install-default-multi: install-all-multi + +install-default-shared: install-all-shared + + +clean-default-default: clean-all-all + +clean-all-default: clean-all-all + +clean-release-default: clean-release-all + +clean-debug-default: clean-debug-all + +clean-default-all: clean-all-all + +clean-default-single: clean-all-single + +clean-default-multi: clean-all-multi + +clean-default-shared: clean-all-shared + diff --git a/externals/grill/flext/buildsys/targets-shlib.inc b/externals/grill/flext/buildsys/targets-shlib.inc index bd9d733e..b8031522 100644 --- a/externals/grill/flext/buildsys/targets-shlib.inc +++ b/externals/grill/flext/buildsys/targets-shlib.inc @@ -1,51 +1,51 @@ -build-default-default: build-$(BUILDMODE)-$(BUILDTYPE)
-
-build-all-default: build-all-$(BUILDTYPE)
-
-build-release-default: build-release-$(BUILDTYPE)
-
-build-debug-default: build-debug-$(BUILDTYPE)
-
-build-profile-default: build-profile-$(BUILDTYPE)
-
-build-default-all: build-$(BUILDMODE)-all
-
-build-default-single: build-$(BUILDMODE)-single
-
-build-default-multi: build-$(BUILDMODE)-multi
-
-build-default-shared: build-$(BUILDMODE)-shared
-
-
-install-default-default: install-$(BUILDMODE)-$(BUILDTYPE)
-
-install-all-default: install-all-$(BUILDTYPE)
-
-install-release-default: install-release-$(BUILDTYPE)
-
-install-debug-default: install-debug-$(BUILDTYPE)
-
-install-default-all: install-$(BUILDMODE)-all
-
-install-default-single: install-$(BUILDMODE)-single
-
-install-default-multi: install-$(BUILDMODE)-multi
-
-install-default-shared: install-$(BUILDMODE)-shared
-
-
-clean-default-default: clean-$(BUILDMODE)-$(BUILDTYPE)
-
-clean-all-default: clean-all-$(BUILDTYPE)
-
-clean-release-default: clean-release-$(BUILDTYPE)
-
-clean-debug-default: clean-debug-$(BUILDTYPE)
-
-clean-default-all: clean-$(BUILDMODE)-all
-
-clean-default-single: clean-$(BUILDMODE)-single
-
-clean-default-multi: clean-$(BUILDMODE)-multi
-
-clean-default-shared: clean-$(BUILDMODE)-shared
+build-default-default: build-$(BUILDMODE)-$(BUILDTYPE) + +build-all-default: build-all-$(BUILDTYPE) + +build-release-default: build-release-$(BUILDTYPE) + +build-debug-default: build-debug-$(BUILDTYPE) + +build-profile-default: build-profile-$(BUILDTYPE) + +build-default-all: build-$(BUILDMODE)-all + +build-default-single: build-$(BUILDMODE)-single + +build-default-multi: build-$(BUILDMODE)-multi + +build-default-shared: build-$(BUILDMODE)-shared + + +install-default-default: install-$(BUILDMODE)-$(BUILDTYPE) + +install-all-default: install-all-$(BUILDTYPE) + +install-release-default: install-release-$(BUILDTYPE) + +install-debug-default: install-debug-$(BUILDTYPE) + +install-default-all: install-$(BUILDMODE)-all + +install-default-single: install-$(BUILDMODE)-single + +install-default-multi: install-$(BUILDMODE)-multi + +install-default-shared: install-$(BUILDMODE)-shared + + +clean-default-default: clean-$(BUILDMODE)-$(BUILDTYPE) + +clean-all-default: clean-all-$(BUILDTYPE) + +clean-release-default: clean-release-$(BUILDTYPE) + +clean-debug-default: clean-debug-$(BUILDTYPE) + +clean-default-all: clean-$(BUILDMODE)-all + +clean-default-single: clean-$(BUILDMODE)-single + +clean-default-multi: clean-$(BUILDMODE)-multi + +clean-default-shared: clean-$(BUILDMODE)-shared diff --git a/externals/grill/flext/buildsys/targets.inc b/externals/grill/flext/buildsys/targets.inc index a1ab4631..1c901410 100644 --- a/externals/grill/flext/buildsys/targets.inc +++ b/externals/grill/flext/buildsys/targets.inc @@ -1,148 +1,148 @@ -all: build
-
-build: build-default-default
-
-profile: build-profile-default
-
-clean: clean-default-default
-
-install: install-default-default
-
-###########################################################
-
-build-all-all: build-release-all build-debug-all
-
-build-release-all: build-release-single build-release-multi build-release-shared
-
-build-debug-all: build-debug-single build-debug-multi build-debug-shared
-
-build-profile-all: build-profile-single build-profile-multi build-profile-shared
-
-build-all-single: build-release-single build-debug-single
-
-build-all-multi: build-release-multi build-debug-multi
-
-build-all-shared: build-release-shared build-debug-shared
-
-###################################################
-
-install-all-all: install-release-all install-debug-all
-
-install-release-all: install-release-single install-release-multi install-release-shared
-
-install-debug-all: install-debug-single install-debug-multi install-debug-shared
-
-install-profile-all: install-profile-single install-profile-multi install-profile-shared
-
-install-all-single: install-release-single install-debug-single
-
-install-all-multi: install-release-multi install-debug-multi
-
-install-all-shared: install-release-shared install-debug-shared
-
-###################################################
-
-clean-all-all: clean-release-all clean-debug-all
-
-clean-release-all: clean-release-single clean-release-multi clean-release-shared
-
-clean-debug-all: clean-debug-single clean-debug-multi clean-debug-shared
-
-clean-profile-all: clean-profile-single clean-profile-multi clean-profile-shared
-
-clean-all-single: clean-release-single clean-debug-single
-
-clean-all-multi: clean-release-multi clean-debug-multi
-
-clean-all-shared: clean-release-shared clean-debug-shared
-
-###########################################################
-
-build-release-single: config
- $(MAKE) $(OPTIONS) TARGETMODE=release TARGETTYPE=single _build_
-
-build-debug-single: config
- $(MAKE) $(OPTIONS) TARGETMODE=debug TARGETTYPE=single DEBUG=1 _build_
-
-build-profile-single: config
- $(MAKE) $(OPTIONS) TARGETMODE=profile TARGETTYPE=single PROFILE=1 _build_
-
-build-release-multi: config
- $(MAKE) $(OPTIONS) TARGETMODE=release TARGETTYPE=multi THREADED=1 _build_
-
-build-debug-multi: config
- $(MAKE) $(OPTIONS) TARGETMODE=debug TARGETTYPE=multi THREADED=1 DEBUG=1 _build_
-
-build-profile-multi: config
- $(MAKE) $(OPTIONS) TARGETMODE=profile TARGETTYPE=multi THREADED=1 PROFILE=1 _build_
-
-build-release-shared: config
- $(MAKE) $(OPTIONS) TARGETMODE=release TARGETTYPE=shared SHARED=1 _build_
-
-build-debug-shared: config
- $(MAKE) $(OPTIONS) TARGETMODE=debug TARGETTYPE=shared SHARED=1 DEBUG=1 _build_
-
-build-profile-shared: config
- $(MAKE) $(OPTIONS) TARGETMODE=profile TARGETTYPE=shared SHARED=1 PROFILE=1 _build_
-
-###########################################################
-
-install-release-single: config
- $(MAKE) $(OPTIONS) TARGETMODE=release TARGETTYPE=single _install_
-
-install-debug-single: config
- $(MAKE) $(OPTIONS) TARGETMODE=debug TARGETTYPE=single DEBUG=1 _install_
-
-install-profile-single: config
- $(MAKE) $(OPTIONS) TARGETMODE=profile TARGETTYPE=single PROFILE=1 _install_
-
-install-release-multi: config
- $(MAKE) $(OPTIONS) TARGETMODE=release TARGETTYPE=multi THREADED=1 _install_
-
-install-debug-multi: config
- $(MAKE) $(OPTIONS) TARGETMODE=debug TARGETTYPE=multi THREADED=1 DEBUG=1 _install_
-
-install-profile-multi: config
- $(MAKE) $(OPTIONS) TARGETMODE=profile TARGETTYPE=multi THREADED=1 PROFILE=1 _install_
-
-install-release-shared: config
- $(MAKE) $(OPTIONS) TARGETMODE=release TARGETTYPE=shared SHARED=1 _install_
-
-install-debug-shared: config
- $(MAKE) $(OPTIONS) TARGETMODE=debug TARGETTYPE=shared SHARED=1 DEBUG=1 _install_
-
-install-profile-shared: config
- $(MAKE) $(OPTIONS) TARGETMODE=profile TARGETTYPE=shared SHARED=1 PROFILE=1 _install_
-
-###########################################################
-
-clean-release-single: config
- $(MAKE) $(OPTIONS) TARGETMODE=release TARGETTYPE=single _clean_
-
-clean-debug-single: config
- $(MAKE) $(OPTIONS) TARGETMODE=debug TARGETTYPE=single DEBUG=1 _clean_
-
-clean-profile-single: config
- $(MAKE) $(OPTIONS) TARGETMODE=profile TARGETTYPE=single PROFILE=1 _clean_
-
-clean-release-multi: config
- $(MAKE) $(OPTIONS) TARGETMODE=release TARGETTYPE=multi THREADED=1 _clean_
-
-clean-debug-multi: config
- $(MAKE) $(OPTIONS) TARGETMODE=debug TARGETTYPE=multi THREADED=1 DEBUG=1 _clean_
-
-clean-profile-multi: config
- $(MAKE) $(OPTIONS) TARGETMODE=profile TARGETTYPE=multi THREADED=1 PROFILE=1 _clean_
-
-clean-release-shared: config
- $(MAKE) $(OPTIONS) TARGETMODE=release TARGETTYPE=shared SHARED=1 _clean_
-
-clean-debug-shared: config
- $(MAKE) $(OPTIONS) TARGETMODE=debug TARGETTYPE=shared SHARED=1 DEBUG=1 _clean_
-
-clean-profile-shared: config
- $(MAKE) $(OPTIONS) TARGETMODE=profile TARGETTYPE=shared SHARED=1 PROFILE=1 _clean_
-
-###########################################################
-
-config: $(USRMAKE) $(SYSCONFIG) $(USRCONFIG)
+all: build + +build: build-default-default + +profile: build-profile-default + +clean: clean-default-default + +install: install-default-default + +########################################################### + +build-all-all: build-release-all build-debug-all + +build-release-all: build-release-single build-release-multi build-release-shared + +build-debug-all: build-debug-single build-debug-multi build-debug-shared + +build-profile-all: build-profile-single build-profile-multi build-profile-shared + +build-all-single: build-release-single build-debug-single + +build-all-multi: build-release-multi build-debug-multi + +build-all-shared: build-release-shared build-debug-shared + +################################################### + +install-all-all: install-release-all install-debug-all + +install-release-all: install-release-single install-release-multi install-release-shared + +install-debug-all: install-debug-single install-debug-multi install-debug-shared + +install-profile-all: install-profile-single install-profile-multi install-profile-shared + +install-all-single: install-release-single install-debug-single + +install-all-multi: install-release-multi install-debug-multi + +install-all-shared: install-release-shared install-debug-shared + +################################################### + +clean-all-all: clean-release-all clean-debug-all + +clean-release-all: clean-release-single clean-release-multi clean-release-shared + +clean-debug-all: clean-debug-single clean-debug-multi clean-debug-shared + +clean-profile-all: clean-profile-single clean-profile-multi clean-profile-shared + +clean-all-single: clean-release-single clean-debug-single + +clean-all-multi: clean-release-multi clean-debug-multi + +clean-all-shared: clean-release-shared clean-debug-shared + +########################################################### + +build-release-single: config + $(MAKE) $(OPTIONS) TARGETMODE=release TARGETTYPE=single _build_ + +build-debug-single: config + $(MAKE) $(OPTIONS) TARGETMODE=debug TARGETTYPE=single DEBUG=1 _build_ + +build-profile-single: config + $(MAKE) $(OPTIONS) TARGETMODE=profile TARGETTYPE=single PROFILE=1 _build_ + +build-release-multi: config + $(MAKE) $(OPTIONS) TARGETMODE=release TARGETTYPE=multi THREADED=1 _build_ + +build-debug-multi: config + $(MAKE) $(OPTIONS) TARGETMODE=debug TARGETTYPE=multi THREADED=1 DEBUG=1 _build_ + +build-profile-multi: config + $(MAKE) $(OPTIONS) TARGETMODE=profile TARGETTYPE=multi THREADED=1 PROFILE=1 _build_ + +build-release-shared: config + $(MAKE) $(OPTIONS) TARGETMODE=release TARGETTYPE=shared SHARED=1 _build_ + +build-debug-shared: config + $(MAKE) $(OPTIONS) TARGETMODE=debug TARGETTYPE=shared SHARED=1 DEBUG=1 _build_ + +build-profile-shared: config + $(MAKE) $(OPTIONS) TARGETMODE=profile TARGETTYPE=shared SHARED=1 PROFILE=1 _build_ + +########################################################### + +install-release-single: config + $(MAKE) $(OPTIONS) TARGETMODE=release TARGETTYPE=single _install_ + +install-debug-single: config + $(MAKE) $(OPTIONS) TARGETMODE=debug TARGETTYPE=single DEBUG=1 _install_ + +install-profile-single: config + $(MAKE) $(OPTIONS) TARGETMODE=profile TARGETTYPE=single PROFILE=1 _install_ + +install-release-multi: config + $(MAKE) $(OPTIONS) TARGETMODE=release TARGETTYPE=multi THREADED=1 _install_ + +install-debug-multi: config + $(MAKE) $(OPTIONS) TARGETMODE=debug TARGETTYPE=multi THREADED=1 DEBUG=1 _install_ + +install-profile-multi: config + $(MAKE) $(OPTIONS) TARGETMODE=profile TARGETTYPE=multi THREADED=1 PROFILE=1 _install_ + +install-release-shared: config + $(MAKE) $(OPTIONS) TARGETMODE=release TARGETTYPE=shared SHARED=1 _install_ + +install-debug-shared: config + $(MAKE) $(OPTIONS) TARGETMODE=debug TARGETTYPE=shared SHARED=1 DEBUG=1 _install_ + +install-profile-shared: config + $(MAKE) $(OPTIONS) TARGETMODE=profile TARGETTYPE=shared SHARED=1 PROFILE=1 _install_ + +########################################################### + +clean-release-single: config + $(MAKE) $(OPTIONS) TARGETMODE=release TARGETTYPE=single _clean_ + +clean-debug-single: config + $(MAKE) $(OPTIONS) TARGETMODE=debug TARGETTYPE=single DEBUG=1 _clean_ + +clean-profile-single: config + $(MAKE) $(OPTIONS) TARGETMODE=profile TARGETTYPE=single PROFILE=1 _clean_ + +clean-release-multi: config + $(MAKE) $(OPTIONS) TARGETMODE=release TARGETTYPE=multi THREADED=1 _clean_ + +clean-debug-multi: config + $(MAKE) $(OPTIONS) TARGETMODE=debug TARGETTYPE=multi THREADED=1 DEBUG=1 _clean_ + +clean-profile-multi: config + $(MAKE) $(OPTIONS) TARGETMODE=profile TARGETTYPE=multi THREADED=1 PROFILE=1 _clean_ + +clean-release-shared: config + $(MAKE) $(OPTIONS) TARGETMODE=release TARGETTYPE=shared SHARED=1 _clean_ + +clean-debug-shared: config + $(MAKE) $(OPTIONS) TARGETMODE=debug TARGETTYPE=shared SHARED=1 DEBUG=1 _clean_ + +clean-profile-shared: config + $(MAKE) $(OPTIONS) TARGETMODE=profile TARGETTYPE=shared SHARED=1 PROFILE=1 _clean_ + +########################################################### + +config: $(USRMAKE) $(SYSCONFIG) $(USRCONFIG) diff --git a/externals/grill/flext/changes.txt b/externals/grill/flext/changes.txt index 3369338c..ae67cbf4 100644 --- a/externals/grill/flext/changes.txt +++ b/externals/grill/flext/changes.txt @@ -35,6 +35,9 @@ Version history: - attribute generation is now determined exclusively by each object class setup (not library is before) - more robust pack setting for Max/MSP @ Windows - should work with Mac/Intel (still untested!) +- added new FLEXT_HEADER macros to enable class templates +- more ToOut/Sys* methods +- fixed help name definition at class setup 0.5.0: - fixes for 64 bit builds (size_t is integer type of pointer size) diff --git a/externals/grill/flext/source/flbase.cpp b/externals/grill/flext/source/flbase.cpp index a1cc37d3..404588d9 100644 --- a/externals/grill/flext/source/flbase.cpp +++ b/externals/grill/flext/source/flbase.cpp @@ -98,10 +98,11 @@ void flext_obj::DefineHelp(t_classid c,const char *ref,const char *dir,bool addt { #if FLEXT_SYS == FLEXT_SYS_PD char tmp[256]; - if(dir) { - strcpy(tmp,dir); - strcat(tmp,"/"); - strcat(tmp,ref); + if(dir && *dir) { + strcpy(tmp,dir); + char *last = tmp+strlen(tmp)-1; + if(*last != '/') strcat(last,"/"); + strcat(last,ref); } else strcpy(tmp,ref); diff --git a/externals/grill/flext/source/flbase.h b/externals/grill/flext/source/flbase.h index c37036c1..73b1a21a 100644 --- a/externals/grill/flext/source/flbase.h +++ b/externals/grill/flext/source/flbase.h @@ -331,6 +331,34 @@ static void __setup__(t_classid classid) { \ thisType::SETUPFUN(classid); \ } +#define FLEXT_REALHDR_T(NEW_CLASS, PARENT_CLASS) \ +public: \ +typedef NEW_CLASS thisType; \ +typedef PARENT_CLASS thisParent; \ +typedef typename thisParent::t_classid t_classid; \ +static FLEXT_CLASSDEF(flext_obj) *__init__(int argc,t_atom *argv); \ +static void __free__(flext_hdr *hdr) { \ + FLEXT_CLASSDEF(flext_obj) *mydata = hdr->data; delete mydata; \ + hdr->flext_hdr::~flext_hdr(); \ +} \ +static void __setup__(t_classid classid) { thisParent::__setup__(classid); } + + +#define FLEXT_REALHDR_TS(NEW_CLASS, PARENT_CLASS,SETUPFUN) \ +public: \ +typedef NEW_CLASS thisType; \ +typedef PARENT_CLASS thisParent; \ +typedef typename thisParent::t_classid t_classid; \ +static FLEXT_CLASSDEF(flext_obj) *__init__(int argc,t_atom *argv); \ +static void __free__(flext_hdr *hdr) { \ + FLEXT_CLASSDEF(flext_obj) *mydata = hdr->data; delete mydata; \ + hdr->flext_hdr::~flext_hdr(); \ +} \ +static void __setup__(t_classid classid) { \ + thisParent::__setup__(classid); \ + thisType::SETUPFUN(classid); \ +} + // generate name of dsp/non-dsp setup function #if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX diff --git a/externals/grill/flext/source/flclass.h b/externals/grill/flext/source/flclass.h index 4356ee8f..cbaa5b1b 100644 --- a/externals/grill/flext/source/flclass.h +++ b/externals/grill/flext/source/flclass.h @@ -226,6 +226,8 @@ public: void ToOutAnything(int n,const t_symbol *s,int argc,const t_atom *argv) const; //! Output anything (index n starts with 0) void ToOutAnything(int n,const AtomAnything &any) const { ToOutAnything(n,any.Header(),any.Count(),any.Atoms()); } + //! Output anything (index n starts with 0) + void ToOutAnything(int n,const t_symbol *s,const AtomList &list) const { ToOutAnything(n,s,list.Count(),list.Atoms()); } //! @} FLEXT_C_IO_OUT @@ -828,8 +830,12 @@ protected: void ToSysFloat(int n,float f) const { outlet *o = GetOut(n); if(o) { CRITON(); outlet_float((t_outlet *)o,f); CRITOFF(); } } void ToSysInt(int n,int f) const { outlet *o = GetOut(n); if(o) { CRITON(); outlet_flint((t_outlet *)o,f); CRITOFF(); } } void ToSysSymbol(int n,const t_symbol *s) const { outlet *o = GetOut(n); if(o) { CRITON(); outlet_symbol((t_outlet *)o,const_cast<t_symbol *>(s)); CRITOFF(); } } + void ToSysString(int n,const char *s) const { ToSysSymbol(n,MakeSymbol(s)); } void ToSysList(int n,int argc,const t_atom *argv) const { outlet *o = GetOut(n); if(o) { CRITON(); outlet_list((t_outlet *)o,const_cast<t_symbol *>(sym_list),argc,(t_atom *)argv); CRITOFF(); } } + void ToSysList(int n,const AtomList &list) const { ToSysList(n,list.Count(),list.Atoms()); } void ToSysAnything(int n,const t_symbol *s,int argc,const t_atom *argv) const { outlet *o = GetOut(n); if(o) { CRITON(); outlet_anything((t_outlet *)o,const_cast<t_symbol *>(s),argc,(t_atom *)argv); CRITOFF(); } } + void ToSysAnything(int n,const AtomAnything &any) const { ToSysAnything(n,any.Header(),any.Count(),any.Atoms()); } + void ToSysAnything(int n,const t_symbol *s,const AtomList &list) const { ToSysAnything(n,s,list.Count(),list.Atoms()); } void ToSysBool(int n,bool f) const { ToSysInt(n,f?1:0); } void ToSysAtom(int n,const t_atom &at) const; diff --git a/externals/grill/flext/source/flcontainers.h b/externals/grill/flext/source/flcontainers.h index 43ea03ed..2b33c4e5 100644 --- a/externals/grill/flext/source/flcontainers.h +++ b/externals/grill/flext/source/flcontainers.h @@ -1,473 +1,473 @@ -/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2006 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.
-
-*/
-
-/*! \file flcontainers.h
- \brief Lock-free container classes
-
- This code has been adapted from the MidiShare project (c)Grame
- http://midishare.sourceforge.net
-*/
-
-#ifndef __FLCONTAINERS_H
-#define __FLCONTAINERS_H
-
-
-#include "flprefix.h"
-
-
-// define that precautiously...
-// it's faster without that but we can't really know...
-#define __SMP__
-
-
-class FLEXT_SHARE Lifo
-{
-public:
- class Cell
- {
- friend class Lifo;
- friend class Fifo;
- private:
- Cell *link;
- };
-
- inline Lifo() { Init(); }
-
- inline void Init() { ic = oc = 0; top = NULL; }
-
- inline Cell *Avail() { return (Cell *)top; }
-
-#if defined(_MSC_VER) && FLEXT_CPU == FLEXT_CPU_IA32
- #ifdef __SMP__
- #define LOCK lock
- #else
- #define LOCK
- #endif
-
- inline void Push(Cell *cell)
- {
- __asm
- {
- push eax
- push ebx
- push ecx
- push edx
- push esi
- mov esi, this
- mov eax, dword ptr [esi]
- mov ecx, cell
- mov edx, dword ptr [esi+4]
- _loop:
- mov ebx, eax
- inc ebx
- mov [ecx], edx
- LOCK cmpxchg8b qword ptr [esi]
- jnz _loop
- pop esi
- pop edx
- pop ecx
- pop ebx
- pop eax
- }
- }
-
- inline Cell *Pop()
- {
- __asm
- {
- push ebx
- push ecx
- push edx
- push esi
- mov esi, this
- add esi, 4 /* point to top */
- mov edx, dword ptr [esi+4]
- mov eax, dword ptr [esi]
- test eax, eax
- jz _end
- _loop:
- mov ebx, dword ptr [eax]
- mov ecx, edx
- inc ecx
- LOCK cmpxchg8b qword ptr [esi]
- jz _end
- test eax, eax
- jnz _loop
- _end:
- pop esi
- pop edx
- pop ecx
- pop ebx
- }
- }
-
- inline size_t Size() const { return ic-oc; }
-#elif defined(__GNUC__) && FLEXT_CPU == FLEXT_CPU_IA32
- #ifndef SMPLOCK
- # ifdef __SMP__
- # define SMPLOCK "lock ; "
- # else
- # define SMPLOCK ""
- # endif
- #endif
-
- inline void Push(Cell *cl)
- {
- __asm__ __volatile__ (
- "# LFPUSH \n\t"
- "pushl %%ebx \n\t"
- "pushl %%ecx \n\t"
- "movl 0(%%esi), %%eax \n\t"
- "movl 4(%%esi), %%edx \n"
- "1: \t"
- "movl %%eax, %%ebx \n\t"
- "incl %%ebx \n\t"
- "movl %%edx, (%%ecx) \n\t"
- SMPLOCK "cmpxchg8b (%%esi) \n\t"
- "jnz 1b \n\t"
- "popl %%ecx \n\t"
- "popl %%ebx \n\t"
- :/* no output */
- :"S" (this), "c" (cl)
- :"memory", "eax", "edx");
- }
-
- inline Cell *Pop()
- {
- Cell *v=0;
- __asm__ __volatile__ (
- "# LFPOP \n\t"
- "pushl %%ebx \n\t"
- "pushl %%ecx \n\t"
- "movl 4(%%esi), %%edx \n\t"
- "movl (%%esi), %%eax \n\t"
- "testl %%eax, %%eax \n\t"
- "jz 2f \n"
- "1: \t"
- "movl (%%eax), %%ebx \n\t"
- "movl %%edx, %%ecx \n\t"
- "incl %%ecx \n\t"
- SMPLOCK "cmpxchg8b (%%esi) \n\t"
- "jz 2f \n\t"
- "testl %%eax, %%eax \n\t"
- "jnz 1b \n"
- "2: \t"
- "popl %%ecx \n\t"
- "popl %%ebx \n\t"
- :"=a" (v)
- :"S" (&this->top)
- :"memory", "edx");
- return v;
- }
-
- inline size_t Size() const
- {
- size_t n;
- __asm__ __volatile__ (
- "# LFSIZE \n\t"
- "movl 8(%%esi), %%edx \n\t"
- "movl (%%esi), %%eax \n\t"
- "subl %%edx, %%eax \n\t"
- :"=a" (n)
- :"S" (this)
- :"memory", "edx");
- return n;
- }
-#elif 0 //defined(__GNUC__) && FLEXT_CPU == FLEXT_CPU_X86_64
-/* attention - this only works for EMT64 or newer revisions of AMD 64-bit cpus */
- #ifndef SMPLOCK
- # ifdef __SMP__
- # define SMPLOCK "lock ; "
- # else
- # define SMPLOCK ""
- # endif
- #endif
-
- inline void Push(Cell *cl)
- {
- __asm__ __volatile__ (
- "# LFPUSH \n\t"
- "push %%rbx \n\t"
- "push %%rcx \n\t"
- "mov 0(%%rsi), %%rax \n\t"
- "mov 8(%%rsi), %%rdx \n"
- "1: \t"
- "mov %%rax, %%rbx \n\t"
- "inc %%rbx \n\t"
- "mov %%rdx, (%%rcx) \n\t"
- SMPLOCK "cmpxchg16b (%%rsi) \n\t"
- "jnz 1b \n\t"
- "pop %%rcx \n\t"
- "pop %%rbx \n\t"
- :/* no output */
- :"S" (this), "c" (cl)
- :"memory", "rax", "rdx");
- }
-
- inline Cell *Pop()
- {
- Cell *v=0;
- __asm__ __volatile__ (
- "# LFPOP \n\t"
- "push %%rbx \n\t"
- "push %%rcx \n\t"
- "mov 8(%%rsi), %%rdx \n\t"
- "mov (%%rsi), %%rax \n\t"
- "test %%rax, %%rax \n\t"
- "jz 2f \n"
- "1: \t"
- "mov (%%rax), %%rbx \n\t"
- "mov %%rdx, %%rcx \n\t"
- "inc %%rcx \n\t"
- SMPLOCK "cmpxchg16b (%%rsi) \n\t"
- "jz 2f \n\t"
- "test %%rax, %%rax \n\t"
- "jnz 1b \n"
- "2: \t"
- "pop %%rcx \n\t"
- "pop %%rbx \n\t"
- :"=a" (v)
- :"S" (&this->top)
- :"memory", "rdx");
- return v;
- }
-
- inline size_t Size() const
- {
- size_t n;
- __asm__ __volatile__ (
- "# LFSIZE \n\t"
- "mov 16(%%rsi), %%rdx \n\t"
- "mov (%%rsi), %%rax \n\t"
- "sub %%rdx, %%rax \n\t"
- :"=a" (n)
- :"S" (this)
- :"memory", "rdx");
- return n;
- }
-
-#elif defined(__GNUC__) && FLEXT_CPU == FLEXT_CPU_PPC
- inline void Push(register Cell *cl)
- {
- register volatile long t1;
- register long t2=0;
- asm volatile (
- "# LFPUSH \n"
- "0: \n"
- " lwarx %0, %3, %1 \n"
- " stw %0, 0(%2) \n"
- " sync \n"
- " stwcx. %2, %3, %1 \n"
- " bne- 0b \n"
- "0: \n"
- " lwarx %0, %3, %4 \n"
- " addi %0, %0, 1 \n"
- " sync \n"
- " stwcx. %0, %3, %4 \n"
- " bne- 0b \n"
- : "=r" (t1)
- : "r" (&this->top), "r" (cl), "r" (t2), "r" (&this->oc), "0" (t1)
- : "r0" /* prevents using r0 because of the ambiguity of 'addi' coding: */
- /* gcc version 2.95.3 20010315 (release - Linux-Mandrake 8.0 for PPC) */
- /* compiles the instruction "addi 0, 0, n" as li 0, n */
- );
- }
-
- inline Cell *Pop()
- {
- register Cell *result;
- register volatile long a, b;
- register long c=0;
- asm volatile (
- "# LFPOP \n"
- "0: \n"
- " lwarx %4, %1, %2 \n" /* creates a reservation on lf */
- " cmpwi %4, 0 \n" /* test if the lifo is empty */
- " beq- 1f \n"
- " lwz %5, 0(%4) \n" /* next cell in b */
- " sync \n" /* synchronize instructions */
- " stwcx. %5, %1, %2 \n" /* if the reservation is not altered */
- /* modify lifo top */
- " bne- 0b \n" /* otherwise: loop and try again */
- "0: \n"
- " lwarx %5, %1, %3 \n" /* creates a reservation on lf->count */
- " addi %5, %5, -1 \n" /* dec count */
- " sync \n" /* synchronize instructions */
- " stwcx. %5, %1, %3 \n" /* conditionnal store */
- " bne- 0b \n"
- "1: \n"
- " mr %0, %4 \n"
- :"=r" (result), "=r" (c)
- : "r" (&this->top), "r" (&this->oc), "r" (a), "r" (b), "1" (c)
- : "r0" /* prevents using r0 because of the ambiguity of 'addi' coding: */
- /* gcc version 2.95.3 20010315 (release - Linux-Mandrake 8.0 for PPC) */
- /* compiles the instruction "addi 0, 0, n" as li 0, n */
- );
- return result;
- }
-
- inline size_t Size() const { return oc; }
-
-#else
- // no lock free code available for this compiler/platform
-
- inline void Push(Cell *c)
- {
-#ifdef FLEXT_THREADS
- mutex.Lock();
-#endif
- c->link = (Cell *)top;
- top = c;
- ++oc;
-#ifdef FLEXT_THREADS
- mutex.Unlock();
-#endif
- }
-
- inline Cell *Pop()
- {
- if(top) {
- Cell *r;
-#ifdef FLEXT_THREADS
- mutex.Lock();
-#endif
- r = (Cell *)top;
- top = r->link;
- --oc;
-#ifdef FLEXT_THREADS
- mutex.Unlock();
-#endif
- return r;
- }
- else
- return NULL;
- }
-
- inline size_t Size() const { return oc; }
-
-private:
-#ifdef FLEXT_THREADS
- flext::ThrMutex mutex;
-#endif
-
-#endif
-
-private:
- // don't change order!
- volatile size_t ic; // input (push) count
- volatile Cell *top; // top of the stack
- volatile size_t oc; // output (pop) count
-#ifdef __POWERPC__
- size_t unused[5]; // lifo size must be at least 32 bytes
- // to avoid livelock in multiprocessor
-#endif
-};
-
-template <typename T>
-class TypedLifo
- : public Lifo
-{
-public:
- inline T *Avail() { return static_cast<T *>(Lifo::Avail()); }
- inline void Push(T *c) { Lifo::Push(static_cast<T *>(c)); }
- inline T *Pop() { return static_cast<T *>(Lifo::Pop()); }
-};
-
-template <typename T,int M = 2,int O = 1>
-class PooledLifo
- : public TypedLifo<T>
-{
-public:
- inline T *New() { T *n = reuse.Pop(); return n?n:new T; }
- inline size_t Size() const { return TypedLifo<T>::Size(); }
- inline void Free(T *p) { if(reuse.Size() < Size()*M+O) reuse.Push(p); else delete p; }
-private:
- TypedLifo<T> reuse;
-};
-
-
-class FLEXT_SHARE Fifo
-{
-public:
- typedef Lifo::Cell Cell;
-
- void Init() { in.Init(); out.Init(); }
-
- inline size_t Size() const { return in.Size()+out.Size(); }
-
- inline void Put(Cell *cl) { in.Push(cl); }
-
- Cell *Get()
- {
- Cell *v1 = out.Pop();
- if(!v1) {
- v1 = in.Pop();
- if(v1)
- for(Cell *v2; (v2 = in.Pop()) != NULL; v1 = v2)
- out.Push(v1);
- }
- return v1;
- }
-
- Cell *Avail()
- {
- Cell *v1 = out.Avail();
- if(v1)
- return v1;
- else {
- for(Cell *v2; (v2 = in.Pop()) != NULL; )
- out.Push(v2);
- return out.Avail();
- }
- }
-
- Cell *Clear()
- {
- Cell *first = Get();
- if(!first) return NULL;
-
- Cell *next,*cur = first;
- while((next = Get()) != NULL) {
- cur->link = next;
- cur = next;
- }
- cur->link = NULL;
-
- Init();
- return first;
- }
-
- Lifo in,out;
-};
-
-template <typename T>
-class TypedFifo
- : public Fifo
-{
-public:
- inline T *Avail() { return static_cast<T *>(Fifo::Avail()); }
- inline void Put(T *c) { Fifo::Put(static_cast<T *>(c)); }
- inline T *Get() { return static_cast<T *>(Fifo::Get()); }
- inline T *Clear() { return static_cast<T *>(Fifo::Clear()); }
-};
-
-template <typename T,int M = 2,int O = 1>
-class PooledFifo
- : public TypedFifo<T>
-{
-public:
- inline T *New() { T *n = reuse.Pop(); return n?n:new T; }
- inline size_t Size() const { return TypedFifo<T>::Size(); }
- inline void Free(T *p) { if(reuse.Size() < Size()*M+O) reuse.Push(p); else delete p; }
-private:
- TypedLifo<T> reuse;
-};
-
-#endif
+/* + +flext - C++ layer for Max/MSP and pd (pure data) externals + +Copyright (c) 2001-2006 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. + +*/ + +/*! \file flcontainers.h + \brief Lock-free container classes + + This code has been adapted from the MidiShare project (c)Grame + http://midishare.sourceforge.net +*/ + +#ifndef __FLCONTAINERS_H +#define __FLCONTAINERS_H + + +#include "flprefix.h" + + +// define that precautiously... +// it's faster without that but we can't really know... +#define __SMP__ + + +class FLEXT_SHARE Lifo +{ +public: + class Cell + { + friend class Lifo; + friend class Fifo; + private: + Cell *link; + }; + + inline Lifo() { Init(); } + + inline void Init() { ic = oc = 0; top = NULL; } + + inline Cell *Avail() { return (Cell *)top; } + +#if defined(_MSC_VER) && FLEXT_CPU == FLEXT_CPU_IA32 + #ifdef __SMP__ + #define LOCK lock + #else + #define LOCK + #endif + + inline void Push(Cell *cell) + { + __asm + { + push eax + push ebx + push ecx + push edx + push esi + mov esi, this + mov eax, dword ptr [esi] + mov ecx, cell + mov edx, dword ptr [esi+4] + _loop: + mov ebx, eax + inc ebx + mov [ecx], edx + LOCK cmpxchg8b qword ptr [esi] + jnz _loop + pop esi + pop edx + pop ecx + pop ebx + pop eax + } + } + + inline Cell *Pop() + { + __asm + { + push ebx + push ecx + push edx + push esi + mov esi, this + add esi, 4 /* point to top */ + mov edx, dword ptr [esi+4] + mov eax, dword ptr [esi] + test eax, eax + jz _end + _loop: + mov ebx, dword ptr [eax] + mov ecx, edx + inc ecx + LOCK cmpxchg8b qword ptr [esi] + jz _end + test eax, eax + jnz _loop + _end: + pop esi + pop edx + pop ecx + pop ebx + } + } + + inline size_t Size() const { return ic-oc; } +#elif defined(__GNUC__) && FLEXT_CPU == FLEXT_CPU_IA32 + #ifndef SMPLOCK + # ifdef __SMP__ + # define SMPLOCK "lock ; " + # else + # define SMPLOCK "" + # endif + #endif + + inline void Push(Cell *cl) + { + __asm__ __volatile__ ( + "# LFPUSH \n\t" + "pushl %%ebx \n\t" + "pushl %%ecx \n\t" + "movl 0(%%esi), %%eax \n\t" + "movl 4(%%esi), %%edx \n" + "1: \t" + "movl %%eax, %%ebx \n\t" + "incl %%ebx \n\t" + "movl %%edx, (%%ecx) \n\t" + SMPLOCK "cmpxchg8b (%%esi) \n\t" + "jnz 1b \n\t" + "popl %%ecx \n\t" + "popl %%ebx \n\t" + :/* no output */ + :"S" (this), "c" (cl) + :"memory", "eax", "edx"); + } + + inline Cell *Pop() + { + Cell *v=0; + __asm__ __volatile__ ( + "# LFPOP \n\t" + "pushl %%ebx \n\t" + "pushl %%ecx \n\t" + "movl 4(%%esi), %%edx \n\t" + "movl (%%esi), %%eax \n\t" + "testl %%eax, %%eax \n\t" + "jz 2f \n" + "1: \t" + "movl (%%eax), %%ebx \n\t" + "movl %%edx, %%ecx \n\t" + "incl %%ecx \n\t" + SMPLOCK "cmpxchg8b (%%esi) \n\t" + "jz 2f \n\t" + "testl %%eax, %%eax \n\t" + "jnz 1b \n" + "2: \t" + "popl %%ecx \n\t" + "popl %%ebx \n\t" + :"=a" (v) + :"S" (&this->top) + :"memory", "edx"); + return v; + } + + inline size_t Size() const + { + size_t n; + __asm__ __volatile__ ( + "# LFSIZE \n\t" + "movl 8(%%esi), %%edx \n\t" + "movl (%%esi), %%eax \n\t" + "subl %%edx, %%eax \n\t" + :"=a" (n) + :"S" (this) + :"memory", "edx"); + return n; + } +#elif 0 //defined(__GNUC__) && FLEXT_CPU == FLEXT_CPU_X86_64 +/* attention - this only works for EMT64 or newer revisions of AMD 64-bit cpus */ + #ifndef SMPLOCK + # ifdef __SMP__ + # define SMPLOCK "lock ; " + # else + # define SMPLOCK "" + # endif + #endif + + inline void Push(Cell *cl) + { + __asm__ __volatile__ ( + "# LFPUSH \n\t" + "push %%rbx \n\t" + "push %%rcx \n\t" + "mov 0(%%rsi), %%rax \n\t" + "mov 8(%%rsi), %%rdx \n" + "1: \t" + "mov %%rax, %%rbx \n\t" + "inc %%rbx \n\t" + "mov %%rdx, (%%rcx) \n\t" + SMPLOCK "cmpxchg16b (%%rsi) \n\t" + "jnz 1b \n\t" + "pop %%rcx \n\t" + "pop %%rbx \n\t" + :/* no output */ + :"S" (this), "c" (cl) + :"memory", "rax", "rdx"); + } + + inline Cell *Pop() + { + Cell *v=0; + __asm__ __volatile__ ( + "# LFPOP \n\t" + "push %%rbx \n\t" + "push %%rcx \n\t" + "mov 8(%%rsi), %%rdx \n\t" + "mov (%%rsi), %%rax \n\t" + "test %%rax, %%rax \n\t" + "jz 2f \n" + "1: \t" + "mov (%%rax), %%rbx \n\t" + "mov %%rdx, %%rcx \n\t" + "inc %%rcx \n\t" + SMPLOCK "cmpxchg16b (%%rsi) \n\t" + "jz 2f \n\t" + "test %%rax, %%rax \n\t" + "jnz 1b \n" + "2: \t" + "pop %%rcx \n\t" + "pop %%rbx \n\t" + :"=a" (v) + :"S" (&this->top) + :"memory", "rdx"); + return v; + } + + inline size_t Size() const + { + size_t n; + __asm__ __volatile__ ( + "# LFSIZE \n\t" + "mov 16(%%rsi), %%rdx \n\t" + "mov (%%rsi), %%rax \n\t" + "sub %%rdx, %%rax \n\t" + :"=a" (n) + :"S" (this) + :"memory", "rdx"); + return n; + } + +#elif defined(__GNUC__) && FLEXT_CPU == FLEXT_CPU_PPC + inline void Push(register Cell *cl) + { + register volatile long t1; + register long t2=0; + asm volatile ( + "# LFPUSH \n" + "0: \n" + " lwarx %0, %3, %1 \n" + " stw %0, 0(%2) \n" + " sync \n" + " stwcx. %2, %3, %1 \n" + " bne- 0b \n" + "0: \n" + " lwarx %0, %3, %4 \n" + " addi %0, %0, 1 \n" + " sync \n" + " stwcx. %0, %3, %4 \n" + " bne- 0b \n" + : "=r" (t1) + : "r" (&this->top), "r" (cl), "r" (t2), "r" (&this->oc), "0" (t1) + : "r0" /* prevents using r0 because of the ambiguity of 'addi' coding: */ + /* gcc version 2.95.3 20010315 (release - Linux-Mandrake 8.0 for PPC) */ + /* compiles the instruction "addi 0, 0, n" as li 0, n */ + ); + } + + inline Cell *Pop() + { + register Cell *result; + register volatile long a, b; + register long c=0; + asm volatile ( + "# LFPOP \n" + "0: \n" + " lwarx %4, %1, %2 \n" /* creates a reservation on lf */ + " cmpwi %4, 0 \n" /* test if the lifo is empty */ + " beq- 1f \n" + " lwz %5, 0(%4) \n" /* next cell in b */ + " sync \n" /* synchronize instructions */ + " stwcx. %5, %1, %2 \n" /* if the reservation is not altered */ + /* modify lifo top */ + " bne- 0b \n" /* otherwise: loop and try again */ + "0: \n" + " lwarx %5, %1, %3 \n" /* creates a reservation on lf->count */ + " addi %5, %5, -1 \n" /* dec count */ + " sync \n" /* synchronize instructions */ + " stwcx. %5, %1, %3 \n" /* conditionnal store */ + " bne- 0b \n" + "1: \n" + " mr %0, %4 \n" + :"=r" (result), "=r" (c) + : "r" (&this->top), "r" (&this->oc), "r" (a), "r" (b), "1" (c) + : "r0" /* prevents using r0 because of the ambiguity of 'addi' coding: */ + /* gcc version 2.95.3 20010315 (release - Linux-Mandrake 8.0 for PPC) */ + /* compiles the instruction "addi 0, 0, n" as li 0, n */ + ); + return result; + } + + inline size_t Size() const { return oc; } + +#else + // no lock free code available for this compiler/platform + + inline void Push(Cell *c) + { +#ifdef FLEXT_THREADS + mutex.Lock(); +#endif + c->link = (Cell *)top; + top = c; + ++oc; +#ifdef FLEXT_THREADS + mutex.Unlock(); +#endif + } + + inline Cell *Pop() + { + if(top) { + Cell *r; +#ifdef FLEXT_THREADS + mutex.Lock(); +#endif + r = (Cell *)top; + top = r->link; + --oc; +#ifdef FLEXT_THREADS + mutex.Unlock(); +#endif + return r; + } + else + return NULL; + } + + inline size_t Size() const { return oc; } + +private: +#ifdef FLEXT_THREADS + flext::ThrMutex mutex; +#endif + +#endif + +private: + // don't change order! + volatile size_t ic; // input (push) count + volatile Cell *top; // top of the stack + volatile size_t oc; // output (pop) count +#ifdef __POWERPC__ + size_t unused[5]; // lifo size must be at least 32 bytes + // to avoid livelock in multiprocessor +#endif +}; + +template <typename T> +class TypedLifo + : public Lifo +{ +public: + inline T *Avail() { return static_cast<T *>(Lifo::Avail()); } + inline void Push(T *c) { Lifo::Push(static_cast<T *>(c)); } + inline T *Pop() { return static_cast<T *>(Lifo::Pop()); } +}; + +template <typename T,int M = 2,int O = 1> +class PooledLifo + : public TypedLifo<T> +{ +public: + inline T *New() { T *n = reuse.Pop(); return n?n:new T; } + inline size_t Size() const { return TypedLifo<T>::Size(); } + inline void Free(T *p) { if(reuse.Size() < Size()*M+O) reuse.Push(p); else delete p; } +private: + TypedLifo<T> reuse; +}; + + +class FLEXT_SHARE Fifo +{ +public: + typedef Lifo::Cell Cell; + + void Init() { in.Init(); out.Init(); } + + inline size_t Size() const { return in.Size()+out.Size(); } + + inline void Put(Cell *cl) { in.Push(cl); } + + Cell *Get() + { + Cell *v1 = out.Pop(); + if(!v1) { + v1 = in.Pop(); + if(v1) + for(Cell *v2; (v2 = in.Pop()) != NULL; v1 = v2) + out.Push(v1); + } + return v1; + } + + Cell *Avail() + { + Cell *v1 = out.Avail(); + if(v1) + return v1; + else { + for(Cell *v2; (v2 = in.Pop()) != NULL; ) + out.Push(v2); + return out.Avail(); + } + } + + Cell *Clear() + { + Cell *first = Get(); + if(!first) return NULL; + + Cell *next,*cur = first; + while((next = Get()) != NULL) { + cur->link = next; + cur = next; + } + cur->link = NULL; + + Init(); + return first; + } + + Lifo in,out; +}; + +template <typename T> +class TypedFifo + : public Fifo +{ +public: + inline T *Avail() { return static_cast<T *>(Fifo::Avail()); } + inline void Put(T *c) { Fifo::Put(static_cast<T *>(c)); } + inline T *Get() { return static_cast<T *>(Fifo::Get()); } + inline T *Clear() { return static_cast<T *>(Fifo::Clear()); } +}; + +template <typename T,int M = 2,int O = 1> +class PooledFifo + : public TypedFifo<T> +{ +public: + inline T *New() { T *n = reuse.Pop(); return n?n:new T; } + inline size_t Size() const { return TypedFifo<T>::Size(); } + inline void Free(T *p) { if(reuse.Size() < Size()*M+O) reuse.Push(p); else delete p; } +private: + TypedLifo<T> reuse; +}; + +#endif diff --git a/externals/grill/flext/source/fldefs_hdr.h b/externals/grill/flext/source/fldefs_hdr.h index 12b17c79..01bcd477 100644 --- a/externals/grill/flext/source/fldefs_hdr.h +++ b/externals/grill/flext/source/fldefs_hdr.h @@ -32,6 +32,10 @@ WARRANTIES, see the file, "license.txt," in this distribution. \ FLEXT_REALHDR(NEW_CLASS, PARENT_CLASS) +#define FLEXT_HEADER_T(NEW_CLASS,PARENT_CLASS) \ +\ +FLEXT_REALHDR_T(NEW_CLASS, PARENT_CLASS) + /*! \brief Flext class header with setup function \param NEW_CLASS name of the current C++ class \param PARENT_CLASS name of the base C++ class (e.g. flext_base or flext_dsp) @@ -46,6 +50,10 @@ FLEXT_REALHDR(NEW_CLASS, PARENT_CLASS) \ FLEXT_REALHDR_S(NEW_CLASS, PARENT_CLASS, SETUPFUN) +#define FLEXT_HEADER_TS(NEW_CLASS, PARENT_CLASS, SETUPFUN)\ +\ +FLEXT_REALHDR_TS(NEW_CLASS, PARENT_CLASS, SETUPFUN) + //! @} FLEXT_D_HEADER diff --git a/externals/grill/flext/source/flfeatures.h b/externals/grill/flext/source/flfeatures.h index 915f44a9..efb198d0 100644 --- a/externals/grill/flext/source/flfeatures.h +++ b/externals/grill/flext/source/flfeatures.h @@ -1,34 +1,34 @@ -/*
-
-flext - C++ layer for Max/MSP and pd (pure data) externals
-
-Copyright (c) 2001-2005 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.
-
-*/
-
-/*! \file flfeatures.h
- \brief Detect version-specific features.
-*/
-
-#ifndef __FLFEATURES_H
-#define __FLFEATURES_H
-
-// check if PD API supports buffer dirty time
-#if defined(PD_DEVEL_VERSION) && defined(PD_MAJOR_VERSION) && defined(PD_MINOR_VERSION)
-#if PD_MINOR_VERSION >= 36 && PD_MINOR_VERSION <= 38
-// array locks have been removed in devel_0_39
- #define _FLEXT_HAVE_PD_GARRAYLOCKS
-#endif
-#if PD_MINOR_VERSION >= 36
- #define _FLEXT_HAVE_PD_GARRAYUPDATETIME
-#endif
-#endif
-
-#if defined(MAC_VERSION) || defined(WIN_VERSION)
- // not for OS9
- #define _FLEXT_HAVE_MAX_INUSEFLAG
-#endif
-
-#endif
+/* + +flext - C++ layer for Max/MSP and pd (pure data) externals + +Copyright (c) 2001-2005 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. + +*/ + +/*! \file flfeatures.h + \brief Detect version-specific features. +*/ + +#ifndef __FLFEATURES_H +#define __FLFEATURES_H + +// check if PD API supports buffer dirty time +#if defined(PD_DEVEL_VERSION) && defined(PD_MAJOR_VERSION) && defined(PD_MINOR_VERSION) +#if PD_MINOR_VERSION >= 36 && PD_MINOR_VERSION <= 38 +// array locks have been removed in devel_0_39 + #define _FLEXT_HAVE_PD_GARRAYLOCKS +#endif +#if PD_MINOR_VERSION >= 36 + #define _FLEXT_HAVE_PD_GARRAYUPDATETIME +#endif +#endif + +#if defined(MAC_VERSION) || defined(WIN_VERSION) + // not for OS9 + #define _FLEXT_HAVE_MAX_INUSEFLAG +#endif + +#endif diff --git a/externals/grill/flext/source/fllib.cpp b/externals/grill/flext/source/fllib.cpp index ff70da2f..a7b98335 100755 --- a/externals/grill/flext/source/fllib.cpp +++ b/externals/grill/flext/source/fllib.cpp @@ -41,27 +41,31 @@ WARRANTIES, see the file, "license.txt," in this distribution. //! Extract space-delimited words from a string static const char *extract(const char *name,int ix = 0) { - static char tmp[1024]; + char tmp[1024]; const char *n = name; const char *del = strchr(name,ALIASDEL); if(del) { - if(ix < 0) { - char *t = tmp; - while(n < del && (isspace(*n) || strchr(ALIASSLASHES,*n))) ++n; - while(n < del && !isspace(*n)) { - char c = *(n++); - *(t++) = strchr(ALIASSLASHES,c)?ALIASSLASH:c; - } - while(*t == ALIASSLASH && t > tmp) --t; - *t = 0; - - return tmp; +#if 0 + char *t = tmp; + while(n < del && (isspace(*n) || strchr(ALIASSLASHES,*n))) ++n; + while(n < del && !isspace(*n)) { + char c = *(n++); + *(t++) = strchr(ALIASSLASHES,c)?ALIASSLASH:c; } + while(*t == ALIASSLASH && t > tmp) --t; + *t = 0; +#endif + if(ix < 0) + return del+1; - n = del+1; + strncpy(tmp,name,del-name); + tmp[del-name] = 0; + n = tmp; } + else if(ix < 0) + return NULL; // no explicit help name while(*n && isspace(*n)) ++n; @@ -301,7 +305,16 @@ void flext_obj::obj_add(bool lib,bool dsp,bool attr,const char *idname,const cha t_classid clid = lo; // make help reference - flext_obj::DefineHelp(clid,idname,extract(names,-1),dsp); + const char *helptxt = extract(names,-1); + if(helptxt) { + const char *sl = strchr(helptxt,'/'); + if(sl && !sl[1]) + // helptxt is only the path (path with trailing /) + flext_obj::DefineHelp(clid,idname,helptxt,dsp); + else + // helptxt is path and patch name + flext_obj::DefineHelp(clid,helptxt,NULL,dsp); + } for(int ix = 0; ; ++ix) { // in this loop register all the possible aliases of the object diff --git a/externals/grill/flext/source/flsupport.h b/externals/grill/flext/source/flsupport.h index dcc0acc2..f26437df 100644 --- a/externals/grill/flext/source/flsupport.h +++ b/externals/grill/flext/source/flsupport.h @@ -1124,16 +1124,37 @@ public: \remark Since this clock can be synchronized to an external clock (or e.g. the audio card) \remark it may differ from the clock of the operating system */ + /*! \brief Get time since real-time system startup. \note This is not the time of the operating system but of the real-time system. - \note It depends on the time source the system is synchronized to. + \note It may depend on the time source the system is synchronized to (e.g. audio sample rate). */ - static double GetTime(); + static double GetTime() + { + #if FLEXT_SYS == FLEXT_SYS_PD + return clock_gettimesince(0)*0.001; + #elif FLEXT_SYS == FLEXT_SYS_MAX + double tm; + clock_getftime(&tm); + return tm*0.001; + #else + #error Not implemented + #endif + } /*! \brief Get time granularity of the GetTime function. \note This can be zero if not determined. */ - static double GetTimeGrain(); + static double GetTimeGrain() + { + #if FLEXT_SYS == FLEXT_SYS_PD + return 0; + #elif FLEXT_SYS == FLEXT_SYS_MAX + return 0.001; + #else + #error Not implemented + #endif + } /*! \brief Get operating system time since flext startup. */ diff --git a/externals/grill/flext/source/fltimer.cpp b/externals/grill/flext/source/fltimer.cpp index d9bf3cc1..6f13999f 100755 --- a/externals/grill/flext/source/fltimer.cpp +++ b/externals/grill/flext/source/fltimer.cpp @@ -25,31 +25,6 @@ WARRANTIES, see the file, "license.txt," in this distribution. #endif - -double flext::GetTime() -{ -#if FLEXT_SYS == FLEXT_SYS_PD - return clock_gettimesince(0)*0.001; -#elif FLEXT_SYS == FLEXT_SYS_MAX - double tm; - clock_getftime(&tm); - return tm*0.001; -#else - #error Not implemented -#endif -} - -double flext::GetTimeGrain() -{ -#if FLEXT_SYS == FLEXT_SYS_PD - return 0; -#elif FLEXT_SYS == FLEXT_SYS_MAX - return 0.001; -#else - #error Not implemented -#endif -} - #if FLEXT_OS == FLEXT_OS_WIN static double perffrq = 0; #endif @@ -246,9 +221,9 @@ bool flext::Timer::Delay(double tm,void *data) bool flext::Timer::Periodic(double tm,void *data) { userdata = data; - period = tm; + period = tm; #if FLEXT_SYS == FLEXT_SYS_PD - clock_delay(clk,tm*1000); + clock_delay(clk,tm*1000.); #elif FLEXT_SYS == FLEXT_SYS_MAX clock_fdelay(clk,tm*1000.); #else @@ -257,29 +232,26 @@ bool flext::Timer::Periodic(double tm,void *data) return true; } -/*! \brief Callback function for system clock. - \todo Make periodic events scheduled as such. -*/ +//! \brief Callback function for system clock. void flext::Timer::callback(Timer *tmr) { +#if FLEXT_SYS == FLEXT_SYS_MAX + if(tmr->queued) + qelem_set(tmr->qelem); + else +#endif + tmr->Work(); + if(tmr->period) { - // clearly it would be more precise if the periodic event is scheduled as such - // and not retriggered every time + // reschedule #if FLEXT_SYS == FLEXT_SYS_PD - clock_delay(tmr->clk,tmr->period*1000); + clock_delay(tmr->clk,tmr->period*1000.); #elif FLEXT_SYS == FLEXT_SYS_MAX clock_fdelay(tmr->clk,tmr->period*1000.); #else #error Not implemented #endif } - -#if FLEXT_SYS == FLEXT_SYS_MAX - if(tmr->queued) - qelem_set(tmr->qelem); - else -#endif - tmr->Work(); } #if FLEXT_SYS == FLEXT_SYS_MAX |