Boost logo

Boost-Commit :

From: xushiweizh_at_[hidden]
Date: 2008-04-28 21:16:18


Author: xushiwei
Date: 2008-04-28 21:16:17 EDT (Mon, 28 Apr 2008)
New Revision: 44865
URL: http://svn.boost.org/trac/boost/changeset/44865

Log:
boost-memory version 1.0
Added:
   sandbox/memory/boost/memory.hpp (contents, props changed)
   sandbox/memory/boost/memory/auto_alloc.hpp (contents, props changed)
   sandbox/memory/boost/memory/basic.hpp (contents, props changed)
   sandbox/memory/boost/memory/config.hpp (contents, props changed)
   sandbox/memory/boost/memory/linklib.hpp (contents, props changed)
   sandbox/memory/boost/memory/scoped_alloc.hpp (contents, props changed)
   sandbox/memory/boost/memory/system_alloc.hpp (contents, props changed)
   sandbox/memory/boost/memory/thread/
   sandbox/memory/boost/memory/thread/tls.hpp (contents, props changed)
   sandbox/memory/boost/memory/threadmodel/
   sandbox/memory/boost/memory/threadmodel.hpp (contents, props changed)
   sandbox/memory/boost/memory/threadmodel/multi_thread.hpp (contents, props changed)
   sandbox/memory/boost/memory/threadmodel/single_thread.hpp (contents, props changed)
   sandbox/memory/boost/memory/winapi/
   sandbox/memory/boost/memory/winapi/posix/
   sandbox/memory/boost/memory/winapi/posix/pthread.hpp (contents, props changed)
   sandbox/memory/boost/memory/winapi/winbase.h (contents, props changed)
   sandbox/memory/boost/memory/winapi/windef.h (contents, props changed)
   sandbox/memory/boost/memory/winapi/wtypes.h (contents, props changed)

Added: sandbox/memory/boost/memory.hpp
==============================================================================
--- (empty file)
+++ sandbox/memory/boost/memory.hpp 2008-04-28 21:16:17 EDT (Mon, 28 Apr 2008)
@@ -0,0 +1,117 @@
+//
+// boost/memory.hpp
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// 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)
+//
+// See http://www.boost.org/libs/memory/index.htm for documentation.
+//
+#ifndef __BOOST_MEMORY_HPP__
+#define __BOOST_MEMORY_HPP__
+
+// -------------------------------------------------------------------------
+
+#ifndef __BOOST_MEMORY_AUTO_ALLOC_HPP__
+#include "memory/auto_alloc.hpp"
+#endif
+
+#ifndef __BOOST_MEMORY_SCOPED_ALLOC_HPP__
+#include "memory/scoped_alloc.hpp"
+#endif
+
+// -------------------------------------------------------------------------
+// class stl_alloc
+
+__NS_BOOST_BEGIN
+
+template <class _Ty, class _Alloc = scoped_alloc>
+class stl_alloc
+{
+private:
+ _Alloc* m_alloc;
+
+public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Ty* pointer;
+ typedef const _Ty* const_pointer;
+ typedef _Ty& reference;
+ typedef const _Ty& const_reference;
+ typedef _Ty value_type;
+
+ template <class U>
+ struct rebind { typedef stl_alloc<U, _Alloc> other; };
+
+public:
+ pointer address(reference val) const
+ { return &val; }
+ const_pointer address(const_reference val) const
+ { return &val; }
+
+ size_type max_size() const
+ { size_type count = (size_type)(-1) / sizeof (_Ty);
+ return (0 < count ? count : 1); }
+
+public:
+ stl_alloc(_Alloc& alloc) : m_alloc(&alloc) {}
+
+ template <class U>
+ stl_alloc(const stl_alloc<U, _Alloc>& rhs) : m_alloc(rhs._Getalloc()) {}
+
+ pointer allocate(size_type count, const void* = NULL)
+ { return (pointer)m_alloc->allocate(count * sizeof(_Ty)); }
+ void deallocate(void* p, size_type cb)
+ { m_alloc->deallocate(p, cb); }
+ void construct(pointer p, const _Ty& val)
+ { new(p) _Ty(val); }
+ void destroy(pointer p)
+ { p->~_Ty(); }
+
+public:
+ char* _Charalloc(size_type cb)
+ { return (char*)m_alloc->allocate(cb); }
+
+ _Alloc* _Getalloc() const { return m_alloc; }
+};
+
+template<> class stl_alloc<void, scoped_alloc>
+{
+ typedef void value_type;
+ typedef void* pointer;
+ typedef const void* const_pointer;
+
+ template <class U>
+ struct rebind { typedef stl_alloc<U, scoped_alloc> other; };
+};
+
+template<> class stl_alloc<void, auto_alloc>
+{
+ typedef void value_type;
+ typedef void* pointer;
+ typedef const void* const_pointer;
+
+ template <class U>
+ struct rebind { typedef stl_alloc<U, scoped_alloc> other; };
+};
+
+template <class _Ty, class _Alloc>
+inline bool operator==(const stl_alloc<_Ty, _Alloc>&,
+ const stl_alloc<_Ty, _Alloc>&) {
+ return true;
+}
+
+template <class _Ty, class _Alloc>
+inline bool operator!=(const stl_alloc<_Ty, _Alloc>&,
+ const stl_alloc<_Ty, _Alloc>&) {
+ return false;
+}
+
+__NS_BOOST_END
+
+// -------------------------------------------------------------------------
+// $Log: memory.hpp,v $
+
+#endif /* __BOOST_MEMORY_HPP__ */

Added: sandbox/memory/boost/memory/auto_alloc.hpp
==============================================================================
--- (empty file)
+++ sandbox/memory/boost/memory/auto_alloc.hpp 2008-04-28 21:16:17 EDT (Mon, 28 Apr 2008)
@@ -0,0 +1,207 @@
+//
+// boost/memory/auto_alloc.hpp
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// 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)
+//
+// See http://www.boost.org/libs/memory/index.htm for documentation.
+//
+#ifndef __BOOST_MEMORY_AUTO_ALLOC_HPP__
+#define __BOOST_MEMORY_AUTO_ALLOC_HPP__
+
+#ifndef __BOOST_MEMORY_SYSTEM_ALLOC_HPP__
+#include "system_alloc.hpp"
+#endif
+
+__NS_BOOST_BEGIN
+
+// -------------------------------------------------------------------------
+// class gc_alloc_imp
+
+template <class _Policy>
+class gc_alloc_imp
+{
+private:
+ typedef typename _Policy::allocator_type _Alloc;
+
+public:
+ enum { MemBlockSize = _Policy::MemBlockSize };
+ enum { HeaderSize = sizeof(void*) };
+ enum { BlockSize = MemBlockSize - HeaderSize };
+ enum { IsAutoFreeAllocator = 1 };
+
+ typedef _Alloc allocator_type;
+
+private:
+ struct _MemBlock
+ {
+ _MemBlock* pPrev;
+ char buffer[BlockSize];
+ };
+ struct _DestroyNode
+ {
+ _DestroyNode* pPrev;
+ destructor_t fnDestroy;
+ };
+
+ char* m_begin;
+ char* m_end;
+ _DestroyNode* m_destroyChain;
+ _Alloc m_alloc;
+
+private:
+ const gc_alloc_imp& operator=(const gc_alloc_imp&);
+
+ _MemBlock* BOOST_MEMORY_CALL _ChainHeader() const
+ {
+ return (_MemBlock*)(m_begin - HeaderSize);
+ }
+
+public:
+ gc_alloc_imp() : m_destroyChain(NULL)
+ {
+ m_begin = m_end = (char*)HeaderSize;
+ }
+ explicit gc_alloc_imp(_Alloc alloc) : m_alloc(alloc), m_destroyChain(NULL)
+ {
+ m_begin = m_end = (char*)HeaderSize;
+ }
+ explicit gc_alloc_imp(gc_alloc_imp& owner)
+ : m_alloc(owner.m_alloc), m_destroyChain(NULL)
+ {
+ m_begin = m_end = (char*)HeaderSize;
+ }
+
+ ~gc_alloc_imp()
+ {
+ clear();
+ }
+
+ void BOOST_MEMORY_CALL swap(gc_alloc_imp& o)
+ {
+ std::swap(m_begin, o.m_begin);
+ std::swap(m_end, o.m_end);
+ std::swap(m_destroyChain, o.m_destroyChain);
+ m_alloc.swap(o.m_alloc);
+ }
+
+ void BOOST_MEMORY_CALL clear()
+ {
+ while (m_destroyChain)
+ {
+ _DestroyNode* curr = m_destroyChain;
+ m_destroyChain = m_destroyChain->pPrev;
+ curr->fnDestroy(curr + 1);
+ }
+ _MemBlock* pHeader = _ChainHeader();
+ while (pHeader)
+ {
+ _MemBlock* pTemp = pHeader->pPrev;
+ m_alloc.deallocate(pHeader);
+ pHeader = pTemp;
+ }
+ m_begin = m_end = (char*)HeaderSize;
+ }
+
+ template <class Type>
+ void BOOST_MEMORY_CALL destroy(Type* obj)
+ {
+ // no action
+ }
+
+ template <class Type>
+ Type* BOOST_MEMORY_CALL newArray(size_t count, Type* zero)
+ {
+ Type* array = (Type*)destructor_traits<Type>::allocArrayBuf(*this, count);
+ return constructor_traits<Type>::constructArray(array, count);
+ }
+
+ template <class Type>
+ void BOOST_MEMORY_CALL destroyArray(Type* array, size_t count)
+ {
+ // no action
+ }
+
+ void* BOOST_MEMORY_CALL allocate(size_t cb)
+ {
+ if ((size_t)(m_end - m_begin) < cb)
+ {
+ if (cb >= BlockSize)
+ {
+ _MemBlock* pHeader = _ChainHeader();
+ _MemBlock* pNew = (_MemBlock*)m_alloc.allocate(HeaderSize + cb);
+ if (pHeader)
+ {
+ pNew->pPrev = pHeader->pPrev;
+ pHeader->pPrev = pNew;
+ }
+ else
+ {
+ m_end = m_begin = pNew->buffer;
+ pNew->pPrev = NULL;
+ }
+ return pNew->buffer;
+ }
+ else
+ {
+ _MemBlock* pNew = (_MemBlock*)m_alloc.allocate(sizeof(_MemBlock));
+ pNew->pPrev = _ChainHeader();
+ m_begin = pNew->buffer;
+ m_end = m_begin + BlockSize;
+ }
+ }
+ return m_end -= cb;
+ }
+
+ void* BOOST_MEMORY_CALL allocate(size_t cb, destructor_t fn)
+ {
+ _DestroyNode* pNode = (_DestroyNode*)allocate(sizeof(_DestroyNode) + cb);
+ pNode->fnDestroy = fn;
+ pNode->pPrev = m_destroyChain;
+ m_destroyChain = pNode;
+ return pNode + 1;
+ }
+
+ void* BOOST_MEMORY_CALL allocate(size_t cb, int fnZero)
+ {
+ return allocate(cb);
+ }
+
+ void* BOOST_MEMORY_CALL reallocate(void* p, size_t oldSize, size_t newSize)
+ {
+ if (oldSize >= newSize)
+ return p;
+ void* p2 = allocate(newSize);
+ memcpy(p2, p, oldSize);
+ return p2;
+ }
+
+ void BOOST_MEMORY_CALL deallocate(void* p, size_t cb)
+ {
+ // no action
+ }
+
+ __BOOST_FAKE_DBG_ALLOCATE();
+};
+
+// -------------------------------------------------------------------------
+// class auto_alloc
+
+class _sys_alloc
+{
+public:
+ enum { MemBlockSize = BOOST_MEMORY_BLOCK_SIZE };
+ typedef system_alloc allocator_type;
+};
+
+typedef gc_alloc_imp<_sys_alloc> auto_alloc;
+
+// -------------------------------------------------------------------------
+// $Log: auto_alloc.hpp,v $
+
+__NS_BOOST_END
+
+#endif /* __BOOST_MEMORY_AUTO_ALLOC_HPP__ */

Added: sandbox/memory/boost/memory/basic.hpp
==============================================================================
--- (empty file)
+++ sandbox/memory/boost/memory/basic.hpp 2008-04-28 21:16:17 EDT (Mon, 28 Apr 2008)
@@ -0,0 +1,239 @@
+//
+// boost/memory/basic.hpp
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// 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)
+//
+// See http://www.boost.org/libs/memory/index.htm for documentation.
+//
+#ifndef __BOOST_MEMORY_BASIC_HPP__
+#define __BOOST_MEMORY_BASIC_HPP__
+
+#ifndef __BOOST_MEMORY_CONFIG_HPP__
+#include "config.hpp"
+#endif
+
+// -------------------------------------------------------------------------
+
+#if !defined(_NEW_) && !defined(_NEW)
+#include <new> // new
+#endif
+
+#if !defined(_CSTDIO_) && !defined(_CSTDIO)
+#include <cstdio>
+#endif
+
+#if !defined(_INC_MALLOC) && !defined(_MALLOC_H)
+#include <malloc.h> // _alloca
+#endif
+
+// =========================================================================
+// BOOST_MEMORY_ASSERT - diagnost
+
+#if defined(ASSERT)
+#define BOOST_MEMORY_ASSERT(e) ASSERT(e)
+#elif defined(_ASSERTE)
+#define BOOST_MEMORY_ASSERT(e) _ASSERTE(e)
+#else
+#ifdef _DEBUG
+#ifndef assert
+#include <cassert>
+#endif
+#define BOOST_MEMORY_ASSERT(e) assert(e)
+#else
+#define BOOST_MEMORY_ASSERT(e)
+#endif
+#endif
+
+// =========================================================================
+// constructor_traits, destructor_traits
+
+__NS_BOOST_BEGIN
+
+typedef void BOOST_MEMORY_CALL __FnDestructor(void* data);
+typedef __FnDestructor* destructor_t;
+
+template <class Type>
+struct constructor_traits
+{
+ static Type* BOOST_MEMORY_CALL construct(void* data)
+ {
+ return new(data) Type;
+ }
+
+ static Type* BOOST_MEMORY_CALL constructArray(Type* array, size_t count)
+ {
+ for (size_t i = 0; i < count; ++i)
+ new(array + i) Type;
+ return array;
+ }
+};
+
+template <class Type>
+struct destructor_traits
+{
+ typedef destructor_t destructor_type;
+ struct array_destructor_header
+ {
+ size_t count;
+ };
+
+ static void BOOST_MEMORY_CALL destruct(void* data)
+ {
+ ((Type*)data)->~Type();
+ }
+
+ static void BOOST_MEMORY_CALL destructArrayN(Type* array, size_t count)
+ {
+ for (size_t i = 0; i < count; ++i)
+ array[i].~Type();
+ }
+
+ static void BOOST_MEMORY_CALL destructArray(void* data)
+ {
+ array_destructor_header* hdr = (array_destructor_header*)data;
+ destructArrayN((Type*)(hdr + 1), hdr->count);
+ }
+
+ template <class AllocT>
+ static void* BOOST_MEMORY_CALL allocArrayBuf(AllocT& alloc, size_t count)
+ {
+ array_destructor_header* hdr = (array_destructor_header*)alloc.allocate(
+ sizeof(array_destructor_header)+sizeof(Type)*count, destructArray);
+ hdr->count = count;
+ return hdr + 1;
+ }
+};
+
+template <class Type>
+inline void BOOST_MEMORY_CALL destroyArray(Type* array, size_t count)
+{
+ destructor_traits<Type>::destructArrayN(array, count);
+}
+
+__NS_BOOST_END
+
+// =========================================================================
+// BOOST_NO_DESTRUCTOR
+
+#define BOOST_NO_DESTRUCTOR(Type) \
+__NS_BOOST_BEGIN \
+template <> \
+struct destructor_traits< Type > \
+{ \
+ typedef int destructor_type; \
+ \
+ enum { destruct = 0 }; \
+ enum { destructArray = 0 }; \
+ \
+ static void BOOST_MEMORY_CALL destructArrayN(Type* array, size_t count) {} \
+ \
+ template <class AllocT> \
+ static void* BOOST_MEMORY_CALL allocArrayBuf(AllocT& alloc, size_t count) { \
+ return alloc.allocate(sizeof(Type)*count); \
+ } \
+}; \
+__NS_BOOST_END
+
+#define BOOST_INT_NO_DESTRUCTOR(Type) \
+ BOOST_NO_DESTRUCTOR(unsigned Type); \
+ BOOST_NO_DESTRUCTOR(signed Type)
+
+// -------------------------------------------------------------------------
+// BOOST_NO_CONSTRUCTOR
+
+#define BOOST_NO_CONSTRUCTOR(Type) \
+__NS_BOOST_BEGIN \
+template <> \
+struct constructor_traits< Type > \
+{ \
+ static Type* BOOST_MEMORY_CALL construct(void* data) { \
+ return (Type*)data; \
+ } \
+ static Type* BOOST_MEMORY_CALL constructArray(Type* array, size_t count) { \
+ return array; \
+ } \
+}; \
+__NS_BOOST_END
+
+#define BOOST_INT_NO_CONSTRUCTOR(Type) \
+ BOOST_NO_CONSTRUCTOR(unsigned Type); \
+ BOOST_NO_CONSTRUCTOR(signed Type)
+
+// -------------------------------------------------------------------------
+// C Standard Types Support
+
+#define BOOST_DECL_CTYPE(Type) \
+ BOOST_NO_CONSTRUCTOR(Type); \
+ BOOST_NO_DESTRUCTOR(Type)
+
+#define BOOST_DECL_INT_CTYPE(Type) \
+ BOOST_NO_CONSTRUCTOR(Type); \
+ BOOST_INT_NO_DESTRUCTOR(Type)
+
+// -------------------------------------------------------------------------
+
+BOOST_DECL_CTYPE(bool);
+BOOST_DECL_CTYPE(float);
+BOOST_DECL_CTYPE(double);
+
+BOOST_DECL_INT_CTYPE(int);
+BOOST_DECL_INT_CTYPE(char);
+BOOST_DECL_INT_CTYPE(short);
+BOOST_DECL_INT_CTYPE(long);
+
+// =========================================================================
+// MEMORY_DBG_NEW_ARG
+
+#if defined(_DEBUG)
+#define MEMORY_FILE_LINE_ARG ,__FILE__, __LINE__
+#else
+#define MEMORY_FILE_LINE_ARG
+#endif
+
+#define MEMORY_NEW_ARG(Type) sizeof(Type), boost::destructor_traits<Type>::destruct
+#define MEMORY_DBG_NEW_ARG(Type) MEMORY_NEW_ARG(Type) MEMORY_FILE_LINE_ARG
+
+#define MEMORY_NEW_ARRAY_ARG(Type, count) (count), (Type*)0
+#define MEMORY_DBG_NEW_ARRAY_ARG(Type, count) MEMORY_NEW_ARRAY_ARG(Type, count) MEMORY_FILE_LINE_ARG
+
+#define MEMORY_DBG_ALLOC_ARG(Type) sizeof(Type) MEMORY_FILE_LINE_ARG
+#define MEMORY_DBG_ALLOC_ARRAY_ARG(Type, count) sizeof(Type)*(count) MEMORY_FILE_LINE_ARG
+
+// =========================================================================
+// NEW, NEW_ARRAY, ALLOC, ALLOC_ARRAY
+
+#define BOOST_NEW(alloc, Type) ::new((alloc).allocate(MEMORY_DBG_NEW_ARG(Type))) Type
+#define BOOST_NEW_ARRAY(alloc, Type, count) (alloc).newArray(MEMORY_DBG_NEW_ARRAY_ARG(Type, count))
+
+#define BOOST_ALLOC(alloc, Type) ((Type*)(alloc).allocate(MEMORY_DBG_ALLOC_ARG(Type)))
+#define BOOST_ALLOC_ARRAY(alloc, Type, count) ((Type*)(alloc).allocate(MEMORY_DBG_ALLOC_ARRAY_ARG(Type, count)))
+
+// =========================================================================
+
+#ifndef _CrtSetDbgFlag
+
+#if defined(_MSC_VER)
+#include <crtdbg.h>
+#endif
+
+#endif
+
+__NS_BOOST_BEGIN
+
+inline void BOOST_MEMORY_CALL enableMemoryLeakCheck()
+{
+#ifdef _CrtSetDbgFlag
+ _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF);
+#endif
+}
+
+__NS_BOOST_END
+
+// =========================================================================
+// $Log: basic.hpp,v $
+
+#endif /* __BOOST_MEMORY_BASIC_HPP__ */

Added: sandbox/memory/boost/memory/config.hpp
==============================================================================
--- (empty file)
+++ sandbox/memory/boost/memory/config.hpp 2008-04-28 21:16:17 EDT (Mon, 28 Apr 2008)
@@ -0,0 +1,45 @@
+//
+// boost/memory/config.hpp
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// 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)
+//
+// See http://www.boost.org/libs/memory/index.htm for documentation.
+//
+#ifndef __BOOST_MEMORY_CONFIG_HPP__
+#define __BOOST_MEMORY_CONFIG_HPP__
+
+// -------------------------------------------------------------------------
+// Configurations
+
+#ifndef BOOST_MEMORY_ALLOC_PADDING
+#define BOOST_MEMORY_ALLOC_PADDING 32
+#endif
+
+#ifndef BOOST_MEMORY_BLOCK_TOTAL
+#define BOOST_MEMORY_BLOCK_TOTAL 16384 // 16k
+#endif
+
+#ifndef BOOST_MEMORY_BLOCK_SIZE
+#define BOOST_MEMORY_BLOCK_SIZE (BOOST_MEMORY_BLOCK_TOTAL - BOOST_MEMORY_ALLOC_PADDING)
+#endif
+
+// -------------------------------------------------------------------------
+
+#ifndef BOOST_MEMORY_CALL
+#define BOOST_MEMORY_CALL
+#endif
+
+// -------------------------------------------------------------------------
+
+#ifndef __NS_BOOST_BEGIN
+#define __NS_BOOST_BEGIN namespace boost {
+#define __NS_BOOST_END }
+#endif
+
+// -------------------------------------------------------------------------
+
+#endif /* __BOOST_MEMORY_CONFIG_HPP__ */

Added: sandbox/memory/boost/memory/linklib.hpp
==============================================================================
--- (empty file)
+++ sandbox/memory/boost/memory/linklib.hpp 2008-04-28 21:16:17 EDT (Mon, 28 Apr 2008)
@@ -0,0 +1,27 @@
+//
+// boost/memory/linklib.hpp
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// 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)
+//
+// See http://www.boost.org/libs/memory/index.htm for documentation.
+//
+#ifndef __BOOST_MEMORY_LINKLIB_HPP__
+#define __BOOST_MEMORY_LINKLIB_HPP__
+
+// -------------------------------------------------------------------------
+
+#if !defined(__Linked_boost_memory)
+#define __Linked_boost_memory
+#if defined(_MSC_VER)
+# pragma comment(lib, "boost-memory")
+#endif
+#endif
+
+// -------------------------------------------------------------------------
+// $Log: linklib.hpp,v $
+
+#endif /* __BOOST_MEMORY_LINKLIB_HPP__ */

Added: sandbox/memory/boost/memory/scoped_alloc.hpp
==============================================================================
--- (empty file)
+++ sandbox/memory/boost/memory/scoped_alloc.hpp 2008-04-28 21:16:17 EDT (Mon, 28 Apr 2008)
@@ -0,0 +1,184 @@
+//
+// boost/memory/scoped_alloc.hpp
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// 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)
+//
+// See http://www.boost.org/libs/memory/index.htm for documentation.
+//
+#ifndef __BOOST_MEMORY_SCOPED_ALLOC_HPP__
+#define __BOOST_MEMORY_SCOPED_ALLOC_HPP__
+
+#ifndef __BOOST_MEMORY_BASIC_HPP__
+#include "basic.hpp"
+#endif
+
+#ifndef __BOOST_MEMORY_AUTO_ALLOC_HPP__
+#include "auto_alloc.hpp"
+#endif
+
+#ifndef __BOOST_MEMORY_THREAD_TLS_HPP__
+#include "thread/tls.hpp"
+#endif
+
+#if !defined(_CLIMITS_) && !defined(_CLIMITS)
+#include <climits> // INT_MAX
+#endif
+
+__NS_BOOST_BEGIN
+
+// -------------------------------------------------------------------------
+// class proxy_alloc
+
+template <class AllocT, class TlsAllocT>
+class proxy_alloc
+{
+private:
+ AllocT* m_alloc;
+
+public:
+ proxy_alloc(AllocT& alloc) : m_alloc(&alloc) {}
+ proxy_alloc() : m_alloc(&TlsAllocT::instance()) {}
+
+public:
+ void* BOOST_MEMORY_CALL allocate(size_t cb) { return m_alloc->allocate(cb); }
+ void BOOST_MEMORY_CALL deallocate(void* p) { m_alloc->deallocate(p); }
+ void BOOST_MEMORY_CALL swap(proxy_alloc& o) { std::swap(m_alloc, o.m_alloc); }
+};
+
+// -------------------------------------------------------------------------
+// class block_pool
+
+template <class _Policy>
+class block_pool_imp
+{
+private:
+ typedef typename _Policy::allocator_type _Alloc;
+ enum { m_cbBlock = _Policy::MemBlockSize };
+
+ struct _Block {
+ _Block* next;
+ };
+ _Block* m_freeList;
+
+ int m_nFree;
+ const int m_nFreeLimit;
+
+private:
+ block_pool_imp(const block_pool_imp&);
+ void operator=(const block_pool_imp&);
+
+public:
+ block_pool_imp(int cbFreeLimit = INT_MAX)
+ : m_freeList(NULL), m_nFree(0),
+ m_nFreeLimit(cbFreeLimit / m_cbBlock + 1)
+ {
+ }
+ ~block_pool_imp()
+ {
+ clear();
+ }
+
+public:
+ void* BOOST_MEMORY_CALL allocate(size_t cb)
+ {
+ BOOST_MEMORY_ASSERT(cb >= (size_t)m_cbBlock);
+
+ if (cb > (size_t)m_cbBlock)
+ return _Alloc::allocate(cb);
+ else
+ {
+ if (m_freeList)
+ {
+ BOOST_MEMORY_ASSERT(_Alloc::alloc_size(m_freeList) >= cb);
+ _Block* blk = m_freeList;
+ m_freeList = blk->next;
+ --m_nFree;
+ return blk;
+ }
+ return _Alloc::allocate(m_cbBlock);
+ }
+ }
+
+ void BOOST_MEMORY_CALL deallocate(void* p)
+ {
+ if (m_nFree >= m_nFreeLimit) {
+ _Alloc::deallocate(p);
+ }
+ else {
+ _Block* blk = (_Block*)p;
+ blk->next = m_freeList;
+ m_freeList = blk;
+ ++m_nFree;
+ }
+ }
+
+ void BOOST_MEMORY_CALL clear()
+ {
+ while (m_freeList)
+ {
+ _Block* blk = m_freeList;
+ m_freeList = blk->next;
+ _Alloc::deallocate(blk);
+ }
+ m_nFree = 0;
+ }
+};
+
+typedef block_pool_imp<_sys_alloc> block_pool;
+
+// -------------------------------------------------------------------------
+// class tls_block_pool
+
+typedef tls_object<block_pool> tls_block_pool_t;
+
+STDAPI_(tls_block_pool_t*) _boost_TlsBlockPool();
+
+template <class _Unused>
+class tls_block_pool_imp
+{
+private:
+ static tls_block_pool_t* _tls_blockPool;
+
+public:
+ tls_block_pool_imp() {
+ _tls_blockPool->init();
+ }
+ ~tls_block_pool_imp() {
+ _tls_blockPool->term();
+ }
+
+ static block_pool& BOOST_MEMORY_CALL instance()
+ {
+ return _tls_blockPool->get();
+ }
+};
+
+template <class _Unused>
+tls_block_pool_t* tls_block_pool_imp<_Unused>::_tls_blockPool = _boost_TlsBlockPool();
+
+typedef tls_block_pool_imp<int> tls_block_pool;
+
+// -------------------------------------------------------------------------
+// class scoped_alloc
+
+typedef proxy_alloc<block_pool, tls_block_pool> proxy_block_pool;
+
+class _pool_alloc
+{
+public:
+ enum { MemBlockSize = BOOST_MEMORY_BLOCK_SIZE };
+ typedef proxy_block_pool allocator_type;
+};
+
+typedef gc_alloc_imp<_pool_alloc> scoped_alloc;
+
+// -------------------------------------------------------------------------
+// $Log: $
+
+__NS_BOOST_END
+
+#endif /* __BOOST_MEMORY_SCOPED_ALLOC_HPP__ */

Added: sandbox/memory/boost/memory/system_alloc.hpp
==============================================================================
--- (empty file)
+++ sandbox/memory/boost/memory/system_alloc.hpp 2008-04-28 21:16:17 EDT (Mon, 28 Apr 2008)
@@ -0,0 +1,139 @@
+//
+// boost/memory/system_alloc.hpp
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// 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)
+//
+// See http://www.boost.org/libs/memory/index.htm for documentation.
+//
+#ifndef __BOOST_MEMORY_SYSTEM_ALLOC_HPP__
+#define __BOOST_MEMORY_SYSTEM_ALLOC_HPP__
+
+#ifndef __BOOST_MEMORY_BASIC_HPP__
+#include "basic.hpp"
+#endif
+
+#ifndef __BOOST_MEMORY_THREADMODEL_HPP__
+#include "threadmodel.hpp"
+#endif
+
+#if !defined(_ALGORITHM_) && !defined(_ALGORITHM)
+#include <algorithm> // std::swap
+#endif
+
+#if !defined(_CSTDLIB_) && !defined(_CSTDLIB)
+#include <cstdlib> // malloc, free
+#endif
+
+__NS_BOOST_BEGIN
+
+// -------------------------------------------------------------------------
+// __BOOST_FAKE_DBG_ALLOCATE
+
+#if defined(_DEBUG)
+
+#define __BOOST_FAKE_DBG_ALLOCATE() \
+ void* BOOST_MEMORY_CALL allocate(size_t cb, LPCSTR szFile, int nLine) \
+ { return allocate(cb); } \
+ void* BOOST_MEMORY_CALL allocate(size_t cb, destructor_t fn, LPCSTR szFile, int nLine) \
+ { return allocate(cb, fn); } \
+ void* BOOST_MEMORY_CALL allocate(size_t cb, int fnZero, LPCSTR szFile, int nLine) \
+ { return allocate(cb); } \
+ void* BOOST_MEMORY_CALL reallocate(void* p, size_t oldSize, size_t newSize, \
+ LPCSTR szFile, int nLine) { return reallocate(p, oldSize, newSize); } \
+ template <class Type> \
+ Type* BOOST_MEMORY_CALL newArray(size_t count, Type* zero, LPCSTR szFile, int nLine)\
+ { return newArray(count, zero); }
+
+#else
+
+#define __BOOST_FAKE_DBG_ALLOCATE()
+
+#endif
+
+// -------------------------------------------------------------------------
+// class stdlib_alloc
+
+#if defined(__GNUG__)
+#define _msize malloc_usable_size
+#endif
+
+class stdlib_alloc
+{
+public:
+ static void* BOOST_MEMORY_CALL allocate(size_t cb) { return malloc(cb); }
+ static void* BOOST_MEMORY_CALL allocate(size_t cb, destructor_t fn) { return malloc(cb); }
+ static void* BOOST_MEMORY_CALL allocate(size_t cb, int fnZero) { return malloc(cb); }
+
+ static void* BOOST_MEMORY_CALL reallocate(void* p, size_t oldSize, size_t newSize) {
+ return realloc(p, newSize);
+ }
+
+ static void BOOST_MEMORY_CALL deallocate(void* p) { free(p); }
+ static void BOOST_MEMORY_CALL deallocate(void* p, size_t) { free(p); }
+ static void BOOST_MEMORY_CALL swap(stdlib_alloc& o) {}
+
+ static size_t BOOST_MEMORY_CALL alloc_size(void* p)
+ {
+ return _msize(p);
+ }
+
+ template <class Type>
+ static void BOOST_MEMORY_CALL destroy(Type* obj)
+ {
+ obj->~Type();
+ free(obj);
+ }
+
+ template <class Type>
+ static Type* BOOST_MEMORY_CALL newArray(size_t count, Type* zero)
+ {
+ Type* array = (Type*)malloc(sizeof(Type) * count);
+ return constructor_traits<Type>::constructArray(array, count);
+ }
+
+ template <class Type>
+ static void BOOST_MEMORY_CALL destroyArray(Type* array, size_t count)
+ {
+ destructor_traits<Type>::destructArrayN(array, count);
+ free(array);
+ }
+
+#if defined(_malloc_dbg)
+ static void* BOOST_MEMORY_CALL allocate(size_t cb, LPCSTR szFile, int nLine)
+ { return _malloc_dbg(cb, _NORMAL_BLOCK, szFile, nLine); }
+
+ static void* BOOST_MEMORY_CALL allocate(size_t cb, destructor_t fn, LPCSTR szFile, int nLine)
+ { return _malloc_dbg(cb, _NORMAL_BLOCK, szFile, nLine); }
+
+ static void* BOOST_MEMORY_CALL allocate(size_t cb, int fnZero, LPCSTR szFile, int nLine)
+ { return _malloc_dbg(cb, _NORMAL_BLOCK, szFile, nLine); }
+
+ static void* BOOST_MEMORY_CALL reallocate(void* p, size_t oldSize, size_t newSize, LPCSTR szFile, int nLine)
+ { return _realloc_dbg(p, newSize, _NORMAL_BLOCK, szFile, nLine); }
+
+ template <class Type>
+ static Type* BOOST_MEMORY_CALL newArray(size_t count, Type* zero, LPCSTR szFile, int nLine)
+ {
+ Type* array = (Type*)_malloc_dbg(sizeof(Type) * count, _NORMAL_BLOCK, szFile, nLine);
+ return constructor_traits<Type>::constructArray(array, count);
+ }
+#else
+ __BOOST_FAKE_DBG_ALLOCATE()
+#endif
+};
+
+// -------------------------------------------------------------------------
+// class system_alloc
+
+typedef stdlib_alloc system_alloc;
+
+// -------------------------------------------------------------------------
+// $Log: $
+
+__NS_BOOST_END
+
+#endif /* __BOOST_MEMORY_SYSTEM_ALLOC_HPP__ */

Added: sandbox/memory/boost/memory/thread/tls.hpp
==============================================================================
--- (empty file)
+++ sandbox/memory/boost/memory/thread/tls.hpp 2008-04-28 21:16:17 EDT (Mon, 28 Apr 2008)
@@ -0,0 +1,237 @@
+//
+// boost/memory/thread/tls.hpp (*)
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// 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)
+//
+// See http://www.boost.org/libs/memory/index.htm for documentation.
+//
+#ifndef __BOOST_MEMORY_THREAD_TLS_HPP__
+#define __BOOST_MEMORY_THREAD_TLS_HPP__
+
+#ifndef __BOOST_MEMORY_BASIC_HPP__
+#include "../basic.hpp"
+#endif
+
+#ifndef __BOOST_MEMORY_THREADMODEL_HPP__
+#include "../threadmodel.hpp"
+#endif
+
+// -------------------------------------------------------------------------
+// class win_tls_key
+
+#if defined(_WIN32)
+
+__NS_BOOST_BEGIN
+
+typedef DWORD TLSINDEX;
+
+class win_tls_key
+{
+private:
+ TLSINDEX m_key;
+
+public:
+ void BOOST_MEMORY_CALL create() {
+ m_key = TlsAlloc();
+ }
+
+ void BOOST_MEMORY_CALL clear() {
+ TlsFree(m_key);
+ }
+
+ void BOOST_MEMORY_CALL put(void* p) const {
+ TlsSetValue(m_key, p);
+ }
+
+ void* BOOST_MEMORY_CALL get() const {
+ return TlsGetValue(m_key);
+ }
+};
+
+__NS_BOOST_END
+
+#endif // defined(_WIN32)
+
+// -------------------------------------------------------------------------
+// class pthread_tls_key
+
+#if !defined(_WIN32)
+
+#ifndef _PTHREAD_H
+#include <pthread.h>
+#endif
+
+__NS_BOOST_BEGIN
+
+class pthread_tls_key
+{
+private:
+ pthread_key_t m_key;
+
+public:
+ void BOOST_MEMORY_CALL create() {
+ pthread_key_create(&m_key, NULL);
+ }
+
+ void BOOST_MEMORY_CALL clear() const {
+ pthread_key_delete(m_key);
+ }
+
+ void BOOST_MEMORY_CALL put(void* p) const {
+ pthread_setspecific(m_key, p);
+ }
+
+ void* BOOST_MEMORY_CALL get() const {
+ return pthread_getspecific(m_key);
+ }
+};
+
+__NS_BOOST_END
+
+#endif // !defined(_WIN32)
+
+// -------------------------------------------------------------------------
+// class tls_key
+
+__NS_BOOST_BEGIN
+
+#if defined(_WIN32)
+
+typedef win_tls_key tls_key;
+
+#else
+
+typedef pthread_tls_key tls_key;
+
+#endif
+
+__NS_BOOST_END
+
+// -------------------------------------------------------------------------
+// class tls_ptr
+
+__NS_BOOST_BEGIN
+
+template <class Type>
+class tls_ptr
+{
+private:
+ tls_ptr(const tls_ptr&);
+ void operator=(const tls_ptr&);
+
+public:
+ tls_key p;
+
+public:
+ typedef Type* pointer;
+ typedef Type& reference;
+
+public:
+ explicit tls_ptr(const tls_key& key) : p(key) {}
+
+ operator pointer() const {
+ return (pointer)p.get();
+ }
+
+ pointer BOOST_MEMORY_CALL operator->() const {
+ return (pointer)p.get();
+ }
+
+ pointer BOOST_MEMORY_CALL operator=(pointer lp) {
+ p.put(lp);
+ return lp;
+ }
+
+ bool BOOST_MEMORY_CALL operator!() const {
+ return p.get() == NULL;
+ }
+
+ reference BOOST_MEMORY_CALL operator*() const {
+ return *(pointer)p.get();
+ }
+};
+
+__NS_BOOST_END
+
+// -------------------------------------------------------------------------
+// class tls_object
+
+__NS_BOOST_BEGIN
+
+template <class Type>
+class tls_factory
+{
+public:
+ enum { has_cleanup = 1 };
+
+ static Type* BOOST_MEMORY_CALL create() {
+ return new Type;
+ }
+ static void cleanup(void* p) {
+ delete (Type*)p;
+ }
+};
+
+#pragma warning(disable:4786)
+
+template <
+ class Type,
+ class Factory = tls_factory<Type>,
+ class ThreadModel = initializer_threadmodel>
+class tls_object
+{
+private:
+ typedef typename ThreadModel::refcount refcount;
+
+ tls_key m_key;
+ refcount m_ref;
+
+public:
+ tls_object() : m_ref(0) {}
+
+ void BOOST_MEMORY_CALL init()
+ {
+ if (m_ref.acquire() == 1) {
+ m_key.create();
+ }
+ }
+
+ void BOOST_MEMORY_CALL term()
+ {
+ if (m_ref.release() == 0)
+ {
+ if (Factory::has_cleanup)
+ {
+ void* p = m_key.get();
+ if (p)
+ Factory::cleanup(p);
+ }
+ m_key.clear();
+ }
+ }
+
+ const tls_key& BOOST_MEMORY_CALL storage() const
+ {
+ return m_key;
+ }
+
+ Type& BOOST_MEMORY_CALL get()
+ {
+ void* p = m_key.get();
+ if (p == NULL) {
+ m_key.put(p = Factory::create());
+ }
+ return *(Type*)p;
+ }
+};
+
+__NS_BOOST_END
+
+// -------------------------------------------------------------------------
+// $Log: $
+
+#endif /* __BOOST_MEMORY_THREAD_TLS_HPP__ */

Added: sandbox/memory/boost/memory/threadmodel.hpp
==============================================================================
--- (empty file)
+++ sandbox/memory/boost/memory/threadmodel.hpp 2008-04-28 21:16:17 EDT (Mon, 28 Apr 2008)
@@ -0,0 +1,95 @@
+//
+// boost/memory/threadmodel.hpp (*)
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// 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)
+//
+// See http://www.boost.org/libs/memory/index.htm for documentation.
+//
+#ifndef __BOOST_MEMORY_THREADMODEL_HPP__
+#define __BOOST_MEMORY_THREADMODEL_HPP__
+
+// -------------------------------------------------------------------------
+
+#ifndef __BOOST_MEMORY_THREADMODEL_SINGLE_THREAD_H__
+#include "threadmodel/single_thread.hpp"
+#endif
+
+#ifndef __BOOST_MEMORY_THREADMODEL_MULTI_THREAD_H__
+#include "threadmodel/multi_thread.hpp"
+#endif
+
+__NS_BOOST_BEGIN
+
+// -------------------------------------------------------------------------
+// class auto_lock
+
+template <class LockT>
+class auto_lock
+{
+private:
+ LockT& m_lock;
+
+private:
+ auto_lock(const auto_lock&);
+ void operator=(const auto_lock&);
+
+public:
+ auto_lock(LockT& lock) : m_lock(lock)
+ {
+ m_lock.acquire();
+ }
+ ~auto_lock()
+ {
+ m_lock.release();
+ }
+};
+
+// -------------------------------------------------------------------------
+// class multi_thread
+
+class multi_thread
+{
+public:
+ typedef refcount_mt refcount;
+ typedef critical_section_mt critical_section;
+
+public:
+ typedef critical_section cs;
+ typedef auto_lock<cs> cslock;
+};
+
+// -------------------------------------------------------------------------
+// class single_thread
+
+class single_thread
+{
+public:
+ typedef refcount_st refcount;
+ typedef critical_section_st critical_section;
+
+public:
+ typedef critical_section cs;
+ typedef auto_lock<cs> cslock;
+};
+
+// -------------------------------------------------------------------------
+// class default_threadmodel
+
+#if defined(_MT)
+typedef multi_thread default_threadmodel;
+#else
+typedef single_thread default_threadmodel;
+#endif
+
+typedef single_thread initializer_threadmodel;
+
+// -------------------------------------------------------------------------
+// $Log: $
+
+__NS_BOOST_END
+
+#endif /* __BOOST_MEMORY_THREADMODEL_HPP__ */

Added: sandbox/memory/boost/memory/threadmodel/multi_thread.hpp
==============================================================================
--- (empty file)
+++ sandbox/memory/boost/memory/threadmodel/multi_thread.hpp 2008-04-28 21:16:17 EDT (Mon, 28 Apr 2008)
@@ -0,0 +1,95 @@
+//
+// boost/memory/threadmodel/multi_thread.hpp (*)
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// 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)
+//
+// See http://www.boost.org/libs/memory/index.htm for documentation.
+//
+#ifndef __BOOST_MEMORY_THREADMODEL_MULTI_THREAD_H__
+#define __BOOST_MEMORY_THREADMODEL_MULTI_THREAD_H__
+
+#ifndef __BOOST_MEMORY_BASIC_HPP__
+#include "../basic.hpp"
+#endif
+
+#include "../winapi/winbase.h"
+
+__NS_BOOST_BEGIN
+
+// -------------------------------------------------------------------------
+// class refcount_mt
+
+class refcount_mt
+{
+public:
+ typedef LONG value_type;
+
+private:
+ value_type m_nRef;
+
+public:
+ refcount_mt(value_type nRef)
+ : m_nRef(nRef)
+ {
+ }
+
+/* @@todo:
+ value_type BOOST_MEMORY_CALL acquire()
+ {
+ return InterlockedIncrement(&m_nRef);
+ }
+
+ value_type BOOST_MEMORY_CALL release()
+ {
+ return InterlockedDecrement(&m_nRef);
+ }
+*/
+ operator value_type()
+ {
+ return m_nRef;
+ }
+};
+
+// -------------------------------------------------------------------------
+// class critical_section_mt
+
+class critical_section_mt
+{
+private:
+ CRITICAL_SECTION m_cs;
+
+private:
+ critical_section_mt(const critical_section_mt&);
+ void operator=(const critical_section_mt&);
+
+public:
+ critical_section_mt()
+ {
+ InitializeCriticalSection(&m_cs);
+ }
+ ~critical_section_mt()
+ {
+ DeleteCriticalSection(&m_cs);
+ }
+
+ void BOOST_MEMORY_CALL acquire()
+ {
+ EnterCriticalSection(&m_cs);
+ }
+
+ void BOOST_MEMORY_CALL release()
+ {
+ LeaveCriticalSection(&m_cs);
+ }
+};
+
+// -------------------------------------------------------------------------
+// $Log: $
+
+__NS_BOOST_END
+
+#endif /* __BOOST_MEMORY_THREADMODEL_MULTI_THREAD_H__ */

Added: sandbox/memory/boost/memory/threadmodel/single_thread.hpp
==============================================================================
--- (empty file)
+++ sandbox/memory/boost/memory/threadmodel/single_thread.hpp 2008-04-28 21:16:17 EDT (Mon, 28 Apr 2008)
@@ -0,0 +1,61 @@
+//
+// boost/memory/threadmodel/single_thread.hpp (*)
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// 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)
+//
+// See http://www.boost.org/libs/memory/index.htm for documentation.
+//
+#ifndef __BOOST_MEMORY_THREADMODEL_SINGLE_THREAD_H__
+#define __BOOST_MEMORY_THREADMODEL_SINGLE_THREAD_H__
+
+#ifndef __BOOST_MEMORY_BASIC_HPP__
+#include "../basic.hpp"
+#endif
+
+__NS_BOOST_BEGIN
+
+// -------------------------------------------------------------------------
+// struct refcount_st
+
+class refcount_st
+{
+public:
+ typedef long value_type;
+
+private:
+ value_type m_nRef;
+
+public:
+ refcount_st(value_type nRef) : m_nRef(nRef)
+ {
+ }
+
+ value_type BOOST_MEMORY_CALL acquire() { return ++m_nRef; }
+ value_type BOOST_MEMORY_CALL release() { return --m_nRef; }
+
+ operator value_type()
+ {
+ return m_nRef;
+ }
+};
+
+// -------------------------------------------------------------------------
+// class critical_section_st
+
+class critical_section_st
+{
+public:
+ void BOOST_MEMORY_CALL acquire() {}
+ void BOOST_MEMORY_CALL release() {}
+};
+
+// -------------------------------------------------------------------------
+// $Log: $
+
+__NS_BOOST_END
+
+#endif /* __BOOST_MEMORY_THREADMODEL_SINGLE_THREAD_H__ */

Added: sandbox/memory/boost/memory/winapi/posix/pthread.hpp
==============================================================================
--- (empty file)
+++ sandbox/memory/boost/memory/winapi/posix/pthread.hpp 2008-04-28 21:16:17 EDT (Mon, 28 Apr 2008)
@@ -0,0 +1,111 @@
+//
+// boost/memory/winapi/posix/pthread.hpp (*)
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// 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)
+//
+// See http://www.boost.org/libs/memory/index.htm for documentation.
+//
+#ifndef __BOOST_MEMORY_WINAPI_POSIX_PTHREAD_HPP__
+#define __BOOST_MEMORY_WINAPI_POSIX_PTHREAD_HPP__
+
+#ifndef __BOOST_MEMORY_WINAPI_WINDEF_H__
+#include "../windef.h"
+#endif
+
+#ifndef _PTHREAD_H
+#include <pthread.h>
+#endif
+
+// -------------------------------------------------------------------------
+// CriticalSection
+
+typedef pthread_mutex_t RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION;
+typedef RTL_CRITICAL_SECTION CRITICAL_SECTION;
+typedef PRTL_CRITICAL_SECTION PCRITICAL_SECTION;
+typedef PRTL_CRITICAL_SECTION LPCRITICAL_SECTION;
+
+__forceinline VOID WINAPI InitializeCriticalSection(
+ LPCRITICAL_SECTION lpCriticalSection)
+{
+ pthread_mutex_init(lpCriticalSection, NULL);
+}
+
+__forceinline VOID WINAPI EnterCriticalSection(
+ LPCRITICAL_SECTION lpCriticalSection)
+{
+ pthread_mutex_lock(lpCriticalSection);
+}
+
+__forceinline BOOL WINAPI TryEnterCriticalSection(
+ LPCRITICAL_SECTION lpCriticalSection)
+{
+ return pthread_mutex_trylock(lpCriticalSection) == 0;
+}
+
+__forceinline VOID WINAPI LeaveCriticalSection(
+ LPCRITICAL_SECTION lpCriticalSection)
+{
+ pthread_mutex_unlock(lpCriticalSection);
+}
+
+__forceinline VOID WINAPI DeleteCriticalSection(
+ LPCRITICAL_SECTION lpCriticalSection)
+{
+ pthread_mutex_destroy(lpCriticalSection);
+}
+
+// -------------------------------------------------------------------------
+
+__forceinline DWORD WINAPI GetCurrentThreadId()
+{
+#if defined(PTW32_VERSION)
+ return (DWORD)pthread_self().p;
+#else
+ return pthread_self();
+#endif
+}
+
+// -------------------------------------------------------------------------
+
+#ifndef TLS_OUT_OF_INDEXES
+#define TLS_OUT_OF_INDEXES (DWORD)0xFFFFFFFF
+#endif
+
+#ifndef S_OK
+#define S_OK 0
+#endif
+
+typedef pthread_key_t TLSINDEX;
+
+__forceinline TLSINDEX WINAPI TlsAlloc(void)
+{
+ pthread_key_t key;
+ if (pthread_key_create(&key, NULL) != S_OK)
+ return TLS_OUT_OF_INDEXES;
+ else
+ return key;
+}
+
+__forceinline BOOL WINAPI TlsFree(TLSINDEX key)
+{
+ return pthread_key_delete(key) == S_OK;
+}
+
+__forceinline BOOL WINAPI TlsSetValue(TLSINDEX key, LPVOID lpTlsValue)
+{
+ return pthread_setspecific(key, lpTlsValue) == S_OK;
+}
+
+__forceinline LPVOID WINAPI TlsGetValue(TLSINDEX key)
+{
+ return pthread_getspecific(key);
+}
+
+// -------------------------------------------------------------------------
+// $Log: $
+
+#endif /* __BOOST_MEMORY_WINAPI_POSIX_PTHREAD_HPP__ */

Added: sandbox/memory/boost/memory/winapi/winbase.h
==============================================================================
--- (empty file)
+++ sandbox/memory/boost/memory/winapi/winbase.h 2008-04-28 21:16:17 EDT (Mon, 28 Apr 2008)
@@ -0,0 +1,42 @@
+//
+// boost/memory/winapi/winbase.h (*)
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// 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)
+//
+// See http://www.boost.org/libs/memory/index.htm for documentation.
+//
+#ifndef __BOOST_MEMORY_WINAPI_WINBASE_H__
+#define __BOOST_MEMORY_WINAPI_WINBASE_H__
+
+#if defined(_WIN32)
+
+#ifndef __wtypes_h__
+#include <wtypes.h>
+#endif
+
+#ifndef _WINBASE_
+#include <winbase.h>
+#endif
+
+#else
+
+#define BOOST_NO_WINSDK
+
+#ifndef __BOOST_MEMORY_WINAPI_WTYPES_H__
+#include "wtypes.h"
+#endif
+
+#ifndef __BOOST_MEMORY_WINAPI_POSIX_PTHREAD_HPP__
+#include "posix/pthread.hpp"
+#endif
+
+#endif
+
+// -------------------------------------------------------------------------
+// $Log: $
+
+#endif /* __BOOST_MEMORY_WINAPI_WINBASE_H__ */

Added: sandbox/memory/boost/memory/winapi/windef.h
==============================================================================
--- (empty file)
+++ sandbox/memory/boost/memory/winapi/windef.h 2008-04-28 21:16:17 EDT (Mon, 28 Apr 2008)
@@ -0,0 +1,568 @@
+//
+// boost/memory/winapi/windef.h (*)
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// 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)
+//
+// See http://www.boost.org/libs/memory/index.htm for documentation.
+//
+#ifndef __BOOST_MEMORY_WINAPI_WINDEF_H__
+#define __BOOST_MEMORY_WINAPI_WINDEF_H__
+
+#ifndef BOOST_NO_WINSDK
+#error "Don't include <winapi/windef.h>"
+#endif
+
+// -------------------------------------------------------------------------
+
+#ifdef __cplusplus
+ #define EXTERN_C extern "C"
+#else
+ #define EXTERN_C extern
+#endif
+
+// -------------------------------------------------------------------------
+
+#ifndef CDECL
+#define CDECL
+#endif
+
+#if defined(__GNUG__)
+#define __forceinline inline
+#define __stdcall
+#endif
+
+#ifdef _MAC
+#define CALLBACK PASCAL
+#define WINAPI CDECL
+#define WINAPIV CDECL
+#define APIENTRY WINAPI
+#define APIPRIVATE CDECL
+#ifdef _68K_
+#define PASCAL __pascal
+#else
+#define PASCAL
+#endif
+#elif (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
+#define CALLBACK __stdcall
+#define WINAPI __stdcall
+#define WINAPIV __cdecl
+#define APIENTRY WINAPI
+#define APIPRIVATE __stdcall
+#define PASCAL __stdcall
+#else
+#define CALLBACK
+#define WINAPI
+#define WINAPIV
+#define APIENTRY WINAPI
+#define APIPRIVATE
+#define PASCAL pascal
+#endif
+
+#ifndef STDAPICALLTYPE
+#define STDAPICALLTYPE __stdcall
+#endif
+
+#ifndef STDMETHODCALLTYPE
+#define STDMETHODCALLTYPE __stdcall
+#endif
+
+#ifndef STDMETHODIMP
+#define STDMETHOD(method) virtual HRESULT STDMETHODCALLTYPE method
+#define STDMETHOD_(type,method) virtual type STDMETHODCALLTYPE method
+#define STDMETHODIMP HRESULT STDMETHODCALLTYPE
+#define STDMETHODIMP_(type) type STDMETHODCALLTYPE
+#endif
+
+#ifndef STDAPI
+#define STDAPI EXTERN_C HRESULT STDMETHODCALLTYPE
+#define STDAPI_(type) EXTERN_C type STDMETHODCALLTYPE
+#endif
+
+// -------------------------------------------------------------------------
+
+#ifndef __RPC_FAR
+#define __RPC_FAR
+#endif
+
+typedef void __RPC_FAR * RPC_IF_HANDLE;
+
+#ifndef MIDL_INTERFACE
+#define MIDL_INTERFACE(x) struct
+#endif
+
+#ifndef MIDL_INTERFACE_
+#define MIDL_INTERFACE_(x, Intrf) struct Intrf
+#endif
+
+#ifndef PURE
+#define PURE = 0
+#endif
+
+#ifndef interface
+#define interface struct
+#endif
+
+// -------------------------------------------------------------------------
+
+#ifndef NULL
+ #ifdef __cplusplus
+ #define NULL 0
+ #else
+ #define NULL ((void *)0)
+ #endif
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef IN
+#define IN
+#endif
+
+#ifndef OUT
+#define OUT
+#endif
+
+#ifndef OPTIONAL
+#define OPTIONAL
+#endif
+
+#ifndef CONST
+#define CONST const
+#endif
+
+#undef far
+#undef near
+#define far
+#define near
+
+#undef FAR
+#undef NEAR
+#define FAR far
+#define NEAR near
+
+#ifndef VOID
+#define VOID void
+#endif
+
+// -------------------------------------------------------------------------
+
+typedef unsigned char UCHAR;
+typedef UCHAR *PUCHAR;
+typedef char *PSZ;
+
+typedef char CHAR;
+typedef CHAR *LPSTR, *PSTR;
+typedef CONST CHAR *LPCSTR, *PCSTR;
+
+// -------------------------------------------------------------------------
+
+typedef int INT;
+typedef unsigned int UINT;
+typedef unsigned long ULONG;
+typedef short SHORT;
+typedef unsigned short USHORT;
+typedef unsigned long ULONG;
+typedef unsigned short USHORT;
+
+typedef long LONG;
+typedef unsigned long DWORD;
+typedef int BOOL;
+typedef unsigned char BYTE;
+typedef unsigned short WORD;
+typedef float FLOAT;
+typedef double DOUBLE;
+
+typedef ULONG near *PULONG;
+typedef LONG far *LPLONG;
+typedef USHORT near *PUSHORT;
+typedef DWORD near *PDWORD;
+typedef DWORD far *LPDWORD;
+typedef WORD near *PWORD;
+typedef WORD far *LPWORD;
+typedef long far *LPLONG;
+typedef FLOAT *PFLOAT;
+typedef BOOL near *PBOOL;
+typedef BOOL far *LPBOOL;
+typedef BYTE near *PBYTE;
+typedef BYTE far *LPBYTE;
+typedef int near *PINT;
+typedef int far *LPINT;
+typedef void near *PVOID;
+typedef void far *LPVOID;
+typedef CONST void far *LPCVOID;
+typedef unsigned int *PUINT;
+
+typedef SHORT *PSHORT;
+typedef LONG *PLONG;
+
+// -------------------------------------------------------------------------
+//
+// The following types are guaranteed to be signed and 32 bits wide.
+//
+
+typedef int LONG32, *PLONG32;
+typedef int INT32, *PINT32;
+
+//
+// The following types are guaranteed to be unsigned and 32 bits wide.
+//
+
+typedef unsigned int ULONG32, *PULONG32;
+typedef unsigned int DWORD32, *PDWORD32;
+typedef unsigned int UINT32, *PUINT32;
+
+// -------------------------------------------------------------------------
+
+typedef DWORD COLORREF;
+typedef DWORD* LPCOLORREF;
+
+/* Types use for passing & returning polymorphic values */
+typedef UINT WPARAM;
+typedef LONG LPARAM;
+typedef LONG LRESULT;
+
+#define MAKEWORD(a, b) ((WORD)(((BYTE)(a)) | ((WORD)((BYTE)(b))) << 8))
+#define MAKELONG(a, b) ((LONG)(((WORD)(a)) | ((DWORD)((WORD)(b))) << 16))
+#define LOWORD(l) ((WORD)(l))
+#define HIWORD(l) ((WORD)(((DWORD)(l) >> 16) & 0xFFFF))
+#define LOBYTE(w) ((BYTE)(w))
+#define HIBYTE(w) ((BYTE)(((WORD)(w) >> 8) & 0xFF))
+
+// -------------------------------------------------------------------------
+
+typedef struct tagRECT
+{
+ LONG left;
+ LONG top;
+ LONG right;
+ LONG bottom;
+} RECT, *PRECT, NEAR *NPRECT, FAR *LPRECT;
+
+typedef const RECT FAR* LPCRECT;
+
+typedef struct _RECTL /* rcl */
+{
+ LONG left;
+ LONG top;
+ LONG right;
+ LONG bottom;
+} RECTL, *PRECTL, *LPRECTL;
+
+typedef const RECTL FAR* LPCRECTL;
+
+typedef struct tagPOINT
+{
+ LONG x;
+ LONG y;
+} POINT, *PPOINT, NEAR *NPPOINT, FAR *LPPOINT;
+
+typedef struct _POINTL /* ptl */
+{
+ LONG x;
+ LONG y;
+} POINTL, *PPOINTL;
+
+typedef struct tagSIZE
+{
+ LONG cx;
+ LONG cy;
+} SIZE, *PSIZE, *LPSIZE;
+
+typedef SIZE SIZEL;
+typedef SIZE *PSIZEL, *LPSIZEL;
+
+typedef struct tagPOINTS
+{
+#ifndef _MAC
+ SHORT x;
+ SHORT y;
+#else
+ SHORT y;
+ SHORT x;
+#endif
+} POINTS, *PPOINTS, *LPPOINTS;
+
+// -------------------------------------------------------------------------
+// HRESULT
+
+#ifndef _HRESULT_DEFINED
+#define _HRESULT_DEFINED
+
+typedef LONG HRESULT;
+
+#endif // !_HRESULT_DEFINED
+
+// -------------------------------------------------------------------------
+////////////////////////////////////////////////////////////////////////
+// //
+// ACCESS MASK //
+// //
+////////////////////////////////////////////////////////////////////////
+
+//
+// Define the access mask as a longword sized structure divided up as
+// follows:
+//
+// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
+// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+// +---------------+---------------+-------------------------------+
+// |G|G|G|G|Res'd|A| StandardRights| SpecificRights |
+// |R|W|E|A| |S| | |
+// +-+-------------+---------------+-------------------------------+
+//
+// typedef struct _ACCESS_MASK {
+// WORD SpecificRights;
+// BYTE StandardRights;
+// BYTE AccessSystemAcl : 1;
+// BYTE Reserved : 3;
+// BYTE GenericAll : 1;
+// BYTE GenericExecute : 1;
+// BYTE GenericWrite : 1;
+// BYTE GenericRead : 1;
+// } ACCESS_MASK;
+// typedef ACCESS_MASK *PACCESS_MASK;
+//
+// but to make life simple for programmer's we'll allow them to specify
+// a desired access mask by simply OR'ing together mulitple single rights
+// and treat an access mask as a DWORD. For example
+//
+// DesiredAccess = DELETE | READ_CONTROL
+//
+// So we'll declare ACCESS_MASK as DWORD
+//
+
+// begin_ntddk begin_wdm begin_nthal begin_ntifs
+typedef DWORD ACCESS_MASK;
+typedef ACCESS_MASK *PACCESS_MASK;
+
+// -------------------------------------------------------------------------
+//
+// A language ID is a 16 bit value which is the combination of a
+// primary language ID and a secondary language ID. The bits are
+// allocated as follows:
+//
+// +-----------------------+-------------------------+
+// | Sublanguage ID | Primary Language ID |
+// +-----------------------+-------------------------+
+// 15 10 9 0 bit
+//
+//
+// Language ID creation/extraction macros:
+//
+// MAKELANGID - construct language id from a primary language id and
+// a sublanguage id.
+// PRIMARYLANGID - extract primary language id from a language id.
+// SUBLANGID - extract sublanguage id from a language id.
+//
+
+#define MAKELANGID(p, s) ((((WORD )(s)) << 10) | (WORD )(p))
+#define PRIMARYLANGID(lgid) ((WORD )(lgid) & 0x3ff)
+#define SUBLANGID(lgid) ((WORD )(lgid) >> 10)
+
+//
+// Language IDs.
+//
+// The following two combinations of primary language ID and
+// sublanguage ID have special semantics:
+//
+// Primary Language ID Sublanguage ID Result
+// ------------------- --------------- ------------------------
+// LANG_NEUTRAL SUBLANG_NEUTRAL Language neutral
+// LANG_NEUTRAL SUBLANG_DEFAULT User default language
+// LANG_NEUTRAL SUBLANG_SYS_DEFAULT System default language
+//
+
+//
+// Primary language IDs.
+//
+
+#define LANG_NEUTRAL 0x00
+
+#define LANG_AFRIKAANS 0x36
+#define LANG_ALBANIAN 0x1c
+#define LANG_ARABIC 0x01
+#define LANG_ARMENIAN 0x2b
+#define LANG_ASSAMESE 0x4d
+#define LANG_AZERI 0x2c
+#define LANG_BASQUE 0x2d
+#define LANG_BELARUSIAN 0x23
+#define LANG_BENGALI 0x45
+#define LANG_BULGARIAN 0x02
+#define LANG_CATALAN 0x03
+#define LANG_CHINESE 0x04
+#define LANG_CROATIAN 0x1a
+#define LANG_CZECH 0x05
+#define LANG_DANISH 0x06
+#define LANG_DUTCH 0x13
+#define LANG_ENGLISH 0x09
+#define LANG_ESTONIAN 0x25
+#define LANG_FAEROESE 0x38
+#define LANG_FARSI 0x29
+#define LANG_FINNISH 0x0b
+#define LANG_FRENCH 0x0c
+#define LANG_GEORGIAN 0x37
+#define LANG_GERMAN 0x07
+#define LANG_GREEK 0x08
+#define LANG_GUJARATI 0x47
+#define LANG_HEBREW 0x0d
+#define LANG_HINDI 0x39
+#define LANG_HUNGARIAN 0x0e
+#define LANG_ICELANDIC 0x0f
+#define LANG_INDONESIAN 0x21
+#define LANG_ITALIAN 0x10
+#define LANG_JAPANESE 0x11
+#define LANG_KANNADA 0x4b
+#define LANG_KASHMIRI 0x60
+#define LANG_KAZAK 0x3f
+#define LANG_KONKANI 0x57
+#define LANG_KOREAN 0x12
+#define LANG_LATVIAN 0x26
+#define LANG_LITHUANIAN 0x27
+#define LANG_MACEDONIAN 0x2f
+#define LANG_MALAY 0x3e
+#define LANG_MALAYALAM 0x4c
+#define LANG_MANIPURI 0x58
+#define LANG_MARATHI 0x4e
+#define LANG_NEPALI 0x61
+#define LANG_NORWEGIAN 0x14
+#define LANG_ORIYA 0x48
+#define LANG_POLISH 0x15
+#define LANG_PORTUGUESE 0x16
+#define LANG_PUNJABI 0x46
+#define LANG_ROMANIAN 0x18
+#define LANG_RUSSIAN 0x19
+#define LANG_SANSKRIT 0x4f
+#define LANG_SERBIAN 0x1a
+#define LANG_SINDHI 0x59
+#define LANG_SLOVAK 0x1b
+#define LANG_SLOVENIAN 0x24
+#define LANG_SPANISH 0x0a
+#define LANG_SWAHILI 0x41
+#define LANG_SWEDISH 0x1d
+#define LANG_TAMIL 0x49
+#define LANG_TATAR 0x44
+#define LANG_TELUGU 0x4a
+#define LANG_THAI 0x1e
+#define LANG_TURKISH 0x1f
+#define LANG_UKRAINIAN 0x22
+#define LANG_URDU 0x20
+#define LANG_UZBEK 0x43
+#define LANG_VIETNAMESE 0x2a
+
+//
+// Sublanguage IDs.
+//
+// The name immediately following SUBLANG_ dictates which primary
+// language ID that sublanguage ID can be combined with to form a
+// valid language ID.
+//
+
+#define SUBLANG_NEUTRAL 0x00 // language neutral
+#define SUBLANG_DEFAULT 0x01 // user default
+#define SUBLANG_SYS_DEFAULT 0x02 // system default
+
+#define SUBLANG_ARABIC_SAUDI_ARABIA 0x01 // Arabic (Saudi Arabia)
+#define SUBLANG_ARABIC_IRAQ 0x02 // Arabic (Iraq)
+#define SUBLANG_ARABIC_EGYPT 0x03 // Arabic (Egypt)
+#define SUBLANG_ARABIC_LIBYA 0x04 // Arabic (Libya)
+#define SUBLANG_ARABIC_ALGERIA 0x05 // Arabic (Algeria)
+#define SUBLANG_ARABIC_MOROCCO 0x06 // Arabic (Morocco)
+#define SUBLANG_ARABIC_TUNISIA 0x07 // Arabic (Tunisia)
+#define SUBLANG_ARABIC_OMAN 0x08 // Arabic (Oman)
+#define SUBLANG_ARABIC_YEMEN 0x09 // Arabic (Yemen)
+#define SUBLANG_ARABIC_SYRIA 0x0a // Arabic (Syria)
+#define SUBLANG_ARABIC_JORDAN 0x0b // Arabic (Jordan)
+#define SUBLANG_ARABIC_LEBANON 0x0c // Arabic (Lebanon)
+#define SUBLANG_ARABIC_KUWAIT 0x0d // Arabic (Kuwait)
+#define SUBLANG_ARABIC_UAE 0x0e // Arabic (U.A.E)
+#define SUBLANG_ARABIC_BAHRAIN 0x0f // Arabic (Bahrain)
+#define SUBLANG_ARABIC_QATAR 0x10 // Arabic (Qatar)
+#define SUBLANG_AZERI_LATIN 0x01 // Azeri (Latin)
+#define SUBLANG_AZERI_CYRILLIC 0x02 // Azeri (Cyrillic)
+#define SUBLANG_CHINESE_TRADITIONAL 0x01 // Chinese (Taiwan Region)
+#define SUBLANG_CHINESE_SIMPLIFIED 0x02 // Chinese (PR China)
+#define SUBLANG_CHINESE_HONGKONG 0x03 // Chinese (Hong Kong)
+#define SUBLANG_CHINESE_SINGAPORE 0x04 // Chinese (Singapore)
+#define SUBLANG_CHINESE_MACAU 0x05 // Chinese (Macau)
+#define SUBLANG_DUTCH 0x01 // Dutch
+#define SUBLANG_DUTCH_BELGIAN 0x02 // Dutch (Belgian)
+#define SUBLANG_ENGLISH_US 0x01 // English (USA)
+#define SUBLANG_ENGLISH_UK 0x02 // English (UK)
+#define SUBLANG_ENGLISH_AUS 0x03 // English (Australian)
+#define SUBLANG_ENGLISH_CAN 0x04 // English (Canadian)
+#define SUBLANG_ENGLISH_NZ 0x05 // English (New Zealand)
+#define SUBLANG_ENGLISH_EIRE 0x06 // English (Irish)
+#define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07 // English (South Africa)
+#define SUBLANG_ENGLISH_JAMAICA 0x08 // English (Jamaica)
+#define SUBLANG_ENGLISH_CARIBBEAN 0x09 // English (Caribbean)
+#define SUBLANG_ENGLISH_BELIZE 0x0a // English (Belize)
+#define SUBLANG_ENGLISH_TRINIDAD 0x0b // English (Trinidad)
+#define SUBLANG_ENGLISH_ZIMBABWE 0x0c // English (Zimbabwe)
+#define SUBLANG_ENGLISH_PHILIPPINES 0x0d // English (Philippines)
+#define SUBLANG_FRENCH 0x01 // French
+#define SUBLANG_FRENCH_BELGIAN 0x02 // French (Belgian)
+#define SUBLANG_FRENCH_CANADIAN 0x03 // French (Canadian)
+#define SUBLANG_FRENCH_SWISS 0x04 // French (Swiss)
+#define SUBLANG_FRENCH_LUXEMBOURG 0x05 // French (Luxembourg)
+#define SUBLANG_FRENCH_MONACO 0x06 // French (Monaco)
+#define SUBLANG_GERMAN 0x01 // German
+#define SUBLANG_GERMAN_SWISS 0x02 // German (Swiss)
+#define SUBLANG_GERMAN_AUSTRIAN 0x03 // German (Austrian)
+#define SUBLANG_GERMAN_LUXEMBOURG 0x04 // German (Luxembourg)
+#define SUBLANG_GERMAN_LIECHTENSTEIN 0x05 // German (Liechtenstein)
+#define SUBLANG_ITALIAN 0x01 // Italian
+#define SUBLANG_ITALIAN_SWISS 0x02 // Italian (Swiss)
+#define SUBLANG_KASHMIRI_INDIA 0x02 // Kashmiri (India)
+#define SUBLANG_KOREAN 0x01 // Korean (Extended Wansung)
+#define SUBLANG_LITHUANIAN 0x01 // Lithuanian
+#define SUBLANG_LITHUANIAN_CLASSIC 0x02 // Lithuanian (Classic)
+#define SUBLANG_MALAY_MALAYSIA 0x01 // Malay (Malaysia)
+#define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02 // Malay (Brunei Darussalam)
+#define SUBLANG_NEPALI_INDIA 0x02 // Nepali (India)
+#define SUBLANG_NORWEGIAN_BOKMAL 0x01 // Norwegian (Bokmal)
+#define SUBLANG_NORWEGIAN_NYNORSK 0x02 // Norwegian (Nynorsk)
+#define SUBLANG_PORTUGUESE 0x02 // Portuguese
+#define SUBLANG_PORTUGUESE_BRAZILIAN 0x01 // Portuguese (Brazilian)
+#define SUBLANG_SERBIAN_LATIN 0x02 // Serbian (Latin)
+#define SUBLANG_SERBIAN_CYRILLIC 0x03 // Serbian (Cyrillic)
+#define SUBLANG_SPANISH 0x01 // Spanish (Castilian)
+#define SUBLANG_SPANISH_MEXICAN 0x02 // Spanish (Mexican)
+#define SUBLANG_SPANISH_MODERN 0x03 // Spanish (Modern)
+#define SUBLANG_SPANISH_GUATEMALA 0x04 // Spanish (Guatemala)
+#define SUBLANG_SPANISH_COSTA_RICA 0x05 // Spanish (Costa Rica)
+#define SUBLANG_SPANISH_PANAMA 0x06 // Spanish (Panama)
+#define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07 // Spanish (Dominican Republic)
+#define SUBLANG_SPANISH_VENEZUELA 0x08 // Spanish (Venezuela)
+#define SUBLANG_SPANISH_COLOMBIA 0x09 // Spanish (Colombia)
+#define SUBLANG_SPANISH_PERU 0x0a // Spanish (Peru)
+#define SUBLANG_SPANISH_ARGENTINA 0x0b // Spanish (Argentina)
+#define SUBLANG_SPANISH_ECUADOR 0x0c // Spanish (Ecuador)
+#define SUBLANG_SPANISH_CHILE 0x0d // Spanish (Chile)
+#define SUBLANG_SPANISH_URUGUAY 0x0e // Spanish (Uruguay)
+#define SUBLANG_SPANISH_PARAGUAY 0x0f // Spanish (Paraguay)
+#define SUBLANG_SPANISH_BOLIVIA 0x10 // Spanish (Bolivia)
+#define SUBLANG_SPANISH_EL_SALVADOR 0x11 // Spanish (El Salvador)
+#define SUBLANG_SPANISH_HONDURAS 0x12 // Spanish (Honduras)
+#define SUBLANG_SPANISH_NICARAGUA 0x13 // Spanish (Nicaragua)
+#define SUBLANG_SPANISH_PUERTO_RICO 0x14 // Spanish (Puerto Rico)
+#define SUBLANG_SWEDISH 0x01 // Swedish
+#define SUBLANG_SWEDISH_FINLAND 0x02 // Swedish (Finland)
+#define SUBLANG_URDU_PAKISTAN 0x01 // Urdu (Pakistan)
+#define SUBLANG_URDU_INDIA 0x02 // Urdu (India)
+#define SUBLANG_UZBEK_LATIN 0x01 // Uzbek (Latin)
+#define SUBLANG_UZBEK_CYRILLIC 0x02 // Uzbek (Cyrillic)
+
+// -------------------------------------------------------------------------
+// $Log: $
+
+#endif /* __BOOST_MEMORY_WINAPI_WINDEF_H__ */

Added: sandbox/memory/boost/memory/winapi/wtypes.h
==============================================================================
--- (empty file)
+++ sandbox/memory/boost/memory/winapi/wtypes.h 2008-04-28 21:16:17 EDT (Mon, 28 Apr 2008)
@@ -0,0 +1,235 @@
+//
+// boost/memory/winapi/wtypes.h (*)
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// 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)
+//
+// See http://www.boost.org/libs/memory/index.htm for documentation.
+//
+#ifndef __BOOST_MEMORY_WINAPI_WTYPES_H__
+#define __BOOST_MEMORY_WINAPI_WTYPES_H__
+
+#if !defined(BOOST_NO_WINSDK)
+#error "Don't include <winapi/wtypes.h>"
+#endif
+
+#ifndef __BOOST_MEMORY_WINAPI_WINDEF_H__
+#include "windef.h"
+#endif
+
+// =========================================================================
+
+typedef unsigned char byte;
+typedef wchar_t WCHAR;
+
+typedef WCHAR OLECHAR;
+typedef OLECHAR* LPOLESTR;
+typedef const OLECHAR* LPCOLESTR;
+typedef OLECHAR* BSTR;
+typedef double DATE;
+
+// =========================================================================
+
+#if defined(_UNICODE)
+typedef WCHAR TCHAR;
+#else
+typedef CHAR TCHAR;
+#endif
+
+// =========================================================================
+
+typedef /* [string] */ WCHAR __RPC_FAR *LPWSTR;
+
+typedef /* [string] */ TCHAR __RPC_FAR *LPTSTR;
+
+typedef /* [string] */ const WCHAR __RPC_FAR *LPCWSTR;
+
+typedef /* [string] */ const TCHAR __RPC_FAR *LPCTSTR;
+
+// =========================================================================
+
+#if defined(__GNUG__)
+typedef long long __int64;
+typedef unsigned long long __uint64;
+#endif
+
+typedef __int64 LONG64, *PLONG64;
+typedef __int64 INT64, *PINT64;
+
+typedef __uint64 ULONG64, *PULONG64;
+typedef __uint64 DWORD64, *PDWORD64;
+typedef __uint64 UINT64, *PUINT64;
+
+typedef __int64 LONGLONG;
+typedef __uint64 ULONGLONG;
+
+// =========================================================================
+
+typedef union _LARGE_INTEGER {
+ struct {
+ DWORD LowPart;
+ LONG HighPart;
+ };
+ struct {
+ DWORD LowPart;
+ LONG HighPart;
+ } u;
+ LONGLONG QuadPart;
+} LARGE_INTEGER;
+
+typedef union _ULARGE_INTEGER {
+ struct {
+ DWORD LowPart;
+ DWORD HighPart;
+ };
+ struct {
+ DWORD LowPart;
+ DWORD HighPart;
+ } u;
+ ULONGLONG QuadPart;
+} ULARGE_INTEGER;
+
+typedef ULARGE_INTEGER *PULARGE_INTEGER;
+
+// =========================================================================
+
+#ifndef _FILETIME_
+#define _FILETIME_
+
+typedef struct _FILETIME
+ {
+ DWORD dwLowDateTime;
+ DWORD dwHighDateTime;
+ } FILETIME;
+
+typedef struct _FILETIME __RPC_FAR *PFILETIME;
+typedef struct _FILETIME __RPC_FAR *LPFILETIME;
+
+#endif // !_FILETIME
+
+#ifndef _SYSTEMTIME_
+#define _SYSTEMTIME_
+
+typedef struct _SYSTEMTIME
+ {
+ WORD wYear;
+ WORD wMonth;
+ WORD wDayOfWeek;
+ WORD wDay;
+ WORD wHour;
+ WORD wMinute;
+ WORD wSecond;
+ WORD wMilliseconds;
+ } SYSTEMTIME;
+
+typedef struct _SYSTEMTIME __RPC_FAR *PSYSTEMTIME;
+typedef struct _SYSTEMTIME __RPC_FAR *LPSYSTEMTIME;
+
+#endif // !_SYSTEMTIME
+
+// -------------------------------------------------------------------------
+
+#ifndef _SECURITY_ATTRIBUTES_
+#define _SECURITY_ATTRIBUTES_
+typedef struct _SECURITY_ATTRIBUTES
+ {
+ DWORD nLength;
+ /* [size_is] */ LPVOID lpSecurityDescriptor;
+ BOOL bInheritHandle;
+ } SECURITY_ATTRIBUTES;
+
+typedef struct _SECURITY_ATTRIBUTES __RPC_FAR *PSECURITY_ATTRIBUTES;
+typedef struct _SECURITY_ATTRIBUTES __RPC_FAR *LPSECURITY_ATTRIBUTES;
+
+#endif // !_SECURITY_ATTRIBUTES_
+
+// =========================================================================
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(1)
+typedef struct _GUID
+{
+ unsigned long Data1;
+ unsigned short Data2;
+ unsigned short Data3;
+ unsigned char Data4[8];
+} GUID;
+#pragma pack()
+
+typedef GUID IID;
+typedef GUID CLSID;
+
+typedef CLSID __RPC_FAR* LPCLSID;
+typedef IID __RPC_FAR* LPIID;
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+// =========================================================================
+
+typedef const IID& REFIID;
+typedef const CLSID& REFCLSID;
+typedef const GUID& REFGUID;
+
+// =========================================================================
+// HANDLE
+
+#define DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef struct name##__ *name
+
+DECLARE_HANDLE(HINSTANCE);
+
+typedef PVOID HANDLE;
+typedef HINSTANCE HMODULE; /* HMODULEs can be used in place of HINSTANCEs */
+
+typedef HANDLE HGLOBAL;
+typedef HANDLE HLOCAL;
+
+typedef /* [wire_marshal] */ void __RPC_FAR *HMETAFILEPICT;
+
+// -------------------------------------------------------------------------
+
+DECLARE_HANDLE(HGDIOBJ);
+DECLARE_HANDLE(HBITMAP);
+DECLARE_HANDLE(HBRUSH);
+DECLARE_HANDLE(HDC);
+DECLARE_HANDLE(HFONT);
+DECLARE_HANDLE(HICON);
+DECLARE_HANDLE(HCURSOR);
+DECLARE_HANDLE(HMENU);
+DECLARE_HANDLE(HPALETTE);
+DECLARE_HANDLE(HPEN);
+DECLARE_HANDLE(HRGN);
+DECLARE_HANDLE(HRSRC);
+DECLARE_HANDLE(HSTR);
+DECLARE_HANDLE(HTASK);
+DECLARE_HANDLE(HWINSTA);
+DECLARE_HANDLE(HKL);
+DECLARE_HANDLE(HACCEL);
+
+DECLARE_HANDLE(HGLRC); // OpenGL
+DECLARE_HANDLE(HDESK);
+DECLARE_HANDLE(HMETAFILE);
+DECLARE_HANDLE(HENHMETAFILE);
+
+// -------------------------------------------------------------------------
+
+DECLARE_HANDLE(HKEY);
+typedef HKEY *PHKEY;
+
+//
+// Requested Key access mask type.
+//
+
+typedef ACCESS_MASK REGSAM;
+
+// =========================================================================
+// $Log: $
+
+#endif /* __BOOST_MEMORY_WINAPI_WTYPES_H__ */


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk