changeset 15479:b1ff8c83e232

set Vdoc_cache_file and Vtexi_macros_file variables directly from command line options * octave.cc (octave_process_command_line): Set Vdoc_cache_file and Vtexi_macros_file directly. (octave_initialize_interpreter): Don't call bind_internal_variable to set Vdoc_cache_file or Vtexi_macros_file. (doc_cache_file, Vtexi_macros_file): Delete unused static variables. * defaults.cc (set_default_doc_cache_file): Don't set Vdoc_cache_file unless it is empty. (set_default_texi_macros_file): Don't set Vtexi_macros_file unless it is empty.
author John W. Eaton <jwe@octave.org>
date Wed, 03 Oct 2012 02:51:04 -0400
parents 8b5fc510c6d6
children 3f447bcc8488
files libinterp/interpfcn/defaults.cc libinterp/octave.cc
diffstat 2 files changed, 14 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/interpfcn/defaults.cc
+++ b/libinterp/interpfcn/defaults.cc
@@ -296,21 +296,27 @@
 static void
 set_default_doc_cache_file (void)
 {
-  std::string def_file = subst_octave_home (OCTAVE_DOC_CACHE_FILE);
+  if (Vdoc_cache_file.empty ())
+    {
+      std::string def_file = subst_octave_home (OCTAVE_DOC_CACHE_FILE);
 
-  std::string env_file = octave_env::getenv ("OCTAVE_DOC_CACHE_FILE");
+      std::string env_file = octave_env::getenv ("OCTAVE_DOC_CACHE_FILE");
 
-  Vdoc_cache_file = env_file.empty () ? def_file : env_file;
+      Vdoc_cache_file = env_file.empty () ? def_file : env_file;
+    }
 }
 
 static void
 set_default_texi_macros_file (void)
 {
-  std::string def_file = subst_octave_home (OCTAVE_TEXI_MACROS_FILE);
+  if (Vtexi_macros_file.empty ())
+    {
+      std::string def_file = subst_octave_home (OCTAVE_TEXI_MACROS_FILE);
 
-  std::string env_file = octave_env::getenv ("OCTAVE_TEXI_MACROS_FILE");
+      std::string env_file = octave_env::getenv ("OCTAVE_TEXI_MACROS_FILE");
 
-  Vtexi_macros_file = env_file.empty () ? def_file : env_file;
+      Vtexi_macros_file = env_file.empty () ? def_file : env_file;
+    }
 }
 
 static void
--- a/libinterp/octave.cc
+++ b/libinterp/octave.cc
@@ -146,10 +146,6 @@
 // (--path; -p)
 static std::list<std::string> command_line_path;
 
-// The file used for the doc string cache.
-// (--doc-cache-file)
-static std::string doc_cache_file;
-
 // The value for "EXEC_PATH" specified on the command line.
 // (--exec-path)
 static std::string exec_path;
@@ -162,10 +158,6 @@
 // (--no-window-system)
 static bool no_window_system = false;
 
-// The value for "texi_macros_file" specified on the command line.
-// (--texi-macros-file)
-static std::string texi_macros_file;
-
 // Usage message
 static const char *usage_string =
   "octave [-HVdfhiqvx] [--debug] [--echo-commands] [--eval CODE]\n\
@@ -773,7 +765,7 @@
 
         case DOC_CACHE_FILE_OPTION:
           if (optarg)
-            doc_cache_file = optarg;
+            Vdoc_cache_file = optarg;
           break;
 
         case EVAL_OPTION:
@@ -852,7 +844,7 @@
 
         case TEXI_MACROS_FILE_OPTION:
           if (optarg)
-            texi_macros_file = optarg;
+            Vtexi_macros_file = optarg;
           break;
 
         case TRADITIONAL_OPTION:
@@ -933,9 +925,6 @@
        it != command_line_path.end (); it++)
     load_path::set_command_line_path (*it);
 
-  if (! doc_cache_file.empty ())
-    bind_internal_variable ("doc_cache_file", doc_cache_file);
-
   if (! exec_path.empty ())
     set_exec_path (exec_path);
 
@@ -945,9 +934,6 @@
   if (no_window_system)
     display_info::no_window_system ();
 
-  if (! texi_macros_file.empty ())
-    bind_internal_variable ("texi_macros_file", texi_macros_file);
-
   if (jit_debug_option)
     bind_internal_variable ("enable_jit_debugging", true);