Skip to content

Commit 5236aa8

Browse files
committed
telepen: Uplift
1 parent c94ea6c commit 5236aa8

1 file changed

Lines changed: 54 additions & 52 deletions

File tree

src/telepen.ps.src

Lines changed: 54 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
% Barcode Writer in Pure PostScript
22
% https://bwipp.terryburton.co.uk
33
%
4-
% Copyright (c) 2004-2024 Terry Burton
4+
% Copyright (c) 2004-2025 Terry Burton
55
%
66
% $Id$
77
%
@@ -38,19 +38,54 @@
3838
currentglobal
3939
true setglobal
4040
/setpacking where {pop currentpacking true setpacking} if
41-
10 dict
42-
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
43-
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
41+
50 dict
4442
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
4543
dup /processoptions dup /uk.co.terryburton.bwipp findresource put
4644
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
4745
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
4846
begin
47+
48+
/telepen.encs [
49+
(31313131) (1131313111) (33313111) (1111313131)
50+
(3111313111) (11333131) (13133131) (111111313111)
51+
(31333111) (1131113131) (33113131) (1111333111)
52+
(3111113131) (1113133111) (1311133111) (111111113131)
53+
(3131113111) (11313331) (333331) (111131113111)
54+
(31113331) (1133113111) (1313113111) (1111113331)
55+
(31131331) (113111113111) (3311113111) (1111131331)
56+
(311111113111) (1113111331) (1311111331) (11111111113111)
57+
(31313311) (1131311131) (33311131) (1111313311)
58+
(3111311131) (11333311) (13133311) (111111311131)
59+
(31331131) (1131113311) (33113311) (1111331131)
60+
(3111113311) (1113131131) (1311131131) (111111113311)
61+
(3131111131) (1131131311) (33131311) (111131111131)
62+
(3111131311) (1133111131) (1313111131) (111111131311)
63+
(3113111311) (113111111131) (3311111131) (111113111311)
64+
(311111111131) (111311111311) (131111111311) (11111111111131)
65+
(3131311111) (11313133) (333133) (111131311111)
66+
(31113133) (1133311111) (1313311111) (1111113133)
67+
(313333) (113111311111) (3311311111) (11113333)
68+
(311111311111) (11131333) (13111333) (11111111311111)
69+
(31311133) (1131331111) (33331111) (1111311133)
70+
(3111331111) (11331133) (13131133) (111111331111)
71+
(3113131111) (1131111133) (33111133) (111113131111)
72+
(3111111133) (111311131111) (131111131111) (111111111133)
73+
(31311313) (113131111111) (3331111111) (1111311313)
74+
(311131111111) (11331313) (13131313) (11111131111111)
75+
(3133111111) (1131111313) (33111313) (111133111111)
76+
(3111111313) (111313111111) (131113111111) (111111111313)
77+
(313111111111) (1131131113) (33131113) (11113111111111)
78+
(3111131113) (113311111111) (131311111111) (111111131113)
79+
(3113111113) (11311111111111) (331111111111) (111113111113)
80+
(31111111111111) (111311111113) (131111111113) (1111111111111111)
81+
] readonly def
82+
4983
/telepen {
5084

51-
20 dict begin % Confine variables to local scope
85+
20 dict begin
5286

5387
/ctx null def
88+
5489
/numeric false def
5590
/dontdraw false def
5691
/includetext false def % Enable/disable text
@@ -63,9 +98,9 @@ begin
6398
//processoptions exec /options exch def
6499
/barcode exch def
65100

66-
/telepen //loadctx exec
67-
101+
%
68102
% Parse ordinals of the form ^NNN to ASCII
103+
%
69104
/fncvals <<
70105
/parse parse
71106
/parseonly true
@@ -79,49 +114,13 @@ begin
79114
/bwipp.telepenNumericOddLength (Telepen Numeric must have an even length) //raiseerror exec
80115
} if
81116

82-
% Create an array containing the character mappings
83-
{
84-
/encs
85-
[ (31313131) (1131313111) (33313111) (1111313131)
86-
(3111313111) (11333131) (13133131) (111111313111)
87-
(31333111) (1131113131) (33113131) (1111333111)
88-
(3111113131) (1113133111) (1311133111) (111111113131)
89-
(3131113111) (11313331) (333331) (111131113111)
90-
(31113331) (1133113111) (1313113111) (1111113331)
91-
(31131331) (113111113111) (3311113111) (1111131331)
92-
(311111113111) (1113111331) (1311111331) (11111111113111)
93-
(31313311) (1131311131) (33311131) (1111313311)
94-
(3111311131) (11333311) (13133311) (111111311131)
95-
(31331131) (1131113311) (33113311) (1111331131)
96-
(3111113311) (1113131131) (1311131131) (111111113311)
97-
(3131111131) (1131131311) (33131311) (111131111131)
98-
(3111131311) (1133111131) (1313111131) (111111131311)
99-
(3113111311) (113111111131) (3311111131) (111113111311)
100-
(311111111131) (111311111311) (131111111311) (11111111111131)
101-
(3131311111) (11313133) (333133) (111131311111)
102-
(31113133) (1133311111) (1313311111) (1111113133)
103-
(313333) (113111311111) (3311311111) (11113333)
104-
(311111311111) (11131333) (13111333) (11111111311111)
105-
(31311133) (1131331111) (33331111) (1111311133)
106-
(3111331111) (11331133) (13131133) (111111331111)
107-
(3113131111) (1131111133) (33111133) (111113131111)
108-
(3111111133) (111311131111) (131111131111) (111111111133)
109-
(31311313) (113131111111) (3331111111) (1111311313)
110-
(311131111111) (11331313) (13131313) (11111131111111)
111-
(3133111111) (1131111313) (33111313) (111133111111)
112-
(3111111313) (111313111111) (131113111111) (111111111313)
113-
(313111111111) (1131131113) (33131113) (11113111111111)
114-
(3111131113) (113311111111) (131311111111) (111111131113)
115-
(3113111113) (11311111111111) (331111111111) (111113111113)
116-
(31111111111111) (111311111113) (131111111113) (1111111111111111)
117-
] def
118-
} ctxdef
119-
120117
/sbs barlen 16 mul 48 add string def
121118
/txt barlen array def
122119

120+
%
123121
% Put the start character ASCII 95
124-
/enc encs 95 get def
122+
%
123+
/enc //telepen.encs 95 get def
125124
sbs 0 enc putinterval
126125
/l enc length def
127126

@@ -165,28 +164,33 @@ begin
165164
/i i 1 add def
166165
} ifelse
167166
/checksum checksum indx add def
168-
/enc encs indx get def
167+
/enc //telepen.encs indx get def
169168
sbs l enc putinterval % Put encoded digit into sbs
170169
/l l enc length add def
171170
/j j 1 add def
172171
} loop
173172

173+
%
174174
% Put the checksum character
175+
%
175176
/checksum 127 checksum 127 mod sub 127 mod def
176-
/enc encs checksum get def
177+
/enc //telepen.encs checksum get def
177178
sbs l enc putinterval
178179
/l l enc length add def
179180

181+
%
180182
% Put the end character ASCII 122
181-
/enc encs 122 get def
183+
%
184+
/enc //telepen.encs 122 get def
182185
sbs l enc putinterval
183186
/l l enc length add def
184187

188+
%
185189
% Shrink sbs and txt to fit exactly
190+
%
186191
/sbs sbs 0 l getinterval def
187192
/txt txt 0 j getinterval def
188193

189-
% Return the arguments
190194
<<
191195
/ren /renlinear
192196
/sbs [sbs {48 sub} forall]
@@ -200,8 +204,6 @@ begin
200204

201205
dontdraw not //renlinear if
202206

203-
//unloadctx exec
204-
205207
end
206208

207209
}

0 commit comments

Comments
 (0)