Mercurial > hg > octave-nkf
changeset 8321:69b6127f6962
better use of templates in ov-intx.h
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 13 Nov 2008 14:13:54 -0500 |
parents | 9a05d76e5291 |
children | f32a91d99156 |
files | src/ChangeLog src/ov-int16.h src/ov-int32.h src/ov-int64.h src/ov-int8.h src/ov-intx.h src/ov-uint16.h src/ov-uint32.h src/ov-uint64.h src/ov-uint8.h |
diffstat | 10 files changed, 60 insertions(+), 46 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,16 @@ +2008-11-13 John W. Eaton <jwe@octave.org> + + * ov-int8.h, ov-int16.h, ov-int32.h, ov-int64.h, ov-uint8.h, + ov-uint16.h, ov-uint32.h, ov-uint64.h: Don't define + OCTAVE_INT_NDARRAY_T. + * ov-intx.h (class OCTAVE_VALUE_INT_MATRIX_T, + class OCTAVE_VALUE_INT_SCALAR_T): Use intNDArray<OCTAVE_INT_T> + instead of OCTAVE_INT_NDARRAY_T. + (OCTAVE_VALUE_INT_MATRIX_T::increment, + OCTAVE_VALUE_INT_MATRIX_T::decrement, + OCTAVE_VALUE_INT_SCALAR_T::increment, + OCTAVE_VALUE_INT_SCALAR_T::decrement): Convert 1 to OCTAVE_INT_T. + 2008-11-12 Michael Goffioul <michael.goffioul@gmail.com> * dirfcn.cc (Ffilesep): Make it return all file separators when 'all'
--- a/src/ov-int16.h +++ b/src/ov-int16.h @@ -23,12 +23,12 @@ #if !defined (octave_int16_h) #define octave_int16_h 1 +#define OCTAVE_INT_T octave_int16 + #define OCTAVE_VALUE_INT_MATRIX_T octave_int16_matrix -#define OCTAVE_INT_NDARRAY_T int16NDArray #define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION int16_array_value #define OCTAVE_VALUE_INT_SCALAR_T octave_int16_scalar -#define OCTAVE_INT_T octave_int16 #define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION int16_scalar_value #define OCTAVE_TYPE_PREDICATE_FUNCTION is_int16_type @@ -37,12 +37,12 @@ #include "ov-intx.h" +#undef OCTAVE_INT_T + #undef OCTAVE_VALUE_INT_MATRIX_T -#undef OCTAVE_INT_NDARRAY_T #undef OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION #undef OCTAVE_VALUE_INT_SCALAR_T -#undef OCTAVE_INT_T #undef OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION #undef OCTAVE_TYPE_PREDICATE_FUNCTION
--- a/src/ov-int32.h +++ b/src/ov-int32.h @@ -23,12 +23,12 @@ #if !defined (octave_int32_h) #define octave_int32_h 1 +#define OCTAVE_INT_T octave_int32 + #define OCTAVE_VALUE_INT_MATRIX_T octave_int32_matrix -#define OCTAVE_INT_NDARRAY_T int32NDArray #define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION int32_array_value #define OCTAVE_VALUE_INT_SCALAR_T octave_int32_scalar -#define OCTAVE_INT_T octave_int32 #define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION int32_scalar_value #define OCTAVE_TYPE_PREDICATE_FUNCTION is_int32_type @@ -37,12 +37,12 @@ #include "ov-intx.h" +#undef OCTAVE_INT_T + #undef OCTAVE_VALUE_INT_MATRIX_T -#undef OCTAVE_INT_NDARRAY_T #undef OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION #undef OCTAVE_VALUE_INT_SCALAR_T -#undef OCTAVE_INT_T #undef OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION #undef OCTAVE_TYPE_PREDICATE_FUNCTION
--- a/src/ov-int64.h +++ b/src/ov-int64.h @@ -23,12 +23,12 @@ #if !defined (octave_int64_h) #define octave_int64_h 1 +#define OCTAVE_INT_T octave_int64 + #define OCTAVE_VALUE_INT_MATRIX_T octave_int64_matrix -#define OCTAVE_INT_NDARRAY_T int64NDArray #define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION int64_array_value #define OCTAVE_VALUE_INT_SCALAR_T octave_int64_scalar -#define OCTAVE_INT_T octave_int64 #define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION int64_scalar_value #define OCTAVE_TYPE_PREDICATE_FUNCTION is_int64_type @@ -37,12 +37,12 @@ #include "ov-intx.h" +#undef OCTAVE_INT_T + #undef OCTAVE_VALUE_INT_MATRIX_T -#undef OCTAVE_INT_NDARRAY_T #undef OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION #undef OCTAVE_VALUE_INT_SCALAR_T -#undef OCTAVE_INT_T #undef OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION #undef OCTAVE_TYPE_PREDICATE_FUNCTION
--- a/src/ov-int8.h +++ b/src/ov-int8.h @@ -23,12 +23,12 @@ #if !defined (octave_int8_h) #define octave_int8_h 1 +#define OCTAVE_INT_T octave_int8 + #define OCTAVE_VALUE_INT_MATRIX_T octave_int8_matrix -#define OCTAVE_INT_NDARRAY_T int8NDArray #define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION int8_array_value #define OCTAVE_VALUE_INT_SCALAR_T octave_int8_scalar -#define OCTAVE_INT_T octave_int8 #define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION int8_scalar_value #define OCTAVE_TYPE_PREDICATE_FUNCTION is_int8_type @@ -37,12 +37,12 @@ #include "ov-intx.h" +#undef OCTAVE_INT_T + #undef OCTAVE_VALUE_INT_MATRIX_T -#undef OCTAVE_INT_NDARRAY_T #undef OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION #undef OCTAVE_VALUE_INT_SCALAR_T -#undef OCTAVE_INT_T #undef OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION #undef OCTAVE_TYPE_PREDICATE_FUNCTION
--- a/src/ov-intx.h +++ b/src/ov-intx.h @@ -42,18 +42,19 @@ class OCTINTERP_API OCTAVE_VALUE_INT_MATRIX_T - : public octave_base_int_matrix<OCTAVE_INT_NDARRAY_T> + : public octave_base_int_matrix<intNDArray<OCTAVE_INT_T> > { public: OCTAVE_VALUE_INT_MATRIX_T (void) - : octave_base_int_matrix<OCTAVE_INT_NDARRAY_T> () { } + : octave_base_int_matrix<intNDArray<OCTAVE_INT_T> > () { } - OCTAVE_VALUE_INT_MATRIX_T (const OCTAVE_INT_NDARRAY_T& nda) - : octave_base_int_matrix<OCTAVE_INT_NDARRAY_T> (nda) { } + OCTAVE_VALUE_INT_MATRIX_T (const intNDArray<OCTAVE_INT_T>& nda) + : octave_base_int_matrix<intNDArray<OCTAVE_INT_T> > (nda) { } OCTAVE_VALUE_INT_MATRIX_T (const ArrayN<OCTAVE_INT_T>& nda) - : octave_base_int_matrix<OCTAVE_INT_NDARRAY_T> (OCTAVE_INT_NDARRAY_T (nda)) { } + : octave_base_int_matrix<intNDArray<OCTAVE_INT_T> > + (intNDArray<OCTAVE_INT_T> (nda)) { } ~OCTAVE_VALUE_INT_MATRIX_T (void) { } @@ -73,7 +74,7 @@ IM convert_gripe () const { typedef typename IM::element_type dest_el_type; - typedef OCTAVE_INT_NDARRAY_T::element_type src_el_type; + typedef intNDArray<OCTAVE_INT_T>::element_type src_el_type; dest_el_type::clear_conv_flag (); IM retval (matrix); if (dest_el_type::get_trunc_flag ()) @@ -300,7 +301,7 @@ void increment (void) { - matrix += 1; + matrix += OCTAVE_INT_T (1); if (OCTAVE_INT_T::get_math_trunc_flag ()) gripe_unop_integer_math_truncated ("++", type_name (). c_str ()); @@ -309,7 +310,7 @@ void decrement (void) { - matrix -= 1; + matrix -= OCTAVE_INT_T (1); if (OCTAVE_INT_T::get_math_trunc_flag ()) gripe_unop_integer_math_truncated ("--", type_name (). c_str ()); OCTAVE_INT_T::clear_conv_flag (); @@ -348,8 +349,8 @@ octave_value imag (void) const { - return OCTAVE_INT_NDARRAY_T (matrix.dims (), - static_cast<OCTAVE_INT_T>(0)); + return intNDArray<OCTAVE_INT_T> (matrix.dims (), + static_cast<OCTAVE_INT_T>(0)); } #define NO_OP_MAPPER(FCN) \ @@ -515,14 +516,14 @@ { if (fill) { - OCTAVE_INT_NDARRAY_T retval (dv, 0); + intNDArray<OCTAVE_INT_T> retval (dv, 0); if (dv.numel()) retval(0) = scalar; return retval; } else { - OCTAVE_INT_NDARRAY_T retval (dv); + intNDArray<OCTAVE_INT_T> retval (dv); if (dv.numel()) retval(0) = scalar; return retval; @@ -624,7 +625,7 @@ void increment (void) { - scalar += 1; + scalar += OCTAVE_INT_T (1); if (OCTAVE_INT_T::get_math_trunc_flag ()) gripe_unop_integer_math_truncated ("++", type_name (). c_str ()); OCTAVE_INT_T::clear_conv_flag (); @@ -632,7 +633,7 @@ void decrement (void) { - scalar -= 1; + scalar -= OCTAVE_INT_T (1); if (OCTAVE_INT_T::get_math_trunc_flag ()) gripe_unop_integer_math_truncated ("--", type_name (). c_str ()); OCTAVE_INT_T::clear_conv_flag ();
--- a/src/ov-uint16.h +++ b/src/ov-uint16.h @@ -23,12 +23,12 @@ #if !defined (octave_uint16_h) #define octave_uint16_h 1 +#define OCTAVE_INT_T octave_uint16 + #define OCTAVE_VALUE_INT_MATRIX_T octave_uint16_matrix -#define OCTAVE_INT_NDARRAY_T uint16NDArray #define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION uint16_array_value #define OCTAVE_VALUE_INT_SCALAR_T octave_uint16_scalar -#define OCTAVE_INT_T octave_uint16 #define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION uint16_scalar_value #define OCTAVE_TYPE_PREDICATE_FUNCTION is_uint16_type @@ -37,12 +37,12 @@ #include "ov-intx.h" +#undef OCTAVE_INT_T + #undef OCTAVE_VALUE_INT_MATRIX_T -#undef OCTAVE_INT_NDARRAY_T #undef OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION #undef OCTAVE_VALUE_INT_SCALAR_T -#undef OCTAVE_INT_T #undef OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION #undef OCTAVE_TYPE_PREDICATE_FUNCTION
--- a/src/ov-uint32.h +++ b/src/ov-uint32.h @@ -23,12 +23,12 @@ #if !defined (octave_uint32_h) #define octave_uint32_h 1 +#define OCTAVE_INT_T octave_uint32 + #define OCTAVE_VALUE_INT_MATRIX_T octave_uint32_matrix -#define OCTAVE_INT_NDARRAY_T uint32NDArray #define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION uint32_array_value #define OCTAVE_VALUE_INT_SCALAR_T octave_uint32_scalar -#define OCTAVE_INT_T octave_uint32 #define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION uint32_scalar_value #define OCTAVE_TYPE_PREDICATE_FUNCTION is_uint32_type @@ -37,12 +37,12 @@ #include "ov-intx.h" +#undef OCTAVE_INT_T + #undef OCTAVE_VALUE_INT_MATRIX_T -#undef OCTAVE_INT_NDARRAY_T #undef OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION #undef OCTAVE_VALUE_INT_SCALAR_T -#undef OCTAVE_INT_T #undef OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION #undef OCTAVE_TYPE_PREDICATE_FUNCTION
--- a/src/ov-uint64.h +++ b/src/ov-uint64.h @@ -23,12 +23,12 @@ #if !defined (octave_uint64_h) #define octave_uint64_h 1 +#define OCTAVE_INT_T octave_uint64 + #define OCTAVE_VALUE_INT_MATRIX_T octave_uint64_matrix -#define OCTAVE_INT_NDARRAY_T uint64NDArray #define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION uint64_array_value #define OCTAVE_VALUE_INT_SCALAR_T octave_uint64_scalar -#define OCTAVE_INT_T octave_uint64 #define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION uint64_scalar_value #define OCTAVE_TYPE_PREDICATE_FUNCTION is_uint64_type @@ -37,12 +37,12 @@ #include "ov-intx.h" +#undef OCTAVE_INT_T + #undef OCTAVE_VALUE_INT_MATRIX_T -#undef OCTAVE_INT_NDARRAY_T #undef OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION #undef OCTAVE_VALUE_INT_SCALAR_T -#undef OCTAVE_INT_T #undef OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION #undef OCTAVE_TYPE_PREDICATE_FUNCTION
--- a/src/ov-uint8.h +++ b/src/ov-uint8.h @@ -23,12 +23,12 @@ #if !defined (octave_uint8_h) #define octave_uint8_h 1 +#define OCTAVE_INT_T octave_uint8 + #define OCTAVE_VALUE_INT_MATRIX_T octave_uint8_matrix -#define OCTAVE_INT_NDARRAY_T uint8NDArray #define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION uint8_array_value #define OCTAVE_VALUE_INT_SCALAR_T octave_uint8_scalar -#define OCTAVE_INT_T octave_uint8 #define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION uint8_scalar_value #define OCTAVE_TYPE_PREDICATE_FUNCTION is_uint8_type @@ -37,12 +37,12 @@ #include "ov-intx.h" +#undef OCTAVE_INT_T + #undef OCTAVE_VALUE_INT_MATRIX_T -#undef OCTAVE_INT_NDARRAY_T #undef OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION #undef OCTAVE_VALUE_INT_SCALAR_T -#undef OCTAVE_INT_T #undef OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION #undef OCTAVE_TYPE_PREDICATE_FUNCTION