Browse Source

Merge branch 'master' into cmake

Sam Edwards 9 years ago
parent
commit
fffd105f96
100 changed files with 2763 additions and 2935 deletions
  1. 5 3
      .travis.yml
  2. 6 6
      direct/src/dcparser/dcLexer.cxx.prebuilt
  3. 6 6
      direct/src/dcparser/dcLexer.lxx
  4. 2 2
      direct/src/dcparser/dcNumericRange.h
  5. 16 16
      direct/src/dcparser/dcPacker.I
  6. 2 2
      direct/src/dcparser/dcPacker.cxx
  7. 12 12
      direct/src/dcparser/dcPacker.h
  8. 24 24
      direct/src/dcparser/dcPackerInterface.I
  9. 4 4
      direct/src/dcparser/dcPackerInterface.cxx
  10. 10 10
      direct/src/dcparser/dcPackerInterface.h
  11. 2 2
      direct/src/dcparser/dcParserDefs.h
  12. 82 82
      direct/src/dcparser/dcSimpleParameter.cxx
  13. 5 5
      direct/src/dcparser/dcSimpleParameter.h
  14. 4 14
      direct/src/dcparser/dcbase.h
  15. 10 10
      direct/src/directdevices/DirectDeviceManager.py
  16. 1 1
      direct/src/directscripts/eggcacher.py
  17. 1 1
      direct/src/directscripts/packpanda.py
  18. 0 1
      direct/src/distributed/DistributedObjectBase.py
  19. 5 1
      direct/src/distributed/DistributedObjectGlobalUD.py
  20. 1 1
      direct/src/distributed/cDistributedSmoothNodeBase.I
  21. 1 1
      direct/src/distributed/cDistributedSmoothNodeBase.cxx
  22. 3 3
      direct/src/distributed/cDistributedSmoothNodeBase.h
  23. 1 1
      direct/src/fsm/FSM.py
  24. 16 16
      direct/src/interval/MetaInterval.py
  25. 3 2
      direct/src/p3d/Packager.py
  26. 1 1
      direct/src/p3d/PatchMaker.py
  27. 6 1
      direct/src/p3d/SeqValue.py
  28. 8 3
      direct/src/p3d/panda3d.pdef
  29. 3 2
      direct/src/plugin/p3dPackage.cxx
  30. 18 0
      direct/src/plugin/p3dPythonRun.cxx
  31. 10 6
      direct/src/showbase/DistancePhasedNode.py
  32. 22 5
      direct/src/showbase/ShowBase.py
  33. 1 0
      direct/src/showbase/ShowBaseGlobal.py
  34. 2 4
      direct/src/showbase/VFSImporter.py
  35. 0 374
      direct/src/showbase/pandaSqueezeTool.py
  36. 0 57
      direct/src/showbase/pandaSqueezer.py
  37. 222 84
      direct/src/showutil/FreezeTool.py
  38. 19 4
      direct/src/showutil/pfreeze.py
  39. 3 6
      direct/src/task/Task.py
  40. 3 3
      direct/src/tkpanels/ParticlePanel.py
  41. 18 0
      doc/ReleaseNotes
  42. 348 634
      dtool/src/cppparser/cppBison.cxx.prebuilt
  43. 185 198
      dtool/src/cppparser/cppBison.h.prebuilt
  44. 159 17
      dtool/src/cppparser/cppBison.yxx
  45. 66 13
      dtool/src/cppparser/cppEnumType.cxx
  46. 10 7
      dtool/src/cppparser/cppEnumType.h
  47. 1 1
      dtool/src/cppparser/cppExpression.cxx
  48. 6 0
      dtool/src/cppparser/cppExtensionType.cxx
  49. 2 0
      dtool/src/cppparser/cppExtensionType.h
  50. 19 3
      dtool/src/cppparser/cppMakeProperty.cxx
  51. 4 0
      dtool/src/cppparser/cppMakeProperty.h
  52. 2 0
      dtool/src/cppparser/cppPreprocessor.cxx
  53. 74 53
      dtool/src/cppparser/cppScope.cxx
  54. 3 3
      dtool/src/cppparser/cppScope.h
  55. 1 1
      dtool/src/cppparser/cppStructType.cxx
  56. 12 3
      dtool/src/cppparser/cppTemplateScope.cxx
  57. 3 3
      dtool/src/cppparser/cppTemplateScope.h
  58. 17 0
      dtool/src/cppparser/cppTypedefType.cxx
  59. 8 1
      dtool/src/cppparser/cppTypedefType.h
  60. 4 4
      dtool/src/dtoolbase/addHash.I
  61. 8 8
      dtool/src/dtoolbase/addHash.cxx
  62. 2 2
      dtool/src/dtoolbase/addHash.h
  63. 1 1
      dtool/src/dtoolbase/atomicAdjustI386Impl.h
  64. 0 534
      dtool/src/dtoolbase/dlmalloc.h
  65. 405 130
      dtool/src/dtoolbase/dlmalloc_src.cxx
  66. 2 1
      dtool/src/dtoolbase/dtoolbase.h
  67. 179 179
      dtool/src/dtoolbase/lookup3.c
  68. 3 3
      dtool/src/dtoolbase/lookup3.h
  69. 7 4
      dtool/src/dtoolbase/memoryHook.cxx
  70. 1 24
      dtool/src/dtoolbase/numeric_types.h
  71. 1 1
      dtool/src/dtoolbase/pallocator.h
  72. 1 1
      dtool/src/dtoolbase/pdeque.h
  73. 1 1
      dtool/src/dtoolbase/pdtoa.cxx
  74. 1 1
      dtool/src/dtoolbase/plist.h
  75. 1 1
      dtool/src/dtoolbase/pmap.h
  76. 1 1
      dtool/src/dtoolbase/pset.h
  77. 6 0
      dtool/src/dtoolbase/pvector.h
  78. 4 4
      dtool/src/dtoolbase/stl_compares.I
  79. 2 0
      dtool/src/dtoolbase/typeHandle.h
  80. 4 4
      dtool/src/dtoolbase/typeRegistry.cxx
  81. 3 0
      dtool/src/dtoolbase/typeRegistry.h
  82. 1 0
      dtool/src/dtoolutil/dSearchPath.h
  83. 5 1
      dtool/src/dtoolutil/filename.cxx
  84. 1 0
      dtool/src/dtoolutil/pandaSystem.h
  85. 2 2
      dtool/src/dtoolutil/string_utils.I
  86. 1 1
      dtool/src/dtoolutil/string_utils.h
  87. 17 2
      dtool/src/interrogate/interfaceMaker.cxx
  88. 2 0
      dtool/src/interrogate/interfaceMaker.h
  89. 391 288
      dtool/src/interrogate/interfaceMakerPythonNative.cxx
  90. 4 1
      dtool/src/interrogate/interfaceMakerPythonNative.h
  91. 92 21
      dtool/src/interrogate/interrogateBuilder.cxx
  92. 60 0
      dtool/src/interrogate/typeManager.cxx
  93. 2 0
      dtool/src/interrogate/typeManager.h
  94. 1 1
      dtool/src/interrogatedb/interrogateDatabase.cxx
  95. 36 0
      dtool/src/interrogatedb/interrogateElement.I
  96. 10 1
      dtool/src/interrogatedb/interrogateElement.cxx
  97. 9 0
      dtool/src/interrogatedb/interrogateElement.h
  98. 8 0
      dtool/src/interrogatedb/interrogateType.I
  99. 2 0
      dtool/src/interrogatedb/interrogateType.h
  100. 4 0
      dtool/src/interrogatedb/interrogate_request.cxx

+ 5 - 3
.travis.yml

@@ -3,9 +3,11 @@ sudo: false
 matrix:
 matrix:
   include:
   include:
     - compiler: gcc
     - compiler: gcc
-      env: PYTHONV=python2.7
+      env: PYTHONV=python2.7 FLAGS=
     - compiler: clang
     - compiler: clang
-      env: PYTHONV=python3
+      env: PYTHONV=python3 FLAGS=--installer
+    - compiler: clang
+      env: PYTHONV=python2.7 FLAGS=--override=STDFLOAT_DOUBLE=1
 addons:
 addons:
   apt:
   apt:
     packages:
     packages:
@@ -26,7 +28,7 @@ addons:
     - python-dev
     - python-dev
     - python3-dev
     - python3-dev
     - zlib1g-dev
     - zlib1g-dev
-script: $PYTHONV makepanda/makepanda.py --everything --git-commit $TRAVIS_COMMIT --installer --threads 4 && LD_LIBRARY_PATH=built/lib PYTHONPATH=built $PYTHONV makepanda/test_imports.py
+script: $PYTHONV makepanda/makepanda.py --everything --git-commit $TRAVIS_COMMIT $FLAGS --threads 4 && LD_LIBRARY_PATH=built/lib PYTHONPATH=built $PYTHONV makepanda/test_imports.py
 notifications:
 notifications:
   irc:
   irc:
     channels:
     channels:

+ 6 - 6
direct/src/dcparser/dcLexer.cxx.prebuilt

@@ -1550,7 +1550,7 @@ YY_RULE_SETUP
   dcyylval.u.uint64 = 0;
   dcyylval.u.uint64 = 0;
   const char *p = dcyytext;
   const char *p = dcyytext;
   while (*p != '\0') {
   while (*p != '\0') {
-    PN_uint64 next_value = dcyylval.u.uint64 * 10;
+    uint64_t next_value = dcyylval.u.uint64 * 10;
     if (next_value < dcyylval.u.uint64) {
     if (next_value < dcyylval.u.uint64) {
       dcyyerror("Number out of range.");
       dcyyerror("Number out of range.");
       dcyylval.u.uint64 = 1;
       dcyylval.u.uint64 = 1;
@@ -1583,9 +1583,9 @@ YY_RULE_SETUP
     ++p;
     ++p;
   }
   }
 
 
-  PN_uint64 value = 0;
+  uint64_t value = 0;
   while (*p != '\0') {
   while (*p != '\0') {
-    PN_uint64 next_value = value * 10;
+    uint64_t next_value = value * 10;
     if (next_value < value) {
     if (next_value < value) {
       dcyyerror("Number out of range.");
       dcyyerror("Number out of range.");
       dcyylval.u.int64 = 1;
       dcyylval.u.int64 = 1;
@@ -1597,13 +1597,13 @@ YY_RULE_SETUP
   }
   }
 
 
   if (neg) {
   if (neg) {
-    dcyylval.u.int64 = -(PN_int64)value;
+    dcyylval.u.int64 = -(int64_t)value;
     if (dcyylval.u.int64 > 0) {
     if (dcyylval.u.int64 > 0) {
       dcyyerror("Number out of range.");
       dcyyerror("Number out of range.");
       dcyylval.u.int64 = 1;
       dcyylval.u.int64 = 1;
     }
     }
   } else {
   } else {
-    dcyylval.u.int64 = (PN_int64)value;
+    dcyylval.u.int64 = (int64_t)value;
     if (dcyylval.u.int64 < 0) {
     if (dcyylval.u.int64 < 0) {
       dcyyerror("Number out of range.");
       dcyyerror("Number out of range.");
       dcyylval.u.int64 = 1;
       dcyylval.u.int64 = 1;
@@ -1625,7 +1625,7 @@ YY_RULE_SETUP
   dcyylval.u.uint64 = 0;
   dcyylval.u.uint64 = 0;
   const char *p = dcyytext + 2;
   const char *p = dcyytext + 2;
   while (*p != '\0') {
   while (*p != '\0') {
-    PN_uint64 next_value = dcyylval.u.uint64 * 16;
+    uint64_t next_value = dcyylval.u.uint64 * 16;
     if (next_value < dcyylval.u.uint64) {
     if (next_value < dcyylval.u.uint64) {
       dcyyerror("Number out of range.");
       dcyyerror("Number out of range.");
       dcyylval.u.uint64 = 1;
       dcyylval.u.uint64 = 1;

+ 6 - 6
direct/src/dcparser/dcLexer.lxx

@@ -612,7 +612,7 @@ REALNUM              ([+-]?(([0-9]+[.])|([0-9]*[.][0-9]+))([eE][+-]?[0-9]+)?)
   dcyylval.u.uint64 = 0;
   dcyylval.u.uint64 = 0;
   const char *p = dcyytext;
   const char *p = dcyytext;
   while (*p != '\0') {
   while (*p != '\0') {
-    PN_uint64 next_value = dcyylval.u.uint64 * 10;
+    uint64_t next_value = dcyylval.u.uint64 * 10;
     if (next_value < dcyylval.u.uint64) {
     if (next_value < dcyylval.u.uint64) {
       dcyyerror("Number out of range.");
       dcyyerror("Number out of range.");
       dcyylval.u.uint64 = 1;
       dcyylval.u.uint64 = 1;
@@ -642,9 +642,9 @@ REALNUM              ([+-]?(([0-9]+[.])|([0-9]*[.][0-9]+))([eE][+-]?[0-9]+)?)
     ++p;
     ++p;
   }
   }
 
 
-  PN_uint64 value = 0;
+  uint64_t value = 0;
   while (*p != '\0') {
   while (*p != '\0') {
-    PN_uint64 next_value = value * 10;
+    uint64_t next_value = value * 10;
     if (next_value < value) {
     if (next_value < value) {
       dcyyerror("Number out of range.");
       dcyyerror("Number out of range.");
       dcyylval.u.int64 = 1;
       dcyylval.u.int64 = 1;
@@ -656,13 +656,13 @@ REALNUM              ([+-]?(([0-9]+[.])|([0-9]*[.][0-9]+))([eE][+-]?[0-9]+)?)
   }
   }
 
 
   if (neg) {
   if (neg) {
-    dcyylval.u.int64 = -(PN_int64)value;
+    dcyylval.u.int64 = -(int64_t)value;
     if (dcyylval.u.int64 > 0) {
     if (dcyylval.u.int64 > 0) {
       dcyyerror("Number out of range.");
       dcyyerror("Number out of range.");
       dcyylval.u.int64 = 1;
       dcyylval.u.int64 = 1;
     }
     }
   } else {
   } else {
-    dcyylval.u.int64 = (PN_int64)value;
+    dcyylval.u.int64 = (int64_t)value;
     if (dcyylval.u.int64 < 0) {
     if (dcyylval.u.int64 < 0) {
       dcyyerror("Number out of range.");
       dcyyerror("Number out of range.");
       dcyylval.u.int64 = 1;
       dcyylval.u.int64 = 1;
@@ -681,7 +681,7 @@ REALNUM              ([+-]?(([0-9]+[.])|([0-9]*[.][0-9]+))([eE][+-]?[0-9]+)?)
   dcyylval.u.uint64 = 0;
   dcyylval.u.uint64 = 0;
   const char *p = dcyytext + 2;
   const char *p = dcyytext + 2;
   while (*p != '\0') {
   while (*p != '\0') {
-    PN_uint64 next_value = dcyylval.u.uint64 * 16;
+    uint64_t next_value = dcyylval.u.uint64 * 16;
     if (next_value < dcyylval.u.uint64) {
     if (next_value < dcyylval.u.uint64) {
       dcyyerror("Number out of range.");
       dcyyerror("Number out of range.");
       dcyylval.u.uint64 = 1;
       dcyylval.u.uint64 = 1;

+ 2 - 2
direct/src/dcparser/dcNumericRange.h

@@ -71,8 +71,8 @@ private:
 
 
 typedef DCNumericRange<int> DCIntRange;
 typedef DCNumericRange<int> DCIntRange;
 typedef DCNumericRange<unsigned int> DCUnsignedIntRange;
 typedef DCNumericRange<unsigned int> DCUnsignedIntRange;
-typedef DCNumericRange<PN_int64> DCInt64Range;
-typedef DCNumericRange<PN_uint64> DCUnsignedInt64Range;
+typedef DCNumericRange<int64_t> DCInt64Range;
+typedef DCNumericRange<uint64_t> DCUnsignedInt64Range;
 typedef DCNumericRange<double> DCDoubleRange;
 typedef DCNumericRange<double> DCDoubleRange;
 
 
 #endif
 #endif

+ 16 - 16
direct/src/dcparser/dcPacker.I

@@ -178,7 +178,7 @@ pack_uint(unsigned int value) {
  * Packs the indicated numeric or string value into the stream.
  * Packs the indicated numeric or string value into the stream.
  */
  */
 INLINE void DCPacker::
 INLINE void DCPacker::
-pack_int64(PN_int64 value) {
+pack_int64(int64_t value) {
   nassertv(_mode == M_pack || _mode == M_repack);
   nassertv(_mode == M_pack || _mode == M_repack);
   if (_current_field == NULL) {
   if (_current_field == NULL) {
     _pack_error = true;
     _pack_error = true;
@@ -192,7 +192,7 @@ pack_int64(PN_int64 value) {
  * Packs the indicated numeric or string value into the stream.
  * Packs the indicated numeric or string value into the stream.
  */
  */
 INLINE void DCPacker::
 INLINE void DCPacker::
-pack_uint64(PN_uint64 value) {
+pack_uint64(uint64_t value) {
   nassertv(_mode == M_pack || _mode == M_repack);
   nassertv(_mode == M_pack || _mode == M_repack);
   if (_current_field == NULL) {
   if (_current_field == NULL) {
     _pack_error = true;
     _pack_error = true;
@@ -291,9 +291,9 @@ unpack_uint() {
 /**
 /**
  * Unpacks the current numeric or string value from the stream.
  * Unpacks the current numeric or string value from the stream.
  */
  */
-INLINE PN_int64 DCPacker::
+INLINE int64_t DCPacker::
 unpack_int64() {
 unpack_int64() {
-  PN_int64 value = 0;
+  int64_t value = 0;
   nassertr(_mode == M_unpack, value);
   nassertr(_mode == M_unpack, value);
   if (_current_field == NULL) {
   if (_current_field == NULL) {
     _pack_error = true;
     _pack_error = true;
@@ -310,9 +310,9 @@ unpack_int64() {
 /**
 /**
  * Unpacks the current numeric or string value from the stream.
  * Unpacks the current numeric or string value from the stream.
  */
  */
-INLINE PN_uint64 DCPacker::
+INLINE uint64_t DCPacker::
 unpack_uint64() {
 unpack_uint64() {
-  PN_uint64 value = 0;
+  uint64_t value = 0;
   nassertr(_mode == M_unpack, value);
   nassertr(_mode == M_unpack, value);
   if (_current_field == NULL) {
   if (_current_field == NULL) {
     _pack_error = true;
     _pack_error = true;
@@ -409,7 +409,7 @@ unpack_uint(unsigned int &value) {
  * Unpacks the current numeric or string value from the stream.
  * Unpacks the current numeric or string value from the stream.
  */
  */
 INLINE void DCPacker::
 INLINE void DCPacker::
-unpack_int64(PN_int64 &value) {
+unpack_int64(int64_t &value) {
   nassertv(_mode == M_unpack);
   nassertv(_mode == M_unpack);
   if (_current_field == NULL) {
   if (_current_field == NULL) {
     _pack_error = true;
     _pack_error = true;
@@ -425,7 +425,7 @@ unpack_int64(PN_int64 &value) {
  * Unpacks the current numeric or string value from the stream.
  * Unpacks the current numeric or string value from the stream.
  */
  */
 INLINE void DCPacker::
 INLINE void DCPacker::
-unpack_uint64(PN_uint64 &value) {
+unpack_uint64(uint64_t &value) {
   nassertv(_mode == M_unpack);
   nassertv(_mode == M_unpack);
   if (_current_field == NULL) {
   if (_current_field == NULL) {
     _pack_error = true;
     _pack_error = true;
@@ -668,7 +668,7 @@ raw_pack_int32(int value) {
  * Packs the data into the buffer between packing sessions.
  * Packs the data into the buffer between packing sessions.
  */
  */
 INLINE void DCPacker::
 INLINE void DCPacker::
-raw_pack_int64(PN_int64 value) {
+raw_pack_int64(int64_t value) {
   nassertv(_mode == M_idle);
   nassertv(_mode == M_idle);
   DCPackerInterface::do_pack_int64(_pack_data.get_write_pointer(8), value);
   DCPackerInterface::do_pack_int64(_pack_data.get_write_pointer(8), value);
 }
 }
@@ -704,7 +704,7 @@ raw_pack_uint32(unsigned int value) {
  * Packs the data into the buffer between packing sessions.
  * Packs the data into the buffer between packing sessions.
  */
  */
 INLINE void DCPacker::
 INLINE void DCPacker::
-raw_pack_uint64(PN_uint64 value) {
+raw_pack_uint64(uint64_t value) {
   nassertv(_mode == M_idle);
   nassertv(_mode == M_idle);
   DCPackerInterface::do_pack_uint64(_pack_data.get_write_pointer(8), value);
   DCPackerInterface::do_pack_uint64(_pack_data.get_write_pointer(8), value);
 }
 }
@@ -761,9 +761,9 @@ raw_unpack_int32() {
 /**
 /**
  * Unpacks the data from the buffer between unpacking sessions.
  * Unpacks the data from the buffer between unpacking sessions.
  */
  */
-INLINE PN_int64 DCPacker::
+INLINE int64_t DCPacker::
 raw_unpack_int64() {
 raw_unpack_int64() {
-  PN_int64 value = 0;
+  int64_t value = 0;
   raw_unpack_int64(value);
   raw_unpack_int64(value);
   return value;
   return value;
 }
 }
@@ -843,9 +843,9 @@ raw_unpack_uint32() {
 /**
 /**
  * Unpacks the data from the buffer between unpacking sessions.
  * Unpacks the data from the buffer between unpacking sessions.
  */
  */
-INLINE PN_uint64 DCPacker::
+INLINE uint64_t DCPacker::
 raw_unpack_uint64() {
 raw_unpack_uint64() {
-  PN_uint64 value = 0;
+  uint64_t value = 0;
   raw_unpack_uint64(value);
   raw_unpack_uint64(value);
   return value;
   return value;
 }
 }
@@ -874,7 +874,7 @@ raw_unpack_string() {
  * Unpacks the data from the buffer between unpacking sessions.
  * Unpacks the data from the buffer between unpacking sessions.
  */
  */
 INLINE void DCPacker::
 INLINE void DCPacker::
-raw_unpack_int64(PN_int64 &value) {
+raw_unpack_int64(int64_t &value) {
   nassertv(_mode == M_idle && _unpack_data != NULL);
   nassertv(_mode == M_idle && _unpack_data != NULL);
   if (_unpack_p + 8 > _unpack_length) {
   if (_unpack_p + 8 > _unpack_length) {
     _pack_error = true;
     _pack_error = true;
@@ -930,7 +930,7 @@ raw_unpack_uint32(unsigned int &value) {
  * Unpacks the data from the buffer between unpacking sessions.
  * Unpacks the data from the buffer between unpacking sessions.
  */
  */
 INLINE void DCPacker::
 INLINE void DCPacker::
-raw_unpack_uint64(PN_uint64 &value) {
+raw_unpack_uint64(uint64_t &value) {
   nassertv(_mode == M_idle && _unpack_data != NULL);
   nassertv(_mode == M_idle && _unpack_data != NULL);
   if (_unpack_p + 8 > _unpack_length) {
   if (_unpack_p + 8 > _unpack_length) {
     _pack_error = true;
     _pack_error = true;

+ 2 - 2
direct/src/dcparser/dcPacker.cxx

@@ -858,14 +858,14 @@ unpack_object() {
 
 
   case PT_int64:
   case PT_int64:
     {
     {
-      PN_int64 value = unpack_int64();
+      int64_t value = unpack_int64();
       object = PyLong_FromLongLong(value);
       object = PyLong_FromLongLong(value);
     }
     }
     break;
     break;
 
 
   case PT_uint64:
   case PT_uint64:
     {
     {
-      PN_uint64 value = unpack_uint64();
+      uint64_t value = unpack_uint64();
       object = PyLong_FromUnsignedLongLong(value);
       object = PyLong_FromUnsignedLongLong(value);
     }
     }
     break;
     break;

+ 12 - 12
direct/src/dcparser/dcPacker.h

@@ -72,8 +72,8 @@ PUBLISHED:
   INLINE void pack_double(double value);
   INLINE void pack_double(double value);
   INLINE void pack_int(int value);
   INLINE void pack_int(int value);
   INLINE void pack_uint(unsigned int value);
   INLINE void pack_uint(unsigned int value);
-  INLINE void pack_int64(PN_int64 value);
-  INLINE void pack_uint64(PN_uint64 value);
+  INLINE void pack_int64(int64_t value);
+  INLINE void pack_uint64(uint64_t value);
   INLINE void pack_string(const string &value);
   INLINE void pack_string(const string &value);
   INLINE void pack_literal_value(const string &value);
   INLINE void pack_literal_value(const string &value);
   void pack_default_value();
   void pack_default_value();
@@ -81,8 +81,8 @@ PUBLISHED:
   INLINE double unpack_double();
   INLINE double unpack_double();
   INLINE int unpack_int();
   INLINE int unpack_int();
   INLINE unsigned int unpack_uint();
   INLINE unsigned int unpack_uint();
-  INLINE PN_int64 unpack_int64();
-  INLINE PN_uint64 unpack_uint64();
+  INLINE int64_t unpack_int64();
+  INLINE uint64_t unpack_uint64();
   INLINE string unpack_string();
   INLINE string unpack_string();
   INLINE string unpack_literal_value();
   INLINE string unpack_literal_value();
   void unpack_validate();
   void unpack_validate();
@@ -94,8 +94,8 @@ public:
   INLINE void unpack_double(double &value);
   INLINE void unpack_double(double &value);
   INLINE void unpack_int(int &value);
   INLINE void unpack_int(int &value);
   INLINE void unpack_uint(unsigned int &value);
   INLINE void unpack_uint(unsigned int &value);
-  INLINE void unpack_int64(PN_int64 &value);
-  INLINE void unpack_uint64(PN_uint64 &value);
+  INLINE void unpack_int64(int64_t &value);
+  INLINE void unpack_uint64(uint64_t &value);
   INLINE void unpack_string(string &value);
   INLINE void unpack_string(string &value);
   INLINE void unpack_literal_value(string &value);
   INLINE void unpack_literal_value(string &value);
 
 
@@ -141,11 +141,11 @@ PUBLISHED:
   INLINE void raw_pack_int8(int value);
   INLINE void raw_pack_int8(int value);
   INLINE void raw_pack_int16(int value);
   INLINE void raw_pack_int16(int value);
   INLINE void raw_pack_int32(int value);
   INLINE void raw_pack_int32(int value);
-  INLINE void raw_pack_int64(PN_int64 value);
+  INLINE void raw_pack_int64(int64_t value);
   INLINE void raw_pack_uint8(unsigned int value);
   INLINE void raw_pack_uint8(unsigned int value);
   INLINE void raw_pack_uint16(unsigned int value);
   INLINE void raw_pack_uint16(unsigned int value);
   INLINE void raw_pack_uint32(unsigned int value);
   INLINE void raw_pack_uint32(unsigned int value);
-  INLINE void raw_pack_uint64(PN_uint64 value);
+  INLINE void raw_pack_uint64(uint64_t value);
   INLINE void raw_pack_float64(double value);
   INLINE void raw_pack_float64(double value);
   INLINE void raw_pack_string(const string &value);
   INLINE void raw_pack_string(const string &value);
 
 
@@ -158,11 +158,11 @@ PUBLISHED:
   INLINE int raw_unpack_int8();
   INLINE int raw_unpack_int8();
   INLINE int raw_unpack_int16();
   INLINE int raw_unpack_int16();
   INLINE int raw_unpack_int32();
   INLINE int raw_unpack_int32();
-  INLINE PN_int64 raw_unpack_int64();
+  INLINE int64_t raw_unpack_int64();
   INLINE unsigned int raw_unpack_uint8();
   INLINE unsigned int raw_unpack_uint8();
   INLINE unsigned int raw_unpack_uint16();
   INLINE unsigned int raw_unpack_uint16();
   INLINE unsigned int raw_unpack_uint32();
   INLINE unsigned int raw_unpack_uint32();
-  INLINE PN_uint64 raw_unpack_uint64();
+  INLINE uint64_t raw_unpack_uint64();
   INLINE double raw_unpack_float64();
   INLINE double raw_unpack_float64();
   INLINE string raw_unpack_string();
   INLINE string raw_unpack_string();
 
 
@@ -170,11 +170,11 @@ public:
   INLINE void raw_unpack_int8(int &value);
   INLINE void raw_unpack_int8(int &value);
   INLINE void raw_unpack_int16(int &value);
   INLINE void raw_unpack_int16(int &value);
   INLINE void raw_unpack_int32(int &value);
   INLINE void raw_unpack_int32(int &value);
-  INLINE void raw_unpack_int64(PN_int64 &value);
+  INLINE void raw_unpack_int64(int64_t &value);
   INLINE void raw_unpack_uint8(unsigned int &value);
   INLINE void raw_unpack_uint8(unsigned int &value);
   INLINE void raw_unpack_uint16(unsigned int &value);
   INLINE void raw_unpack_uint16(unsigned int &value);
   INLINE void raw_unpack_uint32(unsigned int &value);
   INLINE void raw_unpack_uint32(unsigned int &value);
-  INLINE void raw_unpack_uint64(PN_uint64 &value);
+  INLINE void raw_unpack_uint64(uint64_t &value);
   INLINE void raw_unpack_float64(double &value);
   INLINE void raw_unpack_float64(double &value);
   INLINE void raw_unpack_string(string &value);
   INLINE void raw_unpack_string(string &value);
 
 

+ 24 - 24
direct/src/dcparser/dcPackerInterface.I

@@ -142,7 +142,7 @@ do_pack_int32(char *buffer, int value) {
  *
  *
  */
  */
 INLINE void DCPackerInterface::
 INLINE void DCPackerInterface::
-do_pack_int64(char *buffer, PN_int64 value) {
+do_pack_int64(char *buffer, int64_t value) {
   buffer[0] = (char)(value & 0xff);
   buffer[0] = (char)(value & 0xff);
   buffer[1] = (char)((value >> 8) & 0xff);
   buffer[1] = (char)((value >> 8) & 0xff);
   buffer[2] = (char)((value >> 16) & 0xff);
   buffer[2] = (char)((value >> 16) & 0xff);
@@ -185,7 +185,7 @@ do_pack_uint32(char *buffer, unsigned int value) {
  *
  *
  */
  */
 INLINE void DCPackerInterface::
 INLINE void DCPackerInterface::
-do_pack_uint64(char *buffer, PN_uint64 value) {
+do_pack_uint64(char *buffer, uint64_t value) {
   buffer[0] = (char)(value & 0xff);
   buffer[0] = (char)(value & 0xff);
   buffer[1] = (char)((value >> 8) & 0xff);
   buffer[1] = (char)((value >> 8) & 0xff);
   buffer[2] = (char)((value >> 16) & 0xff);
   buffer[2] = (char)((value >> 16) & 0xff);
@@ -244,16 +244,16 @@ do_unpack_int32(const char *buffer) {
 /**
 /**
  *
  *
  */
  */
-INLINE PN_int64 DCPackerInterface::
+INLINE int64_t DCPackerInterface::
 do_unpack_int64(const char *buffer) {
 do_unpack_int64(const char *buffer) {
-  return (PN_int64)((PN_uint64)(unsigned char)buffer[0] |
-                    ((PN_uint64)(unsigned char)buffer[1] << 8) |
-                    ((PN_uint64)(unsigned char)buffer[2] << 16) |
-                    ((PN_uint64)(unsigned char)buffer[3] << 24) |
-                    ((PN_uint64)(unsigned char)buffer[4] << 32) |
-                    ((PN_uint64)(unsigned char)buffer[5] << 40) |
-                    ((PN_uint64)(unsigned char)buffer[6] << 48) |
-                    ((PN_int64)(signed char)buffer[7] << 54));
+  return (int64_t)((uint64_t)(unsigned char)buffer[0] |
+                    ((uint64_t)(unsigned char)buffer[1] << 8) |
+                    ((uint64_t)(unsigned char)buffer[2] << 16) |
+                    ((uint64_t)(unsigned char)buffer[3] << 24) |
+                    ((uint64_t)(unsigned char)buffer[4] << 32) |
+                    ((uint64_t)(unsigned char)buffer[5] << 40) |
+                    ((uint64_t)(unsigned char)buffer[6] << 48) |
+                    ((int64_t)(signed char)buffer[7] << 54));
 }
 }
 /**
 /**
  *
  *
@@ -286,16 +286,16 @@ do_unpack_uint32(const char *buffer) {
 /**
 /**
  *
  *
  */
  */
-INLINE PN_uint64 DCPackerInterface::
+INLINE uint64_t DCPackerInterface::
 do_unpack_uint64(const char *buffer) {
 do_unpack_uint64(const char *buffer) {
-  return ((PN_uint64)(unsigned char)buffer[0] |
-          ((PN_uint64)(unsigned char)buffer[1] << 8) |
-          ((PN_uint64)(unsigned char)buffer[2] << 16) |
-          ((PN_uint64)(unsigned char)buffer[3] << 24) |
-          ((PN_uint64)(unsigned char)buffer[4] << 32) |
-          ((PN_uint64)(unsigned char)buffer[5] << 40) |
-          ((PN_uint64)(unsigned char)buffer[6] << 48) |
-          ((PN_int64)(signed char)buffer[7] << 54));
+  return ((uint64_t)(unsigned char)buffer[0] |
+          ((uint64_t)(unsigned char)buffer[1] << 8) |
+          ((uint64_t)(unsigned char)buffer[2] << 16) |
+          ((uint64_t)(unsigned char)buffer[3] << 24) |
+          ((uint64_t)(unsigned char)buffer[4] << 32) |
+          ((uint64_t)(unsigned char)buffer[5] << 40) |
+          ((uint64_t)(unsigned char)buffer[6] << 48) |
+          ((int64_t)(signed char)buffer[7] << 54));
 }
 }
 
 
 
 
@@ -342,8 +342,8 @@ validate_int_limits(int value, int num_bits, bool &range_error) {
  * true if it does not.
  * true if it does not.
  */
  */
 INLINE void DCPackerInterface::
 INLINE void DCPackerInterface::
-validate_int64_limits(PN_int64 value, int num_bits, bool &range_error) {
-  PN_int64 mask = ((PN_int64)1 << (num_bits - 1)) - 1;
+validate_int64_limits(int64_t value, int num_bits, bool &range_error) {
+  int64_t mask = ((int64_t)1 << (num_bits - 1)) - 1;
   value |= mask;
   value |= mask;
 
 
   if (value != mask && value != -1) {
   if (value != mask && value != -1) {
@@ -373,8 +373,8 @@ validate_uint_limits(unsigned int value, int num_bits, bool &range_error) {
  * range_error true if it does not.
  * range_error true if it does not.
  */
  */
 INLINE void DCPackerInterface::
 INLINE void DCPackerInterface::
-validate_uint64_limits(PN_uint64 value, int num_bits, bool &range_error) {
-  PN_uint64 mask = ((PN_uint64)1 << num_bits) - 1;
+validate_uint64_limits(uint64_t value, int num_bits, bool &range_error) {
+  uint64_t mask = ((uint64_t)1 << num_bits) - 1;
   value &= ~mask;
   value &= ~mask;
 
 
   if (value != 0) {
   if (value != 0) {

+ 4 - 4
direct/src/dcparser/dcPackerInterface.cxx

@@ -226,7 +226,7 @@ pack_uint(DCPackData &, unsigned int, bool &pack_error, bool &) const {
  * Packs the indicated numeric or string value into the stream.
  * Packs the indicated numeric or string value into the stream.
  */
  */
 void DCPackerInterface::
 void DCPackerInterface::
-pack_int64(DCPackData &, PN_int64, bool &pack_error, bool &) const {
+pack_int64(DCPackData &, int64_t, bool &pack_error, bool &) const {
   pack_error = true;
   pack_error = true;
 }
 }
 
 
@@ -234,7 +234,7 @@ pack_int64(DCPackData &, PN_int64, bool &pack_error, bool &) const {
  * Packs the indicated numeric or string value into the stream.
  * Packs the indicated numeric or string value into the stream.
  */
  */
 void DCPackerInterface::
 void DCPackerInterface::
-pack_uint64(DCPackData &, PN_uint64, bool &pack_error, bool &) const {
+pack_uint64(DCPackData &, uint64_t, bool &pack_error, bool &) const {
   pack_error = true;
   pack_error = true;
 }
 }
 
 
@@ -284,7 +284,7 @@ unpack_uint(const char *, size_t, size_t &, unsigned int &, bool &pack_error, bo
  * Unpacks the current numeric or string value from the stream.
  * Unpacks the current numeric or string value from the stream.
  */
  */
 void DCPackerInterface::
 void DCPackerInterface::
-unpack_int64(const char *, size_t, size_t &, PN_int64 &, bool &pack_error, bool &) const {
+unpack_int64(const char *, size_t, size_t &, int64_t &, bool &pack_error, bool &) const {
   pack_error = true;
   pack_error = true;
 }
 }
 
 
@@ -292,7 +292,7 @@ unpack_int64(const char *, size_t, size_t &, PN_int64 &, bool &pack_error, bool
  * Unpacks the current numeric or string value from the stream.
  * Unpacks the current numeric or string value from the stream.
  */
  */
 void DCPackerInterface::
 void DCPackerInterface::
-unpack_uint64(const char *, size_t, size_t &, PN_uint64 &, bool &pack_error, bool &) const {
+unpack_uint64(const char *, size_t, size_t &, uint64_t &, bool &pack_error, bool &) const {
   pack_error = true;
   pack_error = true;
 }
 }
 
 

+ 10 - 10
direct/src/dcparser/dcPackerInterface.h

@@ -107,9 +107,9 @@ public:
                         bool &pack_error, bool &range_error) const;
                         bool &pack_error, bool &range_error) const;
   virtual void pack_uint(DCPackData &pack_data, unsigned int value,
   virtual void pack_uint(DCPackData &pack_data, unsigned int value,
                          bool &pack_error, bool &range_error) const;
                          bool &pack_error, bool &range_error) const;
-  virtual void pack_int64(DCPackData &pack_data, PN_int64 value,
+  virtual void pack_int64(DCPackData &pack_data, int64_t value,
                           bool &pack_error, bool &range_error) const;
                           bool &pack_error, bool &range_error) const;
-  virtual void pack_uint64(DCPackData &pack_data, PN_uint64 value,
+  virtual void pack_uint64(DCPackData &pack_data, uint64_t value,
                            bool &pack_error, bool &range_error) const;
                            bool &pack_error, bool &range_error) const;
   virtual void pack_string(DCPackData &pack_data, const string &value,
   virtual void pack_string(DCPackData &pack_data, const string &value,
                            bool &pack_error, bool &range_error) const;
                            bool &pack_error, bool &range_error) const;
@@ -122,9 +122,9 @@ public:
   virtual void unpack_uint(const char *data, size_t length, size_t &p,
   virtual void unpack_uint(const char *data, size_t length, size_t &p,
                            unsigned int &value, bool &pack_error, bool &range_error) const;
                            unsigned int &value, bool &pack_error, bool &range_error) const;
   virtual void unpack_int64(const char *data, size_t length, size_t &p,
   virtual void unpack_int64(const char *data, size_t length, size_t &p,
-                            PN_int64 &value, bool &pack_error, bool &range_error) const;
+                            int64_t &value, bool &pack_error, bool &range_error) const;
   virtual void unpack_uint64(const char *data, size_t length, size_t &p,
   virtual void unpack_uint64(const char *data, size_t length, size_t &p,
-                             PN_uint64 &value, bool &pack_error, bool &range_error) const;
+                             uint64_t &value, bool &pack_error, bool &range_error) const;
   virtual void unpack_string(const char *data, size_t length, size_t &p,
   virtual void unpack_string(const char *data, size_t length, size_t &p,
                              string &value, bool &pack_error, bool &range_error) const;
                              string &value, bool &pack_error, bool &range_error) const;
   virtual bool unpack_validate(const char *data, size_t length, size_t &p,
   virtual bool unpack_validate(const char *data, size_t length, size_t &p,
@@ -138,30 +138,30 @@ public:
   INLINE static void do_pack_int8(char *buffer, int value);
   INLINE static void do_pack_int8(char *buffer, int value);
   INLINE static void do_pack_int16(char *buffer, int value);
   INLINE static void do_pack_int16(char *buffer, int value);
   INLINE static void do_pack_int32(char *buffer, int value);
   INLINE static void do_pack_int32(char *buffer, int value);
-  INLINE static void do_pack_int64(char *buffer, PN_int64 value);
+  INLINE static void do_pack_int64(char *buffer, int64_t value);
   INLINE static void do_pack_uint8(char *buffer, unsigned int value);
   INLINE static void do_pack_uint8(char *buffer, unsigned int value);
   INLINE static void do_pack_uint16(char *buffer, unsigned int value);
   INLINE static void do_pack_uint16(char *buffer, unsigned int value);
   INLINE static void do_pack_uint32(char *buffer, unsigned int value);
   INLINE static void do_pack_uint32(char *buffer, unsigned int value);
-  INLINE static void do_pack_uint64(char *buffer, PN_uint64 value);
+  INLINE static void do_pack_uint64(char *buffer, uint64_t value);
   INLINE static void do_pack_float64(char *buffer, double value);
   INLINE static void do_pack_float64(char *buffer, double value);
 
 
   INLINE static int do_unpack_int8(const char *buffer);
   INLINE static int do_unpack_int8(const char *buffer);
   INLINE static int do_unpack_int16(const char *buffer);
   INLINE static int do_unpack_int16(const char *buffer);
   INLINE static int do_unpack_int32(const char *buffer);
   INLINE static int do_unpack_int32(const char *buffer);
-  INLINE static PN_int64 do_unpack_int64(const char *buffer);
+  INLINE static int64_t do_unpack_int64(const char *buffer);
   INLINE static unsigned int do_unpack_uint8(const char *buffer);
   INLINE static unsigned int do_unpack_uint8(const char *buffer);
   INLINE static unsigned int do_unpack_uint16(const char *buffer);
   INLINE static unsigned int do_unpack_uint16(const char *buffer);
   INLINE static unsigned int do_unpack_uint32(const char *buffer);
   INLINE static unsigned int do_unpack_uint32(const char *buffer);
-  INLINE static PN_uint64 do_unpack_uint64(const char *buffer);
+  INLINE static uint64_t do_unpack_uint64(const char *buffer);
   INLINE static double do_unpack_float64(const char *buffer);
   INLINE static double do_unpack_float64(const char *buffer);
 
 
   INLINE static void validate_int_limits(int value, int num_bits,
   INLINE static void validate_int_limits(int value, int num_bits,
                                          bool &range_error);
                                          bool &range_error);
-  INLINE static void validate_int64_limits(PN_int64 value, int num_bits,
+  INLINE static void validate_int64_limits(int64_t value, int num_bits,
                                            bool &range_error);
                                            bool &range_error);
   INLINE static void validate_uint_limits(unsigned int value, int num_bits,
   INLINE static void validate_uint_limits(unsigned int value, int num_bits,
                                           bool &range_error);
                                           bool &range_error);
-  INLINE static void validate_uint64_limits(PN_uint64 value, int num_bits,
+  INLINE static void validate_uint64_limits(uint64_t value, int num_bits,
                                             bool &range_error);
                                             bool &range_error);
 
 
   const DCPackerCatalog *get_catalog() const;
   const DCPackerCatalog *get_catalog() const;

+ 2 - 2
direct/src/dcparser/dcParserDefs.h

@@ -48,8 +48,8 @@ public:
   union U {
   union U {
     int s_int;
     int s_int;
     unsigned int s_uint;
     unsigned int s_uint;
-    PN_int64 int64;
-    PN_uint64 uint64;
+    int64_t int64;
+    uint64_t uint64;
     double real;
     double real;
     bool flag;
     bool flag;
     DCClass *dclass;
     DCClass *dclass;

+ 82 - 82
direct/src/dcparser/dcSimpleParameter.cxx

@@ -313,7 +313,7 @@ set_modulus(double modulus) {
 
 
   bool range_error = false;
   bool range_error = false;
   _double_modulus = modulus * _divisor;
   _double_modulus = modulus * _divisor;
-  _uint64_modulus = (PN_uint64)floor(_double_modulus + 0.5);
+  _uint64_modulus = (uint64_t)floor(_double_modulus + 0.5);
   _uint_modulus = (unsigned int)_uint64_modulus;
   _uint_modulus = (unsigned int)_uint64_modulus;
 
 
   // Check the range.  The legitimate range for a modulus value is 1 through
   // Check the range.  The legitimate range for a modulus value is 1 through
@@ -413,8 +413,8 @@ set_range(const DCDoubleRange &range) {
   case ST_int8array:
   case ST_int8array:
     _int_range.clear();
     _int_range.clear();
     for (i = 0; i < num_ranges; i++) {
     for (i = 0; i < num_ranges; i++) {
-      PN_int64 min = (PN_int64)floor(range.get_min(i) * _divisor + 0.5);
-      PN_int64 max = (PN_int64)floor(range.get_max(i) * _divisor + 0.5);
+      int64_t min = (int64_t)floor(range.get_min(i) * _divisor + 0.5);
+      int64_t max = (int64_t)floor(range.get_max(i) * _divisor + 0.5);
       validate_int64_limits(min, 8, range_error);
       validate_int64_limits(min, 8, range_error);
       validate_int64_limits(max, 8, range_error);
       validate_int64_limits(max, 8, range_error);
       _int_range.add_range((int)min, (int)max);
       _int_range.add_range((int)min, (int)max);
@@ -425,8 +425,8 @@ set_range(const DCDoubleRange &range) {
   case ST_int16array:
   case ST_int16array:
     _int_range.clear();
     _int_range.clear();
     for (i = 0; i < num_ranges; i++) {
     for (i = 0; i < num_ranges; i++) {
-      PN_int64 min = (PN_int64)floor(range.get_min(i) * _divisor + 0.5);
-      PN_int64 max = (PN_int64)floor(range.get_max(i) * _divisor + 0.5);
+      int64_t min = (int64_t)floor(range.get_min(i) * _divisor + 0.5);
+      int64_t max = (int64_t)floor(range.get_max(i) * _divisor + 0.5);
       validate_int64_limits(min, 16, range_error);
       validate_int64_limits(min, 16, range_error);
       validate_int64_limits(max, 16, range_error);
       validate_int64_limits(max, 16, range_error);
       _int_range.add_range((int)min, (int)max);
       _int_range.add_range((int)min, (int)max);
@@ -437,8 +437,8 @@ set_range(const DCDoubleRange &range) {
   case ST_int32array:
   case ST_int32array:
     _int_range.clear();
     _int_range.clear();
     for (i = 0; i < num_ranges; i++) {
     for (i = 0; i < num_ranges; i++) {
-      PN_int64 min = (PN_int64)floor(range.get_min(i) * _divisor + 0.5);
-      PN_int64 max = (PN_int64)floor(range.get_max(i) * _divisor + 0.5);
+      int64_t min = (int64_t)floor(range.get_min(i) * _divisor + 0.5);
+      int64_t max = (int64_t)floor(range.get_max(i) * _divisor + 0.5);
       validate_int64_limits(min, 32, range_error);
       validate_int64_limits(min, 32, range_error);
       validate_int64_limits(max, 32, range_error);
       validate_int64_limits(max, 32, range_error);
       _int_range.add_range((int)min, (int)max);
       _int_range.add_range((int)min, (int)max);
@@ -448,8 +448,8 @@ set_range(const DCDoubleRange &range) {
   case ST_int64:
   case ST_int64:
     _int64_range.clear();
     _int64_range.clear();
     for (i = 0; i < num_ranges; i++) {
     for (i = 0; i < num_ranges; i++) {
-      PN_int64 min = (PN_int64)floor(range.get_min(i) * _divisor + 0.5);
-      PN_int64 max = (PN_int64)floor(range.get_max(i) * _divisor + 0.5);
+      int64_t min = (int64_t)floor(range.get_min(i) * _divisor + 0.5);
+      int64_t max = (int64_t)floor(range.get_max(i) * _divisor + 0.5);
       _int64_range.add_range(min, max);
       _int64_range.add_range(min, max);
     }
     }
     break;
     break;
@@ -459,8 +459,8 @@ set_range(const DCDoubleRange &range) {
   case ST_uint8array:
   case ST_uint8array:
     _uint_range.clear();
     _uint_range.clear();
     for (i = 0; i < num_ranges; i++) {
     for (i = 0; i < num_ranges; i++) {
-      PN_uint64 min = (PN_uint64)floor(range.get_min(i) * _divisor + 0.5);
-      PN_uint64 max = (PN_uint64)floor(range.get_max(i) * _divisor + 0.5);
+      uint64_t min = (uint64_t)floor(range.get_min(i) * _divisor + 0.5);
+      uint64_t max = (uint64_t)floor(range.get_max(i) * _divisor + 0.5);
       validate_uint64_limits(min, 8, range_error);
       validate_uint64_limits(min, 8, range_error);
       validate_uint64_limits(max, 8, range_error);
       validate_uint64_limits(max, 8, range_error);
       _uint_range.add_range((unsigned int)min, (unsigned int)max);
       _uint_range.add_range((unsigned int)min, (unsigned int)max);
@@ -471,8 +471,8 @@ set_range(const DCDoubleRange &range) {
   case ST_uint16array:
   case ST_uint16array:
     _uint_range.clear();
     _uint_range.clear();
     for (i = 0; i < num_ranges; i++) {
     for (i = 0; i < num_ranges; i++) {
-      PN_uint64 min = (PN_uint64)floor(range.get_min(i) * _divisor + 0.5);
-      PN_uint64 max = (PN_uint64)floor(range.get_max(i) * _divisor + 0.5);
+      uint64_t min = (uint64_t)floor(range.get_min(i) * _divisor + 0.5);
+      uint64_t max = (uint64_t)floor(range.get_max(i) * _divisor + 0.5);
       validate_uint64_limits(min, 16, range_error);
       validate_uint64_limits(min, 16, range_error);
       validate_uint64_limits(max, 16, range_error);
       validate_uint64_limits(max, 16, range_error);
       _uint_range.add_range((unsigned int)min, (unsigned int)max);
       _uint_range.add_range((unsigned int)min, (unsigned int)max);
@@ -483,8 +483,8 @@ set_range(const DCDoubleRange &range) {
   case ST_uint32array:
   case ST_uint32array:
     _uint_range.clear();
     _uint_range.clear();
     for (i = 0; i < num_ranges; i++) {
     for (i = 0; i < num_ranges; i++) {
-      PN_uint64 min = (PN_uint64)floor(range.get_min(i) * _divisor + 0.5);
-      PN_uint64 max = (PN_uint64)floor(range.get_max(i) * _divisor + 0.5);
+      uint64_t min = (uint64_t)floor(range.get_min(i) * _divisor + 0.5);
+      uint64_t max = (uint64_t)floor(range.get_max(i) * _divisor + 0.5);
       validate_uint64_limits(min, 32, range_error);
       validate_uint64_limits(min, 32, range_error);
       validate_uint64_limits(max, 32, range_error);
       validate_uint64_limits(max, 32, range_error);
       _uint_range.add_range((unsigned int)min, (unsigned int)max);
       _uint_range.add_range((unsigned int)min, (unsigned int)max);
@@ -494,8 +494,8 @@ set_range(const DCDoubleRange &range) {
   case ST_uint64:
   case ST_uint64:
     _uint64_range.clear();
     _uint64_range.clear();
     for (i = 0; i < num_ranges; i++) {
     for (i = 0; i < num_ranges; i++) {
-      PN_uint64 min = (PN_uint64)floor(range.get_min(i) * _divisor + 0.5);
-      PN_uint64 max = (PN_uint64)floor(range.get_max(i) * _divisor + 0.5);
+      uint64_t min = (uint64_t)floor(range.get_min(i) * _divisor + 0.5);
+      uint64_t max = (uint64_t)floor(range.get_max(i) * _divisor + 0.5);
       _uint64_range.add_range(min, max);
       _uint64_range.add_range(min, max);
     }
     }
     break;
     break;
@@ -513,8 +513,8 @@ set_range(const DCDoubleRange &range) {
   case ST_blob:
   case ST_blob:
     _uint_range.clear();
     _uint_range.clear();
     for (i = 0; i < num_ranges; i++) {
     for (i = 0; i < num_ranges; i++) {
-      PN_uint64 min = (PN_uint64)floor(range.get_min(i) * _divisor + 0.5);
-      PN_uint64 max = (PN_uint64)floor(range.get_max(i) * _divisor + 0.5);
+      uint64_t min = (uint64_t)floor(range.get_min(i) * _divisor + 0.5);
+      uint64_t max = (uint64_t)floor(range.get_max(i) * _divisor + 0.5);
       validate_uint64_limits(min, 16, range_error);
       validate_uint64_limits(min, 16, range_error);
       validate_uint64_limits(max, 16, range_error);
       validate_uint64_limits(max, 16, range_error);
       _uint_range.add_range((unsigned int)min, (unsigned int)max);
       _uint_range.add_range((unsigned int)min, (unsigned int)max);
@@ -536,8 +536,8 @@ set_range(const DCDoubleRange &range) {
   case ST_blob32:
   case ST_blob32:
     _uint_range.clear();
     _uint_range.clear();
     for (i = 0; i < num_ranges; i++) {
     for (i = 0; i < num_ranges; i++) {
-      PN_uint64 min = (PN_uint64)floor(range.get_min(i) * _divisor + 0.5);
-      PN_uint64 max = (PN_uint64)floor(range.get_max(i) * _divisor + 0.5);
+      uint64_t min = (uint64_t)floor(range.get_min(i) * _divisor + 0.5);
+      uint64_t max = (uint64_t)floor(range.get_max(i) * _divisor + 0.5);
       validate_uint64_limits(min, 32, range_error);
       validate_uint64_limits(min, 32, range_error);
       validate_uint64_limits(max, 32, range_error);
       validate_uint64_limits(max, 32, range_error);
       _uint_range.add_range((unsigned int)min, (unsigned int)max);
       _uint_range.add_range((unsigned int)min, (unsigned int)max);
@@ -634,7 +634,7 @@ pack_double(DCPackData &pack_data, double value,
 
 
   case ST_int64:
   case ST_int64:
     {
     {
-      PN_int64 int64_value = (PN_int64)floor(real_value + 0.5);
+      int64_t int64_value = (int64_t)floor(real_value + 0.5);
       _int64_range.validate(int64_value, range_error);
       _int64_range.validate(int64_value, range_error);
       do_pack_int64(pack_data.get_write_pointer(8), int64_value);
       do_pack_int64(pack_data.get_write_pointer(8), int64_value);
     }
     }
@@ -669,7 +669,7 @@ pack_double(DCPackData &pack_data, double value,
 
 
   case ST_uint64:
   case ST_uint64:
     {
     {
-      PN_uint64 int64_value = (PN_uint64)floor(real_value + 0.5);
+      uint64_t int64_value = (uint64_t)floor(real_value + 0.5);
       _uint64_range.validate(int64_value, range_error);
       _uint64_range.validate(int64_value, range_error);
       do_pack_uint64(pack_data.get_write_pointer(8), int64_value);
       do_pack_uint64(pack_data.get_write_pointer(8), int64_value);
     }
     }
@@ -696,7 +696,7 @@ pack_int(DCPackData &pack_data, int value,
   if (value != 0 && (int_value / value) != (int)_divisor) {
   if (value != 0 && (int_value / value) != (int)_divisor) {
     // If we've experienced overflow after applying the divisor, pack it as an
     // If we've experienced overflow after applying the divisor, pack it as an
     // int64 instead.
     // int64 instead.
-    pack_int64(pack_data, (PN_int64)value, pack_error, range_error);
+    pack_int64(pack_data, (int64_t)value, pack_error, range_error);
     return;
     return;
   }
   }
 
 
@@ -859,9 +859,9 @@ pack_uint(DCPackData &pack_data, unsigned int value,
  * Packs the indicated numeric or string value into the stream.
  * Packs the indicated numeric or string value into the stream.
  */
  */
 void DCSimpleParameter::
 void DCSimpleParameter::
-pack_int64(DCPackData &pack_data, PN_int64 value,
+pack_int64(DCPackData &pack_data, int64_t value,
             bool &pack_error, bool &range_error) const {
             bool &pack_error, bool &range_error) const {
-  PN_int64 int_value = value * _divisor;
+  int64_t int_value = value * _divisor;
   if (_has_modulus && _uint64_modulus != 0) {
   if (_has_modulus && _uint64_modulus != 0) {
     if (int_value < 0) {
     if (int_value < 0) {
       int_value = _uint64_modulus - 1 - (-int_value - 1) % _uint64_modulus;
       int_value = _uint64_modulus - 1 - (-int_value - 1) % _uint64_modulus;
@@ -899,35 +899,35 @@ pack_int64(DCPackData &pack_data, PN_int64 value,
     if (int_value < 0) {
     if (int_value < 0) {
       range_error = true;
       range_error = true;
     }
     }
-    _uint_range.validate((unsigned int)(PN_uint64)int_value, range_error);
-    validate_uint64_limits((PN_uint64)int_value, 8, range_error);
-    do_pack_uint8(pack_data.get_write_pointer(1), (unsigned int)(PN_uint64)int_value);
+    _uint_range.validate((unsigned int)(uint64_t)int_value, range_error);
+    validate_uint64_limits((uint64_t)int_value, 8, range_error);
+    do_pack_uint8(pack_data.get_write_pointer(1), (unsigned int)(uint64_t)int_value);
     break;
     break;
 
 
   case ST_uint16:
   case ST_uint16:
     if (int_value < 0) {
     if (int_value < 0) {
       range_error = true;
       range_error = true;
     }
     }
-    _uint_range.validate((unsigned int)(PN_uint64)int_value, range_error);
-    validate_uint64_limits((PN_uint64)int_value, 16, range_error);
-    do_pack_uint16(pack_data.get_write_pointer(2), (unsigned int)(PN_uint64)int_value);
+    _uint_range.validate((unsigned int)(uint64_t)int_value, range_error);
+    validate_uint64_limits((uint64_t)int_value, 16, range_error);
+    do_pack_uint16(pack_data.get_write_pointer(2), (unsigned int)(uint64_t)int_value);
     break;
     break;
 
 
   case ST_uint32:
   case ST_uint32:
     if (int_value < 0) {
     if (int_value < 0) {
       range_error = true;
       range_error = true;
     }
     }
-    _uint_range.validate((unsigned int)(PN_uint64)int_value, range_error);
-    validate_uint64_limits((PN_uint64)int_value, 32, range_error);
-    do_pack_uint32(pack_data.get_write_pointer(4), (unsigned int)(PN_uint64)int_value);
+    _uint_range.validate((unsigned int)(uint64_t)int_value, range_error);
+    validate_uint64_limits((uint64_t)int_value, 32, range_error);
+    do_pack_uint32(pack_data.get_write_pointer(4), (unsigned int)(uint64_t)int_value);
     break;
     break;
 
 
   case ST_uint64:
   case ST_uint64:
     if (int_value < 0) {
     if (int_value < 0) {
       range_error = true;
       range_error = true;
     }
     }
-    _uint64_range.validate((PN_uint64)int_value, range_error);
-    do_pack_uint64(pack_data.get_write_pointer(8), (PN_uint64)int_value);
+    _uint64_range.validate((uint64_t)int_value, range_error);
+    do_pack_uint64(pack_data.get_write_pointer(8), (uint64_t)int_value);
     break;
     break;
 
 
   case ST_float64:
   case ST_float64:
@@ -944,47 +944,47 @@ pack_int64(DCPackData &pack_data, PN_int64 value,
  * Packs the indicated numeric or string value into the stream.
  * Packs the indicated numeric or string value into the stream.
  */
  */
 void DCSimpleParameter::
 void DCSimpleParameter::
-pack_uint64(DCPackData &pack_data, PN_uint64 value,
+pack_uint64(DCPackData &pack_data, uint64_t value,
             bool &pack_error, bool &range_error) const {
             bool &pack_error, bool &range_error) const {
-  PN_uint64 int_value = value * _divisor;
+  uint64_t int_value = value * _divisor;
   if (_has_modulus && _uint64_modulus != 0) {
   if (_has_modulus && _uint64_modulus != 0) {
     int_value = int_value % _uint64_modulus;
     int_value = int_value % _uint64_modulus;
   }
   }
 
 
   switch (_type) {
   switch (_type) {
   case ST_int8:
   case ST_int8:
-    if ((PN_int64)int_value < 0) {
+    if ((int64_t)int_value < 0) {
       range_error = true;
       range_error = true;
     }
     }
-    _int_range.validate((int)(PN_int64)int_value, range_error);
-    validate_int64_limits((PN_int64)int_value, 8, range_error);
-    do_pack_int8(pack_data.get_write_pointer(1), (int)(PN_int64)int_value);
+    _int_range.validate((int)(int64_t)int_value, range_error);
+    validate_int64_limits((int64_t)int_value, 8, range_error);
+    do_pack_int8(pack_data.get_write_pointer(1), (int)(int64_t)int_value);
     break;
     break;
 
 
   case ST_int16:
   case ST_int16:
-    if ((PN_int64)int_value < 0) {
+    if ((int64_t)int_value < 0) {
       range_error = true;
       range_error = true;
     }
     }
-    _int_range.validate((int)(PN_int64)int_value, range_error);
-    validate_int64_limits((PN_int64)int_value, 16, range_error);
-    do_pack_int16(pack_data.get_write_pointer(2), (int)(PN_int64)int_value);
+    _int_range.validate((int)(int64_t)int_value, range_error);
+    validate_int64_limits((int64_t)int_value, 16, range_error);
+    do_pack_int16(pack_data.get_write_pointer(2), (int)(int64_t)int_value);
     break;
     break;
 
 
   case ST_int32:
   case ST_int32:
-    if ((PN_int64)int_value < 0) {
+    if ((int64_t)int_value < 0) {
       range_error = true;
       range_error = true;
     }
     }
-    _int_range.validate((int)(PN_int64)int_value, range_error);
-    validate_int64_limits((PN_int64)int_value, 32, range_error);
-    do_pack_int32(pack_data.get_write_pointer(4), (int)(PN_int64)int_value);
+    _int_range.validate((int)(int64_t)int_value, range_error);
+    validate_int64_limits((int64_t)int_value, 32, range_error);
+    do_pack_int32(pack_data.get_write_pointer(4), (int)(int64_t)int_value);
     break;
     break;
 
 
   case ST_int64:
   case ST_int64:
-    if ((PN_int64)int_value < 0) {
+    if ((int64_t)int_value < 0) {
       range_error = true;
       range_error = true;
     }
     }
-    _int64_range.validate((PN_int64)int_value, range_error);
-    do_pack_int64(pack_data.get_write_pointer(8), (PN_int64)int_value);
+    _int64_range.validate((int64_t)int_value, range_error);
+    do_pack_int64(pack_data.get_write_pointer(8), (int64_t)int_value);
     break;
     break;
 
 
   case ST_char:
   case ST_char:
@@ -1213,7 +1213,7 @@ unpack_double(const char *data, size_t length, size_t &p, double &value,
         pack_error = true;
         pack_error = true;
         return;
         return;
       }
       }
-      PN_int64 int_value = do_unpack_int64(data + p);
+      int64_t int_value = do_unpack_int64(data + p);
       _int64_range.validate(int_value, range_error);
       _int64_range.validate(int_value, range_error);
       value = (double)int_value;
       value = (double)int_value;
       p += 8;
       p += 8;
@@ -1266,7 +1266,7 @@ unpack_double(const char *data, size_t length, size_t &p, double &value,
         pack_error = true;
         pack_error = true;
         return;
         return;
       }
       }
-      PN_uint64 uint_value = do_unpack_uint64(data + p);
+      uint64_t uint_value = do_unpack_uint64(data + p);
       _uint64_range.validate(uint_value, range_error);
       _uint64_range.validate(uint_value, range_error);
       value = (double)uint_value;
       value = (double)uint_value;
       p += 8;
       p += 8;
@@ -1340,7 +1340,7 @@ unpack_int(const char *data, size_t length, size_t &p, int &value,
         pack_error = true;
         pack_error = true;
         return;
         return;
       }
       }
-      PN_int64 int_value = do_unpack_uint64(data + p);
+      int64_t int_value = do_unpack_uint64(data + p);
       _int64_range.validate(int_value, range_error);
       _int64_range.validate(int_value, range_error);
       value = (int)int_value;
       value = (int)int_value;
       if (value != int_value) {
       if (value != int_value) {
@@ -1400,7 +1400,7 @@ unpack_int(const char *data, size_t length, size_t &p, int &value,
         pack_error = true;
         pack_error = true;
         return;
         return;
       }
       }
-      PN_uint64 uint_value = do_unpack_uint64(data + p);
+      uint64_t uint_value = do_unpack_uint64(data + p);
       _uint64_range.validate(uint_value, range_error);
       _uint64_range.validate(uint_value, range_error);
       value = (int)(unsigned int)uint_value;
       value = (int)(unsigned int)uint_value;
       if ((unsigned int)value != uint_value || value < 0) {
       if ((unsigned int)value != uint_value || value < 0) {
@@ -1496,7 +1496,7 @@ unpack_uint(const char *data, size_t length, size_t &p, unsigned int &value,
         pack_error = true;
         pack_error = true;
         return;
         return;
       }
       }
-      PN_int64 int_value = do_unpack_int64(data + p);
+      int64_t int_value = do_unpack_int64(data + p);
       _int64_range.validate(int_value, range_error);
       _int64_range.validate(int_value, range_error);
       if (int_value < 0) {
       if (int_value < 0) {
         pack_error = true;
         pack_error = true;
@@ -1546,7 +1546,7 @@ unpack_uint(const char *data, size_t length, size_t &p, unsigned int &value,
         pack_error = true;
         pack_error = true;
         return;
         return;
       }
       }
-      PN_uint64 uint_value = do_unpack_uint64(data + p);
+      uint64_t uint_value = do_unpack_uint64(data + p);
       _uint64_range.validate(uint_value, range_error);
       _uint64_range.validate(uint_value, range_error);
       value = (unsigned int)uint_value;
       value = (unsigned int)uint_value;
       if (value != uint_value) {
       if (value != uint_value) {
@@ -1585,7 +1585,7 @@ unpack_uint(const char *data, size_t length, size_t &p, unsigned int &value,
  * Unpacks the current numeric or string value from the stream.
  * Unpacks the current numeric or string value from the stream.
  */
  */
 void DCSimpleParameter::
 void DCSimpleParameter::
-unpack_int64(const char *data, size_t length, size_t &p, PN_int64 &value,
+unpack_int64(const char *data, size_t length, size_t &p, int64_t &value,
               bool &pack_error, bool &range_error) const {
               bool &pack_error, bool &range_error) const {
   switch (_type) {
   switch (_type) {
   case ST_int8:
   case ST_int8:
@@ -1596,7 +1596,7 @@ unpack_int64(const char *data, size_t length, size_t &p, PN_int64 &value,
       }
       }
       int int_value = do_unpack_int8(data + p);
       int int_value = do_unpack_int8(data + p);
       _int_range.validate(int_value, range_error);
       _int_range.validate(int_value, range_error);
-      value = (PN_int64)int_value;
+      value = (int64_t)int_value;
       p++;
       p++;
     }
     }
     break;
     break;
@@ -1609,7 +1609,7 @@ unpack_int64(const char *data, size_t length, size_t &p, PN_int64 &value,
       }
       }
       int int_value = do_unpack_int16(data + p);
       int int_value = do_unpack_int16(data + p);
       _int_range.validate(int_value, range_error);
       _int_range.validate(int_value, range_error);
-      value = (PN_int64)int_value;
+      value = (int64_t)int_value;
       p += 2;
       p += 2;
     }
     }
     break;
     break;
@@ -1622,7 +1622,7 @@ unpack_int64(const char *data, size_t length, size_t &p, PN_int64 &value,
       }
       }
       int int_value = do_unpack_int32(data + p);
       int int_value = do_unpack_int32(data + p);
       _int_range.validate(int_value, range_error);
       _int_range.validate(int_value, range_error);
-      value = (PN_int64)int_value;
+      value = (int64_t)int_value;
       p += 4;
       p += 4;
     }
     }
     break;
     break;
@@ -1646,7 +1646,7 @@ unpack_int64(const char *data, size_t length, size_t &p, PN_int64 &value,
       }
       }
       unsigned int uint_value = do_unpack_uint8(data + p);
       unsigned int uint_value = do_unpack_uint8(data + p);
       _uint_range.validate(uint_value, range_error);
       _uint_range.validate(uint_value, range_error);
-      value = (PN_int64)(int)uint_value;
+      value = (int64_t)(int)uint_value;
       p++;
       p++;
     }
     }
     break;
     break;
@@ -1659,7 +1659,7 @@ unpack_int64(const char *data, size_t length, size_t &p, PN_int64 &value,
       }
       }
       unsigned int uint_value = do_unpack_uint16(data + p);
       unsigned int uint_value = do_unpack_uint16(data + p);
       _uint_range.validate(uint_value, range_error);
       _uint_range.validate(uint_value, range_error);
-      value = (PN_int64)(int)uint_value;
+      value = (int64_t)(int)uint_value;
       p += 2;
       p += 2;
     }
     }
     break;
     break;
@@ -1672,7 +1672,7 @@ unpack_int64(const char *data, size_t length, size_t &p, PN_int64 &value,
       }
       }
       unsigned int uint_value = do_unpack_uint32(data + p);
       unsigned int uint_value = do_unpack_uint32(data + p);
       _uint_range.validate(uint_value, range_error);
       _uint_range.validate(uint_value, range_error);
-      value = (PN_int64)(int)uint_value;
+      value = (int64_t)(int)uint_value;
       p += 4;
       p += 4;
     }
     }
     break;
     break;
@@ -1683,9 +1683,9 @@ unpack_int64(const char *data, size_t length, size_t &p, PN_int64 &value,
         pack_error = true;
         pack_error = true;
         return;
         return;
       }
       }
-      PN_uint64 uint_value = do_unpack_uint64(data + p);
+      uint64_t uint_value = do_unpack_uint64(data + p);
       _uint64_range.validate(uint_value, range_error);
       _uint64_range.validate(uint_value, range_error);
-      value = (PN_int64)uint_value;
+      value = (int64_t)uint_value;
       if (value < 0) {
       if (value < 0) {
         pack_error = true;
         pack_error = true;
       }
       }
@@ -1701,7 +1701,7 @@ unpack_int64(const char *data, size_t length, size_t &p, PN_int64 &value,
       }
       }
       double real_value = do_unpack_float64(data + p);
       double real_value = do_unpack_float64(data + p);
       _double_range.validate(real_value, range_error);
       _double_range.validate(real_value, range_error);
-      value = (PN_int64)real_value;
+      value = (int64_t)real_value;
       p += 8;
       p += 8;
     }
     }
     break;
     break;
@@ -1722,7 +1722,7 @@ unpack_int64(const char *data, size_t length, size_t &p, PN_int64 &value,
  * Unpacks the current numeric or string value from the stream.
  * Unpacks the current numeric or string value from the stream.
  */
  */
 void DCSimpleParameter::
 void DCSimpleParameter::
-unpack_uint64(const char *data, size_t length, size_t &p, PN_uint64 &value,
+unpack_uint64(const char *data, size_t length, size_t &p, uint64_t &value,
               bool &pack_error, bool &range_error) const {
               bool &pack_error, bool &range_error) const {
   switch (_type) {
   switch (_type) {
   case ST_int8:
   case ST_int8:
@@ -1736,7 +1736,7 @@ unpack_uint64(const char *data, size_t length, size_t &p, PN_uint64 &value,
       if (int_value < 0) {
       if (int_value < 0) {
         pack_error = true;
         pack_error = true;
       }
       }
-      value = (PN_uint64)(unsigned int)int_value;
+      value = (uint64_t)(unsigned int)int_value;
       p++;
       p++;
     }
     }
     break;
     break;
@@ -1752,7 +1752,7 @@ unpack_uint64(const char *data, size_t length, size_t &p, PN_uint64 &value,
       if (int_value < 0) {
       if (int_value < 0) {
         pack_error = true;
         pack_error = true;
       }
       }
-      value = (PN_uint64)(unsigned int)int_value;
+      value = (uint64_t)(unsigned int)int_value;
       p += 2;
       p += 2;
     }
     }
     break;
     break;
@@ -1768,7 +1768,7 @@ unpack_uint64(const char *data, size_t length, size_t &p, PN_uint64 &value,
       if (int_value < 0) {
       if (int_value < 0) {
         pack_error = true;
         pack_error = true;
       }
       }
-      value = (PN_uint64)(unsigned int)int_value;
+      value = (uint64_t)(unsigned int)int_value;
       p += 4;
       p += 4;
     }
     }
     break;
     break;
@@ -1779,12 +1779,12 @@ unpack_uint64(const char *data, size_t length, size_t &p, PN_uint64 &value,
         pack_error = true;
         pack_error = true;
         return;
         return;
       }
       }
-      PN_int64 int_value = do_unpack_int64(data + p);
+      int64_t int_value = do_unpack_int64(data + p);
       _int64_range.validate(int_value, range_error);
       _int64_range.validate(int_value, range_error);
       if (int_value < 0) {
       if (int_value < 0) {
         pack_error = true;
         pack_error = true;
       }
       }
-      value = (PN_uint64)int_value;
+      value = (uint64_t)int_value;
       p += 8;
       p += 8;
     }
     }
     break;
     break;
@@ -1798,7 +1798,7 @@ unpack_uint64(const char *data, size_t length, size_t &p, PN_uint64 &value,
       }
       }
       unsigned int uint_value = do_unpack_uint8(data + p);
       unsigned int uint_value = do_unpack_uint8(data + p);
       _uint_range.validate(uint_value, range_error);
       _uint_range.validate(uint_value, range_error);
-      value = (PN_uint64)uint_value;
+      value = (uint64_t)uint_value;
       p++;
       p++;
     }
     }
     break;
     break;
@@ -1811,7 +1811,7 @@ unpack_uint64(const char *data, size_t length, size_t &p, PN_uint64 &value,
       }
       }
       unsigned int uint_value = do_unpack_uint16(data + p);
       unsigned int uint_value = do_unpack_uint16(data + p);
       _uint_range.validate(uint_value, range_error);
       _uint_range.validate(uint_value, range_error);
-      value = (PN_uint64)uint_value;
+      value = (uint64_t)uint_value;
       p += 2;
       p += 2;
     }
     }
     break;
     break;
@@ -1824,7 +1824,7 @@ unpack_uint64(const char *data, size_t length, size_t &p, PN_uint64 &value,
       }
       }
       unsigned int uint_value = do_unpack_uint32(data + p);
       unsigned int uint_value = do_unpack_uint32(data + p);
       _uint_range.validate(uint_value, range_error);
       _uint_range.validate(uint_value, range_error);
-      value = (PN_uint64)uint_value;
+      value = (uint64_t)uint_value;
       p += 4;
       p += 4;
     }
     }
     break;
     break;
@@ -1847,7 +1847,7 @@ unpack_uint64(const char *data, size_t length, size_t &p, PN_uint64 &value,
       }
       }
       double real_value = do_unpack_float64(data + p);
       double real_value = do_unpack_float64(data + p);
       _double_range.validate(real_value, range_error);
       _double_range.validate(real_value, range_error);
-      value = (PN_uint64)real_value;
+      value = (uint64_t)real_value;
       p += 8;
       p += 8;
     }
     }
     break;
     break;
@@ -1990,7 +1990,7 @@ unpack_validate(const char *data, size_t length, size_t &p,
         pack_error = true;
         pack_error = true;
         return true;
         return true;
       }
       }
-      PN_int64 int_value = do_unpack_int64(data + p);
+      int64_t int_value = do_unpack_int64(data + p);
       _int64_range.validate(int_value, range_error);
       _int64_range.validate(int_value, range_error);
       p += 8;
       p += 8;
     }
     }
@@ -2039,7 +2039,7 @@ unpack_validate(const char *data, size_t length, size_t &p,
         pack_error = true;
         pack_error = true;
         return true;
         return true;
       }
       }
-      PN_uint64 uint_value = do_unpack_uint64(data + p);
+      uint64_t uint_value = do_unpack_uint64(data + p);
       _uint64_range.validate(uint_value, range_error);
       _uint64_range.validate(uint_value, range_error);
       p += 8;
       p += 8;
     }
     }

+ 5 - 5
direct/src/dcparser/dcSimpleParameter.h

@@ -56,9 +56,9 @@ public:
                         bool &pack_error, bool &range_error) const;
                         bool &pack_error, bool &range_error) const;
   virtual void pack_uint(DCPackData &pack_data, unsigned int value,
   virtual void pack_uint(DCPackData &pack_data, unsigned int value,
                          bool &pack_error, bool &range_error) const;
                          bool &pack_error, bool &range_error) const;
-  virtual void pack_int64(DCPackData &pack_data, PN_int64 value,
+  virtual void pack_int64(DCPackData &pack_data, int64_t value,
                           bool &pack_error, bool &range_error) const;
                           bool &pack_error, bool &range_error) const;
-  virtual void pack_uint64(DCPackData &pack_data, PN_uint64 value,
+  virtual void pack_uint64(DCPackData &pack_data, uint64_t value,
                            bool &pack_error, bool &range_error) const;
                            bool &pack_error, bool &range_error) const;
   virtual void pack_string(DCPackData &pack_data, const string &value,
   virtual void pack_string(DCPackData &pack_data, const string &value,
                            bool &pack_error, bool &range_error) const;
                            bool &pack_error, bool &range_error) const;
@@ -71,9 +71,9 @@ public:
   virtual void unpack_uint(const char *data, size_t length, size_t &p,
   virtual void unpack_uint(const char *data, size_t length, size_t &p,
                            unsigned int &value, bool &pack_error, bool &range_error) const;
                            unsigned int &value, bool &pack_error, bool &range_error) const;
   virtual void unpack_int64(const char *data, size_t length, size_t &p,
   virtual void unpack_int64(const char *data, size_t length, size_t &p,
-                            PN_int64 &value, bool &pack_error, bool &range_error) const;
+                            int64_t &value, bool &pack_error, bool &range_error) const;
   virtual void unpack_uint64(const char *data, size_t length, size_t &p,
   virtual void unpack_uint64(const char *data, size_t length, size_t &p,
-                             PN_uint64 &value, bool &pack_error, bool &range_error) const;
+                             uint64_t &value, bool &pack_error, bool &range_error) const;
   virtual void unpack_string(const char *data, size_t length, size_t &p,
   virtual void unpack_string(const char *data, size_t length, size_t &p,
                              string &value, bool &pack_error, bool &range_error) const;
                              string &value, bool &pack_error, bool &range_error) const;
   virtual bool unpack_validate(const char *data, size_t length, size_t &p,
   virtual bool unpack_validate(const char *data, size_t length, size_t &p,
@@ -125,7 +125,7 @@ private:
 
 
   // All of these modulus values will be filled in, regardless of the type.
   // All of these modulus values will be filled in, regardless of the type.
   unsigned int _uint_modulus;
   unsigned int _uint_modulus;
-  PN_uint64 _uint64_modulus;
+  uint64_t _uint64_modulus;
   double _double_modulus;
   double _double_modulus;
 
 
   static DCClassParameter *_uint32uint8_type;
   static DCClassParameter *_uint32uint8_type;

+ 4 - 14
direct/src/dcparser/dcbase.h

@@ -102,17 +102,7 @@ typedef string Filename;
 #define pmap map
 #define pmap map
 #define pset set
 #define pset set
 
 
-#ifdef WIN32
-typedef __int64 PN_int64;
-typedef unsigned __int64 PN_uint64;
-#else
-typedef long long PN_int64;
-typedef unsigned long long PN_uint64;
-#endif
-
-typedef unsigned char PN_uint8;
-typedef unsigned short PN_uint16;
-typedef unsigned int PN_uint32;
+#include <stdint.h>
 
 
 typedef ifstream pifstream;
 typedef ifstream pifstream;
 typedef ofstream pofstream;
 typedef ofstream pofstream;
@@ -121,8 +111,8 @@ typedef fstream pfstream;
 #endif  // WITHIN_PANDA
 #endif  // WITHIN_PANDA
 
 
 // typedef       unsigned long   CHANNEL_TYPE;
 // typedef       unsigned long   CHANNEL_TYPE;
-typedef       PN_uint64   CHANNEL_TYPE;
-typedef       PN_uint32   DOID_TYPE;
-typedef       PN_uint32   ZONEID_TYPE;
+typedef       uint64_t   CHANNEL_TYPE;
+typedef       uint32_t   DOID_TYPE;
+typedef       uint32_t   ZONEID_TYPE;
 
 
 #endif  // DCBASE_H
 #endif  // DCBASE_H

+ 10 - 10
direct/src/directdevices/DirectDeviceManager.py

@@ -48,10 +48,10 @@ class DirectButtons(ButtonNode, DirectObject):
     def __init__(self, vrpnClient, device):
     def __init__(self, vrpnClient, device):
         # Keep track of number of buttons created
         # Keep track of number of buttons created
         DirectButtons.buttonCount += 1
         DirectButtons.buttonCount += 1
-        # Create a unique name for this button object
-        self.name = 'DirectButtons-' + repr(DirectButtons.buttonCount)
         # Create a new button node for the given device
         # Create a new button node for the given device
         ButtonNode.__init__(self, vrpnClient, device)
         ButtonNode.__init__(self, vrpnClient, device)
+        # Create a unique name for this button object
+        self.name = 'DirectButtons-' + repr(DirectButtons.buttonCount)
         # Attach node to data graph
         # Attach node to data graph
         self.nodePath = myBase.dataRoot.attachNewNode(self)
         self.nodePath = myBase.dataRoot.attachNewNode(self)
 
 
@@ -86,10 +86,10 @@ class DirectAnalogs(AnalogNode, DirectObject):
     def __init__(self, vrpnClient, device):
     def __init__(self, vrpnClient, device):
         # Keep track of number of analogs created
         # Keep track of number of analogs created
         DirectAnalogs.analogCount += 1
         DirectAnalogs.analogCount += 1
-        # Create a unique name for this analog object
-        self.name = 'DirectAnalogs-' + repr(DirectAnalogs.analogCount)
         # Create a new analog node for the given device
         # Create a new analog node for the given device
         AnalogNode.__init__(self, vrpnClient, device)
         AnalogNode.__init__(self, vrpnClient, device)
+        # Create a unique name for this analog object
+        self.name = 'DirectAnalogs-' + repr(DirectAnalogs.analogCount)
         # Attach node to data graph
         # Attach node to data graph
         self.nodePath = myBase.dataRoot.attachNewNode(self)
         self.nodePath = myBase.dataRoot.attachNewNode(self)
         # See if any of the general analog parameters are dconfig'd
         # See if any of the general analog parameters are dconfig'd
@@ -182,10 +182,10 @@ class DirectTracker(TrackerNode, DirectObject):
     def __init__(self, vrpnClient, device):
     def __init__(self, vrpnClient, device):
         # Keep track of number of trackers created
         # Keep track of number of trackers created
         DirectTracker.trackerCount += 1
         DirectTracker.trackerCount += 1
-        # Create a unique name for this tracker object
-        self.name = 'DirectTracker-' + repr(DirectTracker.trackerCount)
         # Create a new tracker node for the given device
         # Create a new tracker node for the given device
         TrackerNode.__init__(self, vrpnClient, device)
         TrackerNode.__init__(self, vrpnClient, device)
+        # Create a unique name for this tracker object
+        self.name = 'DirectTracker-' + repr(DirectTracker.trackerCount)
         # Attach node to data graph
         # Attach node to data graph
         self.nodePath = myBase.dataRoot.attachNewNode(self)
         self.nodePath = myBase.dataRoot.attachNewNode(self)
 
 
@@ -209,10 +209,10 @@ class DirectDials(DialNode, DirectObject):
     def __init__(self, vrpnClient, device):
     def __init__(self, vrpnClient, device):
         # Keep track of number of dials created
         # Keep track of number of dials created
         DirectDials.dialCount += 1
         DirectDials.dialCount += 1
-        # Create a unique name for this dial object
-        self.name = 'DirectDials-' + repr(DirectDials.dialCount)
         # Create a new dial node for the given device
         # Create a new dial node for the given device
         DialNode.__init__(self, vrpnClient, device)
         DialNode.__init__(self, vrpnClient, device)
+        # Create a unique name for this dial object
+        self.name = 'DirectDials-' + repr(DirectDials.dialCount)
         # Attach node to data graph
         # Attach node to data graph
         self.nodePath = myBase.dataRoot.attachNewNode(self)
         self.nodePath = myBase.dataRoot.attachNewNode(self)
 
 
@@ -249,6 +249,8 @@ class DirectTimecodeReader(AnalogNode, DirectObject):
     def __init__(self, vrpnClient, device):
     def __init__(self, vrpnClient, device):
         # Keep track of number of timecodeReader created
         # Keep track of number of timecodeReader created
         DirectTimecodeReader.timecodeReaderCount += 1
         DirectTimecodeReader.timecodeReaderCount += 1
+        # Create a new dial node for the given device
+        AnalogNode.__init__(self, vrpnClient, device)
         # Create a unique name for this dial object
         # Create a unique name for this dial object
         self.name = ('DirectTimecodeReader-' +
         self.name = ('DirectTimecodeReader-' +
                      repr(DirectTimecodeReader.timecodeReaderCount))
                      repr(DirectTimecodeReader.timecodeReaderCount))
@@ -257,8 +259,6 @@ class DirectTimecodeReader(AnalogNode, DirectObject):
         self.seconds = 0
         self.seconds = 0
         self.minutes = 0
         self.minutes = 0
         self.hours = 0
         self.hours = 0
-        # Create a new dial node for the given device
-        AnalogNode.__init__(self, vrpnClient, device)
         # Attach node to data graph
         # Attach node to data graph
         self.nodePath = myBase.dataRoot.attachNewNode(self)
         self.nodePath = myBase.dataRoot.attachNewNode(self)
 
 

+ 1 - 1
direct/src/directscripts/eggcacher.py

@@ -55,7 +55,7 @@ class EggCacher:
             size = os.path.getsize(path)
             size = os.path.getsize(path)
             eggs.append((path,size))
             eggs.append((path,size))
             return
             return
-        if (path.endswith(".egg.pz")):
+        if (path.endswith(".egg.pz") or path.endswith(".egg.gz")):
             size = os.path.getsize(path)
             size = os.path.getsize(path)
             if (self.pzkeep): eggs.append((path,size))
             if (self.pzkeep): eggs.append((path,size))
             else: eggs.append((path[:-3],size))
             else: eggs.append((path[:-3],size))

+ 1 - 1
direct/src/directscripts/packpanda.py

@@ -274,7 +274,7 @@ def CompileFiles(file):
     if (os.path.isfile(file)):
     if (os.path.isfile(file)):
         if (file.endswith(".egg")):
         if (file.endswith(".egg")):
             egg2bam(file, file[:-4]+'.bam')
             egg2bam(file, file[:-4]+'.bam')
-        elif (file.endswith(".egg.pz")):
+        elif (file.endswith(".egg.pz") or file.endswith(".egg.gz")):
             egg2bam(file, file[:-7]+'.bam')
             egg2bam(file, file[:-7]+'.bam')
         elif (file.endswith(".py")):
         elif (file.endswith(".py")):
             py2pyc(file)
             py2pyc(file)

+ 0 - 1
direct/src/distributed/DistributedObjectBase.py

@@ -13,7 +13,6 @@ class DistributedObjectBase(DirectObject):
     def __init__(self, cr):
     def __init__(self, cr):
         assert self.notify.debugStateCall(self)
         assert self.notify.debugStateCall(self)
         self.cr = cr
         self.cr = cr
-        self.children = {}
         self.parentId = None
         self.parentId = None
         self.zoneId = None
         self.zoneId = None
 
 

+ 5 - 1
direct/src/distributed/DistributedObjectGlobalUD.py

@@ -35,7 +35,11 @@ class DistributedObjectGlobalUD(DistributedObjectUD):
     def __execMessage(self, message):
     def __execMessage(self, message):
         if not self.ExecNamespace:
         if not self.ExecNamespace:
             # Import some useful variables into the ExecNamespace initially.
             # Import some useful variables into the ExecNamespace initially.
-            exec('from pandac.PandaModules import *', globals(), self.ExecNamespace)
+            import pandac.PandaModules
+
+            for key, value in pandac.PandaModules.__dict__.items():
+                if not key.startswith('__'):
+                    self.ExecNamespace[key] = value
             #self.importExecNamespace()
             #self.importExecNamespace()
 
 
         # Now try to evaluate the expression using ChatInputNormal.ExecNamespace as
         # Now try to evaluate the expression using ChatInputNormal.ExecNamespace as

+ 1 - 1
direct/src/distributed/cDistributedSmoothNodeBase.I

@@ -184,7 +184,7 @@ d_setSmPosHpr(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat h, PN_std
  *
  *
  */
  */
 INLINE void CDistributedSmoothNodeBase::
 INLINE void CDistributedSmoothNodeBase::
-d_setSmPosHprL(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r, PN_uint64 l) {
+d_setSmPosHprL(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r, uint64_t l) {
   // cout << "d_setSmPosHprL: " << x << ", " << y << ", " << z << ", " << h <<
   // cout << "d_setSmPosHprL: " << x << ", " << y << ", " << z << ", " << h <<
   // ", " << p << ", " << r << l << endl;
   // ", " << p << ", " << r << l << endl;
   DCPacker packer;
   DCPacker packer;

+ 1 - 1
direct/src/distributed/cDistributedSmoothNodeBase.cxx

@@ -358,7 +358,7 @@ finish_send_update(DCPacker &packer) {
  * Appends the timestamp and sends the update.
  * Appends the timestamp and sends the update.
  */
  */
 void CDistributedSmoothNodeBase::
 void CDistributedSmoothNodeBase::
-set_curr_l(PN_uint64 l) {
+set_curr_l(uint64_t l) {
   _currL[1] = l;
   _currL[1] = l;
 }
 }
 
 

+ 3 - 3
direct/src/distributed/cDistributedSmoothNodeBase.h

@@ -51,7 +51,7 @@ PUBLISHED:
   void broadcast_pos_hpr_xyh();
   void broadcast_pos_hpr_xyh();
   void broadcast_pos_hpr_xy();
   void broadcast_pos_hpr_xy();
 
 
-  void set_curr_l(PN_uint64 l);
+  void set_curr_l(uint64_t l);
   void print_curr_l();
   void print_curr_l();
 
 
 private:
 private:
@@ -67,7 +67,7 @@ private:
   INLINE void d_setSmXYH(PN_stdfloat x, PN_stdfloat y, PN_stdfloat h);
   INLINE void d_setSmXYH(PN_stdfloat x, PN_stdfloat y, PN_stdfloat h);
   INLINE void d_setSmXYZH(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat h);
   INLINE void d_setSmXYZH(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat h);
   INLINE void d_setSmPosHpr(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r);
   INLINE void d_setSmPosHpr(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r);
-  INLINE void d_setSmPosHprL(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r, PN_uint64 l);
+  INLINE void d_setSmPosHprL(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r, uint64_t l);
 
 
   void begin_send_update(DCPacker &packer, const string &field_name);
   void begin_send_update(DCPacker &packer, const string &field_name);
   void finish_send_update(DCPacker &packer);
   void finish_send_update(DCPacker &packer);
@@ -97,7 +97,7 @@ private:
   bool _store_stop;
   bool _store_stop;
   // contains most recently sent location info as index 0, index 1 contains
   // contains most recently sent location info as index 0, index 1 contains
   // most recently set location info
   // most recently set location info
-  PN_uint64 _currL[2];
+  uint64_t _currL[2];
 };
 };
 
 
 #include "cDistributedSmoothNodeBase.I"
 #include "cDistributedSmoothNodeBase.I"

+ 1 - 1
direct/src/fsm/FSM.py

@@ -310,7 +310,7 @@ class FSM(DirectObject):
                 self.name, request, str(args)[1:]))
                 self.name, request, str(args)[1:]))
 
 
             filter = self.getCurrentFilter()
             filter = self.getCurrentFilter()
-            result = list(filter(request, args))
+            result = filter(request, args)
             if result:
             if result:
                 if isinstance(result, str):
                 if isinstance(result, str):
                     # If the return value is a string, it's just the name
                     # If the return value is a string, it's just the name

+ 16 - 16
direct/src/interval/MetaInterval.py

@@ -268,7 +268,7 @@ class MetaInterval(CMetaInterval):
             self.addInterval(ival, maxDuration - ival.getDuration(), TRACK_START)
             self.addInterval(ival, maxDuration - ival.getDuration(), TRACK_START)
         self.popLevel(duration)
         self.popLevel(duration)
 
 
-    def addTrack(self, list, name, relTime, relTo, duration):
+    def addTrack(self, trackList, name, relTime, relTo, duration):
         # Adds a "track list".  This is a list of tuples of the form:
         # Adds a "track list".  This is a list of tuples of the form:
         #
         #
         #   (<delay>, <Interval>,
         #   (<delay>, <Interval>,
@@ -281,19 +281,19 @@ class MetaInterval(CMetaInterval):
         # (TRACK_START).  If the relative code is omitted, the default
         # (TRACK_START).  If the relative code is omitted, the default
         # is TRACK_START.
         # is TRACK_START.
         self.pushLevel(name, relTime, relTo)
         self.pushLevel(name, relTime, relTo)
-        for tuple in list:
-            if isinstance(tuple, tuple) or \
-               isinstance(tuple, list):
-                relTime = tuple[0]
-                ival = tuple[1]
-                if len(tuple) >= 3:
-                    relTo = tuple[2]
+        for tupleObj in trackList:
+            if isinstance(tupleObj, tuple) or \
+               isinstance(tupleObj, list):
+                relTime = tupleObj[0]
+                ival = tupleObj[1]
+                if len(tupleObj) >= 3:
+                    relTo = tupleObj[2]
                 else:
                 else:
                     relTo = TRACK_START
                     relTo = TRACK_START
                 self.addInterval(ival, relTime, relTo)
                 self.addInterval(ival, relTime, relTo)
 
 
             else:
             else:
-                self.notify.error("Not a tuple in Track: %s" % (tuple,))
+                self.notify.error("Not a tuple in Track: %s" % (tupleObj,))
         self.popLevel(duration)
         self.popLevel(duration)
 
 
     def addInterval(self, ival, relTime, relTo):
     def addInterval(self, ival, relTime, relTo):
@@ -593,22 +593,22 @@ class Track(MetaInterval):
         meta.addTrack(self.ivals, self.getName(),
         meta.addTrack(self.ivals, self.getName(),
                       relTime, relTo, self.phonyDuration)
                       relTime, relTo, self.phonyDuration)
 
 
-    def validateComponent(self, tuple):
+    def validateComponent(self, tupleObj):
         # This is called only in debug mode to verify that the
         # This is called only in debug mode to verify that the
         # indicated component added to the MetaInterval is appropriate
         # indicated component added to the MetaInterval is appropriate
         # to this type of MetaInterval.  In most cases except Track,
         # to this type of MetaInterval.  In most cases except Track,
         # this is the same as asking that the component is itself an
         # this is the same as asking that the component is itself an
         # Interval.
         # Interval.
 
 
-        if not (isinstance(tuple, tuple) or \
-                isinstance(tuple, list)):
+        if not (isinstance(tupleObj, tuple) or \
+                isinstance(tupleObj, list)):
             # It's not a tuple.
             # It's not a tuple.
             return 0
             return 0
 
 
-        relTime = tuple[0]
-        ival = tuple[1]
-        if len(tuple) >= 3:
-            relTo = tuple[2]
+        relTime = tupleObj[0]
+        ival = tupleObj[1]
+        if len(tupleObj) >= 3:
+            relTo = tupleObj[2]
         else:
         else:
             relTo = TRACK_START
             relTo = TRACK_START
 
 

+ 3 - 2
direct/src/p3d/Packager.py

@@ -61,7 +61,7 @@ class Packager:
                 self.newName = str(self.filename)
                 self.newName = str(self.filename)
 
 
             ext = Filename(self.newName).getExtension()
             ext = Filename(self.newName).getExtension()
-            if ext == 'pz':
+            if ext == 'pz' or ext == 'gz':
                 # Strip off a .pz extension; we can compress files
                 # Strip off a .pz extension; we can compress files
                 # within the Multifile without it.
                 # within the Multifile without it.
                 filename = Filename(self.newName)
                 filename = Filename(self.newName)
@@ -2484,6 +2484,7 @@ class Packager:
             GlobPattern('libthr.so*'),
             GlobPattern('libthr.so*'),
             GlobPattern('ld-linux.so*'),
             GlobPattern('ld-linux.so*'),
             GlobPattern('ld-linux-*.so*'),
             GlobPattern('ld-linux-*.so*'),
+            GlobPattern('librt.so*'),
             ]
             ]
 
 
         # A Loader for loading models.
         # A Loader for loading models.
@@ -3772,7 +3773,7 @@ class Packager:
             self.currentPackage.addFile(filename, newName = newName,
             self.currentPackage.addFile(filename, newName = newName,
                                         explicit = False, unprocessed = unprocessed)
                                         explicit = False, unprocessed = unprocessed)
         else:
         else:
-            if ext == 'pz':
+            if ext == 'pz' or ext == 'gz':
                 # Strip off an implicit .pz extension.
                 # Strip off an implicit .pz extension.
                 newFilename = Filename(filename)
                 newFilename = Filename(filename)
                 newFilename.setExtension('')
                 newFilename.setExtension('')

+ 1 - 1
direct/src/p3d/PatchMaker.py

@@ -137,7 +137,7 @@ class PatchMaker:
 
 
             startFile, startPv, plan = self.getRecreateFilePlan()
             startFile, startPv, plan = self.getRecreateFilePlan()
 
 
-            if startFile.getExtension() == 'pz':
+            if startFile.getExtension() in ('pz', 'gz'):
                 # If the starting file is compressed, we have to
                 # If the starting file is compressed, we have to
                 # decompress it first.
                 # decompress it first.
                 assert startPv.tempFile is None
                 assert startPv.tempFile is None

+ 6 - 1
direct/src/p3d/SeqValue.py

@@ -77,9 +77,14 @@ class SeqValue:
         """ Compares to another seq value. """
         """ Compares to another seq value. """
         return cmp(self.value, other.value)
         return cmp(self.value, other.value)
 
 
+    def __lt__(self, other):
+        return self.value < other.value
+
+    def __gt__(self, other):
+        return self.value > other.value
+
     def __bool__(self):
     def __bool__(self):
         return bool(self.value)
         return bool(self.value)
 
 
     def __str__(self):
     def __str__(self):
         return 'SeqValue%s' % (repr(self.value))
         return 'SeqValue%s' % (repr(self.value))
-

+ 8 - 3
direct/src/p3d/panda3d.pdef

@@ -63,8 +63,10 @@ class panda3d(package):
 
 
     # Include various standard Python encodings.  The rest is in morepy.
     # Include various standard Python encodings.  The rest is in morepy.
     module('encodings', 'encodings.aliases', 'encodings.undefined',
     module('encodings', 'encodings.aliases', 'encodings.undefined',
-           'encodings.utf_8', 'encodings.ascii', 'encodings.string_escape',
-           'encodings.mbcs', 'encodings.latin_1', 'io')
+           'encodings.utf_8', 'encodings.ascii', 'encodings.mbcs',
+           'encodings.latin_1', 'io')
+    if sys.version_info < (3, 0):
+        module('encodings.string_escape')
 
 
     # Pick up the shader files that appear in direct/src/filter.
     # Pick up the shader files that appear in direct/src/filter.
     import direct
     import direct
@@ -241,7 +243,10 @@ class models(package):
     # we assume this is the models directory.
     # we assume this is the models directory.
     pathname = getModelPath().findFile('cmss12.egg')
     pathname = getModelPath().findFile('cmss12.egg')
     if pathname:
     if pathname:
-        dir(pathname.getDirname(), newDir = '')
+        dir(pathname.getDirname(), newDir = 'models')
+
+    # Some people are used to loading the models without models/ prefix.
+    file('models.prc', extract = True, text = "model-path $MODELS_ROOT/models")
 
 
 
 
 class fmod(package):
 class fmod(package):

+ 3 - 2
direct/src/plugin/p3dPackage.cxx

@@ -998,7 +998,8 @@ build_install_plans(TiXmlDocument *doc) {
           FileSpec new_file = patchfile->_file;
           FileSpec new_file = patchfile->_file;
           string new_filename = new_file.get_filename();
           string new_filename = new_file.get_filename();
           size_t dot = new_filename.rfind('.');
           size_t dot = new_filename.rfind('.');
-          assert(new_filename.substr(dot) == ".pz");
+          string extension = new_filename.substr(dot);
+          assert(extension == ".pz" || extension == ".gz");
           new_filename = new_filename.substr(0, dot);
           new_filename = new_filename.substr(0, dot);
           new_file.set_filename(new_filename);
           new_file.set_filename(new_filename);
           step = new InstallStepUncompressFile
           step = new InstallStepUncompressFile
@@ -1834,7 +1835,7 @@ thread_step() {
   z.next_in = (Bytef *)decompress_buffer;
   z.next_in = (Bytef *)decompress_buffer;
   z.avail_in = (size_t)read_count;
   z.avail_in = (size_t)read_count;
 
 
-  int result = inflateInit(&z);
+  int result = inflateInit2(&z, 32 + 15);
   if (result < 0) {
   if (result < 0) {
     nout << z.msg << "\n";
     nout << z.msg << "\n";
     return IT_step_failed;
     return IT_step_failed;

+ 18 - 0
direct/src/plugin/p3dPythonRun.cxx

@@ -217,6 +217,24 @@ run_python() {
     PyModule_AddStringConstant(showbase_module, "__package__", "direct.showbase");
     PyModule_AddStringConstant(showbase_module, "__package__", "direct.showbase");
   }
   }
 
 
+  PyObject *stdpy_module = PyImport_AddModule("direct.stdpy");
+  if (stdpy_module != NULL) {
+    Filename stdpy_dir(direct_dir, "stdpy");
+    dir_str = stdpy_dir.to_os_specific();
+    PyModule_AddObject(stdpy_module, "__path__", Py_BuildValue("[s#]", dir_str.data(), dir_str.length()));
+    PyModule_AddStringConstant(stdpy_module, "__package__", "direct.stdpy");
+  }
+
+  // And the encodings package as well, since we've presumably picked up a
+  // bunch of encodings modules as part of the frozen bundle.
+  Filename encodings_dir(dir, "encodings");
+  PyObject *encodings_module = PyImport_AddModule("encodings");
+  if (encodings_module != NULL) {
+    dir_str = encodings_dir.to_os_specific();
+    PyModule_AddObject(encodings_module, "__path__", Py_BuildValue("[s#]", dir_str.data(), dir_str.length()));
+    PyModule_AddStringConstant(encodings_module, "__package__", "encodings");
+  }
+
   // And register the VFSImporter.
   // And register the VFSImporter.
   PyObject *result = PyObject_CallMethod(vfsimporter_module, (char *)"register", (char *)"");
   PyObject *result = PyObject_CallMethod(vfsimporter_module, (char *)"register", (char *)"");
   if (result == NULL) {
   if (result == NULL) {

+ 10 - 6
direct/src/showbase/DistancePhasedNode.py

@@ -106,10 +106,12 @@ class DistancePhasedNode(PhasedObject, DirectObject, NodePath):
 
 
     def __repr__(self):
     def __repr__(self):
         outStr = 'DistancePhasedObject('
         outStr = 'DistancePhasedObject('
-        outStr += '%s' % repr(self.getName())
+        outStr += repr(self.getName())
         for param, value in zip(('phaseParamMap', 'autoCleanup', 'enterPrefix', 'exitPrefix', 'phaseCollideMask', 'fromCollideNode'),
         for param, value in zip(('phaseParamMap', 'autoCleanup', 'enterPrefix', 'exitPrefix', 'phaseCollideMask', 'fromCollideNode'),
-                                ('{}', 'True','\'enter\'','\'exit\'','BitMask32.allOn()','None')):
-            outStr += eval('(\', ' + param + ' = %s\' % repr(self.' + param + '),\'\')[self.' + param + ' == ' + value + ']')
+                                ({}, True, 'enter', 'exit', BitMask32.allOn(), None)):
+            pv = getattr(self, param)
+            if pv != value:
+                outStr += ', %s = %r' % (param, pv)
         outStr += ')'
         outStr += ')'
         return outStr
         return outStr
 
 
@@ -287,10 +289,12 @@ class BufferedDistancePhasedNode(DistancePhasedNode):
 
 
     def __repr__(self):
     def __repr__(self):
         outStr = 'BufferedDistancePhasedNode('
         outStr = 'BufferedDistancePhasedNode('
-        outStr += '%s' % repr(self.getName())
+        outStr += repr(self.getName())
         for param, value in zip(('bufferParamMap', 'autoCleanup', 'enterPrefix', 'exitPrefix', 'phaseCollideMask', 'fromCollideNode'),
         for param, value in zip(('bufferParamMap', 'autoCleanup', 'enterPrefix', 'exitPrefix', 'phaseCollideMask', 'fromCollideNode'),
-                                ('{}', 'True','\'enter\'','\'exit\'','BitMask32.allOn()', 'None')):
-            outStr += eval('(\', ' + param + ' = %s\' % repr(self.' + param + '),\'\')[self.' + param + ' == ' + value + ']')
+                                ({}, True, 'enter', 'exit', BitMask32.allOn(), None)):
+            pv = getattr(self, param)
+            if pv != value:
+                outStr += ', %s = %r' % (param, pv)
         outStr += ')'
         outStr += ')'
         return outStr
         return outStr
 
 

+ 22 - 5
direct/src/showbase/ShowBase.py

@@ -201,7 +201,9 @@ class ShowBase(DirectObject.DirectObject):
         ## This is used to store the wx.Application object used when want-wx is
         ## This is used to store the wx.Application object used when want-wx is
         ## set or base.startWx() is called.
         ## set or base.startWx() is called.
         self.wxApp = None
         self.wxApp = None
+        self.wxAppCreated = False
         self.tkRoot = None
         self.tkRoot = None
+        self.tkRootCreated = False
 
 
         # This is used for syncing multiple PCs in a distributed cluster
         # This is used for syncing multiple PCs in a distributed cluster
         try:
         try:
@@ -259,6 +261,17 @@ class ShowBase(DirectObject.DirectObject):
             random.seed(seed)
             random.seed(seed)
             #whrandom.seed(seed & 0xff, (seed >> 8) & 0xff, (seed >> 16) & 0xff)
             #whrandom.seed(seed & 0xff, (seed >> 8) & 0xff, (seed >> 16) & 0xff)
 
 
+        # For some reason, wx needs to be initialized before the graphics window
+        if sys.platform == "darwin":
+            if self.config.GetBool("want-wx", 0):
+                wx = importlib.import_module('wx')
+                self.wxApp = wx.App()
+
+            # Same goes for Tk, which uses a conflicting NSApplication
+            if self.config.GetBool("want-tk", 0):
+                Pmw = importlib.import_module('Pmw')
+                self.tkRoot = Pmw.initialise()
+
         # Open the default rendering window.
         # Open the default rendering window.
         if self.windowType != 'none':
         if self.windowType != 'none':
             props = WindowProperties.getDefault()
             props = WindowProperties.getDefault()
@@ -2821,7 +2834,7 @@ class ShowBase(DirectObject.DirectObject):
         updated, but wxPython owns the main loop (which seems to make
         updated, but wxPython owns the main loop (which seems to make
         it happier than the other way around). """
         it happier than the other way around). """
 
 
-        if self.wxApp:
+        if self.wxAppCreated:
             # Don't do this twice.
             # Don't do this twice.
             return
             return
 
 
@@ -2831,8 +2844,9 @@ class ShowBase(DirectObject.DirectObject):
         # by modulefinder when packaging an application.
         # by modulefinder when packaging an application.
         wx = importlib.import_module('wx')
         wx = importlib.import_module('wx')
 
 
-        # Create a new base.wxApp.
-        self.wxApp = wx.PySimpleApp(redirect = False)
+        if not self.wxApp:
+            # Create a new base.wxApp.
+            self.wxApp = wx.PySimpleApp(redirect = False)
 
 
         if ConfigVariableBool('wx-main-loop', True):
         if ConfigVariableBool('wx-main-loop', True):
             # Put wxPython in charge of the main loop.  It really
             # Put wxPython in charge of the main loop.  It really
@@ -2867,6 +2881,7 @@ class ShowBase(DirectObject.DirectObject):
                 return task.again
                 return task.again
 
 
             self.taskMgr.add(wxLoop, 'wxLoop')
             self.taskMgr.add(wxLoop, 'wxLoop')
+        self.wxAppCreated = True
 
 
     def __wxTimerCallback(self, event):
     def __wxTimerCallback(self, event):
         if Thread.getCurrentThread().getCurrentTask():
         if Thread.getCurrentThread().getCurrentTask():
@@ -2901,7 +2916,7 @@ class ShowBase(DirectObject.DirectObject):
         updated, but Tkinter owns the main loop (which seems to make
         updated, but Tkinter owns the main loop (which seems to make
         it happier than the other way around). """
         it happier than the other way around). """
 
 
-        if self.tkRoot:
+        if self.tkRootCreated:
             # Don't do this twice.
             # Don't do this twice.
             return
             return
 
 
@@ -2911,7 +2926,8 @@ class ShowBase(DirectObject.DirectObject):
         Pmw = importlib.import_module('Pmw')
         Pmw = importlib.import_module('Pmw')
 
 
         # Create a new Tk root.
         # Create a new Tk root.
-        self.tkRoot = Pmw.initialise()
+        if not self.tkRoot:
+            self.tkRoot = Pmw.initialise()
         builtins.tkroot = self.tkRoot
         builtins.tkroot = self.tkRoot
 
 
         init_app_for_gui()
         init_app_for_gui()
@@ -2947,6 +2963,7 @@ class ShowBase(DirectObject.DirectObject):
                 return task.again
                 return task.again
 
 
             self.taskMgr.add(tkLoop, 'tkLoop')
             self.taskMgr.add(tkLoop, 'tkLoop')
+        self.tkRootCreated = True
 
 
     def __tkTimerCallback(self):
     def __tkTimerCallback(self):
         if not Thread.getCurrentThread().getCurrentTask():
         if not Thread.getCurrentThread().getCurrentTask():

+ 1 - 0
direct/src/showbase/ShowBaseGlobal.py

@@ -20,6 +20,7 @@ def inspect(anObject):
     Inspector = importlib.import_module('direct.tkpanels.Inspector')
     Inspector = importlib.import_module('direct.tkpanels.Inspector')
     return Inspector.inspect(anObject)
     return Inspector.inspect(anObject)
 
 
+import sys
 if sys.version_info >= (3, 0):
 if sys.version_info >= (3, 0):
     import builtins
     import builtins
 else:
 else:

+ 2 - 4
direct/src/showbase/VFSImporter.py

@@ -2,6 +2,7 @@ __all__ = ['register', 'sharedPackages',
            'reloadSharedPackage', 'reloadSharedPackages']
            'reloadSharedPackage', 'reloadSharedPackages']
 
 
 from panda3d.core import Filename, VirtualFileSystem, VirtualFileMountSystem, OFileStream, copyStream
 from panda3d.core import Filename, VirtualFileSystem, VirtualFileMountSystem, OFileStream, copyStream
+from direct.stdpy.file import open
 import sys
 import sys
 import marshal
 import marshal
 import imp
 import imp
@@ -173,10 +174,7 @@ class VFSLoader:
         filename = Filename(self.filename)
         filename = Filename(self.filename)
         filename.setExtension('py')
         filename.setExtension('py')
         filename.setText()
         filename.setText()
-        vfile = vfs.getFile(filename)
-        if not vfile:
-            raise IOError("Could not find '%s'" % (filename))
-        return vfile.readFile(True)
+        return open(self.filename, self.desc[1]).read()
 
 
     def _import_extension_module(self, fullname):
     def _import_extension_module(self, fullname):
         """ Loads the binary shared object as a Python module, and
         """ Loads the binary shared object as a Python module, and

+ 0 - 374
direct/src/showbase/pandaSqueezeTool.py

@@ -1,374 +0,0 @@
-"""Undocumented Module"""
-
-__all__ = ['usage', 'Squeezer', 'Loader', 'boot', 'open', 'explode', 'getloader', 'squeeze', 'searchPath']
-
-#!/usr/bin/env python
-#
-# SQUEEZE
-#
-# squeeze a python program
-#
-# installation:
-# - use this script as is, or squeeze it using the following command:
-#
-# python squeezeTool.py -1su -o squeeze -b squeezeTool squeezeTool.py
-#
-# notes:
-# - this is pretty messy.  make sure to test everything carefully
-#   if you change anything
-#
-# - the name "squeeze" is taken from an ABC800 utility which did
-#   about the same thing with Basic II bytecodes.
-#
-# history:
-# 1.0   97-04-22 fl     Created
-# 1.1   97-05-25 fl     Added base64 embedding option (-1)
-#       97-05-25 fl     Check for broken package file
-# 1.2   97-05-26 fl     Support uncompressed packages (-u)
-# 1.3   97-05-27 fl     Check byte code magic, eliminated StringIO, etc.
-# 1.4   97-06-04 fl     Removed last bits of white space, removed try/except
-# 1.5   97-06-17 fl     Added squeeze archive capabilities (-x)
-# 1.6   98-05-04 fl     Minor fixes in preparation for public source release
-#
-# reviews:
-#       "Fredrik Lundh is a friggin genius"
-#       -- Aaron Watters, author of 'Internet Programming with Python'
-#
-#       "I agree ... this is a friggin Good Thing"
-#       -- Paul Everitt, Digital Creations
-#
-# Copyright (c) 1997 by Fredrik Lundh.
-# Copyright (c) 1997-1998 by Secret Labs AB
-#
-# [email protected]
-# http://www.pythonware.com
-#
-# --------------------------------------------------------------------
-# Permission to use, copy, modify, and distribute this software and
-# its associated documentation for any purpose and without fee is
-# hereby granted.  This software is provided as is.
-# --------------------------------------------------------------------
-
-VERSION = "1.6/98-05-04"
-MAGIC   = "[PANDASQUEEZE]"
-
-import base64, imp, marshal, os, sys
-
-# --------------------------------------------------------------------
-# usage
-
-def usage():
-        print("\nSQUEEZE", VERSION, "(c) 1997-1998 by Secret Labs AB")
-        print("""\
-Convert a Python application to a compressed module package.
-
-Usage: squeeze [-1ux] -o app [-b start] modules... [-d files...]
-
-This utility creates a compressed package file named "app.pyz", which
-contains the given module files.  It also creates a bootstrap script
-named "app.py", which loads the package and imports the given "start"
-module to get things going.  Example:
-
-        squeeze -o app -b appMain app*.py
-
-The -1 option tells squeeze to put the package file inside the boot-
-strap script using base64 encoding.  The result is a single text file
-containing the full application.
-
-The -u option disables compression.  Otherwise, the package will be
-compressed using zlib, and the user needs zlib to run the resulting
-application.
-
-The -d option can be used to put additional files in the package file.
-You can access these files via "__main__.open(filename)" (returns a
-StringIO file object).
-
-The -x option can be used with -d to create a self-extracting archive,
-instead of a package.  When the resulting script is executed, the
-data files are extracted.  Omit the -b option in this case.
-""")
-        sys.exit(1)
-
-
-# --------------------------------------------------------------------
-# squeezer -- collect squeezed modules
-
-class Squeezer:
-
-        def __init__(self):
-
-                self.rawbytes = self.bytes = 0
-                self.modules = {}
-
-        def addmodule(self, file):
-
-                if file[-1] == "c":
-                        file = file[:-1]
-
-                m = os.path.splitext(os.path.split(file)[1])[0]
-
-                # read sourcefile
-                f = open(file)
-                codestring = f.read()
-                f.close()
-
-                # dump to file
-                self.modules[m] = compile(codestring, m, "exec")
-
-        def adddata(self, file):
-
-                self.modules["+"+file] = open(file, "rb").read()
-
-        def getarchive(self):
-
-                # marshal our module dictionary
-                data = marshal.dumps(self.modules)
-                self.rawbytes = len(data)
-
-                # return (compressed) dictionary
-                data = zlib.compress(data, 9)
-                self.bytes = len(data)
-
-                return data
-
-        def getstatus(self):
-                return self.bytes, self.rawbytes
-
-
-# --------------------------------------------------------------------
-# loader (used in bootstrap code)
-
-loader = """
-import ihooks
-
-PYZ_MODULE = 64
-
-class Loader(ihooks.ModuleLoader):
-
-    def __init__(self, modules):
-        self.__modules = modules
-        return ihooks.ModuleLoader.__init__(self)
-
-    def find_module(self, name, path = None):
-        try:
-            self.__modules[name]
-            return None, None, (None, None, PYZ_MODULE)
-        except KeyError:
-            return ihooks.ModuleLoader.find_module(self, name, path)
-
-    def load_module(self, name, stuff):
-        file, filename, (suff, mode, type) = stuff
-        if type != PYZ_MODULE:
-            return ihooks.ModuleLoader.load_module(self, name, stuff)
-        #print "PYZ:", "import", name
-        basename = name.split('.')[-1]
-        code = self.__modules[basename]
-        del self.__modules[basename] # no need to keep this one around
-        m = self.hooks.add_module(name)
-        m.__file__ = filename
-        exec code in m.__dict__
-        return m
-
-def boot(name, fp, size, offset = 0):
-
-    global data
-
-    try:
-        import %(modules)s
-    except ImportError:
-        #print "PYZ:", "failed to load marshal and zlib libraries"
-        return # cannot boot from PYZ file
-    #print "PYZ:", "boot from", name+".PYZ"
-
-    # load archive and install import hook
-    if offset:
-        data = fp[offset:]
-    else:
-        data = fp.read(size)
-        fp.close()
-
-    if len(data) != size:
-        raise IOError, "package is truncated"
-
-    data = marshal.loads(%(data)s)
-
-    ihooks.install(ihooks.ModuleImporter(Loader(data)))
-"""
-
-loaderopen = """
-
-def open(name):
-    from io import StringIO
-    try:
-        return StringIO(data["+"+name])
-    except KeyError:
-        raise IOError, (0, "no such file")
-"""
-
-loaderexplode = """
-
-def explode():
-    for k, v in data.items():
-        if k[0] == "+":
-            try:
-                open(k[1:], "wb").write(v)
-                print k[1:], "extracted ok"
-            except IOError, v:
-                print k[1:], "failed:", "IOError", v
-
-"""
-
-def getloader(data, package):
-
-        s = loader
-
-        if data:
-                if explode:
-                        s = s + loaderexplode
-                else:
-                        s = s + loaderopen
-
-        dict = {
-                "modules": "marshal, zlib",
-                "data":    "zlib.decompress(data)",
-                }
-
-        s = s % dict
-
-        return marshal.dumps(compile(s, "<package>", "exec"))
-
-
-# --------------------------------------------------------------------
-# Main
-# --------------------------------------------------------------------
-
-#
-# parse options
-
-import sys
-import zlib
-
-embed = 0
-explode = 0
-
-def squeeze(app, start, filelist, outputDir):
-        localMagic = MAGIC
-        data = None
-
-        bootstrap = os.path.join(outputDir, app + ".py")
-        archiveBase = app + ".pyz"
-        archive   = os.path.join(outputDir, archiveBase)
-
-        archiveid = app
-
-        #
-        # avoid overwriting files not generated by squeeze
-
-        try:
-                fp = open(bootstrap)
-                s = fp.readline()
-                s.index(MAGIC)
-        except IOError:
-                pass
-        except ValueError:
-                print("%s was not created by squeeze.  You have to manually" % (bootstrap))
-                print("remove the file to proceed.")
-                sys.exit(1)
-
-        #
-        # collect modules
-
-        sq = Squeezer()
-        for file in filelist:
-                # print 'addmodule:', file
-                sq.addmodule(file)
-
-        package = sq.getarchive()
-        size = len(package)
-
-        #
-        # get loader
-
-        loader = getloader(data, package)
-
-        zbegin, zend = "zlib.decompress(", ")"
-        loader = zlib.compress(loader, 9)
-
-        loaderlen = len(loader)
-
-        magic = repr(imp.get_magic())
-        version = sys.version.split()[0]
-
-        #
-        # generate script and package files
-
-        if embed:
-
-                # embedded archive
-                data = base64.encodestring(loader + package)
-
-                fp = open(bootstrap, "w")
-                fp.write('''\
-#%(localMagic)s %(archiveid)s
-import ihooks, zlib, base64, marshal
-s=base64.decodestring("""
-%(data)s""")
-exec marshal.loads(%(zbegin)ss[:%(loaderlen)d]%(zend)s)
-boot("%(app)s", s, %(size)d, %(loaderlen)d)
-exec "import %(start)s"
-''' % locals())
-                bytes = fp.tell()
-
-        else:
-
-                # separate archive file
-
-                fp = open(archive, "wb")
-
-                fp.write(loader)
-                fp.write(package)
-
-                bytes = fp.tell()
-                fp.close()
-                #
-                # create bootstrap code
-
-                fp = open(bootstrap, "w")
-                # Note: David Rose adjusted the following to be panda-specific.
-                fp.write("""\
-#%(localMagic)s %(archiveid)s
-import ihooks, zlib, marshal, os, sys
-
-def searchPath(filename):
-  # Look along panda3d.__path__ for the indicated filename.  Returns
-  # the located pathname, or None if the filename is not found.
-  import panda3d
-
-  for dir in panda3d.__path__:
-    pathname = os.path.join(dir, filename)
-    if os.path.exists(pathname):
-      return pathname
-
-  return None
-
-# Look for %(archiveBase)s along panda3d.__path__.
-archiveName = "%(archiveBase)s"
-archivePath = searchPath(archiveName)
-if archivePath == None:
-  raise ImportError, "Could not locate panda3d.%%s." %% (archiveName)
-
-f=open(archivePath,"rb")
-exec marshal.loads(%(zbegin)sf.read(%(loaderlen)d)%(zend)s)
-boot("%(app)s", f, %(size)d)
-exec "from %(start)s import *"
-#exec "run()"
-""" % locals())
-                bytes = bytes + fp.tell()
-                fp.close()
-
-        #
-        # show statistics
-
-        dummy, rawbytes = sq.getstatus()
-
-        print("squeezed %s to %s (%d%%)" % (rawbytes, bytes, bytes * 100 / rawbytes))

+ 0 - 57
direct/src/showbase/pandaSqueezer.py

@@ -1,57 +0,0 @@
-"""Undocumented Module"""
-
-__all__ = []
-
-import os
-import sys
-import getopt
-from . import pandaSqueezeTool
-
-# Assumption: We will be squeezing the files from the current directory or the -d directory.
-
-if __name__ == "__main__":
-    try:
-        opts, pargs = getopt.getopt(sys.argv[1:], 'Od:')
-    except Exception as e:
-        # User passed in a bad option, print the error and the help, then exit
-        print(e)
-        print('Usage: pass in -O for optimized')
-        print('       pass in -d directory')
-        sys.exit()
-
-    fOptimized = 0
-    # Store the option values into our variables
-    for opt in opts:
-        flag, value = opt
-        if (flag == '-O'):
-            fOptimized = 1
-            print('Squeezing pyo files')
-        elif (flag == '-d'):
-            os.chdir(value)
-
-    def getSqueezeableFiles():
-        fileList = os.listdir(".")
-        newFileList = []
-        if fOptimized:
-            targetFileExtension = ".pyo"
-        else:
-            targetFileExtension = ".pyc"
-        for i in fileList:
-            base, ext = os.path.splitext(i)
-            if (ext == ".py"):
-                newFileList.append(i)
-        return newFileList
-
-    def squeezePandaFiles():
-        l = getSqueezeableFiles()
-        pandaSqueezeTool.squeeze("PandaModules", "PandaModulesUnsqueezed", l)
-
-        # Clean up the source files now that they've been squeezed.  If
-        # you don't like this behavior (e.g. if you want to inspect the
-        # generated files), use genPyCode -n to avoid squeezing
-        # altogether.
-        for i in l:
-            os.unlink(i)
-
-
-    squeezePandaFiles()

+ 222 - 84
direct/src/showutil/FreezeTool.py

@@ -8,7 +8,7 @@ import marshal
 import imp
 import imp
 import platform
 import platform
 from io import StringIO
 from io import StringIO
-from distutils.sysconfig import PREFIX, get_python_inc, get_python_version, get_config_var
+import distutils.sysconfig as sysconf
 
 
 # Temporary (?) try..except to protect against unbuilt p3extend_frozen.
 # Temporary (?) try..except to protect against unbuilt p3extend_frozen.
 try:
 try:
@@ -29,9 +29,23 @@ isDebugBuild = (python.lower().endswith('_d'))
 # These are modules that Python always tries to import up-front.  They
 # These are modules that Python always tries to import up-front.  They
 # must be frozen in any main.exe.
 # must be frozen in any main.exe.
 startupModules = [
 startupModules = [
-    'os', 'encodings.cp1252',
-    'encodings.latin_1', 'encodings.utf_8', 'io',
+    'encodings.cp1252', 'encodings.latin_1', 'encodings.utf_8',
     ]
     ]
+if sys.version_info >= (3, 0):
+    startupModules += ['io', 'marshal', 'importlib.machinery', 'importlib.util']
+
+# These are some special init functions for some built-in Python modules that
+# deviate from the standard naming convention.  A value of None means that a
+# dummy entry should be written to the inittab.
+builtinInitFuncs = {
+    'builtins': None,
+    '__builtin__': None,
+    'sys': None,
+    'exceptions': None,
+    '_imp': 'PyInit_imp',
+    '_warnings': '_PyWarnings_Init',
+    'marshal': 'PyMarshal_Init',
+}
 
 
 # These are missing modules that we've reported already this session.
 # These are missing modules that we've reported already this session.
 reportedMissing = {}
 reportedMissing = {}
@@ -60,8 +74,8 @@ class CompilationEnvironment:
 
 
         # Paths to Python stuff.
         # Paths to Python stuff.
         self.Python = None
         self.Python = None
-        self.PythonIPath = get_python_inc()
-        self.PythonVersion = get_config_var("LDVERSION") or get_python_version()
+        self.PythonIPath = sysconf.get_python_inc()
+        self.PythonVersion = sysconf.get_config_var("LDVERSION") or sysconf.get_python_version()
 
 
         # The VC directory of Microsoft Visual Studio (if relevant)
         # The VC directory of Microsoft Visual Studio (if relevant)
         self.MSVC = None
         self.MSVC = None
@@ -85,7 +99,7 @@ class CompilationEnvironment:
 
 
     def determineStandardSetup(self):
     def determineStandardSetup(self):
         if self.platform.startswith('win'):
         if self.platform.startswith('win'):
-            self.Python = PREFIX
+            self.Python = sysconf.PREFIX
 
 
             if ('VCINSTALLDIR' in os.environ):
             if ('VCINSTALLDIR' in os.environ):
                 self.MSVC = os.environ['VCINSTALLDIR']
                 self.MSVC = os.environ['VCINSTALLDIR']
@@ -122,13 +136,15 @@ class CompilationEnvironment:
 
 
             # If it is run by makepanda, it handles the MSVC and PlatformSDK paths itself.
             # If it is run by makepanda, it handles the MSVC and PlatformSDK paths itself.
             if ('MAKEPANDA' in os.environ):
             if ('MAKEPANDA' in os.environ):
-                self.compileObj = 'cl /wd4996 /Fo%(basename)s.obj /nologo /c %(MD)s /Zi /O2 /Ob2 /EHsc /Zm300 /W3 /I"%(pythonIPath)s" %(filename)s'
+                self.compileObjExe = 'cl /wd4996 /Fo%(basename)s.obj /nologo /c %(MD)s /Zi /O2 /Ob2 /EHsc /Zm300 /W3 /I"%(pythonIPath)s" %(filename)s'
+                self.compileObjDll = self.compileObjExe
                 self.linkExe = 'link /nologo /MAP:NUL /FIXED:NO /OPT:REF /STACK:4194304 /INCREMENTAL:NO /LIBPATH:"%(python)s\libs"  /out:%(basename)s.exe %(basename)s.obj'
                 self.linkExe = 'link /nologo /MAP:NUL /FIXED:NO /OPT:REF /STACK:4194304 /INCREMENTAL:NO /LIBPATH:"%(python)s\libs"  /out:%(basename)s.exe %(basename)s.obj'
                 self.linkDll = 'link /nologo /DLL /MAP:NUL /FIXED:NO /OPT:REF /INCREMENTAL:NO /LIBPATH:"%(python)s\libs"  /out:%(basename)s%(dllext)s.pyd %(basename)s.obj'
                 self.linkDll = 'link /nologo /DLL /MAP:NUL /FIXED:NO /OPT:REF /INCREMENTAL:NO /LIBPATH:"%(python)s\libs"  /out:%(basename)s%(dllext)s.pyd %(basename)s.obj'
             else:
             else:
                 os.environ['PATH'] += ';' + self.MSVC + '\\bin' + self.suffix64 + ';' + self.MSVC + '\\Common7\\IDE;' + self.PSDK + '\\bin'
                 os.environ['PATH'] += ';' + self.MSVC + '\\bin' + self.suffix64 + ';' + self.MSVC + '\\Common7\\IDE;' + self.PSDK + '\\bin'
 
 
-                self.compileObj = 'cl /wd4996 /Fo%(basename)s.obj /nologo /c %(MD)s /Zi /O2 /Ob2 /EHsc /Zm300 /W3 /I"%(pythonIPath)s" /I"%(PSDK)s\include" /I"%(MSVC)s\include" %(filename)s'
+                self.compileObjExe = 'cl /wd4996 /Fo%(basename)s.obj /nologo /c %(MD)s /Zi /O2 /Ob2 /EHsc /Zm300 /W3 /I"%(pythonIPath)s" /I"%(PSDK)s\include" /I"%(MSVC)s\include" %(filename)s'
+                self.compileObjDll = self.compileObjExe
                 self.linkExe = 'link /nologo /MAP:NUL /FIXED:NO /OPT:REF /STACK:4194304 /INCREMENTAL:NO /LIBPATH:"%(PSDK)s\lib" /LIBPATH:"%(MSVC)s\\lib%(suffix64)s" /LIBPATH:"%(python)s\libs"  /out:%(basename)s.exe %(basename)s.obj'
                 self.linkExe = 'link /nologo /MAP:NUL /FIXED:NO /OPT:REF /STACK:4194304 /INCREMENTAL:NO /LIBPATH:"%(PSDK)s\lib" /LIBPATH:"%(MSVC)s\\lib%(suffix64)s" /LIBPATH:"%(python)s\libs"  /out:%(basename)s.exe %(basename)s.obj'
                 self.linkDll = 'link /nologo /DLL /MAP:NUL /FIXED:NO /OPT:REF /INCREMENTAL:NO /LIBPATH:"%(PSDK)s\lib" /LIBPATH:"%(MSVC)s\\lib%(suffix64)s" /LIBPATH:"%(python)s\libs"  /out:%(basename)s%(dllext)s.pyd %(basename)s.obj'
                 self.linkDll = 'link /nologo /DLL /MAP:NUL /FIXED:NO /OPT:REF /INCREMENTAL:NO /LIBPATH:"%(PSDK)s\lib" /LIBPATH:"%(MSVC)s\\lib%(suffix64)s" /LIBPATH:"%(python)s\libs"  /out:%(basename)s%(dllext)s.pyd %(basename)s.obj'
 
 
@@ -141,22 +157,26 @@ class CompilationEnvironment:
                 self.arch = '-arch ppc'
                 self.arch = '-arch ppc'
             elif proc == 'amd64':
             elif proc == 'amd64':
                 self.arch = '-arch x86_64'
                 self.arch = '-arch x86_64'
-            self.compileObj = "gcc -fPIC -c %(arch)s -o %(basename)s.o -O2 -I%(pythonIPath)s %(filename)s"
+            self.compileObjExe = "gcc -c %(arch)s -o %(basename)s.o -O2 -I%(pythonIPath)s %(filename)s"
+            self.compileObjDll = "gcc -fPIC -c %(arch)s -o %(basename)s.o -O2 -I%(pythonIPath)s %(filename)s"
             self.linkExe = "gcc %(arch)s -o %(basename)s %(basename)s.o -framework Python"
             self.linkExe = "gcc %(arch)s -o %(basename)s %(basename)s.o -framework Python"
             self.linkDll = "gcc %(arch)s -undefined dynamic_lookup -bundle -o %(basename)s.so %(basename)s.o"
             self.linkDll = "gcc %(arch)s -undefined dynamic_lookup -bundle -o %(basename)s.so %(basename)s.o"
 
 
         else:
         else:
             # Unix
             # Unix
-            self.compileObj = "gcc -fPIC -c -o %(basename)s.o -O2 %(filename)s -I%(pythonIPath)s"
-            self.linkExe = "gcc -o %(basename)s %(basename)s.o -L/usr/local/lib -lpython%(pythonVersion)s"
-            self.linkDll = "gcc -shared -o %(basename)s.so %(basename)s.o -L/usr/local/lib -lpython%(pythonVersion)s"
+            lib_dir = sysconf.get_python_lib(plat_specific=1, standard_lib=1)
+            #python_a = os.path.join(lib_dir, "config", "libpython%(pythonVersion)s.a")
+            self.compileObjExe = "%(CC)s %(CFLAGS)s -c -o %(basename)s.o -pthread -O2 %(filename)s -I%(pythonIPath)s"
+            self.compileObjDll = "%(CC)s %(CFLAGS)s %(CCSHARED)s -c -o %(basename)s.o -O2 %(filename)s -I%(pythonIPath)s"
+            self.linkExe = "%(CC)s -o %(basename)s %(basename)s.o -L/usr/local/lib -lpython%(pythonVersion)s"
+            self.linkDll = "%(LDSHARED)s -o %(basename)s.so %(basename)s.o -L/usr/local/lib -lpython%(pythonVersion)s"
 
 
             if (os.path.isdir("/usr/PCBSD/local/lib")):
             if (os.path.isdir("/usr/PCBSD/local/lib")):
                 self.linkExe += " -L/usr/PCBSD/local/lib"
                 self.linkExe += " -L/usr/PCBSD/local/lib"
                 self.linkDll += " -L/usr/PCBSD/local/lib"
                 self.linkDll += " -L/usr/PCBSD/local/lib"
 
 
-    def compileExe(self, filename, basename):
-        compile = self.compileObj % {
+    def compileExe(self, filename, basename, extraLink=[]):
+        compile = self.compileObjExe % dict({
             'python' : self.Python,
             'python' : self.Python,
             'MSVC' : self.MSVC,
             'MSVC' : self.MSVC,
             'PSDK' : self.PSDK,
             'PSDK' : self.PSDK,
@@ -167,12 +187,12 @@ class CompilationEnvironment:
             'arch' : self.arch,
             'arch' : self.arch,
             'filename' : filename,
             'filename' : filename,
             'basename' : basename,
             'basename' : basename,
-            }
+            }, **sysconf.get_config_vars())
         sys.stderr.write(compile + '\n')
         sys.stderr.write(compile + '\n')
         if os.system(compile) != 0:
         if os.system(compile) != 0:
             raise Exception('failed to compile %s.' % basename)
             raise Exception('failed to compile %s.' % basename)
 
 
-        link = self.linkExe % {
+        link = self.linkExe % dict({
             'python' : self.Python,
             'python' : self.Python,
             'MSVC' : self.MSVC,
             'MSVC' : self.MSVC,
             'PSDK' : self.PSDK,
             'PSDK' : self.PSDK,
@@ -182,13 +202,14 @@ class CompilationEnvironment:
             'arch' : self.arch,
             'arch' : self.arch,
             'filename' : filename,
             'filename' : filename,
             'basename' : basename,
             'basename' : basename,
-            }
+            }, **sysconf.get_config_vars())
+        link += ' ' + ' '.join(extraLink)
         sys.stderr.write(link + '\n')
         sys.stderr.write(link + '\n')
         if os.system(link) != 0:
         if os.system(link) != 0:
             raise Exception('failed to link %s.' % basename)
             raise Exception('failed to link %s.' % basename)
 
 
-    def compileDll(self, filename, basename):
-        compile = self.compileObj % {
+    def compileDll(self, filename, basename, extraLink=[]):
+        compile = self.compileObjDll % dict({
             'python' : self.Python,
             'python' : self.Python,
             'MSVC' : self.MSVC,
             'MSVC' : self.MSVC,
             'PSDK' : self.PSDK,
             'PSDK' : self.PSDK,
@@ -199,12 +220,12 @@ class CompilationEnvironment:
             'arch' : self.arch,
             'arch' : self.arch,
             'filename' : filename,
             'filename' : filename,
             'basename' : basename,
             'basename' : basename,
-            }
+            }, **sysconf.get_config_vars())
         sys.stderr.write(compile + '\n')
         sys.stderr.write(compile + '\n')
         if os.system(compile) != 0:
         if os.system(compile) != 0:
             raise Exception('failed to compile %s.' % basename)
             raise Exception('failed to compile %s.' % basename)
 
 
-        link = self.linkDll % {
+        link = self.linkDll % dict({
             'python' : self.Python,
             'python' : self.Python,
             'MSVC' : self.MSVC,
             'MSVC' : self.MSVC,
             'PSDK' : self.PSDK,
             'PSDK' : self.PSDK,
@@ -215,7 +236,8 @@ class CompilationEnvironment:
             'filename' : filename,
             'filename' : filename,
             'basename' : basename,
             'basename' : basename,
             'dllext' : self.dllext,
             'dllext' : self.dllext,
-            }
+            }, **sysconf.get_config_vars())
+        link += ' ' + ' '.join(extraLink)
         sys.stderr.write(link + '\n')
         sys.stderr.write(link + '\n')
         if os.system(link) != 0:
         if os.system(link) != 0:
             raise Exception('failed to link %s.' % basename)
             raise Exception('failed to link %s.' % basename)
@@ -233,7 +255,8 @@ frozenMainCode = """
 #ifdef MS_WINDOWS
 #ifdef MS_WINDOWS
 extern void PyWinFreeze_ExeInit(void);
 extern void PyWinFreeze_ExeInit(void);
 extern void PyWinFreeze_ExeTerm(void);
 extern void PyWinFreeze_ExeTerm(void);
-extern int PyInitFrozenExtensions(void);
+
+extern DL_IMPORT(int) PyImport_ExtendInittab(struct _inittab *newtab);
 #endif
 #endif
 
 
 /* Main program */
 /* Main program */
@@ -264,6 +287,8 @@ Py_FrozenMain(int argc, char **argv)
 #endif
 #endif
 
 
     Py_FrozenFlag = 1; /* Suppress errors from getpath.c */
     Py_FrozenFlag = 1; /* Suppress errors from getpath.c */
+    Py_NoSiteFlag = 1;
+    Py_NoUserSiteDirectory = 1;
 
 
     if ((p = Py_GETENV("PYTHONINSPECT")) && *p != '\\0')
     if ((p = Py_GETENV("PYTHONINSPECT")) && *p != '\\0')
         inspect = 1;
         inspect = 1;
@@ -300,7 +325,7 @@ Py_FrozenMain(int argc, char **argv)
 #endif
 #endif
 
 
 #ifdef MS_WINDOWS
 #ifdef MS_WINDOWS
-    PyInitFrozenExtensions();
+    PyImport_ExtendInittab(extensions);
 #endif /* MS_WINDOWS */
 #endif /* MS_WINDOWS */
 
 
     if (argc >= 1) {
     if (argc >= 1) {
@@ -344,8 +369,8 @@ Py_FrozenMain(int argc, char **argv)
 #endif
 #endif
     Py_Finalize();
     Py_Finalize();
 
 
-error:
 #if PY_MAJOR_VERSION >= 3
 #if PY_MAJOR_VERSION >= 3
+error:
     PyMem_RawFree(argv_copy);
     PyMem_RawFree(argv_copy);
     if (argv_copy2) {
     if (argv_copy2) {
         for (i = 0; i < argc; i++)
         for (i = 0; i < argc; i++)
@@ -463,10 +488,6 @@ main(int argc, char *argv[]) {
 
 
 # Our own glue code to start up a Python shared library.
 # Our own glue code to start up a Python shared library.
 dllInitCode = """
 dllInitCode = """
-static PyMethodDef nullMethods[] = {
-  {NULL, NULL}
-};
-
 /*
 /*
  * Call this function to extend the frozen modules array with a new
  * Call this function to extend the frozen modules array with a new
  * array of frozen modules, provided in a C-style array, at runtime.
  * array of frozen modules, provided in a C-style array, at runtime.
@@ -508,10 +529,29 @@ extend_frozen_modules(const struct _frozen *new_modules, int new_count) {
   return orig_count + new_count;
   return orig_count + new_count;
 }
 }
 
 
-%(dllexport)svoid init%(moduleName)s() {
+#if PY_MAJOR_VERSION >= 3
+static PyModuleDef mdef = {
+  PyModuleDef_HEAD_INIT,
+  "%(moduleName)s",
+  "",
+  -1,
+  NULL, NULL, NULL, NULL, NULL
+};
+
+%(dllexport)sPyObject *PyInit_%(moduleName)s(void) {
+  extend_frozen_modules(_PyImport_FrozenModules, sizeof(_PyImport_FrozenModules) / sizeof(struct _frozen));
+  return PyModule_Create(&mdef);
+}
+#else
+static PyMethodDef nullMethods[] = {
+  {NULL, NULL}
+};
+
+%(dllexport)svoid init%(moduleName)s(void) {
   extend_frozen_modules(_PyImport_FrozenModules, sizeof(_PyImport_FrozenModules) / sizeof(struct _frozen));
   extend_frozen_modules(_PyImport_FrozenModules, sizeof(_PyImport_FrozenModules) / sizeof(struct _frozen));
   Py_InitModule("%(moduleName)s", nullMethods);
   Py_InitModule("%(moduleName)s", nullMethods);
 }
 }
+#endif
 """
 """
 
 
 programFile = """
 programFile = """
@@ -526,24 +566,8 @@ struct _frozen _PyImport_FrozenModules[] = {
 %(moduleList)s
 %(moduleList)s
   {NULL, NULL, 0}
   {NULL, NULL, 0}
 };
 };
-
-%(initCode)s
 """
 """
 
 
-# Windows needs this bit.
-frozenExtensions = """
-
-static struct _inittab extensions[] = {
-        /* Sentinel */
-        {0, 0}
-};
-extern DL_IMPORT(int) PyImport_ExtendInittab(struct _inittab *newtab);
-
-int PyInitFrozenExtensions()
-{
-        return PyImport_ExtendInittab(extensions);
-}
-"""
 
 
 okMissing = [
 okMissing = [
     '__main__', '_dummy_threading', 'Carbon', 'Carbon.Files',
     '__main__', '_dummy_threading', 'Carbon', 'Carbon.Files',
@@ -645,14 +669,13 @@ class Freezer:
         if self.platform.startswith('win'):
         if self.platform.startswith('win'):
             self.objectExtension = '.obj'
             self.objectExtension = '.obj'
 
 
-        self.keepTemporaryFiles = True
+        self.keepTemporaryFiles = False
 
 
         # Change any of these to change the generated startup and glue
         # Change any of these to change the generated startup and glue
         # code.
         # code.
         self.frozenMainCode = frozenMainCode
         self.frozenMainCode = frozenMainCode
         self.frozenDllMainCode = frozenDllMainCode
         self.frozenDllMainCode = frozenDllMainCode
         self.mainInitCode = mainInitCode
         self.mainInitCode = mainInitCode
-        self.frozenExtensions = frozenExtensions
 
 
         # Set this true to encode Python files in a Multifile as their
         # Set this true to encode Python files in a Multifile as their
         # original source if possible, or false to encode them as
         # original source if possible, or false to encode them as
@@ -664,9 +687,14 @@ class Freezer:
         # addToMultifile().  It contains a list of all the extension
         # addToMultifile().  It contains a list of all the extension
         # modules that were discovered, which have not been added to
         # modules that were discovered, which have not been added to
         # the output.  The list is a list of tuples of the form
         # the output.  The list is a list of tuples of the form
-        # (moduleName, filename).
+        # (moduleName, filename).  filename will be None for built-in
+        # modules.
         self.extras = []
         self.extras = []
 
 
+        # Set this to true if extension modules should be linked in to
+        # the resulting executable.
+        self.linkExtensionModules = False
+
         # End of public interface.  These remaining members should not
         # End of public interface.  These remaining members should not
         # be directly manipulated by callers.
         # be directly manipulated by callers.
         self.previousModules = {}
         self.previousModules = {}
@@ -676,6 +704,10 @@ class Freezer:
             self.previousModules = dict(previous.modules)
             self.previousModules = dict(previous.modules)
             self.modules = dict(previous.modules)
             self.modules = dict(previous.modules)
 
 
+        # Exclude doctest by default; it is not very useful in production
+        # builds.  It can be explicitly included if desired.
+        self.modules['doctest'] = self.ModuleDef('doctest', exclude = True)
+
         self.mf = None
         self.mf = None
 
 
         # Actually, make sure we know how to find all of the
         # Actually, make sure we know how to find all of the
@@ -951,8 +983,8 @@ class Freezer:
         for mdef in includes:
         for mdef in includes:
             try:
             try:
                 self.__loadModule(mdef)
                 self.__loadModule(mdef)
-            except ImportError:
-                print("Unknown module: %s" % (mdef.moduleName))
+            except ImportError as ex:
+                print("Unknown module: %s (%s)" % (mdef.moduleName, str(ex)))
 
 
         # Also attempt to import any implicit modules.  If any of
         # Also attempt to import any implicit modules.  If any of
         # these fail to import, we don't really care.
         # these fail to import, we don't really care.
@@ -1158,7 +1190,7 @@ class Freezer:
 
 
             if self.storePythonSource:
             if self.storePythonSource:
                 filename += '.py'
                 filename += '.py'
-                stream = StringStream('')
+                stream = StringStream(b'')
                 if multifile.findSubfile(filename) < 0:
                 if multifile.findSubfile(filename) < 0:
                     multifile.addSubfile(filename, stream, 0)
                     multifile.addSubfile(filename, stream, 0)
                     multifile.flush()
                     multifile.flush()
@@ -1296,41 +1328,116 @@ class Freezer:
             if mdef.forbid:
             if mdef.forbid:
                 # Explicitly disallow importing this module.
                 # Explicitly disallow importing this module.
                 moduleList.append(self.makeForbiddenModuleListEntry(moduleName))
                 moduleList.append(self.makeForbiddenModuleListEntry(moduleName))
-            else:
-                assert not mdef.exclude
-                # Allow importing this module.
-                module = self.mf.modules.get(origName, None)
-                code = getattr(module, "__code__", None)
-                if code:
-                    code = marshal.dumps(code)
+                continue
 
 
-                    mangledName = self.mangleName(moduleName)
-                    moduleDefs.append(self.makeModuleDef(mangledName, code))
-                    moduleList.append(self.makeModuleListEntry(mangledName, code, moduleName, module))
+            assert not mdef.exclude
+            # Allow importing this module.
+            module = self.mf.modules.get(origName, None)
+            code = getattr(module, "__code__", None)
+            if code:
+                code = marshal.dumps(code)
 
 
-                elif moduleName in startupModules:
-                    # Forbid the loading of this startup module.
-                    moduleList.append(self.makeForbiddenModuleListEntry(moduleName))
+                mangledName = self.mangleName(moduleName)
+                moduleDefs.append(self.makeModuleDef(mangledName, code))
+                moduleList.append(self.makeModuleListEntry(mangledName, code, moduleName, module))
+                continue
 
 
-                else:
-                    # This is a module with no associated Python
-                    # code.  It must be an extension module.  Get the
-                    # filename.
-                    extensionFilename = getattr(module, '__file__', None)
-                    if extensionFilename:
-                        self.extras.append((moduleName, extensionFilename))
-                    else:
-                        # It doesn't even have a filename; it must
-                        # be a built-in module.  No worries about
-                        # this one, then.
-                        pass
+            #if moduleName in startupModules:
+            #    # Forbid the loading of this startup module.
+            #    moduleList.append(self.makeForbiddenModuleListEntry(moduleName))
+            #    continue
+
+            # This is a module with no associated Python code.  It is either
+            # an extension module or a builtin module.  Get the filename, if
+            # it is the former.
+            extensionFilename = getattr(module, '__file__', None)
+
+            if extensionFilename or self.linkExtensionModules:
+                self.extras.append((moduleName, extensionFilename))
+
+            # If it is a submodule of a frozen module, Python will have
+            # trouble importing it as a builtin module.  Synthesize a frozen
+            # module that loads it as builtin.
+            if '.' in moduleName and self.linkExtensionModules:
+                code = compile('import sys;del sys.modules["%s"];import imp;imp.init_builtin("%s")' % (moduleName, moduleName), moduleName, 'exec')
+                code = marshal.dumps(code)
+                mangledName = self.mangleName(moduleName)
+                moduleDefs.append(self.makeModuleDef(mangledName, code))
+                moduleList.append(self.makeModuleListEntry(mangledName, code, moduleName, None))
+            elif '.' in moduleName:
+                # Nothing we can do about this case except warn the user they
+                # are in for some trouble.
+                print('WARNING: Python cannot import extension modules under '
+                      'frozen Python packages; %s will be inaccessible.  '
+                      'passing either -l to link in extension modules or use '
+                      '-x %s to exclude the entire package.' % (moduleName, moduleName.split('.')[0]))
 
 
         text = programFile % {
         text = programFile % {
             'moduleDefs': '\n'.join(moduleDefs),
             'moduleDefs': '\n'.join(moduleDefs),
             'moduleList': '\n'.join(moduleList),
             'moduleList': '\n'.join(moduleList),
-            'initCode': initCode
             }
             }
 
 
+        if self.linkExtensionModules and self.extras:
+            # Should we link in extension modules?  If so, we write out a new
+            # built-in module table that directly hooks up with the init
+            # functions.  On Linux, we completely override Python's own
+            # built-in module table; on Windows, we can't do this, so we
+            # instead use PyImport_ExtendInittab to add to it.
+
+            # Python 3 case.
+            text += '#if PY_MAJOR_VERSION >= 3\n'
+            for module, fn in self.extras:
+                if sys.platform != "win32" or fn:
+                    libName = module.split('.')[-1]
+                    initFunc = builtinInitFuncs.get(module, 'PyInit_' + libName)
+                    if initFunc:
+                        text += 'extern DL_IMPORT(PyObject) *%s(void);\n' % (initFunc)
+            text += '\n'
+
+            if sys.platform == "win32":
+                text += 'static struct _inittab extensions[] = {\n'
+            else:
+                text += 'struct _inittab _PyImport_Inittab[] = {\n'
+
+            for module, fn in self.extras:
+                if sys.platform != "win32" or fn:
+                    libName = module.split('.')[-1]
+                    initFunc = builtinInitFuncs.get(module, 'PyInit_' + libName) or 'NULL'
+                    text += '  {"%s", %s},\n' % (module, initFunc)
+            text += '  {0, 0},\n'
+            text += '};\n\n'
+
+            # Python 2 case.
+            text += '#else\n'
+            for module, fn in self.extras:
+                if sys.platform != "win32" or fn:
+                    libName = module.split('.')[-1]
+                    initFunc = builtinInitFuncs.get(module, 'init' + libName)
+                    if initFunc:
+                        text += 'extern DL_IMPORT(void) %s(void);\n' % (initFunc)
+            text += '\n'
+
+            if sys.platform == "win32":
+                text += 'static struct _inittab extensions[] = {\n'
+            else:
+                text += 'struct _inittab _PyImport_Inittab[] = {\n'
+
+            for module, fn in self.extras:
+                if sys.platform != "win32" or fn:
+                    libName = module.split('.')[-1]
+                    initFunc = builtinInitFuncs.get(module, 'init' + libName) or 'NULL'
+                    text += '  {"%s", %s},\n' % (module, initFunc)
+            text += '  {0, 0},\n'
+            text += '};\n'
+            text += '#endif\n\n'
+
+        elif sys.platform == "win32":
+            text += 'static struct _inittab extensions[] = {\n'
+            text += '  {0, 0},\n'
+            text += '};\n\n'
+
+        text += initCode
+
         if filename is not None:
         if filename is not None:
             file = open(filename, 'w')
             file = open(filename, 'w')
             file.write(text)
             file.write(text)
@@ -1375,7 +1482,6 @@ class Freezer:
                 'dllimport' : dllimport,
                 'dllimport' : dllimport,
                 }
                 }
             if self.platform.startswith('win'):
             if self.platform.startswith('win'):
-                initCode += self.frozenExtensions
                 target = basename + '.exe'
                 target = basename + '.exe'
             else:
             else:
                 target = basename
                 target = basename
@@ -1397,14 +1503,46 @@ class Freezer:
 
 
         self.writeCode(filename, initCode=initCode)
         self.writeCode(filename, initCode=initCode)
 
 
+        # Keep track of the files we should clean up after use.
+        cleanFiles = [filename, basename + self.objectExtension]
+
+        extraLink = []
+        if self.linkExtensionModules:
+            for mod, fn in self.extras:
+                if not fn:
+                    continue
+                if sys.platform == 'win32':
+                    # We can't link with a .pyd directly on Windows.  Check
+                    # if there is a corresponding .lib file in the Python libs
+                    # directory.
+                    libsdir = os.path.join(sys.exec_prefix, 'libs')
+                    libfile = os.path.join(libsdir, mod + '.lib')
+                    if os.path.isfile(libfile):
+                        extraLink.append(mod + '.lib')
+                        continue
+
+                    # No, so we have to generate a .lib file.  This is pretty
+                    # easy given that we know the only symbol we need is a
+                    # initmodule or PyInit_module function.
+                    modname = mod.split('.')[-1]
+                    libfile = modname + '.lib'
+                    if sys.version_info >= (3, 0):
+                        symbolName = 'PyInit_' + modname
+                    else:
+                        symbolName = 'init' + modname
+                    os.system('lib /nologo /def /export:%s /name:%s.pyd /out:%s' % (symbolName, modname, libfile))
+                    extraLink.append(libfile)
+                    cleanFiles += [libfile, modname + '.exp']
+                else:
+                    extraLink.append(fn)
+
         try:
         try:
-            compileFunc(filename, basename)
+            compileFunc(filename, basename, extraLink=extraLink)
         finally:
         finally:
             if not self.keepTemporaryFiles:
             if not self.keepTemporaryFiles:
-                if os.path.exists(filename):
-                    os.unlink(filename)
-                if os.path.exists(basename + self.objectExtension):
-                    os.unlink(basename + self.objectExtension)
+                for file in cleanFiles:
+                    if os.path.exists(file):
+                        os.unlink(file)
 
 
         return target
         return target
 
 

+ 19 - 4
direct/src/showutil/pfreeze.py

@@ -15,7 +15,7 @@ imported directly or indirectly by the original startfile.py.
 
 
 Usage:
 Usage:
 
 
-  pfreeze.py [opts] startfile
+  pfreeze.py [opts] [startfile]
 
 
 Options:
 Options:
 
 
@@ -40,11 +40,20 @@ Options:
      of the __path__ variable, and thus must be actually imported to
      of the __path__ variable, and thus must be actually imported to
      determine the true value of __path__.
      determine the true value of __path__.
 
 
+  -P path
+     Specifies an additional directory in which we should search for
+     Python modules.  This is equivalent to setting the PYTHONPATH
+     environment variable.  May be repeated.
+
   -s
   -s
      Adds the standard set of modules that are necessary for embedding
      Adds the standard set of modules that are necessary for embedding
      the Python interpreter.  Implicitly set if an executable is
      the Python interpreter.  Implicitly set if an executable is
      generated.
      generated.
 
 
+  -k
+     Keeps temporary files generated by pfreeze.  Useful when debugging
+     FreezeTool itself.
+
 """
 """
 
 
 import getopt
 import getopt
@@ -55,7 +64,7 @@ from direct.showutil import FreezeTool
 def usage(code, msg = ''):
 def usage(code, msg = ''):
     if __doc__:
     if __doc__:
         sys.stderr.write(__doc__ + '\n')
         sys.stderr.write(__doc__ + '\n')
-    sys.stderr.write(msg + '\n')
+    sys.stderr.write(str(msg) + '\n')
     sys.exit(code)
     sys.exit(code)
 
 
 # We're not protecting the next part under a __name__ == __main__
 # We're not protecting the next part under a __name__ == __main__
@@ -67,7 +76,7 @@ basename = None
 addStartupModules = False
 addStartupModules = False
 
 
 try:
 try:
-    opts, args = getopt.getopt(sys.argv[1:], 'o:i:x:p:sh')
+    opts, args = getopt.getopt(sys.argv[1:], 'o:i:x:p:P:slkh')
 except getopt.error as msg:
 except getopt.error as msg:
     usage(1, msg)
     usage(1, msg)
 
 
@@ -83,8 +92,14 @@ for opt, arg in opts:
     elif opt == '-p':
     elif opt == '-p':
         for module in arg.split(','):
         for module in arg.split(','):
             freezer.handleCustomPath(module)
             freezer.handleCustomPath(module)
+    elif opt == '-P':
+        sys.path.append(arg)
     elif opt == '-s':
     elif opt == '-s':
         addStartupModules = True
         addStartupModules = True
+    elif opt == '-l':
+        freezer.linkExtensionModules = True
+    elif opt == '-k':
+        freezer.keepTemporaryFiles = True
     elif opt == '-h':
     elif opt == '-h':
         usage(0)
         usage(0)
     else:
     else:
@@ -126,7 +141,7 @@ if args:
 
 
 elif outputType == 'exe':
 elif outputType == 'exe':
     # We must have a main module when making an executable.
     # We must have a main module when making an executable.
-    usage(0)
+    usage(1, 'A main file needs to be specified when creating an executable.')
 
 
 freezer.done(addStartupModules = addStartupModules)
 freezer.done(addStartupModules = addStartupModules)
 
 

+ 3 - 6
direct/src/task/Task.py

@@ -397,7 +397,6 @@ class TaskManager:
                 'Task %s does not accept arguments.' % (repr(task)))
                 'Task %s does not accept arguments.' % (repr(task)))
 
 
         if name is not None:
         if name is not None:
-            assert isinstance(name, str), 'Name must be a string type'
             task.setName(name)
             task.setName(name)
         assert task.hasName()
         assert task.hasName()
 
 
@@ -431,16 +430,14 @@ class TaskManager:
         all tasks with the indicated name are removed.  Returns the
         all tasks with the indicated name are removed.  Returns the
         number of tasks removed. """
         number of tasks removed. """
 
 
-        if isinstance(taskOrName, str):
-            tasks = self.mgr.findTasks(taskOrName)
-            return self.mgr.remove(tasks)
-        elif isinstance(taskOrName, AsyncTask):
+        if isinstance(taskOrName, AsyncTask):
             return self.mgr.remove(taskOrName)
             return self.mgr.remove(taskOrName)
         elif isinstance(taskOrName, list):
         elif isinstance(taskOrName, list):
             for task in taskOrName:
             for task in taskOrName:
                 self.remove(task)
                 self.remove(task)
         else:
         else:
-            self.notify.error('remove takes a string or a Task')
+            tasks = self.mgr.findTasks(taskOrName)
+            return self.mgr.remove(tasks)
 
 
     def removeTasksMatching(self, taskPattern):
     def removeTasksMatching(self, taskPattern):
         """Removes all tasks whose names match the pattern, which can
         """Removes all tasks whose names match the pattern, which can

+ 3 - 3
direct/src/tkpanels/ParticlePanel.py

@@ -1976,9 +1976,9 @@ class ParticlePanel(AppShell):
         self.particles.renderer.setAlphaDisable(
         self.particles.renderer.setAlphaDisable(
             self.getVariable('Sprite Renderer', 'Alpha Disable').get())
             self.getVariable('Sprite Renderer', 'Alpha Disable').get())
     def setRendererColorBlendAttrib(self, rendererName, blendMethodStr, incomingOperandStr, fbufferOperandStr):
     def setRendererColorBlendAttrib(self, rendererName, blendMethodStr, incomingOperandStr, fbufferOperandStr):
-        self.particles.getRenderer().setColorBlendMode(eval('ColorBlendAttrib.'+blendMethodStr),
-                                                       eval('ColorBlendAttrib.'+incomingOperandStr),
-                                                       eval('ColorBlendAttrib.'+fbufferOperandStr))
+        self.particles.getRenderer().setColorBlendMode(getattr(ColorBlendAttrib, blendMethodStr),
+                                                       getattr(ColorBlendAttrib, incomingOperandStr),
+                                                       getattr(ColorBlendAttrib, fbufferOperandStr))
 
 
         if(blendMethodStr in ['MAdd','MSubtract','MInvSubtract']):
         if(blendMethodStr in ['MAdd','MSubtract','MInvSubtract']):
             self.getWidget(rendererName,'Incoming Op.').pack(fill = X)
             self.getWidget(rendererName,'Incoming Op.').pack(fill = X)

+ 18 - 0
doc/ReleaseNotes

@@ -1,3 +1,21 @@
+------------------------  RELEASE 1.9.3  ------------------------
+
+This issue fixes several bugs that were still found in 1.9.2.
+
+* Fix crash when running in Steam on Linux when using OpenAL
+* Fix crash using wx/tkinter on Mac as long as want-wx/tk is set
+* Fix loading models from 'models' package with models/ prefix
+* Fix random crashes in task system
+* Fix memory leaks in BulletTriangleMesh
+* Fix loading old models with MovingPart<LMatrix4f>
+* Improve performance of CPU vertex animation somewhat
+* Show framebuffer properties when fbprop request fails
+* Fix hang on exit when using Python task on threaded task chain
+* Fix inability to get RGBA renderbuffer in certain cases
+* Work around GLSL issue with #pragma and certain Intel drivers
+* Improve performance of texture load and store operations
+* Fix crashes with pbuffers on Intel cards on Windows
+
 ------------------------  RELEASE 1.9.2  ------------------------
 ------------------------  RELEASE 1.9.2  ------------------------
 
 
 This is a minor bugfix release, fixing a few minor issues that
 This is a minor bugfix release, fixing a few minor issues that

File diff suppressed because it is too large
+ 348 - 634
dtool/src/cppparser/cppBison.cxx.prebuilt


+ 185 - 198
dtool/src/cppparser/cppBison.h.prebuilt

@@ -1,19 +1,19 @@
-/* A Bison parser, made by GNU Bison 2.7.  */
+/* A Bison parser, made by GNU Bison 3.0.4.  */
 
 
 /* Bison interface for Yacc-like parsers in C
 /* Bison interface for Yacc-like parsers in C
-   
-      Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
-   
+
+   Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+
    This program is free software: you can redistribute it and/or modify
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
    (at your option) any later version.
-   
+
    This program is distributed in the hope that it will be useful,
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    GNU General Public License for more details.
-   
+
    You should have received a copy of the GNU General Public License
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
@@ -26,13 +26,13 @@
    special exception, which will cause the skeleton and the resulting
    special exception, which will cause the skeleton and the resulting
    Bison output files to be licensed under the GNU General Public
    Bison output files to be licensed under the GNU General Public
    License without this special exception.
    License without this special exception.
-   
+
    This special exception was added by the Free Software Foundation in
    This special exception was added by the Free Software Foundation in
    version 2.2 of Bison.  */
    version 2.2 of Bison.  */
 
 
 #ifndef YY_CPPYY_BUILT_TMP_CPPBISON_YXX_H_INCLUDED
 #ifndef YY_CPPYY_BUILT_TMP_CPPBISON_YXX_H_INCLUDED
 # define YY_CPPYY_BUILT_TMP_CPPBISON_YXX_H_INCLUDED
 # define YY_CPPYY_BUILT_TMP_CPPBISON_YXX_H_INCLUDED
-/* Enabling traces.  */
+/* Debug traces.  */
 #ifndef YYDEBUG
 #ifndef YYDEBUG
 # define YYDEBUG 0
 # define YYDEBUG 0
 #endif
 #endif
@@ -40,134 +40,135 @@
 extern int cppyydebug;
 extern int cppyydebug;
 #endif
 #endif
 
 
-/* Tokens.  */
+/* Token type.  */
 #ifndef YYTOKENTYPE
 #ifndef YYTOKENTYPE
 # define YYTOKENTYPE
 # define YYTOKENTYPE
-   /* Put the tokens into the symbol table, so that GDB and other debuggers
-      know about them.  */
-   enum yytokentype {
-     REAL = 258,
-     INTEGER = 259,
-     CHAR_TOK = 260,
-     SIMPLE_STRING = 261,
-     SIMPLE_IDENTIFIER = 262,
-     STRING_LITERAL = 263,
-     CUSTOM_LITERAL = 264,
-     IDENTIFIER = 265,
-     TYPENAME_IDENTIFIER = 266,
-     SCOPING = 267,
-     TYPEDEFNAME = 268,
-     ELLIPSIS = 269,
-     OROR = 270,
-     ANDAND = 271,
-     EQCOMPARE = 272,
-     NECOMPARE = 273,
-     LECOMPARE = 274,
-     GECOMPARE = 275,
-     LSHIFT = 276,
-     RSHIFT = 277,
-     POINTSAT_STAR = 278,
-     DOT_STAR = 279,
-     UNARY = 280,
-     UNARY_NOT = 281,
-     UNARY_NEGATE = 282,
-     UNARY_MINUS = 283,
-     UNARY_PLUS = 284,
-     UNARY_STAR = 285,
-     UNARY_REF = 286,
-     POINTSAT = 287,
-     SCOPE = 288,
-     PLUSPLUS = 289,
-     MINUSMINUS = 290,
-     TIMESEQUAL = 291,
-     DIVIDEEQUAL = 292,
-     MODEQUAL = 293,
-     PLUSEQUAL = 294,
-     MINUSEQUAL = 295,
-     OREQUAL = 296,
-     ANDEQUAL = 297,
-     XOREQUAL = 298,
-     LSHIFTEQUAL = 299,
-     RSHIFTEQUAL = 300,
-     KW_ALIGNAS = 301,
-     KW_ALIGNOF = 302,
-     KW_AUTO = 303,
-     KW_BEGIN_PUBLISH = 304,
-     KW_BLOCKING = 305,
-     KW_BOOL = 306,
-     KW_CATCH = 307,
-     KW_CHAR = 308,
-     KW_CHAR16_T = 309,
-     KW_CHAR32_T = 310,
-     KW_CLASS = 311,
-     KW_CONST = 312,
-     KW_CONSTEXPR = 313,
-     KW_CONST_CAST = 314,
-     KW_DECLTYPE = 315,
-     KW_DEFAULT = 316,
-     KW_DELETE = 317,
-     KW_DOUBLE = 318,
-     KW_DYNAMIC_CAST = 319,
-     KW_ELSE = 320,
-     KW_END_PUBLISH = 321,
-     KW_ENUM = 322,
-     KW_EXTENSION = 323,
-     KW_EXTERN = 324,
-     KW_EXPLICIT = 325,
-     KW_PUBLISHED = 326,
-     KW_FALSE = 327,
-     KW_FINAL = 328,
-     KW_FLOAT = 329,
-     KW_FRIEND = 330,
-     KW_FOR = 331,
-     KW_GOTO = 332,
-     KW_IF = 333,
-     KW_INLINE = 334,
-     KW_INT = 335,
-     KW_LONG = 336,
-     KW_MAKE_PROPERTY = 337,
-     KW_MAKE_PROPERTY2 = 338,
-     KW_MAKE_SEQ = 339,
-     KW_MUTABLE = 340,
-     KW_NAMESPACE = 341,
-     KW_NEW = 342,
-     KW_NOEXCEPT = 343,
-     KW_NULLPTR = 344,
-     KW_OPERATOR = 345,
-     KW_OVERRIDE = 346,
-     KW_PRIVATE = 347,
-     KW_PROTECTED = 348,
-     KW_PUBLIC = 349,
-     KW_REGISTER = 350,
-     KW_REINTERPRET_CAST = 351,
-     KW_RETURN = 352,
-     KW_SHORT = 353,
-     KW_SIGNED = 354,
-     KW_SIZEOF = 355,
-     KW_STATIC = 356,
-     KW_STATIC_ASSERT = 357,
-     KW_STATIC_CAST = 358,
-     KW_STRUCT = 359,
-     KW_TEMPLATE = 360,
-     KW_THREAD_LOCAL = 361,
-     KW_THROW = 362,
-     KW_TRUE = 363,
-     KW_TRY = 364,
-     KW_TYPEDEF = 365,
-     KW_TYPEID = 366,
-     KW_TYPENAME = 367,
-     KW_UNION = 368,
-     KW_UNSIGNED = 369,
-     KW_USING = 370,
-     KW_VIRTUAL = 371,
-     KW_VOID = 372,
-     KW_VOLATILE = 373,
-     KW_WCHAR_T = 374,
-     KW_WHILE = 375,
-     START_CPP = 376,
-     START_CONST_EXPR = 377,
-     START_TYPE = 378
-   };
+  enum yytokentype
+  {
+    REAL = 258,
+    INTEGER = 259,
+    CHAR_TOK = 260,
+    SIMPLE_STRING = 261,
+    SIMPLE_IDENTIFIER = 262,
+    STRING_LITERAL = 263,
+    CUSTOM_LITERAL = 264,
+    IDENTIFIER = 265,
+    TYPENAME_IDENTIFIER = 266,
+    SCOPING = 267,
+    TYPEDEFNAME = 268,
+    ELLIPSIS = 269,
+    OROR = 270,
+    ANDAND = 271,
+    EQCOMPARE = 272,
+    NECOMPARE = 273,
+    LECOMPARE = 274,
+    GECOMPARE = 275,
+    LSHIFT = 276,
+    RSHIFT = 277,
+    POINTSAT_STAR = 278,
+    DOT_STAR = 279,
+    UNARY = 280,
+    UNARY_NOT = 281,
+    UNARY_NEGATE = 282,
+    UNARY_MINUS = 283,
+    UNARY_PLUS = 284,
+    UNARY_STAR = 285,
+    UNARY_REF = 286,
+    POINTSAT = 287,
+    SCOPE = 288,
+    PLUSPLUS = 289,
+    MINUSMINUS = 290,
+    TIMESEQUAL = 291,
+    DIVIDEEQUAL = 292,
+    MODEQUAL = 293,
+    PLUSEQUAL = 294,
+    MINUSEQUAL = 295,
+    OREQUAL = 296,
+    ANDEQUAL = 297,
+    XOREQUAL = 298,
+    LSHIFTEQUAL = 299,
+    RSHIFTEQUAL = 300,
+    KW_ALIGNAS = 301,
+    KW_ALIGNOF = 302,
+    KW_AUTO = 303,
+    KW_BEGIN_PUBLISH = 304,
+    KW_BLOCKING = 305,
+    KW_BOOL = 306,
+    KW_CATCH = 307,
+    KW_CHAR = 308,
+    KW_CHAR16_T = 309,
+    KW_CHAR32_T = 310,
+    KW_CLASS = 311,
+    KW_CONST = 312,
+    KW_CONSTEXPR = 313,
+    KW_CONST_CAST = 314,
+    KW_DECLTYPE = 315,
+    KW_DEFAULT = 316,
+    KW_DELETE = 317,
+    KW_DOUBLE = 318,
+    KW_DYNAMIC_CAST = 319,
+    KW_ELSE = 320,
+    KW_END_PUBLISH = 321,
+    KW_ENUM = 322,
+    KW_EXTENSION = 323,
+    KW_EXTERN = 324,
+    KW_EXPLICIT = 325,
+    KW_PUBLISHED = 326,
+    KW_FALSE = 327,
+    KW_FINAL = 328,
+    KW_FLOAT = 329,
+    KW_FRIEND = 330,
+    KW_FOR = 331,
+    KW_GOTO = 332,
+    KW_IF = 333,
+    KW_INLINE = 334,
+    KW_INT = 335,
+    KW_LONG = 336,
+    KW_MAKE_MAP_PROPERTY = 337,
+    KW_MAKE_PROPERTY = 338,
+    KW_MAKE_PROPERTY2 = 339,
+    KW_MAKE_SEQ = 340,
+    KW_MAKE_SEQ_PROPERTY = 341,
+    KW_MUTABLE = 342,
+    KW_NAMESPACE = 343,
+    KW_NEW = 344,
+    KW_NOEXCEPT = 345,
+    KW_NULLPTR = 346,
+    KW_OPERATOR = 347,
+    KW_OVERRIDE = 348,
+    KW_PRIVATE = 349,
+    KW_PROTECTED = 350,
+    KW_PUBLIC = 351,
+    KW_REGISTER = 352,
+    KW_REINTERPRET_CAST = 353,
+    KW_RETURN = 354,
+    KW_SHORT = 355,
+    KW_SIGNED = 356,
+    KW_SIZEOF = 357,
+    KW_STATIC = 358,
+    KW_STATIC_ASSERT = 359,
+    KW_STATIC_CAST = 360,
+    KW_STRUCT = 361,
+    KW_TEMPLATE = 362,
+    KW_THREAD_LOCAL = 363,
+    KW_THROW = 364,
+    KW_TRUE = 365,
+    KW_TRY = 366,
+    KW_TYPEDEF = 367,
+    KW_TYPEID = 368,
+    KW_TYPENAME = 369,
+    KW_UNION = 370,
+    KW_UNSIGNED = 371,
+    KW_USING = 372,
+    KW_VIRTUAL = 373,
+    KW_VOID = 374,
+    KW_VOLATILE = 375,
+    KW_WCHAR_T = 376,
+    KW_WHILE = 377,
+    START_CPP = 378,
+    START_CONST_EXPR = 379,
+    START_TYPE = 380
+  };
 #endif
 #endif
 /* Tokens.  */
 /* Tokens.  */
 #define REAL 258
 #define REAL 258
@@ -249,83 +250,69 @@ extern int cppyydebug;
 #define KW_INLINE 334
 #define KW_INLINE 334
 #define KW_INT 335
 #define KW_INT 335
 #define KW_LONG 336
 #define KW_LONG 336
-#define KW_MAKE_PROPERTY 337
-#define KW_MAKE_PROPERTY2 338
-#define KW_MAKE_SEQ 339
-#define KW_MUTABLE 340
-#define KW_NAMESPACE 341
-#define KW_NEW 342
-#define KW_NOEXCEPT 343
-#define KW_NULLPTR 344
-#define KW_OPERATOR 345
-#define KW_OVERRIDE 346
-#define KW_PRIVATE 347
-#define KW_PROTECTED 348
-#define KW_PUBLIC 349
-#define KW_REGISTER 350
-#define KW_REINTERPRET_CAST 351
-#define KW_RETURN 352
-#define KW_SHORT 353
-#define KW_SIGNED 354
-#define KW_SIZEOF 355
-#define KW_STATIC 356
-#define KW_STATIC_ASSERT 357
-#define KW_STATIC_CAST 358
-#define KW_STRUCT 359
-#define KW_TEMPLATE 360
-#define KW_THREAD_LOCAL 361
-#define KW_THROW 362
-#define KW_TRUE 363
-#define KW_TRY 364
-#define KW_TYPEDEF 365
-#define KW_TYPEID 366
-#define KW_TYPENAME 367
-#define KW_UNION 368
-#define KW_UNSIGNED 369
-#define KW_USING 370
-#define KW_VIRTUAL 371
-#define KW_VOID 372
-#define KW_VOLATILE 373
-#define KW_WCHAR_T 374
-#define KW_WHILE 375
-#define START_CPP 376
-#define START_CONST_EXPR 377
-#define START_TYPE 378
-
+#define KW_MAKE_MAP_PROPERTY 337
+#define KW_MAKE_PROPERTY 338
+#define KW_MAKE_PROPERTY2 339
+#define KW_MAKE_SEQ 340
+#define KW_MAKE_SEQ_PROPERTY 341
+#define KW_MUTABLE 342
+#define KW_NAMESPACE 343
+#define KW_NEW 344
+#define KW_NOEXCEPT 345
+#define KW_NULLPTR 346
+#define KW_OPERATOR 347
+#define KW_OVERRIDE 348
+#define KW_PRIVATE 349
+#define KW_PROTECTED 350
+#define KW_PUBLIC 351
+#define KW_REGISTER 352
+#define KW_REINTERPRET_CAST 353
+#define KW_RETURN 354
+#define KW_SHORT 355
+#define KW_SIGNED 356
+#define KW_SIZEOF 357
+#define KW_STATIC 358
+#define KW_STATIC_ASSERT 359
+#define KW_STATIC_CAST 360
+#define KW_STRUCT 361
+#define KW_TEMPLATE 362
+#define KW_THREAD_LOCAL 363
+#define KW_THROW 364
+#define KW_TRUE 365
+#define KW_TRY 366
+#define KW_TYPEDEF 367
+#define KW_TYPEID 368
+#define KW_TYPENAME 369
+#define KW_UNION 370
+#define KW_UNSIGNED 371
+#define KW_USING 372
+#define KW_VIRTUAL 373
+#define KW_VOID 374
+#define KW_VOLATILE 375
+#define KW_WCHAR_T 376
+#define KW_WHILE 377
+#define START_CPP 378
+#define START_CONST_EXPR 379
+#define START_TYPE 380
 
 
+/* Value type.  */
 
 
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
-# define YYSTYPE_IS_DECLARED 1
-#endif
-
+/* Location type.  */
 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
-typedef struct YYLTYPE
+typedef struct YYLTYPE YYLTYPE;
+struct YYLTYPE
 {
 {
   int first_line;
   int first_line;
   int first_column;
   int first_column;
   int last_line;
   int last_line;
   int last_column;
   int last_column;
-} YYLTYPE;
-# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
+};
 # define YYLTYPE_IS_DECLARED 1
 # define YYLTYPE_IS_DECLARED 1
 # define YYLTYPE_IS_TRIVIAL 1
 # define YYLTYPE_IS_TRIVIAL 1
 #endif
 #endif
 
 
 
 
-#ifdef YYPARSE_PARAM
-#if defined __STDC__ || defined __cplusplus
-int cppyyparse (void *YYPARSE_PARAM);
-#else
-int cppyyparse ();
-#endif
-#else /* ! YYPARSE_PARAM */
-#if defined __STDC__ || defined __cplusplus
+
 int cppyyparse (void);
 int cppyyparse (void);
-#else
-int cppyyparse ();
-#endif
-#endif /* ! YYPARSE_PARAM */
 
 
 #endif /* !YY_CPPYY_BUILT_TMP_CPPBISON_YXX_H_INCLUDED  */
 #endif /* !YY_CPPYY_BUILT_TMP_CPPBISON_YXX_H_INCLUDED  */

+ 159 - 17
dtool/src/cppparser/cppBison.yxx

@@ -284,9 +284,11 @@ pop_struct() {
 %token KW_INLINE
 %token KW_INLINE
 %token KW_INT
 %token KW_INT
 %token KW_LONG
 %token KW_LONG
+%token KW_MAKE_MAP_PROPERTY
 %token KW_MAKE_PROPERTY
 %token KW_MAKE_PROPERTY
 %token KW_MAKE_PROPERTY2
 %token KW_MAKE_PROPERTY2
 %token KW_MAKE_SEQ
 %token KW_MAKE_SEQ
+%token KW_MAKE_SEQ_PROPERTY
 %token KW_MUTABLE
 %token KW_MUTABLE
 %token KW_NAMESPACE
 %token KW_NAMESPACE
 %token KW_NEW
 %token KW_NEW
@@ -474,7 +476,6 @@ declaration:
         | template_declaration
         | template_declaration
         | extern_c
         | extern_c
         | namespace_declaration
         | namespace_declaration
-        | using_declaration
         | friend_declaration
         | friend_declaration
         | KW_TYPEDEF typedef_declaration
         | KW_TYPEDEF typedef_declaration
         | KW_BEGIN_PUBLISH
         | KW_BEGIN_PUBLISH
@@ -550,6 +551,118 @@ declaration:
                                                          setter_func, current_scope, @1.file);
                                                          setter_func, current_scope, @1.file);
     current_scope->add_declaration(make_property, global_scope, current_lexer, @1);
     current_scope->add_declaration(make_property, global_scope, current_lexer, @1);
   }
   }
+}
+        | KW_MAKE_PROPERTY '(' name ',' IDENTIFIER ',' IDENTIFIER ',' IDENTIFIER ')' ';'
+{
+  CPPDeclaration *getter = $5->find_symbol(current_scope, global_scope, current_lexer);
+  if (getter == (CPPDeclaration *)NULL || getter->get_subtype() != CPPDeclaration::ST_function_group) {
+    yyerror("Reference to non-existent or invalid getter: " + $5->get_fully_scoped_name(), @5);
+
+  } else {
+    CPPDeclaration *setter = $7->find_symbol(current_scope, global_scope, current_lexer);
+    CPPFunctionGroup *setter_func = NULL;
+
+    if (setter == (CPPDeclaration *)NULL || setter->get_subtype() != CPPDeclaration::ST_function_group) {
+      yyerror("Reference to non-existent or invalid setter: " + $7->get_fully_scoped_name(), @7);
+    } else {
+      setter_func = setter->as_function_group();
+    }
+
+    CPPDeclaration *deleter = $9->find_symbol(current_scope, global_scope, current_lexer);
+    if (deleter == (CPPDeclaration *)NULL || deleter->get_subtype() != CPPDeclaration::ST_function_group) {
+      yyerror("reference to non-existent or invalid delete method: " + $9->get_fully_scoped_name(), @9);
+      deleter = NULL;
+    }
+
+    CPPMakeProperty *make_property = new CPPMakeProperty($3, getter->as_function_group(),
+                                                         setter_func, current_scope, @1.file);
+    if (deleter) {
+      make_property->_del_function = deleter->as_function_group();
+    }
+    current_scope->add_declaration(make_property, global_scope, current_lexer, @1);
+  }
+}
+        | KW_MAKE_SEQ_PROPERTY '(' name ',' IDENTIFIER ',' IDENTIFIER ')' ';'
+{
+  CPPDeclaration *length_getter = $5->find_symbol(current_scope, global_scope, current_lexer);
+  if (length_getter == (CPPDeclaration *)NULL || length_getter->get_subtype() != CPPDeclaration::ST_function_group) {
+    yyerror("reference to non-existent or invalid length method: " + $5->get_fully_scoped_name(), @5);
+    length_getter = NULL;
+  }
+
+  CPPDeclaration *getter = $7->find_symbol(current_scope, global_scope, current_lexer);
+  if (getter == (CPPDeclaration *)NULL || getter->get_subtype() != CPPDeclaration::ST_function_group) {
+    yyerror("Reference to non-existent or invalid getter: " + $7->get_fully_scoped_name(), @7);
+  }
+
+  CPPMakeProperty *make_property = new CPPMakeProperty($3, getter->as_function_group(), NULL, current_scope, @1.file);
+  make_property->_length_function = length_getter->as_function_group();
+  current_scope->add_declaration(make_property, global_scope, current_lexer, @1);
+}
+        | KW_MAKE_SEQ_PROPERTY '(' name ',' IDENTIFIER ',' IDENTIFIER ',' IDENTIFIER ')' ';'
+{
+  CPPDeclaration *length_getter = $5->find_symbol(current_scope, global_scope, current_lexer);
+  if (length_getter == (CPPDeclaration *)NULL || length_getter->get_subtype() != CPPDeclaration::ST_function_group) {
+    yyerror("reference to non-existent or invalid length method: " + $5->get_fully_scoped_name(), @5);
+    length_getter = NULL;
+  }
+
+  CPPDeclaration *getter = $7->find_symbol(current_scope, global_scope, current_lexer);
+  if (getter == (CPPDeclaration *)NULL || getter->get_subtype() != CPPDeclaration::ST_function_group) {
+    yyerror("Reference to non-existent or invalid getter: " + $7->get_fully_scoped_name(), @7);
+
+  } else {
+    CPPDeclaration *setter = $9->find_symbol(current_scope, global_scope, current_lexer);
+    CPPFunctionGroup *setter_func = NULL;
+
+    if (setter == (CPPDeclaration *)NULL || setter->get_subtype() != CPPDeclaration::ST_function_group) {
+      yyerror("Reference to non-existent or invalid setter: " + $9->get_fully_scoped_name(), @9);
+    } else {
+      setter_func = setter->as_function_group();
+    }
+
+    CPPMakeProperty *make_property = new CPPMakeProperty($3, getter->as_function_group(),
+                                                         setter_func, current_scope, @1.file);
+    make_property->_length_function = length_getter->as_function_group();
+    current_scope->add_declaration(make_property, global_scope, current_lexer, @1);
+  }
+}
+        | KW_MAKE_SEQ_PROPERTY '(' name ',' IDENTIFIER ',' IDENTIFIER ',' IDENTIFIER ',' IDENTIFIER ')' ';'
+{
+  CPPDeclaration *length_getter = $5->find_symbol(current_scope, global_scope, current_lexer);
+  if (length_getter == (CPPDeclaration *)NULL || length_getter->get_subtype() != CPPDeclaration::ST_function_group) {
+    yyerror("reference to non-existent or invalid length method: " + $5->get_fully_scoped_name(), @5);
+    length_getter = NULL;
+  }
+
+  CPPDeclaration *getter = $7->find_symbol(current_scope, global_scope, current_lexer);
+  if (getter == (CPPDeclaration *)NULL || getter->get_subtype() != CPPDeclaration::ST_function_group) {
+    yyerror("Reference to non-existent or invalid getter: " + $7->get_fully_scoped_name(), @7);
+
+  } else {
+    CPPDeclaration *setter = $9->find_symbol(current_scope, global_scope, current_lexer);
+    CPPFunctionGroup *setter_func = NULL;
+
+    if (setter == (CPPDeclaration *)NULL || setter->get_subtype() != CPPDeclaration::ST_function_group) {
+      yyerror("Reference to non-existent or invalid setter: " + $9->get_fully_scoped_name(), @9);
+    } else {
+      setter_func = setter->as_function_group();
+    }
+
+    CPPDeclaration *deleter = $11->find_symbol(current_scope, global_scope, current_lexer);
+    if (deleter == (CPPDeclaration *)NULL || deleter->get_subtype() != CPPDeclaration::ST_function_group) {
+      yyerror("reference to non-existent or invalid delete method: " + $11->get_fully_scoped_name(), @11);
+      deleter = NULL;
+    }
+
+    CPPMakeProperty *make_property = new CPPMakeProperty($3, getter->as_function_group(),
+                                                         setter_func, current_scope, @1.file);
+    make_property->_length_function = length_getter->as_function_group();
+    if (deleter) {
+      make_property->_del_function = deleter->as_function_group();
+    }
+    current_scope->add_declaration(make_property, global_scope, current_lexer, @1);
+  }
 }
 }
         | KW_MAKE_PROPERTY2 '(' name ',' IDENTIFIER ',' IDENTIFIER ')' ';'
         | KW_MAKE_PROPERTY2 '(' name ',' IDENTIFIER ',' IDENTIFIER ')' ';'
 {
 {
@@ -777,6 +890,7 @@ type_like_declaration:
     $2->set_initializer($3);
     $2->set_initializer($3);
   }
   }
 }
 }
+        | using_declaration
         ;
         ;
 
 
 multiple_var_declaration:
 multiple_var_declaration:
@@ -2349,21 +2463,23 @@ enum:
         ;
         ;
 
 
 enum_decl:
 enum_decl:
-        enum_keyword name_no_final ':' enum_element_type
+        enum_keyword ':' enum_element_type
 {
 {
-  current_enum = new CPPEnumType($2, $4, current_scope, @1.file);
+  current_enum = new CPPEnumType($1, NULL, $3, current_scope, NULL, @1.file);
 }
 }
-        | enum_keyword name_no_final
+        | enum_keyword
 {
 {
-  current_enum = new CPPEnumType($2, current_scope, @1.file);
+  current_enum = new CPPEnumType($1, NULL, current_scope, NULL, @1.file);
 }
 }
-        | enum_keyword ':' enum_element_type
+        | enum_keyword name_no_final ':' enum_element_type
 {
 {
-  current_enum = new CPPEnumType(NULL, $3, current_scope, @1.file);
+  CPPScope *new_scope = new CPPScope(current_scope, $2->_names.back(), V_public);
+  current_enum = new CPPEnumType($1, $2, $4, current_scope, new_scope, @1.file);
 }
 }
-        | enum_keyword
+        | enum_keyword name_no_final
 {
 {
-  current_enum = new CPPEnumType(NULL, current_scope, @1.file);
+  CPPScope *new_scope = new CPPScope(current_scope, $2->_names.back(), V_public);
+  current_enum = new CPPEnumType($1, $2, current_scope, new_scope, @1.file);
 }
 }
         ;
         ;
 
 
@@ -2383,14 +2499,12 @@ enum_body_trailing_comma:
         | enum_body_trailing_comma name ','
         | enum_body_trailing_comma name ','
 {
 {
   assert(current_enum != NULL);
   assert(current_enum != NULL);
-  CPPInstance *inst = current_enum->add_element($2->get_simple_name());
-  current_scope->add_enum_value(inst, current_lexer, @2);
+  current_enum->add_element($2->get_simple_name(), NULL, current_lexer, @2);
 }
 }
         | enum_body_trailing_comma name '=' const_expr ','
         | enum_body_trailing_comma name '=' const_expr ','
 {
 {
   assert(current_enum != NULL);
   assert(current_enum != NULL);
-  CPPInstance *inst = current_enum->add_element($2->get_simple_name(), $4);
-  current_scope->add_enum_value(inst, current_lexer, @2);
+  current_enum->add_element($2->get_simple_name(), $4, current_lexer, @2);
 };
 };
 
 
 enum_body:
 enum_body:
@@ -2398,14 +2512,12 @@ enum_body:
         | enum_body_trailing_comma name
         | enum_body_trailing_comma name
 {
 {
   assert(current_enum != NULL);
   assert(current_enum != NULL);
-  CPPInstance *inst = current_enum->add_element($2->get_simple_name());
-  current_scope->add_enum_value(inst, current_lexer, @2);
+  current_enum->add_element($2->get_simple_name(), NULL, current_lexer, @2);
 }
 }
         | enum_body_trailing_comma name '=' const_expr
         | enum_body_trailing_comma name '=' const_expr
 {
 {
   assert(current_enum != NULL);
   assert(current_enum != NULL);
-  CPPInstance *inst = current_enum->add_element($2->get_simple_name(), $4);
-  current_scope->add_enum_value(inst, current_lexer, @2);
+  current_enum->add_element($2->get_simple_name(), $4, current_lexer, @2);
 }
 }
         ;
         ;
 
 
@@ -2413,6 +2525,14 @@ enum_keyword:
         KW_ENUM
         KW_ENUM
 {
 {
   $$ = CPPExtensionType::T_enum;
   $$ = CPPExtensionType::T_enum;
+}
+        | KW_ENUM KW_CLASS
+{
+  $$ = CPPExtensionType::T_enum_class;
+}
+        | KW_ENUM KW_STRUCT
+{
+  $$ = CPPExtensionType::T_enum_struct;
 }
 }
         ;
         ;
 
 
@@ -3495,6 +3615,28 @@ name:
         | KW_OVERRIDE
         | KW_OVERRIDE
 {
 {
   $$ = new CPPIdentifier("override", @1);
   $$ = new CPPIdentifier("override", @1);
+}
+        | KW_SIGNED
+{
+  // This is not a keyword in Python, so it is useful to be able to use this
+  // in MAKE_PROPERTY definitions, etc.
+  $$ = new CPPIdentifier("signed", @1);
+}
+        | KW_FLOAT
+{
+  $$ = new CPPIdentifier("float", @1);
+}
+        | KW_PUBLIC
+{
+  $$ = new CPPIdentifier("public", @1);
+}
+        | KW_PRIVATE
+{
+  $$ = new CPPIdentifier("private", @1);
+}
+        | KW_STATIC
+{
+  $$ = new CPPIdentifier("static", @1);
 }
 }
         ;
         ;
 
 

+ 66 - 13
dtool/src/cppparser/cppEnumType.cxx

@@ -22,42 +22,53 @@
 #include "indent.h"
 #include "indent.h"
 
 
 /**
 /**
- * Creates an untyped, unscoped enum.
+ * Creates an untyped enum.
  */
  */
 CPPEnumType::
 CPPEnumType::
-CPPEnumType(CPPIdentifier *ident, CPPScope *current_scope,
-            const CPPFile &file) :
-  CPPExtensionType(T_enum, ident, current_scope, file),
-  _parent_scope(current_scope),
+CPPEnumType(Type type, CPPIdentifier *ident, CPPScope *current_scope,
+            CPPScope *scope, const CPPFile &file) :
+  CPPExtensionType(type, ident, current_scope, file),
+  _scope(scope),
   _element_type(NULL),
   _element_type(NULL),
   _last_value(NULL)
   _last_value(NULL)
 {
 {
+  _parent_scope = (type == T_enum) ? current_scope : scope;
+
   if (ident != NULL) {
   if (ident != NULL) {
     ident->_native_scope = current_scope;
     ident->_native_scope = current_scope;
   }
   }
 }
 }
 
 
 /**
 /**
- * Creates a typed but unscoped enum.
+ * Creates a typed enum.
  */
  */
 CPPEnumType::
 CPPEnumType::
-CPPEnumType(CPPIdentifier *ident, CPPType *element_type,
-            CPPScope *current_scope, const CPPFile &file) :
-  CPPExtensionType(T_enum, ident, current_scope, file),
-  _parent_scope(current_scope),
+CPPEnumType(Type type, CPPIdentifier *ident, CPPType *element_type,
+            CPPScope *current_scope, CPPScope *scope, const CPPFile &file) :
+  CPPExtensionType(type, ident, current_scope, file),
+  _scope(scope),
   _element_type(element_type),
   _element_type(element_type),
   _last_value(NULL)
   _last_value(NULL)
 {
 {
+  _parent_scope = (type == T_enum) ? current_scope : scope;
   if (ident != NULL) {
   if (ident != NULL) {
     ident->_native_scope = current_scope;
     ident->_native_scope = current_scope;
   }
   }
 }
 }
 
 
+/**
+ * Returns true if this is a scoped enum.
+ */
+bool CPPEnumType::
+is_scoped() const {
+  return (_type != T_enum);
+}
+
 /**
 /**
  * Returns the integral type used to store enum values.
  * Returns the integral type used to store enum values.
  */
  */
 CPPType *CPPEnumType::
 CPPType *CPPEnumType::
-get_element_type() {
+get_underlying_type() {
   if (_element_type == NULL) {
   if (_element_type == NULL) {
     // This enum is untyped.  Use a suitable default, ie.  'int'. In the
     // This enum is untyped.  Use a suitable default, ie.  'int'. In the
     // future, we might want to check whether it fits in an int.
     // future, we might want to check whether it fits in an int.
@@ -78,11 +89,18 @@ get_element_type() {
  *
  *
  */
  */
 CPPInstance *CPPEnumType::
 CPPInstance *CPPEnumType::
-add_element(const string &name, CPPExpression *value) {
+add_element(const string &name, CPPExpression *value, CPPPreprocessor *preprocessor, const cppyyltype &pos) {
   CPPIdentifier *ident = new CPPIdentifier(name);
   CPPIdentifier *ident = new CPPIdentifier(name);
   ident->_native_scope = _parent_scope;
   ident->_native_scope = _parent_scope;
 
 
-  CPPInstance *inst = new CPPInstance(get_element_type(), ident);
+  CPPInstance *inst;
+  if (_type == T_enum) {
+    // Weakly typed enum.
+    inst = new CPPInstance(get_underlying_type(), ident);
+  } else {
+    // C++11-style strongly typed enum.
+    inst = new CPPInstance(this, ident);
+  }
   inst->_storage_class |= CPPInstance::SC_constexpr;
   inst->_storage_class |= CPPInstance::SC_constexpr;
   _elements.push_back(inst);
   _elements.push_back(inst);
 
 
@@ -104,6 +122,41 @@ add_element(const string &name, CPPExpression *value) {
   }
   }
   inst->_initializer = value;
   inst->_initializer = value;
   _last_value = value;
   _last_value = value;
+
+  if (preprocessor != (CPPPreprocessor *)NULL) {
+    // Same-line comment?
+    CPPCommentBlock *comment =
+      preprocessor->get_comment_on(pos.first_line, pos.file);
+
+    if (comment == (CPPCommentBlock *)NULL) {
+      // Nope.  Check for a comment before this line.
+      comment =
+        preprocessor->get_comment_before(pos.first_line, pos.file);
+
+      if (comment != NULL) {
+        // This is a bit of a hack, but it prevents us from picking up a same-
+        // line comment from the previous line.
+        if (comment->_line_number != pos.first_line - 1 ||
+            comment->_col_number <= pos.first_column) {
+
+          inst->_leading_comment = comment;
+        }
+      }
+    } else {
+      inst->_leading_comment = comment;
+    }
+  }
+
+  // Add the value to the enum scope (as per C++11), assuming it's not anonymous.
+  if (_scope != NULL) {
+    _scope->add_enum_value(inst);
+  }
+
+  // Now add it to the containing scope as well if it's not an "enum class".
+  if (!is_scoped() && _parent_scope != NULL) {
+    _parent_scope->add_enum_value(inst);
+  }
+
   return inst;
   return inst;
 }
 }
 
 

+ 10 - 7
dtool/src/cppparser/cppEnumType.h

@@ -16,6 +16,7 @@
 
 
 #include "dtoolbase.h"
 #include "dtoolbase.h"
 
 
+#include "cppBisonDefs.h"
 #include "cppExtensionType.h"
 #include "cppExtensionType.h"
 
 
 #include <vector>
 #include <vector>
@@ -30,15 +31,16 @@ class CPPScope;
  */
  */
 class CPPEnumType : public CPPExtensionType {
 class CPPEnumType : public CPPExtensionType {
 public:
 public:
-  CPPEnumType(CPPIdentifier *ident, CPPScope *current_scope,
-              const CPPFile &file);
-  CPPEnumType(CPPIdentifier *ident, CPPType *element_type,
-              CPPScope *current_scope, const CPPFile &file);
+  CPPEnumType(Type type, CPPIdentifier *ident, CPPScope *current_scope,
+              CPPScope *scope, const CPPFile &file);
+  CPPEnumType(Type type, CPPIdentifier *ident, CPPType *element_type,
+              CPPScope *current_scope, CPPScope *scope, const CPPFile &file);
 
 
-  CPPType *get_element_type();
+  bool is_scoped() const;
+  CPPType *get_underlying_type();
 
 
-  CPPInstance *add_element(const string &name,
-                           CPPExpression *value = (CPPExpression *)NULL);
+  CPPInstance *add_element(const string &name, CPPExpression *value,
+                           CPPPreprocessor *preprocessor, const cppyyltype &pos);
 
 
   virtual bool is_incomplete() const;
   virtual bool is_incomplete() const;
 
 
@@ -54,6 +56,7 @@ public:
   virtual CPPEnumType *as_enum_type();
   virtual CPPEnumType *as_enum_type();
 
 
   CPPScope *_parent_scope;
   CPPScope *_parent_scope;
+  CPPScope *_scope;
   CPPType *_element_type;
   CPPType *_element_type;
 
 
   typedef vector<CPPInstance *> Elements;
   typedef vector<CPPInstance *> Elements;

+ 1 - 1
dtool/src/cppparser/cppExpression.cxx

@@ -949,7 +949,7 @@ determine_type() const {
 
 
         case CPPDeclaration::ST_enum:
         case CPPDeclaration::ST_enum:
           // Convert into integral type.
           // Convert into integral type.
-          return t1->as_enum_type()->get_element_type();
+          return t1->as_enum_type()->get_underlying_type();
 
 
         case CPPDeclaration::ST_simple:
         case CPPDeclaration::ST_simple:
           {
           {

+ 6 - 0
dtool/src/cppparser/cppExtensionType.cxx

@@ -229,6 +229,12 @@ operator << (ostream &out, CPPExtensionType::Type type) {
   case CPPExtensionType::T_union:
   case CPPExtensionType::T_union:
     return out << "union";
     return out << "union";
 
 
+  case CPPExtensionType::T_enum_class:
+    return out << "enum class";
+
+  case CPPExtensionType::T_enum_struct:
+    return out << "enum struct";
+
   default:
   default:
     return out << "***invalid extension type***";
     return out << "***invalid extension type***";
   }
   }

+ 2 - 0
dtool/src/cppparser/cppExtensionType.h

@@ -34,6 +34,8 @@ public:
     T_class,
     T_class,
     T_struct,
     T_struct,
     T_union,
     T_union,
+    T_enum_class,
+    T_enum_struct,
   };
   };
 
 
   CPPExtensionType(Type type, CPPIdentifier *ident, CPPScope *current_scope,
   CPPExtensionType(Type type, CPPIdentifier *ident, CPPScope *current_scope,

+ 19 - 3
dtool/src/cppparser/cppMakeProperty.cxx

@@ -23,10 +23,12 @@ CPPMakeProperty(CPPIdentifier *ident,
                 CPPScope *current_scope, const CPPFile &file) :
                 CPPScope *current_scope, const CPPFile &file) :
   CPPDeclaration(file),
   CPPDeclaration(file),
   _ident(ident),
   _ident(ident),
+  _length_function(NULL),
   _has_function(NULL),
   _has_function(NULL),
   _get_function(getter),
   _get_function(getter),
   _set_function(setter),
   _set_function(setter),
-  _clear_function(NULL)
+  _clear_function(NULL),
+  _del_function(NULL)
 {
 {
   _ident->_native_scope = current_scope;
   _ident->_native_scope = current_scope;
 }
 }
@@ -41,10 +43,12 @@ CPPMakeProperty(CPPIdentifier *ident,
                 CPPScope *current_scope, const CPPFile &file) :
                 CPPScope *current_scope, const CPPFile &file) :
   CPPDeclaration(file),
   CPPDeclaration(file),
   _ident(ident),
   _ident(ident),
+  _length_function(NULL),
   _has_function(hasser),
   _has_function(hasser),
   _get_function(getter),
   _get_function(getter),
   _set_function(setter),
   _set_function(setter),
-  _clear_function(clearer)
+  _clear_function(clearer),
+  _del_function(NULL)
 {
 {
   _ident->_native_scope = current_scope;
   _ident->_native_scope = current_scope;
 }
 }
@@ -78,7 +82,11 @@ get_fully_scoped_name() const {
  */
  */
 void CPPMakeProperty::
 void CPPMakeProperty::
 output(ostream &out, int indent_level, CPPScope *scope, bool complete) const {
 output(ostream &out, int indent_level, CPPScope *scope, bool complete) const {
-  out << "__make_property";
+  if (_length_function != NULL) {
+    out << "__make_seq_property";
+  } else {
+    out << "__make_property";
+  }
 
 
   if (_has_function != NULL) {
   if (_has_function != NULL) {
     out.put('2');
     out.put('2');
@@ -86,6 +94,10 @@ output(ostream &out, int indent_level, CPPScope *scope, bool complete) const {
 
 
   out << "(" << _ident->get_local_name(scope);
   out << "(" << _ident->get_local_name(scope);
 
 
+  if (_length_function != NULL) {
+    out << ", " << _length_function->_name;
+  }
+
   if (_has_function != NULL) {
   if (_has_function != NULL) {
     out << ", " << _has_function->_name;
     out << ", " << _has_function->_name;
   }
   }
@@ -100,6 +112,10 @@ output(ostream &out, int indent_level, CPPScope *scope, bool complete) const {
     out << ", " << _clear_function->_name;
     out << ", " << _clear_function->_name;
   }
   }
 
 
+  if (_del_function != NULL) {
+    out << ", " << _del_function->_name;
+  }
+
   out << ");";
   out << ");";
 }
 }
 
 

+ 4 - 0
dtool/src/cppparser/cppMakeProperty.h

@@ -46,10 +46,14 @@ public:
   virtual CPPMakeProperty *as_make_property();
   virtual CPPMakeProperty *as_make_property();
 
 
   CPPIdentifier *_ident;
   CPPIdentifier *_ident;
+  // If length_function is not NULL, this is actually a sequence property,
+  // and the other functions take an additional index argument.
+  CPPFunctionGroup *_length_function;
   CPPFunctionGroup *_has_function;
   CPPFunctionGroup *_has_function;
   CPPFunctionGroup *_get_function;
   CPPFunctionGroup *_get_function;
   CPPFunctionGroup *_set_function;
   CPPFunctionGroup *_set_function;
   CPPFunctionGroup *_clear_function;
   CPPFunctionGroup *_clear_function;
+  CPPFunctionGroup *_del_function;
 };
 };
 
 
 #endif
 #endif

+ 2 - 0
dtool/src/cppparser/cppPreprocessor.cxx

@@ -2458,9 +2458,11 @@ check_keyword(const string &name) {
   if (name == "__inline__") return KW_INLINE;
   if (name == "__inline__") return KW_INLINE;
   if (name == "int") return KW_INT;
   if (name == "int") return KW_INT;
   if (name == "long") return KW_LONG;
   if (name == "long") return KW_LONG;
+  if (name == "__make_map_property") return KW_MAKE_MAP_PROPERTY;
   if (name == "__make_property") return KW_MAKE_PROPERTY;
   if (name == "__make_property") return KW_MAKE_PROPERTY;
   if (name == "__make_property2") return KW_MAKE_PROPERTY2;
   if (name == "__make_property2") return KW_MAKE_PROPERTY2;
   if (name == "__make_seq") return KW_MAKE_SEQ;
   if (name == "__make_seq") return KW_MAKE_SEQ;
+  if (name == "__make_seq_property") return KW_MAKE_SEQ_PROPERTY;
   if (name == "mutable") return KW_MUTABLE;
   if (name == "mutable") return KW_MUTABLE;
   if (name == "namespace") return KW_NAMESPACE;
   if (name == "namespace") return KW_NAMESPACE;
   if (name == "noexcept") return KW_NOEXCEPT;
   if (name == "noexcept") return KW_NOEXCEPT;

+ 74 - 53
dtool/src/cppparser/cppScope.cxx

@@ -18,6 +18,7 @@
 #include "cppTypedefType.h"
 #include "cppTypedefType.h"
 #include "cppTypeDeclaration.h"
 #include "cppTypeDeclaration.h"
 #include "cppExtensionType.h"
 #include "cppExtensionType.h"
+#include "cppEnumType.h"
 #include "cppInstance.h"
 #include "cppInstance.h"
 #include "cppInstanceIdentifier.h"
 #include "cppInstanceIdentifier.h"
 #include "cppIdentifier.h"
 #include "cppIdentifier.h"
@@ -124,37 +125,72 @@ add_declaration(CPPDeclaration *decl, CPPScope *global_scope,
  *
  *
  */
  */
 void CPPScope::
 void CPPScope::
-add_enum_value(CPPInstance *inst, CPPPreprocessor *preprocessor,
-               const cppyyltype &pos) {
+add_enum_value(CPPInstance *inst) {
   inst->_vis = _current_vis;
   inst->_vis = _current_vis;
 
 
-  if (inst->_leading_comment == (CPPCommentBlock *)NULL) {
-    // Same-line comment?
-    CPPCommentBlock *comment =
-      preprocessor->get_comment_on(pos.first_line, pos.file);
+  string name = inst->get_simple_name();
+  if (!name.empty()) {
+    _enum_values[name] = inst;
+  }
+}
 
 
-    if (comment == (CPPCommentBlock *)NULL) {
-      // Nope.  Check for a comment before this line.
-      comment =
-        preprocessor->get_comment_before(pos.first_line, pos.file);
+/**
+ *
+ */
+void CPPScope::
+define_typedef_type(CPPTypedefType *type, CPPPreprocessor *error_sink) {
+  string name = type->get_simple_name();
 
 
-      if (comment != NULL) {
-        // This is a bit of a hack, but it prevents us from picking up a same-
-        // line comment from the previous line.
-        if (comment->_line_number != pos.first_line - 1 ||
-            comment->_col_number <= pos.first_column) {
+  pair<Types::iterator, bool> result =
+    _types.insert(Types::value_type(name, type));
 
 
-          inst->_leading_comment = comment;
-        }
+  if (!result.second) {
+    CPPType *other_type = result.first->second;
+    CPPTypedefType *other_td = other_type->as_typedef_type();
+
+    // We don't do redefinitions of typedefs.  But we don't complain as long
+    // as this is actually a typedef to the previous definition.
+    if (other_type != type->_type &&
+        (other_td == NULL || !other_td->_type->is_equivalent(*type->_type))) {
+
+      if (error_sink != NULL) {
+        ostringstream errstr;
+        type->output(errstr, 0, NULL, false);
+        errstr << " has conflicting declaration as ";
+        other_type->output(errstr, 0, NULL, true);
+        error_sink->error(errstr.str(), type->_ident->_loc);
+        error_sink->error("previous definition is here",
+                          other_td->_ident->_loc);
       }
       }
-    } else {
-      inst->_leading_comment = comment;
     }
     }
+  } else {
+    _types[name] = type;
   }
   }
 
 
-  string name = inst->get_simple_name();
-  if (!name.empty()) {
-    _enum_values[name] = inst;
+  // This might be a templated "using" definition.
+  if (type->is_template()) {
+    CPPTemplateScope *scope = type->get_template_scope();
+    if (scope->_parameters._parameters.size() == 0) {
+      return;
+    }
+
+    string simple_name = type->get_simple_name();
+
+    pair<Templates::iterator, bool> result =
+      _templates.insert(Templates::value_type(simple_name, type));
+
+    if (!result.second) {
+      // The template was not inserted because we already had a template
+      // definition with the given name.  If the previous definition was
+      // incomplete, replace it.
+      CPPDeclaration *old_templ = (*result.first).second;
+      CPPType *old_templ_type = old_templ->as_type();
+      if (old_templ_type == NULL || old_templ_type->is_incomplete()) {
+        // The previous template definition was incomplete, maybe a forward
+        // reference; replace it with the good one.
+        (*result.first).second = type;
+      }
+    }
   }
   }
 }
 }
 
 
@@ -183,6 +219,8 @@ define_extension_type(CPPExtensionType *type, CPPPreprocessor *error_sink) {
     break;
     break;
 
 
   case CPPExtensionType::T_enum:
   case CPPExtensionType::T_enum:
+  case CPPExtensionType::T_enum_struct:
+  case CPPExtensionType::T_enum_class:
     _enums[name] = type;
     _enums[name] = type;
     break;
     break;
   }
   }
@@ -606,6 +644,11 @@ find_scope(const string &name, bool recurse) const {
     if (st != NULL) {
     if (st != NULL) {
       return st->_scope;
       return st->_scope;
     }
     }
+
+    CPPEnumType *et = type->as_enum_type();
+    if (et != NULL) {
+      return et->_scope;
+    }
   }
   }
 
 
   Using::const_iterator ui;
   Using::const_iterator ui;
@@ -645,11 +688,16 @@ find_scope(const string &name, CPPDeclaration::SubstDecl &subst,
   }
   }
 
 
   CPPStructType *st = type->as_struct_type();
   CPPStructType *st = type->as_struct_type();
-  if (st == NULL) {
-    return NULL;
+  if (st != NULL) {
+    return st->_scope;
   }
   }
 
 
-  return st->_scope;
+  CPPEnumType *et = type->as_enum_type();
+  if (et != NULL) {
+    return et->_scope;
+  }
+
+  return NULL;
 }
 }
 
 
 /**
 /**
@@ -1048,39 +1096,12 @@ handle_declaration(CPPDeclaration *decl, CPPScope *global_scope,
                    CPPPreprocessor *error_sink) {
                    CPPPreprocessor *error_sink) {
   CPPTypedefType *def = decl->as_typedef_type();
   CPPTypedefType *def = decl->as_typedef_type();
   if (def != NULL) {
   if (def != NULL) {
-    string name = def->get_simple_name();
-
-    pair<Types::iterator, bool> result =
-      _types.insert(Types::value_type(name, def));
-
-    if (!result.second) {
-      CPPType *other_type = result.first->second;
-      CPPTypedefType *other_td = other_type->as_typedef_type();
-
-      // We don't do redefinitions of typedefs.  But we don't complain as long
-      // as this is actually a typedef to the previous definition.
-      if (other_type != def->_type &&
-          (other_td == NULL || !other_td->_type->is_equivalent(*def->_type))) {
-
-        if (error_sink != NULL) {
-          ostringstream errstr;
-          def->output(errstr, 0, NULL, false);
-          errstr << " has conflicting declaration as ";
-          other_type->output(errstr, 0, NULL, true);
-          error_sink->error(errstr.str(), def->_ident->_loc);
-          error_sink->error("previous definition is here",
-                            other_td->_ident->_loc);
-        }
-      }
-    } else {
-      _types[name] = def;
-    }
+    define_typedef_type(def, error_sink);
 
 
     CPPExtensionType *et = def->_type->as_extension_type();
     CPPExtensionType *et = def->_type->as_extension_type();
     if (et != NULL) {
     if (et != NULL) {
       define_extension_type(et, error_sink);
       define_extension_type(et, error_sink);
     }
     }
-
     return;
     return;
   }
   }
 
 

+ 3 - 3
dtool/src/cppparser/cppScope.h

@@ -61,9 +61,9 @@ public:
   virtual void add_declaration(CPPDeclaration *decl, CPPScope *global_scope,
   virtual void add_declaration(CPPDeclaration *decl, CPPScope *global_scope,
                                CPPPreprocessor *preprocessor,
                                CPPPreprocessor *preprocessor,
                                const cppyyltype &pos);
                                const cppyyltype &pos);
-  virtual void add_enum_value(CPPInstance *inst,
-                              CPPPreprocessor *preprocessor,
-                              const cppyyltype &pos);
+  virtual void add_enum_value(CPPInstance *inst);
+  virtual void define_typedef_type(CPPTypedefType *type,
+                                   CPPPreprocessor *error_sink = NULL);
   virtual void define_extension_type(CPPExtensionType *type,
   virtual void define_extension_type(CPPExtensionType *type,
                                      CPPPreprocessor *error_sink = NULL);
                                      CPPPreprocessor *error_sink = NULL);
   virtual void define_namespace(CPPNamespace *scope);
   virtual void define_namespace(CPPNamespace *scope);

+ 1 - 1
dtool/src/cppparser/cppStructType.cxx

@@ -674,7 +674,7 @@ substitute_decl(CPPDeclaration::SubstDecl &subst,
 
 
         // If the struct name didn't have an explicit template reference
         // If the struct name didn't have an explicit template reference
         // before, now it does.
         // before, now it does.
-        if (!_ident->_names.empty() && !_ident->_names.back().has_templ()) {
+        if (_ident != NULL && !_ident->_names.empty() && !_ident->_names.back().has_templ()) {
           if (rep->is_template()) {
           if (rep->is_template()) {
             rep->_template_scope = (CPPTemplateScope *)NULL;
             rep->_template_scope = (CPPTemplateScope *)NULL;
             CPPNameComponent nc(get_simple_name());
             CPPNameComponent nc(get_simple_name());

+ 12 - 3
dtool/src/cppparser/cppTemplateScope.cxx

@@ -43,11 +43,20 @@ add_declaration(CPPDeclaration *decl, CPPScope *global_scope,
  *
  *
  */
  */
 void CPPTemplateScope::
 void CPPTemplateScope::
-add_enum_value(CPPInstance *inst, CPPPreprocessor *preprocessor,
-               const cppyyltype &pos) {
+add_enum_value(CPPInstance *inst) {
   inst->_template_scope = this;
   inst->_template_scope = this;
   assert(_parent_scope != NULL);
   assert(_parent_scope != NULL);
-  _parent_scope->add_enum_value(inst, preprocessor, pos);
+  _parent_scope->add_enum_value(inst);
+}
+
+/**
+ *
+ */
+void CPPTemplateScope::
+define_typedef_type(CPPTypedefType *type, CPPPreprocessor *error_sink) {
+  type->_template_scope = this;
+  assert(_parent_scope != NULL);
+  _parent_scope->define_typedef_type(type, error_sink);
 }
 }
 
 
 /**
 /**

+ 3 - 3
dtool/src/cppparser/cppTemplateScope.h

@@ -33,9 +33,9 @@ public:
   virtual void add_declaration(CPPDeclaration *decl, CPPScope *global_scope,
   virtual void add_declaration(CPPDeclaration *decl, CPPScope *global_scope,
                                CPPPreprocessor *preprocessor,
                                CPPPreprocessor *preprocessor,
                                const cppyyltype &pos);
                                const cppyyltype &pos);
-  virtual void add_enum_value(CPPInstance *inst,
-                              CPPPreprocessor *preprocessor,
-                              const cppyyltype &pos);
+  virtual void add_enum_value(CPPInstance *inst);
+  virtual void define_typedef_type(CPPTypedefType *type,
+                                   CPPPreprocessor *error_sink = NULL);
   virtual void define_extension_type(CPPExtensionType *type,
   virtual void define_extension_type(CPPExtensionType *type,
                                      CPPPreprocessor *error_sink = NULL);
                                      CPPPreprocessor *error_sink = NULL);
   virtual void define_namespace(CPPNamespace *scope);
   virtual void define_namespace(CPPNamespace *scope);

+ 17 - 0
dtool/src/cppparser/cppTypedefType.cxx

@@ -14,6 +14,8 @@
 #include "cppTypedefType.h"
 #include "cppTypedefType.h"
 #include "cppIdentifier.h"
 #include "cppIdentifier.h"
 #include "cppInstanceIdentifier.h"
 #include "cppInstanceIdentifier.h"
+#include "cppTemplateScope.h"
+#include "indent.h"
 
 
 /**
 /**
  *
  *
@@ -193,6 +195,17 @@ is_fully_specified() const {
     _type->is_fully_specified();
     _type->is_fully_specified();
 }
 }
 
 
+/**
+ *
+ */
+CPPDeclaration *CPPTypedefType::
+instantiate(const CPPTemplateParameterList *actual_params,
+            CPPScope *current_scope, CPPScope *global_scope,
+            CPPPreprocessor *error_sink) const {
+
+  return _type->instantiate(actual_params, current_scope, global_scope, error_sink);
+}
+
 /**
 /**
  *
  *
  */
  */
@@ -320,6 +333,10 @@ output(ostream &out, int indent_level, CPPScope *scope, bool complete) const {
   if (complete) {
   if (complete) {
     if (_using) {
     if (_using) {
       // It was declared using the "using" keyword.
       // It was declared using the "using" keyword.
+      if (is_template()) {
+        get_template_scope()->_parameters.write_formal(out, scope);
+        indent(out, indent_level);
+      }
       out << "using " << name << " = ";
       out << "using " << name << " = ";
       _type->output(out, 0, scope, false);
       _type->output(out, 0, scope, false);
     } else {
     } else {

+ 8 - 1
dtool/src/cppparser/cppTypedefType.h

@@ -21,7 +21,9 @@ class CPPIdentifier;
 class CPPInstanceIdentifier;
 class CPPInstanceIdentifier;
 
 
 /**
 /**
- *
+ * A type alias created by a C++ typedef or using declaration.  These aren't
+ * officially supposed to be types in themselves, but we represent them as
+ * such so that we can preserve typedef names in the generated code.
  */
  */
 class CPPTypedefType : public CPPType {
 class CPPTypedefType : public CPPType {
 public:
 public:
@@ -46,6 +48,11 @@ public:
 
 
   virtual bool is_fully_specified() const;
   virtual bool is_fully_specified() const;
 
 
+  virtual CPPDeclaration *
+  instantiate(const CPPTemplateParameterList *actual_params,
+              CPPScope *current_scope, CPPScope *global_scope,
+              CPPPreprocessor *error_sink = NULL) const;
+
   virtual CPPDeclaration *substitute_decl(SubstDecl &subst,
   virtual CPPDeclaration *substitute_decl(SubstDecl &subst,
                                           CPPScope *current_scope,
                                           CPPScope *current_scope,
                                           CPPScope *global_scope);
                                           CPPScope *global_scope);

+ 4 - 4
dtool/src/dtoolbase/addHash.I

@@ -15,8 +15,8 @@
  * Adds a linear sequence of uint32 words to the hash.
  * Adds a linear sequence of uint32 words to the hash.
  */
  */
 INLINE size_t AddHash::
 INLINE size_t AddHash::
-add_hash(size_t start, const PN_uint32 *words, size_t num_words) {
-  return (size_t)hashword(words, num_words, (PN_uint32)start);
+add_hash(size_t start, const uint32_t *words, size_t num_words) {
+  return (size_t)hashword(words, num_words, (uint32_t)start);
 }
 }
 
 
 /**
 /**
@@ -24,7 +24,7 @@ add_hash(size_t start, const PN_uint32 *words, size_t num_words) {
  */
  */
 INLINE size_t AddHash::
 INLINE size_t AddHash::
 add_hash(size_t start, const PN_float32 *floats, size_t num_floats) {
 add_hash(size_t start, const PN_float32 *floats, size_t num_floats) {
-  return add_hash(start, (const PN_uint32 *)floats, num_floats);
+  return add_hash(start, (const uint32_t *)floats, num_floats);
 }
 }
 
 
 /**
 /**
@@ -32,5 +32,5 @@ add_hash(size_t start, const PN_float32 *floats, size_t num_floats) {
  */
  */
 INLINE size_t AddHash::
 INLINE size_t AddHash::
 add_hash(size_t start, const PN_float64 *floats, size_t num_floats) {
 add_hash(size_t start, const PN_float64 *floats, size_t num_floats) {
-  return add_hash(start, (const PN_uint32 *)floats, num_floats * 2);
+  return add_hash(start, (const uint32_t *)floats, num_floats * 2);
 }
 }

+ 8 - 8
dtool/src/dtoolbase/addHash.cxx

@@ -17,33 +17,33 @@
  * Adds a linear sequence of bytes to the hash.
  * Adds a linear sequence of bytes to the hash.
  */
  */
 size_t AddHash::
 size_t AddHash::
-add_hash(size_t start, const PN_uint8 *bytes, size_t num_bytes) {
+add_hash(size_t start, const uint8_t *bytes, size_t num_bytes) {
   size_t num_words = num_bytes >> 2;
   size_t num_words = num_bytes >> 2;
   size_t remaining_bytes = num_bytes - (num_words << 2);
   size_t remaining_bytes = num_bytes - (num_words << 2);
-  size_t hash = (size_t)hashword((const PN_uint32 *)bytes, num_words, (PN_uint32)start);
+  size_t hash = (size_t)hashword((const uint32_t *)bytes, num_words, (uint32_t)start);
 
 
   switch (remaining_bytes) {
   switch (remaining_bytes) {
   case 3:
   case 3:
     {
     {
-      PN_uint32 remaining;
+      uint32_t remaining;
       remaining = (bytes[num_bytes - 3] << 16) | (bytes[num_bytes - 2] << 8) | (bytes[num_bytes - 1]);
       remaining = (bytes[num_bytes - 3] << 16) | (bytes[num_bytes - 2] << 8) | (bytes[num_bytes - 1]);
-      hash = (size_t)hashword(&remaining, 1, (PN_uint32)hash);
+      hash = (size_t)hashword(&remaining, 1, (uint32_t)hash);
     }
     }
     break;
     break;
 
 
   case 2:
   case 2:
     {
     {
-      PN_uint32 remaining;
+      uint32_t remaining;
       remaining = (bytes[num_bytes - 2] << 8) | (bytes[num_bytes - 1]);
       remaining = (bytes[num_bytes - 2] << 8) | (bytes[num_bytes - 1]);
-      hash = (size_t)hashword(&remaining, 1, (PN_uint32)hash);
+      hash = (size_t)hashword(&remaining, 1, (uint32_t)hash);
     }
     }
     break;
     break;
 
 
   case 1:
   case 1:
     {
     {
-      PN_uint32 remaining;
+      uint32_t remaining;
       remaining = (bytes[num_bytes - 1]);
       remaining = (bytes[num_bytes - 1]);
-      hash = (size_t)hashword(&remaining, 1, (PN_uint32)hash);
+      hash = (size_t)hashword(&remaining, 1, (uint32_t)hash);
     }
     }
     break;
     break;
 
 

+ 2 - 2
dtool/src/dtoolbase/addHash.h

@@ -25,8 +25,8 @@
  */
  */
 class EXPCL_DTOOL AddHash {
 class EXPCL_DTOOL AddHash {
 public:
 public:
-  INLINE static size_t add_hash(size_t start, const PN_uint32 *words, size_t num_words);
-  static size_t add_hash(size_t start, const PN_uint8 *bytes, size_t num_bytes);
+  INLINE static size_t add_hash(size_t start, const uint32_t *words, size_t num_words);
+  static size_t add_hash(size_t start, const uint8_t *bytes, size_t num_bytes);
   INLINE static size_t add_hash(size_t start, const PN_float32 *floats, size_t num_floats);
   INLINE static size_t add_hash(size_t start, const PN_float32 *floats, size_t num_floats);
   INLINE static size_t add_hash(size_t start, const PN_float64 *floats, size_t num_floats);
   INLINE static size_t add_hash(size_t start, const PN_float64 *floats, size_t num_floats);
 };
 };

+ 1 - 1
dtool/src/dtoolbase/atomicAdjustI386Impl.h

@@ -28,7 +28,7 @@
  */
  */
 class EXPCL_DTOOL AtomicAdjustI386Impl {
 class EXPCL_DTOOL AtomicAdjustI386Impl {
 public:
 public:
-  typedef ALIGN_4BYTE PN_int32 Integer;
+  typedef ALIGN_4BYTE int32_t Integer;
   typedef void *UnalignedPointer;
   typedef void *UnalignedPointer;
   typedef ALIGN_4BYTE UnalignedPointer Pointer;
   typedef ALIGN_4BYTE UnalignedPointer Pointer;
 
 

+ 0 - 534
dtool/src/dtoolbase/dlmalloc.h

@@ -1,534 +0,0 @@
-/*
-  Default header file for malloc-2.8.x, written by Doug Lea
-  and released to the public domain, as explained at
-  http://creativecommons.org/licenses/publicdomain. 
- 
-  last update: Mon Aug 15 08:55:52 2005  Doug Lea  (dl at gee)
-
-  This header is for ANSI C/C++ only.  You can set any of
-  the following #defines before including:
-
-  * If USE_DL_PREFIX is defined, it is assumed that malloc.c 
-    was also compiled with this option, so all routines
-    have names starting with "dl".
-
-  * If HAVE_USR_INCLUDE_MALLOC_H is defined, it is assumed that this
-    file will be #included AFTER <malloc.h>. This is needed only if
-    your system defines a struct mallinfo that is incompatible with the
-    standard one declared here.  Otherwise, you can include this file
-    INSTEAD of your system system <malloc.h>.  At least on ANSI, all
-    declarations should be compatible with system versions
-
-  * If MSPACES is defined, declarations for mspace versions are included.
-*/
-
-#ifndef MALLOC_280_H
-#define MALLOC_280_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stddef.h>   /* for size_t */
-
-#if !ONLY_MSPACES
-
-#ifndef USE_DL_PREFIX
-#define dlcalloc               calloc
-#define dlfree                 free
-#define dlmalloc               malloc
-#define dlmemalign             memalign
-#define dlrealloc              realloc
-#define dlvalloc               valloc
-#define dlpvalloc              pvalloc
-#define dlmallinfo             mallinfo
-#define dlmallopt              mallopt
-#define dlmalloc_trim          malloc_trim
-#define dlmalloc_stats         malloc_stats
-#define dlmalloc_usable_size   malloc_usable_size
-#define dlmalloc_footprint     malloc_footprint
-#define dlindependent_calloc   independent_calloc
-#define dlindependent_comalloc independent_comalloc
-#endif /* USE_DL_PREFIX */
-
-
-/*
-  malloc(size_t n)
-  Returns a pointer to a newly allocated chunk of at least n bytes, or
-  null if no space is available, in which case errno is set to ENOMEM
-  on ANSI C systems.
-
-  If n is zero, malloc returns a minimum-sized chunk. (The minimum
-  size is 16 bytes on most 32bit systems, and 32 bytes on 64bit
-  systems.)  Note that size_t is an unsigned type, so calls with
-  arguments that would be negative if signed are interpreted as
-  requests for huge amounts of space, which will often fail. The
-  maximum supported value of n differs across systems, but is in all
-  cases less than the maximum representable value of a size_t.
-*/
-void* dlmalloc(size_t);
-
-/*
-  free(void* p)
-  Releases the chunk of memory pointed to by p, that had been previously
-  allocated using malloc or a related routine such as realloc.
-  It has no effect if p is null. If p was not malloced or already
-  freed, free(p) will by default cuase the current program to abort.
-*/
-void  dlfree(void*);
-
-/*
-  calloc(size_t n_elements, size_t element_size);
-  Returns a pointer to n_elements * element_size bytes, with all locations
-  set to zero.
-*/
-void* dlcalloc(size_t, size_t);
-
-/*
-  realloc(void* p, size_t n)
-  Returns a pointer to a chunk of size n that contains the same data
-  as does chunk p up to the minimum of (n, p's size) bytes, or null
-  if no space is available.
-
-  The returned pointer may or may not be the same as p. The algorithm
-  prefers extending p in most cases when possible, otherwise it
-  employs the equivalent of a malloc-copy-free sequence.
-
-  If p is null, realloc is equivalent to malloc.
-
-  If space is not available, realloc returns null, errno is set (if on
-  ANSI) and p is NOT freed.
-
-  if n is for fewer bytes than already held by p, the newly unused
-  space is lopped off and freed if possible.  realloc with a size
-  argument of zero (re)allocates a minimum-sized chunk.
-
-  The old unix realloc convention of allowing the last-free'd chunk
-  to be used as an argument to realloc is not supported.
-*/
-
-void* dlrealloc(void*, size_t);
-
-/*
-  memalign(size_t alignment, size_t n);
-  Returns a pointer to a newly allocated chunk of n bytes, aligned
-  in accord with the alignment argument.
-
-  The alignment argument should be a power of two. If the argument is
-  not a power of two, the nearest greater power is used.
-  8-byte alignment is guaranteed by normal malloc calls, so don't
-  bother calling memalign with an argument of 8 or less.
-
-  Overreliance on memalign is a sure way to fragment space.
-*/
-void* dlmemalign(size_t, size_t);
-
-/*
-  valloc(size_t n);
-  Equivalent to memalign(pagesize, n), where pagesize is the page
-  size of the system. If the pagesize is unknown, 4096 is used.
-*/
-void* dlvalloc(size_t);
-
-/*
-  mallopt(int parameter_number, int parameter_value)
-  Sets tunable parameters The format is to provide a
-  (parameter-number, parameter-value) pair.  mallopt then sets the
-  corresponding parameter to the argument value if it can (i.e., so
-  long as the value is meaningful), and returns 1 if successful else
-  0.  SVID/XPG/ANSI defines four standard param numbers for mallopt,
-  normally defined in malloc.h.  None of these are use in this malloc,
-  so setting them has no effect. But this malloc also supports other
-  options in mallopt:
-
-  Symbol            param #  default    allowed param values
-  M_TRIM_THRESHOLD     -1   2*1024*1024   any   (-1U disables trimming)
-  M_GRANULARITY        -2     page size   any power of 2 >= page size
-  M_MMAP_THRESHOLD     -3      256*1024   any   (or 0 if no MMAP support)
-*/
-int dlmallopt(int, int);
-
-#ifndef M_TRIM_THRESHOLD
-#define M_TRIM_THRESHOLD     (-1)
-#endif
-#ifndef M_GRANULARITY
-#define M_GRANULARITY        (-2)
-#endif
-#ifndef M_MMAP_THRESHOLD
-#define M_MMAP_THRESHOLD     (-3)
-#endif
-
-/*
-  malloc_footprint();
-  Returns the number of bytes obtained from the system.  The total
-  number of bytes allocated by malloc, realloc etc., is less than this
-  value. Unlike mallinfo, this function returns only a precomputed
-  result, so can be called frequently to monitor memory consumption.
-  Even if locks are otherwise defined, this function does not use them,
-  so results might not be up to date.
-*/
-size_t dlmalloc_footprint();
-
-#if !NO_MALLINFO
-/*
-  mallinfo()
-  Returns (by copy) a struct containing various summary statistics:
-
-  arena:     current total non-mmapped bytes allocated from system
-  ordblks:   the number of free chunks
-  smblks:    always zero.
-  hblks:     current number of mmapped regions
-  hblkhd:    total bytes held in mmapped regions
-  usmblks:   the maximum total allocated space. This will be greater
-                than current total if trimming has occurred.
-  fsmblks:   always zero
-  uordblks:  current total allocated space (normal or mmapped)
-  fordblks:  total free space
-  keepcost:  the maximum number of bytes that could ideally be released
-               back to system via malloc_trim. ("ideally" means that
-               it ignores page restrictions etc.)
-
-  Because these fields are ints, but internal bookkeeping may
-  be kept as longs, the reported values may wrap around zero and
-  thus be inaccurate.
-*/
-#ifndef HAVE_USR_INCLUDE_MALLOC_H
-#ifndef _MALLOC_H
-#ifndef MALLINFO_FIELD_TYPE
-#define MALLINFO_FIELD_TYPE size_t
-#endif /* MALLINFO_FIELD_TYPE */
-struct mallinfo {
-  MALLINFO_FIELD_TYPE arena;    /* non-mmapped space allocated from system */
-  MALLINFO_FIELD_TYPE ordblks;  /* number of free chunks */
-  MALLINFO_FIELD_TYPE smblks;   /* always 0 */
-  MALLINFO_FIELD_TYPE hblks;    /* always 0 */
-  MALLINFO_FIELD_TYPE hblkhd;   /* space in mmapped regions */
-  MALLINFO_FIELD_TYPE usmblks;  /* maximum total allocated space */
-  MALLINFO_FIELD_TYPE fsmblks;  /* always 0 */
-  MALLINFO_FIELD_TYPE uordblks; /* total allocated space */
-  MALLINFO_FIELD_TYPE fordblks; /* total free space */
-  MALLINFO_FIELD_TYPE keepcost; /* releasable (via malloc_trim) space */
-};
-#endif  /* _MALLOC_H */
-#endif  /* HAVE_USR_INCLUDE_MALLOC_H */
-
-struct mallinfo dlmallinfo(void);
-#endif  /* NO_MALLINFO */
-
-/*
-  independent_calloc(size_t n_elements, size_t element_size, void* chunks[]);
-
-  independent_calloc is similar to calloc, but instead of returning a
-  single cleared space, it returns an array of pointers to n_elements
-  independent elements that can hold contents of size elem_size, each
-  of which starts out cleared, and can be independently freed,
-  realloc'ed etc. The elements are guaranteed to be adjacently
-  allocated (this is not guaranteed to occur with multiple callocs or
-  mallocs), which may also improve cache locality in some
-  applications.
-
-  The "chunks" argument is optional (i.e., may be null, which is
-  probably the most typical usage). If it is null, the returned array
-  is itself dynamically allocated and should also be freed when it is
-  no longer needed. Otherwise, the chunks array must be of at least
-  n_elements in length. It is filled in with the pointers to the
-  chunks.
-
-  In either case, independent_calloc returns this pointer array, or
-  null if the allocation failed.  If n_elements is zero and "chunks"
-  is null, it returns a chunk representing an array with zero elements
-  (which should be freed if not wanted).
-
-  Each element must be individually freed when it is no longer
-  needed. If you'd like to instead be able to free all at once, you
-  should instead use regular calloc and assign pointers into this
-  space to represent elements.  (In this case though, you cannot
-  independently free elements.)
-
-  independent_calloc simplifies and speeds up implementations of many
-  kinds of pools.  It may also be useful when constructing large data
-  structures that initially have a fixed number of fixed-sized nodes,
-  but the number is not known at compile time, and some of the nodes
-  may later need to be freed. For example:
-
-  struct Node { int item; struct Node* next; };
-
-  struct Node* build_list() {
-    struct Node** pool;
-    int n = read_number_of_nodes_needed();
-    if (n <= 0) return 0;
-    pool = (struct Node**)(independent_calloc(n, sizeof(struct Node), 0);
-    if (pool == 0) die();
-    // organize into a linked list...
-    struct Node* first = pool[0];
-    for (i = 0; i < n-1; ++i)
-      pool[i]->next = pool[i+1];
-    free(pool);     // Can now free the array (or not, if it is needed later)
-    return first;
-  }
-*/
-void** dlindependent_calloc(size_t, size_t, void**);
-
-/*
-  independent_comalloc(size_t n_elements, size_t sizes[], void* chunks[]);
-
-  independent_comalloc allocates, all at once, a set of n_elements
-  chunks with sizes indicated in the "sizes" array.    It returns
-  an array of pointers to these elements, each of which can be
-  independently freed, realloc'ed etc. The elements are guaranteed to
-  be adjacently allocated (this is not guaranteed to occur with
-  multiple callocs or mallocs), which may also improve cache locality
-  in some applications.
-
-  The "chunks" argument is optional (i.e., may be null). If it is null
-  the returned array is itself dynamically allocated and should also
-  be freed when it is no longer needed. Otherwise, the chunks array
-  must be of at least n_elements in length. It is filled in with the
-  pointers to the chunks.
-
-  In either case, independent_comalloc returns this pointer array, or
-  null if the allocation failed.  If n_elements is zero and chunks is
-  null, it returns a chunk representing an array with zero elements
-  (which should be freed if not wanted).
-
-  Each element must be individually freed when it is no longer
-  needed. If you'd like to instead be able to free all at once, you
-  should instead use a single regular malloc, and assign pointers at
-  particular offsets in the aggregate space. (In this case though, you
-  cannot independently free elements.)
-
-  independent_comallac differs from independent_calloc in that each
-  element may have a different size, and also that it does not
-  automatically clear elements.
-
-  independent_comalloc can be used to speed up allocation in cases
-  where several structs or objects must always be allocated at the
-  same time.  For example:
-
-  struct Head { ... }
-  struct Foot { ... }
-
-  void send_message(char* msg) {
-    int msglen = strlen(msg);
-    size_t sizes[3] = { sizeof(struct Head), msglen, sizeof(struct Foot) };
-    void* chunks[3];
-    if (independent_comalloc(3, sizes, chunks) == 0)
-      die();
-    struct Head* head = (struct Head*)(chunks[0]);
-    char*        body = (char*)(chunks[1]);
-    struct Foot* foot = (struct Foot*)(chunks[2]);
-    // ...
-  }
-
-  In general though, independent_comalloc is worth using only for
-  larger values of n_elements. For small values, you probably won't
-  detect enough difference from series of malloc calls to bother.
-
-  Overuse of independent_comalloc can increase overall memory usage,
-  since it cannot reuse existing noncontiguous small chunks that
-  might be available for some of the elements.
-*/
-void** dlindependent_comalloc(size_t, size_t*, void**);
-
-
-/*
-  pvalloc(size_t n);
-  Equivalent to valloc(minimum-page-that-holds(n)), that is,
-  round up n to nearest pagesize.
- */
-void*  dlpvalloc(size_t);
-
-/*
-  malloc_trim(size_t pad);
-
-  If possible, gives memory back to the system (via negative arguments
-  to sbrk) if there is unused memory at the `high' end of the malloc
-  pool or in unused MMAP segments. You can call this after freeing
-  large blocks of memory to potentially reduce the system-level memory
-  requirements of a program. However, it cannot guarantee to reduce
-  memory. Under some allocation patterns, some large free blocks of
-  memory will be locked between two used chunks, so they cannot be
-  given back to the system.
-
-  The `pad' argument to malloc_trim represents the amount of free
-  trailing space to leave untrimmed. If this argument is zero, only
-  the minimum amount of memory to maintain internal data structures
-  will be left. Non-zero arguments can be supplied to maintain enough
-  trailing space to service future expected allocations without having
-  to re-obtain memory from the system.
-
-  Malloc_trim returns 1 if it actually released any memory, else 0.
-*/
-int  dlmalloc_trim(size_t);
-
-/*
-  malloc_usable_size(void* p);
-
-  Returns the number of bytes you can actually use in
-  an allocated chunk, which may be more than you requested (although
-  often not) due to alignment and minimum size constraints.
-  You can use this many bytes without worrying about
-  overwriting other allocated objects. This is not a particularly great
-  programming practice. malloc_usable_size can be more useful in
-  debugging and assertions, for example:
-
-  p = malloc(n);
-  assert(malloc_usable_size(p) >= 256);
-*/
-size_t dlmalloc_usable_size(void*);
-
-/*
-  malloc_stats();
-  Prints on stderr the amount of space obtained from the system (both
-  via sbrk and mmap), the maximum amount (which may be more than
-  current if malloc_trim and/or munmap got called), and the current
-  number of bytes allocated via malloc (or realloc, etc) but not yet
-  freed. Note that this is the number of bytes allocated, not the
-  number requested. It will be larger than the number requested
-  because of alignment and bookkeeping overhead. Because it includes
-  alignment wastage as being in use, this figure may be greater than
-  zero even when no user-level chunks are allocated.
-
-  The reported current and maximum system memory can be inaccurate if
-  a program makes other calls to system memory allocation functions
-  (normally sbrk) outside of malloc.
-
-  malloc_stats prints only the most commonly interesting statistics.
-  More information can be obtained by calling mallinfo.
-*/
-void  dlmalloc_stats();
-
-#endif /* !ONLY_MSPACES */
-
-#if MSPACES
-
-/*
-  mspace is an opaque type representing an independent
-  region of space that supports mspace_malloc, etc.
-*/
-typedef void* mspace;
-
-/*
-  create_mspace creates and returns a new independent space with the
-  given initial capacity, or, if 0, the default granularity size.  It
-  returns null if there is no system memory available to create the
-  space.  If argument locked is non-zero, the space uses a separate
-  lock to control access. The capacity of the space will grow
-  dynamically as needed to service mspace_malloc requests.  You can
-  control the sizes of incremental increases of this space by
-  compiling with a different DEFAULT_GRANULARITY or dynamically
-  setting with mallopt(M_GRANULARITY, value).
-*/
-mspace create_mspace(size_t capacity, int locked);
-
-/*
-  destroy_mspace destroys the given space, and attempts to return all
-  of its memory back to the system, returning the total number of
-  bytes freed. After destruction, the results of access to all memory
-  used by the space become undefined.
-*/
-size_t destroy_mspace(mspace msp);
-
-/*
-  create_mspace_with_base uses the memory supplied as the initial base
-  of a new mspace. Part (less than 128*sizeof(size_t) bytes) of this
-  space is used for bookkeeping, so the capacity must be at least this
-  large. (Otherwise 0 is returned.) When this initial space is
-  exhausted, additional memory will be obtained from the system.
-  Destroying this space will deallocate all additionally allocated
-  space (if possible) but not the initial base.
-*/
-mspace create_mspace_with_base(void* base, size_t capacity, int locked);
-
-/*
-  mspace_malloc behaves as malloc, but operates within
-  the given space.
-*/
-void* mspace_malloc(mspace msp, size_t bytes);
-
-/*
-  mspace_free behaves as free, but operates within
-  the given space.
-
-  If compiled with FOOTERS==1, mspace_free is not actually needed.
-  free may be called instead of mspace_free because freed chunks from
-  any space are handled by their originating spaces.
-*/
-void mspace_free(mspace msp, void* mem);
-
-/*
-  mspace_realloc behaves as realloc, but operates within
-  the given space.
-
-  If compiled with FOOTERS==1, mspace_realloc is not actually
-  needed.  realloc may be called instead of mspace_realloc because
-  realloced chunks from any space are handled by their originating
-  spaces.
-*/
-void* mspace_realloc(mspace msp, void* mem, size_t newsize);
-
-/*
-  mspace_calloc behaves as calloc, but operates within
-  the given space.
-*/
-void* mspace_calloc(mspace msp, size_t n_elements, size_t elem_size);
-
-/*
-  mspace_memalign behaves as memalign, but operates within
-  the given space.
-*/
-void* mspace_memalign(mspace msp, size_t alignment, size_t bytes);
-
-/*
-  mspace_independent_calloc behaves as independent_calloc, but
-  operates within the given space.
-*/
-void** mspace_independent_calloc(mspace msp, size_t n_elements,
-                                 size_t elem_size, void* chunks[]);
-
-/*
-  mspace_independent_comalloc behaves as independent_comalloc, but
-  operates within the given space.
-*/
-void** mspace_independent_comalloc(mspace msp, size_t n_elements,
-                                   size_t sizes[], void* chunks[]);
-
-/*
-  mspace_footprint() returns the number of bytes obtained from the
-  system for this space.
-*/
-size_t mspace_footprint(mspace msp);
-
-
-#if !NO_MALLINFO
-/*
-  mspace_mallinfo behaves as mallinfo, but reports properties of
-  the given space.
-*/
-struct mallinfo mspace_mallinfo(mspace msp);
-#endif /* NO_MALLINFO */
-
-/*
-  mspace_malloc_stats behaves as malloc_stats, but reports
-  properties of the given space.
-*/
-void mspace_malloc_stats(mspace msp);
-
-/*
-  mspace_trim behaves as malloc_trim, but
-  operates within the given space.
-*/
-int mspace_trim(mspace msp, size_t pad);
-
-/*
-  An alias for mallopt.
-*/
-int mspace_mallopt(int, int);
-
-#endif  /* MSPACES */
-
-#ifdef __cplusplus
-};  /* end of extern "C" */
-#endif
-
-#endif /* MALLOC_280_H */

File diff suppressed because it is too large
+ 405 - 130
dtool/src/dtoolbase/dlmalloc_src.cxx


+ 2 - 1
dtool/src/dtoolbase/dtoolbase.h

@@ -415,7 +415,7 @@ typedef struct _object PyObject;
 #define MAKE_PROPERTY(property_name, ...) __make_property(property_name, __VA_ARGS__)
 #define MAKE_PROPERTY(property_name, ...) __make_property(property_name, __VA_ARGS__)
 #define MAKE_PROPERTY2(property_name, ...) __make_property2(property_name, __VA_ARGS__)
 #define MAKE_PROPERTY2(property_name, ...) __make_property2(property_name, __VA_ARGS__)
 #define MAKE_SEQ(seq_name, num_name, element_name) __make_seq(seq_name, num_name, element_name)
 #define MAKE_SEQ(seq_name, num_name, element_name) __make_seq(seq_name, num_name, element_name)
-#undef USE_STL_ALLOCATOR  /* Don't try to parse these template classes in interrogate. */
+#define MAKE_SEQ_PROPERTY(property_name, ...) __make_seq_property(property_name, __VA_ARGS__)
 #define EXTENSION(x) __extension x
 #define EXTENSION(x) __extension x
 #define EXTEND __extension
 #define EXTEND __extension
 #else
 #else
@@ -425,6 +425,7 @@ typedef struct _object PyObject;
 #define MAKE_PROPERTY(property_name, ...)
 #define MAKE_PROPERTY(property_name, ...)
 #define MAKE_PROPERTY2(property_name, ...)
 #define MAKE_PROPERTY2(property_name, ...)
 #define MAKE_SEQ(seq_name, num_name, element_name)
 #define MAKE_SEQ(seq_name, num_name, element_name)
+#define MAKE_SEQ_PROPERTY(property_name, ...)
 #define EXTENSION(x)
 #define EXTENSION(x)
 #define EXTEND
 #define EXTEND
 #endif
 #endif

+ 179 - 179
dtool/src/dtoolbase/lookup3.c

@@ -149,25 +149,25 @@ and these came close:
 /*
 /*
 --------------------------------------------------------------------
 --------------------------------------------------------------------
  This works on all machines.  To be useful, it requires
  This works on all machines.  To be useful, it requires
- -- that the key be an array of PN_uint32's, and
- -- that the length be the number of PN_uint32's in the key
+ -- that the key be an array of uint32_t's, and
+ -- that the length be the number of uint32_t's in the key
 
 
  The function hashword() is identical to hashlittle() on little-endian
  The function hashword() is identical to hashlittle() on little-endian
  machines, and identical to hashbig() on big-endian machines,
  machines, and identical to hashbig() on big-endian machines,
- except that the length has to be measured in PN_uint32s rather than in
+ except that the length has to be measured in uint32_ts rather than in
  bytes.  hashlittle() is more complicated than hashword() only because
  bytes.  hashlittle() is more complicated than hashword() only because
  hashlittle() has to dance around fitting the key bytes into registers.
  hashlittle() has to dance around fitting the key bytes into registers.
 --------------------------------------------------------------------
 --------------------------------------------------------------------
 */
 */
-PN_uint32 hashword(
-const PN_uint32 *k,                   /* the key, an array of PN_uint32 values */
-size_t          length,               /* the length of the key, in PN_uint32s */
-PN_uint32        initval)         /* the previous hash, or an arbitrary value */
+uint32_t hashword(
+const uint32_t *k,                   /* the key, an array of uint32_t values */
+size_t          length,               /* the length of the key, in uint32_ts */
+uint32_t        initval)         /* the previous hash, or an arbitrary value */
 {
 {
-  PN_uint32 a,b,c;
+  uint32_t a,b,c;
 
 
   /* Set up the internal state */
   /* Set up the internal state */
-  a = b = c = 0xdeadbeef + (((PN_uint32)length)<<2) + initval;
+  a = b = c = 0xdeadbeef + (((uint32_t)length)<<2) + initval;
 
 
   /*------------------------------------------------- handle most of the key */
   /*------------------------------------------------- handle most of the key */
   while (length > 3)
   while (length > 3)
@@ -180,7 +180,7 @@ PN_uint32        initval)         /* the previous hash, or an arbitrary value */
     k += 3;
     k += 3;
   }
   }
 
 
-  /*------------------------------------------- handle the last 3 PN_uint32's */
+  /*------------------------------------------- handle the last 3 uint32_t's */
   switch(length)                     /* all the case statements fall through */
   switch(length)                     /* all the case statements fall through */
   { 
   { 
   case 3 : c+=k[2];
   case 3 : c+=k[2];
@@ -211,7 +211,7 @@ use a bitmask.  For example, if you need only 10 bits, do
   h = (h & hashmask(10));
   h = (h & hashmask(10));
 In which case, the hash table should have hashsize(10) elements.
 In which case, the hash table should have hashsize(10) elements.
 
 
-If you are hashing n strings (PN_uint8 **)k, do it like this:
+If you are hashing n strings (uint8_t **)k, do it like this:
   for (i=0, h=0; i<n; ++i) h = hashlittle( k[i], len[i], h);
   for (i=0, h=0; i<n; ++i) h = hashlittle( k[i], len[i], h);
 
 
 By Bob Jenkins, 2006.  [email protected].  You may use this
 By Bob Jenkins, 2006.  [email protected].  You may use this
@@ -222,19 +222,19 @@ acceptable.  Do NOT use for cryptographic purposes.
 -------------------------------------------------------------------------------
 -------------------------------------------------------------------------------
 */
 */
 
 
-PN_uint32 hashlittle( const void *key, size_t length, PN_uint32 initval)
+uint32_t hashlittle( const void *key, size_t length, uint32_t initval)
 {
 {
-  PN_uint32 a,b,c;                                          /* internal state */
+  uint32_t a,b,c;                                          /* internal state */
   union { const void *ptr; size_t i; } u;     /* needed for Mac Powerbook G4 */
   union { const void *ptr; size_t i; } u;     /* needed for Mac Powerbook G4 */
 
 
   /* Set up the internal state */
   /* Set up the internal state */
-  a = b = c = 0xdeadbeef + ((PN_uint32)length) + initval;
+  a = b = c = 0xdeadbeef + ((uint32_t)length) + initval;
 
 
   u.ptr = key;
   u.ptr = key;
   if (HASH_LITTLE_ENDIAN && ((u.i & 0x3) == 0)) {
   if (HASH_LITTLE_ENDIAN && ((u.i & 0x3) == 0)) {
-    const PN_uint32 *k =(PN_uint32*) key;                           /* read 32-bit chunks */
+    const uint32_t *k =(uint32_t*) key;                           /* read 32-bit chunks */
 #ifdef VALGRIND
 #ifdef VALGRIND
-    const PN_uint8  *k8;
+    const uint8_t  *k8;
 #endif
 #endif
 
 
     /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
     /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
@@ -279,20 +279,20 @@ PN_uint32 hashlittle( const void *key, size_t length, PN_uint32 initval)
 
 
 #else /* make valgrind happy */
 #else /* make valgrind happy */
 
 
-    k8 = (const PN_uint8 *)k;
+    k8 = (const uint8_t *)k;
     switch(length)
     switch(length)
     {
     {
     case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
     case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
-    case 11: c+=((PN_uint32)k8[10])<<16;  /* fall through */
-    case 10: c+=((PN_uint32)k8[9])<<8;    /* fall through */
+    case 11: c+=((uint32_t)k8[10])<<16;  /* fall through */
+    case 10: c+=((uint32_t)k8[9])<<8;    /* fall through */
     case 9 : c+=k8[8];                   /* fall through */
     case 9 : c+=k8[8];                   /* fall through */
     case 8 : b+=k[1]; a+=k[0]; break;
     case 8 : b+=k[1]; a+=k[0]; break;
-    case 7 : b+=((PN_uint32)k8[6])<<16;   /* fall through */
-    case 6 : b+=((PN_uint32)k8[5])<<8;    /* fall through */
+    case 7 : b+=((uint32_t)k8[6])<<16;   /* fall through */
+    case 6 : b+=((uint32_t)k8[5])<<8;    /* fall through */
     case 5 : b+=k8[4];                   /* fall through */
     case 5 : b+=k8[4];                   /* fall through */
     case 4 : a+=k[0]; break;
     case 4 : a+=k[0]; break;
-    case 3 : a+=((PN_uint32)k8[2])<<16;   /* fall through */
-    case 2 : a+=((PN_uint32)k8[1])<<8;    /* fall through */
+    case 3 : a+=((uint32_t)k8[2])<<16;   /* fall through */
+    case 2 : a+=((uint32_t)k8[1])<<8;    /* fall through */
     case 1 : a+=k8[0]; break;
     case 1 : a+=k8[0]; break;
     case 0 : return c;
     case 0 : return c;
     }
     }
@@ -300,45 +300,45 @@ PN_uint32 hashlittle( const void *key, size_t length, PN_uint32 initval)
 #endif /* !valgrind */
 #endif /* !valgrind */
 
 
   } else if (HASH_LITTLE_ENDIAN && ((u.i & 0x1) == 0)) {
   } else if (HASH_LITTLE_ENDIAN && ((u.i & 0x1) == 0)) {
-    const PN_uint16 *k = (PN_uint16*)key;                           /* read 16-bit chunks */
-    const PN_uint8  *k8;
+    const uint16_t *k = (uint16_t*)key;                           /* read 16-bit chunks */
+    const uint8_t  *k8;
 
 
     /*--------------- all but last block: aligned reads and different mixing */
     /*--------------- all but last block: aligned reads and different mixing */
     while (length > 12)
     while (length > 12)
     {
     {
-      a += k[0] + (((PN_uint32)k[1])<<16);
-      b += k[2] + (((PN_uint32)k[3])<<16);
-      c += k[4] + (((PN_uint32)k[5])<<16);
+      a += k[0] + (((uint32_t)k[1])<<16);
+      b += k[2] + (((uint32_t)k[3])<<16);
+      c += k[4] + (((uint32_t)k[5])<<16);
       mix(a,b,c);
       mix(a,b,c);
       length -= 12;
       length -= 12;
       k += 6;
       k += 6;
     }
     }
 
 
     /*----------------------------- handle the last (probably partial) block */
     /*----------------------------- handle the last (probably partial) block */
-    k8 = (const PN_uint8 *)k;
+    k8 = (const uint8_t *)k;
     switch(length)
     switch(length)
     {
     {
-    case 12: c+=k[4]+(((PN_uint32)k[5])<<16);
-             b+=k[2]+(((PN_uint32)k[3])<<16);
-             a+=k[0]+(((PN_uint32)k[1])<<16);
+    case 12: c+=k[4]+(((uint32_t)k[5])<<16);
+             b+=k[2]+(((uint32_t)k[3])<<16);
+             a+=k[0]+(((uint32_t)k[1])<<16);
              break;
              break;
-    case 11: c+=((PN_uint32)k8[10])<<16;     /* fall through */
+    case 11: c+=((uint32_t)k8[10])<<16;     /* fall through */
     case 10: c+=k[4];
     case 10: c+=k[4];
-             b+=k[2]+(((PN_uint32)k[3])<<16);
-             a+=k[0]+(((PN_uint32)k[1])<<16);
+             b+=k[2]+(((uint32_t)k[3])<<16);
+             a+=k[0]+(((uint32_t)k[1])<<16);
              break;
              break;
     case 9 : c+=k8[8];                      /* fall through */
     case 9 : c+=k8[8];                      /* fall through */
-    case 8 : b+=k[2]+(((PN_uint32)k[3])<<16);
-             a+=k[0]+(((PN_uint32)k[1])<<16);
+    case 8 : b+=k[2]+(((uint32_t)k[3])<<16);
+             a+=k[0]+(((uint32_t)k[1])<<16);
              break;
              break;
-    case 7 : b+=((PN_uint32)k8[6])<<16;      /* fall through */
+    case 7 : b+=((uint32_t)k8[6])<<16;      /* fall through */
     case 6 : b+=k[2];
     case 6 : b+=k[2];
-             a+=k[0]+(((PN_uint32)k[1])<<16);
+             a+=k[0]+(((uint32_t)k[1])<<16);
              break;
              break;
     case 5 : b+=k8[4];                      /* fall through */
     case 5 : b+=k8[4];                      /* fall through */
-    case 4 : a+=k[0]+(((PN_uint32)k[1])<<16);
+    case 4 : a+=k[0]+(((uint32_t)k[1])<<16);
              break;
              break;
-    case 3 : a+=((PN_uint32)k8[2])<<16;      /* fall through */
+    case 3 : a+=((uint32_t)k8[2])<<16;      /* fall through */
     case 2 : a+=k[0];
     case 2 : a+=k[0];
              break;
              break;
     case 1 : a+=k8[0];
     case 1 : a+=k8[0];
@@ -347,23 +347,23 @@ PN_uint32 hashlittle( const void *key, size_t length, PN_uint32 initval)
     }
     }
 
 
   } else {                        /* need to read the key one byte at a time */
   } else {                        /* need to read the key one byte at a time */
-    const PN_uint8 *k =(PN_uint8*) key;
+    const uint8_t *k =(uint8_t*) key;
 
 
     /*--------------- all but the last block: affect some 32 bits of (a,b,c) */
     /*--------------- all but the last block: affect some 32 bits of (a,b,c) */
     while (length > 12)
     while (length > 12)
     {
     {
       a += k[0];
       a += k[0];
-      a += ((PN_uint32)k[1])<<8;
-      a += ((PN_uint32)k[2])<<16;
-      a += ((PN_uint32)k[3])<<24;
+      a += ((uint32_t)k[1])<<8;
+      a += ((uint32_t)k[2])<<16;
+      a += ((uint32_t)k[3])<<24;
       b += k[4];
       b += k[4];
-      b += ((PN_uint32)k[5])<<8;
-      b += ((PN_uint32)k[6])<<16;
-      b += ((PN_uint32)k[7])<<24;
+      b += ((uint32_t)k[5])<<8;
+      b += ((uint32_t)k[6])<<16;
+      b += ((uint32_t)k[7])<<24;
       c += k[8];
       c += k[8];
-      c += ((PN_uint32)k[9])<<8;
-      c += ((PN_uint32)k[10])<<16;
-      c += ((PN_uint32)k[11])<<24;
+      c += ((uint32_t)k[9])<<8;
+      c += ((uint32_t)k[10])<<16;
+      c += ((uint32_t)k[11])<<24;
       mix(a,b,c);
       mix(a,b,c);
       length -= 12;
       length -= 12;
       k += 12;
       k += 12;
@@ -372,17 +372,17 @@ PN_uint32 hashlittle( const void *key, size_t length, PN_uint32 initval)
     /*-------------------------------- last block: affect all 32 bits of (c) */
     /*-------------------------------- last block: affect all 32 bits of (c) */
     switch(length)                   /* all the case statements fall through */
     switch(length)                   /* all the case statements fall through */
     {
     {
-    case 12: c+=((PN_uint32)k[11])<<24;
-    case 11: c+=((PN_uint32)k[10])<<16;
-    case 10: c+=((PN_uint32)k[9])<<8;
+    case 12: c+=((uint32_t)k[11])<<24;
+    case 11: c+=((uint32_t)k[10])<<16;
+    case 10: c+=((uint32_t)k[9])<<8;
     case 9 : c+=k[8];
     case 9 : c+=k[8];
-    case 8 : b+=((PN_uint32)k[7])<<24;
-    case 7 : b+=((PN_uint32)k[6])<<16;
-    case 6 : b+=((PN_uint32)k[5])<<8;
+    case 8 : b+=((uint32_t)k[7])<<24;
+    case 7 : b+=((uint32_t)k[6])<<16;
+    case 6 : b+=((uint32_t)k[5])<<8;
     case 5 : b+=k[4];
     case 5 : b+=k[4];
-    case 4 : a+=((PN_uint32)k[3])<<24;
-    case 3 : a+=((PN_uint32)k[2])<<16;
-    case 2 : a+=((PN_uint32)k[1])<<8;
+    case 4 : a+=((uint32_t)k[3])<<24;
+    case 3 : a+=((uint32_t)k[2])<<16;
+    case 2 : a+=((uint32_t)k[1])<<8;
     case 1 : a+=k[0];
     case 1 : a+=k[0];
              break;
              break;
     case 0 : return c;
     case 0 : return c;
@@ -407,21 +407,21 @@ PN_uint32 hashlittle( const void *key, size_t length, PN_uint32 initval)
 void hashlittle2( 
 void hashlittle2( 
   const void *key,       /* the key to hash */
   const void *key,       /* the key to hash */
   size_t      length,    /* length of the key */
   size_t      length,    /* length of the key */
-  PN_uint32   *pc,        /* IN: primary initval, OUT: primary hash */
-  PN_uint32   *pb)        /* IN: secondary initval, OUT: secondary hash */
+  uint32_t   *pc,        /* IN: primary initval, OUT: primary hash */
+  uint32_t   *pb)        /* IN: secondary initval, OUT: secondary hash */
 {
 {
-  PN_uint32 a,b,c;                                          /* internal state */
+  uint32_t a,b,c;                                          /* internal state */
   union { const void *ptr; size_t i; } u;     /* needed for Mac Powerbook G4 */
   union { const void *ptr; size_t i; } u;     /* needed for Mac Powerbook G4 */
 
 
   /* Set up the internal state */
   /* Set up the internal state */
-  a = b = c = 0xdeadbeef + ((PN_uint32)length) + *pc;
+  a = b = c = 0xdeadbeef + ((uint32_t)length) + *pc;
   c += *pb;
   c += *pb;
 
 
   u.ptr = key;
   u.ptr = key;
   if (HASH_LITTLE_ENDIAN && ((u.i & 0x3) == 0)) {
   if (HASH_LITTLE_ENDIAN && ((u.i & 0x3) == 0)) {
-    const PN_uint32 *k = (PN_uint32*)key;                           /* read 32-bit chunks */
+    const uint32_t *k = (uint32_t*)key;                           /* read 32-bit chunks */
 #ifdef VALGRIND
 #ifdef VALGRIND
-    const PN_uint8  *k8;
+    const uint8_t  *k8;
 #endif
 #endif
 
 
     /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
     /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
@@ -466,20 +466,20 @@ void hashlittle2(
 
 
 #else /* make valgrind happy */
 #else /* make valgrind happy */
 
 
-    k8 = (const PN_uint8 *)k;
+    k8 = (const uint8_t *)k;
     switch(length)
     switch(length)
     {
     {
     case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
     case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
-    case 11: c+=((PN_uint32)k8[10])<<16;  /* fall through */
-    case 10: c+=((PN_uint32)k8[9])<<8;    /* fall through */
+    case 11: c+=((uint32_t)k8[10])<<16;  /* fall through */
+    case 10: c+=((uint32_t)k8[9])<<8;    /* fall through */
     case 9 : c+=k8[8];                   /* fall through */
     case 9 : c+=k8[8];                   /* fall through */
     case 8 : b+=k[1]; a+=k[0]; break;
     case 8 : b+=k[1]; a+=k[0]; break;
-    case 7 : b+=((PN_uint32)k8[6])<<16;   /* fall through */
-    case 6 : b+=((PN_uint32)k8[5])<<8;    /* fall through */
+    case 7 : b+=((uint32_t)k8[6])<<16;   /* fall through */
+    case 6 : b+=((uint32_t)k8[5])<<8;    /* fall through */
     case 5 : b+=k8[4];                   /* fall through */
     case 5 : b+=k8[4];                   /* fall through */
     case 4 : a+=k[0]; break;
     case 4 : a+=k[0]; break;
-    case 3 : a+=((PN_uint32)k8[2])<<16;   /* fall through */
-    case 2 : a+=((PN_uint32)k8[1])<<8;    /* fall through */
+    case 3 : a+=((uint32_t)k8[2])<<16;   /* fall through */
+    case 2 : a+=((uint32_t)k8[1])<<8;    /* fall through */
     case 1 : a+=k8[0]; break;
     case 1 : a+=k8[0]; break;
     case 0 : *pc=c; *pb=b; return;  /* zero length strings require no mixing */
     case 0 : *pc=c; *pb=b; return;  /* zero length strings require no mixing */
     }
     }
@@ -487,45 +487,45 @@ void hashlittle2(
 #endif /* !valgrind */
 #endif /* !valgrind */
 
 
   } else if (HASH_LITTLE_ENDIAN && ((u.i & 0x1) == 0)) {
   } else if (HASH_LITTLE_ENDIAN && ((u.i & 0x1) == 0)) {
-    const PN_uint16 *k = (PN_uint16*)key;                           /* read 16-bit chunks */
-    const PN_uint8  *k8;
+    const uint16_t *k = (uint16_t*)key;                           /* read 16-bit chunks */
+    const uint8_t  *k8;
 
 
     /*--------------- all but last block: aligned reads and different mixing */
     /*--------------- all but last block: aligned reads and different mixing */
     while (length > 12)
     while (length > 12)
     {
     {
-      a += k[0] + (((PN_uint32)k[1])<<16);
-      b += k[2] + (((PN_uint32)k[3])<<16);
-      c += k[4] + (((PN_uint32)k[5])<<16);
+      a += k[0] + (((uint32_t)k[1])<<16);
+      b += k[2] + (((uint32_t)k[3])<<16);
+      c += k[4] + (((uint32_t)k[5])<<16);
       mix(a,b,c);
       mix(a,b,c);
       length -= 12;
       length -= 12;
       k += 6;
       k += 6;
     }
     }
 
 
     /*----------------------------- handle the last (probably partial) block */
     /*----------------------------- handle the last (probably partial) block */
-    k8 = (const PN_uint8 *)k;
+    k8 = (const uint8_t *)k;
     switch(length)
     switch(length)
     {
     {
-    case 12: c+=k[4]+(((PN_uint32)k[5])<<16);
-             b+=k[2]+(((PN_uint32)k[3])<<16);
-             a+=k[0]+(((PN_uint32)k[1])<<16);
+    case 12: c+=k[4]+(((uint32_t)k[5])<<16);
+             b+=k[2]+(((uint32_t)k[3])<<16);
+             a+=k[0]+(((uint32_t)k[1])<<16);
              break;
              break;
-    case 11: c+=((PN_uint32)k8[10])<<16;     /* fall through */
+    case 11: c+=((uint32_t)k8[10])<<16;     /* fall through */
     case 10: c+=k[4];
     case 10: c+=k[4];
-             b+=k[2]+(((PN_uint32)k[3])<<16);
-             a+=k[0]+(((PN_uint32)k[1])<<16);
+             b+=k[2]+(((uint32_t)k[3])<<16);
+             a+=k[0]+(((uint32_t)k[1])<<16);
              break;
              break;
     case 9 : c+=k8[8];                      /* fall through */
     case 9 : c+=k8[8];                      /* fall through */
-    case 8 : b+=k[2]+(((PN_uint32)k[3])<<16);
-             a+=k[0]+(((PN_uint32)k[1])<<16);
+    case 8 : b+=k[2]+(((uint32_t)k[3])<<16);
+             a+=k[0]+(((uint32_t)k[1])<<16);
              break;
              break;
-    case 7 : b+=((PN_uint32)k8[6])<<16;      /* fall through */
+    case 7 : b+=((uint32_t)k8[6])<<16;      /* fall through */
     case 6 : b+=k[2];
     case 6 : b+=k[2];
-             a+=k[0]+(((PN_uint32)k[1])<<16);
+             a+=k[0]+(((uint32_t)k[1])<<16);
              break;
              break;
     case 5 : b+=k8[4];                      /* fall through */
     case 5 : b+=k8[4];                      /* fall through */
-    case 4 : a+=k[0]+(((PN_uint32)k[1])<<16);
+    case 4 : a+=k[0]+(((uint32_t)k[1])<<16);
              break;
              break;
-    case 3 : a+=((PN_uint32)k8[2])<<16;      /* fall through */
+    case 3 : a+=((uint32_t)k8[2])<<16;      /* fall through */
     case 2 : a+=k[0];
     case 2 : a+=k[0];
              break;
              break;
     case 1 : a+=k8[0];
     case 1 : a+=k8[0];
@@ -534,23 +534,23 @@ void hashlittle2(
     }
     }
 
 
   } else {                        /* need to read the key one byte at a time */
   } else {                        /* need to read the key one byte at a time */
-    const PN_uint8 *k = (PN_uint8*)key;
+    const uint8_t *k = (uint8_t*)key;
 
 
     /*--------------- all but the last block: affect some 32 bits of (a,b,c) */
     /*--------------- all but the last block: affect some 32 bits of (a,b,c) */
     while (length > 12)
     while (length > 12)
     {
     {
       a += k[0];
       a += k[0];
-      a += ((PN_uint32)k[1])<<8;
-      a += ((PN_uint32)k[2])<<16;
-      a += ((PN_uint32)k[3])<<24;
+      a += ((uint32_t)k[1])<<8;
+      a += ((uint32_t)k[2])<<16;
+      a += ((uint32_t)k[3])<<24;
       b += k[4];
       b += k[4];
-      b += ((PN_uint32)k[5])<<8;
-      b += ((PN_uint32)k[6])<<16;
-      b += ((PN_uint32)k[7])<<24;
+      b += ((uint32_t)k[5])<<8;
+      b += ((uint32_t)k[6])<<16;
+      b += ((uint32_t)k[7])<<24;
       c += k[8];
       c += k[8];
-      c += ((PN_uint32)k[9])<<8;
-      c += ((PN_uint32)k[10])<<16;
-      c += ((PN_uint32)k[11])<<24;
+      c += ((uint32_t)k[9])<<8;
+      c += ((uint32_t)k[10])<<16;
+      c += ((uint32_t)k[11])<<24;
       mix(a,b,c);
       mix(a,b,c);
       length -= 12;
       length -= 12;
       k += 12;
       k += 12;
@@ -559,17 +559,17 @@ void hashlittle2(
     /*-------------------------------- last block: affect all 32 bits of (c) */
     /*-------------------------------- last block: affect all 32 bits of (c) */
     switch(length)                   /* all the case statements fall through */
     switch(length)                   /* all the case statements fall through */
     {
     {
-    case 12: c+=((PN_uint32)k[11])<<24;
-    case 11: c+=((PN_uint32)k[10])<<16;
-    case 10: c+=((PN_uint32)k[9])<<8;
+    case 12: c+=((uint32_t)k[11])<<24;
+    case 11: c+=((uint32_t)k[10])<<16;
+    case 10: c+=((uint32_t)k[9])<<8;
     case 9 : c+=k[8];
     case 9 : c+=k[8];
-    case 8 : b+=((PN_uint32)k[7])<<24;
-    case 7 : b+=((PN_uint32)k[6])<<16;
-    case 6 : b+=((PN_uint32)k[5])<<8;
+    case 8 : b+=((uint32_t)k[7])<<24;
+    case 7 : b+=((uint32_t)k[6])<<16;
+    case 6 : b+=((uint32_t)k[5])<<8;
     case 5 : b+=k[4];
     case 5 : b+=k[4];
-    case 4 : a+=((PN_uint32)k[3])<<24;
-    case 3 : a+=((PN_uint32)k[2])<<16;
-    case 2 : a+=((PN_uint32)k[1])<<8;
+    case 4 : a+=((uint32_t)k[3])<<24;
+    case 3 : a+=((uint32_t)k[2])<<16;
+    case 2 : a+=((uint32_t)k[1])<<8;
     case 1 : a+=k[0];
     case 1 : a+=k[0];
              break;
              break;
     case 0 : *pc=c; *pb=b; return;  /* zero length strings require no mixing */
     case 0 : *pc=c; *pb=b; return;  /* zero length strings require no mixing */
@@ -588,19 +588,19 @@ void hashlittle2(
  * from hashlittle() on all machines.  hashbig() takes advantage of
  * from hashlittle() on all machines.  hashbig() takes advantage of
  * big-endian byte ordering. 
  * big-endian byte ordering. 
  */
  */
-PN_uint32 hashbig( const void *key, size_t length, PN_uint32 initval)
+uint32_t hashbig( const void *key, size_t length, uint32_t initval)
 {
 {
-  PN_uint32 a,b,c;
+  uint32_t a,b,c;
   union { const void *ptr; size_t i; } u; /* to cast key to (size_t) happily */
   union { const void *ptr; size_t i; } u; /* to cast key to (size_t) happily */
 
 
   /* Set up the internal state */
   /* Set up the internal state */
-  a = b = c = 0xdeadbeef + ((PN_uint32)length) + initval;
+  a = b = c = 0xdeadbeef + ((uint32_t)length) + initval;
 
 
   u.ptr = key;
   u.ptr = key;
   if (HASH_BIG_ENDIAN && ((u.i & 0x3) == 0)) {
   if (HASH_BIG_ENDIAN && ((u.i & 0x3) == 0)) {
-    const PN_uint32 *k = (PN_uint32*)key;                           /* read 32-bit chunks */
+    const uint32_t *k = (uint32_t*)key;                           /* read 32-bit chunks */
 #ifdef VALGRIND
 #ifdef VALGRIND
-    const PN_uint8  *k8;
+    const uint8_t  *k8;
 #endif
 #endif
 
 
     /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
     /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
@@ -645,44 +645,44 @@ PN_uint32 hashbig( const void *key, size_t length, PN_uint32 initval)
 
 
 #else  /* make valgrind happy */
 #else  /* make valgrind happy */
 
 
-    k8 = (const PN_uint8 *)k;
+    k8 = (const uint8_t *)k;
     switch(length)                   /* all the case statements fall through */
     switch(length)                   /* all the case statements fall through */
     {
     {
     case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
     case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
-    case 11: c+=((PN_uint32)k8[10])<<8;  /* fall through */
-    case 10: c+=((PN_uint32)k8[9])<<16;  /* fall through */
-    case 9 : c+=((PN_uint32)k8[8])<<24;  /* fall through */
+    case 11: c+=((uint32_t)k8[10])<<8;  /* fall through */
+    case 10: c+=((uint32_t)k8[9])<<16;  /* fall through */
+    case 9 : c+=((uint32_t)k8[8])<<24;  /* fall through */
     case 8 : b+=k[1]; a+=k[0]; break;
     case 8 : b+=k[1]; a+=k[0]; break;
-    case 7 : b+=((PN_uint32)k8[6])<<8;   /* fall through */
-    case 6 : b+=((PN_uint32)k8[5])<<16;  /* fall through */
-    case 5 : b+=((PN_uint32)k8[4])<<24;  /* fall through */
+    case 7 : b+=((uint32_t)k8[6])<<8;   /* fall through */
+    case 6 : b+=((uint32_t)k8[5])<<16;  /* fall through */
+    case 5 : b+=((uint32_t)k8[4])<<24;  /* fall through */
     case 4 : a+=k[0]; break;
     case 4 : a+=k[0]; break;
-    case 3 : a+=((PN_uint32)k8[2])<<8;   /* fall through */
-    case 2 : a+=((PN_uint32)k8[1])<<16;  /* fall through */
-    case 1 : a+=((PN_uint32)k8[0])<<24; break;
+    case 3 : a+=((uint32_t)k8[2])<<8;   /* fall through */
+    case 2 : a+=((uint32_t)k8[1])<<16;  /* fall through */
+    case 1 : a+=((uint32_t)k8[0])<<24; break;
     case 0 : return c;
     case 0 : return c;
     }
     }
 
 
 #endif /* !VALGRIND */
 #endif /* !VALGRIND */
 
 
   } else {                        /* need to read the key one byte at a time */
   } else {                        /* need to read the key one byte at a time */
-    const PN_uint8 *k = (PN_uint8*)key;
+    const uint8_t *k = (uint8_t*)key;
 
 
     /*--------------- all but the last block: affect some 32 bits of (a,b,c) */
     /*--------------- all but the last block: affect some 32 bits of (a,b,c) */
     while (length > 12)
     while (length > 12)
     {
     {
-      a += ((PN_uint32)k[0])<<24;
-      a += ((PN_uint32)k[1])<<16;
-      a += ((PN_uint32)k[2])<<8;
-      a += ((PN_uint32)k[3]);
-      b += ((PN_uint32)k[4])<<24;
-      b += ((PN_uint32)k[5])<<16;
-      b += ((PN_uint32)k[6])<<8;
-      b += ((PN_uint32)k[7]);
-      c += ((PN_uint32)k[8])<<24;
-      c += ((PN_uint32)k[9])<<16;
-      c += ((PN_uint32)k[10])<<8;
-      c += ((PN_uint32)k[11]);
+      a += ((uint32_t)k[0])<<24;
+      a += ((uint32_t)k[1])<<16;
+      a += ((uint32_t)k[2])<<8;
+      a += ((uint32_t)k[3]);
+      b += ((uint32_t)k[4])<<24;
+      b += ((uint32_t)k[5])<<16;
+      b += ((uint32_t)k[6])<<8;
+      b += ((uint32_t)k[7]);
+      c += ((uint32_t)k[8])<<24;
+      c += ((uint32_t)k[9])<<16;
+      c += ((uint32_t)k[10])<<8;
+      c += ((uint32_t)k[11]);
       mix(a,b,c);
       mix(a,b,c);
       length -= 12;
       length -= 12;
       k += 12;
       k += 12;
@@ -692,17 +692,17 @@ PN_uint32 hashbig( const void *key, size_t length, PN_uint32 initval)
     switch(length)                   /* all the case statements fall through */
     switch(length)                   /* all the case statements fall through */
     {
     {
     case 12: c+=k[11];
     case 12: c+=k[11];
-    case 11: c+=((PN_uint32)k[10])<<8;
-    case 10: c+=((PN_uint32)k[9])<<16;
-    case 9 : c+=((PN_uint32)k[8])<<24;
+    case 11: c+=((uint32_t)k[10])<<8;
+    case 10: c+=((uint32_t)k[9])<<16;
+    case 9 : c+=((uint32_t)k[8])<<24;
     case 8 : b+=k[7];
     case 8 : b+=k[7];
-    case 7 : b+=((PN_uint32)k[6])<<8;
-    case 6 : b+=((PN_uint32)k[5])<<16;
-    case 5 : b+=((PN_uint32)k[4])<<24;
+    case 7 : b+=((uint32_t)k[6])<<8;
+    case 6 : b+=((uint32_t)k[5])<<16;
+    case 5 : b+=((uint32_t)k[4])<<24;
     case 4 : a+=k[3];
     case 4 : a+=k[3];
-    case 3 : a+=((PN_uint32)k[2])<<8;
-    case 2 : a+=((PN_uint32)k[1])<<16;
-    case 1 : a+=((PN_uint32)k[0])<<24;
+    case 3 : a+=((uint32_t)k[2])<<8;
+    case 2 : a+=((uint32_t)k[1])<<16;
+    case 1 : a+=((uint32_t)k[0])<<24;
              break;
              break;
     case 0 : return c;
     case 0 : return c;
     }
     }
@@ -718,9 +718,9 @@ PN_uint32 hashbig( const void *key, size_t length, PN_uint32 initval)
 /* used for timings */
 /* used for timings */
 void driver1()
 void driver1()
 {
 {
-  PN_uint8 buf[256];
-  PN_uint32 i;
-  PN_uint32 h=0;
+  uint8_t buf[256];
+  uint32_t i;
+  uint32_t h=0;
   time_t a,z;
   time_t a,z;
 
 
   time(&a);
   time(&a);
@@ -740,11 +740,11 @@ void driver1()
 #define MAXLEN  70
 #define MAXLEN  70
 void driver2()
 void driver2()
 {
 {
-  PN_uint8 qa[MAXLEN+1], qb[MAXLEN+2], *a = &qa[0], *b = &qb[1];
-  PN_uint32 c[HASHSTATE], d[HASHSTATE], i=0, j=0, k, l, m=0, z;
-  PN_uint32 e[HASHSTATE],f[HASHSTATE],g[HASHSTATE],h[HASHSTATE];
-  PN_uint32 x[HASHSTATE],y[HASHSTATE];
-  PN_uint32 hlen;
+  uint8_t qa[MAXLEN+1], qb[MAXLEN+2], *a = &qa[0], *b = &qb[1];
+  uint32_t c[HASHSTATE], d[HASHSTATE], i=0, j=0, k, l, m=0, z;
+  uint32_t e[HASHSTATE],f[HASHSTATE],g[HASHSTATE],h[HASHSTATE];
+  uint32_t x[HASHSTATE],y[HASHSTATE];
+  uint32_t hlen;
 
 
   printf("No more than %d trials should ever be needed \n",MAXPAIR/2);
   printf("No more than %d trials should ever be needed \n",MAXPAIR/2);
   for (hlen=0; hlen < MAXLEN; ++hlen)
   for (hlen=0; hlen < MAXLEN; ++hlen)
@@ -757,14 +757,14 @@ void driver2()
 	for (m=1; m<8; ++m) /*------------ for serveral possible initvals, */
 	for (m=1; m<8; ++m) /*------------ for serveral possible initvals, */
 	{
 	{
 	  for (l=0; l<HASHSTATE; ++l)
 	  for (l=0; l<HASHSTATE; ++l)
-	    e[l]=f[l]=g[l]=h[l]=x[l]=y[l]=~((PN_uint32)0);
+	    e[l]=f[l]=g[l]=h[l]=x[l]=y[l]=~((uint32_t)0);
 
 
       	  /*---- check that every output bit is affected by that input bit */
       	  /*---- check that every output bit is affected by that input bit */
 	  for (k=0; k<MAXPAIR; k+=2)
 	  for (k=0; k<MAXPAIR; k+=2)
 	  { 
 	  { 
-	    PN_uint32 finished=1;
+	    uint32_t finished=1;
 	    /* keys have one bit different */
 	    /* keys have one bit different */
-	    for (l=0; l<hlen+1; ++l) {a[l] = b[l] = (PN_uint8)0;}
+	    for (l=0; l<hlen+1; ++l) {a[l] = b[l] = (uint8_t)0;}
 	    /* have a and b be two keys differing in only one bit */
 	    /* have a and b be two keys differing in only one bit */
 	    a[i] ^= (k<<j);
 	    a[i] ^= (k<<j);
 	    a[i] ^= (k>>(8-j));
 	    a[i] ^= (k>>(8-j));
@@ -810,23 +810,23 @@ void driver2()
 /* Check for reading beyond the end of the buffer and alignment problems */
 /* Check for reading beyond the end of the buffer and alignment problems */
 void driver3()
 void driver3()
 {
 {
-  PN_uint8 buf[MAXLEN+20], *b;
-  PN_uint32 len;
-  PN_uint8 q[] = "This is the time for all good men to come to the aid of their country...";
-  PN_uint32 h;
-  PN_uint8 qq[] = "xThis is the time for all good men to come to the aid of their country...";
-  PN_uint32 i;
-  PN_uint8 qqq[] = "xxThis is the time for all good men to come to the aid of their country...";
-  PN_uint32 j;
-  PN_uint8 qqqq[] = "xxxThis is the time for all good men to come to the aid of their country...";
-  PN_uint32 ref,x,y;
-  PN_uint8 *p;
+  uint8_t buf[MAXLEN+20], *b;
+  uint32_t len;
+  uint8_t q[] = "This is the time for all good men to come to the aid of their country...";
+  uint32_t h;
+  uint8_t qq[] = "xThis is the time for all good men to come to the aid of their country...";
+  uint32_t i;
+  uint8_t qqq[] = "xxThis is the time for all good men to come to the aid of their country...";
+  uint32_t j;
+  uint8_t qqqq[] = "xxxThis is the time for all good men to come to the aid of their country...";
+  uint32_t ref,x,y;
+  uint8_t *p;
 
 
   printf("Endianness.  These lines should all be the same (for values filled in):\n");
   printf("Endianness.  These lines should all be the same (for values filled in):\n");
   printf("%.8x                            %.8x                            %.8x\n",
   printf("%.8x                            %.8x                            %.8x\n",
-         hashword((const PN_uint32 *)q, (sizeof(q)-1)/4, 13),
-         hashword((const PN_uint32 *)q, (sizeof(q)-5)/4, 13),
-         hashword((const PN_uint32 *)q, (sizeof(q)-9)/4, 13));
+         hashword((const uint32_t *)q, (sizeof(q)-1)/4, 13),
+         hashword((const uint32_t *)q, (sizeof(q)-5)/4, 13),
+         hashword((const uint32_t *)q, (sizeof(q)-9)/4, 13));
   p = q;
   p = q;
   printf("%.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x\n",
   printf("%.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x\n",
          hashlittle(p, sizeof(q)-1, 13), hashlittle(p, sizeof(q)-2, 13),
          hashlittle(p, sizeof(q)-1, 13), hashlittle(p, sizeof(q)-2, 13),
@@ -868,11 +868,11 @@ void driver3()
       for (j=0; j<i; ++j) *(b+j)=0;
       for (j=0; j<i; ++j) *(b+j)=0;
 
 
       /* these should all be equal */
       /* these should all be equal */
-      ref = hashlittle(b, len, (PN_uint32)1);
-      *(b+i)=(PN_uint8)~0;
-      *(b-1)=(PN_uint8)~0;
-      x = hashlittle(b, len, (PN_uint32)1);
-      y = hashlittle(b, len, (PN_uint32)1);
+      ref = hashlittle(b, len, (uint32_t)1);
+      *(b+i)=(uint8_t)~0;
+      *(b-1)=(uint8_t)~0;
+      x = hashlittle(b, len, (uint32_t)1);
+      y = hashlittle(b, len, (uint32_t)1);
       if ((ref != x) || (ref != y)) 
       if ((ref != x) || (ref != y)) 
       {
       {
 	printf("alignment error: %.8x %.8x %.8x %d %d\n",ref,x,y,
 	printf("alignment error: %.8x %.8x %.8x %d %d\n",ref,x,y,
@@ -885,8 +885,8 @@ void driver3()
 /* check for problems with nulls */
 /* check for problems with nulls */
  void driver4()
  void driver4()
 {
 {
-  PN_uint8 buf[1];
-  PN_uint32 h,i,state[HASHSTATE];
+  uint8_t buf[1];
+  uint32_t h,i,state[HASHSTATE];
 
 
 
 
   buf[0] = ~0;
   buf[0] = ~0;

+ 3 - 3
dtool/src/dtoolbase/lookup3.h

@@ -21,9 +21,9 @@
 extern "C" {
 extern "C" {
 #endif
 #endif
 
 
-EXPCL_DTOOL PN_uint32 hashword(const PN_uint32 *k,                   /* the key, an array of PN_uint32 values */
-                               size_t          length,               /* the length of the key, in PN_uint32s */
-                               PN_uint32        initval);
+EXPCL_DTOOL uint32_t hashword(const uint32_t *k,                   /* the key, an array of uint32_t values */
+                               size_t          length,               /* the length of the key, in uint32_ts */
+                               uint32_t        initval);
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus
 };  /* end of extern "C" */
 };  /* end of extern "C" */

+ 7 - 4
dtool/src/dtoolbase/memoryHook.cxx

@@ -43,16 +43,19 @@
 // fast, but it is not thread-safe.  However, we provide thread locking within
 // fast, but it is not thread-safe.  However, we provide thread locking within
 // MemoryHook.
 // MemoryHook.
 
 
+#define DLMALLOC_EXPORT static
 #define USE_DL_PREFIX 1
 #define USE_DL_PREFIX 1
 #define NO_MALLINFO 1
 #define NO_MALLINFO 1
 #ifdef _DEBUG
 #ifdef _DEBUG
   #define DEBUG 1
   #define DEBUG 1
 #endif
 #endif
-#ifdef assert
-  // dlmalloc defines its own assert, which clashes.
-  #undef assert
+#ifdef LINMATH_ALIGN
+// drose: We require 16-byte alignment of certain structures, to
+// support SSE2.  We don't strictly have to align *everything*, but
+// it's just easier to do so.
+#define MALLOC_ALIGNMENT ((size_t)16U)
 #endif
 #endif
-#include "dlmalloc.h"
+
 #include "dlmalloc_src.cxx"
 #include "dlmalloc_src.cxx"
 
 
 #define call_malloc dlmalloc
 #define call_malloc dlmalloc

+ 1 - 24
dtool/src/dtoolbase/numeric_types.h

@@ -19,30 +19,7 @@
 // This header file defines a number of typedefs that correspond to the
 // This header file defines a number of typedefs that correspond to the
 // various numeric types for unsigned and signed numbers of various widths.
 // various numeric types for unsigned and signed numbers of various widths.
 
 
-#if defined(WIN32_VC) && !defined(CPPPARSER)
-typedef signed __int8  PN_int8;
-typedef signed __int16 PN_int16;
-typedef signed __int32 PN_int32;
-typedef signed __int64 PN_int64;
-
-typedef unsigned __int8  PN_uint8;
-typedef unsigned __int16 PN_uint16;
-typedef unsigned __int32 PN_uint32;
-typedef unsigned __int64 PN_uint64;
-
-#else
-
-typedef signed char PN_int8;
-typedef short int PN_int16;
-typedef int PN_int32;
-typedef long long int PN_int64;
-
-typedef unsigned char PN_uint8;
-typedef unsigned short int PN_uint16;
-typedef unsigned int PN_uint32;
-typedef unsigned long long int PN_uint64;
-
-#endif
+#include <stdint.h>
 
 
 typedef double PN_float64;
 typedef double PN_float64;
 typedef float PN_float32;
 typedef float PN_float32;

+ 1 - 1
dtool/src/dtoolbase/pallocator.h

@@ -32,7 +32,7 @@
  * can allocate arrays of objects.
  * can allocate arrays of objects.
  */
  */
 
 
-#ifndef USE_STL_ALLOCATOR
+#if !defined(USE_STL_ALLOCATOR) || defined(CPPPARSER)
 // If we're not trying to make custom allocators (either we don't know what
 // 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),
 // kind of syntax this STL library wants, or we're compiling with OPTIMIZE 4),
 // then simply use the standard allocator.
 // then simply use the standard allocator.

+ 1 - 1
dtool/src/dtoolbase/pdeque.h

@@ -19,7 +19,7 @@
 #include "register_type.h"
 #include "register_type.h"
 #include <deque>
 #include <deque>
 
 
-#ifndef USE_STL_ALLOCATOR
+#if !defined(USE_STL_ALLOCATOR) || defined(CPPPARSER)
 // If we're not using custom allocators, just use the standard class
 // If we're not using custom allocators, just use the standard class
 // definition.
 // definition.
 #define pdeque deque
 #define pdeque deque

+ 1 - 1
dtool/src/dtoolbase/pdtoa.cxx

@@ -250,7 +250,7 @@ inline static unsigned CountDecimalDigit32(uint32_t n) {
 }
 }
 
 
 inline static void DigitGen(const DiyFp& W, const DiyFp& Mp, uint64_t delta, char* buffer, int* len, int* K) {
 inline static void DigitGen(const DiyFp& W, const DiyFp& Mp, uint64_t delta, char* buffer, int* len, int* K) {
-  static const uint32_t kPow10[] = { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000 };
+  static const uint32_t kPow10[] = { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, 0, 0, 0, 0, 0 };
   const DiyFp one(uint64_t(1) << -Mp.e, Mp.e);
   const DiyFp one(uint64_t(1) << -Mp.e, Mp.e);
   const DiyFp wp_w = Mp - W;
   const DiyFp wp_w = Mp - W;
   uint32_t p1 = static_cast<uint32_t>(Mp.f >> -one.e);
   uint32_t p1 = static_cast<uint32_t>(Mp.f >> -one.e);

+ 1 - 1
dtool/src/dtoolbase/plist.h

@@ -19,7 +19,7 @@
 #include "register_type.h"
 #include "register_type.h"
 #include <list>
 #include <list>
 
 
-#ifndef USE_STL_ALLOCATOR
+#if !defined(USE_STL_ALLOCATOR) || defined(CPPPARSER)
 // If we're not using custom allocators, just use the standard class
 // If we're not using custom allocators, just use the standard class
 // definition.
 // definition.
 #define plist list
 #define plist list

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

@@ -24,7 +24,7 @@
 #include <hash_map>
 #include <hash_map>
 #endif
 #endif
 
 
-#ifndef USE_STL_ALLOCATOR
+#if !defined(USE_STL_ALLOCATOR) || defined(CPPPARSER)
 // If we're not using custom allocators, just use the standard class
 // If we're not using custom allocators, just use the standard class
 // definition.
 // definition.
 #define pmap map
 #define pmap map

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

@@ -24,7 +24,7 @@
 #include <hash_set>
 #include <hash_set>
 #endif
 #endif
 
 
-#ifndef USE_STL_ALLOCATOR
+#if !defined(USE_STL_ALLOCATOR) || defined(CPPPARSER)
 // If we're not using custom allocators, just use the standard class
 // If we're not using custom allocators, just use the standard class
 // definition.
 // definition.
 #define pset set
 #define pset set

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

@@ -25,6 +25,12 @@
 // definition.
 // definition.
 #define pvector vector
 #define pvector vector
 
 
+#elif defined(CPPPARSER)
+// Simplified definition to speed up Interrogate parsing.
+template<class Type>
+class pvector : public vector<Type> {
+};
+
 #else
 #else
 
 
 /**
 /**

+ 4 - 4
dtool/src/dtoolbase/stl_compares.I

@@ -99,7 +99,7 @@ is_equal(const Key &a, const Key &b) const {
 template<class Key, class Compare>
 template<class Key, class Compare>
 INLINE size_t integer_hash<Key, Compare>::
 INLINE size_t integer_hash<Key, Compare>::
 add_hash(size_t hash, const Key &key) {
 add_hash(size_t hash, const Key &key) {
-  PN_uint32 key32 = (PN_uint32)(key);
+  uint32_t key32 = (uint32_t)(key);
   return AddHash::add_hash(hash, &key32, 1);
   return AddHash::add_hash(hash, &key32, 1);
 }
 }
 
 
@@ -109,7 +109,7 @@ add_hash(size_t hash, const Key &key) {
 INLINE size_t pointer_hash::
 INLINE size_t pointer_hash::
 add_hash(size_t hash, const void *key) {
 add_hash(size_t hash, const void *key) {
   // We don't mind if this loses precision.
   // We don't mind if this loses precision.
-  PN_uint32 key32 = (PN_uint32)reinterpret_cast<uintptr_t>(key);
+  uint32_t key32 = (uint32_t)reinterpret_cast<uintptr_t>(key);
   return AddHash::add_hash(hash, &key32, 1);
   return AddHash::add_hash(hash, &key32, 1);
 }
 }
 
 
@@ -147,7 +147,7 @@ operator () (const Key &a, const Key &b) const {
 template<class Key>
 template<class Key>
 INLINE size_t floating_point_hash<Key>::
 INLINE size_t floating_point_hash<Key>::
 add_hash(size_t hash, const Key &key) const {
 add_hash(size_t hash, const Key &key) const {
-  PN_uint32 key32 = (PN_uint32)(key / _threshold + 0.5f);
+  uint32_t key32 = (uint32_t)(key / _threshold + 0.5f);
   return AddHash::add_hash(hash, &key32, 1);
   return AddHash::add_hash(hash, &key32, 1);
 }
 }
 
 
@@ -173,7 +173,7 @@ add_hash(size_t hash, const Key &key) {
   }
   }
 #endif
 #endif
   size_t num_bytes = (key.size() * sizeof(key[0]));
   size_t num_bytes = (key.size() * sizeof(key[0]));
-  return AddHash::add_hash(hash, (const PN_uint8 *)&key[0], num_bytes);
+  return AddHash::add_hash(hash, (const uint8_t *)&key[0], num_bytes);
 }
 }
 
 
 /**
 /**

+ 2 - 0
dtool/src/dtoolbase/typeHandle.h

@@ -114,6 +114,8 @@ PUBLISHED:
 
 
   MAKE_PROPERTY(index, get_index);
   MAKE_PROPERTY(index, get_index);
   MAKE_PROPERTY(name, get_name);
   MAKE_PROPERTY(name, get_name);
+  MAKE_SEQ_PROPERTY(parent_classes, get_num_parent_classes, get_parent_class);
+  MAKE_SEQ_PROPERTY(child_classes, get_num_child_classes, get_child_class);
 
 
 public:
 public:
   INLINE static TypeHandle from_index(int index);
   INLINE static TypeHandle from_index(int index);

+ 4 - 4
dtool/src/dtoolbase/typeRegistry.cxx

@@ -511,10 +511,10 @@ TypeRegistry() {
   // Here's a few sanity checks on the sizes of our words.  We have to put it
   // Here's a few sanity checks on the sizes of our words.  We have to put it
   // here, at runtime, since there doesn't appear to be a cross-platform
   // here, at runtime, since there doesn't appear to be a cross-platform
   // compile-time way to verify that we've chosen the right word sizes.
   // compile-time way to verify that we've chosen the right word sizes.
-  assert(sizeof(PN_uint8) == 1 && sizeof(PN_int8) == 1);
-  assert(sizeof(PN_uint16) == 2 && sizeof(PN_int16) == 2);
-  assert(sizeof(PN_uint32) == 4 && sizeof(PN_int32) == 4);
-  assert(sizeof(PN_uint64) == 8 && sizeof(PN_int64) == 8);
+  assert(sizeof(uint8_t) == 1 && sizeof(int8_t) == 1);
+  assert(sizeof(uint16_t) == 2 && sizeof(int16_t) == 2);
+  assert(sizeof(uint32_t) == 4 && sizeof(int32_t) == 4);
+  assert(sizeof(uint64_t) == 8 && sizeof(int64_t) == 8);
 
 
   assert(sizeof(PN_float32) == 4);
   assert(sizeof(PN_float32) == 4);
   assert(sizeof(PN_float64) == 8);
   assert(sizeof(PN_float64) == 8);

+ 3 - 0
dtool/src/dtoolbase/typeRegistry.h

@@ -79,6 +79,9 @@ PUBLISHED:
   // ptr() returns the pointer to the global TypeRegistry object.
   // ptr() returns the pointer to the global TypeRegistry object.
   static TypeRegistry *ptr();
   static TypeRegistry *ptr();
 
 
+  MAKE_SEQ_PROPERTY(typehandles, get_num_typehandles, get_typehandle);
+  MAKE_SEQ_PROPERTY(root_classes, get_num_root_classes, get_root_class);
+
 private:
 private:
   // The TypeRegistry class should never be constructed by user code.  There
   // The TypeRegistry class should never be constructed by user code.  There
   // is only one in the universe, and it constructs itself!
   // is only one in the universe, and it constructs itself!

+ 1 - 0
dtool/src/dtoolutil/dSearchPath.h

@@ -71,6 +71,7 @@ PUBLISHED:
   size_t get_num_directories() const;
   size_t get_num_directories() const;
   const Filename &get_directory(size_t n) const;
   const Filename &get_directory(size_t n) const;
   MAKE_SEQ(get_directories, get_num_directories, get_directory);
   MAKE_SEQ(get_directories, get_num_directories, get_directory);
+  MAKE_SEQ_PROPERTY(directories, get_num_directories, get_directory);
 
 
   Filename find_file(const Filename &filename) const;
   Filename find_file(const Filename &filename) const;
   size_t find_all_files(const Filename &filename, Results &results) const;
   size_t find_all_files(const Filename &filename, Results &results) const;

+ 5 - 1
dtool/src/dtoolutil/filename.cxx

@@ -443,7 +443,11 @@ temporary(const string &dirname, const string &prefix, const string &suffix,
     // generate a 6-character hex code.
     // generate a 6-character hex code.
     int hash = (clock() * time(NULL)) & 0xffffff;
     int hash = (clock() * time(NULL)) & 0xffffff;
     char hex_code[10];
     char hex_code[10];
-    sprintf(hex_code, "%06x", hash);
+#ifdef _WIN32
+    sprintf_s(hex_code, 10, "%06x", hash);
+#else
+    snprintf(hex_code, 10, "%06x", hash);
+#endif
     result = Filename(fdirname, Filename(prefix + hex_code + suffix));
     result = Filename(fdirname, Filename(prefix + hex_code + suffix));
     result.set_type(type);
     result.set_type(type);
   } while (result.exists());
   } while (result.exists());

+ 1 - 0
dtool/src/dtoolutil/pandaSystem.h

@@ -50,6 +50,7 @@ PUBLISHED:
   size_t get_num_systems() const;
   size_t get_num_systems() const;
   string get_system(size_t n) const;
   string get_system(size_t n) const;
   MAKE_SEQ(get_systems, get_num_systems, get_system);
   MAKE_SEQ(get_systems, get_num_systems, get_system);
+  MAKE_SEQ_PROPERTY(systems, get_num_systems, get_system);
 
 
   string get_system_tag(const string &system, const string &tag) const;
   string get_system_tag(const string &system, const string &tag) const;
 
 

+ 2 - 2
dtool/src/dtoolutil/string_utils.I

@@ -80,13 +80,13 @@ format_string(int value) {
 }
 }
 
 
 INLINE string
 INLINE string
-format_string(PN_int64 value) {
+format_string(int64_t value) {
   char buffer[21];
   char buffer[21];
   char *p = buffer + 20;
   char *p = buffer + 20;
   *p = 0;
   *p = 0;
 
 
   if (value < 0) {
   if (value < 0) {
-    PN_uint64 posv = (PN_uint64)-value;
+    uint64_t posv = (uint64_t)-value;
     do {
     do {
       *--p = '0' + (posv % 10);
       *--p = '0' + (posv % 10);
       posv /= 10;
       posv /= 10;

+ 1 - 1
dtool/src/dtoolutil/string_utils.h

@@ -73,7 +73,7 @@ INLINE string format_string(float value);
 INLINE string format_string(double value);
 INLINE string format_string(double value);
 INLINE string format_string(unsigned int value);
 INLINE string format_string(unsigned int value);
 INLINE string format_string(int value);
 INLINE string format_string(int value);
-INLINE string format_string(PN_int64 value);
+INLINE string format_string(int64_t value);
 
 
 #include "string_utils.I"
 #include "string_utils.I"
 
 

+ 17 - 2
dtool/src/interrogate/interfaceMaker.cxx

@@ -86,10 +86,12 @@ MakeSeq(const string &name, const InterrogateMakeSeq &imake_seq) :
 InterfaceMaker::Property::
 InterfaceMaker::Property::
 Property(const InterrogateElement &ielement) :
 Property(const InterrogateElement &ielement) :
   _ielement(ielement),
   _ielement(ielement),
+  _length_function(NULL),
   _getter(NULL),
   _getter(NULL),
   _setter(NULL),
   _setter(NULL),
   _has_function(NULL),
   _has_function(NULL),
-  _clear_function(NULL)
+  _clear_function(NULL),
+  _deleter(NULL)
 {
 {
 }
 }
 
 
@@ -131,7 +133,8 @@ check_protocols() {
     if (func->_ifunc.get_name() == "__traverse__") {
     if (func->_ifunc.get_name() == "__traverse__") {
       // If we have a method named __traverse__, we implement Python's cyclic
       // If we have a method named __traverse__, we implement Python's cyclic
       // garbage collection protocol.
       // garbage collection protocol.
-      _protocol_types |= PT_python_gc;
+      //XXX disabled for now because it's too unstable.
+      //_protocol_types |= PT_python_gc;
     }
     }
   }
   }
 
 
@@ -359,6 +362,18 @@ remap_parameter(CPPType *struct_type, CPPType *param_type) {
         }
         }
       }
       }
     }
     }
+    if (struct_type == (CPPType *)NULL ||
+        !TypeManager::is_vector_unsigned_char(struct_type)) {
+      if (TypeManager::is_vector_unsigned_char(param_type)) {
+        if (TypeManager::is_reference(param_type)) {
+          return new ParameterRemapReferenceToConcrete(param_type);
+        } else if (TypeManager::is_const(param_type)) {
+          return new ParameterRemapConstToNonConst(param_type);
+        } else {
+          return new ParameterRemapUnchanged(param_type);
+        }
+      }
+    }
   }
   }
 
 
   if (manage_reference_counts) {
   if (manage_reference_counts) {

+ 2 - 0
dtool/src/interrogate/interfaceMaker.h

@@ -126,10 +126,12 @@ public:
     Property(const InterrogateElement &ielement);
     Property(const InterrogateElement &ielement);
 
 
     const InterrogateElement &_ielement;
     const InterrogateElement &_ielement;
+    Function *_length_function;
     Function *_getter;
     Function *_getter;
     Function *_setter;
     Function *_setter;
     Function *_has_function;
     Function *_has_function;
     Function *_clear_function;
     Function *_clear_function;
+    Function *_deleter;
   };
   };
   typedef vector<Property *> Properties;
   typedef vector<Property *> Properties;
 
 

File diff suppressed because it is too large
+ 391 - 288
dtool/src/interrogate/interfaceMakerPythonNative.cxx


+ 4 - 1
dtool/src/interrogate/interfaceMakerPythonNative.h

@@ -101,6 +101,9 @@ private:
     // Assign to the coerced argument, in the case of a coercion constructor.
     // Assign to the coerced argument, in the case of a coercion constructor.
     RF_coerced = 0x040,
     RF_coerced = 0x040,
 
 
+    // Don't automatically map NULL to None
+    RF_preserve_null = 0x080,
+
     // These indicate what should be returned on error.
     // These indicate what should be returned on error.
     RF_err_notimplemented = 0x002,
     RF_err_notimplemented = 0x002,
     RF_err_null = 0x004,
     RF_err_null = 0x004,
@@ -164,7 +167,7 @@ private:
                           const string &exc_type, const string &message,
                           const string &exc_type, const string &message,
                           const string &format_args = "");
                           const string &format_args = "");
   void pack_return_value(ostream &out, int indent_level, FunctionRemap *remap,
   void pack_return_value(ostream &out, int indent_level, FunctionRemap *remap,
-                         std::string return_expr);
+                         std::string return_expr, int return_flags);
 
 
   void write_make_seq(ostream &out, Object *obj, const std::string &ClassName,
   void write_make_seq(ostream &out, Object *obj, const std::string &ClassName,
                       const std::string &cClassName, MakeSeq *make_seq);
                       const std::string &cClassName, MakeSeq *make_seq);

+ 92 - 21
dtool/src/interrogate/interrogateBuilder.cxx

@@ -1167,8 +1167,10 @@ scan_typedef_type(CPPTypedefType *type) {
     return;
     return;
   }
   }
 
 
-  // A typedef cannot be a template declaration.
-  assert(!type->is_template());
+  if (type->is_template()) {
+    // The type is a template declaration, not a true type.
+    return;
+  }
 
 
   if (type->_file.is_c_file()) {
   if (type->_file.is_c_file()) {
     // This type declaration appears in a .C file.  We can only export types
     // This type declaration appears in a .C file.  We can only export types
@@ -1782,9 +1784,9 @@ get_function(CPPInstance *function, string description,
 }
 }
 
 
 /**
 /**
- * Adds the indicated make_property to the database, if it is not already
- * present.  In either case, returns the MakeSeqIndex of the make_seq within
- * the database.
+ * Adds the indicated make_property or make_seq_property to the database, if
+ * it is not already present.  In either case, returns the ElementIndex
+ * of the created property within the database.
  */
  */
 ElementIndex InterrogateBuilder::
 ElementIndex InterrogateBuilder::
 get_make_property(CPPMakeProperty *make_property, CPPStructType *struct_type, CPPScope *scope) {
 get_make_property(CPPMakeProperty *make_property, CPPStructType *struct_type, CPPScope *scope) {
@@ -1805,20 +1807,58 @@ get_make_property(CPPMakeProperty *make_property, CPPStructType *struct_type, CP
     return index;
     return index;
   }
   }
 
 
+  // If we have a length function (ie. this is a sequence property), we should
+  // find the function that will give us the length.
+  FunctionIndex length_function = 0;
+  bool is_seq = false;
+
+  CPPFunctionGroup::Instances::const_iterator fi;
+  CPPFunctionGroup *fgroup = make_property->_length_function;
+  if (fgroup != NULL) {
+    is_seq = true;
+
+    for (fi = fgroup->_instances.begin(); fi != fgroup->_instances.end(); ++fi) {
+      CPPInstance *function = (*fi);
+      CPPFunctionType *ftype =
+        function->_type->as_function_type();
+      if (ftype != NULL) {
+        length_function = get_function(function, "", struct_type,
+                                       struct_type->get_scope(), 0);
+        if (length_function != 0) {
+          break;
+        }
+      }
+    }
+    if (length_function == 0) {
+      cerr << "No instance of length method '"
+           << fgroup->_name << "' is suitable!\n";
+      return 0;
+    }
+  }
+
   // Find the getter so we can get its return type.
   // Find the getter so we can get its return type.
   CPPInstance *getter = NULL;
   CPPInstance *getter = NULL;
   CPPType *return_type = NULL;
   CPPType *return_type = NULL;
 
 
-  CPPFunctionGroup *fgroup = make_property->_get_function;
+  fgroup = make_property->_get_function;
   if (fgroup != NULL) {
   if (fgroup != NULL) {
     CPPFunctionGroup::Instances::const_iterator fi;
     CPPFunctionGroup::Instances::const_iterator fi;
     for (fi = fgroup->_instances.begin(); fi != fgroup->_instances.end(); ++fi) {
     for (fi = fgroup->_instances.begin(); fi != fgroup->_instances.end(); ++fi) {
       CPPInstance *function = (*fi);
       CPPInstance *function = (*fi);
       CPPFunctionType *ftype = function->_type->as_function_type();
       CPPFunctionType *ftype = function->_type->as_function_type();
+      if (ftype == NULL) {
+        continue;
+      }
 
 
       // The getter must either take no arguments, or all defaults.
       // The getter must either take no arguments, or all defaults.
-      if (ftype != NULL && (ftype->_parameters->_parameters.size() == 0 ||
-          ftype->_parameters->_parameters[0]->_initializer != NULL)) {
+      if (ftype->_parameters->_parameters.size() == (int)is_seq ||
+          (ftype->_parameters->_parameters.size() > (int)is_seq &&
+           ftype->_parameters->_parameters[(int)is_seq]->_initializer != NULL)) {
+        // If this is a sequence getter, it must take an index argument.
+        if (is_seq && !TypeManager::is_integer(ftype->_parameters->_parameters[0]->_type)) {
+          continue;
+        }
+
         getter = function;
         getter = function;
         return_type = ftype->_return_type;
         return_type = ftype->_return_type;
 
 
@@ -1860,6 +1900,28 @@ get_make_property(CPPMakeProperty *make_property, CPPStructType *struct_type, CP
     }
     }
   }
   }
 
 
+  // And the "deleter".
+  CPPInstance *deleter = NULL;
+
+  fgroup = make_property->_del_function;
+  if (fgroup != NULL) {
+    CPPFunctionGroup::Instances::const_iterator fi;
+    for (fi = fgroup->_instances.begin(); fi != fgroup->_instances.end(); ++fi) {
+      CPPInstance *function = (*fi);
+      CPPFunctionType *ftype = function->_type->as_function_type();
+      if (ftype != NULL && ftype->_parameters->_parameters.size() == (int)is_seq) {
+        deleter = function;
+        break;
+      }
+    }
+
+    if (deleter == NULL || return_type == NULL) {
+      cerr << "No instance of delete-function '"
+           << fgroup->_name << "' is suitable!\n";
+      return 0;
+    }
+  }
+
   InterrogateDatabase *idb = InterrogateDatabase::get_ptr();
   InterrogateDatabase *idb = InterrogateDatabase::get_ptr();
   // It isn't here, so we'll have to define it.
   // It isn't here, so we'll have to define it.
   ElementIndex index = idb->get_next_index();
   ElementIndex index = idb->get_next_index();
@@ -1875,22 +1937,30 @@ get_make_property(CPPMakeProperty *make_property, CPPStructType *struct_type, CP
     iproperty._type = 0;
     iproperty._type = 0;
   }
   }
 
 
+  if (length_function != 0) {
+    iproperty._flags |= InterrogateElement::F_sequence;
+    iproperty._length_function = length_function;
+  }
+
   if (getter != NULL) {
   if (getter != NULL) {
     iproperty._flags |= InterrogateElement::F_has_getter;
     iproperty._flags |= InterrogateElement::F_has_getter;
     iproperty._getter = get_function(getter, "", struct_type,
     iproperty._getter = get_function(getter, "", struct_type,
                                      struct_type->get_scope(), 0);
                                      struct_type->get_scope(), 0);
-    if (iproperty._getter == 0) {
-      cerr << "failed " << *getter << "\n";
-    }
+    nassertr(iproperty._getter, 0);
   }
   }
 
 
   if (hasser != NULL) {
   if (hasser != NULL) {
     iproperty._flags |= InterrogateElement::F_has_has_function;
     iproperty._flags |= InterrogateElement::F_has_has_function;
     iproperty._has_function = get_function(hasser, "", struct_type,
     iproperty._has_function = get_function(hasser, "", struct_type,
                                            struct_type->get_scope(), 0);
                                            struct_type->get_scope(), 0);
-    if (iproperty._has_function == 0) {
-      cerr << "failed " << *hasser << "\n";
-    }
+    nassertr(iproperty._has_function, 0);
+  }
+
+  if (deleter != NULL) {
+    iproperty._flags |= InterrogateElement::F_has_del_function;
+    iproperty._del_function = get_function(deleter, "", struct_type,
+                                          struct_type->get_scope(), 0);
+    nassertr(iproperty._del_function, 0);
   }
   }
 
 
   // See if there happens to be a comment before the MAKE_PROPERTY macro.
   // See if there happens to be a comment before the MAKE_PROPERTY macro.
@@ -1907,9 +1977,7 @@ get_make_property(CPPMakeProperty *make_property, CPPStructType *struct_type, CP
       iproperty._flags |= InterrogateElement::F_has_setter;
       iproperty._flags |= InterrogateElement::F_has_setter;
       iproperty._setter = get_function(function, "", struct_type,
       iproperty._setter = get_function(function, "", struct_type,
                                        struct_type->get_scope(), 0);
                                        struct_type->get_scope(), 0);
-      if (iproperty._setter == 0) {
-        cerr << "failed " << *function << "\n";
-      }
+      nassertr(iproperty._setter, 0);
       break;
       break;
     }
     }
   }
   }
@@ -1922,15 +1990,12 @@ get_make_property(CPPMakeProperty *make_property, CPPStructType *struct_type, CP
       iproperty._flags |= InterrogateElement::F_has_clear_function;
       iproperty._flags |= InterrogateElement::F_has_clear_function;
       iproperty._clear_function = get_function(function, "", struct_type,
       iproperty._clear_function = get_function(function, "", struct_type,
                                                struct_type->get_scope(), 0);
                                                struct_type->get_scope(), 0);
-      if (iproperty._clear_function == 0) {
-        cerr << "failed " << *function << "\n";
-      }
+      nassertr(iproperty._clear_function, 0);
       break;
       break;
     }
     }
   }
   }
 
 
   idb->add_element(index, iproperty);
   idb->add_element(index, iproperty);
-
   return index;
   return index;
 }
 }
 
 
@@ -2838,6 +2903,10 @@ define_enum_type(InterrogateType &itype, CPPEnumType *cpptype) {
     return;
     return;
   }
   }
 
 
+  if (cpptype->is_scoped()) {
+    itype._flags |= InterrogateType::F_scoped_enum;
+  }
+
   int next_value = 0;
   int next_value = 0;
 
 
   CPPEnumType::Elements::const_iterator ei;
   CPPEnumType::Elements::const_iterator ei;
@@ -2919,6 +2988,8 @@ define_extension_type(InterrogateType &itype, CPPExtensionType *cpptype) {
   // But we can at least indicate which of the various extension types it is.
   // But we can at least indicate which of the various extension types it is.
   switch (cpptype->_type) {
   switch (cpptype->_type) {
   case CPPExtensionType::T_enum:
   case CPPExtensionType::T_enum:
+  case CPPExtensionType::T_enum_class:
+  case CPPExtensionType::T_enum_struct:
     itype._flags |= InterrogateType::F_enum;
     itype._flags |= InterrogateType::F_enum;
     break;
     break;
 
 

+ 60 - 0
dtool/src/interrogate/typeManager.cxx

@@ -937,6 +937,66 @@ is_wstring(CPPType *type) {
   return is_basic_string_wchar(type);
   return is_basic_string_wchar(type);
 }
 }
 
 
+/**
+ * Returns true if the type is vector<unsigned char>, or a const reference to
+ * it.
+ */
+bool TypeManager::
+is_vector_unsigned_char(CPPType *type) {
+  if (type->get_local_name(&parser) == "vector< unsigned char >" ||
+      type->get_local_name(&parser) == "pvector< unsigned char >") {
+    return true;
+  }
+
+  switch (type->get_subtype()) {
+  case CPPDeclaration::ST_const:
+    return is_vector_unsigned_char(type->as_const_type()->_wrapped_around);
+
+  case CPPDeclaration::ST_reference:
+    return is_const_vector_unsigned_char(type->as_reference_type()->_pointing_at);
+
+  case CPPDeclaration::ST_struct:
+    {
+      CPPStructType *stype = type->as_struct_type();
+      CPPStructType::Derivation::const_iterator di;
+      for (di = stype->_derivation.begin();
+           di != stype->_derivation.end();
+           ++di) {
+        if (is_vector_unsigned_char((*di)._base)) {
+          return true;
+        }
+      }
+    }
+    break;
+
+  case CPPDeclaration::ST_typedef:
+    return is_vector_unsigned_char(type->as_typedef_type()->_type);
+
+  default:
+    break;
+  }
+
+  return false;
+}
+
+/**
+ * Returns true if the indicated type is a const wrapper around
+ * vector<unsigned char>.
+ */
+bool TypeManager::
+is_const_vector_unsigned_char(CPPType *type) {
+  switch (type->get_subtype()) {
+  case CPPDeclaration::ST_const:
+    return is_vector_unsigned_char(type->as_const_type()->_wrapped_around);
+
+  case CPPDeclaration::ST_typedef:
+    return is_const_vector_unsigned_char(type->as_typedef_type()->_type);
+
+  default:
+    return false;
+  }
+}
+
 /**
 /**
  * Returns true if the indicated type is bool, or some trivial variant.
  * Returns true if the indicated type is bool, or some trivial variant.
  */
  */

+ 2 - 0
dtool/src/interrogate/typeManager.h

@@ -81,6 +81,8 @@ public:
   static bool is_const_ref_to_basic_string_wchar(CPPType *type);
   static bool is_const_ref_to_basic_string_wchar(CPPType *type);
   static bool is_const_ptr_to_basic_string_wchar(CPPType *type);
   static bool is_const_ptr_to_basic_string_wchar(CPPType *type);
   static bool is_wstring(CPPType *type);
   static bool is_wstring(CPPType *type);
+  static bool is_vector_unsigned_char(CPPType *type);
+  static bool is_const_vector_unsigned_char(CPPType *type);
   static bool is_pair(CPPType *type);
   static bool is_pair(CPPType *type);
   static bool is_bool(CPPType *type);
   static bool is_bool(CPPType *type);
   static bool is_integer(CPPType *type);
   static bool is_integer(CPPType *type);

+ 1 - 1
dtool/src/interrogatedb/interrogateDatabase.cxx

@@ -20,7 +20,7 @@ InterrogateDatabase *InterrogateDatabase::_global_ptr = NULL;
 int InterrogateDatabase::_file_major_version = 0;
 int InterrogateDatabase::_file_major_version = 0;
 int InterrogateDatabase::_file_minor_version = 0;
 int InterrogateDatabase::_file_minor_version = 0;
 int InterrogateDatabase::_current_major_version = 3;
 int InterrogateDatabase::_current_major_version = 3;
-int InterrogateDatabase::_current_minor_version = 1;
+int InterrogateDatabase::_current_minor_version = 2;
 
 
 /**
 /**
  *
  *

+ 36 - 0
dtool/src/interrogatedb/interrogateElement.I

@@ -24,6 +24,8 @@ InterrogateElement(InterrogateModuleDef *def) :
   _setter = 0;
   _setter = 0;
   _has_function = 0;
   _has_function = 0;
   _clear_function = 0;
   _clear_function = 0;
+  _del_function = 0;
+  _length_function = 0;
 }
 }
 
 
 /**
 /**
@@ -48,6 +50,8 @@ operator = (const InterrogateElement &copy) {
   _setter = copy._setter;
   _setter = copy._setter;
   _has_function = copy._has_function;
   _has_function = copy._has_function;
   _clear_function = copy._clear_function;
   _clear_function = copy._clear_function;
+  _del_function = copy._del_function;
+  _length_function = copy._length_function;
 }
 }
 
 
 /**
 /**
@@ -163,6 +167,38 @@ get_clear_function() const {
   return _clear_function;
   return _clear_function;
 }
 }
 
 
+/**
+ *
+ */
+INLINE bool InterrogateElement::
+has_del_function() const {
+  return (_flags & F_has_del_function) != 0;
+}
+
+/**
+ *
+ */
+INLINE FunctionIndex InterrogateElement::
+get_del_function() const {
+  return _del_function;
+}
+
+/**
+ *
+ */
+INLINE bool InterrogateElement::
+is_sequence() const {
+  return (_flags & F_sequence) != 0;
+}
+
+/**
+ *
+ */
+INLINE FunctionIndex InterrogateElement::
+get_length_function() const {
+  return _length_function;
+}
+
 
 
 INLINE ostream &
 INLINE ostream &
 operator << (ostream &out, const InterrogateElement &element) {
 operator << (ostream &out, const InterrogateElement &element) {

+ 10 - 1
dtool/src/interrogatedb/interrogateElement.cxx

@@ -27,7 +27,9 @@ output(ostream &out) const {
       << _getter << " "
       << _getter << " "
       << _setter << " "
       << _setter << " "
       << _has_function << " "
       << _has_function << " "
-      << _clear_function << " ";
+      << _clear_function << " "
+      << _del_function << " "
+      << _length_function << " ";
   idf_output_string(out, _scoped_name);
   idf_output_string(out, _scoped_name);
   idf_output_string(out, _comment, '\n');
   idf_output_string(out, _comment, '\n');
 }
 }
@@ -41,6 +43,9 @@ input(istream &in) {
   in >> _flags >> _type >> _getter >> _setter;
   in >> _flags >> _type >> _getter >> _setter;
   if (InterrogateDatabase::get_file_minor_version() >= 1) {
   if (InterrogateDatabase::get_file_minor_version() >= 1) {
     in >> _has_function >> _clear_function;
     in >> _has_function >> _clear_function;
+    if (InterrogateDatabase::get_file_minor_version() >= 2) {
+      in >> _del_function >> _length_function;
+    }
   }
   }
   idf_input_string(in, _scoped_name);
   idf_input_string(in, _scoped_name);
   idf_input_string(in, _comment);
   idf_input_string(in, _comment);
@@ -55,4 +60,8 @@ remap_indices(const IndexRemapper &remap) {
   _type = remap.map_from(_type);
   _type = remap.map_from(_type);
   _getter = remap.map_from(_getter);
   _getter = remap.map_from(_getter);
   _setter = remap.map_from(_setter);
   _setter = remap.map_from(_setter);
+  _has_function = remap.map_from(_has_function);
+  _clear_function = remap.map_from(_clear_function);
+  _del_function = remap.map_from(_del_function);
+  _length_function = remap.map_from(_length_function);
 }
 }

+ 9 - 0
dtool/src/interrogatedb/interrogateElement.h

@@ -47,6 +47,10 @@ public:
   INLINE FunctionIndex get_has_function() const;
   INLINE FunctionIndex get_has_function() const;
   INLINE bool has_clear_function() const;
   INLINE bool has_clear_function() const;
   INLINE FunctionIndex get_clear_function() const;
   INLINE FunctionIndex get_clear_function() const;
+  INLINE bool has_del_function() const;
+  INLINE FunctionIndex get_del_function() const;
+  INLINE bool is_sequence() const;
+  INLINE FunctionIndex get_length_function() const;
 
 
   void output(ostream &out) const;
   void output(ostream &out) const;
   void input(istream &in);
   void input(istream &in);
@@ -60,16 +64,21 @@ private:
     F_has_setter      = 0x0004,
     F_has_setter      = 0x0004,
     F_has_has_function= 0x0008,
     F_has_has_function= 0x0008,
     F_has_clear_function= 0x0010,
     F_has_clear_function= 0x0010,
+    F_has_del_function= 0x0020,
+    F_sequence        = 0x0040,
+    F_mapping         = 0x0080,
   };
   };
 
 
   int _flags;
   int _flags;
   string _scoped_name;
   string _scoped_name;
   string _comment;
   string _comment;
   TypeIndex _type;
   TypeIndex _type;
+  FunctionIndex _length_function;
   FunctionIndex _getter;
   FunctionIndex _getter;
   FunctionIndex _setter;
   FunctionIndex _setter;
   FunctionIndex _has_function;
   FunctionIndex _has_function;
   FunctionIndex _clear_function;
   FunctionIndex _clear_function;
+  FunctionIndex _del_function;
 
 
   friend class InterrogateBuilder;
   friend class InterrogateBuilder;
 };
 };

+ 8 - 0
dtool/src/interrogatedb/interrogateType.I

@@ -205,6 +205,14 @@ is_enum() const {
   return (_flags & F_enum) != 0;
   return (_flags & F_enum) != 0;
 }
 }
 
 
+/**
+ * Returns true if enum values are only available under a scope.
+ */
+INLINE bool InterrogateType::
+is_scoped_enum() const {
+  return (_flags & F_scoped_enum) != 0;
+}
+
 /**
 /**
  *
  *
  */
  */

+ 2 - 0
dtool/src/interrogatedb/interrogateType.h

@@ -65,6 +65,7 @@ public:
   INLINE int get_array_size() const;
   INLINE int get_array_size() const;
 
 
   INLINE bool is_enum() const;
   INLINE bool is_enum() const;
+  INLINE bool is_scoped_enum() const;
   INLINE int number_of_enum_values() const;
   INLINE int number_of_enum_values() const;
   INLINE const string &get_enum_value_name(int n) const;
   INLINE const string &get_enum_value_name(int n) const;
   INLINE const string &get_enum_value_scoped_name(int n) const;
   INLINE const string &get_enum_value_scoped_name(int n) const;
@@ -136,6 +137,7 @@ private:
     F_unpublished          = 0x100000,
     F_unpublished          = 0x100000,
     F_typedef              = 0x200000,
     F_typedef              = 0x200000,
     F_array                = 0x400000,
     F_array                = 0x400000,
+    F_scoped_enum          = 0x800000,
   };
   };
 
 
 public:
 public:

+ 4 - 0
dtool/src/interrogatedb/interrogate_request.cxx

@@ -20,7 +20,11 @@ void
 interrogate_request_database(const char *database_filename) {
 interrogate_request_database(const char *database_filename) {
   InterrogateModuleDef *def = new InterrogateModuleDef;
   InterrogateModuleDef *def = new InterrogateModuleDef;
   memset(def, 0, sizeof(InterrogateModuleDef));
   memset(def, 0, sizeof(InterrogateModuleDef));
+#ifdef _WIN32
+  def->database_filename = _strdup(database_filename);
+#else
   def->database_filename = strdup(database_filename);
   def->database_filename = strdup(database_filename);
+#endif
 
 
   // Don't think of this as a leak; think of it as a one-time database
   // Don't think of this as a leak; think of it as a one-time database
   // allocation.
   // allocation.

Some files were not shown because too many files changed in this diff