diff --git a/CMakeLists.txt b/CMakeLists.txt index ebee14b66..9381f357f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -138,8 +138,13 @@ macro(CMAKE_HANDLE_SYSTEM_LIBRARIES) option(CMAKE_USE_SYSTEM_FORM "Use system-installed libform" "${CMAKE_USE_SYSTEM_LIBRARY_FORM}") option(CMAKE_USE_SYSTEM_JSONCPP "Use system-installed jsoncpp" "${CMAKE_USE_SYSTEM_LIBRARY_JSONCPP}") + # For now use system KWIML only if explicitly requested rather + # than activating via the general system libs options. + option(CMAKE_USE_SYSTEM_KWIML "Use system-installed KWIML" OFF) + mark_as_advanced(CMAKE_USE_SYSTEM_KWIML) + # Mention to the user what system libraries are being used. - foreach(util ${UTILITIES}) + foreach(util ${UTILITIES} KWIML) if(CMAKE_USE_SYSTEM_${util}) message(STATUS "Using system-installed ${util}") endif() @@ -270,6 +275,20 @@ macro (CMAKE_BUILD_UTILITIES) # (a macro defined in this file) CMAKE_HANDLE_SYSTEM_LIBRARIES() + if(CMAKE_USE_SYSTEM_KWIML) + find_package(KWIML 1.0) + if(NOT KWIML_FOUND) + message(FATAL_ERROR "CMAKE_USE_SYSTEM_KWIML is ON but KWIML is not found!") + endif() + set(CMake_KWIML_LIBRARIES kwiml::kwiml) + else() + set(CMake_KWIML_LIBRARIES "") + if(BUILD_TESTING) + set(KWIML_TEST_ENABLE 1) + endif() + add_subdirectory(Utilities/KWIML) + endif() + #--------------------------------------------------------------------- # Build zlib library for Curl, CMake, and CTest. set(CMAKE_ZLIB_HEADER "cm_zlib.h") @@ -538,10 +557,10 @@ if("x${CMAKE_TESTS_CDASH_SERVER}" STREQUAL "x") set(CMAKE_TESTS_CDASH_SERVER "http://open.cdash.org") endif() -# Create the KWIML library for CMake. -set(KWIML cmIML) -set(KWIML_HEADER_ROOT ${CMake_BINARY_DIR}/Utilities) -add_subdirectory(Utilities/KWIML) +if(CMake_TEST_EXTERNAL_CMAKE) + set(KWIML_TEST_ENABLE 1) + add_subdirectory(Utilities/KWIML) +endif() if(NOT CMake_TEST_EXTERNAL_CMAKE) # build the utilities (a macro defined in this file) diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index 2adf317a6..db64559bb 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -36,7 +36,7 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION "LINK : warning LNK4089: all references to.*SHELL32.dll.*discarded by /OPT:REF" "LINK : warning LNK4089: all references to.*USER32.dll.*discarded by /OPT:REF" "LINK : warning LNK4089: all references to.*ole32.dll.*discarded by /OPT:REF" - "Warning.*: .*/Utilities/KWIML/test/test_INT_format.h.* # Redundant preprocessing concatenation" + "Warning.*: .*/Utilities/KWIML/test/test_int_format.h.* # Redundant preprocessing concatenation" "Warning: library was too large for page size.*" "Warning: public.*_archive_.*in module.*archive_*clashes with prior module.*archive_.*" "Warning: public.*BZ2_bz.*in module.*bzlib.*clashes with prior module.*bzlib.*" diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index f23331bec..ab70568d3 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -566,6 +566,7 @@ target_link_libraries(CMakeLib cmsys ${CMAKE_TAR_LIBRARIES} ${CMAKE_COMPRESS_LIBRARIES} ${CMAKE_CURL_LIBRARIES} ${CMAKE_JSONCPP_LIBRARIES} + ${CMake_KWIML_LIBRARIES} ) # On Apple we need CoreFoundation diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index bda933bc3..ef607d212 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -162,13 +162,13 @@ struct cmRange const_iterator end() const { return End; } bool empty() const { return std::distance(Begin, End) == 0; } difference_type size() const { return std::distance(Begin, End); } - cmRange& advance(cmIML_INT_intptr_t amount) + cmRange& advance(KWIML_INT_intptr_t amount) { std::advance(Begin, amount); return *this; } - cmRange& retreat(cmIML_INT_intptr_t amount) + cmRange& retreat(KWIML_INT_intptr_t amount) { std::advance(End, -amount); return *this; diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx index fda6e023d..b480cd53b 100644 --- a/Source/cmELF.cxx +++ b/Source/cmELF.cxx @@ -15,9 +15,6 @@ #include #include -// Need the native byte order of the running CPU. -#include - // Include the ELF format information system header. #if defined(__OpenBSD__) # include @@ -101,9 +98,9 @@ public: // In most cases the processor-specific byte order will match that // of the target execution environment. If we choose wrong here // it is fixed when the header is read. -#if cmIML_ABI_ENDIAN_ID == cmIML_ABI_ENDIAN_ID_LITTLE +#if KWIML_ABI_ENDIAN_ID == KWIML_ABI_ENDIAN_ID_LITTLE this->NeedSwap = (this->ByteOrder == ByteOrderMSB); -#elif cmIML_ABI_ENDIAN_ID == cmIML_ABI_ENDIAN_ID_BIG +#elif KWIML_ABI_ENDIAN_ID == KWIML_ABI_ENDIAN_ID_BIG this->NeedSwap = (this->ByteOrder == ByteOrderLSB); #else this->NeedSwap = false; // Final decision is at runtime anyway. @@ -197,7 +194,7 @@ struct cmELFTypes32 typedef Elf32_Shdr ELF_Shdr; typedef Elf32_Dyn ELF_Dyn; typedef Elf32_Half ELF_Half; - typedef cmIML_INT_uint32_t tagtype; + typedef KWIML_INT_uint32_t tagtype; static const char* GetName() { return "32-bit"; } }; @@ -208,7 +205,7 @@ struct cmELFTypes64 typedef Elf64_Shdr ELF_Shdr; typedef Elf64_Dyn ELF_Dyn; typedef Elf64_Half ELF_Half; - typedef cmIML_INT_uint64_t tagtype; + typedef KWIML_INT_uint64_t tagtype; static const char* GetName() { return "64-bit"; } }; diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index df95d9dd6..b3557f9a2 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -2811,8 +2811,8 @@ namespace { case CURLINFO_SSL_DATA_OUT: { char buf[128]; - int n = sprintf(buf, "[%" cmIML_INT_PRIu64 " bytes data]\n", - static_cast(size)); + int n = sprintf(buf, "[%" KWIML_INT_PRIu64 " bytes data]\n", + static_cast(size)); if (n > 0) { vec->insert(vec->end(), buf, buf + n); diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h index 3eee40421..8bfd4051e 100644 --- a/Source/cmFindPackageCommand.h +++ b/Source/cmFindPackageCommand.h @@ -130,7 +130,7 @@ private: unsigned int VersionFoundPatch; unsigned int VersionFoundTweak; unsigned int VersionFoundCount; - cmIML_INT_uint64_t RequiredCMakeVersion; + KWIML_INT_uint64_t RequiredCMakeVersion; bool Quiet; bool Required; bool UseConfigFiles; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 6a57374f0..1d17032d8 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2980,7 +2980,7 @@ cmLocalGenerator::GetTargetDirectory(const cmGeneratorTarget*) const } //---------------------------------------------------------------------------- -cmIML_INT_uint64_t cmLocalGenerator::GetBackwardsCompatibility() +KWIML_INT_uint64_t cmLocalGenerator::GetBackwardsCompatibility() { // The computed version may change until the project is fully // configured. @@ -3033,7 +3033,7 @@ bool cmLocalGenerator::NeedBackwardsCompatibility_2_4() // Compatibility is needed if CMAKE_BACKWARDS_COMPATIBILITY is set // equal to or lower than the given version. - cmIML_INT_uint64_t actual_compat = this->GetBackwardsCompatibility(); + KWIML_INT_uint64_t actual_compat = this->GetBackwardsCompatibility(); return (actual_compat && actual_compat <= CMake_VERSION_ENCODE(2, 4, 255)); } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index e2f551976..68e766741 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -267,7 +267,7 @@ public: * * and is monotonically increasing with the CMake version. */ - cmIML_INT_uint64_t GetBackwardsCompatibility(); + KWIML_INT_uint64_t GetBackwardsCompatibility(); /** * Test whether compatibility is set to a given version or lower. @@ -390,7 +390,7 @@ protected: // committed. std::string TargetImplib; - cmIML_INT_uint64_t BackwardsCompatibility; + KWIML_INT_uint64_t BackwardsCompatibility; bool BackwardsCompatibilityFinal; private: void AddSharedFlags(std::string& flags, const std::string& lang, diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h index aed2e7456..272c1361d 100644 --- a/Source/cmStandardIncludes.h +++ b/Source/cmStandardIncludes.h @@ -31,7 +31,7 @@ #endif // Provide fixed-size integer types. -#include +#include #include #include diff --git a/Source/cmVersion.h b/Source/cmVersion.h index 0ab639051..84f750f19 100644 --- a/Source/cmVersion.h +++ b/Source/cmVersion.h @@ -34,7 +34,7 @@ public: /* Encode with room for up to 1000 minor releases between major releases and to encode dates until the year 10000 in the patch level. */ -#define CMake_VERSION_ENCODE__BASE cmIML_INT_UINT64_C(100000000) +#define CMake_VERSION_ENCODE__BASE KWIML_INT_UINT64_C(100000000) #define CMake_VERSION_ENCODE(major, minor, patch) \ ((((major) * 1000u) * CMake_VERSION_ENCODE__BASE) + \ (((minor) % 1000u) * CMake_VERSION_ENCODE__BASE) + \ diff --git a/Source/cm_sha2.c b/Source/cm_sha2.c index b90e060ef..649c39aaf 100644 --- a/Source/cm_sha2.c +++ b/Source/cm_sha2.c @@ -87,22 +87,21 @@ * made). */ #if !defined(BYTE_ORDER) || (BYTE_ORDER != LITTLE_ENDIAN && BYTE_ORDER != BIG_ENDIAN) -/* CMake modification: use byte order from cmIML. */ -# include "cmIML/ABI.h" +/* CMake modification: use byte order from KWIML. */ # undef BYTE_ORDER # undef BIG_ENDIAN # undef LITTLE_ENDIAN -# define BYTE_ORDER cmIML_ABI_ENDIAN_ID -# define BIG_ENDIAN cmIML_ABI_ENDIAN_ID_BIG -# define LITTLE_ENDIAN cmIML_ABI_ENDIAN_ID_LITTLE +# define BYTE_ORDER KWIML_ABI_ENDIAN_ID +# define BIG_ENDIAN KWIML_ABI_ENDIAN_ID_BIG +# define LITTLE_ENDIAN KWIML_ABI_ENDIAN_ID_LITTLE #endif /* CMake modification: use types computed in header. */ typedef cm_sha2_uint8_t sha_byte; /* Exactly 1 byte */ typedef cm_sha2_uint32_t sha_word32; /* Exactly 4 bytes */ typedef cm_sha2_uint64_t sha_word64; /* Exactly 8 bytes */ -#define SHA_UINT32_C(x) cmIML_INT_UINT32_C(x) -#define SHA_UINT64_C(x) cmIML_INT_UINT64_C(x) +#define SHA_UINT32_C(x) KWIML_INT_UINT32_C(x) +#define SHA_UINT64_C(x) KWIML_INT_UINT64_C(x) #if defined(__clang__) # pragma clang diagnostic ignored "-Wcast-align" #endif diff --git a/Source/cm_sha2.h b/Source/cm_sha2.h index 71395f06b..f1510318c 100644 --- a/Source/cm_sha2.h +++ b/Source/cm_sha2.h @@ -38,11 +38,11 @@ #include "cm_sha2_mangle.h" -/* CMake modification: use integer types from cmIML. */ -#include "cmIML/INT.h" -typedef cmIML_INT_uint8_t cm_sha2_uint8_t; -typedef cmIML_INT_uint32_t cm_sha2_uint32_t; -typedef cmIML_INT_uint64_t cm_sha2_uint64_t; +/* CMake modification: use integer types from KWIML. */ +#include +typedef KWIML_INT_uint8_t cm_sha2_uint8_t; +typedef KWIML_INT_uint32_t cm_sha2_uint32_t; +typedef KWIML_INT_uint64_t cm_sha2_uint64_t; #ifdef __cplusplus extern "C" { diff --git a/Utilities/KWIML/.gitattributes b/Utilities/KWIML/.gitattributes new file mode 100644 index 000000000..ecbf2196c --- /dev/null +++ b/Utilities/KWIML/.gitattributes @@ -0,0 +1 @@ +*.md conflict-marker-size=78 diff --git a/Utilities/KWIML/ABI.h.in b/Utilities/KWIML/ABI.h.in deleted file mode 100644 index 87b6e96da..000000000 --- a/Utilities/KWIML/ABI.h.in +++ /dev/null @@ -1,506 +0,0 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Kitware, Inc. nor the names of its contributors - may be used to endorse or promote products derived from this - software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -============================================================================*/ -#ifndef @KWIML@_ABI_H -#define @KWIML@_ABI_H -/* -This header defines macros with information about the C ABI. -Only information that can be determined using the preprocessor at -compilation time is available. No try-compile results may be added -here. Instead we memorize results on platforms of interest. - -An includer may optionally define the following macros to suppress errors: - - @KWIML@_ABI_NO_VERIFY = skip verification declarations - @KWIML@_ABI_NO_ERROR_CHAR_SIGN = signedness of 'char' may be unknown - @KWIML@_ABI_NO_ERROR_LONG_LONG = existence of 'long long' may be unknown - @KWIML@_ABI_NO_ERROR_ENDIAN = byte order of CPU may be unknown - -An includer may test the following macros after inclusion: - - @KWIML@_ABI_SIZEOF_DATA_PTR = sizeof(void*) - @KWIML@_ABI_SIZEOF_CODE_PTR = sizeof(void(*)(void)) - @KWIML@_ABI_SIZEOF_FLOAT = sizeof(float) - @KWIML@_ABI_SIZEOF_DOUBLE = sizeof(double) - @KWIML@_ABI_SIZEOF_CHAR = sizeof(char) - @KWIML@_ABI_SIZEOF_SHORT = sizeof(short) - @KWIML@_ABI_SIZEOF_INT = sizeof(int) - @KWIML@_ABI_SIZEOF_LONG = sizeof(long) - - @KWIML@_ABI_SIZEOF_LONG_LONG = sizeof(long long) or 0 if not a type - Undefined if existence is unknown and error suppression macro - @KWIML@_ABI_NO_ERROR_LONG_LONG was defined. - - @KWIML@_ABI_SIZEOF___INT64 = 8 if '__int64' exists or 0 if not - Undefined if existence is unknown. - - @KWIML@_ABI___INT64_IS_LONG = 1 if '__int64' is 'long' (same type) - Undefined otherwise. - @KWIML@_ABI___INT64_IS_LONG_LONG = 1 if '__int64' is 'long long' (same type) - Undefined otherwise. - @KWIML@_ABI___INT64_IS_UNIQUE = 1 if '__int64' is a distinct type - Undefined otherwise. - - @KWIML@_ABI_CHAR_IS_UNSIGNED = 1 if 'char' is unsigned, else undefined - @KWIML@_ABI_CHAR_IS_SIGNED = 1 if 'char' is signed, else undefined - One of these is defined unless signedness of 'char' is unknown and - error suppression macro @KWIML@_ABI_NO_ERROR_CHAR_SIGN was defined. - - @KWIML@_ABI_ENDIAN_ID_BIG = id for big-endian (always defined) - @KWIML@_ABI_ENDIAN_ID_LITTLE = id for little-endian (always defined) - @KWIML@_ABI_ENDIAN_ID = id of byte order of target CPU - Defined to @KWIML@_ABI_ENDIAN_ID_BIG or @KWIML@_ABI_ENDIAN_ID_LITTLE - unless byte order is unknown and error suppression macro - @KWIML@_ABI_NO_ERROR_ENDIAN was defined. - -We verify most results using dummy "extern" declarations that are -invalid if the macros are wrong. Verification is disabled if -suppression macro @KWIML@_ABI_NO_VERIFY was defined. -*/ - -/*--------------------------------------------------------------------------*/ -#if !defined(@KWIML@_ABI_SIZEOF_DATA_PTR) -# if defined(__SIZEOF_POINTER__) -# define @KWIML@_ABI_SIZEOF_DATA_PTR __SIZEOF_POINTER__ -# elif defined(_SIZE_PTR) -# define @KWIML@_ABI_SIZEOF_DATA_PTR (_SIZE_PTR >> 3) -# elif defined(_LP64) || defined(__LP64__) -# define @KWIML@_ABI_SIZEOF_DATA_PTR 8 -# elif defined(_ILP32) -# define @KWIML@_ABI_SIZEOF_DATA_PTR 4 -# elif defined(__64BIT__) /* IBM XL */ -# define @KWIML@_ABI_SIZEOF_DATA_PTR 8 -# elif defined(_M_X64) -# define @KWIML@_ABI_SIZEOF_DATA_PTR 8 -# elif defined(__ia64) -# define @KWIML@_ABI_SIZEOF_DATA_PTR 8 -# elif defined(__sparcv9) -# define @KWIML@_ABI_SIZEOF_DATA_PTR 8 -# elif defined(__x86_64) || defined(__x86_64__) -# define @KWIML@_ABI_SIZEOF_DATA_PTR 8 -# elif defined(__amd64) || defined(__amd64__) -# define @KWIML@_ABI_SIZEOF_DATA_PTR 8 -# elif defined(__i386) || defined(__i386__) -# define @KWIML@_ABI_SIZEOF_DATA_PTR 4 -# endif -#endif -#if !defined(@KWIML@_ABI_SIZEOF_DATA_PTR) -# define @KWIML@_ABI_SIZEOF_DATA_PTR 4 -#endif -#if !defined(@KWIML@_ABI_SIZEOF_CODE_PTR) -# define @KWIML@_ABI_SIZEOF_CODE_PTR @KWIML@_ABI_SIZEOF_DATA_PTR -#endif - -/*--------------------------------------------------------------------------*/ -#if !defined(@KWIML@_ABI_SIZEOF_CHAR) -# define @KWIML@_ABI_SIZEOF_CHAR 1 -#endif - -#if !defined(@KWIML@_ABI_CHAR_IS_UNSIGNED) && !defined(@KWIML@_ABI_CHAR_IS_SIGNED) -# if defined(__CHAR_UNSIGNED__) /* GNU, some IBM XL, others? */ -# define @KWIML@_ABI_CHAR_IS_UNSIGNED 1 -# elif defined(_CHAR_UNSIGNED) /* Intel, IBM XL, MSVC, Borland, others? */ -# define @KWIML@_ABI_CHAR_IS_UNSIGNED 1 -# elif defined(_CHAR_SIGNED) /* IBM XL, others? */ -# define @KWIML@_ABI_CHAR_IS_SIGNED 1 -# elif defined(__CHAR_SIGNED__) /* IBM XL, Watcom, others? */ -# define @KWIML@_ABI_CHAR_IS_SIGNED 1 -# elif defined(__SIGNED_CHARS__) /* EDG, Intel, SGI MIPSpro */ -# define @KWIML@_ABI_CHAR_IS_SIGNED 1 -# elif defined(_CHAR_IS_SIGNED) /* Some SunPro, others? */ -# define @KWIML@_ABI_CHAR_IS_SIGNED 1 -# elif defined(_CHAR_IS_UNSIGNED) /* SunPro, others? */ -# define @KWIML@_ABI_CHAR_IS_UNSIGNED 1 -# elif defined(__GNUC__) /* GNU default */ -# define @KWIML@_ABI_CHAR_IS_SIGNED 1 -# elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* SunPro default */ -# define @KWIML@_ABI_CHAR_IS_SIGNED 1 -# elif defined(__HP_cc) || defined(__HP_aCC) /* HP default (unless +uc) */ -# define @KWIML@_ABI_CHAR_IS_SIGNED 1 -# elif defined(_SGI_COMPILER_VERSION) /* SGI MIPSpro default */ -# define @KWIML@_ABI_CHAR_IS_UNSIGNED 1 -# elif defined(__PGIC__) /* PGI default */ -# define @KWIML@_ABI_CHAR_IS_SIGNED 1 -# elif defined(_MSC_VER) /* MSVC default */ -# define @KWIML@_ABI_CHAR_IS_SIGNED 1 -# elif defined(__WATCOMC__) /* Watcom default */ -# define @KWIML@_ABI_CHAR_IS_UNSIGNED 1 -# elif defined(__BORLANDC__) /* Borland default */ -# define @KWIML@_ABI_CHAR_IS_SIGNED 1 -# elif defined(__hpux) /* Old HP: no __HP_cc/__HP_aCC/__GNUC__ above */ -# define @KWIML@_ABI_CHAR_IS_SIGNED 1 /* (unless +uc) */ -# endif -#endif -#if !defined(@KWIML@_ABI_CHAR_IS_UNSIGNED) && !defined(@KWIML@_ABI_CHAR_IS_SIGNED) \ - && !defined(@KWIML@_ABI_NO_ERROR_CHAR_SIGN) -# error "Signedness of 'char' unknown." -#endif - -/*--------------------------------------------------------------------------*/ -#if !defined(@KWIML@_ABI_SIZEOF_SHORT) -# if defined(__SIZEOF_SHORT__) -# define @KWIML@_ABI_SIZEOF_SHORT __SIZEOF_SHORT__ -# endif -#endif -#if !defined(@KWIML@_ABI_SIZEOF_SHORT) -# define @KWIML@_ABI_SIZEOF_SHORT 2 -#endif - -/*--------------------------------------------------------------------------*/ -#if !defined(@KWIML@_ABI_SIZEOF_INT) -# if defined(__SIZEOF_INT__) -# define @KWIML@_ABI_SIZEOF_INT __SIZEOF_INT__ -# elif defined(_SIZE_INT) -# define @KWIML@_ABI_SIZEOF_INT (_SIZE_INT >> 3) -# endif -#endif -#if !defined(@KWIML@_ABI_SIZEOF_INT) -# define @KWIML@_ABI_SIZEOF_INT 4 -#endif - -/*--------------------------------------------------------------------------*/ -#if !defined(@KWIML@_ABI_SIZEOF_LONG) -# if defined(__SIZEOF_LONG__) -# define @KWIML@_ABI_SIZEOF_LONG __SIZEOF_LONG__ -# elif defined(_SIZE_LONG) -# define @KWIML@_ABI_SIZEOF_LONG (_SIZE_LONG >> 3) -# elif defined(__LONG_MAX__) -# if __LONG_MAX__ == 0x7fffffff -# define @KWIML@_ABI_SIZEOF_LONG 4 -# elif __LONG_MAX__>>32 == 0x7fffffff -# define @KWIML@_ABI_SIZEOF_LONG 8 -# endif -# elif defined(_MSC_VER) /* MSVC and Intel on Windows */ -# define @KWIML@_ABI_SIZEOF_LONG 4 -# endif -#endif -#if !defined(@KWIML@_ABI_SIZEOF_LONG) -# define @KWIML@_ABI_SIZEOF_LONG @KWIML@_ABI_SIZEOF_DATA_PTR -#endif - -/*--------------------------------------------------------------------------*/ -#if !defined(@KWIML@_ABI_SIZEOF_LONG_LONG) -# if defined(__SIZEOF_LONG_LONG__) -# define @KWIML@_ABI_SIZEOF_LONG_LONG __SIZEOF_LONG_LONG__ -# elif defined(__LONG_LONG_MAX__) -# if __LONG_LONG_MAX__ == 0x7fffffff -# define @KWIML@_ABI_SIZEOF_LONG_LONG 4 -# elif __LONG_LONG_MAX__>>32 == 0x7fffffff -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# endif -# endif -#endif -#if !defined(@KWIML@_ABI_SIZEOF_LONG_LONG) -# if defined(_LONGLONG) /* SGI, some GNU, perhaps others. */ \ - && !defined(_MSC_VER) -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# elif defined(_LONG_LONG) /* IBM XL, perhaps others. */ -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# elif defined(__NO_LONG_LONG) /* EDG */ -# define @KWIML@_ABI_SIZEOF_LONG_LONG 0 -# elif defined(__cplusplus) && __cplusplus > 199711L /* C++0x */ -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* SunPro */ -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# elif defined(__HP_cc) || defined(__HP_aCC) /* HP */ -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# elif defined(__PGIC__) /* PGI */ -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# elif defined(__WATCOMC__) /* Watcom */ -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# elif defined(__INTEL_COMPILER) /* Intel */ -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# elif defined(__BORLANDC__) /* Borland */ -# if __BORLANDC__ >= 0x0560 -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# else -# define @KWIML@_ABI_SIZEOF_LONG_LONG 0 -# endif -# elif defined(_MSC_VER) /* Microsoft */ -# if _MSC_VER >= 1310 -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# else -# define @KWIML@_ABI_SIZEOF_LONG_LONG 0 -# endif -# elif defined(__GNUC__) /* GNU */ -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# elif defined(__hpux) /* Old HP: no __HP_cc/__HP_aCC/__GNUC__ above */ -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# endif -#endif -#if !defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && !defined(@KWIML@_ABI_NO_ERROR_LONG_LONG) -# error "Existence of 'long long' unknown." -#endif - -/*--------------------------------------------------------------------------*/ -#if !defined(@KWIML@_ABI_SIZEOF___INT64) -# if defined(__INTEL_COMPILER) -# define @KWIML@_ABI_SIZEOF___INT64 8 -# elif defined(_MSC_VER) -# define @KWIML@_ABI_SIZEOF___INT64 8 -# elif defined(__BORLANDC__) -# define @KWIML@_ABI_SIZEOF___INT64 8 -# else -# define @KWIML@_ABI_SIZEOF___INT64 0 -# endif -#endif - -#if defined(@KWIML@_ABI_SIZEOF___INT64) && @KWIML@_ABI_SIZEOF___INT64 > 0 -# if @KWIML@_ABI_SIZEOF_LONG == 8 -# define @KWIML@_ABI___INT64_IS_LONG 1 -# elif defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG == 8 -# define @KWIML@_ABI___INT64_IS_LONG_LONG 1 -# else -# define @KWIML@_ABI___INT64_IS_UNIQUE 1 -# endif -#endif - -/*--------------------------------------------------------------------------*/ -#if !defined(@KWIML@_ABI_SIZEOF_FLOAT) -# if defined(__SIZEOF_FLOAT__) -# define @KWIML@_ABI_SIZEOF_FLOAT __SIZEOF_FLOAT__ -# endif -#endif -#if !defined(@KWIML@_ABI_SIZEOF_FLOAT) -# define @KWIML@_ABI_SIZEOF_FLOAT 4 -#endif - -/*--------------------------------------------------------------------------*/ -#if !defined(@KWIML@_ABI_SIZEOF_DOUBLE) -# if defined(__SIZEOF_DOUBLE__) -# define @KWIML@_ABI_SIZEOF_DOUBLE __SIZEOF_DOUBLE__ -# endif -#endif -#if !defined(@KWIML@_ABI_SIZEOF_DOUBLE) -# define @KWIML@_ABI_SIZEOF_DOUBLE 8 -#endif - -/*--------------------------------------------------------------------------*/ -/* Identify possible endian cases. The macro @KWIML@_ABI_ENDIAN_ID will be - defined to one of these, or undefined if unknown. */ -#if !defined(@KWIML@_ABI_ENDIAN_ID_BIG) -# define @KWIML@_ABI_ENDIAN_ID_BIG 4321 -#endif -#if !defined(@KWIML@_ABI_ENDIAN_ID_LITTLE) -# define @KWIML@_ABI_ENDIAN_ID_LITTLE 1234 -#endif -#if @KWIML@_ABI_ENDIAN_ID_BIG == @KWIML@_ABI_ENDIAN_ID_LITTLE -# error "@KWIML@_ABI_ENDIAN_ID_BIG == @KWIML@_ABI_ENDIAN_ID_LITTLE" -#endif - -#if defined(@KWIML@_ABI_ENDIAN_ID) /* Skip #elif cases if already defined. */ - -/* Use dedicated symbols if the compiler defines them. Do this first - because some architectures allow runtime byte order selection by - the operating system (values for such architectures below are - guesses for compilers that do not define a dedicated symbol). - Ensure that only one is defined in case the platform or a header - defines both as possible values for some third symbol. */ -#elif defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG -#elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE -#elif defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG -#elif defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE - -/* Alpha */ -#elif defined(__alpha) || defined(__alpha__) || defined(_M_ALPHA) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE - -/* Arm */ -#elif defined(__arm__) -# if !defined(__ARMEB__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE -# else -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG -# endif - -/* Intel x86 */ -#elif defined(__i386) || defined(__i386__) || defined(_M_IX86) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE -#elif defined(_X86_) || defined(__THW_INTEL__) || defined(__I86__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE -#elif defined(__MWERKS__) && defined(__INTEL__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE - -/* Intel x86-64 */ -#elif defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE -#elif defined(__amd64) || defined(__amd64__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE - -/* Intel Architecture-64 (Itanium) */ -#elif defined(__ia64) || defined(__ia64__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE -#elif defined(_IA64) || defined(__IA64__) || defined(_M_IA64) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE - -/* PowerPC */ -#elif defined(__powerpc) || defined(__powerpc__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG -#elif defined(__ppc) || defined(__ppc__) || defined(__POWERPC__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* SPARC */ -#elif defined(__sparc) || defined(__sparc__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* HP/PA RISC */ -#elif defined(__hppa) || defined(__hppa__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* Motorola 68k */ -#elif defined(__m68k__) || defined(M68000) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* MIPSel (MIPS little endian) */ -#elif defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE - -/* MIPSeb (MIPS big endian) */ -#elif defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* MIPS (fallback, big endian) */ -#elif defined(__mips) || defined(__mips__) || defined(__MIPS__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* NIOS2 */ -#elif defined(__NIOS2__) || defined(__NIOS2) || defined(__nios2__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE - -/* OpenRISC 1000 */ -#elif defined(__or1k__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* RS/6000 */ -#elif defined(__THW_RS600) || defined(_IBMR2) || defined(_POWER) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG -#elif defined(_ARCH_PWR) || defined(_ARCH_PWR2) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* System/370 */ -#elif defined(__370__) || defined(__THW_370__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* System/390 */ -#elif defined(__s390__) || defined(__s390x__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* z/Architecture */ -#elif defined(__SYSC_ZARCH__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* VAX */ -#elif defined(__vax__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* Aarch64 */ -#elif defined(__aarch64__) -# if !defined(__AARCH64EB__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE -# else -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG -# endif - -/* Xtensa */ -#elif defined(__XTENSA_EB__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG -#elif defined(__XTENSA_EL__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE - -/* Unknown CPU */ -#elif !defined(@KWIML@_ABI_NO_ERROR_ENDIAN) -# error "Byte order of target CPU unknown." -#endif - -/*--------------------------------------------------------------------------*/ -#if !defined(@KWIML@_ABI_NO_VERIFY) -#define @KWIML@_ABI__VERIFY(n, x, y) extern int (*n)[x]; extern int (*n)[y] -#define @KWIML@_ABI__VERIFY2(n, x, y) extern int (*n)(x*); extern int (*n)(y*) -#if defined(__cplusplus) -# define @KWIML@_ABI__VERIFY3(n, x, y) extern int* n(x*); extern char* n(y*) -#else -# define @KWIML@_ABI__VERIFY3(n, x, y) extern int* n(x*) /* TODO: possible? */ -#endif -#define @KWIML@_ABI__VERIFY_BOOL(m, b) @KWIML@_ABI__VERIFY(m##__VERIFY__, 2, (b)?2:3) -#define @KWIML@_ABI__VERIFY_SIZE(m, t) @KWIML@_ABI__VERIFY(m##__VERIFY__, m, sizeof(t)) -#define @KWIML@_ABI__VERIFY_SAME(m, x, y) @KWIML@_ABI__VERIFY2(m##__VERIFY__, x, y) -#define @KWIML@_ABI__VERIFY_DIFF(m, x, y) @KWIML@_ABI__VERIFY3(m##__VERIFY__, x, y) - -@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_DATA_PTR, int*); -@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_CODE_PTR, int(*)(int)); -@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_CHAR, char); -@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_SHORT, short); -@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_INT, int); -@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_LONG, long); -#if defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG > 0 -@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_LONG_LONG, long long); -#endif -#if defined(@KWIML@_ABI_SIZEOF___INT64) && @KWIML@_ABI_SIZEOF___INT64 > 0 -@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF___INT64, __int64); -#endif -@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_FLOAT, float); -@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_DOUBLE, double); - -#if defined(@KWIML@_ABI___INT64_IS_LONG) -@KWIML@_ABI__VERIFY_SAME(@KWIML@_ABI___INT64_IS_LONG, __int64, long); -#elif defined(@KWIML@_ABI___INT64_IS_LONG_LONG) -@KWIML@_ABI__VERIFY_SAME(@KWIML@_ABI___INT64_IS_LONG_LONG, __int64, long long); -#elif defined(@KWIML@_ABI_SIZEOF___INT64) && @KWIML@_ABI_SIZEOF___INT64 > 0 -@KWIML@_ABI__VERIFY_DIFF(@KWIML@_ABI___INT64_NOT_LONG, __int64, long); -# if defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG > 0 -@KWIML@_ABI__VERIFY_DIFF(@KWIML@_ABI___INT64_NOT_LONG_LONG, __int64, long long); -# endif -#endif - -#if defined(@KWIML@_ABI_CHAR_IS_UNSIGNED) -@KWIML@_ABI__VERIFY_BOOL(@KWIML@_ABI_CHAR_IS_UNSIGNED, (char)0x80 > 0); -#elif defined(@KWIML@_ABI_CHAR_IS_SIGNED) -@KWIML@_ABI__VERIFY_BOOL(@KWIML@_ABI_CHAR_IS_SIGNED, (char)0x80 < 0); -#endif - -#undef @KWIML@_ABI__VERIFY_DIFF -#undef @KWIML@_ABI__VERIFY_SAME -#undef @KWIML@_ABI__VERIFY_SIZE -#undef @KWIML@_ABI__VERIFY_BOOL -#undef @KWIML@_ABI__VERIFY3 -#undef @KWIML@_ABI__VERIFY2 -#undef @KWIML@_ABI__VERIFY - -#endif - -#endif diff --git a/Utilities/KWIML/CMakeLists.txt b/Utilities/KWIML/CMakeLists.txt index 62b6fffb7..15e65e5c7 100644 --- a/Utilities/KWIML/CMakeLists.txt +++ b/Utilities/KWIML/CMakeLists.txt @@ -1,52 +1,29 @@ -#============================================================================= -# Kitware Information Macro Library -# Copyright 2010-2011 Kitware, Inc. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. +# Copyright Kitware, Inc. +# Distributed under the OSI-approved BSD 3-Clause License. +# See accompanying file Copyright.txt for details. # -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= - -# Import the KWIML directory tree into a subdirectory under a parent -# project and configure the library as follows: -# -# set(KWIML myIML) -# subdirs(KWIML) -# -# Optional settings are as follows: -# -# KWIML_HEADER_ROOT = build tree directory to hold KWIML headers. -# Headers will go in a directory called "${KWIML}" under this root. -# For example: -# -# set(KWIML_HEADER_ROOT ${PROJECT_BINARY_DIR}) -# include_directories(${PROJECT_BINARY_DIR}) -# -# KWIML_INSTALL_INCLUDE_DIR = install KWIML with "make install" -# Specify a value relative to the install prefix and do NOT start with '/'. -# KWIML_INSTALL_INCLUDE_OPTIONS = extra header installation options -# Specify options for the install(FILES) command. -# -# KWIML_LABELS_TEST = list of labels for KWIML tests - -cmake_minimum_required(VERSION 2.6.3 FATAL_ERROR) - -#----------------------------------------------------------------------------- -if(NOT DEFINED KWIML) - if(NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") - message(FATAL_ERROR "Set KWIML namespace in parent directory!") - endif() - set(KWIML KWIML) - set(KWIML_STANDALONE 1) +if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") + cmake_minimum_required(VERSION 3.0 FATAL_ERROR) + set(kwiml_standalone 1) project(KWIML) include(CTest) mark_as_advanced(BUILD_TESTING) + if(BUILD_TESTING) + set(KWIML_TEST_ENABLE 1) + endif() + if(NOT DEFINED KWIML_INSTALL_INCLUDE_DIR) + set(KWIML_INSTALL_INCLUDE_DIR include) + endif() + set(KWIML_INCLUDE_PREFIX kwiml) +else() + cmake_minimum_required(VERSION 2.8.2 FATAL_ERROR) + set(kwiml_standalone 0) + if(KWIML_INSTALL_INCLUDE_DIR AND NOT DEFINED KWIML_INCLUDE_PREFIX) + message(FATAL_ERROR "Host project must set KWIML_INCLUDE_PREFIX") + endif() endif() -#----------------------------------------------------------------------------- get_property(KWIML_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) foreach(lang ${KWIML_LANGUAGES}) set(KWIML_LANGUAGE_${lang} 1) @@ -55,25 +32,73 @@ if(NOT KWIML_LANGUAGE_C AND NOT KWIML_LANGUAGE_CXX) set(BUILD_TESTING OFF) endif() -#----------------------------------------------------------------------------- -if(NOT KWIML_HEADER_ROOT) - set(KWIML_HEADER_ROOT "${PROJECT_BINARY_DIR}") +if(KWIML_INSTALL_INCLUDE_DIR) + install(FILES + include/kwiml/abi.h + include/kwiml/int.h + DESTINATION ${KWIML_INSTALL_INCLUDE_DIR}/${KWIML_INCLUDE_PREFIX} + ${KWIML_INSTALL_INCLUDE_OPTIONS} + ) endif() -set(KWIML_HEADER_DIR "${KWIML_HEADER_ROOT}/${KWIML}") -include_directories(${KWIML_HEADER_ROOT}) -#----------------------------------------------------------------------------- -foreach(h ABI INT) - set(header ${KWIML_HEADER_DIR}/${h}.h) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${h}.h.in ${header} @ONLY) - if(KWIML_INSTALL_INCLUDE_DIR) - install(FILES ${header} - DESTINATION ${KWIML_INSTALL_INCLUDE_DIR}/${KWIML} - ${KWIML_INSTALL_INCLUDE_OPTIONS}) - endif() -endforeach() - -#----------------------------------------------------------------------------- -if(BUILD_TESTING) +if(KWIML_TEST_ENABLE) add_subdirectory(test) endif() + +if(NOT kwiml_standalone) + return() +endif() + +#---------------------------------------------------------------------------- +set(KWIML_VERSION 1.0.0) +if(KWIML_VERSION MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+)") + set(KWIML_VERSION_MAJOR "${CMAKE_MATCH_1}") + set(KWIML_VERSION_MINOR "${CMAKE_MATCH_2}") + set(KWIML_VERSION_PATCH "${CMAKE_MATCH_3}") + math(EXPR KWIML_VERSION_DECIMAL + "${KWIML_VERSION_MAJOR}*1000000 + ${KWIML_VERSION_MINOR}*1000 + ${KWIML_VERSION_PATCH}") +else() + message(FATAL_ERROR "Failed to parse KWIML_VERSION='${KWIML_VERSION}'") +endif() + +configure_file(src/version.h.in include/kwiml/version.h @ONLY) +install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/include/kwiml/version.h + DESTINATION ${KWIML_INSTALL_INCLUDE_DIR}/kwiml + ) + +if(NOT KWIML_INSTALL_PACKAGE_DIR) + set(KWIML_INSTALL_PACKAGE_DIR share/cmake/kwiml-${KWIML_VERSION_MAJOR}.${KWIML_VERSION_MINOR}) +endif() + +add_library(kwiml INTERFACE) +target_include_directories(kwiml INTERFACE + $/${KWIML_INSTALL_INCLUDE_DIR}> + $ + $ + ) +export(TARGETS kwiml + NAMESPACE kwiml:: + FILE kwiml-targets.cmake + ) +install(TARGETS kwiml + DESTINATION lib + EXPORT kwiml-targets + ) +install(EXPORT kwiml-targets + NAMESPACE kwiml:: + DESTINATION ${KWIML_INSTALL_PACKAGE_DIR} + ) + +configure_file(src/kwiml-config.cmake.in kwiml-config.cmake @ONLY) +include(CMakePackageConfigHelpers) +write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/kwiml-config-version.cmake" + VERSION ${KWIML_VERSION} + COMPATIBILITY AnyNewerVersion + ) +install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/kwiml-config.cmake + ${CMAKE_CURRENT_BINARY_DIR}/kwiml-config-version.cmake + DESTINATION ${KWIML_INSTALL_PACKAGE_DIR} + ) diff --git a/Utilities/KWIML/Copyright.txt b/Utilities/KWIML/Copyright.txt index c1e5ebc3f..a6204b0c2 100644 --- a/Utilities/KWIML/Copyright.txt +++ b/Utilities/KWIML/Copyright.txt @@ -1,5 +1,5 @@ Kitware Information Macro Library -Copyright 2010-2011 Kitware, Inc. +Copyright 2010-2015 Kitware, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/Utilities/KWIML/INT.h.in b/Utilities/KWIML/INT.h.in deleted file mode 100644 index d2eda6387..000000000 --- a/Utilities/KWIML/INT.h.in +++ /dev/null @@ -1,861 +0,0 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Kitware, Inc. nor the names of its contributors - may be used to endorse or promote products derived from this - software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -============================================================================*/ -#ifndef @KWIML@_INT_H -#define @KWIML@_INT_H -/* -This header defines macros with information about sized integer types. -Only information that can be determined using the preprocessor at -compilation time is available. No try-compile results may be added -here. Instead we memorize results on platforms of interest. - -An includer may optionally define the following macros to suppress errors: - -Input: - @KWIML@_INT_NO_VERIFY = skip verification declarations - @KWIML@_INT_NO_ERROR_INT64_T = type '@KWIML@_INT_int64_t' is optional (*) - @KWIML@_INT_NO_ERROR_UINT64_T = type '@KWIML@_INT_uint64_t' is optional (*) - @KWIML@_INT_NO_ERROR_INTPTR_T = type '@KWIML@_INT_intptr_t' is optional (*) - @KWIML@_INT_NO_ERROR_UINTPTR_T = type '@KWIML@_INT_uintptr_t' is optional (*) - -An includer may optionally define the following macros to override defaults. -Either way, an includer may test these macros after inclusion: - - @KWIML@_INT_HAVE_STDINT_H = include - @KWIML@_INT_NO_STDINT_H = do not include - @KWIML@_INT_HAVE_INTTYPES_H = include - @KWIML@_INT_NO_INTTYPES_H = do not include - -An includer may test the following macros after inclusion: - - @KWIML@_INT_HAVE_INT#_T = type 'int#_t' is available - @KWIML@_INT_HAVE_UINT#_T = type 'uint#_t' is available - # = 8, 16, 32, 64, PTR - - @KWIML@_INT_int#_t = signed integer type exactly # bits wide - @KWIML@_INT_uint#_t = unsigned integer type exactly # bits wide - # = 8, 16, 32, 64 (*), ptr (*) - - @KWIML@_INT_NO_INT64_T = type '@KWIML@_INT_int64_t' not available - @KWIML@_INT_NO_UINT64_T = type '@KWIML@_INT_uint64_t' not available - @KWIML@_INT_NO_INTPTR_T = type '@KWIML@_INT_intptr_t' not available - @KWIML@_INT_NO_UINTPTR_T = type '@KWIML@_INT_uintptr_t' not available - - @KWIML@_INT_INT#_C(c) = signed integer constant at least # bits wide - @KWIML@_INT_UINT#_C(c) = unsigned integer constant at least # bits wide - # = 8, 16, 32, 64 (*) - - @KWIML@_INT_# = print or scan format, in table below - # = 8, 16, 32, 64, PTR (*) - - signed unsigned - ----------- ------------------------------ - | decimal | decimal octal hexadecimal | - print | PRId PRIi | PRIu PRIo PRIx PRIX | - scan | SCNd SCNi | SCNu SCNo SCNx | - ----------- ------------------------------ - - The SCN*8 and SCN*64 format macros will not be defined on systems - with scanf implementations known not to support them. - - @KWIML@_INT_BROKEN_# = macro # is incorrect if defined - Some compilers define integer format macros incorrectly for their - own formatted print/scan implementations. - - @KWIML@_INT_BROKEN_INT#_C = macro INT#_C is incorrect if defined - @KWIML@_INT_BROKEN_UINT#_C = macro UINT#_C is incorrect if defined - Some compilers define integer constant macros incorrectly and - cannot handle literals as large as the integer type or even - produce bad preprocessor syntax. - - @KWIML@_INT_BROKEN_INT8_T = type 'int8_t' is available but incorrect - Some compilers have a flag to make 'char' (un)signed but do not account - for it while defining int8_t in the non-default case. - - The broken cases do not affect correctness of the macros documented above. -*/ - -#include "ABI.h" - -/*--------------------------------------------------------------------------*/ -#if defined(@KWIML@_INT_HAVE_STDINT_H) /* Already defined. */ -#elif defined(@KWIML@_INT_NO_STDINT_H) /* Already defined. */ -#elif defined(HAVE_STDINT_H) /* Optionally provided by includer. */ -# define @KWIML@_INT_HAVE_STDINT_H 1 -#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ -# define @KWIML@_INT_HAVE_STDINT_H 1 -#elif defined(_MSC_VER) /* MSVC */ -# if _MSC_VER >= 1600 -# define @KWIML@_INT_HAVE_STDINT_H 1 -# else -# define @KWIML@_INT_NO_STDINT_H 1 -# endif -#elif defined(__BORLANDC__) /* Borland */ -# if __BORLANDC__ >= 0x560 -# define @KWIML@_INT_HAVE_STDINT_H 1 -# else -# define @KWIML@_INT_NO_STDINT_H 1 -# endif -#elif defined(__WATCOMC__) /* Watcom */ -# define @KWIML@_INT_NO_STDINT_H 1 -#endif - -/*--------------------------------------------------------------------------*/ -#if defined(@KWIML@_INT_HAVE_INTTYPES_H) /* Already defined. */ -#elif defined(@KWIML@_INT_NO_INTTYPES_H) /* Already defined. */ -#elif defined(HAVE_INTTYPES_H) /* Optionally provided by includer. */ -# define @KWIML@_INT_HAVE_INTTYPES_H 1 -#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ -# define @KWIML@_INT_HAVE_INTTYPES_H 1 -#elif defined(_MSC_VER) /* MSVC */ -# define @KWIML@_INT_NO_INTTYPES_H 1 -#elif defined(__BORLANDC__) /* Borland */ -# define @KWIML@_INT_NO_INTTYPES_H 1 -#elif defined(__WATCOMC__) /* Watcom */ -# define @KWIML@_INT_NO_INTTYPES_H 1 -#else /* Assume it exists. */ -# define @KWIML@_INT_HAVE_INTTYPES_H 1 -#endif - -/*--------------------------------------------------------------------------*/ -#if defined(@KWIML@_INT_HAVE_STDINT_H) && defined(@KWIML@_INT_NO_STDINT_H) -# error "Both @KWIML@_INT_HAVE_STDINT_H and @KWIML@_INT_NO_STDINT_H defined!" -#endif -#if defined(@KWIML@_INT_HAVE_INTTYPES_H) && defined(@KWIML@_INT_NO_INTTYPES_H) -# error "Both @KWIML@_INT_HAVE_INTTYPES_H and @KWIML@_INT_NO_INTTYPES_H defined!" -#endif - -#if defined(@KWIML@_INT_HAVE_STDINT_H) -# include -#endif -#if defined(@KWIML@_INT_HAVE_INTTYPES_H) -# if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS) -# define __STDC_FORMAT_MACROS -# endif -# include -#endif - -#if defined(@KWIML@_INT_HAVE_STDINT_H) || defined(@KWIML@_INT_HAVE_INTTYPES_H) -#define @KWIML@_INT_HAVE_INT8_T 1 -#define @KWIML@_INT_HAVE_UINT8_T 1 -#define @KWIML@_INT_HAVE_INT16_T 1 -#define @KWIML@_INT_HAVE_UINT16_T 1 -#define @KWIML@_INT_HAVE_INT32_T 1 -#define @KWIML@_INT_HAVE_UINT32_T 1 -#define @KWIML@_INT_HAVE_INT64_T 1 -#define @KWIML@_INT_HAVE_UINT64_T 1 -#define @KWIML@_INT_HAVE_INTPTR_T 1 -#define @KWIML@_INT_HAVE_UINTPTR_T 1 -#endif - -#if defined(_AIX43) && !defined(_AIX50) && !defined(_AIX51) - /* AIX 4.3 defines these incorrectly with % and no quotes. */ -# define @KWIML@_INT_BROKEN_PRId8 -# define @KWIML@_INT_BROKEN_SCNd8 -# define @KWIML@_INT_BROKEN_PRIi8 -# define @KWIML@_INT_BROKEN_SCNi8 -# define @KWIML@_INT_BROKEN_PRIo8 -# define @KWIML@_INT_BROKEN_SCNo8 -# define @KWIML@_INT_BROKEN_PRIu8 -# define @KWIML@_INT_BROKEN_SCNu8 -# define @KWIML@_INT_BROKEN_PRIx8 -# define @KWIML@_INT_BROKEN_SCNx8 -# define @KWIML@_INT_BROKEN_PRIX8 -# define @KWIML@_INT_BROKEN_PRId16 -# define @KWIML@_INT_BROKEN_SCNd16 -# define @KWIML@_INT_BROKEN_PRIi16 -# define @KWIML@_INT_BROKEN_SCNi16 -# define @KWIML@_INT_BROKEN_PRIo16 -# define @KWIML@_INT_BROKEN_SCNo16 -# define @KWIML@_INT_BROKEN_PRIu16 -# define @KWIML@_INT_BROKEN_SCNu16 -# define @KWIML@_INT_BROKEN_PRIx16 -# define @KWIML@_INT_BROKEN_SCNx16 -# define @KWIML@_INT_BROKEN_PRIX16 -# define @KWIML@_INT_BROKEN_PRId32 -# define @KWIML@_INT_BROKEN_SCNd32 -# define @KWIML@_INT_BROKEN_PRIi32 -# define @KWIML@_INT_BROKEN_SCNi32 -# define @KWIML@_INT_BROKEN_PRIo32 -# define @KWIML@_INT_BROKEN_SCNo32 -# define @KWIML@_INT_BROKEN_PRIu32 -# define @KWIML@_INT_BROKEN_SCNu32 -# define @KWIML@_INT_BROKEN_PRIx32 -# define @KWIML@_INT_BROKEN_SCNx32 -# define @KWIML@_INT_BROKEN_PRIX32 -# define @KWIML@_INT_BROKEN_PRId64 -# define @KWIML@_INT_BROKEN_SCNd64 -# define @KWIML@_INT_BROKEN_PRIi64 -# define @KWIML@_INT_BROKEN_SCNi64 -# define @KWIML@_INT_BROKEN_PRIo64 -# define @KWIML@_INT_BROKEN_SCNo64 -# define @KWIML@_INT_BROKEN_PRIu64 -# define @KWIML@_INT_BROKEN_SCNu64 -# define @KWIML@_INT_BROKEN_PRIx64 -# define @KWIML@_INT_BROKEN_SCNx64 -# define @KWIML@_INT_BROKEN_PRIX64 -# define @KWIML@_INT_BROKEN_PRIdPTR -# define @KWIML@_INT_BROKEN_SCNdPTR -# define @KWIML@_INT_BROKEN_PRIiPTR -# define @KWIML@_INT_BROKEN_SCNiPTR -# define @KWIML@_INT_BROKEN_PRIoPTR -# define @KWIML@_INT_BROKEN_SCNoPTR -# define @KWIML@_INT_BROKEN_PRIuPTR -# define @KWIML@_INT_BROKEN_SCNuPTR -# define @KWIML@_INT_BROKEN_PRIxPTR -# define @KWIML@_INT_BROKEN_SCNxPTR -# define @KWIML@_INT_BROKEN_PRIXPTR -#endif - -#if (defined(__SUNPRO_C)||defined(__SUNPRO_CC)) && defined(_CHAR_IS_UNSIGNED) -# define @KWIML@_INT_BROKEN_INT8_T /* system type defined incorrectly */ -#elif defined(__BORLANDC__) && defined(_CHAR_UNSIGNED) -# define @KWIML@_INT_BROKEN_INT8_T /* system type defined incorrectly */ -#endif - -/*--------------------------------------------------------------------------*/ -#if defined(@KWIML@_INT_HAVE_INT8_T) && !defined(@KWIML@_INT_BROKEN_INT8_T) -# define @KWIML@_INT_int8_t int8_t -#else -# define @KWIML@_INT_int8_t signed char -#endif -#if defined(@KWIML@_INT_HAVE_UINT8_T) -# define @KWIML@_INT_uint8_t uint8_t -#else -# define @KWIML@_INT_uint8_t unsigned char -#endif - -#if defined(__INTEL_COMPILER) -# if defined(_WIN32) -# define @KWIML@_INT__NO_SCN8 -# endif -#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) -# define @KWIML@_INT__NO_SCN8 -#elif defined(__BORLANDC__) -# define @KWIML@_INT__NO_SCN8 -# define @KWIML@_INT__NO_SCN64 -#elif defined(_MSC_VER) -# define @KWIML@_INT__NO_SCN8 -#elif defined(__WATCOMC__) -# define @KWIML@_INT__NO_SCN8 -# elif defined(__hpux) /* HP runtime lacks support (any compiler) */ -# define @KWIML@_INT__NO_SCN8 -#endif - -/* 8-bit d, i */ -#if defined(@KWIML@_INT_HAVE_INT8_T) && defined(PRId8) \ - && !defined(@KWIML@_INT_BROKEN_PRId8) -# define @KWIML@_INT_PRId8 PRId8 -#else -# define @KWIML@_INT_PRId8 "d" -#endif -#if defined(@KWIML@_INT_HAVE_INT8_T) && defined(SCNd8) \ - && !defined(@KWIML@_INT_BROKEN_SCNd8) -# define @KWIML@_INT_SCNd8 SCNd8 -#elif !defined(@KWIML@_INT__NO_SCN8) -# define @KWIML@_INT_SCNd8 "hhd" -#endif -#if defined(@KWIML@_INT_HAVE_INT8_T) && defined(PRIi8) \ - && !defined(@KWIML@_INT_BROKEN_PRIi8) -# define @KWIML@_INT_PRIi8 PRIi8 -#else -# define @KWIML@_INT_PRIi8 "i" -#endif -#if defined(@KWIML@_INT_HAVE_INT8_T) && defined(SCNi8) \ - && !defined(@KWIML@_INT_BROKEN_SCNi8) -# define @KWIML@_INT_SCNi8 SCNi8 -#elif !defined(@KWIML@_INT__NO_SCN8) -# define @KWIML@_INT_SCNi8 "hhi" -#endif - -/* 8-bit o, u, x, X */ -#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(PRIo8) \ - && !defined(@KWIML@_INT_BROKEN_PRIo8) -# define @KWIML@_INT_PRIo8 PRIo8 -#else -# define @KWIML@_INT_PRIo8 "o" -#endif -#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(SCNo8) \ - && !defined(@KWIML@_INT_BROKEN_SCNo8) -# define @KWIML@_INT_SCNo8 SCNo8 -#elif !defined(@KWIML@_INT__NO_SCN8) -# define @KWIML@_INT_SCNo8 "hho" -#endif -#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(PRIu8) \ - && !defined(@KWIML@_INT_BROKEN_PRIu8) -# define @KWIML@_INT_PRIu8 PRIu8 -#else -# define @KWIML@_INT_PRIu8 "u" -#endif -#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(SCNu8) \ - && !defined(@KWIML@_INT_BROKEN_SCNu8) -# define @KWIML@_INT_SCNu8 SCNu8 -#elif !defined(@KWIML@_INT__NO_SCN8) -# define @KWIML@_INT_SCNu8 "hhu" -#endif -#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(PRIx8) \ - && !defined(@KWIML@_INT_BROKEN_PRIx8) -# define @KWIML@_INT_PRIx8 PRIx8 -#else -# define @KWIML@_INT_PRIx8 "x" -#endif -#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(SCNx8) \ - && !defined(@KWIML@_INT_BROKEN_SCNx8) -# define @KWIML@_INT_SCNx8 SCNx8 -#elif !defined(@KWIML@_INT__NO_SCN8) -# define @KWIML@_INT_SCNx8 "hhx" -#endif -#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(PRIX8) \ - && !defined(@KWIML@_INT_BROKEN_PRIX8) -# define @KWIML@_INT_PRIX8 PRIX8 -#else -# define @KWIML@_INT_PRIX8 "X" -#endif - -/* 8-bit constants */ -#if defined(INT8_C) && !defined(@KWIML@_INT_BROKEN_INT8_C) -# define @KWIML@_INT_INT8_C(c) INT8_C(c) -#else -# define @KWIML@_INT_INT8_C(c) c -#endif -#if defined(UINT8_C) && !defined(@KWIML@_INT_BROKEN_UINT8_C) -# define @KWIML@_INT_UINT8_C(c) UINT8_C(c) -#else -# define @KWIML@_INT_UINT8_C(c) c ## u -#endif - -/*--------------------------------------------------------------------------*/ -#if defined(@KWIML@_INT_HAVE_INT16_T) -# define @KWIML@_INT_int16_t int16_t -#else -# define @KWIML@_INT_int16_t signed short -#endif -#if defined(@KWIML@_INT_HAVE_UINT16_T) -# define @KWIML@_INT_uint16_t uint16_t -#else -# define @KWIML@_INT_uint16_t unsigned short -#endif - -/* 16-bit d, i */ -#if defined(@KWIML@_INT_HAVE_INT16_T) && defined(PRId16) \ - && !defined(@KWIML@_INT_BROKEN_PRId16) -# define @KWIML@_INT_PRId16 PRId16 -#else -# define @KWIML@_INT_PRId16 "d" -#endif -#if defined(@KWIML@_INT_HAVE_INT16_T) && defined(SCNd16) \ - && !defined(@KWIML@_INT_BROKEN_SCNd16) -# define @KWIML@_INT_SCNd16 SCNd16 -#else -# define @KWIML@_INT_SCNd16 "hd" -#endif -#if defined(@KWIML@_INT_HAVE_INT16_T) && defined(PRIi16) \ - && !defined(@KWIML@_INT_BROKEN_PRIi16) -# define @KWIML@_INT_PRIi16 PRIi16 -#else -# define @KWIML@_INT_PRIi16 "i" -#endif -#if defined(@KWIML@_INT_HAVE_INT16_T) && defined(SCNi16) \ - && !defined(@KWIML@_INT_BROKEN_SCNi16) -# define @KWIML@_INT_SCNi16 SCNi16 -#else -# define @KWIML@_INT_SCNi16 "hi" -#endif - -/* 16-bit o, u, x, X */ -#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(PRIo16) \ - && !defined(@KWIML@_INT_BROKEN_PRIo16) -# define @KWIML@_INT_PRIo16 PRIo16 -#else -# define @KWIML@_INT_PRIo16 "o" -#endif -#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(SCNo16) \ - && !defined(@KWIML@_INT_BROKEN_SCNo16) -# define @KWIML@_INT_SCNo16 SCNo16 -#else -# define @KWIML@_INT_SCNo16 "ho" -#endif -#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(PRIu16) \ - && !defined(@KWIML@_INT_BROKEN_PRIu16) -# define @KWIML@_INT_PRIu16 PRIu16 -#else -# define @KWIML@_INT_PRIu16 "u" -#endif -#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(SCNu16) \ - && !defined(@KWIML@_INT_BROKEN_SCNu16) -# define @KWIML@_INT_SCNu16 SCNu16 -#else -# define @KWIML@_INT_SCNu16 "hu" -#endif -#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(PRIx16) \ - && !defined(@KWIML@_INT_BROKEN_PRIx16) -# define @KWIML@_INT_PRIx16 PRIx16 -#else -# define @KWIML@_INT_PRIx16 "x" -#endif -#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(SCNx16) \ - && !defined(@KWIML@_INT_BROKEN_SCNx16) -# define @KWIML@_INT_SCNx16 SCNx16 -#else -# define @KWIML@_INT_SCNx16 "hx" -#endif -#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(PRIX16) \ - && !defined(@KWIML@_INT_BROKEN_PRIX16) -# define @KWIML@_INT_PRIX16 PRIX16 -#else -# define @KWIML@_INT_PRIX16 "X" -#endif - -/* 16-bit constants */ -#if defined(INT16_C) && !defined(@KWIML@_INT_BROKEN_INT16_C) -# define @KWIML@_INT_INT16_C(c) INT16_C(c) -#else -# define @KWIML@_INT_INT16_C(c) c -#endif -#if defined(UINT16_C) && !defined(@KWIML@_INT_BROKEN_UINT16_C) -# define @KWIML@_INT_UINT16_C(c) UINT16_C(c) -#else -# define @KWIML@_INT_UINT16_C(c) c ## u -#endif - -/*--------------------------------------------------------------------------*/ -#if defined(@KWIML@_INT_HAVE_INT32_T) -# define @KWIML@_INT_int32_t int32_t -#else -# define @KWIML@_INT_int32_t signed int -#endif -#if defined(@KWIML@_INT_HAVE_UINT32_T) -# define @KWIML@_INT_uint32_t uint32_t -#else -# define @KWIML@_INT_uint32_t unsigned int -#endif - -/* 32-bit d, i */ -#if defined(@KWIML@_INT_HAVE_INT32_T) && defined(PRId32) \ - && !defined(@KWIML@_INT_BROKEN_PRId32) -# define @KWIML@_INT_PRId32 PRId32 -#else -# define @KWIML@_INT_PRId32 "d" -#endif -#if defined(@KWIML@_INT_HAVE_INT32_T) && defined(SCNd32) \ - && !defined(@KWIML@_INT_BROKEN_SCNd32) -# define @KWIML@_INT_SCNd32 SCNd32 -#else -# define @KWIML@_INT_SCNd32 "d" -#endif -#if defined(@KWIML@_INT_HAVE_INT32_T) && defined(PRIi32) \ - && !defined(@KWIML@_INT_BROKEN_PRIi32) -# define @KWIML@_INT_PRIi32 PRIi32 -#else -# define @KWIML@_INT_PRIi32 "i" -#endif -#if defined(@KWIML@_INT_HAVE_INT32_T) && defined(SCNi32) \ - && !defined(@KWIML@_INT_BROKEN_SCNi32) -# define @KWIML@_INT_SCNi32 SCNi32 -#else -# define @KWIML@_INT_SCNi32 "i" -#endif - -/* 32-bit o, u, x, X */ -#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(PRIo32) \ - && !defined(@KWIML@_INT_BROKEN_PRIo32) -# define @KWIML@_INT_PRIo32 PRIo32 -#else -# define @KWIML@_INT_PRIo32 "o" -#endif -#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(SCNo32) \ - && !defined(@KWIML@_INT_BROKEN_SCNo32) -# define @KWIML@_INT_SCNo32 SCNo32 -#else -# define @KWIML@_INT_SCNo32 "o" -#endif -#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(PRIu32) \ - && !defined(@KWIML@_INT_BROKEN_PRIu32) -# define @KWIML@_INT_PRIu32 PRIu32 -#else -# define @KWIML@_INT_PRIu32 "u" -#endif -#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(SCNu32) \ - && !defined(@KWIML@_INT_BROKEN_SCNu32) -# define @KWIML@_INT_SCNu32 SCNu32 -#else -# define @KWIML@_INT_SCNu32 "u" -#endif -#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(PRIx32) \ - && !defined(@KWIML@_INT_BROKEN_PRIx32) -# define @KWIML@_INT_PRIx32 PRIx32 -#else -# define @KWIML@_INT_PRIx32 "x" -#endif -#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(SCNx32) \ - && !defined(@KWIML@_INT_BROKEN_SCNx32) -# define @KWIML@_INT_SCNx32 SCNx32 -#else -# define @KWIML@_INT_SCNx32 "x" -#endif -#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(PRIX32) \ - && !defined(@KWIML@_INT_BROKEN_PRIX32) -# define @KWIML@_INT_PRIX32 PRIX32 -#else -# define @KWIML@_INT_PRIX32 "X" -#endif - -#if defined(__hpux) && defined(__GNUC__) && !defined(__LP64__) \ - && defined(__CONCAT__) && defined(__CONCAT_U__) - /* Some HPs define UINT32_C incorrectly and break GNU. */ -# define @KWIML@_INT_BROKEN_UINT32_C -#endif - -/* 32-bit constants */ -#if defined(INT32_C) && !defined(@KWIML@_INT_BROKEN_INT32_C) -# define @KWIML@_INT_INT32_C(c) INT32_C(c) -#else -# define @KWIML@_INT_INT32_C(c) c -#endif -#if defined(UINT32_C) && !defined(@KWIML@_INT_BROKEN_UINT32_C) -# define @KWIML@_INT_UINT32_C(c) UINT32_C(c) -#else -# define @KWIML@_INT_UINT32_C(c) c ## u -#endif - -/*--------------------------------------------------------------------------*/ -#if defined(@KWIML@_INT_HAVE_INT64_T) -# define @KWIML@_INT_int64_t int64_t -#elif @KWIML@_ABI_SIZEOF_LONG == 8 -# define @KWIML@_INT_int64_t signed long -#elif defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG == 8 -# define @KWIML@_INT_int64_t signed long long -#elif defined(@KWIML@_ABI_SIZEOF___INT64) -# define @KWIML@_INT_int64_t signed __int64 -#elif defined(@KWIML@_INT_NO_ERROR_INT64_T) -# define @KWIML@_INT_NO_INT64_T -#else -# error "No type known for 'int64_t'." -#endif -#if defined(@KWIML@_INT_HAVE_UINT64_T) -# define @KWIML@_INT_uint64_t uint64_t -#elif @KWIML@_ABI_SIZEOF_LONG == 8 -# define @KWIML@_INT_uint64_t unsigned long -#elif defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG == 8 -# define @KWIML@_INT_uint64_t unsigned long long -#elif defined(@KWIML@_ABI_SIZEOF___INT64) -# define @KWIML@_INT_uint64_t unsigned __int64 -#elif defined(@KWIML@_INT_NO_ERROR_UINT64_T) -# define @KWIML@_INT_NO_UINT64_T -#else -# error "No type known for 'uint64_t'." -#endif - -#if defined(__INTEL_COMPILER) -#elif defined(__BORLANDC__) -# define @KWIML@_INT__NO_FMTLL /* type 'long long' but not 'll' format */ -# define @KWIML@_INT_BROKEN_INT64_C /* system macro defined incorrectly */ -# define @KWIML@_INT_BROKEN_UINT64_C /* system macro defined incorrectly */ -#elif defined(_MSC_VER) && _MSC_VER < 1400 -# define @KWIML@_INT__NO_FMTLL /* type 'long long' but not 'll' format */ -#endif - -#if @KWIML@_ABI_SIZEOF_LONG == 8 -# define @KWIML@_INT__FMT64 "l" -#elif defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG == 8 -# if !defined(@KWIML@_INT__NO_FMTLL) -# define @KWIML@_INT__FMT64 "ll" -# else -# define @KWIML@_INT__FMT64 "I64" -# endif -#elif defined(@KWIML@_ABI_SIZEOF___INT64) -# if defined(__BORLANDC__) -# define @KWIML@_INT__FMT64 "L" -# else -# define @KWIML@_INT__FMT64 "I64" -# endif -#endif - -/* 64-bit d, i */ -#if defined(@KWIML@_INT_HAVE_INT64_T) && defined(PRId64) \ - && !defined(@KWIML@_INT_BROKEN_PRId64) -# define @KWIML@_INT_PRId64 PRId64 -#elif defined(@KWIML@_INT__FMT64) -# define @KWIML@_INT_PRId64 @KWIML@_INT__FMT64 "d" -#endif -#if defined(@KWIML@_INT_HAVE_INT64_T) && defined(SCNd64) \ - && !defined(@KWIML@_INT_BROKEN_SCNd64) -# define @KWIML@_INT_SCNd64 SCNd64 -#elif defined(@KWIML@_INT__FMT64) && !defined(@KWIML@_INT__NO_SCN64) -# define @KWIML@_INT_SCNd64 @KWIML@_INT__FMT64 "d" -#endif -#if defined(@KWIML@_INT_HAVE_INT64_T) && defined(PRIi64) \ - && !defined(@KWIML@_INT_BROKEN_PRIi64) -# define @KWIML@_INT_PRIi64 PRIi64 -#elif defined(@KWIML@_INT__FMT64) -# define @KWIML@_INT_PRIi64 @KWIML@_INT__FMT64 "d" -#endif -#if defined(@KWIML@_INT_HAVE_INT64_T) && defined(SCNi64) \ - && !defined(@KWIML@_INT_BROKEN_SCNi64) -# define @KWIML@_INT_SCNi64 SCNi64 -#elif defined(@KWIML@_INT__FMT64) && !defined(@KWIML@_INT__NO_SCN64) -# define @KWIML@_INT_SCNi64 @KWIML@_INT__FMT64 "d" -#endif - -/* 64-bit o, u, x, X */ -#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(PRIo64) \ - && !defined(@KWIML@_INT_BROKEN_PRIo64) -# define @KWIML@_INT_PRIo64 PRIo64 -#elif defined(@KWIML@_INT__FMT64) -# define @KWIML@_INT_PRIo64 @KWIML@_INT__FMT64 "o" -#endif -#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(SCNo64) \ - && !defined(@KWIML@_INT_BROKEN_SCNo64) -# define @KWIML@_INT_SCNo64 SCNo64 -#elif defined(@KWIML@_INT__FMT64) && !defined(@KWIML@_INT__NO_SCN64) -# define @KWIML@_INT_SCNo64 @KWIML@_INT__FMT64 "o" -#endif -#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(PRIu64) \ - && !defined(@KWIML@_INT_BROKEN_PRIu64) -# define @KWIML@_INT_PRIu64 PRIu64 -#elif defined(@KWIML@_INT__FMT64) -# define @KWIML@_INT_PRIu64 @KWIML@_INT__FMT64 "u" -#endif -#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(SCNu64) \ - && !defined(@KWIML@_INT_BROKEN_SCNu64) -# define @KWIML@_INT_SCNu64 SCNu64 -#elif defined(@KWIML@_INT__FMT64) && !defined(@KWIML@_INT__NO_SCN64) -# define @KWIML@_INT_SCNu64 @KWIML@_INT__FMT64 "u" -#endif -#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(PRIx64) \ - && !defined(@KWIML@_INT_BROKEN_PRIx64) -# define @KWIML@_INT_PRIx64 PRIx64 -#elif defined(@KWIML@_INT__FMT64) -# define @KWIML@_INT_PRIx64 @KWIML@_INT__FMT64 "x" -#endif -#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(SCNx64) \ - && !defined(@KWIML@_INT_BROKEN_SCNx64) -# define @KWIML@_INT_SCNx64 SCNx64 -#elif defined(@KWIML@_INT__FMT64) && !defined(@KWIML@_INT__NO_SCN64) -# define @KWIML@_INT_SCNx64 @KWIML@_INT__FMT64 "x" -#endif -#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(PRIX64) \ - && !defined(@KWIML@_INT_BROKEN_PRIX64) -# define @KWIML@_INT_PRIX64 PRIX64 -#elif defined(@KWIML@_INT__FMT64) -# define @KWIML@_INT_PRIX64 @KWIML@_INT__FMT64 "X" -#endif - -/* 64-bit constants */ -#if defined(@KWIML@_INT_HAVE_INT64_T) && defined(INT64_C) \ - && !defined(@KWIML@_INT_BROKEN_INT64_C) -# define @KWIML@_INT_INT64_C(c) INT64_C(c) -#elif @KWIML@_ABI_SIZEOF_LONG == 8 -# define @KWIML@_INT_INT64_C(c) c ## l -#elif defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG == 8 -# define @KWIML@_INT_INT64_C(c) c ## ll -#elif defined(@KWIML@_ABI_SIZEOF___INT64) -# define @KWIML@_INT_INT64_C(c) c ## i64 -#endif -#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(UINT64_C) \ - && !defined(@KWIML@_INT_BROKEN_UINT64_C) -# define @KWIML@_INT_UINT64_C(c) UINT64_C(c) -#elif @KWIML@_ABI_SIZEOF_LONG == 8 -# define @KWIML@_INT_UINT64_C(c) c ## ul -#elif defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG == 8 -# define @KWIML@_INT_UINT64_C(c) c ## ull -#elif defined(@KWIML@_ABI_SIZEOF___INT64) -# define @KWIML@_INT_UINT64_C(c) c ## ui64 -#endif - -/*--------------------------------------------------------------------------*/ -#if defined(@KWIML@_INT_HAVE_INTPTR_T) -# define @KWIML@_INT_intptr_t intptr_t -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_intptr_t @KWIML@_INT_int32_t -#elif !defined(@KWIML@_INT_NO_INT64_T) -# define @KWIML@_INT_intptr_t @KWIML@_INT_int64_t -#elif defined(@KWIML@_INT_NO_ERROR_INTPTR_T) -# define @KWIML@_INT_NO_INTPTR_T -#else -# error "No type known for 'intptr_t'." -#endif -#if defined(@KWIML@_INT_HAVE_UINTPTR_T) -# define @KWIML@_INT_uintptr_t uintptr_t -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_uintptr_t @KWIML@_INT_uint32_t -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_uintptr_t @KWIML@_INT_uint64_t -#elif defined(@KWIML@_INT_NO_ERROR_UINTPTR_T) -# define @KWIML@_INT_NO_UINTPTR_T -#else -# error "No type known for 'uintptr_t'." -#endif - -#if defined(@KWIML@_INT_HAVE_INTPTR_T) && defined(PRIdPTR) \ - && !defined(@KWIML@_INT_BROKEN_PRIdPTR) -# define @KWIML@_INT_PRIdPTR PRIdPTR -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_PRIdPTR @KWIML@_INT_PRId32 -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_PRIdPTR @KWIML@_INT_PRId64 -#endif -#if defined(@KWIML@_INT_HAVE_INTPTR_T) && defined(SCNdPTR) \ - && !defined(@KWIML@_INT_BROKEN_SCNdPTR) -# define @KWIML@_INT_SCNdPTR SCNdPTR -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_SCNdPTR @KWIML@_INT_SCNd32 -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_SCNdPTR @KWIML@_INT_SCNd64 -#endif -#if defined(@KWIML@_INT_HAVE_INTPTR_T) && defined(PRIiPTR) \ - && !defined(@KWIML@_INT_BROKEN_PRIiPTR) -# define @KWIML@_INT_PRIiPTR PRIiPTR -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_PRIiPTR @KWIML@_INT_PRIi32 -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_PRIiPTR @KWIML@_INT_PRIi64 -#endif -#if defined(@KWIML@_INT_HAVE_INTPTR_T) && defined(SCNiPTR) \ - && !defined(@KWIML@_INT_BROKEN_SCNiPTR) -# define @KWIML@_INT_SCNiPTR SCNiPTR -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_SCNiPTR @KWIML@_INT_SCNi32 -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_SCNiPTR @KWIML@_INT_SCNi64 -#endif - -#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(PRIoPTR) \ - && !defined(@KWIML@_INT_BROKEN_PRIoPTR) -# define @KWIML@_INT_PRIoPTR PRIoPTR -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_PRIoPTR @KWIML@_INT_PRIo32 -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_PRIoPTR @KWIML@_INT_PRIo64 -#endif -#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(SCNoPTR) \ - && !defined(@KWIML@_INT_BROKEN_SCNoPTR) -# define @KWIML@_INT_SCNoPTR SCNoPTR -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_SCNoPTR @KWIML@_INT_SCNo32 -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_SCNoPTR @KWIML@_INT_SCNo64 -#endif -#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(PRIuPTR) \ - && !defined(@KWIML@_INT_BROKEN_PRIuPTR) -# define @KWIML@_INT_PRIuPTR PRIuPTR -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_PRIuPTR @KWIML@_INT_PRIu32 -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_PRIuPTR @KWIML@_INT_PRIu64 -#endif -#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(SCNuPTR) \ - && !defined(@KWIML@_INT_BROKEN_SCNuPTR) -# define @KWIML@_INT_SCNuPTR SCNuPTR -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_SCNuPTR @KWIML@_INT_SCNu32 -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_SCNuPTR @KWIML@_INT_SCNu64 -#endif -#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(PRIxPTR) \ - && !defined(@KWIML@_INT_BROKEN_PRIxPTR) -# define @KWIML@_INT_PRIxPTR PRIxPTR -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_PRIxPTR @KWIML@_INT_PRIx32 -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_PRIxPTR @KWIML@_INT_PRIx64 -#endif -#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(SCNxPTR) \ - && !defined(@KWIML@_INT_BROKEN_SCNxPTR) -# define @KWIML@_INT_SCNxPTR SCNxPTR -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_SCNxPTR @KWIML@_INT_SCNx32 -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_SCNxPTR @KWIML@_INT_SCNx64 -#endif -#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(PRIXPTR) \ - && !defined(@KWIML@_INT_BROKEN_PRIXPTR) -# define @KWIML@_INT_PRIXPTR PRIXPTR -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_PRIXPTR @KWIML@_INT_PRIX32 -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_PRIXPTR @KWIML@_INT_PRIX64 -#endif - -/*--------------------------------------------------------------------------*/ -#if !defined(@KWIML@_INT_NO_VERIFY) -#define @KWIML@_INT__VERIFY(n, x, y) extern int (*n)[x]; extern int (*n)[y] -#define @KWIML@_INT__VERIFY_BOOL(m, b) @KWIML@_INT__VERIFY(m##__VERIFY__, 2, (b)?2:3) -#define @KWIML@_INT__VERIFY_TYPE(t, s) @KWIML@_INT__VERIFY(t##__VERIFY__, s, sizeof(t)) -#define @KWIML@_INT__VERIFY_SIGN(t, u, o) @KWIML@_INT__VERIFY_BOOL(t##__SIGN, (t)((u)1 << ((sizeof(t)<<3)-1)) o 0) - -@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_int8_t, 1); -@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_uint8_t, 1); -@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_int16_t, 2); -@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_uint16_t, 2); -@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_int32_t, 4); -@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_uint32_t, 4); -#if !defined(@KWIML@_INT_NO_INT64_T) -@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_int64_t, 8); -#endif -#if !defined(@KWIML@_INT_NO_UINT64_T) -@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_uint64_t, 8); -#endif -#if !defined(@KWIML@_INT_NO_INTPTR_T) -@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_intptr_t, sizeof(void*)); -#endif -#if !defined(@KWIML@_INT_NO_UINTPTR_T) -@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_uintptr_t, sizeof(void*)); -#endif - -@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_int8_t, @KWIML@_INT_uint8_t, <); -@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_uint8_t, @KWIML@_INT_uint8_t, >); -@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_int16_t, @KWIML@_INT_uint16_t, <); -@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_uint16_t, @KWIML@_INT_uint16_t, >); -@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_int32_t, @KWIML@_INT_uint32_t, <); -@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_uint32_t, @KWIML@_INT_uint32_t, >); -#if !defined(@KWIML@_INT_NO_INT64_T) -@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_int64_t, @KWIML@_INT_uint64_t, <); -#endif -#if !defined(@KWIML@_INT_NO_UINT64_T) -@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_uint64_t, @KWIML@_INT_uint64_t, >); -#endif -#if !defined(@KWIML@_INT_NO_INTPTR_T) -@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_intptr_t, @KWIML@_INT_uintptr_t, <); -#endif -#if !defined(@KWIML@_INT_NO_UINTPTR_T) -@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_uintptr_t, @KWIML@_INT_uintptr_t, >); -#endif - -#undef @KWIML@_INT__VERIFY_SIGN -#undef @KWIML@_INT__VERIFY_TYPE -#undef @KWIML@_INT__VERIFY_BOOL -#undef @KWIML@_INT__VERIFY - -#endif - -#endif diff --git a/Utilities/KWIML/README.md b/Utilities/KWIML/README.md new file mode 100644 index 000000000..37d72d1b1 --- /dev/null +++ b/Utilities/KWIML/README.md @@ -0,0 +1,36 @@ +Kitware Information Macro Library (KWIML) +========================================= + +KWIML provides header files that use preprocessor tests to detect and +provide information about the compiler and its target architecture. +The headers contain no configuration-time test results and thus may +be installed into an architecture-independent include directory. +This makes them suitable for use in the public interface of any package. + +The following headers are provided. See header comments for details: + +* [kwiml/abi.h][]: Fundamental type size and representation. + +* [kwiml/int.h][]: Fixed-size integer types and format specifiers. + +* [kwiml/version.h][]: Information about this version of KWIML. + +The [test][] subdirectory builds tests that verify correctness of the +information provided by each header. + +License +======= + +KWIML is distributed under the OSI-approved 3-clause BSD License. + +Files used only for build and test purposes contain a copyright notice and +reference [Copyright.txt][] for details. Headers meant for installation and +distribution outside the source tree come with full inlined copies of the +copyright notice and license text. This makes them suitable for distribution +with any package under compatible license terms. + +[Copyright.txt]: Copyright.txt +[kwiml/abi.h]: include/kwiml/abi.h +[kwiml/int.h]: include/kwiml/int.h +[kwiml/version.h]: src/version.h.in +[test]: test/ diff --git a/Utilities/KWIML/README.txt b/Utilities/KWIML/README.txt deleted file mode 100644 index 6bdf859d9..000000000 --- a/Utilities/KWIML/README.txt +++ /dev/null @@ -1,29 +0,0 @@ -KWIML - The Kitware Information Macro Library - -KWIML provides header files that use preprocessor tests to detect and -provide information about the compiler and its target architecture. The -headers contain no configuration-time test results and thus may be -installed into an architecture-independent include directory. This -makes them suitable for use in the public interface of any package. - -This source tree is intended for distribution inside the source trees of -other packages. In order to avoid name collisions among multiple -packages the KWIML headers are configured with a per-package prefix on -both the header locations and the macros they define. See comments in -CMakeLists.txt for instructions to include KWIML inside another project. - -The entire KWIML source tree is distributed under the OSI-approved -3-clause BSD License. Files used only for build and test purposes -contain a copyright notice and reference Copyright.txt for details. -Headers meant for installation and distribution outside the source tree -come with full inlined copies of the copyright notice and license text. -This makes them suitable for distribution with any package under -compatible license terms. - -The following components are provided. See header comments for details: - - ABI.h = Fundamental type size and representation - INT.h = Fixed-size integer types and format specifiers - -The "test" subdirectory builds tests that verify correctness of the -information provided by each header. diff --git a/Utilities/KWIML/include/kwiml/abi.h b/Utilities/KWIML/include/kwiml/abi.h new file mode 100644 index 000000000..362636165 --- /dev/null +++ b/Utilities/KWIML/include/kwiml/abi.h @@ -0,0 +1,562 @@ +/*============================================================================ + Kitware Information Macro Library + Copyright 2010-2015 Kitware, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Kitware, Inc. nor the names of its contributors + may be used to endorse or promote products derived from this + software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +============================================================================*/ +/* +This header defines macros with information about the C ABI. +Only information that can be determined using the preprocessor at +compilation time is available. No try-compile results may be added +here. Instead we memorize results on platforms of interest. + +An includer may optionally define the following macros to suppress errors: + + KWIML_ABI_NO_VERIFY = skip verification declarations + KWIML_ABI_NO_ERROR_CHAR_SIGN = signedness of 'char' may be unknown + KWIML_ABI_NO_ERROR_LONG_LONG = existence of 'long long' may be unknown + KWIML_ABI_NO_ERROR_ENDIAN = byte order of CPU may be unknown + +An includer may test the following macros after inclusion: + + KWIML_ABI_VERSION = interface version number # of this header + + KWIML_ABI_SIZEOF_DATA_PTR = sizeof(void*) + KWIML_ABI_SIZEOF_CODE_PTR = sizeof(void(*)(void)) + KWIML_ABI_SIZEOF_FLOAT = sizeof(float) + KWIML_ABI_SIZEOF_DOUBLE = sizeof(double) + KWIML_ABI_SIZEOF_CHAR = sizeof(char) + KWIML_ABI_SIZEOF_SHORT = sizeof(short) + KWIML_ABI_SIZEOF_INT = sizeof(int) + KWIML_ABI_SIZEOF_LONG = sizeof(long) + + KWIML_ABI_SIZEOF_LONG_LONG = sizeof(long long) or 0 if not a type + Undefined if existence is unknown and error suppression macro + KWIML_ABI_NO_ERROR_LONG_LONG was defined. + + KWIML_ABI_SIZEOF___INT64 = 8 if '__int64' exists or 0 if not + Undefined if existence is unknown. + + KWIML_ABI___INT64_IS_LONG = 1 if '__int64' is 'long' (same type) + Undefined otherwise. + KWIML_ABI___INT64_IS_LONG_LONG = 1 if '__int64' is 'long long' (same type) + Undefined otherwise. + KWIML_ABI___INT64_IS_UNIQUE = 1 if '__int64' is a distinct type + Undefined otherwise. + + KWIML_ABI_CHAR_IS_UNSIGNED = 1 if 'char' is unsigned, else undefined + KWIML_ABI_CHAR_IS_SIGNED = 1 if 'char' is signed, else undefined + One of these is defined unless signedness of 'char' is unknown and + error suppression macro KWIML_ABI_NO_ERROR_CHAR_SIGN was defined. + + KWIML_ABI_ENDIAN_ID_BIG = id for big-endian (always defined) + KWIML_ABI_ENDIAN_ID_LITTLE = id for little-endian (always defined) + KWIML_ABI_ENDIAN_ID = id of byte order of target CPU + Defined to KWIML_ABI_ENDIAN_ID_BIG or KWIML_ABI_ENDIAN_ID_LITTLE + unless byte order is unknown and error suppression macro + KWIML_ABI_NO_ERROR_ENDIAN was defined. + +We verify most results using dummy "extern" declarations that are +invalid if the macros are wrong. Verification is disabled if +suppression macro KWIML_ABI_NO_VERIFY was defined. +*/ + +#define KWIML_ABI_private_VERSION 1 + +/* Guard definition of this version. */ +#ifndef KWIML_ABI_detail_DEFINED_VERSION_1 +# define KWIML_ABI_detail_DEFINED_VERSION_1 1 +# define KWIML_ABI_private_DO_DEFINE +#endif + +/* Guard verification of this version. */ +#if !defined(KWIML_ABI_NO_VERIFY) +# ifndef KWIML_ABI_detail_VERIFIED_VERSION_1 +# define KWIML_ABI_detail_VERIFIED_VERSION_1 +# define KWIML_ABI_private_DO_VERIFY +# endif +#endif + +#ifdef KWIML_ABI_private_DO_DEFINE +#undef KWIML_ABI_private_DO_DEFINE + +/* Define version as most recent of those included. */ +#if !defined(KWIML_ABI_VERSION) || KWIML_ABI_VERSION < KWIML_ABI_private_VERSION +# undef KWIML_ABI_VERSION +# define KWIML_ABI_VERSION 1 +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_ABI_SIZEOF_DATA_PTR) +# if defined(__SIZEOF_POINTER__) +# define KWIML_ABI_SIZEOF_DATA_PTR __SIZEOF_POINTER__ +# elif defined(_SIZE_PTR) +# define KWIML_ABI_SIZEOF_DATA_PTR (_SIZE_PTR >> 3) +# elif defined(_LP64) || defined(__LP64__) +# define KWIML_ABI_SIZEOF_DATA_PTR 8 +# elif defined(_ILP32) +# define KWIML_ABI_SIZEOF_DATA_PTR 4 +# elif defined(__64BIT__) /* IBM XL */ +# define KWIML_ABI_SIZEOF_DATA_PTR 8 +# elif defined(_M_X64) +# define KWIML_ABI_SIZEOF_DATA_PTR 8 +# elif defined(__ia64) +# define KWIML_ABI_SIZEOF_DATA_PTR 8 +# elif defined(__sparcv9) +# define KWIML_ABI_SIZEOF_DATA_PTR 8 +# elif defined(__x86_64) || defined(__x86_64__) +# define KWIML_ABI_SIZEOF_DATA_PTR 8 +# elif defined(__amd64) || defined(__amd64__) +# define KWIML_ABI_SIZEOF_DATA_PTR 8 +# elif defined(__i386) || defined(__i386__) +# define KWIML_ABI_SIZEOF_DATA_PTR 4 +# endif +#endif +#if !defined(KWIML_ABI_SIZEOF_DATA_PTR) +# define KWIML_ABI_SIZEOF_DATA_PTR 4 +#endif +#if !defined(KWIML_ABI_SIZEOF_CODE_PTR) +# define KWIML_ABI_SIZEOF_CODE_PTR KWIML_ABI_SIZEOF_DATA_PTR +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_ABI_SIZEOF_CHAR) +# define KWIML_ABI_SIZEOF_CHAR 1 +#endif + +#if !defined(KWIML_ABI_CHAR_IS_UNSIGNED) && !defined(KWIML_ABI_CHAR_IS_SIGNED) +# if defined(__CHAR_UNSIGNED__) /* GNU, some IBM XL, others? */ +# define KWIML_ABI_CHAR_IS_UNSIGNED 1 +# elif defined(_CHAR_UNSIGNED) /* Intel, IBM XL, MSVC, Borland, others? */ +# define KWIML_ABI_CHAR_IS_UNSIGNED 1 +# elif defined(_CHAR_SIGNED) /* IBM XL, others? */ +# define KWIML_ABI_CHAR_IS_SIGNED 1 +# elif defined(__CHAR_SIGNED__) /* IBM XL, Watcom, others? */ +# define KWIML_ABI_CHAR_IS_SIGNED 1 +# elif defined(__SIGNED_CHARS__) /* EDG, Intel, SGI MIPSpro */ +# define KWIML_ABI_CHAR_IS_SIGNED 1 +# elif defined(_CHAR_IS_SIGNED) /* Some SunPro, others? */ +# define KWIML_ABI_CHAR_IS_SIGNED 1 +# elif defined(_CHAR_IS_UNSIGNED) /* SunPro, others? */ +# define KWIML_ABI_CHAR_IS_UNSIGNED 1 +# elif defined(__GNUC__) /* GNU default */ +# define KWIML_ABI_CHAR_IS_SIGNED 1 +# elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* SunPro default */ +# define KWIML_ABI_CHAR_IS_SIGNED 1 +# elif defined(__HP_cc) || defined(__HP_aCC) /* HP default (unless +uc) */ +# define KWIML_ABI_CHAR_IS_SIGNED 1 +# elif defined(_SGI_COMPILER_VERSION) /* SGI MIPSpro default */ +# define KWIML_ABI_CHAR_IS_UNSIGNED 1 +# elif defined(__PGIC__) /* PGI default */ +# define KWIML_ABI_CHAR_IS_SIGNED 1 +# elif defined(_MSC_VER) /* MSVC default */ +# define KWIML_ABI_CHAR_IS_SIGNED 1 +# elif defined(__WATCOMC__) /* Watcom default */ +# define KWIML_ABI_CHAR_IS_UNSIGNED 1 +# elif defined(__BORLANDC__) /* Borland default */ +# define KWIML_ABI_CHAR_IS_SIGNED 1 +# elif defined(__hpux) /* Old HP: no __HP_cc/__HP_aCC/__GNUC__ above */ +# define KWIML_ABI_CHAR_IS_SIGNED 1 /* (unless +uc) */ +# endif +#endif +#if !defined(KWIML_ABI_CHAR_IS_UNSIGNED) && !defined(KWIML_ABI_CHAR_IS_SIGNED) \ + && !defined(KWIML_ABI_NO_ERROR_CHAR_SIGN) +# error "Signedness of 'char' unknown." +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_ABI_SIZEOF_SHORT) +# if defined(__SIZEOF_SHORT__) +# define KWIML_ABI_SIZEOF_SHORT __SIZEOF_SHORT__ +# endif +#endif +#if !defined(KWIML_ABI_SIZEOF_SHORT) +# define KWIML_ABI_SIZEOF_SHORT 2 +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_ABI_SIZEOF_INT) +# if defined(__SIZEOF_INT__) +# define KWIML_ABI_SIZEOF_INT __SIZEOF_INT__ +# elif defined(_SIZE_INT) +# define KWIML_ABI_SIZEOF_INT (_SIZE_INT >> 3) +# endif +#endif +#if !defined(KWIML_ABI_SIZEOF_INT) +# define KWIML_ABI_SIZEOF_INT 4 +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_ABI_SIZEOF_LONG) +# if defined(__SIZEOF_LONG__) +# define KWIML_ABI_SIZEOF_LONG __SIZEOF_LONG__ +# elif defined(_SIZE_LONG) +# define KWIML_ABI_SIZEOF_LONG (_SIZE_LONG >> 3) +# elif defined(__LONG_MAX__) +# if __LONG_MAX__ == 0x7fffffff +# define KWIML_ABI_SIZEOF_LONG 4 +# elif __LONG_MAX__>>32 == 0x7fffffff +# define KWIML_ABI_SIZEOF_LONG 8 +# endif +# elif defined(_MSC_VER) /* MSVC and Intel on Windows */ +# define KWIML_ABI_SIZEOF_LONG 4 +# endif +#endif +#if !defined(KWIML_ABI_SIZEOF_LONG) +# define KWIML_ABI_SIZEOF_LONG KWIML_ABI_SIZEOF_DATA_PTR +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_ABI_SIZEOF_LONG_LONG) +# if defined(__SIZEOF_LONG_LONG__) +# define KWIML_ABI_SIZEOF_LONG_LONG __SIZEOF_LONG_LONG__ +# elif defined(__LONG_LONG_MAX__) +# if __LONG_LONG_MAX__ == 0x7fffffff +# define KWIML_ABI_SIZEOF_LONG_LONG 4 +# elif __LONG_LONG_MAX__>>32 == 0x7fffffff +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# endif +# endif +#endif +#if !defined(KWIML_ABI_SIZEOF_LONG_LONG) +# if defined(_LONGLONG) /* SGI, some GNU, perhaps others. */ \ + && !defined(_MSC_VER) +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# elif defined(_LONG_LONG) /* IBM XL, perhaps others. */ +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__NO_LONG_LONG) /* EDG */ +# define KWIML_ABI_SIZEOF_LONG_LONG 0 +# elif defined(__cplusplus) && __cplusplus > 199711L /* C++0x */ +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* SunPro */ +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__HP_cc) || defined(__HP_aCC) /* HP */ +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__PGIC__) /* PGI */ +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__WATCOMC__) /* Watcom */ +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__INTEL_COMPILER) /* Intel */ +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__BORLANDC__) /* Borland */ +# if __BORLANDC__ >= 0x0560 +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# else +# define KWIML_ABI_SIZEOF_LONG_LONG 0 +# endif +# elif defined(_MSC_VER) /* Microsoft */ +# if _MSC_VER >= 1310 +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# else +# define KWIML_ABI_SIZEOF_LONG_LONG 0 +# endif +# elif defined(__GNUC__) /* GNU */ +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__hpux) /* Old HP: no __HP_cc/__HP_aCC/__GNUC__ above */ +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# endif +#endif +#if !defined(KWIML_ABI_SIZEOF_LONG_LONG) && !defined(KWIML_ABI_NO_ERROR_LONG_LONG) +# error "Existence of 'long long' unknown." +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_ABI_SIZEOF___INT64) +# if defined(__INTEL_COMPILER) +# define KWIML_ABI_SIZEOF___INT64 8 +# elif defined(_MSC_VER) +# define KWIML_ABI_SIZEOF___INT64 8 +# elif defined(__BORLANDC__) +# define KWIML_ABI_SIZEOF___INT64 8 +# else +# define KWIML_ABI_SIZEOF___INT64 0 +# endif +#endif + +#if defined(KWIML_ABI_SIZEOF___INT64) && KWIML_ABI_SIZEOF___INT64 > 0 +# if KWIML_ABI_SIZEOF_LONG == 8 +# define KWIML_ABI___INT64_IS_LONG 1 +# elif defined(KWIML_ABI_SIZEOF_LONG_LONG) && KWIML_ABI_SIZEOF_LONG_LONG == 8 +# define KWIML_ABI___INT64_IS_LONG_LONG 1 +# else +# define KWIML_ABI___INT64_IS_UNIQUE 1 +# endif +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_ABI_SIZEOF_FLOAT) +# if defined(__SIZEOF_FLOAT__) +# define KWIML_ABI_SIZEOF_FLOAT __SIZEOF_FLOAT__ +# endif +#endif +#if !defined(KWIML_ABI_SIZEOF_FLOAT) +# define KWIML_ABI_SIZEOF_FLOAT 4 +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_ABI_SIZEOF_DOUBLE) +# if defined(__SIZEOF_DOUBLE__) +# define KWIML_ABI_SIZEOF_DOUBLE __SIZEOF_DOUBLE__ +# endif +#endif +#if !defined(KWIML_ABI_SIZEOF_DOUBLE) +# define KWIML_ABI_SIZEOF_DOUBLE 8 +#endif + +/*--------------------------------------------------------------------------*/ +/* Identify possible endian cases. The macro KWIML_ABI_ENDIAN_ID will be + defined to one of these, or undefined if unknown. */ +#if !defined(KWIML_ABI_ENDIAN_ID_BIG) +# define KWIML_ABI_ENDIAN_ID_BIG 4321 +#endif +#if !defined(KWIML_ABI_ENDIAN_ID_LITTLE) +# define KWIML_ABI_ENDIAN_ID_LITTLE 1234 +#endif +#if KWIML_ABI_ENDIAN_ID_BIG == KWIML_ABI_ENDIAN_ID_LITTLE +# error "KWIML_ABI_ENDIAN_ID_BIG == KWIML_ABI_ENDIAN_ID_LITTLE" +#endif + +#if defined(KWIML_ABI_ENDIAN_ID) /* Skip #elif cases if already defined. */ + +/* Use dedicated symbols if the compiler defines them. Do this first + because some architectures allow runtime byte order selection by + the operating system (values for such architectures below are + guesses for compilers that do not define a dedicated symbol). + Ensure that only one is defined in case the platform or a header + defines both as possible values for some third symbol. */ +#elif defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG +#elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE +#elif defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG +#elif defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE + +/* Alpha */ +#elif defined(__alpha) || defined(__alpha__) || defined(_M_ALPHA) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE + +/* Arm */ +#elif defined(__arm__) +# if !defined(__ARMEB__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE +# else +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG +# endif + +/* Intel x86 */ +#elif defined(__i386) || defined(__i386__) || defined(_M_IX86) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE +#elif defined(_X86_) || defined(__THW_INTEL__) || defined(__I86__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE +#elif defined(__MWERKS__) && defined(__INTEL__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE + +/* Intel x86-64 */ +#elif defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE +#elif defined(__amd64) || defined(__amd64__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE + +/* Intel Architecture-64 (Itanium) */ +#elif defined(__ia64) || defined(__ia64__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE +#elif defined(_IA64) || defined(__IA64__) || defined(_M_IA64) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE + +/* PowerPC */ +#elif defined(__powerpc) || defined(__powerpc__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG +#elif defined(__ppc) || defined(__ppc__) || defined(__POWERPC__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* SPARC */ +#elif defined(__sparc) || defined(__sparc__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* HP/PA RISC */ +#elif defined(__hppa) || defined(__hppa__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* Motorola 68k */ +#elif defined(__m68k__) || defined(M68000) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* MIPSel (MIPS little endian) */ +#elif defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE + +/* MIPSeb (MIPS big endian) */ +#elif defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* MIPS (fallback, big endian) */ +#elif defined(__mips) || defined(__mips__) || defined(__MIPS__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* NIOS2 */ +#elif defined(__NIOS2__) || defined(__NIOS2) || defined(__nios2__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE + +/* OpenRISC 1000 */ +#elif defined(__or1k__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* RS/6000 */ +#elif defined(__THW_RS600) || defined(_IBMR2) || defined(_POWER) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG +#elif defined(_ARCH_PWR) || defined(_ARCH_PWR2) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* System/370 */ +#elif defined(__370__) || defined(__THW_370__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* System/390 */ +#elif defined(__s390__) || defined(__s390x__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* z/Architecture */ +#elif defined(__SYSC_ZARCH__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* VAX */ +#elif defined(__vax__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* Aarch64 */ +#elif defined(__aarch64__) +# if !defined(__AARCH64EB__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE +# else +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG +# endif + +/* Xtensa */ +#elif defined(__XTENSA_EB__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG +#elif defined(__XTENSA_EL__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE + +/* Unknown CPU */ +#elif !defined(KWIML_ABI_NO_ERROR_ENDIAN) +# error "Byte order of target CPU unknown." +#endif + +#endif /* KWIML_ABI_private_DO_DEFINE */ + +/*--------------------------------------------------------------------------*/ +#ifdef KWIML_ABI_private_DO_VERIFY +#undef KWIML_ABI_private_DO_VERIFY + +#if defined(_MSC_VER) +# pragma warning (push) +# pragma warning (disable:4310) /* cast truncates constant value */ +#endif + +#define KWIML_ABI_private_VERIFY(n, x, y) KWIML_ABI_private_VERIFY_0(KWIML_ABI_private_VERSION, n, x, y) +#define KWIML_ABI_private_VERIFY_0(V, n, x, y) KWIML_ABI_private_VERIFY_1(V, n, x, y) +#define KWIML_ABI_private_VERIFY_1(V, n, x, y) extern int (*n##_v##V)[x]; extern int (*n##_v##V)[y] + +#define KWIML_ABI_private_VERIFY_SAME_IMPL(n, x, y) KWIML_ABI_private_VERIFY_SAME_IMPL_0(KWIML_ABI_private_VERSION, n, x, y) +#define KWIML_ABI_private_VERIFY_SAME_IMPL_0(V, n, x, y) KWIML_ABI_private_VERIFY_SAME_IMPL_1(V, n, x, y) +#define KWIML_ABI_private_VERIFY_SAME_IMPL_1(V, n, x, y) extern int (*n##_v##V)(x*); extern int (*n##_v##V)(y*) + +#define KWIML_ABI_private_VERIFY_DIFF_IMPL(n, x, y) KWIML_ABI_private_VERIFY_DIFF_IMPL_0(KWIML_ABI_private_VERSION, n, x, y) +#define KWIML_ABI_private_VERIFY_DIFF_IMPL_0(V, n, x, y) KWIML_ABI_private_VERIFY_DIFF_IMPL_1(V, n, x, y) +#if defined(__cplusplus) +# define KWIML_ABI_private_VERIFY_DIFF_IMPL_1(V, n, x, y) extern int* n##_v##V(x*); extern char* n##_v##V(y*) +#else +# define KWIML_ABI_private_VERIFY_DIFF_IMPL_1(V, n, x, y) extern int* n##_v##V(x*) /* TODO: possible? */ +#endif + +#define KWIML_ABI_private_VERIFY_BOOL(m, b) KWIML_ABI_private_VERIFY(KWIML_ABI_detail_VERIFY_##m, 2, (b)?2:3) +#define KWIML_ABI_private_VERIFY_SIZE(m, t) KWIML_ABI_private_VERIFY(KWIML_ABI_detail_VERIFY_##m, m, sizeof(t)) +#define KWIML_ABI_private_VERIFY_SAME(m, x, y) KWIML_ABI_private_VERIFY_SAME_IMPL(KWIML_ABI_detail_VERIFY_##m, x, y) +#define KWIML_ABI_private_VERIFY_DIFF(m, x, y) KWIML_ABI_private_VERIFY_DIFF_IMPL(KWIML_ABI_detail_VERIFY_##m, x, y) + +KWIML_ABI_private_VERIFY_SIZE(KWIML_ABI_SIZEOF_DATA_PTR, int*); +KWIML_ABI_private_VERIFY_SIZE(KWIML_ABI_SIZEOF_CODE_PTR, int(*)(int)); +KWIML_ABI_private_VERIFY_SIZE(KWIML_ABI_SIZEOF_CHAR, char); +KWIML_ABI_private_VERIFY_SIZE(KWIML_ABI_SIZEOF_SHORT, short); +KWIML_ABI_private_VERIFY_SIZE(KWIML_ABI_SIZEOF_INT, int); +KWIML_ABI_private_VERIFY_SIZE(KWIML_ABI_SIZEOF_LONG, long); +#if defined(KWIML_ABI_SIZEOF_LONG_LONG) && KWIML_ABI_SIZEOF_LONG_LONG > 0 +KWIML_ABI_private_VERIFY_SIZE(KWIML_ABI_SIZEOF_LONG_LONG, long long); +#endif +#if defined(KWIML_ABI_SIZEOF___INT64) && KWIML_ABI_SIZEOF___INT64 > 0 +KWIML_ABI_private_VERIFY_SIZE(KWIML_ABI_SIZEOF___INT64, __int64); +#endif +KWIML_ABI_private_VERIFY_SIZE(KWIML_ABI_SIZEOF_FLOAT, float); +KWIML_ABI_private_VERIFY_SIZE(KWIML_ABI_SIZEOF_DOUBLE, double); + +#if defined(KWIML_ABI___INT64_IS_LONG) +KWIML_ABI_private_VERIFY_SAME(KWIML_ABI___INT64_IS_LONG, __int64, long); +#elif defined(KWIML_ABI___INT64_IS_LONG_LONG) +KWIML_ABI_private_VERIFY_SAME(KWIML_ABI___INT64_IS_LONG_LONG, __int64, long long); +#elif defined(KWIML_ABI_SIZEOF___INT64) && KWIML_ABI_SIZEOF___INT64 > 0 +KWIML_ABI_private_VERIFY_DIFF(KWIML_ABI___INT64_NOT_LONG, __int64, long); +# if defined(KWIML_ABI_SIZEOF_LONG_LONG) && KWIML_ABI_SIZEOF_LONG_LONG > 0 +KWIML_ABI_private_VERIFY_DIFF(KWIML_ABI___INT64_NOT_LONG_LONG, __int64, long long); +# endif +#endif + +#if defined(KWIML_ABI_CHAR_IS_UNSIGNED) +KWIML_ABI_private_VERIFY_BOOL(KWIML_ABI_CHAR_IS_UNSIGNED, (char)0x80 > 0); +#elif defined(KWIML_ABI_CHAR_IS_SIGNED) +KWIML_ABI_private_VERIFY_BOOL(KWIML_ABI_CHAR_IS_SIGNED, (char)0x80 < 0); +#endif + +#undef KWIML_ABI_private_VERIFY_DIFF +#undef KWIML_ABI_private_VERIFY_SAME +#undef KWIML_ABI_private_VERIFY_SIZE +#undef KWIML_ABI_private_VERIFY_BOOL + +#undef KWIML_ABI_private_VERIFY_DIFF_IMPL_1 +#undef KWIML_ABI_private_VERIFY_DIFF_IMPL_0 +#undef KWIML_ABI_private_VERIFY_DIFF_IMPL + +#undef KWIML_ABI_private_VERIFY_SAME_IMPL_1 +#undef KWIML_ABI_private_VERIFY_SAME_IMPL_0 +#undef KWIML_ABI_private_VERIFY_SAME_IMPL + +#undef KWIML_ABI_private_VERIFY_1 +#undef KWIML_ABI_private_VERIFY_0 +#undef KWIML_ABI_private_VERIFY + +#if defined(_MSC_VER) +# pragma warning (pop) +#endif + +#endif /* KWIML_ABI_private_DO_VERIFY */ + +#undef KWIML_ABI_private_VERSION diff --git a/Utilities/KWIML/include/kwiml/int.h b/Utilities/KWIML/include/kwiml/int.h new file mode 100644 index 000000000..b297acee4 --- /dev/null +++ b/Utilities/KWIML/include/kwiml/int.h @@ -0,0 +1,1069 @@ +/*============================================================================ + Kitware Information Macro Library + Copyright 2010-2015 Kitware, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Kitware, Inc. nor the names of its contributors + may be used to endorse or promote products derived from this + software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +============================================================================*/ +/* +This header defines macros with information about sized integer types. +Only information that can be determined using the preprocessor at +compilation time is available. No try-compile results may be added +here. Instead we memorize results on platforms of interest. + +An includer may optionally define the following macros to suppress errors: + +Input: + KWIML_INT_NO_VERIFY = skip verification declarations + KWIML_INT_NO_ERROR_INT64_T = type 'KWIML_INT_int64_t' is optional (*) + KWIML_INT_NO_ERROR_UINT64_T = type 'KWIML_INT_uint64_t' is optional (*) + KWIML_INT_NO_ERROR_INTPTR_T = type 'KWIML_INT_intptr_t' is optional (*) + KWIML_INT_NO_ERROR_UINTPTR_T = type 'KWIML_INT_uintptr_t' is optional (*) + +An includer may optionally define the following macros to override defaults. +Either way, an includer may test these macros after inclusion: + + KWIML_INT_HAVE_STDINT_H = include + KWIML_INT_NO_STDINT_H = do not include + KWIML_INT_HAVE_INTTYPES_H = include + KWIML_INT_NO_INTTYPES_H = do not include + +An includer may test the following macros after inclusion: + + KWIML_INT_VERSION = interface version number # of this header + + KWIML_INT_HAVE_INT#_T = type 'int#_t' is available + KWIML_INT_HAVE_UINT#_T = type 'uint#_t' is available + # = 8, 16, 32, 64, PTR + + KWIML_INT_int#_t = signed integer type exactly # bits wide + KWIML_INT_uint#_t = unsigned integer type exactly # bits wide + # = 8, 16, 32, 64 (*), ptr (*) + + KWIML_INT_NO_INT64_T = type 'KWIML_INT_int64_t' not available + KWIML_INT_NO_UINT64_T = type 'KWIML_INT_uint64_t' not available + KWIML_INT_NO_INTPTR_T = type 'KWIML_INT_intptr_t' not available + KWIML_INT_NO_UINTPTR_T = type 'KWIML_INT_uintptr_t' not available + + KWIML_INT_INT#_C(c) = signed integer constant at least # bits wide + KWIML_INT_UINT#_C(c) = unsigned integer constant at least # bits wide + # = 8, 16, 32, 64 (*) + + KWIML_INT_# = print or scan format, in table below + # = 8, 16, 32, 64, PTR (*) + + signed unsigned + ----------- ------------------------------ + | decimal | decimal octal hexadecimal | + print | PRId PRIi | PRIu PRIo PRIx PRIX | + scan | SCNd SCNi | SCNu SCNo SCNx | + ----------- ------------------------------ + + The SCN*8 and SCN*64 format macros will not be defined on systems + with scanf implementations known not to support them. + + KWIML_INT_BROKEN_# = macro # is incorrect if defined + Some compilers define integer format macros incorrectly for their + own formatted print/scan implementations. + + KWIML_INT_BROKEN_INT#_C = macro INT#_C is incorrect if defined + KWIML_INT_BROKEN_UINT#_C = macro UINT#_C is incorrect if defined + Some compilers define integer constant macros incorrectly and + cannot handle literals as large as the integer type or even + produce bad preprocessor syntax. + + KWIML_INT_BROKEN_INT8_T = type 'int8_t' is available but incorrect + Some compilers have a flag to make 'char' (un)signed but do not account + for it while defining int8_t in the non-default case. + + The broken cases do not affect correctness of the macros documented above. +*/ + +#include "abi.h" + +#define KWIML_INT_private_VERSION 1 + +/* Guard definition of this version. */ +#ifndef KWIML_INT_detail_DEFINED_VERSION_1 +# define KWIML_INT_detail_DEFINED_VERSION_1 1 +# define KWIML_INT_private_DO_DEFINE +#endif + +/* Guard verification of this version. */ +#if !defined(KWIML_INT_NO_VERIFY) +# ifndef KWIML_INT_detail_VERIFIED_VERSION_1 +# define KWIML_INT_detail_VERIFIED_VERSION_1 +# define KWIML_INT_private_DO_VERIFY +# endif +#endif + +#ifdef KWIML_INT_private_DO_DEFINE +#undef KWIML_INT_private_DO_DEFINE + +/* Define version as most recent of those included. */ +#if !defined(KWIML_INT_VERSION) || KWIML_INT_VERSION < KWIML_INT_private_VERSION +# undef KWIML_INT_VERSION +# define KWIML_INT_VERSION 1 +#endif + +/*--------------------------------------------------------------------------*/ +#if defined(KWIML_INT_HAVE_STDINT_H) /* Already defined. */ +#elif defined(KWIML_INT_NO_STDINT_H) /* Already defined. */ +#elif defined(HAVE_STDINT_H) /* Optionally provided by includer. */ +# define KWIML_INT_HAVE_STDINT_H 1 +#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ +# define KWIML_INT_HAVE_STDINT_H 1 +#elif defined(_MSC_VER) /* MSVC */ +# if _MSC_VER >= 1600 +# define KWIML_INT_HAVE_STDINT_H 1 +# else +# define KWIML_INT_NO_STDINT_H 1 +# endif +#elif defined(__BORLANDC__) /* Borland */ +# if __BORLANDC__ >= 0x560 +# define KWIML_INT_HAVE_STDINT_H 1 +# else +# define KWIML_INT_NO_STDINT_H 1 +# endif +#elif defined(__WATCOMC__) /* Watcom */ +# define KWIML_INT_NO_STDINT_H 1 +#endif + +/*--------------------------------------------------------------------------*/ +#if defined(KWIML_INT_HAVE_INTTYPES_H) /* Already defined. */ +#elif defined(KWIML_INT_NO_INTTYPES_H) /* Already defined. */ +#elif defined(HAVE_INTTYPES_H) /* Optionally provided by includer. */ +# define KWIML_INT_HAVE_INTTYPES_H 1 +#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ +# define KWIML_INT_HAVE_INTTYPES_H 1 +#elif defined(_MSC_VER) /* MSVC */ +# define KWIML_INT_NO_INTTYPES_H 1 +#elif defined(__BORLANDC__) /* Borland */ +# define KWIML_INT_NO_INTTYPES_H 1 +#elif defined(__WATCOMC__) /* Watcom */ +# define KWIML_INT_NO_INTTYPES_H 1 +#else /* Assume it exists. */ +# define KWIML_INT_HAVE_INTTYPES_H 1 +#endif + +/*--------------------------------------------------------------------------*/ +#if defined(KWIML_INT_HAVE_STDINT_H) && defined(KWIML_INT_NO_STDINT_H) +# error "Both KWIML_INT_HAVE_STDINT_H and KWIML_INT_NO_STDINT_H defined!" +#endif +#if defined(KWIML_INT_HAVE_INTTYPES_H) && defined(KWIML_INT_NO_INTTYPES_H) +# error "Both KWIML_INT_HAVE_INTTYPES_H and KWIML_INT_NO_INTTYPES_H defined!" +#endif + +#if defined(KWIML_INT_HAVE_STDINT_H) +# ifndef KWIML_INT_detail_INCLUDED_STDINT_H +# define KWIML_INT_detail_INCLUDED_STDINT_H +# include +# endif +#endif +#if defined(KWIML_INT_HAVE_INTTYPES_H) +# ifndef KWIML_INT_detail_INCLUDED_INTTYPES_H +# define KWIML_INT_detail_INCLUDED_INTTYPES_H +# if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS) +# define __STDC_FORMAT_MACROS +# endif +# include +# endif +#endif + +#if defined(KWIML_INT_HAVE_STDINT_H) || defined(KWIML_INT_HAVE_INTTYPES_H) +#define KWIML_INT_HAVE_INT8_T 1 +#define KWIML_INT_HAVE_UINT8_T 1 +#define KWIML_INT_HAVE_INT16_T 1 +#define KWIML_INT_HAVE_UINT16_T 1 +#define KWIML_INT_HAVE_INT32_T 1 +#define KWIML_INT_HAVE_UINT32_T 1 +#define KWIML_INT_HAVE_INT64_T 1 +#define KWIML_INT_HAVE_UINT64_T 1 +#define KWIML_INT_HAVE_INTPTR_T 1 +#define KWIML_INT_HAVE_UINTPTR_T 1 +# if defined(__cplusplus) +# define KWIML_INT_detail_GLOBAL_NS(T) ::T +# else +# define KWIML_INT_detail_GLOBAL_NS(T) T +# endif +#endif + +#if defined(_AIX43) && !defined(_AIX50) && !defined(_AIX51) + /* AIX 4.3 defines these incorrectly with % and no quotes. */ +# define KWIML_INT_BROKEN_PRId8 1 +# define KWIML_INT_BROKEN_SCNd8 1 +# define KWIML_INT_BROKEN_PRIi8 1 +# define KWIML_INT_BROKEN_SCNi8 1 +# define KWIML_INT_BROKEN_PRIo8 1 +# define KWIML_INT_BROKEN_SCNo8 1 +# define KWIML_INT_BROKEN_PRIu8 1 +# define KWIML_INT_BROKEN_SCNu8 1 +# define KWIML_INT_BROKEN_PRIx8 1 +# define KWIML_INT_BROKEN_SCNx8 1 +# define KWIML_INT_BROKEN_PRIX8 1 +# define KWIML_INT_BROKEN_PRId16 1 +# define KWIML_INT_BROKEN_SCNd16 1 +# define KWIML_INT_BROKEN_PRIi16 1 +# define KWIML_INT_BROKEN_SCNi16 1 +# define KWIML_INT_BROKEN_PRIo16 1 +# define KWIML_INT_BROKEN_SCNo16 1 +# define KWIML_INT_BROKEN_PRIu16 1 +# define KWIML_INT_BROKEN_SCNu16 1 +# define KWIML_INT_BROKEN_PRIx16 1 +# define KWIML_INT_BROKEN_SCNx16 1 +# define KWIML_INT_BROKEN_PRIX16 1 +# define KWIML_INT_BROKEN_PRId32 1 +# define KWIML_INT_BROKEN_SCNd32 1 +# define KWIML_INT_BROKEN_PRIi32 1 +# define KWIML_INT_BROKEN_SCNi32 1 +# define KWIML_INT_BROKEN_PRIo32 1 +# define KWIML_INT_BROKEN_SCNo32 1 +# define KWIML_INT_BROKEN_PRIu32 1 +# define KWIML_INT_BROKEN_SCNu32 1 +# define KWIML_INT_BROKEN_PRIx32 1 +# define KWIML_INT_BROKEN_SCNx32 1 +# define KWIML_INT_BROKEN_PRIX32 1 +# define KWIML_INT_BROKEN_PRId64 1 +# define KWIML_INT_BROKEN_SCNd64 1 +# define KWIML_INT_BROKEN_PRIi64 1 +# define KWIML_INT_BROKEN_SCNi64 1 +# define KWIML_INT_BROKEN_PRIo64 1 +# define KWIML_INT_BROKEN_SCNo64 1 +# define KWIML_INT_BROKEN_PRIu64 1 +# define KWIML_INT_BROKEN_SCNu64 1 +# define KWIML_INT_BROKEN_PRIx64 1 +# define KWIML_INT_BROKEN_SCNx64 1 +# define KWIML_INT_BROKEN_PRIX64 1 +# define KWIML_INT_BROKEN_PRIdPTR 1 +# define KWIML_INT_BROKEN_SCNdPTR 1 +# define KWIML_INT_BROKEN_PRIiPTR 1 +# define KWIML_INT_BROKEN_SCNiPTR 1 +# define KWIML_INT_BROKEN_PRIoPTR 1 +# define KWIML_INT_BROKEN_SCNoPTR 1 +# define KWIML_INT_BROKEN_PRIuPTR 1 +# define KWIML_INT_BROKEN_SCNuPTR 1 +# define KWIML_INT_BROKEN_PRIxPTR 1 +# define KWIML_INT_BROKEN_SCNxPTR 1 +# define KWIML_INT_BROKEN_PRIXPTR 1 +#endif + +#if (defined(__SUNPRO_C)||defined(__SUNPRO_CC)) && defined(_CHAR_IS_UNSIGNED) +# define KWIML_INT_BROKEN_INT8_T 1 /* system type defined incorrectly */ +#elif defined(__BORLANDC__) && defined(_CHAR_UNSIGNED) +# define KWIML_INT_BROKEN_INT8_T 1 /* system type defined incorrectly */ +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_INT_int8_t) +# if defined(KWIML_INT_HAVE_INT8_T) && !defined(KWIML_INT_BROKEN_INT8_T) +# define KWIML_INT_int8_t KWIML_INT_detail_GLOBAL_NS(int8_t) +# else +# define KWIML_INT_int8_t signed char +# endif +#endif +#if !defined(KWIML_INT_uint8_t) +# if defined(KWIML_INT_HAVE_UINT8_T) +# define KWIML_INT_uint8_t KWIML_INT_detail_GLOBAL_NS(uint8_t) +# else +# define KWIML_INT_uint8_t unsigned char +# endif +#endif + +#if defined(__INTEL_COMPILER) +# if defined(_WIN32) +# define KWIML_INT_private_NO_SCN8 +# endif +#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) +# define KWIML_INT_private_NO_SCN8 +#elif defined(__BORLANDC__) +# define KWIML_INT_private_NO_SCN8 +# define KWIML_INT_private_NO_SCN64 +#elif defined(_MSC_VER) +# define KWIML_INT_private_NO_SCN8 +#elif defined(__WATCOMC__) +# define KWIML_INT_private_NO_SCN8 +# elif defined(__hpux) /* HP runtime lacks support (any compiler) */ +# define KWIML_INT_private_NO_SCN8 +#endif + +/* 8-bit d, i */ +#if !defined(KWIML_INT_PRId8) +# if defined(KWIML_INT_HAVE_INT8_T) && defined(PRId8) \ + && !defined(KWIML_INT_BROKEN_PRId8) +# define KWIML_INT_PRId8 PRId8 +# else +# define KWIML_INT_PRId8 "d" +# endif +#endif +#if !defined(KWIML_INT_SCNd8) +# if defined(KWIML_INT_HAVE_INT8_T) && defined(SCNd8) \ + && !defined(KWIML_INT_BROKEN_SCNd8) +# define KWIML_INT_SCNd8 SCNd8 +# elif !defined(KWIML_INT_private_NO_SCN8) +# define KWIML_INT_SCNd8 "hhd" +# endif +#endif +#if !defined(KWIML_INT_PRIi8) +# if defined(KWIML_INT_HAVE_INT8_T) && defined(PRIi8) \ + && !defined(KWIML_INT_BROKEN_PRIi8) +# define KWIML_INT_PRIi8 PRIi8 +# else +# define KWIML_INT_PRIi8 "i" +# endif +#endif +#if !defined(KWIML_INT_SCNi8) +# if defined(KWIML_INT_HAVE_INT8_T) && defined(SCNi8) \ + && !defined(KWIML_INT_BROKEN_SCNi8) +# define KWIML_INT_SCNi8 SCNi8 +# elif !defined(KWIML_INT_private_NO_SCN8) +# define KWIML_INT_SCNi8 "hhi" +# endif +#endif + +/* 8-bit o, u, x, X */ +#if !defined(KWIML_INT_PRIo8) +# if defined(KWIML_INT_HAVE_UINT8_T) && defined(PRIo8) \ + && !defined(KWIML_INT_BROKEN_PRIo8) +# define KWIML_INT_PRIo8 PRIo8 +# else +# define KWIML_INT_PRIo8 "o" +# endif +#endif +#if !defined(KWIML_INT_SCNo8) +# if defined(KWIML_INT_HAVE_UINT8_T) && defined(SCNo8) \ + && !defined(KWIML_INT_BROKEN_SCNo8) +# define KWIML_INT_SCNo8 SCNo8 +# elif !defined(KWIML_INT_private_NO_SCN8) +# define KWIML_INT_SCNo8 "hho" +# endif +#endif +#if !defined(KWIML_INT_PRIu8) +# if defined(KWIML_INT_HAVE_UINT8_T) && defined(PRIu8) \ + && !defined(KWIML_INT_BROKEN_PRIu8) +# define KWIML_INT_PRIu8 PRIu8 +# else +# define KWIML_INT_PRIu8 "u" +# endif +#endif +#if !defined(KWIML_INT_SCNu8) +# if defined(KWIML_INT_HAVE_UINT8_T) && defined(SCNu8) \ + && !defined(KWIML_INT_BROKEN_SCNu8) +# define KWIML_INT_SCNu8 SCNu8 +# elif !defined(KWIML_INT_private_NO_SCN8) +# define KWIML_INT_SCNu8 "hhu" +# endif +#endif +#if !defined(KWIML_INT_PRIx8) +# if defined(KWIML_INT_HAVE_UINT8_T) && defined(PRIx8) \ + && !defined(KWIML_INT_BROKEN_PRIx8) +# define KWIML_INT_PRIx8 PRIx8 +# else +# define KWIML_INT_PRIx8 "x" +# endif +#endif +#if !defined(KWIML_INT_SCNx8) +# if defined(KWIML_INT_HAVE_UINT8_T) && defined(SCNx8) \ + && !defined(KWIML_INT_BROKEN_SCNx8) +# define KWIML_INT_SCNx8 SCNx8 +# elif !defined(KWIML_INT_private_NO_SCN8) +# define KWIML_INT_SCNx8 "hhx" +# endif +#endif +#if !defined(KWIML_INT_PRIX8) +# if defined(KWIML_INT_HAVE_UINT8_T) && defined(PRIX8) \ + && !defined(KWIML_INT_BROKEN_PRIX8) +# define KWIML_INT_PRIX8 PRIX8 +# else +# define KWIML_INT_PRIX8 "X" +# endif +#endif + +/* 8-bit constants */ +#if !defined(KWIML_INT_INT8_C) +# if defined(INT8_C) && !defined(KWIML_INT_BROKEN_INT8_C) +# define KWIML_INT_INT8_C(c) INT8_C(c) +# else +# define KWIML_INT_INT8_C(c) c +# endif +#endif +#if !defined(KWIML_INT_UINT8_C) +# if defined(UINT8_C) && !defined(KWIML_INT_BROKEN_UINT8_C) +# define KWIML_INT_UINT8_C(c) UINT8_C(c) +# else +# define KWIML_INT_UINT8_C(c) c ## u +# endif +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_INT_int16_t) +# if defined(KWIML_INT_HAVE_INT16_T) +# define KWIML_INT_int16_t KWIML_INT_detail_GLOBAL_NS(int16_t) +# else +# define KWIML_INT_int16_t signed short +# endif +#endif +#if !defined(KWIML_INT_uint16_t) +# if defined(KWIML_INT_HAVE_UINT16_T) +# define KWIML_INT_uint16_t KWIML_INT_detail_GLOBAL_NS(uint16_t) +# else +# define KWIML_INT_uint16_t unsigned short +# endif +#endif + +/* 16-bit d, i */ +#if !defined(KWIML_INT_PRId16) +# if defined(KWIML_INT_HAVE_INT16_T) && defined(PRId16) \ + && !defined(KWIML_INT_BROKEN_PRId16) +# define KWIML_INT_PRId16 PRId16 +# else +# define KWIML_INT_PRId16 "d" +# endif +#endif +#if !defined(KWIML_INT_SCNd16) +# if defined(KWIML_INT_HAVE_INT16_T) && defined(SCNd16) \ + && !defined(KWIML_INT_BROKEN_SCNd16) +# define KWIML_INT_SCNd16 SCNd16 +# else +# define KWIML_INT_SCNd16 "hd" +# endif +#endif +#if !defined(KWIML_INT_PRIi16) +# if defined(KWIML_INT_HAVE_INT16_T) && defined(PRIi16) \ + && !defined(KWIML_INT_BROKEN_PRIi16) +# define KWIML_INT_PRIi16 PRIi16 +# else +# define KWIML_INT_PRIi16 "i" +# endif +#endif +#if !defined(KWIML_INT_SCNi16) +# if defined(KWIML_INT_HAVE_INT16_T) && defined(SCNi16) \ + && !defined(KWIML_INT_BROKEN_SCNi16) +# define KWIML_INT_SCNi16 SCNi16 +# else +# define KWIML_INT_SCNi16 "hi" +# endif +#endif + +/* 16-bit o, u, x, X */ +#if !defined(KWIML_INT_PRIo16) +# if defined(KWIML_INT_HAVE_UINT16_T) && defined(PRIo16) \ + && !defined(KWIML_INT_BROKEN_PRIo16) +# define KWIML_INT_PRIo16 PRIo16 +# else +# define KWIML_INT_PRIo16 "o" +# endif +#endif +#if !defined(KWIML_INT_SCNo16) +# if defined(KWIML_INT_HAVE_UINT16_T) && defined(SCNo16) \ + && !defined(KWIML_INT_BROKEN_SCNo16) +# define KWIML_INT_SCNo16 SCNo16 +# else +# define KWIML_INT_SCNo16 "ho" +# endif +#endif +#if !defined(KWIML_INT_PRIu16) +# if defined(KWIML_INT_HAVE_UINT16_T) && defined(PRIu16) \ + && !defined(KWIML_INT_BROKEN_PRIu16) +# define KWIML_INT_PRIu16 PRIu16 +# else +# define KWIML_INT_PRIu16 "u" +# endif +#endif +#if !defined(KWIML_INT_SCNu16) +# if defined(KWIML_INT_HAVE_UINT16_T) && defined(SCNu16) \ + && !defined(KWIML_INT_BROKEN_SCNu16) +# define KWIML_INT_SCNu16 SCNu16 +# else +# define KWIML_INT_SCNu16 "hu" +# endif +#endif +#if !defined(KWIML_INT_PRIx16) +# if defined(KWIML_INT_HAVE_UINT16_T) && defined(PRIx16) \ + && !defined(KWIML_INT_BROKEN_PRIx16) +# define KWIML_INT_PRIx16 PRIx16 +# else +# define KWIML_INT_PRIx16 "x" +# endif +#endif +#if !defined(KWIML_INT_SCNx16) +# if defined(KWIML_INT_HAVE_UINT16_T) && defined(SCNx16) \ + && !defined(KWIML_INT_BROKEN_SCNx16) +# define KWIML_INT_SCNx16 SCNx16 +# else +# define KWIML_INT_SCNx16 "hx" +# endif +#endif +#if !defined(KWIML_INT_PRIX16) +# if defined(KWIML_INT_HAVE_UINT16_T) && defined(PRIX16) \ + && !defined(KWIML_INT_BROKEN_PRIX16) +# define KWIML_INT_PRIX16 PRIX16 +# else +# define KWIML_INT_PRIX16 "X" +# endif +#endif + +/* 16-bit constants */ +#if !defined(KWIML_INT_INT16_C) +# if defined(INT16_C) && !defined(KWIML_INT_BROKEN_INT16_C) +# define KWIML_INT_INT16_C(c) INT16_C(c) +# else +# define KWIML_INT_INT16_C(c) c +# endif +#endif +#if !defined(KWIML_INT_UINT16_C) +# if defined(UINT16_C) && !defined(KWIML_INT_BROKEN_UINT16_C) +# define KWIML_INT_UINT16_C(c) UINT16_C(c) +# else +# define KWIML_INT_UINT16_C(c) c ## u +# endif +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_INT_int32_t) +# if defined(KWIML_INT_HAVE_INT32_T) +# define KWIML_INT_int32_t KWIML_INT_detail_GLOBAL_NS(int32_t) +# else +# define KWIML_INT_int32_t signed int +# endif +#endif +#if !defined(KWIML_INT_uint32_t) +# if defined(KWIML_INT_HAVE_UINT32_T) +# define KWIML_INT_uint32_t KWIML_INT_detail_GLOBAL_NS(uint32_t) +# else +# define KWIML_INT_uint32_t unsigned int +# endif +#endif + +/* 32-bit d, i */ +#if !defined(KWIML_INT_PRId32) +# if defined(KWIML_INT_HAVE_INT32_T) && defined(PRId32) \ + && !defined(KWIML_INT_BROKEN_PRId32) +# define KWIML_INT_PRId32 PRId32 +# else +# define KWIML_INT_PRId32 "d" +# endif +#endif +#if !defined(KWIML_INT_SCNd32) +# if defined(KWIML_INT_HAVE_INT32_T) && defined(SCNd32) \ + && !defined(KWIML_INT_BROKEN_SCNd32) +# define KWIML_INT_SCNd32 SCNd32 +# else +# define KWIML_INT_SCNd32 "d" +# endif +#endif +#if !defined(KWIML_INT_PRIi32) +# if defined(KWIML_INT_HAVE_INT32_T) && defined(PRIi32) \ + && !defined(KWIML_INT_BROKEN_PRIi32) +# define KWIML_INT_PRIi32 PRIi32 +# else +# define KWIML_INT_PRIi32 "i" +# endif +#endif +#if !defined(KWIML_INT_SCNi32) +# if defined(KWIML_INT_HAVE_INT32_T) && defined(SCNi32) \ + && !defined(KWIML_INT_BROKEN_SCNi32) +# define KWIML_INT_SCNi32 SCNi32 +# else +# define KWIML_INT_SCNi32 "i" +# endif +#endif + +/* 32-bit o, u, x, X */ +#if !defined(KWIML_INT_PRIo32) +# if defined(KWIML_INT_HAVE_UINT32_T) && defined(PRIo32) \ + && !defined(KWIML_INT_BROKEN_PRIo32) +# define KWIML_INT_PRIo32 PRIo32 +# else +# define KWIML_INT_PRIo32 "o" +# endif +#endif +#if !defined(KWIML_INT_SCNo32) +# if defined(KWIML_INT_HAVE_UINT32_T) && defined(SCNo32) \ + && !defined(KWIML_INT_BROKEN_SCNo32) +# define KWIML_INT_SCNo32 SCNo32 +# else +# define KWIML_INT_SCNo32 "o" +# endif +#endif +#if !defined(KWIML_INT_PRIu32) +# if defined(KWIML_INT_HAVE_UINT32_T) && defined(PRIu32) \ + && !defined(KWIML_INT_BROKEN_PRIu32) +# define KWIML_INT_PRIu32 PRIu32 +# else +# define KWIML_INT_PRIu32 "u" +# endif +#endif +#if !defined(KWIML_INT_SCNu32) +# if defined(KWIML_INT_HAVE_UINT32_T) && defined(SCNu32) \ + && !defined(KWIML_INT_BROKEN_SCNu32) +# define KWIML_INT_SCNu32 SCNu32 +# else +# define KWIML_INT_SCNu32 "u" +# endif +#endif +#if !defined(KWIML_INT_PRIx32) +# if defined(KWIML_INT_HAVE_UINT32_T) && defined(PRIx32) \ + && !defined(KWIML_INT_BROKEN_PRIx32) +# define KWIML_INT_PRIx32 PRIx32 +# else +# define KWIML_INT_PRIx32 "x" +# endif +#endif +#if !defined(KWIML_INT_SCNx32) +# if defined(KWIML_INT_HAVE_UINT32_T) && defined(SCNx32) \ + && !defined(KWIML_INT_BROKEN_SCNx32) +# define KWIML_INT_SCNx32 SCNx32 +# else +# define KWIML_INT_SCNx32 "x" +# endif +#endif +#if !defined(KWIML_INT_PRIX32) +# if defined(KWIML_INT_HAVE_UINT32_T) && defined(PRIX32) \ + && !defined(KWIML_INT_BROKEN_PRIX32) +# define KWIML_INT_PRIX32 PRIX32 +# else +# define KWIML_INT_PRIX32 "X" +# endif +#endif + +#if defined(__hpux) && defined(__GNUC__) && !defined(__LP64__) \ + && defined(__CONCAT__) && defined(__CONCAT_U__) + /* Some HPs define UINT32_C incorrectly and break GNU. */ +# define KWIML_INT_BROKEN_UINT32_C 1 +#endif + +/* 32-bit constants */ +#if !defined(KWIML_INT_INT32_C) +# if defined(INT32_C) && !defined(KWIML_INT_BROKEN_INT32_C) +# define KWIML_INT_INT32_C(c) INT32_C(c) +# else +# define KWIML_INT_INT32_C(c) c +# endif +#endif +#if !defined(KWIML_INT_UINT32_C) +# if defined(UINT32_C) && !defined(KWIML_INT_BROKEN_UINT32_C) +# define KWIML_INT_UINT32_C(c) UINT32_C(c) +# else +# define KWIML_INT_UINT32_C(c) c ## u +# endif +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_INT_int64_t) && !defined(KWIML_INT_NO_INT64_T) +# if defined(KWIML_INT_HAVE_INT64_T) +# define KWIML_INT_int64_t KWIML_INT_detail_GLOBAL_NS(int64_t) +# elif KWIML_ABI_SIZEOF_LONG == 8 +# define KWIML_INT_int64_t signed long +# elif defined(KWIML_ABI_SIZEOF_LONG_LONG) && KWIML_ABI_SIZEOF_LONG_LONG == 8 +# define KWIML_INT_int64_t signed long long +# elif defined(KWIML_ABI_SIZEOF___INT64) +# define KWIML_INT_int64_t signed __int64 +# elif defined(KWIML_INT_NO_ERROR_INT64_T) +# define KWIML_INT_NO_INT64_T +# else +# error "No type known for 'int64_t'." +# endif +#endif +#if !defined(KWIML_INT_uint64_t) && !defined(KWIML_INT_NO_UINT64_T) +# if defined(KWIML_INT_HAVE_UINT64_T) +# define KWIML_INT_uint64_t KWIML_INT_detail_GLOBAL_NS(uint64_t) +# elif KWIML_ABI_SIZEOF_LONG == 8 +# define KWIML_INT_uint64_t unsigned long +# elif defined(KWIML_ABI_SIZEOF_LONG_LONG) && KWIML_ABI_SIZEOF_LONG_LONG == 8 +# define KWIML_INT_uint64_t unsigned long long +# elif defined(KWIML_ABI_SIZEOF___INT64) +# define KWIML_INT_uint64_t unsigned __int64 +# elif defined(KWIML_INT_NO_ERROR_UINT64_T) +# define KWIML_INT_NO_UINT64_T +# else +# error "No type known for 'uint64_t'." +# endif +#endif + +#if defined(__INTEL_COMPILER) +#elif defined(__BORLANDC__) +# define KWIML_INT_private_NO_FMTLL /* type 'long long' but not 'll' format */ +# define KWIML_INT_BROKEN_INT64_C 1 /* system macro defined incorrectly */ +# define KWIML_INT_BROKEN_UINT64_C 1 /* system macro defined incorrectly */ +#elif defined(_MSC_VER) && _MSC_VER < 1400 +# define KWIML_INT_private_NO_FMTLL /* type 'long long' but not 'll' format */ +#endif + +#if !defined(KWIML_INT_detail_FMT64) +# if KWIML_ABI_SIZEOF_LONG == 8 +# define KWIML_INT_detail_FMT64 "l" +# elif defined(KWIML_ABI_SIZEOF_LONG_LONG) && KWIML_ABI_SIZEOF_LONG_LONG == 8 +# if !defined(KWIML_INT_private_NO_FMTLL) +# define KWIML_INT_detail_FMT64 "ll" +# else +# define KWIML_INT_detail_FMT64 "I64" +# endif +# elif defined(KWIML_ABI_SIZEOF___INT64) +# if defined(__BORLANDC__) +# define KWIML_INT_detail_FMT64 "L" +# else +# define KWIML_INT_detail_FMT64 "I64" +# endif +# endif +#endif + +#undef KWIML_INT_private_NO_FMTLL + +/* 64-bit d, i */ +#if !defined(KWIML_INT_PRId64) +# if defined(KWIML_INT_HAVE_INT64_T) && defined(PRId64) \ + && !defined(KWIML_INT_BROKEN_PRId64) +# define KWIML_INT_PRId64 PRId64 +# elif defined(KWIML_INT_detail_FMT64) +# define KWIML_INT_PRId64 KWIML_INT_detail_FMT64 "d" +# endif +#endif +#if !defined(KWIML_INT_SCNd64) +# if defined(KWIML_INT_HAVE_INT64_T) && defined(SCNd64) \ + && !defined(KWIML_INT_BROKEN_SCNd64) +# define KWIML_INT_SCNd64 SCNd64 +# elif defined(KWIML_INT_detail_FMT64) && !defined(KWIML_INT_private_NO_SCN64) +# define KWIML_INT_SCNd64 KWIML_INT_detail_FMT64 "d" +# endif +#endif +#if !defined(KWIML_INT_PRIi64) +# if defined(KWIML_INT_HAVE_INT64_T) && defined(PRIi64) \ + && !defined(KWIML_INT_BROKEN_PRIi64) +# define KWIML_INT_PRIi64 PRIi64 +# elif defined(KWIML_INT_detail_FMT64) +# define KWIML_INT_PRIi64 KWIML_INT_detail_FMT64 "d" +# endif +#endif +#if !defined(KWIML_INT_SCNi64) +# if defined(KWIML_INT_HAVE_INT64_T) && defined(SCNi64) \ + && !defined(KWIML_INT_BROKEN_SCNi64) +# define KWIML_INT_SCNi64 SCNi64 +# elif defined(KWIML_INT_detail_FMT64) && !defined(KWIML_INT_private_NO_SCN64) +# define KWIML_INT_SCNi64 KWIML_INT_detail_FMT64 "d" +# endif +#endif + +/* 64-bit o, u, x, X */ +#if !defined(KWIML_INT_PRIo64) +# if defined(KWIML_INT_HAVE_UINT64_T) && defined(PRIo64) \ + && !defined(KWIML_INT_BROKEN_PRIo64) +# define KWIML_INT_PRIo64 PRIo64 +# elif defined(KWIML_INT_detail_FMT64) +# define KWIML_INT_PRIo64 KWIML_INT_detail_FMT64 "o" +# endif +#endif +#if !defined(KWIML_INT_SCNo64) +# if defined(KWIML_INT_HAVE_UINT64_T) && defined(SCNo64) \ + && !defined(KWIML_INT_BROKEN_SCNo64) +# define KWIML_INT_SCNo64 SCNo64 +# elif defined(KWIML_INT_detail_FMT64) && !defined(KWIML_INT_private_NO_SCN64) +# define KWIML_INT_SCNo64 KWIML_INT_detail_FMT64 "o" +# endif +#endif +#if !defined(KWIML_INT_PRIu64) +# if defined(KWIML_INT_HAVE_UINT64_T) && defined(PRIu64) \ + && !defined(KWIML_INT_BROKEN_PRIu64) +# define KWIML_INT_PRIu64 PRIu64 +# elif defined(KWIML_INT_detail_FMT64) +# define KWIML_INT_PRIu64 KWIML_INT_detail_FMT64 "u" +# endif +#endif +#if !defined(KWIML_INT_SCNu64) +# if defined(KWIML_INT_HAVE_UINT64_T) && defined(SCNu64) \ + && !defined(KWIML_INT_BROKEN_SCNu64) +# define KWIML_INT_SCNu64 SCNu64 +# elif defined(KWIML_INT_detail_FMT64) && !defined(KWIML_INT_private_NO_SCN64) +# define KWIML_INT_SCNu64 KWIML_INT_detail_FMT64 "u" +# endif +#endif +#if !defined(KWIML_INT_PRIx64) +# if defined(KWIML_INT_HAVE_UINT64_T) && defined(PRIx64) \ + && !defined(KWIML_INT_BROKEN_PRIx64) +# define KWIML_INT_PRIx64 PRIx64 +# elif defined(KWIML_INT_detail_FMT64) +# define KWIML_INT_PRIx64 KWIML_INT_detail_FMT64 "x" +# endif +#endif +#if !defined(KWIML_INT_SCNx64) +# if defined(KWIML_INT_HAVE_UINT64_T) && defined(SCNx64) \ + && !defined(KWIML_INT_BROKEN_SCNx64) +# define KWIML_INT_SCNx64 SCNx64 +# elif defined(KWIML_INT_detail_FMT64) && !defined(KWIML_INT_private_NO_SCN64) +# define KWIML_INT_SCNx64 KWIML_INT_detail_FMT64 "x" +# endif +#endif +#if !defined(KWIML_INT_PRIX64) +# if defined(KWIML_INT_HAVE_UINT64_T) && defined(PRIX64) \ + && !defined(KWIML_INT_BROKEN_PRIX64) +# define KWIML_INT_PRIX64 PRIX64 +# elif defined(KWIML_INT_detail_FMT64) +# define KWIML_INT_PRIX64 KWIML_INT_detail_FMT64 "X" +# endif +#endif + +/* 64-bit constants */ +#if !defined(KWIML_INT_INT64_C) +# if defined(KWIML_INT_HAVE_INT64_T) && defined(INT64_C) \ + && !defined(KWIML_INT_BROKEN_INT64_C) +# define KWIML_INT_INT64_C(c) INT64_C(c) +# elif KWIML_ABI_SIZEOF_LONG == 8 +# define KWIML_INT_INT64_C(c) c ## l +# elif defined(KWIML_ABI_SIZEOF_LONG_LONG) && KWIML_ABI_SIZEOF_LONG_LONG == 8 +# define KWIML_INT_INT64_C(c) c ## ll +# elif defined(KWIML_ABI_SIZEOF___INT64) +# define KWIML_INT_INT64_C(c) c ## i64 +# endif +#endif +#if !defined(KWIML_INT_UINT64_C) +# if defined(KWIML_INT_HAVE_UINT64_T) && defined(UINT64_C) \ + && !defined(KWIML_INT_BROKEN_UINT64_C) +# define KWIML_INT_UINT64_C(c) UINT64_C(c) +# elif KWIML_ABI_SIZEOF_LONG == 8 +# define KWIML_INT_UINT64_C(c) c ## ul +# elif defined(KWIML_ABI_SIZEOF_LONG_LONG) && KWIML_ABI_SIZEOF_LONG_LONG == 8 +# define KWIML_INT_UINT64_C(c) c ## ull +# elif defined(KWIML_ABI_SIZEOF___INT64) +# define KWIML_INT_UINT64_C(c) c ## ui64 +# endif +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_INT_intptr_t) && !defined(KWIML_INT_NO_INTPTR_T) +# if defined(KWIML_INT_HAVE_INTPTR_T) +# define KWIML_INT_intptr_t KWIML_INT_detail_GLOBAL_NS(intptr_t) +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_intptr_t KWIML_INT_int32_t +# elif !defined(KWIML_INT_NO_INT64_T) +# define KWIML_INT_intptr_t KWIML_INT_int64_t +# elif defined(KWIML_INT_NO_ERROR_INTPTR_T) +# define KWIML_INT_NO_INTPTR_T +# else +# error "No type known for 'intptr_t'." +# endif +#endif +#if !defined(KWIML_INT_uintptr_t) && !defined(KWIML_INT_NO_UINTPTR_T) +# if defined(KWIML_INT_HAVE_UINTPTR_T) +# define KWIML_INT_uintptr_t KWIML_INT_detail_GLOBAL_NS(uintptr_t) +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_uintptr_t KWIML_INT_uint32_t +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_uintptr_t KWIML_INT_uint64_t +# elif defined(KWIML_INT_NO_ERROR_UINTPTR_T) +# define KWIML_INT_NO_UINTPTR_T +# else +# error "No type known for 'uintptr_t'." +# endif +#endif + +#if !defined(KWIML_INT_PRIdPTR) +# if defined(KWIML_INT_HAVE_INTPTR_T) && defined(PRIdPTR) \ + && !defined(KWIML_INT_BROKEN_PRIdPTR) +# define KWIML_INT_PRIdPTR PRIdPTR +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_PRIdPTR KWIML_INT_PRId32 +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_PRIdPTR KWIML_INT_PRId64 +# endif +#endif +#if !defined(KWIML_INT_SCNdPTR) +# if defined(KWIML_INT_HAVE_INTPTR_T) && defined(SCNdPTR) \ + && !defined(KWIML_INT_BROKEN_SCNdPTR) +# define KWIML_INT_SCNdPTR SCNdPTR +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_SCNdPTR KWIML_INT_SCNd32 +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_SCNdPTR KWIML_INT_SCNd64 +# endif +#endif +#if !defined(KWIML_INT_PRIiPTR) +# if defined(KWIML_INT_HAVE_INTPTR_T) && defined(PRIiPTR) \ + && !defined(KWIML_INT_BROKEN_PRIiPTR) +# define KWIML_INT_PRIiPTR PRIiPTR +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_PRIiPTR KWIML_INT_PRIi32 +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_PRIiPTR KWIML_INT_PRIi64 +# endif +#endif +#if !defined(KWIML_INT_SCNiPTR) +# if defined(KWIML_INT_HAVE_INTPTR_T) && defined(SCNiPTR) \ + && !defined(KWIML_INT_BROKEN_SCNiPTR) +# define KWIML_INT_SCNiPTR SCNiPTR +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_SCNiPTR KWIML_INT_SCNi32 +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_SCNiPTR KWIML_INT_SCNi64 +# endif +#endif + +#if !defined(KWIML_INT_PRIoPTR) +# if defined(KWIML_INT_HAVE_UINTPTR_T) && defined(PRIoPTR) \ + && !defined(KWIML_INT_BROKEN_PRIoPTR) +# define KWIML_INT_PRIoPTR PRIoPTR +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_PRIoPTR KWIML_INT_PRIo32 +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_PRIoPTR KWIML_INT_PRIo64 +# endif +#endif +#if !defined(KWIML_INT_SCNoPTR) +# if defined(KWIML_INT_HAVE_UINTPTR_T) && defined(SCNoPTR) \ + && !defined(KWIML_INT_BROKEN_SCNoPTR) +# define KWIML_INT_SCNoPTR SCNoPTR +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_SCNoPTR KWIML_INT_SCNo32 +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_SCNoPTR KWIML_INT_SCNo64 +# endif +#endif +#if !defined(KWIML_INT_PRIuPTR) +# if defined(KWIML_INT_HAVE_UINTPTR_T) && defined(PRIuPTR) \ + && !defined(KWIML_INT_BROKEN_PRIuPTR) +# define KWIML_INT_PRIuPTR PRIuPTR +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_PRIuPTR KWIML_INT_PRIu32 +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_PRIuPTR KWIML_INT_PRIu64 +# endif +#endif +#if !defined(KWIML_INT_SCNuPTR) +# if defined(KWIML_INT_HAVE_UINTPTR_T) && defined(SCNuPTR) \ + && !defined(KWIML_INT_BROKEN_SCNuPTR) +# define KWIML_INT_SCNuPTR SCNuPTR +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_SCNuPTR KWIML_INT_SCNu32 +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_SCNuPTR KWIML_INT_SCNu64 +# endif +#endif +#if !defined(KWIML_INT_PRIxPTR) +# if defined(KWIML_INT_HAVE_UINTPTR_T) && defined(PRIxPTR) \ + && !defined(KWIML_INT_BROKEN_PRIxPTR) +# define KWIML_INT_PRIxPTR PRIxPTR +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_PRIxPTR KWIML_INT_PRIx32 +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_PRIxPTR KWIML_INT_PRIx64 +# endif +#endif +#if !defined(KWIML_INT_SCNxPTR) +# if defined(KWIML_INT_HAVE_UINTPTR_T) && defined(SCNxPTR) \ + && !defined(KWIML_INT_BROKEN_SCNxPTR) +# define KWIML_INT_SCNxPTR SCNxPTR +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_SCNxPTR KWIML_INT_SCNx32 +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_SCNxPTR KWIML_INT_SCNx64 +# endif +#endif +#if !defined(KWIML_INT_PRIXPTR) +# if defined(KWIML_INT_HAVE_UINTPTR_T) && defined(PRIXPTR) \ + && !defined(KWIML_INT_BROKEN_PRIXPTR) +# define KWIML_INT_PRIXPTR PRIXPTR +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_PRIXPTR KWIML_INT_PRIX32 +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_PRIXPTR KWIML_INT_PRIX64 +# endif +#endif + +#undef KWIML_INT_private_NO_SCN64 +#undef KWIML_INT_private_NO_SCN8 + +#endif /* KWIML_INT_private_DO_DEFINE */ + +/*--------------------------------------------------------------------------*/ +#ifdef KWIML_INT_private_DO_VERIFY +#undef KWIML_INT_private_DO_VERIFY + +#if defined(_MSC_VER) +# pragma warning (push) +# pragma warning (disable:4310) /* cast truncates constant value */ +#endif + +#define KWIML_INT_private_VERIFY(n, x, y) KWIML_INT_private_VERIFY_0(KWIML_INT_private_VERSION, n, x, y) +#define KWIML_INT_private_VERIFY_0(V, n, x, y) KWIML_INT_private_VERIFY_1(V, n, x, y) +#define KWIML_INT_private_VERIFY_1(V, n, x, y) extern int (*n##_v##V)[x]; extern int (*n##_v##V)[y] + +#define KWIML_INT_private_VERIFY_BOOL(m, b) KWIML_INT_private_VERIFY(KWIML_INT_detail_VERIFY_##m, 2, (b)?2:3) +#define KWIML_INT_private_VERIFY_TYPE(t, s) KWIML_INT_private_VERIFY(KWIML_INT_detail_VERIFY_##t, s, sizeof(t)) +#define KWIML_INT_private_VERIFY_SIGN(t, u, o) KWIML_INT_private_VERIFY_BOOL(SIGN_##t, (t)((u)1 << ((sizeof(t)<<3)-1)) o 0) + +KWIML_INT_private_VERIFY_TYPE(KWIML_INT_int8_t, 1); +KWIML_INT_private_VERIFY_TYPE(KWIML_INT_uint8_t, 1); +KWIML_INT_private_VERIFY_TYPE(KWIML_INT_int16_t, 2); +KWIML_INT_private_VERIFY_TYPE(KWIML_INT_uint16_t, 2); +KWIML_INT_private_VERIFY_TYPE(KWIML_INT_int32_t, 4); +KWIML_INT_private_VERIFY_TYPE(KWIML_INT_uint32_t, 4); +#if !defined(KWIML_INT_NO_INT64_T) +KWIML_INT_private_VERIFY_TYPE(KWIML_INT_int64_t, 8); +#endif +#if !defined(KWIML_INT_NO_UINT64_T) +KWIML_INT_private_VERIFY_TYPE(KWIML_INT_uint64_t, 8); +#endif +#if !defined(KWIML_INT_NO_INTPTR_T) +KWIML_INT_private_VERIFY_TYPE(KWIML_INT_intptr_t, sizeof(void*)); +#endif +#if !defined(KWIML_INT_NO_UINTPTR_T) +KWIML_INT_private_VERIFY_TYPE(KWIML_INT_uintptr_t, sizeof(void*)); +#endif + +KWIML_INT_private_VERIFY_SIGN(KWIML_INT_int8_t, KWIML_INT_uint8_t, <); +KWIML_INT_private_VERIFY_SIGN(KWIML_INT_uint8_t, KWIML_INT_uint8_t, >); +KWIML_INT_private_VERIFY_SIGN(KWIML_INT_int16_t, KWIML_INT_uint16_t, <); +KWIML_INT_private_VERIFY_SIGN(KWIML_INT_uint16_t, KWIML_INT_uint16_t, >); +KWIML_INT_private_VERIFY_SIGN(KWIML_INT_int32_t, KWIML_INT_uint32_t, <); +KWIML_INT_private_VERIFY_SIGN(KWIML_INT_uint32_t, KWIML_INT_uint32_t, >); +#if !defined(KWIML_INT_NO_INT64_T) +KWIML_INT_private_VERIFY_SIGN(KWIML_INT_int64_t, KWIML_INT_uint64_t, <); +#endif +#if !defined(KWIML_INT_NO_UINT64_T) +KWIML_INT_private_VERIFY_SIGN(KWIML_INT_uint64_t, KWIML_INT_uint64_t, >); +#endif +#if !defined(KWIML_INT_NO_INTPTR_T) +KWIML_INT_private_VERIFY_SIGN(KWIML_INT_intptr_t, KWIML_INT_uintptr_t, <); +#endif +#if !defined(KWIML_INT_NO_UINTPTR_T) +KWIML_INT_private_VERIFY_SIGN(KWIML_INT_uintptr_t, KWIML_INT_uintptr_t, >); +#endif + +#undef KWIML_INT_private_VERIFY_SIGN +#undef KWIML_INT_private_VERIFY_TYPE +#undef KWIML_INT_private_VERIFY_BOOL + +#undef KWIML_INT_private_VERIFY_1 +#undef KWIML_INT_private_VERIFY_0 +#undef KWIML_INT_private_VERIFY + +#if defined(_MSC_VER) +# pragma warning (pop) +#endif + +#endif /* KWIML_INT_private_DO_VERIFY */ + +#undef KWIML_INT_private_VERSION diff --git a/Utilities/KWIML/src/kwiml-config.cmake.in b/Utilities/KWIML/src/kwiml-config.cmake.in new file mode 100644 index 000000000..124f0fc55 --- /dev/null +++ b/Utilities/KWIML/src/kwiml-config.cmake.in @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/kwiml-targets.cmake) diff --git a/Utilities/KWIML/src/version.h.in b/Utilities/KWIML/src/version.h.in new file mode 100644 index 000000000..e58e0dce3 --- /dev/null +++ b/Utilities/KWIML/src/version.h.in @@ -0,0 +1,59 @@ +/*============================================================================ + Kitware Information Macro Library + Copyright 2010-2015 Kitware, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Kitware, Inc. nor the names of its contributors + may be used to endorse or promote products derived from this + software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +============================================================================*/ +#ifndef KWIML_VERSION_H +#define KWIML_VERSION_H +/* +This header defines macros with information about this version of KWIML. + +An includer may test the following macros after inclusion: + + KWIML_VERSION = KWIML version number encoded in an integer as + `printf("%d%03d%03d", MAJOR, MINOR, PATCH)`. + MAJOR is incremented on incompatible changes. + MINOR is incremented on interface additions. + PATCH is incremented on implementation updates. + + KWIML_VERSION_STRING = KWIML version number in string formatted as + `printf("%d.%d.%d", MAJOR, MINOR PATCH)`. + + KWIML_VERSION_HAS_ABI_H = header 'kwiml/abi.h' is available + KWIML_VERSION_HAS_INT_H = header 'kwiml/int.h' is available +*/ + +#define KWIML_VERSION @KWIML_VERSION_DECIMAL@ +#define KWIML_VERSION_STRING "@KWIML_VERSION@" + +#define KWIML_VERSION_HAS_ABI_H 1 +#define KWIML_VERSION_HAS_INT_H 1 + +#endif diff --git a/Utilities/KWIML/test/CMakeLists.txt b/Utilities/KWIML/test/CMakeLists.txt index a16b5cdda..4f6f37b4f 100644 --- a/Utilities/KWIML/test/CMakeLists.txt +++ b/Utilities/KWIML/test/CMakeLists.txt @@ -1,22 +1,11 @@ -#============================================================================= -# Kitware Information Macro Library -# Copyright 2010-2011 Kitware, Inc. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. +# Copyright Kitware, Inc. +# Distributed under the OSI-approved BSD 3-Clause License. +# See accompanying file Copyright.txt for details. # -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= - -set(test_defs KWIML_NAMESPACE=${KWIML}) - -# Tell CMake how to follow dependencies of sources in this directory. -set_property(DIRECTORY - PROPERTY IMPLICIT_DEPENDS_INCLUDE_TRANSFORM - "KWIML_HEADER(%)=<${KWIML}/%>" - ) +if(NOT KWIML_TEST_PREFIX) + set(KWIML_TEST_PREFIX kwiml) +endif() # Suppress printf/scanf format warnings; we test if the sizes match. foreach(lang C CXX) @@ -33,38 +22,33 @@ endif() if(KWIML_LANGUAGE_C) list(APPEND test_defs KWIML_LANGUAGE_C) list(APPEND test_srcs - test_ABI_C.c - test_INT_C.c + test_abi_C.c + test_int_C.c test_include_C.c ) endif() if(KWIML_LANGUAGE_CXX) list(APPEND test_defs KWIML_LANGUAGE_CXX) list(APPEND test_srcs - test_ABI_CXX.cxx - test_INT_CXX.cxx + test_abi_CXX.cxx + test_int_CXX.cxx test_include_CXX.cxx ) endif() -foreach(th test_ABI_endian test_INT_format) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${th}.h.in - ${CMAKE_CURRENT_BINARY_DIR}/${th}.h @ONLY) -endforeach() -include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) -add_executable(${KWIML}_test ${test_srcs}) -set_property(TARGET ${KWIML}_test PROPERTY COMPILE_DEFINITIONS ${test_defs}) -set_property(TARGET ${KWIML}_test PROPERTY +add_executable(kwiml_test ${test_srcs}) +set_property(TARGET kwiml_test PROPERTY COMPILE_DEFINITIONS ${test_defs}) +set_property(TARGET kwiml_test PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) -add_test(${KWIML}.test ${CMAKE_CURRENT_BINARY_DIR}/${KWIML}_test) -set_property(TEST ${KWIML}.test PROPERTY LABELS ${KWIML_LABELS_TEST}) +add_test(NAME ${KWIML_TEST_PREFIX}.test COMMAND kwiml_test) +set_property(TEST ${KWIML_TEST_PREFIX}.test PROPERTY LABELS ${KWIML_TEST_LABELS}) # Xcode 2.x forgets to create the output directory before linking # the individual architectures. if(CMAKE_OSX_ARCHITECTURES AND XCODE AND NOT "${XCODE_VERSION}" MATCHES "^[^12]") add_custom_command( - TARGET ${KWIML}_test + TARGET kwiml_test PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}" ) endif() diff --git a/Utilities/KWIML/test/test.c b/Utilities/KWIML/test/test.c index 131c81f92..5f5b5d776 100644 --- a/Utilities/KWIML/test/test.c +++ b/Utilities/KWIML/test/test.c @@ -1,21 +1,15 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ #ifdef __cplusplus extern "C" { #endif -extern int test_ABI_C(void); -extern int test_INT_C(void); -extern int test_ABI_CXX(void); -extern int test_INT_CXX(void); +extern int test_abi_C(void); +extern int test_int_C(void); +extern int test_abi_CXX(void); +extern int test_int_CXX(void); extern int test_include_C(void); extern int test_include_CXX(void); #ifdef __cplusplus @@ -26,13 +20,13 @@ int main(void) { int result = 1; #ifdef KWIML_LANGUAGE_C - result = test_ABI_C() && result; - result = test_INT_C() && result; + result = test_abi_C() && result; + result = test_int_C() && result; result = test_include_C() && result; #endif #ifdef KWIML_LANGUAGE_CXX - result = test_ABI_CXX() && result; - result = test_INT_CXX() && result; + result = test_abi_CXX() && result; + result = test_int_CXX() && result; result = test_include_CXX() && result; #endif return result? 0 : 1; diff --git a/Utilities/KWIML/test/test.cxx b/Utilities/KWIML/test/test.cxx index bf614218a..464325ba4 100644 --- a/Utilities/KWIML/test/test.cxx +++ b/Utilities/KWIML/test/test.cxx @@ -1,12 +1,6 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ #include "test.c" diff --git a/Utilities/KWIML/test/test.h b/Utilities/KWIML/test/test.h index b87a0e7e9..44add3faf 100644 --- a/Utilities/KWIML/test/test.h +++ b/Utilities/KWIML/test/test.h @@ -1,32 +1,11 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#ifndef KWIML_NAMESPACE -# error "Do not include test.h outside of KWIML test files." -#endif - +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ #ifndef KWIML_TEST_H #define KWIML_TEST_H -/* - Define KWIML_HEADER macro to help the test files include kwiml - headers from the configured namespace directory. The macro can be - used like this: - - #include KWIML_HEADER(ABI.h) -*/ -#define KWIML_HEADER(x) KWIML_HEADER0(KWIML_NAMESPACE/x) -#define KWIML_HEADER0(x) KWIML_HEADER1(x) -#define KWIML_HEADER1(x) - /* Quiet MS standard library deprecation warnings. */ #ifndef _CRT_SECURE_NO_DEPRECATE # define _CRT_SECURE_NO_DEPRECATE diff --git a/Utilities/KWIML/test/test_ABI_C.c b/Utilities/KWIML/test/test_ABI_C.c deleted file mode 100644 index 3ca4ad390..000000000 --- a/Utilities/KWIML/test/test_ABI_C.c +++ /dev/null @@ -1,22 +0,0 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include "test.h" -#include KWIML_HEADER(ABI.h) -#include "test_ABI_endian.h" -int test_ABI_C(void) -{ - if(!test_ABI_endian()) - { - return 0; - } - return 1; -} diff --git a/Utilities/KWIML/test/test_ABI_endian.h.in b/Utilities/KWIML/test/test_ABI_endian.h.in deleted file mode 100644 index 992baeaeb..000000000 --- a/Utilities/KWIML/test/test_ABI_endian.h.in +++ /dev/null @@ -1,47 +0,0 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include - -#ifdef __cplusplus -# define LANG "C++ " -#else -# define LANG "C " -#endif - -static int test_ABI_endian(void) -{ - int result = 1; - { -#if defined(@KWIML@_ABI_ENDIAN_ID) - int expect; - union { short s; unsigned char c[sizeof(short)]; } x; - x.s = 1; - expect = (x.c[0] == 1 ? - @KWIML@_ABI_ENDIAN_ID_LITTLE : @KWIML@_ABI_ENDIAN_ID_BIG); - printf(LANG "@KWIML@_ABI_ENDIAN_ID: expected [%d], got [%d]", - expect, @KWIML@_ABI_ENDIAN_ID); - if(@KWIML@_ABI_ENDIAN_ID == expect) - { - printf(", PASSED\n"); - } - else - { - printf(", FAILED\n"); - result = 0; - } -#else - printf(LANG "@KWIML@_ABI_ENDIAN_ID: unknown, FAILED\n"); - result = 0; -#endif - } - return result; -} diff --git a/Utilities/KWIML/test/test_INT_C.c b/Utilities/KWIML/test/test_INT_C.c deleted file mode 100644 index 5513a0bd8..000000000 --- a/Utilities/KWIML/test/test_INT_C.c +++ /dev/null @@ -1,22 +0,0 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include "test.h" -#include KWIML_HEADER(INT.h) -#include "test_INT_format.h" -int test_INT_C(void) -{ - if(!test_INT_format()) - { - return 0; - } - return 1; -} diff --git a/Utilities/KWIML/test/test_INT_CXX.cxx b/Utilities/KWIML/test/test_INT_CXX.cxx deleted file mode 100644 index 9f74e9680..000000000 --- a/Utilities/KWIML/test/test_INT_CXX.cxx +++ /dev/null @@ -1,22 +0,0 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include "test.h" -#include KWIML_HEADER(INT.h) -#include "test_INT_format.h" -extern "C" int test_INT_CXX(void) -{ - if(!test_INT_format()) - { - return 0; - } - return 1; -} diff --git a/Utilities/KWIML/test/test_abi_C.c b/Utilities/KWIML/test/test_abi_C.c new file mode 100644 index 000000000..18b639f4a --- /dev/null +++ b/Utilities/KWIML/test/test_abi_C.c @@ -0,0 +1,19 @@ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ +#include "test.h" +#include "../include/kwiml/abi.h" +#include "test_abi_endian.h" +#ifndef KWIML_ABI_VERSION +# error "KWIML_ABI_VERSION not defined!" +#endif +int test_abi_C(void) +{ + if(!test_abi_endian()) + { + return 0; + } + return 1; +} diff --git a/Utilities/KWIML/test/test_abi_CXX.cxx b/Utilities/KWIML/test/test_abi_CXX.cxx new file mode 100644 index 000000000..e8feb44d2 --- /dev/null +++ b/Utilities/KWIML/test/test_abi_CXX.cxx @@ -0,0 +1,19 @@ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ +#include "test.h" +#include "../include/kwiml/abi.h" +#include "test_abi_endian.h" +#ifndef KWIML_ABI_VERSION +# error "KWIML_ABI_VERSION not defined!" +#endif +extern "C" int test_abi_CXX(void) +{ + if(!test_abi_endian()) + { + return 0; + } + return 1; +} diff --git a/Utilities/KWIML/test/test_abi_endian.h b/Utilities/KWIML/test/test_abi_endian.h new file mode 100644 index 000000000..334b018a1 --- /dev/null +++ b/Utilities/KWIML/test/test_abi_endian.h @@ -0,0 +1,41 @@ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ +#include + +#ifdef __cplusplus +# define LANG "C++ " +#else +# define LANG "C " +#endif + +static int test_abi_endian(void) +{ + int result = 1; + { +#if defined(KWIML_ABI_ENDIAN_ID) + int expect; + union { short s; unsigned char c[sizeof(short)]; } x; + x.s = 1; + expect = (x.c[0] == 1 ? + KWIML_ABI_ENDIAN_ID_LITTLE : KWIML_ABI_ENDIAN_ID_BIG); + printf(LANG "KWIML_ABI_ENDIAN_ID: expected [%d], got [%d]", + expect, KWIML_ABI_ENDIAN_ID); + if(KWIML_ABI_ENDIAN_ID == expect) + { + printf(", PASSED\n"); + } + else + { + printf(", FAILED\n"); + result = 0; + } +#else + printf(LANG "KWIML_ABI_ENDIAN_ID: unknown, FAILED\n"); + result = 0; +#endif + } + return result; +} diff --git a/Utilities/KWIML/test/test_include_C.c b/Utilities/KWIML/test/test_include_C.c index fb3e4cf7f..518544d25 100644 --- a/Utilities/KWIML/test/test_include_C.c +++ b/Utilities/KWIML/test/test_include_C.c @@ -1,20 +1,14 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ #include /* Test KWIML header inclusion after above system headers. */ #include "test.h" -#include KWIML_HEADER(ABI.h) -#include KWIML_HEADER(INT.h) +#include "../include/kwiml/abi.h" +#include "../include/kwiml/int.h" int test_include_C(void) { diff --git a/Utilities/KWIML/test/test_include_CXX.cxx b/Utilities/KWIML/test/test_include_CXX.cxx index 111311a84..82aa54616 100644 --- a/Utilities/KWIML/test/test_include_CXX.cxx +++ b/Utilities/KWIML/test/test_include_CXX.cxx @@ -1,14 +1,8 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ #include #if defined(_MSC_VER) && defined(NDEBUG) @@ -19,8 +13,8 @@ std::string test_include_CXX_use_stl_string; /* Test KWIML header inclusion after above system headers. */ #include "test.h" -#include KWIML_HEADER(ABI.h) -#include KWIML_HEADER(INT.h) +#include "../include/kwiml/abi.h" +#include "../include/kwiml/int.h" extern "C" int test_include_CXX(void) { diff --git a/Utilities/KWIML/test/test_int_C.c b/Utilities/KWIML/test/test_int_C.c new file mode 100644 index 000000000..fe8ee8e3c --- /dev/null +++ b/Utilities/KWIML/test/test_int_C.c @@ -0,0 +1,19 @@ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ +#include "test.h" +#include "../include/kwiml/int.h" +#include "test_int_format.h" +#ifndef KWIML_INT_VERSION +# error "KWIML_INT_VERSION not defined!" +#endif +int test_int_C(void) +{ + if(!test_int_format()) + { + return 0; + } + return 1; +} diff --git a/Utilities/KWIML/test/test_int_CXX.cxx b/Utilities/KWIML/test/test_int_CXX.cxx new file mode 100644 index 000000000..ffa4c9b08 --- /dev/null +++ b/Utilities/KWIML/test/test_int_CXX.cxx @@ -0,0 +1,19 @@ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ +#include "test.h" +#include "../include/kwiml/int.h" +#include "test_int_format.h" +#ifndef KWIML_INT_VERSION +# error "KWIML_INT_VERSION not defined!" +#endif +extern "C" int test_int_CXX(void) +{ + if(!test_int_format()) + { + return 0; + } + return 1; +} diff --git a/Utilities/KWIML/test/test_INT_format.h.in b/Utilities/KWIML/test/test_int_format.h similarity index 78% rename from Utilities/KWIML/test/test_INT_format.h.in rename to Utilities/KWIML/test/test_int_format.h index 71b443d6e..24dcdfba6 100644 --- a/Utilities/KWIML/test/test_INT_format.h.in +++ b/Utilities/KWIML/test/test_int_format.h @@ -1,17 +1,16 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ #include #include +#if defined(_MSC_VER) +# pragma warning (push) +# pragma warning (disable:4310) /* cast truncates constant value */ +#endif + #ifdef __cplusplus # define LANG "C++ " #else @@ -25,8 +24,8 @@ T const x = VALUE(T, U); \ T y = C(V); \ printf(LANG #C ":" \ - " expression [%" @KWIML@_INT_PRI##PRI "]," \ - " literal [%" @KWIML@_INT_PRI##PRI "]", x, y); \ + " expression [%" KWIML_INT_PRI##PRI "]," \ + " literal [%" KWIML_INT_PRI##PRI "]", x, y); \ if(x == y) \ { \ printf(", PASSED\n"); \ @@ -42,8 +41,8 @@ { \ T const x = VALUE(T, U); \ char const* str = STR; \ - sprintf(buf, "%" @KWIML@_INT_PRI##PRI, x); \ - printf(LANG "@KWIML@_INT_PRI" #PRI ":" \ + sprintf(buf, "%" KWIML_INT_PRI##PRI, x); \ + printf(LANG "KWIML_INT_PRI" #PRI ":" \ " expected [%s], got [%s]", str, buf); \ if(strcmp(str, buf) == 0) \ { \ @@ -62,13 +61,13 @@ T const x = VALUE(T, U); \ T y; \ char const* str = STR; \ - if(sscanf(str, "%" @KWIML@_INT_SCN##SCN, &y) != 1) \ + if(sscanf(str, "%" KWIML_INT_SCN##SCN, &y) != 1) \ { \ y = 0; \ } \ - printf(LANG "@KWIML@_INT_SCN" #SCN ":" \ - " expected [%" @KWIML@_INT_PRI##PRI "]," \ - " got [%" @KWIML@_INT_PRI##PRI "]", x, y); \ + printf(LANG "KWIML_INT_SCN" #SCN ":" \ + " expected [%" KWIML_INT_PRI##PRI "]," \ + " got [%" KWIML_INT_PRI##PRI "]", x, y); \ if(x == y) \ { \ printf(", PASSED\n"); \ @@ -87,41 +86,41 @@ /* Concatenate T and U now to avoid expanding them. */ #define TEST(FMT, T, U, STR) \ - TEST_(FMT, @KWIML@_INT_##T, @KWIML@_INT_##U, STR) + TEST_(FMT, KWIML_INT_##T, KWIML_INT_##U, STR) #define TEST2(PRI, SCN, T, U, STR) \ - TEST2_(PRI, SCN, @KWIML@_INT_##T, @KWIML@_INT_##U, STR) + TEST2_(PRI, SCN, KWIML_INT_##T, KWIML_INT_##U, STR) #define TEST_C(C, V, PRI, T, U) \ - TEST_C_(@KWIML@_INT_##C, V, PRI, @KWIML@_INT_##T, @KWIML@_INT_##U) + TEST_C_(KWIML_INT_##C, V, PRI, KWIML_INT_##T, KWIML_INT_##U) #define TEST_PRI(PRI, T, U, STR) \ - TEST_PRI_(PRI, @KWIML@_INT_##T, @KWIML@_INT_##U, STR) + TEST_PRI_(PRI, KWIML_INT_##T, KWIML_INT_##U, STR) #define TEST_SCN(SCN, T, U, STR) \ - TEST_SCN_(SCN, @KWIML@_INT_##T, @KWIML@_INT_##U, STR) + TEST_SCN_(SCN, KWIML_INT_##T, KWIML_INT_##U, STR) #define TEST_SCN2(PRI, SCN, T, U, STR) \ - TEST_SCN2_(PRI, SCN, @KWIML@_INT_##T, @KWIML@_INT_##U, STR) + TEST_SCN2_(PRI, SCN, KWIML_INT_##T, KWIML_INT_##U, STR) -static int test_INT_format(void) +static int test_int_format(void) { int result = 1; char buf[256]; TEST_PRI(i8, int8_t, uint8_t, "-85") -#if defined(@KWIML@_INT_SCNi8) +#if defined(KWIML_INT_SCNi8) TEST_SCN(i8, int8_t, uint8_t, "-85") #endif TEST_PRI(d8, int8_t, uint8_t, "-85") -#if defined(@KWIML@_INT_SCNd8) +#if defined(KWIML_INT_SCNd8) TEST_SCN(d8, int8_t, uint8_t, "-85") #endif TEST_PRI(o8, uint8_t, uint8_t, "253") -#if defined(@KWIML@_INT_SCNo8) +#if defined(KWIML_INT_SCNo8) TEST_SCN(o8, uint8_t, uint8_t, "253") #endif TEST_PRI(u8, uint8_t, uint8_t, "171") -#if defined(@KWIML@_INT_SCNu8) +#if defined(KWIML_INT_SCNu8) TEST_SCN(u8, uint8_t, uint8_t, "171") #endif TEST_PRI(x8, uint8_t, uint8_t, "ab") TEST_PRI(X8, uint8_t, uint8_t, "AB") -#if defined(@KWIML@_INT_SCNx8) +#if defined(KWIML_INT_SCNx8) TEST_SCN(x8, uint8_t, uint8_t, "ab") TEST_SCN2(X8, x8, uint8_t, uint8_t, "AB") #endif @@ -141,30 +140,30 @@ static int test_INT_format(void) TEST2(X32, x32, uint32_t, uint32_t, "AB000000") TEST_PRI(i64, int64_t, uint64_t, "-6124895493223874560") -#if defined(@KWIML@_INT_SCNi64) +#if defined(KWIML_INT_SCNi64) TEST_SCN(i64, int64_t, uint64_t, "-6124895493223874560") #endif TEST_PRI(d64, int64_t, uint64_t, "-6124895493223874560") -#if defined(@KWIML@_INT_SCNd64) +#if defined(KWIML_INT_SCNd64) TEST_SCN(d64, int64_t, uint64_t, "-6124895493223874560") #endif TEST_PRI(o64, uint64_t, uint64_t, "1254000000000000000000") -#if defined(@KWIML@_INT_SCNo64) +#if defined(KWIML_INT_SCNo64) TEST_SCN(o64, uint64_t, uint64_t, "1254000000000000000000") #endif TEST_PRI(u64, uint64_t, uint64_t, "12321848580485677056") -#if defined(@KWIML@_INT_SCNu64) +#if defined(KWIML_INT_SCNu64) TEST_SCN(u64, uint64_t, uint64_t, "12321848580485677056") #endif TEST_PRI(x64, uint64_t, uint64_t, "ab00000000000000") TEST_PRI(X64, uint64_t, uint64_t, "AB00000000000000") -#if defined(@KWIML@_INT_SCNx64) +#if defined(KWIML_INT_SCNx64) TEST_SCN(x64, uint64_t, uint64_t, "ab00000000000000") TEST_SCN2(X64, x64, uint64_t, uint64_t, "AB00000000000000") #endif -#if !defined(@KWIML@_INT_NO_INTPTR_T) -# if @KWIML@_ABI_SIZEOF_DATA_PTR == 4 +#if !defined(KWIML_INT_NO_INTPTR_T) +# if KWIML_ABI_SIZEOF_DATA_PTR == 4 TEST(iPTR, intptr_t, uint32_t, "-1426063360") TEST(dPTR, intptr_t, uint32_t, "-1426063360") # else @@ -173,8 +172,8 @@ static int test_INT_format(void) # endif #endif -#if !defined(@KWIML@_INT_NO_UINTPTR_T) -# if @KWIML@_ABI_SIZEOF_DATA_PTR == 4 +#if !defined(KWIML_INT_NO_UINTPTR_T) +# if KWIML_ABI_SIZEOF_DATA_PTR == 4 TEST(oPTR, uintptr_t, uintptr_t, "25300000000") TEST(uPTR, uintptr_t, uintptr_t, "2868903936") TEST(xPTR, uintptr_t, uintptr_t, "ab000000") @@ -198,3 +197,7 @@ static int test_INT_format(void) return result; } + +#if defined(_MSC_VER) +# pragma warning (pop) +#endif diff --git a/Utilities/Scripts/update-kwiml.bash b/Utilities/Scripts/update-kwiml.bash new file mode 100755 index 000000000..5c0d1922a --- /dev/null +++ b/Utilities/Scripts/update-kwiml.bash @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -e +set -x +shopt -s dotglob + +readonly name="KWIML" +readonly ownership="KWIML Upstream " +readonly subtree="Utilities/KWIML" +readonly repo="https://github.com/Kitware/KWIML.git" +readonly tag="master" +readonly shortlog=true +readonly paths=" +" + +extract_source () { + git_archive +} + +. "${BASH_SOURCE%/*}/update-third-party.bash" diff --git a/Utilities/cmThirdParty.h.in b/Utilities/cmThirdParty.h.in index 0cb6809c3..4c1177ca8 100644 --- a/Utilities/cmThirdParty.h.in +++ b/Utilities/cmThirdParty.h.in @@ -15,6 +15,7 @@ /* Whether CMake is using its own utility libraries. */ #cmakedefine CMAKE_USE_SYSTEM_CURL #cmakedefine CMAKE_USE_SYSTEM_EXPAT +#cmakedefine CMAKE_USE_SYSTEM_KWIML #cmakedefine CMAKE_USE_SYSTEM_ZLIB #cmakedefine CMAKE_USE_SYSTEM_BZIP2 #cmakedefine CMAKE_USE_SYSTEM_LIBARCHIVE diff --git a/Utilities/KWIML/test/test_ABI_CXX.cxx b/Utilities/cm_kwiml.h similarity index 53% rename from Utilities/KWIML/test/test_ABI_CXX.cxx rename to Utilities/cm_kwiml.h index 7ede20e09..ab2b80b3c 100644 --- a/Utilities/KWIML/test/test_ABI_CXX.cxx +++ b/Utilities/cm_kwiml.h @@ -1,6 +1,6 @@ /*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. + CMake - Cross Platform Makefile Generator + Copyright 2000-2015 Kitware, Inc., Insight Software Consortium Distributed under the OSI-approved BSD License (the "License"); see accompanying file Copyright.txt for details. @@ -9,14 +9,17 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#include "test.h" -#include KWIML_HEADER(ABI.h) -#include "test_ABI_endian.h" -extern "C" int test_ABI_CXX(void) -{ - if(!test_ABI_endian()) - { - return 0; - } - return 1; -} +#ifndef cm_kwiml_h +#define cm_kwiml_h + +/* Use the KWIML library configured for CMake. */ +#include "cmThirdParty.h" +#ifdef CMAKE_USE_SYSTEM_KWIML +# include +# include +#else +# include "KWIML/include/kwiml/abi.h" +# include "KWIML/include/kwiml/int.h" +#endif + +#endif diff --git a/Utilities/cmjsoncpp/CMakeLists.txt b/Utilities/cmjsoncpp/CMakeLists.txt index 1c863f855..d0114e711 100644 --- a/Utilities/cmjsoncpp/CMakeLists.txt +++ b/Utilities/cmjsoncpp/CMakeLists.txt @@ -23,3 +23,4 @@ include_directories( ) add_library(cmjsoncpp ${JSONCPP_SOURCES}) +target_link_libraries(cmjsoncpp ${CMake_KWIML_LIBRARIES}) diff --git a/bootstrap b/bootstrap index b2421a11b..9e3036366 100755 --- a/bootstrap +++ b/bootstrap @@ -373,11 +373,6 @@ KWSYS_FILES="\ SystemTools.hxx \ Terminal.h" -KWIML_FILES=' - ABI.h - INT.h -' - # Display CMake bootstrap usage cmake_usage() { @@ -455,6 +450,18 @@ cmake_error() exit ${res} } +cmake_generate_file () +{ + OUTFILE="$1" + CONTENT="$2" + echo "$CONTENT" > "$OUTFILE.tmp" + if "${_diff}" "$OUTFILE.tmp" "$OUTFILE" > /dev/null 2> /dev/null ; then + rm -f "$OUTFILE.tmp" + else + mv -f "$OUTFILE.tmp" "$OUTFILE" + fi +} + # Replace KWSYS_NAMESPACE with cmsys cmake_replace_string () { @@ -702,11 +709,6 @@ if [ ! -d "cmsys" ]; then cmake_error 4 "Cannot create directory ${cmake_bootstrap_dir}/cmsys" fi -[ -d "cmIML" ] || mkdir "cmIML" -if [ ! -d "cmIML" ]; then - cmake_error 12 "Cannot create directory ${cmake_bootstrap_dir}/cmIML" -fi - # Delete all the bootstrap files rm -f "${cmake_bootstrap_dir}/cmake_bootstrap.log" rm -f "${cmake_bootstrap_dir}/cmConfigure.h${_tmp}" @@ -1280,10 +1282,7 @@ for a in ${KWSYS_FILES}; do "${cmake_bootstrap_dir}/cmsys/${a}" KWSYS_NAMESPACE cmsys done -for a in ${KWIML_FILES}; do - cmake_replace_string "${cmake_source_dir}/Utilities/KWIML/${a}.in" \ - "${cmake_bootstrap_dir}/cmIML/${a}" KWIML cmIML -done +cmake_generate_file "${cmake_bootstrap_dir}/cmThirdParty.h" "" # Generate Makefile dep="cmConfigure.h cmsys/*.hxx cmsys/*.h `cmake_escape \"${cmake_source_dir}\"`/Source/*.h" @@ -1326,9 +1325,9 @@ cmake_cxx_flags_SystemTools=" -DKWSYS_CXX_HAS_UTIMES=${KWSYS_CXX_HAS_UTIMES} " cmake_c_flags="${cmake_c_flags}-I`cmake_escape \"${cmake_bootstrap_dir}\"` -I`cmake_escape \"${cmake_source_dir}/Source\"` \ - -I`cmake_escape \"${cmake_bootstrap_dir}\"`" + -I`cmake_escape \"${cmake_source_dir}/Utilities\"`" cmake_cxx_flags="${cmake_cxx_flags} -I`cmake_escape \"${cmake_bootstrap_dir}\"` -I`cmake_escape \"${cmake_source_dir}/Source\"` \ - -I`cmake_escape \"${cmake_bootstrap_dir}\"`" + -I`cmake_escape \"${cmake_source_dir}/Utilities\"`" echo "cmake: ${objs}" > "${cmake_bootstrap_dir}/Makefile" echo " ${cmake_cxx_compiler} ${cmake_ld_flags} ${cmake_cxx_flags} ${objs} -o cmake" >> "${cmake_bootstrap_dir}/Makefile" for a in ${CMAKE_CXX_SOURCES}; do