aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbtk.c
diff options
context:
space:
mode:
authorFred Fish <fnf@specifix.com>1996-05-20 02:05:55 +0000
committerFred Fish <fnf@specifix.com>1996-05-20 02:05:55 +0000
commit41756e56ee00510ee7044119d0b033ea536dae5b (patch)
treea13dd46e358db51665d1904037254fc685ea66f1 /gdb/gdbtk.c
parent4242ac27a53b03d4cdd4f1da1887ee92fd39befa (diff)
downloadgdb-41756e56ee00510ee7044119d0b033ea536dae5b.zip
gdb-41756e56ee00510ee7044119d0b033ea536dae5b.tar.gz
gdb-41756e56ee00510ee7044119d0b033ea536dae5b.tar.bz2
* defs.h (read_command_lines, query_hook): Update prototypes.
(readline_begin_hook, readline_hook, readline_end_hook): Declare. * breakpoint.c (commands_command): Build message in temporary buffer and pass that, as well as tty control flag, to read_command_lines. * top.c (readline_begin_hook, readline_hook, readline_end_hook): Define here. (command_loop): Check for non-NULL instream before looping. (command_line_input): Use readline_hook when appropriate, to get user input from a GUI window. (read_next_line): Also build prompt if getting user input from a GUI. (recurse_read_control_structure): Fix typo in comment. (read_command_lines): Use passed in prompt and tty flag to decide how to build message. Use readline_begin_hook when appropriate, to set up a GUI interaction window. Just return head, whether NULL or not, after using readline_end_hook to complete GUI interaction. (define_command, document_command): Build message in a temporary buffer and pass it to read_command_lines, along with tty flag. * gdbtk.c (gdbtk_readline_begin, gdbtk_readline, gdbtk_readline_end): New functions. (tk_command_loop): Set instream to NULL to enable Tk user interaction. (gdbtk_init): Set readline_begin_hook, readline_hook, and readline_end_hook. * gdbtk.tcl (gdbtk_tcl_readline_begin, gdbtk_tcl_readline, gdbtk_tcl_readline_end): New functions. (tclsh): Pack scroll bar on right side of window, not left. PR 9385
Diffstat (limited to 'gdb/gdbtk.c')
-rw-r--r--gdb/gdbtk.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/gdb/gdbtk.c b/gdb/gdbtk.c
index 6234e4a..2e24448 100644
--- a/gdb/gdbtk.c
+++ b/gdb/gdbtk.c
@@ -183,6 +183,64 @@ gdbtk_query (query, args)
val = atol (interp->result);
return val;
}
+
+/* VARARGS */
+static void
+#ifdef ANSI_PROTOTYPES
+gdbtk_readline_begin (char *format, ...)
+#else
+gdbtk_readline_begin (va_alist)
+ va_dcl
+#endif
+{
+ va_list args;
+ char buf[200], *merge[2];
+ char *command;
+
+#ifdef ANSI_PROTOTYPES
+ va_start (args, format);
+#else
+ char *format;
+ va_start (args);
+ format = va_arg (args, char *);
+#endif
+
+ vsprintf (buf, format, args);
+ merge[0] = "gdbtk_tcl_readline_begin";
+ merge[1] = buf;
+ command = Tcl_Merge (2, merge);
+ Tcl_Eval (interp, command);
+ free (command);
+}
+
+static char *
+gdbtk_readline (prompt)
+ char *prompt;
+{
+ char *merge[2];
+ char *command;
+
+ merge[0] = "gdbtk_tcl_readline";
+ merge[1] = prompt;
+ command = Tcl_Merge (2, merge);
+ if (Tcl_Eval (interp, command) == TCL_OK)
+ {
+ return (strdup (interp -> result));
+ }
+ else
+ {
+ gdbtk_fputs (interp -> result, gdb_stdout);
+ gdbtk_fputs ("\n", gdb_stdout);
+ return (NULL);
+ }
+}
+
+static void
+gdbtk_readline_end ()
+{
+ Tcl_Eval (interp, "gdbtk_tcl_readline_end");
+}
+
static void
#ifdef ANSI_PROTOTYPES
@@ -1117,6 +1175,10 @@ gdbtk_call_command (cmdblk, arg, from_tty)
static void
tk_command_loop ()
{
+ extern GDB_FILE *instream;
+
+ /* We no longer want to use stdin as the command input stream */
+ instream = NULL;
Tcl_Eval (interp, "gdbtk_tcl_preloop");
Tk_MainLoop ();
}
@@ -1180,6 +1242,9 @@ gdbtk_init ()
interactive_hook = gdbtk_interactive;
target_wait_hook = gdbtk_wait;
call_command_hook = gdbtk_call_command;
+ readline_begin_hook = gdbtk_readline_begin;
+ readline_hook = gdbtk_readline;
+ readline_end_hook = gdbtk_readline_end;
/* Get the file descriptor for the X server */