mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
gs1_verify: validate AIs from BWIPP gs1-format-spec.txt
This commit is contained in:
parent
0b80592f87
commit
f9300cb37e
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
libzint - the open source barcode library
|
libzint - the open source barcode library
|
||||||
Copyright (C) 2008-2020 Robin Stuart <rstuart114@gmail.com>
|
Copyright (C) 2008-2021 Robin Stuart <rstuart114@gmail.com>
|
||||||
Bugfixes thanks to Christian Sakowski and BogDan Vatra
|
Bugfixes thanks to Christian Sakowski and BogDan Vatra
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
@ -734,7 +734,7 @@ INTERNAL int ean_128(struct zint_symbol *symbol, unsigned char source[], int len
|
|||||||
}
|
}
|
||||||
|
|
||||||
error_number = gs1_verify(symbol, source, length, reduced);
|
error_number = gs1_verify(symbol, source, length, reduced);
|
||||||
if (error_number != 0) {
|
if (error_number >= ZINT_ERROR) {
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
reduced_length = (int) ustrlen(reduced);
|
reduced_length = (int) ustrlen(reduced);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
libzint - the open source barcode library
|
libzint - the open source barcode library
|
||||||
Copyright (C) 2008 - 2020 Robin Stuart <rstuart114@gmail.com>
|
Copyright (C) 2008 - 2021 Robin Stuart <rstuart114@gmail.com>
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
@ -1257,16 +1257,15 @@ static int linear_dummy_run(unsigned char *source, const int length, char *errtx
|
|||||||
dummy->option_1 = 3;
|
dummy->option_1 = 3;
|
||||||
error_number = ean_128(dummy, source, length);
|
error_number = ean_128(dummy, source, length);
|
||||||
linear_width = dummy->width;
|
linear_width = dummy->width;
|
||||||
if (error_number != 0) {
|
if (error_number >= ZINT_ERROR) {
|
||||||
strcpy(errtxt, dummy->errtxt);
|
strcpy(errtxt, dummy->errtxt);
|
||||||
}
|
}
|
||||||
ZBarcode_Delete(dummy);
|
ZBarcode_Delete(dummy);
|
||||||
|
|
||||||
if (error_number == 0) {
|
if (error_number >= ZINT_ERROR) {
|
||||||
return linear_width;
|
|
||||||
} else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
return linear_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int length) {
|
INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||||
@ -1456,7 +1455,7 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error_number != 0) {
|
if (error_number >= ZINT_ERROR) {
|
||||||
strcpy(symbol->errtxt, linear->errtxt);
|
strcpy(symbol->errtxt, linear->errtxt);
|
||||||
strcat(symbol->errtxt, " in linear component");
|
strcat(symbol->errtxt, " in linear component");
|
||||||
ZBarcode_Delete(linear);
|
ZBarcode_Delete(linear);
|
||||||
|
1589
backend/gs1.c
1589
backend/gs1.c
File diff suppressed because it is too large
Load Diff
841
backend/gs1_lint.h
Normal file
841
backend/gs1_lint.h
Normal file
@ -0,0 +1,841 @@
|
|||||||
|
/*
|
||||||
|
* GS1 AI checker generated by "backend/tools/gen_gs1_lint.php" from
|
||||||
|
* https://raw.githubusercontent.com/bwipp/postscriptbarcode/master/contrib/development/gs1-format-spec.txt
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
libzint - the open source barcode library
|
||||||
|
Copyright (C) 2021 Robin Stuart <rstuart114@gmail.com>
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions
|
||||||
|
are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
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
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
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
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GS1_LINT_H
|
||||||
|
#define GS1_LINT_H
|
||||||
|
|
||||||
|
/* N18,csum,key */
|
||||||
|
static int n18_csum_key(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len == 18
|
||||||
|
&& csum(data, data_len, 0, 18, 18, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& key(data, data_len, 0, 18, 18, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& numeric(data, data_len, 0, 18, 18, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& csum(data, data_len, 0, 18, 18, p_err_no, p_err_posn, err_msg, 0)
|
||||||
|
&& key(data, data_len, 0, 18, 18, p_err_no, p_err_posn, err_msg, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* N14,csum,key */
|
||||||
|
static int n14_csum_key(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len == 14
|
||||||
|
&& csum(data, data_len, 0, 14, 14, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& key(data, data_len, 0, 14, 14, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& numeric(data, data_len, 0, 14, 14, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& csum(data, data_len, 0, 14, 14, p_err_no, p_err_posn, err_msg, 0)
|
||||||
|
&& key(data, data_len, 0, 14, 14, p_err_no, p_err_posn, err_msg, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* X..20 */
|
||||||
|
static int x__20(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 1 && data_len <= 20
|
||||||
|
&& cset82(data, data_len, 0, 1, 20, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* N6,yymmd0 */
|
||||||
|
static int n6_yymmd0(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len == 6
|
||||||
|
&& yymmd0(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& numeric(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& yymmd0(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* N2 */
|
||||||
|
static int n2(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len == 2
|
||||||
|
&& numeric(data, data_len, 0, 2, 2, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* X..28 */
|
||||||
|
static int x__28(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 1 && data_len <= 28
|
||||||
|
&& cset82(data, data_len, 0, 1, 28, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* X..30 */
|
||||||
|
static int x__30(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 1 && data_len <= 30
|
||||||
|
&& cset82(data, data_len, 0, 1, 30, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* N..6 */
|
||||||
|
static int n__6(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 1 && data_len <= 6
|
||||||
|
&& numeric(data, data_len, 0, 1, 6, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* N13,csum,key X0..17 */
|
||||||
|
static int n13_csum_key_x0__17(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 13 && data_len <= 30
|
||||||
|
&& csum(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& key(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& numeric(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& csum(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 0)
|
||||||
|
&& key(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 0)
|
||||||
|
&& cset82(data, data_len, 13, 0, 17, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* N13,csum,key N0..12 */
|
||||||
|
static int n13_csum_key_n0__12(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 13 && data_len <= 25
|
||||||
|
&& csum(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& key(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& numeric(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& csum(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 0)
|
||||||
|
&& key(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 0)
|
||||||
|
&& numeric(data, data_len, 13, 0, 12, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* N..8 */
|
||||||
|
static int n__8(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 1 && data_len <= 8
|
||||||
|
&& numeric(data, data_len, 0, 1, 8, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* N6 */
|
||||||
|
static int n6(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len == 6
|
||||||
|
&& numeric(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* N..15 */
|
||||||
|
static int n__15(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 1 && data_len <= 15
|
||||||
|
&& numeric(data, data_len, 0, 1, 15, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* N3,iso4217 N..15 */
|
||||||
|
static int n3_iso4217_n__15(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 4 && data_len <= 18
|
||||||
|
&& iso4217(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& numeric(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& iso4217(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg, 0)
|
||||||
|
&& numeric(data, data_len, 3, 1, 15, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* N4 */
|
||||||
|
static int n4(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len == 4
|
||||||
|
&& numeric(data, data_len, 0, 4, 4, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* X..30,key */
|
||||||
|
static int x__30_key(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 1 && data_len <= 30
|
||||||
|
&& key(data, data_len, 0, 1, 30, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& cset82(data, data_len, 0, 1, 30, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& key(data, data_len, 0, 1, 30, p_err_no, p_err_posn, err_msg, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* N17,csum,key */
|
||||||
|
static int n17_csum_key(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len == 17
|
||||||
|
&& csum(data, data_len, 0, 17, 17, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& key(data, data_len, 0, 17, 17, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& numeric(data, data_len, 0, 17, 17, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& csum(data, data_len, 0, 17, 17, p_err_no, p_err_posn, err_msg, 0)
|
||||||
|
&& key(data, data_len, 0, 17, 17, p_err_no, p_err_posn, err_msg, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* N13,csum,key */
|
||||||
|
static int n13_csum_key(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len == 13
|
||||||
|
&& csum(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& key(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& numeric(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& csum(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 0)
|
||||||
|
&& key(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* N3,iso3166 X..9 */
|
||||||
|
static int n3_iso3166_x__9(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 4 && data_len <= 12
|
||||||
|
&& iso3166(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& numeric(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& iso3166(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg, 0)
|
||||||
|
&& cset82(data, data_len, 3, 1, 9, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* N3,iso3166 */
|
||||||
|
static int n3_iso3166(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len == 3
|
||||||
|
&& iso3166(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& numeric(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& iso3166(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* N..15,iso3166list */
|
||||||
|
static int n__15_iso3166list(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 1 && data_len <= 15
|
||||||
|
&& iso3166list(data, data_len, 0, 1, 15, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& numeric(data, data_len, 0, 1, 15, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& iso3166list(data, data_len, 0, 1, 15, p_err_no, p_err_posn, err_msg, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* X..3 */
|
||||||
|
static int x__3(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 1 && data_len <= 3
|
||||||
|
&& cset82(data, data_len, 0, 1, 3, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* X..35,pcenc */
|
||||||
|
static int x__35_pcenc(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 1 && data_len <= 35
|
||||||
|
&& pcenc(data, data_len, 0, 1, 35, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& cset82(data, data_len, 0, 1, 35, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& pcenc(data, data_len, 0, 1, 35, p_err_no, p_err_posn, err_msg, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* X..70,pcenc */
|
||||||
|
static int x__70_pcenc(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 1 && data_len <= 70
|
||||||
|
&& pcenc(data, data_len, 0, 1, 70, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& cset82(data, data_len, 0, 1, 70, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& pcenc(data, data_len, 0, 1, 70, p_err_no, p_err_posn, err_msg, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* X2,iso3166alpha2 */
|
||||||
|
static int x2_iso3166alpha2(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len == 2
|
||||||
|
&& iso3166alpha2(data, data_len, 0, 2, 2, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& cset82(data, data_len, 0, 2, 2, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& iso3166alpha2(data, data_len, 0, 2, 2, p_err_no, p_err_posn, err_msg, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* X..30,pcenc */
|
||||||
|
static int x__30_pcenc(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 1 && data_len <= 30
|
||||||
|
&& pcenc(data, data_len, 0, 1, 30, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& cset82(data, data_len, 0, 1, 30, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& pcenc(data, data_len, 0, 1, 30, p_err_no, p_err_posn, err_msg, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* N1,yesno */
|
||||||
|
static int n1_yesno(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len == 1
|
||||||
|
&& yesno(data, data_len, 0, 1, 1, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& numeric(data, data_len, 0, 1, 1, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& yesno(data, data_len, 0, 1, 1, p_err_no, p_err_posn, err_msg, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* N6,yymmd0 N4,hhmm */
|
||||||
|
static int n6_yymmd0_n4_hhmm(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len == 10
|
||||||
|
&& yymmd0(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& hhmm(data, data_len, 6, 4, 4, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& numeric(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& yymmd0(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 0)
|
||||||
|
&& numeric(data, data_len, 6, 4, 4, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& hhmm(data, data_len, 6, 4, 4, p_err_no, p_err_posn, err_msg, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* N6,yymmdd */
|
||||||
|
static int n6_yymmdd(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len == 6
|
||||||
|
&& yymmdd(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& numeric(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& yymmdd(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* N13 */
|
||||||
|
static int n13(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len == 13
|
||||||
|
&& numeric(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* N6,yymmdd N4,hhmm */
|
||||||
|
static int n6_yymmdd_n4_hhmm(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len == 10
|
||||||
|
&& yymmdd(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& hhmm(data, data_len, 6, 4, 4, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& numeric(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& yymmdd(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 0)
|
||||||
|
&& numeric(data, data_len, 6, 4, 4, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& hhmm(data, data_len, 6, 4, 4, p_err_no, p_err_posn, err_msg, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* N..4 */
|
||||||
|
static int n__4(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 1 && data_len <= 4
|
||||||
|
&& numeric(data, data_len, 0, 1, 4, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* X..12 */
|
||||||
|
static int x__12(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 1 && data_len <= 12
|
||||||
|
&& cset82(data, data_len, 0, 1, 12, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* N6,yymmdd N0..6,yymmdd */
|
||||||
|
static int n6_yymmdd_n0__6_yymmdd(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 6 && data_len <= 12
|
||||||
|
&& yymmdd(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& yymmdd(data, data_len, 6, 0, 6, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& numeric(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& yymmdd(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 0)
|
||||||
|
&& numeric(data, data_len, 6, 0, 6, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& yymmdd(data, data_len, 6, 0, 6, p_err_no, p_err_posn, err_msg, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* X..10 */
|
||||||
|
static int x__10(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 1 && data_len <= 10
|
||||||
|
&& cset82(data, data_len, 0, 1, 10, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* X..2 */
|
||||||
|
static int x__2(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 1 && data_len <= 2
|
||||||
|
&& cset82(data, data_len, 0, 1, 2, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* N3,iso3166999 X..27 */
|
||||||
|
static int n3_iso3166999_x__27(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 4 && data_len <= 30
|
||||||
|
&& iso3166999(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& numeric(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& iso3166999(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg, 0)
|
||||||
|
&& cset82(data, data_len, 3, 1, 27, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* N1 X1 X1 X1,importeridx */
|
||||||
|
static int n1_x1_x1_x1_importeridx(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len == 4
|
||||||
|
&& importeridx(data, data_len, 3, 1, 1, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& numeric(data, data_len, 0, 1, 1, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& cset82(data, data_len, 1, 1, 1, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& cset82(data, data_len, 2, 1, 1, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& cset82(data, data_len, 3, 1, 1, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& importeridx(data, data_len, 3, 1, 1, p_err_no, p_err_posn, err_msg, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* X2 X..28 */
|
||||||
|
static int x2_x__28(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 3 && data_len <= 30
|
||||||
|
&& cset82(data, data_len, 0, 2, 2, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& cset82(data, data_len, 2, 1, 28, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* N4,nonzero N5,nonzero N3,nonzero N1,winding N1 */
|
||||||
|
static int n4_nonzero_n5_nonzero_n3_nonzero_n1_winding_n1(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len == 14
|
||||||
|
&& nonzero(data, data_len, 0, 4, 4, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& nonzero(data, data_len, 4, 5, 5, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& nonzero(data, data_len, 9, 3, 3, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& winding(data, data_len, 12, 1, 1, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& numeric(data, data_len, 0, 4, 4, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& nonzero(data, data_len, 0, 4, 4, p_err_no, p_err_posn, err_msg, 0)
|
||||||
|
&& numeric(data, data_len, 4, 5, 5, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& nonzero(data, data_len, 4, 5, 5, p_err_no, p_err_posn, err_msg, 0)
|
||||||
|
&& numeric(data, data_len, 9, 3, 3, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& nonzero(data, data_len, 9, 3, 3, p_err_no, p_err_posn, err_msg, 0)
|
||||||
|
&& numeric(data, data_len, 12, 1, 1, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& winding(data, data_len, 12, 1, 1, p_err_no, p_err_posn, err_msg, 0)
|
||||||
|
&& numeric(data, data_len, 13, 1, 1, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* N1,zero N13,csum,key X0..16 */
|
||||||
|
static int n1_zero_n13_csum_key_x0__16(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 14 && data_len <= 30
|
||||||
|
&& zero(data, data_len, 0, 1, 1, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& csum(data, data_len, 1, 13, 13, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& key(data, data_len, 1, 13, 13, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& numeric(data, data_len, 0, 1, 1, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& zero(data, data_len, 0, 1, 1, p_err_no, p_err_posn, err_msg, 0)
|
||||||
|
&& numeric(data, data_len, 1, 13, 13, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& csum(data, data_len, 1, 13, 13, p_err_no, p_err_posn, err_msg, 0)
|
||||||
|
&& key(data, data_len, 1, 13, 13, p_err_no, p_err_posn, err_msg, 0)
|
||||||
|
&& cset82(data, data_len, 14, 0, 16, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* N14,csum N4,pieceoftotal */
|
||||||
|
static int n14_csum_n4_pieceoftotal(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len == 18
|
||||||
|
&& csum(data, data_len, 0, 14, 14, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& pieceoftotal(data, data_len, 14, 4, 4, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& numeric(data, data_len, 0, 14, 14, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& csum(data, data_len, 0, 14, 14, p_err_no, p_err_posn, err_msg, 0)
|
||||||
|
&& numeric(data, data_len, 14, 4, 4, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& pieceoftotal(data, data_len, 14, 4, 4, p_err_no, p_err_posn, err_msg, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* X..34,iban */
|
||||||
|
static int x__34_iban(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 1 && data_len <= 34
|
||||||
|
&& iban(data, data_len, 0, 1, 34, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& cset82(data, data_len, 0, 1, 34, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& iban(data, data_len, 0, 1, 34, p_err_no, p_err_posn, err_msg, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* N8,yymmddhh N0..4,mmoptss */
|
||||||
|
static int n8_yymmddhh_n0__4_mmoptss(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 8 && data_len <= 12
|
||||||
|
&& yymmddhh(data, data_len, 0, 8, 8, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& mmoptss(data, data_len, 8, 0, 4, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& numeric(data, data_len, 0, 8, 8, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& yymmddhh(data, data_len, 0, 8, 8, p_err_no, p_err_posn, err_msg, 0)
|
||||||
|
&& numeric(data, data_len, 8, 0, 4, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& mmoptss(data, data_len, 8, 0, 4, p_err_no, p_err_posn, err_msg, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* X..50 */
|
||||||
|
static int x__50(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 1 && data_len <= 50
|
||||||
|
&& cset82(data, data_len, 0, 1, 50, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* C..30,key */
|
||||||
|
static int c__30_key(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 1 && data_len <= 30
|
||||||
|
&& key(data, data_len, 0, 1, 30, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& cset39(data, data_len, 0, 1, 30, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& key(data, data_len, 0, 1, 30, p_err_no, p_err_posn, err_msg, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* N..12,nozeroprefix */
|
||||||
|
static int n__12_nozeroprefix(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 1 && data_len <= 12
|
||||||
|
&& nozeroprefix(data, data_len, 0, 1, 12, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& numeric(data, data_len, 0, 1, 12, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& nozeroprefix(data, data_len, 0, 1, 12, p_err_no, p_err_posn, err_msg, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* N18,csum */
|
||||||
|
static int n18_csum(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len == 18
|
||||||
|
&& csum(data, data_len, 0, 18, 18, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& numeric(data, data_len, 0, 18, 18, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& csum(data, data_len, 0, 18, 18, p_err_no, p_err_posn, err_msg, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* N..10 */
|
||||||
|
static int n__10(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 1 && data_len <= 10
|
||||||
|
&& numeric(data, data_len, 0, 1, 10, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* X..25 */
|
||||||
|
static int x__25(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 1 && data_len <= 25
|
||||||
|
&& cset82(data, data_len, 0, 1, 25, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* X..70,couponcode */
|
||||||
|
static int x__70_couponcode(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 1 && data_len <= 70
|
||||||
|
&& couponcode(data, data_len, 0, 1, 70, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& cset82(data, data_len, 0, 1, 70, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& couponcode(data, data_len, 0, 1, 70, p_err_no, p_err_posn, err_msg, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* X..70,couponposoffer */
|
||||||
|
static int x__70_couponposoffer(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 1 && data_len <= 70
|
||||||
|
&& couponposoffer(data, data_len, 0, 1, 70, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& cset82(data, data_len, 0, 1, 70, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& couponposoffer(data, data_len, 0, 1, 70, p_err_no, p_err_posn, err_msg, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* X..70 */
|
||||||
|
static int x__70(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 1 && data_len <= 70
|
||||||
|
&& cset82(data, data_len, 0, 1, 70, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* X..90 */
|
||||||
|
static int x__90(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 1 && data_len <= 90
|
||||||
|
&& cset82(data, data_len, 0, 1, 90, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Entry point. Returns 1 on success, 0 on failure: `*p_err_no` set to 1 if unknown AI, 2 if bad data length */
|
||||||
|
static int gs1_lint(const int ai, const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn,
|
||||||
|
char err_msg[50]) {
|
||||||
|
|
||||||
|
/* Assume data length failure */
|
||||||
|
*p_err_no = 2;
|
||||||
|
|
||||||
|
if (ai < 100) {
|
||||||
|
|
||||||
|
if (ai == 0) {
|
||||||
|
return n18_csum_key(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 1 || ai == 2) {
|
||||||
|
return n14_csum_key(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 10 || ai == 21 || ai == 22) {
|
||||||
|
return x__20(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai >= 11 && ai <= 17) {
|
||||||
|
return n6_yymmd0(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 20) {
|
||||||
|
return n2(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 30 || ai == 37) {
|
||||||
|
return n__8(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 90) {
|
||||||
|
return x__30(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai >= 91) {
|
||||||
|
return x__90(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (ai < 300) {
|
||||||
|
|
||||||
|
if (ai == 235) {
|
||||||
|
return x__28(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 240 || ai == 241 || ai == 250 || ai == 251) {
|
||||||
|
return x__30(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 242) {
|
||||||
|
return n__6(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 243 || ai == 254) {
|
||||||
|
return x__20(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 253) {
|
||||||
|
return n13_csum_key_x0__17(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 255) {
|
||||||
|
return n13_csum_key_n0__12(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (ai < 500) {
|
||||||
|
|
||||||
|
if (ai == 400 || ai == 403) {
|
||||||
|
return x__30(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 401) {
|
||||||
|
return x__30_key(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 402) {
|
||||||
|
return n17_csum_key(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai >= 410 && ai <= 417) {
|
||||||
|
return n13_csum_key(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 420) {
|
||||||
|
return x__20(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 421) {
|
||||||
|
return n3_iso3166_x__9(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 422 || ai == 424 || ai == 426) {
|
||||||
|
return n3_iso3166(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 423 || ai == 425) {
|
||||||
|
return n__15_iso3166list(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 427) {
|
||||||
|
return x__3(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (ai < 800) {
|
||||||
|
|
||||||
|
if (ai >= 710 && ai <= 714) {
|
||||||
|
return x__20(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (ai < 3200) {
|
||||||
|
|
||||||
|
if ((ai >= 3100 && ai <= 3105) || (ai >= 3110 && ai <= 3115) || (ai >= 3120 && ai <= 3125)
|
||||||
|
|| (ai >= 3130 && ai <= 3135) || (ai >= 3140 && ai <= 3145) || (ai >= 3150 && ai <= 3155)
|
||||||
|
|| (ai >= 3160 && ai <= 3165)) {
|
||||||
|
return n6(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (ai < 3300) {
|
||||||
|
|
||||||
|
if (ai <= 3205 || (ai >= 3210 && ai <= 3215) || (ai >= 3220 && ai <= 3225) || (ai >= 3230 && ai <= 3235)
|
||||||
|
|| (ai >= 3240 && ai <= 3245) || (ai >= 3250 && ai <= 3255) || (ai >= 3260 && ai <= 3265)
|
||||||
|
|| (ai >= 3270 && ai <= 3275) || (ai >= 3280 && ai <= 3285) || (ai >= 3290 && ai <= 3295)) {
|
||||||
|
return n6(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (ai < 3400) {
|
||||||
|
|
||||||
|
if (ai <= 3305 || (ai >= 3310 && ai <= 3315) || (ai >= 3320 && ai <= 3325) || (ai >= 3330 && ai <= 3335)
|
||||||
|
|| (ai >= 3340 && ai <= 3345) || (ai >= 3350 && ai <= 3355) || (ai >= 3360 && ai <= 3365)
|
||||||
|
|| (ai >= 3370 && ai <= 3375)) {
|
||||||
|
return n6(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (ai < 3500) {
|
||||||
|
|
||||||
|
if (ai <= 3405 || (ai >= 3410 && ai <= 3415) || (ai >= 3420 && ai <= 3425) || (ai >= 3430 && ai <= 3435)
|
||||||
|
|| (ai >= 3440 && ai <= 3445) || (ai >= 3450 && ai <= 3455) || (ai >= 3460 && ai <= 3465)
|
||||||
|
|| (ai >= 3470 && ai <= 3475) || (ai >= 3480 && ai <= 3485) || (ai >= 3490 && ai <= 3495)) {
|
||||||
|
return n6(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (ai < 3600) {
|
||||||
|
|
||||||
|
if (ai <= 3505 || (ai >= 3510 && ai <= 3515) || (ai >= 3520 && ai <= 3525) || (ai >= 3530 && ai <= 3535)
|
||||||
|
|| (ai >= 3540 && ai <= 3545) || (ai >= 3550 && ai <= 3555) || (ai >= 3560 && ai <= 3565)
|
||||||
|
|| (ai >= 3570 && ai <= 3575)) {
|
||||||
|
return n6(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (ai < 3700) {
|
||||||
|
|
||||||
|
if (ai <= 3605 || (ai >= 3610 && ai <= 3615) || (ai >= 3620 && ai <= 3625) || (ai >= 3630 && ai <= 3635)
|
||||||
|
|| (ai >= 3640 && ai <= 3645) || (ai >= 3650 && ai <= 3655) || (ai >= 3660 && ai <= 3665)
|
||||||
|
|| (ai >= 3670 && ai <= 3675) || (ai >= 3680 && ai <= 3685) || (ai >= 3690 && ai <= 3695)) {
|
||||||
|
return n6(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (ai < 4000) {
|
||||||
|
|
||||||
|
if ((ai >= 3900 && ai <= 3909) || (ai >= 3920 && ai <= 3929)) {
|
||||||
|
return n__15(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if ((ai >= 3910 && ai <= 3919) || (ai >= 3930 && ai <= 3939)) {
|
||||||
|
return n3_iso4217_n__15(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai >= 3940 && ai <= 3943) {
|
||||||
|
return n4(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai >= 3950 && ai <= 3955) {
|
||||||
|
return n6(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (ai < 4400) {
|
||||||
|
|
||||||
|
if (ai == 4300 || ai == 4301 || ai == 4310 || ai == 4311 || ai == 4320) {
|
||||||
|
return x__35_pcenc(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if ((ai >= 4302 && ai <= 4306) || (ai >= 4312 && ai <= 4316)) {
|
||||||
|
return x__70_pcenc(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 4307 || ai == 4317) {
|
||||||
|
return x2_iso3166alpha2(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 4308) {
|
||||||
|
return x__30_pcenc(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 4318) {
|
||||||
|
return x__20(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 4319) {
|
||||||
|
return x__30(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai >= 4321 && ai <= 4323) {
|
||||||
|
return n1_yesno(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 4324 || ai == 4325) {
|
||||||
|
return n6_yymmd0_n4_hhmm(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 4326) {
|
||||||
|
return n6_yymmdd(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (ai < 7100) {
|
||||||
|
|
||||||
|
if (ai == 7001) {
|
||||||
|
return n13(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 7002) {
|
||||||
|
return x__30(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 7003) {
|
||||||
|
return n6_yymmdd_n4_hhmm(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 7004) {
|
||||||
|
return n__4(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 7005) {
|
||||||
|
return x__12(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 7006) {
|
||||||
|
return n6_yymmdd(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 7007) {
|
||||||
|
return n6_yymmdd_n0__6_yymmdd(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 7008) {
|
||||||
|
return x__3(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 7009) {
|
||||||
|
return x__10(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 7010) {
|
||||||
|
return x__2(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai >= 7020 && ai <= 7022) {
|
||||||
|
return x__20(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 7023) {
|
||||||
|
return x__30_key(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai >= 7030 && ai <= 7039) {
|
||||||
|
return n3_iso3166999_x__27(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 7040) {
|
||||||
|
return n1_x1_x1_x1_importeridx(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (ai < 7300) {
|
||||||
|
|
||||||
|
if (ai >= 7230 && ai <= 7239) {
|
||||||
|
return x2_x__28(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 7240) {
|
||||||
|
return x__20(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (ai < 8100) {
|
||||||
|
|
||||||
|
if (ai == 8001) {
|
||||||
|
return n4_nonzero_n5_nonzero_n3_nonzero_n1_winding_n1(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 8002 || ai == 8012) {
|
||||||
|
return x__20(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 8003) {
|
||||||
|
return n1_zero_n13_csum_key_x0__16(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 8004 || ai == 8013) {
|
||||||
|
return x__30_key(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 8005) {
|
||||||
|
return n6(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 8006 || ai == 8026) {
|
||||||
|
return n14_csum_n4_pieceoftotal(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 8007) {
|
||||||
|
return x__34_iban(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 8008) {
|
||||||
|
return n8_yymmddhh_n0__4_mmoptss(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 8009) {
|
||||||
|
return x__50(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 8010) {
|
||||||
|
return c__30_key(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 8011) {
|
||||||
|
return n__12_nozeroprefix(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 8017 || ai == 8018) {
|
||||||
|
return n18_csum(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 8019) {
|
||||||
|
return n__10(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 8020) {
|
||||||
|
return x__25(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (ai < 8200) {
|
||||||
|
|
||||||
|
if (ai == 8110) {
|
||||||
|
return x__70_couponcode(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 8111) {
|
||||||
|
return n4(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 8112) {
|
||||||
|
return x__70_couponposoffer(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (ai < 8300) {
|
||||||
|
|
||||||
|
if (ai == 8200) {
|
||||||
|
return x__70(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Unknown AI */
|
||||||
|
*p_err_no = 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* GS1_LINT_H */
|
88
backend/iso3166.h
Normal file
88
backend/iso3166.h
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
/*
|
||||||
|
* ISO 3166 country codes generated by "backend/tools/gen_iso3166_h.php"
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
libzint - the open source barcode library
|
||||||
|
Copyright (C) 2021 Robin Stuart <rstuart114@gmail.com>
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions
|
||||||
|
are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
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
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
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
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ISO3166_H
|
||||||
|
#define ISO3166_H
|
||||||
|
|
||||||
|
/* Whether ISO 3166-1 numeric */
|
||||||
|
static int iso3166_numeric(int cc) {
|
||||||
|
static const unsigned char codes[112] = {
|
||||||
|
0x10, 0x15, 0x11, 0x91, 0x11, 0x11, 0x1D, 0x11,
|
||||||
|
0x51, 0x15, 0x50, 0x14, 0x11, 0x11, 0x11, 0x11,
|
||||||
|
0x10, 0x11, 0x11, 0x51, 0x44, 0xC4, 0x14, 0x91,
|
||||||
|
0x11, 0x18, 0x51, 0x44, 0x84, 0xC7, 0x44, 0x45,
|
||||||
|
0x54, 0x54, 0x18, 0x00, 0x11, 0x11, 0x11, 0x11,
|
||||||
|
0x11, 0x51, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
|
||||||
|
0x11, 0x41, 0x11, 0x45, 0x46, 0x54, 0x44, 0x45,
|
||||||
|
0x44, 0x44, 0x44, 0x44, 0x11, 0x10, 0x1D, 0x11,
|
||||||
|
0x11, 0x11, 0xE9, 0x10, 0x10, 0x44, 0x44, 0x44,
|
||||||
|
0xB4, 0x87, 0x40, 0x11, 0x11, 0x11, 0x45, 0x44,
|
||||||
|
0x4C, 0x50, 0xD8, 0x44, 0x44, 0x44, 0x45, 0xC0,
|
||||||
|
0x47, 0x10, 0x10, 0x13, 0x10, 0x11, 0x11, 0x15,
|
||||||
|
0x11, 0x11, 0x11, 0x59, 0x91, 0x00, 0x04, 0x84,
|
||||||
|
0x07, 0x01, 0x44, 0x54, 0x00, 0x10, 0x84, 0x40,
|
||||||
|
};
|
||||||
|
int b = cc >> 3;
|
||||||
|
|
||||||
|
if (b < 0 || b >= 112) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return codes[b] & (1 << (cc & 0x7)) ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Whether ISO 3166-1 alpha2 */
|
||||||
|
static int iso3166_alpha2(const char *cc) {
|
||||||
|
static const unsigned char codes[85] = {
|
||||||
|
0x78, 0x59, 0xDF, 0xEE, 0xEF, 0xBD, 0xDD, 0xDE,
|
||||||
|
0x27, 0x3F, 0x84, 0x15, 0x80, 0xD4, 0x00, 0x0E,
|
||||||
|
0x00, 0x5C, 0x09, 0xB0, 0x9F, 0xFB, 0x15, 0x00,
|
||||||
|
0x8D, 0x06, 0x18, 0x78, 0x0F, 0x40, 0x40, 0x03,
|
||||||
|
0x00, 0x1D, 0x2B, 0xF4, 0x41, 0x81, 0x4F, 0xFD,
|
||||||
|
0xFC, 0xFF, 0xD7, 0x25, 0x4B, 0x08, 0x00, 0x01,
|
||||||
|
0x40, 0x3C, 0x8F, 0x53, 0x01, 0x00, 0x00, 0x40,
|
||||||
|
0x00, 0x51, 0xF1, 0xFD, 0xE7, 0x3A, 0xBB, 0x9F,
|
||||||
|
0x9A, 0x41, 0x10, 0x04, 0x57, 0x85, 0x40, 0x00,
|
||||||
|
0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
|
||||||
|
0x08, 0x04, 0x40, 0x00, 0x01,
|
||||||
|
};
|
||||||
|
int cc_int;
|
||||||
|
|
||||||
|
if (cc[0] < 'A' || cc[0] > 'Z' || cc[1] < 'A' || cc[1] > 'Z') {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
cc_int = (cc[0] - 'A') * 26 + (cc[1] - 'A');
|
||||||
|
|
||||||
|
return codes[cc_int >> 3] & (1 << (cc_int & 0x7)) ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* ISO3166_H */
|
65
backend/iso4217.h
Normal file
65
backend/iso4217.h
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
* ISO 4217 currency codes generated by "backend/tools/gen_iso4217_h.php"
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
libzint - the open source barcode library
|
||||||
|
Copyright (C) 2021 Robin Stuart <rstuart114@gmail.com>
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions
|
||||||
|
are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
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
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
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
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ISO4217_H
|
||||||
|
#define ISO4217_H
|
||||||
|
|
||||||
|
/* Whether ISO 4217-1 numeric */
|
||||||
|
static int iso4217_numeric(int cc) {
|
||||||
|
static const unsigned char codes[125] = {
|
||||||
|
0x00, 0x11, 0x00, 0x00, 0x11, 0x10, 0x1D, 0x10,
|
||||||
|
0x11, 0x01, 0x10, 0x04, 0x01, 0x11, 0x10, 0x10,
|
||||||
|
0x10, 0x01, 0x01, 0x11, 0x00, 0x44, 0x00, 0x90,
|
||||||
|
0x01, 0x08, 0x41, 0x40, 0x40, 0x41, 0x04, 0x00,
|
||||||
|
0x40, 0x40, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
|
||||||
|
0x11, 0x11, 0x10, 0x11, 0x11, 0x11, 0x01, 0x01,
|
||||||
|
0x10, 0x41, 0x11, 0x45, 0x46, 0x44, 0x04, 0x40,
|
||||||
|
0x40, 0x44, 0x00, 0x00, 0x11, 0x00, 0x05, 0x01,
|
||||||
|
0x11, 0x10, 0x30, 0x00, 0x10, 0x44, 0x40, 0x00,
|
||||||
|
0x04, 0x44, 0x40, 0x11, 0x01, 0x00, 0x00, 0x04,
|
||||||
|
0x48, 0x40, 0x00, 0x00, 0x00, 0x04, 0x44, 0x40,
|
||||||
|
0x45, 0x00, 0x00, 0x01, 0x00, 0x10, 0x11, 0x11,
|
||||||
|
0x00, 0x11, 0x11, 0x00, 0x81, 0x00, 0x04, 0x04,
|
||||||
|
0x04, 0x01, 0x00, 0x14, 0x00, 0x00, 0x44, 0x00,
|
||||||
|
0x20, 0x00, 0x00, 0x80, 0x7F, 0xB5, 0xFD, 0xFB,
|
||||||
|
0xBF, 0xBF, 0x3F, 0x47, 0xA4,
|
||||||
|
};
|
||||||
|
int b = cc >> 3;
|
||||||
|
|
||||||
|
if (b < 0 || b >= 125) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return codes[b] & (1 << (cc & 0x7)) ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* ISO4217_H */
|
@ -1300,7 +1300,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source, int
|
|||||||
unsigned char *reduced = (unsigned char *) _alloca(in_length + 1);
|
unsigned char *reduced = (unsigned char *) _alloca(in_length + 1);
|
||||||
#endif
|
#endif
|
||||||
error_number = gs1_verify(symbol, local_source, in_length, reduced);
|
error_number = gs1_verify(symbol, local_source, in_length, reduced);
|
||||||
if (error_number != 0) {
|
if (error_number >= ZINT_ERROR) {
|
||||||
const char in_2d_comp[] = " in 2D component";
|
const char in_2d_comp[] = " in 2D component";
|
||||||
if (is_composite(symbol->symbology) && strlen(symbol->errtxt) < 100 - strlen(in_2d_comp)) {
|
if (is_composite(symbol->symbology) && strlen(symbol->errtxt) < 100 - strlen(in_2d_comp)) {
|
||||||
strcat(symbol->errtxt, in_2d_comp);
|
strcat(symbol->errtxt, in_2d_comp);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
libzint - the open source barcode library
|
libzint - the open source barcode library
|
||||||
Copyright (C) 2008-2020 Robin Stuart <rstuart114@gmail.com>
|
Copyright (C) 2008-2021 Robin Stuart <rstuart114@gmail.com>
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
@ -1191,6 +1191,7 @@ static void rssexp_separator(struct zint_symbol *symbol, int width, const int co
|
|||||||
|
|
||||||
/* GS1 DataBar Expanded */
|
/* GS1 DataBar Expanded */
|
||||||
INTERNAL int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
INTERNAL int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
||||||
|
int error_number;
|
||||||
int i, j, k, p, codeblocks, data_chars, vs, group, v_odd, v_even;
|
int i, j, k, p, codeblocks, data_chars, vs, group, v_odd, v_even;
|
||||||
int latch;
|
int latch;
|
||||||
int char_widths[21][8], checksum, check_widths[8], c_group;
|
int char_widths[21][8], checksum, check_widths[8], c_group;
|
||||||
@ -1210,9 +1211,9 @@ INTERNAL int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int
|
|||||||
|
|
||||||
separator_row = 0;
|
separator_row = 0;
|
||||||
|
|
||||||
i = gs1_verify(symbol, source, src_len, reduced);
|
error_number = gs1_verify(symbol, source, src_len, reduced);
|
||||||
if (i != 0) {
|
if (error_number >= ZINT_ERROR) {
|
||||||
return i;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (symbol->debug & ZINT_DEBUG_PRINT) {
|
if (symbol->debug & ZINT_DEBUG_PRINT) {
|
||||||
@ -1527,5 +1528,5 @@ INTERNAL int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
@ -102,6 +102,8 @@ zint_add_test(gridmtx, test_gridmtx)
|
|||||||
zint_add_test(gs1, test_gs1)
|
zint_add_test(gs1, test_gs1)
|
||||||
zint_add_test(hanxin, test_hanxin)
|
zint_add_test(hanxin, test_hanxin)
|
||||||
zint_add_test(imail, test_imail)
|
zint_add_test(imail, test_imail)
|
||||||
|
zint_add_test(iso3166, test_iso3166)
|
||||||
|
zint_add_test(iso4217, test_iso4217)
|
||||||
zint_add_test(ksx1001, test_ksx1001)
|
zint_add_test(ksx1001, test_ksx1001)
|
||||||
zint_add_test(large, test_large)
|
zint_add_test(large, test_large)
|
||||||
zint_add_test(library, test_library)
|
zint_add_test(library, test_library)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
libzint - the open source barcode library
|
libzint - the open source barcode library
|
||||||
Copyright (C) 2020 Robin Stuart <rstuart114@gmail.com>
|
Copyright (C) 2020 - 2021 Robin Stuart <rstuart114@gmail.com>
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
@ -228,8 +228,8 @@ static void test_reader_init(int index, int generate, int debug) {
|
|||||||
/* 1*/ { BARCODE_CODE128, UNICODE_MODE, READER_INIT, "12", 0, 1, 68, "(6) 104 96 99 12 22 106", "StartB FNC3 CodeC 12" },
|
/* 1*/ { BARCODE_CODE128, UNICODE_MODE, READER_INIT, "12", 0, 1, 68, "(6) 104 96 99 12 22 106", "StartB FNC3 CodeC 12" },
|
||||||
/* 2*/ { BARCODE_CODE128B, UNICODE_MODE, READER_INIT, "\0371234", 0, 1, 101, "(9) 103 96 95 17 18 19 20 6 106", "StartA FNC3 US 1 2 3 4" },
|
/* 2*/ { BARCODE_CODE128B, UNICODE_MODE, READER_INIT, "\0371234", 0, 1, 101, "(9) 103 96 95 17 18 19 20 6 106", "StartA FNC3 US 1 2 3 4" },
|
||||||
/* 3*/ { BARCODE_GS1_128, GS1_MODE, READER_INIT, "[90]12", 0, 1, 68, "(6) 105 102 90 12 11 106", "StartC FNC1 90 12 (Reader Initialise not supported by GS1 barcodes (use CODE128))" },
|
/* 3*/ { BARCODE_GS1_128, GS1_MODE, READER_INIT, "[90]12", 0, 1, 68, "(6) 105 102 90 12 11 106", "StartC FNC1 90 12 (Reader Initialise not supported by GS1 barcodes (use CODE128))" },
|
||||||
/* 4*/ { BARCODE_EAN14, GS1_MODE, READER_INIT, "12", 0, 1, 134, "(12) 105 102 1 0 0 0 0 0 1 25 30 106", "StartC FNC1 01 00 (5) 01 (Reader Initialise not supported by GS1 barcodes (use CODE128))" },
|
/* 4*/ { BARCODE_EAN14, GS1_MODE, READER_INIT, "12", ZINT_WARN_NONCOMPLIANT, 1, 134, "Warning (12) 105 102 1 0 0 0 0 0 1 25 30 106", "StartC FNC1 01 00 (5) 01 (Reader Initialise not supported by GS1 barcodes (use CODE128))" },
|
||||||
/* 5*/ { BARCODE_NVE18, GS1_MODE, READER_INIT, "12", 0, 1, 156, "(14) 105 102 0 0 0 0 0 0 0 0 1 25 80 106", "StartC FNC1 00 (8) 01 (Reader Initialise not supported by GS1 barcodes (use CODE128))" },
|
/* 5*/ { BARCODE_NVE18, GS1_MODE, READER_INIT, "12", ZINT_WARN_NONCOMPLIANT, 1, 156, "Warning (14) 105 102 0 0 0 0 0 0 0 0 1 25 80 106", "StartC FNC1 00 (8) 01 (Reader Initialise not supported by GS1 barcodes (use CODE128))" },
|
||||||
/* 6*/ { BARCODE_HIBC_128, UNICODE_MODE, READER_INIT, "A", 0, 1, 79, "(7) 104 96 11 33 24 5 106", "StartA FNC3 + A 8 (check) (Not sensible, use CODE128)" },
|
/* 6*/ { BARCODE_HIBC_128, UNICODE_MODE, READER_INIT, "A", 0, 1, 79, "(7) 104 96 11 33 24 5 106", "StartA FNC3 + A 8 (check) (Not sensible, use CODE128)" },
|
||||||
};
|
};
|
||||||
int data_size = ARRAY_SIZE(data);
|
int data_size = ARRAY_SIZE(data);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
libzint - the open source barcode library
|
libzint - the open source barcode library
|
||||||
Copyright (C) 2019 - 2020 Robin Stuart <rstuart114@gmail.com>
|
Copyright (C) 2019 - 2021 Robin Stuart <rstuart114@gmail.com>
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
@ -1608,8 +1608,8 @@ static void test_ean128_cc_width(int index, int generate, int debug) {
|
|||||||
/* 8*/ { "[91]123A1234A", "[02]13012345678909", 0, 5, 174, "" },
|
/* 8*/ { "[91]123A1234A", "[02]13012345678909", 0, 5, 174, "" },
|
||||||
/* 9*/ { "[91]123A1234A1", "[02]13012345678909", 0, 5, 188, "" },
|
/* 9*/ { "[91]123A1234A1", "[02]13012345678909", 0, 5, 188, "" },
|
||||||
/*10*/ { "[91]123A1234A12", "[02]13012345678909", 0, 5, 205, "" },
|
/*10*/ { "[91]123A1234A12", "[02]13012345678909", 0, 5, 205, "" },
|
||||||
/*11*/ { "[00]123456789012345678", "[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[91]1234567890", 0, 32, 579, "With composite 2372 digits == max" },
|
/*11*/ { "[00]123456789012345675", "[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345678[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[91]1234567890", 0, 32, 579, "With composite 2372 digits == max" },
|
||||||
/*12*/ { "[00]123456789012345678", "[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[00]123456789012345678[91]12345678901", ZINT_ERROR_TOO_LONG, 0, 0, "With composite 2373 digits > max" },
|
/*12*/ { "[00]123456789012345675", "[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[91]12345678901", ZINT_ERROR_TOO_LONG, 0, 0, "With composite 2373 digits > max" },
|
||||||
};
|
};
|
||||||
int data_size = sizeof(data) / sizeof(struct item);
|
int data_size = sizeof(data) / sizeof(struct item);
|
||||||
|
|
||||||
@ -2574,12 +2574,13 @@ static void test_encodation_11(int index, int generate, int debug) {
|
|||||||
"0001000000000000000000000000000000000000000000000000010"
|
"0001000000000000000000000000000000000000000000000000010"
|
||||||
"0001010010011011110101000110111001000010100100010101010"
|
"0001010010011011110101000110111001000010100100010101010"
|
||||||
},
|
},
|
||||||
/*26*/ { BARCODE_UPCE_CC, 1, "1234567", "[90]AB[8004]1[10]12", 0, 9, 55, "Mode '11', alpha [90], with [8004], other data",
|
/*26*/ { BARCODE_UPCE_CC, 1, "1234567", "[90]AB[8004]12[10]12", 0, 10, 55, "Mode '11', alpha [90], with [8004], other data",
|
||||||
"1101100110100111110011001001100101111110010011110101001"
|
"1100100010110000110000101001101111011101000011100101101"
|
||||||
"1101101110101000100000100001101100011100111011100101001"
|
"1110100010110100011110001101001110001011111011000101101"
|
||||||
"1101101100100010011111011001100110011110001011101101001"
|
"1110110010100011100110111001011101101110000011000101001"
|
||||||
"1101101000110101100111111001000011001000111011101001001"
|
"1100110010100000100010001001010000010000100011001101001"
|
||||||
"1101001000100010000010100001101001111011111011101001101"
|
"1101110010111010000110000101101011100010000011011101001"
|
||||||
|
"1101111010110011110010001101000111101100110011011001001"
|
||||||
"0001000000000000000000000000000000000000000000000000010"
|
"0001000000000000000000000000000000000000000000000000010"
|
||||||
"0010000000000000000000000000000000000000000000000000001"
|
"0010000000000000000000000000000000000000000000000000001"
|
||||||
"0001000000000000000000000000000000000000000000000000010"
|
"0001000000000000000000000000000000000000000000000000010"
|
||||||
|
File diff suppressed because it is too large
Load Diff
776
backend/tests/test_iso3166.c
Normal file
776
backend/tests/test_iso3166.c
Normal file
@ -0,0 +1,776 @@
|
|||||||
|
/*
|
||||||
|
libzint - the open source barcode library
|
||||||
|
Copyright (C) 2021 Robin Stuart <rstuart114@gmail.com>
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions
|
||||||
|
are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
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
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
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
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
/* vim: set ts=4 sw=4 et : */
|
||||||
|
|
||||||
|
#include "testcommon.h"
|
||||||
|
#include "../iso3166.h"
|
||||||
|
|
||||||
|
static void test_numeric(int index) {
|
||||||
|
|
||||||
|
testStart("");
|
||||||
|
|
||||||
|
int ret;
|
||||||
|
struct item {
|
||||||
|
int data;
|
||||||
|
int ret;
|
||||||
|
};
|
||||||
|
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
|
||||||
|
struct item data[] = {
|
||||||
|
/* 0*/ { -1, 0 },
|
||||||
|
/* 1*/ { 0, 0 },
|
||||||
|
/* 2*/ { 1, 0 },
|
||||||
|
/* 3*/ { 2, 0 },
|
||||||
|
/* 4*/ { 3, 0 },
|
||||||
|
/* 5*/ { 4, 1 },
|
||||||
|
/* 6*/ { 5, 0 },
|
||||||
|
/* 7*/ { 6, 0 },
|
||||||
|
/* 8*/ { 7, 0 },
|
||||||
|
/* 9*/ { 8, 1 },
|
||||||
|
/* 10*/ { 9, 0 },
|
||||||
|
/* 11*/ { 10, 1 },
|
||||||
|
/* 12*/ { 11, 0 },
|
||||||
|
/* 13*/ { 12, 1 },
|
||||||
|
/* 14*/ { 13, 0 },
|
||||||
|
/* 15*/ { 14, 0 },
|
||||||
|
/* 16*/ { 15, 0 },
|
||||||
|
/* 17*/ { 16, 1 },
|
||||||
|
/* 18*/ { 17, 0 },
|
||||||
|
/* 19*/ { 18, 0 },
|
||||||
|
/* 20*/ { 19, 0 },
|
||||||
|
/* 21*/ { 20, 1 },
|
||||||
|
/* 22*/ { 21, 0 },
|
||||||
|
/* 23*/ { 22, 0 },
|
||||||
|
/* 24*/ { 23, 0 },
|
||||||
|
/* 25*/ { 24, 1 },
|
||||||
|
/* 26*/ { 25, 0 },
|
||||||
|
/* 27*/ { 26, 0 },
|
||||||
|
/* 28*/ { 27, 0 },
|
||||||
|
/* 29*/ { 28, 1 },
|
||||||
|
/* 30*/ { 29, 0 },
|
||||||
|
/* 31*/ { 30, 0 },
|
||||||
|
/* 32*/ { 31, 1 },
|
||||||
|
/* 33*/ { 32, 1 },
|
||||||
|
/* 34*/ { 33, 0 },
|
||||||
|
/* 35*/ { 34, 0 },
|
||||||
|
/* 36*/ { 35, 0 },
|
||||||
|
/* 37*/ { 36, 1 },
|
||||||
|
/* 38*/ { 37, 0 },
|
||||||
|
/* 39*/ { 38, 0 },
|
||||||
|
/* 40*/ { 39, 0 },
|
||||||
|
/* 41*/ { 40, 1 },
|
||||||
|
/* 42*/ { 41, 0 },
|
||||||
|
/* 43*/ { 47, 0 },
|
||||||
|
/* 44*/ { 48, 1 },
|
||||||
|
/* 45*/ { 49, 0 },
|
||||||
|
/* 46*/ { 50, 1 },
|
||||||
|
/* 47*/ { 51, 1 },
|
||||||
|
/* 48*/ { 52, 1 },
|
||||||
|
/* 49*/ { 53, 0 },
|
||||||
|
/* 50*/ { 67, 0 },
|
||||||
|
/* 51*/ { 68, 1 },
|
||||||
|
/* 52*/ { 69, 0 },
|
||||||
|
/* 53*/ { 70, 1 },
|
||||||
|
/* 54*/ { 71, 0 },
|
||||||
|
/* 55*/ { 72, 1 },
|
||||||
|
/* 56*/ { 73, 0 },
|
||||||
|
/* 57*/ { 74, 1 },
|
||||||
|
/* 58*/ { 75, 0 },
|
||||||
|
/* 59*/ { 76, 1 },
|
||||||
|
/* 60*/ { 77, 0 },
|
||||||
|
/* 61*/ { 83, 0 },
|
||||||
|
/* 62*/ { 84, 1 },
|
||||||
|
/* 63*/ { 85, 0 },
|
||||||
|
/* 64*/ { 86, 1 },
|
||||||
|
/* 65*/ { 87, 0 },
|
||||||
|
/* 66*/ { 99, 0 },
|
||||||
|
/* 67*/ { 100, 1 },
|
||||||
|
/* 68*/ { 101, 0 },
|
||||||
|
/* 69*/ { 110, 0 },
|
||||||
|
/* 70*/ { 119, 0 },
|
||||||
|
/* 71*/ { 120, 1 },
|
||||||
|
/* 72*/ { 121, 0 },
|
||||||
|
/* 73*/ { 130, 0 },
|
||||||
|
/* 74*/ { 131, 0 },
|
||||||
|
/* 75*/ { 132, 1 },
|
||||||
|
/* 76*/ { 133, 0 },
|
||||||
|
/* 77*/ { 147, 0 },
|
||||||
|
/* 78*/ { 148, 1 },
|
||||||
|
/* 79*/ { 149, 0 },
|
||||||
|
/* 80*/ { 150, 0 },
|
||||||
|
/* 81*/ { 151, 0 },
|
||||||
|
/* 82*/ { 152, 1 },
|
||||||
|
/* 83*/ { 153, 0 },
|
||||||
|
/* 84*/ { 154, 0 },
|
||||||
|
/* 85*/ { 155, 0 },
|
||||||
|
/* 86*/ { 156, 1 },
|
||||||
|
/* 87*/ { 157, 0 },
|
||||||
|
/* 88*/ { 158, 1 },
|
||||||
|
/* 89*/ { 159, 0 },
|
||||||
|
/* 90*/ { 160, 0 },
|
||||||
|
/* 91*/ { 161, 0 },
|
||||||
|
/* 92*/ { 162, 1 },
|
||||||
|
/* 93*/ { 163, 0 },
|
||||||
|
/* 94*/ { 169, 0 },
|
||||||
|
/* 95*/ { 170, 1 },
|
||||||
|
/* 96*/ { 171, 0 },
|
||||||
|
/* 97*/ { 177, 0 },
|
||||||
|
/* 98*/ { 178, 1 },
|
||||||
|
/* 99*/ { 179, 0 },
|
||||||
|
/*100*/ { 180, 1 },
|
||||||
|
/*101*/ { 181, 0 },
|
||||||
|
/*102*/ { 190, 0 },
|
||||||
|
/*103*/ { 191, 1 },
|
||||||
|
/*104*/ { 192, 1 },
|
||||||
|
/*105*/ { 193, 0 },
|
||||||
|
/*106*/ { 200, 0 },
|
||||||
|
/*107*/ { 210, 0 },
|
||||||
|
/*108*/ { 220, 0 },
|
||||||
|
/*109*/ { 230, 0 },
|
||||||
|
/*110*/ { 231, 1 },
|
||||||
|
/*111*/ { 232, 1 },
|
||||||
|
/*112*/ { 233, 1 },
|
||||||
|
/*113*/ { 234, 1 },
|
||||||
|
/*114*/ { 235, 0 },
|
||||||
|
/*115*/ { 236, 0 },
|
||||||
|
/*116*/ { 237, 0 },
|
||||||
|
/*117*/ { 238, 1 },
|
||||||
|
/*118*/ { 239, 1 },
|
||||||
|
/*119*/ { 240, 0 },
|
||||||
|
/*120*/ { 241, 0 },
|
||||||
|
/*121*/ { 242, 1 },
|
||||||
|
/*122*/ { 243, 0 },
|
||||||
|
/*123*/ { 244, 0 },
|
||||||
|
/*124*/ { 245, 0 },
|
||||||
|
/*125*/ { 246, 1 },
|
||||||
|
/*126*/ { 247, 0 },
|
||||||
|
/*127*/ { 248, 1 },
|
||||||
|
/*128*/ { 249, 0 },
|
||||||
|
/*129*/ { 250, 1 },
|
||||||
|
/*130*/ { 251, 0 },
|
||||||
|
/*131*/ { 259, 0 },
|
||||||
|
/*132*/ { 260, 1 },
|
||||||
|
/*133*/ { 261, 0 },
|
||||||
|
/*134*/ { 269, 0 },
|
||||||
|
/*135*/ { 270, 1 },
|
||||||
|
/*136*/ { 271, 0 },
|
||||||
|
/*137*/ { 280, 0 },
|
||||||
|
/*138*/ { 287, 0 },
|
||||||
|
/*139*/ { 288, 1 },
|
||||||
|
/*140*/ { 289, 0 },
|
||||||
|
/*141*/ { 290, 0 },
|
||||||
|
/*142*/ { 291, 0 },
|
||||||
|
/*143*/ { 292, 1 },
|
||||||
|
/*144*/ { 293, 0 },
|
||||||
|
/*145*/ { 299, 0 },
|
||||||
|
/*146*/ { 300, 1 },
|
||||||
|
/*147*/ { 301, 0 },
|
||||||
|
/*148*/ { 310, 0 },
|
||||||
|
/*149*/ { 319, 0 },
|
||||||
|
/*150*/ { 320, 1 },
|
||||||
|
/*151*/ { 321, 0 },
|
||||||
|
/*152*/ { 322, 0 },
|
||||||
|
/*153*/ { 323, 0 },
|
||||||
|
/*154*/ { 324, 1 },
|
||||||
|
/*155*/ { 325, 0 },
|
||||||
|
/*156*/ { 330, 0 },
|
||||||
|
/*157*/ { 339, 0 },
|
||||||
|
/*158*/ { 340, 1 },
|
||||||
|
/*159*/ { 341, 0 },
|
||||||
|
/*160*/ { 350, 0 },
|
||||||
|
/*161*/ { 367, 0 },
|
||||||
|
/*162*/ { 368, 1 },
|
||||||
|
/*163*/ { 369, 0 },
|
||||||
|
/*164*/ { 370, 0 },
|
||||||
|
/*165*/ { 379, 0 },
|
||||||
|
/*166*/ { 380, 1 },
|
||||||
|
/*167*/ { 381, 0 },
|
||||||
|
/*168*/ { 397, 0 },
|
||||||
|
/*169*/ { 398, 1 },
|
||||||
|
/*170*/ { 399, 0 },
|
||||||
|
/*171*/ { 400, 1 },
|
||||||
|
/*172*/ { 401, 0 },
|
||||||
|
/*173*/ { 409, 0 },
|
||||||
|
/*174*/ { 410, 1 },
|
||||||
|
/*175*/ { 411, 0 },
|
||||||
|
/*176*/ { 426, 1 },
|
||||||
|
/*177*/ { 427, 0 },
|
||||||
|
/*178*/ { 428, 1 },
|
||||||
|
/*179*/ { 429, 0 },
|
||||||
|
/*180*/ { 430, 1 },
|
||||||
|
/*181*/ { 431, 0 },
|
||||||
|
/*182*/ { 432, 0 },
|
||||||
|
/*183*/ { 433, 0 },
|
||||||
|
/*184*/ { 434, 1 },
|
||||||
|
/*185*/ { 435, 0 },
|
||||||
|
/*186*/ { 436, 0 },
|
||||||
|
/*187*/ { 437, 0 },
|
||||||
|
/*188*/ { 438, 1 },
|
||||||
|
/*189*/ { 439, 0 },
|
||||||
|
/*190*/ { 440, 1 },
|
||||||
|
/*191*/ { 441, 0 },
|
||||||
|
/*192*/ { 442, 1 },
|
||||||
|
/*193*/ { 443, 0 },
|
||||||
|
/*194*/ { 449, 0 },
|
||||||
|
/*195*/ { 450, 1 },
|
||||||
|
/*196*/ { 451, 0 },
|
||||||
|
/*197*/ { 460, 0 },
|
||||||
|
/*198*/ { 469, 0 },
|
||||||
|
/*199*/ { 470, 1 },
|
||||||
|
/*200*/ { 471, 0 },
|
||||||
|
/*201*/ { 479, 0 },
|
||||||
|
/*202*/ { 480, 1 },
|
||||||
|
/*203*/ { 481, 0 },
|
||||||
|
/*204*/ { 490, 0 },
|
||||||
|
/*205*/ { 497, 0 },
|
||||||
|
/*206*/ { 498, 1 },
|
||||||
|
/*207*/ { 499, 1 },
|
||||||
|
/*208*/ { 500, 1 },
|
||||||
|
/*209*/ { 501, 0 },
|
||||||
|
/*210*/ { 502, 0 },
|
||||||
|
/*211*/ { 503, 0 },
|
||||||
|
/*212*/ { 504, 1 },
|
||||||
|
/*213*/ { 505, 0 },
|
||||||
|
/*214*/ { 510, 0 },
|
||||||
|
/*215*/ { 519, 0 },
|
||||||
|
/*216*/ { 520, 1 },
|
||||||
|
/*217*/ { 521, 0 },
|
||||||
|
/*218*/ { 530, 0 },
|
||||||
|
/*219*/ { 531, 1 },
|
||||||
|
/*220*/ { 532, 0 },
|
||||||
|
/*221*/ { 539, 0 },
|
||||||
|
/*222*/ { 540, 1 },
|
||||||
|
/*223*/ { 541, 0 },
|
||||||
|
/*224*/ { 550, 0 },
|
||||||
|
/*225*/ { 561, 0 },
|
||||||
|
/*226*/ { 562, 1 },
|
||||||
|
/*227*/ { 563, 0 },
|
||||||
|
/*228*/ { 564, 0 },
|
||||||
|
/*229*/ { 565, 0 },
|
||||||
|
/*230*/ { 566, 1 },
|
||||||
|
/*231*/ { 567, 0 },
|
||||||
|
/*232*/ { 568, 0 },
|
||||||
|
/*233*/ { 569, 0 },
|
||||||
|
/*234*/ { 570, 1 },
|
||||||
|
/*235*/ { 571, 0 },
|
||||||
|
/*236*/ { 579, 0 },
|
||||||
|
/*237*/ { 580, 1 },
|
||||||
|
/*238*/ { 581, 1 },
|
||||||
|
/*239*/ { 582, 0 },
|
||||||
|
/*240*/ { 590, 0 },
|
||||||
|
/*241*/ { 599, 0 },
|
||||||
|
/*242*/ { 600, 1 },
|
||||||
|
/*243*/ { 601, 0 },
|
||||||
|
/*244*/ { 611, 0 },
|
||||||
|
/*245*/ { 612, 1 },
|
||||||
|
/*246*/ { 613, 0 },
|
||||||
|
/*247*/ { 614, 0 },
|
||||||
|
/*248*/ { 615, 0 },
|
||||||
|
/*249*/ { 616, 1 },
|
||||||
|
/*250*/ { 617, 0 },
|
||||||
|
/*251*/ { 618, 0 },
|
||||||
|
/*252*/ { 619, 0 },
|
||||||
|
/*253*/ { 620, 1 },
|
||||||
|
/*254*/ { 621, 0 },
|
||||||
|
/*255*/ { 630, 1 },
|
||||||
|
/*256*/ { 640, 0 },
|
||||||
|
/*257*/ { 650, 0 },
|
||||||
|
/*258*/ { 658, 0 },
|
||||||
|
/*259*/ { 659, 1 },
|
||||||
|
/*260*/ { 660, 1 },
|
||||||
|
/*261*/ { 661, 0 },
|
||||||
|
/*262*/ { 677, 0 },
|
||||||
|
/*263*/ { 678, 1 },
|
||||||
|
/*264*/ { 679, 0 },
|
||||||
|
/*265*/ { 680, 0 },
|
||||||
|
/*266*/ { 690, 1 },
|
||||||
|
/*267*/ { 700, 0 },
|
||||||
|
/*268*/ { 701, 0 },
|
||||||
|
/*269*/ { 702, 1 },
|
||||||
|
/*270*/ { 703, 1 },
|
||||||
|
/*271*/ { 704, 1 },
|
||||||
|
/*272*/ { 705, 1 },
|
||||||
|
/*273*/ { 706, 1 },
|
||||||
|
/*274*/ { 707, 0 },
|
||||||
|
/*275*/ { 708, 0 },
|
||||||
|
/*276*/ { 709, 0 },
|
||||||
|
/*277*/ { 710, 1 },
|
||||||
|
/*278*/ { 711, 0 },
|
||||||
|
/*279*/ { 747, 0 },
|
||||||
|
/*280*/ { 748, 1 },
|
||||||
|
/*281*/ { 749, 0 },
|
||||||
|
/*282*/ { 750, 0 },
|
||||||
|
/*283*/ { 751, 0 },
|
||||||
|
/*284*/ { 752, 1 },
|
||||||
|
/*285*/ { 753, 0 },
|
||||||
|
/*286*/ { 791, 0 },
|
||||||
|
/*287*/ { 792, 1 },
|
||||||
|
/*288*/ { 793, 0 },
|
||||||
|
/*289*/ { 794, 0 },
|
||||||
|
/*290*/ { 795, 1 },
|
||||||
|
/*291*/ { 796, 1 },
|
||||||
|
/*292*/ { 797, 0 },
|
||||||
|
/*293*/ { 798, 1 },
|
||||||
|
/*294*/ { 799, 0 },
|
||||||
|
/*295*/ { 800, 1 },
|
||||||
|
/*296*/ { 801, 0 },
|
||||||
|
/*297*/ { 802, 0 },
|
||||||
|
/*298*/ { 803, 0 },
|
||||||
|
/*299*/ { 804, 1 },
|
||||||
|
/*300*/ { 805, 0 },
|
||||||
|
/*301*/ { 806, 0 },
|
||||||
|
/*302*/ { 807, 1 },
|
||||||
|
/*303*/ { 808, 0 },
|
||||||
|
/*304*/ { 830, 0 },
|
||||||
|
/*305*/ { 831, 1 },
|
||||||
|
/*306*/ { 832, 1 },
|
||||||
|
/*307*/ { 833, 1 },
|
||||||
|
/*308*/ { 834, 1 },
|
||||||
|
/*309*/ { 835, 0 },
|
||||||
|
/*310*/ { 880, 0 },
|
||||||
|
/*311*/ { 881, 0 },
|
||||||
|
/*312*/ { 882, 1 },
|
||||||
|
/*313*/ { 883, 0 },
|
||||||
|
/*314*/ { 884, 0 },
|
||||||
|
/*315*/ { 885, 0 },
|
||||||
|
/*316*/ { 886, 0 },
|
||||||
|
/*317*/ { 887, 1 },
|
||||||
|
/*318*/ { 888, 0 },
|
||||||
|
/*319*/ { 889, 0 },
|
||||||
|
/*320*/ { 890, 0 },
|
||||||
|
/*321*/ { 891, 0 },
|
||||||
|
/*322*/ { 892, 0 },
|
||||||
|
/*323*/ { 893, 0 },
|
||||||
|
/*324*/ { 894, 1 },
|
||||||
|
/*325*/ { 895, 0 },
|
||||||
|
/*326*/ { 896, 0 },
|
||||||
|
/*327*/ { 897, 0 },
|
||||||
|
/*328*/ { 898, 0 },
|
||||||
|
/*329*/ { 899, 0 },
|
||||||
|
/*330*/ { 900, 0 },
|
||||||
|
/*331*/ { 999, 0 },
|
||||||
|
/*332*/ { 2000, 0 },
|
||||||
|
};
|
||||||
|
int data_size = ARRAY_SIZE(data);
|
||||||
|
|
||||||
|
for (int i = 0; i < data_size; i++) {
|
||||||
|
|
||||||
|
if (index != -1 && i != index) continue;
|
||||||
|
|
||||||
|
ret = iso3166_numeric(data[i].data);
|
||||||
|
assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
testFinish();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Binary chop version: Whether ISO 3166-1 numeric */
|
||||||
|
static int bc_iso3166_numeric(int cc) {
|
||||||
|
static const short codes[249] = {
|
||||||
|
/*AFG*/ 4, /*ALB*/ 8, /*ATA*/ 10, /*DZA*/ 12, /*ASM*/ 16, /*AND*/ 20, /*AGO*/ 24, /*ATG*/ 28, /*AZE*/ 31, /*ARG*/ 32,
|
||||||
|
/*AUS*/ 36, /*AUT*/ 40, /*BHS*/ 44, /*BHR*/ 48, /*BGD*/ 50, /*ARM*/ 51, /*BRB*/ 52, /*BEL*/ 56, /*BMU*/ 60, /*BTN*/ 64,
|
||||||
|
/*BOL*/ 68, /*BIH*/ 70, /*BWA*/ 72, /*BVT*/ 74, /*BRA*/ 76, /*BLZ*/ 84, /*IOT*/ 86, /*SLB*/ 90, /*VGB*/ 92, /*BRN*/ 96,
|
||||||
|
/*BGR*/ 100, /*MMR*/ 104, /*BDI*/ 108, /*BLR*/ 112, /*KHM*/ 116, /*CMR*/ 120, /*CAN*/ 124, /*CPV*/ 132, /*CYM*/ 136, /*CAF*/ 140,
|
||||||
|
/*LKA*/ 144, /*TCD*/ 148, /*CHL*/ 152, /*CHN*/ 156, /*TWN*/ 158, /*CXR*/ 162, /*CCK*/ 166, /*COL*/ 170, /*COM*/ 174, /*MYT*/ 175,
|
||||||
|
/*COG*/ 178, /*COD*/ 180, /*COK*/ 184, /*CRI*/ 188, /*HRV*/ 191, /*CUB*/ 192, /*CYP*/ 196, /*CZE*/ 203, /*BEN*/ 204, /*DNK*/ 208,
|
||||||
|
/*DMA*/ 212, /*DOM*/ 214, /*ECU*/ 218, /*SLV*/ 222, /*GNQ*/ 226, /*ETH*/ 231, /*ERI*/ 232, /*EST*/ 233, /*FRO*/ 234, /*FLK*/ 238,
|
||||||
|
/*SGS*/ 239, /*FJI*/ 242, /*FIN*/ 246, /*ALA*/ 248, /*FRA*/ 250, /*GUF*/ 254, /*PYF*/ 258, /*ATF*/ 260, /*DJI*/ 262, /*GAB*/ 266,
|
||||||
|
/*GEO*/ 268, /*GMB*/ 270, /*PSE*/ 275, /*DEU*/ 276, /*GHA*/ 288, /*GIB*/ 292, /*KIR*/ 296, /*GRC*/ 300, /*GRL*/ 304, /*GRD*/ 308,
|
||||||
|
/*GLP*/ 312, /*GUM*/ 316, /*GTM*/ 320, /*GIN*/ 324, /*GUY*/ 328, /*HTI*/ 332, /*HMD*/ 334, /*VAT*/ 336, /*HND*/ 340, /*HKG*/ 344,
|
||||||
|
/*HUN*/ 348, /*ISL*/ 352, /*IND*/ 356, /*IDN*/ 360, /*IRN*/ 364, /*IRQ*/ 368, /*IRL*/ 372, /*ISR*/ 376, /*ITA*/ 380, /*CIV*/ 384,
|
||||||
|
/*JAM*/ 388, /*JPN*/ 392, /*KAZ*/ 398, /*JOR*/ 400, /*KEN*/ 404, /*PRK*/ 408, /*KOR*/ 410, /*KWT*/ 414, /*KGZ*/ 417, /*LAO*/ 418,
|
||||||
|
/*LBN*/ 422, /*LSO*/ 426, /*LVA*/ 428, /*LBR*/ 430, /*LBY*/ 434, /*LIE*/ 438, /*LTU*/ 440, /*LUX*/ 442, /*MAC*/ 446, /*MDG*/ 450,
|
||||||
|
/*MWI*/ 454, /*MYS*/ 458, /*MDV*/ 462, /*MLI*/ 466, /*MLT*/ 470, /*MTQ*/ 474, /*MRT*/ 478, /*MUS*/ 480, /*MEX*/ 484, /*MCO*/ 492,
|
||||||
|
/*MNG*/ 496, /*MDA*/ 498, /*MNE*/ 499, /*MSR*/ 500, /*MAR*/ 504, /*MOZ*/ 508, /*OMN*/ 512, /*NAM*/ 516, /*NRU*/ 520, /*NPL*/ 524,
|
||||||
|
/*NLD*/ 528, /*CUW*/ 531, /*ABW*/ 533, /*SXM*/ 534, /*BES*/ 535, /*NCL*/ 540, /*VUT*/ 548, /*NZL*/ 554, /*NIC*/ 558, /*NER*/ 562,
|
||||||
|
/*NGA*/ 566, /*NIU*/ 570, /*NFK*/ 574, /*NOR*/ 578, /*MNP*/ 580, /*UMI*/ 581, /*FSM*/ 583, /*MHL*/ 584, /*PLW*/ 585, /*PAK*/ 586,
|
||||||
|
/*PAN*/ 591, /*PNG*/ 598, /*PRY*/ 600, /*PER*/ 604, /*PHL*/ 608, /*PCN*/ 612, /*POL*/ 616, /*PRT*/ 620, /*GNB*/ 624, /*TLS*/ 626,
|
||||||
|
/*PRI*/ 630, /*QAT*/ 634, /*REU*/ 638, /*ROU*/ 642, /*RUS*/ 643, /*RWA*/ 646, /*BLM*/ 652, /*SHN*/ 654, /*KNA*/ 659, /*AIA*/ 660,
|
||||||
|
/*LCA*/ 662, /*MAF*/ 663, /*SPM*/ 666, /*VCT*/ 670, /*SMR*/ 674, /*STP*/ 678, /*SAU*/ 682, /*SEN*/ 686, /*SRB*/ 688, /*SYC*/ 690,
|
||||||
|
/*SLE*/ 694, /*SGP*/ 702, /*SVK*/ 703, /*VNM*/ 704, /*SVN*/ 705, /*SOM*/ 706, /*ZAF*/ 710, /*ZWE*/ 716, /*ESP*/ 724, /*SSD*/ 728,
|
||||||
|
/*SDN*/ 729, /*ESH*/ 732, /*SUR*/ 740, /*SJM*/ 744, /*SWZ*/ 748, /*SWE*/ 752, /*CHE*/ 756, /*SYR*/ 760, /*TJK*/ 762, /*THA*/ 764,
|
||||||
|
/*TGO*/ 768, /*TKL*/ 772, /*TON*/ 776, /*TTO*/ 780, /*ARE*/ 784, /*TUN*/ 788, /*TUR*/ 792, /*TKM*/ 795, /*TCA*/ 796, /*TUV*/ 798,
|
||||||
|
/*UGA*/ 800, /*UKR*/ 804, /*MKD*/ 807, /*EGY*/ 818, /*GBR*/ 826, /*GGY*/ 831, /*JEY*/ 832, /*IMN*/ 833, /*TZA*/ 834, /*USA*/ 840,
|
||||||
|
/*VIR*/ 850, /*BFA*/ 854, /*URY*/ 858, /*UZB*/ 860, /*VEN*/ 862, /*WLF*/ 876, /*WSM*/ 882, /*YEM*/ 887, /*ZMB*/ 894,
|
||||||
|
};
|
||||||
|
|
||||||
|
int s = 0, e = sizeof(codes) / sizeof(codes[0]) - 1;
|
||||||
|
|
||||||
|
while (s <= e) {
|
||||||
|
int m = (s + e) / 2;
|
||||||
|
if (codes[m] == cc) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (codes[m] < cc) {
|
||||||
|
s = m + 1;
|
||||||
|
} else {
|
||||||
|
e = m - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_numeric_bc(void) {
|
||||||
|
|
||||||
|
testStart("");
|
||||||
|
|
||||||
|
int ret, bc_ret;
|
||||||
|
|
||||||
|
for (int i = 0; i < 1001; i++) {
|
||||||
|
ret = iso3166_numeric(i);
|
||||||
|
bc_ret = bc_iso3166_numeric(i);
|
||||||
|
assert_equal(ret, bc_ret, "i:%d ret %d != bc_ret %d\n", i, ret, bc_ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
testFinish();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_alpha2(int index) {
|
||||||
|
|
||||||
|
testStart("");
|
||||||
|
|
||||||
|
int ret;
|
||||||
|
struct item {
|
||||||
|
const char *data;
|
||||||
|
int ret;
|
||||||
|
};
|
||||||
|
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
|
||||||
|
struct item data[] = {
|
||||||
|
/* 0*/ { "", 0 },
|
||||||
|
/* 1*/ { "A", 0 },
|
||||||
|
/* 2*/ { "aa", 0 },
|
||||||
|
/* 3*/ { "AA", 0 },
|
||||||
|
/* 4*/ { "AB", 0 },
|
||||||
|
/* 5*/ { "AC", 0 },
|
||||||
|
/* 6*/ { "AD", 1 },
|
||||||
|
/* 7*/ { "ad", 0 },
|
||||||
|
/* 8*/ { "AE", 1 },
|
||||||
|
/* 9*/ { "AF", 1 },
|
||||||
|
/* 10*/ { "AG", 1 },
|
||||||
|
/* 11*/ { "AH", 0 },
|
||||||
|
/* 12*/ { "AI", 1 },
|
||||||
|
/* 13*/ { "AJ", 0 },
|
||||||
|
/* 14*/ { "AP", 0 },
|
||||||
|
/* 15*/ { "AQ", 1 },
|
||||||
|
/* 16*/ { "AR", 1 },
|
||||||
|
/* 17*/ { "AS", 1 },
|
||||||
|
/* 18*/ { "AT", 1 },
|
||||||
|
/* 19*/ { "AU", 1 },
|
||||||
|
/* 20*/ { "AV", 0 },
|
||||||
|
/* 21*/ { "AW", 1 },
|
||||||
|
/* 22*/ { "AX", 1 },
|
||||||
|
/* 23*/ { "AY", 0 },
|
||||||
|
/* 24*/ { "AZ", 1 },
|
||||||
|
/* 25*/ { "BA", 1 },
|
||||||
|
/* 26*/ { "BB", 1 },
|
||||||
|
/* 27*/ { "BC", 0 },
|
||||||
|
/* 28*/ { "BD", 1 },
|
||||||
|
/* 29*/ { "BX", 0 },
|
||||||
|
/* 30*/ { "BY", 1 },
|
||||||
|
/* 31*/ { "BZ", 1 },
|
||||||
|
/* 32*/ { "CA", 1 },
|
||||||
|
/* 33*/ { "CB", 0 },
|
||||||
|
/* 34*/ { "CC", 1 },
|
||||||
|
/* 35*/ { "CD", 1 },
|
||||||
|
/* 36*/ { "CE", 0 },
|
||||||
|
/* 37*/ { "CT", 0 },
|
||||||
|
/* 38*/ { "CU", 1 },
|
||||||
|
/* 39*/ { "CV", 1 },
|
||||||
|
/* 40*/ { "CW", 1 },
|
||||||
|
/* 41*/ { "CX", 1 },
|
||||||
|
/* 42*/ { "CY", 1 },
|
||||||
|
/* 43*/ { "CZ", 1 },
|
||||||
|
/* 44*/ { "DA", 0 },
|
||||||
|
/* 45*/ { "DD", 0 },
|
||||||
|
/* 46*/ { "DE", 1 },
|
||||||
|
/* 47*/ { "DF", 0 },
|
||||||
|
/* 48*/ { "DY", 0 },
|
||||||
|
/* 49*/ { "DZ", 1 },
|
||||||
|
/* 50*/ { "EA", 0 },
|
||||||
|
/* 51*/ { "EB", 0 },
|
||||||
|
/* 52*/ { "EC", 1 },
|
||||||
|
/* 53*/ { "ED", 0 },
|
||||||
|
/* 54*/ { "EZ", 0 },
|
||||||
|
/* 55*/ { "FA", 0 },
|
||||||
|
/* 56*/ { "FQ", 0 },
|
||||||
|
/* 57*/ { "FR", 1 },
|
||||||
|
/* 58*/ { "FS", 0 },
|
||||||
|
/* 59*/ { "FZ", 0 },
|
||||||
|
/* 60*/ { "GA", 1 },
|
||||||
|
/* 61*/ { "GB", 1 },
|
||||||
|
/* 62*/ { "GC", 0 },
|
||||||
|
/* 63*/ { "GX", 0 },
|
||||||
|
/* 64*/ { "GY", 1 },
|
||||||
|
/* 65*/ { "GZ", 0 },
|
||||||
|
/* 66*/ { "HA", 0 },
|
||||||
|
/* 67*/ { "HI", 0 },
|
||||||
|
/* 68*/ { "HJ", 0 },
|
||||||
|
/* 69*/ { "HK", 1 },
|
||||||
|
/* 70*/ { "HL", 0 },
|
||||||
|
/* 71*/ { "HZ", 0 },
|
||||||
|
/* 72*/ { "IA", 0 },
|
||||||
|
/* 73*/ { "IC", 0 },
|
||||||
|
/* 74*/ { "ID", 1 },
|
||||||
|
/* 75*/ { "IE", 1 },
|
||||||
|
/* 76*/ { "IF", 0 },
|
||||||
|
/* 77*/ { "IZ", 0 },
|
||||||
|
/* 78*/ { "JA", 0 },
|
||||||
|
/* 79*/ { "JD", 0 },
|
||||||
|
/* 80*/ { "JE", 1 },
|
||||||
|
/* 81*/ { "JF", 0 },
|
||||||
|
/* 82*/ { "JZ", 0 },
|
||||||
|
/* 83*/ { "KA", 0 },
|
||||||
|
/* 84*/ { "KD", 0 },
|
||||||
|
/* 85*/ { "KE", 1 },
|
||||||
|
/* 86*/ { "KF", 0 },
|
||||||
|
/* 87*/ { "KG", 1 },
|
||||||
|
/* 88*/ { "KH", 1 },
|
||||||
|
/* 89*/ { "KI", 1 },
|
||||||
|
/* 90*/ { "KJ", 0 },
|
||||||
|
/* 91*/ { "KX", 0 },
|
||||||
|
/* 92*/ { "KY", 1 },
|
||||||
|
/* 93*/ { "KZ", 1 },
|
||||||
|
/* 94*/ { "LA", 1 },
|
||||||
|
/* 95*/ { "LB", 1 },
|
||||||
|
/* 96*/ { "LC", 1 },
|
||||||
|
/* 97*/ { "LD", 0 },
|
||||||
|
/* 98*/ { "LE", 0 },
|
||||||
|
/* 99*/ { "LX", 0 },
|
||||||
|
/*100*/ { "LY", 1 },
|
||||||
|
/*101*/ { "LZ", 0 },
|
||||||
|
/*102*/ { "MA", 1 },
|
||||||
|
/*103*/ { "MB", 0 },
|
||||||
|
/*104*/ { "MI", 0 },
|
||||||
|
/*105*/ { "MJ", 0 },
|
||||||
|
/*106*/ { "MK", 1 },
|
||||||
|
/*107*/ { "ML", 1 },
|
||||||
|
/*108*/ { "MM", 1 },
|
||||||
|
/*109*/ { "MN", 1 },
|
||||||
|
/*110*/ { "MO", 1 },
|
||||||
|
/*111*/ { "MP", 1 },
|
||||||
|
/*112*/ { "MQ", 1 },
|
||||||
|
/*113*/ { "MR", 1 },
|
||||||
|
/*114*/ { "MS", 1 },
|
||||||
|
/*115*/ { "MT", 1 },
|
||||||
|
/*116*/ { "MU", 1 },
|
||||||
|
/*117*/ { "MV", 1 },
|
||||||
|
/*118*/ { "MW", 1 },
|
||||||
|
/*119*/ { "MX", 1 },
|
||||||
|
/*120*/ { "MY", 1 },
|
||||||
|
/*121*/ { "MZ", 1 },
|
||||||
|
/*122*/ { "NA", 1 },
|
||||||
|
/*123*/ { "NB", 0 },
|
||||||
|
/*124*/ { "NC", 1 },
|
||||||
|
/*125*/ { "NY", 0 },
|
||||||
|
/*126*/ { "NZ", 1 },
|
||||||
|
/*127*/ { "OA", 0 },
|
||||||
|
/*128*/ { "OL", 0 },
|
||||||
|
/*129*/ { "OM", 1 },
|
||||||
|
/*130*/ { "ON", 0 },
|
||||||
|
/*131*/ { "OZ", 0 },
|
||||||
|
/*132*/ { "PA", 1 },
|
||||||
|
/*133*/ { "PB", 0 },
|
||||||
|
/*134*/ { "PQ", 0 },
|
||||||
|
/*135*/ { "PR", 1 },
|
||||||
|
/*136*/ { "PS", 1 },
|
||||||
|
/*137*/ { "PT", 1 },
|
||||||
|
/*138*/ { "PU", 0 },
|
||||||
|
/*139*/ { "PV", 0 },
|
||||||
|
/*140*/ { "PW", 1 },
|
||||||
|
/*141*/ { "PX", 0 },
|
||||||
|
/*142*/ { "PY", 1 },
|
||||||
|
/*143*/ { "PZ", 0 },
|
||||||
|
/*144*/ { "QA", 1 },
|
||||||
|
/*145*/ { "QB", 0 },
|
||||||
|
/*146*/ { "QZ", 0 },
|
||||||
|
/*147*/ { "RA", 0 },
|
||||||
|
/*148*/ { "RC", 0 },
|
||||||
|
/*149*/ { "RD", 0 },
|
||||||
|
/*150*/ { "RE", 1 },
|
||||||
|
/*151*/ { "RF", 0 },
|
||||||
|
/*152*/ { "RZ", 0 },
|
||||||
|
/*153*/ { "SA", 1 },
|
||||||
|
/*154*/ { "SB", 1 },
|
||||||
|
/*155*/ { "SC", 1 },
|
||||||
|
/*156*/ { "SD", 1 },
|
||||||
|
/*157*/ { "SE", 1 },
|
||||||
|
/*158*/ { "SF", 0 },
|
||||||
|
/*159*/ { "SW", 0 },
|
||||||
|
/*160*/ { "SX", 1 },
|
||||||
|
/*161*/ { "SY", 1 },
|
||||||
|
/*162*/ { "SZ", 1 },
|
||||||
|
/*163*/ { "TA", 0 },
|
||||||
|
/*164*/ { "TB", 0 },
|
||||||
|
/*165*/ { "TC", 1 },
|
||||||
|
/*166*/ { "TD", 1 },
|
||||||
|
/*167*/ { "TE", 0 },
|
||||||
|
/*168*/ { "TU", 0 },
|
||||||
|
/*169*/ { "TV", 1 },
|
||||||
|
/*170*/ { "TW", 1 },
|
||||||
|
/*171*/ { "TX", 0 },
|
||||||
|
/*172*/ { "TY", 0 },
|
||||||
|
/*173*/ { "TZ", 1 },
|
||||||
|
/*174*/ { "UA", 1 },
|
||||||
|
/*175*/ { "UB", 0 },
|
||||||
|
/*176*/ { "UX", 0 },
|
||||||
|
/*177*/ { "UY", 1 },
|
||||||
|
/*178*/ { "UZ", 1 },
|
||||||
|
/*179*/ { "VA", 1 },
|
||||||
|
/*180*/ { "VB", 0 },
|
||||||
|
/*181*/ { "VC", 1 },
|
||||||
|
/*182*/ { "VD", 0 },
|
||||||
|
/*183*/ { "VZ", 0 },
|
||||||
|
/*184*/ { "WA", 0 },
|
||||||
|
/*185*/ { "WE", 0 },
|
||||||
|
/*186*/ { "WF", 1 },
|
||||||
|
/*187*/ { "WG", 0 },
|
||||||
|
/*188*/ { "WZ", 0 },
|
||||||
|
/*189*/ { "XA", 0 },
|
||||||
|
/*190*/ { "XZ", 0 },
|
||||||
|
/*191*/ { "YA", 0 },
|
||||||
|
/*192*/ { "YC", 0 },
|
||||||
|
/*193*/ { "YD", 0 },
|
||||||
|
/*194*/ { "YE", 1 },
|
||||||
|
/*195*/ { "YF", 0 },
|
||||||
|
/*196*/ { "YZ", 0 },
|
||||||
|
/*197*/ { "ZA", 1 },
|
||||||
|
/*198*/ { "ZB", 0 },
|
||||||
|
/*199*/ { "ZL", 0 },
|
||||||
|
/*200*/ { "ZM", 1 },
|
||||||
|
/*201*/ { "ZN", 0 },
|
||||||
|
/*202*/ { "ZV", 0 },
|
||||||
|
/*203*/ { "ZW", 1 },
|
||||||
|
/*204*/ { "ZX", 0 },
|
||||||
|
/*205*/ { "ZY", 0 },
|
||||||
|
/*206*/ { "ZZ", 0 },
|
||||||
|
/*207*/ { "Z", 0 },
|
||||||
|
/*208*/ { "zz", 0 },
|
||||||
|
/*209*/ { "0", 0 },
|
||||||
|
/*210*/ { "\001", 0 },
|
||||||
|
/*211*/ { "\177", 0 },
|
||||||
|
/*212*/ { "\200", 0 },
|
||||||
|
/*213*/ { "\377", 0 },
|
||||||
|
};
|
||||||
|
int data_size = ARRAY_SIZE(data);
|
||||||
|
|
||||||
|
for (int i = 0; i < data_size; i++) {
|
||||||
|
|
||||||
|
if (index != -1 && i != index) continue;
|
||||||
|
|
||||||
|
ret = iso3166_alpha2(data[i].data);
|
||||||
|
assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
testFinish();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Binary chop version: Whether ISO 3166-1 alpha2 */
|
||||||
|
static int bc_iso3166_alpha2(const char *cc) {
|
||||||
|
static const char codes[249][2] = {
|
||||||
|
{'A','D'}, {'A','E'}, {'A','F'}, {'A','G'}, {'A','I'}, {'A','L'}, {'A','M'}, {'A','O'}, {'A','Q'}, {'A','R'},
|
||||||
|
{'A','S'}, {'A','T'}, {'A','U'}, {'A','W'}, {'A','X'}, {'A','Z'}, {'B','A'}, {'B','B'}, {'B','D'}, {'B','E'},
|
||||||
|
{'B','F'}, {'B','G'}, {'B','H'}, {'B','I'}, {'B','J'}, {'B','L'}, {'B','M'}, {'B','N'}, {'B','O'}, {'B','Q'},
|
||||||
|
{'B','R'}, {'B','S'}, {'B','T'}, {'B','V'}, {'B','W'}, {'B','Y'}, {'B','Z'}, {'C','A'}, {'C','C'}, {'C','D'},
|
||||||
|
{'C','F'}, {'C','G'}, {'C','H'}, {'C','I'}, {'C','K'}, {'C','L'}, {'C','M'}, {'C','N'}, {'C','O'}, {'C','R'},
|
||||||
|
{'C','U'}, {'C','V'}, {'C','W'}, {'C','X'}, {'C','Y'}, {'C','Z'}, {'D','E'}, {'D','J'}, {'D','K'}, {'D','M'},
|
||||||
|
{'D','O'}, {'D','Z'}, {'E','C'}, {'E','E'}, {'E','G'}, {'E','H'}, {'E','R'}, {'E','S'}, {'E','T'}, {'F','I'},
|
||||||
|
{'F','J'}, {'F','K'}, {'F','M'}, {'F','O'}, {'F','R'}, {'G','A'}, {'G','B'}, {'G','D'}, {'G','E'}, {'G','F'},
|
||||||
|
{'G','G'}, {'G','H'}, {'G','I'}, {'G','L'}, {'G','M'}, {'G','N'}, {'G','P'}, {'G','Q'}, {'G','R'}, {'G','S'},
|
||||||
|
{'G','T'}, {'G','U'}, {'G','W'}, {'G','Y'}, {'H','K'}, {'H','M'}, {'H','N'}, {'H','R'}, {'H','T'}, {'H','U'},
|
||||||
|
{'I','D'}, {'I','E'}, {'I','L'}, {'I','M'}, {'I','N'}, {'I','O'}, {'I','Q'}, {'I','R'}, {'I','S'}, {'I','T'},
|
||||||
|
{'J','E'}, {'J','M'}, {'J','O'}, {'J','P'}, {'K','E'}, {'K','G'}, {'K','H'}, {'K','I'}, {'K','M'}, {'K','N'},
|
||||||
|
{'K','P'}, {'K','R'}, {'K','W'}, {'K','Y'}, {'K','Z'}, {'L','A'}, {'L','B'}, {'L','C'}, {'L','I'}, {'L','K'},
|
||||||
|
{'L','R'}, {'L','S'}, {'L','T'}, {'L','U'}, {'L','V'}, {'L','Y'}, {'M','A'}, {'M','C'}, {'M','D'}, {'M','E'},
|
||||||
|
{'M','F'}, {'M','G'}, {'M','H'}, {'M','K'}, {'M','L'}, {'M','M'}, {'M','N'}, {'M','O'}, {'M','P'}, {'M','Q'},
|
||||||
|
{'M','R'}, {'M','S'}, {'M','T'}, {'M','U'}, {'M','V'}, {'M','W'}, {'M','X'}, {'M','Y'}, {'M','Z'}, {'N','A'},
|
||||||
|
{'N','C'}, {'N','E'}, {'N','F'}, {'N','G'}, {'N','I'}, {'N','L'}, {'N','O'}, {'N','P'}, {'N','R'}, {'N','U'},
|
||||||
|
{'N','Z'}, {'O','M'}, {'P','A'}, {'P','E'}, {'P','F'}, {'P','G'}, {'P','H'}, {'P','K'}, {'P','L'}, {'P','M'},
|
||||||
|
{'P','N'}, {'P','R'}, {'P','S'}, {'P','T'}, {'P','W'}, {'P','Y'}, {'Q','A'}, {'R','E'}, {'R','O'}, {'R','S'},
|
||||||
|
{'R','U'}, {'R','W'}, {'S','A'}, {'S','B'}, {'S','C'}, {'S','D'}, {'S','E'}, {'S','G'}, {'S','H'}, {'S','I'},
|
||||||
|
{'S','J'}, {'S','K'}, {'S','L'}, {'S','M'}, {'S','N'}, {'S','O'}, {'S','R'}, {'S','S'}, {'S','T'}, {'S','V'},
|
||||||
|
{'S','X'}, {'S','Y'}, {'S','Z'}, {'T','C'}, {'T','D'}, {'T','F'}, {'T','G'}, {'T','H'}, {'T','J'}, {'T','K'},
|
||||||
|
{'T','L'}, {'T','M'}, {'T','N'}, {'T','O'}, {'T','R'}, {'T','T'}, {'T','V'}, {'T','W'}, {'T','Z'}, {'U','A'},
|
||||||
|
{'U','G'}, {'U','M'}, {'U','S'}, {'U','Y'}, {'U','Z'}, {'V','A'}, {'V','C'}, {'V','E'}, {'V','G'}, {'V','I'},
|
||||||
|
{'V','N'}, {'V','U'}, {'W','F'}, {'W','S'}, {'Y','E'}, {'Y','T'}, {'Z','A'}, {'Z','M'}, {'Z','W'},
|
||||||
|
};
|
||||||
|
|
||||||
|
int s = 0, e = sizeof(codes) / sizeof(codes[0]) - 1;
|
||||||
|
|
||||||
|
while (s <= e) {
|
||||||
|
int m = (s + e) / 2;
|
||||||
|
int cmp = strncmp(codes[m], cc, 2);
|
||||||
|
if (cmp == 0) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (cmp < 0) {
|
||||||
|
s = m + 1;
|
||||||
|
} else {
|
||||||
|
e = m - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_alpha2_bc(void) {
|
||||||
|
|
||||||
|
testStart("");
|
||||||
|
|
||||||
|
int ret, bc_ret;
|
||||||
|
char data[2];
|
||||||
|
|
||||||
|
for (int i = 0; i < 128; i++) {
|
||||||
|
for (int j = 0; j < 128; j++) {
|
||||||
|
data[0] = i;
|
||||||
|
data[1] = j;
|
||||||
|
ret = iso3166_alpha2(data);
|
||||||
|
bc_ret = bc_iso3166_alpha2(data);
|
||||||
|
assert_equal(ret, bc_ret, "i:%d ret %d != bc_ret %d\n", i, ret, bc_ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
testFinish();
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
|
testFunction funcs[] = { /* name, func, has_index, has_generate, has_debug */
|
||||||
|
{ "test_numeric", test_numeric, 1, 0, 0 },
|
||||||
|
{ "test_alpha2", test_alpha2, 1, 0, 0 },
|
||||||
|
{ "test_numeric_bc", test_numeric_bc, 0, 0, 0 },
|
||||||
|
{ "test_alpha2_bc", test_alpha2_bc, 0, 0, 0 },
|
||||||
|
};
|
||||||
|
|
||||||
|
testRun(argc, argv, funcs, ARRAY_SIZE(funcs));
|
||||||
|
|
||||||
|
testReport();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
513
backend/tests/test_iso4217.c
Normal file
513
backend/tests/test_iso4217.c
Normal file
@ -0,0 +1,513 @@
|
|||||||
|
/*
|
||||||
|
libzint - the open source barcode library
|
||||||
|
Copyright (C) 2021 Robin Stuart <rstuart114@gmail.com>
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions
|
||||||
|
are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
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
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
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
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
/* vim: set ts=4 sw=4 et : */
|
||||||
|
|
||||||
|
#include "testcommon.h"
|
||||||
|
#include "../iso4217.h"
|
||||||
|
|
||||||
|
static void test_numeric(int index) {
|
||||||
|
|
||||||
|
testStart("");
|
||||||
|
|
||||||
|
int ret;
|
||||||
|
struct item {
|
||||||
|
int data;
|
||||||
|
int ret;
|
||||||
|
};
|
||||||
|
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
|
||||||
|
struct item data[] = {
|
||||||
|
/* 0*/ { -1, 0 },
|
||||||
|
/* 1*/ { 0, 0 },
|
||||||
|
/* 2*/ { 1, 0 },
|
||||||
|
/* 3*/ { 2, 0 },
|
||||||
|
/* 4*/ { 3, 0 },
|
||||||
|
/* 5*/ { 4, 0 },
|
||||||
|
/* 6*/ { 5, 0 },
|
||||||
|
/* 7*/ { 6, 0 },
|
||||||
|
/* 8*/ { 7, 0 },
|
||||||
|
/* 9*/ { 8, 1 },
|
||||||
|
/* 10*/ { 9, 0 },
|
||||||
|
/* 11*/ { 10, 0 },
|
||||||
|
/* 12*/ { 11, 0 },
|
||||||
|
/* 13*/ { 12, 1 },
|
||||||
|
/* 14*/ { 13, 0 },
|
||||||
|
/* 15*/ { 14, 0 },
|
||||||
|
/* 16*/ { 15, 0 },
|
||||||
|
/* 17*/ { 16, 0 },
|
||||||
|
/* 18*/ { 17, 0 },
|
||||||
|
/* 19*/ { 18, 0 },
|
||||||
|
/* 20*/ { 19, 0 },
|
||||||
|
/* 21*/ { 20, 0 },
|
||||||
|
/* 22*/ { 21, 0 },
|
||||||
|
/* 23*/ { 31, 0 },
|
||||||
|
/* 24*/ { 32, 1 },
|
||||||
|
/* 25*/ { 33, 0 },
|
||||||
|
/* 26*/ { 34, 0 },
|
||||||
|
/* 27*/ { 35, 0 },
|
||||||
|
/* 28*/ { 36, 1 },
|
||||||
|
/* 29*/ { 37, 0 },
|
||||||
|
/* 30*/ { 43, 0 },
|
||||||
|
/* 31*/ { 44, 1 },
|
||||||
|
/* 32*/ { 45, 0 },
|
||||||
|
/* 33*/ { 49, 0 },
|
||||||
|
/* 34*/ { 50, 1 },
|
||||||
|
/* 35*/ { 51, 1 },
|
||||||
|
/* 36*/ { 52, 1 },
|
||||||
|
/* 37*/ { 53, 0 },
|
||||||
|
/* 38*/ { 59, 0 },
|
||||||
|
/* 39*/ { 60, 1 },
|
||||||
|
/* 40*/ { 61, 0 },
|
||||||
|
/* 41*/ { 62, 0 },
|
||||||
|
/* 42*/ { 63, 0 },
|
||||||
|
/* 43*/ { 64, 1 },
|
||||||
|
/* 44*/ { 65, 0 },
|
||||||
|
/* 45*/ { 66, 0 },
|
||||||
|
/* 46*/ { 67, 0 },
|
||||||
|
/* 47*/ { 68, 1 },
|
||||||
|
/* 48*/ { 69, 0 },
|
||||||
|
/* 49*/ { 70, 0 },
|
||||||
|
/* 50*/ { 71, 0 },
|
||||||
|
/* 51*/ { 72, 1 },
|
||||||
|
/* 52*/ { 73, 0 },
|
||||||
|
/* 53*/ { 80, 0 },
|
||||||
|
/* 54*/ { 81, 0 },
|
||||||
|
/* 55*/ { 82, 0 },
|
||||||
|
/* 56*/ { 83, 0 },
|
||||||
|
/* 57*/ { 84, 1 },
|
||||||
|
/* 58*/ { 85, 0 },
|
||||||
|
/* 59*/ { 89, 0 },
|
||||||
|
/* 60*/ { 90, 1 },
|
||||||
|
/* 61*/ { 91, 0 },
|
||||||
|
/* 62*/ { 99, 0 },
|
||||||
|
/* 63*/ { 100, 0 },
|
||||||
|
/* 64*/ { 101, 0 },
|
||||||
|
/* 65*/ { 102, 0 },
|
||||||
|
/* 66*/ { 103, 0 },
|
||||||
|
/* 67*/ { 104, 1 },
|
||||||
|
/* 68*/ { 105, 0 },
|
||||||
|
/* 69*/ { 110, 0 },
|
||||||
|
/* 70*/ { 120, 0 },
|
||||||
|
/* 71*/ { 130, 0 },
|
||||||
|
/* 72*/ { 131, 0 },
|
||||||
|
/* 73*/ { 132, 1 },
|
||||||
|
/* 74*/ { 133, 0 },
|
||||||
|
/* 75*/ { 143, 0 },
|
||||||
|
/* 76*/ { 144, 1 },
|
||||||
|
/* 77*/ { 145, 0 },
|
||||||
|
/* 78*/ { 146, 0 },
|
||||||
|
/* 79*/ { 147, 0 },
|
||||||
|
/* 80*/ { 148, 0 },
|
||||||
|
/* 81*/ { 149, 0 },
|
||||||
|
/* 82*/ { 150, 0 },
|
||||||
|
/* 83*/ { 160, 0 },
|
||||||
|
/* 84*/ { 169, 0 },
|
||||||
|
/* 85*/ { 170, 1 },
|
||||||
|
/* 86*/ { 171, 0 },
|
||||||
|
/* 87*/ { 180, 0 },
|
||||||
|
/* 88*/ { 190, 0 },
|
||||||
|
/* 89*/ { 191, 1 },
|
||||||
|
/* 90*/ { 192, 1 },
|
||||||
|
/* 91*/ { 193, 0 },
|
||||||
|
/* 92*/ { 200, 0 },
|
||||||
|
/* 93*/ { 210, 0 },
|
||||||
|
/* 94*/ { 220, 0 },
|
||||||
|
/* 95*/ { 221, 0 },
|
||||||
|
/* 96*/ { 222, 1 },
|
||||||
|
/* 97*/ { 223, 0 },
|
||||||
|
/* 98*/ { 229, 0 },
|
||||||
|
/* 99*/ { 230, 1 },
|
||||||
|
/*100*/ { 231, 0 },
|
||||||
|
/*101*/ { 232, 1 },
|
||||||
|
/*102*/ { 233, 0 },
|
||||||
|
/*103*/ { 234, 0 },
|
||||||
|
/*104*/ { 235, 0 },
|
||||||
|
/*105*/ { 236, 0 },
|
||||||
|
/*106*/ { 237, 0 },
|
||||||
|
/*107*/ { 238, 1 },
|
||||||
|
/*108*/ { 239, 0 },
|
||||||
|
/*109*/ { 240, 0 },
|
||||||
|
/*110*/ { 241, 0 },
|
||||||
|
/*111*/ { 242, 1 },
|
||||||
|
/*112*/ { 243, 0 },
|
||||||
|
/*113*/ { 250, 0 },
|
||||||
|
/*114*/ { 260, 0 },
|
||||||
|
/*115*/ { 269, 0 },
|
||||||
|
/*116*/ { 270, 1 },
|
||||||
|
/*117*/ { 271, 0 },
|
||||||
|
/*118*/ { 280, 0 },
|
||||||
|
/*119*/ { 290, 0 },
|
||||||
|
/*120*/ { 291, 0 },
|
||||||
|
/*121*/ { 292, 1 },
|
||||||
|
/*122*/ { 293, 0 },
|
||||||
|
/*123*/ { 300, 0 },
|
||||||
|
/*124*/ { 310, 0 },
|
||||||
|
/*125*/ { 319, 0 },
|
||||||
|
/*126*/ { 320, 1 },
|
||||||
|
/*127*/ { 321, 0 },
|
||||||
|
/*128*/ { 322, 0 },
|
||||||
|
/*129*/ { 323, 0 },
|
||||||
|
/*130*/ { 324, 1 },
|
||||||
|
/*131*/ { 325, 0 },
|
||||||
|
/*132*/ { 330, 0 },
|
||||||
|
/*133*/ { 331, 0 },
|
||||||
|
/*134*/ { 332, 1 },
|
||||||
|
/*135*/ { 333, 0 },
|
||||||
|
/*136*/ { 339, 0 },
|
||||||
|
/*137*/ { 340, 1 },
|
||||||
|
/*138*/ { 341, 0 },
|
||||||
|
/*139*/ { 350, 0 },
|
||||||
|
/*140*/ { 351, 0 },
|
||||||
|
/*141*/ { 352, 1 },
|
||||||
|
/*142*/ { 353, 0 },
|
||||||
|
/*143*/ { 359, 0 },
|
||||||
|
/*144*/ { 360, 1 },
|
||||||
|
/*145*/ { 361, 0 },
|
||||||
|
/*146*/ { 367, 0 },
|
||||||
|
/*147*/ { 368, 1 },
|
||||||
|
/*148*/ { 369, 0 },
|
||||||
|
/*149*/ { 370, 0 },
|
||||||
|
/*150*/ { 380, 0 },
|
||||||
|
/*151*/ { 390, 0 },
|
||||||
|
/*152*/ { 391, 0 },
|
||||||
|
/*153*/ { 392, 1 },
|
||||||
|
/*154*/ { 393, 0 },
|
||||||
|
/*155*/ { 397, 0 },
|
||||||
|
/*156*/ { 398, 1 },
|
||||||
|
/*157*/ { 399, 0 },
|
||||||
|
/*158*/ { 400, 1 },
|
||||||
|
/*159*/ { 401, 0 },
|
||||||
|
/*160*/ { 409, 0 },
|
||||||
|
/*161*/ { 410, 1 },
|
||||||
|
/*162*/ { 411, 0 },
|
||||||
|
/*163*/ { 425, 0 },
|
||||||
|
/*164*/ { 426, 1 },
|
||||||
|
/*165*/ { 427, 0 },
|
||||||
|
/*166*/ { 428, 0 },
|
||||||
|
/*167*/ { 429, 0 },
|
||||||
|
/*168*/ { 430, 1 },
|
||||||
|
/*169*/ { 431, 0 },
|
||||||
|
/*170*/ { 432, 0 },
|
||||||
|
/*171*/ { 433, 0 },
|
||||||
|
/*172*/ { 434, 1 },
|
||||||
|
/*173*/ { 435, 0 },
|
||||||
|
/*174*/ { 436, 0 },
|
||||||
|
/*175*/ { 437, 0 },
|
||||||
|
/*176*/ { 438, 0 },
|
||||||
|
/*177*/ { 439, 0 },
|
||||||
|
/*178*/ { 440, 0 },
|
||||||
|
/*179*/ { 441, 0 },
|
||||||
|
/*180*/ { 442, 0 },
|
||||||
|
/*181*/ { 443, 0 },
|
||||||
|
/*182*/ { 450, 0 },
|
||||||
|
/*183*/ { 460, 0 },
|
||||||
|
/*184*/ { 470, 0 },
|
||||||
|
/*185*/ { 479, 0 },
|
||||||
|
/*186*/ { 480, 1 },
|
||||||
|
/*187*/ { 481, 0 },
|
||||||
|
/*188*/ { 495, 0 },
|
||||||
|
/*189*/ { 496, 1 },
|
||||||
|
/*190*/ { 497, 0 },
|
||||||
|
/*191*/ { 498, 1 },
|
||||||
|
/*192*/ { 499, 0 },
|
||||||
|
/*193*/ { 500, 0 },
|
||||||
|
/*194*/ { 501, 0 },
|
||||||
|
/*195*/ { 502, 0 },
|
||||||
|
/*196*/ { 503, 0 },
|
||||||
|
/*197*/ { 504, 1 },
|
||||||
|
/*198*/ { 505, 0 },
|
||||||
|
/*199*/ { 510, 0 },
|
||||||
|
/*200*/ { 520, 0 },
|
||||||
|
/*201*/ { 530, 0 },
|
||||||
|
/*202*/ { 540, 0 },
|
||||||
|
/*203*/ { 550, 0 },
|
||||||
|
/*204*/ { 557, 0 },
|
||||||
|
/*205*/ { 558, 1 },
|
||||||
|
/*206*/ { 559, 0 },
|
||||||
|
/*207*/ { 560, 0 },
|
||||||
|
/*208*/ { 561, 0 },
|
||||||
|
/*209*/ { 562, 0 },
|
||||||
|
/*210*/ { 563, 0 },
|
||||||
|
/*211*/ { 564, 0 },
|
||||||
|
/*212*/ { 565, 0 },
|
||||||
|
/*213*/ { 566, 1 },
|
||||||
|
/*214*/ { 567, 0 },
|
||||||
|
/*215*/ { 570, 0 },
|
||||||
|
/*216*/ { 580, 0 },
|
||||||
|
/*217*/ { 589, 0 },
|
||||||
|
/*218*/ { 590, 1 },
|
||||||
|
/*219*/ { 591, 0 },
|
||||||
|
/*220*/ { 597, 0 },
|
||||||
|
/*221*/ { 598, 1 },
|
||||||
|
/*222*/ { 599, 0 },
|
||||||
|
/*223*/ { 600, 1 },
|
||||||
|
/*224*/ { 601, 0 },
|
||||||
|
/*225*/ { 610, 0 },
|
||||||
|
/*226*/ { 611, 0 },
|
||||||
|
/*227*/ { 612, 0 },
|
||||||
|
/*228*/ { 613, 0 },
|
||||||
|
/*229*/ { 620, 0 },
|
||||||
|
/*230*/ { 630, 0 },
|
||||||
|
/*231*/ { 640, 0 },
|
||||||
|
/*232*/ { 650, 0 },
|
||||||
|
/*233*/ { 660, 0 },
|
||||||
|
/*234*/ { 670, 0 },
|
||||||
|
/*235*/ { 677, 0 },
|
||||||
|
/*236*/ { 678, 0 },
|
||||||
|
/*237*/ { 679, 0 },
|
||||||
|
/*238*/ { 680, 0 },
|
||||||
|
/*239*/ { 681, 0 },
|
||||||
|
/*240*/ { 682, 1 },
|
||||||
|
/*241*/ { 683, 0 },
|
||||||
|
/*242*/ { 689, 0 },
|
||||||
|
/*243*/ { 690, 1 },
|
||||||
|
/*244*/ { 691, 0 },
|
||||||
|
/*245*/ { 700, 0 },
|
||||||
|
/*246*/ { 701, 0 },
|
||||||
|
/*247*/ { 702, 1 },
|
||||||
|
/*248*/ { 703, 0 },
|
||||||
|
/*249*/ { 704, 1 },
|
||||||
|
/*250*/ { 705, 0 },
|
||||||
|
/*251*/ { 706, 1 },
|
||||||
|
/*252*/ { 707, 0 },
|
||||||
|
/*253*/ { 708, 0 },
|
||||||
|
/*254*/ { 709, 0 },
|
||||||
|
/*255*/ { 710, 1 },
|
||||||
|
/*256*/ { 711, 0 },
|
||||||
|
/*257*/ { 720, 0 },
|
||||||
|
/*258*/ { 730, 0 },
|
||||||
|
/*259*/ { 740, 0 },
|
||||||
|
/*260*/ { 750, 0 },
|
||||||
|
/*261*/ { 751, 0 },
|
||||||
|
/*262*/ { 752, 1 },
|
||||||
|
/*263*/ { 753, 0 },
|
||||||
|
/*264*/ { 759, 0 },
|
||||||
|
/*265*/ { 760, 1 },
|
||||||
|
/*266*/ { 761, 0 },
|
||||||
|
/*267*/ { 770, 0 },
|
||||||
|
/*268*/ { 779, 0 },
|
||||||
|
/*269*/ { 780, 1 },
|
||||||
|
/*270*/ { 781, 0 },
|
||||||
|
/*271*/ { 790, 0 },
|
||||||
|
/*272*/ { 799, 0 },
|
||||||
|
/*273*/ { 800, 1 },
|
||||||
|
/*274*/ { 801, 0 },
|
||||||
|
/*275*/ { 810, 0 },
|
||||||
|
/*276*/ { 820, 0 },
|
||||||
|
/*277*/ { 830, 0 },
|
||||||
|
/*278*/ { 839, 0 },
|
||||||
|
/*279*/ { 840, 1 },
|
||||||
|
/*280*/ { 841, 0 },
|
||||||
|
/*281*/ { 857, 0 },
|
||||||
|
/*282*/ { 858, 1 },
|
||||||
|
/*283*/ { 859, 0 },
|
||||||
|
/*284*/ { 860, 1 },
|
||||||
|
/*285*/ { 861, 0 },
|
||||||
|
/*286*/ { 870, 0 },
|
||||||
|
/*287*/ { 880, 0 },
|
||||||
|
/*288*/ { 881, 0 },
|
||||||
|
/*289*/ { 882, 1 },
|
||||||
|
/*290*/ { 883, 0 },
|
||||||
|
/*291*/ { 884, 0 },
|
||||||
|
/*292*/ { 885, 0 },
|
||||||
|
/*293*/ { 886, 1 },
|
||||||
|
/*294*/ { 887, 0 },
|
||||||
|
/*295*/ { 888, 0 },
|
||||||
|
/*296*/ { 889, 0 },
|
||||||
|
/*297*/ { 890, 0 },
|
||||||
|
/*298*/ { 891, 0 },
|
||||||
|
/*299*/ { 892, 0 },
|
||||||
|
/*300*/ { 893, 0 },
|
||||||
|
/*301*/ { 894, 0 },
|
||||||
|
/*302*/ { 895, 0 },
|
||||||
|
/*303*/ { 896, 0 },
|
||||||
|
/*304*/ { 897, 0 },
|
||||||
|
/*305*/ { 898, 0 },
|
||||||
|
/*306*/ { 899, 0 },
|
||||||
|
/*307*/ { 900, 0 },
|
||||||
|
/*308*/ { 901, 1 },
|
||||||
|
/*309*/ { 902, 0 },
|
||||||
|
/*310*/ { 926, 0 },
|
||||||
|
/*311*/ { 927, 1 },
|
||||||
|
/*312*/ { 928, 1 },
|
||||||
|
/*313*/ { 929, 1 },
|
||||||
|
/*314*/ { 930, 1 },
|
||||||
|
/*315*/ { 931, 1 },
|
||||||
|
/*316*/ { 932, 1 },
|
||||||
|
/*317*/ { 933, 1 },
|
||||||
|
/*318*/ { 934, 1 },
|
||||||
|
/*319*/ { 935, 0 },
|
||||||
|
/*320*/ { 936, 1 },
|
||||||
|
/*321*/ { 937, 0 },
|
||||||
|
/*322*/ { 938, 1 },
|
||||||
|
/*323*/ { 939, 0 },
|
||||||
|
/*324*/ { 940, 1 },
|
||||||
|
/*325*/ { 941, 1 },
|
||||||
|
/*326*/ { 942, 0 },
|
||||||
|
/*327*/ { 943, 1 },
|
||||||
|
/*328*/ { 944, 1 },
|
||||||
|
/*329*/ { 945, 0 },
|
||||||
|
/*330*/ { 946, 1 },
|
||||||
|
/*331*/ { 947, 1 },
|
||||||
|
/*332*/ { 948, 1 },
|
||||||
|
/*333*/ { 949, 1 },
|
||||||
|
/*334*/ { 950, 1 },
|
||||||
|
/*335*/ { 951, 1 },
|
||||||
|
/*336*/ { 952, 1 },
|
||||||
|
/*337*/ { 953, 1 },
|
||||||
|
/*338*/ { 954, 0 },
|
||||||
|
/*339*/ { 955, 1 },
|
||||||
|
/*340*/ { 956, 1 },
|
||||||
|
/*341*/ { 957, 1 },
|
||||||
|
/*342*/ { 958, 1 },
|
||||||
|
/*343*/ { 959, 1 },
|
||||||
|
/*344*/ { 960, 1 },
|
||||||
|
/*345*/ { 961, 1 },
|
||||||
|
/*346*/ { 962, 1 },
|
||||||
|
/*347*/ { 963, 1 },
|
||||||
|
/*348*/ { 964, 1 },
|
||||||
|
/*349*/ { 965, 1 },
|
||||||
|
/*350*/ { 966, 0 },
|
||||||
|
/*351*/ { 967, 1 },
|
||||||
|
/*352*/ { 968, 1 },
|
||||||
|
/*353*/ { 969, 1 },
|
||||||
|
/*354*/ { 970, 1 },
|
||||||
|
/*355*/ { 971, 1 },
|
||||||
|
/*356*/ { 972, 1 },
|
||||||
|
/*357*/ { 973, 1 },
|
||||||
|
/*358*/ { 974, 0 },
|
||||||
|
/*359*/ { 975, 1 },
|
||||||
|
/*360*/ { 976, 1 },
|
||||||
|
/*361*/ { 977, 1 },
|
||||||
|
/*362*/ { 978, 1 },
|
||||||
|
/*363*/ { 979, 1 },
|
||||||
|
/*364*/ { 980, 1 },
|
||||||
|
/*365*/ { 981, 1 },
|
||||||
|
/*366*/ { 982, 0 },
|
||||||
|
/*367*/ { 983, 0 },
|
||||||
|
/*368*/ { 984, 1 },
|
||||||
|
/*369*/ { 985, 1 },
|
||||||
|
/*370*/ { 986, 1 },
|
||||||
|
/*371*/ { 987, 0 },
|
||||||
|
/*372*/ { 988, 0 },
|
||||||
|
/*373*/ { 989, 0 },
|
||||||
|
/*374*/ { 990, 1 },
|
||||||
|
/*375*/ { 991, 0 },
|
||||||
|
/*376*/ { 992, 0 },
|
||||||
|
/*377*/ { 993, 0 },
|
||||||
|
/*378*/ { 994, 1 },
|
||||||
|
/*379*/ { 995, 0 },
|
||||||
|
/*380*/ { 996, 0 },
|
||||||
|
/*381*/ { 997, 1 },
|
||||||
|
/*382*/ { 998, 0 },
|
||||||
|
/*383*/ { 999, 1 },
|
||||||
|
/*384*/ { 1000, 0 },
|
||||||
|
/*385*/ { 2000, 0 },
|
||||||
|
};
|
||||||
|
int data_size = ARRAY_SIZE(data);
|
||||||
|
|
||||||
|
for (int i = 0; i < data_size; i++) {
|
||||||
|
|
||||||
|
if (index != -1 && i != index) continue;
|
||||||
|
|
||||||
|
ret = iso4217_numeric(data[i].data);
|
||||||
|
assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
testFinish();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Binary chop version: Whether ISO 4217 numeric */
|
||||||
|
static int bc_iso4217_numeric(int cc) {
|
||||||
|
static const short codes[179] = {
|
||||||
|
/*ALL*/ 8, /*DZD*/ 12, /*ARS*/ 32, /*AUD*/ 36, /*BSD*/ 44, /*BHD*/ 48, /*BDT*/ 50, /*AMD*/ 51, /*BBD*/ 52, /*BMD*/ 60,
|
||||||
|
/*BTN*/ 64, /*BOB*/ 68, /*BWP*/ 72, /*BZD*/ 84, /*SBD*/ 90, /*BND*/ 96, /*MMK*/ 104, /*BIF*/ 108, /*KHR*/ 116, /*CAD*/ 124,
|
||||||
|
/*CVE*/ 132, /*KYD*/ 136, /*LKR*/ 144, /*CLP*/ 152, /*CNY*/ 156, /*COP*/ 170, /*KMF*/ 174, /*CRC*/ 188, /*HRK*/ 191, /*CUP*/ 192,
|
||||||
|
/*CZK*/ 203, /*DKK*/ 208, /*DOP*/ 214, /*SVC*/ 222, /*ETB*/ 230, /*ERN*/ 232, /*FKP*/ 238, /*FJD*/ 242, /*DJF*/ 262, /*GMD*/ 270,
|
||||||
|
/*GIP*/ 292, /*GTQ*/ 320, /*GNF*/ 324, /*GYD*/ 328, /*HTG*/ 332, /*HNL*/ 340, /*HKD*/ 344, /*HUF*/ 348, /*ISK*/ 352, /*INR*/ 356,
|
||||||
|
/*IDR*/ 360, /*IRR*/ 364, /*IQD*/ 368, /*ILS*/ 376, /*JMD*/ 388, /*JPY*/ 392, /*KZT*/ 398, /*JOD*/ 400, /*KES*/ 404, /*KPW*/ 408,
|
||||||
|
/*KRW*/ 410, /*KWD*/ 414, /*KGS*/ 417, /*LAK*/ 418, /*LBP*/ 422, /*LSL*/ 426, /*LRD*/ 430, /*LYD*/ 434, /*MOP*/ 446, /*MWK*/ 454,
|
||||||
|
/*MYR*/ 458, /*MVR*/ 462, /*MUR*/ 480, /*MXN*/ 484, /*MNT*/ 496, /*MDL*/ 498, /*MAD*/ 504, /*OMR*/ 512, /*NAD*/ 516, /*NPR*/ 524,
|
||||||
|
/*ANG*/ 532, /*AWG*/ 533, /*VUV*/ 548, /*NZD*/ 554, /*NIO*/ 558, /*NGN*/ 566, /*NOK*/ 578, /*PKR*/ 586, /*PAB*/ 590, /*PGK*/ 598,
|
||||||
|
/*PYG*/ 600, /*PEN*/ 604, /*PHP*/ 608, /*QAR*/ 634, /*RUB*/ 643, /*RWF*/ 646, /*SHP*/ 654, /*SAR*/ 682, /*SCR*/ 690, /*SLL*/ 694,
|
||||||
|
/*SGD*/ 702, /*VND*/ 704, /*SOS*/ 706, /*ZAR*/ 710, /*SSP*/ 728, /*SZL*/ 748, /*SEK*/ 752, /*CHF*/ 756, /*SYP*/ 760, /*THB*/ 764,
|
||||||
|
/*TOP*/ 776, /*TTD*/ 780, /*AED*/ 784, /*TND*/ 788, /*UGX*/ 800, /*MKD*/ 807, /*EGP*/ 818, /*GBP*/ 826, /*TZS*/ 834, /*USD*/ 840,
|
||||||
|
/*UYU*/ 858, /*UZS*/ 860, /*WST*/ 882, /*YER*/ 886, /*TWD*/ 901, /*UYW*/ 927, /*VES*/ 928, /*MRU*/ 929, /*STN*/ 930, /*CUC*/ 931,
|
||||||
|
/*ZWL*/ 932, /*BYN*/ 933, /*TMT*/ 934, /*GHS*/ 936, /*SDG*/ 938, /*UYI*/ 940, /*RSD*/ 941, /*MZN*/ 943, /*AZN*/ 944, /*RON*/ 946,
|
||||||
|
/*CHE*/ 947, /*CHW*/ 948, /*TRY*/ 949, /*XAF*/ 950, /*XCD*/ 951, /*XOF*/ 952, /*XPF*/ 953, /*XBA*/ 955, /*XBB*/ 956, /*XBC*/ 957,
|
||||||
|
/*XBD*/ 958, /*XAU*/ 959, /*XDR*/ 960, /*XAG*/ 961, /*XPT*/ 962, /*XTS*/ 963, /*XPD*/ 964, /*XUA*/ 965, /*ZMW*/ 967, /*SRD*/ 968,
|
||||||
|
/*MGA*/ 969, /*COU*/ 970, /*AFN*/ 971, /*TJS*/ 972, /*AOA*/ 973, /*BGN*/ 975, /*CDF*/ 976, /*BAM*/ 977, /*EUR*/ 978, /*MXV*/ 979,
|
||||||
|
/*UAH*/ 980, /*GEL*/ 981, /*BOV*/ 984, /*PLN*/ 985, /*BRL*/ 986, /*CLF*/ 990, /*XSU*/ 994, /*USN*/ 997, /*XXX*/ 999,
|
||||||
|
};
|
||||||
|
|
||||||
|
int s = 0, e = sizeof(codes) / sizeof(codes[0]) - 1;
|
||||||
|
|
||||||
|
while (s <= e) {
|
||||||
|
int m = (s + e) / 2;
|
||||||
|
if (codes[m] == cc) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (codes[m] < cc) {
|
||||||
|
s = m + 1;
|
||||||
|
} else {
|
||||||
|
e = m - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_numeric_bc(void) {
|
||||||
|
|
||||||
|
testStart("");
|
||||||
|
|
||||||
|
int ret, bc_ret;
|
||||||
|
|
||||||
|
for (int i = 0; i < 1001; i++) {
|
||||||
|
ret = iso4217_numeric(i);
|
||||||
|
bc_ret = bc_iso4217_numeric(i);
|
||||||
|
assert_equal(ret, bc_ret, "i:%d ret %d != bc_ret %d\n", i, ret, bc_ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
testFinish();
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
|
testFunction funcs[] = { /* name, func, has_index, has_generate, has_debug */
|
||||||
|
{ "test_numeric", test_numeric, 1, 0, 0 },
|
||||||
|
{ "test_numeric_bc", test_numeric_bc, 0, 0, 0 },
|
||||||
|
};
|
||||||
|
|
||||||
|
testRun(argc, argv, funcs, ARRAY_SIZE(funcs));
|
||||||
|
|
||||||
|
testReport();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
@ -158,7 +158,7 @@ static void test_input_mode(int index, int debug) {
|
|||||||
/* 7*/ { "1234", -1, 0, DATA_MODE },
|
/* 7*/ { "1234", -1, 0, DATA_MODE },
|
||||||
/* 8*/ { "1234", DATA_MODE | 0x10, 0, DATA_MODE | 0x10 }, // Unknown flags kept (but ignored)
|
/* 8*/ { "1234", DATA_MODE | 0x10, 0, DATA_MODE | 0x10 }, // Unknown flags kept (but ignored)
|
||||||
/* 9*/ { "1234", UNICODE_MODE | 0x10, 0, UNICODE_MODE | 0x10 },
|
/* 9*/ { "1234", UNICODE_MODE | 0x10, 0, UNICODE_MODE | 0x10 },
|
||||||
/* 10*/ { "[01]12345678901234", GS1_MODE | 0x20, 0, GS1_MODE | 0x20 },
|
/* 10*/ { "[01]12345678901231", GS1_MODE | 0x20, 0, GS1_MODE | 0x20 },
|
||||||
};
|
};
|
||||||
int data_size = ARRAY_SIZE(data);
|
int data_size = ARRAY_SIZE(data);
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
libzint - the open source barcode library
|
libzint - the open source barcode library
|
||||||
Copyright (C) 2019 - 2020 Robin Stuart <rstuart114@gmail.com>
|
Copyright (C) 2019 - 2021 Robin Stuart <rstuart114@gmail.com>
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
@ -145,7 +145,7 @@ static void test_buffer(int index, int generate, int debug) {
|
|||||||
/* 21*/ { BARCODE_EANX_CHK, "1234", "", 50, 1, 47, 118, 116 },
|
/* 21*/ { BARCODE_EANX_CHK, "1234", "", 50, 1, 47, 118, 116 },
|
||||||
/* 22*/ { BARCODE_EANX, "12", "", 50, 1, 20, 64, 116 },
|
/* 22*/ { BARCODE_EANX, "12", "", 50, 1, 20, 64, 116 },
|
||||||
/* 23*/ { BARCODE_EANX_CHK, "12", "", 50, 1, 20, 64, 116 },
|
/* 23*/ { BARCODE_EANX_CHK, "12", "", 50, 1, 20, 64, 116 },
|
||||||
/* 24*/ { BARCODE_GS1_128, "[01]12345678901234", "", 50, 1, 134, 268, 116 },
|
/* 24*/ { BARCODE_GS1_128, "[01]12345678901231", "", 50, 1, 134, 268, 116 },
|
||||||
/* 25*/ { BARCODE_CODABAR, "A00000000B", "", 50, 1, 102, 204, 116 },
|
/* 25*/ { BARCODE_CODABAR, "A00000000B", "", 50, 1, 102, 204, 116 },
|
||||||
/* 26*/ { BARCODE_CODE128, "1234567890", "", 50, 1, 90, 180, 116 },
|
/* 26*/ { BARCODE_CODE128, "1234567890", "", 50, 1, 90, 180, 116 },
|
||||||
/* 27*/ { BARCODE_DPLEIT, "1234567890123", "", 50, 1, 135, 270, 116 },
|
/* 27*/ { BARCODE_DPLEIT, "1234567890123", "", 50, 1, 135, 270, 116 },
|
||||||
@ -156,7 +156,7 @@ static void test_buffer(int index, int generate, int debug) {
|
|||||||
/* 32*/ { BARCODE_FLAT, "1234567890", "", 50, 1, 90, 180, 100 },
|
/* 32*/ { BARCODE_FLAT, "1234567890", "", 50, 1, 90, 180, 100 },
|
||||||
/* 33*/ { BARCODE_DBAR_OMN, "1234567890123", "", 50, 1, 96, 192, 116 },
|
/* 33*/ { BARCODE_DBAR_OMN, "1234567890123", "", 50, 1, 96, 192, 116 },
|
||||||
/* 34*/ { BARCODE_DBAR_LTD, "1234567890123", "", 50, 1, 79, 158, 116 },
|
/* 34*/ { BARCODE_DBAR_LTD, "1234567890123", "", 50, 1, 79, 158, 116 },
|
||||||
/* 35*/ { BARCODE_DBAR_EXP, "[01]12345678901234", "", 34, 1, 134, 268, 84 },
|
/* 35*/ { BARCODE_DBAR_EXP, "[01]12345678901231", "", 34, 1, 134, 268, 84 },
|
||||||
/* 36*/ { BARCODE_TELEPEN, "1234567890", "", 50, 1, 208, 416, 116 },
|
/* 36*/ { BARCODE_TELEPEN, "1234567890", "", 50, 1, 208, 416, 116 },
|
||||||
/* 37*/ { BARCODE_UPCA, "12345678901", "", 50, 1, 95, 226, 116 },
|
/* 37*/ { BARCODE_UPCA, "12345678901", "", 50, 1, 95, 226, 116 },
|
||||||
/* 38*/ { BARCODE_UPCA_CHK, "123456789012", "", 50, 1, 95, 226, 116 },
|
/* 38*/ { BARCODE_UPCA_CHK, "123456789012", "", 50, 1, 95, 226, 116 },
|
||||||
@ -199,7 +199,7 @@ static void test_buffer(int index, int generate, int debug) {
|
|||||||
/* 75*/ { BARCODE_KOREAPOST, "123456", "", 50, 1, 167, 334, 116 },
|
/* 75*/ { BARCODE_KOREAPOST, "123456", "", 50, 1, 167, 334, 116 },
|
||||||
/* 76*/ { BARCODE_DBAR_STK, "1234567890123", "", 13, 3, 50, 100, 26 },
|
/* 76*/ { BARCODE_DBAR_STK, "1234567890123", "", 13, 3, 50, 100, 26 },
|
||||||
/* 77*/ { BARCODE_DBAR_OMNSTK, "1234567890123", "", 69, 5, 50, 100, 138 },
|
/* 77*/ { BARCODE_DBAR_OMNSTK, "1234567890123", "", 69, 5, 50, 100, 138 },
|
||||||
/* 78*/ { BARCODE_DBAR_EXPSTK, "[01]12345678901234", "", 71, 5, 102, 204, 142 },
|
/* 78*/ { BARCODE_DBAR_EXPSTK, "[01]12345678901231", "", 71, 5, 102, 204, 142 },
|
||||||
/* 79*/ { BARCODE_PLANET, "12345678901", "", 12, 2, 123, 246, 24 },
|
/* 79*/ { BARCODE_PLANET, "12345678901", "", 12, 2, 123, 246, 24 },
|
||||||
/* 80*/ { BARCODE_MICROPDF417, "1234567890", "", 12, 6, 82, 164, 24 },
|
/* 80*/ { BARCODE_MICROPDF417, "1234567890", "", 12, 6, 82, 164, 24 },
|
||||||
/* 81*/ { BARCODE_USPS_IMAIL, "12345678901234567890", "", 8, 3, 129, 258, 16 },
|
/* 81*/ { BARCODE_USPS_IMAIL, "12345678901234567890", "", 8, 3, 129, 258, 16 },
|
||||||
@ -230,10 +230,10 @@ static void test_buffer(int index, int generate, int debug) {
|
|||||||
/*106*/ { BARCODE_EANX_CC, "1234567", "[20]01", 50, 8, 72, 172, 116 },
|
/*106*/ { BARCODE_EANX_CC, "1234567", "[20]01", 50, 8, 72, 172, 116 },
|
||||||
/*107*/ { BARCODE_EANX_CC, "1234567+12", "[20]01", 50, 8, 99, 226, 116 },
|
/*107*/ { BARCODE_EANX_CC, "1234567+12", "[20]01", 50, 8, 99, 226, 116 },
|
||||||
/*108*/ { BARCODE_EANX_CC, "1234567+12345", "[20]01", 50, 8, 126, 280, 116 },
|
/*108*/ { BARCODE_EANX_CC, "1234567+12345", "[20]01", 50, 8, 126, 280, 116 },
|
||||||
/*109*/ { BARCODE_GS1_128_CC, "[01]12345678901234", "[20]01", 50, 5, 145, 290, 116 },
|
/*109*/ { BARCODE_GS1_128_CC, "[01]12345678901231", "[20]01", 50, 5, 145, 290, 116 },
|
||||||
/*110*/ { BARCODE_DBAR_OMN_CC, "1234567890123", "[20]01", 21, 5, 100, 200, 58 },
|
/*110*/ { BARCODE_DBAR_OMN_CC, "1234567890123", "[20]01", 21, 5, 100, 200, 58 },
|
||||||
/*111*/ { BARCODE_DBAR_LTD_CC, "1234567890123", "[20]01", 19, 6, 79, 158, 54 },
|
/*111*/ { BARCODE_DBAR_LTD_CC, "1234567890123", "[20]01", 19, 6, 79, 158, 54 },
|
||||||
/*112*/ { BARCODE_DBAR_EXP_CC, "[01]12345678901234", "[20]01", 41, 5, 134, 268, 98 },
|
/*112*/ { BARCODE_DBAR_EXP_CC, "[01]12345678901231", "[20]01", 41, 5, 134, 268, 98 },
|
||||||
/*113*/ { BARCODE_UPCA_CC, "12345678901", "[20]01", 50, 7, 99, 234, 116 },
|
/*113*/ { BARCODE_UPCA_CC, "12345678901", "[20]01", 50, 7, 99, 234, 116 },
|
||||||
/*114*/ { BARCODE_UPCA_CC, "12345678901+12", "[20]01", 50, 7, 128, 284, 116 },
|
/*114*/ { BARCODE_UPCA_CC, "12345678901+12", "[20]01", 50, 7, 128, 284, 116 },
|
||||||
/*115*/ { BARCODE_UPCA_CC, "12345678901+12345", "[20]01", 50, 7, 155, 338, 116 },
|
/*115*/ { BARCODE_UPCA_CC, "12345678901+12345", "[20]01", 50, 7, 155, 338, 116 },
|
||||||
@ -242,7 +242,7 @@ static void test_buffer(int index, int generate, int debug) {
|
|||||||
/*118*/ { BARCODE_UPCE_CC, "1234567+12345", "[20]01", 50, 9, 109, 246, 116 },
|
/*118*/ { BARCODE_UPCE_CC, "1234567+12345", "[20]01", 50, 9, 109, 246, 116 },
|
||||||
/*119*/ { BARCODE_DBAR_STK_CC, "1234567890123", "[20]01", 24, 9, 56, 112, 48 },
|
/*119*/ { BARCODE_DBAR_STK_CC, "1234567890123", "[20]01", 24, 9, 56, 112, 48 },
|
||||||
/*120*/ { BARCODE_DBAR_OMNSTK_CC, "1234567890123", "[20]01", 80, 11, 56, 112, 160 },
|
/*120*/ { BARCODE_DBAR_OMNSTK_CC, "1234567890123", "[20]01", 80, 11, 56, 112, 160 },
|
||||||
/*121*/ { BARCODE_DBAR_EXPSTK_CC, "[01]12345678901234", "[20]01", 78, 9, 102, 204, 156 },
|
/*121*/ { BARCODE_DBAR_EXPSTK_CC, "[01]12345678901231", "[20]01", 78, 9, 102, 204, 156 },
|
||||||
/*122*/ { BARCODE_CHANNEL, "01", "", 50, 1, 19, 38, 116 },
|
/*122*/ { BARCODE_CHANNEL, "01", "", 50, 1, 19, 38, 116 },
|
||||||
/*123*/ { BARCODE_CODEONE, "12345678901234567890", "", 22, 22, 22, 44, 44 },
|
/*123*/ { BARCODE_CODEONE, "12345678901234567890", "", 22, 22, 22, 44, 44 },
|
||||||
/*124*/ { BARCODE_GRIDMATRIX, "ABC", "", 18, 18, 18, 36, 36 },
|
/*124*/ { BARCODE_GRIDMATRIX, "ABC", "", 18, 18, 18, 36, 36 },
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
libzint - the open source barcode library
|
libzint - the open source barcode library
|
||||||
Copyright (C) 2019 - 2020 Robin Stuart <rstuart114@gmail.com>
|
Copyright (C) 2019 - 2021 Robin Stuart <rstuart114@gmail.com>
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
@ -193,6 +193,7 @@ static void test_examples(int index, int generate, int debug) {
|
|||||||
int option_2;
|
int option_2;
|
||||||
char *data;
|
char *data;
|
||||||
|
|
||||||
|
int ret;
|
||||||
int expected_rows;
|
int expected_rows;
|
||||||
int expected_width;
|
int expected_width;
|
||||||
int bwipp_cmp;
|
int bwipp_cmp;
|
||||||
@ -201,109 +202,109 @@ static void test_examples(int index, int generate, int debug) {
|
|||||||
};
|
};
|
||||||
// Verified manually against GS1 General Specifications 20.0 (GGS) and ISO/IEC 24724:2011, and verified via bwipp_dump.ps against BWIPP
|
// Verified manually against GS1 General Specifications 20.0 (GGS) and ISO/IEC 24724:2011, and verified via bwipp_dump.ps against BWIPP
|
||||||
struct item data[] = {
|
struct item data[] = {
|
||||||
/* 0*/ { BARCODE_DBAR_OMN, -1, "0950110153001", 1, 96, 1, "GGS Figure 5.5.2.1.1-1. GS1 DataBar Omnidirectional",
|
/* 0*/ { BARCODE_DBAR_OMN, -1, "0950110153001", 0, 1, 96, 1, "GGS Figure 5.5.2.1.1-1. GS1 DataBar Omnidirectional",
|
||||||
"010000010100000101000111110000010111101101011100100011011101000101100000000111001110110111001101"
|
"010000010100000101000111110000010111101101011100100011011101000101100000000111001110110111001101"
|
||||||
},
|
},
|
||||||
/* 1*/ { BARCODE_DBAR_EXP, -1, "[01]90614141000015[3202]000150", 1, 151, 1, "GGS Figure 5.5.2.3.1-1. GS1 DataBar Expanded",
|
/* 1*/ { BARCODE_DBAR_EXP, -1, "[01]90614141000015[3202]000150", 0, 1, 151, 1, "GGS Figure 5.5.2.3.1-1. GS1 DataBar Expanded",
|
||||||
"0101100011001100001011111111000010100100010000111101110011100010100010111100000011100111010111111011010100000100000110001111110000101000000100011010010"
|
"0101100011001100001011111111000010100100010000111101110011100010100010111100000011100111010111111011010100000100000110001111110000101000000100011010010"
|
||||||
},
|
},
|
||||||
/* 2*/ { BARCODE_DBAR_EXPSTK, -1, "[01]90614141000015[3202]000150", 5, 102, 1, "GGS Figure 5.5.2.3.2-1. GS1 DataBar Expanded Stacked, same (tec-it separator differs)",
|
/* 2*/ { BARCODE_DBAR_EXPSTK, -1, "[01]90614141000015[3202]000150", 0, 5, 102, 1, "GGS Figure 5.5.2.3.2-1. GS1 DataBar Expanded Stacked, same (tec-it separator differs)",
|
||||||
"010110001100110000101111111100001010010001000011110111001110001010001011110000001110011101011111101101"
|
"010110001100110000101111111100001010010001000011110111001110001010001011110000001110011101011111101101"
|
||||||
"000001110011001111010000000010100101101110111100001000110001110101110100001010100001100010100000010000"
|
"000001110011001111010000000010100101101110111100001000110001110101110100001010100001100010100000010000"
|
||||||
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
||||||
"000001011111011111001010000001010010111111011100100000000000000000000000000000000000000000000000000000"
|
"000001011111011111001010000001010010111111011100100000000000000000000000000000000000000000000000000000"
|
||||||
"001010100000100000110001111110000101000000100011010010000000000000000000000000000000000000000000000000"
|
"001010100000100000110001111110000101000000100011010010000000000000000000000000000000000000000000000000"
|
||||||
},
|
},
|
||||||
/* 3*/ { BARCODE_DBAR_OMN, -1, "2001234567890", 1, 96, 1, "24724:2011 Figure 1 — GS1 DataBar Omnidirectional",
|
/* 3*/ { BARCODE_DBAR_OMN, -1, "2001234567890", 0, 1, 96, 1, "24724:2011 Figure 1 — GS1 DataBar Omnidirectional",
|
||||||
"010100011101000001001111111000010100110110111110110000010010100101100000000111000110110110001101"
|
"010100011101000001001111111000010100110110111110110000010010100101100000000111000110110110001101"
|
||||||
},
|
},
|
||||||
/* 4*/ { BARCODE_DBAR_OMN, -1, "0441234567890", 1, 96, 1, "24724:2011 Figure 2 — GS1 DataBar Omnidirectional",
|
/* 4*/ { BARCODE_DBAR_OMN, -1, "0441234567890", 0, 1, 96, 1, "24724:2011 Figure 2 — GS1 DataBar Omnidirectional",
|
||||||
"010010001000010001000111000000010101000001100110101100100100000101111110000011000010100011100101"
|
"010010001000010001000111000000010101000001100110101100100100000101111110000011000010100011100101"
|
||||||
},
|
},
|
||||||
/* 5*/ { BARCODE_DBAR_OMN, -1, "0001234567890", 1, 96, 1, "24724:2011 Figure 4 — GS1 DataBar Truncated",
|
/* 5*/ { BARCODE_DBAR_OMN, -1, "0001234567890", 0, 1, 96, 1, "24724:2011 Figure 4 — GS1 DataBar Truncated",
|
||||||
"010101001000000001001111111000010111001011011110111001010110000101111111000111001100111101110101"
|
"010101001000000001001111111000010111001011011110111001010110000101111111000111001100111101110101"
|
||||||
},
|
},
|
||||||
/* 6*/ { BARCODE_DBAR_STK, -1, "0001234567890", 3, 50, 1, "24724:2011 Figure 5 — GS1 DataBar Stacked NOTE: Figure 5 separator differs from GGS Figure 5.5.2.1.3-1. which has ends set",
|
/* 6*/ { BARCODE_DBAR_STK, -1, "0001234567890", 0, 3, 50, 1, "24724:2011 Figure 5 — GS1 DataBar Stacked NOTE: Figure 5 separator differs from GGS Figure 5.5.2.1.3-1. which has ends set",
|
||||||
"01010100100000000100111111100001011100101101111010"
|
"01010100100000000100111111100001011100101101111010"
|
||||||
"00001010101011111010000000111010100011010010000000"
|
"00001010101011111010000000111010100011010010000000"
|
||||||
"10111001010110000101111111000111001100111101110101"
|
"10111001010110000101111111000111001100111101110101"
|
||||||
},
|
},
|
||||||
/* 7*/ { BARCODE_DBAR_OMNSTK, -1, "0003456789012", 5, 50, 1, "24724:2011 Figure 6 — GS1 DataBar Stacked Omnidirectional",
|
/* 7*/ { BARCODE_DBAR_OMNSTK, -1, "0003456789012", 0, 5, 50, 1, "24724:2011 Figure 6 — GS1 DataBar Stacked Omnidirectional",
|
||||||
"01010100100000000100111110000001010011100110011010"
|
"01010100100000000100111110000001010011100110011010"
|
||||||
"00001011011111111010000001010100101100011001100000"
|
"00001011011111111010000001010100101100011001100000"
|
||||||
"00000101010101010101010101010101010101010101010000"
|
"00000101010101010101010101010101010101010101010000"
|
||||||
"00001000100010111010010101010000111101001101110000"
|
"00001000100010111010010101010000111101001101110000"
|
||||||
"10110111011101000101100000000111000010110010001101"
|
"10110111011101000101100000000111000010110010001101"
|
||||||
},
|
},
|
||||||
/* 8*/ { BARCODE_DBAR_LTD, -1, "1501234567890", 1, 79, 1, "24724:2011 Figure 7 — GS1 DataBar Limited",
|
/* 8*/ { BARCODE_DBAR_LTD, -1, "1501234567890", 0, 1, 79, 1, "24724:2011 Figure 7 — GS1 DataBar Limited",
|
||||||
"0100011001100011011010100111010010101101001101001001011000110111001100110100000"
|
"0100011001100011011010100111010010101101001101001001011000110111001100110100000"
|
||||||
},
|
},
|
||||||
/* 9*/ { BARCODE_DBAR_LTD, -1, "0031234567890", 1, 79, 1, "24724:2011 Figure 8 — (a) GS1 DataBar Limited",
|
/* 9*/ { BARCODE_DBAR_LTD, -1, "0031234567890", 0, 1, 79, 1, "24724:2011 Figure 8 — (a) GS1 DataBar Limited",
|
||||||
"0101010000010010001000010111001010110110100101011000001010010010110000010100000"
|
"0101010000010010001000010111001010110110100101011000001010010010110000010100000"
|
||||||
},
|
},
|
||||||
/* 10*/ { BARCODE_DBAR_EXP, -1, "[01]98898765432106[3202]012345[15]991231", 1, 200, 1, "24724:2011 Figure 10 — GS1 DataBar Expanded",
|
/* 10*/ { BARCODE_DBAR_EXP, -1, "[01]98898765432106[3202]012345[15]991231", 0, 1, 200, 1, "24724:2011 Figure 10 — GS1 DataBar Expanded",
|
||||||
"01001000011000110110111111110000101110000110010100011010000001100010101111110000111010011100000010010100111110111001100011111100001011101100000100100100011110010110001011111111001110001101111010000101"
|
"01001000011000110110111111110000101110000110010100011010000001100010101111110000111010011100000010010100111110111001100011111100001011101100000100100100011110010110001011111111001110001101111010000101"
|
||||||
},
|
},
|
||||||
/* 11*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3103]001750", 1, 151, 1, "24724:2011 Figure 11 — GS1 DataBar Expanded",
|
/* 11*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3103]001750", 0, 1, 151, 1, "24724:2011 Figure 11 — GS1 DataBar Expanded",
|
||||||
"0101110010000010011011111111000010111000010011000101011110111001100010111100000011100101110001110111011110101111000110001111110000101011000010011111010"
|
"0101110010000010011011111111000010111000010011000101011110111001100010111100000011100101110001110111011110101111000110001111110000101011000010011111010"
|
||||||
},
|
},
|
||||||
/* 12*/ { BARCODE_DBAR_EXPSTK, -1, "[01]98898765432106[3202]012345[15]991231", 5, 102, 1, "24724:2011 Figure 12 — GS1 DataBar Expanded Stacked symbol",
|
/* 12*/ { BARCODE_DBAR_EXPSTK, -1, "[01]98898765432106[3202]012345[15]991231", 0, 5, 102, 1, "24724:2011 Figure 12 — GS1 DataBar Expanded Stacked symbol",
|
||||||
"010010000110001101101111111100001011100001100101000110100000011000101011111100001110100111000000100101"
|
"010010000110001101101111111100001011100001100101000110100000011000101011111100001110100111000000100101"
|
||||||
"000001111001110010010000000010100100011110011010111001011111100111010100000010100001011000111111010000"
|
"000001111001110010010000000010100100011110011010111001011111100111010100000010100001011000111111010000"
|
||||||
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
||||||
"000011101000010011100001000000001011100101100001110110110111110010001001010000001010011000100000110000"
|
"000011101000010011100001000000001011100101100001110110110111110010001001010000001010011000100000110000"
|
||||||
"101000010111101100011100111111110100011010011110001001001000001101110100001111110001100111011111001010"
|
"101000010111101100011100111111110100011010011110001001001000001101110100001111110001100111011111001010"
|
||||||
},
|
},
|
||||||
/* 13*/ { BARCODE_DBAR_EXPSTK, -1, "[01]95012345678903[3103]000123", 5, 102, 1, "24724:2011 Figure 13 — GS1 DataBar Expanded Stacked",
|
/* 13*/ { BARCODE_DBAR_EXPSTK, -1, "[01]95012345678903[3103]000123", 0, 5, 102, 1, "24724:2011 Figure 13 — GS1 DataBar Expanded Stacked",
|
||||||
"010100010001111000101111111100001010111000001100010111000110001001101011110000001110010111000111011101"
|
"010100010001111000101111111100001010111000001100010111000110001001101011110000001110010111000111011101"
|
||||||
"000011101110000111010000000010100101000111110011101000111001110110010100001010100001101000111000100000"
|
"000011101110000111010000000010100101000111110011101000111001110110010100001010100001101000111000100000"
|
||||||
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
||||||
"000000001010000111001010000001010010111011011111100000000000000000000000000000000000000000000000000000"
|
"000000001010000111001010000001010010111011011111100000000000000000000000000000000000000000000000000000"
|
||||||
"001011110101111000110001111110000101000100100000011010000000000000000000000000000000000000000000000000"
|
"001011110101111000110001111110000101000100100000011010000000000000000000000000000000000000000000000000"
|
||||||
},
|
},
|
||||||
/* 14*/ { BARCODE_DBAR_LTD, -1, "0009876543210", 1, 79, 1, "24724:2011 Figure F.2 — GS1 DataBar Limited",
|
/* 14*/ { BARCODE_DBAR_LTD, -1, "0009876543210", 0, 1, 79, 1, "24724:2011 Figure F.2 — GS1 DataBar Limited",
|
||||||
"0101010010010011000011000001010110100101100101000100010100010000010010010100000"
|
"0101010010010011000011000001010110100101100101000100010100010000010010010100000"
|
||||||
},
|
},
|
||||||
/* 15*/ { BARCODE_DBAR_EXP, -1, "[10]12A", 1, 102, 1, "24724:2011 Figure F.3 — GS1 DataBar Expanded",
|
/* 15*/ { BARCODE_DBAR_EXP, -1, "[10]12A", 0, 1, 102, 1, "24724:2011 Figure F.3 — GS1 DataBar Expanded",
|
||||||
"010100000110100000101111111100001010001000000010110101111100100111001011110000000010011101111111010101"
|
"010100000110100000101111111100001010001000000010110101111100100111001011110000000010011101111111010101"
|
||||||
},
|
},
|
||||||
/* 16*/ { BARCODE_DBAR_STK, -1, "0000000000000", 3, 50, 1, "#183 GS1 DataBar Stacked separator alternation; verified manually against tec-it.com",
|
/* 16*/ { BARCODE_DBAR_STK, -1, "0000000000000", 0, 3, 50, 1, "#183 GS1 DataBar Stacked separator alternation; verified manually against tec-it.com",
|
||||||
"01010100100000000100011111111001011111110010101010"
|
"01010100100000000100011111111001011111110010101010"
|
||||||
"00000101011111111010100000001010100000001101010000"
|
"00000101011111111010100000001010100000001101010000"
|
||||||
"10101010110000000101111111110111011111111011010101"
|
"10101010110000000101111111110111011111111011010101"
|
||||||
},
|
},
|
||||||
/* 17*/ { BARCODE_DBAR_EXP, -1, "[255]95011015340010123456789", 1, 232, 1, "GGS 2.6.2.1 Example 1",
|
/* 17*/ { BARCODE_DBAR_EXP, -1, "[255]95011015340010123456789", 0, 1, 232, 1, "GGS 2.6.2.1 Example 1",
|
||||||
"0100011000110001011011111111000010100000010101100001100001100111001010111110000001100100001110100001001000011011111010001111110000101001011111100111011001000111100100101111111100111011111001100100110010011100010111100011110000001010"
|
"0100011000110001011011111111000010100000010101100001100001100111001010111110000001100100001110100001001000011011111010001111110000101001011111100111011001000111100100101111111100111011111001100100110010011100010111100011110000001010"
|
||||||
},
|
},
|
||||||
/* 18*/ { BARCODE_DBAR_EXP, -1, "[255]95011015340010123456789[3900]000", 1, 298, 1, "GGS 2.6.2.1 Example 2",
|
/* 18*/ { BARCODE_DBAR_EXP, -1, "[255]95011015340010123456789[3900]000", 0, 1, 298, 1, "GGS 2.6.2.1 Example 2",
|
||||||
"0101100011111010001011111111000010100001000001001101100001100111001010111110000001100100001110100001001000011011111010001111110000101001011111100111011001000111100100101111111100111011111001100100110010011100010111100011000000001010111111011101000100001000110001101011111111100110011110010010001101"
|
"0101100011111010001011111111000010100001000001001101100001100111001010111110000001100100001110100001001000011011111010001111110000101001011111100111011001000111100100101111111100111011111001100100110010011100010111100011000000001010111111011101000100001000110001101011111111100110011110010010001101"
|
||||||
},
|
},
|
||||||
/* 19*/ { BARCODE_DBAR_EXP, -1, "[255]9501101534001[17]160531[3902]050", 1, 281, 1, "GGS 2.6.2.1 Example 3",
|
/* 19*/ { BARCODE_DBAR_EXP, -1, "[255]9501101534001[17]160531[3902]050", 0, 1, 281, 1, "GGS 2.6.2.1 Example 3",
|
||||||
"01011001000110011110111111110000101000000101011000011000011001110010101111100000011001000011101000010010000110111110100011111100001010010111111001110111000010010100001011111111001110000100001100110100010000001101001000110000000010111010011110011101110010110001100010111111111001101"
|
"01011001000110011110111111110000101000000101011000011000011001110010101111100000011001000011101000010010000110111110100011111100001010010111111001110111000010010100001011111111001110000100001100110100010000001101001000110000000010111010011110011101110010110001100010111111111001101"
|
||||||
},
|
},
|
||||||
/* 20*/ { BARCODE_DBAR_EXPSTK, 3, "[255]9501101534001012345[8111]0500", 5, 151, 1, "GGS 2.6.2.1 Example 4, same (tec-it separator differs)",
|
/* 20*/ { BARCODE_DBAR_EXPSTK, 3, "[255]9501101534001012345[8111]0500", 0, 5, 151, 1, "GGS 2.6.2.1 Example 4, same (tec-it separator differs)",
|
||||||
"0101100111100011001011111111000010100000010101100001100001100111001010111110000001100100001110100001001000011011111010001111110000101001011111100111010"
|
"0101100111100011001011111111000010100000010101100001100001100111001010111110000001100100001110100001001000011011111010001111110000101001011111100111010"
|
||||||
"0000011000011100110100000000101001011111101010011110011110011000110101000001010100011011110001011110110111100100000101010000001010010110100000011000000"
|
"0000011000011100110100000000101001011111101010011110011110011000110101000001010100011011110001011110110111100100000101010000001010010110100000011000000"
|
||||||
"0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000"
|
"0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000"
|
||||||
"0000110111000011011010000000010000100000100111011001100001100100010010100101010100101110110001111001011101100011101110100000000010000000000000000000000"
|
"0000110111000011011010000000010000100000100111011001100001100100010010100101010100101110110001111001011101100011101110100000000010000000000000000000000"
|
||||||
"1011001000111100100101111111100111011111011000100110011110011011101100011000000001010001001110000110100010011100010001011111111100110100000000000000000"
|
"1011001000111100100101111111100111011111011000100110011110011011101100011000000001010001001110000110100010011100010001011111111100110100000000000000000"
|
||||||
},
|
},
|
||||||
/* 21*/ { BARCODE_DBAR_EXPSTK, 3, "[255]9501101534001[3941]0035", 5, 151, 1, "GGS 2.6.2.1 Example 5, same (tec-it separator differs)",
|
/* 21*/ { BARCODE_DBAR_EXPSTK, 3, "[255]9501101534001[3941]0035", 0, 5, 151, 1, "GGS 2.6.2.1 Example 5, same (tec-it separator differs)",
|
||||||
"0100001101011000011011111111000010100000010101100001100001100111001010111110000001100100001110100001001000011011111010001111110000101001011111100111010"
|
"0100001101011000011011111111000010100000010101100001100001100111001010111110000001100100001110100001001000011011111010001111110000101001011111100111010"
|
||||||
"0000110010100111100100000000101001011111101010011110011110011000110101000001010100011011110001011110110111100100000101010000001010010110100000011000000"
|
"0000110010100111100100000000101001011111101010011110011110011000110101000001010100011011110001011110110111100100000101010000001010010110100000011000000"
|
||||||
"0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000"
|
"0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000"
|
||||||
"0000011011111011111010000000010000111100101011111001000100011100111010100001010100000000000000000000000000000000000000000000000000000000000000000000000"
|
"0000011011111011111010000000010000111100101011111001000100011100111010100001010100000000000000000000000000000000000000000000000000000000000000000000000"
|
||||||
"1010100100000100000101111111100111000011010100000110111011100011000100011110000001010000000000000000000000000000000000000000000000000000000000000000000"
|
"1010100100000100000101111111100111000011010100000110111011100011000100011110000001010000000000000000000000000000000000000000000000000000000000000000000"
|
||||||
},
|
},
|
||||||
/* 22*/ { BARCODE_DBAR_OMN, -1, "0950110153000", 1, 96, 1, "https://www.gs1.org/standards/barcodes/databar, same, verified manually against tec-it",
|
/* 22*/ { BARCODE_DBAR_OMN, -1, "0950110153000", 0, 1, 96, 1, "https://www.gs1.org/standards/barcodes/databar, same, verified manually against tec-it",
|
||||||
"010000010100000101000111111110010111101101011100100011011011000101111110000011001110110111001101"
|
"010000010100000101000111111110010111101101011100100011011011000101111110000011001110110111001101"
|
||||||
},
|
},
|
||||||
/* 23*/ { BARCODE_DBAR_STK, -1, "0950110153000", 3, 50, 1, "https://www.gs1.org/standards/barcodes/databar, same, verified manually against tec-it",
|
/* 23*/ { BARCODE_DBAR_STK, -1, "0950110153000", 0, 3, 50, 1, "https://www.gs1.org/standards/barcodes/databar, same, verified manually against tec-it",
|
||||||
"01000001010000010100011111111001011110110101110010"
|
"01000001010000010100011111111001011110110101110010"
|
||||||
"00001100101101101010100001010100100001001010100000"
|
"00001100101101101010100001010100100001001010100000"
|
||||||
"10100011011011000101111110000011001110110111001101"
|
"10100011011011000101111110000011001110110111001101"
|
||||||
},
|
},
|
||||||
/* 24*/ { BARCODE_DBAR_EXPSTK, -1, "[01]09501101530003[17]140704[10]AB-123", 9, 102, 1, "https://www.gs1.org/standards/barcodes/databar, same (tec-it separator differs)",
|
/* 24*/ { BARCODE_DBAR_EXPSTK, -1, "[01]09501101530003[17]140704[10]AB-123", 0, 9, 102, 1, "https://www.gs1.org/standards/barcodes/databar, same (tec-it separator differs)",
|
||||||
"010101111100001001101111111100001011100001110110010100000011011010001011111000000110011010000001001101"
|
"010101111100001001101111111100001011100001110110010100000011011010001011111000000110011010000001001101"
|
||||||
"000010000011110110010000000010100100011110001001101011111100100101110100000101010001100101111110110000"
|
"000010000011110110010000000010100100011110001001101011111100100101110100000101010001100101111110110000"
|
||||||
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
||||||
@ -314,64 +315,64 @@ static void test_examples(int index, int generate, int debug) {
|
|||||||
"000010111101011110010100101010100100111100110010111001001100011111010100000000010000000000000000000000"
|
"000010111101011110010100101010100100111100110010111001001100011111010100000000010000000000000000000000"
|
||||||
"010001000010100001100011000000001011000011001101000110110011100000101011111111100110100000000000000000"
|
"010001000010100001100011000000001011000011001101000110110011100000101011111111100110100000000000000000"
|
||||||
},
|
},
|
||||||
/* 25*/ { BARCODE_DBAR_EXP, -1, "[01]09501101530003[17]140704[10]AB-123", 1, 281, 1, "https://www.gs1.org/standards/barcodes/databar, same, verified manually against tec-it",
|
/* 25*/ { BARCODE_DBAR_EXP, -1, "[01]09501101530003[17]140704[10]AB-123", 0, 1, 281, 1, "https://www.gs1.org/standards/barcodes/databar, same, verified manually against tec-it",
|
||||||
"01010111110000100110111111110000101110000111011001010000001101101000101111100000011001101000000100110001110100010001100011111100001010100000111100100100100111000001001011111111001110000011011001000100010000101000011000110000000010110000110011010001101100111000001010111111111001101"
|
"01010111110000100110111111110000101110000111011001010000001101101000101111100000011001101000000100110001110100010001100011111100001010100000111100100100100111000001001011111111001110000011011001000100010000101000011000110000000010110000110011010001101100111000001010111111111001101"
|
||||||
},
|
},
|
||||||
/* 26*/ { BARCODE_DBAR_STK, -1, "07010001234567", 3, 50, 1, "https://www.gs1.no/support/standardbibliotek/datafangst/gs1-databar, same, verified manually against tec-it",
|
/* 26*/ { BARCODE_DBAR_STK, -1, "07010001234567", 0, 3, 50, 1, "https://www.gs1.no/support/standardbibliotek/datafangst/gs1-databar, same, verified manually against tec-it",
|
||||||
"01000100001010000100011100000001011000100110001010"
|
"01000100001010000100011100000001011000100110001010"
|
||||||
"00000011010101011010101011111010100111010101010000"
|
"00000011010101011010101011111010100111010101010000"
|
||||||
"10111100101110100101100000000111011000001000110101"
|
"10111100101110100101100000000111011000001000110101"
|
||||||
},
|
},
|
||||||
/* 27*/ { BARCODE_DBAR_OMNSTK, -1, "12380000000008", 5, 50, 1, "Example with finder values 3 & 3; for bottom row see 5.3.2.2, same as BWIPP (tec-it and IDAutomation differ (ie no shift))",
|
/* 27*/ { BARCODE_DBAR_OMNSTK, -1, "12380000000008", 0, 5, 50, 1, "Example with finder values 3 & 3; for bottom row see 5.3.2.2, same as BWIPP (tec-it and IDAutomation differ (ie no shift))",
|
||||||
"01011101001000000100010000000001010000001101011010"
|
"01011101001000000100010000000001010000001101011010"
|
||||||
"00000010110111111010101010101010101111110010100000"
|
"00000010110111111010101010101010101111110010100000"
|
||||||
"00000101010101010101010101010101010101010101010000"
|
"00000101010101010101010101010101010101010101010000"
|
||||||
"00001101100011001010000000000100101100111011110000"
|
"00001101100011001010000000000100101100111011110000"
|
||||||
"10100010011100110101111111110111010011000100001101"
|
"10100010011100110101111111110111010011000100001101"
|
||||||
},
|
},
|
||||||
/* 28*/ { BARCODE_DBAR_OMNSTK, -1, "99991234912372", 5, 50, 1, "Example with finder values 8 & 6, same as BWIPP, verified manually against tec-it and IDAutomation",
|
/* 28*/ { BARCODE_DBAR_OMNSTK, -1, "99991234912372", 0, 5, 50, 1, "Example with finder values 8 & 6, same as BWIPP, verified manually against tec-it and IDAutomation",
|
||||||
"01001011101110000101110000000001011111011100101010"
|
"01001011101110000101110000000001011111011100101010"
|
||||||
"00000100010001111010001010101010100000100011010000"
|
"00000100010001111010001010101010100000100011010000"
|
||||||
"00000101010101010101010101010101010101010101010000"
|
"00000101010101010101010101010101010101010101010000"
|
||||||
"00001000100011001010000000010100100001000100100000"
|
"00001000100011001010000000010100100001000100100000"
|
||||||
"10100111011100110101111111100011011110111011011101"
|
"10100111011100110101111111100011011110111011011101"
|
||||||
},
|
},
|
||||||
/* 29*/ { BARCODE_DBAR_OMNSTK, -1, "32219876543217", 5, 50, 1, "Example with finder values 6 & 1, same as BWIPP, verified manually against tec-it and IDAutomation",
|
/* 29*/ { BARCODE_DBAR_OMNSTK, -1, "32219876543217", 0, 5, 50, 1, "Example with finder values 6 & 1, same as BWIPP, verified manually against tec-it and IDAutomation",
|
||||||
"01001011000010001100111000000001011100010101000010"
|
"01001011000010001100111000000001011100010101000010"
|
||||||
"00000100111101110010000101010100100011101010110000"
|
"00000100111101110010000101010100100011101010110000"
|
||||||
"00000101010101010101010101010101010101010101010000"
|
"00000101010101010101010101010101010101010101010000"
|
||||||
"00001110011100101010000010101000110100001000010000"
|
"00001110011100101010000010101000110100001000010000"
|
||||||
"10110001100011010101111100000111001011110111100101"
|
"10110001100011010101111100000111001011110111100101"
|
||||||
},
|
},
|
||||||
/* 30*/ { BARCODE_DBAR_OMNSTK, -1, "32219876543255", 5, 50, 1, "Example with finder values 7 & 7, same as BWIPP, verified manually against tec-it and IDAutomation",
|
/* 30*/ { BARCODE_DBAR_OMNSTK, -1, "32219876543255", 0, 5, 50, 1, "Example with finder values 7 & 7, same as BWIPP, verified manually against tec-it and IDAutomation",
|
||||||
"01001011000010001101111100000001011100010101000010"
|
"01001011000010001101111100000001011100010101000010"
|
||||||
"00000100111101110010000010101010100011101010110000"
|
"00000100111101110010000010101010100011101010110000"
|
||||||
"00000101010101010101010101010101010101010101010000"
|
"00000101010101010101010101010101010101010101010000"
|
||||||
"00000111001110101010000000101010110100001000010000"
|
"00000111001110101010000000101010110100001000010000"
|
||||||
"10111000110001010101111111000001001011110111100101"
|
"10111000110001010101111111000001001011110111100101"
|
||||||
},
|
},
|
||||||
/* 31*/ { BARCODE_DBAR_OMNSTK, -1, "04072912296211", 5, 50, 1, "Example with finder values 7 & 8, same as BWIPP, verified manually against tec-it and IDAutomation",
|
/* 31*/ { BARCODE_DBAR_OMNSTK, -1, "04072912296211", 0, 5, 50, 1, "Example with finder values 7 & 8, same as BWIPP, verified manually against tec-it and IDAutomation",
|
||||||
"01001001000000010101111100000001011111000100101010"
|
"01001001000000010101111100000001011111000100101010"
|
||||||
"00000110111111101010000010101010100000111011010000"
|
"00000110111111101010000010101010100000111011010000"
|
||||||
"00000101010101010101010101010101010101010101010000"
|
"00000101010101010101010101010101010101010101010000"
|
||||||
"00001110100010111010000000001010111010000111010000"
|
"00001110100010111010000000001010111010000111010000"
|
||||||
"10110001011101000101111111110001000101111000101101"
|
"10110001011101000101111111110001000101111000101101"
|
||||||
},
|
},
|
||||||
/* 32*/ { BARCODE_DBAR_OMNSTK, -1, "06666666666666", 5, 50, 1, "Example with finder values 6 & 4, same as BWIPP, verified manually against tec-it and IDAutomation",
|
/* 32*/ { BARCODE_DBAR_OMNSTK, -1, "06666666666666", 0, 5, 50, 1, "Example with finder values 6 & 4, same as BWIPP, verified manually against tec-it and IDAutomation",
|
||||||
"01000100010010000100111000000001011110111100101010"
|
"01000100010010000100111000000001011110111100101010"
|
||||||
"00001011101101111010000101010100100001000011010000"
|
"00001011101101111010000101010100100001000011010000"
|
||||||
"00000101010101010101010101010101010101010101010000"
|
"00000101010101010101010101010101010101010101010000"
|
||||||
"00000100011111001010000101010100101001100001110000"
|
"00000100011111001010000101010100101001100001110000"
|
||||||
"10101011100000110101111000000011010110011110000101"
|
"10101011100000110101111000000011010110011110000101"
|
||||||
},
|
},
|
||||||
/* 33*/ { BARCODE_DBAR_EXPSTK, -1, "[90]12345678901234567", 5, 102, 1, "Example with 7 chars, 1 full row, bottom 3 chars",
|
/* 33*/ { BARCODE_DBAR_EXPSTK, -1, "[90]12345678901234567", 0, 5, 102, 1, "Example with 7 chars, 1 full row, bottom 3 chars",
|
||||||
"010010100001111000101111111100001010000010001110110100111110001011101011111100001110001111010011000101"
|
"010010100001111000101111111100001010000010001110110100111110001011101011111100001110001111010011000101"
|
||||||
"000001011110000111010000000010100101111101110001001011000001110100010100000010100001110000101100110000"
|
"000001011110000111010000000010100101111101110001001011000001110100010100000010100001110000101100110000"
|
||||||
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
||||||
"000000100000000101111110110001101011110001110011010100101000000101000010010111000000000000000000000000"
|
"000000100000000101111110110001101011110001110011010100101000000101000010010111000000000000000000000000"
|
||||||
"101110011111111010000001001110010100001110001100101010000111111000111101101000111101000000000000000000"
|
"101110011111111010000001001110010100001110001100101010000111111000111101101000111101000000000000000000"
|
||||||
},
|
},
|
||||||
/* 34*/ { BARCODE_DBAR_EXPSTK, -1, "[90]123456789012345678901234567", 9, 102, 1, "Example with 10 chars, 2 full rows, bottom 2 chars",
|
/* 34*/ { BARCODE_DBAR_EXPSTK, -1, "[90]123456789012345678901234567", 0, 9, 102, 1, "Example with 10 chars, 2 full rows, bottom 2 chars",
|
||||||
"010000111100100010101111111100001010001000100000110100111110001011101011111000000110001111010011000101"
|
"010000111100100010101111111100001010001000100000110100111110001011101011111000000110001111010011000101"
|
||||||
"000011000011011101010000000010100101110111011111001011000001110100010100000101010001110000101100110000"
|
"000011000011011101010000000010100101110111011111001011000001110100010100000101010001110000101100110000"
|
||||||
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
||||||
@ -382,7 +383,7 @@ static void test_examples(int index, int generate, int debug) {
|
|||||||
"000010000110110001010100001010100100000111010011000000000000000000000000000000000000000000000000000000"
|
"000010000110110001010100001010100100000111010011000000000000000000000000000000000000000000000000000000"
|
||||||
"010001111001001110100011110000001011111000101100100100000000000000000000000000000000000000000000000000"
|
"010001111001001110100011110000001011111000101100100100000000000000000000000000000000000000000000000000"
|
||||||
},
|
},
|
||||||
/* 35*/ { BARCODE_DBAR_EXPSTK, -1, "[90]123456789012345678901234567890", 9, 102, 1, "Example with 11 chars, 2 full rows, bottom 3 chars",
|
/* 35*/ { BARCODE_DBAR_EXPSTK, -1, "[90]123456789012345678901234567890", 0, 9, 102, 1, "Example with 11 chars, 2 full rows, bottom 3 chars",
|
||||||
"010111011100010001101111111100001010000010001110110100111110001011101011111000000110001111010011000101"
|
"010111011100010001101111111100001010000010001110110100111110001011101011111000000110001111010011000101"
|
||||||
"000000100011101110010000000010100101111101110001001011000001110100010100000101010001110000101100110000"
|
"000000100011101110010000000010100101111101110001001011000001110100010100000101010001110000101100110000"
|
||||||
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
||||||
@ -393,7 +394,7 @@ static void test_examples(int index, int generate, int debug) {
|
|||||||
"000010000110110001010100101010100100111000100011011011000110001101110100000000010000000000000000000000"
|
"000010000110110001010100101010100100111000100011011011000110001101110100000000010000000000000000000000"
|
||||||
"010001111001001110100011000000001011000111011100100100111001110010001011111111100110100000000000000000"
|
"010001111001001110100011000000001011000111011100100100111001110010001011111111100110100000000000000000"
|
||||||
},
|
},
|
||||||
/* 36*/ { BARCODE_DBAR_EXPSTK, -1, "[91]1234567890123456789012345678901234", 9, 102, 1, "Example with 12 chars, 3 full rows",
|
/* 36*/ { BARCODE_DBAR_EXPSTK, -1, "[91]1234567890123456789012345678901234", 0, 9, 102, 1, "Example with 12 chars, 3 full rows",
|
||||||
"010100010011111001101111111100001011001000010000010100111110001011101011111000000110001111010011000101"
|
"010100010011111001101111111100001011001000010000010100111110001011101011111000000110001111010011000101"
|
||||||
"000011101100000110010000000010100100110111101111101011000001110100010100000101010001110000101100110000"
|
"000011101100000110010000000010100100110111101111101011000001110100010100000101010001110000101100110000"
|
||||||
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
||||||
@ -404,7 +405,7 @@ static void test_examples(int index, int generate, int debug) {
|
|||||||
"000010000110110001010100101010100100111000100011011011000110001110110100000000010001101110100001000000"
|
"000010000110110001010100101010100100111000100011011011000110001110110100000000010001101110100001000000"
|
||||||
"010001111001001110100011000000001011000111011100100100111001110001001011111111100110010001011110111101"
|
"010001111001001110100011000000001011000111011100100100111001110001001011111111100110010001011110111101"
|
||||||
},
|
},
|
||||||
/* 37*/ { BARCODE_DBAR_EXPSTK, -1, "[91]123456789012345678901234567890123456789012", 13, 102, 1, "Example with 15 chars, 3 full rows, bottom 7 chars",
|
/* 37*/ { BARCODE_DBAR_EXPSTK, -1, "[91]123456789012345678901234567890123456789012", 0, 13, 102, 1, "Example with 15 chars, 3 full rows, bottom 7 chars",
|
||||||
"010010000111101011101111111100001011100000101100010100111110001011101011110000000010001111010011000101"
|
"010010000111101011101111111100001011100000101100010100111110001011101011110000000010001111010011000101"
|
||||||
"000001111000010100010000000010100100011111010011101011000001110100010100001010101001110000101100110000"
|
"000001111000010100010000000010100100011111010011101011000001110100010100001010101001110000101100110000"
|
||||||
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
||||||
@ -419,7 +420,7 @@ static void test_examples(int index, int generate, int debug) {
|
|||||||
"000000100000000101001001111101100011000010000110010100101010100101011111011100100000000000000000000000"
|
"000000100000000101001001111101100011000010000110010100101010100101011111011100100000000000000000000000"
|
||||||
"101110011111111010110110000010011100111101111001101010000000011000100000100011011101000000000000000000"
|
"101110011111111010110110000010011100111101111001101010000000011000100000100011011101000000000000000000"
|
||||||
},
|
},
|
||||||
/* 38*/ { BARCODE_DBAR_EXPSTK, 3, "[91]123456789012345678901234567890123456789012", 9, 151, 1, "Example with 15 chars, 2 full rows, bottom 3 chars",
|
/* 38*/ { BARCODE_DBAR_EXPSTK, 3, "[91]123456789012345678901234567890123456789012", 0, 9, 151, 1, "Example with 15 chars, 2 full rows, bottom 3 chars",
|
||||||
"0100100001111010111011111111000010111000001011000101001111100010111010111100000000100011110100110001011110001011011110001111110000101010011000111000010"
|
"0100100001111010111011111111000010111000001011000101001111100010111010111100000000100011110100110001011110001011011110001111110000101010011000111000010"
|
||||||
"0000011110000101000100000000101001000111110100111010110000011101000101000010101010011100001011001110100001110100100001010000001010010101100111000110000"
|
"0000011110000101000100000000101001000111110100111010110000011101000101000010101010011100001011001110100001110100100001010000001010010101100111000110000"
|
||||||
"0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000"
|
"0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000"
|
||||||
@ -430,7 +431,7 @@ static void test_examples(int index, int generate, int debug) {
|
|||||||
"0000001001110111110101001010101001010011000010000110001101111100100101000000001000000000000000000000000000000000000000000000000000000000000000000000000"
|
"0000001001110111110101001010101001010011000010000110001101111100100101000000001000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||||
"0101110110001000001000110000000010101100111101111001110010000011011010111111110011101000000000000000000000000000000000000000000000000000000000000000000"
|
"0101110110001000001000110000000010101100111101111001110010000011011010111111110011101000000000000000000000000000000000000000000000000000000000000000000"
|
||||||
},
|
},
|
||||||
/* 39*/ { BARCODE_DBAR_EXPSTK, -1, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", 17, 102, 1, "Example with 19 chars, 4 full rows, bottom 3 chars",
|
/* 39*/ { BARCODE_DBAR_EXPSTK, -1, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", 0, 17, 102, 1, "Example with 19 chars, 4 full rows, bottom 3 chars",
|
||||||
"010101111100011101101111111100001011100000101100010101111110011110101011110000000010111000111110010101"
|
"010101111100011101101111111100001011100000101100010101111110011110101011110000000010111000111110010101"
|
||||||
"000010000011100010010000000010100100011111010011101010000001100001010100001010101001000111000001100000"
|
"000010000011100010010000000010100100011111010011101010000001100001010100001010101001000111000001100000"
|
||||||
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
||||||
@ -449,7 +450,7 @@ static void test_examples(int index, int generate, int debug) {
|
|||||||
"000010011111000111010001010101010101000111001111011011110100110000110100000000010000000000000000000000"
|
"000010011111000111010001010101010101000111001111011011110100110000110100000000010000000000000000000000"
|
||||||
"010101100000111000100110000000001010111000110000100100001011001111001011111111100110100000000000000000"
|
"010101100000111000100110000000001010111000110000100100001011001111001011111111100110100000000000000000"
|
||||||
},
|
},
|
||||||
/* 40*/ { BARCODE_DBAR_EXPSTK, -1, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 21, 102, 1, "Example with 22 chars, 5 full rows, bottom 2 chars",
|
/* 40*/ { BARCODE_DBAR_EXPSTK, -1, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 21, 102, 1, "Example with 22 chars, 5 full rows, bottom 2 chars",
|
||||||
"010101011110111111101111111100001011001000000101000100111110001011101011110000000010001111010011000101"
|
"010101011110111111101111111100001011001000000101000100111110001011101011110000000010001111010011000101"
|
||||||
"000010100001000000010000000010100100110111111010111011000001110100010100001010101001110000101100110000"
|
"000010100001000000010000000010100100110111111010111011000001110100010100001010101001110000101100110000"
|
||||||
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
||||||
@ -472,7 +473,7 @@ static void test_examples(int index, int generate, int debug) {
|
|||||||
"000001000111010000101000101010101010100001011000110000000000000000000000000000000000000000000000000000"
|
"000001000111010000101000101010101010100001011000110000000000000000000000000000000000000000000000000000"
|
||||||
"001000111000101111010011000000000101011110100111000010000000000000000000000000000000000000000000000000"
|
"001000111000101111010011000000000101011110100111000010000000000000000000000000000000000000000000000000"
|
||||||
},
|
},
|
||||||
/* 41*/ { BARCODE_DBAR_EXPSTK, 3, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 13, 151, 1, "Example with 22 chars, 3 full rows, bottom 4 chars",
|
/* 41*/ { BARCODE_DBAR_EXPSTK, 3, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 13, 151, 1, "Example with 22 chars, 3 full rows, bottom 4 chars",
|
||||||
"0101010111101111111011111111000010110010000001010001001111100010111010111100000000100011110100110001011110001011011110001111110000101010011000111000010"
|
"0101010111101111111011111111000010110010000001010001001111100010111010111100000000100011110100110001011110001011011110001111110000101010011000111000010"
|
||||||
"0000101000010000000100000000101001001101111110101110110000011101000101000010101010011100001011001110100001110100100001010000001010010101100111000110000"
|
"0000101000010000000100000000101001001101111110101110110000011101000101000010101010011100001011001110100001110100100001010000001010010101100111000110000"
|
||||||
"0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000"
|
"0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000"
|
||||||
@ -487,7 +488,7 @@ static void test_examples(int index, int generate, int debug) {
|
|||||||
"0000101110001000111010000000001000101111101000110001110001110100001010001010101010101000010110001100000000000000000000000000000000000000000000000000000"
|
"0000101110001000111010000000001000101111101000110001110001110100001010001010101010101000010110001100000000000000000000000000000000000000000000000000000"
|
||||||
"1010010001110111000101111111110011010000010111001110001110001011110100110000000001010111101001110000100000000000000000000000000000000000000000000000000"
|
"1010010001110111000101111111110011010000010111001110001110001011110100110000000001010111101001110000100000000000000000000000000000000000000000000000000"
|
||||||
},
|
},
|
||||||
/* 42*/ { BARCODE_DBAR_EXPSTK, 4, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 9, 200, 1, "Example with 22 chars, 2 full rows, bottom 6 chars",
|
/* 42*/ { BARCODE_DBAR_EXPSTK, 4, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 9, 200, 1, "Example with 22 chars, 2 full rows, bottom 6 chars",
|
||||||
"01010101111011111110111111110000101100100000010100010011111000101110101111000000001000111101001100010111100010110111100011111100001010100110001110000101001110000010001011110000001110001110001000100101"
|
"01010101111011111110111111110000101100100000010100010011111000101110101111000000001000111101001100010111100010110111100011111100001010100110001110000101001110000010001011110000001110001110001000100101"
|
||||||
"00001010000100000001000000001010010011011111101011101100000111010001010000101010100111000010110011101000011101001000010100000010100101011001110001111010110001111101110100001010100001110001110111010000"
|
"00001010000100000001000000001010010011011111101011101100000111010001010000101010100111000010110011101000011101001000010100000010100101011001110001111010110001111101110100001010100001110001110111010000"
|
||||||
"00000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
"00000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
||||||
@ -498,7 +499,7 @@ static void test_examples(int index, int generate, int debug) {
|
|||||||
"00000011000110001001000000010101010000011110011010101101110001000111010000000001000101111101000110001110001110100001010001010101010101000010110001100000000000000000000000000000000000000000000000000000"
|
"00000011000110001001000000010101010000011110011010101101110001000111010000000001000101111101000110001110001110100001010001010101010101000010110001100000000000000000000000000000000000000000000000000000"
|
||||||
"01011100111001110110011111100000101111100001100101010010001110111000101111111110011010000010111001110001110001011110100110000000001010111101001110000100000000000000000000000000000000000000000000000000"
|
"01011100111001110110011111100000101111100001100101010010001110111000101111111110011010000010111001110001110001011110100110000000001010111101001110000100000000000000000000000000000000000000000000000000"
|
||||||
},
|
},
|
||||||
/* 43*/ { BARCODE_DBAR_EXPSTK, 5, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 9, 249, 1, "Example with 22 chars, 2 full rows, bottom 2 chars",
|
/* 43*/ { BARCODE_DBAR_EXPSTK, 5, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 9, 249, 1, "Example with 22 chars, 2 full rows, bottom 2 chars",
|
||||||
"010101011110111111101111111100001011001000000101000100111110001011101011110000000010001111010011000101111000101101111000111111000010101001100011100001010011100000100010111100000011100011100010001001000111100100111010001111000000101100011101110010010"
|
"010101011110111111101111111100001011001000000101000100111110001011101011110000000010001111010011000101111000101101111000111111000010101001100011100001010011100000100010111100000011100011100010001001000111100100111010001111000000101100011101110010010"
|
||||||
"000010100001000000010000000010100100110111111010111011000001110100010100001010101001110000101100111010000111010010000101000000101001010110011100011110101100011111011101000010101000011100011101110110111000011011000101010000101010010011100010001100000"
|
"000010100001000000010000000010100100110111111010111011000001110100010100001010101001110000101100111010000111010010000101000000101001010110011100011110101100011111011101000010101000011100011101110110111000011011000101010000101010010011100010001100000"
|
||||||
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000"
|
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000"
|
||||||
@ -509,45 +510,45 @@ static void test_examples(int index, int generate, int debug) {
|
|||||||
"000010001110100001010001010101010101000010110001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
"000010001110100001010001010101010101000010110001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||||
"010001110001011110100110000000001010111101001110000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
"010001110001011110100110000000001010111101001110000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||||
},
|
},
|
||||||
/* 44*/ { BARCODE_DBAR_EXPSTK, 6, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 5, 298, 1, "Example with 22 chars, 1 full row, bottom 10 chars",
|
/* 44*/ { BARCODE_DBAR_EXPSTK, 6, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 5, 298, 1, "Example with 22 chars, 1 full row, bottom 10 chars",
|
||||||
"0101010111101111111011111111000010110010000001010001001111100010111010111100000000100011110100110001011110001011011110001111110000101010011000111000010100111000001000101111000000111000111000100010010001111001001110100011110000001011000111011100100100111001110001001011111111001110100001011110111101"
|
"0101010111101111111011111111000010110010000001010001001111100010111010111100000000100011110100110001011110001011011110001111110000101010011000111000010100111000001000101111000000111000111000100010010001111001001110100011110000001011000111011100100100111001110001001011111111001110100001011110111101"
|
||||||
"0000101000010000000100000000101001001101111110101110110000011101000101000010101010011100001011001110100001110100100001010000001010010101100111000111101011000111110111010000101010000111000111011101101110000110110001010100001010100100111000100011011011000110001110110100000000100001011110100001000000"
|
"0000101000010000000100000000101001001101111110101110110000011101000101000010101010011100001011001110100001110100100001010000001010010101100111000111101011000111110111010000101010000111000111011101101110000110110001010100001010100100111000100011011011000110001110110100000000100001011110100001000000"
|
||||||
"0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
"0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
||||||
"0000000100111011111010100101010100101001100001000011000100010111101110100000101010001100000110011010010001100011000100100000001010101000001111001101010110111000100011101000000000100010111110100011000111000111010000101000101010101010100001011000110000000000000000000000000000000000000000000000000000"
|
"0000000100111011111010100101010100101001100001000011000100010111101110100000101010001100000110011010010001100011000100100000001010101000001111001101010110111000100011101000000000100010111110100011000111000111010000101000101010101010100001011000110000000000000000000000000000000000000000000000000000"
|
||||||
"0010111011000100000100011000000001010110011110111100111011101000010001011111000000110011111001100101101110011100111011001111110000010111110000110010101001000111011100010111111111001101000001011100111000111000101111010011000000000101011110100111000010000000000000000000000000000000000000000000000000"
|
"0010111011000100000100011000000001010110011110111100111011101000010001011111000000110011111001100101101110011100111011001111110000010111110000110010101001000111011100010111111111001101000001011100111000111000101111010011000000000101011110100111000010000000000000000000000000000000000000000000000000"
|
||||||
},
|
},
|
||||||
/* 45*/ { BARCODE_DBAR_EXPSTK, 7, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 5, 347, 1, "Example with 22 chars, 1 full row, bottom 8 chars",
|
/* 45*/ { BARCODE_DBAR_EXPSTK, 7, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 5, 347, 1, "Example with 22 chars, 1 full row, bottom 8 chars",
|
||||||
"01010101111011111110111111110000101100100000010100010011111000101110101111000000001000111101001100010111100010110111100011111100001010100110001110000101001110000010001011110000001110001110001000100100011110010011101000111100000010110001110111001001001110011100010010111111110011101000010111101111011101100010000010001100000000101011001111011110010"
|
"01010101111011111110111111110000101100100000010100010011111000101110101111000000001000111101001100010111100010110111100011111100001010100110001110000101001110000010001011110000001110001110001000100100011110010011101000111100000010110001110111001001001110011100010010111111110011101000010111101111011101100010000010001100000000101011001111011110010"
|
||||||
"00001010000100000001000000001010010011011111101011101100000111010001010000101010100111000010110011101000011101001000010100000010100101011001110001111010110001111101110100001010100001110001110111011011100001101100010101000010101001001110001000110110110001100011101101000000001000010111101000010000100010011101111101010010101010010100110000100000000"
|
"00001010000100000001000000001010010011011111101011101100000111010001010000101010100111000010110011101000011101001000010100000010100101011001110001111010110001111101110100001010100001110001110111011011100001101100010101000010101001001110001000110110110001100011101101000000001000010111101000010000100010011101111101010010101010010100110000100000000"
|
||||||
"00000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000"
|
"00000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000"
|
||||||
"00000100010111101110100000101010001100000110011010010001100011000100100000001010101000001111001101010110111000100011101000000000100010111110100011000111000111010000101000101010101010100001011000110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
"00000100010111101110100000101010001100000110011010010001100011000100100000001010101000001111001101010110111000100011101000000000100010111110100011000111000111010000101000101010101010100001011000110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||||
"10111011101000010001011111000000110011111001100101101110011100111011001111110000010111110000110010101001000111011100010111111111001101000001011100111000111000101111010011000000000101011110100111000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
"10111011101000010001011111000000110011111001100101101110011100111011001111110000010111110000110010101001000111011100010111111111001101000001011100111000111000101111010011000000000101011110100111000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||||
},
|
},
|
||||||
/* 46*/ { BARCODE_DBAR_EXPSTK, 8, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 5, 396, 1, "Example with 22 chars, 1 full row, bottom 6 chars",
|
/* 46*/ { BARCODE_DBAR_EXPSTK, 8, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 5, 396, 1, "Example with 22 chars, 1 full row, bottom 6 chars",
|
||||||
"010101011110111111101111111100001011001000000101000100111110001011101011110000000010001111010011000101111000101101111000111111000010101001100011100001010011100000100010111100000011100011100010001001000111100100111010001111000000101100011101110010010011100111000100101111111100111010000101111011110111011000100000100011000000001010110011110111100111011101000010001011111000000110011111001100101101"
|
"010101011110111111101111111100001011001000000101000100111110001011101011110000000010001111010011000101111000101101111000111111000010101001100011100001010011100000100010111100000011100011100010001001000111100100111010001111000000101100011101110010010011100111000100101111111100111010000101111011110111011000100000100011000000001010110011110111100111011101000010001011111000000110011111001100101101"
|
||||||
"000010100001000000010000000010100100110111111010111011000001110100010100001010101001110000101100111010000111010010000101000000101001010110011100011110101100011111011101000010101000011100011101110110111000011011000101010000101010010011100010001101101100011000111011010000000010000101111010000100001000100111011111010100101010100101001100001000011000100010111101110100000101010001100000110011010000"
|
"000010100001000000010000000010100100110111111010111011000001110100010100001010101001110000101100111010000111010010000101000000101001010110011100011110101100011111011101000010101000011100011101110110111000011011000101010000101010010011100010001101101100011000111011010000000010000101111010000100001000100111011111010100101010100101001100001000011000100010111101110100000101010001100000110011010000"
|
||||||
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
||||||
"000000011000110001001000000010101010000011110011010101101110001000111010000000001000101111101000110001110001110100001010001010101010101000010110001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
"000000011000110001001000000010101010000011110011010101101110001000111010000000001000101111101000110001110001110100001010001010101010101000010110001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||||
"001011100111001110110011111100000101111100001100101010010001110111000101111111110011010000010111001110001110001011110100110000000001010111101001110000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
"001011100111001110110011111100000101111100001100101010010001110111000101111111110011010000010111001110001110001011110100110000000001010111101001110000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||||
},
|
},
|
||||||
/* 47*/ { BARCODE_DBAR_EXPSTK, 9, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 5, 445, 1, "Example with 22 chars, 1 full row, bottom 4 chars",
|
/* 47*/ { BARCODE_DBAR_EXPSTK, 9, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 5, 445, 1, "Example with 22 chars, 1 full row, bottom 4 chars",
|
||||||
"0101010111101111111011111111000010110010000001010001001111100010111010111100000000100011110100110001011110001011011110001111110000101010011000111000010100111000001000101111000000111000111000100010010001111001001110100011110000001011000111011100100100111001110001001011111111001110100001011110111101110110001000001000110000000010101100111101111001110111010000100010111110000001100111110011001011011100111001110110011111100000101111100001100101010"
|
"0101010111101111111011111111000010110010000001010001001111100010111010111100000000100011110100110001011110001011011110001111110000101010011000111000010100111000001000101111000000111000111000100010010001111001001110100011110000001011000111011100100100111001110001001011111111001110100001011110111101110110001000001000110000000010101100111101111001110111010000100010111110000001100111110011001011011100111001110110011111100000101111100001100101010"
|
||||||
"0000101000010000000100000000101001001101111110101110110000011101000101000010101010011100001011001110100001110100100001010000001010010101100111000111101011000111110111010000101010000111000111011101101110000110110001010100001010100100111000100011011011000110001110110100000000100001011110100001000010001001110111110101001010101001010011000010000110001000101111011101000001010100011000001100110100100011000110001001000000010101010000011110011010000"
|
"0000101000010000000100000000101001001101111110101110110000011101000101000010101010011100001011001110100001110100100001010000001010010101100111000111101011000111110111010000101010000111000111011101101110000110110001010100001010100100111000100011011011000110001110110100000000100001011110100001000010001001110111110101001010101001010011000010000110001000101111011101000001010100011000001100110100100011000110001001000000010101010000011110011010000"
|
||||||
"0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000"
|
"0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000"
|
||||||
"0000101110001000111010000000001000101111101000110001110001110100001010001010101010101000010110001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
"0000101110001000111010000000001000101111101000110001110001110100001010001010101010101000010110001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||||
"1010010001110111000101111111110011010000010111001110001110001011110100110000000001010111101001110000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
"1010010001110111000101111111110011010000010111001110001110001011110100110000000001010111101001110000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||||
},
|
},
|
||||||
/* 48*/ { BARCODE_DBAR_EXPSTK, 10, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 5, 494, 1, "Example with 22 chars, 1 full row, bottom 2 chars",
|
/* 48*/ { BARCODE_DBAR_EXPSTK, 10, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 5, 494, 1, "Example with 22 chars, 1 full row, bottom 2 chars",
|
||||||
"01010101111011111110111111110000101100100000010100010011111000101110101111000000001000111101001100010111100010110111100011111100001010100110001110000101001110000010001011110000001110001110001000100100011110010011101000111100000010110001110111001001001110011100010010111111110011101000010111101111011101100010000010001100000000101011001111011110011101110100001000101111100000011001111100110010110111001110011101100111111000001011111000011001010100100011101110001011111111100110100000101110011101"
|
"01010101111011111110111111110000101100100000010100010011111000101110101111000000001000111101001100010111100010110111100011111100001010100110001110000101001110000010001011110000001110001110001000100100011110010011101000111100000010110001110111001001001110011100010010111111110011101000010111101111011101100010000010001100000000101011001111011110011101110100001000101111100000011001111100110010110111001110011101100111111000001011111000011001010100100011101110001011111111100110100000101110011101"
|
||||||
"00001010000100000001000000001010010011011111101011101100000111010001010000101010100111000010110011101000011101001000010100000010100101011001110001111010110001111101110100001010100001110001110111011011100001101100010101000010101001001110001000110110110001100011101101000000001000010111101000010000100010011101111101010010101010010100110000100001100010001011110111010000010101000110000011001101001000110001100010010000000101010100000111100110101011011100010001110100000000010001011111010001100000"
|
"00001010000100000001000000001010010011011111101011101100000111010001010000101010100111000010110011101000011101001000010100000010100101011001110001111010110001111101110100001010100001110001110111011011100001101100010101000010101001001110001000110110110001100011101101000000001000010111101000010000100010011101111101010010101010010100110000100001100010001011110111010000010101000110000011001101001000110001100010010000000101010100000111100110101011011100010001110100000000010001011111010001100000"
|
||||||
"00000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
"00000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
||||||
"00000100011101000010100010101010101010000101100011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
"00000100011101000010100010101010101010000101100011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||||
"00100011100010111101001100000000010101111010011100001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
"00100011100010111101001100000000010101111010011100001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||||
},
|
},
|
||||||
/* 49*/ { BARCODE_DBAR_EXPSTK, 11, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 1, 543, 1, "Example with 22 chars, 1 row",
|
/* 49*/ { BARCODE_DBAR_EXPSTK, 11, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 1, 543, 1, "Example with 22 chars, 1 row",
|
||||||
"010101011110111111101111111100001011001000000101000100111110001011101011110000000010001111010011000101111000101101111000111111000010101001100011100001010011100000100010111100000011100011100010001001000111100100111010001111000000101100011101110010010011100111000100101111111100111010000101111011110111011000100000100011000000001010110011110111100111011101000010001011111000000110011111001100101101110011100111011001111110000010111110000110010101001000111011100010111111111001101000001011100111000111000101111010011000000000101011110100111000010"
|
"010101011110111111101111111100001011001000000101000100111110001011101011110000000010001111010011000101111000101101111000111111000010101001100011100001010011100000100010111100000011100011100010001001000111100100111010001111000000101100011101110010010011100111000100101111111100111010000101111011110111011000100000100011000000001010110011110111100111011101000010001011111000000110011111001100101101110011100111011001111110000010111110000110010101001000111011100010111111111001101000001011100111000111000101111010011000000000101011110100111000010"
|
||||||
},
|
},
|
||||||
/* 50*/ { BARCODE_DBAR_EXPSTK, 1, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 41, 53, 1, "Example with 22 chars, 11 rows",
|
/* 50*/ { BARCODE_DBAR_EXPSTK, 1, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 41, 53, 1, "Example with 22 chars, 11 rows",
|
||||||
"01010101111011111110111111110000101100100000010100010"
|
"01010101111011111110111111110000101100100000010100010"
|
||||||
"00001010000100000001000000001010010011011111101010000"
|
"00001010000100000001000000001010010011011111101010000"
|
||||||
"00000101010101010101010101010101010101010101010100000"
|
"00000101010101010101010101010101010101010101010100000"
|
||||||
@ -590,14 +591,14 @@ static void test_examples(int index, int generate, int debug) {
|
|||||||
"00001000111010000101000101010101010100001011000110000"
|
"00001000111010000101000101010101010100001011000110000"
|
||||||
"01000111000101111010011000000000101011110100111000010"
|
"01000111000101111010011000000000101011110100111000010"
|
||||||
},
|
},
|
||||||
/* 51*/ { BARCODE_DBAR_EXPSTK, 6, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 5, 298, 1, "#200 Daniel Gredler mostly empty last row, 16 chars, 2 rows, bottom row 4 chars",
|
/* 51*/ { BARCODE_DBAR_EXPSTK, 6, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 0, 5, 298, 1, "#200 Daniel Gredler mostly empty last row, 16 chars, 2 rows, bottom row 4 chars",
|
||||||
"0100011101110001011011111111000010110000100101111101101000000110001010111100000000101001110000001001010011111011100110001111110000101110101000011000011010011100011000101111000000111001111000111101010111110010110000100011110000001010110010000010000111011111000100101011111100001110011110011000100101"
|
"0100011101110001011011111111000010110000100101111101101000000110001010111100000000101001110000001001010011111011100110001111110000101110101000011000011010011100011000101111000000111001111000111101010111110010110000100011110000001010110010000010000111011111000100101011111100001110011110011000100101"
|
||||||
"0000100010001110100100000000101001001111011010000010010111111001110101000010101010010110001111110110101100000100011001010000001010010001010111100111100101100011100111010000101010000110000111000010101000001101001111010100001010100101001101111101111000100000111011010100000010100001100001100111010000"
|
"0000100010001110100100000000101001001111011010000010010111111001110101000010101010010110001111110110101100000100011001010000001010010001010111100111100101100011100111010000101010000110000111000010101000001101001111010100001010100101001101111101111000100000111011010100000010100001100001100111010000"
|
||||||
"0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
"0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
||||||
"0000110000010010011000010000000010111110011010001001111010011011100010010101010010101110100011111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
"0000110000010010011000010000000010111110011010001001111010011011100010010101010010101110100011111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||||
"1010001111101101100111001111111101000001100101110110000101100100011101000000001100010001011100000110100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
"1010001111101101100111001111111101000001100101110110000101100100011101000000001100010001011100000110100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||||
},
|
},
|
||||||
/* 52*/ { BARCODE_DBAR_EXPSTK, 3, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 9, 151, 1, "#200 16 chars, 3 rows, bottom row 4 chars",
|
/* 52*/ { BARCODE_DBAR_EXPSTK, 3, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 0, 9, 151, 1, "#200 16 chars, 3 rows, bottom row 4 chars",
|
||||||
"0100011101110001011011111111000010110000100101111101101000000110001010111100000000101001110000001001010011111011100110001111110000101110101000011000010"
|
"0100011101110001011011111111000010110000100101111101101000000110001010111100000000101001110000001001010011111011100110001111110000101110101000011000010"
|
||||||
"0000100010001110100100000000101001001111011010000010010111111001110101000010101010010110001111110110101100000100011001010000001010010001010111100110000"
|
"0000100010001110100100000000101001001111011010000010010111111001110101000010101010010110001111110110101100000100011001010000001010010001010111100110000"
|
||||||
"0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000"
|
"0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000"
|
||||||
@ -608,114 +609,170 @@ static void test_examples(int index, int generate, int debug) {
|
|||||||
"0000011111000101110101001010101001000111011001011110010001011001111101000000001000011001001000001100000000000000000000000000000000000000000000000000000"
|
"0000011111000101110101001010101001000111011001011110010001011001111101000000001000011001001000001100000000000000000000000000000000000000000000000000000"
|
||||||
"0101100000111010001000110000000010111000100110100001101110100110000010111111110011100110110111110001010000000000000000000000000000000000000000000000000"
|
"0101100000111010001000110000000010111000100110100001101110100110000010111111110011100110110111110001010000000000000000000000000000000000000000000000000"
|
||||||
},
|
},
|
||||||
/* 53*/ { BARCODE_DBAR_EXPSTK, 4, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 5, 200, 1, "#200 16 chars, 2 full rows",
|
/* 53*/ { BARCODE_DBAR_EXPSTK, 4, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 0, 5, 200, 1, "#200 16 chars, 2 full rows",
|
||||||
"01000111011100010110111111110000101100001001011111011010000001100010101111000000001010011100000010010100111110111001100011111100001011101010000110000110100111000110001011110000001110011110001111010101"
|
"01000111011100010110111111110000101100001001011111011010000001100010101111000000001010011100000010010100111110111001100011111100001011101010000110000110100111000110001011110000001110011110001111010101"
|
||||||
"00001000100011101001000000001010010011110110100000100101111110011101010000101010100101100011111101101011000001000110010100000010100100010101111001111001011000111001110100001010100001100001110000100000"
|
"00001000100011101001000000001010010011110110100000100101111110011101010000101010100101100011111101101011000001000110010100000010100100010101111001111001011000111001110100001010100001100001110000100000"
|
||||||
"00000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
"00000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
||||||
"00001100000100100110000100000000101111100110100010011110100110111000100101010100101011101000111110010110111001100001100001010000001010110111000001000111101111101100101001010100001010111100101100000000"
|
"00001100000100100110000100000000101111100110100010011110100110111000100101010100101011101000111110010110111001100001100001010000001010110111000001000111101111101100101001010100001010111100101100000000"
|
||||||
"10100011111011011001110011111111010000011001011101100001011001000111010000000011000100010111000001101001000110011110011100001111110101001000111110111000010000010011010100000011110001000011010011111010"
|
"10100011111011011001110011111111010000011001011101100001011001000111010000000011000100010111000001101001000110011110011100001111110101001000111110111000010000010011010100000011110001000011010011111010"
|
||||||
},
|
},
|
||||||
/* 54*/ { BARCODE_DBAR_EXPSTK, 5, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 5, 249, 1, "#200 16 chars, 2 rows, bottom row 6 chars",
|
/* 54*/ { BARCODE_DBAR_EXPSTK, 5, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 0, 5, 249, 1, "#200 16 chars, 2 rows, bottom row 6 chars",
|
||||||
"010001110111000101101111111100001011000010010111110110100000011000101011110000000010100111000000100101001111101110011000111111000010111010100001100001101001110001100010111100000011100111100011110101011111001011000010001111000000101011001000001000010"
|
"010001110111000101101111111100001011000010010111110110100000011000101011110000000010100111000000100101001111101110011000111111000010111010100001100001101001110001100010111100000011100111100011110101011111001011000010001111000000101011001000001000010"
|
||||||
"000010001000111010010000000010100100111101101000001001011111100111010100001010101001011000111111011010110000010001100101000000101001000101011110011110010110001110011101000010101000011000011100001010100000110100111101010000101010010100110111110110000"
|
"000010001000111010010000000010100100111101101000001001011111100111010100001010101001011000111111011010110000010001100101000000101001000101011110011110010110001110011101000010101000011000011100001010100000110100111101010000101010010100110111110110000"
|
||||||
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000"
|
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000"
|
||||||
"000001000001110110101000000101000011000011001110110100111110001011101010010101010010001110110010111100100010110011111010000000010000110010010000011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
"000001000001110110101000000101000011000011001110110100111110001011101010010101010010001110110010111100100010110011111010000000010000110010010000011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||||
"101110111110001001010111111000011100111100110001001011000001110100010001100000000101110001001101000011011101001100000101111111100111001101101111100010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
"101110111110001001010111111000011100111100110001001011000001110100010001100000000101110001001101000011011101001100000101111111100111001101101111100010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||||
},
|
},
|
||||||
/* 55*/ { BARCODE_DBAR_EXPSTK, 7, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 5, 347, 1, "#200 16 chars, 2 rows, bottom row 2 chars",
|
/* 55*/ { BARCODE_DBAR_EXPSTK, 7, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 0, 5, 347, 1, "#200 16 chars, 2 rows, bottom row 2 chars",
|
||||||
"01000111011100010110111111110000101100001001011111011010000001100010101111000000001010011100000010010100111110111001100011111100001011101010000110000110100111000110001011110000001110011110001111010101111100101100001000111100000010101100100000100001110111110001001010111111000011100111100110001001011000001110100010001100000000101110001001101000010"
|
"01000111011100010110111111110000101100001001011111011010000001100010101111000000001010011100000010010100111110111001100011111100001011101010000110000110100111000110001011110000001110011110001111010101111100101100001000111100000010101100100000100001110111110001001010111111000011100111100110001001011000001110100010001100000000101110001001101000010"
|
||||||
"00001000100011101001000000001010010011110110100000100101111110011101010000101010100101100011111101101011000001000110010100000010100100010101111001111001011000111001110100001010100001100001110000101010000011010011110101000010101001010011011111011110001000001110110101000000101000011000011001110110100111110001011101010010101010010001110110010110000"
|
"00001000100011101001000000001010010011110110100000100101111110011101010000101010100101100011111101101011000001000110010100000010100100010101111001111001011000111001110100001010100001100001110000101010000011010011110101000010101001010011011111011110001000001110110101000000101000011000011001110110100111110001011101010010101010010001110110010110000"
|
||||||
"00000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000"
|
"00000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000"
|
||||||
"00001000101100111110100000000100001100100100000110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
"00001000101100111110100000000100001100100100000110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||||
"10110111010011000001011111111001110011011011111000101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
"10110111010011000001011111111001110011011011111000101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||||
},
|
},
|
||||||
/* 56*/ { BARCODE_DBAR_EXPSTK, 8, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 1, 396, 1, "#200 16 chars, 1 row",
|
/* 56*/ { BARCODE_DBAR_EXPSTK, 8, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 0, 1, 396, 1, "#200 16 chars, 1 row",
|
||||||
"010001110111000101101111111100001011000010010111110110100000011000101011110000000010100111000000100101001111101110011000111111000010111010100001100001101001110001100010111100000011100111100011110101011111001011000010001111000000101011001000001000011101111100010010101111110000111001111001100010010110000011101000100011000000001011100010011010000110111010011000001011111111001110011011011111000101"
|
"010001110111000101101111111100001011000010010111110110100000011000101011110000000010100111000000100101001111101110011000111111000010111010100001100001101001110001100010111100000011100111100011110101011111001011000010001111000000101011001000001000011101111100010010101111110000111001111001100010010110000011101000100011000000001011100010011010000110111010011000001011111111001110011011011111000101"
|
||||||
},
|
},
|
||||||
/* 57*/ { BARCODE_DBAR_EXP, -1, "[01]00012345678905[10]ABC123", 1, 232, 1, "24724:2011 7.2.5.4.1, encoding method 1 '1'",
|
/* 57*/ { BARCODE_DBAR_EXP, -1, "[01]00012345678905[10]ABC123", 0, 1, 232, 1, "24724:2011 7.2.5.4.1, encoding method 1 '1'",
|
||||||
"0100011000001011011011111111000010110011000010111101011110011011111010111110000001100010110000110111000111101101011110001111110000101110001100100001010011101111110110101111111100111001011011111101110011011100101111100011110000001010"
|
"0100011000001011011011111111000010110011000010111101011110011011111010111110000001100010110000110111000111101101011110001111110000101110001100100001010011101111110110101111111100111001011011111101110011011100101111100011110000001010"
|
||||||
},
|
},
|
||||||
/* 58*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3103]001750", 1, 151, 1, "24724:2011 7.2.5.4.2, encoding method 3 '0100'",
|
/* 58*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3103]001750", 0, 1, 151, 1, "24724:2011 7.2.5.4.2, encoding method 3 '0100'",
|
||||||
"0101110010000010011011111111000010111000010011000101011110111001100010111100000011100101110001110111011110101111000110001111110000101011000010011111010"
|
"0101110010000010011011111111000010111000010011000101011110111001100010111100000011100101110001110111011110101111000110001111110000101011000010011111010"
|
||||||
},
|
},
|
||||||
/* 59*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3103]032767", 1, 151, 1, "Encoding method 3 '0100' with weight = 32767",
|
/* 59*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3103]032767", 0, 1, 151, 1, "Encoding method 3 '0100' with weight = 32767",
|
||||||
"0101001000111000011011111111000010111000010011000101011110111001100010111100000011100101110001110111011110111011000110001111110000101101111101110111010"
|
"0101001000111000011011111111000010111000010011000101011110111001100010111100000011100101110001110111011110111011000110001111110000101101111101110111010"
|
||||||
},
|
},
|
||||||
/* 60*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3103]032768", 1, 200, 1, "Possible encoding method 3 '0100' but weight > 32767 so encoding method 7 '0111000' with dummy date",
|
/* 60*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3103]032768", 0, 1, 200, 1, "Possible encoding method 3 '0100' but weight > 32767 so encoding method 7 '0111000' with dummy date",
|
||||||
"01001100000101001110111111110000101000110111000010010111100110111110101111110000111000101100001101110001111011010111100011111100001011000110100110000110100000100110001011111111001110011001111010000101"
|
"01001100000101001110111111110000101000110111000010010111100110111110101111110000111000101100001101110001111011010111100011111100001011000110100110000110100000100110001011111111001110011001111010000101"
|
||||||
},
|
},
|
||||||
/* 61*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3202]000156", 1, 151, 1, "24724:2011 7.2.5.4.3, encoding method 4 '0101'",
|
/* 61*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3202]000156", 0, 1, 151, 1, "24724:2011 7.2.5.4.3, encoding method 4 '0101'",
|
||||||
"0101001000111100001011111111000010100111000100001101011110111001100010111100000011100101110001110111011110101111000110001111110000101100001000001010010"
|
"0101001000111100001011111111000010100111000100001101011110111001100010111100000011100101110001110111011110101111000110001111110000101100001000001010010"
|
||||||
},
|
},
|
||||||
/* 62*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3202]009999", 1, 151, 1, "Encoding method 4 '0101' with weight = 9999",
|
/* 62*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3202]009999", 0, 1, 151, 1, "Encoding method 4 '0101' with weight = 9999",
|
||||||
"0101110001000100011011111111000010100111000100001101011110111001100010111100000011100101110001110111011110110100011110001111110000101100111110010001010"
|
"0101110001000100011011111111000010100111000100001101011110111001100010111100000011100101110001110111011110110100011110001111110000101100111110010001010"
|
||||||
},
|
},
|
||||||
/* 63*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3202]010000", 1, 200, 1, "Possible encoding method 4 '0101' but weight > 9999 so encoding method 8 with dummy date",
|
/* 63*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3202]010000", 0, 1, 200, 1, "Possible encoding method 4 '0101' but weight > 9999 so encoding method 8 with dummy date",
|
||||||
"01001000101110000110111111110000101110100011000010010111100110111110101111110000111000101100001101110001111011010111100011111100001010000011101001100111101101001110001011111111001110011001111010000101"
|
"01001000101110000110111111110000101110100011000010010111100110111110101111110000111000101100001101110001111011010111100011111100001010000011101001100111101101001110001011111111001110011001111010000101"
|
||||||
},
|
},
|
||||||
/* 64*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3203]022767", 1, 151, 1, "Encoding method 4 '0101' with weight = 22767",
|
/* 64*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3203]022767", 0, 1, 151, 1, "Encoding method 4 '0101' with weight = 22767",
|
||||||
"0101110010011000001011111111000010100111000100001101011110111001100010111100000011100101110001110111011110111011000110001111110000101101111101110111010"
|
"0101110010011000001011111111000010100111000100001101011110111001100010111100000011100101110001110111011110111011000110001111110000101101111101110111010"
|
||||||
},
|
},
|
||||||
/* 65*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3203]022768", 1, 200, 1, "Possible encoding method 4 '0101' but weight > 22767 so encoding method 8 with dummy date",
|
/* 65*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3203]022768", 0, 1, 200, 1, "Possible encoding method 4 '0101' but weight > 22767 so encoding method 8 with dummy date",
|
||||||
"01000110111000100010111111110000101110100011000010010111100110111110101111110000111000101100001101110001111011010111100011111100001010011100010110000100001101000001101011111111001110011001111010000101"
|
"01000110111000100010111111110000101110100011000010010111100110111110101111110000111000101100001101110001111011010111100011111100001010011100010110000100001101000001101011111111001110011001111010000101"
|
||||||
},
|
},
|
||||||
/* 66*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3922]795", 1, 183, 1, "24724:2011 7.2.5.4.5, encoding method 5 '01100XX', no following AIs",
|
/* 66*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3922]795", 0, 1, 183, 1, "24724:2011 7.2.5.4.5, encoding method 5 '01100XX', no following AIs",
|
||||||
"010110000010001011101111111100001010011100000101100101111001101111101011111100001110001011000011011100011110110101111000111111000010100111101110100001100011011100100010111111110011101"
|
"010110000010001011101111111100001010011100000101100101111001101111101011111100001110001011000011011100011110110101111000111111000010100111101110100001100011011100100010111111110011101"
|
||||||
},
|
},
|
||||||
/* 67*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3922]795[20]01", 1, 200, 1, "Encoding method 5 '01100XX' with following AI",
|
/* 67*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3922]795[20]01", 0, 1, 200, 1, "Encoding method 5 '01100XX' with following AI",
|
||||||
"01000110110000110010111111110000101111000100001010010111100110111110101111110000111000101100001101110001111011010111100011111100001010011110111010000110001110001011001011111111001110100111110001110101"
|
"01000110110000110010111111110000101111000100001010010111100110111110101111110000111000101100001101110001111011010111100011111100001010011110111010000110001110001011001011111111001110100111110001110101"
|
||||||
},
|
},
|
||||||
/* 68*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3932]0401234", 1, 200, 1, "24724:2011 7.2.5.4.6, encoding method 6 '01101XX', no following AIs",
|
/* 68*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3932]0081234", 0, 1, 200, 1, "24724:2011 7.2.5.4.6, encoding method 6 '01101XX', no following AIs",
|
||||||
"01000111101010000010111111110000101110100000110010010111100110111110101111110000111000101100001101110001111011010111100011111100001011100011001101100100111110001011101011111111001110001101111001011101"
|
"01001110000101100010111111110000101110100000110010010111100110111110101111110000111000101100001101110001111011010111100011111100001011000011010111100100111110001011101011111111001110001101111001011101"
|
||||||
},
|
},
|
||||||
/* 69*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3932]0401234[20]01", 1, 232, 1, "Encoding method 6 '01101XX' with following AI",
|
/* 69*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3932]0081234[20]01", 0, 1, 232, 1, "Encoding method 6 '01101XX' with following AI",
|
||||||
"0100010001000110111011111111000010110000101000111001011110011011111010111110000001100010110000110111000111101101011110001111110000101110001100110110010011111000101110101111111100111000100110011110010011101111001000100011110000001010"
|
"0100001101000100111011111111000010110000101000111001011110011011111010111110000001100010110000110111000111101101011110001111110000101100001101011110010011111000101110101111111100111000100110011110010011101111001000100011110000001010"
|
||||||
},
|
},
|
||||||
/* 70*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3932]A401234", 1, 232, 0, "Possible encoding method 6 '01101XX' but invalid currency code so encoding method 1; BWIPP no check",
|
/* 70*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3932]A401234", ZINT_WARN_NONCOMPLIANT, 1, 232, 0, "Possible encoding method 6 '01101XX' but invalid currency code so encoding method 1; BWIPP no check",
|
||||||
"0100011000010011011011111111000010100100011111001101011110011011111010111110000001100010110000110111000111101101011110001111110000101100011001111001010001011011000000101111111100111001101011111110110001111001001110100011110000001010"
|
"0100011000010011011011111111000010100100011111001101011110011011111010111110000001100010110000110111000111101101011110001111110000101100011001111001010001011011000000101111111100111001101011111110110001111001001110100011110000001010"
|
||||||
},
|
},
|
||||||
/* 71*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3102]099999[11]201209", 1, 200, 1, "Encoding method 7 '0111000' with weight <= 99999 and valid date",
|
/* 71*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3102]099999[11]201209", 0, 1, 200, 1, "Encoding method 7 '0111000' with weight <= 99999 and valid date",
|
||||||
"01000101111001000010111111110000101000110111000010010111100110111110101111110000111000101100001101110001111011010111100011111100001010111100100001000100000011100101001011111111001110010000100100011101"
|
"01000101111001000010111111110000101000110111000010010111100110111110101111110000111000101100001101110001111011010111100011111100001010111100100001000100000011100101001011111111001110010000100100011101"
|
||||||
},
|
},
|
||||||
/* 72*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3102]099999", 1, 200, 1, "Encoding method 7 '0111000' with weight <= 99999 but no date",
|
/* 72*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3102]099999", 0, 1, 200, 1, "Encoding method 7 '0111000' with weight <= 99999 but no date",
|
||||||
"01000111011000010010111111110000101000110111000010010111100110111110101111110000111000101100001101110001111011010111100011111100001010111100100001000110100100011000001011111111001110011001111010000101"
|
"01000111011000010010111111110000101000110111000010010111100110111110101111110000111000101100001101110001111011010111100011111100001010111100100001000110100100011000001011111111001110011001111010000101"
|
||||||
},
|
},
|
||||||
/* 73*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3102]100000[11]201209", 1, 281, 1, "Possible encoding method 7 '0111000' but weight > 99999 so encoding method 1",
|
/* 73*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3102]100000[11]201209", 0, 1, 281, 1, "Possible encoding method 7 '0111000' but weight > 99999 so encoding method 1",
|
||||||
"01010011110001110010111111110000101001000111110011010111100110111110101111100000011000101100001101110001111011010111100011111100001010010110001110000110010000011110101011111111001110000011100110101100001001110100011000110000000010100101100000100001011100011001111010111111111001101"
|
"01010011110001110010111111110000101001000111110011010111100110111110101111100000011000101100001101110001111011010111100011111100001010010110001110000110010000011110101011111111001110000011100110101100001001110100011000110000000010100101100000100001011100011001111010111111111001101"
|
||||||
},
|
},
|
||||||
/* 74*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3102]099999[11]200000", 1, 281, 1, "Possible encoding method 7 '0111000' with weight <= 99999 but date invalid so encoding method 1",
|
/* 74*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3102]099999[11]200000", ZINT_WARN_NONCOMPLIANT, 1, 281, 0, "Possible encoding method 7 '0111000' with weight <= 99999 but date invalid so encoding method 1; BWIPP need method to pass `dontlint` option",
|
||||||
"01011001110001001110111111110000101001000111110011010111100110111110101111100000011000101100001101110001111011010111100011111100001010010110001110000110010011110100001011111111001110110011100010111100001001110100011000110000000010101100001000000101010111101111110010111111111001101"
|
"01011001110001001110111111110000101001000111110011010111100110111110101111100000011000101100001101110001111011010111100011111100001010010110001110000110010011110100001011111111001110110011100010111100001001110100011000110000000010101100001000000101010111101111110010111111111001101"
|
||||||
},
|
},
|
||||||
/* 75*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3201]099999[11]201209", 1, 200, 1, "Encoding method 8 '0111001' with weight <= 99999 and valid date",
|
/* 75*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3201]099999[11]201209", 0, 1, 200, 1, "Encoding method 8 '0111001' with weight <= 99999 and valid date",
|
||||||
"01001000001101001110111111110000101110100011000010010111100110111110101111110000111000101100001101110001111011010111100011111100001011000100001101100111010111001110001011111111001110010000100100011101"
|
"01001000001101001110111111110000101110100011000010010111100110111110101111110000111000101100001101110001111011010111100011111100001011000100001101100111010111001110001011111111001110010000100100011101"
|
||||||
},
|
},
|
||||||
/* 76*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3201]099999", 1, 200, 1, "Encoding method 8 '0111001' with weight <= 99999 but no date",
|
/* 76*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3201]099999", 0, 1, 200, 1, "Encoding method 8 '0111001' with weight <= 99999 but no date",
|
||||||
"01000101110010000110111111110000101110100011000010010111100110111110101111110000111000101100001101110001111011010111100011111100001011000100001101100111010000111011101011111111001110011001111010000101"
|
"01000101110010000110111111110000101110100011000010010111100110111110101111110000111000101100001101110001111011010111100011111100001011000100001101100111010000111011101011111111001110011001111010000101"
|
||||||
},
|
},
|
||||||
/* 77*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3201]100000[11]201209", 1, 281, 1, "Possible encoding method 8 '0111001' but weight > 99999 so encoding method 1",
|
/* 77*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3201]100000[11]201209", 0, 1, 281, 1, "Possible encoding method 8 '0111001' but weight > 99999 so encoding method 1",
|
||||||
"01011101100011000110111111110000101001000111110011010111100110111110101111100000011000101100001101110001111011010111100011111100001011101010000110000111011110001100101011111111001110000011100110101100001001110100011000110000000010100101100000100001011100011001111010111111111001101"
|
"01011101100011000110111111110000101001000111110011010111100110111110101111100000011000101100001101110001111011010111100011111100001011101010000110000111011110001100101011111111001110000011100110101100001001110100011000110000000010100101100000100001011100011001111010111111111001101"
|
||||||
},
|
},
|
||||||
/* 78*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3201]099999[11]000000", 1, 281, 1, "Possible encoding method 8 '0111001' but date invalid so encoding method 1",
|
/* 78*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3201]099999[11]000000", ZINT_WARN_NONCOMPLIANT, 1, 281, 0, "Possible encoding method 8 '0111001' but date invalid so encoding method 1; BWIPP need method to pass `dontlint` option",
|
||||||
"01011110100001001110111111110000101001000111110011010111100110111110101111100000011000101100001101110001111011010111100011111100001011101010000110000111000011110101101011111111001110110011100010111100001110100001011000110000000010101100001000000101010111101111110010111111111001101"
|
"01011110100001001110111111110000101001000111110011010111100110111110101111100000011000101100001101110001111011010111100011111100001011101010000110000111000011110101101011111111001110110011100010111100001110100001011000110000000010101100001000000101010111101111110010111111111001101"
|
||||||
},
|
},
|
||||||
/* 79*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3100]099999[13]201209", 1, 200, 1, "Encoding method 9 '0111010' with weight <= 99999 and valid date",
|
/* 79*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3100]099999[13]201209", 0, 1, 200, 1, "Encoding method 9 '0111010' with weight <= 99999 and valid date",
|
||||||
"01001000001101001110111111110000101111001010000010010111100110111110101111110000111000101100001101110001111011010111100011111100001011000111000001010111010000110110001011111111001110010000100100011101"
|
"01001000001101001110111111110000101111001010000010010111100110111110101111110000111000101100001101110001111011010111100011111100001011000111000001010111010000110110001011111111001110010000100100011101"
|
||||||
},
|
},
|
||||||
/* 80*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3204]099999[13]201209", 1, 200, 1, "Encoding method 10 '0111011' with weight <= 99999 and valid date",
|
/* 80*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3204]099999[13]201209", 0, 1, 200, 1, "Encoding method 10 '0111011' with weight <= 99999 and valid date",
|
||||||
"01001000111000010110111111110000101100101000001110010111100110111110101111110000111000101100001101110001111011010111100011111100001010011101000011110101110000101111101011111111001110010000100100011101"
|
"01001000111000010110111111110000101100101000001110010111100110111110101111110000111000101100001101110001111011010111100011111100001010011101000011110101110000101111101011111111001110010000100100011101"
|
||||||
},
|
},
|
||||||
/* 81*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3103]012233[15]991231", 1, 200, 1, "24724:2011 7.2.5.4.4, encoding method 11 '0111100' with weight <= 99999 and valid date",
|
/* 81*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3103]012233[15]991231", 0, 1, 200, 1, "24724:2011 7.2.5.4.4, encoding method 11 '0111100' with weight <= 99999 and valid date",
|
||||||
"01001100000100111010111111110000101011100100000110010111100110111110101111110000111000101100001101110001111011010111100011111100001011000011010110000111001100110001001011111111001110001101111010000101"
|
"01001100000100111010111111110000101011100100000110010111100110111110101111110000111000101100001101110001111011010111100011111100001011000011010110000111001100110001001011111111001110001101111010000101"
|
||||||
},
|
},
|
||||||
/* 82*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3205]099999[15]201209", 1, 200, 1, "Encoding method 12 '0111101' with weight <= 99999 and valid date",
|
/* 82*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3205]099999[15]201209", 0, 1, 200, 1, "Encoding method 12 '0111101' with weight <= 99999 and valid date",
|
||||||
"01001110000010011010111111110000101000001101110100010111100110111110101111110000111000101100001101110001111011010111100011111100001011110011010001100101001100011000001011111111001110010000100100011101"
|
"01001110000010011010111111110000101000001101110100010111100110111110101111110000111000101100001101110001111011010111100011111100001011110011010001100101001100011000001011111111001110010000100100011101"
|
||||||
},
|
},
|
||||||
/* 83*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3109]099999[17]201209", 1, 200, 1, "Encoding method 13 '0111110' with weight <= 99999 and valid date",
|
/* 83*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3105]099999[17]201209", 0, 1, 200, 1, "Encoding method 13 '0111110' with weight <= 99999 and valid date",
|
||||||
"01001110000010100110111111110000101110000100110100010111100110111110101111110000111000101100001101110001111011010111100011111100001011011101111101000111010111001110001011111111001110010000100100011101"
|
"01000111010000110010111111110000101110000100110100010111100110111110101111110000111000101100001101110001111011010111100011111100001011110011010001100101001100011000001011111111001110010000100100011101"
|
||||||
},
|
},
|
||||||
/* 84*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3200]099999[17]201209", 1, 200, 1, "Encoding method 14 '0111111' with weight <= 99999 and valid date",
|
/* 84*/ { BARCODE_DBAR_EXP, -1, "[01]90012345678908[3200]099999[17]201209", 0, 1, 200, 1, "Encoding method 14 '0111111' with weight <= 99999 and valid date",
|
||||||
"01001110000010100110111111110000101111000100010100010111100110111110101111110000111000101100001101110001111011010111100011111100001011000111000001010111010000110110001011111111001110010000100100011101"
|
"01001110000010100110111111110000101111000100010100010111100110111110101111110000111000101100001101110001111011010111100011111100001011000111000001010111010000110110001011111111001110010000100100011101"
|
||||||
},
|
},
|
||||||
|
/* 85*/ { BARCODE_DBAR_EXPSTK, 4, "[8110]106141416543213500110000310123196000", 0, 5, 200, 1, "North American Coupon Application Guideline (NACAG) Figure 1 (& Appendix C: Example 6)",
|
||||||
|
"01001100101110001110111111110000101000001101000001010111100110111000101111100000011011010001000000110000111100001010100011111100001010000010101111000111010000011001101011111111001110000001101101000101"
|
||||||
|
"00000011010001110001000000001010010111110010111110101000011001000111010000010101000100101110111111001111000011110101010100000010100101111101010000111000101111100110010100000000100001111110010010110000"
|
||||||
|
"00000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
||||||
|
"00000100010110000110100000001010101010111100111101110010110001110011101000000000100010000011010010000100011110111011001000101010101010011101111111010000000000000000000000000000000000000000000000000000"
|
||||||
|
"00100011101001111001001111110000010101000011000010001101001110001100010111111111001101111100101101111011100001000100110011000000000101100010000000101010000000000000000000000000000000000000000000000000"
|
||||||
|
},
|
||||||
|
/* 86*/ { BARCODE_DBAR_EXPSTK, 3, "[8110]10614141011111275110111", 0, 5, 151, 1, "NACAG Figure 3",
|
||||||
|
"0101011110011100001011111111000010100000110100000101011110011011100010111110000001101101000100000011000011100001101010001111110000101010000011000111010"
|
||||||
|
"0000100001100011110100000000101001011111001011111010100001100100011101000001010100010010111011111100111100011110010101010000001010010101111100111000000"
|
||||||
|
"0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000"
|
||||||
|
"0000001000100001011010000000010000111001101101100001100111100100100010100001010100100001101011111000000000000000000000000000000000000000000000000000000"
|
||||||
|
"1011110111011110100101111111100111000110010010011110011000011011011100011110000001011110010100000100100000000000000000000000000000000000000000000000000"
|
||||||
|
},
|
||||||
|
/* 87*/ { BARCODE_DBAR_EXPSTK, 6, "[8110]106141410222223100110222111101231023456721104561045678991201", 0, 5, 298, 1, "NACAG Figure 4",
|
||||||
|
"0100101111101001111011111111000010110010000011001101011110011011100010111100000000101101000100000011000011100001101010001111110000101011000011100001010111000011011110101111000000111010011111000101110001110110011001100011110000001011100110000101000110101111110111001011111111001110011010011100001101"
|
||||||
|
"0000010000010110000100000000101001001101111100110010100001100100011101000010101010010010111011111100111100011110010101010000001010010100111100011110101000111100100001010000101010000101100000111010001110001001100110010100001010100100011001111010111001010000001000110100000000100001100101100011110000"
|
||||||
|
"0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
||||||
|
"0000011010011011100010100101010100100111000100000101010000111000110010100000101010001111000101110100011001110001101000100000001010101011011110000111010111110001101011101000000000100011110100100010000110101100111000001000101010101000000000000000000000000000000000000000000000000000000000000000000000"
|
||||||
|
"0010000101100100011100011000000001011000111011111010101111000111001101011111000000110000111010001011100110001110010111001111110000010100100001111000101000001110010100010111111111001100001011011101111001010011000111110011000000000101000000000000000000000000000000000000000000000000000000000000000000"
|
||||||
|
},
|
||||||
|
/* 88*/ { BARCODE_DBAR_EXPSTK, 5, "[8110]1061414165432131501101201211014092110256100126663101231", 0, 5, 249, 1, "NACAG Appendix C: Example 1",
|
||||||
|
"010111101100011011101111111100001011001000001100110101111001101110001011110000000010110100010000001100001111000010101000111111000010100000101011110001110100000110011010111100000011101001111000101111000111011001001110001111000000101011001000001110010"
|
||||||
|
"000000010011100100010000000010100100110111110011001010000110010001110100001010101001001011101111110011110000111101010101000000101001011111010100001110001011111001100101000010101000010110000111010000111000100110110001010000101010010100110111110000000"
|
||||||
|
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000"
|
||||||
|
"000001110000100101101000000101000011110100100011100111100001001101001010010101010010011111110101101100010010110011111010000010101000111101010000010001110001001100110010001010101010100011000111001011000010011010000010100000000010000000000000000000000"
|
||||||
|
"101110001111011010010111111000011100001011011100011000011110110010110001100000000101100000001010010011101101001100000101111100000011000010101111101110001110110011001100110000000001011100111000110100111101100101111101011111111100110100000000000000000"
|
||||||
|
},
|
||||||
|
/* 89*/ { BARCODE_DBAR_EXPSTK, 4, "[8110]106141410012342501106501013085093101231", 0, 5, 200, 1, "NACAG Appendix C: Example 2",
|
||||||
|
"01001100101110001110111111110000101000001101000001010111100110111000101111100000011011010001000000110000111000011010100011111100001010000110011000110111001110000010101011111111001110011110010001100101"
|
||||||
|
"00000011010001110001000000001010010111110010111110101000011001000111010000010101000100101110111111001111000111100101010100000010100101111001100111001000110001111101010100000000100001100001101110010000"
|
||||||
|
"00000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
||||||
|
"00000100100001001110100000001010101011111101001011110000110001001011101000000000100010111000110010000111011001101000001000101010101010011011001000010000000000000000000000000000000000000000000000000000"
|
||||||
|
"00100011011110110001001111110000010100000010110100001111001110110100010111111111001101000111001101111000100110010111110011000000000101100100110111100010000000000000000000000000000000000000000000000000"
|
||||||
|
},
|
||||||
|
/* 90*/ { BARCODE_DBAR_EXPSTK, 5, "[8110]106141410012471011076011110850921108609310123191000", 0, 5, 249, 1, "NACAG Appendix C: Example 3",
|
||||||
|
"010101111101111000101111111100001010000011000101000101111001101110001011110000000010110100010000001100001110000110101000111111000010100001100110001101001000010000111010111100000011100011100011011001011100001001101110001111000000101001100010000111010"
|
||||||
|
"000010000010000111010000000010100101111100111010111010000110010001110100001010101001001011101111110011110001111001010101000000101001011110011001110010110111101111000101000010101000011100011100100110100011110110010001010000101010010110011101111000000"
|
||||||
|
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000"
|
||||||
|
"000010000001000010101000000101000011110111011110110111101101011100001010010101010010101000011111011101111101110011001010000010101000101001111001110001000001100110001010000000101010100111111101101000000000000000000000000000000000000000000000000000000"
|
||||||
|
"101001111110111101010111111000011100001000100001001000010010100011110001100000000101010111100000100010000010001100110101111100000011010110000110001110111110011001110100111111000001011000000010010100100000000000000000000000000000000000000000000000000"
|
||||||
|
},
|
||||||
|
/* 91*/ { BARCODE_DBAR_EXPSTK, 6, "[8110]106141411234562891101201212085010048000214025610048000310123191000", 0, 5, 298, 1, "NACAG Appendix C: Example 4",
|
||||||
|
"0100111111001110101011111111000010100000110001010001011110011011100010111100000000101101000100000011000011100001101010001111110000101010011000111000010101110001000000101111000000111001000001001110010011000011011101100011110000001010000010010110000100011001011000001011111111001110001110101100111101"
|
||||||
|
"0000000000110001010100000000101001011111001110101110100001100100011101000010101010010010111011111100111100011110010101010000001010010101100111000111101010001110111111010000101010000110111110110001101100111100100010010100001010100101111101101001111011100110100111110100000000100001110001010011000000"
|
||||||
|
"0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
|
||||||
|
"0000001110011100111010100101010100101001111011111101000100011101100010100000101010001110110010001000010111101100001110100000001010101000011101111010110010111110001001101000000000100011100001011000010111001010111000001000101010101010001111001001100000000000000000000000000000000000000000000000000000"
|
||||||
|
"0010110001100011000100011000000001010110000100000010111011100010011101011111000000110001001101110111101000010011110001001111110000010111100010000101001101000001110110010111111111001100011110100111101000110101000111110011000000000101110000110110011010000000000000000000000000000000000000000000000000"
|
||||||
|
},
|
||||||
|
/* 92*/ { BARCODE_DBAR_EXPSTK, 5, "[8110]1061414154321031501101201211014092110256100126663101231", 0, 5, 249, 1, "NACAG Appendix C: Example 5",
|
||||||
|
"010100111111010011101111111100001011001000001100110101111001101110001011110000000010110100010000001100001111000010101000111111000010101100100000001001100011101011000010111100000011101001111000101111000111011001001110001111000000101011001000001110010"
|
||||||
|
"000011000000101100010000000010100100110111110011001010000110010001110100001010101001001011101111110011110000111101010101000000101001010011011111110110011100010100111101000010101000010110000111010000111000100110110001010000101010010100110111110000000"
|
||||||
|
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000"
|
||||||
|
"000001110000100101101000000101000011110100100011100111100001001101001010010101010010011111110101101100010010110011111010000010101000111101010000010001110001001100110010001010101010100011000111001011000010011010000010100000000010000000000000000000000"
|
||||||
|
"101110001111011010010111111000011100001011011100011000011110110010110001100000000101100000001010010011101101001100000101111100000011000010101111101110001110110011001100110000000001011100111000110100111101100101111101011111111100110100000000000000000"
|
||||||
|
},
|
||||||
};
|
};
|
||||||
int data_size = sizeof(data) / sizeof(struct item);
|
int data_size = sizeof(data) / sizeof(struct item);
|
||||||
|
|
||||||
@ -733,11 +790,11 @@ static void test_examples(int index, int generate, int debug) {
|
|||||||
int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
|
int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
|
||||||
|
|
||||||
ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].data, length);
|
ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].data, length);
|
||||||
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 (%s)\n", i, ret, symbol->errtxt);
|
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
|
||||||
|
|
||||||
if (generate) {
|
if (generate) {
|
||||||
printf(" /*%3d*/ { %s, %d, \"%s\", %d, %d, %d, \"%s\",\n",
|
printf(" /*%3d*/ { %s, %d, \"%s\", %d, %d, %d, %d, \"%s\",\n",
|
||||||
i, testUtilBarcodeName(symbol->symbology), data[i].option_2, data[i].data, symbol->rows, symbol->width, data[i].bwipp_cmp, data[i].comment);
|
i, testUtilBarcodeName(symbol->symbology), data[i].option_2, data[i].data, data[i].ret, symbol->rows, symbol->width, data[i].bwipp_cmp, data[i].comment);
|
||||||
testUtilModulesDump(symbol, " ", "\n");
|
testUtilModulesDump(symbol, " ", "\n");
|
||||||
printf(" },\n");
|
printf(" },\n");
|
||||||
} else {
|
} else {
|
||||||
@ -1085,12 +1142,12 @@ static void test_binary_buffer_size(int index, int generate, int debug) {
|
|||||||
struct item data[] = {
|
struct item data[] = {
|
||||||
/* 0*/ { "[91]1", 0, 1, 102, "Minimum digit" },
|
/* 0*/ { "[91]1", 0, 1, 102, "Minimum digit" },
|
||||||
/* 1*/ { "[91]+", 0, 1, 102, "Minimum ISO-646" },
|
/* 1*/ { "[91]+", 0, 1, 102, "Minimum ISO-646" },
|
||||||
/* 2*/ { "[00]123456789012345678[00]123456789012345678[00]123456789012345678[91]12345678", 0, 1, 543, "70 == any AIs max" },
|
/* 2*/ { "[00]123456789012345675[00]123456789012345675[00]123456789012345675[91]12345678", 0, 1, 543, "70 == any AIs max" },
|
||||||
/* 3*/ { "[00]123456789012345678[00]123456789012345678[00]123456789012345678[91]123456789", ZINT_ERROR_TOO_LONG, 0, 0, "71 > any AIs max" },
|
/* 3*/ { "[00]123456789012345675[00]123456789012345675[00]123456789012345675[91]123456789", ZINT_ERROR_TOO_LONG, 0, 0, "71 > any AIs max" },
|
||||||
/* 4*/ { "[01]12345678901234[00]123456789012345678[00]123456789012345678[91]1234567890123456", 0, 1, 543, "74 == 01 + other AIs max" },
|
/* 4*/ { "[01]12345678901231[00]123456789012345675[00]123456789012345675[91]1234567890123456", 0, 1, 543, "74 == 01 + other AIs max" },
|
||||||
/* 5*/ { "[01]12345678901234[00]123456789012345678[00]123456789012345678[91]12345678901234567", ZINT_ERROR_TOO_LONG, 0, 0, "75 > 01 + other AIs max" },
|
/* 5*/ { "[01]12345678901231[00]123456789012345675[00]123456789012345675[91]12345678901234567", ZINT_ERROR_TOO_LONG, 0, 0, "75 > 01 + other AIs max" },
|
||||||
/* 6*/ { "[01]92345678901234[3920]123456789012345[00]123456789012345678[91]1234567890123456789", 0, 1, 543, "77 (incl. FNC1 after 3920) == 01 + 392x + other AIs max" },
|
/* 6*/ { "[01]92345678901237[3920]123456789012345[00]123456789012345675[91]1234567890123456789", 0, 1, 543, "77 (incl. FNC1 after 3920) == 01 + 392x + other AIs max" },
|
||||||
/* 7*/ { "[01]92345678901234[3920]123456789012345[00]123456789012345678[91]12345678901234567890", ZINT_ERROR_TOO_LONG, 0, 0, "78 > 01 + 392x + other AIs max" },
|
/* 7*/ { "[01]92345678901237[3920]123456789012345[00]123456789012345675[91]12345678901234567890", ZINT_ERROR_TOO_LONG, 0, 0, "78 > 01 + 392x + other AIs max" },
|
||||||
};
|
};
|
||||||
int data_size = sizeof(data) / sizeof(struct item);
|
int data_size = sizeof(data) / sizeof(struct item);
|
||||||
|
|
||||||
@ -1141,10 +1198,10 @@ static void test_hrt(int index, int debug) {
|
|||||||
/* 2*/ { BARCODE_DBAR_OMN, "1000000000009", "(01)10000000000090" },
|
/* 2*/ { BARCODE_DBAR_OMN, "1000000000009", "(01)10000000000090" },
|
||||||
/* 3*/ { BARCODE_DBAR_LTD, "1341056790138", "(01)13410567901384" },
|
/* 3*/ { BARCODE_DBAR_LTD, "1341056790138", "(01)13410567901384" },
|
||||||
/* 4*/ { BARCODE_DBAR_LTD, "13410567901384", "(01)13410567901384" },
|
/* 4*/ { BARCODE_DBAR_LTD, "13410567901384", "(01)13410567901384" },
|
||||||
/* 5*/ { BARCODE_DBAR_EXP, "[01]12345678901234", "(01)12345678901234" },
|
/* 5*/ { BARCODE_DBAR_EXP, "[01]12345678901231", "(01)12345678901231" },
|
||||||
/* 6*/ { BARCODE_DBAR_STK, "12345678901231", "" },
|
/* 6*/ { BARCODE_DBAR_STK, "12345678901231", "" },
|
||||||
/* 7*/ { BARCODE_DBAR_OMNSTK, "10000000000090", "" },
|
/* 7*/ { BARCODE_DBAR_OMNSTK, "10000000000090", "" },
|
||||||
/* 8*/ { BARCODE_DBAR_EXPSTK, "[01]12345678901234", "" },
|
/* 8*/ { BARCODE_DBAR_EXPSTK, "[01]12345678901231", "" },
|
||||||
};
|
};
|
||||||
int data_size = ARRAY_SIZE(data);
|
int data_size = ARRAY_SIZE(data);
|
||||||
|
|
||||||
@ -1192,20 +1249,22 @@ static void test_input(int index, int debug) {
|
|||||||
/* 7*/ { BARCODE_DBAR_LTD, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1 },
|
/* 7*/ { BARCODE_DBAR_LTD, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||||
/* 8*/ { BARCODE_DBAR_LTD, "2234567890123", ZINT_ERROR_INVALID_DATA, -1, -1 },
|
/* 8*/ { BARCODE_DBAR_LTD, "2234567890123", ZINT_ERROR_INVALID_DATA, -1, -1 },
|
||||||
/* 9*/ { BARCODE_DBAR_LTD, "22345678901238", ZINT_ERROR_INVALID_DATA, -1, -1 },
|
/* 9*/ { BARCODE_DBAR_LTD, "22345678901238", ZINT_ERROR_INVALID_DATA, -1, -1 },
|
||||||
/* 10*/ { BARCODE_DBAR_EXP, "[01]12345678901234", 0, 1, 134 },
|
/* 10*/ { BARCODE_DBAR_EXP, "[01]12345678901234", ZINT_WARN_NONCOMPLIANT, 1, 134 },
|
||||||
/* 11*/ { BARCODE_DBAR_EXP, "[01]1234567890123A", ZINT_ERROR_INVALID_DATA, -1, -1 },
|
/* 11*/ { BARCODE_DBAR_EXP, "[01]12345678901231", 0, 1, 134 },
|
||||||
/* 12*/ { BARCODE_DBAR_EXP, "[01]123456789012315", ZINT_ERROR_INVALID_DATA, -1, -1 },
|
/* 12*/ { BARCODE_DBAR_EXP, "[01]1234567890123A", ZINT_ERROR_INVALID_DATA, -1, -1 },
|
||||||
/* 13*/ { BARCODE_DBAR_STK, "1234567890123", 0, 3, 50 },
|
/* 13*/ { BARCODE_DBAR_EXP, "[01]123456789012315", ZINT_ERROR_INVALID_DATA, -1, -1 },
|
||||||
/* 14*/ { BARCODE_DBAR_STK, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1 },
|
/* 14*/ { BARCODE_DBAR_STK, "1234567890123", 0, 3, 50 },
|
||||||
/* 15*/ { BARCODE_DBAR_STK, "12345678901235", ZINT_ERROR_INVALID_CHECK, -1, -1 },
|
/* 15*/ { BARCODE_DBAR_STK, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1 },
|
||||||
/* 16*/ { BARCODE_DBAR_STK, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1 },
|
/* 16*/ { BARCODE_DBAR_STK, "12345678901235", ZINT_ERROR_INVALID_CHECK, -1, -1 },
|
||||||
/* 17*/ { BARCODE_DBAR_OMNSTK, "1234567890123", 0, 5, 50 },
|
/* 17*/ { BARCODE_DBAR_STK, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||||
/* 18*/ { BARCODE_DBAR_OMNSTK, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1 },
|
/* 18*/ { BARCODE_DBAR_OMNSTK, "1234567890123", 0, 5, 50 },
|
||||||
/* 19*/ { BARCODE_DBAR_OMNSTK, "12345678901236", ZINT_ERROR_INVALID_CHECK, -1, -1 },
|
/* 19*/ { BARCODE_DBAR_OMNSTK, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1 },
|
||||||
/* 20*/ { BARCODE_DBAR_OMNSTK, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1 },
|
/* 20*/ { BARCODE_DBAR_OMNSTK, "12345678901236", ZINT_ERROR_INVALID_CHECK, -1, -1 },
|
||||||
/* 21*/ { BARCODE_DBAR_EXPSTK, "[01]12345678901234", 0, 5, 102 },
|
/* 21*/ { BARCODE_DBAR_OMNSTK, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||||
/* 22*/ { BARCODE_DBAR_EXPSTK, "[01]123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1 },
|
/* 22*/ { BARCODE_DBAR_EXPSTK, "[01]12345678901234", ZINT_WARN_NONCOMPLIANT, 5, 102 },
|
||||||
/* 23*/ { BARCODE_DBAR_EXPSTK, "[01]123456789012315", ZINT_ERROR_INVALID_DATA, -1, -1 },
|
/* 22*/ { BARCODE_DBAR_EXPSTK, "[01]12345678901231", 0, 5, 102 },
|
||||||
|
/* 23*/ { BARCODE_DBAR_EXPSTK, "[01]123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1 },
|
||||||
|
/* 24*/ { BARCODE_DBAR_EXPSTK, "[01]123456789012315", ZINT_ERROR_INVALID_DATA, -1, -1 },
|
||||||
};
|
};
|
||||||
int data_size = ARRAY_SIZE(data);
|
int data_size = ARRAY_SIZE(data);
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
libzint - the open source barcode library
|
libzint - the open source barcode library
|
||||||
Copyright (C) 2019 - 2020 Robin Stuart <rstuart114@gmail.com>
|
Copyright (C) 2019 - 2021 Robin Stuart <rstuart114@gmail.com>
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
@ -162,7 +162,7 @@ static void test_buffer_vector(int index, int generate, int debug) {
|
|||||||
/* 21*/ { BARCODE_EANX_CHK, "1234", "", 50, 1, 47, 118, 116.4 },
|
/* 21*/ { BARCODE_EANX_CHK, "1234", "", 50, 1, 47, 118, 116.4 },
|
||||||
/* 22*/ { BARCODE_EANX, "12", "", 50, 1, 20, 64, 116.4 },
|
/* 22*/ { BARCODE_EANX, "12", "", 50, 1, 20, 64, 116.4 },
|
||||||
/* 23*/ { BARCODE_EANX_CHK, "12", "", 50, 1, 20, 64, 116.4 },
|
/* 23*/ { BARCODE_EANX_CHK, "12", "", 50, 1, 20, 64, 116.4 },
|
||||||
/* 24*/ { BARCODE_GS1_128, "[01]12345678901234", "", 50, 1, 134, 268, 118.9 },
|
/* 24*/ { BARCODE_GS1_128, "[01]12345678901231", "", 50, 1, 134, 268, 118.9 },
|
||||||
/* 25*/ { BARCODE_CODABAR, "A00000000B", "", 50, 1, 102, 204, 118.9 },
|
/* 25*/ { BARCODE_CODABAR, "A00000000B", "", 50, 1, 102, 204, 118.9 },
|
||||||
/* 26*/ { BARCODE_CODE128, "1234567890", "", 50, 1, 90, 180, 118.9 },
|
/* 26*/ { BARCODE_CODE128, "1234567890", "", 50, 1, 90, 180, 118.9 },
|
||||||
/* 27*/ { BARCODE_DPLEIT, "1234567890123", "", 50, 1, 135, 270, 118.9 },
|
/* 27*/ { BARCODE_DPLEIT, "1234567890123", "", 50, 1, 135, 270, 118.9 },
|
||||||
@ -173,7 +173,7 @@ static void test_buffer_vector(int index, int generate, int debug) {
|
|||||||
/* 32*/ { BARCODE_FLAT, "1234567890", "", 50, 1, 90, 180, 100 },
|
/* 32*/ { BARCODE_FLAT, "1234567890", "", 50, 1, 90, 180, 100 },
|
||||||
/* 33*/ { BARCODE_DBAR_OMN, "1234567890123", "", 50, 1, 96, 192, 118.9 },
|
/* 33*/ { BARCODE_DBAR_OMN, "1234567890123", "", 50, 1, 96, 192, 118.9 },
|
||||||
/* 34*/ { BARCODE_DBAR_LTD, "1234567890123", "", 50, 1, 79, 158, 118.9 },
|
/* 34*/ { BARCODE_DBAR_LTD, "1234567890123", "", 50, 1, 79, 158, 118.9 },
|
||||||
/* 35*/ { BARCODE_DBAR_EXP, "[01]12345678901234", "", 34, 1, 134, 268, 86.900002 },
|
/* 35*/ { BARCODE_DBAR_EXP, "[01]12345678901231", "", 34, 1, 134, 268, 86.900002 },
|
||||||
/* 36*/ { BARCODE_TELEPEN, "1234567890", "", 50, 1, 208, 416, 118.9 },
|
/* 36*/ { BARCODE_TELEPEN, "1234567890", "", 50, 1, 208, 416, 118.9 },
|
||||||
/* 37*/ { BARCODE_UPCA, "12345678901", "", 50, 1, 95, 226, 116.4 },
|
/* 37*/ { BARCODE_UPCA, "12345678901", "", 50, 1, 95, 226, 116.4 },
|
||||||
/* 38*/ { BARCODE_UPCA_CHK, "123456789012", "", 50, 1, 95, 226, 116.4 },
|
/* 38*/ { BARCODE_UPCA_CHK, "123456789012", "", 50, 1, 95, 226, 116.4 },
|
||||||
@ -216,7 +216,7 @@ static void test_buffer_vector(int index, int generate, int debug) {
|
|||||||
/* 75*/ { BARCODE_KOREAPOST, "123456", "", 50, 1, 167, 334, 118.9 },
|
/* 75*/ { BARCODE_KOREAPOST, "123456", "", 50, 1, 167, 334, 118.9 },
|
||||||
/* 76*/ { BARCODE_DBAR_STK, "1234567890123", "", 13, 3, 50, 100, 26 },
|
/* 76*/ { BARCODE_DBAR_STK, "1234567890123", "", 13, 3, 50, 100, 26 },
|
||||||
/* 77*/ { BARCODE_DBAR_OMNSTK, "1234567890123", "", 69, 5, 50, 100, 138 },
|
/* 77*/ { BARCODE_DBAR_OMNSTK, "1234567890123", "", 69, 5, 50, 100, 138 },
|
||||||
/* 78*/ { BARCODE_DBAR_EXPSTK, "[01]12345678901234", "", 71, 5, 102, 204, 142 },
|
/* 78*/ { BARCODE_DBAR_EXPSTK, "[01]12345678901231", "", 71, 5, 102, 204, 142 },
|
||||||
/* 79*/ { BARCODE_PLANET, "12345678901", "", 12, 2, 123, 246, 24 },
|
/* 79*/ { BARCODE_PLANET, "12345678901", "", 12, 2, 123, 246, 24 },
|
||||||
/* 80*/ { BARCODE_MICROPDF417, "1234567890", "", 12, 6, 82, 164, 24 },
|
/* 80*/ { BARCODE_MICROPDF417, "1234567890", "", 12, 6, 82, 164, 24 },
|
||||||
/* 81*/ { BARCODE_USPS_IMAIL, "12345678901234567890", "", 8, 3, 129, 258, 16 },
|
/* 81*/ { BARCODE_USPS_IMAIL, "12345678901234567890", "", 8, 3, 129, 258, 16 },
|
||||||
@ -246,10 +246,10 @@ static void test_buffer_vector(int index, int generate, int debug) {
|
|||||||
/*105*/ { BARCODE_EANX_CC, "1234567", "[20]01", 50, 8, 72, 172, 116.4 },
|
/*105*/ { BARCODE_EANX_CC, "1234567", "[20]01", 50, 8, 72, 172, 116.4 },
|
||||||
/*106*/ { BARCODE_EANX_CC, "1234567+12", "[20]01", 50, 8, 99, 226, 116.4 },
|
/*106*/ { BARCODE_EANX_CC, "1234567+12", "[20]01", 50, 8, 99, 226, 116.4 },
|
||||||
/*107*/ { BARCODE_EANX_CC, "1234567+12345", "[20]01", 50, 8, 126, 280, 116.4 },
|
/*107*/ { BARCODE_EANX_CC, "1234567+12345", "[20]01", 50, 8, 126, 280, 116.4 },
|
||||||
/*108*/ { BARCODE_GS1_128_CC, "[01]12345678901234", "[20]01", 50, 5, 145, 290, 118.9 },
|
/*108*/ { BARCODE_GS1_128_CC, "[01]12345678901231", "[20]01", 50, 5, 145, 290, 118.9 },
|
||||||
/*109*/ { BARCODE_DBAR_OMN_CC, "1234567890123", "[20]01", 21, 5, 100, 200, 60.900002 },
|
/*109*/ { BARCODE_DBAR_OMN_CC, "1234567890123", "[20]01", 21, 5, 100, 200, 60.900002 },
|
||||||
/*110*/ { BARCODE_DBAR_LTD_CC, "1234567890123", "[20]01", 19, 6, 79, 158, 56.900002 },
|
/*110*/ { BARCODE_DBAR_LTD_CC, "1234567890123", "[20]01", 19, 6, 79, 158, 56.900002 },
|
||||||
/*111*/ { BARCODE_DBAR_EXP_CC, "[01]12345678901234", "[20]01", 41, 5, 134, 268, 100.9 },
|
/*111*/ { BARCODE_DBAR_EXP_CC, "[01]12345678901231", "[20]01", 41, 5, 134, 268, 100.9 },
|
||||||
/*112*/ { BARCODE_UPCA_CC, "12345678901", "[20]01", 50, 7, 99, 234, 116.4 },
|
/*112*/ { BARCODE_UPCA_CC, "12345678901", "[20]01", 50, 7, 99, 234, 116.4 },
|
||||||
/*113*/ { BARCODE_UPCA_CC, "12345678901+12", "[20]01", 50, 7, 128, 284, 116.4 },
|
/*113*/ { BARCODE_UPCA_CC, "12345678901+12", "[20]01", 50, 7, 128, 284, 116.4 },
|
||||||
/*114*/ { BARCODE_UPCA_CC, "12345678901+12345", "[20]01", 50, 7, 155, 338, 116.4 },
|
/*114*/ { BARCODE_UPCA_CC, "12345678901+12345", "[20]01", 50, 7, 155, 338, 116.4 },
|
||||||
@ -258,7 +258,7 @@ static void test_buffer_vector(int index, int generate, int debug) {
|
|||||||
/*117*/ { BARCODE_UPCE_CC, "1234567+12345", "[20]01", 50, 9, 109, 246, 116.4 },
|
/*117*/ { BARCODE_UPCE_CC, "1234567+12345", "[20]01", 50, 9, 109, 246, 116.4 },
|
||||||
/*118*/ { BARCODE_DBAR_STK_CC, "1234567890123", "[20]01", 24, 9, 56, 112, 48 },
|
/*118*/ { BARCODE_DBAR_STK_CC, "1234567890123", "[20]01", 24, 9, 56, 112, 48 },
|
||||||
/*119*/ { BARCODE_DBAR_OMNSTK_CC, "1234567890123", "[20]01", 80, 11, 56, 112, 160 },
|
/*119*/ { BARCODE_DBAR_OMNSTK_CC, "1234567890123", "[20]01", 80, 11, 56, 112, 160 },
|
||||||
/*120*/ { BARCODE_DBAR_EXPSTK_CC, "[01]12345678901234", "[20]01", 78, 9, 102, 204, 156 },
|
/*120*/ { BARCODE_DBAR_EXPSTK_CC, "[01]12345678901231", "[20]01", 78, 9, 102, 204, 156 },
|
||||||
/*121*/ { BARCODE_CHANNEL, "01", "", 50, 1, 19, 38, 118.9 },
|
/*121*/ { BARCODE_CHANNEL, "01", "", 50, 1, 19, 38, 118.9 },
|
||||||
/*122*/ { BARCODE_CODEONE, "12345678901234567890", "", 22, 22, 22, 44, 44 },
|
/*122*/ { BARCODE_CODEONE, "12345678901234567890", "", 22, 22, 22, 44, 44 },
|
||||||
/*123*/ { BARCODE_GRIDMATRIX, "ABC", "", 18, 18, 18, 36, 36 },
|
/*123*/ { BARCODE_GRIDMATRIX, "ABC", "", 18, 18, 18, 36, 36 },
|
||||||
@ -722,7 +722,7 @@ static void test_noncomposite_string_x(int index, int debug) {
|
|||||||
struct item data[] = {
|
struct item data[] = {
|
||||||
/* 0*/ { BARCODE_DBAR_OMN, "1234567890123", 96, 96 },
|
/* 0*/ { BARCODE_DBAR_OMN, "1234567890123", 96, 96 },
|
||||||
/* 1*/ { BARCODE_DBAR_LTD, "1234567890123", 79, 79 },
|
/* 1*/ { BARCODE_DBAR_LTD, "1234567890123", 79, 79 },
|
||||||
/* 2*/ { BARCODE_DBAR_EXP, "[01]12345678901234", 134, 134 },
|
/* 2*/ { BARCODE_DBAR_EXP, "[01]12345678901231", 134, 134 },
|
||||||
};
|
};
|
||||||
int data_size = sizeof(data) / sizeof(struct item);
|
int data_size = sizeof(data) / sizeof(struct item);
|
||||||
|
|
||||||
|
@ -1,15 +1,6 @@
|
|||||||
--- ../../../../postscriptbarcode/build/monolithic/barcode.ps 2020-12-19 06:21:55.358036729 +0000
|
--- ../../../../postscriptbarcode/build/monolithic/barcode.ps 2021-01-16 23:24:06.598867470 +0000
|
||||||
+++ ../tools/bwipp_dump.ps 2020-12-21 14:41:10.265502623 +0000
|
+++ ../tools/bwipp_dump.ps 2021-01-16 23:39:53.854722084 +0000
|
||||||
@@ -29,6 +29,8 @@
|
@@ -26135,34 +26135,80 @@
|
||||||
% CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
||||||
% IN THE SOFTWARE.
|
|
||||||
|
|
||||||
+% vim: set ts=4 sw=4 et :
|
|
||||||
+
|
|
||||||
% --BEGIN TEMPLATE--
|
|
||||||
|
|
||||||
% --BEGIN RESOURCE preamble--
|
|
||||||
@@ -24471,34 +24473,80 @@
|
|
||||||
pop
|
pop
|
||||||
} ifelse
|
} ifelse
|
||||||
|
|
||||||
@ -25,21 +16,7 @@
|
|||||||
+ linear options //ean13 exec
|
+ linear options //ean13 exec
|
||||||
+ dontdraw not {
|
+ dontdraw not {
|
||||||
+ //renlinear exec
|
+ //renlinear exec
|
||||||
|
+
|
||||||
- % Plot the separator
|
|
||||||
- -1 72 rmoveto <<
|
|
||||||
- /ren //renmatrix
|
|
||||||
- /pixs [
|
|
||||||
- 0 1 93 {0} repeat 1 0
|
|
||||||
- 1 0 93 {0} repeat 0 1
|
|
||||||
- 0 1 93 {0} repeat 1 0
|
|
||||||
- ]
|
|
||||||
- /pixx 97
|
|
||||||
- /pixy 3
|
|
||||||
- /height 6 72 div
|
|
||||||
- /width 97 72 div
|
|
||||||
- /opt options
|
|
||||||
- >> //renmatrix exec
|
|
||||||
+ % Plot the separator
|
+ % Plot the separator
|
||||||
+ -1 72 rmoveto <<
|
+ -1 72 rmoveto <<
|
||||||
+ /ren //renmatrix
|
+ /ren //renmatrix
|
||||||
@ -55,12 +32,25 @@
|
|||||||
+ /opt options
|
+ /opt options
|
||||||
+ >> //renmatrix exec
|
+ >> //renmatrix exec
|
||||||
|
|
||||||
- % Plot the 2D part
|
- % Plot the separator
|
||||||
- -2 6 rmoveto comp options //gs1-cc exec //renmatrix exec
|
- -1 72 rmoveto <<
|
||||||
|
- /ren //renmatrix
|
||||||
|
- /pixs [
|
||||||
|
- 0 1 93 {0} repeat 1 0
|
||||||
|
- 1 0 93 {0} repeat 0 1
|
||||||
|
- 0 1 93 {0} repeat 1 0
|
||||||
|
- ]
|
||||||
|
- /pixx 97
|
||||||
|
- /pixy 3
|
||||||
|
- /height 6 72 div
|
||||||
|
- /width 97 72 div
|
||||||
|
- /opt options
|
||||||
|
- >> //renmatrix exec
|
||||||
+ % Plot the 2D part
|
+ % Plot the 2D part
|
||||||
+ -2 6 rmoveto comp options //gs1-cc exec //renmatrix exec
|
+ -2 6 rmoveto comp options //gs1-cc exec //renmatrix exec
|
||||||
|
|
||||||
- grestore
|
- % Plot the 2D part
|
||||||
|
- -2 6 rmoveto comp options //gs1-cc exec //renmatrix exec
|
||||||
+ grestore
|
+ grestore
|
||||||
+ } {
|
+ } {
|
||||||
+ /linsym exch def
|
+ /linsym exch def
|
||||||
@ -83,7 +73,8 @@
|
|||||||
+ /ccrpad 0 array def
|
+ /ccrpad 0 array def
|
||||||
+ /pixx ccpixx def
|
+ /pixx ccpixx def
|
||||||
+ } ifelse
|
+ } ifelse
|
||||||
+
|
|
||||||
|
- grestore
|
||||||
+ /pixs [
|
+ /pixs [
|
||||||
+ 0 ccpixx ccpixs length 1 sub {
|
+ 0 ccpixx ccpixs length 1 sub {
|
||||||
+ /i exch def
|
+ /i exch def
|
||||||
@ -109,7 +100,7 @@
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -24557,7 +24605,7 @@
|
@@ -26221,7 +26267,7 @@
|
||||||
pop
|
pop
|
||||||
} ifelse
|
} ifelse
|
||||||
|
|
||||||
@ -118,7 +109,7 @@
|
|||||||
|
|
||||||
% Get the result of encoding with ean8 and gs1-cc
|
% Get the result of encoding with ean8 and gs1-cc
|
||||||
options (lintype) (ean8) put
|
options (lintype) (ean8) put
|
||||||
@@ -24565,29 +24613,75 @@
|
@@ -26229,29 +26275,75 @@
|
||||||
options (dontdraw) true put
|
options (dontdraw) true put
|
||||||
|
|
||||||
% Plot the linear part
|
% Plot the linear part
|
||||||
@ -126,21 +117,7 @@
|
|||||||
+ linear options //ean8 exec
|
+ linear options //ean8 exec
|
||||||
+ dontdraw not {
|
+ dontdraw not {
|
||||||
+ //renlinear exec
|
+ //renlinear exec
|
||||||
|
+
|
||||||
- % Plot the separator
|
|
||||||
- -1 72 rmoveto <<
|
|
||||||
- /ren //renmatrix
|
|
||||||
- /pixs [
|
|
||||||
- 0 1 65 {0} repeat 1 0
|
|
||||||
- 1 0 65 {0} repeat 0 1
|
|
||||||
- 0 1 65 {0} repeat 1 0
|
|
||||||
- ]
|
|
||||||
- /pixx 69
|
|
||||||
- /pixy 3
|
|
||||||
- /height 6 72 div
|
|
||||||
- /width 69 72 div
|
|
||||||
- /opt options
|
|
||||||
- >> //renmatrix exec
|
|
||||||
+ % Plot the separator
|
+ % Plot the separator
|
||||||
+ -1 72 rmoveto <<
|
+ -1 72 rmoveto <<
|
||||||
+ /ren //renmatrix
|
+ /ren //renmatrix
|
||||||
@ -161,10 +138,20 @@
|
|||||||
+ dup (pixx) get 69 exch sub 6 rmoveto
|
+ dup (pixx) get 69 exch sub 6 rmoveto
|
||||||
+ //renmatrix exec
|
+ //renmatrix exec
|
||||||
|
|
||||||
- % Plot the 2D part
|
- % Plot the separator
|
||||||
- comp options //gs1-cc exec
|
- -1 72 rmoveto <<
|
||||||
- dup (pixx) get 69 exch sub 6 rmoveto
|
- /ren //renmatrix
|
||||||
- //renmatrix exec
|
- /pixs [
|
||||||
|
- 0 1 65 {0} repeat 1 0
|
||||||
|
- 1 0 65 {0} repeat 0 1
|
||||||
|
- 0 1 65 {0} repeat 1 0
|
||||||
|
- ]
|
||||||
|
- /pixx 69
|
||||||
|
- /pixy 3
|
||||||
|
- /height 6 72 div
|
||||||
|
- /width 69 72 div
|
||||||
|
- /opt options
|
||||||
|
- >> //renmatrix exec
|
||||||
+ grestore
|
+ grestore
|
||||||
+ } {
|
+ } {
|
||||||
+ /linsym exch def
|
+ /linsym exch def
|
||||||
@ -172,8 +159,7 @@
|
|||||||
+ linsym /sbs get { cvi 1 index 1 eq {{0}} {{1}} ifelse repeat } forall % Alternates x 1/0's
|
+ linsym /sbs get { cvi 1 index 1 eq {{0}} {{1}} ifelse repeat } forall % Alternates x 1/0's
|
||||||
+ ] def
|
+ ] def
|
||||||
+ /linheight linsym /bhs get 0 get 72 mul cvi def
|
+ /linheight linsym /bhs get 0 get 72 mul cvi def
|
||||||
|
+
|
||||||
- grestore
|
|
||||||
+ /compsym comp options //gs1-cc exec def
|
+ /compsym comp options //gs1-cc exec def
|
||||||
+ /ccpixs compsym /pixs get def
|
+ /ccpixs compsym /pixs get def
|
||||||
+ /ccpixx compsym /pixx get def
|
+ /ccpixx compsym /pixx get def
|
||||||
@ -188,7 +174,11 @@
|
|||||||
+ /ccrpad 0 array def
|
+ /ccrpad 0 array def
|
||||||
+ /pixx ccpixx def
|
+ /pixx ccpixx def
|
||||||
+ } ifelse
|
+ } ifelse
|
||||||
+
|
|
||||||
|
- % Plot the 2D part
|
||||||
|
- comp options //gs1-cc exec
|
||||||
|
- dup (pixx) get 69 exch sub 6 rmoveto
|
||||||
|
- //renmatrix exec
|
||||||
+ /pixs [
|
+ /pixs [
|
||||||
+ 0 ccpixx ccpixs length 1 sub {
|
+ 0 ccpixx ccpixs length 1 sub {
|
||||||
+ /i exch def
|
+ /i exch def
|
||||||
@ -199,7 +189,8 @@
|
|||||||
+ 2 { linpad aload pop 0 1 65 {0} repeat 1 0 ccrpad aload pop } repeat
|
+ 2 { linpad aload pop 0 1 65 {0} repeat 1 0 ccrpad aload pop } repeat
|
||||||
+ linheight { linpad aload pop 0 linpixs aload pop 0 } repeat
|
+ linheight { linpad aload pop 0 linpixs aload pop 0 } repeat
|
||||||
+ ] def
|
+ ] def
|
||||||
+
|
|
||||||
|
- grestore
|
||||||
+ /pixy pixs length pixx idiv def
|
+ /pixy pixs length pixx idiv def
|
||||||
+ <<
|
+ <<
|
||||||
+ /ren //renmatrix
|
+ /ren //renmatrix
|
||||||
@ -214,7 +205,7 @@
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -24646,34 +24740,80 @@
|
@@ -26310,34 +26402,80 @@
|
||||||
pop
|
pop
|
||||||
} ifelse
|
} ifelse
|
||||||
|
|
||||||
@ -230,21 +221,7 @@
|
|||||||
+ linear options //upca exec
|
+ linear options //upca exec
|
||||||
+ dontdraw not {
|
+ dontdraw not {
|
||||||
+ //renlinear exec
|
+ //renlinear exec
|
||||||
|
+
|
||||||
- % Plot the separator
|
|
||||||
- -1 72 rmoveto <<
|
|
||||||
- /ren //renmatrix
|
|
||||||
- /pixs [
|
|
||||||
- 0 1 93 {0} repeat 1 0
|
|
||||||
- 1 0 93 {0} repeat 0 1
|
|
||||||
- 0 1 93 {0} repeat 1 0
|
|
||||||
- ]
|
|
||||||
- /pixx 97
|
|
||||||
- /pixy 3
|
|
||||||
- /height 6 72 div
|
|
||||||
- /width 97 72 div
|
|
||||||
- /opt options
|
|
||||||
- >> //renmatrix exec
|
|
||||||
+ % Plot the separator
|
+ % Plot the separator
|
||||||
+ -1 72 rmoveto <<
|
+ -1 72 rmoveto <<
|
||||||
+ /ren //renmatrix
|
+ /ren //renmatrix
|
||||||
@ -260,12 +237,25 @@
|
|||||||
+ /opt options
|
+ /opt options
|
||||||
+ >> //renmatrix exec
|
+ >> //renmatrix exec
|
||||||
|
|
||||||
- % Plot the 2D part
|
- % Plot the separator
|
||||||
- -2 6 rmoveto comp options //gs1-cc exec //renmatrix exec
|
- -1 72 rmoveto <<
|
||||||
|
- /ren //renmatrix
|
||||||
|
- /pixs [
|
||||||
|
- 0 1 93 {0} repeat 1 0
|
||||||
|
- 1 0 93 {0} repeat 0 1
|
||||||
|
- 0 1 93 {0} repeat 1 0
|
||||||
|
- ]
|
||||||
|
- /pixx 97
|
||||||
|
- /pixy 3
|
||||||
|
- /height 6 72 div
|
||||||
|
- /width 97 72 div
|
||||||
|
- /opt options
|
||||||
|
- >> //renmatrix exec
|
||||||
+ % Plot the 2D part
|
+ % Plot the 2D part
|
||||||
+ -2 6 rmoveto comp options //gs1-cc exec //renmatrix exec
|
+ -2 6 rmoveto comp options //gs1-cc exec //renmatrix exec
|
||||||
|
|
||||||
- grestore
|
- % Plot the 2D part
|
||||||
|
- -2 6 rmoveto comp options //gs1-cc exec //renmatrix exec
|
||||||
+ grestore
|
+ grestore
|
||||||
+ } {
|
+ } {
|
||||||
+ /linsym exch def
|
+ /linsym exch def
|
||||||
@ -288,7 +278,8 @@
|
|||||||
+ /ccrpad 0 array def
|
+ /ccrpad 0 array def
|
||||||
+ /pixx ccpixx def
|
+ /pixx ccpixx def
|
||||||
+ } ifelse
|
+ } ifelse
|
||||||
+
|
|
||||||
|
- grestore
|
||||||
+ /pixs [
|
+ /pixs [
|
||||||
+ 0 ccpixx ccpixs length 1 sub {
|
+ 0 ccpixx ccpixs length 1 sub {
|
||||||
+ /i exch def
|
+ /i exch def
|
||||||
@ -314,7 +305,7 @@
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -24747,34 +24887,80 @@
|
@@ -26411,34 +26549,80 @@
|
||||||
/opt options
|
/opt options
|
||||||
>> def
|
>> def
|
||||||
|
|
||||||
@ -330,21 +321,7 @@
|
|||||||
+ linear options //upce exec
|
+ linear options //upce exec
|
||||||
+ dontdraw not {
|
+ dontdraw not {
|
||||||
+ //renlinear exec
|
+ //renlinear exec
|
||||||
|
+
|
||||||
- % Plot the separator
|
|
||||||
- -1 72 rmoveto <<
|
|
||||||
- /ren //renmatrix
|
|
||||||
- /pixs [
|
|
||||||
- 0 1 49 {0} repeat 1 0
|
|
||||||
- 1 0 49 {0} repeat 0 1
|
|
||||||
- 0 1 49 {0} repeat 1 0
|
|
||||||
- ]
|
|
||||||
- /pixx 53
|
|
||||||
- /pixy 3
|
|
||||||
- /height 6 72 div
|
|
||||||
- /width 53 72 div
|
|
||||||
- /opt options
|
|
||||||
- >> //renmatrix exec
|
|
||||||
+ % Plot the separator
|
+ % Plot the separator
|
||||||
+ -1 72 rmoveto <<
|
+ -1 72 rmoveto <<
|
||||||
+ /ren //renmatrix
|
+ /ren //renmatrix
|
||||||
@ -360,12 +337,25 @@
|
|||||||
+ /opt options
|
+ /opt options
|
||||||
+ >> //renmatrix exec
|
+ >> //renmatrix exec
|
||||||
|
|
||||||
- % Plot the 2D part
|
- % Plot the separator
|
||||||
- -2 6 rmoveto comp options //gs1-cc exec //renmatrix exec
|
- -1 72 rmoveto <<
|
||||||
|
- /ren //renmatrix
|
||||||
|
- /pixs [
|
||||||
|
- 0 1 49 {0} repeat 1 0
|
||||||
|
- 1 0 49 {0} repeat 0 1
|
||||||
|
- 0 1 49 {0} repeat 1 0
|
||||||
|
- ]
|
||||||
|
- /pixx 53
|
||||||
|
- /pixy 3
|
||||||
|
- /height 6 72 div
|
||||||
|
- /width 53 72 div
|
||||||
|
- /opt options
|
||||||
|
- >> //renmatrix exec
|
||||||
+ % Plot the 2D part
|
+ % Plot the 2D part
|
||||||
+ -2 6 rmoveto comp options //gs1-cc exec //renmatrix exec
|
+ -2 6 rmoveto comp options //gs1-cc exec //renmatrix exec
|
||||||
|
|
||||||
- grestore
|
- % Plot the 2D part
|
||||||
|
- -2 6 rmoveto comp options //gs1-cc exec //renmatrix exec
|
||||||
+ grestore
|
+ grestore
|
||||||
+ } {
|
+ } {
|
||||||
+ /linsym exch def
|
+ /linsym exch def
|
||||||
@ -388,7 +378,8 @@
|
|||||||
+ /ccrpad 0 array def
|
+ /ccrpad 0 array def
|
||||||
+ /pixx ccpixx def
|
+ /pixx ccpixx def
|
||||||
+ } ifelse
|
+ } ifelse
|
||||||
+
|
|
||||||
|
- grestore
|
||||||
+ /pixs [
|
+ /pixs [
|
||||||
+ 0 ccpixx ccpixs length 1 sub {
|
+ 0 ccpixx ccpixs length 1 sub {
|
||||||
+ /i exch def
|
+ /i exch def
|
||||||
@ -414,7 +405,7 @@
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -24833,7 +25019,7 @@
|
@@ -26497,7 +26681,7 @@
|
||||||
pop
|
pop
|
||||||
} ifelse
|
} ifelse
|
||||||
|
|
||||||
@ -423,7 +414,7 @@
|
|||||||
|
|
||||||
options (lintype) (databaromni) put
|
options (lintype) (databaromni) put
|
||||||
options (linkage) true put
|
options (linkage) true put
|
||||||
@@ -24844,7 +25030,7 @@
|
@@ -26508,7 +26692,7 @@
|
||||||
linear options //databaromni exec
|
linear options //databaromni exec
|
||||||
dup (sbs) get /linsbs exch def
|
dup (sbs) get /linsbs exch def
|
||||||
dup (bhs) get 0 get 72 mul /linheight exch def
|
dup (bhs) get 0 get 72 mul /linheight exch def
|
||||||
@ -432,7 +423,7 @@
|
|||||||
|
|
||||||
% Plot the separator
|
% Plot the separator
|
||||||
/sepfinder {
|
/sepfinder {
|
||||||
@@ -24875,20 +25061,66 @@
|
@@ -26539,20 +26723,66 @@
|
||||||
sep 0 [0 0 0] putinterval
|
sep 0 [0 0 0] putinterval
|
||||||
sep sep length 4 sub [0 0 0 0] putinterval
|
sep sep length 4 sub [0 0 0 0] putinterval
|
||||||
18 sepfinder 64 sepfinder
|
18 sepfinder 64 sepfinder
|
||||||
@ -511,7 +502,7 @@
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -24946,7 +25178,7 @@
|
@@ -26610,7 +26840,7 @@
|
||||||
pop
|
pop
|
||||||
} ifelse
|
} ifelse
|
||||||
|
|
||||||
@ -520,7 +511,7 @@
|
|||||||
|
|
||||||
options (lintype) (databarstacked) put
|
options (lintype) (databarstacked) put
|
||||||
options (linkage) true put
|
options (linkage) true put
|
||||||
@@ -24957,7 +25189,7 @@
|
@@ -26621,7 +26851,7 @@
|
||||||
linear options //databarstacked exec
|
linear options //databarstacked exec
|
||||||
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
|
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
|
||||||
dup (pixy) get /linheight exch def
|
dup (pixy) get /linheight exch def
|
||||||
@ -529,7 +520,7 @@
|
|||||||
|
|
||||||
% Plot the separator
|
% Plot the separator
|
||||||
/sepfinder {
|
/sepfinder {
|
||||||
@@ -24985,20 +25217,52 @@
|
@@ -26649,20 +26879,52 @@
|
||||||
sep 0 [ 0 0 0 0 ] putinterval
|
sep 0 [ 0 0 0 0 ] putinterval
|
||||||
sep sep length 4 sub [ 0 0 0 0 ] putinterval
|
sep sep length 4 sub [ 0 0 0 0 ] putinterval
|
||||||
18 sepfinder
|
18 sepfinder
|
||||||
@ -594,7 +585,7 @@
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -25056,7 +25320,7 @@
|
@@ -26720,7 +26982,7 @@
|
||||||
pop
|
pop
|
||||||
} ifelse
|
} ifelse
|
||||||
|
|
||||||
@ -603,7 +594,7 @@
|
|||||||
|
|
||||||
options (lintype) (databarstackedomni) put
|
options (lintype) (databarstackedomni) put
|
||||||
options (linkage) true put
|
options (linkage) true put
|
||||||
@@ -25067,7 +25331,7 @@
|
@@ -26731,7 +26993,7 @@
|
||||||
linear options //databarstackedomni exec
|
linear options //databarstackedomni exec
|
||||||
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
|
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
|
||||||
dup (pixy) get /linheight exch def
|
dup (pixy) get /linheight exch def
|
||||||
@ -612,7 +603,7 @@
|
|||||||
|
|
||||||
% Plot the separator
|
% Plot the separator
|
||||||
/sepfinder {
|
/sepfinder {
|
||||||
@@ -25095,20 +25359,52 @@
|
@@ -26759,20 +27021,52 @@
|
||||||
sep 0 [ 0 0 0 0 ] putinterval
|
sep 0 [ 0 0 0 0 ] putinterval
|
||||||
sep sep length 4 sub [ 0 0 0 0 ] putinterval
|
sep sep length 4 sub [ 0 0 0 0 ] putinterval
|
||||||
18 sepfinder
|
18 sepfinder
|
||||||
@ -677,7 +668,7 @@
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -25281,7 +25577,7 @@
|
@@ -26945,7 +27239,7 @@
|
||||||
pop
|
pop
|
||||||
} ifelse
|
} ifelse
|
||||||
|
|
||||||
@ -686,7 +677,7 @@
|
|||||||
|
|
||||||
options (lintype) (databarlimited) put
|
options (lintype) (databarlimited) put
|
||||||
options (linkage) true put
|
options (linkage) true put
|
||||||
@@ -25292,7 +25588,7 @@
|
@@ -26956,7 +27250,7 @@
|
||||||
linear options //databarlimited exec
|
linear options //databarlimited exec
|
||||||
dup (sbs) get /linsbs exch def
|
dup (sbs) get /linsbs exch def
|
||||||
dup (bhs) get 0 get 72 mul /linheight exch def
|
dup (bhs) get 0 get 72 mul /linheight exch def
|
||||||
@ -695,7 +686,7 @@
|
|||||||
|
|
||||||
% Plot the separator
|
% Plot the separator
|
||||||
mark
|
mark
|
||||||
@@ -25300,22 +25596,68 @@
|
@@ -26964,22 +27258,68 @@
|
||||||
counttomark 1 sub array astore /sep exch def pop pop
|
counttomark 1 sub array astore /sep exch def pop pop
|
||||||
sep 0 [0 0 0] putinterval
|
sep 0 [0 0 0] putinterval
|
||||||
sep sep length 9 sub [0 0 0 0 0 0 0 0 0] putinterval % 4 + 5 right guard spaces
|
sep sep length 9 sub [0 0 0 0 0 0 0 0 0] putinterval % 4 + 5 right guard spaces
|
||||||
@ -733,8 +724,7 @@
|
|||||||
+ /compsym comp options //gs1-cc exec def
|
+ /compsym comp options //gs1-cc exec def
|
||||||
+ /ccpixs compsym /pixs get def
|
+ /ccpixs compsym /pixs get def
|
||||||
+ /ccpixx compsym /pixx get def
|
+ /ccpixx compsym /pixx get def
|
||||||
|
+
|
||||||
- grestore
|
|
||||||
+ /linpixs [ 0 % Begin with left guard space
|
+ /linpixs [ 0 % Begin with left guard space
|
||||||
+ linsbs { cvi 1 index 0 eq {{1}} {{0}} ifelse repeat } forall % Alternates x 1/0's
|
+ linsbs { cvi 1 index 0 eq {{1}} {{0}} ifelse repeat } forall % Alternates x 1/0's
|
||||||
+ ] def
|
+ ] def
|
||||||
@ -763,7 +753,8 @@
|
|||||||
+ ] def
|
+ ] def
|
||||||
+ /pixx ccpixx 1 add def
|
+ /pixx ccpixx 1 add def
|
||||||
+ } ifelse
|
+ } ifelse
|
||||||
+
|
|
||||||
|
- grestore
|
||||||
+ /pixy pixs length pixx idiv def
|
+ /pixy pixs length pixx idiv def
|
||||||
+ <<
|
+ <<
|
||||||
+ /ren //renmatrix
|
+ /ren //renmatrix
|
||||||
@ -778,7 +769,7 @@
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -25374,7 +25716,7 @@
|
@@ -27038,7 +27378,7 @@
|
||||||
pop
|
pop
|
||||||
} ifelse
|
} ifelse
|
||||||
|
|
||||||
@ -787,7 +778,7 @@
|
|||||||
|
|
||||||
options (lintype) (databarexpanded) put
|
options (lintype) (databarexpanded) put
|
||||||
options (linkage) true put
|
options (linkage) true put
|
||||||
@@ -25385,7 +25727,7 @@
|
@@ -27049,7 +27389,7 @@
|
||||||
linear options //databarexpanded exec
|
linear options //databarexpanded exec
|
||||||
dup (sbs) get /linsbs exch def
|
dup (sbs) get /linsbs exch def
|
||||||
dup (bhs) get 0 get 72 mul /linheight exch def
|
dup (bhs) get 0 get 72 mul /linheight exch def
|
||||||
@ -796,7 +787,7 @@
|
|||||||
|
|
||||||
% Plot the separator
|
% Plot the separator
|
||||||
/sepfinder {
|
/sepfinder {
|
||||||
@@ -25414,20 +25756,60 @@
|
@@ -27078,20 +27418,60 @@
|
||||||
18 98 bot length 13 sub {} for
|
18 98 bot length 13 sub {} for
|
||||||
69 98 bot length 13 sub {} for
|
69 98 bot length 13 sub {} for
|
||||||
] {sepfinder} forall
|
] {sepfinder} forall
|
||||||
@ -869,7 +860,7 @@
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -25485,7 +25867,7 @@
|
@@ -27149,7 +27529,7 @@
|
||||||
pop
|
pop
|
||||||
} ifelse
|
} ifelse
|
||||||
|
|
||||||
@ -878,7 +869,7 @@
|
|||||||
|
|
||||||
options (lintype) (databarexpandedstacked) put
|
options (lintype) (databarexpandedstacked) put
|
||||||
options (linkage) true put
|
options (linkage) true put
|
||||||
@@ -25496,7 +25878,7 @@
|
@@ -27160,7 +27540,7 @@
|
||||||
linear options //databarexpandedstacked exec
|
linear options //databarexpandedstacked exec
|
||||||
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
|
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
|
||||||
dup (pixy) get /linheight exch def
|
dup (pixy) get /linheight exch def
|
||||||
@ -887,7 +878,7 @@
|
|||||||
|
|
||||||
% Plot the separator
|
% Plot the separator
|
||||||
/sepfinder {
|
/sepfinder {
|
||||||
@@ -25522,21 +25904,49 @@
|
@@ -27186,21 +27566,49 @@
|
||||||
19 98 bot length 13 sub {} for
|
19 98 bot length 13 sub {} for
|
||||||
70 98 bot length 13 sub {} for
|
70 98 bot length 13 sub {} for
|
||||||
] {sepfinder} forall
|
] {sepfinder} forall
|
||||||
@ -950,7 +941,7 @@
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -25595,7 +26005,7 @@
|
@@ -27259,7 +27667,7 @@
|
||||||
pop
|
pop
|
||||||
} ifelse
|
} ifelse
|
||||||
|
|
||||||
@ -959,7 +950,7 @@
|
|||||||
|
|
||||||
options (inkspread) (0) put
|
options (inkspread) (0) put
|
||||||
options (dontdraw) true put
|
options (dontdraw) true put
|
||||||
@@ -25622,35 +26032,87 @@
|
@@ -27286,35 +27694,87 @@
|
||||||
linear << options {} forall >> //gs1-128 exec
|
linear << options {} forall >> //gs1-128 exec
|
||||||
dup (sbs) get /linsbs exch def
|
dup (sbs) get /linsbs exch def
|
||||||
dup (bhs) get 0 get 72 mul /linheight exch def
|
dup (bhs) get 0 get 72 mul /linheight exch def
|
||||||
@ -1061,7 +1052,7 @@
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -26924,3 +27386,181 @@
|
@@ -28745,3 +29205,183 @@
|
||||||
% --END ENCODER hibcazteccode--
|
% --END ENCODER hibcazteccode--
|
||||||
|
|
||||||
% --END TEMPLATE--
|
% --END TEMPLATE--
|
||||||
@ -1243,3 +1234,5 @@
|
|||||||
+ % If not -dNODISPLAY then render for debugging
|
+ % If not -dNODISPLAY then render for debugging
|
||||||
+ currentpagedevice /Name get (nullpage) ne { s s scale 10 10 moveto ret ret /ren get exec } if
|
+ currentpagedevice /Name get (nullpage) ne { s s scale 10 10 moveto ret ret /ren get exec } if
|
||||||
+} if
|
+} if
|
||||||
|
+
|
||||||
|
+% vim: set ts=4 sw=4 et :
|
||||||
|
Binary file not shown.
409
backend/tools/gen_gs1_lint.php
Normal file
409
backend/tools/gen_gs1_lint.php
Normal file
@ -0,0 +1,409 @@
|
|||||||
|
<?php
|
||||||
|
/* Generate GS1 verify include "backend/gs1_lint.h" for "backend/gs1.c" */
|
||||||
|
/*
|
||||||
|
libzint - the open source barcode library
|
||||||
|
Copyright (C) 2021 <rstuart114@gmail.com>
|
||||||
|
*/
|
||||||
|
/* To create "backend/gs1_lint.h" (from project directory):
|
||||||
|
*
|
||||||
|
* php backend/tools/gen_gs1_lint.php > backend/gs1_lint.h
|
||||||
|
*
|
||||||
|
* or to use local copy of "gs1-format_spec.txt":
|
||||||
|
*
|
||||||
|
* php backend/tools/gen_gs1_lint.php -f <local-path>/gs1-format-spec.txt backend/gs1_lint.h
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
/* vim: set ts=4 sw=4 et : */
|
||||||
|
|
||||||
|
$basename = basename(__FILE__);
|
||||||
|
$dirname = dirname(__FILE__);
|
||||||
|
$dirdirname = basename(dirname($dirname)) . '/' . basename($dirname);
|
||||||
|
|
||||||
|
$opts = getopt('c:f:h:l:t:');
|
||||||
|
|
||||||
|
$print_copyright = isset($opts['c']) ? (bool) $opts['c'] : true;
|
||||||
|
$file = isset($opts['f']) ? $opts['f'] :
|
||||||
|
'https://raw.githubusercontent.com/bwipp/postscriptbarcode/master/contrib/development/gs1-format-spec.txt';
|
||||||
|
$print_h_guard = isset($opts['h']) ? (bool) $opts['h'] : true;
|
||||||
|
$use_length_only = isset($opts['l']) ? (bool) $opts['l'] : true;
|
||||||
|
$tab = isset($opts['t']) ? $opts['t'] : ' ';
|
||||||
|
|
||||||
|
if (($get = file_get_contents($file)) === false) {
|
||||||
|
exit("$basename: ERROR: Could not read file \"$file\"" . PHP_EOL);
|
||||||
|
}
|
||||||
|
|
||||||
|
$lines = explode("\n", $get);
|
||||||
|
|
||||||
|
$spec_ais = $spec_parts = $spec_funcs = array();
|
||||||
|
$batches = array_fill(0, 100, array());
|
||||||
|
|
||||||
|
// Parse the lines into AIs and specs
|
||||||
|
$line_no = 0;
|
||||||
|
foreach ($lines as $line) {
|
||||||
|
$line_no++;
|
||||||
|
if ($line === '' || $line[0] === '#') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!preg_match('/^([0-9]+(?:-[0-9]+)?) +([NXC][0-9.][ NXC0-9.,a-z]*)$/', $line, $matches)) {
|
||||||
|
exit("$basename: ERROR: Could not parse line $line_no" . PHP_EOL);
|
||||||
|
}
|
||||||
|
$ai = $matches[1];
|
||||||
|
$spec = trim($matches[2]);
|
||||||
|
|
||||||
|
if (isset($spec_ais[$spec])) {
|
||||||
|
$ais = $spec_ais[$spec];
|
||||||
|
} else {
|
||||||
|
$ais = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($hyphen = strpos($ai, '-')) !== false) {
|
||||||
|
$ai_s = (int) substr($ai, 0, $hyphen);
|
||||||
|
$ai_e = (int) substr($ai, $hyphen + 1);
|
||||||
|
$ais[] = array($ai_s, $ai_e);
|
||||||
|
|
||||||
|
$batch_s_idx = (int) ($ai_s / 100);
|
||||||
|
$batch_e_idx = (int) ($ai_e / 100);
|
||||||
|
if ($batch_s_idx !== $batch_e_idx) {
|
||||||
|
if (!in_array($spec, $batches[$batch_s_idx])) {
|
||||||
|
$batches[$batch_s_idx][] = $spec;
|
||||||
|
}
|
||||||
|
if (!in_array($spec, $batches[$batch_e_idx])) {
|
||||||
|
$batches[$batch_e_idx][] = $spec;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!in_array($spec, $batches[$batch_s_idx])) {
|
||||||
|
$batches[$batch_s_idx][] = $spec;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$ai = (int) $ai;
|
||||||
|
$ais[] = $ai;
|
||||||
|
$batch_idx = (int) ($ai / 100);
|
||||||
|
if (!in_array($spec, $batches[$batch_idx])) {
|
||||||
|
$batches[$batch_idx][] = $spec;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$spec_ais[$spec] = $ais;
|
||||||
|
|
||||||
|
$spec_parts[$spec] = array();
|
||||||
|
$parts = explode(' ', $spec);
|
||||||
|
foreach ($parts as $part) {
|
||||||
|
$checkers = explode(',', $part);
|
||||||
|
$validator = array_shift($checkers);
|
||||||
|
if (!preg_match('/^([NXC])([0-9]+)?(\.\.[0-9|]+)?$/', $validator, $matches)) {
|
||||||
|
exit("$basename: ERROR: Could not parse validator \"$validator\" line $line_no" . PHP_EOL);
|
||||||
|
}
|
||||||
|
if (count($matches) === 3) {
|
||||||
|
$min = $max = (int) $matches[2];
|
||||||
|
} else {
|
||||||
|
$min = $matches[2] === '' ? 1 : (int) $matches[2];
|
||||||
|
$max = (int) substr($matches[3], 2);
|
||||||
|
}
|
||||||
|
if ($matches[1] === 'N') {
|
||||||
|
$validator = "numeric";
|
||||||
|
} elseif ($matches[1] === 'X') {
|
||||||
|
$validator = "cset82";
|
||||||
|
} else {
|
||||||
|
$validator = "cset39";
|
||||||
|
}
|
||||||
|
$spec_parts[$spec][] = array($min, $max, $validator, $checkers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate total min/maxs and convert the AIs into ranges
|
||||||
|
|
||||||
|
foreach ($spec_ais as $spec => $ais) {
|
||||||
|
// Total min/maxs
|
||||||
|
$total_min = $total_max = 0;
|
||||||
|
foreach ($spec_parts[$spec] as list($min, $max)) {
|
||||||
|
$total_min += $min;
|
||||||
|
$total_max += $max;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sort the AIs
|
||||||
|
$sort_ais = array();
|
||||||
|
foreach ($ais as $ai) {
|
||||||
|
if (is_array($ai)) {
|
||||||
|
$sort_ais[] = $ai[0];
|
||||||
|
} else {
|
||||||
|
$sort_ais[] = $ai;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
array_multisort($sort_ais, $ais);
|
||||||
|
|
||||||
|
// Consolidate contiguous AIs into ranges
|
||||||
|
$tmp_ais = array();
|
||||||
|
foreach ($ais as $ai) {
|
||||||
|
$cnt = count($tmp_ais);
|
||||||
|
if ($cnt === 0) {
|
||||||
|
$tmp_ais[] = $ai;
|
||||||
|
} else {
|
||||||
|
$prev_ai = $tmp_ais[$cnt - 1];
|
||||||
|
if (is_array($prev_ai)) {
|
||||||
|
$prev_s = $prev_ai[0];
|
||||||
|
$prev_e = $prev_ai[1];
|
||||||
|
} else {
|
||||||
|
$prev_e = $prev_s = $prev_ai;
|
||||||
|
}
|
||||||
|
if (is_array($ai)) {
|
||||||
|
$this_s = $ai[0];
|
||||||
|
$this_e = $ai[0];
|
||||||
|
} else {
|
||||||
|
$this_s = $this_e = $ai;
|
||||||
|
}
|
||||||
|
if ($this_s === $prev_e + 1) {
|
||||||
|
$tmp_ais[$cnt - 1] = array($prev_s, $this_e);
|
||||||
|
} else {
|
||||||
|
$tmp_ais[] = $ai;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unconsolidate ranges of 1 into separate entries
|
||||||
|
$ais = array();
|
||||||
|
foreach ($tmp_ais as $ai) {
|
||||||
|
if (is_array($ai) && $ai[1] === $ai[0] + 1) {
|
||||||
|
$ais[] = $ai[0];
|
||||||
|
$ais[] = $ai[1];
|
||||||
|
} else {
|
||||||
|
$ais[] = $ai;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$spec_ais[$spec] = array($total_min, $total_max, $ais);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print output
|
||||||
|
|
||||||
|
print <<<EOD
|
||||||
|
/*
|
||||||
|
* GS1 AI checker generated by "$dirdirname/$basename" from
|
||||||
|
* $file
|
||||||
|
*/
|
||||||
|
|
||||||
|
EOD;
|
||||||
|
|
||||||
|
if ($print_copyright) {
|
||||||
|
print <<<'EOD'
|
||||||
|
/*
|
||||||
|
libzint - the open source barcode library
|
||||||
|
Copyright (C) 2021 Robin Stuart <rstuart114@gmail.com>
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions
|
||||||
|
are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
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
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
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
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
EOD;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($print_h_guard) {
|
||||||
|
print <<<'EOD'
|
||||||
|
#ifndef GS1_LINT_H
|
||||||
|
#define GS1_LINT_H
|
||||||
|
|
||||||
|
|
||||||
|
EOD;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print the spec validator/checkers functions
|
||||||
|
|
||||||
|
foreach ($spec_parts as $spec => $spec_part) {
|
||||||
|
$spec_funcs[$spec] = $spec_func = str_replace(array(' ', '.', ','), '_', strtolower($spec));
|
||||||
|
print <<<EOD
|
||||||
|
/* $spec */
|
||||||
|
static int $spec_func(const unsigned char *data, const int data_len,
|
||||||
|
$tab$tab{$tab}int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
{$tab}return
|
||||||
|
EOD;
|
||||||
|
|
||||||
|
list($total_min, $total_max) = $spec_ais[$spec];
|
||||||
|
if ($total_min === $total_max) {
|
||||||
|
print "data_len == $total_max";
|
||||||
|
} else {
|
||||||
|
print "data_len >= $total_min && data_len <= $total_max";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($use_length_only) {
|
||||||
|
// Call checkers checking for length only first
|
||||||
|
$length_only_arg = ", 1 /*length_only*/";
|
||||||
|
$offset = 0;
|
||||||
|
foreach ($spec_part as list($min, $max, $validator, $checkers)) {
|
||||||
|
foreach ($checkers as $checker) {
|
||||||
|
print <<<EOD
|
||||||
|
|
||||||
|
$tab$tab{$tab}&& $checker(data, data_len, $offset, $min, $max, p_err_no, p_err_posn, err_msg$length_only_arg)
|
||||||
|
EOD;
|
||||||
|
}
|
||||||
|
|
||||||
|
$offset += $max;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validator and full checkers
|
||||||
|
$length_only_arg = $use_length_only ? ", 0" : "";
|
||||||
|
$offset = 0;
|
||||||
|
foreach ($spec_part as list($min, $max, $validator, $checkers)) {
|
||||||
|
print <<<EOD
|
||||||
|
|
||||||
|
$tab$tab{$tab}&& $validator(data, data_len, $offset, $min, $max, p_err_no, p_err_posn, err_msg)
|
||||||
|
EOD;
|
||||||
|
|
||||||
|
foreach ($checkers as $checker) {
|
||||||
|
print <<<EOD
|
||||||
|
|
||||||
|
$tab$tab{$tab}&& $checker(data, data_len, $offset, $min, $max, p_err_no, p_err_posn, err_msg$length_only_arg)
|
||||||
|
EOD;
|
||||||
|
}
|
||||||
|
|
||||||
|
$offset += $max;
|
||||||
|
}
|
||||||
|
print ";\n}\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print main routine
|
||||||
|
|
||||||
|
print <<<EOD
|
||||||
|
/* Entry point. Returns 1 on success, 0 on failure: `*p_err_no` set to 1 if unknown AI, 2 if bad data length */
|
||||||
|
static int gs1_lint(const int ai, const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn,
|
||||||
|
$tab$tab{$tab}char err_msg[50]) {
|
||||||
|
|
||||||
|
$tab/* Assume data length failure */
|
||||||
|
$tab*p_err_no = 2;
|
||||||
|
|
||||||
|
EOD;
|
||||||
|
|
||||||
|
// Split AIs into batches of 100 to lessen the number of comparisons
|
||||||
|
|
||||||
|
$not_first_batch = false;
|
||||||
|
$last_batch_e = -1;
|
||||||
|
foreach ($batches as $batch => $batch_specs) {
|
||||||
|
if (empty($batch_specs)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$batch_s = $batch * 100;
|
||||||
|
$batch_e = $batch_s + 100;
|
||||||
|
if ($not_first_batch) {
|
||||||
|
print "\n$tab} else if (ai < $batch_e) {\n\n";
|
||||||
|
} else {
|
||||||
|
print "\n{$tab}if (ai < $batch_e) {\n\n";
|
||||||
|
$not_first_batch = true;
|
||||||
|
}
|
||||||
|
foreach ($batch_specs as $spec) {
|
||||||
|
$total_min = $spec_ais[$spec][0];
|
||||||
|
$total_max = $spec_ais[$spec][1];
|
||||||
|
$ais = $spec_ais[$spec][2];
|
||||||
|
|
||||||
|
$str = "$tab{$tab}if (";
|
||||||
|
print $str;
|
||||||
|
$width = strlen($str);
|
||||||
|
|
||||||
|
// Count the applicable AIs
|
||||||
|
$ais_cnt = 0;
|
||||||
|
foreach ($ais as $ai) {
|
||||||
|
if (is_array($ai)) {
|
||||||
|
if ($ai[1] < $batch_s || $ai[0] >= $batch_e) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($ai < $batch_s || $ai >= $batch_e) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$ais_cnt++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Output
|
||||||
|
$not_first_ai = false;
|
||||||
|
foreach ($ais as $ai) {
|
||||||
|
if (is_array($ai)) {
|
||||||
|
if ($ai[1] < $batch_s || $ai[0] >= $batch_e) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($ai < $batch_s || $ai >= $batch_e) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$str = '';
|
||||||
|
if ($not_first_ai) {
|
||||||
|
$str .= " || ";
|
||||||
|
} else {
|
||||||
|
$not_first_ai = true;
|
||||||
|
}
|
||||||
|
if (is_array($ai)) {
|
||||||
|
if ($ai[0] === $last_batch_e) { // Don't need 1st element of range if excluded by previous batch
|
||||||
|
$str .= "ai <= " . $ai[1];
|
||||||
|
} else if ($ai[1] + 1 == $batch_e) { // Don't need 2nd element of range if excluded by this batch
|
||||||
|
$str .= "ai >= " . $ai[0];
|
||||||
|
} else {
|
||||||
|
if ($ais_cnt > 1) {
|
||||||
|
$str .= "(ai >= " . $ai[0] . " && ai <= " . $ai[1] . ")";
|
||||||
|
} else {
|
||||||
|
$str .= "ai >= " . $ai[0] . " && ai <= " . $ai[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$str .= "ai == " . $ai;
|
||||||
|
}
|
||||||
|
if ($width + strlen($str) > 118) {
|
||||||
|
print "\n";
|
||||||
|
$str2 = "$tab$tab$tab ";
|
||||||
|
print $str2;
|
||||||
|
$width = strlen($str2);
|
||||||
|
}
|
||||||
|
print $str;
|
||||||
|
$width += strlen($str);
|
||||||
|
}
|
||||||
|
$spec_func = $spec_funcs[$spec];
|
||||||
|
print <<<EOD
|
||||||
|
) {
|
||||||
|
$tab$tab{$tab}return $spec_func(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
$tab$tab}
|
||||||
|
|
||||||
|
EOD;
|
||||||
|
}
|
||||||
|
$last_batch_e = $batch_e;
|
||||||
|
}
|
||||||
|
|
||||||
|
print <<<EOD
|
||||||
|
$tab}
|
||||||
|
|
||||||
|
{$tab}/* Unknown AI */
|
||||||
|
{$tab}*p_err_no = 1;
|
||||||
|
{$tab}return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
EOD;
|
||||||
|
|
||||||
|
if ($print_h_guard) {
|
||||||
|
print <<<'EOD'
|
||||||
|
|
||||||
|
#endif /* GS1_LINT_H */
|
||||||
|
|
||||||
|
EOD;
|
||||||
|
}
|
225
backend/tools/gen_iso3166_h.php
Normal file
225
backend/tools/gen_iso3166_h.php
Normal file
@ -0,0 +1,225 @@
|
|||||||
|
<?php
|
||||||
|
/* Generate ISO 3166 include "backend/iso3166.h" for "backend/gs1.c" */
|
||||||
|
/*
|
||||||
|
libzint - the open source barcode library
|
||||||
|
Copyright (C) 2021 <rstuart114@gmail.com>
|
||||||
|
*/
|
||||||
|
/* To create "backend/iso3166.h" (from project directory):
|
||||||
|
*
|
||||||
|
* php backend/tools/gen_iso3166_h.php > backend/iso3166.h
|
||||||
|
*/
|
||||||
|
/* vim: set ts=4 sw=4 et : */
|
||||||
|
|
||||||
|
$basename = basename(__FILE__);
|
||||||
|
$dirname = dirname(__FILE__);
|
||||||
|
$dirdirname = basename(dirname($dirname)) . '/' . basename($dirname);
|
||||||
|
|
||||||
|
$opts = getopt('c:h:t:');
|
||||||
|
|
||||||
|
$print_copyright = isset($opts['c']) ? (bool) $opts['c'] : true;
|
||||||
|
$print_h_guard = isset($opts['h']) ? (bool) $opts['h'] : true;
|
||||||
|
$tab = isset($opts['t']) ? $opts['t'] : ' ';
|
||||||
|
|
||||||
|
$numeric = array(
|
||||||
|
/*AFG*/ 4, /*ALB*/ 8, /*ATA*/ 10, /*DZA*/ 12, /*ASM*/ 16, /*AND*/ 20, /*AGO*/ 24, /*ATG*/ 28, /*AZE*/ 31, /*ARG*/ 32,
|
||||||
|
/*AUS*/ 36, /*AUT*/ 40, /*BHS*/ 44, /*BHR*/ 48, /*BGD*/ 50, /*ARM*/ 51, /*BRB*/ 52, /*BEL*/ 56, /*BMU*/ 60, /*BTN*/ 64,
|
||||||
|
/*BOL*/ 68, /*BIH*/ 70, /*BWA*/ 72, /*BVT*/ 74, /*BRA*/ 76, /*BLZ*/ 84, /*IOT*/ 86, /*SLB*/ 90, /*VGB*/ 92, /*BRN*/ 96,
|
||||||
|
/*BGR*/ 100, /*MMR*/ 104, /*BDI*/ 108, /*BLR*/ 112, /*KHM*/ 116, /*CMR*/ 120, /*CAN*/ 124, /*CPV*/ 132, /*CYM*/ 136, /*CAF*/ 140,
|
||||||
|
/*LKA*/ 144, /*TCD*/ 148, /*CHL*/ 152, /*CHN*/ 156, /*TWN*/ 158, /*CXR*/ 162, /*CCK*/ 166, /*COL*/ 170, /*COM*/ 174, /*MYT*/ 175,
|
||||||
|
/*COG*/ 178, /*COD*/ 180, /*COK*/ 184, /*CRI*/ 188, /*HRV*/ 191, /*CUB*/ 192, /*CYP*/ 196, /*CZE*/ 203, /*BEN*/ 204, /*DNK*/ 208,
|
||||||
|
/*DMA*/ 212, /*DOM*/ 214, /*ECU*/ 218, /*SLV*/ 222, /*GNQ*/ 226, /*ETH*/ 231, /*ERI*/ 232, /*EST*/ 233, /*FRO*/ 234, /*FLK*/ 238,
|
||||||
|
/*SGS*/ 239, /*FJI*/ 242, /*FIN*/ 246, /*ALA*/ 248, /*FRA*/ 250, /*GUF*/ 254, /*PYF*/ 258, /*ATF*/ 260, /*DJI*/ 262, /*GAB*/ 266,
|
||||||
|
/*GEO*/ 268, /*GMB*/ 270, /*PSE*/ 275, /*DEU*/ 276, /*GHA*/ 288, /*GIB*/ 292, /*KIR*/ 296, /*GRC*/ 300, /*GRL*/ 304, /*GRD*/ 308,
|
||||||
|
/*GLP*/ 312, /*GUM*/ 316, /*GTM*/ 320, /*GIN*/ 324, /*GUY*/ 328, /*HTI*/ 332, /*HMD*/ 334, /*VAT*/ 336, /*HND*/ 340, /*HKG*/ 344,
|
||||||
|
/*HUN*/ 348, /*ISL*/ 352, /*IND*/ 356, /*IDN*/ 360, /*IRN*/ 364, /*IRQ*/ 368, /*IRL*/ 372, /*ISR*/ 376, /*ITA*/ 380, /*CIV*/ 384,
|
||||||
|
/*JAM*/ 388, /*JPN*/ 392, /*KAZ*/ 398, /*JOR*/ 400, /*KEN*/ 404, /*PRK*/ 408, /*KOR*/ 410, /*KWT*/ 414, /*KGZ*/ 417, /*LAO*/ 418,
|
||||||
|
/*LBN*/ 422, /*LSO*/ 426, /*LVA*/ 428, /*LBR*/ 430, /*LBY*/ 434, /*LIE*/ 438, /*LTU*/ 440, /*LUX*/ 442, /*MAC*/ 446, /*MDG*/ 450,
|
||||||
|
/*MWI*/ 454, /*MYS*/ 458, /*MDV*/ 462, /*MLI*/ 466, /*MLT*/ 470, /*MTQ*/ 474, /*MRT*/ 478, /*MUS*/ 480, /*MEX*/ 484, /*MCO*/ 492,
|
||||||
|
/*MNG*/ 496, /*MDA*/ 498, /*MNE*/ 499, /*MSR*/ 500, /*MAR*/ 504, /*MOZ*/ 508, /*OMN*/ 512, /*NAM*/ 516, /*NRU*/ 520, /*NPL*/ 524,
|
||||||
|
/*NLD*/ 528, /*CUW*/ 531, /*ABW*/ 533, /*SXM*/ 534, /*BES*/ 535, /*NCL*/ 540, /*VUT*/ 548, /*NZL*/ 554, /*NIC*/ 558, /*NER*/ 562,
|
||||||
|
/*NGA*/ 566, /*NIU*/ 570, /*NFK*/ 574, /*NOR*/ 578, /*MNP*/ 580, /*UMI*/ 581, /*FSM*/ 583, /*MHL*/ 584, /*PLW*/ 585, /*PAK*/ 586,
|
||||||
|
/*PAN*/ 591, /*PNG*/ 598, /*PRY*/ 600, /*PER*/ 604, /*PHL*/ 608, /*PCN*/ 612, /*POL*/ 616, /*PRT*/ 620, /*GNB*/ 624, /*TLS*/ 626,
|
||||||
|
/*PRI*/ 630, /*QAT*/ 634, /*REU*/ 638, /*ROU*/ 642, /*RUS*/ 643, /*RWA*/ 646, /*BLM*/ 652, /*SHN*/ 654, /*KNA*/ 659, /*AIA*/ 660,
|
||||||
|
/*LCA*/ 662, /*MAF*/ 663, /*SPM*/ 666, /*VCT*/ 670, /*SMR*/ 674, /*STP*/ 678, /*SAU*/ 682, /*SEN*/ 686, /*SRB*/ 688, /*SYC*/ 690,
|
||||||
|
/*SLE*/ 694, /*SGP*/ 702, /*SVK*/ 703, /*VNM*/ 704, /*SVN*/ 705, /*SOM*/ 706, /*ZAF*/ 710, /*ZWE*/ 716, /*ESP*/ 724, /*SSD*/ 728,
|
||||||
|
/*SDN*/ 729, /*ESH*/ 732, /*SUR*/ 740, /*SJM*/ 744, /*SWZ*/ 748, /*SWE*/ 752, /*CHE*/ 756, /*SYR*/ 760, /*TJK*/ 762, /*THA*/ 764,
|
||||||
|
/*TGO*/ 768, /*TKL*/ 772, /*TON*/ 776, /*TTO*/ 780, /*ARE*/ 784, /*TUN*/ 788, /*TUR*/ 792, /*TKM*/ 795, /*TCA*/ 796, /*TUV*/ 798,
|
||||||
|
/*UGA*/ 800, /*UKR*/ 804, /*MKD*/ 807, /*EGY*/ 818, /*GBR*/ 826, /*GGY*/ 831, /*JEY*/ 832, /*IMN*/ 833, /*TZA*/ 834, /*USA*/ 840,
|
||||||
|
/*VIR*/ 850, /*BFA*/ 854, /*URY*/ 858, /*UZB*/ 860, /*VEN*/ 862, /*WLF*/ 876, /*WSM*/ 882, /*YEM*/ 887, /*ZMB*/ 894,
|
||||||
|
);
|
||||||
|
|
||||||
|
$numeric_tab = array();
|
||||||
|
$val = 0;
|
||||||
|
$byte = 0;
|
||||||
|
$max = $numeric[count($numeric) - 1];
|
||||||
|
for ($i = 0; $i <= $max; $i++) {
|
||||||
|
if ($i && $i % 8 == 0) {
|
||||||
|
$numeric_tab[$byte++] = $val;
|
||||||
|
$val = 0;
|
||||||
|
}
|
||||||
|
if (in_array($i, $numeric)) {
|
||||||
|
$val |= 1 << ($i & 0x7);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$numeric_tab[$byte++] = $val;
|
||||||
|
$numeric_cnt = count($numeric_tab);
|
||||||
|
|
||||||
|
$alpha2 = array(
|
||||||
|
"AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR",
|
||||||
|
"AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE",
|
||||||
|
"BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ",
|
||||||
|
"BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD",
|
||||||
|
"CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR",
|
||||||
|
"CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM",
|
||||||
|
"DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI",
|
||||||
|
"FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF",
|
||||||
|
"GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS",
|
||||||
|
"GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU",
|
||||||
|
"ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT",
|
||||||
|
"JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN",
|
||||||
|
"KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK",
|
||||||
|
"LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME",
|
||||||
|
"MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ",
|
||||||
|
"MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA",
|
||||||
|
"NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU",
|
||||||
|
"NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM",
|
||||||
|
"PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS",
|
||||||
|
"RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI",
|
||||||
|
"SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV",
|
||||||
|
"SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK",
|
||||||
|
"TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA",
|
||||||
|
"UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI",
|
||||||
|
"VN", "VU", "WF", "WS", "YE", "YT", "ZA", "ZM", "ZW",
|
||||||
|
);
|
||||||
|
|
||||||
|
$alpha2_tab = array();
|
||||||
|
$val = 0;
|
||||||
|
$byte = 0;
|
||||||
|
for ($i = 0; $i < 26; $i++) {
|
||||||
|
for ($j = 0; $j < 26; $j++) {
|
||||||
|
$ij = $i * 26 + $j;
|
||||||
|
if ($ij && $ij % 8 == 0) {
|
||||||
|
$alpha2_tab[$byte++] = $val;
|
||||||
|
$val = 0;
|
||||||
|
}
|
||||||
|
$cc = chr(65 + $i) . chr(65 + $j);
|
||||||
|
if (in_array($cc, $alpha2)) {
|
||||||
|
$val |= 1 << ($ij & 0x7);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$alpha2_tab[$byte++] = $val;
|
||||||
|
$alpha2_cnt = count($alpha2_tab);
|
||||||
|
|
||||||
|
print <<<EOD
|
||||||
|
/*
|
||||||
|
* ISO 3166 country codes generated by "$dirdirname/$basename"
|
||||||
|
*/
|
||||||
|
|
||||||
|
EOD;
|
||||||
|
|
||||||
|
if ($print_copyright) {
|
||||||
|
print <<<'EOD'
|
||||||
|
/*
|
||||||
|
libzint - the open source barcode library
|
||||||
|
Copyright (C) 2021 Robin Stuart <rstuart114@gmail.com>
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions
|
||||||
|
are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
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
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
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
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
EOD;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($print_h_guard) {
|
||||||
|
print <<<'EOD'
|
||||||
|
#ifndef ISO3166_H
|
||||||
|
#define ISO3166_H
|
||||||
|
|
||||||
|
EOD;
|
||||||
|
}
|
||||||
|
|
||||||
|
print <<<EOD
|
||||||
|
|
||||||
|
/* Whether ISO 3166-1 numeric */
|
||||||
|
static int iso3166_numeric(int cc) {
|
||||||
|
{$tab}static const unsigned char codes[$numeric_cnt] = {
|
||||||
|
EOD;
|
||||||
|
|
||||||
|
for ($i = 0; $i < $numeric_cnt; $i++) {
|
||||||
|
if ($i % 8 == 0) {
|
||||||
|
print "\n$tab$tab";
|
||||||
|
} else {
|
||||||
|
print " ";
|
||||||
|
}
|
||||||
|
printf("0x%02X,", $numeric_tab[$i]);
|
||||||
|
}
|
||||||
|
print <<<EOD
|
||||||
|
|
||||||
|
{$tab}};
|
||||||
|
{$tab}int b = cc >> 3;
|
||||||
|
|
||||||
|
{$tab}if (b < 0 || b >= $numeric_cnt) {
|
||||||
|
{$tab}{$tab}return 0;
|
||||||
|
{$tab}}
|
||||||
|
{$tab}return codes[b] & (1 << (cc & 0x7)) ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Whether ISO 3166-1 alpha2 */
|
||||||
|
static int iso3166_alpha2(const char *cc) {
|
||||||
|
{$tab}static const unsigned char codes[$alpha2_cnt] = {
|
||||||
|
EOD;
|
||||||
|
|
||||||
|
for ($i = 0; $i < $alpha2_cnt; $i++) {
|
||||||
|
if ($i % 8 == 0) {
|
||||||
|
print "\n$tab$tab";
|
||||||
|
} else {
|
||||||
|
print " ";
|
||||||
|
}
|
||||||
|
printf("0x%02X,", $alpha2_tab[$i]);
|
||||||
|
}
|
||||||
|
print <<<EOD
|
||||||
|
|
||||||
|
{$tab}};
|
||||||
|
{$tab}int cc_int;
|
||||||
|
|
||||||
|
{$tab}if (cc[0] < 'A' || cc[0] > 'Z' || cc[1] < 'A' || cc[1] > 'Z') {
|
||||||
|
{$tab}{$tab}return 0;
|
||||||
|
{$tab}}
|
||||||
|
{$tab}cc_int = (cc[0] - 'A') * 26 + (cc[1] - 'A');
|
||||||
|
|
||||||
|
{$tab}return codes[cc_int >> 3] & (1 << (cc_int & 0x7)) ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
EOD;
|
||||||
|
|
||||||
|
if ($print_h_guard) {
|
||||||
|
print <<<'EOD'
|
||||||
|
|
||||||
|
#endif /* ISO3166_H */
|
||||||
|
|
||||||
|
EOD;
|
||||||
|
}
|
145
backend/tools/gen_iso4217_h.php
Normal file
145
backend/tools/gen_iso4217_h.php
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
<?php
|
||||||
|
/* Generate ISO 4217 include "backend/iso4217.h" for "backend/gs1.c" */
|
||||||
|
/*
|
||||||
|
libzint - the open source barcode library
|
||||||
|
Copyright (C) 2021 <rstuart114@gmail.com>
|
||||||
|
*/
|
||||||
|
/* To create "backend/iso4217.h" (from project directory):
|
||||||
|
*
|
||||||
|
* php backend/tools/gen_iso4217_h.php > backend/iso4217.h
|
||||||
|
*/
|
||||||
|
/* vim: set ts=4 sw=4 et : */
|
||||||
|
|
||||||
|
$basename = basename(__FILE__);
|
||||||
|
$dirname = dirname(__FILE__);
|
||||||
|
$dirdirname = basename(dirname($dirname)) . '/' . basename($dirname);
|
||||||
|
|
||||||
|
$opts = getopt('c:h:t:');
|
||||||
|
|
||||||
|
$print_copyright = isset($opts['c']) ? (bool) $opts['c'] : true;
|
||||||
|
$print_h_guard = isset($opts['h']) ? (bool) $opts['h'] : true;
|
||||||
|
$tab = isset($opts['t']) ? $opts['t'] : ' ';
|
||||||
|
|
||||||
|
$numeric = array(
|
||||||
|
/*ALL*/ 8, /*DZD*/ 12, /*ARS*/ 32, /*AUD*/ 36, /*BSD*/ 44, /*BHD*/ 48, /*BDT*/ 50, /*AMD*/ 51, /*BBD*/ 52, /*BMD*/ 60,
|
||||||
|
/*BTN*/ 64, /*BOB*/ 68, /*BWP*/ 72, /*BZD*/ 84, /*SBD*/ 90, /*BND*/ 96, /*MMK*/ 104, /*BIF*/ 108, /*KHR*/ 116, /*CAD*/ 124,
|
||||||
|
/*CVE*/ 132, /*KYD*/ 136, /*LKR*/ 144, /*CLP*/ 152, /*CNY*/ 156, /*COP*/ 170, /*KMF*/ 174, /*CRC*/ 188, /*HRK*/ 191, /*CUP*/ 192,
|
||||||
|
/*CZK*/ 203, /*DKK*/ 208, /*DOP*/ 214, /*SVC*/ 222, /*ETB*/ 230, /*ERN*/ 232, /*FKP*/ 238, /*FJD*/ 242, /*DJF*/ 262, /*GMD*/ 270,
|
||||||
|
/*GIP*/ 292, /*GTQ*/ 320, /*GNF*/ 324, /*GYD*/ 328, /*HTG*/ 332, /*HNL*/ 340, /*HKD*/ 344, /*HUF*/ 348, /*ISK*/ 352, /*INR*/ 356,
|
||||||
|
/*IDR*/ 360, /*IRR*/ 364, /*IQD*/ 368, /*ILS*/ 376, /*JMD*/ 388, /*JPY*/ 392, /*KZT*/ 398, /*JOD*/ 400, /*KES*/ 404, /*KPW*/ 408,
|
||||||
|
/*KRW*/ 410, /*KWD*/ 414, /*KGS*/ 417, /*LAK*/ 418, /*LBP*/ 422, /*LSL*/ 426, /*LRD*/ 430, /*LYD*/ 434, /*MOP*/ 446, /*MWK*/ 454,
|
||||||
|
/*MYR*/ 458, /*MVR*/ 462, /*MUR*/ 480, /*MXN*/ 484, /*MNT*/ 496, /*MDL*/ 498, /*MAD*/ 504, /*OMR*/ 512, /*NAD*/ 516, /*NPR*/ 524,
|
||||||
|
/*ANG*/ 532, /*AWG*/ 533, /*VUV*/ 548, /*NZD*/ 554, /*NIO*/ 558, /*NGN*/ 566, /*NOK*/ 578, /*PKR*/ 586, /*PAB*/ 590, /*PGK*/ 598,
|
||||||
|
/*PYG*/ 600, /*PEN*/ 604, /*PHP*/ 608, /*QAR*/ 634, /*RUB*/ 643, /*RWF*/ 646, /*SHP*/ 654, /*SAR*/ 682, /*SCR*/ 690, /*SLL*/ 694,
|
||||||
|
/*SGD*/ 702, /*VND*/ 704, /*SOS*/ 706, /*ZAR*/ 710, /*SSP*/ 728, /*SZL*/ 748, /*SEK*/ 752, /*CHF*/ 756, /*SYP*/ 760, /*THB*/ 764,
|
||||||
|
/*TOP*/ 776, /*TTD*/ 780, /*AED*/ 784, /*TND*/ 788, /*UGX*/ 800, /*MKD*/ 807, /*EGP*/ 818, /*GBP*/ 826, /*TZS*/ 834, /*USD*/ 840,
|
||||||
|
/*UYU*/ 858, /*UZS*/ 860, /*WST*/ 882, /*YER*/ 886, /*TWD*/ 901, /*UYW*/ 927, /*VES*/ 928, /*MRU*/ 929, /*STN*/ 930, /*CUC*/ 931,
|
||||||
|
/*ZWL*/ 932, /*BYN*/ 933, /*TMT*/ 934, /*GHS*/ 936, /*SDG*/ 938, /*UYI*/ 940, /*RSD*/ 941, /*MZN*/ 943, /*AZN*/ 944, /*RON*/ 946,
|
||||||
|
/*CHE*/ 947, /*CHW*/ 948, /*TRY*/ 949, /*XAF*/ 950, /*XCD*/ 951, /*XOF*/ 952, /*XPF*/ 953, /*XBA*/ 955, /*XBB*/ 956, /*XBC*/ 957,
|
||||||
|
/*XBD*/ 958, /*XAU*/ 959, /*XDR*/ 960, /*XAG*/ 961, /*XPT*/ 962, /*XTS*/ 963, /*XPD*/ 964, /*XUA*/ 965, /*ZMW*/ 967, /*SRD*/ 968,
|
||||||
|
/*MGA*/ 969, /*COU*/ 970, /*AFN*/ 971, /*TJS*/ 972, /*AOA*/ 973, /*BGN*/ 975, /*CDF*/ 976, /*BAM*/ 977, /*EUR*/ 978, /*MXV*/ 979,
|
||||||
|
/*UAH*/ 980, /*GEL*/ 981, /*BOV*/ 984, /*PLN*/ 985, /*BRL*/ 986, /*CLF*/ 990, /*XSU*/ 994, /*USN*/ 997, /*XXX*/ 999,
|
||||||
|
);
|
||||||
|
|
||||||
|
$numeric_tab = array();
|
||||||
|
$val = 0;
|
||||||
|
$byte = 0;
|
||||||
|
$max = $numeric[count($numeric) - 1];
|
||||||
|
for ($i = 0; $i <= $max; $i++) {
|
||||||
|
if ($i && $i % 8 == 0) {
|
||||||
|
$numeric_tab[$byte++] = $val;
|
||||||
|
$val = 0;
|
||||||
|
}
|
||||||
|
if (in_array($i, $numeric)) {
|
||||||
|
$val |= 1 << ($i & 0x7);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$numeric_tab[$byte++] = $val;
|
||||||
|
$numeric_cnt = count($numeric_tab);
|
||||||
|
|
||||||
|
print <<<EOD
|
||||||
|
/*
|
||||||
|
* ISO 4217 currency codes generated by "$dirdirname/$basename"
|
||||||
|
*/
|
||||||
|
|
||||||
|
EOD;
|
||||||
|
|
||||||
|
if ($print_copyright) {
|
||||||
|
print <<<'EOD'
|
||||||
|
/*
|
||||||
|
libzint - the open source barcode library
|
||||||
|
Copyright (C) 2021 Robin Stuart <rstuart114@gmail.com>
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions
|
||||||
|
are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
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
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
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
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
EOD;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($print_h_guard) {
|
||||||
|
print <<<'EOD'
|
||||||
|
#ifndef ISO4217_H
|
||||||
|
#define ISO4217_H
|
||||||
|
|
||||||
|
EOD;
|
||||||
|
}
|
||||||
|
|
||||||
|
print <<<EOD
|
||||||
|
|
||||||
|
/* Whether ISO 4217-1 numeric */
|
||||||
|
static int iso4217_numeric(int cc) {
|
||||||
|
{$tab}static const unsigned char codes[$numeric_cnt] = {
|
||||||
|
EOD;
|
||||||
|
|
||||||
|
for ($i = 0; $i < $numeric_cnt; $i++) {
|
||||||
|
if ($i % 8 == 0) {
|
||||||
|
print "\n$tab$tab";
|
||||||
|
} else {
|
||||||
|
print " ";
|
||||||
|
}
|
||||||
|
printf("0x%02X,", $numeric_tab[$i]);
|
||||||
|
}
|
||||||
|
print <<<EOD
|
||||||
|
|
||||||
|
{$tab}};
|
||||||
|
{$tab}int b = cc >> 3;
|
||||||
|
|
||||||
|
{$tab}if (b < 0 || b >= $numeric_cnt) {
|
||||||
|
{$tab}{$tab}return 0;
|
||||||
|
{$tab}}
|
||||||
|
{$tab}return codes[b] & (1 << (cc & 0x7)) ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
EOD;
|
||||||
|
|
||||||
|
if ($print_h_guard) {
|
||||||
|
print <<<'EOD'
|
||||||
|
|
||||||
|
#endif /* ISO4217_H */
|
||||||
|
|
||||||
|
EOD;
|
||||||
|
}
|
@ -192,7 +192,10 @@
|
|||||||
<ClInclude Include="..\backend\general_field.h" />
|
<ClInclude Include="..\backend\general_field.h" />
|
||||||
<ClInclude Include="..\backend\gridmtx.h" />
|
<ClInclude Include="..\backend\gridmtx.h" />
|
||||||
<ClInclude Include="..\backend\gs1.h" />
|
<ClInclude Include="..\backend\gs1.h" />
|
||||||
|
<ClInclude Include="..\backend\gs1_lint.h" />
|
||||||
<ClInclude Include="..\backend\hanxin.h" />
|
<ClInclude Include="..\backend\hanxin.h" />
|
||||||
|
<ClInclude Include="..\backend\iso3166.h" />
|
||||||
|
<ClInclude Include="..\backend\iso4217.h" />
|
||||||
<ClInclude Include="..\backend\ksx1001.h" />
|
<ClInclude Include="..\backend\ksx1001.h" />
|
||||||
<ClInclude Include="..\backend\large.h" />
|
<ClInclude Include="..\backend\large.h" />
|
||||||
<ClInclude Include="..\backend\maxicode.h" />
|
<ClInclude Include="..\backend\maxicode.h" />
|
||||||
|
@ -545,10 +545,22 @@
|
|||||||
RelativePath="..\backend\gs1.h"
|
RelativePath="..\backend\gs1.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\backend\gs1_lint.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\backend\hanxin.h"
|
RelativePath="..\backend\hanxin.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\backend\iso3166.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\backend\iso4217.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\backend\ksx1001.h"
|
RelativePath="..\backend\ksx1001.h"
|
||||||
>
|
>
|
||||||
|
@ -371,7 +371,10 @@
|
|||||||
<ClInclude Include="..\..\backend\general_field.h" />
|
<ClInclude Include="..\..\backend\general_field.h" />
|
||||||
<ClInclude Include="..\..\backend\gridmtx.h" />
|
<ClInclude Include="..\..\backend\gridmtx.h" />
|
||||||
<ClInclude Include="..\..\backend\gs1.h" />
|
<ClInclude Include="..\..\backend\gs1.h" />
|
||||||
|
<ClInclude Include="..\..\backend\gs1_lint.h" />
|
||||||
<ClInclude Include="..\..\backend\hanxin.h" />
|
<ClInclude Include="..\..\backend\hanxin.h" />
|
||||||
|
<ClInclude Include="..\..\backend\iso3166.h" />
|
||||||
|
<ClInclude Include="..\..\backend\iso4217.h" />
|
||||||
<ClInclude Include="..\..\backend\ksx1001.h" />
|
<ClInclude Include="..\..\backend\ksx1001.h" />
|
||||||
<ClInclude Include="..\..\backend\large.h" />
|
<ClInclude Include="..\..\backend\large.h" />
|
||||||
<ClInclude Include="..\..\backend\maxicode.h" />
|
<ClInclude Include="..\..\backend\maxicode.h" />
|
||||||
|
@ -139,7 +139,10 @@
|
|||||||
<ClInclude Include="..\..\backend\general_field.h" />
|
<ClInclude Include="..\..\backend\general_field.h" />
|
||||||
<ClInclude Include="..\..\backend\gridmtx.h" />
|
<ClInclude Include="..\..\backend\gridmtx.h" />
|
||||||
<ClInclude Include="..\..\backend\gs1.h" />
|
<ClInclude Include="..\..\backend\gs1.h" />
|
||||||
|
<ClInclude Include="..\..\backend\gs1_lint.h" />
|
||||||
<ClInclude Include="..\..\backend\hanxin.h" />
|
<ClInclude Include="..\..\backend\hanxin.h" />
|
||||||
|
<ClInclude Include="..\..\backend\iso3166.h" />
|
||||||
|
<ClInclude Include="..\..\backend\iso4217.h" />
|
||||||
<ClInclude Include="..\..\backend\ksx1001.h" />
|
<ClInclude Include="..\..\backend\ksx1001.h" />
|
||||||
<ClInclude Include="..\..\backend\large.h" />
|
<ClInclude Include="..\..\backend\large.h" />
|
||||||
<ClInclude Include="..\..\backend\maxicode.h" />
|
<ClInclude Include="..\..\backend\maxicode.h" />
|
||||||
|
@ -192,7 +192,10 @@
|
|||||||
<ClInclude Include="..\..\backend\general_field.h" />
|
<ClInclude Include="..\..\backend\general_field.h" />
|
||||||
<ClInclude Include="..\..\backend\gridmtx.h" />
|
<ClInclude Include="..\..\backend\gridmtx.h" />
|
||||||
<ClInclude Include="..\..\backend\gs1.h" />
|
<ClInclude Include="..\..\backend\gs1.h" />
|
||||||
|
<ClInclude Include="..\..\backend\gs1_lint.h" />
|
||||||
<ClInclude Include="..\..\backend\hanxin.h" />
|
<ClInclude Include="..\..\backend\hanxin.h" />
|
||||||
|
<ClInclude Include="..\..\backend\iso3166.h" />
|
||||||
|
<ClInclude Include="..\..\backend\iso4217.h" />
|
||||||
<ClInclude Include="..\..\backend\ksx1001.h" />
|
<ClInclude Include="..\..\backend\ksx1001.h" />
|
||||||
<ClInclude Include="..\..\backend\large.h" />
|
<ClInclude Include="..\..\backend\large.h" />
|
||||||
<ClInclude Include="..\..\backend\maxicode.h" />
|
<ClInclude Include="..\..\backend\maxicode.h" />
|
||||||
|
Loading…
Reference in New Issue
Block a user