comparison libinterp/octave-value/ov-flt-re-mat.cc @ 18195:1b6db9303933

allow toupper and tolower to handle numeric values (bug #33537) * ov-base-sparse.cc (octave_base_sparse<T>::map): Special case for umap_xtolower and umap_xtoupper. * ov-float.cc (octave_float_scalar::map): Likewise. * ov-flt-re-mat.cc (octave_float_matrix::map): Likewise. * ov-intx.h (OCTAVE_VALUE_INT_MATRIX_T::map, OCTAVE_VALUE_INT_SCALAR_T::map): Likewise. * ov-re-mat.cc (octave_matrix::map): Likewise. * ov-scalar.cc (octave_scalar::map): Likewise. * build-sparse-tests.sh, mappers.cc: Update tests.
author John W. Eaton <jwe@octave.org>
date Thu, 02 Jan 2014 22:44:37 -0500
parents 6a71e5030df5
children 0d5721873d6b
comparison
equal deleted inserted replaced
18194:1461b9cfac4e 18195:1b6db9303933
810 ARRAY_MAPPER (tan, float, ::tanf); 810 ARRAY_MAPPER (tan, float, ::tanf);
811 ARRAY_MAPPER (tanh, float, ::tanhf); 811 ARRAY_MAPPER (tanh, float, ::tanhf);
812 ARRAY_MAPPER (isna, bool, octave_is_NA); 812 ARRAY_MAPPER (isna, bool, octave_is_NA);
813 ARRAY_MAPPER (xsignbit, float, xsignbit); 813 ARRAY_MAPPER (xsignbit, float, xsignbit);
814 814
815 // Special cases for Matlab compatibility.
816 case umap_xtolower:
817 case umap_xtoupper:
818 return matrix;
819
815 default: 820 default:
816 return octave_base_value::map (umap); 821 // FIXME: this will break if some well-meaning person rearranges
822 // the enum list in ov-base.h.
823 if (umap >= umap_xisalnum && umap <= umap_xtoupper)
824 {
825 octave_value str_conv = convert_to_str (true, true);
826 return error_state ? octave_value () : str_conv.map (umap);
827 }
828 else
829 return octave_base_value::map (umap);
817 } 830 }
818 } 831 }
819 832
820 DEFUN (single, args, , 833 DEFUN (single, args, ,
821 "-*- texinfo -*-\n\ 834 "-*- texinfo -*-\n\