mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-19 21:32:58 -04:00
VC7 allocator support, and *_ALLOCATOR cleanup
This commit is contained in:
parent
07565f943f
commit
5146588a8d
@ -105,5 +105,6 @@
|
|||||||
// Must global operator new and delete functions throw exceptions?
|
// Must global operator new and delete functions throw exceptions?
|
||||||
#define GLOBAL_OPERATOR_NEW_EXCEPTIONS
|
#define GLOBAL_OPERATOR_NEW_EXCEPTIONS
|
||||||
|
|
||||||
// Do we expect the old STL allocator?
|
// What is the syntax of the STL allocator declaration? See
|
||||||
#define OLD_STYLE_ALLOCATOR 1
|
// LocalSetup.pp for allowable values.
|
||||||
|
#define STL_ALLOCATOR OLD
|
||||||
|
@ -105,5 +105,6 @@
|
|||||||
// Must global operator new and delete functions throw exceptions?
|
// Must global operator new and delete functions throw exceptions?
|
||||||
#define GLOBAL_OPERATOR_NEW_EXCEPTIONS 1
|
#define GLOBAL_OPERATOR_NEW_EXCEPTIONS 1
|
||||||
|
|
||||||
// What style STL allocator should we declare?
|
// What is the syntax of the STL allocator declaration? See
|
||||||
#define GNU_STYLE_ALLOCATOR 1
|
// LocalSetup.pp for allowable values.
|
||||||
|
#define STL_ALLOCATOR GNU
|
||||||
|
@ -105,12 +105,10 @@
|
|||||||
// Must global operator new and delete functions throw exceptions?
|
// Must global operator new and delete functions throw exceptions?
|
||||||
#define GLOBAL_OPERATOR_NEW_EXCEPTIONS
|
#define GLOBAL_OPERATOR_NEW_EXCEPTIONS
|
||||||
|
|
||||||
// Do we expect the old STL allocator?
|
// What is the syntax of the STL allocator declaration? See
|
||||||
// this indicates OLD_STYLE_ALLOCATOR is NOT used (defined as the empty string)
|
// LocalSetup.pp for allowable values.
|
||||||
#define OLD_STYLE_ALLOCATOR
|
//#define STL_ALLOCATOR VC6
|
||||||
|
#define STL_ALLOCATOR MODERN
|
||||||
// this is reqd for msvc 7.0 to build (beta-only, havent tested final). Default on for Opt4, off otherwise
|
|
||||||
//#define USE_UNKNOWN_ALLOCATOR 1
|
|
||||||
|
|
||||||
// can Intel C++ build this directory successfully (if not, change CC to msvc)
|
// can Intel C++ build this directory successfully (if not, change CC to msvc)
|
||||||
#define NOT_INTEL_BUILDABLE false
|
#define NOT_INTEL_BUILDABLE false
|
||||||
|
@ -91,7 +91,7 @@
|
|||||||
// 3 - Full compiler optimizations, no debug symbols
|
// 3 - Full compiler optimizations, no debug symbols
|
||||||
// 4 - Full optimizations, no debug symbols, and asserts removed
|
// 4 - Full optimizations, no debug symbols, and asserts removed
|
||||||
//
|
//
|
||||||
|
#define OPTIMIZE 3
|
||||||
|
|
||||||
// NOTE: In the following, to indicate "yes" to a yes/no question,
|
// NOTE: In the following, to indicate "yes" to a yes/no question,
|
||||||
// define the variable to be a nonempty string. To indicate "no",
|
// define the variable to be a nonempty string. To indicate "no",
|
||||||
@ -154,6 +154,13 @@
|
|||||||
// to enable it only for optimize levels 1 and 2.
|
// to enable it only for optimize levels 1 and 2.
|
||||||
#defer TRACK_IN_INTERPRETER $[<= $[OPTIMIZE], 2]
|
#defer TRACK_IN_INTERPRETER $[<= $[OPTIMIZE], 2]
|
||||||
|
|
||||||
|
// Do you want to compile in support for tracking memory usage? This
|
||||||
|
// enables you to define the variable "track-memory-usage" at runtime
|
||||||
|
// to help track memory leaks, and also report total memory usage on
|
||||||
|
// PStats. There is some small overhead for having this ability
|
||||||
|
// available, even if it is unused.
|
||||||
|
#defer DO_MEMORY_USAGE $[<= $[OPTIMIZE], 3]
|
||||||
|
|
||||||
// Do you want to compile in support for pipelining? This enables
|
// Do you want to compile in support for pipelining? This enables
|
||||||
// setting and accessing multiple different copies of frame-specific
|
// setting and accessing multiple different copies of frame-specific
|
||||||
// data stored in nodes, etc. At the moment, Panda cannot actually
|
// data stored in nodes, etc. At the moment, Panda cannot actually
|
||||||
|
@ -38,6 +38,9 @@ $[cdefine HAVE_PYTHON]
|
|||||||
/* Define if we want to track callbacks from within the show code. */
|
/* Define if we want to track callbacks from within the show code. */
|
||||||
$[cdefine TRACK_IN_INTERPRETER]
|
$[cdefine TRACK_IN_INTERPRETER]
|
||||||
|
|
||||||
|
/* Define if we want to enable track-memory-usage. */
|
||||||
|
$[cdefine DO_MEMORY_USAGE]
|
||||||
|
|
||||||
/* Define if we want to compile in support for pipelining. */
|
/* Define if we want to compile in support for pipelining. */
|
||||||
$[cdefine DO_PIPELINING]
|
$[cdefine DO_PIPELINING]
|
||||||
|
|
||||||
@ -212,13 +215,36 @@ $[cdefine HAVE_RTTI]
|
|||||||
$[cdefine GLOBAL_OPERATOR_NEW_EXCEPTIONS]
|
$[cdefine GLOBAL_OPERATOR_NEW_EXCEPTIONS]
|
||||||
|
|
||||||
/* What style STL allocator should we declare? */
|
/* What style STL allocator should we declare? */
|
||||||
|
#define OLD_STYLE_ALLOCATOR
|
||||||
// Use this to force UNKNOWN_ALLOCATOR for non-Opt4 (it is already default for Opt4 using /DUNKNOWN_ALLOCATOR)
|
#define GNU_STYLE_ALLOCATOR
|
||||||
// see dtoolbase.h
|
#define VC6_STYLE_ALLOCATOR
|
||||||
$[cdefine USE_UNKNOWN_ALLOCATOR]
|
#define MODERN_STYLE_ALLOCATOR
|
||||||
|
#define NO_STYLE_ALLOCATOR
|
||||||
|
#if $[eq $[OPTIMIZE], 4]
|
||||||
|
// In optimize level 4, we never try to use custom allocators.
|
||||||
|
#define NO_STYLE_ALLOCATOR 1
|
||||||
|
#elif $[eq $[STL_ALLOCATOR], OLD]
|
||||||
|
// "OLD": Irix 6.2-era STL.
|
||||||
|
#set OLD_STYLE_ALLOCATOR 1
|
||||||
|
#elif $[eq $[STL_ALLOCATOR], ECGS]
|
||||||
|
// "GNU": gcc 2.95-era.
|
||||||
|
#set GNU_STYLE_ALLOCATOR 1
|
||||||
|
#elif $[eq $[STL_ALLOCATOR], VC6]
|
||||||
|
// "VC6": Microsoft Visual C++ 6.
|
||||||
|
#set VC6_STYLE_ALLOCATOR 1
|
||||||
|
#elif $[eq $[STL_ALLOCATOR], MODERN]
|
||||||
|
// "MODERN": Have we finally come to a standard?
|
||||||
|
#set MODERN_STYLE_ALLOCATOR 1
|
||||||
|
#else
|
||||||
|
// Anything else is "unknown". We won't try to define allocators at
|
||||||
|
// all.
|
||||||
|
#set NO_STYLE_ALLOCATOR 1
|
||||||
|
#endif
|
||||||
$[cdefine OLD_STYLE_ALLOCATOR]
|
$[cdefine OLD_STYLE_ALLOCATOR]
|
||||||
$[cdefine GNU_STYLE_ALLOCATOR]
|
$[cdefine GNU_STYLE_ALLOCATOR]
|
||||||
|
$[cdefine VC6_STYLE_ALLOCATOR]
|
||||||
|
$[cdefine MODERN_STYLE_ALLOCATOR]
|
||||||
|
$[cdefine NO_STYLE_ALLOCATOR]
|
||||||
|
|
||||||
#end dtool_config.h
|
#end dtool_config.h
|
||||||
|
|
||||||
|
@ -15,8 +15,6 @@
|
|||||||
#define RELEASEFLAGS /MD
|
#define RELEASEFLAGS /MD
|
||||||
#define WARNING_LEVEL_FLAG /W3
|
#define WARNING_LEVEL_FLAG /W3
|
||||||
|
|
||||||
#define CDEFINES_OPT4 UNKNOWN_ALLOCATOR
|
|
||||||
|
|
||||||
// NODEFAULTLIB ensures static libs linked in will connect to the correct msvcrt, so no debug/release mixing occurs
|
// NODEFAULTLIB ensures static libs linked in will connect to the correct msvcrt, so no debug/release mixing occurs
|
||||||
#define LDFLAGS_OPT1 /NODEFAULTLIB:MSVCRT.LIB
|
#define LDFLAGS_OPT1 /NODEFAULTLIB:MSVCRT.LIB
|
||||||
#define LDFLAGS_OPT2 /NODEFAULTLIB:MSVCRT.LIB
|
#define LDFLAGS_OPT2 /NODEFAULTLIB:MSVCRT.LIB
|
||||||
@ -61,11 +59,10 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// remove 1-3 when allocator stuff is rewritten to build with VC7 STL
|
#define CDEFINES_OPT1
|
||||||
#define CDEFINES_OPT1 UNKNOWN_ALLOCATOR
|
#define CDEFINES_OPT2
|
||||||
#define CDEFINES_OPT2 UNKNOWN_ALLOCATOR
|
#define CDEFINES_OPT3
|
||||||
#define CDEFINES_OPT3 UNKNOWN_ALLOCATOR
|
#define CDEFINES_OPT4
|
||||||
#define CDEFINES_OPT4 UNKNOWN_ALLOCATOR
|
|
||||||
|
|
||||||
// NODEFAULTLIB ensures static libs linked in will connect to the correct msvcrt, so no debug/release mixing occurs
|
// NODEFAULTLIB ensures static libs linked in will connect to the correct msvcrt, so no debug/release mixing occurs
|
||||||
#define LDFLAGS_OPT1 /NODEFAULTLIB:MSVCRT.LIB
|
#define LDFLAGS_OPT1 /NODEFAULTLIB:MSVCRT.LIB
|
||||||
@ -126,8 +123,6 @@
|
|||||||
#define LDFLAGS_OPT4 /Qipo
|
#define LDFLAGS_OPT4 /Qipo
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CDEFINES_OPT4 UNKNOWN_ALLOCATOR
|
|
||||||
|
|
||||||
// NODEFAULTLIB ensures static libs linked in will connect to the correct msvcrt, so no debug/release mixing occurs
|
// NODEFAULTLIB ensures static libs linked in will connect to the correct msvcrt, so no debug/release mixing occurs
|
||||||
#define LDFLAGS_OPT1 /NODEFAULTLIB:MSVCRT.LIB
|
#define LDFLAGS_OPT1 /NODEFAULTLIB:MSVCRT.LIB
|
||||||
#define LDFLAGS_OPT2 /NODEFAULTLIB:MSVCRT.LIB
|
#define LDFLAGS_OPT2 /NODEFAULTLIB:MSVCRT.LIB
|
||||||
|
@ -22,8 +22,7 @@
|
|||||||
#include <dtoolbase.h>
|
#include <dtoolbase.h>
|
||||||
|
|
||||||
#include "config_setup.h"
|
#include "config_setup.h"
|
||||||
|
#include "pvector.h"
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
namespace Config {
|
namespace Config {
|
||||||
|
|
||||||
@ -67,7 +66,7 @@ class EXPCL_DTOOLCONFIG SymbolEnt {
|
|||||||
|
|
||||||
namespace Config {
|
namespace Config {
|
||||||
|
|
||||||
typedef std::vector<SymbolEnt> vector_SymbolEnt;
|
typedef ::vector_SymbolEnt vector_SymbolEnt;
|
||||||
|
|
||||||
#include "symbolEnt.I"
|
#include "symbolEnt.I"
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
#if defined(OLD_STYLE_ALLOCATOR)
|
#if defined(OLD_STYLE_ALLOCATOR)
|
||||||
|
|
||||||
#ifndef NDEBUG
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
INLINE Type *dallocator<Type>::
|
INLINE Type *dallocator<Type>::
|
||||||
allocate(size_t n) {
|
allocate(size_t n) {
|
||||||
@ -30,7 +29,6 @@ INLINE void dallocator<Type>::
|
|||||||
deallocate(void *p, size_t) {
|
deallocate(void *p, size_t) {
|
||||||
default_operator_delete(p);
|
default_operator_delete(p);
|
||||||
}
|
}
|
||||||
#endif // NDEBUG
|
|
||||||
|
|
||||||
#elif defined(GNU_STYLE_ALLOCATOR)
|
#elif defined(GNU_STYLE_ALLOCATOR)
|
||||||
|
|
||||||
@ -45,7 +43,6 @@ INLINE dallocator<Type>::
|
|||||||
dallocator(const dallocator<_Tp1> &) {
|
dallocator(const dallocator<_Tp1> &) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NDEBUG
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
INLINE Type *dallocator<Type>::
|
INLINE Type *dallocator<Type>::
|
||||||
allocate(size_t n) {
|
allocate(size_t n) {
|
||||||
@ -57,11 +54,19 @@ INLINE void dallocator<Type>::
|
|||||||
deallocate(void *p, size_t) {
|
deallocate(void *p, size_t) {
|
||||||
default_operator_delete(p);
|
default_operator_delete(p);
|
||||||
}
|
}
|
||||||
#endif // NDEBUG
|
|
||||||
|
|
||||||
#else // *_STYLE_ALLOCATOR
|
#elif MODERN_STYLE_ALLOCATOR
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
INLINE dallocator<Type>::
|
||||||
|
dallocator() {
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
INLINE dallocator<Type>::
|
||||||
|
dallocator(const allocator<Type> ©) {
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef NDEBUG
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
INLINE dallocator<Type>::pointer dallocator<Type>::
|
INLINE dallocator<Type>::pointer dallocator<Type>::
|
||||||
allocate(dallocator<Type>::size_type n, allocator<void>::const_pointer) {
|
allocate(dallocator<Type>::size_type n, allocator<void>::const_pointer) {
|
||||||
@ -74,6 +79,5 @@ INLINE void dallocator<Type>::
|
|||||||
deallocate(void *p, allocator<Type>::size_type) {
|
deallocate(void *p, allocator<Type>::size_type) {
|
||||||
default_operator_delete(p);
|
default_operator_delete(p);
|
||||||
}
|
}
|
||||||
#endif // NDEBUG
|
|
||||||
|
|
||||||
#endif // *_STYLE_ALLOCATOR
|
#endif // *_STYLE_ALLOCATOR
|
||||||
|
@ -35,20 +35,22 @@
|
|||||||
// within the MemoryUsage class itself.
|
// within the MemoryUsage class itself.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#if defined(UNKNOWN_ALLOCATOR)
|
#if defined(NO_STYLE_ALLOCATOR)
|
||||||
|
// If we're not trying to make custom allocators (either we don't know
|
||||||
|
// what kind of syntax this STL library wants, or we're compiling with
|
||||||
|
// OPTIMIZE 4), then simply use the standard allocator.
|
||||||
#define dallocator allocator
|
#define dallocator allocator
|
||||||
|
|
||||||
#elif defined(OLD_STYLE_ALLOCATOR)
|
#elif defined(OLD_STYLE_ALLOCATOR)
|
||||||
// Early versions of gcc wanted to use its own kind of allocator,
|
// Early versions of gcc wanted to use their own kind of allocator,
|
||||||
// somewhat different from the STL standard. Irix uses this one too.
|
// somewhat different from the STL standard. Irix uses this one too.
|
||||||
// It might be inherited from an early draft of the STL standard.
|
// It might be inherited from an early draft of the STL standard.
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
class dallocator : public alloc {
|
class dallocator : public alloc {
|
||||||
public:
|
public:
|
||||||
#ifndef NDEBUG
|
|
||||||
INLINE static Type *allocate(size_t n);
|
INLINE static Type *allocate(size_t n);
|
||||||
INLINE static void deallocate(void *p, size_t n);
|
INLINE static void deallocate(void *p, size_t n);
|
||||||
#endif // NDEBUG
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#elif defined(GNU_STYLE_ALLOCATOR)
|
#elif defined(GNU_STYLE_ALLOCATOR)
|
||||||
@ -62,31 +64,31 @@ public:
|
|||||||
template<class _Tp1>
|
template<class _Tp1>
|
||||||
INLINE dallocator(const dallocator<_Tp1> &other);
|
INLINE dallocator(const dallocator<_Tp1> &other);
|
||||||
|
|
||||||
#ifndef NDEBUG
|
|
||||||
INLINE Type *allocate(size_t n);
|
INLINE Type *allocate(size_t n);
|
||||||
INLINE void deallocate(void *p, size_t n);
|
INLINE void deallocate(void *p, size_t n);
|
||||||
#endif // NDEBUG
|
|
||||||
|
|
||||||
template <class _Tp1> struct rebind {
|
template <class _Tp1> struct rebind {
|
||||||
typedef dallocator<_Tp1> other;
|
typedef dallocator<_Tp1> other;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#else // *_STYLE_ALLOCATOR
|
#elif defined(MODERN_STYLE_ALLOCATOR)
|
||||||
|
|
||||||
// This is the correct allocator declaration as the current C++
|
// The final specification?
|
||||||
// standard defines it.
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
class dallocator : public allocator<Type> {
|
class dallocator : public allocator<Type> {
|
||||||
public:
|
public:
|
||||||
#ifndef NDEBUG
|
INLINE dallocator();
|
||||||
|
INLINE dallocator(const allocator<Type> ©);
|
||||||
INLINE pointer allocate(size_type n, allocator<void>::const_pointer hint = 0);
|
INLINE pointer allocate(size_type n, allocator<void>::const_pointer hint = 0);
|
||||||
INLINE void deallocate(void *p, size_type n);
|
INLINE void deallocate(void *p, size_type n);
|
||||||
#endif // NDEBUG
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
#error Unrecognized allocator symbol defined!
|
||||||
#endif // *_STYLE_ALLOCATOR
|
#endif // *_STYLE_ALLOCATOR
|
||||||
|
|
||||||
#if !defined(UNKNOWN_ALLOCATOR)
|
#ifndef NO_STYLE_ALLOCATOR
|
||||||
#include "dallocator.T"
|
#include "dallocator.T"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -71,10 +71,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif /* WIN32_VC */
|
#endif /* WIN32_VC */
|
||||||
|
|
||||||
#if defined(USE_UNKNOWN_ALLOCATOR) && !defined(UNKNOWN_ALLOCATOR)
|
|
||||||
#define UNKNOWN_ALLOCATOR 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "dtoolsymbols.h"
|
#include "dtoolsymbols.h"
|
||||||
|
|
||||||
#ifdef HAVE_MALLOC_H
|
#ifdef HAVE_MALLOC_H
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
#if defined(OLD_STYLE_ALLOCATOR)
|
#if defined(OLD_STYLE_ALLOCATOR)
|
||||||
|
|
||||||
#ifndef NDEBUG
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
INLINE Type *pallocator<Type>::
|
INLINE Type *pallocator<Type>::
|
||||||
allocate(size_t n) {
|
allocate(size_t n) {
|
||||||
@ -30,7 +29,6 @@ INLINE void pallocator<Type>::
|
|||||||
deallocate(void *p, size_t) {
|
deallocate(void *p, size_t) {
|
||||||
(*global_operator_delete)(p);
|
(*global_operator_delete)(p);
|
||||||
}
|
}
|
||||||
#endif // NDEBUG
|
|
||||||
|
|
||||||
#elif defined(GNU_STYLE_ALLOCATOR)
|
#elif defined(GNU_STYLE_ALLOCATOR)
|
||||||
|
|
||||||
@ -45,7 +43,6 @@ INLINE pallocator<Type>::
|
|||||||
pallocator(const pallocator<_Tp1> &) {
|
pallocator(const pallocator<_Tp1> &) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NDEBUG
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
INLINE Type *pallocator<Type>::
|
INLINE Type *pallocator<Type>::
|
||||||
allocate(size_t n) {
|
allocate(size_t n) {
|
||||||
@ -57,11 +54,29 @@ INLINE void pallocator<Type>::
|
|||||||
deallocate(void *p, size_t) {
|
deallocate(void *p, size_t) {
|
||||||
(*global_operator_delete)(p);
|
(*global_operator_delete)(p);
|
||||||
}
|
}
|
||||||
#endif // NDEBUG
|
|
||||||
|
|
||||||
#else // *_STYLE_ALLOCATOR
|
#elif VC6_STYLE_ALLOCATOR
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
INLINE pallocator<Type>::pointer pallocator<Type>::
|
||||||
|
allocate(pallocator<Type>::size_type n, allocator<void>::const_pointer) {
|
||||||
|
return (pallocator<Type>::pointer)(*global_operator_new)(n * sizeof(Type));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
INLINE void pallocator<Type>::
|
||||||
|
//deallocate(pallocator<Type>::pointer p, allocator<Type>::size_type) {
|
||||||
|
deallocate(void *p, allocator<Type>::size_type) {
|
||||||
|
(*global_operator_delete)(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif MODERN_STYLE_ALLOCATOR
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
INLINE pallocator<Type>::
|
||||||
|
pallocator() throw() {
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef NDEBUG
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
INLINE pallocator<Type>::pointer pallocator<Type>::
|
INLINE pallocator<Type>::pointer pallocator<Type>::
|
||||||
allocate(pallocator<Type>::size_type n, allocator<void>::const_pointer) {
|
allocate(pallocator<Type>::size_type n, allocator<void>::const_pointer) {
|
||||||
@ -74,6 +89,5 @@ INLINE void pallocator<Type>::
|
|||||||
deallocate(void *p, allocator<Type>::size_type) {
|
deallocate(void *p, allocator<Type>::size_type) {
|
||||||
(*global_operator_delete)(p);
|
(*global_operator_delete)(p);
|
||||||
}
|
}
|
||||||
#endif // NDEBUG
|
|
||||||
|
|
||||||
#endif // *_STYLE_ALLOCATOR
|
#endif // *_STYLE_ALLOCATOR
|
||||||
|
@ -34,21 +34,22 @@
|
|||||||
// to use a pallocator.
|
// to use a pallocator.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#if defined(UNKNOWN_ALLOCATOR)
|
#if defined(NO_STYLE_ALLOCATOR)
|
||||||
|
// If we're not trying to make custom allocators (either we don't know
|
||||||
|
// what kind of syntax this STL library wants, or we're compiling with
|
||||||
|
// OPTIMIZE 4), then simply use the standard allocator.
|
||||||
#define pallocator allocator
|
#define pallocator allocator
|
||||||
|
|
||||||
#elif defined(OLD_STYLE_ALLOCATOR)
|
#elif defined(OLD_STYLE_ALLOCATOR)
|
||||||
// Early versions of gcc wanted to use its own kind of allocator,
|
// Early versions of gcc wanted to use their own kind of allocator,
|
||||||
// somewhat different from the STL standard. Irix uses this one too.
|
// somewhat different from the STL standard. Irix uses this one too.
|
||||||
// It might be inherited from an early draft of the STL standard.
|
// It might be inherited from an early draft of the STL standard.
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
class pallocator : public alloc {
|
class pallocator : public alloc {
|
||||||
public:
|
public:
|
||||||
#ifndef NDEBUG
|
|
||||||
INLINE static Type *allocate(size_t n);
|
INLINE static Type *allocate(size_t n);
|
||||||
INLINE static void deallocate(void *p, size_t n);
|
INLINE static void deallocate(void *p, size_t n);
|
||||||
#endif // NDEBUG
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#elif defined(GNU_STYLE_ALLOCATOR)
|
#elif defined(GNU_STYLE_ALLOCATOR)
|
||||||
@ -62,31 +63,48 @@ public:
|
|||||||
template<class _Tp1>
|
template<class _Tp1>
|
||||||
INLINE pallocator(const pallocator<_Tp1> &other);
|
INLINE pallocator(const pallocator<_Tp1> &other);
|
||||||
|
|
||||||
#ifndef NDEBUG
|
|
||||||
INLINE Type *allocate(size_t n);
|
INLINE Type *allocate(size_t n);
|
||||||
INLINE void deallocate(void *p, size_t n);
|
INLINE void deallocate(void *p, size_t n);
|
||||||
#endif // NDEBUG
|
|
||||||
|
|
||||||
template <class _Tp1> struct rebind {
|
template <class _Tp1> struct rebind {
|
||||||
typedef pallocator<_Tp1> other;
|
typedef pallocator<_Tp1> other;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#else // *_STYLE_ALLOCATOR
|
#elif defined(VC6_STYLE_ALLOCATOR)
|
||||||
|
|
||||||
// This is the correct allocator declaration as the current C++
|
// The VC6-era definition.
|
||||||
// standard defines it.
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
class pallocator : public allocator<Type> {
|
class pallocator : public allocator<Type> {
|
||||||
public:
|
public:
|
||||||
#ifndef NDEBUG
|
|
||||||
INLINE pointer allocate(size_type n, allocator<void>::const_pointer hint = 0);
|
INLINE pointer allocate(size_type n, allocator<void>::const_pointer hint = 0);
|
||||||
INLINE void deallocate(void *p, size_type n);
|
INLINE void deallocate(void *p, size_type n);
|
||||||
#endif // NDEBUG
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#elif defined(MODERN_STYLE_ALLOCATOR)
|
||||||
|
|
||||||
|
// The final specification?
|
||||||
|
template<class Type>
|
||||||
|
class pallocator : public allocator<Type> {
|
||||||
|
public:
|
||||||
|
INLINE pallocator() throw();
|
||||||
|
|
||||||
|
// template member functions in VC++ can only be defined in-class.
|
||||||
|
template<class U>
|
||||||
|
INLINE pallocator(const pallocator<U> ©) throw() { }
|
||||||
|
|
||||||
|
INLINE pointer allocate(size_type n, allocator<void>::const_pointer hint = 0);
|
||||||
|
INLINE void deallocate(void *p, size_type n);
|
||||||
|
|
||||||
|
template<class U>
|
||||||
|
struct rebind { typedef pallocator<U> other; };
|
||||||
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
#error Unrecognized allocator symbol defined!
|
||||||
#endif // *_STYLE_ALLOCATOR
|
#endif // *_STYLE_ALLOCATOR
|
||||||
|
|
||||||
#if !defined(UNKNOWN_ALLOCATOR)
|
#ifndef NO_STYLE_ALLOCATOR
|
||||||
#include "pallocator.T"
|
#include "pallocator.T"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -23,7 +23,9 @@
|
|||||||
#include "pallocator.h"
|
#include "pallocator.h"
|
||||||
#include <deque>
|
#include <deque>
|
||||||
|
|
||||||
#ifdef UNKNOWN_ALLOCATOR
|
#ifdef NO_STYLE_ALLOCATOR
|
||||||
|
// If we're not using custom allocators, just use the standard class
|
||||||
|
// definition.
|
||||||
#define pdeque deque
|
#define pdeque deque
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@ -44,5 +46,5 @@ public:
|
|||||||
pdeque(size_type n, const Type &value) : deque<Type, pallocator<Type> >(n, value) { }
|
pdeque(size_type n, const Type &value) : deque<Type, pallocator<Type> >(n, value) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // NO_STYLE_ALLOCATOR
|
||||||
#endif
|
#endif
|
||||||
|
@ -23,7 +23,9 @@
|
|||||||
#include "pallocator.h"
|
#include "pallocator.h"
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
#ifdef UNKNOWN_ALLOCATOR
|
#ifdef NO_STYLE_ALLOCATOR
|
||||||
|
// If we're not using custom allocators, just use the standard class
|
||||||
|
// definition.
|
||||||
#define plist list
|
#define plist list
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@ -50,5 +52,5 @@ public:
|
|||||||
typedef list<Type, pallocator<Type> >::const_reverse_iterator const_reverse_iterator;
|
typedef list<Type, pallocator<Type> >::const_reverse_iterator const_reverse_iterator;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // NO_STYLE_ALLOCATOR
|
||||||
#endif
|
#endif
|
||||||
|
@ -24,7 +24,9 @@
|
|||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#ifdef UNKNOWN_ALLOCATOR
|
#ifdef NO_STYLE_ALLOCATOR
|
||||||
|
// If we're not using custom allocators, just use the standard class
|
||||||
|
// definition.
|
||||||
#define pmap map
|
#define pmap map
|
||||||
#define pmultimap multimap
|
#define pmultimap multimap
|
||||||
#else
|
#else
|
||||||
@ -59,5 +61,5 @@ public:
|
|||||||
pmultimap(const Compare &comp) : multimap<Key, Value, Compare, pallocator<Value> >(comp) { }
|
pmultimap(const Compare &comp) : multimap<Key, Value, Compare, pallocator<Value> >(comp) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // NO_STYLE_ALLOCATOR
|
||||||
#endif
|
#endif
|
||||||
|
@ -24,7 +24,9 @@
|
|||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
#ifdef UNKNOWN_ALLOCATOR
|
#ifdef NO_STYLE_ALLOCATOR
|
||||||
|
// If we're not using custom allocators, just use the standard class
|
||||||
|
// definition.
|
||||||
#define pset set
|
#define pset set
|
||||||
#define pmultiset multiset
|
#define pmultiset multiset
|
||||||
#else
|
#else
|
||||||
@ -59,5 +61,5 @@ public:
|
|||||||
pmultiset(const Compare &comp) : multiset<Key, Compare, pallocator<Key> >(comp) { }
|
pmultiset(const Compare &comp) : multiset<Key, Compare, pallocator<Key> >(comp) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // NO_STYLE_ALLOCATOR
|
||||||
#endif
|
#endif
|
||||||
|
@ -24,8 +24,11 @@
|
|||||||
#include "dtoolbase.h"
|
#include "dtoolbase.h"
|
||||||
#include "pallocator.h"
|
#include "pallocator.h"
|
||||||
|
|
||||||
#ifdef UNKNOWN_ALLOCATOR
|
#ifdef NO_STYLE_ALLOCATOR
|
||||||
|
// If we're not using custom allocators, just use the standard class
|
||||||
|
// definition.
|
||||||
#define pvector vector
|
#define pvector vector
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -45,6 +48,6 @@ public:
|
|||||||
pvector(const Type *begin, const Type *end) : vector<Type, pallocator<Type> >(begin, end) { }
|
pvector(const Type *begin, const Type *end) : vector<Type, pallocator<Type> >(begin, end) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // NO_STYLE_ALLOCATOR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
vector_string.h gnu_getopt.c gnu_getopt.h gnu_getopt1.c \
|
vector_string.h gnu_getopt.c gnu_getopt.h gnu_getopt1.c \
|
||||||
pfstreamBuf.h vector_src.h
|
pfstreamBuf.h vector_src.h
|
||||||
|
|
||||||
#define INCLUDED_SOURCES \
|
#define INCLUDED_SOURCES \
|
||||||
executionEnvironment.cxx filename.cxx load_dso.cxx \
|
executionEnvironment.cxx filename.cxx load_dso.cxx \
|
||||||
dSearchPath.cxx vector_string.cxx \
|
dSearchPath.cxx vector_string.cxx \
|
||||||
pfstreamBuf.cxx pfstream.cxx
|
pfstreamBuf.cxx pfstream.cxx
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
#ifdef HAVE_DINKUM
|
#ifdef HAVE_DINKUM
|
||||||
// With the Dinkum library, we must first export the base class,
|
// With the Dinkum library, we must first export the base class,
|
||||||
// _Vector_val.
|
// _Vector_val.
|
||||||
#define VV_BASE std::_Vector_val<TYPE, std::allocator<TYPE> >
|
#define VV_BASE std::_Vector_val<TYPE, pallocator<TYPE> >
|
||||||
#pragma warning (disable : 4231)
|
#pragma warning (disable : 4231)
|
||||||
EXPORT_TEMPLATE_CLASS(EXPCL, EXPTP, VV_BASE)
|
EXPORT_TEMPLATE_CLASS(EXPCL, EXPTP, VV_BASE)
|
||||||
#undef VV_BASE
|
#undef VV_BASE
|
||||||
|
@ -19,9 +19,7 @@
|
|||||||
#ifndef VECTOR_STRING_H
|
#ifndef VECTOR_STRING_H
|
||||||
#define VECTOR_STRING_H
|
#define VECTOR_STRING_H
|
||||||
|
|
||||||
#include <dtoolbase.h>
|
#include "dtoolbase.h"
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Class : vector_string
|
// Class : vector_string
|
||||||
|
Loading…
x
Reference in New Issue
Block a user