Browse Source

add interrogate -noangles

David Rose 14 years ago
parent
commit
cebecba2fc

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

@@ -186,6 +186,7 @@ get() {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 CPPPreprocessor::
 CPPPreprocessor::
 CPPPreprocessor() {
 CPPPreprocessor() {
+  _noangles = false;
   _state = S_eof;
   _state = S_eof;
   _paren_nesting = 0;
   _paren_nesting = 0;
   _angle_bracket_found = false;
   _angle_bracket_found = false;
@@ -1375,7 +1376,12 @@ handle_include_directive(const string &args, int first_line,
       }
       }
     } else if (expr[0] == '<' && expr[expr.size() - 1] == '>') {
     } else if (expr[0] == '<' && expr[expr.size() - 1] == '>') {
       filename = expr.substr(1, expr.size() - 2);
       filename = expr.substr(1, expr.size() - 2);
-      angle_quotes = true;
+      if (!_noangles) {
+        // If _noangles is true, we don't make a distinction between
+        // angle brackets and quote marks--all #include statements are
+        // treated the same, as if they used quote marks.
+        angle_quotes = true;
+      }
       okflag = true;
       okflag = true;
 
 
       if (_files.size() == 1) {
       if (_files.size() == 1) {
@@ -1396,7 +1402,6 @@ handle_include_directive(const string &args, int first_line,
   CPPFile::Source source = CPPFile::S_none;
   CPPFile::Source source = CPPFile::S_none;
 
 
   if (okflag) {
   if (okflag) {
-
     found_file = false;
     found_file = false;
 
 
     // Search the current directory.
     // Search the current directory.

+ 3 - 2
dtool/src/cppparser/cppPreprocessor.h

@@ -72,8 +72,9 @@ public:
   Manifests _manifests;
   Manifests _manifests;
 
 
   pvector<CPPFile::Source> _quote_include_kind;
   pvector<CPPFile::Source> _quote_include_kind;
-  DSearchPath              _quote_include_path;
-  DSearchPath              _angle_include_path;
+  DSearchPath _quote_include_path;
+  DSearchPath _angle_include_path;
+  bool _noangles;
   
   
   CPPComments _comments;
   CPPComments _comments;
 
 

+ 11 - 1
dtool/src/interrogate/interrogate.cxx

@@ -75,6 +75,7 @@ enum CommandOptions {
   CO_longlong,
   CO_longlong,
   CO_promiscuous,
   CO_promiscuous,
   CO_spam,
   CO_spam,
+  CO_noangles,
   CO_help,
   CO_help,
 };
 };
 
 
@@ -101,6 +102,7 @@ static struct option long_options[] = {
   { "longlong", required_argument, NULL, CO_longlong },
   { "longlong", required_argument, NULL, CO_longlong },
   { "promiscuous", no_argument, NULL, CO_promiscuous },
   { "promiscuous", no_argument, NULL, CO_promiscuous },
   { "spam", no_argument, NULL, CO_spam },
   { "spam", no_argument, NULL, CO_spam },
+  { "noangles", no_argument, NULL, CO_noangles },
   { "help", no_argument, NULL, CO_help },
   { "help", no_argument, NULL, CO_help },
   { NULL }
   { NULL }
 };
 };
@@ -275,7 +277,11 @@ void show_help() {
 
 
     << "  -spam\n"
     << "  -spam\n"
     << "        Generate wrapper functions that report each invocation to Notify.\n"
     << "        Generate wrapper functions that report each invocation to Notify.\n"
-    << "        This can sometimes be useful for tracking down bugs.\n\n";
+    << "        This can sometimes be useful for tracking down bugs.\n\n"
+
+    << "  -noangles\n"
+    << "        Treat #include <file> the same as #include \"file\".  This means -I\n"
+    << "        and -S are equivalent.\n\n";
 }
 }
 
 
 // handle commandline -D options
 // handle commandline -D options
@@ -429,6 +435,10 @@ main(int argc, char *argv[]) {
       generate_spam = true;
       generate_spam = true;
       break;
       break;
 
 
+    case CO_noangles:
+      parser._noangles = true;
+      break;
+
     case 'h':
     case 'h':
     case CO_help:
     case CO_help:
       show_help();
       show_help();