changeset 2205:bd389b53befa

[project @ 1996-05-15 06:15:45 by jwe]
author jwe
date Wed, 15 May 1996 06:18:02 +0000
parents a24158362f9f
children 9be05ffc288a
files src/input.cc src/oct-hist.cc src/octave.cc src/symtab.cc src/variables.cc
diffstat 5 files changed, 192 insertions(+), 461 deletions(-) [+]
line wrap: on
line diff
--- a/src/input.cc	Wed May 15 06:11:57 1996 +0000
+++ b/src/input.cc	Wed May 15 06:18:02 1996 +0000
@@ -77,7 +77,6 @@
 #include "sighandlers.h"
 #include "symtab.h"
 #include "sysdep.h"
-#include "user-prefs.h"
 #include "utils.h"
 #include "variables.h"
 
@@ -244,7 +243,7 @@
 
 	    case 's':
 	      {
-		temp = base_pathname (prog_name);
+		temp = base_pathname (Vprogram_name);
 
 		goto add_string;
 	      }
@@ -257,7 +256,7 @@
 		// Use the value of PWD because it is much more
 		// effecient.
 
-		temp = user_pref.pwd;
+		temp = Vcurrent_directory;
 
 		if (temp.empty ())
 		  temp = octave_getcwd ();
@@ -280,14 +279,14 @@
       
 	    case 'u':
 	      {
-		temp = user_name;
+		temp = Vuser_name;
 
 		goto add_string;
 	      }
 
 	    case 'h':
 	      {
-		temp = host_name;
+		temp = Vhost_name;
 
 		size_t pos = temp.find ('.');
 
@@ -376,8 +375,8 @@
 do_input_echo (const string& input_string)
 {
   int do_echo = reading_script_file ?
-    (user_pref.echo_executing_commands & ECHO_SCRIPTS)
-      : (user_pref.echo_executing_commands & ECHO_CMD_LINE);
+    (Vecho_executing_commands & ECHO_SCRIPTS)
+      : (Vecho_executing_commands & ECHO_CMD_LINE);
 
   if (do_echo)
     {
@@ -1154,8 +1153,8 @@
     {
     case 1:
       {
-	int echo_cmds = user_pref.echo_executing_commands;
-	if ((echo_cmds & ECHO_SCRIPTS) || (echo_cmds & ECHO_FUNCTIONS))
+	if ((Vecho_executing_commands & ECHO_SCRIPTS)
+	    || (Vecho_executing_commands & ECHO_FUNCTIONS))
 	  bind_builtin_variable ("echo_executing_commands", ECHO_OFF);
 	else
 	  bind_builtin_variable ("echo_executing_commands", ECHO_SCRIPTS);
--- a/src/oct-hist.cc	Wed May 15 06:11:57 1996 +0000
+++ b/src/oct-hist.cc	Wed May 15 06:18:02 1996 +0000
@@ -48,6 +48,7 @@
 #include "file-ops.h"
 #include "str-vec.h"
 
+#include "defaults.h"
 #include "defun.h"
 #include "error.h"
 #include "input.h"
@@ -58,8 +59,8 @@
 #include "sysdep.h"
 #include "toplev.h"
 #include "unwind-prot.h"
-#include "user-prefs.h"
 #include "utils.h"
+#include "variables.h"
 
 // Nonzero means input is coming from temporary history file.
 int input_from_tmp_history_file = 0;
@@ -104,9 +105,9 @@
 
   if (file.empty ())
     {
-      if (! home_directory.empty ())
+      if (! Vhome_directory.empty ())
 	{
-	  file = home_directory;
+	  file = Vhome_directory;
 	  file.append ("/.octave_hist");
 	}
       else
@@ -417,7 +418,7 @@
 
   // Call up our favorite editor on the file of commands.
 
-  string cmd = user_pref.editor;
+  string cmd = Veditor;
   cmd.append (" ");
   cmd.append (name);
 
@@ -463,9 +464,9 @@
   // sense.
 
   begin_unwind_frame ("do_edit_history");
-  unwind_protect_int (user_pref.echo_executing_commands);
+  unwind_protect_int (Vecho_executing_commands);
   unwind_protect_int (input_from_tmp_history_file);
-  user_pref.echo_executing_commands = ECHO_CMD_LINE;
+  Vecho_executing_commands = ECHO_CMD_LINE;
   input_from_tmp_history_file = 1;
 
   parse_and_execute (name, 1);
@@ -490,9 +491,9 @@
   // sense.
 
   begin_unwind_frame ("do_run_history");
-  unwind_protect_int (user_pref.echo_executing_commands);
+  unwind_protect_int (Vecho_executing_commands);
   unwind_protect_int (input_from_tmp_history_file);
-  user_pref.echo_executing_commands = ECHO_CMD_LINE;
+  Vecho_executing_commands = ECHO_CMD_LINE;
   input_from_tmp_history_file = 1;
 
   parse_and_execute (name, 1);
--- a/src/octave.cc	Wed May 15 06:11:57 1996 +0000
+++ b/src/octave.cc	Wed May 15 06:18:02 1996 +0000
@@ -68,7 +68,6 @@
 #include "pt-misc.h"
 #include "pt-plot.h"
 #include "unwind-prot.h"
-#include "user-prefs.h"
 #include "utils.h"
 #include "variables.h"
 #include "version.h"
@@ -189,38 +188,22 @@
     program_invocation_short_name = program_invocation_name;
 #endif
 
-  raw_prog_name = name;
-  size_t pos = raw_prog_name.rfind ('/');
-  if (pos == NPOS)
-    prog_name = raw_prog_name;
-  else
-    prog_name = raw_prog_name.substr (pos+1);
+  Vprogram_invocation_name = name;
+  size_t pos = Vprogram_invocation_name.rfind ('/');
+  Vprogram_name = (pos == NPOS)
+    ? Vprogram_invocation_name : Vprogram_invocation_name.substr (pos+1);
 
   struct passwd *entry = getpwuid (getuid ());
-  if (entry)
-    user_name = entry->pw_name;
-  else
-    user_name = "I have no name!";
-  endpwent ();
+  Vuser_name = entry ? entry->pw_name : "I have no name!";
 
   char hostname[256];
-  if (gethostname (hostname, 255) < 0)
-    host_name = "I have no host!";
-  else
-    host_name = hostname;
+  int status = gethostname (hostname, 255);
+  Vhost_name = (status < 0) ? "I have no host!" : hostname;
 
   char *hd = getenv ("HOME");
-  home_directory = hd ? hd : "I have no home!";
-
-  exec_path = default_exec_path ();
-
-  load_path = default_path ();
+  Vhome_directory = hd ? hd : "I have no home!";
 
-  info_file = default_info_file ();
-
-  info_prog = default_info_prog ();
-
-  editor = default_editor ();
+  install_defaults ();
 }
 
 static void
@@ -260,10 +243,8 @@
   // files.
 
   unwind_protect_int (input_from_startup_file);
-  unwind_protect_int (user_pref.echo_executing_commands);
 
   input_from_startup_file = 1;
-  user_pref.echo_executing_commands = ECHO_OFF;
 
   int verbose = (verbose_flag && ! inhibit_startup_message);
 
@@ -272,19 +253,17 @@
   // then from the file $(prefix)/lib/octave/$(version)/m/octaverc (if
   // it exists).
 
-  string lsd = get_local_site_defaults ();
-  parse_and_execute (lsd, 0, verbose);
+  parse_and_execute (Vlocal_site_defaults_file, 0, verbose);
 
-  string sd = get_site_defaults ();
-  parse_and_execute (sd, 0, verbose);
+  parse_and_execute (Vsite_defaults_file, 0, verbose);
 
   // Try to execute commands from $HOME/.octaverc and ./.octaverc.
 
   int home_rc_already_executed = 0;
   string home_rc;
-  if (! home_directory.empty ())
+  if (! Vhome_directory.empty ())
     {
-      home_rc = home_directory;
+      home_rc = Vhome_directory;
       home_rc.append ("/.octaverc");
       parse_and_execute (home_rc, 0, verbose);
 
@@ -389,13 +368,12 @@
 int
 main (int argc, char **argv)
 {
-  int echo_commands = ECHO_OFF;
-
-  // The order of these calls is important, and initialize_globals
-  // must come before the options are processed because some command
-  // line options override defaults.
-
-  init_user_prefs ();
+  // The order of these calls is important.  The call to
+  // initialize_globals must come before install_builtins because
+  // default variable values must be available for the varaibles to be
+  // installed, and the call to install_builtins must come before the
+  // options are processed because some command line options override
+  // defaults by calling bind_builtin_variable.
 
   sysdep_init ();
 
@@ -405,6 +383,14 @@
 
   initialize_pathsearch ();
 
+  install_signal_handlers ();
+
+  initialize_file_io ();
+
+  initialize_symbol_tables ();  
+
+  install_builtins ();
+
   prog_args args (argc, argv, short_opts, long_opts);
 
   int optc;
@@ -435,7 +421,7 @@
 
 	case 'p':
 	  if (args.optarg ())
-	    load_path = string (args.optarg ());
+	    bind_builtin_variable ("LOADPATH", args.optarg ());
 	  break;
 
 	case 'q':
@@ -443,7 +429,10 @@
 	  break;
 
 	case 'x':
-	  echo_commands = (ECHO_SCRIPTS | ECHO_FUNCTIONS | ECHO_CMD_LINE);
+	  {
+	    double tmp = (ECHO_SCRIPTS | ECHO_FUNCTIONS | ECHO_CMD_LINE);
+	    bind_builtin_variable ("echo_executing_commands", tmp);
+	  }
 	  break;
 
 	case 'v':
@@ -452,17 +441,17 @@
 
 	case EXEC_PATH_OPTION:
 	  if (args.optarg ())
-	    exec_path = string (args.optarg ());
+	    bind_builtin_variable ("EXEC_PATH", args.optarg ());
 	  break;
 
 	case INFO_FILE_OPTION:
 	  if (args.optarg ())
-	    info_file = string (args.optarg ());
+	    bind_builtin_variable ("INFO_FILE", args.optarg ());
 	  break;
 
 	case INFO_PROG_OPTION:
 	  if (args.optarg ())
-	    info_prog = string (args.optarg ());
+	    bind_builtin_variable ("INFO_PROGRAM", args.optarg ());
 	  break;
 
 	case NO_LINE_EDITING_OPTION:
@@ -492,14 +481,6 @@
   // These can come after command line args since none of them set any
   // defaults that might be changed by command line options.
 
-  install_signal_handlers ();
-
-  initialize_file_io ();
-
-  initialize_symbol_tables ();  
-
-  install_builtins ();
-
   initialize_readline ();
 
   init_dynamic_linker ();
@@ -510,9 +491,6 @@
   if (traditional)
     maximum_braindamage ();
 
-  bind_builtin_variable ("echo_executing_commands",
-			 (double) echo_commands);
-
   if (read_init_files)
     execute_startup_files ();
 
--- a/src/symtab.cc	Wed May 15 06:11:57 1996 +0000
+++ b/src/symtab.cc	Wed May 15 06:18:02 1996 +0000
@@ -38,7 +38,6 @@
 #include "pt-fcn.h"
 #include "pt-fvc.h"
 #include "symtab.h"
-#include "user-prefs.h"
 #include "utils.h"
 #include "variables.h"
 
@@ -626,18 +625,7 @@
     {
       if (is_variable ())
 	{
-	  if (user_pref.read_only_constants)
-	    {
-	      if (user_pref.read_only_constants < 0)
-		{
-		  ::warning ("redefinition of constant `%s'",
-			     nm.c_str ());
-		  return 0;
-		}
-	      else
-		::error ("can't redefine read-only constant `%s'",
-			 nm.c_str ());
-	    }
+	  ::error ("can't redefine read-only constant `%s'", nm.c_str ());
 	}
       else if (is_function ())
 	{
--- a/src/variables.cc	Wed May 15 06:11:57 1996 +0000
+++ b/src/variables.cc	Wed May 15 06:18:02 1996 +0000
@@ -45,14 +45,19 @@
 #include "oct-glob.h"
 #include "str-vec.h"
 
+#include "arith-ops.h"
 #include "defaults.h"
+#include "data.h"
 #include "defun.h"
 #include "dirfns.h"
 #include "dynamic-ld.h"
 #include "error.h"
+#include "file-io.h"
+#include "gripes.h"
 #include "help.h"
 #include "input.h"
 #include "lex.h"
+#include "load-save.h"
 #include "mappers.h"
 #include "oct-hist.h"
 #include "toplev.h"
@@ -69,12 +74,34 @@
 #include "pt-plot.h"
 #include "pr-output.h"
 #include "syscalls.h"
+#include "toplev.h"
 #include "unwind-prot.h"
-#include "user-prefs.h"
 #include "utils.h"
 #include "variables.h"
 #include "version.h"
 
+// Echo commands as they are executed?
+//
+//   1  ==>  echo commands read from script files
+//   2  ==>  echo commands from functions
+//   4  ==>  echo commands read from command line
+//
+// more than one state can be active at once.
+int Vecho_executing_commands;
+
+// Where history is saved.
+static string Vhistory_file;
+
+// The number of lines to keep in the history file.
+static int Vhistory_size;
+
+// Should Octave always check to see if function files have changed
+// since they were last compiled?
+static bool Vignore_function_time_stamp;
+
+// TRUE if we are saving history.
+static int Vsaving_history;
+
 // Symbol table for symbols at the top level.
 symbol_table *top_level_sym_tab = 0;
 
@@ -299,206 +326,13 @@
   return retval;
 }
 
-// XXX FIXME XXX -- should these really be here?
-
-static string
-octave_home (void)
-{
-  char *oh = getenv ("OCTAVE_HOME");
-
-  return oh ? string (oh) : string (OCTAVE_PREFIX);
-}
-
-static string
-subst_octave_home (const string& s)
-{
-  string retval;
-
-  string home = octave_home ();
-  string prefix = OCTAVE_PREFIX;
-
-  retval = s;
-
-  if (home != prefix)
-    {
-      int len = prefix.length ();
-      size_t start = 0;
-      while ((start = s.find (prefix)) != NPOS)
-	{
-	  retval.replace (start, len, home);
-	  start++;
-	}
-    }
-
-  return retval;
-}
-
-static string
-octave_info_dir (void)
-{
-  return subst_octave_home (OCTAVE_INFODIR);
-}
-
-string
-octave_arch_lib_dir (void)
-{
-  return subst_octave_home (OCTAVE_ARCHLIBDIR);
-}
-
-string
-octave_fcn_file_dir (void)
-{
-  return subst_octave_home (OCTAVE_FCNFILEDIR);
-}
-
-string
-octave_bin_dir (void)
-{
-  return subst_octave_home (OCTAVE_BINDIR);
-}
-
-string
-maybe_add_default_load_path (const string& pathstring)
-{
-  string std_path = subst_octave_home (OCTAVE_FCNFILEPATH);
-
-  string retval;
-
-  if (! pathstring.empty ())
-    {
-      if (pathstring[0] == SEPCHAR)
-	{
-	  retval = std_path;
-	  retval.append (pathstring);
-	}
-      else
-	retval = pathstring;
-
-      if (pathstring[pathstring.length () - 1] == SEPCHAR)
-	retval.append (std_path);
-    }
-
-  return retval;
-}
-
-string
-octave_lib_dir (void)
-{
-  return subst_octave_home (OCTAVE_LIBDIR);
-}
-
-string
-default_exec_path (void)
-{
-  string exec_path_string;
-
-  char *octave_exec_path = getenv ("OCTAVE_EXEC_PATH");
-
-  if (octave_exec_path)
-    exec_path_string = string (octave_exec_path);
-  else
-    {
-      char *shell_path = getenv ("PATH");
-
-      if (shell_path)
-	{
-	  exec_path_string = string (":");
-	  exec_path_string.append (shell_path);
-	}
-    }
-
-  return exec_path_string;
-}
-
-// Handle OCTAVE_PATH from the environment like TeX handles TEXINPUTS.
-// If the path starts with `:', prepend the standard path.  If it ends
-// with `:' append the standard path.  If it begins and ends with
-// `:', do both (which is useless, but the luser asked for it...).
-
-string
-default_path (void)
-{
-  string std_path = subst_octave_home (OCTAVE_FCNFILEPATH);
-
-  char *oct_path = getenv ("OCTAVE_PATH");
-
-  return oct_path ? string (oct_path) : std_path;
-}
-
-string
-default_info_file (void)
-{
-  string info_file_string;
-
-  char *oct_info_file = getenv ("OCTAVE_INFO_FILE");
-
-  if (oct_info_file)
-    info_file_string = string (oct_info_file);
-  else
-    {
-      string infodir = octave_info_dir ();
-      info_file_string = infodir.append ("/octave.info");
-    }
-
-  return info_file_string;
-}
-
-string
-default_info_prog (void)
-{
-  string info_prog_string;
-
-  char *oct_info_prog = getenv ("OCTAVE_INFO_PROGRAM");
-
-  if (oct_info_prog)
-    info_prog_string = string (oct_info_prog);
-  else
-    {
-      string archdir = octave_arch_lib_dir ();
-      info_prog_string = archdir.append ("/info");
-    }
-
-  return info_prog_string;
-}
-
-string
-default_editor (void)
-{
-  string editor_string = "vi";
-
-  char *env_editor = getenv ("EDITOR");
-
-  if (env_editor && *env_editor)
-    editor_string = string (env_editor);
-
-  return editor_string;
-}
-
-string
-get_local_site_defaults (void)
-{
-  string startupdir = subst_octave_home (OCTAVE_LOCALSTARTUPFILEDIR);
-  return startupdir.append ("/octaverc");
-}
-
-string
-get_site_defaults (void)
-{
-  string startupdir = subst_octave_home (OCTAVE_STARTUPFILEDIR);
-  return startupdir.append ("/octaverc");
-}
-
-// Functions for looking up variables and functions.
-
 // Is there a corresponding function file that is newer than the
 // symbol definition?
 
 static int
 symbol_out_of_date (symbol_record *sr)
 {
-  int ignore = user_pref.ignore_function_time_stamp;
-
-  if (ignore == 2)
+  if (Vignore_function_time_stamp == 2)
     return 0;
 
   if (sr)
@@ -507,7 +341,9 @@
       if (ans)
 	{
 	  string ff = ans->fcn_file_name ();
-	  if (! ff.empty () && ! (ignore && ans->is_system_fcn_file ()))
+	  if (! ff.empty ()
+	      && ! (Vignore_function_time_stamp
+		    && ans->is_system_fcn_file ()))
 	    {
 	      time_t tp = ans->time_parsed ();
 
@@ -664,7 +500,7 @@
 static void
 restore_command_history (void *)
 {
-  octave_command_history.ignore_entries (! user_pref.saving_history);
+  octave_command_history.ignore_entries (! Vsaving_history);
 }
 
 static int
@@ -704,18 +540,18 @@
 	{
 	  // XXX FIXME XXX -- we shouldn't need both the
 	  // octave_command_history object and the
-	  // user_pref.saving_history variable...
+	  // Vsaving_history variable...
 	  octave_command_history.ignore_entries ();
 
 	  add_unwind_protect (restore_command_history, 0);
 
-	  unwind_protect_int (user_pref.echo_executing_commands);
-	  unwind_protect_int (user_pref.saving_history);
+	  unwind_protect_int (Vecho_executing_commands);
+	  unwind_protect_int (Vsaving_history);
 	  unwind_protect_int (reading_fcn_file);
 	  unwind_protect_int (input_from_command_line_file);
 
-	  user_pref.echo_executing_commands = ECHO_OFF;
-	  user_pref.saving_history = 0;
+	  Vecho_executing_commands = ECHO_OFF;
+	  Vsaving_history = 0;
 	  reading_fcn_file = 1;
 	  input_from_command_line_file = 0;
 
@@ -750,15 +586,15 @@
 
 	  // XXX FIXME XXX -- we shouldn't need both the
 	  // octave_command_history object and the
-	  // user_pref.saving_history variable...
+	  // Vsaving_history variable...
 	  octave_command_history.ignore_entries ();
 
 	  add_unwind_protect (restore_command_history, 0);
 
-	  unwind_protect_int (user_pref.saving_history);
+	  unwind_protect_int (Vsaving_history);
 	  unwind_protect_int (reading_script_file);
 
-	  user_pref.saving_history = 0;
+	  Vsaving_history = 0;
 	  reading_script_file = 1;
 
 	  parse_and_execute (ffile, 1);
@@ -1555,75 +1391,103 @@
   bind_builtin_variable (varname, tc, protect, eternal, sv_fcn, help);
 }
 
-// XXX FIXME XX -- these should probably be moved to where they
-// logically belong instead of being all grouped here.
+// XXX FIXME XXX -- some of these should do their own checking to be
+// able to provide more meaningful warning or error messages.
+
+static int
+echo_executing_commands (void)
+{
+  Vecho_executing_commands = check_preference ("echo_executing_commands"); 
+
+  return 0;
+}
+
+static int
+history_size (void)
+{
+  double val;
+  if (builtin_real_scalar_variable ("history_size", val)
+      && ! xisnan (val))
+    {
+      int ival = NINT (val);
+      if (ival >= 0 && (double) ival == val)
+	{
+	  Vhistory_size = ival;
+	  octave_command_history.set_size (ival);
+	  return 0;
+	}
+    }
+  gripe_invalid_value_specified ("history_size");
+  return -1;
+}
+
+static int
+history_file (void)
+{
+  int status = 0;
+
+  string s = builtin_string_variable ("history_file");
 
-// This is split up to try to make compiling with gcc consume less
-// memory and go a little faster.
+  if (s.empty ())
+    {
+      gripe_invalid_value_specified ("history_file");
+      status = -1;
+    }
+  else
+    {
+      Vhistory_file = s;
+      octave_command_history.set_file (oct_tilde_expand (s));
+    }
+
+  return status;
+}
+
+static int
+ignore_function_time_stamp (void)
+{
+  int pref = 0;
+
+  string val = builtin_string_variable ("ignore_function_time_stamp");
+
+  if (! val.empty ())
+    {
+      if (val.compare ("all", 0, 3) == 0)
+	pref = 2;
+      if (val.compare ("system", 0, 6) == 0)
+	pref = 1;
+    }
+
+  Vignore_function_time_stamp = pref;
+
+  return 0;
+}
+
+static int
+saving_history (void)
+{
+  Vsaving_history = check_preference ("saving_history");
+
+  octave_command_history.ignore_entries (! Vsaving_history);
+
+  return 0;
+}
+
+// XXX FIXME XXX -- there still may be better places for some of these
+// to be defined.
 
 static void
-install_builtin_variables_1 (void)
+symbols_of_variables (void)
 {
-  DEFVAR (EDITOR, editor, 0, sv_editor,
-    "name of the editor to be invoked by the edit_history command");
-
-  DEFVAR (EXEC_PATH, exec_path, 0, sv_exec_path,
-    "colon separated list of directories to search for programs to run");
-
-  DEFCONST (I, Complex (0.0, 1.0), 0, 0,
-    "sqrt (-1)");
-
-  DEFCONST (Inf, octave_Inf, 0, 0,
-    "infinity");
-
-  DEFVAR (INFO_FILE, info_file, 0, sv_info_file,
-    "name of the Octave info file");
-
-  DEFVAR (INFO_PROGRAM, info_prog, 0, sv_info_prog,
-    "name of the Octave info reader");
-
-  DEFCONST (J, Complex (0.0, 1.0), 0, 0,
-    "sqrt (-1)");
-
-  DEFCONST (NaN, octave_NaN, 0, 0,
-    "not a number");
-
-  DEFVAR (LOADPATH, load_path, 0, sv_loadpath,
-    "colon separated list of directories to search for scripts");
-
-  DEFVAR (IMAGEPATH, OCTAVE_IMAGEPATH, 0,
-	  sv_imagepath,
-    "colon separated list of directories to search for image files");
-}
-
-static void
-install_builtin_variables_2 (void)
-{
-  DEFCONSTX ("OCTAVE_VERSION", SBV_OCTAVE_VERSION, OCTAVE_VERSION, 0, 0,
-    "Octave version");
-
-  DEFCONST (PWD, get_working_directory ("initialize_globals"), 0, sv_pwd,
-    "current working directory");
-
-  DEFCONST (SEEK_SET, 0.0, 0, 0,
-    "used with fseek to position file relative to the beginning");
-
-  DEFCONST (SEEK_CUR, 1.0, 0, 0,
-    "used with fseek to position file relative to the current position");
-
-  DEFCONST (SEEK_END, 2.0, 0, 0,
-    "used with fseek to position file relative to the end");
-
   DEFVAR (ans, , 0, 0,
     "");
-}
 
-static void
-install_builtin_variables_3 (void)
-{
   DEFCONST (argv, , 0, 0,
     "the command line arguments this program was invoked with");
 
+  DEFVAR (echo_executing_commands, (double) ECHO_OFF, 0,
+	  echo_executing_commands,
+    "echo commands as they are executed");
+
   DEFCONST (error_text, "", 0, 0,
     "the text of error messages that would have been printed in the
 body of the most recent unwind_protect statement or the TRY part of\n\
@@ -1631,140 +1495,40 @@
 eval(), or if no error has ocurred within them, the value of\n\
 __error_text__ is guaranteed to be the empty string.");
 
-  DEFVAR (default_save_format, "ascii", 0, sv_default_save_format,
-    "default format for files created with save, may be one of\n\
-\"binary\", \"text\", or \"mat-binary\"");
-
-  DEFVAR (echo_executing_commands, 0.0, 0, echo_executing_commands,
-    "echo commands as they are executed");
-}
-
-static void
-install_builtin_variables_4 (void)
-{
-#if defined (M_E)
-  double e_val = M_E;
-#else
-  double e_val = exp (1.0);
-#endif
-
-  DEFCONST (e, e_val, 0, 0,
-    "exp (1)");
-
-  DEFCONST (eps, DBL_EPSILON, 0, 0,
-    "machine precision");
-
-  DEFVAR (history_file, default_history_file (), 0, sv_history_file,
+  DEFVAR (history_file, default_history_file (), 0, history_file,
     "name of command history file");
 
   DEFVAR (history_size, default_history_size (), 0, history_size,
     "number of commands to save in the history list");
 
-  DEFCONST (i, Complex (0.0, 1.0), 1, 0,
-    "sqrt (-1)");
-
   DEFVAR (ignore_function_time_stamp, "system", 0, ignore_function_time_stamp,
     "don't check to see if function files have changed since they were\n\
   last compiled.  Possible values are \"system\" and \"all\"");
-}
 
-static void
-install_builtin_variables_5 (void)
-{
-  DEFCONST (inf, octave_Inf, 0, 0,
-    "infinity");
-
-  DEFCONST (j, Complex (0.0, 1.0), 1, 0,
-    "sqrt (-1)");
-
-  DEFCONST (nan, octave_NaN, 0, 0,
-    "not a number");
-
-#if defined (M_PI)
-  double pi_val = M_PI;
-#else
-  double pi_val = 4.0 * atan (1.0);
-#endif
-
-  DEFCONST (pi, pi_val, 0, 0,
-    "ratio of the circumference of a circle to its diameter");
-}
-
-static void
-install_builtin_variables_6 (void)
-{
-  DEFVAR (print_answer_id_name, 1.0, 0, print_answer_id_name,
-    "set output style to print `var_name = ...'");
-
-  DEFCONST (program_invocation_name, raw_prog_name, 0, 0,
+  DEFCONST (program_invocation_name, Vprogram_invocation_name, 0, 0,
     "the full name of the current program or script, including the\n\
 directory specification");
 
-  DEFCONST (program_name, prog_name, 0, 0,
+  DEFCONST (program_name, Vprogram_name, 0, 0,
     "the name of the current program or script");
 
-#if 0
-  DEFVAR (read_only_constants, 1.0, 0, read_only_constants,
-    "allow built-in constants to be modified");
-#endif
-
-  DEFCONST (realmax, DBL_MAX, 0, 0,
-    "realmax (): return largest representable floating point number");
-
-  DEFCONST (realmin, DBL_MIN, 0, 0,
-    "realmin (): return smallest representable floating point number");
-}
-
-static void
-install_builtin_variables_7 (void)
-{
-  DEFVAR (save_precision, 15.0, 0, set_save_precision,
-    "number of significant figures kept by the ASCII save command");
-
   DEFVAR (saving_history, 1.0, 0, saving_history,
     "save command history");
-
-#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\
-help and usage functions");
-#endif
-
-  DEFCONSTX ("stdin", SBV_stdin, 0.0, 0, 0,
-    "file number of the standard input stream");
-
-  DEFCONSTX ("stdout", SBV_stderr, 1.0, 0, 0,
-    "file number of the standard output stream");
-
-  DEFCONSTX ("stderr", SBV_stderr, 2.0, 0, 0,
-    "file number of the standard error stream");
-
-  DEFVAR (treat_neg_dim_as_zero, 0.0, 0, treat_neg_dim_as_zero,
-    "convert negative dimensions to zero");
-}
-
-static void
-install_builtin_variables_8 (void)
-{
-  DEFVAR (warn_divide_by_zero, 1.0, 0, warn_divide_by_zero,
-    "on IEEE machines, allow divide by zero errors to be suppressed");
 }
 
 void
 install_builtin_variables (void)
 {
-  install_builtin_variables_1 ();
-  install_builtin_variables_2 ();
-  install_builtin_variables_3 ();
-  install_builtin_variables_4 ();
-  install_builtin_variables_5 ();
-  install_builtin_variables_6 ();
-  install_builtin_variables_7 ();
-  install_builtin_variables_8 ();
-
+  symbols_of_arith_ops ();
+  symbols_of_data ();
+  symbols_of_defaults ();
+  symbols_of_dirfns ();
   symbols_of_error ();
+  symbols_of_file_io ();
+  symbols_of_help ();
   symbols_of_input ();
   symbols_of_lex ();
+  symbols_of_load_save ();
   symbols_of_pager ();
   symbols_of_parse ();
   symbols_of_pr_output ();
@@ -1773,6 +1537,7 @@
   symbols_of_pt_mat ();
   symbols_of_pt_plot ();
   symbols_of_syscalls ();
+  symbols_of_variables ();
 }
 
 // Deleting names from the symbol tables.