diff src/input.cc @ 4975:80842ad3f85c

[project @ 2004-09-08 18:37:58 by jwe]
author jwe
date Wed, 08 Sep 2004 18:37:59 +0000
parents b3f20980be32
children bdbee5282954
line wrap: on
line diff
--- a/src/input.cc
+++ b/src/input.cc
@@ -535,7 +535,43 @@
   if (nargin == 2)
     read_as_string++;
 
-  std::string prompt ("debug> ");
+  std::string nm;
+  int line = -1;
+
+  // We look at curr_caller_function because curr_function is always
+  // "keyboard".
+
+  if (curr_caller_function)
+    {
+      nm = curr_caller_function->fcn_file_name ();
+
+      if (nm.empty ())
+	nm = curr_caller_function->name ();
+
+      if (curr_statement)
+	line = curr_statement->line ();
+    }
+
+  OSSTREAM buf;
+
+  if (! nm.empty ())
+    {
+      buf << "stopped in " << nm;
+
+      if (line > 0)
+	buf << " at line " << line;
+    }
+    
+  buf << OSSTREAM_ENDS;
+
+  std::string msg = OSSTREAM_STR (buf);
+
+  OSSTREAM_FREEZE (buf);
+
+  if (! msg.empty ())
+    message ("keyboard", msg.c_str ());
+
+  std::string prompt = "debug> ";
 
   if (nargin > 0)
     {