gbranden pushed a commit to branch master
in repository groff.
commit c01c66755c8c2fb0b2298b0c26020d7d19e2eb0c
Author: G. Branden Robinson <[email protected]>
AuthorDate: Wed Apr 8 17:05:21 2026 -0500
[troff]: Refactor.
Separate engine logic from parsing logic with respect to an
environment's filling enablement.
* src/roff/troff/env.h: Stop globally declaring `fill()` and
`no_fill()`.
(class environment): Declare new member function returning `void`:
`configure_filling()`. Drop declaration of `friend` functions
`fill()` and `no_fill()`.
* src/roff/troff/env.cpp (environment::configure_filling): New function
mutates object of `environment` class.
(fill, no_fill): Replace manipulation of `environment` object's
private member variable with calls of the foregoing new public member
function.
---
ChangeLog | 16 ++++++++++++++++
src/roff/troff/env.cpp | 9 +++++++--
src/roff/troff/env.h | 5 +----
3 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 85c561c8d..02c7c75a2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2026-04-08 G. Branden Robinson <[email protected]>
+
+ [troff]: Refactor. Separate engine logic from parsing logic
+ with respect to an environment's filling enablement.
+
+ * src/roff/troff/env.h: Stop globally declaring `fill()` and
+ `no_fill()`.
+ (class environment): Declare new member function returning
+ `void`: `configure_filling()`. Drop declaration of `friend`
+ functions `fill()` and `no_fill()`.
+ * src/roff/troff/env.cpp (environment::configure_filling): New
+ function mutates object of `environment` class.
+ (fill, no_fill): Replace manipulation of `environment` object's
+ private member variable with calls of the foregoing new public
+ member function.
+
2026-04-08 G. Branden Robinson <[email protected]>
[troff]: Trivially refactor.
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 58dbd12b7..114e9ab70 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -1162,6 +1162,11 @@ int environment::get_filling()
return is_filling;
}
+void environment::configure_filling(bool b)
+{
+ is_filling = b;
+}
+
hunits environment::get_indent()
{
return indent;
@@ -1481,7 +1486,7 @@ void fill()
tok.next();
if (was_invoked_with_regular_control_character)
curenv->do_break();
- curenv->is_filling = true;
+ curenv->configure_filling(true);
tok.next();
}
@@ -1491,7 +1496,7 @@ void no_fill()
tok.next();
if (was_invoked_with_regular_control_character)
curenv->do_break();
- curenv->is_filling = false;
+ curenv->configure_filling(false);
curenv->suppress_next_eol = true;
tok.next();
}
diff --git a/src/roff/troff/env.h b/src/roff/troff/env.h
index 812a8ad69..4cfb0c44b 100644
--- a/src/roff/troff/env.h
+++ b/src/roff/troff/env.h
@@ -110,8 +110,6 @@ class pending_output_line;
// arguments and then, if everything is kosher, call curenv->[one of the
// below]? --GBR, 2026
void title_length();
-void fill();
-void no_fill();
void adjust();
void no_adjust();
void center();
@@ -304,6 +302,7 @@ public:
hunits get_emboldening_offset(); // .b
unsigned get_adjust_mode(); // .j
int get_filling(); // .u
+ void configure_filling(bool);
hunits get_indent(); // .i
hunits get_temporary_indent();
hunits get_line_length(); // .l
@@ -395,8 +394,6 @@ public:
void dump_pending_nodes();
friend void title_length();
- friend void fill();
- friend void no_fill();
friend void adjust();
friend void no_adjust();
friend void center();
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit