[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 44/60: [troff]: Boolify `forcing`.
From: |
G. Branden Robinson |
Subject: |
[groff] 44/60: [troff]: Boolify `forcing`. |
Date: |
Wed, 11 Sep 2024 03:38:34 -0400 (EDT) |
gbranden pushed a commit to branch master
in repository groff.
commit ca6801ca1c9f64d9453fc26f9a43467253f423ac
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Tue Sep 10 00:25:24 2024 -0500
[troff]: Boolify `forcing`.
* src/roff/troff/div.h (class diversion, class macro_diversion)
(class top_level_diversion): Boolify and rename `space()` member
function argument, demoting `forced` from `int` to `bool`, and
renaming it `forcing`, for symmetry with `appending` and `boxing`.
* src/roff/troff/div.cpp (macro_diversion::space)
(top_level_diversion::space, continue_page_eject, save_vertical_space)
(output_saved_vertical_space):
* src/roff/troff/input.cpp (exit_troff): Migrate.
---
ChangeLog | 12 ++++++++++++
src/roff/troff/div.cpp | 12 ++++++------
src/roff/troff/div.h | 6 +++---
src/roff/troff/input.cpp | 4 ++--
4 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d03743b5b..3e5d9b861 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-09-10 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ * src/roff/troff/div.h (class diversion, class macro_diversion)
+ (class top_level_diversion): Boolify and rename `space()` member
+ function argument, demoting `forced` from `int` to `bool`, and
+ renaming it `forcing`, for symmetry with `appending` and
+ `boxing`.
+ * src/roff/troff/div.cpp (macro_diversion::space)
+ (top_level_diversion::space, continue_page_eject)
+ (save_vertical_space, output_saved_vertical_space):
+ * src/roff/troff/input.cpp (exit_troff): Migrate.
+
2024-09-10 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/div.h (class diversion, class macro_diversion)
diff --git a/src/roff/troff/div.cpp b/src/roff/troff/div.cpp
index e7ab295a3..970259b59 100644
--- a/src/roff/troff/div.cpp
+++ b/src/roff/troff/div.cpp
@@ -338,7 +338,7 @@ void macro_diversion::output(node *nd, bool retain_size,
high_water_mark = vertical_position - v.post;
}
-void macro_diversion::space(vunits n, int)
+void macro_diversion::space(vunits n, bool /* forcing */)
{
if (honor_vertical_position_traps
&& !diversion_trap.is_null()
@@ -505,10 +505,10 @@ void top_level_diversion::copy_file(const char *filename)
the_output->copy_file(page_offset, vertical_position, filename);
}
-void top_level_diversion::space(vunits n, int forced)
+void top_level_diversion::space(vunits n, bool forcing)
{
if (is_in_no_space_mode) {
- if (!forced)
+ if (!forcing)
return;
else
is_in_no_space_mode = false;
@@ -694,7 +694,7 @@ void continue_page_eject()
" traps disabled");
else {
push_page_ejector();
- topdiv->space(topdiv->get_page_length(), 1);
+ topdiv->space(topdiv->get_page_length(), true /* forcing */);
}
}
}
@@ -904,7 +904,7 @@ void save_vertical_space()
if (!has_arg() || !get_vunits(&x, 'v'))
x = curenv->get_vertical_spacing();
if (curdiv->distance_to_next_trap() > x)
- curdiv->space(x, 1);
+ curdiv->space(x, true /* forcing */);
else
saved_space = x;
skip_line();
@@ -915,7 +915,7 @@ void output_saved_vertical_space()
while (!tok.is_newline() && !tok.is_eof())
tok.next();
if (saved_space > V0)
- curdiv->space(saved_space, 1);
+ curdiv->space(saved_space, true /* forcing */);
saved_space = V0;
tok.next();
}
diff --git a/src/roff/troff/div.h b/src/roff/troff/div.h
index 590fe95af..fef1ca680 100644
--- a/src/roff/troff/div.h
+++ b/src/roff/troff/div.h
@@ -49,7 +49,7 @@ public:
hunits /* width */) = 0;
virtual void transparent_output(unsigned char) = 0;
virtual void transparent_output(node *) = 0;
- virtual void space(vunits distance, int forced = 0) = 0;
+ virtual void space(vunits distance, bool /* forcing */ = 0) = 0;
#ifdef COLUMN
virtual void vjustify(symbol) = 0;
#endif /* COLUMN */
@@ -79,7 +79,7 @@ public:
vunits /* post_vs */, hunits /* width */);
void transparent_output(unsigned char);
void transparent_output(node *);
- void space(vunits distance, int forced = 0);
+ void space(vunits distance, bool /* forcing */ = 0);
#ifdef COLUMN
void vjustify(symbol);
#endif /* COLUMN */
@@ -119,7 +119,7 @@ public:
vunits /* post_vs */, hunits /* width */);
void transparent_output(unsigned char);
void transparent_output(node *);
- void space(vunits distance, int forced = 0);
+ void space(vunits distance, bool /* forcing */ = false);
#ifdef COLUMN
void vjustify(symbol);
#endif /* COLUMN */
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index c6719281a..f70d00087 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -2854,13 +2854,13 @@ void exit_troff()
topdiv->set_ejecting();
static unsigned char buf[2] = { LAST_PAGE_EJECTOR, '\0' };
input_stack::push(make_temp_iterator((char *)buf));
- topdiv->space(topdiv->get_page_length(), 1);
+ topdiv->space(topdiv->get_page_length(), true /* forcing */);
tok.next();
process_input_stack();
seen_last_page_ejector = 1; // should be set already
topdiv->set_ejecting();
push_page_ejector();
- topdiv->space(topdiv->get_page_length(), 1);
+ topdiv->space(topdiv->get_page_length(), true /* forcing */);
tok.next();
process_input_stack();
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 44/60: [troff]: Boolify `forcing`.,
G. Branden Robinson <=