gbranden pushed a commit to branch master
in repository groff.
commit 3dbbafbb58f75920f80c1fbaeef75dd14b78ec24
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon Mar 3 02:22:53 2025 -0600
[troff]: Implement recursive node dumping (5g/9).
* src/roff/troff/node.h (class vmotion_node): Specialize (override)
`dump_properties()` for this class.
* src/roff/troff/node.cpp (vmotion_node::dump_properties): New member
function reports values of `vunits` and `terminal_color` properties.
Changes `pline` request output as follows.
-{"type": "vmotion_node", "diversion level": 0, "is_special_node": false},
+{"type": "vmotion_node", "diversion level": 0, "is_special_node": false,
"vunits": 10000, "terminal_color": "default"},
---
ChangeLog | 8 ++++++++
src/roff/troff/node.cpp | 9 +++++++++
src/roff/troff/node.h | 1 +
3 files changed, 18 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index c39e2b7a1..b3f20e1e4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2025-03-03 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/node.h (class vmotion_node): Specialize
+ {override} `dump_properties()` for this class.
+ * src/roff/troff/node.cpp (vmotion_node::dump_properties): New
+ member function reports values of `vunits` and `terminal_color`
+ properties.
+
2025-03-03 G. Branden Robinson <[email protected]>
* src/roff/troff/node.h (class hmotion_node): Specialize
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 0573f10ac..4fc7c7559 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -3075,6 +3075,15 @@ vmotion_node::vmotion_node(vunits i, color *c, statem
*s, int divlevel)
{
}
+void vmotion_node::dump_properties()
+{
+ node::dump_properties();
+ fprintf(stderr, ", \"vunits\": %d", n.to_units());
+ fputs(", \"terminal_color\": ", stderr);
+ col->nm.json_dump();
+ fflush(stderr);
+}
+
node *vmotion_node::copy()
{
return new vmotion_node(n, col, state, div_nest_level);
diff --git a/src/roff/troff/node.h b/src/roff/troff/node.h
index 12654f5cc..f3f48de3a 100644
--- a/src/roff/troff/node.h
+++ b/src/roff/troff/node.h
@@ -410,6 +410,7 @@ public:
const char *type();
bool causes_tprint();
bool is_tag();
+ void dump_properties();
};
class hline_node : public node {
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit