changeset 6317:8c67f8be341d

[project @ 2007-02-16 08:10:53 by jwe]
author jwe
date Fri, 16 Feb 2007 08:10:54 +0000
parents a3a2580435c2
children bae85c1e0e2a
files src/ChangeLog src/debug.cc src/input.cc
diffstat 3 files changed, 42 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Fri Feb 16 07:23:49 2007 +0000
+++ b/src/ChangeLog	Fri Feb 16 08:10:54 2007 +0000
@@ -1,3 +1,13 @@
+2007-02-16  John W. Eaton  <jwe@octave.org>
+
+	* input.cc (interactive_input): New arg, DEBUG.  Don't call
+	drawnow if debugging.
+	(get_user_input): Pass DEBUG to interactive_input.
+
+2007-02-16  Muthiah Annamalai  <muthuspost@gmail.com>
+
+	* debug.cc (Fdbtype): Improve compatibility.
+
 2007-02-16  John W. Eaton  <jwe@octave.org>
 
 	* toplev.cc (wait_for_input): New function.
--- a/src/debug.cc	Fri Feb 16 07:23:49 2007 +0000
+++ b/src/debug.cc	Fri Feb 16 08:10:54 2007 +0000
@@ -348,8 +348,9 @@
 	os << "dbtype: unable to open `" << ff << "' for reading!\n";
     }
   else
-    os << "dbtype: unkown function";
+    os << "dbtype: unknown function " << name << "\n";
 
+  os.flush();
 }
 
 DEFCMD (dbtype, args, ,
@@ -401,25 +402,28 @@
 		      int start = atoi (start_str.c_str ());
 		      int end = atoi (end_str.c_str ());
 		
-		      if (start < end)
-			do_dbtype (octave_stdout,
-				   dbg_fcn->name (), start, end);
+		      if (std::min (start, end) <= 0)
+ 			error ("dbtype: start and end lines must be >= 1\n");
+
+		      if (start <= end)
+			do_dbtype (octave_stdout, dbg_fcn->name (), start, end);
 		      else
-			error ("dbtype: the start line must be less than the end line\n");
+			error ("dbtype: start line must be less than end line\n");
 		    }
 		  else
-		    error ("dbtype: if you specify lines it must be like `start:end`");
+		    error ("dbtype: line specification must be `start:end'");
 		}
 	    }
 	  break;
 
-	case 2: // (dbtype func start:end)
+	case 2: // (dbtype func start:end) , (dbtype func start)
 	  dbg_fcn = get_user_function (argv[1]);
 
 	  if (dbg_fcn)
 	    {
 	      std::string arg = argv[2];
-
+	      int start = 0;
+	      int end = 0;
 	      size_t ind = arg.find (':');
 
 	      if (ind != NPOS)
@@ -427,17 +431,23 @@
 		  std::string start_str = arg.substr (0, ind);
 		  std::string end_str = arg.substr (ind + 1);
 
-		  int start = atoi (start_str.c_str ());
-		  int end = atoi (end_str.c_str ());
-		
-		  if (start < end)
-		    do_dbtype (octave_stdout,
-			       dbg_fcn->name (), start, end);
-		  else
-		    error ("dbtype: the start line must be less than the end line\n");
+		  start = atoi (start_str.c_str ());
+		  end = atoi (end_str.c_str ());
+		  
 		}
 	      else
-		error ("dbtype: if you specify lines it must be like `start:end`");
+		{
+		  start = atoi (arg.c_str ());
+		  end = start;
+		}
+
+	      if (std::min (start, end) <= 0)
+		error ("dbtype: start and end lines must be >= 1\n");
+	      
+	      if (start <= end)
+		do_dbtype (octave_stdout, dbg_fcn->name (), start, end);
+	      else
+		error ("dbtype: start line must be less than end line\n");
 	    }
 	  break;
 
--- a/src/input.cc	Fri Feb 16 07:23:49 2007 +0000
+++ b/src/input.cc	Fri Feb 16 08:10:54 2007 +0000
@@ -211,11 +211,13 @@
 }
 
 static inline std::string
-interactive_input (const std::string& s, bool force_readline = false)
+interactive_input (const std::string& s, bool debug = false,
+		   bool force_readline = false)
 {
   Vlast_prompt_time.stamp ();
 
-  if (Vdrawnow_requested && (interactive || forced_interactive))
+  if (! debug
+      && (Vdrawnow_requested && (interactive || forced_interactive)))
     {
       feval ("drawnow");
 
@@ -629,7 +631,7 @@
 
   octave_diary << prompt;
 
-  std::string input_buf = interactive_input (prompt.c_str (), true);
+  std::string input_buf = interactive_input (prompt.c_str (), debug, true);
 
   if (! input_buf.empty ())
     {