-extern struct interp *interp_new (const char *name, const struct interp_procs *procs);
-extern void interp_add (struct interp *interp);
-extern int interp_set (struct interp *interp, int top_level);
-extern struct interp *interp_lookup (const char *name);
-extern struct ui_out *interp_ui_out (struct interp *interp);
-extern void *interp_data (struct interp *interp);
-extern const char *interp_name (struct interp *interp);
+extern void interp_add (struct ui *ui, struct interp *interp);
+
+/* Look up the interpreter for NAME, creating one if none exists yet.
+ If NAME is not a interpreter type previously registered with
+ interp_factory_register, return NULL; otherwise return a pointer to
+ the interpreter. */
+extern struct interp *interp_lookup (struct ui *ui, const char *name);
+
+/* Set the current UI's top level interpreter to the interpreter named
+ NAME. Throws an error if NAME is not a known interpreter or the
+ interpreter fails to initialize. */
+extern void set_top_level_interpreter (const char *name);
+
+/* Temporarily set the current interpreter, and reset it on
+ destruction. */
+class scoped_restore_interp
+{
+public:
+
+ scoped_restore_interp (const char *name)
+ : m_interp (set_interp (name))
+ {
+ }
+
+ ~scoped_restore_interp ()
+ {
+ set_interp (m_interp->name ());
+ }
+
+ scoped_restore_interp (const scoped_restore_interp &) = delete;
+ scoped_restore_interp &operator= (const scoped_restore_interp &) = delete;
+
+private:
+
+ struct interp *set_interp (const char *name);
+
+ struct interp *m_interp;
+};