gbranden pushed a commit to branch master
in repository groff.
commit 84bf4520bf9f1086dc4bea3007f609813f5fb52f
Author: G. Branden Robinson <[email protected]>
AuthorDate: Thu Jul 11 12:40:59 2024 -0500
[troff]: Implement `composite_node::dump_node()`.
* src/roff/troff/node.cpp (class composite_node): Declare `dump_node()`
member function.
(composite_node::dump_node): Implement.
---
ChangeLog | 6 ++++++
src/roff/troff/node.cpp | 23 +++++++++++++++++++++++
2 files changed, 29 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 8e212fe77..4b9a42562 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-07-11 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/node.cpp (class composite_node): Declare
+ `dump_node()` member function.
+ (composite_node::dump_node): Implement.
+
2024-07-11 G. Branden Robinson <[email protected]>
* doc/groff.texi.in (Groff Options):
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index b00f8377e..2c6cbbec7 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -2183,6 +2183,8 @@ void glyph_node::ascii_print(ascii_output_file *ascii)
ascii->outs(ci->nm.contents());
}
+// XXX: This and `composite_node::dump_node()` are identical. C++
+// presumably has several different solutions for this. Pick one.
void glyph_node::dump_node()
{
unsigned char c = ci->get_ascii_code();
@@ -4279,6 +4281,7 @@ public:
bool is_tag();
void vertical_extent(vunits *, vunits *);
vunits vertical_width();
+ void dump_node();
};
composite_node::composite_node(node *p, charinfo *c, tfont *t, statem *s,
@@ -4918,6 +4921,26 @@ void composite_node::tprint(troff_output_file *out)
out->right(track_kern);
}
+// XXX: This and `glyph_node::dump_node()` are identical. C++
+// presumably has several different solutions for this. Pick one.
+void composite_node::dump_node()
+{
+ unsigned char c = ci->get_ascii_code();
+ fprintf(stderr, "{type: %s, character: ", type());
+ if (c)
+ fprintf(stderr, "\"%c\"", c);
+ else
+ fprintf(stderr, "\"\\%s\"", ci->nm.contents());
+ fputs(", ", stderr);
+ if (push_state)
+ fprintf(stderr, "push_state, ");
+ if (state)
+ state->display_state();
+ fprintf(stderr, "diversion level: %d", div_nest_level);
+ fputs("}", stderr);
+ fflush(stderr);
+}
+
static node *make_composite_node(charinfo *s, environment *env)
{
int fontno = env_definite_font(env);
_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit