gbranden pushed a commit to branch master
in repository groff.
commit c3bf4b7557bce07c876588c224e6806c6a39dd50
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sat Mar 14 08:32:47 2026 -0500
[troff]: Boolify and rename `global_diverted_space`.
* src/roff/troff/input.cpp: Demote global variable
`global_diverted_space` from `int` to `bool` and rename it to
`have_global_diverted_space`. Annotate it as used only by the MTSM
feature, which I hope some day to either better understand, or to
remove.
* src/roff/troff/env.cpp: Update an `extern` declaration.
* src/roff/troff/input.cpp (diverted_space_node::need_reread):
* src/roff/troff/env.cpp (environment::do_break): Update sites of use.
---
ChangeLog | 14 ++++++++++++++
src/roff/troff/env.cpp | 5 +++--
src/roff/troff/input.cpp | 7 ++++---
3 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 1a2d0993f..7e61bf1af 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2026-03-14 G. Branden Robinson <[email protected]>
+
+ [troff]: Boolify and rename `global_diverted_space`.
+
+ * src/roff/troff/input.cpp: Demote global variable
+ `global_diverted_space` from `int` to `bool` and rename it to
+ `have_global_diverted_space`. Annotate it as used only by the
+ MTSM feature, which I hope some day to either better understand,
+ or to remove.
+ * src/roff/troff/env.cpp: Update an `extern` declaration.
+ * src/roff/troff/input.cpp (diverted_space_node::need_reread):
+ * src/roff/troff/env.cpp (environment::do_break): Update sites
+ of use.
+
2026-03-14 G. Branden Robinson <[email protected]>
* src/utils/pfbtops/pfbtops.am (nodist_EXTRA_pfbtops_SOURCES):
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 07d3aa4e7..db0aecd1f 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -2581,7 +2581,8 @@ void environment::construct_new_line_state(node *nd)
}
}
-extern int global_diverted_space;
+// XXX: used only by MTSM code
+extern bool have_global_diverted_space;
// "Forced adjustment" refers to spreading of adjustable spaces (and
// perhaps only that, even if in the future we implement "squeezing"),
@@ -2638,7 +2639,7 @@ void environment::do_break(bool want_forced_adjustment)
mark_last_line();
output_pending_lines();
#endif /* WIDOW_CONTROL */
- if (!global_diverted_space) {
+ if (!have_global_diverted_space) {
curdiv->modified_tag.incl(MTSM_BR);
seen_break = true;
}
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 890e8164b..d085cadd5 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -3453,16 +3453,17 @@ bool node::need_reread(bool *)
return false;
}
-int global_diverted_space = 0;
+// XXX: used only by MTSM code
+bool have_global_diverted_space = false;
bool diverted_space_node::need_reread(bool *bolp)
{
- global_diverted_space = 1;
+ have_global_diverted_space = true;
if (curenv->get_fill())
trapping_blank_line();
else
curdiv->space(n);
- global_diverted_space = 0;
+ have_global_diverted_space = false;
*bolp = true;
return true;
}
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit