changeset 23517:1bc8f1f50b54

new function for accessing interpreter * interpreter-private.h, interpreter-private.cc (__get_interpreter__): New function. (__get_load_path__): Use it.
author John W. Eaton <jwe@octave.org>
date Fri, 19 May 2017 15:53:32 -0400
parents ed2239ed5fd3
children 8744d4ed8fb4
files libinterp/corefcn/interpreter-private.cc libinterp/corefcn/interpreter-private.h
diffstat 2 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/interpreter-private.cc	Mon May 22 13:42:22 2017 -0700
+++ b/libinterp/corefcn/interpreter-private.cc	Fri May 19 15:53:32 2017 -0400
@@ -33,13 +33,20 @@
 
 namespace octave
 {
-  load_path& __get_load_path__ (const std::string& who)
+  interpreter& __get_interpreter__ (const std::string& who)
   {
     interpreter *interp = interpreter::the_interpreter ();
 
     if (! interp)
       error ("%s: interpreter context missing", who.c_str ());
 
-    return interp->get_load_path ();
+    return *interp;
+  }
+
+  load_path& __get_load_path__ (const std::string& who)
+  {
+    interpreter& interp = __get_interpreter__ (who);
+
+    return interp.get_load_path ();
   }
 }
--- a/libinterp/corefcn/interpreter-private.h	Mon May 22 13:42:22 2017 -0700
+++ b/libinterp/corefcn/interpreter-private.h	Fri May 19 15:53:32 2017 -0400
@@ -29,8 +29,11 @@
 
 namespace octave
 {
+  class interpreter;
   class load_path;
 
+  extern interpreter& __get_interpreter__ (const std::string& who);
+
   extern load_path& __get_load_path__ (const std::string& who);
 }