gbranden pushed a commit to branch master in repository groff. commit 52964e94c67fbf0c8dc167464f90c925caf2f2ed Author: G. Branden Robinson <g.branden.robin...@gmail.com> AuthorDate: Sun Aug 14 22:47:29 2022 -0500
[pic]: Refactor `flyback_flag`. * src/preproc/pic/main.cpp: * src/preproc/pic/pic.h: * src/preproc/pic/troff.cpp: Rename to `want_flyback`. * src/preproc/pic/main.cpp: * src/preproc/pic/pic.h: Demote type from `int` to `bool`. * src/preproc/pic/main.cpp (top_input::get, top_input::peek): Use parentheses to clarify operation precedence. --- ChangeLog | 14 ++++++++++++++ src/preproc/pic/main.cpp | 8 ++++---- src/preproc/pic/pic.h | 2 +- src/preproc/pic/troff.cpp | 4 ++-- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index ee3612acc..1ae835017 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2022-08-14 G. Branden Robinson <g.branden.robin...@gmail.com> + + [pic]: Refactor `flyback_flag`. + + * src/preproc/pic/main.cpp: + * src/preproc/pic/pic.h: + * src/preproc/pic/troff.cpp: Rename to `want_flyback`. + + * src/preproc/pic/main.cpp: + * src/preproc/pic/pic.h: Demote type from `int` to `bool`. + + * src/preproc/pic/main.cpp (top_input::get, top_input::peek): + Use parentheses to clarify operation precedence. + 2022-08-14 G. Branden Robinson <g.branden.robin...@gmail.com> * src/preproc/eqn/eqn.1.man: Expand to include lists of diff --git a/src/preproc/pic/main.cpp b/src/preproc/pic/main.cpp index 7c6be9a23..233e4c177 100644 --- a/src/preproc/pic/main.cpp +++ b/src/preproc/pic/main.cpp @@ -24,7 +24,7 @@ extern "C" const char *Version_string; output *out; char *graphname; // the picture box name in TeX mode -int flyback_flag; +bool want_flyback = false; int zero_length_line_flag = 0; // Non-zero means we're using a groff driver. int driver_extension_flag = 1; @@ -94,7 +94,7 @@ int top_input::get() ungetc(d, fp); if (d == EOF || d == ' ' || d == '\n' || compatible_flag) { eof = 1; - flyback_flag = c == 'F'; + want_flyback = (c == 'F'); return EOF; } push_back[0] = c; @@ -166,7 +166,7 @@ int top_input::peek() ungetc(d, fp); if (d == EOF || d == ' ' || d == '\n' || compatible_flag) { eof = 1; - flyback_flag = c == 'F'; + want_flyback = (c == 'F'); return EOF; } push_back[0] = c; @@ -217,7 +217,7 @@ int top_input::get_location(const char **filenamep, int *linenop) void do_picture(FILE *fp) { - flyback_flag = 0; + want_flyback = false; int c; if (!graphname) free(graphname); diff --git a/src/preproc/pic/pic.h b/src/preproc/pic/pic.h index 0d86183d9..d052c1a89 100644 --- a/src/preproc/pic/pic.h +++ b/src/preproc/pic/pic.h @@ -111,7 +111,7 @@ void lex_warning(const char *message, void lex_cleanup(); -extern int flyback_flag; +extern bool want_flyback; extern int command_char; // zero_length_line_flag is non-zero if zero-length lines are drawn // as dots by the output device diff --git a/src/preproc/pic/troff.cpp b/src/preproc/pic/troff.cpp index 256aa29ab..ad8998446 100644 --- a/src/preproc/pic/troff.cpp +++ b/src/preproc/pic/troff.cpp @@ -298,14 +298,14 @@ void troff_output::finish_picture() line_thickness(BAD_THICKNESS); last_fill = -1.0; // force it to be reset for each picture reset_color(); - if (!flyback_flag) + if (!want_flyback) printf(".sp %.3fi+1\n", height); printf(".if \\n(" FILL_REG " .fi\n"); printf(".br\n"); printf(".nr " EQN_NO_EXTRA_SPACE_REG " 0\n"); // this is a little gross set_location(current_filename, current_lineno); - fputs(flyback_flag ? ".PF\n" : ".PE\n", stdout); + fputs(want_flyback ? ".PF\n" : ".PE\n", stdout); } void troff_output::command(const char *s, _______________________________________________ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit