changeset 2202:31b62b7c5d2d

[project @ 1996-05-15 06:07:11 by jwe]
author jwe
date Wed, 15 May 1996 06:07:55 +0000
parents e5db2ea7f7c8
children 88a4d3580427
files src/help.cc src/help.h src/pt-fcn.cc
diffstat 3 files changed, 67 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/help.cc	Wed May 15 05:37:59 1996 +0000
+++ b/src/help.cc	Wed May 15 06:07:55 1996 +0000
@@ -40,9 +40,11 @@
 
 #include "str-vec.h"
 
+#include "defaults.h"
 #include "defun.h"
 #include "dirfns.h"
 #include "error.h"
+#include "gripes.h"
 #include "help.h"
 #include "input.h"
 #include "oct-obj.h"
@@ -55,10 +57,17 @@
 #include "symtab.h"
 #include "toplev.h"
 #include "unwind-prot.h"
-#include "user-prefs.h"
 #include "utils.h"
 #include "variables.h"
 
+// Name of the info file specified on command line.
+// (--info-file file)
+string Vinfo_file;
+
+// Name of the info reader we'd like to use.
+// (--info-program program)
+string Vinfo_prog;
+
 // If TRUE, don't print additional help message in help and usage
 // functions.
 static bool Vsuppress_verbose_help_message;
@@ -483,7 +492,7 @@
 
   // Also need to search octave_path for script files.
 
-  dir_path p (user_pref.loadpath);
+  dir_path p (Vload_path);
 
   string_vector dirs = p.all_directories ();
 
@@ -496,8 +505,7 @@
       if (! names.empty ())
 	{
 	  octave_stdout << "\n*** function files in "
-			<< make_absolute (dirs[i],
-					  the_current_working_directory)
+			<< make_absolute (dirs[i], Vcurrent_directory)
 			<< ":\n\n";
 
 	  names.list_in_columns (octave_stdout);
@@ -520,9 +528,9 @@
 
   ostrstream cmd_buf;
 
-  cmd_buf << user_pref.info_prog << " --file " << user_pref.info_file;
+  cmd_buf << Vinfo_prog << " --file " << Vinfo_file;
 
-  string directory_name = user_pref.info_file;
+  string directory_name = Vinfo_file;
   size_t pos = directory_name.rfind ('/');
 
   if (pos != NPOS)
@@ -906,9 +914,51 @@
   return 0;
 }
 
+static int
+info_file (void)
+{
+  int status = 0;
+
+  string s = builtin_string_variable ("INFO_FILE");
+
+  if (s.empty ())
+    {
+      gripe_invalid_value_specified ("INFO_FILE");
+      status = -1;
+    }
+  else
+    Vinfo_file = s;
+
+  return status;
+}
+
+static int
+info_prog (void)
+{
+  int status = 0;
+
+  string s = builtin_string_variable ("INFO_PROGRAM");
+
+  if (s.empty ())
+    {
+      gripe_invalid_value_specified ("INFO_PROGRAM");
+      status = -1;
+    }
+  else
+    Vinfo_prog = s;
+
+  return status;
+}
+
 void
 symbols_of_help (void)
 {
+  DEFVAR (INFO_FILE, Vinfo_file, 0, info_file,
+    "name of the Octave info file");
+
+  DEFVAR (INFO_PROGRAM, Vinfo_prog, 0, info_prog,
+    "name of the Octave info reader");
+
 #ifdef USE_GNU_INFO
   DEFVAR (suppress_verbose_help_message, 0.0, 0, suppress_verbose_help_message,
     "suppress printing of message pointing to additional help in the\n\
--- a/src/help.h	Wed May 15 05:37:59 1996 +0000
+++ b/src/help.h	Wed May 15 06:07:55 1996 +0000
@@ -47,6 +47,14 @@
 			   const help_list *list, const string& nm,
 			   int usage);
 
+// Name of the info file specified on command line.
+// (--info-file file)
+extern string Vinfo_file;
+
+// Name of the info reader we'd like to use.
+// (--info-program program)
+extern string Vinfo_prog;
+
 extern void symbols_of_help (void);
 
 #endif
--- a/src/pt-fcn.cc	Wed May 15 05:37:59 1996 +0000
+++ b/src/pt-fcn.cc	Wed May 15 06:07:55 1996 +0000
@@ -30,6 +30,7 @@
 
 #include <iostream.h>
 
+#include "defaults.h"
 #include "defun.h"
 #include "error.h"
 #include "gripes.h"
@@ -44,7 +45,6 @@
 #include "pt-pr-code.h"
 #include "pt-walk.h"
 #include "unwind-prot.h"
-#include "user-prefs.h"
 #include "utils.h"
 #include "variables.h"
 
@@ -155,9 +155,7 @@
 
       string ff_name = fcn_file_in_path (file_name);
 
-      string system_dir = octave_fcn_file_dir ();
-
-      if (system_dir.compare (ff_name, 0, system_dir.length ()) == 0)
+      if (Vfcn_file_dir.compare (ff_name, 0, Vfcn_file_dir.length ()) == 0)
 	system_fcn_file = 1;
     }
   else
@@ -337,8 +335,7 @@
   {
     bind_nargin_and_nargout (nargin, nargout);
 
-    bool echo_commands
-      = (user_pref.echo_executing_commands & ECHO_FUNCTIONS);
+    bool echo_commands = (Vecho_executing_commands & ECHO_FUNCTIONS);
 
     if (echo_commands)
       print_code_function_header ();