Mercurial > hg > octave-terminal
changeset 3685:9d8306640373
[project @ 2000-06-28 19:25:02 by jwe]
author | jwe |
---|---|
date | Wed, 28 Jun 2000 19:25:04 +0000 |
parents | f5f010fdbba5 |
children | 9507d6de9bbd |
files | liboctave/ChangeLog liboctave/boolMatrix.cc liboctave/boolMatrix.h scripts/ChangeLog src/ChangeLog src/OPERATORS/op-bm-bm.cc src/pr-output.cc |
diffstat | 7 files changed, 106 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2000-06-27 John W. Eaton <jwe@bevo.che.wisc.edu> + + * boolMatrix.h: Declare MM_CMP_OPS here. + * boolMatrix.cc: Define them here. + 2000-06-08 John W. Eaton <jwe@bevo.che.wisc.edu> * Array2-idx.h (assign): Allow x(bool) = RHS to succeed if x is
--- a/liboctave/boolMatrix.cc +++ b/liboctave/boolMatrix.cc @@ -187,6 +187,8 @@ return retval; } +MM_CMP_OPS(boolMatrix, , boolMatrix, ) + /* ;;; Local Variables: *** ;;; mode: C++ ***
--- a/liboctave/boolMatrix.h +++ b/liboctave/boolMatrix.h @@ -30,6 +30,7 @@ #include "Array2.h" #include "mx-defs.h" +#include "mx-op-defs.h" class boolMatrix : public Array2<bool> @@ -78,6 +79,8 @@ boolMatrix (bool *b, int r, int c) : Array2<bool> (b, r, c) { } }; +MM_CMP_OP_DECLS (boolMatrix, boolMatrix) + #endif /*
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,7 +1,3 @@ -2000-06-27 John W. Eaton <jwe@bevo.che.wisc.edu> - - * io/fdisp.m, io/disp.m: New files. - 2000-06-27 Matthew W. Roberts <matt@lehi.tamu.edu> * plot/plot.m: Add examples in doc string.
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2000-06-27 John W. Eaton <jwe@bevo.che.wisc.edu> + * OPERATORS/op-bm-bm.cc (eq): Define using mx_el_eq, not operator ==. + (ne): Likewise, use mx_el_ne, not operator !=. + * pr-output.cc (Fdisp): Delete. 2000-06-26 John W. Eaton <jwe@bevo.che.wisc.edu>
--- a/src/OPERATORS/op-bm-bm.cc +++ b/src/OPERATORS/op-bm-bm.cc @@ -49,8 +49,8 @@ // bool matrix by bool matrix ops. -DEFBINOP_OP (eq, bool_matrix, bool_matrix, ==) -DEFBINOP_OP (ne, bool_matrix, bool_matrix, !=) +DEFBINOP_FN (eq, bool_matrix, bool_matrix, mx_el_eq) +DEFBINOP_FN (ne, bool_matrix, bool_matrix, mx_el_ne) void install_bm_bm_ops (void)
--- a/src/pr-output.cc +++ b/src/pr-output.cc @@ -47,6 +47,7 @@ #include "error.h" #include "gripes.h" #include "oct-obj.h" +#include "oct-stream.h" #include "pager.h" #include "pr-output.h" #include "sysdep.h" @@ -1751,6 +1752,96 @@ } } +DEFUN (disp, args, nargout, + "-*- texinfo -*-\n\ +@deftypefn {Built-in Function} {} disp (@var{x})\n\ +Display the value of @var{x}. For example,\n\ +\n\ +@example\n\ +disp (\"The value of pi is:\"), disp (pi)\n\ +\n\ + @print{} the value of pi is:\n\ + @print{} 3.1416\n\ +@end example\n\ +\n\ +@noindent\n\ +Note that the output from @code{disp} always ends with a newline.\n\ +\n\ +If an output value is requested, @code{disp} prints nothing and\n\ +returns the formatted output in a string.\n\ +@end deftypefn\n\ +@seealso{fdisp}") +{ + octave_value retval; + + int nargin = args.length (); + + if (nargin == 1 && nargout < 2) + { + if (nargout == 0) + args(0).print (octave_stdout); + else + { + std::ostrstream buf; + args(0).print (buf); + buf << ends; + char *tmp = buf.str (); + retval = tmp; + delete [] tmp; + } + } + else + print_usage ("disp"); + + return retval; +} + +DEFUN (fdisp, args, , + "-*- texinfo -*-\n\ +@deftypefn {Built-in Function} {} fdisp (@var{fid}, @var{x})\n\ +Display the value of @var{x} on the stream @var{fid}. For example,\n\ +\n\ +@example\n\ +disp (stdout, \"The value of pi is:\"), disp (stdout, pi)\n\ +\n\ + @print{} the value of pi is:\n\ + @print{} 3.1416\n\ +@end example\n\ +\n\ +@noindent\n\ +Note that the output from @code{disp} always ends with a newline.\n\ +\n\ +If an output value is requested, @code{disp} prints nothing and\n\ +returns the formatted output in a string.\n\ +@end deftypefn\n\ +@seealso{disp}") +{ + octave_value retval; + + int nargin = args.length (); + + if (nargin == 2) + { + int fid = octave_stream_list::get_file_number (args (0)); + + octave_stream os = octave_stream_list::lookup (fid, "fdisp"); + + if (! error_state) + { + ostream *osp = os.output_stream (); + + if (osp) + args(1).print (*osp); + else + error ("fdisp: stream not open for writing"); + } + } + else + print_usage ("fdisp"); + + return retval; +} + static void init_format_state (void) {