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

This commit is contained in:
2019-08-06 13:52:22 +00:00
parent 0e153f12ca
commit 4a8aef30c4
5 changed files with 37 additions and 27 deletions

View File

@@ -89,26 +89,23 @@ endif()
# Version
file(READ "${PIP_SRC_MAIN}/piversion.h" VERSION_OFFSET LIMIT 4 OFFSET 3)
file(READ "${PIP_SRC_MAIN}/piversion.h" VERSION_MAJOR LIMIT 1 OFFSET ${VERSION_OFFSET})
file(READ "${PIP_SRC_MAIN}/piversion.h" VERSION_OFFSET LIMIT 4 OFFSET 7)
file(READ "${PIP_SRC_MAIN}/piversion.h" VERSION_MINOR LIMIT 1 OFFSET ${VERSION_OFFSET})
file(READ "${PIP_SRC_MAIN}/piversion.h" VERSION_OFFSET LIMIT 4 OFFSET 11)
file(READ "${PIP_SRC_MAIN}/piversion.h" VERSION_REVISION LIMIT 1 OFFSET ${VERSION_OFFSET})
file(STRINGS "${PIP_SRC_MAIN}/piversion.h" VERSION_SUFFIX REGEX "\".*\"")
string(REGEX MATCH "\".*\"" VERSION_SUFFIX ${VERSION_SUFFIX})
string(LENGTH ${VERSION_SUFFIX} SL)
math(EXPR SL "${SL}-2")
string(SUBSTRING ${VERSION_SUFFIX} 1 ${SL} VERSION_SUFFIX)
string(LENGTH ${VERSION_MAJOR} SL)
math(EXPR SL "${SL}-1")
string(SUBSTRING ${VERSION_MAJOR} 0 ${SL} VERSION_MAJOR)
string(LENGTH ${VERSION_MINOR} SL)
math(EXPR SL "${SL}-1")
string(SUBSTRING ${VERSION_MINOR} 0 ${SL} VERSION_MINOR)
string(LENGTH ${VERSION_REVISION} SL)
math(EXPR SL "${SL}-1")
string(SUBSTRING ${VERSION_REVISION} 0 ${SL} VERSION_REVISION)
macro(versionExtract _file _name _out _string)
file(STRINGS "${_file}" line REGEX "#define[ \t]+${_name}.*")
if (${_string})
string(REGEX MATCH "\".*\"" _str "${line}")
string(LENGTH ${_str} _sl)
math(EXPR _sl "${_sl}-2")
string(SUBSTRING "${_str}" 1 ${_sl} ${_out})
else()
string(REGEX MATCH "[0-9]+" ${_out} "${line}")
endif()
#message("found ${_name} = ${${_out}}")
endmacro()
set(SHARED_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libs/shared")
versionExtract("${PIP_SRC_MAIN}/piversion.h" "PIP_VERSION_MAJOR" VERSION_MAJOR 0)
versionExtract("${PIP_SRC_MAIN}/piversion.h" "PIP_VERSION_MINOR" VERSION_MINOR 0)
versionExtract("${PIP_SRC_MAIN}/piversion.h" "PIP_VERSION_REVISION" VERSION_REVISION 0)
versionExtract("${PIP_SRC_MAIN}/piversion.h" "PIP_VERSION_SUFFIX" VERSION_SUFFIX 1)
set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION}")
set(SOVERSION ${VERSION})
set(_PIP_VERSION_CHANGED 0)

View File

@@ -828,7 +828,12 @@ public:
static PIMutex & __meta_mutex();
static PIMap<PIString, __MetaData> & __meta_data(); // [classname]=__MetaData
//! \brief Execute all posted events from CONNECTU_QUEUED connections
void callQueuedEvents();
//! \brief Check if any CONNECTU_QUEUED connections to this object and execute them.
//! \details This function is more optimized than \a callQueuedEvents() for objects that doesn`t
//! appears as \"performer\" target at CONNECTU_QUEUED
bool maybeCallQueuedEvents() {if (proc_event_queue) callQueuedEvents(); return proc_event_queue;}
protected:

View File

@@ -1,10 +1,9 @@
// 108 141 174 cmake version offset
#ifndef PIVERSION_H
#define PIVERSION_H
#define PIP_VERSION_MAJOR 1
#define PIP_VERSION_MINOR 9
#define PIP_VERSION_REVISION 2
#define PIP_VERSION_SUFFIX ""
#define PIP_VERSION_MINOR 10
#define PIP_VERSION_REVISION 0
#define PIP_VERSION_SUFFIX "_alpha"
#endif // PIVERSION_H

View File

@@ -521,6 +521,7 @@ bool PITimer::isStopped() const {
void PITimer::initFirst() {
lockRun = false;
callEvents = true;
data_t = 0;
ret_func = 0;
imp = 0;
@@ -564,7 +565,7 @@ void PITimer::tickImp() {
if (ret_func) ret_func(data_t, 1);
tick(data_t, 1);
tickEvent(data_t, 1);
maybeCallQueuedEvents();
if (callEvents) maybeCallQueuedEvents();
piForeach (Delimiter & i, delims) {
if (i.delim > ++(i.tick)) continue;
i.tick = 0;

View File

@@ -158,6 +158,14 @@ public:
EVENT_HANDLER0(void, lock) {mutex_.lock();}
EVENT_HANDLER0(void, unlock) {mutex_.unlock();}
//! \brief Returns if timer should exec \a maybeCallQueuedEvents() at every tick.
//! By default \b true
bool isCallQueuedEvents() const {return callEvents;}
//! \brief If set timer exec \a maybeCallQueuedEvents() at every tick.
//! By default \b true
void setCallQueuedEvents(bool yes) {callEvents = yes;}
//! \brief Add frequency delimiter \b delim with optional delimiter slot \b slot.
void addDelimiter(int delim, TimerEvent slot = 0) {delims << Delimiter(slot, delim);}
@@ -233,7 +241,7 @@ protected:
virtual void tick(void * data_, int delimiter) {}
void * data_t;
volatile bool lockRun;
volatile bool lockRun, callEvents;
PIMutex mutex_;
TimerEvent ret_func;
TimerImplementation imp_mode;