File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3302,30 +3302,27 @@ begin
33023302 /this exch def
33033303 /patt exch def
33043304 1 { % common exit
3305- aivals patt known {true exit} if % Fast path
3305+ aivals patt known { true exit } if % Fast path
33063306 patt length 4 eq {
33073307 patt 3 1 getinterval (n) eq {
3308+ % XXXn or XXnn
33083309 /pfxlen patt 2 1 getinterval (n) eq {2} {3} ifelse def
3309- false
3310- ais {
3311- dup dup this ne exch length 4 eq and {
3312- 0 pfxlen getinterval patt 0 pfxlen getinterval eq {
3313- pop true
3314- } if
3315- } {
3316- pop
3317- } ifelse
3318- } forall
3319- exit
3310+ patt 0 pfxlen getinterval
3311+ aipfx exch 2 copy known { get } { pop pop 0 } ifelse
3312+ this length 4 eq {
3313+ this 0 pfxlen getinterval patt 0 pfxlen getinterval eq { 1 sub } if
3314+ } if
3315+ 0 gt exit
33203316 } if
33213317 false exit
33223318 } if
33233319 false exit
33243320 } repeat
33253321 } def
33263322
3327- % Build AI dict and validate repeats
3323+ % Build AI dict and 2- and 3-char prefixes of 4-char AIs; validate repeats
33283324 /aivals vals length dict def
3325+ /aipfx vals length 2 mul 1 add dict def
33293326 0 1 vals length 1 sub {
33303327 dup ais exch get /ai exch def
33313328 vals exch get /val exch def
@@ -3339,6 +3336,10 @@ begin
33393336 } if
33403337 } {
33413338 aivals ai val put
3339+ ai length 4 eq {
3340+ ai 0 2 getinterval aipfx exch 2 copy known { 2 copy get 1 add } { 1 } ifelse put
3341+ ai 0 3 getinterval aipfx exch 2 copy known { 2 copy get 1 add } { 1 } ifelse put
3342+ } if
33423343 } ifelse
33433344 } for
33443345
Original file line number Diff line number Diff line change 10101010((01)12345678901231(3925)12599(3600)654321) good_tmpl
10111011((01)12345678901231(3925)12599(3695)654321) good_tmpl
10121012
1013+ % Wildcard family exclusion (XXXn) resolved via the AI-prefix index
1014+ ((01)12345678901231(3100)123456(3100)123456) good_tmpl % a repeated AI is not exclusive with itself
1015+ ((01)12345678901231(3100)123456(3110)123456) good_tmpl % distinct families (310n vs 311n) are not exclusive
1016+ ((01)12345678901231(3100)123456(3110)123456(3100)123456(3110)123456) good_tmpl % two families, each repeated
1017+ ((01)12345678901231(3100)123456(3100)123456(3110)123456) good_tmpl % a repeat plus a different family
1018+ ((01)12345678901231(3100)123456(3101)123456) /bwipp.GS1exclusiveAIs er_tmpl % two members of one family (310n) are exclusive
1019+ ((01)12345678901231(3100)123456(3101)123456(3102)123456) /bwipp.GS1exclusiveAIs er_tmpl % three members of one family
1020+ ((01)12345678901231(3100)123456(3100)123456(3101)123456) /bwipp.GS1exclusiveAIs er_tmpl % a repeat plus a distinct family member
1021+
1022+ % Many repeated wildcard-family AIs validate (prefix counts are per distinct AI)
1023+ {
1024+ /pre (\(01\)12345678901231) def /seg (\(3100\)123456) def
1025+ /s pre length seg length 100 mul add string def
1026+ s 0 pre putinterval
1027+ 0 1 99 { /i exch def s pre length seg length i mul add seg putinterval } for
1028+ s /ai gs1process pop pop pop null
1029+ } null isEqual
1030+
10131031% lintiso5218 (biological sex code)
10141032((8018)123123123123123121(7252)0) good_tmpl
10151033((8018)123123123123123121(7252)1) good_tmpl
You can’t perform that action at this time.
0 commit comments