changeset 30179:5bef5b36747e

maint: use "m_" prefix for protected member variables in class octave_user_code. * ov-usr-fcn.cc, ov-usr-fcn.h: Use "m_" prefix for protected member variables in class octave_user_code.
author Rik <rik@octave.org>
date Tue, 14 Sep 2021 17:31:49 -0700
parents d0184bad0c07
children 721bad540858
files libinterp/octave-value/ov-usr-fcn.cc libinterp/octave-value/ov-usr-fcn.h
diffstat 2 files changed, 39 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/octave-value/ov-usr-fcn.cc	Tue Sep 14 17:15:28 2021 -0700
+++ b/libinterp/octave-value/ov-usr-fcn.cc	Tue Sep 14 17:31:49 2021 -0700
@@ -73,28 +73,28 @@
   m_scope.set_user_code (nullptr);
 
   // FIXME: shouldn't this happen automatically when deleting cmd_list?
-  if (cmd_list)
+  if (m_cmd_list)
     {
       octave::event_manager& evmgr
         = octave::__get_event_manager__ ("octave_user_code::~octave_user_code");
 
-      cmd_list->remove_all_breakpoints (evmgr, file_name);
+      m_cmd_list->remove_all_breakpoints (evmgr, m_file_name);
     }
 
-  delete cmd_list;
+  delete m_cmd_list;
   delete m_file_info;
 }
 
 void
 octave_user_code::get_file_info (void)
 {
-  m_file_info = new octave::file_info (file_name);
+  m_file_info = new octave::file_info (m_file_name);
 
-  octave::sys::file_stat fs (file_name);
+  octave::sys::file_stat fs (m_file_name);
 
   if (fs && (fs.mtime () > time_parsed ()))
     warning ("function file '%s' changed since it was parsed",
-             file_name.c_str ());
+             m_file_name.c_str ());
 }
 
 std::string
@@ -139,9 +139,9 @@
 {
   std::map<std::string, octave_value> m
     = {{ "scope_info", m_scope ? m_scope.dump () : "0x0" },
-       { "file_name", file_name },
-       { "time_parsed", t_parsed },
-       { "time_checked", t_checked }};
+       { "m_file_name", m_file_name },
+       { "time_parsed", m_t_parsed },
+       { "time_checked", m_t_checked }};
 
   return octave_value (m);
 }
@@ -163,8 +163,8 @@
    const std::string& ds)
   : octave_user_code (fnm, nm, scope, cmds, ds)
 {
-  if (cmd_list)
-    cmd_list->mark_as_script_body ();
+  if (m_cmd_list)
+    m_cmd_list->mark_as_script_body ();
 }
 
 octave_user_script::octave_user_script
@@ -224,8 +224,8 @@
     m_anonymous_function (false), m_nested_function (false),
     m_class_constructor (none), m_class_method (none)
 {
-  if (cmd_list)
-    cmd_list->mark_as_function_body ();
+  if (m_cmd_list)
+    m_cmd_list->mark_as_function_body ();
 }
 
 octave_user_function::~octave_user_function (void)
@@ -255,22 +255,22 @@
 void
 octave_user_function::maybe_relocate_end_internal (void)
 {
-  if (cmd_list && ! cmd_list->empty ())
+  if (m_cmd_list && ! m_cmd_list->empty ())
     {
-      octave::tree_statement *last_stmt = cmd_list->back ();
+      octave::tree_statement *last_stmt = m_cmd_list->back ();
 
       if (last_stmt && last_stmt->is_end_of_fcn_or_script ()
           && last_stmt->is_end_of_file ())
         {
           octave::tree_statement_list::reverse_iterator
-            next_to_last_elt = cmd_list->rbegin ();
+            next_to_last_elt = m_cmd_list->rbegin ();
 
           next_to_last_elt++;
 
           int new_eof_line;
           int new_eof_col;
 
-          if (next_to_last_elt == cmd_list->rend ())
+          if (next_to_last_elt == m_cmd_list->rend ())
             {
               new_eof_line = beginning_line ();
               new_eof_col = beginning_column ();
@@ -339,7 +339,7 @@
 void
 octave_user_function::mark_as_system_fcn_file (void)
 {
-  if (! file_name.empty ())
+  if (! m_file_name.empty ())
     {
       // We really should stash the whole path to the file we found,
       // when we looked it up, to avoid possible race conditions...
@@ -350,7 +350,7 @@
       // function file is parsed, it probably doesn't matter that
       // much.
 
-      std::string ff_name = octave::fcn_file_in_path (file_name);
+      std::string ff_name = octave::fcn_file_in_path (m_file_name);
 
       static const std::string canonical_fcn_file_dir
         = octave::sys::canonicalize_file_name
@@ -505,9 +505,9 @@
 octave_user_function::special_expr (void)
 {
   assert (is_special_expr ());
-  assert (cmd_list->length () == 1);
+  assert (m_cmd_list->length () == 1);
 
-  octave::tree_statement *stmt = cmd_list->front ();
+  octave::tree_statement *stmt = m_cmd_list->front ();
   return stmt->expression ();
 }
 
--- a/libinterp/octave-value/ov-usr-fcn.h	Tue Sep 14 17:15:28 2021 -0700
+++ b/libinterp/octave-value/ov-usr-fcn.h	Tue Sep 14 17:31:49 2021 -0700
@@ -63,10 +63,10 @@
                     const octave::symbol_scope& scope = octave::symbol_scope (),
                     octave::tree_statement_list *cmds = nullptr,
                     const std::string& ds = "")
-    : octave_function (nm, ds), m_scope (scope), file_name (fnm),
-      t_parsed (static_cast<time_t> (0)),
-      t_checked (static_cast<time_t> (0)),
-      m_file_info (nullptr), cmd_list (cmds)
+    : octave_function (nm, ds), m_scope (scope), m_file_name (fnm),
+      m_t_parsed (static_cast<time_t> (0)),
+      m_t_checked (static_cast<time_t> (0)),
+      m_file_info (nullptr), m_cmd_list (cmds)
   {
     if (m_scope)
       m_scope.set_user_code (this);
@@ -86,28 +86,30 @@
 
   std::string get_code_line (std::size_t line);
 
-  std::deque<std::string> get_code_lines (std::size_t line, std::size_t num_lines);
+  std::deque<std::string> get_code_lines (std::size_t line,
+                                          std::size_t num_lines);
 
   void cache_function_text (const std::string& text,
                             const octave::sys::time& timestamp);
 
   octave::symbol_scope scope (void) { return m_scope; }
 
-  void stash_fcn_file_name (const std::string& nm) { file_name = nm; }
+  void stash_fcn_file_name (const std::string& nm) { m_file_name = nm; }
 
-  void mark_fcn_file_up_to_date (const octave::sys::time& t) { t_checked = t; }
+  void mark_fcn_file_up_to_date (const octave::sys::time& t)
+  { m_t_checked = t; }
 
   void stash_fcn_file_time (const octave::sys::time& t)
   {
-    t_parsed = t;
+    m_t_parsed = t;
     mark_fcn_file_up_to_date (t);
   }
 
-  std::string fcn_file_name (void) const { return file_name; }
+  std::string fcn_file_name (void) const { return m_file_name; }
 
-  octave::sys::time time_parsed (void) const { return t_parsed; }
+  octave::sys::time time_parsed (void) const { return m_t_parsed; }
 
-  octave::sys::time time_checked (void) const { return t_checked; }
+  octave::sys::time time_checked (void) const { return m_t_checked; }
 
   virtual octave_value find_subfunction (const std::string&) const
   {
@@ -116,7 +118,7 @@
 
   virtual std::map<std::string, octave_value> subfunctions (void) const;
 
-  octave::tree_statement_list * body (void) { return cmd_list; }
+  octave::tree_statement_list * body (void) { return m_cmd_list; }
 
   octave_value dump (void) const;
 
@@ -128,21 +130,21 @@
   octave::symbol_scope m_scope;
 
   // The name of the file we parsed.
-  std::string file_name;
+  std::string m_file_name;
 
   // The time the file was parsed.
-  octave::sys::time t_parsed;
+  octave::sys::time m_t_parsed;
 
   // The time the file was last checked to see if it needs to be
   // parsed again.
-  octave::sys::time t_checked;
+  octave::sys::time m_t_checked;
 
   // Cached text of function or script code with line offsets
   // calculated.
   octave::file_info *m_file_info;
 
   // The list of commands that make up the body of this function.
-  octave::tree_statement_list *cmd_list;
+  octave::tree_statement_list *m_cmd_list;
 };
 
 // Scripts.