gbranden pushed a commit to branch master
in repository groff.

commit 2506687ea228b6d3fa5d20e80b0df1777d11dbb8
Author: G. Branden Robinson <[email protected]>
AuthorDate: Thu Apr 9 21:16:47 2026 -0500

    [troff]: Work on Savannah #67735.
    
    Improve type discipline with respect to internal character
    representation.
    
    * src/roff/troff/env.cpp (embolden_font_request)
      (configure_track_kerning_request)
      (constantly_space_font_request):
    * src/roff/troff/reg.cpp (inline_define_register): Improve type
      discipline with respect to groff's internal character representation.
      Call `read_measurement()` with explicitly constructed literal argument
      of type `unsigned char` for conceptual clarity.  "groff characters"
      are, for now, unsigned bytes.
    
    Continues the long process of fixing Savannah #67735.
---
 ChangeLog               | 19 +++++++++++++++++++
 src/roff/troff/node.cpp | 23 ++++++++++++++++-------
 src/roff/troff/reg.cpp  |  7 +++++--
 3 files changed, 40 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 873d43a02..5c18c41c2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2026-04-09  G. Branden Robinson <[email protected]>
+
+       [troff]: Work on Savannah #67735.
+
+       Improve type discipline with respect to internal character
+       representation.
+
+       * src/roff/troff/env.cpp (embolden_font_request)
+       (configure_track_kerning_request)
+       (constantly_space_font_request):
+       * src/roff/troff/reg.cpp (inline_define_register): Improve type
+       discipline with respect to groff's internal character
+       representation.  Call `read_measurement()` with explicitly
+       constructed literal argument of type `unsigned char` for
+       conceptual clarity.  "groff characters" are, for now, unsigned
+       bytes.
+
+       Continues the long process of fixing Savannah #67735.
+
 2026-04-09  G. Branden Robinson <[email protected]>
 
        [troff]: Trivially refactor for semantic clarity.  The parameter
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index ceb7a15e8..a6357a9b1 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -7372,7 +7372,8 @@ static void embolden_font_request() // .bd
       int f = finfo2.position;
       units offset;
       if (has_arg()
-         && read_measurement(&offset, 'u')
+         && read_measurement(&offset,
+                             (unsigned char)('u')) // TODO: grochar
          && (offset >= 1))
        font_table[f]->set_conditional_bold(n, hunits(offset - 1));
       else
@@ -7384,7 +7385,9 @@ static void embolden_font_request() // .bd
              " name instead of a mounting position as the first"
              " argument if conditional emboldening desired");
       units offset;
-      if (read_measurement(&offset, 'u') && (offset >= 1))
+      if (read_measurement(&offset,
+                          (unsigned char)('u')) // TODO: grochar
+         && (offset >= 1))
        font_table[n]->set_bold(hunits(offset - 1));
       else
        font_table[n]->unbold();
@@ -7465,10 +7468,14 @@ static void configure_track_kerning_request() // .tkf
     int n = finfo.position, min_s, max_s;
     hunits min_a, max_a;
     if (has_arg()
-       && read_measurement(&min_s, 'z')
-       && read_hunits(&min_a, 'p')
-       && read_measurement(&max_s, 'z')
-       && read_hunits(&max_a, 'p')) {
+       && read_measurement(&min_s,
+                           (unsigned char)('z')) // TODO: grochar
+       && read_hunits(&min_a,
+                      (unsigned char)('p')) // TODO: grochar
+       && read_measurement(&max_s,
+                           (unsigned char)('z')) // TODO: grochar
+       && read_hunits(&max_a,
+                      (unsigned char)('p'))) { // TODO: grochar
       track_kerning_function tk(min_s, min_a, max_s, max_a);
       font_table[n]->set_track_kern(tk);
     }
@@ -7495,7 +7502,9 @@ static void constantly_space_font_request() // .cs
     if (!has_arg() || !read_integer(&x))
       font_table[n]->set_constant_space(CONSTANT_SPACE_NONE);
     else {
-      if (!has_arg() || !read_measurement(&y, 'z'))
+      if (!has_arg()
+         || !read_measurement(&y,
+                              (unsigned char)('z'))) // TODO: grochar
        font_table[n]->set_constant_space(CONSTANT_SPACE_RELATIVE, x);
       else
        font_table[n]->set_constant_space(CONSTANT_SPACE_ABSOLUTE,
diff --git a/src/roff/troff/reg.cpp b/src/roff/troff/reg.cpp
index 31b2ab35c..7cb086054 100644
--- a/src/roff/troff/reg.cpp
+++ b/src/roff/troff/reg.cpp
@@ -416,10 +416,13 @@ void inline_define_register()
   units prev_value;
   if ((0 /* nullptr */ == r) || !r->get_value(&prev_value))
     prev_value = 0;
-  if (read_measurement(&v, 'u', prev_value)) {
+  if (read_measurement(&v,
+                    (unsigned char)('u'), // TODO: grochar
+                    prev_value)) {
     r->set_value(v);
     if (start_token != tok) {
-      if (read_measurement(&v, 'u')) {
+      if (read_measurement(&v,
+                          (unsigned char)('u'))) { // TODO: grochar
        r->set_increment(v);
        if (start_token != tok) {
          // token::description() writes to static, class-wide storage,

_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to