Mercurial > hg > octave-nkf
changeset 2825:60ae49e1284f
[project @ 1997-03-25 23:17:36 by jwe]
author | jwe |
---|---|
date | Tue, 25 Mar 1997 23:32:15 +0000 |
parents | e56a90687a1e |
children | d6867cd782c7 |
files | src/ChangeLog src/Makefile.in src/file-io.cc src/npsol.cc src/op-b-b.cc src/op-b-b.h src/op-bm-bm.cc src/op-bm-bm.h src/op-cm-cm.cc src/op-cm-cs.cc src/op-cm-m.cc src/op-cm-s.cc src/op-cs-cm.cc src/op-cs-m.cc src/op-m-cm.cc src/op-m-cs.cc src/op-m-m.cc src/op-m-s.cc src/op-s-cm.cc src/op-s-m.cc src/op-s-s.cc src/ops.cc src/ops.h src/ov-base.cc src/ov-base.h src/ov-re-mat.cc src/ov.cc src/ov.h src/parse.y src/pr-output.cc src/qpsol.cc src/quad.cc src/variables.cc |
diffstat | 33 files changed, 440 insertions(+), 106 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,40 @@ +Tue Mar 25 17:17:17 1997 John W. Eaton <jwe@bevo.che.wisc.edu> + + * ov.h, ov.cc, ov-base.h, ov-base.cc: Add constructors and + extractors for bool and boolMatrix types. + + * ov.cc (install_types): Register octave_bool and + octave_bool_matrix types. + + * op-cm-cm.cc, op-cm-cs.cc, op-cm-m.cc, op-cm-s.cc, op-cs-cm.cc, + op-cs-m.cc, op-m-cm.cc, op-m-cs.cc, op-m-m.cc, op-m-s.cc, + op-s-cm.cc, op-s-m.cc, op-s-s.cc, ov-re-mat.cc: + Return boolMatrix instead of Matrix object. + * ops.h (BOOL_OP3, MX_MX_BOOL_OP): Likewise. + + * op-b-b.h, op-b-b.cc, op-bm-bm.h, op-bm-bm.cc: New files. + * Makefile.in: Add them to the lists. + * ops.cc: Include header files here. + (install_ops): Call install_b_b_ops() and install_bm_bm_ops() here. + + * variables.cc (symbols_of_variables): Don't rely on default + conversion from int to double for value returned from + default_history_size(). + + * pr-output.cc: Include cstdio. + + * parse.y (param_list_end): Fix typo in last change. + + * quad.cc (quad): Cast integer return values to double. + * npsol.cc (show_npsol_option): Likewise. + * qpsol.cc (show_qpsol_option): Likewise. + * file-io.cc (Fsprintf, Ffwrite): Likewise. + +Mon Mar 24 13:11:47 1997 John W. Eaton <jwe@bevo.che.wisc.edu> + + * ov-typeinfo.cc (typeinfo): If invoked with an argument, return + the type of the argument as a string. Fix doc string. + Thu Mar 20 14:47:49 1997 John W. Eaton <jwe@bevo.che.wisc.edu> * mk-oct-links (links_dir): Don't use -h option for grep. It's
--- a/src/Makefile.in +++ b/src/Makefile.in @@ -77,9 +77,9 @@ xdiv.h xpow.h BaseSLList.h Map.h SLList.h SLStack.h Stack.h \ ov-re-mat.h ov-cx-mat.h ov-ch-mat.h ov-struct.h ov-scalar.h \ ov-range.h ov-complex.h ov-va-args.h ov-colon.h ov-base.h \ - ov-str-mat.h ov.h ov-typeinfo.h ops.h \ - op-cm-cm.h op-cm-cs.h op-cm-m.h op-cm-s.h op-cs-cm.h \ - op-cs-cs.h op-cs-m.h op-cs-s.h op-m-cm.h op-m-cs.h \ + ov-str-mat.h ov-bool-mat.h ov-bool.h ov.h ov-typeinfo.h ops.h \ + op-b-b.h op-bm-bm.h op-cm-cm.h op-cm-cs.h op-cm-m.h op-cm-s.h \ + op-cs-cm.h op-cs-cs.h op-cs-m.h op-cs-s.h op-m-cm.h op-m-cs.h \ op-m-m.h op-m-s.h op-s-cm.h op-s-cs.h op-s-m.h op-s-s.h \ op-str-str.h @@ -106,17 +106,17 @@ pager.cc parse.y pr-output.cc procstream.cc pt-base.cc \ pt-cmd.cc pt-const.cc pt-exp-base.cc pt-exp.cc pt-fcn.cc \ pt-fvc-base.cc pt-fvc.cc pt-mat.cc pt-misc.cc pt-mvr-base.cc \ - pt-mvr.cc pt-plot.cc pt-pr-code.cc \ - sighandlers.cc strcasecmp.c strncase.c strfns.cc strftime.c \ - symtab.cc syscalls.cc sysdep.cc token.cc toplev.cc \ - unwind-prot.cc utils.cc variables.cc xdiv.cc xpow.cc \ - ov-base.cc ov-ch-mat.cc ov-re-mat.cc ov-cx-mat.cc ov-range.cc \ - ov-scalar.cc ov-complex.cc ov-str-mat.cc ov-struct.cc \ - ov-va-args.cc ov-colon.cc ov.cc ov-typeinfo.cc ops.cc \ - op-cm-cm.cc op-cm-cs.cc op-cm-m.cc op-cm-s.cc op-cs-cm.cc \ - op-cs-cs.cc op-cs-m.cc op-cs-s.cc op-m-cm.cc op-m-cs.cc \ - op-m-m.cc op-m-s.cc op-s-cm.cc op-s-cs.cc op-s-m.cc op-s-s.cc \ - op-str-str.cc + pt-mvr.cc pt-plot.cc pt-pr-code.cc sighandlers.cc \ + strcasecmp.c strncase.c strfns.cc strftime.c symtab.cc \ + syscalls.cc sysdep.cc token.cc toplev.cc unwind-prot.cc \ + utils.cc variables.cc xdiv.cc xpow.cc ov-base.cc ov-ch-mat.cc \ + ov-re-mat.cc ov-cx-mat.cc ov-range.cc ov-scalar.cc \ + ov-complex.cc ov-str-mat.cc ov-struct.cc ov-va-args.cc \ + ov-colon.cc ov-bool-mat.cc ov-bool.cc ov.cc ov-typeinfo.cc \ + ops.cc op-b-b.cc op-bm-bm.cc op-cm-cm.cc op-cm-cs.cc \ + op-cm-m.cc op-cm-s.cc op-cs-cm.cc op-cs-cs.cc op-cs-m.cc \ + op-cs-s.cc op-m-cm.cc op-m-cs.cc op-m-m.cc op-m-s.cc \ + op-s-cm.cc op-s-cs.cc op-s-m.cc op-s-s.cc op-str-str.cc OBJECTS_4 := $(SOURCES) OBJECTS_3 := $(patsubst %.l, %.o, $(OBJECTS_4))
--- a/src/file-io.cc +++ b/src/file-io.cc @@ -614,7 +614,7 @@ tmp_args(i-1) = args(i); } - retval(2) = os.printf (fmt, tmp_args); + retval(2) = static_cast<double> (os.printf (fmt, tmp_args)); retval(1) = os.error (); char *tmp = ostr.str (); retval(0) = tmp; @@ -1107,7 +1107,9 @@ octave_value arch = (nargin > 4) ? args(4) : octave_value ("unknown"); - retval = do_fwrite (*os, data, prec, skip, arch); + double status = do_fwrite (*os, data, prec, skip, arch); + + retval = status; } else gripe_invalid_file_id ("fwrite");
--- a/src/npsol.cc +++ b/src/npsol.cc @@ -775,7 +775,7 @@ if (val < 0) retval = "depends on problem size"; else - retval = val; + retval = static_cast<double> (val); } return retval;
new file mode 100644 --- /dev/null +++ b/src/op-b-b.cc @@ -0,0 +1,69 @@ +/* + +Copyright (C) 1996 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#if defined (__GNUG__) +#pragma implementation +#endif + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "gripes.h" +#include "ov.h" +#include "ov-bool.h" +#include "ov-typeinfo.h" +#include "op-b-b.h" +#include "ops.h" +#include "xdiv.h" +#include "xpow.h" + +// bool by bool ops. + +static octave_value +eq (const octave_value& a1, const octave_value& a2) +{ + CAST_BINOP_ARGS (const octave_bool&, const octave_bool&); + + return octave_value (v1.bool_value () == v2.bool_value ()); +} + +static octave_value +ne (const octave_value& a1, const octave_value& a2) +{ + CAST_BINOP_ARGS (const octave_bool&, const octave_bool&); + + return octave_value (v1.bool_value () != v2.bool_value ()); +} + +void +install_b_b_ops (void) +{ + INSTALL_BINOP (eq, octave_bool, octave_bool, eq); + INSTALL_BINOP (ne, octave_bool, octave_bool, ne); +} + +/* +;;; Local Variables: *** +;;; mode: C++ *** +;;; End: *** +*/
new file mode 100644 --- /dev/null +++ b/src/op-b-b.h @@ -0,0 +1,34 @@ +/* + +Copyright (C) 1996 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#if !defined (octave_op_b_b_h) +#define octave_op_b_b_h 1 + +extern void install_b_b_ops (void); + +#endif + +/* +;;; Local Variables: *** +;;; mode: C++ *** +;;; End: *** +*/
new file mode 100644 --- /dev/null +++ b/src/op-bm-bm.cc @@ -0,0 +1,69 @@ +/* + +Copyright (C) 1996 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#if defined (__GNUG__) +#pragma implementation +#endif + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "gripes.h" +#include "ov.h" +#include "ov-bool-mat.h" +#include "ov-typeinfo.h" +#include "op-b-b.h" +#include "ops.h" +#include "xdiv.h" +#include "xpow.h" + +// bool matrix by bool matrix ops. + +static octave_value +eq (const octave_value& a1, const octave_value& a2) +{ + CAST_BINOP_ARGS (const octave_bool_matrix&, const octave_bool_matrix&); + + return octave_value (v1.bool_matrix_value () == v2.bool_matrix_value ()); +} + +static octave_value +ne (const octave_value& a1, const octave_value& a2) +{ + CAST_BINOP_ARGS (const octave_bool_matrix&, const octave_bool_matrix&); + + return octave_value (v1.bool_matrix_value () != v2.bool_matrix_value ()); +} + +void +install_bm_bm_ops (void) +{ + INSTALL_BINOP (eq, octave_bool_matrix, octave_bool_matrix, eq); + INSTALL_BINOP (ne, octave_bool_matrix, octave_bool_matrix, ne); +} + +/* +;;; Local Variables: *** +;;; mode: C++ *** +;;; End: *** +*/
new file mode 100644 --- /dev/null +++ b/src/op-bm-bm.h @@ -0,0 +1,34 @@ +/* + +Copyright (C) 1996 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#if !defined (octave_op_bm_bm_h) +#define octave_op_bm_bm_h 1 + +extern void install_bm_bm_ops (void); + +#endif + +/* +;;; Local Variables: *** +;;; mode: C++ *** +;;; End: *** +*/
--- a/src/op-cm-cm.cc +++ b/src/op-cm-cm.cc @@ -100,7 +100,7 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&); - BOOL_OP (<, Matrix (), Matrix ()); + BOOL_OP (<, boolMatrix (), boolMatrix ()); } static octave_value @@ -108,7 +108,7 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&); - BOOL_OP (<=, Matrix (), Matrix ()); + BOOL_OP (<=, boolMatrix (), boolMatrix ()); } static octave_value @@ -127,7 +127,7 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&); - BOOL_OP (>=, Matrix (), Matrix ()); + BOOL_OP (>=, boolMatrix (), boolMatrix ()); } static octave_value @@ -135,7 +135,7 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&); - BOOL_OP (>, Matrix (), Matrix ()); + BOOL_OP (>, boolMatrix (), boolMatrix ()); } static octave_value @@ -192,7 +192,7 @@ MX_MX_BOOL_OP (ComplexMatrix, m1, v1.complex_matrix_value (), ComplexMatrix, m2, v2.complex_matrix_value (), m1 (i, j) != 0.0 && m2 (i, j) != 0.0, "&", - Matrix (), Matrix ()); + boolMatrix (), boolMatrix ()); } static octave_value @@ -203,7 +203,7 @@ MX_MX_BOOL_OP (ComplexMatrix, m1, v1.complex_matrix_value (), ComplexMatrix, m2, v2.complex_matrix_value (), m1 (i, j) != 0.0 || m2 (i, j) != 0.0, "|", - Matrix (), Matrix ()); + boolMatrix (), boolMatrix ()); } static octave_value
--- a/src/op-cm-cs.cc +++ b/src/op-cm-cs.cc @@ -102,7 +102,7 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex&); - BOOL_OP (<, Matrix ()); + BOOL_OP (<, boolMatrix ()); } static octave_value @@ -110,7 +110,7 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex&); - BOOL_OP (<=, Matrix ()); + BOOL_OP (<=, boolMatrix ()); } static octave_value @@ -128,7 +128,7 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex&); - BOOL_OP (>=, Matrix ()); + BOOL_OP (>=, boolMatrix ()); } static octave_value @@ -136,7 +136,7 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex&); - BOOL_OP (>, Matrix ()); + BOOL_OP (>, boolMatrix ()); } static octave_value @@ -193,7 +193,7 @@ MX_SC_BOOL_OP (ComplexMatrix, m, v1.complex_matrix_value (), Complex, s, v2.complex_value (), - m (i, j) != 0.0 && s != 0.0, Matrix ()); + m (i, j) != 0.0 && s != 0.0, boolMatrix ()); } static octave_value @@ -203,7 +203,7 @@ MX_SC_BOOL_OP (ComplexMatrix, m, v1.complex_matrix_value (), Complex, s, v2.complex_value (), - m (i, j) != 0.0 || s != 0.0, Matrix ()); + m (i, j) != 0.0 || s != 0.0, boolMatrix ()); } static octave_value
--- a/src/op-cm-m.cc +++ b/src/op-cm-m.cc @@ -28,6 +28,9 @@ #include <config.h> #endif +#include "mx-cm-m.h" +#include "mx-m-cm.h" + #include "gripes.h" #include "ov.h" #include "ov-cx-mat.h" @@ -98,7 +101,7 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_matrix&); - BOOL_OP (<, Matrix (), Matrix ()); + BOOL_OP (<, boolMatrix (), boolMatrix ()); } static octave_value @@ -106,7 +109,7 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_matrix&); - BOOL_OP (<=, Matrix (), Matrix ()); + BOOL_OP (<=, boolMatrix (), boolMatrix ()); } static octave_value @@ -125,7 +128,7 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_matrix&); - BOOL_OP (>=, Matrix (), Matrix ()); + BOOL_OP (>=, boolMatrix (), boolMatrix ()); } static octave_value @@ -133,7 +136,7 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_matrix&); - BOOL_OP (>, Matrix (), Matrix ()); + BOOL_OP (>, boolMatrix (), boolMatrix ()); } static octave_value @@ -187,7 +190,7 @@ MX_MX_BOOL_OP (ComplexMatrix, m1, v1.complex_matrix_value (), Matrix, m2, v2.matrix_value (), m1 (i, j) != 0.0 && m2 (i, j), "&", - Matrix (), Matrix ()); + boolMatrix (), boolMatrix ()); } static octave_value @@ -198,7 +201,7 @@ MX_MX_BOOL_OP (ComplexMatrix, m1, v1.complex_matrix_value (), Matrix, m2, v2.matrix_value (), m1 (i, j) != 0.0 || m2 (i, j), "|", - Matrix (), Matrix ()); + boolMatrix (), boolMatrix ()); } static octave_value
--- a/src/op-cm-s.cc +++ b/src/op-cm-s.cc @@ -28,6 +28,8 @@ #include <config.h> #endif +#include "mx-cm-s.h" + #include "gripes.h" #include "ov.h" #include "ov-cx-mat.h" @@ -102,7 +104,7 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_scalar&); - BOOL_OP (<, Matrix ()); + BOOL_OP (<, boolMatrix ()); } static octave_value @@ -110,7 +112,7 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_scalar&); - BOOL_OP (<=, Matrix ()); + BOOL_OP (<=, boolMatrix ()); } static octave_value @@ -128,7 +130,7 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_scalar&); - BOOL_OP (>=, Matrix ()); + BOOL_OP (>=, boolMatrix ()); } static octave_value @@ -136,7 +138,7 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_scalar&); - BOOL_OP (>, Matrix ()); + BOOL_OP (>, boolMatrix ()); } static octave_value @@ -193,7 +195,7 @@ MX_SC_BOOL_OP (ComplexMatrix, m, v1.complex_matrix_value (), double, s, v2.double_value (), - m (i, j) != 0.0 && s, Matrix ()); + m (i, j) != 0.0 && s, boolMatrix ()); } static octave_value @@ -203,7 +205,7 @@ MX_SC_BOOL_OP (ComplexMatrix, m, v1.complex_matrix_value (), double, s, v2.double_value (), - m (i, j) != 0.0 || s, Matrix ()); + m (i, j) != 0.0 || s, boolMatrix ()); } static octave_value
--- a/src/op-cs-cm.cc +++ b/src/op-cs-cm.cc @@ -102,7 +102,7 @@ { CAST_BINOP_ARGS (const octave_complex&, const octave_complex_matrix&); - BOOL_OP (<, Matrix ()); + BOOL_OP (<, boolMatrix ()); } static octave_value @@ -110,7 +110,7 @@ { CAST_BINOP_ARGS (const octave_complex&, const octave_complex_matrix&); - BOOL_OP (<=, Matrix ()); + BOOL_OP (<=, boolMatrix ()); } static octave_value @@ -128,7 +128,7 @@ { CAST_BINOP_ARGS (const octave_complex&, const octave_complex_matrix&); - BOOL_OP (>=, Matrix ()); + BOOL_OP (>=, boolMatrix ()); } static octave_value @@ -136,7 +136,7 @@ { CAST_BINOP_ARGS (const octave_complex&, const octave_complex_matrix&); - BOOL_OP (>, Matrix ()); + BOOL_OP (>, boolMatrix ()); } static octave_value @@ -193,7 +193,7 @@ SC_MX_BOOL_OP (Complex, s, v1.complex_value (), ComplexMatrix, m, v2.complex_matrix_value (), - s != 0.0 && m (i, j) != 0.0, Matrix ()); + s != 0.0 && m (i, j) != 0.0, boolMatrix ()); } static octave_value @@ -203,7 +203,7 @@ SC_MX_BOOL_OP (Complex, s, v1.complex_value (), ComplexMatrix, m, v2.complex_matrix_value (), - s != 0.0 || m (i, j) != 0.0, Matrix ()); + s != 0.0 || m (i, j) != 0.0, boolMatrix ()); } static octave_value *
--- a/src/op-cs-m.cc +++ b/src/op-cs-m.cc @@ -28,6 +28,9 @@ #include <config.h> #endif +#include "mx-cs-m.h" +#include "mx-m-cs.h" + #include "gripes.h" #include "ov.h" #include "ov-complex.h" @@ -103,7 +106,7 @@ { CAST_BINOP_ARGS (const octave_complex&, const octave_matrix&); - BOOL_OP (<, Matrix ()); + BOOL_OP (<, boolMatrix ()); } static octave_value @@ -111,7 +114,7 @@ { CAST_BINOP_ARGS (const octave_complex&, const octave_matrix&); - BOOL_OP (<=, Matrix ()); + BOOL_OP (<=, boolMatrix ()); } static octave_value @@ -129,7 +132,7 @@ { CAST_BINOP_ARGS (const octave_complex&, const octave_matrix&); - BOOL_OP (>=, Matrix ()); + BOOL_OP (>=, boolMatrix ()); } static octave_value @@ -137,7 +140,7 @@ { CAST_BINOP_ARGS (const octave_complex&, const octave_matrix&); - BOOL_OP (>, Matrix ()); + BOOL_OP (>, boolMatrix ()); } static octave_value @@ -194,7 +197,7 @@ SC_MX_BOOL_OP (Complex, s, v1.complex_value (), \ Matrix, m, v2.matrix_value (), \ - s != 0.0 && m (i, j), Matrix ()); + s != 0.0 && m (i, j), boolMatrix ()); } static octave_value @@ -204,7 +207,7 @@ SC_MX_BOOL_OP (Complex, s, v1.complex_value (), \ Matrix, m, v2.matrix_value (), \ - s != 0.0 || m (i, j), Matrix ()); + s != 0.0 || m (i, j), boolMatrix ()); } static octave_value *
--- a/src/op-m-cm.cc +++ b/src/op-m-cm.cc @@ -28,6 +28,9 @@ #include <config.h> #endif +#include "mx-m-cm.h" +#include "mx-cm-m.h" + #include "gripes.h" #include "ov.h" #include "ov-re-mat.h" @@ -98,7 +101,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_complex_matrix&); - BOOL_OP (<, Matrix (), Matrix ()); + BOOL_OP (<, boolMatrix (), boolMatrix ()); } static octave_value @@ -106,7 +109,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_complex_matrix&); - BOOL_OP (<=, Matrix (), Matrix ()); + BOOL_OP (<=, boolMatrix (), boolMatrix ()); } static octave_value @@ -125,7 +128,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_complex_matrix&); - BOOL_OP (>=, Matrix (), Matrix ()); + BOOL_OP (>=, boolMatrix (), boolMatrix ()); } static octave_value @@ -133,7 +136,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_complex_matrix&); - BOOL_OP (>, Matrix (), Matrix ()); + BOOL_OP (>, boolMatrix (), boolMatrix ()); } static octave_value @@ -187,7 +190,7 @@ MX_MX_BOOL_OP (Matrix, m1, v1.matrix_value (), ComplexMatrix, m2, v2.complex_matrix_value (), m1 (i, j) && m2 (i, j) != 0.0, "&", - Matrix (), Matrix ()); + boolMatrix (), boolMatrix ()); } static octave_value @@ -198,7 +201,7 @@ MX_MX_BOOL_OP (Matrix, m1, v1.matrix_value (), ComplexMatrix, m2, v2.complex_matrix_value (), m1 (i, j) || m2 (i, j) != 0.0, "|", - Matrix (), Matrix ()); + boolMatrix (), boolMatrix ()); } static octave_value *
--- a/src/op-m-cs.cc +++ b/src/op-m-cs.cc @@ -28,6 +28,9 @@ #include <config.h> #endif +#include "mx-m-cs.h" +#include "mx-cs-m.h" + #include "gripes.h" #include "ov.h" #include "ov-re-mat.h" @@ -103,7 +106,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_complex&); - BOOL_OP (<, Matrix ()); + BOOL_OP (<, boolMatrix ()); } static octave_value @@ -111,7 +114,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_complex&); - BOOL_OP (<=, Matrix ()); + BOOL_OP (<=, boolMatrix ()); } static octave_value @@ -129,7 +132,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_complex&); - BOOL_OP (>=, Matrix ()); + BOOL_OP (>=, boolMatrix ()); } static octave_value @@ -137,7 +140,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_complex&); - BOOL_OP (>, Matrix ()); + BOOL_OP (>, boolMatrix ()); } static octave_value @@ -194,7 +197,7 @@ MX_SC_BOOL_OP (Matrix, m, v1.matrix_value (), Complex, s, v2.complex_value (), - m (i, j) && s != 0.0, Matrix ()); + m (i, j) && s != 0.0, boolMatrix ()); } static octave_value @@ -204,7 +207,7 @@ MX_SC_BOOL_OP (Matrix, m, v1.matrix_value (), Complex, s, v2.complex_value (), - m (i, j) || s != 0.0, Matrix ()); + m (i, j) || s != 0.0, boolMatrix ()); } static octave_value *
--- a/src/op-m-m.cc +++ b/src/op-m-m.cc @@ -97,7 +97,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&); - BOOL_OP (<, Matrix (), Matrix ()); + BOOL_OP (<, boolMatrix (), boolMatrix ()); } static octave_value @@ -105,7 +105,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&); - BOOL_OP (<=, Matrix (), Matrix ()); + BOOL_OP (<=, boolMatrix (), boolMatrix ()); } static octave_value @@ -121,7 +121,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&); - BOOL_OP (>=, Matrix (), Matrix ()); + BOOL_OP (>=, boolMatrix (), boolMatrix ()); } static octave_value @@ -129,7 +129,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&); - BOOL_OP (>, Matrix (), Matrix ()); + BOOL_OP (>, boolMatrix (), boolMatrix ()); } static octave_value @@ -180,7 +180,7 @@ MX_MX_BOOL_OP (Matrix, m1, v1.matrix_value (), Matrix, m2, v2.matrix_value (), m1 (i, j) && m2 (i, j), "&", - Matrix (), Matrix ()); + boolMatrix (), boolMatrix ()); } static octave_value @@ -191,7 +191,7 @@ MX_MX_BOOL_OP (Matrix, m1, v1.matrix_value (), Matrix, m2, v2.matrix_value (), m1 (i, j) || m2 (i, j), "|", - Matrix (), Matrix ()); + boolMatrix (), boolMatrix ()); } static octave_value
--- a/src/op-m-s.cc +++ b/src/op-m-s.cc @@ -102,7 +102,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_scalar&); - BOOL_OP (<, Matrix ()); + BOOL_OP (<, boolMatrix ()); } static octave_value @@ -110,7 +110,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_scalar&); - BOOL_OP (<=, Matrix ()); + BOOL_OP (<=, boolMatrix ()); } static octave_value @@ -126,7 +126,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_scalar&); - BOOL_OP (>=, Matrix ()); + BOOL_OP (>=, boolMatrix ()); } static octave_value @@ -134,7 +134,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_scalar&); - BOOL_OP (>, Matrix ()); + BOOL_OP (>, boolMatrix ()); } static octave_value @@ -189,7 +189,7 @@ MX_SC_BOOL_OP (Matrix, m, v1.matrix_value (), double, s, v2.double_value (), - m (i, j) && s, Matrix ()); + m (i, j) && s, boolMatrix ()); } static octave_value @@ -199,7 +199,7 @@ MX_SC_BOOL_OP (Matrix, m, v1.matrix_value (), double, s, v2.double_value (), - m (i, j) || s, Matrix ()); + m (i, j) || s, boolMatrix ()); } static octave_value
--- a/src/op-s-cm.cc +++ b/src/op-s-cm.cc @@ -28,6 +28,8 @@ #include <config.h> #endif +#include "mx-s-cm.h" + #include "gripes.h" #include "ov.h" #include "ov-scalar.h" @@ -102,7 +104,7 @@ { CAST_BINOP_ARGS (const octave_scalar&, const octave_complex_matrix&); - BOOL_OP (<, Matrix ()); + BOOL_OP (<, boolMatrix ()); } static octave_value @@ -110,7 +112,7 @@ { CAST_BINOP_ARGS (const octave_scalar&, const octave_complex_matrix&); - BOOL_OP (<=, Matrix ()); + BOOL_OP (<=, boolMatrix ()); } static octave_value @@ -128,7 +130,7 @@ { CAST_BINOP_ARGS (const octave_scalar&, const octave_complex_matrix&); - BOOL_OP (>=, Matrix ()); + BOOL_OP (>=, boolMatrix ()); } static octave_value @@ -136,7 +138,7 @@ { CAST_BINOP_ARGS (const octave_scalar&, const octave_complex_matrix&); - BOOL_OP (>, Matrix ()); + BOOL_OP (>, boolMatrix ()); } static octave_value @@ -193,7 +195,7 @@ SC_MX_BOOL_OP (double, s, v1.double_value (), ComplexMatrix, m, v2.complex_matrix_value (), - s && m (i, j) != 0.0, Matrix ()); + s && m (i, j) != 0.0, boolMatrix ()); } static octave_value @@ -203,7 +205,7 @@ SC_MX_BOOL_OP (double, s, v1.double_value (), ComplexMatrix, m, v2.complex_matrix_value (), - s || m (i, j) != 0.0, Matrix ()); + s || m (i, j) != 0.0, boolMatrix ()); } static octave_value *
--- a/src/op-s-m.cc +++ b/src/op-s-m.cc @@ -102,7 +102,7 @@ { CAST_BINOP_ARGS (const octave_scalar&, const octave_matrix&); - BOOL_OP (<, Matrix ()); + BOOL_OP (<, boolMatrix ()); } static octave_value @@ -110,7 +110,7 @@ { CAST_BINOP_ARGS (const octave_scalar&, const octave_matrix&); - BOOL_OP (<=, Matrix ()); + BOOL_OP (<=, boolMatrix ()); } static octave_value @@ -126,7 +126,7 @@ { CAST_BINOP_ARGS (const octave_scalar&, const octave_matrix&); - BOOL_OP (>=, Matrix ()); + BOOL_OP (>=, boolMatrix ()); } static octave_value @@ -134,7 +134,7 @@ { CAST_BINOP_ARGS (const octave_scalar&, const octave_matrix&); - BOOL_OP (>, Matrix ()); + BOOL_OP (>, boolMatrix ()); } static octave_value @@ -189,7 +189,7 @@ SC_MX_BOOL_OP (double, s, v1.double_value (), Matrix, m, v2.matrix_value (), - s && m (i, j), Matrix ()); + s && m (i, j), boolMatrix ()); } static octave_value @@ -199,7 +199,7 @@ SC_MX_BOOL_OP (double, s, v1.double_value (), Matrix, m, v2.matrix_value (), - s || m (i, j), Matrix ()); + s || m (i, j), boolMatrix ()); } static octave_value *
--- a/src/op-s-s.cc +++ b/src/op-s-s.cc @@ -193,7 +193,9 @@ { CAST_BINOP_ARGS (const octave_scalar&, const octave_scalar&); - return octave_value (v1.double_value () && v2.double_value ()); + double result = v1.double_value () && v2.double_value (); + + return octave_value (result); } static octave_value @@ -201,7 +203,9 @@ { CAST_BINOP_ARGS (const octave_scalar&, const octave_scalar&); - return octave_value (v1.double_value () || v2.double_value ()); + double result = v1.double_value () || v2.double_value (); + + return octave_value (result); } static octave_value *
--- a/src/ops.cc +++ b/src/ops.cc @@ -30,6 +30,8 @@ #include "ov-base.h" +#include "op-b-b.h" +#include "op-bm-bm.h" #include "op-cm-cm.h" #include "op-cm-cs.h" #include "op-cm-m.h" @@ -53,6 +55,8 @@ { install_base_type_conversions (); + install_b_b_ops (); + install_bm_bm_ops (); install_cm_cm_ops (); install_cm_cs_ops (); install_cm_m_ops ();
--- a/src/ops.h +++ b/src/ops.h @@ -54,7 +54,7 @@ int nc = x.columns (); #define BOOL_OP3(test) \ - Matrix retval (nr, nc); \ + boolMatrix retval (nr, nc); \ for (int j = 0; j < nc; j++) \ for (int i = 0; i < nr; i++) \ retval (i, j) = test; \ @@ -109,7 +109,7 @@ { \ gripe_nonconformant ("operator " op, m1_nr, m1_nc, \ m2_nr, m2_nc); \ - return Matrix (); \ + return boolMatrix (); \ } \ } \ } \
--- a/src/ov-base.cc +++ b/src/ov-base.cc @@ -177,6 +177,23 @@ return retval; } +bool +octave_base_value::bool_value (void) const +{ + bool retval = false; + gripe_wrong_type_arg ("octave_base_value::bool_value()", type_name ()); + return retval; +} + +boolMatrix +octave_base_value::bool_matrix_value (void) const +{ + boolMatrix retval; + gripe_wrong_type_arg ("octave_base_value::bool_matrix_value()", + type_name ()); + return retval; +} + octave_value octave_base_value::not (void) const {
--- a/src/ov-base.h +++ b/src/ov-base.h @@ -150,6 +150,10 @@ Octave_map map_value (void) const; + bool bool_value (void) const; + + boolMatrix bool_matrix_value (void) const; + octave_value not (void) const; octave_value uminus (void) const;
--- a/src/ov-re-mat.cc +++ b/src/ov-re-mat.cc @@ -59,8 +59,6 @@ matrix ((pcv < 0 && Vprefer_column_vectors) || pcv ? Matrix (v) : Matrix (v.transpose ())) { } -#include <iostream.h> - octave_value * octave_matrix::try_narrowing_conversion (void) {
--- a/src/ov.cc +++ b/src/ov.cc @@ -32,6 +32,8 @@ #include "ov.h" #include "ov-base.h" +#include "ov-bool.h" +#include "ov-bool-mat.h" #include "ov-scalar.h" #include "ov-re-mat.h" #include "ov-complex.h" @@ -221,10 +223,16 @@ } octave_value::octave_value (void) - : rep (new octave_base_value ()) { rep->count = 1; } + : rep (new octave_base_value ()) +{ + rep->count = 1; +} octave_value::octave_value (double d) - : rep (new octave_scalar (d)) { rep->count = 1; } + : rep (new octave_scalar (d)) +{ + rep->count = 1; +} octave_value::octave_value (const Matrix& m) : rep (new octave_matrix (m)) @@ -289,6 +297,19 @@ maybe_mutate (); } +octave_value::octave_value (bool b) + : rep (new octave_bool (b)) +{ + rep->count = 1; +} + +octave_value::octave_value (const boolMatrix& bm) + : rep (new octave_bool_matrix (bm)) +{ + rep->count = 1; + maybe_mutate (); +} + octave_value::octave_value (const char *s) : rep (new octave_char_matrix_str (s)) { @@ -337,16 +358,28 @@ } octave_value::octave_value (const Octave_map& m) - : rep (new octave_struct (m)) { rep->count = 1; } + : rep (new octave_struct (m)) +{ + rep->count = 1; + } octave_value::octave_value (octave_value::magic_colon) - : rep (new octave_magic_colon ()) { rep->count = 1; } + : rep (new octave_magic_colon ()) +{ + rep->count = 1; +} octave_value::octave_value (octave_value::all_va_args) - : rep (new octave_all_va_args ()) { rep->count = 1; } + : rep (new octave_all_va_args ()) +{ + rep->count = 1; +} octave_value::octave_value (octave_value *new_rep) - : rep (new_rep) { rep->count = 1; } + : rep (new_rep) +{ + rep->count = 1; +} octave_value::~octave_value (void) { @@ -761,6 +794,8 @@ octave_matrix::register_type (); octave_complex_matrix::register_type (); octave_range::register_type (); + octave_bool::register_type (); + octave_bool_matrix::register_type (); octave_char_matrix::register_type (); octave_char_matrix_str::register_type (); octave_struct::register_type ();
--- a/src/ov.h +++ b/src/ov.h @@ -118,6 +118,8 @@ octave_value (const ComplexDiagMatrix& d); octave_value (const ComplexRowVector& v, int pcv = -1); octave_value (const ComplexColumnVector& v, int pcv = -1); + octave_value (bool b); + octave_value (const boolMatrix& bm); octave_value (const char *s); octave_value (const string& s); octave_value (const string_vector& s); @@ -324,6 +326,12 @@ virtual Octave_map map_value (void) const; + virtual bool bool_value (void) const + { return rep->bool_value (); } + + virtual boolMatrix bool_matrix_value (void) const + { return rep->bool_matrix_value (); } + // Unary ops. virtual octave_value not (void) const { return rep->not (); }
--- a/src/parse.y +++ b/src/parse.y @@ -1053,7 +1053,7 @@ ; param_list_end : ')' - { lexer_flags.looking_at_parameter_list = 1; } + { lexer_flags.looking_at_parameter_list = 0; } ; param_list : param_list_beg param_list_end
--- a/src/pr-output.cc +++ b/src/pr-output.cc @@ -25,6 +25,7 @@ #endif #include <cfloat> +#include <cstdio> #include <cstring> #include <string>
--- a/src/qpsol.cc +++ b/src/qpsol.cc @@ -409,7 +409,7 @@ if (val < 0) retval = "depends on problem size"; else - retval = val; + retval = static_cast<double> (val); } return retval;
--- a/src/quad.cc +++ b/src/quad.cc @@ -244,8 +244,8 @@ } retval(3) = abserr; - retval(2) = nfun; - retval(1) = ier; + retval(2) = static_cast<double> (nfun); + retval(1) = static_cast<double> (ier); retval(0) = val; return retval;
--- a/src/variables.cc +++ b/src/variables.cc @@ -1630,7 +1630,9 @@ DEFVAR (history_file, default_history_file (), 0, history_file, "name of command history file"); - DEFVAR (history_size, default_history_size (), 0, history_size, + double tmp_hist_size = default_history_size (); + + DEFVAR (history_size, tmp_hist_size, 0, history_size, "number of commands to save in the history list"); DEFVAR (ignore_function_time_stamp, "system", 0, ignore_function_time_stamp,