1,6 → 1,6 |
%!PS |
|
% Barcode Writer in Pure PostScript - Version 2022-07-29 |
% Barcode Writer in Pure PostScript - Version 2021-09-28 |
% 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 2022072900 29629 32838 |
%%BeginResource: Category uk.co.terryburton.bwipp 0.0 2021092800 29733 32838 |
%%BeginData: 6 ASCII Lines |
currentglobal |
true setglobal |
44,67 → 44,12 |
%%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 2022072900 39029 38860 |
%%BeginResource: uk.co.terryburton.bwipp raiseerror 0.0 2021092800 39041 38872 |
%%BeginData: 15 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 dict |
begin |
/raiseerror { |
$error exch /errorinfo exch put |
123,21 → 68,17 |
% --END RESOURCE raiseerror-- |
|
% --BEGIN RESOURCE parseinput-- |
% --REQUIRES preamble loadctx unloadctx raiseerror-- |
%%BeginResource: uk.co.terryburton.bwipp parseinput 0.0 2022072900 73481 69190 |
%%BeginData: 174 ASCII Lines |
% --REQUIRES preamble raiseerror-- |
%%BeginResource: uk.co.terryburton.bwipp parseinput 0.0 2021092800 58513 58076 |
%%BeginData: 129 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
4 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
begin |
/parseinput { |
|
20 dict begin |
6 dict begin |
|
/parseinput //loadctx exec |
|
/fncvals exch def |
/barcode exch def |
|
146,21 → 87,6 |
/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 |
185,35 → 111,11 |
|
% parse |
parse { |
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 length 3 ge { |
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 |
290,8 → 192,6 |
0 1 j 1 sub { 1 index exch dup msg exch get put } for |
} ifelse |
|
//unloadctx exec |
|
end |
|
} |
304,231 → 204,762 |
%%EndResource |
% --END RESOURCE parseinput-- |
|
% --BEGIN RESOURCE gs1process-- |
% --REQUIRES preamble loadctx unloadctx parseinput raiseerror-- |
%%BeginResource: uk.co.terryburton.bwipp gs1process 0.0 2022072900 564308 592071 |
%%BeginData: 2899 ASCII Lines |
% --BEGIN RESOURCE gs1lint-- |
% --REQUIRES preamble raiseerror-- |
%%BeginResource: uk.co.terryburton.bwipp gs1lint 0.0 2021092800 346062 386888 |
%%BeginData: 1674 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
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 |
2 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
begin |
/gs1process { |
/gs1lint { |
|
20 dict begin |
|
/gs1process //loadctx exec |
/vals exch def |
/ais exch def |
|
/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 { |
{ |
% Extracted from the GS1 Syntax Dictionary |
(%) 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 |
|
/gs1syntax << |
|
<< |
/parts [ |
<< /cset /N /min 18 /max 18 /opt false /linters [ /lintcsum /lintkey ] >> |
[ |
<< /cset /N /min 18 /max 18 /check [ /lintcsum /lintkey ] >> |
] |
/dlpkey [ ] |
>> |
(00) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 14 /max 14 /opt false /linters [ /lintcsum /lintkey ] >> |
[ |
<< /cset /N /min 14 /max 14 /check [ /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 |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 20 /opt false /linters [] >> |
[ |
<< /cset /X /min 1 /max 20 /check [] >> |
] |
/req [ [ (01) (02) (8006) (8026) ] ] |
>> |
(10) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 6 /max 6 /opt false /linters [ /lintyymmd0 ] >> |
[ |
<< /cset /N /min 6 /max 6 /check [ /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 |
|
<< |
/parts [ |
<< /cset /N /min 2 /max 2 /opt false /linters [] >> |
[ |
<< /cset /N /min 2 /max 2 /check [] >> |
] |
/req [ [ (01) (02) (8006) (8026) ] ] |
>> |
(20) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 20 /opt false /linters [] >> |
[ |
<< /cset /X /min 1 /max 20 /check [] >> |
] |
/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 |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 28 /opt false /linters [] >> |
[ |
<< /cset /X /min 1 /max 28 /check [] >> |
] |
/req [ [ (01) ] ] |
>> |
(235) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 30 /opt false /linters [] >> |
[ |
<< /cset /X /min 1 /max 30 /check [] >> |
] |
/req [ [ (01) (02) (8006) (8026) ] ] |
>> |
(240) exch dup |
(241) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 1 /max 6 /opt false /linters [] >> |
[ |
<< /cset /N /min 1 /max 6 /check [] >> |
] |
/req [ [ (01) (02) (8006) (8026) ] ] |
>> |
(242) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 20 /opt false /linters [] >> |
[ |
<< /cset /X /min 1 /max 20 /check [] >> |
] |
/req [ [ (01) ] ] |
>> |
(243) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 30 /opt false /linters [] >> |
[ |
<< /cset /X /min 1 /max 30 /check [] >> |
] |
/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 |
|
<< |
/parts [ |
<< /cset /N /min 13 /max 13 /opt false /linters [ /lintcsum /lintkey ] >> |
<< /cset /X /min 1 /max 17 /opt true /linters [] >> |
[ |
<< /cset /N /min 13 /max 13 /check [ /lintcsum /lintkey ] >> |
<< /cset /X /min 0 /max 17 /check [] >> |
] |
/dlpkey [ ] |
>> |
(253) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 20 /opt false /linters [] >> |
[ |
<< /cset /X /min 1 /max 20 /check [] >> |
] |
/req [ [ (414) ] ] |
>> |
(254) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 13 /max 13 /opt false /linters [ /lintcsum /lintkey ] >> |
<< /cset /N /min 1 /max 12 /opt true /linters [] >> |
[ |
<< /cset /N /min 13 /max 13 /check [ /lintcsum /lintkey ] >> |
<< /cset /N /min 0 /max 12 /check [] >> |
] |
/ex [ (01) (02) (415) (8006) (8020) (8026) ] |
/dlpkey [ ] |
>> |
(255) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 1 /max 8 /opt false /linters [] >> |
[ |
<< /cset /N /min 1 /max 8 /check [] >> |
] |
/req [ [ (01) (02) ] ] |
>> |
(30) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 6 /max 6 /opt false /linters [] >> |
[ |
<< /cset /N /min 6 /max 6 /check [] >> |
] |
/ex [ (310n) ] |
/req [ [ (01) (02) ] ] |
>> |
(3100) exch dup |
(3101) exch dup |
(3102) exch dup |
535,15 → 966,6 |
(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 |
550,15 → 972,6 |
(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 |
565,15 → 978,6 |
(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 |
580,15 → 984,6 |
(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 |
595,15 → 990,6 |
(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 |
610,15 → 996,6 |
(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 |
625,15 → 1002,6 |
(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 |
640,15 → 1008,6 |
(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 |
655,15 → 1014,6 |
(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 |
670,15 → 1020,6 |
(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 |
685,15 → 1026,6 |
(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 |
700,15 → 1032,6 |
(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 |
715,15 → 1038,6 |
(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 |
730,15 → 1044,6 |
(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 |
745,15 → 1050,6 |
(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 |
760,15 → 1056,6 |
(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 |
775,15 → 1062,6 |
(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 |
790,15 → 1068,6 |
(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 |
805,15 → 1074,6 |
(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 |
820,15 → 1080,6 |
(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 |
835,15 → 1086,6 |
(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 |
850,15 → 1092,6 |
(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 |
865,15 → 1098,6 |
(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 |
880,15 → 1104,6 |
(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 |
895,15 → 1110,6 |
(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 |
910,15 → 1116,6 |
(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 |
925,15 → 1122,6 |
(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 |
940,15 → 1128,6 |
(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 |
955,15 → 1134,6 |
(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 |
970,15 → 1140,6 |
(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 |
985,15 → 1146,6 |
(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 |
1000,15 → 1152,6 |
(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 |
1015,15 → 1158,6 |
(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 |
1030,15 → 1164,6 |
(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 |
1045,15 → 1170,6 |
(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 |
1060,15 → 1176,6 |
(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 |
1075,15 → 1182,6 |
(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 |
1090,15 → 1188,6 |
(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 |
1105,15 → 1194,6 |
(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 |
1120,15 → 1200,6 |
(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 |
1135,15 → 1206,6 |
(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 |
1150,15 → 1212,6 |
(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 |
1165,15 → 1218,6 |
(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 |
1180,15 → 1224,6 |
(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 |
1195,15 → 1230,6 |
(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 |
1210,15 → 1236,6 |
(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 |
1225,15 → 1242,6 |
(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 |
1240,15 → 1248,6 |
(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 |
1255,15 → 1254,6 |
(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 |
1270,15 → 1260,6 |
(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 |
1285,15 → 1266,6 |
(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 |
1300,15 → 1272,6 |
(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 |
1317,22 → 1280,15 |
(3695) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 1 /max 8 /opt false /linters [] >> |
[ |
<< /cset /N /min 1 /max 8 /check [] >> |
] |
/req [ [ (00) ] [ (02) (8026) ] ] |
>> |
(37) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 1 /max 15 /opt false /linters [] >> |
[ |
<< /cset /N /min 1 /max 15 /check [] >> |
] |
/ex [ (390n) (391n) (394n) (8111) ] |
/req [ [ (255) (8020) ] ] |
>> |
(3900) exch dup |
(3901) exch dup |
(3902) exch dup |
1345,14 → 1301,10 |
(3909) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 3 /max 3 /opt false /linters [ /lintiso4217 ] >> |
<< /cset /N /min 1 /max 15 /opt false /linters [] >> |
[ |
<< /cset /N /min 3 /max 3 /check [ /lintiso4217 ] >> |
<< /cset /N /min 1 /max 15 /check [] >> |
] |
/ex [ (391n) ] |
/req [ [ (8020) ] ] |
>> |
(3910) exch dup |
(3911) exch dup |
(3912) exch dup |
1365,13 → 1317,9 |
(3919) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 1 /max 15 /opt false /linters [] >> |
[ |
<< /cset /N /min 1 /max 15 /check [] >> |
] |
/ex [ (392n) (393n) ] |
/req [ [ (01) ] [ (30) (31nn) (32nn) (35nn) (36nn) ] ] |
>> |
(3920) exch dup |
(3921) exch dup |
(3922) exch dup |
1384,14 → 1332,10 |
(3929) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 3 /max 3 /opt false /linters [ /lintiso4217 ] >> |
<< /cset /N /min 1 /max 15 /opt false /linters [] >> |
[ |
<< /cset /N /min 3 /max 3 /check [ /lintiso4217 ] >> |
<< /cset /N /min 1 /max 15 /check [] >> |
] |
/ex [ (393n) ] |
/req [ [ (30) (31nn) (32nn) (35nn) (36nn) ] ] |
>> |
(3930) exch dup |
(3931) exch dup |
(3932) exch dup |
1404,13 → 1348,9 |
(3939) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 4 /max 4 /opt false /linters [] >> |
[ |
<< /cset /N /min 4 /max 4 /check [] >> |
] |
/ex [ (394n) (8111) ] |
/req [ [ (255) ] ] |
>> |
(3940) exch dup |
(3941) exch dup |
(3942) exch dup |
1417,13 → 1357,9 |
(3943) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 6 /max 6 /opt false /linters [] >> |
[ |
<< /cset /N /min 6 /max 6 /check [] >> |
] |
/ex [ (392n) (393n) (395n) (8005) ] |
/req [ [ (30) (31nn) (32nn) (35nn) (36nn) ] ] |
>> |
(3950) exch dup |
(3951) exch dup |
(3952) exch dup |
1432,470 → 1368,264 |
(3955) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 30 /opt false /linters [] >> |
[ |
<< /cset /X /min 1 /max 30 /check [] >> |
] |
>> |
(400) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 30 /opt false /linters [ /lintkey ] >> |
[ |
<< /cset /X /min 1 /max 30 /check [ /lintkey ] >> |
] |
/dlpkey [ ] |
>> |
(401) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 17 /max 17 /opt false /linters [ /lintcsum /lintkey ] >> |
[ |
<< /cset /N /min 17 /max 17 /check [ /lintcsum /lintkey ] >> |
] |
/dlpkey [ ] |
>> |
(402) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 30 /opt false /linters [] >> |
[ |
<< /cset /X /min 1 /max 30 /check [] >> |
] |
/req [ [ (00) ] ] |
>> |
(403) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 13 /max 13 /opt false /linters [ /lintcsum /lintkey ] >> |
[ |
<< /cset /N /min 13 /max 13 /check [ /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 |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 20 /opt false /linters [] >> |
[ |
<< /cset /X /min 1 /max 20 /check [] >> |
] |
/ex [ (421) ] |
>> |
(420) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 3 /max 3 /opt false /linters [ /lintiso3166 ] >> |
<< /cset /X /min 1 /max 9 /opt false /linters [] >> |
[ |
<< /cset /N /min 3 /max 3 /check [ /lintiso3166 ] >> |
<< /cset /X /min 1 /max 9 /check [] >> |
] |
/ex [ (4307) ] |
>> |
(421) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 3 /max 3 /opt false /linters [ /lintiso3166 ] >> |
[ |
<< /cset /N /min 3 /max 3 /check [ /lintiso3166 ] >> |
] |
/ex [ (426) ] |
/req [ [ (01) (02) (8006) (8026) ] ] |
>> |
(422) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 1 /max 15 /opt false /linters [ /lintiso3166list ] >> |
[ |
<< /cset /N /min 3 /max 15 /check [ /lintiso3166list ] >> |
] |
/ex [ (426) ] |
/req [ [ (01) (02) ] ] |
>> |
(423) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 3 /max 3 /opt false /linters [ /lintiso3166 ] >> |
[ |
<< /cset /N /min 3 /max 3 /check [ /lintiso3166 ] >> |
] |
/ex [ (426) ] |
/req [ [ (01) (02) ] ] |
>> |
(424) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 1 /max 15 /opt false /linters [ /lintiso3166list ] >> |
[ |
<< /cset /N /min 3 /max 15 /check [ /lintiso3166list ] >> |
] |
/ex [ (426) ] |
/req [ [ (01) (02) ] ] |
>> |
(425) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 3 /max 3 /opt false /linters [ /lintiso3166 ] >> |
[ |
<< /cset /N /min 3 /max 3 /check [ /lintiso3166 ] >> |
] |
/req [ [ (01) (02) ] ] |
>> |
(426) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 3 /opt false /linters [] >> |
[ |
<< /cset /X /min 1 /max 3 /check [] >> |
] |
/req [ [ (01) (02) ] [ (422) ] ] |
>> |
(427) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 35 /opt false /linters [ /lintpcenc ] >> |
[ |
<< /cset /X /min 1 /max 35 /check [ /lintpcenc ] >> |
] |
/req [ [ (00) ] ] |
>> |
(4300) exch dup |
(4301) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 70 /opt false /linters [ /lintpcenc ] >> |
[ |
<< /cset /X /min 1 /max 70 /check [ /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 |
|
<< |
/parts [ |
<< /cset /X /min 2 /max 2 /opt false /linters [ /lintiso3166alpha2 ] >> |
[ |
<< /cset /X /min 2 /max 2 /check [ /lintiso3166alpha2 ] >> |
] |
/req [ [ (00) ] ] |
>> |
(4307) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 30 /opt false /linters [] >> |
[ |
<< /cset /X /min 1 /max 30 /check [] >> |
] |
/req [ [ (00) ] ] |
>> |
(4308) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 20 /max 20 /opt false /linters [ /lintlatlong ] >> |
[ |
<< /cset /X /min 1 /max 35 /check [ /lintpcenc ] >> |
] |
/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 |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 70 /opt false /linters [ /lintpcenc ] >> |
[ |
<< /cset /X /min 1 /max 70 /check [ /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 |
|
<< |
/parts [ |
<< /cset /X /min 2 /max 2 /opt false /linters [ /lintiso3166alpha2 ] >> |
[ |
<< /cset /X /min 2 /max 2 /check [ /lintiso3166alpha2 ] >> |
] |
/req [ [ (00) ] ] |
>> |
(4317) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 20 /opt false /linters [] >> |
[ |
<< /cset /X /min 1 /max 20 /check [] >> |
] |
/req [ [ (00) ] ] |
>> |
(4318) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 30 /opt false /linters [] >> |
[ |
<< /cset /X /min 1 /max 30 /check [] >> |
] |
/req [ [ (00) ] ] |
>> |
(4319) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 35 /opt false /linters [ /lintpcenc ] >> |
[ |
<< /cset /X /min 1 /max 35 /check [ /lintpcenc ] >> |
] |
/req [ [ (00) ] ] |
>> |
(4320) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 1 /max 1 /opt false /linters [ /lintyesno ] >> |
[ |
<< /cset /N /min 1 /max 1 /check [ /lintyesno ] >> |
] |
/req [ [ (00) ] ] |
>> |
(4321) exch dup |
(4322) exch dup |
(4323) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 6 /max 6 /opt false /linters [ /lintyymmd0 ] >> |
<< /cset /N /min 4 /max 4 /opt false /linters [ /linthhmm ] >> |
[ |
<< /cset /N /min 6 /max 6 /check [ /lintyymmd0 ] >> |
<< /cset /N /min 4 /max 4 /check [ /linthhmm ] >> |
] |
/req [ [ (00) ] ] |
>> |
(4324) exch dup |
(4325) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 6 /max 6 /opt false /linters [ /lintyymmdd ] >> |
[ |
<< /cset /N /min 6 /max 6 /check [ /lintyymmdd ] >> |
] |
/req [ [ (00) ] ] |
>> |
(4326) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 13 /max 13 /opt false /linters [] >> |
[ |
<< /cset /N /min 13 /max 13 /check [] >> |
] |
/req [ [ (01) (02) (8006) (8026) ] ] |
>> |
(7001) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 30 /opt false /linters [] >> |
[ |
<< /cset /X /min 1 /max 30 /check [] >> |
] |
/req [ [ (01) (02) ] ] |
>> |
(7002) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 6 /max 6 /opt false /linters [ /lintyymmdd ] >> |
<< /cset /N /min 4 /max 4 /opt false /linters [ /linthhmm ] >> |
[ |
<< /cset /N /min 6 /max 6 /check [ /lintyymmdd ] >> |
<< /cset /N /min 4 /max 4 /check [ /linthhmm ] >> |
] |
/req [ [ (01) (02) ] ] |
>> |
(7003) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 1 /max 4 /opt false /linters [] >> |
[ |
<< /cset /N /min 1 /max 4 /check [] >> |
] |
/req [ [ (01) ] [ (10) ] ] |
>> |
(7004) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 12 /opt false /linters [] >> |
[ |
<< /cset /X /min 1 /max 12 /check [] >> |
] |
/req [ [ (01) (02) ] ] |
>> |
(7005) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 6 /max 6 /opt false /linters [ /lintyymmdd ] >> |
[ |
<< /cset /N /min 6 /max 6 /check [ /lintyymmdd ] >> |
] |
/req [ [ (01) (02) ] ] |
>> |
(7006) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 6 /max 6 /opt false /linters [ /lintyymmdd ] >> |
<< /cset /N /min 6 /max 6 /opt true /linters [ /lintyymmdd ] >> |
[ |
<< /cset /N /min 6 /max 6 /check [ /lintyymmdd ] >> |
<< /cset /N /min 0 /max 6 /check [ /lintyymmdd ] >> |
] |
/req [ [ (01) (02) ] ] |
>> |
(7007) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 3 /opt false /linters [] >> |
[ |
<< /cset /X /min 1 /max 3 /check [] >> |
] |
/req [ [ (01) (02) ] ] |
>> |
(7008) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 10 /opt false /linters [] >> |
[ |
<< /cset /X /min 1 /max 10 /check [] >> |
] |
/req [ [ (01) (02) ] ] |
>> |
(7009) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 2 /opt false /linters [] >> |
[ |
<< /cset /X /min 1 /max 2 /check [] >> |
] |
/req [ [ (01) (02) ] ] |
>> |
(7010) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 20 /opt false /linters [] >> |
[ |
<< /cset /X /min 1 /max 20 /check [] >> |
] |
/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 |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 30 /opt false /linters [ /lintkey ] >> |
[ |
<< /cset /X /min 1 /max 30 /check [ /lintkey ] >> |
] |
>> |
(7023) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 3 /max 3 /opt false /linters [ /lintiso3166999 ] >> |
<< /cset /X /min 1 /max 27 /opt false /linters [] >> |
[ |
<< /cset /N /min 3 /max 3 /check [ /lintiso3166999 ] >> |
<< /cset /X /min 1 /max 27 /check [] >> |
] |
/req [ [ (01) (02) ] ] |
>> |
(7030) exch dup |
(7031) exch dup |
(7032) exch dup |
1908,23 → 1638,18 |
(7039) exch dup |
pop |
|
<< |
/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 ] >> |
[ |
<< /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 ] >> |
] |
>> |
(7040) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 20 /opt false /linters [] >> |
[ |
<< /cset /X /min 1 /max 20 /check [] >> |
] |
/req [ [ (01) ] ] |
>> |
(710) exch dup |
(711) exch dup |
(712) exch dup |
1933,13 → 1658,10 |
(715) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 2 /max 2 /opt false /linters [] >> |
<< /cset /X /min 1 /max 28 /opt false /linters [] >> |
[ |
<< /cset /X /min 2 /max 2 /check [] >> |
<< /cset /X /min 1 /max 28 /check [] >> |
] |
/req [ [ (01) (8004) ] ] |
>> |
(7230) exch dup |
(7231) exch dup |
(7232) exch dup |
1952,235 → 1674,157 |
(7239) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 20 /opt false /linters [] >> |
[ |
<< /cset /X /min 1 /max 20 /check [] >> |
] |
/req [ [ (01) (8006) ] ] |
>> |
(7240) exch dup |
pop |
|
<< |
/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 [] >> |
[ |
<< /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 [] >> |
] |
/req [ [ (01) ] ] |
>> |
(8001) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 20 /opt false /linters [] >> |
[ |
<< /cset /X /min 1 /max 20 /check [] >> |
] |
>> |
(8002) exch dup |
pop |
|
<< |
/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 [] >> |
[ |
<< /cset /N /min 1 /max 1 /check [ /lintzero ] >> |
<< /cset /N /min 13 /max 13 /check [ /lintcsum /lintkey ] >> |
<< /cset /X /min 0 /max 16 /check [] >> |
] |
/dlpkey [ ] |
>> |
(8003) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 30 /opt false /linters [ /lintkey ] >> |
[ |
<< /cset /X /min 1 /max 30 /check [ /lintkey ] >> |
] |
/dlpkey [ [ (7040) ] ] |
>> |
(8004) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 6 /max 6 /opt false /linters [] >> |
[ |
<< /cset /N /min 6 /max 6 /check [] >> |
] |
/req [ [ (01) (02) ] ] |
>> |
(8005) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 14 /max 14 /opt false /linters [ /lintcsum ] >> |
<< /cset /N /min 4 /max 4 /opt false /linters [ /lintpieceoftotal ] >> |
[ |
<< /cset /N /min 14 /max 14 /check [ /lintcsum ] >> |
<< /cset /N /min 4 /max 4 /check [ /lintpieceoftotal ] >> |
] |
/ex [ (01) (37) ] |
/dlpkey [ [ (22) (10) (21) ] ] |
>> |
(8006) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 34 /opt false /linters [ /lintiban ] >> |
[ |
<< /cset /X /min 1 /max 34 /check [ /lintiban ] >> |
] |
/req [ [ (415) ] ] |
>> |
(8007) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 8 /max 8 /opt false /linters [ /lintyymmddhh ] >> |
<< /cset /N /min 1 /max 4 /opt true /linters [ /lintmmoptss ] >> |
[ |
<< /cset /N /min 8 /max 8 /check [ /lintyymmddhh ] >> |
<< /cset /N /min 0 /max 4 /check [ /lintmmoptss ] >> |
] |
/req [ [ (01) (02) ] ] |
>> |
(8008) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 50 /opt false /linters [] >> |
[ |
<< /cset /X /min 1 /max 50 /check [] >> |
] |
/req [ [ (00) (01) ] ] |
>> |
(8009) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /Y /min 1 /max 30 /opt false /linters [ /lintkey ] >> |
[ |
<< /cset /C /min 1 /max 30 /check [ /lintkey ] >> |
] |
/dlpkey [ [ (8011) ] ] |
>> |
(8010) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 1 /max 12 /opt false /linters [ /lintnozeroprefix ] >> |
[ |
<< /cset /N /min 1 /max 12 /check [ /lintnozeroprefix ] >> |
] |
/req [ [ (8010) ] ] |
>> |
(8011) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 20 /opt false /linters [] >> |
[ |
<< /cset /X /min 1 /max 20 /check [] >> |
] |
/req [ [ (01) (8006) ] ] |
>> |
(8012) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 25 /opt false /linters [ /lintcsumalpha /lintkey ] >> |
[ |
<< /cset /X /min 1 /max 25 /check [ /lintcsumalpha /lintkey ] >> |
] |
/dlpkey [ ] |
>> |
(8013) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 18 /max 18 /opt false /linters [ /lintcsum ] >> |
[ |
<< /cset /N /min 18 /max 18 /check [ /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 |
|
<< |
/parts [ |
<< /cset /N /min 1 /max 10 /opt false /linters [] >> |
[ |
<< /cset /N /min 1 /max 10 /check [] >> |
] |
/req [ [ (8017) (8018) ] ] |
>> |
(8019) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 25 /opt false /linters [] >> |
[ |
<< /cset /X /min 1 /max 25 /check [] >> |
] |
/req [ [ (415) ] ] |
>> |
(8020) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 14 /max 14 /opt false /linters [ /lintcsum ] >> |
<< /cset /N /min 4 /max 4 /opt false /linters [ /lintpieceoftotal ] >> |
[ |
<< /cset /N /min 14 /max 14 /check [ /lintcsum ] >> |
<< /cset /N /min 4 /max 4 /check [ /lintpieceoftotal ] >> |
] |
/ex [ (02) (8006) ] |
/req [ [ (37) ] ] |
>> |
(8026) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 70 /opt false /linters [ /lintcouponcode ] >> |
[ |
<< /cset /X /min 1 /max 70 /check [ /lintcouponcode ] >> |
] |
>> |
(8110) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /N /min 4 /max 4 /opt false /linters [] >> |
[ |
<< /cset /N /min 4 /max 4 /check [] >> |
] |
/req [ [ (255) ] ] |
>> |
(8111) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 70 /opt false /linters [ /lintcouponposoffer ] >> |
[ |
<< /cset /X /min 1 /max 70 /check [ /lintcouponposoffer ] >> |
] |
>> |
(8112) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 70 /opt false /linters [] >> |
[ |
<< /cset /X /min 1 /max 70 /check [] >> |
] |
/req [ [ (01) ] ] |
>> |
(8200) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 30 /opt false /linters [] >> |
[ |
<< /cset /X /min 1 /max 30 /check [] >> |
] |
>> |
(90) exch dup |
pop |
|
<< |
/parts [ |
<< /cset /X /min 1 /max 90 /opt false /linters [] >> |
[ |
<< /cset /X /min 1 /max 90 /check [] >> |
] |
>> |
(91) exch dup |
(92) exch dup |
(93) exch dup |
2193,907 → 1837,27 |
pop |
|
>> def |
} ctxdef |
|
% 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 |
} { |
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 |
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 |
} ifelse |
} 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 |
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 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 |
<< /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 |
} forall |
dup not {exit} if |
val length 0 ne { % Not all data consumed by components |
val length 0 ne { |
pop /bwipp.GS1valueTooLong (Too long) false exit |
} if |
} { |
3108,115 → 1872,26 |
dup 5 ai length add 4 -1 roll putinterval |
//raiseerror exec |
} if |
true |
|
% 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 |
/gs1process dup load /uk.co.terryburton.bwipp defineresource pop |
/gs1lint dup load /uk.co.terryburton.bwipp defineresource pop |
end |
/setpacking where {pop setpacking} if |
%%EndData |
%%EndResource |
% --END RESOURCE gs1process-- |
% --END RESOURCE gs1lint-- |
|
% --BEGIN RENDERER renlinear-- |
% --REQUIRES preamble raiseerror-- |
%%BeginResource: uk.co.terryburton.bwipp renlinear 0.0 2022072900 75424 74734 |
%%BeginData: 246 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp renlinear 0.0 2021092800 74624 73842 |
%%BeginData: 239 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
begin |
/renlinear { |
3295,7 → 1970,7 |
|
% Create bar elements and put them into the bars array |
/bars sbs length 1 add 2 idiv array def |
/pixx 0 def /pixy 0 def |
/x 0.00 def /maxh 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 |
3302,11 → 1977,11 |
/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 pixx add def % Centre of the bar = pixx + d/2 |
/c d 2 div x add def % Centre of the bar = x + 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 pixy gt {/pixy h y add def} if |
h y add maxh gt {/maxh h y add def} if |
} { |
bars i 2 idiv -1 put % Dummy entry |
} ifelse |
3313,7 → 1988,7 |
} { |
/d sbs i get spaceratio mul spaceratio sub 1 add def % d = digit*r-r+1 |
} ifelse |
/pixx pixx d add def % pixx += d |
/x x d add def % x+=d |
} for |
|
gsave |
3322,7 → 1997,7 |
|
% Force symbol to given width |
width 0 ne { |
width 72 mul pixx div 1 scale |
width 72 mul x div 1 scale |
} if |
|
% Set RGB or CMYK color depending on length of given hex string |
3339,10 → 2014,10 |
% Display the border and background |
newpath |
borderleft neg borderbottom neg moveto |
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 |
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 |
closepath |
backgroundcolor (unset) ne { gsave backgroundcolor setanycolor fill grestore } if |
showborder { |
3354,22 → 2029,15 |
|
% 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 % 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 |
aload pop newpath setlinewidth moveto 0 exch rlineto stroke |
} { |
pop |
} ifelse |
} forall |
fill |
grestore |
|
% Display the text for elements in the text array |
3416,18 → 2084,18 |
/textascent exch def |
/textwidth tstr stringwidth pop tstr length 1 sub textgaps mul add def |
|
/textxpos textxoffset pixx textwidth sub 2 div add def |
/textxpos textxoffset x textwidth sub 2 div add def |
textxalign (left) eq { /textxpos textxoffset def } if |
textxalign (right) eq { /textxpos pixx textxoffset sub textwidth sub def } if |
textxalign (right) eq { /textxpos x textxoffset sub textwidth sub def } if |
textxalign (offleft) eq { /textxpos textwidth textxoffset add neg def } if |
textxalign (offright) eq { /textxpos pixx textxoffset add def } if |
textxalign (justify) eq textwidth pixx lt and { |
textxalign (offright) eq { /textxpos x textxoffset add def } if |
textxalign (justify) eq textwidth x lt and { |
/textxpos 0 def |
/textgaps pixx textwidth sub tstr length 1 sub div def |
/textgaps x 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 |
textyalign (center) eq { /textypos textyoffset pixy textascent sub 2 div add def } if |
textyalign (above) eq { /textypos textyoffset maxh add 1 add def } if |
textyalign (center) eq { /textypos textyoffset maxh textascent sub 2 div add def } if |
textxpos textypos moveto textgaps 0 tstr ashow |
} ifelse |
} if |
3444,7 → 2112,7 |
} if |
guardrightpos 0 ne { |
newpath |
guardrightpos pixx add guardwidth sub guardrightypos guardheight 2 div add moveto |
guardrightpos x add guardwidth sub guardrightypos guardheight 2 div add moveto |
guardwidth guardheight -2 div rlineto |
guardwidth neg guardheight -2 div rlineto |
stroke |
3467,10 → 2135,10 |
|
% --BEGIN RENDERER renmatrix-- |
% --REQUIRES preamble raiseerror-- |
%%BeginResource: uk.co.terryburton.bwipp renmatrix 0.0 2022072900 90555 89769 |
%%BeginResource: uk.co.terryburton.bwipp renmatrix 0.0 2021092800 90671 89573 |
%%BeginData: 306 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
begin |
/renmatrix { |
3749,14 → 2417,14 |
/textascent exch def |
/textwidth tstr stringwidth pop tstr length 1 sub textgaps mul add def |
|
/textxpos textxoffset pixx textwidth sub 2 div add def |
/textxpos textxoffset x textwidth sub 2 div add def |
textxalign (left) eq { /textxpos textxoffset def } if |
textxalign (right) eq { /textxpos pixx textxoffset sub textwidth sub def } if |
textxalign (right) eq { /textxpos x textxoffset sub textwidth sub def } if |
textxalign (offleft) eq { /textxpos textwidth textxoffset add neg def } if |
textxalign (offright) eq { /textxpos pixx textxoffset add def } if |
textxalign (justify) eq textwidth pixx lt and { |
textxalign (offright) eq { /textxpos x textxoffset add def } if |
textxalign (justify) eq textwidth x lt and { |
/textxpos 0 def |
/textgaps pixx textwidth sub tstr length 1 sub div def |
/textgaps x 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 |
3781,10 → 2449,10 |
|
% --BEGIN RENDERER renmaximatrix-- |
% --REQUIRES preamble raiseerror-- |
%%BeginResource: uk.co.terryburton.bwipp renmaximatrix 0.0 2022072900 50138 49904 |
%%BeginResource: uk.co.terryburton.bwipp renmaximatrix 0.0 2021092800 50254 49916 |
%%BeginData: 81 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
begin |
/renmaximatrix { |
3869,17 → 2537,15 |
% --END RENDERER renmaximatrix-- |
|
% --BEGIN ENCODER ean5-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear-- |
% --REQUIRES preamble raiseerror renlinear-- |
% --DESC: EAN-5 (5 digit addon) |
% --EXAM: 90200 |
% --EXOP: includetext guardwhitespace |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp ean5 0.0 2022072900 67684 63946 |
%%BeginData: 147 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp ean5 0.0 2021092800 58142 57964 |
%%BeginData: 137 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
dup /renlinear dup /uk.co.terryburton.bwipp findresource put |
begin |
3890,7 → 2556,6 |
/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 |
3920,8 → 2585,6 |
/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 |
3932,7 → 2595,6 |
} if |
} forall |
|
{ |
% Create an array containing the character mappings |
/encs |
[ (3211) (2221) (2122) (1411) (1132) |
3948,8 → 2610,6 |
[ (11000) (10100) (10010) (10001) (01100) |
(00110) (00011) (01010) (01001) (00101) |
] def |
} ctxdef |
|
/checksum 0 def |
0 1 4 { |
/i exch def |
4013,8 → 2673,6 |
|
dontdraw not //renlinear if |
|
//unloadctx exec |
|
end |
|
} |
4028,17 → 2686,15 |
% --END ENCODER ean5-- |
|
% --BEGIN ENCODER ean2-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear-- |
% --REQUIRES preamble raiseerror renlinear-- |
% --DESC: EAN-2 (2 digit addon) |
% --EXAM: 05 |
% --EXOP: includetext guardwhitespace |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp ean2 0.0 2022072900 66331 62624 |
%%BeginData: 133 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp ean2 0.0 2021092800 56699 56466 |
%%BeginData: 122 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
dup /renlinear dup /uk.co.terryburton.bwipp findresource put |
begin |
4049,7 → 2705,6 |
/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 |
4079,8 → 2734,6 |
/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 |
4091,7 → 2744,6 |
} if |
} forall |
|
{ |
% Create an array containing the character mappings |
/encs |
[ (3211) (2221) (2122) (1411) (1132) |
4103,11 → 2755,8 |
/barchars (0123456789) def |
|
% Determine the mirror map based on mod 4 checksum |
/mirrormaps [(00) (01) (10) (11)] def |
} ctxdef |
/mirrormap [(00) (01) (10) (11)] barcode 0 2 getinterval cvi 4 mod get def |
|
/mirrormap mirrormaps barcode 0 2 getinterval cvi 4 mod get def |
|
/sbs 13 string def |
/txt 2 array def |
|
4158,8 → 2807,6 |
|
dontdraw not //renlinear if |
|
//unloadctx exec |
|
end |
|
} |
4173,17 → 2820,15 |
% --END ENCODER ean2-- |
|
% --BEGIN ENCODER ean13-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear ean5 ean2-- |
% --REQUIRES preamble raiseerror renlinear ean5 ean2-- |
% --DESC: EAN-13 |
% --EXAM: 2112345678900 |
% --EXOP: includetext guardwhitespace |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp ean13 0.0 2022072900 87046 86773 |
%%BeginData: 226 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp ean13 0.0 2021092800 77528 80639 |
%%BeginData: 217 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
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 |
4196,7 → 2841,6 |
/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 |
4232,8 → 2876,6 |
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 |
4279,7 → 2921,6 |
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) |
4295,7 → 2936,6 |
[ (000000) (001011) (001101) (001110) (010011) |
(011001) (011100) (010101) (010110) (011010) |
] def |
} ctxdef |
|
/sbs 59 string def |
/txt 13 array def |
4396,8 → 3036,6 |
|
dontdraw not //renlinear if |
|
//unloadctx exec |
|
end |
|
} |
4411,17 → 3049,15 |
% --END ENCODER ean13-- |
|
% --BEGIN ENCODER ean8-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear ean5 ean2-- |
% --REQUIRES preamble raiseerror renlinear ean5 ean2-- |
% --DESC: EAN-8 |
% --EXAM: 02345673 |
% --EXOP: includetext guardwhitespace |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp ean8 0.0 2022072900 84284 83888 |
%%BeginData: 207 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp ean8 0.0 2021092800 74726 77866 |
%%BeginData: 198 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
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 |
4434,7 → 3070,6 |
/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 |
4470,8 → 3105,6 |
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 |
4518,7 → 3151,6 |
/barcode pad def |
|
% Create an array containing the character mappings |
{ |
/encs |
[ (3211) (2221) (2122) (1411) (1132) |
(1231) (1114) (1312) (1213) (3112) |
4527,7 → 3159,6 |
|
% Create a string of the available characters |
/barchars (0123456789) def |
} ctxdef |
|
/sbs 43 string def |
/txt 8 array def |
4615,8 → 3246,6 |
|
dontdraw not //renlinear if |
|
//unloadctx exec |
|
end |
|
} |
4630,17 → 3259,15 |
% --END ENCODER ean8-- |
|
% --BEGIN ENCODER upca-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear ean5 ean2-- |
% --REQUIRES preamble raiseerror renlinear ean5 ean2-- |
% --DESC: UPC-A |
% --EXAM: 416000336108 |
% --EXOP: includetext |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp upca 0.0 2022072900 92023 91540 |
%%BeginData: 259 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp upca 0.0 2021092800 82465 85414 |
%%BeginData: 250 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
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 |
4653,7 → 3280,6 |
/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 |
4689,8 → 3315,6 |
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 |
4782,7 → 3406,6 |
/barcode pad def |
|
% Create an array containing the character mappings |
{ |
/encs |
[ (3211) (2221) (2122) (1411) (1132) |
(1231) (1114) (1312) (1213) (3112) |
4791,7 → 3414,6 |
|
% Create a string of the available characters |
/barchars (0123456789) def |
} ctxdef |
|
/sbs 59 string def |
/txt 12 array def |
4886,8 → 3508,6 |
|
dontdraw not //renlinear if |
|
//unloadctx exec |
|
end |
|
} |
4901,17 → 3521,15 |
% --END ENCODER upca-- |
|
% --BEGIN ENCODER upce-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear ean5 ean2-- |
% --REQUIRES preamble raiseerror renlinear ean5 ean2-- |
% --DESC: UPC-E |
% --EXAM: 00123457 |
% --EXOP: includetext |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp upce 0.0 2022072900 96548 96108 |
%%BeginData: 298 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp upce 0.0 2021092800 87070 90062 |
%%BeginData: 289 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
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 |
4924,7 → 3542,6 |
/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 |
4960,8 → 3577,6 |
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 |
5031,7 → 3646,6 |
/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) |
5046,7 → 3660,6 |
[ (000111) (001011) (001101) (001110) (010011) |
(011001) (011100) (010101) (010110) (011010) |
] def |
} ctxdef |
|
% Derive the equivalent UPC-A for its checksum |
1 { % Common exit |
5196,8 → 3809,6 |
|
dontdraw not //renlinear if |
|
//unloadctx exec |
|
end |
|
} |
5211,15 → 3822,15 |
% --END ENCODER upce-- |
|
% --BEGIN ENCODER isbn-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear ean5 ean2 ean13-- |
% --REQUIRES preamble 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 2022072900 95102 94623 |
%%BeginData: 255 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp isbn 0.0 2021092800 89478 88857 |
%%BeginData: 254 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 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 |
5231,7 → 3842,6 |
/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 |
5478,15 → 4088,15 |
% --END ENCODER isbn-- |
|
% --BEGIN ENCODER ismn-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear ean5 ean2 ean13-- |
% --REQUIRES preamble 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 2022072900 91674 91184 |
%%BeginData: 234 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp ismn 0.0 2021092800 85922 85418 |
%%BeginData: 233 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 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 |
5498,7 → 4108,6 |
/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 |
5724,15 → 4333,15 |
% --END ENCODER ismn-- |
|
% --BEGIN ENCODER issn-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear ean2 ean5 ean13-- |
% --REQUIRES preamble 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 2022072900 83234 82740 |
%%BeginData: 179 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp issn 0.0 2021092800 77354 76846 |
%%BeginData: 178 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 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 |
5744,7 → 4353,6 |
/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 |
5915,15 → 4523,15 |
% --END ENCODER issn-- |
|
% --BEGIN ENCODER mands-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear ean2 ean5 ean8-- |
% --REQUIRES preamble raiseerror renlinear ean2 ean5 ean8-- |
% --DESC: Marks & Spencer |
% --EXAM: 0642118 |
% --EXOP: includetext |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp mands 0.0 2022072900 71641 71586 |
%%BeginData: 83 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp mands 0.0 2021092800 66033 65940 |
%%BeginData: 82 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 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 |
5935,7 → 4543,6 |
/options exch def |
/barcode exch def |
|
/ctx null def |
/dontdraw false def |
/includetext false def |
|
6010,17 → 4617,15 |
% --END ENCODER mands-- |
|
% --BEGIN ENCODER code128-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renlinear-- |
% --REQUIRES preamble raiseerror parseinput renlinear-- |
% --DESC: Code 128 |
% --EXAM: Count01234567! |
% --EXOP: includetext |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp code128 0.0 2022072900 126029 129057 |
%%BeginData: 438 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp code128 0.0 2021092800 120207 119811 |
%%BeginData: 425 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
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 |
6032,7 → 4637,6 |
/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 |
6062,16 → 4666,12 |
/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 << |
6089,7 → 4689,6 |
/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 |
6144,7 → 4743,6 |
/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 |
6227,17 → 4825,17 |
/p p 1 add def |
} loop |
n s |
} def |
} bind def |
|
% Encoding for each alphabet |
/enca { |
seta exch get cws exch j exch put |
/j j 1 add def |
} def |
} bind def |
/encb { |
setb exch get cws exch j exch put |
/j j 1 add def |
} def |
} bind def |
/encc { |
dup type /arraytype ne { |
setc exch get |
6246,11 → 4844,11 |
} ifelse |
cws exch j exch put |
/j j 1 add def |
} def |
} bind def |
|
% Character exclusively in either alphabet A or B |
/anotb {dup seta exch known exch setb exch known not and} def |
/bnota {dup setb exch known exch seta exch known not and} def |
/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 |
|
% Pre-compute relative position of next anotb and next bnota characters |
/nextanotb [ msg length {0} repeat 9999 ] def |
6270,8 → 4868,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} def |
/bbeforea {dup nextbnota exch get exch nextanotb exch get lt} def |
/abeforeb {dup nextanotb exch get exch nextbnota exch get lt} bind def |
/bbeforea {dup nextbnota exch get exch nextanotb exch get lt} bind def |
|
/cws barcode length 2 mul 3 add array def |
|
6404,7 → 5002,6 |
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) |
6423,7 → 5020,6 |
(411311) (113141) (114131) (311141) (411131) (211412) (211214) |
(211232) (2331112) |
] def |
} ctxdef |
|
% Derive space bar succession |
/sbs cws length 6 mul 1 add string def |
6445,8 → 5041,6 |
|
dontdraw not //renlinear if |
|
//unloadctx exec |
|
end |
|
} |
6460,18 → 5054,18 |
% --END ENCODER code128-- |
|
% --BEGIN ENCODER gs1-128-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renlinear code128-- |
% --REQUIRES preamble raiseerror parseinput gs1lint renlinear code128-- |
% --DESC: GS1-128 |
% --EXAM: (01)95012345678903(3103)000123 |
% --EXOP: includetext |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp gs1-128 0.0 2022072900 80068 76461 |
%%BeginData: 114 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp gs1-128 0.0 2021092800 81345 84637 |
%%BeginData: 156 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
dup /parseinput dup /uk.co.terryburton.bwipp findresource put |
dup /gs1process dup /uk.co.terryburton.bwipp findresource put |
dup /gs1lint 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 |
6482,7 → 5076,6 |
/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 |
6494,7 → 5087,6 |
/linkagec false def |
/parse false def |
/dontlint false def |
/lintreqs false def |
|
% Parse the input options |
options type /stringtype eq { |
6515,11 → 5107,55 |
|
/text barcode def |
|
barcode /ai //gs1process exec |
/fncs exch def |
/vals exch def |
/ais exch def |
% 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 |
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 |
6532,7 → 5168,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 fncs i get and { % Append FNC1 |
i ais length 1 sub ne aifixed ai 0 2 getinterval known not and { % Append FNC1 |
c128 length 1 add array |
dup 0 c128 putinterval |
dup c128 length fnc1 put |
6586,15 → 5222,15 |
% --END ENCODER gs1-128-- |
|
% --BEGIN ENCODER ean14-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renlinear code128-- |
% --REQUIRES preamble 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 2022072900 72622 72322 |
%%BeginData: 108 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp ean14 0.0 2021092800 63440 66700 |
%%BeginData: 107 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 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 |
6606,7 → 5242,6 |
/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 |
6706,15 → 5341,15 |
% --END ENCODER ean14-- |
|
% --BEGIN ENCODER sscc18-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renlinear code128-- |
% --REQUIRES preamble 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 2022072900 72634 72329 |
%%BeginData: 108 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp sscc18 0.0 2021092800 63324 66579 |
%%BeginData: 107 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 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 |
6726,7 → 5361,6 |
/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 |
6826,17 → 5460,15 |
% --END ENCODER sscc18-- |
|
% --BEGIN ENCODER code39-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear-- |
% --REQUIRES preamble raiseerror renlinear-- |
% --DESC: Code 39 |
% --EXAM: THIS IS CODE 39 |
% --EXOP: includetext includecheck includecheckintext |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp code39 0.0 2022072900 72544 68679 |
%%BeginData: 154 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp code39 0.0 2021092800 62946 62513 |
%%BeginData: 143 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
dup /renlinear dup /uk.co.terryburton.bwipp findresource put |
begin |
6847,7 → 5479,6 |
/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 |
6875,14 → 5506,10 |
/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 { |
6908,7 → 5535,6 |
} if |
|
% Create an array containing the character mappings |
{ |
/encs |
[ (1113313111) (3113111131) (1133111131) (3133111111) (1113311131) |
(3113311111) (1133311111) (1113113131) (3113113111) (1133113111) |
6920,7 → 5546,6 |
(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 |
6977,8 → 5602,6 |
|
dontdraw not //renlinear if |
|
//unloadctx exec |
|
end |
|
} |
6992,17 → 5615,15 |
% --END ENCODER code39-- |
|
% --BEGIN ENCODER code39ext-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renlinear code39-- |
% --REQUIRES preamble 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 2022072900 71121 70993 |
%%BeginData: 109 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp code39ext 0.0 2021092800 61643 64843 |
%%BeginData: 100 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
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 |
7015,7 → 5636,6 |
/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 |
7031,8 → 5651,6 |
} if |
options {def} forall |
|
/code39ext //loadctx exec |
|
% Parse ordinals of the form ^NNN to ASCII |
/fncvals << |
/parse parse |
7051,7 → 5669,6 |
} 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) |
7062,7 → 5679,6 |
(%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 |
7098,8 → 5714,6 |
|
dontdraw not //renlinear if |
|
//unloadctx exec |
|
end |
|
} |
7113,15 → 5727,15 |
% --END ENCODER code39ext-- |
|
% --BEGIN ENCODER code32-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear code39-- |
% --REQUIRES preamble raiseerror renlinear code39-- |
% --DESC: Italian Pharmacode |
% --EXAM: 01234567 |
% --EXOP: includetext |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp code32 0.0 2022072900 63967 67254 |
%%BeginData: 102 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp code32 0.0 2021092800 58521 58072 |
%%BeginData: 101 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 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 |
7133,7 → 5747,6 |
/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 |
7227,15 → 5840,15 |
% --END ENCODER code32-- |
|
% --BEGIN ENCODER pzn-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear code39-- |
% --REQUIRES preamble raiseerror renlinear code39-- |
% --DESC: Pharmazentralnummer (PZN) |
% --EXAM: 123456 |
% --EXOP: includetext |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp pzn 0.0 2022072900 64062 67274 |
%%BeginData: 103 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp pzn 0.0 2021092800 58384 58092 |
%%BeginData: 102 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 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 |
7247,7 → 5860,6 |
/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 |
7342,17 → 5954,15 |
% --END ENCODER pzn-- |
|
% --BEGIN ENCODER code93-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renlinear-- |
% --REQUIRES preamble raiseerror parseinput renlinear-- |
% --DESC: Code 93 |
% --EXAM: THIS IS CODE 93 |
% --EXOP: includetext includecheck |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp code93 0.0 2022072900 68234 71403 |
%%BeginData: 144 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp code93 0.0 2021092800 62124 61789 |
%%BeginData: 134 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
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 |
7364,7 → 5974,6 |
/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 |
7391,9 → 6000,6 |
/textyoffset textyoffset cvr def |
/height height cvr def |
|
/code93 //loadctx exec |
|
{ |
/encs |
[ (131112) (111213) (111312) (111411) (121113) |
(121212) (121311) (111114) (131211) (141111) |
7410,10 → 6016,8 |
% Create a string of the available characters |
/barchars (0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%) def |
|
% Special function characters |
/sft1 -1 def /sft2 -2 def /sft3 -3 def /sft4 -4 def |
} ctxdef |
|
% Special function characters |
/fncvals << |
/parse parse |
/parsefnc parsefnc |
7483,8 → 6087,6 |
|
dontdraw not //renlinear if |
|
//unloadctx exec |
|
end |
|
} |
7498,17 → 6100,15 |
% --END ENCODER code93-- |
|
% --BEGIN ENCODER code93ext-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renlinear code93-- |
% --REQUIRES preamble raiseerror parseinput renlinear code93-- |
% --DESC: Code 93 Extended |
% --EXAM: Code93 Ext! |
% --EXOP: includetext includecheck |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp code93ext 0.0 2022072900 71471 71374 |
%%BeginData: 113 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp code93ext 0.0 2021092800 62105 65416 |
%%BeginData: 104 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
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 |
7521,7 → 6121,6 |
/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 |
7537,8 → 6136,6 |
} if |
options {def} forall |
|
/code93ext //loadctx exec |
|
% Parse ordinals of the form ^NNN to ASCII |
/fncvals << |
/parse parse |
7550,7 → 6147,6 |
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) |
7569,7 → 6165,6 |
(^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 |
7608,8 → 6203,6 |
|
dontdraw not //renlinear if |
|
//unloadctx exec |
|
end |
|
} |
7623,17 → 6216,15 |
% --END ENCODER code93ext-- |
|
% --BEGIN ENCODER interleaved2of5-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear-- |
% --REQUIRES preamble 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 2022072900 70923 67054 |
%%BeginData: 162 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp interleaved2of5 0.0 2021092800 61533 61224 |
%%BeginData: 152 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
dup /renlinear dup /uk.co.terryburton.bwipp findresource put |
begin |
7644,7 → 6235,6 |
/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 |
7670,8 → 6260,6 |
/textyoffset textyoffset cvr def |
/height height cvr def |
|
/interleaved2of5 //loadctx exec |
|
% Validate the input |
barcode { |
dup 48 lt exch 57 gt or { |
7712,7 → 6300,6 |
} if |
|
% Create an array containing the character mappings |
{ |
/encs |
[ (11221) (21112) (12112) (22111) (11212) |
(21211) (12211) (11122) (21121) (12121) |
7721,8 → 6308,6 |
|
% Create a string of the available characters |
/barchars (0123456789) def |
} ctxdef |
|
/sbs barlen 5 mul 8 add string def |
/txt barlen array def |
|
7782,8 → 6367,6 |
|
dontdraw not //renlinear if |
|
//unloadctx exec |
|
end |
|
} |
7797,15 → 6380,15 |
% --END ENCODER interleaved2of5-- |
|
% --BEGIN ENCODER itf14-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear interleaved2of5-- |
% --REQUIRES preamble raiseerror renlinear interleaved2of5-- |
% --DESC: ITF-14 |
% --EXAM: 0 46 01234 56789 3 |
% --EXOP: includetext |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp itf14 0.0 2022072900 66573 69859 |
%%BeginData: 112 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp itf14 0.0 2021092800 60903 60661 |
%%BeginData: 111 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 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 |
7817,7 → 6400,6 |
/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 |
7921,15 → 6503,15 |
% --END ENCODER itf14-- |
|
% --BEGIN ENCODER identcode-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear interleaved2of5-- |
% --REQUIRES preamble raiseerror renlinear interleaved2of5-- |
% --DESC: Deutsche Post Identcode |
% --EXAM: 563102430313 |
% --EXOP: includetext |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp identcode 0.0 2022072900 62988 66378 |
%%BeginData: 94 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp identcode 0.0 2021092800 57310 57220 |
%%BeginData: 93 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 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 |
7941,7 → 6523,6 |
/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 |
8027,15 → 6608,15 |
% --END ENCODER identcode-- |
|
% --BEGIN ENCODER leitcode-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear interleaved2of5-- |
% --REQUIRES preamble raiseerror renlinear interleaved2of5-- |
% --DESC: Deutsche Post Leitcode |
% --EXAM: 21348075016401 |
% --EXOP: includetext |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp leitcode 0.0 2022072900 62980 66374 |
%%BeginData: 94 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp leitcode 0.0 2021092800 57302 57216 |
%%BeginData: 93 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 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 |
8047,7 → 6628,6 |
/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 |
8133,17 → 6713,15 |
% --END ENCODER leitcode-- |
|
% --BEGIN ENCODER databaromni-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear renmatrix-- |
% --REQUIRES preamble raiseerror renlinear renmatrix-- |
% --DESC: GS1 DataBar Omnidirectional |
% --EXAM: (01)24012345678905 |
% --EXOP: |
% --RNDR: renlinear renmatrix |
%%BeginResource: uk.co.terryburton.bwipp databaromni 0.0 2022072900 115343 110971 |
%%BeginData: 436 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp databaromni 0.0 2021092800 105433 104213 |
%%BeginData: 425 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
20 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
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 |
8155,7 → 6733,6 |
/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 |
8177,8 → 6754,6 |
/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 |
8302,7 → 6877,6 |
/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 |
8317,7 → 6891,6 |
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 { |
8411,7 → 6984,6 |
d4w {} forall |
] def |
|
{ |
/checkweights [ |
1 3 9 27 2 6 18 54 |
58 72 24 8 29 36 12 4 |
8424,7 → 6996,6 |
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 { |
8566,8 → 7137,6 |
|
} ifelse |
|
//unloadctx exec |
|
end |
|
} |
8581,15 → 7150,15 |
% --END ENCODER databaromni-- |
|
% --BEGIN ENCODER databarstacked-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear renmatrix databaromni-- |
% --REQUIRES preamble raiseerror renlinear renmatrix databaromni-- |
% --DESC: GS1 DataBar Stacked |
% --EXAM: (01)24012345678905 |
% --EXOP: |
% --RNDR: renmatrix |
%%BeginResource: uk.co.terryburton.bwipp databarstacked 0.0 2022072900 67414 63705 |
%%BeginData: 76 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp databarstacked 0.0 2021092800 58192 61579 |
%%BeginData: 75 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 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 |
8601,7 → 7170,6 |
/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 |
8669,15 → 7237,15 |
% --END ENCODER databarstacked-- |
|
% --BEGIN ENCODER databarstackedomni-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear renmatrix databaromni-- |
% --REQUIRES preamble raiseerror renlinear renmatrix databaromni-- |
% --DESC: GS1 DataBar Stacked Omnidirectional |
% --EXAM: (01)24012345678905 |
% --EXOP: |
% --RNDR: renmatrix |
%%BeginResource: uk.co.terryburton.bwipp databarstackedomni 0.0 2022072900 67514 63785 |
%%BeginData: 76 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp databarstackedomni 0.0 2021092800 58236 61531 |
%%BeginData: 75 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 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 |
8689,7 → 7257,6 |
/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 |
8757,15 → 7324,15 |
% --END ENCODER databarstackedomni-- |
|
% --BEGIN ENCODER databartruncated-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear renmatrix databaromni-- |
% --REQUIRES preamble raiseerror renlinear renmatrix databaromni-- |
% --DESC: GS1 DataBar Truncated |
% --EXAM: (01)24012345678905 |
% --EXOP: |
% --RNDR: renlinear renmatrix |
%%BeginResource: uk.co.terryburton.bwipp databartruncated 0.0 2022072900 67440 63721 |
%%BeginData: 76 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp databartruncated 0.0 2021092800 58138 61491 |
%%BeginData: 75 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 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 |
8777,7 → 7344,6 |
/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 |
8845,17 → 7411,15 |
% --END ENCODER databartruncated-- |
|
% --BEGIN ENCODER databarlimited-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear-- |
% --REQUIRES preamble raiseerror renlinear-- |
% --DESC: GS1 DataBar Limited |
% --EXAM: (01)15012345678907 |
% --EXOP: |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp databarlimited 0.0 2022072900 90806 86511 |
%%BeginData: 291 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp databarlimited 0.0 2021092800 80912 80201 |
%%BeginData: 278 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
20 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
dup /renlinear dup /uk.co.terryburton.bwipp findresource put |
begin |
8866,7 → 7430,6 |
/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 |
8884,8 → 7447,6 |
|
/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 |
8920,13 → 7481,11 |
/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 |
8954,7 → 7513,7 |
1 index idiv exch 1 add exch |
} loop |
exch pop exch pop |
} def |
} bind def |
|
/getRSSwidths { |
/oe exch def |
8993,7 → 7552,7 |
} for |
out el 1 sub nm put |
out |
} def |
} bind def |
|
0 1 11 { |
/i exch def |
9016,7 → 7575,6 |
} ifelse |
} for |
|
{ |
/tab267 [ |
183063 0 17 9 6 3 6538 28 |
820063 183064 13 13 5 4 875 728 |
9026,7 → 7584,6 |
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 { |
9076,7 → 7633,6 |
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 |
9097,7 → 7653,6 |
322 323 |
326 337 |
] def |
} ctxdef |
|
/checksum 0 def |
0 1 27 { |
9133,8 → 7688,6 |
|
dontdraw not //renlinear if |
|
//unloadctx exec |
|
end |
|
} |
9148,19 → 7701,18 |
% --END ENCODER databarlimited-- |
|
% --BEGIN ENCODER databarexpanded-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renlinear renmatrix-- |
% --REQUIRES preamble raiseerror parseinput gs1lint renlinear renmatrix-- |
% --DESC: GS1 DataBar Expanded |
% --EXAM: (01)95012345678903(3103)000123 |
% --EXOP: |
% --RNDR: renlinear renmatrix |
%%BeginResource: uk.co.terryburton.bwipp databarexpanded 0.0 2022072900 246206 244983 |
%%BeginData: 863 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp databarexpanded 0.0 2021092800 242723 244991 |
%%BeginData: 886 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
dup /gs1process 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 /renlinear dup /uk.co.terryburton.bwipp findresource put |
dup /renmatrix dup /uk.co.terryburton.bwipp findresource put |
begin |
9171,10 → 7723,8 |
/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 |
9197,8 → 7747,6 |
/segments segments cvi def |
/barxmult barxmult cvi def |
|
/databarexpanded //loadctx exec |
|
segments -1 eq { |
/segments format (expandedstacked) eq {4} {22} ifelse def |
} { |
9207,11 → 7755,37 |
} if |
} ifelse |
|
barcode /ai //gs1process exec |
/fncs exch def |
/vals exch def |
/ais exch def |
% 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 |
pop |
|
dontlint not { ais vals //gs1lint exec pop } if |
|
% Method selection |
{ % common exit |
|
9309,18 → 7883,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 |
} def |
} bind def |
|
/conv13to44 { |
(00000000000000000000000000000000000000000000) 44 string copy |
2 copy 0 4 getinterval exch 0 1 getinterval cvi 2 4 string cvrs dup length 4 exch sub exch putinterval |
dup 3 -1 roll 1 12 getinterval conv12to40 4 exch putinterval |
} def |
} bind def |
|
/tobin { |
string dup length 1 sub 0 exch 1 exch {1 index exch 48 put} for |
dup 3 -1 roll 2 2 index length string cvrs dup length 2 index length exch sub exch putinterval |
} def |
} bind def |
|
/fnc1 -1 def /lnumeric -2 def /lalphanumeric -3 def /liso646 -4 def |
|
9335,7 → 7909,6 |
/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 { |
9346,7 → 7919,6 |
/gpf [] def |
/ais [] def |
/vals [] def |
/fncs [] def |
} if |
|
method (0101) eq { |
9362,7 → 7934,6 |
/gpf [] def |
/ais [] def |
/vals [] def |
/fncs [] def |
} if |
|
method length 7 eq { |
9384,7 → 7955,6 |
/gpf [] def |
/ais [] def |
/vals [] def |
/fncs [] def |
} if |
|
method (01100) eq { |
9395,7 → 7965,6 |
/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 { |
9407,7 → 7976,6 |
/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 |
9417,7 → 7985,24 |
/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 |
9455,7 → 8040,6 |
lnumeric (000) |
lalphanumeric (00100) |
>> def |
} ctxdef |
|
% Append the remaining AI data |
0 1 ais length 1 sub { |
9467,7 → 8051,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 fncs i get and { % Append FNC1 |
i ais length 1 sub ne aifixed ai 0 2 getinterval known not and { % Append FNC1 |
gpf length 1 add array |
dup 0 gpf putinterval |
dup gpf length fnc1 put |
9486,7 → 8070,7 |
pop |
} ifelse |
exch sub |
} def |
} bind def |
|
/encode { |
dup /raw ne {exch get} {pop} ifelse |
9494,7 → 8078,7 |
dup length exch |
gpfenc exch j exch putinterval |
/j exch j add def |
} def |
} bind def |
|
% Pre-compute alphanumeric and numeric runlengths and position of next ISO646-only characters |
/numericruns [ gpf length {0} repeat 0 -1 ] def |
9663,7 → 8247,7 |
1 index idiv exch 1 add exch |
} loop |
exch pop exch pop |
} def |
} bind def |
|
/getRSSwidths { |
/oe exch def |
9702,9 → 8286,8 |
} for |
out el 1 sub nm put |
out |
} def |
} bind def |
|
{ |
/tab174 [ |
347 0 12 5 7 2 87 4 |
1387 348 10 7 5 4 52 20 |
9712,7 → 8295,6 |
3987 2948 6 11 3 6 10 104 |
4191 3988 4 13 1 8 1 204 |
] def |
} ctxdef |
|
/dxw datalen array def |
|
9757,7 → 8339,6 |
|
} for |
|
{ |
/finderwidths [ |
1 8 4 1 1 1 1 4 8 1 |
3 6 4 1 1 1 1 4 6 3 |
9779,7 → 8360,6 |
[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 |
9788,7 → 8368,6 |
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 |
9815,7 → 8394,6 |
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 |
10008,8 → 8586,6 |
|
} ifelse |
|
//unloadctx exec |
|
end |
|
} |
10023,15 → 8599,15 |
% --END ENCODER databarexpanded-- |
|
% --BEGIN ENCODER databarexpandedstacked-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renlinear renmatrix databarexpanded-- |
% --REQUIRES preamble raiseerror parseinput gs1lint 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 2022072900 69203 72245 |
%%BeginData: 46 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp databarexpandedstacked 0.0 2021092800 66639 63073 |
%%BeginData: 45 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 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 |
10043,7 → 8619,6 |
/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 |
10081,17 → 8656,18 |
% --END ENCODER databarexpandedstacked-- |
|
% --BEGIN ENCODER gs1northamericancoupon-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renlinear renmatrix databarexpanded databarexpandedstacked-- |
% --REQUIRES preamble raiseerror parseinput gs1lint 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 2022072900 84498 91105 |
%%BeginData: 105 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp gs1northamericancoupon 0.0 2021092800 82792 82511 |
%%BeginData: 131 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
dup /gs1process 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 /renmatrix dup /uk.co.terryburton.bwipp findresource put |
dup /databarexpandedstacked dup /uk.co.terryburton.bwipp findresource put |
begin |
10102,8 → 8678,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 |
10111,7 → 8687,6 |
/coupontextyoffset (unset) def |
/parse false def |
/dontlint false def |
/lintreqs true def |
|
% Parse the input options |
options type /stringtype eq { |
10129,10 → 8704,34 |
coupontextxoffset (unset) ne {/coupontextxoffset coupontextxoffset cvr def} if |
coupontextyoffset (unset) ne {/coupontextyoffset coupontextyoffset cvr def} if |
|
barcode /ai //gs1process exec |
% 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 |
pop |
/vals exch def |
/ais exch def |
|
% Validate the AI structure |
ais length 1 ne { |
10142,6 → 8741,8 |
/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 |
10203,10 → 8804,10 |
% --EXAM: 117480 |
% --EXOP: showborder |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp pharmacode 0.0 2022072900 55161 54804 |
%%BeginData: 94 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp pharmacode 0.0 2021092800 54994 54752 |
%%BeginData: 93 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
dup /renlinear dup /uk.co.terryburton.bwipp findresource put |
begin |
10217,7 → 8818,6 |
/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 |
10309,10 → 8909,10 |
% --EXAM: 117480 |
% --EXOP: includetext showborder |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp pharmacode2 0.0 2022072900 55992 55790 |
%%BeginData: 99 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp pharmacode2 0.0 2021092800 55825 55610 |
%%BeginData: 98 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
dup /renlinear dup /uk.co.terryburton.bwipp findresource put |
begin |
10323,7 → 8923,6 |
/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 |
10415,17 → 9014,15 |
% --END ENCODER pharmacode2-- |
|
% --BEGIN ENCODER code2of5-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear-- |
% --REQUIRES preamble raiseerror renlinear-- |
% --DESC: Code 25 |
% --EXAM: 01234567 |
% --EXOP: includetext includecheck includecheckintext |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp code2of5 0.0 2022072900 73027 69031 |
%%BeginData: 165 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp code2of5 0.0 2021092800 63389 62953 |
%%BeginData: 153 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
dup /renlinear dup /uk.co.terryburton.bwipp findresource put |
begin |
10436,7 → 9033,6 |
/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 |
10464,8 → 9060,6 |
/textyoffset textyoffset cvr def |
/height height cvr def |
|
/code2of5 //loadctx exec |
|
% Validate input |
barcode { |
dup 48 lt exch 57 gt or { |
10490,7 → 9084,6 |
} if |
|
% Create an array containing the character mappings |
{ |
/versions << |
/industrial |
[ (1111313111) (3111111131) (1131111131) (3131111111) |
10515,8 → 9108,6 |
(133111) (111331) (311311) (131311) (1111) (311) |
] |
>> def |
} ctxdef |
|
versions version known not { |
/bwipp.code2of5badVersion (Unrecognised Code 25 version) //raiseerror exec |
} if |
10529,9 → 9120,7 |
/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 |
10577,8 → 9166,6 |
|
dontdraw not //renlinear if |
|
//unloadctx exec |
|
end |
|
} |
10592,15 → 9179,15 |
% --END ENCODER code2of5-- |
|
% --BEGIN ENCODER industrial2of5-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear code2of5-- |
% --REQUIRES preamble raiseerror renlinear code2of5-- |
% --DESC: Industrial 2 of 5 |
% --EXAM: 01234567 |
% --EXOP: includetext includecheck includecheckintext |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp industrial2of5 0.0 2022072900 57292 60792 |
%%BeginData: 58 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp industrial2of5 0.0 2021092800 51614 51610 |
%%BeginData: 57 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 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 |
10612,7 → 9199,6 |
/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 |
10662,15 → 9248,15 |
% --END ENCODER industrial2of5-- |
|
% --BEGIN ENCODER iata2of5-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear code2of5-- |
% --REQUIRES preamble raiseerror renlinear code2of5-- |
% --DESC: IATA 2 of 5 |
% --EXAM: 01234567 |
% --EXOP: includetext includecheck includecheckintext |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp iata2of5 0.0 2022072900 57262 60768 |
%%BeginData: 58 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp iata2of5 0.0 2021092800 51712 51586 |
%%BeginData: 57 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 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 |
10682,7 → 9268,6 |
/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 |
10732,15 → 9317,15 |
% --END ENCODER iata2of5-- |
|
% --BEGIN ENCODER matrix2of5-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear code2of5-- |
% --REQUIRES preamble raiseerror renlinear code2of5-- |
% --DESC: Matrix 2 of 5 |
% --EXAM: 01234567 |
% --EXOP: includetext includecheck includecheckintext |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp matrix2of5 0.0 2022072900 57272 60776 |
%%BeginData: 58 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp matrix2of5 0.0 2021092800 51594 51594 |
%%BeginData: 57 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 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 |
10752,7 → 9337,6 |
/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 |
10802,15 → 9386,15 |
% --END ENCODER matrix2of5-- |
|
% --BEGIN ENCODER coop2of5-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear code2of5-- |
% --REQUIRES preamble raiseerror renlinear code2of5-- |
% --DESC: COOP 2 of 5 |
% --EXAM: 01234567 |
% --EXOP: includetext includecheck includecheckintext |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp coop2of5 0.0 2022072900 57262 60768 |
%%BeginData: 58 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp coop2of5 0.0 2021092800 51584 51586 |
%%BeginData: 57 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 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 |
10822,7 → 9406,6 |
/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 |
10872,15 → 9455,15 |
% --END ENCODER coop2of5-- |
|
% --BEGIN ENCODER datalogic2of5-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear code2of5-- |
% --REQUIRES preamble raiseerror renlinear code2of5-- |
% --DESC: Datalogic 2 of 5 |
% --EXAM: 01234567 |
% --EXOP: includetext includecheck includecheckintext |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp datalogic2of5 0.0 2022072900 57287 60788 |
%%BeginData: 58 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp datalogic2of5 0.0 2021092800 51609 51606 |
%%BeginData: 57 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 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 |
10892,7 → 9475,6 |
/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 |
10942,17 → 9524,15 |
% --END ENCODER datalogic2of5-- |
|
% --BEGIN ENCODER code11-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear-- |
% --REQUIRES preamble raiseerror renlinear-- |
% --DESC: Code 11 |
% --EXAM: 0123456789 |
% --EXOP: includetext includecheck includecheckintext |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp code11 0.0 2022072900 74353 70384 |
%%BeginData: 169 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp code11 0.0 2021092800 64947 64514 |
%%BeginData: 160 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
dup /renlinear dup /uk.co.terryburton.bwipp findresource put |
begin |
10963,7 → 9543,6 |
/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 |
10990,10 → 9569,7 |
/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) |
11004,7 → 9580,6 |
/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 { |
11108,8 → 9683,6 |
|
dontdraw not //renlinear if |
|
//unloadctx exec |
|
end |
|
} |
11123,17 → 9696,15 |
% --END ENCODER code11-- |
|
% --BEGIN ENCODER bc412-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear-- |
% --REQUIRES preamble raiseerror renlinear-- |
% --DESC: BC412 |
% --EXAM: BC412 |
% --EXOP: semi includetext includecheckintext |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp bc412 0.0 2022072900 75285 71341 |
%%BeginData: 203 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp bc412 0.0 2021092800 60520 60057 |
%%BeginData: 150 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
dup /renlinear dup /uk.co.terryburton.bwipp findresource put |
begin |
11144,7 → 9715,6 |
/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 |
11174,18 → 9744,14 |
/height height cvr def |
|
semi { |
% Implies includecheck and includecheckintext also |
/includecheck true def |
/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 { |
11194,47 → 9760,6 |
} if |
} for |
|
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 |
|
/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 |
/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 |
11250,21 → 9775,18 |
/barcode barcode 0 barlen getinterval def |
/includecheck true def |
} if |
} ifelse |
|
% Create an array containing the character mappings |
{ |
/encs |
[ (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 |
[ (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) |
] def |
} ctxdef |
|
/sbs barlen 1 add 8 mul 5 add string def |
includecheck { |
11305,7 → 9827,7 |
% Put the stop character |
includestartstop { |
sbs pos encs 36 get putinterval |
/pos pos 3 add def |
/pos pos 2 add def |
} if |
|
% Return the arguments |
11323,8 → 9845,6 |
|
dontdraw not //renlinear if |
|
//unloadctx exec |
|
end |
|
} |
11338,17 → 9858,15 |
% --END ENCODER bc412-- |
|
% --BEGIN ENCODER rationalizedCodabar-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear-- |
% --REQUIRES preamble raiseerror renlinear-- |
% --DESC: Codabar |
% --EXAM: A0123456789B |
% --EXOP: includetext includecheck includecheckintext |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp rationalizedCodabar 0.0 2022072900 75138 71172 |
%%BeginData: 167 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp rationalizedCodabar 0.0 2021092800 65315 64822 |
%%BeginData: 158 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
dup /renlinear dup /uk.co.terryburton.bwipp findresource put |
begin |
11359,7 → 9877,6 |
/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 |
11387,9 → 9904,6 |
/textyoffset textyoffset cvr def |
/height height cvr def |
|
/rationalizedCodabar //loadctx exec |
|
{ |
% Create an array containing the character mappings |
/encs |
[ (11111331) (11113311) (11131131) (33111111) (11311311) |
11399,12 → 9913,11 |
] def |
|
% Create a string of the available characters |
/barcharsnormal (0123456789-$:/.+ABCD) def |
/barcharsalt (0123456789-$:/.+TN*E) def |
} ctxdef |
|
/barchars altstartstop {barcharsalt} {barcharsnormal} ifelse def |
|
altstartstop { |
/barchars (0123456789-$:/.+TN*E) def |
} { |
/barchars (0123456789-$:/.+ABCD) def |
} ifelse |
/charvals 20 dict def |
0 1 19 {charvals exch dup barchars exch 1 getinterval exch put} for |
/bodyvals 16 dict def |
11502,8 → 10015,6 |
|
dontdraw not //renlinear if |
|
//unloadctx exec |
|
end |
|
} |
11517,17 → 10028,15 |
% --END ENCODER rationalizedCodabar-- |
|
% --BEGIN ENCODER onecode-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear-- |
% --REQUIRES preamble raiseerror renlinear-- |
% --DESC: USPS Intelligent Mail |
% --EXAM: 0123456709498765432101234567891 |
% --EXOP: barcolor=FF0000 |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp onecode 0.0 2022072900 108963 104948 |
%%BeginData: 348 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp onecode 0.0 2021092800 99045 98718 |
%%BeginData: 337 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
dup /renlinear dup /uk.co.terryburton.bwipp findresource put |
begin |
11538,7 → 10047,6 |
/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 |
|
11555,8 → 10063,6 |
|
/height height cvr def |
|
/onecode //loadctx exec |
|
/barlen barcode length def |
|
% Create the human readable text |
11685,7 → 10191,6 |
} 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 |
11783,7 → 10288,6 |
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 { |
11804,7 → 10308,6 |
} 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 |
11820,7 → 10323,6 |
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 |
11862,8 → 10364,6 |
|
dontdraw not //renlinear if |
|
//unloadctx exec |
|
end |
|
} |
11877,17 → 10377,15 |
% --END ENCODER onecode-- |
|
% --BEGIN ENCODER postnet-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear-- |
% --REQUIRES preamble raiseerror renlinear-- |
% --DESC: USPS POSTNET |
% --EXAM: 01234 |
% --EXOP: includetext includecheckintext |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp postnet 0.0 2022072900 70748 66913 |
%%BeginData: 151 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp postnet 0.0 2021092800 61190 60891 |
%%BeginData: 142 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
dup /renlinear dup /uk.co.terryburton.bwipp findresource put |
begin |
11898,7 → 10396,6 |
/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 |
11924,8 → 10421,6 |
/textyoffset textyoffset cvr def |
/height height cvr def |
|
/postnet //loadctx exec |
|
/barlen barcode length validatecheck {1 sub} if def |
|
% Validate the input |
11938,18 → 10433,9 |
} 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 |
11963,6 → 10449,13 |
/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 |
|
12025,8 → 10518,6 |
|
dontdraw not //renlinear if |
|
//unloadctx exec |
|
end |
|
} |
12040,17 → 10531,15 |
% --END ENCODER postnet-- |
|
% --BEGIN ENCODER planet-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear-- |
% --REQUIRES preamble raiseerror renlinear-- |
% --DESC: USPS PLANET |
% --EXAM: 01234567890 |
% --EXOP: includetext includecheckintext |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp planet 0.0 2022072900 70608 66777 |
%%BeginData: 152 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp planet 0.0 2021092800 61050 60755 |
%%BeginData: 143 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
dup /renlinear dup /uk.co.terryburton.bwipp findresource put |
begin |
12061,7 → 10550,6 |
/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 |
12087,8 → 10575,6 |
/textyoffset textyoffset cvr def |
/height height cvr def |
|
/planet //loadctx exec |
|
/barlen barcode length validatecheck {1 sub} if def |
|
% Validate the input |
12101,18 → 10587,9 |
} 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 { |
12127,6 → 10604,13 |
/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 |
|
12189,8 → 10673,6 |
|
dontdraw not //renlinear if |
|
//unloadctx exec |
|
end |
|
} |
12204,17 → 10686,15 |
% --END ENCODER planet-- |
|
% --BEGIN ENCODER royalmail-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear-- |
% --REQUIRES preamble 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 2022072900 71499 67703 |
%%BeginData: 156 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp royalmail 0.0 2021092800 61861 61521 |
%%BeginData: 147 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
dup /renlinear dup /uk.co.terryburton.bwipp findresource put |
begin |
12225,7 → 10705,6 |
/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 |
12251,26 → 10730,11 |
/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 { |
12296,6 → 10760,17 |
/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 |
|
12357,8 → 10832,6 |
|
dontdraw not //renlinear if |
|
//unloadctx exec |
|
end |
|
} |
12372,17 → 10845,15 |
% --END ENCODER royalmail-- |
|
% --BEGIN ENCODER auspost-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear-- |
% --REQUIRES preamble 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 2022072900 82286 78581 |
%%BeginData: 213 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp auspost 0.0 2021092800 72673 72415 |
%%BeginData: 204 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
dup /renlinear dup /uk.co.terryburton.bwipp findresource put |
begin |
12393,7 → 10864,6 |
/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 |
12418,10 → 10888,7 |
/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) |
12437,7 → 10904,6 |
|
% Create a string of the available characters |
/barchars (ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz #) def |
} ctxdef |
|
/barlen barcode length def |
barcode 0 2 getinterval (11) eq {37} if |
12582,8 → 11048,6 |
|
dontdraw not //renlinear if |
|
//unloadctx exec |
|
end |
|
} |
12597,17 → 11061,15 |
% --END ENCODER auspost-- |
|
% --BEGIN ENCODER kix-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear-- |
% --REQUIRES preamble raiseerror renlinear-- |
% --DESC: Royal Dutch TPG Post KIX |
% --EXAM: 1231FZ13XHS |
% --EXOP: includetext |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp kix 0.0 2022072900 66625 62978 |
%%BeginData: 122 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp kix 0.0 2021092800 57107 57044 |
%%BeginData: 113 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
dup /renlinear dup /uk.co.terryburton.bwipp findresource put |
begin |
12618,7 → 11080,6 |
/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 |
12642,9 → 11103,6 |
/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) |
12659,7 → 11117,6 |
/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 { |
12716,8 → 11173,6 |
|
dontdraw not //renlinear if |
|
//unloadctx exec |
|
end |
|
} |
12731,17 → 11186,15 |
% --END ENCODER kix-- |
|
% --BEGIN ENCODER japanpost-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear-- |
% --REQUIRES preamble 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 2022072900 71644 67819 |
%%BeginData: 174 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp japanpost 0.0 2021092800 62022 61757 |
%%BeginData: 164 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
dup /renlinear dup /uk.co.terryburton.bwipp findresource put |
begin |
12752,7 → 11205,6 |
/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 |
12777,11 → 11229,6 |
/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 |
12792,7 → 11239,7 |
|
% Create a string of the available characters |
/barchars (0123456789-ABCDEFGHIJKLMNOPQRSTUVWXYZ) def |
} ctxdef |
/barlen barcode length def |
|
/encstr 20 1 add 3 mul 4 add string def |
/digits 20 array def |
12902,8 → 11349,6 |
|
dontdraw not //renlinear if |
|
//unloadctx exec |
|
end |
|
} |
12917,17 → 11362,15 |
% --END ENCODER japanpost-- |
|
% --BEGIN ENCODER msi-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear-- |
% --REQUIRES preamble raiseerror renlinear-- |
% --DESC: MSI Modified Plessey |
% --EXAM: 0123456789 |
% --EXOP: includetext includecheck includecheckintext |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp msi 0.0 2022072900 76359 72660 |
%%BeginData: 150 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp msi 0.0 2021092800 67297 66798 |
%%BeginData: 141 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
dup /renlinear dup /uk.co.terryburton.bwipp findresource put |
begin |
12938,7 → 11381,6 |
/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 |
12966,9 → 11408,6 |
/textyoffset textyoffset cvr def |
/height height cvr def |
|
/msi //loadctx exec |
|
{ |
% Create an array containing the character mappings |
/encs |
[ (12121212) (12121221) (12122112) (12122121) (12211212) |
12978,7 → 11417,6 |
|
% Create a string of the available characters |
/barchars (0123456789) def |
} ctxdef |
|
/barlen barcode length def % Length of the code |
/txtlen barlen def |
12990,7 → 11428,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 |
} def |
} bind def |
|
/mod11 { |
/code exch def |
13002,7 → 11440,7 |
} { |
code length 1 add string dup 0 code putinterval dup code length 4 -1 roll 48 add put |
} ifelse |
} def |
} bind def |
|
/ncrmod11 { |
/code exch def |
13014,7 → 11452,7 |
} { |
code length 1 add string dup 0 code putinterval dup code length 4 -1 roll 48 add put |
} ifelse |
} def |
} bind def |
|
% Calculate checksum |
includecheck { |
13064,8 → 11502,6 |
|
dontdraw not //renlinear if |
|
//unloadctx exec |
|
end |
|
} |
13079,17 → 11515,15 |
% --END ENCODER msi-- |
|
% --BEGIN ENCODER plessey-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear-- |
% --REQUIRES preamble raiseerror renlinear-- |
% --DESC: Plessey UK |
% --EXAM: 01234ABCD |
% --EXOP: includetext includecheckintext |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp plessey 0.0 2022072900 73093 69275 |
%%BeginData: 157 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp plessey 0.0 2021092800 63687 63197 |
%%BeginData: 148 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
dup /renlinear dup /uk.co.terryburton.bwipp findresource put |
begin |
13100,7 → 11534,6 |
/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 |
13127,24 → 11560,11 |
/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 { |
13192,6 → 11612,15 |
/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 |
|
13233,8 → 11662,6 |
|
dontdraw not //renlinear if |
|
//unloadctx exec |
|
end |
|
} |
13248,17 → 11675,15 |
% --END ENCODER plessey-- |
|
% --BEGIN ENCODER telepen-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renlinear-- |
% --REQUIRES preamble raiseerror parseinput renlinear-- |
% --DESC: Telepen |
% --EXAM: ABCDEF |
% --EXOP: includetext |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp telepen 0.0 2022072900 71738 74891 |
%%BeginData: 174 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp telepen 0.0 2021092800 65612 65365 |
%%BeginData: 165 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
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 |
13270,7 → 11695,6 |
/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 |
13296,8 → 11720,6 |
/textyoffset textyoffset cvr def |
/height height cvr def |
|
/telepen //loadctx exec |
|
% Parse ordinals of the form ^NNN to ASCII |
/fncvals << |
/parse parse |
13309,7 → 11731,6 |
options (parse) undef |
|
% Create an array containing the character mappings |
{ |
/encs |
[ (31313131) (1131313111) (33313111) (1111313131) |
(3111313111) (11333131) (13133131) (111111313111) |
13344,7 → 11765,6 |
(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 |
13419,8 → 11839,6 |
|
dontdraw not //renlinear if |
|
//unloadctx exec |
|
end |
|
} |
13434,15 → 11852,15 |
% --END ENCODER telepen-- |
|
% --BEGIN ENCODER telepennumeric-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renlinear telepen-- |
% --REQUIRES preamble raiseerror parseinput renlinear telepen-- |
% --DESC: Telepen Numeric |
% --EXAM: 01234567 |
% --EXOP: includetext |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp telepennumeric 0.0 2022072900 63543 63521 |
%%BeginData: 58 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp telepennumeric 0.0 2021092800 54465 57771 |
%%BeginData: 57 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 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 |
13454,7 → 11872,6 |
/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 |
13480,7 → 11897,7 |
/textyoffset textyoffset cvr def |
/height height cvr def |
|
% Get the result of encoding with telepen with numeric=true |
% Get the result of encoding with code2of5 with version=industrial |
options (dontdraw) true put |
options (numeric) true put |
|
13504,17 → 11921,15 |
% --END ENCODER telepennumeric-- |
|
% --BEGIN ENCODER posicode-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renlinear-- |
% --REQUIRES preamble 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 2022072900 113401 116320 |
%%BeginData: 399 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp posicode 0.0 2021092800 107308 106674 |
%%BeginData: 390 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
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 |
13526,7 → 11941,6 |
/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 |
13561,9 → 11975,6 |
/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 |
13570,7 → 11981,9 |
/fn1 -7 def /fn2 -8 def /fn3 -9 def /fn4 -10 def |
|
% Character maps for each state |
/charmapsnormal [ |
<< |
/normal |
[ |
% 0 1 2 0 1 2 0 1 2 |
[ (0) (^) (') ] [ (1) (;) 27 ] [ (2) (<) 28 ] % 0-2 |
[ (3) (=) 29 ] [ (4) (>) 30 ] [ (5) (?) 31 ] % 3-5 |
13588,8 → 12001,9 |
[ ($) ({) (*) ] [ (/) (|) (,) ] [ (+) (}) (:) ] % 39-41 |
[ (%) (~) fn1 ] [ la1 la0 fn2 ] [ sf1 sf0 fn3 ] % 42-44 |
[ sf2 sf2 fn4 ] % 45 |
] def |
/chapmapslimited [ |
] |
/limited |
[ |
[ (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 |
13603,11 → 12017,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 |
] def |
} ctxdef |
] |
>> |
version (a) eq version (b) eq or {/normal} {/limited} ifelse get |
/charmaps exch def |
|
/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 |
13757,8 → 12171,7 |
} if % auto encoding |
|
% Create an array containing the character mappings |
{ |
/encmaps << % ";"=11, "<"=12 |
<< % ";"=11, "<"=12 |
/a |
[ (141112) (131212) (121312) (111412) (131113) |
(121213) (111313) (121114) (111214) (111115) |
13803,11 → 12216,9 |
(131415) (121515) (141216) (131316) (121416) |
(131217) (121317) (121218) (141212) (1) |
] |
>> def |
} ctxdef |
encmaps version get /encs exch def |
>> |
version get /encs exch def |
|
{ |
/c2w [ |
[ 495 330 210 126 70 35 15 5 ] |
[ 165 120 84 56 35 20 10 4 ] |
13815,7 → 12226,6 |
[ 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 |
13900,8 → 12310,6 |
|
dontdraw not //renlinear if |
|
//unloadctx exec |
|
end |
|
} |
13915,17 → 12323,15 |
% --END ENCODER posicode-- |
|
% --BEGIN ENCODER codablockf-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix-- |
% --REQUIRES preamble raiseerror parseinput renmatrix-- |
% --DESC: Codablock F |
% --EXAM: CODABLOCK F 34567890123456789010040digit |
% --EXOP: columns=8 |
% --RNDR: renmatrix |
%%BeginResource: uk.co.terryburton.bwipp codablockf 0.0 2022072900 134317 137326 |
%%BeginData: 499 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp codablockf 0.0 2021092800 128719 128096 |
%%BeginData: 488 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 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 |
13937,7 → 12343,6 |
/options exch def |
/barcode exch def |
|
/ctx null def |
/dontdraw false def |
/rows -1 def |
/columns 8 def |
13965,8 → 12370,6 |
/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 |
13994,7 → 12397,6 |
/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 |
14048,7 → 12450,6 |
/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 { |
14066,17 → 12467,17 |
/p p 1 add def |
} loop |
n s |
} def |
} bind def |
|
% Encoding for each alphabet |
/enca { |
seta exch get cws exch j exch put |
/j j 1 add def |
} def |
} bind def |
/encb { |
setb exch get cws exch j exch put |
/j j 1 add def |
} def |
} bind def |
/encc { |
dup type /arraytype ne { |
setc exch get |
14085,11 → 12486,11 |
} ifelse |
cws exch j exch put |
/j j 1 add def |
} def |
} bind def |
|
% Character exclusively in either alphabet A or B |
/anotb {dup seta exch known exch setb exch known not and} def |
/bnota {dup setb exch known exch seta exch known not and} def |
/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 |
|
% Pre-compute relative position of next anotb and next bnota characters |
/nextanotb [ msg length {0} repeat 9999 ] def |
14109,8 → 12510,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} def |
/bbeforea {dup nextbnota exch get exch nextanotb exch get lt} def |
/abeforeb {dup nextanotb exch get exch nextbnota exch get lt} bind def |
/bbeforea {dup nextbnota exch get exch nextanotb exch get lt} bind def |
|
% Add padding to row |
/padrow { |
14121,7 → 12522,7 |
cset (setc) eq {swb encc /cset (setb) def exit} if |
} loop |
} repeat |
} def |
} bind def |
|
% Convert message to codewords |
/cws c 5 add 44 mul array def |
14346,7 → 12747,6 |
} for |
|
% Create an array containing the character mappings |
{ |
/encs |
[ (212222) (222122) (222221) (121223) (121322) (131222) (122213) |
(122312) (132212) (221213) (221312) (231212) (112232) (122132) |
14364,7 → 12764,6 |
(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 |
14411,8 → 12810,6 |
|
dontdraw not //renmatrix if |
|
//unloadctx exec |
|
end |
|
} |
14426,17 → 12823,15 |
% --END ENCODER codablockf-- |
|
% --BEGIN ENCODER code16k-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix-- |
% --REQUIRES preamble raiseerror parseinput renmatrix-- |
% --DESC: Code 16K |
% --EXAM: Abcd-1234567890-wxyZ |
% --EXOP: |
% --RNDR: renmatrix |
%%BeginResource: uk.co.terryburton.bwipp code16k 0.0 2022072900 158879 165054 |
%%BeginData: 725 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp code16k 0.0 2021092800 153345 152816 |
%%BeginData: 711 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 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 |
14448,7 → 12843,6 |
/options exch def |
/barcode exch def |
|
/ctx null def |
/dontdraw false def |
/mode -1 def |
/pos -1 def |
14477,12 → 12871,9 |
/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 |
14544,7 → 12935,6 |
/seta charvals 0 get def |
/setb charvals 1 get def |
/setc charvals 2 get def |
} ctxdef |
|
raw {/encoding (raw) def} if |
|
14626,17 → 13016,17 |
/p p 1 add def |
} loop |
n s |
} def |
} bind def |
|
% Encoding for each alphabet |
/enca { |
seta exch get cws exch j exch put |
/j j 1 add def |
} def |
} bind def |
/encb { |
setb exch get cws exch j exch put |
/j j 1 add def |
} def |
} bind def |
/encc { |
dup type /arraytype ne { |
setc exch get |
14645,11 → 13035,11 |
} ifelse |
cws exch j exch put |
/j j 1 add def |
} def |
} bind def |
|
% Character exclusively in either alphabet A or B |
/anotb {dup seta exch known exch setb exch known not and} def |
/bnota {dup setb exch known exch seta exch known not and} def |
/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 |
|
% Pre-compute relative position of next anotb and next bnota characters |
/nextanotb [ msg length {0} repeat 9999 ] def |
14669,8 → 13059,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} def |
/bbeforea {dup nextbnota exch get exch nextanotb exch get lt} def |
/abeforeb {dup nextanotb exch get exch nextbnota exch get lt} bind def |
/bbeforea {dup nextbnota exch get exch nextanotb exch get lt} bind def |
|
/cws barcode length 2 mul 3 add array def |
|
15014,7 → 13404,6 |
|
% Basic metrics for the each symbol |
% r dcws |
{ |
/metrics [ |
[ 2 7 ] |
[ 3 12 ] |
15032,7 → 13421,6 |
[ 15 72 ] |
[ 16 77 ] |
] def |
} ctxdef |
|
% Select metrics of an appropriate symbol |
/urows rows def |
15062,7 → 13450,6 |
/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) |
15095,8 → 13482,6 |
(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 |
} { |
15148,8 → 13533,6 |
|
dontdraw not //renmatrix if |
|
//unloadctx exec |
|
end |
|
} |
15163,17 → 13546,15 |
% --END ENCODER code16k-- |
|
% --BEGIN ENCODER code49-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix-- |
% --REQUIRES preamble raiseerror parseinput renmatrix-- |
% --DESC: Code 49 |
% --EXAM: MULTIPLE ROWS IN CODE 49 |
% --EXOP: |
% --RNDR: renmatrix |
%%BeginResource: uk.co.terryburton.bwipp code49 0.0 2022072900 261572 278054 |
%%BeginData: 1063 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp code49 0.0 2021092800 255438 268416 |
%%BeginData: 1042 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 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 |
15185,7 → 13566,6 |
/options exch def |
/barcode exch def |
|
/ctx null def |
/dontdraw false def |
/mode -1 def |
/pos -1 def |
15212,13 → 13592,8 |
/rowheight rowheight cvi def |
/sepheight sepheight cvi def |
|
/code49 //loadctx exec |
|
{ |
% Parse the input |
/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 |
15229,7 → 13604,6 |
/msg barcode fncvals //parseinput exec def |
/msglen msg length def |
|
{ |
% Character encodings |
/charmap [ |
(0) (1) (2) (3) (4) (5) (6) (7) (8) (9) |
15269,7 → 13643,6 |
charvals i [ charvals s2 get charvals c2 get ] put |
} if |
} for |
} ctxdef |
|
/encodealpha { |
charvals exch get |
15276,7 → 13649,7 |
dup type /arraytype ne {1 array astore} if |
dup cws exch j exch putinterval |
length j add /j exch def |
} def |
} bind def |
|
/base48 { |
0 exch {48 sub exch 10 mul add} forall |
15284,7 → 13657,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 |
} def |
} bind def |
|
/encodenumeric { |
/nums exch def |
15299,7 → 13672,7 |
3 [49 48 nums 0 4 getinterval aload pop] base48 |
2 nums 4 3 getinterval base48 |
} if |
} def |
} bind def |
|
% Pre-compute alphanumeric and numeric runlengths |
/numericruns [ msglen {0} repeat 0 ] def |
15328,7 → 13701,10 |
/cws msglen 2 mul 1 add array def |
/method (alpha) def /i -1 def /j -1 def |
|
{ |
% Handle start for each mode |
mode 0 eq mode 1 eq or {/method (alpha) def /i 0 def /j 0 def} if |
mode 2 eq {/method (numeric) def /i 0 def /j 0 def} if |
mode 3 eq { |
/posval [ |
12 22 |
13 23 33 |
15339,12 → 13715,6 |
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 { |
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 |
15383,7 → 13753,6 |
|
% Basic metrics for the each symbol |
% r dcws |
{ |
/metrics [ |
[ 2 9 ] |
[ 3 16 ] |
15393,7 → 13762,6 |
[ 7 42 ] |
[ 8 49 ] |
] def |
} ctxdef |
|
% Select metrics of an appropriate symbol |
/urows rows def |
15431,13 → 13799,11 |
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 |
15447,7 → 13813,7 |
weights i 1 add get mul /score exch score add def |
} for |
score |
} def |
} bind def |
/lastrow ccs ccs length 8 sub 8 getinterval def |
|
% wr1 check character |
15477,7 → 13843,6 |
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) |
16173,7 → 14538,6 |
/parity [ |
(1001) (0101) (1100) (0011) (1010) (0110) (1111) (0000) |
] def |
} ctxdef |
|
% Derive the bits for each row |
/rowbits r array def |
16223,8 → 14587,6 |
|
dontdraw not //renmatrix if |
|
//unloadctx exec |
|
end |
|
} |
16238,17 → 14600,15 |
% --END ENCODER code49-- |
|
% --BEGIN ENCODER channelcode-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear-- |
% --REQUIRES preamble raiseerror renlinear-- |
% --DESC: Channel Code |
% --EXAM: 3493 |
% --EXOP: height=0.5 includetext |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp channelcode 0.0 2022072900 133046 128171 |
%%BeginData: 262 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp channelcode 0.0 2021092800 125552 124333 |
%%BeginData: 250 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
dup /renlinear dup /uk.co.terryburton.bwipp findresource put |
begin |
16259,7 → 14619,6 |
/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 |
16279,8 → 14638,6 |
|
/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 |
16296,27 → 14653,27 |
|
% Tail-call optimisation FTW! |
/loops1 { /s2max s1max 1 add s1 sub def /b1 1 def |
s1 1 eq {nextb1} {loopb1} ifelse } def |
/loopb1 { /b2max b1max 1 add b1 sub def /s2 1 def loops2 } def |
s1 1 eq {nextb1} {loopb1} ifelse } bind def |
/loopb1 { /b2max b1max 1 add b1 sub def /s2 1 def loops2 } bind def |
/loops2 { /s3max s2max 1 add s2 sub def /b2 1 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 |
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 |
/loops3 { /s4max s3max 1 add s3 sub def /b3 1 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 |
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 |
/loops4 { /s5max s4max 1 add s4 sub def /b4 1 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 |
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 |
/loops5 { /s6max s5max 1 add s5 sub def /b5 1 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 |
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 |
/loops6 { /s7max s6max 1 add s6 sub def /b6 1 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 |
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 |
/loops7 { /s8 s7max 1 add s7 sub def /b7 1 def |
b5 s6 add b6 add s7 add 4 eq {nextb7} {loopb7} ifelse } def |
b5 s6 add b6 add s7 add 4 eq {nextb7} {loopb7} ifelse } bind def |
/loopb7 { /b8 b7max 1 add b7 sub def |
b6 s7 add b7 add s8 add b8 add 5 eq {nextb7} {chkchr} ifelse } def |
b6 s7 add b7 add s8 add b8 add 5 eq {nextb7} {chkchr} ifelse } bind def |
/chkchr { |
value target eq { |
[s1 b1 s2 b2 s3 b3 s4 b4 s5 b5 s6 b6 s7 b7 s8 b8] exit |
16323,23 → 14680,22 |
} if |
/value value 1 add def |
nextb7 |
} 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 |
} 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 |
|
{ |
/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] ] |
16414,7 → 14770,6 |
[ 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 |
16438,7 → 14793,7 |
|
1 {chkchr} repeat 8 chan sub 2 mul dup 16 exch sub getinterval |
|
} def |
} bind def |
|
/barlen barcode length def |
|
16449,8 → 14804,9 |
/data barcode cvi barlen 1 add encode def |
|
% Determine check data |
{ |
/mod23map [ |
/check [] def |
includecheck { |
/mod23 [ |
[] [] |
[ 13 12 4 9 3 1 ] |
[ 8 2 12 3 18 16 4 1 ] |
16458,11 → 14814,7 |
[ 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 ] |
] def |
} ctxdef |
/check [] def |
includecheck { |
/mod23 mod23map barlen get def |
] barlen get def |
0 |
0 1 data length 1 sub { |
dup data exch get 1 sub exch mod23 exch get mul add |
16497,8 → 14849,6 |
|
dontdraw not //renlinear if |
|
//unloadctx exec |
|
end |
|
} |
16512,17 → 14862,15 |
% --END ENCODER channelcode-- |
|
% --BEGIN ENCODER flattermarken-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear-- |
% --REQUIRES preamble 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 2022072900 63323 59686 |
%%BeginData: 104 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp flattermarken 0.0 2021092800 53805 53752 |
%%BeginData: 95 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
dup /renlinear dup /uk.co.terryburton.bwipp findresource put |
begin |
16533,7 → 14881,6 |
/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 |
16564,8 → 14911,6 |
/textyoffset textyoffset cvr def |
/height height cvr def |
|
/flattermarken //loadctx exec |
|
% Validate the input |
barcode { |
dup 48 lt exch 57 gt or { |
16573,7 → 14918,6 |
} if |
} forall |
|
{ |
% Create an array containing the character mappings |
/encs |
[ (0018) (0117) (0216) (0315) (0414) (0513) (0612) (0711) (0810) |
16582,7 → 14926,6 |
|
% Create a string of the available characters |
/barchars (1234567890) def |
} ctxdef |
|
/barlen barcode length def % Length of the code |
|
16613,8 → 14956,6 |
|
dontdraw not //renlinear if |
|
//unloadctx exec |
|
end |
|
} |
16633,10 → 14974,10 |
% --EXAM: 331132131313411122131311333213114131131221323 |
% --EXOP: height=0.5 |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp raw 0.0 2022072900 49590 49507 |
%%BeginData: 55 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp raw 0.0 2021092800 49511 49415 |
%%BeginData: 54 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
dup /renlinear dup /uk.co.terryburton.bwipp findresource put |
begin |
16647,7 → 14988,6 |
/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 |
|
16700,10 → 15040,10 |
% --EXAM: FATDAFTDAD |
% --EXOP: |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp daft 0.0 2022072900 52828 52694 |
%%BeginData: 79 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp daft 0.0 2021092800 52789 52642 |
%%BeginData: 78 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
dup /renlinear dup /uk.co.terryburton.bwipp findresource put |
begin |
16714,7 → 15054,6 |
/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 |
|
16791,10 → 15130,10 |
% --EXAM: fima |
% --EXOP: backgroundcolor=DD000011 |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp symbol 0.0 2022072900 53524 53245 |
%%BeginData: 80 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp symbol 0.0 2021092800 53469 53305 |
%%BeginData: 79 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
dup /renlinear dup /uk.co.terryburton.bwipp findresource put |
begin |
16805,7 → 15144,6 |
/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 |
16878,17 → 15216,15 |
% --END ENCODER symbol-- |
|
% --BEGIN ENCODER pdf417-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix-- |
% --REQUIRES preamble raiseerror parseinput renmatrix-- |
% --DESC: PDF417 |
% --EXAM: This is PDF417 |
% --EXOP: columns=2 |
% --RNDR: renmatrix |
%%BeginResource: uk.co.terryburton.bwipp pdf417 0.0 2022072900 201920 207600 |
%%BeginData: 911 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp pdf417 0.0 2021092800 196554 198626 |
%%BeginData: 900 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 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 |
16900,7 → 15236,6 |
/options exch def |
/barcode exch def |
|
/ctx null def |
/dontdraw false def |
/compact false def |
/eclevel -1 def |
16929,9 → 15264,80 |
/rows rows cvi def |
/rowmult rowmult cvr def |
|
/pdf417 //loadctx exec |
raw {/encoding (raw) def} if |
|
{ |
% Convert input into array of codewords |
encoding (raw) eq { |
/datcws barcode length array def |
/i 0 def /j 0 def |
{ % loop |
i barcode length eq {exit} if |
/cw barcode i 1 add 3 getinterval cvi def |
datcws j cw put |
/i i 4 add def |
/j j 1 add def |
} loop |
/datcws datcws 0 j getinterval def |
} if |
|
ccc {/encoding (ccc) def} if |
|
/encb { |
/in exch def |
/inlen in length def |
/out inlen 6 idiv 5 mul inlen 6 mod add array def |
0 1 inlen 6 idiv 1 sub { |
/k exch def |
/msbs [ in k 6 mul 3 getinterval aload pop ] def |
/mscs [ |
msbs aload pop exch 256 mul add exch 65536 mul add |
3 {dup 900 mod exch 900 idiv} repeat |
] def |
/lsbs [ in k 6 mul 3 add 3 getinterval aload pop ] def |
/lscs [ |
lsbs aload pop exch 256 mul add exch 65536 mul add |
3 {dup 900 mod exch 900 idiv} repeat |
] def |
lscs 0 get mscs 0 get 316 mul add |
out k 5 mul 4 add 2 index 900 mod put |
900 idiv lscs 1 get add mscs 0 get 641 mul add mscs 1 get 316 mul add |
out k 5 mul 3 add 2 index 900 mod put |
900 idiv lscs 2 get add mscs 0 get 20 mul add mscs 1 get 641 mul add mscs 2 get 316 mul add |
out k 5 mul 2 add 2 index 900 mod put |
900 idiv lscs 3 get add mscs 1 get 20 mul add mscs 2 get 641 mul add |
out k 5 mul 1 add 2 index 900 mod put |
900 idiv mscs 2 get 20 mul add |
out k 5 mul 3 -1 roll 900 mod put |
} for |
/rem inlen 6 mod def |
rem 0 ne { |
out out length rem sub |
[ in inlen rem sub rem getinterval aload pop ] |
putinterval |
} if |
out |
} bind def |
|
encoding (byte) eq encoding (ccc) eq or { |
/barlen barcode length def |
/datcws barlen 6 idiv 5 mul barlen 6 mod add 1 add array def |
datcws 0 barlen 6 mod 0 eq {924} {901} ifelse put |
datcws 1 [ barcode {} forall ] encb putinterval |
encoding (ccc) eq {/datcws [920 datcws aload pop] def} if |
} if |
|
encoding (auto) eq { |
|
% Parse the input |
/fncvals << |
/parse parse |
/parsefnc parsefnc |
/eci true |
% Predates FNC non-data codewords, but supports ECI |
>> def |
/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 |
17017,85 → 15423,6 |
[ 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 |
encoding (raw) eq { |
/datcws barcode length array def |
/i 0 def /j 0 def |
{ % loop |
i barcode length eq {exit} if |
/cw barcode i 1 add 3 getinterval cvi def |
datcws j cw put |
/i i 4 add def |
/j j 1 add def |
} loop |
/datcws datcws 0 j getinterval def |
} if |
|
ccc {/encoding (ccc) def} if |
|
/encb { |
/in exch def |
/inlen in length def |
/out inlen 6 idiv 5 mul inlen 6 mod add array def |
0 1 inlen 6 idiv 1 sub { |
/k exch def |
/msbs [ in k 6 mul 3 getinterval aload pop ] def |
/mscs [ |
msbs aload pop exch 256 mul add exch 65536 mul add |
3 {dup 900 mod exch 900 idiv} repeat |
] def |
/lsbs [ in k 6 mul 3 add 3 getinterval aload pop ] def |
/lscs [ |
lsbs aload pop exch 256 mul add exch 65536 mul add |
3 {dup 900 mod exch 900 idiv} repeat |
] def |
lscs 0 get mscs 0 get 316 mul add |
out k 5 mul 4 add 2 index 900 mod put |
900 idiv lscs 1 get add mscs 0 get 641 mul add mscs 1 get 316 mul add |
out k 5 mul 3 add 2 index 900 mod put |
900 idiv lscs 2 get add mscs 0 get 20 mul add mscs 1 get 641 mul add mscs 2 get 316 mul add |
out k 5 mul 2 add 2 index 900 mod put |
900 idiv lscs 3 get add mscs 1 get 20 mul add mscs 2 get 641 mul add |
out k 5 mul 1 add 2 index 900 mod put |
900 idiv mscs 2 get 20 mul add |
out k 5 mul 3 -1 roll 900 mod put |
} for |
/rem inlen 6 mod def |
rem 0 ne { |
out out length rem sub |
[ in inlen rem sub rem getinterval aload pop ] |
putinterval |
} if |
out |
} def |
|
encoding (byte) eq encoding (ccc) eq or { |
/barlen barcode length def |
/datcws barlen 6 idiv 5 mul barlen 6 mod add 1 add array def |
datcws 0 barlen 6 mod 0 eq {924} {901} ifelse put |
datcws 1 [ barcode {} forall ] encb putinterval |
encoding (ccc) eq {/datcws [920 datcws aload pop] def} if |
} if |
|
encoding (auto) eq { |
|
% Parse the input |
/fncvals << |
/parse parse |
/parsefnc parsefnc |
/eci true |
% Predates FNC non-data codewords, but supports ECI |
>> def |
/msg barcode fncvals //parseinput exec def |
/msglen msg length def |
|
% Determine runlengths of digits |
/numdigits [ msglen {0} repeat 0 ] def |
/numtext [ msglen {0} repeat 0 ] def |
17174,17 → 15501,21 |
} 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} def |
/encl {charvals L get exch get} def |
/encm {charvals M get exch get} def |
/encp {charvals P get exch get} def |
/enca {charvals A get exch get} bind def |
/encl {charvals L get exch get} bind def |
/encm {charvals M get exch get} bind def |
/encp {charvals P get exch get} bind def |
/textencfuncs [ /enca /encl /encm /encp ] def |
|
/addtotext { |
text exch l exch put |
/l l 1 add def |
} def |
} bind def |
|
/enct { |
/in exch def |
17315,7 → 15646,7 |
|
out |
|
} def |
} bind def |
|
/encn { |
/in exch def |
17349,7 → 15680,7 |
/out [ out aload pop cwn aload pop ] def |
} for |
out |
} def |
} bind def |
|
/ence { |
0 get neg 1000000 sub |
17362,7 → 15693,7 |
} { |
/bwipp.pdf417badECI (PDF417 supports ECIs 000000 to 811799) //raiseerror exec |
} ifelse } ifelse } ifelse |
} def |
} bind def |
|
/encfuncs [ /enct /encn /encb ] def |
|
17369,7 → 15700,7 |
/addtocws { |
dup datcws j 3 -1 roll putinterval |
length j add /j exch def |
} def |
} bind def |
|
% Encode the sequence |
/state T def /submode A def |
17453,7 → 15784,7 |
} { |
pop pop 0 |
} ifelse |
} def |
} bind def |
|
% Generate the coefficients |
/coeffs [ 1 k {0} repeat ] def |
17485,7 → 15816,6 |
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 |
17726,7 → 16056,6 |
67476 69556 67474 69554 116714 |
] |
] def |
} ctxdef |
|
% Return the 17 bits for a codeword in a given cluster |
/cwtobits { |
17733,7 → 16062,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 |
} def |
} bind def |
|
% Populate bitmap for the image |
compact { |
17786,8 → 16115,6 |
|
dontdraw not //renmatrix if |
|
//unloadctx exec |
|
end |
|
} |
17801,15 → 16128,15 |
% --END ENCODER pdf417-- |
|
% --BEGIN ENCODER pdf417compact-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix pdf417-- |
% --REQUIRES preamble 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 2022072900 62537 62412 |
%%BeginData: 46 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp pdf417compact 0.0 2021092800 53355 56790 |
%%BeginData: 45 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 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 |
17821,7 → 16148,6 |
/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 |
17859,17 → 16185,15 |
% --END ENCODER pdf417compact-- |
|
% --BEGIN ENCODER micropdf417-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix-- |
% --REQUIRES preamble raiseerror parseinput renmatrix-- |
% --DESC: MicroPDF417 |
% --EXAM: MicroPDF417 |
% --EXOP: |
% --RNDR: renmatrix |
%%BeginResource: uk.co.terryburton.bwipp micropdf417 0.0 2022072900 212812 225269 |
%%BeginData: 998 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp micropdf417 0.0 2021092800 207257 212591 |
%%BeginData: 982 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 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 |
17881,7 → 16205,6 |
/options exch def |
/barcode exch def |
|
/ctx null def |
/dontdraw false def |
/version (unset) def |
/columns 0 def |
17915,9 → 16238,81 |
/rows rows cvi def |
/rowmult rowmult cvr def |
|
/micropdf417 //loadctx exec |
raw {/encoding (raw) def} if |
cca {/encoding (cca) def} if |
|
{ |
% Convert input into array of codewords |
encoding (raw) eq encoding (cca) eq or { |
/datcws barcode length array def |
/i 0 def /j 0 def |
{ % loop |
i barcode length eq {exit} if |
/cw barcode i 1 add 3 getinterval cvi def |
datcws j cw put |
/i i 4 add def |
/j j 1 add def |
} loop |
/datcws datcws 0 j getinterval def |
} if |
|
ccb {/encoding (ccb) def} if |
|
/encb { |
/in exch def |
/inlen in length def |
/out inlen 6 idiv 5 mul inlen 6 mod add array def |
0 1 inlen 6 idiv 1 sub { |
/k exch def |
/msbs [ in k 6 mul 3 getinterval aload pop ] def |
/mscs [ |
msbs aload pop exch 256 mul add exch 65536 mul add |
3 {dup 900 mod exch 900 idiv} repeat |
] def |
/lsbs [ in k 6 mul 3 add 3 getinterval aload pop ] def |
/lscs [ |
lsbs aload pop exch 256 mul add exch 65536 mul add |
3 {dup 900 mod exch 900 idiv} repeat |
] def |
lscs 0 get mscs 0 get 316 mul add |
out k 5 mul 4 add 2 index 900 mod put |
900 idiv lscs 1 get add mscs 0 get 641 mul add mscs 1 get 316 mul add |
out k 5 mul 3 add 2 index 900 mod put |
900 idiv lscs 2 get add mscs 0 get 20 mul add mscs 1 get 641 mul add mscs 2 get 316 mul add |
out k 5 mul 2 add 2 index 900 mod put |
900 idiv lscs 3 get add mscs 1 get 20 mul add mscs 2 get 641 mul add |
out k 5 mul 1 add 2 index 900 mod put |
900 idiv mscs 2 get 20 mul add |
out k 5 mul 3 -1 roll 900 mod put |
} for |
/rem inlen 6 mod def |
rem 0 ne { |
out out length rem sub |
[ in inlen rem sub rem getinterval aload pop ] |
putinterval |
} if |
out |
} bind def |
|
encoding (byte) eq encoding (ccb) eq or { |
/barlen barcode length def |
/datcws barlen 6 idiv 5 mul barlen 6 mod add 1 add array def |
datcws 0 barlen 6 mod 0 eq {924} {901} ifelse put |
datcws 1 [ barcode {} forall ] encb putinterval |
encoding (ccb) eq {/datcws [920 datcws aload pop] def} if |
} if |
|
encoding (auto) eq { |
|
% Parse the input |
/fncvals << |
/parse parse |
/parsefnc parsefnc |
/eci true |
% Predates FNC non-data codewords, but supports ECI |
>> def |
/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 |
18002,83 → 16397,7 |
[ e e e 1 ] % M |
[ e e e e ] % P |
] def |
} ctxdef |
|
raw {/encoding (raw) def} if |
cca {/encoding (cca) def} if |
|
% Convert input into array of codewords |
encoding (raw) eq encoding (cca) eq or { |
/datcws barcode length array def |
/i 0 def /j 0 def |
{ % loop |
i barcode length eq {exit} if |
/cw barcode i 1 add 3 getinterval cvi def |
datcws j cw put |
/i i 4 add def |
/j j 1 add def |
} loop |
/datcws datcws 0 j getinterval def |
} if |
|
ccb {/encoding (ccb) def} if |
|
/encb { |
/in exch def |
/inlen in length def |
/out inlen 6 idiv 5 mul inlen 6 mod add array def |
0 1 inlen 6 idiv 1 sub { |
/k exch def |
/msbs [ in k 6 mul 3 getinterval aload pop ] def |
/mscs [ |
msbs aload pop exch 256 mul add exch 65536 mul add |
3 {dup 900 mod exch 900 idiv} repeat |
] def |
/lsbs [ in k 6 mul 3 add 3 getinterval aload pop ] def |
/lscs [ |
lsbs aload pop exch 256 mul add exch 65536 mul add |
3 {dup 900 mod exch 900 idiv} repeat |
] def |
lscs 0 get mscs 0 get 316 mul add |
out k 5 mul 4 add 2 index 900 mod put |
900 idiv lscs 1 get add mscs 0 get 641 mul add mscs 1 get 316 mul add |
out k 5 mul 3 add 2 index 900 mod put |
900 idiv lscs 2 get add mscs 0 get 20 mul add mscs 1 get 641 mul add mscs 2 get 316 mul add |
out k 5 mul 2 add 2 index 900 mod put |
900 idiv lscs 3 get add mscs 1 get 20 mul add mscs 2 get 641 mul add |
out k 5 mul 1 add 2 index 900 mod put |
900 idiv mscs 2 get 20 mul add |
out k 5 mul 3 -1 roll 900 mod put |
} for |
/rem inlen 6 mod def |
rem 0 ne { |
out out length rem sub |
[ in inlen rem sub rem getinterval aload pop ] |
putinterval |
} if |
out |
} def |
|
encoding (byte) eq encoding (ccb) eq or { |
/barlen barcode length def |
/datcws barlen 6 idiv 5 mul barlen 6 mod add 1 add array def |
datcws 0 barlen 6 mod 0 eq {924} {901} ifelse put |
datcws 1 [ barcode {} forall ] encb putinterval |
encoding (ccb) eq {/datcws [920 datcws aload pop] def} if |
} if |
|
encoding (auto) eq { |
|
% Parse the input |
/fncvals << |
/parse parse |
/parsefnc parsefnc |
/eci true |
% Predates FNC non-data codewords, but supports ECI |
>> def |
/msg barcode fncvals //parseinput exec def |
/msglen msg length def |
|
% Determine runlengths of digits |
/numdigits [ msglen {0} repeat 0 ] def |
/numtext [ msglen {0} repeat 0 ] def |
18162,16 → 16481,16 |
>> def |
|
% Submode encoding functions |
/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 |
/enca {charvals A get exch get} bind def |
/encl {charvals L get exch get} bind def |
/encm {charvals M get exch get} bind def |
/encp {charvals P get exch get} bind def |
/textencfuncs [ /enca /encl /encm /encp ] def |
|
/addtotext { |
text exch l exch put |
/l l 1 add def |
} def |
} bind def |
|
/enct { |
|
18303,7 → 16622,7 |
|
out |
|
} def |
} bind def |
|
/encn { |
/in exch def |
18337,7 → 16656,7 |
/out [ out aload pop cwn aload pop ] def |
} for |
out |
} def |
} bind def |
|
/ence { |
0 get neg 1000000 sub |
18350,7 → 16669,7 |
} { |
/bwipp.pdf417badECI (PDF417 supports ECIs 000000 to 811799) //raiseerror exec |
} ifelse } ifelse } ifelse |
} def |
} bind def |
|
/encfuncs [ /enct /encn /encb ] def |
|
18357,7 → 16676,7 |
/addtocws { |
dup datcws j 3 -1 roll putinterval |
length j add /j exch def |
} def |
} bind def |
|
% Encode the sequence |
% No need to set state as seq will always begin with a latch, unlike for pdf417 |
18386,32 → 16705,9 |
/datcws datcws 0 j getinterval def |
} if |
|
{ |
% 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 |
|
% Basic metrics for the each symbol |
% c r ecw rl rc rr |
/nonccametrics [ |
/metrics [ |
[ 1 11 7 1 0 9 ] |
[ 1 14 7 8 0 8 ] |
[ 1 17 7 36 0 36 ] |
18447,9 → 16743,29 |
[ 4 38 44 15 31 47 ] |
[ 4 44 50 1 25 49 ] |
] def |
} ctxdef |
|
/metrics cca {ccametrics} {nonccametrics} ifelse def |
% 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 |
|
% Select metrics of an appropriate symbol |
/urows rows def |
18481,11 → 16797,9 |
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 { |
18494,7 → 16808,7 |
} { |
pop pop 0 |
} ifelse |
} def |
} bind def |
|
% Generate the coefficients |
/coeffs [ 1 k {0} repeat ] def |
18525,7 → 16839,6 |
|
options /debugcws known { /bwipp.debugcws cws //raiseerror exec } if |
|
{ |
% Base 10 encoding of the bar space successions for the codewords in each cluster |
/clusters [ |
[ |
18782,7 → 17095,6 |
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 { |
18789,7 → 17101,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 |
} def |
} bind def |
|
% Return the 10 bits for a row address pattern |
/raptobits { |
18796,7 → 17108,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 |
} def |
} bind def |
|
% Populate bitmap for the image |
/rwid [38 55 82 99] c 1 sub get def |
18854,8 → 17166,6 |
|
dontdraw not //renmatrix if |
|
//unloadctx exec |
|
end |
|
} |
18869,17 → 17179,15 |
% --END ENCODER micropdf417-- |
|
% --BEGIN ENCODER datamatrix-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix-- |
% --REQUIRES preamble raiseerror parseinput renmatrix-- |
% --DESC: Data Matrix |
% --EXAM: This is Data Matrix! |
% --EXOP: |
% --RNDR: renmatrix |
%%BeginResource: uk.co.terryburton.bwipp datamatrix 0.0 2022072900 213397 242547 |
%%BeginData: 934 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp datamatrix 0.0 2021092800 208367 234349 |
%%BeginData: 920 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 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 |
18891,7 → 17199,6 |
/options exch def |
/barcode exch def |
|
/ctx null def |
/dontdraw false def |
/columns 0 def |
/rows 0 def |
18928,9 → 17235,6 |
|
/isodmre dmre def |
|
/datamatrix //loadctx exec |
|
% TODO make this "static" |
% Basic metrics for the each symbol |
% rows cols regh regv rscw rsbl |
/metrics [ |
19020,7 → 17324,23 |
} if |
} for |
|
{ |
raw {/encoding (raw) def} if |
|
encoding (raw) eq { |
/cws barcode length array def |
/i 0 def /j 0 def |
{ % loop |
i barcode length eq {exit} if |
/cw barcode i 1 add 3 getinterval cvi def |
cws j cw put |
/i i 4 add def |
/j j 1 add def |
} loop |
/cws cws 0 j getinterval def |
} if % encoding=raw |
|
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 |
19027,6 → 17347,38 |
/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 |
/parsefnc parsefnc |
/eci true |
(FNC1) fnc1 |
(PROG) prog |
% (MAC5) m05 Encoded automatically |
% (MAC6) m06 Encoded automatically |
>> def |
/msg barcode fncvals //parseinput exec def |
/msglen msg length def |
|
% Macro 05/06 compression of [)>{RS}05/06{GS}...{RS}{EOT} structured data |
msglen 9 ge { |
msg 0 7 getinterval aload pop |
29 eq exch pop exch 48 eq and exch % [)>{RS}0*{GS}... |
30 eq and exch 62 eq and exch 41 eq and exch 91 eq and { |
msg msglen 2 sub 2 getinterval aload pop |
4 eq exch 30 eq and { % ...{RS}{EOT} |
msg 5 get 53 eq { % ...5... |
/msg [ m05 msg 7 msg length 9 sub getinterval aload pop ] def |
} { |
msg 5 get 54 eq { % ...6... |
/msg [ m06 msg 7 msg length 9 sub getinterval aload pop ] def |
} if |
} ifelse |
} if |
} if |
} if |
/msglen msg length def |
|
/Avals << |
0 1 128 {dup 1 add} for |
pad 129 |
19130,58 → 17482,6 |
|
/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 { |
/cws barcode length array def |
/i 0 def /j 0 def |
{ % loop |
i barcode length eq {exit} if |
/cw barcode i 1 add 3 getinterval cvi def |
cws j cw put |
/i i 4 add def |
/j j 1 add def |
} loop |
/cws cws 0 j getinterval def |
} if % encoding=raw |
|
encoding (auto) eq { |
|
% Parse the input |
/fncvals << |
/parse parse |
/parsefnc parsefnc |
/eci true |
(FNC1) fnc1 |
(PROG) prog |
% (MAC5) m05 Encoded automatically |
% (MAC6) m06 Encoded automatically |
>> def |
/msg barcode fncvals //parseinput exec def |
/msglen msg length def |
|
% Macro 05/06 compression of [)>{RS}05/06{GS}...{RS}{EOT} structured data |
msglen 9 ge { |
msg 0 7 getinterval aload pop |
29 eq exch pop exch 48 eq and exch % [)>{RS}0*{GS}... |
30 eq and exch 62 eq and exch 41 eq and exch 91 eq and { |
msg msglen 2 sub 2 getinterval aload pop |
4 eq exch 30 eq and { % ...{RS}{EOT} |
msg 5 get 53 eq { % ...5... |
/msg [ m05 msg 7 msg length 9 sub getinterval aload pop ] def |
} { |
msg 5 get 54 eq { % ...6... |
/msg [ m06 msg 7 msg length 9 sub getinterval aload pop ] def |
} if |
} ifelse |
} if |
} if |
} if |
/msglen msg length def |
|
/numD [ msglen {0} repeat 0 ] def |
/nextXterm [ msglen {0} repeat 9999 ] def |
/nextNonX [ msglen {0} repeat 9999 ] def |
19207,15 → 17507,17 |
/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} 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 |
/isD {char 48 ge char 57 le and} bind def |
/isC {CNvals char known} bind def |
/isT {TNvals char known} bind def |
/isX {Xvals char known} bind def |
/isE {Evals char known} bind def |
/isEA {char 127 gt} bind def |
/isFN {char 0 lt} bind def |
/XtermFirst {dup nextXterm exch get exch nextNonX exch get lt} bind def |
|
/A 0 def /C 1 def /T 2 def /X 3 def /E 4 def /B 5 def |
|
/lookup { |
/ac 1 def /cc 2 def /tc 2 def /xc 2 def /ec 2 def /bc 2.25 def |
mode A eq {/ac 0 def /cc 1 def /tc 1 def /xc 1 def /ec 1 def /bc 1.25 def} if |
19259,12 → 17561,12 |
/k k 1 add def |
} loop |
} repeat |
} def |
} bind def |
|
/addtocws { |
dup cws exch j exch putinterval |
/j exch length j add def |
} def |
} bind def |
|
/ECItocws { |
neg 1000000 sub |
19283,7 → 17585,7 |
254 mod 1 add |
3 array astore |
} ifelse } ifelse |
} def |
} bind def |
|
/encA { |
1 { % Common exit |
19308,7 → 17610,7 |
/i i 1 add def |
exit |
} repeat |
} def |
} bind def |
|
/CTXvalstocws { |
/in exch def |
19318,7 → 17620,7 |
dup 256 idiv exch 256 mod |
} for |
counttomark array astore exch pop |
} def |
} bind def |
|
/encCTX { |
/p 0 def |
19330,7 → 17632,6 |
i msglen eq {exit} if |
encvals mode get msg i get known not {exit} if |
p 3 mod 0 eq { |
p 0 gt { |
/newmode lookup def |
newmode mode ne { |
ctxvals 0 p getinterval CTXvalstocws addtocws |
19342,7 → 17643,6 |
/done true def |
exit |
} if |
} if |
msglen i sub 3 le { % Check end of data conditions |
/remcws numremcws j p 3 idiv 2 mul add get def |
/remvals [ |
19428,7 → 17728,7 |
} if |
} if |
|
} def |
} bind def |
|
/Evalstocws { |
/in exch def |
19444,7 → 17744,7 |
} for |
counttomark array astore exch pop |
0 outlen getinterval |
} def |
} bind def |
|
/encE { |
/p 0 def |
19501,7 → 17801,7 |
} if |
} if |
|
} def |
} bind def |
|
/encB { |
/p 0 def /bvals 1558 array def { |
19528,7 → 17828,7 |
} for |
bvals addtocws |
/mode A def |
} def |
} bind def |
|
% Derive the codewords |
/cws 1558 array def |
19599,11 → 17899,9 |
} 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 { |
19612,7 → 17910,7 |
} { |
pop pop 0 |
} ifelse |
} def |
} bind def |
|
% Generate the coefficients |
/coeffs [ 1 rscw rsbl idiv {0} repeat ] def |
19680,7 → 17978,7 |
exch mcols mul add |
mmat exch 5 -1 roll put |
} forall |
} def |
} bind def |
|
% Placement patterns |
/dmn [ |
19800,8 → 18098,6 |
|
dontdraw not //renmatrix if |
|
//unloadctx exec |
|
end |
|
} |
19815,15 → 18111,15 |
% --END ENCODER datamatrix-- |
|
% --BEGIN ENCODER datamatrixrectangular-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix datamatrix-- |
% --REQUIRES preamble raiseerror parseinput renmatrix datamatrix-- |
% --DESC: Data Matrix Rectangular |
% --EXAM: 1234 |
% --EXOP: |
% --RNDR: renmatrix |
%%BeginResource: uk.co.terryburton.bwipp datamatrixrectangular 0.0 2022072900 62593 62460 |
%%BeginData: 46 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp datamatrixrectangular 0.0 2021092800 53411 56710 |
%%BeginData: 45 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 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 |
19835,7 → 18131,6 |
/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 |
19873,15 → 18168,15 |
% --END ENCODER datamatrixrectangular-- |
|
% --BEGIN ENCODER datamatrixrectangularextension-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix datamatrix-- |
% --REQUIRES preamble raiseerror parseinput renmatrix datamatrix-- |
% --DESC: Data Matrix Rectangular Extension |
% --EXAM: 1234 |
% --EXOP: version=8x96 |
% --RNDR: renmatrix |
%%BeginResource: uk.co.terryburton.bwipp datamatrixrectangularextension 0.0 2022072900 63780 63742 |
%%BeginData: 56 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp datamatrixrectangularextension 0.0 2021092800 54318 57584 |
%%BeginData: 55 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
20 dict |
1 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 |
19893,7 → 18188,6 |
/options exch def |
/barcode exch def |
|
/ctx null def |
/dontdraw false def |
|
/dmre false def |
19941,15 → 18235,15 |
% --END ENCODER datamatrixrectangularextension-- |
|
% --BEGIN ENCODER mailmark-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix datamatrix-- |
% --REQUIRES preamble 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 2022072900 65973 66022 |
%%BeginData: 81 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp mailmark 0.0 2021092800 56791 60248 |
%%BeginData: 80 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 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 |
19962,7 → 18256,6 |
/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 |
20034,17 → 18327,15 |
% --END ENCODER mailmark-- |
|
% --BEGIN ENCODER qrcode-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix-- |
% --REQUIRES preamble raiseerror parseinput renmatrix-- |
% --DESC: QR Code |
% --EXAM: http://goo.gl/0bis |
% --EXOP: eclevel=M |
% --RNDR: renmatrix |
%%BeginResource: uk.co.terryburton.bwipp qrcode 0.0 2022072900 327547 368583 |
%%BeginData: 1362 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp qrcode 0.0 2021092800 320203 358349 |
%%BeginData: 1306 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 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 |
20056,7 → 18347,6 |
/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 |
20078,8 → 18368,6 |
|
/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 { |
20116,8 → 18404,6 |
} if |
} if |
|
{ % context |
|
% Enumerate vergrps |
[ |
/v1to9 /v10to26 /v27to40 |
20150,7 → 18436,15 |
] {-1} forall |
>> def |
|
% Binary exclusives calculated from "not others" |
/Bexcl << |
[ |
16#00 1 16#1F {} for |
16#21 16#22 16#23 16#26 16#27 16#28 16#29 16#2C |
16#3B 1 16#40 {} for |
16#5B 1 16#7F {} for |
16#A0 1 16#DF {} for |
] {-1} forall |
>> def |
|
/Kexcl << |
[ |
20169,7 → 18463,7 |
[ (00) (01) (10) (11) -1 ] % vM3 |
[ (000) (001) (010) (011) -1 ] % vM4 |
32 { |
[ (001) (010) (011) (100) (111) ] % rMQR |
[ (001) (010) (011) (100) -1 ] % rMQR |
} repeat |
] def |
|
20200,7 → 18494,7 |
[ 5 5 4 3 ] % vR13x27 |
[ 6 6 5 5 ] % vR13x43 |
[ 7 6 6 5 ] % vR13x59 |
[ 7 7 6 6 ] % vR13x77 |
[ 8 7 6 6 ] % vR13x77 |
[ 8 7 7 6 ] % vR13x99 |
[ 8 8 7 7 ] % vR13x139 |
[ 7 6 6 5 ] % vR15x43 |
20228,7 → 18522,11 |
} repeat |
] def |
|
/padstrs [ (11101100) (00010001) ] def |
% Encoding functions |
/tobin { |
string dup length 1 sub 0 exch 1 exch {1 index exch 48 put} for |
dup 3 -1 roll 2 2 index length string cvrs dup length 2 index length exch sub exch putinterval |
} bind def |
|
% Alphanumeric character to value map |
/charmap (0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:) def |
20235,14 → 18533,6 |
/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 % |
20262,7 → 18552,7 |
length m add /m exch def |
} loop |
out 0 m getinterval |
} def |
} bind def |
|
/encN { |
/in exch def |
20285,7 → 18575,7 |
length m add /m exch def |
} loop |
out 0 m getinterval |
} def |
} bind def |
|
/encB { |
/in exch def |
20299,7 → 18589,7 |
out k 8 mul 3 -1 roll putinterval |
} for |
out |
} def |
} bind def |
|
/encK { |
/in exch def |
20314,7 → 18604,7 |
/k k 2 add def |
} loop |
out |
} def |
} bind def |
|
/encE { |
0 get neg 1000000 sub |
20325,7 → 18615,7 |
} { % ECI 016384 - 999999 |
2#110000000000000000000000 add 24 tobin |
} ifelse } ifelse |
} def |
} bind def |
|
/encfuncs [ /encN /encA /encB /encK /encE ] def |
|
20332,7 → 18622,7 |
/addtobits { |
dup bits j 3 -1 roll putinterval |
length j add /j exch def |
} def |
} bind def |
|
/numNs [ msglen {0} repeat 0 ] def |
/numAs [ msglen {0} repeat 0 ] def |
20342,6 → 18632,7 |
/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 |
20360,12 → 18651,20 |
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 |
20378,28 → 18677,19 |
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} 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 |
/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 |
|
% Elements of the encoded message have differing lengths based on the |
% resulting symbol size. The symbol sizes with different element lengths |
20408,8 → 18698,9 |
% on the format of symbol. |
|
% Determine which groups we need to encode |
{ |
/versetmap << |
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 |
20425,17 → 18716,11 |
(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 versetmap version get [ exch ] def |
>> version get [ exch ] def |
} { |
% Just the format is specified so encode in each vergrp for the type of symbol |
format (full) eq { /verset versetfull def } if |
format (micro) eq { /verset versetmicro def } if |
format (full) eq { /verset [v1to9 v10to26 v27to40] def } if |
format (micro) eq { /verset [vM1 vM2 vM3 vM4] def } if |
% rMQR symbols are accessed with an explicit version |
} ifelse |
|
20442,36 → 18727,6 |
% 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 |
|
20492,51 → 18747,54 |
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) |
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 |
[ 1 1 1 e e 1 1] KbeforeA {K exit} if |
[ 1 1 1 e e 1 1] KbeforeN {K exit} if |
[ 5 5 6 e e 2 3] KbeforeB {K exit} if |
[ 1 1 1 e e 1 1] KbeforeE {K exit} if |
numK 1 ge {B exit} if |
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 |
[ 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 |
numA 1 ge { |
ver vM2 ne {B} {A} ifelse 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 |
[ 4 4 5 e e 2 3] NbeforeB {N exit} if |
[ 1 1 1 e e 1 1] NbeforeB {B exit} if |
[ 7 8 9 e 3 4 5] NbeforeA {N exit} if |
[ 1 1 1 e 1 1 1] NbeforeA {A exit} if |
numN 1 ge {N exit} if |
B exit |
} if |
mode B eq { |
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 |
[ 9 12 13 e e 4 5] KbeforeB {K exit} if |
[ 9 10 12 e e 4 5] KbeforeA {K exit} if |
[ 9 10 11 e e 5 6] KbeforeN {K exit} if |
[ 4 5 6 e e 2 3] KbeforeE {K exit} if |
[11 12 14 e e 5 7] AbeforeK {A exit} if |
[11 15 16 e e 6 7] AbeforeB {A exit} if |
[12 13 15 e e 6 8] AbeforeN {A exit} if |
[ 6 7 8 e e 3 4] AbeforeE {A exit} if |
[ 6 7 8 e e 3 4] NbeforeK {N exit} if |
[ 6 8 9 e e 3 4] NbeforeB {N exit} if |
[ 6 7 8 e e 3 4] NbeforeA {N exit} if |
[ 3 4 5 e e 2 3] NbeforeE {N exit} if |
B exit |
} if |
mode A eq { |
numK 1 ge {K exit} if |
numB 1 ge {B exit} if |
modeANbeforeA NbeforeA {N exit} if |
modeANbeforeB NbeforeB {N exit} if |
modeANbeforeE NbeforeE {N 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 |
numA 1 ge numN 1 ge or {A exit} if |
B exit |
} if |
20608,7 → 18866,6 |
} 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 |
20689,8 → 18946,6 |
[ (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 |
20733,7 → 18988,7 |
} for |
|
okay not { |
/bwipp.qrcodeNoValidSymbol (Maximum length exceeded or invalid content) //raiseerror exec |
/bwipp.qrcodeNoValidSymbol (No valid symbol available) //raiseerror exec |
} if |
|
/format frmt def |
20753,6 → 19008,7 |
/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 |
20780,11 → 19036,9 |
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 { |
20793,7 → 19047,7 |
} { |
pop pop 0 |
} ifelse |
} def |
} bind def |
|
% Generate the coefficients for the Reed-Solomon algorithm |
/coeffs [ 1 ecpb {0} repeat ] def |
20822,7 → 19076,7 |
} for |
} for |
rscws rsnd ecpb getinterval |
} def |
} bind def |
|
% Divide codewords into two groups of blocks and calculate the error correction codewords |
/dcwsb ecb1 ecb2 add array def |
20883,7 → 19137,7 |
|
% Create the bitmap |
/pixs [ rows cols mul {-1} repeat ] def |
/qmv {cols mul add} def |
/qmv {cols mul add} bind def |
|
% Timing patterns |
format (full) eq { |
20921,7 → 19175,6 |
} if |
|
% Finder patterns |
{ |
/fpat [ |
[ 1 1 1 1 1 1 1 0 ] |
[ 1 0 0 0 0 0 1 0 ] |
20962,14 → 19215,12 |
[ 9 9 9 9 9 9 9 9 ] |
[ 9 9 9 9 9 9 9 9 ] |
] def |
/fpatmap << |
/fpats << |
% TL TR BL BR |
(full) [ fpat fpat fpat fnullpat ] |
(micro) [ fpat fnullpat fnullpat fnullpat ] |
(rmqr) [ fpat fcorpat fcorpat fsubpat ] |
>> def |
} ctxdef |
/fpats fpatmap format get def |
>> format get def |
0 1 7 { |
/y exch def |
0 1 7 { |
20986,23 → 19237,6 |
} 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 |
21016,9 → 19250,15 |
} if |
} for |
} for |
} def |
} bind def |
format (full) eq { |
/algnpat algnpatfull def |
/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 |
asp2 2 sub asp3 asp2 sub cols 13 sub { |
/i exch def |
i 4 putalgnpat |
21033,7 → 19273,13 |
} for |
} if |
format (rmqr) eq { |
/algnpat algnpatrmqr def |
/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 |
asp2 2 sub asp3 asp2 sub cols 13 sub { |
/i exch def |
i 0 putalgnpat |
21042,13 → 19288,6 |
} 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 ] ] |
21057,7 → 19296,11 |
[ [ 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) formatmapmicro |
(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 ] ] |
] |
(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 ] ] |
21191,7 → 19434,7 |
} if |
} for |
scr1 scr3 |
} def |
} bind def |
|
% Evaluation algorithm for full symbols |
/evalfull { |
21247,7 → 19490,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 |
} def |
} bind def |
|
% Evaluation algorithm for micro symbols |
/evalmicro { |
21263,7 → 19506,7 |
} { |
dkbot 16 mul dkrhs add neg |
} ifelse |
} def |
} bind def |
|
% Evaluate the masked symbols to find the most suitable |
/bestscore 999999999 def |
21297,20 → 19540,38 |
} if |
|
% Add the format information |
{ |
/fmtvalsfull [ |
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 |
/fmtvalsmicro [ |
/ecid (MLHQ) eclevel search pop length exch pop exch pop def |
/fmtval fmtvals ecid 3 bitshift bestmaskval add get def |
0 1 formatmap length 1 sub { |
/i exch def |
formatmap i get { |
pixs exch aload pop qmv fmtval 14 i sub neg bitshift 1 and put |
} forall |
} 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 |
/fmtvalsrmqr1 [ |
/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 |
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 |
} 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 |
21320,7 → 19581,7 |
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 [ |
/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 |
21330,29 → 19591,9 |
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 { |
/ecid (MLHQ) eclevel search pop length exch pop exch pop def |
/fmtval fmtvalsfull ecid 3 bitshift bestmaskval add get def |
0 1 formatmap length 1 sub { |
/i exch def |
formatmap i get { |
pixs exch aload pop qmv fmtval 14 i sub neg bitshift 1 and put |
} forall |
} for |
} if |
format (micro) eq { |
/symid [ [0] [1 2] [3 4] [5 6 7] ] cols 11 sub 2 idiv get eclval 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 |
} for |
} if |
format (rmqr) eq { |
/fmtvalu (MH) eclevel search pop length exch pop exch pop 5 bitshift verind add def |
/fmtval1 fmtvalsrmqr1 fmtvalu get def |
/fmtval2 fmtvalsrmqr2 fmtvalu get def |
/fmtval1 fmtvals1 fmtvalu get def |
/fmtval2 fmtvals2 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 |
21361,7 → 19602,7 |
} if |
|
% Add the version information |
{ |
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 |
21369,8 → 19610,6 |
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 { |
/verval vervals cols 17 sub 4 idiv 7 sub get def |
0 1 versionmap length 1 sub { |
/i exch def |
21393,8 → 19632,6 |
|
dontdraw not //renmatrix if |
|
//unloadctx exec |
|
end |
|
} |
21408,15 → 19645,15 |
% --END ENCODER qrcode-- |
|
% --BEGIN ENCODER swissqrcode-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix qrcode-- |
% --REQUIRES preamble raiseerror parseinput renmatrix qrcode-- |
% --DESC: Swiss QR Code |
% --EXAM: |
% --EXOP: |
% --RNDR: renmatrix |
%%BeginResource: uk.co.terryburton.bwipp swissqrcode 0.0 2022072900 71645 71452 |
%%BeginData: 128 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp swissqrcode 0.0 2021092800 62083 65448 |
%%BeginData: 127 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 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 |
21429,7 → 19666,6 |
/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 |
21548,15 → 19784,15 |
% --END ENCODER swissqrcode-- |
|
% --BEGIN ENCODER microqrcode-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix qrcode-- |
% --REQUIRES preamble raiseerror parseinput renmatrix qrcode-- |
% --DESC: Micro QR Code |
% --EXAM: 1234 |
% --EXOP: |
% --RNDR: renmatrix |
%%BeginResource: uk.co.terryburton.bwipp microqrcode 0.0 2022072900 66337 62760 |
%%BeginData: 46 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp microqrcode 0.0 2021092800 56791 56668 |
%%BeginData: 45 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 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 |
21568,7 → 19804,6 |
/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 |
21606,15 → 19841,15 |
% --END ENCODER microqrcode-- |
|
% --BEGIN ENCODER rectangularmicroqrcode-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix qrcode-- |
% --REQUIRES preamble raiseerror parseinput renmatrix qrcode-- |
% --DESC: Rectangular Micro QR Code |
% --EXAM: 1234 |
% --EXOP: version=R17x139 |
% --RNDR: renmatrix |
%%BeginResource: uk.co.terryburton.bwipp rectangularmicroqrcode 0.0 2022072900 66380 62792 |
%%BeginData: 46 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp rectangularmicroqrcode 0.0 2021092800 56834 56700 |
%%BeginData: 45 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 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 |
21626,7 → 19861,6 |
/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 |
21664,17 → 19898,15 |
% --END ENCODER rectangularmicroqrcode-- |
|
% --BEGIN ENCODER maxicode-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmaximatrix-- |
% --REQUIRES preamble 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 2022072900 132953 135762 |
%%BeginData: 607 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp maxicode 0.0 2021092800 126843 125788 |
%%BeginData: 596 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
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 |
21686,7 → 19918,6 |
/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 |
21707,8 → 19938,6 |
/mode mode cvi def |
/sam sam cvi def |
|
/maxicode //loadctx exec |
|
% Parse the input |
/fncvals << |
/parse parse |
21758,7 → 19987,6 |
|
} if |
|
{ |
% Special function characters |
/eci -1 def /pad -2 def /ns -3 def |
/la -4 def /lb -5 def |
21852,7 → 20080,6 |
/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 |
22198,7 → 20425,6 |
} 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 |
22245,7 → 20471,6 |
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 |
22268,8 → 20493,6 |
|
dontdraw not //renmaximatrix if |
|
//unloadctx exec |
|
end |
|
} |
22283,17 → 20506,15 |
% --END ENCODER maxicode-- |
|
% --BEGIN ENCODER azteccode-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix-- |
% --REQUIRES preamble raiseerror parseinput renmatrix-- |
% --DESC: Aztec Code |
% --EXAM: This is Aztec Code |
% --EXOP: format=full |
% --RNDR: renmatrix |
%%BeginResource: uk.co.terryburton.bwipp azteccode 0.0 2022072900 189159 208295 |
%%BeginData: 794 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp azteccode 0.0 2021092800 183704 199457 |
%%BeginData: 780 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 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 |
22305,7 → 20526,6 |
/options exch def |
/barcode exch def |
|
/ctx null def |
/dontdraw false def |
/format (unset) def % full, compact or rune |
/readerinit false def |
22331,8 → 20551,6 |
/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 |
22358,7 → 20576,11 |
/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 |
|
22456,13 → 20678,6 |
[ 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 |
22476,7 → 20691,7 |
ln 10 ln div cvi 1 add 4 mul 8 add |
} ifelse |
} ifelse |
} def |
} bind def |
|
% U L M P D B |
/curlen [ 0 e e e e e ] def |
22651,12 → 20866,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 |
} def |
} 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 |
/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 |
|
/encp { |
dup fn1 eq { % FNC1: Flg(0) |
22677,7 → 20892,7 |
} { |
charvals P get exch get 5 tobin |
} ifelse } ifelse |
} def |
} bind def |
|
/encfuncs [ /encu /encl /encm /encp /encd ] def |
|
22685,7 → 20900,7 |
/v exch def |
msgbits j v putinterval |
/j j v length add def |
} def |
} bind def |
|
% Encode the sequence |
/state U def |
22754,7 → 20969,6 |
} 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 ] |
22770,7 → 20984,6 |
[ (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 |
22795,8 → 21008,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} def |
/allones {dup length (111111111111) 0 3 -1 roll getinterval eq} def |
/allzero {dup length (000000000000) 0 3 -1 roll getinterval eq} bind def |
/allones {dup length (111111111111) 0 3 -1 roll getinterval eq} bind def |
/cws ncws array def |
/m 0 def /c 0 def |
{ |
22850,7 → 21063,7 |
} { |
pop pop 0 |
} ifelse |
} def |
} bind def |
|
% Generate the coefficients |
/coeffs [ 1 rsnc {0} repeat ] def |
22878,7 → 21091,7 |
% Return all but the last codeword |
rscws 0 rscws length 1 sub getinterval |
|
} def |
} bind def |
|
% Create the codewords and bit string for the mode |
format (full) eq { |
22918,7 → 21131,6 |
} for |
|
% Extend the data codewords with error correction codewords to create the bit string for the data |
{ |
/rsparams [ |
[] [] [] [] [] [] |
[ 64 67 ] % 6-bit codewords |
22929,7 → 21141,6 |
[] |
[ 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 |
22945,7 → 21156,7 |
} for |
|
% Move to a point in the cartesian plane centered on the bullseye |
/cmv {size mul sub mid add} def |
/cmv {size mul sub mid add} bind def |
|
% Move to a bit position within a layer |
/lmv { |
22973,7 → 21184,7 |
lwid 2 idiv 1 sub lbit 2 idiv lwid mod sub neg |
cmv |
} if |
} def |
} bind def |
|
% Create the pixel map |
% For full symbols we disregard the reference grid at this stage |
23042,21 → 21253,21 |
] {pixs exch {} forall 3 1 roll cmv exch put} forall |
|
% Mode ring |
{ |
/modemapfull [ |
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 |
/modemapcompact [ |
} { |
/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 |
} ctxdef |
/modemap format (full) eq {modemapfull} {modemapcompact} ifelse def |
} ifelse |
0 1 modemap length 1 sub { |
/i exch def |
pixs modemap i get {} forall cmv modebits i get 48 sub put |
23074,8 → 21285,6 |
|
dontdraw not //renmatrix if |
|
//unloadctx exec |
|
end |
|
} |
23089,15 → 21298,15 |
% --END ENCODER azteccode-- |
|
% --BEGIN ENCODER azteccodecompact-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix azteccode-- |
% --REQUIRES preamble raiseerror parseinput renmatrix azteccode-- |
% --DESC: Compact Aztec Code |
% --EXAM: 1234 |
% --EXOP: |
% --RNDR: renmatrix |
%%BeginResource: uk.co.terryburton.bwipp azteccodecompact 0.0 2022072900 62593 62441 |
%%BeginData: 46 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp azteccodecompact 0.0 2021092800 53387 56691 |
%%BeginData: 45 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 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 |
23109,7 → 21318,6 |
/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 |
23147,15 → 21355,15 |
% --END ENCODER azteccodecompact-- |
|
% --BEGIN ENCODER aztecrune-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix azteccode-- |
% --REQUIRES preamble raiseerror parseinput renmatrix azteccode-- |
% --DESC: Aztec Runes |
% --EXAM: 1 |
% --EXOP: |
% --RNDR: renmatrix |
%%BeginResource: uk.co.terryburton.bwipp aztecrune 0.0 2022072900 62562 62417 |
%%BeginData: 46 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp aztecrune 0.0 2021092800 53356 56667 |
%%BeginData: 45 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 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 |
23167,7 → 21375,6 |
/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 |
23205,17 → 21412,15 |
% --END ENCODER aztecrune-- |
|
% --BEGIN ENCODER codeone-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix-- |
% --REQUIRES preamble raiseerror parseinput renmatrix-- |
% --DESC: Code One |
% --EXAM: Code One |
% --EXOP: |
% --RNDR: renmatrix |
%%BeginResource: uk.co.terryburton.bwipp codeone 0.0 2022072900 201490 227088 |
%%BeginData: 903 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp codeone 0.0 2021092800 196362 218850 |
%%BeginData: 883 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 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 |
23227,7 → 21432,6 |
/options exch def |
/barcode exch def |
|
/ctx null def |
/dontdraw false def |
/version (unset) def |
/parse false def |
23244,12 → 21448,10 |
} if |
options {def} forall |
|
/codeone //loadctx exec |
|
/stype version 0 1 getinterval (S) eq def |
|
{ |
/stypevals [ |
stype { |
/vals [ |
(1) |
(1010) |
(1100100) |
23270,17 → 21472,119 |
(101100011010001010111100001011101100010100000000000000000) |
] def |
|
/normalize { |
/base exch def |
/num exch def |
num length 1 sub -1 1 { |
/i exch def |
num i 1 sub 2 copy get num i get base idiv add put |
num i num i get base mod put |
} for |
{ %loop - extend input as necessary |
num 0 get base lt {exit} if |
/num [0 num {} forall] def |
num 0 num 0 get num 1 get base idiv add put |
num 1 num 1 get base mod put |
} loop |
% Trim leading zeros |
/num [/i true def num {dup 0 eq i and {pop} {/i false def} ifelse} forall] def |
num length 0 eq {/num [0] def} if |
num |
} bind def |
|
/bigadd { |
2 copy length exch length |
2 copy sub abs /offset exch def |
lt {exch} if |
/a exch def /b exch def |
0 1 b length 1 sub { |
dup a exch offset add 2 copy get b 5 -1 roll get add put |
} for |
a |
} bind def |
|
/barlen barcode length def |
|
% Convert value plus one to binary |
/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 ] |
v bigadd /v exch def |
} for |
/v v 2 normalize def |
|
% Split into 5-bit codewords |
/v [ 5 v length 5 mod sub 5 mod {0} repeat v aload pop ] def |
/cws v length 5 idiv array def |
0 1 cws length 1 sub { |
/i exch def |
v i 5 mul 5 getinterval |
0 exch {add 2 mul} forall 2 idiv |
cws exch i exch put |
} for |
|
% Basic metrics for the each symbol |
% ver row col dcol dcws rscw rsbl ro ri rl |
/stypemetrics [ |
/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 |
|
} { % Standard and type-T |
|
% Convert input into bytes accounting for FNC characters |
/fnc1 -1 def /fnc3 -2 def |
/fncvals << |
/parse parse |
/parsefnc parsefnc |
/eci true |
(FNC1) fnc1 |
(FNC3) fnc3 |
>> def |
/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 |
numecis 0 gt { |
/msgtmp msg length 2 mul numecis 6 mul add 2 add array def |
msgtmp 0 pad put |
msgtmp 1 eciesc put |
/j 2 def |
0 1 msg length 1 sub { |
msg exch get |
dup -1000000 le { |
neg 10 7 string cvrs 1 6 getinterval {} forall 6 array astore |
msgtmp exch j 1 add exch putinterval |
msgtmp j eciesc put |
/j j 7 add def |
} { |
dup eciesc ne { |
msgtmp exch j exch put |
/j j 1 add def |
} { |
pop |
msgtmp j eciesc put |
msgtmp j 1 add eciesc put |
/j j 2 add def |
} ifelse |
} ifelse |
} for |
/msg msgtmp 0 j getinterval def |
/msglen msg length def |
} if |
|
% Basic metrics for the each symbol |
% ver row col dcol dcws rscw rsbl ro ri rl |
/nonstypemetrics [ |
/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 ] |
23294,11 → 21598,28 |
[ (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 |
% Select metrics of an appropriate symbol |
/fullcws [] def |
metrics { |
/m exch def |
/vers m 0 get def % Version of symbol |
/dcws m 4 get def % Data codewords in symbol |
/okay true def |
version (unset) eq { |
vers length 1 ne {/okay false def} if |
} { |
version vers ne {/okay false def} if |
} ifelse |
okay {/fullcws [ fullcws aload pop dcws ] def} if |
} forall |
/numremcws [ 1480 {10000} repeat ] def |
fullcws {numremcws exch 1 sub 1 put} forall |
1478 -1 0 { |
/i exch def |
numremcws i get 1 ne { |
numremcws i numremcws i 1 add get 1 add put |
} if |
} for |
|
/Avals << |
0 1 128 {dup 1 add} for |
23403,134 → 21724,6 |
|
/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 { |
|
/normalize { |
/base exch def |
/num exch def |
num length 1 sub -1 1 { |
/i exch def |
num i 1 sub 2 copy get num i get base idiv add put |
num i num i get base mod put |
} for |
{ %loop - extend input as necessary |
num 0 get base lt {exit} if |
/num [0 num {} forall] def |
num 0 num 0 get num 1 get base idiv add put |
num 1 num 1 get base mod put |
} loop |
% Trim leading zeros |
/num [/i true def num {dup 0 eq i and {pop} {/i false def} ifelse} forall] def |
num length 0 eq {/num [0] def} if |
num |
} def |
|
/bigadd { |
2 copy length exch length |
2 copy sub abs /offset exch def |
lt {exch} if |
/a exch def /b exch def |
0 1 b length 1 sub { |
dup a exch offset add 2 copy get b 5 -1 roll get add put |
} for |
a |
} def |
|
/barlen barcode length def |
|
% Convert value plus one to binary |
/v [ 1 ] def |
0 1 barlen 1 sub { |
/i exch def |
[ 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 |
|
% Split into 5-bit codewords |
/v [ 5 v length 5 mod sub 5 mod {0} repeat v aload pop ] def |
/cws v length 5 idiv array def |
0 1 cws length 1 sub { |
/i exch def |
v i 5 mul 5 getinterval |
0 exch {add 2 mul} forall 2 idiv |
cws exch i exch put |
} for |
|
/metrics stypemetrics def |
|
} { % Standard and type-T |
|
% Convert input into bytes accounting for FNC characters |
/fncvals << |
/parse parse |
/parsefnc parsefnc |
/eci true |
(FNC1) fnc1 |
(FNC3) fnc3 |
>> def |
/msg barcode fncvals //parseinput exec def |
/msglen msg length 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 |
numecis 0 gt { |
/msgtmp msg length 2 mul numecis 6 mul add 2 add array def |
msgtmp 0 pad put |
msgtmp 1 eciesc put |
/j 2 def |
0 1 msg length 1 sub { |
msg exch get |
dup -1000000 le { |
neg 10 7 string cvrs 1 6 getinterval {} forall 6 array astore |
msgtmp exch j 1 add exch putinterval |
msgtmp j eciesc put |
/j j 7 add def |
} { |
dup eciesc ne { |
msgtmp exch j exch put |
/j j 1 add def |
} { |
pop |
msgtmp j eciesc put |
msgtmp j 1 add eciesc put |
/j j 2 add def |
} ifelse |
} ifelse |
} for |
/msg msgtmp 0 j getinterval def |
/msglen msg length def |
} if |
|
/metrics nonstypemetrics def |
|
% Select metrics of an appropriate symbol |
/fullcws [] def |
metrics { |
/m exch def |
/vers m 0 get def % Version of symbol |
/dcws m 4 get def % Data codewords in symbol |
/okay true def |
version (unset) eq { |
vers length 1 ne {/okay false def} if |
} { |
version vers ne {/okay false def} if |
} ifelse |
okay {/fullcws [ fullcws aload pop dcws ] def} if |
} forall |
/numremcws [ 1480 {10000} repeat ] def |
fullcws {numremcws exch 1 sub 1 put} forall |
1478 -1 0 { |
/i exch def |
numremcws i get 1 ne { |
numremcws i numremcws i 1 add get 1 add put |
} if |
} for |
|
/numD [ msglen {0} repeat 0 ] def |
/nextXterm [ msglen {0} repeat 9999 ] def |
/nextNonX [ msglen {0} repeat 9999 ] def |
23554,14 → 21747,16 |
/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} 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 |
/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 |
|
/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 |
23597,18 → 21792,18 |
/k k 1 add def |
} loop |
} repeat |
} def |
} bind def |
|
/addtocws { |
dup cws exch j exch putinterval |
/j exch length j add def |
} def |
} bind def |
|
/tobin { |
string dup length 1 sub 0 exch 1 exch {1 index exch 48 put} for |
dup 3 -1 roll 2 2 index length string cvrs dup length 2 index length exch sub exch putinterval |
[ exch {48 sub} forall ] |
} def |
} bind def |
|
/encA { |
1 { % Common exit |
23653,7 → 21848,7 |
/i i 1 add def |
exit |
} repeat |
} def |
} bind def |
|
/CTXvalstocws { |
/in exch def |
23663,7 → 21858,7 |
dup 256 idiv exch 256 mod |
} for |
counttomark array astore exch pop |
} def |
} bind def |
|
/encCTX { |
/p 0 def |
23790,7 → 21985,7 |
} if |
} if |
|
} def |
} bind def |
|
/encD { |
|
23858,7 → 22053,7 |
counttomark array astore exch pop addtocws |
/mode A def |
|
} def |
} bind def |
|
/encB { |
/p 0 def /bvals 1480 array def { |
23880,7 → 22075,7 |
] def |
bvals addtocws |
/mode A def |
} def |
} bind def |
|
% Derive the codewords |
/cws 1480 array def |
23950,7 → 22145,7 |
} { |
pop pop 0 |
} ifelse |
} def |
} bind def |
|
% Generate the coefficients for the Reed-Solomon algorithm |
/coeffs [ 1 ecpb {0} repeat ] def |
24014,7 → 22209,7 |
} for |
|
% Create bitmap and add finder patterns |
/mmv {cols mul add} def |
/mmv {cols mul add} bind def |
/pixs [ rows cols mul {-1} repeat ] def |
|
% Centre pattern |
24028,8 → 22223,7 |
{1 cols 2 sub {0} repeat 1} bind |
{1 0 cols 4 sub {1} repeat 0 1} bind |
] def |
{ |
/cpatmap << |
/cpat << |
/A (121343) |
/B (12134343) |
/C (12121343) |
24040,9 → 22234,7 |
/H (121212134343) |
/S (56661278) |
/T (5666666666127878) |
>> def |
} ctxdef |
/cpat cpatmap vers 0 1 getinterval get def |
>> vers 0 1 getinterval get def |
pixs 0 rows cpat length sub 2 idiv mmv |
[ cpat {artifact exch 49 sub get exec} forall ] putinterval |
|
24062,8 → 22254,7 |
} for |
|
% Black dots |
{ |
/blackdotmap << |
<< |
/A [ [12 5] ] |
/B [ [16 7] ] |
/C [ [26 12] ] |
24078,9 → 22269,7 |
/T-16 [ [8 10] ] |
/T-32 [ [16 10] [16 12] ] |
/T-48 [ [24 10] [24 12] [24 14] ] |
>> def |
} ctxdef |
blackdotmap vers get {pixs exch aload pop mmv 1 put} forall |
>> vers get {pixs exch aload pop mmv 1 put} forall |
|
% Place the modules onto a pixel map between alignment patterns |
/j 0 def |
24105,8 → 22294,6 |
|
dontdraw not //renmatrix if |
|
//unloadctx exec |
|
end |
|
} |
24120,17 → 22307,15 |
% --END ENCODER codeone-- |
|
% --BEGIN ENCODER hanxin-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix-- |
% --REQUIRES preamble raiseerror parseinput renmatrix-- |
% --DESC: Han Xin Code |
% --EXAM: This is Han Xin |
% --EXOP: |
% --RNDR: renmatrix |
%%BeginResource: uk.co.terryburton.bwipp hanxin 0.0 2022072900 311365 358291 |
%%BeginData: 863 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp hanxin 0.0 2021092800 305838 345620 |
%%BeginData: 852 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 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 |
24142,7 → 22327,6 |
/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 |
24163,8 → 22347,6 |
|
/mask mask cvi def |
|
/hanxin //loadctx exec |
|
% Parse the input |
/fncvals << |
/parse parse |
24181,7 → 22363,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 |
} def |
} bind def |
|
% Encode the data using byte mode encoding |
/bits 4 13 add msglen 8 mul add string def |
24193,7 → 22375,6 |
} 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 ] |
24533,7 → 22714,6 |
[ 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 { |
24558,7 → 22738,7 |
} for |
|
okay not { |
/bwipp.hanxinNoValidSymbol (Maximum length exceeded or invalid content) //raiseerror exec |
/bwipp.hanxinNoValidSymbol (No valid symbol available) //raiseerror exec |
} if |
|
/version vers def |
24604,7 → 22784,7 |
} { |
pop pop 0 |
} ifelse |
} def |
} bind def |
|
% Generate the coefficients |
/coeffs [ 1 rsnc {0} repeat ] def |
24632,7 → 22812,7 |
% Return all but the last codeword |
rscws 0 rscws length 1 sub getinterval |
|
} def |
} bind def |
|
% Divide codewords into two groups of blocks and calculate the error correction codewords |
/dcwsb e1nb e2nb add e3nb add array def |
24683,15 → 22863,15 |
|
% Create the bitmap |
/pixs [ size size mul {-1} repeat ] def |
/qmv {size mul add} def |
/qmv {size mul add} bind def |
|
% Alignment patterns |
alnn 0 ne { |
/trmv {size mul size add 1 sub exch sub} def |
/trmv {size mul size add 1 sub exch sub} bind def |
/aplot { |
3 1 roll 3 copy exch trmv pixs exch 3 -1 roll put |
trmv pixs exch 3 -1 roll put |
} def |
} bind def |
/i 0 def /stag 0 def { |
i size ge {exit} if |
0 1 size 1 sub { |
24745,7 → 22925,6 |
} if |
|
% Finder patterns |
{ |
/fpat [ |
[ 1 1 1 1 1 1 1 0 ] |
[ 1 0 0 0 0 0 0 0 ] |
24766,7 → 22945,6 |
[ 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 { |
24886,7 → 23064,7 |
} if |
} for |
scr1 scr3 |
} def |
} bind def |
|
% Evaluation algorithm |
/evalfull { |
24924,7 → 23102,7 |
} for |
|
n1 n3 add |
} def |
} bind def |
|
% Evaluate the masked symbols to find the most suitable |
/bestscore 999999999 def |
24980,8 → 23158,6 |
|
dontdraw not //renmatrix if |
|
//unloadctx exec |
|
end |
|
} |
24995,17 → 23171,15 |
% --END ENCODER hanxin-- |
|
% --BEGIN ENCODER dotcode-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix-- |
% --REQUIRES preamble raiseerror parseinput renmatrix-- |
% --DESC: DotCode |
% --EXAM: This is DotCode |
% --EXOP: inkspread=0.16 |
% --RNDR: renmatrix |
%%BeginResource: uk.co.terryburton.bwipp dotcode 0.0 2022072900 238866 274940 |
%%BeginData: 1067 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp dotcode 0.0 2021092800 231580 260718 |
%%BeginData: 1037 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 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 |
25017,7 → 23191,6 |
/options exch def |
/barcode exch def |
|
/ctx null def |
/dontdraw false def |
/rows -1 def |
/columns -1 def |
25044,8 → 23217,6 |
/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 |
25052,7 → 23223,6 |
} 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 |
25062,7 → 23232,6 |
/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 << |
25095,7 → 23264,6 |
/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 |
25160,9 → 23328,6 |
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 |
25232,10 → 23397,12 |
} 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 |
} def |
} bind def |
|
% Base 259 to one more in base 103 |
/base259to103 { |
25266,7 → 23433,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 |
} def |
} bind def |
|
/finaliseBIN { |
bpos 0 ne { |
25273,13 → 23440,13 |
bvals 0 bpos getinterval base259to103 aload pop |
/bpos 0 def |
} if |
} def |
} bind def |
|
/addtobin { |
bvals exch bpos exch put |
/bpos bpos 1 add def |
bpos 5 eq { finaliseBIN } if |
} def |
} bind 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 |
25288,7 → 23455,7 |
dup 12769 idiv 40 add exch 12769 mod |
dup 113 idiv exch 113 mod |
} if |
} def |
} bind def |
|
/ECIbin { % ECI encoding for binary mode |
[ |
25305,7 → 23472,7 |
] { |
addtobin |
} forall |
} def |
} bind def |
|
/encC { |
1 { % Common exit |
25329,16 → 23496,9 |
} repeat |
/inmac exch def |
inmac 0 ne { |
[ Cvals lab get ] addtocws |
/mode B def |
[ Bvals inmac get ] addtocws |
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 |
/i i inmac mac ne {7} {6} ifelse add def |
exit |
} if |
} if |
25419,17 → 23579,12 |
} if |
[ Cvals [ sfb sb2 sb3 sb4 ] n 1 sub get get ] addtocws |
n { |
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 |
} def % encC |
} bind def % encC |
|
/encB { |
1 { % Common exit |
25505,7 → 23660,7 |
/mode A def |
exit |
} repeat |
} def |
} bind def |
|
/encA { |
1 { % Common exit |
25573,17 → 23728,12 |
} if |
[ Avals [ sfb sb2 sb3 sb4 sb5 sb6 ] n 1 sub get get ] addtocws |
n { |
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 |
} def |
} bind def |
|
/encBIN { |
1 { % Common exit |
25645,7 → 23795,7 |
} if |
exit |
} repeat |
} def |
} bind def |
|
/cws msglen 2 mul 1 add array def |
/mode C def |
25721,7 → 23871,6 |
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) |
25747,7 → 23896,6 |
(100011110) (100111100) (101111000) (110001110) (110011100) |
(110111000) (111000110) (111001100) |
] def |
} ctxdef |
|
% Final six dots arranged at edges |
rows 2 mod 0 eq { |
25770,7 → 23918,7 |
] def |
} ifelse |
|
/dmv {columns mul add} def |
/dmv {columns mul add} bind def |
|
% Construct the template |
/outline rows columns mul array def |
25791,7 → 23939,7 |
x 1 and 2 rows 1 sub { |
x exch dmv sym exch get 1 eq {pop false exit} if |
} for |
} def |
} bind def |
|
/clearrow { |
/y exch def |
25799,7 → 23947,7 |
y 1 and 2 columns 1 sub { |
y dmv sym exch get 1 eq {pop false exit} if |
} for |
} def |
} bind def |
|
% Evaluate the symbol |
/evalsymbol { |
25907,12 → 24055,12 |
worst sum sum mul sub pen sub |
} ifelse |
|
} def |
} bind 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} def |
/offset {step mul start add} bind def |
|
% Evaluate the symbols in the following order: |
% fast mode: m3 -> m3' -> m2 -> m2' -> m1 -> m1' -> m0 -> m0' |
26059,8 → 24207,6 |
|
dontdraw not //renmatrix if |
|
//unloadctx exec |
|
end |
|
} |
26074,17 → 24220,15 |
% --END ENCODER dotcode-- |
|
% --BEGIN ENCODER ultracode-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix-- |
% --REQUIRES preamble raiseerror parseinput renmatrix-- |
% --DESC: Ultracode |
% --EXAM: Awesome colours! |
% --EXOP: eclevel=EC2 |
% --RNDR: renmatrix |
%%BeginResource: uk.co.terryburton.bwipp ultracode 0.0 2022072900 96331 99027 |
%%BeginData: 361 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp ultracode 0.0 2021092800 89868 89228 |
%%BeginData: 345 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 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 |
26096,7 → 24240,6 |
/options exch def |
/barcode exch def |
|
/ctx null def |
/dontdraw false def |
/eclevel (EC2) def % EC0-EC5 |
/encoding (auto) def |
26126,8 → 24269,6 |
/bwipp.ultracodeInvalidRevision (Valid revisions are 1 and 2) //raiseerror exec |
} if |
|
/ultracode //loadctx exec |
|
raw {/encoding (raw) def} if |
|
encoding (raw) eq { |
26184,7 → 24325,6 |
/tcc mcc qcc add def |
|
% Lookup the most appropriate symbol specification |
{ |
/metrics [ |
% rows minc maxc mcol |
[ 2 7 37 5 ] |
26192,8 → 24332,6 |
[ 4 85 161 22 ] |
[ 5 142 282 29 ] |
] def |
} ctxdef |
|
0 1 3 { |
/i exch def |
/m metrics i get def |
26207,7 → 24345,7 |
} for |
|
okay not { |
/bwipp.ultracodeNoValidSymbol (Maximum length exceeded or invalid content) //raiseerror exec |
/bwipp.ultracodeNoValidSymbol (No valid symbol available) //raiseerror exec |
} if |
|
% Determine required number of columns and pads |
26277,7 → 24415,34 |
|
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 |
26310,35 → 24475,6 |
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 |
26407,17 → 24543,6 |
} 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 |
26426,14 → 24551,19 |
/pixy rows |
/height rows 72 div 2 mul |
/width columns 72 div 2 mul |
/colormap colormap |
/colormap << |
0 (FFFFFF) % W |
9 (000000) % K |
1 (00FFFF) % C |
3 (FF00FF) % M |
5 (FFFF00) % Y |
6 (00FF00) % G |
>> |
/opt options |
>> |
|
dontdraw not //renmatrix if |
|
//unloadctx exec |
|
end |
|
} |
26447,15 → 24577,15 |
% --END ENCODER ultracode-- |
|
% --BEGIN ENCODER jabcode-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix-- |
% --REQUIRES preamble 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 2022072900 246160 288650 |
%%BeginData: 1133 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp jabcode 0.0 2021092800 240985 279579 |
%%BeginData: 1132 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 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 |
26467,7 → 24597,6 |
/options exch def |
/barcode exch def |
|
/ctx null def |
/dontdraw false def |
/rows -1 def |
/columns -1 def |
26644,7 → 24773,7 |
|
% TODO Reject all invalid sizes |
rows 145 gt cols 145 gt or { |
/bwipp.jabcodeNoValidSymbol (Maximum length exceeded or invalid content) //raiseerror exec |
/bwipp.jabcodeNoValidSymbol (No valid symbol available) //raiseerror exec |
} if |
|
% Pick ECC params to maximally fill symbol |
27592,19 → 25721,18 |
% --END ENCODER jabcode-- |
|
% --BEGIN ENCODER gs1-cc-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renmatrix micropdf417 pdf417-- |
% --REQUIRES preamble raiseerror parseinput gs1lint 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 2022072900 206333 205184 |
%%BeginData: 639 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp gs1-cc 0.0 2021092800 205775 208288 |
%%BeginData: 661 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
dup /gs1process 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 /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 |
27616,10 → 25744,8 |
/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 |
27640,8 → 25766,6 |
/cccolumns cccolumns cvi def |
/linwidth linwidth cvi def |
|
/gs1-cc //loadctx exec |
|
% Select columns based on linear type |
cccolumns -1 eq { |
<< |
27661,15 → 25785,41 |
>> lintype get /cccolumns exch def |
} if |
|
barcode /ai //gs1process exec |
/fncs exch def |
/vals exch def |
/ais exch def |
% 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 |
pop |
|
dontlint not { ais vals //gs1lint exec pop } if |
|
% Method selection |
/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 |
/isupper {dup 65 ge exch 90 le and} bind def % A-Z |
/isnum0 {dup 48 ge exch 57 le and} bind def % 0-9 |
/isnum1 {dup 49 ge exch 57 le and} bind def % 1-9 |
{ % common exit |
|
% (10/11/17)... |
27719,15 → 25869,13 |
/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 |
} def |
} bind 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 |
27772,8 → 25920,6 |
lalphanumeric (00100) |
>> def |
|
} ctxdef |
|
method (10) eq { % TODO: fixme |
ais 0 get (11) eq ais 0 get (17) eq or { |
vals 0 get |
27788,7 → 25934,6 |
] /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 |
27798,7 → 25943,6 |
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 |
27888,7 → 26032,6 |
} 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 [ |
27897,7 → 26040,6 |
] 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 |
27909,6 → 26051,24 |
/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 |
27919,7 → 26079,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 fncs i get and { % Append FNC1 |
i ais length 1 sub ne aifixed ai 0 2 getinterval known not and { % Append FNC1 |
gpf length 1 add array |
dup 0 gpf putinterval |
dup gpf length fnc1 put |
27928,8 → 26088,10 |
} for |
|
% Calculate the number of bits remaining to the next valid symbol size |
{ |
/bitcapsmaps << |
/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] |
27940,13 → 26102,7 |
[ 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 |
/bitcaps bitcapsmaps ccversion get cccolumns 2 sub get def |
>> ccversion get cccolumns 2 sub get /bitcaps exch def |
-1 bitcaps {dup used ge {exch} if pop} forall |
dup -1 ne {used sub} if |
} { |
27983,7 → 26139,7 |
} ifelse |
used rembits |
} if |
} def |
} bind def |
|
/encode { |
dup /raw ne {exch get} {pop} ifelse |
27991,7 → 26147,7 |
dup length exch |
gpfenc exch j exch putinterval |
/j exch j add def |
} def |
} bind def |
|
% Pre-compute alphanumeric and numeric runlengths and position of next ISO646-only characters |
/numericruns [ gpf length {0} repeat 0 -1 ] def |
28137,7 → 26293,7 |
pad aload pop |
] def |
|
{ |
ccversion (a) eq { |
/pwr928 [ |
[ 0 0 0 0 0 0 1 ] |
68 {7 array} repeat |
28152,9 → 26308,6 |
} for |
pwr928 j get 0 pwr928 j 1 sub get 0 get 2 mul v 928 idiv add put |
} for |
} ctxdef |
|
ccversion (a) eq { |
/cws [ 28 {0} repeat ] def |
/b 0 def /c 0 def |
{ % loop |
28228,8 → 26381,6 |
args |
dontdraw not //renmatrix if |
|
//unloadctx exec |
|
end |
|
} |
28243,19 → 26394,18 |
% --END ENCODER gs1-cc-- |
|
% --BEGIN ENCODER ean13composite-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renlinear renmatrix ean5 ean2 ean13 micropdf417 pdf417 gs1-cc-- |
% --REQUIRES preamble raiseerror parseinput gs1lint 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 2022072900 93981 93421 |
%%BeginData: 86 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp ean13composite 0.0 2021092800 83015 86399 |
%%BeginData: 74 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 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 |
28266,11 → 26416,7 |
/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 { |
28297,14 → 26443,7 |
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 |
|
28341,19 → 26480,18 |
% --END ENCODER ean13composite-- |
|
% --BEGIN ENCODER ean8composite-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renlinear renmatrix ean5 ean2 ean8 micropdf417 pdf417 gs1-cc-- |
% --REQUIRES preamble raiseerror parseinput gs1lint 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 2022072900 94322 90331 |
%%BeginData: 89 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp ean8composite 0.0 2021092800 86788 86741 |
%%BeginData: 77 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 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 |
28364,11 → 26502,7 |
/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 { |
28396,14 → 26530,7 |
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 |
|
28442,19 → 26569,18 |
% --END ENCODER ean8composite-- |
|
% --BEGIN ENCODER upcacomposite-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renlinear renmatrix ean5 ean2 upca micropdf417 pdf417 gs1-cc-- |
% --REQUIRES preamble raiseerror parseinput gs1lint 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 2022072900 93975 93416 |
%%BeginData: 86 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp upcacomposite 0.0 2021092800 86425 82946 |
%%BeginData: 74 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
2 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 |
28465,11 → 26591,7 |
/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 { |
28496,14 → 26618,7 |
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 |
|
28540,19 → 26655,18 |
% --END ENCODER upcacomposite-- |
|
% --BEGIN ENCODER upcecomposite-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renlinear renmatrix ean5 ean2 upce micropdf417 pdf417 gs1-cc-- |
% --REQUIRES preamble raiseerror parseinput gs1lint 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 2022072900 91689 90991 |
%%BeginData: 101 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp upcecomposite 0.0 2021092800 87707 87649 |
%%BeginData: 89 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
2 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 |
28563,11 → 26677,7 |
/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 { |
28609,14 → 26719,7 |
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 |
|
28653,19 → 26756,18 |
% --END ENCODER upcecomposite-- |
|
% --BEGIN ENCODER databaromnicomposite-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renlinear renmatrix databaromni micropdf417 pdf417 gs1-cc-- |
% --REQUIRES preamble raiseerror parseinput gs1lint 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 2022072900 91130 94450 |
%%BeginData: 114 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp databaromnicomposite 0.0 2021092800 84062 87382 |
%%BeginData: 102 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
2 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 |
28676,11 → 26778,7 |
/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 { |
28708,14 → 26806,7 |
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 |
28779,19 → 26870,18 |
% --END ENCODER databaromnicomposite-- |
|
% --BEGIN ENCODER databarstackedcomposite-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renlinear renmatrix databaromni databarstacked micropdf417 pdf417 gs1-cc-- |
% --REQUIRES preamble raiseerror parseinput gs1lint 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 2022072900 92950 96281 |
%%BeginData: 110 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp databarstackedcomposite 0.0 2021092800 85882 85781 |
%%BeginData: 98 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
2 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 { |
28801,11 → 26891,7 |
/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 { |
28833,14 → 26919,7 |
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 |
28901,19 → 26980,18 |
% --END ENCODER databarstackedcomposite-- |
|
% --BEGIN ENCODER databarstackedomnicomposite-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renlinear renmatrix databaromni databarstackedomni micropdf417 pdf417 gs1-cc-- |
% --REQUIRES preamble raiseerror parseinput gs1lint 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 2022072900 92978 96305 |
%%BeginData: 110 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp databarstackedomnicomposite 0.0 2021092800 85910 85805 |
%%BeginData: 98 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
2 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 { |
28923,11 → 27001,7 |
/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 { |
28955,14 → 27029,7 |
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 |
29023,19 → 27090,18 |
% --END ENCODER databarstackedomnicomposite-- |
|
% --BEGIN ENCODER databartruncatedcomposite-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renlinear renmatrix databaromni databartruncated micropdf417 pdf417 gs1-cc-- |
% --REQUIRES preamble raiseerror parseinput gs1lint 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 2022072900 94020 97335 |
%%BeginData: 114 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp databartruncatedcomposite 0.0 2021092800 86952 86835 |
%%BeginData: 102 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
2 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 |
29046,11 → 27112,7 |
/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 { |
29078,14 → 27140,7 |
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 |
29149,19 → 27204,18 |
% --END ENCODER databartruncatedcomposite-- |
|
% --BEGIN ENCODER databarlimitedcomposite-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renlinear renmatrix databarlimited micropdf417 pdf417 gs1-cc-- |
% --REQUIRES preamble raiseerror parseinput gs1lint renlinear renmatrix databarlimited micropdf417 pdf417 gs1-cc-- |
% --DESC: GS1 DataBar Limited Composite |
% --EXAM: (01)03512345678907|(21)abcdefghijklmnopqrst |
% --EXAM: (01)03512345678907|(21)abcdefghijklmnopqrstuv |
% --EXOP: |
% --RNDR: renlinear renmatrix |
%%BeginResource: uk.co.terryburton.bwipp databarlimitedcomposite 0.0 2022072900 87443 90880 |
%%BeginData: 93 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp databarlimitedcomposite 0.0 2021092800 80359 83692 |
%%BeginData: 81 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
2 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 |
29172,11 → 27226,7 |
/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 { |
29204,14 → 27254,7 |
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 |
29254,19 → 27297,18 |
% --END ENCODER databarlimitedcomposite-- |
|
% --BEGIN ENCODER databarexpandedcomposite-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renlinear renmatrix databarexpanded micropdf417 pdf417 gs1-cc-- |
% --REQUIRES preamble raiseerror parseinput gs1lint 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 2022072900 97433 90314 |
%%BeginData: 112 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp databarexpandedcomposite 0.0 2021092800 86821 83262 |
%%BeginData: 100 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
2 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 |
29277,11 → 27319,7 |
/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 { |
29309,14 → 27347,7 |
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 |
29339,7 → 27370,7 |
} ifelse |
sep exch i exch put |
} for |
} def |
} bind def |
mark |
0 linsbs {1 index 1 eq {{0}} {{1}} ifelse repeat} forall |
counttomark 1 sub array astore /bot exch def pop pop |
29378,19 → 27409,18 |
% --END ENCODER databarexpandedcomposite-- |
|
% --BEGIN ENCODER databarexpandedstackedcomposite-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renlinear renmatrix databarexpanded databarexpandedstacked micropdf417 pdf417 gs1-cc-- |
% --REQUIRES preamble raiseerror parseinput gs1lint 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 2022072900 96049 95929 |
%%BeginData: 109 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp databarexpandedstackedcomposite 0.0 2021092800 89045 85493 |
%%BeginData: 97 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
2 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 { |
29400,11 → 27430,7 |
/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 { |
29432,14 → 27458,7 |
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 |
29462,7 → 27481,7 |
} ifelse |
sep exch i exch put |
} for |
} def |
} bind 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 |
29499,19 → 27518,18 |
% --END ENCODER databarexpandedstackedcomposite-- |
|
% --BEGIN ENCODER gs1-128composite-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renlinear renmatrix code128 gs1-128 micropdf417 pdf417 gs1-cc-- |
% --REQUIRES preamble raiseerror parseinput gs1lint 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 2022072900 97016 96997 |
%%BeginData: 114 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp gs1-128composite 0.0 2021092800 86500 89809 |
%%BeginData: 102 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
2 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 |
29522,11 → 27540,7 |
/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 { |
29552,14 → 27566,7 |
|
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 |
29625,17 → 27632,18 |
% --END ENCODER gs1-128composite-- |
|
% --BEGIN ENCODER gs1datamatrix-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renmatrix datamatrix-- |
% --REQUIRES preamble raiseerror parseinput gs1lint 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 2022072900 77432 73954 |
%%BeginData: 91 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp gs1datamatrix 0.0 2021092800 74645 81522 |
%%BeginData: 134 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
dup /gs1process 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 /renmatrix dup /uk.co.terryburton.bwipp findresource put |
dup /datamatrix dup /uk.co.terryburton.bwipp findresource put |
begin |
29646,11 → 27654,9 |
/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 |
29664,11 → 27670,55 |
} if |
options {def} forall |
|
barcode /ai //gs1process exec |
/fncs exch def |
/vals exch def |
/ais exch def |
% 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 |
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 |
29681,7 → 27731,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 fncs i get and { % Append FNC1 |
i ais length 1 sub ne aifixed ai 0 2 getinterval known not and { % Append FNC1 |
dmtx length 1 add array |
dup 0 dmtx putinterval |
dup dmtx length gssep {29} {fnc1} ifelse put |
29728,17 → 27778,18 |
% --END ENCODER gs1datamatrix-- |
|
% --BEGIN ENCODER gs1datamatrixrectangular-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput gs1process renmatrix datamatrix-- |
% --REQUIRES preamble raiseerror parseinput gs1lint 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 2022072900 77747 74258 |
%%BeginData: 92 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp gs1datamatrixrectangular 0.0 2021092800 74848 81714 |
%%BeginData: 135 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
dup /gs1process 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 /renmatrix dup /uk.co.terryburton.bwipp findresource put |
dup /datamatrix dup /uk.co.terryburton.bwipp findresource put |
begin |
29749,10 → 27800,8 |
/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 |
|
29767,11 → 27816,55 |
} if |
options {def} forall |
|
barcode /ai //gs1process exec |
/fncs exch def |
/vals exch def |
/ais exch def |
% 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 |
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 |
29784,7 → 27877,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 fncs i get and { % Append FNC1 |
i ais length 1 sub ne aifixed ai 0 2 getinterval known not and { % Append FNC1 |
dmtx length 1 add array |
dup 0 dmtx putinterval |
dup dmtx length gssep {29} {fnc1} ifelse put |
29831,22 → 27924,22 |
%%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 |
% --BEGIN ENCODER gs1qrcode-- |
% --REQUIRES preamble raiseerror parseinput gs1lint 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 gs1dldatamatrix 0.0 2022072900 70572 63571 |
%%BeginData: 59 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp gs1qrcode 0.0 2021092800 74363 77838 |
%%BeginData: 132 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 dict |
dup /parseinput dup /uk.co.terryburton.bwipp findresource put |
dup /gs1process dup /uk.co.terryburton.bwipp findresource put |
dup /gs1lint 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 |
dup /qrcode dup /uk.co.terryburton.bwipp findresource put |
begin |
/gs1dldatamatrix { |
/gs1qrcode { |
|
20 dict begin % Confine variables to local scope |
|
29853,10 → 27946,8 |
/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 |
29870,81 → 27961,55 |
} if |
options {def} forall |
|
% Parse the input |
% Expand ordinals of the form ^NNN to ASCII |
/expand { |
/fncvals << |
/parse parse |
/parseonly true |
/parsefnc false |
>> def |
/barcode barcode fncvals //parseinput exec def |
fncvals //parseinput exec |
} bind def |
|
barcode /dl //gs1process exec pop pop pop |
% 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 |
|
% Get the result of encoding with datamatrix |
options (parse) undef |
options (dontdraw) true put |
/args barcode options //datamatrix exec def |
dontlint not { ais vals //gs1lint exec pop } if |
|
args (opt) options put |
args |
% 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 |
|
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 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 2022072900 77214 73742 |
%%BeginData: 89 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
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 |
/gs1qrcode { |
|
20 dict begin % Confine variables to local scope |
|
/options exch def % We are given an option string |
/barcode exch def % We are given a barcode string |
|
/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 |
|
barcode /ai //gs1process exec |
/fncs exch def |
/vals exch def |
/ais exch def |
|
% Create the qrcode data |
/fnc1 -1 def |
/qrc [ fnc1 ] def |
29957,7 → 28022,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 fncs i get and { % Append FNC1 |
i ais length 1 sub ne aifixed ai 0 2 getinterval known not and { % Append FNC1 |
qrc length 1 add array |
dup 0 qrc putinterval |
dup qrc length fnc1 put |
30003,22 → 28068,23 |
%%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: |
% --BEGIN ENCODER gs1dotcode-- |
% --REQUIRES preamble raiseerror parseinput gs1lint renmatrix dotcode-- |
% --DESC: GS1 DotCode |
% --EXAM: (235)5vBZIF%!<B;?oa%(01)01234567890128(8008)19052001 |
% --EXOP: rows=16 |
% --RNDR: renmatrix |
%%BeginResource: uk.co.terryburton.bwipp gs1dlqrcode 0.0 2022072900 70548 63551 |
%%BeginData: 59 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp gs1dotcode 0.0 2021092800 74370 81275 |
%%BeginData: 133 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
1 dict |
dup /raiseerror dup /uk.co.terryburton.bwipp findresource put |
dup /parseinput dup /uk.co.terryburton.bwipp findresource put |
dup /gs1process dup /uk.co.terryburton.bwipp findresource put |
dup /gs1lint 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 |
dup /dotcode dup /uk.co.terryburton.bwipp findresource put |
begin |
/gs1dlqrcode { |
/gs1dotcode { |
|
20 dict begin % Confine variables to local scope |
|
30025,11 → 28091,9 |
/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 |
/dontdraw false def |
|
% Parse the input options |
options type /stringtype eq { |
30042,82 → 28106,55 |
} if |
options {def} forall |
|
% Parse the input |
% Expand ordinals of the form ^NNN to ASCII |
/expand { |
/fncvals << |
/parse parse |
/parseonly true |
/parsefnc false |
>> def |
/barcode barcode fncvals //parseinput exec def |
fncvals //parseinput exec |
} bind def |
|
barcode /dl //gs1process exec pop pop pop |
% 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 |
|
% Get the result of encoding with qrcode |
options (parse) undef |
options (dontdraw) true put |
/args barcode options //qrcode exec def |
dontlint not { ais vals //gs1lint exec pop } if |
|
args (opt) options put |
args |
% 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 |
|
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 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 2022072900 77157 73683 |
%%BeginData: 90 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /raiseerror 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 |
/gs1dotcode { |
|
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 |
/dontdraw false def |
/parse false def |
/dontlint false def |
/lintreqs true 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 |
|
barcode /ai //gs1process exec |
/fncs exch def |
/vals exch def |
/ais exch def |
|
% Create the dotcode data |
/fnc1 -1 def |
/dmtx [ fnc1 ] def |
30130,7 → 28167,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 fncs i get and { % Append FNC1 |
i ais length 1 sub ne aifixed ai 0 2 getinterval known not and { % Append FNC1 |
dmtx length 1 add array |
dup 0 dmtx putinterval |
dup dmtx length fnc1 put |
30177,17 → 28214,15 |
% --END ENCODER gs1dotcode-- |
|
% --BEGIN ENCODER hibccode39-- |
% --REQUIRES preamble loadctx unloadctx raiseerror renlinear code39-- |
% --REQUIRES preamble raiseerror renlinear code39-- |
% --DESC: HIBC Code 39 |
% --EXAM: A123BJC5D6E71 |
% --EXOP: includetext |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp hibccode39 0.0 2022072900 63587 66902 |
%%BeginData: 103 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp hibccode39 0.0 2021092800 57669 57712 |
%%BeginData: 94 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 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 |
30199,7 → 28234,6 |
/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 |
30223,14 → 28257,10 |
/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 { |
30277,8 → 28307,6 |
|
dontdraw not //renlinear if |
|
//unloadctx exec |
|
end |
|
} |
30292,17 → 28320,15 |
% --END ENCODER hibccode39-- |
|
% --BEGIN ENCODER hibccode128-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renlinear code128-- |
% --REQUIRES preamble raiseerror parseinput renlinear code128-- |
% --DESC: HIBC Code 128 |
% --EXAM: A123BJC5D6E71 |
% --EXOP: includetext |
% --RNDR: renlinear |
%%BeginResource: uk.co.terryburton.bwipp hibccode128 0.0 2022072900 69903 69718 |
%%BeginData: 102 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp hibccode128 0.0 2021092800 60457 63624 |
%%BeginData: 93 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 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 |
30314,7 → 28340,6 |
/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 |
30338,14 → 28363,10 |
/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 { |
30391,8 → 28412,6 |
|
dontdraw not //renlinear if |
|
//unloadctx exec |
|
end |
|
} |
30406,17 → 28425,15 |
% --END ENCODER hibccode128-- |
|
% --BEGIN ENCODER hibcdatamatrix-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix datamatrix-- |
% --REQUIRES preamble raiseerror parseinput renmatrix datamatrix-- |
% --DESC: HIBC Data Matrix |
% --EXAM: A123BJC5D6E71 |
% --EXOP: |
% --RNDR: renmatrix |
%%BeginResource: uk.co.terryburton.bwipp hibcdatamatrix 0.0 2022072900 67434 67144 |
%%BeginData: 85 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp hibcdatamatrix 0.0 2021092800 58052 64626 |
%%BeginData: 76 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 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 |
30428,7 → 28445,6 |
/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 |
|
30443,14 → 28459,10 |
} 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 { |
30488,8 → 28500,6 |
|
dontdraw not //renmatrix if |
|
//unloadctx exec |
|
end |
|
} |
30503,17 → 28513,15 |
% --END ENCODER hibcdatamatrix-- |
|
% --BEGIN ENCODER hibcdatamatrixrectangular-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix datamatrix-- |
% --REQUIRES preamble raiseerror parseinput renmatrix datamatrix-- |
% --DESC: HIBC Data Matrix Rectangular |
% --EXAM: A123BJC5D6E71 |
% --EXOP: |
% --RNDR: renmatrix |
%%BeginResource: uk.co.terryburton.bwipp hibcdatamatrixrectangular 0.0 2022072900 67787 67360 |
%%BeginData: 86 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp hibcdatamatrixrectangular 0.0 2021092800 58173 61386 |
%%BeginData: 77 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 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 |
30525,7 → 28533,6 |
/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 |
|
30540,14 → 28547,10 |
} 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 { |
30586,8 → 28589,6 |
|
dontdraw not //renmatrix if |
|
//unloadctx exec |
|
end |
|
} |
30601,17 → 28602,15 |
% --END ENCODER hibcdatamatrixrectangular-- |
|
% --BEGIN ENCODER hibcpdf417-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix pdf417-- |
% --REQUIRES preamble raiseerror parseinput renmatrix pdf417-- |
% --DESC: HIBC PDF417 |
% --EXAM: A123BJC5D6E71 |
% --EXOP: |
% --RNDR: renmatrix |
%%BeginResource: uk.co.terryburton.bwipp hibcpdf417 0.0 2022072900 67737 67465 |
%%BeginData: 89 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp hibcpdf417 0.0 2021092800 58331 61491 |
%%BeginData: 80 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 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 |
30623,7 → 28622,6 |
/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 |
30641,14 → 28639,10 |
|
/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 { |
30687,8 → 28681,6 |
|
dontdraw not //renmatrix if |
|
//unloadctx exec |
|
end |
|
} |
30702,17 → 28694,15 |
% --END ENCODER hibcpdf417-- |
|
% --BEGIN ENCODER hibcmicropdf417-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix micropdf417-- |
% --REQUIRES preamble raiseerror parseinput renmatrix micropdf417-- |
% --DESC: HIBC MicroPDF417 |
% --EXAM: A123BJC5D6E71 |
% --EXOP: |
% --RNDR: renmatrix |
%%BeginResource: uk.co.terryburton.bwipp hibcmicropdf417 0.0 2022072900 67763 67500 |
%%BeginData: 89 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp hibcmicropdf417 0.0 2021092800 58253 61526 |
%%BeginData: 80 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
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 |
30724,7 → 28714,6 |
/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 |
30742,14 → 28731,10 |
|
/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 { |
30788,8 → 28773,6 |
|
dontdraw not //renmatrix if |
|
//unloadctx exec |
|
end |
|
} |
30803,17 → 28786,15 |
% --END ENCODER hibcmicropdf417-- |
|
% --BEGIN ENCODER hibcqrcode-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix qrcode-- |
% --REQUIRES preamble raiseerror parseinput renmatrix qrcode-- |
% --DESC: HIBC QR Code |
% --EXAM: A123BJC5D6E71 |
% --EXOP: |
% --RNDR: renmatrix |
%%BeginResource: uk.co.terryburton.bwipp hibcqrcode 0.0 2022072900 71782 71498 |
%%BeginData: 85 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp hibcqrcode 0.0 2021092800 61300 64470 |
%%BeginData: 76 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 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 |
30825,7 → 28806,6 |
/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 |
|
30840,14 → 28820,10 |
} 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 { |
30885,8 → 28861,6 |
|
dontdraw not //renmatrix if |
|
//unloadctx exec |
|
end |
|
} |
30900,17 → 28874,15 |
% --END ENCODER hibcqrcode-- |
|
% --BEGIN ENCODER hibccodablockf-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix codablockf-- |
% --REQUIRES preamble raiseerror parseinput renmatrix codablockf-- |
% --DESC: HIBC Codablock F |
% --EXAM: A123BJC5D6E71 |
% --EXOP: |
% --RNDR: renmatrix |
%%BeginResource: uk.co.terryburton.bwipp hibccodablockf 0.0 2022072900 67542 67144 |
%%BeginData: 85 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp hibccodablockf 0.0 2021092800 57904 61298 |
%%BeginData: 76 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 dict |
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 |
30922,7 → 28894,6 |
/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 |
|
30937,14 → 28908,10 |
} 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 { |
30982,8 → 28949,6 |
|
dontdraw not //renmatrix if |
|
//unloadctx exec |
|
end |
|
} |
30997,17 → 28962,15 |
% --END ENCODER hibccodablockf-- |
|
% --BEGIN ENCODER hibcazteccode-- |
% --REQUIRES preamble loadctx unloadctx raiseerror parseinput renmatrix azteccode-- |
% --REQUIRES preamble raiseerror parseinput renmatrix azteccode-- |
% --DESC: HIBC Aztec Code |
% --EXAM: A123BJC5D6E71 |
% --EXOP: |
% --RNDR: renmatrix |
%%BeginResource: uk.co.terryburton.bwipp hibcazteccode 0.0 2022072900 67432 67241 |
%%BeginData: 85 ASCII Lines |
%%BeginResource: uk.co.terryburton.bwipp hibcazteccode 0.0 2021092800 58002 61059 |
%%BeginData: 76 ASCII Lines |
/setpacking where {pop currentpacking true setpacking} if |
10 dict |
dup /loadctx dup /uk.co.terryburton.bwipp findresource put |
dup /unloadctx dup /uk.co.terryburton.bwipp findresource put |
1 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 |
31019,7 → 28982,6 |
/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 |
|
31034,14 → 28996,10 |
} if |
options {def} forall |
|
/hibcazteccode //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 { |
31079,8 → 29037,6 |
|
dontdraw not //renmatrix if |
|
//unloadctx exec |
|
end |
|
} |