[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 18/36: [mm]: Fix bugs in `EPIC`.
From: |
G. Branden Robinson |
Subject: |
[groff] 18/36: [mm]: Fix bugs in `EPIC`. |
Date: |
Tue, 17 Jan 2023 20:45:12 -0500 (EST) |
gbranden pushed a commit to branch master
in repository groff.
commit f2af717d00e9fa01fdd302db81979e4c93237279
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Mon Jan 16 12:56:54 2023 -0600
[mm]: Fix bugs in `EPIC`.
* contrib/mm/m.tmac (EPIC): Handle and shift off a leading "-L" argument
before checking argument count. Then, if fewer than two arguments
remain, throw warning diagnostic and return early instead of bombing
out. Do bomb out (with diagnostic) if either of the width or height
arguments are not numeric expressions. Fix bug which prevented third
argument from being interpreted. Annotate potential future
development.
---
contrib/mm/ChangeLog | 10 ++++++++++
contrib/mm/m.tmac | 19 +++++++++++++------
2 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/contrib/mm/ChangeLog b/contrib/mm/ChangeLog
index 45a7fc57b..dfa2e719e 100644
--- a/contrib/mm/ChangeLog
+++ b/contrib/mm/ChangeLog
@@ -1,3 +1,13 @@
+2023-01-16 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ * m.tmac (EPIC): Handle and shift off a leading "-L" argument
+ before checking argument count. Then, if fewer than two
+ arguments remain, throw warning diagnostic and return early
+ instead of bombing out. Do bomb out (with diagnostic) if either
+ of the width or height arguments are not numeric expressions.
+ Fix bug which prevented third argument from being interpreted.
+ Annotate potential future development.
+
2023-01-16 G. Branden Robinson <g.branden.robinson@gmail.com>
* m.tmac (AU): Partially revert commit 4fd984adc9, 2021-07-17.
diff --git a/contrib/mm/m.tmac b/contrib/mm/m.tmac
index e1dd8082e..f81f29f1c 100644
--- a/contrib/mm/m.tmac
+++ b/contrib/mm/m.tmac
@@ -914,17 +914,24 @@ in=\\n[.i] fi=\\n[.u] .d=\\n[.d] nl=\\n[nl] pg=\\n[%]
.\" external picture
.\" -L left align
.de EPIC
-.if \\n[.$]<2 .@error "EPIC: Not enough arguments"
.nr pict*adj 0 \" centered
.if '\\$1'-L' \{\
-. shift 1 \" left align
+. shift
. nr pict*adj 1
.\}
+.if \\n[.$]<2 \{\
+. @warning \\$0: ignoring; expected width and height arguments
+. return
+.\}
+.\" Permit a document to start with EPIC.
.if \\n[nl]<0 \&
-.nr pict*w \\$1
-.nr pict*h \\$2
-.ds pict*name "External picture
-.if !''$3' .ds pict*name \\$3
+.ie \B'\\$1' .nr pict*w \\$1
+.el .@error \\$0: width parameter is not numeric; got '\\$1'
+.ie \B'\\$2' .nr pict*h \\$2
+.el .@error \\$0: height parameter is not numeric; got '\\$2'
+.\" XXX: This is kind of lame. It's also not localized.
+.ds pict*name External picture\"
+.if !''\\$3' .ds pict*name " \\$3\"
.ne \\n[pict*h]u
.sp \\n[pict*h]u-1v
.nr pict*ind 0
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 18/36: [mm]: Fix bugs in `EPIC`.,
G. Branden Robinson <=