gbranden pushed a commit to branch master
in repository groff.
commit 7f88ed1d7f71e2d3266f3ecbcbc685e329ce41d1
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon Mar 3 02:43:05 2025 -0600
[troff]: Implement recursive node dumping (5h/9).
* src/roff/troff/node.h (class hline_node): Specialize (override)
`dump_properties()` for this class.
* src/roff/troff/node.cpp (hline_node::dump_properties): New member
function reports value of `hunits` property.
Changes `pline` request output as follows.
-{"type": "hline_node", "diversion level": 0, "is_special_node": false},
+{"type": "hline_node", "diversion level": 0, "is_special_node": false,
"hunits": 144},
---
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 b3f20e1e4..c236c1a2d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2025-03-03 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/node.h (class hline_node): Specialize
+ {override} `dump_properties()` for this class.
+ * src/roff/troff/node.cpp (hline_node::dump_properties): New
+ member function reports value of `hunits` property.
+
2025-03-03 G. Branden Robinson <[email protected]>
* src/roff/troff/node.h (class vmotion_node): Specialize
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 4fc7c7559..276f73303 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -3115,6 +3115,13 @@ hline_node::hline_node(hunits i, node *c, statem *s, int
divlevel,
{
}
+void hline_node::dump_properties()
+{
+ node::dump_properties();
+ fprintf(stderr, ", \"hunits\": %d", x.to_units());
+ fflush(stderr);
+}
+
node *hline_node::copy()
{
return new hline_node(x, (nodes != 0 /* nullptr */) ? nodes->copy()
diff --git a/src/roff/troff/node.h b/src/roff/troff/node.h
index f3f48de3a..0a124521f 100644
--- a/src/roff/troff/node.h
+++ b/src/roff/troff/node.h
@@ -413,6 +413,7 @@ public:
void dump_properties();
};
+// TODO: Derive from abstract class `container_node`.
class hline_node : public node {
hunits x;
node *nodes;
@@ -428,6 +429,7 @@ public:
const char *type();
bool causes_tprint();
bool is_tag();
+ void dump_properties();
};
class vline_node : public node {
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit