Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 25124 → Rev 25126

/trunk/Scribus/scribus/plugins/barcodegenerator/barcode.ps
1,6 → 1,6
%!PS
 
% Barcode Writer in Pure PostScript - Version 2021-09-28
% Barcode Writer in Pure PostScript - Version 2022-07-29
% https://bwipp.terryburton.co.uk
%
% Copyright (c) 2004-2022 Terry Burton
32,7 → 32,7
% --BEGIN TEMPLATE--
 
% --BEGIN RESOURCE preamble--
%%BeginResource: Category uk.co.terryburton.bwipp 0.0 2021092800 29733 32838
%%BeginResource: Category uk.co.terryburton.bwipp 0.0 2022072900 29629 32838
%%BeginData: 6 ASCII Lines
currentglobal
true setglobal
44,19 → 44,74
%%EndResource
% --END RESOURCE preamble--
 
% --BEGIN RESOURCE loadctx--
% --REQUIRES preamble--
%%BeginResource: uk.co.terryburton.bwipp loadctx 0.0 2022072900 40205 39999
%%BeginData: 25 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
begin
/loadctx {
% Place a context dictionary just below the current dictionary, which can
% be populated with static data on the first run and then carried between
% invocations of the encoder
/ctxname exch def
ctx null ne {
ctx ctxname known not {
ctx ctxname 10 dict put
/ctxdef {ctx ctxname get begin exec end} def
} {
/ctxdef {pop} def % No need to redefine within the existing context
} ifelse
currentdict ctx ctxname get end begin begin
} {
/ctxdef {exec} def % No context provided, so define ephemerally
} ifelse
}
[/barcode] {null def} forall
bind def
/loadctx dup load /uk.co.terryburton.bwipp defineresource pop
end
/setpacking where {pop setpacking} if
%%EndData
%%EndResource
% --END RESOURCE loadctx--
 
% --BEGIN RESOURCE unloadctx--
% --REQUIRES preamble--
%%BeginResource: uk.co.terryburton.bwipp unloadctx 0.0 2022072900 38856 38677
%%BeginData: 14 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
begin
/unloadctx {
% Remove the context which is expected to be just underneath currentdict
ctx null ne {
currentdict end end begin
} if
}
[/barcode] {null def} forall
bind def
/unloadctx dup load /uk.co.terryburton.bwipp defineresource pop
end
/setpacking where {pop setpacking} if
%%EndData
%%EndResource
% --END RESOURCE unloadctx--
 
% --BEGIN RESOURCE raiseerror--
% --REQUIRES preamble--
%%BeginResource: uk.co.terryburton.bwipp raiseerror 0.0 2021092800 39041 38872
%%BeginResource: uk.co.terryburton.bwipp raiseerror 0.0 2022072900 39029 38860
%%BeginData: 15 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
begin
/raiseerror {
$error exch /errorinfo exch put
$error exch /errorname exch put
$error /command null put
$error /newerror true put
stop
$error exch /errorinfo exch put
$error exch /errorname exch put
$error /command null put
$error /newerror true put
stop
}
[/barcode] {null def} forall
bind def
68,17 → 123,21
% --END RESOURCE raiseerror--
 
% --BEGIN RESOURCE parseinput--
% --REQUIRES preamble raiseerror--
%%BeginResource: uk.co.terryburton.bwipp parseinput 0.0 2021092800 58513 58076
%%BeginData: 129 ASCII Lines
% --REQUIRES preamble loadctx unloadctx raiseerror--
%%BeginResource: uk.co.terryburton.bwipp parseinput 0.0 2022072900 73481 69190
%%BeginData: 174 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
4 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
begin
/parseinput {
 
6 dict begin
20 dict begin
 
/parseinput //loadctx exec
 
/fncvals exch def
/barcode exch def
 
87,6 → 146,21
/parseonly dup dup fncvals exch known def fncvals exch undef
/eci dup dup fncvals exch known def fncvals exch undef
 
% Control character names to ordinals
{
<<
[
/NUL /SOH /STX /ETX /EOT /ENQ /ACK /BEL
/BS /TAB /LF /VT /FF /CR () () % SO and SI prefix clash with SOH
/DLE /DC1 /DC2 /DC3 /DC4 /NAK /SYN /ETB
/CAN /EM /SUB /ESC /FS /GS /RS /US
]
0 exch {
1 index 1 add 3 1 roll exch 3 -1 roll
} forall pop
>> /ctrl exch def
} ctxdef
 
/msg barcode length array def
/j 0 def
barcode { % loop
111,11 → 185,35
 
% parse
parse {
dup length 3 ge {
dup length 3 ge { % "^XXX" byte
dup 0 3 getinterval ctrl exch
2 copy known {
/j j 1 sub def % Replace "^" with ordinal
get msg exch j exch put
/j j 1 add def
dup length 3 sub 3 exch getinterval
exit
} {
pop pop
} ifelse
} if
dup length 2 ge { % "^XX" to byte
dup 0 2 getinterval ctrl exch
2 copy known {
/j j 1 sub def % Replace "^" with ordinal
get msg exch j exch put
/j j 1 add def
dup length 2 sub 2 exch getinterval
exit
} {
pop pop
} ifelse
} if
dup length 3 ge { % "^NNN" to byte
dup 0 3 getinterval true exch {
dup 48 lt exch 57 gt or { pop false } if
} forall
{ % "^NNN" to byte
{
dup 0 3 getinterval cvi dup 255 gt {
pop pop
/bwipp.invalidOrdinal (Ordinal must be 000 to 255) //raiseerror exec
192,6 → 290,8
0 1 j 1 sub { 1 index exch dup msg exch get put } for
} ifelse
 
//unloadctx exec
 
end
 
}
204,762 → 304,231
%%EndResource
% --END RESOURCE parseinput--
 
% --BEGIN RESOURCE gs1lint--
% --REQUIRES preamble raiseerror--
%%BeginResource: uk.co.terryburton.bwipp gs1lint 0.0 2021092800 346062 386888
%%BeginData: 1674 ASCII Lines
% --BEGIN RESOURCE gs1process--
% --REQUIRES preamble loadctx unloadctx parseinput raiseerror--
%%BeginResource: uk.co.terryburton.bwipp gs1process 0.0 2022072900 564308 592071
%%BeginData: 2899 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
2 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
begin
/gs1lint {
/gs1process {
 
20 dict begin
 
/vals exch def
/ais exch def
/gs1process //loadctx exec
 
/lintnumeric {
true exch {
dup 48 lt exch 57 gt or { pop false exit } if
} forall
not { pop /bwipp.GS1notNumeric (Not numeric) false exit } if
} bind def
 
/lintcset82 {
true exch {
1 string dup 0 4 -1 roll put
(!"%&'()*+,-./0123456789:;<=>?ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz)
exch search not { pop pop false exit } if
pop pop pop
} forall
not { pop /bwipp.GS1badCSET82character (Invalid CSET 82 character) false exit } if
} bind def
 
/lintcset39 {
true exch {
1 string dup 0 4 -1 roll put
(#-/0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ)
exch search not { pop pop false exit } if
pop pop pop
} forall
not { pop /bwipp.GS1badCSET39character (Invalid CSET 39 character) false exit } if
} bind def
 
/lintkey {
dup length 2 lt { pop pop /bwipp.GS1keyTooShort (Key is too short) false exit } if
dup 0 get dup 48 lt exch 57 gt or exch
1 get dup 48 lt exch 57 gt or or {
pop /bwipp.GS1badGCP (Non-numeric company prefix) false exit
} if
} bind def
 
/lintimporteridx {
(-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz)
exch search not {pop pop /bwipp.GS1badImporterIndex (Invalid importer index) false exit} if
pop pop pop
} bind def
 
/lintcsum {
mark exch
dup length 2 mod 0 eq {3} {1} ifelse
exch { 48 sub 1 index mul exch 4 exch sub } forall pop
0 counttomark 1 sub {add} repeat exch pop
10 mod 0 ne { pop /bwipp.GS1badChecksum (Bad checksum) false exit } if
} bind def
 
/cset82 <<
0 (!"%&'\(\)*+,-./0123456789:;<=>?ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz)
{ exch dup 1 add } forall pop
>> def
 
/cset32 <<
0 (23456789ABCDEFGHJKLMNPQRSTUVWXYZ)
{ exch dup 1 add } forall pop
>> def
 
/lintcsumalpha {
dup length 2 lt { pop pop /bwipp.GS1alphaTooShort (Alphanumeric string is too short to check) false exit} if
dup length 2 sub
2 copy
0 exch getinterval mark exch {
dup cset82 exch known { cset82 exch get } { -1 exit } ifelse
} forall
dup -1 eq { cleartomark pop pop pop /bwipp.GS1UnknownCSET82Character (Unknown CSET 82 character) false exit} if
counttomark array astore exch pop
3 1 roll
2 getinterval mark exch {
dup cset32 exch known { cset32 exch get } { -1 exit } ifelse
} forall
dup -1 eq { cleartomark pop pop /bwipp.GS1UnknownCSET32Character (Unknown CSET 32 character) false exit} if
counttomark array astore exch pop
dup 0 get 5 bitshift exch 1 get add exch
[ 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 ]
1 index length
dup 2 index length gt { pop pop pop pop pop /bwipp.GS1alphaTooLong (Alphanumeric string is too long to check) false exit} if
0 exch getinterval {exch} forall
0 exch { 3 -1 roll exch mul add } forall 1021 mod
ne { pop /bwipp.GS1badAlphaCheckCharacters (Bad alphanumeric check characters) false exit} if
} bind def
 
/iso3166 << [
/004 /008 /010 /012 /016 /020 /024 /028 /031 /032 /036 /040 /044 /048
/050 /051 /052 /056 /060 /064 /068 /070 /072 /074 /076 /084 /086 /090 /092 /096
/100 /104 /108 /112 /116 /120 /124 /132 /136 /140 /144 /148
/152 /156 /158 /162 /166 /170 /174 /175 /178 /180 /184 /188 /191 /192 /196
/203 /204 /208 /212 /214 /218 /222 /226 /231 /232 /233 /234 /238 /239 /242 /246 /248
/250 /254 /258 /260 /262 /266 /268 /270 /275 /276 /288 /292 /296
/300 /304 /308 /312 /316 /320 /324 /328 /332 /334 /336 /340 /344 /348
/352 /356 /360 /364 /368 /372 /376 /380 /384 /388 /392 /398
/400 /404 /408 /410 /414 /417 /418 /422 /426 /428 /430 /434 /438 /440 /442 /446
/450 /454 /458 /462 /466 /470 /474 /478 /480 /484 /492 /496 /498 /499
/500 /504 /508 /512 /516 /520 /524 /528 /531 /533 /534 /535 /540 /548
/554 /558 /562 /566 /570 /574 /578 /580 /581 /583 /584 /585 /586 /591 /598
/600 /604 /608 /612 /616 /620 /624 /626 /630 /634 /638 /642 /643 /646
/652 /654 /659 /660 /662 /663 /666 /670 /674 /678 /682 /686 /688 /690 /694
/702 /703 /704 /705 /706 /710 /716 /724 /728 /729 /732 /740 /744 /748
/752 /756 /760 /762 /764 /768 /772 /776 /780 /784 /788 /792 /795 /796 /798
/800 /804 /807 /818 /826 /831 /832 /833 /834 /840
/850 /854 /858 /860 /862 /876 /882 /887 /894
] {dup} forall >> def
 
/lintiso3166 {
iso3166 exch known not { pop /bwipp.GS1UnknownCountry (Unknown country code) false exit } if
} bind def
 
/lintiso3166999 {
dup /999 ne {
iso3166 exch known not { pop /bwipp.GS1UnknownCountryOr999 (Unknown country code or not 999) false exit } if
} {
pop
} ifelse
} bind def
 
/lintiso3166list {
dup length 3 mod 0 ne {
pop pop /bwipp.GS1BadCountryListLength (Not a group of three-digit country codes) false exit
} if
true
0 3 3 index length 1 sub {
2 index exch 3 getinterval
iso3166 exch known not { pop pop false exit } if
} for
not { pop /bwipp.GS1UnknownCountry (Unknown country code) false exit } if
pop
} bind def
 
/iso3166alpha2 << [
/AD /AE /AF /AG /AI /AL /AM /AO /AQ /AR /AS /AT /AU /AW /AX /AZ
/BA /BB /BD /BE /BF /BG /BH /BI /BJ /BL /BM /BN /BO /BQ /BR /BS /BT /BV /BW /BY /BZ
/CA /CC /CD /CF /CG /CH /CI /CK /CL /CM /CN /CO /CR /CU /CV /CW /CX /CY /CZ
/DE /DJ /DK /DM /DO /DZ
/EC /EE /EG /EH /ER /ES /ET
/FI /FJ /FK /FM /FO /FR
/GA /GB /GD /GE /GF /GG /GH /GI /GL /GM /GN /GP /GQ /GR /GS /GT /GU /GW /GY
/HK /HM /HN /HR /HT /HU
/ID /IE /IL /IM /IN /IO /IQ /IR /IS /IT /JE /JM /JO /JP
/KE /KG /KH /KI /KM /KN /KP /KR /KW /KY /KZ
/LA /LB /LC /LI /LK /LR /LS /LT /LU /LV /LY
/MA /MC /MD /ME /MF /MG /MH /MK /ML /MM /MN /MO /MP /MQ /MR /MS /MT /MU /MV /MW /MX /MY /MZ
/NA /NC /NE /NF /NG /NI /NL /NO /NP /NR /NU /NZ
/OM
/PA /PE /PF /PG /PH /PK /PL /PM /PN /PR /PS /PT /PW /PY
/QA
/RE /RO /RS /RU /RW
/SA /SB /SC /SD /SE /SG /SH /SI /SJ /SK /SL /SM /SN /SO /SR /SS /ST /SV /SX /SY /SZ
/TC /TD /TF /TG /TH /TJ /TK /TL /TM /TN /TO /TR /TT /TV /TW /TZ
/UA /UG /UM /US /UY /UZ
/VA /VC /VE /VG /VI /VN /VU
/WF /WS
/YE /YT
/ZA /ZM /ZW
] {dup} forall >> def
 
/lintiso3166alpha2 {
iso3166alpha2 exch known not { pop /bwipp.GS1UnknownCountryAlpha (Unknown country alpha code) false exit } if
} bind def
 
/iso4217 << [
/008 /012 /032 /036 /044 /048
/050 /051 /052 /060 /064 /068 /072 /084 /090 /096
/104 /108 /116 /124 /132 /136 /144
/152 /156 /170 /174 /188 /191 /192
/203 /208 /214 /222 /230 /232 /238 /242 /262 /270 /292
/320 /324 /328 /332 /340 /344 /348
/352 /356 /360 /364 /368 /376 /388 /392 /398
/400 /404 /408 /410 /414 /417 /418
/422 /426 /430 /434 /446
/454 /458 /462 /480 /484 /496 /498
/504 /512 /516 /524 /532 /533 /548
/554 /558 /566 /578 /586 /590 /598
/600 /604 /608 /634 /643 /646 /654 /682 /690 /694
/702 /704 /706 /710 /728 /748
/752 /756 /760 /764 /776 /780 /784 /788
/800 /807 /818 /826 /834 /840 /858 /860 /882 /886
/901 /927 /928 /929 /930 /931 /932 /933 /934 /936 /938
/940 /941 /943 /944 /946 /947 /948 /949
/950 /951 /952 /953 /955 /956 /957 /958 /959
/960 /961 /962 /963 /964 /965 /967 /968 /969
/970 /971 /972 /973 /975 /976 /977 /978 /979
/980 /981 /984 /985 /986 /990 /994 /997 /999
] {dup} forall >> def
 
/lintiso4217 {
iso4217 exch known not { pop /bwipp.GS1UnknownCurrency (Unknown currency code) false exit } if
} bind def
 
/lintiban {
dup length 4 le { pop pop /bwipp.GS1tooShort (IBAN too short) false exit } if
dup true exch {
1 string dup 0 4 -1 roll put
(0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ)
exch search not { pop pop false exit } if
pop pop pop
} forall
not { pop /bwipp.GS1badIBANcharacter (Invalid IBAN character) false exit } if
dup mark exch mark exch {} forall counttomark -4 roll counttomark array astore exch pop {
48 sub dup 9 gt {7 sub dup 10 idiv exch 10 mod} if
} forall counttomark array astore exch pop
0 exch {exch 10 mul add 97 mod} forall
1 ne { pop pop /bwipp.GS1badIBANchecksum (IBAN checksum incorrect) false exit } if
0 2 getinterval lintiso3166alpha2
} bind def
 
/lintzero {
(0) ne { pop /bwipp.GS1zeroRequired (Zero is required) false exit } if
} bind def
 
/lintnonzero {
false exch { 48 ne {pop true} if } forall
not { pop /bwipp.GS1zeroNotPermitted (Zero not permitted) false exit } if
} bind def
 
/lintnozeroprefix {
dup length 1 gt exch 0 get 48 eq and {
pop /bwipp.GS1badZeroPrefix (Zero prefix is not permitted) false exit
} if
} bind def
 
/lintyymmd0 {
dup 2 2 getinterval cvi dup 1 lt exch 12 gt or { pop /bwipp.GS1badMonth (Invalid month) false exit } if
dup 0 2 getinterval cvi dup 21 sub % Update 20YY periodically for century calculation
dup 51 ge {pop 1900 add} { -50 le {2100 add} {2000 add} ifelse} ifelse % YYYY
dup 400 mod 0 eq exch dup 4 mod 0 eq exch 100 mod 0 ne and or % Leap year?
[ 31 3 -1 roll {29} {28} ifelse 31 30 31 30 31 31 30 31 30 31 ]
1 index 2 2 getinterval cvi 1 sub get
exch 4 2 getinterval cvi lt { pop /bwipp.GS1badDay (Invalid day of month) false exit } if
} bind def
 
/lintyymmdd {
dup length 6 ne { pop /bwipp.GS1badDateLength (Invalid length for date) false exit } if
dup 4 2 getinterval cvi 1 lt { pop /bwipp.GS1badDay (Invalid day of month) false exit } if
lintyymmd0
} bind def
 
/lintyymmddhh {
dup length 8 ne { pop /bwipp.GS1badYYMMDDHHLength (Invalid length for date with hour) false exit } if
dup 6 2 getinterval cvi 23 gt { pop pop /bwipp.GS1badHour (Invalid hour of day) false exit } if
0 6 getinterval lintyymmdd
} bind def
 
/linthhmm {
dup 0 2 getinterval cvi 23 gt { pop pop /bwipp.GS1badHour (Invalid hour of day) false exit } if
2 2 getinterval cvi 59 gt { pop /bwipp.GS1badMinute (Invalid minute in the hour) false exit } if
} bind def
 
/lintmmoptss {
dup length dup 2 ne exch 4 ne and {
pop /bwipp.GS1badTimeLength (Invalid length for optional minutes and seconds) false exit
} if
dup 0 2 getinterval cvi 59 gt { pop pop /bwipp.GS1badMinute (Invalid minute in the hour) false exit } if
dup length 4 ge {
dup 2 2 getinterval cvi 59 gt { pop pop /bwipp.GS1badSecond (Invalid second in the minute) false exit } if
} if
pop
} bind def
 
/lintyesno {
dup (0) ne exch (1) ne and {
pop /bwipp.GS1badBoolean (Neither 0 nor 1 for yes or no) false exit
} if
} bind def
 
/lintwinding {
dup (0) ne exch dup (1) ne exch (9) ne and and {
pop /bwipp.GS1badWinding (Invalid winding direction) false exit
} if
} bind def
 
/lintpieceoftotal {
dup length 2 mod 0 ne { pop pop /bwipp.GS1badPieceTotalLength (Invalid piece/total length) false exit } if
dup dup length 2 idiv 0 exch getinterval cvi
dup 0 eq { pop pop pop /bwipp.GS1badPieceNumber (Invalid piece number) false exit } if
exch dup length 2 idiv dup getinterval cvi
dup 0 eq { pop pop pop /bwipp.GS1badPieceTotal (Invalid total number) false exit } if
gt { pop /bwipp.GS1pieceExceedsTotal (Piece number exceeds total) false exit } if
} bind def
 
/lintpcenc {
{
(%) search not {pop exit} if
pop pop dup length 2 lt { pop pop /bwipp.GS1badPercentEscape (Invalid % escape) false exit } if
dup 0 2 getinterval true exch {
1 string dup 0 4 -1 roll put
(0123456789ABCDEFabcdef)
exch search not { pop pop false exit } if
pop pop pop
} forall
not { pop pop /bwipp.GS1badPercentChars (Invalid characters for percent encoding) false exit } if
} loop
} bind def
 
/lintcouponcode {
dup true exch {
dup 48 lt exch 57 gt or { pop false exit } if
} forall
not { pop pop /bwipp.GS1couponNotNumeric (Coupon not numeric) false exit } if
 
% GCP VLI and value
dup length 1 lt {
pop pop /bwipp.GS1couponTooShortGCPVLI (Coupon too short: Missing GCP VLI) false exit
} if
dup 0 1 getinterval cvi dup 6 gt {
pop pop /bwipp.GS1couponBadGCPVLI (Coupon GCP length indicator must be 0-6) false exit
} if
6 add 1 add
2 copy exch length gt {
pop pop pop /bwipp.GS1couponTooShortGCP (Coupon too short: GCP truncated) false exit
} if
dup 2 index length exch sub getinterval
 
% Offer Code
dup length 6 lt {
pop pop /bwipp.GS1couponTooShortOfferCode (Coupon too short: Offer Code truncated) false exit
} if
dup length 6 sub 6 exch getinterval
 
% Save Value VLI and value
dup length 1 lt {
pop pop /bwipp.GS1couponTooShortSaveValueVLI (Coupon too short: Missing Save Value VLI) false exit
} if
dup 0 1 getinterval cvi dup dup 1 lt exch 5 gt or {
pop pop /bwipp.GS1couponBadSaveValueVLI (Coupon Save Value length indicator must be 1-5) false exit
} if
1 add
2 copy exch length gt {
pop pop pop /bwipp.GS1couponTooShortSaveValue (Coupon too short: Save Value truncated) false exit
} if
dup 2 index length exch sub getinterval
 
% 1st Purchase Requirement VLI and value
dup length 1 lt {
pop pop /bwipp.GS1couponTooShort1stPurchaseRequirementVLI (Coupon too short: Missing 1st Purchase Requirement VLI) false exit
} if
dup 0 1 getinterval cvi dup dup 1 lt exch 5 gt or {
pop pop /bwipp.GS1couponBad1stPurchaseRequirementVLI (Coupon 1st Purchase Requirement length indicator must be 1-5) false exit
} if
1 add
2 copy exch length gt {
pop pop pop /bwipp.GS1couponTooShort1stPurchaseRequirement (Coupon too short: 1st Purchase Requirement truncated) false exit
} if
dup 2 index length exch sub getinterval
 
% 1st Purchase Requirement Code
dup length 1 lt {
pop pop /bwipp.GS1couponTooShort1stPurchaseRequirementCode (Coupon too short: Missing 1st Purchase Requirement Code) false exit
} if
dup 0 1 getinterval cvi dup 4 gt exch 9 ne and {
pop pop /bwipp.GS1couponBad1stPurchaseRequirementCode (Coupon 1st Purchase Requirement Code must be 0-4 or 9) false exit
} if
dup length 1 sub 1 exch getinterval
 
% 1st Purchase Family Code
dup length 3 lt {
pop pop /bwipp.GS1couponTooShort1stPurchaseFamilyCode (Coupon too short: 1st Purchase Family Code truncated) false exit
} if
dup length 3 sub 3 exch getinterval
 
% Optional field 1
dup length 1 ge { dup 0 1 getinterval cvi 1 eq {
1 dup 2 index length exch sub getinterval
 
% Additional Purchase Rules Code
dup length 1 lt {
pop pop /bwipp.GS1couponTooShortAdditionalPurchaseRulesCode (Coupon too short: Missing Additional Purchase Rules Code) false exit
} if
dup 0 1 getinterval cvi 3 gt {
pop pop /bwipp.GS1couponBadAdditionalPurchaseRulesCode (Coupon Additional Purchase Rules Code must be 0-3) false exit
} if
dup length 1 sub 1 exch getinterval
 
% 2nd Purchase RequirementVLI and value
dup length 1 lt {
pop pop /bwipp.GS1couponTooShort2ndPurchaseRequirementVLI (Coupon too short: Missing 2nd Purchase Requirement VLI) false exit
} if
dup 0 1 getinterval cvi dup dup 1 lt exch 5 gt or {
pop pop /bwipp.GS1couponBad2ndPurchaseRequirementVLI (Coupon 2nd Purchase Requirement length indicator must be 1-5) false exit
} if
1 add
2 copy exch length gt {
pop pop pop /bwipp.GS1couponTooShort2ndPurchaseRequirement (Coupon too short: 2nd Purchase Requirement truncated) false exit
} if
dup 2 index length exch sub getinterval
 
% 2nd Purchase Requirement Code
dup length 1 lt {
pop pop /bwipp.GS1couponTooShort2ndPurchaseRequirementCode (Coupon too short: Missing 2nd Purchase Requirement Code) false exit
} if
dup 0 1 getinterval cvi dup 4 gt exch 9 ne and {
pop pop /bwipp.GS1couponBad2ndPurchaseRequirementCode (Coupon 2nd Purchase Requirement Code must be 0-4 or 9) false exit
} if
dup length 1 sub 1 exch getinterval
 
% 2nd Purchase Family Code
dup length 3 lt {
pop pop /bwipp.GS1couponTooShort2ndPurchaseFamilyCode (Coupon too short: 2nd Purchase Family Code truncated) false exit
} if
dup length 3 sub 3 exch getinterval
 
% 2nd Purchase GCP VLI and value
dup length 1 lt {
pop pop /bwipp.GS1couponTooShort2ndPurchaseGCPVLI (Coupon too short: Missing 2nd Purchase GCP VLI) false exit
} if
dup 0 1 getinterval cvi dup dup 6 gt exch 9 ne and {
pop pop /bwipp.GS1couponBad2ndPurchaseGCPVLI (Coupon 2nd Purchase GCP length indicator must be 0-6 or 9) false exit
} if
dup 9 ne {6 add} {pop 0} ifelse 1 add
2 copy exch length gt {
pop pop pop /bwipp.GS1couponTooShort2ndPurchaseGCP (Coupon too short: 2nd Purchase GCP truncated) false exit
} if
dup 2 index length exch sub getinterval
 
} if } if
 
% Optional field 2
dup length 1 ge { dup 0 1 getinterval cvi 2 eq {
1 dup 2 index length exch sub getinterval
 
% 3rd Purchase RequirementVLI and value
dup length 1 lt {
pop pop /bwipp.GS1couponTooShort3rdPurchaseRequirementVLI (Coupon too short: Missing 3rd Purchase Requirement VLI) false exit
} if
dup 0 1 getinterval cvi dup dup 1 lt exch 5 gt or {
pop pop /bwipp.GS1couponBad3rdPurchaseRequirementVLI (Coupon 3rd Purchase Requirement length indicator must be 1-5) false exit
} if
1 add
2 copy exch length gt {
pop pop pop /bwipp.GS1couponTooShort3rdPurchaseRequirement (Coupon too short: 3rd Purchase Requirement truncated) false exit
} if
dup 2 index length exch sub getinterval
 
% 3rd Purchase Requirement Code
dup length 1 lt {
pop pop /bwipp.GS1couponTooShort3rdPurchaseRequirementCode (Coupon too short: Missing 3rd Purchase Requirement Code) false exit
} if
dup 0 1 getinterval cvi dup 4 gt exch 9 ne and {
pop pop /bwipp.GS1couponBad3rdPurchaseRequirementCode (Coupon 3rd Purchase Requirement Code must be 0-4 or 9) false exit
} if
dup length 1 sub 1 exch getinterval
 
% 3rd Purchase Family Code
dup length 3 lt {
pop pop /bwipp.GS1couponTooShort3rdPurchaseFamilyCode (Coupon too short: 3rd Purchase Family Code truncated) false exit
} if
dup length 3 sub 3 exch getinterval
 
% 3rd Purchase GCP VLI and value
dup length 1 lt {
pop pop /bwipp.GS1couponTooShort3rdPurchaseGCPVLI (Coupon too short: Missing 3rd Purchase GCP VLI) false exit
} if
dup 0 1 getinterval cvi dup dup 6 gt exch 9 ne and {
pop pop /bwipp.GS1couponBad3rdPurchaseGCPVLI (Coupon 3rd Purchase GCP length indicator must be 0-6 or 9) false exit
} if
dup 9 ne {6 add} {pop 0} ifelse 1 add
2 copy exch length gt {
pop pop pop /bwipp.GS1couponTooShort3rdPurchaseGCP (Coupon too short: 3rd Purchase GCP truncated) false exit
} if
dup 2 index length exch sub getinterval
 
} if } if
 
% Optional field 3
/couponexpire -1 def
dup length 1 ge { dup 0 1 getinterval cvi 3 eq {
1 dup 2 index length exch sub getinterval
 
% Expiration date
dup length 6 lt {
pop pop /bwipp.GS1couponTooShortExpirationDate (Coupon too short: Expiration date) false exit
} if
dup 2 2 getinterval cvi dup 1 lt exch 12 gt or { pop pop /bwipp.GS1couponExpirationDateBadMonth (Invalid month in expiration date) false exit } if
dup 0 2 getinterval cvi dup 21 sub % Update 20YY periodically for century calculation
dup 51 ge {pop 1900 add} { -50 le {2100 add} {2000 add} ifelse} ifelse % YYYY
dup 400 mod 0 eq exch dup 4 mod 0 eq exch 100 mod 0 ne and or % Leap year?
[ 31 3 -1 roll {29} {28} ifelse 31 30 31 30 31 31 30 31 30 31 ]
1 index 2 2 getinterval cvi 1 sub get
1 index 4 2 getinterval cvi dup 3 1 roll lt
exch 1 lt or { pop pop /bwipp.GS1couponExpirationDateBadDay (Invalid day of month in expiration date) false exit } if
dup 0 6 getinterval cvi /couponexpire exch def
dup length 6 sub 6 exch getinterval
 
} if } if
 
% Optional field 4
dup length 1 ge { dup 0 1 getinterval cvi 4 eq {
1 dup 2 index length exch sub getinterval
 
% Start date
dup length 6 lt {
pop pop /bwipp.GS1couponTooShortStartDate (Coupon too short: Start date) false exit
} if
dup 2 2 getinterval cvi dup 1 lt exch 12 gt or { pop pop /bwipp.GS1couponStartDateBadMonth (Invalid month in start date) false exit } if
dup 0 2 getinterval cvi dup 21 sub % Update 20YY periodically for century calculation
dup 51 ge {pop 1900 add} { -50 le {2100 add} {2000 add} ifelse} ifelse % YYYY
dup 400 mod 0 eq exch dup 4 mod 0 eq exch 100 mod 0 ne and or % Leap year?
[ 31 3 -1 roll {29} {28} ifelse 31 30 31 30 31 31 30 31 30 31 ]
1 index 2 2 getinterval cvi 1 sub get
1 index 4 2 getinterval cvi dup 3 1 roll lt
exch 1 lt or { pop pop /bwipp.GS1couponStartDateBadDay (Invalid day of month in start date) false exit } if
dup 0 6 getinterval cvi /couponstart exch def
couponexpire -1 ne couponexpire couponstart lt and {
pop pop /bwipp.GS1couponExpireDateBeforeStartDate (Coupon expires before it starts) false exit
} if
dup length 6 sub 6 exch getinterval
 
} if } if
 
% Optional field 5
dup length 1 ge { dup 0 1 getinterval cvi 5 eq {
1 dup 2 index length exch sub getinterval
 
% Serial Number VLI and value
dup length 1 lt {
pop pop /bwipp.GS1couponTooShortSerialNumberVLI (Coupon too short: Missing Serial Number VLI) false exit
} if
dup 0 1 getinterval cvi 6 add 1 add
2 copy exch length gt {
pop pop pop /bwipp.GS1couponTooShortSerialNumber (Coupon too short: Serial Number truncated) false exit
} if
dup 2 index length exch sub getinterval
 
} if } if
 
% Optional field 6
dup length 1 ge { dup 0 1 getinterval cvi 6 eq {
1 dup 2 index length exch sub getinterval
 
% Retailer GCP/GLN VLI and value
dup length 1 lt {
pop pop /bwipp.GS1couponTooShortRetailerGCPGLNVLI (Coupon too short: Missing Retailer GCP/GLN VLI) false exit
} if
dup 0 1 getinterval cvi dup dup 1 lt exch 7 gt or {
pop pop /bwipp.GS1couponBadRetailerGCPGLNVLI (Coupon Retailer GCP/GLN length indicator must be 1-7) false exit
} if
6 add 1 add
2 copy exch length gt {
pop pop pop /bwipp.GS1couponTooShortRetailerGCPGLN (Coupon too short: Retailer GCP/GLN truncated) false exit
} if
dup 2 index length exch sub getinterval
 
} if } if
 
% Optional field 9
dup length 1 ge { dup 0 1 getinterval cvi 9 eq {
1 dup 2 index length exch sub getinterval
 
% Save Value Code
dup length 1 lt {
pop pop /bwipp.GS1couponTooShortSaveValueCode (Coupon too short: Missing Save Value Code) false exit
} if
dup 0 1 getinterval cvi dup 6 gt exch dup 3 eq exch 4 eq or or {
pop pop /bwipp.GS1couponBadSaveValueCode (Coupon Save Value Code must be 0,1,2,5 or 6) false exit
} if
dup length 1 sub 1 exch getinterval
 
% Save Value Applies to Item
dup length 1 lt {
pop pop /bwipp.GS1couponTooShortSaveValueAppliesToItem (Coupon too short: Missing Save Value Applies to Item) false exit
} if
dup 0 1 getinterval cvi 2 gt {
pop pop /bwipp.GS1couponBadSaveValueAppliesToItem (Coupon Save Value Applies to Item must be 0-2) false exit
} if
dup length 1 sub 1 exch getinterval
 
% Store Coupon Flag
dup length 1 lt {
pop pop /bwipp.GS1couponTooShortStoreCouponFlag (Coupon too short: Missing Store Coupon Flag) false exit
} if
dup length 1 sub 1 exch getinterval
 
% Don't Multiply Flag
dup length 1 lt {
pop pop /bwipp.GS1couponTooShortDontMultiplyFlag (Coupon too short: Missing Don't Multiply Flag) false exit
} if
dup 0 1 getinterval cvi 1 gt {
pop pop /bwipp.GS1couponBadDontMultiplyFlag (Don't Multiply Flag must be 0 or 1) false exit
} if
dup length 1 sub 1 exch getinterval
 
} if } if
 
dup length 0 ne {
pop pop /bwipp.GS1couponUnrecognisedOptionalField (Coupon fields must be 1,2,3,4,5,6 or 9, increasing order) false exit
} if
pop
} bind def
 
/lintcouponposoffer {
dup true exch {
dup 48 lt exch 57 gt or { pop false exit } if
} forall
not { pop pop /bwipp.GS1couponNotNumeric (Coupon not numeric) false exit } if
% Format Code
dup length 1 lt {
pop pop /bwipp.GS1couponTooShortFormatCode (Coupon too short: Missing Format Code) false exit
} if
dup 0 1 getinterval dup (0) ne exch (1) ne and {
pop pop /bwipp.GS1couponBadFormatCode (Coupon format must be 0 or 1) false exit
} if
dup length 1 sub 1 exch getinterval
% Funder ID VLI and Funder ID
dup length 1 lt {
pop pop /bwipp.GS1couponTooShortFunderVLI (Coupon too short: Missing Funder VLI) false exit
} if
dup 0 1 getinterval cvi dup 6 gt {
pop pop pop /bwipp.GS1couponBadFunderVLI (Coupon Funder length indicator must be 0-6) false exit
} if
6 add 1 add
2 copy exch length gt {
pop pop pop /bwipp.GS1couponTooShortFunder (Coupon too short: Truncated Funder ID) false exit
} if
dup 2 index length exch sub getinterval
% Offer Code
dup length 6 lt {
pop pop /bwipp.GS1couponTooShortOfferCode (Coupon too short: Truncated Offer Code) false exit
} if
dup length 6 sub 6 exch getinterval
% Serial Number VLI and Serial Number
dup length 1 lt {
pop pop /bwipp.GS1couponTooShortSnVLI (Coupon too short: Missing SN VLI) false exit
} if
dup 0 1 getinterval cvi
6 add 1 add
2 copy exch length gt {
pop pop pop /bwipp.GS1couponTooShortSn (Coupon too short: Truncated SN) false exit
} if
dup 2 index length exch sub getinterval
dup length 0 ne {
pop pop /bwipp.GS1couponTooLong (Coupon too long) false exit
} if
pop
} bind def
 
{
% Extracted from the GS1 Syntax Dictionary
/gs1syntax <<
 
[
<< /cset /N /min 18 /max 18 /check [ /lintcsum /lintkey ] >>
]
<<
/parts [
<< /cset /N /min 18 /max 18 /opt false /linters [ /lintcsum /lintkey ] >>
]
/dlpkey [ ]
>>
(00) exch dup
pop
 
[
<< /cset /N /min 14 /max 14 /check [ /lintcsum /lintkey ] >>
]
<<
/parts [
<< /cset /N /min 14 /max 14 /opt false /linters [ /lintcsum /lintkey ] >>
]
/ex [ (02) (255) (37) ]
/dlpkey [ [ (22) (10) (21) ] [ (235) ] ]
>>
(01) exch dup
pop
 
<<
/parts [
<< /cset /N /min 14 /max 14 /opt false /linters [ /lintcsum /lintkey ] >>
]
/req [ [ (37) ] ]
>>
(02) exch dup
pop
 
[
<< /cset /X /min 1 /max 20 /check [] >>
]
<<
/parts [
<< /cset /X /min 1 /max 20 /opt false /linters [] >>
]
/req [ [ (01) (02) (8006) (8026) ] ]
>>
(10) exch dup
pop
 
[
<< /cset /N /min 6 /max 6 /check [ /lintyymmd0 ] >>
]
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [ /lintyymmd0 ] >>
]
/req [ [ (01) (02) (8006) (8026) ] ]
>>
(11) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [ /lintyymmd0 ] >>
]
/req [ [ (8020) ] ]
>>
(12) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [ /lintyymmd0 ] >>
]
/req [ [ (01) (02) (8006) (8026) ] ]
>>
(13) exch dup
(15) exch dup
(16) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [ /lintyymmd0 ] >>
]
/req [ [ (01) (02) (255) (8006) (8026) ] ]
>>
(17) exch dup
pop
 
[
<< /cset /N /min 2 /max 2 /check [] >>
]
<<
/parts [
<< /cset /N /min 2 /max 2 /opt false /linters [] >>
]
/req [ [ (01) (02) (8006) (8026) ] ]
>>
(20) exch dup
pop
 
[
<< /cset /X /min 1 /max 20 /check [] >>
]
<<
/parts [
<< /cset /X /min 1 /max 20 /opt false /linters [] >>
]
/ex [ (235) ]
/req [ [ (01) (8006) ] ]
>>
(21) exch dup
pop
 
<<
/parts [
<< /cset /X /min 1 /max 20 /opt false /linters [] >>
]
/req [ [ (01) ] ]
>>
(22) exch dup
pop
 
[
<< /cset /X /min 1 /max 28 /check [] >>
]
<<
/parts [
<< /cset /X /min 1 /max 28 /opt false /linters [] >>
]
/req [ [ (01) ] ]
>>
(235) exch dup
pop
 
[
<< /cset /X /min 1 /max 30 /check [] >>
]
<<
/parts [
<< /cset /X /min 1 /max 30 /opt false /linters [] >>
]
/req [ [ (01) (02) (8006) (8026) ] ]
>>
(240) exch dup
(241) exch dup
pop
 
[
<< /cset /N /min 1 /max 6 /check [] >>
]
<<
/parts [
<< /cset /N /min 1 /max 6 /opt false /linters [] >>
]
/req [ [ (01) (02) (8006) (8026) ] ]
>>
(242) exch dup
pop
 
[
<< /cset /X /min 1 /max 20 /check [] >>
]
<<
/parts [
<< /cset /X /min 1 /max 20 /opt false /linters [] >>
]
/req [ [ (01) ] ]
>>
(243) exch dup
pop
 
[
<< /cset /X /min 1 /max 30 /check [] >>
]
<<
/parts [
<< /cset /X /min 1 /max 30 /opt false /linters [] >>
]
/req [ [ (01) (8006) ] [ (21) ] ]
>>
(250) exch dup
pop
 
<<
/parts [
<< /cset /X /min 1 /max 30 /opt false /linters [] >>
]
/req [ [ (01) (8006) ] ]
>>
(251) exch dup
pop
 
[
<< /cset /N /min 13 /max 13 /check [ /lintcsum /lintkey ] >>
<< /cset /X /min 0 /max 17 /check [] >>
]
<<
/parts [
<< /cset /N /min 13 /max 13 /opt false /linters [ /lintcsum /lintkey ] >>
<< /cset /X /min 1 /max 17 /opt true /linters [] >>
]
/dlpkey [ ]
>>
(253) exch dup
pop
 
[
<< /cset /X /min 1 /max 20 /check [] >>
]
<<
/parts [
<< /cset /X /min 1 /max 20 /opt false /linters [] >>
]
/req [ [ (414) ] ]
>>
(254) exch dup
pop
 
[
<< /cset /N /min 13 /max 13 /check [ /lintcsum /lintkey ] >>
<< /cset /N /min 0 /max 12 /check [] >>
]
<<
/parts [
<< /cset /N /min 13 /max 13 /opt false /linters [ /lintcsum /lintkey ] >>
<< /cset /N /min 1 /max 12 /opt true /linters [] >>
]
/ex [ (01) (02) (415) (8006) (8020) (8026) ]
/dlpkey [ ]
>>
(255) exch dup
pop
 
[
<< /cset /N /min 1 /max 8 /check [] >>
]
<<
/parts [
<< /cset /N /min 1 /max 8 /opt false /linters [] >>
]
/req [ [ (01) (02) ] ]
>>
(30) exch dup
pop
 
[
<< /cset /N /min 6 /max 6 /check [] >>
]
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (310n) ]
/req [ [ (01) (02) ] ]
>>
(3100) exch dup
(3101) exch dup
(3102) exch dup
966,6 → 535,15
(3103) exch dup
(3104) exch dup
(3105) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (311n) ]
/req [ [ (01) (02) ] ]
>>
(3110) exch dup
(3111) exch dup
(3112) exch dup
972,6 → 550,15
(3113) exch dup
(3114) exch dup
(3115) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (312n) ]
/req [ [ (01) (02) ] ]
>>
(3120) exch dup
(3121) exch dup
(3122) exch dup
978,6 → 565,15
(3123) exch dup
(3124) exch dup
(3125) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (313n) ]
/req [ [ (01) (02) ] ]
>>
(3130) exch dup
(3131) exch dup
(3132) exch dup
984,6 → 580,15
(3133) exch dup
(3134) exch dup
(3135) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (314n) ]
/req [ [ (01) (02) ] ]
>>
(3140) exch dup
(3141) exch dup
(3142) exch dup
990,6 → 595,15
(3143) exch dup
(3144) exch dup
(3145) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (315n) ]
/req [ [ (01) (02) ] ]
>>
(3150) exch dup
(3151) exch dup
(3152) exch dup
996,6 → 610,15
(3153) exch dup
(3154) exch dup
(3155) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (316n) ]
/req [ [ (01) (02) ] ]
>>
(3160) exch dup
(3161) exch dup
(3162) exch dup
1002,6 → 625,15
(3163) exch dup
(3164) exch dup
(3165) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (320n) ]
/req [ [ (01) (02) ] ]
>>
(3200) exch dup
(3201) exch dup
(3202) exch dup
1008,6 → 640,15
(3203) exch dup
(3204) exch dup
(3205) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (321n) ]
/req [ [ (01) (02) ] ]
>>
(3210) exch dup
(3211) exch dup
(3212) exch dup
1014,6 → 655,15
(3213) exch dup
(3214) exch dup
(3215) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (322n) ]
/req [ [ (01) (02) ] ]
>>
(3220) exch dup
(3221) exch dup
(3222) exch dup
1020,6 → 670,15
(3223) exch dup
(3224) exch dup
(3225) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (323n) ]
/req [ [ (01) (02) ] ]
>>
(3230) exch dup
(3231) exch dup
(3232) exch dup
1026,6 → 685,15
(3233) exch dup
(3234) exch dup
(3235) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (324n) ]
/req [ [ (01) (02) ] ]
>>
(3240) exch dup
(3241) exch dup
(3242) exch dup
1032,6 → 700,15
(3243) exch dup
(3244) exch dup
(3245) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (325n) ]
/req [ [ (01) (02) ] ]
>>
(3250) exch dup
(3251) exch dup
(3252) exch dup
1038,6 → 715,15
(3253) exch dup
(3254) exch dup
(3255) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (326n) ]
/req [ [ (01) (02) ] ]
>>
(3260) exch dup
(3261) exch dup
(3262) exch dup
1044,6 → 730,15
(3263) exch dup
(3264) exch dup
(3265) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (327n) ]
/req [ [ (01) (02) ] ]
>>
(3270) exch dup
(3271) exch dup
(3272) exch dup
1050,6 → 745,15
(3273) exch dup
(3274) exch dup
(3275) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (328n) ]
/req [ [ (01) (02) ] ]
>>
(3280) exch dup
(3281) exch dup
(3282) exch dup
1056,6 → 760,15
(3283) exch dup
(3284) exch dup
(3285) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (329n) ]
/req [ [ (01) (02) ] ]
>>
(3290) exch dup
(3291) exch dup
(3292) exch dup
1062,6 → 775,15
(3293) exch dup
(3294) exch dup
(3295) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (330n) ]
/req [ [ (00) (01) ] ]
>>
(3300) exch dup
(3301) exch dup
(3302) exch dup
1068,6 → 790,15
(3303) exch dup
(3304) exch dup
(3305) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (331n) ]
/req [ [ (00) (01) ] ]
>>
(3310) exch dup
(3311) exch dup
(3312) exch dup
1074,6 → 805,15
(3313) exch dup
(3314) exch dup
(3315) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (332n) ]
/req [ [ (00) (01) ] ]
>>
(3320) exch dup
(3321) exch dup
(3322) exch dup
1080,6 → 820,15
(3323) exch dup
(3324) exch dup
(3325) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (333n) ]
/req [ [ (00) (01) ] ]
>>
(3330) exch dup
(3331) exch dup
(3332) exch dup
1086,6 → 835,15
(3333) exch dup
(3334) exch dup
(3335) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (334n) ]
/req [ [ (00) (01) ] ]
>>
(3340) exch dup
(3341) exch dup
(3342) exch dup
1092,6 → 850,15
(3343) exch dup
(3344) exch dup
(3345) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (335n) ]
/req [ [ (00) (01) ] ]
>>
(3350) exch dup
(3351) exch dup
(3352) exch dup
1098,6 → 865,15
(3353) exch dup
(3354) exch dup
(3355) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (336n) ]
/req [ [ (00) (01) ] ]
>>
(3360) exch dup
(3361) exch dup
(3362) exch dup
1104,6 → 880,15
(3363) exch dup
(3364) exch dup
(3365) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (337n) ]
/req [ [ (01) ] ]
>>
(3370) exch dup
(3371) exch dup
(3372) exch dup
1110,6 → 895,15
(3373) exch dup
(3374) exch dup
(3375) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (340n) ]
/req [ [ (00) (01) ] ]
>>
(3400) exch dup
(3401) exch dup
(3402) exch dup
1116,6 → 910,15
(3403) exch dup
(3404) exch dup
(3405) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (341n) ]
/req [ [ (00) (01) ] ]
>>
(3410) exch dup
(3411) exch dup
(3412) exch dup
1122,6 → 925,15
(3413) exch dup
(3414) exch dup
(3415) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (342n) ]
/req [ [ (00) (01) ] ]
>>
(3420) exch dup
(3421) exch dup
(3422) exch dup
1128,6 → 940,15
(3423) exch dup
(3424) exch dup
(3425) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (343n) ]
/req [ [ (00) (01) ] ]
>>
(3430) exch dup
(3431) exch dup
(3432) exch dup
1134,6 → 955,15
(3433) exch dup
(3434) exch dup
(3435) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (344n) ]
/req [ [ (00) (01) ] ]
>>
(3440) exch dup
(3441) exch dup
(3442) exch dup
1140,6 → 970,15
(3443) exch dup
(3444) exch dup
(3445) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (345n) ]
/req [ [ (00) (01) ] ]
>>
(3450) exch dup
(3451) exch dup
(3452) exch dup
1146,6 → 985,15
(3453) exch dup
(3454) exch dup
(3455) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (346n) ]
/req [ [ (00) (01) ] ]
>>
(3460) exch dup
(3461) exch dup
(3462) exch dup
1152,6 → 1000,15
(3463) exch dup
(3464) exch dup
(3465) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (347n) ]
/req [ [ (00) (01) ] ]
>>
(3470) exch dup
(3471) exch dup
(3472) exch dup
1158,6 → 1015,15
(3473) exch dup
(3474) exch dup
(3475) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (348n) ]
/req [ [ (00) (01) ] ]
>>
(3480) exch dup
(3481) exch dup
(3482) exch dup
1164,6 → 1030,15
(3483) exch dup
(3484) exch dup
(3485) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (349n) ]
/req [ [ (00) (01) ] ]
>>
(3490) exch dup
(3491) exch dup
(3492) exch dup
1170,6 → 1045,15
(3493) exch dup
(3494) exch dup
(3495) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (350n) ]
/req [ [ (01) (02) ] ]
>>
(3500) exch dup
(3501) exch dup
(3502) exch dup
1176,6 → 1060,15
(3503) exch dup
(3504) exch dup
(3505) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (351n) ]
/req [ [ (01) (02) ] ]
>>
(3510) exch dup
(3511) exch dup
(3512) exch dup
1182,6 → 1075,15
(3513) exch dup
(3514) exch dup
(3515) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (352n) ]
/req [ [ (01) (02) ] ]
>>
(3520) exch dup
(3521) exch dup
(3522) exch dup
1188,6 → 1090,15
(3523) exch dup
(3524) exch dup
(3525) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (353n) ]
/req [ [ (00) (01) ] ]
>>
(3530) exch dup
(3531) exch dup
(3532) exch dup
1194,6 → 1105,15
(3533) exch dup
(3534) exch dup
(3535) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (354n) ]
/req [ [ (00) (01) ] ]
>>
(3540) exch dup
(3541) exch dup
(3542) exch dup
1200,6 → 1120,15
(3543) exch dup
(3544) exch dup
(3545) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (355n) ]
/req [ [ (00) (01) ] ]
>>
(3550) exch dup
(3551) exch dup
(3552) exch dup
1206,6 → 1135,15
(3553) exch dup
(3554) exch dup
(3555) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (356n) ]
/req [ [ (01) (02) ] ]
>>
(3560) exch dup
(3561) exch dup
(3562) exch dup
1212,6 → 1150,15
(3563) exch dup
(3564) exch dup
(3565) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (357n) ]
/req [ [ (01) (02) ] ]
>>
(3570) exch dup
(3571) exch dup
(3572) exch dup
1218,6 → 1165,15
(3573) exch dup
(3574) exch dup
(3575) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (360n) ]
/req [ [ (01) (02) ] ]
>>
(3600) exch dup
(3601) exch dup
(3602) exch dup
1224,6 → 1180,15
(3603) exch dup
(3604) exch dup
(3605) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (361n) ]
/req [ [ (01) (02) ] ]
>>
(3610) exch dup
(3611) exch dup
(3612) exch dup
1230,6 → 1195,15
(3613) exch dup
(3614) exch dup
(3615) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (362n) ]
/req [ [ (00) (01) ] ]
>>
(3620) exch dup
(3621) exch dup
(3622) exch dup
1236,6 → 1210,15
(3623) exch dup
(3624) exch dup
(3625) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (363n) ]
/req [ [ (00) (01) ] ]
>>
(3630) exch dup
(3631) exch dup
(3632) exch dup
1242,6 → 1225,15
(3633) exch dup
(3634) exch dup
(3635) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (364n) ]
/req [ [ (01) (02) ] ]
>>
(3640) exch dup
(3641) exch dup
(3642) exch dup
1248,6 → 1240,15
(3643) exch dup
(3644) exch dup
(3645) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (365n) ]
/req [ [ (01) (02) ] ]
>>
(3650) exch dup
(3651) exch dup
(3652) exch dup
1254,6 → 1255,15
(3653) exch dup
(3654) exch dup
(3655) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (366n) ]
/req [ [ (01) (02) ] ]
>>
(3660) exch dup
(3661) exch dup
(3662) exch dup
1260,6 → 1270,15
(3663) exch dup
(3664) exch dup
(3665) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (367n) ]
/req [ [ (00) (01) ] ]
>>
(3670) exch dup
(3671) exch dup
(3672) exch dup
1266,6 → 1285,15
(3673) exch dup
(3674) exch dup
(3675) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (368n) ]
/req [ [ (00) (01) ] ]
>>
(3680) exch dup
(3681) exch dup
(3682) exch dup
1272,6 → 1300,15
(3683) exch dup
(3684) exch dup
(3685) exch dup
pop
 
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (369n) ]
/req [ [ (00) (01) ] ]
>>
(3690) exch dup
(3691) exch dup
(3692) exch dup
1280,15 → 1317,22
(3695) exch dup
pop
 
[
<< /cset /N /min 1 /max 8 /check [] >>
]
<<
/parts [
<< /cset /N /min 1 /max 8 /opt false /linters [] >>
]
/req [ [ (00) ] [ (02) (8026) ] ]
>>
(37) exch dup
pop
 
[
<< /cset /N /min 1 /max 15 /check [] >>
]
<<
/parts [
<< /cset /N /min 1 /max 15 /opt false /linters [] >>
]
/ex [ (390n) (391n) (394n) (8111) ]
/req [ [ (255) (8020) ] ]
>>
(3900) exch dup
(3901) exch dup
(3902) exch dup
1301,10 → 1345,14
(3909) exch dup
pop
 
[
<< /cset /N /min 3 /max 3 /check [ /lintiso4217 ] >>
<< /cset /N /min 1 /max 15 /check [] >>
]
<<
/parts [
<< /cset /N /min 3 /max 3 /opt false /linters [ /lintiso4217 ] >>
<< /cset /N /min 1 /max 15 /opt false /linters [] >>
]
/ex [ (391n) ]
/req [ [ (8020) ] ]
>>
(3910) exch dup
(3911) exch dup
(3912) exch dup
1317,9 → 1365,13
(3919) exch dup
pop
 
[
<< /cset /N /min 1 /max 15 /check [] >>
]
<<
/parts [
<< /cset /N /min 1 /max 15 /opt false /linters [] >>
]
/ex [ (392n) (393n) ]
/req [ [ (01) ] [ (30) (31nn) (32nn) (35nn) (36nn) ] ]
>>
(3920) exch dup
(3921) exch dup
(3922) exch dup
1332,10 → 1384,14
(3929) exch dup
pop
 
[
<< /cset /N /min 3 /max 3 /check [ /lintiso4217 ] >>
<< /cset /N /min 1 /max 15 /check [] >>
]
<<
/parts [
<< /cset /N /min 3 /max 3 /opt false /linters [ /lintiso4217 ] >>
<< /cset /N /min 1 /max 15 /opt false /linters [] >>
]
/ex [ (393n) ]
/req [ [ (30) (31nn) (32nn) (35nn) (36nn) ] ]
>>
(3930) exch dup
(3931) exch dup
(3932) exch dup
1348,9 → 1404,13
(3939) exch dup
pop
 
[
<< /cset /N /min 4 /max 4 /check [] >>
]
<<
/parts [
<< /cset /N /min 4 /max 4 /opt false /linters [] >>
]
/ex [ (394n) (8111) ]
/req [ [ (255) ] ]
>>
(3940) exch dup
(3941) exch dup
(3942) exch dup
1357,9 → 1417,13
(3943) exch dup
pop
 
[
<< /cset /N /min 6 /max 6 /check [] >>
]
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/ex [ (392n) (393n) (395n) (8005) ]
/req [ [ (30) (31nn) (32nn) (35nn) (36nn) ] ]
>>
(3950) exch dup
(3951) exch dup
(3952) exch dup
1368,264 → 1432,470
(3955) exch dup
pop
 
[
<< /cset /X /min 1 /max 30 /check [] >>
]
<<
/parts [
<< /cset /X /min 1 /max 30 /opt false /linters [] >>
]
>>
(400) exch dup
pop
 
[
<< /cset /X /min 1 /max 30 /check [ /lintkey ] >>
]
<<
/parts [
<< /cset /X /min 1 /max 30 /opt false /linters [ /lintkey ] >>
]
/dlpkey [ ]
>>
(401) exch dup
pop
 
[
<< /cset /N /min 17 /max 17 /check [ /lintcsum /lintkey ] >>
]
<<
/parts [
<< /cset /N /min 17 /max 17 /opt false /linters [ /lintcsum /lintkey ] >>
]
/dlpkey [ ]
>>
(402) exch dup
pop
 
[
<< /cset /X /min 1 /max 30 /check [] >>
]
<<
/parts [
<< /cset /X /min 1 /max 30 /opt false /linters [] >>
]
/req [ [ (00) ] ]
>>
(403) exch dup
pop
 
[
<< /cset /N /min 13 /max 13 /check [ /lintcsum /lintkey ] >>
]
<<
/parts [
<< /cset /N /min 13 /max 13 /opt false /linters [ /lintcsum /lintkey ] >>
]
>>
(410) exch dup
(411) exch dup
(412) exch dup
(413) exch dup
pop
 
<<
/parts [
<< /cset /N /min 13 /max 13 /opt false /linters [ /lintcsum /lintkey ] >>
]
/dlpkey [ [ (254) ] [ (7040) ] ]
>>
(414) exch dup
pop
 
<<
/parts [
<< /cset /N /min 13 /max 13 /opt false /linters [ /lintcsum /lintkey ] >>
]
/req [ [ (8020) ] ]
>>
(415) exch dup
pop
 
<<
/parts [
<< /cset /N /min 13 /max 13 /opt false /linters [ /lintcsum /lintkey ] >>
]
>>
(416) exch dup
pop
 
<<
/parts [
<< /cset /N /min 13 /max 13 /opt false /linters [ /lintcsum /lintkey ] >>
]
/dlpkey [ [ (7040) ] ]
>>
(417) exch dup
pop
 
[
<< /cset /X /min 1 /max 20 /check [] >>
]
<<
/parts [
<< /cset /X /min 1 /max 20 /opt false /linters [] >>
]
/ex [ (421) ]
>>
(420) exch dup
pop
 
[
<< /cset /N /min 3 /max 3 /check [ /lintiso3166 ] >>
<< /cset /X /min 1 /max 9 /check [] >>
]
<<
/parts [
<< /cset /N /min 3 /max 3 /opt false /linters [ /lintiso3166 ] >>
<< /cset /X /min 1 /max 9 /opt false /linters [] >>
]
/ex [ (4307) ]
>>
(421) exch dup
pop
 
[
<< /cset /N /min 3 /max 3 /check [ /lintiso3166 ] >>
]
<<
/parts [
<< /cset /N /min 3 /max 3 /opt false /linters [ /lintiso3166 ] >>
]
/ex [ (426) ]
/req [ [ (01) (02) (8006) (8026) ] ]
>>
(422) exch dup
pop
 
[
<< /cset /N /min 3 /max 15 /check [ /lintiso3166list ] >>
]
<<
/parts [
<< /cset /N /min 1 /max 15 /opt false /linters [ /lintiso3166list ] >>
]
/ex [ (426) ]
/req [ [ (01) (02) ] ]
>>
(423) exch dup
pop
 
[
<< /cset /N /min 3 /max 3 /check [ /lintiso3166 ] >>
]
<<
/parts [
<< /cset /N /min 3 /max 3 /opt false /linters [ /lintiso3166 ] >>
]
/ex [ (426) ]
/req [ [ (01) (02) ] ]
>>
(424) exch dup
pop
 
[
<< /cset /N /min 3 /max 15 /check [ /lintiso3166list ] >>
]
<<
/parts [
<< /cset /N /min 1 /max 15 /opt false /linters [ /lintiso3166list ] >>
]
/ex [ (426) ]
/req [ [ (01) (02) ] ]
>>
(425) exch dup
pop
 
[
<< /cset /N /min 3 /max 3 /check [ /lintiso3166 ] >>
]
<<
/parts [
<< /cset /N /min 3 /max 3 /opt false /linters [ /lintiso3166 ] >>
]
/req [ [ (01) (02) ] ]
>>
(426) exch dup
pop
 
[
<< /cset /X /min 1 /max 3 /check [] >>
]
<<
/parts [
<< /cset /X /min 1 /max 3 /opt false /linters [] >>
]
/req [ [ (01) (02) ] [ (422) ] ]
>>
(427) exch dup
pop
 
[
<< /cset /X /min 1 /max 35 /check [ /lintpcenc ] >>
]
<<
/parts [
<< /cset /X /min 1 /max 35 /opt false /linters [ /lintpcenc ] >>
]
/req [ [ (00) ] ]
>>
(4300) exch dup
(4301) exch dup
pop
 
[
<< /cset /X /min 1 /max 70 /check [ /lintpcenc ] >>
]
<<
/parts [
<< /cset /X /min 1 /max 70 /opt false /linters [ /lintpcenc ] >>
]
/req [ [ (00) ] ]
>>
(4302) exch dup
pop
 
<<
/parts [
<< /cset /X /min 1 /max 70 /opt false /linters [ /lintpcenc ] >>
]
/req [ [ (4302) ] ]
>>
(4303) exch dup
pop
 
<<
/parts [
<< /cset /X /min 1 /max 70 /opt false /linters [ /lintpcenc ] >>
]
/req [ [ (00) ] ]
>>
(4304) exch dup
(4305) exch dup
(4306) exch dup
pop
 
[
<< /cset /X /min 2 /max 2 /check [ /lintiso3166alpha2 ] >>
]
<<
/parts [
<< /cset /X /min 2 /max 2 /opt false /linters [ /lintiso3166alpha2 ] >>
]
/req [ [ (00) ] ]
>>
(4307) exch dup
pop
 
[
<< /cset /X /min 1 /max 30 /check [] >>
]
<<
/parts [
<< /cset /X /min 1 /max 30 /opt false /linters [] >>
]
/req [ [ (00) ] ]
>>
(4308) exch dup
pop
 
[
<< /cset /X /min 1 /max 35 /check [ /lintpcenc ] >>
]
<<
/parts [
<< /cset /N /min 20 /max 20 /opt false /linters [ /lintlatlong ] >>
]
/req [ [ (00) ] ]
>>
(4309) exch dup
pop
 
<<
/parts [
<< /cset /X /min 1 /max 35 /opt false /linters [ /lintpcenc ] >>
]
/req [ [ (00) ] ]
>>
(4310) exch dup
(4311) exch dup
pop
 
[
<< /cset /X /min 1 /max 70 /check [ /lintpcenc ] >>
]
<<
/parts [
<< /cset /X /min 1 /max 70 /opt false /linters [ /lintpcenc ] >>
]
/req [ [ (00) ] ]
>>
(4312) exch dup
pop
 
<<
/parts [
<< /cset /X /min 1 /max 70 /opt false /linters [ /lintpcenc ] >>
]
/req [ [ (4312) ] ]
>>
(4313) exch dup
pop
 
<<
/parts [
<< /cset /X /min 1 /max 70 /opt false /linters [ /lintpcenc ] >>
]
/req [ [ (00) ] ]
>>
(4314) exch dup
(4315) exch dup
(4316) exch dup
pop
 
[
<< /cset /X /min 2 /max 2 /check [ /lintiso3166alpha2 ] >>
]
<<
/parts [
<< /cset /X /min 2 /max 2 /opt false /linters [ /lintiso3166alpha2 ] >>
]
/req [ [ (00) ] ]
>>
(4317) exch dup
pop
 
[
<< /cset /X /min 1 /max 20 /check [] >>
]
<<
/parts [
<< /cset /X /min 1 /max 20 /opt false /linters [] >>
]
/req [ [ (00) ] ]
>>
(4318) exch dup
pop
 
[
<< /cset /X /min 1 /max 30 /check [] >>
]
<<
/parts [
<< /cset /X /min 1 /max 30 /opt false /linters [] >>
]
/req [ [ (00) ] ]
>>
(4319) exch dup
pop
 
[
<< /cset /X /min 1 /max 35 /check [ /lintpcenc ] >>
]
<<
/parts [
<< /cset /X /min 1 /max 35 /opt false /linters [ /lintpcenc ] >>
]
/req [ [ (00) ] ]
>>
(4320) exch dup
pop
 
[
<< /cset /N /min 1 /max 1 /check [ /lintyesno ] >>
]
<<
/parts [
<< /cset /N /min 1 /max 1 /opt false /linters [ /lintyesno ] >>
]
/req [ [ (00) ] ]
>>
(4321) exch dup
(4322) exch dup
(4323) exch dup
pop
 
[
<< /cset /N /min 6 /max 6 /check [ /lintyymmd0 ] >>
<< /cset /N /min 4 /max 4 /check [ /linthhmm ] >>
]
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [ /lintyymmd0 ] >>
<< /cset /N /min 4 /max 4 /opt false /linters [ /linthhmm ] >>
]
/req [ [ (00) ] ]
>>
(4324) exch dup
(4325) exch dup
pop
 
[
<< /cset /N /min 6 /max 6 /check [ /lintyymmdd ] >>
]
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [ /lintyymmdd ] >>
]
/req [ [ (00) ] ]
>>
(4326) exch dup
pop
 
[
<< /cset /N /min 13 /max 13 /check [] >>
]
<<
/parts [
<< /cset /N /min 13 /max 13 /opt false /linters [] >>
]
/req [ [ (01) (02) (8006) (8026) ] ]
>>
(7001) exch dup
pop
 
[
<< /cset /X /min 1 /max 30 /check [] >>
]
<<
/parts [
<< /cset /X /min 1 /max 30 /opt false /linters [] >>
]
/req [ [ (01) (02) ] ]
>>
(7002) exch dup
pop
 
[
<< /cset /N /min 6 /max 6 /check [ /lintyymmdd ] >>
<< /cset /N /min 4 /max 4 /check [ /linthhmm ] >>
]
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [ /lintyymmdd ] >>
<< /cset /N /min 4 /max 4 /opt false /linters [ /linthhmm ] >>
]
/req [ [ (01) (02) ] ]
>>
(7003) exch dup
pop
 
[
<< /cset /N /min 1 /max 4 /check [] >>
]
<<
/parts [
<< /cset /N /min 1 /max 4 /opt false /linters [] >>
]
/req [ [ (01) ] [ (10) ] ]
>>
(7004) exch dup
pop
 
[
<< /cset /X /min 1 /max 12 /check [] >>
]
<<
/parts [
<< /cset /X /min 1 /max 12 /opt false /linters [] >>
]
/req [ [ (01) (02) ] ]
>>
(7005) exch dup
pop
 
[
<< /cset /N /min 6 /max 6 /check [ /lintyymmdd ] >>
]
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [ /lintyymmdd ] >>
]
/req [ [ (01) (02) ] ]
>>
(7006) exch dup
pop
 
[
<< /cset /N /min 6 /max 6 /check [ /lintyymmdd ] >>
<< /cset /N /min 0 /max 6 /check [ /lintyymmdd ] >>
]
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [ /lintyymmdd ] >>
<< /cset /N /min 6 /max 6 /opt true /linters [ /lintyymmdd ] >>
]
/req [ [ (01) (02) ] ]
>>
(7007) exch dup
pop
 
[
<< /cset /X /min 1 /max 3 /check [] >>
]
<<
/parts [
<< /cset /X /min 1 /max 3 /opt false /linters [] >>
]
/req [ [ (01) (02) ] ]
>>
(7008) exch dup
pop
 
[
<< /cset /X /min 1 /max 10 /check [] >>
]
<<
/parts [
<< /cset /X /min 1 /max 10 /opt false /linters [] >>
]
/req [ [ (01) (02) ] ]
>>
(7009) exch dup
pop
 
[
<< /cset /X /min 1 /max 2 /check [] >>
]
<<
/parts [
<< /cset /X /min 1 /max 2 /opt false /linters [] >>
]
/req [ [ (01) (02) ] ]
>>
(7010) exch dup
pop
 
[
<< /cset /X /min 1 /max 20 /check [] >>
]
<<
/parts [
<< /cset /X /min 1 /max 20 /opt false /linters [] >>
]
/req [ [ (01) (8006) ] [ (416) ] ]
>>
(7020) exch dup
pop
 
<<
/parts [
<< /cset /X /min 1 /max 20 /opt false /linters [] >>
]
/req [ [ (01) (8006) ] ]
>>
(7021) exch dup
pop
 
<<
/parts [
<< /cset /X /min 1 /max 20 /opt false /linters [] >>
]
/req [ [ (7021) ] ]
>>
(7022) exch dup
pop
 
[
<< /cset /X /min 1 /max 30 /check [ /lintkey ] >>
]
<<
/parts [
<< /cset /X /min 1 /max 30 /opt false /linters [ /lintkey ] >>
]
>>
(7023) exch dup
pop
 
[
<< /cset /N /min 3 /max 3 /check [ /lintiso3166999 ] >>
<< /cset /X /min 1 /max 27 /check [] >>
]
<<
/parts [
<< /cset /N /min 3 /max 3 /opt false /linters [ /lintiso3166999 ] >>
<< /cset /X /min 1 /max 27 /opt false /linters [] >>
]
/req [ [ (01) (02) ] ]
>>
(7030) exch dup
(7031) exch dup
(7032) exch dup
1638,18 → 1908,23
(7039) exch dup
pop
 
[
<< /cset /N /min 1 /max 1 /check [] >>
<< /cset /X /min 1 /max 1 /check [] >>
<< /cset /X /min 1 /max 1 /check [] >>
<< /cset /X /min 1 /max 1 /check [ /lintimporteridx ] >>
]
<<
/parts [
<< /cset /N /min 1 /max 1 /opt false /linters [] >>
<< /cset /X /min 1 /max 1 /opt false /linters [] >>
<< /cset /X /min 1 /max 1 /opt false /linters [] >>
<< /cset /X /min 1 /max 1 /opt false /linters [ /lintimporteridx ] >>
]
>>
(7040) exch dup
pop
 
[
<< /cset /X /min 1 /max 20 /check [] >>
]
<<
/parts [
<< /cset /X /min 1 /max 20 /opt false /linters [] >>
]
/req [ [ (01) ] ]
>>
(710) exch dup
(711) exch dup
(712) exch dup
1658,10 → 1933,13
(715) exch dup
pop
 
[
<< /cset /X /min 2 /max 2 /check [] >>
<< /cset /X /min 1 /max 28 /check [] >>
]
<<
/parts [
<< /cset /X /min 2 /max 2 /opt false /linters [] >>
<< /cset /X /min 1 /max 28 /opt false /linters [] >>
]
/req [ [ (01) (8004) ] ]
>>
(7230) exch dup
(7231) exch dup
(7232) exch dup
1674,157 → 1952,235
(7239) exch dup
pop
 
[
<< /cset /X /min 1 /max 20 /check [] >>
]
<<
/parts [
<< /cset /X /min 1 /max 20 /opt false /linters [] >>
]
/req [ [ (01) (8006) ] ]
>>
(7240) exch dup
pop
 
[
<< /cset /N /min 4 /max 4 /check [ /lintnonzero ] >>
<< /cset /N /min 5 /max 5 /check [ /lintnonzero ] >>
<< /cset /N /min 3 /max 3 /check [ /lintnonzero ] >>
<< /cset /N /min 1 /max 1 /check [ /lintwinding ] >>
<< /cset /N /min 1 /max 1 /check [] >>
]
<<
/parts [
<< /cset /N /min 4 /max 4 /opt false /linters [ /lintnonzero ] >>
<< /cset /N /min 5 /max 5 /opt false /linters [ /lintnonzero ] >>
<< /cset /N /min 3 /max 3 /opt false /linters [ /lintnonzero ] >>
<< /cset /N /min 1 /max 1 /opt false /linters [ /lintwinding ] >>
<< /cset /N /min 1 /max 1 /opt false /linters [] >>
]
/req [ [ (01) ] ]
>>
(8001) exch dup
pop
 
[
<< /cset /X /min 1 /max 20 /check [] >>
]
<<
/parts [
<< /cset /X /min 1 /max 20 /opt false /linters [] >>
]
>>
(8002) exch dup
pop
 
[
<< /cset /N /min 1 /max 1 /check [ /lintzero ] >>
<< /cset /N /min 13 /max 13 /check [ /lintcsum /lintkey ] >>
<< /cset /X /min 0 /max 16 /check [] >>
]
<<
/parts [
<< /cset /N /min 1 /max 1 /opt false /linters [ /lintzero ] >>
<< /cset /N /min 13 /max 13 /opt false /linters [ /lintcsum /lintkey ] >>
<< /cset /X /min 1 /max 16 /opt true /linters [] >>
]
/dlpkey [ ]
>>
(8003) exch dup
pop
 
[
<< /cset /X /min 1 /max 30 /check [ /lintkey ] >>
]
<<
/parts [
<< /cset /X /min 1 /max 30 /opt false /linters [ /lintkey ] >>
]
/dlpkey [ [ (7040) ] ]
>>
(8004) exch dup
pop
 
[
<< /cset /N /min 6 /max 6 /check [] >>
]
<<
/parts [
<< /cset /N /min 6 /max 6 /opt false /linters [] >>
]
/req [ [ (01) (02) ] ]
>>
(8005) exch dup
pop
 
[
<< /cset /N /min 14 /max 14 /check [ /lintcsum ] >>
<< /cset /N /min 4 /max 4 /check [ /lintpieceoftotal ] >>
]
<<
/parts [
<< /cset /N /min 14 /max 14 /opt false /linters [ /lintcsum ] >>
<< /cset /N /min 4 /max 4 /opt false /linters [ /lintpieceoftotal ] >>
]
/ex [ (01) (37) ]
/dlpkey [ [ (22) (10) (21) ] ]
>>
(8006) exch dup
pop
 
[
<< /cset /X /min 1 /max 34 /check [ /lintiban ] >>
]
<<
/parts [
<< /cset /X /min 1 /max 34 /opt false /linters [ /lintiban ] >>
]
/req [ [ (415) ] ]
>>
(8007) exch dup
pop
 
[
<< /cset /N /min 8 /max 8 /check [ /lintyymmddhh ] >>
<< /cset /N /min 0 /max 4 /check [ /lintmmoptss ] >>
]
<<
/parts [
<< /cset /N /min 8 /max 8 /opt false /linters [ /lintyymmddhh ] >>
<< /cset /N /min 1 /max 4 /opt true /linters [ /lintmmoptss ] >>
]
/req [ [ (01) (02) ] ]
>>
(8008) exch dup
pop
 
[
<< /cset /X /min 1 /max 50 /check [] >>
]
<<
/parts [
<< /cset /X /min 1 /max 50 /opt false /linters [] >>
]
/req [ [ (00) (01) ] ]
>>
(8009) exch dup
pop
 
[
<< /cset /C /min 1 /max 30 /check [ /lintkey ] >>
]
<<
/parts [
<< /cset /Y /min 1 /max 30 /opt false /linters [ /lintkey ] >>
]
/dlpkey [ [ (8011) ] ]
>>
(8010) exch dup
pop
 
[
<< /cset /N /min 1 /max 12 /check [ /lintnozeroprefix ] >>
]
<<
/parts [
<< /cset /N /min 1 /max 12 /opt false /linters [ /lintnozeroprefix ] >>
]
/req [ [ (8010) ] ]
>>
(8011) exch dup
pop
 
[
<< /cset /X /min 1 /max 20 /check [] >>
]
<<
/parts [
<< /cset /X /min 1 /max 20 /opt false /linters [] >>
]
/req [ [ (01) (8006) ] ]
>>
(8012) exch dup
pop
 
[
<< /cset /X /min 1 /max 25 /check [ /lintcsumalpha /lintkey ] >>
]
<<
/parts [
<< /cset /X /min 1 /max 25 /opt false /linters [ /lintcsumalpha /lintkey ] >>
]
/dlpkey [ ]
>>
(8013) exch dup
pop
 
[
<< /cset /N /min 18 /max 18 /check [ /lintcsum ] >>
]
<<
/parts [
<< /cset /N /min 18 /max 18 /opt false /linters [ /lintcsum ] >>
]
/dlpkey [ [ (8019) ] ]
>>
(8017) exch dup
pop
 
<<
/parts [
<< /cset /N /min 18 /max 18 /opt false /linters [ /lintcsum ] >>
]
/ex [ (8017) ]
/dlpkey [ [ (8019) ] ]
>>
(8018) exch dup
pop
 
[
<< /cset /N /min 1 /max 10 /check [] >>
]
<<
/parts [
<< /cset /N /min 1 /max 10 /opt false /linters [] >>
]
/req [ [ (8017) (8018) ] ]
>>
(8019) exch dup
pop
 
[
<< /cset /X /min 1 /max 25 /check [] >>
]
<<
/parts [
<< /cset /X /min 1 /max 25 /opt false /linters [] >>
]
/req [ [ (415) ] ]
>>
(8020) exch dup
pop
 
[
<< /cset /N /min 14 /max 14 /check [ /lintcsum ] >>
<< /cset /N /min 4 /max 4 /check [ /lintpieceoftotal ] >>
]
<<
/parts [
<< /cset /N /min 14 /max 14 /opt false /linters [ /lintcsum ] >>
<< /cset /N /min 4 /max 4 /opt false /linters [ /lintpieceoftotal ] >>
]
/ex [ (02) (8006) ]
/req [ [ (37) ] ]
>>
(8026) exch dup
pop
 
[
<< /cset /X /min 1 /max 70 /check [ /lintcouponcode ] >>
]
<<
/parts [
<< /cset /X /min 1 /max 70 /opt false /linters [ /lintcouponcode ] >>
]
>>
(8110) exch dup
pop
 
[
<< /cset /N /min 4 /max 4 /check [] >>
]
<<
/parts [
<< /cset /N /min 4 /max 4 /opt false /linters [] >>
]
/req [ [ (255) ] ]
>>
(8111) exch dup
pop
 
[
<< /cset /X /min 1 /max 70 /check [ /lintcouponposoffer ] >>
]
<<
/parts [
<< /cset /X /min 1 /max 70 /opt false /linters [ /lintcouponposoffer ] >>
]
>>
(8112) exch dup
pop
 
[
<< /cset /X /min 1 /max 70 /check [] >>
]
<<
/parts [
<< /cset /X /min 1 /max 70 /opt false /linters [] >>
]
/req [ [ (01) ] ]
>>
(8200) exch dup
pop
 
[
<< /cset /X /min 1 /max 30 /check [] >>
]
<<
/parts [
<< /cset /X /min 1 /max 30 /opt false /linters [] >>
]
>>
(90) exch dup
pop
 
[
<< /cset /X /min 1 /max 90 /check [] >>
]
<<
/parts [
<< /cset /X /min 1 /max 90 /opt false /linters [] >>
]
>>
(91) exch dup
(92) exch dup
(93) exch dup
1837,61 → 2193,1030
pop
 
>> def
} ctxdef
 
true
0 1 vals length 1 sub {
dup ais exch get /ai exch def
vals exch get /val exch def
gs1syntax ai known {
gs1syntax ai get { % For each element of the AI
/props exch def
props /max get val length 2 copy gt {exch} if pop
val exch 0 exch getinterval /eval exch def
/val val eval length dup val length exch sub getinterval def
eval length props /min get lt {
pop /bwipp.GS1valueTooShort (Too short) false exit
% Extract AIs and vals from provided GS1 data in the indicated format
 
/ai eq { % Bracketed AI element string
 
% Parse out AIs and values
(\() anchorsearch not {
pop /bwipp.GS1aiMissingOpenParen (AIs must start with '\(') //raiseerror exec
} if
pop
mark exch { % loop
dup () eq {pop exit} if
(\)) search not {
cleartomark /bwipp.GS1aiMissingCloseParen (AIs must end with '\)') //raiseerror exec
} if
exch pop exch
(\() search { exch pop exch } { () } ifelse
} loop
counttomark dup 0 gt {dup 2 idiv 1 add -1 exch {-1 roll} for} {pop} ifelse
counttomark 2 idiv array astore /ais exch def
counttomark array astore [ exch { % Expand ordinals of the form ^NNN to ASCII
<< /parse parse /parseonly true /parsefnc false >> //parseinput exec
} forall ] /vals exch def
pop
 
} { % Digital Link URI
 
% Validate and strip the scheme
(http://) anchorsearch not {
(https://) anchorsearch not {
pop /bwipp.GS1dlURIbadScheme (Scheme must be http:// or https://) //raiseerror exec
} if} if
pop
 
% Strip the domain
(/) search not {
pop /bwipp.GS1dlMissingDomainOrPathInfo (URI must contain a domain and path info) //raiseerror exec
} if
pop pop
 
% Fragment delimits end of data
(#) search {
exch pop exch pop
} if
 
% Query parameter marker splits path info and query parameters
(?) search not {
() exch null exch
} if
/pp exch def
pop
/qp exch def
 
% Find positions of character immediately following "/" in the path info
mark 0
0 pp {
(/) search not {pop exit} if
length 1 add exch pop 2 index add exch
} loop
counttomark 1 sub array astore /pipos exch def pop pop
pipos length 1 le {
/bwipp.GS1dlNoAIinfo (The path was too short to contain AI info) //raiseerror exec
} if
 
% Walk backwards to find the right-most path element that is a valid dlpkey
false
pipos length 2 sub -2 0 {
dup
dup pipos exch get
exch pipos exch 1 add get 1 index sub 1 sub pp 3 1 roll getinterval
dup gs1syntax exch known {
gs1syntax exch get /dlpkey known {
exch pop true exit
} if
<< /N /lintnumeric /X /lintcset82 /C /lintcset39 >> props /cset get get eval exch load exec
eval length 0 gt {
props /check get { eval exch load exec } forall
} if
} {
pop
} ifelse
pop
} for
not {
/bwipp.GS1dlNoAIinfo (The path does not contain a valid primary key) //raiseerror exec
} if
pipos exch get dup pp length exch sub pp 3 1 roll getinterval /pp exch def
 
/uriunescape {
/in exch def
/out in length string def
0 0 {
1 index in length ge {exit} if
in 2 index get
dup 43 eq { % "+" -> " "
pop out 1 index 32 put
1 add exch 1 add exch
} {
dup 37 eq 3 index in length 2 sub lt and { % "%nn" -> ord
pop
(< >) 4 string copy dup 1 in 5 index 1 add 2 getinterval putinterval cvx
stopped {
pop pop raiseerror_invalid_hex_character
} if
0 get out exch 2 index exch put
1 add exch 3 add exch
} {
out exch 2 index exch put
1 add exch 1 add exch
} ifelse } ifelse
} loop
out exch 0 exch getinterval /out exch def
pop
out
} def
 
/ais 99 array def
/vals 99 array def
0
 
% Extract AIs from the path components
pp {
(/) search {
ais exch 4 index exch put
pop
(/) search {exch pop} {() exch} ifelse
vals exch 3 index exch uriunescape put
} {
pop exit
} ifelse
exch 1 add exch
} loop
 
% Validate the key-qualifiers in the path info sequence
dup 1 gt {
false
gs1syntax ais 0 get get /dlpkey get {
/seq exch def
/i 1 def /j 0 def
{
i ais length ge {exit} if
j seq length ge {exit} if
ais i get seq j get eq {
/i i 1 add def
} if
/j j 1 add def
} loop
i 2 index eq {pop true exit} if
} forall
dup not {exit} if
val length 0 ne {
pop /bwipp.GS1valueTooLong (Too long) false exit
not {
pop /bwipp.GS1dlBadPathInfo (The AIs in the path are not a valid key-qualifier sequence for the key) //raiseerror exec
} if
} if
 
% Extract AIs from the query parameters
qp {
dup () eq {pop exit} if
(&) search {exch pop} {() exch} ifelse
(=) search {
true 1 index {dup 48 ge exch 57 le and and} forall {
ais exch 5 index exch put
pop
vals exch 3 index exch uriunescape put
exch 1 add exch
} { % Ignore non-numeric parameters
pop pop pop
} ifelse
} { % Ignore singletons and empty parameters
pop
} ifelse
} loop
 
/ais ais 0 3 index getinterval def
/vals vals 0 3 index getinterval def
pop
 
% Expand any extracted GTINs
0 1 ais length 1 sub {
dup ais exch get (01) eq {
dup vals exch get
dup length dup 8 eq exch dup 12 eq exch 13 eq or or {
(00000000000000) 14 string copy dup 3 -1 roll dup length 14 exch sub exch putinterval
vals exch 2 index exch put
} {
pop
} ifelse
} if
pop
} for
 
} ifelse
 
% AIs not requiring FNC1 separation
{
/aifixed << [
(00) (01) (02) (03) (04)
(11) (12) (13) (14) (15) (16) (17) (18) (19) (20)
% (23) % Reassigned to variable-length AI (235)!
(31) (32) (33) (34) (35) (36)
(41)
] {dup} forall >> def
} ctxdef
 
/fncs [
ais {
true exch
dup length 2 ge {
0 2 getinterval aifixed exch known {pop false} if
} {
pop
} ifelse
} forall
] def
 
 
% Linter routines for validating AI components
 
/lintnumeric {
true exch {
dup 48 lt exch 57 gt or { pop false exit } if
} forall
not { pop /bwipp.GS1notNumeric (Not numeric) false exit } if
} def
 
/lintcset82 {
true exch {
1 string dup 0 4 -1 roll put
(!"%&'()*+,-./0123456789:;<=>?ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz)
exch search not { pop pop false exit } if
pop pop pop
} forall
not { pop /bwipp.GS1badCSET82character (Invalid CSET 82 character) false exit } if
} def
 
/lintcset39 {
true exch {
1 string dup 0 4 -1 roll put
(#-/0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ)
exch search not { pop pop false exit } if
pop pop pop
} forall
not { pop /bwipp.GS1badCSET39character (Invalid CSET 39 character) false exit } if
} def
 
/lintkey {
dup length 2 lt { pop pop /bwipp.GS1keyTooShort (Key is too short) false exit } if
dup 0 get dup 48 lt exch 57 gt or exch
1 get dup 48 lt exch 57 gt or or {
pop /bwipp.GS1badGCP (Non-numeric company prefix) false exit
} if
} def
 
/lintimporteridx {
(-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz)
exch search not {pop pop /bwipp.GS1badImporterIndex (Invalid importer index) false exit} if
pop pop pop
} def
 
/lintcsum {
mark exch
dup length 2 mod 0 eq {3} {1} ifelse
exch { 48 sub 1 index mul exch 4 exch sub } forall pop
0 counttomark 1 sub {add} repeat exch pop
10 mod 0 ne { pop /bwipp.GS1badChecksum (Bad checksum) false exit } if
} def
 
{
/cset82 <<
0 (!"%&'\(\)*+,-./0123456789:;<=>?ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz)
{ exch dup 1 add } forall pop
>> def
 
/cset32 <<
0 (23456789ABCDEFGHJKLMNPQRSTUVWXYZ)
{ exch dup 1 add } forall pop
>> def
} ctxdef
 
/lintcsumalpha {
dup length 2 lt { pop pop /bwipp.GS1alphaTooShort (Alphanumeric string is too short to check) false exit} if
dup length 2 sub
2 copy
0 exch getinterval mark exch {
dup cset82 exch known { cset82 exch get } { -1 exit } ifelse
} forall
dup -1 eq { cleartomark pop pop pop /bwipp.GS1UnknownCSET82Character (Unknown CSET 82 character) false exit} if
counttomark array astore exch pop
3 1 roll
2 getinterval mark exch {
dup cset32 exch known { cset32 exch get } { -1 exit } ifelse
} forall
dup -1 eq { cleartomark pop pop /bwipp.GS1UnknownCSET32Character (Unknown CSET 32 character) false exit} if
counttomark array astore exch pop
dup 0 get 5 bitshift exch 1 get add exch
[ 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 ]
1 index length
dup 2 index length gt { pop pop pop pop pop /bwipp.GS1alphaTooLong (Alphanumeric string is too long to check) false exit} if
0 exch getinterval {exch} forall
0 exch { 3 -1 roll exch mul add } forall 1021 mod
ne { pop /bwipp.GS1badAlphaCheckCharacters (Bad alphanumeric check characters) false exit} if
} def
 
{
/iso3166 << [
/004 /008 /010 /012 /016 /020 /024 /028 /031 /032 /036 /040 /044 /048
/050 /051 /052 /056 /060 /064 /068 /070 /072 /074 /076 /084 /086 /090 /092 /096
/100 /104 /108 /112 /116 /120 /124 /132 /136 /140 /144 /148
/152 /156 /158 /162 /166 /170 /174 /175 /178 /180 /184 /188 /191 /192 /196
/203 /204 /208 /212 /214 /218 /222 /226 /231 /232 /233 /234 /238 /239 /242 /246 /248
/250 /254 /258 /260 /262 /266 /268 /270 /275 /276 /288 /292 /296
/300 /304 /308 /312 /316 /320 /324 /328 /332 /334 /336 /340 /344 /348
/352 /356 /360 /364 /368 /372 /376 /380 /384 /388 /392 /398
/400 /404 /408 /410 /414 /417 /418 /422 /426 /428 /430 /434 /438 /440 /442 /446
/450 /454 /458 /462 /466 /470 /474 /478 /480 /484 /492 /496 /498 /499
/500 /504 /508 /512 /516 /520 /524 /528 /531 /533 /534 /535 /540 /548
/554 /558 /562 /566 /570 /574 /578 /580 /581 /583 /584 /585 /586 /591 /598
/600 /604 /608 /612 /616 /620 /624 /626 /630 /634 /638 /642 /643 /646
/652 /654 /659 /660 /662 /663 /666 /670 /674 /678 /682 /686 /688 /690 /694
/702 /703 /704 /705 /706 /710 /716 /724 /728 /729 /732 /740 /744 /748
/752 /756 /760 /762 /764 /768 /772 /776 /780 /784 /788 /792 /795 /796 /798
/800 /804 /807 /818 /826 /831 /832 /833 /834 /840
/850 /854 /858 /860 /862 /876 /882 /887 /894
] {dup} forall >> def
} ctxdef
 
/lintiso3166 {
iso3166 exch known not { pop /bwipp.GS1UnknownCountry (Unknown country code) false exit } if
} def
 
/lintiso3166999 {
dup /999 ne {
iso3166 exch known not { pop /bwipp.GS1UnknownCountryOr999 (Unknown country code or not 999) false exit } if
} {
pop /bwipp.GS1unknownAI (Unrecognised AI) false exit
pop
} ifelse
} for
not {
dup length ai length add 5 add string
dup 0 (AI ) putinterval
dup 3 ai putinterval
dup 3 ai length add (: ) putinterval
dup 5 ai length add 4 -1 roll putinterval
//raiseerror exec
} if
true
} def
 
/lintiso3166list {
dup length 3 mod 0 ne {
pop pop /bwipp.GS1BadCountryListLength (Not a group of three-digit country codes) false exit
} if
true
0 3 3 index length 1 sub {
2 index exch 3 getinterval
iso3166 exch known not { pop pop false exit } if
} for
not { pop /bwipp.GS1UnknownCountry (Unknown country code) false exit } if
pop
} def
 
{
/iso3166alpha2 << [
/AD /AE /AF /AG /AI /AL /AM /AO /AQ /AR /AS /AT /AU /AW /AX /AZ
/BA /BB /BD /BE /BF /BG /BH /BI /BJ /BL /BM /BN /BO /BQ /BR /BS /BT /BV /BW /BY /BZ
/CA /CC /CD /CF /CG /CH /CI /CK /CL /CM /CN /CO /CR /CU /CV /CW /CX /CY /CZ
/DE /DJ /DK /DM /DO /DZ
/EC /EE /EG /EH /ER /ES /ET
/FI /FJ /FK /FM /FO /FR
/GA /GB /GD /GE /GF /GG /GH /GI /GL /GM /GN /GP /GQ /GR /GS /GT /GU /GW /GY
/HK /HM /HN /HR /HT /HU
/ID /IE /IL /IM /IN /IO /IQ /IR /IS /IT /JE /JM /JO /JP
/KE /KG /KH /KI /KM /KN /KP /KR /KW /KY /KZ
/LA /LB /LC /LI /LK /LR /LS /LT /LU /LV /LY
/MA /MC /MD /ME /MF /MG /MH /MK /ML /MM /MN /MO /MP /MQ /MR /MS /MT /MU /MV /MW /MX /MY /MZ
/NA /NC /NE /NF /NG /NI /NL /NO /NP /NR /NU /NZ
/OM
/PA /PE /PF /PG /PH /PK /PL /PM /PN /PR /PS /PT /PW /PY
/QA
/RE /RO /RS /RU /RW
/SA /SB /SC /SD /SE /SG /SH /SI /SJ /SK /SL /SM /SN /SO /SR /SS /ST /SV /SX /SY /SZ
/TC /TD /TF /TG /TH /TJ /TK /TL /TM /TN /TO /TR /TT /TV /TW /TZ
/UA /UG /UM /US /UY /UZ
/VA /VC /VE /VG /VI /VN /VU
/WF /WS
/YE /YT
/ZA /ZM /ZW
] {dup} forall >> def
} ctxdef
 
/lintiso3166alpha2 {
iso3166alpha2 exch known not { pop /bwipp.GS1UnknownCountryAlpha (Unknown country alpha code) false exit } if
} def
 
{
/iso4217 << [
/008 /012 /032 /036 /044 /048
/050 /051 /052 /060 /064 /068 /072 /084 /090 /096
/104 /108 /116 /124 /132 /136 /144
/152 /156 /170 /174 /188 /191 /192
/203 /208 /214 /222 /230 /232 /238 /242 /262 /270 /292
/320 /324 /328 /332 /340 /344 /348
/352 /356 /360 /364 /368 /376 /388 /392 /398
/400 /404 /408 /410 /414 /417 /418
/422 /426 /430 /434 /446
/454 /458 /462 /480 /484 /496 /498
/504 /512 /516 /524 /532 /533 /548
/554 /558 /566 /578 /586 /590 /598
/600 /604 /608 /634 /643 /646 /654 /682 /690 /694
/702 /704 /706 /710 /728 /748
/752 /756 /760 /764 /776 /780 /784 /788
/800 /807 /818 /826 /834 /840 /858 /860 /882 /886
/901 /925 /927 /928 /929 /930 /931 /932 /933 /934 /936 /938
/940 /941 /943 /944 /946 /947 /948 /949
/950 /951 /952 /953 /955 /956 /957 /958 /959
/960 /961 /962 /963 /964 /965 /967 /968 /969
/970 /971 /972 /973 /975 /976 /977 /978 /979
/980 /981 /984 /985 /986 /990 /994 /997 /999
] {dup} forall >> def
} ctxdef
 
/lintiso4217 {
iso4217 exch known not { pop /bwipp.GS1UnknownCurrency (Unknown currency code) false exit } if
} def
 
/lintiban {
dup length 4 le { pop pop /bwipp.GS1tooShort (IBAN too short) false exit } if
dup true exch {
1 string dup 0 4 -1 roll put
(0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ)
exch search not { pop pop false exit } if
pop pop pop
} forall
not { pop /bwipp.GS1badIBANcharacter (Invalid IBAN character) false exit } if
dup mark exch mark exch {} forall counttomark -4 roll counttomark array astore exch pop {
48 sub dup 9 gt {7 sub dup 10 idiv exch 10 mod} if
} forall counttomark array astore exch pop
0 exch {exch 10 mul add 97 mod} forall
1 ne { pop pop /bwipp.GS1badIBANchecksum (IBAN checksum incorrect) false exit } if
0 2 getinterval lintiso3166alpha2
} def
 
/lintzero {
(0) ne { pop /bwipp.GS1zeroRequired (Zero is required) false exit } if
} def
 
/lintnonzero {
false exch { 48 ne {pop true} if } forall
not { pop /bwipp.GS1zeroNotPermitted (Zero not permitted) false exit } if
} def
 
/lintnozeroprefix {
dup length 1 gt exch 0 get 48 eq and {
pop /bwipp.GS1badZeroPrefix (Zero prefix is not permitted) false exit
} if
} def
 
/lintyymmd0 {
dup 2 2 getinterval cvi dup 1 lt exch 12 gt or { pop /bwipp.GS1badMonth (Invalid month) false exit } if
dup 0 2 getinterval cvi dup 21 sub % Update 20YY periodically for century calculation
dup 51 ge {pop 1900 add} { -50 le {2100 add} {2000 add} ifelse} ifelse % YYYY
dup 400 mod 0 eq exch dup 4 mod 0 eq exch 100 mod 0 ne and or % Leap year?
[ 31 3 -1 roll {29} {28} ifelse 31 30 31 30 31 31 30 31 30 31 ]
1 index 2 2 getinterval cvi 1 sub get
exch 4 2 getinterval cvi lt { pop /bwipp.GS1badDay (Invalid day of month) false exit } if
} def
 
/lintyymmdd {
dup length 6 ne { pop /bwipp.GS1badDateLength (Invalid length for date) false exit } if
dup 4 2 getinterval cvi 1 lt { pop /bwipp.GS1badDay (Invalid day of month) false exit } if
lintyymmd0
} def
 
/lintyymmddhh {
dup length 8 ne { pop /bwipp.GS1badYYMMDDHHLength (Invalid length for date with hour) false exit } if
dup 6 2 getinterval cvi 23 gt { pop pop /bwipp.GS1badHour (Invalid hour of day) false exit } if
0 6 getinterval lintyymmdd
} def
 
/linthhmm {
dup 0 2 getinterval cvi 23 gt { pop pop /bwipp.GS1badHour (Invalid hour of day) false exit } if
2 2 getinterval cvi 59 gt { pop /bwipp.GS1badMinute (Invalid minute in the hour) false exit } if
} def
 
/lintmmoptss {
dup length dup 2 ne exch 4 ne and {
pop /bwipp.GS1badTimeLength (Invalid length for optional minutes and seconds) false exit
} if
dup 0 2 getinterval cvi 59 gt { pop pop /bwipp.GS1badMinute (Invalid minute in the hour) false exit } if
dup length 4 ge {
dup 2 2 getinterval cvi 59 gt { pop pop /bwipp.GS1badSecond (Invalid second in the minute) false exit } if
} if
pop
} def
 
/lintyesno {
dup (0) ne exch (1) ne and {
pop /bwipp.GS1badBoolean (Neither 0 nor 1 for yes or no) false exit
} if
} def
 
/lintwinding {
dup (0) ne exch dup (1) ne exch (9) ne and and {
pop /bwipp.GS1badWinding (Invalid winding direction) false exit
} if
} def
 
/lintpieceoftotal {
dup length 2 mod 0 ne { pop pop /bwipp.GS1badPieceTotalLength (Invalid piece/total length) false exit } if
dup dup length 2 idiv 0 exch getinterval cvi
dup 0 eq { pop pop pop /bwipp.GS1badPieceNumber (Invalid piece number) false exit } if
exch dup length 2 idiv dup getinterval cvi
dup 0 eq { pop pop pop /bwipp.GS1badPieceTotal (Invalid total number) false exit } if
gt { pop /bwipp.GS1pieceExceedsTotal (Piece number exceeds total) false exit } if
} def
 
/lintpcenc {
{
(%) search not {pop exit} if
pop pop dup length 2 lt { pop pop /bwipp.GS1badPercentEscape (Invalid % escape) false exit } if
dup 0 2 getinterval true exch {
1 string dup 0 4 -1 roll put
(0123456789ABCDEFabcdef)
exch search not { pop pop false exit } if
pop pop pop
} forall
not { pop pop /bwipp.GS1badPercentChars (Invalid characters for percent encoding) false exit } if
} loop
} bind def
 
/lintcouponcode {
dup true exch {
dup 48 lt exch 57 gt or { pop false exit } if
} forall
not { pop pop /bwipp.GS1couponNotNumeric (Coupon not numeric) false exit } if
 
% GCP VLI and value
dup length 1 lt {
pop pop /bwipp.GS1couponTooShortGCPVLI (Coupon too short: Missing GCP VLI) false exit
} if
dup 0 1 getinterval cvi dup 6 gt {
pop pop /bwipp.GS1couponBadGCPVLI (Coupon GCP length indicator must be 0-6) false exit
} if
6 add 1 add
2 copy exch length gt {
pop pop pop /bwipp.GS1couponTooShortGCP (Coupon too short: GCP truncated) false exit
} if
dup 2 index length exch sub getinterval
 
% Offer Code
dup length 6 lt {
pop pop /bwipp.GS1couponTooShortOfferCode (Coupon too short: Offer Code truncated) false exit
} if
dup length 6 sub 6 exch getinterval
 
% Save Value VLI and value
dup length 1 lt {
pop pop /bwipp.GS1couponTooShortSaveValueVLI (Coupon too short: Missing Save Value VLI) false exit
} if
dup 0 1 getinterval cvi dup dup 1 lt exch 5 gt or {
pop pop /bwipp.GS1couponBadSaveValueVLI (Coupon Save Value length indicator must be 1-5) false exit
} if
1 add
2 copy exch length gt {
pop pop pop /bwipp.GS1couponTooShortSaveValue (Coupon too short: Save Value truncated) false exit
} if
dup 2 index length exch sub getinterval
 
% 1st Purchase Requirement VLI and value
dup length 1 lt {
pop pop /bwipp.GS1couponTooShort1stPurchaseRequirementVLI (Coupon too short: Missing 1st Purchase Requirement VLI) false exit
} if
dup 0 1 getinterval cvi dup dup 1 lt exch 5 gt or {
pop pop /bwipp.GS1couponBad1stPurchaseRequirementVLI (Coupon 1st Purchase Requirement length indicator must be 1-5) false exit
} if
1 add
2 copy exch length gt {
pop pop pop /bwipp.GS1couponTooShort1stPurchaseRequirement (Coupon too short: 1st Purchase Requirement truncated) false exit
} if
dup 2 index length exch sub getinterval
 
% 1st Purchase Requirement Code
dup length 1 lt {
pop pop /bwipp.GS1couponTooShort1stPurchaseRequirementCode (Coupon too short: Missing 1st Purchase Requirement Code) false exit
} if
dup 0 1 getinterval cvi dup 4 gt exch 9 ne and {
pop pop /bwipp.GS1couponBad1stPurchaseRequirementCode (Coupon 1st Purchase Requirement Code must be 0-4 or 9) false exit
} if
dup length 1 sub 1 exch getinterval
 
% 1st Purchase Family Code
dup length 3 lt {
pop pop /bwipp.GS1couponTooShort1stPurchaseFamilyCode (Coupon too short: 1st Purchase Family Code truncated) false exit
} if
dup length 3 sub 3 exch getinterval
 
% Optional field 1
dup length 1 ge { dup 0 1 getinterval cvi 1 eq {
1 dup 2 index length exch sub getinterval
 
% Additional Purchase Rules Code
dup length 1 lt {
pop pop /bwipp.GS1couponTooShortAdditionalPurchaseRulesCode (Coupon too short: Missing Additional Purchase Rules Code) false exit
} if
dup 0 1 getinterval cvi 3 gt {
pop pop /bwipp.GS1couponBadAdditionalPurchaseRulesCode (Coupon Additional Purchase Rules Code must be 0-3) false exit
} if
dup length 1 sub 1 exch getinterval
 
% 2nd Purchase RequirementVLI and value
dup length 1 lt {
pop pop /bwipp.GS1couponTooShort2ndPurchaseRequirementVLI (Coupon too short: Missing 2nd Purchase Requirement VLI) false exit
} if
dup 0 1 getinterval cvi dup dup 1 lt exch 5 gt or {
pop pop /bwipp.GS1couponBad2ndPurchaseRequirementVLI (Coupon 2nd Purchase Requirement length indicator must be 1-5) false exit
} if
1 add
2 copy exch length gt {
pop pop pop /bwipp.GS1couponTooShort2ndPurchaseRequirement (Coupon too short: 2nd Purchase Requirement truncated) false exit
} if
dup 2 index length exch sub getinterval
 
% 2nd Purchase Requirement Code
dup length 1 lt {
pop pop /bwipp.GS1couponTooShort2ndPurchaseRequirementCode (Coupon too short: Missing 2nd Purchase Requirement Code) false exit
} if
dup 0 1 getinterval cvi dup 4 gt exch 9 ne and {
pop pop /bwipp.GS1couponBad2ndPurchaseRequirementCode (Coupon 2nd Purchase Requirement Code must be 0-4 or 9) false exit
} if
dup length 1 sub 1 exch getinterval
 
% 2nd Purchase Family Code
dup length 3 lt {
pop pop /bwipp.GS1couponTooShort2ndPurchaseFamilyCode (Coupon too short: 2nd Purchase Family Code truncated) false exit
} if
dup length 3 sub 3 exch getinterval
 
% 2nd Purchase GCP VLI and value
dup length 1 lt {
pop pop /bwipp.GS1couponTooShort2ndPurchaseGCPVLI (Coupon too short: Missing 2nd Purchase GCP VLI) false exit
} if
dup 0 1 getinterval cvi dup dup 6 gt exch 9 ne and {
pop pop /bwipp.GS1couponBad2ndPurchaseGCPVLI (Coupon 2nd Purchase GCP length indicator must be 0-6 or 9) false exit
} if
dup 9 ne {6 add} {pop 0} ifelse 1 add
2 copy exch length gt {
pop pop pop /bwipp.GS1couponTooShort2ndPurchaseGCP (Coupon too short: 2nd Purchase GCP truncated) false exit
} if
dup 2 index length exch sub getinterval
 
} if } if
 
% Optional field 2
dup length 1 ge { dup 0 1 getinterval cvi 2 eq {
1 dup 2 index length exch sub getinterval
 
% 3rd Purchase RequirementVLI and value
dup length 1 lt {
pop pop /bwipp.GS1couponTooShort3rdPurchaseRequirementVLI (Coupon too short: Missing 3rd Purchase Requirement VLI) false exit
} if
dup 0 1 getinterval cvi dup dup 1 lt exch 5 gt or {
pop pop /bwipp.GS1couponBad3rdPurchaseRequirementVLI (Coupon 3rd Purchase Requirement length indicator must be 1-5) false exit
} if
1 add
2 copy exch length gt {
pop pop pop /bwipp.GS1couponTooShort3rdPurchaseRequirement (Coupon too short: 3rd Purchase Requirement truncated) false exit
} if
dup 2 index length exch sub getinterval
 
% 3rd Purchase Requirement Code
dup length 1 lt {
pop pop /bwipp.GS1couponTooShort3rdPurchaseRequirementCode (Coupon too short: Missing 3rd Purchase Requirement Code) false exit
} if
dup 0 1 getinterval cvi dup 4 gt exch 9 ne and {
pop pop /bwipp.GS1couponBad3rdPurchaseRequirementCode (Coupon 3rd Purchase Requirement Code must be 0-4 or 9) false exit
} if
dup length 1 sub 1 exch getinterval
 
% 3rd Purchase Family Code
dup length 3 lt {
pop pop /bwipp.GS1couponTooShort3rdPurchaseFamilyCode (Coupon too short: 3rd Purchase Family Code truncated) false exit
} if
dup length 3 sub 3 exch getinterval
 
% 3rd Purchase GCP VLI and value
dup length 1 lt {
pop pop /bwipp.GS1couponTooShort3rdPurchaseGCPVLI (Coupon too short: Missing 3rd Purchase GCP VLI) false exit
} if
dup 0 1 getinterval cvi dup dup 6 gt exch 9 ne and {
pop pop /bwipp.GS1couponBad3rdPurchaseGCPVLI (Coupon 3rd Purchase GCP length indicator must be 0-6 or 9) false exit
} if
dup 9 ne {6 add} {pop 0} ifelse 1 add
2 copy exch length gt {
pop pop pop /bwipp.GS1couponTooShort3rdPurchaseGCP (Coupon too short: 3rd Purchase GCP truncated) false exit
} if
dup 2 index length exch sub getinterval
 
} if } if
 
% Optional field 3
/couponexpire -1 def
dup length 1 ge { dup 0 1 getinterval cvi 3 eq {
1 dup 2 index length exch sub getinterval
 
% Expiration date
dup length 6 lt {
pop pop /bwipp.GS1couponTooShortExpirationDate (Coupon too short: Expiration date) false exit
} if
dup 2 2 getinterval cvi dup 1 lt exch 12 gt or { pop pop /bwipp.GS1couponExpirationDateBadMonth (Invalid month in expiration date) false exit } if
dup 0 2 getinterval cvi dup 21 sub % Update 20YY periodically for century calculation
dup 51 ge {pop 1900 add} { -50 le {2100 add} {2000 add} ifelse} ifelse % YYYY
dup 400 mod 0 eq exch dup 4 mod 0 eq exch 100 mod 0 ne and or % Leap year?
[ 31 3 -1 roll {29} {28} ifelse 31 30 31 30 31 31 30 31 30 31 ]
1 index 2 2 getinterval cvi 1 sub get
1 index 4 2 getinterval cvi dup 3 1 roll lt
exch 1 lt or { pop pop /bwipp.GS1couponExpirationDateBadDay (Invalid day of month in expiration date) false exit } if
dup 0 6 getinterval cvi /couponexpire exch def
dup length 6 sub 6 exch getinterval
 
} if } if
 
% Optional field 4
dup length 1 ge { dup 0 1 getinterval cvi 4 eq {
1 dup 2 index length exch sub getinterval
 
% Start date
dup length 6 lt {
pop pop /bwipp.GS1couponTooShortStartDate (Coupon too short: Start date) false exit
} if
dup 2 2 getinterval cvi dup 1 lt exch 12 gt or { pop pop /bwipp.GS1couponStartDateBadMonth (Invalid month in start date) false exit } if
dup 0 2 getinterval cvi dup 21 sub % Update 20YY periodically for century calculation
dup 51 ge {pop 1900 add} { -50 le {2100 add} {2000 add} ifelse} ifelse % YYYY
dup 400 mod 0 eq exch dup 4 mod 0 eq exch 100 mod 0 ne and or % Leap year?
[ 31 3 -1 roll {29} {28} ifelse 31 30 31 30 31 31 30 31 30 31 ]
1 index 2 2 getinterval cvi 1 sub get
1 index 4 2 getinterval cvi dup 3 1 roll lt
exch 1 lt or { pop pop /bwipp.GS1couponStartDateBadDay (Invalid day of month in start date) false exit } if
dup 0 6 getinterval cvi /couponstart exch def
couponexpire -1 ne couponexpire couponstart lt and {
pop pop /bwipp.GS1couponExpireDateBeforeStartDate (Coupon expires before it starts) false exit
} if
dup length 6 sub 6 exch getinterval
 
} if } if
 
% Optional field 5
dup length 1 ge { dup 0 1 getinterval cvi 5 eq {
1 dup 2 index length exch sub getinterval
 
% Serial Number VLI and value
dup length 1 lt {
pop pop /bwipp.GS1couponTooShortSerialNumberVLI (Coupon too short: Missing Serial Number VLI) false exit
} if
dup 0 1 getinterval cvi 6 add 1 add
2 copy exch length gt {
pop pop pop /bwipp.GS1couponTooShortSerialNumber (Coupon too short: Serial Number truncated) false exit
} if
dup 2 index length exch sub getinterval
 
} if } if
 
% Optional field 6
dup length 1 ge { dup 0 1 getinterval cvi 6 eq {
1 dup 2 index length exch sub getinterval
 
% Retailer GCP/GLN VLI and value
dup length 1 lt {
pop pop /bwipp.GS1couponTooShortRetailerGCPGLNVLI (Coupon too short: Missing Retailer GCP/GLN VLI) false exit
} if
dup 0 1 getinterval cvi dup dup 1 lt exch 7 gt or {
pop pop /bwipp.GS1couponBadRetailerGCPGLNVLI (Coupon Retailer GCP/GLN length indicator must be 1-7) false exit
} if
6 add 1 add
2 copy exch length gt {
pop pop pop /bwipp.GS1couponTooShortRetailerGCPGLN (Coupon too short: Retailer GCP/GLN truncated) false exit
} if
dup 2 index length exch sub getinterval
 
} if } if
 
% Optional field 9
dup length 1 ge { dup 0 1 getinterval cvi 9 eq {
1 dup 2 index length exch sub getinterval
 
% Save Value Code
dup length 1 lt {
pop pop /bwipp.GS1couponTooShortSaveValueCode (Coupon too short: Missing Save Value Code) false exit
} if
dup 0 1 getinterval cvi dup 6 gt exch dup 3 eq exch 4 eq or or {
pop pop /bwipp.GS1couponBadSaveValueCode (Coupon Save Value Code must be 0,1,2,5 or 6) false exit
} if
dup length 1 sub 1 exch getinterval
 
% Save Value Applies to Item
dup length 1 lt {
pop pop /bwipp.GS1couponTooShortSaveValueAppliesToItem (Coupon too short: Missing Save Value Applies to Item) false exit
} if
dup 0 1 getinterval cvi 2 gt {
pop pop /bwipp.GS1couponBadSaveValueAppliesToItem (Coupon Save Value Applies to Item must be 0-2) false exit
} if
dup length 1 sub 1 exch getinterval
 
% Store Coupon Flag
dup length 1 lt {
pop pop /bwipp.GS1couponTooShortStoreCouponFlag (Coupon too short: Missing Store Coupon Flag) false exit
} if
dup length 1 sub 1 exch getinterval
 
% Don't Multiply Flag
dup length 1 lt {
pop pop /bwipp.GS1couponTooShortDontMultiplyFlag (Coupon too short: Missing Don't Multiply Flag) false exit
} if
dup 0 1 getinterval cvi 1 gt {
pop pop /bwipp.GS1couponBadDontMultiplyFlag (Don't Multiply Flag must be 0 or 1) false exit
} if
dup length 1 sub 1 exch getinterval
 
} if } if
 
dup length 0 ne {
pop pop /bwipp.GS1couponUnrecognisedOptionalField (Coupon fields must be 1,2,3,4,5,6 or 9, increasing order) false exit
} if
pop
} def
 
/lintcouponposoffer {
dup true exch {
dup 48 lt exch 57 gt or { pop false exit } if
} forall
not { pop pop /bwipp.GS1couponNotNumeric (Coupon not numeric) false exit } if
% Format Code
dup length 1 lt {
pop pop /bwipp.GS1couponTooShortFormatCode (Coupon too short: Missing Format Code) false exit
} if
dup 0 1 getinterval dup (0) ne exch (1) ne and {
pop pop /bwipp.GS1couponBadFormatCode (Coupon format must be 0 or 1) false exit
} if
dup length 1 sub 1 exch getinterval
% Funder ID VLI and Funder ID
dup length 1 lt {
pop pop /bwipp.GS1couponTooShortFunderVLI (Coupon too short: Missing Funder VLI) false exit
} if
dup 0 1 getinterval cvi dup 6 gt {
pop pop pop /bwipp.GS1couponBadFunderVLI (Coupon Funder length indicator must be 0-6) false exit
} if
6 add 1 add
2 copy exch length gt {
pop pop pop /bwipp.GS1couponTooShortFunder (Coupon too short: Truncated Funder ID) false exit
} if
dup 2 index length exch sub getinterval
% Offer Code
dup length 6 lt {
pop pop /bwipp.GS1couponTooShortOfferCode (Coupon too short: Truncated Offer Code) false exit
} if
dup length 6 sub 6 exch getinterval
% Serial Number VLI and Serial Number
dup length 1 lt {
pop pop /bwipp.GS1couponTooShortSnVLI (Coupon too short: Missing SN VLI) false exit
} if
dup 0 1 getinterval cvi
6 add 1 add
2 copy exch length gt {
pop pop pop /bwipp.GS1couponTooShortSn (Coupon too short: Truncated SN) false exit
} if
dup 2 index length exch sub getinterval
dup length 0 ne {
pop pop /bwipp.GS1couponTooLong (Coupon too long) false exit
} if
pop
} def
 
/lintlatlong {
dup length 20 ne {
pop /bwipp.GS1badGeoLength (Invalid length for a geo-location) false exit
} if
dup 0 10 getinterval cvi 1800000000 gt { pop /bwipp.GS1badLatitude (Invalid value for latitude) false exit } if
dup 10 10 getinterval cvi 3600000000 gt { pop /bwipp.GS1badLongitude (Invalid value for longitude) false exit } if
pop
} def
 
dontlint not {
 
% Validate AI contents
true
0 1 vals length 1 sub {
dup ais exch get /ai exch def
vals exch get /val exch def
gs1syntax ai known {
gs1syntax ai get /parts get
% Overall length checks, e.g. to report "too long", not "checksum failure"
dup 0 exch {dup /opt get {pop 0} {/min get} ifelse add} forall val length gt {
pop /bwipp.GS1valueTooShort (Too short) false exit
} if
dup 0 exch {/max get add} forall val length lt {
pop /bwipp.GS1valueTooLong (Too long) false exit
} if
{ % Checks for each component of the AI
/props exch def
props /max get val length 2 copy gt {exch} if pop
val exch 0 exch getinterval /eval exch def
/val val eval length dup val length exch sub getinterval def
eval length 0 eq {
props /opt get not {
pop /bwipp.GS1valueTooShort (Too short) false exit
} if
} {
eval length props /min get lt {
pop /bwipp.GS1valueTooShort (Too short) false exit
} if
<< /N /lintnumeric /X /lintcset82 /Y /lintcset39 >> props /cset get get eval exch load exec
props /linters get { eval exch load exec } forall
} ifelse
} forall
dup not {exit} if
val length 0 ne { % Not all data consumed by components
pop /bwipp.GS1valueTooLong (Too long) false exit
} if
} {
pop /bwipp.GS1unknownAI (Unrecognised AI) false exit
} ifelse
} for
not {
dup length ai length add 5 add string
dup 0 (AI ) putinterval
dup 3 ai putinterval
dup 3 ai length add (: ) putinterval
dup 5 ai length add 4 -1 roll putinterval
//raiseerror exec
} if
 
% Search for "patt" matching an AIs, excluding "this" AI
/aiexists {
/this exch def
/patt exch def
1 { % common exit
aivals patt known {true exit} if % Fast path
patt length 4 eq {
patt 3 1 getinterval (n) eq {
/pfxlen patt 2 1 getinterval (n) eq {2} {3} ifelse def
false
ais {
dup dup this ne exch length 4 eq and {
0 pfxlen getinterval patt 0 pfxlen getinterval eq {
pop true
} if
} {
pop
} ifelse
} forall
exit
} if
false exit
} if
false exit
} repeat
} def
 
% Build AI dict and validate repeats
/aivals vals length dict def
0 1 vals length 1 sub {
dup ais exch get /ai exch def
vals exch get /val exch def
aivals ai known {
aivals ai get val ne {
ai length 40 add string
dup 0 (Repeated AIs \() putinterval
dup 14 ai putinterval
dup 14 ai length add (\) must have the same value) putinterval
/bwipp.GS1repeatedDifferingAIs exch //raiseerror exec
} if
} {
aivals ai val put
} ifelse
} for
 
% Validate ex and req pairings
0 1 vals length 1 sub {
ais exch get /ai exch def
gs1syntax ai get /ex 2 copy known {
get {
/patt exch def
patt ai aiexists {
ai length patt length add 36 add string
dup 0 (AIs \() putinterval
dup 5 ai putinterval
dup 5 ai length add (\) and \() putinterval
dup 12 ai length add patt putinterval
dup 12 ai length add patt length add (\) are mutually exclusive) putinterval
/bwipp.GS1exclusiveAIs exch //raiseerror exec
} if
} forall
} {
pop pop
} ifelse
lintreqs {
gs1syntax ai get /req 2 copy known {
get { % For each req attribute group
false exch { % Any req AI in the group is fine
ai aiexists {pop true} if
} forall
not {
ai length 47 add string
dup 0 (One of more requisite AIs for AI \() putinterval
dup 34 ai putinterval
dup 34 ai length add (\) are missing) putinterval
/bwipp.GS1missingAIs exch //raiseerror exec
} if
} forall
} {
pop pop
} ifelse
} if
} for
 
} if % dontlint
 
ais vals fncs
 
//unloadctx exec
 
end
 
}
[/barcode] {null def} forall
bind def
/gs1lint dup load /uk.co.terryburton.bwipp defineresource pop
/gs1process dup load /uk.co.terryburton.bwipp defineresource pop
end
/setpacking where {pop setpacking} if
%%EndData
%%EndResource
% --END RESOURCE gs1lint--
% --END RESOURCE gs1process--
 
% --BEGIN RENDERER renlinear--
% --REQUIRES preamble raiseerror--
%%BeginResource: uk.co.terryburton.bwipp renlinear 0.0 2021092800 74624 73842
%%BeginData: 239 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp renlinear 0.0 2022072900 75424 74734
%%BeginData: 246 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
begin
/renlinear {
1970,25 → 3295,25
 
% 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
/pixx 0 def /pixy 0 def
0 1 sbs length 1 add 2 idiv 2 mul 2 sub {
/i exch def
i 2 mod 0 eq { % i is even
/d sbs i get barratio mul barratio sub 1 add def % d=digit*r-r+1
/d sbs i get barratio mul barratio sub 1 add def % d = digit*r-r+1
sbs i get 0 ne {
/h bhs i 2 idiv get 72 mul def % Height from bhs
/c d 2 div x add def % Centre of the bar = x + d/2
/c d 2 div pixx add def % Centre of the bar = pixx + d/2
/y bbs i 2 idiv get 72 mul def % Baseline from bbs
/w d inkspread sub def % bar width = digit - inkspread
bars i 2 idiv [h c y w] put % Add the bar entry
h y add maxh gt {/maxh h y add def} if
h y add pixy gt {/pixy h y add def} if
} {
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
/pixx pixx d add def % pixx += d
} for
 
gsave
1997,7 → 3322,7
 
% Force symbol to given width
width 0 ne {
width 72 mul x div 1 scale
width 72 mul pixx div 1 scale
} if
 
% Set RGB or CMYK color depending on length of given hex string
2014,10 → 3339,10
% Display the border and background
newpath
borderleft neg borderbottom neg moveto
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
pixx borderleft add borderright add 0 rlineto
0 pixy borderbottom add bordertop add rlineto
pixx borderleft add borderright add neg 0 rlineto
0 pixy borderbottom add bordertop add neg rlineto
closepath
backgroundcolor (unset) ne { gsave backgroundcolor setanycolor fill grestore } if
showborder {
2029,15 → 3354,22
 
% Display the bars for elements in the bars array
gsave
0 setlinecap
barcolor (unset) ne { barcolor setanycolor } if
newpath
bars {
dup -1 ne {
aload pop newpath setlinewidth moveto 0 exch rlineto stroke
aload pop % h x y w
2 index 1 index 2 div sub 2 index moveto
0 4 index rlineto
dup 0 rlineto
0 4 index neg rlineto
closepath
pop pop pop pop
} {
pop
} ifelse
} forall
fill
grestore
 
% Display the text for elements in the text array
2084,18 → 3416,18
/textascent exch def
/textwidth tstr stringwidth pop tstr length 1 sub textgaps mul add def
 
/textxpos textxoffset x textwidth sub 2 div add def
/textxpos textxoffset pixx textwidth sub 2 div add def
textxalign (left) eq { /textxpos textxoffset def } if
textxalign (right) eq { /textxpos x textxoffset sub textwidth sub def } if
textxalign (right) eq { /textxpos pixx textxoffset sub textwidth sub def } if
textxalign (offleft) eq { /textxpos textwidth textxoffset add neg def } if
textxalign (offright) eq { /textxpos x textxoffset add def } if
textxalign (justify) eq textwidth x lt and {
textxalign (offright) eq { /textxpos pixx textxoffset add def } if
textxalign (justify) eq textwidth pixx lt and {
/textxpos 0 def
/textgaps x textwidth sub tstr length 1 sub div def
/textgaps pixx textwidth sub tstr length 1 sub div def
} if
/textypos textyoffset textascent add 1 add neg def
textyalign (above) eq { /textypos textyoffset maxh add 1 add def } if
textyalign (center) eq { /textypos textyoffset maxh textascent sub 2 div add def } if
textyalign (above) eq { /textypos textyoffset pixy add 1 add def } if
textyalign (center) eq { /textypos textyoffset pixy textascent sub 2 div add def } if
textxpos textypos moveto textgaps 0 tstr ashow
} ifelse
} if
2112,7 → 3444,7
} if
guardrightpos 0 ne {
newpath
guardrightpos x add guardwidth sub guardrightypos guardheight 2 div add moveto
guardrightpos pixx add guardwidth sub guardrightypos guardheight 2 div add moveto
guardwidth guardheight -2 div rlineto
guardwidth neg guardheight -2 div rlineto
stroke
2135,10 → 3467,10
 
% --BEGIN RENDERER renmatrix--
% --REQUIRES preamble raiseerror--
%%BeginResource: uk.co.terryburton.bwipp renmatrix 0.0 2021092800 90671 89573
%%BeginResource: uk.co.terryburton.bwipp renmatrix 0.0 2022072900 90555 89769
%%BeginData: 306 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
begin
/renmatrix {
2417,14 → 3749,14
/textascent exch def
/textwidth tstr stringwidth pop tstr length 1 sub textgaps mul add def
 
/textxpos textxoffset x textwidth sub 2 div add def
/textxpos textxoffset pixx textwidth sub 2 div add def
textxalign (left) eq { /textxpos textxoffset def } if
textxalign (right) eq { /textxpos x textxoffset sub textwidth sub def } if
textxalign (right) eq { /textxpos pixx textxoffset sub textwidth sub def } if
textxalign (offleft) eq { /textxpos textwidth textxoffset add neg def } if
textxalign (offright) eq { /textxpos x textxoffset add def } if
textxalign (justify) eq textwidth x lt and {
textxalign (offright) eq { /textxpos pixx textxoffset add def } if
textxalign (justify) eq textwidth pixx lt and {
/textxpos 0 def
/textgaps x textwidth sub tstr length 1 sub div def
/textgaps pixx textwidth sub tstr length 1 sub div def
} if
/textypos textyoffset textascent add 1 add neg def
textyalign (above) eq { /textypos textyoffset pixy add 1 add def } if
2449,10 → 3781,10
 
% --BEGIN RENDERER renmaximatrix--
% --REQUIRES preamble raiseerror--
%%BeginResource: uk.co.terryburton.bwipp renmaximatrix 0.0 2021092800 50254 49916
%%BeginResource: uk.co.terryburton.bwipp renmaximatrix 0.0 2022072900 50138 49904
%%BeginData: 81 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
begin
/renmaximatrix {
2537,15 → 3869,17
% --END RENDERER renmaximatrix--
 
% --BEGIN ENCODER ean5--
% --REQUIRES preamble raiseerror renlinear--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear--
% --DESC: EAN-5 (5 digit addon)
% --EXAM: 90200
% --EXOP: includetext guardwhitespace
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp ean5 0.0 2021092800 58142 57964
%%BeginData: 137 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp ean5 0.0 2022072900 67684 63946
%%BeginData: 147 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
begin
2556,6 → 3890,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includetext false def % Enable/disable text
/textfont /Helvetica def
2585,6 → 3920,8
/textyoffset textyoffset cvr def
} ifelse
 
/ean5 //loadctx exec
 
% Validate input
barcode length 5 ne {
/bwipp.ean5badLength (EAN-5 add-on must be 5 digits) //raiseerror exec
2595,6 → 3932,7
} if
} forall
 
{
% Create an array containing the character mappings
/encs
[ (3211) (2221) (2122) (1411) (1132)
2610,6 → 3948,8
[ (11000) (10100) (10010) (10001) (01100)
(00110) (00011) (01010) (01001) (00101)
] def
} ctxdef
 
/checksum 0 def
0 1 4 {
/i exch def
2673,6 → 4013,8
 
dontdraw not //renlinear if
 
//unloadctx exec
 
end
 
}
2686,15 → 4028,17
% --END ENCODER ean5--
 
% --BEGIN ENCODER ean2--
% --REQUIRES preamble raiseerror renlinear--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear--
% --DESC: EAN-2 (2 digit addon)
% --EXAM: 05
% --EXOP: includetext guardwhitespace
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp ean2 0.0 2021092800 56699 56466
%%BeginData: 122 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp ean2 0.0 2022072900 66331 62624
%%BeginData: 133 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
begin
2705,6 → 4049,7
/options exch def % We are given an options string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includetext false def % Enable/disable text
/textfont /Helvetica def
2734,6 → 4079,8
/textyoffset textyoffset cvr def
} ifelse
 
/ean2 //loadctx exec
 
% Validate input
barcode length 2 ne {
/bwipp.ean2badLength (EAN-2 add-on must be 2 digits) //raiseerror exec
2744,6 → 4091,7
} if
} forall
 
{
% Create an array containing the character mappings
/encs
[ (3211) (2221) (2122) (1411) (1132)
2755,8 → 4103,11
/barchars (0123456789) def
 
% Determine the mirror map based on mod 4 checksum
/mirrormap [(00) (01) (10) (11)] barcode 0 2 getinterval cvi 4 mod get def
/mirrormaps [(00) (01) (10) (11)] def
} ctxdef
 
/mirrormap mirrormaps barcode 0 2 getinterval cvi 4 mod get def
 
/sbs 13 string def
/txt 2 array def
 
2807,6 → 4158,8
 
dontdraw not //renlinear if
 
//unloadctx exec
 
end
 
}
2820,15 → 4173,17
% --END ENCODER ean2--
 
% --BEGIN ENCODER ean13--
% --REQUIRES preamble raiseerror renlinear ean5 ean2--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear ean5 ean2--
% --DESC: EAN-13
% --EXAM: 2112345678900
% --EXOP: includetext guardwhitespace
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp ean13 0.0 2021092800 77528 80639
%%BeginData: 217 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp ean13 0.0 2022072900 87046 86773
%%BeginData: 226 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /ean2 dup /uk.co.terryburton.bwipp findresource put
2841,6 → 4196,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includetext false def % Enable/disable text
/textfont /Helvetica def
2876,6 → 4232,8
addontextxoffset (unset) ne {/addontextxoffset addontextxoffset cvr def} if
addontextyoffset (unset) ne {/addontextyoffset addontextyoffset cvr def} if
 
/ean13 //loadctx exec
 
% Split off the addon
barcode ( ) search {
/barcode exch def
2921,6 → 4279,7
pad 12 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)
2936,6 → 4295,7
[ (000000) (001011) (001101) (001110) (010011)
(011001) (011100) (010101) (010110) (011010)
] def
} ctxdef
 
/sbs 59 string def
/txt 13 array def
3036,6 → 4396,8
 
dontdraw not //renlinear if
 
//unloadctx exec
 
end
 
}
3049,15 → 4411,17
% --END ENCODER ean13--
 
% --BEGIN ENCODER ean8--
% --REQUIRES preamble raiseerror renlinear ean5 ean2--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear ean5 ean2--
% --DESC: EAN-8
% --EXAM: 02345673
% --EXOP: includetext guardwhitespace
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp ean8 0.0 2021092800 74726 77866
%%BeginData: 198 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp ean8 0.0 2022072900 84284 83888
%%BeginData: 207 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /ean2 dup /uk.co.terryburton.bwipp findresource put
3070,6 → 4434,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includetext false def % Enable/disable text
/textfont /Helvetica def
3105,6 → 4470,8
addontextxoffset (unset) ne {/addontextxoffset addontextxoffset cvr def} if
addontextyoffset (unset) ne {/addontextyoffset addontextyoffset cvr def} if
 
/ean8 //loadctx exec
 
% Split off the addon
barcode ( ) search {
/barcode exch def
3151,6 → 4518,7
/barcode pad def
 
% Create an array containing the character mappings
{
/encs
[ (3211) (2221) (2122) (1411) (1132)
(1231) (1114) (1312) (1213) (3112)
3159,6 → 4527,7
 
% Create a string of the available characters
/barchars (0123456789) def
} ctxdef
 
/sbs 43 string def
/txt 8 array def
3246,6 → 4615,8
 
dontdraw not //renlinear if
 
//unloadctx exec
 
end
 
}
3259,15 → 4630,17
% --END ENCODER ean8--
 
% --BEGIN ENCODER upca--
% --REQUIRES preamble raiseerror renlinear ean5 ean2--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear ean5 ean2--
% --DESC: UPC-A
% --EXAM: 416000336108
% --EXOP: includetext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp upca 0.0 2021092800 82465 85414
%%BeginData: 250 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp upca 0.0 2022072900 92023 91540
%%BeginData: 259 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /ean2 dup /uk.co.terryburton.bwipp findresource put
3280,6 → 4653,7
/options exch def
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includetext false def % Enable/disable text
/textfont /Helvetica def
3315,6 → 4689,8
addontextxoffset (unset) ne {/addontextxoffset addontextxoffset cvr def} if
addontextyoffset (unset) ne {/addontextyoffset addontextyoffset cvr def} if
 
/upca //loadctx exec
 
% Split off the addon
barcode ( ) search {
/barcode exch def
3406,6 → 4782,7
/barcode pad def
 
% Create an array containing the character mappings
{
/encs
[ (3211) (2221) (2122) (1411) (1132)
(1231) (1114) (1312) (1213) (3112)
3414,6 → 4791,7
 
% Create a string of the available characters
/barchars (0123456789) def
} ctxdef
 
/sbs 59 string def
/txt 12 array def
3508,6 → 4886,8
 
dontdraw not //renlinear if
 
//unloadctx exec
 
end
 
}
3521,15 → 4901,17
% --END ENCODER upca--
 
% --BEGIN ENCODER upce--
% --REQUIRES preamble raiseerror renlinear ean5 ean2--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear ean5 ean2--
% --DESC: UPC-E
% --EXAM: 00123457
% --EXOP: includetext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp upce 0.0 2021092800 87070 90062
%%BeginData: 289 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp upce 0.0 2022072900 96548 96108
%%BeginData: 298 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /ean2 dup /uk.co.terryburton.bwipp findresource put
3542,6 → 4924,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includetext false def % Enable/disable text
/textfont /Helvetica def
3577,6 → 4960,8
addontextxoffset (unset) ne {/addontextxoffset addontextxoffset cvr def} if
addontextyoffset (unset) ne {/addontextyoffset addontextyoffset cvr def} if
 
/upce //loadctx exec
 
% Split off the addon
barcode ( ) search {
/barcode exch def
3646,6 → 5031,7
/bwipp.upcEbadNumberSystem (UPC-E must have number system 0 or 1) //raiseerror exec
} if
 
{
% Create an array containing the character mappings
/encs
[ (3211) (2221) (2122) (1411) (1132)
3660,6 → 5046,7
[ (000111) (001011) (001101) (001110) (010011)
(011001) (011100) (010101) (010110) (011010)
] def
} ctxdef
 
% Derive the equivalent UPC-A for its checksum
1 { % Common exit
3809,6 → 5196,8
 
dontdraw not //renlinear if
 
//unloadctx exec
 
end
 
}
3822,15 → 5211,15
% --END ENCODER upce--
 
% --BEGIN ENCODER isbn--
% --REQUIRES preamble raiseerror renlinear ean5 ean2 ean13--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear ean5 ean2 ean13--
% --DESC: ISBN
% --EXAM: 978-1-56581-231-4 90000
% --EXOP: includetext guardwhitespace
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp isbn 0.0 2021092800 89478 88857
%%BeginData: 254 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp isbn 0.0 2022072900 95102 94623
%%BeginData: 255 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /ean13 dup /uk.co.terryburton.bwipp findresource put
3842,6 → 5231,7
/options exch def % We are given an options string
/barcode exch def % We are given the isbn text with dashes
 
/ctx null def
/dontdraw false def
/includetext false def % Enable/disable ISBN text
/isbntextfont /Courier def
4088,15 → 5478,15
% --END ENCODER isbn--
 
% --BEGIN ENCODER ismn--
% --REQUIRES preamble raiseerror renlinear ean5 ean2 ean13--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear ean5 ean2 ean13--
% --DESC: ISMN
% --EXAM: 979-0-2605-3211-3
% --EXOP: includetext guardwhitespace
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp ismn 0.0 2021092800 85922 85418
%%BeginData: 233 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp ismn 0.0 2022072900 91674 91184
%%BeginData: 234 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /ean13 dup /uk.co.terryburton.bwipp findresource put
4108,6 → 5498,7
/options exch def % We are given an options string
/barcode exch def % We are given the ismn text with dashes
 
/ctx null def
/dontdraw false def
/includetext false def % Enable/disable ISMN text
/ismntextfont /Courier def
4333,15 → 5724,15
% --END ENCODER ismn--
 
% --BEGIN ENCODER issn--
% --REQUIRES preamble raiseerror renlinear ean2 ean5 ean13--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear ean2 ean5 ean13--
% --DESC: ISSN
% --EXAM: 0311-175X 00 17
% --EXOP: includetext guardwhitespace
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp issn 0.0 2021092800 77354 76846
%%BeginData: 178 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp issn 0.0 2022072900 83234 82740
%%BeginData: 179 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /ean13 dup /uk.co.terryburton.bwipp findresource put
4353,6 → 5744,7
/options exch def % We are given an options string
/issntxt exch def % We are given the issn text with dashes
 
/ctx null def
/dontdraw false def
/includetext false def % Enable/disable ISSN text
/issntextfont /Courier def
4523,15 → 5915,15
% --END ENCODER issn--
 
% --BEGIN ENCODER mands--
% --REQUIRES preamble raiseerror renlinear ean2 ean5 ean8--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear ean2 ean5 ean8--
% --DESC: Marks & Spencer
% --EXAM: 0642118
% --EXOP: includetext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp mands 0.0 2021092800 66033 65940
%%BeginData: 82 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp mands 0.0 2022072900 71641 71586
%%BeginData: 83 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /ean8 dup /uk.co.terryburton.bwipp findresource put
4543,6 → 5935,7
/options exch def
/barcode exch def
 
/ctx null def
/dontdraw false def
/includetext false def
 
4617,15 → 6010,17
% --END ENCODER mands--
 
% --BEGIN ENCODER code128--
% --REQUIRES preamble raiseerror parseinput renlinear--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renlinear--
% --DESC: Code 128
% --EXAM: Count01234567!
% --EXOP: includetext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp code128 0.0 2021092800 120207 119811
%%BeginData: 425 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp code128 0.0 2022072900 126029 129057
%%BeginData: 438 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
4637,6 → 6032,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includetext false def % Enable/disable text
/textfont /Courier def
4666,12 → 6062,16
/textyoffset textyoffset cvr def
/height height cvr def
 
/code128 //loadctx exec
 
% 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
/fn4 -10 def /sft -11 def /stp -12 def
/lka -13 def /lkc -14 def % CC-A/B and CC-C linkage
} ctxdef
 
% Parse the input
/fncvals <<
4689,6 → 6089,7
/msglen msg length def
 
% Character maps for each state
{
/charmaps [
% A B C A B C A B C
[ 32 32 (00) ] [ (!) (!) (01) ] [ (") (") (02) ] % 0-2
4743,6 → 6144,7
/seta charvals 0 get def
/setb charvals 1 get def
/setc charvals 2 get def
} ctxdef
 
% Include pseudo characters for GS1-128 Composite linkage identifiers
seta lka seta swb get put seta lkc seta swc get put
4825,17 → 6227,17
/p p 1 add def
} loop
n s
} bind def
} def
 
% Encoding for each alphabet
/enca {
seta exch get cws exch j exch put
/j j 1 add def
} bind def
} def
/encb {
setb exch get cws exch j exch put
/j j 1 add def
} bind def
} def
/encc {
dup type /arraytype ne {
setc exch get
4844,11 → 6246,11
} ifelse
cws exch j exch put
/j j 1 add def
} bind def
} def
 
% Character exclusively in either alphabet A or B
/anotb {dup seta exch known exch setb exch known not and} bind def
/bnota {dup setb exch known exch seta exch known not and} bind def
/anotb {dup seta exch known exch setb exch known not and} def
/bnota {dup setb exch known exch seta exch known not and} def
 
% Pre-compute relative position of next anotb and next bnota characters
/nextanotb [ msg length {0} repeat 9999 ] def
4868,8 → 6270,8
} for
 
% 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
/abeforeb {dup nextanotb exch get exch nextbnota exch get lt} def
/bbeforea {dup nextbnota exch get exch nextanotb exch get lt} def
 
/cws barcode length 2 mul 3 add array def
 
5002,6 → 6404,7
cws j 1 add seta stp get put
 
% Create an array containing the character mappings
{
/encs
[ (212222) (222122) (222221) (121223) (121322) (131222) (122213)
(122312) (132212) (221213) (221312) (231212) (112232) (122132)
5020,6 → 6423,7
(411311) (113141) (114131) (311141) (411131) (211412) (211214)
(211232) (2331112)
] def
} ctxdef
 
% Derive space bar succession
/sbs cws length 6 mul 1 add string def
5041,6 → 6445,8
 
dontdraw not //renlinear if
 
//unloadctx exec
 
end
 
}
5054,18 → 6460,18
% --END ENCODER code128--
 
% --BEGIN ENCODER gs1-128--
% --REQUIRES preamble raiseerror parseinput gs1lint renlinear code128--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renlinear code128--
% --DESC: GS1-128
% --EXAM: (01)95012345678903(3103)000123
% --EXOP: includetext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp gs1-128 0.0 2021092800 81345 84637
%%BeginData: 156 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp gs1-128 0.0 2022072900 80068 76461
%%BeginData: 114 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
dup /gs1lint dup /uk.co.terryburton.bwipp findresource put
dup /gs1process dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /code128 dup /uk.co.terryburton.bwipp findresource put
begin
5076,6 → 6482,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includetext false def % Enable/disable text
/textfont /Courier def
5087,6 → 6494,7
/linkagec false def
/parse false def
/dontlint false def
/lintreqs false def
 
% Parse the input options
options type /stringtype eq {
5107,55 → 6515,11
 
/text barcode def
 
% Expand ordinals of the form ^NNN to ASCII
/expand {
/fncvals <<
/parse parse
/parseonly true
/parsefnc false
>> def
fncvals //parseinput exec
} bind def
barcode /ai //gs1process exec
/fncs exch def
/vals exch def
/ais exch def
 
% Parse out AIs
/ais [] def
/vals [] 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
[ vals aload pop counttomark 1 add index expand ] /vals exch def
pop pop
} loop
pop
 
dontlint not { ais vals //gs1lint exec pop } if
 
% 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 code128 data
/fnc1 -1 def
/c128 [ fnc1 ] def
5168,7 → 6532,7
dup c128 length ai [ exch {} forall ] putinterval
dup c128 length ai length add val [ exch {} forall ] putinterval
/c128 exch def
i ais length 1 sub ne aifixed ai 0 2 getinterval known not and { % Append FNC1
i ais length 1 sub ne fncs i get and { % Append FNC1
c128 length 1 add array
dup 0 c128 putinterval
dup c128 length fnc1 put
5222,15 → 6586,15
% --END ENCODER gs1-128--
 
% --BEGIN ENCODER ean14--
% --REQUIRES preamble raiseerror parseinput renlinear code128--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renlinear code128--
% --DESC: GS1-14
% --EXAM: (01) 0 46 01234 56789 3
% --EXOP: includetext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp ean14 0.0 2021092800 63440 66700
%%BeginData: 107 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp ean14 0.0 2022072900 72622 72322
%%BeginData: 108 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /code128 dup /uk.co.terryburton.bwipp findresource put
5242,6 → 6606,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includetext false def % Enable/disable text
/textfont /Courier def
5341,15 → 6706,15
% --END ENCODER ean14--
 
% --BEGIN ENCODER sscc18--
% --REQUIRES preamble raiseerror parseinput renlinear code128--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renlinear code128--
% --DESC: SSCC-18
% --EXAM: (00) 0 0614141 123456789 0
% --EXOP: includetext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp sscc18 0.0 2021092800 63324 66579
%%BeginData: 107 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp sscc18 0.0 2022072900 72634 72329
%%BeginData: 108 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /code128 dup /uk.co.terryburton.bwipp findresource put
5361,6 → 6726,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includetext false def % Enable/disable text
/textfont /Courier def
5460,15 → 6826,17
% --END ENCODER sscc18--
 
% --BEGIN ENCODER code39--
% --REQUIRES preamble raiseerror renlinear--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear--
% --DESC: Code 39
% --EXAM: THIS IS CODE 39
% --EXOP: includetext includecheck includecheckintext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp code39 0.0 2021092800 62946 62513
%%BeginData: 143 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp code39 0.0 2022072900 72544 68679
%%BeginData: 154 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
begin
5479,6 → 6847,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includecheck false def
/validatecheck false def
5506,10 → 6875,14
/textyoffset textyoffset cvr def
/height height cvr def
 
/code39 //loadctx exec
 
% Create a string of the available characters
{
/barchars (0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%) def
/charvals 43 dict def
0 1 42 {charvals exch dup barchars exch 1 getinterval exch put} for
} ctxdef
 
% Validate the input
0 1 barcode length 1 sub {
5535,6 → 6908,7
} if
 
% Create an array containing the character mappings
{
/encs
[ (1113313111) (3113111131) (1133111131) (3133111111) (1113311131)
(3113311111) (1133311111) (1113113131) (3113113111) (1133113111)
5546,6 → 6920,7
(1331311111) (1311113131) (3311113111) (1331113111) (1313131111)
(1313111311) (1311131311) (1113131311) (1311313111)
] def
} ctxdef
 
/sbs barlen includecheck {3} {2} ifelse add 10 mul string def
/txt barlen includecheck {3} {2} ifelse add array def
5602,6 → 6977,8
 
dontdraw not //renlinear if
 
//unloadctx exec
 
end
 
}
5615,15 → 6992,17
% --END ENCODER code39--
 
% --BEGIN ENCODER code39ext--
% --REQUIRES preamble raiseerror parseinput renlinear code39--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renlinear code39--
% --DESC: Code 39 Extended
% --EXAM: Code39 Ext!
% --EXOP: includetext includecheck includecheckintext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp code39ext 0.0 2021092800 61643 64843
%%BeginData: 100 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp code39ext 0.0 2022072900 71121 70993
%%BeginData: 109 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
5636,6 → 7015,7
/options exch def % We are given an options string
/barcode exch def % We are given the code39extended text
 
/ctx null def
/dontdraw false def
/includetext false def
/parse false def
5651,6 → 7031,8
} if
options {def} forall
 
/code39ext //loadctx exec
 
% Parse ordinals of the form ^NNN to ASCII
/fncvals <<
/parse parse
5669,6 → 7051,7
} forall
 
% Extended alphabet to non-extended alphabet
{
/extencs
[ (%U) ($A) ($B) ($C) ($D) ($E) ($F) ($G) ($H) ($I) ($J) ($K) ($L) ($M) ($N) ($O)
($P) ($Q) ($R) ($S) ($T) ($U) ($V) ($W) ($X) ($Y) ($Z) (%A) (%B) (%C) (%D) (%E)
5679,6 → 7062,7
(%W) (+A) (+B) (+C) (+D) (+E) (+F) (+G) (+H) (+I) (+J) (+K) (+L) (+M) (+N) (+O)
(+P) (+Q) (+R) (+S) (+T) (+U) (+V) (+W) (+X) (+Y) (+Z) (%P) (%Q) (%R) (%S) (%T)
] def
} ctxdef
 
/newcode barlen 2 mul string def
/newtext barlen 2 mul string def
5714,6 → 7098,8
 
dontdraw not //renlinear if
 
//unloadctx exec
 
end
 
}
5727,15 → 7113,15
% --END ENCODER code39ext--
 
% --BEGIN ENCODER code32--
% --REQUIRES preamble raiseerror renlinear code39--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear code39--
% --DESC: Italian Pharmacode
% --EXAM: 01234567
% --EXOP: includetext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp code32 0.0 2021092800 58521 58072
%%BeginData: 101 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp code32 0.0 2022072900 63967 67254
%%BeginData: 102 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /code39 dup /uk.co.terryburton.bwipp findresource put
5747,6 → 7133,7
/options exch def % We are given an options string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includetext false def % Enable/disable code32 text
/textfont /Courier def
5840,15 → 7227,15
% --END ENCODER code32--
 
% --BEGIN ENCODER pzn--
% --REQUIRES preamble raiseerror renlinear code39--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear code39--
% --DESC: Pharmazentralnummer (PZN)
% --EXAM: 123456
% --EXOP: includetext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp pzn 0.0 2021092800 58384 58092
%%BeginData: 102 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp pzn 0.0 2022072900 64062 67274
%%BeginData: 103 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /code39 dup /uk.co.terryburton.bwipp findresource put
5860,6 → 7247,7
/options exch def % We are given an options string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includetext false def % Enable/disable code32 text
/textfont /Courier def
5954,15 → 7342,17
% --END ENCODER pzn--
 
% --BEGIN ENCODER code93--
% --REQUIRES preamble raiseerror parseinput renlinear--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renlinear--
% --DESC: Code 93
% --EXAM: THIS IS CODE 93
% --EXOP: includetext includecheck
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp code93 0.0 2021092800 62124 61789
%%BeginData: 134 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp code93 0.0 2022072900 68234 71403
%%BeginData: 144 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
5974,6 → 7364,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includecheck false def % Enable/disable checkdigit
/includetext false def % Enable/disable text
6000,6 → 7391,9
/textyoffset textyoffset cvr def
/height height cvr def
 
/code93 //loadctx exec
 
{
/encs
[ (131112) (111213) (111312) (111411) (121113)
(121212) (121311) (111114) (131211) (141111)
6016,8 → 7410,10
% Create a string of the available characters
/barchars (0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%) def
 
/sft1 -1 def /sft2 -2 def /sft3 -3 def /sft4 -4 def
} ctxdef
 
% Special function characters
/sft1 -1 def /sft2 -2 def /sft3 -3 def /sft4 -4 def
/fncvals <<
/parse parse
/parsefnc parsefnc
6087,6 → 7483,8
 
dontdraw not //renlinear if
 
//unloadctx exec
 
end
 
}
6100,15 → 7498,17
% --END ENCODER code93--
 
% --BEGIN ENCODER code93ext--
% --REQUIRES preamble raiseerror parseinput renlinear code93--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renlinear code93--
% --DESC: Code 93 Extended
% --EXAM: Code93 Ext!
% --EXOP: includetext includecheck
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp code93ext 0.0 2021092800 62105 65416
%%BeginData: 104 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp code93ext 0.0 2022072900 71471 71374
%%BeginData: 113 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
6121,6 → 7521,7
/options exch def % We are given an options string
/barcode exch def % We are given the code39extended text
 
/ctx null def
/dontdraw false def
/includetext false def
/parse false def
6136,6 → 7537,8
} if
options {def} forall
 
/code93ext //loadctx exec
 
% Parse ordinals of the form ^NNN to ASCII
/fncvals <<
/parse parse
6147,6 → 7550,7
options (parse) undef
 
% Extended alphabet to non-extended alphabet
{
/extencs
[ (^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)
6165,6 → 7569,7
(^SFT+P) (^SFT+Q) (^SFT+R) (^SFT+S) (^SFT+T) (^SFT+U) (^SFT+V) (^SFT+W)
(^SFT+X) (^SFT+Y) (^SFT+Z) (^SFT%P) (^SFT%Q) (^SFT%R) (^SFT%S) (^SFT%T)
] def
} ctxdef
 
/newcode barlen 6 mul string def
/newtext barlen 6 mul string def
6203,6 → 7608,8
 
dontdraw not //renlinear if
 
//unloadctx exec
 
end
 
}
6216,15 → 7623,17
% --END ENCODER code93ext--
 
% --BEGIN ENCODER interleaved2of5--
% --REQUIRES preamble raiseerror renlinear--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear--
% --DESC: Interleaved 2 of 5 (ITF)
% --EXAM: 2401234567
% --EXOP: height=0.5 includecheck includetext includecheckintext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp interleaved2of5 0.0 2021092800 61533 61224
%%BeginData: 152 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp interleaved2of5 0.0 2022072900 70923 67054
%%BeginData: 162 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
begin
6235,6 → 7644,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includecheck false def % Enable/disable checkdigit
/includetext false def % Enable/disable text
6260,6 → 7670,8
/textyoffset textyoffset cvr def
/height height cvr def
 
/interleaved2of5 //loadctx exec
 
% Validate the input
barcode {
dup 48 lt exch 57 gt or {
6300,6 → 7712,7
} if
 
% Create an array containing the character mappings
{
/encs
[ (11221) (21112) (12112) (22111) (11212)
(21211) (12211) (11122) (21121) (12121)
6308,6 → 7721,8
 
% Create a string of the available characters
/barchars (0123456789) def
} ctxdef
 
/sbs barlen 5 mul 8 add string def
/txt barlen array def
 
6367,6 → 7782,8
 
dontdraw not //renlinear if
 
//unloadctx exec
 
end
 
}
6380,15 → 7797,15
% --END ENCODER interleaved2of5--
 
% --BEGIN ENCODER itf14--
% --REQUIRES preamble raiseerror renlinear interleaved2of5--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear interleaved2of5--
% --DESC: ITF-14
% --EXAM: 0 46 01234 56789 3
% --EXOP: includetext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp itf14 0.0 2021092800 60903 60661
%%BeginData: 111 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp itf14 0.0 2022072900 66573 69859
%%BeginData: 112 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /interleaved2of5 dup /uk.co.terryburton.bwipp findresource put
6400,6 → 7817,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includetext false def
/includecheckintext true def
6503,15 → 7921,15
% --END ENCODER itf14--
 
% --BEGIN ENCODER identcode--
% --REQUIRES preamble raiseerror renlinear interleaved2of5--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear interleaved2of5--
% --DESC: Deutsche Post Identcode
% --EXAM: 563102430313
% --EXOP: includetext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp identcode 0.0 2021092800 57310 57220
%%BeginData: 93 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp identcode 0.0 2022072900 62988 66378
%%BeginData: 94 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /interleaved2of5 dup /uk.co.terryburton.bwipp findresource put
6523,6 → 7941,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includetext false def % Enable/disable text
/textfont /Courier def
6608,15 → 8027,15
% --END ENCODER identcode--
 
% --BEGIN ENCODER leitcode--
% --REQUIRES preamble raiseerror renlinear interleaved2of5--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear interleaved2of5--
% --DESC: Deutsche Post Leitcode
% --EXAM: 21348075016401
% --EXOP: includetext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp leitcode 0.0 2021092800 57302 57216
%%BeginData: 93 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp leitcode 0.0 2022072900 62980 66374
%%BeginData: 94 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /interleaved2of5 dup /uk.co.terryburton.bwipp findresource put
6628,6 → 8047,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includetext false def % Enable/disable text
/textfont /Courier def
6713,15 → 8133,17
% --END ENCODER leitcode--
 
% --BEGIN ENCODER databaromni--
% --REQUIRES preamble raiseerror renlinear renmatrix--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear renmatrix--
% --DESC: GS1 DataBar Omnidirectional
% --EXAM: (01)24012345678905
% --EXOP:
% --RNDR: renlinear renmatrix
%%BeginResource: uk.co.terryburton.bwipp databaromni 0.0 2021092800 105433 104213
%%BeginData: 425 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp databaromni 0.0 2022072900 115343 110971
%%BeginData: 436 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
20 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
6733,6 → 8155,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/height 33 72 div def
/linkage false def
6754,6 → 8177,8
/height height cvr def
/barxmult barxmult cvi def
 
/databaromni //loadctx exec
 
% Validate the input
barcode 0 4 getinterval (\(01\)) ne {
/bwipp.databaromniBadAI (GS1 DataBar Omnidirectional must begin with (01) application identifier) //raiseerror exec
6877,6 → 8302,7
/d3 right 1597 idiv def
/d4 right 1597 mod def
 
{
/tab164 [
160 0 12 4 8 1 161 1
960 161 10 6 6 3 80 10
6891,6 → 8317,7
1515 1036 9 6 6 3 48 10
1596 1516 11 4 8 1 81 1
] def
} ctxdef
 
/i 0 def {
d1 tab164 i get le {
6984,6 → 8411,7
d4w {} forall
] def
 
{
/checkweights [
1 3 9 27 2 6 18 54
58 72 24 8 29 36 12 4
6996,6 → 8424,7
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
} ctxdef
 
/checksum 0 def
0 1 31 {
7137,6 → 8566,8
 
} ifelse
 
//unloadctx exec
 
end
 
}
7150,15 → 8581,15
% --END ENCODER databaromni--
 
% --BEGIN ENCODER databarstacked--
% --REQUIRES preamble raiseerror renlinear renmatrix databaromni--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear renmatrix databaromni--
% --DESC: GS1 DataBar Stacked
% --EXAM: (01)24012345678905
% --EXOP:
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp databarstacked 0.0 2021092800 58192 61579
%%BeginData: 75 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp databarstacked 0.0 2022072900 67414 63705
%%BeginData: 76 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
dup /databaromni dup /uk.co.terryburton.bwipp findresource put
7170,6 → 8601,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
 
% Parse the input options
7237,15 → 8669,15
% --END ENCODER databarstacked--
 
% --BEGIN ENCODER databarstackedomni--
% --REQUIRES preamble raiseerror renlinear renmatrix databaromni--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear renmatrix databaromni--
% --DESC: GS1 DataBar Stacked Omnidirectional
% --EXAM: (01)24012345678905
% --EXOP:
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp databarstackedomni 0.0 2021092800 58236 61531
%%BeginData: 75 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp databarstackedomni 0.0 2022072900 67514 63785
%%BeginData: 76 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
dup /databaromni dup /uk.co.terryburton.bwipp findresource put
7257,6 → 8689,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
 
% Parse the input options
7324,15 → 8757,15
% --END ENCODER databarstackedomni--
 
% --BEGIN ENCODER databartruncated--
% --REQUIRES preamble raiseerror renlinear renmatrix databaromni--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear renmatrix databaromni--
% --DESC: GS1 DataBar Truncated
% --EXAM: (01)24012345678905
% --EXOP:
% --RNDR: renlinear renmatrix
%%BeginResource: uk.co.terryburton.bwipp databartruncated 0.0 2021092800 58138 61491
%%BeginData: 75 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp databartruncated 0.0 2022072900 67440 63721
%%BeginData: 76 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /databaromni dup /uk.co.terryburton.bwipp findresource put
7344,6 → 8777,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
 
% Parse the input options
7411,15 → 8845,17
% --END ENCODER databartruncated--
 
% --BEGIN ENCODER databarlimited--
% --REQUIRES preamble raiseerror renlinear--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear--
% --DESC: GS1 DataBar Limited
% --EXAM: (01)15012345678907
% --EXOP:
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp databarlimited 0.0 2021092800 80912 80201
%%BeginData: 278 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp databarlimited 0.0 2022072900 90806 86511
%%BeginData: 291 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
20 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
begin
7430,6 → 8866,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/height 10 72 div def
/linkage false def
7447,6 → 8884,8
 
/height height cvr def
 
/databarlimited //loadctx exec
 
% Validate the input
barcode 0 4 getinterval (\(01\)) ne {
/bwipp.databarlimitedBadAI (GS1 DataBar Limited must begin with (01) application identifier) //raiseerror exec
7481,11 → 8920,13
/barcode exch def
 
% Strip the AI and optional check digit
{
/linkval [ 2 0 1 5 1 3 3 5 3 1 0 9 6 ] def
} ctxdef
/binval [
barcode 4 13 getinterval {48 sub} forall
] def
linkage {
/linkval [ 2 0 1 5 1 3 3 5 3 1 0 9 6 ] def
0 1 binval length 1 sub {
/i exch def
binval i binval i get linkval i get add put
7513,7 → 8954,7
1 index idiv exch 1 add exch
} loop
exch pop exch pop
} bind def
} def
 
/getRSSwidths {
/oe exch def
7552,7 → 8993,7
} for
out el 1 sub nm put
out
} bind def
} def
 
0 1 11 {
/i exch def
7575,6 → 9016,7
} ifelse
} for
 
{
/tab267 [
183063 0 17 9 6 3 6538 28
820063 183064 13 13 5 4 875 728
7584,6 → 9026,7
1996938 1979845 19 7 8 1 17094 1
2013570 1996939 7 19 1 8 1 16632
] def
} ctxdef
 
/i 0 def {
d1 tab267 i get le {
7633,6 → 9076,7
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
7653,6 → 9097,7
322 323
326 337
] def
} ctxdef
 
/checksum 0 def
0 1 27 {
7688,6 → 9133,8
 
dontdraw not //renlinear if
 
//unloadctx exec
 
end
 
}
7701,18 → 9148,19
% --END ENCODER databarlimited--
 
% --BEGIN ENCODER databarexpanded--
% --REQUIRES preamble raiseerror parseinput gs1lint renlinear renmatrix--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renlinear renmatrix--
% --DESC: GS1 DataBar Expanded
% --EXAM: (01)95012345678903(3103)000123
% --EXOP:
% --RNDR: renlinear renmatrix
%%BeginResource: uk.co.terryburton.bwipp databarexpanded 0.0 2021092800 242723 244991
%%BeginData: 886 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp databarexpanded 0.0 2022072900 246206 244983
%%BeginData: 863 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
dup /gs1lint dup /uk.co.terryburton.bwipp findresource put
dup /gs1process dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
begin
7723,8 → 9171,10
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/parse false def
/dontlint false def
/lintreqs true def
/dontdraw false def
/height 34 72 div def
/format (expanded) def
7747,6 → 9197,8
/segments segments cvi def
/barxmult barxmult cvi def
 
/databarexpanded //loadctx exec
 
segments -1 eq {
/segments format (expandedstacked) eq {4} {22} ifelse def
} {
7755,37 → 9207,11
} if
} ifelse
 
% Expand ordinals of the form ^NNN to ASCII
/expand {
/fncvals <<
/parse parse
/parseonly true
/parsefnc false
>> def
fncvals //parseinput exec
} bind def
barcode /ai //gs1process exec
/fncs exch def
/vals exch def
/ais exch def
 
% Parse out AIs
/ais [] def
/vals [] 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
[ vals aload pop counttomark 1 add index expand ] /vals exch def
pop pop
} loop
pop
 
dontlint not { ais vals //gs1lint exec pop } if
 
% Method selection
{ % common exit
 
7883,18 → 9309,18
2 copy 20 10 getinterval exch 6 3 getinterval cvi 2 10 string cvrs dup length 10 exch sub exch putinterval
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
} 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
} 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
} bind def
} def
 
/fnc1 -1 def /lnumeric -2 def /lalphanumeric -3 def /liso646 -4 def
 
7909,6 → 9335,7
/gpf [] def
/ais ais 1 ais length 1 sub getinterval def
/vals vals 1 vals length 1 sub getinterval def
/fncs fncs 1 fncs length 1 sub getinterval def
} if
 
method (0100) eq {
7919,6 → 9346,7
/gpf [] def
/ais [] def
/vals [] def
/fncs [] def
} if
 
method (0101) eq {
7934,6 → 9362,7
/gpf [] def
/ais [] def
/vals [] def
/fncs [] def
} if
 
method length 7 eq {
7955,6 → 9384,7
/gpf [] def
/ais [] def
/vals [] def
/fncs [] def
} if
 
method (01100) eq {
7965,6 → 9395,7
/gpf [ vals 1 get {} forall ais length 2 gt { fnc1 } if ] def
/ais ais 2 ais length 2 sub getinterval def
/vals vals 2 vals length 2 sub getinterval def
/fncs fncs 2 fncs length 2 sub getinterval def
} if
 
method (01101) eq {
7976,6 → 9407,7
/gpf [ vals 1 get dup length 3 sub 3 exch getinterval {} forall ais length 2 gt { fnc1 } if ] def
/ais ais 2 ais length 2 sub getinterval def
/vals vals 2 vals length 2 sub getinterval def
/fncs fncs 2 fncs length 2 sub getinterval def
} if
 
% Variable length symbol field
7985,24 → 9417,7
/vlf [] def
} ifelse
 
% 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
 
{
/numeric <<
0 1 119 {
dup (00) 2 string copy dup 3 -1 roll 11 2 string cvrs
8040,6 → 9455,7
lnumeric (000)
lalphanumeric (00100)
>> def
} ctxdef
 
% Append the remaining AI data
0 1 ais length 1 sub {
8051,7 → 9467,7
dup gpf length ai [ exch {} forall ] putinterval
dup gpf length ai length add val [ exch {} forall ] putinterval
/gpf exch def
i ais length 1 sub ne aifixed ai 0 2 getinterval known not and { % Append FNC1
i ais length 1 sub ne fncs i get and { % Append FNC1
gpf length 1 add array
dup 0 gpf putinterval
dup gpf length fnc1 put
8070,7 → 9486,7
pop
} ifelse
exch sub
} bind def
} def
 
/encode {
dup /raw ne {exch get} {pop} ifelse
8078,7 → 9494,7
dup length exch
gpfenc exch j exch putinterval
/j exch j add def
} bind def
} def
 
% Pre-compute alphanumeric and numeric runlengths and position of next ISO646-only characters
/numericruns [ gpf length {0} repeat 0 -1 ] def
8247,7 → 9663,7
1 index idiv exch 1 add exch
} loop
exch pop exch pop
} bind def
} def
 
/getRSSwidths {
/oe exch def
8286,8 → 9702,9
} for
out el 1 sub nm put
out
} bind def
} def
 
{
/tab174 [
347 0 12 5 7 2 87 4
1387 348 10 7 5 4 52 20
8295,6 → 9712,7
3987 2948 6 11 3 6 10 104
4191 3988 4 13 1 8 1 204
] def
} ctxdef
 
/dxw datalen array def
 
8339,6 → 9757,7
 
} for
 
{
/finderwidths [
1 8 4 1 1 1 1 4 8 1
3 6 4 1 1 1 1 4 6 3
8360,6 → 9779,7
[0 1 2 3 4 5 6 9 10 11]
[0 1 2 3 4 7 6 9 8 11 10]
] def
} ctxdef
 
/seq finderseq datalen 2 sub 2 idiv get def
/fxw seq length array def
8368,6 → 9788,7
fxw x finderwidths seq x get 5 mul 5 getinterval put
} for
 
{
/checkweights [
-1 -1 -1 -1 -1 -1 -1 -1 % A1L
77 96 32 81 27 9 3 1 % A1R
8394,6 → 9815,7
55 165 73 8 24 72 5 15 % F2L
89 100 174 58 160 194 135 45 % F2R
] def
} ctxdef
 
/checkweightseq [
seq {16 mul checkweights exch 16 getinterval aload pop} forall
8586,6 → 10008,8
 
} ifelse
 
//unloadctx exec
 
end
 
}
8599,15 → 10023,15
% --END ENCODER databarexpanded--
 
% --BEGIN ENCODER databarexpandedstacked--
% --REQUIRES preamble raiseerror parseinput gs1lint renlinear renmatrix databarexpanded--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renlinear renmatrix databarexpanded--
% --DESC: GS1 DataBar Expanded Stacked
% --EXAM: (01)95012345678903(3103)000123
% --EXOP: segments=4
% --RNDR: renlinear renmatrix
%%BeginResource: uk.co.terryburton.bwipp databarexpandedstacked 0.0 2021092800 66639 63073
%%BeginData: 45 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp databarexpandedstacked 0.0 2022072900 69203 72245
%%BeginData: 46 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
dup /databarexpanded dup /uk.co.terryburton.bwipp findresource put
8619,6 → 10043,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
 
% Parse the input options
8656,18 → 10081,17
% --END ENCODER databarexpandedstacked--
 
% --BEGIN ENCODER gs1northamericancoupon--
% --REQUIRES preamble raiseerror parseinput gs1lint renlinear renmatrix databarexpanded databarexpandedstacked--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renlinear renmatrix databarexpanded databarexpandedstacked--
% --DESC: GS1 North American Coupon
% --EXAM: (8110)106141416543213500110000310123196000
% --EXOP: includetext segments=8
% --RNDR: renlinear renmatrix
%%BeginResource: uk.co.terryburton.bwipp gs1northamericancoupon 0.0 2021092800 82792 82511
%%BeginData: 131 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp gs1northamericancoupon 0.0 2022072900 84498 91105
%%BeginData: 105 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
dup /gs1lint dup /uk.co.terryburton.bwipp findresource put
dup /gs1process dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
dup /databarexpandedstacked dup /uk.co.terryburton.bwipp findresource put
begin
8678,8 → 10102,8
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
 
/includetext false def % Enable/disable coupon text
/coupontextfont /Helvetica def
/coupontextsize 9 def
8687,6 → 10111,7
/coupontextyoffset (unset) def
/parse false def
/dontlint false def
/lintreqs true def
 
% Parse the input options
options type /stringtype eq {
8704,34 → 10129,10
coupontextxoffset (unset) ne {/coupontextxoffset coupontextxoffset cvr def} if
coupontextyoffset (unset) ne {/coupontextyoffset coupontextyoffset cvr def} if
 
% Expand ordinals of the form ^NNN to ASCII
/expand {
/fncvals <<
/parse parse
/parseonly true
/parsefnc false
>> def
fncvals //parseinput exec
} bind def
 
% Parse out AIs
/ais [] def
/vals [] 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
[ vals aload pop counttomark 1 add index expand ] /vals exch def
pop pop
} loop
barcode /ai //gs1process exec
pop
/vals exch def
/ais exch def
 
% Validate the AI structure
ais length 1 ne {
8741,8 → 10142,6
/bwipp.gs1northamericancouponBadAIStructure (A GS1 North American Coupon should consist of a single AI (8110)) //raiseerror exec
} if
 
dontlint not { ais vals //gs1lint exec pop } if
 
% Parse out the Company Prefix and Offer Code
/val vals 0 get def
/vli val 0 get 48 sub def
8804,10 → 10203,10
% --EXAM: 117480
% --EXOP: showborder
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp pharmacode 0.0 2021092800 54994 54752
%%BeginData: 93 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp pharmacode 0.0 2022072900 55161 54804
%%BeginData: 94 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
begin
8818,6 → 10217,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/height 8 2.835 mul 72 div def
/nwidth 0.5 2.835 mul def
8909,10 → 10309,10
% --EXAM: 117480
% --EXOP: includetext showborder
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp pharmacode2 0.0 2021092800 55825 55610
%%BeginData: 98 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp pharmacode2 0.0 2022072900 55992 55790
%%BeginData: 99 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
begin
8923,6 → 10323,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includetext false def % Enable/disable text
/height 4 def % Height of short bars in millimetres
9014,15 → 10415,17
% --END ENCODER pharmacode2--
 
% --BEGIN ENCODER code2of5--
% --REQUIRES preamble raiseerror renlinear--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear--
% --DESC: Code 25
% --EXAM: 01234567
% --EXOP: includetext includecheck includecheckintext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp code2of5 0.0 2021092800 63389 62953
%%BeginData: 153 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp code2of5 0.0 2022072900 73027 69031
%%BeginData: 165 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
begin
9033,6 → 10436,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includecheck false def
/validatecheck false def
9060,6 → 10464,8
/textyoffset textyoffset cvr def
/height height cvr def
 
/code2of5 //loadctx exec
 
% Validate input
barcode {
dup 48 lt exch 57 gt or {
9084,6 → 10490,7
} if
 
% Create an array containing the character mappings
{
/versions <<
/industrial
[ (1111313111) (3111111131) (1131111131) (3131111111)
9108,6 → 10515,8
(133111) (111331) (311311) (131311) (1111) (311)
]
>> def
} ctxdef
 
versions version known not {
/bwipp.code2of5badVersion (Unrecognised Code 25 version) //raiseerror exec
} if
9120,7 → 10529,9
/es encs 11 get length def
 
% Create a string of the available characters
{
/barchars (0123456789) def
} ctxdef
 
/sbs barlen includecheck {1 add} if cs mul ss add es add string def
/txt barlen includecheck {1 add} if array def
9166,6 → 10577,8
 
dontdraw not //renlinear if
 
//unloadctx exec
 
end
 
}
9179,15 → 10592,15
% --END ENCODER code2of5--
 
% --BEGIN ENCODER industrial2of5--
% --REQUIRES preamble raiseerror renlinear code2of5--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear code2of5--
% --DESC: Industrial 2 of 5
% --EXAM: 01234567
% --EXOP: includetext includecheck includecheckintext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp industrial2of5 0.0 2021092800 51614 51610
%%BeginData: 57 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp industrial2of5 0.0 2022072900 57292 60792
%%BeginData: 58 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /code2of5 dup /uk.co.terryburton.bwipp findresource put
9199,6 → 10612,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includetext false def % Enable/disable text
/textfont /Courier def
9248,15 → 10662,15
% --END ENCODER industrial2of5--
 
% --BEGIN ENCODER iata2of5--
% --REQUIRES preamble raiseerror renlinear code2of5--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear code2of5--
% --DESC: IATA 2 of 5
% --EXAM: 01234567
% --EXOP: includetext includecheck includecheckintext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp iata2of5 0.0 2021092800 51712 51586
%%BeginData: 57 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp iata2of5 0.0 2022072900 57262 60768
%%BeginData: 58 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /code2of5 dup /uk.co.terryburton.bwipp findresource put
9268,6 → 10682,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includetext false def % Enable/disable text
/textfont /Courier def
9317,15 → 10732,15
% --END ENCODER iata2of5--
 
% --BEGIN ENCODER matrix2of5--
% --REQUIRES preamble raiseerror renlinear code2of5--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear code2of5--
% --DESC: Matrix 2 of 5
% --EXAM: 01234567
% --EXOP: includetext includecheck includecheckintext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp matrix2of5 0.0 2021092800 51594 51594
%%BeginData: 57 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp matrix2of5 0.0 2022072900 57272 60776
%%BeginData: 58 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /code2of5 dup /uk.co.terryburton.bwipp findresource put
9337,6 → 10752,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includetext false def % Enable/disable text
/textfont /Courier def
9386,15 → 10802,15
% --END ENCODER matrix2of5--
 
% --BEGIN ENCODER coop2of5--
% --REQUIRES preamble raiseerror renlinear code2of5--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear code2of5--
% --DESC: COOP 2 of 5
% --EXAM: 01234567
% --EXOP: includetext includecheck includecheckintext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp coop2of5 0.0 2021092800 51584 51586
%%BeginData: 57 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp coop2of5 0.0 2022072900 57262 60768
%%BeginData: 58 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /code2of5 dup /uk.co.terryburton.bwipp findresource put
9406,6 → 10822,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includetext false def % Enable/disable text
/textfont /Courier def
9455,15 → 10872,15
% --END ENCODER coop2of5--
 
% --BEGIN ENCODER datalogic2of5--
% --REQUIRES preamble raiseerror renlinear code2of5--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear code2of5--
% --DESC: Datalogic 2 of 5
% --EXAM: 01234567
% --EXOP: includetext includecheck includecheckintext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp datalogic2of5 0.0 2021092800 51609 51606
%%BeginData: 57 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp datalogic2of5 0.0 2022072900 57287 60788
%%BeginData: 58 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /code2of5 dup /uk.co.terryburton.bwipp findresource put
9475,6 → 10892,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includetext false def % Enable/disable text
/textfont /Courier def
9524,15 → 10942,17
% --END ENCODER datalogic2of5--
 
% --BEGIN ENCODER code11--
% --REQUIRES preamble raiseerror renlinear--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear--
% --DESC: Code 11
% --EXAM: 0123456789
% --EXOP: includetext includecheck includecheckintext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp code11 0.0 2021092800 64947 64514
%%BeginData: 160 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp code11 0.0 2022072900 74353 70384
%%BeginData: 169 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
begin
9543,6 → 10963,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includecheck false def
/validatecheck false def
9569,7 → 10990,10
/textyoffset textyoffset cvr def
/height height cvr def
 
/code11 //loadctx exec
 
% Create an array containing the character mappings
{
/encs
[ (111131) (311131) (131131) (331111) (113131)
(313111) (133111) (111331) (311311) (311111)
9580,6 → 11004,7
/barchars (0123456789-) def
/charvals 11 dict def
0 1 10 {charvals exch dup barchars exch 1 getinterval exch put} for
} ctxdef
 
% Validate the input
0 1 barcode length 1 sub {
9683,6 → 11108,8
 
dontdraw not //renlinear if
 
//unloadctx exec
 
end
 
}
9696,15 → 11123,17
% --END ENCODER code11--
 
% --BEGIN ENCODER bc412--
% --REQUIRES preamble raiseerror renlinear--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear--
% --DESC: BC412
% --EXAM: BC412
% --EXOP: semi includetext includecheckintext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp bc412 0.0 2021092800 60520 60057
%%BeginData: 150 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp bc412 0.0 2022072900 75285 71341
%%BeginData: 203 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
begin
9715,6 → 11144,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includecheck false def
/validatecheck false def
9744,14 → 11174,18
/height height cvr def
 
semi {
/includecheck true def
% Implies includecheck and includecheckintext also
/includestartstop true def
} if
 
/bc412 //loadctx exec
 
% Create a string of the available characters
{
/barchars (0R9GLVHA8EZ4NTS1J2Q6C7DYKBUIX3FWP5M) def
/charvals 35 dict def
0 1 34 {charvals exch dup barchars exch 1 getinterval exch put} for
} ctxdef
 
% Validate the input
0 1 barcode length 1 sub {
9760,33 → 11194,77
} if
} for
 
/barlen barcode length validatecheck {1 sub} if def
semi {
% Validate length
validatecheck {
barcode length 8 lt barcode length 19 gt or {
/bwipp.bc412semivalidateBadLength (BC412 semi with check digit must be 8 to 19 characters long) //raiseerror exec
} if
} {
barcode length 7 lt barcode length 18 gt or {
/bwipp.bc412semiBadLength (BC412 semi must be 7 to 18 characters long) //raiseerror exec
} if
} ifelse
 
/checksum 0 def
0 1 barlen 1 sub {
barcode exch 1 getinterval charvals exch get
checksum add /checksum exch def
} for
/checksum checksum 35 mod def
validatecheck {
barcode barlen get barchars checksum get ne {
/bwipp.bc412badCheckDigit (Incorrect BC412 check digit provided) //raiseerror exec
/barlen barcode length def
validatecheck not { % Place dummy (0) in checksum position (1-based 2nd)
/barlen barlen 1 add def
/sbarcode barlen string def
sbarcode 0 barcode 0 get put
sbarcode 1 48 put % (0)
sbarcode 2 barcode 1 barlen 2 sub getinterval putinterval
/barcode sbarcode def
} if
/barcode barcode 0 barlen getinterval def
/includecheck true def
} if
/sumodd 0 def /sumeven 0 def
0 1 barlen 1 sub {
/i exch def
barcode i 1 getinterval charvals exch get
i 2 mod 0 eq { % 1-based odd
sumodd add /sumodd exch def
} {
sumeven add /sumeven exch def
} ifelse
} for
/checksum sumodd 35 mod sumeven 35 mod 2 mul add 35 mod def % F = Mod35( Mod35( Fodd ) + 2 * Mod35( Feven ) )
validatecheck {
checksum 0 ne {
/bwipp.bc412semiBadCheckDigit (Incorrect BC412 semi check digit provided) //raiseerror exec
} if
} {
/checksum checksum 17 mul 35 mod def % CD = Mod35( 17 * F )
barcode 1 barchars checksum get put
} ifelse
} {
/barlen barcode length validatecheck {1 sub} if def
 
/checksum 0 def
0 1 barlen 1 sub {
barcode exch 1 getinterval charvals exch get
checksum add /checksum exch def
} for
/checksum checksum 35 mod def
validatecheck {
barcode barlen get barchars checksum get ne {
/bwipp.bc412badCheckDigit (Incorrect BC412 check digit provided) //raiseerror exec
} if
/barcode barcode 0 barlen getinterval def
/includecheck true def
} if
} ifelse
 
% Create an array containing the character mappings
{
/encs
[ (11111115) (13111212) (11131113) (12111213) (12121311)
(13131111) (12111312) (11131212) (11121411) (11151111)
(15111111) (11111511) (12131211) (13121112) (13111212)
(11111214) (12121113) (11111313) (13111113) (11121213)
(11141112) (11121312) (11141211) (14121111) (12121212)
(11131311) (13121211) (12111411) (14111211) (11111412)
(12111114) (14111112) (12141111) (11121114) (12131112)
(12) (111)
[ (11111115) (13111212) (11131113) (12111213) (12121311) % 0R9GL
(13131111) (12111312) (11131212) (11121411) (11151111) % VHA8E
(15111111) (11111511) (12131211) (13121112) (13111311) % Z4NTS
(11111214) (12121113) (11111313) (13111113) (11121213) % 1J2Q6
(11141112) (11121312) (11141211) (14121111) (12121212) % C7DYK
(11131311) (13121211) (12111411) (14111211) (11111412) % BUIX3
(12111114) (14111112) (12141111) (11121114) (12131112) % FWP5M
(12) (111) % Start Stop
] def
} ctxdef
 
/sbs barlen 1 add 8 mul 5 add string def
includecheck {
9827,7 → 11305,7
% Put the stop character
includestartstop {
sbs pos encs 36 get putinterval
/pos pos 2 add def
/pos pos 3 add def
} if
 
% Return the arguments
9845,6 → 11323,8
 
dontdraw not //renlinear if
 
//unloadctx exec
 
end
 
}
9858,15 → 11338,17
% --END ENCODER bc412--
 
% --BEGIN ENCODER rationalizedCodabar--
% --REQUIRES preamble raiseerror renlinear--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear--
% --DESC: Codabar
% --EXAM: A0123456789B
% --EXOP: includetext includecheck includecheckintext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp rationalizedCodabar 0.0 2021092800 65315 64822
%%BeginData: 158 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp rationalizedCodabar 0.0 2022072900 75138 71172
%%BeginData: 167 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
begin
9877,6 → 11359,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/altstartstop false def
/includecheck false def % Enable/disable checkdigit
9904,6 → 11387,9
/textyoffset textyoffset cvr def
/height height cvr def
 
/rationalizedCodabar //loadctx exec
 
{
% Create an array containing the character mappings
/encs
[ (11111331) (11113311) (11131131) (33111111) (11311311)
9913,11 → 11399,12
] def
 
% Create a string of the available characters
altstartstop {
/barchars (0123456789-$:/.+TN*E) def
} {
/barchars (0123456789-$:/.+ABCD) def
} ifelse
/barcharsnormal (0123456789-$:/.+ABCD) def
/barcharsalt (0123456789-$:/.+TN*E) def
} ctxdef
 
/barchars altstartstop {barcharsalt} {barcharsnormal} ifelse def
 
/charvals 20 dict def
0 1 19 {charvals exch dup barchars exch 1 getinterval exch put} for
/bodyvals 16 dict def
10015,6 → 11502,8
 
dontdraw not //renlinear if
 
//unloadctx exec
 
end
 
}
10028,15 → 11517,17
% --END ENCODER rationalizedCodabar--
 
% --BEGIN ENCODER onecode--
% --REQUIRES preamble raiseerror renlinear--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear--
% --DESC: USPS Intelligent Mail
% --EXAM: 0123456709498765432101234567891
% --EXOP: barcolor=FF0000
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp onecode 0.0 2021092800 99045 98718
%%BeginData: 337 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp onecode 0.0 2022072900 108963 104948
%%BeginData: 348 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
begin
10047,6 → 11538,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/height 0.15 def
 
10063,6 → 11555,8
 
/height height cvr def
 
/onecode //loadctx exec
 
/barlen barcode length def
 
% Create the human readable text
10191,6 → 11685,7
} if
 
% 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
10288,6 → 11783,7
513 4104 514 2056 516 1032 1025 4100 1026 2052 2049 4098 4097 2050 1028
520 272 160
] def
} ctxdef
 
/chars 10 array def
0 1 9 {
10308,6 → 11804,7
} for
 
% Conversion from characters to the OneCode encoding
{
/barmap [
7 2 4 3 1 10 0 0 9 12 2 8 5 5 6 11 8 9 3 1
0 1 5 12 2 5 1 8 4 4 9 11 6 3 8 10 3 9 7 6
10323,6 → 11820,7
5 4 0 11 1 5 2 2 9 1 4 12 8 3 6 6 7 0 3 7
4 7 7 5 0 12 1 11 2 9 9 0 6 8 5 3 3 10 8 2
] def
} ctxdef
 
/bbs 65 array def
/bhs 65 array def
10364,6 → 11862,8
 
dontdraw not //renlinear if
 
//unloadctx exec
 
end
 
}
10377,15 → 11877,17
% --END ENCODER onecode--
 
% --BEGIN ENCODER postnet--
% --REQUIRES preamble raiseerror renlinear--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear--
% --DESC: USPS POSTNET
% --EXAM: 01234
% --EXOP: includetext includecheckintext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp postnet 0.0 2021092800 61190 60891
%%BeginData: 142 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp postnet 0.0 2022072900 70748 66913
%%BeginData: 151 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
begin
10396,6 → 11898,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includetext false def % Enable/disable text
/validatecheck false def
10421,6 → 11924,8
/textyoffset textyoffset cvr def
/height height cvr def
 
/postnet //loadctx exec
 
/barlen barcode length validatecheck {1 sub} if def
 
% Validate the input
10433,9 → 11938,18
} if
} forall
 
{
% Create a string of the available characters
/barchars (0123456789) def
 
% Create an array containing the character mappings
/encs
[ (55222) (22255) (22525) (22552) (25225)
(25252) (25522) (52225) (52252) (52522)
(5) (5)
] def
} ctxdef
 
/checksum 0 def
0 1 barlen 1 sub {
/i exch def
10449,13 → 11963,6
/barcode barcode 0 barlen getinterval def
} if
 
% Create an array containing the character mappings
/encs
[ (55222) (22255) (22525) (22552) (25225)
(25252) (25522) (52225) (52252) (52522)
(5) (5)
] def
 
/bhs barlen 5 mul 7 add array def
/txt barlen 1 add array def
 
10518,6 → 12025,8
 
dontdraw not //renlinear if
 
//unloadctx exec
 
end
 
}
10531,15 → 12040,17
% --END ENCODER postnet--
 
% --BEGIN ENCODER planet--
% --REQUIRES preamble raiseerror renlinear--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear--
% --DESC: USPS PLANET
% --EXAM: 01234567890
% --EXOP: includetext includecheckintext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp planet 0.0 2021092800 61050 60755
%%BeginData: 143 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp planet 0.0 2022072900 70608 66777
%%BeginData: 152 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
begin
10550,6 → 12061,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includetext false def % Enable/disable text
/validatecheck false def
10575,6 → 12087,8
/textyoffset textyoffset cvr def
/height height cvr def
 
/planet //loadctx exec
 
/barlen barcode length validatecheck {1 sub} if def
 
% Validate the input
10587,9 → 12101,18
} if
} forall
 
{
% Create a string of the available characters
/barchars (0123456789) def
 
% Create an array containing the character mappings
/encs
[ (22555) (55522) (55252) (55225) (52552)
(52525) (52255) (25552) (25525) (25255)
(5) (5)
] def
} ctxdef
 
% Calculate the checksum
/checksum 0 def
0 1 barlen 1 sub {
10604,13 → 12127,6
/barcode barcode 0 barlen getinterval def
} if
 
% Create an array containing the character mappings
/encs
[ (22555) (55522) (55252) (55225) (52552)
(52525) (52255) (25552) (25525) (25255)
(5) (5)
] def
 
/bhs barlen 5 mul 7 add array def
/txt barlen 1 add array def
 
10673,6 → 12189,8
 
dontdraw not //renlinear if
 
//unloadctx exec
 
end
 
}
10686,15 → 12204,17
% --END ENCODER planet--
 
% --BEGIN ENCODER royalmail--
% --REQUIRES preamble raiseerror renlinear--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear--
% --DESC: Royal Mail 4 State Customer Code
% --EXAM: LE28HS9Z
% --EXOP: includetext barcolor=FF0000
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp royalmail 0.0 2021092800 61861 61521
%%BeginData: 147 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp royalmail 0.0 2022072900 71499 67703
%%BeginData: 156 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
begin
10705,6 → 12225,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includetext false def % Enable/disable text
/validatecheck false def
10730,11 → 12251,26
/textyoffset textyoffset cvr def
/height height cvr def
 
/royalmail //loadctx exec
 
{
% Create a string of the available characters
/barchars (ZUVWXY501234B6789AHCDEFGNIJKLMTOPQRS) def
/charvals 36 dict def
0 1 35 {charvals exch dup barchars exch 1 getinterval exch put} for
 
% 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)
(2) (3)
] def
} ctxdef
 
% Validate the input
0 1 barcode length 1 sub {
barcode exch 1 getinterval charvals exch known not {
10760,17 → 12296,6
/barcode barcode 0 barlen getinterval def
} if
 
% 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)
(2) (3)
] def
 
/encstr barlen 4 mul 6 add string def
/txt barlen 1 add array def
 
10832,6 → 12357,8
 
dontdraw not //renlinear if
 
//unloadctx exec
 
end
 
}
10845,15 → 12372,17
% --END ENCODER royalmail--
 
% --BEGIN ENCODER auspost--
% --REQUIRES preamble raiseerror renlinear--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear--
% --DESC: AusPost 4 State Customer Code
% --EXAM: 5956439111ABA 9
% --EXOP: includetext custinfoenc=character
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp auspost 0.0 2021092800 72673 72415
%%BeginData: 204 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp auspost 0.0 2022072900 82286 78581
%%BeginData: 213 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
begin
10864,6 → 12393,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includetext false def % Enable/disable text
/textfont /Courier def
10888,7 → 12418,10
/textyoffset textyoffset cvr def
/height height cvr def
 
/ausport //loadctx exec
 
% Create an array containing the character mappings
{
/encs
[ (000) (001) (002) (010) (011) (012) (020) (021)
(022) (100) (101) (102) (110) (111) (112) (120)
10904,6 → 12437,7
 
% Create a string of the available characters
/barchars (ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz #) def
} ctxdef
 
/barlen barcode length def
barcode 0 2 getinterval (11) eq {37} if
11048,6 → 12582,8
 
dontdraw not //renlinear if
 
//unloadctx exec
 
end
 
}
11061,15 → 12597,17
% --END ENCODER auspost--
 
% --BEGIN ENCODER kix--
% --REQUIRES preamble raiseerror renlinear--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear--
% --DESC: Royal Dutch TPG Post KIX
% --EXAM: 1231FZ13XHS
% --EXOP: includetext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp kix 0.0 2021092800 57107 57044
%%BeginData: 113 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp kix 0.0 2022072900 66625 62978
%%BeginData: 122 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
begin
11080,6 → 12618,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includetext false def % Enable/disable text
/textfont /Courier def
11103,6 → 12642,9
/textyoffset textyoffset cvr def
/height height cvr def
 
/kix //loadctx exec
 
{
% Create an array containing the character mappings
/encs
[ (0033) (0123) (0132) (1023) (1032) (1122)
11117,6 → 12659,7
/barchars (0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ) def
/charvals 36 dict def
0 1 35 {charvals exch dup barchars exch 1 getinterval exch put} for
} ctxdef
 
% Validate the input
0 1 barcode length 1 sub {
11173,6 → 12716,8
 
dontdraw not //renlinear if
 
//unloadctx exec
 
end
 
}
11186,15 → 12731,17
% --END ENCODER kix--
 
% --BEGIN ENCODER japanpost--
% --REQUIRES preamble raiseerror renlinear--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear--
% --DESC: Japan Post 4 State Customer Code
% --EXAM: 6540123789-A-K-Z
% --EXOP: includetext includecheckintext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp japanpost 0.0 2021092800 62022 61757
%%BeginData: 164 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp japanpost 0.0 2022072900 71644 67819
%%BeginData: 174 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
begin
11205,6 → 12752,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includetext false def % Enable/disable text
/includecheckintext false def
11229,6 → 12777,11
/textyoffset textyoffset cvr def
/height height cvr def
 
/barlen barcode length def
 
/japanpost //loadctx exec
 
{
% Create an array containing the character mappings
% 0123456789- C1C2C3C4C5C6C7C8 ST EN
/encs
11239,7 → 12792,7
 
% Create a string of the available characters
/barchars (0123456789-ABCDEFGHIJKLMNOPQRSTUVWXYZ) def
/barlen barcode length def
} ctxdef
 
/encstr 20 1 add 3 mul 4 add string def
/digits 20 array def
11349,6 → 12902,8
 
dontdraw not //renlinear if
 
//unloadctx exec
 
end
 
}
11362,15 → 12917,17
% --END ENCODER japanpost--
 
% --BEGIN ENCODER msi--
% --REQUIRES preamble raiseerror renlinear--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear--
% --DESC: MSI Modified Plessey
% --EXAM: 0123456789
% --EXOP: includetext includecheck includecheckintext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp msi 0.0 2021092800 67297 66798
%%BeginData: 141 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp msi 0.0 2022072900 76359 72660
%%BeginData: 150 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
begin
11381,6 → 12938,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includecheck false def % Enable/disable checkdigit
/includetext false def % Enable/disable text
11408,6 → 12966,9
/textyoffset textyoffset cvr def
/height height cvr def
 
/msi //loadctx exec
 
{
% Create an array containing the character mappings
/encs
[ (12121212) (12121221) (12122112) (12122121) (12211212)
11417,6 → 12978,7
 
% Create a string of the available characters
/barchars (0123456789) def
} ctxdef
 
/barlen barcode length def % Length of the code
/txtlen barlen def
11428,7 → 12990,7
0 0 code {48 sub add exch} forall exch pop add
10 mod 10 exch sub 10 mod
code length 1 add string dup 0 code putinterval dup code length 4 -1 roll 48 add put
} bind def
} def
 
/mod11 {
/code exch def
11440,7 → 13002,7
} {
code length 1 add string dup 0 code putinterval dup code length 4 -1 roll 48 add put
} ifelse
} bind def
} def
 
/ncrmod11 {
/code exch def
11452,7 → 13014,7
} {
code length 1 add string dup 0 code putinterval dup code length 4 -1 roll 48 add put
} ifelse
} bind def
} def
 
% Calculate checksum
includecheck {
11502,6 → 13064,8
 
dontdraw not //renlinear if
 
//unloadctx exec
 
end
 
}
11515,15 → 13079,17
% --END ENCODER msi--
 
% --BEGIN ENCODER plessey--
% --REQUIRES preamble raiseerror renlinear--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear--
% --DESC: Plessey UK
% --EXAM: 01234ABCD
% --EXOP: includetext includecheckintext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp plessey 0.0 2021092800 63687 63197
%%BeginData: 148 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp plessey 0.0 2022072900 73093 69275
%%BeginData: 157 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
begin
11534,6 → 13100,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includetext false def % Enable/disable text
/validatecheck false def
11560,11 → 13127,24
/textyoffset textyoffset cvr def
/height height cvr def
 
/plessey //loadctx exec
 
% Create a string of the available characters
{
/barchars (0123456789ABCDEF) def
/charvals 16 dict def
0 1 15 {charvals exch dup barchars exch 1 getinterval exch put} for
 
% Create an array containing the character mappings
/encs
[ (14141414) (32141414) (14321414) (32321414)
(14143214) (32143214) (14323214) (32323214)
(14141432) (32141432) (14321432) (32321432)
(14143232) (32143232) (14323232) (32323232)
(32321432) (541412323) (323)
] def
} ctxdef
 
% Validate the input
0 1 barcode length 1 sub {
barcode exch 1 getinterval charvals exch known not {
11612,15 → 13192,6
/barcode barcode 0 barlen getinterval def
} if
 
% Create an array containing the character mappings
/encs
[ (14141414) (32141414) (14321414) (32321414)
(14143214) (32143214) (14323214) (32323214)
(14141432) (32141432) (14321432) (32321432)
(14143232) (32143232) (14323232) (32323232)
(32321432) (541412323) (323)
] def
 
/sbs barlen 8 mul unidirectional {27} {33} ifelse add string def
/txt barlen 2 add array def
 
11662,6 → 13233,8
 
dontdraw not //renlinear if
 
//unloadctx exec
 
end
 
}
11675,15 → 13248,17
% --END ENCODER plessey--
 
% --BEGIN ENCODER telepen--
% --REQUIRES preamble raiseerror parseinput renlinear--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renlinear--
% --DESC: Telepen
% --EXAM: ABCDEF
% --EXOP: includetext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp telepen 0.0 2021092800 65612 65365
%%BeginData: 165 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp telepen 0.0 2022072900 71738 74891
%%BeginData: 174 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
11695,6 → 13270,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/numeric false def
/dontdraw false def
/includetext false def % Enable/disable text
11720,6 → 13296,8
/textyoffset textyoffset cvr def
/height height cvr def
 
/telepen //loadctx exec
 
% Parse ordinals of the form ^NNN to ASCII
/fncvals <<
/parse parse
11731,6 → 13309,7
options (parse) undef
 
% Create an array containing the character mappings
{
/encs
[ (31313131) (1131313111) (33313111) (1111313131)
(3111313111) (11333131) (13133131) (111111313111)
11765,6 → 13344,7
(3113111113) (11311111111111) (331111111111) (111113111113)
(31111111111111) (111311111113) (131111111113) (1111111111111111)
] def
} ctxdef
 
/barlen barcode length def % Length of the code
/sbs barlen 16 mul 48 add string def
11839,6 → 13419,8
 
dontdraw not //renlinear if
 
//unloadctx exec
 
end
 
}
11852,15 → 13434,15
% --END ENCODER telepen--
 
% --BEGIN ENCODER telepennumeric--
% --REQUIRES preamble raiseerror parseinput renlinear telepen--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renlinear telepen--
% --DESC: Telepen Numeric
% --EXAM: 01234567
% --EXOP: includetext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp telepennumeric 0.0 2021092800 54465 57771
%%BeginData: 57 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp telepennumeric 0.0 2022072900 63543 63521
%%BeginData: 58 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /telepen dup /uk.co.terryburton.bwipp findresource put
11872,6 → 13454,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includetext false def % Enable/disable text
/textfont /Courier def
11897,7 → 13480,7
/textyoffset textyoffset cvr def
/height height cvr def
 
% Get the result of encoding with code2of5 with version=industrial
% Get the result of encoding with telepen with numeric=true
options (dontdraw) true put
options (numeric) true put
 
11921,15 → 13504,17
% --END ENCODER telepennumeric--
 
% --BEGIN ENCODER posicode--
% --REQUIRES preamble raiseerror parseinput renlinear--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renlinear--
% --DESC: PosiCode
% --EXAM: ABC123
% --EXOP: version=b inkspread=-0.5 parsefnc includetext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp posicode 0.0 2021092800 107308 106674
%%BeginData: 390 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp posicode 0.0 2022072900 113401 116320
%%BeginData: 399 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
11941,6 → 13526,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includetext false def % Enable/disable text
/textfont /Courier def
11975,6 → 13561,9
/checkoffset checkoffset cvi def
/height height cvr def
 
/posicode //loadctx exec
 
{
% Special function characters
/la0 -1 def /la1 -2 def /la2 -3 def
/sf0 -4 def /sf1 -5 def /sf2 -6 def
11981,9 → 13570,7
/fn1 -7 def /fn2 -8 def /fn3 -9 def /fn4 -10 def
 
% Character maps for each state
<<
/normal
[
/charmapsnormal [
% 0 1 2 0 1 2 0 1 2
[ (0) (^) (') ] [ (1) (;) 27 ] [ (2) (<) 28 ] % 0-2
[ (3) (=) 29 ] [ (4) (>) 30 ] [ (5) (?) 31 ] % 3-5
12001,9 → 13588,8
[ ($) ({) (*) ] [ (/) (|) (,) ] [ (+) (}) (:) ] % 39-41
[ (%) (~) fn1 ] [ la1 la0 fn2 ] [ sf1 sf0 fn3 ] % 42-44
[ sf2 sf2 fn4 ] % 45
]
/limited
[
] def
/chapmapslimited [
[ (0) -98 -98 ] [ (1) -98 -98 ] [ (2) -98 -98 ] % 0-2
[ (3) -98 -98 ] [ (4) -98 -98 ] [ (5) -98 -98 ] % 3-5
[ (6) -98 -98 ] [ (7) -98 -98 ] [ (8) -98 -98 ] % 6-8
12017,11 → 13603,11
[ (U) -98 -98 ] [ (V) -98 -98 ] [ (W) -98 -98 ] % 30-32
[ (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
/charmaps exch def
] def
} ctxdef
 
/charmaps version (a) eq version (b) eq or {charmapsnormal} {chapmapslimited} ifelse def
 
% Invert charmaps to give character to value maps for each state
/charvals [
charmaps length dict charmaps length dict charmaps length dict
12171,7 → 13757,8
} if % auto encoding
 
% Create an array containing the character mappings
<< % ";"=11, "<"=12
{
/encmaps << % ";"=11, "<"=12
/a
[ (141112) (131212) (121312) (111412) (131113)
(121213) (111313) (121114) (111214) (111115)
12216,9 → 13803,11
(131415) (121515) (141216) (131316) (121416)
(131217) (121317) (121218) (141212) (1)
]
>>
version get /encs exch def
>> def
} ctxdef
encmaps version get /encs exch def
 
{
/c2w [
[ 495 330 210 126 70 35 15 5 ]
[ 165 120 84 56 35 20 10 4 ]
12226,6 → 13815,7
[ 9 8 7 6 5 4 3 2 ]
[ 1 1 1 1 1 1 1 1 ]
] def
} ctxdef
/v 0 def
cws {
/cw exch def
12310,6 → 13900,8
 
dontdraw not //renlinear if
 
//unloadctx exec
 
end
 
}
12323,15 → 13915,17
% --END ENCODER posicode--
 
% --BEGIN ENCODER codablockf--
% --REQUIRES preamble raiseerror parseinput renmatrix--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix--
% --DESC: Codablock F
% --EXAM: CODABLOCK F 34567890123456789010040digit
% --EXOP: columns=8
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp codablockf 0.0 2021092800 128719 128096
%%BeginData: 488 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp codablockf 0.0 2022072900 134317 137326
%%BeginData: 499 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
12343,6 → 13937,7
/options exch def
/barcode exch def
 
/ctx null def
/dontdraw false def
/rows -1 def
/columns 8 def
12370,6 → 13965,8
/c columns 4 ge columns 62 le and {columns} {8} ifelse def
/rows rows 2 ge rows 44 le and {rows} {-1} ifelse def
 
/codablockf //loadctx exec
 
% 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
12397,6 → 13994,7
/msglen msg length def
 
% Character maps for each state
{
/charmaps [
% A B C A B C A B C
[ 32 32 (00) ] [ (!) (!) (01) ] [ (") (") (02) ] % 0-2
12450,6 → 14048,7
/seta charvals 0 get def
/setb charvals 1 get def
/setc charvals 2 get def
} ctxdef
 
% Determine digit runlength and characters from given position
/numsscr {
12467,17 → 14066,17
/p p 1 add def
} loop
n s
} bind def
} def
 
% Encoding for each alphabet
/enca {
seta exch get cws exch j exch put
/j j 1 add def
} bind def
} def
/encb {
setb exch get cws exch j exch put
/j j 1 add def
} bind def
} def
/encc {
dup type /arraytype ne {
setc exch get
12486,11 → 14085,11
} ifelse
cws exch j exch put
/j j 1 add def
} bind def
} def
 
% Character exclusively in either alphabet A or B
/anotb {dup seta exch known exch setb exch known not and} bind def
/bnota {dup setb exch known exch seta exch known not and} bind def
/anotb {dup seta exch known exch setb exch known not and} def
/bnota {dup setb exch known exch seta exch known not and} def
 
% Pre-compute relative position of next anotb and next bnota characters
/nextanotb [ msg length {0} repeat 9999 ] def
12510,8 → 14109,8
} for
 
% 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
/abeforeb {dup nextanotb exch get exch nextbnota exch get lt} def
/bbeforea {dup nextbnota exch get exch nextanotb exch get lt} def
 
% Add padding to row
/padrow {
12522,7 → 14121,7
cset (setc) eq {swb encc /cset (setb) def exit} if
} loop
} repeat
} bind def
} def
 
% Convert message to codewords
/cws c 5 add 44 mul array def
12747,6 → 14346,7
} for
 
% Create an array containing the character mappings
{
/encs
[ (212222) (222122) (222221) (121223) (121322) (131222) (122213)
(122312) (132212) (221213) (221312) (231212) (112232) (122132)
12764,6 → 14364,7
(412121) (111143) (111341) (131141) (114113) (114311) (411113)
(411311) (113141) (114131) (311141) (411131) (211412) (2331112)
] def
} ctxdef
 
% Derive the bits for each row
/rowbits r array def
12810,6 → 14411,8
 
dontdraw not //renmatrix if
 
//unloadctx exec
 
end
 
}
12823,15 → 14426,17
% --END ENCODER codablockf--
 
% --BEGIN ENCODER code16k--
% --REQUIRES preamble raiseerror parseinput renmatrix--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix--
% --DESC: Code 16K
% --EXAM: Abcd-1234567890-wxyZ
% --EXOP:
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp code16k 0.0 2021092800 153345 152816
%%BeginData: 711 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp code16k 0.0 2022072900 158879 165054
%%BeginData: 725 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
12843,6 → 14448,7
/options exch def
/barcode exch def
 
/ctx null def
/dontdraw false def
/mode -1 def
/pos -1 def
12871,9 → 14477,12
/rowheight rowheight cvi def
/sepheight sepheight cvi def
 
/code16k //loadctx exec
 
pos -1 ne {/rows 16 def} if
 
% 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
12935,6 → 14544,7
/seta charvals 0 get def
/setb charvals 1 get def
/setc charvals 2 get def
} ctxdef
 
raw {/encoding (raw) def} if
 
13016,17 → 14626,17
/p p 1 add def
} loop
n s
} bind def
} def
 
% Encoding for each alphabet
/enca {
seta exch get cws exch j exch put
/j j 1 add def
} bind def
} def
/encb {
setb exch get cws exch j exch put
/j j 1 add def
} bind def
} def
/encc {
dup type /arraytype ne {
setc exch get
13035,11 → 14645,11
} ifelse
cws exch j exch put
/j j 1 add def
} bind def
} def
 
% Character exclusively in either alphabet A or B
/anotb {dup seta exch known exch setb exch known not and} bind def
/bnota {dup setb exch known exch seta exch known not and} bind def
/anotb {dup seta exch known exch setb exch known not and} def
/bnota {dup setb exch known exch seta exch known not and} def
 
% Pre-compute relative position of next anotb and next bnota characters
/nextanotb [ msg length {0} repeat 9999 ] def
13059,8 → 14669,8
} for
 
% 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
/abeforeb {dup nextanotb exch get exch nextbnota exch get lt} def
/bbeforea {dup nextbnota exch get exch nextanotb exch get lt} def
 
/cws barcode length 2 mul 3 add array def
 
13404,6 → 15014,7
 
% Basic metrics for the each symbol
% r dcws
{
/metrics [
[ 2 7 ]
[ 3 12 ]
13421,6 → 15032,7
[ 15 72 ]
[ 16 77 ]
] def
} ctxdef
 
% Select metrics of an appropriate symbol
/urows rows def
13450,6 → 15062,7
/cws [ cws aload pop c1 c2 ] def
 
% Create an array containing the character mappings
{
/encs
[ (212222) (222122) (222221) (121223) (121322) (131222) (122213)
(122312) (132212) (221213) (221312) (231212) (112232) (122132)
13482,6 → 15095,8
(2122) (1411) (1132) (1231) (1114) (3112) (1132) (1231)
(1114) (3112) (3211) (2221) (2122) (1411) (3211) (2221)
] def
} ctxdef
 
pos -1 eq pos 10 idiv 2 mod 1 eq or {
/stopencs stopencsodd def
} {
13533,6 → 15148,8
 
dontdraw not //renmatrix if
 
//unloadctx exec
 
end
 
}
13546,15 → 15163,17
% --END ENCODER code16k--
 
% --BEGIN ENCODER code49--
% --REQUIRES preamble raiseerror parseinput renmatrix--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix--
% --DESC: Code 49
% --EXAM: MULTIPLE ROWS IN CODE 49
% --EXOP:
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp code49 0.0 2021092800 255438 268416
%%BeginData: 1042 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp code49 0.0 2022072900 261572 278054
%%BeginData: 1063 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
13566,6 → 15185,7
/options exch def
/barcode exch def
 
/ctx null def
/dontdraw false def
/mode -1 def
/pos -1 def
13592,8 → 15212,13
/rowheight rowheight cvi def
/sepheight sepheight cvi def
 
% Parse the input
/code49 //loadctx exec
 
{
/s1 -1 def /s2 -2 def /fn1 -3 def /fn2 -4 def /fn3 -5 def /ns -6 def
} ctxdef
 
% Parse the input
/fncvals <<
/parse parse
/parsefnc parsefnc
13604,6 → 15229,7
/msg barcode fncvals //parseinput exec def
/msglen msg length def
 
{
% Character encodings
/charmap [
(0) (1) (2) (3) (4) (5) (6) (7) (8) (9)
13643,6 → 15269,7
charvals i [ charvals s2 get charvals c2 get ] put
} if
} for
} ctxdef
 
/encodealpha {
charvals exch get
13649,7 → 15276,7
dup type /arraytype ne {1 array astore} if
dup cws exch j exch putinterval
length j add /j exch def
} bind def
} def
 
/base48 {
0 exch {48 sub exch 10 mul add} forall
13657,7 → 15284,7
[ exch dup length 1 sub -1 0 {1 index exch get exch} for pop ]
dup cws exch j exch putinterval
length j add /j exch def
} bind def
} def
 
/encodenumeric {
/nums exch def
13672,7 → 15299,7
3 [49 48 nums 0 4 getinterval aload pop] base48
2 nums 4 3 getinterval base48
} if
} bind def
} def
 
% Pre-compute alphanumeric and numeric runlengths
/numericruns [ msglen {0} repeat 0 ] def
13701,20 → 15328,23
/cws msglen 2 mul 1 add array def
/method (alpha) def /i -1 def /j -1 def
 
{
/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
19 29 39 49 59 69 79 89 99
] def
} ctxdef
 
% Handle start for each mode
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 [
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
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
/method (alpha) def /i 0 def /j 1 def
} if
13753,6 → 15383,7
 
% Basic metrics for the each symbol
% r dcws
{
/metrics [
[ 2 9 ]
[ 3 16 ]
13762,6 → 15393,7
[ 7 42 ]
[ 8 49 ]
] def
} ctxdef
 
% Select metrics of an appropriate symbol
/urows rows def
13799,11 → 15431,13
ccs ccs length 2 sub cr7 put
 
% Calculate the symbol check characters
{
[ 1 9 31 26 2 12 17 23 37 18 22 6 27 44 15 43 39
11 13 5 41 33 36 8 4 32 3 19 40 25 29 10 24 30 ]
dup [ exch 20 exch 0 32 getinterval aload pop ] /weightx exch def
dup [ exch 16 exch 1 32 getinterval aload pop ] /weighty exch def
[ exch 38 exch 2 32 getinterval aload pop ] /weightz exch def
} ctxdef
/calccheck {
/weights exch def
/score 0 def
13813,7 → 15447,7
weights i 1 add get mul /score exch score add def
} for
score
} bind def
} def
/lastrow ccs ccs length 8 sub 8 getinterval def
 
% wr1 check character
13843,6 → 15477,7
ccs ccs length 8 sub 7 getinterval 0 exch {add} forall 49 mod
ccs ccs length 1 sub 3 -1 roll put
 
{
/patterns [
[ % Even parity
(11521132) (25112131) (14212132) (25121221) (14221222) (12412132) (23321221)
14538,6 → 16173,7
/parity [
(1001) (0101) (1100) (0011) (1010) (0110) (1111) (0000)
] def
} ctxdef
 
% Derive the bits for each row
/rowbits r array def
14587,6 → 16223,8
 
dontdraw not //renmatrix if
 
//unloadctx exec
 
end
 
}
14600,15 → 16238,17
% --END ENCODER code49--
 
% --BEGIN ENCODER channelcode--
% --REQUIRES preamble raiseerror renlinear--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear--
% --DESC: Channel Code
% --EXAM: 3493
% --EXOP: height=0.5 includetext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp channelcode 0.0 2021092800 125552 124333
%%BeginData: 250 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp channelcode 0.0 2022072900 133046 128171
%%BeginData: 262 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
begin
14619,6 → 16259,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/shortfinder false def
/includetext false def
14638,6 → 16279,8
 
/height height cvr def
 
/channelcode //loadctx exec
 
% Validate the input
barcode length 2 lt barcode length 7 gt or {
/bwipp.channelcodeBadLength (Channel Code must be 2 to 7 digits) //raiseerror exec
14653,27 → 16296,27
 
% Tail-call optimisation FTW!
/loops1 { /s2max s1max 1 add s1 sub def /b1 1 def
s1 1 eq {nextb1} {loopb1} ifelse } bind def
/loopb1 { /b2max b1max 1 add b1 sub def /s2 1 def loops2 } bind def
s1 1 eq {nextb1} {loopb1} ifelse } def
/loopb1 { /b2max b1max 1 add b1 sub def /s2 1 def loops2 } def
/loops2 { /s3max s2max 1 add s2 sub def /b2 1 def
s1 b1 add s2 add 3 eq {nextb2} {loopb2} ifelse } bind def
/loopb2 { /b3max b2max 1 add b2 sub def /s3 1 def loops3 } bind def
s1 b1 add s2 add 3 eq {nextb2} {loopb2} ifelse } def
/loopb2 { /b3max b2max 1 add b2 sub def /s3 1 def loops3 } def
/loops3 { /s4max s3max 1 add s3 sub def /b3 1 def
b1 s2 add b2 add s3 add 4 eq {nextb3} {loopb3} ifelse } bind def
/loopb3 { /b4max b3max 1 add b3 sub def /s4 1 def loops4 } bind def
b1 s2 add b2 add s3 add 4 eq {nextb3} {loopb3} ifelse } def
/loopb3 { /b4max b3max 1 add b3 sub def /s4 1 def loops4 } def
/loops4 { /s5max s4max 1 add s4 sub def /b4 1 def
b2 s3 add b3 add s4 add 4 eq {nextb4} {loopb4} ifelse } bind def
/loopb4 { /b5max b4max 1 add b4 sub def /s5 1 def loops5 } bind def
b2 s3 add b3 add s4 add 4 eq {nextb4} {loopb4} ifelse } def
/loopb4 { /b5max b4max 1 add b4 sub def /s5 1 def loops5 } def
/loops5 { /s6max s5max 1 add s5 sub def /b5 1 def
b3 s4 add b4 add s5 add 4 eq {nextb5} {loopb5} ifelse } bind def
/loopb5 { /b6max b5max 1 add b5 sub def /s6 1 def loops6 } bind def
b3 s4 add b4 add s5 add 4 eq {nextb5} {loopb5} ifelse } def
/loopb5 { /b6max b5max 1 add b5 sub def /s6 1 def loops6 } def
/loops6 { /s7max s6max 1 add s6 sub def /b6 1 def
b4 s5 add b5 add s6 add 4 eq {nextb6} {loopb6} ifelse } bind def
/loopb6 { /b7max b6max 1 add b6 sub def /s7 1 def loops7 } bind def
b4 s5 add b5 add s6 add 4 eq {nextb6} {loopb6} ifelse } def
/loopb6 { /b7max b6max 1 add b6 sub def /s7 1 def loops7 } def
/loops7 { /s8 s7max 1 add s7 sub def /b7 1 def
b5 s6 add b6 add s7 add 4 eq {nextb7} {loopb7} ifelse } bind def
b5 s6 add b6 add s7 add 4 eq {nextb7} {loopb7} ifelse } def
/loopb7 { /b8 b7max 1 add b7 sub def
b6 s7 add b7 add s8 add b8 add 5 eq {nextb7} {chkchr} ifelse } bind def
b6 s7 add b7 add s8 add b8 add 5 eq {nextb7} {chkchr} ifelse } def
/chkchr {
value target eq {
[s1 b1 s2 b2 s3 b3 s4 b4 s5 b5 s6 b6 s7 b7 s8 b8] exit
14680,22 → 16323,23
} if
/value value 1 add def
nextb7
} bind def
/nextb7 { /b7 b7 1 add def b7 b7max le {loopb7} {nexts7} ifelse } bind def
/nexts7 { /s7 s7 1 add def s7 s7max le {loops7} {nextb6} ifelse } bind def
/nextb6 { /b6 b6 1 add def b6 b6max le {loopb6} {nexts6} ifelse } bind def
/nexts6 { /s6 s6 1 add def s6 s6max le {loops6} {nextb5} ifelse } bind def
/nextb5 { /b5 b5 1 add def b5 b5max le {loopb5} {nexts5} ifelse } bind def
/nexts5 { /s5 s5 1 add def s5 s5max le {loops5} {nextb4} ifelse } bind def
/nextb4 { /b4 b4 1 add def b4 b4max le {loopb4} {nexts4} ifelse } bind def
/nexts4 { /s4 s4 1 add def s4 s4max le {loops4} {nextb3} ifelse } bind def
/nextb3 { /b3 b3 1 add def b3 b3max le {loopb3} {nexts3} ifelse } bind def
/nexts3 { /s3 s3 1 add def s3 s3max le {loops3} {nextb2} ifelse } bind def
/nextb2 { /b2 b2 1 add def b2 b2max le {loopb2} {nexts2} ifelse } bind def
/nexts2 { /s2 s2 1 add def s2 s2max le {loops2} {nextb1} ifelse } bind def
/nextb1 { /b1 b1 1 add def b1 b1max le {loopb1} {nexts1} ifelse } bind def
/nexts1 { /s1 s1 1 add def s1 s1max le {loops1} if } bind def
} def
/nextb7 { /b7 b7 1 add def b7 b7max le {loopb7} {nexts7} ifelse } def
/nexts7 { /s7 s7 1 add def s7 s7max le {loops7} {nextb6} ifelse } def
/nextb6 { /b6 b6 1 add def b6 b6max le {loopb6} {nexts6} ifelse } def
/nexts6 { /s6 s6 1 add def s6 s6max le {loops6} {nextb5} ifelse } def
/nextb5 { /b5 b5 1 add def b5 b5max le {loopb5} {nexts5} ifelse } def
/nexts5 { /s5 s5 1 add def s5 s5max le {loops5} {nextb4} ifelse } def
/nextb4 { /b4 b4 1 add def b4 b4max le {loopb4} {nexts4} ifelse } def
/nexts4 { /s4 s4 1 add def s4 s4max le {loops4} {nextb3} ifelse } def
/nextb3 { /b3 b3 1 add def b3 b3max le {loopb3} {nexts3} ifelse } def
/nexts3 { /s3 s3 1 add def s3 s3max le {loops3} {nextb2} ifelse } def
/nextb2 { /b2 b2 1 add def b2 b2max le {loopb2} {nexts2} ifelse } def
/nexts2 { /s2 s2 1 add def s2 s2max le {loops2} {nextb1} ifelse } def
/nextb1 { /b1 b1 1 add def b1 b1max le {loopb1} {nexts1} ifelse } def
/nexts1 { /s1 s1 1 add def s1 s1max le {loops1} if } def
 
{
/memo [ % Accelerate generation of bar patterns
[ % CH3
[ 0 [1 1 1 1 1 2 1 2] [1 1 1 1 1 1 1 3] [1 1 1 1 1 3 2] [1 1 1 1 1 3 3] ]
14770,6 → 16414,7
[ 7650000 [5 2 1 2 1 2 1 1] [5 2 2 1 1 2 1 1] [8 4 3 3 2 2 1] [8 4 3 2 2 2 1] ]
]
] def
} ctxdef
 
/encode {
/chan exch def
14793,7 → 16438,7
 
1 {chkchr} repeat 8 chan sub 2 mul dup 16 exch sub getinterval
 
} bind def
} def
 
/barlen barcode length def
 
14804,9 → 16449,8
/data barcode cvi barlen 1 add encode def
 
% Determine check data
/check [] def
includecheck {
/mod23 [
{
/mod23map [
[] []
[ 13 12 4 9 3 1 ]
[ 8 2 12 3 18 16 4 1 ]
14814,7 → 16458,11
[ 1 4 16 18 3 12 2 8 9 13 6 1 ]
[ 20 16 22 13 15 12 5 4 17 9 21 3 7 1 ]
[ 2 6 18 8 1 3 9 4 12 13 16 2 6 18 8 1 ]
] barlen get def
] def
} ctxdef
/check [] def
includecheck {
/mod23 mod23map barlen get def
0
0 1 data length 1 sub {
dup data exch get 1 sub exch mod23 exch get mul add
14849,6 → 16497,8
 
dontdraw not //renlinear if
 
//unloadctx exec
 
end
 
}
14862,15 → 16512,17
% --END ENCODER channelcode--
 
% --BEGIN ENCODER flattermarken--
% --REQUIRES preamble raiseerror renlinear--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear--
% --DESC: Flattermarken
% --EXAM: 11099
% --EXOP: inkspread=-0.25 showborder borderleft=0 borderright=0
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp flattermarken 0.0 2021092800 53805 53752
%%BeginData: 95 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp flattermarken 0.0 2022072900 63323 59686
%%BeginData: 104 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
begin
14881,6 → 16533,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/includetext false def % Enable/disable text
/textfont /Courier def
14911,6 → 16564,8
/textyoffset textyoffset cvr def
/height height cvr def
 
/flattermarken //loadctx exec
 
% Validate the input
barcode {
dup 48 lt exch 57 gt or {
14918,6 → 16573,7
} if
} forall
 
{
% Create an array containing the character mappings
/encs
[ (0018) (0117) (0216) (0315) (0414) (0513) (0612) (0711) (0810)
14926,6 → 16582,7
 
% Create a string of the available characters
/barchars (1234567890) def
} ctxdef
 
/barlen barcode length def % Length of the code
 
14956,6 → 16613,8
 
dontdraw not //renlinear if
 
//unloadctx exec
 
end
 
}
14974,10 → 16633,10
% --EXAM: 331132131313411122131311333213114131131221323
% --EXOP: height=0.5
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp raw 0.0 2021092800 49511 49415
%%BeginData: 54 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp raw 0.0 2022072900 49590 49507
%%BeginData: 55 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
begin
14988,6 → 16647,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/height 1 def
 
15040,10 → 16700,10
% --EXAM: FATDAFTDAD
% --EXOP:
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp daft 0.0 2021092800 52789 52642
%%BeginData: 78 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp daft 0.0 2022072900 52828 52694
%%BeginData: 79 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
begin
15054,6 → 16714,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/height 0.175 def
 
15130,10 → 16791,10
% --EXAM: fima
% --EXOP: backgroundcolor=DD000011
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp symbol 0.0 2021092800 53469 53305
%%BeginData: 79 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp symbol 0.0 2022072900 53524 53245
%%BeginData: 80 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
begin
15144,6 → 16805,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
 
% Parse the input options
15216,15 → 16878,17
% --END ENCODER symbol--
 
% --BEGIN ENCODER pdf417--
% --REQUIRES preamble raiseerror parseinput renmatrix--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix--
% --DESC: PDF417
% --EXAM: This is PDF417
% --EXOP: columns=2
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp pdf417 0.0 2021092800 196554 198626
%%BeginData: 900 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp pdf417 0.0 2022072900 201920 207600
%%BeginData: 911 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
15236,6 → 16900,7
/options exch def
/barcode exch def
 
/ctx null def
/dontdraw false def
/compact false def
/eclevel -1 def
15264,6 → 16929,99
/rows rows cvi def
/rowmult rowmult cvr def
 
/pdf417 //loadctx exec
 
{
% 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
 
/latchcws <<
tl 900 bl 901 bl6 924 nl 902 bs 913
>> def
} ctxdef
 
raw {/encoding (raw) def} if
 
% Convert input into array of codewords
15316,7 → 17074,7
putinterval
} if
out
} bind def
} def
 
encoding (byte) eq encoding (ccc) eq or {
/barlen barcode length def
15338,91 → 17096,6
/msg barcode fncvals //parseinput exec def
/msglen msg length def
 
% 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 [ msglen {0} repeat 0 ] def
/numtext [ msglen {0} repeat 0 ] def
15501,21 → 17174,17
} ifelse } 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
/enca {charvals A get exch get} def
/encl {charvals L get exch get} def
/encm {charvals M get exch get} def
/encp {charvals P get exch get} def
/textencfuncs [ /enca /encl /encm /encp ] def
 
/addtotext {
text exch l exch put
/l l 1 add def
} bind def
} def
 
/enct {
/in exch def
15646,7 → 17315,7
 
out
 
} bind def
} def
 
/encn {
/in exch def
15680,7 → 17349,7
/out [ out aload pop cwn aload pop ] def
} for
out
} bind def
} def
 
/ence {
0 get neg 1000000 sub
15693,7 → 17362,7
} {
/bwipp.pdf417badECI (PDF417 supports ECIs 000000 to 811799) //raiseerror exec
} ifelse } ifelse } ifelse
} bind def
} def
 
/encfuncs [ /enct /encn /encb ] def
 
15700,7 → 17369,7
/addtocws {
dup datcws j 3 -1 roll putinterval
length j add /j exch def
} bind def
} def
 
% Encode the sequence
/state T def /submode A def
15784,7 → 17453,7
} {
pop pop 0
} ifelse
} bind def
} def
 
% Generate the coefficients
/coeffs [ 1 k {0} repeat ] def
15816,6 → 17485,7
options /debugcws known { /bwipp.debugcws cws //raiseerror exec } if
 
% Base 10 encoding of the bar space successions for the codewords in each cluster
{
/clusters [
[
120256 125680 128380 120032 125560 128318 108736 119920 108640 86080 108592 86048
16056,6 → 17726,7
67476 69556 67474 69554 116714
]
] def
} ctxdef
 
% Return the 17 bits for a codeword in a given cluster
/cwtobits {
16062,7 → 17733,7
clusters exch get exch get /v exch def
[ 17 {0} repeat v 2 17 string cvrs {48 sub} forall ]
dup length 17 sub 17 getinterval
} bind def
} def
 
% Populate bitmap for the image
compact {
16115,6 → 17786,8
 
dontdraw not //renmatrix if
 
//unloadctx exec
 
end
 
}
16128,15 → 17801,15
% --END ENCODER pdf417--
 
% --BEGIN ENCODER pdf417compact--
% --REQUIRES preamble raiseerror parseinput renmatrix pdf417--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix pdf417--
% --DESC: Compact PDF417
% --EXAM: This is compact PDF417
% --EXOP: columns=2
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp pdf417compact 0.0 2021092800 53355 56790
%%BeginData: 45 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp pdf417compact 0.0 2022072900 62537 62412
%%BeginData: 46 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
dup /pdf417 dup /uk.co.terryburton.bwipp findresource put
16148,6 → 17821,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
 
% Parse the input options
16185,15 → 17859,17
% --END ENCODER pdf417compact--
 
% --BEGIN ENCODER micropdf417--
% --REQUIRES preamble raiseerror parseinput renmatrix--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix--
% --DESC: MicroPDF417
% --EXAM: MicroPDF417
% --EXOP:
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp micropdf417 0.0 2021092800 207257 212591
%%BeginData: 982 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp micropdf417 0.0 2022072900 212812 225269
%%BeginData: 998 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
16205,6 → 17881,7
/options exch def
/barcode exch def
 
/ctx null def
/dontdraw false def
/version (unset) def
/columns 0 def
16238,6 → 17915,95
/rows rows cvi def
/rowmult rowmult cvr def
 
/micropdf417 //loadctx exec
 
{
% 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
} ctxdef
 
raw {/encoding (raw) def} if
cca {/encoding (cca) def} if
 
16291,7 → 18057,7
putinterval
} if
out
} bind def
} def
 
encoding (byte) eq encoding (ccb) eq or {
/barlen barcode length def
16313,91 → 18079,6
/msg barcode fncvals //parseinput exec def
/msglen msg length def
 
% 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 [ msglen {0} repeat 0 ] def
/numtext [ msglen {0} repeat 0 ] def
16481,16 → 18162,16
>> 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
/enca {charvals A get exch get} def
/encl {charvals L get exch get} def
/encm {charvals M get exch get} def
/encp {charvals P get exch get} def
/textencfuncs [ /enca /encl /encm /encp ] def
 
/addtotext {
text exch l exch put
/l l 1 add def
} bind def
} def
 
/enct {
 
16622,7 → 18303,7
 
out
 
} bind def
} def
 
/encn {
/in exch def
16656,7 → 18337,7
/out [ out aload pop cwn aload pop ] def
} for
out
} bind def
} def
 
/ence {
0 get neg 1000000 sub
16669,7 → 18350,7
} {
/bwipp.pdf417badECI (PDF417 supports ECIs 000000 to 811799) //raiseerror exec
} ifelse } ifelse } ifelse
} bind def
} def
 
/encfuncs [ /enct /encn /encb ] def
 
16676,7 → 18357,7
/addtocws {
dup datcws j 3 -1 roll putinterval
length j add /j exch def
} bind def
} def
 
% Encode the sequence
% No need to set state as seq will always begin with a latch, unlike for pdf417
16705,9 → 18386,32
/datcws datcws 0 j getinterval def
} if
 
{
% Basic metrics for the each symbol
% c r ecw rl rc rr
/metrics [
/ccametrics [
[ 2 5 4 39 0 19 ]
[ 2 6 4 1 0 33 ]
[ 2 7 5 32 0 12 ]
[ 2 8 5 8 0 40 ]
[ 2 9 6 14 0 46 ]
[ 2 10 6 43 0 23 ]
[ 2 12 7 20 0 52 ]
[ 3 4 4 11 43 23 ]
[ 3 5 5 1 33 13 ]
[ 3 6 6 5 37 17 ]
[ 3 7 7 15 47 27 ]
[ 3 8 7 21 1 33 ]
[ 4 3 4 40 20 52 ]
[ 4 4 5 43 23 3 ]
[ 4 5 6 46 26 6 ]
[ 4 6 7 34 14 46 ]
[ 4 7 8 29 9 41 ]
] def
 
% Basic metrics for the each symbol
% c r ecw rl rc rr
/nonccametrics [
[ 1 11 7 1 0 9 ]
[ 1 14 7 8 0 8 ]
[ 1 17 7 36 0 36 ]
16743,29 → 18447,9
[ 4 38 44 15 31 47 ]
[ 4 44 50 1 25 49 ]
] def
} ctxdef
 
% Basic metrics for the each symbol
% c r ecw rl rc rr
/ccametrics [
[ 2 5 4 39 0 19 ]
[ 2 6 4 1 0 33 ]
[ 2 7 5 32 0 12 ]
[ 2 8 5 8 0 40 ]
[ 2 9 6 14 0 46 ]
[ 2 10 6 43 0 23 ]
[ 2 12 7 20 0 52 ]
[ 3 4 4 11 43 23 ]
[ 3 5 5 1 33 13 ]
[ 3 6 6 5 37 17 ]
[ 3 7 7 15 47 27 ]
[ 3 8 7 21 1 33 ]
[ 4 3 4 40 20 52 ]
[ 4 4 5 43 23 3 ]
[ 4 5 6 46 26 6 ]
[ 4 6 7 34 14 46 ]
[ 4 7 8 29 9 41 ]
] def
cca {/metrics ccametrics def} if
/metrics cca {ccametrics} {nonccametrics} ifelse def
 
% Select metrics of an appropriate symbol
/urows rows def
16797,9 → 18481,11
cws n [ k {0} repeat 0 ] putinterval
 
% Calculate the log and anti-log tables
{
/rsalog [ 1 928 {dup 3 mul 929 mod} repeat ] def
/rslog 929 array def
1 1 928 {dup rsalog exch get exch rslog 3 1 roll put} for
} ctxdef
 
% Function to calculate the product in the field
/rsprod {
16808,7 → 18494,7
} {
pop pop 0
} ifelse
} bind def
} def
 
% Generate the coefficients
/coeffs [ 1 k {0} repeat ] def
16839,6 → 18525,7
 
options /debugcws known { /bwipp.debugcws cws //raiseerror exec } if
 
{
% Base 10 encoding of the bar space successions for the codewords in each cluster
/clusters [
[
17095,6 → 18782,7
654 652 668 664 696 688 656 720 592 600 604 732 734
]
] def
} ctxdef
 
% Return the 17 bits for a codeword in a given cluster
/cwtobits {
17101,7 → 18789,7
clusters exch get exch get /v exch def
[ 17 {0} repeat v 2 17 string cvrs {48 sub} forall ]
dup length 17 sub 17 getinterval
} bind def
} def
 
% Return the 10 bits for a row address pattern
/raptobits {
17108,7 → 18796,7
raps exch get exch get /v exch def
[ 10 {0} repeat v 2 10 string cvrs {48 sub} forall ]
dup length 10 sub 10 getinterval
} bind def
} def
 
% Populate bitmap for the image
/rwid [38 55 82 99] c 1 sub get def
17166,6 → 18854,8
 
dontdraw not //renmatrix if
 
//unloadctx exec
 
end
 
}
17179,15 → 18869,17
% --END ENCODER micropdf417--
 
% --BEGIN ENCODER datamatrix--
% --REQUIRES preamble raiseerror parseinput renmatrix--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix--
% --DESC: Data Matrix
% --EXAM: This is Data Matrix!
% --EXOP:
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp datamatrix 0.0 2021092800 208367 234349
%%BeginData: 920 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp datamatrix 0.0 2022072900 213397 242547
%%BeginData: 934 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
17199,6 → 18891,7
/options exch def
/barcode exch def
 
/ctx null def
/dontdraw false def
/columns 0 def
/rows 0 def
17235,6 → 18928,9
 
/isodmre dmre def
 
/datamatrix //loadctx exec
 
% TODO make this "static"
% Basic metrics for the each symbol
% rows cols regh regv rscw rsbl
/metrics [
17324,6 → 19020,119
} if
} for
 
{
% Special characters
/fnc1 -1 def /prog -2 def /m05 -3 def /m06 -4 def
/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
 
/A 0 def /C 1 def /T 2 def /X 3 def /E 4 def /B 5 def
} ctxdef
 
raw {/encoding (raw) def} if
 
encoding (raw) eq {
17341,12 → 19150,6
 
encoding (auto) eq {
 
% Special characters
/fnc1 -1 def /prog -2 def /m05 -3 def /m06 -4 def
/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
 
% Parse the input
/fncvals <<
/parse parse
17379,109 → 19182,6
} if
/msglen msg length 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
17507,17 → 19207,15
/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
/isD {char 48 ge char 57 le and} def
/isC {CNvals char known} def
/isT {TNvals char known} def
/isX {Xvals char known} def
/isE {Evals char known} def
/isEA {char 127 gt} def
/isFN {char 0 lt} def
/XtermFirst {dup nextXterm exch get exch nextNonX exch get lt} 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
17561,12 → 19259,12
/k k 1 add def
} loop
} repeat
} bind def
} def
 
/addtocws {
dup cws exch j exch putinterval
/j exch length j add def
} bind def
} def
 
/ECItocws {
neg 1000000 sub
17585,7 → 19283,7
254 mod 1 add
3 array astore
} ifelse } ifelse
} bind def
} def
 
/encA {
1 { % Common exit
17610,7 → 19308,7
/i i 1 add def
exit
} repeat
} bind def
} def
 
/CTXvalstocws {
/in exch def
17620,7 → 19318,7
dup 256 idiv exch 256 mod
} for
counttomark array astore exch pop
} bind def
} def
 
/encCTX {
/p 0 def
17632,16 → 19330,18
i msglen eq {exit} if
encvals mode get msg i get known not {exit} if
p 3 mod 0 eq {
/newmode lookup def
newmode mode ne {
ctxvals 0 p getinterval CTXvalstocws addtocws
[unlcw] addtocws
newmode A ne {
Avals [-1 lC lT lX lE lB] newmode get get addtocws
p 0 gt {
/newmode lookup def
newmode mode ne {
ctxvals 0 p getinterval CTXvalstocws addtocws
[unlcw] addtocws
newmode A ne {
Avals [-1 lC lT lX lE lB] newmode get get addtocws
} if
/mode newmode def
/done true def
exit
} if
/mode newmode def
/done true def
exit
} if
msglen i sub 3 le { % Check end of data conditions
/remcws numremcws j p 3 idiv 2 mul add get def
17728,7 → 19428,7
} if
} if
 
} bind def
} def
 
/Evalstocws {
/in exch def
17744,7 → 19444,7
} for
counttomark array astore exch pop
0 outlen getinterval
} bind def
} def
 
/encE {
/p 0 def
17801,7 → 19501,7
} if
} if
 
} bind def
} def
 
/encB {
/p 0 def /bvals 1558 array def {
17828,7 → 19528,7
} for
bvals addtocws
/mode A def
} bind def
} def
 
% Derive the codewords
/cws 1558 array def
17899,9 → 19599,11
} for
 
% Calculate the log and anti-log tables
{
/rsalog [ 1 255 { dup 2 mul dup 256 ge {301 xor} if } repeat ] def
/rslog 256 array def
1 1 255 {dup rsalog exch get exch rslog 3 1 roll put} for
} ctxdef
 
% Function to calculate the product in the field
/rsprod {
17910,7 → 19612,7
} {
pop pop 0
} ifelse
} bind def
} def
 
% Generate the coefficients
/coeffs [ 1 rscw rsbl idiv {0} repeat ] def
17978,7 → 19680,7
exch mcols mul add
mmat exch 5 -1 roll put
} forall
} bind def
} def
 
% Placement patterns
/dmn [
18098,6 → 19800,8
 
dontdraw not //renmatrix if
 
//unloadctx exec
 
end
 
}
18111,15 → 19815,15
% --END ENCODER datamatrix--
 
% --BEGIN ENCODER datamatrixrectangular--
% --REQUIRES preamble raiseerror parseinput renmatrix datamatrix--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix datamatrix--
% --DESC: Data Matrix Rectangular
% --EXAM: 1234
% --EXOP:
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp datamatrixrectangular 0.0 2021092800 53411 56710
%%BeginData: 45 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp datamatrixrectangular 0.0 2022072900 62593 62460
%%BeginData: 46 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
dup /datamatrix dup /uk.co.terryburton.bwipp findresource put
18131,6 → 19835,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
 
% Parse the input options
18168,15 → 19873,15
% --END ENCODER datamatrixrectangular--
 
% --BEGIN ENCODER datamatrixrectangularextension--
% --REQUIRES preamble raiseerror parseinput renmatrix datamatrix--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix datamatrix--
% --DESC: Data Matrix Rectangular Extension
% --EXAM: 1234
% --EXOP: version=8x96
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp datamatrixrectangularextension 0.0 2021092800 54318 57584
%%BeginData: 55 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp datamatrixrectangularextension 0.0 2022072900 63780 63742
%%BeginData: 56 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
20 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
dup /datamatrix dup /uk.co.terryburton.bwipp findresource put
18188,6 → 19893,7
/options exch def
/barcode exch def
 
/ctx null def
/dontdraw false def
 
/dmre false def
18235,15 → 19941,15
% --END ENCODER datamatrixrectangularextension--
 
% --BEGIN ENCODER mailmark--
% --REQUIRES preamble raiseerror parseinput renmatrix datamatrix--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix datamatrix--
% --DESC: Royal Mail Mailmark
% --EXAM: JGB 012100123412345678AB19XY1A 0 www.xyz.com
% --EXOP: type=29
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp mailmark 0.0 2021092800 56791 60248
%%BeginData: 80 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp mailmark 0.0 2022072900 65973 66022
%%BeginData: 81 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
18256,6 → 19962,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/type (unset) def % 7, 9 or 29
/parse false def
/dontdraw false def
18327,15 → 20034,17
% --END ENCODER mailmark--
 
% --BEGIN ENCODER qrcode--
% --REQUIRES preamble raiseerror parseinput renmatrix--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix--
% --DESC: QR Code
% --EXAM: http://goo.gl/0bis
% --EXOP: eclevel=M
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp qrcode 0.0 2021092800 320203 358349
%%BeginData: 1306 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp qrcode 0.0 2022072900 327547 368583
%%BeginData: 1362 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
18347,6 → 20056,7
/options exch def
/barcode exch def
 
/ctx null def
/dontdraw false def
/format (unset) def % full or micro. rMQR symbols are specified using version
/version (unset) def % 1-40 or M1-M4 or R7x43, etc
18368,6 → 20078,8
 
/mask mask cvi def
 
/qrcode //loadctx exec
 
% If version is supplied and format is not given then set format to correspond
version (unset) ne {
format (unset) eq {
18404,6 → 20116,8
} if
} if
 
{ % context
 
% Enumerate vergrps
[
/v1to9 /v10to26 /v27to40
18436,15 → 20150,7
] {-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
% Binary exclusives calculated from "not others"
 
/Kexcl <<
[
18463,7 → 20169,7
[ (00) (01) (10) (11) -1 ] % vM3
[ (000) (001) (010) (011) -1 ] % vM4
32 {
[ (001) (010) (011) (100) -1 ] % rMQR
[ (001) (010) (011) (100) (111) ] % rMQR
} repeat
] def
 
18494,7 → 20200,7
[ 5 5 4 3 ] % vR13x27
[ 6 6 5 5 ] % vR13x43
[ 7 6 6 5 ] % vR13x59
[ 8 7 6 6 ] % vR13x77
[ 7 7 6 6 ] % vR13x77
[ 8 7 7 6 ] % vR13x99
[ 8 8 7 7 ] % vR13x139
[ 7 6 6 5 ] % vR15x43
18522,11 → 20228,7
} repeat
] 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
/padstrs [ (11101100) (00010001) ] def
 
% Alphanumeric character to value map
/charmap (0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:) def
18533,6 → 20235,14
/charvals 44 dict def
0 1 44 {dup charmap exch get exch charvals 3 1 roll put} for
 
} ctxdef
 
% 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
} def
 
/encA {
/in exch def
fnc1first { % FNC1 as %
18552,7 → 20262,7
length m add /m exch def
} loop
out 0 m getinterval
} bind def
} def
 
/encN {
/in exch def
18575,7 → 20285,7
length m add /m exch def
} loop
out 0 m getinterval
} bind def
} def
 
/encB {
/in exch def
18589,7 → 20299,7
out k 8 mul 3 -1 roll putinterval
} for
out
} bind def
} def
 
/encK {
/in exch def
18604,7 → 20314,7
/k k 2 add def
} loop
out
} bind def
} def
 
/encE {
0 get neg 1000000 sub
18615,7 → 20325,7
} { % ECI 016384 - 999999
2#110000000000000000000000 add 24 tobin
} ifelse } ifelse
} bind def
} def
 
/encfuncs [ /encN /encA /encB /encK /encE ] def
 
18622,7 → 20332,7
/addtobits {
dup bits j 3 -1 roll putinterval
length j add /j exch def
} bind def
} def
 
/numNs [ msglen {0} repeat 0 ] def
/numAs [ msglen {0} repeat 0 ] def
18632,7 → 20342,6
/nextBs [ msglen {0} repeat 9999 ] def
/nextAs [ msglen {0} repeat 9999 ] def
/nextKs [ msglen {0} repeat 9999 ] def
/numAN 0 def % Inclusive alphanumeric count (for rMQR only)
/isECI msglen array def
msglen 1 sub -1 0 {
/i exch def
18651,20 → 20360,12
Nexcl barchar known {
nextNs i 0 put
numNs i numNs i 1 add get 1 add put
/numAN numAN 1 add def
} {
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
/numAN numAN 1 add def
} {
nextAs i nextAs i 1 add get 1 add put
} ifelse
18677,19 → 20378,28
nextKs i 1 add nextKs i 1 add get 1 add put
} if
} for
msglen 1 sub -1 0 { % Finally scan backwards again to set numBs/nextBs from "not others"
/i exch def
numNs i get numAs i get numKs i get add add 0 eq isECI i get not and {
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
} for
 
/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
/KbeforeB {numK exch ver get ge nextBs numK 2 mul i add get 0 eq and} def
/KbeforeA {numK exch ver get ge nextAs numK 2 mul i add get 0 eq and} def
/KbeforeN {numK exch ver get ge nextNs numK 2 mul i add get 0 eq and} def
/KbeforeE {numK exch ver get ge numK 2 mul i add msglen eq and} def
/AbeforeK {numA exch ver get ge nextKs numA i add get 0 eq and} def
/AbeforeB {numA exch ver get ge nextBs numA i add get 0 eq and} def
/AbeforeN {numA exch ver get ge nextNs numA i add get 0 eq and} def
/AbeforeE {numA exch ver get ge numA i add msglen eq and} def
/NbeforeK {numN exch ver get ge nextKs numN i add get 0 eq and} def
/NbeforeB {numN exch ver get ge nextBs numN i add get 0 eq and} def
/NbeforeA {numN exch ver get ge nextAs numN i add get 0 eq and} def
/NbeforeE {numN exch ver get ge numN i add msglen eq and} def
 
% Elements of the encoded message have differing lengths based on the
% resulting symbol size. The symbol sizes with different element lengths
18698,29 → 20408,34
% on the format of symbol.
 
% Determine which groups we need to encode
{
/versetmap <<
% Full
0 1 9 { 10 2 string cvrs v1to9 } for
10 1 26 { 10 2 string cvrs v10to26 } for
27 1 40 { 10 2 string cvrs v27to40 } for
 
% Micro
(M1) vM1 (M2) vM2 (M3) vM3 (M4) vM4
 
% rMQR
(R7x43) vR7x43 (R7x59) vR7x59 (R7x77) vR7x77 (R7x99) vR7x99 (R7x139) vR7x139
(R9x43) vR9x43 (R9x59) vR9x59 (R9x77) vR9x77 (R9x99) vR9x99 (R9x139) vR9x139
(R11x27) vR11x27 (R11x43) vR11x43 (R11x59) vR11x59 (R11x77) vR11x77 (R11x99) vR11x99 (R11x139) vR11x139
(R13x27) vR13x27 (R13x43) vR13x43 (R13x59) vR13x59 (R13x77) vR13x77 (R13x99) vR13x99 (R13x139) vR13x139
(R15x43) vR15x43 (R15x59) vR15x59 (R15x77) vR15x77 (R15x99) vR15x99 (R15x139) vR15x139
(R17x43) vR17x43 (R17x59) vR17x59 (R17x77) vR17x77 (R17x99) vR17x99 (R17x139) vR17x139
>> def
/versetfull [v1to9 v10to26 v27to40] def
/versetmicro [vM1 vM2 vM3 vM4] def
} ctxdef
version (unset) ne {
% A specific version of symbol is given so encode in just the corresponding vergrp
/verset <<
% Full
0 1 9 { 10 2 string cvrs v1to9 } for
10 1 26 { 10 2 string cvrs v10to26 } for
27 1 40 { 10 2 string cvrs v27to40 } for
 
% Micro
(M1) vM1 (M2) vM2 (M3) vM3 (M4) vM4
 
% rMQR
(R7x43) vR7x43 (R7x59) vR7x59 (R7x77) vR7x77 (R7x99) vR7x99 (R7x139) vR7x139
(R9x43) vR9x43 (R9x59) vR9x59 (R9x77) vR9x77 (R9x99) vR9x99 (R9x139) vR9x139
(R11x27) vR11x27 (R11x43) vR11x43 (R11x59) vR11x59 (R11x77) vR11x77 (R11x99) vR11x99 (R11x139) vR11x139
(R13x27) vR13x27 (R13x43) vR13x43 (R13x59) vR13x59 (R13x77) vR13x77 (R13x99) vR13x99 (R13x139) vR13x139
(R15x43) vR15x43 (R15x59) vR15x59 (R15x77) vR15x77 (R15x99) vR15x99 (R15x139) vR15x139
(R17x43) vR17x43 (R17x59) vR17x59 (R17x77) vR17x77 (R17x99) vR17x99 (R17x139) vR17x139
>> version get [ exch ] def
/verset versetmap version get [ exch ] def
} {
% Just the format is specified so encode in each vergrp for the type of symbol
format (full) eq { /verset [v1to9 v10to26 v27to40] def } if
format (micro) eq { /verset [vM1 vM2 vM3 vM4] def } if
format (full) eq { /verset versetfull def } if
format (micro) eq { /verset versetmicro def } if
% rMQR symbols are accessed with an explicit version
} ifelse
 
18727,6 → 20442,36
% Encode unterminated bitstream for each compatible vergrp separately
/msgbits [ 39 {-1} repeat ] def
/e 10000 def
 
% Number of before characters per vergrp, depending on current mode, for optimising modes
% Generated by contrib/development/build-qr-mode-optim-arrs.php
% Full Micro R7 R9 R11 R13 R15 R17
{
/mode0forceKB [ 1 1 1 e e 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] def
/mode0forceA [ 1 1 1 e 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] def
 
/mode0NbeforeB [ 4 4 5 e e 2 3 2 2 3 3 3 2 3 3 3 3 2 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3] def
 
/modeBKbeforeB [ 9 12 13 e e 4 6 4 5 6 6 6 5 6 6 6 7 4 6 6 6 7 7 5 6 6 7 7 7 6 6 7 7 7 6 7 7 7 8] def
/modeBKbeforeA [ 8 10 11 e e 4 5 4 5 5 6 6 5 5 6 6 6 4 5 6 6 6 6 5 6 6 6 6 7 6 6 6 6 7 6 6 6 7 7] def
/modeBKbeforeN [ 8 9 11 e e 3 5 3 4 5 5 5 4 5 5 5 6 3 5 5 5 6 6 4 5 5 6 6 6 5 5 6 6 7 5 6 6 6 7] def
/modeBKbeforeE [ 5 5 6 e e 2 3 2 3 3 3 3 3 3 3 3 4 2 3 3 3 4 4 3 3 3 4 4 4 3 3 4 4 4 3 4 4 4 4] def
 
/modeBAbeforeK [11 12 14 e e 5 7 5 6 7 8 8 6 7 8 8 8 6 7 8 8 8 8 6 8 8 8 8 9 8 8 8 8 9 8 8 8 9 9] def
/modeBAbeforeB [11 15 16 e e 6 7 6 7 7 8 8 7 7 8 8 8 6 7 8 8 8 9 7 8 8 8 9 9 8 8 9 9 9 8 8 9 9 10] def
/modeBAbeforeN [12 13 15 e e 6 8 6 7 8 8 8 7 8 8 8 9 6 8 8 8 9 9 7 8 8 9 9 10 8 9 9 9 10 8 9 9 10 10] def
/modeBAbeforeE [ 6 7 8 e e 3 4 3 4 4 4 4 4 4 4 4 5 4 4 4 4 5 5 4 4 4 5 5 5 4 5 5 5 5 4 5 5 5 5] def
 
/modeBNbeforeK [ 6 7 8 e e 3 4 3 4 4 5 5 4 4 5 5 5 3 4 5 5 5 5 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5] def
/modeBNbeforeB [ 6 8 9 e e 3 4 3 4 4 5 5 4 4 5 5 5 3 4 5 5 5 5 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 6] def
/modeBNbeforeA [ 6 7 8 e e 3 4 3 4 4 5 5 4 4 5 5 5 4 4 5 5 5 5 4 5 5 5 5 5 5 5 5 5 6 5 5 5 5 6] def
/modeBNbeforeE [ 3 4 4 e e 2 3 2 2 3 3 3 2 3 3 3 3 2 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3] def
 
/modeANbeforeA [13 15 17 e 5 7 9 7 8 9 9 9 8 9 9 9 11 7 9 9 9 11 11 8 9 9 10 11 11 9 10 11 11 11 9 11 11 11 11] def
/modeANbeforeB [13 17 18 e e 7 9 7 8 9 9 9 8 9 9 9 10 7 9 9 9 10 11 8 9 9 9 11 11 9 9 11 11 11 9 10 11 11 11] def
/modeANbeforeE [ 7 8 9 e 3 4 5 4 5 5 5 5 5 5 5 5 6 4 5 5 5 6 6 5 5 5 5 6 6 5 5 6 6 6 5 6 6 6 6] def
} ctxdef
 
verset {
/ver exch def
 
18747,54 → 20492,51
ver vM2 eq eci and {/seq -1 def exit} if
ver vM3 eq eci and {/seq -1 def exit} if
ver vM4 eq eci and {/seq -1 def exit} if
ver vR7x43 ge eci and {/seq -1 def exit} if
{ % common exit
eci {
E exit
} if
ver vR7x43 ge { % TODO rMQR is all numeric/alphanumeric/Kanji/binary only for now
numN msglen eq {N} { numAN msglen eq {A} { numK 2 mul msglen eq {K} {B} ifelse } ifelse } ifelse exit
} if
mode -1 eq { % Set initial mode (or mode after ECI)
[ 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
mode0forceKB KbeforeA {K exit} if
mode0forceKB KbeforeN {K exit} if
modeBKbeforeE KbeforeB {K exit} if % Re-using modeB KbeforeE array
mode0forceKB 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] AbeforeN {A exit} if
[ 1 1 1 e 1 1 1] AbeforeE {A exit} if
modeBAbeforeE AbeforeK {A exit} if % Re-using modeB AbeforeE array
modeBAbeforeE AbeforeB {A exit} if % Re-using modeB AbeforeE array
mode0forceA AbeforeN {A exit} if
mode0forceA AbeforeE {A exit} if
numA 1 ge {
ver vM2 ne {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
mode0NbeforeB NbeforeB {N exit} if
mode0forceKB NbeforeB {B exit} if
modeANbeforeE NbeforeA {N exit} if % Re-using modeA NbeforeE array
mode0forceA 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
modeBKbeforeB KbeforeB {K exit} if
modeBKbeforeA KbeforeA {K exit} if
modeBKbeforeN KbeforeN {K exit} if
modeBKbeforeE KbeforeE {K exit} if
modeBAbeforeK AbeforeK {A exit} if
modeBAbeforeB AbeforeB {A exit} if
modeBAbeforeN AbeforeN {A exit} if
modeBAbeforeE AbeforeE {A exit} if
modeBNbeforeK NbeforeK {N exit} if
modeBNbeforeB NbeforeB {N exit} if
modeBNbeforeA NbeforeA {N exit} if
modeBNbeforeE 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
modeANbeforeA NbeforeA {N exit} if
modeANbeforeB NbeforeB {N exit} if
modeANbeforeE NbeforeE {N exit} if
numA 1 ge numN 1 ge or {A exit} if
B exit
} if
18866,6 → 20608,7
} forall
 
% Lookup the most appropriate symbol specification
{
/metrics [
% format vers vergrp rows cols align modules error codewords error correction blocks
% L M Q H L1 L2 M1 M2 Q1 Q2 H1 H2
18946,6 → 20689,8
[ (rmqr) (R17x99) vR17x99 17 99 24 50 1283 [ 99 60 99 104 ] [ -1 -1 2 1 -1 -1 4 0 ] ]
[ (rmqr) (R17x139) vR17x139 17 139 28 56 1860 [ 99 80 99 156 ] [ -1 -1 4 0 -1 -1 2 4 ] ]
] def
} ctxdef
 
/eclval (LMQH) eclevel search pop length exch pop exch pop def
0 1 metrics length 1 sub {
/i exch def
18988,7 → 20733,7
} for
 
okay not {
/bwipp.qrcodeNoValidSymbol (No valid symbol available) //raiseerror exec
/bwipp.qrcodeNoValidSymbol (Maximum length exceeded or invalid content) //raiseerror exec
} if
 
/format frmt def
19008,7 → 20753,6
/pad dmod string def
0 1 pad length 1 sub {pad exch 48 put} for
pad 0 msgbits putinterval
/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
19036,9 → 20780,11
options /debugcws known { /bwipp.debugcws cws //raiseerror exec } if
 
% Calculate the log and anti-log tables
{
/rsalog [ 1 255 { dup 2 mul dup 256 ge {285 xor} if } repeat ] def
/rslog 256 array def
1 1 255 {dup rsalog exch get exch rslog 3 1 roll put} for
} ctxdef
 
% Function to calculate the product in the field
/rsprod {
19047,7 → 20793,7
} {
pop pop 0
} ifelse
} bind def
} def
 
% Generate the coefficients for the Reed-Solomon algorithm
/coeffs [ 1 ecpb {0} repeat ] def
19076,7 → 20822,7
} for
} for
rscws rsnd ecpb getinterval
} bind def
} def
 
% Divide codewords into two groups of blocks and calculate the error correction codewords
/dcwsb ecb1 ecb2 add array def
19137,7 → 20883,7
 
% Create the bitmap
/pixs [ rows cols mul {-1} repeat ] def
/qmv {cols mul add} bind def
/qmv {cols mul add} def
 
% Timing patterns
format (full) eq {
19175,6 → 20921,7
} if
 
% Finder patterns
{
/fpat [
[ 1 1 1 1 1 1 1 0 ]
[ 1 0 0 0 0 0 1 0 ]
19215,12 → 20962,14
[ 9 9 9 9 9 9 9 9 ]
[ 9 9 9 9 9 9 9 9 ]
] def
/fpats <<
/fpatmap <<
% TL TR BL BR
(full) [ fpat fpat fpat fnullpat ]
(micro) [ fpat fnullpat fnullpat fnullpat ]
(rmqr) [ fpat fcorpat fcorpat fsubpat ]
>> format get def
>> def
} ctxdef
/fpats fpatmap format get def
0 1 7 {
/y exch def
0 1 7 {
19237,6 → 20986,23
} for
 
% Alignment patterns
{
/algnpatfull [
[ 1 1 1 1 1 ]
[ 1 0 0 0 1 ]
[ 1 0 1 0 1 ]
[ 1 0 0 0 1 ]
[ 1 1 1 1 1 ]
] def
/algnpatrmqr [
[ 1 1 1 9 9 ]
[ 1 0 1 9 9 ]
[ 1 1 1 9 9 ]
[ 9 9 9 9 9 ]
[ 9 9 9 9 9 ]
] def
} ctxdef
 
/putalgnpat {
/py exch def
/px exch def
19250,15 → 21016,9
} if
} for
} for
} bind def
} def
format (full) eq {
/algnpat [
[ 1 1 1 1 1 ]
[ 1 0 0 0 1 ]
[ 1 0 1 0 1 ]
[ 1 0 0 0 1 ]
[ 1 1 1 1 1 ]
] def
/algnpat algnpatfull def
asp2 2 sub asp3 asp2 sub cols 13 sub {
/i exch def
i 4 putalgnpat
19273,13 → 21033,7
} for
} if
format (rmqr) eq {
/algnpat [
[ 1 1 1 9 9 ]
[ 1 0 1 9 9 ]
[ 1 1 1 9 9 ]
[ 9 9 9 9 9 ]
[ 9 9 9 9 9 ]
] def
/algnpat algnpatrmqr def
asp2 2 sub asp3 asp2 sub cols 13 sub {
/i exch def
i 0 putalgnpat
19288,6 → 21042,13
} if
 
% Format information modules
{
/formatmapmicro [
[ [ 1 8 ] ] [ [ 2 8 ] ] [ [ 3 8 ] ] [ [ 4 8 ] ] [ [ 5 8 ] ]
[ [ 6 8 ] ] [ [ 7 8 ] ] [ [ 8 8 ] ] [ [ 8 7 ] ] [ [ 8 6 ] ]
[ [ 8 5 ] ] [ [ 8 4 ] ] [ [ 8 3 ] ] [ [ 8 2 ] ] [ [ 8 1 ] ]
] def
} ctxdef
/formatmap <<
(full) [
[ [ 0 8 ] [ 8 cols 1 sub ] ] [ [ 1 8 ] [ 8 cols 2 sub ] ] [ [ 2 8 ] [ 8 cols 3 sub ] ]
19296,11 → 21057,7
[ [ 8 5 ] [ cols 6 sub 8 ] ] [ [ 8 4 ] [ cols 5 sub 8 ] ] [ [ 8 3 ] [ cols 4 sub 8 ] ]
[ [ 8 2 ] [ cols 3 sub 8 ] ] [ [ 8 1 ] [ cols 2 sub 8 ] ] [ [ 8 0 ] [ cols 1 sub 8 ] ]
]
(micro) [
[ [ 1 8 ] ] [ [ 2 8 ] ] [ [ 3 8 ] ] [ [ 4 8 ] ] [ [ 5 8 ] ]
[ [ 6 8 ] ] [ [ 7 8 ] ] [ [ 8 8 ] ] [ [ 8 7 ] ] [ [ 8 6 ] ]
[ [ 8 5 ] ] [ [ 8 4 ] ] [ [ 8 3 ] ] [ [ 8 2 ] ] [ [ 8 1 ] ]
]
(micro) formatmapmicro
(rmqr) [
[ [ 11 3 ] [ cols 3 sub rows 6 sub ] ] [ [ 11 2 ] [ cols 4 sub rows 6 sub ] ] [ [ 11 1 ] [ cols 5 sub rows 6 sub ] ]
[ [ 10 5 ] [ cols 6 sub rows 2 sub ] ] [ [ 10 4 ] [ cols 6 sub rows 3 sub ] ] [ [ 10 3 ] [ cols 6 sub rows 4 sub ] ]
19434,7 → 21191,7
} if
} for
scr1 scr3
} bind def
} def
 
% Evaluation algorithm for full symbols
/evalfull {
19490,7 → 21247,7
/n4 dark 100 mul cols dup mul div 50 sub abs 5 div cvi 10 mul def
 
n1 n2 add n3 add n4 add
} bind def
} def
 
% Evaluation algorithm for micro symbols
/evalmicro {
19506,7 → 21263,7
} {
dkbot 16 mul dkrhs add neg
} ifelse
} bind def
} def
 
% Evaluate the masked symbols to find the most suitable
/bestscore 999999999 def
19540,15 → 21297,43
} if
 
% Add the format information
{
/fmtvalsfull [
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#355f 16#3068 16#3f31 16#3a06 16#24b4 16#2183 16#2eda 16#2bed
] def
/fmtvalsmicro [
16#4445 16#4172 16#4e2b 16#4b1c 16#55ae 16#5099 16#5fc0 16#5af7
16#6793 16#62a4 16#6dfd 16#68ca 16#7678 16#734f 16#7c16 16#7921
16#06de 16#03e9 16#0cb0 16#0987 16#1735 16#1202 16#1d5b 16#186c
16#2508 16#203f 16#2f66 16#2a51 16#34e3 16#31d4 16#3e8d 16#3bba
] def
/fmtvalsrmqr1 [
16#1fab2 16#1e597 16#1dbdd 16#1c4f8 16#1b86c 16#1a749 16#19903 16#18626
16#17f0e 16#1602b 16#15e61 16#14144 16#13dd0 16#122f5 16#11cbf 16#1039a
16#0f1ca 16#0eeef 16#0d0a5 16#0cf80 16#0b314 16#0ac31 16#0927b 16#08d5e
16#07476 16#06b53 16#05519 16#04a3c 16#036a8 16#0298d 16#017c7 16#008e2
16#3f367 16#3ec42 16#3d208 16#3cd2d 16#3b1b9 16#3ae9c 16#390d6 16#38ff3
16#376db 16#369fe 16#357b4 16#34891 16#33405 16#32b20 16#3156a 16#30a4f
16#2f81f 16#2e73a 16#2d970 16#2c655 16#2bac1 16#2a5e4 16#29bae 16#2848b
16#27da3 16#26286 16#25ccc 16#243e9 16#23f7d 16#22058 16#21e12 16#20137
] def
/fmtvalsrmqr2 [
16#20a7b 16#2155e 16#22b14 16#23431 16#248a5 16#25780 16#269ca 16#276ef
16#28fc7 16#290e2 16#2aea8 16#2b18d 16#2cd19 16#2d23c 16#2ec76 16#2f353
16#30103 16#31e26 16#3206c 16#33f49 16#343dd 16#35cf8 16#362b2 16#37d97
16#384bf 16#39b9a 16#3a5d0 16#3baf5 16#3c661 16#3d944 16#3e70e 16#3f82b
16#003ae 16#01c8b 16#022c1 16#03de4 16#04170 16#05e55 16#0601f 16#07f3a
16#08612 16#09937 16#0a77d 16#0b858 16#0c4cc 16#0dbe9 16#0e5a3 16#0fa86
16#108d6 16#117f3 16#129b9 16#1369c 16#14a08 16#1552d 16#16b67 16#17442
16#18d6a 16#1924f 16#1ac05 16#1b320 16#1cfb4 16#1d091 16#1eedb 16#1f1fe
] def
} ctxdef
format (full) eq {
/fmtvals [
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#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
/fmtval fmtvals ecid 3 bitshift bestmaskval add get def
/fmtval fmtvalsfull ecid 3 bitshift bestmaskval add get def
0 1 formatmap length 1 sub {
/i exch def
formatmap i get {
19557,14 → 21342,8
} for
} if
format (micro) eq {
/fmtvals [
16#4445 16#4172 16#4e2b 16#4b1c 16#55ae 16#5099 16#5fc0 16#5af7
16#6793 16#62a4 16#6dfd 16#68ca 16#7678 16#734f 16#7c16 16#7921
16#06de 16#03e9 16#0cb0 16#0987 16#1735 16#1202 16#1d5b 16#186c
16#2508 16#203f 16#2f66 16#2a51 16#34e3 16#31d4 16#3e8d 16#3bba
] def
/symid [ [0] [1 2] [3 4] [5 6 7] ] cols 11 sub 2 idiv get eclval get def
/fmtval fmtvals symid 2 bitshift bestmaskval add get def
/fmtval fmtvalsmicro symid 2 bitshift bestmaskval add get def
0 1 formatmap length 1 sub {
/i exch def
pixs formatmap i get 0 get aload pop qmv fmtval 14 i sub neg bitshift 1 and put
19571,29 → 21350,9
} for
} if
format (rmqr) eq {
/fmtvals1 [
16#1fab2 16#1e597 16#1dbdd 16#1c4f8 16#1b86c 16#1a749 16#19903 16#18626
16#17f0e 16#1602b 16#15e61 16#14144 16#13dd0 16#122f5 16#11cbf 16#1039a
16#0f1ca 16#0eeef 16#0d0a5 16#0cf80 16#0b314 16#0ac31 16#0927b 16#08d5e
16#07476 16#06b53 16#05519 16#04a3c 16#036a8 16#0298d 16#017c7 16#008e2
16#3f367 16#3ec42 16#3d208 16#3cd2d 16#3b1b9 16#3ae9c 16#390d6 16#38ff3
16#376db 16#369fe 16#357b4 16#34891 16#33405 16#32b20 16#3156a 16#30a4f
16#2f81f 16#2e73a 16#2d970 16#2c655 16#2bac1 16#2a5e4 16#29bae 16#2848b
16#27da3 16#26286 16#25ccc 16#243e9 16#23f7d 16#22058 16#21e12 16#20137
] def
/fmtvals2 [
16#20a7b 16#2155e 16#22b14 16#23431 16#248a5 16#25780 16#269ca 16#276ef
16#28fc7 16#290e2 16#2aea8 16#2b18d 16#2cd19 16#2d23c 16#2ec76 16#2f353
16#30103 16#31e26 16#3206c 16#33f49 16#343dd 16#35cf8 16#362b2 16#37d97
16#384bf 16#39b9a 16#3a5d0 16#3baf5 16#3c661 16#3d944 16#3e70e 16#3f82b
16#003ae 16#01c8b 16#022c1 16#03de4 16#04170 16#05e55 16#0601f 16#07f3a
16#08612 16#09937 16#0a77d 16#0b858 16#0c4cc 16#0dbe9 16#0e5a3 16#0fa86
16#108d6 16#117f3 16#129b9 16#1369c 16#14a08 16#1552d 16#16b67 16#17442
16#18d6a 16#1924f 16#1ac05 16#1b320 16#1cfb4 16#1d091 16#1eedb 16#1f1fe
] def
/fmtvalu (MH) eclevel search pop length exch pop exch pop 5 bitshift verind add def
/fmtval1 fmtvals1 fmtvalu get def
/fmtval2 fmtvals2 fmtvalu get def
/fmtval1 fmtvalsrmqr1 fmtvalu get def
/fmtval2 fmtvalsrmqr2 fmtvalu get def
0 1 formatmap length 1 sub {
/i exch def
pixs formatmap i get 0 get aload pop qmv fmtval1 17 i sub neg bitshift 1 and put
19602,14 → 21361,16
} if
 
% Add the version information
{
/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#2379f 16#24b0b 16#2542e 16#26a64 16#27541 16#28c69
] def
} ctxdef
format (full) eq cols 45 ge and {
/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#2379f 16#24b0b 16#2542e 16#26a64 16#27541 16#28c69
] def
/verval vervals cols 17 sub 4 idiv 7 sub get def
0 1 versionmap length 1 sub {
/i exch def
19632,6 → 21393,8
 
dontdraw not //renmatrix if
 
//unloadctx exec
 
end
 
}
19645,15 → 21408,15
% --END ENCODER qrcode--
 
% --BEGIN ENCODER swissqrcode--
% --REQUIRES preamble raiseerror parseinput renmatrix qrcode--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix qrcode--
% --DESC: Swiss QR Code
% --EXAM:
% --EXOP:
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp swissqrcode 0.0 2021092800 62083 65448
%%BeginData: 127 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp swissqrcode 0.0 2022072900 71645 71452
%%BeginData: 128 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
19666,6 → 21429,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
 
/parse false def
19784,15 → 21548,15
% --END ENCODER swissqrcode--
 
% --BEGIN ENCODER microqrcode--
% --REQUIRES preamble raiseerror parseinput renmatrix qrcode--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix qrcode--
% --DESC: Micro QR Code
% --EXAM: 1234
% --EXOP:
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp microqrcode 0.0 2021092800 56791 56668
%%BeginData: 45 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp microqrcode 0.0 2022072900 66337 62760
%%BeginData: 46 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
dup /qrcode dup /uk.co.terryburton.bwipp findresource put
19804,6 → 21568,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
 
% Parse the input options
19841,15 → 21606,15
% --END ENCODER microqrcode--
 
% --BEGIN ENCODER rectangularmicroqrcode--
% --REQUIRES preamble raiseerror parseinput renmatrix qrcode--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix qrcode--
% --DESC: Rectangular Micro QR Code
% --EXAM: 1234
% --EXOP: version=R17x139
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp rectangularmicroqrcode 0.0 2021092800 56834 56700
%%BeginData: 45 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp rectangularmicroqrcode 0.0 2022072900 66380 62792
%%BeginData: 46 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
dup /qrcode dup /uk.co.terryburton.bwipp findresource put
19861,6 → 21626,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
 
% Parse the input options
19898,15 → 21664,17
% --END ENCODER rectangularmicroqrcode--
 
% --BEGIN ENCODER maxicode--
% --REQUIRES preamble raiseerror parseinput renmaximatrix--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmaximatrix--
% --DESC: MaxiCode
% --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 2021092800 126843 125788
%%BeginData: 596 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp maxicode 0.0 2022072900 132953 135762
%%BeginData: 607 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
dup /renmaximatrix dup /uk.co.terryburton.bwipp findresource put
19918,6 → 21686,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/mode -1 def
/sam -1 def
19938,6 → 21707,8
/mode mode cvi def
/sam sam cvi def
 
/maxicode //loadctx exec
 
% Parse the input
/fncvals <<
/parse parse
19987,6 → 21758,7
 
} if
 
{
% Special function characters
/eci -1 def /pad -2 def /ns -3 def
/la -4 def /lb -5 def
20080,6 → 21852,7
/setc charvals 2 get def
/setd charvals 3 get def
/sete charvals 4 get def
} ctxdef
 
% Compute numeric runlengths
/nseq [ msglen 1 add {0} repeat ] def
20425,6 → 22198,7
} for
 
% 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
20471,6 → 22245,7
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
} ctxdef
 
% Lookup pixels for enabled modules from modmap
/pixs 864 array def
20493,6 → 22268,8
 
dontdraw not //renmaximatrix if
 
//unloadctx exec
 
end
 
}
20506,15 → 22283,17
% --END ENCODER maxicode--
 
% --BEGIN ENCODER azteccode--
% --REQUIRES preamble raiseerror parseinput renmatrix--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix--
% --DESC: Aztec Code
% --EXAM: This is Aztec Code
% --EXOP: format=full
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp azteccode 0.0 2021092800 183704 199457
%%BeginData: 780 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp azteccode 0.0 2022072900 189159 208295
%%BeginData: 794 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
20526,6 → 22305,7
/options exch def
/barcode exch def
 
/ctx null def
/dontdraw false def
/format (unset) def % full, compact or rune
/readerinit false def
20551,6 → 22331,8
/eclevel eclevel cvr def
/ecaddchars ecaddchars cvi def
 
/azteccode //loadctx exec
 
format (rune) eq {
barcode length 0 eq {
/bwipp.aztecRuneNotNumeric (Aztec runes must be numeric) //raiseerror exec
20576,108 → 22358,111
/msg barcode fncvals //parseinput exec def
/msglen msg length def
 
% 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
 
% 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 -2 def /ll -3 def /lm -4 def
/lp -5 def /ld -6 def /su -7 def
/sp -8 def /sb -9 def /fl -10 def
/p2 -11 def /p3 -12 def /p4 -13 def /p5 -14 def
 
% Special function characters
/lu -2 def /ll -3 def /lm -4 def
/lp -5 def /ld -6 def /su -7 def
/sp -8 def /sb -9 def /fl -10 def
/p2 -11 def /p3 -12 def /p4 -13 def /p5 -14 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
 
% 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
% 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
% Punctuation compression
/pcomp <<
<0d0a> p2 % CR LF
(. ) p3
(, ) p4
(: ) p5
>> def
 
/e 10000 def % "Empty"
/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
/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
/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
/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
 
} ctxdef
 
% Convert from input into message bitstream
/msgbits () def
format (rune) ne raw and {/msgbits barcode def} if
format (rune) ne raw not and {
 
/charsize {
dup 0 ge {
% U L M P D B
20691,7 → 22476,7
ln 10 ln div cvi 1 add 4 mul 8 add
} ifelse
} ifelse
} bind def
} def
 
% U L M P D B
/curlen [ 0 e e e e e ] def
20866,12 → 22651,12
/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
} 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
/encd {charvals D get exch get 4 tobin} bind def
/encu {charvals U get exch get 5 tobin} def
/encl {charvals L get exch get 5 tobin} def
/encm {charvals M get exch get 5 tobin} def
/encd {charvals D get exch get 4 tobin} def
 
/encp {
dup fn1 eq { % FNC1: Flg(0)
20892,7 → 22677,7
} {
charvals P get exch get 5 tobin
} ifelse } ifelse
} bind def
} def
 
/encfuncs [ /encu /encl /encm /encp /encd ] def
 
20900,7 → 22685,7
/v exch def
msgbits j v putinterval
/j j v length add def
} bind def
} def
 
% Encode the sequence
/state U def
20969,6 → 22754,7
} 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 ]
20984,6 → 22770,7
[ (full) 27 0 1224 12 ] [ (full) 28 0 1306 12 ] [ (full) 29 0 1392 12 ]
[ (full) 30 0 1480 12 ] [ (full) 31 0 1570 12 ] [ (full) 32 0 1664 12 ]
] def
} ctxdef
 
/i 0 def
{ % loop
21008,8 → 22795,8
/format frmt def
 
% Expand message bits into codewords avoiding codewords with all zeros or all ones
/allzero {dup length (000000000000) 0 3 -1 roll getinterval eq} bind def
/allones {dup length (111111111111) 0 3 -1 roll getinterval eq} bind def
/allzero {dup length (000000000000) 0 3 -1 roll getinterval eq} def
/allones {dup length (111111111111) 0 3 -1 roll getinterval eq} def
/cws ncws array def
/m 0 def /c 0 def
{
21063,7 → 22850,7
} {
pop pop 0
} ifelse
} bind def
} def
 
% Generate the coefficients
/coeffs [ 1 rsnc {0} repeat ] def
21091,7 → 22878,7
% Return all but the last codeword
rscws 0 rscws length 1 sub getinterval
 
} bind def
} def
 
% Create the codewords and bit string for the mode
format (full) eq {
21131,6 → 22918,7
} for
 
% Extend the data codewords with error correction codewords to create the bit string for the data
{
/rsparams [
[] [] [] [] [] []
[ 64 67 ] % 6-bit codewords
21141,6 → 22929,7
[]
[ 4096 4201 ] % 12-bit codewords
] def
} ctxdef
/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
21156,7 → 22945,7
} for
 
% Move to a point in the cartesian plane centered on the bullseye
/cmv {size mul sub mid add} bind def
/cmv {size mul sub mid add} def
 
% Move to a bit position within a layer
/lmv {
21184,7 → 22973,7
lwid 2 idiv 1 sub lbit 2 idiv lwid mod sub neg
cmv
} if
} bind def
} def
 
% Create the pixel map
% For full symbols we disregard the reference grid at this stage
21253,21 → 23042,21
] {pixs exch {} forall 3 1 roll cmv exch put} forall
 
% Mode ring
format (full) eq {
/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]
[-7 -5] [-7 -4] [-7 -3] [-7 -2] [-7 -1] [-7 1] [-7 2] [-7 3] [-7 4] [-7 5]
] def
} {
/modemap [
[-3 5] [-2 5] [-1 5] [ 0 5] [ 1 5] [ 2 5] [ 3 5]
[ 5 3] [ 5 2] [ 5 1] [ 5 0] [ 5 -1] [ 5 -2] [ 5 -3]
[ 3 -5] [ 2 -5] [ 1 -5] [ 0 -5] [-1 -5] [-2 -5] [-3 -5]
[-5 -3] [-5 -2] [-5 -1] [-5 0] [-5 1] [-5 2] [-5 3]
] def
} ifelse
{
/modemapfull [
[-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]
[-7 -5] [-7 -4] [-7 -3] [-7 -2] [-7 -1] [-7 1] [-7 2] [-7 3] [-7 4] [-7 5]
] def
/modemapcompact [
[-3 5] [-2 5] [-1 5] [ 0 5] [ 1 5] [ 2 5] [ 3 5]
[ 5 3] [ 5 2] [ 5 1] [ 5 0] [ 5 -1] [ 5 -2] [ 5 -3]
[ 3 -5] [ 2 -5] [ 1 -5] [ 0 -5] [-1 -5] [-2 -5] [-3 -5]
[-5 -3] [-5 -2] [-5 -1] [-5 0] [-5 1] [-5 2] [-5 3]
] def
} ctxdef
/modemap format (full) eq {modemapfull} {modemapcompact} ifelse def
0 1 modemap length 1 sub {
/i exch def
pixs modemap i get {} forall cmv modebits i get 48 sub put
21285,6 → 23074,8
 
dontdraw not //renmatrix if
 
//unloadctx exec
 
end
 
}
21298,15 → 23089,15
% --END ENCODER azteccode--
 
% --BEGIN ENCODER azteccodecompact--
% --REQUIRES preamble raiseerror parseinput renmatrix azteccode--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix azteccode--
% --DESC: Compact Aztec Code
% --EXAM: 1234
% --EXOP:
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp azteccodecompact 0.0 2021092800 53387 56691
%%BeginData: 45 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp azteccodecompact 0.0 2022072900 62593 62441
%%BeginData: 46 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
dup /azteccode dup /uk.co.terryburton.bwipp findresource put
21318,6 → 23109,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
 
% Parse the input options
21355,15 → 23147,15
% --END ENCODER azteccodecompact--
 
% --BEGIN ENCODER aztecrune--
% --REQUIRES preamble raiseerror parseinput renmatrix azteccode--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix azteccode--
% --DESC: Aztec Runes
% --EXAM: 1
% --EXOP:
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp aztecrune 0.0 2021092800 53356 56667
%%BeginData: 45 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp aztecrune 0.0 2022072900 62562 62417
%%BeginData: 46 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
dup /azteccode dup /uk.co.terryburton.bwipp findresource put
21375,6 → 23167,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
 
% Parse the input options
21412,15 → 23205,17
% --END ENCODER aztecrune--
 
% --BEGIN ENCODER codeone--
% --REQUIRES preamble raiseerror parseinput renmatrix--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix--
% --DESC: Code One
% --EXAM: Code One
% --EXOP:
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp codeone 0.0 2021092800 196362 218850
%%BeginData: 883 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp codeone 0.0 2022072900 201490 227088
%%BeginData: 903 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
21432,6 → 23227,7
/options exch def
/barcode exch def
 
/ctx null def
/dontdraw false def
/version (unset) def
/parse false def
21448,29 → 23244,169
} if
options {def} forall
 
/codeone //loadctx exec
 
/stype version 0 1 getinterval (S) eq def
 
{
/stypevals [
(1)
(1010)
(1100100)
(1111101000)
(10011100010000)
(11000011010100000)
(11110100001001000000)
(100110001001011010000000)
(101111101011110000100000000)
(111011100110101100101000000000)
(1001010100000010111110010000000000)
(1011101001000011101101110100000000000)
(1110100011010100101001010001000000000000)
(10010001100001001110011100101010000000000000)
(10110101111001100010000011110100100000000000000)
(11100011010111111010100100110001101000000000000000)
(100011100001101111001001101111110000010000000000000000)
(101100011010001010111100001011101100010100000000000000000)
] def
 
% Basic metrics for the each symbol
% ver row col dcol dcws rscw rsbl ro ri rl
/stypemetrics [
[ (S-10) 8 11 10 4 4 1 99 99 99 ]
[ (S-20) 8 21 20 8 8 1 99 99 99 ]
[ (S-30) 8 31 30 12 12 1 99 99 99 ]
] def
 
% Basic metrics for the each symbol
% ver row col dcol dcws rscw rsbl ro ri rl
/nonstypemetrics [
[ (A) 16 18 16 10 10 1 4 99 6 ]
[ (B) 22 22 20 19 16 1 4 99 8 ]
[ (C) 28 32 28 44 26 1 4 22 11 ]
[ (D) 40 42 36 91 44 1 4 16 16 ]
[ (E) 52 54 48 182 70 1 4 22 22 ]
[ (F) 70 76 68 370 140 2 4 22 31 ]
[ (G) 104 98 88 732 280 4 6 21 47 ]
[ (H) 148 134 120 1480 560 8 6 20 69 ]
[ (T-16) 16 17 16 10 10 1 99 99 99 ]
[ (T-32) 16 33 32 24 16 1 99 99 99 ]
[ (T-48) 16 49 48 38 22 1 99 99 99 ]
] def
 
% Special characters
/fnc1 -1 def /fnc3 -2 def
/lC -5 def /lB -6 def /lX -7 def /lT -8 def /lD -9 def /unl -10 def
/fnc2 -11 def /fnc4 -12 def /sft1 -13 def /sft2 -14 def /sft3 -15 def /eci -16 def /pad -17 def /fnc1lD -18 def
/unlcw 255 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 fnc2 fnc3 fnc4 fnc1lD ] {exch 1 add dup} forall pop
lX 238
lT 239
% 240-255 lD + 4 bits
>> 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
fnc2 28
fnc3 29
fnc4 30
pad 31
>> 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
fnc2 28
fnc3 29
fnc4 30
pad 31
>> 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 fnc4 get aload pop Avals i 128 sub get aload pop ] put
Cvals i [ Cvals fnc4 get aload pop Cvals i 128 sub get aload pop ] put
Tvals i [ Tvals fnc4 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
 
/Bvals <<
0 1 255 {dup} for
>> def
/Bvals <<
Bvals {[exch]} forall
>> def
 
/encvals [ Avals Cvals Tvals Xvals -1 Bvals ] def
 
/A 0 def /C 1 def /T 2 def /X 3 def /D 4 def /B 5 def
} ctxdef
 
stype {
/vals [
(1)
(1010)
(1100100)
(1111101000)
(10011100010000)
(11000011010100000)
(11110100001001000000)
(100110001001011010000000)
(101111101011110000100000000)
(111011100110101100101000000000)
(1001010100000010111110010000000000)
(1011101001000011101101110100000000000)
(1110100011010100101001010001000000000000)
(10010001100001001110011100101010000000000000)
(10110101111001100010000011110100100000000000000)
(11100011010111111010100100110001101000000000000000)
(100011100001101111001001101111110000010000000000000000)
(101100011010001010111100001011101100010100000000000000000)
] def
 
/normalize {
/base exch def
21490,7 → 23426,7
/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
} def
 
/bigadd {
2 copy length exch length
21501,7 → 23437,7
dup a exch offset add 2 copy get b 5 -1 roll get add put
} for
a
} bind def
} def
 
/barlen barcode length def
 
21509,7 → 23445,7
/v [ 1 ] def
0 1 barlen 1 sub {
/i exch def
[ vals i get {48 sub barcode barlen i sub 1 sub get 48 sub mul} forall ]
[ stypevals i get {48 sub barcode barlen i sub 1 sub get 48 sub mul} forall ]
v bigadd /v exch def
} for
/v v 2 normalize def
21524,18 → 23460,11
cws exch i exch put
} for
 
% Basic metrics for the each symbol
% ver row col dcol dcws rscw rsbl ro ri rl
/metrics [
[ (S-10) 8 11 10 4 4 1 99 99 99 ]
[ (S-20) 8 21 20 8 8 1 99 99 99 ]
[ (S-30) 8 31 30 12 12 1 99 99 99 ]
] def
/metrics stypemetrics def
 
} { % Standard and type-T
 
% Convert input into bytes accounting for FNC characters
/fnc1 -1 def /fnc3 -2 def
/fncvals <<
/parse parse
/parsefnc parsefnc
21546,11 → 23475,6
/msg barcode fncvals //parseinput exec def
/msglen msg length def
 
% Special characters
/lC -5 def /lB -6 def /lX -7 def /lT -8 def /lD -9 def /unl -10 def
/fnc2 -11 def /fnc4 -12 def /sft1 -13 def /sft2 -14 def /sft3 -15 def /eci -16 def /pad -17 def /fnc1lD -18 def
/unlcw 255 def
 
% Code One stores ECIs in data
/eciesc 16#5c def % We choose \ as a typical default
/numecis 0 msg { -1000000 le {1 add} if } forall def
21582,21 → 23506,7
/msglen msg length def
} if
 
% Basic metrics for the each symbol
% ver row col dcol dcws rscw rsbl ro ri rl
/metrics [
[ (A) 16 18 16 10 10 1 4 99 6 ]
[ (B) 22 22 20 19 16 1 4 99 8 ]
[ (C) 28 32 28 44 26 1 4 22 11 ]
[ (D) 40 42 36 91 44 1 4 16 16 ]
[ (E) 52 54 48 182 70 1 4 22 22 ]
[ (F) 70 76 68 370 140 2 4 22 31 ]
[ (G) 104 98 88 732 280 4 6 21 47 ]
[ (H) 148 134 120 1480 560 8 6 20 69 ]
[ (T-16) 16 17 16 10 10 1 99 99 99 ]
[ (T-32) 16 33 32 24 16 1 99 99 99 ]
[ (T-48) 16 49 48 38 22 1 99 99 99 ]
] def
/metrics nonstypemetrics def
 
% Select metrics of an appropriate symbol
/fullcws [] def
21621,109 → 23531,6
} if
} for
 
/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 fnc2 fnc3 fnc4 fnc1lD ] {exch 1 add dup} forall pop
lX 238
lT 239
% 240-255 lD + 4 bits
>> 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
fnc2 28
fnc3 29
fnc4 30
pad 31
>> 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
fnc2 28
fnc3 29
fnc4 30
pad 31
>> 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 fnc4 get aload pop Avals i 128 sub get aload pop ] put
Cvals i [ Cvals fnc4 get aload pop Cvals i 128 sub get aload pop ] put
Tvals i [ Tvals fnc4 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
 
/Bvals <<
0 1 255 {dup} for
>> def
/Bvals <<
Bvals {[exch]} forall
>> def
 
/encvals [ Avals Cvals Tvals Xvals -1 Bvals ] def
 
/numD [ msglen {0} repeat 0 ] def
/nextXterm [ msglen {0} repeat 9999 ] def
/nextNonX [ msglen {0} repeat 9999 ] def
21747,16 → 23554,14
/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
/isEA {char 127 gt} bind def
/isFN {char 0 lt} bind def
/XtermFirst {dup nextXterm exch get exch nextNonX exch get lt} bind def
/isD {char 48 ge char 57 le and} def
/isC {CNvals char known} def
/isT {TNvals char known} def
/isX {Xvals char known} def
/isEA {char 127 gt} def
/isFN {char 0 lt} def
/XtermFirst {dup nextXterm exch get exch nextNonX exch get lt} def
 
/A 0 def /C 1 def /T 2 def /X 3 def /D 4 def /B 5 def
 
/lookup {
/ac 1 def /cc 2 def /tc 2 def /xc 2 def /bc 3 def
mode A eq {/ac 0 def /cc 1 def /tc 1 def /xc 1 def /bc 2 def} if
21792,18 → 23597,18
/k k 1 add def
} loop
} repeat
} bind def
} def
 
/addtocws {
dup cws exch j exch putinterval
/j exch length j add def
} bind def
} 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
[ exch {48 sub} forall ]
} bind def
} def
 
/encA {
1 { % Common exit
21848,7 → 23653,7
/i i 1 add def
exit
} repeat
} bind def
} def
 
/CTXvalstocws {
/in exch def
21858,7 → 23663,7
dup 256 idiv exch 256 mod
} for
counttomark array astore exch pop
} bind def
} def
 
/encCTX {
/p 0 def
21985,7 → 23790,7
} if
} if
 
} bind def
} def
 
/encD {
 
22053,7 → 23858,7
counttomark array astore exch pop addtocws
/mode A def
 
} bind def
} def
 
/encB {
/p 0 def /bvals 1480 array def {
22075,7 → 23880,7
] def
bvals addtocws
/mode A def
} bind def
} def
 
% Derive the codewords
/cws 1480 array def
22145,7 → 23950,7
} {
pop pop 0
} ifelse
} bind def
} def
 
% Generate the coefficients for the Reed-Solomon algorithm
/coeffs [ 1 ecpb {0} repeat ] def
22209,7 → 24014,7
} for
 
% Create bitmap and add finder patterns
/mmv {cols mul add} bind def
/mmv {cols mul add} def
/pixs [ rows cols mul {-1} repeat ] def
 
% Centre pattern
22223,7 → 24028,8
{1 cols 2 sub {0} repeat 1} bind
{1 0 cols 4 sub {1} repeat 0 1} bind
] def
/cpat <<
{
/cpatmap <<
/A (121343)
/B (12134343)
/C (12121343)
22234,7 → 24040,9
/H (121212134343)
/S (56661278)
/T (5666666666127878)
>> vers 0 1 getinterval get def
>> def
} ctxdef
/cpat cpatmap vers 0 1 getinterval get def
pixs 0 rows cpat length sub 2 idiv mmv
[ cpat {artifact exch 49 sub get exec} forall ] putinterval
 
22254,7 → 24062,8
} for
 
% Black dots
<<
{
/blackdotmap <<
/A [ [12 5] ]
/B [ [16 7] ]
/C [ [26 12] ]
22269,7 → 24078,9
/T-16 [ [8 10] ]
/T-32 [ [16 10] [16 12] ]
/T-48 [ [24 10] [24 12] [24 14] ]
>> vers get {pixs exch aload pop mmv 1 put} forall
>> def
} ctxdef
blackdotmap vers get {pixs exch aload pop mmv 1 put} forall
 
% Place the modules onto a pixel map between alignment patterns
/j 0 def
22294,6 → 24105,8
 
dontdraw not //renmatrix if
 
//unloadctx exec
 
end
 
}
22307,15 → 24120,17
% --END ENCODER codeone--
 
% --BEGIN ENCODER hanxin--
% --REQUIRES preamble raiseerror parseinput renmatrix--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix--
% --DESC: Han Xin Code
% --EXAM: This is Han Xin
% --EXOP:
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp hanxin 0.0 2021092800 305838 345620
%%BeginData: 852 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp hanxin 0.0 2022072900 311365 358291
%%BeginData: 863 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
22327,6 → 24142,7
/options exch def
/barcode exch def
 
/ctx null def
/dontdraw false def
/version (unset) def % 1-84
/eclevel (unset) def % L1, L2, L3 or L4
22347,6 → 24163,8
 
/mask mask cvi def
 
/hanxin //loadctx exec
 
% Parse the input
/fncvals <<
/parse parse
22363,7 → 24181,7
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
} def
 
% Encode the data using byte mode encoding
/bits 4 13 add msglen 8 mul add string def
22375,6 → 24193,7
} for
 
% Lookup the most appropriate symbol specification
{
/metrics [
% vers size align modules error correction blocks
[ (1) 23 -1 0 205 [ 1 21 4 ] [ 0 -1 -1 ] [ 0 -1 -1 ]
22714,6 → 24533,7
[ 2 26 26 ] [ 62 33 28 ] [ 0 -1 -1 ]
[ 79 18 28 ] [ 4 33 30 ] [ 0 -1 -1 ] ]
] def
} ctxdef
 
/eclval eclevel 1 get 49 sub def
0 1 83 {
22738,7 → 24558,7
} for
 
okay not {
/bwipp.hanxinNoValidSymbol (No valid symbol available) //raiseerror exec
/bwipp.hanxinNoValidSymbol (Maximum length exceeded or invalid content) //raiseerror exec
} if
 
/version vers def
22784,7 → 24604,7
} {
pop pop 0
} ifelse
} bind def
} def
 
% Generate the coefficients
/coeffs [ 1 rsnc {0} repeat ] def
22812,7 → 24632,7
% Return all but the last codeword
rscws 0 rscws length 1 sub getinterval
 
} bind def
} def
 
% Divide codewords into two groups of blocks and calculate the error correction codewords
/dcwsb e1nb e2nb add e3nb add array def
22863,15 → 24683,15
 
% Create the bitmap
/pixs [ size size mul {-1} repeat ] def
/qmv {size mul add} bind def
/qmv {size mul add} def
 
% Alignment patterns
alnn 0 ne {
/trmv {size mul size add 1 sub exch sub} bind def
/trmv {size mul size add 1 sub exch sub} def
/aplot {
3 1 roll 3 copy exch trmv pixs exch 3 -1 roll put
trmv pixs exch 3 -1 roll put
} bind def
} def
/i 0 def /stag 0 def {
i size ge {exit} if
0 1 size 1 sub {
22925,6 → 24745,7
} if
 
% Finder patterns
{
/fpat [
[ 1 1 1 1 1 1 1 0 ]
[ 1 0 0 0 0 0 0 0 ]
22945,6 → 24766,7
[ 1 1 1 1 1 1 1 0 ]
[ 0 0 0 0 0 0 0 0 ]
] def
} ctxdef
0 1 fpat length 1 sub {
/y exch def
0 1 fpat 0 get length 1 sub {
23064,7 → 24886,7
} if
} for
scr1 scr3
} bind def
} def
 
% Evaluation algorithm
/evalfull {
23102,7 → 24924,7
} for
 
n1 n3 add
} bind def
} def
 
% Evaluate the masked symbols to find the most suitable
/bestscore 999999999 def
23158,6 → 24980,8
 
dontdraw not //renmatrix if
 
//unloadctx exec
 
end
 
}
23171,15 → 24995,17
% --END ENCODER hanxin--
 
% --BEGIN ENCODER dotcode--
% --REQUIRES preamble raiseerror parseinput renmatrix--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix--
% --DESC: DotCode
% --EXAM: This is DotCode
% --EXOP: inkspread=0.16
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp dotcode 0.0 2021092800 231580 260718
%%BeginData: 1037 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp dotcode 0.0 2022072900 238866 274940
%%BeginData: 1067 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
23191,6 → 25017,7
/options exch def
/barcode exch def
 
/ctx null def
/dontdraw false def
/rows -1 def
/columns -1 def
23217,6 → 25044,8
/ratio ratio cvr def
/mask mask cvi def
 
/dotcode //loadctx exec
 
% Set the ratio to 3:2 if no size is specified
ratio -1 eq rows -1 eq and columns -1 eq and {
/ratio 3 2 div def
23223,6 → 25052,7
} if
 
% Convert input into bytes accounting for FNC characters
{
/laa -1 def /lab -2 def /lac -3 def /bin -4 def
/sfa -5 def /sfb -6 def /sb2 -7 def /sb3 -8 def
/sb4 -9 def /sb5 -10 def /sb6 -11 def /sfc -12 def
23232,6 → 25062,7
/fn1 -25 def /fn2 -26 def /fn3 -27 def /crl -28 def
/aim -29 def /m05 -30 def /m06 -31 def /m12 -32 def
/mac -33 def
} ctxdef
 
% Parse the input
/fncvals <<
23264,7 → 25095,8
/msglen msg length def
 
% Character maps for each state
/charmaps [
{
/charmaps [
% A B C A B C A B C
[ 32 32 (00) ] [ (!) (!) (01) ] [ (") (") (02) ] % 0-2
[ (#) (#) (03) ] [ ($) ($) (04) ] [ (%) (%) (05) ] % 3-5
23328,6 → 25160,9
102 [ sc2 sc3 sc4 sc5 sc6 sc7 tma tmb tmc tms ] {exch 1 add dup} forall pop
>> def
 
/A 0 def /B 1 def /C 2 def /BIN 3 def
} ctxdef
 
% Pre-compute properties of the input at each point
/nDigits [ msglen 1 add {0} repeat ] def
/SeventeenTen [ msglen 1 add {false} repeat ] def
23397,12 → 25232,10
} if
} for
 
/A 0 def /B 1 def /C 2 def /BIN 3 def
 
/addtocws {
dup cws exch j exch putinterval
/j exch length j add def
} bind def
} def
 
% Base 259 to one more in base 103
/base259to103 {
23433,7 → 25266,7
103 idiv mscs 2 get 15 mul add
out 0 3 -1 roll 103 mod put
out 6 inlen sub 1 sub inlen 1 add getinterval
} bind def
} def
 
/finaliseBIN {
bpos 0 ne {
23440,13 → 25273,13
bvals 0 bpos getinterval base259to103 aload pop
/bpos 0 def
} if
} bind def
} def
 
/addtobin {
bvals exch bpos exch put
/bpos bpos 1 add def
bpos 5 eq { finaliseBIN } if
} bind def
} def
 
/ECIabc { % ECI encoding for modes A, B and C
msg i 1 add 6 getinterval 0 exch {48 sub add 10 mul} forall 10 idiv
23455,7 → 25288,7
dup 12769 idiv 40 add exch 12769 mod
dup 113 idiv exch 113 mod
} if
} bind def
} def
 
/ECIbin { % ECI encoding for binary mode
[
23472,7 → 25305,7
] {
addtobin
} forall
} bind def
} def
 
/encC {
1 { % Common exit
23496,9 → 25329,16
} repeat
/inmac exch def
inmac 0 ne {
[ Cvals lab get ] addtocws
/mode B def
[ Bvals inmac get ] addtocws
/i i inmac mac ne {7} {6} ifelse add def
inmac mac eq {
[ Bvals msg segstart 4 add get get ] addtocws
[ Bvals msg segstart 5 add get get ] addtocws
/i i 6 add def
} {
/i i 7 add def
} ifelse
exit
} if
} if
23579,12 → 25419,17
} if
[ Cvals [ sfb sb2 sb3 sb4 ] n 1 sub get get ] addtocws
n {
[ Bvals msg i get get ] addtocws
/i i 1 add def
msg i get 13 eq {
[ Bvals crl get ] addtocws
/i i 2 add def
} {
[ Bvals msg i get get ] addtocws
/i i 1 add def
} ifelse
} repeat
exit
} repeat
} bind def % encC
} def % encC
 
/encB {
1 { % Common exit
23660,7 → 25505,7
/mode A def
exit
} repeat
} bind def
} def
 
/encA {
1 { % Common exit
23728,12 → 25573,17
} if
[ Avals [ sfb sb2 sb3 sb4 sb5 sb6 ] n 1 sub get get ] addtocws
n {
[ Bvals msg i get get ] addtocws
/i i 1 add def
msg i get 13 eq {
[ Bvals crl get ] addtocws
/i i 2 add def
} {
[ Bvals msg i get get ] addtocws
/i i 1 add def
} ifelse
} repeat
exit
} repeat
} bind def
} def
 
/encBIN {
1 { % Common exit
23795,7 → 25645,7
} if
exit
} repeat
} bind def
} def
 
/cws msglen 2 mul 1 add array def
/mode C def
23871,6 → 25721,7
options /debugcws known { /bwipp.debugcws cws //raiseerror exec } if
 
% Create an array containing the character mappings
{
/encs [
(101010101) (010101011) (010101101) (010110101) (011010101)
(101010110) (101011010) (101101010) (110101010) (010101110)
23896,6 → 25747,7
(100011110) (100111100) (101111000) (110001110) (110011100)
(110111000) (111000110) (111001100)
] def
} ctxdef
 
% Final six dots arranged at edges
rows 2 mod 0 eq {
23918,7 → 25770,7
] def
} ifelse
 
/dmv {columns mul add} bind def
/dmv {columns mul add} def
 
% Construct the template
/outline rows columns mul array def
23939,7 → 25791,7
x 1 and 2 rows 1 sub {
x exch dmv sym exch get 1 eq {pop false exit} if
} for
} bind def
} def
 
/clearrow {
/y exch def
23947,7 → 25799,7
y 1 and 2 columns 1 sub {
y dmv sym exch get 1 eq {pop false exit} if
} for
} bind def
} def
 
% Evaluate the symbol
/evalsymbol {
24055,12 → 25907,12
worst sum sum mul sub pen sub
} ifelse
 
} bind def
} def
 
% Reed Solomon antilog table
/rsalog [ 1 112 { dup 3 mul 113 mod } repeat ] def
/step nw 112 idiv 1 add def
/offset {step mul start add} bind def
/offset {step mul start add} def
 
% Evaluate the symbols in the following order:
% fast mode: m3 -> m3' -> m2 -> m2' -> m1 -> m1' -> m0 -> m0'
24207,6 → 26059,8
 
dontdraw not //renmatrix if
 
//unloadctx exec
 
end
 
}
24220,15 → 26074,17
% --END ENCODER dotcode--
 
% --BEGIN ENCODER ultracode--
% --REQUIRES preamble raiseerror parseinput renmatrix--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix--
% --DESC: Ultracode
% --EXAM: Awesome colours!
% --EXOP: eclevel=EC2
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp ultracode 0.0 2021092800 89868 89228
%%BeginData: 345 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp ultracode 0.0 2022072900 96331 99027
%%BeginData: 361 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
24240,6 → 26096,7
/options exch def
/barcode exch def
 
/ctx null def
/dontdraw false def
/eclevel (EC2) def % EC0-EC5
/encoding (auto) def
24269,6 → 26126,8
/bwipp.ultracodeInvalidRevision (Valid revisions are 1 and 2) //raiseerror exec
} if
 
/ultracode //loadctx exec
 
raw {/encoding (raw) def} if
 
encoding (raw) eq {
24325,6 → 26184,7
/tcc mcc qcc add def
 
% Lookup the most appropriate symbol specification
{
/metrics [
% rows minc maxc mcol
[ 2 7 37 5 ]
24332,6 → 26192,8
[ 4 85 161 22 ]
[ 5 142 282 29 ]
] def
} ctxdef
 
0 1 3 {
/i exch def
/m metrics i get def
24345,7 → 26207,7
} for
 
okay not {
/bwipp.ultracodeNoValidSymbol (No valid symbol available) //raiseerror exec
/bwipp.ultracodeNoValidSymbol (Maximum length exceeded or invalid content) //raiseerror exec
} if
 
% Determine required number of columns and pads
24415,34 → 26277,7
 
options /debugecc known { /bwipp.debugecc ecws //raiseerror exec } if
 
rev 1 eq {
/dccu [
51363 51563 51653 53153 53163 53513 53563 53613 % 0-7
53653 56153 56163 56313 56353 56363 56513 56563 % 8-15
51316 51356 51536 51616 53156 53516 53536 53616 % 16-23
53636 53656 56136 56156 56316 56356 56516 56536 % 24-31
] def
/dccl [
61351 61361 61531 61561 61631 61651 63131 63151 % 0-7
63161 63531 63561 63631 65131 65161 65351 65631 % 8-15
31351 31361 31531 31561 31631 31651 35131 35151 % 16-23
35161 35361 35631 35651 36131 36151 36351 36531 % 24-31
] def
} { % rev=2
/dccu [
15316 16316 13516 16516 13616 15616 13136 15136 % 0-7
16136 13536 16536 13636 13156 16156 15356 13656 % 8-15
15313 16313 13513 16513 13613 15613 13153 15153 % 16-23
16153 16353 13653 15653 13163 15163 15363 13563 % 24-31
] def
/dccl [
36315 36515 35615 35135 36135 31535 36535 31635 % 0-7
35635 35165 36165 31365 35365 36365 31565 36565 % 8-15
61315 65315 63515 61615 65135 61535 63535 61635 % 16-23
63635 65635 63165 65165 61365 65365 61565 63565 % 24-31
] def
} ifelse
 
{
/tiles [
13135 13136 13153 13156 13163 13165 13513 13515 13516 13531 % 0-9
13535 13536 13561 13563 13565 13613 13615 13616 13631 13635 % 10-19
24475,6 → 26310,35
65635 65651 65653 56565 51515 % 280-284
] def
 
/dccurev1 [
51363 51563 51653 53153 53163 53513 53563 53613 % 0-7
53653 56153 56163 56313 56353 56363 56513 56563 % 8-15
51316 51356 51536 51616 53156 53516 53536 53616 % 16-23
53636 53656 56136 56156 56316 56356 56516 56536 % 24-31
] def
/dcclrev1 [
61351 61361 61531 61561 61631 61651 63131 63151 % 0-7
63161 63531 63561 63631 65131 65161 65351 65631 % 8-15
31351 31361 31531 31561 31631 31651 35131 35151 % 16-23
35161 35361 35631 35651 36131 36151 36351 36531 % 24-31
] def
/dccurev2 [
15316 16316 13516 16516 13616 15616 13136 15136 % 0-7
16136 13536 16536 13636 13156 16156 15356 13656 % 8-15
15313 16313 13513 16513 13613 15613 13153 15153 % 16-23
16153 16353 13653 15653 13163 15163 15363 13563 % 24-31
] def
/dcclrev2 [
36315 36515 35615 35135 36135 31535 36535 31635 % 0-7
35635 35165 36165 31365 35365 36365 31565 36565 % 8-15
61315 65315 63515 61615 65135 61535 63535 61635 % 16-23
63635 65635 63165 65165 61365 65365 61565 63565 % 24-31
] def
} ctxdef
 
/dccu rev 1 eq {dccurev1} {dccurev2} ifelse def
/dccl rev 1 eq {dcclrev1} {dcclrev2} ifelse def
 
% Create the bitmap
/rows rows 6 mul 1 add def
/columns columns 6 add def
24543,6 → 26407,17
} ifelse
} forall
 
{
/colormap <<
0 (FFFFFF) % W
9 (000000) % K
1 (00FFFF) % C
3 (FF00FF) % M
5 (FFFF00) % Y
6 (00FF00) % G
>> def
} ctxdef
 
% Return the arguments
<<
/ren //renmatrix
24551,19 → 26426,14
/pixy rows
/height rows 72 div 2 mul
/width columns 72 div 2 mul
/colormap <<
0 (FFFFFF) % W
9 (000000) % K
1 (00FFFF) % C
3 (FF00FF) % M
5 (FFFF00) % Y
6 (00FF00) % G
>>
/colormap colormap
/opt options
>>
 
dontdraw not //renmatrix if
 
//unloadctx exec
 
end
 
}
24577,15 → 26447,15
% --END ENCODER ultracode--
 
% --BEGIN ENCODER jabcode--
% --REQUIRES preamble raiseerror parseinput renmatrix--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix--
% --DESC: JAB Code (Beta)
% --EXAM: This is JAB Code
% --EXOP: eclevel=6
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp jabcode 0.0 2021092800 240985 279579
%%BeginData: 1132 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp jabcode 0.0 2022072900 246160 288650
%%BeginData: 1133 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
24597,6 → 26467,7
/options exch def
/barcode exch def
 
/ctx null def
/dontdraw false def
/rows -1 def
/columns -1 def
24773,7 → 26644,7
 
% TODO Reject all invalid sizes
rows 145 gt cols 145 gt or {
/bwipp.jabcodeNoValidSymbol (No valid symbol available) //raiseerror exec
/bwipp.jabcodeNoValidSymbol (Maximum length exceeded or invalid content) //raiseerror exec
} if
 
% Pick ECC params to maximally fill symbol
25721,18 → 27592,19
% --END ENCODER jabcode--
 
% --BEGIN ENCODER gs1-cc--
% --REQUIRES preamble raiseerror parseinput gs1lint renmatrix micropdf417 pdf417--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renmatrix micropdf417 pdf417--
% --DESC: GS1 Composite 2D Component
% --EXAM: (01)95012345678903(3103)000123
% --EXOP: ccversion=b cccolumns=4
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp gs1-cc 0.0 2021092800 205775 208288
%%BeginData: 661 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp gs1-cc 0.0 2022072900 206333 205184
%%BeginData: 639 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
dup /gs1lint dup /uk.co.terryburton.bwipp findresource put
dup /gs1process dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
dup /pdf417 dup /uk.co.terryburton.bwipp findresource put
dup /micropdf417 dup /uk.co.terryburton.bwipp findresource put
25744,8 → 27616,10
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/parse false def
/dontlint false def
/lintreqs false def
/dontdraw false def
/ccversion (a) def
/cccolumns -1 def
25766,6 → 27640,8
/cccolumns cccolumns cvi def
/linwidth linwidth cvi def
 
/gs1-cc //loadctx exec
 
% Select columns based on linear type
cccolumns -1 eq {
<<
25785,41 → 27661,15
>> lintype get /cccolumns exch def
} if
 
% Expand ordinals of the form ^NNN to ASCII
/expand {
/fncvals <<
/parse parse
/parseonly true
/parsefnc false
>> def
fncvals //parseinput exec
} bind def
barcode /ai //gs1process exec
/fncs exch def
/vals exch def
/ais exch def
 
% Parse out AIs
/ais [] def
/vals [] 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
[ vals aload pop counttomark 1 add index expand ] /vals exch def
pop pop
} loop
pop
 
dontlint not { ais vals //gs1lint exec pop } if
 
% 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
/isupper {dup 65 ge exch 90 le and} def % A-Z
/isnum0 {dup 48 ge exch 57 le and} def % 0-9
/isnum1 {dup 49 ge exch 57 le and} def % 1-9
{ % common exit
 
% (10/11/17)...
25869,13 → 27719,15
/method exch def
/npre exch def
 
/fnc1 -1 def /lnumeric -2 def /lalphanumeric -3 def /liso646 -4 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
} bind def
} def
 
{
 
/fnc1 -1 def /lnumeric -2 def /lalphanumeric -3 def /liso646 -4 def
 
/alpha <<
65 1 90 {dup 65 sub 5 tobin} for
48 1 57 {dup 4 add 6 tobin} for
25920,6 → 27772,8
lalphanumeric (00100)
>> def
 
} ctxdef
 
method (10) eq { % TODO: fixme
ais 0 get (11) eq ais 0 get (17) eq or {
vals 0 get
25934,6 → 27788,7
] /cdf exch def
/ais ais 1 ais length 1 sub getinterval def
/vals vals 1 vals length 1 sub getinterval def
/fncs fncs 1 fncs length 1 sub getinterval def
} {
/cdf [ 1 0 1 1 ] def
} ifelse
25943,6 → 27798,7
ais length 1 gt {/gpf [ gpf aload pop fnc1 ] def} if % TODO: check
/ais ais 1 ais length 1 sub getinterval def
/vals vals 1 vals length 1 sub getinterval def
/fncs fncs 1 fncs length 1 sub getinterval def
} {
/gpf [fnc1] def % TODO: check
} ifelse
26032,6 → 27888,7
} ifelse
/ais ais 1 ais length 1 sub getinterval def
/vals vals 1 vals length 1 sub getinterval def
/fncs fncs 1 fncs length 1 sub getinterval def
ais length 0 ne {
ais1 (21) eq ais1 (8004) eq or {
/gpf [
26040,6 → 27897,7
] def
/ais ais 1 ais length 1 sub getinterval def
/vals vals 1 vals length 1 sub getinterval def
/fncs fncs 1 fncs length 1 sub getinterval def
ais length 0 ne {/gpf [gpf aload pop fnc1] def} if
} if
} if
26051,24 → 27909,6
/mode (numeric) def
} if
 
% 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
 
% Append the remaining AI data
0 1 ais length 1 sub {
/i exch def
26079,7 → 27919,7
dup gpf length ai [ exch {} forall ] putinterval
dup gpf length ai length add val [ exch {} forall ] putinterval
/gpf exch def
i ais length 1 sub ne aifixed ai 0 2 getinterval known not and { % Append FNC1
i ais length 1 sub ne fncs i get and { % Append FNC1
gpf length 1 add array
dup 0 gpf putinterval
dup gpf length fnc1 put
26088,21 → 27928,25
} for
 
% Calculate the number of bits remaining to the next valid symbol size
{
/bitcapsmaps <<
/a [
[167 138 118 108 88 78 59]
[167 138 118 98 78]
[197 167 138 108 78]
]
/b [
[ 336 296 256 208 160 104 56]
[ 768 648 536 416 304 208 152 112 72 32]
[1184 1016 840 672 496 352 264 208 152 96 56]
]
>> def
} ctxdef
 
/rembits {
/used exch def
ccversion (c) ne { % cc-a or cc-b
<<
/a [
[167 138 118 108 88 78 59]
[167 138 118 98 78]
[197 167 138 108 78]
]
/b [
[ 336 296 256 208 160 104 56]
[ 768 648 536 416 304 208 152 112 72 32]
[1184 1016 840 672 496 352 264 208 152 96 56]
]
>> ccversion get cccolumns 2 sub get /bitcaps exch def
/bitcaps bitcapsmaps ccversion get cccolumns 2 sub get def
-1 bitcaps {dup used ge {exch} if pop} forall
dup -1 ne {used sub} if
} {
26139,7 → 27983,7
} ifelse
used rembits
} if
} bind def
} def
 
/encode {
dup /raw ne {exch get} {pop} ifelse
26147,7 → 27991,7
dup length exch
gpfenc exch j exch putinterval
/j exch j add def
} bind def
} def
 
% Pre-compute alphanumeric and numeric runlengths and position of next ISO646-only characters
/numericruns [ gpf length {0} repeat 0 -1 ] def
26293,21 → 28137,24
pad aload pop
] def
 
{
/pwr928 [
[ 0 0 0 0 0 0 1 ]
68 {7 array} repeat
] def
1 1 68 {
/j exch def
/v 0 def
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 0 pwr928 j 1 sub get 0 get 2 mul v 928 idiv add put
} for
} ctxdef
 
ccversion (a) eq {
/pwr928 [
[ 0 0 0 0 0 0 1 ]
68 {7 array} repeat
] def
1 1 68 {
/j exch def
/v 0 def
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 0 pwr928 j 1 sub get 0 get 2 mul v 928 idiv add put
} for
/cws [ 28 {0} repeat ] def
/b 0 def /c 0 def
{ % loop
26381,6 → 28228,8
args
dontdraw not //renmatrix if
 
//unloadctx exec
 
end
 
}
26394,18 → 28243,19
% --END ENCODER gs1-cc--
 
% --BEGIN ENCODER ean13composite--
% --REQUIRES preamble raiseerror parseinput gs1lint renlinear renmatrix ean5 ean2 ean13 micropdf417 pdf417 gs1-cc--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renlinear renmatrix ean5 ean2 ean13 micropdf417 pdf417 gs1-cc--
% --DESC: EAN-13 Composite
% --EXAM: 2112345678900|(99)1234-abcd
% --EXOP: includetext
% --RNDR: renlinear renmatrix
%%BeginResource: uk.co.terryburton.bwipp ean13composite 0.0 2021092800 83015 86399
%%BeginData: 74 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp ean13composite 0.0 2022072900 93981 93421
%%BeginData: 86 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /ean13 dup /uk.co.terryburton.bwipp findresource put
dup /gs1-cc dup /uk.co.terryburton.bwipp findresource put
dup /gs1process dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
begin
26416,7 → 28266,11
/options exch def
/barcode exch def
 
/ctx null def
/dontdraw false def
/parse false def
/dontlint false def
/lintreqs true def
 
% Parse the input options
options type /stringtype eq {
26443,7 → 28297,14
options (lintype) (ean13) put
options (inkspread) (0) put
options (dontdraw) true put
options (dontlint) true put
 
% Lint with a fake AI (01)
comp length 18 add string
dup 0 ((01)00000000000000) putinterval
dup 18 comp putinterval
/ai //gs1process exec pop pop pop
 
% Plot the linear part
linear options //ean13 exec //renlinear exec
 
26480,18 → 28341,19
% --END ENCODER ean13composite--
 
% --BEGIN ENCODER ean8composite--
% --REQUIRES preamble raiseerror parseinput gs1lint renlinear renmatrix ean5 ean2 ean8 micropdf417 pdf417 gs1-cc--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renlinear renmatrix ean5 ean2 ean8 micropdf417 pdf417 gs1-cc--
% --DESC: EAN-8 Composite
% --EXAM: 02345673|(21)A12345678
% --EXOP: includetext
% --RNDR: renlinear renmatrix
%%BeginResource: uk.co.terryburton.bwipp ean8composite 0.0 2021092800 86788 86741
%%BeginData: 77 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp ean8composite 0.0 2022072900 94322 90331
%%BeginData: 89 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /ean8 dup /uk.co.terryburton.bwipp findresource put
dup /gs1-cc dup /uk.co.terryburton.bwipp findresource put
dup /gs1process dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
begin
26502,7 → 28364,11
/options exch def
/barcode exch def
 
/ctx null def
/dontdraw false def
/parse false def
/dontlint false def
/lintreqs true def
 
% Parse the input options
options type /stringtype eq {
26530,7 → 28396,14
options (lintype) (ean8) put
options (inkspread) (0) put
options (dontdraw) true put
options (dontlint) true put
 
% Lint with a fake AI (01)
comp length 18 add string
dup 0 ((01)00000000000000) putinterval
dup 18 comp putinterval
/ai //gs1process exec pop pop pop
 
% Plot the linear part
linear options //ean8 exec //renlinear exec
 
26569,18 → 28442,19
% --END ENCODER ean8composite--
 
% --BEGIN ENCODER upcacomposite--
% --REQUIRES preamble raiseerror parseinput gs1lint renlinear renmatrix ean5 ean2 upca micropdf417 pdf417 gs1-cc--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renlinear renmatrix ean5 ean2 upca micropdf417 pdf417 gs1-cc--
% --DESC: UPC-A Composite
% --EXAM: 416000336108|(99)1234-abcd
% --EXOP: includetext
% --RNDR: renlinear renmatrix
%%BeginResource: uk.co.terryburton.bwipp upcacomposite 0.0 2021092800 86425 82946
%%BeginData: 74 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp upcacomposite 0.0 2022072900 93975 93416
%%BeginData: 86 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
2 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /upca dup /uk.co.terryburton.bwipp findresource put
dup /gs1-cc dup /uk.co.terryburton.bwipp findresource put
dup /gs1process dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
begin
26591,7 → 28465,11
/options exch def
/barcode exch def
 
/ctx null def
/dontdraw false def
/parse false def
/dontlint false def
/lintreqs true def
 
% Parse the input options
options type /stringtype eq {
26618,7 → 28496,14
options (lintype) (ean13) put
options (inkspread) (0) put
options (dontdraw) true put
options (dontlint) true put
 
% Lint with a fake AI (01)
comp length 18 add string
dup 0 ((01)00000000000000) putinterval
dup 18 comp putinterval
/ai //gs1process exec pop pop pop
 
% Plot the linear part
linear options //upca exec //renlinear exec
 
26655,18 → 28540,19
% --END ENCODER upcacomposite--
 
% --BEGIN ENCODER upcecomposite--
% --REQUIRES preamble raiseerror parseinput gs1lint renlinear renmatrix ean5 ean2 upce micropdf417 pdf417 gs1-cc--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renlinear renmatrix ean5 ean2 upce micropdf417 pdf417 gs1-cc--
% --DESC: UPC-E Composite
% --EXAM: 00123457|(15)021231
% --EXOP: includetext
% --RNDR: renlinear renmatrix
%%BeginResource: uk.co.terryburton.bwipp upcecomposite 0.0 2021092800 87707 87649
%%BeginData: 89 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp upcecomposite 0.0 2022072900 91689 90991
%%BeginData: 101 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
2 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /upce dup /uk.co.terryburton.bwipp findresource put
dup /gs1-cc dup /uk.co.terryburton.bwipp findresource put
dup /gs1process dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
begin
26677,7 → 28563,11
/options exch def
/barcode exch def
 
/ctx null def
/dontdraw false def
/parse false def
/dontlint false def
/lintreqs true def
 
% Parse the input options
options type /stringtype eq {
26719,7 → 28609,14
options (lintype) (upce) put
options (inkspread) (0) put
options (dontdraw) true put
options (dontlint) true put
 
% Lint with a fake AI (01)
comp length 18 add string
dup 0 ((01)00000000000000) putinterval
dup 18 comp putinterval
/ai //gs1process exec pop pop pop
 
% Plot the linear part
linear options //upce exec //renlinear exec
 
26756,18 → 28653,19
% --END ENCODER upcecomposite--
 
% --BEGIN ENCODER databaromnicomposite--
% --REQUIRES preamble raiseerror parseinput gs1lint renlinear renmatrix databaromni micropdf417 pdf417 gs1-cc--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renlinear renmatrix databaromni micropdf417 pdf417 gs1-cc--
% --DESC: GS1 DataBar Omnidirectional Composite
% --EXAM: (01)03612345678904|(11)990102
% --EXOP:
% --RNDR: renlinear renmatrix
%%BeginResource: uk.co.terryburton.bwipp databaromnicomposite 0.0 2021092800 84062 87382
%%BeginData: 102 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp databaromnicomposite 0.0 2022072900 91130 94450
%%BeginData: 114 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
2 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /databaromni dup /uk.co.terryburton.bwipp findresource put
dup /gs1-cc dup /uk.co.terryburton.bwipp findresource put
dup /gs1process dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
begin
26778,7 → 28676,11
/options exch def
/barcode exch def
 
/ctx null def
/dontdraw false def
/parse false def
/dontlint false def
/lintreqs true def
 
% Parse the input options
options type /stringtype eq {
26806,7 → 28708,14
options (linkage) true put
options (inkspread) (0) put
options (dontdraw) true put
options (dontlint) true put
 
% Lint the combined AI element strings
linear length comp length add string
dup 0 linear putinterval
dup linear length comp putinterval
/ai //gs1process exec pop pop pop
 
% Plot the linear part
linear options //databaromni exec
dup (sbs) get /linsbs exch def
26870,18 → 28779,19
% --END ENCODER databaromnicomposite--
 
% --BEGIN ENCODER databarstackedcomposite--
% --REQUIRES preamble raiseerror parseinput gs1lint renlinear renmatrix databaromni databarstacked micropdf417 pdf417 gs1-cc--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renlinear renmatrix databaromni databarstacked micropdf417 pdf417 gs1-cc--
% --DESC: GS1 DataBar Stacked Composite
% --EXAM: (01)03412345678900|(17)010200
% --EXOP:
% --RNDR: renlinear renmatrix
%%BeginResource: uk.co.terryburton.bwipp databarstackedcomposite 0.0 2021092800 85882 85781
%%BeginData: 98 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp databarstackedcomposite 0.0 2022072900 92950 96281
%%BeginData: 110 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
2 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /databarstacked dup /uk.co.terryburton.bwipp findresource put
dup /gs1-cc dup /uk.co.terryburton.bwipp findresource put
dup /gs1process dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
begin
/databarstackedcomposite {
26891,7 → 28801,11
/options exch def
/barcode exch def
 
/ctx null def
/dontdraw false def
/parse false def
/dontlint false def
/lintreqs true def
 
% Parse the input options
options type /stringtype eq {
26919,7 → 28833,14
options (linkage) true put
options (inkspread) (0) put
options (dontdraw) true put
options (dontlint) true put
 
% Lint the combined AI element strings
linear length comp length add string
dup 0 linear putinterval
dup linear length comp putinterval
/ai //gs1process exec pop pop pop
 
% Plot the linear part
linear options //databarstacked exec
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
26980,18 → 28901,19
% --END ENCODER databarstackedcomposite--
 
% --BEGIN ENCODER databarstackedomnicomposite--
% --REQUIRES preamble raiseerror parseinput gs1lint renlinear renmatrix databaromni databarstackedomni micropdf417 pdf417 gs1-cc--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renlinear renmatrix databaromni databarstackedomni micropdf417 pdf417 gs1-cc--
% --DESC: GS1 DataBar Stacked Omnidirectional Composite
% --EXAM: (01)03612345678904|(11)990102
% --EXOP:
% --RNDR: renlinear renmatrix
%%BeginResource: uk.co.terryburton.bwipp databarstackedomnicomposite 0.0 2021092800 85910 85805
%%BeginData: 98 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp databarstackedomnicomposite 0.0 2022072900 92978 96305
%%BeginData: 110 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
2 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /databarstackedomni dup /uk.co.terryburton.bwipp findresource put
dup /gs1-cc dup /uk.co.terryburton.bwipp findresource put
dup /gs1process dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
begin
/databarstackedomnicomposite {
27001,7 → 28923,11
/options exch def
/barcode exch def
 
/ctx null def
/dontdraw false def
/parse false def
/dontlint false def
/lintreqs true def
 
% Parse the input options
options type /stringtype eq {
27029,7 → 28955,14
options (linkage) true put
options (inkspread) (0) put
options (dontdraw) true put
options (dontlint) true put
 
% Lint the combined AI element strings
linear length comp length add string
dup 0 linear putinterval
dup linear length comp putinterval
/ai //gs1process exec pop pop pop
 
% Plot the linear part
linear options //databarstackedomni exec
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
27090,18 → 29023,19
% --END ENCODER databarstackedomnicomposite--
 
% --BEGIN ENCODER databartruncatedcomposite--
% --REQUIRES preamble raiseerror parseinput gs1lint renlinear renmatrix databaromni databartruncated micropdf417 pdf417 gs1-cc--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renlinear renmatrix databaromni databartruncated micropdf417 pdf417 gs1-cc--
% --DESC: GS1 DataBar Truncated Composite
% --EXAM: (01)03612345678904|(11)990102
% --EXOP:
% --RNDR: renlinear renmatrix
%%BeginResource: uk.co.terryburton.bwipp databartruncatedcomposite 0.0 2021092800 86952 86835
%%BeginData: 102 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp databartruncatedcomposite 0.0 2022072900 94020 97335
%%BeginData: 114 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
2 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /databartruncated dup /uk.co.terryburton.bwipp findresource put
dup /gs1-cc dup /uk.co.terryburton.bwipp findresource put
dup /gs1process dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
begin
27112,7 → 29046,11
/options exch def
/barcode exch def
 
/ctx null def
/dontdraw false def
/parse false def
/dontlint false def
/lintreqs true def
 
% Parse the input options
options type /stringtype eq {
27140,7 → 29078,14
options (linkage) true put
options (inkspread) (0) put
options (dontdraw) true put
options (dontlint) true put
 
% Lint the combined AI element strings
linear length comp length add string
dup 0 linear putinterval
dup linear length comp putinterval
/ai //gs1process exec pop pop pop
 
% Plot the linear part
linear options //databartruncated exec
dup (sbs) get /linsbs exch def
27204,18 → 29149,19
% --END ENCODER databartruncatedcomposite--
 
% --BEGIN ENCODER databarlimitedcomposite--
% --REQUIRES preamble raiseerror parseinput gs1lint renlinear renmatrix databarlimited micropdf417 pdf417 gs1-cc--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renlinear renmatrix databarlimited micropdf417 pdf417 gs1-cc--
% --DESC: GS1 DataBar Limited Composite
% --EXAM: (01)03512345678907|(21)abcdefghijklmnopqrstuv
% --EXAM: (01)03512345678907|(21)abcdefghijklmnopqrst
% --EXOP:
% --RNDR: renlinear renmatrix
%%BeginResource: uk.co.terryburton.bwipp databarlimitedcomposite 0.0 2021092800 80359 83692
%%BeginData: 81 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp databarlimitedcomposite 0.0 2022072900 87443 90880
%%BeginData: 93 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
2 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /databarlimited dup /uk.co.terryburton.bwipp findresource put
dup /gs1-cc dup /uk.co.terryburton.bwipp findresource put
dup /gs1process dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
begin
27226,7 → 29172,11
/options exch def
/barcode exch def
 
/ctx null def
/dontdraw false def
/parse false def
/dontlint false def
/lintreqs true def
 
% Parse the input options
options type /stringtype eq {
27254,7 → 29204,14
options (linkage) true put
options (inkspread) (0) put
options (dontdraw) true put
options (dontlint) true put
 
% Lint the combined AI element strings
linear length comp length add string
dup 0 linear putinterval
dup linear length comp putinterval
/ai //gs1process exec pop pop pop
 
% Plot the linear part
linear options //databarlimited exec
dup (sbs) get /linsbs exch def
27297,18 → 29254,19
% --END ENCODER databarlimitedcomposite--
 
% --BEGIN ENCODER databarexpandedcomposite--
% --REQUIRES preamble raiseerror parseinput gs1lint renlinear renmatrix databarexpanded micropdf417 pdf417 gs1-cc--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renlinear renmatrix databarexpanded micropdf417 pdf417 gs1-cc--
% --DESC: GS1 DataBar Expanded Composite
% --EXAM: (01)93712345678904(3103)001234|(91)1A2B3C4D5E
% --EXOP:
% --RNDR: renlinear renmatrix
%%BeginResource: uk.co.terryburton.bwipp databarexpandedcomposite 0.0 2021092800 86821 83262
%%BeginData: 100 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp databarexpandedcomposite 0.0 2022072900 97433 90314
%%BeginData: 112 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
2 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /databarexpanded dup /uk.co.terryburton.bwipp findresource put
dup /gs1-cc dup /uk.co.terryburton.bwipp findresource put
dup /gs1process dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
begin
27319,7 → 29277,11
/options exch def
/barcode exch def
 
/ctx null def
/dontdraw false def
/parse false def
/dontlint false def
/lintreqs true def
 
% Parse the input options
options type /stringtype eq {
27347,7 → 29309,14
options (linkage) true put
options (inkspread) (0) put
options (dontdraw) true put
options (dontlint) true put
 
% Lint the combined AI element strings
linear length comp length add string
dup 0 linear putinterval
dup linear length comp putinterval
/ai //gs1process exec pop pop pop
 
% Plot the linear part
linear options //databarexpanded exec
dup (sbs) get /linsbs exch def
27370,7 → 29339,7
} ifelse
sep exch i exch put
} for
} bind def
} def
mark
0 linsbs {1 index 1 eq {{0}} {{1}} ifelse repeat} forall
counttomark 1 sub array astore /bot exch def pop pop
27409,18 → 29378,19
% --END ENCODER databarexpandedcomposite--
 
% --BEGIN ENCODER databarexpandedstackedcomposite--
% --REQUIRES preamble raiseerror parseinput gs1lint renlinear renmatrix databarexpanded databarexpandedstacked micropdf417 pdf417 gs1-cc--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renlinear renmatrix databarexpanded databarexpandedstacked micropdf417 pdf417 gs1-cc--
% --DESC: GS1 DataBar Expanded Stacked Composite
% --EXAM: (01)00012345678905(10)ABCDEF|(21)12345678
% --EXOP: segments=4
% --RNDR: renmatrix renlinear
%%BeginResource: uk.co.terryburton.bwipp databarexpandedstackedcomposite 0.0 2021092800 89045 85493
%%BeginData: 97 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp databarexpandedstackedcomposite 0.0 2022072900 96049 95929
%%BeginData: 109 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
2 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /databarexpandedstacked dup /uk.co.terryburton.bwipp findresource put
dup /gs1-cc dup /uk.co.terryburton.bwipp findresource put
dup /gs1process dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
begin
/databarexpandedstackedcomposite {
27430,7 → 29400,11
/options exch def
/barcode exch def
 
/ctx null def
/dontdraw false def
/parse false def
/dontlint false def
/lintreqs true def
 
% Parse the input options
options type /stringtype eq {
27458,7 → 29432,14
options (linkage) true put
options (inkspread) (0) put
options (dontdraw) true put
options (dontlint) true put
 
% Lint the combined AI element strings
linear length comp length add string
dup 0 linear putinterval
dup linear length comp putinterval
/ai //gs1process exec pop pop pop
 
% Plot the linear part
linear options //databarexpandedstacked exec
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
27481,7 → 29462,7
} ifelse
sep exch i exch put
} for
} bind def
} def
/sep [ bot {1 exch sub} forall ] def
sep 0 [ 0 0 0 0 ] putinterval
sep sep length 4 sub [ 0 0 0 0 ] putinterval
27518,18 → 29499,19
% --END ENCODER databarexpandedstackedcomposite--
 
% --BEGIN ENCODER gs1-128composite--
% --REQUIRES preamble raiseerror parseinput gs1lint renlinear renmatrix code128 gs1-128 micropdf417 pdf417 gs1-cc--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renlinear renmatrix code128 gs1-128 micropdf417 pdf417 gs1-cc--
% --DESC: GS1-128 Composite
% --EXAM: (00)030123456789012340|(02)13012345678909(37)24(10)1234567ABCDEFG
% --EXOP: ccversion=c
% --RNDR: renlinear renmatrix
%%BeginResource: uk.co.terryburton.bwipp gs1-128composite 0.0 2021092800 86500 89809
%%BeginData: 102 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp gs1-128composite 0.0 2022072900 97016 96997
%%BeginData: 114 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
2 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /gs1-128 dup /uk.co.terryburton.bwipp findresource put
dup /gs1-cc dup /uk.co.terryburton.bwipp findresource put
dup /gs1process dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
begin
27540,7 → 29522,11
/options exch def
/barcode exch def
 
/ctx null def
/dontdraw false def
/parse false def
/dontlint false def
/lintreqs true def
 
% Parse the input options
options type /stringtype eq {
27566,7 → 29552,14
 
options (inkspread) (0) put
options (dontdraw) true put
options (dontlint) true put
 
% Lint the combined AI element strings
linear length comp length add string
dup 0 linear putinterval
dup linear length comp putinterval
/ai //gs1process exec pop pop pop
 
% Dummy plot of linear part with CC-A to get width
options (linkagea) true put
linear << options {} forall >> //gs1-128 exec
27632,18 → 29625,17
% --END ENCODER gs1-128composite--
 
% --BEGIN ENCODER gs1datamatrix--
% --REQUIRES preamble raiseerror parseinput gs1lint renmatrix datamatrix--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renmatrix datamatrix--
% --DESC: GS1 Data Matrix
% --EXAM: (01)03453120000011(17)120508(10)ABCD1234(410)9501101020917
% --EXOP:
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp gs1datamatrix 0.0 2021092800 74645 81522
%%BeginData: 134 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp gs1datamatrix 0.0 2022072900 77432 73954
%%BeginData: 91 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
dup /gs1lint dup /uk.co.terryburton.bwipp findresource put
dup /gs1process dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
dup /datamatrix dup /uk.co.terryburton.bwipp findresource put
begin
27654,9 → 29646,11
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/parse false def
/dontlint false def
/lintreqs true def
/gssep false def
 
% Parse the input options
27670,55 → 29664,11
} if
options {def} forall
 
% Expand ordinals of the form ^NNN to ASCII
/expand {
/fncvals <<
/parse parse
/parseonly true
/parsefnc false
>> def
fncvals //parseinput exec
} bind def
barcode /ai //gs1process exec
/fncs exch def
/vals exch def
/ais exch def
 
% Parse out AIs
/ais [] def
/vals [] 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
[ vals aload pop counttomark 1 add index expand ] /vals exch def
pop pop
} loop
pop
 
dontlint not { ais vals //gs1lint exec pop } if
 
% 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 datamatrix data
/fnc1 -1 def
/dmtx [ fnc1 ] def
27731,7 → 29681,7
dup dmtx length ai [ exch {} forall ] putinterval
dup dmtx length ai length add val [ exch {} forall ] putinterval
/dmtx exch def
i ais length 1 sub ne aifixed ai 0 2 getinterval known not and { % Append FNC1
i ais length 1 sub ne fncs i get and { % Append FNC1
dmtx length 1 add array
dup 0 dmtx putinterval
dup dmtx length gssep {29} {fnc1} ifelse put
27778,18 → 29728,17
% --END ENCODER gs1datamatrix--
 
% --BEGIN ENCODER gs1datamatrixrectangular--
% --REQUIRES preamble raiseerror parseinput gs1lint renmatrix datamatrix--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renmatrix datamatrix--
% --DESC: GS1 Data Matrix Rectangular
% --EXAM: (01)03453120000011(17)120508(10)ABCD1234(410)9501101020917
% --EXOP:
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp gs1datamatrixrectangular 0.0 2021092800 74848 81714
%%BeginData: 135 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp gs1datamatrixrectangular 0.0 2022072900 77747 74258
%%BeginData: 92 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
dup /gs1lint dup /uk.co.terryburton.bwipp findresource put
dup /gs1process dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
dup /datamatrix dup /uk.co.terryburton.bwipp findresource put
begin
27800,8 → 29749,10
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/parse false def
/dontlint false def
/lintreqs true def
/dontdraw false def
/gssep false def
 
27816,55 → 29767,11
} if
options {def} forall
 
% Expand ordinals of the form ^NNN to ASCII
/expand {
/fncvals <<
/parse parse
/parseonly true
/parsefnc false
>> def
fncvals //parseinput exec
} bind def
barcode /ai //gs1process exec
/fncs exch def
/vals exch def
/ais exch def
 
% Parse out AIs
/ais [] def
/vals [] 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
[ vals aload pop counttomark 1 add index expand ] /vals exch def
pop pop
} loop
pop
 
dontlint not { ais vals //gs1lint exec pop } if
 
% 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 datamatrix data
/fnc1 -1 def
/dmtx [ fnc1 ] def
27877,7 → 29784,7
dup dmtx length ai [ exch {} forall ] putinterval
dup dmtx length ai length add val [ exch {} forall ] putinterval
/dmtx exch def
i ais length 1 sub ne aifixed ai 0 2 getinterval known not and { % Append FNC1
i ais length 1 sub ne fncs i get and { % Append FNC1
dmtx length 1 add array
dup 0 dmtx putinterval
dup dmtx length gssep {29} {fnc1} ifelse put
27924,18 → 29831,88
%%EndResource
% --END ENCODER gs1datamatrixrectangular--
 
% --BEGIN ENCODER gs1dldatamatrix--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renmatrix datamatrix--
% --DESC: GS1 Digital Link Data Matrix
% --EXAM: https://id.gs1.org/01/12312312312333/22/ABC%2d123?99=XYZ%2f987#test
% --EXOP:
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp gs1dldatamatrix 0.0 2022072900 70572 63571
%%BeginData: 59 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
10 dict
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
dup /gs1process dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
dup /datamatrix dup /uk.co.terryburton.bwipp findresource put
begin
/gs1dldatamatrix {
 
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
 
/ctx null def
/parse false def
/dontlint false def
/lintreqs true def
/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
 
% Parse the input
/fncvals <<
/parse parse
/parseonly true
/parsefnc false
>> def
/barcode barcode fncvals //parseinput exec def
 
barcode /dl //gs1process exec pop pop pop
 
% Get the result of encoding with datamatrix
options (parse) undef
options (dontdraw) true put
/args barcode options //datamatrix exec def
 
args (opt) options put
args
 
dontdraw not //renmatrix if
 
end
 
}
[/barcode] {null def} forall
bind def
/gs1dldatamatrix dup load /uk.co.terryburton.bwipp defineresource pop
end
/setpacking where {pop setpacking} if
%%EndData
%%EndResource
% --END ENCODER gs1dldatamatrix--
 
% --BEGIN ENCODER gs1qrcode--
% --REQUIRES preamble raiseerror parseinput gs1lint renmatrix qrcode--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process 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 2021092800 74363 77838
%%BeginData: 132 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp gs1qrcode 0.0 2022072900 77214 73742
%%BeginData: 89 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
dup /gs1lint dup /uk.co.terryburton.bwipp findresource put
10 dict
dup /gs1process dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
dup /qrcode dup /uk.co.terryburton.bwipp findresource put
begin
27946,8 → 29923,10
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/parse false def
/dontlint false def
/lintreqs true def
/dontdraw false def
 
% Parse the input options
27961,55 → 29940,11
} if
options {def} forall
 
% Expand ordinals of the form ^NNN to ASCII
/expand {
/fncvals <<
/parse parse
/parseonly true
/parsefnc false
>> def
fncvals //parseinput exec
} bind def
barcode /ai //gs1process exec
/fncs exch def
/vals exch def
/ais exch def
 
% Parse out AIs
/ais [] def
/vals [] 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
[ vals aload pop counttomark 1 add index expand ] /vals exch def
pop pop
} loop
pop
 
dontlint not { ais vals //gs1lint exec pop } if
 
% 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
28022,7 → 29957,7
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
i ais length 1 sub ne fncs i get and { % Append FNC1
qrc length 1 add array
dup 0 qrc putinterval
dup qrc length fnc1 put
28068,19 → 30003,89
%%EndResource
% --END ENCODER gs1qrcode--
 
% --BEGIN ENCODER gs1dlqrcode--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renmatrix qrcode--
% --DESC: GS1 Digital Link QR Code
% --EXAM: https://id.gs1.org/01/12312312312333/22/ABC%2d123?99=XYZ%2f987#test
% --EXOP:
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp gs1dlqrcode 0.0 2022072900 70548 63551
%%BeginData: 59 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
10 dict
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
dup /gs1process dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
dup /qrcode dup /uk.co.terryburton.bwipp findresource put
begin
/gs1dlqrcode {
 
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
 
/ctx null def
/parse false def
/dontlint false def
/lintreqs true def
/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
 
% Parse the input
/fncvals <<
/parse parse
/parseonly true
/parsefnc false
>> def
/barcode barcode fncvals //parseinput exec def
 
barcode /dl //gs1process exec pop pop pop
 
% Get the result of encoding with qrcode
options (parse) undef
options (dontdraw) true put
/args barcode options //qrcode exec def
 
args (opt) options put
args
 
dontdraw not //renmatrix if
 
end
 
}
[/barcode] {null def} forall
bind def
/gs1dlqrcode dup load /uk.co.terryburton.bwipp defineresource pop
end
/setpacking where {pop setpacking} if
%%EndData
%%EndResource
% --END ENCODER gs1dlqrcode--
 
% --BEGIN ENCODER gs1dotcode--
% --REQUIRES preamble raiseerror parseinput gs1lint renmatrix dotcode--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renmatrix dotcode--
% --DESC: GS1 DotCode
% --EXAM: (235)5vBZIF%!<B;?oa%(01)01234567890128(8008)19052001
% --EXOP: rows=16
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp gs1dotcode 0.0 2021092800 74370 81275
%%BeginData: 133 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp gs1dotcode 0.0 2022072900 77157 73683
%%BeginData: 90 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /parseinput dup /uk.co.terryburton.bwipp findresource put
dup /gs1lint dup /uk.co.terryburton.bwipp findresource put
dup /gs1process dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
dup /dotcode dup /uk.co.terryburton.bwipp findresource put
begin
28091,9 → 30096,11
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/parse false def
/dontlint false def
/lintreqs true def
 
% Parse the input options
options type /stringtype eq {
28106,55 → 30113,11
} if
options {def} forall
 
% Expand ordinals of the form ^NNN to ASCII
/expand {
/fncvals <<
/parse parse
/parseonly true
/parsefnc false
>> def
fncvals //parseinput exec
} bind def
barcode /ai //gs1process exec
/fncs exch def
/vals exch def
/ais exch def
 
% Parse out AIs
/ais [] def
/vals [] 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
[ vals aload pop counttomark 1 add index expand ] /vals exch def
pop pop
} loop
pop
 
dontlint not { ais vals //gs1lint exec pop } if
 
% 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 dotcode data
/fnc1 -1 def
/dmtx [ fnc1 ] def
28167,7 → 30130,7
dup dmtx length ai [ exch {} forall ] putinterval
dup dmtx length ai length add val [ exch {} forall ] putinterval
/dmtx exch def
i ais length 1 sub ne aifixed ai 0 2 getinterval known not and { % Append FNC1
i ais length 1 sub ne fncs i get and { % Append FNC1
dmtx length 1 add array
dup 0 dmtx putinterval
dup dmtx length fnc1 put
28214,15 → 30177,17
% --END ENCODER gs1dotcode--
 
% --BEGIN ENCODER hibccode39--
% --REQUIRES preamble raiseerror renlinear code39--
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear code39--
% --DESC: HIBC Code 39
% --EXAM: A123BJC5D6E71
% --EXOP: includetext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp hibccode39 0.0 2021092800 57669 57712
%%BeginData: 94 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp hibccode39 0.0 2022072900 63587 66902
%%BeginData: 103 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /code39 dup /uk.co.terryburton.bwipp findresource put
28234,6 → 30199,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/textfont /Courier def
/textsize 10 def
28257,10 → 30223,14
/textyoffset textyoffset cvr def
/textxoffset textxoffset cvr def
 
/hibccode39 //loadctx exec
 
% Create a string of the available characters
{
/barchars (0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%) def
/charvals 43 dict def
0 1 42 {charvals exch dup barchars exch 1 getinterval exch put} for
} ctxdef
 
% Validate the input
0 1 barcode length 1 sub {
28307,6 → 30277,8
 
dontdraw not //renlinear if
 
//unloadctx exec
 
end
 
}
28320,15 → 30292,17
% --END ENCODER hibccode39--
 
% --BEGIN ENCODER hibccode128--
% --REQUIRES preamble raiseerror parseinput renlinear code128--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renlinear code128--
% --DESC: HIBC Code 128
% --EXAM: A123BJC5D6E71
% --EXOP: includetext
% --RNDR: renlinear
%%BeginResource: uk.co.terryburton.bwipp hibccode128 0.0 2021092800 60457 63624
%%BeginData: 93 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp hibccode128 0.0 2022072900 69903 69718
%%BeginData: 102 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renlinear dup /uk.co.terryburton.bwipp findresource put
dup /code128 dup /uk.co.terryburton.bwipp findresource put
28340,6 → 30314,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/textfont /Courier def
/textsize 10 def
28363,10 → 30338,14
/textyoffset textyoffset cvr def
/textxoffset textxoffset cvr def
 
/hibccode128 //loadctx exec
 
% Create a string of the available characters
{
/barchars (0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%) def
/charvals 43 dict def
0 1 42 {charvals exch dup barchars exch 1 getinterval exch put} for
} ctxdef
 
% Validate the input
0 1 barcode length 1 sub {
28412,6 → 30391,8
 
dontdraw not //renlinear if
 
//unloadctx exec
 
end
 
}
28425,15 → 30406,17
% --END ENCODER hibccode128--
 
% --BEGIN ENCODER hibcdatamatrix--
% --REQUIRES preamble raiseerror parseinput renmatrix datamatrix--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix datamatrix--
% --DESC: HIBC Data Matrix
% --EXAM: A123BJC5D6E71
% --EXOP:
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp hibcdatamatrix 0.0 2021092800 58052 64626
%%BeginData: 76 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp hibcdatamatrix 0.0 2022072900 67434 67144
%%BeginData: 85 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
dup /datamatrix dup /uk.co.terryburton.bwipp findresource put
28445,6 → 30428,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/validatecheck false def
 
28459,10 → 30443,14
} if
options {def} forall
 
/hibcdatamatrix //loadctx exec
 
% Create a string of the available characters
{
/barchars (0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%) def
/charvals 43 dict def
0 1 42 {charvals exch dup barchars exch 1 getinterval exch put} for
} ctxdef
 
% Validate the input
0 1 barcode length 1 sub {
28500,6 → 30488,8
 
dontdraw not //renmatrix if
 
//unloadctx exec
 
end
 
}
28513,15 → 30503,17
% --END ENCODER hibcdatamatrix--
 
% --BEGIN ENCODER hibcdatamatrixrectangular--
% --REQUIRES preamble raiseerror parseinput renmatrix datamatrix--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix datamatrix--
% --DESC: HIBC Data Matrix Rectangular
% --EXAM: A123BJC5D6E71
% --EXOP:
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp hibcdatamatrixrectangular 0.0 2021092800 58173 61386
%%BeginData: 77 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp hibcdatamatrixrectangular 0.0 2022072900 67787 67360
%%BeginData: 86 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
dup /datamatrix dup /uk.co.terryburton.bwipp findresource put
28533,6 → 30525,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/validatecheck false def
 
28547,10 → 30540,14
} if
options {def} forall
 
/hibcdatamatrixrectangular //loadctx exec
 
% Create a string of the available characters
{
/barchars (0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%) def
/charvals 43 dict def
0 1 42 {charvals exch dup barchars exch 1 getinterval exch put} for
} ctxdef
 
% Validate the input
0 1 barcode length 1 sub {
28589,6 → 30586,8
 
dontdraw not //renmatrix if
 
//unloadctx exec
 
end
 
}
28602,15 → 30601,17
% --END ENCODER hibcdatamatrixrectangular--
 
% --BEGIN ENCODER hibcpdf417--
% --REQUIRES preamble raiseerror parseinput renmatrix pdf417--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix pdf417--
% --DESC: HIBC PDF417
% --EXAM: A123BJC5D6E71
% --EXOP:
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp hibcpdf417 0.0 2021092800 58331 61491
%%BeginData: 80 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp hibcpdf417 0.0 2022072900 67737 67465
%%BeginData: 89 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
dup /pdf417 dup /uk.co.terryburton.bwipp findresource put
28622,6 → 30623,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/columns 2 def
/validatecheck false def
28639,10 → 30641,14
 
/columns columns cvi def
 
/hibcpdf417 //loadctx exec
 
% Create a string of the available characters
{
/barchars (0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%) def
/charvals 43 dict def
0 1 42 {charvals exch dup barchars exch 1 getinterval exch put} for
} ctxdef
 
% Validate the input
0 1 barcode length 1 sub {
28681,6 → 30687,8
 
dontdraw not //renmatrix if
 
//unloadctx exec
 
end
 
}
28694,15 → 30702,17
% --END ENCODER hibcpdf417--
 
% --BEGIN ENCODER hibcmicropdf417--
% --REQUIRES preamble raiseerror parseinput renmatrix micropdf417--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix micropdf417--
% --DESC: HIBC MicroPDF417
% --EXAM: A123BJC5D6E71
% --EXOP:
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp hibcmicropdf417 0.0 2021092800 58253 61526
%%BeginData: 80 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp hibcmicropdf417 0.0 2022072900 67763 67500
%%BeginData: 89 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
dup /micropdf417 dup /uk.co.terryburton.bwipp findresource put
28714,6 → 30724,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/columns 2 def
/validatecheck false def
28731,10 → 30742,14
 
/columns columns cvi def
 
/hibcmicropdf417 //loadctx exec
 
% Create a string of the available characters
{
/barchars (0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%) def
/charvals 43 dict def
0 1 42 {charvals exch dup barchars exch 1 getinterval exch put} for
} ctxdef
 
% Validate the input
0 1 barcode length 1 sub {
28773,6 → 30788,8
 
dontdraw not //renmatrix if
 
//unloadctx exec
 
end
 
}
28786,15 → 30803,17
% --END ENCODER hibcmicropdf417--
 
% --BEGIN ENCODER hibcqrcode--
% --REQUIRES preamble raiseerror parseinput renmatrix qrcode--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix qrcode--
% --DESC: HIBC QR Code
% --EXAM: A123BJC5D6E71
% --EXOP:
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp hibcqrcode 0.0 2021092800 61300 64470
%%BeginData: 76 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp hibcqrcode 0.0 2022072900 71782 71498
%%BeginData: 85 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
dup /qrcode dup /uk.co.terryburton.bwipp findresource put
28806,6 → 30825,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/validatecheck false def
 
28820,10 → 30840,14
} if
options {def} forall
 
/hibcqrcode //loadctx exec
 
% Create a string of the available characters
{
/barchars (0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%) def
/charvals 43 dict def
0 1 42 {charvals exch dup barchars exch 1 getinterval exch put} for
} ctxdef
 
% Validate the input
0 1 barcode length 1 sub {
28861,6 → 30885,8
 
dontdraw not //renmatrix if
 
//unloadctx exec
 
end
 
}
28874,15 → 30900,17
% --END ENCODER hibcqrcode--
 
% --BEGIN ENCODER hibccodablockf--
% --REQUIRES preamble raiseerror parseinput renmatrix codablockf--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix codablockf--
% --DESC: HIBC Codablock F
% --EXAM: A123BJC5D6E71
% --EXOP:
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp hibccodablockf 0.0 2021092800 57904 61298
%%BeginData: 76 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp hibccodablockf 0.0 2022072900 67542 67144
%%BeginData: 85 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
dup /codablockf dup /uk.co.terryburton.bwipp findresource put
28894,6 → 30922,7
/options exch def % We are given an option string
/barcode exch def % We are given a barcode string
 
/ctx null def
/dontdraw false def
/validatecheck false def
 
28908,10 → 30937,14
} if
options {def} forall
 
/hibccodablockf //loadctx exec
 
% Create a string of the available characters
{
/barchars (0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%) def
/charvals 43 dict def
0 1 42 {charvals exch dup barchars exch 1 getinterval exch put} for
} ctxdef
 
% Validate the input
0 1 barcode length 1 sub {
28949,6 → 30982,8
 
dontdraw not //renmatrix if
 
//unloadctx exec
 
end
 
}
28962,15 → 30997,17
% --END ENCODER hibccodablockf--
 
% --BEGIN ENCODER hibcazteccode--
% --REQUIRES preamble raiseerror parseinput renmatrix azteccode--
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix azteccode--
% --DESC: HIBC Aztec Code
% --EXAM: A123BJC5D6E71
% --EXOP:
% --RNDR: renmatrix
%%BeginResource: uk.co.terryburton.bwipp hibcazteccode 0.0 2021092800 58002 61059
%%BeginData: 76 ASCII Lines
%%BeginResource: uk.co.terryburton.bwipp hibcazteccode 0.0 2022072900 67432 67241
%%BeginData: 85 ASCII Lines
/setpacking where {pop currentpacking true setpacking} if
1 dict
10 dict
dup /loadctx dup /uk.co.terryburton.bwipp findresource put
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
dup /azteccode dup /uk.co.terryburton.bwipp findresource put
28982,6 → 31019,7
/options exch def % We are given an option stri