gbranden pushed a commit to branch master
in repository groff.
commit 2dd2f62f0e14ca4579fdcd3b55dac072f3b720cc
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon Apr 21 03:00:31 2025 -0500
[troff]: Slightly refactor (boolify).
* src/roff/troff/node.h (struct node):
* src/roff/troff/node.cpp (node::interpret): Demote return type of
`interpret` virtual member function from `int` to `bool`.
* src/roff/troff/input.cpp (class non_interpreted_char_node)
(non_interpreted_char_node::interpret)
(class non_interpreted_node)
(non_interpreted_node::interpret): Same.
* src/roff/troff/input.cpp (non_interpreted_char_node::interpret)
(non_interpreted_node::interpret): Return Boolean instead of integer
literals.
---
ChangeLog | 16 ++++++++++++++++
src/roff/troff/input.cpp | 12 ++++++------
src/roff/troff/node.cpp | 4 ++--
src/roff/troff/node.h | 2 +-
4 files changed, 25 insertions(+), 9 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 379d730be..1d609db24 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2025-04-21 G. Branden Robinson <[email protected]>
+
+ [troff]: Slightly refactor (boolify).
+
+ * src/roff/troff/node.h (struct node):
+ * src/roff/troff/node.cpp (node::interpret): Demote return type
+ of `interpret` virtual member function from `int` to `bool`.
+ * src/roff/troff/input.cpp (class non_interpreted_char_node)
+ (non_interpreted_char_node::interpret)
+ (class non_interpreted_node)
+ (non_interpreted_node::interpret): Same.
+ * src/roff/troff/input.cpp
+ (non_interpreted_char_node::interpret)
+ (non_interpreted_node::interpret): Return Boolean instead of
+ integer literals.
+
2025-04-21 G. Branden Robinson <[email protected]>
[troff]: Slightly refactor.
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 175147f51..fd25620ab 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -1287,7 +1287,7 @@ class non_interpreted_char_node : public node {
public:
non_interpreted_char_node(unsigned char);
node *copy();
- int interpret(macro *);
+ bool interpret(macro *);
bool is_same_as(node *);
const char *type();
bool causes_tprint();
@@ -1324,10 +1324,10 @@ node *non_interpreted_char_node::copy()
return new non_interpreted_char_node(c);
}
-int non_interpreted_char_node::interpret(macro *mac)
+bool non_interpreted_char_node::interpret(macro *mac)
{
mac->append(c);
- return 1;
+ return true;
}
// forward declarations
@@ -5990,7 +5990,7 @@ class non_interpreted_node : public node {
macro mac;
public:
non_interpreted_node(const macro &);
- int interpret(macro *);
+ bool interpret(macro *);
node *copy();
int ends_sentence();
bool is_same_as(node *);
@@ -6033,7 +6033,7 @@ node *non_interpreted_node::copy()
return new non_interpreted_node(mac);
}
-int non_interpreted_node::interpret(macro *m)
+bool non_interpreted_node::interpret(macro *m)
{
string_iterator si(mac);
node *n = 0 /* nullptr */;
@@ -6046,7 +6046,7 @@ int non_interpreted_node::interpret(macro *m)
else
m->append(c);
}
- return 1;
+ return true;
}
static node *do_non_interpreted() // \?
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index a5ec036d4..9bf2e80b1 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -4166,9 +4166,9 @@ hyphenation_type
unbreakable_space_node::get_hyphenation_type()
return HYPHEN_MIDDLE;
}
-int node::interpret(macro *)
+bool node::interpret(macro *)
{
- return 0;
+ return false;
}
device_extension_node::device_extension_node(const macro &m, bool b)
diff --git a/src/roff/troff/node.h b/src/roff/troff/node.h
index 889afb68d..f7381f9ad 100644
--- a/src/roff/troff/node.h
+++ b/src/roff/troff/node.h
@@ -103,7 +103,7 @@ struct node {
virtual int overlaps_vertically();
virtual int overlaps_horizontally();
virtual units size();
- virtual int interpret(macro *);
+ virtual bool interpret(macro *);
virtual node *merge_glyph_node(glyph_node *);
virtual tfont *get_tfont();
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit