gbranden pushed a commit to branch master
in repository groff.
commit eb354331cc21eafca023a98d24900acbeab65a7e
Author: G. Branden Robinson <[email protected]>
AuthorDate: Wed Apr 22 11:27:18 2026 -0500
[troff]: Trivially refactor.
Rename `get_flags()` global function to `recompute_character_flags()`.
In addition to being more clear and explicit, it avoids a collision with
the `charinfo` class's own `get_flags()` member function.
* src/roff/troff/input.cpp (get_flags): Rename this...
(recompute_character_flags): ...to this.
* src/roff/troff/charinfo.h: Update `extern` declaration "importing" the
symbol.
(charinfo::overlaps_horizontally)
(charinfo::overlaps_vertically)
(charinfo::allows_break_before)
(charinfo::allows_break_after)
(charinfo::ends_sentence)
(charinfo::is_transparent_to_end_of_sentence)
(charinfo::ignores_surrounding_hyphenation_codes)
(charinfo::prohibits_break_before)
(charinfo::prohibits_break_after)
(charinfo::is_interword_space): Update call sites. Drop now-unneeded
namespace access operator.
---
ChangeLog | 23 +++++++++++++++++++++++
src/roff/troff/charinfo.h | 26 ++++++++++++++------------
src/roff/troff/input.cpp | 2 +-
3 files changed, 38 insertions(+), 13 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index cb9988264..316585d26 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2026-04-22 G. Branden Robinson <[email protected]>
+
+ [troff]: Trivially refactor. Rename `get_flags()` global
+ function to `recompute_character_flags()`. In addition to being
+ more clear and explicit, it avoids a collision with the
+ `charinfo` class's own `get_flags()` member function.
+
+ * src/roff/troff/input.cpp (get_flags): Rename this...
+ (recompute_character_flags): ...to this.
+ * src/roff/troff/charinfo.h: Update `extern` declaration
+ "importing" the symbol.
+ (charinfo::overlaps_horizontally)
+ (charinfo::overlaps_vertically)
+ (charinfo::allows_break_before)
+ (charinfo::allows_break_after)
+ (charinfo::ends_sentence)
+ (charinfo::is_transparent_to_end_of_sentence)
+ (charinfo::ignores_surrounding_hyphenation_codes)
+ (charinfo::prohibits_break_before)
+ (charinfo::prohibits_break_after)
+ (charinfo::is_interword_space): Update call sites. Drop now-
+ unneeded namespace access operator.
+
2026-04-22 G. Branden Robinson <[email protected]>
[troff]: Drop dead/unreachable nested character class code.
diff --git a/src/roff/troff/charinfo.h b/src/roff/troff/charinfo.h
index 90f3840c9..ef8bba7fb 100644
--- a/src/roff/troff/charinfo.h
+++ b/src/roff/troff/charinfo.h
@@ -20,8 +20,10 @@ along with this program. If not, see
<http://www.gnu.org/licenses/>. */
#include <vector>
#include <utility>
-extern bool using_character_classes; // if `.class` is invoked
-extern void get_flags();
+extern bool using_character_classes; // was `class` request invoked?
+
+// input.cpp
+extern void recompute_character_flags();
class macro;
@@ -130,70 +132,70 @@ extern charinfo *charset_table[];
inline bool charinfo::overlaps_horizontally()
{
if (using_character_classes)
- ::get_flags();
+ recompute_character_flags();
return (flags & OVERLAPS_HORIZONTALLY);
}
inline bool charinfo::overlaps_vertically()
{
if (using_character_classes)
- ::get_flags();
+ recompute_character_flags();
return (flags & OVERLAPS_VERTICALLY);
}
inline bool charinfo::allows_break_before()
{
if (using_character_classes)
- ::get_flags();
+ recompute_character_flags();
return (flags & ALLOWS_BREAK_BEFORE);
}
inline bool charinfo::allows_break_after()
{
if (using_character_classes)
- ::get_flags();
+ recompute_character_flags();
return (flags & ALLOWS_BREAK_AFTER);
}
inline bool charinfo::ends_sentence()
{
if (using_character_classes)
- ::get_flags();
+ recompute_character_flags();
return (flags & ENDS_SENTENCE);
}
inline bool charinfo::is_transparent_to_end_of_sentence()
{
if (using_character_classes)
- ::get_flags();
+ recompute_character_flags();
return (flags & IS_TRANSPARENT_TO_END_OF_SENTENCE);
}
inline bool charinfo::ignores_surrounding_hyphenation_codes()
{
if (using_character_classes)
- ::get_flags();
+ recompute_character_flags();
return (flags & IGNORES_SURROUNDING_HYPHENATION_CODES);
}
inline bool charinfo::prohibits_break_before()
{
if (using_character_classes)
- ::get_flags();
+ recompute_character_flags();
return (flags & PROHIBITS_BREAK_BEFORE);
}
inline bool charinfo::prohibits_break_after()
{
if (using_character_classes)
- ::get_flags();
+ recompute_character_flags();
return (flags & PROHIBITS_BREAK_AFTER);
}
inline bool charinfo::is_interword_space()
{
if (using_character_classes)
- ::get_flags();
+ recompute_character_flags();
return (flags & IS_INTERWORD_SPACE);
}
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index f4e68c6ca..010450c59 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -11046,7 +11046,7 @@ void charinfo::set_translation(charinfo *ci, bool
transparently,
}
// Recompute flags for all entries in the charinfo dictionary.
-void get_flags()
+void recompute_character_flags()
{
dictionary_iterator iter(charinfo_dictionary);
charinfo *ci;
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit