gbranden pushed a commit to branch master in repository groff. commit bf34c55b121ef2d444cfc7307639797b27f0ad0b Author: G. Branden Robinson <g.branden.robin...@gmail.com> AuthorDate: Mon Mar 3 11:05:34 2025 -0600
[troff]: Implement recursive node dumping (6/9). The property of the environment that holds the pending output line appears to be unique in storing the elements of its node list in reverse order. Rename function to reflect its specialized purpose. * src/roff/troff/node.cpp (dump_node_list): Rename this... (dump_node_list_in_reverse): ...to this. * src/roff/troff/env.cpp (environment::add_char) [0]: (environment::dump_pending_nodes): Update call sites. --- ChangeLog | 12 ++++++++++++ src/roff/troff/env.cpp | 10 +++++----- src/roff/troff/node.cpp | 4 ++-- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 69f92871e..0f5f87dee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2025-03-03 G. Branden Robinson <g.branden.robin...@gmail.com> + + [troff]: The property of the environment that holds the pending + output line appears to be unique in storing the elements of its + node list in reverse order. Rename function to reflect its + specialized purpose. + + * src/roff/troff/node.cpp (dump_node_list): Rename this... + (dump_node_list_in_reverse): ...to this. + * src/roff/troff/env.cpp (environment::add_char) [0]: + (environment::dump_pending_nodes): Update call sites. + 2025-03-04 G. Branden Robinson <g.branden.robin...@gmail.com> * src/roff/troff/node.h (class break_char_node): diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp index 4349bba66..37dd7954c 100644 --- a/src/roff/troff/env.cpp +++ b/src/roff/troff/env.cpp @@ -351,7 +351,7 @@ void environment::add_char(charinfo *ci) start_line(); #if 0 fprintf(stderr, "current line is\n"); - dump_node_list(line); + dump_node_list_in_reverse(line); #endif if (ci != hyphen_indicator_char) line = line->add_char(ci, this, &width_total, &space_total, &gc_np); @@ -360,7 +360,7 @@ void environment::add_char(charinfo *ci) } #if 0 fprintf(stderr, "now after we have added character the line is\n"); - dump_node_list(line); + dump_node_list_in_reverse(line); #endif if ((!suppress_push) && gc_np) { if (gc_np && (gc_np->state == 0 /* nullptr */)) { @@ -374,7 +374,7 @@ void environment::add_char(charinfo *ci) } #if 0 fprintf(stderr, "now we have possibly added the state the line is\n"); - dump_node_list(line); + dump_node_list_in_reverse(line); #endif } @@ -2418,11 +2418,11 @@ void environment::dump_troff_state() #undef SPACES } -extern void dump_node_list(node *); +extern void dump_node_list_in_reverse(node *); void environment::dump_pending_nodes() { - dump_node_list(line); + dump_node_list_in_reverse(line); } statem *environment::construct_state(bool has_only_eol) diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp index baebd6d95..d9f0e2a2d 100644 --- a/src/roff/troff/node.cpp +++ b/src/roff/troff/node.cpp @@ -2633,8 +2633,8 @@ void node::dump_node() fflush(stderr); } -// TODO: Turn this into container_node::dump(). -void dump_node_list(node *nlist) +// TODO: Move this into env.cpp. +void dump_node_list_in_reverse(node *nlist) { // It's stored in reverse order already; this puts it forward again. std::stack<node *> reversed_node_list; _______________________________________________ groff-commit mailing list groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit