Update of bug#63074 (group groff): Status: None => In Progress Assigned to: None => gbranden Summary: [troff] need a way to embed non-Basic Latin glyphs in device control commands => [troff] support construction of arbitrary byte sequences in device control commands
_______________________________________________________ Follow-up Comment #18: This is a skeleton of my proposal, an alternative to Deri's new `stringhex` request in his branch, "deri-gropdf-ng". Originally posted in a recent duplicate bug #65137. diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp index a0b987634..f6e5b1279 100644 --- a/src/roff/troff/input.cpp +++ b/src/roff/troff/input.cpp @@ -5571,7 +5571,7 @@ static node *do_non_interpreted() return new non_interpreted_node(mac); } -static void encode_char(macro *mac, char c) +static void encode_char_for_device_control(macro *mac, char c) { if (c == '\0') { if (tok.is_stretchable_space() @@ -5600,6 +5600,13 @@ static void encode_char(macro *mac, char c) else if (strcmp("ti", sc) == 0) mac->append('~'); else { + // TODO: Support '\[uXXXX]' for all devices to support + // transmission of arbitrary data to the output device. It's a + // misnomer--this doesn't necessarily represent a Unicode code + // point, but this syntax beats inventing a new one for this + // esoteric purpose. Whether one sends \[uAABB], + // \[u00AA]\[u00BB], or the latter's byte-swapped counterpart is + // an interface detail that the output device must specify. if (font::use_charnames_in_special) { if (sc[0] != (char)0) { mac->append('\\'); @@ -5612,9 +5619,14 @@ static void encode_char(macro *mac, char c) mac->append(']'); } else - error("special character '%1' cannot be used within" - " device control escape sequence", sc); + error("special character '%1' cannot be used within a" + " device control escape sequence", sc); } + else + // TODO: Put '\[uXXXX]' support here. Don't allow + // '\[uXXXX_YYYY]'. + error("special character '%1' cannot be used within a device" + " control escape sequence", sc); } } else if (!(tok.is_hyphen_indicator() @@ -5668,7 +5680,7 @@ static node *do_special() c = '\b'; else c = tok.ch(); - encode_char(&mac, c); + encode_char_for_device_control(&mac, c); } return new special_node(mac); } _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?63074> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/