Mercurial > hg > octave-terminal
changeset 3260:cd454a6fa1a4
[project @ 1999-08-02 21:55:15 by jwe]
author | jwe |
---|---|
date | Mon, 02 Aug 1999 21:56:44 +0000 |
parents | fa345875edea |
children | 49bec5dee616 |
files | liboctave/cmd-edit.cc liboctave/file-stat.cc liboctave/file-stat.h scripts/ChangeLog scripts/plot/bar.m |
diffstat | 5 files changed, 35 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/cmd-edit.cc +++ b/liboctave/cmd-edit.cc @@ -26,7 +26,6 @@ #include <cstdlib> #include <cstring> -#include <ctime> #include <string> @@ -42,6 +41,7 @@ #include "lo-error.h" #include "lo-utils.h" #include "oct-env.h" +#include "oct-time.h" command_editor *command_editor::instance = 0; @@ -786,9 +786,9 @@ case 'd': // Make the current time/date into a string. { - time_t now = time (0); + octave_time now; - temp = ctime (&now); + temp = now.ctime (); if (c == 't') {
--- a/liboctave/file-stat.cc +++ b/liboctave/file-stat.cc @@ -137,7 +137,7 @@ // and -1 for any error. int -file_stat::is_newer (const string& file, time_t time) +file_stat::is_newer (const string& file, const octave_time& time) { file_stat fs (file);
--- a/liboctave/file-stat.h +++ b/liboctave/file-stat.h @@ -25,6 +25,8 @@ #include <string> +#include "oct-time.h" + #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif @@ -92,9 +94,9 @@ off_t size (void) const { return fs_size; } - time_t atime (void) const { return fs_atime; } - time_t mtime (void) const { return fs_mtime; } - time_t ctime (void) const { return fs_ctime; } + octave_time atime (void) const { return fs_atime; } + octave_time mtime (void) const { return fs_mtime; } + octave_time ctime (void) const { return fs_ctime; } #if defined (HAVE_ST_RDEV) dev_t rdev (void) const { return fs_rdev; } @@ -119,11 +121,11 @@ string error (void) const { return ok () ? string () : errmsg; } // Has the file referenced by this object been modified since TIME? - bool is_newer (time_t time) const { return fs_mtime > time; } + bool is_newer (const octave_time& time) const { return fs_mtime > time; } // It's nice to be able to hide the file_stat object if we don't // really care about it. - static int is_newer (const string&, time_t); + static int is_newer (const string&, const octave_time&); private: @@ -165,13 +167,13 @@ off_t fs_size; // time of last access - time_t fs_atime; + octave_time fs_atime; // time of last modification - time_t fs_mtime; + octave_time fs_mtime; // time of last file status change - time_t fs_ctime; + octave_time fs_ctime; #if defined (HAVE_ST_RDEV) // device number for special files
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +Mon Aug 2 16:39:04 1999 John W. Eaton <jwe@bevo.che.wisc.edu> + + * plot/bar.m: Compute bar widths correctly when x-values are not + evenly spaced. + Mon Jul 12 22:48:34 1999 John W. Eaton <jwe@bevo.che.wisc.edu> * linear-algebra/cond.m: Avoid returning NaN for matrices that
--- a/scripts/plot/bar.m +++ b/scripts/plot/bar.m @@ -69,24 +69,34 @@ if (xlen == ylen) len = 3 * xlen + 1; tmp_xb = tmp_yb = zeros (len, 1); - delta = (x(2) - x(1)) / 2.0; - tmp_xb(1) = x(1) - delta; + cutoff = zeros (1, xlen-1); + for i = 1:xlen-1 + cutoff(i) = (x(i) + x(i+1)) / 2.0; + endfor + delta_p = cutoff(1) - x(1); + delta_m = delta_p; + tmp_xb(1) = x(1) - delta_m; tmp_yb(1) = 0.0; k = 1; for i = 2:3:len tmp_xb(i) = tmp_xb(i-1); - tmp_xb(i+1) = tmp_xb(i) + 2.0 * delta; + tmp_xb(i+1) = x(k) + delta_p; tmp_xb(i+2) = tmp_xb(i+1); tmp_yb(i) = y(k); tmp_yb(i+1) = y(k); tmp_yb(i+2) = 0.0; if (k < xlen) - delta = (x(k+1) - x(k)) / 2.0; if (x(k+1) < x(k)) error ("bar: x vector values must be in ascending order"); endif - endif - k++; + delta_m = x(k+1) - cutoff(k); + k++; + if (k < xlen) + delta_p = cutoff(k) - x(k); + else + delta_p = delta_m; + endif + endif endfor else error ("bar: arguments must be the same length");