aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/source
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2003-09-24 02:40:50 +0000
committerThomas Grill <xovo@users.sourceforge.net>2003-09-24 02:40:50 +0000
commitb1ab45bd09c01f9ec61e0017ebe42af1a8bf0f6d (patch)
tree352867c77c959f4d0e85b559dee84708e9ab29a6 /externals/grill/flext/source
parent8c5eb1bcbbf8156dc3211cb1c33974b6bb0df1ec (diff)
""
svn path=/trunk/; revision=1022
Diffstat (limited to 'externals/grill/flext/source')
-rw-r--r--externals/grill/flext/source/flclass.h15
-rwxr-xr-xexternals/grill/flext/source/fllib.cpp8
-rw-r--r--externals/grill/flext/source/flsupport.cpp16
-rw-r--r--externals/grill/flext/source/flsupport.h98
4 files changed, 85 insertions, 52 deletions
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);