diff src/pt-eval.cc @ 8845:5a6db6bd1a02

eigs.cc (Feigs): fix handling of sigma arg
author John W. Eaton <jwe@octave.org>
date Mon, 23 Feb 2009 16:29:20 -0500
parents 280fae940bb0
children 4d812facab0e
line wrap: on
line diff
--- a/src/pt-eval.cc	Mon Feb 23 12:55:32 2009 -0500
+++ b/src/pt-eval.cc	Mon Feb 23 16:29:20 2009 -0500
@@ -85,10 +85,15 @@
 }
 
 void
-tree_evaluator::visit_break_command (tree_break_command&)
+tree_evaluator::visit_break_command (tree_break_command& cmd)
 {
   if (! error_state)
-    tree_break_command::breaking = 1;
+    {
+      if (debug_mode)
+	do_breakpoint (cmd.is_breakpoint (), cmd.line (), cmd.column ());
+
+      tree_break_command::breaking = 1;
+    }
 }
 
 void
@@ -183,12 +188,18 @@
 void
 tree_evaluator::visit_global_command (tree_global_command& cmd)
 {
+  if (debug_mode)
+    do_breakpoint (cmd.is_breakpoint (), cmd.line (), cmd.column ());
+
   do_decl_init_list (do_global_init, cmd.initializer_list ());
 }
 
 void
 tree_evaluator::visit_static_command (tree_static_command& cmd)
 {
+  if (debug_mode)
+    do_breakpoint (cmd.is_breakpoint (), cmd.line (), cmd.column ());
+
   do_decl_init_list (do_static_init, cmd.initializer_list ());
 }
 
@@ -268,6 +279,9 @@
   if (error_state)
     return;
 
+  if (debug_mode)
+    do_breakpoint (cmd.is_breakpoint (), cmd.line (), cmd.column ());
+
   unwind_protect::begin_frame ("tree_evaluator::visit_simple_for_command");
 
   unwind_protect_bool (in_loop_command);
@@ -408,6 +422,9 @@
   if (error_state)
     return;
 
+  if (debug_mode)
+    do_breakpoint (cmd.is_breakpoint (), cmd.line (), cmd.column ());
+
   unwind_protect::begin_frame ("tree_evaluator::visit_complex_for_command");
 
   unwind_protect_bool (in_loop_command);
@@ -544,9 +561,8 @@
 
       tree_expression *expr = tic->condition ();
 
-      if (debug_mode)
-	do_breakpoint (! tic->is_else_clause () && tic->is_breakpoint (),
-		       tic->line (), tic->column ());
+      if (debug_mode && ! tic->is_else_clause ())
+	do_breakpoint (tic->is_breakpoint (), tic->line (), tic->column ());
 
       if (tic->is_else_clause () || expr->is_logically_true ("if"))
 	{
@@ -588,9 +604,10 @@
 }
 
 void
-tree_evaluator::visit_no_op_command (tree_no_op_command&)
+tree_evaluator::visit_no_op_command (tree_no_op_command& cmd)
 {
-  // Do nothing.
+  if (debug_mode && cmd.is_end_of_fcn_or_script ())
+    do_breakpoint (cmd.is_breakpoint (), cmd.line (), cmd.column (), true);
 }
 
 void
@@ -624,10 +641,15 @@
 }
 
 void
-tree_evaluator::visit_return_command (tree_return_command&)
+tree_evaluator::visit_return_command (tree_return_command& cmd)
 {
   if (! error_state)
-    tree_return_command::returning = 1;
+    {
+      if (debug_mode)
+	do_breakpoint (cmd.is_breakpoint (), cmd.line (), cmd.column ());
+
+      tree_return_command::returning = 1;
+    }
 }
 
 void
@@ -645,9 +667,6 @@
 void
 tree_evaluator::visit_statement (tree_statement& stmt)
 {
-  if (debug_mode)
-    do_breakpoint (stmt);
-
   tree_command *cmd = stmt.command ();
   tree_expression *expr = stmt.expression ();
 
@@ -667,6 +686,10 @@
 	    cmd->accept (*this);
 	  else
 	    {
+	      if (debug_mode)
+		do_breakpoint (expr->is_breakpoint (), expr->line (),
+			       expr->column ());
+
 	      if (in_fcn_or_script_body && Vsilent_functions)
 		expr->set_print_flag (false);
 
@@ -794,9 +817,8 @@
 	    {
 	      tree_switch_case *t = *p;
 
-	      if (debug_mode)
-		do_breakpoint (! t->is_default_case () && t->is_breakpoint (),
-			       t->line (), t->column ());
+	      if (debug_mode && ! t->is_default_case ())
+		do_breakpoint (t->is_breakpoint (), t->line (), t->column ());
 
 	      if (t->is_default_case () || t->label_matches (val))
 		{
@@ -1016,7 +1038,7 @@
   for (;;)
     {
       if (debug_mode)
-	do_breakpoint (expr->is_breakpoint (), l, c);
+	do_breakpoint (cmd.is_breakpoint (), l, c);
 
       if (expr->is_logically_true ("while"))
 	{
@@ -1073,10 +1095,13 @@
 	    goto cleanup;
 	}
 
+      if (quit_loop_now ())
+	break;
+
       if (debug_mode)
-	do_breakpoint (expr->is_breakpoint (), l, c);
+	do_breakpoint (cmd.is_breakpoint (), l, c);
 
-      if (quit_loop_now () || expr->is_logically_true ("do-until"))
+      if (expr->is_logically_true ("do-until"))
 	break;
     }