Browse Source

Added srcdir option

Josh Yelon 20 years ago
parent
commit
65e665414d
1 changed files with 12 additions and 1 deletions
  1. 12 1
      dtool/src/interrogate/interrogate.cxx

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

@@ -39,6 +39,7 @@ CPPParser parser;
 Filename output_code_filename;
 Filename output_code_filename;
 Filename output_include_filename;
 Filename output_include_filename;
 Filename output_data_filename;
 Filename output_data_filename;
+Filename source_file_directory;
 string output_data_basename;
 string output_data_basename;
 bool output_module_specific = false;
 bool output_module_specific = false;
 bool output_function_pointers = false;
 bool output_function_pointers = false;
@@ -67,6 +68,7 @@ static const char *short_options = "I:S:D:F:vh";
 enum CommandOptions {
 enum CommandOptions {
   CO_oc = 256,
   CO_oc = 256,
   CO_od,
   CO_od,
+  CO_srcdir,
   CO_module,
   CO_module,
   CO_library,
   CO_library,
   CO_do_module,
   CO_do_module,
@@ -92,6 +94,7 @@ enum CommandOptions {
 static struct option long_options[] = {
 static struct option long_options[] = {
   { "oc", required_argument, NULL, CO_oc },
   { "oc", required_argument, NULL, CO_oc },
   { "od", required_argument, NULL, CO_od },
   { "od", required_argument, NULL, CO_od },
+  { "srcdir", required_argument, NULL, CO_srcdir },
   { "module", required_argument, NULL, CO_module },
   { "module", required_argument, NULL, CO_module },
   { "library", required_argument, NULL, CO_library },
   { "library", required_argument, NULL, CO_library },
   { "do-module", no_argument, NULL, CO_do_module },
   { "do-module", no_argument, NULL, CO_do_module },
@@ -155,6 +158,10 @@ void show_help() {
     << "        when the scripting language first calls some interrogate query\n"
     << "        when the scripting language first calls some interrogate query\n"
     << "        function.\n\n"
     << "        function.\n\n"
 
 
+    << "  -srcdir directory\n"
+    << "        Specify the name of the directory to which the source filenames are\n"
+    << "        relative.\n\n"
+
     << "  -module module_name\n"
     << "  -module module_name\n"
     << "        Defines the name of the module this data is associated with.  This\n"
     << "        Defines the name of the module this data is associated with.  This\n"
     << "        is strictly a code-organizational tool.  Conceptually, a module is\n"
     << "        is strictly a code-organizational tool.  Conceptually, a module is\n"
@@ -344,6 +351,10 @@ main(int argc, char *argv[]) {
       output_data_filename = Filename::from_os_specific(optarg);
       output_data_filename = Filename::from_os_specific(optarg);
       break;
       break;
 
 
+    case CO_srcdir:
+      source_file_directory = Filename::from_os_specific(optarg);
+      break;
+
     case CO_module:
     case CO_module:
       module_name = optarg;
       module_name = optarg;
       break;
       break;
@@ -468,7 +479,7 @@ main(int argc, char *argv[]) {
   for (i = 1; i < argc; ++i) 
   for (i = 1; i < argc; ++i) 
   {
   {
     Filename filename = Filename::from_os_specific(argv[i]);
     Filename filename = Filename::from_os_specific(argv[i]);
-    if (!parser.parse_file(Filename::from_os_specific(filename))) 
+    if (!parser.parse_file(Filename(source_file_directory, filename)))
     {
     {
       cerr << "Error parsing file: '" << argv[i] << "'\n";
       cerr << "Error parsing file: '" << argv[i] << "'\n";
       exit(1);
       exit(1);