diff src/toplev.h @ 9484:bbe033dcfe13

make dbwhere work when called at keyboard prompt
author John W. Eaton <jwe@octave.org>
date Tue, 04 Aug 2009 15:32:14 -0400
parents 17af7cce7d1b
children cd96d29c5efa
line wrap: on
line diff
--- a/src/toplev.h	Tue Aug 04 12:59:16 2009 -0400
+++ b/src/toplev.h	Tue Aug 04 15:32:14 2009 -0400
@@ -135,10 +135,16 @@
   }
 
   // Current function (top of stack).
-  static octave_function *current (void) { return top (); }
+  static octave_function *current (void)
+  {
+    return instance_ok () ? instance->do_current () : 0;
+  }
 
   // Current statement (top of stack).
-  static tree_statement *current_statement (void) { return top_statement (); }
+  static tree_statement *current_statement (void)
+  {
+    return instance_ok () ? instance->do_current_statement () : 0;
+  }
 
   // Current line in current function.
   static int current_line (void)
@@ -226,16 +232,6 @@
       instance->do_push (0, scope, context);
   }
 
-  static octave_function *top (void)
-  {
-    return instance_ok () ? instance->do_top (): 0;
-  }
-
-  static tree_statement *top_statement (void)
-  {
-    return instance_ok () ? instance->do_top_statement (): 0;
-  }
-
   static void set_statement (tree_statement *s)
   {
     if (instance_ok ())
@@ -358,26 +354,26 @@
     symbol_table::set_scope_and_context (scope, context);
   }
 
-  octave_function *do_top (void) const
+  octave_function *do_current (void) const
   {
     octave_function *retval = 0;
 
     if (! cs.empty ())
       {
-	const call_stack_elt& elt = cs.back ();
+	const call_stack_elt& elt = cs[curr_frame];
 	retval = elt.fcn;
       }
 
     return retval;
   }
 
-  tree_statement *do_top_statement (void) const
+  tree_statement *do_current_statement (void) const
   {
     tree_statement *retval = 0;
 
     if (! cs.empty ())
       {
-	const call_stack_elt& elt = cs.back ();
+	const call_stack_elt& elt = cs[curr_frame];
 	retval = elt.stmt;
       }