Mercurial > hg > octave-lyh
changeset 1328:ec2ab864e8eb
[project @ 1995-08-22 22:32:34 by jwe]
author | jwe |
---|---|
date | Tue, 22 Aug 1995 22:33:13 +0000 |
parents | 019ab630c727 |
children | 13b630c0aad3 |
files | src/dirfns.cc src/pr-output.cc src/pt-plot.cc src/pt-plot.h |
diffstat | 4 files changed, 33 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/src/dirfns.cc +++ b/src/dirfns.cc @@ -72,6 +72,7 @@ #include "statdefs.h" #include "procstream.h" #include "tree-const.h" +#include "tree-plot.h" #include "oct-obj.h" #include "sysdep.h" #include "octave.h" @@ -366,6 +367,19 @@ } } +static int +octave_change_to_directory (const char *newdir) +{ + int cd_ok = change_to_directory (newdir); + + if (cd_ok) + do_external_plotter_cd (newdir); + else + error ("%s: %s", newdir, strerror (errno)); + + return cd_ok; +} + DEFUN_TEXT ("cd", Fcd, Scd, 2, 1, "cd [dir]\n\ \n\ @@ -386,30 +400,21 @@ dirname = tilde_expand (argv[1]); - if (dirname && ! change_to_directory (dirname)) + if (dirname && ! octave_change_to_directory (dirname)) { - error ("%s: %s", dirname, strerror (errno)); DELETE_ARGV; return retval; } } else { - if (!home_directory) + if (! home_directory || ! octave_change_to_directory (home_directory)) { DELETE_ARGV; return retval; } - - if (!change_to_directory (home_directory)) - { - error ("%s: %s", home_directory, strerror (errno)); - DELETE_ARGV; - return retval; - } } - char *directory = get_working_directory ("cd"); tree_constant *dir = new tree_constant (directory); bind_builtin_variable ("PWD", dir, 1);
--- a/src/pr-output.cc +++ b/src/pr-output.cc @@ -929,7 +929,7 @@ } else { - for (size_t i = sizeof (double) - 1; i >= 0; i--) + for (int i = sizeof (double) - 1; i >= 0; i--) os.form ("%02x", (int) tmp.i[i]); } } @@ -955,7 +955,7 @@ { if (bit_format > 1) { - for (int i = 0; i < sizeof (double); i++) + for (size_t i = 0; i < sizeof (double); i++) PRINT_CHAR_BITS_SWAPPED (os, tmp.i[i]); } else
--- a/src/pt-plot.cc +++ b/src/pt-plot.cc @@ -1071,6 +1071,19 @@ plot_line_count = 0; } +void +do_external_plotter_cd (const char *newdir) +{ + if (plot_stream.is_open ()) + { + ostrstream plot_buf; + plot_buf << "cd \"" << newdir << "\"\n" << ends; + char *message = plot_buf.str (); + send_to_plot_stream (message); + delete [] message; + } +} + DEFUN ("clearplot", Fclearplot, Sclearplot, 0, 0, "clearplot (): clear the plot window") {