mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 11:05:54 +00:00
Add compilation test script
This commit is contained in:
@@ -24,7 +24,11 @@
|
||||
#ifndef BEAST_ARITHMETIC_H_INCLUDED
|
||||
#define BEAST_ARITHMETIC_H_INCLUDED
|
||||
|
||||
#include "Config.h"
|
||||
#include "CStdInt.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
|
||||
namespace beast {
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#define BEAST_ATOMIC_H_INCLUDED
|
||||
|
||||
#include "Config.h"
|
||||
#include "CStdInt.h"
|
||||
#include "StaticAssert.h"
|
||||
|
||||
namespace beast {
|
||||
@@ -69,13 +70,16 @@ public:
|
||||
Type get() const noexcept;
|
||||
|
||||
/** Copies another value onto this one (atomically). */
|
||||
inline Atomic& operator= (const Atomic& other) noexcept { exchange (other.get()); return *this; }
|
||||
Atomic& operator= (const Atomic& other) noexcept
|
||||
{ exchange (other.get()); return *this; }
|
||||
|
||||
/** Copies another value onto this one (atomically). */
|
||||
inline Atomic& operator= (const Type newValue) noexcept { exchange (newValue); return *this; }
|
||||
Atomic& operator= (const Type newValue) noexcept
|
||||
{ exchange (newValue); return *this; }
|
||||
|
||||
/** Atomically sets the current value. */
|
||||
void set (Type newValue) noexcept { exchange (newValue); }
|
||||
void set (Type newValue) noexcept
|
||||
{ exchange (newValue); }
|
||||
|
||||
/** Atomically sets the current value, returning the value that was replaced. */
|
||||
Type exchange (Type value) noexcept;
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#ifndef BEAST_BYTEORDER_H_INCLUDED
|
||||
#define BEAST_BYTEORDER_H_INCLUDED
|
||||
|
||||
#include "Config.h"
|
||||
#include "CStdInt.h"
|
||||
#include "Uncopyable.h"
|
||||
|
||||
namespace beast {
|
||||
|
||||
@@ -26,8 +26,7 @@
|
||||
|
||||
#include "Config.h"
|
||||
|
||||
namespace beast
|
||||
{
|
||||
namespace beast {
|
||||
|
||||
typedef signed char int8;
|
||||
typedef signed short int16;
|
||||
|
||||
@@ -32,4 +32,6 @@
|
||||
#include "config/StandardConfig.h"
|
||||
#include "config/ConfigCheck.h"
|
||||
|
||||
#include "config/Suffix.h"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#ifndef BEAST_CRYPTO_H_INCLUDED
|
||||
#define BEAST_CRYPTO_H_INCLUDED
|
||||
|
||||
#include "crypto/api/Sha256.h"
|
||||
#include "crypto/Sha256.h"
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -24,6 +24,10 @@
|
||||
#ifndef BEAST_HEAPBLOCK_H_INCLUDED
|
||||
#define BEAST_HEAPBLOCK_H_INCLUDED
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "Memory.h"
|
||||
#include "Uncopyable.h"
|
||||
|
||||
|
||||
@@ -24,15 +24,21 @@
|
||||
#ifndef BEAST_MEMORY_H_INCLUDED
|
||||
#define BEAST_MEMORY_H_INCLUDED
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "Config.h"
|
||||
|
||||
namespace beast {
|
||||
|
||||
//==============================================================================
|
||||
/** Fills a block of memory with zeros. */
|
||||
inline void zeromem (void* memory, size_t numBytes) noexcept { memset (memory, 0, numBytes); }
|
||||
inline void zeromem (void* memory, size_t numBytes) noexcept
|
||||
{ memset (memory, 0, numBytes); }
|
||||
|
||||
/** Overwrites a structure or object with zeros. */
|
||||
template <typename Type>
|
||||
inline void zerostruct (Type& structure) noexcept { memset (&structure, 0, sizeof (structure)); }
|
||||
void zerostruct (Type& structure) noexcept
|
||||
{ memset (&structure, 0, sizeof (structure)); }
|
||||
|
||||
/** Delete an object pointer, and sets the pointer to null.
|
||||
|
||||
@@ -40,26 +46,30 @@ inline void zerostruct (Type& structure) noexcept { memset (&s
|
||||
or other automatic lifetime-management system rather than resorting to deleting raw pointers!
|
||||
*/
|
||||
template <typename Type>
|
||||
inline void deleteAndZero (Type& pointer) { delete pointer; pointer = nullptr; }
|
||||
void deleteAndZero (Type& pointer)
|
||||
{ delete pointer; pointer = nullptr; }
|
||||
|
||||
/** A handy function which adds a number of bytes to any type of pointer and returns the result.
|
||||
This can be useful to avoid casting pointers to a char* and back when you want to move them by
|
||||
a specific number of bytes,
|
||||
*/
|
||||
template <typename Type, typename IntegerType>
|
||||
inline Type* addBytesToPointer (Type* pointer, IntegerType bytes) noexcept { return (Type*) (((char*) pointer) + bytes); }
|
||||
Type* addBytesToPointer (Type* pointer, IntegerType bytes) noexcept
|
||||
{ return (Type*) (((char*) pointer) + bytes); }
|
||||
|
||||
/** A handy function which returns the difference between any two pointers, in bytes.
|
||||
The address of the second pointer is subtracted from the first, and the difference in bytes is returned.
|
||||
*/
|
||||
template <typename Type1, typename Type2>
|
||||
inline int getAddressDifference (Type1* pointer1, Type2* pointer2) noexcept { return (int) (((const char*) pointer1) - (const char*) pointer2); }
|
||||
int getAddressDifference (Type1* pointer1, Type2* pointer2) noexcept
|
||||
{ return (int) (((const char*) pointer1) - (const char*) pointer2); }
|
||||
|
||||
/** If a pointer is non-null, this returns a new copy of the object that it points to, or safely returns
|
||||
nullptr if the pointer is null.
|
||||
*/
|
||||
template <class Type>
|
||||
inline Type* createCopyIfNotNull (const Type* pointer) { return pointer != nullptr ? new Type (*pointer) : nullptr; }
|
||||
Type* createCopyIfNotNull (const Type* pointer)
|
||||
{ return pointer != nullptr ? new Type (*pointer) : nullptr; }
|
||||
|
||||
//==============================================================================
|
||||
#if BEAST_MAC || BEAST_IOS || DOXYGEN
|
||||
|
||||
25
beast/config/Suffix.h
Normal file
25
beast/config/Suffix.h
Normal file
@@ -0,0 +1,25 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.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_SUFFIX_H_INCLUDED
|
||||
#define BEAST_CONFIG_SUFFIX_H_INCLUDED
|
||||
|
||||
// Included at the end of Config.h
|
||||
|
||||
#endif
|
||||
@@ -19,7 +19,4 @@
|
||||
|
||||
#include "BeastConfig.h"
|
||||
|
||||
#include "../CStdInt.h"
|
||||
#include "../config/PlatformConfig.h"
|
||||
|
||||
#include "impl/Sha256.cpp"
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_CRYPTO_Sha256_H_INCLUDED
|
||||
#define BEAST_CRYPTO_Sha256_H_INCLUDED
|
||||
#ifndef BEAST_CRYPTO_SHA256_H_INCLUDED
|
||||
#define BEAST_CRYPTO_SHA256_H_INCLUDED
|
||||
|
||||
#include "../config/PlatformConfig.h"
|
||||
#include "../Config.h"
|
||||
#include "../CStdInt.h"
|
||||
#include "../FixedArray.h"
|
||||
|
||||
|
||||
@@ -39,9 +39,6 @@ namespace Sha256 {
|
||||
//#define SHA2_USE_INTTYPES_H
|
||||
|
||||
namespace detail {
|
||||
typedef uint8 u_int8_t;
|
||||
typedef uint32 u_int32_t;
|
||||
typedef uint64 u_int64_t;
|
||||
#include "sha2/sha2.c"
|
||||
}
|
||||
|
||||
|
||||
@@ -103,9 +103,9 @@
|
||||
* types and pointing out recent ANSI C support for uintXX_t in inttypes.h.
|
||||
*/
|
||||
|
||||
typedef u_int8_t sha2_byte; /* Exactly 1 byte */
|
||||
typedef u_int32_t sha2_word32; /* Exactly 4 bytes */
|
||||
typedef u_int64_t sha2_word64; /* Exactly 8 bytes */
|
||||
typedef uint8 sha2_byte; /* Exactly 1 byte */
|
||||
typedef uint32 sha2_word32; /* Exactly 4 bytes */
|
||||
typedef uint64 sha2_word64; /* Exactly 8 bytes */
|
||||
|
||||
/*** SHA-256/384/512 Various Length Definitions ***********************/
|
||||
/* NOTE: Most of these are in sha2.h */
|
||||
|
||||
@@ -49,36 +49,18 @@
|
||||
|
||||
/*** SHA-256/384/512 Various Length Definitions ***********************/
|
||||
#define SHA256_DIGEST_STRING_LENGTH (Sha256::digestLength * 2 + 1)
|
||||
#define SHA384_BLOCK_LENGTH 128
|
||||
#define SHA384_DIGEST_LENGTH 48
|
||||
#define SHA384_BLOCK_LENGTH 128
|
||||
#define SHA384_DIGEST_LENGTH 48
|
||||
#define SHA384_DIGEST_STRING_LENGTH (SHA384_DIGEST_LENGTH * 2 + 1)
|
||||
#define SHA512_BLOCK_LENGTH 128
|
||||
#define SHA512_DIGEST_LENGTH 64
|
||||
#define SHA512_BLOCK_LENGTH 128
|
||||
#define SHA512_DIGEST_LENGTH 64
|
||||
#define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1)
|
||||
|
||||
/*** SHA-256/384/512 Context Structures *******************************/
|
||||
/* NOTE: If your architecture does not define either u_intXX_t types or
|
||||
* uintXX_t (from inttypes.h), you may need to define things by hand
|
||||
* for your system:
|
||||
*/
|
||||
#if 0
|
||||
typedef unsigned char u_int8_t; /* 1-byte (8-bits) */
|
||||
typedef unsigned int u_int32_t; /* 4-bytes (32-bits) */
|
||||
typedef unsigned long long u_int64_t; /* 8-bytes (64-bits) */
|
||||
#endif
|
||||
/*
|
||||
* Most BSD systems already define u_intXX_t types, as does Linux.
|
||||
* Some systems, however, like Compaq's Tru64 Unix instead can use
|
||||
* uintXX_t types defined by very recent ANSI C standards and included
|
||||
* in the file:
|
||||
*
|
||||
* #include <inttypes.h>
|
||||
*
|
||||
*/
|
||||
typedef struct _SHA512_CTX {
|
||||
u_int64_t state[8];
|
||||
u_int64_t bitcount[2];
|
||||
u_int8_t buffer[SHA512_BLOCK_LENGTH];
|
||||
uint64 state[8];
|
||||
uint64 bitcount[2];
|
||||
uint8 buffer[SHA512_BLOCK_LENGTH];
|
||||
} SHA512_CTX;
|
||||
|
||||
typedef SHA512_CTX SHA384_CTX;
|
||||
@@ -88,22 +70,22 @@ typedef SHA512_CTX SHA384_CTX;
|
||||
#ifndef NOPROTO
|
||||
|
||||
void SHA256_Init(Sha256::detail::Context *);
|
||||
void SHA256_Update(Sha256::detail::Context*, const u_int8_t*, size_t);
|
||||
void SHA256_Final(u_int8_t[Sha256::digestLength], Sha256::detail::Context*);
|
||||
void SHA256_Update(Sha256::detail::Context*, const uint8*, size_t);
|
||||
void SHA256_Final(uint8[Sha256::digestLength], Sha256::detail::Context*);
|
||||
char* SHA256_End(Sha256::detail::Context*, char[SHA256_DIGEST_STRING_LENGTH]);
|
||||
char* SHA256_Data(const u_int8_t*, size_t, char[SHA256_DIGEST_STRING_LENGTH]);
|
||||
char* SHA256_Data(const uint8*, size_t, char[SHA256_DIGEST_STRING_LENGTH]);
|
||||
|
||||
void SHA384_Init(SHA384_CTX*);
|
||||
void SHA384_Update(SHA384_CTX*, const u_int8_t*, size_t);
|
||||
void SHA384_Final(u_int8_t[SHA384_DIGEST_LENGTH], SHA384_CTX*);
|
||||
void SHA384_Update(SHA384_CTX*, const uint8*, size_t);
|
||||
void SHA384_Final(uint8[SHA384_DIGEST_LENGTH], SHA384_CTX*);
|
||||
char* SHA384_End(SHA384_CTX*, char[SHA384_DIGEST_STRING_LENGTH]);
|
||||
char* SHA384_Data(const u_int8_t*, size_t, char[SHA384_DIGEST_STRING_LENGTH]);
|
||||
char* SHA384_Data(const uint8*, size_t, char[SHA384_DIGEST_STRING_LENGTH]);
|
||||
|
||||
void SHA512_Init(SHA512_CTX*);
|
||||
void SHA512_Update(SHA512_CTX*, const u_int8_t*, size_t);
|
||||
void SHA512_Final(u_int8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*);
|
||||
void SHA512_Update(SHA512_CTX*, const uint8*, size_t);
|
||||
void SHA512_Final(uint8[SHA512_DIGEST_LENGTH], SHA512_CTX*);
|
||||
char* SHA512_End(SHA512_CTX*, char[SHA512_DIGEST_STRING_LENGTH]);
|
||||
char* SHA512_Data(const u_int8_t*, size_t, char[SHA512_DIGEST_STRING_LENGTH]);
|
||||
char* SHA512_Data(const uint8*, size_t, char[SHA512_DIGEST_STRING_LENGTH]);
|
||||
|
||||
#else /* NOPROTO */
|
||||
|
||||
|
||||
@@ -20,10 +20,14 @@
|
||||
#ifndef BEAST_INTRUSIVE_FORWARDLIST_H_INCLUDED
|
||||
#define BEAST_INTRUSIVE_FORWARDLIST_H_INCLUDED
|
||||
|
||||
#include <iterator>
|
||||
#include "../Config.h"
|
||||
|
||||
#include "PointerTraits.h"
|
||||
|
||||
#include "../MPL.h"
|
||||
|
||||
#include <iterator>
|
||||
|
||||
// Ideas based on boost
|
||||
|
||||
namespace beast {
|
||||
|
||||
@@ -20,184 +20,16 @@
|
||||
#ifndef BEAST_INTRUSIVE_LIST_H_INCLUDED
|
||||
#define BEAST_INTRUSIVE_LIST_H_INCLUDED
|
||||
|
||||
#include <iterator>
|
||||
#include "../Config.h"
|
||||
|
||||
#include "../mpl/CopyConst.h"
|
||||
|
||||
#include "../Uncopyable.h"
|
||||
|
||||
#include <iterator>
|
||||
|
||||
namespace beast {
|
||||
|
||||
/** Intrusive Containers
|
||||
|
||||
# Introduction
|
||||
|
||||
Intrusive containers are special containers that offer better performance
|
||||
and exception safety guarantees than non-intrusive containers (like the
|
||||
STL containers). They are useful building blocks for high performance
|
||||
concurrent systems or other purposes where allocations are restricted
|
||||
(such as the AudioIODeviceCallback object), because intrusive list
|
||||
operations do not allocate or free memory.
|
||||
|
||||
While intrusive containers were and are widely used in C, they became more
|
||||
and more forgotten in C++ due to the presence of the standard containers
|
||||
which don't support intrusive techniques. VFLib not only reintroduces this
|
||||
technique to C++ for lists, it also encapsulates the implementation in a
|
||||
mostly compliant STL interface. Hence anyone familiar with standard
|
||||
containers can easily use them.
|
||||
|
||||
# Interface
|
||||
|
||||
The interface for intrusive elements in this library is unified for all
|
||||
containers. Unlike STL containers, objects placed into intrusive containers
|
||||
are not copied. Instead, a pointer to the object is stored. All
|
||||
responsibility for object lifetime is the responsibility of the caller;
|
||||
the intrusive container just keeps track of what is in it.
|
||||
|
||||
Summary of intrusive container differences:
|
||||
|
||||
- Holds pointers to existing objects instead of copies.
|
||||
|
||||
- Does not allocate or free any objects.
|
||||
|
||||
- Requires a element's class declaration to be modified.
|
||||
|
||||
- Methods never throw exceptions when called with valid arguments.
|
||||
|
||||
# Usage
|
||||
|
||||
Like STL containers, intrusive containers are all template based, where the
|
||||
template argument specifies the type of object that the container will hold.
|
||||
These declarations specify a doubly linked list where each element points
|
||||
to a user defined class:
|
||||
|
||||
@code
|
||||
|
||||
struct Object; // Forward declaration
|
||||
|
||||
List <Object> list; // Doubly-linked list of Object
|
||||
|
||||
@endcode
|
||||
|
||||
Because intrusive containers allocate no memory, allowing objects to be
|
||||
placed inside requires a modification to their class declaration. Each
|
||||
intrusive container declares a nested class `Node` which elements must be
|
||||
derived from, using the Curiously Recurring Template Pattern (CRTP). We
|
||||
will continue to fully declare the Object type from the previous example
|
||||
to support emplacement into an intrusive container:
|
||||
|
||||
@code
|
||||
|
||||
struct Object : public List <Object>::Node // Required for List
|
||||
{
|
||||
void performAction ();
|
||||
};
|
||||
|
||||
@endcode
|
||||
|
||||
Usage of a typedef eliminates redundant specification of the template
|
||||
arguments but requires a forward declaration. The following code is
|
||||
equivalent.
|
||||
|
||||
@code
|
||||
|
||||
struct Object; // Forward declaration
|
||||
|
||||
// Specify template parameters just once
|
||||
typedef List <Object> ListType;
|
||||
|
||||
struct Object : public ListType::Node
|
||||
{
|
||||
void performAction ();
|
||||
};
|
||||
|
||||
ListType::Node list;
|
||||
|
||||
@endcode
|
||||
|
||||
With these declarations we may proceed to create our objects, add them to
|
||||
the list, and perform operations:
|
||||
|
||||
@code
|
||||
|
||||
// Create a few objects and put them in the list
|
||||
for (i = 0; i < 5; ++i)
|
||||
list.push_back (*new Object);
|
||||
|
||||
// Call a method on each list
|
||||
for (ListType::iterator iter = list.begin(); iter != list.end (); ++iter)
|
||||
iter->performAction ();
|
||||
|
||||
@endcode
|
||||
|
||||
Unlike regular STL containers, an object derived from an intrusive container
|
||||
node cannot exist in more than one instance of that list at a time. This is
|
||||
because the bookkeeping information for maintaining the list is kept in
|
||||
the object rather than the list.
|
||||
|
||||
To support objects existing in multiple containers, templates variations
|
||||
are instantiated by distinguishing them with an empty structure, called a
|
||||
tag. The object is derived from multiple instances of Node, where each
|
||||
instance specifies a unique tag. The tag is passed as the second template
|
||||
argument. When the second argument is unspecified, the default tag is used.
|
||||
|
||||
This declaration example shows the usage of tags to allow an object to exist
|
||||
simultaneously in two separate lists:
|
||||
|
||||
@code
|
||||
|
||||
struct GlobalListTag { }; // list of all objects
|
||||
struct ActiveListTag { }; // subset of all objects that are active
|
||||
|
||||
class Object : public List <Object, GlobalListTag>
|
||||
, public List <Object, ActiveListTag>
|
||||
{
|
||||
public:
|
||||
Object () : m_isActive (false)
|
||||
{
|
||||
// Add ourselves to the global list
|
||||
s_globalList.push_front (*this);
|
||||
}
|
||||
|
||||
~Object ()
|
||||
{
|
||||
deactivate ();
|
||||
}
|
||||
|
||||
void becomeActive ()
|
||||
{
|
||||
// Add ourselves to the active list
|
||||
if (!m_isActive)
|
||||
{
|
||||
s_activeList.push_front (*this);
|
||||
m_isActive = true;
|
||||
}
|
||||
}
|
||||
|
||||
void deactivate ()
|
||||
{
|
||||
if (m_isActive)
|
||||
{
|
||||
// Doesn't delete the object
|
||||
s_activeList.erase (s_activeList.iterator_to (this));
|
||||
|
||||
m_isActive = false;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
bool m_isActive;
|
||||
|
||||
static List <Object, GlobalListTag> s_globalList;
|
||||
static List <Object, ActiveListTag> s_activeList;
|
||||
}
|
||||
|
||||
@endcode
|
||||
|
||||
@defgroup intrusive intrusive
|
||||
@ingroup beast_core
|
||||
*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template <typename, typename>
|
||||
class List;
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#ifndef BEAST_INTRUSIVE_POINTERTRAITS_H_INCLUDED
|
||||
#define BEAST_INTRUSIVE_POINTERTRAITS_H_INCLUDED
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
namespace beast {
|
||||
namespace intrusive {
|
||||
|
||||
|
||||
@@ -24,6 +24,13 @@
|
||||
#ifndef BEAST_CHARPOINTER_ASCII_H_INCLUDED
|
||||
#define BEAST_CHARPOINTER_ASCII_H_INCLUDED
|
||||
|
||||
#include "../Config.h"
|
||||
|
||||
#include "CharacterFunctions.h"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
namespace beast {
|
||||
|
||||
//==============================================================================
|
||||
|
||||
@@ -24,6 +24,12 @@
|
||||
#ifndef BEAST_CHARPOINTER_UTF16_H_INCLUDED
|
||||
#define BEAST_CHARPOINTER_UTF16_H_INCLUDED
|
||||
|
||||
#include "../Config.h"
|
||||
#include "../Atomic.h"
|
||||
#include "../CStdInt.h"
|
||||
|
||||
#include "CharacterFunctions.h"
|
||||
|
||||
namespace beast {
|
||||
|
||||
//==============================================================================
|
||||
|
||||
@@ -24,6 +24,13 @@
|
||||
#ifndef BEAST_CHARPOINTER_UTF32_H_INCLUDED
|
||||
#define BEAST_CHARPOINTER_UTF32_H_INCLUDED
|
||||
|
||||
#include "../Config.h"
|
||||
#include "../Atomic.h"
|
||||
|
||||
#include "CharacterFunctions.h"
|
||||
|
||||
#include <cwchar>
|
||||
|
||||
namespace beast {
|
||||
|
||||
//==============================================================================
|
||||
|
||||
@@ -24,10 +24,14 @@
|
||||
#ifndef BEAST_CHARPOINTER_UTF8_H_INCLUDED
|
||||
#define BEAST_CHARPOINTER_UTF8_H_INCLUDED
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "../Config.h"
|
||||
#include "../Atomic.h"
|
||||
|
||||
#include "CharacterFunctions.h"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
namespace beast {
|
||||
|
||||
//==============================================================================
|
||||
|
||||
@@ -24,8 +24,11 @@
|
||||
#ifndef BEAST_STRINGS_CHARACTERFUNCTIONS_H_INCLUDED
|
||||
#define BEAST_STRINGS_CHARACTERFUNCTIONS_H_INCLUDED
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include "../Config.h"
|
||||
#include "../CStdInt.h"
|
||||
#include "../Memory.h"
|
||||
|
||||
namespace beast {
|
||||
|
||||
@@ -329,8 +332,11 @@ public:
|
||||
static size_t copyWithDestByteLimit (DestCharPointerType& dest, SrcCharPointerType src, size_t maxBytesToWrite) noexcept
|
||||
{
|
||||
typename DestCharPointerType::CharType const* const startAddress = dest.getAddress();
|
||||
ssize_t maxBytes = (ssize_t) maxBytesToWrite;
|
||||
maxBytes -= sizeof (typename DestCharPointerType::CharType); // (allow for a terminating null)
|
||||
size_t maxBytes = maxBytesToWrite;
|
||||
if (maxBytes >= sizeof (typename DestCharPointerType::CharType))
|
||||
maxBytes -= sizeof (typename DestCharPointerType::CharType); // (allow for a terminating null)
|
||||
else
|
||||
maxBytes = 0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
|
||||
@@ -21,11 +21,13 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_NEWLINE_H_INCLUDED
|
||||
#define BEAST_NEWLINE_H_INCLUDED
|
||||
#ifndef BEAST_STRINGS_NEWLINE_H_INCLUDED
|
||||
#define BEAST_STRINGS_NEWLINE_H_INCLUDED
|
||||
|
||||
#include "../Config.h"
|
||||
|
||||
#include "String.h"
|
||||
|
||||
namespace beast {
|
||||
|
||||
//==============================================================================
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
|
||||
#include "../Config.h"
|
||||
#include "../CStdInt.h"
|
||||
#include "../Memory.h"
|
||||
|
||||
#include "CharacterFunctions.h"
|
||||
#if BEAST_MSVC
|
||||
# pragma warning (push)
|
||||
|
||||
@@ -24,6 +24,11 @@
|
||||
#ifndef BEAST_STRINGS_STRINGCHARPOINTERTYPE_H_INCLUDED
|
||||
#define BEAST_STRINGS_STRINGCHARPOINTERTYPE_H_INCLUDED
|
||||
|
||||
#include "../Config.h"
|
||||
#include "CharPointer_UTF8.h"
|
||||
#include "CharPointer_UTF16.h"
|
||||
#include "CharPointer_UTF32.h"
|
||||
|
||||
namespace beast {
|
||||
|
||||
/** This is the character encoding type used internally to store the string.
|
||||
|
||||
@@ -24,8 +24,15 @@
|
||||
#ifndef BEAST_STRINGS_STRINGFROMNUMBER_H_INCLUDED
|
||||
#define BEAST_STRINGS_STRINGFROMNUMBER_H_INCLUDED
|
||||
|
||||
#include "../Config.h"
|
||||
#include "../Arithmetic.h"
|
||||
|
||||
#include "StringCharPointerType.h"
|
||||
|
||||
#include <limits>
|
||||
#include <ostream>
|
||||
#include <streambuf>
|
||||
|
||||
namespace beast {
|
||||
|
||||
// VFALCO TODO Put this in namespace detail
|
||||
|
||||
@@ -21,10 +21,11 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <cctype>
|
||||
|
||||
#include "../CharacterFunctions.h"
|
||||
|
||||
#include <cctype>
|
||||
#include <cwctype>
|
||||
|
||||
namespace beast {
|
||||
|
||||
#if BEAST_MSVC
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#ifndef BEAST_THREAD_SHAREDDATA_H_INCLUDED
|
||||
#define BEAST_THREAD_SHAREDDATA_H_INCLUDED
|
||||
|
||||
#include "SharedMutexAdapter.h"
|
||||
|
||||
namespace beast
|
||||
{
|
||||
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
#ifndef BEAST_THREAD_SHAREDMUTEXADAPTER_H_INCLUDED
|
||||
#define BEAST_THREAD_SHAREDMUTEXADAPTER_H_INCLUDED
|
||||
|
||||
#include "LockGuard.h"
|
||||
#include "SharedLockGuard.h"
|
||||
|
||||
namespace beast
|
||||
{
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#ifndef BEAST_TYPE_TRAITS_ISINTEGRAL_H_INCLUDED
|
||||
#define BEAST_TYPE_TRAITS_ISINTEGRAL_H_INCLUDED
|
||||
|
||||
#include "../CStdInt.h"
|
||||
#include "IntegralConstant.h"
|
||||
|
||||
namespace beast {
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#define BEAST_TYPE_TRAITS_ISSIGNED_H_INCLUDED
|
||||
|
||||
#include "IntegralConstant.h"
|
||||
#include "../CStdInt.h"
|
||||
|
||||
namespace beast {
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#define BEAST_TYPE_TRAITS_REMOVESIGNED_H_INCLUDED
|
||||
|
||||
#include "IntegralConstant.h"
|
||||
#include "../CStdInt.h"
|
||||
|
||||
namespace beast {
|
||||
|
||||
|
||||
154
scripts/BeastConfig.h
Normal file
154
scripts/BeastConfig.h
Normal file
@@ -0,0 +1,154 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.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_BEASTCONFIG_H_INCLUDED
|
||||
#define BEAST_BEASTCONFIG_H_INCLUDED
|
||||
|
||||
/** Configuration file for Beast.
|
||||
This sets various configurable options for Beast. In order to compile you
|
||||
must place a copy of this file in a location where your build environment
|
||||
can find it, and then customize its contents to suit your needs.
|
||||
@file BeastConfig.h
|
||||
*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// Diagnostics
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** Config: BEAST_FORCE_DEBUG
|
||||
Normally, BEAST_DEBUG is set to 1 or 0 based on compiler and project
|
||||
settings, but if you define this value, you can override this to force it
|
||||
to be true or false.
|
||||
*/
|
||||
#ifndef BEAST_FORCE_DEBUG
|
||||
//#define BEAST_FORCE_DEBUG 1
|
||||
#endif
|
||||
|
||||
/** Config: BEAST_LOG_ASSERTIONS
|
||||
If this flag is enabled, the the bassert and bassertfalse macros will always
|
||||
use Logger::writeToLog() to write a message when an assertion happens.
|
||||
Enabling it will also leave this turned on in release builds. When it's
|
||||
disabled, however, the bassert and bassertfalse macros will not be compiled
|
||||
in a release build.
|
||||
@see bassert, bassertfalse, Logger
|
||||
*/
|
||||
#ifndef BEAST_LOG_ASSERTIONS
|
||||
//#define BEAST_LOG_ASSERTIONS 1
|
||||
#endif
|
||||
|
||||
/** Config: BEAST_CHECK_MEMORY_LEAKS
|
||||
Enables a memory-leak check for certain objects when the app terminates.
|
||||
See the LeakChecked class for more details about enabling leak checking for
|
||||
specific classes.
|
||||
*/
|
||||
#ifndef BEAST_CHECK_MEMORY_LEAKS
|
||||
//#define BEAST_CHECK_MEMORY_LEAKS 0
|
||||
#endif
|
||||
|
||||
/** Config: BEAST_COMPILER_CHECKS_SOCKET_OVERRIDES
|
||||
Setting this option makes Socket-derived classes generate compile errors
|
||||
if they forget any of the virtual overrides As some Socket-derived classes
|
||||
intentionally omit member functions that are not applicable, this macro
|
||||
should only be enabled temporarily when writing your own Socket-derived
|
||||
class, to make sure that the function signatures match as expected.
|
||||
*/
|
||||
#ifndef BEAST_COMPILER_CHECKS_SOCKET_OVERRIDES
|
||||
//#define BEAST_COMPILER_CHECKS_SOCKET_OVERRIDES 1
|
||||
#endif
|
||||
|
||||
/** Config: BEAST_CATCH_UNHANDLED_EXCEPTIONS
|
||||
This will wrap thread entry points with an exception catching block.
|
||||
A customizable hook is provided to get called when unhandled exceptions
|
||||
are thrown.
|
||||
@see ProtectedCall
|
||||
*/
|
||||
#ifndef BEAST_CATCH_UNHANDLED_EXCEPTIONS
|
||||
//#define BEAST_CATCH_UNHANDLED_EXCEPTIONS 1
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// Libraries
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** Config: BEAST_DONT_AUTOLINK_TO_WIN32_LIBRARIES
|
||||
In a Visual C++ build, this can be used to stop the required system libs
|
||||
being automatically added to the link stage.
|
||||
*/
|
||||
#ifndef BEAST_DONT_AUTOLINK_TO_WIN32_LIBRARIES
|
||||
//#define BEAST_DONT_AUTOLINK_TO_WIN32_LIBRARIES 1
|
||||
#endif
|
||||
|
||||
/** Config: BEAST_INCLUDE_ZLIB_CODE
|
||||
This can be used to disable Beast's embedded 3rd-party zlib code.
|
||||
You might need to tweak this if you're linking to an external zlib library
|
||||
in your app, but for normal apps, this option should be left alone.
|
||||
|
||||
If you disable this, you might also want to set a value for
|
||||
BEAST_ZLIB_INCLUDE_PATH, to specify the path where your zlib headers live.
|
||||
*/
|
||||
#ifndef BEAST_INCLUDE_ZLIB_CODE
|
||||
//#define BEAST_INCLUDE_ZLIB_CODE 1
|
||||
#endif
|
||||
|
||||
/** Config: BEAST_ZLIB_INCLUDE_PATH
|
||||
This is included when BEAST_INCLUDE_ZLIB_CODE is set to zero.
|
||||
*/
|
||||
#ifndef BEAST_ZLIB_INCLUDE_PATH
|
||||
#define BEAST_ZLIB_INCLUDE_PATH <zlib.h>
|
||||
#endif
|
||||
|
||||
/** Config: BEAST_FUNCTIONAL_USES_###
|
||||
<functional> source configuration.
|
||||
Set one of these to manually force a particular implementation of bind().
|
||||
If nothing is chosen then beast will use whatever is appropriate for your
|
||||
environment based on what is available.
|
||||
If you override these, set ONE to 1 and the rest to 0
|
||||
*/
|
||||
#ifndef BEAST_FUNCTIONAL_USES_STD
|
||||
//#define BEAST_FUNCTIONAL_USES_STD 0
|
||||
#endif
|
||||
#ifndef BEAST_FUNCTIONAL_USES_TR1
|
||||
//#define BEAST_FUNCTIONAL_USES_TR1 0
|
||||
#endif
|
||||
#ifndef BEAST_FUNCTIONAL_USES_BOOST
|
||||
//#define BEAST_FUNCTIONAL_USES_BOOST 0
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// Boost
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** Config: BEAST_USE_BOOST_FEATURES
|
||||
This activates boost specific features and improvements. If this is
|
||||
turned on, the include paths for your build environment must be set
|
||||
correctly to find the boost headers.
|
||||
*/
|
||||
#ifndef BEAST_USE_BOOST_FEATURES
|
||||
//#define BEAST_USE_BOOST_FEATURES 1
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#endif
|
||||
29
scripts/compile.sh
Executable file
29
scripts/compile.sh
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This script makes sure that every directly includable header
|
||||
# file compiles stand-alone for all supported platforms.
|
||||
#
|
||||
|
||||
for f in $1/*.h $1/*/*.h
|
||||
do
|
||||
{
|
||||
echo "Compilng '$f'"
|
||||
g++ -xc++ - -c -o /dev/null <<EOF
|
||||
#define BEAST_BEASTCONFIG_H_INCLUDED
|
||||
#include "$f"
|
||||
EOF
|
||||
g++ -xc++ -std=c++11 - -c -o /dev/null <<EOF
|
||||
#define BEAST_BEASTCONFIG_H_INCLUDED
|
||||
#include "$f"
|
||||
EOF
|
||||
}
|
||||
done
|
||||
|
||||
for f in $1/*/*.cpp
|
||||
do
|
||||
{
|
||||
echo "Compilng '$f'"
|
||||
g++ -xc++ -I$1/../scripts/ "$f" -c -o /dev/null
|
||||
g++ -xc++ -std=c++11 -I$1/../scripts/ "$f" -c -o /dev/null
|
||||
}
|
||||
done
|
||||
Reference in New Issue
Block a user