refactor: migrate MICRO_PIP to fine-grained feature flags

Replace monolithic MICRO_PIP/PIP_MICRO with granular flags:

Feature flags (CMake options + platform auto-detection):
- PIP_NO_FILESYSTEM, PIP_NO_THREADS, PIP_NO_SOCKET
- PIP_NO_PROCESS, PIP_NO_DYNLIB, PIP_NO_FFT, PIP_NO_SERIAL

Embedded optimization flag:
- PIP_EMBEDDED (auto-set for Pico SDK and FreeRTOS)
  Controls buffer sizes, time stubs, terminal fallback, init stubs

Platform blocks in CMakeLists.txt:
- Pico SDK: auto-disables FS, PROCESS, DYNLIB, FFT, SERIAL;
  conditionally disables THREADS (no FreeRTOS) and SOCKET (no LWIP)
- FreeRTOS: auto-disables FS, PROCESS, DYNLIB, FFT, SERIAL;
  conditionally disables SOCKET (no LWIP)
- Android: auto-disables PROCESS, DYNLIB, FFT

Updated 96 files across libs/, utils/, tests/, and CMakeLists.txt.
Builds verified for Linux (547 tests pass) and Pico SDK (100%).
Removed all MICRO_PIP and PIP_MICRO references (0 remaining).
This commit is contained in:
2026-08-11 14:34:59 +03:00
parent 87c53d45a4
commit 4d8b743075
97 changed files with 1555 additions and 914 deletions
+36 -4
View File
@@ -54,7 +54,7 @@
//! требует явного опустошения очереди через \a callQueuedEvents() или
//! \a maybeCallQueuedEvents().
class PIP_EXPORT PIObject {
#ifndef MICRO_PIP
#ifndef PIP_INTROSPECTION
friend class PIObjectManager;
friend PIP_EXPORT void dumpApplication(bool);
friend class PIIntrospection;
@@ -461,7 +461,9 @@ public:
i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender));
} else {
bool ts = sender->thread_safe_;
#ifndef PIP_NO_THREADS
if (ts) i.dest_o->mutex_.lock();
#endif
i.dest_o->eventBegin();
sender->eventBegin();
i.dest_o->emitter_ = sender;
@@ -469,7 +471,9 @@ public:
sender->eventEnd();
if (i.dest_o->isPIObject()) {
i.dest_o->emitter_ = 0;
#ifndef PIP_NO_THREADS
if (ts) i.dest_o->mutex_.unlock();
#endif
i.dest_o->eventEnd();
}
}
@@ -494,7 +498,9 @@ public:
i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender, vl));
} else {
bool ts = sender->thread_safe_;
#ifndef PIP_NO_THREADS
if (ts) i.dest_o->mutex_.lock();
#endif
i.dest_o->eventBegin();
sender->eventBegin();
i.dest_o->emitter_ = sender;
@@ -505,7 +511,9 @@ public:
sender->eventEnd();
if (i.dest_o->isPIObject()) {
i.dest_o->emitter_ = 0;
#ifndef PIP_NO_THREADS
if (ts) i.dest_o->mutex_.unlock();
#endif
i.dest_o->eventEnd();
}
}
@@ -530,7 +538,9 @@ public:
i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender, vl));
} else {
bool ts = sender->thread_safe_;
#ifndef PIP_NO_THREADS
if (ts) i.dest_o->mutex_.lock();
#endif
i.dest_o->eventBegin();
sender->eventBegin();
i.dest_o->emitter_ = sender;
@@ -542,7 +552,9 @@ public:
sender->eventEnd();
if (i.dest_o->isPIObject()) {
i.dest_o->emitter_ = 0;
#ifndef PIP_NO_THREADS
if (ts) i.dest_o->mutex_.unlock();
#endif
i.dest_o->eventEnd();
}
}
@@ -568,7 +580,9 @@ public:
i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender, vl));
} else {
bool ts = sender->thread_safe_;
#ifndef PIP_NO_THREADS
if (ts) i.dest_o->mutex_.lock();
#endif
i.dest_o->eventBegin();
sender->eventBegin();
i.dest_o->emitter_ = sender;
@@ -581,7 +595,9 @@ public:
sender->eventEnd();
if (i.dest_o->isPIObject()) {
i.dest_o->emitter_ = 0;
#ifndef PIP_NO_THREADS
if (ts) i.dest_o->mutex_.unlock();
#endif
i.dest_o->eventEnd();
}
}
@@ -613,7 +629,9 @@ public:
i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender, vl));
} else {
bool ts = sender->thread_safe_;
#ifndef PIP_NO_THREADS
if (ts) i.dest_o->mutex_.lock();
#endif
i.dest_o->eventBegin();
sender->eventBegin();
i.dest_o->emitter_ = sender;
@@ -627,7 +645,9 @@ public:
sender->eventEnd();
if (i.dest_o->isPIObject()) {
i.dest_o->emitter_ = 0;
#ifndef PIP_NO_THREADS
if (ts) i.dest_o->mutex_.unlock();
#endif
i.dest_o->eventEnd();
}
}
@@ -638,6 +658,7 @@ public:
//! \~english Returns the first live object with name "name", or \c nullptr.
//! \~russian Возвращает первый живой объект с именем "name", либо \c nullptr.
#ifndef PIP_NO_THREADS
static PIObject * findByName(const PIString & name) {
PIMutexLocker _ml(mutexObjects());
for (auto * i: PIObject::objects()) {
@@ -646,6 +667,7 @@ public:
}
return nullptr;
}
#endif
//! \~english Returns whether this pointer still refers to a live %PIObject instance.
//! \~russian Возвращает, указывает ли этот указатель на ещё существующий экземпляр %PIObject.
@@ -653,6 +675,7 @@ public:
//! \~english Returns whether this object belongs to class "T" or one of its registered descendants.
//! \~russian Возвращает, принадлежит ли этот объект классу "T" или одному из его зарегистрированных потомков.
#ifndef PIP_NO_THREADS
template<typename T>
bool isTypeOf() const {
if (!isPIObject()) return false;
@@ -667,6 +690,7 @@ public:
if (!isTypeOf<T>()) return (T *)nullptr;
return (T *)this;
}
#endif
//! \~english Returns whether "o" points to a live %PIObject instance.
//! \~russian Возвращает, указывает ли "o" на ещё существующий экземпляр %PIObject.
@@ -796,6 +820,7 @@ private:
PIVector<PIVariantSimple> values;
};
#ifndef PIP_NO_THREADS
class Deleter {
public:
Deleter();
@@ -807,6 +832,7 @@ private:
void deleteObject(PIObject * o);
PRIVATE_DECLARATION(PIP_EXPORT)
};
#endif
bool findSuitableMethodV(const PIString & method, int args, int & ret_args, __MetaFunc & ret);
PIVector<__MetaFunc> findEH(const PIString & name) const;
@@ -830,13 +856,19 @@ private:
PIMap<uint, PIVariant> properties_;
PISet<PIObject *> connectors;
PIVector<__QueuedEvent> events_queue;
PIMutex mutex_, mutex_connect, mutex_queue;
PIObject * emitter_;
bool thread_safe_, proc_event_queue;
std::atomic_int in_event_cnt;
#ifndef PIP_NO_THREADS
PIMutex mutex_, mutex_connect, mutex_queue;
bool thread_safe_, proc_event_queue;
#else
PIMutex mutex_, mutex_connect, mutex_queue;
bool thread_safe_ = false, proc_event_queue = false;
#endif
};
#ifndef MICRO_PIP
#ifndef PIP_NO_THREADS
//! \~english Dumps application-level %PIObject diagnostics.
//! \~russian Выводит диагностическую информацию уровня приложения для %PIObject.