diff options
Diffstat (limited to 'externals/grill/flext')
-rw-r--r-- | externals/grill/flext/changes.txt | 5 | ||||
-rw-r--r-- | externals/grill/flext/config-pd-msvc.txt | 5 | ||||
-rw-r--r-- | externals/grill/flext/make-inc.pd-msvc | 2 | ||||
-rw-r--r-- | externals/grill/flext/source/flbase.cpp | 4 | ||||
-rw-r--r-- | externals/grill/flext/source/flbase.h | 24 | ||||
-rw-r--r-- | externals/grill/flext/source/flclass.h | 17 | ||||
-rw-r--r-- | externals/grill/flext/source/fldsp.cpp | 4 | ||||
-rw-r--r-- | externals/grill/flext/source/fldsp.h | 12 | ||||
-rw-r--r-- | externals/grill/flext/source/flext.cpp | 4 | ||||
-rwxr-xr-x | externals/grill/flext/source/fllib.cpp | 2 | ||||
-rwxr-xr-x | externals/grill/flext/source/flprefix.h | 55 | ||||
-rw-r--r-- | externals/grill/flext/source/flsupport.cpp | 2 | ||||
-rw-r--r-- | externals/grill/flext/source/flsupport.h | 34 | ||||
-rw-r--r-- | externals/grill/flext/source/flthr.cpp | 11 |
14 files changed, 118 insertions, 63 deletions
diff --git a/externals/grill/flext/changes.txt b/externals/grill/flext/changes.txt index 982e0002..afcb2b2f 100644 --- a/externals/grill/flext/changes.txt +++ b/externals/grill/flext/changes.txt @@ -16,7 +16,7 @@ Version history: 0.5.0: - added some more SIMD functions - fixed wrong returned result of flext::buffer::set function -- fix for linux static exported function name-clash (flext::Setup() single- vs. multi-threading) +- fix for linux static exported function name-clash (individual linker namings for exported flext base classes) - made message queue stuff global (static) for all flext objects - added flext_base::DumpAttrib to send an attribute value to the attribute outlet - added "getmethods" message (for attribute-enabled externals) to list methods for a specified inlet (default = 0) @@ -25,6 +25,7 @@ Version history: - added flext::post() and flext::error() console printing (thread-safe) - added flext::CmpAtom and AtomList::operator < methods ... useful for using lists as keys for STL - make use of new PD thread locking (PD functions sys_lock() and sys_unlock()) +- better FLEXT_OSAPI resolution 0.4.4: - fixed deadly bug for Max/MSP method-to-symbol-binding proxies @@ -266,6 +267,8 @@ general: - add log messages for debugging version - use PD's t_float and t_int types (or comparable for 32-Bit safety) +- make links flext.a -> libflext.a for compatibility + bugs: - PD: problems with timed buffer redrawing (takes a lot of cpu time) - hard thread termination upon object destruction doesn't seem to work properly -> crash diff --git a/externals/grill/flext/config-pd-msvc.txt b/externals/grill/flext/config-pd-msvc.txt index cac79b55..d754b23e 100644 --- a/externals/grill/flext/config-pd-msvc.txt +++ b/externals/grill/flext/config-pd-msvc.txt @@ -5,8 +5,9 @@ # where is PD? PDPATH=c:\programme\audio\pd -# where is MS VC++? -MSVCPATH="c:\programme\prog\microsoft visual studio\VC98" +# where is MS VC++? +# (should be commented out when called from the Visual Studio Command prompt) +# MSVCPATH="c:\programme\prog\microsoft visual studio\VC98" # where is the SndObj include directory? # (leave blank or comment out to disable SndObj support) diff --git a/externals/grill/flext/make-inc.pd-msvc b/externals/grill/flext/make-inc.pd-msvc index bfe4bb2a..3bf75633 100644 --- a/externals/grill/flext/make-inc.pd-msvc +++ b/externals/grill/flext/make-inc.pd-msvc @@ -24,7 +24,7 @@ INCPATH=$(INCPATH) /I$(STK) # compiler definitions and flags DEFS=/DFLEXT_SYS=2 $(UFLAGS) -CFLAGS=/GX /GD /G6 +CFLAGS=/GX /GD /G6 /arch:SSE OFLAGS=/Ox DFLAGS=/Od /Zi diff --git a/externals/grill/flext/source/flbase.cpp b/externals/grill/flext/source/flbase.cpp index aa6b66ea..525cb294 100644 --- a/externals/grill/flext/source/flbase.cpp +++ b/externals/grill/flext/source/flbase.cpp @@ -37,7 +37,7 @@ void flext_obj::ProcessAttributes(bool attr) { process_attributes = attr; } // Constructor // ///////////////////////////////////////////////////////// -flext_obj :: flext_obj() +flext_obj :: FLEXT_CLASSDEF(flext_obj)() : x_obj(m_holder) , procattr(m_holdattr) , init_ok(true) @@ -55,7 +55,7 @@ flext_obj :: flext_obj() // Destructor // ///////////////////////////////////////////////////////// -flext_obj :: ~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 4d0541b8..795c0673 100644 --- a/externals/grill/flext/source/flbase.h +++ b/externals/grill/flext/source/flbase.h @@ -20,7 +20,9 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include "flstdc.h" #include "flsupport.h" -class FLEXT_SHARE flext_obj; + +class FLEXT_SHARE FLEXT_CLASSDEF(flext_obj); +typedef class FLEXT_CLASSDEF(flext_obj) flext_obj; // ---------------------------------------------------------------------------- /*! \brief The obligatory PD or Max/MSP object header @@ -56,7 +58,7 @@ struct FLEXT_SHARE flext_hdr /*! \brief This points to the actual polymorphic C++ class */ - flext_obj *data; + FLEXT_CLASSDEF(flext_obj) *data; //! @} FLEXT_OBJHEADER }; @@ -85,7 +87,7 @@ struct FLEXT_SHARE flext_hdr */ // ---------------------------------------------------------------------------- -class FLEXT_SHARE flext_obj: +class FLEXT_SHARE FLEXT_CLASSDEF(flext_obj): public flext { public: @@ -100,10 +102,10 @@ class FLEXT_SHARE flext_obj: */ //! Constructor - flext_obj(); + FLEXT_CLASSDEF(flext_obj)(); //! Destructor - virtual ~flext_obj() = 0; + virtual ~FLEXT_CLASSDEF(flext_obj)() = 0; /*! \brief Signal a construction problem \note This should only be used in the constructor. Object creation will be aborted. @@ -221,7 +223,7 @@ class FLEXT_SHARE flext_obj: public: //! Creation callback - static void __setup__(t_classid) { flext::FLEXT_SETUPFUNC(); } + static void __setup__(t_classid) { flext::Setup(); } /*! \brief This is a temporary holder \warning don't touch it! @@ -243,7 +245,7 @@ class FLEXT_SHARE flext_obj: // Definitions for library objects static void lib_init(const char *name,void setupfun(),bool attr); - static void obj_add(bool lib,bool dsp,bool attr,const char *idname,const char *names,void setupfun(t_classid),flext_obj *(*newfun)(int,t_atom *),void (*freefun)(flext_hdr *),int argtp1,...); + static void obj_add(bool lib,bool dsp,bool attr,const char *idname,const char *names,void setupfun(t_classid),FLEXT_CLASSDEF(flext_obj) *(*newfun)(int,t_atom *),void (*freefun)(flext_hdr *),int argtp1,...); #if FLEXT_SYS == FLEXT_SYS_JMAX static void obj_new(fts_object_t *o, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at); static void obj_free(fts_object_t *o, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at); @@ -293,9 +295,9 @@ class FLEXT_SHARE flext_obj: #define FLEXT_REALHDR(NEW_CLASS, PARENT_CLASS) \ public: \ typedef NEW_CLASS thisType; \ -static flext_obj *__init__(int argc,t_atom *argv); \ +static FLEXT_CLASSDEF(flext_obj) *__init__(int argc,t_atom *argv); \ static void __free__(flext_hdr *hdr) \ -{ flext_obj *mydata = hdr->data; delete mydata; \ +{ FLEXT_CLASSDEF(flext_obj) *mydata = hdr->data; delete mydata; \ hdr->flext_hdr::~flext_hdr(); } \ static void __setup__(t_classid classid) { \ PARENT_CLASS::__setup__(classid); } \ @@ -306,9 +308,9 @@ static inline NEW_CLASS *thisObject(void *c) { return FLEXT_CAST<NEW_CLASS *>((( #define FLEXT_REALHDR_S(NEW_CLASS, PARENT_CLASS,SETUPFUN) \ public: \ typedef NEW_CLASS thisType; \ -static flext_obj *__init__(int argc,t_atom *argv); \ +static FLEXT_CLASSDEF(flext_obj) *__init__(int argc,t_atom *argv); \ static void __free__(flext_hdr *hdr) \ -{ flext_obj *mydata = hdr->data; delete mydata; \ +{ FLEXT_CLASSDEF(flext_obj) *mydata = hdr->data; delete mydata; \ hdr->flext_hdr::~flext_hdr(); } \ static void __setup__(t_classid classid) \ { PARENT_CLASS::__setup__(classid); \ diff --git a/externals/grill/flext/source/flclass.h b/externals/grill/flext/source/flclass.h index 3667e961..6b361cc7 100644 --- a/externals/grill/flext/source/flclass.h +++ b/externals/grill/flext/source/flclass.h @@ -36,9 +36,9 @@ WARRANTIES, see the file, "license.txt," in this distribution. /*! \brief Flext message only base object - This is the base class from which typical external object derive. + This is the base class from which typical external objects derive. DSP objects should use the flext_dsp class which inherits from flext_base and - provides the needed functionality. + provides the necessary functionality. For a valid external object class you would also need FLEXT_HEADER, also if it's only a base class without instantiated objects again. @@ -49,12 +49,15 @@ WARRANTIES, see the file, "license.txt," in this distribution. */ -class FLEXT_SHARE flext_base: +class FLEXT_SHARE FLEXT_CLASSDEF(flext_base); +typedef class FLEXT_SHARE FLEXT_CLASSDEF(flext_base) flext_base; + +class FLEXT_SHARE FLEXT_CLASSDEF(flext_base): public flext_obj { - FLEXT_HEADER_S(flext_base,flext_obj,Setup) + FLEXT_HEADER_S(FLEXT_CLASSDEF(flext_base),flext_obj,Setup) - friend class flext_obj; + friend class FLEXT_SHARE FLEXT_CLASSDEF(flext_obj); /*! \defgroup FLEXT_CLASS Flext base class @{ @@ -469,8 +472,8 @@ public: protected: - flext_base(); - virtual ~flext_base(); + FLEXT_CLASSDEF(flext_base)(); + virtual ~FLEXT_CLASSDEF(flext_base)(); /*! \brief Set up inlets and outlets, method and attribute lists */ diff --git a/externals/grill/flext/source/fldsp.cpp b/externals/grill/flext/source/fldsp.cpp index 252f2da7..6d3298b2 100644 --- a/externals/grill/flext/source/fldsp.cpp +++ b/externals/grill/flext/source/fldsp.cpp @@ -43,7 +43,7 @@ void flext_dsp::Setup(t_classid id) #endif } -flext_dsp::flext_dsp(): +flext_dsp::FLEXT_CLASSDEF(flext_dsp)(): #if FLEXT_SYS == FLEXT_SYS_JMAX srate(fts_dsp_get_sample_rate()), // should we set it? blksz(fts_dsp_get_tick_size()), @@ -74,7 +74,7 @@ flext_dsp::flext_dsp(): } -flext_dsp::~flext_dsp() +flext_dsp::~FLEXT_CLASSDEF(flext_dsp)() { #if FLEXT_SYS == FLEXT_SYS_JMAX fts_dsp_object_delete(thisHdr()); diff --git a/externals/grill/flext/source/fldsp.h b/externals/grill/flext/source/fldsp.h index 80631531..ee94973d 100644 --- a/externals/grill/flext/source/fldsp.h +++ b/externals/grill/flext/source/fldsp.h @@ -22,12 +22,16 @@ WARRANTIES, see the file, "license.txt," in this distribution. // === flext_dsp ================================================== +class FLEXT_SHARE FLEXT_CLASSDEF(flext_dsp); +typedef class FLEXT_SHARE FLEXT_CLASSDEF(flext_dsp) flext_dsp; + + /*! \brief Flext dsp enabled base object */ -class FLEXT_SHARE flext_dsp: +class FLEXT_SHARE FLEXT_CLASSDEF(flext_dsp): public flext_base { - FLEXT_HEADER_S(flext_dsp,flext_base,Setup) + FLEXT_HEADER_S(FLEXT_CLASSDEF(flext_dsp),flext_base,Setup) public: @@ -132,8 +136,8 @@ public: protected: - flext_dsp(); - virtual ~flext_dsp(); + FLEXT_CLASSDEF(flext_dsp)(); + virtual ~FLEXT_CLASSDEF(flext_dsp)(); private: diff --git a/externals/grill/flext/source/flext.cpp b/externals/grill/flext/source/flext.cpp index 78f01ff5..ce35e205 100644 --- a/externals/grill/flext/source/flext.cpp +++ b/externals/grill/flext/source/flext.cpp @@ -20,7 +20,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. bool flext_base::compatibility = true; -flext_base::flext_base(): +flext_base::FLEXT_CLASSDEF(flext_base)(): inlist(NULL),outlist(NULL), curtag(NULL), incnt(0),outcnt(0), @@ -49,7 +49,7 @@ flext_base::flext_base(): attrhead = clattrhead = NULL; } -flext_base::~flext_base() +flext_base::~FLEXT_CLASSDEF(flext_base)() { #if FLEXT_SYS == FLEXT_SYS_MAX // according to David Z. one should do that first... diff --git a/externals/grill/flext/source/fllib.cpp b/externals/grill/flext/source/fllib.cpp index f84968f2..a6d95895 100755 --- a/externals/grill/flext/source/fllib.cpp +++ b/externals/grill/flext/source/fllib.cpp @@ -194,7 +194,7 @@ t_class *flext_obj::getClass(t_classid id) { return reinterpret_cast<libclass *> void flext_obj::lib_init(const char *name,void setupfun(),bool attr) { - flext::FLEXT_SETUPFUNC(); + flext::Setup(); #if FLEXT_SYS == FLEXT_SYS_MAX lib_name = MakeSymbol(name); diff --git a/externals/grill/flext/source/flprefix.h b/externals/grill/flext/source/flprefix.h index 2399eef5..4d34a975 100755 --- a/externals/grill/flext/source/flprefix.h +++ b/externals/grill/flext/source/flprefix.h @@ -54,9 +54,15 @@ WARRANTIES, see the file, "license.txt," in this distribution. // --- definitions for FLEXT_OS_API --------------------- #define FLEXT_OSAPI_UNKNOWN 0 -#define FLEXT_OSAPI_MAC_CLASSIC 1 -#define FLEXT_OSAPI_MAC_CARBON 2 -#define FLEXT_OSAPI_MAC_OSX 3 + +#define FLEXT_OSAPI_UNIX_POSIX 1 + +#define FLEXT_OSAPI_MAC_CLASSIC 2 +#define FLEXT_OSAPI_MAC_CARBON 3 +#define FLEXT_OSAPI_MAC_OSX 4 + +#define FLEXT_OSAPI_WIN_NATIVE 5 // WIN32 Platform +#define FLEXT_OSAPI_WIN_POSIX 6 // POSIX API (e.g. cygwin) // --- definitions for FLEXT_CPU --------------------- #define FLEXT_CPU_UNKNOWN 0 @@ -120,12 +126,13 @@ WARRANTIES, see the file, "license.txt," in this distribution. #ifndef FLEXT_OS #if defined(_WIN32) #define FLEXT_OS FLEXT_OS_WIN + #define FLEXT_OSAPI FLEXT_OSAPI_WIN_NATIVE #else #define FLEXT_OS FLEXT_OS_UNKNOWN + #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN #endif #endif - #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN #elif defined(__BORLANDC__) // Borland C++ @@ -135,9 +142,11 @@ WARRANTIES, see the file, "license.txt," in this distribution. #endif #ifndef FLEXT_OS #define FLEXT_OS FLEXT_OS_WIN + #define FLEXT_OSAPI FLEXT_OSAPI_WIN_NATIVE + #else + #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN #endif - #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN #elif defined(__MWERKS__) // Metrowerks CodeWarrior @@ -224,14 +233,21 @@ WARRANTIES, see the file, "license.txt," in this distribution. #endif #endif - #if FLEXT_OS == FLEXT_OS_MAC - #define FLEXT_OSAPI FLEXT_OSAPI_MAC_OSX - #else - #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN + #ifndef FLEXT_OSAPI + #if FLEXT_OS == FLEXT_OS_MAC + #define FLEXT_OSAPI FLEXT_OSAPI_MAC_OSX + #elif FLEXT_OS == FLEXT_OS_WIN + #define FLEXT_OSAPI FLEXT_OSAPI_WIN_POSIX + #elif FLEXT_OS == FLEXT_OS_LINUX || FLEXT_OS == FLEXT_OS_IRIX + #define FLEXT_OSAPI FLEXT_OSAPI_UNIX_POSIX + #else + #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN + #endif #endif #elif defined(__MRC__) && defined(MPW_CPLUS) // Apple MPW MrCpp + #if __MRC__ < 0x500 #error Apple MPW MrCpp v.5.0.0 or better compiler required #endif @@ -252,10 +268,17 @@ WARRANTIES, see the file, "license.txt," in this distribution. #endif #endif - #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN - + #ifndef FLEXT_OSAPI + #if FLEXT_OS == FLEXT_OS_MAC + #define FLEXT_OSAPI FLEXT_OSAPI_MAC_CLASSIC + #else + #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN + #endif + #endif #endif + + #if FLEXT_OS == FLEXT_OS_WIN // #pragma message("Compiling for Windows") @@ -334,6 +357,16 @@ WARRANTIES, see the file, "license.txt," in this distribution. #endif #endif +// ----- macros for class names ----- +#if defined(FLEXT_SHARED) + #define FLEXT_CLASSDEF(CL) CL##_shared +#elif defined(FLEXT_THREADS) + #define FLEXT_CLASSDEF(CL) CL##_multi +#else + #define FLEXT_CLASSDEF(CL) CL##_single +#endif + + // std namespace #ifdef __MWERKS__ #define STD std diff --git a/externals/grill/flext/source/flsupport.cpp b/externals/grill/flext/source/flsupport.cpp index 78aeb6d0..14b9bea5 100644 --- a/externals/grill/flext/source/flsupport.cpp +++ b/externals/grill/flext/source/flsupport.cpp @@ -35,7 +35,7 @@ const t_symbol *flext::sym_signal = NULL; int flext::Version() { return FLEXT_VERSION; } const char *flext::VersionStr() { return FLEXT_VERSTR; } -void flext::FLEXT_SETUPFUNC() +void flext::Setup() { static bool issetup = false; if(issetup) diff --git a/externals/grill/flext/source/flsupport.h b/externals/grill/flext/source/flsupport.h index b2132289..789e6921 100644 --- a/externals/grill/flext/source/flsupport.h +++ b/externals/grill/flext/source/flsupport.h @@ -18,7 +18,10 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include "flstdc.h" -class FLEXT_SHARE flext_base; +class FLEXT_SHARE FLEXT_CLASSDEF(flext); +typedef class FLEXT_CLASSDEF(flext) flext; + +class FLEXT_SHARE FLEXT_CLASSDEF(flext_base); /*! \brief Flext support class @@ -31,7 +34,8 @@ class FLEXT_SHARE flext_base; 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 { + +class FLEXT_SHARE FLEXT_CLASSDEF(flext) { /*! \defgroup FLEXT_SUPPORT Flext support class @{ @@ -644,7 +648,7 @@ public: void set_any(const t_symbol *s,int argc,const t_atom *argv); void set_list(int argc,const t_atom *argv); - flext_base *cl; + FLEXT_CLASSDEF(flext_base) *cl; union _data { bool _bool; float _float; @@ -667,10 +671,10 @@ public: //! \brief Check if this class represents the current thread bool Is(thrid_t id = GetThreadId()) const { return IsThread(thrid,id); } - flext_base *This() const { return th; } + FLEXT_CLASSDEF(flext_base) *This() const { return th; } thrid_t Id() const { return thrid; } - flext_base *th; + FLEXT_CLASSDEF(flext_base) *th; void (*meth)(thr_params *); thr_params *params; thrid_t thrid; @@ -913,7 +917,7 @@ public: //! Set timer callback function. void SetCallback(void (*cb)(void *data)) { clss = NULL,cback = cb; } //! Set timer callback function (with class pointer). - void SetCallback(flext_base &th,bool (*cb)(flext_base *th,void *data)) { clss = &th,cback = (void (*)(void *))cb; } + void SetCallback(FLEXT_CLASSDEF(flext_base) &th,bool (*cb)(FLEXT_CLASSDEF(flext_base) *th,void *data)) { clss = &th,cback = (void (*)(void *))cb; } //! Clear timer. bool Reset(); @@ -944,7 +948,7 @@ public: const bool queued; void (*cback)(void *data); - flext_base *clss; + FLEXT_CLASSDEF(flext_base) *clss; void *userdata; double period; }; @@ -990,12 +994,16 @@ protected: As single- and multi-threaded to different initializations the function names have to be different as well. */ + +/* #ifdef FLEXT_THREADS #define FLEXT_SETUPFUNC SetupMulti #else #define FLEXT_SETUPFUNC SetupSingle #endif static void FLEXT_SETUPFUNC(); +*/ + static void Setup(); static bool chktilde(const char *objname); @@ -1004,12 +1012,12 @@ protected: // gcc doesn't like these to be included into the flext class (even if static) -inline bool operator ==(const t_atom &a,const t_atom &b) { return flext::CmpAtom(a,b) == 0; } -inline bool operator !=(const t_atom &a,const t_atom &b) { return flext::CmpAtom(a,b) != 0; } -inline bool operator <(const t_atom &a,const t_atom &b) { return flext::CmpAtom(a,b) < 0; } -inline bool operator <=(const t_atom &a,const t_atom &b) { return flext::CmpAtom(a,b) <= 0; } -inline bool operator >(const t_atom &a,const t_atom &b) { return flext::CmpAtom(a,b) > 0; } -inline bool operator >=(const t_atom &a,const t_atom &b) { return flext::CmpAtom(a,b) >= 0; } +inline bool operator ==(const t_atom &a,const t_atom &b) { return FLEXT_CLASSDEF(flext)::CmpAtom(a,b) == 0; } +inline bool operator !=(const t_atom &a,const t_atom &b) { return FLEXT_CLASSDEF(flext)::CmpAtom(a,b) != 0; } +inline bool operator <(const t_atom &a,const t_atom &b) { return FLEXT_CLASSDEF(flext)::CmpAtom(a,b) < 0; } +inline bool operator <=(const t_atom &a,const t_atom &b) { return FLEXT_CLASSDEF(flext)::CmpAtom(a,b) <= 0; } +inline bool operator >(const t_atom &a,const t_atom &b) { return FLEXT_CLASSDEF(flext)::CmpAtom(a,b) > 0; } +inline bool operator >=(const t_atom &a,const t_atom &b) { return FLEXT_CLASSDEF(flext)::CmpAtom(a,b) >= 0; } diff --git a/externals/grill/flext/source/flthr.cpp b/externals/grill/flext/source/flthr.cpp index 0846805c..598618f1 100644 --- a/externals/grill/flext/source/flthr.cpp +++ b/externals/grill/flext/source/flthr.cpp @@ -20,11 +20,11 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include <time.h> -#if FLEXT_OS == FLEXT_OS_WIN -#include <sys/timeb.h> -#elif FLEXT_OS == FLEXT_OS_LINUX +#if FLEXT_OSAPI == FLEXT_OSAPI_UNIX_POSIX || FLEXT_OSAPI == FLEXT_OSAPI_WIN_POSIX #include <sys/time.h> #include <unistd.h> +#elif FLEXT_OS == FLEXT_OS_WIN +#include <sys/timeb.h> #endif #include <errno.h> @@ -514,12 +514,12 @@ bool flext::ThrCond::Wait() { bool flext::ThrCond::TimedWait(double ftime) { timespec tm; -#if FLEXT_OS == FLEXT_OS_WIN +#if FLEXT_OS == FLEXT_OS_WIN && FLEXT_OSAPI == FLEXT_OSAPI_WIN_NATIVE _timeb tmb; _ftime(&tmb); tm.tv_nsec = tmb.millitm*1000000; tm.tv_sec = tmb.time; -#else +#else // POSIX #if 0 // find out when the following is defined clock_gettime(CLOCK_REALTIME,tm); #else @@ -529,6 +529,7 @@ bool flext::ThrCond::TimedWait(double ftime) tm.tv_sec = tp.tv_sec; #endif #endif + tm.tv_nsec += (long)((ftime-(long)ftime)*1.e9); long nns = tm.tv_nsec%1000000000; tm.tv_sec += (long)ftime+(tm.tv_nsec-nns)/1000000000; |