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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user