wxMaxima
Loading...
Searching...
No Matches
rss.h
1/* rss.h - Data tables for DataBar (previously Reduced Space Symbology) */
2/*
3 libzint - the open source barcode library
4 Copyright (C) 2007-2025 Robin Stuart <rstuart114@gmail.com>
5
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions
8 are met:
9
10 1. Redistributions of source code must retain the above copyright
11 notice, this list of conditions and the following disclaimer.
12 2. Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution.
15 3. Neither the name of the project nor the names of its contributors
16 may be used to endorse or promote products derived from this software
17 without specific prior written permission.
18
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
23 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 SUCH DAMAGE.
30 */
31/* SPDX-License-Identifier: BSD-3-Clause */
32
33#ifndef Z_RSS_H
34#define Z_RSS_H
35
36/* DataBar Omnidirectional Tables */
37
38/* Tables 1 (outside) & 2 (inside) */
39static const unsigned short dbar_omn_g_sum[9] = {
40 0, 161, 961, 2015, 2715, /* Outside Gsum */
41 0, 336, 1036, 1516 /* Inside Gsum */
42};
43
44static const char dbar_omn_t_even_odd[9] = {
45 1, 10, 34, 70, 126, /* Outside Teven */
46 4, 20, 48, 81 /* Inside Todd */
47};
48
49static const char dbar_omn_modules[18] = {
50 12, 10, 8, 6, 4, /* Outside odd */
51 5, 7, 9, 11, /* Inside odd */
52 4, 6, 8, 10, 12, /* Outside even (16 - outside odd) */
53 10, 8, 6, 4 /* Inside even (15 - inside odd) */
54};
55
56static const char dbar_omn_widest[9] = {
57 8, 6, 4, 3, 1, 2, 4, 6, 8 /* Odd, even is 9 - odd */
58};
59
60/* Table 4 */
61static const char dbar_omn_finder_pattern[9][5] = {
62 { 3, 8, 2, 1, 1 },
63 { 3, 5, 5, 1, 1 },
64 { 3, 3, 7, 1, 1 },
65 { 3, 1, 9, 1, 1 },
66 { 2, 7, 4, 1, 1 },
67 { 2, 5, 6, 1, 1 },
68 { 2, 3, 8, 1, 1 },
69 { 1, 5, 7, 1, 1 },
70 { 1, 3, 9, 1, 1 },
71};
72
73/* Table 5 */
74static const char dbar_omn_checksum_weight[4][8] = {
75 { 1, 3, 9, 27, 2, 6, 18, 54 },
76 { 4, 12, 36, 29, 8, 24, 72, 58 },
77 { 16, 48, 65, 37, 32, 17, 51, 74 },
78 { 64, 34, 23, 69, 49, 68, 46, 59 },
79};
80
81/* DataBar Limited Tables */
82
83/* Table 6 */
84static const unsigned short dbar_ltd_t_even[7] = {
85 28, 728, 6454, 203, 2408, 1, 16632
86};
87
88static const char dbar_ltd_modules[7] = {
89 17, 13, 9, 15, 11, 19, 7 /* Odd, even is 26 - odd */
90};
91
92static const char dbar_ltd_widest[7] = {
93 6, 5, 3, 5, 4, 8, 1 /* Odd, even is 9 - odd */
94};
95
96/* Table 7 */
97static const char dbar_ltd_checksum_weight[2][14] = {
98 { 1, 3, 9, 27, 81, 65, 17, 51, 64, 14, 42, 37, 22, 66 },
99 { 20, 60, 2, 6, 18, 54, 73, 41, 34, 13, 39, 28, 84, 74 },
100};
101
102/* Annex C */
103static const char dbar_ltd_finder_pattern[89][14] = {
104 { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 1, 1 },
105 { 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 2, 1, 1 },
106 { 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 1, 1, 1 },
107 { 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 3, 2, 1, 1 },
108 { 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 3, 1, 1, 1 },
109 { 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 3, 1, 1, 1 },
110 { 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 3, 2, 1, 1 },
111 { 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 3, 1, 1, 1 },
112 { 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 3, 1, 1, 1 },
113 { 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 3, 1, 1, 1 },
114 { 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 3, 2, 1, 1 },
115 { 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1 },
116 { 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 3, 1, 1, 1 },
117 { 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 3, 1, 1, 1 },
118 { 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1 },
119 { 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 3, 2, 1, 1 },
120 { 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1 },
121 { 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 3, 1, 1, 1 },
122 { 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 3, 1, 1, 1 },
123 { 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1 },
124 { 1, 3, 1, 1, 1, 1, 1, 1, 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},
190 { 2, 1, 1, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 1 },
191 { 2, 1, 1, 2, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1 },
192 { 2, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2, 1, 1 },
193};
194
195/* DataBar Expanded Tables */
196
197/* Table 8 */
198static const unsigned short dbar_exp_g_sum[5] = {
199 0, 348, 1388, 2948, 3988
200};
201
202static const unsigned char dbar_exp_t_even[5] = {
203 4, 20, 52, 104, 204
204};
205
206static const char dbar_exp_modules[5] = {
207 12, 10, 8, 6, 4 /* Odd, even is 17 - odd */
208};
209
210static const char dbar_exp_widest[5] = {
211 7, 5, 4, 3, 1 /* Odd, even is 9 - odd */
212};
213
214/* Table 14 */
215static const unsigned char dbar_exp_checksum_weight[23][8] = {
216 { 1, 3, 9, 27, 81, 32, 96, 77 },
217 { 20, 60, 180, 118, 143, 7, 21, 63 },
218 { 189, 145, 13, 39, 117, 140, 209, 205 },
219 { 193, 157, 49, 147, 19, 57, 171, 91 },
220 { 62, 186, 136, 197, 169, 85, 44, 132 },
221 { 185, 133, 188, 142, 4, 12, 36, 108 },
222 { 113, 128, 173, 97, 80, 29, 87, 50 },
223 { 150, 28, 84, 41, 123, 158, 52, 156 },
224 { 46, 138, 203, 187, 139, 206, 196, 166 },
225 { 76, 17, 51, 153, 37, 111, 122, 155 },
226 { 43, 129, 176, 106, 107, 110, 119, 146 },
227 { 16, 48, 144, 10, 30, 90, 59, 177 },
228 { 109, 116, 137, 200, 178, 112, 125, 164 },
229 { 70, 210, 208, 202, 184, 130, 179, 115 },
230 { 134, 191, 151, 31, 93, 68, 204, 190 },
231 { 148, 22, 66, 198, 172, 94, 71, 2 },
232 { 6, 18, 54, 162, 64, 192, 154, 40 },
233 { 120, 149, 25, 75, 14, 42, 126, 167 },
234 { 79, 26, 78, 23, 69, 207, 199, 175 },
235 { 103, 98, 83, 38, 114, 131, 182, 124 },
236 { 161, 61, 183, 127, 170, 88, 53, 159 },
237 { 55, 165, 73, 8, 24, 72, 5, 15 },
238 { 45, 135, 194, 160, 58, 174, 100, 89 },
239};
240
241/* Table 15 */
242static const char dbar_exp_finder_pattern[12][5] = {
243 { 1, 8, 4, 1, 1 },
244 { 1, 1, 4, 8, 1 },
245 { 3, 6, 4, 1, 1 },
246 { 1, 1, 4, 6, 3 },
247 { 3, 4, 6, 1, 1 },
248 { 1, 1, 6, 4, 3 },
249 { 3, 2, 8, 1, 1 },
250 { 1, 1, 8, 2, 3 },
251 { 2, 6, 5, 1, 1 },
252 { 1, 1, 5, 6, 2 },
253 { 2, 2, 9, 1, 1 },
254 { 1, 1, 9, 2, 2 },
255};
256
257/* Table 16 */
258static const char dbar_exp_finder_sequence[18][11] = {
259 { 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
260 { 1, 4, 3, 0, 0, 0, 0, 0, 0, 0, 0 },
261 { 1, 6, 3, 8, 0, 0, 0, 0, 0, 0, 0 },
262 { 1, 10, 3, 8, 5, 0, 0, 0, 0, 0, 0 },
263 { 1, 10, 3, 8, 7, 12, 0, 0, 0, 0, 0 },
264 { 1, 10, 3, 8, 9, 12, 11, 0, 0, 0, 0 },
265 { 1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0 },
266 { 1, 2, 3, 4, 5, 6, 7, 10, 9, 0, 0 },
267 { 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 0 },
268 { 1, 2, 3, 4, 5, 8, 7, 10, 9, 12, 11 },
269};
270
271static const char dbar_exp_weight_rows[10][21] = {
272 { 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
273 { 0, 5, 6, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
274 { 0, 9, 10, 3, 4, 13, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
275 { 0, 17, 18, 3, 4, 13, 14, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
276 { 0, 17, 18, 3, 4, 13, 14, 11, 12, 21, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
277 { 0, 17, 18, 3, 4, 13, 14, 15, 16, 21, 22, 19, 20, 0, 0, 0, 0, 0, 0, 0, 0 },
278 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0, 0, 0, 0, 0, 0 },
279 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 17, 18, 15, 16, 0, 0, 0, 0 },
280 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 17, 18, 19, 20, 21, 22, 0, 0 },
281 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 13, 14, 11, 12, 17, 18, 15, 16, 21, 22, 19, 20 },
282};
283
284/* vim: set ts=4 sw=4 et : */
285#endif /* Z_RSS_H */