remove some unused defines

This commit is contained in:
2026-08-12 14:04:49 +03:00
parent 8bf7738e8a
commit e2c0445c1b
15 changed files with 77 additions and 128 deletions
+2
View File
@@ -243,6 +243,7 @@ if(DEFINED PICO_BOARD)
set(PIP_HAS_DYNLIB OFF CACHE BOOL "" FORCE) set(PIP_HAS_DYNLIB OFF CACHE BOOL "" FORCE)
set(PIP_HAS_FFT OFF CACHE BOOL "" FORCE) set(PIP_HAS_FFT OFF CACHE BOOL "" FORCE)
set(PIP_HAS_SERIAL OFF CACHE BOOL "" FORCE) set(PIP_HAS_SERIAL OFF CACHE BOOL "" FORCE)
set(PIP_BUILD_CONSOLE OFF CACHE BOOL "" FORCE)
message(STATUS "Building PIP for Pi Pico SDK ${PICO_SDK_VERSION_STRING}") message(STATUS "Building PIP for Pi Pico SDK ${PICO_SDK_VERSION_STRING}")
endif() endif()
@@ -257,6 +258,7 @@ if(PIP_FREERTOS)
set(PIP_HAS_DYNLIB OFF CACHE BOOL "" FORCE) set(PIP_HAS_DYNLIB OFF CACHE BOOL "" FORCE)
set(PIP_HAS_FFT OFF CACHE BOOL "" FORCE) set(PIP_HAS_FFT OFF CACHE BOOL "" FORCE)
set(PIP_HAS_SERIAL OFF CACHE BOOL "" FORCE) set(PIP_HAS_SERIAL OFF CACHE BOOL "" FORCE)
set(PIP_BUILD_CONSOLE OFF CACHE BOOL "" FORCE)
endif() endif()
if(DEFINED ANDROID_PLATFORM) if(DEFINED ANDROID_PLATFORM)
-5
View File
@@ -22,11 +22,9 @@
#include "piliterals_time.h" #include "piliterals_time.h"
// clang-format off // clang-format off
#ifndef WINDOWS #ifndef WINDOWS
#ifndef PICO_SDK
# include <fcntl.h> # include <fcntl.h>
# include <sys/ioctl.h> # include <sys/ioctl.h>
# include <termios.h> # include <termios.h>
#endif // PICO_SDK
#else #else
# include <wingdi.h> # include <wingdi.h>
# include <wincon.h> # include <wincon.h>
@@ -37,7 +35,6 @@
// clang-format on // clang-format on
#if !defined(PICO_SDK)
using namespace PIScreenTypes; using namespace PIScreenTypes;
@@ -660,5 +657,3 @@ PIScreenTile * PIScreen::tileByName(const PIString & name) {
if (t->name() == name) return t; if (t->name() == name) return t;
return 0; return 0;
} }
#endif // !PICO_SDK
+2 -2
View File
@@ -19,7 +19,7 @@
#include "piscreendrawer.h" #include "piscreendrawer.h"
#if !defined(PICO_SDK)
// comment for use ascii instead of unicode symbols // comment for use ascii instead of unicode symbols
# define USE_UNICODE # define USE_UNICODE
@@ -267,4 +267,4 @@ void PIScreenDrawer::drawText(int x, int y, const PIString & s, Color col_char,
} }
} }
#endif // !PICO_SDK
+2 -2
View File
@@ -21,7 +21,7 @@
#include "piscreendrawer.h" #include "piscreendrawer.h"
#if !defined(PICO_SDK)
using namespace PIScreenTypes; using namespace PIScreenTypes;
@@ -258,4 +258,4 @@ void PIScreenTile::layout() {
} }
} }
#endif // !PICO_SDK
+2 -2
View File
@@ -21,7 +21,7 @@
#include "piscreendrawer.h" #include "piscreendrawer.h"
#if !defined(PICO_SDK)
using namespace PIScreenTypes; using namespace PIScreenTypes;
@@ -695,4 +695,4 @@ void TileInput::reserCursor() {
inv = false; inv = false;
} }
#endif // !PICO_SDK
+2 -2
View File
@@ -22,7 +22,7 @@
#include "piliterals_time.h" #include "piliterals_time.h"
#include "pisharedmemory.h" #include "pisharedmemory.h"
#if !defined(PICO_SDK)
#ifdef PIP_HAS_PROCESS #ifdef PIP_HAS_PROCESS
# ifdef WINDOWS # ifdef WINDOWS
# include <windows.h> # include <windows.h>
@@ -981,4 +981,4 @@ bool PITerminal::resize(int cols, int rows) {
#endif // PIP_HAS_PROCESS #endif // PIP_HAS_PROCESS
#endif // !PICO_SDK
+2 -2
View File
@@ -34,7 +34,7 @@
//! \~\brief //! \~\brief
//! \~english Console screen manager with tile layout, drawing, and input routing. //! \~english Console screen manager with tile layout, drawing, and input routing.
//! \~russian Менеджер консольного экрана с раскладкой тайлов, отрисовкой и маршрутизацией ввода. //! \~russian Менеджер консольного экрана с раскладкой тайлов, отрисовкой и маршрутизацией ввода.
#if !defined(PICO_SDK)
class PIP_CONSOLE_EXPORT PIScreen class PIP_CONSOLE_EXPORT PIScreen
: public PIThread : public PIThread
, public PIScreenTypes::PIScreenBase { , public PIScreenTypes::PIScreenBase {
@@ -215,6 +215,6 @@ private:
PIScreenTile root; PIScreenTile root;
PIScreenTile *tile_focus, *tile_dialog; PIScreenTile *tile_focus, *tile_dialog;
}; };
#endif // !PICO_SDK
#endif // PISCREEN_H #endif // PISCREEN_H
+2 -2
View File
@@ -24,7 +24,7 @@
#ifndef PISCREENDRAWER_H #ifndef PISCREENDRAWER_H
#define PISCREENDRAWER_H #define PISCREENDRAWER_H
#if !defined(PICO_SDK)
#include "pip_console_export.h" #include "pip_console_export.h"
#include "piscreentypes.h" #include "piscreentypes.h"
@@ -147,5 +147,5 @@ private:
}; };
#endif // !PICO_SDK
#endif // PISCREENDRAWER_H #endif // PISCREENDRAWER_H
+2 -2
View File
@@ -38,7 +38,7 @@ class PIScreenDrawer;
//! \details //! \details
//! \~english Base class for all screen tiles providing layout and event handling. //! \~english Base class for all screen tiles providing layout and event handling.
//! \~russian Базовый класс для всех экранных тайлов, обеспечивающий компоновку и обработку событий. //! \~russian Базовый класс для всех экранных тайлов, обеспечивающий компоновку и обработку событий.
#if !defined(PICO_SDK)
class PIP_CONSOLE_EXPORT PIScreenTile: public PIObject { class PIP_CONSOLE_EXPORT PIScreenTile: public PIObject {
friend class PIScreen; friend class PIScreen;
PIOBJECT_SUBCLASS(PIScreenTile, PIObject); PIOBJECT_SUBCLASS(PIScreenTile, PIObject);
@@ -238,6 +238,6 @@ protected:
private: private:
int pw, ph; int pw, ph;
}; };
#endif // !PICO_SDK
#endif // PISCREENTILE_H #endif // PISCREENTILE_H
+2 -2
View File
@@ -27,7 +27,7 @@
#ifndef PISCREENTILES_H #ifndef PISCREENTILES_H
#define PISCREENTILES_H #define PISCREENTILES_H
#if !defined(PICO_SDK)
#include "pip_console_export.h" #include "pip_console_export.h"
#include "piscreentile.h" #include "piscreentile.h"
@@ -445,5 +445,5 @@ protected:
}; };
#endif // !PICO_SDK
#endif // PISCREENTILES_H #endif // PISCREENTILES_H
+2 -2
View File
@@ -27,7 +27,7 @@
#ifndef PISCREENTYPES_H #ifndef PISCREENTYPES_H
#define PISCREENTYPES_H #define PISCREENTYPES_H
#if !defined(PICO_SDK)
#include "pip_console_export.h" #include "pip_console_export.h"
#include "pivariant.h" #include "pivariant.h"
@@ -285,5 +285,5 @@ BINARY_STREAM_READ(PIScreenTypes::TileEvent) {
REGISTER_PIVARIANTSIMPLE(PIScreenTypes::TileEvent) REGISTER_PIVARIANTSIMPLE(PIScreenTypes::TileEvent)
#endif // !PICO_SDK
#endif // PISCREENTYPES_H #endif // PISCREENTYPES_H
+2 -2
View File
@@ -24,7 +24,7 @@
#ifndef PITERMINAL_H #ifndef PITERMINAL_H
#define PITERMINAL_H #define PITERMINAL_H
#if !defined(PICO_SDK)
#include "pikbdlistener.h" #include "pikbdlistener.h"
#include "pip_console_export.h" #include "pip_console_export.h"
@@ -115,5 +115,5 @@ private:
}; };
#endif // !PICO_SDK
#endif // PITERMINAL_H #endif // PITERMINAL_H
+3 -14
View File
@@ -19,13 +19,13 @@
#include "piobject.h" #include "piobject.h"
#include "piconditionvar.h"
#include "pithread.h"
#include "pitime.h" #include "pitime.h"
#ifdef PIP_HAS_THREADS #ifdef PIP_HAS_THREADS
# include "piconditionvar.h"
# include "pifile.h" # include "pifile.h"
# include "piiostream.h" # include "piiostream.h"
# include "pisysteminfo.h" # include "pisysteminfo.h"
# include "pithread.h"
#endif #endif
@@ -176,13 +176,9 @@ PIObject::PIObject(const PIString & name): _signature_(__PIOBJECT_SIGNATURE__),
in_event_cnt = 0; in_event_cnt = 0;
setName(name); setName(name);
setDebug(true); setDebug(true);
#ifdef PIP_HAS_THREADS
mutexObjects().lock(); mutexObjects().lock();
#endif
objects() << this; objects() << this;
#ifdef PIP_HAS_THREADS
mutexObjects().unlock(); mutexObjects().unlock();
#endif
// piCout << "new" << this; // piCout << "new" << this;
} }
@@ -190,13 +186,9 @@ PIObject::PIObject(const PIString & name): _signature_(__PIOBJECT_SIGNATURE__),
PIObject::~PIObject() { PIObject::~PIObject() {
in_event_cnt = 0; in_event_cnt = 0;
// piCout << "delete" << this; // piCout << "delete" << this;
#ifdef PIP_HAS_THREADS
mutexObjects().lock(); mutexObjects().lock();
#endif
objects().removeAll(this); objects().removeAll(this);
#ifdef PIP_HAS_THREADS
mutexObjects().unlock(); mutexObjects().unlock();
#endif
deleted(this); deleted(this);
piDisconnectAll(); piDisconnectAll();
_signature_ = 0; _signature_ = 0;
@@ -555,7 +547,6 @@ PIMap<uint, PIObject::__MetaData> & PIObject::__meta_data() {
} }
#ifdef PIP_HAS_THREADS
void PIObject::callQueuedEvents() { void PIObject::callQueuedEvents() {
mutex_queue.lock(); mutex_queue.lock();
PIVector<__QueuedEvent> qe = events_queue; PIVector<__QueuedEvent> qe = events_queue;
@@ -569,7 +560,6 @@ void PIObject::callQueuedEvents() {
if (e.dest_o->thread_safe_) e.dest_o->mutex_.unlock(); if (e.dest_o->thread_safe_) e.dest_o->mutex_.unlock();
} }
} }
#endif // PIP_HAS_THREADS
//! \details //! \details
@@ -734,8 +724,7 @@ void PIObject::dump(const PIString & line_prefix) const {
PICout(PICoutManipulators::AddNewLine) << line_prefix << " " << src << " -> " << dst->className() << " (" << c.dest PICout(PICoutManipulators::AddNewLine) << line_prefix << " " << src << " -> " << dst->className() << " (" << c.dest
<< ", \"" << dst->name() << "\")::" << hf_fn; << ", \"" << dst->name() << "\")::" << hf_fn;
} else { } else {
PICout(PICoutManipulators::AddNewLine) << line_prefix << " " << src << " -> " PICout(PICoutManipulators::AddNewLine) << line_prefix << " " << src << " -> " << "[lambda]";
<< "[lambda]";
} }
} }
// printf("dump %d connections ok\n",connections.size()); // printf("dump %d connections ok\n",connections.size());
-29
View File
@@ -461,9 +461,7 @@ public:
i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender)); i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender));
} else { } else {
bool ts = sender->thread_safe_; bool ts = sender->thread_safe_;
#ifdef PIP_HAS_THREADS
if (ts) i.dest_o->mutex_.lock(); if (ts) i.dest_o->mutex_.lock();
#endif
i.dest_o->eventBegin(); i.dest_o->eventBegin();
sender->eventBegin(); sender->eventBegin();
i.dest_o->emitter_ = sender; i.dest_o->emitter_ = sender;
@@ -471,9 +469,7 @@ public:
sender->eventEnd(); sender->eventEnd();
if (i.dest_o->isPIObject()) { if (i.dest_o->isPIObject()) {
i.dest_o->emitter_ = 0; i.dest_o->emitter_ = 0;
#ifdef PIP_HAS_THREADS
if (ts) i.dest_o->mutex_.unlock(); if (ts) i.dest_o->mutex_.unlock();
#endif
i.dest_o->eventEnd(); i.dest_o->eventEnd();
} }
} }
@@ -498,9 +494,7 @@ public:
i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender, vl)); i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender, vl));
} else { } else {
bool ts = sender->thread_safe_; bool ts = sender->thread_safe_;
#ifdef PIP_HAS_THREADS
if (ts) i.dest_o->mutex_.lock(); if (ts) i.dest_o->mutex_.lock();
#endif
i.dest_o->eventBegin(); i.dest_o->eventBegin();
sender->eventBegin(); sender->eventBegin();
i.dest_o->emitter_ = sender; i.dest_o->emitter_ = sender;
@@ -511,9 +505,7 @@ public:
sender->eventEnd(); sender->eventEnd();
if (i.dest_o->isPIObject()) { if (i.dest_o->isPIObject()) {
i.dest_o->emitter_ = 0; i.dest_o->emitter_ = 0;
#ifdef PIP_HAS_THREADS
if (ts) i.dest_o->mutex_.unlock(); if (ts) i.dest_o->mutex_.unlock();
#endif
i.dest_o->eventEnd(); i.dest_o->eventEnd();
} }
} }
@@ -538,9 +530,7 @@ public:
i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender, vl)); i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender, vl));
} else { } else {
bool ts = sender->thread_safe_; bool ts = sender->thread_safe_;
#ifdef PIP_HAS_THREADS
if (ts) i.dest_o->mutex_.lock(); if (ts) i.dest_o->mutex_.lock();
#endif
i.dest_o->eventBegin(); i.dest_o->eventBegin();
sender->eventBegin(); sender->eventBegin();
i.dest_o->emitter_ = sender; i.dest_o->emitter_ = sender;
@@ -552,9 +542,7 @@ public:
sender->eventEnd(); sender->eventEnd();
if (i.dest_o->isPIObject()) { if (i.dest_o->isPIObject()) {
i.dest_o->emitter_ = 0; i.dest_o->emitter_ = 0;
#ifdef PIP_HAS_THREADS
if (ts) i.dest_o->mutex_.unlock(); if (ts) i.dest_o->mutex_.unlock();
#endif
i.dest_o->eventEnd(); i.dest_o->eventEnd();
} }
} }
@@ -580,9 +568,7 @@ public:
i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender, vl)); i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender, vl));
} else { } else {
bool ts = sender->thread_safe_; bool ts = sender->thread_safe_;
#ifdef PIP_HAS_THREADS
if (ts) i.dest_o->mutex_.lock(); if (ts) i.dest_o->mutex_.lock();
#endif
i.dest_o->eventBegin(); i.dest_o->eventBegin();
sender->eventBegin(); sender->eventBegin();
i.dest_o->emitter_ = sender; i.dest_o->emitter_ = sender;
@@ -595,9 +581,7 @@ public:
sender->eventEnd(); sender->eventEnd();
if (i.dest_o->isPIObject()) { if (i.dest_o->isPIObject()) {
i.dest_o->emitter_ = 0; i.dest_o->emitter_ = 0;
#ifdef PIP_HAS_THREADS
if (ts) i.dest_o->mutex_.unlock(); if (ts) i.dest_o->mutex_.unlock();
#endif
i.dest_o->eventEnd(); i.dest_o->eventEnd();
} }
} }
@@ -629,9 +613,7 @@ public:
i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender, vl)); i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender, vl));
} else { } else {
bool ts = sender->thread_safe_; bool ts = sender->thread_safe_;
#ifdef PIP_HAS_THREADS
if (ts) i.dest_o->mutex_.lock(); if (ts) i.dest_o->mutex_.lock();
#endif
i.dest_o->eventBegin(); i.dest_o->eventBegin();
sender->eventBegin(); sender->eventBegin();
i.dest_o->emitter_ = sender; i.dest_o->emitter_ = sender;
@@ -645,9 +627,7 @@ public:
sender->eventEnd(); sender->eventEnd();
if (i.dest_o->isPIObject()) { if (i.dest_o->isPIObject()) {
i.dest_o->emitter_ = 0; i.dest_o->emitter_ = 0;
#ifdef PIP_HAS_THREADS
if (ts) i.dest_o->mutex_.unlock(); if (ts) i.dest_o->mutex_.unlock();
#endif
i.dest_o->eventEnd(); i.dest_o->eventEnd();
} }
} }
@@ -658,7 +638,6 @@ public:
//! \~english Returns the first live object with name "name", or \c nullptr. //! \~english Returns the first live object with name "name", or \c nullptr.
//! \~russian Возвращает первый живой объект с именем "name", либо \c nullptr. //! \~russian Возвращает первый живой объект с именем "name", либо \c nullptr.
#ifdef PIP_HAS_THREADS
static PIObject * findByName(const PIString & name) { static PIObject * findByName(const PIString & name) {
PIMutexLocker _ml(mutexObjects()); PIMutexLocker _ml(mutexObjects());
for (auto * i: PIObject::objects()) { for (auto * i: PIObject::objects()) {
@@ -667,7 +646,6 @@ public:
} }
return nullptr; return nullptr;
} }
#endif
//! \~english Returns whether this pointer still refers to a live %PIObject instance. //! \~english Returns whether this pointer still refers to a live %PIObject instance.
//! \~russian Возвращает, указывает ли этот указатель на ещё существующий экземпляр %PIObject. //! \~russian Возвращает, указывает ли этот указатель на ещё существующий экземпляр %PIObject.
@@ -675,7 +653,6 @@ public:
//! \~english Returns whether this object belongs to class "T" or one of its registered descendants. //! \~english Returns whether this object belongs to class "T" or one of its registered descendants.
//! \~russian Возвращает, принадлежит ли этот объект классу "T" или одному из его зарегистрированных потомков. //! \~russian Возвращает, принадлежит ли этот объект классу "T" или одному из его зарегистрированных потомков.
#ifdef PIP_HAS_THREADS
template<typename T> template<typename T>
bool isTypeOf() const { bool isTypeOf() const {
if (!isPIObject()) return false; if (!isPIObject()) return false;
@@ -690,7 +667,6 @@ public:
if (!isTypeOf<T>()) return (T *)nullptr; if (!isTypeOf<T>()) return (T *)nullptr;
return (T *)this; return (T *)this;
} }
#endif
//! \~english Returns whether "o" points to a live %PIObject instance. //! \~english Returns whether "o" points to a live %PIObject instance.
//! \~russian Возвращает, указывает ли "o" на ещё существующий экземпляр %PIObject. //! \~russian Возвращает, указывает ли "o" на ещё существующий экземпляр %PIObject.
@@ -859,13 +835,8 @@ private:
PIObject * emitter_; PIObject * emitter_;
std::atomic_int in_event_cnt; std::atomic_int in_event_cnt;
#ifdef PIP_HAS_THREADS
PIMutex mutex_, mutex_connect, mutex_queue;
bool thread_safe_, proc_event_queue;
#else
PIMutex mutex_, mutex_connect, mutex_queue; PIMutex mutex_, mutex_connect, mutex_queue;
bool thread_safe_ = false, proc_event_queue = false; bool thread_safe_ = false, proc_event_queue = false;
#endif
}; };
#ifdef PIP_HAS_THREADS #ifdef PIP_HAS_THREADS
+1 -9
View File
@@ -20,10 +20,8 @@
#include "pivarianttypes.h" #include "pivarianttypes.h"
#include "colors_p.h" #include "colors_p.h"
#include "pipropertystorage.h"
#ifdef PIP_HAS_FILESYSTEM
#include "piiodevice.h" #include "piiodevice.h"
#endif // PIP_HAS_FILESYSTEM #include "pipropertystorage.h"
int PIVariantTypes::Enum::selectedValue() const { int PIVariantTypes::Enum::selectedValue() const {
@@ -84,11 +82,7 @@ PIStringList PIVariantTypes::Enum::names() const {
PIVariantTypes::IODevice::IODevice() { PIVariantTypes::IODevice::IODevice() {
#ifdef PIP_HAS_FILESYSTEM
mode = PIIODevice::ReadWrite; mode = PIIODevice::ReadWrite;
#else
mode = 0; // TODO: PIIODevice for PIP_HAS_FILESYSTEM
#endif // PIP_HAS_FILESYSTEM
options = 0; options = 0;
} }
@@ -121,12 +115,10 @@ PIString PIVariantTypes::IODevice::toPICout() const {
} }
if (rwc == 1) s += "o"; if (rwc == 1) s += "o";
s += ", flags="; s += ", flags=";
#ifdef PIP_HAS_FILESYSTEM // TODO: PIIODevice for !PIP_HAS_FILESYSTEM
if (options != 0) { if (options != 0) {
if (((PIIODevice::DeviceOptions)options)[PIIODevice::BlockingRead]) s += " br"; if (((PIIODevice::DeviceOptions)options)[PIIODevice::BlockingRead]) s += " br";
if (((PIIODevice::DeviceOptions)options)[PIIODevice::BlockingWrite]) s += " bw"; if (((PIIODevice::DeviceOptions)options)[PIIODevice::BlockingWrite]) s += " bw";
} }
#endif // PIP_HAS_FILESYSTEM
PIPropertyStorage ps = get(); PIPropertyStorage ps = get();
for (const auto & p: ps) { for (const auto & p: ps) {
s += ", " + p.name + "=\"" + p.value.toString() + "\""; s += ", " + p.name + "=\"" + p.value.toString() + "\"";