Parcourir la source

add unknown_allocator

cxgeorge il y a 24 ans
Parent
commit
8aefcb0452

+ 6 - 4
dtool/src/dtoolbase/dallocator.h

@@ -18,11 +18,10 @@
 
 
 #ifndef DALLOCATOR_H
 #ifndef DALLOCATOR_H
 #define DALLOCATOR_H
 #define DALLOCATOR_H
+#include <memory>
 
 
 #include "dtoolbase.h"
 #include "dtoolbase.h"
 
 
-#include <memory>
-
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //       Class : dallocator
 //       Class : dallocator
 // Description : This is similar to pallocator, but always uses the
 // Description : This is similar to pallocator, but always uses the
@@ -36,7 +35,9 @@
 //               within the MemoryUsage class itself.
 //               within the MemoryUsage class itself.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 
 
-#if defined(OLD_STYLE_ALLOCATOR)
+#if defined(UNKNOWN_ALLOCATOR)
+#define dallocator 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 its 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.
@@ -80,13 +81,14 @@ class dallocator : public allocator<Type> {
 public:
 public:
 #ifndef NDEBUG
 #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(pointer p, size_type n);
   INLINE void deallocate(void *p, size_type n);
   INLINE void deallocate(void *p, size_type n);
 #endif  // NDEBUG
 #endif  // NDEBUG
 };
 };
 #endif  // *_STYLE_ALLOCATOR
 #endif  // *_STYLE_ALLOCATOR
 
 
+#if !defined(UNKNOWN_ALLOCATOR)
 #include "dallocator.T"
 #include "dallocator.T"
+#endif
 
 
 #endif
 #endif
 
 

+ 8 - 0
dtool/src/dtoolbase/dtoolbase.h

@@ -48,6 +48,14 @@
 /* C4244: 'initializing' : conversion from 'double' to 'float', possible loss of data */
 /* C4244: 'initializing' : conversion from 'double' to 'float', possible loss of data */
 #pragma warning (disable : 4244)
 #pragma warning (disable : 4244)
 
 
+/*
+#if _MSC_VER < 1300
+#pragma message("VC 6.0")
+#else 
+#pragma message("VC 7.0")
+#endif
+*/
+
 #endif  /* WIN32_VC */
 #endif  /* WIN32_VC */
 
 
 #include "dtoolsymbols.h"
 #include "dtoolsymbols.h"

+ 7 - 3
dtool/src/dtoolbase/pallocator.h

@@ -19,9 +19,9 @@
 #ifndef PALLOCATOR_H
 #ifndef PALLOCATOR_H
 #define PALLOCATOR_H
 #define PALLOCATOR_H
 
 
+#include <memory>
 #include "dtoolbase.h"
 #include "dtoolbase.h"
 
 
-#include <memory>
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //       Class : pallocator
 //       Class : pallocator
@@ -34,7 +34,10 @@
 //               to use a pallocator.
 //               to use a pallocator.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 
 
-#if defined(OLD_STYLE_ALLOCATOR)
+#if defined(UNKNOWN_ALLOCATOR)
+#define pallocator 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 its 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.
@@ -78,13 +81,14 @@ class pallocator : public allocator<Type> {
 public:
 public:
 #ifndef NDEBUG
 #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(pointer p, size_type n);
   INLINE void deallocate(void *p, size_type n);
   INLINE void deallocate(void *p, size_type n);
 #endif  // NDEBUG
 #endif  // NDEBUG
 };
 };
 #endif  // *_STYLE_ALLOCATOR
 #endif  // *_STYLE_ALLOCATOR
 
 
+#if !defined(UNKNOWN_ALLOCATOR)
 #include "pallocator.T"
 #include "pallocator.T"
+#endif
 
 
 #endif
 #endif
 
 

+ 6 - 2
dtool/src/dtoolbase/pdeque.h

@@ -21,9 +21,13 @@
 
 
 #include "dtoolbase.h"
 #include "dtoolbase.h"
 #include "pallocator.h"
 #include "pallocator.h"
-
 #include <deque>
 #include <deque>
 
 
+#ifdef UNKNOWN_ALLOCATOR
+#define pdeque deque 
+
+#else
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //       Class : pdeque
 //       Class : pdeque
 // Description : This is our own Panda specialization on the default
 // Description : This is our own Panda specialization on the default
@@ -41,4 +45,4 @@ public:
 };
 };
 
 
 #endif
 #endif
-
+#endif

+ 6 - 2
dtool/src/dtoolbase/plist.h

@@ -21,9 +21,13 @@
 
 
 #include "dtoolbase.h"
 #include "dtoolbase.h"
 #include "pallocator.h"
 #include "pallocator.h"
-
 #include <list>
 #include <list>
 
 
+#ifdef UNKNOWN_ALLOCATOR
+#define plist list
+
+#else
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //       Class : plist
 //       Class : plist
 // Description : This is our own Panda specialization on the default
 // Description : This is our own Panda specialization on the default
@@ -47,4 +51,4 @@ public:
 };
 };
 
 
 #endif
 #endif
-
+#endif

+ 6 - 1
dtool/src/dtoolbase/pmap.h

@@ -24,6 +24,11 @@
 
 
 #include <map>
 #include <map>
 
 
+#ifdef UNKNOWN_ALLOCATOR
+#define pmap map
+#define pmultimap multimap
+#else
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //       Class : pmap
 //       Class : pmap
 // Description : This is our own Panda specialization on the default
 // Description : This is our own Panda specialization on the default
@@ -55,4 +60,4 @@ public:
 };
 };
 
 
 #endif
 #endif
-
+#endif

+ 6 - 1
dtool/src/dtoolbase/pset.h

@@ -24,6 +24,11 @@
 
 
 #include <set>
 #include <set>
 
 
+#ifdef UNKNOWN_ALLOCATOR
+#define pset set
+#define pmultiset multiset
+#else
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //       Class : pset
 //       Class : pset
 // Description : This is our own Panda specialization on the default
 // Description : This is our own Panda specialization on the default
@@ -55,4 +60,4 @@ public:
 };
 };
 
 
 #endif
 #endif
-
+#endif

+ 6 - 1
dtool/src/dtoolbase/pvector.h

@@ -19,10 +19,14 @@
 #ifndef PVECTOR_H
 #ifndef PVECTOR_H
 #define PVECTOR_H
 #define PVECTOR_H
 
 
+#include <vector>
+
 #include "dtoolbase.h"
 #include "dtoolbase.h"
 #include "pallocator.h"
 #include "pallocator.h"
 
 
-#include <vector>
+#ifdef UNKNOWN_ALLOCATOR
+#define pvector vector
+#else
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //       Class : pvector
 //       Class : pvector
@@ -42,4 +46,5 @@ public:
 };
 };
 
 
 #endif
 #endif
+#endif