[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 40/48: [troff]: Trivially refactor (3/4).
From: |
G. Branden Robinson |
Subject: |
[groff] 40/48: [troff]: Trivially refactor (3/4). |
Date: |
Sun, 28 Apr 2024 23:06:43 -0400 (EDT) |
gbranden pushed a commit to branch master
in repository groff.
commit 30af1de4639bd060f9a33dc432a6f5f909a2ae38
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Apr 27 03:55:33 2024 -0500
[troff]: Trivially refactor (3/4).
[troff]: Rename member functions and variables such that it is easier to
tell Boolean objects (or even an imperative verb/noun action) from a
countable quantity.
* src/roff/troff/env.h (class environment):
* src/roff/troff/env.cpp (environment::environment)
(environment::copy, do_underline) (environment::newline)
(environment::print_env): Rename `underline_lines` to
`underlined_line_count`.
* src/roff/troff/env.cpp (environment::print_env): Perform integer
comparison, not Boolean, test, for clarity and to ensure consistency
with *roff integer-to-Boolean conversion idiom.
---
ChangeLog | 9 +++++++++
src/roff/troff/env.cpp | 20 ++++++++++----------
src/roff/troff/env.h | 2 +-
3 files changed, 20 insertions(+), 11 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8e743d42b..5c481cd11 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -33,6 +33,15 @@
integer comparison, not Boolean, test, for clarity and to ensure
consistency with *roff integer-to-Boolean conversion idiom.
+ * src/roff/troff/env.h (class environment):
+ * src/roff/troff/env.cpp (environment::environment)
+ (environment::copy, do_underline) (environment::newline)
+ (environment::print_env): Rename `underline_lines` to
+ `underlined_line_count`.
+ * src/roff/troff/env.cpp (environment::print_env): Perform
+ integer comparison, not Boolean, test, for clarity and to ensure
+ consistency with *roff integer-to-Boolean conversion idiom.
+
2024-04-27 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Demote parameter of global `do_underline` function from
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 98d857867..421ff977a 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -712,7 +712,7 @@ environment::environment(symbol nm)
indent(0),
temporary_indent(0),
have_temporary_indent(false),
- underline_lines(0),
+ underlined_line_count(0),
underline_spaces(false),
input_trap_count(-1),
continued_input_trap(false),
@@ -806,7 +806,7 @@ environment::environment(const environment *e)
indent(e->indent),
temporary_indent(0),
have_temporary_indent(false),
- underline_lines(0),
+ underlined_line_count(0),
underline_spaces(false),
input_trap_count(-1),
continued_input_trap(false),
@@ -888,7 +888,7 @@ void environment::copy(const environment *e)
indent = e->indent;
have_temporary_indent = false;
temporary_indent = 0;
- underline_lines = 0;
+ underlined_line_count = 0;
underline_spaces = false;
input_trap_count = -1;
continued_input_trap = false;
@@ -1585,7 +1585,7 @@ void do_underline(bool want_spaces_underlined)
if (!has_arg() || !get_integer(&n))
n = 1;
if (n <= 0) {
- if (curenv->underline_lines > 0) {
+ if (curenv->underlined_line_count > 0) {
curenv->prev_fontno = curenv->fontno;
curenv->fontno = curenv->pre_underline_fontno;
if (want_spaces_underlined) {
@@ -1593,10 +1593,10 @@ void do_underline(bool want_spaces_underlined)
curenv->add_node(do_underline_special(false));
}
}
- curenv->underline_lines = 0;
+ curenv->underlined_line_count = 0;
}
else {
- curenv->underline_lines = n;
+ curenv->underlined_line_count = n;
curenv->pre_underline_fontno = curenv->fontno;
curenv->fontno = get_underline_fontno();
if (want_spaces_underlined) {
@@ -1796,8 +1796,8 @@ void environment::interrupt()
void environment::newline()
{
bool was_centered = false;
- if (underline_lines > 0) {
- if (--underline_lines == 0) {
+ if (underlined_line_count > 0) {
+ if (--underlined_line_count == 0) {
prev_fontno = fontno;
fontno = pre_underline_fontno;
if (underline_spaces) {
@@ -3432,8 +3432,8 @@ void environment::print_env()
have_temporary_indent ? "yes" : "no");
errprint(" currently used indentation: %1u\n", saved_indent.to_units());
errprint(" target text length: %1u\n", target_text_length.to_units());
- if (underline_lines) {
- errprint(" lines to underline: %1\n", underline_lines);
+ if (underlined_line_count > 0) {
+ errprint(" lines to underline: %1\n", underlined_line_count);
errprint(" font number before underlining: %1\n", pre_underline_fontno);
errprint(" underline spaces: %1\n", underline_spaces ? "yes" : "no");
}
diff --git a/src/roff/troff/env.h b/src/roff/troff/env.h
index 2e464229f..2a5c532f9 100644
--- a/src/roff/troff/env.h
+++ b/src/roff/troff/env.h
@@ -176,7 +176,7 @@ class environment {
hunits saved_indent;
hunits target_text_length;
int pre_underline_fontno;
- int underline_lines;
+ int underlined_line_count;
bool underline_spaces;
symbol input_trap;
int input_trap_count;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 40/48: [troff]: Trivially refactor (3/4).,
G. Branden Robinson <=