groff-commit
[Top][All Lists]
Advanced

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

[groff] 80/115: [eqn]: Implement new "gifont" primitive.


From: G. Branden Robinson
Subject: [groff] 80/115: [eqn]: Implement new "gifont" primitive.
Date: Thu, 1 Jun 2023 10:46:13 -0400 (EDT)

gbranden pushed a commit to branch branden-2022-06-01
in repository groff.

commit 0dd1239ea8c5d29352c24bd37bbe6bdc4af39b9f
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri Apr 14 14:59:55 2023 -0500

    [eqn]: Implement new "gifont" primitive.
    
    * src/preproc/eqn/eqn.ypp: Add token "GFONT" (to supplement "GIFONT",
      already renamed from "GFONT".
    
    * src/preproc/eqn/lex.cpp (struct token_table): Map "gifont" and "gfont"
      inputs to "GIFONT" and "GFONT" tokens.
    
      (do_gfont, do_gifont): Employ parallel implementations, differing only
      in diagnostic message text.
    
      (yylex): Handle token "GFONT" by calling `do_gfont()`.
    
    * src/preproc/eqn/eqn.1.man (New primitives, Fonts, Options, Bugs):
      Document it.
    
    * NEWS: Add item.
    
    Fixes <https://savannah.gnu.org/bugs/?63967>.  Thanks to Damian
    McGuckin, Doug McIlroy, and Ralph Corderoy for support and suggestions.
---
 ChangeLog                 | 20 ++++++++++++++++++++
 NEWS                      | 10 ++++++++++
 src/preproc/eqn/eqn.1.man | 27 ++++++++++++++++-----------
 src/preproc/eqn/eqn.ypp   |  3 ++-
 src/preproc/eqn/lex.cpp   | 19 +++++++++++++++++--
 5 files changed, 65 insertions(+), 14 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6c45fefb9..977562d04 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2023-04-14  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [eqn]: Implement new "gifont" primitive.
+
+       * src/preproc/eqn/eqn.ypp: Add token "GFONT" (to supplement
+       "GIFONT", already renamed from "GFONT".
+       * src/preproc/eqn/lex.cpp (struct token_table): Map "gifont" and
+       "gfont" inputs to "GIFONT" and "GFONT" tokens.
+       (do_gfont, do_gifont): Employ parallel implementations,
+       differing only in diagnostic message text.
+       (yylex): Handle token "GFONT" by calling `do_gfont()`.
+
+       * src/preproc/eqn/eqn.1.man (New primitives, Fonts, Options)
+       (Bugs): Document it.
+       * NEWS: Add item.
+
+       Fixes <https://savannah.gnu.org/bugs/?63967>.  Thanks to Damian
+       McGuckin, Doug McIlroy, and Ralph Corderoy for support and
+       suggestions.
+
 2023-04-07  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/preproc/eqn/lex.cpp (do_include, do_undef, do_gsize)
diff --git a/NEWS b/NEWS
index 6b97fb28f..52d47cc27 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,15 @@ not described.  There are more details in the man and info 
pages.
 VERSION next
 ============
 
+eqn
+---
+
+o The "gifont" primitive replaces "gfont" as the means of configuring
+  the global italic face within an equation.  "gfont" remains recognized
+  as a synonym for backward compatibility.  The new name is intended to
+  ease acquisition of the eqn language in light of GNU eqn's
+  thirty-year-old extensions "gbfont" and "grfont".
+
 Macro packages
 --------------
 
@@ -28,6 +37,7 @@ o The s (ms) macro package now sets the vertical spacing 
register
   document with a type size of 20 points, the vertical spacing now
   defaults to 24 points rather than 22.
 
+
 VERSION 1.23.0
 ==============
 
diff --git a/src/preproc/eqn/eqn.1.man b/src/preproc/eqn/eqn.1.man
index 4c9b0aaeb..c01690ab8 100644
--- a/src/preproc/eqn/eqn.1.man
+++ b/src/preproc/eqn/eqn.1.man
@@ -586,9 +586,10 @@ are discussed in subsection \[lq]Spacing and typeface\[rq] 
above;
 .RB \[lq] set \[rq]
 in subsection \[lq]Customization\[rq] below;
 and
-.B grfont
+.BR gbfont ,
+.BR gifont ,
 and
-.B gbfont
+.B grfont
 in subsection \[lq]Fonts\[rq] below.
 .
 In the following synopses,
@@ -1655,15 +1656,15 @@ and bold.
 .
 Assign each a
 .I groff
-typeface with the primitives
-.BR gfont ,
+typeface with the GNU extension primitives
 .BR \%grfont ,
+.BR \%gifont ,
 and
 .B \%gbfont.
 .
 The defaults are the styles
-.BR I ,
 .BR R ,
+.BR I ,
 and
 .B B
 (applied to the current font family).
@@ -1690,22 +1691,26 @@ primitive to select an (upright) bold style.
 .RI Select\~ f
 as the bold font.
 .
-This is a GNU extension.
-.
 .
 .TP
-.BI gfont\~ f
+.BI gifont\~ f
 .RI Select\~ f
 as the italic font.
 .
+For
+AT&T
+.I eqn \" AT&T
+compatibility,
+.B gfont
+is recognized as a synonym for
+.BR gifont .
+.
 .
 .TP
 .BI grfont\~ f
 .RI Select\~ f
 as the roman font.
 .
-This is a GNU extension.
-.
 .
 .br
 .ne 4v
@@ -1756,7 +1761,7 @@ statements in the source file override this option.
 .TP
 .BI \-f\~ F
 is equivalent to
-.RB \[lq] gfont
+.RB \[lq] gifont
 .IR F \[rq].
 .
 .
diff --git a/src/preproc/eqn/eqn.ypp b/src/preproc/eqn/eqn.ypp
index d6f8c8b58..4e806d8d7 100644
--- a/src/preproc/eqn/eqn.ypp
+++ b/src/preproc/eqn/eqn.ypp
@@ -86,7 +86,7 @@ void yyerror(const char *);
 
 /* these are handled in the lexer */
 %token SPACE
-%token GIFONT
+%token GFONT
 %token GSIZE
 %token DEFINE
 %token NDEFINE
@@ -100,6 +100,7 @@ void yyerror(const char *);
 %token SET
 %token GRFONT
 %token GBFONT
+%token GIFONT
 
 /* The original eqn manual says that 'left' is right associative. It's lying.
 Consider 'left ( ~ left ( ~ right ) right )'. */
diff --git a/src/preproc/eqn/lex.cpp b/src/preproc/eqn/lex.cpp
index 8eaaca593..d2d53f310 100644
--- a/src/preproc/eqn/lex.cpp
+++ b/src/preproc/eqn/lex.cpp
@@ -94,7 +94,8 @@ static struct {
   { "mark", MARK },
   { "lineup", LINEUP },
   { "space", SPACE },
-  { "gfont", GIFONT },
+  { "gifont", GIFONT },
+  { "gfont", GFONT }, // for backward compatibility
   { "gsize", GSIZE },
   { "define", DEFINE },
   { "sdefine", SDEFINE },
@@ -1004,7 +1005,7 @@ void do_gsize()
     lex_error("invalid size '%1'", token_buffer.contents());
 }
 
-void do_gifont()
+void do_gfont()
 {
   int t = get_token(2);
   if (t != TEXT && t != QUOTED_TEXT) {
@@ -1015,6 +1016,17 @@ void do_gifont()
   set_gifont(token_buffer.contents());
 }
 
+void do_gifont()
+{
+  int t = get_token(2);
+  if (t != TEXT && t != QUOTED_TEXT) {
+    lex_error("invalid argument to gifont primitive");
+    return;
+  }
+  token_buffer += '\0';
+  set_gifont(token_buffer.contents());
+}
+
 void do_grfont()
 {
   int t = get_token(2);
@@ -1172,6 +1184,9 @@ int yylex()
     case GSIZE:
       do_gsize();
       break;
+    case GFONT:
+      do_gfont();
+      break;
     case GIFONT:
       do_gifont();
       break;



reply via email to

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