# HG changeset patch # User jwe # Date 1100025086 0 # Node ID e71be9c548f23c4ecf48550c8fad52d30412f3ac # Parent 97b62f0c1beeb0f5a41aee85488810d5a9b2bf5a [project @ 2004-11-09 18:31:25 by jwe] diff -r 97b62f0c1bee -r e71be9c548f2 liboctave/CNDArray.cc --- a/liboctave/CNDArray.cc Tue Nov 09 05:53:11 2004 +0000 +++ b/liboctave/CNDArray.cc Tue Nov 09 18:31:26 2004 +0000 @@ -654,27 +654,24 @@ } ComplexNDArray -concat (const ComplexNDArray& ra, const ComplexNDArray& rb, - const Array& ra_idx) +ComplexNDArray::concat (const ComplexNDArray& rb, const Array& 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& ra_idx) +ComplexNDArray::concat (const NDArray& rb, const Array& 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& ra_idx) +concat (NDArray& ra, ComplexNDArray& rb, const Array& ra_idx) { ComplexNDArray retval (ra); if (rb.numel () > 0) diff -r 97b62f0c1bee -r e71be9c548f2 liboctave/CNDArray.h --- a/liboctave/CNDArray.h Tue Nov 09 05:53:11 2004 +0000 +++ b/liboctave/CNDArray.h Tue Nov 09 18:31:26 2004 +0000 @@ -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& ra_idx); - friend ComplexNDArray concat (const ComplexNDArray& ra, const NDArray& rb, - const Array& ra_idx); - friend ComplexNDArray concat (const NDArray& ra, const ComplexNDArray& rb, - const Array& ra_idx); + ComplexNDArray concat (const ComplexNDArray& rb, const Array& ra_idx); + ComplexNDArray concat (const NDArray& rb, const Array& ra_idx); ComplexNDArray max (int dim = 0) const; ComplexNDArray max (ArrayN& index, int dim = 0) const; diff -r 97b62f0c1bee -r e71be9c548f2 liboctave/ChangeLog --- a/liboctave/ChangeLog Tue Nov 09 05:53:11 2004 +0000 +++ b/liboctave/ChangeLog Tue Nov 09 18:31:26 2004 +0000 @@ -1,3 +1,35 @@ +2004-11-09 David Bateman + + * 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::concat): New method. + * intNDArray.h: Provide decl. + 2004-11-08 John W. Eaton * oct-inttypes.cc: New file. diff -r 97b62f0c1bee -r e71be9c548f2 liboctave/boolNDArray.cc --- a/liboctave/boolNDArray.cc Tue Nov 09 05:53:11 2004 +0000 +++ b/liboctave/boolNDArray.cc Tue Nov 09 18:31:26 2004 +0000 @@ -62,12 +62,11 @@ } boolNDArray -concat (const boolNDArray& ra, const boolNDArray& rb, const Array& ra_idx) +boolNDArray::concat (const boolNDArray& rb, const Array& ra_idx) { - boolNDArray retval (ra); if (rb.numel () > 0) - retval.insert (rb, ra_idx); - return retval; + insert (rb, ra_idx); + return *this; } boolNDArray& diff -r 97b62f0c1bee -r e71be9c548f2 liboctave/boolNDArray.h --- a/liboctave/boolNDArray.h Tue Nov 09 05:53:11 2004 +0000 +++ b/liboctave/boolNDArray.h Tue Nov 09 18:31:26 2004 +0000 @@ -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& ra_idx); + boolNDArray concat (const boolNDArray& rb, const Array& ra_idx); boolNDArray& insert (const boolNDArray& a, int r, int c); boolNDArray& insert (const boolNDArray& a, const Array& ra_idx); diff -r 97b62f0c1bee -r e71be9c548f2 liboctave/chNDArray.cc --- a/liboctave/chNDArray.cc Tue Nov 09 05:53:11 2004 +0000 +++ b/liboctave/chNDArray.cc Tue Nov 09 18:31:26 2004 +0000 @@ -50,23 +50,21 @@ } charNDArray -concat (const charNDArray& ra, const charNDArray& rb, const Array& ra_idx) +charNDArray::concat (const charNDArray& rb, const Array& 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& ra_idx) +charNDArray::concat (const NDArray& rb, const Array& 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& 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(ival); - } - } - - if (rb.numel () == 0) - return retval; - - retval.insert (rb, ra_idx); - return retval; + insert (tmp, ra_idx); + return *this; } charNDArray& diff -r 97b62f0c1bee -r e71be9c548f2 liboctave/chNDArray.h --- a/liboctave/chNDArray.h Tue Nov 09 05:53:11 2004 +0000 +++ b/liboctave/chNDArray.h Tue Nov 09 18:31:26 2004 +0000 @@ -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& ra_idx); - friend charNDArray concat (const charNDArray& ra, const NDArray& rb, - const Array& ra_idx); - friend charNDArray concat (const NDArray& ra, const charNDArray& rb, - const Array& ra_idx); + charNDArray concat (const charNDArray& rb, const Array& ra_idx); + charNDArray concat (const NDArray& rb, const Array& ra_idx); charNDArray& insert (const charNDArray& a, int r, int c); charNDArray& insert (const charNDArray& a, const Array& ra_idx); diff -r 97b62f0c1bee -r e71be9c548f2 liboctave/dNDArray.cc --- a/liboctave/dNDArray.cc Tue Nov 09 05:53:11 2004 +0000 +++ b/liboctave/dNDArray.cc Tue Nov 09 18:31:26 2004 +0000 @@ -793,14 +793,58 @@ } NDArray -concat (const NDArray& ra, const NDArray& rb, const Array& ra_idx) +NDArray::concat (const NDArray& rb, const Array& ra_idx) { - NDArray retval (ra); + if (rb.numel () > 0) + insert (rb, ra_idx); + return *this; +} + +ComplexNDArray +NDArray::concat (const ComplexNDArray& rb, const Array& ra_idx) +{ + ComplexNDArray retval (*this); if (rb.numel () > 0) retval.insert (rb, ra_idx); return retval; } +charNDArray +NDArray::concat (const charNDArray& rb, const Array& 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(ival); + } + } + + if (rb.numel () == 0) + return retval; + + retval.insert (rb, ra_idx); + return retval; +} + NDArray real (const ComplexNDArray& a) { diff -r 97b62f0c1bee -r e71be9c548f2 liboctave/dNDArray.h --- a/liboctave/dNDArray.h Tue Nov 09 05:53:11 2004 +0000 +++ b/liboctave/dNDArray.h Tue Nov 09 18:31:26 2004 +0000 @@ -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& ra_idx); + NDArray concat (const NDArray& rb, const Array& ra_idx); + ComplexNDArray concat (const ComplexNDArray& rb, const Array& ra_idx); + charNDArray concat (const charNDArray& rb, const Array& ra_idx); NDArray max (int dim = 0) const; NDArray max (ArrayN& index, int dim = 0) const; diff -r 97b62f0c1bee -r e71be9c548f2 liboctave/int16NDArray.cc --- a/liboctave/int16NDArray.cc Tue Nov 09 05:53:11 2004 +0000 +++ b/liboctave/int16NDArray.cc Tue Nov 09 18:31:26 2004 +0000 @@ -45,8 +45,6 @@ std::istream& operator >> (std::istream& is, intNDArray& a); -OCTAVE_INT_CONCAT_FN (octave_int16) - NDS_CMP_OPS (int16NDArray, , octave_int16, ) NDS_BOOL_OPS (int16NDArray, octave_int16, octave_int16 (0)) diff -r 97b62f0c1bee -r e71be9c548f2 liboctave/int16NDArray.h --- a/liboctave/int16NDArray.h Tue Nov 09 05:53:11 2004 +0000 +++ b/liboctave/int16NDArray.h Tue Nov 09 18:31:26 2004 +0000 @@ -33,8 +33,6 @@ typedef intNDArray int16NDArray; -OCTAVE_INT_CONCAT_DECL (octave_int16) - NDS_CMP_OP_DECLS (int16NDArray, octave_int16) NDS_BOOL_OP_DECLS (int16NDArray, octave_int16) diff -r 97b62f0c1bee -r e71be9c548f2 liboctave/int32NDArray.cc --- a/liboctave/int32NDArray.cc Tue Nov 09 05:53:11 2004 +0000 +++ b/liboctave/int32NDArray.cc Tue Nov 09 18:31:26 2004 +0000 @@ -45,8 +45,6 @@ std::istream& operator >> (std::istream& is, intNDArray& a); -OCTAVE_INT_CONCAT_FN (octave_int32) - NDS_CMP_OPS (int32NDArray, , octave_int32, ) NDS_BOOL_OPS (int32NDArray, octave_int32, octave_int32 (0)) diff -r 97b62f0c1bee -r e71be9c548f2 liboctave/int32NDArray.h --- a/liboctave/int32NDArray.h Tue Nov 09 05:53:11 2004 +0000 +++ b/liboctave/int32NDArray.h Tue Nov 09 18:31:26 2004 +0000 @@ -33,8 +33,6 @@ typedef intNDArray int32NDArray; -OCTAVE_INT_CONCAT_DECL (octave_int32) - NDS_CMP_OP_DECLS (int32NDArray, octave_int32) NDS_BOOL_OP_DECLS (int32NDArray, octave_int32) diff -r 97b62f0c1bee -r e71be9c548f2 liboctave/int64NDArray.cc --- a/liboctave/int64NDArray.cc Tue Nov 09 05:53:11 2004 +0000 +++ b/liboctave/int64NDArray.cc Tue Nov 09 18:31:26 2004 +0000 @@ -43,8 +43,6 @@ std::istream& operator >> (std::istream& is, intNDArray& a); -OCTAVE_INT_CONCAT_FN (octave_int64) - NDS_CMP_OPS (int64NDArray, , octave_int64, ) NDS_BOOL_OPS (int64NDArray, octave_int64, octave_int64 (0)) diff -r 97b62f0c1bee -r e71be9c548f2 liboctave/int64NDArray.h --- a/liboctave/int64NDArray.h Tue Nov 09 05:53:11 2004 +0000 +++ b/liboctave/int64NDArray.h Tue Nov 09 18:31:26 2004 +0000 @@ -33,8 +33,6 @@ typedef intNDArray int64NDArray; -OCTAVE_INT_CONCAT_DECL (octave_int64) - NDS_CMP_OP_DECLS (int64NDArray, octave_int64) NDS_BOOL_OP_DECLS (int64NDArray, octave_int64) diff -r 97b62f0c1bee -r e71be9c548f2 liboctave/int8NDArray.cc --- a/liboctave/int8NDArray.cc Tue Nov 09 05:53:11 2004 +0000 +++ b/liboctave/int8NDArray.cc Tue Nov 09 18:31:26 2004 +0000 @@ -45,8 +45,6 @@ std::istream& operator >> (std::istream& is, intNDArray& a); -OCTAVE_INT_CONCAT_FN (octave_int8) - NDS_CMP_OPS (int8NDArray, , octave_int8, ) NDS_BOOL_OPS (int8NDArray, octave_int8, octave_int8 (0)) diff -r 97b62f0c1bee -r e71be9c548f2 liboctave/int8NDArray.h --- a/liboctave/int8NDArray.h Tue Nov 09 05:53:11 2004 +0000 +++ b/liboctave/int8NDArray.h Tue Nov 09 18:31:26 2004 +0000 @@ -33,8 +33,6 @@ typedef intNDArray int8NDArray; -OCTAVE_INT_CONCAT_DECL (octave_int8) - NDS_CMP_OP_DECLS (int8NDArray, octave_int8) NDS_BOOL_OP_DECLS (int8NDArray, octave_int8) diff -r 97b62f0c1bee -r e71be9c548f2 liboctave/intNDArray.cc --- a/liboctave/intNDArray.cc Tue Nov 09 05:53:11 2004 +0000 +++ b/liboctave/intNDArray.cc Tue Nov 09 18:31:26 2004 +0000 @@ -81,6 +81,15 @@ } template +intNDArray +intNDArray::concat (const intNDArray& rb, const Array& ra_idx) +{ + if (rb.numel () > 0); + insert (rb, ra_idx); + return *this; +} + +template intNDArray& intNDArray::insert (const intNDArray& a, int r, int c) { diff -r 97b62f0c1bee -r e71be9c548f2 liboctave/intNDArray.h --- a/liboctave/intNDArray.h Tue Nov 09 05:53:11 2004 +0000 +++ b/liboctave/intNDArray.h Tue Nov 09 18:31:26 2004 +0000 @@ -76,6 +76,8 @@ intNDArray transpose (void) const { return intNDArray (MArrayN::transpose ()); } + intNDArray concat (const intNDArray& rb, const Array& ra_idx); + intNDArray& insert (const intNDArray& a, int r, int c); intNDArray& insert (const intNDArray& a, const Array& ra_idx); diff -r 97b62f0c1bee -r e71be9c548f2 liboctave/oct-inttypes.h --- a/liboctave/oct-inttypes.h Tue Nov 09 05:53:11 2004 +0000 +++ b/liboctave/oct-inttypes.h Tue Nov 09 18:31:26 2004 +0000 @@ -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& 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& ra_idx); - #undef OCTAVE_INT_BINOP_TRAIT #undef OCTAVE_US_S_FTR #undef OCTAVE_US_S_FTR_FCNS diff -r 97b62f0c1bee -r e71be9c548f2 liboctave/uint16NDArray.cc --- a/liboctave/uint16NDArray.cc Tue Nov 09 05:53:11 2004 +0000 +++ b/liboctave/uint16NDArray.cc Tue Nov 09 18:31:26 2004 +0000 @@ -45,8 +45,6 @@ std::istream& operator >> (std::istream& is, intNDArray& a); -OCTAVE_INT_CONCAT_FN (octave_uint16) - NDS_CMP_OPS (uint16NDArray, , octave_uint16, ) NDS_BOOL_OPS (uint16NDArray, octave_uint16, octave_uint16 (0)) diff -r 97b62f0c1bee -r e71be9c548f2 liboctave/uint16NDArray.h --- a/liboctave/uint16NDArray.h Tue Nov 09 05:53:11 2004 +0000 +++ b/liboctave/uint16NDArray.h Tue Nov 09 18:31:26 2004 +0000 @@ -33,8 +33,6 @@ typedef intNDArray uint16NDArray; -OCTAVE_INT_CONCAT_DECL (octave_uint16) - NDS_CMP_OP_DECLS (uint16NDArray, octave_uint16) NDS_BOOL_OP_DECLS (uint16NDArray, octave_uint16) diff -r 97b62f0c1bee -r e71be9c548f2 liboctave/uint32NDArray.cc --- a/liboctave/uint32NDArray.cc Tue Nov 09 05:53:11 2004 +0000 +++ b/liboctave/uint32NDArray.cc Tue Nov 09 18:31:26 2004 +0000 @@ -45,8 +45,6 @@ std::istream& operator >> (std::istream& is, intNDArray& a); -OCTAVE_INT_CONCAT_FN (octave_uint32) - NDS_CMP_OPS (uint32NDArray, , octave_uint32, ) NDS_BOOL_OPS (uint32NDArray, octave_uint32, octave_uint32 (0)) diff -r 97b62f0c1bee -r e71be9c548f2 liboctave/uint32NDArray.h --- a/liboctave/uint32NDArray.h Tue Nov 09 05:53:11 2004 +0000 +++ b/liboctave/uint32NDArray.h Tue Nov 09 18:31:26 2004 +0000 @@ -33,8 +33,6 @@ typedef intNDArray uint32NDArray; -OCTAVE_INT_CONCAT_DECL (octave_uint32) - NDS_CMP_OP_DECLS (uint32NDArray, octave_uint32) NDS_BOOL_OP_DECLS (uint32NDArray, octave_uint32) diff -r 97b62f0c1bee -r e71be9c548f2 liboctave/uint64NDArray.cc --- a/liboctave/uint64NDArray.cc Tue Nov 09 05:53:11 2004 +0000 +++ b/liboctave/uint64NDArray.cc Tue Nov 09 18:31:26 2004 +0000 @@ -43,8 +43,6 @@ std::istream& operator >> (std::istream& is, intNDArray& a); -OCTAVE_INT_CONCAT_FN (octave_uint64) - NDS_CMP_OPS (uint64NDArray, , octave_uint64, ) NDS_BOOL_OPS (uint64NDArray, octave_uint64, octave_uint64 (0)) diff -r 97b62f0c1bee -r e71be9c548f2 liboctave/uint64NDArray.h --- a/liboctave/uint64NDArray.h Tue Nov 09 05:53:11 2004 +0000 +++ b/liboctave/uint64NDArray.h Tue Nov 09 18:31:26 2004 +0000 @@ -33,8 +33,6 @@ typedef intNDArray uint64NDArray; -OCTAVE_INT_CONCAT_DECL (octave_uint64) - NDS_CMP_OP_DECLS (uint64NDArray, octave_uint64) NDS_BOOL_OP_DECLS (uint64NDArray, octave_uint64) diff -r 97b62f0c1bee -r e71be9c548f2 liboctave/uint8NDArray.cc --- a/liboctave/uint8NDArray.cc Tue Nov 09 05:53:11 2004 +0000 +++ b/liboctave/uint8NDArray.cc Tue Nov 09 18:31:26 2004 +0000 @@ -45,8 +45,6 @@ std::istream& operator >> (std::istream& is, intNDArray& a); -OCTAVE_INT_CONCAT_FN (octave_uint8) - NDS_CMP_OPS (uint8NDArray, , octave_uint8, ) NDS_BOOL_OPS (uint8NDArray, octave_uint8, octave_uint8 (0)) diff -r 97b62f0c1bee -r e71be9c548f2 liboctave/uint8NDArray.h --- a/liboctave/uint8NDArray.h Tue Nov 09 05:53:11 2004 +0000 +++ b/liboctave/uint8NDArray.h Tue Nov 09 18:31:26 2004 +0000 @@ -33,8 +33,6 @@ typedef intNDArray uint8NDArray; -OCTAVE_INT_CONCAT_DECL (octave_uint8) - NDS_CMP_OP_DECLS (uint8NDArray, octave_uint8) NDS_BOOL_OP_DECLS (uint8NDArray, octave_uint8) diff -r 97b62f0c1bee -r e71be9c548f2 scripts/ChangeLog --- a/scripts/ChangeLog Tue Nov 09 05:53:11 2004 +0000 +++ b/scripts/ChangeLog Tue Nov 09 18:31:26 2004 +0000 @@ -1,3 +1,8 @@ +2004-11-09 John W. Eaton + + * miscellaneous/fileparts.m: Allow filenames with no extension. + From Julius Smith . + 2004-11-08 John W. Eaton * plot/__plt2vm__.m: Delete debugging statement. diff -r 97b62f0c1bee -r e71be9c548f2 scripts/miscellaneous/fileparts.m --- a/scripts/miscellaneous/fileparts.m Tue Nov 09 05:53:11 2004 +0000 +++ b/scripts/miscellaneous/fileparts.m Tue Nov 09 18:31:26 2004 +0000 @@ -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"); diff -r 97b62f0c1bee -r e71be9c548f2 src/Cell.cc --- a/src/Cell.cc Tue Nov 09 05:53:11 2004 +0000 +++ b/src/Cell.cc Tue Nov 09 18:31:26 2004 +0000 @@ -114,11 +114,9 @@ } Cell -concat (const Cell& ra, const Cell& rb, const Array& ra_idx) +Cell::concat (const Cell& rb, const Array& ra_idx) { - Cell retval (ra); - retval.insert (rb, ra_idx); - return retval; + return insert (rb, ra_idx); } Cell& diff -r 97b62f0c1bee -r e71be9c548f2 src/Cell.h --- a/src/Cell.h Tue Nov 09 05:53:11 2004 +0000 +++ b/src/Cell.h Tue Nov 09 18:31:26 2004 +0000 @@ -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& ra_idx); + Cell concat (const Cell& rb, const Array& ra_idx); Cell& insert (const Cell& a, int r, int c); Cell& insert (const Cell& a, const Array& ra_idx); diff -r 97b62f0c1bee -r e71be9c548f2 src/ChangeLog --- a/src/ChangeLog Tue Nov 09 05:53:11 2004 +0000 +++ b/src/ChangeLog Tue Nov 09 18:31:26 2004 +0000 @@ -1,3 +1,24 @@ +2004-11-09 David Bateman + + * 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&): 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 * version.h (OCTAVE_VERSION): Now 2.1.61. diff -r 97b62f0c1bee -r e71be9c548f2 src/OPERATORS/op-chm.cc --- a/src/OPERATORS/op-chm.cc Tue Nov 09 05:53:11 2004 +0000 +++ b/src/OPERATORS/op-chm.cc Tue Nov 09 18:31:26 2004 +0000 @@ -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)); } diff -r 97b62f0c1bee -r e71be9c548f2 src/OPERATORS/op-str-m.cc --- a/src/OPERATORS/op-str-m.cc Tue Nov 09 05:53:11 2004 +0000 +++ b/src/OPERATORS/op-str-m.cc Tue Nov 09 18:31:26 2004 +0000 @@ -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); } diff -r 97b62f0c1bee -r e71be9c548f2 src/OPERATORS/op-str-s.cc --- a/src/OPERATORS/op-str-s.cc Tue Nov 09 05:53:11 2004 +0000 +++ b/src/OPERATORS/op-str-s.cc Tue Nov 09 18:31:26 2004 +0000 @@ -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); } diff -r 97b62f0c1bee -r e71be9c548f2 src/OPERATORS/op-str-str.cc --- a/src/OPERATORS/op-str-str.cc Tue Nov 09 05:53:11 2004 +0000 +++ b/src/OPERATORS/op-str-str.cc Tue Nov 09 18:31:26 2004 +0000 @@ -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); } diff -r 97b62f0c1bee -r e71be9c548f2 src/oct-map.cc --- a/src/oct-map.cc Tue Nov 09 05:53:11 2004 +0000 +++ b/src/oct-map.cc Tue Nov 09 18:31:26 2004 +0000 @@ -114,15 +114,15 @@ } Octave_map -concat (const Octave_map& ra, const Octave_map& rb, const Array& ra_idx) +Octave_map::concat (const Octave_map& rb, const Array& 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 diff -r 97b62f0c1bee -r e71be9c548f2 src/oct-map.h --- a/src/oct-map.h Tue Nov 09 05:53:11 2004 +0000 +++ b/src/oct-map.h Tue Nov 09 18:31:26 2004 +0000 @@ -120,8 +120,7 @@ int numel (void) const; - friend Octave_map concat (const Octave_map& ra, const Octave_map& rb, - const Array& ra_idx); + Octave_map concat (const Octave_map& rb, const Array& ra_idx); Octave_map& assign (const octave_value_list& idx, const Octave_map& rhs); diff -r 97b62f0c1bee -r e71be9c548f2 src/ops.h --- a/src/ops.h Tue Nov 09 05:53:11 2004 +0000 +++ b/src/ops.h Tue Nov 09 18:31:26 2004 +0000 @@ -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& 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) \ diff -r 97b62f0c1bee -r e71be9c548f2 src/ov.h --- a/src/ov.h Tue Nov 09 05:53:11 2004 +0000 +++ b/src/ov.h Tue Nov 09 18:31:26 2004 +0000 @@ -85,7 +85,7 @@ (const octave_value&, const octave_value&); typedef octave_value (*cat_op_fcn) - (const octave_value&, const octave_value&, const Array& ra_idx); + (octave_value&, const octave_value&, const Array& ra_idx); typedef octave_value (*assign_op_fcn) (octave_value&, const octave_value_list&, const octave_value&);