diff libinterp/corefcn/interpreter.cc @ 27474:3fec8e9fa2aa

make recover_from_exception a member function * interpreter.h, interpreter.cc (interpreter::recover_from_exception): Now a member function. Change all uses.
author John W. Eaton <jwe@octave.org>
date Fri, 04 Oct 2019 16:40:30 -0400
parents fd32c1a9b1bd
children 63b417917f5e
line wrap: on
line diff
--- a/libinterp/corefcn/interpreter.cc	Fri Oct 04 13:51:47 2019 -0700
+++ b/libinterp/corefcn/interpreter.cc	Fri Oct 04 16:40:30 2019 -0400
@@ -177,8 +177,8 @@
 
 DEFALIAS (exit, quit);
 
-DEFUN (atexit, args, nargout,
-       doc: /* -*- texinfo -*-
+DEFMETHOD (atexit, interp, args, nargout,
+           doc: /* -*- texinfo -*-
 @deftypefn  {} {} atexit (@var{fcn})
 @deftypefnx {} {} atexit (@var{fcn}, @var{flag})
 Register a function to be called when Octave exits.
@@ -234,7 +234,7 @@
     octave::interpreter::add_atexit_function (arg);
   else
     {
-      bool found = octave::interpreter::remove_atexit_function (arg);
+      bool found = interp.remove_atexit_function (arg);
 
       if (nargout > 0)
         retval = ovl (found);
@@ -259,20 +259,20 @@
                                bool require_file = true,
                                const std::string& warn_for = "")
   {
+    interpreter& interp = __get_interpreter__ ("safe_source_file");
+
     try
       {
         source_file (file_name, context, verbose, require_file, warn_for);
       }
     catch (const interrupt_exception&)
       {
-        interpreter::recover_from_exception ();
+        interp.recover_from_exception ();
 
         return 1;
       }
     catch (const execution_exception& e)
       {
-        interpreter& interp = __get_interpreter__ ("safe_source_file");
-
         interp.handle_exception (e);
 
         return 1;
@@ -1748,7 +1748,7 @@
       }
     catch (const interrupt_exception&)
       {
-        interpreter::recover_from_exception ();
+        recover_from_exception ();
       }
     catch (const execution_exception& e)
       {