gbranden pushed a commit to branch master
in repository groff.

commit a6f720913d5a2ebf61941232978e2e1d0129605b
Author: G. Branden Robinson <[email protected]>
AuthorDate: Tue Apr 30 20:53:48 2024 -0500

    [troff]: Trivially refactor ("debug" -> "dump").
    
    [troff]: Trivially refactor.  Rename node and node list dumping member
    function prefixes from "debug_" to "dump_", to reflect the fact that
    they're not just for (source-level) debugging anymore.
    
    * src/roff/troff/node.h (struct node): Rename.
      - `debug_node` -> `dump_node`
      - `debug_node_list` -> `dump_node_list`
    
    * src/roff/troff/node.cpp (glyph_node::debug_node)
      (node::debug_node)
      (node::debug_node_list): Rename these...
      (glyph_node::dump_node, node::debug_node)
      (node::dump_node):
      (node::dump_node_list): ...to these.
    
    * src/roff/troff/env.cpp (environment::add_char)
      (environment::dump_node_list):
    * src/roff/troff/node.cpp (node::dump_node_list): Update call sites.
---
 ChangeLog               | 21 +++++++++++++++++++++
 src/roff/troff/env.cpp  |  8 ++++----
 src/roff/troff/node.cpp | 10 +++++-----
 src/roff/troff/node.h   |  4 ++--
 4 files changed, 32 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d5086e8a7..d4d2143bc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2024-04-30  G. Branden Robinson <[email protected]>
+
+       [troff]: Trivially refactor.  Rename node and node list dumping
+       member function prefixes from "debug_" to "dump_", to reflect
+       the fact that they're not just for (source-level) debugging
+       anymore.
+
+       * src/roff/troff/node.h (struct node): Rename.
+       - `debug_node` -> `dump_node`
+       - `debug_node_list` -> `dump_node_list`
+       * src/roff/troff/node.cpp (glyph_node::debug_node)
+       (node::debug_node)
+       (node::debug_node_list): Rename these...
+       (glyph_node::dump_node, node::debug_node)
+       (node::dump_node):
+       (node::dump_node_list): ...to these.
+       * src/roff/troff/env.cpp (environment::add_char)
+       (environment::dump_node_list):
+       * src/roff/troff/node.cpp (node::dump_node_list): Update call
+       sites.
+
 2024-04-30  G. Branden Robinson <[email protected]>
 
        * src/roff/troff/node.cpp (node::debug_node): Report list of
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index e84510f36..5b19ce4ec 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -321,7 +321,7 @@ void environment::add_char(charinfo *ci)
       start_line();
 #if 0
     fprintf(stderr, "current line is\n");
-    line->debug_node_list();
+    line->dump_node_list();
 #endif
     if (ci != hyphen_indicator_char)
       line = line->add_char(ci, this, &width_total, &space_total, &gc_np);
@@ -330,7 +330,7 @@ void environment::add_char(charinfo *ci)
   }
 #if 0
   fprintf(stderr, "now after we have added character the line is\n");
-  line->debug_node_list();
+  line->dump_node_list();
 #endif
   if ((!suppress_push) && gc_np) {
     if (gc_np && (gc_np->state == 0 /* nullptr */)) {
@@ -344,7 +344,7 @@ void environment::add_char(charinfo *ci)
   }
 #if 0
   fprintf(stderr, "now we have possibly added the state the line is\n");
-  line->debug_node_list();
+  line->dump_node_list();
 #endif
 }
 
@@ -2396,7 +2396,7 @@ void environment::dump_troff_state()
 void environment::dump_node_list()
 {
   if (line != 0 /* nullptr */)
-    line->debug_node_list();
+    line->dump_node_list();
 }
 
 statem *environment::construct_state(bool has_only_eol)
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index f5d38e1e9..15875b690 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -1910,7 +1910,7 @@ public:
   const char *type();
   int force_tprint();
   bool is_tag();
-  void debug_node();
+  void dump_node();
 };
 
 class ligature_node : public glyph_node {
@@ -2182,7 +2182,7 @@ void glyph_node::ascii_print(ascii_output_file *ascii)
     ascii->outs(ci->nm.contents());
 }
 
-void glyph_node::debug_node()
+void glyph_node::dump_node()
 {
   unsigned char c = ci->get_ascii_code();
   fprintf(stderr, "{ %s [", type());
@@ -2550,7 +2550,7 @@ units node::size()
   return points_to_units(10);
 }
 
-void node::debug_node()
+void node::dump_node()
 {
   fprintf(stderr, "{ %s ", type());
   if (push_state)
@@ -2562,7 +2562,7 @@ void node::debug_node()
   fflush(stderr);
 }
 
-void node::debug_node_list()
+void node::dump_node_list()
 {
   // It's stored in reverse order already; this puts it forward again.
   std::stack<node *> reversed_node_list;
@@ -2574,7 +2574,7 @@ void node::debug_node_list()
     n = n->next;
   } while (n != 0 /* nullptr */);
   while (!reversed_node_list.empty()) {
-    reversed_node_list.top()->debug_node();
+    reversed_node_list.top()->dump_node();
     reversed_node_list.pop();
   }
 }
diff --git a/src/roff/troff/node.h b/src/roff/troff/node.h
index 2f5caa3d8..4581bb027 100644
--- a/src/roff/troff/node.h
+++ b/src/roff/troff/node.h
@@ -114,8 +114,8 @@ struct node {
 
   virtual bool is_same_as(node *) = 0;
   virtual const char *type() = 0;
-  virtual void debug_node();
-  virtual void debug_node_list();
+  virtual void dump_node();
+  virtual void dump_node_list();
 };
 
 inline node::node()

_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to