Mercurial > hg > octave-terminal
changeset 2412:1a1901564492
[project @ 1996-10-15 16:51:13 by jwe]
author | jwe |
---|---|
date | Tue, 15 Oct 1996 16:54:58 +0000 |
parents | 31a279f31070 |
children | 44753e0cadf2 |
files | src/ChangeLog src/op-cs-cm.cc src/op-cs-cs.cc src/op-cs-m.cc src/op-cs-s.cc src/op-s-cm.cc src/op-s-cs.cc src/op-s-m.cc src/op-s-s.cc src/ov-str-mat.h |
diffstat | 10 files changed, 135 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,36 @@ +Tue Oct 15 11:35:51 1996 John W. Eaton <jwe@bevo.che.wisc.edu> + + * op-cs-cm.cc, op-cs-cs.cc, op-cs-m.cc, op-cs-s.cc + (complex_matrix_conv): New functions. + Install preferred assignment conversion and widening ops. + + * op-s-cm.cc, op-s-cs.cc (complex_matrix_conv): New functions. + Install preferred assignment conversion and widening ops. + + * op-s-m.cc, op-s-s.cc (matrix_conv): New functions. + Install preferred assignment conversion and widening ops. + + * ov.cc (octave_value::try_assignment_with_conversion, + octave_value::convert_and_assign, octave_value::try_assignment): + New functions. + (octave_value::assign): Use them to implement twisted logic for + type conversions in assigments. + + * pt-const.h (tree_constant::maybe_mutate): New function. + * ov.h (octave_value::maybe_mutate): New function. + (octave_value::try_narrowing_conversion): New function. + Use just one typedef for widening_op_fcn and numeric_conv_fcn. + Change all uses. + * ov-base.h, ov-complex.h, ov-complex.cc, ov-cx-mat.h, + ov-cx-mat.cc, ov-range.h, ov-range.cc, ov-re-mat.h, ov-re-mat.cc, + Provide derived class versions of try try_narrowing_conversion(). + + * pr-output.cc (octave_print_internal): Don't bother handing off + to scalar/real versions, even when it would seem appropriate. + + * symtab.cc (symbol_def::define (tree_constant *)): Call + maybe_mutate on constants here. + Mon Oct 14 11:05:24 1996 John W. Eaton <jwe@bevo.che.wisc.edu> * pt-fvc.cc (tree_identifier::eval): If retval is undefined and
--- a/src/op-cs-cm.cc +++ b/src/op-cs-cm.cc @@ -206,6 +206,14 @@ s != 0.0 || m (i, j) != 0.0); } +static octave_value * +complex_matrix_conv (const octave_value& a) +{ + CAST_CONV_ARG (const octave_complex&); + + return new octave_complex_matrix (v.complex_matrix_value ()); +} + void install_cs_cm_ops (void) { @@ -227,6 +235,10 @@ INSTALL_BINOP (el_ldiv, octave_complex, octave_complex_matrix, el_ldiv); INSTALL_BINOP (el_and, octave_complex, octave_complex_matrix, el_and); INSTALL_BINOP (el_or, octave_complex, octave_complex_matrix, el_or); + + INSTALL_ASSIGNCONV (octave_complex, octave_complex_matrix, octave_complex_matrix); + + INSTALL_WIDENOP (octave_complex, octave_complex_matrix, complex_matrix_conv); } /*
--- a/src/op-cs-cs.cc +++ b/src/op-cs-cs.cc @@ -31,6 +31,7 @@ #include "gripes.h" #include "ov.h" #include "ov-complex.h" +#include "ov-cx-mat.h" #include "ov-typeinfo.h" #include "op-cs-cs.h" #include "ops.h" @@ -203,6 +204,14 @@ return v1.complex_value () != 0.0 || v2.complex_value () != 0.0; } +static octave_value * +complex_matrix_conv (const octave_value& a) +{ + CAST_CONV_ARG (const octave_complex&); + + return new octave_complex_matrix (v.complex_matrix_value ()); +} + void install_cs_cs_ops (void) { @@ -224,6 +233,10 @@ INSTALL_BINOP (el_ldiv, octave_complex, octave_complex, el_ldiv); INSTALL_BINOP (el_and, octave_complex, octave_complex, el_and); INSTALL_BINOP (el_or, octave_complex, octave_complex, el_or); + + INSTALL_ASSIGNCONV (octave_complex, octave_complex, octave_complex_matrix); + + INSTALL_WIDENOP (octave_complex, octave_complex_matrix, complex_matrix_conv); } /*
--- a/src/op-cs-m.cc +++ b/src/op-cs-m.cc @@ -31,6 +31,7 @@ #include "gripes.h" #include "ov.h" #include "ov-complex.h" +#include "ov-cx-mat.h" #include "ov-re-mat.h" #include "ov-typeinfo.h" #include "op-cs-m.h" @@ -206,6 +207,14 @@ s != 0.0 || m (i, j)); } +static octave_value * +complex_matrix_conv (const octave_value& a) +{ + CAST_CONV_ARG (const octave_complex&); + + return new octave_complex_matrix (v.complex_matrix_value ()); +} + void install_cs_m_ops (void) { @@ -227,6 +236,10 @@ INSTALL_BINOP (el_ldiv, octave_complex, octave_matrix, el_ldiv); INSTALL_BINOP (el_and, octave_complex, octave_matrix, el_and); INSTALL_BINOP (el_or, octave_complex, octave_matrix, el_or); + + INSTALL_ASSIGNCONV (octave_complex, octave_matrix, octave_complex_matrix); + + INSTALL_WIDENOP (octave_complex, octave_complex_matrix, complex_matrix_conv); } /*
--- a/src/op-cs-s.cc +++ b/src/op-cs-s.cc @@ -31,6 +31,7 @@ #include "gripes.h" #include "ov.h" #include "ov-complex.h" +#include "ov-cx-mat.h" #include "ov-scalar.h" #include "ov-typeinfo.h" #include "op-cs-s.h" @@ -204,6 +205,14 @@ return v1.complex_value () != 0.0 || v2.double_value (); } +static octave_value * +complex_matrix_conv (const octave_value& a) +{ + CAST_CONV_ARG (const octave_complex&); + + return new octave_complex_matrix (v.complex_matrix_value ()); +} + void install_cs_s_ops (void) { @@ -225,6 +234,10 @@ INSTALL_BINOP (el_ldiv, octave_complex, octave_scalar, el_ldiv); INSTALL_BINOP (el_and, octave_complex, octave_scalar, el_and); INSTALL_BINOP (el_or, octave_complex, octave_scalar, el_or); + + INSTALL_ASSIGNCONV (octave_complex, octave_scalar, octave_complex_matrix); + + INSTALL_WIDENOP (octave_complex, octave_complex_matrix, complex_matrix_conv); } /*
--- a/src/op-s-cm.cc +++ b/src/op-s-cm.cc @@ -206,6 +206,14 @@ s || m (i, j) != 0.0); } +static octave_value * +complex_matrix_conv (const octave_value& a) +{ + CAST_CONV_ARG (const octave_scalar&); + + return new octave_complex_matrix (v.complex_matrix_value ()); +} + void install_s_cm_ops (void) { @@ -227,6 +235,10 @@ INSTALL_BINOP (el_ldiv, octave_scalar, octave_complex_matrix, el_ldiv); INSTALL_BINOP (el_and, octave_scalar, octave_complex_matrix, el_and); INSTALL_BINOP (el_or, octave_scalar, octave_complex_matrix, el_or); + + INSTALL_ASSIGNCONV (octave_scalar, octave_complex_matrix, octave_complex_matrix); + + INSTALL_WIDENOP (octave_scalar, octave_complex_matrix, complex_matrix_conv); } /*
--- a/src/op-s-cs.cc +++ b/src/op-s-cs.cc @@ -32,6 +32,7 @@ #include "ov.h" #include "ov-scalar.h" #include "ov-complex.h" +#include "ov-cx-mat.h" #include "ov-typeinfo.h" #include "op-s-cs.h" #include "ops.h" @@ -204,6 +205,14 @@ return octave_value (v1.double_value () || (v2.complex_value () != 0.0)); } +static octave_value * +complex_matrix_conv (const octave_value& a) +{ + CAST_CONV_ARG (const octave_scalar&); + + return new octave_complex_matrix (v.complex_matrix_value ()); +} + void install_s_cs_ops (void) { @@ -225,6 +234,10 @@ INSTALL_BINOP (el_ldiv, octave_scalar, octave_complex, el_ldiv); INSTALL_BINOP (el_and, octave_scalar, octave_complex, el_and); INSTALL_BINOP (el_or, octave_scalar, octave_complex, el_or); + + INSTALL_ASSIGNCONV (octave_scalar, octave_complex, octave_complex_matrix); + + INSTALL_WIDENOP (octave_scalar, octave_complex_matrix, complex_matrix_conv); } /*
--- a/src/op-s-m.cc +++ b/src/op-s-m.cc @@ -202,6 +202,14 @@ s || m (i, j)); } +static octave_value * +matrix_conv (const octave_value& a) +{ + CAST_CONV_ARG (const octave_scalar&); + + return new octave_matrix (v.matrix_value ()); +} + void install_s_m_ops (void) { @@ -223,6 +231,10 @@ INSTALL_BINOP (el_ldiv, octave_scalar, octave_matrix, el_ldiv); INSTALL_BINOP (el_and, octave_scalar, octave_matrix, el_and); INSTALL_BINOP (el_or, octave_scalar, octave_matrix, el_or); + + INSTALL_ASSIGNCONV (octave_scalar, octave_matrix, octave_matrix); + + INSTALL_WIDENOP (octave_scalar, octave_matrix, matrix_conv); } /*
--- a/src/op-s-s.cc +++ b/src/op-s-s.cc @@ -31,6 +31,7 @@ #include "gripes.h" #include "ov.h" #include "ov-scalar.h" +#include "ov-re-mat.h" #include "ov-typeinfo.h" #include "op-s-s.h" #include "ops.h" @@ -203,6 +204,14 @@ return octave_value (v1.double_value () || v2.double_value ()); } +static octave_value * +matrix_conv (const octave_value& a) +{ + CAST_CONV_ARG (const octave_scalar&); + + return new octave_matrix (v.matrix_value ()); +} + void install_s_s_ops (void) { @@ -224,6 +233,10 @@ INSTALL_BINOP (el_ldiv, octave_scalar, octave_scalar, el_ldiv); INSTALL_BINOP (el_and, octave_scalar, octave_scalar, el_and); INSTALL_BINOP (el_or, octave_scalar, octave_scalar, el_or); + + INSTALL_ASSIGNCONV (octave_scalar, octave_scalar, octave_matrix); + + INSTALL_WIDENOP (octave_scalar, octave_matrix, matrix_conv); } /*