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:
@@ -3,7 +3,7 @@
|
||||
#include "piliterals_string.h"
|
||||
#include "piliterals_time.h"
|
||||
|
||||
#ifndef PIP_NO_THREADS
|
||||
#ifdef PIP_HAS_THREADS
|
||||
# ifndef WINDOWS
|
||||
# include "pidir.h"
|
||||
# include "pifile.h"
|
||||
@@ -674,4 +674,4 @@ PIHIDeviceInfo PIHIDevice::findDevice(const PIString & name) {
|
||||
return PIHIDeviceInfo();
|
||||
}
|
||||
|
||||
#endif // PIP_NO_THREADS
|
||||
#endif // PIP_HAS_THREADS
|
||||
|
||||
@@ -169,7 +169,7 @@ PIP_EXPORT PICout operator<<(PICout s, const PIHIDeviceInfo & v);
|
||||
//! \~english Provides access to HID (Human Interface Device) devices such as game controllers, joysticks, and other input devices.
|
||||
//! \~russian Предоставляет доступ к HID (Human Interface Device) устройствам, таким как геймконтроллеры, джойстики и другие устройства
|
||||
//! ввода.
|
||||
#ifndef PIP_NO_THREADS
|
||||
#ifdef PIP_HAS_THREADS
|
||||
class PIP_EXPORT PIHIDevice: public PIThread {
|
||||
PIOBJECT_SUBCLASS(PIHIDevice, PIThread)
|
||||
|
||||
@@ -271,7 +271,7 @@ private:
|
||||
PIMap<int, int> prev_buttons, cur_buttons;
|
||||
float dead_zone = 0.f;
|
||||
};
|
||||
#endif // PIP_NO_THREADS
|
||||
#endif // PIP_HAS_THREADS
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PIP_NO_DYNLIB
|
||||
#ifdef PIP_HAS_DYNLIB
|
||||
|
||||
# include "pilibrary.h"
|
||||
|
||||
@@ -233,4 +233,4 @@ void PILibrary::getLastError() {
|
||||
# endif
|
||||
}
|
||||
|
||||
#endif // PIP_NO_DYNLIB
|
||||
#endif // PIP_HAS_DYNLIB
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#ifndef PILIBRARY_H
|
||||
#define PILIBRARY_H
|
||||
|
||||
#ifndef PIP_NO_DYNLIB
|
||||
#ifdef PIP_HAS_DYNLIB
|
||||
|
||||
# include "pistring.h"
|
||||
|
||||
@@ -82,5 +82,5 @@ private:
|
||||
PIString libpath, liberror;
|
||||
};
|
||||
|
||||
#endif // PIP_NO_DYNLIB
|
||||
#endif // PIP_HAS_DYNLIB
|
||||
#endif // PILIBRARY_H
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PIP_NO_DYNLIB
|
||||
#ifdef PIP_HAS_DYNLIB
|
||||
|
||||
# include "piplugin.h"
|
||||
|
||||
@@ -493,4 +493,4 @@ PIString PIPluginLoader::libExtension() {
|
||||
}
|
||||
|
||||
|
||||
#endif // PIP_NO_DYNLIB
|
||||
#endif // PIP_HAS_DYNLIB
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#ifndef PIPLUGIN_H
|
||||
#define PIPLUGIN_H
|
||||
|
||||
#ifndef PIP_NO_DYNLIB
|
||||
#ifdef PIP_HAS_DYNLIB
|
||||
|
||||
# include "pilibrary.h"
|
||||
# include "pistringlist.h"
|
||||
@@ -298,5 +298,5 @@ private:
|
||||
};
|
||||
|
||||
|
||||
#endif // PIP_NO_DYNLIB
|
||||
#endif // PIP_HAS_DYNLIB
|
||||
#endif // PIPLUGIN_H
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "pitime.h"
|
||||
#ifndef PIP_NO_PROCESS
|
||||
#ifdef PIP_HAS_PROCESS
|
||||
|
||||
# include "piincludes_p.h"
|
||||
# include "piliterals_bytes.h"
|
||||
@@ -516,4 +516,4 @@ PIString PIProcess::getEnvironmentVariable(const PIString & variable) {
|
||||
return PIString();
|
||||
}
|
||||
|
||||
#endif // PIP_NO_PROCESS
|
||||
#endif // PIP_HAS_PROCESS
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#ifndef PIPROCESS_H
|
||||
#define PIPROCESS_H
|
||||
|
||||
#ifndef PIP_NO_PROCESS
|
||||
#ifdef PIP_HAS_PROCESS
|
||||
|
||||
# include "pithread.h"
|
||||
|
||||
@@ -258,5 +258,5 @@ private:
|
||||
std::atomic_bool exec_finished;
|
||||
};
|
||||
|
||||
#endif // PIP_NO_PROCESS
|
||||
#endif // PIP_HAS_PROCESS
|
||||
#endif // PIPROCESS_H
|
||||
|
||||
@@ -207,7 +207,7 @@ PIVector<PISystemInfo::MountInfo> PISystemInfo::mountInfo(bool ignore_cache) {
|
||||
PIString confDir() {
|
||||
return
|
||||
#ifdef WINDOWS
|
||||
# ifndef PIP_NO_FILESYSTEM
|
||||
# ifdef PIP_HAS_FILESYSTEM
|
||||
PIDir::home().path() + "/AppData/Local"
|
||||
# else
|
||||
""
|
||||
@@ -215,7 +215,7 @@ PIString confDir() {
|
||||
#elif defined(ANDROID)
|
||||
""
|
||||
#else
|
||||
# ifndef PIP_NO_FILESYSTEM
|
||||
# ifdef PIP_HAS_FILESYSTEM
|
||||
PIDir::home().path() + "/.config"
|
||||
# else
|
||||
""
|
||||
@@ -242,7 +242,7 @@ PIString PISystemInfo::machineKey() {
|
||||
PISystemInfo * si = instance();
|
||||
PIByteArray salt;
|
||||
PIString conf = confDir() + "/.pip_machine_salt";
|
||||
#ifndef PIP_NO_FILESYSTEM
|
||||
#ifdef PIP_HAS_FILESYSTEM
|
||||
if (PIFile::isExists(conf)) salt = PIFile::readAll(conf);
|
||||
if (salt.size_s() != SALT_SIZE) {
|
||||
salt = generateSalt();
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
|
||||
#include "pisystemtests.h"
|
||||
|
||||
#ifndef PIP_NO_FILESYSTEM
|
||||
#ifdef PIP_HAS_FILESYSTEM
|
||||
# include "piconfig.h"
|
||||
#endif // !PIP_NO_FILESYSTEM
|
||||
#endif // PIP_HAS_FILESYSTEM
|
||||
|
||||
|
||||
namespace PISystemTests {
|
||||
@@ -35,10 +35,10 @@ PISystemTestReader pisystestreader;
|
||||
|
||||
|
||||
PISystemTests::PISystemTestReader::PISystemTestReader() {
|
||||
#if !defined(WINDOWS) && !defined(PIP_NO_FILESYSTEM)
|
||||
#if !defined(WINDOWS) && defined(PIP_HAS_FILESYSTEM)
|
||||
PIConfig conf(PIStringAscii("/etc/pip.conf"), PIIODevice::ReadOnly);
|
||||
time_resolution_ns = conf.getValue(PIStringAscii("time_resolution_ns"), 1).toLong();
|
||||
time_elapsed_ns = conf.getValue(PIStringAscii("time_elapsed_ns"), 0).toLong();
|
||||
usleep_offset_us = conf.getValue(PIStringAscii("usleep_offset_us"), 60).toLong();
|
||||
#endif // !WINDOWS && !PIP_NO_FILESYSTEM
|
||||
#endif // !WINDOWS && PIP_HAS_FILESYSTEM
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user