diff src/error.cc @ 5743:a527e0f77aa5

[project @ 2006-04-06 08:20:21 by jwe]
author jwe
date Thu, 06 Apr 2006 08:20:23 +0000
parents 6bf56668b01a
children 1c36a2e82266
line wrap: on
line diff
--- a/src/error.cc
+++ b/src/error.cc
@@ -378,27 +378,19 @@
       int l = -1;
       int c = -1;
 
-      octave_function *fcn = curr_function;
+      octave_user_function *fcn = octave_call_stack::caller_script ();
 
       if (fcn)
 	{
-	  nm = fcn->name ();
+	  nm = fcn->fcn_file_name ();
 
-	  if (nm == "error" || nm == "warning")
-	    fcn = curr_caller_function;
-
-	  if (fcn)
-	    {
-	      nm = fcn->fcn_file_name ();
+	  if (nm.empty ())
+	    nm = fcn->name ();
 
-	      if (nm.empty ())
-		nm = fcn->name ();
-
-	      if (curr_statement)
-		{
-		  l = curr_statement->line ();
-		  c = curr_statement->column ();
-		}
+	  if (curr_statement)
+	    {
+	      l = curr_statement->line ();
+	      c = curr_statement->column ();
 	    }
 	}
 
@@ -552,7 +544,8 @@
       warning_state = 1;
 
       if ((interactive || forced_interactive)
-	  && Vdebug_on_warning && curr_function)
+	  && Vdebug_on_warning
+	  && octave_call_stack::caller_script ())
 	{
 	  unwind_protect_bool (Vdebug_on_warning);
 	  Vdebug_on_warning = false;
@@ -590,7 +583,8 @@
   error_1 (std::cerr, "error", id, fmt, args);
 
   if ((interactive || forced_interactive)
-      && Vdebug_on_error && init_state == 0 && curr_function)
+      && Vdebug_on_error && init_state == 0
+      && octave_call_stack::caller_script ())
     {
       unwind_protect_bool (Vdebug_on_error);
       Vdebug_on_error = false;