r19685 by fschmid - Fixed Bug #12858: Barcode plugin updated barcode.ps file
scribus-commit
scribus-commit at lists.scribus.net
Fri Dec 26 13:57:08 UTC 2014
Author: fschmid
Date: Fri Dec 26 13:57:08 2014
New Revision: 19685
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19685
Log:
Fixed Bug #12858: Barcode plugin updated barcode.ps file
Modified:
trunk/Scribus/scribus/plugins/barcodegenerator/barcode.ps
Modified: trunk/Scribus/scribus/plugins/barcodegenerator/barcode.ps
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19685&path=/trunk/Scribus/scribus/plugins/barcodegenerator/barcode.ps
==============================================================================
--- trunk/Scribus/scribus/plugins/barcodegenerator/barcode.ps (original)
+++ trunk/Scribus/scribus/plugins/barcodegenerator/barcode.ps Fri Dec 26 13:57:08 2014
@@ -1,10 +1,9 @@
%!PS
-% Barcode Writer in Pure PostScript - Version 2014-01-30
-% http://www.terryburton.co.uk/barcodewriter/
+
+% Barcode Writer in Pure PostScript - Version 2014-12-11
+% http://bwipp.terryburton.co.uk
%
% Copyright (c) 2004-2014 Terry Burton
-%
-% $Id$
%
% Permission is hereby granted, free of charge, to any
% person obtaining a copy of this software and associated
@@ -33,7 +32,7 @@
% --BEGIN TEMPLATE--
% --BEGIN RESOURCE preamble--
-%%BeginResource: Category uk.co.terryburton.bwipp 0.0 2014013000 35431 31872
+%%BeginResource: Category uk.co.terryburton.bwipp 0.0 2014121100 35431 31768
%%BeginData: 6 ASCII Lines
currentglobal
true setglobal
@@ -47,7 +46,7 @@
% --BEGIN RESOURCE raiseerror--
% --REQUIRES preamble--
-%%BeginResource: uk.co.terryburton.bwipp raiseerror 0.0 2014013000 112041 44115
+%%BeginResource: uk.co.terryburton.bwipp raiseerror 0.0 2014121100 112145 43907
%%BeginData: 13 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -56,7 +55,7 @@
$error exch /errorinfo exch put
$error exch /errorname exch put
$error /command null put
- $error /newerror true put
+ $error /newerror true put
handleerror quit
} bind def
/raiseerror dup load /uk.co.terryburton.bwipp defineresource pop
@@ -68,7 +67,7 @@
% --BEGIN RENDERER renlinear--
% --REQUIRES preamble raiseerror--
-%%BeginResource: uk.co.terryburton.bwipp renlinear 0.0 2014013000 80519 79841
+%%BeginResource: uk.co.terryburton.bwipp renlinear 0.0 2014121100 80415 79633
%%BeginData: 237 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -115,10 +114,10 @@
/guardrightypos 0 def
/guardwidth 6 def
/guardheight 7 def
-
+
% Apply the renderer options and the user options
args {def} forall
- opt {def} forall
+ opt {def} forall
/barcolor barcolor cvlit def
/textcolor textcolor cvlit def
@@ -147,7 +146,7 @@
/guardrightypos guardrightypos cvr def
/guardwidth guardwidth cvr def
/guardheight guardheight cvr def
-
+
% Create bar elements and put them into the bars array
/bars sbs length 1 add 2 idiv array def
/x 0.00 def /maxh 0 def
@@ -166,7 +165,7 @@
bars i 2 idiv -1 put % Dummy entry
} ifelse
} {
- /d sbs i get spaceratio mul spaceratio sub 1 add def % d=digit*r-r+1
+ /d sbs i get spaceratio mul spaceratio sub 1 add def % d=digit*r-r+1
} ifelse
/x x d add def % x+=d
} for
@@ -197,16 +196,16 @@
x borderleft add borderright add 0 rlineto
0 maxh borderbottom add bordertop add rlineto
x borderleft add borderright add neg 0 rlineto
- 0 maxh borderbottom add bordertop add neg rlineto
+ 0 maxh borderbottom add bordertop add neg rlineto
closepath
- backgroundcolor (unset) ne { gsave backgroundcolor setanycolor fill grestore } if
+ backgroundcolor (unset) ne { gsave backgroundcolor setanycolor fill grestore } if
showborder {
gsave
bordercolor (unset) ne { bordercolor setanycolor } if
borderwidth setlinewidth stroke
grestore
- } if
-
+ } if
+
% Display the bars for elements in the bars array
gsave
0 setlinecap
@@ -219,7 +218,7 @@
} ifelse
} forall
grestore
-
+
% Display the text for elements in the text array
textcolor (unset) ne { textcolor setanycolor } if
includetext {
@@ -228,8 +227,8 @@
txt {
{} forall
2 copy s ne exch fn ne or {
- 2 copy /s exch def /fn exch def
- exch findfont exch scalefont setfont
+ 2 copy /s exch def /fn exch def
+ exch findfont exch scalefont setfont
} {
pop pop
} ifelse
@@ -278,7 +277,7 @@
textyalign (center) eq { /textypos textyoffset maxh textascent sub 2 div add def } if
textxpos textypos moveto textgaps 0 tstr ashow
} ifelse
- } if
+ } if
% Display the guard elements
guardwhitespace {
@@ -288,19 +287,19 @@
guardleftpos neg guardwidth add guardleftypos guardwidth 2 div add moveto
guardwidth neg guardheight -2 div rlineto
guardwidth guardheight -2 div rlineto
- stroke
+ stroke
} if
guardrightpos 0 ne {
newpath
guardrightpos x add guardwidth sub guardrightypos guardheight 2 div add moveto
guardwidth guardheight -2 div rlineto
guardwidth neg guardheight -2 div rlineto
- stroke
- } if
- } if
-
+ stroke
+ } if
+ } if
+
grestore
-
+
end
} bind def
@@ -313,7 +312,7 @@
% --BEGIN RENDERER renmatrix--
% --REQUIRES preamble raiseerror--
-%%BeginResource: uk.co.terryburton.bwipp renmatrix 0.0 2014013000 54629 54543
+%%BeginResource: uk.co.terryburton.bwipp renmatrix 0.0 2014121100 54629 54335
%%BeginData: 66 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -356,7 +355,7 @@
currentpoint translate
width pixx div 72 mul height pixy div 72 mul scale
0 0 moveto pixx 0 lineto pixx pixy lineto 0 pixy lineto closepath
- backgroundcolor (unset) ne { gsave backgroundcolor setanycolor fill grestore } if
+ backgroundcolor (unset) ne { gsave backgroundcolor setanycolor fill grestore } if
barcolor (unset) ne { barcolor setanycolor } if
/xyget {pixx mul add get} bind def
newpath
@@ -387,7 +386,7 @@
% --BEGIN RENDERER renmaximatrix--
% --REQUIRES preamble raiseerror--
-%%BeginResource: uk.co.terryburton.bwipp renmaximatrix 0.0 2014013000 55933 55803
+%%BeginResource: uk.co.terryburton.bwipp renmaximatrix 0.0 2014121100 55829 55803
%%BeginData: 79 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -428,15 +427,15 @@
2.4945 dup scale % from 1pt to 1.88mm
0 0 moveto 30 0 lineto 30 29 lineto 0 29 lineto closepath
- backgroundcolor (unset) ne { gsave backgroundcolor setanycolor fill grestore } if
+ backgroundcolor (unset) ne { gsave backgroundcolor setanycolor fill grestore } if
barcolor (unset) ne { barcolor setanycolor } if
0.5 0.5774 translate
newpath
pixs {
- dup
- /x exch 30 mod def
+ dup
+ /x exch 30 mod def
/y exch 30 idiv def
y 2 mod 0 eq {x} {x 0.5 add} ifelse
32 y sub 0.8661 mul
@@ -478,7 +477,7 @@
% --EXAM: 90200
% --EXOP: includetext guardwhitespace
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp ean5 0.0 2014013000 64172 63771
+%%BeginResource: uk.co.terryburton.bwipp ean5 0.0 2014121100 64068 63875
%%BeginData: 135 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -498,8 +497,8 @@
/textsize 12 def
/textxoffset 0 def
/textyoffset (unset) def
- /height 0.7 def
-
+ /height 0.7 def
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -509,8 +508,8 @@
} loop
currentdict end /options exch def
} if
- options {def} forall
-
+ options {def} forall
+
/textfont textfont cvlit def
/textsize textsize cvr def
/height height cvr def
@@ -530,7 +529,7 @@
/bwipp.ean5badCharacter (EAN-5 add-on must contain only digits) //raiseerror exec
} if
} forall
-
+
% Create an array containing the character mappings
/encs
[ (3211) (2221) (2122) (1411) (1132)
@@ -561,7 +560,7 @@
/sbs 31 string def
/txt 5 array def
-
+
0 1 4 {
/i exch def
@@ -625,7 +624,7 @@
% --EXAM: 05
% --EXOP: includetext guardwhitespace
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp ean2 0.0 2014013000 62649 62505
+%%BeginResource: uk.co.terryburton.bwipp ean2 0.0 2014121100 62753 62505
%%BeginData: 120 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -646,7 +645,7 @@
/textxoffset 0 def
/textyoffset (unset) def
/height 0.7 def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -657,7 +656,7 @@
currentdict end /options exch def
} if
options {def} forall
-
+
/textfont textfont cvlit def
/textsize textsize cvr def
/height height cvr def
@@ -677,7 +676,7 @@
/bwipp.ean2badCharacter (EAN-2 add-on must contain only digits) //raiseerror exec
} if
} forall
-
+
% Create an array containing the character mappings
/encs
[ (3211) (2221) (2122) (1411) (1132)
@@ -693,7 +692,7 @@
/sbs 13 string def
/txt 2 array def
-
+
0 1 1 {
/i exch def
@@ -710,7 +709,7 @@
length /indx exch def % indx is the length of pre
pop pop % Discard seek and post
/enc encs indx get def % Get the indxth encoding
- mirrormap i get 49 eq { % Reverse enc if 1 in this position in mirrormap
+ mirrormap i get 49 eq { % Reverse enc if 1 in this position in mirrormap
/enclen enc length def
/revenc enclen string def
0 1 enclen 1 sub {
@@ -757,7 +756,7 @@
% --EXAM: 2112345678900
% --EXOP: includetext guardwhitespace
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp ean13 0.0 2014013000 87575 97526
+%%BeginResource: uk.co.terryburton.bwipp ean13 0.0 2014121100 87471 83758
%%BeginData: 215 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -802,7 +801,7 @@
/textxoffset textxoffset cvr def
/textyoffset textyoffset cvr def
/height height cvr def
- /addongap addongap cvr def
+ /addongap addongap cvr def
addontextfont (unset) ne {/addontextfont addontextfont cvlit def} if
addontextsize (unset) ne {/addontextsize addontextsize cvr def} if
addontextxoffset (unset) ne {/addontextxoffset addontextxoffset cvr def} if
@@ -871,7 +870,7 @@
/sbs 59 string def
/txt 13 array def
-
+
% Put the start character
sbs 0 encs 10 get putinterval
@@ -951,8 +950,8 @@
/bbs [bbs aload pop addcode (bbs) get {.075 add} forall] def
/txt [txt aload pop addcode (txt) get aload pop] def
/guardrightypos height 72 mul 6 sub def
- } if
-
+ } if
+
% Return the arguments
<<
/ren //renlinear
@@ -984,7 +983,7 @@
% --EXAM: 02345673
% --EXOP: includetext guardwhitespace
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp ean8 0.0 2014013000 84797 91233
+%%BeginResource: uk.co.terryburton.bwipp ean8 0.0 2014121100 84693 80881
%%BeginData: 196 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -1012,7 +1011,7 @@
/addontextsize (unset) def
/addontextxoffset (unset) def
/addontextyoffset (unset) def
-
+
% Parse the input options, either a string or a dict
options type /stringtype eq {
1 dict begin
@@ -1023,7 +1022,7 @@
currentdict end /options exch def
} if
options {def} forall
-
+
/textfont textfont cvlit def
/textsize textsize cvr def
/textxoffset textxoffset cvr def
@@ -1079,7 +1078,7 @@
pad 0 barcode putinterval % Add barcode to the start of the pad
pad 7 checksum 48 add put % Put ascii for checksum at end of pad
/barcode pad def
-
+
% Create an array containing the character mappings
/encs
[ (3211) (2221) (2122) (1411) (1132)
@@ -1092,7 +1091,7 @@
/sbs 43 string def
/txt 8 array def
-
+
% Put the start character
sbs 0 encs 10 get putinterval
@@ -1158,7 +1157,7 @@
/bbs [bbs aload pop addcode (bbs) get {.075 add} forall] def
/txt [txt aload pop addcode (txt) get aload pop] def
/guardrightypos height 72 mul 6 sub def
- } if
+ } if
% Return the arguments
<<
@@ -1192,8 +1191,8 @@
% --EXAM: 416000336108
% --EXOP: includetext
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp upca 0.0 2014013000 86287 96243
-%%BeginData: 203 ASCII Lines
+%%BeginResource: uk.co.terryburton.bwipp upca 0.0 2014121100 92328 88533
+%%BeginData: 248 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
@@ -1214,7 +1213,7 @@
/textsize 12 def
/textxoffset -7 def
/textyoffset -4 def
- /height 1 def
+ /height 1 def
/addongap 12 def
/addontextfont (unset) def
/addontextsize (unset) def
@@ -1230,7 +1229,7 @@
} loop
currentdict end /options exch def
} if
- options {def} forall
+ options {def} forall
/textfont textfont cvlit def
/textsize textsize cvr def
@@ -1253,6 +1252,51 @@
/addon () def
} ifelse
+ % Expand a given UPC-E
+ barcode length 7 eq barcode length 8 eq or {
+ % Validate the input
+ barcode {
+ dup 48 lt exch 57 gt or {
+ /bwipp.upcAupcEbadCharacter (UPC-E must contain only digits) //raiseerror exec
+ } if
+ } forall
+ barcode 0 get dup 48 ne exch 49 ne and {
+ /bwipp.upcAupcEbadNumberSystem (UPC-E must have number system 0 or 1) //raiseerror exec
+ } if
+ 1 { % Common exit
+ /upcacode barcode length 8 eq {12} {11} ifelse string def
+ barcode 6 get 48 sub 2 le {
+ upcacode 0 barcode 0 3 getinterval putinterval
+ upcacode 3 barcode 6 1 getinterval putinterval
+ upcacode 4 (0000) putinterval
+ upcacode 8 barcode 3 3 getinterval putinterval
+ exit
+ } if
+ barcode 6 get 48 sub 3 eq {
+ upcacode 0 barcode 0 4 getinterval putinterval
+ upcacode 4 (00000) putinterval
+ upcacode 9 barcode 4 2 getinterval putinterval
+ exit
+ } if
+ barcode 6 get 48 sub 4 eq {
+ upcacode 0 barcode 0 5 getinterval putinterval
+ upcacode 5 (00000) putinterval
+ upcacode 10 barcode 5 1 getinterval putinterval
+ exit
+ } if
+ barcode 6 get 48 sub 5 ge {
+ upcacode 0 barcode 0 6 getinterval putinterval
+ upcacode 6 (0000) putinterval
+ upcacode 10 barcode 6 1 getinterval putinterval
+ exit
+ } if
+ } repeat
+ barcode length 8 eq {
+ upcacode 11 barcode 7 1 getinterval putinterval
+ } if
+ /barcode upcacode def
+ } if
+
% Validate the input
barcode length 11 ne barcode length 12 ne and {
/bwipp.upcAbadLength (UPC-A must be 11 or 12 digits) //raiseerror exec
@@ -1265,7 +1309,7 @@
addon length 0 ne addon length 2 ne and addon length 5 ne and {
/bwipp.upcAbadAddOnLength (Add-on for UPC-A must be 2 or 5 digits) //raiseerror exec
} if
-
+
% Add checksum digit to barcode
/pad 12 string def % Create pad one bigger than barcode
/checksum 0 def
@@ -1281,7 +1325,7 @@
/checksum 10 checksum 10 mod sub 10 mod def
barcode length 12 eq {
barcode 11 get checksum 48 add ne {
- /bwipp.upcAbadCheckDigit (Incorrect UPC-A check digit provided) //raiseerror exec
+ /bwipp.upcAbadCheckDigit (Incorrect UPC check digit provided) //raiseerror exec
} if
} if
pad 0 barcode putinterval % Add barcode to the start of the pad
@@ -1374,7 +1418,7 @@
/bbs [bbs aload pop addcode (bbs) get {.075 add} forall] def
/txt [txt aload pop addcode (txt) get aload pop] def
/guardrightypos height 72 mul 6 sub def
- } if
+ } if
% Return the arguments
<<
@@ -1407,8 +1451,8 @@
% --EXAM: 00123457
% --EXOP: includetext
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp upce 0.0 2014013000 94123 96978
-%%BeginData: 237 ASCII Lines
+%%BeginResource: uk.co.terryburton.bwipp upce 0.0 2014121100 97037 93389
+%%BeginData: 287 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
@@ -1435,7 +1479,7 @@
/addontextsize (unset) def
/addontextxoffset (unset) def
/addontextyoffset (unset) def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -1446,7 +1490,7 @@
currentdict end /options exch def
} if
options {def} forall
-
+
/textfont textfont cvlit def
/textsize textsize cvr def
/textxoffset textxoffset cvr def
@@ -1468,6 +1512,47 @@
/addon () def
} ifelse
+ % Compress a given UPC-A
+ barcode length 11 eq barcode length 12 eq or {
+ % Validate the input
+ barcode {
+ dup 48 lt exch 57 gt or {
+ /bwipp.upcEupcAbadCharacter (UPC-A must contain only digits) //raiseerror exec
+ } if
+ } forall
+ 1 { % Common exit
+ /upcecode barcode length 12 eq {8} {7} ifelse string def
+ barcode 3 get 48 sub 2 le barcode 4 4 getinterval (0000) eq and {
+ upcecode 0 barcode 0 3 getinterval putinterval
+ upcecode 3 barcode 8 3 getinterval putinterval
+ upcecode 6 barcode 3 1 getinterval putinterval
+ exit
+ } if
+ barcode 4 5 getinterval (00000) eq {
+ upcecode 0 barcode 0 4 getinterval putinterval
+ upcecode 4 barcode 9 2 getinterval putinterval
+ upcecode 6 (3) putinterval
+ exit
+ } if
+ barcode 5 5 getinterval (00000) eq {
+ upcecode 0 barcode 0 5 getinterval putinterval
+ upcecode 5 barcode 10 1 getinterval putinterval
+ upcecode 6 (4) putinterval
+ exit
+ } if
+ barcode 10 get 48 sub 5 ge barcode 6 4 getinterval (0000) eq and {
+ upcecode 0 barcode 0 6 getinterval putinterval
+ upcecode 6 barcode 10 1 getinterval putinterval
+ exit
+ } if
+ /bwipp.upcEupcAnotCompressible (UPC-A cannot be converted to a UPC-E) //raiseerror exec
+ } repeat
+ barcode length 12 eq {
+ upcecode 7 barcode 11 1 getinterval putinterval
+ } if
+ /barcode upcecode def
+ } if
+
% Validate the input
barcode length 7 ne barcode length 8 ne and {
/bwipp.upcEbadLength (UPC-E must be 7 or 8 digits) //raiseerror exec
@@ -1502,25 +1587,34 @@
] def
% Derive the equivalent UPC-A for its checksum
- /upcacode (00000000000) 11 string copy def
- upcacode 0 barcode 0 get put
- barcode 6 get 48 sub 2 le {
- upcacode 1 barcode 1 2 getinterval putinterval
- upcacode 3 barcode 6 1 getinterval putinterval
- upcacode 8 barcode 3 3 getinterval putinterval
- } if
- barcode 6 get 48 sub 3 eq {
- upcacode 1 barcode 1 3 getinterval putinterval
- upcacode 9 barcode 4 2 getinterval putinterval
- } if
- barcode 6 get 48 sub 4 eq {
- upcacode 1 barcode 1 4 getinterval putinterval
- upcacode 10 barcode 5 1 getinterval putinterval
- } if
- barcode 6 get 48 sub 5 ge {
- upcacode 1 barcode 1 5 getinterval putinterval
- upcacode 10 barcode 6 1 getinterval putinterval
- } if
+ 1 { % Common exit
+ /upcacode 11 string def
+ barcode 6 get 48 sub 2 le {
+ upcacode 0 barcode 0 3 getinterval putinterval
+ upcacode 3 barcode 6 1 getinterval putinterval
+ upcacode 4 (0000) putinterval
+ upcacode 8 barcode 3 3 getinterval putinterval
+ exit
+ } if
+ barcode 6 get 48 sub 3 eq {
+ upcacode 0 barcode 0 4 getinterval putinterval
+ upcacode 4 (00000) putinterval
+ upcacode 9 barcode 4 2 getinterval putinterval
+ exit
+ } if
+ barcode 6 get 48 sub 4 eq {
+ upcacode 0 barcode 0 5 getinterval putinterval
+ upcacode 5 (00000) putinterval
+ upcacode 10 barcode 5 1 getinterval putinterval
+ exit
+ } if
+ barcode 6 get 48 sub 5 ge {
+ upcacode 0 barcode 0 6 getinterval putinterval
+ upcacode 6 (0000) putinterval
+ upcacode 10 barcode 6 1 getinterval putinterval
+ exit
+ } if
+ } repeat
/checksum 0 def
0 1 10 {
/i exch def
@@ -1534,7 +1628,7 @@
/checksum 10 checksum 10 mod sub 10 mod def
barcode length 8 eq {
barcode 7 get checksum 48 add ne {
- /bwipp.upcEbadCheckDigit (Incorrect UPC-E check digit provided) //raiseerror exec
+ /bwipp.upcEbadCheckDigit (Incorrect UPC check digit provided) //raiseerror exec
} if
} if
/pad 8 string def
@@ -1574,7 +1668,7 @@
length /indx exch def % indx is the length of pre
pop pop % Discard seek and post
/enc encs indx get def % Get the indxth encoding
- mirrormap i 1 sub get 49 eq { % Reverse enc if 1 in this position in mirrormap
+ mirrormap i 1 sub get 49 eq { % Reverse enc if 1 in this position in mirrormap
/enclen enc length def
/revenc enclen string def
0 1 enclen 1 sub {
@@ -1656,8 +1750,8 @@
% --EXAM: 978-1-56581-231-4 52250
% --EXOP: includetext guardwhitespace
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp isbn 0.0 2014013000 87301 87094
-%%BeginData: 159 ASCII Lines
+%%BeginResource: uk.co.terryburton.bwipp isbn 0.0 2014121100 92829 99144
+%%BeginData: 252 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
@@ -1669,7 +1763,7 @@
20 dict begin
/options exch def % We are given an options string
- /isbntxt exch def % We are given the isbn text with dashes
+ /barcode exch def % We are given the isbn text with dashes
/dontdraw false def
/includetext false def % Enable/disable ISBN text
@@ -1678,9 +1772,9 @@
/isbntextxoffset (unset) def
/isbntextyoffset (unset) def
/height 1 def
- /addongap 12 def
+ /addongap 12 def
/legacy false def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -1691,7 +1785,7 @@
currentdict end /options exch def
} if
options {def} forall
-
+
/isbntextfont isbntextfont cvlit def
/isbntextsize isbntextsize cvr def
isbntextxoffset (unset) ne {/isbntextxoffset isbntextxoffset cvr def} if
@@ -1700,8 +1794,8 @@
/addongap addongap cvr def
% Split off the addon
- isbntxt ( ) search {
- /isbntxt exch def
+ barcode ( ) search {
+ /barcode exch def
pop
/addon exch def
} {
@@ -1709,64 +1803,157 @@
/addon () def
} ifelse
- % Convert ISBN-10 to ISBN-13
- legacy not isbntxt length 13 le and {
- /pad isbntxt length 4 add string def
- pad 0 (978-) putinterval
- pad 4 isbntxt putinterval
- /isbntxt pad def
- } if
-
- % Read the digits from isbntxt and calculate checksums
- /isbn 13 string def
- /checksum10 0 def
- /checksum13 0 def
- /i 0 def /n 0 def
- { % loop
- /isbnchar isbntxt i get 48 sub def
- isbnchar -3 ne { % Ignore dashes
- isbn n isbnchar 48 add put
- n 9 lt {
- /checksum10 checksum10 10 n sub isbnchar mul add def
+ % Validate the input
+ barcode length 15 ne barcode length 17 ne and
+ barcode length 11 ne barcode length 13 ne and and {
+ /bwipp.isbnBadLength (ISBN-13 must be 15 or 17 characters including dashes. ISBN-10 must be 11 or 13 characters including dashes) //raiseerror exec
+ } if
+ addon length 0 ne addon length 2 ne and addon length 5 ne and {
+ /bwipp.isbnBadAddOnLength (Add-on for ISBN must be 2 or 5 digits) //raiseerror exec
+ } if
+ barcode length 15 ge { % ISBN-13
+ barcode 0 4 getinterval dup (978-) ne exch (979-) ne and {
+ /bwipp.isbn13badPrefix (ISBN-13 prefix must be 978- or 979-) //raiseerror exec
+ } if
+ /wasdash false def /numdash 0 def /numdigit 0 def
+ barcode 5 9 getinterval {
+ dup
+ 45 eq {
+ wasdash {
+ /bwipp.isbn13adjacentDashes (ISBN-13 does not permit adjacent dashes) //raiseerror exec
+ } if
+ /wasdash true def
+ /numdash numdash 1 add def
} if
- n 12 lt {
- n 2 mod 0 eq {
- /checksum13 isbnchar checksum13 add def
- } {
- /checksum13 isbnchar 3 mul checksum13 add def
- } ifelse
+ dup 48 ge exch 57 le and {
+ /wasdash false def
+ /numdigit numdigit 1 add def
} if
- /n n 1 add def
- } if
- /i i 1 add def
- i isbntxt length eq {exit} if
- } loop
+ } forall
+ numdash 2 ne numdigit 7 ne or {
+ /bwipp.isbn13numDashesDigits (Incorrect number of dashes and digits for ISBN-13) //raiseerror exec
+ } if
+ barcode 14 get dup 48 lt exch 57 gt or {
+ /bwipp.isbn13character15 (ISBN-13 character 15 must be a digit) //raiseerror exec
+ } if
+ barcode length 17 eq {
+ barcode 15 1 getinterval (-) ne {
+ /bwipp.isbn13character16 (ISBN-13 penultimate character must be a dash) //raiseerror exec
+ } if
+ barcode 16 get dup 48 lt exch 57 gt or {
+ /bwipp.isbn13character17 (ISBN-13 final character must be a digit) //raiseerror exec
+ } if
+ } if
+ } { % ISBN-10
+ barcode 0 get dup 48 lt exch 57 gt or {
+ /bwipp.isbn10FirstDigit (ISBN-10 first character must be a digit) //raiseerror exec
+ } if
+ /wasdash false def /numdash 0 def /numdigit 0 def
+ barcode 1 9 getinterval {
+ dup
+ 45 eq {
+ wasdash {
+ /bwipp.isbn10adjacentDashes (ISBN-10 does not permit adjacent dashes) //raiseerror exec
+ } if
+ /wasdash true def
+ /numdash numdash 1 add def
+ } if
+ dup 48 ge exch 57 le and {
+ /wasdash false def
+ /numdigit numdigit 1 add def
+ } if
+ } forall
+ numdash 2 ne numdigit 7 ne or {
+ /bwipp.isbn10numDashesDigits (Incorrect number of dashes and digits for ISBN-10) //raiseerror exec
+ } if
+ barcode 10 get dup 48 lt exch 57 gt or {
+ /bwipp.isbn10character11 (ISBN-10 character 11 must be a digit) //raiseerror exec
+ } if
+ barcode length 13 eq {
+ barcode 11 1 getinterval (-) ne {
+ /bwipp.isbn10character12 (ISBN-10 penultimate character must be a dash) //raiseerror exec
+ } if
+ barcode 12 get dup dup 48 lt exch 57 gt or exch 88 ne and {
+ /bwipp.isbn10character13 (ISBN-10 final character must be a digit or X) //raiseerror exec
+ } if
+ } if
+ } ifelse
+
+ /isbntxt barcode def
+
+ % Read the digits from isbntxt and validate checksum for ISBN-10
+ isbntxt length 13 le {
+ /isbn 10 string def
+ /checksum 0 def
+ /i 0 def /n 0 def
+ { % loop
+ /isbnchar isbntxt i get 48 sub def
+ isbnchar -3 ne { % Ignore dashes
+ isbn n isbnchar 48 add put
+ n 9 lt {
+ /checksum checksum 10 n sub isbnchar mul add def
+ } if
+ /n n 1 add def
+ } if
+ /i i 1 add def
+ i isbntxt length eq {exit} if
+ } loop
+ /checksum 11 checksum 11 mod sub 11 mod dup 10 eq {pop 40} if 48 add def
+ /isbn isbn 0 9 getinterval def
+ isbntxt length 13 eq {
+ isbntxt 12 get checksum ne {
+ /bwipp.isbn10badCheckDigit (Incorrect ISBN-10 check digit provided) //raiseerror exec
+ } if
+ } if
+ } if
+
+ legacy not isbntxt length 15 ge or {
+
+ % Convert ISBN-10 to ISBN-13
+ isbntxt length 13 le {
+ /pad 15 string def
+ pad 0 (978-) putinterval
+ pad 4 isbntxt 0 11 getinterval putinterval
+ /isbntxt pad def
+ } if
+
+ % Read the digits from isbntxt and validate checksum for ISBN-13
+ /isbn 13 string def
+ /checksum 0 def
+ /i 0 def /n 0 def
+ { % loop
+ /isbnchar isbntxt i get 48 sub def
+ isbnchar -3 ne { % Ignore dashes
+ isbn n isbnchar 48 add put
+ n 12 lt {
+ /checksum isbnchar n 2 mod 0 ne {3 mul} if checksum add def
+ } if
+ /n n 1 add def
+ } if
+ /i i 1 add def
+ i isbntxt length eq {exit} if
+ } loop
+ /checksum 10 checksum 10 mod sub 10 mod 48 add def
+ /isbn isbn 0 12 getinterval def
+ isbntxt length 17 eq {
+ isbntxt 16 get checksum ne {
+ /bwipp.isbn13badCheckDigit (Incorrect ISBN-13 check digit provided) //raiseerror exec
+ } if
+ } if
+
+ } if
% Add the ISBN header to the isbntxt
- n 9 eq n 10 eq or {
- /checksum 11 checksum10 11 mod sub 11 mod def
- /isbn isbn 0 9 getinterval def
- /pad 18 string def
- } {
- /checksum 10 checksum13 10 mod sub 10 mod def
- /isbn isbn 0 12 getinterval def
- /pad 22 string def
- } ifelse
+ /pad isbn length 12 eq {22} {18} ifelse string def
pad 0 (ISBN ) putinterval
- pad 5 isbntxt putinterval % Add isbntxt to the pad
-
- % Add checksum digit
- pad pad length 2 sub 45 put % Put a dash
- checksum 10 eq {
- pad pad length 1 sub checksum 78 add put % Check digit for 10 is X
- } {
- pad pad length 1 sub checksum 48 add put % Put check digit
- } ifelse
+ pad 5 isbntxt putinterval
+ pad pad length 2 sub 45 put
+ pad pad length 1 sub checksum put
/isbntxt pad def
% Convert ISBN digits to EAN-13
/barcode 12 string def
- isbn length 9 eq {
+ isbn length 9 eq {
barcode 0 (978) putinterval
barcode 3 isbn putinterval
} {
@@ -1775,7 +1962,7 @@
% Append the addon
addon () ne {
- 12 addon length add 1 add string
+ 12 addon length add 1 add string
dup 0 barcode putinterval
dup 12 ( ) putinterval
dup 13 addon putinterval
@@ -1784,7 +1971,7 @@
% Get the result of encoding with ean13
options (dontdraw) true put
- options (addongap) addongap put
+ options (addongap) addongap put
/args barcode options //ean13 exec def
% Add the ISBN text
@@ -1812,7 +1999,7 @@
dontdraw not //renlinear if
end
-
+
} bind def
/isbn dup load /uk.co.terryburton.bwipp defineresource pop
end
@@ -1827,8 +2014,8 @@
% --EXAM: 979-0-2605-3211-3
% --EXOP: includetext guardwhitespace
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp ismn 0.0 2014013000 85722 85534
-%%BeginData: 145 ASCII Lines
+%%BeginResource: uk.co.terryburton.bwipp ismn 0.0 2014121100 89401 95601
+%%BeginData: 231 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
@@ -1840,7 +2027,7 @@
20 dict begin
/options exch def % We are given an options string
- /ismntxt exch def % We are given the ismn text with dashes
+ /barcode exch def % We are given the ismn text with dashes
/dontdraw false def
/includetext false def % Enable/disable ISMN text
@@ -1849,7 +2036,7 @@
/ismntextxoffset (unset) def
/ismntextyoffset (unset) def
/height 1 def
- /addongap 12 def
+ /addongap 12 def
/legacy false def
% Parse the input options
@@ -1862,17 +2049,17 @@
currentdict end /options exch def
} if
options {def} forall
-
+
/ismntextfont ismntextfont cvlit def
/ismntextsize ismntextsize cvr def
ismntextxoffset (unset) ne {/ismntextxoffset ismntextxoffset cvr def} if
ismntextyoffset (unset) ne {/ismntextyoffset ismntextyoffset cvr def} if
/height height cvr def
/addongap addongap cvr def
-
+
% Split off the addon
- ismntxt ( ) search {
- /ismntxt exch def
+ barcode ( ) search {
+ /barcode exch def
pop
/addon exch def
} {
@@ -1880,9 +2067,90 @@
/addon () def
} ifelse
+ % Validate the input
+ barcode length 15 ne barcode length 17 ne and
+ barcode length 11 ne barcode length 13 ne and and {
+ /bwipp.ismnBadLength (ISMN-13 must be 15 or 17 characters including dashes. ISMN-10 must be 11 or 13 characters including dashes) //raiseerror exec
+ } if
+ addon length 0 ne addon length 2 ne and addon length 5 ne and {
+ /bwipp.ismnBadAddOnLength (Add-on for ISMN must be 2 or 5 digits) //raiseerror exec
+ } if
+ barcode length 15 ge { % ISMN-13
+ barcode 0 4 getinterval (979-) ne {
+ /bwipp.ismn13badPrefix (ISMN-13 prefix must be 979-) //raiseerror exec
+ } if
+ /wasdash false def /numdash 0 def /numdigit 0 def
+ barcode 5 9 getinterval {
+ dup
+ 45 eq {
+ wasdash {
+ /bwipp.ismn13adjacentDashes (ISMN-13 does not permit adjacent dashes) //raiseerror exec
+ } if
+ /wasdash true def
+ /numdash numdash 1 add def
+ } if
+ dup 48 ge exch 57 le and {
+ /wasdash false def
+ /numdigit numdigit 1 add def
+ } if
+ } forall
+ numdash 2 ne numdigit 7 ne or {
+ /bwipp.ismn13numDashesDigits (Incorrect number of dashes and digits for ISMN-13) //raiseerror exec
+ } if
+ barcode 14 get dup 48 lt exch 57 gt or {
+ /bwipp.ismn13character15 (ISMN-13 character 15 must be a digit) //raiseerror exec
+ } if
+ barcode length 17 eq {
+ barcode 15 1 getinterval (-) ne {
+ /bwipp.ismn13character16 (ISMN-13 penultimate character must be a dash) //raiseerror exec
+ } if
+ barcode 16 get dup 48 lt exch 57 gt or {
+ /bwipp.ismn13character17 (ISMN-13 final character must be a digit) //raiseerror exec
+ } if
+ } if
+ } { % ISMN-10
+ barcode 0 2 getinterval (M-) ne {
+ /bwipp.ismn10badPrefix (ISMN-10 prefix must be M-) //raiseerror exec
+ } if
+ barcode 2 get dup 48 lt exch 57 gt or {
+ /bwipp.ismn10character3 (ISMN-10 character 3 must be a digit) //raiseerror exec
+ } if
+ /wasdash false def /numdash 0 def /numdigit 0 def
+ barcode 3 7 getinterval {
+ dup
+ 45 eq {
+ wasdash {
+ /bwipp.ismn10adjacentDashes (ISMN-10 does not permit adjacent dashes) //raiseerror exec
+ } if
+ /wasdash true def
+ /numdash numdash 1 add def
+ } if
+ dup 48 ge exch 57 le and {
+ /wasdash false def
+ /numdigit numdigit 1 add def
+ } if
+ } forall
+ numdash 1 ne numdigit 6 ne or {
+ /bwipp.ismn10numDashesDigits (Incorrect number of dashes and digits for ISMN-10) //raiseerror exec
+ } if
+ barcode 10 get dup 48 lt exch 57 gt or {
+ /bwipp.ismn10character11 (ISMN-10 character 11 must be a digit) //raiseerror exec
+ } if
+ barcode length 13 eq {
+ barcode 11 1 getinterval (-) ne {
+ /bwipp.ismn10character12 (ISMN-10 penultimate character must be a dash) //raiseerror exec
+ } if
+ barcode 12 get dup dup 48 lt exch 57 gt or exch 88 ne and {
+ /bwipp.ismn10character13 (ISMN-10 final character must be a digit or X) //raiseerror exec
+ } if
+ } if
+ } ifelse
+
+ /ismntxt barcode def
+
% Convert old ISMN to ISMN-13
/legacytxt () def
- ismntxt 0 1 getinterval (M) eq ismntxt length 13 le and {
+ ismntxt length 13 le {
/legacytxt ismntxt def
/pad ismntxt length 4 add string def
pad 0 (979-0-) putinterval
@@ -1910,9 +2178,16 @@
/i i 1 add def
i ismntxt length eq {exit} if
} loop
- /checksum 10 checksum 10 mod sub 10 mod def
-
- % Add the ISMN header to the ismntxt
+ /checksum 10 checksum 10 mod sub 10 mod 48 add def
+
+ % Validate the checksum
+ barcode length 13 eq barcode length 17 eq or {
+ barcode dup length 1 sub get checksum ne {
+ /bwipp.ismnBadCheckDigit (Incorrect ISMN check digit provided) //raiseerror exec
+ } if
+ } if
+
+ % Add the ISMN header and checksum to the ismntxt
legacy legacytxt () ne and {
/ismntxt legacytxt def
/pad 18 string def
@@ -1920,19 +2195,17 @@
/pad 22 string def
} ifelse
pad 0 (ISMN ) putinterval
- pad 5 ismntxt putinterval % Add ismntxt to the pad
-
- % Add checksum digit
- pad pad length 2 sub 45 put % Put a dash
- pad pad length 1 sub checksum 48 add put % Put check digit
+ pad 5 ismntxt putinterval
+ pad pad length 2 sub 45 put
+ pad pad length 1 sub checksum put
/ismntxt pad def
% Convert ISMN digits to EAN-13
- /barcode ismn 0 12 getinterval def
+ /barcode ismn 0 12 getinterval def
% Append the addon
addon () ne {
- 12 addon length add 1 add string
+ 12 addon length add 1 add string
dup 0 barcode putinterval
dup 12 ( ) putinterval
dup 13 addon putinterval
@@ -1941,7 +2214,7 @@
% Get the result of encoding with ean13
options (dontdraw) true put
- options (addongap) addongap put
+ options (addongap) addongap put
/args barcode options //ean13 exec def
% Add the ISMN text
@@ -1969,7 +2242,7 @@
dontdraw not //renlinear if
end
-
+
} bind def
/ismn dup load /uk.co.terryburton.bwipp defineresource pop
end
@@ -1981,11 +2254,11 @@
% --BEGIN ENCODER issn--
% --REQUIRES preamble raiseerror renlinear ean2 ean5 ean13--
% --DESC: ISSN
-% --EXAM: 0317-8129 00 17
+% --EXAM: 0311-175X 00 17
% --EXOP: includetext guardwhitespace
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp issn 0.0 2014013000 84110 83835
-%%BeginData: 135 ASCII Lines
+%%BeginResource: uk.co.terryburton.bwipp issn 0.0 2014121100 80698 83843
+%%BeginData: 177 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
@@ -2006,7 +2279,7 @@
/issntextxoffset (unset) def
/issntextyoffset (unset) def
/height 1 def
- /addongap 12 def
+ /addongap 12 def
% Parse the input options
options type /stringtype eq {
@@ -2018,20 +2291,23 @@
currentdict end /options exch def
} if
options {def} forall
-
+
/issntextfont issntextfont cvlit def
/issntextsize issntextsize cvr def
issntextxoffset (unset) ne {/issntextxoffset issntextxoffset cvr def} if
issntextyoffset (unset) ne {/issntextyoffset issntextyoffset cvr def} if
/height height cvr def
/addongap addongap cvr def
-
+
% Split off the ISSN
issntxt ( ) search {
/issntxt exch def
pop
/seqvar exch def
- } if
+ } {
+ pop
+ /seqvar () def
+ } ifelse
% Split off the sequence variant and addon
seqvar ( ) search {
@@ -2040,8 +2316,43 @@
/addon exch def
} {
pop
- /addon () def
+ /addon seqvar def
+ /seqvar (00) def
} ifelse
+
+ % Validate the input
+ issntxt length 8 ne issntxt length 9 ne and {
+ /bwipp.issnBadLength (ISSN must be 8 or 9 characters including dash) //raiseerror exec
+ } if
+ issntxt 0 4 getinterval {
+ dup 48 lt exch 57 gt or {
+ /bwipp.issnBadFormat (ISSN must have the format XXXX-XXXX) //raiseerror exec
+ } if
+ } forall
+ issntxt 4 1 getinterval (-) ne {
+ /bwipp.issnBadFormat (ISSN must have the format XXXX-XXXX) //raiseerror exec
+ } if
+ issntxt 5 3 getinterval {
+ dup 48 lt exch 57 gt or {
+ /bwipp.issnBadFormat (ISSN must have the format XXXX-XXXX) //raiseerror exec
+ } if
+ } forall
+ issntxt length 9 eq {
+ issntxt 8 get dup dup 48 lt exch 57 gt or exch 88 ne and { % Digits or X
+ /bwipp.issnBadFormat (ISSN must have the format XXXX-XXXX) //raiseerror exec
+ } if
+ } if
+ seqvar length 2 ne {
+ /bwipp.issnBadSequenceVariantLength (Sequence variant for ISSN must be 2 digits) //raiseerror exec
+ } if
+ seqvar {
+ dup 48 lt exch 57 gt or {
+ /bwipp.issnSequenceVariantBadCharacter (Sequence variant for ISSN must contain only digits) //raiseerror exec
+ } if
+ } forall
+ addon length 0 ne addon length 2 ne and addon length 5 ne and {
+ /bwipp.issnBadAddOnLength (Add-on for ISSN must be 2 or 5 digits) //raiseerror exec
+ } if
% Read the digits from issntxt and calculate checksums
/issn 8 string def
@@ -2060,18 +2371,22 @@
i issntxt length eq {exit} if
} loop
/checksum 11 checksum 11 mod sub 11 mod def
-
- % Add the ISSN header to the issntxt
+ /checksum checksum 48 add dup 58 eq {pop 88} if def
+ issntxt length 9 eq {
+ issntxt 8 get checksum ne {
+ /bwipp.issnBadCheckDigit (Incorrect ISSN check digit provided) //raiseerror exec
+ } if
+ } if
+
+ % Add the ISSN header and checksum to the issntxt
/pad 14 string def
pad 0 (ISSN ) putinterval
pad 5 issntxt putinterval % Add issntxt to the pad
-
- % Add checksum digit
- pad 13 checksum 48 add dup 58 eq {pop 88} if put % Put check digit
+ pad 13 checksum put
/issntxt pad def
% Convert ISSN digits to EAN-13
- /barcode issn 0 7 getinterval def
+ /barcode issn 0 7 getinterval def
% Append the sequence variant
/barcode 12 string def
@@ -2081,7 +2396,7 @@
% Append the addon
addon () ne {
- 12 addon length add 1 add string
+ 12 addon length add 1 add string
dup 0 barcode putinterval
dup 12 ( ) putinterval
dup 13 addon putinterval
@@ -2090,7 +2405,7 @@
% Get the result of encoding with ean13
options (dontdraw) true put
- options (addongap) addongap put
+ options (addongap) addongap put
/args barcode options //ean13 exec def
% Add the ISSN text
@@ -2116,7 +2431,7 @@
dontdraw not //renlinear if
end
-
+
} bind def
/issn dup load /uk.co.terryburton.bwipp defineresource pop
end
@@ -2131,7 +2446,7 @@
% --EXAM: Count01234567^FNC2!
% --EXOP: includetext parsefnc
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp code128 0.0 2014013000 125419 134999
+%%BeginResource: uk.co.terryburton.bwipp code128 0.0 2014121100 122003 121439
%%BeginData: 421 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -2191,23 +2506,23 @@
length j add /j exch def
/barcode msg 0 j getinterval def
exit
- } ifelse
+ } ifelse
} loop
} if
/barlen barcode length def
% Special function characters
- /sta -1 def /stb -2 def /stc -3 def
- /swa -4 def /swb -5 def /swc -6 def
- /fn1 -7 def /fn2 -8 def /fn3 -9 def
+ /sta -1 def /stb -2 def /stc -3 def
+ /swa -4 def /swb -5 def /swc -6 def
+ /fn1 -7 def /fn2 -8 def /fn3 -9 def
/fn4 -10 def /sft -11 def /stp -12 def
/lka -13 def /lkc -14 def % CC-A/B and CC-C linkage
% Character maps for each state
/charmaps [
% A B C A B C A B C
- [ 32 32 (00) ] [ (!) (!) (01) ] [ (") (") (02) ] % 0-2
+ [ 32 32 (00) ] [ (!) (!) (01) ] [ (") (") (02) ] % 0-2
[ (#) (#) (03) ] [ ($) ($) (04) ] [ (%) (%) (05) ] % 3-5
[ (&) (&) (06) ] [ (') (') (07) ] [ 40 40 (08) ] % 6-8
[ 41 41 (09) ] [ (*) (*) (10) ] [ (+) (+) (11) ] % 9-11
@@ -2243,8 +2558,8 @@
[ swc swc (99) ] [ swb fn4 swb ] [ fn4 swa swa ] % 99-101
[ fn1 fn1 fn1 ] [ sta sta sta ] [ stb stb stb ] % 102-104
[ stc stc stc ] [ stp stp stp ] % 105-106
- ] def
-
+ ] def
+
% Invert charmaps to give character to value maps for each state
/charvals [ 109 dict 109 dict 109 dict ] def
0 1 charmaps length 1 sub {
@@ -2253,7 +2568,7 @@
0 1 2 {
/j exch def
encs j get dup type /stringtype eq {0 get} if % convert string to ASCII if required
- charvals j get exch i put
+ charvals j get exch i put
} for
} for
/seta charvals 0 get def
@@ -2281,7 +2596,7 @@
/text () def
} if
- encoding (auto) eq {
+ encoding (auto) eq {
/fncvals <<
(FNC1) fn1
@@ -2292,7 +2607,7 @@
(LNKC) lkc
>> def
- % Convert input into bytes accounting for FNC and LNK characters
+ % Convert input into bytes accounting for FNC and LNK characters
/msg barlen array def
/text barlen string def
/i 0 def /j 0 def {
@@ -2377,7 +2692,7 @@
% Does a-only come before b-only after given position and vice versa
/abeforeb {dup nextanotb exch get exch nextbnota exch get lt} bind def
/bbeforea {dup nextbnota exch get exch nextanotb exch get lt} bind def
-
+
/cws barcode length 2 mul 3 add array def
% Select start character
@@ -2399,25 +2714,25 @@
/cset (setc) def
exit
} if
- 0 abeforeb {
+ 0 abeforeb {
sta enca
/cset (seta) def
- exit
- } if
+ exit
+ } if
stb enca
/cset (setb) def
exit
} loop
% Main encoding loop
- /i 0 def {
+ /i 0 def {
i msglen eq {exit} if
-
+
i numsscr /nums exch def /nchars exch def
-
+
% Determine switches and shifts
{ % common exit
- cset (seta) eq cset (setb) eq or nums 4 ge and
+ cset (seta) eq cset (setb) eq or nums 4 ge and
msg i get fn1 ne and {
nums 2 mod 0 eq {
swc cset (seta) eq {enca} {encb} ifelse
@@ -2431,9 +2746,9 @@
exit
} ifelse
} if
- cset (setb) eq msg i get anotb and {
+ cset (setb) eq msg i get anotb and {
i msglen 1 sub lt {
- i 1 add bbeforea {
+ i 1 add bbeforea {
sft encb
msg i get enca
/i i 1 add def
@@ -2467,7 +2782,7 @@
/cset (setb) def
exit
} if
-
+
% No switches or latches so encode
cset (seta) eq {
msg i get enca
@@ -2485,14 +2800,14 @@
/i i 1 add def
} {
msg i 2 getinterval encc
- /i i 2 add def
+ /i i 2 add def
} ifelse
exit
} if
-
+
exit
} loop
-
+
} loop
/cws cws 0 j getinterval def
} if % auto encoding
@@ -2564,7 +2879,7 @@
% --EXAM: (01)95012345678903(3103)000123
% --EXOP: includetext
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp gs1-128 0.0 2014013000 77354 80518
+%%BeginResource: uk.co.terryburton.bwipp gs1-128 0.0 2014121100 73938 76998
%%BeginData: 157 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -2588,7 +2903,7 @@
/height 0.5 def
/linkagea false def
/linkagec false def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -2604,10 +2919,10 @@
/textsize textsize cvr def
/textxoffset textxoffset cvr def
/textyoffset textyoffset cvr def
- /height height cvr def
-
+ /height height cvr def
+
/text barcode def
-
+
% Expand ordinals of the form ^NNN to ASCII
/expand {
/in exch def
@@ -2625,10 +2940,10 @@
dup out exch j exch putinterval
length j add /j exch def
out 0 j getinterval exit
- } ifelse
+ } ifelse
} loop
} bind def
-
+
% Parse out AIs
/ais [] def
/aival 2 dict def
@@ -2638,8 +2953,8 @@
(\)) search pop
exch pop
exch (\() search {
- exch pop exch 3 1 roll
- } {
+ exch pop exch 3 1 roll
+ } {
() 3 1 roll
} ifelse
[ ais aload pop counttomark 2 add index ] /ais exch def
@@ -2665,7 +2980,7 @@
10 2 string cvrs dup aifixed 3 1 roll put
} forall
- % Create the code128 data
+ % Create the code128 data
/fnc1 -1 def
/c128 [ fnc1 ] def
0 1 ais length 1 sub {
@@ -2714,9 +3029,9 @@
args (textxalign) (center) put
args (opt) options put
args
-
+
dontdraw not //renlinear if
-
+
end
} bind def
@@ -2733,7 +3048,7 @@
% --EXAM: (01)04601234567893
% --EXOP: includetext
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp ean14 0.0 2014013000 67271 66925
+%%BeginResource: uk.co.terryburton.bwipp ean14 0.0 2014121100 63855 67029
%%BeginData: 93 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -2755,7 +3070,7 @@
/textxoffset 0 def
/textyoffset -7 def
/height 1 def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -2771,7 +3086,7 @@
/textsize textsize cvr def
/textxoffset textxoffset cvr def
/textyoffset textyoffset cvr def
- /height height cvr def
+ /height height cvr def
% Validate the input
barcode 0 4 getinterval (\(01\)) ne {
@@ -2791,7 +3106,7 @@
0 1 12 {
/i exch def
/checksum checksum barcode i 4 add get 48 sub i 2 mod 0 eq {3 mul} if add def
- } for
+ } for
/checksum 10 checksum 10 mod sub 10 mod def
barcode length 18 eq {
barcode 17 get checksum 48 add ne {
@@ -2819,9 +3134,9 @@
args (textxalign) (center) put
args (opt) options put
args
-
+
dontdraw not //renlinear if
-
+
end
} bind def
@@ -2838,7 +3153,7 @@
% --EXAM: (00)006141411234567890
% --EXOP: includetext
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp sscc18 0.0 2014013000 67283 66932
+%%BeginResource: uk.co.terryburton.bwipp sscc18 0.0 2014121100 63867 67036
%%BeginData: 93 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -2860,7 +3175,7 @@
/textxoffset 0 def
/textyoffset -7 def
/height 1 def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -2876,7 +3191,7 @@
/textsize textsize cvr def
/textxoffset textxoffset cvr def
/textyoffset textyoffset cvr def
- /height height cvr def
+ /height height cvr def
% Validate the input
barcode 0 4 getinterval (\(00\)) ne {
@@ -2896,7 +3211,7 @@
0 1 16 {
/i exch def
/checksum checksum barcode i 4 add get 48 sub i 2 mod 0 eq {3 mul} if add def
- } for
+ } for
/checksum 10 checksum 10 mod sub 10 mod def
barcode length 22 eq {
barcode 21 get checksum 48 add ne {
@@ -2924,9 +3239,9 @@
args (textxalign) (center) put
args (opt) options put
args
-
+
dontdraw not //renlinear if
-
+
end
} bind def
@@ -2943,7 +3258,7 @@
% --EXAM: THIS IS CODE 39
% --EXOP: includetext includecheck includecheckintext
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp code39 0.0 2014013000 68872 72176
+%%BeginResource: uk.co.terryburton.bwipp code39 0.0 2014121100 69000 68552
%%BeginData: 141 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -2967,7 +3282,7 @@
/textsize 10 def
/textyoffset -7 def
/height 1 def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -2978,7 +3293,7 @@
currentdict end /options exch def
} if
options {def} forall
-
+
/textfont textfont cvlit def
/textsize textsize cvr def
/textyoffset textyoffset cvr def
@@ -3065,7 +3380,7 @@
txt barlen 1 add [() barlen 1 add 16 mul textyoffset textfont textsize] put
} ifelse
} ifelse
-
+
% Return the arguments
<<
/ren //renlinear
@@ -3096,7 +3411,7 @@
% --EXAM: Code39 Ext!
% --EXOP: includetext includecheck includecheckintext
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp code39ext 0.0 2014013000 71391 71049
+%%BeginResource: uk.co.terryburton.bwipp code39ext 0.0 2014121100 67871 70945
%%BeginData: 110 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -3143,7 +3458,7 @@
length j add /j exch def
/barcode msg 0 j getinterval def
exit
- } ifelse
+ } ifelse
} loop
} if
@@ -3218,7 +3533,7 @@
% --EXAM: 01234567
% --EXOP: includetext
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp code32 0.0 2014013000 68024 67911
+%%BeginResource: uk.co.terryburton.bwipp code32 0.0 2014121100 64608 67911
%%BeginData: 99 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -3329,7 +3644,7 @@
% --EXAM: 123456
% --EXOP: includetext
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp pzn 0.0 2014013000 68199 67907
+%%BeginResource: uk.co.terryburton.bwipp pzn 0.0 2014121100 64783 67907
%%BeginData: 100 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -3340,10 +3655,10 @@
/pzn {
20 dict begin
-
+
/options exch def % We are given an options string
/barcode exch def % We are given a barcode string
-
+
/dontdraw false def
/includetext false def % Enable/disable code32 text
/textfont /Courier def
@@ -3352,7 +3667,7 @@
/textxoffset 0 def
/height 1 def
/pzn8 false def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -3363,7 +3678,7 @@
currentdict end /options exch def
} if
options {def} forall
-
+
/textfont textfont cvlit def
/textsize textsize cvr def
/textyoffset textyoffset cvr def
@@ -3392,8 +3707,8 @@
0 1 msglen 3 sub {
/i exch def
barcode i get 48 sub i pzn8 {1} {2} ifelse add mul
- checksum add /checksum exch def
- } for
+ checksum add /checksum exch def
+ } for
/checksum checksum 11 mod def
checksum 10 eq {
/bwipp.pznBadInputSequence (Incorrect PZN input sequence provided) //raiseerror exec
@@ -3404,29 +3719,29 @@
} if
} if
msglen string
- dup 0 45 put
+ dup 0 45 put
dup 1 barcode putinterval
dup msglen 1 sub checksum 48 add put
/msg exch def
-
+
% Get the result of encoding with code39
options (dontdraw) true put
/args msg options //code39 exec def
-
+
% format HRI
/text msglen 5 add string def
text 0 (PZN - ) putinterval
text 6 msg 1 msglen 1 sub getinterval putinterval
-
+
args (txt) [ [text textxoffset textyoffset textfont textsize] ] put
args (textxalign) (center) put
args (opt) options put
args
-
+
dontdraw not //renlinear if
-
+
end
-
+
} bind def
/pzn dup load /uk.co.terryburton.bwipp defineresource pop
end
@@ -3441,7 +3756,7 @@
% --EXAM: THIS IS CODE 93
% --EXOP: includetext includecheck
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp code93 0.0 2014013000 67695 70999
+%%BeginResource: uk.co.terryburton.bwipp code93 0.0 2014121100 67695 67503
%%BeginData: 148 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -3462,8 +3777,8 @@
/textsize 10 def
/textyoffset -7 def
/height 1 def
- /parsefnc false def
-
+ /parsefnc false def
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -3474,12 +3789,12 @@
currentdict end /options exch def
} if
options {def} forall
-
+
/textfont textfont cvlit def
/textsize textsize cvr def
/textyoffset textyoffset cvr def
/height height cvr def
-
+
/encs
[ (131112) (111213) (111312) (111411) (121113)
(121212) (121311) (111114) (131211) (141111)
@@ -3507,7 +3822,7 @@
(SFT+) sft4
>> def
- % Convert input into bytes accounting for shift characters
+ % Convert input into bytes accounting for shift characters
/msg barlen array def
/i 0 def /j 0 def {
i barlen eq {exit} if
@@ -3536,12 +3851,12 @@
% Put the start character
sbs 0 encs 47 get putinterval
-
+
/checksum1 0 def /checksum2 0 def
0 1 msglen 1 sub {
/i exch def
% Lookup the encoding for the each barcode character
- msg i get dup 0 lt {
+ msg i get dup 0 lt {
42 exch sub /indx exch def
/char ( ) def
} {
@@ -3568,7 +3883,7 @@
sbs msglen 6 mul 18 add encs 48 get putinterval
} {
% Put the end character
- sbs msglen 6 mul 6 add encs 48 get putinterval
+ sbs msglen 6 mul 6 add encs 48 get putinterval
} ifelse
% Return the arguments
@@ -3601,7 +3916,7 @@
% --EXAM: Code93 Ext!
% --EXOP: includetext includecheck
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp code93ext 0.0 2014013000 71456 71250
+%%BeginResource: uk.co.terryburton.bwipp code93ext 0.0 2014121100 68040 71146
%%BeginData: 114 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -3648,7 +3963,7 @@
length j add /j exch def
/barcode msg 0 j getinterval def
exit
- } ifelse
+ } ifelse
} loop
} if
@@ -3656,7 +3971,7 @@
% Extended alphabet to non-extended alphabet
/extencs
- [ (^SFT%U) (^SFT$A) (^SFT$B) (^SFT$C) (^SFT$D) (^SFT$E) (^SFT$F) (^SFT$G)
+ [ (^SFT%U) (^SFT$A) (^SFT$B) (^SFT$C) (^SFT$D) (^SFT$E) (^SFT$F) (^SFT$G)
(^SFT$H) (^SFT$I) (^SFT$J) (^SFT$K) (^SFT$L) (^SFT$M) (^SFT$N) (^SFT$O)
(^SFT$P) (^SFT$Q) (^SFT$R) (^SFT$S) (^SFT$T) (^SFT$U) (^SFT$V) (^SFT$W)
(^SFT$X) (^SFT$Y) (^SFT$Z) (^SFT%A) (^SFT%B) (^SFT%C) (^SFT%D) (^SFT%E)
@@ -3727,7 +4042,7 @@
% --EXAM: 2401234567
% --EXOP: height=0.5 includecheck includetext includecheckintext
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp interleaved2of5 0.0 2014013000 67355 70551
+%%BeginResource: uk.co.terryburton.bwipp interleaved2of5 0.0 2014121100 67459 67031
%%BeginData: 150 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -3749,7 +4064,7 @@
/textsize 10 def
/textyoffset -7 def
/height 1 def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -3760,7 +4075,7 @@
currentdict end /options exch def
} if
options {def} forall
-
+
/textfont textfont cvlit def
/textsize textsize cvr def
/textyoffset textyoffset cvr def
@@ -3772,7 +4087,7 @@
/bwipp.interleaved2of5badCharacter (Interleaved 2 of 5 must contain only digits) //raiseerror exec
} if
} forall
-
+
/barlen barcode length def % Length of the code
% Prefix 0 to barcode if length is even and including checkdigit
@@ -3889,7 +4204,7 @@
% --EXAM: 04601234567893
% --EXOP: includetext
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp itf14 0.0 2014013000 63664 66994
+%%BeginResource: uk.co.terryburton.bwipp itf14 0.0 2014121100 63768 66890
%%BeginData: 95 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -3916,7 +4231,7 @@
/borderwidth 4 def
/borderleft 15 def
/borderright 15 def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -3932,7 +4247,7 @@
/textsize textsize cvr def
/textxoffset textxoffset cvr def
/textyoffset textyoffset cvr def
- /height height cvr def
+ /height height cvr def
/borderwidth borderwidth cvr def
/borderleft borderleft cvr def
/borderright borderright cvr def
@@ -3977,9 +4292,9 @@
args (opt) options put
args
-
+
dontdraw not //renlinear if
-
+
end
} bind def
@@ -3996,7 +4311,7 @@
% --EXAM: 563102430313
% --EXOP: includetext
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp identcode 0.0 2014013000 63813 67011
+%%BeginResource: uk.co.terryburton.bwipp identcode 0.0 2014121100 63813 66907
%%BeginData: 91 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -4018,7 +4333,7 @@
/textxoffset 0 def
/textyoffset -7 def
/height 1 def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -4034,7 +4349,7 @@
/textsize textsize cvr def
/textxoffset textxoffset cvr def
/textyoffset textyoffset cvr def
- /height height cvr def
+ /height height cvr def
% Validate the input
barcode length 11 ne barcode length 12 ne and {
@@ -4051,7 +4366,7 @@
0 1 10 {
/i exch def
/checksum checksum barcode i get 48 sub i 2 mod 0 eq {4 mul} {9 mul} ifelse add def
- } for
+ } for
/checksum 10 checksum 10 mod sub 10 mod def
barcode length 12 eq {
barcode 11 get checksum 48 add ne {
@@ -4080,9 +4395,9 @@
args (textxalign) (center) put
args (opt) options put
args
-
+
dontdraw not //renlinear if
-
+
end
} bind def
@@ -4099,7 +4414,7 @@
% --EXAM: 21348075016401
% --EXOP: includetext
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp leitcode 0.0 2014013000 63805 67007
+%%BeginResource: uk.co.terryburton.bwipp leitcode 0.0 2014121100 63805 66903
%%BeginData: 91 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -4121,7 +4436,7 @@
/textxoffset 0 def
/textyoffset -7 def
/height 1 def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -4137,7 +4452,7 @@
/textsize textsize cvr def
/textxoffset textxoffset cvr def
/textyoffset textyoffset cvr def
- /height height cvr def
+ /height height cvr def
% Validate the input
barcode length 13 ne barcode length 14 ne and {
@@ -4154,7 +4469,7 @@
0 1 12 {
/i exch def
/checksum checksum barcode i get 48 sub i 2 mod 0 eq {4 mul} {9 mul} ifelse add def
- } for
+ } for
/checksum 10 checksum 10 mod sub 10 mod def
barcode length 14 eq {
barcode 13 get checksum 48 add ne {
@@ -4183,9 +4498,9 @@
args (textxalign) (center) put
args (opt) options put
args
-
+
dontdraw not //renlinear if
-
+
end
} bind def
@@ -4202,7 +4517,7 @@
% --EXAM: (01)24012345678905
% --EXOP:
% --RNDR: renlinear renmatrix
-%%BeginResource: uk.co.terryburton.bwipp databaromni 0.0 2014013000 116812 129140
+%%BeginResource: uk.co.terryburton.bwipp databaromni 0.0 2014121100 113396 115580
%%BeginData: 418 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -4221,7 +4536,7 @@
/height 33 72 div def
/linkage false def
/format (omni) def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -4232,7 +4547,7 @@
currentdict end /options exch def
} if
options {def} forall
-
+
format (truncated) eq {/height 13 72 div def} if
/height height cvr def
@@ -4288,7 +4603,7 @@
} loop
exch pop exch pop
} bind def
-
+
/getRSSwidths {
/oe exch def
/el exch def
@@ -4299,7 +4614,7 @@
/mask 0 def
0 1 el 2 sub {
/bar exch def
- /ew 1 def
+ /ew 1 def
/mask mask 1 bar bitshift or def {
/sval nm ew sub 1 sub el bar sub 2 sub ncr def
oe mask 0 eq and nm ew sub el 2 mul sub bar 2 mul add -2 ge and {
@@ -4319,20 +4634,20 @@
val 0 lt {exit} if
/ew ew 1 add def
/mask mask 1 bar bitshift not and def
- } loop
+ } loop
/val val sval add def
/nm nm ew sub def
- out bar ew put
+ out bar ew put
} for
out el 1 sub nm put
out
} bind def
-
- /binval [
+
+ /binval [
linkage {1} {0} ifelse
barcode 4 13 getinterval {48 sub} forall
] def
-
+
0 1 12 {
/i exch def
binval i 1 add 2 copy get binval i get 4537077 mod 10 mul add put
@@ -4353,7 +4668,7 @@
/left left 3 -1 roll 10 13 j sub exp cvi mul add def
} ifelse
} for
-
+
/d1 left 1597 idiv def
/d2 left 1597 mod def
/d3 right 1597 idiv def
@@ -4421,7 +4736,7 @@
} if
/i i 8 add def
} loop
-
+
/d1wo d1 d1gs sub d1te idiv d1elo d1mwo 4 false getRSSwidths def
/d1we d1 d1gs sub d1te mod d1ele d1mwe 4 true getRSSwidths def
/d2wo d2 d2gs sub d2to mod d2elo d2mwo 4 true getRSSwidths def
@@ -4444,14 +4759,14 @@
d2w 7 i 2 mul sub d2wo i get put
d2w 6 i 2 mul sub d2we i get put
} for
-
+
/d3w 8 array def
0 1 3 {
/i exch def
d3w 7 i 2 mul sub d3wo i get put
d3w 6 i 2 mul sub d3we i get put
} for
-
+
/d4w 8 array def
0 1 3 {
/i exch def
@@ -4465,7 +4780,7 @@
d3w {} forall
d4w {} forall
] def
-
+
/checkweights [
1 3 9 27 2 6 18 54
58 72 24 8 29 36 12 4
@@ -4478,13 +4793,13 @@
3 1 9 1 1 2 7 4 1 1 2 5 6 1 1
2 3 8 1 1 1 5 7 1 1 1 3 9 1 1
] def
-
+
/checksum 0 def
0 1 31 {
/i exch def
- /checksum checksum widths i get checkweights i get mul add def
+ /checksum checksum widths i get checkweights i get mul add def
} for
- /checksum checksum 79 mod def
+ /checksum checksum 79 mod def
checksum 8 ge {/checksum checksum 1 add def} if
checksum 72 ge {/checksum checksum 1 add def} if
/checklt checkwidths checksum 9 idiv 5 mul 5 getinterval def
@@ -4499,10 +4814,10 @@
format (omni) eq format (truncated) eq or { % linear
/sbs [
- 1 d1w {} forall checklt {} forall d2w {} forall
+ 1 d1w {} forall checklt {} forall d2w {} forall
d4w {} forall checkrt {} forall d3w {} forall 1 1
] def
-
+
<<
/ren //renlinear
/sbs sbs
@@ -4512,19 +4827,19 @@
/textxalign (center)
/opt options
>>
-
+
dontdraw not //renlinear if
} { % 2D - stacked or stackedomni
/top [ 1 1 d1w {} forall checklt {} forall d2w {} forall 1 1 0 ] def
- /bot [ 1 1 d4w {} forall checkrt {} forall d3w {} forall 1 1 0 ] def
+ /bot [ 1 1 d4w {} forall checkrt {} forall d3w {} forall 1 1 0 ] def
0 2 24 {
/i exch def
top i get {0} repeat
top i 1 add get {1} repeat
} for
- 50 array astore /top exch def
+ 50 array astore /top exch def
0 2 24 {
/i exch def
bot i get {1} repeat
@@ -4550,7 +4865,7 @@
] def
/pixy pixs length 50 idiv def
} if
-
+
% Stacked omnidirectional
format (stackedomni) eq {
/sep1 [ top {1 exch sub} forall ] def
@@ -4600,7 +4915,7 @@
] def
/pixy pixs length 50 idiv def
} if
-
+
% Return the arguments
<<
/ren //renmatrix
@@ -4611,11 +4926,11 @@
/width 50 72 div
/opt options
>>
-
+
dontdraw not //renmatrix if
-
+
} ifelse
-
+
end
} bind def
@@ -4632,7 +4947,7 @@
% --EXAM: (01)24012345678905
% --EXOP:
% --RNDR: renmatrix
-%%BeginResource: uk.co.terryburton.bwipp databarstacked 0.0 2014013000 72003 71808
+%%BeginResource: uk.co.terryburton.bwipp databarstacked 0.0 2014121100 68587 65080
%%BeginData: 73 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -4698,7 +5013,7 @@
args (opt) options put
args
-
+
dontdraw not //renmatrix if
end
@@ -4717,7 +5032,7 @@
% --EXAM: (01)24012345678905
% --EXOP:
% --RNDR: renmatrix
-%%BeginResource: uk.co.terryburton.bwipp databarstackedomni 0.0 2014013000 72103 71888
+%%BeginResource: uk.co.terryburton.bwipp databarstackedomni 0.0 2014121100 68687 65056
%%BeginData: 73 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -4783,7 +5098,7 @@
args (opt) options put
args
-
+
dontdraw not //renmatrix if
end
@@ -4802,7 +5117,7 @@
% --EXAM: (01)24012345678905
% --EXOP:
% --RNDR: renlinear renmatrix
-%%BeginResource: uk.co.terryburton.bwipp databartruncated 0.0 2014013000 72029 71824
+%%BeginResource: uk.co.terryburton.bwipp databartruncated 0.0 2014121100 68613 65096
%%BeginData: 73 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -4868,7 +5183,7 @@
args (opt) options put
args
-
+
dontdraw not //renlinear if
end
@@ -4887,7 +5202,7 @@
% --EXAM: (01)15012345678907
% --EXOP:
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp databarlimited 0.0 2014013000 86855 92952
+%%BeginResource: uk.co.terryburton.bwipp databarlimited 0.0 2014121100 86959 85912
%%BeginData: 276 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -4915,7 +5230,7 @@
currentdict end /options exch def
} if
options {def} forall
-
+
/height height cvr def
% Validate the input
@@ -4952,7 +5267,7 @@
/barcode exch def
% Strip the AI and optional check digit
- /binval [
+ /binval [
barcode 4 13 getinterval {48 sub} forall
] def
linkage {
@@ -4961,7 +5276,7 @@
/i exch def
binval i binval i get linkval i get add put
} for
- } if
+ } if
% Create the human readable text
/txt barcode length array def
@@ -4985,7 +5300,7 @@
} loop
exch pop exch pop
} bind def
-
+
/getRSSwidths {
/oe exch def
/el exch def
@@ -4996,7 +5311,7 @@
/mask 0 def
0 1 el 2 sub {
/bar exch def
- /ew 1 def
+ /ew 1 def
/mask mask 1 bar bitshift or def {
/sval nm ew sub 1 sub el bar sub 2 sub ncr def
oe mask 0 eq and nm ew sub el 2 mul sub bar 2 mul add -2 ge and {
@@ -5016,15 +5331,15 @@
val 0 lt {exit} if
/ew ew 1 add def
/mask mask 1 bar bitshift not and def
- } loop
+ } loop
/val val sval add def
/nm nm ew sub def
- out bar ew put
+ out bar ew put
} for
out el 1 sub nm put
out
} bind def
-
+
0 1 11 {
/i exch def
binval i 1 add 2 copy get binval i get 2013571 mod 10 mul add put
@@ -5045,7 +5360,7 @@
/d1 d1 3 -1 roll 10 12 j sub exp cvi mul add def
} ifelse
} for
-
+
/tab267 [
183063 0 17 9 6 3 6538 28
820063 183064 13 13 5 4 875 728
@@ -5080,9 +5395,9 @@
/i i 8 add def
} loop
- /d1wo d1 d1gs sub d1te idiv d1elo d1mwo 7 false getRSSwidths def
+ /d1wo d1 d1gs sub d1te idiv d1elo d1mwo 7 false getRSSwidths def
/d1we d1 d1gs sub d1te mod d1ele d1mwe 7 true getRSSwidths def
- /d2wo d2 d2gs sub d2te idiv d2elo d2mwo 7 false getRSSwidths def
+ /d2wo d2 d2gs sub d2te idiv d2elo d2mwo 7 false getRSSwidths def
/d2we d2 d2gs sub d2te mod d2ele d2mwe 7 true getRSSwidths def
/d1w 14 array def
@@ -5103,7 +5418,7 @@
d1w {} forall
d2w {} forall
] def
-
+
/checkweights [
1 3 9 27 81 65 17 51 64 14 42 37 22 66
20 60 2 6 18 54 73 41 34 13 39 28 84 74
@@ -5124,7 +5439,7 @@
322 323
326 337
] def
-
+
/checksum 0 def
0 1 27 {
/i exch def
@@ -5141,11 +5456,11 @@
checkwidths i 2 mul swidths i get put
checkwidths i 2 mul 1 add bwidths i get put
} for
-
+
/sbs [
1 d1w {} forall checkwidths {} forall d2w {} forall 1 1
] def
-
+
% Return the arguments
<<
/ren //renlinear
@@ -5175,7 +5490,7 @@
% --EXAM: (01)95012345678903(3103)000123
% --EXOP:
% --RNDR: renlinear renmatrix
-%%BeginResource: uk.co.terryburton.bwipp databarexpanded 0.0 2014013000 216579 225605
+%%BeginResource: uk.co.terryburton.bwipp databarexpanded 0.0 2014121100 199499 218773
%%BeginData: 871 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -5194,8 +5509,8 @@
/height 34 72 div def
/format (expanded) def
/segments -1 def
- /linkage false def
-
+ /linkage false def
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -5206,7 +5521,7 @@
currentdict end /options exch def
} if
options {def} forall
-
+
/height height cvr def
/segments segments cvi def
@@ -5231,10 +5546,10 @@
dup out exch j exch putinterval
length j add /j exch def
out 0 j getinterval exit
- } ifelse
+ } ifelse
} loop
} bind def
-
+
% Parse out AIs
/ais [] def
/aival 2 dict def
@@ -5244,27 +5559,27 @@
(\)) search pop
exch pop
exch (\() search {
- exch pop exch 3 1 roll
- } {
+ exch pop exch 3 1 roll
+ } {
() 3 1 roll
} ifelse
[ ais aload pop counttomark 2 add index ] /ais exch def
aival 3 1 roll expand put
} loop
pop
-
+
% Method selection
{ % common exit
-
+
% (01)9...(3103)...
ais length 2 eq {
- ais 0 get (01) eq ais 1 get (3103) eq and {
+ ais 0 get (01) eq ais 1 get (3103) eq and {
aival (01) get 0 1 getinterval (9) eq aival (3103) get cvi 32767 le and {
- (0100) false exit
+ (0100) false exit
} if
} if
} if
-
+
% (01)9...(3202)...
ais length 2 eq {
ais 0 get (01) eq ais 1 get (3202) eq and {
@@ -5273,7 +5588,7 @@
} if
} if
} if
-
+
% (01)9...(3203)...
ais length 2 eq {
ais 0 get (01) eq ais 1 get (3203) eq and {
@@ -5282,7 +5597,7 @@
} if
} if
} if
-
+
% (01)9...(310x/320x)...[(11/13/15/17)...]
ais length dup 2 eq exch 3 eq or {
/ai310x false 3100 1 3109 {10 4 string cvrs ais 1 get eq or} for def
@@ -5294,8 +5609,8 @@
} ifelse
ais 0 get (01) eq ai310x ai320x or and aibad not and {
ais length 3 eq {
- aival (01) get 0 1 getinterval (9) eq
- aival ais 1 get get cvi 99999 le and
+ aival (01) get 0 1 getinterval (9) eq
+ aival ais 1 get get cvi 99999 le and
aival ais 2 get get cvi 999999 le and {
ai310x ais 2 get (11) eq and { (0111000) false exit } if
ai320x ais 2 get (11) eq and { (0111001) false exit } if
@@ -5307,7 +5622,7 @@
ai320x ais 2 get (17) eq and { (0111111) false exit } if
} if
} {
- aival (01) get 0 1 getinterval (9) eq
+ aival (01) get 0 1 getinterval (9) eq
aival ais 1 get get cvi 99999 le and {
ai310x { (0111000) false exit } if
ai320x { (0111001) false exit } if
@@ -5315,7 +5630,7 @@
} ifelse
} if
} if
-
+
% (01)9...(392x)...
ais length 2 ge {
/ai392x false 3920 1 3923 {10 4 string cvrs ais 1 get eq or} for def
@@ -5323,7 +5638,7 @@
aival (01) get 0 1 getinterval (9) eq { (01100) true exit } if
} if
} if
-
+
% (01)9...(393x)...
ais length 2 ge {
/ai393x false 3930 1 3933 {10 4 string cvrs ais 1 get eq or} for def
@@ -5331,17 +5646,17 @@
aival (01) get 0 1 getinterval (9) eq { (01101) true exit } if
} if
} if
-
+
% (01)...
ais 0 get (01) eq { (1) true exit } if
-
+
% Freeform
(00) true exit
-
+
} loop
/gpfallow exch def
/method exch def
-
+
/conv12to40 {
(0000000000000000000000000000000000000000) 40 string copy
2 copy 0 10 getinterval exch 0 3 getinterval cvi 2 10 string cvrs dup length 10 exch sub exch putinterval
@@ -5350,30 +5665,30 @@
2 copy 30 10 getinterval exch 9 3 getinterval cvi 2 10 string cvrs dup length 10 exch sub exch putinterval
exch pop
} bind def
-
+
/conv13to44 {
(00000000000000000000000000000000000000000000) 44 string copy
2 copy 0 4 getinterval exch 0 1 getinterval cvi 2 4 string cvrs dup length 4 exch sub exch putinterval
dup 3 -1 roll 1 12 getinterval conv12to40 4 exch putinterval
} bind def
-
+
/tobin {
string dup length 1 sub 0 exch 1 exch {1 index exch 48 put} for
- dup 3 -1 roll 2 2 index length string cvrs dup length 2 index length exch sub exch putinterval
+ dup 3 -1 roll 2 2 index length string cvrs dup length 2 index length exch sub exch putinterval
} bind def
-
+
method (00) eq {
/cdf [] def
/gpf [] def
} if
-
+
method (1) eq {
/cdf aival (01) get 0 13 getinterval conv13to44 def
/cdf [ cdf {48 sub} forall ] def
/gpf [] def
/ais ais 1 ais length 1 sub getinterval def
} if
-
+
method (0100) eq {
/cdf 55 string def
cdf 0 aival (01) get 1 12 getinterval conv12to40 putinterval
@@ -5382,7 +5697,7 @@
/gpf [] def
/ais [] def
} if
-
+
method (0101) eq {
/cdf 55 string def
cdf 0 aival (01) get 1 12 getinterval conv12to40 putinterval
@@ -5396,7 +5711,7 @@
/gpf [] def
/ais [] def
} if
-
+
method length 7 eq {
/cdf 76 string def
cdf 0 aival (01) get 1 12 getinterval conv12to40 putinterval
@@ -5407,7 +5722,7 @@
aival ais 2 get get
dup 0 2 getinterval cvi 384 mul exch
dup 2 2 getinterval cvi 1 sub 32 mul exch
- 4 2 getinterval cvi add add
+ 4 2 getinterval cvi add add
} {
38400
} ifelse
@@ -5416,7 +5731,7 @@
/gpf [] def
/ais [] def
} if
-
+
method (01100) eq {
/cdf 42 string def
cdf 0 aival (01) get 1 12 getinterval conv12to40 putinterval
@@ -5425,7 +5740,7 @@
/gpf [ aival ais 1 get get {} forall ] def
/ais ais 2 ais length 2 sub getinterval def
} if
-
+
method (01101) eq {
/cdf 52 string def
cdf 0 aival (01) get 1 12 getinterval conv12to40 putinterval
@@ -5435,7 +5750,7 @@
/gpf [ aival ais 1 get get dup length 3 sub 3 exch getinterval {} forall ] def
/ais ais 2 ais length 2 sub getinterval def
} if
-
+
% Variable length symbol field
gpfallow {
/vlf 2 array def
@@ -5462,20 +5777,20 @@
} forall
/fnc1 -1 def /lnumeric -2 def /lalphanumeric -3 def /liso646 -4 def
-
+
/numeric <<
0 1 119 {
dup (00) 2 string copy dup 3 -1 roll 11 2 string cvrs
- dup length 2 exch sub exch putinterval
- dup 0 get 65 eq {dup 0 94 put} if
- dup 1 get 65 eq {dup 1 94 put} if
+ dup length 2 exch sub exch putinterval
+ dup 0 get 65 eq {dup 0 94 put} if
+ dup 1 get 65 eq {dup 1 94 put} if
exch 8 add
- (0000000) 7 string copy dup 3 -1 roll 2 7 string cvrs
+ (0000000) 7 string copy dup 3 -1 roll 2 7 string cvrs
dup length 7 exch sub exch putinterval
} for
lalphanumeric (0000)
>> def
-
+
/alphanumeric <<
48 1 57 {dup 43 sub 5 tobin} for
fnc1 (01111)
@@ -5485,7 +5800,7 @@
lnumeric (000)
liso646 (00100)
>> def
-
+
/iso646 <<
48 1 57 {dup 43 sub 5 tobin} for
fnc1 (01111)
@@ -5500,7 +5815,7 @@
lnumeric (000)
lalphanumeric (00100)
>> def
-
+
% Append the remaining AI data
0 1 ais length 1 sub {
/i exch def
@@ -5522,16 +5837,16 @@
% Calculate the number of bits remaining to the next valid symbol size
/rembits {
dup
- 12 div ceiling cvi 12 mul % Round up to multiple of 12
+ 12 div ceiling cvi 12 mul % Round up to multiple of 12
48 2 copy lt {exch} if pop % At least 4 symbols
dup 12 idiv dup segments mod 1 eq { % At least 2 symbols on last row of stacked symbol
1 add 12 mul exch pop
} {
pop
- } ifelse
+ } ifelse
exch sub
} bind def
-
+
/encode {
dup /raw ne {exch get} {pop} ifelse
[ exch {48 sub} forall ]
@@ -5539,7 +5854,7 @@
gpfenc exch j exch putinterval
/j exch j add def
} bind def
-
+
% Pre-compute alphanumeric and numeric runlengths and position of next ISO646-only characters
/numericruns [ gpf length {0} repeat 0 -1 ] def
/alphanumericruns [ gpf length {0} repeat 0 ] def
@@ -5548,7 +5863,7 @@
/i exch def
gpf i get
(00) 2 string copy
- dup 0 gpf i get dup fnc1 eq {pop 94} if put
+ dup 0 gpf i get dup fnc1 eq {pop 94} if put
i gpf length 1 sub lt {dup 1 gpf i 1 add get dup fnc1 eq {pop 94} if put} if
numeric exch known {
numericruns i numericruns i 2 add get 2 add put
@@ -5566,17 +5881,17 @@
nextiso646only i nextiso646only i 1 add get 1 add put
} ifelse
} for
-
+
% Encode the general purpose field
/gpfenc 252 array def
/i 0 def /j 0 def /mode (numeric) def
{ % loop
i gpf length eq {exit} if
{ % not a loop but common exit point
-
+
mode (numeric) eq {
i gpf length 2 sub le {
- 2 string
+ 2 string
dup 0 gpf i get dup fnc1 eq {pop 94} if put
dup 1 gpf i 1 add get dup fnc1 eq {pop 94} if put
dup numeric exch known {
@@ -5585,7 +5900,7 @@
exit
} if
pop
- lalphanumeric numeric encode
+ lalphanumeric numeric encode
/mode (alphanumeric) def
exit
} {
@@ -5602,13 +5917,13 @@
/i i 1 add def
exit
} { % C1.FNC1
- 2 string dup 0 gpf i get put dup 1 94 put numeric encode
+ 2 string dup 0 gpf i get put dup 1 94 put numeric encode
/i i 1 add def
exit
} ifelse
} ifelse
} if
-
+
mode (alphanumeric) eq {
gpf i get fnc1 eq {
fnc1 alphanumeric encode
@@ -5635,7 +5950,7 @@
/i i 1 add def
exit
} if
-
+
mode (iso646) eq {
gpf i get fnc1 eq {
fnc1 iso646 encode
@@ -5657,13 +5972,13 @@
/i i 1 add def
exit
} if
-
+
} loop
} loop
/gpf gpfenc 0 j getinterval def
% Complete the variable length field and create pad
- 1 12 add method length add vlf length add cdf length add gpf length add
+ 1 12 add method length add vlf length add cdf length add gpf length add
dup rembits dup array /pad exch def
vlf length 0 ne {
add 12 idiv
@@ -5675,16 +5990,16 @@
pad length 0 gt {
0 5 pad length 1 sub { % Fill with 00100
/i exch def
- pad i [ 0 0 1 0 0 ] 0 pad length i sub 5 2 copy gt {exch} if pop getinterval putinterval
- } for
+ pad i [ 0 0 1 0 0 ] 0 pad length i sub 5 2 copy gt {exch} if pop getinterval putinterval
+ } for
mode (numeric) eq { % Prefix shift from numeric to ASCII
/pad [ 0 0 0 0 pad aload pop ] 0 pad length getinterval def
} if
} if
-
+
% Concatinate fields
/binval [
- linkage {1} {0} ifelse
+ linkage {1} {0} ifelse
method {48 sub} forall
vlf aload pop
cdf aload pop
@@ -5692,7 +6007,7 @@
pad aload pop
] def
/datalen binval length 12 idiv def
-
+
/ncr { % n r
2 copy sub 2 copy lt {exch} if % n r maxd mind
1 1 5 3 roll % mind j=1 v=1 n maxd
@@ -5708,7 +6023,7 @@
} loop
exch pop exch pop
} bind def
-
+
/getRSSwidths {
/oe exch def
/el exch def
@@ -5719,7 +6034,7 @@
/mask 0 def
0 1 el 2 sub {
/bar exch def
- /ew 1 def
+ /ew 1 def
/mask mask 1 bar bitshift or def {
/sval nm ew sub 1 sub el bar sub 2 sub ncr def
oe mask 0 eq and nm ew sub el 2 mul sub bar 2 mul add -2 ge and {
@@ -5739,10 +6054,10 @@
val 0 lt {exit} if
/ew ew 1 add def
/mask mask 1 bar bitshift not and def
- } loop
+ } loop
/val val sval add def
/nm nm ew sub def
- out bar ew put
+ out bar ew put
} for
out el 1 sub nm put
out
@@ -5757,7 +6072,7 @@
] def
/dxw datalen array def
-
+
0 1 datalen 1 sub {
/x exch def
@@ -5780,14 +6095,14 @@
/dwo d dgs sub dte idiv delo dmwo 4 true getRSSwidths def
/dwe d dgs sub dte mod dele dmwe 4 false getRSSwidths def
- /dw 8 array def
- x 2 mod 0 eq {
+ /dw 8 array def
+ x 2 mod 0 eq {
0 1 3 {
/j exch def
dw 7 j 2 mul sub dwo j get put
dw 6 j 2 mul sub dwe j get put
} for
- } {
+ } {
0 1 3 {
/j exch def
dw j 2 mul dwo j get put
@@ -5798,7 +6113,7 @@
dxw x dw put
} for
-
+
/finderwidths [
1 8 4 1 1 1 1 4 8 1
3 6 4 1 1 1 1 4 6 3
@@ -5833,7 +6148,7 @@
77 96 32 81 27 9 3 1 % A1R
20 60 180 118 143 7 21 63 % A2L
205 209 140 117 39 13 145 189 % A2R
- 193 157 49 147 19 57 171 91 % B1L
+ 193 157 49 147 19 57 171 91 % B1L
132 44 85 169 197 136 186 62 % B1R
185 133 188 142 4 12 36 108 % B2L
50 87 29 80 97 173 128 113 % B2R
@@ -5862,11 +6177,11 @@
/widths [
dxw {{} forall} forall
] def
-
+
/checksum 0 def
0 1 widths length 1 sub {
/i exch def
- /checksum checksum widths i get checkweightseq i get mul add def
+ /checksum checksum widths i get checkweightseq i get mul add def
} for
/checksum checksum 211 mod datalen 3 sub 211 mul add def
@@ -5885,7 +6200,7 @@
/cwo checksum cgs sub cte idiv celo cmwo 4 true getRSSwidths def
/cwe checksum cgs sub cte mod cele cmwe 4 false getRSSwidths def
- /cw 8 array def
+ /cw 8 array def
0 1 3 {
/i exch def
cw i 2 mul cwo i get put
@@ -5908,7 +6223,7 @@
0 1 segments 1 sub {
/pos exch r segments mul add def
pos datalen lt {
- dxw pos get {} forall
+ dxw pos get {} forall
pos 2 mod 0 eq {fxw pos 2 idiv get {} forall} if
} if
} for
@@ -5965,7 +6280,7 @@
/finderpos [ % Finder pattern module positions
19 98 row length 13 sub {} for
68 98 row length 13 sub {} for
- ] def
+ ] def
finderpos {
dup 14 add 1 exch {
/i exch def
@@ -6004,9 +6319,9 @@
% Extend last row and separator to fill width of symbol
/pixx rows 0 get length def
[ pixx {0} repeat ] dup 0 rows numrows 1 sub get putinterval
- rows exch numrows 1 sub exch put
+ rows exch numrows 1 sub exch put
[ pixx {0} repeat ] dup 0 seps numrows 1 sub get putinterval
- seps exch numrows 1 sub exch put
+ seps exch numrows 1 sub exch put
% Middle separator pattern
/sep [ pixx 2 idiv 1 add { 0 1 } repeat ] 0 pixx getinterval def
@@ -6058,7 +6373,7 @@
% --EXAM: (01)95012345678903(3103)000123
% --EXOP: segments=4
% --RNDR: renlinear renmatrix
-%%BeginResource: uk.co.terryburton.bwipp databarexpandedstacked 0.0 2014013000 63864 67228
+%%BeginResource: uk.co.terryburton.bwipp databarexpandedstacked 0.0 2014121100 67280 63708
%%BeginData: 43 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -6094,7 +6409,7 @@
args (opt) options put
args
-
+
dontdraw not //renmatrix if
end
@@ -6113,7 +6428,7 @@
% --EXAM: 117480
% --EXOP: showborder
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp pharmacode 0.0 2014013000 61048 60895
+%%BeginResource: uk.co.terryburton.bwipp pharmacode 0.0 2014121100 61048 60791
%%BeginData: 91 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -6131,7 +6446,7 @@
/height 8 2.835 mul 72 div def
/nwidth 0.5 2.835 mul def
/wwidth 1.5 2.835 mul def
- /swidth 1.0 2.835 mul def
+ /swidth 1.0 2.835 mul def
% Parse the input options
options type /stringtype eq {
@@ -6143,7 +6458,7 @@
currentdict end /options exch def
} if
options {def} forall
-
+
/height height cvr def
/nwidth nwidth cvr def
/wwidth wwidth cvr def
@@ -6169,7 +6484,7 @@
txt i [barcode i 1 getinterval 0 0 () 0] put
} for
- % Convert the integer into the paramacode string
+ % Convert the integer into the paramacode string
/barcode barcode cvi 1 add 2 17 string cvrs def
/barcode barcode 1 barcode length 1 sub getinterval def
@@ -6216,7 +6531,7 @@
% --EXAM: 117480
% --EXOP: includetext showborder
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp pharmacode2 0.0 2014013000 61615 61489
+%%BeginResource: uk.co.terryburton.bwipp pharmacode2 0.0 2014121100 61823 61489
%%BeginData: 96 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -6273,7 +6588,7 @@
/sbs 32 array def
/bar 1 25.4 div height mul def % bar height (mm)
/spc 1 25.4 div 72 mul def % bar width & spacing (1mm)
-
+
% Convert number into a base3 representation
/i 15 def
/val barcode cvi def
@@ -6285,7 +6600,7 @@
/i i 1 sub def
} loop
/encstr encstr i 1 add 15 i sub getinterval def
-
+
% Generate the bar pattern
0 1 encstr length 1 sub {
/i exch def
@@ -6293,7 +6608,7 @@
bhs i bar [1 1 2] 5 -1 roll get mul put
bbs i [0 bar 0] 4 -1 roll get put
} for
-
+
% Return the arguments
<<
/ren //renlinear
@@ -6324,7 +6639,7 @@
% --EXAM: 01234567
% --EXOP: version=iata includetext includecheck includecheckintext
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp code2of5 0.0 2014013000 69377 72456
+%%BeginResource: uk.co.terryburton.bwipp code2of5 0.0 2014121100 69481 69040
%%BeginData: 150 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -6389,12 +6704,12 @@
} if
% Create an array containing the character mappings
- /versions <<
+ /versions <<
/industrial
[ (1111313111) (3111111131) (1131111131) (3131111111)
(1111311131) (3111311111) (1131311111) (1111113131)
(3111113111) (1131113111) (313111) (31113)
- ]
+ ]
/iata
[ (1111313111) (3111111131) (1131111131) (3131111111)
(1111311131) (3111311111) (1131311111) (1111113131)
@@ -6486,7 +6801,7 @@
% --EXAM: 0123456789
% --EXOP: includetext includecheck includecheckintext
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp code11 0.0 2014013000 70769 73865
+%%BeginResource: uk.co.terryburton.bwipp code11 0.0 2014121100 70977 70345
%%BeginData: 158 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -6509,7 +6824,7 @@
/textsize 10 def
/textyoffset -7 def
/height 1 def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -6520,12 +6835,12 @@
currentdict end /options exch def
} if
options {def} forall
-
+
/textfont textfont cvlit def
/textsize textsize cvr def
/textyoffset textyoffset cvr def
/height height cvr def
-
+
% Create an array containing the character mappings
/encs
[ (111131) (311131) (131131) (331111) (113131)
@@ -6595,15 +6910,15 @@
/xpos exch enc exch get 48 sub xpos add def
} for
} for
-
+
% Put the checksum and end characters
includecheck {
barlen 10 ge {
- sbs barlen 6 mul 6 add encs checksum1 get putinterval
+ sbs barlen 6 mul 6 add encs checksum1 get putinterval
sbs barlen 6 mul 12 add encs checksum2 get putinterval
includecheckintext {
txt barlen [barchars checksum1 1 getinterval xpos textyoffset textfont textsize] put
- /enc encs checksum1 get def
+ /enc encs checksum1 get def
0 1 5 { % xpos+=width of the character
/xpos exch enc exch get 48 sub xpos add def
} for
@@ -6614,7 +6929,7 @@
} ifelse
sbs barlen 6 mul 18 add encs 11 get putinterval
} {
- sbs barlen 6 mul 6 add encs checksum1 get putinterval
+ sbs barlen 6 mul 6 add encs checksum1 get putinterval
includecheckintext {
txt barlen [barchars checksum1 1 getinterval xpos textyoffset textfont textsize] put
} {
@@ -6656,7 +6971,7 @@
% --EXAM: BC412
% --EXOP: semi includetext includecheckintext
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp bc412 0.0 2014013000 66342 69616
+%%BeginResource: uk.co.terryburton.bwipp bc412 0.0 2014121100 66446 66096
%%BeginData: 148 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -6681,7 +6996,7 @@
/textsize 10 def
/textyoffset -7 def
/height 1 def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -6692,12 +7007,12 @@
currentdict end /options exch def
} if
options {def} forall
-
+
/textfont textfont cvlit def
/textsize textsize cvr def
/textyoffset textyoffset cvr def
/height height cvr def
-
+
semi {
/includecheck true def
/includestartstop true def
@@ -6777,16 +7092,16 @@
txt barlen [() barlen 12 mul txtpos add textyoffset textfont textsize] put
} ifelse
/pos pos 8 add def
- } if
+ } if
% Put the stop character
- includestartstop {
+ includestartstop {
sbs pos encs 36 get putinterval
/pos pos 2 add def
} if
% Return the arguments
- /sbs sbs 0 pos getinterval def
+ /sbs sbs 0 pos getinterval def
<<
/ren //renlinear
/sbs [sbs {48 sub} forall]
@@ -6816,7 +7131,7 @@
% --EXAM: A0123456789B
% --EXOP: includetext includecheck includecheckintext
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp rationalizedCodabar 0.0 2014013000 71473 74381
+%%BeginResource: uk.co.terryburton.bwipp rationalizedCodabar 0.0 2014121100 71473 70757
%%BeginData: 156 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -6840,7 +7155,7 @@
/textsize 10 def
/textyoffset -7 def
/height 1 def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -6851,12 +7166,12 @@
currentdict end /options exch def
} if
options {def} forall
-
+
/textfont textfont cvlit def
/textsize textsize cvr def
/textyoffset textyoffset cvr def
/height height cvr def
-
+
% Create an array containing the character mappings
/encs
[ (11111331) (11113311) (11131131) (33111111) (11311311)
@@ -6879,7 +7194,7 @@
16 1 19 {ssvals exch dup barchars exch 1 getinterval exch put} for
% Validate the input
- barcode 0 1 getinterval ssvals exch known not
+ barcode 0 1 getinterval ssvals exch known not
barcode barcode length 1 sub 1 getinterval ssvals exch known not or {
altstartstop {
/bwipp.rationalizedCodabarBadAltStartStop (Codabar start and stop characters must be one of E N T or *) //raiseerror exec
@@ -6901,7 +7216,7 @@
checksum add /checksum exch def
} for
barcode barcode length 1 sub 1 getinterval charvals exch get
- checksum add /checksum exch def
+ checksum add /checksum exch def
/checksum 16 checksum 16 mod sub 16 mod def
validatecheck {
barcode barlen 1 sub get barchars checksum get ne {
@@ -6984,7 +7299,7 @@
% --EXAM: 0123456709498765432101234567891
% --EXOP: barcolor=FF0000
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp onecode 0.0 2014013000 105187 108053
+%%BeginResource: uk.co.terryburton.bwipp onecode 0.0 2014121100 105083 104845
%%BeginData: 335 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -7000,7 +7315,7 @@
/dontdraw false def
/height 0.15 def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -7011,11 +7326,11 @@
currentdict end /options exch def
} if
options {def} forall
-
+
/height height cvr def
/barlen barcode length def
-
+
% Create the human readable text
/txtdict <<
2 dup
@@ -7041,18 +7356,18 @@
/base exch def
/num exch def
num length 1 sub -1 1 {
- /i exch def
+ /i exch def
num i 1 sub 2 copy get num i get base idiv add put
num i num i get base mod put
} for
{ %loop - extend input as necessary
num 0 get base lt {exit} if
- /num [0 num {} forall] def
+ /num [0 num {} forall] def
num 0 num 0 get num 1 get base idiv add put
num 1 num 1 get base mod put
} loop
% Trim leading zeros
- /num [/i true def num {dup 0 eq i and {pop} {/i false def} ifelse} forall] def
+ /num [/i true def num {dup 0 eq i and {pop} {/i false def} ifelse} forall] def
num length 0 eq {/num [0] def} if
num
} bind def
@@ -7061,7 +7376,7 @@
2 copy length exch length
2 copy sub abs /offset exch def
lt {exch} if
- /a exch def /b exch def
+ /a exch def /b exch def
0 1 b length 1 sub {
dup a exch offset add 2 copy get b 5 -1 roll get add put
} for
@@ -7089,7 +7404,7 @@
bintmp j bintmp j get 256 idiv put
} for
bytes i bintmp bintmp length 1 sub get 256 mod put
- bintmp bintmp length 1 sub 2 copy get 256 idiv put
+ bintmp bintmp length 1 sub 2 copy get 256 idiv put
} for
% Generation of 11-bit CRC on byte array
@@ -7097,7 +7412,7 @@
/dat bytes 0 get 5 bitshift def
6 {
fcs dat xor 1024 and 0 ne {
- /fcs fcs 1 bitshift 3893 xor def
+ /fcs fcs 1 bitshift 3893 xor def
} {
/fcs fcs 1 bitshift def
} ifelse
@@ -7105,10 +7420,10 @@
/dat dat 1 bitshift def
} repeat
1 1 12 {
- bytes exch get 3 bitshift /dat exch def
- 8 {
+ bytes exch get 3 bitshift /dat exch def
+ 8 {
fcs dat xor 1024 and 0 ne {
- /fcs fcs 1 bitshift 3893 xor def
+ /fcs fcs 1 bitshift 3893 xor def
} {
/fcs fcs 1 bitshift def
} ifelse
@@ -7130,7 +7445,7 @@
/j exch def
binval j 1 add 2 copy get binval j get b mod 10 mul add put
binval j binval j get b idiv put
- } for
+ } for
codewords i binval binval length 1 sub get b mod put
binval binval length 1 sub 2 copy get b idiv put
} for
@@ -7143,100 +7458,100 @@
% Conversion from codewords to characters
/tab513 [
- 31 7936 47 7808 55 7552 59 7040 61 6016 62 3968 79 7744 87
- 7488 91 6976 93 5952 94 3904 103 7360 107 6848 109 5824 110 3776
- 115 6592 117 5568 118 3520 121 5056 122 3008 124 1984 143 7712 151
- 7456 155 6944 157 5920 158 3872 167 7328 171 6816 173 5792 174 3744
- 179 6560 181 5536 182 3488 185 5024 186 2976 188 1952 199 7264 203
- 6752 205 5728 206 3680 211 6496 213 5472 214 3424 217 4960 218 2912
- 220 1888 227 6368 229 5344 230 3296 233 4832 234 2784 236 1760 241
- 4576 242 2528 244 1504 248 992 271 7696 279 7440 283 6928 285 5904
- 286 3856 295 7312 299 6800 301 5776 302 3728 307 6544 309 5520 310
- 3472 313 5008 314 2960 316 1936 327 7248 331 6736 333 5712 334 3664
- 339 6480 341 5456 342 3408 345 4944 346 2896 348 1872 355 6352 357
- 5328 358 3280 361 4816 362 2768 364 1744 369 4560 370 2512 372 1488
- 376 976 391 7216 395 6704 397 5680 398 3632 403 6448 405 5424 406
- 3376 409 4912 410 2864 412 1840 419 6320 421 5296 422 3248 425 4784
- 426 2736 428 1712 433 4528 434 2480 436 1456 440 944 451 6256 453
- 5232 454 3184 457 4720 458 2672 460 1648 465 4464 466 2416 468 1392
- 472 880 481 4336 482 2288 484 1264 488 752 527 7688 535 7432 539
- 6920 541 5896 542 3848 551 7304 555 6792 557 5768 558 3720 563 6536
- 565 5512 566 3464 569 5000 570 2952 572 1928 583 7240 587 6728 589
- 5704 590 3656 595 6472 597 5448 598 3400 601 4936 602 2888 604 1864
- 611 6344 613 5320 614 3272 617 4808 618 2760 620 1736 625 4552 626
- 2504 628 1480 632 968 647 7208 651 6696 653 5672 654 3624 659 6440
- 661 5416 662 3368 665 4904 666 2856 668 1832 675 6312 677 5288 678
- 3240 681 4776 682 2728 684 1704 689 4520 690 2472 692 1448 696 936
- 707 6248 709 5224 710 3176 713 4712 714 2664 716 1640 721 4456 722
- 2408 724 1384 728 872 737 4328 738 2280 740 1256 775 7192 779 6680
- 781 5656 782 3608 787 6424 789 5400 790 3352 793 4888 794 2840 796
- 1816 803 6296 805 5272 806 3224 809 4760 810 2712 812 1688 817 4504
- 818 2456 820 1432 824 920 835 6232 837 5208 838 3160 841 4696 842
- 2648 844 1624 849 4440 850 2392 852 1368 865 4312 866 2264 868 1240
- 899 6200 901 5176 902 3128 905 4664 906 2616 908 1592 913 4408 914
- 2360 916 1336 929 4280 930 2232 932 1208 961 4216 962 2168 964 1144
- 1039 7684 1047 7428 1051 6916 1053 5892 1054 3844 1063 7300 1067 6788 1069
- 5764 1070 3716 1075 6532 1077 5508 1078 3460 1081 4996 1082 2948 1084 1924
- 1095 7236 1099 6724 1101 5700 1102 3652 1107 6468 1109 5444 1110 3396 1113
- 4932 1114 2884 1116 1860 1123 6340 1125 5316 1126 3268 1129 4804 1130 2756
- 1132 1732 1137 4548 1138 2500 1140 1476 1159 7204 1163 6692 1165 5668 1166
- 3620 1171 6436 1173 5412 1174 3364 1177 4900 1178 2852 1180 1828 1187 6308
- 1189 5284 1190 3236 1193 4772 1194 2724 1196 1700 1201 4516 1202 2468 1204
- 1444 1219 6244 1221 5220 1222 3172 1225 4708 1226 2660 1228 1636 1233 4452
- 1234 2404 1236 1380 1249 4324 1250 2276 1287 7188 1291 6676 1293 5652 1294
- 3604 1299 6420 1301 5396 1302 3348 1305 4884 1306 2836 1308 1812 1315 6292
- 1317 5268 1318 3220 1321 4756 1322 2708 1324 1684 1329 4500 1330 2452 1332
- 1428 1347 6228 1349 5204 1350 3156 1353 4692 1354 2644 1356 1620 1361 4436
- 1362 2388 1377 4308 1378 2260 1411 6196 1413 5172 1414 3124 1417 4660 1418
- 2612 1420 1588 1425 4404 1426 2356 1441 4276 1442 2228 1473 4212 1474 2164
- 1543 7180 1547 6668 1549 5644 1550 3596 1555 6412 1557 5388 1558 3340 1561
- 4876 1562 2828 1564 1804 1571 6284 1573 5260 1574 3212 1577 4748 1578 2700
- 1580 1676 1585 4492 1586 2444 1603 6220 1605 5196 1606 3148 1609 4684 1610
- 2636 1617 4428 1618 2380 1633 4300 1634 2252 1667 6188 1669 5164 1670 3116
- 1673 4652 1674 2604 1681 4396 1682 2348 1697 4268 1698 2220 1729 4204 1730
- 2156 1795 6172 1797 5148 1798 3100 1801 4636 1802 2588 1809 4380 1810 2332
- 1825 4252 1826 2204 1857 4188 1858 2140 1921 4156 1922 2108 2063 7682 2071
- 7426 2075 6914 2077 5890 2078 3842 2087 7298 2091 6786 2093 5762 2094 3714
- 2099 6530 2101 5506 2102 3458 2105 4994 2106 2946 2119 7234 2123 6722 2125
- 5698 2126 3650 2131 6466 2133 5442 2134 3394 2137 4930 2138 2882 2147 6338
- 2149 5314 2150 3266 2153 4802 2154 2754 2161 4546 2162 2498 2183 7202 2187
- 6690 2189 5666 2190 3618 2195 6434 2197 5410 2198 3362 2201 4898 2202 2850
- 2211 6306 2213 5282 2214 3234 2217 4770 2218 2722 2225 4514 2226 2466 2243
- 6242 2245 5218 2246 3170 2249 4706 2250 2658 2257 4450 2258 2402 2273 4322
- 2311 7186 2315 6674 2317 5650 2318 3602 2323 6418 2325 5394 2326 3346 2329
- 4882 2330 2834 2339 6290 2341 5266 2342 3218 2345 4754 2346 2706 2353 4498
- 2354 2450 2371 6226 2373 5202 2374 3154 2377 4690 2378 2642 2385 4434 2401
- 4306 2435 6194 2437 5170 2438 3122 2441 4658 2442 2610 2449 4402 2465 4274
- 2497 4210 2567 7178 2571 6666 2573 5642 2574 3594 2579 6410 2581 5386 2582
- 3338 2585 4874 2586 2826 2595 6282 2597 5258 2598 3210 2601 4746 2602 2698
- 2609 4490 2627 6218 2629 5194 2630 3146 2633 4682 2641 4426 2657 4298 2691
- 6186 2693 5162 2694 3114 2697 4650 2705 4394 2721 4266 2753 4202 2819 6170
- 2821 5146 2822 3098 2825 4634 2833 4378 2849 4250 2881 4186 2945 4154 3079
- 7174 3083 6662 3085 5638 3086 3590 3091 6406 3093 5382 3094 3334 3097 4870
- 3107 6278 3109 5254 3110 3206 3113 4742 3121 4486 3139 6214 3141 5190 3145
- 4678 3153 4422 3169 4294 3203 6182 3205 5158 3209 4646 3217 4390 3233 4262
- 3265 4198 3331 6166 3333 5142 3337 4630 3345 4374 3361 4246 3393 4182 3457
- 4150 3587 6158 3589 5134 3593 4622 3601 4366 3617 4238 3649 4174 3713 4142
- 3841 4126 4111 7681 4119 7425 4123 6913 4125 5889 4135 7297 4139 6785 4141
- 5761 4147 6529 4149 5505 4153 4993 4167 7233 4171 6721 4173 5697 4179 6465
- 4181 5441 4185 4929 4195 6337 4197 5313 4201 4801 4209 4545 4231 7201 4235
- 6689 4237 5665 4243 6433 4245 5409 4249 4897 4259 6305 4261 5281 4265 4769
- 4273 4513 4291 6241 4293 5217 4297 4705 4305 4449 4359 7185 4363 6673 4365
- 5649 4371 6417 4373 5393 4377 4881 4387 6289 4389 5265 4393 4753 4401 4497
- 4419 6225 4421 5201 4425 4689 4483 6193 4485 5169 4489 4657 4615 7177 4619
- 6665 4621 5641 4627 6409 4629 5385 4633 4873 4643 6281 4645 5257 4649 4745
- 4675 6217 4677 5193 4739 6185 4741 5161 4867 6169 4869 5145 5127 7173 5131
- 6661 5133 5637 5139 6405 5141 5381 5155 6277 5157 5253 5187 6213 5251 6181
- 5379 6165 5635 6157 6151 7171 6155 6659 6163 6403 6179 6275 6211 5189 4681
- 4433 4321 3142 2634 2386 2274 1612 1364 1252 856 744 496
+ 31 7936 47 7808 55 7552 59 7040 61 6016 62 3968 79 7744 87
+ 7488 91 6976 93 5952 94 3904 103 7360 107 6848 109 5824 110 3776
+ 115 6592 117 5568 118 3520 121 5056 122 3008 124 1984 143 7712 151
+ 7456 155 6944 157 5920 158 3872 167 7328 171 6816 173 5792 174 3744
+ 179 6560 181 5536 182 3488 185 5024 186 2976 188 1952 199 7264 203
+ 6752 205 5728 206 3680 211 6496 213 5472 214 3424 217 4960 218 2912
+ 220 1888 227 6368 229 5344 230 3296 233 4832 234 2784 236 1760 241
+ 4576 242 2528 244 1504 248 992 271 7696 279 7440 283 6928 285 5904
+ 286 3856 295 7312 299 6800 301 5776 302 3728 307 6544 309 5520 310
+ 3472 313 5008 314 2960 316 1936 327 7248 331 6736 333 5712 334 3664
+ 339 6480 341 5456 342 3408 345 4944 346 2896 348 1872 355 6352 357
+ 5328 358 3280 361 4816 362 2768 364 1744 369 4560 370 2512 372 1488
+ 376 976 391 7216 395 6704 397 5680 398 3632 403 6448 405 5424 406
+ 3376 409 4912 410 2864 412 1840 419 6320 421 5296 422 3248 425 4784
+ 426 2736 428 1712 433 4528 434 2480 436 1456 440 944 451 6256 453
+ 5232 454 3184 457 4720 458 2672 460 1648 465 4464 466 2416 468 1392
+ 472 880 481 4336 482 2288 484 1264 488 752 527 7688 535 7432 539
+ 6920 541 5896 542 3848 551 7304 555 6792 557 5768 558 3720 563 6536
+ 565 5512 566 3464 569 5000 570 2952 572 1928 583 7240 587 6728 589
+ 5704 590 3656 595 6472 597 5448 598 3400 601 4936 602 2888 604 1864
+ 611 6344 613 5320 614 3272 617 4808 618 2760 620 1736 625 4552 626
+ 2504 628 1480 632 968 647 7208 651 6696 653 5672 654 3624 659 6440
+ 661 5416 662 3368 665 4904 666 2856 668 1832 675 6312 677 5288 678
+ 3240 681 4776 682 2728 684 1704 689 4520 690 2472 692 1448 696 936
+ 707 6248 709 5224 710 3176 713 4712 714 2664 716 1640 721 4456 722
+ 2408 724 1384 728 872 737 4328 738 2280 740 1256 775 7192 779 6680
+ 781 5656 782 3608 787 6424 789 5400 790 3352 793 4888 794 2840 796
+ 1816 803 6296 805 5272 806 3224 809 4760 810 2712 812 1688 817 4504
+ 818 2456 820 1432 824 920 835 6232 837 5208 838 3160 841 4696 842
+ 2648 844 1624 849 4440 850 2392 852 1368 865 4312 866 2264 868 1240
+ 899 6200 901 5176 902 3128 905 4664 906 2616 908 1592 913 4408 914
+ 2360 916 1336 929 4280 930 2232 932 1208 961 4216 962 2168 964 1144
+ 1039 7684 1047 7428 1051 6916 1053 5892 1054 3844 1063 7300 1067 6788 1069
+ 5764 1070 3716 1075 6532 1077 5508 1078 3460 1081 4996 1082 2948 1084 1924
+ 1095 7236 1099 6724 1101 5700 1102 3652 1107 6468 1109 5444 1110 3396 1113
+ 4932 1114 2884 1116 1860 1123 6340 1125 5316 1126 3268 1129 4804 1130 2756
+ 1132 1732 1137 4548 1138 2500 1140 1476 1159 7204 1163 6692 1165 5668 1166
+ 3620 1171 6436 1173 5412 1174 3364 1177 4900 1178 2852 1180 1828 1187 6308
+ 1189 5284 1190 3236 1193 4772 1194 2724 1196 1700 1201 4516 1202 2468 1204
+ 1444 1219 6244 1221 5220 1222 3172 1225 4708 1226 2660 1228 1636 1233 4452
+ 1234 2404 1236 1380 1249 4324 1250 2276 1287 7188 1291 6676 1293 5652 1294
+ 3604 1299 6420 1301 5396 1302 3348 1305 4884 1306 2836 1308 1812 1315 6292
+ 1317 5268 1318 3220 1321 4756 1322 2708 1324 1684 1329 4500 1330 2452 1332
+ 1428 1347 6228 1349 5204 1350 3156 1353 4692 1354 2644 1356 1620 1361 4436
+ 1362 2388 1377 4308 1378 2260 1411 6196 1413 5172 1414 3124 1417 4660 1418
+ 2612 1420 1588 1425 4404 1426 2356 1441 4276 1442 2228 1473 4212 1474 2164
+ 1543 7180 1547 6668 1549 5644 1550 3596 1555 6412 1557 5388 1558 3340 1561
+ 4876 1562 2828 1564 1804 1571 6284 1573 5260 1574 3212 1577 4748 1578 2700
+ 1580 1676 1585 4492 1586 2444 1603 6220 1605 5196 1606 3148 1609 4684 1610
+ 2636 1617 4428 1618 2380 1633 4300 1634 2252 1667 6188 1669 5164 1670 3116
+ 1673 4652 1674 2604 1681 4396 1682 2348 1697 4268 1698 2220 1729 4204 1730
+ 2156 1795 6172 1797 5148 1798 3100 1801 4636 1802 2588 1809 4380 1810 2332
+ 1825 4252 1826 2204 1857 4188 1858 2140 1921 4156 1922 2108 2063 7682 2071
+ 7426 2075 6914 2077 5890 2078 3842 2087 7298 2091 6786 2093 5762 2094 3714
+ 2099 6530 2101 5506 2102 3458 2105 4994 2106 2946 2119 7234 2123 6722 2125
+ 5698 2126 3650 2131 6466 2133 5442 2134 3394 2137 4930 2138 2882 2147 6338
+ 2149 5314 2150 3266 2153 4802 2154 2754 2161 4546 2162 2498 2183 7202 2187
+ 6690 2189 5666 2190 3618 2195 6434 2197 5410 2198 3362 2201 4898 2202 2850
+ 2211 6306 2213 5282 2214 3234 2217 4770 2218 2722 2225 4514 2226 2466 2243
+ 6242 2245 5218 2246 3170 2249 4706 2250 2658 2257 4450 2258 2402 2273 4322
+ 2311 7186 2315 6674 2317 5650 2318 3602 2323 6418 2325 5394 2326 3346 2329
+ 4882 2330 2834 2339 6290 2341 5266 2342 3218 2345 4754 2346 2706 2353 4498
+ 2354 2450 2371 6226 2373 5202 2374 3154 2377 4690 2378 2642 2385 4434 2401
+ 4306 2435 6194 2437 5170 2438 3122 2441 4658 2442 2610 2449 4402 2465 4274
+ 2497 4210 2567 7178 2571 6666 2573 5642 2574 3594 2579 6410 2581 5386 2582
+ 3338 2585 4874 2586 2826 2595 6282 2597 5258 2598 3210 2601 4746 2602 2698
+ 2609 4490 2627 6218 2629 5194 2630 3146 2633 4682 2641 4426 2657 4298 2691
+ 6186 2693 5162 2694 3114 2697 4650 2705 4394 2721 4266 2753 4202 2819 6170
+ 2821 5146 2822 3098 2825 4634 2833 4378 2849 4250 2881 4186 2945 4154 3079
+ 7174 3083 6662 3085 5638 3086 3590 3091 6406 3093 5382 3094 3334 3097 4870
+ 3107 6278 3109 5254 3110 3206 3113 4742 3121 4486 3139 6214 3141 5190 3145
+ 4678 3153 4422 3169 4294 3203 6182 3205 5158 3209 4646 3217 4390 3233 4262
+ 3265 4198 3331 6166 3333 5142 3337 4630 3345 4374 3361 4246 3393 4182 3457
+ 4150 3587 6158 3589 5134 3593 4622 3601 4366 3617 4238 3649 4174 3713 4142
+ 3841 4126 4111 7681 4119 7425 4123 6913 4125 5889 4135 7297 4139 6785 4141
+ 5761 4147 6529 4149 5505 4153 4993 4167 7233 4171 6721 4173 5697 4179 6465
+ 4181 5441 4185 4929 4195 6337 4197 5313 4201 4801 4209 4545 4231 7201 4235
+ 6689 4237 5665 4243 6433 4245 5409 4249 4897 4259 6305 4261 5281 4265 4769
+ 4273 4513 4291 6241 4293 5217 4297 4705 4305 4449 4359 7185 4363 6673 4365
+ 5649 4371 6417 4373 5393 4377 4881 4387 6289 4389 5265 4393 4753 4401 4497
+ 4419 6225 4421 5201 4425 4689 4483 6193 4485 5169 4489 4657 4615 7177 4619
+ 6665 4621 5641 4627 6409 4629 5385 4633 4873 4643 6281 4645 5257 4649 4745
+ 4675 6217 4677 5193 4739 6185 4741 5161 4867 6169 4869 5145 5127 7173 5131
+ 6661 5133 5637 5139 6405 5141 5381 5155 6277 5157 5253 5187 6213 5251 6181
+ 5379 6165 5635 6157 6151 7171 6155 6659 6163 6403 6179 6275 6211 5189 4681
+ 4433 4321 3142 2634 2386 2274 1612 1364 1252 856 744 496
] def
/tab213 [
- 3 6144 5 5120 6 3072 9 4608 10 2560 12 1536 17 4352 18
- 2304 20 1280 24 768 33 4224 34 2176 36 1152 40 640 48 384
- 65 4160 66 2112 68 1088 72 576 80 320 96 192 129 4128 130
- 2080 132 1056 136 544 144 288 257 4112 258 2064 260 1040 264 528
- 513 4104 514 2056 516 1032 1025 4100 1026 2052 2049 4098 4097 2050 1028
+ 3 6144 5 5120 6 3072 9 4608 10 2560 12 1536 17 4352 18
+ 2304 20 1280 24 768 33 4224 34 2176 36 1152 40 640 48 384
+ 65 4160 66 2112 68 1088 72 576 80 320 96 192 129 4128 130
+ 2080 132 1056 136 544 144 288 257 4112 258 2064 260 1040 264 528
+ 513 4104 514 2056 516 1032 1025 4100 1026 2052 2049 4098 4097 2050 1028
520 272 160
] def
@@ -7244,7 +7559,7 @@
0 1 9 {
/i exch def
codewords i get dup 1286 le {
- tab513 exch get
+ tab513 exch get
} {
tab213 exch 1287 sub get
} ifelse
@@ -7275,7 +7590,7 @@
4 7 7 5 0 12 1 11 2 9 9 0 6 8 5 3 3 10 8 2
] def
- /bbs 65 array def
+ /bbs 65 array def
/bhs 65 array def
0 1 64 {
/i exch def
@@ -7287,18 +7602,18 @@
} if
dec not asc and {
bbs i 3 height mul 8 div put
- bhs i 5 height mul 8 div put
+ bhs i 5 height mul 8 div put
} if
dec asc not and {
bbs i 0 height mul 8 div put
- bhs i 5 height mul 8 div put
+ bhs i 5 height mul 8 div put
} if
dec asc and {
bbs i 0 height mul 8 div put
- bhs i 8 height mul 8 div put
+ bhs i 8 height mul 8 div put
} if
} for
-
+
% Return the arguments
<<
/ren //renlinear
@@ -7331,7 +7646,7 @@
% --EXAM: 01234
% --EXOP: includetext includecheckintext
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp postnet 0.0 2014013000 67140 70346
+%%BeginResource: uk.co.terryburton.bwipp postnet 0.0 2014121100 67140 66826
%%BeginData: 140 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -7353,7 +7668,7 @@
/textsize 10 def
/textyoffset -7 def
/height 0.125 def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -7364,12 +7679,12 @@
currentdict end /options exch def
} if
options {def} forall
-
+
/textfont textfont cvlit def
/textsize textsize cvr def
/textyoffset textyoffset cvr def
/height height cvr def
-
+
/barlen barcode length validatecheck {1 sub} if def
% Validate the input
@@ -7436,14 +7751,14 @@
/j exch def
heights j enc j 1 getinterval cvi height mul 5 div put
} for
- bhs barlen 5 mul 1 add heights putinterval
-
+ bhs barlen 5 mul 1 add heights putinterval
+
includecheckintext {
txt barlen [barchars checksum 1 getinterval barlen 5 mul 1 add 3.312 mul textyoffset textfont textsize] put
} {
txt barlen [( ) barlen 5 mul 1 add 72 mul 25 div textyoffset textfont textsize] put
} ifelse
-
+
% Put end character
/enc encs 11 get def
/heights enc length array def
@@ -7451,7 +7766,7 @@
/j exch def
heights j enc j 1 getinterval cvi height mul 5 div put
} for
- bhs barlen 5 mul 6 add heights putinterval
+ bhs barlen 5 mul 6 add heights putinterval
% Return the arguments
<<
@@ -7483,7 +7798,7 @@
% --EXAM: 01234567890
% --EXOP: includetext includecheckintext
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp planet 0.0 2014013000 67000 70210
+%%BeginResource: uk.co.terryburton.bwipp planet 0.0 2014121100 67000 66690
%%BeginData: 141 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -7505,7 +7820,7 @@
/textsize 10 def
/textyoffset -7 def
/height 0.125 def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -7516,7 +7831,7 @@
currentdict end /options exch def
} if
options {def} forall
-
+
/textfont textfont cvlit def
/textsize textsize cvr def
/textyoffset textyoffset cvr def
@@ -7589,14 +7904,14 @@
/j exch def
heights j enc j 1 getinterval cvi height mul 5 div put
} for
- bhs barlen 5 mul 1 add heights putinterval
-
+ bhs barlen 5 mul 1 add heights putinterval
+
includecheckintext {
txt barlen [barchars checksum 1 getinterval barlen 5 mul 1 add 3.312 mul textyoffset textfont textsize] put
} {
txt barlen [( ) barlen 5 mul 1 add 72 mul 25 div textyoffset textfont textsize] put
} ifelse
-
+
% Put end character
/enc encs 11 get def
/heights enc length array def
@@ -7604,7 +7919,7 @@
/j exch def
heights j enc j 1 getinterval cvi height mul 5 div put
} for
- bhs barlen 5 mul 6 add heights putinterval
+ bhs barlen 5 mul 6 add heights putinterval
% Return the arguments
<<
@@ -7636,7 +7951,7 @@
% --EXAM: LE28HS9Z
% --EXOP: includetext barcolor=FF0000
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp royalmail 0.0 2014013000 67811 71080
+%%BeginResource: uk.co.terryburton.bwipp royalmail 0.0 2014121100 67915 67664
%%BeginData: 145 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -7658,7 +7973,7 @@
/textsize 10 def
/textyoffset -7 def
/height 0.175 def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -7669,7 +7984,7 @@
currentdict end /options exch def
} if
options {def} forall
-
+
/textfont textfont cvlit def
/textsize textsize cvr def
/textyoffset textyoffset cvr def
@@ -7695,7 +8010,7 @@
/i exch def
/indx charvals barcode i 1 getinterval get def
/checksumrow checksumrow indx 6 idiv add def
- /checksumcol checksumcol indx 6 mod add def
+ /checksumcol checksumcol indx 6 mod add def
} for
/checksum checksumrow 6 mod 6 mul checksumcol 6 mod add def
validatecheck {
@@ -7707,12 +8022,12 @@
% Create an array containing the character mappings
/encs
- [ (3300) (2211) (2301) (2310) (3201) (3210)
- (1122) (0033) (0123) (0132) (1023) (1032)
- (1302) (0213) (0303) (0312) (1203) (1212)
- (1320) (0231) (0321) (0330) (1221) (1230)
- (3102) (2013) (2103) (2112) (3003) (3012)
- (3120) (2031) (2121) (2130) (3021) (3030)
+ [ (3300) (2211) (2301) (2310) (3201) (3210)
+ (1122) (0033) (0123) (0132) (1023) (1032)
+ (1302) (0213) (0303) (0312) (1203) (1212)
+ (1320) (0231) (0321) (0330) (1221) (1230)
+ (3102) (2013) (2103) (2112) (3003) (3012)
+ (3120) (2031) (2121) (2130) (3021) (3030)
(2) (3)
] def
@@ -7721,7 +8036,7 @@
% Put start character
encstr 0 encs 36 get putinterval
-
+
0 1 barlen 1 sub {
/i exch def
/indx charvals barcode i 1 getinterval get def
@@ -7736,11 +8051,11 @@
} {
txt barlen [( ) barlen 4 mul 1 add 3.312 mul textyoffset textfont textsize] put
} ifelse
-
+
% Put end character
- encstr barlen 4 mul 5 add encs 37 get putinterval
-
- /bbs encstr length array def
+ encstr barlen 4 mul 5 add encs 37 get putinterval
+
+ /bbs encstr length array def
/bhs encstr length array def
0 1 encstr length 1 sub {
/i exch def
@@ -7762,7 +8077,7 @@
bhs i 8 height mul 8 div put
} if
} for
-
+
% Return the arguments
<<
/ren //renlinear
@@ -7793,7 +8108,7 @@
% --EXAM: 5956439111ABA 9
% --EXOP: includetext custinfoenc=character
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp auspost 0.0 2014013000 78831 81870
+%%BeginResource: uk.co.terryburton.bwipp auspost 0.0 2014121100 78727 78454
%%BeginData: 202 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -7814,7 +8129,7 @@
/textyoffset -7 def
/height 0.175 def
/custinfoenc (character) def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -7825,7 +8140,7 @@
currentdict end /options exch def
} if
options {def} forall
-
+
/textfont textfont cvlit def
/textsize textsize cvr def
/textyoffset textyoffset cvr def
@@ -7847,7 +8162,7 @@
% Create a string of the available characters
/barchars (ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz #) def
-
+
/barlen barcode length def
barcode 0 2 getinterval (11) eq {37} if
barcode 0 2 getinterval (45) eq {37} if
@@ -7861,57 +8176,57 @@
% Encode the FCC
0 1 1 {
- /i exch def
+ /i exch def
encs barcode i 1 getinterval cvi 64 add get
encstr i 2 mul 2 add 3 2 roll putinterval
} for
-
+
% Encode the DPID
2 1 9 {
- /i exch def
+ /i exch def
encs barcode i 1 getinterval cvi 64 add get
encstr i 2 mul 2 add 3 2 roll putinterval
txt i 2 sub [barcode i 1 getinterval i 2 sub 2 mul 6 add 3.312 mul textyoffset textfont textsize] put
} for
-
- % Encode the customer information
+
+ % Encode the customer information
custinfoenc (numeric) eq {
0 1 barlen 11 sub {
/i exch def
encs barcode i 10 add 1 getinterval cvi 64 add get
encstr i 2 mul 22 add 3 2 roll putinterval
txt i 8 add [barcode i 10 add 1 getinterval i 2 mul 22 add 3.312 mul textyoffset textfont textsize] put
- } for
+ } for
/ciflen barlen 10 sub 2 mul def
} {
0 1 barlen 11 sub {
- /i exch def
+ /i exch def
barcode i 10 add 1 getinterval barchars exch search
- pop
- length /indx exch def
- pop pop
- /enc encs indx get def
+ pop
+ length /indx exch def
+ pop pop
+ /enc encs indx get def
encstr i 3 mul 22 add enc putinterval
txt i 8 add [barcode i 10 add 1 getinterval i 3 mul 22 add 3.312 mul textyoffset textfont textsize] put
- } for
+ } for
/ciflen barlen 10 sub 3 mul def
} ifelse
% Add any filler characters
- 22 ciflen add 1 encstr length 14 sub {
+ 22 ciflen add 1 encstr length 14 sub {
encstr exch encs 75 get putinterval
} for
-
+
% Create the 64x64 Reed-Solomon table
/rstable 64 64 mul array def
rstable 0 [ 64 {0} repeat ] putinterval
rstable 64 [ 0 1 63 {} for ] putinterval
/prev 1 def
- 64 {
+ 64 {
/next prev 1 bitshift def
next 64 and 0 ne {
/next next 67 xor def
- } if
+ } if
0 1 63 {
/j exch def
/nextcell {rstable 64 next mul j add} def
@@ -7922,7 +8237,7 @@
} for
/prev next def
} repeat
-
+
% Calculate the Reed-Solomon codes for triples
/rscodes encstr length 16 sub 3 idiv 4 add array def
rscodes 0 [ 4 {0} repeat ] putinterval
@@ -7931,9 +8246,9 @@
rscodes rscodes length i 2 sub 3 idiv sub 1 sub
encstr i 1 getinterval cvi 16 mul
encstr i 1 add 1 getinterval cvi 4 mul add
- encstr i 2 add 1 getinterval cvi add
+ encstr i 2 add 1 getinterval cvi add
put
- } for
+ } for
rscodes length 5 sub -1 0 {
/i exch def
0 1 4 {
@@ -7949,12 +8264,12 @@
/enc rscodes 3 i sub get 4 3 string cvrs def
checkcode i 3 mul 3 enc length sub add enc putinterval
} for
-
+
% Put checkcode and end characters
encstr encstr length 14 sub checkcode putinterval
- encstr encstr length 2 sub encs 74 get putinterval
-
- /bbs encstr length array def
+ encstr encstr length 2 sub encs 74 get putinterval
+
+ /bbs encstr length array def
/bhs encstr length array def
0 1 encstr length 1 sub {
/i exch def
@@ -7975,8 +8290,8 @@
bbs i 3 height mul 8 div put
bhs i 2 height mul 8 div put
} if
- } for
-
+ } for
+
% Return the arguments
<<
/ren //renlinear
@@ -8007,7 +8322,7 @@
% --EXAM: 1231FZ13XHS
% --EXOP: includetext
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp kix 0.0 2014013000 63161 62955
+%%BeginResource: uk.co.terryburton.bwipp kix 0.0 2014121100 63057 62851
%%BeginData: 111 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -8027,7 +8342,7 @@
/textsize 10 def
/textyoffset -7 def
/height 0.175 def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -8038,20 +8353,20 @@
currentdict end /options exch def
} if
options {def} forall
-
+
/textfont textfont cvlit def
/textsize textsize cvr def
/textyoffset textyoffset cvr def
/height height cvr def
-
+
% Create an array containing the character mappings
/encs
[ (0033) (0123) (0132) (1023) (1032) (1122)
- (0213) (0303) (0312) (1203) (1212) (1302)
+ (0213) (0303) (0312) (1203) (1212) (1302)
(0231) (0321) (0330) (1221) (1230) (1320)
(2013) (2103) (2112) (3003) (3012) (3102)
- (2031) (2121) (2130) (3021) (3030) (3120)
- (2211) (2301) (2310) (3201) (3210) (3300)
+ (2031) (2121) (2130) (3021) (3030) (3120)
+ (2211) (2301) (2310) (3201) (3210) (3300)
] def
% Create a string of the available characters
@@ -8069,7 +8384,7 @@
/barlen barcode length def
/encstr barlen 4 mul string def
/txt barlen array def
-
+
0 1 barlen 1 sub {
/i exch def
/indx charvals barcode i 1 getinterval get def
@@ -8077,7 +8392,7 @@
txt i [barcode i 1 getinterval i 4 mul 3.312 mul textyoffset textfont textsize] put
} for
- /bbs encstr length array def
+ /bbs encstr length array def
/bhs encstr length array def
0 1 encstr length 1 sub {
/i exch def
@@ -8099,7 +8414,7 @@
bhs i 8 height mul 8 div put
} if
} for
-
+
% Return the arguments
<<
/ren //renlinear
@@ -8130,7 +8445,7 @@
% --EXAM: 6540123789-A-K-Z
% --EXOP: includetext includecheckintext
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp japanpost 0.0 2014013000 67972 71212
+%%BeginResource: uk.co.terryburton.bwipp japanpost 0.0 2014121100 68076 67796
%%BeginData: 162 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -8151,7 +8466,7 @@
/textsize 10 def
/textyoffset -7 def
/height 0.175 def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -8162,24 +8477,24 @@
currentdict end /options exch def
} if
options {def} forall
-
+
/textfont textfont cvlit def
/textsize textsize cvr def
/textyoffset textyoffset cvr def
/height height cvr def
-
+
% Create an array containing the character mappings
% 0123456789- C1C2C3C4C5C6C7C8 ST EN
/encs
[ (300) (330) (312) (132) (321) (303) (123) (231) (213) (033) (030)
- (120) (102) (210) (012) (201) (021) (003) (333)
+ (120) (102) (210) (012) (201) (021) (003) (333)
(31) (13)
] def
% Create a string of the available characters
/barchars (0123456789-ABCDEFGHIJKLMNOPQRSTUVWXYZ) def
/barlen barcode length def
-
+
/encstr 20 1 add 3 mul 4 add string def
/digits 20 array def
/txt barlen 1 add array def
@@ -8304,7 +8619,7 @@
% --EXAM: 0123456789
% --EXOP: includetext includecheck includecheckintext
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp msi 0.0 2014013000 73119 76565
+%%BeginResource: uk.co.terryburton.bwipp msi 0.0 2014121100 73223 72733
%%BeginData: 139 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -8328,7 +8643,7 @@
/textsize 10 def
/textyoffset -7 def
/height 1 def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -8339,12 +8654,12 @@
currentdict end /options exch def
} if
options {def} forall
-
+
/textfont textfont cvlit def
/textsize textsize cvr def
/textyoffset textyoffset cvr def
/height height cvr def
-
+
% Create an array containing the character mappings
/encs
[ (12121212) (12121221) (12122112) (12122121) (12211212)
@@ -8360,7 +8675,7 @@
/mod10 {
/code exch def
- 0 0 code {48 sub exch 10 mul add exch} forall pop 2 mul
+ 0 0 code {48 sub exch 10 mul add exch} forall pop 2 mul
0 {1 index 10 mod add exch 10 idiv dup 0 eq {pop exit} if exch} loop
0 0 code {48 sub add exch} forall exch pop add
10 mod 10 exch sub 10 mod
@@ -8370,7 +8685,7 @@
/mod11 {
/code exch def
code length 1 sub code {48 sub exch dup 1 sub exch 6 mod 2 add exch} forall pop
- 0 code length {3 1 roll mul add} repeat
+ 0 code length {3 1 roll mul add} repeat
11 mod 11 exch sub 11 mod
dup 10 eq badmod11 and {
pop code length 2 add string dup 0 code putinterval dup code length (10) putinterval
@@ -8382,7 +8697,7 @@
/ncrmod11 {
/code exch def
code length 1 sub code {48 sub exch dup 1 sub exch 8 mod 2 add exch} forall pop
- 0 code length {3 1 roll mul add} repeat
+ 0 code length {3 1 roll mul add} repeat
11 mod 11 exch sub 11 mod
dup 10 eq badmod11 and {
pop code length 2 add string dup 0 code putinterval dup code length (10) putinterval
@@ -8455,7 +8770,7 @@
% --EXAM: 01234ABCD
% --EXOP: includetext includecheckintext
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp plessey 0.0 2014013000 69509 72964
+%%BeginResource: uk.co.terryburton.bwipp plessey 0.0 2014121100 69717 69236
%%BeginData: 146 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -8478,7 +8793,7 @@
/textsize 10 def
/textyoffset -7 def
/height 1 def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -8489,12 +8804,12 @@
currentdict end /options exch def
} if
options {def} forall
-
+
/textfont textfont cvlit def
/textsize textsize cvr def
/textyoffset textyoffset cvr def
/height height cvr def
-
+
% Create a string of the available characters
/barchars (0123456789ABCDEF) def
/charvals 16 dict def
@@ -8613,7 +8928,7 @@
% --EXAM: 123456
% --EXOP: numeric includetext
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp telepen 0.0 2014013000 70915 74443
+%%BeginResource: uk.co.terryburton.bwipp telepen 0.0 2014121100 71123 70715
%%BeginData: 173 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -8669,7 +8984,7 @@
length j add /j exch def
/barcode msg 0 j getinterval def
exit
- } ifelse
+ } ifelse
} loop
} if
@@ -8723,7 +9038,7 @@
{ % loop
i barlen eq {exit} if
numeric { % numeric mode: 00-99 & 0X-9X
- barcode i get 16 gt {
+ barcode i get 16 gt {
/np barcode i 2 getinterval def
np 1 1 getinterval (X) eq { % X in even position amongst digits
/indx np 0 1 getinterval cvi 17 add def
@@ -8798,7 +9113,7 @@
% --EXAM: ABC123
% --EXOP: version=b inkspread=-0.5 parsefnc includetext
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp posicode 0.0 2014013000 113148 115762
+%%BeginResource: uk.co.terryburton.bwipp posicode 0.0 2014121100 109732 109034
%%BeginData: 389 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -8863,15 +9178,15 @@
length j add /j exch def
/barcode msg 0 j getinterval def
exit
- } ifelse
+ } ifelse
} loop
} if
/barlen barcode length def
% Special function characters
- /la0 -1 def /la1 -2 def /la2 -3 def
- /sf0 -4 def /sf1 -5 def /sf2 -6 def
+ /la0 -1 def /la1 -2 def /la2 -3 def
+ /sf0 -4 def /sf1 -5 def /sf2 -6 def
/fn1 -7 def /fn2 -8 def /fn3 -9 def /fn4 -10 def
% Character maps for each state
@@ -8879,7 +9194,7 @@
/normal
[
% 0 1 2 0 1 2 0 1 2
- [ (0) (^) (') ] [ (1) (;) 27 ] [ (2) (<) 28 ] % 0-2
+ [ (0) (^) (') ] [ (1) (;) 27 ] [ (2) (<) 28 ] % 0-2
[ (3) (=) 29 ] [ (4) (>) 30 ] [ (5) (?) 31 ] % 3-5
[ (6) (@) (!) ] [ (7) ([) (") ] [ (8) 92 (#) ] % 6-8
[ (9) (]) (&) ] [ (A) (a) 1 ] [ (B) (b) 2 ] % 9-11
@@ -8912,8 +9227,8 @@
[ (X) -98 -98 ] [ (Y) -98 -98 ] [ (Z) -98 -98 ] % 33-35
[ (-) -98 -98 ] [ (.) -98 -98 ] % 36-37
]
- >>
- version (a) eq version (b) eq or {/normal} {/limited} ifelse get
+ >>
+ version (a) eq version (b) eq or {/normal} {/limited} ifelse get
/charmaps exch def
% Invert charmaps to give character to value maps for each state
@@ -8926,7 +9241,7 @@
0 1 2 {
/j exch def
encs j get dup type /stringtype eq {0 get} if % convert string to ASCII if required
- charvals j get exch i put
+ charvals j get exch i put
} for
} for
/set0 charvals 0 get def
@@ -8949,7 +9264,7 @@
/text () def
} if
- encoding (auto) eq {
+ encoding (auto) eq {
/fncvals <<
(FNC1) fn1
@@ -8958,7 +9273,7 @@
(FNC4) fn4
>> def
- % Convert input into bytes accounting for FNC characters
+ % Convert input into bytes accounting for FNC characters
/msg barlen array def
/text barlen string def
/i 0 def /j 0 def {
@@ -8992,7 +9307,7 @@
/i 0 def /j 0 def /cset (set0) def
{
i msglen eq {exit} if
-
+
{ % common exit
% Read next two characters
@@ -9000,7 +9315,7 @@
/char2 i 1 add msglen lt {msg i 1 add get} {-99} ifelse def
% If current mode is sufficient then directly encode
- cset load char1 known {
+ cset load char1 known {
char1 cset load enc
/i i 1 add def
exit
@@ -9012,7 +9327,7 @@
char1 set2 enc
/i i 1 add def
exit
- } if
+ } if
% If char2 is also not in this set then latch else shift encode
cset load char2 known not {
@@ -9024,21 +9339,21 @@
/cset (set0) def
} ifelse
exit
- } {
+ } {
cset (set0) eq {
sf1 cset load enc
char1 set1 enc
} {
sf0 cset load enc
char1 set0 enc
- } ifelse
+ } ifelse
/i i 1 add def
exit
} ifelse
exit
} loop
-
+
} loop
/cws cws 0 j getinterval def
} if % auto encoding
@@ -9095,7 +9410,7 @@
/c2w [
[ 495 330 210 126 70 35 15 5 ]
[ 165 120 84 56 35 20 10 4 ]
- [ 45 36 28 21 15 10 6 3 ]
+ [ 45 36 28 21 15 10 6 3 ]
[ 9 8 7 6 5 4 3 2 ]
[ 1 1 1 1 1 1 1 1 ]
] def
@@ -9108,7 +9423,7 @@
} if
/v v -1 bitshift def
/cw cw -1 bitshift def
- } repeat
+ } repeat
} forall
/v v checkoffset add def
@@ -9116,7 +9431,7 @@
/v v 1023 and def
v 824 gt v 853 lt and {
/v v 292 add def
- } if
+ } if
} {
/v v 1023 and 45 add def
} ifelse
@@ -9144,7 +9459,7 @@
} loop
20 0 1 4 {d exch get sub} for
d exch 5 exch put
- version (b) eq version (limitedb) eq or {
+ version (b) eq version (limitedb) eq or {
/d [ d {1 add} forall ] def
} if
/cbs (111111111111) 12 string copy def
@@ -9155,8 +9470,8 @@
% Concatenate the space bar successions
/sbs cws length 6 mul 31 add string def
- encs encs length 2 sub get dup
- sbs exch 0 exch putinterval
+ encs encs length 2 sub get dup
+ sbs exch 0 exch putinterval
length /j exch def
0 1 cws length 1 sub {
/i exch def
@@ -9199,7 +9514,7 @@
% --EXAM: CODABLOCK F 34567890123456789010040digit
% --EXOP: columns=8
% --RNDR: renmatrix
-%%BeginResource: uk.co.terryburton.bwipp codablockf 0.0 2014013000 139631 148959
+%%BeginResource: uk.co.terryburton.bwipp codablockf 0.0 2014121100 136007 135295
%%BeginData: 512 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -9238,7 +9553,7 @@
/rowheight rowheight cvi def
/sepheight sepheight cvi def
- columns 4 ge columns 62 le and
+ columns 4 ge columns 62 le and
rows 2 ge rows 44 le and rows -1 eq or and {/c columns def} if
% Parse ordinals of the form ^NNN to ASCII
@@ -9258,13 +9573,13 @@
length j add /j exch def
/barcode msg 0 j getinterval def
exit
- } ifelse
+ } ifelse
} loop
} if
/barlen barcode length def
- % Convert input into bytes accounting for FNC characters
+ % Convert input into bytes accounting for FNC characters
/swa -1 def /swb -2 def /swc -3 def /sft -4 def
/fn1 -5 def /fn2 -6 def /fn3 -7 def /fn4 -8 def
/sta -9 def /stp -10 def
@@ -9272,7 +9587,7 @@
% Character maps for each state
/charmaps [
% A B C A B C A B C
- [ 32 32 (00) ] [ (!) (!) (01) ] [ (") (") (02) ] % 0-2
+ [ 32 32 (00) ] [ (!) (!) (01) ] [ (") (") (02) ] % 0-2
[ (#) (#) (03) ] [ ($) ($) (04) ] [ (%) (%) (05) ] % 3-5
[ (&) (&) (06) ] [ (') (') (07) ] [ 40 40 (08) ] % 6-8
[ 41 41 (09) ] [ (*) (*) (10) ] [ (+) (+) (11) ] % 9-11
@@ -9308,7 +9623,7 @@
[ swc swc (99) ] [ swb fn4 swb ] [ fn4 swa swa ] % 99-101
[ fn1 fn1 fn1 ] [ sta sta sta ] [ stp stp stp ] % 102-104
] def
-
+
% Invert charmaps to give character to value maps for each state
/charvals [ 105 dict 105 dict 105 dict ] def
0 1 charmaps length 1 sub {
@@ -9317,13 +9632,13 @@
0 1 2 {
/j exch def
encs j get dup type /stringtype eq {0 get} if % convert string to ASCII if required
- charvals j get exch i put
+ charvals j get exch i put
} for
} for
/seta charvals 0 get def
/setb charvals 1 get def
/setc charvals 2 get def
-
+
/fncvals <<
(FNC1) fn1
(FNC2) fn2
@@ -9427,7 +9742,7 @@
/i 0 def /j 0 def /r 1 def
/lastrow false def {
-
+
lastrow {exit} if
% Add start character and code subset selector
@@ -9444,11 +9759,11 @@
/cset (setc) def
exit
} if
- i abeforeb {
+ i abeforeb {
sft enca
/cset (seta) def
- exit
- } if
+ exit
+ } if
swb enca
/cset (setb) def
exit
@@ -9460,12 +9775,12 @@
/rem c 3 add j c 5 add mod sub def % Codewords to end of row
i msglen eq endofrow or {exit} if
-
+
i numsscr /nums exch def /nchars exch def
% Determine switches and shifts
{ % common exit
- cset (seta) eq cset (setb) eq or nums 4 ge and
+ cset (seta) eq cset (setb) eq or nums 4 ge and
msg i get fn1 ne and {
nums 2 mod 0 eq
rem 3 ge and {
@@ -9500,10 +9815,10 @@
exit
} if
} if
- cset (setb) eq msg i get anotb and
- rem 2 ge and {
+ cset (setb) eq msg i get anotb and
+ rem 2 ge and {
i msglen 1 sub lt {
- i 1 add bbeforea {
+ i 1 add bbeforea {
sft encb
msg i get enca
/i i 1 add def
@@ -9547,7 +9862,7 @@
/i i 1 add def
exit
} if
-
+
% No switches or latches so try to encode
cset (seta) eq seta msg i get known and
rem 1 ge and {
@@ -9568,7 +9883,7 @@
/i i 1 add def
} {
msg i 2 getinterval encc
- /i i 2 add def
+ /i i 2 add def
} ifelse
exit
} if
@@ -9604,7 +9919,7 @@
26 1 63 {} for
] def
/cmap [ 0 1 85 {} for ] def
-
+
% Add symbol check characters to last row
/chkmsg msglen array def
/j 0 def
@@ -9669,7 +9984,7 @@
/sbs [
cws i c 5 add mul c 5 add getinterval {
encs exch get {48 sub} forall
- } forall
+ } forall
] def
mark
0 sbs {1 index 1 eq {{0}} {{1}} ifelse repeat} forall
@@ -9693,7 +10008,7 @@
rowheight {rowbits r 1 sub get aload pop} repeat
symwid sepheight mul {1} repeat
] def
-
+
% Return the arguments
<<
/ren //renmatrix
@@ -9723,7 +10038,7 @@
% --EXAM: Abcd-1234567890-wxyZ
% --EXOP:
% --RNDR: renmatrix
-%%BeginResource: uk.co.terryburton.bwipp code16k 0.0 2014013000 159804 175815
+%%BeginResource: uk.co.terryburton.bwipp code16k 0.0 2014121100 156180 158943
%%BeginData: 710 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -9784,23 +10099,23 @@
length j add /j exch def
/barcode msg 0 j getinterval def
exit
- } ifelse
+ } ifelse
} loop
} if
/barlen barcode length def
- % Convert input into bytes accounting for FNC characters
- /swa -1 def /swb -2 def /swc -3 def
- /sa1 -4 def /sb1 -5 def /sc1 -6 def
- /sa2 -7 def /sb2 -8 def /sc2 -9 def
+ % Convert input into bytes accounting for FNC characters
+ /swa -1 def /swb -2 def /swc -3 def
+ /sa1 -4 def /sb1 -5 def /sc1 -6 def
+ /sa2 -7 def /sb2 -8 def /sc2 -9 def
/pad -10 def /sb3 -11 def /sc3 -12 def
/fn1 -13 def /fn2 -14 def /fn3 -15 def /fn4 -16 def
% Character maps for each state
/charmaps [
% A B C A B C A B C
- [ 32 32 (00) ] [ (!) (!) (01) ] [ (") (") (02) ] % 0-2
+ [ 32 32 (00) ] [ (!) (!) (01) ] [ (") (") (02) ] % 0-2
[ (#) (#) (03) ] [ ($) ($) (04) ] [ (%) (%) (05) ] % 3-5
[ (&) (&) (06) ] [ (') (') (07) ] [ 40 40 (08) ] % 6-8
[ 41 41 (09) ] [ (*) (*) (10) ] [ (+) (+) (11) ] % 9-11
@@ -9836,8 +10151,8 @@
[ swc swc (99) ] [ swb fn4 swb ] [ fn4 swa swa ] % 99-101
[ fn1 fn1 fn1 ] [ pad pad pad ] [ sb2 sa2 sb1 ] % 102-104
[ sc2 sc2 sb2 ] [ sc3 sc3 sb3 ] % 105-106
- ] def
-
+ ] def
+
% Invert charmaps to give character to value maps for each state
/charvals [ 109 dict 109 dict 109 dict ] def
0 1 charmaps length 1 sub {
@@ -9846,7 +10161,7 @@
0 1 2 {
/j exch def
encs j get dup type /stringtype eq {0 get} if % convert string to ASCII if required
- charvals j get exch i put
+ charvals j get exch i put
} for
} for
/seta charvals 0 get def
@@ -9869,7 +10184,7 @@
/text () def
} if
- encoding (auto) eq {
+ encoding (auto) eq {
/fncvals <<
(FNC1) fn1
@@ -9895,7 +10210,7 @@
} loop
/msg msg 0 j getinterval def
/msglen msg length def
-
+
% Determine digit runlength and characters from given position
/numsscr {
/n 0 def /s 0 def
@@ -9957,9 +10272,9 @@
% Does a-only come before b-only after given position and vice versa
/abeforeb {dup nextanotb exch get exch nextbnota exch get lt} bind def
/bbeforea {dup nextbnota exch get exch nextanotb exch get lt} bind def
-
+
/cws barcode length 2 mul 3 add array def
-
+
% Select mode and encode first characters
/i 0 def /j 0 def
{ % common exit
@@ -9967,7 +10282,7 @@
pos -1 ne {
% encode one and two
cws 0 pos 10 idiv 1 sub put
- cws 1 pos 10 mod 1 sub put
+ cws 1 pos 10 mod 1 sub put
/j 2 def
/cset (setb) def
/mode 7 def
@@ -10019,7 +10334,7 @@
/i 1 def
exit
} if
- % b . 3+ odd nums => c sb2 encode
+ % b . 3+ odd nums => c sb2 encode
setb msg 0 get known
1 numsscr exch pop dup 3 ge exch 2 mod 1 eq and and {
msg 0 get encb
@@ -10055,9 +10370,9 @@
{ % Encode remainder
i msglen eq {exit} if
-
+
i numsscr /nums exch def /nchars exch def
-
+
% Determine switches and shifts
{ % common exit
cset (seta) eq {
@@ -10091,7 +10406,7 @@
} if
% 4 nums . a => sc2 encode
i msglen 4 sub lt {
- nums 4 eq
+ nums 4 eq
seta msg i 4 add get known and {
sc2 enca
2 {
@@ -10100,15 +10415,15 @@
/i i 1 add def
} {
msg i 2 getinterval encc
- /i i 2 add def
+ /i i 2 add def
} ifelse
} repeat
exit
} if
} if
% 6 nums . a => sc3 encode
- i msglen 6 sub lt {
- nums 6 eq
+ i msglen 6 sub lt {
+ nums 6 eq
seta msg i 6 add get known and {
sc3 enca
3 {
@@ -10147,7 +10462,7 @@
} if
% anotb . anotb . bnota before anotb => sa2 encode
i msglen 2 sub lt {
- msg i get anotb
+ msg i get anotb
msg i 1 add get anotb and
i 2 add bbeforea and {
sa2 encb
@@ -10206,7 +10521,7 @@
% otherwise => encode
msg i get encb
/i i 1 add def
- exit
+ exit
} if
cset (setc) eq {
% 2+ nums => encode
@@ -10268,7 +10583,7 @@
} if
% b . b . b . 2+ even nums => sb3 encode
i msglen 3 sub lt {
- setb msg i get known
+ setb msg i get known
setb msg i 1 add get known and
setb msg i 2 add get known and
i 3 add numsscr exch pop dup 2 ge exch 2 mod 0 eq and and {
@@ -10277,7 +10592,7 @@
msg i 1 add get encb
msg i 2 add get encb
/i i 3 add def
- exit
+ exit
} if
} if
% anotb before bnota => swa
@@ -10293,13 +10608,13 @@
} if
exit
} loop
-
+
} loop
/cws cws 0 j getinterval def
} if % auto encoding
-
+
% Basic metrics for the each symbol
- % r dcws
+ % r dcws
/metrics [
[ 2 7 ]
[ 3 12 ]
@@ -10339,9 +10654,9 @@
/cws [ r 2 sub 7 mul mode add cws aload pop ] def
% Calculate the check characters
- 0 0 1 dcws {dup 2 add exch cws exch get mul add} for
+ 0 0 1 dcws {dup 2 add exch cws exch get mul add} for
107 mod /c1 exch def
- 0 0 1 dcws {dup 1 add exch cws exch get mul add} for
+ 0 0 1 dcws {dup 1 add exch cws exch get mul add} for
c1 dcws 2 add mul add 107 mod /c2 exch def
/cws [ cws aload pop c1 c2 ] def
@@ -10366,7 +10681,7 @@
] def
% Start/stop character encodings
- /startencs [
+ /startencs [
(3211) (2221) (2122) (1411) (1132) (1231) (1114) (3112)
(3211) (2221) (2122) (1411) (1132) (1231) (1114) (3112)
] def
@@ -10383,7 +10698,7 @@
} {
/stopencs stopencseven def
} ifelse
-
+
% Derive the bits for each row
/rowbits r array def
0 1 r 1 sub {
@@ -10394,7 +10709,7 @@
1
cws i 5 mul 5 getinterval {
encs exch get {48 sub} forall
- } forall
+ } forall
stopencs i get {48 sub} forall
1
] def
@@ -10415,7 +10730,7 @@
rowheight {rowbits r 1 sub get aload pop} repeat
81 sepheight mul {1} repeat
] def
-
+
% Return the arguments
<<
/ren //renmatrix
@@ -10445,7 +10760,7 @@
% --EXAM: MULTIPLE ROWS IN CODE 49
% --EXOP:
% --RNDR: renmatrix
-%%BeginResource: uk.co.terryburton.bwipp code49 0.0 2014013000 274315 290531
+%%BeginResource: uk.co.terryburton.bwipp code49 0.0 2014121100 264067 280283
%%BeginData: 1076 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -10502,13 +10817,13 @@
length j add /j exch def
/barcode msg 0 j getinterval def
exit
- } ifelse
+ } ifelse
} loop
} if
/barlen barcode length def
- % Convert input into bytes accounting for FNC characters
+ % Convert input into bytes accounting for FNC characters
/s1 -1 def /s2 -2 def /fn1 -3 def /fn2 -4 def /fn3 -5 def /ns -6 def
/fncvals <<
(FNC1) fn1
@@ -10547,9 +10862,9 @@
/charvals 49 dict def
0 1 48 {
/i exch def
- charmap i get
+ charmap i get
dup type /stringtype eq {0 get} if % convert string to ASCII if required
- charvals exch i put
+ charvals exch i put
} for
% Shifted character encodings
@@ -10632,17 +10947,17 @@
/method (alpha) def /i -1 def /j -1 def
% Handle start for each mode
- mode 0 eq mode 1 eq or {/method (alpha) def /i 0 def /j 0 def} if
+ mode 0 eq mode 1 eq or {/method (alpha) def /i 0 def /j 0 def} if
mode 2 eq {/method (numeric) def /i 0 def /j 0 def} if
mode 3 eq {
- /posval [
+ /posval [
12 22
13 23 33
14 24 34 44
15 25 35 45 55
16 26 36 46 56 66
- 17 27 37 47 57 67 77
- 18 28 38 48 58 68 78 88
+ 17 27 37 47 57 67 77
+ 18 28 38 48 58 68 78 88
19 29 39 49 59 69 79 89 99
] def
cws 0 0 1 43 {dup posval exch get pos ne {pop} if} for 1 add put
@@ -10682,7 +10997,7 @@
/cws cws 0 j getinterval def
% Basic metrics for the each symbol
- % r dcws
+ % r dcws
/metrics [
[ 2 9 ]
[ 3 16 ]
@@ -10716,7 +11031,7 @@
0 1 r 2 sub {
/i exch def
/cc cws j 7 getinterval def
- ccs i 8 mul cc putinterval
+ ccs i 8 mul cc putinterval
ccs i 8 mul 7 add 0 cc {add} forall 49 mod put
/j j 7 add def
} for
@@ -10739,7 +11054,7 @@
/score 0 def
0 1 r 1 sub 8 mul 2 idiv 1 sub {
/i exch def
- ccs i 2 mul get 49 mul ccs i 2 mul 1 add get add
+ ccs i 2 mul get 49 mul ccs i 2 mul 1 add get add
weights i 1 add get mul /score exch score add def
} for
score
@@ -10755,10 +11070,10 @@
/wr1 lastrow 0 get 49 mul lastrow 1 get add def
% wr2 check character
- cr7 weighty 0 get mul weighty calccheck add
+ cr7 weighty 0 get mul weighty calccheck add
wr1 weighty r 4 mul 3 sub get mul add
2401 mod dup /wr2 exch def
- dup 49 idiv exch 49 mod 2 array astore
+ dup 49 idiv exch 49 mod 2 array astore
lastrow 2 3 -1 roll putinterval
% wr3 check character
@@ -10766,7 +11081,7 @@
wr1 weightx r 4 mul 3 sub get mul add
wr2 weightx r 4 mul 2 sub get mul add
2401 mod
- dup 49 idiv exch 49 mod 2 array astore
+ dup 49 idiv exch 49 mod 2 array astore
lastrow 4 3 -1 roll putinterval
% Place last row check character
@@ -11531,9 +11846,9 @@
% --REQUIRES preamble raiseerror renlinear--
% --DESC: Channel Code
% --EXAM: 3493
-% --EXOP: height=0.5 includetext
+% --EXOP: height=0.5 includetext
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp channelcode 0.0 2014013000 70159 73500
+%%BeginResource: uk.co.terryburton.bwipp channelcode 0.0 2014121100 70263 69772
%%BeginData: 149 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -11552,7 +11867,7 @@
/includetext false def
/includecheck false def
/height 1 def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -11595,13 +11910,13 @@
dup 3 index le {
b 2 index 4 index put
value target eq {
- /out [
+ /out [
3 1 10 {dup s exch get exch b exch get} for
- ] 0 chan 2 mul getinterval def
+ ] 0 chan 2 mul getinterval def
} if
/value value 1 add def
} if
- } ifelse
+ } ifelse
pop pop pop pop
} bind def
@@ -11694,7 +12009,7 @@
% --EXAM: 11099
% --EXOP: inkspread=-0.25 showborder borderleft=0 borderright=0
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp flattermarken 0.0 2014013000 59859 59663
+%%BeginResource: uk.co.terryburton.bwipp flattermarken 0.0 2014121100 59859 59559
%%BeginData: 93 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -11799,7 +12114,7 @@
% --EXAM: 331132131313411122131311333213114131131221323
% --EXOP: height=0.5
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp raw 0.0 2014013000 55565 55558
+%%BeginResource: uk.co.terryburton.bwipp raw 0.0 2014121100 55669 55558
%%BeginData: 52 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -11863,7 +12178,7 @@
% --EXAM: FATDAFTDAD
% --EXOP:
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp daft 0.0 2014013000 58923 58681
+%%BeginResource: uk.co.terryburton.bwipp daft 0.0 2014121100 58923 58681
%%BeginData: 76 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -11951,7 +12266,7 @@
% --EXAM: fima
% --EXOP: backgroundcolor=DD000011
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp symbol 0.0 2014013000 58527 58256
+%%BeginResource: uk.co.terryburton.bwipp symbol 0.0 2014121100 58527 58256
%%BeginData: 72 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -12001,13 +12316,13 @@
} bind
>> def
- % Valiate input
+ % Valiate input
symbols barcode known not {
- /bwipp.symbolUnknownSymbol (Unknown symbol name provided) //raiseerror exec
+ /bwipp.symbolUnknownSymbol (Unknown symbol name provided) //raiseerror exec
} if
symbols barcode get exec
-
+
% Return the arguments
<<
/ren //renlinear
@@ -12035,8 +12350,8 @@
% --EXAM: This is PDF417
% --EXOP:
% --RNDR: renmatrix
-%%BeginResource: uk.co.terryburton.bwipp pdf417 0.0 2014013000 138777 141653
-%%BeginData: 505 ASCII Lines
+%%BeginResource: uk.co.terryburton.bwipp pdf417 0.0 2014121100 196239 198381
+%%BeginData: 873 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
@@ -12055,6 +12370,7 @@
/columns 0 def
/rows 0 def
/rowmult 3 def
+ /encoding (auto) def
/ccc false def
/raw false def
/parse false def
@@ -12092,12 +12408,14 @@
length j add /j exch def
/barcode msg 0 j getinterval def
exit
- } ifelse
+ } ifelse
} loop
} if
+ raw {/encoding (raw) def} if
+
% Convert input into array of codewords
- raw {
+ encoding (raw) eq {
/datcws barcode length array def
/i 0 def /j 0 def
{ % loop
@@ -12108,54 +12426,419 @@
/j j 1 add def
} loop
/datcws datcws 0 j getinterval def
- } { % Simple autoencoder from input to codewords using byte mode
- /barlen barcode length def
- barlen 6 mod 0 eq {
- /datcws barlen 6 idiv 5 mul 1 add array def
- datcws 0 924 put
- } {
- /datcws barlen 6 idiv 5 mul barlen 6 mod add 1 add array def
- datcws 0 901 put
- } ifelse
-
- % Rebase groups of 6 bytes splitting into 3 byte chunks
- 0 1 barlen 6 idiv 1 sub {
- /i exch def
- /msbs [ barcode i 6 mul 3 getinterval {} forall ] def
+ } if
+
+ /barcode [ barcode {} forall ] def
+ /barlen barcode length def
+
+ ccc {/encoding (ccc) def} if
+
+ /encb {
+ /in exch def
+ /inlen in length def
+ /out inlen 6 idiv 5 mul inlen 6 mod add array def
+ 0 1 inlen 6 idiv 1 sub {
+ /k exch def
+ /msbs [ in k 6 mul 3 getinterval aload pop ] def
/mscs [
msbs aload pop exch 256 mul add exch 65536 mul add
3 {dup 900 mod exch 900 idiv} repeat
] def
- /lsbs [barcode i 6 mul 3 add 3 getinterval {} forall] def
+ /lsbs [ in k 6 mul 3 add 3 getinterval aload pop ] def
/lscs [
lsbs aload pop exch 256 mul add exch 65536 mul add
3 {dup 900 mod exch 900 idiv} repeat
] def
- /cws 5 array def
lscs 0 get mscs 0 get 316 mul add
- cws 4 2 index 900 mod put
+ out k 5 mul 4 add 2 index 900 mod put
900 idiv lscs 1 get add mscs 0 get 641 mul add mscs 1 get 316 mul add
- cws 3 2 index 900 mod put
+ out k 5 mul 3 add 2 index 900 mod put
900 idiv lscs 2 get add mscs 0 get 20 mul add mscs 1 get 641 mul add mscs 2 get 316 mul add
- cws 2 2 index 900 mod put
+ out k 5 mul 2 add 2 index 900 mod put
900 idiv lscs 3 get add mscs 1 get 20 mul add mscs 2 get 641 mul add
- cws 1 2 index 900 mod put
+ out k 5 mul 1 add 2 index 900 mod put
900 idiv mscs 2 get 20 mul add
- cws 0 3 -1 roll 900 mod put
- datcws i 5 mul 1 add cws putinterval
+ out k 5 mul 3 -1 roll 900 mod put
} for
-
- % Add the remaining bytes to the end of the codewords
- /rem barlen 6 mod def
+ /rem inlen 6 mod def
rem 0 ne {
- datcws datcws length rem sub
- [ barcode barlen rem sub rem getinterval {} forall ]
+ out out length rem sub
+ [ in inlen rem sub rem getinterval aload pop ]
putinterval
} if
-
- ccc {/datcws [920 datcws aload pop] def} if
-
- } ifelse
+ out
+ } bind def
+
+ encoding (byte) eq encoding (ccc) eq or {
+ /datcws barlen 6 idiv 5 mul barlen 6 mod add 1 add array def
+ datcws 0 barlen 6 mod 0 eq {924} {901} ifelse put
+ datcws 1 barcode encb putinterval
+ encoding (ccc) eq {/datcws [920 datcws aload pop] def} if
+ } if
+
+ encoding (auto) eq {
+
+ % Modes and text submodes
+ /T 0 def /N 1 def /B 2 def
+ /A 0 def /L 1 def /M 2 def /P 3 def
+
+ % Special function characters for mode switching
+ /tl -1 def /nl -2 def /bl -3 def /bl6 -4 def /bs -5 def
+
+ % Special function characters for text mode
+ /al -6 def /ll -7 def /ml -8 def /pl -9 def /as -10 def /ps -11 def
+
+ % Character maps for each state
+ /charmaps [
+ % A L M P
+ [ (A) (a) (0) (;) ] % 0
+ [ (B) (b) (1) (<) ] % 1
+ [ (C) (c) (2) (>) ] % 2
+ [ (D) (d) (3) (@) ] % 3
+ [ (E) (e) (4) ([) ] % 4
+ [ (F) (f) (5) 92 ] % 5
+ [ (G) (g) (6) (]) ] % 6
+ [ (H) (h) (7) (_) ] % 7
+ [ (I) (i) (8) (`) ] % 8
+ [ (J) (j) (9) (~) ] % 9
+ [ (K) (k) (&) (!) ] % 10
+ [ (L) (l) 13 13 ] % 11
+ [ (M) (m) 9 9 ] % 12
+ [ (N) (n) (,) (,) ] % 13
+ [ (O) (o) (:) (:) ] % 14
+ [ (P) (p) (#) 10 ] % 15
+ [ (Q) (q) (-) (-) ] % 16
+ [ (R) (r) (.) (.) ] % 17
+ [ (S) (s) ($) ($) ] % 18
+ [ (T) (t) (/) (/) ] % 19
+ [ (U) (u) (+) (") ] % 20
+ [ (V) (v) (%) (|) ] % 21
+ [ (W) (w) (*) (*) ] % 22
+ [ (X) (x) (=) 40 ] % 23
+ [ (Y) (y) (^) 41 ] % 24
+ [ (Z) (z) pl (?) ] % 25
+ [ ( ) ( ) ( ) ({) ] % 26
+ [ ll as ll (}) ] % 27
+ [ ml ml al (') ] % 28
+ [ ps ps ps al ] % 29
+ ] def
+
+ % Invert charmaps to give character to value maps for each state
+ /charvals [ 30 dict 30 dict 30 dict 30 dict ] def
+ /alltext 104 dict def
+ 0 1 charmaps length 1 sub {
+ /i exch def
+ /encs charmaps i get def
+ 0 1 3 {
+ /j exch def
+ encs j get dup type /stringtype eq {0 get} if % convert string to ASCII if required
+ dup charvals j get exch i put
+ alltext exch -1 put
+ } for
+ } for
+
+ /e 10000 def % "Empty"
+
+ /latlen [ % Bit length of latch between submodes
+ % To: A L M P From
+ [ 0 1 1 2 ] % A
+ [ 2 0 1 2 ] % L
+ [ 1 1 0 1 ] % M
+ [ 1 2 2 0 ] % P
+ ] def
+
+ /latseq [ % Latch sequences between submodes
+ % To: A L M P From
+ [ [] [ll] [ml] [ml pl] ] % A
+ [ [ml al] [] [ml] [ml pl] ] % L
+ [ [al] [ll] [] [pl] ] % M
+ [ [al] [al ll] [al ml] [] ] % P
+ ] def
+
+ /shftlen [ % Bit length of shift to submode
+ % To: A L M P From
+ [ e e e 1 ] % A
+ [ 1 e e 1 ] % L
+ [ e e e 1 ] % M
+ [ e e e e ] % P
+ ] def
+
+ % Determine runlengths of digits
+ /numdigits [ barlen {0} repeat 0 ] def
+ /numtext [ barlen {0} repeat 0 ] def
+ /numbytes [ barlen {0} repeat 0 ] def
+ barlen 1 sub -1 0 {
+ /i exch def
+ barcode i get dup 48 ge exch 57 le and {
+ numdigits i numdigits i 1 add get 1 add put
+ } if
+ alltext barcode i get known numdigits i get 13 lt and {
+ numtext i numtext i 1 add get 1 add put
+ } if
+ numtext i get 5 lt numdigits i get 13 lt and {
+ numbytes i numbytes i 1 add get 1 add put
+ } if
+ } for
+ /numdigits numdigits 0 barlen getinterval def
+ /numtext numtext 0 barlen getinterval def
+ /numbytes numbytes 0 barlen getinterval def
+
+ /seq [] def /seqlen 0 def /state T def /p 0 def { % loop
+ p barlen eq {exit} if
+ /n numdigits p get def
+ n 13 ge {
+ /seq [
+ seq aload pop
+ nl
+ [ barcode p n getinterval aload pop ]
+ ] def
+ /state N def
+ /p p n add def
+ /seqlen seqlen 1 add n add def
+ } { % next
+ /t numtext p get def
+ t 5 ge {
+ /seq [
+ seq aload pop
+ state T ne {tl} if
+ [ barcode p t getinterval aload pop ]
+ ] def
+ /state T def
+ /p p t add def
+ /seqlen seqlen 1 add t add def % ish
+ } { % next
+ /b numbytes p get def
+ b 1 eq state T eq and {
+ /seq [
+ seq aload pop
+ bs
+ [ barcode p get ]
+ ] def
+ /p p b add def
+ /seqlen seqlen 2 add def
+ } { % next
+ /seq [
+ seq aload pop
+ b 6 mod 0 ne {bl} {bl6} ifelse
+ [ barcode p b getinterval aload pop ]
+ ] def
+ /state B def
+ /p p b add def
+ /seqlen seqlen 1 add b add def
+ } ifelse } ifelse } ifelse
+ } loop
+
+ /latchcws <<
+ tl 900 bl 901 bl6 924 nl 902 bs 913
+ >> def
+
+ % Submode encoding functions
+ /enca {charvals A get exch get} bind def
+ /encl {charvals L get exch get} bind def
+ /encm {charvals M get exch get} bind def
+ /encp {charvals P get exch get} bind def
+ /textencfuncs [ /enca /encl /encm /encp ] def
+
+ /addtotext {
+ text exch l exch put
+ /l l 1 add def
+ } bind def
+
+ /enct {
+
+ /in exch def
+
+ /curlen [ e e e e ] def
+ curlen submode 0 put
+ /curseq [ [] [] [] [] ] def
+
+ % Derive the optimal sequences ending in each submode
+ in {
+
+ /char exch def
+
+ % Check for optimisations in the current sequences by latching from x to y
+ { % loop
+ /imp false def
+ [ A L M P ] {
+ /x exch def
+ [ A L M P ] {
+ /y exch def
+ /cost curlen x get latlen x get y get add def
+ cost curlen y get lt {
+ curlen y cost put
+ curseq y [
+ curseq x get aload pop
+ latseq x get y get aload pop
+ ] put
+ /imp true def
+ } if
+ } forall
+ } forall
+ imp not {exit} if % Repeat unless no improvement
+ } loop
+
+ % Determine optimal next sequences for each valid encoding
+ /nxtlen [ e e e e ] def
+ /nxtseq 4 array def
+
+ [ A L M P ] {
+ /x exch def
+
+ { % loop for common exit
+
+ charvals x get char known not {exit} if
+
+ % Extend directly
+ /cost curlen x get 1 add def
+ cost nxtlen x get lt {
+ nxtlen x cost put
+ nxtseq x [ curseq x get aload pop char ] put
+ } if
+
+ % Optimise for direct shifts from y to x
+ [ A L M P ] {
+ /y exch def
+ x y ne {
+ /cost curlen y get shftlen y get x get add 1 add def
+ cost nxtlen y get lt {
+ nxtlen y cost put
+ nxtseq y [
+ curseq y get aload pop
+ x A eq {as} {ps} ifelse
+ char
+ ] put
+ } if
+ } if
+ } forall
+
+ exit
+ } loop
+
+ } forall
+
+ /curlen nxtlen def
+ /curseq nxtseq def
+
+ } forall
+
+ % Select the optimal sequence
+ /minseq e def
+ [ A L M P ] {
+ /k exch def
+ curlen k get minseq lt {
+ /minseq curlen k get def
+ /txtseq curseq k get def
+ } if
+ } forall
+
+ % Encode the sequence
+ /text minseq array def
+ /k 0 def /l 0 def {
+ k txtseq length ge {exit} if
+
+ /char txtseq k get def
+
+ % Encode character
+ char textencfuncs submode get load exec addtotext
+ /k k 1 add def
+
+ % Encode shifted next character
+ char as eq char ps eq or {
+ txtseq k get char as eq {enca} {encp} ifelse addtotext
+ /k k 1 add def
+ } if
+
+ % Latches to new submode
+ char al eq {/submode A def} if
+ char ll eq {/submode L def} if
+ char ml eq {/submode M def} if
+ char pl eq {/submode P def} if
+ } loop
+
+ text length 2 mod 1 eq {
+ submode P eq {
+ /pad al encp def
+ /submode A def
+ } {
+ /pad ps textencfuncs submode get load exec def
+ } ifelse
+ /text [ text aload pop pad ] def
+ } if
+
+ /out text length 2 idiv array def
+ 0 1 out length 1 sub {
+ /k exch def
+ out k text k 2 mul get 30 mul text k 2 mul 1 add get add put
+ } for
+
+ out
+
+ } bind def
+
+ /encn {
+ /in exch def
+ /out [] def
+ 0 44 in length 1 sub {
+ /k exch def
+ /gmod [
+ 1 in k in length k sub dup 44 gt {pop 44} if getinterval
+ {48 sub} forall
+ ] def
+ /cwn [] def {
+ /dv 900 def
+ /gmul [] def /val 0 def {
+ gmod length 0 eq {exit} if
+ /val val 10 mul gmod 0 get add def
+ /gmod gmod 1 gmod length 1 sub getinterval def
+ val dv lt {
+ gmul length 0 ne {
+ /gmul [ gmul aload pop 0 ] def
+ } if
+ } {
+ /gmul [ gmul aload pop val dv idiv ] def
+ } ifelse
+ /val val dv mod def
+ } loop
+ /dv val def
+ /cwn [ dv cwn aload pop ] def
+ /gmod gmul def
+ gmul length 0 eq {exit} if
+ } loop
+ /out [ out aload pop cwn aload pop ] def
+ } for
+ out
+ } bind def
+
+ /encfuncs [ /enct /encn /encb ] def
+
+ /addtocws {
+ dup datcws j 3 -1 roll putinterval
+ length j add /j exch def
+ } bind def
+
+ % Encode the sequence
+ /state T def /submode A def
+ /datcws seqlen array def
+ /i 0 def /j 0 def {
+ i seq length ge {exit} if
+ /chars seq i get def
+ chars type /arraytype eq { % Encode data according to mode
+ chars encfuncs state get load exec addtocws
+ } { % Encode the latch to new state or byte shift
+ [ latchcws chars get ] addtocws
+ chars tl eq {/state T def /submode A def} if
+ chars nl eq {/state N def} if
+ chars bl eq chars bl6 eq or {/state B def} if
+ chars bs eq {
+ /i i 1 add def
+ seq i get encb addtocws
+ } if
+ } ifelse
+ /i i 1 add def
+ } loop
+ /datcws datcws 0 j getinterval def
+ } if
% Determine the error correction level if unspecified
/m datcws length def
@@ -12212,12 +12895,12 @@
% Generate the coefficients
/coeffs [ 1 k {0} repeat ] def
1 1 k {
- /i exch def
+ /i exch def
coeffs i coeffs i 1 sub get put
i 1 sub -1 1 {
/j exch def
coeffs j coeffs j 1 sub get coeffs j get rsalog i get rsprod add 929 mod put
- } for
+ } for
coeffs 0 coeffs 0 get rsalog i get rsprod put
} for
/coeffs coeffs 0 coeffs length 1 sub getinterval def
@@ -12552,8 +13235,8 @@
% --EXAM: MicroPDF417
% --EXOP:
% --RNDR: renmatrix
-%%BeginResource: uk.co.terryburton.bwipp micropdf417 0.0 2014013000 149010 154988
-%%BeginData: 585 ASCII Lines
+%%BeginResource: uk.co.terryburton.bwipp micropdf417 0.0 2014121100 206374 212034
+%%BeginData: 952 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
@@ -12570,6 +13253,7 @@
/columns 0 def
/rows 0 def
/rowmult 2 def
+ /encoding (auto) def
/cca false def
/ccb false def
/raw false def
@@ -12589,8 +13273,6 @@
/columns columns cvi def
/rows rows cvi def
/rowmult rowmult cvr def
-
- cca {/raw true def} if
% Parse ordinals of the form ^NNN to ASCII
parse {
@@ -12609,12 +13291,15 @@
length j add /j exch def
/barcode msg 0 j getinterval def
exit
- } ifelse
+ } ifelse
} loop
} if
+ raw {/encoding (raw) def} if
+ cca {/encoding (cca) def} if
+
% Convert input into array of codewords
- raw {
+ encoding (raw) eq encoding (cca) eq or {
/datcws barcode length array def
/i 0 def /j 0 def
{ % loop
@@ -12625,54 +13310,419 @@
/j j 1 add def
} loop
/datcws datcws 0 j getinterval def
- } { % Simple autoencoder from input to codewords using byte mode
- /barlen barcode length def
- barlen 6 mod 0 eq {
- /datcws barlen 6 idiv 5 mul 1 add array def
- datcws 0 924 put
- } {
- /datcws barlen 6 idiv 5 mul barlen 6 mod add 1 add array def
- datcws 0 901 put
- } ifelse
-
- % Rebase groups of 6 bytes splitting into 3 byte chunks
- 0 1 barlen 6 idiv 1 sub {
- /i exch def
- /msbs [ barcode i 6 mul 3 getinterval {} forall ] def
+ } if
+
+ /barcode [ barcode {} forall ] def
+ /barlen barcode length def
+
+ ccb {/encoding (ccb) def} if
+
+ /encb {
+ /in exch def
+ /inlen in length def
+ /out inlen 6 idiv 5 mul inlen 6 mod add array def
+ 0 1 inlen 6 idiv 1 sub {
+ /k exch def
+ /msbs [ in k 6 mul 3 getinterval aload pop ] def
/mscs [
msbs aload pop exch 256 mul add exch 65536 mul add
3 {dup 900 mod exch 900 idiv} repeat
] def
- /lsbs [barcode i 6 mul 3 add 3 getinterval {} forall] def
+ /lsbs [ in k 6 mul 3 add 3 getinterval aload pop ] def
/lscs [
lsbs aload pop exch 256 mul add exch 65536 mul add
3 {dup 900 mod exch 900 idiv} repeat
] def
- /cws 5 array def
lscs 0 get mscs 0 get 316 mul add
- cws 4 2 index 900 mod put
+ out k 5 mul 4 add 2 index 900 mod put
900 idiv lscs 1 get add mscs 0 get 641 mul add mscs 1 get 316 mul add
- cws 3 2 index 900 mod put
+ out k 5 mul 3 add 2 index 900 mod put
900 idiv lscs 2 get add mscs 0 get 20 mul add mscs 1 get 641 mul add mscs 2 get 316 mul add
- cws 2 2 index 900 mod put
+ out k 5 mul 2 add 2 index 900 mod put
900 idiv lscs 3 get add mscs 1 get 20 mul add mscs 2 get 641 mul add
- cws 1 2 index 900 mod put
+ out k 5 mul 1 add 2 index 900 mod put
900 idiv mscs 2 get 20 mul add
- cws 0 3 -1 roll 900 mod put
- datcws i 5 mul 1 add cws putinterval
+ out k 5 mul 3 -1 roll 900 mod put
} for
-
- % Add the remaining bytes to the end of the codewords
- /rem barlen 6 mod def
+ /rem inlen 6 mod def
rem 0 ne {
- datcws datcws length rem sub
- [ barcode barlen rem sub rem getinterval {} forall ]
+ out out length rem sub
+ [ in inlen rem sub rem getinterval aload pop ]
putinterval
} if
-
- ccb {/datcws [920 datcws aload pop] def} if
-
- } ifelse
+ out
+ } bind def
+
+ encoding (byte) eq encoding (ccb) eq or {
+ /datcws barlen 6 idiv 5 mul barlen 6 mod add 1 add array def
+ datcws 0 barlen 6 mod 0 eq {924} {901} ifelse put
+ datcws 1 barcode encb putinterval
+ encoding (ccb) eq {/datcws [920 datcws aload pop] def} if
+ } if
+
+ encoding (auto) eq {
+
+ % Modes and text submodes
+ /T 0 def /N 1 def /B 2 def
+ /A 0 def /L 1 def /M 2 def /P 3 def
+
+ % Special function characters for mode switching
+ /tl -1 def /nl -2 def /bl -3 def /bl6 -4 def /bs -5 def
+
+ % Special function characters for text mode
+ /al -6 def /ll -7 def /ml -8 def /pl -9 def /as -10 def /ps -11 def
+
+ % Character maps for each state
+ /charmaps [
+ % A L M P
+ [ (A) (a) (0) (;) ] % 0
+ [ (B) (b) (1) (<) ] % 1
+ [ (C) (c) (2) (>) ] % 2
+ [ (D) (d) (3) (@) ] % 3
+ [ (E) (e) (4) ([) ] % 4
+ [ (F) (f) (5) 92 ] % 5
+ [ (G) (g) (6) (]) ] % 6
+ [ (H) (h) (7) (_) ] % 7
+ [ (I) (i) (8) (`) ] % 8
+ [ (J) (j) (9) (~) ] % 9
+ [ (K) (k) (&) (!) ] % 10
+ [ (L) (l) 13 13 ] % 11
+ [ (M) (m) 9 9 ] % 12
+ [ (N) (n) (,) (,) ] % 13
+ [ (O) (o) (:) (:) ] % 14
+ [ (P) (p) (#) 10 ] % 15
+ [ (Q) (q) (-) (-) ] % 16
+ [ (R) (r) (.) (.) ] % 17
+ [ (S) (s) ($) ($) ] % 18
+ [ (T) (t) (/) (/) ] % 19
+ [ (U) (u) (+) (") ] % 20
+ [ (V) (v) (%) (|) ] % 21
+ [ (W) (w) (*) (*) ] % 22
+ [ (X) (x) (=) 40 ] % 23
+ [ (Y) (y) (^) 41 ] % 24
+ [ (Z) (z) pl (?) ] % 25
+ [ ( ) ( ) ( ) ({) ] % 26
+ [ ll as ll (}) ] % 27
+ [ ml ml al (') ] % 28
+ [ ps ps ps al ] % 29
+ ] def
+
+ % Invert charmaps to give character to value maps for each state
+ /charvals [ 30 dict 30 dict 30 dict 30 dict ] def
+ /alltext 104 dict def
+ 0 1 charmaps length 1 sub {
+ /i exch def
+ /encs charmaps i get def
+ 0 1 3 {
+ /j exch def
+ encs j get dup type /stringtype eq {0 get} if % convert string to ASCII if required
+ dup charvals j get exch i put
+ alltext exch -1 put
+ } for
+ } for
+
+ /e 10000 def % "Empty"
+
+ /latlen [ % Bit length of latch between submodes
+ % To: A L M P From
+ [ 0 1 1 2 ] % A
+ [ 2 0 1 2 ] % L
+ [ 1 1 0 1 ] % M
+ [ 1 2 2 0 ] % P
+ ] def
+
+ /latseq [ % Latch sequences between submodes
+ % To: A L M P From
+ [ [] [ll] [ml] [ml pl] ] % A
+ [ [ml al] [] [ml] [ml pl] ] % L
+ [ [al] [ll] [] [pl] ] % M
+ [ [al] [al ll] [al ml] [] ] % P
+ ] def
+
+ /shftlen [ % Bit length of shift to submode
+ % To: A L M P From
+ [ e e e 1 ] % A
+ [ 1 e e 1 ] % L
+ [ e e e 1 ] % M
+ [ e e e e ] % P
+ ] def
+
+ % Determine runlengths of digits
+ /numdigits [ barlen {0} repeat 0 ] def
+ /numtext [ barlen {0} repeat 0 ] def
+ /numbytes [ barlen {0} repeat 0 ] def
+ barlen 1 sub -1 0 {
+ /i exch def
+ barcode i get dup 48 ge exch 57 le and {
+ numdigits i numdigits i 1 add get 1 add put
+ } if
+ alltext barcode i get known numdigits i get 13 lt and {
+ numtext i numtext i 1 add get 1 add put
+ } if
+ numtext i get 5 lt numdigits i get 13 lt and {
+ numbytes i numbytes i 1 add get 1 add put
+ } if
+ } for
+ /numdigits numdigits 0 barlen getinterval def
+ /numtext numtext 0 barlen getinterval def
+ /numbytes numbytes 0 barlen getinterval def
+
+ /seq [] def /seqlen 0 def /state B def /p 0 def { % loop
+ p barlen eq {exit} if
+ /n numdigits p get def
+ n 13 ge {
+ /seq [
+ seq aload pop
+ nl
+ [ barcode p n getinterval aload pop ]
+ ] def
+ /state N def
+ /p p n add def
+ /seqlen seqlen 1 add n add def
+ } { % next
+ /t numtext p get def
+ t 5 ge {
+ /seq [
+ seq aload pop
+ state T ne {tl} if
+ [ barcode p t getinterval aload pop ]
+ ] def
+ /state T def
+ /p p t add def
+ /seqlen seqlen 1 add t add def % ish
+ } { % next
+ /b numbytes p get def
+ b 1 eq state T eq and {
+ /seq [
+ seq aload pop
+ bs
+ [ barcode p get ]
+ ] def
+ /p p b add def
+ /seqlen seqlen 2 add def
+ } { % next
+ /seq [
+ seq aload pop
+ b 6 mod 0 ne {bl} {bl6} ifelse
+ [ barcode p b getinterval aload pop ]
+ ] def
+ /state B def
+ /p p b add def
+ /seqlen seqlen 1 add b add def
+ } ifelse } ifelse } ifelse
+ } loop
+
+ /latchcws <<
+ tl 900 bl 901 bl6 924 nl 902 bs 913
+ >> def
+
+ % Submode encoding functions
+ /enca {charvals A get exch get} bind def
+ /encl {charvals L get exch get} bind def
+ /encm {charvals M get exch get} bind def
+ /encp {charvals P get exch get} bind def
+ /textencfuncs [ /enca /encl /encm /encp ] def
+
+ /addtotext {
+ text exch l exch put
+ /l l 1 add def
+ } bind def
+
+ /enct {
+
+ /in exch def
+
+ /curlen [ e e e e ] def
+ curlen submode 0 put
+ /curseq [ [] [] [] [] ] def
+
+ % Derive the optimal sequences ending in each submode
+ in {
+
+ /char exch def
+
+ % Check for optimisations in the current sequences by latching from x to y
+ { % loop
+ /imp false def
+ [ A L M P ] {
+ /x exch def
+ [ A L M P ] {
+ /y exch def
+ /cost curlen x get latlen x get y get add def
+ cost curlen y get lt {
+ curlen y cost put
+ curseq y [
+ curseq x get aload pop
+ latseq x get y get aload pop
+ ] put
+ /imp true def
+ } if
+ } forall
+ } forall
+ imp not {exit} if % Repeat unless no improvement
+ } loop
+
+ % Determine optimal next sequences for each valid encoding
+ /nxtlen [ e e e e ] def
+ /nxtseq 4 array def
+
+ [ A L M P ] {
+ /x exch def
+
+ { % loop for common exit
+
+ charvals x get char known not {exit} if
+
+ % Extend directly
+ /cost curlen x get 1 add def
+ cost nxtlen x get lt {
+ nxtlen x cost put
+ nxtseq x [ curseq x get aload pop char ] put
+ } if
+
+ % Optimise for direct shifts from y to x
+ [ A L M P ] {
+ /y exch def
+ x y ne {
+ /cost curlen y get shftlen y get x get add 1 add def
+ cost nxtlen y get lt {
+ nxtlen y cost put
+ nxtseq y [
+ curseq y get aload pop
+ x A eq {as} {ps} ifelse
+ char
+ ] put
+ } if
+ } if
+ } forall
+
+ exit
+ } loop
+
+ } forall
+
+ /curlen nxtlen def
+ /curseq nxtseq def
+
+ } forall
+
+ % Select the optimal sequence
+ /minseq e def
+ [ A L M P ] {
+ /k exch def
+ curlen k get minseq lt {
+ /minseq curlen k get def
+ /txtseq curseq k get def
+ } if
+ } forall
+
+ % Encode the sequence
+ /text minseq array def
+ /k 0 def /l 0 def {
+ k txtseq length ge {exit} if
+
+ /char txtseq k get def
+
+ % Encode character
+ char textencfuncs submode get load exec addtotext
+ /k k 1 add def
+
+ % Encode shifted next character
+ char as eq char ps eq or {
+ txtseq k get char as eq {enca} {encp} ifelse addtotext
+ /k k 1 add def
+ } if
+
+ % Latches to new submode
+ char al eq {/submode A def} if
+ char ll eq {/submode L def} if
+ char ml eq {/submode M def} if
+ char pl eq {/submode P def} if
+ } loop
+
+ text length 2 mod 1 eq {
+ submode P eq {
+ /pad al encp def
+ /submode A def
+ } {
+ /pad ps textencfuncs submode get load exec def
+ } ifelse
+ /text [ text aload pop pad ] def
+ } if
+
+ /out text length 2 idiv array def
+ 0 1 out length 1 sub {
+ /k exch def
+ out k text k 2 mul get 30 mul text k 2 mul 1 add get add put
+ } for
+
+ out
+
+ } bind def
+
+ /encn {
+ /in exch def
+ /out [] def
+ 0 44 in length 1 sub {
+ /k exch def
+ /gmod [
+ 1 in k in length k sub dup 44 gt {pop 44} if getinterval
+ {48 sub} forall
+ ] def
+ /cwn [] def {
+ /dv 900 def
+ /gmul [] def /val 0 def {
+ gmod length 0 eq {exit} if
+ /val val 10 mul gmod 0 get add def
+ /gmod gmod 1 gmod length 1 sub getinterval def
+ val dv lt {
+ gmul length 0 ne {
+ /gmul [ gmul aload pop 0 ] def
+ } if
+ } {
+ /gmul [ gmul aload pop val dv idiv ] def
+ } ifelse
+ /val val dv mod def
+ } loop
+ /dv val def
+ /cwn [ dv cwn aload pop ] def
+ /gmod gmul def
+ gmul length 0 eq {exit} if
+ } loop
+ /out [ out aload pop cwn aload pop ] def
+ } for
+ out
+ } bind def
+
+ /encfuncs [ /enct /encn /encb ] def
+
+ /addtocws {
+ dup datcws j 3 -1 roll putinterval
+ length j add /j exch def
+ } bind def
+
+ % Encode the sequence
+ /state T def /submode A def
+ /datcws seqlen array def
+ /i 0 def /j 0 def {
+ i seq length ge {exit} if
+ /chars seq i get def
+ chars type /arraytype eq { % Encode data according to mode
+ chars encfuncs state get load exec addtocws
+ } { % Encode the latch to new state or byte shift
+ [ latchcws chars get ] addtocws
+ chars tl eq {/state T def /submode A def} if
+ chars nl eq {/state N def} if
+ chars bl eq chars bl6 eq or {/state B def} if
+ chars bs eq {
+ /i i 1 add def
+ seq i get encb addtocws
+ } if
+ } ifelse
+ /i i 1 add def
+ } loop
+ /datcws datcws 0 j getinterval def
+ } if
% Basic metrics for the each symbol
% c r ecw rl rc rr
@@ -12782,12 +13832,12 @@
% Generate the coefficients
/coeffs [ 1 k {0} repeat ] def
1 1 k {
- /i exch def
+ /i exch def
coeffs i coeffs i 1 sub get put
i 1 sub -1 1 {
/j exch def
coeffs j coeffs j 1 sub get coeffs j get rsalog i get rsprod add 929 mod put
- } for
+ } for
coeffs 0 coeffs 0 get rsalog i get rsprod put
} for
/coeffs coeffs 0 coeffs length 1 sub getinterval def
@@ -13147,10 +14197,10 @@
% --REQUIRES preamble raiseerror renmatrix--
% --DESC: Data Matrix
% --EXAM: This is Data Matrix!
-% --EXOP: rows=32 columns=32
+% --EXOP:
% --RNDR: renmatrix
-%%BeginResource: uk.co.terryburton.bwipp datamatrix 0.0 2014013000 137811 150247
-%%BeginData: 559 ASCII Lines
+%%BeginResource: uk.co.terryburton.bwipp datamatrix 0.0 2014121100 198474 217339
+%%BeginData: 844 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
@@ -13166,9 +14216,6 @@
/dontdraw false def
/columns 0 def
/rows 0 def
- /prefix () def
- /encoding (ascii) def
- /raw false def
/parse false def
/parsefnc false def
@@ -13203,211 +14250,38 @@
length j add /j exch def
/barcode msg 0 j getinterval def
exit
+ } ifelse
+ } loop
+ } if
+
+ /barlen barcode length def
+
+ % Convert input into bytes accounting for FNC characters
+ /fnc1 -1 def /prog -2 def /m05 -3 def /m06 -4 def
+ /fncvals <<
+ (FNC1) fnc1
+ (PROG) prog
+ (MAC5) m05
+ (MAC6) m06
+ >> def
+ /msg barlen array def
+ /i 0 def /j 0 def {
+ i barlen eq {exit} if
+ /char barcode i get def
+ parsefnc char 94 eq and i barlen 4 sub lt and {
+ barcode i 1 add get 94 ne {
+ /char fncvals barcode i 1 add 4 getinterval get def
+ /i i 4 add def
+ } {
+ /i i 1 add def
} ifelse
- } loop
- } if
-
- /premaps <<
- /FNC1 [ 232 ] /PROG [ 234 ] /MAC5 [ 236 ] /MAC6 [ 237 ]
- () []
- >> def
- premaps prefix known {
- /precws premaps prefix get def
- } {
- /bwipp.datamatrixBadPrefix (The prefix for Data Matrix must be FNC1, PROG, MAC5 or MAC6) //raiseerror exec
- } ifelse
-
- /prelen precws length def
- /barlen barcode length def
-
- raw {/encoding (raw) def} if
-
- encoding (raw) eq {
- /cws barlen prelen add array def
- cws 0 precws putinterval
- /i 0 def /j prelen def
- { % loop
- i barlen eq {exit} if
- /cw barcode i 1 add 3 getinterval cvi def
- cws j cw put
- /i i 4 add def
- /j j 1 add def
- } loop
- /cws cws 0 j getinterval def
- } if
-
- % Special function characters
- /fn1 -1 def
-
- encoding (ascii) eq {
- /fncvals <<
- (FNC1) fn1
- >> def
- /msg barlen array def
- /i 0 def /j 0 def {
- i barlen eq {exit} if
- /char barcode i get def
- parsefnc char 94 eq and i barlen 4 sub lt and {
- barcode i 1 add get 94 ne {
- /char fncvals barcode i 1 add 4 getinterval get def
- /i i 4 add def
- } {
- /i i 1 add def
- } ifelse
- } if
- msg j char put
- /i i 1 add def
- /j j 1 add def
- } loop
- /msg msg 0 j getinterval def
- /msglen msg length def
-
- /cws msglen 2 mul prelen add array def
- cws 0 precws putinterval
- /i 0 def /j prelen def
- { % loop
- i msglen eq {exit} if
- /char msg i get def
- char fn1 eq { % FNC1
- cws j 232 put
- /i i 1 add def
- /j j 1 add def
- } { char 48 ge char 57 le and i msglen 1 sub lt and {
- msg i 1 add get dup 48 ge exch 57 le and { % Digit pair
- cws j msg i get 48 sub 10 mul msg i 1 add get 48 sub add 130 add put
- /i i 2 add def
- /j j 1 add def
- } { % Singular digit
- cws j char 1 add put
- /i i 1 add def
- /j j 1 add def
- } ifelse
- } { char 127 le { % ASCII
- cws j char 1 add put
- /i i 1 add def
- /j j 1 add def
- } { % Extended ASCII
- cws j 235 put
- cws j 1 add char 127 sub put
- /i i 1 add def
- /j j 2 add def
- } ifelse } ifelse } ifelse
- } loop
- /cws cws 0 j getinterval def
- } if
-
- /base40 false def % Used for size optimization
- encoding (c40) eq encoding (text) eq encoding (x12) eq or or {
- % Pathological case : 8-bit chars encode to 4 base-40 values
- % plus extra 2 for possible nul-pading
- /b40 barlen 4 mul 2 add array def
- /base40 true def
-
- % Maps are encoded as static strings with the base-40 value in
- % the right 6-bits and the shift-state in the two left bits.
- % The value 255 indicates an invalid mapping (x12 only).
- encoding (c40) eq {
- /mode 230 def
- /8bit true def
- /charmap <
- 404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f
- 03808182838485868788898a8b8c8d8e0405060708090a0b0c0d8f9091929394
- 950e0f101112131415161718191a1b1c1d1e1f2021222324252627969798999a
- c0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedf
- > def
- } if
-
- encoding (text) eq {
- /mode 239 def
- /8bit true def
- /charmap <
- 404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f
- 03808182838485868788898a8b8c8d8e0405060708090a0b0c0d8f9091929394
- 95c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9da969798999a
- c00e0f101112131415161718191a1b1c1d1e1f2021222324252627dbdcdddedf
- > def
- } if
-
- encoding (x12) eq {
- /mode 238 def
- /8bit false def
- /parsefnc false def
- /charmap <
- ffffffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffff
- 03ffffffffffffffffff01ffffffffff0405060708090a0b0c0dffffffff02ff
- ff0e0f101112131415161718191a1b1c1d1e1f2021222324252627ffffffffff
- ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
- > def
- } if
-
- /i 0 def /j 0 def
- { % loop
- i barlen ge {exit} if
- /char barcode i get def
- % ^FNC1
- parsefnc char 94 eq and i barlen 4 sub lt and {
- barcode i 5 getinterval (^FNC1) eq {
- b40 j [ 1 27 ] putinterval % set-2, FNC1
- /char -1 def
- /i i 5 add def
- /j j 2 add def
- } if
- } if
-
- % Replace ^^ with ^
- parsefnc char 94 eq and i barlen 1 sub lt and {
- barcode i 1 add get 94 eq {
- /i i 1 add def
- } if
- } if
- 8bit char 127 gt and {
- /char char 127 and def
- b40 j [ 1 30 ] putinterval % set-2, high-bit
- /j j 2 add def
- } if
- char 0 ge char 127 le and {
- charmap char get
- dup 255 ne {
- dup -6 bitshift 1 sub
- dup 0 ge {
- b40 j 3 -1 roll put
- /j j 1 add def
- } {
- pop
- } ifelse
- 63 and b40 j 3 -1 roll put
- /j j 1 add def
- } {
- /bwipp.datamatrixBadX12character (Invalid character for Data Matrix X12 encoding) //raiseerror exec
- } ifelse
- /i i 1 add def
- } if
- } loop
-
- % Nul-pad to full triples
- { % loop
- j 3 mod 0 eq { exit } if
- b40 j 0 put
- /j j 1 add def
- } loop
-
- % Convert triples to 2 bytes
- /b40len j def
- /cws b40len 3 div 2 mul prelen add 1 add cvi array def
- cws 0 precws putinterval
- cws prelen mode put
- /i 0 def /j prelen 1 add def
- { % loop
- i b40len eq { exit } if
- cws j [
- b40 i get 1600 mul b40 i 1 add get 40 mul add b40 i 2 add get add 1 add
- dup -8 bitshift
- exch 255 and
- ] putinterval
- /i i 3 add def
- /j j 2 add def
- } loop
- } if
+ } if
+ msg j char put
+ /i i 1 add def
+ /j j 1 add def
+ } loop
+ /msg msg 0 j getinterval def
+ /msglen msg length def
% Basic metrics for the each symbol
% rows cols regh regv rscw rsbl
@@ -13418,7 +14292,7 @@
[ 14 14 1 1 10 1 ]
[ 16 16 1 1 12 1 ]
[ 18 18 1 1 14 1 ]
- [ 20 20 1 1 18 1 ]
+ [ 20 20 1 1 18 1 ]
[ 22 22 1 1 20 1 ]
[ 24 24 1 1 24 1 ]
[ 26 26 1 1 28 1 ]
@@ -13446,11 +14320,489 @@
[ 16 48 1 2 28 1 ]
] def
- % Select metrics of an appropriate symbol
+ % Create array of codewords remaining to make a full symbol
/urows rows def
/ucols columns def
- /i 0 def
- { % loop
+ /fullcws [] def
+ metrics {
+ /m exch def
+ /rows m 0 get def % Rows in symbol
+ /cols m 1 get def % Columns in symbol
+ /regh m 2 get def % Horizontal regions
+ /regv m 3 get def % Vertical regions
+ /rscw m 4 get def % Error correction codewords
+ /rsbl m 5 get def % Error correction blocks
+ /mrows rows 2 regh mul sub def % Rows in the mapping matrix
+ /mcols cols 2 regv mul sub def % Columns in the mapping matrix
+ /ncws mrows mcols mul 8 idiv rscw sub def % Data codewords
+ /okay true def
+ urows 0 ne urows rows ne and {/okay false def} if
+ ucols 0 ne ucols cols ne and {/okay false def} if
+ urows 0 eq ucols 0 eq or rows cols ne and {/okay false def} if
+ okay {/fullcws [ fullcws aload pop ncws ] def} if
+ } forall
+ /numremcws [ 1558 {10000} repeat ] def
+ fullcws {numremcws exch 1 sub 1 put} forall
+ 1556 -1 0 {
+ /i exch def
+ numremcws i get 1 ne {
+ numremcws i numremcws i 1 add get 1 add put
+ } if
+ } for
+
+ % Special characters
+ /lC -5 def /lB -6 def /lX -7 def /lT -8 def /lE -9 def /unl -10 def
+ /sapp -11 def /usft -12 def /sft1 -13 def /sft2 -14 def /sft3 -15 def /eci -16 def /pad -17 def
+ /unlcw 254 def
+
+ /Avals <<
+ 0 1 128 {dup 1 add} for
+ pad 129
+ 0 1 99 { % Double digits
+ dup 10 2 string cvrs (00) 2 string copy dup 2 3 index length sub 4 -1 roll putinterval
+ exch 130 add
+ } for
+ 229 [ lC lB fnc1 sapp prog usft m05 m06 lX lT lE eci ] {exch 1 add dup} forall pop
+ >> def
+ /Avals <<
+ Avals {[exch]} forall
+ >> def
+
+ /CNvals <<
+ sft1 0
+ sft2 1
+ sft3 2
+ 32 3
+ 48 1 57 {dup 44 sub} for % 0-9
+ 65 1 90 {dup 51 sub} for % A-Z
+ >> def
+ /C1vals << 0 1 31 {dup} for >> def
+ /C2vals <<
+ 33 1 47 {dup 33 sub} for
+ 58 1 64 {dup 43 sub} for
+ 91 1 95 {dup 69 sub} for
+ fnc1 27
+ usft 30
+ >> def
+ /C3vals << 96 1 127 {dup 96 sub} for >> def
+ /Cvals <<
+ CNvals {[exch]} forall
+ C1vals {[exch CNvals sft1 get exch]} forall
+ C2vals {[exch CNvals sft2 get exch]} forall
+ C3vals {[exch CNvals sft3 get exch]} forall
+ >> def
+
+ /TNvals <<
+ sft1 0
+ sft2 1
+ sft3 2
+ 32 3
+ 48 1 57 {dup 44 sub} for % 0-9
+ 97 1 122 {dup 83 sub} for % a-z
+ >> def
+ /T1vals << 0 1 31 {dup} for >> def
+ /T2vals <<
+ 33 1 47 {dup 33 sub} for
+ 58 1 64 {dup 43 sub} for
+ 91 1 95 {dup 69 sub} for
+ fnc1 27
+ usft 30
+ >> def
+ /T3vals <<
+ 96 0
+ 65 1 90 {dup 64 sub} for
+ 123 1 127 {dup 96 sub} for
+ >> def
+ /Tvals <<
+ TNvals {[exch]} forall
+ T1vals {[exch TNvals sft1 get exch]} forall
+ T2vals {[exch TNvals sft2 get exch]} forall
+ T3vals {[exch TNvals sft3 get exch]} forall
+ >> def
+
+ % Extended ASCII mappings
+ 128 1 255 {
+ /i exch def
+ Avals i [ Avals usft get aload pop Avals i 128 sub get aload pop ] put
+ Cvals i [ Cvals usft get aload pop Cvals i 128 sub get aload pop ] put
+ Tvals i [ Tvals usft get aload pop Tvals i 128 sub get aload pop ] put
+ } for
+
+ /Xvals <<
+ 13 0
+ 42 1
+ 62 2
+ 32 3
+ 48 1 57 {dup 44 sub} for
+ 65 1 90 {dup 51 sub} for
+ >> def
+ /Xvals <<
+ Xvals {[exch]} forall
+ >> def
+
+ /Evals <<
+ 64 1 94 {dup 64 sub} for
+ unl 31
+ 32 1 63 {dup} for
+ >> def
+ /Evals <<
+ Evals {[exch]} forall
+ >> def
+
+ /Bvals <<
+ 0 1 255 {dup} for
+ >> def
+ /Bvals <<
+ Bvals {[exch]} forall
+ >> def
+
+ /encvals [ Avals Cvals Tvals Xvals Evals Bvals ] def
+
+ /numD [ msglen {0} repeat 0 ] def
+ /nextXterm [ msglen {0} repeat 9999 ] def
+ /nextNonX [ msglen {0} repeat 9999 ] def
+ msglen 1 sub -1 0 {
+ /i exch def
+ /barchar msg i get def
+ barchar 48 ge barchar 57 le and {
+ numD i numD i 1 add get 1 add put
+ } if
+ barchar 13 eq barchar 42 eq or barchar 62 eq or {
+ nextXterm i 0 put
+ } {
+ nextXterm i nextXterm i 1 add get 1 add put
+ } ifelse
+ Xvals barchar known not {
+ nextNonX i 0 put
+ } {
+ nextNonX i nextNonX i 1 add get 1 add put
+ } ifelse
+ } for
+ /nextXterm [nextXterm {dup 10000 gt {pop 10000} if} forall] def
+ /nextNonX [nextNonX {dup 10000 gt {pop 10000} if} forall] def
+
+ /isD {char 48 ge char 57 le and} bind def
+ /isC {CNvals char known} bind def
+ /isT {TNvals char known} bind def
+ /isX {Xvals char known} bind def
+ /isE {Evals char known} bind def
+ /isEA {char 127 gt} bind def
+ /isFN {char 0 lt} bind def
+ /XtermFirst {dup nextXterm exch get exch nextNonX exch get lt} bind def
+
+ /A 0 def /C 1 def /T 2 def /X 3 def /E 4 def /B 5 def
+
+ /lookup {
+ /ac 1 def /cc 2 def /tc 2 def /xc 2 def /ec 2 def /bc 2.25 def
+ mode A eq {/ac 0 def /cc 1 def /tc 1 def /xc 1 def /ec 1 def /bc 1.25 def} if
+ mode C eq {/cc 0 def} if
+ mode T eq {/tc 0 def} if
+ mode X eq {/xc 0 def} if
+ mode E eq {/ec 0 def} if
+ mode B eq {/bc 0 def} if
+ 1 { % common exit
+ /k 0 def { % loop
+ i k add msglen eq {
+ [/ac /cc /tc /xc /ec /bc] {dup load ceiling def} forall
+ true [ cc tc xc ec bc] {ac exch le and} forall {A exit} if
+ true [ac cc tc xc ec ] {bc exch lt and} forall {B exit} if
+ true [ac cc tc xc bc] {ec exch lt and} forall {E exit} if
+ true [ac cc xc ec bc] {tc exch lt and} forall {T exit} if
+ true [ac cc tc ec bc] {xc exch lt and} forall {X exit} if
+ C exit
+ } if
+ /char msg i k add get def
+ /ac ac isD {1 2 div add} {isEA {ceiling 2 add} {1 add } ifelse} ifelse def
+ /cc cc isC {2 3 div add} {isEA { 8 3 div add } { 4 3 div add} ifelse} ifelse def
+ /tc tc isT {2 3 div add} {isEA { 8 3 div add } { 4 3 div add} ifelse} ifelse def
+ /xc xc isX {2 3 div add} {isEA {13 3 div add } {10 3 div add} ifelse} ifelse def
+ /ec ec isE {3 4 div add} {isEA {17 4 div add } {13 4 div add} ifelse} ifelse def
+ /bc bc isFN {4 add} {1 add} ifelse def
+ k 4 ge {
+ true [ cc tc xc ec bc] {ac 1 add exch le and} forall {A exit} if
+ bc 1 add ac le {B exit} if
+ true [ cc tc xc ec ] {bc 1 add exch lt and} forall {B exit} if
+ true [ac cc tc xc bc] {ec 1 add exch lt and} forall {E exit} if
+ true [ac cc xc ec bc] {tc 1 add exch lt and} forall {T exit} if
+ true [ac cc tc ec bc] {xc 1 add exch lt and} forall {X exit} if
+ true [ac tc ec bc] {cc 1 add exch lt and} forall {
+ cc xc lt {C exit} if
+ cc xc eq {i k add 1 add XtermFirst {X exit} {C exit} ifelse} if
+ } if
+ } if
+ /k k 1 add def
+ } loop
+ } repeat
+ } bind def
+
+ /addtocws {
+ dup cws exch j exch putinterval
+ /j exch length j add def
+ } bind def
+
+ /encA {
+ 1 { % Common exit
+ numD i get 2 ge {
+ 2 string dup 0 msg i get put dup 1 msg i 1 add get put Avals exch get addtocws
+ /i i 2 add def
+ exit
+ } if
+ /newmode lookup def
+ newmode mode ne {
+ Avals [-1 lC lT lX lE lB] newmode get get addtocws
+ /mode newmode def
+ exit
+ } if
+ Avals msg i get get addtocws
+ /i i 1 add def
+ exit
+ } repeat
+ } bind def
+
+ /CTXvalstocws {
+ /in exch def
+ mark
+ 0 3 in length 1 sub {
+ in exch 3 getinterval 0 exch {add 40 mul} forall 40 idiv 1 add
+ dup 256 idiv exch 256 mod
+ } for
+ counttomark array astore exch pop
+ } bind def
+
+ /encCTX {
+ /p 0 def
+ /ctxvals 2500 array def
+
+ % Lookup the values for each character
+ {
+ i msglen eq {exit} if
+ encvals mode get msg i get known not {exit} if
+ p 3 mod 0 eq {
+ lookup mode ne {
+ ctxvals 0 p getinterval CTXvalstocws addtocws
+ [unlcw] addtocws
+ /mode A def
+ exit
+ } if
+ msglen i sub 3 le { % Check end of data conditions
+ /remcws numremcws j p 3 idiv 2 mul add get def
+ /remvals [
+ msg i msglen i sub getinterval {
+ dup encvals mode get exch known {
+ encvals mode get exch get aload pop
+ } { % Unencodable X12 characters
+ pop -1 -1 -1 -1
+ } ifelse
+ } forall
+ ] def
+ remcws 2 eq remvals length 3 eq and {
+ % Encode and omit unlatch
+ [
+ ctxvals 0 p getinterval aload pop
+ remvals aload pop
+ ] CTXvalstocws addtocws
+ /mode A def
+ /i msglen def
+ exit
+ } if
+ remcws 2 eq remvals length 2 eq and mode X ne and {
+ % Encode with sft1 as third value, omit unlatch
+ [
+ ctxvals 0 p getinterval aload pop
+ remvals aload pop
+ encvals mode get sft1 get aload pop
+ ] CTXvalstocws addtocws
+ /mode A def
+ /i msglen def
+ exit
+ } if
+ remcws 2 eq remvals length 1 eq and {
+ % Unlatch to ASCII
+ ctxvals 0 p getinterval CTXvalstocws addtocws
+ [unlcw] addtocws
+ Avals msg i get get addtocws
+ /mode A def
+ /i msglen def
+ exit
+ } if
+ remcws 1 eq remvals length 1 eq and {
+ % Implied unlatch to ASCII
+ ctxvals 0 p getinterval CTXvalstocws addtocws
+ Avals msg i get get addtocws
+ /mode A def
+ /i msglen def
+ exit
+ } if
+ } if
+ } if
+ encvals mode get msg i get get
+ dup ctxvals exch p exch putinterval
+ /p exch length p add def
+ /i i 1 add def
+ } loop
+
+ % Backtrack to a boundary and return to ASCII
+ mode A ne {
+ {
+ p 3 mod 0 eq {exit} if
+ /i i 1 sub def
+ /p p encvals mode get msg i get get length sub def
+ } loop
+ [
+ ctxvals 0 p getinterval aload pop
+ ] CTXvalstocws addtocws
+ [unlcw] addtocws
+ /mode A def
+ % Encode something to avoid latching immediately back
+ i msglen ne {
+ numD i get 2 ge {
+ 2 string dup 0 msg i get put dup 1 msg i 1 add get put Avals exch get addtocws
+ /i i 2 add def
+ } {
+ Avals msg i get get addtocws
+ /i i 1 add def
+ } ifelse
+ } if
+ } if
+
+ } bind def
+
+ /Evalstocws {
+ /in exch def
+ /inlen in length def
+ /outlen in length 4 div 3 mul ceiling cvi def
+ /in [ in aload pop 0 0 0 ] def
+ mark
+ 0 4 inlen 1 sub {
+ in exch 4 getinterval 0 exch {or 6 bitshift} forall -6 bitshift
+ dup -16 bitshift 255 and exch
+ dup -8 bitshift 255 and exch
+ 255 and
+ } for
+ counttomark array astore exch pop
+ 0 outlen getinterval
+ } bind def
+
+ /encE {
+ /p 0 def
+ /edifactvals 2100 array def
+
+ % Lookup the values for each character
+ {
+ i msglen eq {exit} if
+ Evals msg i get known not {exit} if
+ p 4 mod 0 eq {
+ lookup mode ne {exit} if
+ msglen i sub 2 le { % Check end of data conditions
+ /remcws numremcws j p 4 idiv 3 mul add get def
+ /remvals [
+ msg i msglen i sub getinterval {
+ dup Evals exch known {
+ Evals exch get aload pop
+ } { % Unencodable EDIFACT characters
+ pop -1 -1 -1 -1 -1
+ } ifelse
+ } forall
+ ] def
+ remcws 2 eq remvals length 2 eq and {
+ % Implied unlatch to ASCII
+ edifactvals 0 p getinterval Evalstocws addtocws
+ Avals msg i get get addtocws
+ Avals msg i 1 add get get addtocws
+ /mode A def
+ /i msglen def
+ exit
+ } if
+ remcws 2 eq remcws 1 eq or remvals length 1 eq and {
+ % Implied unlatch to ASCII
+ edifactvals 0 p getinterval Evalstocws addtocws
+ Avals msg i get get addtocws
+ /mode A def
+ /i msglen def
+ exit
+ } if
+ } if
+ } if
+ Evals msg i get get
+ dup edifactvals exch p exch putinterval
+ /p exch length p add def
+ /i i 1 add def
+ } loop
+
+ % Unlatch and pad with zeros until boundary
+ mode A ne {
+ /remcws numremcws j p 4 idiv 3 mul add 1 sub get 1 sub def
+ remcws 0 ne { % Unlatch if we haven't filled symbol
+ Evals unl get
+ dup edifactvals exch p exch putinterval
+ /p exch length p add def
+ } if
+ edifactvals 0 p getinterval Evalstocws addtocws
+ /mode A def
+ % Encode something to avoid latching immediately back
+ i msglen ne {
+ numD i get 2 ge {
+ 2 string dup 0 msg i get put dup 1 msg i 1 add get put Avals exch get addtocws
+ /i i 2 add def
+ } {
+ Avals msg i get get addtocws
+ /i i 1 add def
+ } ifelse
+ } if
+ } if
+
+ } bind def
+
+ /encB {
+ /p 0 def /bvals 1558 array def {
+ i msglen eq {exit} if
+ lookup mode ne {exit} if
+ bvals p msg i get put
+ /p p 1 add def
+ /i i 1 add def
+ } loop
+ /remcws numremcws j p add get 1 sub def
+ /bvals [
+ remcws 0 eq i msglen eq and { % Terminates symbol
+ 0
+ } {
+ p 250 lt {p} {p 250 idiv 249 add p 250 mod} ifelse
+ } ifelse
+ bvals 0 p getinterval aload pop
+ ] def
+ 0 1 bvals length 1 sub { % Pseudo-randomise based on codeword position
+ /p exch def
+ j p add 1 add 149 mul 255 mod 1 add bvals p get add
+ dup 256 ge {256 sub} if
+ bvals exch p exch put
+ } for
+ bvals addtocws
+ /mode A def
+ } bind def
+
+ % Derive the codewords
+ /cws 1558 array def
+ /mode A def /i 0 def /j 0 def {
+ i msglen ge {exit} if
+ [ /encA /encCTX /encCTX /encCTX /encE /encB ] mode get load exec
+ } loop
+ /cws cws 0 j getinterval def
+
+ % Extend codewords to fill symbol with pseudo-randomised pad characters
+ /datlen cws length def
+ /remcws numremcws j 1 sub get 1 sub def
+ remcws 0 gt {
+ /cws [ cws aload pop remcws {129} repeat ] def
+ datlen 1 add 1 datlen remcws add 1 sub {
+ /i exch def
+ i 1 add 149 mul 253 mod 1 add 129 add
+ dup 254 gt {254 sub} if
+ cws exch i exch put
+ } for
+ } if
+
+ % Lookup symbol metrics based on number of codewords and user specification
+ /i 0 def { % loop
/m metrics i get def
/rows m 0 get def % Rows in symbol
/cols m 1 get def % Columns in symbol
@@ -13464,29 +14816,12 @@
/rcols mcols regv idiv def % Columns per region
/ncws mrows mcols mul 8 idiv rscw sub def % Data codewords
/okay true def
- cws length ncws gt {/okay false def} if
+ cws length ncws ne {/okay false def} if
urows 0 ne urows rows ne and {/okay false def} if
ucols 0 ne ucols cols ne and {/okay false def} if
okay {exit} if
/i i 1 add def
} loop
-
- % C40/TEXT/X12 size optimization - do not emit the unlatch unless we pad
- base40 cws length ncws lt and {
- /cws [ cws {} forall 254 ] def
- } if
-
- % Extend cws to ncws codewords by addition of pseudo-randomised pad characters
- cws length ncws lt {
- /datlen cws length def
- /cws [ cws {} forall ncws datlen sub {129} repeat ] def
- datlen 1 add 1 ncws 1 sub {
- /i exch def
- i 1 add 149 mul 253 mod 1 add 129 add
- dup 254 gt {254 sub} if
- cws exch i exch put
- } for
- } if
% De-interleave the codewords into blocks
/cwbs rsbl array def % Array of data codeword blocks
@@ -13498,11 +14833,11 @@
} {
i 7 le {/cwbsize 156 def} {/cwbsize 155 def} ifelse
} ifelse
- /cwb cwbsize array def
+ /cwb cwbsize array def
0 1 cwbsize 1 sub {
/j exch def
cwb j cws j rsbl mul i add get put
- } for
+ } for
cwbs i cwb put
ecbs i [ rscw rsbl idiv {0} repeat ] put
} for
@@ -13514,7 +14849,7 @@
% Function to calculate the product in the field
/rsprod {
- 2 copy 0 ne exch 0 ne and {
+ 2 copy 0 ne exch 0 ne and {
rslog exch get exch rslog exch get add 255 mod rsalog exch get
} {
pop pop 0
@@ -13524,12 +14859,12 @@
% Generate the coefficients
/coeffs [ 1 rscw rsbl idiv {0} repeat ] def
1 1 rscw rsbl idiv {
- /i exch def
+ /i exch def
coeffs i coeffs i 1 sub get put
i 1 sub -1 1 {
/j exch def
coeffs j coeffs j 1 sub get coeffs j get rsalog i get rsprod xor put
- } for
+ } for
coeffs 0 coeffs 0 get rsalog i get rsprod put
} for
/coeffs coeffs 0 coeffs length 1 sub getinterval def
@@ -13540,13 +14875,13 @@
/cwb cwbs i get def
/ecb ecbs i get def
0 1 cwb length 1 sub {
- /t exch cwb exch get ecb 0 get xor def
+ /t exch cwb exch get ecb 0 get xor def
ecb length 1 sub -1 0 {
/j exch def
/p ecb length j sub 1 sub def
ecb p t coeffs j get rsprod put
j 0 gt { ecb p ecb p 1 add get ecb p get xor put } if
- } for
+ } for
} for
} for
@@ -13565,9 +14900,9 @@
% Place the codewords into the matrix
/module {
% cw row col shape
- 4 -1 roll
- (00000000) 8 string copy dup 3 -1 roll 2 8 string cvrs
- dup length 8 exch sub exch putinterval
+ 4 -1 roll
+ (00000000) 8 string copy dup 3 -1 roll 2 8 string cvrs
+ dup length 8 exch sub exch putinterval
7 -1 0 {1 index exch get 48 sub exch} for pop
11 -3 roll
% 1 2 4 8 16 32 64 128 row col shape
@@ -13593,28 +14928,28 @@
{ 2 copy exch 1 sub exch } bind { 2 copy 2 sub } bind
{ 2 copy 1 sub } bind { 2 copy } bind
] def
-
+
/dmc1 [
{ mrows 1 sub 0 } bind { mrows 1 sub 1 } bind
{ mrows 1 sub 2 } bind { 0 mcols 2 sub } bind
{ 0 mcols 1 sub } bind { 1 mcols 1 sub } bind
{ 2 mcols 1 sub } bind { 3 mcols 1 sub } bind
] def
-
+
/dmc2 [
{ mrows 3 sub 0 } bind { mrows 2 sub 0 } bind
{ mrows 1 sub 0 } bind { 0 mcols 4 sub } bind
{ 0 mcols 3 sub } bind { 0 mcols 2 sub } bind
{ 0 mcols 1 sub } bind { 1 mcols 1 sub } bind
] def
-
+
/dmc3 [
{ mrows 3 sub 0 } bind { mrows 2 sub 0 } bind
{ mrows 1 sub 0 } bind { 0 mcols 2 sub } bind
{ 0 mcols 1 sub } bind { 1 mcols 1 sub } bind
{ 2 mcols 1 sub } bind { 3 mcols 1 sub } bind
] def
-
+
/dmc4 [
{ mrows 1 sub 0 } bind { mrows 1 sub mcols 1 sub } bind
{ 0 mcols 3 sub } bind { 0 mcols 2 sub } bind
@@ -13676,8 +15011,8 @@
/cwpos 0 def
0 1 rows 1 sub {
/i exch def
- i rrows 2 add mod 0 eq { pixs i cols mul [ cols 2 idiv {1 0} repeat ] putinterval } if
- i rrows 2 add mod rrows 1 add eq { pixs i cols mul [ cols {1} repeat ] putinterval } if
+ i rrows 2 add mod 0 eq { pixs i cols mul [ cols 2 idiv {1 0} repeat ] putinterval } if
+ i rrows 2 add mod rrows 1 add eq { pixs i cols mul [ cols {1} repeat ] putinterval } if
i rrows 2 add mod 0 ne i rrows 2 add mod rrows 1 add ne and {
0 1 cols 1 sub {
/j exch def
@@ -13688,7 +15023,7 @@
/cwpos cwpos 1 add def
} if
} for
- } if
+ } if
} for
% Return the arguments
@@ -13717,11 +15052,11 @@
% --BEGIN ENCODER qrcode--
% --REQUIRES preamble raiseerror renmatrix--
% --DESC: QR Code
-% --EXAM: http://www.terryburton.co.uk/barcodewriter/
+% --EXAM: http://goo.gl/0bis
% --EXOP: eclevel=M
% --RNDR: renmatrix
-%%BeginResource: uk.co.terryburton.bwipp qrcode 0.0 2014013000 245432 260692
-%%BeginData: 934 ASCII Lines
+%%BeginResource: uk.co.terryburton.bwipp qrcode 0.0 2014121100 261342 297027
+%%BeginData: 1004 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
@@ -13735,12 +15070,11 @@
/barcode exch def
/dontdraw false def
- /format (full) def % full or micro
- /version (unset) def
+ /format (full) def % full or micro or any
+ /version (unset) def % 1-40 or M1-M4
/eclevel (unset) def % L, M, Q or H
- /encoding (unset) def
- /raw false def
/parse false def
+ /parsefnc false def
% Parse the input options
options type /stringtype eq {
@@ -13770,359 +15104,426 @@
length j add /j exch def
/barcode msg 0 j getinterval def
exit
+ } ifelse
+ } loop
+ } if
+
+ /barlen barcode length def
+
+ % Convert input into bytes accounting for FNC characters
+ /fn1 -1 def
+ /fncvals <<
+ (FNC1) fn1
+ >> def
+ /msg barlen array def
+ /i 0 def /j 0 def {
+ i barlen eq {exit} if
+ /char barcode i get def
+ parsefnc char 94 eq and i barlen 4 sub lt and {
+ barcode i 1 add get 94 ne {
+ /char fncvals barcode i 1 add 4 getinterval get def
+ /i i 4 add def
+ } {
+ /i i 1 add def
} ifelse
- } loop
- } if
-
- /barlen barcode length def
+ } if
+ msg j char put
+ /i i 1 add def
+ /j j 1 add def
+ } loop
+ /msg msg 0 j getinterval def
+ /msglen msg length def
+
+ % If FNC1 in first position then escape % as %%
+ /fnc1first false def
+ msglen 0 gt {
+ msg 0 get fn1 eq {
+ /fnc1first true def
+ /msg [ msg 1 msglen 1 sub getinterval { dup 37 eq {dup} if } forall ] def
+ /msglen msg length def
+ } if
+ } if
% Default error correction level
eclevel (unset) eq {/eclevel format (full) eq {(M)} {(L)} ifelse def} if
% Convert from input into message bitstream
- raw {/encoding (raw) def} if
- encoding (raw) eq {
- /msgbits barcode def
- } {
-
- % Symbol capacities
- /fullcaps <<
- /numeric <<
- /L [ 41 77 127 187 255 322 370 461 552 652 % 1-L - 10-L
- 772 883 1022 1101 1250 1408 1548 1725 1903 2061 % 11-L - 20-L
- 2232 2409 2620 2812 3057 3283 3517 3669 3909 4158 % 21-L - 30-L
- 4417 4686 4965 5253 5529 5836 6153 6479 6743 7089 ] % 31-L - 40-L
- /M [ 34 63 101 149 202 255 293 365 432 513 % 1-M - 10-M
- 604 691 796 871 991 1082 1212 1346 1500 1600 % 11-M - 20-M
- 1708 1872 2059 2188 2395 2544 2701 2857 3035 3289 % 21-M - 30-M
- 3486 3693 3909 4134 4343 4588 4775 5039 5313 5596 ] % 31-M - 40-M
- /Q [ 27 48 77 111 144 178 207 259 312 364 % 1-Q - 10-Q
- 427 489 580 621 703 775 876 948 1063 1159 % 11-Q - 20-Q
- 1224 1358 1468 1588 1718 1804 1933 2085 2181 2358 % 21-Q - 30-Q
- 2473 2670 2805 2949 3081 3244 3417 3599 3791 3993 ] % 31-Q - 40-Q
- /H [ 17 34 58 82 106 139 154 202 235 288 % 1-H - 10-H
- 331 374 427 468 530 602 674 746 813 919 % 11-H - 20-H
- 969 1056 1108 1228 1286 1425 1501 1581 1677 1782 % 21-H - 30-H
- 1897 2022 2157 2301 2361 2524 2625 2735 2927 3057 ] % 31-H - 40-H
- >>
- /alphanumeric <<
- /L [ 25 47 77 114 154 195 224 279 335 395 % 1-L - 10-L
- 468 535 619 667 758 854 938 1046 1153 1249 % 11-L - 20-L
- 1352 1460 1588 1704 1853 1990 2132 2223 2369 2520 % 21-L - 30-L
- 2677 2840 3009 3183 3351 3537 3729 3927 4087 4296 ] % 31-L - 40-L
- /M [ 20 38 61 90 122 154 178 221 262 311 % 1-M - 10-M
- 366 419 483 528 600 656 734 816 909 970 % 11-M - 20-M
- 1035 1134 1248 1326 1451 1542 1637 1732 1839 1994 % 21-M - 30-M
- 2113 2238 2369 2506 2632 2780 2894 3054 3220 3391 ] % 31-M - 40-M
- /Q [ 16 29 47 67 87 108 125 157 189 221 % 1-Q - 10-Q
- 259 296 352 376 426 470 531 574 644 702 % 11-Q - 20-Q
- 742 823 890 963 1041 1094 1172 1263 1322 1429 % 21-Q - 30-Q
- 1499 1618 1700 1787 1867 1966 2071 2181 2298 2420 ] % 31-Q - 40-Q
- /H [ 10 20 35 50 64 84 93 122 143 174 % 1-H - 10-H
- 200 227 259 283 321 365 408 452 493 557 % 11-H - 20-H
- 587 640 672 744 779 864 910 958 1016 1080 % 21-H - 30-H
- 1150 1226 1307 1394 1431 1530 1591 1658 1774 1852 ] % 31-H - 40-H
- >>
- /byte <<
- /L [ 17 32 53 78 106 134 154 192 230 271 % 1-L - 10-L
- 321 367 425 458 520 586 644 718 792 858 % 11-L - 20-L
- 929 1003 1091 1171 1273 1367 1465 1528 1628 1732 % 21-L - 30-L
- 1840 1952 2068 2188 2303 2431 2563 2699 2809 2953 ] % 31-L - 40-L
- /M [ 14 26 42 62 84 106 122 152 180 213 % 1-M - 10-M
- 251 287 331 362 412 450 504 560 624 666 % 11-M - 20-M
- 711 779 857 911 997 1059 1125 1190 1264 1370 % 21-M - 30-M
- 1452 1538 1628 1722 1809 1911 1989 2099 2213 2331 ] % 31-M - 40-M
- /Q [ 11 20 32 46 60 74 86 108 130 151 % 1-Q - 10-Q
- 177 203 241 258 292 322 364 394 442 482 % 11-Q - 20-Q
- 509 565 611 661 715 751 805 868 908 982 % 21-Q - 30-Q
- 1030 1112 1168 1228 1283 1351 1423 1499 1579 1663 ] % 31-Q - 40-Q
- /H [ 7 14 24 34 44 58 64 84 98 119 % 1-H - 10-H
- 137 155 177 194 220 250 280 310 338 382 % 11-H - 20-H
- 403 439 461 511 535 593 625 658 698 742 % 21-H - 30-H
- 790 842 898 958 983 1051 1093 1139 1219 1273 ] % 31-H - 40-H
- >>
- /kanji <<
- /L [ 10 20 32 48 65 82 95 118 141 167 % 1-L - 10-L
- 198 226 262 282 320 361 397 442 488 528 % 11-L - 20-L
- 572 618 672 721 784 842 902 940 1002 1066 % 21-L - 30-L
- 1132 1201 1273 1347 1417 1496 1577 1661 1729 1817 ] % 31-L - 40-L
- /M [ 8 16 26 38 52 65 75 93 111 131 % 1-M - 10-M
- 155 177 204 223 254 277 310 345 384 410 % 11-M - 20-M
- 438 480 528 561 614 652 692 732 778 843 % 21-M - 30-M
- 894 947 1002 1060 1113 1176 1224 1292 1362 1435 ] % 31-M - 40-M
- /Q [ 7 12 20 28 37 45 53 66 80 93 % 1-Q - 10-Q
- 109 125 149 159 180 198 224 243 272 297 % 11-Q - 20-Q
- 314 348 376 407 440 462 496 534 559 604 % 21-Q - 30-Q
- 634 684 719 756 790 832 876 923 972 1024 ] % 31-Q - 40-Q
- /H [ 4 8 15 21 27 36 39 52 60 74 % 1-H - 10-H
- 85 96 109 120 136 154 173 191 208 235 % 11-H - 20-H
- 248 270 284 315 330 365 385 405 430 457 % 21-H - 30-H
- 486 518 553 590 605 647 673 701 750 784 ] % 31-H - 40-H
- >>
- >> def
-
- % M1 M2 M3 M4 M1 M2 M3 M4 M1 M2 M3 M4 M1 M2 M3 M4
- /microcaps <<
- /numeric <<
- /L [ 5 10 23 35 ] /M [ -1 8 18 30 ] /Q [ -1 -1 -1 21 ] /H [ -1 -1 -1 -1 ]
- >>
- /alphanumeric <<
- /L [ -1 6 14 21 ] /M [ -1 5 11 18 ] /Q [ -1 -1 -1 13 ] /H [ -1 -1 -1 -1 ]
- >>
- /byte <<
- /L [ -1 -1 9 15 ] /M [ -1 -1 7 13 ] /Q [ -1 -1 -1 9 ] /H [ -1 -1 -1 -1 ]
- >>
- /kanji <<
- /L [ -1 -1 6 9 ] /M [ -1 -1 4 8 ] /Q [ -1 -1 -1 5 ] /H [ -1 -1 -1 -1 ]
- >>
- >> def
-
- /encvals <<
- /numeric 0
- /alphanumeric 1
- /byte 2
- /kanji 3
- >> def
-
- /encs <<
- /numeric /encnumeric
- /alphanumeric /encalphanumeric
- /byte /encbyte
- /kanji /enckanji
- >> def
-
- % N A B K
- /mids [ (0001) (0010) (0100) (1000) ] def
- /mids <<
- /M1 [ () -1 -1 -1 ]
- /M2 [ (0) (1) -1 -1 ]
- /M3 [ (00) (01) (10) (11) ]
- /M4 [ (000) (001) (010) (011) ]
- 1 1 40 {2 string 10 exch cvrs mids} for
- >> def
-
- % N A B K
- /cc1to9 [ 10 9 8 8 ] def
- /cc10to26 [ 12 11 16 10 ] def
- /cc27to40 [ 14 13 16 12 ] def
- /cclens <<
- /M1 [ 3 -1 -1 -1 ]
- /M2 [ 4 3 -1 -1 ]
- /M3 [ 5 4 4 3 ]
- /M4 [ 6 5 5 4 ]
- 1 1 9 { 2 string 10 exch cvrs cc1to9 } for
- 10 1 26 { 2 string 10 exch cvrs cc10to26 } for
- 27 1 40 { 2 string 10 exch cvrs cc27to40 } for
- >> def
-
- % Alphanumeric character to value map
- /charmap (0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:) def
- /charvals 44 dict def
- 0 1 44 {dup charmap exch get exch charvals 3 1 roll put} for
-
- /encnumeric {
- /in exch def
- /out in length 10 mul 3 idiv 1 add string def
- /i 0 def /j 0 def {
- i in length eq {exit} if
- i in length 2 sub lt {
- (0000000000) 10 string copy
- dup in i 3 getinterval cvi
- 2 10 string cvrs dup length 10 exch sub exch putinterval
- /i i 3 add def
- } {
- i in length 2 sub eq { % Two final digits
- (0000000) 7 string copy
- dup in i 2 getinterval cvi
- 2 7 string cvrs dup length 7 exch sub exch putinterval
- /i i 2 add def
- } { % One final digit
- (0000) 4 string copy
- dup in i 1 getinterval cvi
- 2 4 string cvrs dup length 4 exch sub exch putinterval
- /i i 1 add def
- } ifelse
+ /N 0 def /A 1 def /B 2 def /K 3 def
+
+ /Nexcl <<
+ [
+ 16#30 1 16#39 {} for
+ ] {-1} forall
+ >> def
+
+ /Aexcl <<
+ [
+ 16#20 16#24 16#25 16#2A 16#2B 16#2D 16#2E 16#2F 16#3A
+ 16#41 1 16#5A {} for
+ ] {-1} forall
+ >> def
+
+ /Bexcl <<
+ [
+ 16#00 1 16#1F {} for
+ 16#21 16#22 16#23 16#26 16#27 16#28 16#29 16#2C
+ 16#3B 1 16#40 {} for
+ 16#5B 1 16#7F {} for
+ 16#A0 1 16#DF {} for
+ ] {-1} forall
+ >> def
+
+ /Kexcl <<
+ [
+ 16#81 1 16#9F {} for
+ 16#E0 1 16#EB {} for
+ ] {-1} forall
+ >> def
+
+ /mids [ % N A B K
+ [ (0001) (0010) (0100) (1000) ] % 1-9
+ [ (0001) (0010) (0100) (1000) ] % 10-26
+ [ (0001) (0010) (0100) (1000) ] % 27-40
+ [ () -1 -1 -1 ] % M1
+ [ (0) (1) -1 -1 ] % M2
+ [ (00) (01) (10) (11) ] % M3
+ [ (000) (001) (010) (011) ] % M4
+ ] def
+
+ /cclens [ % N A B K
+ [ 10 9 8 8 ] % 1-9
+ [ 12 11 16 10 ] % 10-26
+ [ 14 13 16 12 ] % 27-40
+ [ 3 -1 -1 -1 ] % M1
+ [ 4 3 -1 -1 ] % M2
+ [ 5 4 4 3 ] % M3
+ [ 6 5 5 4 ] % M4
+ ] def
+
+ /termlens [ 4 4 4 3 5 7 9 ] def
+
+ % Encoding functions
+ /tobin {
+ string dup length 1 sub 0 exch 1 exch {1 index exch 48 put} for
+ dup 3 -1 roll 2 2 index length string cvrs dup length 2 index length exch sub exch putinterval
+ } bind def
+
+ % Alphanumeric character to value map
+ /charmap (0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:) def
+ /charvals 44 dict def
+ 0 1 44 {dup charmap exch get exch charvals 3 1 roll put} for
+
+ /encA {
+ /in exch def
+ fnc1first { % FNC1 as %
+ /in [ in { dup -1 eq {pop 37} if } forall ] def
+ } if
+ /out in length 11 mul 2 idiv 1 add string def
+ /k 0 def /m 0 def {
+ k in length eq {exit} if
+ k in length 1 sub lt {
+ charvals in k get get 45 mul charvals in k 1 add get get add 11 tobin
+ /k k 2 add def
+ } { % Final character
+ charvals in k get get 6 tobin
+ /k k 1 add def
+ } ifelse
+ dup out exch m exch putinterval
+ length m add /m exch def
+ } loop
+ out 0 m getinterval
+ } bind def
+
+ /encN {
+ /in exch def
+ /out in length 10 mul 3 idiv 1 add string def
+ /k 0 def /m 0 def {
+ k in length eq {exit} if
+ k in length 2 sub lt {
+ in k 3 getinterval 0 exch {exch 10 mul 48 sub add} forall 10 tobin
+ /k k 3 add def
+ } {
+ k in length 2 sub eq { % Two final digits
+ in k 2 getinterval 0 exch {exch 10 mul 48 sub add} forall 7 tobin
+ /k k 2 add def
+ } { % One final digit
+ in k 1 getinterval 0 exch {exch 10 mul 48 sub add} forall 4 tobin
+ /k k 1 add def
} ifelse
- dup out exch j exch putinterval
- length j add /j exch def
+ } ifelse
+ dup out exch m exch putinterval
+ length m add /m exch def
+ } loop
+ out 0 m getinterval
+ } bind def
+
+ /encB {
+ /in exch def
+ fnc1first { % FNC1 as GS
+ /in [ in { dup -1 eq {pop 29} if } forall ] def
+ } if
+ /out in length 8 mul string def
+ 0 1 in length 1 sub {
+ /k exch def
+ in k get cvi 8 tobin
+ out k 8 mul 3 -1 roll putinterval
+ } for
+ out
+ } bind def
+
+ /encK {
+ /in exch def
+ /out in length 2 idiv 13 mul string def
+ /k 0 def /m 0 def {
+ k in length eq {exit} if
+ in k get 256 mul in k 1 add get add
+ dup 16#E040 lt {16#8140} {16#C140} ifelse sub
+ dup -8 bitshift 16#C0 mul exch 16#00FF and add
+ 13 tobin dup out exch m exch putinterval
+ length m add /m exch def
+ /k k 2 add def
+ } loop
+ out
+ } bind def
+
+ /encfuncs [ /encN /encA /encB /encK ] def
+
+ /addtobits {
+ dup bits j 3 -1 roll putinterval
+ length j add /j exch def
+ } bind def
+
+ /numNs [ msglen {0} repeat 0 ] def
+ /numAs [ msglen {0} repeat 0 ] def
+ /numBs [ msglen {0} repeat 0 ] def
+ /numKs [ msglen {0} repeat -1 ] def
+ /nextNs [ msglen {0} repeat 9999 ] def
+ /nextBs [ msglen {0} repeat 9999 ] def
+ /nextAs [ msglen {0} repeat 9999 ] def
+ /nextKs [ msglen {0} repeat 9999 ] def
+ msglen 1 sub -1 0 {
+ /i exch def
+ /barchar msg i get def
+ Kexcl barchar known {
+ nextKs i 0 put
+ numKs i numKs i 1 add get 1 add put
+ } {
+ nextKs i nextKs i 1 add get 1 add put
+ } ifelse
+ Nexcl barchar known {
+ nextNs i 0 put
+ numNs i numNs i 1 add get 1 add put
+ } {
+ nextNs i nextNs i 1 add get 1 add put
+ } ifelse
+ Bexcl barchar known {
+ nextBs i 0 put
+ numBs i numBs i 1 add get 1 add put
+ } {
+ nextBs i nextBs i 1 add get 1 add put
+ } ifelse
+ Aexcl barchar known {
+ nextAs i 0 put
+ numAs i numAs i 1 add get 1 add put
+ } {
+ nextAs i nextAs i 1 add get 1 add put
+ } ifelse
+ } for
+ /numKs [ numKs {1 add 2 idiv} forall ] def
+
+ /KbeforeB {numK exch ver get ge nextBs numK 2 mul i add get 0 eq and} bind def
+ /KbeforeA {numK exch ver get ge nextAs numK 2 mul i add get 0 eq and} bind def
+ /KbeforeN {numK exch ver get ge nextNs numK 2 mul i add get 0 eq and} bind def
+ /KbeforeE {numK exch ver get ge numK 2 mul i add msglen eq and} bind def
+ /AbeforeK {numA exch ver get ge nextKs numA i add get 0 eq and} bind def
+ /AbeforeB {numA exch ver get ge nextBs numA i add get 0 eq and} bind def
+ /AbeforeN {numA exch ver get ge nextNs numA i add get 0 eq and} bind def
+ /AbeforeE {numA exch ver get ge numA i add msglen eq and} bind def
+ /NbeforeK {numN exch ver get ge nextKs numN i add get 0 eq and} bind def
+ /NbeforeB {numN exch ver get ge nextBs numN i add get 0 eq and} bind def
+ /NbeforeA {numN exch ver get ge nextAs numN i add get 0 eq and} bind def
+ /NbeforeE {numN exch ver get ge numN i add msglen eq and} bind def
+
+ % Encode unterminated bitsream for each version group separately
+ /msgbits [-1 -1 -1 -1 -1 -1 -1] def
+ /v1to9 0 def /v10to26 1 def /v27to40 2 def /vM1 3 def /vM2 4 def /vM3 5 def /vM4 6 def
+ /e 10000 def
+ [v1to9 v10to26 v27to40 vM1 vM2 vM3 vM4] {
+ /ver exch def
+
+ % Derive optimal sequence
+ /mode -1 def /seq [] def /i 0 def {
+ i msglen ge {exit} if
+ /numK numKs i get def
+ /numB numBs i get def
+ /numA numAs i get def
+ /numN numNs i get def
+ ver vM1 eq numA 1 ge and {/seq -1 def exit} if
+ ver vM1 eq numB 1 ge and {/seq -1 def exit} if
+ ver vM1 eq numK 1 ge and {/seq -1 def exit} if
+ ver vM2 eq numB 1 ge and {/seq -1 def exit} if
+ ver vM2 eq numK 1 ge and {/seq -1 def exit} if
+ { % common exit
+ mode -1 eq { % Set initial mode
+ [ 1 1 1 e e 1 1] KbeforeA {K exit} if
+ [ 1 1 1 e e 1 1] KbeforeN {K exit} if
+ [ 5 5 6 e e 2 3] KbeforeB {K exit} if
+ [ 1 1 1 e e 1 1] KbeforeE {K exit} if
+ numK 1 ge {B exit} if
+ [ 6 7 8 e e 3 4] AbeforeB {A exit} if
+ [ 1 1 1 e 1 1 1] AbeforeE {A exit} if
+ numA 1 ge {
+ ver vM1 ne ver vM2 ne and {B} {A} ifelse exit
+ } if
+ [ 4 4 5 e e 2 3] NbeforeB {N exit} if
+ [ 1 1 1 e e 1 1] NbeforeB {B exit} if
+ [ 7 8 9 e 3 4 5] NbeforeA {N exit} if
+ [ 1 1 1 e 1 1 1] NbeforeA {A exit} if
+ numN 1 ge {N exit} if
+ B exit
+ } if
+ mode B eq {
+ [ 9 12 13 e e 4 5] KbeforeB {K exit} if
+ [ 9 10 12 e e 4 5] KbeforeA {K exit} if
+ [ 9 10 11 e e 5 6] KbeforeN {K exit} if
+ [ 4 5 6 e e 2 3] KbeforeE {K exit} if
+ [11 12 14 e e 5 7] AbeforeK {A exit} if
+ [11 15 16 e e 6 7] AbeforeB {A exit} if
+ [12 13 15 e e 6 8] AbeforeN {A exit} if
+ [ 6 7 8 e e 3 4] AbeforeE {A exit} if
+ [ 6 7 8 e e 3 4] NbeforeK {N exit} if
+ [ 6 8 9 e e 3 4] NbeforeB {N exit} if
+ [ 6 7 8 e e 3 4] NbeforeA {N exit} if
+ [ 3 4 5 e e 2 3] NbeforeE {N exit} if
+ B exit
+ } if
+ mode A eq {
+ numK 1 ge {K exit} if
+ numB 1 ge {B exit} if
+ [13 15 17 e 5 7 9] NbeforeA {N exit} if
+ [13 17 18 e e 7 9] NbeforeB {N exit} if
+ [ 7 8 9 e 3 4 5] NbeforeE {N exit} if
+ A exit
+ } if
+ mode N eq {
+ numK 1 ge {K exit} if
+ numB 1 ge {B exit} if
+ numA 1 ge {A exit} if
+ N exit
+ } if
+ mode K eq {
+ numB 1 ge {B exit} if
+ numA 1 ge {A exit} if
+ numN 1 ge {N exit} if
+ K exit
+ } if
} loop
- out 0 j getinterval
- } bind def
-
- /encalphanumeric {
- /in exch def
- /out in length 11 mul 2 idiv 1 add string def
- /i 0 def /j 0 def {
- i in length eq {exit} if
- i in length 1 sub lt {
- (00000000000) 11 string copy
- dup charvals in i get get 45 mul charvals in i 1 add get get add
- 2 11 string cvrs dup length 11 exch sub exch putinterval
- /i i 2 add def
- } {
- (000000) 6 string copy
- dup charvals in i get get
- 2 6 string cvrs dup length 6 exch sub exch putinterval
- /i i 1 add def
- } ifelse
- dup out exch j exch putinterval
- length j add /j exch def
- } loop
- out 0 j getinterval
- } bind def
-
- /encbyte {
- /in exch def
- /out in length 8 mul string def
- 0 1 in length 1 sub {
+ dup K eq fnc1first and {pop B} if % No kanji with fnc1first
+ dup mode eq { % Same mode encode directly
+ pop
+ /dat msg i mode K eq {2} {1} ifelse getinterval def
+ /seq [
+ seq aload pop
+ [ exch aload pop dat aload pop ]
+ ] def
+ } { % Change mode
+ /mode exch def
+ mode K eq {K msg i numK 2 mul getinterval} if
+ mode B eq {B msg i numB getinterval} if
+ mode A eq {A msg i numA getinterval} if
+ mode N eq {N msg i numN getinterval} if
+ /dat exch def /sw exch def
+ /seq [ seq aload pop sw dat ] def
+ } ifelse
+ /i i dat length add def
+ } loop
+
+ % Encode the sequence
+ { % common exit
+ seq -1 eq {exit} if % Sequence not available
+ /bits 23648 string def
+ /j 0 def
+ fnc1first {(0101) addtobits} if
+ /abort false def
+ 0 2 seq length 1 sub {
/i exch def
- (00000000) 8 string copy
- dup in i get cvi
- 2 8 string cvrs dup length 8 exch sub exch putinterval
- out i 8 mul 3 -1 roll putinterval
+ /mode seq i get def
+ mids ver get mode get addtobits
+ /cclen cclens ver get mode get def
+ /chars seq i 1 add get def
+ chars length 2 cclen exp cvi ge { % Too many characters for cc indicator
+ /abort true def exit
+ } if
+ chars length mode K eq {2 idiv} if cclen tobin addtobits
+ chars encfuncs mode get load exec addtobits
} for
- out
- } bind def
-
- /enckanji {
- /in exch def
- /out in length 2 idiv 13 mul string def
- /i 0 def /j 0 def {
- i in length eq {exit} if
- in i get 256 mul in i 1 add get add
- dup 16#E040 lt {16#8140} {16#C140} ifelse sub
- dup -8 bitshift 16#C0 mul exch 16#00FF and add
- (0000000000000) 13 string copy
- dup 3 -1 roll 2 13 string cvrs dup length 13 exch sub exch putinterval
- dup out exch j exch putinterval
- length j add /j exch def
- /i i 2 add def
- } loop
- out
- } bind def
-
- % Determine a compact encoding for the data
- encoding (unset) eq {
- /numericokay true def
- /alphanumericokay true def
- /kanjiokay true def
- /byteokay true def
- barlen 2 mod 0 ne {/kanjiokay false def} if
- 0 1 barlen 1 sub {
- /i exch def
- /barchar barcode i get def
- barchar 48 lt barchar 57 gt or {/numericokay false def} if
- charvals barchar known not {/alphanumericokay false def} if
- i 2 mod 0 eq {
- barchar 16#81 lt barchar 16#9F gt or
- barchar 16#E0 lt barchar 16#EB gt or and {
- /kanjiokay false def
- } if
- } if
- } for
- byteokay {/encoding (byte) def} if
- kanjiokay {/encoding (kanji) def} if
- alphanumericokay {/encoding (alphanumeric) def} if
- numericokay {/encoding (numeric) def} if
- } if
-
- % Determine smallest symbol version to hold given amount of data
- /numchars barlen encoding (kanji) eq {2 idiv} if def
- version (unset) eq {
- /caps format (full) eq {fullcaps} {microcaps} ifelse encoding get eclevel get def
- /i 1 def {
- numchars caps i 1 sub get le {exit} if
- /i i 1 add def
- } loop
- /version i 10 2 string cvrs def
- format (micro) eq {
- /version (M ) 2 string copy dup version 1 exch putinterval def
- } if
- } if
-
- % Opportunistically raise the error correction level for a fit to the same symbol
- /caps format (full) eq {fullcaps} {microcaps} ifelse encoding get def
- /verval format (full) eq {version cvi 1 sub} {version 1 get 49 sub} ifelse def
- eclevel (L) eq {numchars caps /M get verval get le {/eclevel (M) def} if} if
- eclevel (M) eq {numchars caps /Q get verval get le {/eclevel (Q) def} if} if
- eclevel (Q) eq {numchars caps /H get verval get le {/eclevel (H) def} if} if
-
- % Set the control character data for the version
- /mid mids version get encvals encoding get get def
- /cclen cclens version get encvals encoding get get def
-
- % Create the bitstream as mode_id character_count encoded_data
- /enc barcode encs encoding get load exec def
- (0000000000000000) 0 cclen getinterval cclen string copy
- dup barlen encoding (kanji) eq {2 idiv} if cvi
- 2 cclen string cvrs dup length cclen exch sub exch putinterval
- /cc exch def
- /msgbits mid length cclen add enc length add string def
- msgbits 0 mid putinterval
- msgbits mid length cc putinterval
- msgbits mid length cclen add enc putinterval
-
- } ifelse
+ abort {exit} if
+ /bits bits 0 j getinterval def
+ msgbits ver bits put
+ exit
+ } loop
+ } forall
% Lookup the most appropriate symbol specification
/metrics [
- % format vers size align modules error codewords error correction blocks
- % L M Q H L1 L2 M1 M2 Q1 Q2 H1 H2
- [ (micro) (M1) 11 98 99 36 [ 2 99 99 99 ] [ 1 0 -1 -1 -1 -1 -1 -1 ] ]
- [ (micro) (M2) 13 98 99 80 [ 5 6 99 99 ] [ 1 0 1 0 -1 -1 -1 -1 ] ]
- [ (micro) (M3) 15 98 99 132 [ 6 8 99 99 ] [ 1 0 1 0 -1 -1 -1 -1 ] ]
- [ (micro) (M4) 17 98 99 192 [ 8 10 14 99 ] [ 1 0 1 0 1 0 -1 -1 ] ]
- [ (full) (1) 21 98 99 208 [ 7 10 13 17 ] [ 1 0 1 0 1 0 1 0 ] ]
- [ (full) (2) 25 18 99 359 [ 10 16 22 28 ] [ 1 0 1 0 1 0 1 0 ] ]
- [ (full) (3) 29 22 99 567 [ 15 26 36 44 ] [ 1 0 1 0 2 0 2 0 ] ]
- [ (full) (4) 33 26 99 807 [ 20 36 52 64 ] [ 1 0 2 0 2 0 4 0 ] ]
- [ (full) (5) 37 30 99 1079 [ 26 48 72 88 ] [ 1 0 2 0 2 2 2 2 ] ]
- [ (full) (6) 41 34 99 1383 [ 36 64 96 112 ] [ 2 0 4 0 4 0 4 0 ] ]
- [ (full) (7) 45 22 38 1568 [ 40 72 108 130 ] [ 2 0 4 0 2 4 4 1 ] ]
- [ (full) (8) 49 24 42 1936 [ 48 88 132 156 ] [ 2 0 2 2 4 2 4 2 ] ]
- [ (full) (9) 53 26 46 2336 [ 60 110 160 192 ] [ 2 0 3 2 4 4 4 4 ] ]
- [ (full) (10) 57 28 50 2768 [ 72 130 192 224 ] [ 2 2 4 1 6 2 6 2 ] ]
- [ (full) (11) 61 30 54 3232 [ 80 150 224 264 ] [ 4 0 1 4 4 4 3 8 ] ]
- [ (full) (12) 65 32 58 3728 [ 96 176 260 308 ] [ 2 2 6 2 4 6 7 4 ] ]
- [ (full) (13) 69 34 62 4256 [ 104 198 288 352 ] [ 4 0 8 1 8 4 12 4 ] ]
- [ (full) (14) 73 26 46 4651 [ 120 216 320 384 ] [ 3 1 4 5 11 5 11 5 ] ]
- [ (full) (15) 77 26 48 5243 [ 132 240 360 432 ] [ 5 1 5 5 5 7 11 7 ] ]
- [ (full) (16) 81 26 50 5867 [ 144 280 408 480 ] [ 5 1 7 3 15 2 3 13 ] ]
- [ (full) (17) 85 30 54 6523 [ 168 308 448 532 ] [ 1 5 10 1 1 15 2 17 ] ]
- [ (full) (18) 89 30 56 7211 [ 180 338 504 588 ] [ 5 1 9 4 17 1 2 19 ] ]
- [ (full) (19) 93 30 58 7931 [ 196 364 546 650 ] [ 3 4 3 11 17 4 9 16 ] ]
- [ (full) (20) 97 34 62 8683 [ 224 416 600 700 ] [ 3 5 3 13 15 5 15 10 ] ]
- [ (full) (21) 101 28 50 9252 [ 224 442 644 750 ] [ 4 4 17 0 17 6 19 6 ] ]
- [ (full) (22) 105 26 50 10068 [ 252 476 690 816 ] [ 2 7 17 0 7 16 34 0 ] ]
- [ (full) (23) 109 30 54 10916 [ 270 504 750 900 ] [ 4 5 4 14 11 14 16 14 ] ]
- [ (full) (24) 113 28 54 11796 [ 300 560 810 960 ] [ 6 4 6 14 11 16 30 2 ] ]
- [ (full) (25) 117 32 58 12708 [ 312 588 870 1050 ] [ 8 4 8 13 7 22 22 13 ] ]
- [ (full) (26) 121 30 58 13652 [ 336 644 952 1110 ] [ 10 2 19 4 28 6 33 4 ] ]
- [ (full) (27) 125 34 62 14628 [ 360 700 1020 1200 ] [ 8 4 22 3 8 26 12 28 ] ]
- [ (full) (28) 129 26 50 15371 [ 390 728 1050 1260 ] [ 3 10 3 23 4 31 11 31 ] ]
- [ (full) (29) 133 30 54 16411 [ 420 784 1140 1350 ] [ 7 7 21 7 1 37 19 26 ] ]
- [ (full) (30) 137 26 52 17483 [ 450 812 1200 1440 ] [ 5 10 19 10 15 25 23 25 ] ]
- [ (full) (31) 141 30 56 18587 [ 480 868 1290 1530 ] [ 13 3 2 29 42 1 23 28 ] ]
- [ (full) (32) 145 34 60 19723 [ 510 924 1350 1620 ] [ 17 0 10 23 10 35 19 35 ] ]
- [ (full) (33) 149 30 58 20891 [ 540 980 1440 1710 ] [ 17 1 14 21 29 19 11 46 ] ]
- [ (full) (34) 153 34 62 22091 [ 570 1036 1530 1800 ] [ 13 6 14 23 44 7 59 1 ] ]
- [ (full) (35) 157 30 54 23008 [ 570 1064 1590 1890 ] [ 12 7 12 26 39 14 22 41 ] ]
- [ (full) (36) 161 24 50 24272 [ 600 1120 1680 1980 ] [ 6 14 6 34 46 10 2 64 ] ]
- [ (full) (37) 165 28 54 25568 [ 630 1204 1770 2100 ] [ 17 4 29 14 49 10 24 46 ] ]
- [ (full) (38) 169 32 58 26896 [ 660 1260 1860 2220 ] [ 4 18 13 32 48 14 42 32 ] ]
- [ (full) (39) 173 26 54 28256 [ 720 1316 1950 2310 ] [ 20 4 40 7 43 22 10 67 ] ]
- [ (full) (40) 177 30 58 29648 [ 750 1372 2040 2430 ] [ 19 6 18 31 34 34 20 61 ] ]
+ % format vers vergrp size align modules error codewords error correction blocks
+ % L M Q H L1 L2 M1 M2 Q1 Q2 H1 H2
+ [ (micro) (M1) vM1 11 98 99 36 [ 2 99 99 99 ] [ 1 0 -1 -1 -1 -1 -1 -1 ] ]
+ [ (micro) (M2) vM2 13 98 99 80 [ 5 6 99 99 ] [ 1 0 1 0 -1 -1 -1 -1 ] ]
+ [ (micro) (M3) vM3 15 98 99 132 [ 6 8 99 99 ] [ 1 0 1 0 -1 -1 -1 -1 ] ]
+ [ (micro) (M4) vM4 17 98 99 192 [ 8 10 14 99 ] [ 1 0 1 0 1 0 -1 -1 ] ]
+ [ (full) (1) v1to9 21 98 99 208 [ 7 10 13 17 ] [ 1 0 1 0 1 0 1 0 ] ]
+ [ (full) (2) v1to9 25 18 99 359 [ 10 16 22 28 ] [ 1 0 1 0 1 0 1 0 ] ]
+ [ (full) (3) v1to9 29 22 99 567 [ 15 26 36 44 ] [ 1 0 1 0 2 0 2 0 ] ]
+ [ (full) (4) v1to9 33 26 99 807 [ 20 36 52 64 ] [ 1 0 2 0 2 0 4 0 ] ]
+ [ (full) (5) v1to9 37 30 99 1079 [ 26 48 72 88 ] [ 1 0 2 0 2 2 2 2 ] ]
+ [ (full) (6) v1to9 41 34 99 1383 [ 36 64 96 112 ] [ 2 0 4 0 4 0 4 0 ] ]
+ [ (full) (7) v1to9 45 22 38 1568 [ 40 72 108 130 ] [ 2 0 4 0 2 4 4 1 ] ]
+ [ (full) (8) v1to9 49 24 42 1936 [ 48 88 132 156 ] [ 2 0 2 2 4 2 4 2 ] ]
+ [ (full) (9) v1to9 53 26 46 2336 [ 60 110 160 192 ] [ 2 0 3 2 4 4 4 4 ] ]
+ [ (full) (10) v10to26 57 28 50 2768 [ 72 130 192 224 ] [ 2 2 4 1 6 2 6 2 ] ]
+ [ (full) (11) v10to26 61 30 54 3232 [ 80 150 224 264 ] [ 4 0 1 4 4 4 3 8 ] ]
+ [ (full) (12) v10to26 65 32 58 3728 [ 96 176 260 308 ] [ 2 2 6 2 4 6 7 4 ] ]
+ [ (full) (13) v10to26 69 34 62 4256 [ 104 198 288 352 ] [ 4 0 8 1 8 4 12 4 ] ]
+ [ (full) (14) v10to26 73 26 46 4651 [ 120 216 320 384 ] [ 3 1 4 5 11 5 11 5 ] ]
+ [ (full) (15) v10to26 77 26 48 5243 [ 132 240 360 432 ] [ 5 1 5 5 5 7 11 7 ] ]
+ [ (full) (16) v10to26 81 26 50 5867 [ 144 280 408 480 ] [ 5 1 7 3 15 2 3 13 ] ]
+ [ (full) (17) v10to26 85 30 54 6523 [ 168 308 448 532 ] [ 1 5 10 1 1 15 2 17 ] ]
+ [ (full) (18) v10to26 89 30 56 7211 [ 180 338 504 588 ] [ 5 1 9 4 17 1 2 19 ] ]
+ [ (full) (19) v10to26 93 30 58 7931 [ 196 364 546 650 ] [ 3 4 3 11 17 4 9 16 ] ]
+ [ (full) (20) v10to26 97 34 62 8683 [ 224 416 600 700 ] [ 3 5 3 13 15 5 15 10 ] ]
+ [ (full) (21) v10to26 101 28 50 9252 [ 224 442 644 750 ] [ 4 4 17 0 17 6 19 6 ] ]
+ [ (full) (22) v10to26 105 26 50 10068 [ 252 476 690 816 ] [ 2 7 17 0 7 16 34 0 ] ]
+ [ (full) (23) v10to26 109 30 54 10916 [ 270 504 750 900 ] [ 4 5 4 14 11 14 16 14 ] ]
+ [ (full) (24) v10to26 113 28 54 11796 [ 300 560 810 960 ] [ 6 4 6 14 11 16 30 2 ] ]
+ [ (full) (25) v10to26 117 32 58 12708 [ 312 588 870 1050 ] [ 8 4 8 13 7 22 22 13 ] ]
+ [ (full) (26) v10to26 121 30 58 13652 [ 336 644 952 1110 ] [ 10 2 19 4 28 6 33 4 ] ]
+ [ (full) (27) v27to40 125 34 62 14628 [ 360 700 1020 1200 ] [ 8 4 22 3 8 26 12 28 ] ]
+ [ (full) (28) v27to40 129 26 50 15371 [ 390 728 1050 1260 ] [ 3 10 3 23 4 31 11 31 ] ]
+ [ (full) (29) v27to40 133 30 54 16411 [ 420 784 1140 1350 ] [ 7 7 21 7 1 37 19 26 ] ]
+ [ (full) (30) v27to40 137 26 52 17483 [ 450 812 1200 1440 ] [ 5 10 19 10 15 25 23 25 ] ]
+ [ (full) (31) v27to40 141 30 56 18587 [ 480 868 1290 1530 ] [ 13 3 2 29 42 1 23 28 ] ]
+ [ (full) (32) v27to40 145 34 60 19723 [ 510 924 1350 1620 ] [ 17 0 10 23 10 35 19 35 ] ]
+ [ (full) (33) v27to40 149 30 58 20891 [ 540 980 1440 1710 ] [ 17 1 14 21 29 19 11 46 ] ]
+ [ (full) (34) v27to40 153 34 62 22091 [ 570 1036 1530 1800 ] [ 13 6 14 23 44 7 59 1 ] ]
+ [ (full) (35) v27to40 157 30 54 23008 [ 570 1064 1590 1890 ] [ 12 7 12 26 39 14 22 41 ] ]
+ [ (full) (36) v27to40 161 24 50 24272 [ 600 1120 1680 1980 ] [ 6 14 6 34 46 10 2 64 ] ]
+ [ (full) (37) v27to40 165 28 54 25568 [ 630 1204 1770 2100 ] [ 17 4 29 14 49 10 24 46 ] ]
+ [ (full) (38) v27to40 169 32 58 26896 [ 660 1260 1860 2220 ] [ 4 18 13 32 48 14 42 32 ] ]
+ [ (full) (39) v27to40 173 26 54 28256 [ 720 1316 1950 2310 ] [ 20 4 40 7 43 22 10 67 ] ]
+ [ (full) (40) v27to40 177 30 58 29648 [ 750 1372 2040 2430 ] [ 19 6 18 31 34 34 20 61 ] ]
] def
/eclval (LMQH) eclevel search pop length exch pop exch pop def
- /i 0 def
- { % loop
+ 0 1 43 {
+ /i exch def
/m metrics i get def
/frmt m 0 get def % Format of the symbol
/vers m 1 get def % Version of symbol
- /size m 2 get def % Length of side
- /asp2 m 3 get def % Position of second alignment symbol
- /asp3 m 4 get def % Position of third alignment symbol
- /nmod m 5 get def % Number of modules
+ /vergrp m 2 get def % Version group
+ /size m 3 get def % Length of side
+ /asp2 m 4 get def % Position of second alignment symbol
+ /asp3 m 5 get def % Position of third alignment symbol
+ /nmod m 6 get def % Number of modules
/ncws nmod 8 idiv def % Total number of codewords
/rbit nmod 8 mod def % Number of remainder bits
/lc4b false def % Last data codeword is 4 bits long
@@ -14131,33 +15532,37 @@
/rbit 0 def
/lc4b true def
} if
- /ecws m 6 get eclval get def % Number of error correction codewords
+ /ecws m 7 get eclval get def % Number of error correction codewords
/dcws ncws ecws sub def % Number of data codewords
/dmod dcws 8 mul lc4b {4} {0} ifelse sub def % Number of data modules
- /ecb1 m 7 get eclval 2 mul get def % First error correction blocks
- /ecb2 m 7 get eclval 2 mul 1 add get def % Second error correction blocks
+ /ecb1 m 8 get eclval 2 mul get def % First error correction blocks
+ /ecb2 m 8 get eclval 2 mul 1 add get def % Second error correction blocks
/okay true def
- format frmt ne {/okay false def} if % The format must match that supplied
+ format (any) ne format frmt ne and {/okay false def} if % The format must match that supplied
+ frmt (micro) eq fnc1first and {/okay false def} if
version (unset) ne version vers ne and {/okay false def} if % The version must match that supplied
- msgbits length dmod gt {/okay false def} if % Bitstream must fit into data modules
ecb1 -1 eq ecb2 -1 eq or {/okay false def} if % Error correction level must be valid
+ /verbits msgbits vergrp get def
+ verbits -1 eq { % Bitstream must be available
+ /okay false def
+ } {
+ verbits length dmod gt {/okay false def} if % and fit into data modules
+ } ifelse
+ /term (000000000) 0 termlens vergrp get getinterval def
okay {exit} if
- /i i 1 add def
- } loop
+ } for
+
+ okay not {
+ /bwipp.qrcodeNoValidSymbol (No valid symbol available) //raiseerror exec
+ } if
/format frmt def
/version vers def
+ /msgbits verbits def
/dcpb dcws ecb1 ecb2 add idiv def % Base data codewords per block
/ecpb ncws ecb1 ecb2 add idiv dcpb sub def % Error correction codewords per block
% Complete the message bits by adding the terminator, truncated if neccessary
- /terms <<
- /M1 (000)
- /M2 (00000)
- /M3 (0000000)
- /M4 (000000000)
- >> def
- /term terms version known {terms version get} {(0000)} ifelse def
/term term 0 dmod msgbits length sub term length 2 copy gt {exch} if pop getinterval def
msgbits length term length add string
dup 0 msgbits putinterval
@@ -14171,12 +15576,12 @@
/padstrs [ (11101100) (00010001) ] def
/padnum 0 def
msgbits length 8 div ceiling 8 mul cvi 8 dmod lc4b {5} {1} ifelse sub {
- pad exch padstrs padnum get putinterval
+ pad exch padstrs padnum get putinterval
/padnum padnum 1 add 2 mod def
} for
% Evaluate the padded message into codewords
- /cws dcws array def
+ /cws dcws array def
0 1 cws length 1 sub {
/c exch def
/bpcw 8 def
@@ -14186,9 +15591,9 @@
0 1 bpcw 1 sub {
/i exch def
/cw cw 2 bpcw i sub 1 sub exp cvi cwb i get 48 sub mul add def
- } for
+ } for
cws c cw put
- } for
+ } for
% Calculate the log and anti-log tables
/rsalog [ 1 255 { dup 2 mul dup 256 ge {285 xor} if } repeat ] def
@@ -14197,7 +15602,7 @@
% Function to calculate the product in the field
/rsprod {
- 2 copy 0 ne exch 0 ne and {
+ 2 copy 0 ne exch 0 ne and {
rslog exch get exch rslog exch get add 255 mod rsalog exch get
} {
pop pop 0
@@ -14207,12 +15612,12 @@
% Generate the coefficients for the Reed-Solomon algorithm
/coeffs [ 1 ecpb {0} repeat ] def
0 1 ecpb 1 sub {
- /i exch def
+ /i exch def
coeffs i 1 add coeffs i get put
i -1 1 {
/j exch def
coeffs j coeffs j 1 sub get coeffs j get rsalog i get rsprod xor put
- } for
+ } for
coeffs 0 coeffs 0 get rsalog i get rsprod put
} for
/coeffs coeffs 0 coeffs length 1 sub getinterval def
@@ -14246,7 +15651,7 @@
dcwsb ecb1 i add cws ecb1 dcpb mul i dcpb 1 add mul add dcpb 1 add getinterval put
ecwsb ecb1 i add dcwsb ecb1 i add get rscodes put
} for
-
+
% Reassemble the codewords
/cws ncws array def
/cw 0 def
@@ -14268,7 +15673,7 @@
/cw cw 1 add def
} for
} for
-
+
% Extend codewords by one if there are remainder bits
rbit 0 gt {
/pad cws length 1 add array def
@@ -14276,7 +15681,7 @@
pad pad length 1 sub 0 put
/cws pad def
} if
-
+
% Fixups for the short final data byte in M1 and M3 symbols
lc4b {
dcws 1 sub 1 ncws 2 sub {
@@ -14290,7 +15695,7 @@
% Create the bitmap
/pixs [ size size mul {-1} repeat ] def
/qmv {size mul add} bind def
-
+
% Finder patterns
/fpat [
[ 1 1 1 1 1 1 1 0 ]
@@ -14314,7 +15719,7 @@
} if
} for
} for
-
+
% Alignment patterns
/algnpat [
[ 1 1 1 1 1 ]
@@ -14339,14 +15744,14 @@
i 4 putalgnpat
4 i putalgnpat
} for
- asp2 2 sub asp3 asp2 sub size 9 sub {
+ asp2 2 sub asp3 asp2 sub size 9 sub {
/x exch def
asp2 2 sub asp3 asp2 sub size 9 sub {
/y exch def
x y putalgnpat
} for
} for
-
+
% Timing patterns
format (full) eq {
8 1 size 9 sub {
@@ -14361,7 +15766,7 @@
pixs 0 i qmv i 1 add 2 mod put
} for
} ifelse
-
+
% Format information modules
format (full) eq {
/formatmap [
@@ -14381,7 +15786,7 @@
formatmap {
{ {} forall qmv pixs exch 0 put } forall
} forall
-
+
% Version information modules
size 45 ge {
/versionmap [
@@ -14401,15 +15806,15 @@
versionmap {
{ {} forall qmv pixs exch 0 put } forall
} forall
-
+
% Solitary dark module in full symbols
format (full) eq {
pixs 8 size 8 sub qmv 1 put
} if
-
+
% Calculate the mask patterns
format (full) eq {
- /maskfuncs [
+ /maskfuncs [
{add 2 mod} bind
{exch pop 2 mod} bind
{pop 3 mod} bind
@@ -14420,7 +15825,7 @@
{2 copy mul 3 mod 3 1 roll add 2 mod add 2 mod} bind
] def
} {
- /maskfuncs [
+ /maskfuncs [
{exch pop 2 mod} bind
{2 idiv exch 3 idiv add 2 mod} bind
{mul dup 2 mod exch 3 mod add 2 mod} bind
@@ -14435,14 +15840,14 @@
/j exch def
0 1 size 1 sub {
/i exch def
- i j maskfuncs m get exec 0 eq
+ i j maskfuncs m get exec 0 eq
pixs i j qmv get -1 eq and {1} {0} ifelse
mask i j qmv 3 -1 roll put
} for
} for
masks m mask put
} for
-
+
% Walk the symbol placing the bitstream
/posx size 1 sub def
/posy size 1 sub def
@@ -14461,7 +15866,7 @@
/posx posx 1 sub def
} {
/col 1 def
- /posx posx 1 add def
+ /posx posx 1 add def
/posy posy dir add def
posy 0 lt posy size ge or { % Turn around at top and bottom
/dir dir -1 mul def
@@ -14497,7 +15902,7 @@
} for
scr1 scr3
} bind def
-
+
% Evaluation algorithm for full symbols
/evalfull {
/sym exch def
@@ -14507,7 +15912,7 @@
/lastpairs size array def
/thispairs size array def
/sizeadd1 size 1 add def
- 0 1 size 1 sub {
+ 0 1 size 1 sub {
/i exch def
% Runlength encode (light, dark, light, ...) and evaluate each column
@@ -14522,10 +15927,10 @@
% Runlength encode (light, dark, light, ...) and evaluate each row
/symrow sym i size mul size getinterval def
- mark 0 0
- symrow {
+ mark 0 0
+ symrow {
exch 1 index eq {exch 1 add exch} {1 exch} ifelse
- } forall
+ } forall
pop
rle 0 counttomark 2 sub getinterval astore
evalfulln1n3 n3 add /n3 exch def n1 add /n1 exch def
@@ -14546,14 +15951,14 @@
} if
} for
-
- % Score dark/light imbalance
+
+ % Score dark/light imbalance
/dark 0 sym {add} forall def
/n4 dark 100 mul size dup mul div 50 sub abs 5 div cvi 10 mul def
n1 n2 add n3 add n4 add
} bind def
-
+
% Evaluation algorithm for micro symbols
/evalmicro {
/sym exch def
@@ -14569,7 +15974,7 @@
dkbot 16 mul dkrhs add neg
} ifelse
} bind def
-
+
% Evaluate the masked symbols to find the most suitable
/bestscore 999999999 def
0 1 masks length 1 sub {
@@ -14584,20 +15989,20 @@
} {
masksym evalmicro /score exch def
} ifelse
- score bestscore lt {
+ score bestscore lt {
/bestsym masksym def
/bestmaskval m def
/bestscore score def
- } if
+ } if
} for
/pixs bestsym def
-
+
% Add the format information
format (full) eq {
/fmtvals [
- 16#5412 16#5125 16#5e7c 16#5b4b 16#45f9 16#40ce 16#4f97 16#4aa0
+ 16#5412 16#5125 16#5e7c 16#5b4b 16#45f9 16#40ce 16#4f97 16#4aa0
16#77c4 16#72f3 16#7daa 16#789d 16#662f 16#6318 16#6c41 16#6976
- 16#1689 16#13be 16#1ce7 16#19d0 16#0762 16#0255 16#0d0c 16#083b
+ 16#1689 16#13be 16#1ce7 16#19d0 16#0762 16#0255 16#0d0c 16#083b
16#355f 16#3068 16#3f31 16#3a06 16#24b4 16#2183 16#2eda 16#2bed
] def
/ecid (MLHQ) eclevel search pop length exch pop exch pop def
@@ -14618,14 +16023,14 @@
pixs exch {} forall qmv fmtval 14 i sub neg bitshift 1 and put
} forall
} for
-
+
% Add the version information
size 45 ge {
/vervals [
- 16#07c94 16#085bc 16#09a99 16#0a4d3 16#0bbf6 16#0c762 16#0d847
- 16#0e60d 16#0f928 16#10b78 16#1145d 16#12a17 16#13532 16#149a6
- 16#15683 16#168c9 16#177ec 16#18ec4 16#191e1 16#1afab 16#1b08e
- 16#1cc1a 16#1d33f 16#1ed75 16#1f250 16#209d5 16#216fd 16#228ba
+ 16#07c94 16#085bc 16#09a99 16#0a4d3 16#0bbf6 16#0c762 16#0d847
+ 16#0e60d 16#0f928 16#10b78 16#1145d 16#12a17 16#13532 16#149a6
+ 16#15683 16#168c9 16#177ec 16#18ec4 16#191e1 16#1afab 16#1b08e
+ 16#1cc1a 16#1d33f 16#1ed75 16#1f250 16#209d5 16#216fd 16#228ba
16#2379f 16#24b0b 16#2542e 16#26a64 16#27541 16#28c69
] def
/verval vervals size 17 sub 4 idiv 7 sub get def
@@ -14666,7 +16071,7 @@
% --EXAM: [)>^03001^02996152382802^029840^029001^0291Z00004951^029UPSN^02906X610^029159^0291234567^0291/1^029^029Y^029634 ALPHA DR^029PITTSBURGH^029PA^029^004
% --EXOP: mode=2 parse
% --RNDR: renmaximatrix
-%%BeginResource: uk.co.terryburton.bwipp maxicode 0.0 2014013000 129420 134959
+%%BeginResource: uk.co.terryburton.bwipp maxicode 0.0 2014121100 125796 124711
%%BeginData: 564 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -14716,10 +16121,10 @@
length j add /j exch def
/barcode msg 0 j getinterval def
exit
- } ifelse
+ } ifelse
} loop
} if
-
+
/msg barcode def
/msglen msg length def
@@ -14729,7 +16134,7 @@
% Normalise messages that begin with a field identifier [)>RS01GSyy
msg 0 7 getinterval <5b293e1e30311d> eq {
/fid msg 0 9 getinterval def
- /msg msg 9 msglen 9 sub getinterval def
+ /msg msg 9 msglen 9 sub getinterval def
} {
/fid () def
} ifelse
@@ -14742,7 +16147,7 @@
% Prepend the field identifier
msg length fid length add string dup
- 0 fid putinterval dup
+ 0 fid putinterval dup
fid length msg putinterval
/msg exch def
/msglen msg length def
@@ -14753,10 +16158,10 @@
/eci -1 def /pad -2 def /ns -3 def
/la -4 def /lb -5 def
/sa -6 def /sb -7 def /sc -8 def /sd -9 def /se -10 def
- /sa2 -11 def /sa3 -12 def
+ /sa2 -11 def /sa3 -12 def
/lkc -13 def /lkd -14 def /lke -15 def
- /pd2 -16 def /pd3 -17 def
-
+ /pd2 -16 def /pd3 -17 def
+
% Character maps for each state
/charmaps [
% A B C D E
@@ -14769,7 +16174,7 @@
[ (F) (f) 198 230 6 ] % 6
[ (G) (g) 199 231 7 ] % 7
[ (H) (h) 200 232 8 ] % 8
- [ (I) (i) 201 233 9 ] % 9
+ [ (I) (i) 201 233 9 ] % 9
[ (J) (j) 202 234 10 ] % 10
[ (K) (k) 203 235 11 ] % 11
[ (L) (l) 204 236 12 ] % 12
@@ -14824,8 +16229,8 @@
[ sd sd sd lkd sd ] % 61
[ se se se se lke ] % 62
[ lb la lb lb lb ] % 63
- ] def
-
+ ] def
+
% Invert charmaps to give character to value maps for each state
/charvals [ 64 dict 64 dict 64 dict 64 dict 64 dict ] def
0 1 charmaps length 1 sub {
@@ -14834,7 +16239,7 @@
0 1 4 {
/j exch def
encs j get dup type /stringtype eq {0 get} if % convert string to ASCII if required
- charvals j get exch i put
+ charvals j get exch i put
} for
} for
/seta charvals 0 get def
@@ -14855,15 +16260,15 @@
} for
/nseq nseq 0 msglen getinterval def
- % Encode the message from ASCII to codewords
+ % Encode the message from ASCII to codewords
/prefixinset {
0 {
- 2 copy exch length ge {exit} if
+ 2 copy exch length ge {exit} if
2 copy get 3 index exch known {1 add} {exit} ifelse
} loop
exch pop exch pop
} bind def
-
+
/enc {
exch get out exch j exch put
/j j 1 add def
@@ -14881,7 +16286,7 @@
exit
} if
{ % not a loop but common exit point
-
+
% If 9 numerals available then use NS
nseq i get 9 ge {
msg i 9 getinterval cvi 4 { dup 63 and exch -6 bitshift } repeat cset load ns get
@@ -14891,19 +16296,19 @@
/j j 6 add def
exit
} if
-
+
% Read next three characters
/char1 msg i get def
/char2 i 1 add msglen lt {msg i 1 add get} {-99} ifelse def
/char3 i 2 add msglen lt {msg i 2 add get} {-99} ifelse def
-
+
% If current mode is sufficient then directly encode
- cset load char1 known {
+ cset load char1 known {
char1 cset load enc
/i i 1 add def
exit
} if
-
+
% For switching from A to B
cset (seta) eq setb char1 known and {
setb char2 known {
@@ -14916,7 +16321,7 @@
} ifelse
exit
} if
-
+
% For switching from B to A encode according to length of prefix
cset (setb) eq seta char1 known and {
/p seta msg i 4 msglen i sub 2 copy gt {exch} if pop getinterval prefixinset def
@@ -14929,14 +16334,14 @@
sa2 setb enc
char1 seta enc
char2 seta enc
- /i i 2 add def
+ /i i 2 add def
} if
p 3 eq {
sa3 setb enc
char1 seta enc
char2 seta enc
char3 seta enc
- /i i 3 add def
+ /i i 3 add def
} if
p 4 ge {
la setb enc
@@ -14944,24 +16349,24 @@
} if
exit
} if
-
+
% If character is in A or B then directly latch
seta char1 known {
la cset load enc
/cset (seta) def
exit
- } if
+ } if
setb char1 known {
lb cset load enc
/cset (setb) def
exit
- } if
-
+ } if
+
% Determine which one of sets C, D or E the character is in
setc char1 known {/setx (setc) def /sx sc def /lkx lkc def} if
setd char1 known {/setx (setd) def /sx sd def /lkx lkd def} if
sete char1 known {/setx (sete) def /sx se def /lkx lke def} if
-
+
% Encode according to the length of the prefix
/p setx load msg i 4 msglen i sub 2 copy gt {exch} if pop getinterval prefixinset def
p 1 eq {
@@ -14988,20 +16393,20 @@
p 4 ge {
sx cset load enc
lkx setx load enc
- /cset setx def
+ /cset setx def
} if
-
+
exit
} loop % out
} loop
/encmsg out 0 j getinterval def
- /padval cset load pad get def
+ /padval cset load pad get def
% Prefix the encoded message with the structured append insert
/sami [] def
sam -1 ne {
/sami 2 array def
- sami 0 seta pad get put
+ sami 0 seta pad get put
sami 1 sam 10 idiv 1 sub 8 mul sam 10 mod 1 sub add put
} if
/encmsg [ sami aload pop encmsg aload pop ] def
@@ -15020,8 +16425,8 @@
pcb pcode cvi 2 30 string cvrs dup length 36 exch sub exch putinterval
} { % mode=3
% For alphanumeric postcode, trim or pad with spaces to 6 chars and encode to binary
- /pccw [
- ( ) 6 string copy dup 0 pcode length 6 gt {pcode 0 6 getinterval} {pcode} ifelse putinterval
+ /pccw [
+ ( ) 6 string copy dup 0 pcode length 6 gt {pcode 0 6 getinterval} {pcode} ifelse putinterval
{seta exch get} forall
] def
0 1 5 {
@@ -15048,7 +16453,7 @@
% Evaluate the structured carrier message as codewords
/pri [ 0 0 0 0 0 0 0 0 0 0 ] def
- 0 1 59 {
+ 0 1 59 {
/i exch def
/ps i 6 idiv def
/ep 2 5 i 6 mod sub exp cvi scm i get 48 sub mul def
@@ -15143,9 +16548,9 @@
% Concatinate the data into final codewords
/codewords [
- pri aload pop
+ pri aload pop
pri 10 rscodes aload pop
- sec aload pop
+ sec aload pop
secchk aload pop
] def
@@ -15159,49 +16564,49 @@
% Maps modules to pixels in the grid
/modmap [
- 469 529 286 316 347 346 673 672 703 702 647 676 283 282 313 312 370 610 618 379
- 378 409 408 439 705 704 559 589 588 619 458 518 640 701 675 674 285 284 315 314
- 310 340 531 289 288 319 349 348 456 486 517 516 471 470 369 368 399 398 429 428
- 549 548 579 578 609 608 649 648 679 678 709 708 639 638 669 668 699 698 279 278
- 309 308 339 338 381 380 411 410 441 440 561 560 591 590 621 620 547 546 577 576
- 607 606 367 366 397 396 427 426 291 290 321 320 351 350 651 650 681 680 711 710
- 1 0 31 30 61 60 3 2 33 32 63 62 5 4 35 34 65 64 7 6
- 37 36 67 66 9 8 39 38 69 68 11 10 41 40 71 70 13 12 43 42
- 73 72 15 14 45 44 75 74 17 16 47 46 77 76 19 18 49 48 79 78
- 21 20 51 50 81 80 23 22 53 52 83 82 25 24 55 54 85 84 27 26
- 57 56 87 86 117 116 147 146 177 176 115 114 145 144 175 174 113 112 143 142
- 173 172 111 110 141 140 171 170 109 108 139 138 169 168 107 106 137 136 167 166
- 105 104 135 134 165 164 103 102 133 132 163 162 101 100 131 130 161 160 99 98
- 129 128 159 158 97 96 127 126 157 156 95 94 125 124 155 154 93 92 123 122
- 153 152 91 90 121 120 151 150 181 180 211 210 241 240 183 182 213 212 243 242
- 185 184 215 214 245 244 187 186 217 216 247 246 189 188 219 218 249 248 191 190
- 221 220 251 250 193 192 223 222 253 252 195 194 225 224 255 254 197 196 227 226
- 257 256 199 198 229 228 259 258 201 200 231 230 261 260 203 202 233 232 263 262
- 205 204 235 234 265 264 207 206 237 236 267 266 297 296 327 326 357 356 295 294
- 325 324 355 354 293 292 323 322 353 352 277 276 307 306 337 336 275 274 305 304
- 335 334 273 272 303 302 333 332 271 270 301 300 331 330 361 360 391 390 421 420
- 363 362 393 392 423 422 365 364 395 394 425 424 383 382 413 412 443 442 385 384
- 415 414 445 444 387 386 417 416 447 446 477 476 507 506 537 536 475 474 505 504
- 535 534 473 472 503 502 533 532 455 454 485 484 515 514 453 452 483 482 513 512
- 451 450 481 480 511 510 541 540 571 570 601 600 543 542 573 572 603 602 545 544
- 575 574 605 604 563 562 593 592 623 622 565 564 595 594 625 624 567 566 597 596
- 627 626 657 656 687 686 717 716 655 654 685 684 715 714 653 652 683 682 713 712
- 637 636 667 666 697 696 635 634 665 664 695 694 633 632 663 662 693 692 631 630
- 661 660 691 690 721 720 751 750 781 780 723 722 753 752 783 782 725 724 755 754
- 785 784 727 726 757 756 787 786 729 728 759 758 789 788 731 730 761 760 791 790
- 733 732 763 762 793 792 735 734 765 764 795 794 737 736 767 766 797 796 739 738
- 769 768 799 798 741 740 771 770 801 800 743 742 773 772 803 802 745 744 775 774
- 805 804 747 746 777 776 807 806 837 836 867 866 897 896 835 834 865 864 895 894
- 833 832 863 862 893 892 831 830 861 860 891 890 829 828 859 858 889 888 827 826
- 857 856 887 886 825 824 855 854 885 884 823 822 853 852 883 882 821 820 851 850
- 881 880 819 818 849 848 879 878 817 816 847 846 877 876 815 814 845 844 875 874
- 813 812 843 842 873 872 811 810 841 840 871 870 901 900 931 930 961 960 903 902
- 933 932 963 962 905 904 935 934 965 964 907 906 937 936 967 966 909 908 939 938
- 969 968 911 910 941 940 971 970 913 912 943 942 973 972 915 914 945 944 975 974
- 917 916 947 946 977 976 919 918 949 948 979 978 921 920 951 950 981 980 923 922
- 953 952 983 982 925 924 955 954 985 984 927 926 957 956 987 986 58 89 88 118
- 149 148 178 209 208 238 269 268 298 329 328 358 389 388 418 449 448 478 509 508
- 538 569 568 598 629 628 658 689 688 718 749 748 778 809 808 838 869 868 898 929
+ 469 529 286 316 347 346 673 672 703 702 647 676 283 282 313 312 370 610 618 379
+ 378 409 408 439 705 704 559 589 588 619 458 518 640 701 675 674 285 284 315 314
+ 310 340 531 289 288 319 349 348 456 486 517 516 471 470 369 368 399 398 429 428
+ 549 548 579 578 609 608 649 648 679 678 709 708 639 638 669 668 699 698 279 278
+ 309 308 339 338 381 380 411 410 441 440 561 560 591 590 621 620 547 546 577 576
+ 607 606 367 366 397 396 427 426 291 290 321 320 351 350 651 650 681 680 711 710
+ 1 0 31 30 61 60 3 2 33 32 63 62 5 4 35 34 65 64 7 6
+ 37 36 67 66 9 8 39 38 69 68 11 10 41 40 71 70 13 12 43 42
+ 73 72 15 14 45 44 75 74 17 16 47 46 77 76 19 18 49 48 79 78
+ 21 20 51 50 81 80 23 22 53 52 83 82 25 24 55 54 85 84 27 26
+ 57 56 87 86 117 116 147 146 177 176 115 114 145 144 175 174 113 112 143 142
+ 173 172 111 110 141 140 171 170 109 108 139 138 169 168 107 106 137 136 167 166
+ 105 104 135 134 165 164 103 102 133 132 163 162 101 100 131 130 161 160 99 98
+ 129 128 159 158 97 96 127 126 157 156 95 94 125 124 155 154 93 92 123 122
+ 153 152 91 90 121 120 151 150 181 180 211 210 241 240 183 182 213 212 243 242
+ 185 184 215 214 245 244 187 186 217 216 247 246 189 188 219 218 249 248 191 190
+ 221 220 251 250 193 192 223 222 253 252 195 194 225 224 255 254 197 196 227 226
+ 257 256 199 198 229 228 259 258 201 200 231 230 261 260 203 202 233 232 263 262
+ 205 204 235 234 265 264 207 206 237 236 267 266 297 296 327 326 357 356 295 294
+ 325 324 355 354 293 292 323 322 353 352 277 276 307 306 337 336 275 274 305 304
+ 335 334 273 272 303 302 333 332 271 270 301 300 331 330 361 360 391 390 421 420
+ 363 362 393 392 423 422 365 364 395 394 425 424 383 382 413 412 443 442 385 384
+ 415 414 445 444 387 386 417 416 447 446 477 476 507 506 537 536 475 474 505 504
+ 535 534 473 472 503 502 533 532 455 454 485 484 515 514 453 452 483 482 513 512
+ 451 450 481 480 511 510 541 540 571 570 601 600 543 542 573 572 603 602 545 544
+ 575 574 605 604 563 562 593 592 623 622 565 564 595 594 625 624 567 566 597 596
+ 627 626 657 656 687 686 717 716 655 654 685 684 715 714 653 652 683 682 713 712
+ 637 636 667 666 697 696 635 634 665 664 695 694 633 632 663 662 693 692 631 630
+ 661 660 691 690 721 720 751 750 781 780 723 722 753 752 783 782 725 724 755 754
+ 785 784 727 726 757 756 787 786 729 728 759 758 789 788 731 730 761 760 791 790
+ 733 732 763 762 793 792 735 734 765 764 795 794 737 736 767 766 797 796 739 738
+ 769 768 799 798 741 740 771 770 801 800 743 742 773 772 803 802 745 744 775 774
+ 805 804 747 746 777 776 807 806 837 836 867 866 897 896 835 834 865 864 895 894
+ 833 832 863 862 893 892 831 830 861 860 891 890 829 828 859 858 889 888 827 826
+ 857 856 887 886 825 824 855 854 885 884 823 822 853 852 883 882 821 820 851 850
+ 881 880 819 818 849 848 879 878 817 816 847 846 877 876 815 814 845 844 875 874
+ 813 812 843 842 873 872 811 810 841 840 871 870 901 900 931 930 961 960 903 902
+ 933 932 963 962 905 904 935 934 965 964 907 906 937 936 967 966 909 908 939 938
+ 969 968 911 910 941 940 971 970 913 912 943 942 973 972 915 914 945 944 975 974
+ 917 916 947 946 977 976 919 918 949 948 979 978 921 920 951 950 981 980 923 922
+ 953 952 983 982 925 924 955 954 985 984 927 926 957 956 987 986 58 89 88 118
+ 149 148 178 209 208 238 269 268 298 329 328 358 389 388 418 449 448 478 509 508
+ 538 569 568 598 629 628 658 689 688 718 749 748 778 809 808 838 869 868 898 929
928 958 989 988
] def
@@ -15242,8 +16647,8 @@
% --EXAM: This is Aztec Code
% --EXOP: format=full
% --RNDR: renmatrix
-%%BeginResource: uk.co.terryburton.bwipp azteccode 0.0 2014013000 135811 148610
-%%BeginData: 408 ASCII Lines
+%%BeginResource: uk.co.terryburton.bwipp azteccode 0.0 2014121100 173685 186101
+%%BeginData: 679 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
@@ -15275,7 +16680,7 @@
currentdict end /options exch def
} if
options {def} forall
-
+
/layers layers cvi def
/eclevel eclevel cvr def
/ecaddchars ecaddchars cvi def
@@ -15297,41 +16702,312 @@
length j add /j exch def
/barcode msg 0 j getinterval def
exit
+ } ifelse
+ } loop
+ } if
+
+ % Convert from input into message bitstream
+ /msgbits () def
+ format (rune) ne raw and {/msgbits barcode def} if
+ format (rune) ne raw not and {
+
+ % State key: "U"pper, "L"ower, "M"ixed, "P"unctuation, "D"igit, "B"inary
+ /U 0 def /L 1 def /M 2 def /P 3 def /D 4 def /B 5 def
+
+ % Special function characters
+ /lu -1 def /ll -2 def /lm -3 def
+ /lp -4 def /ld -5 def /su -6 def
+ /sp -7 def /sb -8 def /fl -9 def
+ /p2 -10 def /p3 -11 def /p4 -12 def /p5 -13 def
+
+ % Character maps for each state
+ /charmaps [
+ % U L M P D
+ [ sp sp sp fl sp ] % 0
+ [ 32 32 32 13 32 ] % 1
+ [ (A) (a) 1 p2 (0) ] % 2 p2 = CR LF
+ [ (B) (b) 2 p3 (1) ] % 3 p3 = ". "
+ [ (C) (c) 3 p4 (2) ] % 4 p4 = ", "
+ [ (D) (d) 4 p5 (3) ] % 5 p5 = ": "
+ [ (E) (e) 5 (!) (4) ] % 6
+ [ (F) (f) 6 (") (5) ] % 7
+ [ (G) (g) 7 (#) (6) ] % 8
+ [ (H) (h) 8 ($) (7) ] % 9
+ [ (I) (i) 9 (%) (8) ] % 10
+ [ (J) (j) 10 (&) (9) ] % 11
+ [ (K) (k) 11 (') (,) ] % 12
+ [ (L) (l) 12 40 (.) ] % 13
+ [ (M) (m) 13 41 lu ] % 14
+ [ (N) (n) 27 (*) su ] % 15
+ [ (O) (o) 28 (+) -99 ] % 16
+ [ (P) (p) 29 (,) -99 ] % 17
+ [ (Q) (q) 30 (-) -99 ] % 18
+ [ (R) (r) 31 (.) -99 ] % 19
+ [ (S) (s) (@) (/) -99 ] % 20
+ [ (T) (t) 92 (:) -99 ] % 21
+ [ (U) (u) (^) (;) -99 ] % 22
+ [ (V) (v) (_) (<) -99 ] % 23
+ [ (W) (w) (`) (=) -99 ] % 24
+ [ (X) (x) (|) (>) -99 ] % 25
+ [ (Y) (y) (~) (?) -99 ] % 26
+ [ (Z) (z) 127 ([) -99 ] % 27
+ [ ll su ll (]) -99 ] % 28
+ [ lm lm lu ({) -99 ] % 29
+ [ ld ld lp (}) -99 ] % 30
+ [ sb sb sb lu -99 ] % 31
+ ] def
+
+ % Invert charmaps to give character to value maps for each state
+ /charvals [ 32 dict 32 dict 32 dict 32 dict 16 dict ] def
+ 0 1 charmaps length 1 sub {
+ /i exch def
+ /encs charmaps i get def
+ 0 1 4 {
+ /j exch def
+ encs j get dup type /stringtype eq {0 get} if % convert string to ASCII if required
+ charvals j get exch i put
+ } for
+ } for
+
+ % Punctuation compression
+ /pcomp <<
+ <0d0a> p2 % CR LF
+ (. ) p3
+ (, ) p4
+ (: ) p5
+ >> def
+
+ /e 10000 def % "Empty"
+
+ /latlen [ % Bit length of latch between states
+ % To: U L M P D B From
+ [ 0 5 5 10 5 10 ] % U
+ [ 9 0 5 10 5 10 ] % L
+ [ 5 5 0 5 10 10 ] % M
+ [ 5 10 10 0 10 15 ] % P
+ [ 4 9 9 14 0 14 ] % D
+ [ 0 0 0 0 0 0 ] % B
+ ] def
+
+ /latseq [ % Latch sequences between states
+ % To: U L M P D B From
+ [ [] [ll] [lm] [lm lp] [ld] [sb] ] % U
+ [ [ld lu] [] [lm] [lm lp] [ld] [sb] ] % L
+ [ [lu] [ll] [] [lp] [lu ld] [sb] ] % M
+ [ [lu] [lu ll] [lu lm] [] [lu ld] [lu sb] ] % P
+ [ [lu] [lu ll] [lu lm] [lu lm lp] [] [lu sb] ] % D
+ [ [lu] [ll] [lm] [] [] [] ] % B
+ ] def
+
+ /shftlen [ % Bit length of shift to state
+ % To: U L M P D From
+ [ e e e 5 e ] % U
+ [ 5 e e 5 e ] % L
+ [ e e e 5 e ] % M
+ [ e e e e e ] % P
+ [ 4 e e 4 e ] % D
+ ] def
+
+ % U L M P D B
+ /charsize [ 5 5 5 5 4 8 ] def
+
+ % U L M P D B
+ /curlen [ 0 e e e e e ] def
+ /curseq [ [] [] [] [] [] [] ] def
+
+ /backto U def % U
+ /lastchar () def
+
+ % Derive the optimal sequences ending in each state
+ barcode {
+
+ /char exch def
+
+ % Check for optimisations in the current sequences by latching from x to y
+ { % loop
+ /imp false def
+ [ U L M P D B ] {
+ /x exch def
+ [ U L M P D B ] {
+ /y exch def
+ x B ne y backto eq or { % Only B -> backto
+ /cost curlen x get latlen x get y get add def
+ cost curlen y get lt {
+ curlen y cost put
+ curseq y [
+ curseq x get aload pop
+ latseq x get y get aload pop
+ ] put
+ y B eq { % Set backto to previous state
+ /backto x P eq x D eq or {U} {x} ifelse def
+ } if
+ /imp true def
+ } if
+ } if
+ } forall
+ } forall
+ imp not {exit} if % Repeat unless no improvement
+ } loop
+
+ % Determine optimal next sequences for each valid encoding
+ /nxtlen [ e e e e e e ] def
+ /nxtseq 6 array def
+
+ [ U L M P D B ] {
+ /x exch def
+
+ { % loop for common exit
+
+ % Skip states that cannot encode character
+ x B ne {charvals x get char known not {exit} if} if
+
+ % Extend directly
+ /cost curlen x get charsize x get add def
+ cost nxtlen x get lt {
+ nxtlen x cost put
+ nxtseq x [ curseq x get aload pop char ] put
+ } if
+
+ % Optimise for direct shifts from y to x
+ x B eq {exit} if % B is treated as a latch
+ [ U L M P D ] {
+ /y exch def
+ x y ne {
+ /cost curlen y get shftlen y get x get add charsize x get add def
+ cost nxtlen y get lt {
+ nxtlen y cost put
+ nxtseq y [
+ curseq y get aload pop
+ x U eq {su} {sp} ifelse
+ char
+ ] put
+ } if
+ } if
+ } forall
+
+ exit
+ } loop
+
+ } forall
+
+ % Optimise using P compression
+ lastchar () ne {
+ /pchars 2 string dup 0 lastchar put dup 1 char put def
+ pcomp pchars known {
+ curlen P get nxtlen P get lt {
+ nxtlen P curlen P get put
+ nxtseq P [ curseq P get aload pop pop pcomp pchars get ] put
+ } if
+ } if
+ } if
+
+ % Account for binary extension for 32 or more bytes
+ /numbytes 0 def
+ nxtseq B get {
+ sb eq {0} {numbytes 1 add} ifelse /numbytes exch def
+ } forall
+ numbytes 32 eq {nxtlen B nxtlen B get 11 add put} if
+
+ /curlen nxtlen def
+ /curseq nxtseq def
+ /lastchar char def
+
+ } forall
+
+ % Select the optimal sequence
+ /minseq e def
+ [ U L M P D B ] {
+ /i exch def
+ curlen i get minseq lt {
+ /minseq curlen i get def
+ /seq curseq i get def
+ } if
+ } forall
+
+ % Encoding functions
+ /tobin {
+ string dup length 1 sub 0 exch 1 exch {1 index exch 48 put} for
+ dup 3 -1 roll 2 2 index length string cvrs dup length 2 index length exch sub exch putinterval
+ } bind def
+ /encu {charvals U get exch get 5 tobin} bind def
+ /encl {charvals L get exch get 5 tobin} bind def
+ /encm {charvals M get exch get 5 tobin} bind def
+ /encp {charvals P get exch get 5 tobin} bind def
+ /encd {charvals D get exch get 4 tobin} bind def
+ /encfuncs [ /encu /encl /encm /encp /encd ] def
+ /addtomsgbits {
+ /v exch def
+ msgbits j v putinterval
+ /j j v length add def
+ } bind def
+
+ % Encode the sequence
+ /state U def
+ /msgbits minseq string def
+ /i 0 def /j 0 def {
+ i seq length ge {exit} if
+
+ state B ne {
+
+ /char seq i get def
+
+ % Encode character
+ char encfuncs state get load exec addtomsgbits
+ /i i 1 add def
+
+ % Encode shifted next character
+ char su eq char sp eq or {
+ seq i get char su eq {encu} {encp} ifelse addtomsgbits
+ /i i 1 add def
+ } if
+
+ % Latches to new state
+ char lu eq {/state U def} if
+ char ll eq {/state L def} if
+ char lm eq {/state M def} if
+ char lp eq {/state P def} if
+ char ld eq {/state D def} if
+ char sb eq {/state B def} if
+
+ } { % Binary
+
+ % Find number of bytes before latch or end
+ /numbytes 0 def {
+ i numbytes add seq length ge {exit} if
+ seq i numbytes add get 0 lt {exit} if
+ /numbytes numbytes 1 add def
+ } loop
+
+ % Encode length
+ numbytes 31 le {
+ numbytes 5 tobin addtomsgbits
+ } {
+ 0 5 tobin addtomsgbits
+ numbytes 31 sub 11 tobin addtomsgbits
+ } ifelse
+
+ % Encode bytes
+ numbytes {
+ seq i get 8 tobin addtomsgbits
+ /i i 1 add def
+ } repeat
+
+ % Return to previous state as indicated
+ i seq length lt {
+ /char seq i get def
+ /i i 1 add def
+ char lu eq {/state U def} if
+ char ll eq {/state L def} if
+ char lm eq {/state M def} if
+ } if
+
} ifelse
+
} loop
- } if
-
- % Convert from input into message bitstream
- /msgbits () def
- format (rune) ne raw and {/msgbits barcode def} if
- format (rune) ne raw not and { % Simple autoencoder from input to bitstream using byte mode only
-
- % Determine the character count
- /barlen barcode length def
- barlen 31 le {
- (00000) 5 string copy dup barlen 2 5 string cvrs
- dup length 5 exch sub exch putinterval
- /cc exch def
- } {
- (0000000000000000) 16 string copy dup barlen 31 sub 2 16 string cvrs
- dup length 16 exch sub exch putinterval
- /cc exch def
- } ifelse
- /cclen cc length def
-
- % Create the bitstream as byte_mode_id character_count data_bytes
- /msgbits 5 cclen add barlen 8 mul add string def
- msgbits 0 (11111) putinterval
- msgbits 5 cc putinterval
- 0 1 barlen 1 sub {
- /i exch def
- (00000000) 8 string copy dup barcode i get cvi 2 8 string cvrs dup length 8 exch sub exch putinterval
- msgbits 5 cclen add i 8 mul add 3 -1 roll putinterval
- } for
-
- } if
-
- % Lookup the most appropriate symbol specification
+
+ } if
+
+ % Lookup the most appropriate symbol specification
/metrics [
[ (rune) 0 0 0 6 ] % Special metric for rune symbols
[ (compact) 1 1 17 6 ] [ (full) 1 1 21 6 ] [ (compact) 2 0 40 6 ]
@@ -15357,12 +17033,12 @@
/ncws m 3 get def % Total of codewords
/bpcw m 4 get def % Bits per codeword
/numecw ncws eclevel mul 100 div ecaddchars add ceiling cvi def
- msgbits length 0 eq {/numecw 0 def} if % Error correction codewords
+ msgbits length 0 eq {/numecw 0 def} if % Error correction codewords
/numdcw ncws numecw sub def % Data codewords
/okay true def
format (unset) ne format frmt ne and {/okay false def} if
readerinit icap 1 ne and {/okay false def} if
- layers -1 ne layers mlyr ne and {/okay false def} if
+ layers -1 ne layers mlyr ne and {/okay false def} if
msgbits length bpcw div ceiling cvi numdcw gt {/okay false def} if
okay {exit} if
/i i 1 add def
@@ -15382,8 +17058,8 @@
/cwf msgbits m bpcw add 1 sub 1 getinterval def % Last bit
cwb allzero {/cwf (1) def /m m 1 sub def} if % Flip last bit to avoid zeros
cwb allones {/cwf (0) def /m m 1 sub def} if % Flip last bit to avoid ones
- % Concatinate the bits
- 12 string dup 0 cwb putinterval
+ % Concatinate the bits
+ 12 string dup 0 cwb putinterval
dup bpcw 1 sub cwf putinterval
0 bpcw getinterval
/cwb exch def
@@ -15399,9 +17075,9 @@
/cw cw 2 bpcw i sub 1 sub exp cvi cwb i get 48 sub mul add def
} for
cws c cw put
- /m m bpcw add def
+ /m m bpcw add def
/c c 1 add def
- } loop
+ } loop
/cws cws 0 c getinterval def
% Reed-Solomon algorithm
@@ -15429,12 +17105,12 @@
% Generate the coefficients
/coeffs [ 1 rsnc {0} repeat ] def
1 1 rsnc {
- /i exch def
+ /i exch def
coeffs i coeffs i 1 sub get put
i 1 sub -1 1 {
/j exch def
coeffs j coeffs j 1 sub get coeffs j get rsalog i get rsprod xor put
- } for
+ } for
coeffs 0 coeffs 0 get rsalog i get rsprod put
} for
@@ -15442,11 +17118,11 @@
/nd rscws length def
/rscws [ rscws {} forall rsnc {0} repeat 0 ] def
0 1 nd 1 sub {
- /k exch rscws exch get rscws nd get xor def
+ /k exch rscws exch get rscws nd get xor def
0 1 rsnc 1 sub {
- /j exch def
+ /j exch def
rscws nd j add rscws nd j add 1 add get k coeffs rsnc j sub 1 sub get rsprod xor put
- } for
+ } for
} for
% Return all but the last codeword
@@ -15464,11 +17140,11 @@
mode 2#0000000011110000 and -4 bitshift
mode 2#0000000000001111 and
] def
- /mode mode 6 16 19 rscodes def
+ /mode mode 6 16 19 rscodes def
} if
format (compact) eq {
/mode layers 1 sub 6 bitshift cws length 1 sub add def
- readerinit {/mode mode 2#00100000 or def} if
+ readerinit {/mode mode 2#00100000 or def} if
/mode [
mode 2#11110000 and -4 bitshift
mode 2#00001111 and
@@ -15488,32 +17164,32 @@
0 1 modebits length 1 sub {modebits exch (0) putinterval} for
0 1 mode length 1 sub {
/i exch def
- modebits mode i get 2 4 string cvrs dup length 4 exch sub 4 i mul add exch putinterval
+ modebits mode i get 2 4 string cvrs dup length 4 exch sub 4 i mul add exch putinterval
} for
% Extend the data codewords with error correction codewords to create the bit string for the data
/rsparams [
- [] [] [] [] [] []
- [ 64 67 ] % 6-bit codewords
+ [] [] [] [] [] []
+ [ 64 67 ] % 6-bit codewords
[]
[ 256 301 ] % 8-bit codewords
- []
+ []
[ 1024 1033 ] % 10-bit codewords
[]
[ 4096 4201 ] % 12-bit codewords
] def
/cws cws ncws cws length sub rsparams bpcw get {} forall rscodes def
format (full) eq {
- /databits layers layers mul 16 mul layers 112 mul add string def
+ /databits layers layers mul 16 mul layers 112 mul add string def
} {
- /databits layers layers mul 16 mul layers 88 mul add string def
+ /databits layers layers mul 16 mul layers 88 mul add string def
} ifelse
0 1 databits length 1 sub {databits exch (0) putinterval} for
- 0 1 ncws 1 sub {
+ 0 1 ncws 1 sub {
/i exch def
- databits cws i get 2 bpcw string cvrs
- dup length bpcw exch sub bpcw i mul add databits length ncws bpcw mul sub add
- exch putinterval
+ databits cws i get 2 bpcw string cvrs
+ dup length bpcw exch sub bpcw i mul add databits length ncws bpcw mul sub add
+ exch putinterval
} for
% Move to a point in the cartesian plane centered on the bullseye
@@ -15526,7 +17202,7 @@
/lwid fw llyr 4 mul add def
/ldir lbit 2 idiv lwid idiv def
ldir 0 eq { % Top
- lwid 1 sub 2 idiv neg 1 add lbit 2 idiv lwid mod add
+ lwid 1 sub 2 idiv neg 1 add lbit 2 idiv lwid mod add
fw 1 sub 2 idiv llyr 2 mul add lbit 2 mod add
cmv
} if
@@ -15550,7 +17226,7 @@
% Create the pixel map
% For full symbols we disregard the reference grid at this stage
format (full) eq {/fw 12 def} {/fw 9 def} ifelse
- /size fw layers 4 mul add 2 add def
+ /size fw layers 4 mul add 2 add def
/pixs [size size mul {-1} repeat] def
/mid size 1 sub 2 idiv size mul size 1 sub 2 idiv add def
@@ -15580,7 +17256,7 @@
npixs i size 2 idiv neg j add cmv [size 2 idiv j add i add 1 add 2 mod] putinterval
npixs i neg size 2 idiv neg j add cmv [size 2 idiv j add i add 1 add 2 mod] putinterval
} for
- } for
+ } for
/j 0 def
0 1 npixs length 1 sub {
/i exch def
@@ -15615,7 +17291,7 @@
% Mode ring
format (full) eq {
- /modemap [
+ /modemap [
[-5 7] [-4 7] [-3 7] [-2 7] [-1 7] [ 1 7] [ 2 7] [ 3 7] [ 4 7] [ 5 7]
[ 7 5] [ 7 4] [ 7 3] [ 7 2] [ 7 1] [ 7 -1] [ 7 -2] [ 7 -3] [ 7 -4] [ 7 -5]
[ 5 -7] [ 4 -7] [ 3 -7] [ 2 -7] [ 1 -7] [-1 -7] [-2 -7] [-3 -7] [-4 -7] [-5 -7]
@@ -15662,7 +17338,7 @@
% --EXAM: Code One
% --EXOP: version=B
% --RNDR: renmatrix
-%%BeginResource: uk.co.terryburton.bwipp codeone 0.0 2014013000 104659 110857
+%%BeginResource: uk.co.terryburton.bwipp codeone 0.0 2014121100 104659 104025
%%BeginData: 328 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -15713,7 +17389,7 @@
length j add /j exch def
/barcode msg 0 j getinterval def
exit
- } ifelse
+ } ifelse
} loop
} if
@@ -15792,7 +17468,7 @@
/cols m 2 get def % Columns in symbol
/dcol m 3 get def % Data columns in symbol
/dcws m 4 get def % Data codewords in symbol
- /rscw m 5 get def % Error correction codewords
+ /rscw m 5 get def % Error correction codewords
/rsbl m 6 get def % Error correction blocks
/riso m 7 get def % Riser offset
/risi m 8 get def % Riser interval
@@ -15816,11 +17492,11 @@
/ecbs rsbl array def % Array of error correction blocks
0 1 rsbl 1 sub {
/i exch def
- /cwb dcpb array def
+ /cwb dcpb array def
0 1 dcpb 1 sub {
/j exch def
cwb j cws j rsbl mul i add get put
- } for
+ } for
cwbs i cwb put
} for
@@ -15832,7 +17508,7 @@
/rslog gf array def
1 1 gf-1 {dup rsalog exch get exch rslog 3 1 roll put} for
/rsprod {
- 2 copy 0 ne exch 0 ne and {
+ 2 copy 0 ne exch 0 ne and {
rslog exch get exch rslog exch get add gf-1 mod rsalog exch get
} {
pop pop 0
@@ -15842,12 +17518,12 @@
% Generate the coefficients for the Reed-Solomon algorithm
/coeffs [ 1 ecpb {0} repeat ] def
0 1 ecpb 1 sub {
- /i exch def
+ /i exch def
coeffs i 1 add coeffs i get put
i -1 1 {
/j exch def
coeffs j coeffs j 1 sub get coeffs j get rsalog i get rsprod xor put
- } for
+ } for
coeffs 0 coeffs 0 get rsalog i get rsprod put
} for
/coeffs coeffs 0 coeffs length 1 sub getinterval def
@@ -15906,14 +17582,14 @@
% Centre pattern
/artifact [
- {cols {0} repeat} bind
- {cols {1} repeat} bind
- {0 cols 2 sub {1} repeat 0} bind
- {0 1 cols 4 sub {0} repeat 1 0} bind
- {cols 1 sub 2 idiv {-1} repeat 1 cols 1 sub 2 idiv {-1} repeat} bind
- {cols 1 sub 2 idiv {-1} repeat 0 cols 1 sub 2 idiv {-1} repeat} bind
- {1 cols 2 sub {0} repeat 1} bind
- {1 0 cols 4 sub {1} repeat 0 1} bind
+ {cols {0} repeat} bind
+ {cols {1} repeat} bind
+ {0 cols 2 sub {1} repeat 0} bind
+ {0 1 cols 4 sub {0} repeat 1 0} bind
+ {cols 1 sub 2 idiv {-1} repeat 1 cols 1 sub 2 idiv {-1} repeat} bind
+ {cols 1 sub 2 idiv {-1} repeat 0 cols 1 sub 2 idiv {-1} repeat} bind
+ {1 cols 2 sub {0} repeat 1} bind
+ {1 0 cols 4 sub {1} repeat 0 1} bind
] def
/cpat <<
/A (121343)
@@ -15927,7 +17603,7 @@
/S (56661278)
/T (5666666666127878)
>> vers 0 1 getinterval get def
- pixs 0 rows cpat length sub 2 idiv mmv
+ pixs 0 rows cpat length sub 2 idiv mmv
[ cpat {artifact exch 49 sub get exec} forall ] putinterval
% Risers
@@ -15939,7 +17615,7 @@
pixs j i mmv
3 -1 roll putinterval
i risl 1 sub ne {
- pixs cols j sub 2 sub rows i sub 1 sub mmv
+ pixs cols j sub 2 sub rows i sub 1 sub mmv
3 -1 roll putinterval
} {pop} ifelse
} for
@@ -16002,7 +17678,7 @@
% --EXAM: (01)95012345678903(3103)000123
% --EXOP: ccversion=b cccolumns=4
% --RNDR: renmatrix
-%%BeginResource: uk.co.terryburton.bwipp gs1-cc 0.0 2014013000 191363 193686
+%%BeginResource: uk.co.terryburton.bwipp gs1-cc 0.0 2014121100 208010 203774
%%BeginData: 650 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -16012,7 +17688,7 @@
dup /micropdf417 dup /uk.co.terryburton.bwipp findresource put
begin
/gs1-cc {
-
+
20 dict begin % Confine variables to local scope
/options exch def % We are given an option string
@@ -16023,7 +17699,7 @@
/cccolumns -1 def
/lintype () def
/linwidth -1 def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -16034,7 +17710,7 @@
currentdict end /options exch def
} if
options {def} forall
-
+
/cccolumns cccolumns cvi def
/linwidth linwidth cvi def
@@ -16054,7 +17730,7 @@
/databarlimited 3
/databarexpanded 4
/databarexpandedstacked 4
- >> lintype get /cccolumns exch def
+ >> lintype get /cccolumns exch def
} if
% Expand ordinals of the form ^NNN to ASCII
@@ -16074,10 +17750,10 @@
dup out exch j exch putinterval
length j add /j exch def
out 0 j getinterval exit
- } ifelse
+ } ifelse
} loop
} bind def
-
+
% Parse out AIs
/ais [] def
/aival 2 dict def
@@ -16087,21 +17763,21 @@
(\)) search pop
exch pop
exch (\() search {
- exch pop exch 3 1 roll
- } {
+ exch pop exch 3 1 roll
+ } {
() 3 1 roll
} ifelse
[ ais aload pop counttomark 2 add index ] /ais exch def
aival 3 1 roll expand put
} loop
pop
-
+
% Method selection
/isupper {dup 65 ge exch 90 le and} bind def % A-Z
/isnum0 {dup 48 ge exch 57 le and} bind def % 0-9
/isnum1 {dup 49 ge exch 57 le and} bind def % 1-9
{ % common exit
-
+
% (10/11/17)...
ais length 1 ge {
ais 0 get (10) eq ais 0 get (11) eq or ais 0 get (17) eq or {
@@ -16144,7 +17820,7 @@
% Freeform
-1 (0) exit
-
+
} loop
/method exch def
/npre exch def
@@ -16153,9 +17829,9 @@
/tobin {
string dup length 1 sub 0 exch 1 exch {1 index exch 48 put} for
- dup 3 -1 roll 2 2 index length string cvrs dup length 2 index length exch sub exch putinterval
+ dup 3 -1 roll 2 2 index length string cvrs dup length 2 index length exch sub exch putinterval
} bind def
-
+
/alpha <<
65 1 90 {dup 65 sub 5 tobin} for
48 1 57 {dup 4 add 6 tobin} for
@@ -16165,16 +17841,16 @@
/numeric <<
0 1 119 {
dup (00) 2 string copy dup 3 -1 roll 11 2 string cvrs
- dup length 2 exch sub exch putinterval
- dup 0 get 65 eq {dup 0 94 put} if
- dup 1 get 65 eq {dup 1 94 put} if
+ dup length 2 exch sub exch putinterval
+ dup 0 get 65 eq {dup 0 94 put} if
+ dup 1 get 65 eq {dup 1 94 put} if
exch 8 add
- (0000000) 7 string copy dup 3 -1 roll 2 7 string cvrs
+ (0000000) 7 string copy dup 3 -1 roll 2 7 string cvrs
dup length 7 exch sub exch putinterval
} for
lalphanumeric (0000)
>> def
-
+
/alphanumeric <<
48 1 57 {dup 43 sub 5 tobin} for
fnc1 (01111)
@@ -16184,7 +17860,7 @@
lnumeric (000)
liso646 (00100)
>> def
-
+
/iso646 <<
48 1 57 {dup 43 sub 5 tobin} for
fnc1 (01111)
@@ -16205,7 +17881,7 @@
aival ais 0 get get
dup 0 2 getinterval cvi 384 mul exch
dup 2 2 getinterval cvi 1 sub 32 mul exch
- 4 2 getinterval cvi add add
+ 4 2 getinterval cvi add add
(0000000000000000) 16 string copy dup 3 -1 roll 2 16 string cvrs
dup length 16 exch sub exch putinterval
[ 1 0
@@ -16246,12 +17922,12 @@
nalpha nnums add ai90rem length ne {/mode (alphanumeric) def} if
/cdf [
cdf aload pop
- mode (alphanumeric) eq {0} if
- mode (numeric) eq {1 0} if
- mode (alpha) eq {1 1} if
+ mode (alphanumeric) eq {0} if
+ mode (numeric) eq {1 0} if
+ mode (alpha) eq {1 1} if
] def
/ais1 ais length 1 gt {ais 1 get} {-1} ifelse def
- ais1 (21) eq ais1 (8004) eq or {
+ ais1 (21) eq ais1 (8004) eq or {
/cdf [ cdf aload pop ais1 (21) eq {1 0} {1 1} ifelse ] def
} {
/cdf [ cdf aload pop 0 ] def
@@ -16262,7 +17938,7 @@
/aval exch def
} {
pop /aval -1 def
- } ifelse
+ } ifelse
nval 31 lt aval -1 ne and {
(00000) 5 string copy dup nval 2 5 string cvrs
dup length 5 exch sub exch putinterval
@@ -16271,7 +17947,7 @@
dup length 4 exch sub exch putinterval
[ exch {48 sub} forall ] /abits exch def
/cdf [
- cdf aload pop
+ cdf aload pop
nbits aload pop
abits aload pop
] def
@@ -16297,12 +17973,12 @@
/out in length 6 mul array def
/j 0 def
0 1 in length 1 sub {
- in exch get encs exch get
+ in exch get encs exch get
dup [ exch {48 sub} forall ] out exch j exch putinterval
length j add /j exch def
} for
/cdf [
- cdf aload pop
+ cdf aload pop
out 0 j getinterval aload pop
] def
/gpf [] def
@@ -16407,7 +18083,7 @@
} {
/ccversion -1 def
} ifelse
- } ifelse
+ } ifelse
used rembits
} if
} bind def
@@ -16428,7 +18104,7 @@
/i exch def
gpf i get
(00) 2 string copy
- dup 0 gpf i get dup fnc1 eq {pop 94} if put
+ dup 0 gpf i get dup fnc1 eq {pop 94} if put
i gpf length 1 sub lt {dup 1 gpf i 1 add get dup fnc1 eq {pop 94} if put} if
numeric exch known {
numericruns i numericruns i 2 add get 2 add put
@@ -16446,17 +18122,17 @@
nextiso646only i nextiso646only i 1 add get 1 add put
} ifelse
} for
-
+
% Encode the general purpose field
/gpfenc 8296 array def
/i 0 def /j 0 def
{ % loop
i gpf length eq {exit} if
{ % not a loop but common exit point
-
+
mode (numeric) eq {
i gpf length 2 sub le {
- 2 string
+ 2 string
dup 0 gpf i get dup fnc1 eq {pop 94} if put
dup 1 gpf i 1 add get dup fnc1 eq {pop 94} if put
dup numeric exch known {
@@ -16465,7 +18141,7 @@
exit
} if
pop
- lalphanumeric numeric encode
+ lalphanumeric numeric encode
/mode (alphanumeric) def
exit
} {
@@ -16482,13 +18158,13 @@
/i i 1 add def
exit
} { % C1.FNC1
- 2 string dup 0 gpf i get put dup 1 94 put numeric encode
+ 2 string dup 0 gpf i get put dup 1 94 put numeric encode
/i i 1 add def
exit
} ifelse
} ifelse
} if
-
+
mode (alphanumeric) eq {
gpf i get fnc1 eq {
fnc1 alphanumeric encode
@@ -16515,7 +18191,7 @@
/i i 1 add def
exit
} if
-
+
mode (iso646) eq {
gpf i get fnc1 eq {
fnc1 iso646 encode
@@ -16537,7 +18213,7 @@
/i i 1 add def
exit
} if
-
+
} loop
} loop
/gpf gpfenc 0 j getinterval def
@@ -16547,8 +18223,8 @@
pad length 0 gt {
0 5 pad length 1 sub { % Fill with 00100
/i exch def
- pad i [ 0 0 1 0 0 ] 0 pad length i sub 5 2 copy gt {exch} if pop getinterval putinterval
- } for
+ pad i [ 0 0 1 0 0 ] 0 pad length i sub 5 2 copy gt {exch} if pop getinterval putinterval
+ } for
mode (numeric) eq { % Prefix shift from numeric to ASCII
/pad [ 0 0 0 0 pad aload pop ] 0 pad length getinterval def
} if
@@ -16575,8 +18251,8 @@
6 -1 1 {
/i exch def
/v pwr928 j 1 sub get i get 2 mul v 928 idiv add def
- pwr928 j get i v 928 mod put
- } for
+ pwr928 j get i v 928 mod put
+ } for
pwr928 j get 0 pwr928 j 1 sub get 0 get 2 mul v 928 idiv add put
} for
/cws [ 28 {0} repeat ] def
@@ -16601,7 +18277,7 @@
/i exch def
cs i 1 sub 2 copy get cs i get 928 idiv add put
cs i 2 copy get 928 mod put
- } for
+ } for
/b b bsl add def
/c c csl add def
} loop
@@ -16664,7 +18340,7 @@
% --EXAM: 2112345678900|(99)1234-abcd
% --EXOP: includetext
% --RNDR: renlinear renmatrix
-%%BeginResource: uk.co.terryburton.bwipp ean13composite 0.0 2014013000 88474 88426
+%%BeginResource: uk.co.terryburton.bwipp ean13composite 0.0 2014121100 84954 88322
%%BeginData: 72 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -16682,7 +18358,7 @@
/barcode exch def
/dontdraw false def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -16748,7 +18424,7 @@
% --EXAM: 02345673|(21)A12345678
% --EXOP: includetext
% --RNDR: renlinear renmatrix
-%%BeginResource: uk.co.terryburton.bwipp ean8composite 0.0 2014013000 85295 92184
+%%BeginResource: uk.co.terryburton.bwipp ean8composite 0.0 2014121100 88815 88768
%%BeginData: 75 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -16766,7 +18442,7 @@
/barcode exch def
/dontdraw false def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -16835,7 +18511,7 @@
% --EXAM: 416000336108|(99)1234-abcd
% --EXOP: includetext
% --RNDR: renlinear renmatrix
-%%BeginResource: uk.co.terryburton.bwipp upcacomposite 0.0 2014013000 84946 91835
+%%BeginResource: uk.co.terryburton.bwipp upcacomposite 0.0 2014121100 84932 88301
%%BeginData: 72 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
2 dict
@@ -16853,7 +18529,7 @@
/barcode exch def
/dontdraw false def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -16919,7 +18595,7 @@
% --EXAM: 00123457|(15)021231
% --EXOP: includetext
% --RNDR: renlinear renmatrix
-%%BeginResource: uk.co.terryburton.bwipp upcecomposite 0.0 2014013000 85900 89258
+%%BeginResource: uk.co.terryburton.bwipp upcecomposite 0.0 2014121100 85886 92764
%%BeginData: 87 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
2 dict
@@ -16937,7 +18613,7 @@
/barcode exch def
/dontdraw false def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -16965,7 +18641,7 @@
0 1 49 {0} repeat 1 0
1 0 49 {0} repeat 0 1
0 1 49 {0} repeat 1 0
- ]
+ ]
/pixx 53
/pixy 3
/height 6 72 div
@@ -17018,7 +18694,7 @@
% --EXAM: (01)03612345678904|(11)990102
% --EXOP:
% --RNDR: renlinear renmatrix
-%%BeginResource: uk.co.terryburton.bwipp databaromnicomposite 0.0 2014013000 85295 88703
+%%BeginResource: uk.co.terryburton.bwipp databaromnicomposite 0.0 2014121100 97855 88807
%%BeginData: 100 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
2 dict
@@ -17036,7 +18712,7 @@
/barcode exch def
/dontdraw false def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -17130,7 +18806,7 @@
% --EXAM: (01)03412345678900|(17)010200
% --EXOP:
% --RNDR: renlinear renmatrix
-%%BeginResource: uk.co.terryburton.bwipp databarstackedcomposite 0.0 2014013000 91237 87360
+%%BeginResource: uk.co.terryburton.bwipp databarstackedcomposite 0.0 2014121100 87821 90984
%%BeginData: 96 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
2 dict
@@ -17147,7 +18823,7 @@
/barcode exch def
/dontdraw false def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -17238,7 +18914,7 @@
% --EXAM: (01)03612345678904|(11)990102
% --EXOP:
% --RNDR: renlinear renmatrix
-%%BeginResource: uk.co.terryburton.bwipp databarstackedomnicomposite 0.0 2014013000 91313 87432
+%%BeginResource: uk.co.terryburton.bwipp databarstackedomnicomposite 0.0 2014121100 87897 90952
%%BeginData: 96 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
2 dict
@@ -17255,7 +18931,7 @@
/barcode exch def
/dontdraw false def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -17346,7 +19022,7 @@
% --EXAM: (01)03612345678904|(11)990102
% --EXOP:
% --RNDR: renlinear renmatrix
-%%BeginResource: uk.co.terryburton.bwipp databartruncatedcomposite 0.0 2014013000 92307 88414
+%%BeginResource: uk.co.terryburton.bwipp databartruncatedcomposite 0.0 2014121100 88891 91934
%%BeginData: 100 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
2 dict
@@ -17364,7 +19040,7 @@
/barcode exch def
/dontdraw false def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -17458,7 +19134,7 @@
% --EXAM: (01)03512345678907|(21)abcdefghijklmnopqrstuv
% --EXOP:
% --RNDR: renlinear renmatrix
-%%BeginResource: uk.co.terryburton.bwipp databarlimitedcomposite 0.0 2014013000 85160 81541
+%%BeginResource: uk.co.terryburton.bwipp databarlimitedcomposite 0.0 2014121100 81640 81749
%%BeginData: 79 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
2 dict
@@ -17476,7 +19152,7 @@
/barcode exch def
/dontdraw false def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -17527,8 +19203,8 @@
>> //renmatrix exec
% Plot the 2D part
- comp options //gs1-cc exec
- dup (pixx) get 72 exch sub 1 rmoveto
+ comp options //gs1-cc exec
+ dup (pixx) get 72 exch sub 1 rmoveto
//renmatrix exec
grestore
@@ -17549,7 +19225,7 @@
% --EXAM: (01)93712345678904(3103)001234|(91)1A2B3C4D5E
% --EXOP:
% --RNDR: renlinear renmatrix
-%%BeginResource: uk.co.terryburton.bwipp databarexpandedcomposite 0.0 2014013000 88262 84615
+%%BeginResource: uk.co.terryburton.bwipp databarexpandedcomposite 0.0 2014121100 84742 88135
%%BeginData: 98 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
2 dict
@@ -17567,7 +19243,7 @@
/barcode exch def
/dontdraw false def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -17627,7 +19303,7 @@
[ % Finder pattern module positions
18 98 bot length 13 sub {} for
69 98 bot length 13 sub {} for
- ] {sepfinder} forall
+ ] {sepfinder} forall
0 linheight rmoveto <<
/ren //renmatrix
/pixs sep
@@ -17657,9 +19333,9 @@
% --REQUIRES preamble raiseerror renlinear renmatrix databarexpanded databarexpandedstacked micropdf417 pdf417 gs1-cc--
% --DESC: GS1 DataBar Expanded Stacked Composite
% --EXAM: (01)00012345678905(10)ABCDEF|(21)12345678
-% --EXOP: segments=4
+% --EXOP: segments=4
% --RNDR: renmatrix renlinear
-%%BeginResource: uk.co.terryburton.bwipp databarexpandedstackedcomposite 0.0 2014013000 87600 90536
+%%BeginResource: uk.co.terryburton.bwipp databarexpandedstackedcomposite 0.0 2014121100 87600 90640
%%BeginData: 95 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
2 dict
@@ -17676,7 +19352,7 @@
/barcode exch def
/dontdraw false def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -17733,7 +19409,7 @@
[ % Finder pattern module positions
19 98 bot length 13 sub {} for
70 98 bot length 13 sub {} for
- ] {sepfinder} forall
+ ] {sepfinder} forall
0 linheight rmoveto <<
/ren //renmatrix
/pixs sep
@@ -17766,7 +19442,7 @@
% --EXAM: (00)030123456789012340|(02)13012345678909(37)24(10)1234567ABCDEFG
% --EXOP: ccversion=c
% --RNDR: renlinear renmatrix
-%%BeginResource: uk.co.terryburton.bwipp gs1-128composite 0.0 2014013000 88527 91356
+%%BeginResource: uk.co.terryburton.bwipp gs1-128composite 0.0 2014121100 92047 87940
%%BeginData: 100 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
2 dict
@@ -17784,7 +19460,7 @@
/barcode exch def
/dontdraw false def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -17819,7 +19495,7 @@
options (lintype) (gs1-128) put
options (linwidth) linwidth put
comp options //gs1-cc exec /compsym exch def
- compsym (pixx) get 99 eq {(a)} {(c)} ifelse /linktype exch def
+ compsym (pixx) get 99 eq {(a)} {(c)} ifelse /linktype exch def
% Plot linear part
linktype (a) eq {
@@ -17855,7 +19531,7 @@
/x s p sub 1 sub 11 mul 10 add p 0 eq {2 add} if 99 sub def
x 1 rmoveto
} {
- -7 1 rmoveto
+ -7 1 rmoveto
} ifelse
compsym //renmatrix exec
@@ -17878,7 +19554,7 @@
% --EXAM: (01)03453120000011(17)120508(10)ABCD1234(410)9501101020917
% --EXOP:
% --RNDR: renmatrix
-%%BeginResource: uk.co.terryburton.bwipp gs1datamatrix 0.0 2014013000 74757 77843
+%%BeginResource: uk.co.terryburton.bwipp gs1datamatrix 0.0 2014121100 76851 79937
%%BeginData: 134 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -17894,7 +19570,7 @@
/barcode exch def % We are given a barcode string
/dontdraw false def
-
+
% Parse the input options
options type /stringtype eq {
1 dict begin
@@ -17923,10 +19599,10 @@
dup out exch j exch putinterval
length j add /j exch def
out 0 j getinterval exit
- } ifelse
+ } ifelse
} loop
} bind def
-
+
% Parse out AIs
/ais [] def
/aival 2 dict def
@@ -17936,8 +19612,8 @@
(\)) search pop
exch pop
exch (\() search {
- exch pop exch 3 1 roll
- } {
+ exch pop exch 3 1 roll
+ } {
() 3 1 roll
} ifelse
[ ais aload pop counttomark 2 add index ] /ais exch def
@@ -17963,7 +19639,7 @@
10 2 string cvrs dup aifixed 3 1 roll put
} forall
- % Create the datamatrix data
+ % Create the datamatrix data
/fnc1 -1 def
/dmtx [ fnc1 ] def
0 1 ais length 1 sub {
@@ -18005,9 +19681,9 @@
args (opt) options put
args
-
+
dontdraw not //renmatrix if
-
+
end
} bind def
@@ -18018,13 +19694,158 @@
%%EndResource
% --END ENCODER gs1datamatrix--
+% --BEGIN ENCODER gs1qrcode--
+% --REQUIRES preamble raiseerror renmatrix qrcode--
+% --DESC: GS1 QR Code
+% --EXAM: (01)03453120000011(8200)http://www.abc.net(10)ABCD1234(410)9501101020917
+% --EXOP:
+% --RNDR: renmatrix
+%%BeginResource: uk.co.terryburton.bwipp gs1qrcode 0.0 2014121100 76691 83197
+%%BeginData: 133 ASCII Lines
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
+dup /qrcode dup /uk.co.terryburton.bwipp findresource put
+begin
+/gs1qrcode {
+
+ 20 dict begin % Confine variables to local scope
+
+ /options exch def % We are given an option string
+ /barcode exch def % We are given a barcode string
+
+ /dontdraw false def
+
+ % Parse the input options
+ options type /stringtype eq {
+ 1 dict begin
+ options {
+ token false eq {exit} if dup length string cvs (=) search
+ true eq {cvlit exch pop exch def} {cvlit true def} ifelse
+ } loop
+ currentdict end /options exch def
+ } if
+ options {def} forall
+
+ % Expand ordinals of the form ^NNN to ASCII
+ /expand {
+ /in exch def
+ /out in length string def
+ /j 0 def
+ in
+ { % loop
+ (^) search {
+ dup out exch j exch putinterval
+ length j add 1 add /j exch def
+ pop
+ dup 0 3 getinterval cvi out exch j 1 sub exch put
+ dup length 3 sub 3 exch getinterval
+ } {
+ dup out exch j exch putinterval
+ length j add /j exch def
+ out 0 j getinterval exit
+ } ifelse
+ } loop
+ } bind def
+
+ % Parse out AIs
+ /ais [] def
+ /aival 2 dict def
+ barcode dup length 1 sub 1 exch getinterval
+ { % loop
+ dup () eq {exit} if
+ (\)) search pop
+ exch pop
+ exch (\() search {
+ exch pop exch 3 1 roll
+ } {
+ () 3 1 roll
+ } ifelse
+ [ ais aload pop counttomark 2 add index ] /ais exch def
+ aival 3 1 roll expand put
+ } loop
+ pop
+
+ % Pre-defined fixed length data field AIs
+ % any AI whose prefix is not included in this table must be
+ % terminated with "FNC1", even if it's fixed length
+ /aifixed 23 dict def
+ [
+ 0 1 4 {} for
+ ] {
+ (00) 2 string copy dup dup 1 5 -1 roll 48 add put aifixed 3 1 roll put
+ } forall
+ [
+ 11 1 20 {} for
+ 23
+ 31 1 36 {} for
+ 41
+ ] {
+ 10 2 string cvrs dup aifixed 3 1 roll put
+ } forall
+
+ % Create the qrcode data
+ /fnc1 -1 def
+ /qrc [ fnc1 ] def
+ 0 1 ais length 1 sub {
+ /i exch def
+ /ai ais i get def
+ /val aival ai get def
+ qrc length ai length add val length add array
+ dup 0 qrc putinterval
+ dup qrc length ai [ exch {} forall ] putinterval
+ dup qrc length ai length add val [ exch {} forall ] putinterval
+ /qrc exch def
+ i ais length 1 sub ne aifixed ai 0 2 getinterval known not and { % Append FNC1
+ qrc length 1 add array
+ dup 0 qrc putinterval
+ dup qrc length fnc1 put
+ /qrc exch def
+ } if
+ } for
+
+ % Compose input to qrcode
+ /barcode qrc length 1 add 5 mul string def
+ /i 0 def /j 0 def {
+ i qrc length eq {exit} if
+ qrc i get dup fnc1 eq {
+ pop barcode j (^FNC1) putinterval
+ /j j 4 add def
+ } {
+ barcode exch j exch put
+ } ifelse
+ /i i 1 add def
+ /j j 1 add def
+ } loop
+ /barcode barcode 0 j getinterval def
+
+ % Get the result of encoding with qrcode
+ options (dontdraw) true put
+ options (parsefnc) true put
+ /args barcode options //qrcode exec def
+
+ args (opt) options put
+ args
+
+ dontdraw not //renmatrix if
+
+ end
+
+} bind def
+/gs1qrcode dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+%%EndData
+%%EndResource
+% --END ENCODER gs1qrcode--
+
% --BEGIN ENCODER hibccode39--
% --REQUIRES preamble raiseerror renlinear code39--
% --DESC: HIBC Code 39
% --EXAM: A123BJC5D6E71
% --EXOP: includetext
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp hibccode39 0.0 2014013000 67484 67295
+%%BeginResource: uk.co.terryburton.bwipp hibccode39 0.0 2014121100 64068 67295
%%BeginData: 92 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -18076,7 +19897,7 @@
/barlen barcode length validatecheck {1 sub} if def
- /checksum 0 def
+ /checksum 41 def
0 1 barlen 1 sub {
barcode exch 1 getinterval charvals exch get
checksum add /checksum exch def
@@ -18109,7 +19930,7 @@
args (textxalign) (center) put
args (opt) options put
args
-
+
dontdraw not //renlinear if
end
@@ -18128,7 +19949,7 @@
% --EXAM: A123BJC5D6E71
% --EXOP: includetext
% --RNDR: renlinear
-%%BeginResource: uk.co.terryburton.bwipp hibccode128 0.0 2014013000 67387 67050
+%%BeginResource: uk.co.terryburton.bwipp hibccode128 0.0 2014121100 63971 67258
%%BeginData: 91 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -18180,7 +20001,7 @@
/barlen barcode length validatecheck {1 sub} if def
- /checksum 0 def
+ /checksum 41 def
0 1 barlen 1 sub {
barcode exch 1 getinterval charvals exch get
checksum add /checksum exch def
@@ -18212,7 +20033,7 @@
args (textxalign) (center) put
args (opt) options put
args
-
+
dontdraw not //renlinear if
end
@@ -18231,7 +20052,7 @@
% --EXAM: A123BJC5D6E71
% --EXOP:
% --RNDR: renmatrix
-%%BeginResource: uk.co.terryburton.bwipp hibcdatamatrix 0.0 2014013000 65062 64700
+%%BeginResource: uk.co.terryburton.bwipp hibcdatamatrix 0.0 2014121100 62602 69050
%%BeginData: 74 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -18274,7 +20095,7 @@
/barlen barcode length validatecheck {1 sub} if def
- /checksum 0 def
+ /checksum 41 def
0 1 barlen 1 sub {
barcode exch 1 getinterval charvals exch get
checksum add /checksum exch def
@@ -18298,7 +20119,7 @@
args (opt) options put
args
-
+
dontdraw not //renmatrix if
end
@@ -18317,7 +20138,7 @@
% --EXAM: A123BJC5D6E71
% --EXOP:
% --RNDR: renmatrix
-%%BeginResource: uk.co.terryburton.bwipp hibcpdf417 0.0 2014013000 61955 65229
+%%BeginResource: uk.co.terryburton.bwipp hibcpdf417 0.0 2014121100 61835 65021
%%BeginData: 78 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -18363,7 +20184,7 @@
/barlen barcode length validatecheck {1 sub} if def
- /checksum 0 def
+ /checksum 41 def
0 1 barlen 1 sub {
barcode exch 1 getinterval charvals exch get
checksum add /checksum exch def
@@ -18388,7 +20209,7 @@
args (opt) options put
args
-
+
dontdraw not //renmatrix if
end
@@ -18407,7 +20228,7 @@
% --EXAM: A123BJC5D6E71
% --EXOP:
% --RNDR: renmatrix
-%%BeginResource: uk.co.terryburton.bwipp hibcmicropdf417 0.0 2014013000 65525 65160
+%%BeginResource: uk.co.terryburton.bwipp hibcmicropdf417 0.0 2014121100 61885 64952
%%BeginData: 78 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -18453,7 +20274,7 @@
/barlen barcode length validatecheck {1 sub} if def
- /checksum 0 def
+ /checksum 41 def
0 1 barlen 1 sub {
barcode exch 1 getinterval charvals exch get
checksum add /checksum exch def
@@ -18478,7 +20299,7 @@
args (opt) options put
args
-
+
dontdraw not //renmatrix if
end
@@ -18497,7 +20318,7 @@
% --EXAM: A123BJC5D6E71
% --EXOP:
% --RNDR: renmatrix
-%%BeginResource: uk.co.terryburton.bwipp hibcqrcode 0.0 2014013000 65682 65326
+%%BeginResource: uk.co.terryburton.bwipp hibcqrcode 0.0 2014121100 65786 68742
%%BeginData: 74 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -18540,7 +20361,7 @@
/barlen barcode length validatecheck {1 sub} if def
- /checksum 0 def
+ /checksum 41 def
0 1 barlen 1 sub {
barcode exch 1 getinterval charvals exch get
checksum add /checksum exch def
@@ -18564,7 +20385,7 @@
args (opt) options put
args
-
+
dontdraw not //renmatrix if
end
@@ -18583,7 +20404,7 @@
% --EXAM: A123BJC5D6E71
% --EXOP:
% --RNDR: renmatrix
-%%BeginResource: uk.co.terryburton.bwipp hibccodablockf 0.0 2014013000 64938 64908
+%%BeginResource: uk.co.terryburton.bwipp hibccodablockf 0.0 2014121100 61522 64700
%%BeginData: 74 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
@@ -18626,7 +20447,7 @@
/barlen barcode length validatecheck {1 sub} if def
- /checksum 0 def
+ /checksum 41 def
0 1 barlen 1 sub {
barcode exch 1 getinterval charvals exch get
checksum add /checksum exch def
@@ -18650,7 +20471,7 @@
args (opt) options put
args
-
+
dontdraw not //renmatrix if
end
More information about the scribus-commit
mailing list