Skip to content

Commit 16fcfa6

Browse files
committed
mands: Don't fail if includetext isn't provided
1 parent 40da255 commit 16fcfa6

2 files changed

Lines changed: 22 additions & 22 deletions

File tree

src/mands.ps.src

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
%
44
% vim: set sw=4 sts=4 et:
55
%
6-
% Copyright (c) 2004-2025 Terry Burton
6+
% Copyright (c) 2004-2026 Terry Burton
77
%
88
% $Id$
99
%
@@ -91,28 +91,25 @@ begin
9191
dup 2 get 11 exch put
9292

9393
%
94-
% Fix up the text for 7-digit inputs
94+
% Fix up the text for 7-digit inputs and add the M and S guards
9595
%
96-
/txt args (txt) get def
97-
barlen 7 eq {
98-
0 1 6 {
99-
txt exch 2 copy
100-
1 add get 0 get 3 1 roll get
101-
0 get exch 0 exch putinterval
102-
} for
103-
txt 7 get 0 get 0 ( ) putinterval
96+
includetext {
97+
/txt args (txt) get def
98+
barlen 7 eq {
99+
0 1 6 {
100+
txt exch 2 copy
101+
1 add get 0 get 3 1 roll get
102+
0 get exch 0 exch putinterval
103+
} for
104+
txt 7 get 0 get 0 ( ) putinterval
105+
} if
106+
10 array dup 0 txt putinterval /txt exch def
107+
txt 0 get dup length array copy txt exch 8 exch put
108+
txt 0 get dup length array copy txt exch 9 exch put
109+
txt 8 get 0 (M) put txt 8 get 1 -12 put
110+
txt 9 get 0 (S) put txt 9 get 1 69 put
111+
args (txt) txt put
104112
} if
105-
106-
%
107-
% Add the M and S guards
108-
%
109-
10 array dup 0 txt putinterval /txt exch def
110-
txt 0 get dup length array copy txt exch 8 exch put
111-
txt 0 get dup length array copy txt exch 9 exch put
112-
txt 8 get 0 (M) put txt 8 get 1 -12 put
113-
txt 9 get 0 (S) put txt 9 get 1 69 put
114-
115-
args (txt) txt put
116113
args (opt) options put
117114
args
118115

tests/ps_tests/mands.ps.test

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
%
44
% vim: set sw=4 sts=4 et:
55
%
6-
% Copyright (c) 2004-2025 Terry Burton
6+
% Copyright (c) 2004-2026 Terry Burton
77
%
88

99
/mands dup /uk.co.terryburton.bwipp findresource cvx def
@@ -17,3 +17,6 @@
1717
%
1818

1919
{ (123456) (dontdraw) mands } /bwipp.MandSbadLength isError
20+
21+
% Without includetext
22+
(12345670) (dontdraw) mands pop

0 commit comments

Comments
 (0)