Explorar o código

*** empty log message ***

David Rose %!s(int64=25) %!d(string=hai) anos
pai
achega
b01eb83885

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

@@ -12,7 +12,7 @@
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //       Class : vector_string
 //       Class : vector_string
-// Description : A vector of ints.  This class is defined once here,
+// Description : A vector of strings.  This class is defined once here,
 //               and exported to DTOOL.DLL; other packages that want
 //               and exported to DTOOL.DLL; other packages that want
 //               to use a vector of this type (whether they need to
 //               to use a vector of this type (whether they need to
 //               export it or not) should include this header file,
 //               export it or not) should include this header file,

+ 56 - 19
dtool/src/interrogate/interrogateBuilder.cxx

@@ -66,9 +66,7 @@ add_source_file(const string &filename) {
     return;
     return;
   }
   }
 
 
-  if (!CPPFile::is_c_or_i_file(filename)) {
-    _include_files.insert('"' + filename + '"');
-  }
+  _include_files[filename] = '"';
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
@@ -177,6 +175,9 @@ do_command(const string &command, const string &params) {
   } else if (command == "ignoremember") {
   } else if (command == "ignoremember") {
     insert_param_list(_ignoremember, params);
     insert_param_list(_ignoremember, params);
 
 
+  } else if (command == "noinclude") {
+    insert_param_list(_noinclude, params);
+
   } else {
   } else {
     nout << "Ignoring " << command << " " << params << "\n";
     nout << "Ignoring " << command << " " << params << "\n";
   }
   }
@@ -197,19 +198,13 @@ build() {
        ii != parser._quote_includes.end();
        ii != parser._quote_includes.end();
        ++ii) {
        ++ii) {
     const string &filename = (*ii);
     const string &filename = (*ii);
-    // Don't add any C files to the include list.
-    if (!CPPFile::is_c_or_i_file(filename)) {
-      _include_files.insert('"' + filename + '"');
-    }
+    _include_files[filename] = '"';
   }
   }
   for (ii = parser._angle_includes.begin();
   for (ii = parser._angle_includes.begin();
        ii != parser._angle_includes.end();
        ii != parser._angle_includes.end();
        ++ii) {
        ++ii) {
     const string &filename = (*ii);
     const string &filename = (*ii);
-    // Don't add any C files to the include list.
-    if (!CPPFile::is_c_or_i_file(filename)) {
-      _include_files.insert('<' + filename + '>');
-    }
+    _include_files[filename] = '<';
   }
   }
 
 
   // First, get all the types that were explicitly forced.
   // First, get all the types that were explicitly forced.
@@ -321,14 +316,14 @@ write_code(ostream &out, InterrogateModuleDef *def) {
   for (ifi = _include_files.begin();
   for (ifi = _include_files.begin();
        ifi != _include_files.end();
        ifi != _include_files.end();
        ++ifi) {
        ++ifi) {
-    const string &filename = (*ifi);
-    // Much as I hate to do it, I'm going to code in a special-case
-    // for two particularly nasty header files that we probably don't
-    // want to actually ever include.
-    if (filename == "<winbase.h>" || filename == "<windows.h>") {
-      // Ignoring these.
-    } else {
-      out << "#include " << (*ifi) << "\n";
+    const string &filename = (*ifi).first;
+    char delimiter = (*ifi).second;
+    if (should_include(filename)) {
+      if (delimiter == '"') {
+	out << "#include \"" << filename << "\"\n";
+      } else {
+	out << "#include <" << filename << ">\n";
+      }
     }
     }
   }
   }
   out << "\n";
   out << "\n";
@@ -778,6 +773,48 @@ in_ignoremember(const string &name) const {
   return (_ignoremember.count(name) != 0);
   return (_ignoremember.count(name) != 0);
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: InterrogateBuilder::in_noinclude
+//       Access: Private
+//  Description: Returns true if the indicated filename is one that
+//               the user identified with a noinclude command.
+////////////////////////////////////////////////////////////////////
+bool InterrogateBuilder::
+in_noinclude(const string &name) const {
+  return (_noinclude.count(name) != 0);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: InterrogateBuilder::should_include
+//       Access: Private
+//  Description: Returns true if the indicated filename is a valid
+//               file to explicitly #include in the generated .cxx
+//               file, false otherwise.
+////////////////////////////////////////////////////////////////////
+bool InterrogateBuilder::
+should_include(const string &filename) const {
+  // Don't directly include any .cxx or .I files.
+  if (CPPFile::is_c_or_i_file(filename)) {
+    return false;
+  }
+
+  // Also, don't include any files specifically forbidden in a .N
+  // file.
+  if (in_noinclude(filename)) {
+    return false;
+  }
+
+  // Much as I hate to do it, I'm going to code in a special-case
+  // for two particularly nasty header files that we probably don't
+  // want to actually ever include.
+  if (filename == "winbase.h" || filename == "windows.h") {
+    return false;
+  }
+
+  // Otherwise, no problem.
+  return true;
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: InterrogateBuilder::remap_indices
 //     Function: InterrogateBuilder::remap_indices
 //       Access: Private
 //       Access: Private

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

@@ -66,6 +66,8 @@ private:
   bool in_ignoreinvolved(CPPType *type) const;
   bool in_ignoreinvolved(CPPType *type) const;
   bool in_ignorefile(const string &name) const;
   bool in_ignorefile(const string &name) const;
   bool in_ignoremember(const string &name) const;
   bool in_ignoremember(const string &name) const;
+  bool in_noinclude(const string &name) const;
+  bool should_include(const string &filename) const;
 
 
   void remap_indices();
   void remap_indices();
   void scan_function(CPPFunctionGroup *fgroup);
   void scan_function(CPPFunctionGroup *fgroup);
@@ -145,7 +147,7 @@ private:
   FunctionsBySignature _functions_by_signature;
   FunctionsBySignature _functions_by_signature;
   WrappersByHash _wrappers_by_hash;
   WrappersByHash _wrappers_by_hash;
 
 
-  typedef set<string> IncludeFiles;
+  typedef map<string, char> IncludeFiles;
   IncludeFiles _include_files;
   IncludeFiles _include_files;
 
 
   Commands _forcetype;
   Commands _forcetype;
@@ -154,6 +156,7 @@ private:
   Commands _ignoreinvolved;
   Commands _ignoreinvolved;
   Commands _ignorefile;
   Commands _ignorefile;
   Commands _ignoremember;
   Commands _ignoremember;
+  Commands _noinclude;
 
 
   string _library_hash_name;
   string _library_hash_name;
 };
 };