# HG changeset patch # User John W. Eaton # Date 1226603634 18000 # Node ID 69b6127f69628d9db455deeb3fcd664e4739cc2c # Parent 9a05d76e529105d4abf434c6ea17ced3b0db287f better use of templates in ov-intx.h diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,16 @@ +2008-11-13 John W. Eaton + + * 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 + 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 * dirfcn.cc (Ffilesep): Make it return all file separators when 'all' diff --git a/src/ov-int16.h b/src/ov-int16.h --- 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 diff --git a/src/ov-int32.h b/src/ov-int32.h --- 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 diff --git a/src/ov-int64.h b/src/ov-int64.h --- 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 diff --git a/src/ov-int8.h b/src/ov-int8.h --- 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 diff --git a/src/ov-intx.h b/src/ov-intx.h --- 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 + : public octave_base_int_matrix > { public: OCTAVE_VALUE_INT_MATRIX_T (void) - : octave_base_int_matrix () { } + : octave_base_int_matrix > () { } - OCTAVE_VALUE_INT_MATRIX_T (const OCTAVE_INT_NDARRAY_T& nda) - : octave_base_int_matrix (nda) { } + OCTAVE_VALUE_INT_MATRIX_T (const intNDArray& nda) + : octave_base_int_matrix > (nda) { } OCTAVE_VALUE_INT_MATRIX_T (const ArrayN& nda) - : octave_base_int_matrix (OCTAVE_INT_NDARRAY_T (nda)) { } + : octave_base_int_matrix > + (intNDArray (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::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(0)); + return intNDArray (matrix.dims (), + static_cast(0)); } #define NO_OP_MAPPER(FCN) \ @@ -515,14 +516,14 @@ { if (fill) { - OCTAVE_INT_NDARRAY_T retval (dv, 0); + intNDArray retval (dv, 0); if (dv.numel()) retval(0) = scalar; return retval; } else { - OCTAVE_INT_NDARRAY_T retval (dv); + intNDArray 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 (); diff --git a/src/ov-uint16.h b/src/ov-uint16.h --- 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 diff --git a/src/ov-uint32.h b/src/ov-uint32.h --- 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 diff --git a/src/ov-uint64.h b/src/ov-uint64.h --- 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 diff --git a/src/ov-uint8.h b/src/ov-uint8.h --- 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