changeset 4643:ef3a14fb6847

[project @ 2003-11-22 12:25:44 by jwe]
author jwe
date Sat, 22 Nov 2003 12:25:45 +0000
parents 7a83d52d2aed
children 3b74f1a86750
files src/ChangeLog src/Makefile.in src/c-file-ptr-stream.cc src/file-io.cc src/ls-mat-ascii.cc src/oct-fstrm.cc src/oct-fstrm.h src/oct-iostrm.cc src/oct-iostrm.h src/oct-stdstrm.cc src/oct-stdstrm.h src/oct-stream.cc src/oct-stream.h src/oct-strstrm.cc src/oct-strstrm.h src/ov-base-mat.cc src/ov-base-mat.h src/ov-base.cc src/ov-base.h src/ov-bool-mat.cc src/ov-bool-mat.h src/ov-ch-mat.cc src/ov-ch-mat.h src/ov-cx-mat.cc src/ov-cx-mat.h src/ov-fcn.h src/ov-file.cc src/ov-mapper.cc src/ov-re-mat.cc src/ov-re-mat.h src/ov-str-mat.cc src/ov-str-mat.h src/ov.cc src/ov.h
diffstat 34 files changed, 245 insertions(+), 95 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Sat Nov 22 12:20:33 2003 +0000
+++ b/src/ChangeLog	Sat Nov 22 12:25:45 2003 +0000
@@ -1,3 +1,61 @@
+2003-11-22  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* 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  <jwe@bevo.che.wisc.edu>
+
+	* 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  <jwe@bevo.che.wisc.edu>
+
+	* 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  <jwe@bevo.che.wisc.edu>
 
 	* ls-mat5.cc (read_mat5_binary_element, save_mat5_binary_element):
--- a/src/Makefile.in	Sat Nov 22 12:20:33 2003 +0000
+++ b/src/Makefile.in	Sat Nov 22 12:25:45 2003 +0000
@@ -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
--- a/src/c-file-ptr-stream.cc	Sat Nov 22 12:20:33 2003 +0000
+++ b/src/c-file-ptr-stream.cc	Sat Nov 22 12:25:45 2003 +0000
@@ -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
--- a/src/file-io.cc	Sat Nov 22 12:20:33 2003 +0000
+++ b/src/file-io.cc	Sat Nov 22 12:25:45 2003 +0000
@@ -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");
--- a/src/ls-mat-ascii.cc	Sat Nov 22 12:20:33 2003 +0000
+++ b/src/ls-mat-ascii.cc	Sat Nov 22 12:25:45 2003 +0000
@@ -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.
--- a/src/oct-fstrm.cc	Sat Nov 22 12:20:33 2003 +0000
+++ b/src/oct-fstrm.cc	Sat Nov 22 12:25:45 2003 +0000
@@ -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<long> (fb->pubseekoff (0, std::ios::cur));
+
+      retval = std::streamoff (fb->pubseekoff (0, std::ios::cur));
     }
 
   return retval;
--- a/src/oct-fstrm.h	Sat Nov 22 12:20:33 2003 +0000
+++ b/src/oct-fstrm.h	Sat Nov 22 12:25:45 2003 +0000
@@ -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.
 
--- a/src/oct-iostrm.cc	Sat Nov 22 12:20:33 2003 +0000
+++ b/src/oct-iostrm.cc	Sat Nov 22 12:25:45 2003 +0000
@@ -38,7 +38,7 @@
 
 // Return current stream position.
 
-long
+std::streamoff
 octave_base_iostream::tell (void) const
 {
   invalid_operation ();
--- a/src/oct-iostrm.h	Sat Nov 22 12:20:33 2003 +0000
+++ b/src/oct-iostrm.h	Sat Nov 22 12:25:45 2003 +0000
@@ -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.
 
--- a/src/oct-stdstrm.cc	Sat Nov 22 12:20:33 2003 +0000
+++ b/src/oct-stdstrm.cc	Sat Nov 22 12:25:45 2003 +0000
@@ -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<long> (sb->pubseekoff (0, std::ios::cur));
+	  retval = std::streamoff (sb->pubseekoff (0, std::ios::cur));
 
 	  if (bad ())
 	    retval = -1;
--- a/src/oct-stdstrm.h	Sat Nov 22 12:20:33 2003 +0000
+++ b/src/oct-stdstrm.h	Sat Nov 22 12:25:45 2003 +0000
@@ -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.
 
--- a/src/oct-stream.cc	Sat Nov 22 12:20:33 2003 +0000
+++ b/src/oct-stream.cc	Sat Nov 22 12:25:45 2003 +0000
@@ -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 ();
--- a/src/oct-stream.h	Sat Nov 22 12:20:33 2003 +0000
+++ b/src/oct-stream.h	Sat Nov 22 12:25:45 2003 +0000
@@ -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);
 
--- a/src/oct-strstrm.cc	Sat Nov 22 12:20:33 2003 +0000
+++ b/src/oct-strstrm.cc	Sat Nov 22 12:25:45 2003 +0000
@@ -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<long> (sb->pubseekoff (0, std::ios::cur));
+	  retval = std::streamoff (sb->pubseekoff (0, std::ios::cur));
 
 	  if (bad ())
 	    retval = -1;
--- a/src/oct-strstrm.h	Sat Nov 22 12:20:33 2003 +0000
+++ b/src/oct-strstrm.h	Sat Nov 22 12:25:45 2003 +0000
@@ -45,7 +45,7 @@
 
   // Return current stream position.
 
-  long tell (void) const;
+  std::streamoff tell (void) const;
 
   // The name of the file.
 
--- a/src/ov-base-mat.cc	Sat Nov 22 12:20:33 2003 +0000
+++ b/src/ov-base-mat.cc	Sat Nov 22 12:25:45 2003 +0000
@@ -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 <class MT>
 void
-octave_base_matrix<MT>::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 <class MT>
-void
 octave_base_matrix<MT>::print_info (std::ostream& os,
 				    const std::string& prefix) const
 {
--- a/src/ov-base-mat.h	Sat Nov 22 12:20:33 2003 +0000
+++ b/src/ov-base-mat.h	Sat Nov 22 12:25:45 2003 +0000
@@ -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:
--- a/src/ov-base.cc	Sat Nov 22 12:20:33 2003 +0000
+++ b/src/ov-base.cc	Sat Nov 22 12:25:45 2003 +0000
@@ -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
 {
--- a/src/ov-base.h	Sat Nov 22 12:20:33 2003 +0000
+++ b/src/ov-base.h	Sat Nov 22 12:25:45 2003 +0000
@@ -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);
--- a/src/ov-bool-mat.cc	Sat Nov 22 12:20:33 2003 +0000
+++ b/src/ov-bool-mat.cc	Sat Nov 22 12:25:45 2003 +0000
@@ -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++ ***
--- a/src/ov-bool-mat.h	Sat Nov 22 12:20:33 2003 +0000
+++ b/src/ov-bool-mat.h	Sat Nov 22 12:25:45 2003 +0000
@@ -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
--- a/src/ov-ch-mat.cc	Sat Nov 22 12:20:33 2003 +0000
+++ b/src/ov-ch-mat.cc	Sat Nov 22 12:25:45 2003 +0000
@@ -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++ ***
--- a/src/ov-ch-mat.h	Sat Nov 22 12:20:33 2003 +0000
+++ b/src/ov-ch-mat.h	Sat Nov 22 12:25:45 2003 +0000
@@ -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
--- a/src/ov-cx-mat.cc	Sat Nov 22 12:20:33 2003 +0000
+++ b/src/ov-cx-mat.cc	Sat Nov 22 12:25:45 2003 +0000
@@ -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++ ***
--- a/src/ov-cx-mat.h	Sat Nov 22 12:20:33 2003 +0000
+++ b/src/ov-cx-mat.h	Sat Nov 22 12:25:45 2003 +0000
@@ -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
--- a/src/ov-fcn.h	Sat Nov 22 12:20:33 2003 +0000
+++ b/src/ov-fcn.h	Sat Nov 22 12:25:45 2003 +0000
@@ -27,6 +27,8 @@
 #pragma interface
 #endif
 
+#include <cstdlib>
+
 #include <string>
 
 #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
 };
 
--- a/src/ov-file.cc	Sat Nov 22 12:20:33 2003 +0000
+++ b/src/ov-file.cc	Sat Nov 22 12:25:45 2003 +0000
@@ -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 ();
--- a/src/ov-mapper.cc	Sat Nov 22 12:20:33 2003 +0000
+++ b/src/ov-mapper.cc	Sat Nov 22 12:25:45 2003 +0000
@@ -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;
 
--- a/src/ov-re-mat.cc	Sat Nov 22 12:20:33 2003 +0000
+++ b/src/ov-re-mat.cc	Sat Nov 22 12:25:45 2003 +0000
@@ -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++ ***
--- a/src/ov-re-mat.h	Sat Nov 22 12:20:33 2003 +0000
+++ b/src/ov-re-mat.h	Sat Nov 22 12:25:45 2003 +0000
@@ -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
--- a/src/ov-str-mat.cc	Sat Nov 22 12:20:33 2003 +0000
+++ b/src/ov-str-mat.cc	Sat Nov 22 12:25:45 2003 +0000
@@ -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;
 }
--- a/src/ov-str-mat.h	Sat Nov 22 12:20:33 2003 +0000
+++ b/src/ov-str-mat.h	Sat Nov 22 12:25:45 2003 +0000
@@ -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;
--- a/src/ov.cc	Sat Nov 22 12:20:33 2003 +0000
+++ b/src/ov.cc	Sat Nov 22 12:25:45 2003 +0000
@@ -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
--- a/src/ov.h	Sat Nov 22 12:20:33 2003 +0000
+++ b/src/ov.h	Sat Nov 22 12:25:45 2003 +0000
@@ -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);