gbranden pushed a commit to branch master
in repository groff.

commit f5046d542f89f545e5b4d30b3626432a4876fef8
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Mar 1 20:33:12 2024 -0600

    [troff]: Slightly refactor (unsigned .hy,.j regs).
    
    * src/roff/troff/env.cpp:
    * src/roff/troff/env.h:
      (environment::get_adjust_mode):
      (environment::get_hyphenation_mode): Migrate report of these
      quantities to use "unsigned int" type instead of a signed type;
      this is more consistent with their internal storage, more
      appropriate given their use as bit vectors, and more
      future-proof in the event their meaningful values ever carry
      them close to the sign bit (let's hope not).
---
 ChangeLog              | 12 ++++++++++++
 src/roff/troff/env.cpp |  8 ++++----
 src/roff/troff/env.h   |  4 ++--
 3 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 09f627dc6..e4c715729 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-03-01  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/env.cpp:
+       * src/roff/troff/env.h:
+       (environment::get_adjust_mode):
+       (environment::get_hyphenation_mode): Migrate report of these
+       quantities to use "unsigned int" type instead of a signed type;
+       this is more consistent with their internal storage, more
+       appropriate given their use as bit vectors, and more
+       future-proof in the event their meaningful values ever carry
+       them close to the sign bit (let's hope not).
+
 2024-03-01  G. Branden Robinson <[email protected]>
 
        * src/roff/troff/env.cpp: Add support for read-only numeric
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index f69e0c460..d0ae50959 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -397,7 +397,7 @@ void environment::add_hyphen_indicator()
   line = line->add_discretionary_hyphen();
 }
 
-int environment::get_hyphenation_mode()
+unsigned environment::get_hyphenation_mode()
 {
   return hyphenation_mode;
 }
@@ -1027,7 +1027,7 @@ hunits environment::get_digit_width()
   return env_digit_width(this);
 }
 
-int environment::get_adjust_mode()
+unsigned environment::get_adjust_mode()
 {
   return adjust_mode;
 }
@@ -3558,7 +3558,7 @@ void init_env_requests()
   init_int_env_reg(".height", get_char_height);
   init_int_env_reg(".hlc", get_hyphen_line_count);
   init_int_env_reg(".hlm", get_hyphen_line_max);
-  init_int_env_reg(".hy", get_hyphenation_mode);
+  init_unsigned_env_reg(".hy", get_hyphenation_mode);
   init_hunits_env_reg(".hym", get_hyphenation_margin);
   init_hunits_env_reg(".hys", get_hyphenation_space);
   init_hunits_env_reg(".i", get_indent);
@@ -3569,7 +3569,7 @@ void init_env_requests()
   init_string_env_reg(".itm", get_input_trap_macro);
   init_int_env_reg(".linetabs", get_line_tabs);
   init_hunits_env_reg(".lt", get_title_length);
-  init_int_env_reg(".j", get_adjust_mode);
+  init_unsigned_env_reg(".j", get_adjust_mode);
   init_hunits_env_reg(".k", get_text_length);
   init_int_env_reg(".L", get_line_spacing);
   init_hunits_env_reg(".l", get_line_length);
diff --git a/src/roff/troff/env.h b/src/roff/troff/env.h
index b1ab88fc8..70f2cb626 100644
--- a/src/roff/troff/env.h
+++ b/src/roff/troff/env.h
@@ -285,7 +285,7 @@ public:
   int get_numbering_nodes();           // .nm
   font_family *get_family() { return family; }
   int get_bold();                      // .b
-  int get_adjust_mode();               // .j
+  unsigned get_adjust_mode();          // .j
   int get_fill();                      // .u
   hunits get_indent();                 // .i
   hunits get_temporary_indent();
@@ -308,7 +308,7 @@ public:
   hunits get_input_line_position();
   const char *get_tabs();
   int get_line_tabs();
-  int get_hyphenation_mode();
+  unsigned get_hyphenation_mode();
   int get_hyphen_line_max();
   int get_hyphen_line_count();
   hunits get_hyphenation_space();

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

Reply via email to