home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / octa21fb.zip / octave / SCRIPTS.ZIP / scripts.fat / misc / dump_pr.m < prev    next >
Text File  |  1999-12-24  |  4KB  |  116 lines

  1. ## Copyright (C) 1996, 1997 John W. Eaton
  2. ##
  3. ## This file is part of Octave.
  4. ##
  5. ## Octave is free software; you can redistribute it and/or modify it
  6. ## under the terms of the GNU General Public License as published by
  7. ## the Free Software Foundation; either version 2, or (at your option)
  8. ## any later version.
  9. ##
  10. ## Octave is distributed in the hope that it will be useful, but
  11. ## WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13. ## General Public License for more details.
  14. ##
  15. ## You should have received a copy of the GNU General Public License
  16. ## along with Octave; see the file COPYING.  If not, write to the Free
  17. ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  18. ## 02111-1307, USA.
  19.  
  20. ## usage: dump_pr (file)
  21. ##
  22. ## Have Octave dump all the current user preference variables to FILE
  23. ## in a format that can be parsed by Octave later.  If FILE is omitted,
  24. ## the listing is printed to stdout.
  25.  
  26. ## Author: jwe
  27.  
  28. function dump_pr (file)
  29.  
  30.   if (nargin == 0)
  31.     file = stdout;
  32.   endif
  33.  
  34.   ## XXX FIXME XXX -- it would be nice to be able to get the list of
  35.   ## built-in variables directly from Octave so that we wouldn't have to
  36.   ## remember to update it each time the list of preference variables
  37.   ## changes
  38.  
  39.   var_list = ["EDITOR";
  40.           "EXEC_PATH";
  41.           "IMAGEPATH";
  42.           "INFO_FILE";
  43.           "INFO_PROGRAM";
  44.           "LOADPATH";
  45.           "PAGER";
  46.           "PS1";
  47.           "PS2";
  48.           "PS4";
  49.           "automatic_replot";
  50.           "beep_on_error";
  51.           "completion_append_char";
  52.           "default_eval_print_flag";
  53.           "default_global_variable_value";
  54.           "default_return_value";
  55.           "default_save_format";
  56.           "define_all_return_values";
  57.           "do_fortran_indexing";
  58.           "echo_executing_commands";
  59.           "empty_list_elements_ok";
  60.           "fixed_point_format";
  61.           "gnuplot_binary";
  62.           "gnuplot_command_end";
  63.           "gnuplot_command_plot";
  64.           "gnuplot_command_replot";
  65.           "gnuplot_command_splot";
  66.           "gnuplot_command_title";
  67.           "gnuplot_command_using";
  68.           "gnuplot_command_with";
  69.           "gnuplot_has_frames";
  70.           "gnuplot_has_multiplt";
  71.           "history_file";
  72.           "history_size";
  73.           "ignore_function_time_stamp";
  74.           "implicit_num_to_str_ok";
  75.           "implicit_str_to_num_ok";
  76.           "initialize_global_variables";
  77.           "max_recursion_depth";
  78.           "ok_to_lose_imaginary_part";
  79.           "output_max_field_width";
  80.           "output_precision";
  81.           "page_output_immediately";
  82.           "page_screen_output";
  83.           "prefer_column_vectors";
  84.           "print_answer_id_name";
  85.           "print_empty_dimensions";
  86.           "print_rhs_assign_val";
  87.           "propagate_empty_matrices";
  88.           "resize_on_range_error";
  89.           "return_last_computed_value";
  90.           "save_precision";
  91.           "saving_history";
  92.           "silent_functions";
  93.           "split_long_rows";
  94.           "string_fill_char";
  95.           "struct_levels_to_print";
  96.           "suppress_verbose_help_message";
  97.           "treat_neg_dim_as_zero";
  98.           "warn_assign_as_truth_value";
  99.           "warn_divide_by_zero";
  100.           "warn_function_name_clash";
  101.           "warn_future_time_stamp";
  102.           "warn_missing_semicoln";
  103.           "warn_variable_switch_label";
  104.           "whitespace_in_literal_matrix"];
  105.  
  106.   for i = 1:rows(var_list)
  107.     var = deblank (var_list(i,:));
  108.     try
  109.       fprintf (file, "  %s = %s\n", var, type ("-q", var));
  110.     catch
  111.       fprintf (file, "# %s = <no value or error in displaying it>\n", var);
  112.     end_try_catch
  113.   endfor
  114.  
  115. endfunction
  116.