Skip to content

Commit 2315c4a

Browse files
gitlostterryburton
authored andcommitted
datamatrix: unlatch from Base 256 if FNC1
In lookup, on Base 256 exit, return ASCII instead if FNC1.
1 parent c7f2227 commit 2315c4a

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

src/datamatrix.ps.src

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -603,11 +603,12 @@ begin
603603
1 { % common exit
604604
isECI i get {//datamatrix.A exit} if % ECI only in ASCII
605605
i c40headerlength lt {//datamatrix.C exit} if % C40 only for c40headerlength characters
606+
/isfnc1 msg i get //datamatrix.fnc1 eq def
606607
/k 0 def { % loop
607608
i k add msglen eq {
608609
[/ac /cc /tc /xc /ec /bc] {dup load ceiling def} forall
609610
true [ cc tc xc ec bc] {ac exch le and} forall {//datamatrix.A exit} if
610-
true [ac cc tc xc ec ] {bc exch lt and} forall {//datamatrix.B exit} if
611+
true [ac cc tc xc ec ] {bc exch lt and} forall {isfnc1 {//datamatrix.A} {//datamatrix.B} ifelse exit} if
611612
true [ac cc tc xc bc] {ec exch lt and} forall {//datamatrix.E exit} if
612613
true [ac cc xc ec bc] {tc exch lt and} forall {//datamatrix.T exit} if
613614
true [ac cc tc ec bc] {xc exch lt and} forall {//datamatrix.X exit} if
@@ -622,8 +623,8 @@ begin
622623
/bc bc isFN {4 add} {1 add} ifelse def
623624
k 4 ge {
624625
true [ cc tc xc ec bc] {ac 1 add exch le and} forall {//datamatrix.A exit} if
625-
bc 1 add ac le {//datamatrix.B exit} if
626-
true [ cc tc xc ec ] {bc 1 add exch lt and} forall {//datamatrix.B exit} if
626+
bc 1 add ac le {isfnc1 {//datamatrix.A} {//datamatrix.B} ifelse exit} if
627+
true [ cc tc xc ec ] {bc 1 add exch lt and} forall {isfnc1 {//datamatrix.A} {//datamatrix.B} ifelse exit} if
627628
true [ac cc tc xc bc] {ec 1 add exch lt and} forall {//datamatrix.E exit} if
628629
true [ac cc xc ec bc] {tc 1 add exch lt and} forall {//datamatrix.T exit} if
629630
true [ac cc tc ec bc] {xc 1 add exch lt and} forall {//datamatrix.X exit} if

tests/ps_tests/datamatrix.ps.test

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,16 @@
710710
44 65 216 110 % randomised length+data bytes
711711
] debugIsEqual
712712

713+
% Unlatch from base256 if FNC1: "ロ^FNC1ワ" (UTF-8 Katakana)
714+
{ (^227^131^173^FNC1^227^131^175) (debugcws parse parsefnc) datamatrix } [
715+
231 % lB256
716+
47 164 218 153 % randomised length+data bytes
717+
232 % FNC1
718+
231 % lB256
719+
176 38 91 29 % randomised length+data bytes
720+
129 % PAD
721+
] debugIsEqual
722+
713723

714724
%
715725
% EDIFACT mode

0 commit comments

Comments
 (0)