From e2c0445c1bb8b13a05d647d8b0db517e855eb411 Mon Sep 17 00:00:00 2001 From: Andrey Bychkov Date: Wed, 12 Aug 2026 14:04:49 +0300 Subject: [PATCH] remove some unused defines --- CMakeLists.txt | 2 + libs/console/piscreen.cpp | 105 ++++++++++++++--------------- libs/console/piscreendrawer.cpp | 4 +- libs/console/piscreentile.cpp | 4 +- libs/console/piscreentiles.cpp | 4 +- libs/console/piterminal.cpp | 4 +- libs/main/console/piscreen.h | 4 +- libs/main/console/piscreendrawer.h | 4 +- libs/main/console/piscreentile.h | 4 +- libs/main/console/piscreentiles.h | 4 +- libs/main/console/piscreentypes.h | 4 +- libs/main/console/piterminal.h | 4 +- libs/main/core/piobject.cpp | 17 +---- libs/main/core/piobject.h | 29 -------- libs/main/types/pivarianttypes.cpp | 12 +--- 15 files changed, 77 insertions(+), 128 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a09a2fe..374aa62b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -243,6 +243,7 @@ if(DEFINED PICO_BOARD) set(PIP_HAS_DYNLIB OFF CACHE BOOL "" FORCE) set(PIP_HAS_FFT 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}") endif() @@ -257,6 +258,7 @@ if(PIP_FREERTOS) set(PIP_HAS_DYNLIB OFF CACHE BOOL "" FORCE) set(PIP_HAS_FFT OFF CACHE BOOL "" FORCE) set(PIP_HAS_SERIAL OFF CACHE BOOL "" FORCE) + set(PIP_BUILD_CONSOLE OFF CACHE BOOL "" FORCE) endif() if(DEFINED ANDROID_PLATFORM) diff --git a/libs/console/piscreen.cpp b/libs/console/piscreen.cpp index 56f4a6e7..ee298093 100644 --- a/libs/console/piscreen.cpp +++ b/libs/console/piscreen.cpp @@ -22,11 +22,9 @@ #include "piliterals_time.h" // clang-format off #ifndef WINDOWS -#ifndef PICO_SDK # include # include # include -#endif // PICO_SDK #else # include # include @@ -37,12 +35,11 @@ // clang-format on -#if !defined(PICO_SDK) using namespace PIScreenTypes; PRIVATE_DEFINITION_START(PIScreen::SystemConsole) -# ifdef WINDOWS +#ifdef WINDOWS void * hOut; CONSOLE_SCREEN_BUFFER_INFO sbi, csbi; CONSOLE_CURSOR_INFO curinfo; @@ -51,7 +48,7 @@ PRIVATE_DEFINITION_START(PIScreen::SystemConsole) WORD dattr; DWORD smode, written; PIVector chars; -# endif +#endif PRIVATE_DEFINITION_END(PIScreen::SystemConsole) @@ -62,16 +59,16 @@ PIScreen::SystemConsole::SystemConsole() { PIScreen::SystemConsole::~SystemConsole() { -# ifdef WINDOWS +#ifdef WINDOWS SetConsoleMode(PRIVATE->hOut, PRIVATE->smode); SetConsoleTextAttribute(PRIVATE->hOut, PRIVATE->dattr); -# endif +#endif } void PIScreen::SystemConsole::begin() { int w, h; -# ifdef WINDOWS +#ifdef WINDOWS PRIVATE->ulcoord.X = 0; PRIVATE->hOut = GetStdHandle(STD_OUTPUT_HANDLE); GetConsoleScreenBufferInfo(PRIVATE->hOut, &PRIVATE->sbi); @@ -81,24 +78,24 @@ void PIScreen::SystemConsole::begin() { PRIVATE->ulcoord.Y = PRIVATE->sbi.srWindow.Top; GetConsoleMode(PRIVATE->hOut, &PRIVATE->smode); GetConsoleCursorInfo(PRIVATE->hOut, &PRIVATE->curinfo); -# else -# ifdef PIP_EMBEDDED +#else +# ifdef PIP_EMBEDDED w = 80; h = 24; -# else +# else winsize ws; ioctl(0, TIOCGWINSZ, &ws); w = ws.ws_col; h = ws.ws_row; -# endif # endif +#endif resize(w, h); -# ifdef WINDOWS +#ifdef WINDOWS SetConsoleMode(PRIVATE->hOut, ENABLE_WRAP_AT_EOL_OUTPUT); GetConsoleScreenBufferInfo(PRIVATE->hOut, &PRIVATE->sbi); PRIVATE->bc.X = 0; PRIVATE->bc.Y = 0; -# endif +#endif clear(); clearScreen(); hideCursor(); @@ -106,11 +103,11 @@ void PIScreen::SystemConsole::begin() { void PIScreen::SystemConsole::end() { -# ifdef WINDOWS +#ifdef WINDOWS SetConsoleTextAttribute(PRIVATE->hOut, PRIVATE->dattr); -# else +#else printf("\e[0m"); -# endif +#endif moveTo(0, height); showCursor(); } @@ -118,18 +115,18 @@ void PIScreen::SystemConsole::end() { void PIScreen::SystemConsole::prepare() { int w = 80, h = 24; -# ifdef WINDOWS +#ifdef WINDOWS GetConsoleScreenBufferInfo(PRIVATE->hOut, &PRIVATE->csbi); w = PRIVATE->csbi.srWindow.Right - PRIVATE->csbi.srWindow.Left + 1; h = PRIVATE->csbi.srWindow.Bottom - PRIVATE->csbi.srWindow.Top + 1; -# else -# ifndef PIP_EMBEDDED +#else +# ifndef PIP_EMBEDDED winsize ws; ioctl(0, TIOCGWINSZ, &ws); w = ws.ws_col; h = ws.ws_row; -# endif # endif +#endif resize(w, h); } @@ -152,10 +149,10 @@ void PIScreen::SystemConsole::resize(int w, int h) { cells[i].resize(width); pcells[i].resize(width, Cell(PIChar())); } -# ifdef WINDOWS +#ifdef WINDOWS PRIVATE->sbi.srWindow = PRIVATE->csbi.srWindow; PRIVATE->chars.resize(width * height); -# endif +#endif for (int i = 0; i < pcells.size_s(); ++i) pcells[i].fill(Cell()); clear(); @@ -167,7 +164,7 @@ void PIScreen::SystemConsole::print() { if (mouse_x >= 0 && mouse_x < width && mouse_y >= 0 && mouse_y < height) { /// cells[mouse_y][mouse_x].format.flags ^= Inverse; } -# ifdef WINDOWS +#ifdef WINDOWS PRIVATE->srect = PRIVATE->sbi.srWindow; int dx0 = -1, dx1 = -1, dy0 = -1, dy1 = -1; for (int j = 0; j < height; ++j) { @@ -204,7 +201,7 @@ void PIScreen::SystemConsole::print() { PRIVATE->srect.Right -= width - dx1 - 1; PRIVATE->srect.Bottom -= height - dy1 - 1; WriteConsoleOutputW(PRIVATE->hOut, PRIVATE->chars.data(), PRIVATE->bs, PRIVATE->bc, &PRIVATE->srect); -# else +#else PIString s; int si = 0, sj = 0; CellFormat prf(0xFFFF); @@ -241,14 +238,14 @@ void PIScreen::SystemConsole::print() { } printf("\e[0m"); fflush(0); -# endif +#endif pcells = cells; } -# ifdef WINDOWS -# define FOREGROUND_MASK (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE) -# define BACKGROUND_MASK (BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE) +#ifdef WINDOWS +# define FOREGROUND_MASK (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE) +# define BACKGROUND_MASK (BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE) ushort PIScreen::SystemConsole::attributes(const PIScreenTypes::Cell & c) { WORD attr = PRIVATE->dattr; if (c.format.flags & Bold) @@ -287,8 +284,8 @@ ushort PIScreen::SystemConsole::attributes(const PIScreenTypes::Cell & c) { } return attr; } -# undef FOREGROUND_MASK -# undef BACKGROUND_MASK +# undef FOREGROUND_MASK +# undef BACKGROUND_MASK void PIScreen::SystemConsole::getWinCurCoord() { GetConsoleScreenBufferInfo(PRIVATE->hOut, &PRIVATE->csbi); @@ -307,7 +304,7 @@ void PIScreen::SystemConsole::newLine() { PRIVATE->ccoord.Y++; SetConsoleCursorPosition(PRIVATE->hOut, PRIVATE->ccoord); } -# else // WINDOWS +#else // WINDOWS PIString PIScreen::SystemConsole::formatString(const PIScreenTypes::Cell & c) { PIString ts = PIStringAscii("\e[0"); switch (c.format.color_char) { @@ -336,39 +333,39 @@ PIString PIScreen::SystemConsole::formatString(const PIScreenTypes::Cell & c) { if ((c.format.flags & Inverse) == Inverse) ts += PIStringAscii(";7"); return ts + 'm'; } -# endif // WINDOWS +#endif // WINDOWS void PIScreen::SystemConsole::toUpperLeft() { -# ifdef WINDOWS +#ifdef WINDOWS SetConsoleCursorPosition(PRIVATE->hOut, PRIVATE->ulcoord); -# else +#else printf("\e[H"); -# endif +#endif } void PIScreen::SystemConsole::moveTo(int x, int y) { -# ifdef WINDOWS +#ifdef WINDOWS PRIVATE->ccoord.X = x; PRIVATE->ccoord.Y = PRIVATE->ulcoord.Y + y; SetConsoleCursorPosition(PRIVATE->hOut, PRIVATE->ccoord); -# else +#else printf("\e[%d;%dH", y + 1, x + 1); -# endif +#endif } void PIScreen::SystemConsole::clearScreen() { -# ifdef WINDOWS +#ifdef WINDOWS toUpperLeft(); FillConsoleOutputAttribute(PRIVATE->hOut, PRIVATE->dattr, width * (height + 1), PRIVATE->ulcoord, &PRIVATE->written); FillConsoleOutputCharacter(PRIVATE->hOut, ' ', width * (height + 1), PRIVATE->ulcoord, &PRIVATE->written); -# else +#else printf("\e[0m\e[H\e[J"); -# endif +#endif } void PIScreen::SystemConsole::clearScreenLower() { -# ifdef WINDOWS +#ifdef WINDOWS getWinCurCoord(); FillConsoleOutputAttribute(PRIVATE->hOut, PRIVATE->dattr, @@ -380,27 +377,27 @@ void PIScreen::SystemConsole::clearScreenLower() { width * height - width * PRIVATE->ccoord.Y + PRIVATE->ccoord.X, PRIVATE->ccoord, &PRIVATE->written); -# else +#else printf("\e[0m\e[J"); -# endif +#endif } void PIScreen::SystemConsole::hideCursor() { -# ifdef WINDOWS +#ifdef WINDOWS PRIVATE->curinfo.bVisible = false; SetConsoleCursorInfo(PRIVATE->hOut, &PRIVATE->curinfo); -# else +#else printf("\e[?25l"); -# endif +#endif } void PIScreen::SystemConsole::showCursor() { -# ifdef WINDOWS +#ifdef WINDOWS PRIVATE->curinfo.bVisible = true; SetConsoleCursorInfo(PRIVATE->hOut, &PRIVATE->curinfo); -# else +#else printf("\e[?25h"); -# endif +#endif } @@ -605,9 +602,9 @@ void PIScreen::start(bool wait) { void PIScreen::stop(bool clear) { PIThread::stopAndWait(); if (clear) console.clearScreen(); -# ifndef WINDOWS +#ifndef WINDOWS fflush(0); -# endif +#endif } @@ -660,5 +657,3 @@ PIScreenTile * PIScreen::tileByName(const PIString & name) { if (t->name() == name) return t; return 0; } - -#endif // !PICO_SDK diff --git a/libs/console/piscreendrawer.cpp b/libs/console/piscreendrawer.cpp index 26655a51..43ed6a40 100644 --- a/libs/console/piscreendrawer.cpp +++ b/libs/console/piscreendrawer.cpp @@ -19,7 +19,7 @@ #include "piscreendrawer.h" -#if !defined(PICO_SDK) + // comment for use ascii instead of unicode symbols # define USE_UNICODE @@ -267,4 +267,4 @@ void PIScreenDrawer::drawText(int x, int y, const PIString & s, Color col_char, } } -#endif // !PICO_SDK + diff --git a/libs/console/piscreentile.cpp b/libs/console/piscreentile.cpp index 67eb8eff..f5221b52 100644 --- a/libs/console/piscreentile.cpp +++ b/libs/console/piscreentile.cpp @@ -21,7 +21,7 @@ #include "piscreendrawer.h" -#if !defined(PICO_SDK) + using namespace PIScreenTypes; @@ -258,4 +258,4 @@ void PIScreenTile::layout() { } } -#endif // !PICO_SDK + diff --git a/libs/console/piscreentiles.cpp b/libs/console/piscreentiles.cpp index 2c11655d..36d42443 100644 --- a/libs/console/piscreentiles.cpp +++ b/libs/console/piscreentiles.cpp @@ -21,7 +21,7 @@ #include "piscreendrawer.h" -#if !defined(PICO_SDK) + using namespace PIScreenTypes; @@ -695,4 +695,4 @@ void TileInput::reserCursor() { inv = false; } -#endif // !PICO_SDK + diff --git a/libs/console/piterminal.cpp b/libs/console/piterminal.cpp index f7c51bf8..c767f708 100644 --- a/libs/console/piterminal.cpp +++ b/libs/console/piterminal.cpp @@ -22,7 +22,7 @@ #include "piliterals_time.h" #include "pisharedmemory.h" -#if !defined(PICO_SDK) + #ifdef PIP_HAS_PROCESS # ifdef WINDOWS # include @@ -981,4 +981,4 @@ bool PITerminal::resize(int cols, int rows) { #endif // PIP_HAS_PROCESS -#endif // !PICO_SDK + diff --git a/libs/main/console/piscreen.h b/libs/main/console/piscreen.h index db769155..5c84b463 100644 --- a/libs/main/console/piscreen.h +++ b/libs/main/console/piscreen.h @@ -34,7 +34,7 @@ //! \~\brief //! \~english Console screen manager with tile layout, drawing, and input routing. //! \~russian Менеджер консольного экрана с раскладкой тайлов, отрисовкой и маршрутизацией ввода. -#if !defined(PICO_SDK) + class PIP_CONSOLE_EXPORT PIScreen : public PIThread , public PIScreenTypes::PIScreenBase { @@ -215,6 +215,6 @@ private: PIScreenTile root; PIScreenTile *tile_focus, *tile_dialog; }; -#endif // !PICO_SDK + #endif // PISCREEN_H diff --git a/libs/main/console/piscreendrawer.h b/libs/main/console/piscreendrawer.h index 4029dc5f..ce607b8a 100644 --- a/libs/main/console/piscreendrawer.h +++ b/libs/main/console/piscreendrawer.h @@ -24,7 +24,7 @@ #ifndef PISCREENDRAWER_H #define PISCREENDRAWER_H -#if !defined(PICO_SDK) + #include "pip_console_export.h" #include "piscreentypes.h" @@ -147,5 +147,5 @@ private: }; -#endif // !PICO_SDK + #endif // PISCREENDRAWER_H diff --git a/libs/main/console/piscreentile.h b/libs/main/console/piscreentile.h index 7e7008e1..c28f59a2 100644 --- a/libs/main/console/piscreentile.h +++ b/libs/main/console/piscreentile.h @@ -38,7 +38,7 @@ class PIScreenDrawer; //! \details //! \~english Base class for all screen tiles providing layout and event handling. //! \~russian Базовый класс для всех экранных тайлов, обеспечивающий компоновку и обработку событий. -#if !defined(PICO_SDK) + class PIP_CONSOLE_EXPORT PIScreenTile: public PIObject { friend class PIScreen; PIOBJECT_SUBCLASS(PIScreenTile, PIObject); @@ -238,6 +238,6 @@ protected: private: int pw, ph; }; -#endif // !PICO_SDK + #endif // PISCREENTILE_H diff --git a/libs/main/console/piscreentiles.h b/libs/main/console/piscreentiles.h index 8f1fbcb7..21672030 100644 --- a/libs/main/console/piscreentiles.h +++ b/libs/main/console/piscreentiles.h @@ -27,7 +27,7 @@ #ifndef PISCREENTILES_H #define PISCREENTILES_H -#if !defined(PICO_SDK) + #include "pip_console_export.h" #include "piscreentile.h" @@ -445,5 +445,5 @@ protected: }; -#endif // !PICO_SDK + #endif // PISCREENTILES_H diff --git a/libs/main/console/piscreentypes.h b/libs/main/console/piscreentypes.h index 8e32d479..e27feb85 100644 --- a/libs/main/console/piscreentypes.h +++ b/libs/main/console/piscreentypes.h @@ -27,7 +27,7 @@ #ifndef PISCREENTYPES_H #define PISCREENTYPES_H -#if !defined(PICO_SDK) + #include "pip_console_export.h" #include "pivariant.h" @@ -285,5 +285,5 @@ BINARY_STREAM_READ(PIScreenTypes::TileEvent) { REGISTER_PIVARIANTSIMPLE(PIScreenTypes::TileEvent) -#endif // !PICO_SDK + #endif // PISCREENTYPES_H diff --git a/libs/main/console/piterminal.h b/libs/main/console/piterminal.h index a91a779c..7fcb3aac 100644 --- a/libs/main/console/piterminal.h +++ b/libs/main/console/piterminal.h @@ -24,7 +24,7 @@ #ifndef PITERMINAL_H #define PITERMINAL_H -#if !defined(PICO_SDK) + #include "pikbdlistener.h" #include "pip_console_export.h" @@ -115,5 +115,5 @@ private: }; -#endif // !PICO_SDK + #endif // PITERMINAL_H diff --git a/libs/main/core/piobject.cpp b/libs/main/core/piobject.cpp index 1ef2d0c7..9ba33d2c 100644 --- a/libs/main/core/piobject.cpp +++ b/libs/main/core/piobject.cpp @@ -19,13 +19,13 @@ #include "piobject.h" -#include "piconditionvar.h" -#include "pithread.h" #include "pitime.h" #ifdef PIP_HAS_THREADS +# include "piconditionvar.h" # include "pifile.h" # include "piiostream.h" # include "pisysteminfo.h" +# include "pithread.h" #endif @@ -176,13 +176,9 @@ PIObject::PIObject(const PIString & name): _signature_(__PIOBJECT_SIGNATURE__), in_event_cnt = 0; setName(name); setDebug(true); -#ifdef PIP_HAS_THREADS mutexObjects().lock(); -#endif objects() << this; -#ifdef PIP_HAS_THREADS mutexObjects().unlock(); -#endif // piCout << "new" << this; } @@ -190,13 +186,9 @@ PIObject::PIObject(const PIString & name): _signature_(__PIOBJECT_SIGNATURE__), PIObject::~PIObject() { in_event_cnt = 0; // piCout << "delete" << this; -#ifdef PIP_HAS_THREADS mutexObjects().lock(); -#endif objects().removeAll(this); -#ifdef PIP_HAS_THREADS mutexObjects().unlock(); -#endif deleted(this); piDisconnectAll(); _signature_ = 0; @@ -555,7 +547,6 @@ PIMap & PIObject::__meta_data() { } -#ifdef PIP_HAS_THREADS void PIObject::callQueuedEvents() { mutex_queue.lock(); PIVector<__QueuedEvent> qe = events_queue; @@ -569,7 +560,6 @@ void PIObject::callQueuedEvents() { if (e.dest_o->thread_safe_) e.dest_o->mutex_.unlock(); } } -#endif // PIP_HAS_THREADS //! \details @@ -734,8 +724,7 @@ void PIObject::dump(const PIString & line_prefix) const { PICout(PICoutManipulators::AddNewLine) << line_prefix << " " << src << " -> " << dst->className() << " (" << c.dest << ", \"" << dst->name() << "\")::" << hf_fn; } else { - PICout(PICoutManipulators::AddNewLine) << line_prefix << " " << src << " -> " - << "[lambda]"; + PICout(PICoutManipulators::AddNewLine) << line_prefix << " " << src << " -> " << "[lambda]"; } } // printf("dump %d connections ok\n",connections.size()); diff --git a/libs/main/core/piobject.h b/libs/main/core/piobject.h index 164d06d8..efdd5d47 100644 --- a/libs/main/core/piobject.h +++ b/libs/main/core/piobject.h @@ -461,9 +461,7 @@ public: i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender)); } else { bool ts = sender->thread_safe_; -#ifdef PIP_HAS_THREADS if (ts) i.dest_o->mutex_.lock(); -#endif i.dest_o->eventBegin(); sender->eventBegin(); i.dest_o->emitter_ = sender; @@ -471,9 +469,7 @@ public: sender->eventEnd(); if (i.dest_o->isPIObject()) { i.dest_o->emitter_ = 0; -#ifdef PIP_HAS_THREADS if (ts) i.dest_o->mutex_.unlock(); -#endif i.dest_o->eventEnd(); } } @@ -498,9 +494,7 @@ public: i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender, vl)); } else { bool ts = sender->thread_safe_; -#ifdef PIP_HAS_THREADS if (ts) i.dest_o->mutex_.lock(); -#endif i.dest_o->eventBegin(); sender->eventBegin(); i.dest_o->emitter_ = sender; @@ -511,9 +505,7 @@ public: sender->eventEnd(); if (i.dest_o->isPIObject()) { i.dest_o->emitter_ = 0; -#ifdef PIP_HAS_THREADS if (ts) i.dest_o->mutex_.unlock(); -#endif i.dest_o->eventEnd(); } } @@ -538,9 +530,7 @@ public: i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender, vl)); } else { bool ts = sender->thread_safe_; -#ifdef PIP_HAS_THREADS if (ts) i.dest_o->mutex_.lock(); -#endif i.dest_o->eventBegin(); sender->eventBegin(); i.dest_o->emitter_ = sender; @@ -552,9 +542,7 @@ public: sender->eventEnd(); if (i.dest_o->isPIObject()) { i.dest_o->emitter_ = 0; -#ifdef PIP_HAS_THREADS if (ts) i.dest_o->mutex_.unlock(); -#endif i.dest_o->eventEnd(); } } @@ -580,9 +568,7 @@ public: i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender, vl)); } else { bool ts = sender->thread_safe_; -#ifdef PIP_HAS_THREADS if (ts) i.dest_o->mutex_.lock(); -#endif i.dest_o->eventBegin(); sender->eventBegin(); i.dest_o->emitter_ = sender; @@ -595,9 +581,7 @@ public: sender->eventEnd(); if (i.dest_o->isPIObject()) { i.dest_o->emitter_ = 0; -#ifdef PIP_HAS_THREADS if (ts) i.dest_o->mutex_.unlock(); -#endif i.dest_o->eventEnd(); } } @@ -629,9 +613,7 @@ public: i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender, vl)); } else { bool ts = sender->thread_safe_; -#ifdef PIP_HAS_THREADS if (ts) i.dest_o->mutex_.lock(); -#endif i.dest_o->eventBegin(); sender->eventBegin(); i.dest_o->emitter_ = sender; @@ -645,9 +627,7 @@ public: sender->eventEnd(); if (i.dest_o->isPIObject()) { i.dest_o->emitter_ = 0; -#ifdef PIP_HAS_THREADS if (ts) i.dest_o->mutex_.unlock(); -#endif i.dest_o->eventEnd(); } } @@ -658,7 +638,6 @@ public: //! \~english Returns the first live object with name "name", or \c nullptr. //! \~russian Возвращает первый живой объект с именем "name", либо \c nullptr. -#ifdef PIP_HAS_THREADS static PIObject * findByName(const PIString & name) { PIMutexLocker _ml(mutexObjects()); for (auto * i: PIObject::objects()) { @@ -667,7 +646,6 @@ public: } return nullptr; } -#endif //! \~english Returns whether this pointer still refers to a live %PIObject instance. //! \~russian Возвращает, указывает ли этот указатель на ещё существующий экземпляр %PIObject. @@ -675,7 +653,6 @@ public: //! \~english Returns whether this object belongs to class "T" or one of its registered descendants. //! \~russian Возвращает, принадлежит ли этот объект классу "T" или одному из его зарегистрированных потомков. -#ifdef PIP_HAS_THREADS template bool isTypeOf() const { if (!isPIObject()) return false; @@ -690,7 +667,6 @@ public: if (!isTypeOf()) return (T *)nullptr; return (T *)this; } -#endif //! \~english Returns whether "o" points to a live %PIObject instance. //! \~russian Возвращает, указывает ли "o" на ещё существующий экземпляр %PIObject. @@ -859,13 +835,8 @@ private: PIObject * emitter_; 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; bool thread_safe_ = false, proc_event_queue = false; -#endif }; #ifdef PIP_HAS_THREADS diff --git a/libs/main/types/pivarianttypes.cpp b/libs/main/types/pivarianttypes.cpp index a69ddb94..212e118f 100644 --- a/libs/main/types/pivarianttypes.cpp +++ b/libs/main/types/pivarianttypes.cpp @@ -20,10 +20,8 @@ #include "pivarianttypes.h" #include "colors_p.h" +#include "piiodevice.h" #include "pipropertystorage.h" -#ifdef PIP_HAS_FILESYSTEM -# include "piiodevice.h" -#endif // PIP_HAS_FILESYSTEM int PIVariantTypes::Enum::selectedValue() const { @@ -84,11 +82,7 @@ PIStringList PIVariantTypes::Enum::names() const { PIVariantTypes::IODevice::IODevice() { -#ifdef PIP_HAS_FILESYSTEM - mode = PIIODevice::ReadWrite; -#else - mode = 0; // TODO: PIIODevice for PIP_HAS_FILESYSTEM -#endif // PIP_HAS_FILESYSTEM + mode = PIIODevice::ReadWrite; options = 0; } @@ -121,12 +115,10 @@ PIString PIVariantTypes::IODevice::toPICout() const { } if (rwc == 1) s += "o"; s += ", flags="; -#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_HAS_FILESYSTEM PIPropertyStorage ps = get(); for (const auto & p: ps) { s += ", " + p.name + "=\"" + p.value.toString() + "\"";