changeset 27394:489c74ac36da

store reference to interpreter in load_path object * load-path.h, load-path.cc (load_path::m_interpreter): New data member. (load_path::load_path): Accept reference to load_path object as argument. * interpreter.cc (interpreter::interpreter): Pass *this to load_path constructor.
author John W. Eaton <jwe@octave.org>
date Wed, 11 Sep 2019 18:23:46 -0400
parents efe72866b483
children 4164895adf79
files libinterp/corefcn/interpreter.cc libinterp/corefcn/load-path.cc libinterp/corefcn/load-path.h
diffstat 3 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/interpreter.cc	Wed Sep 11 16:46:54 2019 -0400
+++ b/libinterp/corefcn/interpreter.cc	Wed Sep 11 18:23:46 2019 -0400
@@ -371,7 +371,7 @@
       m_output_system (*this),
       m_history_system (*this),
       m_dynamic_loader (*this),
-      m_load_path (),
+      m_load_path (*this),
       m_load_save_system (*this),
       m_type_info (),
       m_symbol_table (*this),
--- a/libinterp/corefcn/load-path.cc	Wed Sep 11 16:46:54 2019 -0400
+++ b/libinterp/corefcn/load-path.cc	Wed Sep 11 18:23:46 2019 -0400
@@ -193,9 +193,9 @@
   std::string load_path::sys_path;
   load_path::abs_dir_cache_type load_path::abs_dir_cache;
 
-  load_path::load_path (void)
-    : package_map (), top_level_package (), dir_info_list (), init_dirs (),
-      m_command_line_path (),
+  load_path::load_path (interpreter& interp)
+    : m_interpreter (interp), package_map (), top_level_package (),
+      dir_info_list (), init_dirs (), m_command_line_path (),
       add_hook ([this] (const std::string& dir) { this->execute_pkg_add (dir); }),
       remove_hook ([this] (const std::string& dir) { this->execute_pkg_del (dir); })
   { }
--- a/libinterp/corefcn/load-path.h	Wed Sep 11 16:46:54 2019 -0400
+++ b/libinterp/corefcn/load-path.h	Wed Sep 11 18:23:46 2019 -0400
@@ -45,7 +45,7 @@
   {
   public:
 
-    load_path (void);
+    load_path (interpreter& interp);
 
     typedef void (*hook_fcn_ptr) (const std::string& dir);
 
@@ -507,6 +507,8 @@
     typedef package_map_type::const_iterator const_package_map_iterator;
     typedef package_map_type::iterator package_map_iterator;
 
+    interpreter& m_interpreter;
+
     mutable package_map_type package_map;
 
     mutable package_info top_level_package;