10# if !defined(HPP_ALIB_LANG_PLATFORM_INCLUDES) && !defined(ALIB_DOX)
13# if ALIB_CAMP && !defined (HPP_ALIB_LANG_BASECAMP)
16# if ALIB_SINGLETONS && !defined (HPP_ALIB_SINGLETONS_SINGLETON)
19# if ALIB_BOXING && !defined (HPP_ALIB_BOXING_BOXING)
22# if ALIB_TIME && !defined (HPP_ALIB_TIME_TIME)
25# if ALIB_ENUMS && !defined (HPP_ALIB_ENUMS_RECORDS)
29# if ALIB_ALOX && !defined (HPP_ALIB_ALOXMODULE)
32# if ALIB_CONFIGURATION && !defined (HPP_ALIB_CONFIG_CONFIG)
35# if ALIB_CLI && !defined (HPP_ALIB_CLI_CLI)
38# if ALIB_EXPRESSIONS && !defined (HPP_ALIB_EXPRESSIONS_EXPRESSIONS)
41# if ALIB_FILES && !defined (HPP_ALIB_FILES_CAMP)
45# if ALIB_CAMP && !defined (HPP_ALIB_LANG_CAMP_BOOTSTRAP)
119 { 13,
"CONFIGURATION" },
120 { 14,
"EXPRESSIONS" },
122 { 16,
"FEAT_SINGLETON_MAPPED" },
123 { 17,
"CHARACTERS_WIDE" },
124 { 18,
"CHARACTERS_WCHAR_IS_4" },
125 { 19,
"FEAT_BOXING_BIJECTIVE_INTEGRALS" },
126 { 20,
"FEAT_BOXING_BIJECTIVE_CHARACTERS" },
127 { 21,
"FEAT_BOXING_BIJECTIVE_FLOATS" },
128 { 22,
"DEBUG_BOXING" },
129 { 23,
"DEBUG_STRINGS" },
130 { 24,
"DEBUG_MONOMEM" },
131 { 25,
"DEBUG_RESOURCES" },
133 { 27,
"DBG_LOG_CI" },
135 { 29,
"REL_LOG_CI" },
145 std::cerr <<
"!!! Error in ALox library compilation: linked against wrong version of ALib" << std::endl;
146 std::cerr <<
"!!! ALib library version: " <<
Version <<
"R" << int(
Revision) << std::endl;
147 std::cerr <<
"!!! ALib requested version: " << alibVersion <<
"R" << alibRevision << std::endl;
148 std::cerr <<
"!!! Exiting with exit(-1)" << std::endl;
159 std::cerr <<
"!!! Error in ALib library compilation: linked library of ALib has "
160 "different compiler symbols set than the using executable (or library)." << std::endl;
163 std::cerr << std::left << std::setw(35) <<
"Symbol" <<
'|' << std::setw(5) <<
" Lib" <<
'|' <<
" Comp. Unit" << std::endl;
164 std::cerr<< std::setw(62) << std::setfill(
'-') <<
' ' << std::endl << std::setfill(
' ');
169 bool reqFlag= (compilationFlags.
bits[p.Flag/8] & (1 << (p.Flag % 8))) != 0;
171 std::cerr << std::setw(35) << p.Name <<
'|' << std::setw(5) << (libFlag ?
" On" :
" Off")
172 <<
"|" << std::setw(5) << (reqFlag ?
" On" :
" Off")
173 << ( libFlag != reqFlag ?
" <-- Mismatch! " :
"")
178 std::cerr <<
"!!! Exiting with exit(-1)" << std::endl;
192#if (ALIB_DEBUG && !ALIB_THREADS && ALIB_EXT_LIB_THREADS_AVAILABLE) || defined(ALIB_DOX)
198# if !defined(ALIB_DOX)
199 namespace { std::thread::id threadSeen;
200 bool inSingleThreadedCheck=
false; }
228 if( inSingleThreadedCheck )
230 inSingleThreadedCheck=
true;
233 if( threadSeen == std::thread::id() )
235 threadSeen= std::this_thread::get_id();
236 inSingleThreadedCheck=
false;
240 if( threadSeen != std::this_thread::get_id() )
243 "A second thread was detected using a single-threaded compilation of "
244 "ALib! (Module 'Threads' not included in the ALib distribution)." )
246 inSingleThreadedCheck=
false;
261# if defined( _WIN32 ) && !defined(_STRING_)
269 int type,
const char* topic,
int qtyMsgs,
const char** msgs )
275void DbgSimpleALibMsg(
const char* file,
int line,
const char* method,
int type,
277 const char* msg1,
const char* msg2,
const char* msg3,
278 const char* msg4,
const char* msg5 )
282 int qtyMsgs= msg2 !=
nullptr ? (msg3 !=
nullptr ? (msg4 !=
nullptr ? (msg5 !=
nullptr ? 5 : 4) : 3) : 2) : 1;
283 const char* msgs[5]= { msg1, msg2, msg3, msg4, msg5 };
292 if( type == 0 ) std::cout <<
"ALib Error: ";
293 else if( type == 1 ) std::cout <<
"ALib WARNING: ";
294 else std::cout <<
"ALib Message(" << type <<
"): ";
302 bool illegalCharacterFound=
false;
304 auto strLen= strlen(msg1);
305 for(
size_t idx= 0 ; idx< strLen ; ++idx )
309 || ( c >=
'A' && c <=
'Z' )
316 illegalCharacterFound=
true;
321 if(!illegalCharacterFound)
323 std::cout << msg1 <<
": ";
329 for ( ; msgNo != qtyMsgs; ++msgNo )
330 std::cout << msgs[msgNo];
331 std::cout << std::endl;
332 std::cout <<
"At : " << file <<
':' << line <<
' ' << method <<
"()" << std::endl;
337void DbgSimpleALibMsg(
const char* file,
int line,
const char* method,
int type,
338 const char* topic,
const char* msg,
int intVal )
340 std::basic_string<char> sIntVal= std::to_string( intVal );
343 const char* msgs[2]= { msg, sIntVal.c_str() };
350 std::cout <<
"Error in '" << topic <<
"': ";
352 std::cout <<
"Warning in '" << topic <<
"' " <<
"(type=" << type <<
"): ";
353 std::cout << msg << sIntVal << std::endl;
354 std::cout <<
"At : " << file <<
':' << line <<
' ' << method <<
"()" << std::endl;
365#if !defined(HPP_ALIB_LANG_INTEGERS)
368#if !defined(_GLIBCXX_TYPE_TRAITS) || !defined(_TYPE_TRAITS_)
369# include <type_traits>
374static_assert(
sizeof(
alib::integer ) ==
sizeof(std::size_t ),
"Error in ALib type definitions" );
375static_assert(std::is_signed< alib::integer>::value == std::is_signed<std::ptrdiff_t >::value,
"Error in ALib type definitions" );
376static_assert(std::is_signed< alib::integer>::value != std::is_signed<std::size_t >::value,
"Error in ALib type definitions" );
377static_assert(std::is_signed<alib::uinteger>::value == std::is_signed<std::size_t >::value,
"Error in ALib type definitions" );
378static_assert(std::is_signed<alib::uinteger>::value != std::is_signed<std::ptrdiff_t >::value,
"Error in ALib type definitions" );
385#if ALIB_DEBUG && !defined(ALIB_DOX)
386# if !defined (HPP_ALIB_LANG_DBGTYPEDEMANGLER)
390# if defined(__GNUC__) || defined(__clang__)
395# if !defined(_GLIBCXX_CSTDLIB) && !defined(_CSTDLIB_)
399# if defined(_WIN32) && !defined(_CSTRING_)
405 #if defined(__GNUC__) || defined(__clang__)
410 name= abi::__cxa_demangle( typeInfo.name(),
nullptr,
nullptr, &status);
417 std::free(
static_cast<void*
>(
const_cast<char*
>(name) ) );
428 name= typeInfo.name();
429 if (std::strncmp( name,
"class ", 6) == 0)
ALIB_API const char * Get()
ALIB_API ~DbgTypeDemangler()
ALIB_API DbgTypeDemangler(const std::type_info &typeInfo)
#define ALIB_IF_TIME(...)
#define ALIB_IF_BOXING(...)
#define ALIB_IF_SINGLETONS(...)
#define ALIB_IF_THREADS(...)
#define ALIB_WARNINGS_RESTORE
#define ALIB_IF_ENUMS(...)
#define ALIB_WARNINGS_ALLOW_UNSAFE_BUFFER_USAGE
ALIB_API void Bootstrap()
void(* DBG_SIMPLE_ALIB_MSG_PLUGIN)(const char *file, int line, const char *method, int type, const char *topic, int qtyMsgs, const char **msgs)
ALIB_API void DbgSimpleALibMsg(const char *file, int line, const char *method, int type, const char *topic, const char *msg1=nullptr, const char *msg2=nullptr, const char *msg3=nullptr, const char *msg4=nullptr, const char *msg5=nullptr)
@ Destruct
The main phase of termination that destructs everything.
ALIB_WARNINGS_ALLOW_UNSAFE_BUFFER_USAGE void AssertALibVersionAndFlags(int alibVersion, int alibRevision, TCompilationFlags compilationFlags)
lang::uinteger uinteger
Type alias in namespace alib.
ALIB_API List< lang::Camp * > Camps
void DbgCheckSingleThreaded()
@ Final
The final initialization phase.
bool NonCampModulesInitialized
ALIB_WARNINGS_ALLOW_UNSAFE_BUFFER_USAGE TCompilationFlags CompilationFlags
void BootstrapAddDefaultCamps()
ALIB_WARNINGS_RESTORE void Bootstrap(int alibVersion, int alibRevision, TCompilationFlags compilationFlags)
CompilationFlagMeaningsEntry CompilationFlagMeanings[30]
lang::integer integer
Type alias in namespace alib.
unsigned char bits[4]
The Flags.