groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 03/32: [troff]: Describe input DEL char comprehensibly.


From: G. Branden Robinson
Subject: [groff] 03/32: [troff]: Describe input DEL char comprehensibly.
Date: Thu, 6 Oct 2022 09:11:21 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 158f45c394de3f617e0cbc2ace40867600db4f2b
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Mon Oct 3 21:43:39 2022 -0500

    [troff]: Describe input DEL char comprehensibly.
    
    * src/roff/troff/input.cpp (token::description): The delete character
      (ISO 127 decimal, EBCDIC 7) is a valid `TOKEN_CHAR` but is not
      printable.  Don't attempt to output it literally in diagnostics;
      describe it in a phrase instead.
---
 ChangeLog                |  9 +++++++++
 src/roff/troff/input.cpp | 14 +++++++++-----
 src/roff/troff/input.h   |  4 ++++
 3 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d0e4ed88b..ce4146502 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2022-10-03  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [troff]: Describe an input delete character comprehensibly.
+
+       * src/roff/troff/input.cpp (token::description): The delete
+       character (ISO 127 decimal, EBCDIC 7) is a valid `TOKEN_CHAR`
+       but is not printable.  Don't attempt to output it literally in
+       diagnostics; describe it in a phrase instead.
+
 2022-10-03  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [troff]: Apply consistent terminology.
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 4797a9a55..0005cdaad 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -2405,11 +2405,15 @@ const char *token::description()
   case TOKEN_BACKSPACE:
     return "a backspace character";
   case TOKEN_CHAR:
-    buf[0] = '\'';
-    buf[1] = c;
-    buf[2] = '\'';
-    buf[3] = '\0';
-    return buf;
+    if (c == INPUT_DELETE)
+      return "a delete character";
+    else {
+      buf[0] = '\'';
+      buf[1] = c;
+      buf[2] = '\'';
+      buf[3] = '\0';
+      return buf;
+    }
   case TOKEN_DUMMY:
     return "an escaped '&'";
   case TOKEN_ESCAPE:
diff --git a/src/roff/troff/input.h b/src/roff/troff/input.h
index 5b1c88244..e78124f92 100644
--- a/src/roff/troff/input.h
+++ b/src/roff/troff/input.h
@@ -41,6 +41,8 @@ const int ESCAPE_e = 035;
 const int ESCAPE_PERCENT = 036;
 const int ESCAPE_SPACE = 037;
 
+const int INPUT_DELETE = 0177;
+
 const int TITLE_REQUEST = 0200;
 const int COPY_FILE_REQUEST = 0201;
 const int TRANSPARENT_FILE_REQUEST = 0202;
@@ -63,6 +65,8 @@ const int INPUT_SOFT_HYPHEN= 0255;
 
 #else /* IS_EBCDIC_HOST */
 
+const int INPUT_DELETE = 007;
+
 const int ESCAPE_QUESTION = 010;
 const int BEGIN_TRAP = 011;
 const int END_TRAP = 013;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]