diff --git a/backend/CMakeLists.txt b/backend/CMakeLists.txt index 5719181f..854674dc 100644 --- a/backend/CMakeLists.txt +++ b/backend/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (C) 2008 by BogDan Vatra < bogdan@licentia.eu > -# Copyright (C) 2009-2021 Robin Stuart +# Copyright (C) 2009-2022 Robin Stuart # vim: set ts=4 sw=4 et : project(zint) diff --git a/backend/bc412.c b/backend/bc412.c index 77314846..220afaf5 100644 --- a/backend/bc412.c +++ b/backend/bc412.c @@ -1,8 +1,7 @@ /* bc412.c - Handles IBM BC412 (SEMI T1-95) symbology */ - /* libzint - the open source barcode library - Copyright (C) 2021 Robin Stuart + Copyright (C) 2022 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -29,7 +28,7 @@ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* vim: set ts=4 sw=4 et : */ +/* SPDX-License-Identifier: BSD-3-Clause */ /* A little information about this symbology can be found at * https://barcodeguide.seagullscientific.com/Content/Symbologies/BC412.htm @@ -136,3 +135,5 @@ INTERNAL int bc412(struct zint_symbol *symbol, unsigned char source[], int lengt return error_number; } + +/* vim: set ts=4 sw=4 et : */ diff --git a/backend/library.c b/backend/library.c index e11d27b4..69daf835 100644 --- a/backend/library.c +++ b/backend/library.c @@ -1871,6 +1871,7 @@ unsigned int ZBarcode_Cap(int symbol_id, unsigned int cap_flag) { case BARCODE_HIBC_128: /* See CODE128 */ case BARCODE_HIBC_PDF: /* See PDF417 */ case BARCODE_HIBC_MICPDF: /* See PDF417 */ + case BARCODE_BC412: /* TODO: Find doc */ break; default: result |= ZINT_CAP_COMPLIANT_HEIGHT; diff --git a/backend/output.c b/backend/output.c index 7e23aea8..a58a096d 100644 --- a/backend/output.c +++ b/backend/output.c @@ -465,6 +465,9 @@ static int out_quiet_zones(const struct zint_symbol *symbol, const int hide_text /* AIMD/TSC15032-43 (v 0.99c) Section 9.2 */ *left = *right = *top = *bottom = 1.0f; done = 1; + + case BARCODE_BC412: + /* TODO: Find doc */ break; } diff --git a/backend/tests/CMakeLists.txt b/backend/tests/CMakeLists.txt index 54c1f584..9c1bd0d8 100644 --- a/backend/tests/CMakeLists.txt +++ b/backend/tests/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2009-2021 Robin Stuart +# Copyright (C) 2009-2022 Robin Stuart # Adapted from qrencode/tests/CMakeLists.txt # Copyright (C) 2006-2017 Kentaro Fukuchi # vim: set ts=4 sw=4 et : @@ -40,6 +40,7 @@ endif() zint_add_test(2of5 test_2of5) zint_add_test(auspost test_auspost) zint_add_test(aztec test_aztec) +zint_add_test(bc412 test_bc412) zint_add_test(big5 test_big5) zint_add_test(bmp test_bmp) zint_add_test(channel test_channel) diff --git a/backend/tests/test_bc412.c b/backend/tests/test_bc412.c new file mode 100644 index 00000000..3192081d --- /dev/null +++ b/backend/tests/test_bc412.c @@ -0,0 +1,188 @@ +/* + libzint - the open source barcode library + Copyright (C) 2022 Robin Stuart + + 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. + */ +/* SPDX-License-Identifier: BSD-3-Clause */ + +#include "testcommon.h" + +static void test_input(int index, int generate, int debug) { + + struct item { + int input_mode; + int option_1; + int option_2; + char *data; + int length; + int ret; + int expected_rows; + int expected_width; + char *expected; + char *comment; + }; + struct item data[] = { + /* 0*/ { UNICODE_MODE, -1, -1, "123456", -1, ZINT_ERROR_TOO_LONG, 0, 0, "Error nan: Input wrong length (should be between 7 and 18 characters)", "" }, + }; + int data_size = ARRAY_SIZE(data); + int i, length, ret; + struct zint_symbol *symbol; + + char escaped[1024]; + + testStart("test_input"); + + for (i = 0; i < data_size; i++) { + + if (index != -1 && i != index) continue; + + symbol = ZBarcode_Create(); + assert_nonnull(symbol, "Symbol not created\n"); + + //symbol->debug = ZINT_DEBUG_TEST; // Needed to get codeword dump in errtxt + + length = testUtilSetSymbol(symbol, BARCODE_BC412, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug); + + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); + assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); + + if (generate) { + printf(" /*%3d*/ { %s, %d, %d, \"%s\", %d, %s, %d, %d, \"%s\", \"%s\" },\n", + i, testUtilInputModeName(data[i].input_mode), data[i].option_1, data[i].option_2, + testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), data[i].length, + testUtilErrorName(data[i].ret), symbol->rows, symbol->width, symbol->errtxt, data[i].comment); + } else { + if (ret < ZINT_ERROR) { + assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, data[i].data); + assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data); + assert_zero(strcmp((char *) symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected); + } + } + + ZBarcode_Delete(symbol); + } + + testFinish(); +} + +static void test_encode(int index, int generate, int debug) { + + struct item { + int input_mode; + int option_1; + int option_2; + char *data; + int ret; + + int expected_rows; + int expected_width; + int bwipp_cmp; + char *comment; + char *expected; + }; + struct item data[] = { + /* 0*/ { UNICODE_MODE, -1, -1, "AQ45670", 0, 1, 102, 0, "SEMI T1-95 SPECIFICATION FOR BACK SURFACE BAR CODE; BWIPP TODO", + "100101000100100100010101000100010101000101010000010101001010000101001001000101001000100101010100000101" + }, + }; + int data_size = ARRAY_SIZE(data); + int i, length, ret; + struct zint_symbol *symbol; + + char escaped[1024]; + char bwipp_buf[8192]; + char bwipp_msg[1024]; + + int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise + + testStart("test_encode"); + + for (i = 0; i < data_size; i++) { + + if (index != -1 && i != index) continue; + + symbol = ZBarcode_Create(); + assert_nonnull(symbol, "Symbol not created\n"); + + length = testUtilSetSymbol(symbol, BARCODE_BC412, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug); + + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); + assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); + + if (generate) { + printf(" /*%3d*/ { %s, %d, %d, \"%s\", %s, %d, %d, %d, \"%s\",\n", + i, testUtilInputModeName(data[i].input_mode), data[i].option_1, data[i].option_2, + testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), + testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].bwipp_cmp, data[i].comment); + testUtilModulesPrint(symbol, " ", "\n"); + printf(" },\n"); + } else { + if (ret < ZINT_ERROR) { + int width, row; + + assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, data[i].data); + assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data); + + ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row); + assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data); + + if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, -1, -1, debug)) { + if (!data[i].bwipp_cmp) { + if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment); + } else { + ret = testUtilBwipp(i, symbol, data[i].option_1, -1, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf), NULL); + assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); + + ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected); + assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", + i, testUtilBarcodeName(symbol->symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); + } + } + } + } + + ZBarcode_Delete(symbol); + } + + testFinish(); +} + +int main(int argc, char *argv[]) { + + testFunction funcs[] = { /* name, func, has_index, has_generate, has_debug */ + { "test_input", test_input, 1, 1, 1 }, + { "test_encode", test_encode, 1, 1, 1 }, + }; + + testRun(argc, argv, funcs, ARRAY_SIZE(funcs)); + + testReport(); + + return 0; +} + +/* vim: set ts=4 sw=4 et : */ diff --git a/backend/tests/test_eci.c b/backend/tests/test_eci.c index 19e3ced6..ea53b9e4 100644 --- a/backend/tests/test_eci.c +++ b/backend/tests/test_eci.c @@ -767,6 +767,8 @@ static void test_utf8_to_eci_ascii(void) { assert_zero(memcmp(data[i].data, dest, length), "i:%d memcmp != 0\n", i); } } + + testFinish(); } static void test_utf8_to_eci_utf16be(void) { @@ -828,6 +830,8 @@ static void test_utf8_to_eci_utf16be(void) { } } } + + testFinish(); } static void test_utf8_to_eci_utf16le(void) { @@ -889,6 +893,8 @@ static void test_utf8_to_eci_utf16le(void) { } } } + + testFinish(); } static void test_utf8_to_eci_utf32be(void) { @@ -949,6 +955,8 @@ static void test_utf8_to_eci_utf32be(void) { } } } + + testFinish(); } static void test_utf8_to_eci_utf32le(void) { @@ -1009,6 +1017,8 @@ static void test_utf8_to_eci_utf32le(void) { } } } + + testFinish(); } static void test_utf8_to_eci_sjis(void) { @@ -1061,6 +1071,8 @@ static void test_utf8_to_eci_sjis(void) { assert_nonzero(out_length <= eci_length, "i:%d out_length %d > eci_length %d\n", i, out_length, eci_length); } } + + testFinish(); } static void test_utf8_to_eci_big5(void) { @@ -1103,6 +1115,8 @@ static void test_utf8_to_eci_big5(void) { assert_nonzero(out_length <= eci_length, "i:%d out_length %d > eci_length %d\n", i, out_length, eci_length); } } + + testFinish(); } static void test_utf8_to_eci_gb2312(void) { @@ -1145,6 +1159,8 @@ static void test_utf8_to_eci_gb2312(void) { assert_nonzero(out_length <= eci_length, "i:%d out_length %d > eci_length %d\n", i, out_length, eci_length); } } + + testFinish(); } static void test_utf8_to_eci_euc_kr(void) { @@ -1187,6 +1203,8 @@ static void test_utf8_to_eci_euc_kr(void) { assert_nonzero(out_length <= eci_length, "i:%d out_length %d > eci_length %d\n", i, out_length, eci_length); } } + + testFinish(); } static void test_utf8_to_eci_gbk(void) { @@ -1229,6 +1247,8 @@ static void test_utf8_to_eci_gbk(void) { assert_nonzero(out_length <= eci_length, "i:%d out_length %d > eci_length %d\n", i, out_length, eci_length); } } + + testFinish(); } static void test_utf8_to_eci_gb18030(void) { @@ -1271,6 +1291,8 @@ static void test_utf8_to_eci_gb18030(void) { assert_nonzero(out_length <= eci_length, "i:%d out_length %d > eci_length %d\n", i, out_length, eci_length); } } + + testFinish(); } static void test_is_eci_convertible_segs(int index) { diff --git a/backend/tests/test_gb18030.c b/backend/tests/test_gb18030.c index a4fabccb..c9f68ffc 100644 --- a/backend/tests/test_gb18030.c +++ b/backend/tests/test_gb18030.c @@ -42,7 +42,8 @@ INTERNAL int u_gb18030_int_test(const unsigned int u, unsigned int *dest1, unsigned int *dest2); // As control convert to GB 18030 using table generated from GB18030.TXT plus simple processing. -// The version of GB18030.TXT is libiconv-1.11/GB18030.TXT taken from https://haible.de/bruno/charsets/conversion-tables/GB18030.html +// The version of GB18030.TXT is jdk-1.4.2/GB18030.TXT taken from +// https://haible.de/bruno/charsets/conversion-tables/GB18030.html // The generated file backend/tests/test_gb18030_tab.h does not include U+10000..10FFFF codepoints to save space. // See also backend/tests/tools/data/GB18030.TXT.README and backend/tests/tools/gen_test_tab.php. static int u_gb18030_int2(unsigned int u, unsigned int *dest1, unsigned int *dest2) { @@ -50,18 +51,18 @@ static int u_gb18030_int2(unsigned int u, unsigned int *dest1, unsigned int *des int tab_length, start_i, end_i; int i; - // GB18030 two-byte extension (libiconv-1.16/lib/gb18030ext.h) + // GB18030 two-byte extension if (u == 0x1E3F) { // GB 18030-2005 change, was PUA U+E7C7 below, see Table 3-39, p.111, Lunde 2nd ed. *dest1 = 0xA8BC; return 2; } - // GB18030 four-byte extension (libiconv-1.16/lib/gb18030uni.h) + // GB18030 four-byte extension if (u == 0xE7C7) { // PUA *dest1 = 0x8135; *dest2 = 0xF437; return 4; } - // GB18030 two-byte extension (libiconv-1.16/lib/gb18030ext.h) + // GB18030 two-byte extension if (u >= 0x9FB4 && u <= 0x9FBB) { // GB 18030-2005 change, were PUA, see Table 3-37, p.108, Lunde 2nd ed. if (u == 0x9FB4) { *dest1 = 0xFE59; @@ -80,7 +81,7 @@ static int u_gb18030_int2(unsigned int u, unsigned int *dest1, unsigned int *des } return 2; } - // GB18030 two-byte extension (libiconv-1.16/lib/gb18030ext.h) + // GB18030 two-byte extension if (u >= 0xFE10 && u <= 0xFE19) { // GB 18030-2005 change, were PUA, see Table 3-37, p.108, Lunde 2nd ed. if (u == 0xFE10) { *dest1 = 0xA6D9; @@ -97,7 +98,7 @@ static int u_gb18030_int2(unsigned int u, unsigned int *dest1, unsigned int *des } return 2; } - // GB18030 four-byte extension (libiconv-1.16/lib/gb18030uni.h) + // GB18030 four-byte extension if (u >= 0xFE1A && u <= 0xFE2F) { // These are Vertical Forms (U+FE1A..FE1F unassigned) and Combining Half Marks (U+FE20..FE2F) if (u >= 0xFE1A && u <= 0xFE1D) { c = 0x84318336 + (u - 0xFE1A); @@ -110,7 +111,7 @@ static int u_gb18030_int2(unsigned int u, unsigned int *dest1, unsigned int *des *dest2 = c & 0xFFFF; return 4; } - // GB18030 (libiconv-1.16/lib/gb18030.h) + // GB18030 // Code set 3 (Unicode U+10000..U+10FFFF) if (u >= 0x10000 /*&& u < 0x10400*/) { // Not being called for U+10400..U+10FFFF c = u - 0x10000; diff --git a/backend/tests/test_library.c b/backend/tests/test_library.c index d0fa2763..ca49b38e 100644 --- a/backend/tests/test_library.c +++ b/backend/tests/test_library.c @@ -192,25 +192,27 @@ static void test_checks(int index, int debug) { /*131*/ { 126, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 }, /*132*/ { 127, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 }, /*133*/ { 127, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 }, - /*134*/ { 146, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 216: Symbology out of range", BARCODE_CODE128 }, - /*135*/ { 146, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 216: Symbology out of range", -1 }, - /*136*/ { BARCODE_CODE128, -1, "\200", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input data", -1 }, - /*137*/ { BARCODE_GS1_128, -1, "[01]12345678901234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 }, - /*138*/ { BARCODE_GS1_128, -1, "[01]12345678901234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_NONCOMPLIANT, "Error 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 }, - /*139*/ { BARCODE_QRCODE, -1, "ก", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", -1 }, - /*140*/ { BARCODE_QRCODE, -1, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 }, - /*141*/ { BARCODE_QRCODE, -1, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_USES_ECI, "Error 222: Encoded data includes ECI 13", -1 }, - /*142*/ { BARCODE_CODEONE, -1, "[01]12345678901231", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 512: ECI ignored for GS1 mode", -1 }, - /*143*/ { BARCODE_CODEONE, -1, "[01]12345678901231", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 512: ECI ignored for GS1 mode", -1 }, - /*144*/ { BARCODE_CODEONE, -1, "[01]12345678901234", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 512: ECI ignored for GS1 mode", -1 }, // Warning in encoder overrides library warnings - /*145*/ { BARCODE_CODEONE, -1, "[01]12345678901234", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_NONCOMPLIANT, "Error 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 }, // But not errors - /*146*/ { BARCODE_AZTEC, -1, "ก", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", -1 }, - /*147*/ { BARCODE_AZTEC, -1, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 }, - /*148*/ { BARCODE_AZTEC, -1, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_USES_ECI, "Error 222: Encoded data includes ECI 13", -1 }, - /*149*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 503: Invalid error correction level - using default instead", -1 }, - /*150*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 503: Invalid error correction level - using default instead", -1 }, - /*151*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 }, // ECI warning trumps all other warnings - /*152*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 503: Invalid error correction level - using default instead", -1 }, // But not errors + /*134*/ { 147, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 216: Symbology out of range", BARCODE_CODE128 }, + /*135*/ { 147, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 216: Symbology out of range", -1 }, + /*136*/ { BARCODE_LAST + 1, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 216: Symbology out of range", BARCODE_CODE128 }, + /*137*/ { BARCODE_LAST + 1, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 216: Symbology out of range", -1 }, + /*138*/ { BARCODE_CODE128, -1, "\200", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input data", -1 }, + /*139*/ { BARCODE_GS1_128, -1, "[01]12345678901234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 }, + /*140*/ { BARCODE_GS1_128, -1, "[01]12345678901234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_NONCOMPLIANT, "Error 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 }, + /*141*/ { BARCODE_QRCODE, -1, "ก", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", -1 }, + /*142*/ { BARCODE_QRCODE, -1, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 }, + /*143*/ { BARCODE_QRCODE, -1, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_USES_ECI, "Error 222: Encoded data includes ECI 13", -1 }, + /*144*/ { BARCODE_CODEONE, -1, "[01]12345678901231", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 512: ECI ignored for GS1 mode", -1 }, + /*145*/ { BARCODE_CODEONE, -1, "[01]12345678901231", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 512: ECI ignored for GS1 mode", -1 }, + /*146*/ { BARCODE_CODEONE, -1, "[01]12345678901234", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 512: ECI ignored for GS1 mode", -1 }, // Warning in encoder overrides library warnings + /*147*/ { BARCODE_CODEONE, -1, "[01]12345678901234", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_NONCOMPLIANT, "Error 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 }, // But not errors + /*148*/ { BARCODE_AZTEC, -1, "ก", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", -1 }, + /*149*/ { BARCODE_AZTEC, -1, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 }, + /*150*/ { BARCODE_AZTEC, -1, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_USES_ECI, "Error 222: Encoded data includes ECI 13", -1 }, + /*151*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 503: Invalid error correction level - using default instead", -1 }, + /*152*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 503: Invalid error correction level - using default instead", -1 }, + /*153*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 }, // ECI warning trumps all other warnings + /*154*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 503: Invalid error correction level - using default instead", -1 }, // But not errors }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -582,8 +584,8 @@ static void test_escape_char_process(int index, int generate, int debug) { if (generate) { printf(" /*%3d*/ { %s, %s, %d, \"%s\", \"%s\", %s, %d, \"%s\", %d, \"%s\" },\n", i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), data[i].eci, - testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), - testUtilEscape(data[i].composite, strlen(data[i].composite), escaped_composite, sizeof(escaped_composite)), + testUtilEscape(data[i].data, length, escaped, ARRAY_SIZE(escaped)), + testUtilEscape(data[i].composite, strlen(data[i].composite), escaped_composite, ARRAY_SIZE(escaped_composite)), testUtilErrorName(data[i].ret), symbol->width, symbol->errtxt, data[i].compare_previous, data[i].comment); } else { assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected); diff --git a/backend/tests/test_output.c b/backend/tests/test_output.c index e678e2a1..b212f5f7 100644 --- a/backend/tests/test_output.c +++ b/backend/tests/test_output.c @@ -47,7 +47,7 @@ static void test_quiet_zones(void) { symbol.symbology = i; symbol.output_options = BARCODE_QUIET_ZONES; ret = out_quiet_zones_test(&symbol, hide_text, &left, &right, &top, &bottom); - if (i != BARCODE_FLAT) { // Only one which isn't marked as done + if (i != BARCODE_FLAT && i != BARCODE_BC412) { // Only two which aren't marked as done assert_nonzero(ret, "i:%d %s not done\n", i, testUtilBarcodeName(i)); } } diff --git a/backend/tests/test_qr.c b/backend/tests/test_qr.c index 3cdcfad8..9e041897 100644 --- a/backend/tests/test_qr.c +++ b/backend/tests/test_qr.c @@ -290,22 +290,22 @@ static void test_qr_input(int index, int generate, int debug) { /*126*/ { UNICODE_MODE, 16384, 4, 8 << 8, "é", 0, 16384, "7C 04 00 04 02 C3 A9 00 EC", 1, 1, "ECI-16384 B2 (no conversion)" }, /*127*/ { UNICODE_MODE, 3, 4, -1, "product:Google Pixel 4a - 128 GB of Storage - Black;price:$439.97", 0, 3, "(86) 70 34 39 70 72 6F 64 75 63 74 3A 47 6F 6F 67 6C 65 20 50 69 78 65 6C 20 34 61 20 2D", 0, 1, "ECI-3 B57 A8; BWIPP different encodation (B65)" }, /*128*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\176", 0, 0, "80 10 1F 00 EC 11 EC 11 EC", 1, 1, "K1 (Shift JIS 0x817E)" }, - /*129*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\177", 0, 0, "40 28 17 F0 EC 11 EC 11 EC", 1, 1, "B2 (0x817F previously used Kanji mode, now excludes trailing 0x7F)" }, + /*129*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\177", 0, 0, "40 28 17 F0 EC 11 EC 11 EC", 0, 1, "B2 (0x817F previously used Kanji mode, now excludes trailing 0x7F); BWIPP TODO: exclude also" }, /*130*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\200", 0, 0, "80 10 20 00 EC 11 EC 11 EC", 1, 1, "K1 (Shift JIS 0x8180)" }, /*131*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\237\176", 0, 0, "80 1B 5F 00 EC 11 EC 11 EC", 1, 1, "K1 (Shift JIS 0x9F7E)" }, - /*132*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\237\177", 0, 0, "40 29 F7 F0 EC 11 EC 11 EC", 1, 1, "B2 (0x9F7F previously used Kanji mode, now excludes trailing 0x7F)" }, - /*133*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\340\176", 0, 0, "80 1B BF 00 EC 11 EC 11 EC", 1, 1, "K1 (Shift JIS 0xE07E)" }, - /*134*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\340\177", 0, 0, "40 2E 07 F0 EC 11 EC 11 EC", 1, 1, "B2 (0xE07F previously used Kanji mode, now excludes trailing 0x7F)" }, - /*135*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\352\244", 0, 0, "80 1F 92 00 EC 11 EC 11 EC", 1, 1, "K1 (Shift JIS 0xEAA4, last valid codepoint)" }, - /*136*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\353\277", 0, 0, "80 1F FF 80 EC 11 EC 11 EC", 1, 1, "K1 (0xEBBF undefined in Shift JIS but not checked and uses Kanji mode)" }, + /*132*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\237\177", 0, 0, "40 29 F7 F0 EC 11 EC 11 EC", 0, 1, "B2 (0x9F7F previously used Kanji mode, now excludes trailing 0x7F); BWIPP TODO: exclude also" }, + /*133*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE | (5 << 8), "\340\176", 0, 0, "80 1B BF 00 EC 11 EC 11 EC", 1, 1, "K1 (Shift JIS 0xE07E)" }, + /*134*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\340\177", 0, 0, "40 2E 07 F0 EC 11 EC 11 EC", 0, 1, "B2 (0xE07F previously used Kanji mode, now excludes trailing 0x7F); BWIPP TODO: exclude also" }, + /*135*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE | (4 << 8), "\352\244", 0, 0, "80 1F 92 00 EC 11 EC 11 EC", 1, 1, "K1 (Shift JIS 0xEAA4, last valid codepoint)" }, + /*136*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\353\277", 0, 0, "80 1F FF 80 EC 11 EC 11 EC", 0, 1, "K1 (0xEBBF undefined in Shift JIS but not checked and uses Kanji mode); BWIPP TODO: exclude also" }, /*137*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\353\300", 0, 0, "40 2E BC 00 EC 11 EC 11 EC", 1, 1, "B2 (0xEBC0 was always excluded)" }, /*138*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\300", 0, 0, "80 10 40 00 EC 11 EC 11 EC", 1, 1, "K1 (Shift JIS 0x81C0)" }, - /*139*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\374", 0, 0, "80 10 5E 00 EC 11 EC 11 EC", 1, 1, "K1 (Shift JIS 0x81FC)" }, - /*140*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\375", 0, 0, "40 28 1F D0 EC 11 EC 11 EC", 1, 1, "B2 (0x81FD previously used Kanji mode, now excludes trailing 0xFD)" }, - /*141*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\376", 0, 0, "40 28 1F E0 EC 11 EC 11 EC", 1, 1, "B2 (0x81FE previously used Kanji mode, now excludes trailing 0xFE)" }, - /*142*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\377", 0, 0, "40 28 1F F0 EC 11 EC 11 EC", 1, 1, "B2 (0x81FF previously used Kanji mode, now excludes trailing 0xFF)" }, - /*143*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\377", 0, 0, "40 28 1F F0 EC 11 EC 11 EC", 1, 1, "B2 (0x81FF previously used Kanji mode, now excludes trailing 0xFF)" }, - /*144*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\255", 0, 0, "80 10 36 80 EC 11 EC 11 EC", 1, 1, "K1 (0x81AD undefined in Shift JIS but not checked and uses Kanji mode)" }, + /*139*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE | (2 << 8), "\201\374", 0, 0, "80 10 5E 00 EC 11 EC 11 EC", 1, 1, "K1 (Shift JIS 0x81FC)" }, + /*140*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\375", 0, 0, "40 28 1F D0 EC 11 EC 11 EC", 0, 1, "B2 (0x81FD previously used Kanji mode, now excludes trailing 0xFD); BWIPP TODO: exclude also" }, + /*141*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\376", 0, 0, "40 28 1F E0 EC 11 EC 11 EC", 0, 1, "B2 (0x81FE previously used Kanji mode, now excludes trailing 0xFE); BWIPP TODO: exclude also" }, + /*142*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\377", 0, 0, "40 28 1F F0 EC 11 EC 11 EC", 0, 1, "B2 (0x81FF previously used Kanji mode, now excludes trailing 0xFF); BWIPP TODO: exclude also" }, + /*143*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\377", 0, 0, "40 28 1F F0 EC 11 EC 11 EC", 0, 1, "B2 (0x81FF previously used Kanji mode, now excludes trailing 0xFF); BWIPP TODO: exclude also" }, + /*144*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE | (7 << 8), "\201\255", 0, 0, "80 10 36 80 EC 11 EC 11 EC", 1, 1, "K1 (0x81AD undefined in Shift JIS but not checked and uses Kanji mode)" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; diff --git a/backend/tests/testcommon.c b/backend/tests/testcommon.c index 153a1b3e..efdd3af8 100644 --- a/backend/tests/testcommon.c +++ b/backend/tests/testcommon.c @@ -27,11 +27,12 @@ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* SPDX-License-Identifier: BSD-3-Clause */ /* * Adapted from qrencode/tests/common.c * Copyright (C) 2006-2017 Kentaro Fukuchi */ +/* Due to above: */ +/* SPDX-License-Identifier: LGPL-2.1+ */ #include "testcommon.h" @@ -2012,6 +2013,7 @@ static const char *testUtilBwippName(int index, const struct zint_symbol *symbol { "qrcode", BARCODE_UPNQR, 143, 0, 0, 1, 0, 0, }, { "ultracode", BARCODE_ULTRA, 144, 1, 1, 0, 0, 0, }, { "rectangularmicroqrcode", BARCODE_RMQR, 145, 1, 1, 1, 0, 0, }, + { "bc412", BARCODE_BC412, 146, 1, 1, 0, 0, 0, }, }; static const int data_size = ARRAY_SIZE(data); @@ -2762,6 +2764,8 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int itoc(symbol->structapp.count)); bwipp_opts = bwipp_opts_buf; } + } else if (symbology == BARCODE_BC412) { + // TODO: } } diff --git a/backend/tests/testcommon.h b/backend/tests/testcommon.h index 45385525..6a02c5a1 100644 --- a/backend/tests/testcommon.h +++ b/backend/tests/testcommon.h @@ -31,6 +31,8 @@ * Adapted from qrencode/tests/common.h * Copyright (C) 2006-2017 Kentaro Fukuchi */ +/* Due to above: */ +/* SPDX-License-Identifier: LGPL-2.1+ */ #ifndef Z_TESTCOMMON_H #define Z_TESTCOMMON_H diff --git a/backend/tests/tools/bwipp_dump-barcode.ps.diff b/backend/tests/tools/bwipp_dump-barcode.ps.diff index 1b8cb48e..e84ab1d0 100644 --- a/backend/tests/tools/bwipp_dump-barcode.ps.diff +++ b/backend/tests/tools/bwipp_dump-barcode.ps.diff @@ -1,6 +1,6 @@ ---- /home/mburke/code/bwipp/postscriptbarcode/build/monolithic/barcode.ps 2022-05-09 17:52:29.878548024 +0100 -+++ backend/tests/tools/bwipp_dump.ps 2022-05-09 18:09:55.849954110 +0100 -@@ -15187,8 +15187,8 @@ +--- /home/mburke/code/bwipp/postscriptbarcode/build/monolithic/barcode.ps 2022-07-03 21:45:03.217966554 +0100 ++++ backend/tests/tools/bwipp_dump.ps 2022-07-03 21:50:45.106786827 +0100 +@@ -15224,8 +15224,8 @@ } bind /fime { /sbs [2.25 6.75 2.25 15.75 2.25 6.75 2.25] def @@ -11,7 +11,7 @@ } bind >> def -@@ -26479,34 +26479,80 @@ +@@ -26518,34 +26518,80 @@ pop } ifelse @@ -111,7 +111,7 @@ end -@@ -26565,7 +26611,7 @@ +@@ -26604,7 +26650,7 @@ pop } ifelse @@ -120,7 +120,7 @@ % Get the result of encoding with ean8 and gs1-cc options (lintype) (ean8) put -@@ -26573,29 +26619,75 @@ +@@ -26612,29 +26658,75 @@ options (dontdraw) true put % Plot the linear part @@ -216,7 +216,7 @@ end -@@ -26654,34 +26746,80 @@ +@@ -26693,34 +26785,80 @@ pop } ifelse @@ -316,7 +316,7 @@ end -@@ -26755,34 +26893,80 @@ +@@ -26794,34 +26932,80 @@ /opt options >> def @@ -416,7 +416,7 @@ end -@@ -26841,7 +27025,7 @@ +@@ -26880,7 +27064,7 @@ pop } ifelse @@ -425,7 +425,7 @@ options (lintype) (databaromni) put options (linkage) true put -@@ -26852,7 +27036,7 @@ +@@ -26891,7 +27075,7 @@ linear options //databaromni exec dup (sbs) get /linsbs exch def dup (bhs) get 0 get 72 mul /linheight exch def @@ -434,7 +434,7 @@ % Plot the separator /sepfinder { -@@ -26883,20 +27067,66 @@ +@@ -26922,20 +27106,66 @@ sep 0 [0 0 0] putinterval sep sep length 4 sub [0 0 0 0] putinterval 18 sepfinder 64 sepfinder @@ -513,7 +513,7 @@ end -@@ -26954,7 +27184,7 @@ +@@ -26993,7 +27223,7 @@ pop } ifelse @@ -522,7 +522,7 @@ options (lintype) (databarstacked) put options (linkage) true put -@@ -26965,7 +27195,7 @@ +@@ -27004,7 +27234,7 @@ linear options //databarstacked exec dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def dup (pixy) get /linheight exch def @@ -531,7 +531,7 @@ % Plot the separator /sepfinder { -@@ -26993,20 +27223,52 @@ +@@ -27032,20 +27262,52 @@ sep 0 [ 0 0 0 0 ] putinterval sep sep length 4 sub [ 0 0 0 0 ] putinterval 18 sepfinder @@ -596,7 +596,7 @@ end -@@ -27064,7 +27326,7 @@ +@@ -27103,7 +27365,7 @@ pop } ifelse @@ -605,7 +605,7 @@ options (lintype) (databarstackedomni) put options (linkage) true put -@@ -27075,7 +27337,7 @@ +@@ -27114,7 +27376,7 @@ linear options //databarstackedomni exec dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def dup (pixy) get /linheight exch def @@ -614,7 +614,7 @@ % Plot the separator /sepfinder { -@@ -27103,20 +27365,52 @@ +@@ -27142,20 +27404,52 @@ sep 0 [ 0 0 0 0 ] putinterval sep sep length 4 sub [ 0 0 0 0 ] putinterval 18 sepfinder @@ -679,7 +679,7 @@ end -@@ -27289,7 +27583,7 @@ +@@ -27328,7 +27622,7 @@ pop } ifelse @@ -688,7 +688,7 @@ options (lintype) (databarlimited) put options (linkage) true put -@@ -27300,7 +27594,7 @@ +@@ -27339,7 +27633,7 @@ linear options //databarlimited exec dup (sbs) get /linsbs exch def dup (bhs) get 0 get 72 mul /linheight exch def @@ -697,7 +697,7 @@ % Plot the separator mark -@@ -27308,22 +27602,68 @@ +@@ -27347,22 +27641,68 @@ counttomark 1 sub array astore /sep exch def pop pop 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 @@ -780,7 +780,7 @@ end -@@ -27382,7 +27722,7 @@ +@@ -27421,7 +27761,7 @@ pop } ifelse @@ -789,7 +789,7 @@ options (lintype) (databarexpanded) put options (linkage) true put -@@ -27393,7 +27733,7 @@ +@@ -27432,7 +27772,7 @@ linear options //databarexpanded exec dup (sbs) get /linsbs exch def dup (bhs) get 0 get 72 mul /linheight exch def @@ -798,7 +798,7 @@ % Plot the separator /sepfinder { -@@ -27422,20 +27762,60 @@ +@@ -27461,20 +27801,60 @@ 18 98 bot length 13 sub {} for 69 98 bot length 13 sub {} for ] {sepfinder} forall @@ -871,7 +871,7 @@ end -@@ -27493,7 +27873,7 @@ +@@ -27532,7 +27912,7 @@ pop } ifelse @@ -880,7 +880,7 @@ options (lintype) (databarexpandedstacked) put options (linkage) true put -@@ -27504,7 +27884,7 @@ +@@ -27543,7 +27923,7 @@ linear options //databarexpandedstacked exec dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def dup (pixy) get /linheight exch def @@ -889,7 +889,7 @@ % Plot the separator /sepfinder { -@@ -27530,21 +27910,49 @@ +@@ -27569,21 +27949,49 @@ 19 98 bot length 13 sub {} for 70 98 bot length 13 sub {} for ] {sepfinder} forall @@ -952,7 +952,7 @@ end -@@ -27603,7 +28011,7 @@ +@@ -27642,7 +28050,7 @@ pop } ifelse @@ -961,7 +961,7 @@ options (inkspread) (0) put options (dontdraw) true put -@@ -27630,35 +28038,87 @@ +@@ -27669,35 +28077,87 @@ linear << options {} forall >> //gs1-128 exec dup (sbs) get /linsbs exch def dup (bhs) get 0 get 72 mul /linheight exch def @@ -1063,7 +1063,7 @@ end -@@ -29091,3 +29551,189 @@ +@@ -29130,3 +29590,189 @@ % --END ENCODER hibcazteccode-- % --END TEMPLATE-- diff --git a/backend/tests/tools/bwipp_dump.ps.tar.xz b/backend/tests/tools/bwipp_dump.ps.tar.xz index 1a7be66b..bd02d7f0 100644 Binary files a/backend/tests/tools/bwipp_dump.ps.tar.xz and b/backend/tests/tools/bwipp_dump.ps.tar.xz differ diff --git a/backend_qt/backend_qt.pro b/backend_qt/backend_qt.pro index ec541fd1..6e87d6a5 100644 --- a/backend_qt/backend_qt.pro +++ b/backend_qt/backend_qt.pro @@ -73,6 +73,7 @@ HEADERS += ../backend/aztec.h \ SOURCES += ../backend/2of5.c \ ../backend/auspost.c \ ../backend/aztec.c \ + ../backend/bc412.c \ ../backend/bmp.c \ ../backend/codablock.c \ ../backend/code.c \ diff --git a/backend_qt/backend_vc8.pro b/backend_qt/backend_vc8.pro index f9d07499..4c1c7275 100644 --- a/backend_qt/backend_vc8.pro +++ b/backend_qt/backend_vc8.pro @@ -55,6 +55,7 @@ HEADERS += ../backend/aztec.h \ SOURCES += ../backend/2of5.c \ ../backend/auspost.c \ ../backend/aztec.c \ + ../backend/bc412.c \ ../backend/bmp.c \ ../backend/codablock.c \ ../backend/code.c \ diff --git a/backend_tcl/configure b/backend_tcl/configure index 6168f51e..4283ea12 100755 --- a/backend_tcl/configure +++ b/backend_tcl/configure @@ -5567,6 +5567,7 @@ done ../backend/2of5.c ../backend/auspost.c ../backend/aztec.c + ../backend/bc412.c ../backend/bmp.c ../backend/codablock.c ../backend/code128.c diff --git a/backend_tcl/configure.in b/backend_tcl/configure.in index 20bb909a..e3a3a448 100644 --- a/backend_tcl/configure.in +++ b/backend_tcl/configure.in @@ -70,6 +70,7 @@ TEA_ADD_SOURCES([ ../backend/2of5.c ../backend/auspost.c ../backend/aztec.c + ../backend/bc412.c ../backend/bmp.c ../backend/codablock.c ../backend/code128.c diff --git a/backend_tcl/zint.c b/backend_tcl/zint.c index 6e2e5cf4..fbfb5359 100644 --- a/backend_tcl/zint.c +++ b/backend_tcl/zint.c @@ -310,6 +310,7 @@ static const char *s_code_list[] = { "UPNQR", "UltraCode", "rMQR", + "BC412", NULL}; static const int s_code_number[] = { @@ -408,6 +409,7 @@ static const int s_code_number[] = { BARCODE_UPNQR, BARCODE_ULTRA, BARCODE_RMQR, + BARCODE_BC412, 0}; /* ECI TCL encoding names. diff --git a/frontend/main.c b/frontend/main.c index f4fe0be2..18aff631 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -450,7 +450,7 @@ static int get_barcode_name(const char *barcode_name) { { BARCODE_DBAR_EXPSTK_CC, "rssexpstackcc" }, /* Synonym */ { BARCODE_DBAR_LTD, "rssltd" }, /* Synonym */ { BARCODE_DBAR_LTD_CC, "rssltdcc" }, /* Synonym */ - { BARCODE_C25STANDARD, "standardcode2of5" }, + { BARCODE_C25STANDARD, "standardcode2of5" }, /* Synonym */ { BARCODE_TELEPEN, "telepen" }, { BARCODE_TELEPEN_NUM, "telepennum" }, { BARCODE_ULTRA, "ultra" }, diff --git a/frontend_qt/mainwindow.cpp b/frontend_qt/mainwindow.cpp index 2ff13f2a..f4288412 100644 --- a/frontend_qt/mainwindow.cpp +++ b/frontend_qt/mainwindow.cpp @@ -1282,6 +1282,8 @@ void MainWindow::copy_to_clipboard_png() { copy_to_clipboard(QSL(".zint.png"), QSL("PNG")); } +#else +void MainWindow::copy_to_clipboard_png() {} // Workaround Qt not parsing #ifndef NO_PNG in slots #endif void MainWindow::copy_to_clipboard_svg() diff --git a/frontend_qt/mainwindow.h b/frontend_qt/mainwindow.h index df0a4581..c3a69238 100644 --- a/frontend_qt/mainwindow.h +++ b/frontend_qt/mainwindow.h @@ -102,9 +102,7 @@ public slots: void copy_to_clipboard_emf(); void copy_to_clipboard_eps(); void copy_to_clipboard_gif(); -#ifndef NO_PNG - void copy_to_clipboard_png(); -#endif + void copy_to_clipboard_png(); // Note Qt can't handle #ifndef NO_PNG in slots void copy_to_clipboard_pcx(); void copy_to_clipboard_svg(); void copy_to_clipboard_tif(); diff --git a/win32/libzint.vcxproj b/win32/libzint.vcxproj index 8413cd35..7fe8e82c 100644 --- a/win32/libzint.vcxproj +++ b/win32/libzint.vcxproj @@ -126,6 +126,7 @@ + diff --git a/win32/vs2008/libzint.vcproj b/win32/vs2008/libzint.vcproj index eb4cb102..5e53b36e 100644 --- a/win32/vs2008/libzint.vcproj +++ b/win32/vs2008/libzint.vcproj @@ -275,6 +275,10 @@ RelativePath="..\backend\aztec.c" > + + diff --git a/win32/vs2015/libzint.vcxproj b/win32/vs2015/libzint.vcxproj index 9b5a02e8..70078974 100644 --- a/win32/vs2015/libzint.vcxproj +++ b/win32/vs2015/libzint.vcxproj @@ -304,6 +304,7 @@ + diff --git a/win32/vs2015/vsx/libzintMD.vcxproj b/win32/vs2015/vsx/libzintMD.vcxproj index 627c530b..bffbf744 100644 --- a/win32/vs2015/vsx/libzintMD.vcxproj +++ b/win32/vs2015/vsx/libzintMD.vcxproj @@ -71,6 +71,7 @@ + diff --git a/win32/vs2019/libzint.vcxproj b/win32/vs2019/libzint.vcxproj index 43c81558..f87966c6 100644 --- a/win32/vs2019/libzint.vcxproj +++ b/win32/vs2019/libzint.vcxproj @@ -126,6 +126,7 @@ + diff --git a/win32/zint_cmdline_vc6/zint_cmdline_vc6.dsp b/win32/zint_cmdline_vc6/zint_cmdline_vc6.dsp index e0e6e0a5..1301a233 100644 --- a/win32/zint_cmdline_vc6/zint_cmdline_vc6.dsp +++ b/win32/zint_cmdline_vc6/zint_cmdline_vc6.dsp @@ -100,6 +100,10 @@ SOURCE=..\..\backend\aztec.c # End Source File # Begin Source File +SOURCE=..\..\backend\bc412.c +# End Source File +# Begin Source File + SOURCE=..\..\backend\bmp.c # End Source File # Begin Source File