octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GUD octave support


From: John W. Eaton
Subject: Re: GUD octave support
Date: Tue, 11 Dec 2007 15:34:44 -0500

On 11-Dec-2007, John W. Eaton wrote:

| OK, how about the following patch?  With this change, the command line
| could be
| 
|   octave --persist --eval "__gud_mode__ (true)"
| 
| I'm not sure I'm printing C-z correctly.  If not, then please fix and
| submit a patch.

Oops, this time with the patch.

jwe


src/ChangeLog:

2007-12-11  John W. Eaton  <address@hidden>

        * input.cc (Vgud_mode): New static variable.
        (F__gud_mode__): New function.
        (get_user_input): If debug and Vgud_mode, print location info in
        format for Emacs GUD mode.


Index: src/input.cc
===================================================================
RCS file: /cvs/octave/src/input.cc,v
retrieving revision 1.189
diff -u -u -r1.189 input.cc
--- src/input.cc        2 Nov 2007 17:24:24 -0000       1.189
+++ src/input.cc        11 Dec 2007 18:52:53 -0000
@@ -144,6 +144,9 @@
 // the next user prompt.
 static bool Vdrawnow_requested = false;
 
+// TRUE if we are running in the Emacs GUD mode.
+static bool Vgud_mode = false;
+
 static void
 do_input_echo (const std::string& input_string)
 {
@@ -617,16 +620,25 @@
 
   if (! nm.empty ())
     {
-      buf << "stopped in " << nm;
+      if (Vgud_mode)
+       {
+         static char ctrl_z = 'Z' & 0x1f;
+
+         buf << ctrl_z << ctrl_z << nm << ":" << line;
+       }
+      else
+       {
+         buf << "stopped in " << nm;
 
-      if (line > 0)
-       buf << " at line " << line;
+         if (line > 0)
+           buf << " at line " << line;
+       }
     }
 
   std::string msg = buf.str ();
 
   if (! msg.empty ())
-    message ("keyboard", msg.c_str ());
+    message (Vgud_mode ? 0 : "keyboard", msg.c_str ());
 
   std::string prompt = "debug> ";
 
@@ -1296,6 +1308,26 @@
   return retval;
 }
 
+DEFUN (__gud_mode__, args, ,
+  "-*- texinfo -*-\n\
address@hidden {Built-in Function} {} __gud_mode__ ()\n\
+Undocumented internal function.\n\
address@hidden deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+
+  if (nargin == 0)
+    retval = Vgud_mode;
+  else if (nargin == 1)
+    Vgud_mode = args(0).bool_value ();
+  else
+    print_usage ();
+
+  return retval;
+}
+
 /*
 ;;; Local Variables: ***
 ;;; mode: C++ ***

reply via email to

[Prev in Thread] Current Thread [Next in Thread]