gbranden pushed a commit to branch master
in repository groff.

commit aba02db80d377e00d9e350561f1a9addf8eb6969
Author: G. Branden Robinson <g.branden.robin...@gmail.com>
AuthorDate: Mon Mar 3 02:48:59 2025 -0600

    [troff]: Implement recursive node dumping (5i/9).
    
    * src/roff/troff/node.h (class vline_node): Specialize (override)
      `dump_properties()` for this class.
    
    * src/roff/troff/node.cpp (vline_node::dump_properties): New member
      function reports value of `vunits` property.
    
    Changes `pline` request output as follows.
    
    -{"type": "vline_node", "diversion level": 0, "is_special_node": false},
    +{"type": "vline_node", "diversion level": 0, "is_special_node": false, 
"vunits": 15000},
---
 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 c236c1a2d..5e4f16eef 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 vline_node): Specialize
+       {override} `dump_properties()` for this class.
+       * src/roff/troff/node.cpp (vline_node::dump_properties): New
+       member function reports value of `vunits` property.
+
 2025-03-03  G. Branden Robinson <g.branden.robin...@gmail.com>
 
        * src/roff/troff/node.h (class hline_node): Specialize
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 276f73303..48c3fe483 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -3145,6 +3145,13 @@ vline_node::vline_node(vunits i, node *c, statem *s,
 {
 }
 
+void vline_node::dump_properties()
+{
+  node::dump_properties();
+  fprintf(stderr, ", \"vunits\": %d", x.to_units());
+  fflush(stderr);
+}
+
 vline_node::~vline_node()
 {
   delete nodes;
diff --git a/src/roff/troff/node.h b/src/roff/troff/node.h
index 0a124521f..867616be2 100644
--- a/src/roff/troff/node.h
+++ b/src/roff/troff/node.h
@@ -432,6 +432,7 @@ public:
   void dump_properties();
 };
 
+// TODO: Derive from abstract class `container_node`.
 class vline_node : public node {
   vunits x;
   node *nodes;
@@ -449,6 +450,7 @@ public:
   const char *type();
   bool causes_tprint();
   bool is_tag();
+  void dump_properties();
 };
 
 class dummy_node : public node {

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

Reply via email to