diff src/ov-fcn-inline.cc @ 5409:fda074a55b5c

[project @ 2005-07-11 08:41:16 by dbateman]
author dbateman
date Mon, 11 Jul 2005 08:41:16 +0000
parents 4c8a2e4e0717
children 2618a0750ae6
line wrap: on
line diff
--- a/src/ov-fcn-inline.cc	Fri Jul 08 15:46:15 2005 +0000
+++ b/src/ov-fcn-inline.cc	Mon Jul 11 08:41:16 2005 +0000
@@ -810,13 +810,26 @@
 
   if (nargin == 1)
     {
-      octave_fcn_inline* old = args(0).fcn_inline_value (true);
+      std::string old_func;
+      octave_fcn_inline* old = 0;
+      bool func_is_string = true;
 
-      if (old)
+      if (args(0).is_string ())
+	old_func = args(0).string_value ();
+      else
 	{
-	  std::string old_func = old->fcn_text ();
+	  old = args(0).fcn_inline_value (true);
+	  func_is_string = false;
+
+	  if (old)
+	    old_func = old->fcn_text ();
+	  else
+	    error ("vectorize: must be a string or inline function");
+	}
+
+      if (! error_state)
+	{
 	  std::string new_func;
-
 	  size_t i = 0;
 
 	  while (i < old_func.length ())
@@ -840,10 +853,12 @@
 	      i++;
 	    }
 
-	  retval = octave_value (new octave_fcn_inline (new_func, old->fcn_arg_names ()));
+	  if (func_is_string)
+	    retval = octave_value (new_func);
+	  else
+	    retval = octave_value (new octave_fcn_inline 
+				   (new_func, old->fcn_arg_names ()));
 	}
-      else
-	error ("vectorize: must be an inline function");
     }
   else
     print_usage ("vectorize");