Mercurial > hg > octave-nkf
changeset 5073:e71be9c548f2
[project @ 2004-11-09 18:31:25 by jwe]
line wrap: on
line diff
--- a/liboctave/CNDArray.cc +++ b/liboctave/CNDArray.cc @@ -654,27 +654,24 @@ } ComplexNDArray -concat (const ComplexNDArray& ra, const ComplexNDArray& rb, - const Array<int>& ra_idx) +ComplexNDArray::concat (const ComplexNDArray& rb, const Array<int>& ra_idx) { - ComplexNDArray retval (ra); if (rb.numel () > 0) - retval.insert (rb, ra_idx); - return retval; + insert (rb, ra_idx); + return *this; } ComplexNDArray -concat (const ComplexNDArray& ra, const NDArray& rb, const Array<int>& ra_idx) +ComplexNDArray::concat (const NDArray& rb, const Array<int>& ra_idx) { - ComplexNDArray retval (ra); ComplexNDArray tmp (rb); if (rb.numel () > 0) - retval.insert (tmp, ra_idx); - return retval; + insert (tmp, ra_idx); + return *this; } ComplexNDArray -concat (const NDArray& ra, const ComplexNDArray& rb, const Array<int>& ra_idx) +concat (NDArray& ra, ComplexNDArray& rb, const Array<int>& ra_idx) { ComplexNDArray retval (ra); if (rb.numel () > 0)
--- a/liboctave/CNDArray.h +++ b/liboctave/CNDArray.h @@ -76,13 +76,8 @@ ComplexNDArray prod (int dim = -1) const; ComplexNDArray sum (int dim = -1) const; ComplexNDArray sumsq (int dim = -1) const; - friend ComplexNDArray concat (const ComplexNDArray& ra, - const ComplexNDArray& rb, - const Array<int>& ra_idx); - friend ComplexNDArray concat (const ComplexNDArray& ra, const NDArray& rb, - const Array<int>& ra_idx); - friend ComplexNDArray concat (const NDArray& ra, const ComplexNDArray& rb, - const Array<int>& ra_idx); + ComplexNDArray concat (const ComplexNDArray& rb, const Array<int>& ra_idx); + ComplexNDArray concat (const NDArray& rb, const Array<int>& ra_idx); ComplexNDArray max (int dim = 0) const; ComplexNDArray max (ArrayN<int>& index, int dim = 0) const;
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,35 @@ +2004-11-09 David Bateman <dbateman@free.fr> + + * dNDArray.cc (concat): Delete. + (NDArray::concat): New methods. + * dNDArray.h: Provide decls. + + * CNDArray.cc (concat): Delete. + (ComplexNDArray::concat): New methods. + * CNDArray.h: Provide decls. + + * boolNDArray.cc (concat): Delete. + (boolNDArray::concat): New methods. + * boolNDArray.h: Provide decls. + + * chNDArray.cc (concat): Delete. + (charNDArray::concat): New methods. + * chNDArray.h: Provide decls. + + * oct-inttypes.h (OCTAVE_INT_CONCAT_FN, OCTAVE_INT_CONCAT_DECL): + Delete macros. + + * int8NDArray.h, int16NDArray.h, int32NDArray.h, int64NDArray.h, + uint8NDArray.h, uint16NDArray.h, uint32NDArray.h, uint64NDArray.h + (OCTAVE_INT_CONCAT_DECL): Delete use of macro. + + * int8NDArray.cc, int16NDArray.cc, int32NDArray.cc, int64NDArray.cc, + uint8NDArray.cc, uint16NDArray.cc, uint32NDArray.cc, uint64NDArray.cc + (OCTAVE_INT_CONCAT_FN): Delete use of macro. + + * intNDArray.cc (intNDArray<T>::concat): New method. + * intNDArray.h: Provide decl. + 2004-11-08 John W. Eaton <jwe@octave.org> * oct-inttypes.cc: New file.
--- a/liboctave/boolNDArray.cc +++ b/liboctave/boolNDArray.cc @@ -62,12 +62,11 @@ } boolNDArray -concat (const boolNDArray& ra, const boolNDArray& rb, const Array<int>& ra_idx) +boolNDArray::concat (const boolNDArray& rb, const Array<int>& ra_idx) { - boolNDArray retval (ra); if (rb.numel () > 0) - retval.insert (rb, ra_idx); - return retval; + insert (rb, ra_idx); + return *this; } boolNDArray&
--- a/liboctave/boolNDArray.h +++ b/liboctave/boolNDArray.h @@ -70,8 +70,7 @@ boolNDArray all (int dim = -1) const; boolNDArray any (int dim = -1) const; - friend boolNDArray concat (const boolNDArray& ra, const boolNDArray& rb, - const Array<int>& ra_idx); + boolNDArray concat (const boolNDArray& rb, const Array<int>& ra_idx); boolNDArray& insert (const boolNDArray& a, int r, int c); boolNDArray& insert (const boolNDArray& a, const Array<int>& ra_idx);
--- a/liboctave/chNDArray.cc +++ b/liboctave/chNDArray.cc @@ -50,23 +50,21 @@ } charNDArray -concat (const charNDArray& ra, const charNDArray& rb, const Array<int>& ra_idx) +charNDArray::concat (const charNDArray& rb, const Array<int>& ra_idx) { - charNDArray retval (ra); if (rb.numel () > 0) - retval.insert (rb, ra_idx); - return retval; + insert (rb, ra_idx); + return *this; } charNDArray -concat (const charNDArray& ra, const NDArray& rb, const Array<int>& ra_idx) +charNDArray::concat (const NDArray& rb, const Array<int>& ra_idx) { - charNDArray retval (ra); charNDArray tmp (rb.dims ()); int nel = rb.numel (); if (rb.numel () == 0) - return retval; + return *this; for (int i = 0; i < nel; i++) { @@ -76,7 +74,7 @@ { (*current_liboctave_error_handler) ("invalid conversion from NaN to character"); - return retval; + return *this; } else { @@ -91,44 +89,8 @@ } } - retval.insert (tmp, ra_idx); - return retval; -} - -charNDArray -concat (const NDArray& ra, const charNDArray& rb, const Array<int>& ra_idx) -{ - charNDArray retval (ra.dims ()); - int nel = ra.numel (); - - for (int i = 0; i < nel; i++) - { - double d = ra.elem (i); - - if (xisnan (d)) - { - (*current_liboctave_error_handler) - ("invalid conversion from NaN to character"); - return retval; - } - else - { - int ival = NINT (d); - - if (ival < 0 || ival > UCHAR_MAX) - // XXX FIXME XXX -- is there something - // better we could do? Should we warn the user? - ival = 0; - - retval.elem (i) = static_cast<char>(ival); - } - } - - if (rb.numel () == 0) - return retval; - - retval.insert (rb, ra_idx); - return retval; + insert (tmp, ra_idx); + return *this; } charNDArray&
--- a/liboctave/chNDArray.h +++ b/liboctave/chNDArray.h @@ -68,12 +68,8 @@ boolNDArray all (int dim = -1) const; boolNDArray any (int dim = -1) const; - friend charNDArray concat (const charNDArray& ra, const charNDArray& rb, - const Array<int>& ra_idx); - friend charNDArray concat (const charNDArray& ra, const NDArray& rb, - const Array<int>& ra_idx); - friend charNDArray concat (const NDArray& ra, const charNDArray& rb, - const Array<int>& ra_idx); + charNDArray concat (const charNDArray& rb, const Array<int>& ra_idx); + charNDArray concat (const NDArray& rb, const Array<int>& ra_idx); charNDArray& insert (const charNDArray& a, int r, int c); charNDArray& insert (const charNDArray& a, const Array<int>& ra_idx);
--- a/liboctave/dNDArray.cc +++ b/liboctave/dNDArray.cc @@ -793,14 +793,58 @@ } NDArray -concat (const NDArray& ra, const NDArray& rb, const Array<int>& ra_idx) +NDArray::concat (const NDArray& rb, const Array<int>& ra_idx) { - NDArray retval (ra); + if (rb.numel () > 0) + insert (rb, ra_idx); + return *this; +} + +ComplexNDArray +NDArray::concat (const ComplexNDArray& rb, const Array<int>& ra_idx) +{ + ComplexNDArray retval (*this); if (rb.numel () > 0) retval.insert (rb, ra_idx); return retval; } +charNDArray +NDArray::concat (const charNDArray& rb, const Array<int>& ra_idx) +{ + charNDArray retval (dims ()); + int nel = numel (); + + for (int i = 0; i < nel; i++) + { + double d = elem (i); + + if (xisnan (d)) + { + (*current_liboctave_error_handler) + ("invalid conversion from NaN to character"); + return retval; + } + else + { + int ival = NINT (d); + + if (ival < 0 || ival > UCHAR_MAX) + // XXX FIXME XXX -- is there something + // better we could do? Should we warn the user? + ival = 0; + + retval.elem (i) = static_cast<char>(ival); + } + } + + if (rb.numel () == 0) + return retval; + + retval.insert (rb, ra_idx); + return retval; +} + NDArray real (const ComplexNDArray& a) {
--- a/liboctave/dNDArray.h +++ b/liboctave/dNDArray.h @@ -81,8 +81,9 @@ NDArray prod (int dim = -1) const; NDArray sum (int dim = -1) const; NDArray sumsq (int dim = -1) const; - friend NDArray concat (const NDArray& ra, const NDArray& rb, - const Array<int>& ra_idx); + NDArray concat (const NDArray& rb, const Array<int>& ra_idx); + ComplexNDArray concat (const ComplexNDArray& rb, const Array<int>& ra_idx); + charNDArray concat (const charNDArray& rb, const Array<int>& ra_idx); NDArray max (int dim = 0) const; NDArray max (ArrayN<int>& index, int dim = 0) const;
--- a/liboctave/int16NDArray.cc +++ b/liboctave/int16NDArray.cc @@ -45,8 +45,6 @@ std::istream& operator >> (std::istream& is, intNDArray<octave_int16>& a); -OCTAVE_INT_CONCAT_FN (octave_int16) - NDS_CMP_OPS (int16NDArray, , octave_int16, ) NDS_BOOL_OPS (int16NDArray, octave_int16, octave_int16 (0))
--- a/liboctave/int16NDArray.h +++ b/liboctave/int16NDArray.h @@ -33,8 +33,6 @@ typedef intNDArray<octave_int16> int16NDArray; -OCTAVE_INT_CONCAT_DECL (octave_int16) - NDS_CMP_OP_DECLS (int16NDArray, octave_int16) NDS_BOOL_OP_DECLS (int16NDArray, octave_int16)
--- a/liboctave/int32NDArray.cc +++ b/liboctave/int32NDArray.cc @@ -45,8 +45,6 @@ std::istream& operator >> (std::istream& is, intNDArray<octave_int32>& a); -OCTAVE_INT_CONCAT_FN (octave_int32) - NDS_CMP_OPS (int32NDArray, , octave_int32, ) NDS_BOOL_OPS (int32NDArray, octave_int32, octave_int32 (0))
--- a/liboctave/int32NDArray.h +++ b/liboctave/int32NDArray.h @@ -33,8 +33,6 @@ typedef intNDArray<octave_int32> int32NDArray; -OCTAVE_INT_CONCAT_DECL (octave_int32) - NDS_CMP_OP_DECLS (int32NDArray, octave_int32) NDS_BOOL_OP_DECLS (int32NDArray, octave_int32)
--- a/liboctave/int64NDArray.cc +++ b/liboctave/int64NDArray.cc @@ -43,8 +43,6 @@ std::istream& operator >> (std::istream& is, intNDArray<octave_int64>& a); -OCTAVE_INT_CONCAT_FN (octave_int64) - NDS_CMP_OPS (int64NDArray, , octave_int64, ) NDS_BOOL_OPS (int64NDArray, octave_int64, octave_int64 (0))
--- a/liboctave/int64NDArray.h +++ b/liboctave/int64NDArray.h @@ -33,8 +33,6 @@ typedef intNDArray<octave_int64> int64NDArray; -OCTAVE_INT_CONCAT_DECL (octave_int64) - NDS_CMP_OP_DECLS (int64NDArray, octave_int64) NDS_BOOL_OP_DECLS (int64NDArray, octave_int64)
--- a/liboctave/int8NDArray.cc +++ b/liboctave/int8NDArray.cc @@ -45,8 +45,6 @@ std::istream& operator >> (std::istream& is, intNDArray<octave_int8>& a); -OCTAVE_INT_CONCAT_FN (octave_int8) - NDS_CMP_OPS (int8NDArray, , octave_int8, ) NDS_BOOL_OPS (int8NDArray, octave_int8, octave_int8 (0))
--- a/liboctave/int8NDArray.h +++ b/liboctave/int8NDArray.h @@ -33,8 +33,6 @@ typedef intNDArray<octave_int8> int8NDArray; -OCTAVE_INT_CONCAT_DECL (octave_int8) - NDS_CMP_OP_DECLS (int8NDArray, octave_int8) NDS_BOOL_OP_DECLS (int8NDArray, octave_int8)
--- a/liboctave/intNDArray.cc +++ b/liboctave/intNDArray.cc @@ -81,6 +81,15 @@ } template <class T> +intNDArray<T> +intNDArray<T>::concat (const intNDArray<T>& rb, const Array<int>& ra_idx) +{ + if (rb.numel () > 0); + insert (rb, ra_idx); + return *this; +} + +template <class T> intNDArray<T>& intNDArray<T>::insert (const intNDArray<T>& a, int r, int c) {
--- a/liboctave/intNDArray.h +++ b/liboctave/intNDArray.h @@ -76,6 +76,8 @@ intNDArray transpose (void) const { return intNDArray<T> (MArrayN<T>::transpose ()); } + intNDArray concat (const intNDArray<T>& rb, const Array<int>& ra_idx); + intNDArray& insert (const intNDArray<T>& a, int r, int c); intNDArray& insert (const intNDArray<T>& a, const Array<int>& ra_idx);
--- a/liboctave/oct-inttypes.h +++ b/liboctave/oct-inttypes.h @@ -620,21 +620,6 @@ OCTAVE_TYPE2_CMP_OP_DECLS (octave_uint32_t, octave_int64_t) -#define OCTAVE_INT_CONCAT_FN(TYPE) \ -intNDArray< TYPE > \ -concat (const intNDArray< TYPE >& ra, const intNDArray< TYPE >& rb, \ - const Array<int>& ra_idx) \ -{ \ - intNDArray< TYPE > retval (ra); \ - retval.insert (rb, ra_idx); \ - return retval; \ -} - -#define OCTAVE_INT_CONCAT_DECL(TYPE) \ -intNDArray< TYPE > \ -concat (const intNDArray< TYPE >& ra, const intNDArray< TYPE >& rb, \ - const Array<int>& ra_idx); - #undef OCTAVE_INT_BINOP_TRAIT #undef OCTAVE_US_S_FTR #undef OCTAVE_US_S_FTR_FCNS
--- a/liboctave/uint16NDArray.cc +++ b/liboctave/uint16NDArray.cc @@ -45,8 +45,6 @@ std::istream& operator >> (std::istream& is, intNDArray<octave_uint16>& a); -OCTAVE_INT_CONCAT_FN (octave_uint16) - NDS_CMP_OPS (uint16NDArray, , octave_uint16, ) NDS_BOOL_OPS (uint16NDArray, octave_uint16, octave_uint16 (0))
--- a/liboctave/uint16NDArray.h +++ b/liboctave/uint16NDArray.h @@ -33,8 +33,6 @@ typedef intNDArray<octave_uint16> uint16NDArray; -OCTAVE_INT_CONCAT_DECL (octave_uint16) - NDS_CMP_OP_DECLS (uint16NDArray, octave_uint16) NDS_BOOL_OP_DECLS (uint16NDArray, octave_uint16)
--- a/liboctave/uint32NDArray.cc +++ b/liboctave/uint32NDArray.cc @@ -45,8 +45,6 @@ std::istream& operator >> (std::istream& is, intNDArray<octave_uint32>& a); -OCTAVE_INT_CONCAT_FN (octave_uint32) - NDS_CMP_OPS (uint32NDArray, , octave_uint32, ) NDS_BOOL_OPS (uint32NDArray, octave_uint32, octave_uint32 (0))
--- a/liboctave/uint32NDArray.h +++ b/liboctave/uint32NDArray.h @@ -33,8 +33,6 @@ typedef intNDArray<octave_uint32> uint32NDArray; -OCTAVE_INT_CONCAT_DECL (octave_uint32) - NDS_CMP_OP_DECLS (uint32NDArray, octave_uint32) NDS_BOOL_OP_DECLS (uint32NDArray, octave_uint32)
--- a/liboctave/uint64NDArray.cc +++ b/liboctave/uint64NDArray.cc @@ -43,8 +43,6 @@ std::istream& operator >> (std::istream& is, intNDArray<octave_uint64>& a); -OCTAVE_INT_CONCAT_FN (octave_uint64) - NDS_CMP_OPS (uint64NDArray, , octave_uint64, ) NDS_BOOL_OPS (uint64NDArray, octave_uint64, octave_uint64 (0))
--- a/liboctave/uint64NDArray.h +++ b/liboctave/uint64NDArray.h @@ -33,8 +33,6 @@ typedef intNDArray<octave_uint64> uint64NDArray; -OCTAVE_INT_CONCAT_DECL (octave_uint64) - NDS_CMP_OP_DECLS (uint64NDArray, octave_uint64) NDS_BOOL_OP_DECLS (uint64NDArray, octave_uint64)
--- a/liboctave/uint8NDArray.cc +++ b/liboctave/uint8NDArray.cc @@ -45,8 +45,6 @@ std::istream& operator >> (std::istream& is, intNDArray<octave_uint8>& a); -OCTAVE_INT_CONCAT_FN (octave_uint8) - NDS_CMP_OPS (uint8NDArray, , octave_uint8, ) NDS_BOOL_OPS (uint8NDArray, octave_uint8, octave_uint8 (0))
--- a/liboctave/uint8NDArray.h +++ b/liboctave/uint8NDArray.h @@ -33,8 +33,6 @@ typedef intNDArray<octave_uint8> uint8NDArray; -OCTAVE_INT_CONCAT_DECL (octave_uint8) - NDS_CMP_OP_DECLS (uint8NDArray, octave_uint8) NDS_BOOL_OP_DECLS (uint8NDArray, octave_uint8)
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +2004-11-09 John W. Eaton <jwe@octave.org> + + * miscellaneous/fileparts.m: Allow filenames with no extension. + From Julius Smith <jos@ccrma.stanford.edu>. + 2004-11-08 John W. Eaton <jwe@octave.org> * plot/__plt2vm__.m: Delete debugging statement.
--- a/scripts/miscellaneous/fileparts.m +++ b/scripts/miscellaneous/fileparts.m @@ -29,12 +29,17 @@ if (isstr (filename)) ds = rindex (filename, filesep); es = rindex (filename, "."); - if (es < ds) + ## These can be the same if they are both 0 (no dir or ext). + if (es <= ds) es = length(filename)+1; endif directory = filename(1:ds-1); name = filename(ds+1:es-1); - extension = filename(es:end); + if (es > 0) + extension = filename(es:end); + else + extension = ""; + endif version = ""; else error ("fileparts: expecting filename argument to be a string");
--- a/src/Cell.cc +++ b/src/Cell.cc @@ -114,11 +114,9 @@ } Cell -concat (const Cell& ra, const Cell& rb, const Array<int>& ra_idx) +Cell::concat (const Cell& rb, const Array<int>& ra_idx) { - Cell retval (ra); - retval.insert (rb, ra_idx); - return retval; + return insert (rb, ra_idx); } Cell&
--- a/src/Cell.h +++ b/src/Cell.h @@ -99,7 +99,7 @@ // XXX FIXME XXX boolMatrix any (int /* dim */ = 0) const { return boolMatrix (); } - friend Cell concat (const Cell& ra, const Cell& rb, const Array<int>& ra_idx); + Cell concat (const Cell& rb, const Array<int>& ra_idx); Cell& insert (const Cell& a, int r, int c); Cell& insert (const Cell& a, const Array<int>& ra_idx);
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,24 @@ +2004-11-09 David Bateman <dbateman@free.fr> + + * Cell.cc (concat): Delete. + (Cell::concat): New method. + * Cell.h: Provide decls. + + * oct-map.cc (concat): Delete + (Octave_map::concat): New method. + * oct-map.h: Provide decls. + + * ov.h (typedef octave_value (*cat_op_fcn) (octave_value&, + const octave_value&, const Array<int>&): Change definition of + cat_op_fcn so first argument is not constant. + + * ops.h (CATOPDECL): First arg is no longer constant. + (DEFCATOP_FN, DEFNDCATOP_FN): Change to use new concat methods. + + * OPERATORS/op-chm.cc, OPERATORS/op-str-m.cc, OPERATORS/op-str-s.cc, + OPERATORS/op-str-str.cc (DEFCATOP): Change explicit concat functions + to use new concatenation methods. + 2004-11-05 John W. Eaton <jwe@octave.org> * version.h (OCTAVE_VERSION): Now 2.1.61.
--- a/src/OPERATORS/op-chm.cc +++ b/src/OPERATORS/op-chm.cc @@ -48,49 +48,50 @@ return octave_value (v.matrix_value().transpose ()); } -DEFNDCATOP_FN (chm_chm, char_matrix, char_matrix, char_array, char_array, concat) +DEFNDCATOP_FN (chm_chm, char_matrix, char_matrix, char_array, char_array, + concat) DEFCATOP (chm_s, char_matrix, scalar) { - CAST_BINOP_ARGS (const octave_char_matrix&, const octave_scalar&); + CAST_BINOP_ARGS (octave_char_matrix&, const octave_scalar&); if (Vwarn_num_to_str) gripe_implicit_conversion (v2.type_name (), v1.type_name ()); - return octave_value (concat (v1.char_array_value (), v2.array_value (), + return octave_value (v1.char_array_value (). concat(v2.array_value (), ra_idx)); } DEFCATOP (chm_m, char_matrix, matrix) { - CAST_BINOP_ARGS (const octave_char_matrix&, const octave_matrix&); + CAST_BINOP_ARGS (octave_char_matrix&, const octave_matrix&); if (Vwarn_num_to_str) gripe_implicit_conversion (v2.type_name (), v1.type_name ()); - return octave_value (concat (v1.char_array_value (), v2.array_value (), + return octave_value (v1.char_array_value (). concat (v2.array_value (), ra_idx)); } DEFCATOP (s_chm, scalar, char_matrix) { - CAST_BINOP_ARGS (const octave_scalar&, const octave_char_matrix&); + CAST_BINOP_ARGS (octave_scalar&, const octave_char_matrix&); if (Vwarn_num_to_str) gripe_implicit_conversion (v1.type_name (), v2.type_name ()); - return octave_value (concat (v1.array_value (), v2.char_array_value (), + return octave_value (v1.array_value (). concat (v2.char_array_value (), ra_idx)); } DEFCATOP (m_chm, matrix, char_matrix) { - CAST_BINOP_ARGS (const octave_matrix&, const octave_char_matrix&); + CAST_BINOP_ARGS (octave_matrix&, const octave_char_matrix&); if (Vwarn_num_to_str) gripe_implicit_conversion (v1.type_name (), v2.type_name ()); - return octave_value (concat (v1.array_value (), v2.char_array_value (), + return octave_value (v1.array_value (). concat (v2.char_array_value (), ra_idx)); }
--- a/src/OPERATORS/op-str-m.cc +++ b/src/OPERATORS/op-str-m.cc @@ -50,25 +50,23 @@ DEFCATOP (str_m, char_matrix_str, matrix) { - CAST_BINOP_ARGS (const octave_char_matrix_str&, - const octave_matrix&); + CAST_BINOP_ARGS (octave_char_matrix_str&, const octave_matrix&); if (Vwarn_num_to_str) gripe_implicit_conversion (v2.type_name (), v1.type_name ()); - return octave_value (concat (v1.char_array_value (), v2.array_value (), + return octave_value (v1.char_array_value (). concat (v2.array_value (), ra_idx), true); } DEFCATOP (m_str, matrix, char_matrix_str) { - CAST_BINOP_ARGS (const octave_matrix&, - const octave_char_matrix_str&); + CAST_BINOP_ARGS (octave_matrix&, const octave_char_matrix_str&); if (Vwarn_num_to_str) gripe_implicit_conversion (v1.type_name (), v2.type_name ()); - return octave_value (concat (v1.array_value (), v2.char_array_value (), + return octave_value (v1.array_value (). concat (v2.char_array_value (), ra_idx), true); }
--- a/src/OPERATORS/op-str-s.cc +++ b/src/OPERATORS/op-str-s.cc @@ -50,25 +50,23 @@ DEFCATOP (str_s, char_matrix_str, scalar) { - CAST_BINOP_ARGS (const octave_char_matrix_str&, - const octave_scalar&); + CAST_BINOP_ARGS (octave_char_matrix_str&, const octave_scalar&); if (Vwarn_num_to_str) gripe_implicit_conversion (v2.type_name (), v1.type_name ()); - return octave_value (concat (v1.char_array_value (), v2.array_value (), + return octave_value (v1.char_array_value (). concat (v2.array_value (), ra_idx), true); } DEFCATOP (s_str, scalar, char_matrix_str) { - CAST_BINOP_ARGS (const octave_scalar&, - const octave_char_matrix_str&); + CAST_BINOP_ARGS (octave_scalar&, const octave_char_matrix_str&); if (Vwarn_num_to_str) gripe_implicit_conversion (v1.type_name (), v2.type_name ()); - return octave_value (concat (v1.array_value (), v2.char_array_value (), + return octave_value (v1.array_value (). concat (v2.char_array_value (), ra_idx), true); }
--- a/src/OPERATORS/op-str-str.cc +++ b/src/OPERATORS/op-str-str.cc @@ -119,9 +119,8 @@ DEFCATOP (str_str, char_matrix_str, char_matrix_str) { - CAST_BINOP_ARGS (const octave_char_matrix_str&, - const octave_char_matrix_str&); - return octave_value (concat (v1.char_array_value (), v2.char_array_value (), + CAST_BINOP_ARGS (octave_char_matrix_str&, const octave_char_matrix_str&); + return octave_value (v1.char_array_value (). concat (v2.char_array_value (), ra_idx), true); }
--- a/src/oct-map.cc +++ b/src/oct-map.cc @@ -114,15 +114,15 @@ } Octave_map -concat (const Octave_map& ra, const Octave_map& rb, const Array<int>& ra_idx) +Octave_map::concat (const Octave_map& rb, const Array<int>& ra_idx) { Octave_map retval; - if (ra.length() == rb.length()) + if (length() == rb.length()) { - for (Octave_map::const_iterator pa = ra.begin (); pa != ra.end (); pa++) + for (Octave_map::const_iterator pa = begin (); pa != end (); pa++) { - Octave_map::const_iterator pb = rb.seek (ra.key(pa)); + Octave_map::const_iterator pb = rb.seek (key(pa)); if (pb == rb.end ()) { @@ -130,8 +130,8 @@ break; } - retval.assign (ra.key(pa), - ra.contents(pa).insert (rb.contents(pb), ra_idx)); + retval.assign (key(pa), + contents(pa).insert (rb.contents(pb), ra_idx)); } } else
--- a/src/oct-map.h +++ b/src/oct-map.h @@ -120,8 +120,7 @@ int numel (void) const; - friend Octave_map concat (const Octave_map& ra, const Octave_map& rb, - const Array<int>& ra_idx); + Octave_map concat (const Octave_map& rb, const Array<int>& ra_idx); Octave_map& assign (const octave_value_list& idx, const Octave_map& rhs);
--- a/src/ops.h +++ b/src/ops.h @@ -318,7 +318,7 @@ #define CATOPDECL(name, a1, a2) \ static octave_value \ - oct_catop_ ## name (const octave_value& a1, const octave_value& a2, \ + oct_catop_ ## name (octave_value& a1, const octave_value& a2, \ const Array<int>& ra_idx) #define DEFCATOPX(name, t1, t2) \ @@ -332,15 +332,15 @@ #define DEFCATOP_FN(name, t1, t2, f) \ CATOPDECL (name, a1, a2) \ { \ - CAST_BINOP_ARGS (const octave_ ## t1&, const octave_ ## t2&); \ - return octave_value (f (v1.t1 ## _value (), v2.t2 ## _value (), ra_idx)); \ + CAST_BINOP_ARGS (octave_ ## t1&, const octave_ ## t2&); \ + return octave_value (v1.t1 ## _value (). f (v2.t2 ## _value (), ra_idx)); \ } #define DEFNDCATOP_FN(name, t1, t2, e1, e2, f) \ CATOPDECL (name, a1, a2) \ { \ - CAST_BINOP_ARGS (const octave_ ## t1&, const octave_ ## t2&); \ - return octave_value (f (v1.e1 ## _value (), v2.e2 ## _value (), ra_idx)); \ + CAST_BINOP_ARGS (octave_ ## t1&, const octave_ ## t2&); \ + return octave_value (v1.e1 ## _value (). f (v2.e2 ## _value (), ra_idx)); \ } #define CATOP_NONCONFORMANT(msg) \
--- a/src/ov.h +++ b/src/ov.h @@ -85,7 +85,7 @@ (const octave_value&, const octave_value&); typedef octave_value (*cat_op_fcn) - (const octave_value&, const octave_value&, const Array<int>& ra_idx); + (octave_value&, const octave_value&, const Array<int>& ra_idx); typedef octave_value (*assign_op_fcn) (octave_value&, const octave_value_list&, const octave_value&);