gbranden pushed a commit to branch master
in repository groff.
commit 1148e36e586a123ecbfe07837286c51d01f3fecf
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sat Apr 27 02:21:23 2024 -0500
[troff]: Boolify env.cpp (14/25).
[troff]: Boolify more `environment` class member variables, member
function parameters, and local variables.
* src/roff/troff/env.h (class environment):
* src/roff/troff/env.cpp (environment::construct_state): Rename
parameter `only_eol` to `has_only_eol` and demote it from `int` to
`bool`.
* src/roff/troff/env.cpp (environment::add_char, environment::add_node):
* src/roff/troff/input.cpp (input_stack::push): Assign Boolean literals
to it.
---
ChangeLog | 9 +++++++++
src/roff/troff/env.cpp | 10 +++++-----
src/roff/troff/env.h | 2 +-
src/roff/troff/input.cpp | 2 +-
4 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 36f39e873..9d377b8c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -103,6 +103,15 @@
parameter `is_leader` from `int` to `bool`. Assign Boolean
literal to it.
+ * src/roff/troff/env.h (class environment):
+ * src/roff/troff/env.cpp
+ (environment::construct_state): Rename parameter `only_eol` to
+ `has_only_eol` and demote it from `int` to `bool`.
+ * src/roff/troff/env.cpp (environment::add_char):
+ (environment::add_node):
+ * src/roff/troff/input.cpp (input_stack::push): Assign Boolean
+ literals to it.
+
2024-04-24 G. Branden Robinson <[email protected]>
* src/roff/troff/env.cpp (tab_stops::to_string)
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index e592fcbda..b78188391 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -335,11 +335,11 @@ void environment::add_char(charinfo *ci)
#endif
if ((!suppress_push) && gc_np) {
if (gc_np && (gc_np->state == 0)) {
- gc_np->state = construct_state(0);
+ gc_np->state = construct_state(false);
gc_np->push_state = get_diversion_state();
}
else if (line && (line->state == 0)) {
- line->state = construct_state(0);
+ line->state = construct_state(false);
line->push_state = get_diversion_state();
}
}
@@ -360,7 +360,7 @@ void environment::add_node(node *n)
return;
if (!suppress_push) {
if (n->is_special && n->state == NULL)
- n->state = construct_state(0);
+ n->state = construct_state(false);
n->push_state = get_diversion_state();
}
@@ -2381,11 +2381,11 @@ void environment::dump_troff_state()
#undef SPACES
}
-statem *environment::construct_state(int only_eol)
+statem *environment::construct_state(bool has_only_eol)
{
if (is_html) {
statem *s = new statem();
- if (!only_eol) {
+ if (!has_only_eol) {
s->add_tag(MTSM_IN, indent);
s->add_tag(MTSM_LL, line_length);
s->add_tag(MTSM_PO, topdiv->get_page_offset().to_units());
diff --git a/src/roff/troff/env.h b/src/roff/troff/env.h
index 99b2dd5cb..7c692c2c9 100644
--- a/src/roff/troff/env.h
+++ b/src/roff/troff/env.h
@@ -265,7 +265,7 @@ public:
bool set_control_character(unsigned char);
unsigned char get_no_break_control_character();
bool set_no_break_control_character(unsigned char);
- statem *construct_state(int only_eol);
+ statem *construct_state(bool has_only_eol);
void print_env();
void copy(const environment *);
int is_dummy() { return dummy; }
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 71aa97a37..28278f846 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -701,7 +701,7 @@ void input_stack::push(input_iterator *in)
if (top->is_diversion) {
div_level++;
in->diversion_state = diversion_state;
- diversion_state = curenv->construct_state(0);
+ diversion_state = curenv->construct_state(false);
#if defined(DEBUGGING)
if (want_html_debugging) {
curenv->dump_troff_state();
_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit