git-svn-id: svn://db.shs.com.ru/pip@597 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2018-02-12 12:20:15 +00:00
parent da48575caa
commit 6c51e8edf3
43 changed files with 204 additions and 164 deletions

View File

@@ -90,6 +90,11 @@ if (_PIP_VERSION_CHANGED)
endif() endif()
# Compiler
get_filename_component(C_COMPILER "${CMAKE_C_COMPILER}" NAME)
#message("${C_COMPILER}")
# Sources # Sources
# Main lib # Main lib
@@ -234,7 +239,10 @@ if ((NOT DEFINED LIBPROJECT) AND (DEFINED ANDROID_PLATFORM))
#message("${ANDROID_NDK}/sysroot/usr/include") #message("${ANDROID_NDK}/sysroot/usr/include")
endif() endif()
if(WIN32) 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() else()
list(APPEND LIBS_MAIN dl) list(APPEND LIBS_MAIN dl)
if(DEFINED ENV{QNX_HOST}) if(DEFINED ENV{QNX_HOST})
@@ -256,10 +264,8 @@ if(WIN32)
list(APPEND CPP_LIB_MAIN "pip_resource_win.rc") list(APPEND CPP_LIB_MAIN "pip_resource_win.rc")
add_definitions(-DPSAPI_VERSION=1) add_definitions(-DPSAPI_VERSION=1)
add_library(pip SHARED ${CPP_LIB_MAIN} ${HDRS} ${PHDRS}) add_library(pip SHARED ${CPP_LIB_MAIN} ${HDRS} ${PHDRS})
if(${CMAKE_C_COMPILER} STREQUAL "cl") if(${C_COMPILER} STREQUAL "cl.exe")
include(GenerateExportHeader) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /O2 /Ob2 /Ot /W0")
generate_export_header(pip)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /O2 /Ob2 /Ot")
else() else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -Wall") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -Wall")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native") #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
@@ -275,6 +281,10 @@ else()
add_library(pip SHARED ${CPP_LIB_MAIN}) add_library(pip SHARED ${CPP_LIB_MAIN})
endif() endif()
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}) target_link_libraries(pip ${LIBS_MAIN})
@@ -393,7 +403,7 @@ endif()
# Test program # Test program
add_executable(pip_test "main.cpp") add_executable(pip_test "main.cpp")
target_link_libraries(pip_test pip pip_compress) target_link_libraries(pip_test pip)
# Install # 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/code_model_generator")
file(COPY "${STDLIB}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/utils/resources_compiler") file(COPY "${STDLIB}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/utils/resources_compiler")
endif() endif()
else()
#message("${CMAKE_CURRENT_BINARY_DIR}/pip_export.h")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pip_export.h DESTINATION include)
endif() endif()
else() else()
if(APPLE) if(APPLE)
@@ -430,6 +443,7 @@ if(LIB)
install(FILES ${CMAKES} DESTINATION ${CMAKE_ROOT}/Modules) install(FILES ${CMAKES} DESTINATION ${CMAKE_ROOT}/Modules)
else() else()
install(TARGETS ${PIP_LIBS_TARGETS} DESTINATION bin) install(TARGETS ${PIP_LIBS_TARGETS} DESTINATION bin)
install(FILES ${HDRS} DESTINATION include)
message(STATUS "Install ${PROJECT_NAME} to local \"bin\"") message(STATUS "Install ${PROJECT_NAME} to local \"bin\"")
endif() endif()

View File

@@ -1,18 +1,11 @@
#include "pip.h" #include "pip.h"
#include "picodeparser.h"
#define PIMETA(...)
struct S {
int i PIMETA(a="123",j=5);
};
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
piCout << "Hello VS!";
//S s; //S s;
//s.i; //s.i;
PICodeParser cp; //PICodeParser cp;
cp.parseFile("cp.h"); //cp.parseFile("cp.h");
return 0; return 0;
} }

View File

@@ -37,7 +37,7 @@
template <typename T> template <typename T>
class PIFFTW_Private class PIP_EXPORT PIFFTW_Private
{ {
public: public:
explicit PIFFTW_Private() { explicit PIFFTW_Private() {

View File

@@ -28,7 +28,7 @@
namespace PICodeInfo { namespace PICodeInfo {
enum TypeFlag { enum PIP_EXPORT TypeFlag {
NoFlag, NoFlag,
Const = 0x01, Const = 0x01,
Static = 0x02, Static = 0x02,
@@ -42,7 +42,7 @@ enum TypeFlag {
typedef PIFlags<PICodeInfo::TypeFlag> TypeFlags; typedef PIFlags<PICodeInfo::TypeFlag> TypeFlags;
typedef PIMap<PIString, PIString> MetaMap; typedef PIMap<PIString, PIString> 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;} 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;} const bool isBitfield() const {return bits > 0;}
MetaMap meta; MetaMap meta;
@@ -52,14 +52,14 @@ struct TypeInfo {
int bits; int bits;
}; };
struct FunctionInfo { struct PIP_EXPORT FunctionInfo {
MetaMap meta; MetaMap meta;
PIString name; PIString name;
TypeInfo return_type; TypeInfo return_type;
PIVector<PICodeInfo::TypeInfo> arguments; PIVector<PICodeInfo::TypeInfo> arguments;
}; };
struct ClassInfo { struct PIP_EXPORT ClassInfo {
ClassInfo() {has_name = true;} ClassInfo() {has_name = true;}
MetaMap meta; MetaMap meta;
bool has_name; bool has_name;
@@ -71,14 +71,14 @@ struct ClassInfo {
PIVector<PICodeInfo::ClassInfo * > children_info; PIVector<PICodeInfo::ClassInfo * > children_info;
}; };
struct EnumeratorInfo { struct PIP_EXPORT EnumeratorInfo {
EnumeratorInfo(const PIString & n = PIString(), int v = 0) {name = n; value = v;} EnumeratorInfo(const PIString & n = PIString(), int v = 0) {name = n; value = v;}
MetaMap meta; MetaMap meta;
PIString name; PIString name;
int value; int value;
}; };
struct EnumInfo { struct PIP_EXPORT EnumInfo {
PIString memberName(int value) const; PIString memberName(int value) const;
int memberValue(const PIString & name) const; int memberValue(const PIString & name) const;
MetaMap meta; MetaMap meta;

View File

@@ -68,7 +68,7 @@ protected:
class PIScreenConsoleTile : public PIScreenTile class PIP_EXPORT PIScreenConsoleTile : public PIScreenTile
{ {
public: public:
PIScreenConsoleTile(); PIScreenConsoleTile();

View File

@@ -416,7 +416,7 @@ void TileButtons::drawEvent(PIScreenDrawer * d) {
cw = width_ - 2; cw = width_ - 2;
xo = (cw - b.first.size_s()) / 2 - 1; 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->fillRect(cx, cy, cx + cw + 2, cy + 1, ' ', Default, cb);
d->drawText(cx, cy, "[", ct, Transparent, ff); d->drawText(cx, cy, "[", ct, Transparent, ff);
d->drawText(cx + xo + 2, cy, b.first, ct, Transparent, ff); d->drawText(cx + xo + 2, cy, b.first, ct, Transparent, ff);

View File

@@ -131,7 +131,7 @@ protected:
void drawEvent(PIScreenDrawer * d); void drawEvent(PIScreenDrawer * d);
bool keyEvent(PIKbdListener::KeyEvent key); bool keyEvent(PIKbdListener::KeyEvent key);
bool mouseEvent(PIKbdListener::MouseEvent me); 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<Rect> btn_rects; PIVector<Rect> btn_rects;
}; };
@@ -201,7 +201,7 @@ protected:
PITimeMeasurer tm_blink; PITimeMeasurer tm_blink;
}; };
/*
class PIP_EXPORT TileTabs: public PIScreenTile { class PIP_EXPORT TileTabs: public PIScreenTile {
PIOBJECT_SUBCLASS(TileTabs, PIScreenTile) PIOBJECT_SUBCLASS(TileTabs, PIScreenTile)
public: public:
@@ -229,6 +229,6 @@ protected:
void selectTab(int index); void selectTab(int index);
int cur; int cur;
}; };
*/
#endif // PISCREENTILES_H #endif // PISCREENTILES_H

View File

@@ -30,7 +30,7 @@ class PIScreenTile;
namespace PIScreenTypes { namespace PIScreenTypes {
//! Color for chars or background //! Color for chars or background
enum Color { enum PIP_EXPORT Color {
Default /** Default */, Default /** Default */,
Black /** Black */, Black /** Black */,
Red /** Red */, Red /** Red */,
@@ -44,7 +44,7 @@ namespace PIScreenTypes {
}; };
//! Flags for chars //! Flags for chars
enum CharFlag { enum PIP_EXPORT CharFlag {
Bold /** Bold or bright */ = 0x1, Bold /** Bold or bright */ = 0x1,
Blink /** Blink text */ = 0x2, Blink /** Blink text */ = 0x2,
Underline /** Underline text */ = 0x4, Underline /** Underline text */ = 0x4,
@@ -52,14 +52,14 @@ namespace PIScreenTypes {
}; };
//! Alignment //! Alignment
enum Alignment { enum PIP_EXPORT Alignment {
Left /** Left */ , Left /** Left */ ,
Center /** Center */ , Center /** Center */ ,
Right /** Right */ Right /** Right */
}; };
//! Size policy //! Size policy
enum SizePolicy { enum PIP_EXPORT SizePolicy {
Fixed /** Fixed size */ , Fixed /** Fixed size */ ,
Preferred /** Preferred size */ , Preferred /** Preferred size */ ,
Expanding /** Maximum available size */ , Expanding /** Maximum available size */ ,
@@ -67,13 +67,13 @@ namespace PIScreenTypes {
}; };
//! Direction //! Direction
enum Direction { enum PIP_EXPORT Direction {
Horizontal /** Horizontal */ , Horizontal /** Horizontal */ ,
Vertical /** Vertical */ Vertical /** Vertical */
}; };
//! Position //! Position
enum Position { enum PIP_EXPORT Position {
//Left /** Left */ , //Left /** Left */ ,
//Right /** Right */ , //Right /** Right */ ,
//Top /** Top */ , //Top /** Top */ ,
@@ -81,7 +81,7 @@ namespace PIScreenTypes {
}; };
//! Focus flags //! Focus flags
enum FocusFlag { enum PIP_EXPORT FocusFlag {
CanHasFocus /** Tile can has focus */ = 0x1, CanHasFocus /** Tile can has focus */ = 0x1,
NextByTab /** Focus passed to next tile by tab key */ = 0x2, NextByTab /** Focus passed to next tile by tab key */ = 0x2,
NextByArrowsHorizontal /** Focus passed to next tile by arrow keys left or right */ = 0x4, NextByArrowsHorizontal /** Focus passed to next tile by arrow keys left or right */ = 0x4,
@@ -95,7 +95,7 @@ namespace PIScreenTypes {
typedef PIFlags<CharFlag> CharFlags; typedef PIFlags<CharFlag> CharFlags;
typedef PIFlags<FocusFlag> FocusFlags; typedef PIFlags<FocusFlag> FocusFlags;
union CellFormat { union PIP_EXPORT CellFormat {
CellFormat(uint f = 0) {raw_format = f;} CellFormat(uint f = 0) {raw_format = f;}
CellFormat(Color col_char, Color col_back = Default, CharFlags flags_ = 0) { CellFormat(Color col_char, Color col_back = Default, CharFlags flags_ = 0) {
color_char = col_char; color_char = col_char;
@@ -112,7 +112,7 @@ namespace PIScreenTypes {
bool operator !=(const CellFormat & c) const {return raw_format != c.raw_format;} 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;} Cell(PIChar c = PIChar(' '), CellFormat f = CellFormat()) {symbol = c; format = f;}
CellFormat format; CellFormat format;
PIChar symbol; 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) {} TileEvent(int t = -1, const PIVariant & d = PIVariant()): type(t), data(d) {}
int type; int type;
PIVariant data; PIVariant data;

View File

@@ -182,12 +182,12 @@ public:
#else #else
struct _PIForeachBase {mutable bool _break, _end;}; class _PIForeachBase {public: mutable bool _break, _end; };
template<typename Type> template<typename Type>
class _PIForeach: public _PIForeachBase { class _PIForeach: public _PIForeachBase {
public: 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::value_type _var;
mutable typename Type::iterator _it; mutable typename Type::iterator _it;
mutable typename Type::reverse_iterator _rit; mutable typename Type::reverse_iterator _rit;
@@ -200,7 +200,7 @@ public:
template<typename Type> template<typename Type>
class _PIForeachC: public _PIForeachBase { class _PIForeachC: public _PIForeachBase {
public: 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::value_type _var;
mutable typename Type::const_iterator _it; mutable typename Type::const_iterator _it;
mutable typename Type::const_reverse_iterator _rit; mutable typename Type::const_reverse_iterator _rit;

View File

@@ -207,7 +207,7 @@ public:
void swap(PIMap<Key, T> & other) { void swap(PIMap<Key, T> & other) {
piSwapBinary<PIVector<T> >(pim_content, other.pim_content); piSwapBinary<PIVector<T> >(pim_content, other.pim_content);
piSwapBinary<PIVector<MapIndex> >(pim_index, other.pim_index); piSwapBinary<PIDeque<MapIndex> >(pim_index, other.pim_index);
} }
PIMap<Key, T> & insert(const Key & key, const T & value) { PIMap<Key, T> & insert(const Key & key, const T & value) {

View File

@@ -104,6 +104,11 @@
# pragma comment(lib, "Ws2_32.lib") # pragma comment(lib, "Ws2_32.lib")
# pragma comment(lib, "Iphlpapi.lib") # pragma comment(lib, "Iphlpapi.lib")
# pragma comment(lib, "Psapi.lib") # pragma comment(lib, "Psapi.lib")
# ifdef ARCH_BITS_32
# define _X86_
# else
# define _IA64_
# endif
# else # else
# define SHUT_RDWR SD_BOTH # define SHUT_RDWR SD_BOTH
# endif # endif
@@ -258,6 +263,22 @@ template<typename T> 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<void*>(f), * ps = const_cast<void*>(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 /*! \brief Function for compare two values without "=" by raw content
* \details Example:\n \snippet piincludes.cpp compareBinary */ * \details Example:\n \snippet piincludes.cpp compareBinary */
inline bool piCompareBinary(const void * f, const void * s, size_t size) { inline bool piCompareBinary(const void * f, const void * s, size_t size) {

View File

@@ -26,7 +26,7 @@
#include "pibytearray.h" #include "pibytearray.h"
class PIChunkStream class PIP_EXPORT PIChunkStream
{ {
public: public:

View File

@@ -44,16 +44,16 @@ extern lconv * currentLocale;
/*! \fn errorString() /*! \fn errorString()
* \brief Return readable error description in format "code <number> - <description>" */ * \brief Return readable error description in format "code <number> - <description>" */
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(); PIP_EXPORT void randomize();
int randomi(); PIP_EXPORT int randomi();
/// Return readable version of PIP /// Return readable version of PIP
PIString PIPVersion(); PIP_EXPORT PIString PIPVersion();
#endif // PIINCLUDES_H #endif // PIINCLUDES_H

View File

@@ -25,8 +25,8 @@
# include <stdarg.h> # include <stdarg.h>
# include <windef.h> # include <windef.h>
# include <winbase.h> # include <winbase.h>
typedef void(*PINtQueryTimerResolution)(PULONG, PULONG, PULONG); typedef LONG(NTAPI*PINtQueryTimerResolution)(PULONG, PULONG, PULONG);
typedef void(*PINtSetTimerResolution)(ULONG, BOOLEAN, PULONG); typedef LONG(NTAPI*PINtSetTimerResolution)(ULONG, BOOLEAN, PULONG);
#endif #endif
#ifdef CC_GCC #ifdef CC_GCC
# include <unistd.h> # include <unistd.h>

View File

@@ -34,10 +34,12 @@
void __PISetTimerResolution() { void __PISetTimerResolution() {
if (setTimerResolutionAddr == NULL || getTimerResolutionAddr == NULL) if (setTimerResolutionAddr == NULL || getTimerResolutionAddr == NULL)
return; return;
ULONG max(0), min(0), cur(0); ULONG _max(0), _min(0), _cur(0);
getTimerResolutionAddr(&max, &min, &cur); //printf("getTimerResolution ...\n");
//printf("getTimerResolution %lu %lu %lu\n", min, max, cur); LONG q = getTimerResolutionAddr(&_max, &_min, &_cur);
setTimerResolutionAddr(min, TRUE, &cur); //printf("getTimerResolution %d %lu %lu %lu\n", q, _min, _max, _cur);
if (q == 0)
setTimerResolutionAddr(_min, TRUE, &_cur);
//printf("setTimerResolution %lu\n", cur); //printf("setTimerResolution %lu\n", cur);
} }
#else #else
@@ -149,8 +151,8 @@ PIInit::PIInit() {
if (PRIVATE->ntlib) { if (PRIVATE->ntlib) {
getTimerResolutionAddr = (PINtQueryTimerResolution)GetProcAddress(PRIVATE->ntlib, "NtQueryTimerResolution"); getTimerResolutionAddr = (PINtQueryTimerResolution)GetProcAddress(PRIVATE->ntlib, "NtQueryTimerResolution");
setTimerResolutionAddr = (PINtSetTimerResolution)GetProcAddress(PRIVATE->ntlib, "NtSetTimerResolution"); setTimerResolutionAddr = (PINtSetTimerResolution)GetProcAddress(PRIVATE->ntlib, "NtSetTimerResolution");
__PISetTimerResolution();
} }
__PISetTimerResolution();
/*if (setTimerResolution) setTimerResolutionAddr(1, TRUE, &(PRIVATE->prev_res));*/ /*if (setTimerResolution) setTimerResolutionAddr(1, TRUE, &(PRIVATE->prev_res));*/
# endif # endif
//piDebug = true; //piDebug = true;

View File

@@ -30,7 +30,7 @@ class PIFile;
class PIStringList; class PIStringList;
class __PIInit_Initializer__ { class PIP_EXPORT __PIInit_Initializer__ {
public: public:
__PIInit_Initializer__(); __PIInit_Initializer__();
~__PIInit_Initializer__(); ~__PIInit_Initializer__();
@@ -39,7 +39,7 @@ public:
}; };
class PIInit { class PIP_EXPORT PIInit {
friend class __PIInit_Initializer__; friend class __PIInit_Initializer__;
friend class PIFile; friend class PIFile;
public: public:

View File

@@ -185,7 +185,11 @@
#define _PI_STR(x) #x #define _PI_STR(x) #x
#define _PI_SSTR(x) _PI_STR(x) #define _PI_SSTR(x) _PI_STR(x)
#define LOCATION __FILE__ ":" _PI_SSTR(__LINE__) #define LOCATION __FILE__ ":" _PI_SSTR(__LINE__)
#define __PTYPE(t) typename __PIVariantTypeInfo__<t>::PureType #ifdef CC_GCC
# define __PTYPE(t) typename __PIVariantTypeInfo__<t>::PureType
#else
# define __PTYPE(t) __PIVariantTypeInfo__<t>::PureType
#endif
#define __VVALUE(t, v) v.value< __PTYPE(t) >() #define __VVALUE(t, v) v.value< __PTYPE(t) >()

View File

@@ -731,7 +731,7 @@ private:
//! \relatesalso PIString \relatesalso PICout \brief Output operator to PICout //! \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 //! \relatesalso PIString \relatesalso PIByteArray \brief Output operator to PIByteArray

View File

@@ -31,7 +31,7 @@
#endif #endif
//! \brief Sleep for "msecs" milliseconds //! \brief Sleep for "msecs" milliseconds
void msleep(int msecs); PIP_EXPORT void msleep(int msecs);
/*! \brief Precise sleep for "usecs" microseconds /*! \brief Precise sleep for "usecs" microseconds
* \details This function consider \c "usleep" offset * \details This function consider \c "usleep" offset
@@ -39,7 +39,7 @@ void msleep(int msecs);
* \a pip_sys_test program. If there is correct * \a pip_sys_test program. If there is correct
* offset value in system config, this function * offset value in system config, this function
* wait \b exactly "usecs" microseconds. */ * 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 /*! \brief Precise sleep for "msecs" milliseconds
* \details This function exec \a piUSleep (msecs * 1000). */ * \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;} 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 //! \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;} 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 //! \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;} 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 //! \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: public:
PITimeMeasurer(); PITimeMeasurer();

View File

@@ -37,7 +37,7 @@
template<typename T> template<typename T>
class __PIVariantFunctions__ { class PIP_EXPORT __PIVariantFunctions__ {
public: public:
static PIString typeNameHelper() {return PIStringAscii("");} static PIString typeNameHelper() {return PIStringAscii("");}
@@ -46,7 +46,7 @@ public:
template<typename C> static C castVariant(const T & v) {return C();} template<typename C> static C castVariant(const T & v) {return C();}
}; };
struct __PIVariantInfo__ { struct PIP_EXPORT __PIVariantInfo__ {
__PIVariantInfo__() { __PIVariantInfo__() {
simple = false; simple = false;
} }
@@ -57,7 +57,7 @@ struct __PIVariantInfo__ {
}; };
template<typename T> template<typename T>
struct __PIVariantTypeInfo__ { struct PIP_EXPORT __PIVariantTypeInfo__ {
typedef T PureType; typedef T PureType;
typedef const T ConstPureType; typedef const T ConstPureType;
typedef T * PointerType; typedef T * PointerType;
@@ -84,7 +84,7 @@ struct __PIVariantTypeInfo__ {
//__TYPEINFO_SINGLE(T, const T *) //__TYPEINFO_SINGLE(T, const T *)
class __PIVariantInfoStorage__ { class PIP_EXPORT __PIVariantInfoStorage__ {
public: public:
__PIVariantInfoStorage__() {if (!map) map = new PIMap<PIString, __PIVariantInfo__ * >();} __PIVariantInfoStorage__() {if (!map) map = new PIMap<PIString, __PIVariantInfo__ * >();}
static __PIVariantInfoStorage__ * get() {static __PIVariantInfoStorage__ * r = new __PIVariantInfoStorage__(); return r;} static __PIVariantInfoStorage__ * get() {static __PIVariantInfoStorage__ * r = new __PIVariantInfoStorage__(); return r;}
@@ -102,7 +102,7 @@ REGISTER_VARIANT_TYPEINFO(ns::classname)
#define REGISTER_VARIANT_CPP(classname) \ #define REGISTER_VARIANT_CPP(classname) \
template <typename T> \ template <typename T> \
class __##classname##_PIVariantInitializer__ { \ class PIP_EXPORT __##classname##_PIVariantInitializer__ { \
public: \ public: \
__##classname##_PIVariantInitializer__(const PIString & name) { \ __##classname##_PIVariantInitializer__(const PIString & name) { \
if (__PIVariantInfoStorage__::get()->map->contains(name)) \ if (__PIVariantInfoStorage__::get()->map->contains(name)) \
@@ -115,7 +115,7 @@ public: \
#define REGISTER_NS_VARIANT_CPP(ns, classname) \ #define REGISTER_NS_VARIANT_CPP(ns, classname) \
template <typename T> \ template <typename T> \
class __##ns##classname##_PIVariantInitializer__ { \ class PIP_EXPORT __##ns##classname##_PIVariantInitializer__ { \
public: \ public: \
__##ns##classname##_PIVariantInitializer__(const PIString & name) { \ __##ns##classname##_PIVariantInitializer__(const PIString & name) { \
if (__PIVariantInfoStorage__::get()->map->contains(name)) \ if (__PIVariantInfoStorage__::get()->map->contains(name)) \
@@ -155,7 +155,7 @@ PIByteArray __PIVariantFunctions__<classname_from>::castHelper<classname_to>(PIB
PIByteArray ret; ret << t; \ PIByteArray ret; ret << t; \
return ret;} \ return ret;} \
template <typename T, typename C> \ template <typename T, typename C> \
class __##classname_from##_##classname_to##_PIVariantCastInitializer__ { \ class PIP_EXPORT __##classname_from##_##classname_to##_PIVariantCastInitializer__ { \
public: \ public: \
__##classname_from##_##classname_to##_PIVariantCastInitializer__(const PIString & name, const PIString & cname) { \ __##classname_from##_##classname_to##_PIVariantCastInitializer__(const PIString & name, const PIString & cname) { \
__PIVariantInfo__ * vi(__PIVariantInfoStorage__::get()->map->value(name, 0)); \ __PIVariantInfo__ * vi(__PIVariantInfoStorage__::get()->map->value(name, 0)); \
@@ -206,7 +206,7 @@ class PIP_EXPORT PIVariant {
public: public:
//! Type of %PIVariant content //! Type of %PIVariant content
enum Type { enum PIP_EXPORT Type {
pivInvalid /** Invalid type , default type of empty contructor */ = 0 , pivInvalid /** Invalid type , default type of empty contructor */ = 0 ,
pivBool /** bool */ , pivBool /** bool */ ,
pivChar /** char */ , pivChar /** char */ ,

View File

@@ -30,13 +30,13 @@
namespace PIVariantTypes { namespace PIVariantTypes {
struct Enumerator { struct PIP_EXPORT Enumerator {
Enumerator(int v = 0, const PIString & n = PIString()): value(v), name(n) {} Enumerator(int v = 0, const PIString & n = PIString()): value(v), name(n) {}
int value; int value;
PIString name; PIString name;
}; };
struct Enum { struct PIP_EXPORT Enum {
Enum(const PIString & n = PIString()): enum_name(n) {} Enum(const PIString & n = PIString()): enum_name(n) {}
PIString toString() const {return selected;} // obsolete PIString toString() const {return selected;} // obsolete
int selectedValue() const; int selectedValue() const;
@@ -55,7 +55,7 @@ namespace PIVariantTypes {
Enum & operator <<(const PIStringList & v); 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) {} 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 toString() const {return file;}
PIString file; PIString file;
@@ -63,14 +63,14 @@ namespace PIVariantTypes {
bool is_abs; bool is_abs;
}; };
struct Dir { struct PIP_EXPORT Dir {
Dir(const PIString & d = PIString(), bool abs = false): dir(d), is_abs(abs) {} Dir(const PIString & d = PIString(), bool abs = false): dir(d), is_abs(abs) {}
PIString toString() const {return dir;} PIString toString() const {return dir;}
PIString dir; PIString dir;
bool is_abs; bool is_abs;
}; };
struct Color { struct PIP_EXPORT Color {
Color(uint v = 0) {rgba = v;} Color(uint v = 0) {rgba = v;}
uint rgba; uint rgba;
}; };

View File

@@ -26,7 +26,7 @@
#include "pimathbase.h" #include "pimathbase.h"
class PIEllipsoidModel { class PIP_EXPORT PIEllipsoidModel {
public: public:
PIEllipsoidModel(); PIEllipsoidModel();
double eccSquared() const {return eccentricity * eccentricity;} // eccentricity squared double eccSquared() const {return eccentricity * eccentricity;} // eccentricity squared

View File

@@ -26,7 +26,7 @@
#include "piellipsoidmodel.h" #include "piellipsoidmodel.h"
#include "pimathvector.h" #include "pimathvector.h"
class PIGeoPosition : public PIMathVectorT3d class PIP_EXPORT PIGeoPosition : public PIMathVectorT3d
{ {
public: public:

View File

@@ -26,7 +26,7 @@
#include "picrc.h" #include "picrc.h"
#include "pidiagnostics.h" #include "pidiagnostics.h"
class PIBaseTransfer: public PIObject class PIP_EXPORT PIBaseTransfer: public PIObject
{ {
PIOBJECT_SUBCLASS(PIBaseTransfer, PIObject) PIOBJECT_SUBCLASS(PIBaseTransfer, PIObject)
public: public:
@@ -34,7 +34,7 @@ public:
~PIBaseTransfer(); ~PIBaseTransfer();
# pragma pack(push,1) # pragma pack(push,1)
struct PacketHeader { struct PIP_EXPORT PacketHeader {
uint sig; uint sig;
int type; // PacketType int type; // PacketType
int session_id; int session_id;
@@ -43,7 +43,7 @@ public:
bool check_sig() {return (sig == signature);} 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_) {} Part(uint id_ = 0, ullong size_ = 0, ullong start_ = 0) : id(id_), size(size_), start(start_) {}
uint id; uint id;
ullong size; ullong size;
@@ -102,10 +102,10 @@ protected:
llong bytes_all, bytes_cur; llong bytes_all, bytes_cur;
private: 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) # pragma pack(push,1)
struct StartRequest { struct PIP_EXPORT StartRequest {
uint packets; uint packets;
ullong size; ullong size;
}; };

View File

@@ -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 static functions to join binlog files
/// TODO: Create functions to insert and delete records /// TODO: Create functions to insert and delete records
class PIBinaryLog: public PIIODevice class PIP_EXPORT PIBinaryLog: public PIIODevice
{ {
PIIODEVICE(PIBinaryLog) PIIODEVICE(PIBinaryLog)
public: public:

View File

@@ -282,7 +282,7 @@ public:
//! Returns if Device pool works in fake mode //! Returns if Device pool works in fake mode
static bool isFakeMode(); static bool isFakeMode();
class DevicePool: public PIThread { class PIP_EXPORT DevicePool: public PIThread {
PIOBJECT_SUBCLASS(DevicePool, PIThread) PIOBJECT_SUBCLASS(DevicePool, PIThread)
friend void __DevicePool_threadReadDP(void * ddp); friend void __DevicePool_threadReadDP(void * ddp);
friend class PIConnection; friend class PIConnection;
@@ -302,7 +302,7 @@ public:
PIVector<PIIODevice * > boundedDevices(const PIConnection * parent) const; PIVector<PIIODevice * > boundedDevices(const PIConnection * parent) const;
protected: protected:
struct DeviceData { struct PIP_EXPORT DeviceData {
DeviceData(): dev(0), rthread(0), started(false) {} DeviceData(): dev(0), rthread(0), started(false) {}
~DeviceData(); ~DeviceData();
PIIODevice * dev; PIIODevice * dev;
@@ -372,14 +372,14 @@ private:
PIString devFPath(const PIIODevice * d) const; PIString devFPath(const PIIODevice * d) const;
PIIODevice * devByString(const PIString & s) const; PIIODevice * devByString(const PIString & s) const;
struct Extractor { struct PIP_EXPORT Extractor {
Extractor(): extractor(0) {} Extractor(): extractor(0) {}
~Extractor(); ~Extractor();
PIPacketExtractor * extractor; PIPacketExtractor * extractor;
PIVector<PIIODevice * > devices; PIVector<PIIODevice * > devices;
}; };
class Sender: public PITimer { class PIP_EXPORT Sender: public PITimer {
PIOBJECT_SUBCLASS(Sender, PIObject) PIOBJECT_SUBCLASS(Sender, PIObject)
public: public:
Sender(PIConnection * parent_ = 0): parent(parent_), int_(0.f) {needLockRun(true);} 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__; extern PIConnection::DevicePool * __device_pool__;
class __DevicePoolContainer__ { class PIP_EXPORT __DevicePoolContainer__ {
public: public:
__DevicePoolContainer__(); __DevicePoolContainer__();
static bool inited_; static bool inited_;

View File

@@ -25,7 +25,7 @@
#include "pibasetransfer.h" #include "pibasetransfer.h"
class PIDataTransfer: public PIBaseTransfer class PIP_EXPORT PIDataTransfer: public PIBaseTransfer
{ {
PIOBJECT_SUBCLASS(PIDataTransfer, PIBaseTransfer) PIOBJECT_SUBCLASS(PIDataTransfer, PIBaseTransfer)
public: public:

View File

@@ -212,7 +212,10 @@ private:
uint cnt_fail; uint cnt_fail;
bool empty; 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); void tick(void *, int);
Entry calcHistory(PIQueue<Entry> & hist, int & cnt); Entry calcHistory(PIQueue<Entry> & hist, int & cnt);
void propertyChanged(const PIString &); 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 #endif // PIDIAGNOSTICS_H

View File

@@ -53,9 +53,15 @@
# define _fseek_call_ fseek # define _fseek_call_ fseek
# define _ftell_call_ ftell # define _ftell_call_ ftell
# else # else
# define _fopen_call_ fopen64 # ifdef CC_GCC
# define _fseek_call_ fseeko64 # define _fopen_call_ fopen64
# define _ftell_call_ ftello64 # define _fseek_call_ fseeko64
# define _ftell_call_ ftello64
# else
# define _fopen_call_ fopen
# define _fseek_call_ fseek
# define _ftell_call_ ftell
# endif
# endif # endif
# define _stat_struct_ struct stat64 # define _stat_struct_ struct stat64
# define _stat_call_ stat64 # define _stat_call_ stat64

View File

@@ -34,10 +34,10 @@ public:
//! Constructs an empty file //! Constructs an empty file
explicit PIFile(); explicit PIFile();
struct FileInfo { struct PIP_EXPORT FileInfo {
FileInfo() {size = 0; id_group = id_user = 0;} FileInfo() {size = 0; id_group = id_user = 0;}
enum Flag { enum PIP_EXPORT Flag {
File = 0x01, File = 0x01,
Dir = 0x02, Dir = 0x02,
Dot = 0x04, Dot = 0x04,
@@ -46,7 +46,7 @@ public:
Hidden = 0x20 Hidden = 0x20
}; };
typedef PIFlags<FileInfo::Flag> Flags; typedef PIFlags<FileInfo::Flag> Flags;
struct Permissions { struct PIP_EXPORT Permissions {
Permissions(uchar r = 0): raw(r) {} Permissions(uchar r = 0): raw(r) {}
Permissions(bool r, bool w, bool e): raw(0) {read = r; write = w; exec = e;} 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" : "-");} PIString toString() const {return PIString(read ? "r" : "-") + PIString(write ? "w" : "-") + PIString(exec ? "x" : "-");}

View File

@@ -28,22 +28,22 @@
#define __PIFILETRANSFER_VERSION 2 #define __PIFILETRANSFER_VERSION 2
class PIFileTransfer: public PIBaseTransfer class PIP_EXPORT PIFileTransfer: public PIBaseTransfer
{ {
PIOBJECT_SUBCLASS(PIFileTransfer, PIBaseTransfer) PIOBJECT_SUBCLASS(PIFileTransfer, PIBaseTransfer)
public: public:
PIFileTransfer(); PIFileTransfer();
~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) {} PFTFileInfo(const PIFile::FileInfo &fi = PIFile::FileInfo()): PIFile::FileInfo(fi) {}
PIString dest_path; PIString dest_path;
}; };
#pragma pack(push,1) #pragma pack(push,1)
struct PFTHeader { struct PIP_EXPORT PFTHeader {
union { union {
struct { struct {
char sig[3]; // PFT char sig[3]; // PFT

View File

@@ -25,7 +25,7 @@
#include "pistring.h" #include "pistring.h"
class PICrypt { class PIP_EXPORT PICrypt {
public: public:
//! Construct and generate random key //! Construct and generate random key
PICrypt(); PICrypt();

View File

@@ -31,12 +31,12 @@ typedef complexd (*FuncFunc)(void * , int, complexd * );
namespace PIEvaluatorTypes { namespace PIEvaluatorTypes {
static const int operationCount = 14; static const int operationCount = 14;
enum eType {etNumber, etOperator, etVariable, etFunction}; enum PIP_EXPORT eType {etNumber, etOperator, etVariable, etFunction};
enum Operation {oNone, oAdd, oSubtract, oMultiply, oDivide, oResidue, oPower, enum PIP_EXPORT Operation {oNone, oAdd, oSubtract, oMultiply, oDivide, oResidue, oPower,
oEqual, oNotEqual, oGreater, oSmaller, oGreaterEqual, oSmallerEqual, oEqual, oNotEqual, oGreater, oSmaller, oGreaterEqual, oSmallerEqual,
oAnd, oOr, oFunction oAnd, oOr, oFunction
}; };
enum BaseFunctions {bfUnknown, bfSin, bfCos, bfTg, bfCtg, enum PIP_EXPORT BaseFunctions {bfUnknown, bfSin, bfCos, bfTg, bfCtg,
bfArcsin, bfArccos, bfArctg, bfArcctg, bfArcsin, bfArccos, bfArctg, bfArcctg,
bfExp, bfRandom, bfRandomn, bfExp, bfRandom, bfRandomn,
bfSh, bfCh, bfTh, bfCth, bfSh, bfCh, bfTh, bfCth,
@@ -50,7 +50,7 @@ namespace PIEvaluatorTypes {
bfCustom = 0xFFFF bfCustom = 0xFFFF
}; };
struct Instruction { struct PIP_EXPORT Instruction {
Instruction() {out = -1; function = -1; operation = oNone;} Instruction() {out = -1; function = -1; operation = oNone;}
Instruction(Operation oper, PIVector<int> opers, int out_ind, int func = -1) { Instruction(Operation oper, PIVector<int> opers, int out_ind, int func = -1) {
operation = oper; operators = opers; out = out_ind; function = func;} operation = oper; operators = opers; out = out_ind; function = func;}
@@ -59,7 +59,7 @@ namespace PIEvaluatorTypes {
int out; int out;
int function; int function;
}; };
struct Element { struct PIP_EXPORT Element {
Element() {num = 0; var_num = -1; type = etNumber;} 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);} 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;} 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 num;
int var_num; int var_num;
}; };
struct Function { struct PIP_EXPORT Function {
Function() {arguments = 0; type = bfUnknown; handler = 0;} 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, 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;} Function(const PIString & name, int args, FuncFunc h) {identifier = name; arguments = args; type = bfCustom; handler = h;}
@@ -76,7 +76,7 @@ namespace PIEvaluatorTypes {
FuncFunc handler; FuncFunc handler;
int arguments; int arguments;
}; };
struct Variable { struct PIP_EXPORT Variable {
Variable() {value = 0.;} Variable() {value = 0.;}
Variable(const PIString & var_name, complexd val) {name = var_name; value = val;} Variable(const PIString & var_name, complexd val) {name = var_name; value = val;}
PIString name; PIString name;

View File

@@ -121,6 +121,7 @@ typedef PIFFT_double PIFFT;
typedef PIFFT_double PIFFTd; typedef PIFFT_double PIFFTd;
typedef PIFFT_float PIFFTf; typedef PIFFT_float PIFFTf;
#ifndef CC_VC
#define _PIFFTW_H(type) class _PIFFTW_P_##type##_ { \ #define _PIFFTW_H(type) class _PIFFTW_P_##type##_ { \
public: \ public: \
@@ -190,4 +191,6 @@ template<> inline void PIFFTW<ldouble>::deleteP(void *& _p) {if (_p) delete (_PI
typedef PIFFTW<ldouble> PIFFTWld; typedef PIFFTW<ldouble> PIFFTWld;
#endif
#endif // PIFFT_H #endif // PIFFT_H

View File

@@ -24,8 +24,9 @@
#ifndef PIFIXEDPOINT_H #ifndef PIFIXEDPOINT_H
#define PIFIXEDPOINT_H #define PIFIXEDPOINT_H
template<int Precision = 0, typename Type = int> template<int Precision = 0, typename Type = int>
class PIFixedPoint { class PIP_EXPORT PIFixedPoint {
// friend PICout operator <<(PICout s, const FixedPoint<> & v); // friend PICout operator <<(PICout s, const FixedPoint<> & v);
public: public:
typedef PIFixedPoint<Precision, Type> fp; typedef PIFixedPoint<Precision, Type> fp;

View File

@@ -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

View File

@@ -25,7 +25,7 @@
#include "pistring.h" #include "pistring.h"
class PIResources { class PIP_EXPORT PIResources {
public: public:
//! //!

View File

@@ -25,13 +25,13 @@
class PIResources; class PIResources;
class PIResourcesStorage { class PIP_EXPORT PIResourcesStorage {
friend class PIResources; friend class PIResources;
public: public:
static PIResourcesStorage * instance(); static PIResourcesStorage * instance();
struct Section { struct PIP_EXPORT Section {
Section(); Section();
~Section(); ~Section();
void add(const Section & s); void add(const Section & s);
@@ -39,7 +39,7 @@ public:
PIMap<PIString, PIByteArray * > entries; PIMap<PIString, PIByteArray * > entries;
}; };
struct __RCEntry { struct PIP_EXPORT __RCEntry {
__RCEntry(const PIString & s = PIString(), const PIString & n = PIString(), const PIString & a = PIString(), __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) { const PIString & f = PIString(), llong o = 0, llong si = 0, int fl = 0) {
section = s; section = s;
@@ -76,8 +76,8 @@ private:
}; };
PIByteArray & operator <<(PIByteArray & b, const PIResourcesStorage::__RCEntry & v); PIP_EXPORT PIByteArray & operator <<(PIByteArray & b, const PIResourcesStorage::__RCEntry & v);
PIByteArray & operator >>(PIByteArray & b, PIResourcesStorage::__RCEntry & v); PIP_EXPORT PIByteArray & operator >>(PIByteArray & b, PIResourcesStorage::__RCEntry & v);
#endif // PIRESOURCES_H #endif // PIRESOURCES_H

View File

@@ -39,8 +39,10 @@ void PISignals::grabSignals(PIFlags<PISignals::Signal> signals_) {
if (signals_[PISignals::FPE]) signal(signalCode(PISignals::FPE), PISignals::signal_event); 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::SegFault]) signal(signalCode(PISignals::SegFault), PISignals::signal_event);
if (signals_[PISignals::Termination]) signal(signalCode(PISignals::Termination), 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::UserDefined1]) signal(signalCode(PISignals::UserDefined1), PISignals::signal_event);
if (signals_[PISignals::UserDefined2]) signal(signalCode(PISignals::UserDefined2), PISignals::signal_event); if (signals_[PISignals::UserDefined2]) signal(signalCode(PISignals::UserDefined2), PISignals::signal_event);
# endif
#ifndef WINDOWS #ifndef WINDOWS
if (signals_[PISignals::Hangup]) signal(signalCode(PISignals::Hangup), PISignals::signal_event); if (signals_[PISignals::Hangup]) signal(signalCode(PISignals::Hangup), PISignals::signal_event);
if (signals_[PISignals::Quit]) signal(signalCode(PISignals::Quit), 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::FPE: return SIGFPE;
case PISignals::SegFault: return SIGSEGV; case PISignals::SegFault: return SIGSEGV;
case PISignals::Termination: return SIGTERM; case PISignals::Termination: return SIGTERM;
# ifndef CC_VC
case PISignals::UserDefined1: return SIGUSR1; case PISignals::UserDefined1: return SIGUSR1;
case PISignals::UserDefined2: return SIGUSR2; case PISignals::UserDefined2: return SIGUSR2;
# endif
#ifndef WINDOWS #ifndef WINDOWS
case PISignals::Hangup: return SIGHUP; case PISignals::Hangup: return SIGHUP;
case PISignals::Quit: return SIGQUIT; case PISignals::Quit: return SIGQUIT;
@@ -99,8 +103,10 @@ PISignals::Signal PISignals::signalFromCode(int signal) {
case SIGFPE: return PISignals::FPE; case SIGFPE: return PISignals::FPE;
case SIGSEGV: return PISignals::SegFault; case SIGSEGV: return PISignals::SegFault;
case SIGTERM: return PISignals::Termination; case SIGTERM: return PISignals::Termination;
# ifndef CC_VC
case SIGUSR1: return PISignals::UserDefined1; case SIGUSR1: return PISignals::UserDefined1;
case SIGUSR2: return PISignals::UserDefined2; case SIGUSR2: return PISignals::UserDefined2;
# endif
#ifndef WINDOWS #ifndef WINDOWS
case SIGHUP: return PISignals::Hangup; case SIGHUP: return PISignals::Hangup;
case SIGQUIT: return PISignals::Quit; case SIGQUIT: return PISignals::Quit;

View File

@@ -28,7 +28,7 @@
template<typename T = PIByteArray> template<typename T = PIByteArray>
class PIGrabberBase: public PIThread class PIP_EXPORT PIGrabberBase: public PIThread
{ {
PIOBJECT_SUBCLASS(PIGrabberBase, PIThread) PIOBJECT_SUBCLASS(PIGrabberBase, PIThread)
public: public:

View File

@@ -223,8 +223,11 @@ bool PIThread::start(int timer_delay) {
# endif # endif
#else #else
if (PRIVATE->thread != 0) CloseHandle(PRIVATE->thread); if (PRIVATE->thread != 0) CloseHandle(PRIVATE->thread);
# ifdef CC_GCC
PRIVATE->thread = (void *)_beginthreadex(0, 0, thread_function, this, 0, 0); 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) { if (PRIVATE->thread != 0) {
#endif #endif
setPriority(priority_); setPriority(priority_);
@@ -259,8 +262,11 @@ bool PIThread::startOnce() {
# endif # endif
#else #else
if (PRIVATE->thread != 0) CloseHandle(PRIVATE->thread); if (PRIVATE->thread != 0) CloseHandle(PRIVATE->thread);
# ifdef CC_GCC
PRIVATE->thread = (void *)_beginthreadex(0, 0, thread_function_once, this, 0, 0); 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) { if (PRIVATE->thread != 0) {
#endif #endif
setPriority(priority_); setPriority(priority_);
@@ -447,8 +453,11 @@ void PIThread::__thread_func__(void * t) {
#ifndef WINDOWS #ifndef WINDOWS
pthread_exit(0); pthread_exit(0);
#else #else
# ifdef CC_GCC
_endthreadex(0); _endthreadex(0);
//ExitThread(0); # else
ExitThread(0);
# endif
#endif #endif
} }
@@ -493,7 +502,10 @@ void PIThread::__thread_func_once__(void * t) {
#ifndef WINDOWS #ifndef WINDOWS
pthread_exit(0); pthread_exit(0);
#else #else
# ifdef CC_GCC
_endthreadex(0); _endthreadex(0);
//ExitThread(0); # else
ExitThread(0);
# endif
#endif #endif
} }

View File

@@ -31,7 +31,7 @@
class PIThread; class PIThread;
class __PIThreadCollection { class PIP_EXPORT __PIThreadCollection {
public: public:
static __PIThreadCollection * instance(); static __PIThreadCollection * instance();
void registerThread(PIThread * t); void registerThread(PIThread * t);
@@ -45,7 +45,7 @@ private:
}; };
class __PIThreadCollection_Initializer__ { class PIP_EXPORT __PIThreadCollection_Initializer__ {
public: public:
__PIThreadCollection_Initializer__(); __PIThreadCollection_Initializer__();
~__PIThreadCollection_Initializer__(); ~__PIThreadCollection_Initializer__();

View File

@@ -31,7 +31,7 @@ typedef void (*TimerEvent)(void * , int );
class PITimer; class PITimer;
class _PITimerBase { class PIP_EXPORT _PITimerBase {
friend class PITimer; friend class PITimer;
public: public:
_PITimerBase(); _PITimerBase();
@@ -72,7 +72,7 @@ protected:
class PITimer: public PIObject { class PIP_EXPORT PITimer: public PIObject {
PIOBJECT_SUBCLASS(PITimer, PIObject) PIOBJECT_SUBCLASS(PITimer, PIObject)
public: public:
@@ -214,7 +214,7 @@ public:
//! \} //! \}
protected: protected:
struct Delimiter { struct PIP_EXPORT Delimiter {
Delimiter(TimerEvent slot_ = 0, int delim_ = 1) {slot = slot_; delim = delim_; tick = 0;} Delimiter(TimerEvent slot_ = 0, int delim_ = 1) {slot = slot_; delim = delim_; tick = 0;}
TimerEvent slot; TimerEvent slot;
int delim; int delim;