Make gdb.mi/user-selected-context-sync.exp use proc_with_prefix
[deliverable/binutils-gdb.git] / gdb / interps.c
index 6eed8f3c6c88eb2ebefa9ef10f62682ab05cecfb..163c83729672abadc73b4bb76634df98af81a174 100644 (file)
@@ -117,9 +117,6 @@ interp_new (const char *name, const struct interp_procs *procs, void *data)
   new_interp->procs = procs;
   new_interp->inited = 0;
 
-  /* Check for required procs.  */
-  gdb_assert (procs->command_loop_proc != NULL);
-
   return new_interp;
 }
 
@@ -322,6 +319,21 @@ interp_lookup (struct ui *ui, const char *name)
   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 *
@@ -411,16 +423,15 @@ command_interp (void)
     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 (ui_interp->current_interpreter != NULL);
+  gdb_assert (interp != NULL);
 
-  interp->procs->command_loop_proc (interp->data);
+  if (interp->procs->pre_command_loop_proc != NULL)
+    interp->procs->pre_command_loop_proc (interp);
 }
 
 /* See interp.h  */
@@ -554,8 +565,9 @@ interpreter_exec_cmd (char *args, int from_tty)
   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)
 {
@@ -613,6 +625,16 @@ top_level_interpreter_data (void)
   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)
This page took 0.025345 seconds and 4 git commands to generate.