gbranden pushed a commit to branch master
in repository groff.

commit f663aaa1b65a5189b66e2b546341f6772c417843
Author: G. Branden Robinson <g.branden.robin...@gmail.com>
AuthorDate: Mon Mar 3 02:15:30 2025 -0600

    [troff]: Implement recursive node dumping (5f/9).
    
    * src/roff/troff/node.h (class hmotion_node): Specialize (override)
      `dump_properties()` for this class.
    
    * src/roff/troff/node.cpp (hmotion_node::dump_properties): New member
      function reports values of `hunits`, `was_tab`, `unformat`, and
      `terminal_color` properties.
    
    Changes `pline` request output as follows.
    
    -{"type": "hmotion_node", "diversion level": 0, "is_special_node": false},
    +{"type": "hmotion_node", "diversion level": 0, "is_special_node": false, 
"hunits": 10000, "was_tab": false, "unformat": false, "terminal_color": 
"default"},
---
 ChangeLog               |  8 ++++++++
 src/roff/troff/node.cpp | 11 +++++++++++
 src/roff/troff/node.h   |  1 +
 3 files changed, 20 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 708c2572a..c39e2b7a1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2025-03-03  G. Branden Robinson <g.branden.robin...@gmail.com>
+
+       * src/roff/troff/node.h (class hmotion_node): Specialize
+       {override} `dump_properties()` for this class.
+       * src/roff/troff/node.cpp (hmotion_node::dump_properties): New
+       member function reports values of `hunits`, `was_tab`,
+       `unformat`, and `terminal_color` properties.
+
 2025-03-03  G. Branden Robinson <g.branden.robin...@gmail.com>
 
        * src/roff/troff/node.h (class vertical_size_node): Specialize
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 4a3e77b84..0573f10ac 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -3044,6 +3044,17 @@ void vertical_size_node::dump_properties()
   fflush(stderr);
 }
 
+void hmotion_node::dump_properties()
+{
+  node::dump_properties();
+  fprintf(stderr, ", \"hunits\": %d", n.to_units());
+  fprintf(stderr, ", \"was_tab\": %s", was_tab ? "true" : "false");
+  fprintf(stderr, ", \"unformat\": %s", unformat ? "true" : "false");
+  fputs(", \"terminal_color\": ", stderr);
+  col->nm.json_dump();
+  fflush(stderr);
+}
+
 node *hmotion_node::copy()
 {
   return new hmotion_node(n, was_tab, unformat, col, state, div_nest_level);
diff --git a/src/roff/troff/node.h b/src/roff/troff/node.h
index 0a0a35f00..12654f5cc 100644
--- a/src/roff/troff/node.h
+++ b/src/roff/troff/node.h
@@ -375,6 +375,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 space_char_hmotion_node : public hmotion_node {

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

Reply via email to