gbranden pushed a commit to branch master
in repository groff.
commit 29119fa73481970d6cb0238372fea4ddff132d27
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon May 25 01:08:00 2026 -0500
[libgroff]: `errarg` now handles unsigned longs.
Extend argument printer for diagnostic messages to handle object of type
`unsigned long int`, so that we can report `sizeof` values messages,
perhaps among other purposes.
* src/include/errarg.h (class errarg): Extend `type` enumeration type to
support `UNSIGNED_LONG_INTEGER` constant. Add member `l` of type
`unsigned long int` to anonymous union. Declare constructor taking
argument of `unsigned long int` type.
* src/libs/libgroff/errarg.cpp (errarg:errargs): Define new constructor
taking argument of `unsigned long int` type.
(errarg::print): Handle case of `UNSIGNED_LONG_INTEGER`, delegating
printing to fprintf(3).
---
ChangeLog | 15 +++++++++++++++
src/include/errarg.h | 5 ++++-
src/libs/libgroff/errarg.cpp | 8 ++++++++
3 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index a62de9a6c..51c9a0a45 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2026-05-25 G. Branden Robinson <[email protected]>
+
+ [libgroff]: Extend argument printer for diagnostic messages to
+ handle object of type `unsigned long int`, so that we can report
+ `sizeof` values messages, perhaps among other purposes.
+
+ * src/include/errarg.h (class errarg): Extend `type` enumeration
+ type to support `UNSIGNED_LONG_INTEGER` constant. Add member
+ `l` of type `unsigned long int` to anonymous union. Declare
+ constructor taking argument of `unsigned long int` type.
+ * src/libs/libgroff/errarg.cpp (errarg:errargs): Define new
+ constructor taking argument of `unsigned long int` type.
+ (errarg::print): Handle case of `UNSIGNED_LONG_INTEGER`,
+ delegating printing to fprintf(3).
+
2026-05-25 Deri James <[email protected]>
[gropdf]: Handle URI encoded characters (%nn) correctly.
diff --git a/src/include/errarg.h b/src/include/errarg.h
index 0b5523f3d..efa7a5252 100644
--- a/src/include/errarg.h
+++ b/src/include/errarg.h
@@ -18,11 +18,13 @@ You should have received a copy of the GNU General Public
License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
class errarg {
- enum { EMPTY, STRING, CHAR, INTEGER, UNSIGNED_INTEGER, DOUBLE } type;
+ enum { EMPTY, STRING, CHAR, INTEGER, UNSIGNED_INTEGER,
+ UNSIGNED_LONG_INTEGER, DOUBLE } type;
union {
const char *s;
int n;
unsigned int u;
+ unsigned long int l;
char c;
double d;
};
@@ -33,6 +35,7 @@ class errarg {
errarg(unsigned char);
errarg(int);
errarg(unsigned int);
+ errarg(unsigned long int);
errarg(double);
int empty() const;
void print() const;
diff --git a/src/libs/libgroff/errarg.cpp b/src/libs/libgroff/errarg.cpp
index 019f7f4c7..aa750a18e 100644
--- a/src/libs/libgroff/errarg.cpp
+++ b/src/libs/libgroff/errarg.cpp
@@ -45,6 +45,11 @@ errarg::errarg(unsigned int uu) : type(UNSIGNED_INTEGER)
u = uu;
}
+errarg::errarg(unsigned long int ll) : type(UNSIGNED_LONG_INTEGER)
+{
+ l = ll;
+}
+
errarg::errarg(char cc) : type(CHAR)
{
c = cc;
@@ -79,6 +84,9 @@ void errarg::print() const
case UNSIGNED_INTEGER:
fputs(ui_to_a(u), stderr);
break;
+ case UNSIGNED_LONG_INTEGER:
+ fprintf(stderr, "%lu", l);
+ break;
case CHAR:
putc(c, stderr);
break;
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit