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()
# 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()

View File

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

View File

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

View File

@@ -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<PICodeInfo::TypeFlag> TypeFlags;
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;}
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<PICodeInfo::TypeInfo> arguments;
};
struct ClassInfo {
struct PIP_EXPORT ClassInfo {
ClassInfo() {has_name = true;}
MetaMap meta;
bool has_name;
@@ -71,14 +71,14 @@ struct ClassInfo {
PIVector<PICodeInfo::ClassInfo * > 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;

View File

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

View File

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

View File

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

View File

@@ -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<CharFlag> CharFlags;
typedef PIFlags<FocusFlag> 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;

View File

@@ -182,12 +182,12 @@ public:
#else
struct _PIForeachBase {mutable bool _break, _end;};
class _PIForeachBase {public: mutable bool _break, _end; };
template<typename Type>
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<typename Type>
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;

View File

@@ -207,7 +207,7 @@ public:
void swap(PIMap<Key, T> & other) {
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) {

View File

@@ -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<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
* \details Example:\n \snippet piincludes.cpp compareBinary */
inline bool piCompareBinary(const void * f, const void * s, size_t size) {

View File

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

View File

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

View File

@@ -25,8 +25,8 @@
# include <stdarg.h>
# include <windef.h>
# include <winbase.h>
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 <unistd.h>

View File

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

View File

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

View File

@@ -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__<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) >()

View File

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

View File

@@ -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();

View File

@@ -37,7 +37,7 @@
template<typename T>
class __PIVariantFunctions__ {
class PIP_EXPORT __PIVariantFunctions__ {
public:
static PIString typeNameHelper() {return PIStringAscii("");}
@@ -46,7 +46,7 @@ public:
template<typename C> static C castVariant(const T & v) {return C();}
};
struct __PIVariantInfo__ {
struct PIP_EXPORT __PIVariantInfo__ {
__PIVariantInfo__() {
simple = false;
}
@@ -57,7 +57,7 @@ struct __PIVariantInfo__ {
};
template<typename T>
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<PIString, __PIVariantInfo__ * >();}
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 <typename T> \
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 <typename T> \
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__<classname_from>::castHelper<classname_to>(PIB
PIByteArray ret; ret << t; \
return ret;} \
template <typename T, typename C> \
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 */ ,

View File

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

View File

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

View File

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

View File

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

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 functions to insert and delete records
class PIBinaryLog: public PIIODevice
class PIP_EXPORT PIBinaryLog: public PIIODevice
{
PIIODEVICE(PIBinaryLog)
public:

View File

@@ -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<PIIODevice * > 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<PIIODevice * > 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_;

View File

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

View File

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

View File

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

View File

@@ -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<FileInfo::Flag> 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" : "-");}

View File

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

View File

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

View File

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

View File

@@ -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<ldouble>::deleteP(void *& _p) {if (_p) delete (_PI
typedef PIFFTW<ldouble> PIFFTWld;
#endif
#endif // PIFFT_H

View File

@@ -24,8 +24,9 @@
#ifndef PIFIXEDPOINT_H
#define PIFIXEDPOINT_H
template<int Precision = 0, typename Type = int>
class PIFixedPoint {
class PIP_EXPORT PIFixedPoint {
// friend PICout operator <<(PICout s, const FixedPoint<> & v);
public:
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"
class PIResources {
class PIP_EXPORT PIResources {
public:
//!

View File

@@ -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<PIString, PIByteArray * > 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

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::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;

View File

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

View File

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

View File

@@ -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__();

View File

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