Mercurial > octave
changeset 27379:3db033e86376
use m_ prefix for data members in most liboctave/util classes
Files affected: cmd-edit.cc, cmd-edit.h, cmd-hist.cc, cmd-hist.h,
glob-match.cc, glob-match.h, kpse.cc, kpse.h, lo-array-errwarn.cc,
lo-array-errwarn.h, lo-regexp.cc, lo-regexp.h, oct-inttypes.h,
oct-mutex.cc, oct-mutex.h, oct-shlib.cc, oct-shlib.h, oct-sort.cc,
oct-sort.h, octave-preserve-stream-state.h, singleton-cleanup.cc, and
singleton-cleanup.h.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 09 Sep 2019 16:15:40 -0400 |
parents | 6d0585c8ee11 |
children | 72e8f15b5527 |
files | liboctave/util/cmd-edit.cc liboctave/util/cmd-edit.h liboctave/util/cmd-hist.cc liboctave/util/cmd-hist.h liboctave/util/glob-match.cc liboctave/util/glob-match.h liboctave/util/kpse.cc liboctave/util/kpse.h liboctave/util/lo-array-errwarn.cc liboctave/util/lo-array-errwarn.h liboctave/util/lo-regexp.cc liboctave/util/lo-regexp.h liboctave/util/oct-inttypes.h liboctave/util/oct-mutex.cc liboctave/util/oct-mutex.h liboctave/util/oct-shlib.cc liboctave/util/oct-shlib.h liboctave/util/oct-sort.cc liboctave/util/oct-sort.h liboctave/util/octave-preserve-stream-state.h liboctave/util/singleton-cleanup.cc liboctave/util/singleton-cleanup.h |
diffstat | 22 files changed, 713 insertions(+), 710 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/util/cmd-edit.cc Sat Sep 07 10:49:03 2019 -0400 +++ b/liboctave/util/cmd-edit.cc Mon Sep 09 16:15:40 2019 -0400 @@ -53,7 +53,7 @@ { char * do_completer_word_break_hook (); - command_editor *command_editor::instance = nullptr; + command_editor *command_editor::s_instance = nullptr; std::set<command_editor::startup_hook_fcn> command_editor::startup_hook_set; @@ -1061,19 +1061,19 @@ { bool retval = true; - if (! instance) + if (! s_instance) { make_command_editor (); - if (instance) + if (s_instance) { - instance->set_event_hook (event_handler); + s_instance->set_event_hook (event_handler); singleton_cleanup_list::add (cleanup_instance); } } - if (! instance) + if (! s_instance) (*current_liboctave_error_handler) ("unable to create command history object!"); @@ -1084,30 +1084,30 @@ command_editor::make_command_editor (void) { #if defined (USE_READLINE) - instance = new gnu_readline (); + s_instance = new gnu_readline (); #else - instance = new default_command_editor (); + s_instance = new default_command_editor (); #endif } void command_editor::force_default_editor (void) { - delete instance; - instance = new default_command_editor (); + delete s_instance; + s_instance = new default_command_editor (); } void command_editor::set_initial_input (const std::string& text) { if (instance_ok ()) - instance->initial_input = text; + s_instance->m_initial_input = text; } int command_editor::insert_initial_input (void) { - return instance_ok () ? instance->do_insert_initial_input () : 0; + return instance_ok () ? s_instance->do_insert_initial_input () : 0; } int @@ -1169,7 +1169,7 @@ command_editor::set_name (const std::string& n) { if (instance_ok ()) - instance->do_set_name (n); + s_instance->do_set_name (n); } std::string @@ -1187,10 +1187,10 @@ if (instance_ok ()) { - if (! instance->initial_input.empty ()) + if (! s_instance->m_initial_input.empty ()) add_pre_input_hook (command_editor::insert_initial_input); - retval = instance->do_readline (prompt, eof); + retval = s_instance->do_readline (prompt, eof); } return retval; @@ -1200,249 +1200,241 @@ command_editor::set_input_stream (FILE *f) { if (instance_ok ()) - instance->do_set_input_stream (f); + s_instance->do_set_input_stream (f); } FILE * command_editor::get_input_stream (void) { - return (instance_ok ()) - ? instance->do_get_input_stream () : nullptr; + return instance_ok () ? s_instance->do_get_input_stream () : nullptr; } void command_editor::set_output_stream (FILE *f) { if (instance_ok ()) - instance->do_set_output_stream (f); + s_instance->do_set_output_stream (f); } FILE * command_editor::get_output_stream (void) { - return (instance_ok ()) - ? instance->do_get_output_stream () : nullptr; + return instance_ok () ? s_instance->do_get_output_stream () : nullptr; } void command_editor::redisplay (void) { if (instance_ok ()) - instance->do_redisplay (); + s_instance->do_redisplay (); } int command_editor::terminal_rows (void) { - return (instance_ok ()) - ? instance->do_terminal_rows () : -1; + return instance_ok () ? s_instance->do_terminal_rows () : -1; } int command_editor::terminal_cols (void) { - return (instance_ok ()) - ? instance->do_terminal_cols () : -1; + return instance_ok () ? s_instance->do_terminal_cols () : -1; } void command_editor::clear_screen (bool skip_redisplay) { if (instance_ok ()) - instance->do_clear_screen (skip_redisplay); + s_instance->do_clear_screen (skip_redisplay); } void command_editor::resize_terminal (void) { if (instance_ok ()) - instance->do_resize_terminal (); + s_instance->do_resize_terminal (); } void command_editor::set_screen_size (int ht, int wd) { if (instance_ok ()) - instance->do_set_screen_size (ht, wd); + s_instance->do_set_screen_size (ht, wd); } std::string command_editor::decode_prompt_string (const std::string& s) { - return (instance_ok ()) - ? instance->do_decode_prompt_string (s) : ""; + return instance_ok () ? s_instance->do_decode_prompt_string (s) : ""; } int command_editor::current_command_number (void) { - return (instance_ok ()) - ? instance->command_number : 0; + return instance_ok () ? s_instance->m_command_number : 0; } void command_editor::reset_current_command_number (int n) { if (instance_ok ()) - instance->command_number = n; + s_instance->m_command_number = n; } void command_editor::increment_current_command_number (void) { if (instance_ok ()) - instance->command_number++; + s_instance->m_command_number++; } void command_editor::restore_terminal_state (void) { if (instance_ok ()) - instance->do_restore_terminal_state (); + s_instance->do_restore_terminal_state (); } void command_editor::blink_matching_paren (bool flag) { if (instance_ok ()) - instance->do_blink_matching_paren (flag); + s_instance->do_blink_matching_paren (flag); } bool command_editor::erase_empty_line (bool flag) { - return instance_ok () ? instance->do_erase_empty_line (flag) : false; + return instance_ok () ? s_instance->do_erase_empty_line (flag) : false; } void command_editor::set_basic_word_break_characters (const std::string& s) { if (instance_ok ()) - instance->do_set_basic_word_break_characters (s); + s_instance->do_set_basic_word_break_characters (s); } void command_editor::set_completer_word_break_characters (const std::string& s) { if (instance_ok ()) - instance->do_set_completer_word_break_characters (s); + s_instance->do_set_completer_word_break_characters (s); } void command_editor::set_basic_quote_characters (const std::string& s) { if (instance_ok ()) - instance->do_set_basic_quote_characters (s); + s_instance->do_set_basic_quote_characters (s); } void command_editor::set_filename_quote_characters (const std::string& s) { if (instance_ok ()) - instance->do_set_filename_quote_characters (s); + s_instance->do_set_filename_quote_characters (s); } void command_editor::set_completer_quote_characters (const std::string& s) { if (instance_ok ()) - instance->do_set_completer_quote_characters (s); + s_instance->do_set_completer_quote_characters (s); } void command_editor::set_completion_append_character (char c) { if (instance_ok ()) - instance->do_set_completion_append_character (c); + s_instance->do_set_completion_append_character (c); } void command_editor::set_completion_function (completion_fcn f) { if (instance_ok ()) - instance->do_set_completion_function (f); + s_instance->do_set_completion_function (f); } void command_editor::set_quoting_function (quoting_fcn f) { if (instance_ok ()) - instance->do_set_quoting_function (f); + s_instance->do_set_quoting_function (f); } void command_editor::set_dequoting_function (dequoting_fcn f) { if (instance_ok ()) - instance->do_set_dequoting_function (f); + s_instance->do_set_dequoting_function (f); } void command_editor::set_char_is_quoted_function (char_is_quoted_fcn f) { if (instance_ok ()) - instance->do_set_char_is_quoted_function (f); + s_instance->do_set_char_is_quoted_function (f); } void command_editor::set_user_accept_line_function (user_accept_line_fcn f) { if (instance_ok ()) - instance->do_set_user_accept_line_function (f); + s_instance->do_set_user_accept_line_function (f); } command_editor::completion_fcn command_editor::get_completion_function (void) { - return (instance_ok ()) - ? instance->do_get_completion_function () : nullptr; + return instance_ok () ? s_instance->do_get_completion_function () : nullptr; } command_editor::quoting_fcn command_editor::get_quoting_function (void) { - return (instance_ok ()) - ? instance->do_get_quoting_function () : nullptr; + return instance_ok () ? s_instance->do_get_quoting_function () : nullptr; } command_editor::dequoting_fcn command_editor::get_dequoting_function (void) { - return (instance_ok ()) - ? instance->do_get_dequoting_function () : nullptr; + return instance_ok () ? s_instance->do_get_dequoting_function () : nullptr; } command_editor::char_is_quoted_fcn command_editor::get_char_is_quoted_function (void) { - return (instance_ok ()) - ? instance->do_get_char_is_quoted_function () : nullptr; + return (instance_ok () + ? s_instance->do_get_char_is_quoted_function () : nullptr); } command_editor::user_accept_line_fcn command_editor::get_user_accept_line_function (void) { - return (instance_ok ()) - ? instance->do_get_user_accept_line_function () : nullptr; + return (instance_ok () + ? s_instance->do_get_user_accept_line_function () : nullptr); } string_vector command_editor::generate_filename_completions (const std::string& text) { - return (instance_ok ()) - ? instance->do_generate_filename_completions (text) : string_vector (); + return (instance_ok () + ? s_instance->do_generate_filename_completions (text) + : string_vector ()); } std::string command_editor::get_line_buffer (void) { - return (instance_ok ()) ? instance->do_get_line_buffer () : ""; + return instance_ok () ? s_instance->do_get_line_buffer () : ""; } std::string command_editor::get_current_line (void) { - return (instance_ok ()) ? instance->do_get_current_line () : ""; + return instance_ok () ? s_instance->do_get_current_line () : ""; } // Return the character (offset+1) to the left of the cursor, @@ -1450,55 +1442,55 @@ char command_editor::get_prev_char (int offset) { - return (instance_ok ()) ? instance->do_get_prev_char (offset) : '\0'; + return instance_ok () ? s_instance->do_get_prev_char (offset) : '\0'; } void command_editor::replace_line (const std::string& text, bool clear_undo) { if (instance_ok ()) - instance->do_replace_line (text, clear_undo); + s_instance->do_replace_line (text, clear_undo); } void command_editor::kill_full_line (void) { if (instance_ok ()) - instance->do_kill_full_line (); + s_instance->do_kill_full_line (); } void command_editor::insert_text (const std::string& text) { if (instance_ok ()) - instance->do_insert_text (text); + s_instance->do_insert_text (text); } void command_editor::newline (void) { if (instance_ok ()) - instance->do_newline (); + s_instance->do_newline (); } void command_editor::accept_line (void) { if (instance_ok ()) - instance->do_accept_line (); + s_instance->do_accept_line (); } bool command_editor::undo (void) { - return instance_ok () ? instance->do_undo () : false; + return instance_ok () ? s_instance->do_undo () : false; } void command_editor::clear_undo_list (void) { if (instance_ok ()) - instance->do_clear_undo_list (); + s_instance->do_clear_undo_list (); } void @@ -1508,7 +1500,7 @@ { startup_hook_set.insert (f); - instance->set_startup_hook (startup_handler); + s_instance->set_startup_hook (startup_handler); } } @@ -1523,7 +1515,7 @@ startup_hook_set.erase (p); if (startup_hook_set.empty ()) - instance->restore_startup_hook (); + s_instance->restore_startup_hook (); } } @@ -1534,7 +1526,7 @@ { pre_input_hook_set.insert (f); - instance->set_pre_input_hook (pre_input_handler); + s_instance->set_pre_input_hook (pre_input_handler); } } @@ -1549,7 +1541,7 @@ pre_input_hook_set.erase (p); if (pre_input_hook_set.empty ()) - instance->restore_pre_input_hook (); + s_instance->restore_pre_input_hook (); } } @@ -1586,7 +1578,7 @@ { std::string file = sys::file_ops::tilde_expand (file_arg); - instance->do_read_init_file (file); + s_instance->do_read_init_file (file); } } @@ -1594,28 +1586,27 @@ command_editor::re_read_init_file (void) { if (instance_ok ()) - instance->do_re_read_init_file (); + s_instance->do_re_read_init_file (); } bool command_editor::filename_completion_desired (bool arg) { - return (instance_ok ()) - ? instance->do_filename_completion_desired (arg) : false; + return (instance_ok () + ? s_instance->do_filename_completion_desired (arg) : false); } bool command_editor::filename_quoting_desired (bool arg) { return (instance_ok ()) - ? instance->do_filename_quoting_desired (arg) : false; + ? s_instance->do_filename_quoting_desired (arg) : false; } bool command_editor::prefer_env_winsize (bool arg) { - return (instance_ok ()) - ? instance->do_prefer_env_winsize (arg) : false; + return instance_ok () ? s_instance->do_prefer_env_winsize (arg) : false; } bool @@ -1626,11 +1617,11 @@ if (instance_ok ()) { // Return the current interrupt state. - retval = instance->interrupted; + retval = s_instance->m_interrupted; - instance->do_interrupt (arg); + s_instance->do_interrupt (arg); - instance->interrupted = arg; + s_instance->m_interrupted = arg; } else retval = false; @@ -1642,20 +1633,20 @@ command_editor::interrupt_event_loop (bool arg) { if (instance_ok ()) - instance->do_interrupt_event_loop (arg); + s_instance->do_interrupt_event_loop (arg); } bool command_editor::event_loop_interrupted (void) { - return instance_ok () ? instance->do_event_loop_interrupted () : false; + return instance_ok () ? s_instance->do_event_loop_interrupted () : false; } void command_editor::handle_interrupt_signal (void) { if (instance_ok ()) - instance->do_handle_interrupt_signal (); + s_instance->do_handle_interrupt_signal (); } // Return a string which will be printed as a prompt. The string may @@ -1859,7 +1850,7 @@ case '#': { char number_buffer[32]; - sprintf (number_buffer, "%d", command_number); + sprintf (number_buffer, "%d", m_command_number); tmpstr = number_buffer; break; @@ -1914,9 +1905,9 @@ int command_editor::do_insert_initial_input (void) { - std::string input = initial_input; + std::string input = m_initial_input; - initial_input = ""; + m_initial_input = ""; do_insert_text (input);
--- a/liboctave/util/cmd-edit.h Sat Sep 07 10:49:03 2019 -0400 +++ b/liboctave/util/cmd-edit.h Mon Sep 09 16:15:40 2019 -0400 @@ -41,8 +41,8 @@ protected: command_editor (void) - : command_number (0), m_rows (24), m_cols (80), interrupted (false), - m_interrupt_event_loop (false), initial_input () + : m_command_number (0), m_rows (24), m_cols (80), m_interrupted (false), + m_interrupt_event_loop (false), m_initial_input () { } public: @@ -222,9 +222,13 @@ static std::set<event_hook_fcn> event_hook_set; // The real thing. - static command_editor *instance; + static command_editor *s_instance; - static void cleanup_instance (void) { delete instance; instance = nullptr; } + static void cleanup_instance (void) + { + delete s_instance; + s_instance = nullptr; + } static void handle_interrupt_signal (void); @@ -380,16 +384,16 @@ void error (const std::string&); // The current command number. - int command_number; + int m_command_number; int m_rows; int m_cols; - bool interrupted; + bool m_interrupted; bool m_interrupt_event_loop; - std::string initial_input; + std::string m_initial_input; }; }
--- a/liboctave/util/cmd-hist.cc Sat Sep 07 10:49:03 2019 -0400 +++ b/liboctave/util/cmd-hist.cc Mon Sep 09 16:15:40 2019 -0400 @@ -47,7 +47,7 @@ namespace octave { - command_history *command_history::instance = nullptr; + command_history *command_history::s_instance = nullptr; #if defined (USE_READLINE) @@ -117,7 +117,7 @@ void gnu_history::do_process_histcontrol (const std::string& control_arg) { - history_control = 0; + m_history_control = 0; size_t len = control_arg.length (); size_t beg = 0; @@ -136,13 +136,13 @@ std::string tmp = control_arg.substr (beg, end-beg); if (tmp == "erasedups") - history_control |= HC_ERASEDUPS; + m_history_control |= HC_ERASEDUPS; else if (tmp == "ignoreboth") - history_control |= (HC_IGNDUPS | HC_IGNSPACE); + m_history_control |= (HC_IGNDUPS | HC_IGNSPACE); else if (tmp == "ignoredups") - history_control |= HC_IGNDUPS; + m_history_control |= HC_IGNDUPS; else if (tmp == "ignorespace") - history_control |= HC_IGNSPACE; + m_history_control |= HC_IGNSPACE; else (*current_liboctave_warning_with_id_handler) ("Octave:history-control", @@ -162,10 +162,10 @@ std::string retval; - if (history_control & HC_IGNSPACE) + if (m_history_control & HC_IGNSPACE) retval.append ("ignorespace"); - if (history_control & HC_IGNDUPS) + if (m_history_control & HC_IGNDUPS) { if (retval.length () > 0) retval += ':'; @@ -173,7 +173,7 @@ retval.append ("ignoredups"); } - if (history_control & HC_ERASEDUPS) + if (m_history_control & HC_ERASEDUPS) { if (retval.length () > 0) retval += ':'; @@ -198,9 +198,9 @@ if (stmp.back () == '\n') stmp.pop_back (); - int added = ::octave_add_history (stmp.c_str (), history_control); - lines_this_session += added; - return (added > 0) ? true : false; + int added = ::octave_add_history (stmp.c_str (), m_history_control); + m_lines_this_session += added; + return added > 0 ? true : false; } return false; } @@ -244,7 +244,7 @@ int gnu_history::do_current_number (void) const { - return (xsize > 0) ? do_base () + do_where () : -1; + return m_size > 0 ? do_base () + do_where () : -1; } void @@ -309,7 +309,7 @@ } else { - lines_in_file = do_where (); + m_lines_in_file = do_where (); ::octave_using_history (); } @@ -323,7 +323,7 @@ bool must_exist) { if (from < 0) - from = lines_in_file; + from = m_lines_in_file; if (! f.empty ()) { @@ -339,7 +339,7 @@ } else { - lines_in_file = do_where (); + m_lines_in_file = do_where (); ::octave_using_history (); } @@ -351,12 +351,12 @@ void gnu_history::do_write (const std::string& f_arg) const { - if (initialized) + if (m_initialized) { std::string f = f_arg; if (f.empty ()) - f = xfile; + f = m_file; if (! f.empty ()) { @@ -377,18 +377,18 @@ void gnu_history::do_append (const std::string& f_arg) { - if (initialized) + if (m_initialized) { - if (lines_this_session) + if (m_lines_this_session) { - if (lines_this_session < do_where ()) + if (m_lines_this_session < do_where ()) { // Create file if it doesn't already exist. std::string f = f_arg; if (f.empty ()) - f = xfile; + f = m_file; if (! f.empty ()) { @@ -401,7 +401,7 @@ } int status - = ::octave_append_history (lines_this_session, f.c_str ()); + = ::octave_append_history (m_lines_this_session, f.c_str ()); if (status != 0) { @@ -410,9 +410,9 @@ error (status, msg); } else - lines_in_file += lines_this_session; + m_lines_in_file += m_lines_this_session; - lines_this_session = 0; + m_lines_this_session = 0; } else error ("gnu_history::append: missing filename"); @@ -424,12 +424,12 @@ void gnu_history::do_truncate_file (const std::string& f_arg, int n) const { - if (initialized) + if (m_initialized) { std::string f = f_arg; if (f.empty ()) - f = xfile; + f = m_file; if (! f.empty ()) ::octave_history_truncate_file (f.c_str (), n); @@ -471,17 +471,17 @@ void gnu_history::do_clean_up_and_save (const std::string& f_arg, int n) { - if (initialized) + if (m_initialized) { std::string f = f_arg; if (f.empty ()) - f = xfile; + f = m_file; if (! f.empty ()) { if (n < 0) - n = xsize; + n = m_size; stifle (n); @@ -499,15 +499,15 @@ { bool retval = true; - if (! instance) + if (! s_instance) { make_command_history (); - if (instance) + if (s_instance) singleton_cleanup_list::add (cleanup_instance); } - if (! instance) + if (! s_instance) (*current_liboctave_error_handler) ("unable to create command history object!"); @@ -518,9 +518,9 @@ command_history::make_command_history (void) { #if defined (USE_READLINE) - instance = new gnu_history (); + s_instance = new gnu_history (); #else - instance = new command_history (); + s_instance = new command_history (); #endif } @@ -530,7 +530,7 @@ const std::string & control_arg) { if (instance_ok ()) - instance->do_initialize (read_history_file, f_arg, sz, control_arg); + s_instance->do_initialize (read_history_file, f_arg, sz, control_arg); } bool @@ -538,7 +538,7 @@ { // We just want to check the status of an existing instance, not // create one. - return instance && instance->do_is_initialized (); + return s_instance && s_instance->do_is_initialized (); } void @@ -548,64 +548,60 @@ { std::string f = sys::file_ops::tilde_expand (f_arg); - instance->do_set_file (f); + s_instance->do_set_file (f); } } std::string command_history::file (void) { - return (instance_ok ()) - ? instance->do_file () : ""; + return instance_ok () ? s_instance->do_file () : ""; } void command_history::process_histcontrol (const std::string& control_arg) { if (instance_ok ()) - instance->do_process_histcontrol (control_arg); + s_instance->do_process_histcontrol (control_arg); } std::string command_history::histcontrol (void) { - return (instance_ok ()) - ? instance->do_histcontrol () : ""; + return instance_ok () ? s_instance->do_histcontrol () : ""; } void command_history::set_size (int n) { if (instance_ok ()) - instance->do_set_size (n); + s_instance->do_set_size (n); } int command_history::size (void) { - return (instance_ok ()) - ? instance->do_size () : 0; + return instance_ok () ? s_instance->do_size () : 0; } void command_history::ignore_entries (bool flag) { if (instance_ok ()) - instance->do_ignore_entries (flag); + s_instance->do_ignore_entries (flag); } bool command_history::ignoring_entries (void) { - return (instance_ok ()) - ? instance->do_ignoring_entries () : false; + return instance_ok () ? s_instance->do_ignoring_entries () : false; } bool command_history::add (const std::string& s) { if (instance_ok ()) - return instance->do_add (s); + return s_instance->do_add (s); return false; } @@ -613,84 +609,76 @@ command_history::remove (int n) { if (instance_ok ()) - instance->do_remove (n); + s_instance->do_remove (n); } void command_history::clear (void) { if (instance_ok ()) - instance->do_clear (); + s_instance->do_clear (); } int command_history::where (void) { - return (instance_ok ()) - ? instance->do_where () : 0; + return instance_ok () ? s_instance->do_where () : 0; } int command_history::length (void) { - return (instance_ok ()) - ? instance->do_length () : 0; + return instance_ok () ? s_instance->do_length () : 0; } int command_history::max_input_history (void) { - return (instance_ok ()) - ? instance->do_max_input_history () : 0; + return instance_ok () ? s_instance->do_max_input_history () : 0; } int command_history::base (void) { - return (instance_ok ()) - ? instance->do_base () : 0; + return instance_ok () ? s_instance->do_base () : 0; } int command_history::current_number (void) { - return (instance_ok ()) - ? instance->do_current_number () : 0; + return instance_ok () ? s_instance->do_current_number () : 0; } void command_history::stifle (int n) { if (instance_ok ()) - instance->do_stifle (n); + s_instance->do_stifle (n); } int command_history::unstifle (void) { - return (instance_ok ()) - ? instance->do_unstifle () : 0; + return instance_ok () ? s_instance->do_unstifle () : 0; } int command_history::is_stifled (void) { - return (instance_ok ()) - ? instance->do_is_stifled () : 0; + return instance_ok () ? s_instance->do_is_stifled () : 0; } void command_history::set_mark (int n) { if (instance_ok ()) - instance->do_set_mark (n); + s_instance->do_set_mark (n); } int command_history::goto_mark (void) { - return (instance_ok ()) - ? instance->do_goto_mark () : 0; + return instance_ok () ? s_instance->do_goto_mark () : 0; } void @@ -703,7 +691,7 @@ command_history::read (const std::string& f, bool must_exist) { if (instance_ok ()) - instance->do_read (f, must_exist); + s_instance->do_read (f, must_exist); } void @@ -717,56 +705,55 @@ bool must_exist) { if (instance_ok ()) - instance->do_read_range (f, from, to, must_exist); + s_instance->do_read_range (f, from, to, must_exist); } void command_history::write (const std::string& f) { if (instance_ok ()) - instance->do_write (f); + s_instance->do_write (f); } void command_history::append (const std::string& f) { if (instance_ok ()) - instance->do_append (f); + s_instance->do_append (f); } void command_history::truncate_file (const std::string& f, int n) { if (instance_ok ()) - instance->do_truncate_file (f, n); + s_instance->do_truncate_file (f, n); } string_vector command_history::list (int limit, bool number_lines) { - return (instance_ok ()) - ? instance->do_list (limit, number_lines) : string_vector (); + return (instance_ok () + ? s_instance->do_list (limit, number_lines) : string_vector ()); } std::string command_history::get_entry (int n) { - return (instance_ok ()) - ? instance->do_get_entry (n) : ""; + return instance_ok () ? s_instance->do_get_entry (n) : ""; } void command_history::replace_entry (int which, const std::string& line) { if (instance_ok ()) - instance->do_replace_entry (which, line); + s_instance->do_replace_entry (which, line); } void command_history::clean_up_and_save (const std::string& f, int n) { if (instance_ok ()) - instance->do_clean_up_and_save (f, n); + s_instance->do_clean_up_and_save (f, n); } void @@ -785,49 +772,49 @@ if (read_history_file) command_history::read (false); - initialized = true; + m_initialized = true; } bool command_history::do_is_initialized (void) const { - return initialized; + return m_initialized; } void command_history::do_set_file (const std::string& f) { - xfile = f; + m_file = f; } std::string command_history::do_file (void) { - return xfile; + return m_file; } void command_history::do_set_size (int n) { - xsize = n; + m_size = n; } int command_history::do_size (void) const { - return xsize; + return m_size; } void command_history::do_ignore_entries (bool flag) { - ignoring_additions = flag; + m_ignoring_additions = flag; } bool command_history::do_ignoring_entries (void) const { - return ignoring_additions; + return m_ignoring_additions; } bool @@ -871,7 +858,7 @@ int command_history::do_current_number (void) const { - return (xsize > 0) ? do_base () + do_where () : -1; + return m_size > 0 ? do_base () + do_where () : -1; } void @@ -917,12 +904,12 @@ void command_history::do_write (const std::string& f_arg) const { - if (initialized) + if (m_initialized) { std::string f = f_arg; if (f.empty ()) - f = xfile; + f = m_file; if (f.empty ()) error ("command_history::write: missing filename"); @@ -932,18 +919,18 @@ void command_history::do_append (const std::string& f_arg) { - if (initialized) + if (m_initialized) { - if (lines_this_session) + if (m_lines_this_session) { - if (lines_this_session < do_where ()) + if (m_lines_this_session < do_where ()) { // Create file if it doesn't already exist. std::string f = f_arg; if (f.empty ()) - f = xfile; + f = m_file; if (f.empty ()) error ("command_history::append: missing filename"); @@ -955,12 +942,12 @@ void command_history::do_truncate_file (const std::string& f_arg, int) const { - if (initialized) + if (m_initialized) { std::string f = f_arg; if (f.empty ()) - f = xfile; + f = m_file; if (f.empty ()) error ("command_history::truncate_file: missing filename"); @@ -986,12 +973,12 @@ void command_history::do_clean_up_and_save (const std::string& f_arg, int) { - if (initialized) + if (m_initialized) { std::string f = f_arg; if (f.empty ()) - f = xfile; + f = m_file; if (f.empty ()) error ("command_history::clean_up_and_save: missing filename");
--- a/liboctave/util/cmd-hist.h Sat Sep 07 10:49:03 2019 -0400 +++ b/liboctave/util/cmd-hist.h Mon Sep 09 16:15:40 2019 -0400 @@ -38,8 +38,10 @@ protected: command_history (void) - : initialized (false), ignoring_additions (false), history_control (0), - lines_in_file (0), lines_this_session (0), xfile (), xsize (-1) { } + : m_initialized (false), m_ignoring_additions (false), + m_history_control (0), m_lines_in_file (0), + m_lines_this_session (0), m_file (), m_size (-1) + { } public: @@ -130,9 +132,13 @@ static void make_command_history (void); // The real thing. - static command_history *instance; + static command_history *s_instance; - static void cleanup_instance (void) { delete instance; instance = nullptr; } + static void cleanup_instance (void) + { + delete s_instance; + s_instance = nullptr; + } protected: @@ -211,25 +217,25 @@ // TRUE means we have initialized the history filename and number of // lines to save. - bool initialized; + bool m_initialized; // TRUE means we are ignoring new additions. - bool ignoring_additions; + bool m_ignoring_additions; // Bitmask for history control options. See oct-rl-hist.h. - int history_control; + int m_history_control; // The number of history lines we read from the history file. - int lines_in_file; + int m_lines_in_file; // The number of history lines we've saved so far. - int lines_this_session; + int m_lines_this_session; // The default history file. - std::string xfile; + std::string m_file; // The number of lines of history to save. - int xsize; + int m_size; }; }
--- a/liboctave/util/glob-match.cc Sat Sep 07 10:49:03 2019 -0400 +++ b/liboctave/util/glob-match.cc Mon Sep 09 16:15:40 2019 -0400 @@ -31,13 +31,13 @@ bool glob_match::match (const std::string& str) const { - return octave::sys::fnmatch (pat, str, fnmatch_flags); + return octave::sys::fnmatch (m_pat, str, m_fnmatch_flags); } string_vector glob_match::glob (void) const { - return octave::sys::glob (pat); + return octave::sys::glob (m_pat); } int
--- a/liboctave/util/glob-match.h Sat Sep 07 10:49:03 2019 -0400 +++ b/liboctave/util/glob-match.h Mon Sep 09 16:15:40 2019 -0400 @@ -45,30 +45,30 @@ glob_match (const std::string& p, unsigned int xopts = pathname | noescape | period) - : pat (p), fnmatch_flags (opts_to_fnmatch_flags (xopts)) { } + : m_pat (p), m_fnmatch_flags (opts_to_fnmatch_flags (xopts)) { } glob_match (const string_vector& p = string_vector (), unsigned int xopts = pathname | noescape | period) - : pat (p), fnmatch_flags (opts_to_fnmatch_flags (xopts)) { } + : m_pat (p), m_fnmatch_flags (opts_to_fnmatch_flags (xopts)) { } glob_match (const glob_match& gm) - : pat (gm.pat), fnmatch_flags (gm.fnmatch_flags) { } + : m_pat (gm.m_pat), m_fnmatch_flags (gm.m_fnmatch_flags) { } glob_match& operator = (const glob_match& gm) { if (this != &gm) { - pat = gm.pat; - fnmatch_flags = gm.fnmatch_flags; + m_pat = gm.m_pat; + m_fnmatch_flags = gm.m_fnmatch_flags; } return *this; } ~glob_match (void) = default; - void set_pattern (const std::string& p) { pat = p; } + void set_pattern (const std::string& p) { m_pat = p; } - void set_pattern (const string_vector& p) { pat = p; } + void set_pattern (const string_vector& p) { m_pat = p; } bool match (const std::string& str) const; @@ -92,10 +92,10 @@ private: // Globbing pattern(s). - string_vector pat; + string_vector m_pat; // Option flags. - int fnmatch_flags; + int m_fnmatch_flags; int opts_to_fnmatch_flags (unsigned int xopts) const; };
--- a/liboctave/util/kpse.cc Sat Sep 07 10:49:03 2019 -0400 +++ b/liboctave/util/kpse.cc Mon Sep 09 16:15:40 2019 -0400 @@ -90,33 +90,33 @@ void kpse_path_iterator::set_end (void) { - e = b + 1; + m_e = m_b + 1; - if (e == len) + if (m_e == m_len) ; // OK, we have found the last element. - else if (e > len) - b = e = std::string::npos; + else if (m_e > m_len) + m_b = m_e = std::string::npos; else { // Find the next colon not enclosed by braces (or the end of the // path). - while (e < len && ! octave::directory_path::is_path_sep (path[e])) - e++; + while (m_e < m_len && ! octave::directory_path::is_path_sep (m_path[m_e])) + m_e++; } } void kpse_path_iterator::next (void) { - b = e + 1; + m_b = m_e + 1; // Skip any consecutive colons. - while (b < len && octave::directory_path::is_path_sep (path[b])) - b++; + while (m_b < m_len && octave::directory_path::is_path_sep (m_path[m_b])) + m_b++; - if (b >= len) - b = e = std::string::npos; + if (m_b >= m_len) + m_b = m_e = std::string::npos; else set_end (); } @@ -132,9 +132,9 @@ std::string ret = name; - size_t len = name.length (); + size_t m_len = name.length (); - for (size_t i = 0; i < len; i++) + for (size_t i = 0; i < m_len; i++) { if (IS_DIR_SEP (name[i]) || IS_DEVICE_SEP (name[i])) {
--- a/liboctave/util/kpse.h Sat Sep 07 10:49:03 2019 -0400 +++ b/liboctave/util/kpse.h Mon Sep 09 16:15:40 2019 -0400 @@ -36,10 +36,14 @@ public: kpse_path_iterator (const std::string& p) - : path (p), b (0), e (0), len (path.length ()) { set_end (); } + : m_path (p), m_b (0), m_e (0), m_len (m_path.length ()) + { + set_end (); + } kpse_path_iterator (const kpse_path_iterator& pi) - : path (pi.path), b (pi.b), e (pi.e), len (pi.len) { } + : m_path (pi.m_path), m_b (pi.m_b), m_e (pi.m_e), m_len (pi.m_len) + { } kpse_path_iterator operator ++ (int) { @@ -48,16 +52,16 @@ return retval; } - std::string operator * (void) { return path.substr (b, e-b); } + std::string operator * (void) { return m_path.substr (m_b, m_e-m_b); } - bool operator != (const size_t sz) { return b != sz; } + bool operator != (const size_t sz) { return m_b != sz; } private: - const std::string& path; - size_t b; - size_t e; - size_t len; + const std::string& m_path; + size_t m_b; + size_t m_e; + size_t m_len; void set_end (void); void next (void);
--- a/liboctave/util/lo-array-errwarn.cc Sat Sep 07 10:49:03 2019 -0400 +++ b/liboctave/util/lo-array-errwarn.cc Mon Sep 09 16:15:40 2019 -0400 @@ -135,40 +135,40 @@ { std::ostringstream buf; - if (var.empty () || var == "<unknown>") + if (m_var.empty () || m_var == "<unknown>") buf << "index "; else - buf << var; + buf << m_var; - bool show_parens = dim > 0; + bool show_parens = m_dim > 0; if (show_parens) { - if (dim < 5) + if (m_dim < 5) { buf << '('; - for (octave_idx_type i = 1; i < dim; i++) + for (octave_idx_type i = 1; i < m_dim; i++) buf << "_,"; } else - buf << "(...[x" << dim - 1 << "]..."; + buf << "(...[x" << m_dim - 1 << "]..."; } buf << idx (); if (show_parens) { - if (nd - dim < 5) + if (m_nd - m_dim < 5) { - for (octave_idx_type i = 0; i < nd - dim; i++) + for (octave_idx_type i = 0; i < m_nd - m_dim; i++) buf << ",_"; - if (nd >= dim) + if (m_nd >= m_dim) buf << ')'; } else - buf << "...[x" << nd - dim << "]...)"; + buf << "...[x" << m_nd - m_dim << "]...)"; } return buf.str (); @@ -245,26 +245,26 @@ out_of_range (const std::string& value, octave_idx_type nd_in, octave_idx_type dim_in) - : index_exception (value, nd_in, dim_in), extent (0) + : index_exception (value, nd_in, dim_in), m_size (), m_extent (0) { } std::string details (void) const { std::string expl; - if (nd >= size.ndims ()) // if not an index slice + if (m_nd >= m_size.ndims ()) // if not an index slice { - if (var != "") - expl = "but " + var + " has size "; + if (m_var != "") + expl = "but " + m_var + " has size "; else expl = "but object has size "; - expl = expl + size.str ('x'); + expl = expl + m_size.str ('x'); } else { std::ostringstream buf; - buf << extent; + buf << m_extent; expl = "out of bound " + buf.str (); } @@ -277,17 +277,17 @@ return error_id_index_out_of_bounds; } - void set_size (const dim_vector& size_in) { size = size_in; } + void set_size (const dim_vector& size_in) { m_size = size_in; } - void set_extent (octave_idx_type ext) { extent = ext; } + void set_extent (octave_idx_type ext) { m_extent = ext; } private: // Dimension of object being accessed. - dim_vector size; + dim_vector m_size; // Length of dimension being accessed. - octave_idx_type extent; + octave_idx_type m_extent; }; // Complain of an index that is out of range, but we don't know matrix size
--- a/liboctave/util/lo-array-errwarn.h Sat Sep 07 10:49:03 2019 -0400 +++ b/liboctave/util/lo-array-errwarn.h Mon Sep 09 16:15:40 2019 -0400 @@ -44,14 +44,14 @@ index_exception (const std::string& index_arg, octave_idx_type nd_arg = 0, octave_idx_type dim_arg = -1, const char *var_arg = "") - : index (index_arg), nd (nd_arg), dim (dim_arg), var (var_arg) + : m_index (index_arg), m_nd (nd_arg), m_dim (dim_arg), m_var (var_arg) { } ~index_exception (void) = default; // Erroneous index value. Called in what, and by external code // (e.g., nth_element) to make a custom error message. - std::string idx (void) const { return index; } + std::string idx (void) const { return m_index; } // details set by subclass. virtual std::string details (void) const = 0; @@ -64,29 +64,29 @@ // Position of error: dimension in error, and number of dimensions. void set_pos (octave_idx_type nd_arg, octave_idx_type dim_arg) { - nd = nd_arg; - dim = dim_arg; + m_nd = nd_arg; + m_dim = dim_arg; } void set_pos_if_unset (octave_idx_type nd_arg, octave_idx_type dim_arg) { - if (nd == 0) + if (m_nd == 0) { - nd = nd_arg; - dim = dim_arg; + m_nd = nd_arg; + m_dim = dim_arg; } } // Name of variable being indexed. eye(2)(1,1) gives "<unknown>". void set_var (const std::string& var_arg = "") { - var = var_arg; + m_var = var_arg; } private: // Value of invalid index. - std::string index; + std::string m_index; protected: @@ -94,13 +94,13 @@ std::string expression (void) const; // Number of dimensions of indexed object. - octave_idx_type nd; + octave_idx_type m_nd; // Dimension number in which invalid index occurred. - octave_idx_type dim; + octave_idx_type m_dim; // Name of variable being indexed. - std::string var; + std::string m_var; };
--- a/liboctave/util/lo-regexp.cc Sat Sep 07 10:49:03 2019 -0400 +++ b/liboctave/util/lo-regexp.cc Mon Sep 09 16:15:40 2019 -0400 @@ -62,8 +62,8 @@ void regexp::free (void) { - if (data) - pcre_free (static_cast<pcre *> (data)); + if (m_data) + pcre_free (static_cast<pcre *> (m_data)); } void @@ -79,11 +79,11 @@ int inames = 0; std::ostringstream buf; - while ((new_pos = pattern.find ("(?", pos)) != std::string::npos) + while ((new_pos = m_pattern.find ("(?", pos)) != std::string::npos) { - if (pattern.at (new_pos + 2) == '<' - && !(pattern.at (new_pos + 3) == '=' - || pattern.at (new_pos + 3) == '!')) + if (m_pattern.at (new_pos + 2) == '<' + && !(m_pattern.at (new_pos + 3) == '=' + || m_pattern.at (new_pos + 3) == '!')) { // The syntax of named tokens in pcre is "(?P<name>...)" while // we need a syntax "(?<name>...)", so fix that here. Also an @@ -94,23 +94,23 @@ // that here by replacing name tokens by dummy names, and dealing // with the dummy names later. - size_t tmp_pos = pattern.find_first_of ('>', new_pos); + size_t tmp_pos = m_pattern.find_first_of ('>', new_pos); if (tmp_pos == std::string::npos) (*current_liboctave_error_handler) ("regexp: syntax error in pattern"); std::string tmp_name - = pattern.substr (new_pos+3, tmp_pos-new_pos-3); + = m_pattern.substr (new_pos+3, tmp_pos-new_pos-3); bool found = false; - for (int i = 0; i < nnames; i++) + for (int i = 0; i < m_names; i++) { - if (named_pats(i) == tmp_name) + if (m_named_pats(i) == tmp_name) { - named_idx.resize (dim_vector (inames+1, 1)); - named_idx(inames) = i; + m_named_idx.resize (dim_vector (inames+1, 1)); + m_named_idx(inames) = i; found = true; break; } @@ -118,14 +118,14 @@ if (! found) { - named_idx.resize (dim_vector (inames+1, 1)); - named_idx(inames) = nnames; - named_pats.append (tmp_name); - nnames++; + m_named_idx.resize (dim_vector (inames+1, 1)); + m_named_idx(inames) = m_names; + m_named_pats.append (tmp_name); + m_names++; } if (new_pos - pos > 0) - buf << pattern.substr (pos, new_pos-pos); + buf << m_pattern.substr (pos, new_pos-pos); if (inames < 10) buf << "(?P<n00" << inames++; else if (inames < 100) @@ -135,7 +135,7 @@ pos = tmp_pos; } - else if (pattern.at (new_pos + 2) == '<') + else if (m_pattern.at (new_pos + 2) == '<') { // Find lookbehind operators of arbitrary length (ie like // "(?<=[a-z]*)") and replace with a maximum length operator @@ -147,9 +147,9 @@ size_t tmp_pos1 = new_pos + 2; size_t tmp_pos2 = tmp_pos1; - while (tmp_pos1 < pattern.length () && brackets > 0) + while (tmp_pos1 < m_pattern.length () && brackets > 0) { - char ch = pattern.at (tmp_pos1); + char ch = m_pattern.at (tmp_pos1); if (ch == '(') brackets++; @@ -166,12 +166,12 @@ if (brackets != 0) { - buf << pattern.substr (pos, new_pos - pos) << "(?"; + buf << m_pattern.substr (pos, new_pos - pos) << "(?"; pos = new_pos + 2; } else { - size_t tmp_pos3 = pattern.find_first_of ("*+", tmp_pos2); + size_t tmp_pos3 = m_pattern.find_first_of ("*+", tmp_pos2); if (tmp_pos3 != std::string::npos && tmp_pos3 < tmp_pos1) { @@ -181,23 +181,23 @@ (*current_liboctave_warning_with_id_handler) ("Octave:regexp-lookbehind-limit", "%s: arbitrary length lookbehind patterns are only supported up to length %d", - who.c_str (), MAXLOOKBEHIND); + m_who.c_str (), MAXLOOKBEHIND); } - buf << pattern.substr (pos, new_pos - pos) << '('; + buf << m_pattern.substr (pos, new_pos - pos) << '('; size_t i; - if (pattern.at (tmp_pos3) == '*') + if (m_pattern.at (tmp_pos3) == '*') i = 0; else i = 1; for (; i < max_length + 1; i++) { - buf << pattern.substr (new_pos, tmp_pos3 - new_pos) + buf << m_pattern.substr (new_pos, tmp_pos3 - new_pos) << '{' << i << '}'; - buf << pattern.substr (tmp_pos3 + 1, + buf << m_pattern.substr (tmp_pos3 + 1, tmp_pos1 - tmp_pos3 - 1); if (i != max_length) buf << '|'; @@ -205,20 +205,20 @@ buf << ')'; } else - buf << pattern.substr (pos, tmp_pos1 - pos); + buf << m_pattern.substr (pos, tmp_pos1 - pos); pos = tmp_pos1; } } else { - buf << pattern.substr (pos, new_pos - pos) << "(?"; + buf << m_pattern.substr (pos, new_pos - pos) << "(?"; pos = new_pos + 2; } } - buf << pattern.substr (pos); + buf << m_pattern.substr (pos); // Replace NULLs with escape sequence because conversion function c_str() // will terminate string early at embedded NULLs. @@ -230,17 +230,17 @@ int erroffset; int pcre_options - = ( (options.case_insensitive () ? PCRE_CASELESS : 0) - | (options.dotexceptnewline () ? 0 : PCRE_DOTALL) - | (options.lineanchors () ? PCRE_MULTILINE : 0) - | (options.freespacing () ? PCRE_EXTENDED : 0)); + = ( (m_options.case_insensitive () ? PCRE_CASELESS : 0) + | (m_options.dotexceptnewline () ? 0 : PCRE_DOTALL) + | (m_options.lineanchors () ? PCRE_MULTILINE : 0) + | (m_options.freespacing () ? PCRE_EXTENDED : 0)); - data = pcre_compile (buf_str.c_str (), pcre_options, + m_data = pcre_compile (buf_str.c_str (), pcre_options, &err, &erroffset, nullptr); - if (! data) + if (! m_data) (*current_liboctave_error_handler) - ("%s: %s at position %d of expression", who.c_str (), err, erroffset); + ("%s: %s at position %d of expression", m_who.c_str (), err, erroffset); } regexp::match_data @@ -256,7 +256,7 @@ char *nametable; size_t idx = 0; - pcre *re = static_cast<pcre *> (data); + pcre *re = static_cast<pcre *> (m_data); pcre_fullinfo (re, nullptr, PCRE_INFO_CAPTURECOUNT, &subpatterns); pcre_fullinfo (re, nullptr, PCRE_INFO_NAMECOUNT, &namecount); @@ -315,15 +315,15 @@ if (matches == PCRE_ERROR_BADUTF8) (*current_liboctave_error_handler) ("%s: internal error calling pcre_exec; " - "the input string is invalid UTF-8", who.c_str ()); + "the input string is invalid UTF-8", m_who.c_str ()); else if (matches < 0 && matches != PCRE_ERROR_NOMATCH) (*current_liboctave_error_handler) ("%s: internal error calling pcre_exec; " - "error code from pcre_exec is %i", who.c_str (), matches); + "error code from pcre_exec is %i", m_who.c_str (), matches); if (matches == PCRE_ERROR_NOMATCH) break; - else if (ovector[0] >= ovector[1] && ! options.emptymatch ()) + else if (ovector[0] >= ovector[1] && ! m_options.emptymatch ()) { // Zero length match. Skip to next char. idx = ovector[0] + 1; @@ -360,13 +360,13 @@ if (status == PCRE_ERROR_NOMEMORY) (*current_liboctave_error_handler) ("%s: cannot allocate memory in pcre_get_substring_list", - who.c_str ()); + m_who.c_str ()); // Must use explicit length constructor as match can contain '\0'. std::string match_string = std::string (*listptr, end - start + 1); string_vector tokens (pos_match); - string_vector named_tokens (nnames); + string_vector named_tokens (m_names); int pos_offset = 0; pos_match = 0; @@ -388,7 +388,7 @@ if (nidx[j] == i) { size_t len = ovector[2*i+1] - ovector[2*i]; - named_tokens(named_idx(j)) + named_tokens(m_named_idx(j)) = std::string (*(listptr+i-pos_offset), len); break; @@ -420,12 +420,12 @@ else idx = ovector[1]; - if (options.once () || idx >= buffer.length ()) + if (m_options.once () || idx >= buffer.length ()) break; } } - retval = regexp::match_data (lst, named_pats); + retval = regexp::match_data (lst, m_named_pats); return retval; }
--- a/liboctave/util/lo-regexp.h Sat Sep 07 10:49:03 2019 -0400 +++ b/liboctave/util/lo-regexp.h Mon Sep 09 16:15:40 2019 -0400 @@ -49,26 +49,26 @@ regexp (const std::string& pat = "", const regexp::opts& opt = regexp::opts (), const std::string& w = "regexp") - : pattern (pat), options (opt), data (nullptr), named_pats (), - nnames (0), named_idx (), who (w) + : m_pattern (pat), m_options (opt), m_data (nullptr), m_named_pats (), + m_names (0), m_named_idx (), m_who (w) { compile_internal (); } regexp (const regexp& rx) - : pattern (rx.pattern), data (rx.data), named_pats (rx.named_pats), - nnames (rx.nnames), named_idx (rx.named_idx) + : m_pattern (rx.m_pattern), m_data (rx.m_data), m_named_pats (rx.m_named_pats), + m_names (rx.m_names), m_named_idx (rx.m_named_idx) { } regexp& operator = (const regexp& rx) { if (this != &rx) { - pattern = rx.pattern; - data = rx.data; - named_pats = rx.named_pats; - nnames = rx.nnames; - named_idx = rx.named_idx; + m_pattern = rx.m_pattern; + m_data = rx.m_data; + m_named_pats = rx.m_named_pats; + m_names = rx.m_names; + m_named_idx = rx.m_named_idx; } return *this; @@ -79,8 +79,8 @@ void compile (const std::string& pat, const regexp::opts& opt = regexp::opts ()) { - pattern = pat; - options = opt; + m_pattern = pat; + m_options = opt; compile_internal (); } @@ -139,29 +139,29 @@ public: opts (void) - : x_case_insensitive (false), x_dotexceptnewline (false), - x_emptymatch (false), x_freespacing (false), x_lineanchors (false), - x_once (false) { } + : m_case_insensitive (false), m_dotexceptnewline (false), + m_emptymatch (false), m_freespacing (false), m_lineanchors (false), + m_once (false) { } opts (const opts& o) - : x_case_insensitive (o.x_case_insensitive), - x_dotexceptnewline (o.x_dotexceptnewline), - x_emptymatch (o.x_emptymatch), - x_freespacing (o.x_freespacing), - x_lineanchors (o.x_lineanchors), - x_once (o.x_once) + : m_case_insensitive (o.m_case_insensitive), + m_dotexceptnewline (o.m_dotexceptnewline), + m_emptymatch (o.m_emptymatch), + m_freespacing (o.m_freespacing), + m_lineanchors (o.m_lineanchors), + m_once (o.m_once) { } opts& operator = (const opts& o) { if (this != &o) { - x_case_insensitive = o.x_case_insensitive; - x_dotexceptnewline = o.x_dotexceptnewline; - x_emptymatch = o.x_emptymatch; - x_freespacing = o.x_freespacing; - x_lineanchors = o.x_lineanchors; - x_once = o.x_once; + m_case_insensitive = o.m_case_insensitive; + m_dotexceptnewline = o.m_dotexceptnewline; + m_emptymatch = o.m_emptymatch; + m_freespacing = o.m_freespacing; + m_lineanchors = o.m_lineanchors; + m_once = o.m_once; } return *this; @@ -169,28 +169,28 @@ ~opts (void) = default; - void case_insensitive (bool val) { x_case_insensitive = val; } - void dotexceptnewline (bool val) { x_dotexceptnewline = val; } - void emptymatch (bool val) { x_emptymatch = val; } - void freespacing (bool val) { x_freespacing = val; } - void lineanchors (bool val) { x_lineanchors = val; } - void once (bool val) { x_once = val; } + void case_insensitive (bool val) { m_case_insensitive = val; } + void dotexceptnewline (bool val) { m_dotexceptnewline = val; } + void emptymatch (bool val) { m_emptymatch = val; } + void freespacing (bool val) { m_freespacing = val; } + void lineanchors (bool val) { m_lineanchors = val; } + void once (bool val) { m_once = val; } - bool case_insensitive (void) const { return x_case_insensitive; } - bool dotexceptnewline (void) const { return x_dotexceptnewline; } - bool emptymatch (void) const { return x_emptymatch; } - bool freespacing (void) const { return x_freespacing; } - bool lineanchors (void) const { return x_lineanchors; } - bool once (void) const { return x_once; } + bool case_insensitive (void) const { return m_case_insensitive; } + bool dotexceptnewline (void) const { return m_dotexceptnewline; } + bool emptymatch (void) const { return m_emptymatch; } + bool freespacing (void) const { return m_freespacing; } + bool lineanchors (void) const { return m_lineanchors; } + bool once (void) const { return m_once; } private: - bool x_case_insensitive; - bool x_dotexceptnewline; - bool x_emptymatch; - bool x_freespacing; - bool x_lineanchors; - bool x_once; + bool m_case_insensitive; + bool m_dotexceptnewline; + bool m_emptymatch; + bool m_freespacing; + bool m_lineanchors; + bool m_once; }; class match_element @@ -200,32 +200,32 @@ match_element (const string_vector& nt, const string_vector& t, const std::string& ms, const Matrix& te, double s, double e) - : x_match_string (ms), x_named_tokens (nt), x_tokens (t), - x_token_extents (te), x_start (s), x_end (e) + : m_match_string (ms), m_named_tokens (nt), m_tokens (t), + m_token_extents (te), m_start (s), m_end (e) { } match_element (const match_element& a) - : x_match_string (a.x_match_string), - x_named_tokens (a.x_named_tokens), x_tokens (a.x_tokens), - x_token_extents (a.x_token_extents), - x_start (a.x_start), x_end (a.x_end) + : m_match_string (a.m_match_string), + m_named_tokens (a.m_named_tokens), m_tokens (a.m_tokens), + m_token_extents (a.m_token_extents), + m_start (a.m_start), m_end (a.m_end) { } - std::string match_string (void) const { return x_match_string; } - string_vector named_tokens (void) const { return x_named_tokens; } - string_vector tokens (void) const { return x_tokens; } - Matrix token_extents (void) const { return x_token_extents; } - double start (void) const { return x_start; } - double end (void) const { return x_end; } + std::string match_string (void) const { return m_match_string; } + string_vector named_tokens (void) const { return m_named_tokens; } + string_vector tokens (void) const { return m_tokens; } + Matrix token_extents (void) const { return m_token_extents; } + double start (void) const { return m_start; } + double end (void) const { return m_end; } private: - std::string x_match_string; - string_vector x_named_tokens; - string_vector x_tokens; - Matrix x_token_extents; - double x_start; - double x_end; + std::string m_match_string; + string_vector m_named_tokens; + string_vector m_tokens; + Matrix m_token_extents; + double m_start; + double m_end; }; class match_data : public base_list<match_element> @@ -233,16 +233,16 @@ public: match_data (void) - : base_list<match_element> (), named_pats () + : base_list<match_element> (), m_named_pats () { } match_data (const std::list<match_element>& l, const string_vector& np) - : base_list<match_element> (l), named_pats (np) + : base_list<match_element> (l), m_named_pats (np) { } match_data (const match_data& rx_lst) : base_list<match_element> (rx_lst), - named_pats (rx_lst.named_pats) + m_named_pats (rx_lst.m_named_pats) { } match_data& operator = (const match_data& rx_lst) @@ -250,7 +250,7 @@ if (this != &rx_lst) { base_list<match_element>::operator = (rx_lst); - named_pats = rx_lst.named_pats; + m_named_pats = rx_lst.m_named_pats; } return *this; @@ -258,28 +258,28 @@ ~match_data (void) = default; - string_vector named_patterns (void) const { return named_pats; } + string_vector named_patterns (void) const { return m_named_pats; } private: - string_vector named_pats; + string_vector m_named_pats; }; private: // The pattern we've been asked to match. - std::string pattern; + std::string m_pattern; - opts options; + opts m_options; // Internal data describing the regular expression. - void *data; + void *m_data; - std::string m; - string_vector named_pats; - int nnames; - Array<int> named_idx; - std::string who; + std::string m_m; + string_vector m_named_pats; + int m_names; + Array<int> m_named_idx; + std::string m_who; void free (void);
--- a/liboctave/util/oct-inttypes.h Sat Sep 07 10:49:03 2019 -0400 +++ b/liboctave/util/oct-inttypes.h Mon Sep 09 16:15:40 2019 -0400 @@ -213,7 +213,7 @@ // We also provide two special relations: ct, yielding always true, // and cf, yielding always false. -#define OCTAVE_REGISTER_INT_CONST_OP(NM, VALUE) \ +#define OCTAVE_REGISTER_INT_CONST_OP(NM, VALUE) \ class NM \ { \ public: \ @@ -222,7 +222,7 @@ static const bool gtval = VALUE; \ \ template <typename T> \ - static bool op (T, T) { return VALUE; } \ + static bool op (T, T) { return VALUE; } \ } OCTAVE_REGISTER_INT_CONST_OP (ct, true); @@ -795,58 +795,58 @@ typedef T val_type; - octave_int (void) : ival () { } + octave_int (void) : m_ival () { } - octave_int (T i) : ival (i) { } + octave_int (T i) : m_ival (i) { } #if defined (OCTAVE_HAVE_OVERLOAD_CHAR_INT8_TYPES) // Always treat characters as unsigned. octave_int (char c) - : ival (octave_int_base<T>::truncate_int (static_cast<unsigned char> (c))) + : m_ival (octave_int_base<T>::truncate_int (static_cast<unsigned char> (c))) { } #endif octave_int (double d) - : ival (octave_int_base<T>::convert_real (d)) { } + : m_ival (octave_int_base<T>::convert_real (d)) { } octave_int (float d) - : ival (octave_int_base<T>::convert_real (d)) { } + : m_ival (octave_int_base<T>::convert_real (d)) { } #if defined (OCTAVE_INT_USE_LONG_DOUBLE) octave_int (long double d) - : ival (octave_int_base<T>::convert_real (d)) { } + : m_ival (octave_int_base<T>::convert_real (d)) { } #endif - octave_int (bool b) : ival (b) { } + octave_int (bool b) : m_ival (b) { } template <typename U> octave_int (const U& i) - : ival(octave_int_base<T>::truncate_int (i)) { } + : m_ival(octave_int_base<T>::truncate_int (i)) { } template <typename U> octave_int (const octave_int<U>& i) - : ival (octave_int_base<T>::truncate_int (i.value ())) { } + : m_ival (octave_int_base<T>::truncate_int (i.value ())) { } - octave_int (const octave_int<T>& i) : ival (i.ival) { } + octave_int (const octave_int<T>& i) : m_ival (i.m_ival) { } octave_int& operator = (const octave_int<T>& i) { - ival = i.ival; + m_ival = i.m_ival; return *this; } - T value (void) const { return ival; } + T value (void) const { return m_ival; } const unsigned char * iptr (void) const { - return reinterpret_cast<const unsigned char *> (& ival); + return reinterpret_cast<const unsigned char *> (& m_ival); } - bool operator ! (void) const { return ! ival; } + bool operator ! (void) const { return ! m_ival; } bool bool_value (void) const { return static_cast<bool> (value ()); } @@ -865,7 +865,7 @@ inline octave_int<T> \ OPNAME () const \ { \ - return octave_int_arith<T>::NAME (ival); \ + return octave_int_arith<T>::NAME (m_ival); \ } OCTAVE_INT_UN_OP (operator -, minus) @@ -874,19 +874,19 @@ #undef OCTAVE_INT_UN_OP -// Homogeneous binary integer operations. -#define OCTAVE_INT_BIN_OP(OP, NAME, ARGT) \ - inline octave_int<T> \ - operator OP (const ARGT& y) const \ - { \ - return octave_int_arith<T>::NAME (ival, y); \ - } \ - \ - inline octave_int<T>& \ - operator OP##= (const ARGT& y) \ - { \ - ival = octave_int_arith<T>::NAME (ival, y); \ - return *this; \ + // Homogeneous binary integer operations. +#define OCTAVE_INT_BIN_OP(OP, NAME, ARGT) \ + inline octave_int<T> \ + operator OP (const ARGT& y) const \ + { \ + return octave_int_arith<T>::NAME (m_ival, y); \ + } \ + \ + inline octave_int<T>& \ + operator OP##= (const ARGT& y) \ + { \ + m_ival = octave_int_arith<T>::NAME (m_ival, y); \ + return *this; \ } OCTAVE_INT_BIN_OP (+, add, octave_int<T>) @@ -913,11 +913,11 @@ // Unsafe. This function exists to support the MEX interface. // You should not use it anywhere else. - void * mex_get_data (void) const { return const_cast<T *> (&ival); } + void * mex_get_data (void) const { return const_cast<T *> (&m_ival); } private: - T ival; + T m_ival; }; template <typename T>
--- a/liboctave/util/oct-mutex.cc Sat Sep 07 10:49:03 2019 -0400 +++ b/liboctave/util/oct-mutex.cc Mon Sep 09 16:15:40 2019 -0400 @@ -112,38 +112,38 @@ { public: pthread_mutex (void) - : base_mutex (), pm () + : base_mutex (), m_pm () { pthread_mutexattr_t attr; pthread_mutexattr_init (&attr); pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE); - pthread_mutex_init (&pm, &attr); + pthread_mutex_init (&m_pm, &attr); pthread_mutexattr_destroy (&attr); } ~pthread_mutex (void) { - pthread_mutex_destroy (&pm); + pthread_mutex_destroy (&m_pm); } void lock (void) { - pthread_mutex_lock (&pm); + pthread_mutex_lock (&m_pm); } void unlock (void) { - pthread_mutex_unlock (&pm); + pthread_mutex_unlock (&m_pm); } bool try_lock (void) { - return (pthread_mutex_trylock (&pm) == 0); + return (pthread_mutex_trylock (&m_pm) == 0); } private: - pthread_mutex_t pm; + pthread_mutex_t m_pm; }; static pthread_t thread_id = 0; @@ -174,5 +174,5 @@ #endif } - mutex::mutex (void) : rep (init_rep ()) { } + mutex::mutex (void) : m_rep (init_rep ()) { } }
--- a/liboctave/util/oct-mutex.h Sat Sep 07 10:49:03 2019 -0400 +++ b/liboctave/util/oct-mutex.h Mon Sep 09 16:15:40 2019 -0400 @@ -37,7 +37,7 @@ public: friend class mutex; - base_mutex (void) : count (1) { } + base_mutex (void) : m_count (1) { } virtual ~base_mutex (void) = default; @@ -48,7 +48,7 @@ virtual bool try_lock (void); private: - refcount<int> count; + refcount<int> m_count; }; class @@ -59,26 +59,26 @@ mutex (void); mutex (const mutex& m) - : rep (m.rep) + : m_rep (m.m_rep) { - rep->count++; + m_rep->m_count++; } ~mutex (void) { - if (--rep->count == 0) - delete rep; + if (--m_rep->m_count == 0) + delete m_rep; } mutex& operator = (const mutex& m) { - if (rep != m.rep) + if (m_rep != m.m_rep) { - if (--rep->count == 0) - delete rep; + if (--m_rep->m_count == 0) + delete m_rep; - rep = m.rep; - rep->count++; + m_rep = m.m_rep; + m_rep->m_count++; } return *this; @@ -86,21 +86,21 @@ void lock (void) { - rep->lock (); + m_rep->lock (); } void unlock (void) { - rep->unlock (); + m_rep->unlock (); } bool try_lock (void) { - return rep->try_lock (); + return m_rep->try_lock (); } protected: - base_mutex *rep; + base_mutex *m_rep; }; class
--- a/liboctave/util/oct-shlib.cc Sat Sep 07 10:49:03 2019 -0400 +++ b/liboctave/util/oct-shlib.cc Mon Sep 09 16:15:40 2019 -0400 @@ -58,35 +58,36 @@ namespace octave { dynamic_library::dynlib_rep::dynlib_rep (const std::string& f) - : count (1), file (f), tm_loaded (), fcn_names (), search_all_loaded (false) + : m_count (1), m_fcn_names (), m_file (f), m_time_loaded (), + m_search_all_loaded (false) { - instances[f] = this; + s_instances[f] = this; if (is_out_of_date ()) (*current_liboctave_warning_with_id_handler) ("Octave:warn-future-time-stamp", - "timestamp on file %s is in the future", file.c_str ()); + "timestamp on file %s is in the future", m_file.c_str ()); } bool dynamic_library::dynlib_rep::is_out_of_date (void) const { - sys::file_stat fs (file); - return (fs && fs.is_newer (tm_loaded)); + sys::file_stat fs (m_file); + return (fs && fs.is_newer (m_time_loaded)); } void dynamic_library::dynlib_rep::fake_reload (void) { // We can't actually reload the library, but we'll pretend we did. - sys::file_stat fs (file); - if (fs && fs.is_newer (tm_loaded)) + sys::file_stat fs (m_file); + if (fs && fs.is_newer (m_time_loaded)) { - tm_loaded = fs.mtime (); + m_time_loaded = fs.mtime (); (*current_liboctave_warning_with_id_handler) ("Octave:library-reload", - "library %s not reloaded due to existing references", file.c_str ()); + "library %s not reloaded due to existing references", m_file.c_str ()); } } @@ -94,11 +95,11 @@ dynamic_library::dynlib_rep::get_instance (const std::string& f, bool fake) { dynlib_rep *retval = nullptr; - std::map<std::string, dynlib_rep *>::iterator p = instances.find (f); - if (p != instances.end ()) + std::map<std::string, dynlib_rep *>::iterator p = s_instances.find (f); + if (p != s_instances.end ()) { retval = p->second; - retval->count++; + retval->m_count++; if (fake) retval->fake_reload (); } @@ -113,7 +114,7 @@ { std::list<std::string> retval; - for (const auto& p : fcn_names) + for (const auto& p : m_fcn_names) retval.push_back (p.first); return retval; @@ -122,10 +123,10 @@ void dynamic_library::dynlib_rep::add_fcn_name (const std::string& name) { - auto p = fcn_names.find (name); + auto p = m_fcn_names.find (name); - if (p == fcn_names.end ()) - fcn_names[name] = 1; + if (p == m_fcn_names.end ()) + m_fcn_names[name] = 1; else ++(p->second); } @@ -135,11 +136,11 @@ { bool retval = false; - auto p = fcn_names.find (fcn_name); + auto p = m_fcn_names.find (fcn_name); - if (p != fcn_names.end () && --(p->second) == 0) + if (p != m_fcn_names.end () && --(p->second) == 0) { - fcn_names.erase (fcn_name); + m_fcn_names.erase (fcn_name); retval = true; } @@ -147,9 +148,9 @@ } std::map<std::string, dynamic_library::dynlib_rep *> - dynamic_library::dynlib_rep::instances; + dynamic_library::dynlib_rep::s_instances; - dynamic_library::dynlib_rep dynamic_library::nil_rep; + dynamic_library::dynlib_rep dynamic_library::s_nil_rep; #if defined (HAVE_DLOPEN_API) @@ -177,16 +178,16 @@ bool is_open (void) const { - return (search_all_loaded || library != nullptr); + return (m_search_all_loaded || m_library != nullptr); } private: - void *library; + void *m_library; }; octave_dlopen_shlib::octave_dlopen_shlib (const std::string& f) - : dynamic_library::dynlib_rep (f), library (nullptr) + : dynamic_library::dynlib_rep (f), m_library (nullptr) { int flags = 0; @@ -204,31 +205,31 @@ flags |= RTLD_GLOBAL; # endif - if (file.empty ()) + if (m_file.empty ()) { - search_all_loaded = true; + m_search_all_loaded = true; return; } - library = dlopen (file.c_str (), flags); + m_library = dlopen (m_file.c_str (), flags); - if (! library) + if (! m_library) { const char *msg = dlerror (); if (msg) (*current_liboctave_error_handler) ("%s: failed to load: %s", - file.c_str (), msg); + m_file.c_str (), msg); else (*current_liboctave_error_handler) ("%s: failed to load", - file.c_str ()); + m_file.c_str ()); } } octave_dlopen_shlib::~octave_dlopen_shlib (void) { - if (library) - dlclose (library); + if (m_library) + dlclose (m_library); } void * @@ -239,17 +240,17 @@ if (! is_open ()) (*current_liboctave_error_handler) - ("shared library %s is not open", file.c_str ()); + ("shared library %s is not open", m_file.c_str ()); std::string sym_name = name; if (mangler) sym_name = mangler (name); - if (search_all_loaded) + if (m_search_all_loaded) function = dlsym (RTLD_DEFAULT, sym_name.c_str ()); else - function = dlsym (library, sym_name.c_str ()); + function = dlsym (m_library, sym_name.c_str ()); return function; } @@ -276,26 +277,29 @@ void * global_search (const std::string& sym_name); - bool is_open (void) const { return (search_all_loaded || handle != nullptr); } + bool is_open (void) const + { + return (m_search_all_loaded || m_handle != nullptr); + } private: - HINSTANCE handle; + HINSTANCE m_handle; }; static void set_dll_directory (const std::string& dir = "") { - SetDllDirectoryW (dir.empty () ? nullptr - : sys::u8_to_wstring (dir).c_str ()); + SetDllDirectoryW (dir.empty () + ? nullptr : sys::u8_to_wstring (dir).c_str ()); } octave_w32_shlib::octave_w32_shlib (const std::string& f) - : dynamic_library::dynlib_rep (f), handle (nullptr) + : dynamic_library::dynlib_rep (f), m_handle (nullptr) { if (f.empty()) { - search_all_loaded = true; + m_search_all_loaded = true; return; } @@ -303,11 +307,11 @@ set_dll_directory (dir); - handle = LoadLibraryW (sys::u8_to_wstring (file).c_str ()); + m_handle = LoadLibraryW (sys::u8_to_wstring (m_file).c_str ()); set_dll_directory (); - if (! handle) + if (! m_handle) { DWORD lastError = GetLastError (); const char *msg; @@ -331,14 +335,14 @@ msg = "library open failed"; } - (*current_liboctave_error_handler) ("%s: %s", msg, file.c_str ()); + (*current_liboctave_error_handler) ("%s: %s", msg, m_file.c_str ()); } } octave_w32_shlib::~octave_w32_shlib (void) { - if (handle) - FreeLibrary (handle); + if (m_handle) + FreeLibrary (m_handle); } void * @@ -396,19 +400,19 @@ { void *function = nullptr; - if (! search_all_loaded && ! is_open ()) + if (! m_search_all_loaded && ! is_open ()) (*current_liboctave_error_handler) - ("shared library %s is not open", file.c_str ()); + ("shared library %s is not open", m_file.c_str ()); std::string sym_name = name; if (mangler) sym_name = mangler (name); - if (search_all_loaded) + if (m_search_all_loaded) function = global_search (sym_name); else - function = reinterpret_cast<void *> (GetProcAddress (handle, + function = reinterpret_cast<void *> (GetProcAddress (m_handle, sym_name.c_str ())); return function;
--- a/liboctave/util/oct-shlib.h Sat Sep 07 10:49:03 2019 -0400 +++ b/liboctave/util/oct-shlib.h Mon Sep 09 16:15:40 2019 -0400 @@ -48,8 +48,8 @@ public: dynlib_rep (void) - : count (1), file (), tm_loaded (time_t ()), fcn_names (), - search_all_loaded (false) + : m_count (1), m_fcn_names (), m_file (), m_time_loaded (time_t ()), + m_search_all_loaded (false) { } protected: @@ -60,7 +60,7 @@ virtual ~dynlib_rep (void) { - instances.erase (file); + s_instances.erase (m_file); } virtual bool is_open (void) const @@ -77,12 +77,12 @@ static dynlib_rep * get_instance (const std::string& f, bool fake); sys::time time_loaded (void) const - { return tm_loaded; } + { return m_time_loaded; } std::string file_name (void) const - { return file; } + { return m_file; } - size_t num_fcn_names (void) const { return fcn_names.size (); } + size_t num_fcn_names (void) const { return m_fcn_names.size (); } std::list<std::string> function_names (void) const; @@ -90,79 +90,78 @@ bool remove_fcn_name (const std::string&); - void clear_fcn_names (void) { fcn_names.clear (); } + void clear_fcn_names (void) { m_fcn_names.clear (); } public: - refcount<int> count; + refcount<int> m_count; protected: void fake_reload (void); - std::string file; - sys::time tm_loaded; + static std::map<std::string, dynlib_rep *> s_instances; // Set of hooked function names. typedef std::map<std::string, size_t>::iterator fcn_names_iterator; typedef std::map<std::string, size_t>::const_iterator fcn_names_const_iterator; - std::map<std::string, size_t> fcn_names; - - static std::map<std::string, dynlib_rep *> instances; - bool search_all_loaded; + std::map<std::string, size_t> m_fcn_names; + std::string m_file; + sys::time m_time_loaded; + bool m_search_all_loaded; }; private: - static dynlib_rep nil_rep; + static dynlib_rep s_nil_rep; public: - dynamic_library (void) : rep (&nil_rep) { rep->count++; } + dynamic_library (void) : m_rep (&s_nil_rep) { m_rep->m_count++; } dynamic_library (const std::string& f, bool fake = true) - : rep (dynlib_rep::get_instance (f, fake)) { } + : m_rep (dynlib_rep::get_instance (f, fake)) { } ~dynamic_library (void) { - if (--rep->count == 0) - delete rep; + if (--m_rep->m_count == 0) + delete m_rep; } dynamic_library (const dynamic_library& sl) - : rep (sl.rep) + : m_rep (sl.m_rep) { - rep->count++; + m_rep->m_count++; } dynamic_library& operator = (const dynamic_library& sl) { - if (rep != sl.rep) + if (m_rep != sl.m_rep) { - if (--rep->count == 0) - delete rep; + if (--m_rep->m_count == 0) + delete m_rep; - rep = sl.rep; - rep->count++; + m_rep = sl.m_rep; + m_rep->m_count++; } return *this; } bool operator == (const dynamic_library& sl) const - { return (rep == sl.rep); } + { return (m_rep == sl.m_rep); } - operator bool () const { return rep->is_open (); } + operator bool () const { return m_rep->is_open (); } void open (const std::string& f) { *this = dynamic_library (f); } std::list<std::string> close (void) { - std::list<std::string> removed_fcns = rep->function_names (); + std::list<std::string> removed_fcns = m_rep->function_names (); - rep->clear_fcn_names (); + m_rep->clear_fcn_names (); *this = dynamic_library (); @@ -171,34 +170,34 @@ void * search (const std::string& nm, name_mangler mangler = nullptr) const { - void *f = rep->search (nm, mangler); + void *f = m_rep->search (nm, mangler); if (f) - rep->add_fcn_name (nm); + m_rep->add_fcn_name (nm); return f; } void add (const std::string& name) - { rep->add_fcn_name (name); } + { m_rep->add_fcn_name (name); } bool remove (const std::string& name) - { return rep->remove_fcn_name (name); } + { return m_rep->remove_fcn_name (name); } size_t number_of_functions_loaded (void) const - { return rep->num_fcn_names (); } + { return m_rep->num_fcn_names (); } bool is_out_of_date (void) const - { return rep->is_out_of_date (); } + { return m_rep->is_out_of_date (); } std::string file_name (void) const - { return rep->file_name (); } + { return m_rep->file_name (); } sys::time time_loaded (void) const - { return rep->time_loaded (); } + { return m_rep->time_loaded (); } private: - dynlib_rep *rep; + dynlib_rep *m_rep; }; }
--- a/liboctave/util/oct-sort.cc Sat Sep 07 10:49:03 2019 -0400 +++ b/liboctave/util/oct-sort.cc Mon Sep 09 16:15:40 2019 -0400 @@ -119,18 +119,18 @@ template <typename T> octave_sort<T>::octave_sort (void) : - compare (ascending_compare), ms (nullptr) + m_compare (ascending_compare), m_ms (nullptr) { } template <typename T> octave_sort<T>::octave_sort (compare_fcn_type comp) - : compare (comp), ms (nullptr) + : m_compare (comp), m_ms (nullptr) { } template <typename T> octave_sort<T>::~octave_sort () { - delete ms; + delete m_ms; } template <typename T> @@ -138,11 +138,11 @@ octave_sort<T>::set_compare (sortmode mode) { if (mode == ASCENDING) - compare = ascending_compare; + m_compare = ascending_compare; else if (mode == DESCENDING) - compare = descending_compare; + m_compare = descending_compare; else - compare = nullptr; + m_compare = nullptr; } template <typename T> @@ -543,17 +543,17 @@ void octave_sort<T>::MergeState::getmem (octave_idx_type need) { - if (need <= alloced) + if (need <= m_alloced) return; need = roundupsize (need); /* Don't realloc! That can cost cycles to copy the old data, but * we don't care what's in the block. */ - delete [] a; - delete [] ia; // Must do this or fool possible next getmemi. - a = new T [need]; - alloced = need; + delete [] m_a; + delete [] m_ia; // Must do this or fool possible next getmemi. + m_a = new T [need]; + m_alloced = need; } @@ -561,19 +561,19 @@ void octave_sort<T>::MergeState::getmemi (octave_idx_type need) { - if (ia && need <= alloced) + if (m_ia && need <= m_alloced) return; need = roundupsize (need); /* Don't realloc! That can cost cycles to copy the old data, but * we don't care what's in the block. */ - delete [] a; - delete [] ia; + delete [] m_a; + delete [] m_ia; - a = new T [need]; - ia = new octave_idx_type [need]; - alloced = need; + m_a = new T [need]; + m_ia = new octave_idx_type [need]; + m_alloced = need; } /* Merge the na elements starting at pa with the nb elements starting at pb @@ -592,13 +592,13 @@ octave_idx_type k; T *dest; int result = -1; /* guilty until proved innocent */ - octave_idx_type min_gallop = ms->min_gallop; + octave_idx_type min_gallop = m_ms->m_min_gallop; - ms->getmem (na); + m_ms->getmem (na); - std::copy (pa, pa + na, ms->a); + std::copy (pa, pa + na, m_ms->m_a); dest = pa; - pa = ms->a; + pa = m_ms->m_a; *dest++ = *pb++; --nb; @@ -654,7 +654,7 @@ do { min_gallop -= (min_gallop > 1); - ms->min_gallop = min_gallop; + m_ms->m_min_gallop = min_gallop; k = gallop_right (*pb, pa, na, 0, comp); acount = k; if (k) @@ -698,7 +698,7 @@ while (acount >= MIN_GALLOP || bcount >= MIN_GALLOP); ++min_gallop; /* penalize it for leaving galloping mode */ - ms->min_gallop = min_gallop; + m_ms->m_min_gallop = min_gallop; } Succeed: @@ -728,14 +728,14 @@ T *dest; octave_idx_type *idest; int result = -1; /* guilty until proved innocent */ - octave_idx_type min_gallop = ms->min_gallop; + octave_idx_type min_gallop = m_ms->m_min_gallop; - ms->getmemi (na); + m_ms->getmemi (na); - std::copy (pa, pa + na, ms->a); - std::copy (ipa, ipa + na, ms->ia); + std::copy (pa, pa + na, m_ms->m_a); + std::copy (ipa, ipa + na, m_ms->m_ia); dest = pa; idest = ipa; - pa = ms->a; ipa = ms->ia; + pa = m_ms->m_a; ipa = m_ms->m_ia; *dest++ = *pb++; *idest++ = *ipb++; --nb; @@ -788,7 +788,7 @@ do { min_gallop -= (min_gallop > 1); - ms->min_gallop = min_gallop; + m_ms->m_min_gallop = min_gallop; k = gallop_right (*pb, pa, na, 0, comp); acount = k; if (k) @@ -834,7 +834,7 @@ while (acount >= MIN_GALLOP || bcount >= MIN_GALLOP); ++min_gallop; /* penalize it for leaving galloping mode */ - ms->min_gallop = min_gallop; + m_ms->m_min_gallop = min_gallop; } Succeed: @@ -875,15 +875,15 @@ T *dest; int result = -1; /* guilty until proved innocent */ T *basea, *baseb; - octave_idx_type min_gallop = ms->min_gallop; + octave_idx_type min_gallop = m_ms->m_min_gallop; - ms->getmem (nb); + m_ms->getmem (nb); dest = pb + nb - 1; - std::copy (pb, pb + nb, ms->a); + std::copy (pb, pb + nb, m_ms->m_a); basea = pa; - baseb = ms->a; - pb = ms->a + nb - 1; + baseb = m_ms->m_a; + pb = m_ms->m_a + nb - 1; pa += na - 1; *dest-- = *pa--; @@ -936,7 +936,7 @@ do { min_gallop -= (min_gallop > 1); - ms->min_gallop = min_gallop; + m_ms->m_min_gallop = min_gallop; k = gallop_right (*pb, basea, na, na-1, comp); if (k < 0) goto Fail; @@ -981,7 +981,7 @@ goto Succeed; } while (acount >= MIN_GALLOP || bcount >= MIN_GALLOP); ++min_gallop; /* penalize it for leaving galloping mode */ - ms->min_gallop = min_gallop; + m_ms->m_min_gallop = min_gallop; } Succeed: @@ -1014,17 +1014,17 @@ int result = -1; /* guilty until proved innocent */ T *basea, *baseb; octave_idx_type *ibaseb; - octave_idx_type min_gallop = ms->min_gallop; + octave_idx_type min_gallop = m_ms->m_min_gallop; - ms->getmemi (nb); + m_ms->getmemi (nb); dest = pb + nb - 1; idest = ipb + nb - 1; - std::copy (pb, pb + nb, ms->a); - std::copy (ipb, ipb + nb, ms->ia); + std::copy (pb, pb + nb, m_ms->m_a); + std::copy (ipb, ipb + nb, m_ms->m_ia); basea = pa; - baseb = ms->a; ibaseb = ms->ia; - pb = ms->a + nb - 1; ipb = ms->ia + nb - 1; + baseb = m_ms->m_a; ibaseb = m_ms->m_ia; + pb = m_ms->m_a + nb - 1; ipb = m_ms->m_ia + nb - 1; pa += na - 1; ipa += na - 1; *dest-- = *pa--; *idest-- = *ipa--; @@ -1077,7 +1077,7 @@ do { min_gallop -= (min_gallop > 1); - ms->min_gallop = min_gallop; + m_ms->m_min_gallop = min_gallop; k = gallop_right (*pb, basea, na, na-1, comp); if (k < 0) goto Fail; @@ -1124,7 +1124,7 @@ goto Succeed; } while (acount >= MIN_GALLOP || bcount >= MIN_GALLOP); ++min_gallop; /* penalize it for leaving galloping mode */ - ms->min_gallop = min_gallop; + m_ms->m_min_gallop = min_gallop; } Succeed: @@ -1161,19 +1161,19 @@ octave_idx_type na, nb; octave_idx_type k; - pa = data + ms->pending[i].base; - na = ms->pending[i].len; - pb = data + ms->pending[i+1].base; - nb = ms->pending[i+1].len; + pa = data + m_ms->m_pending[i].m_base; + na = m_ms->m_pending[i].m_len; + pb = data + m_ms->m_pending[i+1].m_base; + nb = m_ms->m_pending[i+1].m_len; /* Record the length of the combined runs; if i is the 3rd-last * run now, also slide over the last run (which isn't involved * in this merge). The current run i+1 goes away in any case. */ - ms->pending[i].len = na + nb; - if (i == ms->n - 3) - ms->pending[i+1] = ms->pending[i+2]; - ms->n--; + m_ms->m_pending[i].m_len = na + nb; + if (i == m_ms->m_n - 3) + m_ms->m_pending[i+1] = m_ms->m_pending[i+2]; + m_ms->m_n--; /* Where does b start in a? Elements in a before that can be * ignored (already in place). @@ -1213,21 +1213,21 @@ octave_idx_type na, nb; octave_idx_type k; - pa = data + ms->pending[i].base; - ipa = idx + ms->pending[i].base; - na = ms->pending[i].len; - pb = data + ms->pending[i+1].base; - ipb = idx + ms->pending[i+1].base; - nb = ms->pending[i+1].len; + pa = data + m_ms->m_pending[i].m_base; + ipa = idx + m_ms->m_pending[i].m_base; + na = m_ms->m_pending[i].m_len; + pb = data + m_ms->m_pending[i+1].m_base; + ipb = idx + m_ms->m_pending[i+1].m_base; + nb = m_ms->m_pending[i+1].m_len; /* Record the length of the combined runs; if i is the 3rd-last * run now, also slide over the last run (which isn't involved * in this merge). The current run i+1 goes away in any case. */ - ms->pending[i].len = na + nb; - if (i == ms->n - 3) - ms->pending[i+1] = ms->pending[i+2]; - ms->n--; + m_ms->m_pending[i].m_len = na + nb; + if (i == m_ms->m_n - 3) + m_ms->m_pending[i+1] = m_ms->m_pending[i+2]; + m_ms->m_n--; /* Where does b start in a? Elements in a before that can be * ignored (already in place). @@ -1271,19 +1271,19 @@ int octave_sort<T>::merge_collapse (T *data, Comp comp) { - struct s_slice *p = ms->pending; + struct s_slice *p = m_ms->m_pending; - while (ms->n > 1) + while (m_ms->m_n > 1) { - octave_idx_type n = ms->n - 2; - if (n > 0 && p[n-1].len <= p[n].len + p[n+1].len) + octave_idx_type n = m_ms->m_n - 2; + if (n > 0 && p[n-1].m_len <= p[n].m_len + p[n+1].m_len) { - if (p[n-1].len < p[n+1].len) + if (p[n-1].m_len < p[n+1].m_len) --n; if (merge_at (n, data, comp) < 0) return -1; } - else if (p[n].len <= p[n+1].len) + else if (p[n].m_len <= p[n+1].m_len) { if (merge_at (n, data, comp) < 0) return -1; @@ -1300,19 +1300,19 @@ int octave_sort<T>::merge_collapse (T *data, octave_idx_type *idx, Comp comp) { - struct s_slice *p = ms->pending; + struct s_slice *p = m_ms->m_pending; - while (ms->n > 1) + while (m_ms->m_n > 1) { - octave_idx_type n = ms->n - 2; - if (n > 0 && p[n-1].len <= p[n].len + p[n+1].len) + octave_idx_type n = m_ms->m_n - 2; + if (n > 0 && p[n-1].m_len <= p[n].m_len + p[n+1].m_len) { - if (p[n-1].len < p[n+1].len) + if (p[n-1].m_len < p[n+1].m_len) --n; if (merge_at (n, data, idx, comp) < 0) return -1; } - else if (p[n].len <= p[n+1].len) + else if (p[n].m_len <= p[n+1].m_len) { if (merge_at (n, data, idx, comp) < 0) return -1; @@ -1334,12 +1334,12 @@ int octave_sort<T>::merge_force_collapse (T *data, Comp comp) { - struct s_slice *p = ms->pending; + struct s_slice *p = m_ms->m_pending; - while (ms->n > 1) + while (m_ms->m_n > 1) { - octave_idx_type n = ms->n - 2; - if (n > 0 && p[n-1].len < p[n+1].len) + octave_idx_type n = m_ms->m_n - 2; + if (n > 0 && p[n-1].m_len < p[n+1].m_len) --n; if (merge_at (n, data, comp) < 0) return -1; @@ -1353,12 +1353,12 @@ int octave_sort<T>::merge_force_collapse (T *data, octave_idx_type *idx, Comp comp) { - struct s_slice *p = ms->pending; + struct s_slice *p = m_ms->m_pending; - while (ms->n > 1) + while (m_ms->m_n > 1) { - octave_idx_type n = ms->n - 2; - if (n > 0 && p[n-1].len < p[n+1].len) + octave_idx_type n = m_ms->m_n - 2; + if (n > 0 && p[n-1].m_len < p[n+1].m_len) --n; if (merge_at (n, data, idx, comp) < 0) return -1; @@ -1398,10 +1398,10 @@ octave_sort<T>::sort (T *data, octave_idx_type nel, Comp comp) { /* Re-initialize the Mergestate as this might be the second time called */ - if (! ms) ms = new MergeState; + if (! m_ms) m_ms = new MergeState; - ms->reset (); - ms->getmem (MERGESTATE_TEMP_SIZE); + m_ms->reset (); + m_ms->getmem (MERGESTATE_TEMP_SIZE); if (nel > 1) { @@ -1431,11 +1431,11 @@ binarysort (data + lo, force, n, comp); n = force; } - /* Push run onto pending-runs stack, and maybe merge. */ - assert (ms->n < MAX_MERGE_PENDING); - ms->pending[ms->n].base = lo; - ms->pending[ms->n].len = n; - ms->n++; + /* Push run onto m_pending-runs stack, and maybe merge. */ + assert (m_ms->m_n < MAX_MERGE_PENDING); + m_ms->m_pending[m_ms->m_n].m_base = lo; + m_ms->m_pending[m_ms->m_n].m_len = n; + m_ms->m_n++; if (merge_collapse (data, comp) < 0) return; /* Advance to find next run. */ @@ -1455,10 +1455,10 @@ Comp comp) { /* Re-initialize the Mergestate as this might be the second time called */ - if (! ms) ms = new MergeState; + if (! m_ms) m_ms = new MergeState; - ms->reset (); - ms->getmemi (MERGESTATE_TEMP_SIZE); + m_ms->reset (); + m_ms->getmemi (MERGESTATE_TEMP_SIZE); if (nel > 1) { @@ -1491,11 +1491,11 @@ binarysort (data + lo, idx + lo, force, n, comp); n = force; } - /* Push run onto pending-runs stack, and maybe merge. */ - assert (ms->n < MAX_MERGE_PENDING); - ms->pending[ms->n].base = lo; - ms->pending[ms->n].len = n; - ms->n++; + /* Push run onto m_pending-runs stack, and maybe merge. */ + assert (m_ms->m_n < MAX_MERGE_PENDING); + m_ms->m_pending[m_ms->m_n].m_base = lo; + m_ms->m_pending[m_ms->m_n].m_len = n; + m_ms->m_n++; if (merge_collapse (data, idx, comp) < 0) return; /* Advance to find next run. */ @@ -1513,17 +1513,17 @@ octave_sort<T>::sort (T *data, octave_idx_type nel) { #if defined (INLINE_ASCENDING_SORT) - if (compare == ascending_compare) + if (m_compare == ascending_compare) sort (data, nel, std::less<T> ()); else #endif #if defined (INLINE_DESCENDING_SORT) - if (compare == descending_compare) + if (m_compare == descending_compare) sort (data, nel, std::greater<T> ()); else #endif - if (compare) - sort (data, nel, compare); + if (m_compare) + sort (data, nel, m_compare); } template <typename T> @@ -1531,17 +1531,17 @@ octave_sort<T>::sort (T *data, octave_idx_type *idx, octave_idx_type nel) { #if defined (INLINE_ASCENDING_SORT) - if (compare == ascending_compare) + if (m_compare == ascending_compare) sort (data, idx, nel, std::less<T> ()); else #endif #if defined (INLINE_DESCENDING_SORT) - if (compare == descending_compare) + if (m_compare == descending_compare) sort (data, idx, nel, std::greater<T> ()); else #endif - if (compare) - sort (data, idx, nel, compare); + if (m_compare) + sort (data, idx, nel, m_compare); } template <typename T> @@ -1571,17 +1571,17 @@ { bool retval = false; #if defined (INLINE_ASCENDING_SORT) - if (compare == ascending_compare) + if (m_compare == ascending_compare) retval = issorted (data, nel, std::less<T> ()); else #endif #if defined (INLINE_DESCENDING_SORT) - if (compare == descending_compare) + if (m_compare == descending_compare) retval = issorted (data, nel, std::greater<T> ()); else #endif - if (compare) - retval = issorted (data, nel, compare); + if (m_compare) + retval = issorted (data, nel, m_compare); return retval; } @@ -1658,17 +1658,17 @@ octave_idx_type rows, octave_idx_type cols) { #if defined (INLINE_ASCENDING_SORT) - if (compare == ascending_compare) + if (m_compare == ascending_compare) sort_rows (data, idx, rows, cols, std::less<T> ()); else #endif #if defined (INLINE_DESCENDING_SORT) - if (compare == descending_compare) + if (m_compare == descending_compare) sort_rows (data, idx, rows, cols, std::greater<T> ()); else #endif - if (compare) - sort_rows (data, idx, rows, cols, compare); + if (m_compare) + sort_rows (data, idx, rows, cols, m_compare); } template <typename T> @@ -1737,17 +1737,17 @@ bool retval = false; #if defined (INLINE_ASCENDING_SORT) - if (compare == ascending_compare) + if (m_compare == ascending_compare) retval = is_sorted_rows (data, rows, cols, std::less<T> ()); else #endif #if defined (INLINE_DESCENDING_SORT) - if (compare == descending_compare) + if (m_compare == descending_compare) retval = is_sorted_rows (data, rows, cols, std::greater<T> ()); else #endif - if (compare) - retval = is_sorted_rows (data, rows, cols, compare); + if (m_compare) + retval = is_sorted_rows (data, rows, cols, m_compare); return retval; } @@ -1783,17 +1783,17 @@ octave_idx_type retval = 0; #if defined (INLINE_ASCENDING_SORT) - if (compare == ascending_compare) + if (m_compare == ascending_compare) retval = lookup (data, nel, value, std::less<T> ()); else #endif #if defined (INLINE_DESCENDING_SORT) - if (compare == descending_compare) + if (m_compare == descending_compare) retval = lookup (data, nel, value, std::greater<T> ()); else #endif - if (compare) - retval = lookup (data, nel, value, std::ptr_fun (compare)); + if (m_compare) + retval = lookup (data, nel, value, std::ptr_fun (m_compare)); return retval; } @@ -1819,17 +1819,17 @@ octave_idx_type *idx) { #if defined (INLINE_ASCENDING_SORT) - if (compare == ascending_compare) + if (m_compare == ascending_compare) lookup (data, nel, values, nvalues, idx, std::less<T> ()); else #endif #if defined (INLINE_DESCENDING_SORT) - if (compare == descending_compare) + if (m_compare == descending_compare) lookup (data, nel, values, nvalues, idx, std::greater<T> ()); else #endif - if (compare) - lookup (data, nel, values, nvalues, idx, std::ptr_fun (compare)); + if (m_compare) + lookup (data, nel, values, nvalues, idx, std::ptr_fun (m_compare)); } template <typename T> @@ -1894,18 +1894,18 @@ octave_idx_type *idx, bool rev) { #if defined (INLINE_ASCENDING_SORT) - if (compare == ascending_compare) + if (m_compare == ascending_compare) lookup_sorted (data, nel, values, nvalues, idx, rev, std::less<T> ()); else #endif #if defined (INLINE_DESCENDING_SORT) - if (compare == descending_compare) + if (m_compare == descending_compare) lookup_sorted (data, nel, values, nvalues, idx, rev, std::greater<T> ()); else #endif - if (compare) + if (m_compare) lookup_sorted (data, nel, values, nvalues, idx, rev, - std::ptr_fun (compare)); + std::ptr_fun (m_compare)); } template <typename T> @@ -1943,17 +1943,17 @@ if (up < 0) up = lo + 1; #if defined (INLINE_ASCENDING_SORT) - if (compare == ascending_compare) + if (m_compare == ascending_compare) nth_element (data, nel, lo, up, std::less<T> ()); else #endif #if defined (INLINE_DESCENDING_SORT) - if (compare == descending_compare) + if (m_compare == descending_compare) nth_element (data, nel, lo, up, std::greater<T> ()); else #endif - if (compare) - nth_element (data, nel, lo, up, std::ptr_fun (compare)); + if (m_compare) + nth_element (data, nel, lo, up, std::ptr_fun (m_compare)); } template <typename T>
--- a/liboctave/util/oct-sort.h Sat Sep 07 10:49:03 2019 -0400 +++ b/liboctave/util/oct-sort.h Mon Sep 09 16:15:40 2019 -0400 @@ -111,7 +111,7 @@ ~octave_sort (void); - void set_compare (compare_fcn_type comp) { compare = comp; } + void set_compare (compare_fcn_type comp) { m_compare = comp; } void set_compare (sortmode mode); @@ -185,13 +185,13 @@ struct s_slice { - octave_idx_type base, len; + octave_idx_type m_base, m_len; }; struct MergeState { MergeState (void) - : min_gallop (), a (nullptr), ia (nullptr), alloced (0), n (0) + : m_min_gallop (), m_a (nullptr), m_ia (nullptr), m_alloced (0), m_n (0) { reset (); } // No copying! @@ -201,10 +201,10 @@ MergeState& operator = (const MergeState&) = delete; ~MergeState (void) - { delete [] a; delete [] ia; } + { delete [] m_a; delete [] m_ia; } void reset (void) - { min_gallop = MIN_GALLOP; n = 0; } + { m_min_gallop = MIN_GALLOP; m_n = 0; } void getmem (octave_idx_type need); @@ -214,13 +214,13 @@ // initialized to MIN_GALLOP. merge_lo and merge_hi tend to nudge // it higher for random data, and lower for highly structured // data. - octave_idx_type min_gallop; + octave_idx_type m_min_gallop; // 'a' is temp storage to help with merges. It contains room for // alloced entries. - T *a; // may point to temparray below - octave_idx_type *ia; - octave_idx_type alloced; + T *m_a; // may point to temparray below + octave_idx_type *m_ia; + octave_idx_type m_alloced; // A stack of n pending runs yet to be merged. Run #i starts at // address base[i] and extends for len[i] elements. It's always @@ -230,13 +230,13 @@ // // so we could cut the storage for this, but it's a minor amount, // and keeping all the info explicit simplifies the code. - octave_idx_type n; - struct s_slice pending[MAX_MERGE_PENDING]; + octave_idx_type m_n; + struct s_slice m_pending[MAX_MERGE_PENDING]; }; - compare_fcn_type compare; + compare_fcn_type m_compare; - MergeState *ms; + MergeState *m_ms; template <typename Comp> void binarysort (T *data, octave_idx_type nel, @@ -341,7 +341,7 @@ vec_index { public: - T vec; - octave_idx_type indx; + T m_vec; + octave_idx_type m_indx; }; #endif
--- a/liboctave/util/octave-preserve-stream-state.h Sat Sep 07 10:49:03 2019 -0400 +++ b/liboctave/util/octave-preserve-stream-state.h Mon Sep 09 16:15:40 2019 -0400 @@ -35,25 +35,25 @@ public: preserve_stream_state (std::ios& s) - : stream (s), oflags (s.flags ()), oprecision (s.precision ()), - owidth (s.width ()), ofill (s.fill ()) + : m_stream (s), m_oflags (s.flags ()), m_oprecision (s.precision ()), + m_owidth (s.width ()), m_ofill (s.fill ()) { } ~preserve_stream_state (void) { - stream.flags (oflags); - stream.precision (oprecision); - stream.width (owidth); - stream.fill (ofill); + m_stream.flags (m_oflags); + m_stream.precision (m_oprecision); + m_stream.width (m_owidth); + m_stream.fill (m_ofill); } private: - std::ios& stream; - std::ios::fmtflags oflags; - std::streamsize oprecision; - int owidth; - char ofill; + std::ios& m_stream; + std::ios::fmtflags m_oflags; + std::streamsize m_oprecision; + int m_owidth; + char m_ofill; }; }
--- a/liboctave/util/singleton-cleanup.cc Sat Sep 07 10:49:03 2019 -0400 +++ b/liboctave/util/singleton-cleanup.cc Mon Sep 09 16:15:40 2019 -0400 @@ -27,11 +27,11 @@ #include "lo-error.h" #include "singleton-cleanup.h" -singleton_cleanup_list *singleton_cleanup_list::instance = nullptr; +singleton_cleanup_list *singleton_cleanup_list::s_instance = nullptr; singleton_cleanup_list::~singleton_cleanup_list (void) { - for (fptr fcn : fcn_list) + for (fptr fcn : m_fcn_list) { fcn (); } @@ -42,8 +42,8 @@ { bool retval = true; - if (! instance) - instance = new singleton_cleanup_list (); + if (! s_instance) + s_instance = new singleton_cleanup_list (); return retval; }
--- a/liboctave/util/singleton-cleanup.h Sat Sep 07 10:49:03 2019 -0400 +++ b/liboctave/util/singleton-cleanup.h Mon Sep 09 16:15:40 2019 -0400 @@ -33,7 +33,7 @@ { protected: - singleton_cleanup_list (void) : fcn_list () { } + singleton_cleanup_list (void) : m_fcn_list () { } public: @@ -50,24 +50,32 @@ static void add (fptr f) { if (instance_ok ()) - instance->do_add (f); + s_instance->do_add (f); } - static void cleanup (void) { delete instance; instance = nullptr; } + static void cleanup (void) + { + delete s_instance; + s_instance = nullptr; + } private: - static singleton_cleanup_list *instance; + static singleton_cleanup_list *s_instance; static bool instance_ok (void); - static void cleanup_instance (void) { delete instance; instance = nullptr; } + static void cleanup_instance (void) + { + delete s_instance; + s_instance = nullptr; + } - std::set<fptr> fcn_list; + std::set<fptr> m_fcn_list; void do_add (fptr f) { - fcn_list.insert (f); + m_fcn_list.insert (f); } };