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:
@@ -24,7 +24,7 @@
|
||||
#include "piliterals_time.h"
|
||||
#include "pipropertystorage.h"
|
||||
|
||||
#ifndef PIP_NO_FILESYSTEM
|
||||
#ifdef PIP_HAS_FILESYSTEM
|
||||
# include "pitime.h"
|
||||
# include "pitranslator.h"
|
||||
|
||||
@@ -60,11 +60,11 @@ static const uchar binlog_sig[] = {'B', 'I', 'N', 'L', 'O', 'G'};
|
||||
REGISTER_DEVICE(PIBinaryLog)
|
||||
|
||||
PIBinaryLog::PIBinaryLog() {
|
||||
# ifdef PIP_NO_THREADS
|
||||
# ifndef PIP_HAS_THREADS
|
||||
setThreadedReadBufferSize(512);
|
||||
# else
|
||||
setThreadedReadBufferSize(64_KiB);
|
||||
# endif // PIP_NO_THREADS
|
||||
# endif // PIP_HAS_THREADS
|
||||
is_started = is_indexed = is_pause = false;
|
||||
create_index_on_fly = false;
|
||||
current_index = -1;
|
||||
@@ -1011,4 +1011,4 @@ void PIBinaryLog::CompleteIndex::makeIndexPos() {
|
||||
index_pos[index[i].pos] = i;
|
||||
}
|
||||
|
||||
#endif // PIP_NO_FILESYSTEM
|
||||
#endif // PIP_HAS_FILESYSTEM
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include "pichunkstream.h"
|
||||
#include "pifile.h"
|
||||
|
||||
#ifndef PIP_NO_FILESYSTEM
|
||||
#ifdef PIP_HAS_FILESYSTEM
|
||||
|
||||
//! \~english Class for writing and reading binary data to/from log files, with support for playback in different modes.
|
||||
//! \~russian Класс для записи и чтения бинарных данных в/из файлов логов с поддержкой воспроизведения в различных режимах.
|
||||
@@ -993,5 +993,5 @@ inline PICout operator<<(PICout s, const PIBinaryLog::BinLogInfo & bi) {
|
||||
return s;
|
||||
}
|
||||
|
||||
#endif // PIP_NO_FILESYSTEM
|
||||
#endif // PIP_HAS_FILESYSTEM
|
||||
#endif // PIBINARYLOG_H
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "pipropertystorage.h"
|
||||
#include "piwaitevent_p.h"
|
||||
#if !defined(WINDOWS) && !defined(MAC_OS) && !defined(PIP_NO_SOCKET)
|
||||
#if !defined(WINDOWS) && !defined(MAC_OS) && defined(PIP_HAS_SOCKET)
|
||||
# define PIP_CAN
|
||||
#endif
|
||||
#ifdef PIP_CAN
|
||||
|
||||
@@ -288,7 +288,7 @@ PIConfig::PIConfig(PIIODevice * device, PIIODevice::DeviceMode mode) {
|
||||
}
|
||||
|
||||
|
||||
#ifndef PIP_NO_FILESYSTEM
|
||||
#ifdef PIP_HAS_FILESYSTEM
|
||||
PIConfig::PIConfig(const PIString & path, PIStringList dirs) {
|
||||
_init();
|
||||
internal = true;
|
||||
@@ -312,7 +312,7 @@ PIConfig::PIConfig(const PIString & path, PIStringList dirs) {
|
||||
_setupDev();
|
||||
parse();
|
||||
}
|
||||
#endif // PIP_NO_FILESYSTEM
|
||||
#endif // PIP_HAS_FILESYSTEM
|
||||
|
||||
|
||||
PIConfig::~PIConfig() {
|
||||
@@ -321,7 +321,7 @@ PIConfig::~PIConfig() {
|
||||
}
|
||||
|
||||
|
||||
#ifndef PIP_NO_FILESYSTEM
|
||||
#ifdef PIP_HAS_FILESYSTEM
|
||||
bool PIConfig::open(const PIString & path, PIIODevice::DeviceMode mode) {
|
||||
_destroy();
|
||||
incdirs << PIFile::fileInfo(path).dir();
|
||||
@@ -332,7 +332,7 @@ bool PIConfig::open(const PIString & path, PIIODevice::DeviceMode mode) {
|
||||
parse();
|
||||
return dev->isOpened();
|
||||
}
|
||||
#endif // PIP_NO_FILESYSTEM
|
||||
#endif // PIP_HAS_FILESYSTEM
|
||||
|
||||
|
||||
bool PIConfig::open(PIString * string, PIIODevice::DeviceMode mode) {
|
||||
@@ -351,7 +351,7 @@ bool PIConfig::open(PIIODevice * device, PIIODevice::DeviceMode mode) {
|
||||
dev = device;
|
||||
if (dev) {
|
||||
dev->open(mode);
|
||||
#ifndef PIP_NO_FILESYSTEM
|
||||
#ifdef PIP_HAS_FILESYSTEM
|
||||
if (dev->isTypeOf<PIFile>()) incdirs << PIFile::fileInfo(((PIFile *)dev)->path()).dir();
|
||||
#endif
|
||||
}
|
||||
@@ -389,7 +389,7 @@ void PIConfig::_setupDev() {
|
||||
|
||||
void PIConfig::_clearDev() {
|
||||
if (!dev) return;
|
||||
#ifndef PIP_NO_FILESYSTEM
|
||||
#ifdef PIP_HAS_FILESYSTEM
|
||||
if (PIString(dev->className()) == "PIFile") {
|
||||
((PIFile *)dev)->clear();
|
||||
return;
|
||||
@@ -405,7 +405,7 @@ void PIConfig::_clearDev() {
|
||||
|
||||
void PIConfig::_flushDev() {
|
||||
if (!dev) return;
|
||||
#ifndef PIP_NO_FILESYSTEM
|
||||
#ifdef PIP_HAS_FILESYSTEM
|
||||
if (PIString(dev->className()) == "PIFile") {
|
||||
((PIFile *)dev)->flush();
|
||||
}
|
||||
@@ -421,7 +421,7 @@ bool PIConfig::_isEndDev() {
|
||||
|
||||
void PIConfig::_seekToBeginDev() {
|
||||
if (!dev) return;
|
||||
#ifndef PIP_NO_FILESYSTEM
|
||||
#ifdef PIP_HAS_FILESYSTEM
|
||||
if (PIString(dev->className()) == "PIFile") {
|
||||
((PIFile *)dev)->seekToBegin();
|
||||
return;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef PIP_NO_FILESYSTEM
|
||||
#ifdef PIP_HAS_FILESYSTEM
|
||||
#include "pidir.h"
|
||||
|
||||
#include "piincludes_p.h"
|
||||
@@ -612,4 +612,4 @@ void PIDir::CurrentDirOverrider::save(const PIFile::FileInfo & info) {
|
||||
else
|
||||
PIDir::setCurrent(PIDir::current().path() + PIDir::separator + p);
|
||||
}
|
||||
#endif // PIP_NO_FILESYSTEM
|
||||
#endif // PIP_HAS_FILESYSTEM
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "piregularexpression.h"
|
||||
|
||||
|
||||
#ifndef PIP_NO_FILESYSTEM
|
||||
#ifdef PIP_HAS_FILESYSTEM
|
||||
//! \~\ingroup IO
|
||||
//! \~\brief
|
||||
//! \~english Local directory.
|
||||
@@ -218,10 +218,10 @@ private:
|
||||
|
||||
PIString path_, scan_;
|
||||
};
|
||||
#endif // PIP_NO_FILESYSTEM
|
||||
#endif // PIP_HAS_FILESYSTEM
|
||||
|
||||
|
||||
#ifndef PIP_NO_FILESYSTEM
|
||||
#ifdef PIP_HAS_FILESYSTEM
|
||||
inline bool operator<(const PIFile::FileInfo & v0, const PIFile::FileInfo & v1) {
|
||||
return (v0.path < v1.path);
|
||||
}
|
||||
@@ -245,7 +245,7 @@ inline PICout operator<<(PICout s, const PIDir & v) {
|
||||
s.restoreControls();
|
||||
return s;
|
||||
}
|
||||
#endif // PIP_NO_FILESYSTEM
|
||||
#endif // PIP_HAS_FILESYSTEM
|
||||
|
||||
|
||||
#endif // PIDIR_H
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
#include "piethernet.h"
|
||||
|
||||
#ifndef PIP_NO_SOCKET
|
||||
#ifdef PIP_HAS_SOCKET
|
||||
|
||||
# include "piconfig.h"
|
||||
# include "piconstchars.h"
|
||||
@@ -1505,4 +1505,4 @@ bool PIEthernet::ethIsWriteable(int sock) {
|
||||
# endif
|
||||
}
|
||||
|
||||
#endif // PIP_NO_SOCKET
|
||||
#endif // PIP_HAS_SOCKET
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include "piiodevice.h"
|
||||
#include "pinetworkaddress.h"
|
||||
|
||||
#ifndef PIP_NO_SOCKET
|
||||
#ifdef PIP_HAS_SOCKET
|
||||
|
||||
# ifdef ANDROID
|
||||
struct
|
||||
@@ -706,5 +706,5 @@ inline bool operator!=(const PIEthernet::Interface & v0, const PIEthernet::Inter
|
||||
return (v0.name != v1.name || v0.address != v1.address || v0.netmask != v1.netmask);
|
||||
}
|
||||
|
||||
#endif // PIP_NO_SOCKET
|
||||
#endif // PIP_HAS_SOCKET
|
||||
#endif // PIETHERNET_H
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PIP_NO_FILESYSTEM
|
||||
#ifdef PIP_HAS_FILESYSTEM
|
||||
# include "pifile.h"
|
||||
|
||||
# include "pidir.h"
|
||||
@@ -46,7 +46,7 @@
|
||||
# include <utime.h>
|
||||
# endif
|
||||
# define S_IFHDN 0x40
|
||||
# if defined(QNX) || defined(ANDROID) || defined(PIP_NO_FILESYSTEM)
|
||||
# if defined(QNX) || defined(ANDROID) || !defined(PIP_HAS_FILESYSTEM)
|
||||
# define _fopen_call_ fopen
|
||||
# define _fseek_call_ fseek
|
||||
# define _ftell_call_ ftell
|
||||
@@ -538,7 +538,7 @@ PIFile::FileInfo PIFile::fileInfo(const PIString & path) {
|
||||
ret.time_modification = PIDateTime::fromSystemTime(PISystemTime(fs.MTIME.tv_sec, fs.MTIME.tv_nsec));
|
||||
# endif
|
||||
# endif
|
||||
# ifndef PIP_NO_FILESYSTEM
|
||||
# ifdef PIP_HAS_FILESYSTEM
|
||||
ret.perm_user = FileInfo::Permissions((mode & S_IRUSR) == S_IRUSR, (mode & S_IWUSR) == S_IWUSR, (mode & S_IXUSR) == S_IXUSR);
|
||||
ret.perm_group = FileInfo::Permissions((mode & S_IRGRP) == S_IRGRP, (mode & S_IWGRP) == S_IWGRP, (mode & S_IXGRP) == S_IXGRP);
|
||||
ret.perm_other = FileInfo::Permissions((mode & S_IROTH) == S_IROTH, (mode & S_IWOTH) == S_IWOTH, (mode & S_IXOTH) == S_IXOTH);
|
||||
@@ -636,4 +636,4 @@ int PIFile::writeAll(const PIString & path, const PIByteArray & data) {
|
||||
f.clear();
|
||||
return f.write(data.data(), data.size_s());
|
||||
}
|
||||
#endif // PIP_NO_FILESYSTEM
|
||||
#endif // PIP_HAS_FILESYSTEM
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include "pipropertystorage.h"
|
||||
|
||||
|
||||
#ifndef PIP_NO_FILESYSTEM
|
||||
#ifdef PIP_HAS_FILESYSTEM
|
||||
//! \~\ingroup IO
|
||||
//! \~\brief
|
||||
//! \~english Local file.
|
||||
@@ -362,10 +362,10 @@ private:
|
||||
llong _size = -1;
|
||||
PIString prec_str;
|
||||
};
|
||||
#endif // PIP_NO_FILESYSTEM
|
||||
#endif // PIP_HAS_FILESYSTEM
|
||||
|
||||
|
||||
#ifndef PIP_NO_FILESYSTEM
|
||||
#ifdef PIP_HAS_FILESYSTEM
|
||||
//! \relatesalso PICout
|
||||
//! \~english Output operator to \a PICout.
|
||||
//! \~russian Оператор вывода в \a PICout.
|
||||
@@ -398,6 +398,6 @@ BINARY_STREAM_READ(PIFile::FileInfo) {
|
||||
v.perm_group.raw >> v.perm_other.raw;
|
||||
return s;
|
||||
}
|
||||
#endif // PIP_NO_FILESYSTEM
|
||||
#endif // PIP_HAS_FILESYSTEM
|
||||
|
||||
#endif // PIFILE_H
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#endif
|
||||
#include "piliterals.h"
|
||||
|
||||
#ifndef PIP_NO_THREADS
|
||||
#ifdef PIP_HAS_THREADS
|
||||
|
||||
//! \class PIGPIO pigpio.h
|
||||
//! \~english \section PIGPIO_sec0 Synopsis
|
||||
@@ -309,4 +309,4 @@ void PIGPIO::clearWatch() {
|
||||
// # pragma GCC diagnostic pop
|
||||
# endif
|
||||
|
||||
#endif // PIP_NO_THREADS
|
||||
#endif // PIP_HAS_THREADS
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
#include "pithread.h"
|
||||
|
||||
#ifndef PIP_NO_THREADS
|
||||
#ifdef PIP_HAS_THREADS
|
||||
|
||||
//! \~\ingroup IO
|
||||
//! \~\brief
|
||||
@@ -144,6 +144,6 @@ private:
|
||||
PIMutex mutex;
|
||||
};
|
||||
|
||||
#endif // PIP_NO_THREADS
|
||||
#endif // PIP_HAS_THREADS
|
||||
|
||||
#endif // PIGPIO_H
|
||||
|
||||
@@ -117,7 +117,7 @@
|
||||
//!
|
||||
|
||||
|
||||
#ifndef PIP_NO_THREADS
|
||||
#ifdef PIP_HAS_THREADS
|
||||
PIMutex PIIODevice::nfp_mutex;
|
||||
#endif
|
||||
PIMap<PIString, PIString> PIIODevice::nfp_cache;
|
||||
@@ -198,7 +198,7 @@ void PIIODevice::setThreadedReadBufferSize(int new_size) {
|
||||
}
|
||||
|
||||
|
||||
#ifndef PIP_NO_THREADS
|
||||
#ifdef PIP_HAS_THREADS
|
||||
bool PIIODevice::isThreadedRead() const {
|
||||
return read_thread.isRunning();
|
||||
}
|
||||
@@ -252,7 +252,7 @@ bool PIIODevice::waitThreadedReadFinished(PISystemTime timeout) {
|
||||
|
||||
|
||||
bool PIIODevice::isThreadedWrite() const {
|
||||
#ifndef PIP_NO_THREADS
|
||||
#ifdef PIP_HAS_THREADS
|
||||
return write_thread.isRunning();
|
||||
#else
|
||||
return false;
|
||||
@@ -261,14 +261,14 @@ bool PIIODevice::isThreadedWrite() const {
|
||||
|
||||
|
||||
void PIIODevice::startThreadedWrite() {
|
||||
#ifndef PIP_NO_THREADS
|
||||
#ifdef PIP_HAS_THREADS
|
||||
if (!write_thread.isRunning()) write_thread.startOnce();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void PIIODevice::stopThreadedWrite() {
|
||||
#ifndef PIP_NO_THREADS
|
||||
#ifdef PIP_HAS_THREADS
|
||||
if (!write_thread.isRunning()) return;
|
||||
write_thread.stop();
|
||||
#endif
|
||||
@@ -276,14 +276,14 @@ void PIIODevice::stopThreadedWrite() {
|
||||
|
||||
|
||||
void PIIODevice::terminateThreadedWrite() {
|
||||
#ifndef PIP_NO_THREADS
|
||||
#ifdef PIP_HAS_THREADS
|
||||
write_thread.terminate();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
bool PIIODevice::waitThreadedWriteFinished(PISystemTime timeout) {
|
||||
#ifndef PIP_NO_THREADS
|
||||
#ifdef PIP_HAS_THREADS
|
||||
return write_thread.waitForFinish(timeout);
|
||||
#else
|
||||
(void)timeout;
|
||||
@@ -293,7 +293,7 @@ bool PIIODevice::waitThreadedWriteFinished(PISystemTime timeout) {
|
||||
|
||||
|
||||
void PIIODevice::clearThreadedWriteQueue() {
|
||||
#ifndef PIP_NO_THREADS
|
||||
#ifdef PIP_HAS_THREADS
|
||||
write_thread.lock();
|
||||
write_queue.clear();
|
||||
write_thread.unlock();
|
||||
@@ -302,7 +302,7 @@ void PIIODevice::clearThreadedWriteQueue() {
|
||||
|
||||
|
||||
void PIIODevice::start() {
|
||||
#ifndef PIP_NO_THREADS
|
||||
#ifdef PIP_HAS_THREADS
|
||||
startThreadedRead();
|
||||
#endif
|
||||
startThreadedWrite();
|
||||
@@ -310,7 +310,7 @@ void PIIODevice::start() {
|
||||
|
||||
|
||||
void PIIODevice::stop() {
|
||||
#ifndef PIP_NO_THREADS
|
||||
#ifdef PIP_HAS_THREADS
|
||||
stopThreadedRead();
|
||||
#endif
|
||||
stopThreadedWrite();
|
||||
@@ -319,7 +319,7 @@ void PIIODevice::stop() {
|
||||
|
||||
void PIIODevice::stopAndWait(PISystemTime timeout) {
|
||||
stop();
|
||||
#ifndef PIP_NO_THREADS
|
||||
#ifdef PIP_HAS_THREADS
|
||||
waitThreadedReadFinished(timeout);
|
||||
#endif
|
||||
waitThreadedWriteFinished(timeout);
|
||||
@@ -357,7 +357,7 @@ void PIIODevice::_init() {
|
||||
setOptions(0);
|
||||
setReopenEnabled(true);
|
||||
setReopenTimeout(1_s);
|
||||
#ifdef PIP_NO_THREADS
|
||||
#ifndef PIP_HAS_THREADS
|
||||
threaded_read_buffer_size = 512;
|
||||
#else
|
||||
threaded_read_buffer_size = 4_KiB;
|
||||
@@ -368,11 +368,11 @@ void PIIODevice::_init() {
|
||||
if (!isOpened()) open();
|
||||
});
|
||||
read_thread.setSlot([this](void *) { read_func(); });
|
||||
#endif // PIP_NO_THREADS
|
||||
#endif // PIP_HAS_THREADS
|
||||
}
|
||||
|
||||
|
||||
#ifndef PIP_NO_THREADS
|
||||
#ifdef PIP_HAS_THREADS
|
||||
void PIIODevice::write_func() {
|
||||
while (!write_thread.isStopping()) {
|
||||
while (!write_queue.isEmpty()) {
|
||||
@@ -412,7 +412,7 @@ void PIIODevice::read_func() {
|
||||
threadedRead(buffer_tr.data(), readed_);
|
||||
threadedReadEvent(buffer_tr.data(), readed_);
|
||||
}
|
||||
#endif // PIP_NO_THREADS
|
||||
#endif // PIP_HAS_THREADS
|
||||
|
||||
|
||||
PIIODevice * PIIODevice::newDeviceByPrefix(const char * prefix) {
|
||||
@@ -443,7 +443,7 @@ PIByteArray PIIODevice::readForTime(PISystemTime timeout) {
|
||||
}
|
||||
|
||||
|
||||
#ifndef PIP_NO_THREADS
|
||||
#ifdef PIP_HAS_THREADS
|
||||
ullong PIIODevice::writeThreaded(const PIByteArray & data) {
|
||||
write_thread.lock();
|
||||
write_queue.enqueue(PIPair<PIByteArray, ullong>(data, tri));
|
||||
@@ -663,17 +663,17 @@ PIIODevice * PIIODevice::createFromVariant(const PIVariantTypes::IODevice & d) {
|
||||
|
||||
|
||||
PIString PIIODevice::normalizeFullPath(const PIString & full_path) {
|
||||
#ifndef PIP_NO_THREADS
|
||||
#ifdef PIP_HAS_THREADS
|
||||
nfp_mutex.lock();
|
||||
#endif
|
||||
PIString ret = nfp_cache.value(full_path);
|
||||
if (!ret.isEmpty()) {
|
||||
#ifndef PIP_NO_THREADS
|
||||
#ifdef PIP_HAS_THREADS
|
||||
nfp_mutex.unlock();
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
#ifndef PIP_NO_THREADS
|
||||
#ifdef PIP_HAS_THREADS
|
||||
nfp_mutex.unlock();
|
||||
#endif
|
||||
PIIODevice * d = createFromFullPath(full_path);
|
||||
@@ -685,7 +685,7 @@ PIString PIIODevice::normalizeFullPath(const PIString & full_path) {
|
||||
|
||||
|
||||
void PIIODevice::cacheFullPath(const PIString & full_path, const PIIODevice * d) {
|
||||
#ifndef PIP_NO_THREADS
|
||||
#ifdef PIP_HAS_THREADS
|
||||
PIMutexLocker nfp_ml(nfp_mutex);
|
||||
#endif
|
||||
nfp_cache[full_path] = d->constructFullPath();
|
||||
|
||||
@@ -242,7 +242,7 @@ public:
|
||||
//! \~russian Возвращает пользовательские данные, передаваемые в callback потокового чтения.
|
||||
void * threadedReadData() const { return ret_data_; }
|
||||
|
||||
#ifndef PIP_NO_THREADS
|
||||
#ifdef PIP_HAS_THREADS
|
||||
//! \~english Returns whether threaded read is running.
|
||||
//! \~russian Возвращает, запущено ли потоковое чтение.
|
||||
bool isThreadedRead() const;
|
||||
@@ -273,7 +273,7 @@ public:
|
||||
//! \~english Waits until threaded read finishes or "timeout" expires.
|
||||
//! \~russian Ожидает завершения потокового чтения, но не дольше "timeout".
|
||||
bool waitThreadedReadFinished(PISystemTime timeout = {});
|
||||
#endif // PIP_NO_THREADS
|
||||
#endif // PIP_HAS_THREADS
|
||||
|
||||
|
||||
//! \~english Returns delay between unsuccessful threaded read attempts in milliseconds.
|
||||
@@ -362,7 +362,7 @@ public:
|
||||
PIByteArray readForTime(PISystemTime timeout);
|
||||
|
||||
|
||||
#ifndef PIP_NO_THREADS
|
||||
#ifdef PIP_HAS_THREADS
|
||||
//! \~english Queues "data" for threaded write and returns task ID.
|
||||
//! \~russian Помещает "data" в очередь потоковой записи и возвращает ID задания.
|
||||
ullong writeThreaded(const void * data, ssize_t max_size) { return writeThreaded(PIByteArray(data, uint(max_size))); }
|
||||
@@ -615,7 +615,7 @@ private:
|
||||
bool reopen_enabled = true, destroying = false;
|
||||
static PIMap<PIString, PIString> nfp_cache;
|
||||
|
||||
#ifndef PIP_NO_THREADS
|
||||
#ifdef PIP_HAS_THREADS
|
||||
PIThread read_thread, write_thread;
|
||||
PIQueue<PIPair<PIByteArray, ullong>> write_queue;
|
||||
static PIMutex nfp_mutex;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "piliterals_time.h"
|
||||
#include "pipropertystorage.h"
|
||||
|
||||
#ifndef PIP_NO_SOCKET
|
||||
#ifdef PIP_HAS_SOCKET
|
||||
# include "pitime.h"
|
||||
|
||||
# define _PIPEER_MSG_SIZE 4000
|
||||
@@ -1179,4 +1179,4 @@ bool PIPeer::hasPeer(const PIString & name) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif // PIP_NO_SOCKET
|
||||
#endif // PIP_HAS_SOCKET
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
//! \~russian
|
||||
//! Класс обнаруживает пиры, маршрутизирует пакеты по имени пира и может предоставлять поток trusted-peer через унаследованные \a read() и
|
||||
//! \a write().
|
||||
#ifndef PIP_NO_SOCKET
|
||||
#ifdef PIP_HAS_SOCKET
|
||||
class PIP_EXPORT PIPeer: public PIIODevice {
|
||||
PIIODEVICE(PIPeer, "peer");
|
||||
|
||||
@@ -437,6 +437,6 @@ BINARY_STREAM_READ(PIPeer::PeerInfo) {
|
||||
s >> v.name >> v.addresses >> v.dist >> v.neighbours >> v.cnt >> v.time;
|
||||
return s;
|
||||
}
|
||||
#endif // PIP_NO_SOCKET
|
||||
#endif // PIP_HAS_SOCKET
|
||||
|
||||
#endif // PIPEER_H
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "piserial.h"
|
||||
|
||||
#ifndef PIP_NO_SERIAL
|
||||
#ifdef PIP_HAS_SERIAL
|
||||
|
||||
# include "piconfig.h"
|
||||
# include "pidir.h"
|
||||
@@ -1326,4 +1326,4 @@ void PISerial::threadedReadBufferSizeChanged() {
|
||||
# endif
|
||||
}
|
||||
|
||||
#endif // PIP_NO_SERIAL
|
||||
#endif // PIP_HAS_SERIAL
|
||||
|
||||
@@ -43,11 +43,11 @@ REGISTER_DEVICE(PISPI)
|
||||
|
||||
|
||||
PISPI::PISPI(const PIString & path, uint speed, PIIODevice::DeviceMode mode): PIIODevice(path, mode) {
|
||||
#ifdef PIP_NO_THREADS
|
||||
#ifndef PIP_HAS_THREADS
|
||||
setThreadedReadBufferSize(512);
|
||||
#else
|
||||
setThreadedReadBufferSize(1024);
|
||||
#endif // PIP_NO_THREADS
|
||||
#endif // PIP_HAS_THREADS
|
||||
setPath(path);
|
||||
setSpeed(speed);
|
||||
setBits(8);
|
||||
|
||||
Reference in New Issue
Block a user