From b1ab45bd09c01f9ec61e0017ebe42af1a8bf0f6d Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Wed, 24 Sep 2003 02:40:50 +0000 Subject: "" svn path=/trunk/; revision=1022 --- externals/grill/flext/changes.txt | 1 + externals/grill/flext/config-pd-linux.txt | 5 +- externals/grill/flext/makefile.pd-linux | 31 +++++----- externals/grill/flext/source/flclass.h | 15 +++-- externals/grill/flext/source/fllib.cpp | 8 ++- externals/grill/flext/source/flsupport.cpp | 16 ++--- externals/grill/flext/source/flsupport.h | 98 ++++++++++++++++++------------ 7 files changed, 104 insertions(+), 70 deletions(-) (limited to 'externals/grill/flext') diff --git a/externals/grill/flext/changes.txt b/externals/grill/flext/changes.txt index 207bb364..6493764b 100644 --- a/externals/grill/flext/changes.txt +++ b/externals/grill/flext/changes.txt @@ -33,6 +33,7 @@ Version history: - added flext::NewLarge and flext::FreeLarge memory allocation functions which use the C-Library heap and should mainly be used in secondary threads - flext_dsp reported wrong inlet/outlet count (CntInSig, CntOutSig functions) - added support for patcher arguments for attributes (use # instead of $ to save them with a patch) +- moved memory functions and console output from flext to super-base-class flext_root and derived all helper classes from that 0.4.4: - fixed deadly bug for Max/MSP method-to-symbol-binding proxies diff --git a/externals/grill/flext/config-pd-linux.txt b/externals/grill/flext/config-pd-linux.txt index 254e9171..6962affc 100644 --- a/externals/grill/flext/config-pd-linux.txt +++ b/externals/grill/flext/config-pd-linux.txt @@ -12,7 +12,7 @@ PDPATH=/usr/src/pd-0.37-0/src # where is the SndObj include directory? # (leave blank or comment out to disable SndObj support) -SNDOBJ=/usr/local/include/SndObj +SNDOBJ=/usr/local/include #/SndObj # where is the STK include directory? # (leave blank or comment out to disable STK support) @@ -30,6 +30,3 @@ INSTDIR=/usr/local/lib/pd/flext # UFLAGS=-mcpu=pentiumpro # gcc 2.95 # UFLAGS=-mcpu=pentium3 -msse # gcc 3.2 -# define to use old library naming for backwards compatibility (to externals depending on flext versions < 0.5) -# ("flext.a" instead of new "libflext.a" etc.) -V4_NAMING=1 diff --git a/externals/grill/flext/makefile.pd-linux b/externals/grill/flext/makefile.pd-linux index 8131f25a..a5a3e241 100644 --- a/externals/grill/flext/makefile.pd-linux +++ b/externals/grill/flext/makefile.pd-linux @@ -19,7 +19,7 @@ INCLUDES=${PDPATH} FLAGS=-DFLEXT_SYS=2 ${UFLAGS} # compiler flags for optimized build -CFLAGS=-O6 +CFLAGS=-O2 # compiler flags for debug build CFLAGS_D=-g @@ -31,7 +31,8 @@ CFLAGS_T=-DFLEXT_THREADS CFLAGS_S=-DFLEXT_SHARED -DFLEXT_EXPORTS # libraries -LIBS= +# it seems like libstdc++ must be defined for icc.... +LIBS=stdc++ # ---------------------------------------------- # the rest can stay untouched @@ -59,20 +60,22 @@ endif MAKEFILE=makefile.pd-linux -ifdef V4_NAMING -TARGET=${TARGDIR}/${NAME}.a -TARGET_D=${TARGDIR}/${NAME}_d.a -TARGET_T=${TARGDIR}/${NAME}_t.a -TARGET_TD=${TARGDIR}/${NAME}_td.a +# invoke dynamic linking +ifeq ($(CXX),icc) +DYNAMIC=-i_dynamic else +DYNAMIC=-Wl,-Bdynamic +endif + + TARGET=${TARGDIR}/lib${NAME}.a TARGET_D=${TARGDIR}/lib${NAME}_d.a TARGET_T=${TARGDIR}/lib${NAME}_t.a TARGET_TD=${TARGDIR}/lib${NAME}_td.a -endif TARGET_S=${TARGDIR}/lib${NAME}.so TARGET_SD=${TARGDIR}/lib${NAME}_d.so + all: $(TARGDIR) $(TARGET) $(TARGET_D) $(TARGET_T) $(TARGET_TD) $(TARGET_S) $(TARGET_SD) $(TARGDIR): @@ -94,16 +97,16 @@ $(TARGDIR)/%.tdo : $(SRCDIR)/%.cpp $(CXX) -c $(CFLAGS_D) $(CFLAGS_T) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $< -o $@ $(TARGDIR)/%.sro : $(SRCDIR)/%.cpp - $(CXX) -c $(CFLAGS) $(CFLAGS_T) $(CFLAGS_S) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $< -o $@ + $(CXX) -shared -c $(CFLAGS) $(CFLAGS_T) $(CFLAGS_S) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $< -o $@ $(TARGDIR)/%.sdo : $(SRCDIR)/%.cpp - $(CXX) -c $(CFLAGS_D) $(CFLAGS_T) $(CFLAGS_S) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $< -o $@ + $(CXX) -shared -c $(CFLAGS_D) $(CFLAGS_T) $(CFLAGS_S) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $< -o $@ $(TARGET) : $(patsubst %.cpp,$(TARGDIR)/%.ro,$(SRCS)) - ar rc $@ $^ + ar rc $@ $^ chmod 644 $@ $(TARGET_D) : $(patsubst %.cpp,$(TARGDIR)/%.do,$(SRCS)) @@ -119,11 +122,11 @@ $(TARGET_TD) : $(patsubst %.cpp,$(TARGDIR)/%.tdo,$(SRCS)) chmod 644 $@ $(TARGET_S) : $(patsubst %.cpp,$(TARGDIR)/%.sro,$(SRCS)) - ld -shared -Bdynamic --strip-debug $(patsubst %,-L%,$(LIBPATH)) $(patsubst %,-l%,$(LIBS)) -o $@ $^ + $(CXX) -shared $(DYNAMIC) -Wl,--strip-debug $(patsubst %,-L%,$(LIBPATH)) -o $@ $^ $(patsubst %,-l%,$(LIBS)) chmod 755 $@ $(TARGET_SD) : $(patsubst %.cpp,$(TARGDIR)/%.sdo,$(SRCS)) - ld -shared -Bdynamic $(patsubst %,-L%,$(LIBPATH)) $(patsubst %,-l%,$(LIBS)) -o $@ $^ + $(CXX) -shared $(DYNAMIC) $(patsubst %,-L%,$(LIBPATH)) -o $@ $^ $(patsubst %,-l%,$(LIBS)) chmod 755 $@ @@ -141,6 +144,6 @@ endif install:: $(TARGET) $(TARGET_D) $(TARGET_T) $(TARGET_TD) $(TARGET_S) $(TARGET_SD) $(patsubst %,$(SRCDIR)/%,$(HDRS)) cp $^ $(INSTDIR) + for i in $(foreach f,$(notdir $(filter %.a,$^)),$(patsubst lib%.a,%,$(f))); do rm -f $(INSTDIR)/$$i.a && ln -sf lib$$i.a $(INSTDIR)/$$i.a; done chmod a+r $(patsubst %,$(INSTDIR)/%,$(notdir $^)) chown root.users $(patsubst %,$(INSTDIR)/%,$(notdir $^)) - diff --git a/externals/grill/flext/source/flclass.h b/externals/grill/flext/source/flclass.h index 6bdd55d5..fa5337b7 100644 --- a/externals/grill/flext/source/flclass.h +++ b/externals/grill/flext/source/flclass.h @@ -591,7 +591,9 @@ protected: class AttrItem; - class Item { + class Item: + public flext_root + { public: Item(const t_symbol *t,int inl,AttrItem *a); virtual ~Item(); @@ -605,7 +607,9 @@ protected: }; //! This class holds hashed item entries - class ItemCont { + class ItemCont: + public flext_root + { public: ItemCont(); ~ItemCont(); @@ -685,7 +689,8 @@ protected: }; //! Represent a data value of an attribute - class AttrData + class AttrData: + public flext_root { public: AttrData(): flags(0) {} @@ -900,7 +905,9 @@ private: static t_class *pxbnd_class; - class pxbnd_object // no virtual table! + class pxbnd_object: + public flext_root + // no virtual table! { public: t_object obj; // MUST reside at memory offset 0 diff --git a/externals/grill/flext/source/fllib.cpp b/externals/grill/flext/source/fllib.cpp index 65d71cc5..6d9c32cd 100755 --- a/externals/grill/flext/source/fllib.cpp +++ b/externals/grill/flext/source/fllib.cpp @@ -104,7 +104,9 @@ 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 libclass: + public flext_root +{ public: libclass(t_class *&cl,flext_obj *(*newf)(int,t_atom *),void (*freef)(flext_hdr *)); @@ -126,7 +128,9 @@ libclass::libclass(t_class *&cl,flext_obj *(*newf)(int,t_atom *),void (*freef)(f // this class stands for one registered object name // it holds a pointer to the respective object // it will never be destroyed -class libname { +class libname: + public flext_root +{ public: const t_symbol *name; libclass *obj; diff --git a/externals/grill/flext/source/flsupport.cpp b/externals/grill/flext/source/flsupport.cpp index ab0d871e..7b30a2b8 100644 --- a/externals/grill/flext/source/flsupport.cpp +++ b/externals/grill/flext/source/flsupport.cpp @@ -79,7 +79,7 @@ void flext::Setup() // ///////////////////////////////////////////////////////// -void *flext::operator new(size_t bytes) +void *flext_root::operator new(size_t bytes) { bytes += sizeof(size_t); @@ -98,7 +98,7 @@ void *flext::operator new(size_t bytes) return blk+sizeof(size_t); } -void flext::operator delete(void *blk) +void flext_root::operator delete(void *blk) { char *ori = (char *)blk-sizeof(size_t); #if FLEXT_SYS == FLEXT_SYS_JMAX @@ -109,7 +109,7 @@ void flext::operator delete(void *blk) #endif } -void *flext::NewAligned(size_t bytes,int bitalign) +void *flext_root::NewAligned(size_t bytes,int bitalign) { const size_t ovh = sizeof(size_t)+sizeof(char *); const unsigned long alignovh = bitalign/8-1; @@ -125,7 +125,7 @@ void *flext::NewAligned(size_t bytes,int bitalign) return ablk; } -void flext::FreeAligned(void *blk) +void flext_root::FreeAligned(void *blk) { char *ori = *(char **)((char *)blk-sizeof(size_t)-sizeof(char *)); @@ -182,10 +182,10 @@ int flext::Int2Bits(unsigned long n) } -void flext::post(const char *fmt, ...) +void flext_root::post(const char *fmt, ...) { #ifdef FLEXT_THREADS - static ThrMutex mutex; + static flext::ThrMutex mutex; mutex.Lock(); #endif va_list ap; @@ -204,10 +204,10 @@ void flext::post(const char *fmt, ...) #endif } -void flext::error(const char *fmt,...) +void flext_root::error(const char *fmt,...) { #ifdef FLEXT_THREADS - static ThrMutex mutex; + static flext::ThrMutex mutex; mutex.Lock(); #endif va_list ap; diff --git a/externals/grill/flext/source/flsupport.h b/externals/grill/flext/source/flsupport.h index c4331df4..f336d0de 100644 --- a/externals/grill/flext/source/flsupport.h +++ b/externals/grill/flext/source/flsupport.h @@ -17,43 +17,17 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include "flstdc.h" -class FLEXT_SHARE FLEXT_CLASSDEF(flext); -typedef class FLEXT_CLASSDEF(flext) flext; -class FLEXT_SHARE FLEXT_CLASSDEF(flext_base); - -/*! \brief Flext support class +class FLEXT_SHARE FLEXT_CLASSDEF(flext_root); +typedef class FLEXT_CLASSDEF(flext_root) flext_root; - A number of methods (most are static functions) are defined here for convenience. - This class doesn't define any data members, hence it can be inherited to all - classes (not only PD objects) to profit from the cross-platform functionality. - Examples are the overloaded memory allocation, atom and atom list functions, - thread functions and classes, the sample buffer class and others. +/*! \brief Flext root support class - This class can also be used for a non-object class (not representing an external object) - and won't give any extra burden to it. + Moved memory functions and console output here so that all the classes + contained in flext can use them */ - -class FLEXT_SHARE FLEXT_CLASSDEF(flext) { - - /*! \defgroup FLEXT_SUPPORT Flext support class - @{ - */ +class FLEXT_SHARE FLEXT_CLASSDEF(flext_root) { public: - -// --- version ----------------------------------------------- - - /*! \brief Flext version number - - Return the version number of the flext library. - For statically linked flext this is identical to the header definition FLEXT_VERSION, - otherwise it reflects the version number of the shared flext library. - */ - static int Version(); - - //! Flext version string - static const char *VersionStr(); - // --- console output ----------------------------------------------- //! post message to console @@ -96,6 +70,48 @@ public: //! @} FLEXT_S_MEMORY +}; + + +class FLEXT_SHARE FLEXT_CLASSDEF(flext); +typedef class FLEXT_CLASSDEF(flext) flext; + +class FLEXT_SHARE FLEXT_CLASSDEF(flext_base); + +/*! \brief Flext support class + + A number of methods (most are static functions) are defined here for convenience. + This class doesn't define any data members, hence it can be inherited to all + classes (not only PD objects) to profit from the cross-platform functionality. + Examples are the overloaded memory allocation, atom and atom list functions, + thread functions and classes, the sample buffer class and others. + + This class can also be used for a non-object class (not representing an external object) + and won't give any extra burden to it. +*/ + +class FLEXT_SHARE FLEXT_CLASSDEF(flext): + public flext_root +{ + + /*! \defgroup FLEXT_SUPPORT Flext support class + @{ + */ +public: + +// --- version ----------------------------------------------- + + /*! \brief Flext version number + + Return the version number of the flext library. + For statically linked flext this is identical to the header definition FLEXT_VERSION, + otherwise it reflects the version number of the shared flext library. + */ + static int Version(); + + //! Flext version string + static const char *VersionStr(); + // --- buffer/array stuff ----------------------------------------- /*! \defgroup FLEXT_S_BUFFER Buffer handling @@ -106,7 +122,8 @@ public: #if FLEXT_SYS != FLEXT_SYS_JMAX //! Class for platform independent buffer handling - class FLEXT_SHARE buffer + class FLEXT_SHARE buffer: + public flext_root { public: /*! \brief Construct buffer. @@ -470,7 +487,8 @@ public: // --- atom list stuff ------------------------------------------- //! Class representing a list of atoms - class FLEXT_SHARE AtomList + class FLEXT_SHARE AtomList: + public flext_root { public: //! Construct list @@ -652,7 +670,8 @@ public: /*! \brief Thread parameters \internal */ - class FLEXT_SHARE thr_params + class FLEXT_SHARE thr_params: + public flext_root { public: thr_params(int n = 1); @@ -676,7 +695,8 @@ public: /*! \brief This represents an entry to the list of active method threads \internal */ - class FLEXT_SHARE thr_entry + class FLEXT_SHARE thr_entry: + public flext_root { public: thr_entry(void (*m)(thr_params *),thr_params *p,thrid_t id = GetThreadId()); @@ -752,7 +772,8 @@ public: /*! \brief Thread mutex \sa pthreads documentation */ - class FLEXT_SHARE ThrMutex + class FLEXT_SHARE ThrMutex: + public flext_root #if FLEXT_THREADS == FLEXT_THR_POSIX { public: @@ -921,7 +942,8 @@ public: /*! \brief Class encapsulating a timer with callback functionality. This class can either be used with FLEXT_ADDTIMER or used as a base class with an overloaded virtual Work function. */ - class FLEXT_SHARE Timer + class FLEXT_SHARE Timer: + public flext_root { public: Timer(bool queued = false); -- cgit v1.2.1