gbranden pushed a commit to branch master
in repository groff.
commit f1840fbef873f17cdd4534ad24ac74d726f25d6e
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon Nov 16 16:53:23 2026 -0600
[pic]: Boolify AT&T compatibility flag.
Demote `compatible_flag` from `int` to `bool` and rename it to
`want_att_compat`.
* src/preproc/pic/pic.h: Update declaration.
* src/preproc/pic/main.cpp: Initialize it with Boolean, not integer,
literal.
* src/preproc/pic/main.cpp (main): Assign to it with Boolean, not
integer, literal.
* src/preproc/pic/lex.cpp (file_input::read_line):
* src/preproc/pic/main.cpp
(top_input::get)
(top_input::peek)
(do_file)
(main): Update dereference sites.
Continues the long process of fixing Savannah #66672.
---
ChangeLog | 21 +++++++++++++++++++++
src/preproc/pic/lex.cpp | 2 +-
src/preproc/pic/main.cpp | 16 ++++++++--------
src/preproc/pic/pic.h | 2 +-
4 files changed, 31 insertions(+), 10 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d7ca5a22c..a3e678de7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2026-11-16 G. Branden Robinson <[email protected]>
+
+ [pic]: Boolify AT&T compatibility flag.
+
+ Demote `compatible_flag` from `int` to `bool` and rename it to
+ `want_att_compat`.
+
+ * src/preproc/pic/pic.h: Update declaration.
+ * src/preproc/pic/main.cpp: Initialize it with Boolean, not
+ integer, literal.
+ * src/preproc/pic/main.cpp (main): Assign to it with Boolean,
+ not integer, literal.
+ * src/preproc/pic/lex.cpp (file_input::read_line):
+ * src/preproc/pic/main.cpp
+ (top_input::get)
+ (top_input::peek)
+ (do_file)
+ (main): Update dereference sites.
+
+ Continues the long process of fixing Savannah #66672.
+
2026-11-16 G. Branden Robinson <[email protected]>
[pic]: Apply the C++ "rule of three".
diff --git a/src/preproc/pic/lex.cpp b/src/preproc/pic/lex.cpp
index af5cbd7c0..b052c2e99 100644
--- a/src/preproc/pic/lex.cpp
+++ b/src/preproc/pic/lex.cpp
@@ -121,7 +121,7 @@ bool file_input::read_line()
if (!(line.length() >= 3 && line[0] == '.' && line[1] == 'P'
&& (line[2] == 'S' || line[2] == 'E' || line[2] == 'F')
&& (line.length() == 3 || line[3] == ' ' || line[3] == '\n'
- || compatible_flag))) {
+ || want_att_compat))) {
line += '\0';
ptr = line.contents();
return true;
diff --git a/src/preproc/pic/main.cpp b/src/preproc/pic/main.cpp
index f128909d8..04782e110 100644
--- a/src/preproc/pic/main.cpp
+++ b/src/preproc/pic/main.cpp
@@ -51,7 +51,7 @@ bool want_alternate_flyback = false;
int zero_length_line_flag = 0;
// Non-zero means we're using a groff driver.
int driver_extension_flag = 1;
-int compatible_flag = 0;
+bool want_att_compat = false;
bool want_unsafe_mode = false;
int command_char = '.'; // the character that introduces lines
// that should be passed through transparently
@@ -110,7 +110,7 @@ int top_input::get()
int d = getc(fp);
if (d != EOF)
ungetc(d, fp);
- if (d == EOF || d == ' ' || d == '\n' || compatible_flag) {
+ if (d == EOF || d == ' ' || d == '\n' || want_att_compat) {
eof = 1;
want_flyback = (c == 'F');
want_alternate_flyback = (c == 'Y');
@@ -124,7 +124,7 @@ int top_input::get()
c = getc(fp);
if (c != EOF)
ungetc(c, fp);
- if (c == EOF || c == ' ' || c == '\n' || compatible_flag) {
+ if (c == EOF || c == ' ' || c == '\n' || want_att_compat) {
error("nested .PS");
eof = 1;
return EOF;
@@ -178,7 +178,7 @@ int top_input::peek()
int d = getc(fp);
if (d != EOF)
ungetc(d, fp);
- if (d == EOF || d == ' ' || d == '\n' || compatible_flag) {
+ if (d == EOF || d == ' ' || d == '\n' || want_att_compat) {
eof = 1;
want_flyback = (c == 'F');
want_alternate_flyback = (c == 'Y');
@@ -193,7 +193,7 @@ int top_input::peek()
c = getc(fp);
if (c != EOF)
ungetc(c, fp);
- if (c == EOF || c == ' ' || c == '\n' || compatible_flag) {
+ if (c == EOF || c == ' ' || c == '\n' || want_att_compat) {
error("nested .PS");
eof = 1;
return EOF;
@@ -389,7 +389,7 @@ void do_file(const char *filename)
}
break;
case HAD_PS:
- if (c == ' ' || c == '\n' || compatible_flag) {
+ if (c == ' ' || c == '\n' || want_att_compat) {
ungetc(c, fp);
do_picture(fp);
state = START;
@@ -416,7 +416,7 @@ void do_file(const char *filename)
}
break;
case HAD_lf:
- if (c == ' ' || c == '\n' || compatible_flag) {
+ if (c == ' ' || c == '\n' || want_att_compat) {
string line;
while (c != EOF) {
line += c;
@@ -571,7 +571,7 @@ int main(int argc, char **argv)
!= EOF)
switch (opt) {
case 'C':
- compatible_flag = 1;
+ want_att_compat = true;
break;
case 'D':
case 'T':
diff --git a/src/preproc/pic/pic.h b/src/preproc/pic/pic.h
index 7db1c2f0f..c83f3e5af 100644
--- a/src/preproc/pic/pic.h
+++ b/src/preproc/pic/pic.h
@@ -106,7 +106,7 @@ extern int command_char;
// as dots by the output device
extern int zero_length_line_flag;
extern int driver_extension_flag;
-extern int compatible_flag;
+extern bool want_att_compat;
extern bool want_unsafe_mode;
extern char *graphname;
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit