# HG changeset patch # User Rik # Date 1631283643 25200 # Node ID c8d5ec1f5618ae55b70076cdd827b1c30a770489 # Parent 14b098a6ba46113fc206850c9ca403ae36641fb0 maint: use "m_" prefix for member variable "instance" in class interpreter. * interpreter.cc, interpreter.h: Use "m_" prefix for member variable "instance" in class interpreter. Order member functions before member variables in class. diff -r 14b098a6ba46 -r c8d5ec1f5618 libinterp/corefcn/interpreter.cc --- a/libinterp/corefcn/interpreter.cc Fri Sep 10 07:02:04 2021 -0700 +++ b/libinterp/corefcn/interpreter.cc Fri Sep 10 07:20:43 2021 -0700 @@ -489,11 +489,11 @@ // // only one Octave interpreter may be active in any given thread - if (instance) + if (m_instance) throw std::runtime_error ("only one Octave interpreter may be active"); - instance = this; + m_instance = this; // Matlab uses "C" locale for LC_NUMERIC class regardless of local setting setlocale (LC_ALL, ""); @@ -644,7 +644,7 @@ octave_interpreter_ready = true; } - OCTAVE_THREAD_LOCAL interpreter *interpreter::instance = nullptr; + OCTAVE_THREAD_LOCAL interpreter *interpreter::m_instance = nullptr; interpreter::~interpreter (void) { diff -r 14b098a6ba46 -r c8d5ec1f5618 libinterp/corefcn/interpreter.h --- a/libinterp/corefcn/interpreter.h Fri Sep 10 07:02:04 2021 -0700 +++ b/libinterp/corefcn/interpreter.h Fri Sep 10 07:20:43 2021 -0700 @@ -562,20 +562,10 @@ } #endif - static interpreter * the_interpreter (void) { return instance; } + static interpreter * the_interpreter (void) { return m_instance; } private: - // The interpreter instance; Currently it is only possible to - // have one, so OCTAVE_THREAD_LOCAL will normally be defined to be - // empty. Eventually we would like to allow multiple interpreters - // to be active at once, but they will still be limited to one per - // thread. When that is possible, OCTAVE_THREAD_LOCAL can be - // replaced by the C++ thread_local keyword. For now, use a macro - // to allow experimenting with thread_local storage. - - OCTAVE_THREAD_LOCAL static interpreter *instance; - void display_startup_message (void) const; int execute_startup_files (void); @@ -590,6 +580,22 @@ void execute_atexit_fcns (void); + void maximum_braindamage (void); + + void execute_pkg_add (const std::string& dir); + + //-------- + + // The interpreter instance; Currently it is only possible to + // have one, so OCTAVE_THREAD_LOCAL will normally be defined to be + // empty. Eventually we would like to allow multiple interpreters + // to be active at once, but they will still be limited to one per + // thread. When that is possible, OCTAVE_THREAD_LOCAL can be + // replaced by the C++ thread_local keyword. For now, use a macro + // to allow experimenting with thread_local storage. + + OCTAVE_THREAD_LOCAL static interpreter *m_instance; + application *m_app_context; temporary_file_list m_tmp_files; @@ -664,10 +670,6 @@ bool m_executing_atexit; bool m_initialized; - - void maximum_braindamage (void); - - void execute_pkg_add (const std::string& dir); }; OCTAVE_NAMESPACE_END