refactor: rename PIP_NO_\* to PIP_HAS_\* with inverted logic

All feature flags now use positive naming (enabled by default):
- PIP_HAS_FILESYSTEM, PIP_HAS_THREADS, PIP_HAS_SOCKET
- PIP_HAS_PROCESS, PIP_HAS_DYNLIB, PIP_HAS_FFT, PIP_HAS_SERIAL

Preprocessor guards inverted:
- #ifndef PIP_NO_X → #ifdef PIP_HAS_X
- #ifdef PIP_NO_X → #ifndef PIP_HAS_X

CMake options default ON instead of OFF.
Platform blocks set flags OFF to disable features.

85 files transformed via Python script + 2 manual fixes.
This commit is contained in:
2026-08-11 19:51:42 +03:00
parent 1db0dfea43
commit 077ac9887b
85 changed files with 344 additions and 342 deletions
+2 -2
View File
@@ -23,7 +23,7 @@
#include "pisharedmemory.h"
#if !defined(PICO_SDK)
#ifndef PIP_NO_PROCESS
#ifdef PIP_HAS_PROCESS
# ifdef WINDOWS
# include <windows.h>
# include <wingdi.h>
@@ -979,6 +979,6 @@ bool PITerminal::resize(int cols, int rows) {
return ret;
}
#endif // PIP_NO_PROCESS
#endif // PIP_HAS_PROCESS
#endif // !PICO_SDK
+2 -2
View File
@@ -21,7 +21,7 @@
#include "piliterals_time.h"
#ifndef PIP_NO_SOCKET
#ifdef PIP_HAS_SOCKET
/** \class PIBroadcast
* \brief Broadcast for all interfaces, including loopback
@@ -271,4 +271,4 @@ void PIBroadcast::run() {
if (ac) addressesChanged();
}
#endif // PIP_NO_SOCKET
#endif // PIP_HAS_SOCKET
+2 -2
View File
@@ -19,7 +19,7 @@
#include "piethutilbase.h"
#ifndef PIP_NO_SOCKET
#ifdef PIP_HAS_SOCKET
#include "pitranslator.h"
#ifdef PIP_CRYPT
@@ -132,4 +132,4 @@ size_t PIEthUtilBase::cryptSizeAddition() {
#endif
}
#endif // PIP_NO_SOCKET
#endif // PIP_HAS_SOCKET
+2 -2
View File
@@ -22,7 +22,7 @@
#include "piethernet.h"
#include "piliterals.h"
#ifndef PIP_NO_SOCKET
#ifdef PIP_HAS_SOCKET
/** \class PIPackedTCP pipackedtcp.h
@@ -200,4 +200,4 @@ bool PIPackedTCP::closeDevice() {
return eth->close();
}
#endif // PIP_NO_SOCKET
#endif // PIP_HAS_SOCKET
+2 -2
View File
@@ -26,7 +26,7 @@
#include "piiodevice.h"
#include "pitranslator.h"
#ifndef PIP_NO_SOCKET
#ifdef PIP_HAS_SOCKET
#ifdef __GNUC__
# pragma GCC diagnostic pop
#endif
@@ -178,4 +178,4 @@ uint PIStreamPacker::sizeCryptedSize() {
return sizeof(int) + (crypt_size ? cryptSizeAddition() : 0);
}
#endif // PIP_NO_SOCKET
#endif // PIP_HAS_SOCKET
+4 -4
View File
@@ -24,8 +24,8 @@
#include "piliterals_time.h"
#include "pitime.h"
#ifndef PIP_NO_THREADS
# ifndef PIP_NO_FILESYSTEM
#ifdef PIP_HAS_THREADS
# ifdef PIP_HAS_FILESYSTEM
//! \class PILog pilog.h
//! \details
@@ -248,5 +248,5 @@ void PILog::run() {
}
}
# endif // PIP_NO_FILESYSTEM
#endif // PIP_NO_THREADS
# endif // PIP_HAS_FILESYSTEM
#endif // PIP_HAS_THREADS
+4 -4
View File
@@ -29,8 +29,8 @@
#include "piiostream.h"
#include "pithread.h"
#ifndef PIP_NO_THREADS
# ifndef PIP_NO_FILESYSTEM
#ifdef PIP_HAS_THREADS
# ifdef PIP_HAS_FILESYSTEM
//! \~\ingroup Application
//! \~\brief
@@ -187,7 +187,7 @@ private:
int part_number = -1, cout_id = -1;
};
# endif // PIP_NO_FILESYSTEM
#endif // PIP_NO_THREADS
# endif // PIP_HAS_FILESYSTEM
#endif // PIP_HAS_THREADS
#endif // PIlog_H
@@ -24,7 +24,7 @@
#include "pisharedmemory.h"
#include "pitime.h"
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
//! \class PISingleApplication pisingleapplication.h
//! \~\details
@@ -154,4 +154,4 @@ void PISingleApplication::waitFirst() const {
piMSleep(50);
}
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
+2 -2
View File
@@ -29,7 +29,7 @@
class PISharedMemory;
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
//! \~\ingroup Application
//! \~\brief
@@ -94,5 +94,5 @@ private:
int sacnt;
};
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
#endif // PISINGLEAPPLICATION_H
+14 -14
View File
@@ -40,7 +40,7 @@ struct kqueue_id_t;
# include "esp_heap_caps.h"
#endif
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
void PISystemMonitor::ProcessStats::makeStrings() {
physical_memsize_readable.setReadableSize(physical_memsize);
@@ -51,7 +51,7 @@ void PISystemMonitor::ProcessStats::makeStrings() {
}
# ifndef PIP_NO_PROCESS
# ifdef PIP_HAS_PROCESS
PRIVATE_DEFINITION_START(PISystemMonitor)
# ifndef WINDOWS
# ifdef MAC_OS
@@ -70,13 +70,13 @@ PRIVATE_DEFINITION_START(PISystemMonitor)
PITimeMeasurer tm;
# endif
PRIVATE_DEFINITION_END(PISystemMonitor)
# endif // PIP_NO_PROCESS
# endif // PIP_HAS_PROCESS
PISystemMonitor::PISystemMonitor(): PIThread() {
pID_ = cycle = 0;
cpu_count = PISystemInfo::instance()->processorsCount;
# ifndef PIP_NO_PROCESS
# ifdef PIP_HAS_PROCESS
# ifndef WINDOWS
# ifdef QNX
page_size = 4096;
@@ -87,7 +87,7 @@ PISystemMonitor::PISystemMonitor(): PIThread() {
PRIVATE->hProc = 0;
PRIVATE->mem_cnt.cb = sizeof(PRIVATE->mem_cnt);
# endif
# endif // PIP_NO_PROCESS
# endif // PIP_HAS_PROCESS
setName("system_monitor"_a);
}
@@ -97,7 +97,7 @@ PISystemMonitor::~PISystemMonitor() {
}
# ifndef PIP_NO_PROCESS
# ifdef PIP_HAS_PROCESS
bool PISystemMonitor::startOnProcess(int pID, PISystemTime interval) {
stop();
pID_ = pID;
@@ -123,16 +123,16 @@ bool PISystemMonitor::startOnProcess(int pID, PISystemTime interval) {
# endif
return start(interval);
}
# endif // PIP_NO_PROCESS
# endif // PIP_HAS_PROCESS
bool PISystemMonitor::startOnSelf(PISystemTime interval) {
# ifndef PIP_NO_PROCESS
# ifdef PIP_HAS_PROCESS
bool ret = startOnProcess(PIProcess::currentPID(), interval);
cycle = -1;
# else
bool ret = start(interval);
# endif // PIP_NO_PROCESS
# endif // PIP_HAS_PROCESS
return ret;
}
@@ -181,7 +181,7 @@ void PISystemMonitor::run() {
tbid.clear();
ProcessStats tstat;
tstat.ID = pID_;
# ifndef PIP_NO_THREADS
# ifdef PIP_HAS_THREADS
__PIThreadCollection * pitc = __PIThreadCollection::instance();
pitc->lock();
PIVector<PIThread *> tv = pitc->threads();
@@ -319,7 +319,7 @@ void PISystemMonitor::run() {
PRIVATE->tm.reset();
# endif // WINDOWS
# endif // FREERTOS
# endif // PIP_NO_THREADS
# endif // PIP_HAS_THREADS
tstat.cpu_load_system = piClampf(tstat.cpu_load_system, 0.f, 100.f);
tstat.cpu_load_user = piClampf(tstat.cpu_load_user, 0.f, 100.f);
@@ -352,7 +352,7 @@ void PISystemMonitor::gatherThread(llong id) {
PISystemMonitor::ThreadStats ts;
if (id == 0) return;
ts.id = id;
# ifdef PIP_NO_PROCESS
# ifndef PIP_HAS_PROCESS
ts.name = tbid.value(id, "<PIThread>");
# else
ts.name = tbid.value(id, "<non-PIThread>");
@@ -395,7 +395,7 @@ void PISystemMonitor::gatherThread(llong id) {
ts.kernel_time = FILETIME2PISystemTime(times[2]);
ts.user_time = FILETIME2PISystemTime(times[3]);
# endif
# endif // PIP_NO_PROCESS
# endif // PIP_HAS_PROCESS
cur_tm[id] = ts;
}
@@ -462,4 +462,4 @@ void PISystemMonitor::Pool::remove(PISystemMonitor * sm) {
sysmons.remove(sm->pID());
}
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
+6 -6
View File
@@ -28,7 +28,7 @@
#include "pifile.h"
#include "pithread.h"
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
//! \~\ingroup Application
//! \~\brief
@@ -206,12 +206,12 @@ public:
PIString name;
};
# ifndef PIP_NO_PROCESS
# ifdef PIP_HAS_PROCESS
//! \~english Starts monitoring the process with PID "pID" using the given update interval.
//! \~russian Запускает мониторинг процесса с PID "pID" с указанным интервалом обновления.
bool startOnProcess(int pID, PISystemTime interval = PISystemTime::fromSeconds(1.));
# endif // PIP_NO_PROCESS
# endif // PIP_HAS_PROCESS
//! \~english Starts monitoring the current application process.
//! \~russian Запускает мониторинг текущего процесса приложения.
@@ -272,9 +272,9 @@ private:
PIMap<llong, PIString> tbid;
mutable PIMutex stat_mutex;
int pID_, page_size, cpu_count, cycle;
# ifndef PIP_NO_PROCESS
# ifdef PIP_HAS_PROCESS
PRIVATE_DECLARATION(PIP_EXPORT)
# endif // PIP_NO_PROCESS
# endif // PIP_HAS_PROCESS
class PIP_EXPORT Pool {
friend class PISystemMonitor;
@@ -338,5 +338,5 @@ BINARY_STREAM_READ(PISystemMonitor::ThreadStats) {
return s;
}
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
#endif // PISYSTEMMONITOR_H
+2 -2
View File
@@ -25,7 +25,7 @@
#include "pitranslator_p.h"
#include "pivaluetree_conversions.h"
#ifndef PIP_NO_FILESYSTEM
#ifdef PIP_HAS_FILESYSTEM
//! \class PITranslator pitranslator.h
//! \details
@@ -116,4 +116,4 @@ PITranslator * PITranslator::instance() {
return &ret;
}
#endif // PIP_NO_FILESYSTEM
#endif // PIP_HAS_FILESYSTEM
+2 -2
View File
@@ -153,7 +153,7 @@ bool PICodeParser::isEnum(const PIString & name) {
}
#ifndef PIP_NO_FILESYSTEM
#ifdef PIP_HAS_FILESYSTEM
bool PICodeParser::parseFileInternal(const PIString & file, bool follow_includes) {
if (proc_files[file]) return true;
with_includes = follow_includes;
@@ -179,7 +179,7 @@ bool PICodeParser::parseFileInternal(const PIString & file, bool follow_includes
piCout << "parsing" << f.path() << "done";
return ret;
}
#endif // PIP_NO_FILESYSTEM
#endif // PIP_HAS_FILESYSTEM
void PICodeParser::clear() {
+2 -2
View File
@@ -18,7 +18,7 @@
*/
#include "pikbdlistener.h"
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
# include "piincludes_p.h"
# include "piliterals.h"
@@ -590,4 +590,4 @@ void PIKbdListener::setActive(bool yes) {
}
}
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
+2 -2
View File
@@ -27,7 +27,7 @@
#include "pibase.h"
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
# include "pithread.h"
# include "pitime.h"
@@ -381,5 +381,5 @@ REGISTER_PIVARIANTSIMPLE(PIKbdListener::KeyEvent)
REGISTER_PIVARIANTSIMPLE(PIKbdListener::MouseEvent)
REGISTER_PIVARIANTSIMPLE(PIKbdListener::WheelEvent)
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
#endif // PIKBDLISTENER_H
+2 -2
View File
@@ -709,7 +709,7 @@ void PICout::applyFormat(PICoutFormat f) {
}
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
PIString PICout::getBuffer() {
PIMutexLocker ml(PICout::__mutex__());
PIString ret = PICout::__string__();
@@ -729,7 +729,7 @@ void PICout::clearBuffer() {
PIMutexLocker ml(PICout::__mutex__());
PICout::__string__().clear();
}
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
bool PICout::setOutputDevice(PICout::OutputDevice d, bool on) {
+3 -3
View File
@@ -32,11 +32,11 @@
#include "pibase.h"
// PIInit stub: enabled for embedded or when core features are missing
#if defined(PIP_EMBEDDED) || (defined(PIP_NO_THREADS) && defined(PIP_NO_FILESYSTEM))
#if defined(PIP_EMBEDDED) || (!defined(PIP_HAS_THREADS) && !defined(PIP_HAS_FILESYSTEM))
# define _PIP_INIT_STUB_
#endif
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
# include "piincludes.h"
@@ -127,5 +127,5 @@ private:
};
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
#endif // PIINIT_H
+14 -14
View File
@@ -22,7 +22,7 @@
#include "piconditionvar.h"
#include "pithread.h"
#include "pitime.h"
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
# include "pifile.h"
# include "piiostream.h"
# include "pisysteminfo.h"
@@ -176,11 +176,11 @@ PIObject::PIObject(const PIString & name): _signature_(__PIOBJECT_SIGNATURE__),
in_event_cnt = 0;
setName(name);
setDebug(true);
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
mutexObjects().lock();
#endif
objects() << this;
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
mutexObjects().unlock();
#endif
// piCout << "new" << this;
@@ -190,11 +190,11 @@ PIObject::PIObject(const PIString & name): _signature_(__PIOBJECT_SIGNATURE__),
PIObject::~PIObject() {
in_event_cnt = 0;
// piCout << "delete" << this;
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
mutexObjects().lock();
#endif
objects().removeAll(this);
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
mutexObjects().unlock();
#endif
deleted(this);
@@ -472,7 +472,7 @@ void PIObject::piDisconnect(PIObject * src, const PIString & sig) {
src->connections.remove(i);
i--;
if (dest) {
#if !defined(ANDROID) && !defined(MAC_OS) && !defined(PIP_NO_THREADS)
#if !defined(ANDROID) && !defined(MAC_OS) && defined(PIP_HAS_THREADS)
PIMutexLocker _mld(dest->mutex_connect, src != dest);
#endif
dest->updateConnectors();
@@ -490,7 +490,7 @@ void PIObject::piDisconnectAll() {
// piCout << "disconnect"<< src << o;
if (!o || (o == this)) continue;
if (!o->isPIObject()) continue;
#if !defined(ANDROID) && !defined(MAC_OS) && !defined(PIP_NO_THREADS)
#if !defined(ANDROID) && !defined(MAC_OS) && defined(PIP_HAS_THREADS)
PIMutexLocker _mld(o->mutex_connect, this != o);
#endif
PIVector<Connection> & oc(o->connections);
@@ -555,7 +555,7 @@ PIMap<uint, PIObject::__MetaData> & PIObject::__meta_data() {
}
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
void PIObject::callQueuedEvents() {
mutex_queue.lock();
PIVector<__QueuedEvent> qe = events_queue;
@@ -569,7 +569,7 @@ void PIObject::callQueuedEvents() {
if (e.dest_o->thread_safe_) e.dest_o->mutex_.unlock();
}
}
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
//! \details
@@ -580,11 +580,11 @@ void PIObject::callQueuedEvents() {
//! При первом вызове стартует фоновый поток для удаления объектов.
//! Каждый объект из очереди удаляется только когда выйдет из всех
//! событий и обработок.
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
void PIObject::deleteLater() {
Deleter::instance()->post(this);
}
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
bool PIObject::findSuitableMethodV(const PIString & method, int args, int & ret_args, PIObject::__MetaFunc & ret) {
@@ -744,7 +744,7 @@ void PIObject::dump(const PIString & line_prefix) const {
}
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
void dumpApplication(bool with_objects) {
PIMutexLocker _ml(PIObject::mutexObjects());
// printf("dump application ...\n");
@@ -847,7 +847,7 @@ bool PIObject::Connection::disconnect() const {
return ret;
}
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
PRIVATE_DEFINITION_START(PIObject::Deleter)
PIThread thread;
PIConditionVariable cond_var;
@@ -911,4 +911,4 @@ void PIObject::Deleter::deleteObject(PIObject * o) {
}
// piCout << "[Deleter] delete" << (uintptr_t)o << "done";
}
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
+15 -15
View File
@@ -461,7 +461,7 @@ public:
i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender));
} else {
bool ts = sender->thread_safe_;
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
if (ts) i.dest_o->mutex_.lock();
#endif
i.dest_o->eventBegin();
@@ -471,7 +471,7 @@ public:
sender->eventEnd();
if (i.dest_o->isPIObject()) {
i.dest_o->emitter_ = 0;
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
if (ts) i.dest_o->mutex_.unlock();
#endif
i.dest_o->eventEnd();
@@ -498,7 +498,7 @@ public:
i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender, vl));
} else {
bool ts = sender->thread_safe_;
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
if (ts) i.dest_o->mutex_.lock();
#endif
i.dest_o->eventBegin();
@@ -511,7 +511,7 @@ public:
sender->eventEnd();
if (i.dest_o->isPIObject()) {
i.dest_o->emitter_ = 0;
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
if (ts) i.dest_o->mutex_.unlock();
#endif
i.dest_o->eventEnd();
@@ -538,7 +538,7 @@ public:
i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender, vl));
} else {
bool ts = sender->thread_safe_;
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
if (ts) i.dest_o->mutex_.lock();
#endif
i.dest_o->eventBegin();
@@ -552,7 +552,7 @@ public:
sender->eventEnd();
if (i.dest_o->isPIObject()) {
i.dest_o->emitter_ = 0;
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
if (ts) i.dest_o->mutex_.unlock();
#endif
i.dest_o->eventEnd();
@@ -580,7 +580,7 @@ public:
i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender, vl));
} else {
bool ts = sender->thread_safe_;
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
if (ts) i.dest_o->mutex_.lock();
#endif
i.dest_o->eventBegin();
@@ -595,7 +595,7 @@ public:
sender->eventEnd();
if (i.dest_o->isPIObject()) {
i.dest_o->emitter_ = 0;
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
if (ts) i.dest_o->mutex_.unlock();
#endif
i.dest_o->eventEnd();
@@ -629,7 +629,7 @@ public:
i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender, vl));
} else {
bool ts = sender->thread_safe_;
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
if (ts) i.dest_o->mutex_.lock();
#endif
i.dest_o->eventBegin();
@@ -645,7 +645,7 @@ public:
sender->eventEnd();
if (i.dest_o->isPIObject()) {
i.dest_o->emitter_ = 0;
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
if (ts) i.dest_o->mutex_.unlock();
#endif
i.dest_o->eventEnd();
@@ -658,7 +658,7 @@ public:
//! \~english Returns the first live object with name "name", or \c nullptr.
//! \~russian Возвращает первый живой объект с именем "name", либо \c nullptr.
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
static PIObject * findByName(const PIString & name) {
PIMutexLocker _ml(mutexObjects());
for (auto * i: PIObject::objects()) {
@@ -675,7 +675,7 @@ public:
//! \~english Returns whether this object belongs to class "T" or one of its registered descendants.
//! \~russian Возвращает, принадлежит ли этот объект классу "T" или одному из его зарегистрированных потомков.
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
template<typename T>
bool isTypeOf() const {
if (!isPIObject()) return false;
@@ -820,7 +820,7 @@ private:
PIVector<PIVariantSimple> values;
};
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
class Deleter {
public:
Deleter();
@@ -859,7 +859,7 @@ private:
PIObject * emitter_;
std::atomic_int in_event_cnt;
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
PIMutex mutex_, mutex_connect, mutex_queue;
bool thread_safe_, proc_event_queue;
#else
@@ -868,7 +868,7 @@ private:
#endif
};
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
//! \~english Dumps application-level %PIObject diagnostics.
//! \~russian Выводит диагностическую информацию уровня приложения для %PIObject.
+2 -2
View File
@@ -18,7 +18,7 @@
*/
#include "piwaitevent_p.h"
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
# ifdef WINDOWS
// # ifdef _WIN32_WINNT
// # undef _WIN32_WINNT
@@ -154,4 +154,4 @@ void * PIWaitEvent::getEvent() const {
# endif
}
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
+2 -2
View File
@@ -20,7 +20,7 @@
#ifndef PIWAITEVENT_P_H
#define PIWAITEVENT_P_H
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
# include "pibase.h"
// clang-format off
@@ -67,5 +67,5 @@ private:
};
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
#endif // PIWAITEVENT_P_H
+4 -4
View File
@@ -24,7 +24,7 @@
#include "piliterals_time.h"
#include "pipropertystorage.h"
#ifndef PIP_NO_FILESYSTEM
#ifdef PIP_HAS_FILESYSTEM
# include "pitime.h"
# include "pitranslator.h"
@@ -60,11 +60,11 @@ static const uchar binlog_sig[] = {'B', 'I', 'N', 'L', 'O', 'G'};
REGISTER_DEVICE(PIBinaryLog)
PIBinaryLog::PIBinaryLog() {
# ifdef PIP_NO_THREADS
# ifndef PIP_HAS_THREADS
setThreadedReadBufferSize(512);
# else
setThreadedReadBufferSize(64_KiB);
# endif // PIP_NO_THREADS
# endif // PIP_HAS_THREADS
is_started = is_indexed = is_pause = false;
create_index_on_fly = false;
current_index = -1;
@@ -1011,4 +1011,4 @@ void PIBinaryLog::CompleteIndex::makeIndexPos() {
index_pos[index[i].pos] = i;
}
#endif // PIP_NO_FILESYSTEM
#endif // PIP_HAS_FILESYSTEM
+2 -2
View File
@@ -29,7 +29,7 @@
#include "pichunkstream.h"
#include "pifile.h"
#ifndef PIP_NO_FILESYSTEM
#ifdef PIP_HAS_FILESYSTEM
//! \~english Class for writing and reading binary data to/from log files, with support for playback in different modes.
//! \~russian Класс для записи и чтения бинарных данных в/из файлов логов с поддержкой воспроизведения в различных режимах.
@@ -993,5 +993,5 @@ inline PICout operator<<(PICout s, const PIBinaryLog::BinLogInfo & bi) {
return s;
}
#endif // PIP_NO_FILESYSTEM
#endif // PIP_HAS_FILESYSTEM
#endif // PIBINARYLOG_H
+1 -1
View File
@@ -20,7 +20,7 @@
#include "pipropertystorage.h"
#include "piwaitevent_p.h"
#if !defined(WINDOWS) && !defined(MAC_OS) && !defined(PIP_NO_SOCKET)
#if !defined(WINDOWS) && !defined(MAC_OS) && defined(PIP_HAS_SOCKET)
# define PIP_CAN
#endif
#ifdef PIP_CAN
+8 -8
View File
@@ -288,7 +288,7 @@ PIConfig::PIConfig(PIIODevice * device, PIIODevice::DeviceMode mode) {
}
#ifndef PIP_NO_FILESYSTEM
#ifdef PIP_HAS_FILESYSTEM
PIConfig::PIConfig(const PIString & path, PIStringList dirs) {
_init();
internal = true;
@@ -312,7 +312,7 @@ PIConfig::PIConfig(const PIString & path, PIStringList dirs) {
_setupDev();
parse();
}
#endif // PIP_NO_FILESYSTEM
#endif // PIP_HAS_FILESYSTEM
PIConfig::~PIConfig() {
@@ -321,7 +321,7 @@ PIConfig::~PIConfig() {
}
#ifndef PIP_NO_FILESYSTEM
#ifdef PIP_HAS_FILESYSTEM
bool PIConfig::open(const PIString & path, PIIODevice::DeviceMode mode) {
_destroy();
incdirs << PIFile::fileInfo(path).dir();
@@ -332,7 +332,7 @@ bool PIConfig::open(const PIString & path, PIIODevice::DeviceMode mode) {
parse();
return dev->isOpened();
}
#endif // PIP_NO_FILESYSTEM
#endif // PIP_HAS_FILESYSTEM
bool PIConfig::open(PIString * string, PIIODevice::DeviceMode mode) {
@@ -351,7 +351,7 @@ bool PIConfig::open(PIIODevice * device, PIIODevice::DeviceMode mode) {
dev = device;
if (dev) {
dev->open(mode);
#ifndef PIP_NO_FILESYSTEM
#ifdef PIP_HAS_FILESYSTEM
if (dev->isTypeOf<PIFile>()) incdirs << PIFile::fileInfo(((PIFile *)dev)->path()).dir();
#endif
}
@@ -389,7 +389,7 @@ void PIConfig::_setupDev() {
void PIConfig::_clearDev() {
if (!dev) return;
#ifndef PIP_NO_FILESYSTEM
#ifdef PIP_HAS_FILESYSTEM
if (PIString(dev->className()) == "PIFile") {
((PIFile *)dev)->clear();
return;
@@ -405,7 +405,7 @@ void PIConfig::_clearDev() {
void PIConfig::_flushDev() {
if (!dev) return;
#ifndef PIP_NO_FILESYSTEM
#ifdef PIP_HAS_FILESYSTEM
if (PIString(dev->className()) == "PIFile") {
((PIFile *)dev)->flush();
}
@@ -421,7 +421,7 @@ bool PIConfig::_isEndDev() {
void PIConfig::_seekToBeginDev() {
if (!dev) return;
#ifndef PIP_NO_FILESYSTEM
#ifdef PIP_HAS_FILESYSTEM
if (PIString(dev->className()) == "PIFile") {
((PIFile *)dev)->seekToBegin();
return;
+2 -2
View File
@@ -16,7 +16,7 @@
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PIP_NO_FILESYSTEM
#ifdef PIP_HAS_FILESYSTEM
#include "pidir.h"
#include "piincludes_p.h"
@@ -612,4 +612,4 @@ void PIDir::CurrentDirOverrider::save(const PIFile::FileInfo & info) {
else
PIDir::setCurrent(PIDir::current().path() + PIDir::separator + p);
}
#endif // PIP_NO_FILESYSTEM
#endif // PIP_HAS_FILESYSTEM
+4 -4
View File
@@ -30,7 +30,7 @@
#include "piregularexpression.h"
#ifndef PIP_NO_FILESYSTEM
#ifdef PIP_HAS_FILESYSTEM
//! \~\ingroup IO
//! \~\brief
//! \~english Local directory.
@@ -218,10 +218,10 @@ private:
PIString path_, scan_;
};
#endif // PIP_NO_FILESYSTEM
#endif // PIP_HAS_FILESYSTEM
#ifndef PIP_NO_FILESYSTEM
#ifdef PIP_HAS_FILESYSTEM
inline bool operator<(const PIFile::FileInfo & v0, const PIFile::FileInfo & v1) {
return (v0.path < v1.path);
}
@@ -245,7 +245,7 @@ inline PICout operator<<(PICout s, const PIDir & v) {
s.restoreControls();
return s;
}
#endif // PIP_NO_FILESYSTEM
#endif // PIP_HAS_FILESYSTEM
#endif // PIDIR_H
+2 -2
View File
@@ -18,7 +18,7 @@
*/
#include "piethernet.h"
#ifndef PIP_NO_SOCKET
#ifdef PIP_HAS_SOCKET
# include "piconfig.h"
# include "piconstchars.h"
@@ -1505,4 +1505,4 @@ bool PIEthernet::ethIsWriteable(int sock) {
# endif
}
#endif // PIP_NO_SOCKET
#endif // PIP_HAS_SOCKET
+2 -2
View File
@@ -29,7 +29,7 @@
#include "piiodevice.h"
#include "pinetworkaddress.h"
#ifndef PIP_NO_SOCKET
#ifdef PIP_HAS_SOCKET
# ifdef ANDROID
struct
@@ -706,5 +706,5 @@ inline bool operator!=(const PIEthernet::Interface & v0, const PIEthernet::Inter
return (v0.name != v1.name || v0.address != v1.address || v0.netmask != v1.netmask);
}
#endif // PIP_NO_SOCKET
#endif // PIP_HAS_SOCKET
#endif // PIETHERNET_H
+4 -4
View File
@@ -17,7 +17,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PIP_NO_FILESYSTEM
#ifdef PIP_HAS_FILESYSTEM
# include "pifile.h"
# include "pidir.h"
@@ -46,7 +46,7 @@
# include <utime.h>
# endif
# define S_IFHDN 0x40
# if defined(QNX) || defined(ANDROID) || defined(PIP_NO_FILESYSTEM)
# if defined(QNX) || defined(ANDROID) || !defined(PIP_HAS_FILESYSTEM)
# define _fopen_call_ fopen
# define _fseek_call_ fseek
# define _ftell_call_ ftell
@@ -538,7 +538,7 @@ PIFile::FileInfo PIFile::fileInfo(const PIString & path) {
ret.time_modification = PIDateTime::fromSystemTime(PISystemTime(fs.MTIME.tv_sec, fs.MTIME.tv_nsec));
# endif
# endif
# ifndef PIP_NO_FILESYSTEM
# ifdef PIP_HAS_FILESYSTEM
ret.perm_user = FileInfo::Permissions((mode & S_IRUSR) == S_IRUSR, (mode & S_IWUSR) == S_IWUSR, (mode & S_IXUSR) == S_IXUSR);
ret.perm_group = FileInfo::Permissions((mode & S_IRGRP) == S_IRGRP, (mode & S_IWGRP) == S_IWGRP, (mode & S_IXGRP) == S_IXGRP);
ret.perm_other = FileInfo::Permissions((mode & S_IROTH) == S_IROTH, (mode & S_IWOTH) == S_IWOTH, (mode & S_IXOTH) == S_IXOTH);
@@ -636,4 +636,4 @@ int PIFile::writeAll(const PIString & path, const PIByteArray & data) {
f.clear();
return f.write(data.data(), data.size_s());
}
#endif // PIP_NO_FILESYSTEM
#endif // PIP_HAS_FILESYSTEM
+4 -4
View File
@@ -31,7 +31,7 @@
#include "pipropertystorage.h"
#ifndef PIP_NO_FILESYSTEM
#ifdef PIP_HAS_FILESYSTEM
//! \~\ingroup IO
//! \~\brief
//! \~english Local file.
@@ -362,10 +362,10 @@ private:
llong _size = -1;
PIString prec_str;
};
#endif // PIP_NO_FILESYSTEM
#endif // PIP_HAS_FILESYSTEM
#ifndef PIP_NO_FILESYSTEM
#ifdef PIP_HAS_FILESYSTEM
//! \relatesalso PICout
//! \~english Output operator to \a PICout.
//! \~russian Оператор вывода в \a PICout.
@@ -398,6 +398,6 @@ BINARY_STREAM_READ(PIFile::FileInfo) {
v.perm_group.raw >> v.perm_other.raw;
return s;
}
#endif // PIP_NO_FILESYSTEM
#endif // PIP_HAS_FILESYSTEM
#endif // PIFILE_H
+2 -2
View File
@@ -30,7 +30,7 @@
#endif
#include "piliterals.h"
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
//! \class PIGPIO pigpio.h
//! \~english \section PIGPIO_sec0 Synopsis
@@ -309,4 +309,4 @@ void PIGPIO::clearWatch() {
// # pragma GCC diagnostic pop
# endif
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
+2 -2
View File
@@ -28,7 +28,7 @@
#include "pithread.h"
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
//! \~\ingroup IO
//! \~\brief
@@ -144,6 +144,6 @@ private:
PIMutex mutex;
};
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
#endif // PIGPIO_H
+20 -20
View File
@@ -117,7 +117,7 @@
//!
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
PIMutex PIIODevice::nfp_mutex;
#endif
PIMap<PIString, PIString> PIIODevice::nfp_cache;
@@ -198,7 +198,7 @@ void PIIODevice::setThreadedReadBufferSize(int new_size) {
}
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
bool PIIODevice::isThreadedRead() const {
return read_thread.isRunning();
}
@@ -252,7 +252,7 @@ bool PIIODevice::waitThreadedReadFinished(PISystemTime timeout) {
bool PIIODevice::isThreadedWrite() const {
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
return write_thread.isRunning();
#else
return false;
@@ -261,14 +261,14 @@ bool PIIODevice::isThreadedWrite() const {
void PIIODevice::startThreadedWrite() {
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
if (!write_thread.isRunning()) write_thread.startOnce();
#endif
}
void PIIODevice::stopThreadedWrite() {
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
if (!write_thread.isRunning()) return;
write_thread.stop();
#endif
@@ -276,14 +276,14 @@ void PIIODevice::stopThreadedWrite() {
void PIIODevice::terminateThreadedWrite() {
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
write_thread.terminate();
#endif
}
bool PIIODevice::waitThreadedWriteFinished(PISystemTime timeout) {
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
return write_thread.waitForFinish(timeout);
#else
(void)timeout;
@@ -293,7 +293,7 @@ bool PIIODevice::waitThreadedWriteFinished(PISystemTime timeout) {
void PIIODevice::clearThreadedWriteQueue() {
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
write_thread.lock();
write_queue.clear();
write_thread.unlock();
@@ -302,7 +302,7 @@ void PIIODevice::clearThreadedWriteQueue() {
void PIIODevice::start() {
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
startThreadedRead();
#endif
startThreadedWrite();
@@ -310,7 +310,7 @@ void PIIODevice::start() {
void PIIODevice::stop() {
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
stopThreadedRead();
#endif
stopThreadedWrite();
@@ -319,7 +319,7 @@ void PIIODevice::stop() {
void PIIODevice::stopAndWait(PISystemTime timeout) {
stop();
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
waitThreadedReadFinished(timeout);
#endif
waitThreadedWriteFinished(timeout);
@@ -357,7 +357,7 @@ void PIIODevice::_init() {
setOptions(0);
setReopenEnabled(true);
setReopenTimeout(1_s);
#ifdef PIP_NO_THREADS
#ifndef PIP_HAS_THREADS
threaded_read_buffer_size = 512;
#else
threaded_read_buffer_size = 4_KiB;
@@ -368,11 +368,11 @@ void PIIODevice::_init() {
if (!isOpened()) open();
});
read_thread.setSlot([this](void *) { read_func(); });
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
}
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
void PIIODevice::write_func() {
while (!write_thread.isStopping()) {
while (!write_queue.isEmpty()) {
@@ -412,7 +412,7 @@ void PIIODevice::read_func() {
threadedRead(buffer_tr.data(), readed_);
threadedReadEvent(buffer_tr.data(), readed_);
}
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
PIIODevice * PIIODevice::newDeviceByPrefix(const char * prefix) {
@@ -443,7 +443,7 @@ PIByteArray PIIODevice::readForTime(PISystemTime timeout) {
}
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
ullong PIIODevice::writeThreaded(const PIByteArray & data) {
write_thread.lock();
write_queue.enqueue(PIPair<PIByteArray, ullong>(data, tri));
@@ -663,17 +663,17 @@ PIIODevice * PIIODevice::createFromVariant(const PIVariantTypes::IODevice & d) {
PIString PIIODevice::normalizeFullPath(const PIString & full_path) {
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
nfp_mutex.lock();
#endif
PIString ret = nfp_cache.value(full_path);
if (!ret.isEmpty()) {
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
nfp_mutex.unlock();
#endif
return ret;
}
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
nfp_mutex.unlock();
#endif
PIIODevice * d = createFromFullPath(full_path);
@@ -685,7 +685,7 @@ PIString PIIODevice::normalizeFullPath(const PIString & full_path) {
void PIIODevice::cacheFullPath(const PIString & full_path, const PIIODevice * d) {
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
PIMutexLocker nfp_ml(nfp_mutex);
#endif
nfp_cache[full_path] = d->constructFullPath();
+4 -4
View File
@@ -242,7 +242,7 @@ public:
//! \~russian Возвращает пользовательские данные, передаваемые в callback потокового чтения.
void * threadedReadData() const { return ret_data_; }
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
//! \~english Returns whether threaded read is running.
//! \~russian Возвращает, запущено ли потоковое чтение.
bool isThreadedRead() const;
@@ -273,7 +273,7 @@ public:
//! \~english Waits until threaded read finishes or "timeout" expires.
//! \~russian Ожидает завершения потокового чтения, но не дольше "timeout".
bool waitThreadedReadFinished(PISystemTime timeout = {});
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
//! \~english Returns delay between unsuccessful threaded read attempts in milliseconds.
@@ -362,7 +362,7 @@ public:
PIByteArray readForTime(PISystemTime timeout);
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
//! \~english Queues "data" for threaded write and returns task ID.
//! \~russian Помещает "data" в очередь потоковой записи и возвращает ID задания.
ullong writeThreaded(const void * data, ssize_t max_size) { return writeThreaded(PIByteArray(data, uint(max_size))); }
@@ -615,7 +615,7 @@ private:
bool reopen_enabled = true, destroying = false;
static PIMap<PIString, PIString> nfp_cache;
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
PIThread read_thread, write_thread;
PIQueue<PIPair<PIByteArray, ullong>> write_queue;
static PIMutex nfp_mutex;
+2 -2
View File
@@ -24,7 +24,7 @@
#include "piliterals_time.h"
#include "pipropertystorage.h"
#ifndef PIP_NO_SOCKET
#ifdef PIP_HAS_SOCKET
# include "pitime.h"
# define _PIPEER_MSG_SIZE 4000
@@ -1179,4 +1179,4 @@ bool PIPeer::hasPeer(const PIString & name) {
return false;
}
#endif // PIP_NO_SOCKET
#endif // PIP_HAS_SOCKET
+2 -2
View File
@@ -38,7 +38,7 @@
//! \~russian
//! Класс обнаруживает пиры, маршрутизирует пакеты по имени пира и может предоставлять поток trusted-peer через унаследованные \a read() и
//! \a write().
#ifndef PIP_NO_SOCKET
#ifdef PIP_HAS_SOCKET
class PIP_EXPORT PIPeer: public PIIODevice {
PIIODEVICE(PIPeer, "peer");
@@ -437,6 +437,6 @@ BINARY_STREAM_READ(PIPeer::PeerInfo) {
s >> v.name >> v.addresses >> v.dist >> v.neighbours >> v.cnt >> v.time;
return s;
}
#endif // PIP_NO_SOCKET
#endif // PIP_HAS_SOCKET
#endif // PIPEER_H
+2 -2
View File
@@ -19,7 +19,7 @@
#include "piserial.h"
#ifndef PIP_NO_SERIAL
#ifdef PIP_HAS_SERIAL
# include "piconfig.h"
# include "pidir.h"
@@ -1326,4 +1326,4 @@ void PISerial::threadedReadBufferSizeChanged() {
# endif
}
#endif // PIP_NO_SERIAL
#endif // PIP_HAS_SERIAL
+2 -2
View File
@@ -43,11 +43,11 @@ REGISTER_DEVICE(PISPI)
PISPI::PISPI(const PIString & path, uint speed, PIIODevice::DeviceMode mode): PIIODevice(path, mode) {
#ifdef PIP_NO_THREADS
#ifndef PIP_HAS_THREADS
setThreadedReadBufferSize(512);
#else
setThreadedReadBufferSize(1024);
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
setPath(path);
setSpeed(speed);
setBits(8);
+15 -13
View File
@@ -29,7 +29,7 @@ const uint PIBaseTransfer::signature = 0x54424950;
PIBaseTransfer::PIBaseTransfer()
: crc(standardCRC_16())
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
, diag(false)
#endif
{
@@ -44,7 +44,7 @@ PIBaseTransfer::PIBaseTransfer()
send_queue = 0;
send_up = 0;
timeout_ = 10.;
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
diag.setDisconnectTimeout(PISystemTime::fromSeconds(timeout_ / 10.));
diag.setName("PIBaseTransfer");
diag.start(20_Hz);
@@ -60,7 +60,7 @@ PIBaseTransfer::PIBaseTransfer()
PIBaseTransfer::~PIBaseTransfer() {
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
diag.stopAndWait();
#endif
break_ = true;
@@ -94,7 +94,7 @@ void PIBaseTransfer::setPause(bool pause_) {
void PIBaseTransfer::setTimeout(double sec) {
timeout_ = sec;
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
diag.setDisconnectTimeout(PISystemTime::fromSeconds(sec));
#endif
}
@@ -103,7 +103,7 @@ void PIBaseTransfer::setTimeout(double sec) {
void PIBaseTransfer::received(PIByteArray data) {
packet_header_size = sizeof(PacketHeader) + customHeader().size();
if (data.size() < sizeof(PacketHeader)) {
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
diag.received(data.size(), false);
#endif
return;
@@ -113,12 +113,12 @@ void PIBaseTransfer::received(PIByteArray data) {
PacketType pt = (PacketType)h.type;
if (!h.check_sig()) {
piCoutObj << "invalid packet signature"_tr("PIBaseTransfer");
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
diag.received(data.size(), false);
#endif
return;
} else
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
diag.received(data.size(), true);
#endif
// piCoutObj << "receive" << h.session_id << h.type << h.id;
@@ -195,7 +195,9 @@ void PIBaseTransfer::received(PIByteArray data) {
replies.resize(sr.packets + 1);
replies.fill(pt_Unknown);
pm_string.resize(replies.size(), '-');
#ifdef PIP_HAS_THREADS
diag.reset();
#endif
is_receiving = true;
break_ = false;
mutex_send.lock();
@@ -277,7 +279,7 @@ void PIBaseTransfer::received(PIByteArray data) {
return;
}
break;
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
#endif
case pt_Pause:
mutex_header.lock();
@@ -309,7 +311,7 @@ bool PIBaseTransfer::send_process() {
mutex_session.lock();
packet_header_size = sizeof(PacketHeader) + customHeader().size();
break_ = false;
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
diag.reset();
#endif
sendStarted();
@@ -359,7 +361,7 @@ bool PIBaseTransfer::send_process() {
}
stm.reset();
ba = build_packet(i);
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
diag.sended(ba.size_s());
#endif
sendRequest(ba);
@@ -414,7 +416,7 @@ bool PIBaseTransfer::send_process() {
continue;
}
ba = build_packet(chk - 1);
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
diag.sended(ba.size_s());
#endif
sendRequest(ba);
@@ -521,7 +523,7 @@ void PIBaseTransfer::sendReply(PacketType reply) {
header.type = reply;
PIByteArray ba;
ba << header;
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
if (is_sending || is_receiving) diag.sended(ba.size_s());
#endif
sendRequest(ba);
@@ -542,7 +544,7 @@ bool PIBaseTransfer::getStartRequest() {
state_string = "send request";
PITimeMeasurer tm;
while (tm.elapsed_s() < timeout_) {
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
diag.sended(ba.size_s());
#endif
sendRequest(ba);
+2 -2
View File
@@ -161,7 +161,7 @@ public:
//! \~russian Возвращает число байтов, уже обработанных в текущей сессии.
llong bytesCur() const { return bytes_cur; }
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
//! \~english Get diagnostics object
//! \~russian Получить объект диагностики
//! \~\return
@@ -348,7 +348,7 @@ private:
CRC_16 crc;
int send_queue;
int send_up;
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
PIDiagnostics diag;
#endif
PIMutex mutex_session;
+2 -2
View File
@@ -34,7 +34,7 @@
//! \~\brief
//! \~english Multi-channel sender and receiver over multicast, broadcast and loopback endpoints.
//! \~russian Многоканальный отправитель и приемник через multicast-, broadcast- и loopback-конечные точки.
#ifndef PIP_NO_SOCKET
#ifdef PIP_HAS_SOCKET
class PIP_IO_UTILS_EXPORT PIBroadcast
: public PIThread
, public PIEthUtilBase {
@@ -183,6 +183,6 @@ private:
int lo_pcnt;
bool _started, _send_only, _reinit;
};
#endif // PIP_NO_SOCKET
#endif // PIP_HAS_SOCKET
#endif // PIBROADCAST_H
+2 -2
View File
@@ -24,7 +24,7 @@
#include "piliterals_time.h"
#include "pitime.h"
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
# include "pitranslator.h"
/** \class PIConnection
@@ -1312,4 +1312,4 @@ __DevicePoolContainer__::__DevicePoolContainer__() {
__device_pool__ = new PIConnection::DevicePool();
}
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
+10 -10
View File
@@ -379,7 +379,7 @@ public:
bool isEmpty() const { return device_modes.isEmpty(); }
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
//! \~english Returns diagnostics object for device or filter "full_path_name".
//! \~russian Возвращает объект диагностики для устройства или фильтра "full_path_name".
PIDiagnostics * diagnostic(const PIString & full_path_name) const;
@@ -417,7 +417,7 @@ public:
//! \~russian Возвращает, работает ли общий пул устройств в режиме имитации.
static bool isFakeMode();
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
class PIP_EXPORT DevicePool: public PIThread {
PIOBJECT_SUBCLASS(DevicePool, PIThread);
friend void __DevicePool_threadReadDP(void * ddp);
@@ -459,7 +459,7 @@ public:
PIMap<PIString, DeviceData *> devices;
bool fake;
};
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
//! \events
@@ -475,7 +475,7 @@ public:
//! \~russian Генерируется, когда фильтр "from" выдает пакет.
EVENT2(packetReceivedEvent, const PIString &, from, const PIByteArray &, data);
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
//! \fn void qualityChanged(const PIIODevice * device, PIDiagnostics::Quality new_quality, PIDiagnostics::Quality old_quality)
//! \~english Emitted when diagnostics quality of "device" changes.
//! \~russian Генерируется при изменении качества диагностики устройства "device".
@@ -502,7 +502,7 @@ private:
void rawReceived(PIIODevice * dev, const PIString & from, const PIByteArray & data);
void unboundExtractor(PIPacketExtractor * pe);
EVENT_HANDLER2(void, packetExtractorReceived, const uchar *, data, int, size);
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
EVENT_HANDLER2(void, diagQualityChanged, PIDiagnostics::Quality, new_quality, PIDiagnostics::Quality, old_quality);
#endif
@@ -517,7 +517,7 @@ private:
PIVector<PIIODevice *> devices;
};
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
class PIP_EXPORT Sender: public PITimer {
PIOBJECT_SUBCLASS(Sender, PIObject);
@@ -533,21 +533,21 @@ private:
#endif
PIMap<PIString, Extractor *> extractors;
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
PIMap<PIString, Sender *> senders;
#endif
PIMap<PIString, PIIODevice *> device_names;
PIMap<PIIODevice *, PIIODevice::DeviceMode> device_modes;
PIMap<PIIODevice *, PIVector<PIPacketExtractor *>> bounded_extractors;
PIMap<PIIODevice *, PIVector<PIIODevice *>> channels_;
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
PIMap<PIIODevice *, PIDiagnostics *> diags_;
#endif
static PIVector<PIConnection *> _connections;
};
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
void __DevicePool_threadReadDP(void * ddp);
extern PIP_EXPORT PIConnection::DevicePool * __device_pool__;
@@ -559,7 +559,7 @@ public:
};
static __DevicePoolContainer__ __device_pool_container__;
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
#endif // PICONNECTION_H
+2 -2
View File
@@ -19,7 +19,7 @@
#include "pidiagnostics.h"
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
# include "piliterals_time.h"
# include "pitranslator.h"
@@ -253,4 +253,4 @@ void PIDiagnostics::changeDisconnectTimeout(PISystemTime disct) {
mutex_state.unlock();
}
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
+2 -2
View File
@@ -29,7 +29,7 @@
#include "pitimer.h"
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
//! \~\ingroup IO-Utils
//! \brief
//! \~english Connection diagnostics for packet frequency, throughput and receive quality
@@ -236,6 +236,6 @@ inline bool operator!=(const PIDiagnostics::Entry & f, const PIDiagnostics::Entr
inline bool operator<(const PIDiagnostics::Entry & f, const PIDiagnostics::Entry & s) {
return f.bytes_ok < s.bytes_ok;
}
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
#endif // PIDIAGNOSTICS_H
+2 -2
View File
@@ -24,7 +24,7 @@
#ifndef PIETHUTILBASE_H
#define PIETHUTILBASE_H
#ifndef PIP_NO_SOCKET
#ifdef PIP_HAS_SOCKET
#include "pibytearray.h"
#include "pip_io_utils_export.h"
@@ -97,5 +97,5 @@ private:
bool _crypt;
};
#endif // PIP_NO_SOCKET
#endif // PIP_HAS_SOCKET
#endif // PIETHUTILBASE_H
+2 -2
View File
@@ -19,7 +19,7 @@
#include "pifiletransfer.h"
#ifndef PIP_NO_FILESYSTEM
#ifdef PIP_HAS_FILESYSTEM
const char PIFileTransfer::sign[] = {'P', 'F', 'T'};
PIFileTransfer::PIFileTransfer() {
@@ -341,4 +341,4 @@ void PIFileTransfer::send_finished(bool ok) {
}
}
#endif // PIP_NO_FILESYSTEM
#endif // PIP_HAS_FILESYSTEM
+2 -2
View File
@@ -31,7 +31,7 @@
#include "pibasetransfer.h"
#include "pidir.h"
#ifndef PIP_NO_FILESYSTEM
#ifdef PIP_HAS_FILESYSTEM
# define __PIFILETRANSFER_VERSION 2
@@ -263,6 +263,6 @@ inline PICout operator<<(PICout s, const PIFileTransfer::PFTFileInfo & v) {
s.restoreControls();
return s;
}
#endif // PIP_NO_FILESYSTEM
#endif // PIP_HAS_FILESYSTEM
#endif // PIFILETRANSFER_H
+2 -2
View File
@@ -24,7 +24,7 @@
#ifndef pipackedtcp_H
#define pipackedtcp_H
#ifndef PIP_NO_SOCKET
#ifdef PIP_HAS_SOCKET
#include "piiodevice.h"
#include "pinetworkaddress.h"
@@ -123,6 +123,6 @@ private:
REGISTER_DEVICE(PIPackedTCP)
#endif // PIP_NO_SOCKET
#endif // PIP_HAS_SOCKET
#endif
+2 -2
View File
@@ -24,7 +24,7 @@
#ifndef PISTREAMPACKER_H
#define PISTREAMPACKER_H
#ifndef PIP_NO_SOCKET
#ifdef PIP_HAS_SOCKET
#include "piethutilbase.h"
#include "piobject.h"
@@ -201,5 +201,5 @@ private:
mutable PIMutex prog_s_mutex, prog_r_mutex;
};
#endif // PIP_NO_SOCKET
#endif // PIP_HAS_SOCKET
#endif // PISTREAMPACKER_H
+2 -2
View File
@@ -19,7 +19,7 @@
#include "pifft.h"
#ifndef PIP_NO_FFT
#ifdef PIP_HAS_FFT
PIFFT_double::PIFFT_double() {}
@@ -1961,4 +1961,4 @@ void PIFFT_float::ftbase_ffttwcalc(PIVector<float> * a, int aoffset, int n1, int
}
}
#endif // PIP_NO_FFT
#endif // PIP_HAS_FFT
+2 -2
View File
@@ -59,7 +59,7 @@
#include "pimathcomplex.h"
#ifndef PIP_NO_FFT
#ifdef PIP_HAS_FFT
# include "pip_fftw_export.h"
@@ -384,6 +384,6 @@ typedef PIFFTW<ldouble> PIFFTWld;
# endif
#endif // PIP_NO_FFT
#endif // PIP_HAS_FFT
#endif // PIFFT_H
@@ -43,7 +43,7 @@ PIString mask(const PIString & str) {
}
PIString overrideFile(PIString path) {
#ifndef PIP_NO_FILESYSTEM
#ifdef PIP_HAS_FILESYSTEM
if (path.isEmpty()) return {};
PIFile::FileInfo fi(path);
auto ext = fi.extension();
@@ -142,7 +142,7 @@ PIValueTree PIValueTreeConversions::fromText(PIIODevice * device) {
PIMap<PIString, PIString> substitutions;
if (!device) return ret;
PIString base_path;
#ifndef PIP_NO_FILESYSTEM
#ifdef PIP_HAS_FILESYSTEM
if (device->isTypeOf<PIFile>()) base_path = PIFile::FileInfo(device->path()).dir().replaceAll('\\', '/');
#endif
PIIOTextStream ts(device);
@@ -217,7 +217,7 @@ PIValueTree PIValueTreeConversions::fromText(PIIODevice * device) {
line.cutLeft(1).trim();
if (path.front() == "include") {
PIString include = line.trimmed();
#ifndef PIP_NO_FILESYSTEM
#ifdef PIP_HAS_FILESYSTEM
if (!PIFile::FileInfo(include).isAbsolute()) {
include = base_path + "/" + include.replaceAll('\\', '/');
include.replaceAll("//", '/');
@@ -353,7 +353,7 @@ PIValueTree PIValueTreeConversions::fromText(const PIString & str) {
PIValueTree PIValueTreeConversions::fromJSONFile(const PIString & path) {
#ifdef PIP_NO_FILESYSTEM
#ifndef PIP_HAS_FILESYSTEM
return PIValueTree();
#else
auto ret = PIValueTreeConversions::fromJSON(PIJSON::fromJSON(PIString::fromUTF8(PIFile::readAll(path))));
@@ -368,7 +368,7 @@ PIValueTree PIValueTreeConversions::fromJSONFile(const PIString & path) {
PIValueTree PIValueTreeConversions::fromTextFile(const PIString & path) {
#ifdef PIP_NO_FILESYSTEM
#ifndef PIP_HAS_FILESYSTEM
return PIValueTree();
#else
PIFile f(path, PIIODevice::ReadOnly);
@@ -385,7 +385,7 @@ PIValueTree PIValueTreeConversions::fromTextFile(const PIString & path) {
bool PIValueTreeConversions::toJSONFile(const PIString & path, const PIValueTree & root, Options options) {
#ifdef PIP_NO_FILESYSTEM
#ifndef PIP_HAS_FILESYSTEM
return false;
#else
auto d = toJSON(root, options).toJSON(PIJSON::Tree).toUTF8();
@@ -396,7 +396,7 @@ bool PIValueTreeConversions::toJSONFile(const PIString & path, const PIValueTree
bool PIValueTreeConversions::toTextFile(const PIString & path, const PIValueTree & root, Options options) {
#ifdef PIP_NO_FILESYSTEM
#ifndef PIP_HAS_FILESYSTEM
return false;
#else
auto d = toText(root, options).toUTF8();
@@ -99,7 +99,7 @@ void PITransitionBase::trigger() {
PITransitionTimeout::PITransitionTimeout(PIStateBase * source, PIStateBase * target, PISystemTime timeout)
: PITransitionBase(source, target, 0) {
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
timer.setInterval(timeout);
timer.setSlot([this] {
trigger();
@@ -110,21 +110,21 @@ PITransitionTimeout::PITransitionTimeout(PIStateBase * source, PIStateBase * tar
PITransitionTimeout::~PITransitionTimeout() {
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
timer.stopAndWait();
#endif
}
void PITransitionTimeout::enabled() {
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
timer.start();
#endif
}
void PITransitionTimeout::disabled() {
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
timer.stop();
#endif
}
@@ -142,7 +142,7 @@ private:
void enabled() override;
void disabled() override;
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
PITimer timer;
#endif
};
+2 -2
View File
@@ -3,7 +3,7 @@
#include "piliterals_string.h"
#include "piliterals_time.h"
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
# ifndef WINDOWS
# include "pidir.h"
# include "pifile.h"
@@ -674,4 +674,4 @@ PIHIDeviceInfo PIHIDevice::findDevice(const PIString & name) {
return PIHIDeviceInfo();
}
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
+2 -2
View File
@@ -169,7 +169,7 @@ PIP_EXPORT PICout operator<<(PICout s, const PIHIDeviceInfo & v);
//! \~english Provides access to HID (Human Interface Device) devices such as game controllers, joysticks, and other input devices.
//! \~russian Предоставляет доступ к HID (Human Interface Device) устройствам, таким как геймконтроллеры, джойстики и другие устройства
//! ввода.
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
class PIP_EXPORT PIHIDevice: public PIThread {
PIOBJECT_SUBCLASS(PIHIDevice, PIThread)
@@ -271,7 +271,7 @@ private:
PIMap<int, int> prev_buttons, cur_buttons;
float dead_zone = 0.f;
};
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
#endif
+2 -2
View File
@@ -17,7 +17,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PIP_NO_DYNLIB
#ifdef PIP_HAS_DYNLIB
# include "pilibrary.h"
@@ -233,4 +233,4 @@ void PILibrary::getLastError() {
# endif
}
#endif // PIP_NO_DYNLIB
#endif // PIP_HAS_DYNLIB
+2 -2
View File
@@ -26,7 +26,7 @@
#ifndef PILIBRARY_H
#define PILIBRARY_H
#ifndef PIP_NO_DYNLIB
#ifdef PIP_HAS_DYNLIB
# include "pistring.h"
@@ -82,5 +82,5 @@ private:
PIString libpath, liberror;
};
#endif // PIP_NO_DYNLIB
#endif // PIP_HAS_DYNLIB
#endif // PILIBRARY_H
+2 -2
View File
@@ -17,7 +17,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PIP_NO_DYNLIB
#ifdef PIP_HAS_DYNLIB
# include "piplugin.h"
@@ -493,4 +493,4 @@ PIString PIPluginLoader::libExtension() {
}
#endif // PIP_NO_DYNLIB
#endif // PIP_HAS_DYNLIB
+2 -2
View File
@@ -28,7 +28,7 @@
#ifndef PIPLUGIN_H
#define PIPLUGIN_H
#ifndef PIP_NO_DYNLIB
#ifdef PIP_HAS_DYNLIB
# include "pilibrary.h"
# include "pistringlist.h"
@@ -298,5 +298,5 @@ private:
};
#endif // PIP_NO_DYNLIB
#endif // PIP_HAS_DYNLIB
#endif // PIPLUGIN_H
+2 -2
View File
@@ -18,7 +18,7 @@
*/
#include "pitime.h"
#ifndef PIP_NO_PROCESS
#ifdef PIP_HAS_PROCESS
# include "piincludes_p.h"
# include "piliterals_bytes.h"
@@ -516,4 +516,4 @@ PIString PIProcess::getEnvironmentVariable(const PIString & variable) {
return PIString();
}
#endif // PIP_NO_PROCESS
#endif // PIP_HAS_PROCESS
+2 -2
View File
@@ -26,7 +26,7 @@
#ifndef PIPROCESS_H
#define PIPROCESS_H
#ifndef PIP_NO_PROCESS
#ifdef PIP_HAS_PROCESS
# include "pithread.h"
@@ -258,5 +258,5 @@ private:
std::atomic_bool exec_finished;
};
#endif // PIP_NO_PROCESS
#endif // PIP_HAS_PROCESS
#endif // PIPROCESS_H
+3 -3
View File
@@ -207,7 +207,7 @@ PIVector<PISystemInfo::MountInfo> PISystemInfo::mountInfo(bool ignore_cache) {
PIString confDir() {
return
#ifdef WINDOWS
# ifndef PIP_NO_FILESYSTEM
# ifdef PIP_HAS_FILESYSTEM
PIDir::home().path() + "/AppData/Local"
# else
""
@@ -215,7 +215,7 @@ PIString confDir() {
#elif defined(ANDROID)
""
#else
# ifndef PIP_NO_FILESYSTEM
# ifdef PIP_HAS_FILESYSTEM
PIDir::home().path() + "/.config"
# else
""
@@ -242,7 +242,7 @@ PIString PISystemInfo::machineKey() {
PISystemInfo * si = instance();
PIByteArray salt;
PIString conf = confDir() + "/.pip_machine_salt";
#ifndef PIP_NO_FILESYSTEM
#ifdef PIP_HAS_FILESYSTEM
if (PIFile::isExists(conf)) salt = PIFile::readAll(conf);
if (salt.size_s() != SALT_SIZE) {
salt = generateSalt();
+4 -4
View File
@@ -19,9 +19,9 @@
#include "pisystemtests.h"
#ifndef PIP_NO_FILESYSTEM
#ifdef PIP_HAS_FILESYSTEM
# include "piconfig.h"
#endif // !PIP_NO_FILESYSTEM
#endif // PIP_HAS_FILESYSTEM
namespace PISystemTests {
@@ -35,10 +35,10 @@ PISystemTestReader pisystestreader;
PISystemTests::PISystemTestReader::PISystemTestReader() {
#if !defined(WINDOWS) && !defined(PIP_NO_FILESYSTEM)
#if !defined(WINDOWS) && defined(PIP_HAS_FILESYSTEM)
PIConfig conf(PIStringAscii("/etc/pip.conf"), PIIODevice::ReadOnly);
time_resolution_ns = conf.getValue(PIStringAscii("time_resolution_ns"), 1).toLong();
time_elapsed_ns = conf.getValue(PIStringAscii("time_elapsed_ns"), 0).toLong();
usleep_offset_us = conf.getValue(PIStringAscii("usleep_offset_us"), 60).toLong();
#endif // !WINDOWS && !PIP_NO_FILESYSTEM
#endif // !WINDOWS && PIP_HAS_FILESYSTEM
}
+2 -2
View File
@@ -23,7 +23,7 @@
# define _WIN32_WINNT 0x0600
#endif
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
#include "piconditionvar.h"
#include "piincludes_p.h"
#ifdef WINDOWS
@@ -178,4 +178,4 @@ void PIConditionVariable::notifyAll() {
pthread_cond_broadcast(&PRIVATE->nativeHandle);
#endif
}
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
+4 -4
View File
@@ -29,7 +29,7 @@
#include "pisystemtime.h"
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
//! \~\ingroup Thread
//! \~\brief
//! \~english Condition variable used together with external %PIMutex.
@@ -175,9 +175,9 @@ private:
PRIVATE_DECLARATION(PIP_EXPORT)
};
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
#ifdef PIP_NO_THREADS
#ifndef PIP_HAS_THREADS
class PIConditionVariable {
public:
void wait(PIMutex &) {}
@@ -187,6 +187,6 @@ public:
void notifyOne() {}
void notifyAll() {}
};
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
#endif // PICONDITIONVAR_H
+2 -2
View File
@@ -107,7 +107,7 @@
//! \}
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
#include "pimutex.h"
#include "piincludes_p.h"
@@ -229,4 +229,4 @@ void PIMutex::destroy() {
pthread_mutex_destroy(&(PRIVATE->mutex));
#endif
}
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
+4 -4
View File
@@ -28,7 +28,7 @@
#include "piinit.h"
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
//! \~\ingroup Thread
//! \~\brief
//! \~english Mutex for mutual exclusion between threads.
@@ -94,9 +94,9 @@ private:
bool cond;
};
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
#ifdef PIP_NO_THREADS
#ifndef PIP_HAS_THREADS
//! \~\ingroup Thread
//! \~\brief
//! \~english Dummy mutex for builds without threading support.
@@ -117,6 +117,6 @@ class PIMutexLocker {
public:
PIMutexLocker(PIMutex &, bool = true) {}
};
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
#endif // PIMUTEX_H
+2 -2
View File
@@ -151,7 +151,7 @@
#include "pireadwritelock.h"
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
PIReadWriteLock::PIReadWriteLock() {}
@@ -235,4 +235,4 @@ void PIReadWriteLock::unlockRead() {
var.notifyAll();
}
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
+2 -2
View File
@@ -98,7 +98,7 @@
#include "pisemaphore.h"
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
PISemaphore::PISemaphore(int initial) {
@@ -153,4 +153,4 @@ int PISemaphore::available() const {
return count;
}
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
+6 -6
View File
@@ -17,7 +17,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
# include "pithread.h"
# include "piincludes_p.h"
@@ -450,7 +450,7 @@ __THREAD_FUNC_RET__ thread_function_once(void * t) {
//! \return \c false если таймаут истёк
# ifndef PIP_NO_THREADS
# ifdef PIP_HAS_THREADS
__PIThreadCollection * __PIThreadCollection::instance() {
return __PIThreadCollection_Initializer__::__instance__;
@@ -516,7 +516,7 @@ __PIThreadCollection_Initializer__::~__PIThreadCollection_Initializer__() {
}
}
# endif // PIP_NO_THREADS
# endif // PIP_HAS_THREADS
PRIVATE_DEFINITION_START(PIThread)
@@ -1003,7 +1003,7 @@ void PIThread::runOnce(PIObject * object, const char * handler, const PIString &
delete t;
return;
}
# ifndef PIP_NO_THREADS
# ifdef PIP_HAS_THREADS
__PIThreadCollection::instance()->startedAuto(t);
CONNECT0(void, t, stopped, __PIThreadCollection::instance(), stoppedAuto);
# endif
@@ -1037,7 +1037,7 @@ void PIThread::runOnce(std::function<void()> func, const PIString & name) {
PIThread * t = new PIThread();
t->setName(name);
t->setSlot(std::move(func));
# ifndef PIP_NO_THREADS
# ifdef PIP_HAS_THREADS
__PIThreadCollection::instance()->startedAuto(t);
CONNECT0(void, t, stopped, __PIThreadCollection::instance(), stoppedAuto);
# endif
@@ -1079,4 +1079,4 @@ bool PIThread::_waitForFinish(PISystemTime max_tm) {
# endif
return false;
}
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
+3 -3
View File
@@ -43,7 +43,7 @@
class PIThread;
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
class PIIntrospectionThreads;
class PIP_EXPORT __PIThreadCollection: public PIObject {
@@ -97,7 +97,7 @@ typedef std::function<void(void *)> ThreadFunc;
//! проход без повторяющегося цикла обработки очереди.
class PIP_EXPORT PIThread: public PIObject {
PIOBJECT_SUBCLASS(PIThread, PIObject);
# ifndef PIP_NO_THREADS
# ifdef PIP_HAS_THREADS
friend class PIIntrospectionThreads;
# endif
@@ -338,5 +338,5 @@ private:
void setThreadName();
};
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
#endif // PITHREAD_H
+2 -2
View File
@@ -19,7 +19,7 @@
#include "pithreadnotifier.h"
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
//! \addtogroup Thread
//! \{
@@ -145,4 +145,4 @@ void PIThreadNotifier::notify() {
m.unlock();
}
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
+2 -2
View File
@@ -27,7 +27,7 @@
#include "piconditionvar.h"
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
//! \~\ingroup Thread
//! \~\brief
@@ -64,6 +64,6 @@ private:
PIMutex m;
PIConditionVariable v;
};
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
#endif // PITHREADNOTIFIER_H
+2 -2
View File
@@ -23,7 +23,7 @@
#include "pisysteminfo.h"
#include "pithread.h"
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
//! \addtogroup Thread
@@ -169,4 +169,4 @@ void PIThreadPoolLoop::exec(int index_start, int index_count, std::function<void
exec(index_start, index_count);
}
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
+2 -2
View File
@@ -21,7 +21,7 @@
#include "pisysteminfo.h"
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
//! \addtogroup Thread
//! \{
@@ -239,4 +239,4 @@ void PIThreadPoolWorker::threadFunc(Worker * w) {
w->notifier.notify();
}
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
+2 -2
View File
@@ -33,7 +33,7 @@
//! \~\brief
//! \~english Fixed-size pool of worker threads for generic-purpose tasks.
//! \~russian Фиксированный пул рабочих потоков для задач общего назначения.
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
class PIP_EXPORT PIThreadPoolWorker: public PIObject {
PIOBJECT(PIThreadPoolWorker)
@@ -173,7 +173,7 @@ private:
PISet<PIObject *> contexts;
std::atomic_int64_t next_task_id = {0};
};
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
#endif // PITHREADPOOLWORKER_H
+2 -2
View File
@@ -17,7 +17,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
#include "pitimer.h"
#include "piconditionvar.h"
@@ -316,4 +316,4 @@ void PITimer::stop() {
thread->stop();
event.notifyAll();
}
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
+2 -2
View File
@@ -44,7 +44,7 @@
class PIThread;
#ifndef PIP_NO_THREADS
#ifdef PIP_HAS_THREADS
//! \~\ingroup Thread
//! \~\brief
//! \~english Periodic timer that emits ticks from an internal worker thread.
@@ -247,5 +247,5 @@ protected:
PIConditionVariable event;
};
#endif // PIP_NO_THREADS
#endif // PIP_HAS_THREADS
#endif // PITIMER_H
+4 -4
View File
@@ -20,7 +20,7 @@
#include "pinetworkaddress.h"
// clang-format off
#ifndef PIP_NO_SOCKET
#ifdef PIP_HAS_SOCKET
#ifdef QNX
# include <netdb.h>
#else
@@ -34,7 +34,7 @@
# endif
# endif
#endif
#endif // PIP_NO_SOCKET
#endif // PIP_HAS_SOCKET
// clang-format on
@@ -147,7 +147,7 @@ PINetworkAddress PINetworkAddress::resolve(const PIString & host_port) {
PINetworkAddress PINetworkAddress::resolve(const PIString & host, ushort port) {
#ifndef PIP_NO_SOCKET
#ifdef PIP_HAS_SOCKET
PINetworkAddress ret(0, port);
hostent * he = gethostbyname(host.dataAscii());
if (!he) return ret;
@@ -170,7 +170,7 @@ void PINetworkAddress::splitIPPort(const PIString & ipp, PIString * _ip, int * _
void PINetworkAddress::initIP(const PIString & _ip) {
#ifndef PIP_NO_SOCKET
#ifdef PIP_HAS_SOCKET
ip_ = inet_addr(_ip.dataAscii());
#else
(void)_ip;
+1 -1
View File
@@ -56,7 +56,7 @@ void piUSleep(int usecs) {
#elif defined(PICO_SDK)
sleep_us(usecs);
#else
# ifndef PIP_NO_THREADS
# ifdef PIP_HAS_THREADS
usecs -= PISystemTests::usleep_offset_us;
# endif
if (usecs > 0) usleep(usecs);
+7 -7
View File
@@ -21,9 +21,9 @@
#include "colors_p.h"
#include "pipropertystorage.h"
#ifndef PIP_NO_FILESYSTEM
#ifdef PIP_HAS_FILESYSTEM
# include "piiodevice.h"
#endif // PIP_NO_FILESYSTEM
#endif // PIP_HAS_FILESYSTEM
int PIVariantTypes::Enum::selectedValue() const {
@@ -84,11 +84,11 @@ PIStringList PIVariantTypes::Enum::names() const {
PIVariantTypes::IODevice::IODevice() {
#ifndef PIP_NO_FILESYSTEM
#ifdef PIP_HAS_FILESYSTEM
mode = PIIODevice::ReadWrite;
#else
mode = 0; // TODO: PIIODevice for PIP_NO_FILESYSTEM
#endif // PIP_NO_FILESYSTEM
mode = 0; // TODO: PIIODevice for PIP_HAS_FILESYSTEM
#endif // PIP_HAS_FILESYSTEM
options = 0;
}
@@ -121,12 +121,12 @@ PIString PIVariantTypes::IODevice::toPICout() const {
}
if (rwc == 1) s += "o";
s += ", flags=";
#ifndef PIP_NO_FILESYSTEM // TODO: PIIODevice for PIP_NO_FILESYSTEM
#ifdef PIP_HAS_FILESYSTEM // TODO: PIIODevice for !PIP_HAS_FILESYSTEM
if (options != 0) {
if (((PIIODevice::DeviceOptions)options)[PIIODevice::BlockingRead]) s += " br";
if (((PIIODevice::DeviceOptions)options)[PIIODevice::BlockingWrite]) s += " bw";
}
#endif // PIP_NO_FILESYSTEM
#endif // PIP_HAS_FILESYSTEM
PIPropertyStorage ps = get();
for (const auto & p: ps) {
s += ", " + p.name + "=\"" + p.value.toString() + "\"";