gbranden pushed a commit to branch master
in repository groff.

commit 309a4f6c2b32e5646ca0d564b3fd4b69588086fb
Author: G. Branden Robinson <g.branden.robin...@gmail.com>
AuthorDate: Mon Mar 3 04:27:50 2025 -0600

    [troff]: Implement recursive node dumping (5o/9).
    
    * src/roff/troff/node.h (class draw_node): Specialize (override)
      `dump_properties()` for this class.
    
    * src/roff/troff/node.cpp (draw_node::dump_properties): New member
      function reports values of `code`, `npoints`, `font_size`,
      `stroke_color`, `fill_color`, and `point` properties.
    
    Changes `pline` request output as follows.
    
    -{"type": "draw_node", "diversion level": 0, "is_special_node": false},
    +{"type": "draw_node", "diversion level": 0, "is_special_node": false, 
"code": "l", "npoints": 1, "font_size": 10000, "stroke_color": "default", 
"fill_color": "default", "point": "(72000, 72000)"},
---
 ChangeLog               |  9 +++++++++
 src/roff/troff/node.cpp | 13 +++++++++++++
 src/roff/troff/node.h   |  1 +
 3 files changed, 23 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index acb820702..c4050044f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2025-03-03  G. Branden Robinson <g.branden.robin...@gmail.com>
+
+       * src/roff/troff/node.h (class draw_node): Specialize (override)
+       `dump_properties()` for this class.
+       * src/roff/troff/node.cpp (draw_node::dump_properties): New
+       member function reports values of `code`, `npoints`,
+       `font_size`, `stroke_color`, `fill_color`, and `point`
+       properties.
+
 2025-03-03  G. Branden Robinson <g.branden.robin...@gmail.com>
 
        * src/roff/troff/node.h (class suppress_node): Specialize
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index e665e71da..facd48f88 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -4757,6 +4757,19 @@ draw_node::draw_node(char c, hvpair *p, int np, 
font_size s,
     point[i] = p[i];
 }
 
+void draw_node::dump_properties()
+{
+  node::dump_properties();
+  fprintf(stderr, ", \"code\": \"%c\"", code);
+  fprintf(stderr, ", \"npoints\": %d", npoints);
+  fprintf(stderr, ", \"font_size\": %d", sz.to_units());
+  fprintf(stderr, ", \"stroke_color\": \"%s\"", gcol->nm.contents());
+  fprintf(stderr, ", \"fill_color\": \"%s\"", fcol->nm.contents());
+  fprintf(stderr, ", \"point\": \"(%d, %d)\"",
+         point->h.to_units(), point->v.to_units());
+  fflush(stderr);
+}
+
 bool draw_node::is_same_as(node *n)
 {
   draw_node *nd = (draw_node *)n;
diff --git a/src/roff/troff/node.h b/src/roff/troff/node.h
index b2fc1e521..35b39d1ad 100644
--- a/src/roff/troff/node.h
+++ b/src/roff/troff/node.h
@@ -662,6 +662,7 @@ public:
   const char *type();
   bool causes_tprint();
   bool is_tag();
+  void dump_properties();
 };
 
 class charinfo;

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

Reply via email to