new_interp->procs = procs;
new_interp->inited = 0;
- /* Check for required procs. */
- gdb_assert (procs->command_loop_proc != NULL);
-
return new_interp;
}
return NULL;
}
+/* See interps.h. */
+
+void
+set_top_level_interpreter (const char *name)
+{
+ /* Find it. */
+ struct interp *interp = interp_lookup (current_ui, name);
+
+ if (interp == NULL)
+ error (_("Interpreter `%s' unrecognized"), name);
+ /* Install it. */
+ if (!interp_set (interp, 1))
+ error (_("Interpreter `%s' failed to initialize."), name);
+}
+
/* Returns the current interpreter. */
struct ui_out *
return ui_interp->current_interpreter;
}
-/* Run the current command interpreter's main loop. */
+/* See interps.h. */
+
void
-current_interp_command_loop (void)
+interp_pre_command_loop (struct interp *interp)
{
- struct ui_interp_info *ui_interp = get_current_interp_info ();
- struct interp *interp = ui_interp->current_interpreter;
+ gdb_assert (interp != NULL);
- gdb_assert (ui_interp->current_interpreter != NULL);
+ if (interp->procs->pre_command_loop_proc != NULL)
+ interp->procs->pre_command_loop_proc (interp);
+}
+
+/* See interp.h */
- interp->procs->command_loop_proc (interp->data);
+int
+interp_supports_command_editing (struct interp *interp)
+{
+ if (interp->procs->supports_command_editing_proc != NULL)
+ return interp->procs->supports_command_editing_proc (interp);
+ return 0;
}
int
do_cleanups (cleanup);
}
-/* List the possible interpreters which could complete the given text. */
-static VEC (char_ptr) *
+/* See interps.h. */
+
+VEC (char_ptr) *
interpreter_completer (struct cmd_list_element *ignore,
const char *text, const char *word)
{
return interp->data;
}
+/* See interps.h. */
+
+struct interp *
+current_interpreter (void)
+{
+ struct ui_interp_info *ui_interp = get_interp_info (current_ui);
+
+ return ui_interp->current_interpreter;
+}
+
/* This just adds the "interpreter-exec" command. */
void
_initialize_interpreter (void)