#define PANTHEIOS_NO_INCLUDE_OS_AND_3PTYLIB_STRING_ACCESS // Faster compilation
#include <pantheios/pantheios.hpp>
#include <pantheios/inserters/integer.hpp>
#include <stlsoft/stlsoft.h>
#include <exception>
#include <new>
#include <string>
#include <stdlib.h>
#include <limits.h>
PANTHEIOS_EXTERN_C const PAN_CHAR_T PANTHEIOS_FE_PROCESS_IDENTITY[] = PANTHEIOS_LITERAL_STRING("example.cpp.inserter.integer");
#define PSTR(x) PANTHEIOS_LITERAL_STRING(x)
#ifndef PANTHEIOS_OBSOLETE
# define PANTHEIOS_OBSOLETE
#endif
int main()
{
try
{
short shortMin = SHRT_MIN;
short shortMax = SHRT_MAX;
unsigned short ushortMax = USHRT_MAX;
int intMin = INT_MIN;
int intMax = INT_MAX;
unsigned int uintMax = UINT_MAX;
long longMin = LONG_MIN;
long longMax = LONG_MAX;
unsigned long ulongMax = ULONG_MAX;
stlsoft::sint32_t si32Val = -123;
stlsoft::uint32_t ui32Val = 456;
pantheios::log_NOTICE(PSTR("SHRT_MIN: ["), pantheios::integer(shortMin), PSTR("]"));
pantheios::log_NOTICE(PSTR("SHRT_MAX: ["), pantheios::integer(shortMax), PSTR("]"));
#ifdef PANTHEIOS_OBSOLETE // 2-parameter constructors are deprecated, and will be removed
pantheios::log_NOTICE(PSTR("USHRT_MAX: ["), pantheios::integer(ushortMax, pantheios::fmt::hex), PSTR("]"));
pantheios::log_NOTICE(PSTR("INT_MIN: ["), pantheios::integer(intMin, -20), PSTR("]"));
pantheios::log_NOTICE(PSTR("INT_MAX: ["), pantheios::integer(intMax, -20), PSTR("]"));
pantheios::log_NOTICE(PSTR("UINT_MAX: ["), pantheios::integer(uintMax, pantheios::fmt::hex | pantheios::fmt::zeroXPrefix), PSTR("]"));
pantheios::log_NOTICE(PSTR("LONG_MIN: ["), pantheios::integer(longMin, 20), PSTR("]"));
pantheios::log_NOTICE(PSTR("LONG_MAX: ["), pantheios::integer(longMax, 20), PSTR("]"));
#endif
pantheios::log_NOTICE(PSTR("USHRT_MAX: ["), pantheios::integer(ushortMax, 0, pantheios::fmt::hex), PSTR("]"));
pantheios::log_NOTICE(PSTR("INT_MIN: ["), pantheios::integer(intMin, -20, 0), PSTR("]"));
pantheios::log_NOTICE(PSTR("INT_MIN: ["), pantheios::integer(intMin, +20, 0), PSTR("]"));
pantheios::log_NOTICE(PSTR("INT_MAX: ["), pantheios::integer(intMax, -20, 0), PSTR("]"));
pantheios::log_NOTICE(PSTR("INT_MAX: ["), pantheios::integer(intMax, +20, 0), PSTR("]"));
pantheios::log_NOTICE(PSTR("UINT_MAX: ["), pantheios::integer(uintMax, 0, pantheios::fmt::hex | pantheios::fmt::zeroXPrefix), PSTR("]"));
pantheios::log_NOTICE(PSTR("UINT_MAX: ["), pantheios::integer(uintMax, -20, pantheios::fmt::hex | pantheios::fmt::zeroXPrefix), PSTR("]"));
pantheios::log_NOTICE(PSTR("UINT_MAX: ["), pantheios::integer(uintMax, +20, pantheios::fmt::hex | pantheios::fmt::zeroXPrefix), PSTR("]"));
pantheios::log_NOTICE(PSTR("UINT_MAX: ["), pantheios::integer(uintMax, -10, pantheios::fmt::hex | pantheios::fmt::zeroXPrefix), PSTR("]"));
pantheios::log_NOTICE(PSTR("UINT_MAX: ["), pantheios::integer(uintMax, +10, pantheios::fmt::hex | pantheios::fmt::zeroXPrefix), PSTR("]"));
pantheios::log_NOTICE(PSTR("UINT_MAX: ["), pantheios::integer(uintMax, -5, pantheios::fmt::hex | pantheios::fmt::zeroXPrefix), PSTR("]"));
pantheios::log_NOTICE(PSTR("UINT_MAX: ["), pantheios::integer(uintMax, +5, pantheios::fmt::hex | pantheios::fmt::zeroXPrefix), PSTR("]"));
pantheios::log_NOTICE(PSTR("LONG_MIN: ["), pantheios::integer(longMin, 20, 0), PSTR("]"));
pantheios::log_NOTICE(PSTR("LONG_MAX: ["), pantheios::integer(longMax, 20, 0), PSTR("]"));
pantheios::log_NOTICE(PSTR("LONG_MIN: ["), pantheios::integer(longMin, 10, 0), PSTR("]"));
pantheios::log_NOTICE(PSTR("LONG_MAX: ["), pantheios::integer(longMax, 10, 0), PSTR("]"));
pantheios::log_NOTICE(PSTR("LONG_MIN: ["), pantheios::integer(longMin, 5, 0), PSTR("]"));
pantheios::log_NOTICE(PSTR("LONG_MAX: ["), pantheios::integer(longMax, 5, 0), PSTR("]"));
pantheios::log_NOTICE(PSTR("ULONG_MAX: ["), pantheios::integer(ulongMax), PSTR("]"));
pantheios::log_NOTICE(PSTR("sint32_t: ["), pantheios::integer(si32Val), PSTR("]"));
pantheios::log_NOTICE(PSTR("uint32_t: ["), pantheios::integer(ui32Val, 8, 0), PSTR("]"));
return EXIT_SUCCESS;
}
catch(std::bad_alloc&)
{
pantheios::log(pantheios::alert, PSTR("out of memory"));
}
catch(std::exception& x)
{
pantheios::log_CRITICAL(PSTR("Exception: "), x);
}
catch(...)
{
pantheios::logputs(pantheios::emergency, PSTR("Unexpected unknown error"));
}
return EXIT_FAILURE;
}