Mercurial > hg > octave-nkf
changeset 4904:71229573b6bf
[project @ 2004-06-14 19:31:52 by jwe]
author | jwe |
---|---|
date | Mon, 14 Jun 2004 19:33:53 +0000 |
parents | bfe64e459ce3 |
children | f7a337f3fd9e |
files | src/ChangeLog src/ov-int-traits.h 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 | 11 files changed, 626 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -58,9 +58,11 @@ * Cell.h (Cell::reshape (const dim_vector&)): New forwarding function for return type conversion. - * ov-int16.cc, ov-int32.cc, ov-int64.cc, ov-int8.cc, ov-uint16.cc, - ov-uint32.cc, ov-uint64.cc, ov-uint8.cc, ov-type-conv.h, - OPERATORS/op-int-conv.cc, OPERATORS/op-double-conv.cc, + * ov-int16.cc, ov-int16.h, ov-int32.cc, ov-int32.h, ov-int64.cc, + ov-int64.h, ov-int8.cc, ov-int8.h, ov-uint16.cc, ov-uint16.h, + ov-uint32.cc, ov-uint32.h, ov-uint64.cc, ov-uint64.h, ov-uint8.cc, + ov-uint8.h, ov-type-conv.h, ov-int-traits.h, + OPERATORS/op-int-conv.cc, OPERATORS/op-double-conv.cc, OPERATORS/op-i16-i16.cc, OPERATORS/op-i32-i32.cc, OPERATORS/op-i64-i64.cc, OPERATORS/op-i8-i8.cc, OPERATORS/op-ui16-ui16.cc, OPERATORS/op-ui32-ui32.cc,
new file mode 100644 --- /dev/null +++ b/src/ov-int-traits.h @@ -0,0 +1,69 @@ +/* + +Copyright (C) 2004 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#if !defined (octave_value_int_traits_h) +#define octave_value_int_traits_h 1 + +#include "ov-int8.h" +#include "ov-int16.h" +#include "ov-int32.h" +#include "ov-int64.h" + +#include "ov-uint8.h" +#include "ov-uint16.h" +#include "ov-uint32.h" +#include "ov-uint64.h" + +template <class T> +class +octave_value_int_traits +{ +public: + typedef T scalar_type; +}; + +#define OCTAVE_VALUE_INT_TRAITS(MT, ST) \ + template<> \ + class \ + octave_value_int_traits<MT> \ + { \ + public: \ + typedef ST scalar_type; \ + } + +OCTAVE_VALUE_INT_TRAITS(int8NDArray, octave_int8_scalar); +OCTAVE_VALUE_INT_TRAITS(int16NDArray, octave_int16_scalar); +OCTAVE_VALUE_INT_TRAITS(int32NDArray, octave_int32_scalar); +OCTAVE_VALUE_INT_TRAITS(int64NDArray, octave_int64_scalar); + +OCTAVE_VALUE_INT_TRAITS(uint8NDArray, octave_uint8_scalar); +OCTAVE_VALUE_INT_TRAITS(uint16NDArray, octave_uint16_scalar); +OCTAVE_VALUE_INT_TRAITS(uint32NDArray, octave_uint32_scalar); +OCTAVE_VALUE_INT_TRAITS(uint64NDArray, octave_uint64_scalar); + +#endif + +/* +;;; Local Variables: *** +;;; mode: C++ *** +;;; End: *** +*/
new file mode 100644 --- /dev/null +++ b/src/ov-int16.h @@ -0,0 +1,55 @@ +/* + +Copyright (C) 2004 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#if !defined (octave_int16_h) +#define octave_int16_h 1 + +#if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) +#pragma interface +#endif + +#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 + +#include "ov-intx.h" + +#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 + +#endif + +/* +;;; Local Variables: *** +;;; mode: C++ *** +;;; End: *** +*/ +
new file mode 100644 --- /dev/null +++ b/src/ov-int32.h @@ -0,0 +1,55 @@ +/* + +Copyright (C) 2004 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#if !defined (octave_int32_h) +#define octave_int32_h 1 + +#if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) +#pragma interface +#endif + +#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 + +#include "ov-intx.h" + +#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 + +#endif + +/* +;;; Local Variables: *** +;;; mode: C++ *** +;;; End: *** +*/ +
new file mode 100644 --- /dev/null +++ b/src/ov-int64.h @@ -0,0 +1,55 @@ +/* + +Copyright (C) 2004 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#if !defined (octave_int64_h) +#define octave_int64_h 1 + +#if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) +#pragma interface +#endif + +#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 + +#include "ov-intx.h" + +#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 + +#endif + +/* +;;; Local Variables: *** +;;; mode: C++ *** +;;; End: *** +*/ +
new file mode 100644 --- /dev/null +++ b/src/ov-int8.h @@ -0,0 +1,55 @@ +/* + +Copyright (C) 2004 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#if !defined (octave_int8_h) +#define octave_int8_h 1 + +#if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) +#pragma interface +#endif + +#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 + +#include "ov-intx.h" + +#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 + +#endif + +/* +;;; Local Variables: *** +;;; mode: C++ *** +;;; End: *** +*/ +
new file mode 100644 --- /dev/null +++ b/src/ov-intx.h @@ -0,0 +1,112 @@ +/* + +Copyright (C) 2004 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#include <cstdlib> + +#include <iostream> +#include <string> + +#include "mx-base.h" +#include "oct-alloc.h" +#include "so-array.h" +#include "str-vec.h" + +#include "error.h" +#include "ov-base.h" +#include "ov-base-int.h" +#include "ov-typeinfo.h" + +class +OCTAVE_VALUE_INT_MATRIX_T + : public octave_base_int_matrix<OCTAVE_INT_NDARRAY_T> +{ +public: + + OCTAVE_VALUE_INT_MATRIX_T (void) + : octave_base_int_matrix<OCTAVE_INT_NDARRAY_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 (void) { } + + octave_value * + clone (void) const + { return new OCTAVE_VALUE_INT_MATRIX_T (*this); } + + octave_value * + empty_clone (void) const + { return new OCTAVE_VALUE_INT_MATRIX_T (); } + + OCTAVE_INT_NDARRAY_T + OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION (bool = false) const + { return matrix; } + +private: + + DECLARE_OCTAVE_ALLOCATOR + + DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA +}; + +class +OCTAVE_VALUE_INT_SCALAR_T + : public octave_base_int_scalar<OCTAVE_INT_T> +{ +public: + + OCTAVE_VALUE_INT_SCALAR_T (void) + : octave_base_int_scalar<OCTAVE_INT_T> () { } + + OCTAVE_VALUE_INT_SCALAR_T (const OCTAVE_INT_T& nda) + : octave_base_int_scalar<OCTAVE_INT_T> (nda) { } + + ~OCTAVE_VALUE_INT_SCALAR_T (void) { } + + octave_value * + clone (void) const + { return new OCTAVE_VALUE_INT_SCALAR_T (*this); } + + octave_value * + empty_clone (void) const + { return new OCTAVE_VALUE_INT_SCALAR_T (); } + + OCTAVE_INT_T + OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION (bool = false) const + { return scalar; } + + OCTAVE_INT_NDARRAY_T + OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION (bool = false) const + { return scalar; } + +private: + + DECLARE_OCTAVE_ALLOCATOR + + DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA +}; + +/* +;;; Local Variables: *** +;;; mode: C++ *** +;;; End: *** +*/
new file mode 100644 --- /dev/null +++ b/src/ov-uint16.h @@ -0,0 +1,55 @@ +/* + +Copyright (C) 2004 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#if !defined (octave_uint16_h) +#define octave_uint16_h 1 + +#if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) +#pragma interface +#endif + +#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 + +#include "ov-intx.h" + +#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 + +#endif + +/* +;;; Local Variables: *** +;;; mode: C++ *** +;;; End: *** +*/ +
new file mode 100644 --- /dev/null +++ b/src/ov-uint32.h @@ -0,0 +1,55 @@ +/* + +Copyright (C) 2004 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#if !defined (octave_uint32_h) +#define octave_uint32_h 1 + +#if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) +#pragma interface +#endif + +#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 + +#include "ov-intx.h" + +#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 + +#endif + +/* +;;; Local Variables: *** +;;; mode: C++ *** +;;; End: *** +*/ +
new file mode 100644 --- /dev/null +++ b/src/ov-uint64.h @@ -0,0 +1,55 @@ +/* + +Copyright (C) 2004 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#if !defined (octave_uint64_h) +#define octave_uint64_h 1 + +#if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) +#pragma interface +#endif + +#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 + +#include "ov-intx.h" + +#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 + +#endif + +/* +;;; Local Variables: *** +;;; mode: C++ *** +;;; End: *** +*/ +
new file mode 100644 --- /dev/null +++ b/src/ov-uint8.h @@ -0,0 +1,55 @@ +/* + +Copyright (C) 2004 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#if !defined (octave_uint8_h) +#define octave_uint8_h 1 + +#if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) +#pragma interface +#endif + +#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 + +#include "ov-intx.h" + +#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 + +#endif + +/* +;;; Local Variables: *** +;;; mode: C++ *** +;;; End: *** +*/ +