line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Barcode::DataMatrix::CharDataFiller; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
49
|
|
4
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
2022
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 Barcode::DataMatrix::CharDataFiller |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Handle filling character data within the data matrix array. |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
The documentation for the methods in this class has been adapted from the |
11
|
|
|
|
|
|
|
comments in |
12
|
|
|
|
|
|
|
L. |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head2 new |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Construct a C object. |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=cut |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new { |
21
|
12
|
|
|
12
|
1
|
28
|
my $self = bless {}, shift; |
22
|
12
|
|
|
|
|
69
|
@$self{qw( ncol nrow array )} = @_; |
23
|
12
|
|
|
|
|
42
|
$self->fill(); |
24
|
12
|
|
|
|
|
70
|
return $self; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head2 module (i, j, k, l) |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Places "chr+bit" with the appropriate wrapping within the array. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub module { |
34
|
14064
|
|
|
14064
|
1
|
19328
|
my ($self,$i,$j,$k,$l) = @_; |
35
|
14064
|
100
|
|
|
|
26536
|
if($i < 0) { |
36
|
287
|
|
|
|
|
399
|
$i += $self->{nrow}; |
37
|
287
|
|
|
|
|
447
|
$j += 4 - ($self->{nrow} + 4) % 8; |
38
|
|
|
|
|
|
|
} |
39
|
14064
|
100
|
|
|
|
24800
|
if($j < 0) { |
40
|
369
|
|
|
|
|
511
|
$j += $self->{ncol}; |
41
|
369
|
|
|
|
|
618
|
$i += 4 - ($self->{ncol} + 4) % 8; |
42
|
|
|
|
|
|
|
} |
43
|
14064
|
|
|
|
|
23875
|
$self->{array}->[$i * $self->{ncol} + $j] = 10 * $k + $l; |
44
|
14064
|
|
|
|
|
19235
|
return; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 utah (i, j, k) |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Places the 8 bits of a utah-shaped symbol character. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=cut |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub utah { |
54
|
1754
|
|
|
1754
|
1
|
2614
|
my ($self,$i,$j,$k) = @_; |
55
|
1754
|
|
|
|
|
3654
|
$self->module($i - 2, $j - 2, $k, 1); |
56
|
1754
|
|
|
|
|
3764
|
$self->module($i - 2, $j - 1, $k, 2); |
57
|
1754
|
|
|
|
|
3701
|
$self->module($i - 1, $j - 2, $k, 3); |
58
|
1754
|
|
|
|
|
3654
|
$self->module($i - 1, $j - 1, $k, 4); |
59
|
1754
|
|
|
|
|
3586
|
$self->module($i - 1, $j, $k, 5); |
60
|
1754
|
|
|
|
|
3560
|
$self->module($i, $j - 2, $k, 6); |
61
|
1754
|
|
|
|
|
3487
|
$self->module($i, $j - 1, $k, 7); |
62
|
1754
|
|
|
|
|
3262
|
$self->module($i, $j, $k, 8); |
63
|
1754
|
|
|
|
|
2401
|
return; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 corner1 (i) |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Places 8 bits of the first of the four special corner cases. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=cut |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub corner1 { |
73
|
3
|
|
|
3
|
1
|
5
|
my ($self,$i) = @_; |
74
|
3
|
|
|
|
|
6
|
my ($ncol,$nrow) = @$self{qw( ncol nrow )}; |
75
|
3
|
|
|
|
|
9
|
$self->module($nrow - 1, 0, $i, 1); |
76
|
3
|
|
|
|
|
7
|
$self->module($nrow - 1, 1, $i, 2); |
77
|
3
|
|
|
|
|
9
|
$self->module($nrow - 1, 2, $i, 3); |
78
|
3
|
|
|
|
|
9
|
$self->module(0, $ncol - 2, $i, 4); |
79
|
3
|
|
|
|
|
9
|
$self->module(0, $ncol - 1, $i, 5); |
80
|
3
|
|
|
|
|
11
|
$self->module(1, $ncol - 1, $i, 6); |
81
|
3
|
|
|
|
|
7
|
$self->module(2, $ncol - 1, $i, 7); |
82
|
3
|
|
|
|
|
8
|
$self->module(3, $ncol - 1, $i, 8); |
83
|
3
|
|
|
|
|
4
|
return; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head2 corner2 (i) |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Places 8 bits of the second of the four special corner cases. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=cut |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub corner2 { #(int i) |
93
|
1
|
|
|
1
|
1
|
3
|
my ($self,$i) = @_; |
94
|
1
|
|
|
|
|
3
|
my ($ncol,$nrow) = @$self{qw( ncol nrow )}; |
95
|
1
|
|
|
|
|
3
|
$self->module($nrow - 3, 0, $i, 1); |
96
|
1
|
|
|
|
|
4
|
$self->module($nrow - 2, 0, $i, 2); |
97
|
1
|
|
|
|
|
4
|
$self->module($nrow - 1, 0, $i, 3); |
98
|
1
|
|
|
|
|
3
|
$self->module(0, $ncol - 4, $i, 4); |
99
|
1
|
|
|
|
|
4
|
$self->module(0, $ncol - 3, $i, 5); |
100
|
1
|
|
|
|
|
4
|
$self->module(0, $ncol - 2, $i, 6); |
101
|
1
|
|
|
|
|
4
|
$self->module(0, $ncol - 1, $i, 7); |
102
|
1
|
|
|
|
|
3
|
$self->module(1, $ncol - 1, $i, 8); |
103
|
1
|
|
|
|
|
2
|
return; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head2 corner3 (i) |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Places 8 bits of the third of the four special corner cases. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=cut |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub corner3 { #(int i) |
113
|
0
|
|
|
0
|
1
|
0
|
my ($self,$i) = @_; |
114
|
0
|
|
|
|
|
0
|
my ($ncol,$nrow) = @$self{qw( ncol nrow )}; |
115
|
0
|
|
|
|
|
0
|
$self->module($nrow - 3, 0, $i, 1); |
116
|
0
|
|
|
|
|
0
|
$self->module($nrow - 2, 0, $i, 2); |
117
|
0
|
|
|
|
|
0
|
$self->module($nrow - 1, 0, $i, 3); |
118
|
0
|
|
|
|
|
0
|
$self->module(0, $ncol - 2, $i, 4); |
119
|
0
|
|
|
|
|
0
|
$self->module(0, $ncol - 1, $i, 5); |
120
|
0
|
|
|
|
|
0
|
$self->module(1, $ncol - 1, $i, 6); |
121
|
0
|
|
|
|
|
0
|
$self->module(2, $ncol - 1, $i, 7); |
122
|
0
|
|
|
|
|
0
|
$self->module(3, $ncol - 1, $i, 8); |
123
|
0
|
|
|
|
|
0
|
return; |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head2 corner4 (i) |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Places 8 bits of the fourth of the four special corner cases. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=cut |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
sub corner4 { #(int i) |
133
|
0
|
|
|
0
|
1
|
0
|
my ($self,$i) = @_; |
134
|
0
|
|
|
|
|
0
|
my ($ncol,$nrow) = @$self{qw( ncol nrow )}; |
135
|
0
|
|
|
|
|
0
|
$self->module($nrow - 1, 0, $i, 1); |
136
|
0
|
|
|
|
|
0
|
$self->module($nrow - 1, $ncol - 1, $i, 2); |
137
|
0
|
|
|
|
|
0
|
$self->module(0, $ncol - 3, $i, 3); |
138
|
0
|
|
|
|
|
0
|
$self->module(0, $ncol - 2, $i, 4); |
139
|
0
|
|
|
|
|
0
|
$self->module(0, $ncol - 1, $i, 5); |
140
|
0
|
|
|
|
|
0
|
$self->module(1, $ncol - 3, $i, 6); |
141
|
0
|
|
|
|
|
0
|
$self->module(1, $ncol - 2, $i, 7); |
142
|
0
|
|
|
|
|
0
|
$self->module(1, $ncol - 1, $i, 8); |
143
|
0
|
|
|
|
|
0
|
return; |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head2 fill |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Fills an nrow x ncol array with appropriate values. |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=cut |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
sub fill { # (int ncol; int nrow; int array;) : void |
153
|
12
|
|
|
12
|
1
|
17
|
my $self = shift; |
154
|
12
|
|
|
|
|
29
|
my ($ncol,$nrow,$array) = @$self{qw( ncol nrow array )}; |
155
|
12
|
|
|
|
|
23
|
my $i = 1; |
156
|
12
|
|
|
|
|
14
|
my $j = 4; |
157
|
12
|
|
|
|
|
18
|
my $k = 0; |
158
|
12
|
|
|
|
|
29
|
for(my $l = 0; $l < $nrow; $l++) { |
159
|
350
|
|
|
|
|
705
|
for(my $i1 = 0; $i1 < $ncol; $i1++) { |
160
|
14076
|
|
|
|
|
31776
|
$array->[$l * $ncol + $i1] = 0; |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
} |
163
|
12
|
|
100
|
|
|
17
|
do { |
164
|
89
|
100
|
66
|
|
|
231
|
$self->corner1($i++) if $j == $nrow && $k == 0; |
165
|
89
|
50
|
66
|
|
|
232
|
$self->corner2($i++) if $j == $nrow - 2 && $k == 0 && $ncol % 4 != 0; |
|
|
|
66
|
|
|
|
|
166
|
89
|
50
|
66
|
|
|
212
|
$self->corner3($i++) if $j == $nrow - 2 && $k == 0 && $ncol % 8 == 4; |
|
|
|
66
|
|
|
|
|
167
|
89
|
50
|
100
|
|
|
309
|
$self->corner4($i++) if $j == $nrow + 4 && $k == 2 && $ncol % 8 == 0; |
|
|
|
66
|
|
|
|
|
168
|
89
|
|
100
|
|
|
100
|
do { |
169
|
1010
|
100
|
66
|
|
|
6772
|
$self->utah($j, $k, $i++) if $j < $nrow && $k >= 0 && $array->[$j * $ncol + $k] == 0; |
|
|
|
100
|
|
|
|
|
170
|
1010
|
|
|
|
|
1238
|
$j -= 2; |
171
|
1010
|
|
|
|
|
4402
|
$k += 2; |
172
|
|
|
|
|
|
|
} while($j >= 0 && $k < $ncol); |
173
|
89
|
|
|
|
|
116
|
$j++; |
174
|
89
|
|
|
|
|
114
|
$k += 3; |
175
|
89
|
|
100
|
|
|
111
|
do { |
176
|
1010
|
100
|
100
|
|
|
6867
|
$self->utah($j, $k, $i++) if $j >= 0 && $k < $ncol && $array->[$j * $ncol + $k] == 0; |
|
|
|
66
|
|
|
|
|
177
|
1010
|
|
|
|
|
1248
|
$j += 2; |
178
|
1010
|
|
|
|
|
4453
|
$k -= 2; |
179
|
|
|
|
|
|
|
} while($j < $nrow && $k >= 0); |
180
|
89
|
|
|
|
|
106
|
$j += 3; |
181
|
89
|
|
|
|
|
358
|
$k++; |
182
|
|
|
|
|
|
|
} while($j < $nrow || $k < $ncol); |
183
|
12
|
100
|
|
|
|
51
|
$array->[$nrow * $ncol - 1] = $array->[($nrow - 1) * $ncol - 2] = 1 |
184
|
|
|
|
|
|
|
if($array->[$nrow * $ncol - 1] == 0); |
185
|
12
|
|
|
|
|
19
|
return; |
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
1; |