2009-07-05 00:48:42 +04:00
/* code1.h - Lookup info for USS Code One */
/*
libzint - the open source barcode library
2017-05-11 23:14:38 +03:00
Copyright ( C ) 2009 - 2017 Robin Stuart < rstuart114 @ gmail . com >
2013-05-16 21:26:38 +04:00
Redistribution and use in source and binary forms , with or without
modification , are permitted provided that the following conditions
are met :
2017-10-23 22:37:52 +03:00
1. Redistributions of source code must retain the above copyright
notice , this list of conditions and the following disclaimer .
2013-05-16 21:26:38 +04:00
2. Redistributions in binary form must reproduce the above copyright
notice , this list of conditions and the following disclaimer in the
2017-10-23 22:37:52 +03:00
documentation and / or other materials provided with the distribution .
2013-05-16 21:26:38 +04:00
3. Neither the name of the project nor the names of its contributors
may be used to endorse or promote products derived from this software
2017-10-23 22:37:52 +03:00
without specific prior written permission .
2013-05-16 21:26:38 +04:00
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS " AS IS " AND
ANY EXPRESS OR IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED . IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT , INDIRECT , INCIDENTAL , SPECIAL , EXEMPLARY , OR CONSEQUENTIAL
DAMAGES ( INCLUDING , BUT NOT LIMITED TO , PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; OR BUSINESS INTERRUPTION )
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , WHETHER IN CONTRACT , STRICT
LIABILITY , OR TORT ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY
2017-10-23 22:37:52 +03:00
OUT OF THE USE OF THIS SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF
2013-05-16 21:26:38 +04:00
SUCH DAMAGE .
2016-02-20 12:38:03 +03:00
*/
2009-07-05 00:48:42 +04:00
2017-08-09 11:13:37 +03:00
static const char c40_shift [ ] = {
2016-02-20 12:38:03 +03:00
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 ,
0 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
2 , 2 , 2 , 2 , 2 , 2 , 2 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
2 , 2 , 2 , 2 , 2 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3
} ;
2012-12-31 17:41:59 +04:00
2017-08-09 11:13:37 +03:00
static const char c40_value [ ] = {
2016-02-20 12:38:03 +03:00
0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 , 25 , 26 , 27 , 28 , 29 , 30 , 31 ,
3 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 ,
15 , 16 , 17 , 18 , 19 , 20 , 21 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 , 25 , 26 , 27 , 28 , 29 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , 37 , 38 , 39 ,
22 , 23 , 24 , 25 , 26 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 , 25 , 26 , 27 , 28 , 29 , 30 , 31
} ;
2012-12-31 17:41:59 +04:00
2017-08-09 11:13:37 +03:00
static const char text_shift [ ] = {
2016-02-20 12:38:03 +03:00
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 ,
0 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
2 , 2 , 2 , 2 , 2 , 2 , 2 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 ,
2 , 2 , 2 , 2 , 2 , 3 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 3 , 3 , 3 , 3 , 3
} ;
2009-07-05 00:48:42 +04:00
2017-08-09 11:13:37 +03:00
static const char text_value [ ] = {
2016-02-20 12:38:03 +03:00
0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 , 25 , 26 , 27 , 28 , 29 , 30 , 31 ,
3 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 ,
15 , 16 , 17 , 18 , 19 , 20 , 21 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 , 25 , 26 ,
22 , 23 , 24 , 25 , 26 , 0 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 , 25 , 26 , 27 , 28 , 29 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , 37 , 38 , 39 , 27 , 28 , 29 , 30 , 31
} ;
2017-08-09 11:13:37 +03:00
static const unsigned short int c1_height [ ] = {
2016-02-20 12:38:03 +03:00
16 , 22 , 28 , 40 , 52 , 70 , 104 , 148
} ;
2017-08-09 11:13:37 +03:00
static const unsigned short int c1_width [ ] = {
2016-02-20 12:38:03 +03:00
18 , 22 , 32 , 42 , 54 , 76 , 98 , 134
} ;
2017-08-09 11:13:37 +03:00
static const unsigned short int c1_data_length [ ] = {
2016-02-20 12:38:03 +03:00
10 , 19 , 44 , 91 , 182 , 370 , 732 , 1480
} ;
2017-08-09 11:13:37 +03:00
static const unsigned short int c1_ecc_length [ ] = {
2016-02-20 12:38:03 +03:00
10 , 16 , 26 , 44 , 70 , 140 , 280 , 560
} ;
2017-08-09 11:13:37 +03:00
static const unsigned short int c1_blocks [ ] = {
2016-02-20 12:38:03 +03:00
1 , 1 , 1 , 1 , 1 , 2 , 4 , 8
} ;
2017-08-09 11:13:37 +03:00
static const unsigned short int c1_data_blocks [ ] = {
2016-02-20 12:38:03 +03:00
10 , 19 , 44 , 91 , 182 , 185 , 183 , 185
} ;
2017-08-09 11:13:37 +03:00
static const unsigned short int c1_ecc_blocks [ ] = {
2016-02-20 12:38:03 +03:00
10 , 16 , 26 , 44 , 70 , 70 , 70 , 70
} ;
2017-08-09 11:13:37 +03:00
static const unsigned short int c1_grid_width [ ] = {
2016-02-20 12:38:03 +03:00
4 , 5 , 7 , 9 , 12 , 17 , 22 , 30
} ;
2017-08-09 11:13:37 +03:00
static const unsigned short int c1_grid_height [ ] = {
2016-02-20 12:38:03 +03:00
5 , 7 , 10 , 15 , 21 , 30 , 46 , 68
} ;
2009-07-05 00:48:42 +04:00
# define C1_ASCII 1
# define C1_C40 2
# define C1_DECIMAL 3
# define C1_TEXT 4
# define C1_EDI 5
2017-10-23 22:37:52 +03:00
# define C1_BYTE 6