gbranden pushed a commit to branch master
in repository groff.

commit 6a79bde452a503a7e61b9c2c206ac7164ff052de
Author: G. Branden Robinson <g.branden.robin...@gmail.com>
AuthorDate: Mon Mar 3 03:11:29 2025 -0600

    [troff]: Implement recursive node dumping (5k/9).
    
    * src/roff/troff/node.h (class overstrike_node): Specialize (override)
      `dump_properties()` for this class.
    
    * src/roff/troff/node.cpp (overstrike_node::dump_properties): New member
      function reports value of `max_width` property.
    
    Changes `pline` request output as follows.
    
    -{"type": "overstrike_node", "diversion level": 0, "is_special_node": 
false},
    +{"type": "overstrike_node", "diversion level": 0, "is_special_node": 
false, "max_width": 7220},
---
 ChangeLog               | 7 +++++++
 src/roff/troff/node.cpp | 7 +++++++
 src/roff/troff/node.h   | 2 ++
 3 files changed, 16 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 784a72f3e..9b85fc47e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2025-03-03  G. Branden Robinson <g.branden.robin...@gmail.com>
+
+       * src/roff/troff/node.h (class overstrike_node): Specialize
+       {override} `dump_properties()` for this class.
+       * src/roff/troff/node.cpp (overstrike_node::dump_properties):
+       New member function reports value of `max_width` property.
+
 2025-03-03  G. Branden Robinson <g.branden.robin...@gmail.com>
 
        * src/roff/troff/node.h (class left_italic_corrected_node):
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 33aea95ab..f4a8d589e 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -3237,6 +3237,13 @@ overstrike_node::overstrike_node(statem *s, int divlevel)
 {
 }
 
+void overstrike_node::dump_properties()
+{
+  node::dump_properties();
+  fprintf(stderr, ", \"max_width\": %d", max_width.to_units());
+  fflush(stderr);
+}
+
 overstrike_node::~overstrike_node()
 {
   delete_node_list(nodes);
diff --git a/src/roff/troff/node.h b/src/roff/troff/node.h
index 4714be33d..4ab5e3aa8 100644
--- a/src/roff/troff/node.h
+++ b/src/roff/troff/node.h
@@ -529,6 +529,7 @@ public:
   void dump_properties();
 };
 
+// TODO: Derive from abstract class `container_node`.
 class overstrike_node : public node {
   node *nodes;
   hunits max_width;
@@ -547,6 +548,7 @@ public:
   node *add_self(node *, hyphen_list **);
   hyphen_list *get_hyphen_list(hyphen_list *, int *);
   hyphenation_type get_hyphenation_type();
+  void dump_properties();
 };
 
 class bracket_node : public node {

_______________________________________________
groff-commit mailing list
groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to