changeset 628:aecbe369233b

[project @ 1994-08-19 13:27:51 by jwe]
author jwe
date Fri, 19 Aug 1994 13:37:34 +0000
parents 739d16c30481
children 0788882808bc
files src/dassl.cc src/file-io.cc src/fsolve.cc src/gripes.cc src/gripes.h src/lsode.cc src/mappers.h src/npsol.cc src/pt-const.h src/qpsol.cc src/quad.cc src/qzval.cc src/rand.cc src/sort.cc src/svd.cc src/syl.cc src/tc-rep.h src/utils.cc src/utils.h src/variables.cc
diffstat 20 files changed, 180 insertions(+), 130 deletions(-) [+]
line wrap: on
line diff
--- a/src/dassl.cc	Fri Aug 19 13:24:32 1994 +0000
+++ b/src/dassl.cc	Fri Aug 19 13:37:34 1994 +0000
@@ -93,7 +93,7 @@
 
       if (tmp.length () > 0 && tmp(0).is_defined ())
 	{
-	  retval = tmp(0).to_vector ();
+	  retval = tmp(0).vector_value ();
 
 	  if (retval.length () == 0)
 	    gripe_user_supplied_eval ("dassl");
@@ -130,14 +130,14 @@
   if (! dassl_fcn || takes_correct_nargs (dassl_fcn, 4, "dassl", 1) != 1)
     return retval;
 
-  ColumnVector state = args(2).to_vector ();
-  ColumnVector deriv = args(3).to_vector ();
-  ColumnVector out_times = args(4).to_vector ();
+  ColumnVector state = args(2).vector_value ();
+  ColumnVector deriv = args(3).vector_value ();
+  ColumnVector out_times = args(4).vector_value ();
   ColumnVector crit_times;
   int crit_times_set = 0;
   if (nargin > 5)
     {
-      crit_times = args(5).to_vector ();
+      crit_times = args(5).vector_value ();
       crit_times_set = 1;
     }
 
--- a/src/file-io.cc	Fri Aug 19 13:24:32 1994 +0000
+++ b/src/file-io.cc	Fri Aug 19 13:37:34 1994 +0000
@@ -1111,7 +1111,7 @@
 
   int chars_from_fmt_str = 0;
   int store_value = 1;
-  int string_width = -1;
+  int string_width = 0;
   int success = 1;
 
   if (*s == '*')
@@ -1168,6 +1168,7 @@
 	  values(fmt_arg_count++) = tree_constant ((double) temp);
       }
       break;
+
     case 'e': case 'E': case 'f': case 'g': case 'G':
       {
 	chars_from_fmt_str++;
@@ -1180,12 +1181,20 @@
 	  values(fmt_arg_count++) = tree_constant (temp);
       }
       break;
+
     case 's':
       {
 	if (string_width < 1)
 	  {
+// XXX FIXME XXX -- The code below is miscompiled on the Alpha with
+// gcc 2.6.0, so that string_width is never incremented, even though
+// reading the data works correctly.  One fix is to use a fixed-size
+// buffer...
+//	    string_width = 8192;
+
 	    string_width = 0;
 	    long original_position = ftell (fptr);
+
 	    int c;
 
 	    while ((c = getc (fptr)) != EOF
@@ -1212,10 +1221,11 @@
 	char *str = fmt.str ();
 	success = fscanf (fptr, str, temp);
 	delete [] str;
-	if (success && store_value)
+	if (success > 0 && store_value)
 	  values(fmt_arg_count++) = tree_constant (temp);
       }
       break;
+
     case 'c':
       {
 	if (string_width < 1)
@@ -1232,6 +1242,7 @@
 	  values(fmt_arg_count++) = tree_constant (temp);
       }
       break;
+
     default:
       goto invalid_format;
     }
@@ -1590,7 +1601,7 @@
 	}
       else if (args(2).is_matrix_type ())
 	{
-	  ColumnVector tmp = args(2).to_vector ();
+	  ColumnVector tmp = args(2).vector_value ();
 
 	  if (tmp.length () == 2)
 	    {
@@ -1730,7 +1741,7 @@
 
   file_info file = file_list (p);
 
-  Matrix m = args(2).to_matrix ();
+  Matrix m = args(2).matrix_value ();
 
   int count = m.write (file.fptr (), prec);
 
--- a/src/fsolve.cc	Fri Aug 19 13:24:32 1994 +0000
+++ b/src/fsolve.cc	Fri Aug 19 13:37:34 1994 +0000
@@ -103,7 +103,7 @@
       Octave_object tmp = fsolve_fcn->eval (0, 1, args);
       if (tmp.length () > 0 && tmp(0).is_defined ())
 	{
-	  retval = tmp(0).to_vector ();
+	  retval = tmp(0).vector_value ();
 
 	  if (retval.length () <= 0)
 	    gripe_user_supplied_eval ("fsolve");
@@ -141,7 +141,7 @@
   if (! fsolve_fcn || takes_correct_nargs (fsolve_fcn, 2, "fsolve", 1) != 1)
     return retval;
 
-  ColumnVector x = args(2).to_vector ();
+  ColumnVector x = args(2).vector_value ();
 
   if (nargin > 3)
     warning ("fsolve: ignoring extra arguments");
--- a/src/gripes.cc	Fri Aug 19 13:24:32 1994 +0000
+++ b/src/gripes.cc	Fri Aug 19 13:37:34 1994 +0000
@@ -80,6 +80,12 @@
   error ("%s: user-supplied function returned invalid value", name);
 }
 
+void
+gripe_invalid_conversion (const char *from, const char *to)
+{
+  error ("invalid conversion from %s to %s", from, to);
+}
+
 /*
 ;;; Local Variables: ***
 ;;; mode: C++ ***
--- a/src/gripes.h	Fri Aug 19 13:24:32 1994 +0000
+++ b/src/gripes.h	Fri Aug 19 13:37:34 1994 +0000
@@ -34,6 +34,7 @@
 extern void gripe_square_matrix_required (const char *name);
 extern void gripe_user_supplied_eval (const char *name);
 extern void gripe_user_returned_invalid (const char *name);
+extern void gripe_invalid_conversion (const char *from, const char *to);
 
 #endif
 
--- a/src/lsode.cc	Fri Aug 19 13:24:32 1994 +0000
+++ b/src/lsode.cc	Fri Aug 19 13:37:34 1994 +0000
@@ -82,7 +82,7 @@
 
       if (tmp.length () > 0 && tmp(0).is_defined ())
 	{
-	  retval = tmp(0).to_vector ();
+	  retval = tmp(0).vector_value ();
 
 	  if (retval.length () == 0)
 	    gripe_user_supplied_eval ("lsode");
@@ -118,13 +118,13 @@
   if (! lsode_fcn || takes_correct_nargs (lsode_fcn, 3, "lsode", 1) != 1)
     return retval;
 
-  ColumnVector state = args(2).to_vector ();
-  ColumnVector out_times = args(3).to_vector ();
+  ColumnVector state = args(2).vector_value ();
+  ColumnVector out_times = args(3).vector_value ();
   ColumnVector crit_times;
   int crit_times_set = 0;
   if (nargin > 4)
     {
-      crit_times = args(4).to_vector ();
+      crit_times = args(4).vector_value ();
       crit_times_set = 1;
     }
 
--- a/src/mappers.h	Fri Aug 19 13:24:32 1994 +0000
+++ b/src/mappers.h	Fri Aug 19 13:37:34 1994 +0000
@@ -40,6 +40,7 @@
 
 struct Mapper_fcn
 {
+  char *name;
   int can_return_complex_for_real_arg;
   double lower_limit;
   double upper_limit;
--- a/src/npsol.cc	Fri Aug 19 13:24:32 1994 +0000
+++ b/src/npsol.cc	Fri Aug 19 13:37:34 1994 +0000
@@ -157,7 +157,7 @@
 
       if (tmp.length () > 0 && tmp(0).is_defined ())
 	{
-	  retval = tmp(0).to_vector ();
+	  retval = tmp(0).vector_value ();
 
 	  if (retval.length () <= 0)
 	    error ("npsol: error evaluating constraints");
@@ -294,7 +294,7 @@
       return retval;
     }
 
-  ColumnVector x = args(1).to_vector ();
+  ColumnVector x = args(1).vector_value ();
 
   if (x.capacity () == 0)
     {
@@ -314,8 +314,8 @@
   Bounds bounds;
   if (nargin == 5 || nargin == 8 || nargin == 11)
     {
-      ColumnVector lb = args(3).to_vector ();
-      ColumnVector ub = args(4).to_vector ();
+      ColumnVector lb = args(3).vector_value ();
+      ColumnVector ub = args(4).vector_value ();
 
       int lb_len = lb.capacity ();
       int ub_len = ub.capacity ();
@@ -365,9 +365,9 @@
     {
       if (! npsol_constraints)
 	{
-	  ColumnVector lub = args(nargin-1).to_vector ();
-	  Matrix c = args(nargin-2).to_matrix ();
-	  ColumnVector llb = args(nargin-3).to_vector ();
+	  ColumnVector lub = args(nargin-1).vector_value ();
+	  Matrix c = args(nargin-2).matrix_value ();
+	  ColumnVector llb = args(nargin-3).vector_value ();
 
 	  if (llb.capacity () == 0 || lub.capacity () == 0)
 	    {
@@ -402,8 +402,8 @@
 	{
 	  if (takes_correct_nargs (npsol_constraints, 2, "npsol", 1))
 	    {
-	      ColumnVector nlub = args(nargin-1).to_vector ();
-	      ColumnVector nllb = args(nargin-3).to_vector ();
+	      ColumnVector nlub = args(nargin-1).vector_value ();
+	      ColumnVector nllb = args(nargin-3).vector_value ();
 
 	      NLFunc const_func (npsol_constraint_function);
 
@@ -445,8 +445,8 @@
 	{
 	  if (takes_correct_nargs (npsol_constraints, 2, "npsol", 1))
 	    {
-	      ColumnVector nlub = args(nargin-1).to_vector ();
-	      ColumnVector nllb = args(nargin-3).to_vector ();
+	      ColumnVector nlub = args(nargin-1).vector_value ();
+	      ColumnVector nllb = args(nargin-3).vector_value ();
 
 	      NLFunc const_func (npsol_constraint_function);
 
@@ -456,9 +456,9 @@
 
 	      NLConst nonlinear_constraints (nllb, const_func, nlub);
 
-	      ColumnVector lub = args(nargin-4).to_vector ();
-	      Matrix c = args(nargin-5).to_matrix ();
-	      ColumnVector llb = args(nargin-6).to_vector ();
+	      ColumnVector lub = args(nargin-4).vector_value ();
+	      Matrix c = args(nargin-5).matrix_value ();
+	      ColumnVector llb = args(nargin-6).vector_value ();
 
 	      if (llb.capacity () == 0 || lub.capacity () == 0)
 		{
--- a/src/pt-const.h	Fri Aug 19 13:24:32 1994 +0000
+++ b/src/pt-const.h	Fri Aug 19 13:37:34 1994 +0000
@@ -210,11 +210,13 @@
   int is_matrix_type (void) const { return rep->is_matrix_type (); }
 
   int is_real_type (void) const { return rep->is_real_type (); }
+
   int is_complex_type (void) const { return rep->is_complex_type (); }
 
 // These need better names, since a range really is a numeric type.
 
-  int is_numeric_type (void) const { return rep->is_numeric_type (); }
+  int is_numeric_type (void) const
+    { return rep->is_numeric_type (); }
 
   int is_numeric_or_range_type (void) const
     { return rep->is_numeric_or_range_type (); }
@@ -246,19 +248,38 @@
 
 // Values.
 
-  double double_value (void) const { return rep->double_value (); }
-  Matrix matrix_value (void) const { return rep->matrix_value (); }
-  Complex complex_value (void) const { return rep->complex_value (); }
-  ComplexMatrix complex_matrix_value (void) const
-    { return rep->complex_matrix_value (); }
-  char *string_value (void) const { return rep->string_value (); }
-  Range range_value (void) const { return rep->range_value (); }
+  double double_value (int force_string_conversion = 0) const
+    { return rep->double_value (force_string_conversion); }
+
+  Matrix matrix_value (int force_string_conversion = 0) const
+    { return rep->matrix_value (force_string_conversion); }
+
+  Complex complex_value (int force_string_conversion = 0) const
+    { return rep->complex_value (force_string_conversion); }
+
+  ComplexMatrix complex_matrix_value (int force_string_conversion = 0) const
+    { return rep->complex_matrix_value (force_string_conversion); }
+
+  char *string_value (void) const
+    { return rep->string_value (); }
+
+  Range range_value (void) const
+    { return rep->range_value (); }
+
+  ColumnVector vector_value (int force_string_conversion = 0,
+			     int force_vector_conversion = 0) const 
+    { return rep->vector_value (); }
+
+  ComplexColumnVector complex_vector_value (int force_string_conv = 0,
+					    int force_vec_conv = 0) const
+    { return rep->complex_vector_value (); }
 
 // Conversions.  These should probably be private.  If a user of this
 // class wants a certain kind of constant, he should simply ask for
 // it, and we should convert it if possible.
 
-  tree_constant convert_to_str (void) { return rep->convert_to_str (); }
+  tree_constant convert_to_str (void)
+    { return rep->convert_to_str (); }
 
   void convert_to_row_or_column_vector (void)
     { rep->convert_to_row_or_column_vector (); }
@@ -354,6 +375,9 @@
 
   friend void gripe_wrong_type_arg (const char *name, const tree_constant& tc);
 
+  char *type_as_string (void) const
+    { return rep->type_as_string (); }
+
 // -------------------------------------------------------------------
 
 // These may not need to be member functions.
@@ -377,18 +401,7 @@
   tree_constant_rep::constant_type const_type (void) const
     { return rep->const_type (); }
 
-// More conversions.  These should probably be eliminated.  If a user
-// of this class wants a certain kind of constant, he should simply
-// ask for it, and we should convert it if possible.
-
-  double to_scalar (void) const { return rep->to_scalar (); }
-  ColumnVector to_vector (void) const { return rep->to_vector (); }
-  Matrix to_matrix (void) const { return rep->to_matrix (); }
-
 // -------------------------------------------------------------------
-
-private:
-  char *type_as_string (void) const;
 };
 
 // XXX FIXME XXX -- this is not used very much now.  Perhaps it can be
--- a/src/qpsol.cc	Fri Aug 19 13:24:32 1994 +0000
+++ b/src/qpsol.cc	Fri Aug 19 13:37:34 1994 +0000
@@ -96,21 +96,21 @@
       return retval;
     }
 
-  ColumnVector x = args(1).to_vector ();
+  ColumnVector x = args(1).vector_value ();
   if (x.capacity () == 0)
     {
       error ("qpsol: expecting vector as first argument");
       return retval;
     }
 
-  Matrix H = args(2).to_matrix ();
+  Matrix H = args(2).matrix_value ();
   if (H.rows () != H.columns () || H.rows () != x.capacity ())
     {
       error ("qpsol: H must be a square matrix consistent with the size of x");
       return retval;
     }
 
-  ColumnVector c = args(3).to_vector ();
+  ColumnVector c = args(3).vector_value ();
   if (c.capacity () != x.capacity ())
     {
       error ("qpsol: c must be a vector the same size as x");
@@ -120,8 +120,8 @@
   Bounds bounds;
   if (nargin == 6 || nargin == 9)
     {
-      ColumnVector lb = args(4).to_vector ();
-      ColumnVector ub = args(5).to_vector ();
+      ColumnVector lb = args(4).vector_value ();
+      ColumnVector ub = args(5).vector_value ();
 
       int lb_len = lb.capacity ();
       int ub_len = ub.capacity ();
@@ -166,9 +166,9 @@
 
   if (nargin == 7 || nargin == 9)
     {
-      ColumnVector lub = args(nargin-1).to_vector ();
-      Matrix A = args(nargin-2).to_matrix ();
-      ColumnVector llb = args(nargin-3).to_vector ();
+      ColumnVector lub = args(nargin-1).vector_value ();
+      Matrix A = args(nargin-2).matrix_value ();
+      ColumnVector llb = args(nargin-3).vector_value ();
 
       if (llb.capacity () == 0 || lub.capacity () == 0)
 	{
--- a/src/quad.cc	Fri Aug 19 13:24:32 1994 +0000
+++ b/src/quad.cc	Fri Aug 19 13:37:34 1994 +0000
@@ -66,7 +66,7 @@
 	}
 
       if (tmp.length () && tmp(0).is_defined ())
-	retval = tmp(0).to_scalar ();
+	retval = tmp(0).double_value ();
       else
 	{
 	  quad_integration_error = 1;  // XXX FIXME XXX
@@ -106,8 +106,8 @@
   if (! quad_fcn || takes_correct_nargs (quad_fcn, 2, "fsolve", 1) != 1)
     return retval;
 
-  double a = args(2).to_scalar ();
-  double b = args(3).to_scalar ();
+  double a = args(2).double_value ();
+  double b = args(3).double_value ();
 
   int indefinite = 0;
   IndefQuad::IntegralType indef_type = IndefQuad::doubly_infinite;
@@ -148,9 +148,9 @@
 	  return retval;
 	}
       have_sing = 1;
-      sing = args(5).to_vector ();
+      sing = args(5).vector_value ();
     case 5:
-      tol = args(4).to_vector ();
+      tol = args(4).vector_value ();
       switch (tol.capacity ())
 	{
 	case 2:
--- a/src/qzval.cc	Fri Aug 19 13:24:32 1994 +0000
+++ b/src/qzval.cc	Fri Aug 19 13:37:34 1994 +0000
@@ -118,8 +118,8 @@
 // XXX FIXME ??? XXX
 	  double eps = DBL_EPSILON;
 
-	  Matrix ca = arga.to_matrix ();
-	  Matrix cb = argb.to_matrix ();
+	  Matrix ca = arga.matrix_value ();
+	  Matrix cb = argb.matrix_value ();
 
 // Use EISPACK qz functions.
 
--- a/src/rand.cc	Fri Aug 19 13:24:32 1994 +0000
+++ b/src/rand.cc	Fri Aug 19 13:37:34 1994 +0000
@@ -205,13 +205,13 @@
       if (args(1).is_string ()
 	  && strcmp (args(1).string_value (), "seed") == 0)
 	{
-	  double d = args(2).to_scalar ();
+	  double d = args(2).double_value ();
 	  set_rand_seed (d);
 	}
       else
 	{
-	  n = NINT (args(1).to_scalar ());
-	  m = NINT (args(2).to_scalar ());
+	  n = NINT (args(1).double_value ());
+	  m = NINT (args(2).double_value ());
 	  goto gen_matrix;
 	}
     }
--- a/src/sort.cc	Fri Aug 19 13:24:32 1994 +0000
+++ b/src/sort.cc	Fri Aug 19 13:37:34 1994 +0000
@@ -200,7 +200,7 @@
     }
   else if (tmp.is_real_matrix () || tmp.is_string () || tmp.is_range ())
     {
-      Matrix m = tmp.to_matrix ();
+      Matrix m = tmp.matrix_value ();
       if (m.rows () == 1)
 	{
 	  int nc = m.columns ();
--- a/src/svd.cc	Fri Aug 19 13:24:32 1994 +0000
+++ b/src/svd.cc	Fri Aug 19 13:37:34 1994 +0000
@@ -32,6 +32,7 @@
 #include "user-prefs.h"
 #include "gripes.h"
 #include "error.h"
+#include "utils.h"
 #include "help.h"
 #include "defun-dld.h"
 
@@ -42,7 +43,7 @@
 argument, an `economy' sized factorization is computed that omits\n\
 unnecessary rows and columns of U and V")
 {
-  Octave_object retval;
+  Octave_object retval (3, Matrix ());
 
   int nargin = args.length ();
 
@@ -52,35 +53,15 @@
       return retval;
     }
 
-  tree_constant arg = args(1).make_numeric ();
-
-  if (error_state)
-    return retval;
+  SVD::type type = (nargin == 3) ? SVD::economy : SVD::std;
 
-  if (arg.rows () == 0 || arg.columns () == 0)
-    {
-      int flag = user_pref.propagate_empty_matrices;
-      if (flag != 0)
-	{
-	  if (flag < 0)
-	    gripe_empty_arg ("svd", 0);
-
-	  Matrix m;
-	  retval.resize (3, m);
-	}
-      else
-	gripe_empty_arg ("svd", 1);
-
-      return retval;
-    }
-
-  SVD::type type = (nargin == 3) ? SVD::economy : SVD::std;
+  tree_constant arg = args(1);
 
   if (arg.is_real_type ())
     {
       Matrix tmp = arg.matrix_value ();
 
-      if (error_state)
+      if (error_state || empty_arg ("svd", tmp.rows (), tmp.columns ()))
 	return retval;
 
       SVD result (tmp, type);
@@ -102,7 +83,7 @@
     {
       ComplexMatrix ctmp = arg.complex_matrix_value ();
 
-      if (error_state)
+      if (error_state || empty_arg ("svd", ctmp.rows (), ctmp.columns ()))
 	return retval;
 
       ComplexSVD result (ctmp, type);
--- a/src/syl.cc	Fri Aug 19 13:24:32 1994 +0000
+++ b/src/syl.cc	Fri Aug 19 13:37:34 1994 +0000
@@ -146,9 +146,9 @@
 
 // Do everything in real arithmetic;
 
-	Matrix ca = arga.to_matrix ();
-	Matrix cb = argb.to_matrix ();
-	Matrix cc = argc.to_matrix ();
+	Matrix ca = arga.matrix_value ();
+	Matrix cb = argb.matrix_value ();
+	Matrix cc = argc.matrix_value ();
   
 // Compute Schur decompositions.
 
--- a/src/tc-rep.h	Fri Aug 19 13:24:32 1994 +0000
+++ b/src/tc-rep.h	Fri Aug 19 13:37:34 1994 +0000
@@ -119,46 +119,65 @@
   tree_constant any (void) const;
 
   int is_scalar_type (void) const
-    { return type_tag == scalar_constant
-             || type_tag == complex_scalar_constant; }
+    {
+      return (type_tag == scalar_constant
+	      || type_tag == complex_scalar_constant);
+    }
 
   int is_matrix_type (void) const
-    { return type_tag == matrix_constant
-             || type_tag == complex_matrix_constant; }
+    {
+      return (type_tag == matrix_constant
+	      || type_tag == complex_matrix_constant);
+    }
 
   int is_real_type (void) const
-    { return type_tag == scalar_constant
-             || type_tag == matrix_constant
-	     || type_tag == range_constant; }
+    {
+      return (type_tag == scalar_constant
+	      || type_tag == matrix_constant
+	      || type_tag == range_constant
+	      || type_tag == string_constant);
+    }
 
   int is_complex_type (void) const
-    { return type_tag == complex_matrix_constant
-             || type_tag == complex_scalar_constant; }
+    {
+      return (type_tag == complex_matrix_constant
+	      || type_tag == complex_scalar_constant);
+    }
 
   int is_numeric_type (void) const
-    { return type_tag == scalar_constant
-             || type_tag == matrix_constant
-	     || type_tag == complex_matrix_constant
-             || type_tag == complex_scalar_constant; }
+    {
+      return (type_tag == scalar_constant
+	      || type_tag == matrix_constant
+	      || type_tag == complex_matrix_constant
+	      || type_tag == complex_scalar_constant);
+    }
 
   int is_numeric_or_range_type (void) const
-    { return type_tag == scalar_constant
-             || type_tag == matrix_constant
-	     || type_tag == complex_matrix_constant
-             || type_tag == complex_scalar_constant
-	     || type_tag == range_constant; }
+    {
+      return (type_tag == scalar_constant
+	      || type_tag == matrix_constant
+	      || type_tag == complex_matrix_constant
+	      || type_tag == complex_scalar_constant
+	      || type_tag == range_constant);
+    }
 
   int valid_as_scalar_index (void) const;
 
   int is_true (void) const;
 
-  double double_value (void) const;
-  Matrix matrix_value (void) const;
-  Complex complex_value (void) const;
-  ComplexMatrix complex_matrix_value (void) const;
+  double double_value (int force_string_conversion = 0) const;
+  Matrix matrix_value (int force_string_conversion = 0) const;
+  Complex complex_value (int force_string_conversion = 0) const;
+  ComplexMatrix complex_matrix_value (int force_string_conversion = 0) const;
   char *string_value (void) const;
   Range range_value (void) const;
 
+  ColumnVector vector_value (int force_string_conversion = 0,
+			     int force_vector_conversion = 0) const;
+
+  ComplexColumnVector complex_vector_value (int force_string_conv = 0,
+					    int force_vec_conv = 0) const;
+
   tree_constant convert_to_str (void);
 
   void convert_to_row_or_column_vector (void);
@@ -238,10 +257,6 @@
   void do_matrix_assignment (const tree_constant& rhs,
 			     const tree_constant& i_arg);
 
-  void do_matrix_assignment (const tree_constant& rhs,
-			     const tree_constant& i_arg,
-			     const tree_constant& j_arg);
-
   void fortran_style_matrix_assignment (const tree_constant& rhs,
 					const tree_constant& i_arg);
 
@@ -261,6 +276,10 @@
   void do_vector_assign (const tree_constant& rhs, idx_vector& i);
   void do_vector_assign (const tree_constant& rhs, Range& i);
 
+  void do_matrix_assignment (const tree_constant& rhs,
+			     const tree_constant& i_arg,
+			     const tree_constant& j_arg);
+
   void do_matrix_assignment (const tree_constant& rhs, int i,
 			     const tree_constant& j_arg);
   void do_matrix_assignment (const tree_constant& rhs, idx_vector& i,
@@ -315,6 +334,8 @@
 
   void print_code (ostream& os);
 
+  char *type_as_string (void) const;
+
 // Binary and unary operations.
 
   friend tree_constant do_binary_op (tree_constant& a, tree_constant& b,
@@ -358,14 +379,6 @@
 // We want to eliminate this.
 
   constant_type const_type (void) const { return type_tag; }
-
-// More conversions.  These should probably be eliminated.  If a user
-// of this class wants a certain kind of constant, he should simply
-// ask for it, and we should convert it if possible.
-
-  double to_scalar (void) const;
-  ColumnVector to_vector (void) const;
-  Matrix to_matrix (void) const;
 };
 
 #endif
--- a/src/utils.cc	Fri Aug 19 13:24:32 1994 +0000
+++ b/src/utils.cc	Fri Aug 19 13:37:34 1994 +0000
@@ -102,6 +102,7 @@
 #include "variables.h"
 #include "dirfns.h"
 #include "error.h"
+#include "gripes.h"
 #include "pager.h"
 #include "utils.h"
 #include "input.h"
@@ -506,6 +507,26 @@
   return argv;
 }
 
+int
+empty_arg (const char *name, int nr, int nc)
+{
+  int is_empty = 0;
+
+  if (nr == 0 || nc == 0)
+    {
+      is_empty = 0;
+
+      int flag = user_pref.propagate_empty_matrices;
+
+      if (flag < 0)
+	gripe_empty_arg (name, 0);
+      else if (flag > 0)
+	gripe_empty_arg (name, 1);
+    }
+
+  return is_empty;
+}
+
 // Format a list in neat columns.  Mostly stolen from GNU ls.  This
 // should maybe be in utils.cc.
 
--- a/src/utils.h	Fri Aug 19 13:24:32 1994 +0000
+++ b/src/utils.h	Fri Aug 19 13:37:34 1994 +0000
@@ -68,6 +68,8 @@
 
 extern char **make_argv (const Octave_object& args, const char *fcn_name);
 
+extern int empty_arg (const char *name, int nr, int nc);
+
 extern ostrstream& list_in_columns (ostrstream& os, char **list);
 
 #endif
--- a/src/variables.cc	Fri Aug 19 13:24:32 1994 +0000
+++ b/src/variables.cc	Fri Aug 19 13:37:34 1994 +0000
@@ -1128,6 +1128,7 @@
   sym_rec->unprotect ();
 
   Mapper_fcn mfcn;
+  mfcn.name = strsave (mf->name);
   mfcn.can_return_complex_for_real_arg = mf->can_return_complex_for_real_arg;
   mfcn.lower_limit = mf->lower_limit;
   mfcn.upper_limit = mf->upper_limit;