diff --git a/libs/main/containers/pideque.h b/libs/main/containers/pideque.h index 047bf410..b5207f29 100644 --- a/libs/main/containers/pideque.h +++ b/libs/main/containers/pideque.h @@ -1272,7 +1272,7 @@ public: template::value, int>::type = 0> inline PIDeque & _resizeRaw(size_t new_size) { -#if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION) +#ifdef PIP_INTROSPECTION if (new_size > pid_size) { PIINTROSPECTION_CONTAINER_USED(T, (new_size - pid_size)); } @@ -2678,7 +2678,7 @@ private: pid_size = new_size; const size_t new_rsize = _PIContainerConstants::calcNewSize(pid_rsize, pid_start + new_size); if (new_rsize != pid_rsize) { - PIINTROSPECTION_CONTAINER_ALLOC(T, (as - pid_rsize)) + PIINTROSPECTION_CONTAINER_ALLOC(T, (new_rsize - pid_rsize)) T * new_data = reinterpret_cast(realloc(reinterpret_cast(pid_data), new_rsize * sizeof(T))); #ifndef NDEBUG if (!new_data) { @@ -2697,7 +2697,7 @@ private: if (new_rsize > pid_rsize) { T * tmp_data = reinterpret_cast(malloc(new_rsize * sizeof(T))); const size_t new_start = pid_start + new_rsize - pid_rsize; - PIINTROSPECTION_CONTAINER_ALLOC(T, (as - pid_rsize)) + PIINTROSPECTION_CONTAINER_ALLOC(T, (new_rsize - pid_rsize)) if (pid_rsize > 0 && pid_data) { memcpy(reinterpret_cast(tmp_data + new_start), reinterpret_cast(pid_data + pid_start), diff --git a/libs/main/containers/pivector.h b/libs/main/containers/pivector.h index bdd2a700..9de6508a 100644 --- a/libs/main/containers/pivector.h +++ b/libs/main/containers/pivector.h @@ -1274,7 +1274,7 @@ public: template::value, int>::type = 0> inline PIVector & _resizeRaw(size_t new_size) { -#if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION) +#ifdef PIP_INTROSPECTION if (new_size > piv_size) { PIINTROSPECTION_CONTAINER_USED(T, (new_size - piv_size)); } @@ -2575,7 +2575,7 @@ private: piv_size = new_size; const size_t new_rsize = _PIContainerConstants::calcNewSize(piv_rsize, new_size); if (new_rsize == piv_rsize) return; - PIINTROSPECTION_CONTAINER_ALLOC(T, (as - piv_rsize)) + PIINTROSPECTION_CONTAINER_ALLOC(T, (new_rsize - piv_rsize)) T * new_data = reinterpret_cast(realloc(reinterpret_cast(piv_data), new_rsize * sizeof(T))); #ifndef NDEBUG if (!new_data) { diff --git a/libs/main/core/piinit.cpp b/libs/main/core/piinit.cpp index 80672b84..86bcdb88 100644 --- a/libs/main/core/piinit.cpp +++ b/libs/main/core/piinit.cpp @@ -84,9 +84,11 @@ PRIVATE_DEFINITION_END(PIInit) void __sighandler__(PISignals::Signal s) { // piCout << Hex << int(s); if (s == PISignals::StopTTYInput || s == PISignals::StopTTYOutput) piMSleep(10); +# if defined(PIP_INTROSPECTION) && defined(PIP_HAS_FILESYSTEM) if (s == PISignals::UserDefined1) dumpApplicationToFile(PIDir::home().path() + PIDir::separator + PIStringAscii("_PIP_DUMP_") + PIString::fromNumber(PIProcess::currentPID())); +# endif } @@ -181,9 +183,9 @@ PIInit::PIInit() { // piCout << __sysoemname__; # else // PIP_ICU # ifdef WINDOWS - __syslocname__ = (char *)CP_ACP; - __sysoemname__ = (char *)CP_OEMCP; - __utf8name__ = (char *)CP_UTF8; + __syslocname__ = (char *)CP_ACP; + __sysoemname__ = (char *)CP_OEMCP; + __utf8name__ = (char *)CP_UTF8; # endif # endif // PIP_ICU # ifdef MAC_OS diff --git a/libs/main/core/piobject.cpp b/libs/main/core/piobject.cpp index 9ba33d2c..9bfba4bc 100644 --- a/libs/main/core/piobject.cpp +++ b/libs/main/core/piobject.cpp @@ -681,6 +681,7 @@ bool PIObject::isPIObject(const PIObject * o) { } +#ifdef PIP_INTROSPECTION void PIObject::dump(const PIString & line_prefix) const { // printf("dump %s \"%s\"\n", className(), name().data()); PICout(PICoutManipulators::AddNewLine) << line_prefix << "class " << className() << " (" << (const void *)this << ", \"" << name() @@ -731,9 +732,10 @@ void PIObject::dump(const PIString & line_prefix) const { PICout(PICoutManipulators::AddNewLine) << line_prefix << " }"; PICout(PICoutManipulators::AddNewLine) << line_prefix << "}"; } +#endif // PIP_INTROSPECTION -#ifdef PIP_HAS_THREADS +#ifdef PIP_INTROSPECTION void dumpApplication(bool with_objects) { PIMutexLocker _ml(PIObject::mutexObjects()); // printf("dump application ...\n"); @@ -763,6 +765,7 @@ void dumpApplication(bool with_objects) { } +# if defined(PIP_HAS_FILESYSTEM) bool dumpApplicationToFile(const PIString & path, bool with_objects) { PIFile f(path + "_tmp"); f.setName("_S.DumpFile"); @@ -779,7 +782,8 @@ bool dumpApplicationToFile(const PIString & path, bool with_objects) { PIFile::rename(path + "_tmp", path); return true; } -#endif +# endif // PIP_HAS_FILESYSTEM +#endif // PIP_INTROSPECTION void PIObject::__MetaData::addScope(const char * s, uint shash) { diff --git a/libs/main/core/piobject.h b/libs/main/core/piobject.h index 2c5c5979..16c63915 100644 --- a/libs/main/core/piobject.h +++ b/libs/main/core/piobject.h @@ -54,8 +54,7 @@ //! требует явного опустошения очереди через \a callQueuedEvents() или //! \a maybeCallQueuedEvents(). class PIP_EXPORT PIObject { -#ifndef PIP_INTROSPECTION - friend class PIObjectManager; +#ifdef PIP_INTROSPECTION friend PIP_EXPORT void dumpApplication(bool); friend class PIIntrospection; #endif @@ -376,9 +375,11 @@ public: return executeQueued(o, performer, method, PIVector() << v0 << v1 << v2 << v3); } +#ifdef PIP_INTROSPECTION //! \~english Dumps object diagnostics to the project output stream. //! \~russian Выводит диагностическую информацию об объекте в проектный поток вывода. void dump(const PIString & line_prefix = PIString()) const; +#endif // PIP_INTROSPECTION //! \~english Returns the registered inheritance scope of this object, including its own class. @@ -838,16 +839,18 @@ private: bool thread_safe_ = false, proc_event_queue = false; }; -#ifdef PIP_HAS_THREADS +#ifdef PIP_INTROSPECTION //! \~english Dumps application-level %PIObject diagnostics. //! \~russian Выводит диагностическую информацию уровня приложения для %PIObject. PIP_EXPORT void dumpApplication(bool with_objects = true); +# if defined(PIP_HAS_FILESYSTEM) //! \~english Dumps application-level %PIObject diagnostics to file "path". //! \~russian Выводит диагностическую информацию уровня приложения для %PIObject в файл "path". PIP_EXPORT bool dumpApplicationToFile(const PIString & path, bool with_objects = true); +# endif // PIP_HAS_FILESYSTEM -#endif +#endif // PIP_INTROSPECTION #endif // PIOBJECT_H diff --git a/libs/main/introspection/piintrospection_base.h b/libs/main/introspection/piintrospection_base.h index 6a321400..b9d541ff 100644 --- a/libs/main/introspection/piintrospection_base.h +++ b/libs/main/introspection/piintrospection_base.h @@ -82,7 +82,7 @@ class PIIntrospectionServer; #else -#if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION) +#ifdef PIP_INTROSPECTION # define __PIINTROSPECTION_SINGLETON_H__(T) static PIIntrospection##T##Interface * instance(); # define __PIINTROSPECTION_SINGLETON_CPP__(T) \ diff --git a/libs/main/introspection/piintrospection_containers.cpp b/libs/main/introspection/piintrospection_containers.cpp index 7823c19d..f89864ce 100644 --- a/libs/main/introspection/piintrospection_containers.cpp +++ b/libs/main/introspection/piintrospection_containers.cpp @@ -27,7 +27,7 @@ PIIntrospectionContainersType::~PIIntrospectionContainersType() { } -#if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION) +#ifdef PIP_INTROSPECTION # include "piintrospection_containers_p.h" diff --git a/libs/main/introspection/piintrospection_containers.h b/libs/main/introspection/piintrospection_containers.h index 9677831c..d9c5fe0d 100644 --- a/libs/main/introspection/piintrospection_containers.h +++ b/libs/main/introspection/piintrospection_containers.h @@ -61,7 +61,7 @@ struct PIP_EXPORT PIIntrospectionContainersType { bool has_demangled = false; }; -#if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION) +#ifdef PIP_INTROSPECTION # include "piintrospection_base.h" diff --git a/libs/main/introspection/piintrospection_server.cpp b/libs/main/introspection/piintrospection_server.cpp index 5e71e820..94eaf1bf 100644 --- a/libs/main/introspection/piintrospection_server.cpp +++ b/libs/main/introspection/piintrospection_server.cpp @@ -17,7 +17,7 @@ along with this program. If not, see . */ -#if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION) +#ifdef PIP_INTROSPECTION # include "piintrospection_server.h" diff --git a/libs/main/introspection/piintrospection_server.h b/libs/main/introspection/piintrospection_server.h index e7431dc0..22c961a3 100644 --- a/libs/main/introspection/piintrospection_server.h +++ b/libs/main/introspection/piintrospection_server.h @@ -43,7 +43,7 @@ #else -# if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION) +# ifdef PIP_INTROSPECTION # include "pipeer.h" diff --git a/libs/main/introspection/piintrospection_server_p.cpp b/libs/main/introspection/piintrospection_server_p.cpp index 40bf8811..e7cc7946 100644 --- a/libs/main/introspection/piintrospection_server_p.cpp +++ b/libs/main/introspection/piintrospection_server_p.cpp @@ -19,7 +19,7 @@ #include "piintrospection_server_p.h" -#if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION) +#ifdef PIP_INTROSPECTION # include "pichunkstream.h" # include "piinit.h" @@ -173,4 +173,4 @@ void PIIntrospection::unpackObjects(PIByteArray & ba, PIVector> objects; } -#endif // #if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION) +#endif // PIP_INTROSPECTION diff --git a/libs/main/introspection/piintrospection_server_p.h b/libs/main/introspection/piintrospection_server_p.h index 076e588d..228eb128 100644 --- a/libs/main/introspection/piintrospection_server_p.h +++ b/libs/main/introspection/piintrospection_server_p.h @@ -27,7 +27,7 @@ #include "piintrospection_threads_p.h" #include "pisystemmonitor.h" -#if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION) +#ifdef PIP_INTROSPECTION class PIP_EXPORT PIIntrospection { public: @@ -169,5 +169,5 @@ BINARY_STREAM_READ(PIIntrospection::ObjectInfo) { return s; } -#endif // #if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION) +#endif // PIP_INTROSPECTION #endif // PIINTROSPECTION_SERVER_P_H diff --git a/libs/main/introspection/piintrospection_threads.cpp b/libs/main/introspection/piintrospection_threads.cpp index 7b2d9019..4572cb6e 100644 --- a/libs/main/introspection/piintrospection_threads.cpp +++ b/libs/main/introspection/piintrospection_threads.cpp @@ -17,7 +17,7 @@ along with this program. If not, see . */ -#if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION) +#ifdef PIP_INTROSPECTION # include "piintrospection_threads.h" diff --git a/libs/main/introspection/piintrospection_threads.h b/libs/main/introspection/piintrospection_threads.h index ca24606a..0cc84d06 100644 --- a/libs/main/introspection/piintrospection_threads.h +++ b/libs/main/introspection/piintrospection_threads.h @@ -25,7 +25,7 @@ #ifndef PIINTROSPECTION_THREADS_H #define PIINTROSPECTION_THREADS_H -#if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION) +#ifdef PIP_INTROSPECTION # include "piintrospection_base.h" diff --git a/libs/main/introspection/piintrospection_threads_p.cpp b/libs/main/introspection/piintrospection_threads_p.cpp index 6057690c..a6188aa9 100644 --- a/libs/main/introspection/piintrospection_threads_p.cpp +++ b/libs/main/introspection/piintrospection_threads_p.cpp @@ -19,7 +19,7 @@ #include "piintrospection_threads_p.h" -#if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION) +#ifdef PIP_INTROSPECTION PIIntrospectionThreads::ThreadInfo::ThreadInfo() { id = delay = 0; @@ -80,4 +80,4 @@ void PIIntrospectionThreads::threadRunDone(PIThread * t, ullong us) { ti.run_us = (ti.run_us * 0.8) + (us * 0.2); /// WARNING } -#endif // #if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION) +#endif // PIP_INTROSPECTION diff --git a/libs/main/introspection/piintrospection_threads_p.h b/libs/main/introspection/piintrospection_threads_p.h index b71b05b9..dadbb61c 100644 --- a/libs/main/introspection/piintrospection_threads_p.h +++ b/libs/main/introspection/piintrospection_threads_p.h @@ -22,7 +22,7 @@ #include "pibase.h" -#if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION) +#ifdef PIP_INTROSPECTION #include "pimap.h" #include "pithread.h" @@ -72,5 +72,5 @@ BINARY_STREAM_READ(PIIntrospectionThreads::ThreadInfo) { return s; } -#endif // #if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION) +#endif // PIP_INTROSPECTION #endif // PIINTROSPECTION_THREADS_P_H