-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 struct interp *interp_set_temp (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;
+};