Browse Source

Fix the vast majority of Interrogate parse issues and warnings, add support for inline namespace and constexpr

rdb 10 years ago
parent
commit
920210c999
67 changed files with 1049 additions and 726 deletions
  1. 0 1
      contrib/src/ai/p3ai_composite.cxx
  2. 2 2
      dtool/metalibs/dtoolconfig/pydtool.cxx
  3. 596 586
      dtool/src/cppparser/cppBison.cxx.prebuilt
  4. 61 35
      dtool/src/cppparser/cppBison.yxx
  5. 1 0
      dtool/src/cppparser/cppEnumType.cxx
  6. 10 2
      dtool/src/cppparser/cppExpression.cxx
  7. 18 2
      dtool/src/cppparser/cppIdentifier.cxx
  8. 3 0
      dtool/src/cppparser/cppInstance.cxx
  9. 4 3
      dtool/src/cppparser/cppInstance.h
  10. 6 1
      dtool/src/cppparser/cppNamespace.cxx
  11. 2 0
      dtool/src/cppparser/cppNamespace.h
  12. 8 3
      dtool/src/cppparser/cppScope.cxx
  13. 20 0
      dtool/src/cppparser/cppStructType.cxx
  14. 1 0
      dtool/src/cppparser/cppStructType.h
  15. 0 2
      dtool/src/dtoolbase/dtoolbase.h
  16. 1 1
      dtool/src/dtoolbase/dtoolbase_cc.h
  17. 1 1
      dtool/src/dtoolbase/selectThreadImpl.h
  18. 10 0
      dtool/src/interrogate/interfaceMaker.cxx
  19. 2 2
      dtool/src/interrogate/interfaceMakerPythonSimple.cxx
  20. 3 0
      dtool/src/interrogate/interrogateBuilder.cxx
  21. 2 2
      dtool/src/interrogate/typeManager.cxx
  22. 2 4
      dtool/src/parser-inc/Dense
  23. 0 0
      dtool/src/parser-inc/alloca.h
  24. 2 0
      dtool/src/parser-inc/btBulletDynamicsCommon.h
  25. 1 0
      dtool/src/parser-inc/cfloat
  26. 4 0
      dtool/src/parser-inc/cmath
  27. 7 0
      dtool/src/parser-inc/errno.h
  28. 7 0
      dtool/src/parser-inc/fcntl.h
  29. 18 0
      dtool/src/parser-inc/float.h
  30. 1 0
      dtool/src/parser-inc/ft2build.h
  31. 6 0
      dtool/src/parser-inc/iterator
  32. 5 0
      dtool/src/parser-inc/limits
  33. 18 15
      dtool/src/parser-inc/list
  34. 9 0
      dtool/src/parser-inc/locale.h
  35. 12 10
      dtool/src/parser-inc/memory
  36. 0 1
      dtool/src/parser-inc/ode.h
  37. 0 1
      dtool/src/parser-inc/ode/ode.h
  38. 14 0
      dtool/src/parser-inc/ogg/ogg.h
  39. 9 0
      dtool/src/parser-inc/squish.h
  40. 23 0
      dtool/src/parser-inc/sstream
  41. 4 0
      dtool/src/parser-inc/stdio.h
  42. 11 12
      dtool/src/parser-inc/stdtypedefs.h
  43. 36 30
      dtool/src/parser-inc/string
  44. 3 0
      dtool/src/parser-inc/sys/stat.h
  45. 4 0
      dtool/src/parser-inc/sys/time.h
  46. 17 0
      dtool/src/parser-inc/sys/types.h
  47. 5 0
      dtool/src/parser-inc/typeinfo
  48. 10 0
      dtool/src/parser-inc/unistd.h
  49. 1 0
      dtool/src/parser-inc/vorbis/codec.h
  50. 9 1
      dtool/src/parser-inc/vorbis/vorbisfile.h
  51. 19 0
      dtool/src/parser-inc/zconf.h
  52. 2 0
      dtool/src/parser-inc/zlib.h
  53. 3 0
      panda/src/downloader/bioPtr.h
  54. 3 0
      panda/src/downloader/bioStreamBuf.h
  55. 3 0
      panda/src/downloader/bioStreamPtr.h
  56. 3 0
      panda/src/downloader/httpChannel.h
  57. 3 0
      panda/src/express/openSSLWrapper.h
  58. 7 0
      panda/src/linmath/lmatrix3_src.I
  59. 4 0
      panda/src/linmath/lmatrix4_src.I
  60. 6 1
      panda/src/nativenet/socket_portable.h
  61. 1 1
      panda/src/net/connectionManager.cxx
  62. 0 3
      panda/src/putil/config_util.N
  63. 2 0
      panda/src/rocket/rocketInputHandler.cxx
  64. 1 1
      panda/src/vision/webcamVideoCursorV4L.cxx
  65. 1 1
      panda/src/vision/webcamVideoCursorV4L.h
  66. 1 1
      panda/src/vision/webcamVideoV4L.cxx
  67. 1 1
      panda/src/vision/webcamVideoV4L.h

+ 0 - 1
contrib/src/ai/p3ai_composite.cxx

@@ -1 +0,0 @@
-#include "ai_composite1.cxx"

+ 2 - 2
dtool/metalibs/dtoolconfig/pydtool.cxx

@@ -2359,8 +2359,8 @@ _inP07yte_7S(PyObject *, PyObject *args) {
  */
 static PyObject *
 _inP07ytw_15(PyObject *, PyObject *args) {
-  int param0;
-  if (PyArg_ParseTuple(args, "i", &param0)) {
+  Py_ssize_t param0;
+  if (PyArg_ParseTuple(args, "n", &param0)) {
     interrogate_request_module((InterrogateModuleDef *)param0);
     return Py_BuildValue("");
   }

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


+ 61 - 35
dtool/src/cppparser/cppBison.yxx

@@ -577,56 +577,60 @@ storage_class:
 {
   $$ = 0;
 }
-        | storage_class KW_EXTERN
+        | KW_EXTERN storage_class
 {
-  $$ = $1 | (int)CPPInstance::SC_extern;
+  $$ = $2 | (int)CPPInstance::SC_extern;
 }
-        | storage_class KW_EXTERN SIMPLE_STRING
+        | KW_EXTERN SIMPLE_STRING storage_class
 {
-  $$ = $1 | (int)CPPInstance::SC_extern;
-  if ($3 == "C") {
+  $$ = $3 | (int)CPPInstance::SC_extern;
+  if ($2 == "C") {
     $$ |= (int)CPPInstance::SC_c_binding;
-  } else if ($3 == "C++") {
+  } else if ($2 == "C++") {
     $$ &= ~(int)CPPInstance::SC_c_binding;
   } else {
-    yywarning("Ignoring unknown linkage type \"" + $3 + "\"", @3);
+    yywarning("Ignoring unknown linkage type \"" + $2 + "\"", @2);
   }
 }
-        | storage_class KW_STATIC
+        | KW_STATIC storage_class
 {
-  $$ = $1 | (int)CPPInstance::SC_static;
+  $$ = $2 | (int)CPPInstance::SC_static;
 }
-        | storage_class KW_INLINE
+        | KW_INLINE storage_class
 {
-  $$ = $1 | (int)CPPInstance::SC_inline;
+  $$ = $2 | (int)CPPInstance::SC_inline;
 }
-        | storage_class KW_VIRTUAL
+        | KW_VIRTUAL storage_class
 {
-  $$ = $1 | (int)CPPInstance::SC_virtual;
+  $$ = $2 | (int)CPPInstance::SC_virtual;
 }
-        | storage_class KW_EXPLICIT
+        | KW_EXPLICIT storage_class
 {
-  $$ = $1 | (int)CPPInstance::SC_explicit;
+  $$ = $2 | (int)CPPInstance::SC_explicit;
 }
-        | storage_class KW_VOLATILE
+        | KW_REGISTER storage_class
 {
-  $$ = $1 | (int)CPPInstance::SC_volatile;
+  $$ = $2 | (int)CPPInstance::SC_register;
 }
-        | storage_class KW_MUTABLE
+        | KW_VOLATILE storage_class
 {
-  $$ = $1 | (int)CPPInstance::SC_mutable;
+  $$ = $2 | (int)CPPInstance::SC_volatile;
 }
-        | storage_class KW_REGISTER
+        | KW_MUTABLE storage_class
 {
-  $$ = $1 | (int)CPPInstance::SC_register;
+  $$ = $2 | (int)CPPInstance::SC_mutable;
 }
-        | storage_class KW_BLOCKING
+        | KW_CONSTEXPR storage_class
 {
-  $$ = $1 | (int)CPPInstance::SC_blocking;
+  $$ = $2 | (int)CPPInstance::SC_constexpr;
 }
-        | storage_class KW_EXTENSION
+        | KW_BLOCKING storage_class
 {
-  $$ = $1 | (int)CPPInstance::SC_extension;
+  $$ = $2 | (int)CPPInstance::SC_blocking;
+}
+        | KW_EXTENSION storage_class
+{
+  $$ = $2 | (int)CPPInstance::SC_extension;
 }
         ;
 
@@ -810,16 +814,18 @@ function_prototype:
 }
         formal_parameter_list ')' function_post
 {
-  pop_scope();
   CPPType *type;
-  if ($1->get_simple_name() == current_scope->get_simple_name()) {
+  if ($1->get_simple_name() == current_scope->get_simple_name() ||
+      $1->get_simple_name() == string("~") + current_scope->get_simple_name()) {
     // This is a constructor, and has no return.
     type = new CPPSimpleType(CPPSimpleType::T_void);
   } else {
     // This isn't a constructor, so it has an implicit return type of
     // int.
+    yywarning("function has no return type, assuming int", @1);
     type = new CPPSimpleType(CPPSimpleType::T_int);
   }
+  pop_scope();
 
   CPPInstanceIdentifier *ii = new CPPInstanceIdentifier($1);
   ii->add_func_modifier($4, $6);
@@ -1463,14 +1469,6 @@ formal_parameter:
 {
   $$ = new CPPInstance($1, $2, 0, @2.file);
   $$->set_initializer($3);
-}
-        | IDENTIFIER formal_parameter_identifier maybe_initialize
-{
-  yywarning("Not a type: " + $1->get_fully_scoped_name(), @1);
-  CPPType *type =
-    CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_unknown));
-  $$ = new CPPInstance(type, $2, 0, @2.file);
-  $$->set_initializer($3);
 }
         | KW_CONST type formal_parameter_identifier maybe_initialize
 {
@@ -2101,8 +2099,32 @@ namespace_declaration:
         cpp '}'
 {
   pop_scope();
+}
+        | KW_INLINE KW_NAMESPACE name '{'
+{
+  CPPScope *scope = $3->find_scope(current_scope, global_scope, current_lexer);
+  if (scope == NULL) {
+    // This must be a new namespace declaration.
+    CPPScope *parent_scope =
+      $3->get_scope(current_scope, global_scope, current_lexer);
+    if (parent_scope == NULL) {
+      parent_scope = current_scope;
+    }
+    scope = new CPPScope(parent_scope, $3->_names.back(), V_public);
+  }
+
+  CPPNamespace *nspace = new CPPNamespace($3, scope, @2.file);
+  nspace->_inline = true;
+  current_scope->add_declaration(nspace, global_scope, current_lexer, @2);
+  current_scope->define_namespace(nspace);
+  push_scope(scope);
+}
+        cpp '}'
+{
+  pop_scope();
 }
         | KW_NAMESPACE '{' cpp '}'
+        | KW_INLINE KW_NAMESPACE '{' cpp '}'
         ;
 
 using_declaration:
@@ -2929,6 +2951,10 @@ formal_const_operand:
         | CUSTOM_LITERAL
 {
   $$ = $1;
+}
+        | IDENTIFIER
+{
+  $$ = new CPPExpression($1, current_scope, global_scope, current_lexer);
 }
         | KW_NULLPTR
 {

+ 1 - 0
dtool/src/cppparser/cppEnumType.cxx

@@ -82,6 +82,7 @@ add_element(const string &name, CPPExpression *value) {
     inst = new CPPInstance(CPPType::new_type(new CPPConstType(_element_type)), ident);
   }
 
+  inst->_storage_class |= CPPInstance::SC_constexpr;
   _elements.push_back(inst);
 
   if (value == (CPPExpression *)NULL) {

+ 10 - 2
dtool/src/cppparser/cppExpression.cxx

@@ -531,6 +531,10 @@ evaluate() const {
   case T_variable:
     if (_u._variable->_type != NULL &&
         _u._variable->_initializer != NULL) {
+      // A constexpr variable, which is treated as const.
+      if (_u._variable->_storage_class & CPPInstance::SC_constexpr) {
+        return _u._variable->_initializer->evaluate();
+      }
       // A const variable.  Fetch its assigned value.
       CPPConstType *const_type = _u._variable->_type->as_const_type();
       if (const_type != NULL) {
@@ -1227,6 +1231,9 @@ is_tbd() const {
   case T_variable:
     if (_u._variable->_type != NULL &&
         _u._variable->_initializer != NULL) {
+      if (_u._variable->_storage_class & CPPInstance::SC_constexpr) {
+        return false;
+      }
       CPPConstType *const_type = _u._variable->_type->as_const_type();
       if (const_type != NULL) {
         return false;
@@ -1363,9 +1370,10 @@ output(ostream &out, int indent_level, CPPScope *scope, bool) const {
     if (_u._variable->_type != NULL &&
         _u._variable->_initializer != NULL &&
         _u._variable->_vis > V_public) {
-      // A const variable.  Fetch its assigned value.
+      // A constexpr or const variable.  Fetch its assigned value.
       CPPConstType *const_type = _u._variable->_type->as_const_type();
-      if (const_type != NULL) {
+      if ((_u._variable->_storage_class & CPPInstance::SC_constexpr) != 0 ||
+          const_type != NULL) {
         _u._variable->_initializer->output(out, indent_level, scope, false);
         break;
       }

+ 18 - 2
dtool/src/cppparser/cppIdentifier.cxx

@@ -187,6 +187,12 @@ get_local_name(CPPScope *scope) const {
     // last name.
     CPPScope *my_scope = get_scope(scope, NULL);
 
+    // Strip off template scopes, since they don't add anything
+    // particularly meaningful to the local name.
+    while (my_scope->as_template_scope() != NULL) {
+      my_scope = my_scope->get_parent_scope();
+    }
+
     if (my_scope == NULL) {
       result = get_fully_scoped_name();
     } else if (my_scope == scope) {
@@ -463,7 +469,12 @@ find_symbol(CPPScope *current_scope, CPPScope *global_scope,
 
   CPPDeclaration *sym;
   if (!_names.back().has_templ()) {
-    sym = scope->find_symbol(get_simple_name());
+    if (_names.size() > 1 && scope->get_simple_name() == get_simple_name()) {
+      // An identifier like Class::Class always refers to the class constructor.
+      sym = scope->get_struct_type()->get_constructor();
+    } else {
+      sym = scope->find_symbol(get_simple_name());
+    }
 
   } else {
     sym = scope->find_template(get_simple_name());
@@ -499,7 +510,12 @@ find_symbol(CPPScope *current_scope, CPPScope *global_scope,
 
   CPPDeclaration *sym;
   if (!_names.back().has_templ()) {
-    sym = scope->find_symbol(get_simple_name());
+    if (_names.size() > 1 && scope->get_simple_name() == get_simple_name()) {
+      // An identifier like Class::Class always refers to the class constructor.
+      sym = scope->get_struct_type()->get_constructor();
+    } else {
+      sym = scope->find_symbol(get_simple_name());
+    }
 
   } else {
     sym = scope->find_template(get_simple_name());

+ 3 - 0
dtool/src/cppparser/cppInstance.cxx

@@ -601,6 +601,9 @@ output(ostream &out, int indent_level, CPPScope *scope, bool complete,
   if (_storage_class & SC_mutable) {
     out << "mutable ";
   }
+  if (_storage_class & SC_constexpr) {
+    out << "constexpr ";
+  }
 
   string name;
   if (_ident != NULL) {

+ 4 - 3
dtool/src/cppparser/cppInstance.h

@@ -46,19 +46,20 @@ public:
     SC_pure_virtual = 0x0080,
     SC_volatile     = 0x0100,
     SC_mutable      = 0x0200,
+    SC_constexpr    = 0x0400,
 
     // This bit is only set by CPPStructType::check_virtual().
-    SC_inherited_virtual = 0x0400,
+    SC_inherited_virtual = 0x0800,
 
     // This is a special "storage class" for methods tagged with the
     // BLOCKING macro (i.e. the special __blocking keyword).  These
     // are methods that might block and therefore need to release
     // Python threads for their duration.
-    SC_blocking     = 0x0800,
+    SC_blocking     = 0x1000,
 
     // And this is for methods tagged with __extension, which declares
     // extension methods defined separately from the source code.
-    SC_extension    = 0x1000,
+    SC_extension    = 0x2000,
   };
 
   CPPInstance(CPPType *type, const string &name, int storage_class = 0);

+ 6 - 1
dtool/src/cppparser/cppNamespace.cxx

@@ -26,7 +26,9 @@
 CPPNamespace::
 CPPNamespace(CPPIdentifier *ident, CPPScope *scope, const CPPFile &file) :
   CPPDeclaration(file),
-  _ident(ident), _scope(scope)
+  _ident(ident),
+  _scope(scope),
+  _inline(false)
 {
 }
 
@@ -86,6 +88,9 @@ get_scope() const {
 ////////////////////////////////////////////////////////////////////
 void CPPNamespace::
 output(ostream &out, int indent_level, CPPScope *scope, bool complete) const {
+  if (_inline) {
+    out << "inline ";
+  }
   if (!complete && _ident != NULL) {
     // If we have a name, use it.
     out << "namespace " << _ident->get_local_name(scope);

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

@@ -42,6 +42,8 @@ public:
 
   virtual CPPNamespace *as_namespace();
 
+  bool _inline;
+
 private:
   CPPIdentifier *_ident;
   CPPScope *_scope;

+ 8 - 3
dtool/src/cppparser/cppScope.cxx

@@ -292,10 +292,15 @@ define_extension_type(CPPExtensionType *type, CPPPreprocessor *error_sink) {
 //  Description:
 ////////////////////////////////////////////////////////////////////
 void CPPScope::
-define_namespace(CPPNamespace *scope) {
-  string name = scope->get_simple_name();
+define_namespace(CPPNamespace *ns) {
+  string name = ns->get_simple_name();
 
-  _namespaces[name] = scope;
+  _namespaces[name] = ns;
+
+  if (ns->_inline) {
+    // Add an implicit using declaration for an inline namespace.
+    _using.insert(ns->get_scope());
+  }
 }
 
 ////////////////////////////////////////////////////////////////////

+ 20 - 0
dtool/src/cppparser/cppStructType.cxx

@@ -277,6 +277,26 @@ is_incomplete() const {
   return _incomplete;
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: CPPStructType::get_constructor
+//       Access: Public
+//  Description: Returns the constructor defined for the struct type,
+//               if any, or NULL if no constructor is found.
+////////////////////////////////////////////////////////////////////
+CPPFunctionGroup *CPPStructType::
+get_constructor() const {
+  // Iterate through all the functions that begin with '~' until we
+  // find one that claims to be a destructor.  In theory, there should
+  // only be one such function.
+  CPPScope::Functions::const_iterator fi;
+  fi = _scope->_functions.find(get_simple_name());
+  if (fi != _scope->_functions.end()) {
+    return fi->second;
+  } else {
+    return (CPPFunctionGroup *)NULL;
+  }
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: CPPStructType::get_destructor
 //       Access: Public

+ 1 - 0
dtool/src/cppparser/cppStructType.h

@@ -49,6 +49,7 @@ public:
   virtual bool is_incomplete() const;
   virtual bool is_trivial() const;
 
+  CPPFunctionGroup *get_constructor() const;
   CPPInstance *get_destructor() const;
 
   virtual CPPDeclaration *

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

@@ -254,8 +254,6 @@
 #define TAU_TRACK_MEMORY_HERE()
 #define TAU_ENABLE_TRACKING_MEMORY()
 #define TAU_DISABLE_TRACKING_MEMORY()
-#define TAU_TRACK_MEMORY()
-#define TAU_TRACK_MEMORY_HERE()
 #define TAU_ENABLE_TRACKING_MUSE_EVENTS()
 #define TAU_DISABLE_TRACKING_MUSE_EVENTS()
 #define TAU_TRACK_MUSE_EVENTS()

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

@@ -34,7 +34,7 @@ using namespace std;
 #define INLINE inline
 #define ALWAYS_INLINE inline
 #define TYPENAME typename
-#define CONSTEXPR
+#define CONSTEXPR constexpr
 #define NOEXCEPT noexcept
 #define FINAL
 #define OVERRIDE

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

@@ -36,7 +36,7 @@
 // regular volatile keyword.
 #define TVOLATILE volatile
 
-#if !defined(HAVE_THREADS)
+#if !defined(HAVE_THREADS) || defined(CPPPARSER)
 
 // With threading disabled, use the do-nothing implementation.
 #define THREAD_DUMMY_IMPL 1

+ 10 - 0
dtool/src/interrogate/interfaceMaker.cxx

@@ -412,6 +412,16 @@ remap_parameter(CPPType *struct_type, CPPType *param_type) {
 
       } else if (TypeManager::is_const_ptr_to_basic_string_wchar(param_type)) {
         return new ParameterRemapBasicWStringPtrToWString(param_type);
+
+      } else if (TypeManager::is_reference(param_type) ||
+                 TypeManager::is_pointer(param_type)) {
+        // Python strings are immutable, so we can't wrap a non-const
+        // pointer or reference to a string.
+        CPPType *pt_type = TypeManager::unwrap(param_type);
+        if (TypeManager::is_basic_string_char(pt_type) ||
+            TypeManager::is_basic_string_wchar(pt_type)) {
+          return (ParameterRemap *)NULL;
+        }
       }
     }
   }

+ 2 - 2
dtool/src/interrogate/interfaceMakerPythonSimple.cxx

@@ -360,8 +360,8 @@ void InterfaceMakerPythonSimple::write_function_instance(ostream &out, Interface
       pexpr_string = param_name;
 
     } else if (TypeManager::is_pointer(type)) {
-      out << "int " << param_name;
-      format_specifiers += "i";
+      out << "Py_ssize_t " << param_name;
+      format_specifiers += "n";
       parameter_list += ", &" + param_name;
 
     } else {

+ 3 - 0
dtool/src/interrogate/interrogateBuilder.cxx

@@ -264,6 +264,9 @@ build() {
        ci != _forcetype.end();
        ++ci) {
     CPPType *type = parser.parse_type(*ci);
+    if (type == NULL) {
+      cerr << "Failure to parse forcetype " << *ci << "\n";
+    }
     assert(type != (CPPType *)NULL);
     get_type(type, true);
   }

+ 2 - 2
dtool/src/interrogate/typeManager.cxx

@@ -2295,7 +2295,7 @@ get_basic_string_char_type() {
   static bool got_type = false;
   static CPPType *type = (CPPType *)NULL;
   if (!got_type) {
-    type = parser.parse_type("basic_string<char>");
+    type = parser.parse_type("std::basic_string<char>");
     got_type = true;
   }
   return type;
@@ -2312,7 +2312,7 @@ get_basic_string_wchar_type() {
   static bool got_type = false;
   static CPPType *type = (CPPType *)NULL;
   if (!got_type) {
-    type = parser.parse_type("basic_string<wchar_t>");
+    type = parser.parse_type("std::basic_string<wchar_t>");
     got_type = true;
   }
   return type;

+ 2 - 4
dtool/src/parser-inc/Dense

@@ -1,6 +1,4 @@
 namespace Eigen {
-   template <class type, int rows, int cols>
-   class Matrix {
-   };
+   template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
+   class Matrix;
 };
-

+ 0 - 0
dtool/src/parser-inc/alloca.h


+ 2 - 0
dtool/src/parser-inc/btBulletDynamicsCommon.h

@@ -1,9 +1,11 @@
+#pragma once
 
 class bt32BitAxisSweep3;
 class btActionInterface;
 class btAxisSweep3;
 class btBoxShape;
 class btBroadphaseInterface;
+class btBroadphaseProxy;
 class btBulletWorldImporter;
 class btBvhTriangleMeshShape;
 class btCapsuleShape;

+ 1 - 0
dtool/src/parser-inc/cfloat

@@ -0,0 +1 @@
+#include <float.h>

+ 4 - 0
dtool/src/parser-inc/cmath

@@ -0,0 +1,4 @@
+#pragma once
+
+typedef float float_t;
+typedef double double_t;

+ 7 - 0
dtool/src/parser-inc/errno.h

@@ -0,0 +1,7 @@
+#pragma once
+
+#define EDOM 33
+#define EILSEQ 84
+#define ERANGE 34
+
+extern int errno;

+ 7 - 0
dtool/src/parser-inc/fcntl.h

@@ -0,0 +1,7 @@
+#pragma once
+
+typedef int pid_t;
+typedef long int off_t;
+typedef unsigned int mode_t;
+
+struct flock;

+ 18 - 0
dtool/src/parser-inc/float.h

@@ -0,0 +1,18 @@
+#pragma once
+
+#define FLT_RADIX 2
+#define DECIMAL_DIG 21
+
+#define FLT_MIN 1.17549435e-38F
+#define DBL_MIN 2.2250738585072014e-308
+#define LDBL_MIN 3.36210314311209350626e-4932L
+
+#define FLT_MAX 3.40282347e+38F
+#define DBL_MAX 1.7976931348623157e+308
+#define LDBL_MAX 1.18973149535723176502e+4932L
+
+#define FLT_DIG 6
+#define DBL_DIG 15
+#define LDBL_DIG 18
+
+#define FLT_EVAL_METHOD -1

+ 1 - 0
dtool/src/parser-inc/ft2build.h

@@ -23,6 +23,7 @@
 // This definition is intentionally recursive.  Why complicate things
 // with multiple files?
 #define FT_FREETYPE_H <ft2build.h>
+#define FT_OUTLINE_H <ft2build.h>
 
 class FT_Face;
 class FT_Library;

+ 6 - 0
dtool/src/parser-inc/iterator

@@ -0,0 +1,6 @@
+#pragma once
+
+namespace std {
+  template<class Iterator> class iterator;
+  template<class Iterator> class reverse_iterator;
+};

+ 5 - 0
dtool/src/parser-inc/limits

@@ -0,0 +1,5 @@
+#pragma once
+
+namespace std {
+  template<class T> class numeric_limits;
+};

+ 18 - 15
dtool/src/parser-inc/list

@@ -21,23 +21,26 @@
 #define LIST_H
 
 #include <stdtypedefs.h>
+#include <memory>
 
-template<class element>
-class list {
-public:
-  typedef element value_type;
+namespace std {
+  template<class element, class Allocator = std::allocator<element>>
+  class list {
+  public:
+    typedef element value_type;
 
-  typedef element *pointer;
-  typedef const element *const_pointer;
-  typedef element &reference;
-  typedef const element &const_reference;
+    typedef element *pointer;
+    typedef const element *const_pointer;
+    typedef element &reference;
+    typedef const element &const_reference;
 
-  class iterator;
-  class const_iterator;
-  class reverse_iterator;
-  class const_reverse_iterator;
-  typedef size_t size_type;
-  class difference_type;
-};
+    class iterator;
+    class const_iterator;
+    class reverse_iterator;
+    class const_reverse_iterator;
+    typedef size_t size_type;
+    class difference_type;
+  };
+}
 
 #endif

+ 9 - 0
dtool/src/parser-inc/locale.h

@@ -0,0 +1,9 @@
+#pragma once
+
+#define LC_CTYPE 0
+#define LC_NUMERIC 1
+#define LC_TIME 2
+#define LC_COLLATE 3
+#define LC_MONETARY 4
+#define LC_MESSAGES 5
+#define LC_ALL 6

+ 12 - 10
dtool/src/parser-inc/memory

@@ -32,16 +32,18 @@ public:
 
 #else  // GCC_STYLE_ALLOCATOR
 
-template<class Type>
-class allocator {
-public:
-  typedef Type *pointer;
-  typedef const Type *const_pointer;
-  typedef size_t size_type;
-
-  INLINE pointer allocate(size_type n, allocator<void>::const_pointer hint = 0);
-  INLINE void deallocate(pointer p, size_type n);
-};
+namespace std {
+  template<class Type>
+  class allocator {
+  public:
+    typedef Type *pointer;
+    typedef const Type *const_pointer;
+    typedef size_t size_type;
+
+    pointer allocate(size_type n, allocator<void>::const_pointer hint = 0);
+    void deallocate(pointer p, size_type n);
+  };
+}
 
 #endif  // GCC_STYLE_ALLOCATOR
 

+ 0 - 1
dtool/src/parser-inc/ode.h

@@ -20,7 +20,6 @@
 #define _ODE_CONFIG_H_
 
 #define dSINGLE 1
-#define _MSC_VER 1
 #define ODE_PLATFORM_WINDOWS  
 
 #if !defined(ODE_API)

+ 0 - 1
dtool/src/parser-inc/ode/ode.h

@@ -20,7 +20,6 @@
 #define _ODE_CONFIG_H_
 
 #define dSINGLE 1
-#define _MSC_VER 1
 #define ODE_PLATFORM_WINDOWS  
 
 #if !defined(ODE_API)

+ 14 - 0
dtool/src/parser-inc/ogg/ogg.h

@@ -0,0 +1,14 @@
+#ifndef _OGG_H
+#define _OGG_H
+
+#include <stddef.h>
+#include <ogg/os_types.h>
+
+typedef struct {} ogg_iovec_t;
+typedef struct {} oggpack_buffer;
+typedef struct {} ogg_page;
+typedef struct {} ogg_stream_state;
+typedef struct {} ogg_packet;
+typedef struct {} ogg_sync_state;
+
+#endif

+ 9 - 0
dtool/src/parser-inc/squish.h

@@ -0,0 +1,9 @@
+#ifndef SQUISH_H
+#define SQUISH_H
+
+namespace squish {
+  typedef unsigned char u8;
+};
+
+#endif
+

+ 23 - 0
dtool/src/parser-inc/sstream

@@ -0,0 +1,23 @@
+#pragma once
+
+namespace std {
+  template <class charT,
+            class traits = char_traits<charT>,
+            class Allocator = allocator<charT> >
+  class basic_stringbuf;
+
+  template <class charT,
+          class traits = char_traits<charT>,
+          class Allocator = allocator<charT> >
+  class basic_istringstream;
+
+  template <class charT,
+            class traits = char_traits<charT>,
+            class Allocator = allocator<charT> >
+  class basic_ostringstream;
+
+  template <class charT,
+            class traits = char_traits<charT>,
+            class Allocator = allocator<charT> >
+  class basic_stringstream;
+};

+ 4 - 0
dtool/src/parser-inc/stdio.h

@@ -5,4 +5,8 @@
 
 struct FILE;
 
+#define SEEK_SET 0
+#define SEEK_CUR 1
+#define SEEK_END 2
+
 #endif

+ 11 - 12
dtool/src/parser-inc/stdtypedefs.h

@@ -19,27 +19,26 @@
 
 #ifndef STDTYPEDEFS_H
 #define STDTYPEDEFS_H
-typedef int off_t;
-typedef long time_t;
-typedef long clock_t;
-
-namespace std {
-}
 
 typedef unsigned int uint;
 typedef unsigned long ulong;
 typedef unsigned short ushort;
 typedef unsigned char uchar;
 
+inline namespace std {
+  typedef long time_t;
+  typedef long clock_t;
+
 #ifdef _WIN64
-typedef unsigned long long size_t;
-typedef long long ssize_t;
-typedef long long ptrdiff_t;
+  typedef unsigned long long size_t;
+  typedef long long ssize_t;
+  typedef long long ptrdiff_t;
 #else
-typedef unsigned long size_t;
-typedef long ssize_t;
-typedef long ptrdiff_t;
+  typedef unsigned long size_t;
+  typedef long ssize_t;
+  typedef long ptrdiff_t;
 #endif
+}
 
 #ifdef __cplusplus
 #define NULL 0L

+ 36 - 30
dtool/src/parser-inc/string

@@ -22,47 +22,53 @@
 
 #include <stdtypedefs.h>
 
-template<class ctype>
-class basic_string {
-public:
-  typedef typename size_t size_type;
-  static const size_t npos = -1;
+namespace std {
+  template<class charT>
+  class char_traits;
 
-  basic_string();
-  basic_string(const basic_string &copy);
-  void operator = (const basic_string &copy);
-  basic_string(const ctype *string);
-  ~basic_string();
+  template<class ctype>
+  class basic_string {
+  public:
+    struct iterator;
+    struct const_iterator;
+    struct reverse_iterator;
+    struct const_reverse_iterator;
 
-  const ctype *c_str() const;
-  size_t length() const;
+    typedef typename size_t size_type;
+    static const size_t npos = -1;
 
-  ctype at(size_t pos) const;
-  ctype operator[](size_t pos) const;
-  ctype &operator[](size_t pos);
-};
+    basic_string();
+    basic_string(const basic_string<ctype> &copy);
+    void operator = (const basic_string<ctype> &copy);
+    basic_string(const ctype *string);
+    ~basic_string();
 
-typedef basic_string<char> string;
-typedef basic_string<wchar_t> wstring;
-typedef basic_string<char16_t> u16string;
-typedef basic_string<char32_t> u32string;
+    const ctype *c_str() const;
+    size_t length() const;
+
+    ctype at(size_t pos) const;
+    ctype operator[](size_t pos) const;
+    ctype &operator[](size_t pos);
+  };
+
+  typedef basic_string<char> string;
+  typedef basic_string<wchar_t> wstring;
+  typedef basic_string<char16_t> u16string;
+  typedef basic_string<char32_t> u32string;
 
-namespace std {
   template<class T> struct hash;
   template<> struct hash<string>;
   template<> struct hash<u16string>;
   template<> struct hash<u32string>;
   template<> struct hash<wstring>;
 
-  namespace string_literals {
-    string operator "" s(const char *str, size_t len);
-    wstring operator "" s(const wchar_t *str, size_t len);
-    u16string operator "" s(const char16_t *str, size_t len);
-    u32string operator "" s(const char32_t *str, size_t len);
-  }
-
-  namespace literals {
-    using namespace string_literals;
+  inline namespace literals {
+    inline namespace string_literals {
+      string operator "" s(const char *str, size_t len);
+      wstring operator "" s(const wchar_t *str, size_t len);
+      u16string operator "" s(const char16_t *str, size_t len);
+      u32string operator "" s(const char32_t *str, size_t len);
+    }
   }
 }
 

+ 3 - 0
dtool/src/parser-inc/sys/stat.h

@@ -0,0 +1,3 @@
+#pragma once
+
+struct stat;

+ 4 - 0
dtool/src/parser-inc/sys/time.h

@@ -0,0 +1,4 @@
+#pragma once
+
+struct timeval;
+struct fd_set;

+ 17 - 0
dtool/src/parser-inc/sys/types.h

@@ -0,0 +1,17 @@
+#pragma once
+
+#include <stdtypedefs.h>
+
+typedef unsigned int id_t;
+typedef unsigned int gid_t;
+typedef unsigned int uid_t;
+typedef int pid_t;
+typedef long int off_t;
+typedef unsigned int mode_t;
+typedef unsigned long ino_t;
+typedef long int dev_t;
+
+typedef void *timer_t;
+typedef int clockid_t;
+typedef unsigned int useconds_t;
+typedef long int suseconds_t;

+ 5 - 0
dtool/src/parser-inc/typeinfo

@@ -0,0 +1,5 @@
+#pragma once
+
+class type_info;
+class bad_cast;
+class bad_typeid;

+ 10 - 0
dtool/src/parser-inc/unistd.h

@@ -0,0 +1,10 @@
+#pragma once
+
+#include <stdio.h>
+
+#define STDIN_FILENO 0
+#define STDOUT_FILENO 1
+#define STDERR_FILENO 2
+
+extern char *optarg;
+extern int optind, opterr, optopt;

+ 1 - 0
dtool/src/parser-inc/vorbis/codec.h

@@ -0,0 +1 @@
+#include <ogg/ogg.h>

+ 9 - 1
dtool/src/parser-inc/vorbis/vorbisfile.h

@@ -1 +1,9 @@
-struct OggVorbis_File;
+#ifndef _OV_FILE_H
+#define _OV_FILE_H
+
+#include <stdio.h>
+#include "codec.h"
+
+typedef struct OggVorbis_File OggVorbis_File;
+
+#endif

+ 19 - 0
dtool/src/parser-inc/zconf.h

@@ -0,0 +1,19 @@
+#ifndef ZCONF_H
+#define ZCONF_H
+
+typedef unsigned char Byte;
+typedef unsigned int uInt;
+typedef unsigned long uLong;
+
+typedef char charf;
+typedef int intf;
+typedef uInt uIntf;
+typedef uLong uLongf;
+
+typedef void const *voidpc;
+typedef void *voidpf;
+typedef void *voidp;
+
+typedef unsigned long z_crc_t;
+
+#endif

+ 2 - 0
dtool/src/parser-inc/zlib.h

@@ -20,6 +20,8 @@
 #ifndef ZLIB_H
 #define ZLIB_H
 
+#include "zconf.h"
+
 class z_stream {
 };
 

+ 3 - 0
panda/src/downloader/bioPtr.h

@@ -19,7 +19,10 @@
 
 // This module is not compiled if OpenSSL is not available.
 #ifdef HAVE_OPENSSL
+
+#ifndef OPENSSL_NO_KRB5
 #define OPENSSL_NO_KRB5
+#endif
 
 #include "referenceCount.h"
 #include "openSSLWrapper.h"  // must be included before any other openssl.

+ 3 - 0
panda/src/downloader/bioStreamBuf.h

@@ -19,7 +19,10 @@
 
 // This module is not compiled if OpenSSL is not available.
 #ifdef HAVE_OPENSSL
+
+#ifndef OPENSSL_NO_KRB5
 #define OPENSSL_NO_KRB5
+#endif
 
 #include "bioPtr.h"
 #include "pointerTo.h"

+ 3 - 0
panda/src/downloader/bioStreamPtr.h

@@ -19,7 +19,10 @@
 
 // This module is not compiled if OpenSSL is not available.
 #ifdef HAVE_OPENSSL
+
+#ifndef OPENSSL_NO_KRB5
 #define OPENSSL_NO_KRB5
+#endif
 
 #include "bioStream.h"
 #include "referenceCount.h"

+ 3 - 0
panda/src/downloader/httpChannel.h

@@ -23,7 +23,10 @@
 // communications.
 
 #ifdef HAVE_OPENSSL
+
+#ifndef OPENSSL_NO_KRB5
 #define OPENSSL_NO_KRB5
+#endif
 
 #include "httpClient.h"
 #include "httpEnum.h"

+ 3 - 0
panda/src/express/openSSLWrapper.h

@@ -24,7 +24,10 @@
 #include <winsock2.h>  // must be included prior to including OpenSSL.
 #endif
 
+#ifndef OPENSSL_NO_KRB5
 #define OPENSSL_NO_KRB5
+#endif
+
 #include "openssl/ssl.h"
 #include "openssl/rand.h"
 #include "openssl/err.h"

+ 7 - 0
panda/src/linmath/lmatrix3_src.I

@@ -607,6 +607,8 @@ xform(const FLOATNAME(LVecBase3) &v) const {
   return v_res;
 }
 
+#undef VECTOR3_MATRIX3_PRODUCT
+
 ////////////////////////////////////////////////////////////////////
 //     Function: LMatrix3::xform_point
 //       Access: Published
@@ -811,6 +813,8 @@ multiply(const FLOATNAME(LMatrix3) &other1, const FLOATNAME(LMatrix3) &other2) {
   MATRIX3_PRODUCT((*this), other1, other2);
 }
 
+#undef MATRIX3_PRODUCT
+
 ////////////////////////////////////////////////////////////////////
 //     Function: LMatrix3::matrix * scalar
 //       Access: Published
@@ -1235,6 +1239,9 @@ invert_transpose_from(const FLOATNAME(LMatrix4) &other) {
 #endif  // HAVE_EIGEN
 }
 
+#undef MATRIX3_DETERMINANT
+#undef DET2
+
 ////////////////////////////////////////////////////////////////////
 //     Function: LMatrix::set_translate_mat
 //       Access: Published

+ 4 - 0
panda/src/linmath/lmatrix4_src.I

@@ -849,6 +849,8 @@ xform(const FLOATNAME(LVecBase4) &v) const {
   return v_res;
 }
 
+#undef VECTOR4_MATRIX4_PRODUCT
+
 ////////////////////////////////////////////////////////////////////
 //     Function: LMatrix4::xform_point
 //       Access: Public
@@ -1068,6 +1070,8 @@ multiply(const FLOATNAME(LMatrix4) &other1, const FLOATNAME(LMatrix4) &other2) {
 #endif  // HAVE_EIGEN
 }
 
+#undef MATRIX4_PRODUCT
+
 ////////////////////////////////////////////////////////////////////
 //     Function: LMatrix4::matrix * scalar
 //       Access: Public

+ 6 - 1
panda/src/nativenet/socket_portable.h

@@ -8,10 +8,15 @@
 const int ALL_OK = 0;
 const int BASIC_ERROR = -1;
 
+#if defined(CPPPARSER)
+// Interrogate doesn't need to parse any of this.
+
+typedef unsigned long SOCKET;
+
 /************************************************************************
 * HP SOCKET LIBRARY STUFF
 ************************************************************************/
-#if defined(HP_SOCK)
+#elif defined(HP_SOCK)
 
 #ifndef _INCLUDE_HPUX_SOURCE
 #define _INCLUDE_HPUX_SOURCE

+ 1 - 1
panda/src/net/connectionManager.cxx

@@ -28,7 +28,7 @@
 #include <Iphlpapi.h> // For GetAdaptersAddresses()
 #elif defined(ANDROID)
 #include <net/if.h>
-#else
+#elif !defined(CPPPARSER)
 #include <net/if.h>
 #include <ifaddrs.h>
 #endif

+ 0 - 3
panda/src/putil/config_util.N

@@ -10,9 +10,6 @@ ignoretype Factory<TypedWriteable>
 # builds (to support multi-arch builds), so we don't export this.
 ignoretype BitMaskNative
 
-forcetype basic_string<char>
-renametype basic_string<char> CString
-
 forcetype PointerToBase<ReferenceCountedVector<ushort> >
 forcetype PointerToArrayBase<ushort>
 forcetype PointerToArray<ushort>

+ 2 - 0
panda/src/rocket/rocketInputHandler.cxx

@@ -20,9 +20,11 @@
 #include "keyboardButton.h"
 #include "mouseButton.h"
 
+#ifndef CPPPARSER
 #include <Rocket/Core/Input.h>
 
 using namespace Rocket::Core::Input;
+#endif
 
 TypeHandle RocketInputHandler::_type_handle;
 

+ 1 - 1
panda/src/vision/webcamVideoCursorV4L.cxx

@@ -14,7 +14,7 @@
 
 #include "webcamVideoV4L.h"
 
-#ifdef HAVE_VIDEO4LINUX
+#if defined(HAVE_VIDEO4LINUX) && !defined(CPPPARSER)
 
 #include <fcntl.h>
 #include <sys/mman.h>

+ 1 - 1
panda/src/vision/webcamVideoCursorV4L.h

@@ -17,7 +17,7 @@
 
 #include "pandabase.h"
 
-#ifdef HAVE_VIDEO4LINUX
+#if defined(HAVE_VIDEO4LINUX) && !defined(CPPPARSER)
 
 #include "webcamVideo.h"
 #include "movieVideoCursor.h"

+ 1 - 1
panda/src/vision/webcamVideoV4L.cxx

@@ -14,7 +14,7 @@
 
 #include "webcamVideoV4L.h"
 
-#ifdef HAVE_VIDEO4LINUX
+#if defined(HAVE_VIDEO4LINUX) && !defined(CPPPARSER)
 
 #include "webcamVideoCursorV4L.h"
 #include "dcast.h"

+ 1 - 1
panda/src/vision/webcamVideoV4L.h

@@ -17,7 +17,7 @@
 
 #include "pandabase.h"
 
-#ifdef HAVE_VIDEO4LINUX
+#if defined(HAVE_VIDEO4LINUX) && !defined(CPPPARSER)
 
 #include "webcamVideo.h"
 

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