bugGNU roff - Bugs: bug #65137, [troff] support construction of...

 
 

bug #65137: [troff] support construction of arbitrary byte sequences in device control commands

Submitter:  G. Branden Robinson <gbranden>
Submitted:  Mon 08 Jan 2024 10:13:02 AM UTC
   
 
Category:  Core Severity:  1 - Wish
Item Group:  Feature change Status:  Duplicate
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Closed Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 09 Jan 2024 01:39:10 AM UTC, comment #2: 

Duplicates bug #63074.  Will migrate comment #0 over there.

G. Branden Robinson <gbranden>
Group administrator
Mon 08 Jan 2024 10:18:46 AM UTC, comment #1: 

This isn't a strict dependency, but see bug #64484.

G. Branden Robinson <gbranden>
Group administrator
Mon 08 Jan 2024 10:13:02 AM UTC, original submission:  

This is my generalization of Deri's `stringhex` request in the deri-gropdf-ng branch.

In my working copy, I embedded the idea where the code would go.


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);
 }


G. Branden Robinson <gbranden>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gbranden (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-01-09 gbranden StatusNone Duplicate
        Assigned toNone gbranden
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code