URL: <https://savannah.gnu.org/bugs/?65108>
Summary: [troff] support construction of general file name request arguments Group: GNU roff Submitter: gbranden Submitted: Tue 02 Jan 2024 10:59:42 PM UTC Category: Core Severity: 1 - Wish Item Group: Feature change Status: None Privacy: Public Assigned to: None Open/Closed: Open Discussion Lock: Any Planned Release: None _______________________________________________________ Follow-up Comments: ------------------------------------------------------- Date: Tue 02 Jan 2024 10:59:42 PM UTC By: G. Branden Robinson <gbranden> See the related bug #64071, which aims to do something similar for `sy` and `pso` requests. Quoting bug #59442, where I got carried away and brainstormed this. *** [Something] I want to do is specialize the formatter's logic when handling file name arguments given to requests. Presently, GNU _troff_ calls the same internal function to gather an argument that is a file name as it does to gather a _roff_ identifier. Maybe that made sense in 1990, but it doesn't today. File names can contain spaces and non-ASCII characters (in whatever encoding the file system happens to support). Since these arguments used mainly as-is, handed off to standard C library functions like `fopen()`, I don't anticipate many problems here (O Fortuna, seize my hostage). The only exception to that I can think of off the top of my head is the value of the `.F` register, which interpolates a file name. We will need some way to represent this such things as output. At first blush, it seems to me that we can interpolate spaces as-is (if you want the argument quoted, do that yourself in context), and any unprintable non-Basic Latin bytes in groff's \[u00xx] notation. I say "\[u00xx]" instead of "\[uXXXX]" because we have no way of knowing what the file system's character encoding is. Might be ISO 8859-1, UTF-8, UTF-16BE/LE, or something else entirely. What would be affected by this: Requests: cf fp (when invoked with a 3rd argument) hpf hpfa lf (when invoked with a 2nd argument) mso msoquiet nx (when invoked with a 2nd argument) open opena psbb so soquiet trf Escape sequences: \O5 (but since this is mainly used internally to manage temporary files by _grohtml_, maybe lazily postponing this in hope that my Grand Plan to revise _grohtml_ to no longer use a dedicated preprocessor is a better idea) Registers: .F [snip] And probably step 1 would be a simple refactor to introduce file name argument-gathering and -interpolating functions which initially behave no differently than the status [quo], but simply wrap existing logic for identifier gathering and whatever one-off thing the `.F` interpolator does. *** _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?65108> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/