7474 /modunit 1 def
7575
7676 /apply //processoptions exec /options exch def
77- /issntxt exch def
7877 /global_encoder_defaults //render exec
7978
79+ /barcode exch def
80+
8081 /_render
8182 dontdraw /uk.co.terryburton.bwipp.global_ctx dup where {exch get /enabledontdraw known} {pop false} ifelse and
8283 /uk.co.terryburton.bwipp._dontdraw dup where {exch get} {pop false} ifelse or not
8586 %
8687 % Split off the ISSN
8788 %
88- issntxt ( ) search {
89- /issntxt exch def
89+ barcode ( ) search {
90+ /barcode exch def
9091 pop
9192 /seqvar exch def
9293 } {
@@ -109,24 +110,24 @@ begin
109110 %
110111 % Validate the input
111112 %
112- issntxt length 8 ne issntxt length 9 ne and {
113+ barcode length 8 ne barcode length 9 ne and {
113114 /bwipp.issnBadLength (ISSN must be 8 or 9 characters including dash, in the format XXXX-XXXX) //raiseerror exec
114115 } if
115- issntxt 0 4 getinterval {
116+ barcode 0 4 getinterval {
116117 dup 48 lt exch 57 gt or {
117118 /bwipp.issnFirstThroughFourthNotNumeric (ISSN first four characters must be numeral characters) //raiseerror exec
118119 } if
119120 } forall
120- issntxt 4 1 getinterval (-) ne {
121+ barcode 4 1 getinterval (-) ne {
121122 /bwipp.issnNeedsDash (ISSN fifth character must be a dash) //raiseerror exec
122123 } if
123- issntxt 5 3 getinterval {
124+ barcode 5 3 getinterval {
124125 dup 48 lt exch 57 gt or {
125126 /bwipp.issnSixthThroughEighthNotNumeric (ISSN sixth through eighth characters must be numerals) //raiseerror exec
126127 } if
127128 } forall
128- issntxt length 9 eq {
129- issntxt 8 get dup dup 48 lt exch 57 gt or exch 88 ne and { % Digits or X
129+ barcode length 9 eq {
130+ barcode 8 get dup dup 48 lt exch 57 gt or exch 88 ne and { % Digits or X
130131 /bwipp.issnNinthCharacterBadFormat (ISSN ninth character must be a number or the character X) //raiseerror exec
131132 } if
132133 } if
@@ -143,13 +144,13 @@ begin
143144 } if
144145
145146 %
146- % Read the digits from issntxt and calculate checksums
147+ % Read the digits from barcode and calculate checksums
147148 %
148149 /issn 8 string def
149150 /checksum 0 def
150151 /i 0 def /n 0 def
151152 { % loop
152- /issnchar issntxt i get 48 sub def
153+ /issnchar barcode i get 48 sub def
153154 issnchar -3 ne { % Ignore dashes
154155 issn n issnchar 48 add put
155156 n 7 lt {
@@ -158,22 +159,22 @@ begin
158159 /n n 1 add def
159160 } if
160161 /i i 1 add def
161- i issntxt length eq {exit} if
162+ i barcode length eq {exit} if
162163 } loop
163164 /checksum 11 checksum 11 mod sub 11 mod def
164165 /checksum checksum 48 add dup 58 eq {pop 88} if def
165- issntxt length 9 eq {
166- issntxt 8 get checksum ne {
166+ barcode length 9 eq {
167+ barcode 8 get checksum ne {
167168 /bwipp.issnBadCheckDigit (Incorrect ISSN check digit provided) //raiseerror exec
168169 } if
169170 } if
170171
171172 %
172- % Add the ISSN header and checksum to the issntxt
173+ % Build the ISSN display text
173174 %
174175 /pad 14 string def
175176 pad 0 (ISSN ) putinterval
176- pad 5 issntxt putinterval % Add issntxt to the pad
177+ pad 5 barcode putinterval % Add barcode to the pad
177178 pad 13 checksum put
178179 /issntxt pad def
179180
0 commit comments