groff-commit
[Top][All Lists]
Advanced

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

[groff] 06/13: [troff]: Translate 8-bit NBSP and SHY on input.


From: G. Branden Robinson
Subject: [groff] 06/13: [troff]: Translate 8-bit NBSP and SHY on input.
Date: Sat, 16 Apr 2022 04:37:31 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit f9fb11f6625fe859d3f22c5fc6cbd51e19b64ec6
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Thu Apr 14 12:49:27 2022 +1000

    [troff]: Translate 8-bit NBSP and SHY on input.
    
    * src/roff/troff/input.h: Define constant integers for "input" no-break
      spaces and soft hyphens for EBCDIC and non-EBCDIC (presumably
      ASCII/ISO 8859/Unicode) systems.
    
    * src/roff/troff/input.cpp (token::next): Translate the input character
      codes for input NBSP to \~ and nput SHY to \%.
    
    Fixes <https://savannah.gnu.org/bugs/?58962>.  Thanks to Dave Kemper for
    the report, code review, and his suggestion to push more work to compile
    time.
---
 ChangeLog                | 15 +++++++++++++++
 src/roff/troff/input.cpp |  8 +++++++-
 src/roff/troff/input.h   | 14 ++++++++++++--
 3 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4b4a81fa..c91b8754 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2022-04-14  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [troff]: Translate 8-bit NBSP and SHY on input.
+
+       * src/roff/troff/input.h: Define constant integers for "input"
+       no-break spaces and soft hyphens for EBCDIC and non-EBCDIC
+       (presumably ASCII/ISO 8859/Unicode) systems.
+
+       * src/roff/troff/input.cpp (token::next): Translate the input
+       character codes for input NBSP to \~ and nput SHY to \%.
+
+       Fixes <https://savannah.gnu.org/bugs/?58962>.  Thanks to Dave
+       Kemper for the report, code review, and his suggestion to push
+       more work to compile time.
+
 2022-04-14  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [groff]: Regression-test Savannah #58962.
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 36822033..029bfad8 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 1989-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1989-2022 Free Software Foundation, Inc.
      Written by James Clark (jjc@jclark.com)
 
 This file is part of groff.
@@ -1744,6 +1744,12 @@ void token::next()
     if (cc != escape_char || escape_char == 0) {
     handle_normal_char:
       switch(cc) {
+      case INPUT_NO_BREAK_SPACE:
+         type = TOKEN_STRETCHABLE_SPACE;
+         return;
+      case INPUT_SOFT_HYPHEN:
+         type = TOKEN_HYPHEN_INDICATOR;
+         return;
       case PUSH_GROFF_MODE:
        input_stack::save_compatible_flag(compatible_flag);
        compatible_flag = 0;
diff --git a/src/roff/troff/input.h b/src/roff/troff/input.h
index f719e885..5b1c8824 100644
--- a/src/roff/troff/input.h
+++ b/src/roff/troff/input.h
@@ -1,5 +1,4 @@
-// -*- C++ -*-
-/* Copyright (C) 2001-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2022 Free Software Foundation, Inc.
      Written by James Clark (jjc@jclark.com)
 
 This file is part of groff.
@@ -59,6 +58,8 @@ const int POP_GROFFCOMP_MODE = 0213;
 const int BEGIN_QUOTE = 0214;
 const int END_QUOTE = 0215;
 const int DOUBLE_QUOTE = 0216;
+const int INPUT_NO_BREAK_SPACE = 0240;
+const int INPUT_SOFT_HYPHEN= 0255;
 
 #else /* IS_EBCDIC_HOST */
 
@@ -100,7 +101,16 @@ const int BEGIN_QUOTE = 074;
 const int END_QUOTE = 075;
 const int DOUBLE_QUOTE = 076;
 
+const int INPUT_NO_BREAK_SPACE = 0101;
+const int INPUT_SOFT_HYPHEN= 0312;
+
 #endif /* IS_EBCDIC_HOST */
 
 extern void do_glyph_color(symbol);
 extern void do_fill_color(symbol);
+
+// Local Variables:
+// fill-column: 72
+// mode: C++
+// End:
+// vim: set cindent noexpandtab shiftwidth=2 textwidth=72:



reply via email to

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