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