diff src/error.cc @ 3018:5708b8bb4f06

[project @ 1997-06-03 21:48:05 by jwe]
author jwe
date Tue, 03 Jun 1997 21:57:33 +0000
parents 8b262e771614
children 2d485faf2fa3
line wrap: on
line diff
--- a/src/error.cc
+++ b/src/error.cc
@@ -49,7 +49,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.
-int buffer_error_messages;
+bool buffer_error_messages;
 
 // The message buffer
 ostrstream *error_message_buffer = 0;
@@ -279,6 +279,31 @@
   return handle_message (usage, "unknown", args);
 }
 
+void
+bind_global_error_variable (void)
+{
+  *error_message_buffer << ends;
+
+  char *error_text = error_message_buffer->str ();
+
+  bind_builtin_variable ("__error_text__", error_text, 1);
+
+  delete [] error_text;
+
+  delete error_message_buffer;
+
+  error_message_buffer = 0;
+}
+
+void
+clear_global_error_variable (void *)
+{
+  delete error_message_buffer;
+  error_message_buffer = 0;
+
+  bind_builtin_variable ("__error_text__", "", 1);
+}
+
 static int
 beep_on_error (void)
 {
@@ -292,6 +317,13 @@
 {
   DEFVAR (beep_on_error, 0.0, 0, beep_on_error,
     "if true, beep before printing error messages");
+
+  DEFCONST (error_text, "", 0, 0,
+    "the text of error messages that would have been printed in the\n\
+body of the most recent unwind_protect statement or the TRY part of\n\
+the most recent eval() command.  Outside of unwind_protect and\n\
+eval(), or if no error has ocurred within them, the value of\n\
+__error_text__ is guaranteed to be the empty string.");
 }
 
 /*