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
@@ -20,7 +20,7 @@
#include "pinetworkaddress.h"
// clang-format off
#ifndef PIP_NO_SOCKET
#ifdef PIP_HAS_SOCKET
#ifdef QNX
# include <netdb.h>
#else
@@ -34,7 +34,7 @@
# endif
# endif
#endif
#endif // PIP_NO_SOCKET
#endif // PIP_HAS_SOCKET
// clang-format on
@@ -147,7 +147,7 @@ PINetworkAddress PINetworkAddress::resolve(const PIString & host_port) {
PINetworkAddress PINetworkAddress::resolve(const PIString & host, ushort port) {
#ifndef PIP_NO_SOCKET
#ifdef PIP_HAS_SOCKET
PINetworkAddress ret(0, port);
hostent * he = gethostbyname(host.dataAscii());
if (!he) return ret;
@@ -170,7 +170,7 @@ void PINetworkAddress::splitIPPort(const PIString & ipp, PIString * _ip, int * _
void PINetworkAddress::initIP(const PIString & _ip) {
#ifndef PIP_NO_SOCKET
#ifdef PIP_HAS_SOCKET
ip_ = inet_addr(_ip.dataAscii());
#else
(void)_ip;
+1 -1
View File
@@ -56,7 +56,7 @@ void piUSleep(int usecs) {
#elif defined(PICO_SDK)
sleep_us(usecs);
#else
# ifndef PIP_NO_THREADS
# ifdef PIP_HAS_THREADS
usecs -= PISystemTests::usleep_offset_us;
# endif
if (usecs > 0) usleep(usecs);
+7 -7
View File
@@ -21,9 +21,9 @@
#include "colors_p.h"
#include "pipropertystorage.h"
#ifndef PIP_NO_FILESYSTEM
#ifdef PIP_HAS_FILESYSTEM
# include "piiodevice.h"
#endif // PIP_NO_FILESYSTEM
#endif // PIP_HAS_FILESYSTEM
int PIVariantTypes::Enum::selectedValue() const {
@@ -84,11 +84,11 @@ PIStringList PIVariantTypes::Enum::names() const {
PIVariantTypes::IODevice::IODevice() {
#ifndef PIP_NO_FILESYSTEM
#ifdef PIP_HAS_FILESYSTEM
mode = PIIODevice::ReadWrite;
#else
mode = 0; // TODO: PIIODevice for PIP_NO_FILESYSTEM
#endif // PIP_NO_FILESYSTEM
mode = 0; // TODO: PIIODevice for PIP_HAS_FILESYSTEM
#endif // PIP_HAS_FILESYSTEM
options = 0;
}
@@ -121,12 +121,12 @@ PIString PIVariantTypes::IODevice::toPICout() const {
}
if (rwc == 1) s += "o";
s += ", flags=";
#ifndef PIP_NO_FILESYSTEM // TODO: PIIODevice for PIP_NO_FILESYSTEM
#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_NO_FILESYSTEM
#endif // PIP_HAS_FILESYSTEM
PIPropertyStorage ps = get();
for (const auto & p: ps) {
s += ", " + p.name + "=\"" + p.value.toString() + "\"";