# HG changeset patch # User jwe # Date 1069503945 0 # Node ID ef3a14fb6847290a27ef2b9b90aa652543059cc8 # Parent 7a83d52d2aed1b5bf710ebbef538260152d182f5 [project @ 2003-11-22 12:25:44 by jwe] diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,61 @@ +2003-11-22 John W. Eaton + + * ov-dld-fcn.h (octave_dld_function::octave_dld_function): + Make public, but abort if called. + * ov-builtin.h (octave_builtin::octave_builtin): Likewise. + * ov-fcn.h (octave_function::octave_function): Likewise. + + * ov-typeinfo.cc (octave_value_typeinfo::register_type, + octave_value_typeinfo::do_register_type): New arg, val. + (octave_value_typeinfo::lookup_type, + octave_value_typeinfo::do_lookup_type): New functions. + * ov-typeinfo.h: Provide decl. + + * ov.h (DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA): Pass + + * ov.h (DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA): Define register_type + here. Also pass an empty object of the to-be-registered type to + register_type. + (DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA): Declare register type + here, but don't define it. + +2003-11-21 John W. Eaton + + * ov-fcn-handle.h (octave_fcn_handle::octave_fcn_handle (void)): + New constructor. + + * ov-usr-fcn.h (octave_user_function::octave_user_function): + Delete decl for private constructor. + + * ov-str-mat.cc (octave_char_matrix_str::matrix_value): + Conversion to matrix is an error unless explicitly forced. + + * ov-str-mat.cc (octave_char_matrix_str::double_value): New function. + * ov-str-mat.h: Provide decl. + + * ov-file.cc (print_raw): Use parens around ?: conditional used on + RHS of << output operator. + + * c-file-ptr-stream.cc (c_file_ptr_buf::seekoff, + c_file_ptr_buf::seekpos): Can't use fseek here, so just fail (by + returning -1) until we have a better solution. + + * oct-stream.cc (octave_stream::tell): Return std::streamoff, not long. + * oct-iostrm.cc (octave_base_iostream::tell): Likewise. + * oct-stdstrm.cc (octave_stdiostream::tell): Likewise. + * oct-strstrm.cc (octave_base_strstream::tell): Likewise. + * oct-stream.h, oct-iostrm.h, oct-stdstrm.h, oct-strstrm.h: + Fix decls to match. + +2003-11-20 John W. Eaton + + * ls-mat-ascii.cc (get_lines_and_columns): Delete second arg in + call to istream::seekg. + + * ov-mapper.cc (MAPPER_LOOP_2, any_element_less_than, + any_element_greater_than, octave_mapper::apply): + Handle N-d arrays. + 2003-11-19 John W. Eaton * ls-mat5.cc (read_mat5_binary_element, save_mat5_binary_element): diff --git a/src/Makefile.in b/src/Makefile.in --- a/src/Makefile.in +++ b/src/Makefile.in @@ -69,9 +69,9 @@ 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-va-args.h \ ov-colon.h ov-base.h ov-base-mat.h ov-base-scalar.h \ - ov-str-mat.h ov-bool-mat.h ov-bool.h ov-file.h ov-cell.h ov.h \ - ov-fcn.h ov-builtin.h ov-dld-fcn.h ov-mapper.h ov-usr-fcn.h \ - ov-fcn-handle.h ov-typeinfo.h + ov-streamoff.h ov-str-mat.h ov-bool-mat.h ov-bool.h \ + ov-file.h ov-cell.h ov.h ov-fcn.h ov-builtin.h ov-dld-fcn.h \ + ov-mapper.h ov-usr-fcn.h ov-fcn-handle.h ov-typeinfo.h PT_INCLUDES := pt.h pt-all.h pt-arg-list.h pt-assign.h pt-binop.h \ pt-bp.h pt-cell.h pt-check.h pt-cmd.h pt-colon.h pt-const.h \ @@ -103,14 +103,14 @@ op-fil-rec.cc op-fil-str.cc op-list.cc op-m-cm.cc \ op-m-cs.cc op-m-m.cc op-m-s.cc op-range.cc op-s-cm.cc \ op-s-cs.cc op-s-m.cc op-s-s.cc op-str-m.cc \ - op-str-s.cc op-str-str.cc + op-str-s.cc op-str-str.cc op-streamoff.cc OP_SRC := $(addprefix OPERATORS/, $(OP_XSRC)) OV_SRC := ov-base.cc ov-base-mat.cc ov-base-scalar.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-struct.cc ov-va-args.cc \ + ov-range.cc ov-scalar.cc ov-complex.cc ov-str-mat.cc \ + ov-streamoff.cc ov-struct.cc ov-va-args.cc \ ov-colon.cc ov-bool-mat.cc ov-bool.cc ov-file.cc ov-cell.cc \ ov.cc ov-fcn.cc ov-builtin.cc ov-dld-fcn.cc ov-mapper.cc \ ov-usr-fcn.cc ov-fcn-handle.cc ov-typeinfo.cc diff --git a/src/c-file-ptr-stream.cc b/src/c-file-ptr-stream.cc --- a/src/c-file-ptr-stream.cc +++ b/src/c-file-ptr-stream.cc @@ -132,8 +132,8 @@ c_file_ptr_buf::seekoff (std::streamoff offset, std::ios::seekdir dir, std::ios::openmode) { - // XXX FIXME XXX -- is this the right thing to do? - + // XXX FIXME XXX +#if 0 if (f) { fseek (f, offset, seekdir_to_whence (dir)); @@ -142,13 +142,15 @@ } else return 0; +#endif + return -1; } std::streampos c_file_ptr_buf::seekpos (std::streampos offset, std::ios::openmode) { - // XXX FIXME XXX -- is this the right thing to do? - + // XXX FIXME XXX +#if 0 if (f) { fseek (f, offset, SEEK_SET); @@ -157,6 +159,8 @@ } else return 0; +#endif + return -1; } int diff --git a/src/file-io.cc b/src/file-io.cc --- a/src/file-io.cc +++ b/src/file-io.cc @@ -63,6 +63,7 @@ #include "oct-prcstrm.h" #include "oct-stream.h" #include "oct-strstrm.h" +#include "ov-streamoff.h" #include "pager.h" #include "pt-plot.h" #include "sysdep.h" @@ -632,7 +633,7 @@ from the beginning of the file @var{fid}.\n\ @end deftypefn") { - octave_value retval = -1; + octave_value retval = streamoff_array (dim_vector (1, 1), -1); int nargin = args.length (); @@ -641,7 +642,7 @@ octave_stream os = octave_stream_list::lookup (args(0), "ftell"); if (! error_state) - retval = os.tell (); + retval = streamoff_array (dim_vector (1, 1), os.tell ()); } else print_usage ("ftell"); diff --git a/src/ls-mat-ascii.cc b/src/ls-mat-ascii.cc --- a/src/ls-mat-ascii.cc +++ b/src/ls-mat-ascii.cc @@ -181,7 +181,7 @@ error ("load: file `%s' seems to be empty!", filename.c_str ()); is.clear (); - is.seekg (pos, std::ios::beg); + is.seekg (pos); } // Extract a matrix from a file of numbers only. diff --git a/src/oct-fstrm.cc b/src/oct-fstrm.cc --- a/src/oct-fstrm.cc +++ b/src/oct-fstrm.cc @@ -88,15 +88,16 @@ // Return current stream position. -long +std::streamoff octave_fstream::tell (void) const { - long retval = -1; + std::streamoff retval = -1; if (fs) { std::filebuf *fb = fs.rdbuf (); - retval = static_cast (fb->pubseekoff (0, std::ios::cur)); + + retval = std::streamoff (fb->pubseekoff (0, std::ios::cur)); } return retval; diff --git a/src/oct-fstrm.h b/src/oct-fstrm.h --- a/src/oct-fstrm.h +++ b/src/oct-fstrm.h @@ -49,7 +49,7 @@ // Return current stream position. - long tell (void) const; + std::streamoff tell (void) const; // Return non-zero if EOF has been reached on this stream. diff --git a/src/oct-iostrm.cc b/src/oct-iostrm.cc --- a/src/oct-iostrm.cc +++ b/src/oct-iostrm.cc @@ -38,7 +38,7 @@ // Return current stream position. -long +std::streamoff octave_base_iostream::tell (void) const { invalid_operation (); diff --git a/src/oct-iostrm.h b/src/oct-iostrm.h --- a/src/oct-iostrm.h +++ b/src/oct-iostrm.h @@ -44,7 +44,7 @@ // Return current stream position. - long tell (void) const; + std::streamoff tell (void) const; // Return non-zero if EOF has been reached on this stream. diff --git a/src/oct-stdstrm.cc b/src/oct-stdstrm.cc --- a/src/oct-stdstrm.cc +++ b/src/oct-stdstrm.cc @@ -53,10 +53,10 @@ // Return current stream position. -long +std::streamoff octave_stdiostream::tell (void) const { - long retval = -1; + std::streamoff retval = -1; if (! bad ()) { @@ -64,7 +64,7 @@ if (sb) { - retval = static_cast (sb->pubseekoff (0, std::ios::cur)); + retval = std::streamoff (sb->pubseekoff (0, std::ios::cur)); if (bad ()) retval = -1; diff --git a/src/oct-stdstrm.h b/src/oct-stdstrm.h --- a/src/oct-stdstrm.h +++ b/src/oct-stdstrm.h @@ -57,7 +57,7 @@ // Return current stream position. - long tell (void) const; + std::streamoff tell (void) const; // Return non-zero if EOF has been reached on this stream. diff --git a/src/oct-stream.cc b/src/oct-stream.cc --- a/src/oct-stream.cc +++ b/src/oct-stream.cc @@ -2746,10 +2746,10 @@ return retval; } -long +std::streamoff octave_stream::tell (void) const { - long retval = -1; + std::streamoff retval = -1; if (stream_ok ("tell")) retval = rep->tell (); diff --git a/src/oct-stream.h b/src/oct-stream.h --- a/src/oct-stream.h +++ b/src/oct-stream.h @@ -338,7 +338,7 @@ // Return current stream position. - virtual long tell (void) const = 0; + virtual std::streamoff tell (void) const = 0; // Return TRUE if EOF has been reached on this stream. @@ -505,7 +505,7 @@ int seek (std::streamoff offset, std::ios::seekdir origin); int seek (const octave_value& offset, const octave_value& origin); - long tell (void) const; + std::streamoff tell (void) const; int rewind (void); diff --git a/src/oct-strstrm.cc b/src/oct-strstrm.cc --- a/src/oct-strstrm.cc +++ b/src/oct-strstrm.cc @@ -51,10 +51,10 @@ // Return current stream position. -long +std::streamoff octave_base_strstream::tell (void) const { - long retval = -1; + std::streamoff retval = -1; if (! bad ()) { @@ -64,7 +64,7 @@ if (sb) { - retval = static_cast (sb->pubseekoff (0, std::ios::cur)); + retval = std::streamoff (sb->pubseekoff (0, std::ios::cur)); if (bad ()) retval = -1; diff --git a/src/oct-strstrm.h b/src/oct-strstrm.h --- a/src/oct-strstrm.h +++ b/src/oct-strstrm.h @@ -45,7 +45,7 @@ // Return current stream position. - long tell (void) const; + std::streamoff tell (void) const; // The name of the file. diff --git a/src/ov-base-mat.cc b/src/ov-base-mat.cc --- a/src/ov-base-mat.cc +++ b/src/ov-base-mat.cc @@ -134,7 +134,8 @@ idx_vector i = idx (0).index_vector (); idx_vector j = idx (1).index_vector (); - retval = MT (matrix.index (i, j, resize_ok, MT::resize_fill_value ())); + retval = MT (matrix.index (i, j, resize_ok, + MT::resize_fill_value ())); } else error ("invalid number of indices (= 2) for %d-dimensional array", @@ -220,15 +221,6 @@ template void -octave_base_matrix::print_raw (std::ostream& os, - bool pr_as_read_syntax) const -{ - octave_print_internal (os, matrix, pr_as_read_syntax, - current_print_indent_level ()); -} - -template -void octave_base_matrix::print_info (std::ostream& os, const std::string& prefix) const { diff --git a/src/ov-base-mat.h b/src/ov-base-mat.h --- a/src/ov-base-mat.h +++ b/src/ov-base-mat.h @@ -115,8 +115,6 @@ 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; - void print_info (std::ostream& os, const std::string& prefix) const; protected: diff --git a/src/ov-base.cc b/src/ov-base.cc --- a/src/ov-base.cc +++ b/src/ov-base.cc @@ -50,6 +50,7 @@ #include "ov-re-mat.h" #include "ov-scalar.h" #include "ov-str-mat.h" +#include "ov-streamoff.h" #include "ov-fcn-handle.h" #include "variables.h" @@ -465,6 +466,14 @@ return retval; } +streamoff_array +octave_base_value::streamoff_value (void) const +{ + streamoff_array retval; + gripe_wrong_type_arg ("octave_base_value::streamoff_value()", type_name ()); + return retval; +} + int octave_base_value::stream_number (void) const { diff --git a/src/ov-base.h b/src/ov-base.h --- a/src/ov-base.h +++ b/src/ov-base.h @@ -126,6 +126,8 @@ bool is_stream (void) const { return false; } + bool is_streamoff (void) const { return false; } + bool is_cs_list (void) const { return false; } bool is_list (void) const { return false; } @@ -224,6 +226,8 @@ int stream_number (void) const; + streamoff_array streamoff_value (void) const; + octave_function *function_value (bool silent); octave_fcn_handle *fcn_handle_value (bool silent); diff --git a/src/ov-bool-mat.cc b/src/ov-bool-mat.cc --- a/src/ov-bool-mat.cc +++ b/src/ov-bool-mat.cc @@ -140,6 +140,14 @@ return tmp.convert_to_str (pad, force); } +void +octave_bool_matrix::print_raw (std::ostream& os, + bool pr_as_read_syntax) const +{ + octave_print_internal (os, matrix, pr_as_read_syntax, + current_print_indent_level ()); +} + /* ;;; Local Variables: *** ;;; mode: C++ *** diff --git a/src/ov-bool-mat.h b/src/ov-bool-mat.h --- a/src/ov-bool-mat.h +++ b/src/ov-bool-mat.h @@ -115,6 +115,8 @@ octave_value convert_to_str_internal (bool pad, bool force) const; + void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; + protected: DECLARE_OCTAVE_ALLOCATOR diff --git a/src/ov-ch-mat.cc b/src/ov-ch-mat.cc --- a/src/ov-ch-mat.cc +++ b/src/ov-ch-mat.cc @@ -97,6 +97,14 @@ return retval; } +void +octave_char_matrix::print_raw (std::ostream& os, + bool pr_as_read_syntax) const +{ + octave_print_internal (os, matrix, pr_as_read_syntax, + current_print_indent_level ()); +} + /* ;;; Local Variables: *** ;;; mode: C++ *** diff --git a/src/ov-ch-mat.h b/src/ov-ch-mat.h --- a/src/ov-ch-mat.h +++ b/src/ov-ch-mat.h @@ -112,6 +112,8 @@ octave_value convert_to_str_internal (bool, bool) const { return octave_value (matrix.matrix_value (), true); } + void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; + protected: DECLARE_OCTAVE_ALLOCATOR diff --git a/src/ov-cx-mat.cc b/src/ov-cx-mat.cc --- a/src/ov-cx-mat.cc +++ b/src/ov-cx-mat.cc @@ -172,6 +172,14 @@ return matrix.matrix_value (); } +void +octave_complex_matrix::print_raw (std::ostream& os, + bool pr_as_read_syntax) const +{ + octave_print_internal (os, matrix, pr_as_read_syntax, + current_print_indent_level ()); +} + /* ;;; Local Variables: *** ;;; mode: C++ *** diff --git a/src/ov-cx-mat.h b/src/ov-cx-mat.h --- a/src/ov-cx-mat.h +++ b/src/ov-cx-mat.h @@ -108,6 +108,8 @@ void decrement (void) { matrix -= Complex (1.0); } + void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; + private: DECLARE_OCTAVE_ALLOCATOR diff --git a/src/ov-fcn.h b/src/ov-fcn.h --- a/src/ov-fcn.h +++ b/src/ov-fcn.h @@ -27,6 +27,8 @@ #pragma interface #endif +#include + #include #include "oct-time.h" @@ -45,6 +47,8 @@ { public: + octave_function (void) { abort (); } + octave_function (const octave_function& f) : octave_base_value (), my_name (f.my_name), doc (f.doc) { } @@ -94,8 +98,6 @@ private: - octave_function (void); - DECLARE_OCTAVE_ALLOCATOR }; diff --git a/src/ov-file.cc b/src/ov-file.cc --- a/src/ov-file.cc +++ b/src/ov-file.cc @@ -87,7 +87,7 @@ newline (os); indent (os); - os << "status = " << stream.is_open () ? "open" : "closed"; + os << "status = " << (stream.is_open () ? "open" : "closed"); newline (os); decrement_indent_level (); diff --git a/src/ov-mapper.cc b/src/ov-mapper.cc --- a/src/ov-mapper.cc +++ b/src/ov-mapper.cc @@ -43,42 +43,38 @@ "built-in mapper function"); static bool -any_element_less_than (const Matrix& a, double val) +any_element_less_than (const NDArray& a, double val) { - int nr = a.rows (); - int nc = a.columns (); + int len = a.length (); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) - { - OCTAVE_QUIT; + for (int i = 0; i < len; i++) + { + OCTAVE_QUIT; - if (a (i, j) < val) - return true; - } + if (a(i) < val) + return true; + } return false; } static bool -any_element_greater_than (const Matrix& a, double val) +any_element_greater_than (const NDArray& a, double val) { - int nr = a.rows (); - int nc = a.columns (); + int len = a.length (); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) - { - OCTAVE_QUIT; + for (int i = 0; i < len; i++) + { + OCTAVE_QUIT; - if (a (i, j) > val) - return true; - } + if (a(i) > val) + return true; + } return false; } -// In most cases, we could use the map member function from the Matrix +// In most cases, we could use the map member function from the NDArray // classes, but as currently implemented, they don't allow us to // detect errors and abort properly. So use these macros to do the // looping here instead. @@ -86,23 +82,20 @@ #define MAPPER_LOOP_2(T, F, M, CONV, R) \ do \ { \ - int nr = M.rows (); \ - int nc = M.cols (); \ + int len = M.length (); \ \ - T result (nr, nc); \ + T result (M.dims ()); \ \ - for (int j = 0; j < nc; j++) \ + for (int i = 0; i < len; i++) \ { \ - for (int i = 0; i < nr; i++) \ - { \ - OCTAVE_QUIT; \ + OCTAVE_QUIT; \ + \ + result(i) = CONV (F (M(i))); \ \ - result (i, j) = CONV (F (M (i, j))); \ + if (error_state) \ + return retval; \ + } \ \ - if (error_state) \ - return retval; \ - } \ - } \ retval = R; \ } \ while (0) @@ -145,7 +138,7 @@ } else { - Matrix m = arg.matrix_value (); + NDArray m = arg.array_value (); if (error_state) return retval; @@ -155,15 +148,15 @@ || any_element_greater_than (m, upper_limit))) { if (c_c_map_fcn) - MAPPER_LOOP (ComplexMatrix, c_c_map_fcn, m); + MAPPER_LOOP (ComplexNDArray, c_c_map_fcn, m); else error ("%s: unable to handle real arguments", name().c_str ()); } else if (d_d_map_fcn) - MAPPER_LOOP (Matrix, d_d_map_fcn, m); + MAPPER_LOOP (NDArray, d_d_map_fcn, m); else if (d_b_map_fcn) - MAPPER_LOOP (boolMatrix, d_b_map_fcn, m); + MAPPER_LOOP (boolNDArray, d_b_map_fcn, m); else error ("%s: unable to handle real arguments", name().c_str ()); @@ -187,17 +180,17 @@ } else { - ComplexMatrix cm = arg.complex_matrix_value (); + ComplexNDArray cm = arg.complex_array_value (); if (error_state) return retval; if (d_c_map_fcn) - MAPPER_LOOP (Matrix, d_c_map_fcn, cm); + MAPPER_LOOP (NDArray, d_c_map_fcn, cm); else if (c_c_map_fcn) - MAPPER_LOOP (ComplexMatrix, c_c_map_fcn, cm); + MAPPER_LOOP (ComplexNDArray, c_c_map_fcn, cm); else if (c_b_map_fcn) - MAPPER_LOOP (boolMatrix, c_b_map_fcn, cm); + MAPPER_LOOP (boolNDArray, c_b_map_fcn, cm); else error ("%s: unable to handle complex arguments", name().c_str ()); @@ -211,22 +204,22 @@ if (! error_state) { - charMatrix chm = tmp.char_matrix_value (); + charNDArray chm = tmp.char_array_value (); if (! error_state) { switch (ch_map_flag) { case 0: - MAPPER_LOOP_1 (boolMatrix, ch_map_fcn, chm, bool); + MAPPER_LOOP_1 (boolNDArray, ch_map_fcn, chm, bool); break; case 1: - MAPPER_LOOP (Matrix, ch_map_fcn, chm); + MAPPER_LOOP (NDArray, ch_map_fcn, chm); break; case 2: - MAPPER_LOOP_2 (charMatrix, ch_map_fcn, chm, , + MAPPER_LOOP_2 (charNDArray, ch_map_fcn, chm, , octave_value (result, true)); break; diff --git a/src/ov-re-mat.cc b/src/ov-re-mat.cc --- a/src/ov-re-mat.cc +++ b/src/ov-re-mat.cc @@ -204,6 +204,14 @@ return retval; } +void +octave_matrix::print_raw (std::ostream& os, + bool pr_as_read_syntax) const +{ + octave_print_internal (os, matrix, pr_as_read_syntax, + current_print_indent_level ()); +} + /* ;;; Local Variables: *** ;;; mode: C++ *** diff --git a/src/ov-re-mat.h b/src/ov-re-mat.h --- a/src/ov-re-mat.h +++ b/src/ov-re-mat.h @@ -109,6 +109,8 @@ octave_value convert_to_str_internal (bool pad, bool force) const; + void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; + private: DECLARE_OCTAVE_ALLOCATOR diff --git a/src/ov-str-mat.cc b/src/ov-str-mat.cc --- a/src/ov-str-mat.cc +++ b/src/ov-str-mat.cc @@ -50,7 +50,7 @@ { CAST_CONV_ARG (const octave_char_matrix_str&); - Matrix m = v.matrix_value (); + Matrix m = v.matrix_value (true); return error_state ? 0 : new octave_matrix (m); } @@ -131,15 +131,38 @@ return retval; } +double +octave_char_matrix_str::double_value (bool force_string_conv) const +{ + double retval = 0; + + if (! force_string_conv) + gripe_invalid_conversion ("string", "real scalar"); + else + { + if (Vwarn_str_to_num) + gripe_implicit_conversion ("string", "real scalar"); + + retval = octave_char_matrix::double_value (); + } + + return retval; +} + Matrix octave_char_matrix_str::matrix_value (bool force_string_conv) const { Matrix retval; - if (! force_string_conv && Vwarn_str_to_num) - gripe_implicit_conversion ("string", "real matrix"); + if (! force_string_conv) + gripe_invalid_conversion ("string", "real matrix"); + else + { + if (Vwarn_str_to_num) + gripe_implicit_conversion ("string", "real matrix"); - retval = Matrix (matrix.matrix_value ()); + retval = octave_char_matrix::matrix_value (); + } return retval; } diff --git a/src/ov-str-mat.h b/src/ov-str-mat.h --- a/src/ov-str-mat.h +++ b/src/ov-str-mat.h @@ -104,6 +104,8 @@ bool valid_as_scalar_index (void) const; + double double_value (bool = false) const; + Matrix matrix_value (bool = false) const; string_vector all_strings (bool pad = false, bool force = false) const; diff --git a/src/ov.cc b/src/ov.cc --- a/src/ov.cc +++ b/src/ov.cc @@ -47,6 +47,7 @@ #include "ov-range.h" #include "ov-struct.h" #include "ov-file.h" +#include "ov-streamoff.h" #include "ov-list.h" #include "ov-cs-list.h" #include "ov-colon.h" @@ -592,6 +593,12 @@ rep->count = 1; } +octave_value::octave_value (const streamoff_array& off) + : rep (new octave_streamoff (off)) +{ + rep->count = 1; +} + octave_value::octave_value (octave_function *f) : rep (f) { @@ -923,6 +930,12 @@ return rep->stream_number (); } +streamoff_array +octave_value::streamoff_value (void) const +{ + return rep->streamoff_value (); +} + octave_function * octave_value::function_value (bool silent) { @@ -1879,6 +1892,8 @@ octave_builtin::register_type (); octave_mapper::register_type (); octave_user_function::register_type (); + octave_fcn_handle::register_type (); + octave_streamoff::register_type (); } static int diff --git a/src/ov.h b/src/ov.h --- a/src/ov.h +++ b/src/ov.h @@ -42,8 +42,10 @@ #include "str-vec.h" class Cell; +class streamoff_array; class Octave_map; class octave_stream; +class octave_streamoff; class octave_function; class octave_fcn_handle; class octave_value_list; @@ -209,6 +211,7 @@ octave_value (const Range& r); octave_value (const Octave_map& m); octave_value (const octave_stream& s, int n); + octave_value (const streamoff_array& off); octave_value (octave_function *f); octave_value (const octave_fcn_handle& fh); octave_value (const octave_value_list& m, bool is_cs_list = false); @@ -387,6 +390,9 @@ virtual bool is_stream (void) const { return rep->is_stream (); } + virtual bool is_streamoff (void) const + { return rep->is_streamoff (); } + virtual bool is_cs_list (void) const { return rep->is_cs_list (); } @@ -542,6 +548,8 @@ virtual int stream_number (void) const; + virtual streamoff_array streamoff_value (void) const; + virtual octave_function *function_value (bool silent = false); virtual octave_fcn_handle *fcn_handle_value (bool silent = false);