Mercurial > hg > octave-max
changeset 111:e4acc68c9c60
[project @ 1993-09-17 06:06:30 by jwe]
(symbol_record::save (ostream&, int)): Don't print a warning for ans
being undefined. Call warning to print the message, and change the
text to make it clearer.
(symbol_table::save (ostream&, int)): Don't crash if there aren't any
symbols to save.
author | jwe |
---|---|
date | Fri, 17 Sep 1993 06:06:30 +0000 |
parents | 7573fac6f629 |
children | 3438ee77fea2 |
files | src/symtab.cc |
diffstat | 1 files changed, 15 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/symtab.cc +++ b/src/symtab.cc @@ -412,7 +412,12 @@ else if (fcn != (symbol_def *) NULL) message ("save", "sorry, can't save functions yet"); else - message ("save", "can't save undefined symbols!"); + { +// Kludge! We probably don't want to print warnings for ans, but it +// does seem reasonable to print them for other undefined variables. + if (strcmp (nm, "ans") != 0) + warning ("not saving undefined symbol `%s'", nm); + } return status; } @@ -653,10 +658,16 @@ symbol_table::save (ostream& os, int mark_as_global = 0) { int status = 0; - for (char **names = sorted_var_list (); *names != (char *) NULL; names++) + char **names = sorted_var_list (); + if (names != (char **) NULL) { - if (save (os, *names, mark_as_global)) - status++; + while (*names != (char *) NULL) + { + if (save (os, *names, mark_as_global)) + status++; + + names++; + } } return status; }