gbranden pushed a commit to branch master in repository groff. commit 609d962fc02e517744ee4f68160648a78df3a020 Author: G. Branden Robinson <g.branden.robin...@gmail.com> AuthorDate: Sat May 11 09:54:35 2024 -0500
[tmac]: Perform actual string comparisons. * tmac/fallbacks.tmac: * tmac/troffrc-end: Bracket comparands to formatted output comparison operator with `\?` escape sequences to perform a more elementary string comparison on them (cf. a comparison of _formatted text_). This way they continue to perform their function even if the default font family has no coverage of Basic Latin (not a bizarre choice when considering potential rendering of documents using Devanagari or East Asian languages). Unfortunately this means of comparing strings, while long documented in the GNU troff Manual, is neither idiomatic for *roff macro programmers nor portable to AT&T troff. (The *roff language historically _lacks_ a string comparison operator.) Each macro package will have to decide for itself whether it wants to have portability at the expense of requiring Basic Latin coverage (possibly switching fonts before and after a formatted output comparison for the sole purpose of obtaining it). These two files are unconditionally loaded by the stock `troffrc`, and therefore must be dealt with in any case. Fixes <https://savannah.gnu.org/bugs/?64155>. Thanks to Dave Kemper for the report, and to him, Peter Schaffter, and Deri James for the discussion. Previously: $ echo | groff -fZD -a troff:/.../groff/1.23.0/tmac/fallbacks.tmac:14: warning: character 'p' not defined troff:/.../groff/1.23.0/tmac/fallbacks.tmac:14: warning: character 's' not defined troff:/.../groff/1.23.0/tmac/fallbacks.tmac:14: warning: character 'a' not defined troff:/.../groff/1.23.0/tmac/fallbacks.tmac:14: warning: character 'c' not defined troff:/.../groff/1.23.0/tmac/fallbacks.tmac:14: warning: character 'i' not defined troff:/.../groff/1.23.0/tmac/fallbacks.tmac:16: warning: character 'l' not defined troff:/.../groff/1.23.0/tmac/fallbacks.tmac:16: warning: character 't' not defined troff:/.../groff/1.23.0/tmac/fallbacks.tmac:16: warning: character 'n' not defined troff:/.../groff/1.23.0/tmac/fallbacks.tmac:17: warning: character 'u' not defined troff:/.../groff/1.23.0/tmac/fallbacks.tmac:17: warning: character 'f' not defined troff:/.../groff/1.23.0/tmac/troffrc-end:7: warning: character 'h' not defined troff:/.../groff/1.23.0/tmac/troffrc-end:7: warning: character 'm' not defined <beginning of page> Now: $ echo | ./build/test-groff -fZD -a <beginning of page> squash thing --- ChangeLog | 28 ++++++++++++++++++++++++++++ tmac/fallbacks.tmac | 8 ++++---- tmac/troffrc-end | 2 +- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9f85f3143..0d321594e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,31 @@ +2024-05-11 G. Branden Robinson <g.branden.robin...@gmail.com> + + [tmac]: Perform actual string comparisons. + + * tmac/fallbacks.tmac: + * tmac/troffrc-end: Bracket comparands to formatted output + comparison operator with `\?` escape sequences to perform a more + elementary string comparison on them (cf. a comparison of + _formatted text_). This way they continue to perform their + function even if the default font family has no coverage of + Basic Latin (not a bizarre choice when considering potential + rendering of documents using Devanagari or East Asian + languages). Unfortunately this means of comparing strings, + while long documented in the GNU troff Manual, is neither + idiomatic for *roff macro programmers nor portable to AT&T + troff. (The *roff language historically _lacks_ a string + comparison operator.) Each macro package will have to decide + for itself whether it wants to have portability at the expense + of requiring Basic Latin coverage (possibly switching fonts + before and after a formatted output comparison for the sole + purpose of obtaining it). These two files are unconditionally + loaded by the stock `troffrc`, and therefore must be dealt with + in any case. + + Fixes <https://savannah.gnu.org/bugs/?64155>. Thanks to Dave + Kemper for the report, and to him, Peter Schaffter, and Deri + James for the discussion. + 2024-05-11 G. Branden Robinson <g.branden.robin...@gmail.com> Begin withdrawing support for CCSID (code page) 1047 (EBCDIC). diff --git a/tmac/fallbacks.tmac b/tmac/fallbacks.tmac index 162e57eea..8c9738d78 100644 --- a/tmac/fallbacks.tmac +++ b/tmac/fallbacks.tmac @@ -11,10 +11,10 @@ .\" The early loading observation above also means that the conditional .\" expressions 'n' and 't' are not reliable. Define ersatz substitute. .nr fallbacks*troff-mode 1 -.if '\*[.T]'ascii' .nr fallbacks*troff-mode 0 -.if '\*[.T]'cp1047' .nr fallbacks*troff-mode 0 -.if '\*[.T]'latin1' .nr fallbacks*troff-mode 0 -.if '\*[.T]'utf8' .nr fallbacks*troff-mode 0 +.if '\?\*[.T]\?'\?ascii\?' .nr fallbacks*troff-mode 0 +.if '\?\*[.T]\?'\?cp1047\?' .nr fallbacks*troff-mode 0 +.if '\?\*[.T]\?'\?latin1\?' .nr fallbacks*troff-mode 0 +.if '\?\*[.T]\?'\?utf8\?' .nr fallbacks*troff-mode 0 . .\" MODIFIER LETTER CIRCUMFLEX ACCENT -> CIRCUMFLEX ACCENT .fchar \[u02C6] ^ diff --git a/tmac/troffrc-end b/tmac/troffrc-end index 31b90b8b5..cf31db61c 100644 --- a/tmac/troffrc-end +++ b/tmac/troffrc-end @@ -4,7 +4,7 @@ .\" .\" Use .do for any groff extensions so that this file works with -C. . -.do if '\*[.T]'html' \ +.do if '\?\*[.T]\?'\?html\?' \ . do mso html-end.tmac . .\" Load www if we are running the PostScript driver for HTML images. _______________________________________________ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit