# HG changeset patch # User jwe # Date 962220304 0 # Node ID 9d8306640373e15779f70f8d88546d796c1c1bf5 # Parent f5f010fdbba546c464d68ea9983ea11ac59e5a2b [project @ 2000-06-28 19:25:02 by jwe] diff -r f5f010fdbba5 -r 9d8306640373 liboctave/ChangeLog --- a/liboctave/ChangeLog Wed Jun 28 18:42:45 2000 +0000 +++ b/liboctave/ChangeLog Wed Jun 28 19:25:04 2000 +0000 @@ -1,3 +1,8 @@ +2000-06-27 John W. Eaton + + * boolMatrix.h: Declare MM_CMP_OPS here. + * boolMatrix.cc: Define them here. + 2000-06-08 John W. Eaton * Array2-idx.h (assign): Allow x(bool) = RHS to succeed if x is diff -r f5f010fdbba5 -r 9d8306640373 liboctave/boolMatrix.cc --- a/liboctave/boolMatrix.cc Wed Jun 28 18:42:45 2000 +0000 +++ b/liboctave/boolMatrix.cc Wed Jun 28 19:25:04 2000 +0000 @@ -187,6 +187,8 @@ return retval; } +MM_CMP_OPS(boolMatrix, , boolMatrix, ) + /* ;;; Local Variables: *** ;;; mode: C++ *** diff -r f5f010fdbba5 -r 9d8306640373 liboctave/boolMatrix.h --- a/liboctave/boolMatrix.h Wed Jun 28 18:42:45 2000 +0000 +++ b/liboctave/boolMatrix.h Wed Jun 28 19:25:04 2000 +0000 @@ -30,6 +30,7 @@ #include "Array2.h" #include "mx-defs.h" +#include "mx-op-defs.h" class boolMatrix : public Array2 @@ -78,6 +79,8 @@ boolMatrix (bool *b, int r, int c) : Array2 (b, r, c) { } }; +MM_CMP_OP_DECLS (boolMatrix, boolMatrix) + #endif /* diff -r f5f010fdbba5 -r 9d8306640373 scripts/ChangeLog --- a/scripts/ChangeLog Wed Jun 28 18:42:45 2000 +0000 +++ b/scripts/ChangeLog Wed Jun 28 19:25:04 2000 +0000 @@ -1,7 +1,3 @@ -2000-06-27 John W. Eaton - - * io/fdisp.m, io/disp.m: New files. - 2000-06-27 Matthew W. Roberts * plot/plot.m: Add examples in doc string. diff -r f5f010fdbba5 -r 9d8306640373 src/ChangeLog --- a/src/ChangeLog Wed Jun 28 18:42:45 2000 +0000 +++ b/src/ChangeLog Wed Jun 28 19:25:04 2000 +0000 @@ -1,5 +1,8 @@ 2000-06-27 John W. Eaton + * 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 diff -r f5f010fdbba5 -r 9d8306640373 src/OPERATORS/op-bm-bm.cc --- a/src/OPERATORS/op-bm-bm.cc Wed Jun 28 18:42:45 2000 +0000 +++ b/src/OPERATORS/op-bm-bm.cc Wed Jun 28 19:25:04 2000 +0000 @@ -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) diff -r f5f010fdbba5 -r 9d8306640373 src/pr-output.cc --- a/src/pr-output.cc Wed Jun 28 18:42:45 2000 +0000 +++ b/src/pr-output.cc Wed Jun 28 19:25:04 2000 +0000 @@ -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) {