gbranden pushed a commit to branch master
in repository groff.
commit 619203ed7b4cc2ad5975b099247e83c82fce980b
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sat Apr 27 12:05:35 2024 -0500
[troff]: Trivially refactor (4/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, environment::distance_to_next_tab)
(line_tabs_request, environment::print_env, init_env_requests): Rename
`line_tabs` to `using_line_tabs`.
* src/roff/troff/env.h (class environment):
* src/roff/troff/env.cpp (environment::get_line_tabs): Rename this...
(environment::get_using_line_tabs): ...to this.
---
ChangeLog | 10 ++++++++++
src/roff/troff/env.cpp | 22 +++++++++++-----------
src/roff/troff/env.h | 4 ++--
3 files changed, 23 insertions(+), 13 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5c481cd11..191afe401 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -42,6 +42,16 @@
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, environment::distance_to_next_tab)
+ (line_tabs_request, environment::print_env, init_env_requests):
+ Rename `line_tabs` to `using_line_tabs`.
+ * src/roff/troff/env.h (class environment):
+ * src/roff/troff/env.cpp (environment::get_line_tabs): Rename
+ this...
+ (environment::get_using_line_tabs): ...to this.
+
2024-04-27 G. Branden Robinson <[email protected]>
[troff]: Demote parameter of global `do_underline` function from
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 421ff977a..23ab6c115 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -721,7 +721,7 @@ environment::environment(symbol nm)
width_total(0),
space_total(0),
input_line_start(0),
- line_tabs(0),
+ using_line_tabs(false),
current_tab(TAB_NONE),
leader_node(0),
tab_char(0),
@@ -815,7 +815,7 @@ environment::environment(const environment *e)
width_total(0),
space_total(0),
input_line_start(0),
- line_tabs(e->line_tabs),
+ using_line_tabs(e->using_line_tabs),
current_tab(TAB_NONE),
leader_node(0),
tab_char(e->tab_char),
@@ -904,7 +904,7 @@ void environment::copy(const environment *e)
pending_lines = 0;
discarding = false;
tabs = e->tabs;
- line_tabs = e->line_tabs;
+ using_line_tabs = e->using_line_tabs;
current_tab = TAB_NONE;
has_current_field = false;
margin_character_flags = e->margin_character_flags;
@@ -2918,14 +2918,14 @@ const char *environment::get_tabs()
tab_type environment::distance_to_next_tab(hunits *distance)
{
- return line_tabs
+ return using_line_tabs
? curenv->tabs.distance_to_next_tab(get_text_length(), distance)
: curenv->tabs.distance_to_next_tab(get_input_line_position(), distance);
}
tab_type environment::distance_to_next_tab(hunits *distance, hunits *leftpos)
{
- return line_tabs
+ return using_line_tabs
? curenv->tabs.distance_to_next_tab(get_text_length(), distance, leftpos)
: curenv->tabs.distance_to_next_tab(get_input_line_position(), distance,
leftpos);
@@ -2945,15 +2945,15 @@ void line_tabs_request()
{
int n;
if (has_arg() && get_integer(&n))
- curenv->line_tabs = (n > 0);
+ curenv->using_line_tabs = (n > 0);
else
- curenv->line_tabs = 1;
+ curenv->using_line_tabs = true;
skip_line();
}
-int environment::get_line_tabs()
+int environment::get_using_line_tabs()
{
- return line_tabs;
+ return using_line_tabs;
}
void environment::wrap_up_tab()
@@ -3447,7 +3447,7 @@ void environment::print_env()
errprint(" total width: %1u\n", width_total.to_units());
errprint(" total number of spaces: %1\n", space_total);
errprint(" input line start: %1u\n", input_line_start.to_units());
- errprint(" line tabs: %1\n", line_tabs ? "yes" : "no");
+ errprint(" line tabs: %1\n", using_line_tabs ? "yes" : "no");
errprint(" discarding: %1\n", discarding ? "yes" : "no");
errprint(" spread flag set: %1\n", spreading ? "yes" : "no"); // \p
if (margin_character_node) {
@@ -4151,7 +4151,7 @@ void init_env_requests()
init_int_env_reg(".it", get_input_trap_line_count);
init_int_env_reg(".itc", get_input_trap_respects_continuation);
init_string_env_reg(".itm", get_input_trap_macro);
- init_int_env_reg(".linetabs", get_line_tabs);
+ init_int_env_reg(".linetabs", get_using_line_tabs);
init_hunits_env_reg(".lt", get_title_length);
init_unsigned_env_reg(".j", get_adjust_mode);
init_hunits_env_reg(".k", get_text_length);
diff --git a/src/roff/troff/env.h b/src/roff/troff/env.h
index 2a5c532f9..c94b323b4 100644
--- a/src/roff/troff/env.h
+++ b/src/roff/troff/env.h
@@ -189,7 +189,7 @@ class environment {
node *tab_contents;
hunits tab_width;
hunits tab_distance;
- int line_tabs;
+ bool using_line_tabs;
tab_type current_tab;
node *leader_node;
charinfo *tab_char;
@@ -310,7 +310,7 @@ public:
{ return env_half_narrow_space_width(this); }
hunits get_input_line_position();
const char *get_tabs();
- int get_line_tabs();
+ int get_using_line_tabs();
unsigned get_hyphenation_mode();
unsigned get_hyphenation_mode_default();
int get_hyphen_line_max();
_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit