gbranden pushed a commit to branch master
in repository groff.
commit 0d170ef062831b481e7f023197f3f86a719f2fd0
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sat Jul 4 18:54:35 2026 -0500
[grn]: Boolify.
* src/preproc/grn/gprint.h: Delete `TRUE` and `FALSE` preprocessor
macros.
* src/preproc/grn/hdb.cpp:
* src/preproc/grn/main.cpp: Preprocessor-include "<stdbool.h>",
admittedly redundantly, to mark this file as reviewed for use of a
standard Boolean type.
* src/preproc/grn/hdb.cpp: Demote external symbols `SUNFILE` and
`compatibility_flag` from `int` to `bool`.
(DBRead): Demote local variables `done` and `last` from `int` to
`bool`. Assign to `bool` objects using Boolean literals.
* src/preproc/grn/main.cpp: Demote global symbols `defpoint`,
`pointscale`, `setdefault`, and `sflag` from `int` to `bool`.
Initialize `bool` objects using Boolean literals. Declare
`has_polygon()` as returning `bool`, not `int`.
(main): Assign to `bool` objects using Boolean literals.
(has_polygon): Demote return type from `int` to `bool`.
Continues the long process of fixing Savannah #66672.
---
ChangeLog | 23 +++++++++++++++++++++++
src/preproc/grn/gprint.h | 3 ---
src/preproc/grn/hdb.cpp | 28 ++++++++++++++--------------
src/preproc/grn/main.cpp | 32 ++++++++++++++++----------------
4 files changed, 53 insertions(+), 33 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 34dda613e..e343992f4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2026-07-04 G. Branden Robinson <[email protected]>
+
+ [grn]: Boolify.
+
+ * src/preproc/grn/gprint.h: Delete `TRUE` and `FALSE`
+ preprocessor macros.
+ * src/preproc/grn/hdb.cpp:
+ * src/preproc/grn/main.cpp: Preprocessor-include "<stdbool.h>",
+ admittedly redundantly, to mark this file as reviewed for
+ use of a standard Boolean type.
+ * src/preproc/grn/hdb.cpp: Demote external symbols `SUNFILE` and
+ `compatibility_flag` from `int` to `bool`.
+ (DBRead): Demote local variables `done` and `last` from `int` to
+ `bool`. Assign to `bool` objects using Boolean literals.
+ * src/preproc/grn/main.cpp: Demote global symbols `defpoint`,
+ `pointscale`, `setdefault`, and `sflag` from `int` to `bool`.
+ Initialize `bool` objects using Boolean literals.
+ Declare `has_polygon()` as returning `bool`, not `int`.
+ (main): Assign to `bool` objects using Boolean literals.
+ (has_polygon): Demote return type from `int` to `bool`.
+
+ Continues the long process of fixing Savannah #66672.
+
2026-07-05 G. Branden Robinson <[email protected]>
* doc/doc.am (texinfo-all): New convenience target builds all
diff --git a/src/preproc/grn/gprint.h b/src/preproc/grn/gprint.h
index 772d79a8a..c2b7ccd27 100644
--- a/src/preproc/grn/gprint.h
+++ b/src/preproc/grn/gprint.h
@@ -24,9 +24,6 @@
#define DEFTHICK -1 /* default thickness */
#define DEFSTYLE SOLID /* default line style */
-#define TRUE 1
-#define FALSE 0
-
#define nullelt -1
#define nullpt -1
#define nullun NULL
diff --git a/src/preproc/grn/hdb.cpp b/src/preproc/grn/hdb.cpp
index a84b27fdf..9f88c5300 100644
--- a/src/preproc/grn/hdb.cpp
+++ b/src/preproc/grn/hdb.cpp
@@ -31,8 +31,8 @@
/* imports from main.cpp */
extern char gremlinfile[]; /* name of file currently reading */
-extern int SUNFILE; /* TRUE if SUN gremlin file */
-extern int compatibility_flag; /* TRUE if in compatibility mode */
+extern bool SUNFILE; /* true if SUN gremlin file */
+extern bool compatibility_flag; /* true if in compatibility mode */
int DBGetType(char *s);
@@ -83,7 +83,7 @@ ELT *
DBRead(FILE *file)
{
int i;
- int done; /* flag for input exhausted */
+ bool done; /* flag for input exhausted */
double nx; /* x holder so x is not set before orienting */
int type; /* element type */
ELT *elist; /* pointer to the file's elements */
@@ -91,9 +91,9 @@ DBRead(FILE *file)
char string[MAXSTRING], *txt;
double x, y; /* x and y are read in point coords */
int len, brush, size;
- int lastpoint;
+ bool lastpoint;
- SUNFILE = FALSE;
+ SUNFILE = false;
elist = DBInit();
int nitems = fscanf(file, "%" MAXSTRING_S "s%*[^\n]\n", string);
if (nitems != 1) {
@@ -110,7 +110,7 @@ DBRead(FILE *file)
" picture");
return (elist);
}
- SUNFILE = TRUE;
+ SUNFILE = true;
}
nitems = fscanf(file, "%d%lf%lf\n", &size, &x, &y);
@@ -123,7 +123,7 @@ DBRead(FILE *file)
lineno++;
/* ignore orientation and file positioning point */
- done = FALSE;
+ done = false;
while (!done) {
/* if (fscanf(file,"%" MAXSTRING_S "s\n", string) == EOF) */
/* I changed the scanf format because the element */
@@ -140,7 +140,7 @@ DBRead(FILE *file)
type = DBGetType(string); /* interpret element type */
if (type < 0) { /* no more data */
- done = TRUE;
+ done = true;
} else {
/* always one point */
#ifdef UW_FASTSCAN
@@ -172,7 +172,7 @@ DBRead(FILE *file)
#ifdef UW_FASTSCAN
while (xscanf(file, &x, &y));
#else
- lastpoint = FALSE;
+ lastpoint = false;
do {
char *cp = fgets(string, MAXSTRING, file);
if (0 /* nullptr */ == cp) {
@@ -184,7 +184,7 @@ DBRead(FILE *file)
}
lineno++;
if (string[0] == '*') { /* SUN gremlin file */
- lastpoint = TRUE;
+ lastpoint = true;
} else {
if (!sscanf(string, "%lf%lf", &x, &y)) {
error_with_file_and_line(gremlinfile, lineno,
@@ -194,7 +194,7 @@ DBRead(FILE *file)
return(elist);
}
if ((x == -1.00 && y == -1.00) && (!SUNFILE))
- lastpoint = TRUE;
+ lastpoint = true;
else {
if (compatibility_flag)
savebounds(xorn(x, y), yorn(x, y));
@@ -211,7 +211,7 @@ DBRead(FILE *file)
savebounds(nx, y);
} while (xscanf(file, &x, &y));
#else
- lastpoint = FALSE;
+ lastpoint = false;
while (!lastpoint) {
nx = xorn(x, y);
y = yorn(x, y);
@@ -228,11 +228,11 @@ DBRead(FILE *file)
}
lineno++;
if (string[0] == '*') { /* SUN gremlin file */
- lastpoint = TRUE;
+ lastpoint = true;
} else {
(void) sscanf(string, "%lf%lf", &x, &y);
if ((x == -1.00 && y == -1.00) && (!SUNFILE))
- lastpoint = TRUE;
+ lastpoint = true;
}
}
#endif /* UW_FASTSCAN */
diff --git a/src/preproc/grn/main.cpp b/src/preproc/grn/main.cpp
index d6f50418d..a3721133c 100644
--- a/src/preproc/grn/main.cpp
+++ b/src/preproc/grn/main.cpp
@@ -187,7 +187,7 @@ int *defstipple_index = cf_stipple_index;
int style[STYLES] =
{DOTTED, DOTDASHED, SOLID, DASHED, SOLID, SOLID};
double scale = 1.0; /* no scaling, default */
-int defpoint = 0; /* flag for point size scaling */
+bool defpoint = false; /* flag for point size scaling */
char *defstipple = (char *) 0;
enum E {
OUTLINE, FILL, BOTH
@@ -214,10 +214,10 @@ double troffscale; /* scaling factor at output
time */
double width; /* user-request maximum width for picture */
/* (in inches) */
double height; /* user-request height */
-int pointscale; /* flag for point size scaling */
-int setdefault; /* flag for a .GS/.GE to remember all */
+bool pointscale; /* flag for point size scaling */
+bool setdefault; /* flag for a .GS/.GE to remember all */
/* settings */
-int sflag; /* -s flag: sort order (do polyfill first) */
+bool sflag; /* -s flag: sort order (do polyfill first) */
double toppoint; /* remember the picture */
double bottompoint; /* bounds in these variables */
@@ -237,15 +237,15 @@ char *c3 = inputline + 2; /* '.GS' by looking
individually */
char *c4 = inputline + 3; /* needed for compatibility mode */
char GScommand[MAXINLINE]; /* put user's '.GS' command line here */
char gremlinfile[MAXINLINE]; /* filename to use for a picture */
-int SUNFILE = FALSE; /* TRUE if SUN gremlin file */
-int compatibility_flag = FALSE; /* TRUE if in compatibility mode */
+bool SUNFILE = false; /* true if SUN gremlin file */
+bool compatibility_flag = false;/* true if in compatibility mode */
void getres();
int doinput(FILE *fp);
void conv(FILE *fp, int baseline);
void savestate();
-int has_polygon(ELT *elist);
+bool has_polygon(ELT *elist);
void interpret(char *line);
void *
@@ -357,7 +357,7 @@ main(int argc,
break;
case 'C': /* compatibility mode */
- compatibility_flag = TRUE;
+ compatibility_flag = true;
break;
case 'F': /* font path to find DESC */
@@ -375,7 +375,7 @@ main(int argc,
break;
case 's': /* preserve order of elements */
- sflag = 1;
+ sflag = true;
break;
case '-':
@@ -514,7 +514,7 @@ initpic()
stipple = defstipple;
gremlinfile[0] = 0; /* filename is 'null' */
- setdefault = 0; /* not the default settings (yet) */
+ setdefault = false; /* not the default settings (yet) */
toppoint = BIG; /* set the picture bounds out */
bottompoint = -BIG; /* of range so they'll be set */
@@ -946,14 +946,14 @@ interpret(char *line)
break;
case 'd': /* defaults */
- setdefault = 1;
+ setdefault = true;
break;
case 'p': /* pointscale */
if (strcmp("off", str2))
- pointscale = 1;
+ pointscale = true;
else
- pointscale = 0;
+ pointscale = false;
break;
default:
@@ -965,11 +965,11 @@ interpret(char *line)
/*
- * return TRUE if picture contains a polygon
- * otherwise FALSE
+ * return true if picture contains a polygon
+ * otherwise false
*/
-int
+bool
has_polygon(ELT *elist)
{
while (!DBNullelt(elist)) {
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit