diff --git a/src/beast/Builds/VisualStudio2012/beast.vcxproj b/src/beast/Builds/VisualStudio2012/beast.vcxproj
index 6f9e5f3c3c..f55e325993 100644
--- a/src/beast/Builds/VisualStudio2012/beast.vcxproj
+++ b/src/beast/Builds/VisualStudio2012/beast.vcxproj
@@ -21,9 +21,18 @@
+
+
+
+
+
+
+
+
+
-
+
true
true
true
@@ -69,14 +78,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -90,6 +112,16 @@
+
+
+
+
+
+
+
+
+
+
@@ -104,6 +136,7 @@
+
@@ -127,8 +160,6 @@
-
-
@@ -186,7 +217,6 @@
-
@@ -203,7 +233,6 @@
-
@@ -213,8 +242,6 @@
-
-
@@ -222,8 +249,6 @@
-
-
@@ -249,7 +274,6 @@
-
@@ -258,31 +282,20 @@
-
-
-
+
-
-
-
-
-
-
-
-
-
@@ -371,6 +384,49 @@
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
true
true
@@ -378,6 +434,19 @@
true
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
true
true
@@ -456,18 +525,6 @@
true
true
-
- true
- true
- true
- true
-
-
- true
- true
- true
- true
-
true
true
@@ -941,12 +998,6 @@
true
true
-
- true
- true
- true
- true
-
true
true
@@ -1001,12 +1052,6 @@
true
true
-
- true
- true
- true
- true
-
true
true
@@ -1025,12 +1070,6 @@
true
true
-
- true
- true
- true
- true
-
true
true
diff --git a/src/beast/Builds/VisualStudio2012/beast.vcxproj.filters b/src/beast/Builds/VisualStudio2012/beast.vcxproj.filters
index b725af4e99..b0278d174b 100644
--- a/src/beast/Builds/VisualStudio2012/beast.vcxproj.filters
+++ b/src/beast/Builds/VisualStudio2012/beast.vcxproj.filters
@@ -1,9 +1,6 @@
-
- beast_core
-
beast_core\native
@@ -40,6 +37,36 @@
_meta
+
+ beast\http\impl\http-parser
+
+
+ beast\http\impl\http-parser
+
+
+ beast\http\impl\http-parser
+
+
+ beast\http\impl\http-parser
+
+
+ beast\http\impl\http-parser
+
+
+ beast\http\impl\http-parser
+
+
+ beast\http\impl\http-parser
+
+
+ beast\http\impl\http-parser
+
+
+ beast\http\impl\http-parser
+
+
+ beast_core
+
@@ -174,9 +201,6 @@
{5904368f-a0f2-4d26-a031-8cbe4448dc3f}
-
- {ac367054-ddbf-4118-a41a-07bea34d32c8}
-
{c0724499-ab69-40c3-90e2-65242dbd2eaa}
@@ -204,6 +228,27 @@
{da8084c0-491b-4eb0-b750-97182a9deed4}
+
+ {56ef157f-ad92-4da7-8fbf-00723f769732}
+
+
+ {565f012b-42b7-42c9-81b7-9e93aa378000}
+
+
+ {7eead15d-f9dc-4b4d-a653-57d9c090e697}
+
+
+ {233e3c4d-e398-4c11-a42c-3483107eb8e9}
+
+
+ {8d80e304-a42d-411a-9528-811eddff3191}
+
+
+ {eabf472c-e198-409a-a65b-7c087ae911d0}
+
+
+ {1fff3bd8-44ae-41df-8dd4-8bb6f07b2908}
+
@@ -284,24 +329,12 @@
beast_core\maths
-
- beast_core\maths
-
beast_core\maths
beast_core\maths
-
- beast_core\memory
-
-
- beast_core\memory
-
-
- beast_core\memory
-
beast_core\memory
@@ -350,9 +383,6 @@
beast_core\network
-
- beast_core\network
-
beast_core\streams
@@ -377,33 +407,12 @@
beast_core\streams
-
- beast_core\text
-
-
- beast_core\text
-
-
- beast_core\text
-
-
- beast_core\text
-
-
- beast_core\text
-
beast_core\text
beast_core\text
-
- beast_core\text
-
-
- beast_core\text
-
beast_core\text
@@ -678,9 +687,6 @@
beast_core\maths
-
- beast_core\memory
-
beast_core\memory
@@ -786,18 +792,9 @@
beast_core\system
-
- beast_core\system
-
beast_core\system
-
- beast_core\system
-
-
- beast_core\system
-
beast_core\system
@@ -813,12 +810,6 @@
beast_core\containers
-
- beast_core\text
-
-
- beast_core\text
-
beast\intrusive
@@ -849,12 +840,6 @@
beast_core\memory
-
- beast_core\diagnostic
-
-
- beast_asio\parsehttp
-
beast_asio\async
@@ -972,9 +957,6 @@
beast_asio\http
-
- beast_asio\http
-
beast\mpl
@@ -1047,9 +1029,6 @@
beast\utility
-
- beast
-
beast\utility
@@ -1104,6 +1083,84 @@
beast_core\thread
+
+ beast\http\impl\http-parser
+
+
+ beast
+
+
+ beast\strings
+
+
+ beast\strings
+
+
+ beast\strings
+
+
+ beast\strings
+
+
+ beast\strings
+
+
+ beast\strings
+
+
+ beast\strings
+
+
+ beast\strings
+
+
+ beast\strings
+
+
+ beast
+
+
+ beast\config
+
+
+ beast\config
+
+
+ beast\config
+
+
+ beast
+
+
+ beast\config
+
+
+ beast\config
+
+
+ beast
+
+
+ beast
+
+
+ beast
+
+
+ beast
+
+
+ beast
+
+
+ beast_core\system
+
+
+ beast\http
+
+
+ beast\http
+
@@ -1223,9 +1280,6 @@
beast_core\network
-
- beast_core\network
-
beast_core\streams
@@ -1247,18 +1301,12 @@
beast_core\streams
-
- beast_core\text
-
beast_core\text
beast_core\text
-
- beast_core\text
-
beast_core\text
@@ -1508,9 +1556,6 @@
beast_core\containers
-
- beast_asio\parsehttp
-
beast_asio\async
@@ -1580,9 +1625,6 @@
beast_asio\http
-
- beast_asio\http
-
beast_crypto
@@ -1637,6 +1679,39 @@
beast_core\thread
+
+ beast\http\impl\http-parser
+
+
+ beast\http\impl\http-parser
+
+
+ beast\http\impl\http-parser\contrib
+
+
+ beast\http\impl\http-parser\contrib
+
+
+ beast\http
+
+
+ beast\http\impl
+
+
+ beast\strings\impl
+
+
+ beast\strings\impl
+
+
+ beast\strings
+
+
+ beast\http\impl
+
+
+ beast\http\impl
+
diff --git a/src/beast/modules/beast_core/maths/MathsFunctions.h b/src/beast/beast/Arithmetic.h
similarity index 97%
rename from src/beast/modules/beast_core/maths/MathsFunctions.h
rename to src/beast/beast/Arithmetic.h
index 4ccd4eab5c..15b2852f60 100644
--- a/src/beast/modules/beast_core/maths/MathsFunctions.h
+++ b/src/beast/beast/Arithmetic.h
@@ -21,10 +21,11 @@
*/
//==============================================================================
-#ifndef BEAST_MATHSFUNCTIONS_H_INCLUDED
-#define BEAST_MATHSFUNCTIONS_H_INCLUDED
+#ifndef BEAST_ARITHMETIC_H_INCLUDED
+#define BEAST_ARITHMETIC_H_INCLUDED
+
+namespace beast {
-//==============================================================================
// Some indispensible min/max functions
/** Returns the larger of two values. */
@@ -199,7 +200,7 @@ inline void swapVariables (Type& variable1, Type& variable2)
@endcode
*/
template
-inline int numElementsInArray (Type (&array)[N])
+int numElementsInArray (Type (&array)[N])
{
(void) array; // (required to avoid a spurious warning in MS compilers)
(void) sizeof (0[array]); // This line should cause an error if you pass an object with a user-defined subscript operator
@@ -440,7 +441,7 @@ namespace TypeHelpers
template <> struct SmallestFloatType { typedef double type; };
}
+}
-//==============================================================================
+#endif
-#endif // BEAST_MATHSFUNCTIONS_H_INCLUDED
diff --git a/src/beast/beast/Atomic.h b/src/beast/beast/Atomic.h
index fa498aadc9..e7204003d1 100644
--- a/src/beast/beast/Atomic.h
+++ b/src/beast/beast/Atomic.h
@@ -24,6 +24,9 @@
#ifndef BEAST_ATOMIC_H_INCLUDED
#define BEAST_ATOMIC_H_INCLUDED
+#include "Config.h"
+#include "StaticAssert.h"
+
namespace beast {
//==============================================================================
diff --git a/src/beast/modules/beast_core/memory/ByteOrder.h b/src/beast/beast/ByteOrder.h
similarity index 79%
rename from src/beast/modules/beast_core/memory/ByteOrder.h
rename to src/beast/beast/ByteOrder.h
index 191de0d943..dcc88d43e5 100644
--- a/src/beast/modules/beast_core/memory/ByteOrder.h
+++ b/src/beast/beast/ByteOrder.h
@@ -24,6 +24,10 @@
#ifndef BEAST_BYTEORDER_H_INCLUDED
#define BEAST_BYTEORDER_H_INCLUDED
+#include "Uncopyable.h"
+
+namespace beast {
+
//==============================================================================
/** Contains static methods for converting the byte order between different
endiannesses.
@@ -182,5 +186,109 @@ inline int ByteOrder::bigEndian24Bit (const char* const bytes)
inline void ByteOrder::littleEndian24BitToChars (const int value, char* const destBytes) { destBytes[0] = (char)(value & 0xff); destBytes[1] = (char)((value >> 8) & 0xff); destBytes[2] = (char)((value >> 16) & 0xff); }
inline void ByteOrder::bigEndian24BitToChars (const int value, char* const destBytes) { destBytes[0] = (char)((value >> 16) & 0xff); destBytes[1] = (char)((value >> 8) & 0xff); destBytes[2] = (char)(value & 0xff); }
-#endif
+namespace detail
+{
+/** Specialized helper class template for swapping bytes.
+
+ Normally you won't use this directly, use the helper function
+ byteSwap instead. You can specialize this class for your
+ own user defined types, as was done for uint24.
+
+ @see swapBytes, uint24
+*/
+template
+struct SwapBytes
+{
+ inline IntegralType operator() (IntegralType value) const noexcept
+ {
+ return ByteOrder::swap (value);
+ }
+};
+
+// Specializations for signed integers
+
+template <>
+struct SwapBytes
+{
+ inline int16 operator() (int16 value) const noexcept
+ {
+ return static_cast (ByteOrder::swap (static_cast (value)));
+ }
+};
+
+template <>
+struct SwapBytes
+{
+ inline int32 operator() (int32 value) const noexcept
+ {
+ return static_cast (ByteOrder::swap (static_cast (value)));
+ }
+};
+
+template <>
+struct SwapBytes
+{
+ inline int64 operator() (int64 value) const noexcept
+ {
+ return static_cast (ByteOrder::swap (static_cast (value)));
+ }
+};
+
+}
+
+//------------------------------------------------------------------------------
+
+/** Returns a type with the bytes swapped.
+ Little endian becomes big endian and vice versa. The underlying
+ type must be an integral type or behave like one.
+*/
+template
+inline IntegralType swapBytes (IntegralType value) noexcept
+{
+ return detail::SwapBytes () (value);
+}
+
+/** Returns the machine byte-order value to little-endian byte order. */
+template
+inline IntegralType toLittleEndian (IntegralType value) noexcept
+{
+#if BEAST_LITTLE_ENDIAN
+ return value;
+#else
+ return swapBytes (value);
+#endif
+}
+
+/** Returns the machine byte-order value to big-endian byte order. */
+template
+inline IntegralType toBigEndian (IntegralType value) noexcept
+{
+#if BEAST_LITTLE_ENDIAN
+ return swapBytes (value);
+#else
+ return value;
+#endif
+}
+
+/** Returns the machine byte-order value to network byte order. */
+template
+inline IntegralType toNetworkByteOrder (IntegralType value) noexcept
+{
+ return toBigEndian (value);
+}
+
+/** Converts from network byte order to machine byte order. */
+template
+inline IntegralType fromNetworkByteOrder (IntegralType value) noexcept
+{
+#if BEAST_LITTLE_ENDIAN
+ return swapBytes (value);
+#else
+ return value;
+#endif
+}
+
+}
+
+#endif
diff --git a/src/beast/beast/Config.h b/src/beast/beast/Config.h
index d67089d4cd..89353891dd 100644
--- a/src/beast/beast/Config.h
+++ b/src/beast/beast/Config.h
@@ -26,194 +26,10 @@
// VFALCO NOTE this is analogous to
-//==============================================================================
-/* This file figures out which platform is being built, and defines some macros
- that the rest of the code can use for OS-specific compilation.
-
- Macros that will be set here are:
-
- - One of BEAST_WINDOWS, BEAST_MAC BEAST_LINUX, BEAST_IOS, BEAST_ANDROID, etc.
- - Either BEAST_32BIT or BEAST_64BIT, depending on the architecture.
- - Either BEAST_LITTLE_ENDIAN or BEAST_BIG_ENDIAN.
- - Either BEAST_INTEL or BEAST_PPC
- - Either BEAST_GCC or BEAST_MSVC
-*/
-
-//==============================================================================
-#if (defined (_WIN32) || defined (_WIN64))
- #define BEAST_WIN32 1
- #define BEAST_WINDOWS 1
-#elif defined (BEAST_ANDROID)
- #undef BEAST_ANDROID
- #define BEAST_ANDROID 1
-#elif defined (LINUX) || defined (__linux__)
- #define BEAST_LINUX 1
-#elif defined (__APPLE_CPP__) || defined(__APPLE_CC__)
- #define Point CarbonDummyPointName // (workaround to avoid definition of "Point" by old Carbon headers)
- #define Component CarbonDummyCompName
- #include // (needed to find out what platform we're using)
- #undef Point
- #undef Component
-
- #if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
- #define BEAST_IPHONE 1
- #define BEAST_IOS 1
- #else
- #define BEAST_MAC 1
- #endif
-#elif defined (__FreeBSD__)
- #define BEAST_BSD 1
-#else
- #error "Unknown platform!"
-#endif
-
-//==============================================================================
-#if BEAST_WINDOWS
- #ifdef _MSC_VER
- #ifdef _WIN64
- #define BEAST_64BIT 1
- #else
- #define BEAST_32BIT 1
- #endif
- #endif
-
- #ifdef _DEBUG
- #define BEAST_DEBUG 1
- #endif
-
- #ifdef __MINGW32__
- #define BEAST_MINGW 1
- #ifdef __MINGW64__
- #define BEAST_64BIT 1
- #else
- #define BEAST_32BIT 1
- #endif
- #endif
-
- /** If defined, this indicates that the processor is little-endian. */
- #define BEAST_LITTLE_ENDIAN 1
-
- #define BEAST_INTEL 1
-#endif
-
-//==============================================================================
-#if BEAST_MAC || BEAST_IOS
-
- #if defined (DEBUG) || defined (_DEBUG) || ! (defined (NDEBUG) || defined (_NDEBUG))
- #define BEAST_DEBUG 1
- #endif
-
- #if ! (defined (DEBUG) || defined (_DEBUG) || defined (NDEBUG) || defined (_NDEBUG))
- #warning "Neither NDEBUG or DEBUG has been defined - you should set one of these to make it clear whether this is a release build,"
- #endif
-
- #ifdef __LITTLE_ENDIAN__
- #define BEAST_LITTLE_ENDIAN 1
- #else
- #define BEAST_BIG_ENDIAN 1
- #endif
-#endif
-
-#if BEAST_MAC
-
- #if defined (__ppc__) || defined (__ppc64__)
- #define BEAST_PPC 1
- #elif defined (__arm__)
- #define BEAST_ARM 1
- #else
- #define BEAST_INTEL 1
- #endif
-
- #ifdef __LP64__
- #define BEAST_64BIT 1
- #else
- #define BEAST_32BIT 1
- #endif
-
- #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_4
- #error "Building for OSX 10.3 is no longer supported!"
- #endif
-
- #ifndef MAC_OS_X_VERSION_10_5
- #error "To build with 10.4 compatibility, use a 10.5 or 10.6 SDK and set the deployment target to 10.4"
- #endif
+#include "Version.h"
+#include "config/PlatformConfig.h"
+#include "config/CompilerConfig.h"
+#include "config/StandardConfig.h"
+#include "config/ConfigCheck.h"
#endif
-
-//==============================================================================
-#if BEAST_LINUX || BEAST_ANDROID || BEAST_BSD
-
- #ifdef _DEBUG
- #define BEAST_DEBUG 1
- #endif
-
- // Allow override for big-endian Linux platforms
- #if defined (__LITTLE_ENDIAN__) || ! defined (BEAST_BIG_ENDIAN)
- #define BEAST_LITTLE_ENDIAN 1
- #undef BEAST_BIG_ENDIAN
- #else
- #undef BEAST_LITTLE_ENDIAN
- #define BEAST_BIG_ENDIAN 1
- #endif
-
- #if defined (__LP64__) || defined (_LP64)
- #define BEAST_64BIT 1
- #else
- #define BEAST_32BIT 1
- #endif
-
- #if __MMX__ || __SSE__ || __amd64__
- #ifdef __arm__
- #define BEAST_ARM 1
- #else
- #define BEAST_INTEL 1
- #endif
- #endif
-#endif
-
-//==============================================================================
-// Compiler type macros.
-
-#ifdef __clang__
- #define BEAST_CLANG 1
- #define BEAST_GCC 1
-#elif defined (__GNUC__)
- #define BEAST_GCC 1
-#elif defined (_MSC_VER)
- #define BEAST_MSVC 1
-
- #if _MSC_VER < 1500
- #define BEAST_VC8_OR_EARLIER 1
-
- #if _MSC_VER < 1400
- #define BEAST_VC7_OR_EARLIER 1
-
- #if _MSC_VER < 1300
- #warning "MSVC 6.0 is no longer supported!"
- #endif
- #endif
- #endif
-
- #if BEAST_64BIT || ! BEAST_VC7_OR_EARLIER
- #define BEAST_USE_INTRINSICS 1
- #endif
-#else
- #error unknown compiler
-#endif
-
-//------------------------------------------------------------------------------
-
-// Handy macro that lets pragma warnings be clicked in the output window
-//
-// Usage: #pragma message(BEAST_FILEANDLINE_ "Advertise here!")
-//
-// Note that a space following the macro is mandatory for C++11.
-//
-// This is here so it can be used in C compilations that include this directly.
-//
-#define BEAST_PP_STR2_(x) #x
-#define BEAST_PP_STR1_(x) BEAST_PP_STR2_(x)
-#define BEAST_FILEANDLINE_ __FILE__ "(" BEAST_PP_STR1_(__LINE__) "): warning:"
-
-#endif
-
diff --git a/src/beast/beast/HTTP.h b/src/beast/beast/HTTP.h
new file mode 100644
index 0000000000..400191ed25
--- /dev/null
+++ b/src/beast/beast/HTTP.h
@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of Beast: https://github.com/vinniefalco/Beast
+ Copyright 2013, Vinnie Falco
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+#ifndef BEAST_HTTP_H_INCLUDED
+#define BEAST_HTTP_H_INCLUDED
+
+#include "http/URL.h"
+#include "http/ParsedURL.h"
+
+#endif
diff --git a/src/beast/modules/beast_core/memory/HeapBlock.h b/src/beast/beast/HeapBlock.h
similarity index 89%
rename from src/beast/modules/beast_core/memory/HeapBlock.h
rename to src/beast/beast/HeapBlock.h
index 8d4dfc92f8..144edae140 100644
--- a/src/beast/modules/beast_core/memory/HeapBlock.h
+++ b/src/beast/beast/HeapBlock.h
@@ -24,6 +24,42 @@
#ifndef BEAST_HEAPBLOCK_H_INCLUDED
#define BEAST_HEAPBLOCK_H_INCLUDED
+#include "Memory.h"
+#include "Uncopyable.h"
+
+// If the MSVC debug heap headers were included, disable
+// the macros during the juce include since they conflict.
+#ifdef _CRTDBG_MAP_ALLOC
+#pragma push_macro("calloc")
+#pragma push_macro("free")
+#pragma push_macro("malloc")
+#pragma push_macro("realloc")
+#pragma push_macro("_recalloc")
+#pragma push_macro("_aligned_free")
+#pragma push_macro("_aligned_malloc")
+#pragma push_macro("_aligned_offset_malloc")
+#pragma push_macro("_aligned_realloc")
+#pragma push_macro("_aligned_recalloc")
+#pragma push_macro("_aligned_offset_realloc")
+#pragma push_macro("_aligned_offset_recalloc")
+#pragma push_macro("_aligned_msize")
+#undef calloc
+#undef free
+#undef malloc
+#undef realloc
+#undef _recalloc
+#undef _aligned_free
+#undef _aligned_malloc
+#undef _aligned_offset_malloc
+#undef _aligned_realloc
+#undef _aligned_recalloc
+#undef _aligned_offset_realloc
+#undef _aligned_offset_recalloc
+#undef _aligned_msize
+#endif
+
+namespace beast {
+
#ifndef DOXYGEN
namespace HeapBlockHelper
{
@@ -305,5 +341,23 @@ private:
#endif
};
+}
+
+#ifdef _CRTDBG_MAP_ALLOC
+#pragma pop_macro("_aligned_msize")
+#pragma pop_macro("_aligned_offset_recalloc")
+#pragma pop_macro("_aligned_offset_realloc")
+#pragma pop_macro("_aligned_recalloc")
+#pragma pop_macro("_aligned_realloc")
+#pragma pop_macro("_aligned_offset_malloc")
+#pragma pop_macro("_aligned_malloc")
+#pragma pop_macro("_aligned_free")
+#pragma pop_macro("_recalloc")
+#pragma pop_macro("realloc")
+#pragma pop_macro("malloc")
+#pragma pop_macro("free")
+#pragma pop_macro("calloc")
+#endif
+
+#endif
-#endif // BEAST_HEAPBLOCK_H_INCLUDED
diff --git a/src/beast/modules/beast_core/memory/Memory.h b/src/beast/beast/Memory.h
similarity index 99%
rename from src/beast/modules/beast_core/memory/Memory.h
rename to src/beast/beast/Memory.h
index b67ec0cd7a..f39fa9ca13 100644
--- a/src/beast/modules/beast_core/memory/Memory.h
+++ b/src/beast/beast/Memory.h
@@ -24,6 +24,8 @@
#ifndef BEAST_MEMORY_H_INCLUDED
#define BEAST_MEMORY_H_INCLUDED
+namespace beast {
+
//==============================================================================
/** Fills a block of memory with zeros. */
inline void zeromem (void* memory, size_t numBytes) noexcept { memset (memory, 0, numBytes); }
@@ -90,5 +92,7 @@ inline Type* createCopyIfNotNull (const Type* pointer) { return pointer != n
#define BEAST_AUTORELEASEPOOL
#endif
+}
+
#endif
diff --git a/src/beast/beast/Strings.h b/src/beast/beast/Strings.h
new file mode 100644
index 0000000000..5b76162400
--- /dev/null
+++ b/src/beast/beast/Strings.h
@@ -0,0 +1,27 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of Beast: https://github.com/vinniefalco/Beast
+ Copyright 2013, Vinnie Falco
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+#ifndef BEAST_STRINGS_H_INCLUDED
+#define BEAST_STRINGS_H_INCLUDED
+
+#include "strings/String.h"
+#include "strings/NewLine.h"
+
+#endif
+
diff --git a/src/beast/beast/Version.h b/src/beast/beast/Version.h
new file mode 100644
index 0000000000..e409692fb6
--- /dev/null
+++ b/src/beast/beast/Version.h
@@ -0,0 +1,40 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of Beast: https://github.com/vinniefalco/Beast
+ Copyright 2013, Vinnie Falco
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+#ifndef BEAST_VERSION_H_INCLUDED
+#define BEAST_VERSION_H_INCLUDED
+
+/** Current BEAST version number.
+ See also SystemStats::getBeastVersion() for a string version.
+*/
+// VFALCO TODO Replace this with SemanticVerson
+#define BEAST_MAJOR_VERSION 1
+#define BEAST_MINOR_VERSION 0
+#define BEAST_BUILDNUMBER 0
+
+/** Current Beast version number.
+ Bits 16 to 32 = major version.
+ Bits 8 to 16 = minor version.
+ Bits 0 to 8 = point release.
+ See also SystemStats::getBeastVersion() for a string version.
+*/
+#define BEAST_VERSION ((BEAST_MAJOR_VERSION << 16) + (BEAST_MINOR_VERSION << 8) + BEAST_BUILDNUMBER)
+
+#endif
+
diff --git a/src/beast/modules/beast_core/system/PlatformDefs.h b/src/beast/beast/config/CompilerConfig.h
similarity index 92%
rename from src/beast/modules/beast_core/system/PlatformDefs.h
rename to src/beast/beast/config/CompilerConfig.h
index 5039445a5c..46e3afbfa5 100644
--- a/src/beast/modules/beast_core/system/PlatformDefs.h
+++ b/src/beast/beast/config/CompilerConfig.h
@@ -21,8 +21,14 @@
*/
//==============================================================================
-#ifndef BEAST_CORE_PLATFORMDEFS_H_INCLUDED
-#define BEAST_CORE_PLATFORMDEFS_H_INCLUDED
+#ifndef BEAST_CONFIG_COMPILERCONFIG_H_INCLUDED
+#define BEAST_CONFIG_COMPILERCONFIG_H_INCLUDED
+
+// This file has to work when included in a C source file.
+
+#ifndef BEAST_CONFIG_PLATFORMCONFIG_H_INCLUDED
+#error "PlatformConfig.h must come first!"
+#endif
// This file defines miscellaneous macros for debugging, assertions, etc.
@@ -84,6 +90,17 @@
//------------------------------------------------------------------------------
+#ifdef __cplusplus
+extern "C" {
+#endif
+/** Report a fatal error message and terminate the application.
+ Normally you won't call this directly.
+*/
+extern void beast_reportFatalError (char const* message, char const* fileName, int lineNumber);
+#ifdef __cplusplus
+}
+#endif
+
#if BEAST_DEBUG || DOXYGEN
/** Writes a string to the standard error stream.
@@ -99,17 +116,12 @@
#define bassertfalse { beast_LogCurrentAssertion; if (beast::beast_isRunningUnderDebugger()) beast_breakDebugger; BEAST_ANALYZER_NORETURN }
/** Platform-independent assertion macro.
-
This macro gets turned into a no-op when you're building with debugging turned off, so be
careful that the expression you pass to it doesn't perform any actions that are vital for the
correct behaviour of your program!
@see bassertfalse
*/
-#if 0
-#define bassert(expression) { if (! (expression)) bassertfalse; }
-#else
-#define bassert(expression) { if (! (expression)) fatal_error(#expression); }
-#endif
+#define bassert(expression) { if (! (expression)) beast_reportFatalError(#expression,__FILE__,__LINE__); }
#else
@@ -283,4 +295,11 @@
#define override
#endif
+#ifdef __cplusplus
+namespace beast {
+bool beast_isRunningUnderDebugger();
+void logAssertion (char const* file, int line) noexcept;
+}
+#endif
+
#endif
diff --git a/src/beast/modules/beast_core/system/BeastConfigCheck.h b/src/beast/beast/config/ConfigCheck.h
similarity index 97%
rename from src/beast/modules/beast_core/system/BeastConfigCheck.h
rename to src/beast/beast/config/ConfigCheck.h
index 53a3b433cc..3fd5a17a22 100644
--- a/src/beast/modules/beast_core/system/BeastConfigCheck.h
+++ b/src/beast/beast/config/ConfigCheck.h
@@ -17,8 +17,8 @@
*/
//==============================================================================
-#ifndef BEAST_CORE_BEASTCONFIGCHECK_H_INCLUDED
-#define BEAST_CORE_BEASTCONFIGCHECK_H_INCLUDED
+#ifndef BEAST_CONFIG_CONFIGCHECK_H_INCLUDED
+#define BEAST_CONFIG_CONFIGCHECK_H_INCLUDED
// This file makes sure that BeastConfig.h was included.
// It also sets defaults for all config options.
diff --git a/src/beast/modules/beast_core/diagnostic/ContractChecks.h b/src/beast/beast/config/ContractChecks.h
similarity index 92%
rename from src/beast/modules/beast_core/diagnostic/ContractChecks.h
rename to src/beast/beast/config/ContractChecks.h
index b7d9e09a0f..59cad4231c 100644
--- a/src/beast/modules/beast_core/diagnostic/ContractChecks.h
+++ b/src/beast/beast/config/ContractChecks.h
@@ -17,8 +17,10 @@
*/
//==============================================================================
-#ifndef BEAST_CONTRACTCHECKS_H_INCLUDED
-#define BEAST_CONTRACTCHECKS_H_INCLUDED
+#ifndef BEAST_CONFIG_CONTRACTCHECKS_H_INCLUDED
+#define BEAST_CONFIG_CONTRACTCHECKS_H_INCLUDED
+
+// This file has to work when included in a C source file.
#if defined (fatal_error) || \
defined (fatal_condition) || \
@@ -33,15 +35,13 @@
#error "Programming by contract macros cannot be overriden!"
#endif
-extern void reportFatalError (char const* message, char const* fileName, int lineNumber);
-
/** Report a fatal error message and terminate the application.
This macro automatically fills in the file and line number
Meets this declaration syntax:
@code inline void fatal_error (char const* message); @endif
@see FatalError
*/
-#define fatal_error(message) reportFatalError (message, __FILE__, __LINE__)
+#define fatal_error(message) beast_reportFatalError (message, __FILE__, __LINE__)
/** Reports a fatal error message type if the condition is false
The condition is always evaluated regardless of settings.
@@ -49,7 +49,7 @@ extern void reportFatalError (char const* message, char const* fileName, int lin
@code inline void fatal_condition (bool condition, char const* category); @endcode
*/
#define fatal_condition(condition,category) static_cast \
- (((!!(condition)) || (reportFatalError ( \
+ (((!!(condition)) || (beast_reportFatalError ( \
category " '" BEAST_STRINGIFY(condition) "' failed.", __FILE__, __LINE__), 0)))
/** Replacement for assert which generates a fatal error if the condition is false.
@@ -65,7 +65,7 @@ extern void reportFatalError (char const* message, char const* fileName, int lin
@code inline void fatal_condition (bool condition, char const* category); @endcode
*/
#define meets_condition(condition,category) static_cast \
- (((!!(condition)) || (reportFatalError ( \
+ (((!!(condition)) || (beast_reportFatalError ( \
category " '" BEAST_STRINGIFY(condition) "' failed.", __FILE__, __LINE__), false)))
/** Condition tests for programming by contract.
diff --git a/src/beast/beast/config/PlatformConfig.h b/src/beast/beast/config/PlatformConfig.h
new file mode 100644
index 0000000000..ec59dab8d7
--- /dev/null
+++ b/src/beast/beast/config/PlatformConfig.h
@@ -0,0 +1,217 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of Beast: https://github.com/vinniefalco/Beast
+ Copyright 2013, Vinnie Falco
+
+ Portions of this file are from JUCE.
+ Copyright (c) 2013 - Raw Material Software Ltd.
+ Please visit http://www.juce.com
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+#ifndef BEAST_CONFIG_PLATFORMCONFIG_H_INCLUDED
+#define BEAST_CONFIG_PLATFORMCONFIG_H_INCLUDED
+
+//==============================================================================
+/* This file figures out which platform is being built, and defines some macros
+ that the rest of the code can use for OS-specific compilation.
+
+ Macros that will be set here are:
+
+ - One of BEAST_WINDOWS, BEAST_MAC BEAST_LINUX, BEAST_IOS, BEAST_ANDROID, etc.
+ - Either BEAST_32BIT or BEAST_64BIT, depending on the architecture.
+ - Either BEAST_LITTLE_ENDIAN or BEAST_BIG_ENDIAN.
+ - Either BEAST_INTEL or BEAST_PPC
+ - Either BEAST_GCC or BEAST_MSVC
+*/
+
+//==============================================================================
+#if (defined (_WIN32) || defined (_WIN64))
+ #define BEAST_WIN32 1
+ #define BEAST_WINDOWS 1
+#elif defined (BEAST_ANDROID)
+ #undef BEAST_ANDROID
+ #define BEAST_ANDROID 1
+#elif defined (LINUX) || defined (__linux__)
+ #define BEAST_LINUX 1
+#elif defined (__APPLE_CPP__) || defined(__APPLE_CC__)
+ #define Point CarbonDummyPointName // (workaround to avoid definition of "Point" by old Carbon headers)
+ #define Component CarbonDummyCompName
+ #include // (needed to find out what platform we're using)
+ #undef Point
+ #undef Component
+
+ #if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
+ #define BEAST_IPHONE 1
+ #define BEAST_IOS 1
+ #else
+ #define BEAST_MAC 1
+ #endif
+#elif defined (__FreeBSD__)
+ #define BEAST_BSD 1
+#else
+ #error "Unknown platform!"
+#endif
+
+//==============================================================================
+#if BEAST_WINDOWS
+ #ifdef _MSC_VER
+ #ifdef _WIN64
+ #define BEAST_64BIT 1
+ #else
+ #define BEAST_32BIT 1
+ #endif
+ #endif
+
+ #ifdef _DEBUG
+ #define BEAST_DEBUG 1
+ #endif
+
+ #ifdef __MINGW32__
+ #define BEAST_MINGW 1
+ #ifdef __MINGW64__
+ #define BEAST_64BIT 1
+ #else
+ #define BEAST_32BIT 1
+ #endif
+ #endif
+
+ /** If defined, this indicates that the processor is little-endian. */
+ #define BEAST_LITTLE_ENDIAN 1
+
+ #define BEAST_INTEL 1
+#endif
+
+//==============================================================================
+#if BEAST_MAC || BEAST_IOS
+
+ #if defined (DEBUG) || defined (_DEBUG) || ! (defined (NDEBUG) || defined (_NDEBUG))
+ #define BEAST_DEBUG 1
+ #endif
+
+ #if ! (defined (DEBUG) || defined (_DEBUG) || defined (NDEBUG) || defined (_NDEBUG))
+ #warning "Neither NDEBUG or DEBUG has been defined - you should set one of these to make it clear whether this is a release build,"
+ #endif
+
+ #ifdef __LITTLE_ENDIAN__
+ #define BEAST_LITTLE_ENDIAN 1
+ #else
+ #define BEAST_BIG_ENDIAN 1
+ #endif
+#endif
+
+#if BEAST_MAC
+
+ #if defined (__ppc__) || defined (__ppc64__)
+ #define BEAST_PPC 1
+ #elif defined (__arm__)
+ #define BEAST_ARM 1
+ #else
+ #define BEAST_INTEL 1
+ #endif
+
+ #ifdef __LP64__
+ #define BEAST_64BIT 1
+ #else
+ #define BEAST_32BIT 1
+ #endif
+
+ #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_4
+ #error "Building for OSX 10.3 is no longer supported!"
+ #endif
+
+ #ifndef MAC_OS_X_VERSION_10_5
+ #error "To build with 10.4 compatibility, use a 10.5 or 10.6 SDK and set the deployment target to 10.4"
+ #endif
+
+#endif
+
+//==============================================================================
+#if BEAST_LINUX || BEAST_ANDROID || BEAST_BSD
+
+ #ifdef _DEBUG
+ #define BEAST_DEBUG 1
+ #endif
+
+ // Allow override for big-endian Linux platforms
+ #if defined (__LITTLE_ENDIAN__) || ! defined (BEAST_BIG_ENDIAN)
+ #define BEAST_LITTLE_ENDIAN 1
+ #undef BEAST_BIG_ENDIAN
+ #else
+ #undef BEAST_LITTLE_ENDIAN
+ #define BEAST_BIG_ENDIAN 1
+ #endif
+
+ #if defined (__LP64__) || defined (_LP64)
+ #define BEAST_64BIT 1
+ #else
+ #define BEAST_32BIT 1
+ #endif
+
+ #if __MMX__ || __SSE__ || __amd64__
+ #ifdef __arm__
+ #define BEAST_ARM 1
+ #else
+ #define BEAST_INTEL 1
+ #endif
+ #endif
+#endif
+
+//==============================================================================
+// Compiler type macros.
+
+#ifdef __clang__
+ #define BEAST_CLANG 1
+ #define BEAST_GCC 1
+#elif defined (__GNUC__)
+ #define BEAST_GCC 1
+#elif defined (_MSC_VER)
+ #define BEAST_MSVC 1
+
+ #if _MSC_VER < 1500
+ #define BEAST_VC8_OR_EARLIER 1
+
+ #if _MSC_VER < 1400
+ #define BEAST_VC7_OR_EARLIER 1
+
+ #if _MSC_VER < 1300
+ #warning "MSVC 6.0 is no longer supported!"
+ #endif
+ #endif
+ #endif
+
+ #if BEAST_64BIT || ! BEAST_VC7_OR_EARLIER
+ #define BEAST_USE_INTRINSICS 1
+ #endif
+#else
+ #error unknown compiler
+#endif
+
+//------------------------------------------------------------------------------
+
+// Handy macro that lets pragma warnings be clicked in the output window
+//
+// Usage: #pragma message(BEAST_FILEANDLINE_ "Advertise here!")
+//
+// Note that a space following the macro is mandatory for C++11.
+//
+// This is here so it can be used in C compilations that include this directly.
+//
+#define BEAST_PP_STR2_(x) #x
+#define BEAST_PP_STR1_(x) BEAST_PP_STR2_(x)
+#define BEAST_FILEANDLINE_ __FILE__ "(" BEAST_PP_STR1_(__LINE__) "): warning:"
+
+#endif
+
diff --git a/src/beast/modules/beast_core/system/StandardHeader.h b/src/beast/beast/config/StandardConfig.h
similarity index 65%
rename from src/beast/modules/beast_core/system/StandardHeader.h
rename to src/beast/beast/config/StandardConfig.h
index 4172ed1c2d..6f2a67c875 100644
--- a/src/beast/modules/beast_core/system/StandardHeader.h
+++ b/src/beast/beast/config/StandardConfig.h
@@ -21,34 +21,11 @@
*/
//==============================================================================
-#ifndef BEAST_STANDARDHEADER_H_INCLUDED
-#define BEAST_STANDARDHEADER_H_INCLUDED
+#ifndef BEAST_CONFIG_STANDARDCONFIG_H_INCLUDED
+#define BEAST_CONFIG_STANDARDCONFIG_H_INCLUDED
-//------------------------------------------------------------------------------
-
-/** Current BEAST version number.
-
- See also SystemStats::getBeastVersion() for a string version.
-*/
-// VFALCO TODO Replace this with SemanticVerson
-#define BEAST_MAJOR_VERSION 1
-#define BEAST_MINOR_VERSION 0
-#define BEAST_BUILDNUMBER 0
-
-/** Current Beast version number.
-
- Bits 16 to 32 = major version.
- Bits 8 to 16 = minor version.
- Bits 0 to 8 = point release.
-
- See also SystemStats::getBeastVersion() for a string version.
-*/
-#define BEAST_VERSION ((BEAST_MAJOR_VERSION << 16) + (BEAST_MINOR_VERSION << 8) + BEAST_BUILDNUMBER)
-
-//------------------------------------------------------------------------------
-
-#ifndef BEAST_CORE_PLATFORMDEFS_H_INCLUDED
-#error "PlatformDefs.h must be included first"
+#ifndef BEAST_CONFIG_COMPILERCONFIG_H_INCLUDED
+#error "CompilerConfig.h must be included first"
#endif
// Now we'll include some common OS headers..
@@ -57,45 +34,6 @@
#pragma warning (disable: 4514 4245 4100)
#endif
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include