Mercurial > hg > octave-lojdl
changeset 7885:f336dd8e96d0
eliminate streamoff type
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 12 Jun 2008 10:42:56 -0400 |
parents | e88411265a75 |
children | e3e94982dfd4 |
files | liboctave/Array-so.cc liboctave/ChangeLog liboctave/Makefile.in liboctave/so-array.cc liboctave/so-array.h src/ChangeLog src/Makefile.in src/OPERATORS/op-streamoff.cc src/file-io.cc src/ov-base-int.h src/ov-base.cc src/ov-base.h src/ov-bool-sparse.h src/ov-cx-sparse.h src/ov-float.cc src/ov-float.h src/ov-flt-re-mat.cc src/ov-flt-re-mat.h src/ov-intx.h src/ov-re-mat.cc src/ov-re-mat.h src/ov-re-sparse.cc src/ov-re-sparse.h src/ov-scalar.cc src/ov-scalar.h src/ov-streamoff.cc src/ov-streamoff.h src/ov.cc src/ov.h |
diffstat | 29 files changed, 37 insertions(+), 964 deletions(-) [+] |
line wrap: on
line diff
deleted file mode 100644 --- a/liboctave/Array-so.cc +++ /dev/null @@ -1,47 +0,0 @@ -/* - -Copyright (C) 2003, 2005, 2007 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 3 of the License, 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, see -<http://www.gnu.org/licenses/>. - -*/ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -// Instantiate Arrays of std::streamoff values. - -#include "Array.h" -#include "Array.cc" - -INSTANTIATE_ARRAY_AND_ASSIGN (std::streamoff, OCTAVE_API); - -#include "Array2.h" - -template class Array2<std::streamoff>; - -#include "ArrayN.h" -#include "ArrayN.cc" - -template class ArrayN<std::streamoff>; - -/* -;;; Local Variables: *** -;;; mode: C++ *** -;;; End: *** -*/
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2008-06-11 John W. Eaton <jwe@octave.org> + + * so-array.h, so-array.cc, Array-so.cc: Delete. + * Makefile.in: Remove them from the lists. + 2008-06-05 John W. Eaton <jwe@octave.org> * oct-shlib.cc (octave_base_shlib::remove): Only dereference
--- a/liboctave/Makefile.in +++ b/liboctave/Makefile.in @@ -93,7 +93,7 @@ oct-sparse.h oct-time.h oct-uname.h \ pathlen.h pathsearch.h prog-args.h \ randgamma.h randmtzig.h randpoisson.h regex-match.h \ - so-array.h sparse-sort.h statdefs.h str-vec.h \ + sparse-sort.h statdefs.h str-vec.h \ sparse-util.h sun-utils.h sysdir.h systime.h syswait.h \ $(MATRIX_INC) @@ -109,7 +109,7 @@ sparse-dmsolve.cc TI_SRC := Array-C.cc Array-b.cc Array-ch.cc Array-i.cc Array-d.cc \ - Array-f.cc Array-fC.cc Array-s.cc Array-so.cc Array-str.cc \ + Array-f.cc Array-fC.cc Array-s.cc Array-str.cc \ Array-idx-vec.cc MArray-C.cc MArray-ch.cc MArray-i.cc MArray-d.cc \ MArray-f.cc MArray-fC.cc MArray-s.cc MSparse-C.cc MSparse-d.cc \ Sparse-C.cc Sparse-b.cc Sparse-d.cc oct-inttypes.cc @@ -151,7 +151,7 @@ oct-fftw.cc oct-group.cc oct-md5.cc oct-passwd.cc oct-rand.cc \ oct-shlib.cc oct-spparms.cc oct-syscalls.cc oct-time.cc oct-uname.cc \ prog-args.cc regex-match.cc \ - so-array.cc sparse-sort.cc sparse-util.cc str-vec.cc \ + sparse-sort.cc sparse-util.cc str-vec.cc \ $(TEMPLATE_SRC) \ $(TI_SRC) \ $(MATRIX_SRC)
deleted file mode 100644 --- a/liboctave/so-array.cc +++ /dev/null @@ -1,138 +0,0 @@ -/* - -Copyright (C) 2003, 2004, 2005, 2006, 2007 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 3 of the License, 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, see -<http://www.gnu.org/licenses/>. - -*/ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <iostream> - -#include "ArrayN.h" -#include "Array-util.h" -// FIXME -- we are including the MArray{,2,N}.h files just for -// their gripe_nonconformant function decls. -#include "MArray.h" -#include "MArray2.h" -#include "MArrayN.h" -#include "MArray-defs.h" -#include "boolMatrix.h" -#include "boolNDArray.h" -#include "mx-op-defs.h" -#include "so-array.h" - -boolNDArray -streamoff_array::all (int dim) const -{ - MX_ND_ANY_ALL_REDUCTION (MX_ND_ALL_EVAL (MX_ND_ALL_EXPR), true); -} - -boolNDArray -streamoff_array::any (int dim) const -{ - MX_ND_ANY_ALL_REDUCTION (MX_ND_ANY_EVAL (MX_ND_ANY_EXPR), false); -} - -streamoff_array& -operator += (streamoff_array& a, const std::streamoff& s) -{ - DO_VS_OP2 (std::streamoff, a, +=, s) - return a; -} - -streamoff_array& -operator -= (streamoff_array& a, const std::streamoff& s) -{ - DO_VS_OP2 (std::streamoff, a, -=, s); - return a; -} - -streamoff_array& -operator += (streamoff_array& a, const streamoff_array& b) -{ - octave_idx_type l = a.length (); - if (l > 0) - { - octave_idx_type bl = b.length (); - if (l != bl) - gripe_nonconformant ("operator +=", l, bl); - else - DO_VV_OP2 (std::streamoff, a, +=, b); - } - return a; -} - -streamoff_array& -operator -= (streamoff_array& a, const streamoff_array& b) -{ - octave_idx_type l = a.length (); - if (l > 0) - { - octave_idx_type bl = b.length (); - if (l != bl) - gripe_nonconformant ("operator -=", l, bl); - else - DO_VV_OP2 (std::streamoff, a, -=, b); - } - return a; -} - -octave_idx_type -streamoff_array::compute_index (Array<octave_idx_type>& ra_idx, - const dim_vector& dimensions) -{ - return ::compute_index (ra_idx, dimensions); -} - -SND_CMP_OP (mx_el_eq, ==, std::streamoff, , streamoff_array, ) -SND_CMP_OP (mx_el_ne, !=, std::streamoff, , streamoff_array, ) - -NDS_CMP_OP (mx_el_eq, ==, streamoff_array, , std::streamoff, ) -NDS_CMP_OP (mx_el_ne, !=, streamoff_array, , std::streamoff, ) - -NDND_CMP_OP (mx_el_eq, ==, streamoff_array, , streamoff_array, ) -NDND_CMP_OP (mx_el_ne, !=, streamoff_array, , streamoff_array, ) - -NDND_BIN_OP (streamoff_array, operator +, - streamoff_array, streamoff_array, mx_inline_add) - -NDND_BIN_OP (streamoff_array, operator -, - streamoff_array, streamoff_array, mx_inline_subtract) - - -NDS_BIN_OP (streamoff_array, operator +, - streamoff_array, std::streamoff, mx_inline_add) - -NDS_BIN_OP (streamoff_array, operator -, - streamoff_array, std::streamoff, mx_inline_subtract) - - -SND_BIN_OP (streamoff_array, operator +, - std::streamoff, streamoff_array, mx_inline_add) - -SND_BIN_OP (streamoff_array, operator -, - std::streamoff, streamoff_array, mx_inline_subtract) - -/* -;;; Local Variables: *** -;;; mode: C++ *** -;;; End: *** -*/
deleted file mode 100644 --- a/liboctave/so-array.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - -Copyright (C) 2003, 2004, 2005, 2006, 2007 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 3 of the License, 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, see -<http://www.gnu.org/licenses/>. - -*/ - -#if !defined (octave_streamoff_array_h) -#define octave_streamoff_array_h 1 - -#include <iostream> - -#include "ArrayN.h" -#include "mx-op-defs.h" - -class boolNDArray; - -// Stream offsets. - -class OCTAVE_API streamoff_array : public ArrayN<std::streamoff> -{ -public: - - streamoff_array (void) : ArrayN<std::streamoff> () { } - - streamoff_array (const dim_vector& dv, - const std::streamoff& val = resize_fill_value ()) - : ArrayN<std::streamoff> (dv, val) { } - - streamoff_array (const ArrayN<std::streamoff>& sa) - : ArrayN<std::streamoff> (sa) { } - - streamoff_array (const streamoff_array& sa) - : ArrayN<std::streamoff> (sa) { } - - ~streamoff_array (void) { } - - streamoff_array& operator = (const streamoff_array& sa) - { - if (this != &sa) - ArrayN<std::streamoff>::operator = (sa); - - return *this; - } - - streamoff_array squeeze (void) const - { return ArrayN<std::streamoff>::squeeze (); } - - octave_idx_type nnz (void) const - { - octave_idx_type retval = 0; - - const std::streamoff *d = this->data (); - - octave_idx_type nel = this->numel (); - - for (octave_idx_type i = 0; i < nel; i++) - { - if (d[i]) - retval++; - } - - return retval; - } - - boolNDArray all (int dim = -1) const; - boolNDArray any (int dim = -1) const; - - static octave_idx_type compute_index (Array<octave_idx_type>& ra_idx, - const dim_vector& dimensions); - - static std::streamoff resize_fill_value (void) { return 0; } -}; - -OCTAVE_API streamoff_array& operator += (streamoff_array& l, const std::streamoff& r); -OCTAVE_API streamoff_array& operator -= (streamoff_array& l, const std::streamoff& r); - -OCTAVE_API streamoff_array& operator += (streamoff_array& l, const streamoff_array& r); -OCTAVE_API streamoff_array& operator -= (streamoff_array& l, const streamoff_array& r); - -NDCMP_OP_DECL (mx_el_eq, std::streamoff, streamoff_array, OCTAVE_API); -NDCMP_OP_DECL (mx_el_ne, std::streamoff, streamoff_array, OCTAVE_API); - -NDCMP_OP_DECL (mx_el_eq, streamoff_array, std::streamoff, OCTAVE_API); -NDCMP_OP_DECL (mx_el_ne, streamoff_array, std::streamoff, OCTAVE_API); - -NDCMP_OP_DECL (mx_el_eq, streamoff_array, streamoff_array, OCTAVE_API); -NDCMP_OP_DECL (mx_el_ne, streamoff_array, streamoff_array, OCTAVE_API); - -BIN_OP_DECL (streamoff_array, operator +, streamoff_array, streamoff_array, OCTAVE_API); -BIN_OP_DECL (streamoff_array, operator -, streamoff_array, streamoff_array, OCTAVE_API); - -BIN_OP_DECL (streamoff_array, operator +, streamoff_array, std::streamoff, OCTAVE_API); -BIN_OP_DECL (streamoff_array, operator -, streamoff_array, std::streamoff, OCTAVE_API); - -BIN_OP_DECL (streamoff_array, operator +, std::streamoff, streamoff_array, OCTAVE_API); -BIN_OP_DECL (streamoff_array, operator -, std::streamoff, streamoff_array, OCTAVE_API); - -#endif - -/* -;;; Local Variables: *** -;;; mode: C++ *** -;;; End: *** -*/
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,31 @@ 2008-06-11 John W. Eaton <jwe@octave.org> + * ov-base.cc (octave_base_value::streamoff_value, + octave_base_value::streamoff_array_value): Delete. + * ov-base.h: Delete decls. + (octave_base_value::is_streamoff): Delete. + * ov-float.cc (octave_float_scalar::streamoff_value, + octave_float_scalar::streamoff_array_value): Delete. + * ov-float.h: Delete decls. + * ov-flt-re-mat.cc (octave_float_matrix::streamoff_array_value): Delete. + * ov-flt-re-mat.h: Delete decl. + * ov-re-mat.cc (octave_matrix::streamoff_array_value): Delete. + * ov-re-mat.h: Delete decl. + * ov-re-sparse.cc (octave_sparse_matrix::streamoff_array_value): Delete. + * ov-re-sparse.h: Delete decl. + * ov-scalar.cc (octave_scalar::streamoff_value, + octave_scalar::streamoff_array_value): Delete. + * ov-scalar.h: Delete decls. + * ov.cc (octave_value::octave_value (const streamoff_array&), + octave_value::octave_value (const ArrayN<std::streamoff>&), + octave_value::streamoff_value (void) const, + octave_value::streamoff_array_value (void) const): Delete. + * ov.h: Delete decls. + (octave_value::is_streamoff): Delete. + * ov.cc (install_types): Don't register streamoff type. + * ov-streamoff.h, ov-streamoff.cc, OPERATORS/op-streamoff.cc: Delete. + * Makefile.in: Delete them from the lists. + * error.cc (verror): Restore newline in msg_string. Stripping "error: " prefix when buffering error messages is no longer neeed.
--- a/src/Makefile.in +++ b/src/Makefile.in @@ -100,7 +100,7 @@ OV_INCLUDES := ov-re-mat.h ov-cx-mat.h ov-ch-mat.h ov-cs-list.h ov-list.h \ ov-struct.h ov-scalar.h ov-range.h ov-complex.h \ ov-colon.h ov-base.h ov-base-mat.h ov-base-scalar.h \ - ov-streamoff.h ov-str-mat.h ov-bool-mat.h ov-bool.h \ + ov-str-mat.h ov-bool-mat.h ov-bool.h \ ov-cell.h ov.h ov-fcn.h ov-builtin.h ov-dld-fcn.h \ ov-mex-fcn.h ov-usr-fcn.h ov-fcn-handle.h \ ov-fcn-inline.h ov-class.h ov-typeinfo.h ov-type-conv.h \ @@ -162,7 +162,7 @@ OP_XSRC := op-b-b.cc op-b-bm.cc op-bm-b.cc op-bm-bm.cc op-cell.cc \ op-chm.cc op-class.cc op-list.cc op-range.cc op-str-m.cc \ - op-str-s.cc op-str-str.cc op-streamoff.cc op-struct.cc \ + op-str-s.cc op-str-str.cc op-struct.cc \ $(DOUBLE_OP_XSRC) $(FLOAT_OP_XSRC) $(INTTYPE_OP_XSRC) \ $(SPARSE_OP_XSRC) @@ -180,7 +180,7 @@ OV_SRC := ov-base.cc ov-ch-mat.cc \ ov-cs-list.cc ov-list.cc ov-re-mat.cc ov-cx-mat.cc \ ov-range.cc ov-scalar.cc ov-complex.cc ov-str-mat.cc \ - ov-streamoff.cc ov-struct.cc \ + ov-struct.cc \ ov-colon.cc ov-bool-mat.cc ov-bool.cc ov-cell.cc \ ov.cc ov-fcn.cc ov-builtin.cc ov-dld-fcn.cc \ ov-mex-fcn.cc ov-usr-fcn.cc ov-fcn-handle.cc ov-fcn-inline.cc \
deleted file mode 100644 --- a/src/OPERATORS/op-streamoff.cc +++ /dev/null @@ -1,170 +0,0 @@ -/* - -Copyright (C) 2003, 2004, 2005, 2006, 2007 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 3 of the License, 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, see -<http://www.gnu.org/licenses/>. - -*/ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "gripes.h" -#include "ov.h" -#include "ov-re-mat.h" -#include "ov-scalar.h" -#include "ov-streamoff.h" -#include "ov-typeinfo.h" -#include "ops.h" - -// streamoff unary ops. - -DEFUNOP (transpose, streamoff) -{ - CAST_UNOP_ARG (const octave_streamoff&); - - if (v.ndims () > 2) - { - error ("transpose not defined for N-d objects"); - return octave_value (); - } - else - return octave_value (streamoff_array (v.streamoff_array_value().transpose ())); -} - -DEFNCUNOP_METHOD (incr, streamoff, increment) -DEFNCUNOP_METHOD (decr, streamoff, decrement) - -// streamoff by streamoff ops. - -DEFNDBINOP_OP (add, streamoff, streamoff, streamoff_array, streamoff_array, +) -DEFNDBINOP_OP (sub, streamoff, streamoff, streamoff_array, streamoff_array, -) - -DEFNDBINOP_OP (add_so_m, streamoff, matrix, streamoff_array, streamoff_array, +) -DEFNDBINOP_OP (sub_so_m, streamoff, matrix, streamoff_array, streamoff_array, -) - -DEFNDBINOP_OP (add_m_so, matrix, streamoff, streamoff_array, streamoff_array, +) -DEFNDBINOP_OP (sub_m_so, matrix, streamoff, streamoff_array, streamoff_array, +) -DEFNDBINOP_OP (add_so_s, streamoff, scalar, streamoff_array, streamoff, +) -DEFNDBINOP_OP (sub_so_s, streamoff, scalar, streamoff_array, streamoff, -) - -DEFNDBINOP_OP (add_s_so, scalar, streamoff, streamoff, streamoff_array, +) -DEFNDBINOP_OP (sub_s_so, scalar, streamoff, streamoff, streamoff_array, +) - -#define STREAMOFF_COMP_OP(FN, OP, T1, T2) \ - DEFBINOP (FN, T1, T2) \ - { \ - CAST_BINOP_ARGS (const octave_ ## T1&, const octave_ ## T2&); \ - \ - streamoff_array cm1 = v1.streamoff_array_value (); \ - streamoff_array cm2 = v2.streamoff_array_value (); \ - \ - if (! error_state) \ - { \ - if (cm1.rows () == 1 && cm1.columns () == 1) \ - { \ - if (cm2.rows () == 1 && cm2.columns () == 1) \ - return octave_value (cm1(0,0) OP cm2(0,0)); \ - else \ - SC_MX_BOOL_OP (std::streamoff, c, cm1 (0, 0), streamoff_array, \ - m, cm2, c OP m(i,j), 0.0); \ - } \ - else \ - { \ - if (cm2.rows () == 1 && cm2.columns () == 1) \ - MX_SC_BOOL_OP (streamoff_array, m, cm1, std::streamoff, \ - c, cm2(0,0), c OP m(i,j), 0.0); \ - else \ - MX_MX_BOOL_OP (streamoff_array, m1, cm1, streamoff_array, \ - m2, cm2, m1(i,j) OP m2(i,j), #OP, 0.0, 1.0); \ - } \ - } \ - \ - return boolMatrix (); \ - } - -STREAMOFF_COMP_OP (eq, ==, streamoff, streamoff); -STREAMOFF_COMP_OP (ne, !=, streamoff, streamoff); - -STREAMOFF_COMP_OP (eq_so_m, ==, streamoff, matrix); -STREAMOFF_COMP_OP (ne_so_m, !=, streamoff, matrix); - -STREAMOFF_COMP_OP (eq_m_so, ==, matrix, streamoff); -STREAMOFF_COMP_OP (ne_m_so, !=, matrix, streamoff); - -STREAMOFF_COMP_OP (eq_so_s, ==, streamoff, scalar); -STREAMOFF_COMP_OP (ne_so_s, !=, streamoff, scalar); - -STREAMOFF_COMP_OP (eq_s_so, ==, scalar, streamoff); -STREAMOFF_COMP_OP (ne_s_so, !=, scalar, streamoff); - -DEFASSIGNOP (assign, streamoff, streamoff) -{ - CAST_BINOP_ARGS (octave_streamoff&, const octave_streamoff&); - - v1.assign (idx, v2.streamoff_array_value ()); - return octave_value (); -} - -void -install_streamoff_ops (void) -{ - INSTALL_UNOP (op_transpose, octave_streamoff, transpose); - INSTALL_UNOP (op_hermitian, octave_streamoff, transpose); - - INSTALL_NCUNOP (op_incr, octave_streamoff, incr); - INSTALL_NCUNOP (op_decr, octave_streamoff, decr); - - INSTALL_BINOP (op_eq, octave_streamoff, octave_streamoff, eq); - INSTALL_BINOP (op_ne, octave_streamoff, octave_streamoff, ne); - - INSTALL_BINOP (op_eq, octave_streamoff, octave_matrix, eq_so_m); - INSTALL_BINOP (op_ne, octave_streamoff, octave_matrix, ne_so_m); - - INSTALL_BINOP (op_eq, octave_matrix, octave_streamoff, eq_m_so); - INSTALL_BINOP (op_ne, octave_matrix, octave_streamoff, ne_m_so); - - INSTALL_BINOP (op_eq, octave_streamoff, octave_scalar, eq_so_s); - INSTALL_BINOP (op_ne, octave_streamoff, octave_scalar, ne_so_s); - - INSTALL_BINOP (op_eq, octave_scalar, octave_streamoff, eq_s_so); - INSTALL_BINOP (op_ne, octave_scalar, octave_streamoff, ne_s_so); - - INSTALL_BINOP (op_add, octave_streamoff, octave_streamoff, add); - INSTALL_BINOP (op_sub, octave_streamoff, octave_streamoff, sub); - - INSTALL_BINOP (op_add, octave_streamoff, octave_matrix, add_so_m); - INSTALL_BINOP (op_sub, octave_streamoff, octave_matrix, sub_so_m); - - INSTALL_BINOP (op_add, octave_matrix, octave_streamoff, add_m_so); - INSTALL_BINOP (op_sub, octave_matrix, octave_streamoff, sub_m_so); - - INSTALL_BINOP (op_add, octave_streamoff, octave_scalar, add_so_s); - INSTALL_BINOP (op_sub, octave_streamoff, octave_scalar, sub_so_s); - - INSTALL_BINOP (op_add, octave_scalar, octave_streamoff, add_s_so); - INSTALL_BINOP (op_sub, octave_scalar, octave_streamoff, sub_s_so); - - INSTALL_ASSIGNOP (op_asn_eq, octave_streamoff, octave_streamoff, assign); -} - -/* -;;; Local Variables: *** -;;; mode: C++ *** -;;; End: *** -*/
--- a/src/file-io.cc +++ b/src/file-io.cc @@ -75,7 +75,6 @@ #include "oct-stream.h" #include "oct-strstrm.h" #include "pager.h" -#include "so-array.h" #include "sysdep.h" #include "utils.h" #include "variables.h"
--- a/src/ov-base-int.h +++ b/src/ov-base-int.h @@ -30,7 +30,6 @@ #include "mx-base.h" #include "oct-alloc.h" -#include "so-array.h" #include "str-vec.h" #include "error.h"
--- a/src/ov-base.cc +++ b/src/ov-base.cc @@ -31,7 +31,6 @@ #include "lo-ieee.h" #include "lo-mappers.h" -#include "so-array.h" #include "defun.h" #include "gripes.h" @@ -794,23 +793,6 @@ return retval; } -std::streamoff -octave_base_value::streamoff_value (void) const -{ - std::streamoff retval (-1); - gripe_wrong_type_arg ("octave_base_value::streamoff_value()", type_name ()); - return retval; -} - -streamoff_array -octave_base_value::streamoff_array_value (void) const -{ - streamoff_array retval; - gripe_wrong_type_arg ("octave_base_value::streamoff_array_value()", - type_name ()); - return retval; -} - octave_function * octave_base_value::function_value (bool silent) {
--- a/src/ov-base.h +++ b/src/ov-base.h @@ -43,12 +43,10 @@ #include "error.h" class Cell; -class streamoff_array; class Octave_map; class octave_value; class octave_value_list; class octave_stream; -class octave_streamoff; class octave_function; class octave_user_function; class octave_user_script; @@ -230,8 +228,6 @@ virtual bool is_object (void) const { return false; } - virtual bool is_streamoff (void) const { return false; } - virtual bool is_cs_list (void) const { return false; } virtual bool is_list (void) const { return false; } @@ -416,10 +412,6 @@ virtual string_vector map_keys (void) const; - virtual std::streamoff streamoff_value (void) const; - - virtual streamoff_array streamoff_array_value (void) const; - virtual octave_function *function_value (bool silent = false); virtual const octave_function *function_value (bool silent = false) const;
--- a/src/ov-bool-sparse.h +++ b/src/ov-bool-sparse.h @@ -31,7 +31,6 @@ #include "mx-base.h" #include "oct-alloc.h" -#include "so-array.h" #include "str-vec.h" #include "error.h"
--- a/src/ov-cx-sparse.h +++ b/src/ov-cx-sparse.h @@ -31,7 +31,6 @@ #include "mx-base.h" #include "oct-alloc.h" -#include "so-array.h" #include "str-vec.h" #include "error.h"
--- a/src/ov-float.cc +++ b/src/ov-float.cc @@ -84,32 +84,6 @@ return retval; } -std::streamoff -octave_float_scalar::streamoff_value (void) const -{ - std::streamoff retval (-1); - - if (D_NINT (scalar) == scalar) - retval = std::streamoff (static_cast<long> (scalar)); - else - error ("conversion to streamoff value failed"); - - return retval; -} - -streamoff_array -octave_float_scalar::streamoff_array_value (void) const -{ - streamoff_array retval; - - std::streamoff soff = streamoff_value (); - - if (! error_state) - retval = streamoff_array (dim_vector (1, 1), soff); - - return retval; -} - octave_value octave_float_scalar::resize (const dim_vector& dv, bool fill) const {
--- a/src/ov-float.h +++ b/src/ov-float.h @@ -205,10 +205,6 @@ return boolNDArray (dim_vector (1, 1), scalar); } - std::streamoff streamoff_value (void) const; - - streamoff_array streamoff_array_value (void) const; - octave_value convert_to_str_internal (bool pad, bool force, char type) const; void increment (void) { ++scalar; }
--- a/src/ov-flt-re-mat.cc +++ b/src/ov-flt-re-mat.cc @@ -252,29 +252,6 @@ return SparseComplexMatrix (sparse_matrix_value ()); } -streamoff_array -octave_float_matrix::streamoff_array_value (void) const -{ - streamoff_array retval (dims ()); - - octave_idx_type nel = numel (); - - for (octave_idx_type i = 0; i < nel; i++) - { - float d = matrix(i); - - if (F_NINT (d) == d) - retval(i) = std::streamoff (static_cast<long> (d)); - else - { - error ("conversion to streamoff_array value failed"); - break; - } - } - - return retval; -} - octave_value octave_float_matrix::convert_to_str_internal (bool, bool, char type) const {
--- a/src/ov-flt-re-mat.h +++ b/src/ov-flt-re-mat.h @@ -31,7 +31,6 @@ #include "mx-base.h" #include "oct-alloc.h" -#include "so-array.h" #include "str-vec.h" #include "error.h" @@ -163,8 +162,6 @@ SparseComplexMatrix sparse_complex_matrix_value (bool = false) const; - streamoff_array streamoff_array_value (void) const; - void increment (void) { matrix += 1.0; } void decrement (void) { matrix -= 1.0; }
--- a/src/ov-intx.h +++ b/src/ov-intx.h @@ -27,7 +27,6 @@ #include "mx-base.h" #include "oct-alloc.h" -#include "so-array.h" #include "str-vec.h" #include "error.h"
--- a/src/ov-re-mat.cc +++ b/src/ov-re-mat.cc @@ -258,29 +258,6 @@ return SparseComplexMatrix (sparse_matrix_value ()); } -streamoff_array -octave_matrix::streamoff_array_value (void) const -{ - streamoff_array retval (dims ()); - - octave_idx_type nel = numel (); - - for (octave_idx_type i = 0; i < nel; i++) - { - double d = matrix(i); - - if (D_NINT (d) == d) - retval(i) = std::streamoff (static_cast<long> (d)); - else - { - error ("conversion to streamoff_array value failed"); - break; - } - } - - return retval; -} - octave_value octave_matrix::convert_to_str_internal (bool, bool, char type) const {
--- a/src/ov-re-mat.h +++ b/src/ov-re-mat.h @@ -31,7 +31,6 @@ #include "mx-base.h" #include "oct-alloc.h" -#include "so-array.h" #include "str-vec.h" #include "error.h" @@ -162,8 +161,6 @@ SparseComplexMatrix sparse_complex_matrix_value (bool = false) const; - streamoff_array streamoff_array_value (void) const; - void increment (void) { matrix += 1.0; } void decrement (void) { matrix -= 1.0; }
--- a/src/ov-re-sparse.cc +++ b/src/ov-re-sparse.cc @@ -188,33 +188,6 @@ return NDArray (matrix.matrix_value ()); } -streamoff_array -octave_sparse_matrix::streamoff_array_value (void) const -{ - streamoff_array retval (dims ()); - octave_idx_type nc = matrix.cols (); - octave_idx_type nr = matrix.rows (); - - for (octave_idx_type j = 0; j < nc; j++) - for (octave_idx_type i = matrix.cidx(j); i < matrix.cidx(j+1); i++) - { - double d = matrix.data(i); - - if (D_NINT (d) == d) - { - retval(matrix.ridx(i) + nr * j) = - std::streamoff (static_cast<long> (d)); - } - else - { - error ("conversion to streamoff_array value failed"); - break; - } - } - - return retval; -} - octave_value octave_sparse_matrix::convert_to_str_internal (bool, bool, char type) const {
--- a/src/ov-re-sparse.h +++ b/src/ov-re-sparse.h @@ -31,7 +31,6 @@ #include "mx-base.h" #include "oct-alloc.h" -#include "so-array.h" #include "str-vec.h" #include "error.h" @@ -129,8 +128,6 @@ SparseComplexMatrix sparse_complex_matrix_value (bool = false) const { return SparseComplexMatrix (matrix); } - streamoff_array streamoff_array_value (void) const; - octave_value convert_to_str_internal (bool pad, bool force, char type) const; #if 0
--- a/src/ov-scalar.cc +++ b/src/ov-scalar.cc @@ -98,32 +98,6 @@ return retval; } -std::streamoff -octave_scalar::streamoff_value (void) const -{ - std::streamoff retval (-1); - - if (D_NINT (scalar) == scalar) - retval = std::streamoff (static_cast<long> (scalar)); - else - error ("conversion to streamoff value failed"); - - return retval; -} - -streamoff_array -octave_scalar::streamoff_array_value (void) const -{ - streamoff_array retval; - - std::streamoff soff = streamoff_value (); - - if (! error_state) - retval = streamoff_array (dim_vector (1, 1), soff); - - return retval; -} - octave_value octave_scalar::resize (const dim_vector& dv, bool fill) const {
--- a/src/ov-scalar.h +++ b/src/ov-scalar.h @@ -206,10 +206,6 @@ return boolNDArray (dim_vector (1, 1), scalar); } - std::streamoff streamoff_value (void) const; - - streamoff_array streamoff_array_value (void) const; - octave_value convert_to_str_internal (bool pad, bool force, char type) const; void increment (void) { ++scalar; }
deleted file mode 100644 --- a/src/ov-streamoff.cc +++ /dev/null @@ -1,170 +0,0 @@ -/* - -Copyright (C) 2003, 2004, 2005, 2006, 2007 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 3 of the License, 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, see -<http://www.gnu.org/licenses/>. - -*/ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <iostream> - -#include "so-array.h" - -#include "defun.h" -#include "error.h" -#include "gripes.h" -#include "ov-streamoff.h" -#include "oct-obj.h" -#include "utils.h" -#include "ov-base-mat.h" -#include "ov-base-mat.cc" - -template class octave_base_matrix<streamoff_array>; - -DEFINE_OCTAVE_ALLOCATOR (octave_streamoff); - -DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_streamoff, - "streamoff", "streamoff"); - -std::streamoff -octave_streamoff::streamoff_value (void) const -{ - std::streamoff retval (-1); - - if (numel () > 0) - { - gripe_implicit_conversion ("Octave:array-as-scalar", - "streamoff array", "scalar streamoff"); - - retval = matrix (0, 0); - } - else - gripe_invalid_conversion ("streamoff array", "scalar streamoff"); - - return retval; -} - -void -octave_streamoff::print (std::ostream& os, bool) const -{ - print_raw (os); - newline (os); -} - -void -octave_streamoff::print_raw (std::ostream& os, bool) const -{ - dim_vector dv = matrix.dims (); - os << "<" << dv.str () << " streamoff object>"; -} - -DEFUN (isstreamoff, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} isstreamoff (@var{x})\n\ -Return true if @var{x} is a streamoff object. Otherwise, return\n\ -false.\n\ -@end deftypefn") -{ - octave_value retval; - - if (args.length () == 1) - retval = args(0).is_streamoff (); - else - print_usage (); - - return retval; -} - -DEFUN (streamoff, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} streamoff (@var{x})\n\ -@deftypefnx {Built-in Function} {} streamoff (@var{n}, @var{m})\n\ -Create a new streamoff array object. If invoked with a single scalar\n\ -argument, @code{streamoff} returns a square streamoff array with\n\ -the dimension specified. If you supply two scalar arguments,\n\ -@code{streamoff} takes them to be the number of rows and columns.\n\ -If given a vector with two elements, @code{streamoff} uses the values\n\ -of the elements as the number of rows and columns, respectively.\n\ -@end deftypefn") -{ - octave_value retval; - - int nargin = args.length (); - - dim_vector dims; - - switch (nargin) - { - case 0: - dims = dim_vector (0, 0); - break; - - case 1: - get_dimensions (args(0), "streamoff", dims); - break; - - default: - { - dims.resize (nargin); - - for (int i = 0; i < nargin; i++) - { - dims(i) = args(i).is_empty () ? 0 : args(i).nint_value (); - - if (error_state) - { - error ("streamoff: expecting scalar arguments"); - break; - } - } - } - break; - } - - if (! error_state) - { - int ndim = dims.length (); - - check_dimensions (dims, "streamoff"); - - if (! error_state) - { - switch (ndim) - { - case 1: - retval = Cell (dims(0), dims(0), Matrix ()); - break; - - default: - retval = Cell (dims, Matrix ()); - break; - } - } - } - - return retval; -} - -/* -;;; Local Variables: *** -;;; mode: C++ *** -;;; End: *** -*/
deleted file mode 100644 --- a/src/ov-streamoff.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - -Copyright (C) 2003, 2004, 2005, 2006, 2007 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 3 of the License, 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, see -<http://www.gnu.org/licenses/>. - -*/ - -#if !defined (octave_streamoff_h) -#define octave_streamoff_h 1 - -#include <iostream> - -#include "so-array.h" -#include "oct-alloc.h" - -#include "ov.h" -#include "ov-base-mat.h" -#include "ov-typeinfo.h" - -class tree_walker; - -// Stream offsets. - -class -octave_streamoff : public octave_base_matrix<streamoff_array> -{ -public: - - octave_streamoff (void) - : octave_base_matrix<streamoff_array> () { } - - octave_streamoff (const std::streamoff& off) - : octave_base_matrix<streamoff_array> - (streamoff_array (dim_vector (1, 1), off)) { } - - octave_streamoff (const streamoff_array& off) - : octave_base_matrix<streamoff_array> (off) { } - - octave_streamoff (const octave_streamoff& off) - : octave_base_matrix<streamoff_array> (off) { } - - ~octave_streamoff (void) { } - - octave_base_value *clone (void) const { return new octave_streamoff (*this); } - octave_base_value *empty_clone (void) const { return new octave_streamoff (); } - - bool is_defined (void) const { return true; } - - bool is_streamoff (void) const { return true; } - - std::streamoff streamoff_value (void) const; - - streamoff_array streamoff_array_value (void) const { return matrix; } - - void increment (void) { matrix += std::streamoff (1); } - - void decrement (void) { matrix -= std::streamoff (1); } - - bool print_as_scalar (void) const { return true; } - - void print (std::ostream& os, bool pr_as_read_syntax = false) const; - - void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; - - octave_value sort (octave_idx_type, sortmode) const - { - gripe_wrong_type_arg ("octave_base_value::sort ()", type_name ()); - return octave_value(); - } - octave_value sort (Array<octave_idx_type> &, octave_idx_type, - sortmode) const - { - gripe_wrong_type_arg ("octave_base_value::sort ()", type_name ()); - return octave_value(); - } - -private: - - DECLARE_OCTAVE_ALLOCATOR - - DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA -}; - -#endif - -/* -;;; Local Variables: *** -;;; mode: C++ *** -;;; End: *** -*/
--- a/src/ov.cc +++ b/src/ov.cc @@ -60,7 +60,6 @@ #include "ov-range.h" #include "ov-struct.h" #include "ov-class.h" -#include "ov-streamoff.h" #include "ov-list.h" #include "ov-cs-list.h" #include "ov-colon.h" @@ -974,16 +973,6 @@ { } -octave_value::octave_value (const streamoff_array& off) - : rep (new octave_streamoff (off)) -{ -} - -octave_value::octave_value (const ArrayN<std::streamoff>& inda) - : rep (new octave_streamoff (inda)) -{ -} - octave_value::octave_value (const octave_value_list& l, bool is_csl) : rep (is_csl ? dynamic_cast<octave_base_value *> (new octave_cs_list (l)) @@ -1244,18 +1233,6 @@ return rep->map_value (); } -std::streamoff -octave_value::streamoff_value (void) const -{ - return rep->streamoff_value (); -} - -streamoff_array -octave_value::streamoff_array_value (void) const -{ - return rep->streamoff_array_value (); -} - octave_function * octave_value::function_value (bool silent) { @@ -2730,7 +2707,6 @@ octave_dld_function::register_type (); octave_fcn_handle::register_type (); octave_fcn_inline::register_type (); - octave_streamoff::register_type (); octave_float_scalar::register_type (); octave_float_complex::register_type (); octave_float_matrix::register_type ();
--- a/src/ov.h +++ b/src/ov.h @@ -47,10 +47,8 @@ #include "oct-sort.h" class Cell; -class streamoff_array; class Octave_map; class octave_stream; -class octave_streamoff; class octave_function; class octave_user_function; class octave_fcn_handle; @@ -259,8 +257,6 @@ octave_value (const Range& r); octave_value (const Octave_map& m); octave_value (const Octave_map& m, const std::string& id); - octave_value (const streamoff_array& off); - octave_value (const ArrayN<std::streamoff>& inda); octave_value (const octave_value_list& m, bool is_cs_list = false); octave_value (octave_value::magic_colon); @@ -484,9 +480,6 @@ bool is_object (void) const { return rep->is_object (); } - bool is_streamoff (void) const - { return rep->is_streamoff (); } - bool is_cs_list (void) const { return rep->is_cs_list (); } @@ -787,10 +780,6 @@ string_vector map_keys (void) const { return rep->map_keys (); } - std::streamoff streamoff_value (void) const; - - streamoff_array streamoff_array_value (void) const; - octave_function *function_value (bool silent = false); const octave_function *function_value (bool silent = false) const;