From 99ed654ccdfa3d2e85d8b152cb5a4170759d8b5d Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Mon, 18 Mar 2013 23:06:06 -0500 Subject: [PATCH] Add endian.h header for byte order detection. Ensure that headers can be included individually. --- .project | 11 ++ doc/html/.gitignore | 2 + doc/html/boostbook.css | 6 +- doc/html/index.html | 4 +- doc/html/predef/adding_new_predefs.html | 2 +- doc/html/predef/introduction.html | 2 +- doc/html/predef/reference.html | 2 +- .../boost_arch_architecture_macros.html | 2 +- .../reference/boost_comp_compiler_macros.html | 2 +- .../boost_lang_language_standards_ma.html | 2 +- .../reference/boost_lib_library_macros.html | 2 +- .../boost_os_operating_system_macros.html | 2 +- .../reference/version_definition_macros.html | 2 +- doc/html/predef/using_the_predefs.html | 2 +- include/boost/predef.h | 1 + include/boost/predef/endian.h | 130 ++++++++++++++++++ include/boost/predef/library/c.h | 2 +- include/boost/predef/library/c/_prefix.h | 13 ++ include/boost/predef/library/c/gnu.h | 2 + include/boost/predef/library/c/uc.h | 2 + include/boost/predef/library/c/vms.h | 2 + include/boost/predef/library/c/zos.h | 2 + include/boost/predef/library/std.h | 32 +---- include/boost/predef/library/std/_prefix.h | 23 ++++ include/boost/predef/library/std/cxx.h | 2 + include/boost/predef/library/std/dinkumware.h | 2 + include/boost/predef/library/std/libcomo.h | 2 + include/boost/predef/library/std/modena.h | 2 + include/boost/predef/library/std/msl.h | 2 + include/boost/predef/library/std/roguewave.h | 2 + include/boost/predef/library/std/sgi.h | 2 + include/boost/predef/library/std/stdcpp3.h | 2 + include/boost/predef/library/std/stlport.h | 2 + include/boost/predef/library/std/vacpp.h | 2 + 34 files changed, 228 insertions(+), 44 deletions(-) create mode 100644 .project create mode 100644 doc/html/.gitignore create mode 100644 include/boost/predef/endian.h create mode 100644 include/boost/predef/library/c/_prefix.h create mode 100644 include/boost/predef/library/std/_prefix.h diff --git a/.project b/.project new file mode 100644 index 0000000..8fe9304 --- /dev/null +++ b/.project @@ -0,0 +1,11 @@ + + + Boost Predef + + + + + + + + diff --git a/doc/html/.gitignore b/doc/html/.gitignore new file mode 100644 index 0000000..b5b50ff --- /dev/null +++ b/doc/html/.gitignore @@ -0,0 +1,2 @@ +/standalone_HTML.manifest +/predef diff --git a/doc/html/boostbook.css b/doc/html/boostbook.css index f106e46..2e15c01 100644 --- a/doc/html/boostbook.css +++ b/doc/html/boostbook.css @@ -205,7 +205,7 @@ Table of contents =============================================================================*/ - .toc + div.toc { margin: 1pc 4% 0pc 4%; padding: 0.1pc 1pc 0.1pc 1pc; @@ -466,7 +466,7 @@ } /* Table of contents */ - .toc + div.toc { border: 1px solid #DCDCDC; } @@ -534,7 +534,7 @@ } /* Table of contents */ - .toc + div.toc { border: 1px solid gray; } diff --git a/doc/html/index.html b/doc/html/index.html index 7db438d..62f6554 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -3,7 +3,7 @@ Predef 1.0 - + @@ -57,7 +57,7 @@ - +

Last revised: January 19, 2013 at 03:18:05 GMT

Last revised: March 19, 2013 at 03:53:01 GMT


diff --git a/doc/html/predef/adding_new_predefs.html b/doc/html/predef/adding_new_predefs.html index b83606c..1e678c3 100644 --- a/doc/html/predef/adding_new_predefs.html +++ b/doc/html/predef/adding_new_predefs.html @@ -3,7 +3,7 @@ Adding new predefs - + diff --git a/doc/html/predef/introduction.html b/doc/html/predef/introduction.html index 06488d2..9d0d64a 100644 --- a/doc/html/predef/introduction.html +++ b/doc/html/predef/introduction.html @@ -3,7 +3,7 @@ Introduction - + diff --git a/doc/html/predef/reference.html b/doc/html/predef/reference.html index 041c263..495ea06 100644 --- a/doc/html/predef/reference.html +++ b/doc/html/predef/reference.html @@ -3,7 +3,7 @@ Reference - + diff --git a/doc/html/predef/reference/boost_arch_architecture_macros.html b/doc/html/predef/reference/boost_arch_architecture_macros.html index cd7da64..177033e 100644 --- a/doc/html/predef/reference/boost_arch_architecture_macros.html +++ b/doc/html/predef/reference/boost_arch_architecture_macros.html @@ -3,7 +3,7 @@ BOOST_ARCH architecture macros - + diff --git a/doc/html/predef/reference/boost_comp_compiler_macros.html b/doc/html/predef/reference/boost_comp_compiler_macros.html index 2f1f2e6..eab3eac 100644 --- a/doc/html/predef/reference/boost_comp_compiler_macros.html +++ b/doc/html/predef/reference/boost_comp_compiler_macros.html @@ -3,7 +3,7 @@ BOOST_COMP compiler macros - + diff --git a/doc/html/predef/reference/boost_lang_language_standards_ma.html b/doc/html/predef/reference/boost_lang_language_standards_ma.html index eb55db1..5772d51 100644 --- a/doc/html/predef/reference/boost_lang_language_standards_ma.html +++ b/doc/html/predef/reference/boost_lang_language_standards_ma.html @@ -3,7 +3,7 @@ BOOST_LANG language standards macros - + diff --git a/doc/html/predef/reference/boost_lib_library_macros.html b/doc/html/predef/reference/boost_lib_library_macros.html index da6f106..9950d44 100644 --- a/doc/html/predef/reference/boost_lib_library_macros.html +++ b/doc/html/predef/reference/boost_lib_library_macros.html @@ -3,7 +3,7 @@ BOOST_LIB library macros - + diff --git a/doc/html/predef/reference/boost_os_operating_system_macros.html b/doc/html/predef/reference/boost_os_operating_system_macros.html index 9942151..40d4950 100644 --- a/doc/html/predef/reference/boost_os_operating_system_macros.html +++ b/doc/html/predef/reference/boost_os_operating_system_macros.html @@ -3,7 +3,7 @@ BOOST_OS_ operating system macros - + diff --git a/doc/html/predef/reference/version_definition_macros.html b/doc/html/predef/reference/version_definition_macros.html index 6cc1dc0..1289fe4 100644 --- a/doc/html/predef/reference/version_definition_macros.html +++ b/doc/html/predef/reference/version_definition_macros.html @@ -3,7 +3,7 @@ Version definition macros - + diff --git a/doc/html/predef/using_the_predefs.html b/doc/html/predef/using_the_predefs.html index c1c8e44..a672f27 100644 --- a/doc/html/predef/using_the_predefs.html +++ b/doc/html/predef/using_the_predefs.html @@ -3,7 +3,7 @@ Using the predefs - + diff --git a/include/boost/predef.h b/include/boost/predef.h index b763d94..44b0915 100644 --- a/include/boost/predef.h +++ b/include/boost/predef.h @@ -13,5 +13,6 @@ http://www.boost.org/LICENSE_1_0.txt) #include #include #include +#include #endif diff --git a/include/boost/predef/endian.h b/include/boost/predef/endian.h new file mode 100644 index 0000000..374a4e6 --- /dev/null +++ b/include/boost/predef/endian.h @@ -0,0 +1,130 @@ +/* +Copyright Redshift Software, Inc. 2013 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_ENDIAN_H +#define BOOST_PREDEF_ENDIAN_H + +#include +#include +#include + +/*` +[heading `BOOST_ENDIAN_BIG_BYTE`, `BOOST_ENDIAN_LITTLE_BYTE`, `BOOST_ENDIAN_BIG_WORD`, `BOOST_ENDIAN_LITTLE_WORD`] + +Detection of endian memory ordering. + */ + +#define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_NOT_AVAILABLE +#define BOOST_ENDIAN_BIG_WORD BOOST_VERSION_NUMBER_NOT_AVAILABLE +#define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_NOT_AVAILABLE +#define BOOST_ENDIAN_LITTLE_WORD BOOST_VERSION_NUMBER_NOT_AVAILABLE + +/* GNU libc provides a header defining __BYT_ORDER. */ +#if BOOST_LIB_C_GNU +# include +#endif + +/* GNU libc style __BYTE_ORDER macros. */ +#if defined(__BYTE_ORDER) +# if (__BYTE_ORDER == __BIG_ENDIAN) +# undef BOOST_ENDIAN_BIG_BYTE +# define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_AVAILABLE +# endif +# if (__BYTE_ORDER == __LITTLE_ENDIAN) +# undef BOOST_ENDIAN_LITTLE_BYTE +# define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE +# endif +# if (__BYTE_ORDER == __PDP_ENDIAN) +# undef BOOST_ENDIAN_LITTLE_WORD +# define BOOST_ENDIAN_LITTLE_WORD BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +/* Built-in byte-swpped big-endian macros. */ +#if !BOOST_ENDIAN_BIG_BYTE +# if defined(__BIG_ENDIAN__) || \ + defined(__ARMEB__) || \ + defined(__THUMBEB__) || \ + defined(__AARCH64EB__) || \ + defined(_MIPSEB) || \ + defined(__MIPSEB) || \ + defined(__MIPSEB__) +# undef BOOST_ENDIAN_BIG_BYTE +# define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +/* Built-in byte-swapped little-endian macros. */ +#if !BOOST_ENDIAN_LITTLE_BYTE +# if defined(__LITTLE_ENDIAN__) || \ + defined(__ARMEL__) || \ + defined(__THUMBEL__) || \ + defined(__AARCH64EL__) || \ + defined(_MIPSEL) || \ + defined(__MIPSEL) || \ + defined(__MIPSEL__) +# undef BOOST_ENDIAN_LITTLE_BYTE +# define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +/* Some architectures are strictly one endianess (as opposed + * the current common bi-endianess). + */ +#if !BOOST_ENDIAN_BIG_BYTE && \ + !BOOST_ENDIAN_BIG_WORD && \ + !BOOST_ENDIAN_LITTLE_BYTE && \ + !BOOST_ENDIAN_LITTLE_WORD +# include +# if BOOST_ARCH_M68K || \ + BOOST_ARCH_PARISK || \ + BOOST_ARCH_SYS370 || \ + BOOST_ARCH_SYS390 || \ + BOOST_ARCH_Z +# undef BOOST_ENDIAN_BIG_BYTE +# define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_AVAILABLE +# endif +# if BOOST_ARCH_AMD64 || \ + BOOST_ARCH_IA64 || \ + BOOST_ARCH_X86 +# undef BOOST_ENDIAN_LITTLE_BYTE +# define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#if BOOST_ENDIAN_BIG_BYTE +# define BOOST_ENDIAN_BIG_BYTE_AVAILABLE +#endif +#if BOOST_ENDIAN_BIG_WORD_BYTE +# define BOOST_ENDIAN_BIG_WORD_BYTE_AVAILABLE +#endif +#if BOOST_ENDIAN_LITTLE_BYTE +# define BOOST_ENDIAN_LITTLE_BYTE_AVAILABLE +#endif +#if BOOST_ENDIAN_LITTLE_WORD_BYTE +# define BOOST_ENDIAN_LITTLE_WORD_BYTE_AVAILABLE +#endif + +#define BOOST_ENDIAN_BIG_BYTE_NAME "Byte-Swapped Big-Endian" +#define BOOST_ENDIAN_BIG_WORD_NAME "Word-Swapped Big-Endian" +#define BOOST_ENDIAN_LITTLE_BYTE_NAME "Byte-Swapped Little-Endian" +#define BOOST_ENDIAN_LITTLE_WORD_NAME "Word-Swapped Little-Endian" + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_ENDIAN_BIG_BYTE,BOOST_ENDIAN_BIG_BYTE_NAME) + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_ENDIAN_BIG_WORD,BOOST_ENDIAN_BIG_WORD_NAME) + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_ENDIAN_LITTLE_BYTE,BOOST_ENDIAN_LITTLE_BYTE_NAME) + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_ENDIAN_LITTLE_WORD,BOOST_ENDIAN_LITTLE_WORD_NAME) + + +#endif diff --git a/include/boost/predef/library/c.h b/include/boost/predef/library/c.h index 18cafe0..221e7dc 100644 --- a/include/boost/predef/library/c.h +++ b/include/boost/predef/library/c.h @@ -8,7 +8,7 @@ http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_PREDEF_LIBRARY_C_H #define BOOST_PREDEF_LIBRARY_C_H -#include +#include #include #include diff --git a/include/boost/predef/library/c/_prefix.h b/include/boost/predef/library/c/_prefix.h new file mode 100644 index 0000000..754601f --- /dev/null +++ b/include/boost/predef/library/c/_prefix.h @@ -0,0 +1,13 @@ +/* +Copyright Redshift Software, Inc. 2008-2013 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_LIBRARY_C__PREFIX_H +#define BOOST_PREDEF_LIBRARY_C__PREFIX_H + +#include + +#endif diff --git a/include/boost/predef/library/c/gnu.h b/include/boost/predef/library/c/gnu.h index ee0ab2b..a2bdfce 100644 --- a/include/boost/predef/library/c/gnu.h +++ b/include/boost/predef/library/c/gnu.h @@ -11,6 +11,8 @@ http://www.boost.org/LICENSE_1_0.txt) #include #include +#include + #if defined(__STDC__) #include #elif defined(__cplusplus) diff --git a/include/boost/predef/library/c/uc.h b/include/boost/predef/library/c/uc.h index 3ad94f8..9b553a5 100644 --- a/include/boost/predef/library/c/uc.h +++ b/include/boost/predef/library/c/uc.h @@ -8,6 +8,8 @@ http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_PREDEF_LIBRARY_C_UC_H #define BOOST_PREDEF_LIBRARY_C_UC_H +#include + #include #include diff --git a/include/boost/predef/library/c/vms.h b/include/boost/predef/library/c/vms.h index 8ae5e73..5243dee 100644 --- a/include/boost/predef/library/c/vms.h +++ b/include/boost/predef/library/c/vms.h @@ -8,6 +8,8 @@ http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_PREDEF_LIBRARY_C_VMS_H #define BOOST_PREDEF_LIBRARY_C_VMS_H +#include + #include #include diff --git a/include/boost/predef/library/c/zos.h b/include/boost/predef/library/c/zos.h index 4a29841..c27f40d 100644 --- a/include/boost/predef/library/c/zos.h +++ b/include/boost/predef/library/c/zos.h @@ -8,6 +8,8 @@ http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_PREDEF_LIBRARY_C_ZOS_H #define BOOST_PREDEF_LIBRARY_C_ZOS_H +#include + #include #include diff --git a/include/boost/predef/library/std.h b/include/boost/predef/library/std.h index e6582ec..003f960 100644 --- a/include/boost/predef/library/std.h +++ b/include/boost/predef/library/std.h @@ -1,5 +1,5 @@ /* -Copyright Redshift Software, Inc. 2008-2012 +Copyright Redshift Software, Inc. 2008-2013 Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -7,41 +7,17 @@ http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_PREDEF_LIBRARY_STD_H #define BOOST_PREDEF_LIBRARY_STD_H -/* -We need to include an STD header to gives us the context -of which library we are using. The "smallest" code-wise header -seems to be . Boost uses but as far -as I can tell (RR) it's not a standalone header in most -implementations. Using also has the benefit of -being available in EC++, so we get a chance to make this work -for embedded users. And since it's not a header impacted by TR1 -there's no magic needed for inclusion in the face of the -Boost.TR1 library. -*/ -#include +#include -/* -STLPort library; this _must_ come first, otherwise since -STLport typically sits on top of some other library, we -can end up detecting that first rather than STLport: -*/ -#include - -/* -The rest in alpha order, except for Dinkumware. -*/ #include +#include #include #include #include #include #include #include +#include #include -/* -Dinkumware Library (this has to appear after any possible replacement libraries): -*/ -#include - #endif diff --git a/include/boost/predef/library/std/_prefix.h b/include/boost/predef/library/std/_prefix.h new file mode 100644 index 0000000..0c288e4 --- /dev/null +++ b/include/boost/predef/library/std/_prefix.h @@ -0,0 +1,23 @@ +/* +Copyright Redshift Software, Inc. 2008-2013 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_PREDEF_LIBRARY_STD__PREFIX_H +#define BOOST_PREDEF_LIBRARY_STD__PREFIX_H + +/* +We need to include an STD header to gives us the context +of which library we are using. The "smallest" code-wise header +seems to be . Boost uses but as far +as I can tell (RR) it's not a stand-alone header in most +implementations. Using also has the benefit of +being available in EC++, so we get a chance to make this work +for embedded users. And since it's not a header impacted by TR1 +there's no magic needed for inclusion in the face of the +Boost.TR1 library. +*/ +#include + +#endif diff --git a/include/boost/predef/library/std/cxx.h b/include/boost/predef/library/std/cxx.h index f884675..2ca4dc3 100644 --- a/include/boost/predef/library/std/cxx.h +++ b/include/boost/predef/library/std/cxx.h @@ -8,6 +8,8 @@ http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_PREDEF_LIBRARY_STD_CXX_H #define BOOST_PREDEF_LIBRARY_STD_CXX_H +#include + #include #include diff --git a/include/boost/predef/library/std/dinkumware.h b/include/boost/predef/library/std/dinkumware.h index f8178a6..5357dad 100644 --- a/include/boost/predef/library/std/dinkumware.h +++ b/include/boost/predef/library/std/dinkumware.h @@ -8,6 +8,8 @@ http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_PREDEF_LIBRARY_STD_DINKUMWARE_H #define BOOST_PREDEF_LIBRARY_STD_DINKUMWARE_H +#include + #include #include diff --git a/include/boost/predef/library/std/libcomo.h b/include/boost/predef/library/std/libcomo.h index 3c32d7f..3c324ab 100644 --- a/include/boost/predef/library/std/libcomo.h +++ b/include/boost/predef/library/std/libcomo.h @@ -8,6 +8,8 @@ http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_PREDEF_LIBRARY_STD_LIBCOMO_H #define BOOST_PREDEF_LIBRARY_STD_LIBCOMO_H +#include + #include #include diff --git a/include/boost/predef/library/std/modena.h b/include/boost/predef/library/std/modena.h index 7b260c2..b87f489 100644 --- a/include/boost/predef/library/std/modena.h +++ b/include/boost/predef/library/std/modena.h @@ -8,6 +8,8 @@ http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_PREDEF_LIBRARY_STD_MODENA_H #define BOOST_PREDEF_LIBRARY_STD_MODENA_H +#include + #include #include diff --git a/include/boost/predef/library/std/msl.h b/include/boost/predef/library/std/msl.h index 3478ab9..b205b25 100644 --- a/include/boost/predef/library/std/msl.h +++ b/include/boost/predef/library/std/msl.h @@ -8,6 +8,8 @@ http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_PREDEF_LIBRARY_STD_MSL_H #define BOOST_PREDEF_LIBRARY_STD_MSL_H +#include + #include #include diff --git a/include/boost/predef/library/std/roguewave.h b/include/boost/predef/library/std/roguewave.h index b968ac3..7ca1266 100644 --- a/include/boost/predef/library/std/roguewave.h +++ b/include/boost/predef/library/std/roguewave.h @@ -8,6 +8,8 @@ http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_PREDEF_LIBRARY_STD_ROGUEWAVE_H #define BOOST_PREDEF_LIBRARY_STD_ROGUEWAVE_H +#include + #include #include diff --git a/include/boost/predef/library/std/sgi.h b/include/boost/predef/library/std/sgi.h index 289db97..b8e7807 100644 --- a/include/boost/predef/library/std/sgi.h +++ b/include/boost/predef/library/std/sgi.h @@ -8,6 +8,8 @@ http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_PREDEF_LIBRARY_STD_SGI_H #define BOOST_PREDEF_LIBRARY_STD_SGI_H +#include + #include #include diff --git a/include/boost/predef/library/std/stdcpp3.h b/include/boost/predef/library/std/stdcpp3.h index 209436e..cab5644 100644 --- a/include/boost/predef/library/std/stdcpp3.h +++ b/include/boost/predef/library/std/stdcpp3.h @@ -8,6 +8,8 @@ http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_PREDEF_LIBRARY_STD_STDCPP3_H #define BOOST_PREDEF_LIBRARY_STD_STDCPP3_H +#include + #include #include diff --git a/include/boost/predef/library/std/stlport.h b/include/boost/predef/library/std/stlport.h index 25def0a..eba82bc 100644 --- a/include/boost/predef/library/std/stlport.h +++ b/include/boost/predef/library/std/stlport.h @@ -8,6 +8,8 @@ http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_PREDEF_LIBRARY_STD_STLPORT_H #define BOOST_PREDEF_LIBRARY_STD_STLPORT_H +#include + #include #include diff --git a/include/boost/predef/library/std/vacpp.h b/include/boost/predef/library/std/vacpp.h index e43af47..eb11572 100644 --- a/include/boost/predef/library/std/vacpp.h +++ b/include/boost/predef/library/std/vacpp.h @@ -8,6 +8,8 @@ http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_PREDEF_LIBRARY_STD_VACPP_H #define BOOST_PREDEF_LIBRARY_STD_VACPP_H +#include + #include #include