gbranden pushed a commit to branch master
in repository groff.

commit 148b65b1ed45a51bac10689c36b557e1867341f5
Author: G. Branden Robinson <[email protected]>
AuthorDate: Thu Sep 4 06:14:00 2025 -0500

    [troff]: Make `pchar` report "Unicode mapping".
    
    * src/roff/troff/input.cpp (charinfo::dump): Report Unicode mapping
      corresponding to character.
---
 ChangeLog                |  5 +++++
 src/roff/troff/input.cpp | 11 +++++++++++
 2 files changed, 16 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 79e719d77..59e9395e6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2025-09-04  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/input.cpp (charinfo::dump): Report Unicode
+       mapping corresponding to character.
+
 2025-09-04  G. Branden Robinson <[email protected]>
 
        [troff]: Trivially refactor.  Rename `charinfo` class's member
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index fe36a2f7e..44ba6625a 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -10434,6 +10434,17 @@ void charinfo::dump()
     }
     errprint(")\n");
   }
+  int mapping = get_unicode_mapping();
+  if (mapping >= 0) {
+    const size_t buflen = 6; // enough for five hex digits + '\0'
+    char hexbuf[buflen];
+    (void) memset(hexbuf, '\0', buflen);
+    (void) snprintf(hexbuf, buflen, "%.4X", mapping);
+    errprint("  Unicode mapping: U+%1\n", hexbuf);
+  }
+  else
+    errprint("  Unicode mapping: none (%1)\n", mapping);
+  errprint("  ASCII code: %1\n", static_cast<int>(ascii_code));
   errprint("  ASCII code: %1\n", static_cast<int>(ascii_code));
   errprint("  asciify code: %1\n", static_cast<int>(asciify_code));
   errprint("  is%1 found\n", is_not_found ? " not" : "");

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

Reply via email to