Mercurial > hg > octave-terminal
changeset 275:a419f80fc9a8
[project @ 1994-01-07 01:26:09 by jwe]
author | jwe |
---|---|
date | Fri, 07 Jan 1994 01:29:20 +0000 |
parents | ddf76073ce96 |
children | 4cf3c7df0e3d |
files | src/builtins.cc src/user-prefs.cc src/user-prefs.h |
diffstat | 3 files changed, 40 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/builtins.cc +++ b/src/builtins.cc @@ -1,7 +1,7 @@ // builtins.cc -*- C++ -*- /* -Copyright (C) 1992, 1993 John W. Eaton +Copyright (C) 1992, 1993, 1994 John W. Eaton This file is part of Octave. @@ -721,6 +721,9 @@ "if a function does not return any values explicitly, return the\n\ last computed value", }, + { "save_precision", "??", set_save_precision, + "number of significant figures kept by the ASCII save command", }, + { "silent_functions", "false", silent_functions, "suppress printing results in called functions", }, @@ -845,6 +848,9 @@ tmp = new tree_constant (4.0 * atan (1.0)); bind_builtin_variable ("pi", tmp, 1, 1); + tmp = new tree_constant (17.0); + bind_builtin_variable ("save_precision", tmp, 0, 1); + tmp = new tree_constant (0.0); bind_builtin_variable ("stdin", tmp, 1, 1);
--- a/src/user-prefs.cc +++ b/src/user-prefs.cc @@ -1,7 +1,7 @@ // user-prefs.cc -*- C++ -*- /* -Copyright (C) 1992, 1993 John W. Eaton +Copyright (C) 1992, 1993, 1994 John W. Eaton This file is part of Octave. @@ -401,6 +401,35 @@ } int +set_save_precision (void) +{ + int status = 0; + + static int kludge = 0; + + double val; + if (builtin_real_scalar_variable ("save_precision", val) == 0) + { + int ival = NINT (val); + if (ival >= 0 && (double) ival == val) + { + user_pref.save_precision = ival; + return status; + } + } + + if (kludge == 0) + kludge++; + else + { + warning ("invalid value specified for save_precision"); + status = -1; + } + + return status; +} + +int sv_loadpath (void) { int status = 0;
--- a/src/user-prefs.h +++ b/src/user-prefs.h @@ -1,7 +1,7 @@ // user-prefs.h -*- C++ -*- /* -Copyright (C) 1992, 1993 John W. Eaton +Copyright (C) 1992, 1993, 1994 John W. Eaton This file is part of Octave. @@ -47,6 +47,7 @@ int page_screen_output; int output_max_field_width; int output_precision; + int save_precision; char *loadpath; char *info_file; @@ -82,6 +83,7 @@ extern int set_output_max_field_width (void); extern int set_output_precision (void); +extern int set_save_precision (void); extern int sv_loadpath (void); extern int sv_info_file (void);