diff libinterp/corefcn/interpreter.cc @ 23738:8acd390d16c9

don't use singleton for stream_list object * oct-stream.h, oct-stream.cc (stream_list): Don't use singleton pattern. Change all uses. (stream_list::stream_list): Initialize stdin, stdout, and stderr streams here. (stream_list::~stream_list): Close files here. (stream_list::m_stdin_file, stream_list::m_stdout_file, stream_list::m_stderr_file): New data members. (stream_list::stdin_file, stream_list::stdout_file, stream_list::stderr_file): New functions. * interpreter.h, interpreter.cc (interpreter::m_stream_list): New data member. (interpreter::interpreter): Initialize it. Don't call initialize_file_io. (interpreter::~interpreter): Don't call close_files. (interpreter::get_stream_list): New function. * file-io.h, file-io.cc (stdin_file, stdout_file, stderr_file, stdin_stream, stdout_stream, stderr_stream): Delete static variables. (initialize_file_io, close_files): Delete. These actions are now handled by the stream_list constructor and destructor.
author John W. Eaton <jwe@octave.org>
date Thu, 06 Jul 2017 13:34:31 -0400
parents ab8831d346c1
children 1f0daaf81955
line wrap: on
line diff
--- a/libinterp/corefcn/interpreter.cc	Thu Jul 06 12:21:42 2017 -0400
+++ b/libinterp/corefcn/interpreter.cc	Thu Jul 06 13:34:31 2017 -0400
@@ -354,6 +354,7 @@
       m_load_path (),
       m_symbol_table (),
       m_evaluator (*this),
+      m_stream_list (*this),
       m_cdef_manager (*this),
       m_interactive (false),
       m_read_site_files (true),
@@ -409,8 +410,6 @@
     else
       quit_allowed = false;
 
-    initialize_file_io ();
-
     install_types ();
 
     install_ops ();
@@ -1137,8 +1136,6 @@
 
     OCTAVE_SAFE_CALL (gtk_manager::unload_all_toolkits, ());
 
-    OCTAVE_SAFE_CALL (close_files, ());
-
     OCTAVE_SAFE_CALL (cleanup_tmp_files, ());
 
     // FIXME:  May still need something like this to ensure that
@@ -1172,6 +1169,11 @@
     return m_evaluator;
   }
 
+  stream_list& interpreter::get_stream_list (void)
+  {
+    return m_stream_list;
+  }
+
   symbol_table::scope *
   interpreter::get_current_scope (void)
   {