groff-commit
[Top][All Lists]
Advanced

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

[groff] 01/06: tmac/www.tmac.in: Revise diagnostic messages.


From: G. Branden Robinson
Subject: [groff] 01/06: tmac/www.tmac.in: Revise diagnostic messages.
Date: Fri, 25 Sep 2020 09:33:50 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit bd4af916251334daf9f74d20eb4eeb3b7c68a398
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri Sep 25 21:27:35 2020 +1000

    tmac/www.tmac.in: Revise diagnostic messages.
    
    * tmac/www.tmac.in:
      (www:fatal): New macro handles fatal macro usage errors.
    
      (www:lenstr): Use www:fatal instead of writing to standard error with
      .tm (why not www:error?) and then calling .ab without arguments, which
      produces an unsightly "User Abort." message.
    
      (www:lenstr):
      (www:splitstr):
      (www:url_breaks):
      (www:url_breaks_split):
      (LINKSTYLE): Report expected number of arguments in diagnostics.
    
      (www:fontstyle): Shorten diagnostic message.
---
 ChangeLog        | 14 ++++++++++++++
 tmac/www.tmac.in | 27 ++++++++++++++++++---------
 2 files changed, 32 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 67521fb..cf20d87 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2020-09-25  G. Branden Robinson <g.branden.robinson@gmail.com>
 
+       * tmac/www.tmac.in: Revise diagnostic message handling.
+       (www:fatal): New macro handles fatal macro usage errors.
+       (www:lenstr): Use www:fatal instead of writing to standard error
+       with .tm (rather than www:error) and then calling .ab without
+       arguments, which produces an unsightly "User Abort." message.
+       (www:lenstr):
+       (www:splitstr):
+       (www:url_breaks):
+       (www:url_breaks_split):
+       (LINKSTYLE): Report expected number of arguments in diagnostics.
+       (www:fontstyle): Shorten diagnostic message.
+
+2020-09-25  G. Branden Robinson <g.branden.robinson@gmail.com>
+
        * src/roff/troff/div.cpp
        (top_level_diversion::clear_diversion_trap): Fix copy and paste
        error in diagnostic, which wrongly reported that a top-level
diff --git a/tmac/www.tmac.in b/tmac/www.tmac.in
index 74c864d..347c960 100644
--- a/tmac/www.tmac.in
+++ b/tmac/www.tmac.in
@@ -147,16 +147,25 @@ following, HTML always denotes XHTML also.
 .als www:error www-error
 .
 .\" --------------------------------------------------------------------
+.\" www:fatal (<test>...)
+.\"
+.\" Print fatal error message and abort.
+.\"
+.de www-fatal
+.  ab \\n[.F]:\\n[.c]: fatal macro error: \\$*
+..
+.
+.als www:fatal www-fatal
+.
+.\" --------------------------------------------------------------------
 .\" www:lenstr (<register_name> <string_name>)
 .\"
 .\" Store length of string named <string_name> into register named
 .\" <register_name>.
 .\"
 .de www:lenstr
-.  if !(\\n[.$] == 2) \{\
-.    tm .\\$0 expects 2 arguments.
-.    ab
-.  \}
+.  if !(\\n[.$] == 2) \
+.    www:fatal .\\$0 expects 2 arguments, got \\n[.$]
 .  length \\$0:n x\\*[\\$2]
 .  nr \\$1 (\\n[\\$0:n] - 1)
 .  rr \\$0:n
@@ -171,7 +180,7 @@ following, HTML always denotes XHTML also.
 .\"
 .de www:splitstr
 .  if !(\\n[.$] == 1) \
-.    www:error .\\$0 expects 1 argument.
+.    www:error .\\$0 expects 1 argument, got \\n[.$]
 .  if '\\*[\\$1]'' \
 .    return
 .  ds \\$0:r "\\*[\\$1]\"
@@ -208,7 +217,7 @@ following, HTML always denotes XHTML also.
 .\"
 .de www:url_breaks
 .  if !(\\n[.$] == 1) \
-.    www:error .\\$0 expects 1 argument.
+.    www:error .\\$0 expects 1 argument, got \\n[.$]
 .  if !\n[www:substring_ok] \
 .    return
 .  ds \\$0:s "\\*[\\$1]\"
@@ -228,7 +237,7 @@ following, HTML always denotes XHTML also.
 .de www:url_breaks_split
 .  nr \\$0:min 5        \" minimal number of characters for next line
 .  if (\\n[.$] < 2) \
-.    www:error .\\$0 expects at least 2 arguments.
+.    www:error .\\$0 expects at least 2 arguments, got \\n[.$]
 .  ds \\$0:res \\$1\"
 .  shift
 .  ds \\$0:s
@@ -1584,7 +1593,7 @@ following, HTML always denotes XHTML also.
 .\"
 .de LINKSTYLE
 .  if (\\n[.$] < 1) \
-.    www:error .\\$0 expects at least 1 argument.
+.    www:error .\\$0 expects at least 1 argument, got \\n[.$]
 .  ds www:color \\$1\"
 .  shift
 .  if (\\n[.$] < 1) \
@@ -1592,7 +1601,7 @@ following, HTML always denotes XHTML also.
 .  ds www:fontstyle \\$1\"
 .  shift
 .  if (\\n[.$] < 1) \
-.    www:error .\\$0 expects that both the open and close glyph is specified
+.    www:error .\\$0 expects both open and close glyphs to be specified
 .  ds www:open \\$1\"
 .  ds www:close \\$2\"
 ..



reply via email to

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