forked from Imagelibrary/binutils-gdb
Display the ">" prompt in interactive mode while reading canned
commands, even when the current interpreter is MI. interps.c (interp_set_temp): New function. interps.h (interp_set_temp): Add prototype. cli/cli-script.c (restore_interp): New cleanup function. (read_command_lines): Temporarily override the current interpreter with CLI and arrange for restoring the original one.
This commit is contained in:
@@ -1,3 +1,16 @@
|
|||||||
|
2012-05-08 Eli Zaretskii <eliz@gnu.org>
|
||||||
|
|
||||||
|
Display the ">" prompt in interactive mode while reading canned
|
||||||
|
commands, even when the current interpreter is MI.
|
||||||
|
|
||||||
|
* interps.c (interp_set_temp): New function.
|
||||||
|
|
||||||
|
* interps.h (interp_set_temp): Add prototype.
|
||||||
|
|
||||||
|
* cli/cli-script.c (restore_interp): New cleanup function.
|
||||||
|
(read_command_lines): Temporarily override the current interpreter
|
||||||
|
with CLI and arrange for restoring the original one.
|
||||||
|
|
||||||
2012-05-12 Joel Sherrill <joel.sherrill@oarcorp.com>
|
2012-05-12 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||||
|
|
||||||
* microblaze-rom.c (_initialize_picobug_rom): Add prototype.
|
* microblaze-rom.c (_initialize_picobug_rom): Add prototype.
|
||||||
|
|||||||
@@ -1178,6 +1178,12 @@ recurse_read_control_structure (char * (*read_next_line_func) (void),
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
restore_interp (void *arg)
|
||||||
|
{
|
||||||
|
interp_set_temp (interp_name ((struct interp *)arg));
|
||||||
|
}
|
||||||
|
|
||||||
/* Read lines from the input stream and accumulate them in a chain of
|
/* Read lines from the input stream and accumulate them in a chain of
|
||||||
struct command_line's, which is then returned. For input from a
|
struct command_line's, which is then returned. For input from a
|
||||||
terminal, the special command "end" is used to mark the end of the
|
terminal, the special command "end" is used to mark the end of the
|
||||||
@@ -1210,8 +1216,21 @@ read_command_lines (char *prompt_arg, int from_tty, int parse_commands,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
head = read_command_lines_1 (read_next_line, parse_commands,
|
|
||||||
validator, closure);
|
/* Reading commands assumes the CLI behavior, so temporarily
|
||||||
|
override the current interpreter with CLI. */
|
||||||
|
if (current_interp_named_p (INTERP_CONSOLE))
|
||||||
|
head = read_command_lines_1 (read_next_line, parse_commands,
|
||||||
|
validator, closure);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
struct interp *old_interp = interp_set_temp (INTERP_CONSOLE);
|
||||||
|
struct cleanup *old_chain = make_cleanup (restore_interp, old_interp);
|
||||||
|
|
||||||
|
head = read_command_lines_1 (read_next_line, parse_commands,
|
||||||
|
validator, closure);
|
||||||
|
do_cleanups (old_chain);
|
||||||
|
}
|
||||||
|
|
||||||
if (deprecated_readline_end_hook && from_tty && input_from_terminal_p ())
|
if (deprecated_readline_end_hook && from_tty && input_from_terminal_p ())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -253,6 +253,18 @@ interp_ui_out (struct interp *interp)
|
|||||||
return current_interpreter->procs->ui_out_proc (current_interpreter);
|
return current_interpreter->procs->ui_out_proc (current_interpreter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Temporarily overrides the current interpreter. */
|
||||||
|
struct interp *
|
||||||
|
interp_set_temp (const char *name)
|
||||||
|
{
|
||||||
|
struct interp *interp = interp_lookup (name);
|
||||||
|
struct interp *old_interp = current_interpreter;
|
||||||
|
|
||||||
|
if (interp)
|
||||||
|
current_interpreter = interp;
|
||||||
|
return old_interp;
|
||||||
|
}
|
||||||
|
|
||||||
/* Returns the interpreter's cookie. */
|
/* Returns the interpreter's cookie. */
|
||||||
|
|
||||||
void *
|
void *
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ extern struct interp *interp_lookup (const char *name);
|
|||||||
extern struct ui_out *interp_ui_out (struct interp *interp);
|
extern struct ui_out *interp_ui_out (struct interp *interp);
|
||||||
extern void *interp_data (struct interp *interp);
|
extern void *interp_data (struct interp *interp);
|
||||||
extern const char *interp_name (struct interp *interp);
|
extern const char *interp_name (struct interp *interp);
|
||||||
|
extern struct interp *interp_set_temp (const char *name);
|
||||||
|
|
||||||
extern int current_interp_named_p (const char *name);
|
extern int current_interp_named_p (const char *name);
|
||||||
extern int current_interp_display_prompt_p (void);
|
extern int current_interp_display_prompt_p (void);
|
||||||
|
|||||||
Reference in New Issue
Block a user