Yet another small improvements to library initialization code.
This commit is contained in:
parent
0ee110053b
commit
afa83d8645
@ -73,7 +73,7 @@ $(function() {
|
|||||||
<div class="ttc" id="_hash_8h_html_aa9e34ac422f4e52061cb8908f922fe17"><div class="ttname"><a href="../../d2/dad/_hash_8h.html#aa9e34ac422f4e52061cb8908f922fe17">MUtils::Hash::HASH_BLAKE2_512</a></div><div class="ttdeci">static const quint16 HASH_BLAKE2_512</div><div class="ttdoc">Hash algorithm identifier. </div><div class="ttdef"><b>Definition:</b> Hash.h:42</div></div>
|
<div class="ttc" id="_hash_8h_html_aa9e34ac422f4e52061cb8908f922fe17"><div class="ttname"><a href="../../d2/dad/_hash_8h.html#aa9e34ac422f4e52061cb8908f922fe17">MUtils::Hash::HASH_BLAKE2_512</a></div><div class="ttdeci">static const quint16 HASH_BLAKE2_512</div><div class="ttdoc">Hash algorithm identifier. </div><div class="ttdef"><b>Definition:</b> Hash.h:42</div></div>
|
||||||
<div class="ttc" id="_hash_8h_html_af80dfb1569816fab7ab5ed32e6386458"><div class="ttname"><a href="../../d2/dad/_hash_8h.html#af80dfb1569816fab7ab5ed32e6386458">MUtils::Hash::HASH_KECCAK_384</a></div><div class="ttdeci">static const quint16 HASH_KECCAK_384</div><div class="ttdoc">Hash algorithm identifier. </div><div class="ttdef"><b>Definition:</b> Hash.h:45</div></div>
|
<div class="ttc" id="_hash_8h_html_af80dfb1569816fab7ab5ed32e6386458"><div class="ttname"><a href="../../d2/dad/_hash_8h.html#af80dfb1569816fab7ab5ed32e6386458">MUtils::Hash::HASH_KECCAK_384</a></div><div class="ttdeci">static const quint16 HASH_KECCAK_384</div><div class="ttdoc">Hash algorithm identifier. </div><div class="ttdef"><b>Definition:</b> Hash.h:45</div></div>
|
||||||
<div class="ttc" id="namespace_m_utils_html"><div class="ttname"><a href="../../d3/da6/namespace_m_utils.html">MUtils</a></div><div class="ttdoc">Global MUtils namespace. </div><div class="ttdef"><b>Definition:</b> CPUFeatures.h:37</div></div>
|
<div class="ttc" id="namespace_m_utils_html"><div class="ttname"><a href="../../d3/da6/namespace_m_utils.html">MUtils</a></div><div class="ttdoc">Global MUtils namespace. </div><div class="ttdef"><b>Definition:</b> CPUFeatures.h:37</div></div>
|
||||||
<div class="ttc" id="_global_8h_html_a8e7b4857b78f9749233e5abc96534ca8"><div class="ttname"><a href="../../d5/d3b/_global_8h.html#a8e7b4857b78f9749233e5abc96534ca8">MUTILS_NO_COPY</a></div><div class="ttdeci">#define MUTILS_NO_COPY(CLASS)</div><div class="ttdoc">Disables copy constructor and assignment operator in the specified class. This macro should be used i...</div><div class="ttdef"><b>Definition:</b> Global.h:416</div></div>
|
<div class="ttc" id="_global_8h_html_a8e7b4857b78f9749233e5abc96534ca8"><div class="ttname"><a href="../../d5/d3b/_global_8h.html#a8e7b4857b78f9749233e5abc96534ca8">MUTILS_NO_COPY</a></div><div class="ttdeci">#define MUTILS_NO_COPY(CLASS)</div><div class="ttdoc">Disables copy constructor and assignment operator in the specified class. This macro should be used i...</div><div class="ttdef"><b>Definition:</b> Global.h:422</div></div>
|
||||||
<div class="ttc" id="_hash_8h_html_a330b73d6927d6cd95892712f9396f40e"><div class="ttname"><a href="../../d2/dad/_hash_8h.html#a330b73d6927d6cd95892712f9396f40e">MUtils::Hash::create</a></div><div class="ttdeci">MUTILS_API Hash * create(const quint16 &hashId, const char *const key=NULL)</div><div class="ttdoc">Create instance of a hash function. </div></div>
|
<div class="ttc" id="_hash_8h_html_a330b73d6927d6cd95892712f9396f40e"><div class="ttname"><a href="../../d2/dad/_hash_8h.html#a330b73d6927d6cd95892712f9396f40e">MUtils::Hash::create</a></div><div class="ttdeci">MUTILS_API Hash * create(const quint16 &hashId, const char *const key=NULL)</div><div class="ttdoc">Create instance of a hash function. </div></div>
|
||||||
<div class="ttc" id="class_m_utils_1_1_hash_1_1_hash_html"><div class="ttname"><a href="../../da/db0/class_m_utils_1_1_hash_1_1_hash.html">MUtils::Hash::Hash</a></div><div class="ttdoc">This abstract class specifies the generic interface for all support hash algorithms. </div><div class="ttdef"><b>Definition:</b> Hash.h:57</div></div>
|
<div class="ttc" id="class_m_utils_1_1_hash_1_1_hash_html"><div class="ttname"><a href="../../da/db0/class_m_utils_1_1_hash_1_1_hash.html">MUtils::Hash::Hash</a></div><div class="ttdoc">This abstract class specifies the generic interface for all support hash algorithms. </div><div class="ttdef"><b>Definition:</b> Hash.h:57</div></div>
|
||||||
<div class="ttc" id="_hash_8h_html_ae38cda07e425eb7c745492215a48ae08"><div class="ttname"><a href="../../d2/dad/_hash_8h.html#ae38cda07e425eb7c745492215a48ae08">MUtils::Hash::HASH_KECCAK_256</a></div><div class="ttdeci">static const quint16 HASH_KECCAK_256</div><div class="ttdoc">Hash algorithm identifier. </div><div class="ttdef"><b>Definition:</b> Hash.h:44</div></div>
|
<div class="ttc" id="_hash_8h_html_ae38cda07e425eb7c745492215a48ae08"><div class="ttname"><a href="../../d2/dad/_hash_8h.html#ae38cda07e425eb7c745492215a48ae08">MUtils::Hash::HASH_KECCAK_256</a></div><div class="ttdeci">static const quint16 HASH_KECCAK_256</div><div class="ttdoc">Hash algorithm identifier. </div><div class="ttdef"><b>Definition:</b> Hash.h:44</div></div>
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -80,14 +80,20 @@ template<typename K, typename V> class QHash;
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//Library initializer
|
||||||
|
#define MUTILS_GLUE_NAME_HELPER(X,Y) X##Y
|
||||||
|
#define MUTILS_GLUE_NAME(X,Y) MUTILS_GLUE_NAME_HELPER(X,Y)
|
||||||
|
#if MUTILS_DEBUG
|
||||||
|
#define MUTILS_INITIALIZER MUTILS_GLUE_NAME(initialize_d, MUTILS_INTERFACE)
|
||||||
|
#else
|
||||||
|
#define MUTILS_INITIALIZER MUTILS_GLUE_NAME(initialize_r, MUTILS_INTERFACE)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//Compiler warnings
|
||||||
#define MUTILS_MAKE_STRING_HELPER(X) #X
|
#define MUTILS_MAKE_STRING_HELPER(X) #X
|
||||||
#define MUTILS_MAKE_STRING(X) MUTILS_MAKE_STRING_HELPER(X)
|
#define MUTILS_MAKE_STRING(X) MUTILS_MAKE_STRING_HELPER(X)
|
||||||
#define MUTILS_COMPILER_WARNING(TXT) __pragma(message(__FILE__ "(" MUTILS_MAKE_STRING(__LINE__) ") : warning: " TXT))
|
#define MUTILS_COMPILER_WARNING(TXT) __pragma(message(__FILE__ "(" MUTILS_MAKE_STRING(__LINE__) ") : warning: " TXT))
|
||||||
|
|
||||||
#define MUTILS_INIT_GLUE_HELPER(X,Y) X##Y
|
|
||||||
#define MUTILS_INIT_GLUE(X,Y) MUTILS_INIT_GLUE_HELPER(X,Y)
|
|
||||||
#define MUTILS_INITIALIZER MUTILS_INIT_GLUE(initialize_, MUTILS_INTERFACE)
|
|
||||||
|
|
||||||
/** \endcond INTERNAL
|
/** \endcond INTERNAL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -361,11 +367,11 @@ namespace MUtils
|
|||||||
*/
|
*/
|
||||||
MUTILS_API fp_parts_t break_fp(const double value);
|
MUTILS_API fp_parts_t break_fp(const double value);
|
||||||
|
|
||||||
//Internal
|
//Internal (do *not* call directly!)
|
||||||
namespace Internal
|
namespace Internal
|
||||||
{
|
{
|
||||||
MUTILS_API int MUTILS_INITIALIZER(const char *const buildKey, const bool debug);
|
MUTILS_API int MUTILS_INITIALIZER(const unsigned int interfaceId, const bool debugFlag, const char *const buildKey);
|
||||||
static const int s_initializedFlag = MUTILS_INITIALIZER(MUTILS_BUILD_KEY, MUTILS_DEBUG);
|
static const int s_initializedFlag = MUTILS_INITIALIZER(MUTILS_INTERFACE, MUTILS_DEBUG, MUTILS_BUILD_KEY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -905,16 +905,15 @@ MUtils::fp_parts_t MUtils::break_fp(const double value)
|
|||||||
// INITIALIZER
|
// INITIALIZER
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
int MUtils::Internal::MUTILS_INITIALIZER(const char *const buildKey, const bool debug)
|
int MUtils::Internal::MUTILS_INITIALIZER(const unsigned int interfaceId, const bool debugFlag, const char *const buildKey)
|
||||||
{
|
{
|
||||||
static const bool INTERNAL_DEBUG_FLAG = MUTILS_DEBUG;
|
#if (!MUTILS_DEBUG)
|
||||||
static const char *const INTERNAL_BUILD_KEY = MUTILS_BUILD_KEY;
|
if((interfaceId != static_cast<unsigned int>(MUTILS_INTERFACE)) || (debugFlag != static_cast<bool>(MUTILS_DEBUG)) || strncmp(buildKey, MUTILS_BUILD_KEY, 14))
|
||||||
|
|
||||||
if((debug != INTERNAL_DEBUG_FLAG) || strncmp(buildKey, INTERNAL_BUILD_KEY, 11))
|
|
||||||
{
|
{
|
||||||
MUtils::OS::system_message_err(L"MUtils", L"FATAL: MUtils library initialization has failed!");
|
OS::system_message_err(L"MUtils", L"ERROR: MUtils library initialization has failed!");
|
||||||
abort();
|
for(;;) _exit((int)0xC0000142);
|
||||||
}
|
}
|
||||||
|
#endif //MUTILS_DEBUG
|
||||||
|
|
||||||
volatile int _result = MUTILS_INTERFACE;
|
volatile int _result = MUTILS_INTERFACE;
|
||||||
return _result;
|
return _result;
|
||||||
|
Loading…
Reference in New Issue
Block a user