changeset 27327:728e4d99febb

use m_ prefix for gh_manager data members * graphics.in.h, graphics.cc (class gh_manager): Use m_ prefix for data member names. Change all uses.
author John W. Eaton <jwe@octave.org>
date Mon, 05 Aug 2019 14:42:37 -0500
parents a6907d46464f
children d5e24466835f
files libinterp/corefcn/graphics.cc libinterp/corefcn/graphics.in.h
diffstat 2 files changed, 88 insertions(+), 88 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/graphics.cc	Mon Aug 05 20:18:04 2019 -0700
+++ b/libinterp/corefcn/graphics.cc	Mon Aug 05 14:42:37 2019 -0500
@@ -2742,7 +2742,7 @@
 
       retval = 1;
 
-      while (handle_map.find (retval) != handle_map.end ())
+      while (m_handle_map.find (retval) != m_handle_map.end ())
         retval++;
     }
   else
@@ -2751,18 +2751,18 @@
       // fractional part.  To avoid running out of integers, we recycle the
       // integer part but tack on a new random part each time.
 
-      auto p = handle_free_list.begin ();
-
-      if (p != handle_free_list.end ())
+      auto p = m_handle_free_list.begin ();
+
+      if (p != m_handle_free_list.end ())
         {
           retval = *p;
-          handle_free_list.erase (p);
+          m_handle_free_list.erase (p);
         }
       else
         {
-          retval = graphics_handle (next_handle);
-
-          next_handle = std::ceil (next_handle) - 1.0 - make_handle_fraction ();
+          retval = graphics_handle (m_next_handle);
+
+          m_next_handle = std::ceil (m_next_handle) - 1.0 - make_handle_fraction ();
         }
     }
 
@@ -2785,9 +2785,9 @@
       if (h.value () == 0)
         error ("graphics_handle::free: can't delete root object");
 
-      auto p = handle_map.find (h);
-
-      if (p == handle_map.end ())
+      auto p = m_handle_map.find (h);
+
+      if (p == m_handle_map.end ())
         error ("graphics_handle::free: invalid object %g", h.value ());
 
       base_properties& bp = p->second.get_properties ();
@@ -2832,10 +2832,10 @@
       // running out of integers, we recycle the integer part
       // but tack on a new random part each time.
 
-      handle_map.erase (p);
+      m_handle_map.erase (p);
 
       if (h.value () < 0)
-        handle_free_list.insert
+        m_handle_free_list.insert
           (std::ceil (h.value ()) - make_handle_fraction ());
     }
 }
@@ -2844,22 +2844,22 @@
 gh_manager::do_renumber_figure (const graphics_handle& old_gh,
                                 const graphics_handle& new_gh)
 {
-  auto p = handle_map.find (old_gh);
-
-  if (p == handle_map.end ())
+  auto p = m_handle_map.find (old_gh);
+
+  if (p == m_handle_map.end ())
     error ("graphics_handle::free: invalid object %g", old_gh.value ());
 
   graphics_object go = p->second;
 
-  handle_map.erase (p);
-
-  handle_map[new_gh] = go;
+  m_handle_map.erase (p);
+
+  m_handle_map[new_gh] = go;
 
   if (old_gh.value () < 0)
-    handle_free_list.insert (std::ceil (old_gh.value ())
+    m_handle_free_list.insert (std::ceil (old_gh.value ())
                              - make_handle_fraction ());
 
-  for (auto& hfig : figure_list)
+  for (auto& hfig : m_figure_list)
     {
       if (hfig == old_gh)
         {
@@ -3010,9 +3010,9 @@
 {
   // FIXME: should we process or discard pending events?
 
-  event_queue.clear ();
-
-  // Don't use figure_list_iterator because we'll be removing elements
+  m_event_queue.clear ();
+
+  // Don't use m_figure_list_iterator because we'll be removing elements
   // from the list elsewhere.
 
   Matrix hlist = do_figure_handle_list (true);
@@ -3046,7 +3046,7 @@
 
   // Clear all callback objects from our list.
 
-  callback_objects.clear ();
+  m_callback_objects.clear ();
 }
 
 static void
@@ -11297,12 +11297,12 @@
 // We use a random value for the handle to avoid issues with plots and
 // scalar values for the first argument.
 gh_manager::gh_manager (octave::interpreter& interp)
-  : m_interpreter (interp), handle_map (), handle_free_list (),
-    next_handle (-1.0 - (rand () + 1.0) / (RAND_MAX + 2.0)),
-    figure_list (), graphics_lock (),  event_queue (),
-    callback_objects (), event_processing (0)
-{
-  handle_map[0] = graphics_object (new root_figure ());
+  : m_interpreter (interp), m_handle_map (), m_handle_free_list (),
+    m_next_handle (-1.0 - (rand () + 1.0) / (RAND_MAX + 2.0)),
+    m_figure_list (), m_graphics_lock (),  m_event_queue (),
+    m_callback_objects (), m_event_processing (0)
+{
+  m_handle_map[0] = graphics_object (new root_figure ());
 
   octave::gtk_manager& gtk_mgr = octave::__get_gtk_manager__ ("gh_manager");
 
@@ -11332,7 +11332,7 @@
 
   graphics_object go (bgo);
 
-  handle_map[h] = go;
+  m_handle_map[h] = go;
 
   // Overriding defaults will work now because the handle is valid
   // and we can find parent objects (not just handles).
@@ -11380,7 +11380,7 @@
   base_graphics_object *bgo = new figure (h, 0);
   graphics_object go (bgo);
 
-  handle_map[h] = go;
+  m_handle_map[h] = go;
 
   // Notify graphics toolkit.
   if (do_notify_toolkit)
@@ -11396,17 +11396,17 @@
 {
   do_pop_figure (h);
 
-  figure_list.push_front (h);
+  m_figure_list.push_front (h);
 }
 
 void
 gh_manager::do_pop_figure (const graphics_handle& h)
 {
-  for (auto it = figure_list.begin (); it != figure_list.end (); it++)
+  for (auto it = m_figure_list.begin (); it != m_figure_list.end (); it++)
     {
       if (*it == h)
         {
-          figure_list.erase (it);
+          m_figure_list.erase (it);
           break;
         }
     }
@@ -11643,10 +11643,10 @@
 {
   gh_manager::auto_lock guard;
 
-  callback_objects.pop_front ();
-
-  xset_gcbo (callback_objects.empty ()
-             ? graphics_handle () : callback_objects.front ().get_handle ());
+  m_callback_objects.pop_front ();
+
+  xset_gcbo (m_callback_objects.empty ()
+             ? graphics_handle () : m_callback_objects.front ().get_handle ());
 }
 
 void
@@ -11689,7 +11689,7 @@
           // FIXME: Is the lock necessary when we're only calling a
           //        const "get" method?
           gh_manager::auto_lock guard;
-          callback_objects.push_front (go);
+          m_callback_objects.push_front (go);
           xset_gcbo (h);
         }
 
@@ -11785,7 +11785,7 @@
 void
 gh_manager::do_post_event (const graphics_event& e)
 {
-  event_queue.push_back (e);
+  m_event_queue.push_back (e);
 
   octave::command_editor::add_event_hook (gh_manager::process_events);
 }
@@ -11860,38 +11860,38 @@
       {
         gh_manager::auto_lock guard;
 
-        if (! event_queue.empty ())
+        if (! m_event_queue.empty ())
           {
-            if (callback_objects.empty () || force)
+            if (m_callback_objects.empty () || force)
               {
-                e = event_queue.front ();
-
-                event_queue.pop_front ();
+                e = m_event_queue.front ();
+
+                m_event_queue.pop_front ();
               }
             else
               {
-                const graphics_object& go = callback_objects.front ();
+                const graphics_object& go = m_callback_objects.front ();
 
                 if (go.get_properties ().is_interruptible ())
                   {
-                    e = event_queue.front ();
-
-                    event_queue.pop_front ();
+                    e = m_event_queue.front ();
+
+                    m_event_queue.pop_front ();
                   }
                 else
                   {
-                    std::list<graphics_event>::iterator p = event_queue.begin ();
-
-                    while (p != event_queue.end ())
+                    std::list<graphics_event>::iterator p = m_event_queue.begin ();
+
+                    while (p != m_event_queue.end ())
                       if (p->get_busyaction () == base_graphics_event::CANCEL)
                         {
-                          p = event_queue.erase (p);
+                          p = m_event_queue.erase (p);
                         }
                       else if (p->get_busyaction ()
                                == base_graphics_event::INTERRUPT)
                         {
                           e = (*p);
-                          event_queue.erase (p);
+                          m_event_queue.erase (p);
                           break;
                         }
                       else
@@ -11912,7 +11912,7 @@
   {
     gh_manager::auto_lock guard;
 
-    if (event_queue.empty () && event_processing == 0)
+    if (m_event_queue.empty () && m_event_processing == 0)
       octave::command_editor::remove_event_hook (gh_manager::process_events);
   }
 
@@ -11991,15 +11991,15 @@
 
   if (enable)
     {
-      event_processing++;
+      m_event_processing++;
 
       octave::command_editor::add_event_hook (gh_manager::process_events);
     }
   else
     {
-      event_processing--;
-
-      if (event_queue.empty () && event_processing == 0)
+      m_event_processing--;
+
+      if (m_event_queue.empty () && m_event_processing == 0)
         octave::command_editor::remove_event_hook (gh_manager::process_events);
     }
 }
--- a/libinterp/corefcn/graphics.in.h	Mon Aug 05 20:18:04 2019 -0700
+++ b/libinterp/corefcn/graphics.in.h	Mon Aug 05 14:42:37 2019 -0500
@@ -6389,7 +6389,7 @@
   {
   public:
     auto_lock (bool wait = true)
-      : octave::autolock (instance().graphics_lock, wait)
+      : octave::autolock (instance().m_graphics_lock, wait)
     { }
 
     // No copying!
@@ -6414,29 +6414,29 @@
   octave::interpreter& m_interpreter;
 
   // A map of handles to graphics objects.
-  std::map<graphics_handle, graphics_object> handle_map;
+  std::map<graphics_handle, graphics_object> m_handle_map;
 
   // The available graphics handles.
-  std::set<graphics_handle> handle_free_list;
-
-  // The next handle available if handle_free_list is empty.
-  double next_handle;
+  std::set<graphics_handle> m_handle_free_list;
+
+  // The next handle available if m_handle_free_list is empty.
+  double m_next_handle;
 
   // The allocated figure handles.  Top of the stack is most recently
   // created.
-  std::list<graphics_handle> figure_list;
+  std::list<graphics_handle> m_figure_list;
 
   // The lock for accessing the graphics sytsem.
-  octave::mutex graphics_lock;
+  octave::mutex m_graphics_lock;
 
   // The list of events queued by graphics toolkits.
-  std::list<graphics_event> event_queue;
+  std::list<graphics_event> m_event_queue;
 
   // The stack of callback objects.
-  std::list<graphics_object> callback_objects;
+  std::list<graphics_object> m_callback_objects;
 
   // A flag telling whether event processing must be constantly on.
-  int event_processing;
+  int m_event_processing;
 
   graphics_handle do_get_handle (bool integer_figure_handle);
 
@@ -6448,16 +6448,16 @@
   graphics_handle do_lookup (double val)
   {
     iterator p = (octave::math::isnan (val)
-                  ? handle_map.end () : handle_map.find (val));
-
-    return (p != handle_map.end ()) ? p->first : graphics_handle ();
+                  ? m_handle_map.end () : m_handle_map.find (val));
+
+    return (p != m_handle_map.end ()) ? p->first : graphics_handle ();
   }
 
   graphics_object do_get_object (const graphics_handle& h)
   {
-    iterator p = (h.ok () ? handle_map.find (h) : handle_map.end ());
-
-    return (p != handle_map.end ()) ? p->second : graphics_object ();
+    iterator p = (h.ok () ? m_handle_map.find (h) : m_handle_map.end ());
+
+    return (p != m_handle_map.end ()) ? p->second : graphics_object ();
   }
 
   graphics_handle do_make_graphics_handle (const std::string& go_name,
@@ -6470,10 +6470,10 @@
 
   Matrix do_handle_list (bool show_hidden)
   {
-    Matrix retval (1, handle_map.size ());
+    Matrix retval (1, m_handle_map.size ());
 
     octave_idx_type i = 0;
-    for (const auto& h_iter : handle_map)
+    for (const auto& h_iter : m_handle_map)
       {
         graphics_handle h = h_iter.first;
 
@@ -6488,10 +6488,10 @@
 
   Matrix do_figure_handle_list (bool show_hidden)
   {
-    Matrix retval (1, figure_list.size ());
+    Matrix retval (1, m_figure_list.size ());
 
     octave_idx_type i = 0;
-    for (const auto& hfig : figure_list)
+    for (const auto& hfig : m_figure_list)
       {
         if (show_hidden || is_handle_visible (hfig))
           retval(i++) = hfig.value ();
@@ -6510,7 +6510,7 @@
   {
     graphics_handle retval;
 
-    for (const auto& hfig : figure_list)
+    for (const auto& hfig : m_figure_list)
       {
         if (is_handle_visible (hfig))
           retval = hfig;
@@ -6519,11 +6519,11 @@
     return retval;
   }
 
-  void do_lock (void) { graphics_lock.lock (); }
-
-  bool do_try_lock (void) { return graphics_lock.try_lock (); }
-
-  void do_unlock (void) { graphics_lock.unlock (); }
+  void do_lock (void) { m_graphics_lock.lock (); }
+
+  bool do_try_lock (void) { return m_graphics_lock.try_lock (); }
+
+  void do_unlock (void) { m_graphics_lock.unlock (); }
 
   void do_execute_listener (const graphics_handle& h, const octave_value& l);