aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--externals/grill/flext/buildsys/win/gnumake-mingw.inc2
-rw-r--r--externals/grill/flext/buildsys/win/max/gnumake-mingw.inc2
-rw-r--r--externals/grill/flext/buildsys/win/max/nmake-msvc.inc2
-rw-r--r--externals/grill/flext/buildsys/win/pd/bmake-bcc.inc6
-rw-r--r--externals/grill/flext/buildsys/win/pd/config-bcc.def3
-rw-r--r--externals/grill/flext/buildsys/win/pd/config-mingw.def3
-rw-r--r--externals/grill/flext/buildsys/win/pd/config-msvc.def3
-rw-r--r--externals/grill/flext/buildsys/win/pd/gnumake-mingw.inc6
-rw-r--r--externals/grill/flext/buildsys/win/pd/nmake-msvc.inc6
-rw-r--r--externals/grill/flext/changes.txt3
-rw-r--r--externals/grill/flext/flext.doxy26
-rw-r--r--externals/grill/flext/flext.vcproj4
-rw-r--r--externals/grill/flext/source/flattr.cpp9
-rw-r--r--externals/grill/flext/source/flattr_ed.cpp26
-rw-r--r--externals/grill/flext/source/flbase.cpp9
-rw-r--r--externals/grill/flext/source/flbase.h63
-rw-r--r--externals/grill/flext/source/flclass.h158
-rw-r--r--externals/grill/flext/source/fldsp.cpp4
-rw-r--r--externals/grill/flext/source/fldsp.h8
-rw-r--r--externals/grill/flext/source/flext.cpp27
-rw-r--r--externals/grill/flext/source/flext.h9
-rwxr-xr-xexternals/grill/flext/source/flitem.cpp4
-rwxr-xr-xexternals/grill/flext/source/fllib.cpp63
-rw-r--r--externals/grill/flext/source/flmap.cpp60
-rw-r--r--externals/grill/flext/source/flmap.h6
-rwxr-xr-xexternals/grill/flext/source/flmeth.cpp3
-rwxr-xr-xexternals/grill/flext/source/flmsg.cpp7
-rw-r--r--externals/grill/flext/source/flout.cpp275
-rwxr-xr-xexternals/grill/flext/source/fltimer.cpp70
-rwxr-xr-xexternals/grill/flext/source/flxlet.cpp86
30 files changed, 463 insertions, 490 deletions
diff --git a/externals/grill/flext/buildsys/win/gnumake-mingw.inc b/externals/grill/flext/buildsys/win/gnumake-mingw.inc
index 43884e15..063bc058 100644
--- a/externals/grill/flext/buildsys/win/gnumake-mingw.inc
+++ b/externals/grill/flext/buildsys/win/gnumake-mingw.inc
@@ -6,7 +6,7 @@ TARGET=$(TARGETPATH)\$(OUTNAME).$(EXT)
##############################################
-CFLAGS +=
+CFLAGS += -mms-bitfields
LDFLAGS += -shared
##############################################
diff --git a/externals/grill/flext/buildsys/win/max/gnumake-mingw.inc b/externals/grill/flext/buildsys/win/max/gnumake-mingw.inc
index cf5dc17a..6d4e46f7 100644
--- a/externals/grill/flext/buildsys/win/max/gnumake-mingw.inc
+++ b/externals/grill/flext/buildsys/win/max/gnumake-mingw.inc
@@ -1,5 +1,5 @@
DEFS += -DFLEXT_SYS=1
-CFLAGS += -fpack-struct=2
+CFLAGS += -fpack-struct=2 -D_WIN32_WINNT=0x501
INCPATH += -I$(MAXSDKPATH)/max-includes -I$(MAXSDKPATH)/msp-includes
LIBPATH += -L$(MAXSDKPATH)/max-includes -L$(MAXSDKPATH)/msp-includes
diff --git a/externals/grill/flext/buildsys/win/max/nmake-msvc.inc b/externals/grill/flext/buildsys/win/max/nmake-msvc.inc
index 02cf3cf5..94cdc32e 100644
--- a/externals/grill/flext/buildsys/win/max/nmake-msvc.inc
+++ b/externals/grill/flext/buildsys/win/max/nmake-msvc.inc
@@ -1,5 +1,5 @@
DEFS=$(DEFS) /DFLEXT_SYS=1
-CFLAGS=$(CFLAGS) /Zp2
+CFLAGS=$(CFLAGS) /Zp2 /D_WIN32_WINNT=0x501
INCPATH=$(INCPATH) /I$(MAXSDKPATH)\max-includes /I$(MAXSDKPATH)\msp-includes
LIBPATH=$(LIBPATH) /LIBPATH:$(MAXSDKPATH)\max-includes /LIBPATH:$(MAXSDKPATH)\msp-includes
diff --git a/externals/grill/flext/buildsys/win/pd/bmake-bcc.inc b/externals/grill/flext/buildsys/win/pd/bmake-bcc.inc
index 3b257b0d..c24b7723 100644
--- a/externals/grill/flext/buildsys/win/pd/bmake-bcc.inc
+++ b/externals/grill/flext/buildsys/win/pd/bmake-bcc.inc
@@ -1,5 +1,11 @@
DEFS=$(DEFS) /DFLEXT_SYS=2
+!ifdef WINNT
+DEFS=$(DEFS) /D_WIN32_WINNT=0x500
+!endif
+
+##############################################
+
INCPATH=$(INCPATH) -I$(PDPATH)\src
# these are both in FLEXTPATH
diff --git a/externals/grill/flext/buildsys/win/pd/config-bcc.def b/externals/grill/flext/buildsys/win/pd/config-bcc.def
index e9d97eb8..54e8397d 100644
--- a/externals/grill/flext/buildsys/win/pd/config-bcc.def
+++ b/externals/grill/flext/buildsys/win/pd/config-bcc.def
@@ -33,3 +33,6 @@ UFLAGS=
# user defined optimization flags
# (check if they match your system!)
OFLAGS=-6 -O2 -OS -ff -d
+
+# comment if you want to compile for Windows 95/98/ME
+WINNT=1
diff --git a/externals/grill/flext/buildsys/win/pd/config-mingw.def b/externals/grill/flext/buildsys/win/pd/config-mingw.def
index a4ae2f2a..bed53e35 100644
--- a/externals/grill/flext/buildsys/win/pd/config-mingw.def
+++ b/externals/grill/flext/buildsys/win/pd/config-mingw.def
@@ -32,3 +32,6 @@ UFLAGS=-msse -mfpmath=sse -ffast-math
OFLAGS=-O3
# optimizations for Pentium 4
OFLAGS+=-march=pentium4
+
+# comment if you want to compile for Windows 95/98/ME
+WINNT=1
diff --git a/externals/grill/flext/buildsys/win/pd/config-msvc.def b/externals/grill/flext/buildsys/win/pd/config-msvc.def
index 9db081e4..49137ef5 100644
--- a/externals/grill/flext/buildsys/win/pd/config-msvc.def
+++ b/externals/grill/flext/buildsys/win/pd/config-msvc.def
@@ -38,6 +38,9 @@ OFLAGS=/Ox
# optimizations for Pentium 4
OFLAGS=$(OFLAGS) /G6 /arch:SSE
+# comment if you want to compile for Windows 95/98/ME
+WINNT=1
+
# uncomment to link against dynamic C runtime libraries
# (don't use this if you want to distribute the built product)
#DYNAMIC=1
diff --git a/externals/grill/flext/buildsys/win/pd/gnumake-mingw.inc b/externals/grill/flext/buildsys/win/pd/gnumake-mingw.inc
index 1002a914..a3f51aab 100644
--- a/externals/grill/flext/buildsys/win/pd/gnumake-mingw.inc
+++ b/externals/grill/flext/buildsys/win/pd/gnumake-mingw.inc
@@ -1,5 +1,11 @@
DEFS += -DFLEXT_SYS=2
+ifdef WINNT
+CFLAGS += -D_WIN32_WINNT=0x500
+endif
+
+##############################################
+
INCPATH += -I$(PDPATH)/src
LIBPATH += -L$(PDPATH)/bin
diff --git a/externals/grill/flext/buildsys/win/pd/nmake-msvc.inc b/externals/grill/flext/buildsys/win/pd/nmake-msvc.inc
index 75a99d4b..cbe3c5bc 100644
--- a/externals/grill/flext/buildsys/win/pd/nmake-msvc.inc
+++ b/externals/grill/flext/buildsys/win/pd/nmake-msvc.inc
@@ -1,5 +1,11 @@
DEFS=$(DEFS) /DFLEXT_SYS=2
+!ifdef WINNT
+DEFS=$(DEFS) /D_WIN32_WINNT=0x500
+!endif
+
+##############################################
+
INCPATH=$(INCPATH) /I$(PDPATH)\src
LIBPATH=$(LIBPATH) /LIBPATH:$(PDPATH)\bin
diff --git a/externals/grill/flext/changes.txt b/externals/grill/flext/changes.txt
index afcb018c..51057875 100644
--- a/externals/grill/flext/changes.txt
+++ b/externals/grill/flext/changes.txt
@@ -37,6 +37,9 @@ Version history:
- eliminated default "help" (m_help) method... should be implemented in the flext-based object
- changed virtual callback names m_loadbang, m_method_, m_dsp, m_signal, m_click to CbLoadbang, CbMethodResort, CbDsp, CbSignal, CbClick
- replaced memory-intensive STL maps by custom-made vector/map-monster (should be fast!)
+- fixed bug for symbol messages into non-left inlets
+- better timers for Windows
+- slimmed down object data structures and changed initialization code accordingly
0.4.7:
- added flext::GetBool (just because flext::GetInt has been there for a while)
diff --git a/externals/grill/flext/flext.doxy b/externals/grill/flext/flext.doxy
index 031f95cf..bd564300 100644
--- a/externals/grill/flext/flext.doxy
+++ b/externals/grill/flext/flext.doxy
@@ -1,4 +1,4 @@
-# Doxyfile 1.3.5
+# Doxyfile 1.4.3
#---------------------------------------------------------------------------
# Project related configuration options
@@ -6,6 +6,7 @@
PROJECT_NAME = flext
PROJECT_NUMBER = "version 0.5.0"
OUTPUT_DIRECTORY = c:/data/pdmax/flext/doc/
+CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
USE_WINDOWS_ENCODING = YES
BRIEF_MEMBER_DESC = YES
@@ -15,12 +16,14 @@ ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = NO
STRIP_FROM_PATH =
+STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = YES
INHERIT_DOCS = YES
DISTRIBUTE_GROUP_DOC = NO
+SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 8
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = YES
@@ -32,7 +35,8 @@ SUBGROUPING = YES
EXTRACT_ALL = NO
EXTRACT_PRIVATE = NO
EXTRACT_STATIC = NO
-EXTRACT_LOCAL_CLASSES = YES
+EXTRACT_LOCAL_CLASSES = NO
+EXTRACT_LOCAL_METHODS = NO
HIDE_UNDOC_MEMBERS = YES
HIDE_UNDOC_CLASSES = YES
HIDE_FRIEND_COMPOUNDS = NO
@@ -43,6 +47,8 @@ HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
+SORT_BRIEF_DOCS = NO
+SORT_BY_SCOPE_NAME = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
@@ -50,6 +56,8 @@ GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
+SHOW_DIRECTORIES = YES
+FILE_VERSION_FILTER =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
@@ -57,13 +65,15 @@ QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = NO
WARN_IF_DOC_ERROR = YES
+WARN_NO_PARAMDOC = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = c:/data/pdmax/flext/source/
-FILE_PATTERNS =
+FILE_PATTERNS = *.cpp \
+ *.h
RECURSIVE = NO
EXCLUDE =
EXCLUDE_SYMLINKS = NO
@@ -73,6 +83,7 @@ EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
+FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
@@ -82,6 +93,7 @@ INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
+USE_HTAGS = NO
VERBATIM_HEADERS = NO
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
@@ -177,7 +189,7 @@ PREDEFINED = FLEXT_THREADS \
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
-# Configuration::addtions related to external references
+# Configuration::additions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
@@ -192,21 +204,25 @@ HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = NO
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
+GROUP_GRAPHS = YES
UML_LOOK = NO
TEMPLATE_RELATIONS = YES
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
+DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = png
DOT_PATH =
DOTFILE_DIRS =
MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1024
MAX_DOT_GRAPH_DEPTH = 0
+DOT_TRANSPARENT = NO
+DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
-# Configuration::addtions related to the search engine
+# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO
diff --git a/externals/grill/flext/flext.vcproj b/externals/grill/flext/flext.vcproj
index 46b42f75..bf4a298c 100644
--- a/externals/grill/flext/flext.vcproj
+++ b/externals/grill/flext/flext.vcproj
@@ -172,7 +172,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="c:\programme\audio\pd\src;c:\data\prog\audio\sndobj\include;c:\data\prog\audio\stk\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB;FLEXT_SYS=2;FLEXT_USE_SIMD;FLEXT_EXPORTS;FLEXT_DEBUGMEM"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB;FLEXT_SYS=2;FLEXT_USE_SIMD;FLEXT_EXPORTS;FLEXT_DEBUGMEM;_WIN32_WINNT=0x400"
StringPooling="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@@ -275,7 +275,7 @@
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="c:\programme\audio\pd\src;c:\data\prog\audio\sndobj\include;c:\data\prog\audio\stk\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB;FLEXT_SYS=2;FLEXT_USE_SIMD;FLEXT_EXPORTS"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB;FLEXT_SYS=2;FLEXT_USE_SIMD;FLEXT_EXPORTS;_WIN32_WINNT=0x400"
StringPooling="TRUE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
diff --git a/externals/grill/flext/source/flattr.cpp b/externals/grill/flext/source/flattr.cpp
index 1ae55ec4..57b2a919 100644
--- a/externals/grill/flext/source/flattr.cpp
+++ b/externals/grill/flext/source/flattr.cpp
@@ -97,7 +97,7 @@ void flext_base::AddAttrib(ItemCont *aa,ItemCont *ma,const t_symbol *asym,methar
void flext_base::AddAttrib(const t_symbol *attr,metharg tp,methfun gfun,methfun sfun)
{
- if(procattr)
+ if(HasAttributes())
AddAttrib(ThAttrs(),ThMeths(),attr,tp,gfun,sfun);
else
error("%s - attribute procession is not enabled!",thisName());
@@ -112,6 +112,7 @@ void flext_base::ListAttrib(AtomList &la) const
{
typedef TablePtrMap<int,const t_symbol *,32> AttrList;
AttrList list[2];
+ ItemCont *clattrhead = ClAttrs(thisClassId());
int i;
for(i = 0; i <= 1; ++i) {
@@ -191,7 +192,7 @@ bool flext_base::InitAttrib(int argc,const t_atom *argv)
bool flext_base::ListAttrib() const
{
- if(procattr) {
+ if(HasAttributes()) {
// defined in flsupport.cpp
extern const t_symbol *sym_attributes;
@@ -206,6 +207,8 @@ bool flext_base::ListAttrib() const
flext_base::AttrItem *flext_base::FindAttrib(const t_symbol *tag,bool get,bool msg) const
{
+ ItemCont *clattrhead = ClAttrs(thisClassId());
+
// first search within object scope
AttrItem *a = NULL;
{
@@ -401,6 +404,8 @@ bool flext_base::BangAttrib(const t_symbol *attr)
bool flext_base::BangAttribAll()
{
+ ItemCont *clattrhead = ClAttrs(thisClassId());
+
for(int i = 0; i <= 1; ++i) {
ItemCont *a = i?attrhead:clattrhead;
if(a) {
diff --git a/externals/grill/flext/source/flattr_ed.cpp b/externals/grill/flext/source/flattr_ed.cpp
index e499b9d7..be3f19c6 100644
--- a/externals/grill/flext/source/flattr_ed.cpp
+++ b/externals/grill/flext/source/flattr_ed.cpp
@@ -41,16 +41,17 @@ static t_widgetbehavior widgetbehavior;
void flext_base::SetGfx(t_classid c)
{
+ t_class *cl = getClass(c);
// widgetbehavior struct MUST be resident... (static is just ok here)
#ifndef FLEXT_CLONEWIDGET
- widgetbehavior.w_visfn = c->c_wb->w_visfn;
- widgetbehavior.w_selectfn = c->c_wb->w_selectfn;
- widgetbehavior.w_getrectfn = c->c_wb->w_getrectfn;
- widgetbehavior.w_displacefn = c->c_wb->w_displacefn;
- widgetbehavior.w_activatefn = c->c_wb->w_activatefn;
- widgetbehavior.w_deletefn = c->c_wb->w_deletefn;
- widgetbehavior.w_selectfn = c->c_wb->w_selectfn;
+ widgetbehavior.w_visfn = cl->c_wb->w_visfn;
+ widgetbehavior.w_selectfn = cl->c_wb->w_selectfn;
+ widgetbehavior.w_getrectfn = cl->c_wb->w_getrectfn;
+ widgetbehavior.w_displacefn = cl->c_wb->w_displacefn;
+ widgetbehavior.w_activatefn = cl->c_wb->w_activatefn;
+ widgetbehavior.w_deletefn = cl->c_wb->w_deletefn;
+ widgetbehavior.w_selectfn = cl->c_wb->w_selectfn;
#else
widgetbehavior.w_visfn = text_widgetbehavior.w_visfn;
widgetbehavior.w_selectfn = text_widgetbehavior.w_selectfn;
@@ -66,7 +67,7 @@ void flext_base::SetGfx(t_classid c)
#endif // FLEXT_NOATTREDIT
widgetbehavior.w_clickfn = cb_click;
- class_setwidget(c, &widgetbehavior);
+ class_setwidget(cl, &widgetbehavior);
}
@@ -446,17 +447,18 @@ static void tclscript()
void flext_base::attrsetup(t_classid c)
{
+ t_class *cl = getClass(c);
#ifndef FLEXT_CLONEWIDGET
- ori_vis = c->c_wb->w_visfn;
- ori_select = c->c_wb->w_selectfn;
+ ori_vis = cl->c_wb->w_visfn;
+ ori_select = cl->c_wb->w_selectfn;
#endif
widgetbehavior.w_visfn = cb_GfxVis;
widgetbehavior.w_selectfn = cb_GfxSelect;
#if PD_MINOR_VERSION >= 37
- class_setpropertiesfn(c,cb_GfxProperties);
- class_setsavefn(c,cb_GfxSave);
+ class_setpropertiesfn(cl,cb_GfxProperties);
+ class_setsavefn(cl,cb_GfxSave);
#else
widgetbehavior.w_propertiesfn = cb_GfxProperties;
widgetbehavior.w_savefn = cb_GfxSave;
diff --git a/externals/grill/flext/source/flbase.cpp b/externals/grill/flext/source/flbase.cpp
index a4ec0d1c..2fd3fc97 100644
--- a/externals/grill/flext/source/flbase.cpp
+++ b/externals/grill/flext/source/flbase.cpp
@@ -40,13 +40,14 @@ WARRANTIES, see the file, "license.txt," in this distribution.
flext_hdr *flext_obj::m_holder = NULL;
const t_symbol *flext_obj::m_holdname = NULL;
-bool flext_obj::m_holdattr = false;
+flext_class *flext_obj::m_holdclass = NULL;
int flext_obj::m_holdaargc = 0;
const t_atom *flext_obj::m_holdaargv = NULL;
bool flext_obj::process_attributes = false;
bool flext_obj::initing = false;
bool flext_obj::exiting = false;
+bool flext_obj::init_ok;
void flext_obj::ProcessAttributes(bool attr) { process_attributes = attr; }
@@ -56,8 +57,7 @@ void flext_obj::ProcessAttributes(bool attr) { process_attributes = attr; }
/////////////////////////////////////////////////////////
flext_obj :: FLEXT_CLASSDEF(flext_obj)()
: x_obj(m_holder)
- , procattr(m_holdattr)
- , init_ok(true)
+ , clss(m_holdclass)
, m_name(m_holdname)
{
#if FLEXT_SYS == FLEXT_SYS_PD
@@ -72,7 +72,8 @@ flext_obj :: FLEXT_CLASSDEF(flext_obj)()
// Destructor
//
/////////////////////////////////////////////////////////
-flext_obj :: ~FLEXT_CLASSDEF(flext_obj)() {
+flext_obj :: ~FLEXT_CLASSDEF(flext_obj)()
+{
x_obj = NULL;
}
diff --git a/externals/grill/flext/source/flbase.h b/externals/grill/flext/source/flbase.h
index 7cf0d8cc..b487a63e 100644
--- a/externals/grill/flext/source/flbase.h
+++ b/externals/grill/flext/source/flbase.h
@@ -64,6 +64,8 @@ struct FLEXT_SHARE flext_hdr
};
+class flext_class;
+
// ----------------------------------------------------------------------------
/*! \brief The mother of base classes for all flext external objects
@@ -110,7 +112,7 @@ class FLEXT_SHARE FLEXT_CLASSDEF(flext_obj):
/*! \brief Signal a construction problem
\note This should only be used in the constructor. Object creation will be aborted.
*/
- void InitProblem() { init_ok = false; }
+ static void InitProblem() { init_ok = false; }
/*! \brief Enable/disable attribute procession (default = false)
\note Use that in the static class setup function (also library setup function)
@@ -145,34 +147,19 @@ class FLEXT_SHARE FLEXT_CLASSDEF(flext_obj):
const char *thisName() const { return GetString(m_name); }
//! Get the class name (as a symbol)
const t_symbol *thisNameSym() const { return m_name; }
-
-
//! Get the class pointer
-#if FLEXT_SYS == FLEXT_SYS_PD
- t_class *thisClass() const { FLEXT_ASSERT(x_obj); return (t_class *)((t_object *)(x_obj))->te_g.g_pd; }
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- t_class *thisClass() const { FLEXT_ASSERT(x_obj); return (t_class *)(((t_tinyobject *)x_obj)->t_messlist-1); }
-#elif FLEXT_SYS == FLEXT_SYS_JMAX
- t_class *thisClass() const { return fts_object_get_class((fts_object_t *)thisHdr()); }
-#else
-#error
-#endif
-
-#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_JMAX
+ t_class *thisClass() const;
+
//! Typedef for unique class identifier
- typedef t_class *t_classid;
+ typedef flext_class *t_classid;
+
//! Get unique id for object class
- t_classid thisClassId() const { return thisClass(); }
- //! Get class pointer from class id
- static t_class *getClass(t_classid c) { return c; }
-#else
- //! Typedef for unique class identifier
- typedef void *t_classid;
- //! Get unique id for object class (for Max/MSP library object share the same (t_class *)!)
- t_classid thisClassId() const;
+ t_classid thisClassId() const { return clss; }
+
//! Get class pointer from class id
static t_class *getClass(t_classid);
-#endif
+
+ bool HasAttributes() const;
//! @} FLEXT_O_INFO
@@ -202,14 +189,14 @@ class FLEXT_SHARE FLEXT_CLASSDEF(flext_obj):
*/
protected:
-
- //! The object header
- mutable flext_hdr *x_obj;
- //! Flag for attribute procession
- bool procattr;
+ //! pointer to flext class definition
+ flext_class *clss;
+
+ //! backpointer to object header
+ mutable flext_hdr *x_obj;
- static bool process_attributes;
+ static bool process_attributes;
private:
@@ -217,7 +204,7 @@ class FLEXT_SHARE FLEXT_CLASSDEF(flext_obj):
mutable t_canvas *m_canvas;
//! Flag for successful object construction
- bool init_ok;
+ static bool init_ok;
// flags for init and exit procedure;
static bool initing;
@@ -232,20 +219,20 @@ class FLEXT_SHARE FLEXT_CLASSDEF(flext_obj):
\warning don't touch it!
*/
static flext_hdr *m_holder;
+ //! Hold object's class during construction
+ static flext_class *m_holdclass;
//! Hold object's name during construction
static const t_symbol *m_holdname;
//! Holders for attribute procession flag
- static bool m_holdattr;
static int m_holdaargc;
static const t_atom *m_holdaargv;
- //! The object's name in the patcher
+ /*! The object's name in the patcher
+ \note objects of the same class can have various alias names!
+ */
const t_symbol *m_name;
- //! Check whether construction was successful
- bool InitOk() const { return init_ok; }
-
/*! Return true if in object initialization phase
true when in constructor or Init, false when in Finalize
*/
@@ -575,7 +562,3 @@ FLEXT_OBJ_SETUP(NEW_CLASS,DSP,LIB)
#endif
-
-
-
-
diff --git a/externals/grill/flext/source/flclass.h b/externals/grill/flext/source/flclass.h
index bebd045f..e1e871ed 100644
--- a/externals/grill/flext/source/flclass.h
+++ b/externals/grill/flext/source/flclass.h
@@ -60,9 +60,6 @@ class FLEXT_SHARE FLEXT_CLASSDEF(flext_base):
friend class FLEXT_SHARE FLEXT_CLASSDEF(flext_obj);
- /*! \defgroup FLEXT_CLASS Flext base class
- @{
- */
public:
/*! \defgroup FLEXT_C_BASE Basic class functionality
@@ -121,61 +118,61 @@ public:
// argument m specifies multiple inlet/outlet count
-// void AddInDef() { AddInlet(xlet::tp_def,1); }
+// void AddInDef() { AddInlet(xlet_def,1); }
/*! \brief Add inlet(s) for anythings
\remark That's the one to choose for the left-most (first) inlet unless it's a signal inlet.
*/
- void AddInAnything(int m = 1) { AddInlet(xlet::tp_any,m); }
+ void AddInAnything(int m = 1) { AddInlet(xlet_any,m); }
/*! \brief Add inlet(s) for anythings (with description)
\remark That's the one to choose for the left-most (first) inlet unless it's a signal inlet.
*/
- void AddInAnything(const char *desc,int m = 1) { AddInlet(xlet::tp_any,m,desc); }
+ void AddInAnything(const char *desc,int m = 1) { AddInlet(xlet_any,m,desc); }
//! Add inlet(s) for floats
- void AddInFloat(int m = 1) { AddInlet(xlet::tp_float,m); }
+ void AddInFloat(int m = 1) { AddInlet(xlet_float,m); }
//! Add inlet(s) for floats (with description)
- void AddInFloat(const char *desc,int m = 1) { AddInlet(xlet::tp_float,m,desc); }
+ void AddInFloat(const char *desc,int m = 1) { AddInlet(xlet_float,m,desc); }
//! Add inlet(s) for integers
- void AddInInt(int m = 1) { AddInlet(xlet::tp_int,m); }
+ void AddInInt(int m = 1) { AddInlet(xlet_int,m); }
//! Add inlet(s) for integers (with description)
- void AddInInt(const char *desc,int m = 1) { AddInlet(xlet::tp_int,m,desc); }
+ void AddInInt(const char *desc,int m = 1) { AddInlet(xlet_int,m,desc); }
//! Add inlet(s) for symbols
- void AddInSymbol(int m = 1) { AddInlet(xlet::tp_sym,m); }
+ void AddInSymbol(int m = 1) { AddInlet(xlet_sym,m); }
//! Add inlet(s) for symbol (with description)
- void AddInSymbol(const char *desc,int m = 1) { AddInlet(xlet::tp_sym,m,desc); }
+ void AddInSymbol(const char *desc,int m = 1) { AddInlet(xlet_sym,m,desc); }
//! Add inlet(s) for bang
- void AddInBang(int m = 1) { AddInlet(xlet::tp_sym,m); }
+ void AddInBang(int m = 1) { AddInlet(xlet_sym,m); }
//! Add inlet(s) for bangs (with description)
- void AddInBang(const char *desc,int m = 1) { AddInlet(xlet::tp_sym,m,desc); }
+ void AddInBang(const char *desc,int m = 1) { AddInlet(xlet_sym,m,desc); }
//! Add inlet(s) for lists
- void AddInList(int m = 1) { AddInlet(xlet::tp_list,m); }
+ void AddInList(int m = 1) { AddInlet(xlet_list,m); }
//! Add inlet(s) for lists (with description)
- void AddInList(const char *desc,int m = 1) { AddInlet(xlet::tp_list,m,desc); }
+ void AddInList(const char *desc,int m = 1) { AddInlet(xlet_list,m,desc); }
//! Add outlet(s) for anythings
- void AddOutAnything(int m = 1) { AddOutlet(xlet::tp_any,m); }
+ void AddOutAnything(int m = 1) { AddOutlet(xlet_any,m); }
//! Add outlet(s) for anythings (with description)
- void AddOutAnything(const char *desc,int m = 1) { AddOutlet(xlet::tp_any,m,desc); }
+ void AddOutAnything(const char *desc,int m = 1) { AddOutlet(xlet_any,m,desc); }
//! Add outlet(s) for floats
- void AddOutFloat(int m = 1) { AddOutlet(xlet::tp_float,m); }
+ void AddOutFloat(int m = 1) { AddOutlet(xlet_float,m); }
//! Add outlet(s) for floats (with description)
- void AddOutFloat(const char *desc,int m = 1) { AddOutlet(xlet::tp_float,m,desc); }
+ void AddOutFloat(const char *desc,int m = 1) { AddOutlet(xlet_float,m,desc); }
//! Add outlet(s) for integers
- void AddOutInt(int m = 1) { AddOutlet(xlet::tp_int,m); }
+ void AddOutInt(int m = 1) { AddOutlet(xlet_int,m); }
//! Add outlet(s) for integers (with description)
- void AddOutInt(const char *desc,int m = 1) { AddOutlet(xlet::tp_int,m,desc); }
+ void AddOutInt(const char *desc,int m = 1) { AddOutlet(xlet_int,m,desc); }
//! Add outlet(s) for symbols
- void AddOutSymbol(int m = 1) { AddOutlet(xlet::tp_sym,m); }
+ void AddOutSymbol(int m = 1) { AddOutlet(xlet_sym,m); }
//! Add outlet(s) for symbols (with description)
- void AddOutSymbol(const char *desc,int m = 1) { AddOutlet(xlet::tp_sym,m,desc); }
+ void AddOutSymbol(const char *desc,int m = 1) { AddOutlet(xlet_sym,m,desc); }
//! Add outlet(s) for bangs
- void AddOutBang(int m = 1) { AddOutlet(xlet::tp_sym,m); }
+ void AddOutBang(int m = 1) { AddOutlet(xlet_sym,m); }
//! Add outlet(s) for bangs (with description)
- void AddOutBang(const char *desc,int m = 1) { AddOutlet(xlet::tp_sym,m,desc); }
+ void AddOutBang(const char *desc,int m = 1) { AddOutlet(xlet_sym,m,desc); }
//! Add outlet(s) for lists
- void AddOutList(int m = 1) { AddOutlet(xlet::tp_list,m); }
+ void AddOutList(int m = 1) { AddOutlet(xlet_list,m); }
//! Add outlet(s) for lists (with description)
- void AddOutList(const char *desc,int m = 1) { AddOutlet(xlet::tp_list,m,desc); }
+ void AddOutList(const char *desc,int m = 1) { AddOutlet(xlet_list,m,desc); }
//! \deprecated inlets and outlets are now set up automatically
bool SetupInOut() { return true; }
@@ -196,10 +193,10 @@ public:
int CntOutSig() const { return outsigs; }
//! Check if we are in DSP time
- bool InDsp() const { return indsp; }
+ static bool InDsp() { return indsp; }
//! Retrieve currently processed message tag (NULL if no message processing)
- const t_symbol *thisTag() const { return curtag; }
+ static const t_symbol *thisTag() { return curtag; }
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
class outlet;
@@ -207,7 +204,7 @@ public:
//! Get pointer to outlet (not in the constructor!)
outlet *GetOut(int ix) const { return outlets[ix]; }
#endif
- int GetOutAttr() const { return procattr?CntOut():0; }
+ int GetOutAttr() const { return HasAttributes()?CntOut():0; }
//! @} FLEXT_C_IO_MISC
@@ -377,7 +374,10 @@ public:
void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *,int &)) { AddMethod(inlet,MakeSymbol(tag),m); }
//! Set Max/MSP style of distributing list elements over (message) inlets
- void SetDist(bool d = true) { distmsgs = d; }
+ static void SetDist(t_classid c,bool d = true);
+ //! Query whether lists are distributed
+ bool DoDist() const;
+
//! @} FLEXT_C_ADDMETHOD
@@ -515,22 +515,13 @@ protected:
*/
virtual bool Init();
- //! \brief This represents either an inlet or outlet
- struct xlet {
- enum type {
- tp_none = 0,
- tp_float,tp_int,tp_sym,tp_list,tp_any,
- tp_LIST,tp_ANY, // use AtomList and AtomAnything
- tp_sig
- };
- xlet(type t,const char *desc = NULL);
- ~xlet();
-
- char *desc;
- type tp;
- xlet *nxt;
- };
+ enum xlettype {
+ xlet_none = 0,
+ xlet_float,xlet_int,xlet_sym,xlet_list,xlet_any,
+ xlet_LIST,xlet_ANY, // use AtomList and AtomAnything
+ xlet_sig
+ };
/*! \defgroup FLEXT_C_ATTR Attribute handling methods (object scope)
@{
@@ -605,7 +596,7 @@ protected:
*/
//! \brief get a code for a list of inlets or outlets
- unsigned long XletCode(xlet::type tp = xlet::tp_none,...); // end list with 0 (= tp_none) !!
+ unsigned long XletCode(xlettype tp = xlettype::xlet_none,...); // end list with 0 (= tp_none) !!
/*! \brief Add some inlets by a special code representing the types
\remark use XletCode function to get code value
@@ -613,7 +604,7 @@ protected:
void AddInlets(unsigned long code);
//! \brief Add one or more inlet(s)
- void AddInlet(xlet::type tp,int mult = 1,const char *desc = NULL) { AddXlet(tp,mult,desc,inlist); }
+ void AddInlet(xlettype tp,int mult = 1,const char *desc = NULL);
/*! \brief Add some inlets by a special code representing the types
\remark use XletCode function to get code value
@@ -621,13 +612,13 @@ protected:
void AddOutlets(unsigned long code);
//! \brief Add one or more outlet(s)
- void AddOutlet(xlet::type tp,int mult = 1,const char *desc = NULL) { AddXlet(tp,mult,desc,outlist); }
+ void AddOutlet(xlettype tp,int mult = 1,const char *desc = NULL);
//! \brief Set the description of an indexed inlet
- void DescInlet(int ix,const char *desc) { DescXlet(ix,desc,inlist); }
+ void DescInlet(int ix,const char *desc);
//! \brief Set the description of an indexed outlet
- void DescOutlet(int ix,const char *desc) { DescXlet(ix,desc,outlist); }
+ void DescOutlet(int ix,const char *desc);
//! @} FLEXT_C_INOUT
@@ -650,15 +641,6 @@ protected:
Item *nxt;
};
-/*
- class ItemSet:
- public DataMap<const t_symbol *,Item *>
- {
- public:
- ItemSet();
- ~ItemSet();
- };
-*/
class ItemSet
:public TablePtrMap<const t_symbol *,Item *,8>
{
@@ -772,15 +754,6 @@ protected:
int flags;
};
-/*
- class AttrDataCont:
- public DataMap<const t_symbol *,AttrData *>
- {
- public:
- AttrDataCont();
- ~AttrDataCont();
- };
-*/
class AttrDataCont
:public TablePtrMap<const t_symbol *,AttrData *,8>
{
@@ -810,9 +783,6 @@ protected:
void ToSysBool(int n,bool f) const { ToSysInt(n,f?1:0); }
void ToSysAtom(int n,const t_atom &at) const;
- // flag if we are within DSP
- bool indsp;
-
private:
class pxbnd_object;
public:
@@ -831,35 +801,49 @@ public:
pxbnd_object *px;
};
-//! @} FLEXT_CLASS
-
ItemCont *ThMeths() { return &methhead; }
- static ItemCont *ClMeths(t_classid c) { return GetClassArr(c,0); }
+ static ItemCont *ClMeths(t_classid c);
static void AddMethod(ItemCont *ma,int inlet,const t_symbol *tag,methfun fun,metharg tp,...);
ItemCont *ThAttrs() { return attrhead; }
- static ItemCont *ClAttrs(t_classid c) { return GetClassArr(c,1); }
+ static ItemCont *ClAttrs(t_classid c);
static void AddAttrib(ItemCont *aa,ItemCont *ma,const t_symbol *attr,metharg tp,methfun gfun,methfun sfun);
void AddAttrib(const t_symbol *attr,metharg tp,methfun gfun,methfun sfun);
static void AddAttrib(t_classid c,const t_symbol *attr,metharg tp,methfun gfun,methfun sfun);
+ //! flag if we are within DSP
+ static bool indsp;
+
private:
static void Setup(t_classid c);
- xlet *inlist,*outlist;
- const t_symbol *curtag;
- int incnt,outcnt,insigs,outsigs;
- bool distmsgs;
+ //! \brief This represents either an inlet or outlet during construction
+ class FLEXT_SHARE xlet {
+ public:
+ xlet(): tp(xlet_none),desc(NULL) {}
+ ~xlet() { if(desc) delete[] desc; }
+
+ xlettype tp;
+ char *desc;
+
+ void Desc(const char *c);
+ };
+
+ static xlet inlist[];
+ static xlet outlist[];
+
+ //! current message tag
+ static const t_symbol *curtag;
+ //! number of message and signal inlets/outlets
+ unsigned char incnt,outcnt,insigs,outsigs;
+
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
outlet **outlets;
#endif
- void AddXlet(xlet::type tp,int mult,const char *desc,xlet *&root);
- void DescXlet(int ix,const char *desc,xlet *&root);
-
union t_any {
float ft;
int it;
@@ -880,9 +864,7 @@ private:
typedef bool (*methfun_4)(flext_base *c,t_any &,t_any &,t_any &,t_any &);
typedef bool (*methfun_5)(flext_base *c,t_any &,t_any &,t_any &,t_any &,t_any &);
- static ItemCont *GetClassArr(t_classid,int ix);
-
- mutable ItemCont methhead,*clmethhead;
+ mutable ItemCont methhead;
mutable ItemCont *bindhead;
bool CallMeth(const MethItem &m,int argc,const t_atom *argv);
@@ -891,7 +873,7 @@ private:
bool TryMethSym(Item *lst,const t_symbol *s);
bool TryMethAny(Item *lst,const t_symbol *s,int argc,const t_atom *argv);
- mutable ItemCont *attrhead,*clattrhead;
+ mutable ItemCont *attrhead;
mutable AttrDataCont *attrdata;
AttrItem *FindAttrib(const t_symbol *tag,bool get,bool msg = false) const;
diff --git a/externals/grill/flext/source/fldsp.cpp b/externals/grill/flext/source/fldsp.cpp
index 85d7f2f8..fa9ac506 100644
--- a/externals/grill/flext/source/fldsp.cpp
+++ b/externals/grill/flext/source/fldsp.cpp
@@ -89,9 +89,9 @@ t_int *flext_dsp::dspmeth(t_int *w)
if(obj->dspon)
#endif
{
- obj->indsp = true;
+ flext_base::indsp = true;
obj->CbSignal();
- obj->indsp = false;
+ flext_base::indsp = false;
}
return w+2;
}
diff --git a/externals/grill/flext/source/fldsp.h b/externals/grill/flext/source/fldsp.h
index 1ba21ef1..d9dbb1fe 100644
--- a/externals/grill/flext/source/fldsp.h
+++ b/externals/grill/flext/source/fldsp.h
@@ -115,22 +115,22 @@ public:
/*! \brief Add signal inlet(s)
\param m Number of inlets to add
*/
- void AddInSignal(int m = 1) { AddInlet(xlet::tp_sig,m); }
+ void AddInSignal(int m = 1) { AddInlet(xlet_sig,m); }
/*! \brief Add signal inlet (with description)
\param desc Description of inlet
*/
- void AddInSignal(const char *desc) { AddInlet(xlet::tp_sig,1,desc); }
+ void AddInSignal(const char *desc) { AddInlet(xlet_sig,1,desc); }
/*! \brief Add signal outlet(s)
\param m Number of inlets to add
*/
- void AddOutSignal(int m = 1) { AddOutlet(xlet::tp_sig,m); }
+ void AddOutSignal(int m = 1) { AddOutlet(xlet_sig,m); }
/*! \brief Add signal outlet (with description)
\param desc Description of outlet
*/
- void AddOutSignal(const char *desc) { AddOutlet(xlet::tp_sig,1,desc); }
+ void AddOutSignal(const char *desc) { AddOutlet(xlet_sig,1,desc); }
//! @}
diff --git a/externals/grill/flext/source/flext.cpp b/externals/grill/flext/source/flext.cpp
index c88e5f00..91228a1b 100644
--- a/externals/grill/flext/source/flext.cpp
+++ b/externals/grill/flext/source/flext.cpp
@@ -19,14 +19,12 @@ WARRANTIES, see the file, "license.txt," in this distribution.
// === flext_base ============================================
bool flext_base::compatibility = true;
+bool flext_base::indsp = false;
+const t_symbol *flext_base::curtag = NULL;
-flext_base::FLEXT_CLASSDEF(flext_base)():
- indsp(false),
- inlist(NULL),outlist(NULL),
- curtag(NULL),
- incnt(0),outcnt(0),
- insigs(0),outsigs(0),
- distmsgs(false)
+flext_base::FLEXT_CLASSDEF(flext_base)()
+ : incnt(0),outcnt(0)
+ , insigs(0),outsigs(0)
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
,outlets(NULL),inlets(NULL)
#endif
@@ -36,18 +34,15 @@ flext_base::FLEXT_CLASSDEF(flext_base)():
{
FLEXT_LOG1("%s - flext logging is on",thisName());
- t_classid clid = thisClassId();
- clmethhead = ClMeths(clid);
bindhead = NULL;
- if(procattr) {
+ if(HasAttributes()) {
// initialize when attribute processing is enabled
attrhead = new ItemCont;
- clattrhead = ClAttrs(clid);
attrdata = new AttrDataCont;
}
else {
- attrhead = clattrhead = NULL;
+ attrhead = NULL;
attrdata = NULL;
}
}
@@ -77,10 +72,6 @@ flext_base::~FLEXT_CLASSDEF(flext_base)()
if(attrhead) delete attrhead;
if(attrdata) delete attrdata;
- // destroy inlets and outlets and their proxy objects
- if(inlist) delete inlist;
- if(outlist) delete outlist;
-
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
if(outlets) delete[] outlets;
@@ -126,7 +117,7 @@ bool flext_base::Init()
if(ok) ok = InitInlets() && InitOutlets();
if(ok) {
- if(procattr && m_holdaargc && m_holdaargv) {
+ if(HasAttributes() && m_holdaargc && m_holdaargv) {
// initialize creation attributes
ok = InitAttrib(m_holdaargc,m_holdaargv);
}
@@ -210,7 +201,7 @@ void flext_base::cb_assist(t_class *c,void * /*b*/,long msg,long arg,char *s)
if(th->outdesc[arg]) strcpy(s,th->outdesc[arg]);
}
else
- if(arg == th->outcnt && th->procattr) strcpy(s,"Attributes");
+ if(arg == th->outcnt && th->HasAttributes()) strcpy(s,"Attributes");
break;
}
}
diff --git a/externals/grill/flext/source/flext.h b/externals/grill/flext/source/flext.h
index b0f939f7..f58447e5 100644
--- a/externals/grill/flext/source/flext.h
+++ b/externals/grill/flext/source/flext.h
@@ -44,9 +44,12 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#elif FLEXT_THREADS == FLEXT_THR_MP
#include <multiprocessing.h>
#elif FLEXT_THREADS == FLEXT_THR_WIN32
- #define _WIN32_WINNT 0x500 // must be WIN2000 at least!
- #include <windows.h>
- #include <process.h>
+ #if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x500
+ #include <windows.h>
+ #include <process.h>
+ #else
+ #error "Win32 threading model only supported for Win2000/XP or newer"
+ #endif
#else
#error "Thread model not supported"
#endif
diff --git a/externals/grill/flext/source/flitem.cpp b/externals/grill/flext/source/flitem.cpp
index 057f1d44..52657c75 100755
--- a/externals/grill/flext/source/flitem.cpp
+++ b/externals/grill/flext/source/flitem.cpp
@@ -112,7 +112,8 @@ flext_base::Item *flext_base::ItemCont::FindList(const t_symbol *tag,int inlet)
// --- class item lists (methods and attributes) ----------------
-typedef TablePtrMap<flext_base::t_classid,flext_base::ItemCont *,64> ClassMap;
+/*
+typedef TablePtrMap<flext_base::t_classid,flext_base::ItemCont *,8> ClassMap;
static ClassMap classarr[2];
@@ -123,3 +124,4 @@ flext_base::ItemCont *flext_base::GetClassArr(t_classid c,int ix)
if(!cont) map.insert(c,cont = new ItemCont);
return cont;
}
+*/ \ No newline at end of file
diff --git a/externals/grill/flext/source/fllib.cpp b/externals/grill/flext/source/fllib.cpp
index 6b1ccb92..b28bda5a 100755
--- a/externals/grill/flext/source/fllib.cpp
+++ b/externals/grill/flext/source/fllib.cpp
@@ -100,40 +100,42 @@ bool flext::chktilde(const char *objname)
}
-
// this class stands for one registered object
// it holds the class, type flags, constructor and destructor of the object and the creation arg types
// it will never be destroyed
-class libclass:
+class flext_class:
public flext_root
{
public:
- libclass(t_class *&cl,flext_obj *(*newf)(int,t_atom *),void (*freef)(flext_hdr *));
+ flext_class(t_class *&cl,flext_obj *(*newf)(int,t_atom *),void (*freef)(flext_hdr *));
flext_obj *(*newfun)(int,t_atom *);
void (*freefun)(flext_hdr *c);
t_class *const &clss;
- bool lib,dsp,attr;
+ bool lib,dsp,attr,dist;
int argc;
int *argv;
+
+ flext_base::ItemCont meths,attrs;
};
-libclass::libclass(t_class *&cl,flext_obj *(*newf)(int,t_atom *),void (*freef)(flext_hdr *)):
- newfun(newf),freefun(freef),
+flext_class::flext_class(t_class *&cl,flext_obj *(*newf)(int,t_atom *),void (*freef)(flext_hdr *)):
clss(cl),
+ newfun(newf),freefun(freef),
argc(0),argv(NULL)
+ , dist(false)
{}
-typedef TablePtrMap<const t_symbol *,libclass *,8> LibMap;
+typedef TablePtrMap<const t_symbol *,flext_class *,8> LibMap;
static LibMap libnames;
//! Store or retrieve registered classes
-static libclass *FindName(const t_symbol *s,libclass *o = NULL)
+static flext_class *FindName(const t_symbol *s,flext_class *o = NULL)
{
- libclass *cl = libnames.find(s);
+ flext_class *cl = libnames.find(s);
if(!cl) libnames.insert(s,cl = o);
return cl;
}
@@ -144,14 +146,12 @@ static libclass *FindName(const t_symbol *s,libclass *o = NULL)
#if FLEXT_SYS == FLEXT_SYS_MAX
static t_class *lib_class = NULL;
static const t_symbol *lib_name = NULL;
+#endif
-flext_obj::t_classid flext_obj::thisClassId() const
-{
- return FindName(thisNameSym());
-}
+t_class *flext_obj::getClass(t_classid id) { return reinterpret_cast<flext_class *>(id)->clss; }
+
+bool flext_obj::HasAttributes() const { return clss->attr; }
-t_class *flext_obj::getClass(t_classid id) { return reinterpret_cast<libclass *>(id)->clss; }
-#endif
void flext_obj::lib_init(const char *name,void setupfun(),bool attr)
{
@@ -227,7 +227,7 @@ void flext_obj::obj_add(bool lib,bool dsp,bool attr,const char *idname,const cha
#endif
// make new dynamic object
- libclass *lo = new libclass(*cl,newfun,freefun);
+ flext_class *lo = new flext_class(*cl,newfun,freefun);
lo->lib = lib;
lo->dsp = dsp;
lo->attr = process_attributes;
@@ -258,12 +258,7 @@ void flext_obj::obj_add(bool lib,bool dsp,bool attr,const char *idname,const cha
}
// get unique class id
-#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_JMAX
- t_classid clid = lo->clss;
-#else
- // in Max/MSP the t_class *value can't be used because it's possible that's it's not yet set!!
t_classid clid = lo;
-#endif
// make help reference
flext_obj::DefineHelp(clid,idname,extract(names,-1),dsp);
@@ -276,7 +271,7 @@ void flext_obj::obj_add(bool lib,bool dsp,bool attr,const char *idname,const cha
// add to name list
const t_symbol *lsym = MakeSymbol(c);
- /*libclass *lcl =*/ FindName(lsym,lo);
+ FindName(lsym,lo);
#if FLEXT_SYS == FLEXT_SYS_PD
if(ix > 0)
@@ -327,7 +322,7 @@ flext_hdr *flext_obj::obj_new(const t_symbol *s,int _argc_,t_atom *argv)
{
flext_hdr *obj = NULL;
#endif
- libclass *lo = FindName(s);
+ flext_class *lo = FindName(s);
if(lo) {
bool ok = true;
t_atom args[NEWARGS];
@@ -391,24 +386,19 @@ flext_hdr *flext_obj::obj_new(const t_symbol *s,int _argc_,t_atom *argv)
if(ok) {
try {
- t_classid clid;
-
#if FLEXT_SYS == FLEXT_SYS_PD
- clid = lo->clss;
obj = (flext_hdr *)::pd_new(lo->clss);
#elif FLEXT_SYS == FLEXT_SYS_MAX
- clid = lo;
obj = (flext_hdr *)::newobject(lo->clss);
-#elif FLEXT_SYS == FLEXT_SYS_JMAX
- clid = lo->clss;
#else
#error
#endif
flext_obj::m_holder = obj;
+ flext_obj::m_holdclass = lo;
flext_obj::m_holdname = s;
- flext_obj::m_holdattr = lo->attr;
flext_obj::initing = true;
+ flext_obj::init_ok = true;
// get actual flext object (newfun calls "new flext_obj()")
if(lo->argc >= 0)
@@ -417,12 +407,12 @@ flext_hdr *flext_obj::obj_new(const t_symbol *s,int _argc_,t_atom *argv)
obj->data = lo->newfun(argc,argv);
flext_obj::m_holder = NULL;
+ flext_obj::m_holdclass = NULL;
flext_obj::m_holdname = NULL;
- flext_obj::m_holdattr = false;
ok = obj->data &&
// check constructor exit flag
- obj->data->InitOk();
+ flext_obj::init_ok;
if(ok) {
if(lo->attr) {
@@ -496,7 +486,7 @@ void flext_obj::obj_free(flext_hdr *h)
{
flext_hdr *hdr = (flext_hdr *)h;
const t_symbol *name = hdr->data->thisNameSym();
- libclass *lcl = FindName(name);
+ flext_class *lcl = FindName(name);
if(lcl) {
try {
@@ -531,3 +521,10 @@ void flext_obj::obj_free(flext_hdr *h)
}
+t_class *flext_obj::thisClass() const { FLEXT_ASSERT(x_obj); return thisClassId()->clss; }
+
+void flext_base::SetDist(t_classid c,bool d) { c->dist = d; }
+bool flext_base::DoDist() const { return thisClassId()->dist; }
+
+flext_base::ItemCont *flext_base::ClMeths(t_classid c) { return &c->meths; }
+flext_base::ItemCont *flext_base::ClAttrs(t_classid c) { return &c->attrs; }
diff --git a/externals/grill/flext/source/flmap.cpp b/externals/grill/flext/source/flmap.cpp
index 117f0896..5afcf51c 100644
--- a/externals/grill/flext/source/flmap.cpp
+++ b/externals/grill/flext/source/flmap.cpp
@@ -216,34 +216,34 @@ void TableAnyMap::_getsmall(Data &dt)
void TableAnyMap::iterator::forward()
{
- if(map || ix >= map->n) {
- if(++ix >= map->n) {
- TableAnyMap *nmap;
-
- // we reached the end of the slots
- if(map->right) {
- // climb up one
- map = map->right;
- leftmost();
- ix = 0;
- }
- else {
- // fall back
- for(;;) {
- nmap = map->parent;
- if(!nmap) break; // no parent
- if(nmap->left == map) {
- // ok, we are in front of the slots now
- ix = 0;
- map = nmap;
- break;
- }
- else {
- FLEXT_ASSERT(nmap->right == map);
- ix = (map = nmap)->n;
- }
- }
- }
- }
- }
+ FLEXT_ASSERT(map || ix >= map->n);
+
+ if(++ix >= map->n) {
+ TableAnyMap *nmap;
+
+ // we reached the end of the slots
+ if(map->right) {
+ // climb up one
+ map = map->right;
+ leftmost();
+ ix = 0;
+ }
+ else {
+ // fall back
+ for(;;) {
+ nmap = map->parent;
+ if(!nmap) break; // no parent
+ if(nmap->left == map) {
+ // ok, we are in front of the slots now
+ ix = 0;
+ map = nmap;
+ break;
+ }
+ else {
+ FLEXT_ASSERT(nmap->right == map);
+ ix = (map = nmap)->n;
+ }
+ }
+ }
+ }
}
diff --git a/externals/grill/flext/source/flmap.h b/externals/grill/flext/source/flmap.h
index e748356c..0d3f623d 100644
--- a/externals/grill/flext/source/flmap.h
+++ b/externals/grill/flext/source/flmap.h
@@ -52,7 +52,7 @@ public:
#if 0 // set 1 for asserting the map structure (very cpu-intensive!)
void check(int tsize) { if(n) _check(tsize); }
#else
- void check(int tsize) {}
+// void check(int tsize) {}
#endif
void *insert(int tsize,size_t k,void *t)
@@ -64,7 +64,7 @@ public:
data[n++](k,t);
r = 0;
}
- check(tsize);
+// check(tsize);
return r;
}
@@ -73,7 +73,7 @@ public:
void *remove(int tsize,size_t k)
{
void *r = n?_remove(tsize,k):0;
- check(tsize);
+// check(tsize);
return r;
}
diff --git a/externals/grill/flext/source/flmeth.cpp b/externals/grill/flext/source/flmeth.cpp
index df9a6ca6..2da2b3a2 100755
--- a/externals/grill/flext/source/flmeth.cpp
+++ b/externals/grill/flext/source/flmeth.cpp
@@ -91,6 +91,7 @@ void flext_base::ListMethods(AtomList &la,int inlet) const
{
typedef TablePtrMap<int,const t_symbol *,32> MethList;
MethList list[2];
+ ItemCont *clmethhead = ClMeths(thisClassId());
int i;
for(i = 0; i <= 1; ++i) {
@@ -119,7 +120,7 @@ void flext_base::ListMethods(AtomList &la,int inlet) const
bool flext_base::cb_ListMethods(flext_base *c,int argc,const t_atom *argv)
{
- if(c->procattr && (argc == 0 || (argc == 1 && CanbeInt(argv[0])))) {
+ if(c->HasAttributes() && (argc == 0 || (argc == 1 && CanbeInt(argv[0])))) {
// defined in flsupport.cpp
extern const t_symbol *sym_methods;
diff --git a/externals/grill/flext/source/flmsg.cpp b/externals/grill/flext/source/flmsg.cpp
index b31ddc41..9a57e4f2 100755
--- a/externals/grill/flext/source/flmsg.cpp
+++ b/externals/grill/flext/source/flmsg.cpp
@@ -138,6 +138,7 @@ bool flext_base::TryMethAny(Item *lst,const t_symbol *s,int argc,const t_atom *a
bool flext_base::FindMeth(int inlet,const t_symbol *s,int argc,const t_atom *argv)
{
Item *lst;
+ ItemCont *clmethhead = ClMeths(thisClassId());
// search for exactly matching tag
if((lst = methhead.FindList(s,inlet)) != NULL && TryMethTag(lst,s,argc,argv)) return true;
@@ -196,7 +197,7 @@ bool flext_base::CbMethodHandler(int inlet,const t_symbol *s,int argc,const t_at
#endif
// If float or int message is not explicitly handled: try list handler instead
- if(!trap && argc == 1 && (s == sym_float
+ if(!trap && argc == 1 && (s == sym_float || s == sym_symbol
#if FLEXT_SYS == FLEXT_SYS_MAX
|| s == sym_int
#endif
@@ -208,6 +209,8 @@ bool flext_base::CbMethodHandler(int inlet,const t_symbol *s,int argc,const t_at
else if(s == sym_int)
SetInt(list,GetInt(argv[0]));
#endif
+ else if(s == sym_symbol)
+ SetSymbol(list,GetSymbol(argv[0]));
trap = true;
ret = CbMethodHandler(inlet,sym_list,1,&list);
@@ -226,7 +229,7 @@ bool flext_base::CbMethodHandler(int inlet,const t_symbol *s,int argc,const t_at
if(ret) goto end;
// if distmsgs is switched on then distribute list elements over inlets (Max/MSP behavior)
- if(distmsgs && !trap && inlet == 0 && s == sym_list && insigs <= 1) {
+ if(DoDist() && !trap && inlet == 0 && s == sym_list && insigs <= 1) {
int i = incnt;
if(i > argc) i = argc;
for(--i; i >= 0; --i) { // right to left distribution
diff --git a/externals/grill/flext/source/flout.cpp b/externals/grill/flext/source/flout.cpp
index 7a2d2e8e..7f3130e8 100644
--- a/externals/grill/flext/source/flout.cpp
+++ b/externals/grill/flext/source/flout.cpp
@@ -66,71 +66,52 @@ bool flext_base::InitInlets()
{
bool ok = true;
+ // incnt has number of inlets (any type)
+ // insigs should be 0
+
+ FLEXT_ASSERT(!insigs && !inlets);
+
// ----------------------------------
// create inlets
// ----------------------------------
- incnt = insigs = 0;
-
- // digest inlist
-
- xlet *xi;
- incnt = 0;
- for(xi = inlist; xi; xi = xi->nxt) ++incnt;
- xlet::type *list = new xlet::type[incnt];
- int i;
- for(xi = inlist,i = 0; xi; xi = xi->nxt,++i) list[i] = xi->tp;
-
#if FLEXT_SYS == FLEXT_SYS_MAX
// copy inlet descriptions
indesc = new char *[incnt];
- for(xi = inlist,i = 0; xi; xi = xi->nxt,++i) {
- int l = xi->desc?strlen(xi->desc):0;
- if(l) {
- indesc[i] = new char[l+1];
- memcpy(indesc[i],xi->desc,l);
- indesc[i][l] = 0;
- }
- else
- indesc[i] = NULL;
+ for(int i = 0; i < incnt; ++i) {
+ xlet &x = inlist[i];
+ indesc[i] = x.desc;
+ x.desc = NULL;
}
#endif
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
inlets = new px_object *[incnt];
- for(i = 0; i < incnt; ++i) inlets[i] = NULL;
#endif
// type info is now in list array
#if FLEXT_SYS == FLEXT_SYS_PD
{
int cnt = 0;
- xi = inlist; // points to first inlet
-
if(incnt >= 1) {
- switch(list[0]) {
- case xlet::tp_sig:
- ++insigs;
- break;
- default:
- // leftmost inlet is already there...
- break;
- }
+ xlet &xi = inlist[0]; // points to first inlet
+ if(xi.tp == xlet_sig) ++insigs;
+ // else leftmost inlet is already there...
++cnt;
#if PD_MINOR_VERSION >= 37 && defined(PD_DEVEL_VERSION)
// set tooltip
- if(xi->desc && *xi->desc) class_settip(thisClass(),gensym(xi->desc));
+ if(xi.desc && *xi.desc) class_settip(thisClass(),gensym(xi.desc));
#endif
}
for(int ix = 1; ix < incnt; ++ix,++cnt) {
- xi = xi->nxt; // points to next inlet
-
+ xlet &xi = inlist[ix]; // points to first inlet
t_inlet *in = NULL;
- switch(list[ix]) {
- case xlet::tp_float:
- case xlet::tp_int: {
+ switch(xi.tp) {
+ case xlet_float:
+ case xlet_int: {
+ inlets[ix] = NULL;
char sym[] = "ft??";
if(ix >= 10) {
if(compatibility) {
@@ -149,20 +130,21 @@ bool flext_base::InitInlets()
if(ok) in = inlet_new(&x_obj->obj, &x_obj->obj.ob_pd, (t_symbol *)sym_float, gensym(sym));
break;
}
- case xlet::tp_sym:
+ case xlet_sym:
(inlets[ix] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages
in = inlet_new(&x_obj->obj,&inlets[ix]->obj.ob_pd, (t_symbol *)sym_symbol, (t_symbol *)sym_symbol);
break;
- case xlet::tp_list:
+ case xlet_list:
(inlets[ix] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages
in = inlet_new(&x_obj->obj,&inlets[ix]->obj.ob_pd, (t_symbol *)sym_list, (t_symbol *)sym_list);
break;
- case xlet::tp_any:
+ case xlet_any:
(inlets[ix] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages
in = inlet_new(&x_obj->obj,&inlets[ix]->obj.ob_pd, 0, 0);
break;
- case xlet::tp_sig:
- if(compatibility && list[ix-1] != xlet::tp_sig) {
+ case xlet_sig:
+ inlets[ix] = NULL;
+ if(compatibility && inlist[ix-1].tp != xlet_sig) {
post("%s: All signal inlets must be left-aligned in compatibility mode",thisName());
ok = false;
}
@@ -174,13 +156,14 @@ bool flext_base::InitInlets()
}
break;
default:
- error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)list[ix]);
+ inlets[ix] = NULL;
+ error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)inlist[ix].tp);
ok = false;
}
#if PD_MINOR_VERSION >= 37 && defined(PD_DEVEL_VERSION)
// set tooltip
- if(in && xi->desc && *xi->desc) inlet_settip(in,gensym(xi->desc));
+ if(in && xi.desc && *xi.desc) inlet_settip(in,gensym(xi.desc));
#endif
}
@@ -190,22 +173,26 @@ bool flext_base::InitInlets()
{
int ix,cnt;
// count leftmost signal inlets
- while(insigs < incnt && list[insigs] == xlet::tp_sig) ++insigs;
+ while(insigs < incnt && inlist[insigs].tp == xlet_sig) ++insigs;
for(cnt = 0,ix = incnt-1; ix >= insigs; --ix,++cnt) {
+ xlet &xi = inlist[ix];
if(ix == 0) {
- if(list[ix] != xlet::tp_any) {
+ inlets[ix] = NULL;
+ if(xi.tp != xlet_any) {
error("%s: Leftmost inlet must be of type signal or anything",thisName());
ok = false;
}
}
else {
- switch(list[ix]) {
- case xlet::tp_sig:
+ switch(xi.tp) {
+ case xlet_sig:
+ inlets[ix] = NULL;
error("%s: All signal inlets must be left-aligned",thisName());
ok = false;
break;
- case xlet::tp_float:
+ case xlet_float:
+ inlets[ix] = NULL;
if(ix >= 10) {
post("%s: Only 9 float inlets possible",thisName());
ok = false;
@@ -213,7 +200,8 @@ bool flext_base::InitInlets()
else
floatin(x_obj,ix);
break;
- case xlet::tp_int:
+ case xlet_int:
+ inlets[ix] = NULL;
if(ix >= 10) {
post("%s: Only 9 int inlets possible",thisName());
ok = false;
@@ -221,13 +209,14 @@ bool flext_base::InitInlets()
else
intin(x_obj,ix);
break;
- case xlet::tp_any: // non-leftmost
- case xlet::tp_sym:
- case xlet::tp_list:
+ case xlet_any: // non-leftmost
+ case xlet_sym:
+ case xlet_list:
inlets[ix] = (px_object *)proxy_new(x_obj,ix,&((flext_hdr *)x_obj)->curinlet);
break;
default:
- error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)list[ix]);
+ inlets[ix] = NULL;
+ error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)xi.tp);
ok = false;
}
}
@@ -236,67 +225,29 @@ bool flext_base::InitInlets()
// incnt = cnt;
if(insigs)
- dsp_setup(thisHdr(),insigs); // signal inlets
-// dsp_setupbox(thisHdr(),insigs); // signal inlets
- }
-#elif FLEXT_SYS == FLEXT_SYS_JMAX
- {
- t_class *cl = thisClass();
- int cnt = 0;
- for(int ix = 0; ix < incnt; ++ix,++cnt) {
- switch(list[ix]) {
- case xlet::tp_float:
- case xlet::tp_int:
-// fts_class_inlet_number(cl, ix, jmax_proxy);
- break;
- case xlet::tp_sym:
-// fts_class_inlet_symbol(cl, ix, jmax_proxy);
- break;
- case xlet::tp_sig:
- if(compatibility && list[ix-1] != xlet::tp_sig) {
- post("%s: All signal inlets must be left-aligned in compatibility mode",thisName());
- ok = false;
- }
- else {
- if(!insigs) fts_dsp_declare_inlet(cl,0);
- ++insigs;
- }
- // no break -> let a signal inlet also accept any messages
- case xlet::tp_list:
- case xlet::tp_any:
-// fts_class_inlet_varargs(cl,ix, jmax_proxy);
- break;
- default:
- error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)list[ix]);
- ok = false;
- }
- }
-
- incnt = cnt;
-
- fts_object_set_inlets_number((fts_object_t *)thisHdr(), incnt);
+ dsp_setup(thisHdr(),insigs); // signal inlets
}
#else
#error
#endif
- delete inlist; inlist = NULL;
-
- delete[] list;
-
return ok;
}
bool flext_base::InitOutlets()
{
bool ok = true;
+ int procattr = HasAttributes()?1:0;
+
+ // outcnt has number of inlets (any type)
+ // outsigs should be 0
+
+ FLEXT_ASSERT(outsigs == 0);
// ----------------------------------
// create outlets
// ----------------------------------
- outcnt = outsigs = 0;
-
#if FLEXT_SYS == FLEXT_SYS_MAX
// for Max/MSP the rightmost outlet has to be created first
outlet *attrtmp = NULL;
@@ -304,104 +255,58 @@ bool flext_base::InitOutlets()
attrtmp = (outlet *)newout_anything(thisHdr());
#endif
- // digest outlist
- {
- xlet *xi;
-
- // count outlets
- outcnt = 0;
- for(xi = outlist; xi; xi = xi->nxt) ++outcnt;
-
- xlet::type *list = new xlet::type[outcnt];
- int i;
- for(xi = outlist,i = 0; xi; xi = xi->nxt,++i) list[i] = xi->tp;
-
#if FLEXT_SYS == FLEXT_SYS_MAX
- // copy outlet descriptions
- outdesc = new char *[outcnt];
- for(xi = outlist,i = 0; xi; xi = xi->nxt,++i) {
- int l = xi->desc?strlen(xi->desc):0;
- if(l) {
- outdesc[i] = new char[l+1];
- memcpy(outdesc[i],xi->desc,l);
- outdesc[i][l] = 0;
- }
- else
- outdesc[i] = NULL;
- }
+ // copy outlet descriptions
+ outdesc = new char *[outcnt];
+ for(int i = 0; i < outcnt; ++i) {
+ xlet &xi = outlist[i];
+ outdesc[i] = xi.desc;
+ xi.desc = NULL;
+ }
#endif
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
- outlets = new outlet *[outcnt+(procattr?1:0)];
+ outlets = new outlet *[outcnt+procattr];
- // type info is now in list array
+ // type info is now in list array
#if FLEXT_SYS == FLEXT_SYS_PD
- for(int ix = 0; ix < outcnt; ++ix)
+ for(int ix = 0; ix < outcnt; ++ix)
#elif FLEXT_SYS == FLEXT_SYS_MAX
- for(int ix = outcnt-1; ix >= 0; --ix)
+ for(int ix = outcnt-1; ix >= 0; --ix)
#else
#error
#endif
- {
- switch(list[ix]) {
- case xlet::tp_float:
- outlets[ix] = (outlet *)newout_float(&x_obj->obj);
- break;
- case xlet::tp_int:
- outlets[ix] = (outlet *)newout_flint(&x_obj->obj);
- break;
- case xlet::tp_sig:
- outlets[ix] = (outlet *)newout_signal(&x_obj->obj);
- ++outsigs;
- break;
- case xlet::tp_sym:
- outlets[ix] = (outlet *)newout_symbol(&x_obj->obj);
- break;
- case xlet::tp_list:
- outlets[ix] = (outlet *)newout_list(&x_obj->obj);
- break;
- case xlet::tp_any:
- outlets[ix] = (outlet *)newout_anything(&x_obj->obj);
- break;
-#ifdef FLEXT_DEBUG
- default:
- ERRINTERNAL();
- ok = false;
-#endif
- }
- }
-#elif FLEXT_SYS == FLEXT_SYS_JMAX
- t_class *cl = thisClass();
- for(int ix = 0; ix < outcnt; ++ix) {
- switch(list[ix]) {
- case xlet::tp_float:
- case xlet::tp_int:
-// fts_class_outlet_number(cl, ix);
- break;
- case xlet::tp_sym:
-// fts_class_outlet_symbol(cl, ix);
- break;
- case xlet::tp_list:
- case xlet::tp_any:
-// fts_class_outlet_anything(cl, ix);
- break;
- case xlet::tp_sig:
- if(!outsigs) fts_dsp_declare_outlet(cl,0);
- ++outsigs;
- break;
+ {
+ switch(outlist[ix].tp) {
+ case xlet_float:
+ outlets[ix] = (outlet *)newout_float(&x_obj->obj);
+ break;
+ case xlet_int:
+ outlets[ix] = (outlet *)newout_flint(&x_obj->obj);
+ break;
+ case xlet_sig:
+ outlets[ix] = (outlet *)newout_signal(&x_obj->obj);
+ ++outsigs;
+ break;
+ case xlet_sym:
+ outlets[ix] = (outlet *)newout_symbol(&x_obj->obj);
+ break;
+ case xlet_list:
+ outlets[ix] = (outlet *)newout_list(&x_obj->obj);
+ break;
+ case xlet_any:
+ outlets[ix] = (outlet *)newout_anything(&x_obj->obj);
+ break;
#ifdef FLEXT_DEBUG
- default:
- ERRINTERNAL();
- ok = false;
+ default:
+ ERRINTERNAL();
+ ok = false;
#endif
- }
- }
-
- fts_object_set_outlets_number((fts_object_t *)thisHdr(), outcnt+(procattr?1:0));
-#endif
-
- delete[] list;
+ }
}
+#else
+#error
+#endif
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
if(procattr) {
@@ -417,8 +322,6 @@ bool flext_base::InitOutlets()
}
#endif
- delete outlist; outlist = NULL;
-
return ok;
}
diff --git a/externals/grill/flext/source/fltimer.cpp b/externals/grill/flext/source/fltimer.cpp
index c33716e5..d9bf3cc1 100755
--- a/externals/grill/flext/source/fltimer.cpp
+++ b/externals/grill/flext/source/fltimer.cpp
@@ -50,11 +50,20 @@ double flext::GetTimeGrain()
#endif
}
+#if FLEXT_OS == FLEXT_OS_WIN
+static double perffrq = 0;
+#endif
+
static double getstarttime();
static double starttime = getstarttime();
static double getstarttime()
{
+#if FLEXT_OS == FLEXT_OS_WIN
+ LARGE_INTEGER frq;
+ if(QueryPerformanceFrequency(&frq)) perffrq = (double)frq.QuadPart;
+#endif
+
starttime = 0;
return flext::GetOSTime();
}
@@ -64,15 +73,15 @@ double flext::GetOSTime()
double tm;
#if FLEXT_OS == FLEXT_OS_WIN
- LARGE_INTEGER frq,cnt;
- if(QueryPerformanceFrequency(&frq) && QueryPerformanceCounter(&cnt))
- tm = (double)(cnt.QuadPart)/frq.QuadPart;
+ LARGE_INTEGER cnt;
+ if(perffrq && QueryPerformanceCounter(&cnt))
+ tm = cnt.QuadPart/perffrq;
else {
SYSTEMTIME systm;
FILETIME fltm;
GetSystemTime(&systm);
SystemTimeToFileTime(&systm,&fltm);
- tm = (double)((LARGE_INTEGER *)&fltm)->QuadPart*0.001;
+ tm = ((LARGE_INTEGER *)&fltm)->QuadPart*1.e-7;
}
#elif FLEXT_OS == FLEXT_OS_LINUX || FLEXT_OS == FLEXT_OS_IRIX || FLEXT_OSAPI == FLEXT_OSAPI_MAC_MACH // POSIX
timeval tmv;
@@ -90,8 +99,39 @@ double flext::GetOSTime()
void flext::Sleep(double s)
{
+ if(s <= 0) return;
#if FLEXT_OS == FLEXT_OS_WIN
- ::Sleep((long)(s*1000.));
+#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x400
+#if 0
+ LARGE_INTEGER liDueTime;
+ liDueTime.QuadPart = (LONGLONG)(-1.e7*s);
+
+ // Create a waitable timer.
+ HANDLE hTimer = CreateWaitableTimer(NULL,TRUE,NULL);
+ if(hTimer) {
+ if(SetWaitableTimer(hTimer,&liDueTime,0,NULL,NULL,0))
+ // Wait for the timer.
+ WaitForSingleObject(hTimer,INFINITE); // != WAIT_OBJECT_0)
+ else
+ ::Sleep((long)(s*1000.));
+ CloseHandle(hTimer);
+ }
+ else
+#else
+ LARGE_INTEGER cnt;
+ if(perffrq && QueryPerformanceCounter(&cnt)) {
+ LONGLONG dst = (LONGLONG)(cnt.QuadPart+perffrq*s);
+ for(;;) {
+ SwitchToThread(); // while waiting switch to another thread
+ QueryPerformanceCounter(&cnt);
+ if(cnt.QuadPart > dst) break;
+ }
+ }
+ else
+#endif
+#endif
+ // last resort....
+ ::Sleep((long)(s*1000.));
#elif FLEXT_OS == FLEXT_OS_LINUX || FLEXT_OS == FLEXT_OS_IRIX || FLEXT_OSAPI == FLEXT_OSAPI_MAC_MACH // POSIX
usleep((long)(s*1000000.));
#elif FLEXT_OS == FLEXT_OS_MAC // that's just for OS9 & Carbon!
@@ -234,14 +274,12 @@ void flext::Timer::callback(Timer *tmr)
#endif
}
- if(tmr->cback) {
#if FLEXT_SYS == FLEXT_SYS_MAX
- if(tmr->queued)
- qelem_set(tmr->qelem);
- else
+ if(tmr->queued)
+ qelem_set(tmr->qelem);
+ else
#endif
- tmr->Work();
- }
+ tmr->Work();
}
#if FLEXT_SYS == FLEXT_SYS_MAX
@@ -255,9 +293,11 @@ void flext::Timer::queuefun(Timer *tmr) { tmr->Work(); }
*/
void flext::Timer::Work()
{
- if(clss)
- ((bool (*)(flext_base *,void *))cback)(clss,userdata);
- else
- cback(userdata);
+ if(cback) {
+ if(clss)
+ ((bool (*)(flext_base *,void *))cback)(clss,userdata);
+ else
+ cback(userdata);
+ }
}
diff --git a/externals/grill/flext/source/flxlet.cpp b/externals/grill/flext/source/flxlet.cpp
index b3ef7f86..f8f26b3b 100755
--- a/externals/grill/flext/source/flxlet.cpp
+++ b/externals/grill/flext/source/flxlet.cpp
@@ -17,57 +17,71 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include <string.h>
#include <stdarg.h>
+#define MAXLETS 256
-flext_base::xlet::xlet(type t,const char *d):
- tp(t),nxt(NULL)
-{
- if(d) {
- size_t ln = strlen(d);
- desc = new char[ln+1];
- memcpy(desc,d,ln);
- desc[ln] = 0;
+flext_base::xlet flext_base::inlist[MAXLETS],flext_base::outlist[MAXLETS];
+
+
+void flext_base::xlet::Desc(const char *c)
+{
+ if(desc) delete[] desc;
+ if(c) {
+ size_t l = strlen(c);
+ desc = new char[l+1];
+ memcpy(desc,c,l+1);
}
- else desc = NULL;
+ else
+ desc = NULL;
}
-flext_base::xlet::~xlet()
-{
- if(desc) delete[] desc;
- if(nxt) delete nxt;
+void flext_base::AddInlet(xlettype tp,int mult,const char *desc)
+{
+ if(incnt+mult >= MAXLETS)
+ post("%s - too many inlets",thisName());
+ else
+ for(int i = 0; i < mult; ++i) {
+ xlet &x = inlist[incnt++];
+ x.tp = tp;
+ x.Desc(desc);
+ }
}
-void flext_base::AddXlet(xlet::type tp,int mult,const char *desc,xlet *&root)
+void flext_base::AddOutlet(xlettype tp,int mult,const char *desc)
{
- if(!root && mult) { root = new xlet(tp,desc); --mult; }
- if(mult) {
- xlet *xi = root;
- while(xi->nxt) xi = xi->nxt;
- while(mult--) xi = xi->nxt = new xlet(tp,desc);
- }
+ if(outcnt+mult >= MAXLETS)
+ post("%s - too many outlets",thisName());
+ else
+ for(int i = 0; i < mult; ++i) {
+ xlet &x = outlist[outcnt++];
+ x.tp = tp;
+ x.Desc(desc);
+ }
}
-void flext_base::DescXlet(int ix,const char *d,xlet *&root)
+void flext_base::DescInlet(int ix,const char *d)
{
- xlet *xi = root;
- for(int i = 0; xi && i < ix; xi = xi->nxt,++i) {}
-
- if(xi) {
- if(xi->desc) delete[] xi->desc;
- size_t ln = strlen(d);
- xi->desc = new char[ln+1];
- memcpy(xi->desc,d,ln);
- xi->desc[ln] = 0;
- }
+ if(ix >= incnt)
+ post("%s - inlet %i not found",thisName(),ix);
+ else
+ inlist[ix].Desc(d);
+}
+
+void flext_base::DescOutlet(int ix,const char *d)
+{
+ if(ix >= outcnt)
+ post("%s - outlet %i not found",thisName(),ix);
+ else
+ outlist[ix].Desc(d);
}
-unsigned long flext_base::XletCode(xlet::type tp,...)
+unsigned long flext_base::XletCode(xlettype tp,...)
{
unsigned long code = 0;
va_list marker;
va_start(marker,tp);
int cnt = 0;
- xlet::type arg = tp;
+ xlettype arg = tp;
for(; arg; ++cnt) {
#ifdef FLEXT_DEBUG
if(cnt > 9) {
@@ -77,7 +91,7 @@ unsigned long flext_base::XletCode(xlet::type tp,...)
#endif
code = code*10+(int)arg;
- arg = (xlet::type)va_arg(marker,int);
+ arg = (xlettype)va_arg(marker,int);
}
va_end(marker);
@@ -86,11 +100,11 @@ unsigned long flext_base::XletCode(xlet::type tp,...)
void flext_base::AddInlets(unsigned long code)
{
- for(; code; code /= 10) AddInlet((xlet::type)(code%10));
+ for(; code; code /= 10) AddInlet((xlettype)(code%10));
}
void flext_base::AddOutlets(unsigned long code)
{
- for(; code; code /= 10) AddOutlet((xlet::type)(code%10));
+ for(; code; code /= 10) AddOutlet((xlettype)(code%10));
}