changeset 4699:5e2c68946f30

[project @ 2004-01-20 23:04:46 by jwe]
author jwe
date Tue, 20 Jan 2004 23:04:47 +0000
parents 737fd5c0ae06
children ca3a1d687bba
files doc/interpreter/errors.txi doc/interpreter/stmt.txi emacs/octave-mod.el src/ChangeLog src/defun-int.h src/defun.h src/error.cc src/error.h src/ov-cell.cc src/ov-re-mat.cc src/ov-re-mat.h src/parse.y src/pt-except.cc src/variables.h test/octave.test/arith/acot-1.m test/octave.test/eval-catch/eval-catch-10.m test/octave.test/eval-catch/eval-catch-5.m test/octave.test/eval-catch/eval-catch-6.m test/octave.test/eval-catch/eval-catch-7.m test/octave.test/eval-catch/eval-catch-8.m test/octave.test/eval-catch/eval-catch-9.m test/octave.test/eval-catch/eval-catch.exp test/octave.test/system/glob-1.m test/octave.test/system/readdir-1.m test/octave.test/try/try-10.m test/octave.test/try/try-5.m test/octave.test/try/try-6.m test/octave.test/try/try-7.m test/octave.test/try/try-8.m test/octave.test/try/try-9.m test/octave.test/try/try.exp
diffstat 31 files changed, 108 insertions(+), 143 deletions(-) [+]
line wrap: on
line diff
--- a/doc/interpreter/errors.txi	Mon Jan 19 19:25:27 2004 +0000
+++ b/doc/interpreter/errors.txi	Tue Jan 20 23:04:47 2004 +0000
@@ -12,8 +12,6 @@
 
 @DOCSTRING(error)
 
-@DOCSTRING(error_text)
-
 @DOCSTRING(beep_on_error)
 
 @DOCSTRING(warning)
--- a/doc/interpreter/stmt.txi	Mon Jan 19 19:25:27 2004 +0000
+++ b/doc/interpreter/stmt.txi	Tue Jan 20 23:04:47 2004 +0000
@@ -714,13 +714,12 @@
 
 No warnings or error messages are printed while @var{body} is
 executing.  If an error does occur during the execution of @var{body},
-@var{cleanup} can access the text of the message that would have been
-printed in the builtin constant @code{__error_text__}.  This is the same
-as @code{eval (@var{try}, @var{catch})} (which may now also use
-@code{__error_text__}) but it is more efficient since the commands do
-not need to be parsed each time the @var{try} and @var{catch} statements
-are evaluated.  @xref{Error Handling}, for more information about the
-@code{__error_text__} variable.
+@var{cleanup} can use the function @code{lasterr} to access the text
+of the message that would have been printed.  This is the same
+as @code{eval (@var{try}, @var{catch})} but it is more efficient since
+the commands do not need to be parsed each time the @var{try} and
+@var{catch} statements are evaluated.  @xref{Error Handling}, for more
+information about the @code{lasterr} function.
 
 Octave's @var{try} block is a very limited variation on the Lisp
 condition-case form (limited because it cannot handle different classes
--- a/emacs/octave-mod.el	Mon Jan 19 19:25:27 2004 +0000
+++ b/emacs/octave-mod.el	Tue Jan 20 23:04:47 2004 +0000
@@ -136,7 +136,7 @@
     "__O_CREAT__" "__O_EXCL__" "__O_NONBLOCK__" "__O_RDONLY__"
     "__O_RDWR__" "__O_TRUNC__" "__O_WRONLY__" "__PWD__" "__SEEK_CUR__"
     "__SEEK_END__" "__SEEK_SET__" "__argv__" "__e__" "__eps__"
-    "__error_text__" "__i__" "__inf__" "__j__" "__nan__" "__pi__"
+    "__i__" "__inf__" "__j__" "__nan__" "__pi__"
     "__program_invocation_name__" "__program_name__" "__realmax__"
     "__realmin__" "__stderr__" "__stdin__" "__stdout__" "ans" "argv"
     "automatic_replot" "beep_on_error" "completion_append_char"
--- a/src/ChangeLog	Mon Jan 19 19:25:27 2004 +0000
+++ b/src/ChangeLog	Tue Jan 20 23:04:47 2004 +0000
@@ -1,3 +1,29 @@
+2004-01-20  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* ov-re-mat.cc (complex_array_value): New function.
+	* ov-re-mat.h: Provide decl.
+
+	* ov-cell.cc (Fiscellstr): Don't return value on usage error.
+
+	* error.cc: (symbols_of_error): Delete DEFVAR for error_text.
+	Define __error_text__ and error_text as aliases for lasterr.
+
+	* error.cc (bind_global_error_variable,	clear_global_error_variable):
+	Delete.
+	* variables.h: Delete decls.
+
+	* parse.y (Feval, Fevalin): Don't call bind_global_error_variable.
+	Don't add clear_global_error_variable to the unwind_protect stack.
+	Increment buffer_error_messages before evaluating "eval" code,
+	decrement it before evaluating "catch" code.	
+
+	* pt-except.cc (do_catch_code): Don't call bind_global_error_variable.
+	Don't add clear_global_error_variable to the unwind_protect stack.
+	Decrement buffer_error_messages here.
+	(tree_try_catch_command::eval): Increment buffer_error_messages here.
+
+	* error.cc, error.h (buffer_error_messages): Now an int.
+
 2004-01-16  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* toplev.cc (octave_config_info): Add float_format,
--- a/src/defun-int.h	Mon Jan 19 19:25:27 2004 +0000
+++ b/src/defun-int.h	Tue Jan 20 23:04:47 2004 +0000
@@ -176,7 +176,7 @@
 
 // No definition is required for an alias.
 
-#define DEFALIAS_INTERNAL(name, alias)
+#define DEFALIAS_INTERNAL(alias, name)
 
 // How builtin variables are actually installed.
 
--- a/src/defun.h	Mon Jan 19 19:25:27 2004 +0000
+++ b/src/defun.h	Tue Jan 20 23:04:47 2004 +0000
@@ -157,8 +157,8 @@
 // must be used in the same file where name is defined, after the
 // definition for name.
 
-#define DEFALIAS(name, alias) \
-  DEFALIAS_INTERNAL (name, alias)
+#define DEFALIAS(alias, name) \
+  DEFALIAS_INTERNAL (alias, name)
 
 #endif
 
--- a/src/error.cc	Mon Jan 19 19:25:27 2004 +0000
+++ b/src/error.cc	Tue Jan 20 23:04:47 2004 +0000
@@ -95,7 +95,7 @@
 // Tell the error handler whether to print messages, or just store
 // them for later.  Used for handling errors in eval() and
 // the `unwind_protect' statement.
-bool buffer_error_messages = false;
+int buffer_error_messages = 0;
 
 // TRUE means error messages are turned off.
 bool discard_error_messages = false;
@@ -111,7 +111,7 @@
 {
   error_state = 0;
   warning_state = 0;
-  buffer_error_messages = false;
+  buffer_error_messages = 0;
   discard_error_messages = false;
 }
 
@@ -200,7 +200,7 @@
 
 	  // XXX FIXME XXX -- this is ugly, but it prevents
 	  //
-	  //   eval ("error (\"msg\")", "error (__error_text__)");
+	  //   eval ("error (\"msg\")", "error (lasterr ())");
 	  //
 	  // from printing `error: ' twice.  Assumes that the NAME we
 	  // have been given doesn't contain `:'.
@@ -428,7 +428,7 @@
 {
   va_list args;
   va_start (args, fmt);
-  buffer_error_messages = false;
+  buffer_error_messages = 0;
   discard_error_messages = false;
   verror ("panic", fmt, args);
   va_end (args);
@@ -669,6 +669,10 @@
   return retval;  
 }
 
+// For backward compatibility.
+DEFALIAS (error_text, lasterr);
+DEFALIAS (__error_text__, lasterr);
+
 DEFUN (lastwarn, args, ,
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} lastwarn ()\n\
@@ -727,37 +731,6 @@
   return retval;
 }
 
-void
-bind_global_error_variable (void)
-{
-  if (error_message_buffer)
-    {
-      *error_message_buffer << OSSTREAM_ENDS;
-
-      bind_builtin_variable ("__error_text__",
-			     OSSTREAM_STR (*error_message_buffer),
-			     true);
-
-      OSSTREAM_FREEZE (*error_message_buffer);
-
-      delete error_message_buffer;
-
-      error_message_buffer = 0;
-    }
-  else
-    bind_builtin_variable ("__error_text__", "", true);
-}
-
-void
-clear_global_error_variable (void *)
-{
-  delete error_message_buffer;
-
-  error_message_buffer = 0;
-
-  bind_builtin_variable ("__error_text__", "", true);
-}
-
 static int
 beep_on_error (void)
 {
@@ -809,25 +782,6 @@
 to enter the debugger when a warning is encountered.  The default\n\
 value is 0.\n\
 @end defvr");
-
-  DEFCONST (error_text, "",
-    "-*- texinfo -*-\n\
-@defvr {Built-in Variable} error_text\n\
-This variable contains the text of error messages that would have\n\
-been printed in the body of the most recent @code{unwind_protect} or\n\
-@code{try} statement or the @var{try} part of the most recent call to\n\
-the @code{eval} function.  Outside of the @code{unwind_protect} and\n\
-@code{try} statements or the @code{eval} function, or if no error has\n\
-occurred within them, the value of @code{error_text} is guaranteed to be\n\
-the empty string.\n\
-\n\
-Note that the message does not include the first @samp{error: } prefix,\n\
-so that it may easily be passed to the @code{error} function without\n\
-additional processing@footnote{Yes, it's a kluge, but it seems to be a\n\
-reasonably useful one.}.\n\
-\n\
-@xref{The try Statement}, and @ref{The unwind_protect Statement}.\n\
-@end defvr");
 }
 
 /*
--- a/src/error.h	Mon Jan 19 19:25:27 2004 +0000
+++ b/src/error.h	Tue Jan 20 23:04:47 2004 +0000
@@ -47,7 +47,7 @@
 // Tell the error handler whether to print messages, or just store
 // them for later.  Used for handling errors in eval() and
 // the `unwind_protect' statement.
-extern bool buffer_error_messages;
+extern int buffer_error_messages;
 
 // TRUE means error messages are turned off.
 extern bool discard_error_messages;
--- a/src/ov-cell.cc	Mon Jan 19 19:25:27 2004 +0000
+++ b/src/ov-cell.cc	Tue Jan 20 23:04:47 2004 +0000
@@ -980,10 +980,12 @@
 character string\n\
 @end deftypefn")
 {
-  octave_value retval = true;
+  octave_value retval;
 
   if (args.length () == 1)
     {
+      retval = true;
+
       octave_value arg = args (0);
 
       if (arg.is_cell ())
--- a/src/ov-re-mat.cc	Mon Jan 19 19:25:27 2004 +0000
+++ b/src/ov-re-mat.cc	Tue Jan 20 23:04:47 2004 +0000
@@ -138,6 +138,12 @@
   return ComplexMatrix (matrix.matrix_value ());
 }
 
+ComplexNDArray
+octave_matrix::complex_array_value (bool) const
+{
+  return ComplexNDArray (matrix);
+}
+
 streamoff_array
 octave_matrix::streamoff_array_value (void) const
 {
--- a/src/ov-re-mat.h	Mon Jan 19 19:25:27 2004 +0000
+++ b/src/ov-re-mat.h	Tue Jan 20 23:04:47 2004 +0000
@@ -101,6 +101,8 @@
 
   ComplexMatrix complex_matrix_value (bool = false) const;
 
+  ComplexNDArray complex_array_value (bool = false) const;
+
   NDArray array_value (bool = false) const { return matrix; }
 
   streamoff_array streamoff_array_value (void) const;
--- a/src/parse.y	Mon Jan 19 19:25:27 2004 +0000
+++ b/src/parse.y	Tue Jan 20 23:04:47 2004 +0000
@@ -3780,8 +3780,8 @@
 
       if (nargin > 1)
 	{
-	  unwind_protect_bool (buffer_error_messages);
-	  buffer_error_messages = true;
+	  unwind_protect_int (buffer_error_messages);
+	  buffer_error_messages++;
 	}
 
       int parse_status = 0;
@@ -3799,11 +3799,7 @@
 	  // Set up for letting the user print any messages from
 	  // errors that occurred in the first part of this eval().
 
-	  buffer_error_messages = false;
-
-	  bind_global_error_variable ();
-
-	  unwind_protect::add (clear_global_error_variable, 0);
+	  buffer_error_messages--;
 
 	  eval_string (args(1), 0, parse_status, nargout);
 
@@ -3917,8 +3913,8 @@
 	    {
 	      if (nargin > 2)
 	        {
-		  unwind_protect_bool (buffer_error_messages);
-		  buffer_error_messages = true;
+		  unwind_protect_int (buffer_error_messages);
+		  buffer_error_messages++;
 		}
 
 	      int parse_status = 0;
@@ -3936,11 +3932,7 @@
 		  // Set up for letting the user print any messages from
 		  // errors that occurred in the first part of this eval().
 
-		  buffer_error_messages = false;
-
-		  bind_global_error_variable ();
-
-		  unwind_protect::add (clear_global_error_variable, 0);
+		  buffer_error_messages--;
 
 		  eval_string (args(2), 0, parse_status, nargout);
 
--- a/src/pt-except.cc	Mon Jan 19 19:25:27 2004 +0000
+++ b/src/pt-except.cc	Tue Jan 20 23:04:47 2004 +0000
@@ -62,22 +62,13 @@
 
   tree_statement_list *list = static_cast<tree_statement_list *> (ptr);
 
-  unwind_protect::begin_frame ("do_catch_code");
-
   // Set up for letting the user print any messages from errors that
   // occurred in the body of the try_catch statement.
 
-  unwind_protect_bool (buffer_error_messages);
-  buffer_error_messages = false;
-
-  bind_global_error_variable ();
-
-  unwind_protect::add (clear_global_error_variable, 0);
+  buffer_error_messages--;
 
   if (list)
     list->eval ();
-
-  unwind_protect::run_frame ("do_catch_code");
 }
 
 void
@@ -89,8 +80,8 @@
 
   if (catch_code)
     {
-      unwind_protect_bool (buffer_error_messages);
-      buffer_error_messages = true;
+      unwind_protect_int (buffer_error_messages);
+      buffer_error_messages++;
     }
 
   unwind_protect::add (do_catch_code, catch_code);
@@ -107,6 +98,9 @@
     {
       error_state = 0;
 
+      // Unwind stack elements must be cleared or run in the reverse
+      // order in which they were added to the stack.
+
       // For clearing the do_catch_code cleanup function.
       unwind_protect::discard ();
 
--- a/src/variables.h	Mon Jan 19 19:25:27 2004 +0000
+++ b/src/variables.h	Tue Jan 20 23:04:47 2004 +0000
@@ -98,10 +98,6 @@
 
 extern void bind_ans (const octave_value& val, bool print);
 
-extern void bind_global_error_variable (void);
-
-extern void clear_global_error_variable (void *);
-
 extern void
 bind_builtin_constant (const std::string&, const octave_value&,
 		       bool protect = false, bool eternal = false,
--- a/test/octave.test/arith/acot-1.m	Mon Jan 19 19:25:27 2004 +0000
+++ b/test/octave.test/arith/acot-1.m	Tue Jan 20 23:04:47 2004 +0000
@@ -1,7 +1,7 @@
 rt2 = sqrt (2);
 rt3 = sqrt (3);
-v = [pi/6, pi/4, pi/3, pi/2, 2*pi/3, 3*pi/4, 5*pi/6];
 x = [rt3, 1, rt3/3, 0, -rt3/3, -1, -rt3];
+v = [pi/6, pi/4, pi/3, pi/2, -pi/3, -pi/4, -pi/6];
 all (abs (acot (x) - v) < sqrt (eps))
 
 
--- a/test/octave.test/eval-catch/eval-catch-10.m	Mon Jan 19 19:25:27 2004 +0000
+++ b/test/octave.test/eval-catch/eval-catch-10.m	Tue Jan 20 23:04:47 2004 +0000
@@ -1,2 +1,2 @@
-eval ("eval (\"clear a; a;\", \"error (strcat (\\\"rethrow: \\\", __error_text__));\");",
-      "__error_text__");
+eval ("eval (\"clear a; a;\", \"error (strcat (\\\"rethrow: \\\", lasterr));\");",
+      "lasterr");
--- a/test/octave.test/eval-catch/eval-catch-5.m	Mon Jan 19 19:25:27 2004 +0000
+++ b/test/octave.test/eval-catch/eval-catch-5.m	Tue Jan 20 23:04:47 2004 +0000
@@ -1,2 +1,2 @@
-eval ("clear a; a;", "__error_text__");
-__error_text__
+eval ("clear a; a;", "lasterr");
+lasterr
--- a/test/octave.test/eval-catch/eval-catch-6.m	Mon Jan 19 19:25:27 2004 +0000
+++ b/test/octave.test/eval-catch/eval-catch-6.m	Tue Jan 20 23:04:47 2004 +0000
@@ -1,2 +1,2 @@
-eval ("error (\"user-defined error\");", "__error_text__");
-__error_text__
+eval ("error (\"user-defined error\");", "lasterr");
+lasterr
--- a/test/octave.test/eval-catch/eval-catch-7.m	Mon Jan 19 19:25:27 2004 +0000
+++ b/test/octave.test/eval-catch/eval-catch-7.m	Tue Jan 20 23:04:47 2004 +0000
@@ -2,4 +2,4 @@
   ## Wrap angle brackets around S.
   ms = strcat ("<", s, ">");
 endfunction
-eval ("clear a; a;", "mangle (__error_text__)");
+eval ("clear a; a;", "mangle (lasterr)");
--- a/test/octave.test/eval-catch/eval-catch-8.m	Mon Jan 19 19:25:27 2004 +0000
+++ b/test/octave.test/eval-catch/eval-catch-8.m	Tue Jan 20 23:04:47 2004 +0000
@@ -1,2 +1,2 @@
-eval ("eval (\"clear a; a;\", \"__error_text__\"); clear b; b;",
-      "__error_text__");
+eval ("eval (\"clear a; a;\", \"lasterr\"); clear b; b;",
+      "lasterr");
--- a/test/octave.test/eval-catch/eval-catch-9.m	Mon Jan 19 19:25:27 2004 +0000
+++ b/test/octave.test/eval-catch/eval-catch-9.m	Tue Jan 20 23:04:47 2004 +0000
@@ -1,2 +1,2 @@
 eval ("clear a; a;",
-      "eval (\"clear b; b;\", \"__error_text__\"); __error_text__");
+      "eval (\"clear b; b;\", \"lasterr\"); lasterr");
--- a/test/octave.test/eval-catch/eval-catch.exp	Mon Jan 19 19:25:27 2004 +0000
+++ b/test/octave.test/eval-catch/eval-catch.exp	Tue Jan 20 23:04:47 2004 +0000
@@ -1,3 +1,4 @@
+
 ## parse empty try string
 set test eval-catch-1
 set prog_output "^$"
@@ -18,35 +19,32 @@
 set prog_output "^ans = 1"
 do_test eval-catch-4.m
 
-## define __error_text__ *only* within catch-string
+## lasterr works in and out of the catch string.
 set test eval-catch-5
-set prog_output "__error_text__ = `a' undefined.*\n\n__error_text__ = $"
+set prog_output "ans = error: `a' undefined.*\n\nans = error: `a' undefined"
 do_test eval-catch-5.m
 
 ## throw a user-defined error
 set test eval-catch-6
-set prog_output "__error_text__ = user-defined error\n\n__error_text__ = $"
+set prog_output "ans = error: user-defined error\n\nans = error: user-defined error"
 do_test eval-catch-6.m
 
-## pass __error_text__ to user-defined subroutine
+## pass lasterr to user-defined subroutine
 set test eval-catch-7
-set prog_output "^ans = <`a' undefined.*\n>"
+set prog_output "^ans = <error: `a' undefined.*\n>"
 do_test eval-catch-7.m
 
 ## handle nested eval: eval in try-string
 set test eval-catch-8
-set prog_output "__error_text__ = `a' undefined.*\n\n__error_text__ = `b' undefined.*\n$"
+set prog_output "ans = error: `a' undefined.*\n\nans = error: `b' undefined.*\n$"
 do_test eval-catch-8.m
 
 ## handle nested eval: eval nested in catch-string
 set test eval-catch-9
-set prog_output "__error_text__ = `a' undefined.*\n\n__error_text__ = `b' undefined.*\n$"
-setup_xfail *-*-*
+set prog_output "ans = error: `b' undefined.*\n\nans = error: `b' undefined.*\n$"
 do_test eval-catch-9.m
 
 ## re-throw an error
 set test eval-catch-10
-set prog_output "__error_text__ = rethrow: `a' undefined.*\n"
-setup_xfail *-*-*
+set prog_output "ans = error: rethrow: error: `a' undefined.*\n"
 do_test eval-catch-10.m
-
--- a/test/octave.test/system/glob-1.m	Mon Jan 19 19:25:27 2004 +0000
+++ b/test/octave.test/system/glob-1.m	Tue Jan 20 23:04:47 2004 +0000
@@ -1,1 +1,1 @@
-isstr (glob ("/*"))
+iscell (glob ("/*"))
--- a/test/octave.test/system/readdir-1.m	Mon Jan 19 19:25:27 2004 +0000
+++ b/test/octave.test/system/readdir-1.m	Tue Jan 20 23:04:47 2004 +0000
@@ -1,2 +1,2 @@
 [files, status, msg] = readdir ("/");
-isstr (files) && status == 0 && msg == ""
+iscell (files) && status == 0 && msg == ""
--- a/test/octave.test/try/try-10.m	Mon Jan 19 19:25:27 2004 +0000
+++ b/test/octave.test/try/try-10.m	Tue Jan 20 23:04:47 2004 +0000
@@ -3,8 +3,8 @@
     clear a
     a;
   catch
-    error (strcat ("rethrow: ", __error_text__));
+    error (strcat ("rethrow: ", lasterr));
   end_try_catch
 catch
-  __error_text__
+  lasterr
 end_try_catch
--- a/test/octave.test/try/try-5.m	Mon Jan 19 19:25:27 2004 +0000
+++ b/test/octave.test/try/try-5.m	Tue Jan 20 23:04:47 2004 +0000
@@ -2,6 +2,6 @@
   clear a;
   a;
 catch
-  __error_text__
+  lasterr
 end_try_catch
-__error_text__
+lasterr
--- a/test/octave.test/try/try-6.m	Mon Jan 19 19:25:27 2004 +0000
+++ b/test/octave.test/try/try-6.m	Tue Jan 20 23:04:47 2004 +0000
@@ -1,5 +1,5 @@
 try
   error ("user-defined error")
 catch
-  __error_text__
+  lasterr
 end_try_catch
--- a/test/octave.test/try/try-7.m	Mon Jan 19 19:25:27 2004 +0000
+++ b/test/octave.test/try/try-7.m	Tue Jan 20 23:04:47 2004 +0000
@@ -6,5 +6,5 @@
   clear a
   a;
 catch
-  mangle (__error_text__)
+  mangle (lasterr)
 end_try_catch
--- a/test/octave.test/try/try-8.m	Mon Jan 19 19:25:27 2004 +0000
+++ b/test/octave.test/try/try-8.m	Tue Jan 20 23:04:47 2004 +0000
@@ -3,10 +3,10 @@
     clear a
     a;
   catch
-    __error_text__
+    lasterr
   end_try_catch
   clear b
   b;
 catch
-  __error_text__
+  lasterr
 end_try_catch
--- a/test/octave.test/try/try-9.m	Mon Jan 19 19:25:27 2004 +0000
+++ b/test/octave.test/try/try-9.m	Tue Jan 20 23:04:47 2004 +0000
@@ -6,7 +6,7 @@
     clear b
     b;
   catch
-    __error_text__
+    lasterr
   end_try_catch
-  __error_text__
+  lasterr
 end_try_catch
--- a/test/octave.test/try/try.exp	Mon Jan 19 19:25:27 2004 +0000
+++ b/test/octave.test/try/try.exp	Tue Jan 20 23:04:47 2004 +0000
@@ -18,34 +18,32 @@
 set prog_output "^ans = 1"
 do_test try-4.m
 
-## define __error_text__ *only* within catch-clause
+## lasterr works in and out of the catch string.
 set test try-5
-set prog_output "__error_text__ = `a' undefined.*\n\n__error_text__ = $"
+set prog_output "ans = error: `a' undefined.*\n\nans = error: `a' undefined"
 do_test try-5.m
 
 ## throw user-defined error
 set test try-6
-set prog_output "__error_text__ = user-defined error\n"
+set prog_output "ans = error: user-defined error\n"
 do_test try-6.m
 
-## pass __error_text__ to user-defined subroutine
+## pass lasterr to user-defined subroutine
 set test try-7
-set prog_output "^ans = <`a' undefined.*\n>"
+set prog_output "^ans = <error: `a' undefined.*\n>"
 do_test try-7.m
 
 ## handle nested try-catch-block: try nested in try
 set test try-8
-set prog_output "__error_text__ = `a' undefined.*\n\n__error_text__ = `b' undefined.*\n$"
+set prog_output "ans = error: `a' undefined.*\n\nans = error: `b' undefined.*\n$"
 do_test try-8.m
 
 ## handle nested try-catch-block: try nested in catch
 set test try-9
-set prog_output "__error_text__ = `a' undefined.*\n\n__error_text__ = `b' undefined.*\n$"
-setup_xfail *-*-*
+set prog_output "ans = error: `b' undefined.*\n\nans = error: `b' undefined.*\n$"
 do_test try-9.m
 
 ## re-throw an error
 set test try-10
-set prog_output "__error_text__ = rethrow: `a' undefined.*\n"
-setup_xfail *-*-*
+set prog_output "ans = error: rethrow: error: `a' undefined.*\n"
 do_test try-10.m