[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 04/18: [troff]: Slightly refactor.
From: |
G. Branden Robinson |
Subject: |
[groff] 04/18: [troff]: Slightly refactor. |
Date: |
Sun, 2 Jan 2022 10:33:57 -0500 (EST) |
gbranden pushed a commit to branch master
in repository groff.
commit e27d4d63aeef3c9ca7e926114651e47b27714ce2
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Tue Dec 28 14:45:13 2021 +1100
[troff]: Slightly refactor.
* src/roff/troff/div.cpp:
* src/roff/troff/div.h:
* src/roff/troff/input.cpp: Rename variables to reduce confusion between
"end macros" and "end-of-input macros". Call the latter "eoi" macros
for brevity.
---
ChangeLog | 10 ++++++++++
src/roff/troff/div.cpp | 12 ++++++------
src/roff/troff/div.h | 2 +-
src/roff/troff/input.cpp | 14 +++++++-------
4 files changed, 24 insertions(+), 14 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 14de27fc..9357fc07 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2021-12-28 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ [troff]: Slightly refactor.
+
+ * src/roff/troff/div.cpp:
+ * src/roff/troff/div.h:
+ * src/roff/troff/input.cpp: Rename variables to reduce confusion
+ between "end macros" and "end-of-input macros". Call the latter
+ "eoi" macros for brevity.
+
2021-12-28 G. Branden Robinson <g.branden.robinson@gmail.com>
* tmac/e.tmac: Fix code style nits.
diff --git a/src/roff/troff/div.cpp b/src/roff/troff/div.cpp
index 002d2e11..492d1ff4 100644
--- a/src/roff/troff/div.cpp
+++ b/src/roff/troff/div.cpp
@@ -34,9 +34,9 @@ along with this program. If not, see
<http://www.gnu.org/licenses/>. */
#include "nonposix.h"
bool is_exit_underway = false;
-bool is_end_macro_finished = false;
+bool is_eoi_macro_finished = false;
bool seen_last_page_ejector = false;
-static bool began_page_in_end_macro = false;
+static bool began_page_in_eoi_macro = false;
int last_page_number = 0; // if > 0, the number of the last page
// specified with -o
@@ -576,11 +576,11 @@ int top_level_diversion::begin_page(vunits n)
if (is_exit_underway) {
if (page_count == last_page_count
? curenv->is_empty()
- : (is_end_macro_finished && (seen_last_page_ejector
- || began_page_in_end_macro)))
+ : (is_eoi_macro_finished && (seen_last_page_ejector
+ || began_page_in_eoi_macro)))
cleanup_and_exit(EXIT_SUCCESS);
- if (!is_end_macro_finished)
- began_page_in_end_macro = true;
+ if (!is_eoi_macro_finished)
+ began_page_in_eoi_macro = true;
}
if (last_page_number > 0 && page_number == last_page_number)
cleanup_and_exit(EXIT_SUCCESS);
diff --git a/src/roff/troff/div.h b/src/roff/troff/div.h
index 10e75d07..15c7807a 100644
--- a/src/roff/troff/div.h
+++ b/src/roff/troff/div.h
@@ -151,7 +151,7 @@ extern top_level_diversion *topdiv;
extern diversion *curdiv;
extern bool is_exit_underway;
-extern bool is_end_macro_finished;
+extern bool is_eoi_macro_finished;
extern bool seen_last_page_ejector;
extern int last_page_number;
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 618a2854..af9b3463 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -96,7 +96,7 @@ static void enable_warning(const char *);
static void disable_warning(const char *);
static int escape_char = '\\';
-static symbol end_macro_name;
+static symbol eoi_macro_name;
static symbol blank_line_macro_name;
static symbol leading_spaces_macro_name;
static int compatible_flag = 0;
@@ -2570,8 +2570,8 @@ void exit_troff()
{
is_exit_underway = true;
topdiv->set_last_page();
- if (!end_macro_name.is_null()) {
- spring_trap(end_macro_name);
+ if (!eoi_macro_name.is_null()) {
+ spring_trap(eoi_macro_name);
tok.next();
process_input_stack();
}
@@ -2580,7 +2580,7 @@ void exit_troff()
process_input_stack();
end_diversions();
if (topdiv->get_page_length() > 0) {
- is_end_macro_finished = true;
+ is_eoi_macro_finished = true;
topdiv->set_ejecting();
static unsigned char buf[2] = { LAST_PAGE_EJECTOR, '\0' };
input_stack::push(make_temp_iterator((char *)buf));
@@ -2619,9 +2619,9 @@ void return_macro_request()
tok.next();
}
-void end_macro()
+void eoi_macro()
{
- end_macro_name = get_name();
+ eoi_macro_name = get_name();
skip_line();
}
@@ -8344,7 +8344,7 @@ void init_input_requests()
init_request("ecr", restore_escape_char);
init_request("ecs", save_escape_char);
init_request("el", else_request);
- init_request("em", end_macro);
+ init_request("em", eoi_macro);
init_request("eo", escape_off);
init_request("ex", exit_request);
init_request("fchar", define_fallback_character);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 04/18: [troff]: Slightly refactor.,
G. Branden Robinson <=