comparison libinterp/octave-value/ov-typeinfo.cc @ 30857:95725e6ad9c1 stable

restore part of the old octave_range class as octave_legacy_range This change allows old range objects to be loaded from data files and then converted to the new range type or other numeric types. * libinterp/octave-value/ov-legacy-range.h, libinterp/octave-value/ov-legacy-range.cc: New files restored from old versions of ov-range.h and ov-range.cc. Only provide enough support to load "range" objects from data files. * libinterp/octave-value/module.mk: Update. * ov.h, ov.cc: Update tests. (octave_value::is_legacy_object): New function. (octave_value::load_ascii, octave_value::load_binary, octave_value::load_hdf5): If loaded value is a legacy object, call maybe_mutate to allow conversion to a currently supported data type. (install_types): Register octave_legacy_range objects. (octave_value::make_range_rep_deprecated): Convert to Don't allow (const Range& r, bool force_range) (octave_value::make_range_rep_deprecated): Use Range constructor. Allow mutation to handle conversion to new range object or other numeric types. * ov-base.h (octave_base_value::is_legacy_object): New function * ov-range.cc: Rename ov_range<double> data type from "range" to "double_range". * Range.h (Range::Range): Always provide deprecated Range constructors. * ov-typeinfo.cc: Update test. * mk-conv-tst.sh: Update tests.
author John W. Eaton <jwe@octave.org>
date Mon, 21 Mar 2022 23:58:35 -0400
parents 796f54d4ddbf
children eba0a86471b9
comparison
equal deleted inserted replaced
30855:82c1554c4a64 30857:95725e6ad9c1
946 %!assert (typeinfo ([i, 2]), "complex matrix") 946 %!assert (typeinfo ([i, 2]), "complex matrix")
947 %!assert (typeinfo (diag ([i, 2])), "complex diagonal matrix") 947 %!assert (typeinfo (diag ([i, 2])), "complex diagonal matrix")
948 948
949 %!test 949 %!test
950 %! if (optimize_range ()) 950 %! if (optimize_range ())
951 %! assert (typeinfo (1:2), "range") 951 %! assert (typeinfo (1:2), "double_range")
952 %! else 952 %! else
953 %! assert (typeinfo (1:2), "matrix") 953 %! assert (typeinfo (1:2), "matrix")
954 %! endif 954 %! endif
955 955
956 %!assert (typeinfo (false), "bool") 956 %!assert (typeinfo (false), "bool")