From 6c51e8edf3c6eff9dadd64b65fb4809823c0bd30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B5=D0=BB=D0=B8=D0=BF=D0=B5=D0=BD=D0=BA=D0=BE=20?= =?UTF-8?q?=D0=98=D0=B2=D0=B0=D0=BD?= Date: Mon, 12 Feb 2018 12:20:15 +0000 Subject: [PATCH] git-svn-id: svn://db.shs.com.ru/pip@597 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5 --- CMakeLists.txt | 26 +++++++++++++----- main.cpp | 13 +++------ src_fftw/pifft_p.h | 2 +- src_main/code/picodeinfo.h | 12 ++++----- src_main/console/piscreenconsole.h | 2 +- src_main/console/piscreentiles.cpp | 2 +- src_main/console/piscreentiles.h | 6 ++--- src_main/console/piscreentypes.h | 20 +++++++------- src_main/containers/picontainers.h | 6 ++--- src_main/containers/pimap.h | 2 +- src_main/core/pibase.h | 21 +++++++++++++++ src_main/core/pichunkstream.h | 2 +- src_main/core/piincludes.h | 12 ++++----- src_main/core/piincludes_p.h | 4 +-- src_main/core/piinit.cpp | 12 +++++---- src_main/core/piinit.h | 4 +-- src_main/core/piobject.h | 6 ++++- src_main/core/pistring.h | 2 +- src_main/core/pitime.h | 12 ++++----- src_main/core/pivariant.h | 16 +++++------ src_main/core/pivarianttypes.h | 10 +++---- src_main/geo/piellipsoidmodel.h | 2 +- src_main/geo/pigeoposition.h | 2 +- src_main/io/pibasetransfer.h | 10 +++---- src_main/io/pibinarylog.h | 2 +- src_main/io/piconnection.h | 10 +++---- src_main/io/pidatatransfer.h | 2 +- src_main/io/pidiagnostics.h | 15 ++++++++++- src_main/io/pifile.cpp | 12 ++++++--- src_main/io/pifile.h | 6 ++--- src_main/io/pifiletransfer.h | 8 +++--- src_main/math/picrypt.h | 2 +- src_main/math/pievaluator.h | 14 +++++----- src_main/math/pifft.h | 3 +++ src_main/math/pifixedpoint.h | 3 ++- src_main/pip_export.h | 35 ------------------------- src_main/resources/piresources.h | 2 +- src_main/resources/piresourcesstorage.h | 10 +++---- src_main/system/pisignals.cpp | 6 +++++ src_main/thread/pigrabberbase.h | 2 +- src_main/thread/pithread.cpp | 20 +++++++++++--- src_main/thread/pithread.h | 4 +-- src_main/thread/pitimer.h | 6 ++--- 43 files changed, 204 insertions(+), 164 deletions(-) delete mode 100755 src_main/pip_export.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 45ca8791..959153cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,6 +90,11 @@ if (_PIP_VERSION_CHANGED) endif() +# Compiler +get_filename_component(C_COMPILER "${CMAKE_C_COMPILER}" NAME) +#message("${C_COMPILER}") + + # Sources # Main lib @@ -234,7 +239,10 @@ if ((NOT DEFINED LIBPROJECT) AND (DEFINED ANDROID_PLATFORM)) #message("${ANDROID_NDK}/sysroot/usr/include") endif() if(WIN32) - list(APPEND LIBS_MAIN ws2_32 iphlpapi psapi) + if(${C_COMPILER} STREQUAL "cl.exe") + else() + list(APPEND LIBS_MAIN ws2_32 iphlpapi psapi) + endif() else() list(APPEND LIBS_MAIN dl) if(DEFINED ENV{QNX_HOST}) @@ -256,10 +264,8 @@ if(WIN32) list(APPEND CPP_LIB_MAIN "pip_resource_win.rc") add_definitions(-DPSAPI_VERSION=1) add_library(pip SHARED ${CPP_LIB_MAIN} ${HDRS} ${PHDRS}) - if(${CMAKE_C_COMPILER} STREQUAL "cl") - include(GenerateExportHeader) - generate_export_header(pip) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /O2 /Ob2 /Ot") + if(${C_COMPILER} STREQUAL "cl.exe") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /O2 /Ob2 /Ot /W0") else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -Wall") #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native") @@ -275,6 +281,10 @@ else() add_library(pip SHARED ${CPP_LIB_MAIN}) endif() endif() +set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}") +include(GenerateExportHeader) +generate_export_header(pip) +list(APPEND HDRS "${CMAKE_CURRENT_BINARY_DIR}/pip_export.h") target_link_libraries(pip ${LIBS_MAIN}) @@ -393,7 +403,7 @@ endif() # Test program add_executable(pip_test "main.cpp") -target_link_libraries(pip_test pip pip_compress) +target_link_libraries(pip_test pip) # Install @@ -412,6 +422,9 @@ if(LIB) file(COPY "${STDLIB}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/utils/code_model_generator") file(COPY "${STDLIB}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/utils/resources_compiler") endif() + else() + #message("${CMAKE_CURRENT_BINARY_DIR}/pip_export.h") + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pip_export.h DESTINATION include) endif() else() if(APPLE) @@ -430,6 +443,7 @@ if(LIB) install(FILES ${CMAKES} DESTINATION ${CMAKE_ROOT}/Modules) else() install(TARGETS ${PIP_LIBS_TARGETS} DESTINATION bin) + install(FILES ${HDRS} DESTINATION include) message(STATUS "Install ${PROJECT_NAME} to local \"bin\"") endif() diff --git a/main.cpp b/main.cpp index a3ca91b2..9b2bb375 100644 --- a/main.cpp +++ b/main.cpp @@ -1,18 +1,11 @@ #include "pip.h" -#include "picodeparser.h" - -#define PIMETA(...) - -struct S { - - int i PIMETA(a="123",j=5); -}; int main(int argc, char *argv[]) { + piCout << "Hello VS!"; //S s; //s.i; - PICodeParser cp; - cp.parseFile("cp.h"); + //PICodeParser cp; + //cp.parseFile("cp.h"); return 0; } diff --git a/src_fftw/pifft_p.h b/src_fftw/pifft_p.h index e9109e8d..63113c7c 100644 --- a/src_fftw/pifft_p.h +++ b/src_fftw/pifft_p.h @@ -37,7 +37,7 @@ template -class PIFFTW_Private +class PIP_EXPORT PIFFTW_Private { public: explicit PIFFTW_Private() { diff --git a/src_main/code/picodeinfo.h b/src_main/code/picodeinfo.h index e8c08e2d..339ac088 100755 --- a/src_main/code/picodeinfo.h +++ b/src_main/code/picodeinfo.h @@ -28,7 +28,7 @@ namespace PICodeInfo { -enum TypeFlag { +enum PIP_EXPORT TypeFlag { NoFlag, Const = 0x01, Static = 0x02, @@ -42,7 +42,7 @@ enum TypeFlag { typedef PIFlags TypeFlags; typedef PIMap MetaMap; -struct TypeInfo { +struct PIP_EXPORT TypeInfo { TypeInfo(const PIString & n = PIString(), const PIString & t = PIString(), PICodeInfo::TypeFlags f = 0, int b = -1) {name = n; type = t; flags = f; bits = b;} const bool isBitfield() const {return bits > 0;} MetaMap meta; @@ -52,14 +52,14 @@ struct TypeInfo { int bits; }; -struct FunctionInfo { +struct PIP_EXPORT FunctionInfo { MetaMap meta; PIString name; TypeInfo return_type; PIVector arguments; }; -struct ClassInfo { +struct PIP_EXPORT ClassInfo { ClassInfo() {has_name = true;} MetaMap meta; bool has_name; @@ -71,14 +71,14 @@ struct ClassInfo { PIVector children_info; }; -struct EnumeratorInfo { +struct PIP_EXPORT EnumeratorInfo { EnumeratorInfo(const PIString & n = PIString(), int v = 0) {name = n; value = v;} MetaMap meta; PIString name; int value; }; -struct EnumInfo { +struct PIP_EXPORT EnumInfo { PIString memberName(int value) const; int memberValue(const PIString & name) const; MetaMap meta; diff --git a/src_main/console/piscreenconsole.h b/src_main/console/piscreenconsole.h index 04afb931..a1a270b4 100644 --- a/src_main/console/piscreenconsole.h +++ b/src_main/console/piscreenconsole.h @@ -68,7 +68,7 @@ protected: -class PIScreenConsoleTile : public PIScreenTile +class PIP_EXPORT PIScreenConsoleTile : public PIScreenTile { public: PIScreenConsoleTile(); diff --git a/src_main/console/piscreentiles.cpp b/src_main/console/piscreentiles.cpp index 96b5d98a..bbe682e2 100644 --- a/src_main/console/piscreentiles.cpp +++ b/src_main/console/piscreentiles.cpp @@ -416,7 +416,7 @@ void TileButtons::drawEvent(PIScreenDrawer * d) { cw = width_ - 2; xo = (cw - b.first.size_s()) / 2 - 1; } - btn_rects[i] = (Rect){cx, cy, cx + cw + 2, cy + 1}; + btn_rects[i] = Rect(cx, cy, cx + cw + 2, cy + 1); d->fillRect(cx, cy, cx + cw + 2, cy + 1, ' ', Default, cb); d->drawText(cx, cy, "[", ct, Transparent, ff); d->drawText(cx + xo + 2, cy, b.first, ct, Transparent, ff); diff --git a/src_main/console/piscreentiles.h b/src_main/console/piscreentiles.h index 1d44ca14..bfb43091 100644 --- a/src_main/console/piscreentiles.h +++ b/src_main/console/piscreentiles.h @@ -131,7 +131,7 @@ protected: void drawEvent(PIScreenDrawer * d); bool keyEvent(PIKbdListener::KeyEvent key); bool mouseEvent(PIKbdListener::MouseEvent me); - struct Rect {int x0,y0,x1,y1;}; + struct Rect {Rect(int _x0 = 0, int _y0 = 0, int _x1 = 0, int _y1 = 0): x0(_x0),y0(_y0),x1(_x1),y1(_y1) {}; int x0,y0,x1,y1;}; PIVector btn_rects; }; @@ -201,7 +201,7 @@ protected: PITimeMeasurer tm_blink; }; - +/* class PIP_EXPORT TileTabs: public PIScreenTile { PIOBJECT_SUBCLASS(TileTabs, PIScreenTile) public: @@ -229,6 +229,6 @@ protected: void selectTab(int index); int cur; }; - +*/ #endif // PISCREENTILES_H diff --git a/src_main/console/piscreentypes.h b/src_main/console/piscreentypes.h index fc8254a1..c227130c 100644 --- a/src_main/console/piscreentypes.h +++ b/src_main/console/piscreentypes.h @@ -30,7 +30,7 @@ class PIScreenTile; namespace PIScreenTypes { //! Color for chars or background - enum Color { + enum PIP_EXPORT Color { Default /** Default */, Black /** Black */, Red /** Red */, @@ -44,7 +44,7 @@ namespace PIScreenTypes { }; //! Flags for chars - enum CharFlag { + enum PIP_EXPORT CharFlag { Bold /** Bold or bright */ = 0x1, Blink /** Blink text */ = 0x2, Underline /** Underline text */ = 0x4, @@ -52,14 +52,14 @@ namespace PIScreenTypes { }; //! Alignment - enum Alignment { + enum PIP_EXPORT Alignment { Left /** Left */ , Center /** Center */ , Right /** Right */ }; //! Size policy - enum SizePolicy { + enum PIP_EXPORT SizePolicy { Fixed /** Fixed size */ , Preferred /** Preferred size */ , Expanding /** Maximum available size */ , @@ -67,13 +67,13 @@ namespace PIScreenTypes { }; //! Direction - enum Direction { + enum PIP_EXPORT Direction { Horizontal /** Horizontal */ , Vertical /** Vertical */ }; //! Position - enum Position { + enum PIP_EXPORT Position { //Left /** Left */ , //Right /** Right */ , //Top /** Top */ , @@ -81,7 +81,7 @@ namespace PIScreenTypes { }; //! Focus flags - enum FocusFlag { + enum PIP_EXPORT FocusFlag { CanHasFocus /** Tile can has focus */ = 0x1, NextByTab /** Focus passed to next tile by tab key */ = 0x2, NextByArrowsHorizontal /** Focus passed to next tile by arrow keys left or right */ = 0x4, @@ -95,7 +95,7 @@ namespace PIScreenTypes { typedef PIFlags CharFlags; typedef PIFlags FocusFlags; - union CellFormat { + union PIP_EXPORT CellFormat { CellFormat(uint f = 0) {raw_format = f;} CellFormat(Color col_char, Color col_back = Default, CharFlags flags_ = 0) { color_char = col_char; @@ -112,7 +112,7 @@ namespace PIScreenTypes { bool operator !=(const CellFormat & c) const {return raw_format != c.raw_format;} }; - struct Cell { + struct PIP_EXPORT Cell { Cell(PIChar c = PIChar(' '), CellFormat f = CellFormat()) {symbol = c; format = f;} CellFormat format; PIChar symbol; @@ -128,7 +128,7 @@ namespace PIScreenTypes { } }; - struct TileEvent { + struct PIP_EXPORT TileEvent { TileEvent(int t = -1, const PIVariant & d = PIVariant()): type(t), data(d) {} int type; PIVariant data; diff --git a/src_main/containers/picontainers.h b/src_main/containers/picontainers.h index 429d7eaf..6ff30481 100755 --- a/src_main/containers/picontainers.h +++ b/src_main/containers/picontainers.h @@ -182,12 +182,12 @@ public: #else -struct _PIForeachBase {mutable bool _break, _end;}; +class _PIForeachBase {public: mutable bool _break, _end; }; template class _PIForeach: public _PIForeachBase { public: - _PIForeach(Type & t, bool i = false): _break(false), _end(false), _t(t), _inv(i) {if (_inv) _rit = _t.rbegin(); else _it = _t.begin();} + _PIForeach(Type & t, bool i = false): _t(t), _inv(i) {_break = _end = false; if (_inv) _rit = _t.rbegin(); else _it = _t.begin();} mutable typename Type::value_type _var; mutable typename Type::iterator _it; mutable typename Type::reverse_iterator _rit; @@ -200,7 +200,7 @@ public: template class _PIForeachC: public _PIForeachBase { public: - _PIForeachC(const Type & t, bool i = false): _break(false), _end(false), _t(t), _inv(i) {if (_inv) _rit = _t.rbegin(); else _it = _t.begin();} + _PIForeachC(const Type & t, bool i = false): _t(t), _inv(i) {_break = _end = false; if (_inv) _rit = _t.rbegin(); else _it = _t.begin();} mutable typename Type::value_type _var; mutable typename Type::const_iterator _it; mutable typename Type::const_reverse_iterator _rit; diff --git a/src_main/containers/pimap.h b/src_main/containers/pimap.h index 02da29fc..3387eef5 100644 --- a/src_main/containers/pimap.h +++ b/src_main/containers/pimap.h @@ -207,7 +207,7 @@ public: void swap(PIMap & other) { piSwapBinary >(pim_content, other.pim_content); - piSwapBinary >(pim_index, other.pim_index); + piSwapBinary >(pim_index, other.pim_index); } PIMap & insert(const Key & key, const T & value) { diff --git a/src_main/core/pibase.h b/src_main/core/pibase.h index ac2a5ed6..83f6005f 100644 --- a/src_main/core/pibase.h +++ b/src_main/core/pibase.h @@ -104,6 +104,11 @@ # pragma comment(lib, "Ws2_32.lib") # pragma comment(lib, "Iphlpapi.lib") # pragma comment(lib, "Psapi.lib") +# ifdef ARCH_BITS_32 +# define _X86_ +# else +# define _IA64_ +# endif # else # define SHUT_RDWR SD_BOTH # endif @@ -258,6 +263,22 @@ template inline void piSwapBinary(T & f, T & s) { } } +template<> inline void piSwapBinary(const void *& f, const void *& s) { + static size_t j = (sizeof(void *) / sizeof(size_t)), bs = j * sizeof(size_t), bf = sizeof(void *); + size_t i = 0; + void * pf = const_cast(f), * ps = const_cast(s); + for (i = 0; i < j; ++i) { + ((size_t*)(&pf))[i] ^= ((size_t*)(&ps))[i]; + ((size_t*)(&ps))[i] ^= ((size_t*)(&pf))[i]; + ((size_t*)(&pf))[i] ^= ((size_t*)(&ps))[i]; + } + for (i = bs; i < bf; ++i) { + ((uchar*)(&pf))[i] ^= ((uchar*)(&ps))[i]; + ((uchar*)(&ps))[i] ^= ((uchar*)(&pf))[i]; + ((uchar*)(&pf))[i] ^= ((uchar*)(&ps))[i]; + } +} + /*! \brief Function for compare two values without "=" by raw content * \details Example:\n \snippet piincludes.cpp compareBinary */ inline bool piCompareBinary(const void * f, const void * s, size_t size) { diff --git a/src_main/core/pichunkstream.h b/src_main/core/pichunkstream.h index 5fe81aa3..329e5fe9 100644 --- a/src_main/core/pichunkstream.h +++ b/src_main/core/pichunkstream.h @@ -26,7 +26,7 @@ #include "pibytearray.h" -class PIChunkStream +class PIP_EXPORT PIChunkStream { public: diff --git a/src_main/core/piincludes.h b/src_main/core/piincludes.h index a57ebd73..ab602390 100755 --- a/src_main/core/piincludes.h +++ b/src_main/core/piincludes.h @@ -44,16 +44,16 @@ extern lconv * currentLocale; /*! \fn errorString() * \brief Return readable error description in format "code - " */ -PIString errorString(); +PIP_EXPORT PIString errorString(); -void errorClear(); +PIP_EXPORT void errorClear(); -void piqsort(void* base, size_t num, size_t size, int (*compar)(const void*,const void*)); +PIP_EXPORT void piqsort(void* base, size_t num, size_t size, int (*compar)(const void*,const void*)); -void randomize(); -int randomi(); +PIP_EXPORT void randomize(); +PIP_EXPORT int randomi(); /// Return readable version of PIP -PIString PIPVersion(); +PIP_EXPORT PIString PIPVersion(); #endif // PIINCLUDES_H diff --git a/src_main/core/piincludes_p.h b/src_main/core/piincludes_p.h index 24d08f8f..fde610a0 100644 --- a/src_main/core/piincludes_p.h +++ b/src_main/core/piincludes_p.h @@ -25,8 +25,8 @@ # include # include # include -typedef void(*PINtQueryTimerResolution)(PULONG, PULONG, PULONG); -typedef void(*PINtSetTimerResolution)(ULONG, BOOLEAN, PULONG); +typedef LONG(NTAPI*PINtQueryTimerResolution)(PULONG, PULONG, PULONG); +typedef LONG(NTAPI*PINtSetTimerResolution)(ULONG, BOOLEAN, PULONG); #endif #ifdef CC_GCC # include diff --git a/src_main/core/piinit.cpp b/src_main/core/piinit.cpp index 126ad840..eae285b8 100644 --- a/src_main/core/piinit.cpp +++ b/src_main/core/piinit.cpp @@ -34,10 +34,12 @@ void __PISetTimerResolution() { if (setTimerResolutionAddr == NULL || getTimerResolutionAddr == NULL) return; - ULONG max(0), min(0), cur(0); - getTimerResolutionAddr(&max, &min, &cur); - //printf("getTimerResolution %lu %lu %lu\n", min, max, cur); - setTimerResolutionAddr(min, TRUE, &cur); + ULONG _max(0), _min(0), _cur(0); + //printf("getTimerResolution ...\n"); + LONG q = getTimerResolutionAddr(&_max, &_min, &_cur); + //printf("getTimerResolution %d %lu %lu %lu\n", q, _min, _max, _cur); + if (q == 0) + setTimerResolutionAddr(_min, TRUE, &_cur); //printf("setTimerResolution %lu\n", cur); } #else @@ -149,8 +151,8 @@ PIInit::PIInit() { if (PRIVATE->ntlib) { getTimerResolutionAddr = (PINtQueryTimerResolution)GetProcAddress(PRIVATE->ntlib, "NtQueryTimerResolution"); setTimerResolutionAddr = (PINtSetTimerResolution)GetProcAddress(PRIVATE->ntlib, "NtSetTimerResolution"); + __PISetTimerResolution(); } - __PISetTimerResolution(); /*if (setTimerResolution) setTimerResolutionAddr(1, TRUE, &(PRIVATE->prev_res));*/ # endif //piDebug = true; diff --git a/src_main/core/piinit.h b/src_main/core/piinit.h index 63b7d1b8..d46df734 100644 --- a/src_main/core/piinit.h +++ b/src_main/core/piinit.h @@ -30,7 +30,7 @@ class PIFile; class PIStringList; -class __PIInit_Initializer__ { +class PIP_EXPORT __PIInit_Initializer__ { public: __PIInit_Initializer__(); ~__PIInit_Initializer__(); @@ -39,7 +39,7 @@ public: }; -class PIInit { +class PIP_EXPORT PIInit { friend class __PIInit_Initializer__; friend class PIFile; public: diff --git a/src_main/core/piobject.h b/src_main/core/piobject.h index c1eeee5e..5fe072c1 100755 --- a/src_main/core/piobject.h +++ b/src_main/core/piobject.h @@ -185,7 +185,11 @@ #define _PI_STR(x) #x #define _PI_SSTR(x) _PI_STR(x) #define LOCATION __FILE__ ":" _PI_SSTR(__LINE__) -#define __PTYPE(t) typename __PIVariantTypeInfo__::PureType +#ifdef CC_GCC +# define __PTYPE(t) typename __PIVariantTypeInfo__::PureType +#else +# define __PTYPE(t) __PIVariantTypeInfo__::PureType +#endif #define __VVALUE(t, v) v.value< __PTYPE(t) >() diff --git a/src_main/core/pistring.h b/src_main/core/pistring.h index 30a796d0..b1762327 100755 --- a/src_main/core/pistring.h +++ b/src_main/core/pistring.h @@ -731,7 +731,7 @@ private: //! \relatesalso PIString \relatesalso PICout \brief Output operator to PICout -PICout operator <<(PICout s, const PIString & v); +PIP_EXPORT PICout operator <<(PICout s, const PIString & v); //! \relatesalso PIString \relatesalso PIByteArray \brief Output operator to PIByteArray diff --git a/src_main/core/pitime.h b/src_main/core/pitime.h index 1527859a..e239e2c5 100755 --- a/src_main/core/pitime.h +++ b/src_main/core/pitime.h @@ -31,7 +31,7 @@ #endif //! \brief Sleep for "msecs" milliseconds -void msleep(int msecs); +PIP_EXPORT void msleep(int msecs); /*! \brief Precise sleep for "usecs" microseconds * \details This function consider \c "usleep" offset @@ -39,7 +39,7 @@ void msleep(int msecs); * \a pip_sys_test program. If there is correct * offset value in system config, this function * wait \b exactly "usecs" microseconds. */ -void piUSleep(int usecs); // on !Windows consider constant "usleep" offset +PIP_EXPORT void piUSleep(int usecs); // on !Windows consider constant "usleep" offset /*! \brief Precise sleep for "msecs" milliseconds * \details This function exec \a piUSleep (msecs * 1000). */ @@ -202,7 +202,7 @@ inline PIByteArray & operator <<(PIByteArray & s, const PITime & v) {s << v.hour inline PIByteArray & operator >>(PIByteArray & s, PITime & v) {s >> v.hours >> v.minutes >> v.seconds >> v.milliseconds; return s;} //! \relatesalso PICout \relatesalso PICout \brief Output operator to PICout -PICout operator <<(PICout s, const PITime & v); +PIP_EXPORT PICout operator <<(PICout s, const PITime & v); @@ -226,7 +226,7 @@ inline PIByteArray & operator <<(PIByteArray & s, const PIDate & v) {s << v.year inline PIByteArray & operator >>(PIByteArray & s, PIDate & v) {s >> v.year >> v.month >> v.day; return s;} //! \relatesalso PICout \relatesalso PICout \brief Output operator to PICout -PICout operator <<(PICout s, const PIDate & v); +PIP_EXPORT PICout operator <<(PICout s, const PIDate & v); @@ -271,12 +271,12 @@ inline PIByteArray & operator <<(PIByteArray & s, const PIDateTime & v) {s << v. inline PIByteArray & operator >>(PIByteArray & s, PIDateTime & v) {s >> v.year >> v.month >> v.day >> v.hours >> v.minutes >> v.seconds >> v.milliseconds; return s;} //! \relatesalso PICout \relatesalso PICout \brief Output operator to PICout -PICout operator <<(PICout s, const PIDateTime & v); +PIP_EXPORT PICout operator <<(PICout s, const PIDateTime & v); -class PITimeMeasurer { +class PIP_EXPORT PITimeMeasurer { public: PITimeMeasurer(); diff --git a/src_main/core/pivariant.h b/src_main/core/pivariant.h index 7e247c04..990c25bb 100755 --- a/src_main/core/pivariant.h +++ b/src_main/core/pivariant.h @@ -37,7 +37,7 @@ template -class __PIVariantFunctions__ { +class PIP_EXPORT __PIVariantFunctions__ { public: static PIString typeNameHelper() {return PIStringAscii("");} @@ -46,7 +46,7 @@ public: template static C castVariant(const T & v) {return C();} }; -struct __PIVariantInfo__ { +struct PIP_EXPORT __PIVariantInfo__ { __PIVariantInfo__() { simple = false; } @@ -57,7 +57,7 @@ struct __PIVariantInfo__ { }; template -struct __PIVariantTypeInfo__ { +struct PIP_EXPORT __PIVariantTypeInfo__ { typedef T PureType; typedef const T ConstPureType; typedef T * PointerType; @@ -84,7 +84,7 @@ struct __PIVariantTypeInfo__ { //__TYPEINFO_SINGLE(T, const T *) -class __PIVariantInfoStorage__ { +class PIP_EXPORT __PIVariantInfoStorage__ { public: __PIVariantInfoStorage__() {if (!map) map = new PIMap();} static __PIVariantInfoStorage__ * get() {static __PIVariantInfoStorage__ * r = new __PIVariantInfoStorage__(); return r;} @@ -102,7 +102,7 @@ REGISTER_VARIANT_TYPEINFO(ns::classname) #define REGISTER_VARIANT_CPP(classname) \ template \ -class __##classname##_PIVariantInitializer__ { \ +class PIP_EXPORT __##classname##_PIVariantInitializer__ { \ public: \ __##classname##_PIVariantInitializer__(const PIString & name) { \ if (__PIVariantInfoStorage__::get()->map->contains(name)) \ @@ -115,7 +115,7 @@ public: \ #define REGISTER_NS_VARIANT_CPP(ns, classname) \ template \ -class __##ns##classname##_PIVariantInitializer__ { \ +class PIP_EXPORT __##ns##classname##_PIVariantInitializer__ { \ public: \ __##ns##classname##_PIVariantInitializer__(const PIString & name) { \ if (__PIVariantInfoStorage__::get()->map->contains(name)) \ @@ -155,7 +155,7 @@ PIByteArray __PIVariantFunctions__::castHelper(PIB PIByteArray ret; ret << t; \ return ret;} \ template \ -class __##classname_from##_##classname_to##_PIVariantCastInitializer__ { \ +class PIP_EXPORT __##classname_from##_##classname_to##_PIVariantCastInitializer__ { \ public: \ __##classname_from##_##classname_to##_PIVariantCastInitializer__(const PIString & name, const PIString & cname) { \ __PIVariantInfo__ * vi(__PIVariantInfoStorage__::get()->map->value(name, 0)); \ @@ -206,7 +206,7 @@ class PIP_EXPORT PIVariant { public: //! Type of %PIVariant content - enum Type { + enum PIP_EXPORT Type { pivInvalid /** Invalid type , default type of empty contructor */ = 0 , pivBool /** bool */ , pivChar /** char */ , diff --git a/src_main/core/pivarianttypes.h b/src_main/core/pivarianttypes.h index 9ed76a91..bd342f68 100644 --- a/src_main/core/pivarianttypes.h +++ b/src_main/core/pivarianttypes.h @@ -30,13 +30,13 @@ namespace PIVariantTypes { - struct Enumerator { + struct PIP_EXPORT Enumerator { Enumerator(int v = 0, const PIString & n = PIString()): value(v), name(n) {} int value; PIString name; }; - struct Enum { + struct PIP_EXPORT Enum { Enum(const PIString & n = PIString()): enum_name(n) {} PIString toString() const {return selected;} // obsolete int selectedValue() const; @@ -55,7 +55,7 @@ namespace PIVariantTypes { Enum & operator <<(const PIStringList & v); }; - struct File { + struct PIP_EXPORT File { File(const PIString & p = PIString(), const PIString & f = PIString(), bool abs = false): file(p), filter(f), is_abs(abs) {} PIString toString() const {return file;} PIString file; @@ -63,14 +63,14 @@ namespace PIVariantTypes { bool is_abs; }; - struct Dir { + struct PIP_EXPORT Dir { Dir(const PIString & d = PIString(), bool abs = false): dir(d), is_abs(abs) {} PIString toString() const {return dir;} PIString dir; bool is_abs; }; - struct Color { + struct PIP_EXPORT Color { Color(uint v = 0) {rgba = v;} uint rgba; }; diff --git a/src_main/geo/piellipsoidmodel.h b/src_main/geo/piellipsoidmodel.h index a3a4fb60..2d4cd223 100644 --- a/src_main/geo/piellipsoidmodel.h +++ b/src_main/geo/piellipsoidmodel.h @@ -26,7 +26,7 @@ #include "pimathbase.h" -class PIEllipsoidModel { +class PIP_EXPORT PIEllipsoidModel { public: PIEllipsoidModel(); double eccSquared() const {return eccentricity * eccentricity;} // eccentricity squared diff --git a/src_main/geo/pigeoposition.h b/src_main/geo/pigeoposition.h index 0a0e6683..dd9eace8 100644 --- a/src_main/geo/pigeoposition.h +++ b/src_main/geo/pigeoposition.h @@ -26,7 +26,7 @@ #include "piellipsoidmodel.h" #include "pimathvector.h" -class PIGeoPosition : public PIMathVectorT3d +class PIP_EXPORT PIGeoPosition : public PIMathVectorT3d { public: diff --git a/src_main/io/pibasetransfer.h b/src_main/io/pibasetransfer.h index 38892c7a..90a5042b 100644 --- a/src_main/io/pibasetransfer.h +++ b/src_main/io/pibasetransfer.h @@ -26,7 +26,7 @@ #include "picrc.h" #include "pidiagnostics.h" -class PIBaseTransfer: public PIObject +class PIP_EXPORT PIBaseTransfer: public PIObject { PIOBJECT_SUBCLASS(PIBaseTransfer, PIObject) public: @@ -34,7 +34,7 @@ public: ~PIBaseTransfer(); # pragma pack(push,1) - struct PacketHeader { + struct PIP_EXPORT PacketHeader { uint sig; int type; // PacketType int session_id; @@ -43,7 +43,7 @@ public: bool check_sig() {return (sig == signature);} }; - struct Part { + struct PIP_EXPORT Part { Part(uint id_ = 0, ullong size_ = 0, ullong start_ = 0) : id(id_), size(size_), start(start_) {} uint id; ullong size; @@ -102,10 +102,10 @@ protected: llong bytes_all, bytes_cur; private: - enum PacketType {pt_Unknown, pt_Data, pt_ReplySuccess, pt_ReplyInvalid, pt_Break, pt_Start, pt_Pause}; + enum PIP_EXPORT PacketType {pt_Unknown, pt_Data, pt_ReplySuccess, pt_ReplyInvalid, pt_Break, pt_Start, pt_Pause}; # pragma pack(push,1) - struct StartRequest { + struct PIP_EXPORT StartRequest { uint packets; ullong size; }; diff --git a/src_main/io/pibinarylog.h b/src_main/io/pibinarylog.h index e7afce78..63db9811 100644 --- a/src_main/io/pibinarylog.h +++ b/src_main/io/pibinarylog.h @@ -33,7 +33,7 @@ static const uchar binlog_sig[] = {'B','I','N','L','O','G'}; /// TODO: Create static functions to join binlog files /// TODO: Create functions to insert and delete records -class PIBinaryLog: public PIIODevice +class PIP_EXPORT PIBinaryLog: public PIIODevice { PIIODEVICE(PIBinaryLog) public: diff --git a/src_main/io/piconnection.h b/src_main/io/piconnection.h index 67a243b9..d43c8ecb 100755 --- a/src_main/io/piconnection.h +++ b/src_main/io/piconnection.h @@ -282,7 +282,7 @@ public: //! Returns if Device pool works in fake mode static bool isFakeMode(); - class DevicePool: public PIThread { + class PIP_EXPORT DevicePool: public PIThread { PIOBJECT_SUBCLASS(DevicePool, PIThread) friend void __DevicePool_threadReadDP(void * ddp); friend class PIConnection; @@ -302,7 +302,7 @@ public: PIVector boundedDevices(const PIConnection * parent) const; protected: - struct DeviceData { + struct PIP_EXPORT DeviceData { DeviceData(): dev(0), rthread(0), started(false) {} ~DeviceData(); PIIODevice * dev; @@ -372,14 +372,14 @@ private: PIString devFPath(const PIIODevice * d) const; PIIODevice * devByString(const PIString & s) const; - struct Extractor { + struct PIP_EXPORT Extractor { Extractor(): extractor(0) {} ~Extractor(); PIPacketExtractor * extractor; PIVector devices; }; - class Sender: public PITimer { + class PIP_EXPORT Sender: public PITimer { PIOBJECT_SUBCLASS(Sender, PIObject) public: Sender(PIConnection * parent_ = 0): parent(parent_), int_(0.f) {needLockRun(true);} @@ -414,7 +414,7 @@ void __DevicePool_threadReadDP(void * ddp); extern PIConnection::DevicePool * __device_pool__; -class __DevicePoolContainer__ { +class PIP_EXPORT __DevicePoolContainer__ { public: __DevicePoolContainer__(); static bool inited_; diff --git a/src_main/io/pidatatransfer.h b/src_main/io/pidatatransfer.h index 4e0de732..49568309 100644 --- a/src_main/io/pidatatransfer.h +++ b/src_main/io/pidatatransfer.h @@ -25,7 +25,7 @@ #include "pibasetransfer.h" -class PIDataTransfer: public PIBaseTransfer +class PIP_EXPORT PIDataTransfer: public PIBaseTransfer { PIOBJECT_SUBCLASS(PIDataTransfer, PIBaseTransfer) public: diff --git a/src_main/io/pidiagnostics.h b/src_main/io/pidiagnostics.h index 06b8e3cb..4d34e94a 100755 --- a/src_main/io/pidiagnostics.h +++ b/src_main/io/pidiagnostics.h @@ -212,7 +212,10 @@ private: uint cnt_fail; bool empty; }; - + friend bool operator ==(const PIDiagnostics::Entry & f, const PIDiagnostics::Entry & s); + friend bool operator !=(const PIDiagnostics::Entry & f, const PIDiagnostics::Entry & s); + friend bool operator <(const PIDiagnostics::Entry & f, const PIDiagnostics::Entry & s); + void tick(void *, int); Entry calcHistory(PIQueue & hist, int & cnt); void propertyChanged(const PIString &); @@ -226,4 +229,14 @@ private: }; +inline bool operator ==(const PIDiagnostics::Entry & f, const PIDiagnostics::Entry & s) { + return f.bytes_ok == s.bytes_ok && + f.bytes_fail == s.bytes_fail && + f.cnt_ok == s.cnt_ok && + f.cnt_fail == s.cnt_fail && + f.empty == s.empty; +} +inline bool operator !=(const PIDiagnostics::Entry & f, const PIDiagnostics::Entry & s) {return !(f == s);} +inline bool operator <(const PIDiagnostics::Entry & f, const PIDiagnostics::Entry & s) {return f.bytes_ok < s.bytes_ok;} + #endif // PIDIAGNOSTICS_H diff --git a/src_main/io/pifile.cpp b/src_main/io/pifile.cpp index 5e43df9c..1947b78d 100755 --- a/src_main/io/pifile.cpp +++ b/src_main/io/pifile.cpp @@ -53,9 +53,15 @@ # define _fseek_call_ fseek # define _ftell_call_ ftell # else -# define _fopen_call_ fopen64 -# define _fseek_call_ fseeko64 -# define _ftell_call_ ftello64 +# ifdef CC_GCC +# define _fopen_call_ fopen64 +# define _fseek_call_ fseeko64 +# define _ftell_call_ ftello64 +# else +# define _fopen_call_ fopen +# define _fseek_call_ fseek +# define _ftell_call_ ftell +# endif # endif # define _stat_struct_ struct stat64 # define _stat_call_ stat64 diff --git a/src_main/io/pifile.h b/src_main/io/pifile.h index ecd74265..d7aaa87c 100755 --- a/src_main/io/pifile.h +++ b/src_main/io/pifile.h @@ -34,10 +34,10 @@ public: //! Constructs an empty file explicit PIFile(); - struct FileInfo { + struct PIP_EXPORT FileInfo { FileInfo() {size = 0; id_group = id_user = 0;} - enum Flag { + enum PIP_EXPORT Flag { File = 0x01, Dir = 0x02, Dot = 0x04, @@ -46,7 +46,7 @@ public: Hidden = 0x20 }; typedef PIFlags Flags; - struct Permissions { + struct PIP_EXPORT Permissions { Permissions(uchar r = 0): raw(r) {} Permissions(bool r, bool w, bool e): raw(0) {read = r; write = w; exec = e;} PIString toString() const {return PIString(read ? "r" : "-") + PIString(write ? "w" : "-") + PIString(exec ? "x" : "-");} diff --git a/src_main/io/pifiletransfer.h b/src_main/io/pifiletransfer.h index 35e65b7a..e53c79c2 100644 --- a/src_main/io/pifiletransfer.h +++ b/src_main/io/pifiletransfer.h @@ -28,22 +28,22 @@ #define __PIFILETRANSFER_VERSION 2 -class PIFileTransfer: public PIBaseTransfer +class PIP_EXPORT PIFileTransfer: public PIBaseTransfer { PIOBJECT_SUBCLASS(PIFileTransfer, PIBaseTransfer) public: PIFileTransfer(); ~PIFileTransfer(); - enum StepType {pft_None, pft_Description, pft_Data}; + enum PIP_EXPORT StepType {pft_None, pft_Description, pft_Data}; - struct PFTFileInfo: public PIFile::FileInfo { + struct PIP_EXPORT PFTFileInfo: public PIFile::FileInfo { PFTFileInfo(const PIFile::FileInfo &fi = PIFile::FileInfo()): PIFile::FileInfo(fi) {} PIString dest_path; }; #pragma pack(push,1) - struct PFTHeader { + struct PIP_EXPORT PFTHeader { union { struct { char sig[3]; // PFT diff --git a/src_main/math/picrypt.h b/src_main/math/picrypt.h index 0d22761e..623ce83f 100644 --- a/src_main/math/picrypt.h +++ b/src_main/math/picrypt.h @@ -25,7 +25,7 @@ #include "pistring.h" -class PICrypt { +class PIP_EXPORT PICrypt { public: //! Construct and generate random key PICrypt(); diff --git a/src_main/math/pievaluator.h b/src_main/math/pievaluator.h index 3d0d0af6..d676d0c6 100755 --- a/src_main/math/pievaluator.h +++ b/src_main/math/pievaluator.h @@ -31,12 +31,12 @@ typedef complexd (*FuncFunc)(void * , int, complexd * ); namespace PIEvaluatorTypes { static const int operationCount = 14; - enum eType {etNumber, etOperator, etVariable, etFunction}; - enum Operation {oNone, oAdd, oSubtract, oMultiply, oDivide, oResidue, oPower, + enum PIP_EXPORT eType {etNumber, etOperator, etVariable, etFunction}; + enum PIP_EXPORT Operation {oNone, oAdd, oSubtract, oMultiply, oDivide, oResidue, oPower, oEqual, oNotEqual, oGreater, oSmaller, oGreaterEqual, oSmallerEqual, oAnd, oOr, oFunction }; - enum BaseFunctions {bfUnknown, bfSin, bfCos, bfTg, bfCtg, + enum PIP_EXPORT BaseFunctions {bfUnknown, bfSin, bfCos, bfTg, bfCtg, bfArcsin, bfArccos, bfArctg, bfArcctg, bfExp, bfRandom, bfRandomn, bfSh, bfCh, bfTh, bfCth, @@ -50,7 +50,7 @@ namespace PIEvaluatorTypes { bfCustom = 0xFFFF }; - struct Instruction { + struct PIP_EXPORT Instruction { Instruction() {out = -1; function = -1; operation = oNone;} Instruction(Operation oper, PIVector opers, int out_ind, int func = -1) { operation = oper; operators = opers; out = out_ind; function = func;} @@ -59,7 +59,7 @@ namespace PIEvaluatorTypes { int out; int function; }; - struct Element { + struct PIP_EXPORT Element { Element() {num = 0; var_num = -1; type = etNumber;} Element(eType new_type, int new_num, int new_var_num = -1) {set(new_type, new_num, new_var_num);} void set(eType new_type, int new_num, int new_var_num = -1) {type = new_type; num = new_num; var_num = new_var_num;} @@ -67,7 +67,7 @@ namespace PIEvaluatorTypes { int num; int var_num; }; - struct Function { + struct PIP_EXPORT Function { Function() {arguments = 0; type = bfUnknown; handler = 0;} Function(const PIString & name, int args, BaseFunctions ftype) {identifier = name; arguments = args; type = ftype; handler = 0;} Function(const PIString & name, int args, FuncFunc h) {identifier = name; arguments = args; type = bfCustom; handler = h;} @@ -76,7 +76,7 @@ namespace PIEvaluatorTypes { FuncFunc handler; int arguments; }; - struct Variable { + struct PIP_EXPORT Variable { Variable() {value = 0.;} Variable(const PIString & var_name, complexd val) {name = var_name; value = val;} PIString name; diff --git a/src_main/math/pifft.h b/src_main/math/pifft.h index 14294908..13199803 100644 --- a/src_main/math/pifft.h +++ b/src_main/math/pifft.h @@ -121,6 +121,7 @@ typedef PIFFT_double PIFFT; typedef PIFFT_double PIFFTd; typedef PIFFT_float PIFFTf; +#ifndef CC_VC #define _PIFFTW_H(type) class _PIFFTW_P_##type##_ { \ public: \ @@ -190,4 +191,6 @@ template<> inline void PIFFTW::deleteP(void *& _p) {if (_p) delete (_PI typedef PIFFTW PIFFTWld; +#endif + #endif // PIFFT_H diff --git a/src_main/math/pifixedpoint.h b/src_main/math/pifixedpoint.h index 32dfc3d2..62e6272b 100644 --- a/src_main/math/pifixedpoint.h +++ b/src_main/math/pifixedpoint.h @@ -24,8 +24,9 @@ #ifndef PIFIXEDPOINT_H #define PIFIXEDPOINT_H + template -class PIFixedPoint { +class PIP_EXPORT PIFixedPoint { // friend PICout operator <<(PICout s, const FixedPoint<> & v); public: typedef PIFixedPoint fp; diff --git a/src_main/pip_export.h b/src_main/pip_export.h deleted file mode 100755 index 4c1e544d..00000000 --- a/src_main/pip_export.h +++ /dev/null @@ -1,35 +0,0 @@ - -#ifndef PIP_EXPORT_H -#define PIP_EXPORT_H - -#ifdef PIP_STATIC_DEFINE -# define PIP_EXPORT -# define PIP_NO_EXPORT -#else -# ifndef PIP_EXPORT -# ifdef pip_EXPORTS - /* We are building this library */ -# define PIP_EXPORT __attribute__((visibility("default"))) -# else - /* We are using this library */ -# define PIP_EXPORT __attribute__((visibility("default"))) -# endif -# endif - -# ifndef PIP_NO_EXPORT -# define PIP_NO_EXPORT __attribute__((visibility("hidden"))) -# endif -#endif - -#ifndef PIP_DEPRECATED -# define PIP_DEPRECATED __attribute__ ((__deprecated__)) -# define PIP_DEPRECATED_EXPORT PIP_EXPORT __attribute__ ((__deprecated__)) -# define PIP_DEPRECATED_NO_EXPORT PIP_NO_EXPORT __attribute__ ((__deprecated__)) -#endif - -#define DEFINE_NO_DEPRECATED 0 -#if DEFINE_NO_DEPRECATED -# define PIP_NO_DEPRECATED -#endif - -#endif diff --git a/src_main/resources/piresources.h b/src_main/resources/piresources.h index 8bfc16e7..b4c503eb 100644 --- a/src_main/resources/piresources.h +++ b/src_main/resources/piresources.h @@ -25,7 +25,7 @@ #include "pistring.h" -class PIResources { +class PIP_EXPORT PIResources { public: //! diff --git a/src_main/resources/piresourcesstorage.h b/src_main/resources/piresourcesstorage.h index 44f3dcfd..108d5b5b 100644 --- a/src_main/resources/piresourcesstorage.h +++ b/src_main/resources/piresourcesstorage.h @@ -25,13 +25,13 @@ class PIResources; -class PIResourcesStorage { +class PIP_EXPORT PIResourcesStorage { friend class PIResources; public: static PIResourcesStorage * instance(); - struct Section { + struct PIP_EXPORT Section { Section(); ~Section(); void add(const Section & s); @@ -39,7 +39,7 @@ public: PIMap entries; }; - struct __RCEntry { + struct PIP_EXPORT __RCEntry { __RCEntry(const PIString & s = PIString(), const PIString & n = PIString(), const PIString & a = PIString(), const PIString & f = PIString(), llong o = 0, llong si = 0, int fl = 0) { section = s; @@ -76,8 +76,8 @@ private: }; -PIByteArray & operator <<(PIByteArray & b, const PIResourcesStorage::__RCEntry & v); -PIByteArray & operator >>(PIByteArray & b, PIResourcesStorage::__RCEntry & v); +PIP_EXPORT PIByteArray & operator <<(PIByteArray & b, const PIResourcesStorage::__RCEntry & v); +PIP_EXPORT PIByteArray & operator >>(PIByteArray & b, PIResourcesStorage::__RCEntry & v); #endif // PIRESOURCES_H diff --git a/src_main/system/pisignals.cpp b/src_main/system/pisignals.cpp index 5ec8c9d7..e46d0f06 100755 --- a/src_main/system/pisignals.cpp +++ b/src_main/system/pisignals.cpp @@ -39,8 +39,10 @@ void PISignals::grabSignals(PIFlags signals_) { if (signals_[PISignals::FPE]) signal(signalCode(PISignals::FPE), PISignals::signal_event); if (signals_[PISignals::SegFault]) signal(signalCode(PISignals::SegFault), PISignals::signal_event); if (signals_[PISignals::Termination]) signal(signalCode(PISignals::Termination), PISignals::signal_event); +# ifndef CC_VC if (signals_[PISignals::UserDefined1]) signal(signalCode(PISignals::UserDefined1), PISignals::signal_event); if (signals_[PISignals::UserDefined2]) signal(signalCode(PISignals::UserDefined2), PISignals::signal_event); +# endif #ifndef WINDOWS if (signals_[PISignals::Hangup]) signal(signalCode(PISignals::Hangup), PISignals::signal_event); if (signals_[PISignals::Quit]) signal(signalCode(PISignals::Quit), PISignals::signal_event); @@ -70,8 +72,10 @@ int PISignals::signalCode(PISignals::Signal signal) { case PISignals::FPE: return SIGFPE; case PISignals::SegFault: return SIGSEGV; case PISignals::Termination: return SIGTERM; +# ifndef CC_VC case PISignals::UserDefined1: return SIGUSR1; case PISignals::UserDefined2: return SIGUSR2; +# endif #ifndef WINDOWS case PISignals::Hangup: return SIGHUP; case PISignals::Quit: return SIGQUIT; @@ -99,8 +103,10 @@ PISignals::Signal PISignals::signalFromCode(int signal) { case SIGFPE: return PISignals::FPE; case SIGSEGV: return PISignals::SegFault; case SIGTERM: return PISignals::Termination; +# ifndef CC_VC case SIGUSR1: return PISignals::UserDefined1; case SIGUSR2: return PISignals::UserDefined2; +# endif #ifndef WINDOWS case SIGHUP: return PISignals::Hangup; case SIGQUIT: return PISignals::Quit; diff --git a/src_main/thread/pigrabberbase.h b/src_main/thread/pigrabberbase.h index beb04ea3..506f4dd2 100644 --- a/src_main/thread/pigrabberbase.h +++ b/src_main/thread/pigrabberbase.h @@ -28,7 +28,7 @@ template -class PIGrabberBase: public PIThread +class PIP_EXPORT PIGrabberBase: public PIThread { PIOBJECT_SUBCLASS(PIGrabberBase, PIThread) public: diff --git a/src_main/thread/pithread.cpp b/src_main/thread/pithread.cpp index be48fe6b..58b2703e 100755 --- a/src_main/thread/pithread.cpp +++ b/src_main/thread/pithread.cpp @@ -223,8 +223,11 @@ bool PIThread::start(int timer_delay) { # endif #else if (PRIVATE->thread != 0) CloseHandle(PRIVATE->thread); +# ifdef CC_GCC PRIVATE->thread = (void *)_beginthreadex(0, 0, thread_function, this, 0, 0); -// PRIVATE->thread = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)thread_function, this, 0, 0); +# else + PRIVATE->thread = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)thread_function, this, 0, 0); +# endif if (PRIVATE->thread != 0) { #endif setPriority(priority_); @@ -259,8 +262,11 @@ bool PIThread::startOnce() { # endif #else if (PRIVATE->thread != 0) CloseHandle(PRIVATE->thread); +# ifdef CC_GCC PRIVATE->thread = (void *)_beginthreadex(0, 0, thread_function_once, this, 0, 0); -// thread = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)thread_function_once, this, 0, 0); +# else + PRIVATE->thread = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)thread_function_once, this, 0, 0); +# endif if (PRIVATE->thread != 0) { #endif setPriority(priority_); @@ -447,8 +453,11 @@ void PIThread::__thread_func__(void * t) { #ifndef WINDOWS pthread_exit(0); #else +# ifdef CC_GCC _endthreadex(0); - //ExitThread(0); +# else + ExitThread(0); +# endif #endif } @@ -493,7 +502,10 @@ void PIThread::__thread_func_once__(void * t) { #ifndef WINDOWS pthread_exit(0); #else +# ifdef CC_GCC _endthreadex(0); - //ExitThread(0); +# else + ExitThread(0); +# endif #endif } diff --git a/src_main/thread/pithread.h b/src_main/thread/pithread.h index db2afa0f..46ce2e08 100755 --- a/src_main/thread/pithread.h +++ b/src_main/thread/pithread.h @@ -31,7 +31,7 @@ class PIThread; -class __PIThreadCollection { +class PIP_EXPORT __PIThreadCollection { public: static __PIThreadCollection * instance(); void registerThread(PIThread * t); @@ -45,7 +45,7 @@ private: }; -class __PIThreadCollection_Initializer__ { +class PIP_EXPORT __PIThreadCollection_Initializer__ { public: __PIThreadCollection_Initializer__(); ~__PIThreadCollection_Initializer__(); diff --git a/src_main/thread/pitimer.h b/src_main/thread/pitimer.h index 115fa892..95ed7f01 100755 --- a/src_main/thread/pitimer.h +++ b/src_main/thread/pitimer.h @@ -31,7 +31,7 @@ typedef void (*TimerEvent)(void * , int ); class PITimer; -class _PITimerBase { +class PIP_EXPORT _PITimerBase { friend class PITimer; public: _PITimerBase(); @@ -72,7 +72,7 @@ protected: -class PITimer: public PIObject { +class PIP_EXPORT PITimer: public PIObject { PIOBJECT_SUBCLASS(PITimer, PIObject) public: @@ -214,7 +214,7 @@ public: //! \} protected: - struct Delimiter { + struct PIP_EXPORT Delimiter { Delimiter(TimerEvent slot_ = 0, int delim_ = 1) {slot = slot_; delim = delim_; tick = 0;} TimerEvent slot; int delim;