gbranden pushed a commit to branch master
in repository groff.

commit b3aaf192f0679b8bd0626b39cca1bc05beb479a1
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sat Oct 4 02:35:57 2025 -0500

    [troff]: Trivially refactor.
    
    Tidy up the name space a bit.  We had two `enum`s declaring symbols
    starting with `HYPHEN_` (and another variable of `symbol` type that does
    as well).  Reduce those two to one, renaming the elements of the `enum`
    that manage the hyphenation state of the node list in the pending output
    line (cf. the hyphenation properties of characters themselves) to start
    with `HYPHENATE_` instead.
    
    * src/roff/troff/node.h (enum hyphenation_type): Do it.
    * src/roff/troff/env.cpp (environment::possibly_hyphenate_line)
    * src/roff/troff/node.cpp (glyph_node::get_hyphenation_type)
      (hyphen_inhibitor_node::get_hyphenation_type)
      (break_char_node::get_hyphen_list)
      (node::get_hyphenation_type)
      (dbreak_node::get_hyphenation_type)
      (kern_pair_node::get_hyphenation_type)
      (dummy_node::get_hyphenation_type)
      (transparent_dummy_node::get_hyphenation_type)
      (hmotion_node::get_hyphenation_type)
      (space_char_hmotion_node::get_hyphenation_type)
      (space_node::get_hyphenation_type)
      (unbreakable_space_node::get_hyphenation_type)
      (composite_node::get_hyphenation_type)
      (left_italic_corrected_node::get_hyphenation_type): Update.
---
 ChangeLog               | 29 +++++++++++++++++++++++++++++
 src/roff/troff/env.cpp  |  7 ++++---
 src/roff/troff/node.cpp | 32 ++++++++++++++++----------------
 src/roff/troff/node.h   |  6 +++---
 4 files changed, 52 insertions(+), 22 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 61116e808..c783b556b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,32 @@
+2025-10-04  G. Branden Robinson <[email protected]>
+
+       [troff]: Trivially refactor.
+
+       Tidy up the name space a bit.  We had two `enum`s declaring
+       symbols starting with `HYPHEN_` (and another variable of
+       `symbol` type that does as well).  Reduce those two to one,
+       renaming the elements of the `enum` that manage the hyphenation
+       state of the node list in the pending output line (cf. the
+       hyphenation properties of characters themselves) to start with
+       `HYPHENATE_` instead.
+
+       * src/roff/troff/node.h (enum hyphenation_type): Do it.
+       * src/roff/troff/env.cpp (environment::possibly_hyphenate_line)
+       * src/roff/troff/node.cpp (glyph_node::get_hyphenation_type)
+       (hyphen_inhibitor_node::get_hyphenation_type)
+       (break_char_node::get_hyphen_list)
+       (node::get_hyphenation_type)
+       (dbreak_node::get_hyphenation_type)
+       (kern_pair_node::get_hyphenation_type)
+       (dummy_node::get_hyphenation_type)
+       (transparent_dummy_node::get_hyphenation_type)
+       (hmotion_node::get_hyphenation_type)
+       (space_char_hmotion_node::get_hyphenation_type)
+       (space_node::get_hyphenation_type)
+       (unbreakable_space_node::get_hyphenation_type)
+       (composite_node::get_hyphenation_type)
+       (left_italic_corrected_node::get_hyphenation_type): Update.
+
 2025-10-04  G. Branden Robinson <[email protected]>
 
        [troff]: Trivially refactor.
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 109e22253..4571f09c1 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -2151,7 +2151,8 @@ void environment::possibly_hyphenate_line(bool 
must_break_here)
     for (startp = &line->next; *startp != 0 /* nullptr */;
         startp = &(*startp)->next) {
       hyphenation_type this_type = (*startp)->get_hyphenation_type();
-      if (prev_type == HYPHEN_BOUNDARY && this_type == HYPHEN_MIDDLE)
+      if (prev_type == HYPHENATE_BOUNDARY
+         && this_type == HYPHENATE_MIDDLE)
        break;
       prev_type = this_type;
     }
@@ -2162,10 +2163,10 @@ void environment::possibly_hyphenate_line(bool 
must_break_here)
   do {
     tem = tem->next;
   } while (tem != 0 /* nullptr */
-          && tem->get_hyphenation_type() == HYPHEN_MIDDLE);
+          && tem->get_hyphenation_type() == HYPHENATE_MIDDLE);
   // This is for characters like hyphen and em dash.
   bool inhibit = (tem != 0 /* nullptr */
-                && tem->get_hyphenation_type() == HYPHEN_INHIBIT);
+                && tem->get_hyphenation_type() == HYPHENATE_INHIBIT);
   node *end = tem;
   hyphen_list *sl = 0 /* nullptr */;
   tem = *startp;
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 3a4430ea3..650a31c44 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -2293,7 +2293,7 @@ hunits glyph_node::left_italic_correction()
 
 hyphenation_type glyph_node::get_hyphenation_type()
 {
-  return HYPHEN_MIDDLE;
+  return HYPHENATE_MIDDLE;
 }
 
 void glyph_node::ascii_print(ascii_output_file *ascii)
@@ -2633,7 +2633,7 @@ const char *hyphen_inhibitor_node::type()
 
 hyphenation_type hyphen_inhibitor_node::get_hyphenation_type()
 {
-  return HYPHEN_INHIBIT;
+  return HYPHENATE_INHIBIT;
 }
 
 /* add_discretionary_hyphen methods */
@@ -3162,7 +3162,7 @@ hyphen_list *break_char_node::get_hyphen_list(hyphen_list 
*tail, int *)
 
 hyphenation_type break_char_node::get_hyphenation_type()
 {
-  return HYPHEN_MIDDLE;
+  return HYPHENATE_MIDDLE;
 }
 
 void break_char_node::ascii_print(ascii_output_file *ascii)
@@ -4239,55 +4239,55 @@ void dbreak_node::split(int where, node **prep, node 
**postp)
 
 hyphenation_type node::get_hyphenation_type()
 {
-  return HYPHEN_BOUNDARY;
+  return HYPHENATE_BOUNDARY;
 }
 
 hyphenation_type dbreak_node::get_hyphenation_type()
 {
-  return HYPHEN_INHIBIT;
+  return HYPHENATE_INHIBIT;
 }
 
 hyphenation_type kern_pair_node::get_hyphenation_type()
 {
-  return HYPHEN_MIDDLE;
+  return HYPHENATE_MIDDLE;
 }
 
 hyphenation_type dummy_node::get_hyphenation_type()
 {
-  return HYPHEN_MIDDLE;
+  return HYPHENATE_MIDDLE;
 }
 
 hyphenation_type transparent_dummy_node::get_hyphenation_type()
 {
-  return HYPHEN_MIDDLE;
+  return HYPHENATE_MIDDLE;
 }
 
 hyphenation_type hmotion_node::get_hyphenation_type()
 {
-  return HYPHEN_MIDDLE;
+  return HYPHENATE_MIDDLE;
 }
 
 hyphenation_type space_char_hmotion_node::get_hyphenation_type()
 {
-  return HYPHEN_MIDDLE;
+  return HYPHENATE_MIDDLE;
 }
 
 hyphenation_type overstrike_node::get_hyphenation_type()
 {
-  return HYPHEN_MIDDLE;
+  return HYPHENATE_MIDDLE;
 }
 
 hyphenation_type space_node::get_hyphenation_type()
 {
   // XXX: This conditional seems to have no practical consequence. --GBR
   if (was_escape_colon)
-    return HYPHEN_MIDDLE;
-  return HYPHEN_BOUNDARY;
+    return HYPHENATE_MIDDLE;
+  return HYPHENATE_BOUNDARY;
 }
 
 hyphenation_type unbreakable_space_node::get_hyphenation_type()
 {
-  return HYPHEN_MIDDLE;
+  return HYPHENATE_MIDDLE;
 }
 
 bool node::interpret(macro *)
@@ -4813,7 +4813,7 @@ units composite_node::size()
 
 hyphenation_type composite_node::get_hyphenation_type()
 {
-  return HYPHEN_MIDDLE;
+  return HYPHENATE_MIDDLE;
 }
 
 void composite_node::asciify(macro *m)
@@ -6167,7 +6167,7 @@ hyphenation_type 
left_italic_corrected_node::get_hyphenation_type()
   if (nodes != 0 /* nullptr */)
     return nodes->get_hyphenation_type();
   else
-    return HYPHEN_MIDDLE;
+    return HYPHENATE_MIDDLE;
 }
 
 hyphen_list *left_italic_corrected_node::get_hyphen_list(
diff --git a/src/roff/troff/node.h b/src/roff/troff/node.h
index d1ff588cd..578fc8cf4 100644
--- a/src/roff/troff/node.h
+++ b/src/roff/troff/node.h
@@ -26,9 +26,9 @@ struct hyphen_list {
 };
 
 enum hyphenation_type {
-  HYPHEN_MIDDLE,
-  HYPHEN_BOUNDARY,
-  HYPHEN_INHIBIT
+  HYPHENATE_MIDDLE,
+  HYPHENATE_BOUNDARY,
+  HYPHENATE_INHIBIT
 };
 
 class ascii_output_file;

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

Reply via email to