From 2d5dcb761ca0fda72dc58669f758d90223611f3a Mon Sep 17 00:00:00 2001
From: Thomas Grill <xovo@users.sourceforge.net>
Date: Thu, 22 Feb 2007 00:15:15 +0000
Subject: PD: possibility to create DSP objects without main DSP inlet (use
 FLEXT_DSP0_NEW or similar) switching OSX builds to -bundle to avoid symbol
 clashes for different flext versions small fix for branch hints

svn path=/trunk/; revision=7441
---
 externals/grill/flext/source/flclass.h        |  1 +
 externals/grill/flext/source/fldefs_methadd.h |  7 +++++--
 externals/grill/flext/source/flmeth.cpp       |  4 ++++
 externals/grill/flext/source/flmsg.cpp        | 14 +++++++++++---
 externals/grill/flext/source/flprefix.h       | 20 ++++++++++++++------
 5 files changed, 35 insertions(+), 11 deletions(-)

(limited to 'externals/grill/flext/source')

diff --git a/externals/grill/flext/source/flclass.h b/externals/grill/flext/source/flclass.h
index 66fa55d2..3da63719 100644
--- a/externals/grill/flext/source/flclass.h
+++ b/externals/grill/flext/source/flclass.h
@@ -866,6 +866,7 @@ public:
 	ItemCont *ThMeths() { if(!methhead) methhead = new ItemCont; return methhead; }
 	static ItemCont *ClMeths(t_classid c);
 
+	//! \brief This is the central function to add message handlers. It is used by all other AddMethod incarnations.
 	static void AddMethod(ItemCont *ma,int inlet,const t_symbol *tag,methfun fun,metharg tp,...); 
 
 	ItemCont *ThAttrs() { return attrhead; }
diff --git a/externals/grill/flext/source/fldefs_methadd.h b/externals/grill/flext/source/fldefs_methadd.h
index e1ab66b4..0798f702 100644
--- a/externals/grill/flext/source/fldefs_methadd.h
+++ b/externals/grill/flext/source/fldefs_methadd.h
@@ -23,13 +23,16 @@ WARRANTIES, see the file, "license.txt," in this distribution.
     @{ 
 */
 
-//! Add a method handler for bang 
+/*! Add a method handler for bang 
+    \note This is for compatibility - better use the method below
+*/
 #define FLEXT_CADDBANG(CL,IX,M_FUN) \
 \
-AddMethod(CL,IX,flext::sym_bang,FLEXT_CALL_PRE(M_FUN))   
+AddMethod(CL,IX,FLEXT_CALL_PRE(M_FUN))   
 
 //! Add a handler for a method with either no, list or anything arguments
 #define FLEXT_CADDMETHOD(CL,IX,M_FUN) \
+\
 AddMethod(CL,IX,FLEXT_CALL_PRE(M_FUN))  
 
 //! Add a a handler for a method with implicit arguments
diff --git a/externals/grill/flext/source/flmeth.cpp b/externals/grill/flext/source/flmeth.cpp
index c538922b..6355dd08 100755
--- a/externals/grill/flext/source/flmeth.cpp
+++ b/externals/grill/flext/source/flmeth.cpp
@@ -39,6 +39,10 @@ void flext_base::MethItem::SetArgs(methfun _fun,int _argc,metharg *_args)
 */
 void flext_base::AddMethod(ItemCont *ma,int inlet,const t_symbol *tag,methfun fun,metharg tp,...)
 {
+#ifdef FLEXT_LOG_MSGS
+	post("addmethod %i:%s",inlet,GetString(tag));
+#endif
+
     va_list marker; 
 
     // at first just count the arg type list (in argc)
diff --git a/externals/grill/flext/source/flmsg.cpp b/externals/grill/flext/source/flmsg.cpp
index 2fd06652..1d42b5fb 100755
--- a/externals/grill/flext/source/flmsg.cpp
+++ b/externals/grill/flext/source/flmsg.cpp
@@ -131,7 +131,7 @@ bool flext_base::FindMeth(int inlet,const t_symbol *s,int argc,const t_atom *arg
     if((lst = clmethhead->FindList(s,inlet)) != NULL && TryMethTag(lst,s,argc,argv)) return true;
 
     // if nothing found try any inlet
-    if(methhead && (lst = methhead->FindList(s,-1)) != NULL && TryMethTag(lst,s,argc,argv)) return true;
+    if(UNLIKELY(methhead) && (lst = methhead->FindList(s,-1)) != NULL && TryMethTag(lst,s,argc,argv)) return true;
     if((lst = clmethhead->FindList(s,-1)) != NULL && TryMethTag(lst,s,argc,argv)) return true;
 
     return false;
@@ -146,7 +146,7 @@ bool flext_base::FindMethAny(int inlet,const t_symbol *s,int argc,const t_atom *
     if((lst = clmethhead->FindList(sym_anything,inlet)) != NULL && TryMethAny(lst,s,argc,argv)) return true;
 
     // if nothing found try any inlet
-    if(methhead && (lst = methhead->FindList(sym_anything,-1)) != NULL && TryMethAny(lst,s,argc,argv)) return true;
+    if(UNLIKELY(methhead) && (lst = methhead->FindList(sym_anything,-1)) != NULL && TryMethAny(lst,s,argc,argv)) return true;
     if((lst = clmethhead->FindList(sym_anything,-1)) != NULL && TryMethAny(lst,s,argc,argv)) return true;
 
     return false;
@@ -162,10 +162,15 @@ bool flext_base::CbMethodHandler(int inlet,const t_symbol *s,int argc,const t_at
 
     curtag = s;
 
-//  post("methodmain inlet:%i args:%i symbol:%s",inlet,argc,s?GetString(s):"");
+#ifdef FLEXT_LOG_MSGS
+	post("methodmain inlet:%i args:%i symbol:%s",inlet,argc,s?GetString(s):"");
+#endif
 
     try {
         ret = FindMeth(inlet,s,argc,argv);
+#ifdef FLEXT_LOG_MSGS
+		if(ret) post("found %s message in %s,%i",GetString(s),__FILE__,__LINE__);
+#endif
         if(ret) goto end;
 
         if(argc == 1) {
@@ -225,6 +230,9 @@ bool flext_base::CbMethodHandler(int inlet,const t_symbol *s,int argc,const t_at
             t_atom at;
             SetSymbol(at,s);
             ret = FindMeth(inlet,sym_list,1,&at);
+#ifdef FLEXT_LOG_MSGS
+			if(ret) post("found %s message in %s,%i",GetString(sym_list),__FILE__,__LINE__);
+#endif
             if(ret) goto end;
         }
 
diff --git a/externals/grill/flext/source/flprefix.h b/externals/grill/flext/source/flprefix.h
index 490899de..094dacf7 100755
--- a/externals/grill/flext/source/flprefix.h
+++ b/externals/grill/flext/source/flprefix.h
@@ -407,18 +407,26 @@ WARRANTIES, see the file, "license.txt," in this distribution.
 
 // std namespace
 #ifdef __MWERKS__
-#define STD std
+#	define STD std
 #else
-#define STD
+#	define STD
 #endif
 
 // branching hints
 #ifdef __GNUC__
-#define LIKELY(expression) (__builtin_expect(!!(expression), 1))
-#define UNLIKELY(expression) (__builtin_expect(!!(expression), 0))
+#	ifndef LIKELY
+#		define LIKELY(expression) (__builtin_expect(!!(expression), 1))
+#	endif
+#	ifndef UNLIKELY
+#		define UNLIKELY(expression) (__builtin_expect(!!(expression), 0))
+#	endif
 #else
-#define LIKELY(expression) (expression)
-#define UNLIKELY(expression) (expression)
+#	ifndef LIKELY
+#		define LIKELY(expression) (expression)
+#	endif
+#	ifndef UNLIKELY
+#		define UNLIKELY(expression) (expression)
+#	endif
 #endif
 
 
-- 
cgit v1.2.1