diff --git a/ChangeLog b/ChangeLog index c61055d5..ce2403a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,6 +24,8 @@ Changes - Add output_options BARCODE_QUIET_ZONES and BARCODE_NO_QUIET_ZONES - Allow dummy AI "[]" if GS1NOCHECK_MODE and has data (#204) - raster.c: improve non-half-integer interpolation performance +- Add Structured Append support for AZTEC, CODEONE, DATAMATRIX, DOTCODE, + GRIDMATRIX, MAXICODE, MICROPDF417, PDF417, QRCODE, ULTRA Bugs ---- diff --git a/backend/2of5.c b/backend/2of5.c index d89961df..cb817017 100644 --- a/backend/2of5.c +++ b/backend/2of5.c @@ -70,11 +70,13 @@ static int c25_common(struct zint_symbol *symbol, const unsigned char source[], int have_checkdigit = symbol->option_2 == 1 || symbol->option_2 == 2; if (length > max) { + /* errtxt 301: 303: 305: 307: */ sprintf(symbol->errtxt, "%d: Input too long (%d character maximum)", error_base, max); return ZINT_ERROR_TOO_LONG; } error_number = is_sane(NEON, source, length); if (error_number == ZINT_ERROR_INVALID_DATA) { + /* errtxt 302: 304: 306: 308: */ sprintf(symbol->errtxt, "%d: Invalid character in data (digits only)", error_base + 1); return error_number; } diff --git a/backend/aztec.c b/backend/aztec.c index 75b449b5..fd0223ee 100644 --- a/backend/aztec.c +++ b/backend/aztec.c @@ -99,8 +99,8 @@ static int az_bin_append_posn(const int arg, const int length, char *binary, con return bin_append_posn(arg, length, binary, bin_posn); } -static int aztec_text_process(const unsigned char source[], int src_len, char binary_string[], const int gs1, - const int eci, int *data_length, const int debug) { +static int aztec_text_process(const unsigned char source[], int src_len, int bp, char binary_string[], const int gs1, + const int eci, int *data_length, const int debug_print) { int i, j; char current_mode; @@ -108,7 +108,6 @@ static int aztec_text_process(const unsigned char source[], int src_len, char bi char next_mode; int reduced_length; int byte_mode = 0; - int bp; #ifndef _MSC_VER char encode_mode[src_len + 1]; @@ -190,7 +189,7 @@ static int aztec_text_process(const unsigned char source[], int src_len, char bi } } - if (debug) { + if (debug_print) { printf("First Pass:\n"); printf("%.*s\n", src_len, encode_mode); } @@ -455,13 +454,11 @@ static int aztec_text_process(const unsigned char source[], int src_len, char bi } } - if (debug) { + if (debug_print) { printf("%.*s\n", reduced_length, reduced_source); printf("%.*s\n", reduced_length, reduced_encode_mode); } - bp = 0; - if (gs1) { bp = bin_append_posn(0, 5, binary_string, bp); // P/S bp = bin_append_posn(0, 5, binary_string, bp); // FLG(n) @@ -727,7 +724,7 @@ static int aztec_text_process(const unsigned char source[], int src_len, char bi } } - if (debug) { + if (debug_print) { printf("Binary String:\n"); printf("%.*s\n", bp, binary_string); } @@ -833,8 +830,9 @@ INTERNAL int aztec(struct zint_symbol *symbol, unsigned char source[], int lengt unsigned char desc_data[4], desc_ecc[6]; int error_number, compact, data_length, data_maxsize, codeword_size, adjusted_length; int remainder, padbits, count, gs1, adjustment_size; - int debug = (symbol->debug & ZINT_DEBUG_PRINT), reader = 0; + int debug_print = (symbol->debug & ZINT_DEBUG_PRINT), reader = 0; int comp_loop = 4; + int bp = 0; rs_t rs; rs_uint_t rs_uint; @@ -857,7 +855,51 @@ INTERNAL int aztec(struct zint_symbol *symbol, unsigned char source[], int lengt return ZINT_ERROR_INVALID_OPTION; } - error_number = aztec_text_process(source, length, binary_string, gs1, symbol->eci, &data_length, debug); + if (symbol->structapp.count) { + /* Structured Append info as string + ID + + index + count + NUL */ + unsigned char sa_src[1 + sizeof(symbol->structapp.id) + 1 + 1 + 1 + 1] = {0}; + int sa_len; + int id_len; + + if (symbol->structapp.count < 2 || symbol->structapp.count > 26) { + strcpy(symbol->errtxt, "701: Structured Append count out of range (2-26)"); + return ZINT_ERROR_INVALID_OPTION; + } + if (symbol->structapp.index < 1 || symbol->structapp.index > symbol->structapp.count) { + sprintf(symbol->errtxt, "702: Structured Append index out of range (1-%d)", symbol->structapp.count); + return ZINT_ERROR_INVALID_OPTION; + } + + for (id_len = 0; id_len < 32 && symbol->structapp.id[id_len]; id_len++); + + if (id_len && chr_cnt((const unsigned char *) symbol->structapp.id, id_len, ' ')) { + strcpy(symbol->errtxt, "703: Structured Append ID cannot contain spaces"); + return ZINT_ERROR_INVALID_OPTION; + } + + bp = bin_append_posn(29, 5, binary_string, bp); // M/L + bp = bin_append_posn(29, 5, binary_string, bp); // U/L + + sa_len = 0; + if (id_len) { /* ID has a space on either side */ + sa_src[sa_len++] = ' '; + memcpy(sa_src + sa_len, symbol->structapp.id, id_len); + sa_len += id_len; + sa_src[sa_len++] = ' '; + } + sa_src[sa_len++] = 'A' + symbol->structapp.index - 1; + sa_src[sa_len++] = 'A' + symbol->structapp.count - 1; + if (debug_print) { + printf("Structured Append Count: %d, Index: %d, ID: %.32s, String: %s\n", + symbol->structapp.count, symbol->structapp.count, symbol->structapp.id, sa_src); + } + + (void) aztec_text_process(sa_src, sa_len, bp, binary_string, 0 /*gs1*/, 0 /*eci*/, &bp, debug_print); + /* Will be in U/L due to uppercase A-Z index/count indicators at end */ + } + + error_number = aztec_text_process(source, length, bp, binary_string, gs1, symbol->eci, &data_length, + debug_print); if (error_number != 0) { strcpy(symbol->errtxt, "502: Input too long or too many extended ASCII characters"); @@ -1003,7 +1045,7 @@ INTERNAL int aztec(struct zint_symbol *symbol, unsigned char source[], int lengt if (padbits == codeword_size) { padbits = 0; } - if (debug) printf("Remainder: %d Pad bits: %d\n", remainder, padbits); + if (debug_print) printf("Remainder: %d Pad bits: %d\n", remainder, padbits); for (i = 0; i < padbits; i++) { adjusted_string[adjusted_length++] = '1'; @@ -1019,7 +1061,7 @@ INTERNAL int aztec(struct zint_symbol *symbol, unsigned char source[], int lengt adjusted_string[adjusted_length - 1] = '0'; } - if (debug) { + if (debug_print) { printf("Codewords:\n"); for (i = 0; i < (adjusted_length / codeword_size); i++) { for (j = 0; j < codeword_size; j++) { @@ -1093,7 +1135,7 @@ INTERNAL int aztec(struct zint_symbol *symbol, unsigned char source[], int lengt if (padbits == codeword_size) { padbits = 0; } - if (debug) printf("Remainder: %d Pad bits: %d\n", remainder, padbits); + if (debug_print) printf("Remainder: %d Pad bits: %d\n", remainder, padbits); for (i = 0; i < padbits; i++) { adjusted_string[adjusted_length++] = '1'; @@ -1121,7 +1163,7 @@ INTERNAL int aztec(struct zint_symbol *symbol, unsigned char source[], int lengt return ZINT_ERROR_TOO_LONG; } - if (debug) { + if (debug_print) { printf("Codewords:\n"); for (i = 0; i < (adjusted_length / codeword_size); i++) { printf("%.*s ", codeword_size, adjusted_string + i * codeword_size); @@ -1144,7 +1186,7 @@ INTERNAL int aztec(struct zint_symbol *symbol, unsigned char source[], int lengt ecc_blocks = AztecSizes[layers - 1] - data_blocks; } - if (debug) { + if (debug_print) { printf("Generating a %s symbol with %d layers\n", compact ? "compact" : "full-size", layers); printf("Requires %d", compact ? AztecCompactSizes[layers - 1] : AztecSizes[layers - 1]); printf(" codewords of %d-bits\n", codeword_size); @@ -1193,7 +1235,7 @@ INTERNAL int aztec(struct zint_symbol *symbol, unsigned char source[], int lengt case 12: if (!rs_uint_init_gf(&rs_uint, 0x1069, 4095)) { /* Can fail on malloc() */ /* Note using AUSPOST error nos range as out of 50x ones & 51x taken by CODEONE */ - strcpy(symbol->errtxt, "400: Insufficient memory for Reed-Solomon log tables"); + strcpy(symbol->errtxt, "700: Insufficient memory for Reed-Solomon log tables"); return ZINT_ERROR_MEMORY; } rs_uint_init_code(&rs_uint, ecc_blocks, 1); @@ -1249,7 +1291,7 @@ INTERNAL int aztec(struct zint_symbol *symbol, unsigned char source[], int lengt descriptor[i] = '0'; } } - if (debug) printf("Mode Message = %.8s\n", descriptor); + if (debug_print) printf("Mode Message = %.8s\n", descriptor); } else { /* The first 5 bits represent the number of layers minus 1 */ for (i = 0; i < 5; i++) { @@ -1277,7 +1319,7 @@ INTERNAL int aztec(struct zint_symbol *symbol, unsigned char source[], int lengt descriptor[i] = '0'; } } - if (debug) printf("Mode Message = %.16s\n", descriptor); + if (debug_print) printf("Mode Message = %.16s\n", descriptor); } /* Split into 4-bit codewords */ @@ -1409,7 +1451,7 @@ INTERNAL int aztec_runes(struct zint_symbol *symbol, unsigned char source[], int char binary_string[28]; unsigned char data_codewords[3], ecc_codewords[6]; int bp = 0; - int debug = symbol->debug & ZINT_DEBUG_PRINT; + int debug_print = symbol->debug & ZINT_DEBUG_PRINT; rs_t rs; input_value = 0; @@ -1460,7 +1502,7 @@ INTERNAL int aztec_runes(struct zint_symbol *symbol, unsigned char source[], int } } - if (debug) { + if (debug_print) { printf("Binary String: %.28s\n", binary_string); } diff --git a/backend/channel_precalcs.h b/backend/channel_precalcs.h index f979e1a9..de134a10 100644 --- a/backend/channel_precalcs.h +++ b/backend/channel_precalcs.h @@ -30,7 +30,7 @@ /* vim: set ts=4 sw=4 et : */ /* Channel code precalculated values to avoid excessive looping */ -/* To generate uncomment CHANNEL_GENERATE_PRECALCS define and run "./test_channel -f generate -g" */ +/* To generate uncomment CHANNEL_GENERATE_PRECALCS define and run "backend/tests/test_channel -f generate -g" */ /* Paste result below here */ static channel_precalc channel_precalcs7[] = { { 115338, { 1, 3, 1, 1, 1, 1, 5, 1, }, { 1, 1, 1, 2, 1, 2, 3, 3, }, { 1, 7, 5, 5, 5, 5, 5, }, { 1, 7, 7, 7, 6, 6, 5, }, }, diff --git a/backend/code.c b/backend/code.c index 1b4ba784..e4affb36 100644 --- a/backend/code.c +++ b/backend/code.c @@ -533,8 +533,8 @@ typedef const struct s_channel_precalc { //#define CHANNEL_GENERATE_PRECALCS #ifdef CHANNEL_GENERATE_PRECALCS -/* To generate precalc tables uncomment CHANNEL_GENERATE_PRECALCS define and run "./test_channel -f generate -g" and - place result in "channel_precalcs.h" */ +/* To generate precalc tables uncomment CHANNEL_GENERATE_PRECALCS define and run + "backend/tests/test_channel -f generate -g" and place result in "channel_precalcs.h" */ static void channel_generate_precalc(int channels, long value, int mod, int last, int B[8], int S[8], int bmax[7], int smax[7]) { int i; @@ -706,7 +706,7 @@ INTERNAL int channel_code(struct zint_symbol *symbol, unsigned char source[], in if (target_value > max_ranges[channels]) { if (channels == 8) { - sprintf(symbol->errtxt, "305: Value out of range (0 to %d)", max_ranges[channels]); + sprintf(symbol->errtxt, "318: Value out of range (0 to %d)", max_ranges[channels]); } else { sprintf(symbol->errtxt, "335: Value out of range (0 to %d) for %d channels", max_ranges[channels], channels); diff --git a/backend/code1.c b/backend/code1.c index 64460626..b04b5afe 100644 --- a/backend/code1.c +++ b/backend/code1.c @@ -517,9 +517,38 @@ static int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigne } else { target[tp++] = 232; /* FNC1 */ } - /* Note ignoring ECI if GS1 mode (up to caller to warn) */ + /* Note ignoring Structured Append and ECI if GS1 mode (up to caller to warn/error) */ } else { - if (symbol->eci) { + if (symbol->structapp.count) { + if (symbol->structapp.count < 16) { /* Group mode */ + if (symbol->eci && symbol->structapp.index == 1) { /* Initial pad indicator for 1st symbol only */ + target[tp++] = 129; /* Pad */ + target[tp++] = 233; /* FNC2 */ + target[tp++] = (symbol->structapp.index - 1) * 15 + (symbol->structapp.count - 1); + target[tp++] = '\\' + 1; /* Escape char */ + } else { + target[tp++] = (symbol->structapp.index - 1) * 15 + (symbol->structapp.count - 1); + target[tp++] = 233; /* FNC2 */ + } + } else { /* Extended Group mode */ + if (symbol->eci && symbol->structapp.index == 1) { /* Initial pad indicator for 1st symbol only */ + target[tp++] = 129; /* Pad */ + target[tp++] = '\\' + 1; /* Escape char */ + target[tp++] = 233; /* FNC2 */ + target[tp++] = symbol->structapp.index; + target[tp++] = symbol->structapp.count; + } else { + target[tp++] = symbol->structapp.index; + target[tp++] = symbol->structapp.count; + target[tp++] = 233; /* FNC2 */ + } + } + if (symbol->eci) { + eci_escape(symbol->eci, source, length, eci_buf, eci_length); + source = eci_buf; + length = eci_length; + } + } else if (symbol->eci) { target[tp++] = 129; /* Pad */ target[tp++] = '\\' + 1; /* Escape char */ eci_escape(symbol->eci, source, length, eci_buf, eci_length); @@ -942,6 +971,25 @@ INTERNAL int code_one(struct zint_symbol *symbol, unsigned char source[], int le return ZINT_ERROR_INVALID_OPTION; } + if (symbol->structapp.count) { + if ((symbol->input_mode & 0x07) == GS1_MODE) { + strcpy(symbol->errtxt, "710: Cannot have Structured Append and GS1 mode at the same time"); + return ZINT_ERROR_INVALID_OPTION; + } + if (symbol->structapp.count < 2 || symbol->structapp.count > 128) { + strcpy(symbol->errtxt, "711: Structured Append count out of range (2-128)"); + return ZINT_ERROR_INVALID_OPTION; + } + if (symbol->structapp.index < 1 || symbol->structapp.index > symbol->structapp.count) { + sprintf(symbol->errtxt, "712: Structured Append index out of range (1-%d)", symbol->structapp.count); + return ZINT_ERROR_INVALID_OPTION; + } + if (symbol->structapp.id[0]) { + strcpy(symbol->errtxt, "713: Structured Append ID not available for Code One"); + return ZINT_ERROR_INVALID_OPTION; + } + } + if (symbol->option_2 == 9) { /* Version S */ int codewords; @@ -949,6 +997,10 @@ INTERNAL int code_one(struct zint_symbol *symbol, unsigned char source[], int le unsigned int data[30], ecc[15]; int block_width; + if (symbol->structapp.count) { /* Version S */ + strcpy(symbol->errtxt, "714: Structured Append not supported for Version S"); + return ZINT_ERROR_INVALID_OPTION; + } if (length > 18) { strcpy(symbol->errtxt, "514: Input data too long for Version S"); return ZINT_ERROR_TOO_LONG; @@ -1460,7 +1512,10 @@ INTERNAL int code_one(struct zint_symbol *symbol, unsigned char source[], int le if (symbol->option_2 == 9) { /* Version S */ if (symbol->eci || (symbol->input_mode & 0x07) == GS1_MODE) { - strcpy(symbol->errtxt, "511: ECI and GS1 mode ignored for Version S"); + sprintf(symbol->errtxt, "511: %s ignored for Version S", + symbol->eci && (symbol->input_mode & 0x07) == GS1_MODE + ? "ECI and GS1 mode" + : symbol->eci ? "ECI" : "GS1 mode"); error_number = ZINT_WARN_INVALID_OPTION; } } else if (symbol->eci && (symbol->input_mode & 0x07) == GS1_MODE) { diff --git a/backend/code128.c b/backend/code128.c index 6fc0274f..75c0451e 100644 --- a/backend/code128.c +++ b/backend/code128.c @@ -1151,7 +1151,7 @@ INTERNAL int dpd_parcel(struct zint_symbol *symbol, unsigned char source[], int } if ((identifier < 32) || (identifier > 127)) { - strcpy(symbol->errtxt, "301: Invalid DPD identifier (first character), ASCII values 32 to 127 only"); + strcpy(symbol->errtxt, "343: Invalid DPD identifier (first character), ASCII values 32 to 127 only"); return ZINT_ERROR_INVALID_DATA; } diff --git a/backend/common.c b/backend/common.c index 5cc9cdf0..8fc5a763 100644 --- a/backend/common.c +++ b/backend/common.c @@ -435,7 +435,7 @@ INTERNAL int set_height(struct zint_symbol *symbol, const float min_row_height, return error_number; } -/* Removes excess precision from floats - see https://stackoverflow.com/q/503436/664741 */ +/* Removes excess precision from floats - see https://stackoverflow.com/q/503436 */ INTERNAL float stripf(const float arg) { return *((volatile const float *) &arg); } diff --git a/backend/common.h b/backend/common.h index 4fbbddee..a7a98405 100644 --- a/backend/common.h +++ b/backend/common.h @@ -72,7 +72,7 @@ # endif #endif -/* Is float integral value? (https://stackoverflow.com/a/40404149/664741) */ +/* Is float integral value? (https://stackoverflow.com/a/40404149) */ #define isfintf(arg) (fmodf(arg, 1.0f) == 0.0f) #if (defined(__GNUC__) || defined(__clang__)) && !defined(ZINT_TEST) && !defined(__MINGW32__) diff --git a/backend/dllversion.c b/backend/dllversion.c index 493859cd..d5cca9d0 100644 --- a/backend/dllversion.c +++ b/backend/dllversion.c @@ -30,6 +30,6 @@ HRESULT DllGetVersion (DLLVERSIONINFO2* pdvi) return S_OK; } #else -/* https://stackoverflow.com/a/26541331/664741 Suppresses gcc warning ISO C forbids an empty translation unit */ +/* https://stackoverflow.com/a/26541331 Suppresses gcc warning ISO C forbids an empty translation unit */ typedef int make_iso_compilers_happy; #endif /* _WIN32 */ diff --git a/backend/dmatrix.c b/backend/dmatrix.c index 19581b39..8250fe7f 100644 --- a/backend/dmatrix.c +++ b/backend/dmatrix.c @@ -632,9 +632,61 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[], sp = 0; tp = 0; - /* step (a) */ - current_mode = DM_ASCII; - next_mode = DM_ASCII; + if (symbol->structapp.count) { + int id1, id2; + + if (symbol->structapp.count < 2 || symbol->structapp.count > 16) { + strcpy(symbol->errtxt, "720: Structured Append count out of range (2-16)"); + return ZINT_ERROR_INVALID_OPTION; + } + if (symbol->structapp.index < 1 || symbol->structapp.index > symbol->structapp.count) { + sprintf(symbol->errtxt, "721: Structured Append index out of range (1-%d)", symbol->structapp.count); + return ZINT_ERROR_INVALID_OPTION; + } + if (symbol->structapp.id[0]) { + int id, id_len, id1_err, id2_err; + + for (id_len = 0; id_len < 32 && symbol->structapp.id[id_len]; id_len++); + + if (id_len > 6) { /* ID1 * 1000 + ID2 */ + strcpy(symbol->errtxt, "722: Structured Append ID too long (6 digit maximum)"); + return ZINT_ERROR_INVALID_OPTION; + } + + id = to_int((const unsigned char *) symbol->structapp.id, id_len); + if (id == -1) { + strcpy(symbol->errtxt, "723: Invalid Structured Append ID (digits only)"); + return ZINT_ERROR_INVALID_OPTION; + } + id1 = id / 1000; + id2 = id % 1000; + id1_err = id1 < 1 || id1 > 254; + id2_err = id2 < 1 || id2 > 254; + if (id1_err || id2_err) { + if (id1_err && id2_err) { + sprintf(symbol->errtxt, + "724: Structured Append ID1 '%03d' and ID2 '%03d' out of range (001-254) (ID '%03d%03d')", + id1, id2, id1, id2); + } else if (id1_err) { + sprintf(symbol->errtxt, + "725: Structured Append ID1 '%03d' out of range (001-254) (ID '%03d%03d')", + id1, id1, id2); + } else { + sprintf(symbol->errtxt, + "726: Structured Append ID2 '%03d' out of range (001-254) (ID '%03d%03d')", + id2, id1, id2); + } + return ZINT_ERROR_INVALID_OPTION; + } + } else { + id1 = id2 = 1; + } + + target[tp++] = 233; + target[tp++] = (17 - symbol->structapp.count) | ((symbol->structapp.index - 1) << 4); + target[tp++] = id1; + target[tp++] = id2; + } /* gs1 flag values: 0: no gs1, 1: gs1 with FNC1 serparator, 2: GS separator */ if ((symbol->input_mode & 0x07) == GS1_MODE) { @@ -657,11 +709,14 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[], if (gs1) { strcpy(symbol->errtxt, "521: Cannot encode in GS1 mode and Reader Initialisation at the same time"); return ZINT_ERROR_INVALID_OPTION; - } else { - target[tp] = 234; - tp++; /* Reader Programming */ - if (debug) printf("RP "); } + if (symbol->structapp.count) { + strcpy(symbol->errtxt, "727: Cannot have Structured Append and Reader Initialisation at the same time"); + return ZINT_ERROR_INVALID_OPTION; + } + target[tp] = 234; + tp++; /* Reader Programming */ + if (debug) printf("RP "); } if (symbol->eci > 0) { @@ -696,6 +751,7 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[], && (source[5] == '5' || source[5] == '6') && source[6] == '\x1d' && source[inputlen - 2] == '\x1e' && source[inputlen - 1] == '\x04') { + /* Output macro Codeword */ if (source[5] == '5') { target[tp] = 236; @@ -711,6 +767,10 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[], *p_length -= 2; } + /* step (a) */ + current_mode = DM_ASCII; + next_mode = DM_ASCII; + while (sp < inputlen) { current_mode = next_mode; @@ -1089,7 +1149,7 @@ static int data_matrix_200(struct zint_symbol *symbol, const unsigned char sourc unsigned char binary[2200]; int binlen; int symbolsize; - int taillength, error_number = 0; + int taillength, error_number; int H, W, FH, FW, datablock, bytes, rsblock; int debug = symbol->debug & ZINT_DEBUG_PRINT; diff --git a/backend/dotcode.c b/backend/dotcode.c index aebab297..55b61a19 100644 --- a/backend/dotcode.c +++ b/backend/dotcode.c @@ -280,22 +280,71 @@ static int score_array(const char Dots[], const int Hgt, const int Wid) { //------------------------------------------------------------------------- static void rsencode(const int nd, const int nc, unsigned char *wd) { - // roots (antilogs): root[0] = 1; for (i = 1; i < GF - 1; i++) root[i] = (PM * root[i - 1]) % GF; - static int root[GF - 1] = { - 1, 3, 9, 27, 81, 17, 51, 40, 7, 21, - 63, 76, 2, 6, 18, 54, 49, 34, 102, 80, - 14, 42, 13, 39, 4, 12, 36, 108, 98, 68, - 91, 47, 28, 84, 26, 78, 8, 24, 72, 103, - 83, 23, 69, 94, 56, 55, 52, 43, 16, 48, - 31, 93, 53, 46, 25, 75, 112, 110, 104, 86, - 32, 96, 62, 73, 106, 92, 50, 37, 111, 107, - 95, 59, 64, 79, 11, 33, 99, 71, 100, 74, - 109, 101, 77, 5, 15, 45, 22, 66, 85, 29, - 87, 35, 105, 89, 41, 10, 30, 90, 44, 19, - 57, 58, 61, 70, 97, 65, 82, 20, 60, 67, - 88, 38 + /* Pre-calculated coefficients for GF(113) of generator polys of degree 3 to 39. To generate run + "backend/tests/test_dotcode -f generate -g" and place result below */ + static const char coefs[820 - 5] = { /* 40*(41 + 1)/2 == 820 less 2 + 3 (degrees 1 and 2) */ + 1, 74, 12, 62, + 1, 106, 7, 107, 63, + 1, 89, 13, 101, 52, 59, + 1, 38, 107, 3, 99, 6, 42, + 1, 111, 56, 17, 92, 1, 28, 15, + 1, 104, 70, 77, 86, 35, 21, 45, 8, + 1, 83, 33, 76, 51, 37, 77, 56, 80, 58, + 1, 20, 2, 31, 9, 101, 6, 64, 55, 103, 75, + 1, 57, 64, 105, 26, 95, 14, 60, 50, 104, 44, 63, + 1, 55, 63, 90, 42, 43, 50, 32, 43, 4, 62, 88, 100, + 1, 49, 72, 51, 67, 17, 18, 71, 77, 85, 38, 55, 24, 78, + 1, 31, 94, 111, 53, 54, 51, 86, 42, 55, 90, 49, 51, 98, 65, + 1, 90, 2, 7, 48, 17, 73, 44, 31, 47, 58, 48, 4, 56, 84, 106, + 1, 41, 112, 22, 44, 38, 31, 83, 22, 110, 15, 31, 25, 86, 52, 58, 4, + 1, 7, 74, 56, 87, 11, 95, 46, 25, 40, 4, 86, 101, 27, 66, 98, 66, 90, + 1, 18, 38, 79, 25, 64, 103, 74, 79, 89, 105, 17, 30, 8, 24, 33, 14, 25, 86, + 1, 51, 67, 90, 33, 98, 68, 83, 35, 97, 104, 92, 26, 94, 62, 34, 86, 35, 7, 13, + 1, 37, 31, 56, 16, 88, 52, 35, 3, 59, 102, 105, 94, 69, 102, 70, 62, 74, 82, 28, 44, + 1, 108, 59, 110, 37, 94, 85, 111, 2, 46, 110, 2, 91, 76, 29, 80, 60, 69, 25, 87, 111, 73, + 1, 95, 11, 21, 76, 65, 106, 23, 28, 20, 77, 41, 65, 23, 58, 42, 37, 80, 32, 101, 110, 99, + 68, + 1, 56, 35, 44, 48, 39, 57, 70, 35, 58, 88, 89, 48, 87, 65, 40, 94, 106, 76, 96, 13, 103, + 49, 60, + 1, 52, 37, 17, 98, 73, 14, 68, 94, 31, 82, 76, 31, 8, 56, 6, 47, 69, 104, 18, 81, 51, + 89, 90, 99, + 1, 40, 91, 25, 7, 27, 42, 13, 69, 33, 49, 109, 23, 88, 73, 12, 88, 70, 67, 13, 91, 96, + 42, 39, 36, 55, + 1, 4, 7, 26, 11, 1, 87, 83, 53, 35, 104, 40, 54, 51, 69, 96, 108, 66, 33, 87, 75, 97, + 89, 109, 101, 2, 54, + 1, 9, 27, 61, 28, 56, 92, 66, 16, 74, 53, 108, 28, 95, 98, 102, 23, 41, 24, 26, 58, 20, + 9, 102, 81, 55, 64, 44, + 1, 24, 49, 14, 39, 24, 28, 90, 102, 88, 33, 112, 66, 63, 54, 103, 84, 47, 74, 47, 109, 99, + 83, 11, 29, 27, 98, 100, 95, + 1, 69, 112, 72, 104, 84, 91, 107, 84, 45, 38, 15, 21, 95, 64, 47, 86, 98, 42, 100, 77, 32, + 18, 17, 72, 89, 70, 103, 75, 94, + 1, 91, 48, 50, 106, 112, 18, 75, 65, 85, 11, 60, 12, 105, 7, 99, 103, 69, 51, 7, 17, 31, + 44, 74, 107, 91, 107, 61, 81, 49, 34, + 1, 44, 65, 54, 16, 102, 65, 20, 43, 81, 84, 108, 17, 106, 44, 109, 83, 87, 85, 96, 27, 23, + 56, 40, 19, 34, 11, 4, 39, 84, 104, 97, + 1, 16, 76, 42, 86, 106, 34, 8, 48, 7, 76, 16, 44, 82, 14, 7, 82, 23, 22, 89, 51, 58, + 90, 54, 29, 67, 76, 35, 40, 9, 12, 10, 109, + 1, 45, 88, 99, 61, 1, 57, 90, 54, 43, 53, 73, 56, 2, 19, 74, 59, 28, 11, 49, 33, 68, + 77, 65, 13, 4, 98, 92, 38, 39, 47, 19, 60, 110, + 1, 19, 48, 71, 86, 110, 31, 77, 87, 108, 65, 51, 79, 15, 80, 32, 56, 76, 74, 102, 2, 1, + 4, 97, 18, 5, 107, 30, 19, 68, 50, 40, 18, 19, 78, + 1, 54, 35, 56, 85, 69, 39, 32, 70, 102, 3, 66, 56, 68, 40, 7, 46, 2, 22, 93, 69, 71, + 39, 11, 23, 70, 56, 46, 52, 55, 57, 95, 62, 84, 65, 18, + 1, 46, 55, 2, 89, 67, 52, 59, 40, 107, 91, 42, 93, 72, 61, 26, 103, 86, 6, 30, 3, 84, + 36, 38, 48, 112, 61, 50, 23, 91, 69, 91, 93, 40, 71, 63, 82, + 1, 22, 81, 38, 41, 78, 26, 54, 93, 51, 9, 5, 102, 100, 28, 31, 44, 100, 89, 112, 74, 12, + 54, 78, 40, 90, 85, 55, 66, 104, 32, 17, 56, 68, 15, 54, 39, 66, + 1, 63, 79, 82, 17, 64, 60, 103, 47, 22, 66, 35, 81, 101, 60, 49, 72, 96, 8, 32, 33, 108, + 94, 32, 74, 35, 46, 37, 61, 98, 2, 86, 75, 104, 91, 104, 106, 83, 107, + 1, 73, 31, 81, 46, 8, 22, 25, 60, 40, 60, 17, 92, 7, 53, 84, 110, 25, 64, 112, 14, 99, + 44, 68, 55, 97, 57, 45, 92, 30, 78, 106, 31, 63, 1, 110, 16, 13, 33, 53, }; - int i, j, k, nw, start, step, c[GF]; + static const short cinds[39 - 2] = { /* Indexes into above coefs[] array */ + 0, 4, 9, 15, 22, 30, 39, 49, 60, 72, 85, 99, 114, 130, 147, 165, 184, 204, 225, 247, 270, 294, + 319, 345, 372, 400, 429, 459, 490, 522, 555, 589, 624, 660, 697, 735, 774, + }; + int i, j, k, nw, start, step; + const char *c; // Here we compute how many interleaved R-S blocks will be needed nw = nd + nc; @@ -306,33 +355,27 @@ static void rsencode(const int nd, const int nc, unsigned char *wd) { int ND = (nd - start + step - 1) / step; int NW = (nw - start + step - 1) / step; int NC = NW - ND; + unsigned char *e = wd + start + ND * step; - // first compute the generator polynomial "c" of order "NC": - - // Keep clang-tidy happy (as far as UndefinedBinaryOperatorResult warning below at least) - memset(c, 0, GF * sizeof(int)); - - c[0] = 1; - for (i = 1; i <= NC; i++) { - for (j = NC; j >= 1; j--) { - c[j] = (GF + c[j] - (root[i] * c[j - 1]) % GF) % GF; - } - } + // first set the generator polynomial "c" of order "NC": + c = coefs + cinds[NC - 3]; // & then compute the corresponding checkword values into wd[] // ... (a) starting at wd[start] & (b) stepping by step - for (i = ND; i < NW; i++) { - wd[start + i * step] = 0; + for (i = 0; i < NC; i++) { + e[i * step] = 0; } for (i = 0; i < ND; i++) { - k = (wd[start + i * step] + wd[start + ND * step]) % GF; + k = (wd[start + i * step] + e[0]) % GF; for (j = 0; j < NC - 1; j++) { - wd[start + (ND + j) * step] = (GF - ((c[j + 1] * k) % GF) + wd[start + (ND + j + 1) * step]) % GF; + e[j * step] = (GF - ((c[j + 1] * k) % GF) + e[(j + 1) * step]) % GF; } - wd[start + (ND + NC - 1) * step] = (GF - ((c[NC] * k) % GF)) % GF; + e[(NC - 1) * step] = (GF - ((c[NC] * k) % GF)) % GF; } - for (i = ND; i < NW; i++) { - wd[start + i * step] = (GF - wd[start + i * step]) % GF; + for (i = 0; i < NC; i++) { + if (e[i * step]) { + e[i * step] = GF - e[i * step]; + } } } } @@ -490,7 +533,7 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha int input_position, array_length, i; char encoding_mode; int inside_macro; - int debug = (symbol->debug & ZINT_DEBUG_PRINT); + int debug_print = (symbol->debug & ZINT_DEBUG_PRINT); int binary_buffer_size = 0; int lawrencium[6]; // Reversed radix 103 values int nx; @@ -557,7 +600,7 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha // inside_macro only gets set to 97, 98 or 99 if the last two characters are RS/EOT input_position += 2; done = 1; - if (debug) { + if (debug_print) { printf("A "); } } @@ -567,7 +610,7 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha // inside_macro only gets set to 100 if the last character is EOT input_position++; done = 1; - if (debug) { + if (debug_print) { printf("B "); } } @@ -592,7 +635,7 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha input_position += 7; inside_macro = 97; done = 1; - if (debug) { + if (debug_print) { printf("C1/1 "); } } @@ -606,7 +649,7 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha input_position += 7; inside_macro = 98; done = 1; - if (debug) { + if (debug_print) { printf("C1/2 "); } } @@ -620,7 +663,7 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha input_position += 7; inside_macro = 99; done = 1; - if (debug) { + if (debug_print) { printf("C1/3 "); } } @@ -636,7 +679,7 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha input_position += 4; inside_macro = 100; done = 1; - if (debug) { + if (debug_print) { printf("C1/4 "); } } @@ -657,7 +700,7 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha array_length++; input_position += 10; done = 1; - if (debug) { + if (debug_print) { printf("C2/1 "); } } @@ -675,7 +718,7 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha } array_length++; done = 1; - if (debug) { + if (debug_print) { printf("C2/2 "); } } @@ -703,7 +746,7 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha encoding_mode = 'X'; } done = 1; - if (debug) { + if (debug_print) { printf("C3 "); } } @@ -746,7 +789,7 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha } } done = 1; - if (debug) { + if (debug_print) { printf("C4 "); } } @@ -770,7 +813,7 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha encoding_mode = 'C'; } done = 1; - if (debug) { + if (debug_print) { printf("D1 "); } } @@ -783,7 +826,7 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha array_length++; input_position++; done = 1; - if (debug) { + if (debug_print) { printf("D2/1 "); } } else { @@ -822,7 +865,7 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha if (done == 1) { array_length++; input_position++; - if (debug) { + if (debug_print) { printf("D2/2 "); } } @@ -852,7 +895,7 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha encoding_mode = 'X'; } done = 1; - if (debug) { + if (debug_print) { printf("D3 "); } } @@ -876,7 +919,7 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha encoding_mode = 'A'; } done = 1; - if (debug) { + if (debug_print) { printf("D4 "); } } @@ -899,7 +942,7 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha encoding_mode = 'C'; } done = 1; - if (debug) { + if (debug_print) { printf("E1 "); } } @@ -913,7 +956,7 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha array_length++; input_position++; done = 1; - if (debug) { + if (debug_print) { printf("E2/1 "); } } else { @@ -926,7 +969,7 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha array_length++; input_position++; done = 1; - if (debug) { + if (debug_print) { printf("E2/2 "); } } @@ -955,7 +998,7 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha encoding_mode = 'X'; } done = 1; - if (debug) { + if (debug_print) { printf("E3 "); } } @@ -991,7 +1034,7 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha encoding_mode = 'B'; } done = 1; - if (debug) { + if (debug_print) { printf("E4 "); } } @@ -1028,7 +1071,7 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha encoding_mode = 'C'; } done = 1; - if (debug) { + if (debug_print) { printf("F1 "); } } @@ -1063,7 +1106,7 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha } input_position++; done = 1; - if (debug) { + if (debug_print) { printf("F2 "); } } @@ -1093,7 +1136,7 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha } array_length++; // done = 1 // As long as last branch not needed - if (debug) { + if (debug_print) { printf("F3 "); } } @@ -1115,7 +1158,28 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha *(binary_finish) = 1; } - if (debug) { + if (symbol->structapp.count) { + /* Need Code Set A or B - choosing A here (TEC-IT chooses B) */ + if (encoding_mode == 'C') { + codeword_array[array_length++] = 101; /* Latch A */ + } else if (encoding_mode == 'X') { + codeword_array[array_length++] = 109; /* Terminate with Latch A */ + *binary_finish = 0; + } + if (symbol->structapp.index < 10) { + codeword_array[array_length++] = 16 + symbol->structapp.index; /* '0' + index for 1-9 */ + } else { + codeword_array[array_length++] = 33 + symbol->structapp.index - 10; /* 'A' + index for A-Z */ + } + if (symbol->structapp.count < 10) { + codeword_array[array_length++] = 16 + symbol->structapp.count; /* '0' + count for 1-9 */ + } else { + codeword_array[array_length++] = 33 + symbol->structapp.count - 10; /* 'A' + count for A-Z */ + } + codeword_array[array_length++] = 108; /* FNC2 as last codeword */ + } + + if (debug_print) { printf("\n"); } @@ -1135,8 +1199,6 @@ static int make_dotstream(const unsigned char masked_array[], const int array_le bp = bin_append_posn(dot_patterns[masked_array[i]], 9, dot_stream, bp); } - dot_stream[bp] = '\0'; - return bp; } @@ -1320,10 +1382,10 @@ INTERNAL int dotcode(struct zint_symbol *symbol, unsigned char source[], int len int dot_stream_length; int high_score, best_mask; int binary_finish = 0; - int debug = symbol->debug; + int debug_print = (symbol->debug & ZINT_DEBUG_PRINT); int padding_dots, is_first; - /* Allow up to 4 codewords per input + 2 (FNC) + 4 (ECI) + 2 (special char 1st position) */ - int codeword_array_len = length * 4 + 8; + /* Allow 4 codewords per input + 2 (FNC) + 4 (ECI) + 2 (special char 1st position) + 4 (Structured Append) */ + int codeword_array_len = length * 4 + 8 + 3; #ifndef _MSC_VER unsigned char codeword_array[codeword_array_len]; @@ -1344,6 +1406,21 @@ INTERNAL int dotcode(struct zint_symbol *symbol, unsigned char source[], int len user_mask = 0; /* Ignore */ } + if (symbol->structapp.count) { + if (symbol->structapp.count < 2 || symbol->structapp.count > 35) { + strcpy(symbol->errtxt, "730: Structured Append count out of range (2-35)"); + return ZINT_ERROR_INVALID_OPTION; + } + if (symbol->structapp.index < 1 || symbol->structapp.index > symbol->structapp.count) { + sprintf(symbol->errtxt, "731: Structured Append index out of range (1-%d)", symbol->structapp.count); + return ZINT_ERROR_INVALID_OPTION; + } + if (symbol->structapp.id[0]) { + strcpy(symbol->errtxt, "732: Structured Append ID not available for DotCode"); + return ZINT_ERROR_INVALID_OPTION; + } + } + data_length = dotcode_encode_message(symbol, source, length, codeword_array, &binary_finish); /* Suppresses clang-tidy clang-analyzer-core.UndefinedBinaryOperatorResult/uninitialized.ArraySubscript @@ -1352,7 +1429,7 @@ INTERNAL int dotcode(struct zint_symbol *symbol, unsigned char source[], int len ecc_length = 3 + (data_length / 2); - if (debug & ZINT_DEBUG_PRINT) { + if (debug_print) { printf("Codeword length = %d, ECC length = %d\n", data_length, ecc_length); printf("Codewords: "); for (i = 0; i < data_length; i++) { @@ -1361,7 +1438,7 @@ INTERNAL int dotcode(struct zint_symbol *symbol, unsigned char source[], int len printf("\n"); } #ifdef ZINT_TEST - if (debug & ZINT_DEBUG_TEST) { + if (symbol->debug & ZINT_DEBUG_TEST) { debug_test_codeword_dump(symbol, codeword_array, data_length); } #endif @@ -1419,7 +1496,7 @@ INTERNAL int dotcode(struct zint_symbol *symbol, unsigned char source[], int len } } - if (debug & ZINT_DEBUG_PRINT) { + if (debug_print) { printf("Width = %d, Height = %d\n", width, height); } @@ -1488,7 +1565,7 @@ INTERNAL int dotcode(struct zint_symbol *symbol, unsigned char source[], int len if (user_mask) { best_mask = user_mask - 1; - if (debug & ZINT_DEBUG_PRINT) { + if (debug_print) { printf("Applying mask %d (specified)\n", best_mask); } } else { @@ -1501,14 +1578,14 @@ INTERNAL int dotcode(struct zint_symbol *symbol, unsigned char source[], int len /* Add pad bits */ for (jc = dot_stream_length; jc < n_dots; jc++) { - strcat(dot_stream, "1"); + dot_stream[dot_stream_length++] = '1'; } fold_dotstream(dot_stream, width, height, dot_array); mask_score[i] = score_array(dot_array, height, width); - if (debug & ZINT_DEBUG_PRINT) { + if (debug_print) { printf("Mask %d score is %d\n", i, mask_score[i]); } } @@ -1525,7 +1602,7 @@ INTERNAL int dotcode(struct zint_symbol *symbol, unsigned char source[], int len /* Re-evaluate using forced corners if needed */ if (high_score <= (height * width) / 2) { - if (debug & ZINT_DEBUG_PRINT) { + if (debug_print) { printf("High score %d <= %d (height * width) / 2\n", high_score, (height * width) / 2); } @@ -1537,7 +1614,7 @@ INTERNAL int dotcode(struct zint_symbol *symbol, unsigned char source[], int len /* Add pad bits */ for (jc = dot_stream_length; jc < n_dots; jc++) { - strcat(dot_stream, "1"); + dot_stream[dot_stream_length++] = '1'; } fold_dotstream(dot_stream, width, height, dot_array); @@ -1546,7 +1623,7 @@ INTERNAL int dotcode(struct zint_symbol *symbol, unsigned char source[], int len mask_score[i + 4] = score_array(dot_array, height, width); - if (debug & ZINT_DEBUG_PRINT) { + if (debug_print) { printf("Mask %d score is %d\n", i + 4, mask_score[i + 4]); } } @@ -1559,7 +1636,7 @@ INTERNAL int dotcode(struct zint_symbol *symbol, unsigned char source[], int len } } - if (debug & ZINT_DEBUG_PRINT) { + if (debug_print) { printf("Applying mask %d, high_score %d\n", best_mask, high_score); } } @@ -1567,12 +1644,26 @@ INTERNAL int dotcode(struct zint_symbol *symbol, unsigned char source[], int len /* Apply best mask */ apply_mask(best_mask % 4, data_length, masked_codeword_array, codeword_array, ecc_length); + if (debug_print) { + printf("Masked codewords (%d):", data_length); + for (i = 1; i < data_length + 1; i++) { + printf(" [%d]", masked_codeword_array[i]); + } + printf("\n"); + printf("Masked ECCs (%d):", ecc_length); + for (i = data_length + 1; i < data_length + ecc_length + 1; i++) { + printf(" [%d]", masked_codeword_array[i]); + } + printf("\n"); + } + dot_stream_length = make_dotstream(masked_codeword_array, (data_length + ecc_length + 1), dot_stream); /* Add pad bits */ for (jc = dot_stream_length; jc < n_dots; jc++) { - strcat(dot_stream, "1"); + dot_stream[dot_stream_length++] = '1'; } + if (debug_print) printf("Binary (%d): %.*s\n", dot_stream_length, dot_stream_length, dot_stream); fold_dotstream(dot_stream, width, height, dot_array); diff --git a/backend/gridmtx.c b/backend/gridmtx.c index 6e340552..44a504cc 100644 --- a/backend/gridmtx.c +++ b/backend/gridmtx.c @@ -324,8 +324,8 @@ static int add_shift_char(char binary[], int bp, int shifty, int debug) { return bp; } -static int gm_encode(unsigned int gbdata[], const int length, char binary[], const int reader, const int eci, - int *bin_len, int debug) { +static int gm_encode(unsigned int gbdata[], const int length, char binary[], const int reader, + const struct zint_structapp *p_structapp, const int eci, int *bin_len, int debug) { /* Create a binary stream representation of the input data. 7 sets are defined - Chinese characters, Numerals, Lower case letters, Upper case letters, Mixed numerals and latters, Control characters and 8-bit binary data */ @@ -352,10 +352,18 @@ static int gm_encode(unsigned int gbdata[], const int length, char binary[], con current_mode = 0; number_pad_posn = 0; - if (reader) { + if (reader && (!p_structapp || p_structapp->index == 1)) { /* Appears only in 1st symbol if Structured Append */ bp = bin_append_posn(10, 4, binary, bp); /* FNC3 - Reader Initialisation */ } + if (p_structapp) { + bp = bin_append_posn(9, 4, binary, bp); /* FNC2 - Structured Append */ + bp = bin_append_posn(to_int((const unsigned char *) p_structapp->id, (int) strlen(p_structapp->id)), 8, + binary, bp); /* File signature */ + bp = bin_append_posn(p_structapp->count - 1, 4, binary, bp); + bp = bin_append_posn(p_structapp->index - 1, 4, binary, bp); + } + if (eci != 0) { /* ECI assignment according to Table 8 */ bp = bin_append_posn(12, 4, binary, bp); /* ECI */ @@ -1007,6 +1015,7 @@ INTERNAL int grid_matrix(struct zint_symbol *symbol, unsigned char source[], int int data_cw, input_latch = 0; unsigned char word[1460] = {0}; int data_max, reader = 0; + const struct zint_structapp *p_structapp = NULL; int size_squared; int bin_len; int eci_length = get_eci_length(symbol->eci, source, length); @@ -1046,12 +1055,44 @@ INTERNAL int grid_matrix(struct zint_symbol *symbol, unsigned char source[], int if (symbol->output_options & READER_INIT) reader = 1; + if (symbol->structapp.count) { + if (symbol->structapp.count < 2 || symbol->structapp.count > 16) { + strcpy(symbol->errtxt, "536: Structured Append count out of range (2-16)"); + return ZINT_ERROR_INVALID_OPTION; + } + if (symbol->structapp.index < 1 || symbol->structapp.index > symbol->structapp.count) { + sprintf(symbol->errtxt, "537: Structured Append index out of range (1-%d)", symbol->structapp.count); + return ZINT_ERROR_INVALID_OPTION; + } + if (symbol->structapp.id[0]) { + int id, id_len; + + for (id_len = 0; id_len < 32 && symbol->structapp.id[id_len]; id_len++); + + if (id_len > 3) { /* 255 (8 bits) */ + strcpy(symbol->errtxt, "538: Structured Append ID too long (3 digit maximum)"); + return ZINT_ERROR_INVALID_OPTION; + } + + id = to_int((const unsigned char *) symbol->structapp.id, id_len); + if (id == -1) { + strcpy(symbol->errtxt, "539: Invalid Structured Append ID (digits only)"); + return ZINT_ERROR_INVALID_OPTION; + } + if (id > 255) { + sprintf(symbol->errtxt, "530: Structured Append ID '%d' out of range (0-255)", id); + return ZINT_ERROR_INVALID_OPTION; + } + } + p_structapp = &symbol->structapp; + } + if (symbol->eci > 811799) { strcpy(symbol->errtxt, "533: Invalid ECI"); return ZINT_ERROR_INVALID_OPTION; } - error_number = gm_encode(gbdata, length, binary, reader, symbol->eci, &bin_len, symbol->debug); + error_number = gm_encode(gbdata, length, binary, reader, p_structapp, symbol->eci, &bin_len, symbol->debug); if (error_number != 0) { strcpy(symbol->errtxt, "531: Input data too long"); return error_number; diff --git a/backend/library.c b/backend/library.c index 2009d14a..bd4098d0 100644 --- a/backend/library.c +++ b/backend/library.c @@ -44,7 +44,7 @@ #define TECHNETIUM "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%" /* It's assumed that int is at least 32 bits, the following will compile-time fail if not - * https://stackoverflow.com/a/1980056/664741 */ + * https://stackoverflow.com/a/1980056 */ typedef int static_assert_int_at_least_32bits[CHAR_BIT != 8 || sizeof(int) < 4 ? -1 : 1]; /* Create and initialize a symbol structure */ @@ -413,12 +413,15 @@ static int gs1_compliant(const int symbology) { case BARCODE_CODE16K: case BARCODE_AZTEC: case BARCODE_DATAMATRIX: - case BARCODE_CODEONE: case BARCODE_CODE49: case BARCODE_QRCODE: case BARCODE_DOTCODE: - case BARCODE_RMQR: + case BARCODE_CODEONE: case BARCODE_ULTRA: + case BARCODE_RMQR: + // TODO: case BARCODE_CODABLOCKF: + // TODO: case BARCODE_HANXIN: + // TODO: case BARCODE_GRIDMATRIX: return 1; break; } @@ -970,7 +973,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source, int symbol->symbology = BARCODE_PLESSEY; } else if (symbol->symbology == 48) { symbol->symbology = BARCODE_NVE18; - } else if (symbol->symbology == 54) { /* General Parcel up to tbarcode 9, Brazelian CEPNet for tbarcode 10+ */ + } else if (symbol->symbology == 54) { /* General Parcel up to tbarcode 9, Brazilian CEPNet for tbarcode 10+ */ warn_number = error_tag(symbol, ZINT_WARN_INVALID_OPTION, "210: General Parcel Code not supported"); if (warn_number >= ZINT_ERROR) { return warn_number; @@ -1603,6 +1606,28 @@ unsigned int ZBarcode_Cap(int symbol_id, unsigned int cap_flag) { break; } } + if (cap_flag & ZINT_CAP_STRUCTAPP) { + switch (symbol_id) { + case BARCODE_PDF417: + case BARCODE_PDF417COMP: + case BARCODE_MAXICODE: + case BARCODE_QRCODE: /* Note does not include MICROQR, UPNQR or rMQR */ + case BARCODE_DATAMATRIX: + case BARCODE_MICROPDF417: + case BARCODE_AZTEC: + case BARCODE_HIBC_DM: + case BARCODE_HIBC_QR: + case BARCODE_HIBC_PDF: + case BARCODE_HIBC_MICPDF: + case BARCODE_HIBC_AZTEC: + case BARCODE_DOTCODE: + case BARCODE_CODEONE: + case BARCODE_GRIDMATRIX: + case BARCODE_ULTRA: + result |= ZINT_CAP_STRUCTAPP; + break; + } + } return result; } diff --git a/backend/maxicode.c b/backend/maxicode.c index 0d9199ec..5e4a28a7 100644 --- a/backend/maxicode.c +++ b/backend/maxicode.c @@ -145,7 +145,7 @@ static int bestSurroundingSet(const int index, const int length, const unsigned /* Format text according to Appendix A */ static int maxi_text_process(unsigned char maxi_codeword[144], const int mode, const unsigned char in_source[], - int length, const int eci, const int scm_vv, const int debug_print) { + int length, const int structapp_cw, const int eci, const int scm_vv, const int debug_print) { unsigned char set[144], character[144] = {0}; int i, count, current_set, padding_set; @@ -447,6 +447,14 @@ static int maxi_text_process(unsigned char maxi_codeword[144], const int mode, c } } + /* Insert Structured Append at beginning if needed */ + if (structapp_cw) { + maxi_bump(set, character, 0, &length); + character[0] = 33; // PAD + maxi_bump(set, character, 1, &length); + character[1] = structapp_cw; + } + if (debug_print) printf("Length: %d\n", length); if (((mode == 2) || (mode == 3)) && (length > 84)) { @@ -490,7 +498,7 @@ static void maxi_do_primary_2(unsigned char maxi_codeword[144], const unsigned c const int postcode_length, const int country, const int service) { int postcode_num; - postcode_num = atoi((const char *) postcode); + postcode_num = to_int(postcode, postcode_length); maxi_codeword[0] = ((postcode_num & 0x03) << 4) | 2; maxi_codeword[1] = ((postcode_num & 0xfc) >> 2); @@ -531,6 +539,8 @@ INTERNAL int maxicode(struct zint_symbol *symbol, unsigned char source[], int le int error_number = 0, eclen; unsigned char maxi_codeword[144] = {0}; int scm_vv = -1; + int structapp_cw = 0; + int debug_print = symbol->debug & ZINT_DEBUG_PRINT; mode = symbol->option_1; @@ -621,18 +631,34 @@ INTERNAL int maxicode(struct zint_symbol *symbol, unsigned char source[], int le scm_vv = symbol->option_2 - 1; } - if (symbol->debug & ZINT_DEBUG_PRINT) { + if (debug_print) { printf("Postcode: %s, Country Code: %d, Service Class: %d\n", postcode, countrycode, service); } } else { maxi_codeword[0] = mode; } - if (symbol->debug & ZINT_DEBUG_PRINT) { + if (debug_print) { printf("Mode: %d\n", mode); } - i = maxi_text_process(maxi_codeword, mode, source, length, symbol->eci, scm_vv, symbol->debug & ZINT_DEBUG_PRINT); + if (symbol->structapp.count) { + if (symbol->structapp.count < 2 || symbol->structapp.count > 8) { + strcpy(symbol->errtxt, "558: Structured Append count out of range (2-8)"); + return ZINT_ERROR_INVALID_OPTION; + } + if (symbol->structapp.index < 1 || symbol->structapp.index > symbol->structapp.count) { + sprintf(symbol->errtxt, "559: Structured Append index out of range (1-%d)", symbol->structapp.count); + return ZINT_ERROR_INVALID_OPTION; + } + if (symbol->structapp.id[0]) { + strcpy(symbol->errtxt, "549: Structured Append ID not available for MaxiCode"); + return ZINT_ERROR_INVALID_OPTION; + } + structapp_cw = (symbol->structapp.count - 1) | ((symbol->structapp.index - 1) << 3); + } + + i = maxi_text_process(maxi_codeword, mode, source, length, structapp_cw, symbol->eci, scm_vv, debug_print); if (i == ZINT_ERROR_TOO_LONG) { strcpy(symbol->errtxt, "553: Input data too long"); return i; @@ -649,7 +675,7 @@ INTERNAL int maxicode(struct zint_symbol *symbol, unsigned char source[], int le maxi_do_secondary_chk_even(maxi_codeword, eclen / 2); // do error correction of even maxi_do_secondary_chk_odd(maxi_codeword, eclen / 2); // do error correction of odd - if (symbol->debug & ZINT_DEBUG_PRINT) { + if (debug_print) { printf("Codewords:"); for (i = 0; i < 144; i++) printf(" %d", maxi_codeword[i]); printf("\n"); diff --git a/backend/pdf417.c b/backend/pdf417.c index 4902dc25..65fd4acf 100644 --- a/backend/pdf417.c +++ b/backend/pdf417.c @@ -1,7 +1,7 @@ /* pdf417.c - Handles PDF417 stacked symbology */ /* Zint - A barcode generating program using libpng - Copyright (C) 2008-2020 Robin Stuart + Copyright (C) 2008-2021 Robin Stuart Portions Copyright (C) 2004 Grandzebu Bug Fixes thanks to KL Chin @@ -398,14 +398,14 @@ static void textprocess(int *chainemc, int *mclength, const unsigned char chaine /* 671 */ INTERNAL void byteprocess(int *chainemc, int *mclength, const unsigned char chaine[], int start, const int length, - const int debug) { + const int debug_print) { - if (debug) printf("\nEntering byte mode at position %d\n", start); + if (debug_print) printf("\nEntering byte mode at position %d\n", start); if (length == 1) { chainemc[(*mclength)++] = 913; chainemc[(*mclength)++] = chaine[start]; - if (debug) { + if (debug_print) { printf("913 %d\n", chainemc[*mclength - 1]); } } else { @@ -413,13 +413,13 @@ INTERNAL void byteprocess(int *chainemc, int *mclength, const unsigned char chai /* select the switch for multiple of 6 bytes */ if (length % 6 == 0) { chainemc[(*mclength)++] = 924; - if (debug) printf("924 "); + if (debug_print) printf("924 "); } else { /* Default mode for MICROPDF417 is Byte Compaction (ISO/IEC 24728:2006 5.4.3), but not emitting it * depends on whether an ECI has been emitted previously (or not) it appears, so simpler and safer * to always emit it. */ chainemc[(*mclength)++] = 901; - if (debug) printf("901 "); + if (debug_print) printf("901 "); } len = 0; @@ -508,20 +508,13 @@ static void numbprocess(int *chainemc, int *mclength, const unsigned char chaine } } -/* 366 */ -static int pdf417(struct zint_symbol *symbol, unsigned char chaine[], const int length) { - int i, k, j, indexchaine, indexliste, mode, longueur, loop, mccorrection[520] = {0}, offset; - int total, chainemc[PDF417_MAX_LEN], mclength, c1, c2, c3, dummy[35]; +/* Initial processing of data, shared by `pdf417enc()` and `micro_pdf417()` */ +static int pdf417_initial(struct zint_symbol *symbol, unsigned char chaine[], const int length, const int is_micro, + int chainemc[PDF417_MAX_LEN], int *p_mclength, int structapp_cws[18], int *p_structapp_cp) { + int i, indexchaine, indexliste, mode; int liste[2][PDF417_MAX_LEN] = {{0}}; - char pattern[580]; - int bp = 0; - int error_number; - int debug = symbol->debug & ZINT_DEBUG_PRINT; - - if (length > PDF417_MAX_LEN) { - strcpy(symbol->errtxt, "463: Input string too long"); - return ZINT_ERROR_TOO_LONG; - } + int mclength, structapp_cp = 0; + int debug_print = symbol->debug & ZINT_DEBUG_PRINT; /* 456 */ indexliste = 0; @@ -543,7 +536,7 @@ static int pdf417(struct zint_symbol *symbol, unsigned char chaine[], const int /* 474 */ pdfsmooth(liste, &indexliste); - if (debug) { + if (debug_print) { printf("Initial block pattern:\n"); for (i = 0; i < indexliste; i++) { printf("Len: %d Type: ", liste[0][i]); @@ -564,6 +557,56 @@ static int pdf417(struct zint_symbol *symbol, unsigned char chaine[], const int indexchaine = 0; mclength = 0; + if (symbol->structapp.count) { + int id_cnt = 0, ids[10]; + + if (symbol->structapp.count < 2 || symbol->structapp.count > 99999) { + strcpy(symbol->errtxt, "740: Structured Append count out of range (2-99999)"); + return ZINT_ERROR_INVALID_OPTION; + } + if (symbol->structapp.index < 1 || symbol->structapp.index > symbol->structapp.count) { + sprintf(symbol->errtxt, "741: Structured Append index out of range (1-%d)", symbol->structapp.count); + return ZINT_ERROR_INVALID_OPTION; + } + if (symbol->structapp.id[0]) { + int id_len; + + for (id_len = 0; id_len < 32 && symbol->structapp.id[id_len]; id_len++); + + if (id_len > 30) { /* 10 triplets */ + strcpy(symbol->errtxt, "742: Structured Append ID too long (30 digit maximum)"); + return ZINT_ERROR_INVALID_OPTION; + } + + for (i = 0; i < id_len; i += 3, id_cnt++) { + int triplet_len = i + 3 < id_len ? 3 : id_len - i; + ids[id_cnt] = to_int((const unsigned char *) (symbol->structapp.id + i), triplet_len); + if (ids[id_cnt] == -1) { + strcpy(symbol->errtxt, "743: Invalid Structured Append ID (digits only)"); + return ZINT_ERROR_INVALID_OPTION; + } + if (ids[id_cnt] > 899) { + sprintf(symbol->errtxt, "744: Structured Append ID triplet %d '%03d' out of range (000-899)", + id_cnt + 1, ids[id_cnt]); + return ZINT_ERROR_INVALID_OPTION; + } + } + } + structapp_cws[structapp_cp++] = 928; /* Macro marker */ + structapp_cws[structapp_cp++] = (100000 + symbol->structapp.index - 1) / 900; /* Segment index 1 */ + structapp_cws[structapp_cp++] = (100000 + symbol->structapp.index - 1) % 900; /* Segment index 2 */ + for (i = 0; i < id_cnt; i++) { + structapp_cws[structapp_cp++] = ids[i]; + } + structapp_cws[structapp_cp++] = 923; /* Optional field */ + structapp_cws[structapp_cp++] = 1; /* Segment count tag */ + structapp_cws[structapp_cp++] = (100000 + symbol->structapp.count) / 900; /* Segment count 1 */ + structapp_cws[structapp_cp++] = (100000 + symbol->structapp.count) % 900; /* Segment count 2 */ + if (symbol->structapp.index == symbol->structapp.count) { + structapp_cws[structapp_cp++] = 922; /* Special last segment terminator */ + } + } + if (symbol->output_options & READER_INIT) { chainemc[mclength] = 921; /* Reader Initialisation */ mclength++; @@ -598,10 +641,10 @@ static int pdf417(struct zint_symbol *symbol, unsigned char chaine[], const int for (i = 0; i < indexliste; i++) { switch (liste[1][i]) { case TEX: /* 547 - text mode */ - textprocess(chainemc, &mclength, chaine, indexchaine, liste[0][i], 0 /*is_micro*/); + textprocess(chainemc, &mclength, chaine, indexchaine, liste[0][i], is_micro); break; case BYT: /* 670 - octet stream mode */ - byteprocess(chainemc, &mclength, chaine, indexchaine, liste[0][i], debug); + byteprocess(chainemc, &mclength, chaine, indexchaine, liste[0][i], debug_print); break; case NUM: /* 712 - numeric mode */ numbprocess(chainemc, &mclength, chaine, indexchaine, liste[0][i]); @@ -611,7 +654,36 @@ static int pdf417(struct zint_symbol *symbol, unsigned char chaine[], const int } assert(mclength > 0); /* Suppress clang-analyzer-core.uninitialized.Assign warning */ - if (debug) { + *p_mclength = mclength; + *p_structapp_cp = structapp_cp; + + return 0; +} + +/* 366 */ +static int pdf417(struct zint_symbol *symbol, unsigned char chaine[], const int length) { + int i, k, j, longueur, loop, mccorrection[520] = {0}, offset; + int total, chainemc[PDF417_MAX_LEN], mclength, c1, c2, c3, dummy[35]; + char pattern[580]; + int bp = 0; + int structapp_cws[18] = {0}; /* 3 (Index) + 10 (ID) + 4 (Count) + 1 (Last) */ + int structapp_cp = 0; + int error_number; + int debug_print = symbol->debug & ZINT_DEBUG_PRINT; + static int ecc_num_cws[] = { 2, 4, 8, 16, 32, 64, 128, 256, 512 }; + + if (length > PDF417_MAX_LEN) { + strcpy(symbol->errtxt, "463: Input string too long"); + return ZINT_ERROR_TOO_LONG; + } + + error_number = pdf417_initial(symbol, chaine, length, 0 /*is_micro*/, chainemc, &mclength, structapp_cws, + &structapp_cp); + if (error_number >= ZINT_ERROR) { + return error_number; + } + + if (debug_print) { printf("\nCompressed data stream (%d):\n", mclength); for (i = 0; i < mclength; i++) { printf("%d ", chainemc[i]); @@ -621,44 +693,42 @@ static int pdf417(struct zint_symbol *symbol, unsigned char chaine[], const int /* 752 - Now take care of the number of CWs per row */ if (symbol->option_1 < 0) { - if (mclength <= 40) { + if (mclength + structapp_cp <= 40) { symbol->option_1 = 2; - } else if (mclength <= 160) { + } else if (mclength + structapp_cp <= 160) { symbol->option_1 = 3; - } else if (mclength <= 320) { + } else if (mclength + structapp_cp <= 320) { symbol->option_1 = 4; - } else if (mclength <= 863) { + } else if (mclength + structapp_cp <= 863) { symbol->option_1 = 5; } else { symbol->option_1 = 6; } } - k = 1; - for (loop = 1; loop <= (symbol->option_1 + 1); loop++) { - k *= 2; - } - longueur = mclength; - if (longueur + k > 928) { + k = ecc_num_cws[symbol->option_1]; + longueur = mclength + structapp_cp + k; + if (longueur > 928) { /* Enforce maximum codeword limit */ strcpy(symbol->errtxt, "464: Input string too long"); return ZINT_ERROR_TOO_LONG; } if (symbol->option_2 < 1) { - symbol->option_2 = (int) (0.5 + sqrt((longueur + k) / 3.0)); + symbol->option_2 = (int) (0.5 + sqrt(longueur / 3.0)); } - if (((longueur + k) / symbol->option_2) > 90) { + if ((longueur / symbol->option_2) > 90) { /* stop the symbol from becoming too high */ symbol->option_2 = symbol->option_2 + 1; - if (((longueur + k) / symbol->option_2) > 90) { + if ((longueur / symbol->option_2) > 90) { strcpy(symbol->errtxt, "465: Data too long for specified number of columns"); return ZINT_ERROR_TOO_LONG; } } + assert(symbol->option_2 >= 1); /* Suppress clang-analyzer-core.CallAndMessage */ /* 781 - Padding calculation */ - longueur = mclength + 1 + k; + longueur = mclength + structapp_cp + 1 + k; i = 0; if ((longueur / symbol->option_2) < 3) { i = (symbol->option_2 * 3) - longueur; /* A bar code must have at least three rows */ @@ -673,6 +743,14 @@ static int pdf417(struct zint_symbol *symbol, unsigned char chaine[], const int mclength++; i--; } + + /* We add the Structured Append Macro Control Block if any */ + if (structapp_cp) { + for (i = 0; i < structapp_cp; i++) { + chainemc[mclength++] = structapp_cws[i]; + } + } + /* we add the length descriptor */ for (i = mclength; i > 0; i--) { chainemc[i] = chainemc[i - 1]; @@ -716,7 +794,7 @@ static int pdf417(struct zint_symbol *symbol, unsigned char chaine[], const int chainemc[mclength++] = mccorrection[i] ? 929 - mccorrection[i] : 0; } - if (debug) { + if (debug_print) { printf("Complete CW string (%d):\n", mclength); for (i = 0; i < mclength; i++) { printf("%d ", chainemc[i]); @@ -732,7 +810,7 @@ static int pdf417(struct zint_symbol *symbol, unsigned char chaine[], const int symbol->rows = mclength / symbol->option_2; assert(symbol->rows > 0); /* Suppress clang-analyzer-core.DivideZero warning */ - if (debug) printf("\nSymbol size:\n%d columns x %d rows\n", symbol->option_2, symbol->rows); + if (debug_print) printf("\nSymbol size:\n%d columns x %d rows\n", symbol->option_2, symbol->rows); /* 818 - The CW string is finished */ c1 = (symbol->rows - 1) / 3; @@ -830,14 +908,15 @@ INTERNAL int pdf417enc(struct zint_symbol *symbol, unsigned char source[], int l /* like PDF417 only much smaller! */ INTERNAL int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], int length) { - int i, k, j, indexchaine, indexliste, mode, longueur, mccorrection[50] = {0}, offset; + int i, k, j, longueur, mccorrection[50] = {0}, offset; int total, chainemc[PDF417_MAX_LEN], mclength, error_number = 0; - int liste[2][PDF417_MAX_LEN] = {{0}}; char pattern[580]; int bp = 0; + int structapp_cws[18] = {0}; /* 3 (Index) + 10 (ID) + 4 (Count) + 1 (Last) */ + int structapp_cp = 0; int variant, LeftRAPStart, CentreRAPStart, RightRAPStart, StartCluster; int LeftRAP, CentreRAP, RightRAP, Cluster, loop; - int debug = symbol->debug & ZINT_DEBUG_PRINT; + int debug_print = symbol->debug & ZINT_DEBUG_PRINT; if (length > MICRO_PDF417_MAX_LEN) { strcpy(symbol->errtxt, "474: Input data too long"); @@ -846,97 +925,15 @@ INTERNAL int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], in /* Encoding starts out the same as PDF417, so use the same code */ - /* 456 */ - indexliste = 0; - indexchaine = 0; - - mode = quelmode(chaine[indexchaine]); - - /* 463 */ - do { - liste[1][indexliste] = mode; - while ((liste[1][indexliste] == mode) && (indexchaine < length)) { - liste[0][indexliste]++; - indexchaine++; - mode = quelmode(chaine[indexchaine]); - } - indexliste++; - } while (indexchaine < length); - - /* 474 */ - pdfsmooth(liste, &indexliste); - - if (debug) { - printf("Initial mapping:\n"); - for (i = 0; i < indexliste; i++) { - printf("len: %d type: ", liste[0][i]); - switch (liste[1][i]) { - case TEX: printf("TEXT\n"); - break; - case BYT: printf("BYTE\n"); - break; - case NUM: printf("NUMBER\n"); - break; - default: printf("*ERROR*\n"); /* Should never happen */ /* Not reached */ - break; - } - } - } - - /* 541 - now compress the data */ - indexchaine = 0; - mclength = 0; - - if (symbol->output_options & READER_INIT) { - chainemc[mclength] = 921; /* Reader Initialisation */ - mclength++; - } - - if (symbol->eci != 0) { - - /* Encoding ECI assignment number, according to Table 8 */ - if (symbol->eci <= 899) { - chainemc[mclength] = 927; /* ECI */ - mclength++; - chainemc[mclength] = symbol->eci; - mclength++; - } else if (symbol->eci <= 810899) { - chainemc[mclength] = 926; /* ECI */ - mclength++; - chainemc[mclength] = (symbol->eci / 900) - 1; - mclength++; - chainemc[mclength] = symbol->eci % 900; - mclength++; - } else { - if (symbol->eci > 811799) { - strcpy(symbol->errtxt, "473: Invalid ECI"); - return ZINT_ERROR_INVALID_OPTION; - } - chainemc[mclength] = 925; /* ECI */ - mclength++; - chainemc[mclength] = symbol->eci - 810900; - mclength++; - } - } - - for (i = 0; i < indexliste; i++) { - switch (liste[1][i]) { - case TEX: /* 547 - text mode */ - textprocess(chainemc, &mclength, chaine, indexchaine, liste[0][i], 1 /*is_micro*/); - break; - case BYT: /* 670 - octet stream mode */ - byteprocess(chainemc, &mclength, chaine, indexchaine, liste[0][i], debug); - break; - case NUM: /* 712 - numeric mode */ - numbprocess(chainemc, &mclength, chaine, indexchaine, liste[0][i]); - break; - } - indexchaine = indexchaine + liste[0][i]; + error_number = pdf417_initial(symbol, chaine, length, 1 /*is_micro*/, chainemc, &mclength, structapp_cws, + &structapp_cp); + if (error_number >= ZINT_ERROR) { + return error_number; } /* This is where it all changes! */ - if (mclength > 126) { + if (mclength + structapp_cp > 126) { strcpy(symbol->errtxt, "467: Input data too long"); return ZINT_ERROR_TOO_LONG; } @@ -949,7 +946,7 @@ INTERNAL int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], in error_number = ZINT_WARN_INVALID_OPTION; } - if (debug) { + if (debug_print) { printf("\nEncoded Data Stream (%d):\n", mclength); for (i = 0; i < mclength; i++) { printf("%3d ", chainemc[i]); @@ -961,7 +958,7 @@ INTERNAL int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], in variant = 0; - if ((symbol->option_2 == 1) && (mclength > 20)) { + if ((symbol->option_2 == 1) && (mclength + structapp_cp > 20)) { /* the user specified 1 column but the data doesn't fit - go to automatic */ strcpy(symbol->errtxt, "469: Specified symbol size too small for data"); if (symbol->warn_level == WARN_FAIL_ALL) { @@ -971,7 +968,7 @@ INTERNAL int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], in error_number = ZINT_WARN_INVALID_OPTION; } - if ((symbol->option_2 == 2) && (mclength > 37)) { + if ((symbol->option_2 == 2) && (mclength + structapp_cp > 37)) { /* the user specified 2 columns but the data doesn't fit - go to automatic */ strcpy(symbol->errtxt, "470: Specified symbol size too small for data"); if (symbol->warn_level == WARN_FAIL_ALL) { @@ -981,7 +978,7 @@ INTERNAL int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], in error_number = ZINT_WARN_INVALID_OPTION; } - if ((symbol->option_2 == 3) && (mclength > 82)) { + if ((symbol->option_2 == 3) && (mclength + structapp_cp > 82)) { /* the user specified 3 columns but the data doesn't fit - go to automatic */ strcpy(symbol->errtxt, "471: Specified symbol size too small for data"); if (symbol->warn_level == WARN_FAIL_ALL) { @@ -993,80 +990,80 @@ INTERNAL int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], in if (symbol->option_2 == 1) { /* the user specified 1 column and the data does fit */ - if (mclength <= 4) { + if (mclength + structapp_cp <= 4) { variant = 1; - } else if (mclength <= 7) { + } else if (mclength + structapp_cp <= 7) { variant = 2; - } else if (mclength <= 10) { + } else if (mclength + structapp_cp <= 10) { variant = 3; - } else if (mclength <= 12) { + } else if (mclength + structapp_cp <= 12) { variant = 4; - } else if (mclength <= 16) { + } else if (mclength + structapp_cp <= 16) { variant = 5; } else { variant = 6; } } else if (symbol->option_2 == 2) { /* the user specified 2 columns and the data does fit */ - if (mclength <= 8) { + if (mclength + structapp_cp <= 8) { variant = 7; - } else if (mclength <= 13) { + } else if (mclength + structapp_cp <= 13) { variant = 8; - } else if (mclength <= 19) { + } else if (mclength + structapp_cp <= 19) { variant = 9; - } else if (mclength <= 24) { + } else if (mclength + structapp_cp <= 24) { variant = 10; - } else if (mclength <= 29) { + } else if (mclength + structapp_cp <= 29) { variant = 11; - } else if (mclength <= 33) { + } else if (mclength + structapp_cp <= 33) { variant = 12; } else { variant = 13; } } else if (symbol->option_2 == 3) { /* the user specified 3 columns and the data does fit */ - if (mclength <= 6) { + if (mclength + structapp_cp <= 6) { variant = 14; - } else if (mclength <= 10) { + } else if (mclength + structapp_cp <= 10) { variant = 15; - } else if (mclength <= 14) { + } else if (mclength + structapp_cp <= 14) { variant = 16; - } else if (mclength <= 18) { + } else if (mclength + structapp_cp <= 18) { variant = 17; - } else if (mclength <= 24) { + } else if (mclength + structapp_cp <= 24) { variant = 18; - } else if (mclength <= 34) { + } else if (mclength + structapp_cp <= 34) { variant = 19; - } else if (mclength <= 46) { + } else if (mclength + structapp_cp <= 46) { variant = 20; - } else if (mclength <= 58) { + } else if (mclength + structapp_cp <= 58) { variant = 21; - } else if (mclength <= 70) { + } else if (mclength + structapp_cp <= 70) { variant = 22; } else { variant = 23; } } else if (symbol->option_2 == 4) { /* the user specified 4 columns and the data does fit */ - if (mclength <= 8) { + if (mclength + structapp_cp <= 8) { variant = 24; - } else if (mclength <= 12) { + } else if (mclength + structapp_cp <= 12) { variant = 25; - } else if (mclength <= 18) { + } else if (mclength + structapp_cp <= 18) { variant = 26; - } else if (mclength <= 24) { + } else if (mclength + structapp_cp <= 24) { variant = 27; - } else if (mclength <= 30) { + } else if (mclength + structapp_cp <= 30) { variant = 28; - } else if (mclength <= 39) { + } else if (mclength + structapp_cp <= 39) { variant = 29; - } else if (mclength <= 54) { + } else if (mclength + structapp_cp <= 54) { variant = 30; - } else if (mclength <= 72) { + } else if (mclength + structapp_cp <= 72) { variant = 31; - } else if (mclength <= 90) { + } else if (mclength + structapp_cp <= 90) { variant = 32; - } else if (mclength <= 108) { + } else if (mclength + structapp_cp <= 108) { variant = 33; } else { variant = 34; @@ -1074,10 +1071,11 @@ INTERNAL int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], in } else { /* Zint can choose automatically from all available variations */ for (i = 27; i >= 0; i--) { - - if (MicroAutosize[i] >= mclength) { + /* Note mclength + structapp_cp <= 126 and MicroAutosize[27] == 126 so variant will be set */ + if (MicroAutosize[i] >= mclength + structapp_cp) { variant = MicroAutosize[i + 28]; } else { + assert(variant > 0); /* Suppress clang-tidy clang-analyzer-core.uninitialized.Assign */ break; } } @@ -1089,10 +1087,10 @@ INTERNAL int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], in symbol->rows = MicroVariants[variant + 34]; /* rows */ k = MicroVariants[variant + 68]; /* number of EC CWs */ longueur = (symbol->option_2 * symbol->rows) - k; /* number of non-EC CWs */ - i = longueur - mclength; /* amount of padding required */ + i = longueur - (mclength + structapp_cp); /* amount of padding required */ offset = MicroVariants[variant + 102]; /* coefficient offset */ - if (debug) { + if (debug_print) { printf("\nChoose symbol size:\n"); printf("%d columns x %d rows, variant %d\n", symbol->option_2, symbol->rows, variant + 1); printf("%d data codewords (including %d pads), %d ecc codewords\n", longueur, i, k); @@ -1106,6 +1104,13 @@ INTERNAL int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], in i--; } + /* We add the Structured Append Macro Control Block if any */ + if (structapp_cp) { + for (i = 0; i < structapp_cp; i++) { + chainemc[mclength++] = structapp_cws[i]; + } + } + /* Reed-Solomon error correction */ longueur = mclength; for (i = 0; i < longueur; i++) { @@ -1130,7 +1135,7 @@ INTERNAL int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], in mclength++; } - if (debug) { + if (debug_print) { printf("Encoded Data Stream with ECC (%d):\n", mclength); for (i = 0; i < mclength; i++) { printf("%3d ", chainemc[i]); @@ -1157,9 +1162,9 @@ INTERNAL int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], in Cluster = StartCluster; /* Cluster can be 0, 1 or 2 for Cluster(0), Cluster(3) and Cluster(6) */ - if (debug) printf("\nInternal row representation:\n"); + if (debug_print) printf("\nInternal row representation:\n"); for (i = 0; i < symbol->rows; i++) { - if (debug) printf("row %d: ", i); + if (debug_print) printf("row %d: ", i); bp = 0; offset = 929 * Cluster; k = i * symbol->option_2; @@ -1188,7 +1193,7 @@ INTERNAL int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], in } bp = bin_append_posn(rap_side[RightRAP - 1], 10, pattern, bp); pattern[bp++] = '1'; /* stop */ - if (debug) printf("%.*s\n", bp, pattern); + if (debug_print) printf("%.*s\n", bp, pattern); /* so now pattern[] holds the string of '1's and '0's. - copy this to the symbol */ for (loop = 0; loop < bp; loop++) { diff --git a/backend/pdf417.h b/backend/pdf417.h index 854e4a51..accde93a 100644 --- a/backend/pdf417.h +++ b/backend/pdf417.h @@ -2,7 +2,7 @@ /* libzint - the open source barcode library - Copyright (C) 2008-2017 Robin Stuart + Copyright (C) 2008-2021 Robin Stuart Portions Copyright (C) 2004 Grandzebu Redistribution and use in source and binary forms, with or without @@ -472,7 +472,7 @@ static const unsigned short int Microcoeffs[344] = { }; /* rows, columns, error codewords, k-offset of valid MicroPDF417 sizes from ISO/IEC 24728:2006 */ -static const unsigned short int MicroVariants[170] ={ +static const unsigned short int MicroVariants[170] = { 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 11, 14, 17, 20, 24, 28, 8, 11, 14, 17, 20, 23, 26, 6, 8, 10, 12, 15, 20, 26, 32, 38, 44, 4, 6, 8, 10, 12, 15, 20, 26, 32, 38, 44, 7, 7, 7, 8, 8, 8, 8, 9, 9, 10, 11, 13, 15, 12, 14, 16, 18, 21, 26, 32, 38, 44, 50, 8, 12, 14, 16, 18, 21, 26, 32, 38, 44, 50, @@ -481,7 +481,7 @@ static const unsigned short int MicroVariants[170] ={ /* rows, columns, error codewords, k-offset */ /* following is Left RAP, Centre RAP, Right RAP and Start Cluster from ISO/IEC 24728:2006 tables 10, 11 and 12 */ -static const char RAPTable[136] ={ +static const char RAPTable[136] = { 1, 8, 36, 19, 9, 25, 1, 1, 8, 36, 19, 9, 27, 1, 7, 15, 25, 37, 1, 1, 21, 15, 1, 47, 1, 7, 15, 25, 37, 1, 1, 21, 15, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7, 15, 25, 37, 17, 9, 29, 31, 25, 19, 1, 7, 15, 25, 37, 17, 9, 29, 31, 25, 9, 8, 36, 19, 17, 33, 1, 9, 8, 36, 19, 17, 35, 1, 7, 15, 25, 37, 33, 17, 37, 47, 49, 43, 1, 7, 15, 25, 37, 33, 17, 37, 47, 49, diff --git a/backend/png.c b/backend/png.c index ef5eb59e..0ebfa752 100644 --- a/backend/png.c +++ b/backend/png.c @@ -341,6 +341,6 @@ INTERNAL int png_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf) return 0; } #else -/* https://stackoverflow.com/a/26541331/664741 Suppresses gcc warning ISO C forbids an empty translation unit */ +/* https://stackoverflow.com/a/26541331 Suppresses gcc warning ISO C forbids an empty translation unit */ typedef int make_iso_compilers_happy; #endif /* NO_PNG */ diff --git a/backend/qr.c b/backend/qr.c index 5f57e59d..1b74f4ef 100644 --- a/backend/qr.c +++ b/backend/qr.c @@ -394,8 +394,8 @@ static int terminator_bits(const int version) { /* Convert input data to a binary stream and add padding */ static void qr_binary(unsigned char datastream[], const int version, const int target_codewords, const char mode[], - const unsigned int jisdata[], const int length, const int gs1, const int eci, const int est_binlen, - const int debug_print) { + const unsigned int jisdata[], const int length, const struct zint_structapp *p_structapp, const int gs1, + const int eci, const int est_binlen, const int debug_print) { int position = 0; int i, j, bp; int termbits, padbits, modebits; @@ -411,6 +411,14 @@ static void qr_binary(unsigned char datastream[], const int version, const int t *binary = '\0'; bp = 0; + if (p_structapp) { + bp = bin_append_posn(3, 4, binary, bp); /* Structured Append indicator */ + bp = bin_append_posn(p_structapp->index - 1, 4, binary, bp); + bp = bin_append_posn(p_structapp->count - 1, 4, binary, bp); + bp = bin_append_posn(to_int((const unsigned char *) p_structapp->id, (int) strlen(p_structapp->id)), 8, + binary, bp); /* Parity */ + } + if (gs1) { /* Not applicable to MICROQR */ if (version < RMQR_VERSION) { bp = bin_append_posn(5, 4, binary, bp); /* FNC1 */ @@ -1431,7 +1439,7 @@ static int blockLength(const int start, const char inputMode[], const int inputL } static int getBinaryLength(const int version, char inputMode[], const unsigned int inputData[], const int inputLength, - const int gs1, const int eci, const int debug_print) { + const struct zint_structapp *p_structapp, const int gs1, const int eci, const int debug_print) { /* Calculate the actual bitlength of the proposed binary string */ int i, j; char currentMode; @@ -1443,6 +1451,10 @@ static int getBinaryLength(const int version, char inputMode[], const unsigned i currentMode = ' '; // Null + if (p_structapp) { + count += 4 + 8 + 8; + } + if (gs1 == 1) { /* Not applicable to MICROQR */ if (version < RMQR_VERSION) { count += 4; @@ -1534,6 +1546,7 @@ INTERNAL int qr_code(struct zint_symbol *symbol, unsigned char source[], int len int user_mask; int canShrink; int size_squared; + const struct zint_structapp *p_structapp = NULL; int debug_print = symbol->debug & ZINT_DEBUG_PRINT; int eci_length = get_eci_length(symbol->eci, source, length); @@ -1581,7 +1594,39 @@ INTERNAL int qr_code(struct zint_symbol *symbol, unsigned char source[], int len } } - est_binlen = getBinaryLength(40, mode, jisdata, length, gs1, symbol->eci, debug_print); + if (symbol->structapp.count) { + if (symbol->structapp.count < 2 || symbol->structapp.count > 16) { + strcpy(symbol->errtxt, "750: Structured Append count out of range (2-16)"); + return ZINT_ERROR_INVALID_OPTION; + } + if (symbol->structapp.index < 1 || symbol->structapp.index > symbol->structapp.count) { + sprintf(symbol->errtxt, "751: Structured Append index out of range (1-%d)", symbol->structapp.count); + return ZINT_ERROR_INVALID_OPTION; + } + if (symbol->structapp.id[0]) { + int id, id_len; + + for (id_len = 0; id_len < 32 && symbol->structapp.id[id_len]; id_len++); + + if (id_len > 3) { /* 255 */ + strcpy(symbol->errtxt, "752: Structured Append ID too long (3 digit maximum)"); + return ZINT_ERROR_INVALID_OPTION; + } + + id = to_int((const unsigned char *) symbol->structapp.id, id_len); + if (id == -1) { + strcpy(symbol->errtxt, "753: Invalid Structured Append ID (digits only)"); + return ZINT_ERROR_INVALID_OPTION; + } + if (id > 255) { + sprintf(symbol->errtxt, "754: Structured Append ID '%d' out of range (0-255)", id); + return ZINT_ERROR_INVALID_OPTION; + } + } + p_structapp = &symbol->structapp; + } + + est_binlen = getBinaryLength(40, mode, jisdata, length, p_structapp, gs1, symbol->eci, debug_print); ecc_level = LEVEL_L; max_cw = 2956; @@ -1632,7 +1677,7 @@ INTERNAL int qr_code(struct zint_symbol *symbol, unsigned char source[], int len } } if (autosize != 40) { - est_binlen = getBinaryLength(autosize, mode, jisdata, length, gs1, symbol->eci, debug_print); + est_binlen = getBinaryLength(autosize, mode, jisdata, length, p_structapp, gs1, symbol->eci, debug_print); } // Now see if the optimised binary will fit in a smaller symbol. @@ -1644,7 +1689,8 @@ INTERNAL int qr_code(struct zint_symbol *symbol, unsigned char source[], int len } else { prev_est_binlen = est_binlen; memcpy(prev_mode, mode, length); - est_binlen = getBinaryLength(autosize - 1, mode, jisdata, length, gs1, symbol->eci, debug_print); + est_binlen = getBinaryLength(autosize - 1, mode, jisdata, length, p_structapp, gs1, symbol->eci, + debug_print); switch (ecc_level) { case LEVEL_L: @@ -1689,7 +1735,8 @@ INTERNAL int qr_code(struct zint_symbol *symbol, unsigned char source[], int len */ if (symbol->option_2 > version) { version = symbol->option_2; - est_binlen = getBinaryLength(symbol->option_2, mode, jisdata, length, gs1, symbol->eci, debug_print); + est_binlen = getBinaryLength(symbol->option_2, mode, jisdata, length, p_structapp, gs1, symbol->eci, + debug_print); } if (symbol->option_2 < version) { @@ -1741,8 +1788,8 @@ INTERNAL int qr_code(struct zint_symbol *symbol, unsigned char source[], int len fullstream = (unsigned char *) _alloca(qr_total_codewords[version - 1] + 1); #endif - qr_binary(datastream, version, target_codewords, mode, jisdata, length, gs1, symbol->eci, est_binlen, - debug_print); + qr_binary(datastream, version, target_codewords, mode, jisdata, length, p_structapp, gs1, symbol->eci, + est_binlen, debug_print); #ifdef ZINT_TEST if (symbol->debug & ZINT_DEBUG_TEST) debug_test_codeword_dump(symbol, datastream, target_codewords); #endif @@ -2482,8 +2529,8 @@ INTERNAL int microqr(struct zint_symbol *symbol, unsigned char source[], int len /* Determine length of binary data */ for (i = 0; i < 4; i++) { if (version_valid[i]) { - binary_count[i] = getBinaryLength(MICROQR_VERSION + i, mode, jisdata, length, 0 /*gs1*/, 0 /*eci*/, - debug_print); + binary_count[i] = getBinaryLength(MICROQR_VERSION + i, mode, jisdata, length, NULL /*p_structapp*/, + 0 /*gs1*/, 0 /*eci*/, debug_print); } else { binary_count[i] = 128 + 1; } @@ -2568,7 +2615,7 @@ INTERNAL int microqr(struct zint_symbol *symbol, unsigned char source[], int len qr_define_mode(mode, jisdata, length, 0 /*gs1*/, MICROQR_VERSION + version, debug_print); qr_binary((unsigned char *) full_stream, MICROQR_VERSION + version, 0 /*target_codewords*/, mode, jisdata, length, - 0 /*gs1*/, 0 /*eci*/, binary_count[version], debug_print); + NULL /*p_structapp*/, 0 /*gs1*/, 0 /*eci*/, binary_count[version], debug_print); if (debug_print) printf("Binary (%d): %s\n", (int) strlen(full_stream), full_stream); @@ -2746,7 +2793,7 @@ INTERNAL int upnqr(struct zint_symbol *symbol, unsigned char source[], int lengt break; } - est_binlen = getBinaryLength(15, mode, jisdata, length, 0, symbol->eci, debug_print); + est_binlen = getBinaryLength(15, mode, jisdata, length, NULL /*p_structapp*/, 0, symbol->eci, debug_print); ecc_level = LEVEL_M; @@ -2767,7 +2814,8 @@ INTERNAL int upnqr(struct zint_symbol *symbol, unsigned char source[], int lengt fullstream = (unsigned char *) _alloca(qr_total_codewords[version - 1] + 1); #endif - qr_binary(datastream, version, target_codewords, mode, jisdata, length, 0, symbol->eci, est_binlen, debug_print); + qr_binary(datastream, version, target_codewords, mode, jisdata, length, NULL /*p_structapp*/, 0 /*gs1*/, + symbol->eci, est_binlen, debug_print); #ifdef ZINT_TEST if (symbol->debug & ZINT_DEBUG_TEST) debug_test_codeword_dump(symbol, datastream, target_codewords); #endif @@ -2972,7 +3020,8 @@ INTERNAL int rmqr(struct zint_symbol *symbol, unsigned char source[], int length } } - est_binlen = getBinaryLength(RMQR_VERSION + 31, mode, jisdata, length, gs1, symbol->eci, debug_print); + est_binlen = getBinaryLength(RMQR_VERSION + 31, mode, jisdata, length, NULL /*p_structapp*/, gs1, symbol->eci, + debug_print); ecc_level = LEVEL_M; max_cw = 152; @@ -3008,8 +3057,8 @@ INTERNAL int rmqr(struct zint_symbol *symbol, unsigned char source[], int length autosize = 31; best_footprint = rmqr_height[31] * rmqr_width[31]; for (version = 30; version >= 0; version--) { - est_binlen = getBinaryLength(RMQR_VERSION + version, mode, jisdata, length, gs1, symbol->eci, - debug_print); + est_binlen = getBinaryLength(RMQR_VERSION + version, mode, jisdata, length, NULL /*p_structapp*/, gs1, + symbol->eci, debug_print); footprint = rmqr_height[version] * rmqr_width[version]; if (ecc_level == LEVEL_M) { if (8 * rmqr_data_codewords_M[version] >= est_binlen) { @@ -3028,20 +3077,23 @@ INTERNAL int rmqr(struct zint_symbol *symbol, unsigned char source[], int length } } version = autosize; - est_binlen = getBinaryLength(RMQR_VERSION + version, mode, jisdata, length, gs1, symbol->eci, debug_print); + est_binlen = getBinaryLength(RMQR_VERSION + version, mode, jisdata, length, NULL /*p_structapp*/, gs1, + symbol->eci, debug_print); } if ((symbol->option_2 >= 1) && (symbol->option_2 <= 32)) { // User specified symbol size version = symbol->option_2 - 1; - est_binlen = getBinaryLength(RMQR_VERSION + version, mode, jisdata, length, gs1, symbol->eci, debug_print); + est_binlen = getBinaryLength(RMQR_VERSION + version, mode, jisdata, length, NULL /*p_structapp*/, gs1, + symbol->eci, debug_print); } if (symbol->option_2 >= 33) { // User has specified symbol height only version = rmqr_fixed_height_upper_bound[symbol->option_2 - 32]; for (i = version - 1; i > rmqr_fixed_height_upper_bound[symbol->option_2 - 33]; i--) { - est_binlen = getBinaryLength(RMQR_VERSION + i, mode, jisdata, length, gs1, symbol->eci, debug_print); + est_binlen = getBinaryLength(RMQR_VERSION + i, mode, jisdata, length, NULL /*p_structapp*/, gs1, + symbol->eci, debug_print); if (ecc_level == LEVEL_M) { if (8 * rmqr_data_codewords_M[i] >= est_binlen) { version = i; @@ -3052,7 +3104,8 @@ INTERNAL int rmqr(struct zint_symbol *symbol, unsigned char source[], int length } } } - est_binlen = getBinaryLength(RMQR_VERSION + version, mode, jisdata, length, gs1, symbol->eci, debug_print); + est_binlen = getBinaryLength(RMQR_VERSION + version, mode, jisdata, length, NULL /*p_structapp*/, gs1, + symbol->eci, debug_print); } if (symbol->option_1 == -1) { @@ -3072,7 +3125,7 @@ INTERNAL int rmqr(struct zint_symbol *symbol, unsigned char source[], int length if (est_binlen > (target_codewords * 8)) { // User has selected a symbol too small for the data - strcpy(symbol->errtxt, "580: Input too long for selected symbol size"); + strcpy(symbol->errtxt, "560: Input too long for selected symbol size"); return ZINT_ERROR_TOO_LONG; } @@ -3092,8 +3145,8 @@ INTERNAL int rmqr(struct zint_symbol *symbol, unsigned char source[], int length fullstream = (unsigned char *) _alloca(rmqr_total_codewords[version] + 1); #endif - qr_binary(datastream, RMQR_VERSION + version, target_codewords, mode, jisdata, length, gs1, symbol->eci, - est_binlen, debug_print); + qr_binary(datastream, RMQR_VERSION + version, target_codewords, mode, jisdata, length, NULL /*p_structapp*/, gs1, + symbol->eci, est_binlen, debug_print); #ifdef ZINT_TEST if (symbol->debug & ZINT_DEBUG_TEST) debug_test_codeword_dump(symbol, datastream, target_codewords); #endif diff --git a/backend/reedsol.c b/backend/reedsol.c index 331c65da..53aea312 100644 --- a/backend/reedsol.c +++ b/backend/reedsol.c @@ -72,8 +72,8 @@ INTERNAL void rs_init_gf(rs_t *rs, const unsigned int prime_poly) { const unsigned char *alog; }; /* To add a new prime poly of degree <= 8 add its details to this table and to the table in `test_generate()` - * in "backend/tests/test_reedsol.c" and regenerate the log tables by running "./test_reedsol -f generate -g". - * Paste the result in "reedsol_logs.h" */ + in "backend/tests/test_reedsol.c" and regenerate the log tables by running + "backend/tests/test_reedsol -f generate -g". Paste the result in "reedsol_logs.h" */ static const struct item data[] = { { logt_0x13, alog_0x13 }, /* 0 000- */ { logt_0x25, alog_0x25 }, /* 0 001- */ diff --git a/backend/reedsol_logs.h b/backend/reedsol_logs.h index 945db287..c902c07e 100644 --- a/backend/reedsol_logs.h +++ b/backend/reedsol_logs.h @@ -36,7 +36,7 @@ /* Static log/antilog tables for prime polys of up to degree 8 (> 8 too large so generated at runtime instead). * Antilog tables doubled to avoid mod. */ -/* Paste output of "./test_reedsol -f generate -g" here */ +/* Paste output of "backend/tests/test_reedsol -f generate -g" here */ static const unsigned char logt_0x13[16] = { 0x00, 0x00, 0x01, 0x04, 0x02, 0x08, 0x05, 0x0A, 0x03, 0x0E, 0x09, 0x07, 0x06, 0x0D, 0x0B, 0x0C, }; diff --git a/backend/tests/data/gif/datamatrix_seq2of9.gif b/backend/tests/data/gif/datamatrix_seq2of9.gif new file mode 100644 index 00000000..4c857ccc Binary files /dev/null and b/backend/tests/data/gif/datamatrix_seq2of9.gif differ diff --git a/backend/tests/data/png/aztec_z1_seq4of7.png b/backend/tests/data/png/aztec_z1_seq4of7.png new file mode 100644 index 00000000..8bc4f3e0 Binary files /dev/null and b/backend/tests/data/png/aztec_z1_seq4of7.png differ diff --git a/backend/tests/test_aztec.c b/backend/tests/test_aztec.c index 539e8e17..98fc0d98 100644 --- a/backend/tests/test_aztec.c +++ b/backend/tests/test_aztec.c @@ -39,31 +39,39 @@ static void test_options(int index, int debug) { int output_options; int option_1; int option_2; + struct zint_structapp structapp; char *data; int ret; int expected_rows; int expected_width; + const char *expected_errtxt; }; // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) struct item data[] = { - /* 0*/ { BARCODE_AZTEC, -1, -1, -1, -1, "1234567890", 0, 15, 15 }, - /* 1*/ { BARCODE_AZTEC, -1, -1, 1, -1, "1234567890", 0, 15, 15 }, - /* 2*/ { BARCODE_AZTEC, -1, -1, 4, -1, "1234567890", 0, 19, 19 }, - /* 3*/ { BARCODE_AZTEC, -1, -1, 5, -1, "1234567890", ZINT_WARN_INVALID_OPTION, 15, 15 }, - /* 4*/ { BARCODE_AZTEC, -1, -1, -1, 1, "12345678901234567890", ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 5*/ { BARCODE_AZTEC, -1, -1, -1, 36, "1234567890", 0, 151, 151 }, - /* 6*/ { BARCODE_AZTEC, -1, -1, -1, 37, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1 }, - /* 7*/ { BARCODE_AZTEC, GS1_MODE, READER_INIT, -1, -1, "[91]A", ZINT_ERROR_INVALID_OPTION, -1, -1 }, - /* 8*/ { BARCODE_AZTEC, GS1_MODE, -1, -1, -1, "[91]A", 0, 15, 15 }, - /* 9*/ { BARCODE_AZTEC, GS1_MODE | GS1PARENS_MODE, -1, -1, -1, "(91)A", 0, 15, 15 }, - /* 10*/ { BARCODE_AZTEC, -1, READER_INIT, -1, 26, "A", 0, 109, 109 }, // 22 layers - /* 11*/ { BARCODE_AZTEC, -1, READER_INIT, -1, 27, "A", ZINT_ERROR_TOO_LONG, -1, -1 }, // 23 layers - /* 12*/ { BARCODE_AZTEC, -1, READER_INIT, -1, 1, "A", 0, 15, 15 }, // Compact 1 layer - /* 13*/ { BARCODE_AZTEC, -1, READER_INIT, -1, 2, "A", 0, 19, 19 }, // Compact 2 layers gets set to full 1 layer if READER_INIT set - /* 14*/ { BARCODE_AZRUNE, -1, -1, -1, -1, "0001", ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 15*/ { BARCODE_AZRUNE, -1, -1, -1, -1, "A", ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 16*/ { BARCODE_AZRUNE, -1, -1, -1, -1, "256", ZINT_ERROR_INVALID_DATA, -1, -1 }, + /* 0*/ { BARCODE_AZTEC, -1, -1, -1, -1, { 0, 0, "" }, "1234567890", 0, 15, 15, "" }, + /* 1*/ { BARCODE_AZTEC, -1, -1, 1, -1, { 0, 0, "" }, "1234567890", 0, 15, 15, "" }, + /* 2*/ { BARCODE_AZTEC, -1, -1, 4, -1, { 0, 0, "" }, "1234567890", 0, 19, 19, "" }, + /* 3*/ { BARCODE_AZTEC, -1, -1, 5, -1, { 0, 0, "" }, "1234567890", ZINT_WARN_INVALID_OPTION, 15, 15, "Warning 503: Invalid error correction level - using default instead" }, + /* 4*/ { BARCODE_AZTEC, -1, -1, -1, 1, { 0, 0, "" }, "12345678901234567890", ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, + /* 5*/ { BARCODE_AZTEC, -1, -1, -1, 36, { 0, 0, "" }, "1234567890", 0, 151, 151, "" }, + /* 6*/ { BARCODE_AZTEC, -1, -1, -1, 37, { 0, 0, "" }, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 510: Invalid Aztec Code size" }, + /* 7*/ { BARCODE_AZTEC, GS1_MODE, READER_INIT, -1, -1, { 0, 0, "" }, "[91]A", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 501: Cannot encode in GS1 and Reader Initialisation mode at the same time" }, + /* 8*/ { BARCODE_AZTEC, GS1_MODE, -1, -1, -1, { 0, 0, "" }, "[91]A", 0, 15, 15, "" }, + /* 9*/ { BARCODE_AZTEC, GS1_MODE | GS1PARENS_MODE, -1, -1, -1, { 0, 0, "" }, "(91)A", 0, 15, 15, "" }, + /* 10*/ { BARCODE_AZTEC, -1, READER_INIT, -1, 26, { 0, 0, "" }, "A", 0, 109, 109, "" }, // 22 layers + /* 11*/ { BARCODE_AZTEC, -1, READER_INIT, -1, 27, { 0, 0, "" }, "A", ZINT_ERROR_TOO_LONG, -1, -1, "Error 506: Data too long for reader initialisation symbol" }, // 23 layers + /* 12*/ { BARCODE_AZTEC, -1, READER_INIT, -1, 1, { 0, 0, "" }, "A", 0, 15, 15, "" }, // Compact 1 layer + /* 13*/ { BARCODE_AZTEC, -1, READER_INIT, -1, 2, { 0, 0, "" }, "A", 0, 19, 19, "" }, // Compact 2 layers gets set to full 1 layer if READER_INIT set + /* 14*/ { BARCODE_AZRUNE, -1, -1, -1, -1, { 0, 0, "" }, "0001", ZINT_ERROR_TOO_LONG, -1, -1, "Error 507: Input too large (3 character maximum)" }, + /* 15*/ { BARCODE_AZRUNE, -1, -1, -1, -1, { 0, 0, "" }, "A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 508: Invalid character in data (digits only)" }, + /* 16*/ { BARCODE_AZRUNE, -1, -1, -1, -1, { 0, 0, "" }, "256", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 509: Input out of range (0 to 255)" }, + /* 17*/ { BARCODE_AZTEC, -1, -1, -1, -1, { 1, 2, "" }, "1234567890", 0, 15, 15, "" }, + /* 18*/ { BARCODE_AZTEC, -1, -1, -1, -1, { 1, 2, "12345678901234567890123456789012" }, "1234567890", 0, 23, 23, "" }, + /* 19*/ { BARCODE_AZTEC, -1, -1, -1, -1, { 1, 1, "" }, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 701: Structured Append count out of range (2-26)" }, + /* 20*/ { BARCODE_AZTEC, -1, -1, -1, -1, { 0, 2, "" }, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 702: Structured Append index out of range (1-2)" }, + /* 21*/ { BARCODE_AZTEC, -1, -1, -1, -1, { 3, 2, "" }, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 702: Structured Append index out of range (1-2)" }, + /* 22*/ { BARCODE_AZTEC, -1, -1, -1, -1, { 1, 2, "A B" }, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 703: Structured Append ID cannot contain spaces" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -79,6 +87,9 @@ static void test_options(int index, int debug) { assert_nonnull(symbol, "Symbol not created\n"); length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, data[i].output_options, data[i].data, -1, debug); + if (data[i].structapp.count) { + symbol->structapp = data[i].structapp; + } 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); @@ -87,6 +98,7 @@ static void test_options(int index, int debug) { assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, symbol->errtxt); assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, symbol->errtxt); } + assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d symbol->errtxt %s != %s\n", i, symbol->errtxt, data[i].expected_errtxt); ZBarcode_Delete(symbol); } diff --git a/backend/tests/test_code1.c b/backend/tests/test_code1.c index 18417c1d..cf37b800 100644 --- a/backend/tests/test_code1.c +++ b/backend/tests/test_code1.c @@ -34,7 +34,9 @@ static void test_large(int index, int debug) { struct item { + int eci; int option_2; + struct zint_structapp structapp; char *pattern; int length; int ret; @@ -44,118 +46,140 @@ static void test_large(int index, int debug) { // Reference AIM USS Code One Table 2 // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) struct item data[] = { - /* 0*/ { -1, "1", 3550, 0, 148, 134 }, /* Auto Version H */ - /* 1*/ { -1, "1", 3551, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 2*/ { -1, "A", 2218, 0, 148, 134 }, - /* 3*/ { -1, "A", 2219, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 4*/ { -1, "\001", 1480, 0, 148, 134 }, /* Full ASCII */ - /* 5*/ { -1, "\001", 1481, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 6*/ { -1, "\200", 1478, 0, 148, 134 }, /* BYTE */ - /* 7*/ { -1, "\200", 1479, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 8*/ { 1, "1", 22, 0, 16, 18 }, /* Version A */ - /* 9*/ { 1, "1", 23, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 10*/ { 1, "A", 13, 0, 16, 18 }, - /* 11*/ { 1, "A", 14, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 12*/ { 1, "\001", 10, 0, 16, 18 }, - /* 13*/ { 1, "\001", 11, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 14*/ { 1, "\200", 8, 0, 16, 18 }, - /* 15*/ { 1, "\200", 9, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 16*/ { 2, "1", 44, 0, 22, 22 }, /* Version B */ - /* 17*/ { 2, "1", 45, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 18*/ { 2, "A", 27, 0, 22, 22 }, - /* 19*/ { 2, "A", 28, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 20*/ { 2, "A", 26, 0, 22, 22 }, - /* 21*/ { 2, "\001", 19, 0, 22, 22 }, - /* 22*/ { 2, "\001", 20, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 23*/ { 2, "\200", 17, 0, 22, 22 }, - /* 24*/ { 2, "\200", 18, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 25*/ { 3, "1", 104, 0, 28, 32 }, /* Version C */ - /* 26*/ { 3, "1", 105, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 27*/ { 3, "A", 64, 0, 28, 32 }, - /* 28*/ { 3, "A", 65, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 29*/ { 3, "\001", 44, 0, 28, 32 }, - /* 30*/ { 3, "\001", 45, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 31*/ { 3, "\200", 42, 0, 28, 32 }, - /* 32*/ { 3, "\200", 43, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 33*/ { 4, "1", 217, 0, 40, 42 }, /* Version D */ - /* 34*/ { 4, "1", 218, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 35*/ { 4, "A", 135, 0, 40, 42 }, - /* 36*/ { 4, "A", 136, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 37*/ { 4, "\001", 91, 0, 40, 42 }, - /* 38*/ { 4, "\001", 92, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 39*/ { 4, "\200", 89, 0, 40, 42 }, - /* 40*/ { 4, "\200", 90, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 41*/ { 5, "1", 435, 0, 52, 54 }, /* Version E (note 435 multiple of 3) */ - /* 42*/ { 5, "1", 436, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 43*/ { 5, "1", 434, ZINT_ERROR_TOO_LONG, -1, -1 }, /* NOTE: a quirk of decimal end-of-data processing is existence of "lower maxs" if digits are not a multiple of 3 */ - /* 44*/ { 5, "1", 433, 0, 52, 54 }, - /* 45*/ { 5, "A", 271, 0, 52, 54 }, - /* 46*/ { 5, "A", 272, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 47*/ { 5, "\001", 182, 0, 52, 54 }, - /* 48*/ { 5, "\001", 183, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 49*/ { 5, "\200", 180, 0, 52, 54 }, - /* 50*/ { 5, "\200", 181, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 51*/ { 6, "1", 886, 0, 70, 76 }, /* Version F */ - /* 52*/ { 6, "1", 887, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 53*/ { 6, "A", 553, 0, 70, 76 }, - /* 54*/ { 6, "A", 554, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 55*/ { 6, "\001", 370, 0, 70, 76 }, - /* 56*/ { 6, "\001", 371, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 57*/ { 6, "\200", 368, 0, 70, 76 }, - /* 58*/ { 6, "\200", 369, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 59*/ { 7, "1", 1755, 0, 104, 98 }, /* Version G (note 1755 multiple of 3) */ - /* 60*/ { 7, "1", 1756, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 61*/ { 7, "1", 1754, ZINT_ERROR_TOO_LONG, -1, -1 }, /* NOTE: a quirk of decimal end-of-data processing is existence of "lower maxs" if digits are not a multiple of 3 */ - /* 62*/ { 7, "1", 1753, 0, 104, 98 }, - /* 63*/ { 7, "A", 1096, 0, 104, 98 }, - /* 64*/ { 7, "A", 1097, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 65*/ { 7, "\001", 732, 0, 104, 98 }, - /* 66*/ { 7, "\001", 733, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 67*/ { 7, "\200", 730, 0, 104, 98 }, - /* 68*/ { 7, "\200", 731, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 69*/ { 8, "1", 3550, 0, 148, 134 }, /* Version H */ - /* 70*/ { 8, "1", 3551, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 71*/ { 8, "A", 2218, 0, 148, 134 }, - /* 72*/ { 8, "A", 2219, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 73*/ { 8, "\001", 1480, 0, 148, 134 }, - /* 74*/ { 8, "\001", 1481, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 75*/ { 8, "\200", 1478, 0, 148, 134 }, - /* 76*/ { 8, "\200", 1479, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 77*/ { 9, "1", 6, 0, 8, 11 }, /* Version S-10 */ - /* 78*/ { 9, "1", 7, 0, 8, 21 }, /* -> S-20 */ - /* 79*/ { 9, "1", 12, 0, 8, 21 }, /* Version S-20 */ - /* 80*/ { 9, "1", 13, 0, 8, 31 }, /* -> S-30 */ - /* 81*/ { 9, "1", 18, 0, 8, 31 }, /* Version S-30 */ - /* 82*/ { 9, "1", 19, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 83*/ { 9, "1", 17, 0, 8, 31 }, - /* 84*/ { 10, "1", 22, 0, 16, 17 }, /* Version T-16 */ - /* 85*/ { 10, "1", 23, 0, 16, 33 }, /* -> T-32 */ - /* 86*/ { 10, "A", 13, 0, 16, 17 }, - /* 87*/ { 10, "A", 14, 0, 16, 33 }, /* -> T-32 */ - /* 88*/ { 10, "\001", 10, 0, 16, 17 }, - /* 89*/ { 10, "\001", 11, 0, 16, 33 }, /* -> T-32 */ - /* 90*/ { 10, "\200", 8, 0, 16, 17 }, - /* 91*/ { 10, "\200", 9, 0, 16, 33 }, /* -> T-32 */ - /* 92*/ { 10, "1", 56, 0, 16, 33 }, /* Version T-32 */ - /* 93*/ { 10, "1", 57, 0, 16, 49 }, /* -> T-48 */ - /* 94*/ { 10, "A", 34, 0, 16, 33 }, - /* 95*/ { 10, "A", 35, 0, 16, 49 }, /* -> T-48 */ - /* 96*/ { 10, "\001", 24, 0, 16, 33 }, - /* 97*/ { 10, "\001", 25, 0, 16, 49 }, /* -> T-48 */ - /* 98*/ { 10, "\200", 22, 0, 16, 33 }, - /* 99*/ { 10, "\200", 23, 0, 16, 49 }, /* -> T-48 */ - /*100*/ { 10, "1", 90, 0, 16, 49 }, /* Version T-48 (note 90 multiple of 3) */ - /*101*/ { 10, "1", 91, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*102*/ { 10, "1", 89, ZINT_ERROR_TOO_LONG, -1, -1 }, /* NOTE: a quirk of decimal end-of-data processing is existence of "lower maxs" if digits are not a multiple of 3 */ - /*103*/ { 10, "1", 88, 0, 16, 49 }, - /*104*/ { 10, "A", 55, 0, 16, 49 }, - /*105*/ { 10, "A", 56, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*106*/ { 10, "A", 90, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*107*/ { 10, "\001", 38, 0, 16, 49 }, - /*108*/ { 10, "\001", 39, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*109*/ { 10, "\001", 90, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*110*/ { 10, "\200", 36, 0, 16, 49 }, - /*111*/ { 10, "\200", 37, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 0*/ { -1, -1, { 0, 0, "" }, "1", 3550, 0, 148, 134 }, /* Auto Version H */ + /* 1*/ { -1, -1, { 0, 0, "" }, "1", 3551, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 2*/ { 3, -1, { 0, 0, "" }, "1", 3535, 0, 148, 134 }, /* With ECI */ + /* 3*/ { 3, -1, { 0, 0, "" }, "1", 3536, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 4*/ { -1, -1, { 1, 2, "" }, "1", 3546, 0, 148, 134 }, /* With Structured Append (Group mode, count < 2) */ + /* 5*/ { -1, -1, { 1, 2, "" }, "1", 3547, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 6*/ { -1, -1, { 1, 16, "" }, "1", 3541, 0, 148, 134 }, /* With Structured Append (Extended Group mode, count >= 16) */ + /* 7*/ { -1, -1, { 1, 16, "" }, "1", 3542, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 8*/ { 3, -1, { 1, 2, "" }, "1", 3532, 0, 148, 134 }, /* With ECI and Structured Append (Group mode) 1st symbol */ + /* 9*/ { 3, -1, { 1, 2, "" }, "1", 3533, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 10*/ { 3, -1, { 2, 2, "" }, "1", 3537, 0, 148, 134 }, /* With ECI and Structured Append (Group mode) subsequent symbol */ + /* 11*/ { 3, -1, { 2, 2, "" }, "1", 3538, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 12*/ { 3, -1, { 1, 16, "" }, "1", 3530, 0, 148, 134 }, /* With ECI and Structured Append (Extended Group mode) 1st symbol */ + /* 13*/ { 3, -1, { 1, 16, "" }, "1", 3531, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 14*/ { 3, -1, { 2, 16, "" }, "1", 3535, 0, 148, 134 }, /* With ECI and Structured Append (Extended Group mode) subsequent symbol */ + /* 15*/ { 3, -1, { 2, 16, "" }, "1", 3536, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 16*/ { -1, -1, { 0, 0, "" }, "A", 2218, 0, 148, 134 }, + /* 17*/ { -1, -1, { 0, 0, "" }, "A", 2219, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 18*/ { -1, -1, { 0, 0, "" }, "\001", 1480, 0, 148, 134 }, /* Full ASCII */ + /* 19*/ { -1, -1, { 0, 0, "" }, "\001", 1481, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 20*/ { -1, -1, { 0, 0, "" }, "\200", 1478, 0, 148, 134 }, /* BYTE */ + /* 21*/ { -1, -1, { 0, 0, "" }, "\200", 1479, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 22*/ { -1, 1, { 0, 0, "" }, "1", 22, 0, 16, 18 }, /* Version A */ + /* 23*/ { -1, 1, { 0, 0, "" }, "1", 23, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 24*/ { -1, 1, { 0, 0, "" }, "A", 13, 0, 16, 18 }, + /* 25*/ { -1, 1, { 0, 0, "" }, "A", 14, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 26*/ { 3, 1, { 0, 0, "" }, "A", 4, 0, 16, 18 }, /* With ECI */ + /* 27*/ { 3, 1, { 0, 0, "" }, "A", 5, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 26*/ { -1, 1, { 1, 2, "" }, "A", 10, 0, 16, 18 }, /* With Structured Append */ + /* 27*/ { -1, 1, { 1, 2, "" }, "A", 11, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 28*/ { 3, 1, { 1, 2, "" }, "A", 2, 0, 16, 18 }, /* With ECI and Structured Append 1st symbol */ + /* 29*/ { 3, 1, { 1, 2, "" }, "A", 3, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 30*/ { 3, 1, { 2, 2, "" }, "A", 4, 0, 16, 18 }, /* With ECI and Structured Append subsequent symbol */ + /* 31*/ { 3, 1, { 2, 2, "" }, "A", 5, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 32*/ { -1, 1, { 0, 0, "" }, "\001", 10, 0, 16, 18 }, + /* 33*/ { -1, 1, { 0, 0, "" }, "\001", 11, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 34*/ { -1, 1, { 0, 0, "" }, "\200", 8, 0, 16, 18 }, + /* 35*/ { -1, 1, { 0, 0, "" }, "\200", 9, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 36*/ { -1, 2, { 0, 0, "" }, "1", 44, 0, 22, 22 }, /* Version B */ + /* 37*/ { -1, 2, { 0, 0, "" }, "1", 45, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 38*/ { -1, 2, { 0, 0, "" }, "A", 27, 0, 22, 22 }, + /* 39*/ { -1, 2, { 0, 0, "" }, "A", 28, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 40*/ { -1, 2, { 0, 0, "" }, "A", 26, 0, 22, 22 }, + /* 41*/ { -1, 2, { 0, 0, "" }, "\001", 19, 0, 22, 22 }, + /* 42*/ { -1, 2, { 0, 0, "" }, "\001", 20, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 43*/ { -1, 2, { 0, 0, "" }, "\200", 17, 0, 22, 22 }, + /* 44*/ { -1, 2, { 0, 0, "" }, "\200", 18, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 45*/ { -1, 3, { 0, 0, "" }, "1", 104, 0, 28, 32 }, /* Version C */ + /* 46*/ { -1, 3, { 0, 0, "" }, "1", 105, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 47*/ { -1, 3, { 0, 0, "" }, "A", 64, 0, 28, 32 }, + /* 48*/ { -1, 3, { 0, 0, "" }, "A", 65, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 49*/ { -1, 3, { 0, 0, "" }, "\001", 44, 0, 28, 32 }, + /* 50*/ { -1, 3, { 0, 0, "" }, "\001", 45, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 51*/ { -1, 3, { 0, 0, "" }, "\200", 42, 0, 28, 32 }, + /* 52*/ { -1, 3, { 0, 0, "" }, "\200", 43, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 53*/ { -1, 4, { 0, 0, "" }, "1", 217, 0, 40, 42 }, /* Version D */ + /* 54*/ { -1, 4, { 0, 0, "" }, "1", 218, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 55*/ { -1, 4, { 0, 0, "" }, "A", 135, 0, 40, 42 }, + /* 56*/ { -1, 4, { 0, 0, "" }, "A", 136, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 57*/ { -1, 4, { 0, 0, "" }, "\001", 91, 0, 40, 42 }, + /* 58*/ { -1, 4, { 0, 0, "" }, "\001", 92, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 59*/ { -1, 4, { 0, 0, "" }, "\200", 89, 0, 40, 42 }, + /* 60*/ { -1, 4, { 0, 0, "" }, "\200", 90, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 61*/ { -1, 5, { 0, 0, "" }, "1", 435, 0, 52, 54 }, /* Version E (note 435 multiple of 3) */ + /* 62*/ { -1, 5, { 0, 0, "" }, "1", 436, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 63*/ { -1, 5, { 0, 0, "" }, "1", 434, ZINT_ERROR_TOO_LONG, -1, -1 }, /* NOTE: a quirk of decimal end-of-data processing is existence of "lower maxs" if digits are not a multiple of 3 */ + /* 64*/ { -1, 5, { 0, 0, "" }, "1", 433, 0, 52, 54 }, + /* 65*/ { -1, 5, { 0, 0, "" }, "A", 271, 0, 52, 54 }, + /* 66*/ { -1, 5, { 0, 0, "" }, "A", 272, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 67*/ { -1, 5, { 0, 0, "" }, "\001", 182, 0, 52, 54 }, + /* 68*/ { -1, 5, { 0, 0, "" }, "\001", 183, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 69*/ { -1, 5, { 0, 0, "" }, "\200", 180, 0, 52, 54 }, + /* 70*/ { -1, 5, { 0, 0, "" }, "\200", 181, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 71*/ { -1, 6, { 0, 0, "" }, "1", 886, 0, 70, 76 }, /* Version F */ + /* 72*/ { -1, 6, { 0, 0, "" }, "1", 887, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 73*/ { -1, 6, { 0, 0, "" }, "A", 553, 0, 70, 76 }, + /* 74*/ { -1, 6, { 0, 0, "" }, "A", 554, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 75*/ { -1, 6, { 0, 0, "" }, "\001", 370, 0, 70, 76 }, + /* 76*/ { -1, 6, { 0, 0, "" }, "\001", 371, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 77*/ { -1, 6, { 0, 0, "" }, "\200", 368, 0, 70, 76 }, + /* 78*/ { -1, 6, { 0, 0, "" }, "\200", 369, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 79*/ { -1, 7, { 0, 0, "" }, "1", 1755, 0, 104, 98 }, /* Version G (note 1755 multiple of 3) */ + /* 80*/ { -1, 7, { 0, 0, "" }, "1", 1756, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 81*/ { -1, 7, { 0, 0, "" }, "1", 1754, ZINT_ERROR_TOO_LONG, -1, -1 }, /* NOTE: a quirk of decimal end-of-data processing is existence of "lower maxs" if digits are not a multiple of 3 */ + /* 82*/ { -1, 7, { 0, 0, "" }, "1", 1753, 0, 104, 98 }, + /* 83*/ { -1, 7, { 0, 0, "" }, "A", 1096, 0, 104, 98 }, + /* 84*/ { -1, 7, { 0, 0, "" }, "A", 1097, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 85*/ { -1, 7, { 0, 0, "" }, "\001", 732, 0, 104, 98 }, + /* 86*/ { -1, 7, { 0, 0, "" }, "\001", 733, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 87*/ { -1, 7, { 0, 0, "" }, "\200", 730, 0, 104, 98 }, + /* 88*/ { -1, 7, { 0, 0, "" }, "\200", 731, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 89*/ { -1, 8, { 0, 0, "" }, "1", 3550, 0, 148, 134 }, /* Version H */ + /* 90*/ { -1, 8, { 0, 0, "" }, "1", 3551, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 91*/ { -1, 8, { 0, 0, "" }, "A", 2218, 0, 148, 134 }, + /* 92*/ { -1, 8, { 0, 0, "" }, "A", 2219, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 93*/ { -1, 8, { 0, 0, "" }, "\001", 1480, 0, 148, 134 }, + /* 94*/ { -1, 8, { 0, 0, "" }, "\001", 1481, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 95*/ { -1, 8, { 0, 0, "" }, "\200", 1478, 0, 148, 134 }, + /* 96*/ { -1, 8, { 0, 0, "" }, "\200", 1479, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 97*/ { -1, 9, { 0, 0, "" }, "1", 6, 0, 8, 11 }, /* Version S-10 */ + /* 98*/ { -1, 9, { 0, 0, "" }, "1", 7, 0, 8, 21 }, /* -> S-20 */ + /* 99*/ { -1, 9, { 0, 0, "" }, "1", 12, 0, 8, 21 }, /* Version S-20 */ + /*100*/ { -1, 9, { 0, 0, "" }, "1", 13, 0, 8, 31 }, /* -> S-30 */ + /*101*/ { -1, 9, { 0, 0, "" }, "1", 18, 0, 8, 31 }, /* Version S-30 */ + /*102*/ { -1, 9, { 0, 0, "" }, "1", 19, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*103*/ { -1, 9, { 0, 0, "" }, "1", 17, 0, 8, 31 }, + /*104*/ { -1, 10, { 0, 0, "" }, "1", 22, 0, 16, 17 }, /* Version T-16 */ + /*105*/ { -1, 10, { 0, 0, "" }, "1", 23, 0, 16, 33 }, /* -> T-32 */ + /*106*/ { -1, 10, { 0, 0, "" }, "A", 13, 0, 16, 17 }, + /*107*/ { -1, 10, { 0, 0, "" }, "A", 14, 0, 16, 33 }, /* -> T-32 */ + /*108*/ { -1, 10, { 0, 0, "" }, "\001", 10, 0, 16, 17 }, + /*109*/ { -1, 10, { 0, 0, "" }, "\001", 11, 0, 16, 33 }, /* -> T-32 */ + /*110*/ { -1, 10, { 0, 0, "" }, "\200", 8, 0, 16, 17 }, + /*111*/ { -1, 10, { 0, 0, "" }, "\200", 9, 0, 16, 33 }, /* -> T-32 */ + /*112*/ { -1, 10, { 0, 0, "" }, "1", 56, 0, 16, 33 }, /* Version T-32 */ + /*113*/ { -1, 10, { 0, 0, "" }, "1", 57, 0, 16, 49 }, /* -> T-48 */ + /*114*/ { -1, 10, { 0, 0, "" }, "A", 34, 0, 16, 33 }, + /*115*/ { -1, 10, { 0, 0, "" }, "A", 35, 0, 16, 49 }, /* -> T-48 */ + /*116*/ { -1, 10, { 0, 0, "" }, "\001", 24, 0, 16, 33 }, + /*117*/ { -1, 10, { 0, 0, "" }, "\001", 25, 0, 16, 49 }, /* -> T-48 */ + /*118*/ { -1, 10, { 0, 0, "" }, "\200", 22, 0, 16, 33 }, + /*119*/ { -1, 10, { 0, 0, "" }, "\200", 23, 0, 16, 49 }, /* -> T-48 */ + /*120*/ { -1, 10, { 0, 0, "" }, "1", 90, 0, 16, 49 }, /* Version T-48 (note 90 multiple of 3) */ + /*121*/ { -1, 10, { 0, 0, "" }, "1", 91, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*122*/ { -1, 10, { 0, 0, "" }, "1", 89, ZINT_ERROR_TOO_LONG, -1, -1 }, /* NOTE: a quirk of decimal end-of-data processing is existence of "lower maxs" if digits are not a multiple of 3 */ + /*123*/ { -1, 10, { 0, 0, "" }, "1", 88, 0, 16, 49 }, + /*124*/ { -1, 10, { 0, 0, "" }, "A", 55, 0, 16, 49 }, + /*125*/ { -1, 10, { 0, 0, "" }, "A", 56, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*126*/ { -1, 10, { 0, 0, "" }, "A", 90, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*127*/ { -1, 10, { 0, 0, "" }, "\001", 38, 0, 16, 49 }, + /*128*/ { -1, 10, { 0, 0, "" }, "\001", 39, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*129*/ { -1, 10, { 0, 0, "" }, "\001", 90, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*130*/ { -1, 10, { 0, 0, "" }, "\200", 36, 0, 16, 49 }, + /*131*/ { -1, 10, { 0, 0, "" }, "\200", 37, ZINT_ERROR_TOO_LONG, -1, -1 }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -176,7 +200,10 @@ static void test_large(int index, int debug) { testUtilStrCpyRepeat(data_buf, data[i].pattern, data[i].length); assert_equal(data[i].length, (int) strlen(data_buf), "i:%d length %d != strlen(data_buf) %d\n", i, data[i].length, (int) strlen(data_buf)); - length = testUtilSetSymbol(symbol, BARCODE_CODEONE, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data_buf, data[i].length, debug); + length = testUtilSetSymbol(symbol, BARCODE_CODEONE, -1 /*input_mode*/, data[i].eci, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data_buf, data[i].length, debug); + if (data[i].structapp.count) { + symbol->structapp = data[i].structapp; + } ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); @@ -198,6 +225,7 @@ static void test_input(int index, int debug) { int input_mode; int eci; int option_2; + struct zint_structapp structapp; char *data; int length; int ret; @@ -207,33 +235,42 @@ static void test_input(int index, int debug) { }; // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) struct item data[] = { - /* 0*/ { -1, -1, -1, "123456789012ABCDEFGHI", -1, 0, 22, 22, "", }, - /* 1*/ { -1, -1, -1, "123456789012ABCDEFGHIJ", -1, 0, 22, 22, "", }, - /* 2*/ { -1, -1, -1, "1", -1, 0, 16, 18, "", }, - /* 3*/ { -1, -1, 0, "1", -1, 0, 16, 18, "", }, - /* 4*/ { -1, -1, 1, "1", -1, 0, 16, 18, "", }, - /* 5*/ { -1, -1, 1, "ABCDEFGHIJKLMN", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for selected symbol size", }, - /* 6*/ { GS1_MODE, -1, 1, "[01]12345678901231", -1, 0, 16, 18, "", }, - /* 7*/ { GS1_MODE | GS1PARENS_MODE, -1, 1, "(01)12345678901231", -1, 0, 16, 18, "", }, - /* 8*/ { -1, 3, 1, "1", -1, 0, 16, 18, "", }, - /* 9*/ { UNICODE_MODE, 3, 1, "é", -1, 0, 16, 18, "", }, - /* 10*/ { GS1_MODE, 3, 1, "[01]12345678901231", -1, ZINT_WARN_INVALID_OPTION, 16, 18, "Warning 512: ECI ignored for GS1 mode", }, - /* 11*/ { -1, -1, 9, "123456789012345678", -1, 0, 8, 31, "", }, - /* 12*/ { -1, -1, 9, "12345678901234567A", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 515: Invalid input data (Version S encodes numeric input only)", }, - /* 13*/ { -1, -1, 9, "1234567890123456789", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 514: Input data too long for Version S", }, - /* 14*/ { GS1_MODE, -1, 9, "[01]12345678901231", -1, ZINT_WARN_INVALID_OPTION, 8, 31, "Warning 511: ECI and GS1 mode ignored for Version S", }, - /* 15*/ { -1, 3, 9, "1", -1, ZINT_WARN_INVALID_OPTION, 8, 11, "Warning 511: ECI and GS1 mode ignored for Version S", }, - /* 16*/ { -1, -1, 10, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", -1, 0, 16, 49, "", }, - /* 17*/ { -1, -1, 10, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 519: Input data too long for Version T", }, - /* 18*/ { -1, -1, 10, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", -1, 0, 16, 49, "", }, - /* 19*/ { -1, -1, 10, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 516: Input data too long for Version T", }, - /* 20*/ { -1, -1, 10, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 38, 0, 16, 49, "", }, - /* 21*/ { -1, 3, 10, "1234567890123456789012345678901234567890123456789012345678901234567890123456", -1, 0, 16, 49, "", }, - /* 22*/ { -1, 3, 10, "12345678901234567890123456789012345678901234567890123456789012345678901234567", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 516: Input data too long for Version T", }, - /* 23*/ { -1, 3, 10, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 519: Input data too long for Version T", }, - /* 24*/ { GS1_MODE, -1, 10, "[01]12345678901231", -1, 0, 16, 17, "", }, - /* 25*/ { GS1_MODE, 3, 10, "[01]12345678901231", -1, ZINT_WARN_INVALID_OPTION, 16, 17, "Warning 512: ECI ignored for GS1 mode", }, - /* 26*/ { -1, -1, 11, "1", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 513: Invalid symbol size", }, + /* 0*/ { -1, -1, -1, { 0, 0, "" }, "123456789012ABCDEFGHI", -1, 0, 22, 22, "", }, + /* 1*/ { -1, -1, -1, { 0, 0, "" }, "123456789012ABCDEFGHIJ", -1, 0, 22, 22, "", }, + /* 2*/ { -1, -1, -1, { 0, 0, "" }, "1", -1, 0, 16, 18, "", }, + /* 3*/ { -1, -1, 0, { 0, 0, "" }, "1", -1, 0, 16, 18, "", }, + /* 4*/ { -1, -1, 1, { 0, 0, "" }, "1", -1, 0, 16, 18, "", }, + /* 5*/ { -1, -1, 1, { 0, 0, "" }, "ABCDEFGHIJKLMN", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for selected symbol size", }, + /* 6*/ { GS1_MODE, -1, 1, { 0, 0, "" }, "[01]12345678901231", -1, 0, 16, 18, "", }, + /* 7*/ { GS1_MODE | GS1PARENS_MODE, -1, 1, { 0, 0, "" }, "(01)12345678901231", -1, 0, 16, 18, "", }, + /* 8*/ { -1, 3, 1, { 0, 0, "" }, "1", -1, 0, 16, 18, "", }, + /* 9*/ { UNICODE_MODE, 3, 1, { 0, 0, "" }, "é", -1, 0, 16, 18, "", }, + /* 10*/ { GS1_MODE, 3, 1, { 0, 0, "" }, "[01]12345678901231", -1, ZINT_WARN_INVALID_OPTION, 16, 18, "Warning 512: ECI ignored for GS1 mode", }, + /* 11*/ { -1, -1, 9, { 0, 0, "" }, "123456789012345678", -1, 0, 8, 31, "", }, + /* 12*/ { -1, -1, 9, { 0, 0, "" }, "12345678901234567A", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 515: Invalid input data (Version S encodes numeric input only)", }, + /* 13*/ { -1, -1, 9, { 0, 0, "" }, "1234567890123456789", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 514: Input data too long for Version S", }, + /* 14*/ { GS1_MODE, -1, 9, { 0, 0, "" }, "[01]12345678901231", -1, ZINT_WARN_INVALID_OPTION, 8, 31, "Warning 511: GS1 mode ignored for Version S", }, + /* 15*/ { -1, 3, 9, { 0, 0, "" }, "1", -1, ZINT_WARN_INVALID_OPTION, 8, 11, "Warning 511: ECI ignored for Version S", }, + /* 16*/ { GS1_MODE, 3, 9, { 0, 0, "" }, "[01]12345678901231", -1, ZINT_WARN_INVALID_OPTION, 8, 31, "Warning 511: ECI and GS1 mode ignored for Version S", }, + /* 17*/ { -1, -1, 10, { 0, 0, "" }, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", -1, 0, 16, 49, "", }, + /* 18*/ { -1, -1, 10, { 0, 0, "" }, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 519: Input data too long for Version T", }, + /* 19*/ { -1, -1, 10, { 0, 0, "" }, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", -1, 0, 16, 49, "", }, + /* 20*/ { -1, -1, 10, { 0, 0, "" }, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 516: Input data too long for Version T", }, + /* 21*/ { -1, -1, 10, { 0, 0, "" }, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 38, 0, 16, 49, "", }, + /* 22*/ { -1, 3, 10, { 0, 0, "" }, "1234567890123456789012345678901234567890123456789012345678901234567890123456", -1, 0, 16, 49, "", }, + /* 23*/ { -1, 3, 10, { 0, 0, "" }, "12345678901234567890123456789012345678901234567890123456789012345678901234567", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 516: Input data too long for Version T", }, + /* 24*/ { -1, 3, 10, { 0, 0, "" }, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 519: Input data too long for Version T", }, + /* 25*/ { GS1_MODE, -1, 10, { 0, 0, "" }, "[01]12345678901231", -1, 0, 16, 17, "", }, + /* 26*/ { GS1_MODE, 3, 10, { 0, 0, "" }, "[01]12345678901231", -1, ZINT_WARN_INVALID_OPTION, 16, 17, "Warning 512: ECI ignored for GS1 mode", }, + /* 27*/ { -1, -1, 11, { 0, 0, "" }, "1", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 513: Invalid symbol size", }, + /* 28*/ { GS1_MODE, -1, -1, { 1, 2, "" }, "[01]12345678901231", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 710: Cannot have Structured Append and GS1 mode at the same time", }, + /* 29*/ { -1, -1, -1, { 1, 1, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 711: Structured Append count out of range (2-128)", }, + /* 30*/ { -1, -1, -1, { 1, 1, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 711: Structured Append count out of range (2-128)", }, + /* 31*/ { -1, -1, -1, { 1, 129, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 711: Structured Append count out of range (2-128)", }, + /* 32*/ { -1, -1, -1, { 0, 2, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 712: Structured Append index out of range (1-2)", }, + /* 33*/ { -1, -1, -1, { 3, 2, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 712: Structured Append index out of range (1-2)", }, + /* 34*/ { -1, -1, -1, { 1, 2, "1" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 713: Structured Append ID not available for Code One", }, + /* 35*/ { -1, -1, 9, { 1, 2, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 714: Structured Append not supported for Version S", }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -250,6 +287,9 @@ static void test_input(int index, int debug) { assert_nonnull(symbol, "Symbol not created\n"); length = testUtilSetSymbol(symbol, BARCODE_CODEONE, data[i].input_mode, data[i].eci, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug); + if (data[i].structapp.count) { + symbol->structapp = data[i].structapp; + } 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); @@ -272,6 +312,7 @@ static void test_encode(int index, int generate, int debug) { int input_mode; int eci; int option_2; + struct zint_structapp structapp; char *data; int length; int ret; @@ -284,7 +325,7 @@ static void test_encode(int index, int generate, int debug) { }; // Figure examples AIM USS Code One (USSCO) Revision March 3, 2000 struct item data[] = { - /* 0*/ { -1, -1, -1, "1234567890123456789012", -1, 0, 16, 18, 1, "USSCO Figure 1 (Version A, no padding), same", + /* 0*/ { -1, -1, -1, { 0, 0, "" }, "1234567890123456789012", -1, 0, 16, 18, 1, "USSCO Figure 1 (Version A, no padding), same", "111111111111001100" "000110000110010101" "100010110101101010" @@ -302,7 +343,7 @@ static void test_encode(int index, int generate, int debug) { "100111000001100000" "101000001010111101" }, - /* 1*/ { -1, -1, -1, "???????????????????????????????????????????????????????????????????????????????????????????", -1, 0, 40, 42, 1, "USSCO Figure 7 (Version D, no padding), same", + /* 1*/ { -1, -1, -1, { 0, 0, "" }, "???????????????????????????????????????????????????????????????????????????????????????????", -1, 0, 40, 42, 1, "USSCO Figure 7 (Version D, no padding), same", "010011010001000100011100010001000100110100" "000010000000000000001000000000000000100000" "010010010001000100011000010001000100100100" @@ -344,7 +385,7 @@ static void test_encode(int index, int generate, int debug) { "001010001001110101011000110000111010101100" "101111001111111001001101111000011111110010" }, - /* 2*/ { -1, -1, 9, "1234567890", -1, 0, 8, 21, 1, "USSCO Figure 9 (left) NOTE: S-20 not S-10 as stated, same", + /* 2*/ { -1, -1, 9, { 0, 0, "" }, "1234567890", -1, 0, 8, 21, 1, "USSCO Figure 9 (left) NOTE: S-20 not S-10 as stated, same", "000000011110110010110" "000010000100000010011" "101111110100010100100" @@ -354,7 +395,7 @@ static void test_encode(int index, int generate, int debug) { "100000000000000000001" "101111111111111111101" }, - /* 3*/ { -1, -1, 10, "12345678901234567890", -1, 0, 16, 17, 1, "USSCO Figure 9 (right) **NOT SAME** different encodation, figure uses ASCII double digits, Zint DECIMAL (same no. of codewords)", + /* 3*/ { -1, -1, 10, { 0, 0, "" }, "12345678901234567890", -1, 0, 16, 17, 1, "USSCO Figure 9 (right) **NOT SAME** different encodation, figure uses ASCII double digits, Zint DECIMAL (same no. of codewords)", "11111111111001100" "00010001010010101" "10001101001101010" @@ -372,7 +413,7 @@ static void test_encode(int index, int generate, int debug) { "10000000000000001" "10111111111111101" }, - /* 4*/ { GS1_MODE, -1, 2, "[01]00312341234014[15]950915[10]ABC123456", -1, 0, 22, 22, 1, "USSCO Figure B1 **NOT SAME** using (10) not (30) as (30) no longer compliant", + /* 4*/ { GS1_MODE, -1, 2, { 0, 0, "" }, "[01]00312341234014[15]950915[10]ABC123456", -1, 0, 22, 22, 1, "USSCO Figure B1 **NOT SAME** using (10) not (30) as (30) no longer compliant", "1110110000110000001010" "1100100010001000111100" "0111100110100100001101" @@ -396,7 +437,31 @@ static void test_encode(int index, int generate, int debug) { "1111101011001110101010" "1010010111000001110111" }, - /* 5*/ { -1, -1, -1, "Code One", -1, 0, 16, 18, 1, "BWIPP example", + /* 5*/ { GS1_MODE | GS1NOCHECK_MODE, -1, 2, { 0, 0, "" }, "[01]00312341234014[15]950915[30]ABC123456", -1, 0, 22, 22, 1, "USSCO Figure B1 same", + "1110110000110000001010" + "1100100010001000111100" + "0111100110100100001101" + "1100100100101011101111" + "1001101111101001000100" + "0100101101000000100011" + "0100101000101010110111" + "0000100000000000100000" + "1111111111111111111111" + "0000000000000000000000" + "0111111111111111111110" + "0100000000000000000010" + "0111111111111111111110" + "0100000000000000000010" + "0111111111111111111110" + "0100111001001010101110" + "1100100111000101101010" + "1011001110001010100000" + "0110011100010001101001" + "1010101110011010101001" + "1101111110110010101110" + "1010011100101001110101" + }, + /* 6*/ { -1, -1, -1, { 0, 0, "" }, "Code One", -1, 0, 16, 18, 1, "BWIPP example", "010011011101100110" "010010000001010110" "001010010101100110" @@ -414,7 +479,7 @@ static void test_encode(int index, int generate, int debug) { "100001100111100100" "100000111000111000" }, - /* 6*/ { -1, -1, 9, "406990", -1, 0, 8, 11, 1, "BWIPP Version S-10 example", + /* 7*/ { -1, -1, 9, { 0, 0, "" }, "406990", -1, 0, 8, 11, 1, "BWIPP Version S-10 example", "01101101101" "00101010111" "01101001101" @@ -424,7 +489,7 @@ static void test_encode(int index, int generate, int debug) { "10000000001" "10111111101" }, - /* 7*/ { -1, -1, 3, "1234567890ABCDEF", -1, 0, 28, 32, 1, "https://fr.wikipedia.org/wiki/Liste_des_symbologies **NOT SAME** as Zint has unlatch to ASCII at end (before padding)", + /* 8*/ { -1, -1, 3, { 0, 0, "" }, "1234567890ABCDEF", -1, 0, 28, 32, 1, "https://fr.wikipedia.org/wiki/Liste_des_symbologies **NOT SAME** as Zint has unlatch to ASCII at end (before padding)", "10001110101011110111011110110101" "11101001001010000011000110101001" "11101001100010111110001000101000" @@ -454,7 +519,7 @@ static void test_encode(int index, int generate, int debug) { "01101001101100000101111100100000" "00111100100000110101111110111001" }, - /* 8*/ { -1, -1, 1, "1", -1, 0, 16, 18, 1, "Version A", + /* 9*/ { -1, -1, 1, { 0, 0, "" }, "1", -1, 0, 16, 18, 1, "Version A", "001111100010001000" "001010000100010001" "100010100010001000" @@ -472,7 +537,7 @@ static void test_encode(int index, int generate, int debug) { "101000000101100011" "001110100110110101" }, - /* 9*/ { -1, -1, 2, "1", -1, 0, 22, 22, 1, "Version B", + /* 10*/ { -1, -1, 2, { 0, 0, "" }, "1", -1, 0, 22, 22, 1, "Version B", "0011111000100010001000" "0010100001000100010001" "1000101000100010001000" @@ -496,7 +561,7 @@ static void test_encode(int index, int generate, int debug) { "0000001101010001100110" "0001001111111101111101" }, - /* 10*/ { -1, -1, 3, "1", -1, 0, 28, 32, 1, "Version C", + /* 11*/ { -1, -1, 3, { 0, 0, "" }, "1", -1, 0, 28, 32, 1, "Version C", "00111110001000100010001000111000" "00101000010001000100010001100001" "10001010001000100010001000101000" @@ -526,7 +591,7 @@ static void test_encode(int index, int generate, int debug) { "00001000011000110111001001100111" "10001110101100110010000011111001" }, - /* 11*/ { -1, -1, 4, "1", -1, 0, 40, 42, 1, "Version D", + /* 12*/ { -1, -1, 4, { 0, 0, "" }, "1", -1, 0, 40, 42, 1, "Version D", "001111100010001000101100100010001000111000" "001010000100010001001001000100010001100001" "100010100010001000101000100010001000101000" @@ -568,7 +633,7 @@ static void test_encode(int index, int generate, int debug) { "111110111100011110001010001011010010101010" "001111110100111100111110111101110110111000" }, - /* 12*/ { -1, -1, 5, "1", -1, 0, 52, 54, 1, "Version E", + /* 13*/ { -1, -1, 5, { 0, 0, "" }, "1", -1, 0, 52, 54, 1, "Version E", "001111100010001000100010001110001000100010001000111000" "001010000100010001000100011000010001000100010001100001" "100010100010001000100010001010001000100010001000101000" @@ -622,7 +687,7 @@ static void test_encode(int index, int generate, int debug) { "111110101100111001100001101011110110001010011110100010" "111111001000100010110011011100010011010001110011110110" }, - /* 13*/ { -1, -1, 6, "1", -1, 0, 70, 76, 1, "Version F", + /* 14*/ { -1, -1, 6, { 0, 0, "" }, "1", -1, 0, 70, 76, 1, "Version F", "0011111000100010001000100011100010001000100010001110001000100010001000111000" "0010100001000100010001000110000100010001000100011000010001000100010001100001" "1000101000100010001000100010100010001000100010001010001000100010001000101000" @@ -694,7 +759,7 @@ static void test_encode(int index, int generate, int debug) { "0100101101010010100110011010000001101000011011111001011101001000011110100101" "1100111111000110110101110011011001001010010101101111011110000111010100110101" }, - /* 14*/ { -1, -1, 7, "1", -1, 0, 104, 98, 1, "Version G", + /* 15*/ { -1, -1, 7, { 0, 0, "" }, "1", -1, 0, 104, 98, 1, "Version G", "00111011001000100010001000111000100010001000100011100010001000100010011010001000100010001011001000" "00100010010001000100010001010001000100010001000110000100010001000100010100010001000100010010010001" "10001010001000100010001000110000100010001000100010100010001000100010010010001000100010001010001000" @@ -800,7 +865,7 @@ static void test_encode(int index, int generate, int debug) { "01010110010110111111111111010101011001100110011010000000000000001110010010001000011000100010100010" "01010111011110111111111111111010000100010001111011010001000100000111011011001100100100010011010001" }, - /* 15*/ { -1, -1, 8, "1", -1, 0, 148, 134, 1, "Version H", + /* 16*/ { -1, -1, 8, { 0, 0, "" }, "1", -1, 0, 148, 134, 1, "Version H", "00111011001000100010001000111000100010001000101100100010001000100011100010001000100010110010001000100010001110001000100010001011001000" "00100010010001000100010001100001000100010001001001000100010001000110000100010001000100100100010001000100011000010001000100010010010001" "10001010001000100010001000101000100010001000101000100010001000100010100010001000100010100010001000100010001010001000100010001010001000" @@ -950,7 +1015,7 @@ static void test_encode(int index, int generate, int debug) { "11111110111111111111111111100101110111011101111001110111011101001010000100010001000100100100010001111001011001010101010101010110010101" "01100111100110011001100110111101111011101110111110111011101110000111110111011101110111110111011101010001011101010101010101010111010101" }, - /* 16*/ { -1, -1, 9, "123456", -1, 0, 8, 11, 1, "Version S-10", + /* 17*/ { -1, -1, 9, { 0, 0, "" }, "123456", -1, 0, 8, 11, 1, "Version S-10", "00011110000" "11000010001" "10100011100" @@ -960,7 +1025,7 @@ static void test_encode(int index, int generate, int debug) { "10000000001" "10111111101" }, - /* 17*/ { -1, -1, 9, "123456789012", -1, 0, 8, 21, 1, "Version S-20", + /* 18*/ { -1, -1, 9, { 0, 0, "" }, "123456789012", -1, 0, 8, 21, 1, "Version S-20", "000101110111000010010" "110101100101011000101" "100000101001110101100" @@ -970,7 +1035,7 @@ static void test_encode(int index, int generate, int debug) { "100000000000000000001" "101111111111111111101" }, - /* 18*/ { -1, -1, 9, "123456789012345678", -1, 0, 8, 31, 1, "Version S-30", + /* 19*/ { -1, -1, 9, { 0, 0, "" }, "123456789012345678", -1, 0, 8, 31, 1, "Version S-30", "0000110111010011100000001111001" "1110100011011100110110110010111" "1111100010010100111000011001010" @@ -980,7 +1045,7 @@ static void test_encode(int index, int generate, int debug) { "1000000000000001000000000000001" "1011111111111111111111111111101" }, - /* 19*/ { -1, -1, 10, "ABCDEFGHIJKLM", -1, 0, 16, 17, 1, "Version T-16", + /* 20*/ { -1, -1, 10, { 0, 0, "" }, "ABCDEFGHIJKLM", -1, 0, 16, 17, 1, "Version T-16", "11100101111100110" "01101001010011101" "00101000001011001" @@ -998,7 +1063,7 @@ static void test_encode(int index, int generate, int debug) { "10000000000000001" "10111111111111101" }, - /* 20*/ { -1, -1, 10, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGH", -1, 0, 16, 33, 1, "Version T-32", + /* 21*/ { -1, -1, 10, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGH", -1, 0, 16, 33, 1, "Version T-32", "111001011110011010010100001011001" "011010011001110100100000011110011" "100110101101101100001110001001110" @@ -1016,7 +1081,7 @@ static void test_encode(int index, int generate, int debug) { "100000000000000000000000000000001" "101111111111111111111111111111101" }, - /* 21*/ { -1, -1, 10, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABC", -1, 0, 16, 49, 1, "Version T-48", + /* 22*/ { -1, -1, 10, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABC", -1, 0, 16, 49, 1, "Version T-48", "1110010111100110001010001010110011001101011011011" "0110100110011101010000000111100111010011001011010" "0001110001001110100011110101001100101011110001000" @@ -1034,7 +1099,7 @@ static void test_encode(int index, int generate, int debug) { "1000000000000000000000001000000000000000000000001" "1011111111111111111111111111111111111111111111101" }, - /* 22*/ { -1, -1, -1, "123456789012", -1, 0, 16, 18, 1, "ASCII double digits", + /* 23*/ { -1, -1, -1, { 0, 0, "" }, "123456789012", -1, 0, 16, 18, 1, "ASCII double digits", "100011101010111101" "111010010010100000" "110110100010001000" @@ -1052,7 +1117,7 @@ static void test_encode(int index, int generate, int debug) { "010111110100100111" "100010001101111100" }, - /* 23*/ { -1, -1, -1, "1234567890123", -1, 0, 16, 18, 1, "DECIMAL (numeric ending >= 13)", + /* 24*/ { -1, -1, -1, { 0, 0, "" }, "1234567890123", -1, 0, 16, 18, 1, "DECIMAL (numeric ending >= 13)", "111111111111001100" "000110000110010101" "100010110111011000" @@ -1070,7 +1135,7 @@ static void test_encode(int index, int generate, int debug) { "011011110100101000" "010000100100111111" }, - /* 24*/ { -1, -1, -1, "1234567890123A", -1, 0, 16, 18, 1, "ASCII (ending not fully numeric)", + /* 25*/ { -1, -1, -1, { 0, 0, "" }, "1234567890123A", -1, 0, 16, 18, 1, "ASCII (ending not fully numeric)", "100011101010111101" "111010010010100000" "110110100000110100" @@ -1088,7 +1153,7 @@ static void test_encode(int index, int generate, int debug) { "001101100111101010" "010000000011110011" }, - /* 25*/ { -1, -1, -1, "GOSGOS", -1, 0, 16, 18, 1, "2 C40 triplets, C40 at end, buffer empty, switch to ASCII before padding (5)", + /* 26*/ { -1, -1, -1, { 0, 0, "" }, "GOSGOS", -1, 0, 16, 18, 1, "2 C40 triplets, C40 at end, buffer empty, switch to ASCII before padding (5)", "111011100010001000" "011010000100010001" "100010111110001000" @@ -1106,7 +1171,7 @@ static void test_encode(int index, int generate, int debug) { "110101010100101011" "100110001001111001" }, - /* 26*/ { -1, -1, -1, "GOSGOSG", -1, 0, 16, 18, 1, "2 C40 triplets + C40 singlet, C40 at end, singlet in buffer, switch to ASCII before padding (3)", + /* 27*/ { -1, -1, -1, { 0, 0, "" }, "GOSGOSG", -1, 0, 16, 18, 1, "2 C40 triplets + C40 singlet, C40 at end, singlet in buffer, switch to ASCII before padding (3)", "111011100010001000" "011010000100010001" "100010111101001000" @@ -1124,7 +1189,7 @@ static void test_encode(int index, int generate, int debug) { "001000000101101010" "100101111101110001" }, - /* 27*/ { -1, -1, -1, "GOSGOSGO", -1, 0, 16, 18, 1, "2 C40 triplets + C40 doublet, C40 at end, doublet in buffer, switch to ASCII for doublet (2 pad)", + /* 28*/ { -1, -1, -1, { 0, 0, "" }, "GOSGOSGO", -1, 0, 16, 18, 1, "2 C40 triplets + C40 doublet, C40 at end, doublet in buffer, switch to ASCII for doublet (2 pad)", "111011100010001000" "011010000100010001" "100010111101000101" @@ -1142,7 +1207,7 @@ static void test_encode(int index, int generate, int debug) { "110011010011101110" "010001011100111100" }, - /* 28*/ { -1, -1, -1, "GOSGOSGOS", -1, 0, 16, 18, 1, "3 C40 triplets, C40 at end, switch to ASCII before padding (3)", + /* 29*/ { -1, -1, -1, { 0, 0, "" }, "GOSGOSGOS", -1, 0, 16, 18, 1, "3 C40 triplets, C40 at end, switch to ASCII before padding (3)", "111011100010001000" "011010000100010001" "100010100010001111" @@ -1160,7 +1225,7 @@ static void test_encode(int index, int generate, int debug) { "000011011111101011" "000011110110110001" }, - /* 29*/ { -1, -1, -1, "GOSGOSGOSG", -1, 0, 16, 18, 1, "3 C40 triplets + C40 singlet, C40 at end, singlet in buffer, switch to ASCII for singlet (1 pad)", + /* 30*/ { -1, -1, -1, { 0, 0, "" }, "GOSGOSGOSG", -1, 0, 16, 18, 1, "3 C40 triplets + C40 singlet, C40 at end, singlet in buffer, switch to ASCII for singlet (1 pad)", "111011100010001000" "011010000100010001" "100010100010001111" @@ -1178,7 +1243,7 @@ static void test_encode(int index, int generate, int debug) { "101001010011100111" "101111111001110110" }, - /* 30*/ { -1, -1, -1, "GOSGOSGOSGO", -1, 0, 16, 18, 1, "3 C40 triplets + C40 doublet, C40 at end, doublet in buffer, switch to ASCII for doublet (0 pad)", + /* 31*/ { -1, -1, -1, { 0, 0, "" }, "GOSGOSGOSGO", -1, 0, 16, 18, 1, "3 C40 triplets + C40 doublet, C40 at end, doublet in buffer, switch to ASCII for doublet (0 pad)", "111011100010001000" "011010000100010001" "100010100010001111" @@ -1196,7 +1261,7 @@ static void test_encode(int index, int generate, int debug) { "110000011111100011" "001001001110111100" }, - /* 31*/ { -1, -1, -1, "GOSGOSGOSGOS", -1, 0, 16, 18, 1, "4 C40 triplets, C40 at end, empty buffer, switch to ASCII before padding (1)", + /* 32*/ { -1, -1, -1, { 0, 0, "" }, "GOSGOSGOSGOS", -1, 0, 16, 18, 1, "4 C40 triplets, C40 at end, empty buffer, switch to ASCII before padding (1)", "111011100010001000" "011010000100010001" "100010100010001000" @@ -1214,7 +1279,7 @@ static void test_encode(int index, int generate, int debug) { "001010101010101001" "110011100111110100" }, - /* 32*/ { -1, -1, -1, ".GOSGOSGOSGOS", -1, 0, 16, 18, 1, "ASCII + 4 C40 triplets, C40 at end, empty buffer, no switch to ASCII as no padding", + /* 33*/ { -1, -1, -1, { 0, 0, "" }, ".GOSGOSGOSGOS", -1, 0, 16, 18, 1, "ASCII + 4 C40 triplets, C40 at end, empty buffer, no switch to ASCII as no padding", "001011111010001000" "111110011000010001" "100010100010001000" @@ -1232,7 +1297,7 @@ static void test_encode(int index, int generate, int debug) { "111011101001100000" "010001000011110110" }, - /* 33*/ { -1, -1, -1, "ABCDEFGHIJ\001K", -1, 0, 16, 18, 1, "4 C40 triplets (last shifted) + singlet, no unlatch, singlet as ASCII, no padding", + /* 34*/ { -1, -1, -1, { 0, 0, "" }, "ABCDEFGHIJ\001K", -1, 0, 16, 18, 1, "4 C40 triplets (last shifted) + singlet, no unlatch, singlet as ASCII, no padding", "111011010111100110" "011010100110011101" "001010100001011000" @@ -1250,7 +1315,7 @@ static void test_encode(int index, int generate, int debug) { "001100001010100011" "001001000000110110" }, - /* 34*/ { -1, -1, -1, "ABCDEFGHIJK\001", -1, 0, 22, 22, 1, "4 C40 triplets + singlet (shifted), backtrack to 3rd triplet and ASCII encode", + /* 35*/ { -1, -1, -1, { 0, 0, "" }, "ABCDEFGHIJK\001", -1, 0, 22, 22, 1, "4 C40 triplets + singlet (shifted), backtrack to 3rd triplet and ASCII encode", "1110110101111001100010" "0110101001100111010100" "1000100101111101000100" @@ -1274,7 +1339,7 @@ static void test_encode(int index, int generate, int debug) { "0011000011111010101111" "1111110001000011110110" }, - /* 35*/ { -1, -1, -1, "ABCDEFGH\001I\001", -1, 0, 22, 22, 1, "4 C40 triplets + singlet (shifted), backtrack to 2nd triplet and ASCII encode", + /* 36*/ { -1, -1, -1, { 0, 0, "" }, "ABCDEFGH\001I\001", -1, 0, 22, 22, 1, "4 C40 triplets + singlet (shifted), backtrack to 2nd triplet and ASCII encode", "1110110101111001100010" "0110101001100111010100" "1111100100010000000100" @@ -1298,7 +1363,7 @@ static void test_encode(int index, int generate, int debug) { "1110110010000110101011" "1001100010111000111111" }, - /* 36*/ { -1, -1, -1, "\101\102\103\104\105\106\107\110\200\101\102", -1, 0, 22, 22, 1, "'ABCDEFGH<80>AB' - cte_buffer_transfer with cte_p > 3", + /* 37*/ { -1, -1, -1, { 0, 0, "" }, "\101\102\103\104\105\106\107\110\200\101\102", -1, 0, 22, 22, 1, "'ABCDEFGH<80>AB' - cte_buffer_transfer with cte_p > 3", "1110110101111001100010" "0110101001100111010100" "1000100100101110001111" @@ -1322,7 +1387,7 @@ static void test_encode(int index, int generate, int debug) { "0111100000001001101001" "0101000100001100110110" }, - /* 37*/ { -1, -1, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", -1, 0, 22, 22, 1, "7 EDI triplets + doublet, doublet encoded as triplet with Shift 0 pad, no switch to ASCII, no padding", + /* 38*/ { -1, -1, -1, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", -1, 0, 22, 22, 1, "7 EDI triplets + doublet, doublet encoded as triplet with Shift 0 pad, no switch to ASCII, no padding", "1110110101111001100010" "0110101001100111010100" "1000100101100110011010" @@ -1346,7 +1411,7 @@ static void test_encode(int index, int generate, int debug) { "0101100011001011101100" "0100011100011000110110" }, - /* 38*/ { -1, -1, -1, "gosgos", -1, 0, 16, 18, 1, "2 TEXT triplets, TEXT at end, buffer empty, switch to ASCII before padding", + /* 39*/ { -1, -1, -1, { 0, 0, "" }, "gosgos", -1, 0, 16, 18, 1, "2 TEXT triplets, TEXT at end, buffer empty, switch to ASCII before padding", "111011100010001000" "111110000100010001" "100010111110001000" @@ -1364,7 +1429,7 @@ static void test_encode(int index, int generate, int debug) { "000011110000100010" "101100010110111010" }, - /* 39*/ { -1, -1, -1, "gosgosg", -1, 0, 16, 18, 1, "2 TEXT triplets + TEXT singlet, TEXT at end, singlet in buffer, switch to ASCII for singlet (3 pads)", + /* 40*/ { -1, -1, -1, { 0, 0, "" }, "gosgosg", -1, 0, 16, 18, 1, "2 TEXT triplets + TEXT singlet, TEXT at end, singlet in buffer, switch to ASCII for singlet (3 pads)", "111011100010001000" "111110000100010001" "100010111101101000" @@ -1382,7 +1447,7 @@ static void test_encode(int index, int generate, int debug) { "100100000110100110" "010101111001110000" }, - /* 40*/ { -1, -1, -1, "gosgosgo", -1, 0, 16, 18, 1, "2 TEXT triplets + TEXT doublet, TEXT at end, doublet in buffer, switch to ASCII for doublet, (2 pads)", + /* 41*/ { -1, -1, -1, { 0, 0, "" }, "gosgosgo", -1, 0, 16, 18, 1, "2 TEXT triplets + TEXT doublet, TEXT at end, doublet in buffer, switch to ASCII for doublet, (2 pads)", "111011100010001000" "111110000100010001" "100010111101100111" @@ -1400,7 +1465,7 @@ static void test_encode(int index, int generate, int debug) { "010010000000100110" "101001101001111111" }, - /* 41*/ { -1, -1, -1, ".gosgosgosgos", -1, 0, 16, 18, 1, "ASCII + 4 TEXT triplets, TEXT at end, empty buffer, no switch to ASCII as no padding", + /* 42*/ { -1, -1, -1, { 0, 0, "" }, ".gosgosgosgos", -1, 0, 16, 18, 1, "ASCII + 4 TEXT triplets, TEXT at end, empty buffer, no switch to ASCII as no padding", "001011111010001000" "111110111100010001" "100010100010001000" @@ -1418,7 +1483,7 @@ static void test_encode(int index, int generate, int debug) { "010110000001101110" "111001010101110110" }, - /* 42*/ { -1, -1, -1, "\015*>", -1, 0, 16, 18, 1, "1 EDI triplet, ASCII mode", + /* 43*/ { -1, -1, -1, { 0, 0, "" }, "\015*>", -1, 0, 16, 18, 1, "1 EDI triplet, ASCII mode", "000011001000111000" "111010101111110001" "100010100010001000" @@ -1436,7 +1501,7 @@ static void test_encode(int index, int generate, int debug) { "111000011101100111" "101001101110111110" }, - /* 43*/ { -1, -1, -1, "\015*>\015", -1, 0, 16, 18, 1, "1 EDI triplet + singlet, ASCII mode", + /* 44*/ { -1, -1, -1, { 0, 0, "" }, "\015*>\015", -1, 0, 16, 18, 1, "1 EDI triplet + singlet, ASCII mode", "000011001000110000" "111010101111111110" "100010100010001000" @@ -1454,7 +1519,7 @@ static void test_encode(int index, int generate, int debug) { "000110111010101011" "101001000010111001" }, - /* 44*/ { -1, -1, -1, "\015*>\015*", -1, 0, 16, 18, 1, "1 EDI triplet + doublet, ASCII mode", + /* 45*/ { -1, -1, -1, { 0, 0, "" }, "\015*>\015*", -1, 0, 16, 18, 1, "1 EDI triplet + doublet, ASCII mode", "000011001000110000" "111010101111111110" "001010100010001000" @@ -1472,7 +1537,7 @@ static void test_encode(int index, int generate, int debug) { "101100010011101101" "000010101011111010" }, - /* 45*/ { -1, -1, -1, "\015*>\015*>", -1, 0, 16, 18, 1, "2 EDI triplets, EDI mode", + /* 46*/ { -1, -1, -1, { 0, 0, "" }, "\015*>\015*>", -1, 0, 16, 18, 1, "2 EDI triplets, EDI mode", "111011000000100000" "111010000010110000" "001010111110001000" @@ -1490,7 +1555,7 @@ static void test_encode(int index, int generate, int debug) { "111000010111100010" "110010111011111011" }, - /* 46*/ { -1, -1, -1, "\015*>\015*>\015", -1, 0, 16, 18, 1, "2 EDI triplets + singlet, EDI mode + final ASCII", + /* 47*/ { -1, -1, -1, { 0, 0, "" }, "\015*>\015*>\015", -1, 0, 16, 18, 1, "2 EDI triplets + singlet, EDI mode + final ASCII", "111011000000100000" "111010000010110000" "001010111100001000" @@ -1508,7 +1573,7 @@ static void test_encode(int index, int generate, int debug) { "011111001000100110" "100011100011110000" }, - /* 47*/ { -1, -1, -1, "\015*>\015*>\015*", -1, 0, 16, 18, 1, "2 EDI triplets + doublet, EDI + final 2 ASCII", + /* 48*/ { -1, -1, -1, { 0, 0, "" }, "\015*>\015*>\015*", -1, 0, 16, 18, 1, "2 EDI triplets + doublet, EDI + final 2 ASCII", "111011000000100000" "111010000010110000" "001010111100000010" @@ -1526,7 +1591,7 @@ static void test_encode(int index, int generate, int debug) { "101001000000100011" "100011000010110110" }, - /* 48*/ { -1, -1, -1, "\015*>\015*>\015*>", -1, 0, 16, 18, 1, "3 EDI triplets, EDI mode", + /* 49*/ { -1, -1, -1, { 0, 0, "" }, "\015*>\015*>\015*>", -1, 0, 16, 18, 1, "3 EDI triplets, EDI mode", "111011000000100000" "111010000010110000" "001010000000101111" @@ -1544,7 +1609,7 @@ static void test_encode(int index, int generate, int debug) { "110110000011100000" "110111100010110011" }, - /* 49*/ { -1, -1, -1, "\015*>\015*>\015*>\015", -1, 0, 16, 18, 1, "3 EDI triplets + singlet, EDI mode + final ASCII singlet", + /* 50*/ { -1, -1, -1, { 0, 0, "" }, "\015*>\015*>\015*>\015", -1, 0, 16, 18, 1, "3 EDI triplets + singlet, EDI mode + final ASCII singlet", "111011000000100000" "111010000010110000" "001010000000101111" @@ -1562,7 +1627,7 @@ static void test_encode(int index, int generate, int debug) { "000101100111100111" "011010010010111010" }, - /* 50*/ { -1, -1, -1, "\015*>\015*>\015*>\015*>", -1, 0, 16, 18, 1, "4 EDI triplets, EDI mode", + /* 51*/ { -1, -1, -1, { 0, 0, "" }, "\015*>\015*>\015*>\015*>", -1, 0, 16, 18, 1, "4 EDI triplets, EDI mode", "111011000000100000" "111010000010110000" "001010000000100000" @@ -1580,7 +1645,7 @@ static void test_encode(int index, int generate, int debug) { "100000101110101011" "110001000001111000" }, - /* 51*/ { -1, -1, -1, "\015*>\015*>\015*>\015*>\015", -1, 0, 16, 18, 1, "4 EDI triplets + singlet, EDI mode + nolatch final ASCII singlet (last data codeword of symbol)", + /* 52*/ { -1, -1, -1, { 0, 0, "" }, "\015*>\015*>\015*>\015*>\015", -1, 0, 16, 18, 1, "4 EDI triplets + singlet, EDI mode + nolatch final ASCII singlet (last data codeword of symbol)", "111011000000100000" "111010000010110000" "001010000000100000" @@ -1598,7 +1663,7 @@ static void test_encode(int index, int generate, int debug) { "010111001011101001" "101010110001111100" }, - /* 52*/ { -1, -1, -1, "\015*>\015*>\015*>\015*>\015*", -1, 0, 22, 22, 1, "4 EDI triplets + doublet, EDI mode + final 2 ASCII", + /* 53*/ { -1, -1, -1, { 0, 0, "" }, "\015*>\015*>\015*>\015*>\015*", -1, 0, 22, 22, 1, "4 EDI triplets + doublet, EDI mode + final 2 ASCII", "1110110000001000000010" "1110100000101100001011" "0000100010000000101111" @@ -1622,7 +1687,7 @@ static void test_encode(int index, int generate, int debug) { "0110100100001000101101" "0010111010100110111000" }, - /* 53*/ { -1, -1, -1, "\015*>\015*>a", -1, 0, 16, 18, 1, "2 EDI triplets + ASCII singlet, EDI mode + final ASCII", + /* 54*/ { -1, -1, -1, { 0, 0, "" }, "\015*>\015*>a", -1, 0, 16, 18, 1, "2 EDI triplets + ASCII singlet, EDI mode + final ASCII", "111011000000100000" "111010000010110000" "001010111101101000" @@ -1640,7 +1705,7 @@ static void test_encode(int index, int generate, int debug) { "100111010011100101" "011111111010110101" }, - /* 54*/ { -1, -1, -1, "\015*>\015*>\015*>\015*>a", -1, 0, 16, 18, 1, "4 EDI triplets + ASCII singlet, EDI mode + final ASCII", + /* 55*/ { -1, -1, -1, { 0, 0, "" }, "\015*>\015*>\015*>\015*>a", -1, 0, 16, 18, 1, "4 EDI triplets + ASCII singlet, EDI mode + final ASCII", "111011000000100000" "111010000010110000" "001010000000100000" @@ -1658,7 +1723,7 @@ static void test_encode(int index, int generate, int debug) { "001110101010100111" "110100010001110011" }, - /* 55*/ { -1, -1, -1, "\015*>\015*>\015*>\015*>\015a", -1, 0, 22, 22, 1, "4 EDI triplets + singlet + ASCII, EDI mode + final 2 ASCII", + /* 56*/ { -1, -1, -1, { 0, 0, "" }, "\015*>\015*>\015*>\015*>\015a", -1, 0, 22, 22, 1, "4 EDI triplets + singlet + ASCII, EDI mode + final 2 ASCII", "1110110000001000000010" "1110100000101100001011" "0000100010000000101111" @@ -1682,7 +1747,7 @@ static void test_encode(int index, int generate, int debug) { "0001110010110111101110" "1001011011101101111101" }, - /* 56*/ { -1, -1, -1, "\015*>\015*>\015*>\015*a", -1, 0, 22, 22, 1, "3 EDI triplets + doublet + ASCII, EDI mode + final 3 ASCII", + /* 57*/ { -1, -1, -1, { 0, 0, "" }, "\015*>\015*>\015*>\015*a", -1, 0, 22, 22, 1, "3 EDI triplets + doublet + ASCII, EDI mode + final 3 ASCII", "1110110000001000000010" "1110100000101100001011" "0000100010111100000010" @@ -1706,7 +1771,7 @@ static void test_encode(int index, int generate, int debug) { "1011110100111010100000" "0001111010001000110010" }, - /* 57*/ { -1, -1, -1, "\015*>\015*>\015*>ABC", -1, 0, 16, 18, 1, "3 EDI triplets + 3 alphas (EDI)", + /* 58*/ { -1, -1, -1, { 0, 0, "" }, "\015*>\015*>\015*>ABC", -1, 0, 16, 18, 1, "3 EDI triplets + 3 alphas (EDI)", "111011000000100000" "111010000010110000" "001010000000100101" @@ -1724,7 +1789,7 @@ static void test_encode(int index, int generate, int debug) { "010011011100100111" "000001001101111001" }, - /* 58*/ { -1, -1, -1, "\015*>\015*>\015*>1234567", -1, 0, 22, 22, 1, "3 EDI triplets + 7 digits ending (EDI)", + /* 59*/ { -1, -1, -1, { 0, 0, "" }, "\015*>\015*>\015*>1234567", -1, 0, 22, 22, 1, "3 EDI triplets + 7 digits ending (EDI)", "1110110000001000000010" "1110100000101100001011" "0000100010001000110011" @@ -1748,7 +1813,7 @@ static void test_encode(int index, int generate, int debug) { "0110011101010010101010" "0101111011000100110001" }, - /* 59*/ { -1, -1, -1, "\015*>\015*>\015*>12345678", -1, 0, 22, 22, 1, "3 EDI triplets + 8 digits ending -> DECIMAL", + /* 60*/ { -1, -1, -1, { 0, 0, "" }, "\015*>\015*>\015*>12345678", -1, 0, 22, 22, 1, "3 EDI triplets + 8 digits ending -> DECIMAL", "1110110000001000000010" "1110100000101100001011" "0000100010111110001010" @@ -1772,7 +1837,7 @@ static void test_encode(int index, int generate, int debug) { "1101100100110011101111" "1001110001001011110010" }, - /* 60*/ { -1, -1, -1, "\015*>\015*>\015*>123456789012\015*>", -1, 0, 22, 22, 1, "3 EDI triplets + 12 DECIMAL not ending -> DECIMAL", + /* 61*/ { -1, -1, -1, { 0, 0, "" }, "\015*>\015*>\015*>123456789012\015*>", -1, 0, 22, 22, 1, "3 EDI triplets + 12 DECIMAL not ending -> DECIMAL", "1110110000001000000010" "1110100000101100001011" "0000100010111110001010" @@ -1796,7 +1861,7 @@ static void test_encode(int index, int generate, int debug) { "1110010110011011100001" "1100100100000011111100" }, - /* 61*/ { -1, -1, -1, "123456789012345", -1, 0, 16, 18, 1, "5 DECIMAL triplets, ASCII switch before padding (2)", + /* 62*/ { -1, -1, -1, { 0, 0, "" }, "123456789012345", -1, 0, 16, 18, 1, "5 DECIMAL triplets, ASCII switch before padding (2)", "111111111111001100" "000110000110010101" "100010110101101111" @@ -1814,7 +1879,7 @@ static void test_encode(int index, int generate, int debug) { "100010110110101011" "111111011010110001" }, - /* 62*/ { -1, -1, -1, "1234567890123456", -1, 0, 16, 18, 1, "5 DECIMAL triplets + singlet, switch to ASCII before padding (2)", + /* 63*/ { -1, -1, -1, { 0, 0, "" }, "1234567890123456", -1, 0, 16, 18, 1, "5 DECIMAL triplets + singlet, switch to ASCII before padding (2)", "111111111111001100" "000110000110010101" "100010110101101111" @@ -1832,7 +1897,7 @@ static void test_encode(int index, int generate, int debug) { "000101110010100011" "010101000001110111" }, - /* 63*/ { -1, -1, -1, "12345678901234567", -1, 0, 16, 18, 1, "5 DECIMAL triplets + doublet, switch before ASCII encoding of final char, padding (1)", + /* 64*/ { -1, -1, -1, { 0, 0, "" }, "12345678901234567", -1, 0, 16, 18, 1, "5 DECIMAL triplets + doublet, switch before ASCII encoding of final char, padding (1)", "111111111111001100" "000110000110010101" "100010110101101111" @@ -1850,7 +1915,7 @@ static void test_encode(int index, int generate, int debug) { "011100000111101100" "100010110100110100" }, - /* 64*/ { -1, -1, -1, "123456789012345678", -1, 0, 16, 18, 1, "6 DECIMAL triplets, switch to ASCII, padding (1)", + /* 65*/ { -1, -1, -1, { 0, 0, "" }, "123456789012345678", -1, 0, 16, 18, 1, "6 DECIMAL triplets, switch to ASCII, padding (1)", "111111111111001100" "000110000110010101" "100010110101101010" @@ -1868,7 +1933,7 @@ static void test_encode(int index, int generate, int debug) { "101110000010100101" "011010011110111101" }, - /* 65*/ { -1, -1, -1, "1234567890123456789", -1, 0, 16, 18, 1, "6 DECIMAL triplets + singlet, switch before ASCII encoding of singlet, no padding", + /* 66*/ { -1, -1, -1, { 0, 0, "" }, "1234567890123456789", -1, 0, 16, 18, 1, "6 DECIMAL triplets + singlet, switch before ASCII encoding of singlet, no padding", "111111111111001100" "000110000110010101" "100010110101101010" @@ -1886,7 +1951,7 @@ static void test_encode(int index, int generate, int debug) { "011001101011100100" "101110111011110000" }, - /* 66*/ { -1, -1, -1, "12345678901234567890", -1, 0, 16, 18, 1, "6 DECIMAL triplets + doublet, switch before ASCII 2-digit encoding of doublet, no padding", + /* 67*/ { -1, -1, -1, { 0, 0, "" }, "12345678901234567890", -1, 0, 16, 18, 1, "6 DECIMAL triplets + doublet, switch before ASCII 2-digit encoding of doublet, no padding", "111111111111001100" "000110000110010101" "100010110101101010" @@ -1904,7 +1969,7 @@ static void test_encode(int index, int generate, int debug) { "111110100110101101" "001000111011111111" }, - /* 67*/ { -1, -1, -1, "123456789012345678901", -1, 0, 16, 18, 1, "7 DECIMAL triplets, fills to final codeword, no padding", + /* 68*/ { -1, -1, -1, { 0, 0, "" }, "123456789012345678901", -1, 0, 16, 18, 1, "7 DECIMAL triplets, fills to final codeword, no padding", "111111111111001100" "000110000110010101" "100010110101101010" @@ -1922,7 +1987,7 @@ static void test_encode(int index, int generate, int debug) { "111000110101100101" "110001100000110100" }, - /* 68*/ { -1, -1, -1, "1234567890123456789012", -1, 0, 16, 18, 1, "7 DECIMAL triplets + singlet, fills to final codeword, no padding", + /* 69*/ { -1, -1, -1, { 0, 0, "" }, "1234567890123456789012", -1, 0, 16, 18, 1, "7 DECIMAL triplets + singlet, fills to final codeword, no padding", "111111111111001100" "000110000110010101" "100010110101101010" @@ -1940,7 +2005,7 @@ static void test_encode(int index, int generate, int debug) { "100111000001100000" "101000001010111101" }, - /* 69*/ { -1, -1, -1, "123456789012345678901234567890123678901AB", -1, 0, 28, 32, 1, "DECIMAL + 4 bits ASCII switch", + /* 70*/ { -1, -1, -1, { 0, 0, "" }, "123456789012345678901234567890123678901AB", -1, 0, 28, 32, 1, "DECIMAL + 4 bits ASCII switch", "11111111111100110010001101110110" "00011000011001010100000101101010" "10101011101000101111100111100001" @@ -1970,7 +2035,7 @@ static void test_encode(int index, int generate, int debug) { "11011010001110110010110100101110" "01011111010001011011010000110111" }, - /* 70*/ { -1, -1, -1, "123456789012345678901234567890123678901234A", -1, 0, 22, 22, 0, "DECIMAL + single ASCII in last 8 bits; BWIPP different encodation TODO: investigate", + /* 71*/ { -1, -1, -1, { 0, 0, "" }, "123456789012345678901234567890123678901234A", -1, 0, 22, 22, 0, "DECIMAL + single ASCII in last 8 bits; BWIPP different encodation TODO: investigate", "1111111111110011001000" "0001100001100101010000" "1101100110101011101000" @@ -1994,7 +2059,7 @@ static void test_encode(int index, int generate, int debug) { "1111110100001111101111" "0100010100010000111100" }, - /* 71*/ { -1, -1, 10, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", -1, 0, 16, 49, 1, "T-48 90", + /* 72*/ { -1, -1, 10, { 0, 0, "" }, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", -1, 0, 16, 49, 1, "T-48 90", "1111111111001100100011011011010101110100010111110" "0001000110010101000001010101001110001111010000011" "0111000100011001010100000010110100111000111101000" @@ -2012,10 +2077,10 @@ static void test_encode(int index, int generate, int debug) { "1000000000000000000000001000000000000000000000001" "1011111111111111111111111111111111111111111111101" }, - /* 72*/ { -1, -1, 10, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", -1, ZINT_ERROR_TOO_LONG, 0, 0, 1, "T-48 89", + /* 73*/ { -1, -1, 10, { 0, 0, "" }, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", -1, ZINT_ERROR_TOO_LONG, 0, 0, 1, "T-48 89", "" }, - /* 73*/ { -1, -1, -1, "A123456789012345678901A", -1, 0, 22, 22, 1, "ASCII + 7 DECIMAL triplets + ASCII", + /* 74*/ { -1, -1, -1, { 0, 0, "" }, "A123456789012345678901A", -1, 0, 22, 22, 1, "ASCII + 7 DECIMAL triplets + ASCII", "0100111111111111001100" "0010100001000110010101" "1000101101011010101110" @@ -2039,7 +2104,7 @@ static void test_encode(int index, int generate, int debug) { "1010001010001011101101" "1101101001100001110101" }, - /* 74*/ { -1, -1, -1, "A1234567890123456789012A", -1, 0, 22, 22, 1, "ASCII + 7 DECIMAL triplets + singlet + ASCII", + /* 75*/ { -1, -1, -1, { 0, 0, "" }, "A1234567890123456789012A", -1, 0, 22, 22, 1, "ASCII + 7 DECIMAL triplets + singlet + ASCII", "0100111111111111001100" "0010100001000110010101" "1000101101011010101110" @@ -2063,7 +2128,7 @@ static void test_encode(int index, int generate, int debug) { "0101101010001000100111" "1110011111011111110100" }, - /* 75*/ { -1, -1, -1, "A12345678901234567890123A", -1, 0, 22, 22, 1, "ASCII + 7 DECIMAL triplets + doublet + ASCII", + /* 76*/ { -1, -1, -1, { 0, 0, "" }, "A12345678901234567890123A", -1, 0, 22, 22, 1, "ASCII + 7 DECIMAL triplets + doublet + ASCII", "0100111111111111001100" "0010100001000110010101" "1000101101011010101110" @@ -2087,7 +2152,7 @@ static void test_encode(int index, int generate, int debug) { "0001111010010111100010" "0001001001000000110100" }, - /* 76*/ { -1, -1, -1, "ABCDEFGHI123456789012A", -1, 0, 22, 22, 1, "3 C40 triplets + 4 DECIMAL triplets + ASCII 0 padding", + /* 77*/ { -1, -1, -1, { 0, 0, "" }, "ABCDEFGHI123456789012A", -1, 0, 22, 22, 1, "3 C40 triplets + 4 DECIMAL triplets + ASCII 0 padding", "1110110101111001100010" "0110101001100111010100" "1000100101111110001010" @@ -2111,7 +2176,7 @@ static void test_encode(int index, int generate, int debug) { "0011001101000011100011" "0100110101010110111011" }, - /* 77*/ { -1, -1, -1, "ABCDEFGHI12345678", -1, 0, 22, 22, 1, "3 C40 triplets + ASCII 2-digits end-of-data", + /* 78*/ { -1, -1, -1, { 0, 0, "" }, "ABCDEFGHI12345678", -1, 0, 22, 22, 1, "3 C40 triplets + ASCII 2-digits end-of-data", "1110110101111001100010" "0110101001100111010100" "1000100101111110001010" @@ -2135,7 +2200,7 @@ static void test_encode(int index, int generate, int debug) { "1010111111111110101011" "1101101100101010110101" }, - /* 78*/ { -1, -1, -1, "ABCDEFGH123456789012345678901A", -1, 0, 22, 22, 1, "2 C40 triplets + doublet + ASCII 2-digits ASCII 0 padding", + /* 79*/ { -1, -1, -1, { 0, 0, "" }, "ABCDEFGH123456789012345678901A", -1, 0, 22, 22, 1, "2 C40 triplets + doublet + ASCII 2-digits ASCII 0 padding", "1110110101111001100010" "0110101001100111010100" "1000100100111110011010" @@ -2159,7 +2224,7 @@ static void test_encode(int index, int generate, int debug) { "0010110111111111101111" "1010010000100000110111" }, - /* 79*/ { -1, -1, -1, "\101\102\103\104\105\106\107\110\111\112\113\200", -1, 0, 22, 22, 1, "3 C40 triplets + doublet + extended ASCII - note extended ASCII not encodable in C40 mode", + /* 80*/ { -1, -1, -1, { 0, 0, "" }, "\101\102\103\104\105\106\107\110\111\112\113\200", -1, 0, 22, 22, 1, "3 C40 triplets + doublet + extended ASCII - note extended ASCII not encodable in C40 mode", "1110110101111001100010" "0110101001100111010100" "1000100101100110001011" @@ -2183,7 +2248,7 @@ static void test_encode(int index, int generate, int debug) { "1010000101100100100110" "0101111100110010110010" }, - /* 80*/ { -1, -1, -1, "\200\200", -1, 0, 16, 18, 1, "BYTE", + /* 81*/ { -1, -1, -1, { 0, 0, "" }, "\200\200", -1, 0, 16, 18, 1, "BYTE", "111011000010001000" "011110001000000000" "100010100010001000" @@ -2201,7 +2266,7 @@ static void test_encode(int index, int generate, int debug) { "010011001011100111" "110100011101110111" }, - /* 81*/ { -1, -1, -1, "\200\200\200\200\200\200\200\200", -1, 0, 16, 18, 1, "BYTE (no padding, byte count 0)", + /* 82*/ { -1, -1, -1, { 0, 0, "" }, "\200\200\200\200\200\200\200\200", -1, 0, 16, 18, 1, "BYTE (no padding, byte count 0)", "111011000010001000" "011110000000000000" "100010100010001000" @@ -2219,7 +2284,7 @@ static void test_encode(int index, int generate, int debug) { "111101011011100111" "101110100100111000" }, - /* 82*/ { -1, -1, -1, "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\061\062\063\064\065\066\067\070\071\060\061\062\063", -1, 0, 70, 76, 1, "249 BYTEs + 13 DECIMAL", + /* 83*/ { -1, -1, -1, { 0, 0, "" }, "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\061\062\063\064\065\066\067\070\071\060\061\062\063", -1, 0, 70, 76, 1, "249 BYTEs + 13 DECIMAL", "1110111111100010001000100011100010001000100010001110001000100010001000111000" "0111101001000000000000000010000000000000000000001000000000000000000000100000" "1000101000100010001000100010100010001000100010001010001000100010001000101000" @@ -2291,7 +2356,7 @@ static void test_encode(int index, int generate, int debug) { "0000101101010101000011010110011110110100100111111011100001010010000111100100" "1101111110001011101100010011101010100111101110111101101000010100111000111001" }, - /* 83*/ { -1, -1, -1, "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\061\062\063\064\065\066\067\070\071\060\061\062\063", -1, 0, 70, 76, 1, "250 BYTEs + 13 DECIMAL", + /* 84*/ { -1, -1, -1, { 0, 0, "" }, "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\061\062\063\064\065\066\067\070\071\060\061\062\063", -1, 0, 70, 76, 1, "250 BYTEs + 13 DECIMAL", "1110111111000010001000100011100010001000100010001110001000100010001000111000" "0111101010000000000000000010000000000000000000001000000000000000000000100000" "1000101000100010001000100010100010001000100010001010001000100010001000101000" @@ -2363,7 +2428,7 @@ static void test_encode(int index, int generate, int debug) { "1111101101101101100101000110010011000011110001101001001011010001000001100100" "1110110001110110001100000011110011001110000101001111000111011001010011111110" }, - /* 84*/ { -1, -1, -1, "\061\062\063\064\065\066\067\070\071\060\061\062\063\064\065\066\067\070\071\060\061\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\061\062\063\064\065\066\067\070\071\060\061\062\063", -1, 0, 104, 98, 1, "21 DECIMAL + 501 BYTEs + 13 DECIMAL", + /* 85*/ { -1, -1, -1, { 0, 0, "" }, "\061\062\063\064\065\066\067\070\071\060\061\062\063\064\065\066\067\070\071\060\061\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\061\062\063\064\065\066\067\070\071\060\061\062\063", -1, 0, 104, 98, 1, "21 DECIMAL + 501 BYTEs + 13 DECIMAL", "11111111111100110010001101011110101011101011111011111100001000100010011010001000100010001011001000" "00010010011001010100000101110010011100011111011110101100010000000000010000000000000000000010000000" "10001010001000100010001000110000100010001000100010100010001000100010010010001000100010001010001000" @@ -2469,7 +2534,7 @@ static void test_encode(int index, int generate, int debug) { "11001110100000010100001001010010000101101110100110101100011011001110010101111001100100110010001101" "01110011001111110111010101111010111001011100001111011101001011010000011011001100100000101011000101" }, - /* 85*/ { -1, -1, -1, "\061\062\063\064\065\066\067\070\071\060\061\062\063\064\065\066\067\070\071\060\061\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\061\062\063\064\065\066\067\070\071\060\061\062\063\064\065\066\067\070\071\060\061\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\061\062\063\064\065\066\067\070\071\060\061\062\063", -1, 0, 104, 98, 1, "21 DECIMAL + 251 BYTEs + 21 DECIMAL + 252 BYTEs 13 DECIMAL", + /* 86*/ { -1, -1, -1, { 0, 0, "" }, "\061\062\063\064\065\066\067\070\071\060\061\062\063\064\065\066\067\070\071\060\061\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\061\062\063\064\065\066\067\070\071\060\061\062\063\064\065\066\067\070\071\060\061\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\061\062\063\064\065\066\067\070\071\060\061\062\063", -1, 0, 104, 98, 1, "21 DECIMAL + 251 BYTEs + 21 DECIMAL + 252 BYTEs 13 DECIMAL", "11111111111100110010001101011110101011101011111011111100001000100010011010001000100010001011001000" "00010010011001010100000101110010011100011111011110101000010000000000010000000000000000000010000000" "10001010001000100010001000110000100010001000100010100010001000100010010010001000100010001010001000" @@ -2575,7 +2640,7 @@ static void test_encode(int index, int generate, int debug) { "01101010000000111001110100110111110011111001000110101010111111101011110001100001110101000110111101" "01111111101011000101001010011010111100011101111011110000111111000110111010011101101111001111011011" }, - /* 86*/ { -1, 3, -1, "\351", -1, 0, 16, 18, 1, "é in ISO 8859-1", + /* 87*/ { -1, 3, -1, { 0, 0, "" }, "\351", -1, 0, 16, 18, 1, "é in ISO 8859-1", "100011010101011000" "000110110111010010" "100010100011100110" @@ -2593,7 +2658,7 @@ static void test_encode(int index, int generate, int debug) { "001010011001100100" "101100110110110101" }, - /* 87*/ { -1, 899, -1, "\134\134\351\142\154\134\141\150\134", -1, 0, 28, 32, 1, "éblah", + /* 88*/ { -1, 899, -1, { 0, 0, "" }, "\134\134\351\142\154\134\141\150\134", -1, 0, 28, 32, 1, "éblah", "10001101010101100010001110110101" "00011011011101001010100101101101" "01011001010101111001100110100110" @@ -2623,7 +2688,7 @@ static void test_encode(int index, int generate, int debug) { "11011011010100010100111000101011" "11011110101110100011111110110011" }, - /* 88*/ { GS1_MODE, -1, -1, "[90]12[91]1234567890123A", -1, 0, 22, 22, 1, "Step B4", + /* 89*/ { GS1_MODE, -1, -1, { 0, 0, "" }, "[90]12[91]1234567890123A", -1, 0, 22, 22, 1, "Step B4", "1110111101100011101110" "1000101100111011000100" "0000101011111001110001" @@ -2647,7 +2712,7 @@ static void test_encode(int index, int generate, int debug) { "0100001001100001101110" "1110110100001101111001" }, - /* 89*/ { GS1_MODE, -1, -1, "[90]12[91]12345", -1, 0, 16, 18, 1, "Step B5", + /* 90*/ { GS1_MODE, -1, -1, { 0, 0, "" }, "[90]12[91]12345", -1, 0, 16, 18, 1, "Step B5", "111011110110001110" "100010110011101100" "111010000010111101" @@ -2665,7 +2730,7 @@ static void test_encode(int index, int generate, int debug) { "011100010001100101" "101000101000110110" }, - /* 90*/ { GS1_MODE, -1, -1, "[10]AB[90]ABCDEFGHIJKLMNOP[91]ABCDEFGHIJKLMNOPQRSTUVWXYZ", -1, 0, 28, 32, 1, "Step P", + /* 91*/ { GS1_MODE, -1, -1, { 0, 0, "" }, "[10]AB[90]ABCDEFGHIJKLMNOP[91]ABCDEFGHIJKLMNOPQRSTUVWXYZ", -1, 0, 28, 32, 1, "Step P", "11101110000100010011101101111110" "10001011000010001110001100100110" "01011011100110001010000101101001" @@ -2695,7 +2760,7 @@ static void test_encode(int index, int generate, int debug) { "01111000010000110101101110100100" "00011110111111111110101011110110" }, - /* 91*/ { GS1_MODE, -1, -1, "[11]121212", -1, 0, 16, 18, 1, "Start FNC1 and Decimal", + /* 92*/ { GS1_MODE, -1, -1, { 0, 0, "" }, "[11]121212", -1, 0, 16, 18, 1, "Start FNC1 and Decimal", "111011000100000101" "110010110011011111" "110010001110001000" @@ -2713,6 +2778,96 @@ static void test_encode(int index, int generate, int debug) { "000111100011101101" "100101110101111101" }, + /* 93*/ { -1, -1, 1, { 1, 15, "" }, "ABCDEFGHIJ", -1, 0, 16, 18, 1, "Structured Append (Group mode) 1st symbol, no ECI", + "000011111011100101" + "111010100101101001" + "111010011000101000" + "100110110101000000" + "010110010011010000" + "000010000000100000" + "111111111111111111" + "000000000000000000" + "011111111111111110" + "010000000000000010" + "011111111111111110" + "111110111110100100" + "000001000110100000" + "011011101111100000" + "010110110000100111" + "101110110100110101" + }, + /* 94*/ { -1, -1, 1, { 2, 15, "" }, "KLMNOPQRST", -1, 0, 16, 18, 1, "Structured Append (Group mode) subsequent symbol, no ECI", + "000111111011101001" + "110110100101101010" + "000010101000111100" + "001110110111100000" + "011110010101010101" + "000010000000100000" + "111111111111111111" + "000000000000000000" + "011111111111111110" + "010000000000000010" + "011111111111111110" + "100101010000100101" + "100010011111100000" + "001110111110101011" + "010101010000100001" + "110100011010111010" + }, + /* 95*/ { -1, 3, 1, { 1, 15, "" }, "AB", -1, 0, 16, 18, 1, "Structured Append (Group mode) 1st symbol, with ECI", + "100011111000000101" + "000110100111101101" + "010110100010001000" + "110110001000100101" + "010010010010101011" + "000010000000100000" + "111111111111111111" + "000000000000000000" + "011111111111111110" + "010000000000000010" + "011111111111111110" + "001000110101100110" + "110100010011101110" + "010010010011100011" + "100001000010100000" + "000110111011111101" + }, + /* 96*/ { -1, 3, 1, { 2, 15, "" }, "CDEF", -1, 0, 16, 18, 1, "Structured Append (Group mode) subsequent symbol, with ECI", + "000111111001011000" + "110110100111010010" + "100010100001000100" + "001010010101000101" + "010010010000110111" + "000010000000100000" + "111111111111111111" + "000000000000000000" + "011111111111111110" + "010000000000000010" + "011111111111111110" + "011001111110101000" + "101101010111100000" + "111001110100100111" + "010010010100100110" + "000100100101110110" + }, + /* 97*/ { -1, -1, 1, { 128, 128, "" }, "ABCDEFGHI", -1, 0, 16, 18, 1, "Structured Append (Extended Group mode)", + "100011100011101110" + "000010000010010110" + "010110111001100010" + "100110100111010100" + "100010010111101110" + "000010000000100000" + "111111111111111111" + "000000000000000000" + "011111111111111110" + "010000000000000010" + "011111111111111110" + "000011111001100010" + "111110000001101110" + "011011001000101010" + "000001010100101011" + "110100001010111101" + }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -2735,13 +2890,17 @@ static void test_encode(int index, int generate, int debug) { assert_nonnull(symbol, "Symbol not created\n"); length = testUtilSetSymbol(symbol, BARCODE_CODEONE, data[i].input_mode, data[i].eci, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug); + if (data[i].structapp.count) { + symbol->structapp = data[i].structapp; + } 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, %d, \"%s\",\n", + printf(" /*%3d*/ { %s, %d, %d, { %d, %d, \"%s\" }, \"%s\", %d, %s, %d, %d, %d, \"%s\",\n", i, testUtilInputModeName(data[i].input_mode), data[i].eci, data[i].option_2, + data[i].structapp.index, data[i].structapp.count, data[i].structapp.id, testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), data[i].length, testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].bwipp_cmp, data[i].comment); if (ret < ZINT_ERROR) { diff --git a/backend/tests/test_code128.c b/backend/tests/test_code128.c index c6aa3e9a..03624dd5 100644 --- a/backend/tests/test_code128.c +++ b/backend/tests/test_code128.c @@ -583,8 +583,8 @@ static void test_dpd_input(int index, int generate, int debug) { /* 1*/ { "12345678901234567890123456789", ZINT_ERROR_TOO_LONG, -1, "Error 349: DPD input wrong length (28 characters required)", "" }, /* 2*/ { "123456789012345678901234567,", ZINT_ERROR_INVALID_DATA, -1, "Error 300: Invalid character in DPD data (alphanumerics only)", "Alphanumerics only in body" }, /* 3*/ { ",234567890123456789012345678", 0, 211, "(19) 104 12 18 99 34 56 78 90 12 34 56 78 90 12 34 56 78 64 106", "Non-alphanumeric DPD Identifier (Barcode ID) allowed" }, - /* 4*/ { "\037234567890123456789012345678", ZINT_ERROR_INVALID_DATA, -1, "Error 301: Invalid DPD identifier (first character), ASCII values 32 to 127 only", "Control char as DPD Identifier" }, - /* 5*/ { "é234567890123456789012345678", ZINT_ERROR_INVALID_DATA, -1, "Error 301: Invalid DPD identifier (first character), ASCII values 32 to 127 only", "Extended ASCII as DPD Identifier" }, + /* 4*/ { "\037234567890123456789012345678", ZINT_ERROR_INVALID_DATA, -1, "Error 343: Invalid DPD identifier (first character), ASCII values 32 to 127 only", "Control char as DPD Identifier" }, + /* 5*/ { "é234567890123456789012345678", ZINT_ERROR_INVALID_DATA, -1, "Error 343: Invalid DPD identifier (first character), ASCII values 32 to 127 only", "Extended ASCII as DPD Identifier" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; diff --git a/backend/tests/test_dmatrix.c b/backend/tests/test_dmatrix.c index abe89e9f..eb1fc560 100644 --- a/backend/tests/test_dmatrix.c +++ b/backend/tests/test_dmatrix.c @@ -36,6 +36,7 @@ static void test_large(int index, int debug) { struct item { int symbology; int option_2; + struct zint_structapp structapp; char *pattern; int length; int ret; @@ -45,302 +46,304 @@ static void test_large(int index, int debug) { // ISO/IEC 16022:2006 Table 7 and ISO/IEC 21471:2020 (DMRE) Table 7 // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) struct item data[] = { - /* 0*/ { BARCODE_DATAMATRIX, -1, "1", 3116, 0, 144, 144 }, - /* 1*/ { BARCODE_DATAMATRIX, -1, "1", 3117, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 2*/ { BARCODE_DATAMATRIX, -1, "A", 2335, 0, 144, 144 }, - /* 3*/ { BARCODE_DATAMATRIX, -1, "A", 2336, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 4*/ { BARCODE_DATAMATRIX, -1, "\200", 1556, 0, 144, 144 }, // Spec says 1555 but 1556 correct as only single byte count of 0 required - /* 5*/ { BARCODE_DATAMATRIX, -1, "\200", 1557, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 6*/ { BARCODE_HIBC_DM, -1, "1", 110, 0, 32, 32 }, - /* 7*/ { BARCODE_HIBC_DM, -1, "1", 111, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 8*/ { BARCODE_DATAMATRIX, 1, "1", 6, 0, 10, 10 }, - /* 9*/ { BARCODE_DATAMATRIX, 1, "1", 7, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 10*/ { BARCODE_DATAMATRIX, 1, "A", 3, 0, 10, 10 }, - /* 11*/ { BARCODE_DATAMATRIX, 1, "A", 4, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 12*/ { BARCODE_DATAMATRIX, 1, "\200", 1, 0, 10, 10 }, - /* 13*/ { BARCODE_DATAMATRIX, 1, "\200", 2, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 14*/ { BARCODE_DATAMATRIX, 2, "1", 10, 0, 12, 12 }, - /* 15*/ { BARCODE_DATAMATRIX, 2, "1", 11, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 16*/ { BARCODE_DATAMATRIX, 2, "A", 6, 0, 12, 12 }, - /* 17*/ { BARCODE_DATAMATRIX, 2, "A", 7, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 18*/ { BARCODE_DATAMATRIX, 2, "\200", 3, 0, 12, 12 }, - /* 19*/ { BARCODE_DATAMATRIX, 2, "\200", 4, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 20*/ { BARCODE_DATAMATRIX, 3, "1", 16, 0, 14, 14 }, - /* 21*/ { BARCODE_DATAMATRIX, 3, "1", 17, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 22*/ { BARCODE_DATAMATRIX, 3, "A", 10, 0, 14, 14 }, - /* 23*/ { BARCODE_DATAMATRIX, 3, "A", 11, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 24*/ { BARCODE_DATAMATRIX, 3, "\200", 6, 0, 14, 14 }, - /* 25*/ { BARCODE_DATAMATRIX, 3, "\200", 7, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 26*/ { BARCODE_DATAMATRIX, 4, "1", 24, 0, 16, 16 }, - /* 27*/ { BARCODE_DATAMATRIX, 4, "1", 25, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 28*/ { BARCODE_DATAMATRIX, 4, "A", 16, 0, 16, 16 }, - /* 29*/ { BARCODE_DATAMATRIX, 4, "A", 17, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 30*/ { BARCODE_DATAMATRIX, 4, "\200", 10, 0, 16, 16 }, - /* 31*/ { BARCODE_DATAMATRIX, 4, "\200", 11, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 32*/ { BARCODE_DATAMATRIX, 5, "1", 36, 0, 18, 18 }, - /* 33*/ { BARCODE_DATAMATRIX, 5, "1", 37, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 34*/ { BARCODE_DATAMATRIX, 5, "A", 25, 0, 18, 18 }, - /* 35*/ { BARCODE_DATAMATRIX, 5, "A", 26, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 36*/ { BARCODE_DATAMATRIX, 5, "\200", 16, 0, 18, 18 }, - /* 37*/ { BARCODE_DATAMATRIX, 5, "\200", 17, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 38*/ { BARCODE_DATAMATRIX, 6, "1", 44, 0, 20, 20 }, - /* 39*/ { BARCODE_DATAMATRIX, 6, "1", 45, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 40*/ { BARCODE_DATAMATRIX, 6, "A", 31, 0, 20, 20 }, - /* 41*/ { BARCODE_DATAMATRIX, 6, "A", 32, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 42*/ { BARCODE_DATAMATRIX, 6, "\200", 20, 0, 20, 20 }, - /* 43*/ { BARCODE_DATAMATRIX, 6, "\200", 21, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 44*/ { BARCODE_DATAMATRIX, 7, "1", 60, 0, 22, 22 }, - /* 45*/ { BARCODE_DATAMATRIX, 7, "1", 61, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 46*/ { BARCODE_DATAMATRIX, 7, "A", 43, 0, 22, 22 }, - /* 47*/ { BARCODE_DATAMATRIX, 7, "A", 44, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 48*/ { BARCODE_DATAMATRIX, 7, "\200", 28, 0, 22, 22 }, - /* 49*/ { BARCODE_DATAMATRIX, 7, "\200", 29, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 50*/ { BARCODE_DATAMATRIX, 8, "1", 72, 0, 24, 24 }, - /* 51*/ { BARCODE_DATAMATRIX, 8, "1", 73, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 52*/ { BARCODE_DATAMATRIX, 8, "A", 52, 0, 24, 24 }, - /* 53*/ { BARCODE_DATAMATRIX, 8, "A", 53, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 54*/ { BARCODE_DATAMATRIX, 8, "\200", 34, 0, 24, 24 }, - /* 55*/ { BARCODE_DATAMATRIX, 8, "\200", 35, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 56*/ { BARCODE_DATAMATRIX, 9, "1", 88, 0, 26, 26 }, - /* 57*/ { BARCODE_DATAMATRIX, 9, "1", 89, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 58*/ { BARCODE_DATAMATRIX, 9, "A", 64, 0, 26, 26 }, - /* 59*/ { BARCODE_DATAMATRIX, 9, "A", 65, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 60*/ { BARCODE_DATAMATRIX, 9, "\200", 42, 0, 26, 26 }, - /* 61*/ { BARCODE_DATAMATRIX, 9, "\200", 43, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 62*/ { BARCODE_DATAMATRIX, 10, "1", 124, 0, 32, 32 }, - /* 63*/ { BARCODE_DATAMATRIX, 10, "1", 125, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 64*/ { BARCODE_DATAMATRIX, 10, "A", 91, 0, 32, 32 }, - /* 65*/ { BARCODE_DATAMATRIX, 10, "A", 92, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 66*/ { BARCODE_DATAMATRIX, 10, "\200", 60, 0, 32, 32 }, - /* 67*/ { BARCODE_DATAMATRIX, 10, "\200", 61, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 68*/ { BARCODE_DATAMATRIX, 11, "1", 172, 0, 36, 36 }, - /* 69*/ { BARCODE_DATAMATRIX, 11, "1", 173, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 70*/ { BARCODE_DATAMATRIX, 11, "A", 127, 0, 36, 36 }, - /* 71*/ { BARCODE_DATAMATRIX, 11, "A", 128, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 72*/ { BARCODE_DATAMATRIX, 11, "\200", 84, 0, 36, 36 }, - /* 73*/ { BARCODE_DATAMATRIX, 11, "\200", 85, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 74*/ { BARCODE_DATAMATRIX, 12, "1", 228, 0, 40, 40 }, - /* 75*/ { BARCODE_DATAMATRIX, 12, "1", 229, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 76*/ { BARCODE_DATAMATRIX, 12, "A", 169, 0, 40, 40 }, - /* 77*/ { BARCODE_DATAMATRIX, 12, "A", 170, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 78*/ { BARCODE_DATAMATRIX, 12, "\200", 112, 0, 40, 40 }, - /* 79*/ { BARCODE_DATAMATRIX, 12, "\200", 113, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 80*/ { BARCODE_DATAMATRIX, 13, "1", 288, 0, 44, 44 }, - /* 81*/ { BARCODE_DATAMATRIX, 13, "1", 289, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 82*/ { BARCODE_DATAMATRIX, 13, "A", 214, 0, 44, 44 }, - /* 83*/ { BARCODE_DATAMATRIX, 13, "A", 215, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 84*/ { BARCODE_DATAMATRIX, 13, "\200", 142, 0, 44, 44 }, - /* 85*/ { BARCODE_DATAMATRIX, 13, "\200", 143, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 86*/ { BARCODE_DATAMATRIX, 14, "1", 348, 0, 48, 48 }, - /* 87*/ { BARCODE_DATAMATRIX, 14, "1", 349, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 88*/ { BARCODE_DATAMATRIX, 14, "A", 259, 0, 48, 48 }, - /* 89*/ { BARCODE_DATAMATRIX, 14, "A", 260, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 90*/ { BARCODE_DATAMATRIX, 14, "\200", 172, 0, 48, 48 }, - /* 91*/ { BARCODE_DATAMATRIX, 14, "\200", 173, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 92*/ { BARCODE_DATAMATRIX, 15, "1", 408, 0, 52, 52 }, - /* 93*/ { BARCODE_DATAMATRIX, 15, "1", 409, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 94*/ { BARCODE_DATAMATRIX, 15, "A", 304, 0, 52, 52 }, - /* 95*/ { BARCODE_DATAMATRIX, 15, "A", 305, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 96*/ { BARCODE_DATAMATRIX, 15, "\200", 202, 0, 52, 52 }, - /* 97*/ { BARCODE_DATAMATRIX, 15, "\200", 203, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 98*/ { BARCODE_DATAMATRIX, 16, "1", 560, 0, 64, 64 }, - /* 99*/ { BARCODE_DATAMATRIX, 16, "1", 561, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*100*/ { BARCODE_DATAMATRIX, 16, "A", 418, 0, 64, 64 }, - /*101*/ { BARCODE_DATAMATRIX, 16, "A", 419, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*102*/ { BARCODE_DATAMATRIX, 16, "\200", 278, 0, 64, 64 }, // Spec says 277 but 278 correct as only single byte count of 0 required - /*103*/ { BARCODE_DATAMATRIX, 16, "\200", 279, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*104*/ { BARCODE_DATAMATRIX, 17, "1", 736, 0, 72, 72 }, - /*105*/ { BARCODE_DATAMATRIX, 17, "1", 737, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*106*/ { BARCODE_DATAMATRIX, 17, "A", 550, 0, 72, 72 }, - /*107*/ { BARCODE_DATAMATRIX, 17, "A", 551, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*108*/ { BARCODE_DATAMATRIX, 17, "\200", 366, 0, 72, 72 }, // Spec says 365 but 366 correct as only single byte count of 0 required - /*109*/ { BARCODE_DATAMATRIX, 17, "\200", 367, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*110*/ { BARCODE_DATAMATRIX, 18, "1", 912, 0, 80, 80 }, - /*111*/ { BARCODE_DATAMATRIX, 18, "1", 913, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*112*/ { BARCODE_DATAMATRIX, 18, "A", 682, 0, 80, 80 }, - /*113*/ { BARCODE_DATAMATRIX, 18, "A", 683, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*114*/ { BARCODE_DATAMATRIX, 18, "\200", 454, 0, 80, 80 }, // Spec says 453 but 454 correct as only single byte count of 0 required - /*115*/ { BARCODE_DATAMATRIX, 18, "\200", 455, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*116*/ { BARCODE_DATAMATRIX, 19, "1", 1152, 0, 88, 88 }, - /*117*/ { BARCODE_DATAMATRIX, 19, "1", 1153, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*118*/ { BARCODE_DATAMATRIX, 19, "A", 862, 0, 88, 88 }, - /*119*/ { BARCODE_DATAMATRIX, 19, "A", 863, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*120*/ { BARCODE_DATAMATRIX, 19, "\200", 574, 0, 88, 88 }, // Spec says 573 but 574 correct as only single byte count of 0 required - /*121*/ { BARCODE_DATAMATRIX, 19, "\200", 575, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*122*/ { BARCODE_DATAMATRIX, 20, "1", 1392, 0, 96, 96 }, - /*123*/ { BARCODE_DATAMATRIX, 20, "1", 1393, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*124*/ { BARCODE_DATAMATRIX, 20, "A", 1042, 0, 96, 96 }, - /*125*/ { BARCODE_DATAMATRIX, 20, "A", 1043, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*126*/ { BARCODE_DATAMATRIX, 20, "\200", 694, 0, 96, 96 }, // Spec says 693 but 694 correct as only single byte count of 0 required - /*127*/ { BARCODE_DATAMATRIX, 20, "\200", 695, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*128*/ { BARCODE_DATAMATRIX, 21, "1", 1632, 0, 104, 104 }, - /*129*/ { BARCODE_DATAMATRIX, 21, "1", 1633, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*130*/ { BARCODE_DATAMATRIX, 21, "A", 1222, 0, 104, 104 }, - /*131*/ { BARCODE_DATAMATRIX, 21, "A", 1223, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*132*/ { BARCODE_DATAMATRIX, 21, "\200", 814, 0, 104, 104 }, // Spec says 813 but 814 correct as only single byte count of 0 required - /*133*/ { BARCODE_DATAMATRIX, 21, "\200", 815, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*134*/ { BARCODE_DATAMATRIX, 22, "1", 2100, 0, 120, 120 }, - /*135*/ { BARCODE_DATAMATRIX, 22, "1", 2101, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*136*/ { BARCODE_DATAMATRIX, 22, "A", 1573, 0, 120, 120 }, - /*137*/ { BARCODE_DATAMATRIX, 22, "A", 1574, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*138*/ { BARCODE_DATAMATRIX, 22, "\200", 1048, 0, 120, 120 }, // Spec says 1047 but 1048 correct as only single byte count of 0 required - /*139*/ { BARCODE_DATAMATRIX, 22, "\200", 1049, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*140*/ { BARCODE_DATAMATRIX, 23, "1", 2608, 0, 132, 132 }, - /*141*/ { BARCODE_DATAMATRIX, 23, "1", 2609, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*142*/ { BARCODE_DATAMATRIX, 23, "A", 1954, 0, 132, 132 }, - /*143*/ { BARCODE_DATAMATRIX, 23, "A", 1955, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*144*/ { BARCODE_DATAMATRIX, 23, "\200", 1302, 0, 132, 132 }, // Spec says 1301 but 1302 correct as only single byte count of 0 required - /*145*/ { BARCODE_DATAMATRIX, 23, "\200", 1303, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*146*/ { BARCODE_DATAMATRIX, 24, "1", 3116, 0, 144, 144 }, - /*147*/ { BARCODE_DATAMATRIX, 24, "1", 3117, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*148*/ { BARCODE_DATAMATRIX, 24, "A", 2335, 0, 144, 144 }, - /*149*/ { BARCODE_DATAMATRIX, 24, "A", 2336, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*150*/ { BARCODE_DATAMATRIX, 24, "\200", 1556, 0, 144, 144 }, // Spec says 1555 but 1556 correct as only single byte count of 0 required - /*151*/ { BARCODE_DATAMATRIX, 24, "\200", 1557, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*152*/ { BARCODE_DATAMATRIX, 25, "1", 10, 0, 8, 18 }, - /*153*/ { BARCODE_DATAMATRIX, 25, "1", 11, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*154*/ { BARCODE_DATAMATRIX, 25, "A", 6, 0, 8, 18 }, - /*155*/ { BARCODE_DATAMATRIX, 25, "A", 7, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*156*/ { BARCODE_DATAMATRIX, 25, "\200", 3, 0, 8, 18 }, - /*157*/ { BARCODE_DATAMATRIX, 25, "\200", 4, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*158*/ { BARCODE_DATAMATRIX, 26, "1", 20, 0, 8, 32 }, - /*159*/ { BARCODE_DATAMATRIX, 26, "1", 21, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*160*/ { BARCODE_DATAMATRIX, 26, "A", 13, 0, 8, 32 }, - /*161*/ { BARCODE_DATAMATRIX, 26, "A", 14, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*162*/ { BARCODE_DATAMATRIX, 26, "\200", 8, 0, 8, 32 }, - /*163*/ { BARCODE_DATAMATRIX, 26, "\200", 9, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*164*/ { BARCODE_DATAMATRIX, 27, "1", 32, 0, 12, 26 }, - /*165*/ { BARCODE_DATAMATRIX, 27, "1", 33, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*166*/ { BARCODE_DATAMATRIX, 27, "A", 22, 0, 12, 26 }, - /*167*/ { BARCODE_DATAMATRIX, 27, "A", 23, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*168*/ { BARCODE_DATAMATRIX, 27, "\200", 14, 0, 12, 26 }, - /*169*/ { BARCODE_DATAMATRIX, 27, "\200", 15, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*170*/ { BARCODE_DATAMATRIX, 28, "1", 44, 0, 12, 36 }, - /*171*/ { BARCODE_DATAMATRIX, 28, "1", 45, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*172*/ { BARCODE_DATAMATRIX, 28, "A", 31, 0, 12, 36 }, - /*173*/ { BARCODE_DATAMATRIX, 28, "A", 32, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*174*/ { BARCODE_DATAMATRIX, 28, "\200", 20, 0, 12, 36 }, - /*175*/ { BARCODE_DATAMATRIX, 28, "\200", 21, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*176*/ { BARCODE_DATAMATRIX, 29, "1", 64, 0, 16, 36 }, - /*177*/ { BARCODE_DATAMATRIX, 29, "1", 65, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*178*/ { BARCODE_DATAMATRIX, 29, "A", 46, 0, 16, 36 }, - /*179*/ { BARCODE_DATAMATRIX, 29, "A", 47, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*180*/ { BARCODE_DATAMATRIX, 29, "\200", 30, 0, 16, 36 }, - /*181*/ { BARCODE_DATAMATRIX, 29, "\200", 31, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*182*/ { BARCODE_DATAMATRIX, 30, "1", 98, 0, 16, 48 }, - /*183*/ { BARCODE_DATAMATRIX, 30, "1", 99, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*184*/ { BARCODE_DATAMATRIX, 30, "A", 72, 0, 16, 48 }, - /*185*/ { BARCODE_DATAMATRIX, 30, "A", 73, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*186*/ { BARCODE_DATAMATRIX, 30, "\200", 47, 0, 16, 48 }, - /*187*/ { BARCODE_DATAMATRIX, 30, "\200", 48, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*188*/ { BARCODE_DATAMATRIX, 31, "1", 36, 0, 8, 48 }, - /*189*/ { BARCODE_DATAMATRIX, 31, "1", 37, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*190*/ { BARCODE_DATAMATRIX, 31, "A", 25, 0, 8, 48 }, - /*191*/ { BARCODE_DATAMATRIX, 31, "A", 26, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*192*/ { BARCODE_DATAMATRIX, 31, "\200", 16, 0, 8, 48 }, - /*193*/ { BARCODE_DATAMATRIX, 31, "\200", 17, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*194*/ { BARCODE_DATAMATRIX, 32, "1", 48, 0, 8, 64 }, - /*195*/ { BARCODE_DATAMATRIX, 32, "1", 49, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*196*/ { BARCODE_DATAMATRIX, 32, "A", 34, 0, 8, 64 }, - /*197*/ { BARCODE_DATAMATRIX, 32, "A", 35, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*198*/ { BARCODE_DATAMATRIX, 32, "\200", 22, 0, 8, 64 }, - /*199*/ { BARCODE_DATAMATRIX, 32, "\200", 23, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*200*/ { BARCODE_DATAMATRIX, 33, "1", 64, 0, 8, 80 }, - /*201*/ { BARCODE_DATAMATRIX, 33, "1", 65, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*202*/ { BARCODE_DATAMATRIX, 33, "A", 46, 0, 8, 80 }, - /*203*/ { BARCODE_DATAMATRIX, 33, "A", 47, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*204*/ { BARCODE_DATAMATRIX, 33, "\200", 30, 0, 8, 80 }, - /*205*/ { BARCODE_DATAMATRIX, 33, "\200", 31, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*206*/ { BARCODE_DATAMATRIX, 34, "1", 76, 0, 8, 96 }, - /*207*/ { BARCODE_DATAMATRIX, 34, "1", 77, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*208*/ { BARCODE_DATAMATRIX, 34, "A", 55, 0, 8, 96 }, - /*209*/ { BARCODE_DATAMATRIX, 34, "A", 56, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*210*/ { BARCODE_DATAMATRIX, 34, "\200", 36, 0, 8, 96 }, - /*211*/ { BARCODE_DATAMATRIX, 34, "\200", 37, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*212*/ { BARCODE_DATAMATRIX, 35, "1", 98, 0, 8, 120 }, - /*213*/ { BARCODE_DATAMATRIX, 35, "1", 99, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*214*/ { BARCODE_DATAMATRIX, 35, "A", 72, 0, 8, 120 }, - /*215*/ { BARCODE_DATAMATRIX, 35, "A", 73, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*216*/ { BARCODE_DATAMATRIX, 35, "\200", 47, 0, 8, 120 }, - /*217*/ { BARCODE_DATAMATRIX, 35, "\200", 48, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*218*/ { BARCODE_DATAMATRIX, 36, "1", 126, 0, 8, 144 }, - /*219*/ { BARCODE_DATAMATRIX, 36, "1", 127, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*220*/ { BARCODE_DATAMATRIX, 36, "A", 93, 0, 8, 144 }, - /*221*/ { BARCODE_DATAMATRIX, 36, "A", 94, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*222*/ { BARCODE_DATAMATRIX, 36, "\200", 61, 0, 8, 144 }, - /*223*/ { BARCODE_DATAMATRIX, 36, "\200", 62, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*224*/ { BARCODE_DATAMATRIX, 37, "1", 86, 0, 12, 64 }, - /*225*/ { BARCODE_DATAMATRIX, 37, "1", 87, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*226*/ { BARCODE_DATAMATRIX, 37, "A", 63, 0, 12, 64 }, - /*227*/ { BARCODE_DATAMATRIX, 37, "A", 64, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*228*/ { BARCODE_DATAMATRIX, 37, "\200", 41, 0, 12, 64 }, - /*229*/ { BARCODE_DATAMATRIX, 37, "\200", 42, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*230*/ { BARCODE_DATAMATRIX, 38, "1", 128, 0, 12, 88 }, - /*231*/ { BARCODE_DATAMATRIX, 38, "1", 129, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*232*/ { BARCODE_DATAMATRIX, 38, "A", 94, 0, 12, 88 }, - /*233*/ { BARCODE_DATAMATRIX, 38, "A", 95, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*234*/ { BARCODE_DATAMATRIX, 38, "\200", 62, 0, 12, 88 }, - /*235*/ { BARCODE_DATAMATRIX, 38, "\200", 63, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*236*/ { BARCODE_DATAMATRIX, 39, "1", 124, 0, 16, 64 }, - /*237*/ { BARCODE_DATAMATRIX, 39, "1", 125, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*238*/ { BARCODE_DATAMATRIX, 39, "A", 91, 0, 16, 64 }, - /*239*/ { BARCODE_DATAMATRIX, 39, "A", 92, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*240*/ { BARCODE_DATAMATRIX, 39, "\200", 60, 0, 16, 64 }, - /*241*/ { BARCODE_DATAMATRIX, 39, "\200", 61, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*242*/ { BARCODE_DATAMATRIX, 40, "1", 88, 0, 20, 36 }, - /*243*/ { BARCODE_DATAMATRIX, 40, "1", 89, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*244*/ { BARCODE_DATAMATRIX, 40, "A", 64, 0, 20, 36 }, - /*245*/ { BARCODE_DATAMATRIX, 40, "A", 65, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*246*/ { BARCODE_DATAMATRIX, 40, "\200", 42, 0, 20, 36 }, - /*247*/ { BARCODE_DATAMATRIX, 40, "\200", 43, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*248*/ { BARCODE_DATAMATRIX, 41, "1", 112, 0, 20, 44 }, - /*249*/ { BARCODE_DATAMATRIX, 41, "1", 113, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*250*/ { BARCODE_DATAMATRIX, 41, "A", 82, 0, 20, 44 }, - /*251*/ { BARCODE_DATAMATRIX, 41, "A", 83, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*252*/ { BARCODE_DATAMATRIX, 41, "\200", 54, 0, 20, 44 }, - /*253*/ { BARCODE_DATAMATRIX, 41, "\200", 55, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*254*/ { BARCODE_DATAMATRIX, 42, "1", 168, 0, 20, 64 }, // Spec says 186 but typo - /*255*/ { BARCODE_DATAMATRIX, 42, "1", 169, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*256*/ { BARCODE_DATAMATRIX, 42, "A", 124, 0, 20, 64 }, - /*257*/ { BARCODE_DATAMATRIX, 42, "A", 125, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*258*/ { BARCODE_DATAMATRIX, 42, "\200", 82, 0, 20, 64 }, - /*259*/ { BARCODE_DATAMATRIX, 42, "\200", 83, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*260*/ { BARCODE_DATAMATRIX, 43, "1", 144, 0, 22, 48 }, - /*261*/ { BARCODE_DATAMATRIX, 43, "1", 145, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*262*/ { BARCODE_DATAMATRIX, 43, "A", 106, 0, 22, 48 }, - /*263*/ { BARCODE_DATAMATRIX, 43, "A", 107, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*264*/ { BARCODE_DATAMATRIX, 43, "\200", 70, 0, 22, 48 }, - /*265*/ { BARCODE_DATAMATRIX, 43, "\200", 71, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*266*/ { BARCODE_DATAMATRIX, 44, "1", 160, 0, 24, 48 }, - /*267*/ { BARCODE_DATAMATRIX, 44, "1", 161, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*268*/ { BARCODE_DATAMATRIX, 44, "A", 118, 0, 24, 48 }, - /*269*/ { BARCODE_DATAMATRIX, 44, "A", 119, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*270*/ { BARCODE_DATAMATRIX, 44, "\200", 78, 0, 24, 48 }, - /*271*/ { BARCODE_DATAMATRIX, 44, "\200", 79, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*272*/ { BARCODE_DATAMATRIX, 45, "1", 216, 0, 24, 64 }, - /*273*/ { BARCODE_DATAMATRIX, 45, "1", 217, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*274*/ { BARCODE_DATAMATRIX, 45, "A", 160, 0, 24, 64 }, - /*275*/ { BARCODE_DATAMATRIX, 45, "A", 161, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*276*/ { BARCODE_DATAMATRIX, 45, "\200", 106, 0, 24, 64 }, - /*277*/ { BARCODE_DATAMATRIX, 45, "\200", 107, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*278*/ { BARCODE_DATAMATRIX, 46, "1", 140, 0, 26, 40 }, - /*279*/ { BARCODE_DATAMATRIX, 46, "1", 141, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*280*/ { BARCODE_DATAMATRIX, 46, "A", 103, 0, 26, 40 }, - /*281*/ { BARCODE_DATAMATRIX, 46, "A", 104, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*282*/ { BARCODE_DATAMATRIX, 46, "\200", 68, 0, 26, 40 }, - /*283*/ { BARCODE_DATAMATRIX, 46, "\200", 69, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*284*/ { BARCODE_DATAMATRIX, 47, "1", 180, 0, 26, 48 }, - /*285*/ { BARCODE_DATAMATRIX, 47, "1", 181, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*286*/ { BARCODE_DATAMATRIX, 47, "A", 133, 0, 26, 48 }, - /*287*/ { BARCODE_DATAMATRIX, 47, "A", 134, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*288*/ { BARCODE_DATAMATRIX, 47, "\200", 88, 0, 26, 48 }, - /*289*/ { BARCODE_DATAMATRIX, 47, "\200", 89, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*290*/ { BARCODE_DATAMATRIX, 48, "1", 236, 0, 26, 64 }, - /*291*/ { BARCODE_DATAMATRIX, 48, "1", 237, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*292*/ { BARCODE_DATAMATRIX, 48, "A", 175, 0, 26, 64 }, - /*293*/ { BARCODE_DATAMATRIX, 48, "A", 176, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*294*/ { BARCODE_DATAMATRIX, 48, "\200", 116, 0, 26, 64 }, - /*295*/ { BARCODE_DATAMATRIX, 48, "\200", 117, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 0*/ { BARCODE_DATAMATRIX, -1, { 0, 0, "" }, "1", 3116, 0, 144, 144 }, + /* 1*/ { BARCODE_DATAMATRIX, -1, { 0, 0, "" }, "1", 3117, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 2*/ { BARCODE_DATAMATRIX, -1, { 1, 2, "001001"}, "1", 3108, 0, 144, 144 }, // Structured Append 4 codewords overhead == 8 digits + /* 3*/ { BARCODE_DATAMATRIX, -1, { 1, 2, "001001"}, "1", 3109, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 4*/ { BARCODE_DATAMATRIX, -1, { 0, 0, "" }, "A", 2335, 0, 144, 144 }, + /* 5*/ { BARCODE_DATAMATRIX, -1, { 0, 0, "" }, "A", 2336, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 6*/ { BARCODE_DATAMATRIX, -1, { 0, 0, "" }, "\200", 1556, 0, 144, 144 }, // Spec says 1555 but 1556 correct as only single byte count of 0 required + /* 7*/ { BARCODE_DATAMATRIX, -1, { 0, 0, "" }, "\200", 1557, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 8*/ { BARCODE_HIBC_DM, -1, { 0, 0, "" }, "1", 110, 0, 32, 32 }, + /* 9*/ { BARCODE_HIBC_DM, -1, { 0, 0, "" }, "1", 111, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 10*/ { BARCODE_DATAMATRIX, 1, { 0, 0, "" }, "1", 6, 0, 10, 10 }, + /* 11*/ { BARCODE_DATAMATRIX, 1, { 0, 0, "" }, "1", 7, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 12*/ { BARCODE_DATAMATRIX, 1, { 0, 0, "" }, "A", 3, 0, 10, 10 }, + /* 13*/ { BARCODE_DATAMATRIX, 1, { 0, 0, "" }, "A", 4, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 14*/ { BARCODE_DATAMATRIX, 1, { 0, 0, "" }, "\200", 1, 0, 10, 10 }, + /* 15*/ { BARCODE_DATAMATRIX, 1, { 0, 0, "" }, "\200", 2, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 16*/ { BARCODE_DATAMATRIX, 2, { 0, 0, "" }, "1", 10, 0, 12, 12 }, + /* 17*/ { BARCODE_DATAMATRIX, 2, { 0, 0, "" }, "1", 11, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 18*/ { BARCODE_DATAMATRIX, 2, { 0, 0, "" }, "A", 6, 0, 12, 12 }, + /* 19*/ { BARCODE_DATAMATRIX, 2, { 0, 0, "" }, "A", 7, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 20*/ { BARCODE_DATAMATRIX, 2, { 0, 0, "" }, "\200", 3, 0, 12, 12 }, + /* 21*/ { BARCODE_DATAMATRIX, 2, { 0, 0, "" }, "\200", 4, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 22*/ { BARCODE_DATAMATRIX, 3, { 0, 0, "" }, "1", 16, 0, 14, 14 }, + /* 23*/ { BARCODE_DATAMATRIX, 3, { 0, 0, "" }, "1", 17, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 24*/ { BARCODE_DATAMATRIX, 3, { 0, 0, "" }, "A", 10, 0, 14, 14 }, + /* 25*/ { BARCODE_DATAMATRIX, 3, { 0, 0, "" }, "A", 11, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 26*/ { BARCODE_DATAMATRIX, 3, { 0, 0, "" }, "\200", 6, 0, 14, 14 }, + /* 27*/ { BARCODE_DATAMATRIX, 3, { 0, 0, "" }, "\200", 7, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 28*/ { BARCODE_DATAMATRIX, 4, { 0, 0, "" }, "1", 24, 0, 16, 16 }, + /* 29*/ { BARCODE_DATAMATRIX, 4, { 0, 0, "" }, "1", 25, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 30*/ { BARCODE_DATAMATRIX, 4, { 0, 0, "" }, "A", 16, 0, 16, 16 }, + /* 31*/ { BARCODE_DATAMATRIX, 4, { 0, 0, "" }, "A", 17, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 32*/ { BARCODE_DATAMATRIX, 4, { 0, 0, "" }, "\200", 10, 0, 16, 16 }, + /* 33*/ { BARCODE_DATAMATRIX, 4, { 0, 0, "" }, "\200", 11, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 34*/ { BARCODE_DATAMATRIX, 5, { 0, 0, "" }, "1", 36, 0, 18, 18 }, + /* 35*/ { BARCODE_DATAMATRIX, 5, { 0, 0, "" }, "1", 37, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 36*/ { BARCODE_DATAMATRIX, 5, { 0, 0, "" }, "A", 25, 0, 18, 18 }, + /* 37*/ { BARCODE_DATAMATRIX, 5, { 0, 0, "" }, "A", 26, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 38*/ { BARCODE_DATAMATRIX, 5, { 0, 0, "" }, "\200", 16, 0, 18, 18 }, + /* 39*/ { BARCODE_DATAMATRIX, 5, { 0, 0, "" }, "\200", 17, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 40*/ { BARCODE_DATAMATRIX, 6, { 0, 0, "" }, "1", 44, 0, 20, 20 }, + /* 41*/ { BARCODE_DATAMATRIX, 6, { 0, 0, "" }, "1", 45, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 42*/ { BARCODE_DATAMATRIX, 6, { 0, 0, "" }, "A", 31, 0, 20, 20 }, + /* 43*/ { BARCODE_DATAMATRIX, 6, { 0, 0, "" }, "A", 32, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 44*/ { BARCODE_DATAMATRIX, 6, { 0, 0, "" }, "\200", 20, 0, 20, 20 }, + /* 45*/ { BARCODE_DATAMATRIX, 6, { 0, 0, "" }, "\200", 21, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 46*/ { BARCODE_DATAMATRIX, 7, { 0, 0, "" }, "1", 60, 0, 22, 22 }, + /* 47*/ { BARCODE_DATAMATRIX, 7, { 0, 0, "" }, "1", 61, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 48*/ { BARCODE_DATAMATRIX, 7, { 0, 0, "" }, "A", 43, 0, 22, 22 }, + /* 49*/ { BARCODE_DATAMATRIX, 7, { 0, 0, "" }, "A", 44, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 50*/ { BARCODE_DATAMATRIX, 7, { 0, 0, "" }, "\200", 28, 0, 22, 22 }, + /* 51*/ { BARCODE_DATAMATRIX, 7, { 0, 0, "" }, "\200", 29, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 52*/ { BARCODE_DATAMATRIX, 8, { 0, 0, "" }, "1", 72, 0, 24, 24 }, + /* 53*/ { BARCODE_DATAMATRIX, 8, { 0, 0, "" }, "1", 73, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 54*/ { BARCODE_DATAMATRIX, 8, { 0, 0, "" }, "A", 52, 0, 24, 24 }, + /* 55*/ { BARCODE_DATAMATRIX, 8, { 0, 0, "" }, "A", 53, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 56*/ { BARCODE_DATAMATRIX, 8, { 0, 0, "" }, "\200", 34, 0, 24, 24 }, + /* 57*/ { BARCODE_DATAMATRIX, 8, { 0, 0, "" }, "\200", 35, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 58*/ { BARCODE_DATAMATRIX, 9, { 0, 0, "" }, "1", 88, 0, 26, 26 }, + /* 59*/ { BARCODE_DATAMATRIX, 9, { 0, 0, "" }, "1", 89, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 60*/ { BARCODE_DATAMATRIX, 9, { 0, 0, "" }, "A", 64, 0, 26, 26 }, + /* 61*/ { BARCODE_DATAMATRIX, 9, { 0, 0, "" }, "A", 65, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 62*/ { BARCODE_DATAMATRIX, 9, { 0, 0, "" }, "\200", 42, 0, 26, 26 }, + /* 63*/ { BARCODE_DATAMATRIX, 9, { 0, 0, "" }, "\200", 43, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 64*/ { BARCODE_DATAMATRIX, 10, { 0, 0, "" }, "1", 124, 0, 32, 32 }, + /* 65*/ { BARCODE_DATAMATRIX, 10, { 0, 0, "" }, "1", 125, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 66*/ { BARCODE_DATAMATRIX, 10, { 0, 0, "" }, "A", 91, 0, 32, 32 }, + /* 67*/ { BARCODE_DATAMATRIX, 10, { 0, 0, "" }, "A", 92, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 68*/ { BARCODE_DATAMATRIX, 10, { 0, 0, "" }, "\200", 60, 0, 32, 32 }, + /* 69*/ { BARCODE_DATAMATRIX, 10, { 0, 0, "" }, "\200", 61, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 70*/ { BARCODE_DATAMATRIX, 11, { 0, 0, "" }, "1", 172, 0, 36, 36 }, + /* 71*/ { BARCODE_DATAMATRIX, 11, { 0, 0, "" }, "1", 173, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 72*/ { BARCODE_DATAMATRIX, 11, { 0, 0, "" }, "A", 127, 0, 36, 36 }, + /* 73*/ { BARCODE_DATAMATRIX, 11, { 0, 0, "" }, "A", 128, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 74*/ { BARCODE_DATAMATRIX, 11, { 0, 0, "" }, "\200", 84, 0, 36, 36 }, + /* 75*/ { BARCODE_DATAMATRIX, 11, { 0, 0, "" }, "\200", 85, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 76*/ { BARCODE_DATAMATRIX, 12, { 0, 0, "" }, "1", 228, 0, 40, 40 }, + /* 77*/ { BARCODE_DATAMATRIX, 12, { 0, 0, "" }, "1", 229, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 78*/ { BARCODE_DATAMATRIX, 12, { 0, 0, "" }, "A", 169, 0, 40, 40 }, + /* 79*/ { BARCODE_DATAMATRIX, 12, { 0, 0, "" }, "A", 170, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 80*/ { BARCODE_DATAMATRIX, 12, { 0, 0, "" }, "\200", 112, 0, 40, 40 }, + /* 81*/ { BARCODE_DATAMATRIX, 12, { 0, 0, "" }, "\200", 113, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 82*/ { BARCODE_DATAMATRIX, 13, { 0, 0, "" }, "1", 288, 0, 44, 44 }, + /* 83*/ { BARCODE_DATAMATRIX, 13, { 0, 0, "" }, "1", 289, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 84*/ { BARCODE_DATAMATRIX, 13, { 0, 0, "" }, "A", 214, 0, 44, 44 }, + /* 85*/ { BARCODE_DATAMATRIX, 13, { 0, 0, "" }, "A", 215, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 86*/ { BARCODE_DATAMATRIX, 13, { 0, 0, "" }, "\200", 142, 0, 44, 44 }, + /* 87*/ { BARCODE_DATAMATRIX, 13, { 0, 0, "" }, "\200", 143, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 88*/ { BARCODE_DATAMATRIX, 14, { 0, 0, "" }, "1", 348, 0, 48, 48 }, + /* 89*/ { BARCODE_DATAMATRIX, 14, { 0, 0, "" }, "1", 349, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 90*/ { BARCODE_DATAMATRIX, 14, { 0, 0, "" }, "A", 259, 0, 48, 48 }, + /* 91*/ { BARCODE_DATAMATRIX, 14, { 0, 0, "" }, "A", 260, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 92*/ { BARCODE_DATAMATRIX, 14, { 0, 0, "" }, "\200", 172, 0, 48, 48 }, + /* 93*/ { BARCODE_DATAMATRIX, 14, { 0, 0, "" }, "\200", 173, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 94*/ { BARCODE_DATAMATRIX, 15, { 0, 0, "" }, "1", 408, 0, 52, 52 }, + /* 95*/ { BARCODE_DATAMATRIX, 15, { 0, 0, "" }, "1", 409, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 96*/ { BARCODE_DATAMATRIX, 15, { 0, 0, "" }, "A", 304, 0, 52, 52 }, + /* 97*/ { BARCODE_DATAMATRIX, 15, { 0, 0, "" }, "A", 305, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 98*/ { BARCODE_DATAMATRIX, 15, { 0, 0, "" }, "\200", 202, 0, 52, 52 }, + /* 99*/ { BARCODE_DATAMATRIX, 15, { 0, 0, "" }, "\200", 203, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*100*/ { BARCODE_DATAMATRIX, 16, { 0, 0, "" }, "1", 560, 0, 64, 64 }, + /*101*/ { BARCODE_DATAMATRIX, 16, { 0, 0, "" }, "1", 561, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*102*/ { BARCODE_DATAMATRIX, 16, { 0, 0, "" }, "A", 418, 0, 64, 64 }, + /*103*/ { BARCODE_DATAMATRIX, 16, { 0, 0, "" }, "A", 419, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*104*/ { BARCODE_DATAMATRIX, 16, { 0, 0, "" }, "\200", 278, 0, 64, 64 }, // Spec says 277 but 278 correct as only single byte count of 0 required + /*105*/ { BARCODE_DATAMATRIX, 16, { 0, 0, "" }, "\200", 279, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*106*/ { BARCODE_DATAMATRIX, 17, { 0, 0, "" }, "1", 736, 0, 72, 72 }, + /*107*/ { BARCODE_DATAMATRIX, 17, { 0, 0, "" }, "1", 737, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*108*/ { BARCODE_DATAMATRIX, 17, { 0, 0, "" }, "A", 550, 0, 72, 72 }, + /*109*/ { BARCODE_DATAMATRIX, 17, { 0, 0, "" }, "A", 551, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*110*/ { BARCODE_DATAMATRIX, 17, { 0, 0, "" }, "\200", 366, 0, 72, 72 }, // Spec says 365 but 366 correct as only single byte count of 0 required + /*111*/ { BARCODE_DATAMATRIX, 17, { 0, 0, "" }, "\200", 367, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*112*/ { BARCODE_DATAMATRIX, 18, { 0, 0, "" }, "1", 912, 0, 80, 80 }, + /*113*/ { BARCODE_DATAMATRIX, 18, { 0, 0, "" }, "1", 913, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*114*/ { BARCODE_DATAMATRIX, 18, { 0, 0, "" }, "A", 682, 0, 80, 80 }, + /*115*/ { BARCODE_DATAMATRIX, 18, { 0, 0, "" }, "A", 683, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*116*/ { BARCODE_DATAMATRIX, 18, { 0, 0, "" }, "\200", 454, 0, 80, 80 }, // Spec says 453 but 454 correct as only single byte count of 0 required + /*117*/ { BARCODE_DATAMATRIX, 18, { 0, 0, "" }, "\200", 455, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*118*/ { BARCODE_DATAMATRIX, 19, { 0, 0, "" }, "1", 1152, 0, 88, 88 }, + /*119*/ { BARCODE_DATAMATRIX, 19, { 0, 0, "" }, "1", 1153, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*120*/ { BARCODE_DATAMATRIX, 19, { 0, 0, "" }, "A", 862, 0, 88, 88 }, + /*121*/ { BARCODE_DATAMATRIX, 19, { 0, 0, "" }, "A", 863, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*122*/ { BARCODE_DATAMATRIX, 19, { 0, 0, "" }, "\200", 574, 0, 88, 88 }, // Spec says 573 but 574 correct as only single byte count of 0 required + /*123*/ { BARCODE_DATAMATRIX, 19, { 0, 0, "" }, "\200", 575, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*124*/ { BARCODE_DATAMATRIX, 20, { 0, 0, "" }, "1", 1392, 0, 96, 96 }, + /*125*/ { BARCODE_DATAMATRIX, 20, { 0, 0, "" }, "1", 1393, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*126*/ { BARCODE_DATAMATRIX, 20, { 0, 0, "" }, "A", 1042, 0, 96, 96 }, + /*127*/ { BARCODE_DATAMATRIX, 20, { 0, 0, "" }, "A", 1043, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*128*/ { BARCODE_DATAMATRIX, 20, { 0, 0, "" }, "\200", 694, 0, 96, 96 }, // Spec says 693 but 694 correct as only single byte count of 0 required + /*129*/ { BARCODE_DATAMATRIX, 20, { 0, 0, "" }, "\200", 695, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*130*/ { BARCODE_DATAMATRIX, 21, { 0, 0, "" }, "1", 1632, 0, 104, 104 }, + /*131*/ { BARCODE_DATAMATRIX, 21, { 0, 0, "" }, "1", 1633, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*132*/ { BARCODE_DATAMATRIX, 21, { 0, 0, "" }, "A", 1222, 0, 104, 104 }, + /*133*/ { BARCODE_DATAMATRIX, 21, { 0, 0, "" }, "A", 1223, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*134*/ { BARCODE_DATAMATRIX, 21, { 0, 0, "" }, "\200", 814, 0, 104, 104 }, // Spec says 813 but 814 correct as only single byte count of 0 required + /*135*/ { BARCODE_DATAMATRIX, 21, { 0, 0, "" }, "\200", 815, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*136*/ { BARCODE_DATAMATRIX, 22, { 0, 0, "" }, "1", 2100, 0, 120, 120 }, + /*137*/ { BARCODE_DATAMATRIX, 22, { 0, 0, "" }, "1", 2101, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*138*/ { BARCODE_DATAMATRIX, 22, { 0, 0, "" }, "A", 1573, 0, 120, 120 }, + /*139*/ { BARCODE_DATAMATRIX, 22, { 0, 0, "" }, "A", 1574, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*140*/ { BARCODE_DATAMATRIX, 22, { 0, 0, "" }, "\200", 1048, 0, 120, 120 }, // Spec says 1047 but 1048 correct as only single byte count of 0 required + /*141*/ { BARCODE_DATAMATRIX, 22, { 0, 0, "" }, "\200", 1049, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*142*/ { BARCODE_DATAMATRIX, 23, { 0, 0, "" }, "1", 2608, 0, 132, 132 }, + /*143*/ { BARCODE_DATAMATRIX, 23, { 0, 0, "" }, "1", 2609, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*144*/ { BARCODE_DATAMATRIX, 23, { 0, 0, "" }, "A", 1954, 0, 132, 132 }, + /*145*/ { BARCODE_DATAMATRIX, 23, { 0, 0, "" }, "A", 1955, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*146*/ { BARCODE_DATAMATRIX, 23, { 0, 0, "" }, "\200", 1302, 0, 132, 132 }, // Spec says 1301 but 1302 correct as only single byte count of 0 required + /*147*/ { BARCODE_DATAMATRIX, 23, { 0, 0, "" }, "\200", 1303, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*148*/ { BARCODE_DATAMATRIX, 24, { 0, 0, "" }, "1", 3116, 0, 144, 144 }, + /*149*/ { BARCODE_DATAMATRIX, 24, { 0, 0, "" }, "1", 3117, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*150*/ { BARCODE_DATAMATRIX, 24, { 0, 0, "" }, "A", 2335, 0, 144, 144 }, + /*151*/ { BARCODE_DATAMATRIX, 24, { 0, 0, "" }, "A", 2336, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*152*/ { BARCODE_DATAMATRIX, 24, { 0, 0, "" }, "\200", 1556, 0, 144, 144 }, // Spec says 1555 but 1556 correct as only single byte count of 0 required + /*153*/ { BARCODE_DATAMATRIX, 24, { 0, 0, "" }, "\200", 1557, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*154*/ { BARCODE_DATAMATRIX, 25, { 0, 0, "" }, "1", 10, 0, 8, 18 }, + /*155*/ { BARCODE_DATAMATRIX, 25, { 0, 0, "" }, "1", 11, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*156*/ { BARCODE_DATAMATRIX, 25, { 0, 0, "" }, "A", 6, 0, 8, 18 }, + /*157*/ { BARCODE_DATAMATRIX, 25, { 0, 0, "" }, "A", 7, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*158*/ { BARCODE_DATAMATRIX, 25, { 0, 0, "" }, "\200", 3, 0, 8, 18 }, + /*159*/ { BARCODE_DATAMATRIX, 25, { 0, 0, "" }, "\200", 4, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*160*/ { BARCODE_DATAMATRIX, 26, { 0, 0, "" }, "1", 20, 0, 8, 32 }, + /*161*/ { BARCODE_DATAMATRIX, 26, { 0, 0, "" }, "1", 21, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*162*/ { BARCODE_DATAMATRIX, 26, { 0, 0, "" }, "A", 13, 0, 8, 32 }, + /*163*/ { BARCODE_DATAMATRIX, 26, { 0, 0, "" }, "A", 14, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*164*/ { BARCODE_DATAMATRIX, 26, { 0, 0, "" }, "\200", 8, 0, 8, 32 }, + /*165*/ { BARCODE_DATAMATRIX, 26, { 0, 0, "" }, "\200", 9, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*166*/ { BARCODE_DATAMATRIX, 27, { 0, 0, "" }, "1", 32, 0, 12, 26 }, + /*167*/ { BARCODE_DATAMATRIX, 27, { 0, 0, "" }, "1", 33, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*168*/ { BARCODE_DATAMATRIX, 27, { 0, 0, "" }, "A", 22, 0, 12, 26 }, + /*169*/ { BARCODE_DATAMATRIX, 27, { 0, 0, "" }, "A", 23, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*170*/ { BARCODE_DATAMATRIX, 27, { 0, 0, "" }, "\200", 14, 0, 12, 26 }, + /*171*/ { BARCODE_DATAMATRIX, 27, { 0, 0, "" }, "\200", 15, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*172*/ { BARCODE_DATAMATRIX, 28, { 0, 0, "" }, "1", 44, 0, 12, 36 }, + /*173*/ { BARCODE_DATAMATRIX, 28, { 0, 0, "" }, "1", 45, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*174*/ { BARCODE_DATAMATRIX, 28, { 0, 0, "" }, "A", 31, 0, 12, 36 }, + /*175*/ { BARCODE_DATAMATRIX, 28, { 0, 0, "" }, "A", 32, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*176*/ { BARCODE_DATAMATRIX, 28, { 0, 0, "" }, "\200", 20, 0, 12, 36 }, + /*177*/ { BARCODE_DATAMATRIX, 28, { 0, 0, "" }, "\200", 21, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*178*/ { BARCODE_DATAMATRIX, 29, { 0, 0, "" }, "1", 64, 0, 16, 36 }, + /*179*/ { BARCODE_DATAMATRIX, 29, { 0, 0, "" }, "1", 65, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*180*/ { BARCODE_DATAMATRIX, 29, { 0, 0, "" }, "A", 46, 0, 16, 36 }, + /*181*/ { BARCODE_DATAMATRIX, 29, { 0, 0, "" }, "A", 47, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*182*/ { BARCODE_DATAMATRIX, 29, { 0, 0, "" }, "\200", 30, 0, 16, 36 }, + /*183*/ { BARCODE_DATAMATRIX, 29, { 0, 0, "" }, "\200", 31, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*184*/ { BARCODE_DATAMATRIX, 30, { 0, 0, "" }, "1", 98, 0, 16, 48 }, + /*185*/ { BARCODE_DATAMATRIX, 30, { 0, 0, "" }, "1", 99, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*186*/ { BARCODE_DATAMATRIX, 30, { 0, 0, "" }, "A", 72, 0, 16, 48 }, + /*187*/ { BARCODE_DATAMATRIX, 30, { 0, 0, "" }, "A", 73, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*188*/ { BARCODE_DATAMATRIX, 30, { 0, 0, "" }, "\200", 47, 0, 16, 48 }, + /*189*/ { BARCODE_DATAMATRIX, 30, { 0, 0, "" }, "\200", 48, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*190*/ { BARCODE_DATAMATRIX, 31, { 0, 0, "" }, "1", 36, 0, 8, 48 }, + /*191*/ { BARCODE_DATAMATRIX, 31, { 0, 0, "" }, "1", 37, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*192*/ { BARCODE_DATAMATRIX, 31, { 0, 0, "" }, "A", 25, 0, 8, 48 }, + /*193*/ { BARCODE_DATAMATRIX, 31, { 0, 0, "" }, "A", 26, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*194*/ { BARCODE_DATAMATRIX, 31, { 0, 0, "" }, "\200", 16, 0, 8, 48 }, + /*195*/ { BARCODE_DATAMATRIX, 31, { 0, 0, "" }, "\200", 17, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*196*/ { BARCODE_DATAMATRIX, 32, { 0, 0, "" }, "1", 48, 0, 8, 64 }, + /*197*/ { BARCODE_DATAMATRIX, 32, { 0, 0, "" }, "1", 49, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*198*/ { BARCODE_DATAMATRIX, 32, { 0, 0, "" }, "A", 34, 0, 8, 64 }, + /*199*/ { BARCODE_DATAMATRIX, 32, { 0, 0, "" }, "A", 35, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*200*/ { BARCODE_DATAMATRIX, 32, { 0, 0, "" }, "\200", 22, 0, 8, 64 }, + /*201*/ { BARCODE_DATAMATRIX, 32, { 0, 0, "" }, "\200", 23, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*202*/ { BARCODE_DATAMATRIX, 33, { 0, 0, "" }, "1", 64, 0, 8, 80 }, + /*203*/ { BARCODE_DATAMATRIX, 33, { 0, 0, "" }, "1", 65, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*204*/ { BARCODE_DATAMATRIX, 33, { 0, 0, "" }, "A", 46, 0, 8, 80 }, + /*205*/ { BARCODE_DATAMATRIX, 33, { 0, 0, "" }, "A", 47, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*206*/ { BARCODE_DATAMATRIX, 33, { 0, 0, "" }, "\200", 30, 0, 8, 80 }, + /*207*/ { BARCODE_DATAMATRIX, 33, { 0, 0, "" }, "\200", 31, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*208*/ { BARCODE_DATAMATRIX, 34, { 0, 0, "" }, "1", 76, 0, 8, 96 }, + /*209*/ { BARCODE_DATAMATRIX, 34, { 0, 0, "" }, "1", 77, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*210*/ { BARCODE_DATAMATRIX, 34, { 0, 0, "" }, "A", 55, 0, 8, 96 }, + /*211*/ { BARCODE_DATAMATRIX, 34, { 0, 0, "" }, "A", 56, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*212*/ { BARCODE_DATAMATRIX, 34, { 0, 0, "" }, "\200", 36, 0, 8, 96 }, + /*213*/ { BARCODE_DATAMATRIX, 34, { 0, 0, "" }, "\200", 37, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*214*/ { BARCODE_DATAMATRIX, 35, { 0, 0, "" }, "1", 98, 0, 8, 120 }, + /*215*/ { BARCODE_DATAMATRIX, 35, { 0, 0, "" }, "1", 99, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*216*/ { BARCODE_DATAMATRIX, 35, { 0, 0, "" }, "A", 72, 0, 8, 120 }, + /*217*/ { BARCODE_DATAMATRIX, 35, { 0, 0, "" }, "A", 73, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*218*/ { BARCODE_DATAMATRIX, 35, { 0, 0, "" }, "\200", 47, 0, 8, 120 }, + /*219*/ { BARCODE_DATAMATRIX, 35, { 0, 0, "" }, "\200", 48, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*220*/ { BARCODE_DATAMATRIX, 36, { 0, 0, "" }, "1", 126, 0, 8, 144 }, + /*221*/ { BARCODE_DATAMATRIX, 36, { 0, 0, "" }, "1", 127, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*222*/ { BARCODE_DATAMATRIX, 36, { 0, 0, "" }, "A", 93, 0, 8, 144 }, + /*223*/ { BARCODE_DATAMATRIX, 36, { 0, 0, "" }, "A", 94, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*224*/ { BARCODE_DATAMATRIX, 36, { 0, 0, "" }, "\200", 61, 0, 8, 144 }, + /*225*/ { BARCODE_DATAMATRIX, 36, { 0, 0, "" }, "\200", 62, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*226*/ { BARCODE_DATAMATRIX, 37, { 0, 0, "" }, "1", 86, 0, 12, 64 }, + /*227*/ { BARCODE_DATAMATRIX, 37, { 0, 0, "" }, "1", 87, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*228*/ { BARCODE_DATAMATRIX, 37, { 0, 0, "" }, "A", 63, 0, 12, 64 }, + /*229*/ { BARCODE_DATAMATRIX, 37, { 0, 0, "" }, "A", 64, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*230*/ { BARCODE_DATAMATRIX, 37, { 0, 0, "" }, "\200", 41, 0, 12, 64 }, + /*231*/ { BARCODE_DATAMATRIX, 37, { 0, 0, "" }, "\200", 42, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*232*/ { BARCODE_DATAMATRIX, 38, { 0, 0, "" }, "1", 128, 0, 12, 88 }, + /*233*/ { BARCODE_DATAMATRIX, 38, { 0, 0, "" }, "1", 129, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*234*/ { BARCODE_DATAMATRIX, 38, { 0, 0, "" }, "A", 94, 0, 12, 88 }, + /*235*/ { BARCODE_DATAMATRIX, 38, { 0, 0, "" }, "A", 95, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*236*/ { BARCODE_DATAMATRIX, 38, { 0, 0, "" }, "\200", 62, 0, 12, 88 }, + /*237*/ { BARCODE_DATAMATRIX, 38, { 0, 0, "" }, "\200", 63, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*238*/ { BARCODE_DATAMATRIX, 39, { 0, 0, "" }, "1", 124, 0, 16, 64 }, + /*239*/ { BARCODE_DATAMATRIX, 39, { 0, 0, "" }, "1", 125, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*240*/ { BARCODE_DATAMATRIX, 39, { 0, 0, "" }, "A", 91, 0, 16, 64 }, + /*241*/ { BARCODE_DATAMATRIX, 39, { 0, 0, "" }, "A", 92, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*242*/ { BARCODE_DATAMATRIX, 39, { 0, 0, "" }, "\200", 60, 0, 16, 64 }, + /*243*/ { BARCODE_DATAMATRIX, 39, { 0, 0, "" }, "\200", 61, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*244*/ { BARCODE_DATAMATRIX, 40, { 0, 0, "" }, "1", 88, 0, 20, 36 }, + /*245*/ { BARCODE_DATAMATRIX, 40, { 0, 0, "" }, "1", 89, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*246*/ { BARCODE_DATAMATRIX, 40, { 0, 0, "" }, "A", 64, 0, 20, 36 }, + /*247*/ { BARCODE_DATAMATRIX, 40, { 0, 0, "" }, "A", 65, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*248*/ { BARCODE_DATAMATRIX, 40, { 0, 0, "" }, "\200", 42, 0, 20, 36 }, + /*249*/ { BARCODE_DATAMATRIX, 40, { 0, 0, "" }, "\200", 43, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*250*/ { BARCODE_DATAMATRIX, 41, { 0, 0, "" }, "1", 112, 0, 20, 44 }, + /*251*/ { BARCODE_DATAMATRIX, 41, { 0, 0, "" }, "1", 113, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*252*/ { BARCODE_DATAMATRIX, 41, { 0, 0, "" }, "A", 82, 0, 20, 44 }, + /*253*/ { BARCODE_DATAMATRIX, 41, { 0, 0, "" }, "A", 83, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*254*/ { BARCODE_DATAMATRIX, 41, { 0, 0, "" }, "\200", 54, 0, 20, 44 }, + /*255*/ { BARCODE_DATAMATRIX, 41, { 0, 0, "" }, "\200", 55, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*256*/ { BARCODE_DATAMATRIX, 42, { 0, 0, "" }, "1", 168, 0, 20, 64 }, // Spec says 186 but typo + /*257*/ { BARCODE_DATAMATRIX, 42, { 0, 0, "" }, "1", 169, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*258*/ { BARCODE_DATAMATRIX, 42, { 0, 0, "" }, "A", 124, 0, 20, 64 }, + /*259*/ { BARCODE_DATAMATRIX, 42, { 0, 0, "" }, "A", 125, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*260*/ { BARCODE_DATAMATRIX, 42, { 0, 0, "" }, "\200", 82, 0, 20, 64 }, + /*261*/ { BARCODE_DATAMATRIX, 42, { 0, 0, "" }, "\200", 83, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*262*/ { BARCODE_DATAMATRIX, 43, { 0, 0, "" }, "1", 144, 0, 22, 48 }, + /*263*/ { BARCODE_DATAMATRIX, 43, { 0, 0, "" }, "1", 145, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*264*/ { BARCODE_DATAMATRIX, 43, { 0, 0, "" }, "A", 106, 0, 22, 48 }, + /*265*/ { BARCODE_DATAMATRIX, 43, { 0, 0, "" }, "A", 107, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*266*/ { BARCODE_DATAMATRIX, 43, { 0, 0, "" }, "\200", 70, 0, 22, 48 }, + /*267*/ { BARCODE_DATAMATRIX, 43, { 0, 0, "" }, "\200", 71, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*268*/ { BARCODE_DATAMATRIX, 44, { 0, 0, "" }, "1", 160, 0, 24, 48 }, + /*269*/ { BARCODE_DATAMATRIX, 44, { 0, 0, "" }, "1", 161, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*270*/ { BARCODE_DATAMATRIX, 44, { 0, 0, "" }, "A", 118, 0, 24, 48 }, + /*271*/ { BARCODE_DATAMATRIX, 44, { 0, 0, "" }, "A", 119, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*272*/ { BARCODE_DATAMATRIX, 44, { 0, 0, "" }, "\200", 78, 0, 24, 48 }, + /*273*/ { BARCODE_DATAMATRIX, 44, { 0, 0, "" }, "\200", 79, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*274*/ { BARCODE_DATAMATRIX, 45, { 0, 0, "" }, "1", 216, 0, 24, 64 }, + /*275*/ { BARCODE_DATAMATRIX, 45, { 0, 0, "" }, "1", 217, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*276*/ { BARCODE_DATAMATRIX, 45, { 0, 0, "" }, "A", 160, 0, 24, 64 }, + /*277*/ { BARCODE_DATAMATRIX, 45, { 0, 0, "" }, "A", 161, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*278*/ { BARCODE_DATAMATRIX, 45, { 0, 0, "" }, "\200", 106, 0, 24, 64 }, + /*279*/ { BARCODE_DATAMATRIX, 45, { 0, 0, "" }, "\200", 107, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*280*/ { BARCODE_DATAMATRIX, 46, { 0, 0, "" }, "1", 140, 0, 26, 40 }, + /*281*/ { BARCODE_DATAMATRIX, 46, { 0, 0, "" }, "1", 141, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*282*/ { BARCODE_DATAMATRIX, 46, { 0, 0, "" }, "A", 103, 0, 26, 40 }, + /*283*/ { BARCODE_DATAMATRIX, 46, { 0, 0, "" }, "A", 104, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*284*/ { BARCODE_DATAMATRIX, 46, { 0, 0, "" }, "\200", 68, 0, 26, 40 }, + /*285*/ { BARCODE_DATAMATRIX, 46, { 0, 0, "" }, "\200", 69, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*286*/ { BARCODE_DATAMATRIX, 47, { 0, 0, "" }, "1", 180, 0, 26, 48 }, + /*287*/ { BARCODE_DATAMATRIX, 47, { 0, 0, "" }, "1", 181, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*288*/ { BARCODE_DATAMATRIX, 47, { 0, 0, "" }, "A", 133, 0, 26, 48 }, + /*289*/ { BARCODE_DATAMATRIX, 47, { 0, 0, "" }, "A", 134, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*290*/ { BARCODE_DATAMATRIX, 47, { 0, 0, "" }, "\200", 88, 0, 26, 48 }, + /*291*/ { BARCODE_DATAMATRIX, 47, { 0, 0, "" }, "\200", 89, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*292*/ { BARCODE_DATAMATRIX, 48, { 0, 0, "" }, "1", 236, 0, 26, 64 }, + /*293*/ { BARCODE_DATAMATRIX, 48, { 0, 0, "" }, "1", 237, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*294*/ { BARCODE_DATAMATRIX, 48, { 0, 0, "" }, "A", 175, 0, 26, 64 }, + /*295*/ { BARCODE_DATAMATRIX, 48, { 0, 0, "" }, "A", 176, ZINT_ERROR_TOO_LONG, -1, -1 }, + /*296*/ { BARCODE_DATAMATRIX, 48, { 0, 0, "" }, "\200", 116, 0, 26, 64 }, + /*297*/ { BARCODE_DATAMATRIX, 48, { 0, 0, "" }, "\200", 117, ZINT_ERROR_TOO_LONG, -1, -1 }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -361,6 +364,9 @@ static void test_large(int index, int debug) { assert_equal(data[i].length, (int) strlen(data_buf), "i:%d length %d != strlen(data_buf) %d\n", i, data[i].length, (int) strlen(data_buf)); length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data_buf, data[i].length, debug); + if (data[i].structapp.count) { + symbol->structapp = data[i].structapp; + } ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); @@ -424,27 +430,47 @@ static void test_options(int index, int debug) { int option_1; int option_2; int option_3; + int output_options; + struct zint_structapp structapp; char *data; int ret; int expected_rows; int expected_width; + const char *expected_errtxt; }; // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) struct item data[] = { - /* 0*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, "1", 0, 10, 10 }, - /* 1*/ { BARCODE_DATAMATRIX, -1, 2, -1, -1, "1", ZINT_ERROR_INVALID_OPTION, -1, -1 }, - /* 2*/ { BARCODE_DATAMATRIX, -1, -1, 1, -1, "1", 0, 10, 10 }, - /* 3*/ { BARCODE_DATAMATRIX, -1, -1, 2, -1, "1", 0, 12, 12 }, - /* 4*/ { BARCODE_DATAMATRIX, -1, -1, 48, -1, "1", 0, 26, 64 }, - /* 5*/ { BARCODE_DATAMATRIX, -1, -1, 49, -1, "1", 0, 10, 10 }, // Ignored - /* 6*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, "ABCDEFGHIJK", 0, 8, 32 }, - /* 7*/ { BARCODE_DATAMATRIX, -1, -1, -1, DM_SQUARE, "ABCDEFGHIJK", 0, 16, 16 }, - /* 8*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTU", 0, 32, 32 }, - /* 9*/ { BARCODE_DATAMATRIX, -1, -1, -1, DM_DMRE, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTU", 0, 20, 44 }, - /* 10*/ { BARCODE_DATAMATRIX, -1, -1, -1, 9999, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTU", 0, 32, 32 }, // Ignored - /* 11*/ { BARCODE_DATAMATRIX, GS1_MODE, -1, -1, -1, "[90]12", 0, 10, 10 }, - /* 12*/ { BARCODE_DATAMATRIX, GS1_MODE | GS1PARENS_MODE, -1, -1, -1, "(90)12", 0, 10, 10 }, + /* 0*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 0, 0, "" }, "1", 0, 10, 10, "" }, + /* 1*/ { BARCODE_DATAMATRIX, -1, 2, -1, -1, -1, { 0, 0, "" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 524: Older Data Matrix standards are no longer supported" }, + /* 2*/ { BARCODE_DATAMATRIX, -1, -1, 1, -1, -1, { 0, 0, "" }, "1", 0, 10, 10, "" }, + /* 3*/ { BARCODE_DATAMATRIX, -1, -1, 2, -1, -1, { 0, 0, "" }, "1", 0, 12, 12, "" }, + /* 4*/ { BARCODE_DATAMATRIX, -1, -1, 48, -1, -1, { 0, 0, "" }, "1", 0, 26, 64, "" }, + /* 5*/ { BARCODE_DATAMATRIX, -1, -1, 49, -1, -1, { 0, 0, "" }, "1", 0, 10, 10, "" }, // Ignored + /* 6*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 0, 0, "" }, "ABCDEFGHIJK", 0, 8, 32, "" }, + /* 7*/ { BARCODE_DATAMATRIX, -1, -1, -1, DM_SQUARE, -1, { 0, 0, "" }, "ABCDEFGHIJK", 0, 16, 16, "" }, + /* 8*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTU", 0, 32, 32, "" }, + /* 9*/ { BARCODE_DATAMATRIX, -1, -1, -1, DM_DMRE, -1, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTU", 0, 20, 44, "" }, + /* 10*/ { BARCODE_DATAMATRIX, -1, -1, -1, 9999, -1, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTU", 0, 32, 32, "" }, // Ignored + /* 11*/ { BARCODE_DATAMATRIX, GS1_MODE, -1, -1, -1, -1, { 0, 0, "" }, "[90]12", 0, 10, 10, "" }, + /* 12*/ { BARCODE_DATAMATRIX, GS1_MODE | GS1PARENS_MODE, -1, -1, -1, -1, { 0, 0, "" }, "(90)12", 0, 10, 10, "" }, + /* 13*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 1, 2, "" }, "1", 0, 12, 12, "" }, + /* 14*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 16, 16, "" }, "1", 0, 12, 12, "" }, + /* 15*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 1, 1, "" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 720: Structured Append count out of range (2-16)" }, + /* 16*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 1, 17, "" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 720: Structured Append count out of range (2-16)" }, + /* 17*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 0, 16, "" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 721: Structured Append index out of range (1-16)" }, + /* 18*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 17, 16, "" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 721: Structured Append index out of range (1-16)" }, + /* 19*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "1001" }, "1", 0, 12, 12, "" }, + /* 20*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "A" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 723: Invalid Structured Append ID (digits only)" }, + /* 21*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "0" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 724: Structured Append ID1 '000' and ID2 '000' out of range (001-254) (ID '000000')" }, + /* 22*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "1" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 725: Structured Append ID1 '000' out of range (001-254) (ID '000001')" }, + /* 23*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "1000" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 726: Structured Append ID2 '000' out of range (001-254) (ID '001000')" }, + /* 24*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "001255" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 726: Structured Append ID2 '255' out of range (001-254) (ID '001255')" }, + /* 25*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "255001" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 725: Structured Append ID1 '255' out of range (001-254) (ID '255001')" }, + /* 26*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "255255" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 724: Structured Append ID1 '255' and ID2 '255' out of range (001-254) (ID '255255')" }, + /* 27*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "1234567" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 722: Structured Append ID too long (6 digit maximum)" }, + /* 28*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, READER_INIT, { 2, 3, "1001" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 727: Cannot have Structured Append and Reader Initialisation at the same time" }, + /* 29*/ { BARCODE_DATAMATRIX, ESCAPE_MODE, -1, -1, -1, -1, { 2, 3, "1001" }, "[)>\\R05\\GA\\R\\E", 0, 12, 26, "" }, // Macro05/06 ignored if have Structured Append TODO: error/warning }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -459,7 +485,10 @@ static void test_options(int index, int debug) { symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); - length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, data[i].option_3, -1 /*output_options*/, data[i].data, -1, debug); + length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, data[i].option_3, data[i].output_options, data[i].data, -1, debug); + if (data[i].structapp.count) { + symbol->structapp = data[i].structapp; + } 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); @@ -468,6 +497,7 @@ static void test_options(int index, int debug) { assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, symbol->errtxt); assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, symbol->errtxt); } + assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d symbol->errtxt %s != %s\n", i, symbol->errtxt, data[i].expected_errtxt); ZBarcode_Delete(symbol); } diff --git a/backend/tests/test_dotcode.c b/backend/tests/test_dotcode.c index 82b6072c..4ccd4aca 100644 --- a/backend/tests/test_dotcode.c +++ b/backend/tests/test_dotcode.c @@ -83,25 +83,33 @@ static void test_options(int index, int debug) { int output_options; int option_2; int option_3; + struct zint_structapp structapp; char *data; int ret; int expected_rows; int expected_width; + const char *expected_errtxt; }; // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) struct item data[] = { - /* 0*/ { -1, -1, -1, -1, "1", 0, 9, 14 }, - /* 1*/ { -1, -1, -1, -1, "1234567890", 0, 12, 19 }, - /* 2*/ { -1, -1, 19, -1, "1234567890", 0, 12, 19 }, - /* 3*/ { -1, -1, 12, -1, "1234567890", 0, 19, 12 }, - /* 4*/ { -1, -1, 5, -1, "1234567890", 0, 44, 5 }, - /* 5*/ { -1, -1, 4, -1, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1 }, // Cols < 5 - /* 6*/ { -1, -1, 200, -1, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1 }, // Not enough data - height 3 too small - /* 7*/ { -1, -1, 200, -1, "1234567890123456789012345678901234567890", 0, 5, 200 }, // Cols 200 max - /* 8*/ { -1, -1, 200, -1, "12345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, 7, 200 }, - /* 9*/ { -1, -1, 201, -1, "12345678901234567890123456789012345678901234567890123456789012345678901234567890", ZINT_ERROR_INVALID_OPTION, -1, -1 }, - /* 10*/ { -1, -1, -1, 10 << 8, "1", 0, 9, 14 }, // Mask > 8 + 1 ignored + /* 0*/ { -1, -1, -1, -1, { 0, 0, "" }, "1", 0, 9, 14, "" }, + /* 1*/ { -1, -1, -1, -1, { 0, 0, "" }, "1234567890", 0, 12, 19, "" }, + /* 2*/ { -1, -1, 19, -1, { 0, 0, "" }, "1234567890", 0, 12, 19, "" }, + /* 3*/ { -1, -1, 12, -1, { 0, 0, "" }, "1234567890", 0, 19, 12, "" }, + /* 4*/ { -1, -1, 5, -1, { 0, 0, "" }, "1234567890", 0, 44, 5, "" }, + /* 5*/ { -1, -1, 4, -1, { 0, 0, "" }, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 529: Symbol width 4 is too small" }, // Cols < 5 + /* 6*/ { -1, -1, 200, -1, { 0, 0, "" }, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 529: Symbol height 3 is too small" }, // Not enough data - height 3 too small + /* 7*/ { -1, -1, 200, -1, { 0, 0, "" }, "1234567890123456789012345678901234567890", 0, 5, 200, "" }, // Cols 200 max + /* 8*/ { -1, -1, 200, -1, { 0, 0, "" }, "12345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, 7, 200, "" }, + /* 9*/ { -1, -1, 201, -1, { 0, 0, "" }, "12345678901234567890123456789012345678901234567890123456789012345678901234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 528: Symbol width 201 is too large" }, + /* 10*/ { -1, -1, -1, 10 << 8, { 0, 0, "" }, "1", 0, 9, 14, "" }, // Mask > 8 + 1 ignored + /* 11*/ { -1, -1, 19, -1, { 0, 0, "" }, "ABCDE", 0, 12, 19, "" }, + /* 12*/ { -1, -1, 19, -1, { 35, 35, "" }, "ABCDE", 0, 16, 19, "" }, + /* 13*/ { -1, -1, 19, -1, { 1, 1, "" }, "ABCDE", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 730: Structured Append count out of range (2-35)" }, + /* 14*/ { -1, -1, 19, -1, { 1, 36, "" }, "ABCDE", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 730: Structured Append count out of range (2-35)" }, + /* 15*/ { -1, -1, 19, -1, { 3, 2, "" }, "ABCDE", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 731: Structured Append index out of range (1-2)" }, + /* 16*/ { -1, -1, 19, -1, { 1, 2, "1" }, "ABCDE", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 732: Structured Append ID not available for DotCode" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -117,6 +125,9 @@ static void test_options(int index, int debug) { assert_nonnull(symbol, "Symbol not created\n"); length = testUtilSetSymbol(symbol, BARCODE_DOTCODE, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, data[i].option_3, data[i].output_options, data[i].data, -1, debug); + if (data[i].structapp.count) { + symbol->structapp = data[i].structapp; + } 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); @@ -125,6 +136,7 @@ static void test_options(int index, int debug) { assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, symbol->errtxt); assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, symbol->errtxt); } + assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); ZBarcode_Delete(symbol); } @@ -137,6 +149,7 @@ static void test_input(int index, int generate, int debug) { struct item { int input_mode; int eci; + struct zint_structapp structapp; char *data; int length; int ret; @@ -144,44 +157,48 @@ static void test_input(int index, int generate, int debug) { char *comment; }; struct item data[] = { - /* 0*/ { UNICODE_MODE, -1, "A", -1, 0, "66 21", "" }, - /* 1*/ { UNICODE_MODE, 3, "A", -1, 0, "6C 03 66 21", "" }, - /* 2*/ { UNICODE_MODE, 40, "A", -1, 0, "6C 28 00 00 66 21", "" }, - /* 3*/ { UNICODE_MODE, 113, "A", -1, 0, "6C 28 00 49 66 21", "" }, - /* 4*/ { UNICODE_MODE, 899, "A", -1, 0, "6C 28 07 44 66 21", "" }, - /* 5*/ { UNICODE_MODE, 12769, "A", -1, 0, "6C 28 70 49 66 21", "" }, - /* 6*/ { UNICODE_MODE, 811799, "A", -1, 0, "6C 67 40 50 66 21", "" }, - /* 7*/ { UNICODE_MODE, 811800, "A", -1, ZINT_ERROR_INVALID_OPTION, "", "" }, - /* 8*/ { UNICODE_MODE, -1, "\000", 1, 0, "65 40", "LatchA (0x65) NUL" }, - /* 9*/ { UNICODE_MODE, -1, "\010", -1, 0, "65 48", "LatchA (0x65) BS" }, - /* 10*/ { UNICODE_MODE, -1, "\011", -1, 0, "65 49", "Lead special; LatchA (0x65) HT" }, - /* 11*/ { UNICODE_MODE, -1, "\034", -1, 0, "65 5C", "Lead special; LatchA (0x65) FS" }, - /* 12*/ { UNICODE_MODE, -1, "\035", -1, 0, "65 5D", "Lead special; LatchA (0x65) GS" }, - /* 13*/ { UNICODE_MODE, -1, "\036", -1, 0, "65 5E", "Lead special; LatchA (0x65) RS" }, - /* 14*/ { UNICODE_MODE, -1, "\037", -1, 0, "65 5F", "LatchA (0x65) US" }, - /* 15*/ { UNICODE_MODE, -1, "\177", -1, 0, "66 5F", "ShiftB (0x66) DEL" }, - /* 16*/ { UNICODE_MODE, -1, "[)>\03605\035A\036\004", -1, 0, "6A 61 21", "[)>RS 05 GS A RS EOT; LatchB (0x6A) Macro97 (0x61) A" }, - /* 17*/ { UNICODE_MODE, -1, "[)>\03606\035\011\034\035\036\036\004", -1, 0, "6A 62 61 62 63 64", "[)>RS 06 GS HT FS GS RS RS EOT; LatchB (0x6A) Macro98 (0x62) HT FS GS RS" }, - /* 18*/ { UNICODE_MODE, -1, "[)>\03612\03512345\036\004", -1, 0, "6A 63 11 67 17 2D", "[)>RS 12 GS A RS EOT; LatchB (0x6A) Macro99 (0x63) 1 2xShiftC (0x67) 23 45" }, - /* 19*/ { UNICODE_MODE, -1, "[)>\03601Blah\004", -1, 0, "6A 64 10 11 22 4C 41 48", "[)>RS 01 Blah EOT; LatchB (0x6A) Macro100 (0x64) 0 1 B l a h" }, - /* 20*/ { UNICODE_MODE, -1, "[)>\03605\035A\004", -1, 0, "6A 64 10 15 63 21", "[)>RS 05 GS A EOT; LatchB (0x6A) Macro100 (0x64) 0 5 HT A" }, - /* 21*/ { UNICODE_MODE, -1, "[)>\03606A\004", -1, 0, "6A 64 10 16 21", "[)>RS 06 A EOT; LatchB (0x6A) Macro100 (0x64) 0 6 A" }, - /* 22*/ { UNICODE_MODE, -1, "[)>\036991\036\004", -1, 0, "6A 64 19 19 11 64", "[)>RS 99 1 RS EOT; LatchB (0x6A) Macro100 (0x64) 9 9 1 RS" }, - /* 23*/ { UNICODE_MODE, -1, "1712345610", -1, 0, "6B 64 0C 22 38", "FNC1 (0x6B) 17..10 12 34 56" }, - /* 24*/ { GS1_MODE, -1, "[17]123456[10]123", -1, ZINT_WARN_NONCOMPLIANT, "64 0C 22 38 0C 66 13", "17..10 12 34 56 12 ShiftB (0x66) 3" }, - /* 25*/ { GS1_MODE, -1, "[90]ABC[90]abc[90]123", -1, 0, "5A 6A 21 22 23 6B 19 10 41 42 43 6B 19 67 01 17", "90 LatchB (0x6A) A B C FNC1 (0x6B) 9 0 a b c FNC1 (0x6B) 9 2xShitfC (0x67) 01 23" }, - /* 26*/ { GS1_MODE | GS1PARENS_MODE, -1, "(90)ABC(90)abc(90)123", -1, 0, "5A 6A 21 22 23 6B 19 10 41 42 43 6B 19 67 01 17", "90 LatchB (0x6A) A B C FNC1 (0x6B) 9 0 a b c FNC1 (0x6B) 9 2xShitfC (0x67) 01 23" }, - /* 27*/ { UNICODE_MODE, -1, "99aA[{00\000", 9, 0, "6B 63 6A 41 21 3B 5B 10 10 65 40", "FNC1 (0x6B) 99 LatchB (0x6A) a A [ { 0 0 ShiftA (0x65) NUL" }, - /* 28*/ { UNICODE_MODE, -1, "\015\012", -1, 0, "66 60", "ShiftB (0x66) CR/LF" }, - /* 29*/ { UNICODE_MODE, -1, "A\015\012", -1, 0, "67 21 60", "2xShiftB (0x67) A CR/LF" }, - /* 30*/ { UNICODE_MODE, -1, "\015\015\012", -1, 0, "65 4D 4D 4A", "LatchA (0x65) CR CR LF" }, - /* 31*/ { UNICODE_MODE, -1, "ABCDE12345678", -1, 0, "6A 21 22 23 24 25 69 0C 22 38 4E", "LatchB (0x6A) A B C D 4xShiftC 12 34 56 78" }, - /* 32*/ { UNICODE_MODE, -1, "\000ABCD1234567890", 15, 0, "65 40 21 22 23 24 6A 0C 22 38 4E 5A", "LatchA (0x65) NULL A B C D LatchC (0x6A) 12 34 56 78 90" }, - /* 33*/ { DATA_MODE, -1, "\141\142\143\144\145\200\201\202\203\204\377", -1, 0, "6A 41 42 43 44 45 70 31 5A 35 21 5A 5F 02 31", "LatchB (0x6A) a b c d e BinaryLatch (0x70) 0x80 0x81 0x82 0x83 0x84 0xFF" }, - /* 34*/ { DATA_MODE, -1, "\200\061\062\240\063\064\201\202\065\066", -1, 0, "6E 40 0C 6F 00 22 70 03 10 42 6E 15 16", "UpperShiftA (0x6E) NUL 12 UpperShiftB (0x6F) SP 34 BinaryLatch (0x70) 0x81 0x82 TermB (0x6E) 5 6" }, - /* 35*/ { DATA_MODE, -1, "\200\201\202\203\061\062\063\064", -1, 0, "70 13 56 0A 59 2C 67 0C 22", "BinaryLatch (0x70) 0x80 0x81 0x82 0x83 Intr2xShiftC (0x67) 12 3" }, - /* 36*/ { DATA_MODE, -1, "\001\200\201\202\203\204\200\201\202\203\204", -1, 0, "65 41 70 31 5A 35 21 5A 5F 31 5A 35 21 5A 5F", "LatchA (0x65) SOH BinaryLatch (0x70) 0x80 0x81 0x82 0x83 0x80 0x81 0x82 0x83" }, - /* 37*/ { UNICODE_MODE, -1, "\001abc\011\015\012\036", -1, 0, "65 41 65 41 42 43 61 60 64", "LatchA (0x65) SOH 6xShiftB (0x65) a b c HT CR/LF RS" }, + /* 0*/ { UNICODE_MODE, -1, { 0, 0, "" }, "A", -1, 0, "66 21", "" }, + /* 1*/ { UNICODE_MODE, 3, { 0, 0, "" }, "A", -1, 0, "6C 03 66 21", "" }, + /* 2*/ { UNICODE_MODE, 40, { 0, 0, "" }, "A", -1, 0, "6C 28 00 00 66 21", "" }, + /* 3*/ { UNICODE_MODE, 113, { 0, 0, "" }, "A", -1, 0, "6C 28 00 49 66 21", "" }, + /* 4*/ { UNICODE_MODE, 899, { 0, 0, "" }, "A", -1, 0, "6C 28 07 44 66 21", "" }, + /* 5*/ { UNICODE_MODE, 12769, { 0, 0, "" }, "A", -1, 0, "6C 28 70 49 66 21", "" }, + /* 6*/ { UNICODE_MODE, 811799, { 0, 0, "" }, "A", -1, 0, "6C 67 40 50 66 21", "" }, + /* 7*/ { UNICODE_MODE, 811800, { 0, 0, "" }, "A", -1, ZINT_ERROR_INVALID_OPTION, "Error 525: Invalid ECI", "" }, + /* 8*/ { UNICODE_MODE, -1, { 0, 0, "" }, "\000", 1, 0, "65 40", "LatchA (0x65) NUL" }, + /* 9*/ { UNICODE_MODE, -1, { 0, 0, "" }, "\010", -1, 0, "65 48", "LatchA (0x65) BS" }, + /* 10*/ { UNICODE_MODE, -1, { 0, 0, "" }, "\011", -1, 0, "65 49", "Lead special; LatchA (0x65) HT" }, + /* 11*/ { UNICODE_MODE, -1, { 0, 0, "" }, "\034", -1, 0, "65 5C", "Lead special; LatchA (0x65) FS" }, + /* 12*/ { UNICODE_MODE, -1, { 0, 0, "" }, "\035", -1, 0, "65 5D", "Lead special; LatchA (0x65) GS" }, + /* 13*/ { UNICODE_MODE, -1, { 0, 0, "" }, "\036", -1, 0, "65 5E", "Lead special; LatchA (0x65) RS" }, + /* 14*/ { UNICODE_MODE, -1, { 0, 0, "" }, "\037", -1, 0, "65 5F", "LatchA (0x65) US" }, + /* 15*/ { UNICODE_MODE, -1, { 0, 0, "" }, "\177", -1, 0, "66 5F", "ShiftB (0x66) DEL" }, + /* 16*/ { UNICODE_MODE, -1, { 0, 0, "" }, "[)>\03605\035A\036\004", -1, 0, "6A 61 21", "[)>RS 05 GS A RS EOT; LatchB (0x6A) Macro97 (0x61) A" }, + /* 17*/ { UNICODE_MODE, -1, { 0, 0, "" }, "[)>\03606\035\011\034\035\036\036\004", -1, 0, "6A 62 61 62 63 64", "[)>RS 06 GS HT FS GS RS RS EOT; LatchB (0x6A) Macro98 (0x62) HT FS GS RS" }, + /* 18*/ { UNICODE_MODE, -1, { 0, 0, "" }, "[)>\03612\03512345\036\004", -1, 0, "6A 63 11 67 17 2D", "[)>RS 12 GS A RS EOT; LatchB (0x6A) Macro99 (0x63) 1 2xShiftC (0x67) 23 45" }, + /* 19*/ { UNICODE_MODE, -1, { 0, 0, "" }, "[)>\03601Blah\004", -1, 0, "6A 64 10 11 22 4C 41 48", "[)>RS 01 Blah EOT; LatchB (0x6A) Macro100 (0x64) 0 1 B l a h" }, + /* 20*/ { UNICODE_MODE, -1, { 0, 0, "" }, "[)>\03605\035A\004", -1, 0, "6A 64 10 15 63 21", "[)>RS 05 GS A EOT; LatchB (0x6A) Macro100 (0x64) 0 5 HT A" }, + /* 21*/ { UNICODE_MODE, -1, { 0, 0, "" }, "[)>\03606A\004", -1, 0, "6A 64 10 16 21", "[)>RS 06 A EOT; LatchB (0x6A) Macro100 (0x64) 0 6 A" }, + /* 22*/ { UNICODE_MODE, -1, { 0, 0, "" }, "[)>\036991\036\004", -1, 0, "6A 64 19 19 11 64", "[)>RS 99 1 RS EOT; LatchB (0x6A) Macro100 (0x64) 9 9 1 RS" }, + /* 23*/ { UNICODE_MODE, -1, { 0, 0, "" }, "1712345610", -1, 0, "6B 64 0C 22 38", "FNC1 (0x6B) 17..10 12 34 56" }, + /* 24*/ { GS1_MODE, -1, { 0, 0, "" }, "[17]123456[10]123", -1, ZINT_WARN_NONCOMPLIANT, "64 0C 22 38 0C 66 13", "17..10 12 34 56 12 ShiftB (0x66) 3" }, + /* 25*/ { GS1_MODE, -1, { 0, 0, "" }, "[90]ABC[90]abc[90]123", -1, 0, "5A 6A 21 22 23 6B 19 10 41 42 43 6B 19 67 01 17", "90 LatchB (0x6A) A B C FNC1 (0x6B) 9 0 a b c FNC1 (0x6B) 9 2xShitfC (0x67) 01 23" }, + /* 26*/ { GS1_MODE | GS1PARENS_MODE, -1, { 0, 0, "" }, "(90)ABC(90)abc(90)123", -1, 0, "5A 6A 21 22 23 6B 19 10 41 42 43 6B 19 67 01 17", "90 LatchB (0x6A) A B C FNC1 (0x6B) 9 0 a b c FNC1 (0x6B) 9 2xShitfC (0x67) 01 23" }, + /* 27*/ { UNICODE_MODE, -1, { 0, 0, "" }, "99aA[{00\000", 9, 0, "6B 63 6A 41 21 3B 5B 10 10 65 40", "FNC1 (0x6B) 99 LatchB (0x6A) a A [ { 0 0 ShiftA (0x65) NUL" }, + /* 28*/ { UNICODE_MODE, -1, { 0, 0, "" }, "\015\012", -1, 0, "66 60", "ShiftB (0x66) CR/LF" }, + /* 29*/ { UNICODE_MODE, -1, { 0, 0, "" }, "A\015\012", -1, 0, "67 21 60", "2xShiftB (0x67) A CR/LF" }, + /* 30*/ { UNICODE_MODE, -1, { 0, 0, "" }, "\015\015\012", -1, 0, "65 4D 4D 4A", "LatchA (0x65) CR CR LF" }, + /* 31*/ { UNICODE_MODE, -1, { 0, 0, "" }, "ABCDE12345678", -1, 0, "6A 21 22 23 24 25 69 0C 22 38 4E", "LatchB (0x6A) A B C D 4xShiftC 12 34 56 78" }, + /* 32*/ { UNICODE_MODE, -1, { 0, 0, "" }, "\000ABCD1234567890", 15, 0, "65 40 21 22 23 24 6A 0C 22 38 4E 5A", "LatchA (0x65) NULL A B C D LatchC (0x6A) 12 34 56 78 90" }, + /* 33*/ { DATA_MODE, -1, { 0, 0, "" }, "\141\142\143\144\145\200\201\202\203\204\377", -1, 0, "6A 41 42 43 44 45 70 31 5A 35 21 5A 5F 02 31", "LatchB (0x6A) a b c d e BinaryLatch (0x70) 0x80 0x81 0x82 0x83 0x84 0xFF" }, + /* 34*/ { DATA_MODE, -1, { 0, 0, "" }, "\200\061\062\240\063\064\201\202\065\066", -1, 0, "6E 40 0C 6F 00 22 70 03 10 42 6E 15 16", "UpperShiftA (0x6E) NUL 12 UpperShiftB (0x6F) SP 34 BinaryLatch (0x70) 0x81 0x82 TermB (0x6E) 5 6" }, + /* 35*/ { DATA_MODE, -1, { 0, 0, "" }, "\200\201\202\203\061\062\063\064", -1, 0, "70 13 56 0A 59 2C 67 0C 22", "BinaryLatch (0x70) 0x80 0x81 0x82 0x83 Intr2xShiftC (0x67) 12 3" }, + /* 36*/ { DATA_MODE, -1, { 0, 0, "" }, "\001\200\201\202\203\204\200\201\202\203\204", -1, 0, "65 41 70 31 5A 35 21 5A 5F 31 5A 35 21 5A 5F", "LatchA (0x65) SOH BinaryLatch (0x70) 0x80 0x81 0x82 0x83 0x80 0x81 0x82 0x83" }, + /* 37*/ { UNICODE_MODE, -1, { 0, 0, "" }, "\001abc\011\015\012\036", -1, 0, "65 41 65 41 42 43 61 60 64", "LatchA (0x65) SOH 6xShiftB (0x65) a b c HT CR/LF RS" }, + /* 38*/ { UNICODE_MODE, -1, { 35, 35, "" }, "ABCDE", -1, 0, "6A 21 22 23 24 25 3A 3A 6C", "LatchB (0x6A) A B C D E Z Z FNC2" }, + /* 39*/ { UNICODE_MODE, -1, { 9, 10, "" }, "1234567890", -1, 0, "6B 0C 22 38 4E 5A 65 19 21 6C", "FNC1 (0x6B) 12 34 56 78 90 LatchA (0x65) 9 A FNC2" }, + /* 40*/ { UNICODE_MODE, -1, { 2, 3, "" }, "\001\002\003\004", -1, 0, "65 41 42 43 44 12 13 6C", "LatchA (0x65) 2 3 FNC2" }, + /* 41*/ { DATA_MODE, -1, { 1, 34, "" }, "\200\201\202\203", -1, 0, "70 13 56 0A 59 2C 6D 11 39 6C", "BinaryLatch (0x70) (...) TermA (0x6D) 1 Y FNC2" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -201,18 +218,21 @@ static void test_input(int index, int generate, int debug) { debug |= ZINT_DEBUG_TEST; // Needed to get codeword dump in errtxt length = testUtilSetSymbol(symbol, BARCODE_DOTCODE, data[i].input_mode, data[i].eci, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, data[i].length, debug); + if (data[i].structapp.count) { + symbol->structapp = data[i].structapp; + } 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, \"%s\", %d, %s, \"%s\", \"%s\" },\n", - i, testUtilInputModeName(data[i].input_mode), data[i].eci, testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), + printf(" /*%3d*/ { %s, %d, { %d, %d, \"%s\" }, \"%s\", %d, %s, \"%s\", \"%s\" },\n", + i, testUtilInputModeName(data[i].input_mode), data[i].eci, + data[i].structapp.index, data[i].structapp.count, data[i].structapp.id, + testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), data[i].length, testUtilErrorName(data[i].ret), symbol->errtxt, data[i].comment); } else { - if (ret < ZINT_ERROR) { - assert_zero(strcmp((char *) symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected); - } + 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); @@ -227,6 +247,7 @@ static void test_encode(int index, int generate, int debug) { int input_mode; int option_2; int option_3; + struct zint_structapp structapp; char *data; int length; int ret; @@ -239,7 +260,7 @@ static void test_encode(int index, int generate, int debug) { }; // ISS DotCode, Rev 4.0, DRAFT 0.15, TSC Pre-PR #5, MAY 28, 2019 struct item data[] = { - /* 0*/ { GS1_MODE, 64, -1, "[01]00012345678905[17]201231[10]ABC123456", -1, 0, 9, 64, 1, "ISS DotCode Rev 4.0 Figure 1 (left), same", + /* 0*/ { GS1_MODE, 64, -1, { 0, 0, "" }, "[01]00012345678905[17]201231[10]ABC123456", -1, 0, 9, 64, 1, "ISS DotCode Rev 4.0 Figure 1 (left), same", "1010000000101000101010000010000010001010100010101000101000001010" "0100010001010001010001000001010100010100010001000100010101000001" "1010001010000000101010100010001010000010101000000010100010100000" @@ -250,7 +271,7 @@ static void test_encode(int index, int generate, int debug) { "0001010100010001010100010001010000010001010000000101010001010101" "1000100010001000100010100010001010001000101000101000100010000010" }, - /* 1*/ { GS1_MODE, -1, -1, "[01]00012345678905[17]201231[10]ABC123456", -1, 0, 20, 29, 1, "ISS DotCode Rev 4.0 Figure 1 (right) (and Figure 10), same", + /* 1*/ { GS1_MODE, -1, -1, { 0, 0, "" }, "[01]00012345678905[17]201231[10]ABC123456", -1, 0, 20, 29, 1, "ISS DotCode Rev 4.0 Figure 1 (right) (and Figure 10), same", "10101000101010100010101000101" "00010100010100010100000001010" "00001010100010000000101010000" @@ -272,7 +293,7 @@ static void test_encode(int index, int generate, int debug) { "10000010101000100000001000001" "01000100010101010000000101010" }, - /* 2*/ { GS1_MODE, -1, 1 << 8, "[17]070620[10]ABC123456", -1, 0, 16, 23, 1, "ISS DotCode Rev 4.0 Figure 5 (and Figure 6 top-left) when Mask = 0, same", + /* 2*/ { GS1_MODE, -1, 1 << 8, { 0, 0, "" }, "[17]070620[10]ABC123456", -1, 0, 16, 23, 1, "ISS DotCode Rev 4.0 Figure 5 (and Figure 6 top-left) when Mask = 0, same", "10101000100010000000001" "01000101010001010000000" "00100010001000101000100" @@ -290,7 +311,7 @@ static void test_encode(int index, int generate, int debug) { "10101000001000101010001" "01000001010101010000010" }, - /* 3*/ { GS1_MODE, -1, 2 << 8, "[17]070620[10]ABC123456", -1, 0, 16, 23, 1, "ISS DotCode Rev 4.0 Figure 6 top-right Mask = 1, same", + /* 3*/ { GS1_MODE, -1, 2 << 8, { 0, 0, "" }, "[17]070620[10]ABC123456", -1, 0, 16, 23, 1, "ISS DotCode Rev 4.0 Figure 6 top-right Mask = 1, same", "10000000001010001000101" "01010101000100000101000" "00100010000000100000001" @@ -308,7 +329,7 @@ static void test_encode(int index, int generate, int debug) { "10000010101010100010101" "01000101000101010101010" }, - /* 4*/ { GS1_MODE, -1, 3 << 8, "[17]070620[10]ABC123456", -1, 0, 16, 23, 1, "ISS DotCode Rev 4.0 Figure 6 bottom-left Mask = 2, same", + /* 4*/ { GS1_MODE, -1, 3 << 8, { 0, 0, "" }, "[17]070620[10]ABC123456", -1, 0, 16, 23, 1, "ISS DotCode Rev 4.0 Figure 6 bottom-left Mask = 2, same", "10100000101010100010001" "01000101000100000000010" "10101010001010000010000" @@ -326,7 +347,7 @@ static void test_encode(int index, int generate, int debug) { "10101010000000001010001" "01010101000001000101010" }, - /* 5*/ { GS1_MODE, -1, 4 << 8, "[17]070620[10]ABC123456", -1, 0, 16, 23, 1, "ISS DotCode Rev 4.0 Figure 6 bottom-right Mask = 3, same", + /* 5*/ { GS1_MODE, -1, 4 << 8, { 0, 0, "" }, "[17]070620[10]ABC123456", -1, 0, 16, 23, 1, "ISS DotCode Rev 4.0 Figure 6 bottom-right Mask = 3, same", "10000000100000001010101" "01010001010100010001000" "10001000001010101010100" @@ -344,7 +365,7 @@ static void test_encode(int index, int generate, int debug) { "10001000001010001000001" "01010100000101000100010" }, - /* 6*/ { GS1_MODE, -1, -1, "[17]070620[10]ABC123456", -1, 0, 16, 23, 1, "ISS DotCode Rev 4.0 Figure 6 top-right, auto Mask = 1, same", + /* 6*/ { GS1_MODE, -1, -1, { 0, 0, "" }, "[17]070620[10]ABC123456", -1, 0, 16, 23, 1, "ISS DotCode Rev 4.0 Figure 6 top-right, auto Mask = 1, same", "10000000001010001000101" "01010101000100000101000" "00100010000000100000001" @@ -362,7 +383,7 @@ static void test_encode(int index, int generate, int debug) { "10000010101010100010101" "01000101000101010101010" }, - /* 7*/ { UNICODE_MODE, -1, 1 << 8, "2741", -1, 0, 10, 13, 0, "ISS DotCode Rev 4.0 Figure 7A top-left Mask = 0, same; BWIPP automatically primes mask", + /* 7*/ { UNICODE_MODE, -1, 1 << 8, { 0, 0, "" }, "2741", -1, 0, 10, 13, 0, "ISS DotCode Rev 4.0 Figure 7A top-left Mask = 0, same; BWIPP automatically primes mask", "1010101010100" "0000010001010" "0000101000101" @@ -374,7 +395,7 @@ static void test_encode(int index, int generate, int debug) { "1000100010001" "0000000000000" }, - /* 8*/ { UNICODE_MODE, -1, 2 << 8, "2741", -1, 0, 10, 13, 0, "ISS DotCode Rev 4.0 Figure 7A top-right Mask = 1, same; BWIPP automatically primes mask", + /* 8*/ { UNICODE_MODE, -1, 2 << 8, { 0, 0, "" }, "2741", -1, 0, 10, 13, 0, "ISS DotCode Rev 4.0 Figure 7A top-right Mask = 1, same; BWIPP automatically primes mask", "1010001000101" "0000000100010" "0000100000001" @@ -386,7 +407,7 @@ static void test_encode(int index, int generate, int debug) { "0000000010001" "0001000001000" }, - /* 9*/ { UNICODE_MODE, -1, 3 << 8, "2741", -1, 0, 10, 13, 0, "ISS DotCode Rev 4.0 Figure 7A bottom-left Mask = 2, same; BWIPP automatically primes mask", + /* 9*/ { UNICODE_MODE, -1, 3 << 8, { 0, 0, "" }, "2741", -1, 0, 10, 13, 0, "ISS DotCode Rev 4.0 Figure 7A bottom-left Mask = 2, same; BWIPP automatically primes mask", "1010001010100" "0001000000000" "1000100010101" @@ -398,7 +419,7 @@ static void test_encode(int index, int generate, int debug) { "1000100010101" "0001000100000" }, - /* 10*/ { UNICODE_MODE, -1, 4 << 8, "2741", -1, 0, 10, 13, 0, "ISS DotCode Rev 4.0 Figure 7A bottom-right Mask = 3, same; BWIPP automatically primes mask", + /* 10*/ { UNICODE_MODE, -1, 4 << 8, { 0, 0, "" }, "2741", -1, 0, 10, 13, 0, "ISS DotCode Rev 4.0 Figure 7A bottom-right Mask = 3, same; BWIPP automatically primes mask", "1010001000100" "0001000001010" "1000001000000" @@ -410,7 +431,7 @@ static void test_encode(int index, int generate, int debug) { "1000001010001" "0101010101010" }, - /* 11*/ { UNICODE_MODE, -1, 5 << 8, "2741", -1, 0, 10, 13, 1, "ISS DotCode Rev 4.0 Figure 7B top-left Mask = 0' (4), same", + /* 11*/ { UNICODE_MODE, -1, 5 << 8, { 0, 0, "" }, "2741", -1, 0, 10, 13, 1, "ISS DotCode Rev 4.0 Figure 7B top-left Mask = 0' (4), same", "1010101010101" "0000010001010" "0000101000101" @@ -422,7 +443,7 @@ static void test_encode(int index, int generate, int debug) { "1000100010001" "0100000000010" }, - /* 12*/ { UNICODE_MODE, -1, 6 << 8, "2741", -1, 0, 10, 13, 1, "ISS DotCode Rev 4.0 Figure 7B top-right Mask = 1' (5), same", + /* 12*/ { UNICODE_MODE, -1, 6 << 8, { 0, 0, "" }, "2741", -1, 0, 10, 13, 1, "ISS DotCode Rev 4.0 Figure 7B top-right Mask = 1' (5), same", "1010001000101" "0000000100010" "0000100000001" @@ -434,7 +455,7 @@ static void test_encode(int index, int generate, int debug) { "1000000010001" "0101000001010" }, - /* 13*/ { UNICODE_MODE, -1, 7 << 8, "2741", -1, 0, 10, 13, 1, "ISS DotCode Rev 4.0 Figure 7B bottom-left Mask = 2' (6), same", + /* 13*/ { UNICODE_MODE, -1, 7 << 8, { 0, 0, "" }, "2741", -1, 0, 10, 13, 1, "ISS DotCode Rev 4.0 Figure 7B bottom-left Mask = 2' (6), same", "1010001010101" "0001000000000" "1000100010101" @@ -446,7 +467,7 @@ static void test_encode(int index, int generate, int debug) { "1000100010101" "0101000100010" }, - /* 14*/ { UNICODE_MODE, -1, 8 << 8, "2741", -1, 0, 10, 13, 1, "ISS DotCode Rev 4.0 Figure 7B bottom-right Mask = 3' (7), same", + /* 14*/ { UNICODE_MODE, -1, 8 << 8, { 0, 0, "" }, "2741", -1, 0, 10, 13, 1, "ISS DotCode Rev 4.0 Figure 7B bottom-right Mask = 3' (7), same", "1010001000101" "0001000001010" "1000001000000" @@ -458,7 +479,7 @@ static void test_encode(int index, int generate, int debug) { "1000001010001" "0101010101010" }, - /* 15*/ { UNICODE_MODE, -1, -1, "2741", -1, 0, 10, 13, 1, "ISS DotCode Rev 4.0 Figure 7B bottom-left auto Mask = 2' (6), same", + /* 15*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, "2741", -1, 0, 10, 13, 1, "ISS DotCode Rev 4.0 Figure 7B bottom-left auto Mask = 2' (6), same", "1010001010101" "0001000000000" "1000100010101" @@ -470,7 +491,7 @@ static void test_encode(int index, int generate, int debug) { "1000100010101" "0101000100010" }, - /* 16*/ { GS1_MODE, 40, -1, "[01]00012345678905", -1, 0, 7, 40, 1, "ISS DotCode Rev 4.0 Figure 8 top-left 7x40, Mask = 1, same", + /* 16*/ { GS1_MODE, 40, -1, { 0, 0, "" }, "[01]00012345678905", -1, 0, 7, 40, 1, "ISS DotCode Rev 4.0 Figure 8 top-left 7x40, Mask = 1, same", "1010101010001000100010100010101000001000" "0000010101000100010100010000010001000001" "1010001000001000001000101010001000101000" @@ -479,7 +500,7 @@ static void test_encode(int index, int generate, int debug) { "0001010001010001000100000001010100010001" "1000100010001000100010100010001010001000" }, - /* 17*/ { GS1_MODE, 18, -1, "[01]00012345678905", -1, 0, 17, 18, 1, "ISS DotCode Rev 4.0 Figure 8 top-right 17x18 **NOT SAME** no matter what mask; but same as BWIPP and verified manually against tec-it", + /* 17*/ { GS1_MODE, 18, -1, { 0, 0, "" }, "[01]00012345678905", -1, 0, 17, 18, 1, "ISS DotCode Rev 4.0 Figure 8 top-right 17x18 **NOT SAME** no matter what mask; but same as BWIPP and verified manually against tec-it", "101000001000101010" "010100000101010001" "000000101000001010" @@ -498,7 +519,7 @@ static void test_encode(int index, int generate, int debug) { "010001010001000101" "100010001000100010" }, - /* 18*/ { GS1_MODE, 35, -1, "[01]00012345678905", -1, 0, 8, 35, 1, "ISS DotCode Rev 4.0 Figure 8 bottom-left 8x35, Mask = 3, same", + /* 18*/ { GS1_MODE, 35, -1, { 0, 0, "" }, "[01]00012345678905", -1, 0, 8, 35, 1, "ISS DotCode Rev 4.0 Figure 8 bottom-left 8x35, Mask = 3, same", "10100010000000000010100000100010101" "00010101010001000000010100010100000" "10001000101010101010001010000010101" @@ -508,7 +529,7 @@ static void test_encode(int index, int generate, int debug) { "10000010101010101010000010000010001" "01000001000101000100010100010001000" }, - /* 19*/ { GS1_MODE, 17, -1, "[01]00012345678905", -1, 0, 18, 17, 1, "ISS DotCode Rev 4.0 Figure 8 bottom-right 18x17 **NOT SAME** no matter what mask; same as BWIPP; verified manually against tec-it", + /* 19*/ { GS1_MODE, 17, -1, { 0, 0, "" }, "[01]00012345678905", -1, 0, 18, 17, 1, "ISS DotCode Rev 4.0 Figure 8 bottom-right 18x17 **NOT SAME** no matter what mask; same as BWIPP; verified manually against tec-it", "10101000001000001" "01000001010100010" "00000000100010001" @@ -528,7 +549,7 @@ static void test_encode(int index, int generate, int debug) { "10101010101010101" "01010101000101010" }, - /* 20*/ { UNICODE_MODE, 35, -1, "Dots can be Square!", -1, 0, 18, 35, 1, "ISS DotCode Rev 4.0 Figure 11 **NOT SAME**; same as BWIPP; verified manually against tec-it", + /* 20*/ { UNICODE_MODE, 35, -1, { 0, 0, "" }, "Dots can be Square!", -1, 0, 18, 35, 1, "ISS DotCode Rev 4.0 Figure 11 **NOT SAME**; same as BWIPP; verified manually against tec-it", "10000010101000000000000000101010101" "01010101000101000100010100000001000" "00001000000010101000101010101010000" @@ -548,7 +569,7 @@ static void test_encode(int index, int generate, int debug) { "10101000101000001000100010101000101" "01000001000001000101010001000000010" }, - /* 21*/ { GS1_MODE, -1, 1 << 8, "[99]8766", -1, 0, 10, 13, 0, "ISS DotCode Rev 4.0 Table G.1 Mask 0, same; BWIPP automatically primes mask", + /* 21*/ { GS1_MODE, -1, 1 << 8, { 0, 0, "" }, "[99]8766", -1, 0, 10, 13, 0, "ISS DotCode Rev 4.0 Table G.1 Mask 0, same; BWIPP automatically primes mask", "0000001010000" "0001010000010" "0000000010001" @@ -560,7 +581,7 @@ static void test_encode(int index, int generate, int debug) { "0010000000101" "0101000101010" }, - /* 22*/ { GS1_MODE, -1, 2 << 8, "[99]8766", -1, 0, 10, 13, 0, "ISS DotCode Rev 4.0 Table G.1 Mask 1, same; BWIPP automatically primes mask", + /* 22*/ { GS1_MODE, -1, 2 << 8, { 0, 0, "" }, "[99]8766", -1, 0, 10, 13, 0, "ISS DotCode Rev 4.0 Table G.1 Mask 1, same; BWIPP automatically primes mask", "0000100000001" "0001010000000" "0000000000001" @@ -572,7 +593,7 @@ static void test_encode(int index, int generate, int debug) { "0010101000101" "0100010101000" }, - /* 23*/ { GS1_MODE, -1, 3 << 8, "[99]8766", -1, 0, 10, 13, 0, "ISS DotCode Rev 4.0 Table G.1 Mask 2, same; BWIPP automatically primes mask", + /* 23*/ { GS1_MODE, -1, 3 << 8, { 0, 0, "" }, "[99]8766", -1, 0, 10, 13, 0, "ISS DotCode Rev 4.0 Table G.1 Mask 2, same; BWIPP automatically primes mask", "0000100010100" "0000000000000" "1000101010101" @@ -584,7 +605,7 @@ static void test_encode(int index, int generate, int debug) { "0000000010001" "0100000001010" }, - /* 24*/ { GS1_MODE, -1, 4 << 8, "[99]8766", -1, 0, 10, 13, 0, "ISS DotCode Rev 4.0 Table G.1 Mask 3, same; BWIPP automatically primes mask", + /* 24*/ { GS1_MODE, -1, 4 << 8, { 0, 0, "" }, "[99]8766", -1, 0, 10, 13, 0, "ISS DotCode Rev 4.0 Table G.1 Mask 3, same; BWIPP automatically primes mask", "0000000000000" "0001010001000" "1000001010000" @@ -596,7 +617,7 @@ static void test_encode(int index, int generate, int debug) { "1000000010000" "0100000000010" }, - /* 25*/ { GS1_MODE, -1, 5 << 8, "[99]8766", -1, 0, 10, 13, 1, "ISS DotCode Rev 4.0 Table G.1 Mask 0' (4), same", + /* 25*/ { GS1_MODE, -1, 5 << 8, { 0, 0, "" }, "[99]8766", -1, 0, 10, 13, 1, "ISS DotCode Rev 4.0 Table G.1 Mask 0' (4), same", "1000001010001" "0001010000010" "0000000010001" @@ -608,7 +629,7 @@ static void test_encode(int index, int generate, int debug) { "1010000000101" "0101000101010" }, - /* 26*/ { GS1_MODE, -1, 6 << 8, "[99]8766", -1, 0, 10, 13, 1, "ISS DotCode Rev 4.0 Table G.1 Mask 1' (5), same", + /* 26*/ { GS1_MODE, -1, 6 << 8, { 0, 0, "" }, "[99]8766", -1, 0, 10, 13, 1, "ISS DotCode Rev 4.0 Table G.1 Mask 1' (5), same", "1000100000001" "0001010000000" "0000000000001" @@ -620,7 +641,7 @@ static void test_encode(int index, int generate, int debug) { "1010101000101" "0100010101010" }, - /* 27*/ { GS1_MODE, -1, 7 << 8, "[99]8766", -1, 0, 10, 13, 1, "ISS DotCode Rev 4.0 Table G.1 Mask 2' (6), same", + /* 27*/ { GS1_MODE, -1, 7 << 8, { 0, 0, "" }, "[99]8766", -1, 0, 10, 13, 1, "ISS DotCode Rev 4.0 Table G.1 Mask 2' (6), same", "1000100010101" "0000000000000" "1000101010101" @@ -632,7 +653,7 @@ static void test_encode(int index, int generate, int debug) { "1000000010001" "0100000001010" }, - /* 28*/ { GS1_MODE, -1, 8 << 8, "[99]8766", -1, 0, 10, 13, 1, "ISS DotCode Rev 4.0 Table G.1 Mask 3' (7), same", + /* 28*/ { GS1_MODE, -1, 8 << 8, { 0, 0, "" }, "[99]8766", -1, 0, 10, 13, 1, "ISS DotCode Rev 4.0 Table G.1 Mask 3' (7), same", "1000000000001" "0001010001000" "1000001010000" @@ -644,7 +665,7 @@ static void test_encode(int index, int generate, int debug) { "1000000010001" "0100000000010" }, - /* 29*/ { GS1_MODE, -1, -1, "[99]8766", -1, 0, 10, 13, 1, "ISS DotCode Rev 4.0 Table G.1 auto Mask 0' (4); all mask scores match Table G.1", + /* 29*/ { GS1_MODE, -1, -1, { 0, 0, "" }, "[99]8766", -1, 0, 10, 13, 1, "ISS DotCode Rev 4.0 Table G.1 auto Mask 0' (4); all mask scores match Table G.1", "1000001010001" "0001010000010" "0000000010001" @@ -656,7 +677,7 @@ static void test_encode(int index, int generate, int debug) { "1010000000101" "0101000101010" }, - /* 30*/ { UNICODE_MODE, 6, -1, "A", -1, 0, 19, 6, 1, "ISS DotCode Rev 4.0 5.2.1.4 2) Table 4, 1 padding dot available; verified manually against tec-it", + /* 30*/ { UNICODE_MODE, 6, -1, { 0, 0, "" }, "A", -1, 0, 19, 6, 1, "ISS DotCode Rev 4.0 5.2.1.4 2) Table 4, 1 padding dot available; verified manually against tec-it", "101000" "000101" "101010" @@ -677,7 +698,7 @@ static void test_encode(int index, int generate, int debug) { "010000" "101000" }, - /* 31*/ { UNICODE_MODE, 94, -1, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRS", -1, 0, 37, 94, 1, "Interleaved R-S; verified manually against tec-it", + /* 31*/ { UNICODE_MODE, 94, -1, { 0, 0, "" }, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRS", -1, 0, 37, 94, 1, "Interleaved R-S; verified manually against tec-it", "1000001010000000100010000010101010101000001000100000001010101000001000001000101010001000101010" "0101010000000101000001010001010001010100010001000001000000010101010000000101010100010001010100" "0010101000100010000010101010000000101010000010101000001000100010100000100010100010001000101000" @@ -716,7 +737,7 @@ static void test_encode(int index, int generate, int debug) { "0001000101010100000001010101000001010000010001010001000100010000010001000101010001010001000001" "0010001000001010101000000010101000101000001000001010100000101010001000000010100000001010101000" }, - /* 32*/ { GS1_MODE, 50, -1, "[17]070620[10]ABC123456", -1, 0, 7, 50, 1, "GS1 Gen Spec Figure 5.1-8.", + /* 32*/ { GS1_MODE, 50, -1, { 0, 0, "" }, "[17]070620[10]ABC123456", -1, 0, 7, 50, 1, "GS1 Gen Spec Figure 5.1-8.", "10000010101000100010101010001000000010100000100000" "01000101000101010100000100010000010001000001010101" "00001010001000101000101000100010001010100000000010" @@ -725,14 +746,14 @@ static void test_encode(int index, int generate, int debug) { "00010001010000000100010101000100010001010001000101" "10001000001010101000001000100010100010100000101010" }, - /* 33*/ { UNICODE_MODE, 200, -1, "123456789012345678901234567890123456789012345678901234567890", -1, 0, 5, 200, 1, "Max cols", + /* 33*/ { UNICODE_MODE, 200, -1, { 0, 0, "" }, "123456789012345678901234567890123456789012345678901234567890", -1, 0, 5, 200, 1, "Max cols", "10101000100010101010000010101000000010001000100000101010100010100000101000100010000000101000101010001010100000100000101010100000001000101000001010100010001010000010001010001010100000100010101000000010" "00010101010000000101000100010001000101000101000100010001000001010001000001010100000001000101010000000101010100010101010000010001000101010001000001000001010000010100010001010101000001000001010100000001" "10100010000000100010101000101010100000001010001000100000101000101000001000101010001000000010101010100010101000000010100010001000001010100000101000100000101010100010000000001000001010101000101010100000" "00010001010001010000000101000100010001010000010000010100010100000100010101010001000101000000010100010001010100010000010100000101000100010100000101010000000101000001010100010100010001000101000001010001" "10100010001010101000000010001000001010001010001000001010100010000000101010001010000010101010000000101000100010100010100000100010100010001010100000001010101000001010000000001000101000101010000010101010" }, - /* 34*/ { UNICODE_MODE, 19, -1, "4", -1, 0, 6, 19, 1, "Mask 1 selected", + /* 34*/ { UNICODE_MODE, 19, -1, { 0, 0, "" }, "4", -1, 0, 6, 19, 1, "Mask 1 selected", "1010100000101000101" "0100000000010001010" "0010101010000000000" @@ -740,7 +761,7 @@ static void test_encode(int index, int generate, int debug) { "1000100010001010001" "0001010101010101010" }, - /* 35*/ { UNICODE_MODE, 19, 3 << 8, "4", -1, 0, 6, 19, 0, "Mask 2 specified, unlit right edge mask; BWIPP automatically primes mask", + /* 35*/ { UNICODE_MODE, 19, 3 << 8, { 0, 0, "" }, "4", -1, 0, 6, 19, 0, "Mask 2 specified, unlit right edge mask; BWIPP automatically primes mask", "1010101010000000100" "0000000101000100010" "1010100000001010100" @@ -748,7 +769,7 @@ static void test_encode(int index, int generate, int debug) { "1000001010100010100" "0101000100010001010" }, - /* 36*/ { UNICODE_MODE, 19, 7 << 8, "4", -1, 0, 6, 19, 1, "Mask 2' specified", + /* 36*/ { UNICODE_MODE, 19, 7 << 8, { 0, 0, "" }, "4", -1, 0, 6, 19, 1, "Mask 2' specified", "1010101010000000101" "0000000101000100010" "1010100000001010100" @@ -756,7 +777,7 @@ static void test_encode(int index, int generate, int debug) { "1000001010100010101" "0101000100010001010" }, - /* 37*/ { GS1_MODE, -1, -1, "[10]12[20]12", -1, 0, 12, 17, 1, "Code Set C with FNC1", + /* 37*/ { GS1_MODE, -1, -1, { 0, 0, "" }, "[10]12[20]12", -1, 0, 12, 17, 1, "Code Set C with FNC1", "10100000001000001" "00010100010101010" "10001000100000001" @@ -770,7 +791,7 @@ static void test_encode(int index, int generate, int debug) { "10000010100000101" "01000100010101010" }, - /* 38*/ { UNICODE_MODE, -1, -1, "1234\011\034\035\036", -1, 0, 14, 21, 1, "Code Set B HT FS GS RS", + /* 38*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, "1234\011\034\035\036", -1, 0, 14, 21, 1, "Code Set B HT FS GS RS", "100010001000001010101" "010001000001000001000" "100010100010101010001" @@ -786,7 +807,7 @@ static void test_encode(int index, int generate, int debug) { "001010101000101010001" "010101010001000101000" }, - /* 39*/ { UNICODE_MODE, 17, -1, "abcd\015\012", -1, 0, 14, 17, 1, "Code Set B CRLF", + /* 39*/ { UNICODE_MODE, 17, -1, { 0, 0, "" }, "abcd\015\012", -1, 0, 14, 17, 1, "Code Set B CRLF", "00001000001000101" "01000101010001000" "10100000100010101" @@ -802,7 +823,7 @@ static void test_encode(int index, int generate, int debug) { "10100000001010000" "01010001000101000" }, - /* 40*/ { DATA_MODE, -1, -1, "\101\102\103\104\105\106\107\200\101\102\240\101", -1, 0, 18, 27, 1, "Code Set B Upper Shift A Upper Shift B", + /* 40*/ { DATA_MODE, -1, -1, { 0, 0, "" }, "\101\102\103\104\105\106\107\200\101\102\240\101", -1, 0, 18, 27, 1, "Code Set B Upper Shift A Upper Shift B", "101010100000101000101000001" "010100010101000100010101000" "000010001010100000101010101" @@ -822,7 +843,7 @@ static void test_encode(int index, int generate, int debug) { "100010101000000010001000001" "010001000100000101000001010" }, - /* 41*/ { UNICODE_MODE, -1, -1, "ABCDEF\001G1234H", -1, 0, 16, 25, 1, "Code Set A 4x Shift C", + /* 41*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, "ABCDEF\001G1234H", -1, 0, 16, 25, 1, "Code Set A 4x Shift C", "0010101010100000100000101" "0000000100010101000001000" "1000100000101000100000101" @@ -840,7 +861,7 @@ static void test_encode(int index, int generate, int debug) { "1010101010001000101000000" "0000010100010101000101010" }, - /* 42*/ { UNICODE_MODE, -1, -1, "ABCDEF\001ab\011\034\035\036\001A", -1, 0, 19, 28, 1, "Code Set A 6x Shift B HT FS GS RS", + /* 42*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, "ABCDEF\001ab\011\034\035\036\001A", -1, 0, 19, 28, 1, "Code Set A 6x Shift B HT FS GS RS", "1000001010100010101010101010" "0101000000010100010101010001" "0010001010100000101000001010" @@ -861,7 +882,7 @@ static void test_encode(int index, int generate, int debug) { "0001010000010100000100010101" "1010100010000000101010101010" }, - /* 43*/ { UNICODE_MODE, -1, -1, "ABCDEF\001abcdefgA", -1, 0, 19, 28, 1, "Code Set A Latch B", + /* 43*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, "ABCDEF\001abcdefgA", -1, 0, 19, 28, 1, "Code Set A Latch B", "1010001010100010101010101010" "0100010101010000000100010001" "1010000010100000100010101000" @@ -882,7 +903,7 @@ static void test_encode(int index, int generate, int debug) { "0001010000010100000100010101" "1010100010000000101010101010" }, - /* 44*/ { DATA_MODE, -1, -1, "\200\200\200\200\061\062\063\064\065\066\067\070\071\060\061\062\063\064\065\066\200", -1, 0, 20, 29, 1, "Binary Latch C", + /* 44*/ { DATA_MODE, -1, -1, { 0, 0, "" }, "\200\200\200\200\061\062\063\064\065\066\067\070\071\060\061\062\063\064\065\066\200", -1, 0, 20, 29, 1, "Binary Latch C", "10101010000010100010101010001" "01010001000101010001000000010" "00001010101000101010001000001" @@ -904,6 +925,36 @@ static void test_encode(int index, int generate, int debug) { "10000010100010000010001000101" "01000100000100010001010101010" }, + /* 45*/ { UNICODE_MODE, -1, -1, { 11, 24, "" }, "ABCDEFG", -1, 0, 16, 23, 1, "Structured Append", + "10101000001000101000001" + "01010101000001010001010" + "10101010100010000000001" + "01000001010000010100010" + "10000000101010100010101" + "01010100010101010101000" + "10000010101010101000101" + "00010100010100000000010" + "00101000100000001010001" + "00010100000001000100000" + "00100010000000001010101" + "01010101010001010101000" + "10000000001010000000001" + "00000000010100010001010" + "10001010101000100010001" + "01000001000100010101010" + }, + /* 46*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, "1234", -1, 0, 10, 13, 1, "", + "0010100000001" + "0000000001010" + "1000000010101" + "0101010101000" + "1000101000000" + "0100010100010" + "1000000010100" + "0101010000010" + "1000101000001" + "0101010101000" + }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -920,18 +971,23 @@ static void test_encode(int index, int generate, int debug) { for (i = 0; i < data_size; i++) { if (index != -1 && i != index) continue; + if ((debug & ZINT_DEBUG_TEST_PRINT) && !(debug & ZINT_DEBUG_TEST_LESS_NOISY)) printf("i:%d\n", i); symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); length = testUtilSetSymbol(symbol, BARCODE_DOTCODE, data[i].input_mode, -1 /*eci*/, -1, data[i].option_2, data[i].option_3, -1 /*output_options*/, data[i].data, data[i].length, debug); + if (data[i].structapp.count) { + symbol->structapp = data[i].structapp; + } 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, %s, \"%s\", %d, %s, %d, %d, %d, \"%s\",\n", + printf(" /*%3d*/ { %s, %d, %s, { %d, %d, \"%s\" }, \"%s\", %d, %s, %d, %d, %d, \"%s\",\n", i, testUtilInputModeName(data[i].input_mode), data[i].option_2, testUtilOption3Name(data[i].option_3), + data[i].structapp.index, data[i].structapp.count, data[i].structapp.id, testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), data[i].length, testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].bwipp_cmp, data[i].comment); testUtilModulesPrint(symbol, " ", "\n"); @@ -1025,6 +1081,140 @@ static void test_fuzz(int index, int debug) { testFinish(); } +#define GF 113 + +// Dummy to generate pre-calculated coefficients for GF(113) of generator polys of degree 3 to 39 +static void test_generate(int generate) { + + // roots (antilogs): root[0] = 1; for (i = 1; i < GF - 1; i++) root[i] = (PM * root[i - 1]) % GF; + static int root[GF - 1] = { + 1, 3, 9, 27, 81, 17, 51, 40, 7, 21, + 63, 76, 2, 6, 18, 54, 49, 34, 102, 80, + 14, 42, 13, 39, 4, 12, 36, 108, 98, 68, + 91, 47, 28, 84, 26, 78, 8, 24, 72, 103, + 83, 23, 69, 94, 56, 55, 52, 43, 16, 48, + 31, 93, 53, 46, 25, 75, 112, 110, 104, 86, + 32, 96, 62, 73, 106, 92, 50, 37, 111, 107, + 95, 59, 64, 79, 11, 33, 99, 71, 100, 74, + 109, 101, 77, 5, 15, 45, 22, 66, 85, 29, + 87, 35, 105, 89, 41, 10, 30, 90, 44, 19, + 57, 58, 61, 70, 97, 65, 82, 20, 60, 67, + 88, 38 + }; + int i, j, nc, cind, ci; + + // Degree nc has nc + 1 terms + char coefs[820 - 5] = {0}; // 40*(41 + 1)/2 == 820 less 2 + 3 (degrees 1 and 2) + int cinds[39 - 2] = {0}; + + if (!generate) { + return; + } + + printf(" static const char coefs[820 - 5] = { /* 40*(41 + 1)/2 == 820 less 2 + 3 (degrees 1 and 2) */\n"); + for (nc = 3, cind = 0, ci = 0; nc <= 39; cind += nc + 1, ci++, nc++) { + cinds[ci] = cind; + + coefs[cind] = 1; + for (i = 1; i <= nc; i++) { + for (j = nc; j >= 1; j--) { + coefs[cind + j] = (GF + coefs[cind + j] - (root[i] * coefs[cind + j - 1]) % GF) % GF; + } + } + printf(" "); + for (i = 0; i <= nc; i++) { + if (i == 22) printf("\n "); + printf(" %3d,", coefs[cinds[ci] + i]); + } + printf("\n"); + } + printf(" };\n"); + + printf(" static const short cinds[39 - 2] = { /* Indexes into above coefs[] array */\n "); + for (i = 0; i < ARRAY_SIZE(cinds); i++) { + if (i == 22) printf("\n "); + printf(" %3d,", cinds[i]); + } + printf("\n };\n"); +} + +#include + +#define TEST_PERF_ITERATIONS 1000 + +// Not a real test, just performance indicator +static void test_perf(int index, int debug) { + + struct item { + int symbology; + int input_mode; + int option_1; + int option_2; + char *data; + int ret; + + int expected_rows; + int expected_width; + char *comment; + }; + struct item data[] = { + /* 0*/ { BARCODE_DOTCODE, -1, -1, -1, + "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz&,:#-.$/+%*=^ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLM" + "NOPQRSTUVWXYZ;<>@[]_`~!||()?{}'123456789012345678901234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJK" + "LMNOPQRSTUVWXYZ12345678912345678912345678912345678900001234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFG" + "HIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234567" + "890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcde" + "fghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNO", + 0, 124, 185, "960 chars, text/numeric" }, + }; + int data_size = ARRAY_SIZE(data); + int i, length, ret; + + clock_t start, total_encode = 0, total_buffer = 0, diff_encode, diff_buffer; + + if (!(debug & ZINT_DEBUG_TEST_PERFORMANCE)) { /* -d 256 */ + return; + } + + for (i = 0; i < data_size; i++) { + int j; + + if (index != -1 && i != index) continue; + + diff_encode = diff_buffer = 0; + + for (j = 0; j < TEST_PERF_ITERATIONS; j++) { + struct zint_symbol *symbol = ZBarcode_Create(); + assert_nonnull(symbol, "Symbol not created\n"); + + length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug); + + start = clock(); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); + diff_encode += clock() - start; + assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); + + 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); + + start = clock(); + ret = ZBarcode_Buffer(symbol, 0 /*rotate_angle*/); + diff_buffer += clock() - start; + assert_zero(ret, "i:%d ZBarcode_Buffer ret %d != 0 (%s)\n", i, ret, symbol->errtxt); + + ZBarcode_Delete(symbol); + } + + printf("%s: diff_encode %gms, diff_buffer %gms\n", data[i].comment, diff_encode * 1000.0 / CLOCKS_PER_SEC, diff_buffer * 1000.0 / CLOCKS_PER_SEC); + + total_encode += diff_encode; + total_buffer += diff_buffer; + } + if (index != -1) { + printf("totals: encode %gms, buffer %gms\n", total_encode * 1000.0 / CLOCKS_PER_SEC, total_buffer * 1000.0 / CLOCKS_PER_SEC); + } +} + int main(int argc, char *argv[]) { testFunction funcs[] = { /* name, func, has_index, has_generate, has_debug */ @@ -1033,6 +1223,9 @@ int main(int argc, char *argv[]) { { "test_input", test_input, 1, 1, 1 }, { "test_encode", test_encode, 1, 1, 1 }, { "test_fuzz", test_fuzz, 1, 0, 1 }, + { "test_fuzz", test_fuzz, 1, 0, 1 }, + { "test_generate", test_generate, 0, 1, 0 }, + { "test_perf", test_perf, 1, 0, 1 }, }; testRun(argc, argv, funcs, ARRAY_SIZE(funcs)); diff --git a/backend/tests/test_gif.c b/backend/tests/test_gif.c index e313a0ad..6d19b999 100644 --- a/backend/tests/test_gif.c +++ b/backend/tests/test_gif.c @@ -132,6 +132,7 @@ static void test_print(int index, int generate, int debug) { float height; float scale; float dot_size; + struct zint_structapp structapp; char *fgcolour; char *bgcolour; char *data; @@ -139,34 +140,35 @@ static void test_print(int index, int generate, int debug) { char *comment; }; struct item data[] = { - /* 0*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 0, 0, "", "", "12", "dotcode_1.0.gif", "" }, - /* 1*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 0, 0.1, "", "", "12", "dotcode_1.0_ds0.1.gif", "" }, - /* 2*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 0, 1.1, "", "", "12", "dotcode_1.0_ds1.1.gif", "" }, - /* 3*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 1.5, 0, "", "", "12", "dotcode_1.5.gif", "" }, - /* 4*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 1.5, 0.4, "", "", "12", "dotcode_1.5_ds0.4.gif", "" }, - /* 5*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 1.5, 1.1, "", "", "12", "dotcode_1.5_ds1.1.gif", "" }, - /* 6*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 1.5, 2.1, "", "", "12", "dotcode_1.5_ds2.1.gif", "" }, - /* 7*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 2, 0, "", "", "12", "dotcode_2.0.gif", "" }, - /* 8*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 2, 0.9, "", "", "12", "dotcode_2.0_ds0.9.gif", "" }, - /* 9*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 2, 1.1, "", "", "12", "dotcode_2.0_ds1.1.gif", "" }, - /* 10*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 3, 0, "", "", "12", "dotcode_3.0.gif", "" }, - /* 11*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 3, 0.4, "", "", "12", "dotcode_3.0_ds0.4.gif", "" }, - /* 12*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 3, 1.1, "", "", "12", "dotcode_3.0_ds1.1.gif", "" }, - /* 13*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 3.5, 0, "", "", "12", "dotcode_3.5.gif", "" }, - /* 14*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 3.5, 0.4, "", "", "12", "dotcode_3.5_ds0.4.gif", "" }, - /* 15*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 3.5, 1.1, "", "", "12", "dotcode_3.5_ds1.1.gif", "" }, - /* 16*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 5, 0, "", "", "12", "dotcode_5.0.gif", "" }, - /* 17*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 5, 0.2, "", "", "12", "dotcode_5.0_ds0.2.gif", "" }, - /* 18*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 5, 1.1, "", "", "12", "dotcode_5.0_ds1.1.gif", "" }, - /* 19*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 5, 1.7, "", "", "12", "dotcode_5.0_ds1.7.gif", "" }, - /* 20*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 0, 0, "2674C344", "FDFFC2CC", "12", "dotcode_bgfgalpha.gif", "" }, - /* 21*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 0, 0, "00000000", "FFFFFF00", "12", "dotcode_bgfgtrans.gif", "" }, - /* 22*/ { BARCODE_ULTRA, 1, BARCODE_BOX, 1, 1, -1, -1, 0, 0, 0, "0000FF", "FF0000", "12", "ultra_fgbg_hvwsp1_box1.gif", "" }, - /* 23*/ { BARCODE_ITF14, 4, BARCODE_BIND, 24, -1, -1, -1, 61.8, 3, 0, "", "", "0501054800395", "itf14_height61.8_bind4_wsp24_3.gif", "#204 ARM-Cortex crash" }, - /* 24*/ { BARCODE_ITF14, 0, BARCODE_BIND, -1, -1, -1, -1, 0.5, 0.5, 0, "", "", "0501054800395", "itf14_height0.5_box0_0.5.gif", "No box, no text" }, - /* 25*/ { BARCODE_ITF14, -1, -1, -1, -1, -1, -1, 0.5, 1.1, 0, "", "", "0501054800395", "itf14_height0.5_1.1.gif", "" }, - /* 26*/ { BARCODE_CODE16K, -1, -1, 3, 5, -1, -1, 0.5, 0, 0, "", "", "1234567890", "code16k_height0.5_wsp3_vwsp5.gif", "Separator covers bars" }, - /* 27*/ { BARCODE_CODE16K, -1, -1, 3, 5, -1, -1, 1.5, 0, 0, "", "", "1234567890", "code16k_height1.5_wsp3_vwsp5.gif", "" }, + /* 0*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 0, 0, { 0, 0, "" }, "", "", "12", "dotcode_1.0.gif", "" }, + /* 1*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 0, 0.1, { 0, 0, "" }, "", "", "12", "dotcode_1.0_ds0.1.gif", "" }, + /* 2*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 0, 1.1, { 0, 0, "" }, "", "", "12", "dotcode_1.0_ds1.1.gif", "" }, + /* 3*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 1.5, 0, { 0, 0, "" }, "", "", "12", "dotcode_1.5.gif", "" }, + /* 4*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 1.5, 0.4, { 0, 0, "" }, "", "", "12", "dotcode_1.5_ds0.4.gif", "" }, + /* 5*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 1.5, 1.1, { 0, 0, "" }, "", "", "12", "dotcode_1.5_ds1.1.gif", "" }, + /* 6*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 1.5, 2.1, { 0, 0, "" }, "", "", "12", "dotcode_1.5_ds2.1.gif", "" }, + /* 7*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 2, 0, { 0, 0, "" }, "", "", "12", "dotcode_2.0.gif", "" }, + /* 8*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 2, 0.9, { 0, 0, "" }, "", "", "12", "dotcode_2.0_ds0.9.gif", "" }, + /* 9*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 2, 1.1, { 0, 0, "" }, "", "", "12", "dotcode_2.0_ds1.1.gif", "" }, + /* 10*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 3, 0, { 0, 0, "" }, "", "", "12", "dotcode_3.0.gif", "" }, + /* 11*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 3, 0.4, { 0, 0, "" }, "", "", "12", "dotcode_3.0_ds0.4.gif", "" }, + /* 12*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 3, 1.1, { 0, 0, "" }, "", "", "12", "dotcode_3.0_ds1.1.gif", "" }, + /* 13*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 3.5, 0, { 0, 0, "" }, "", "", "12", "dotcode_3.5.gif", "" }, + /* 14*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 3.5, 0.4, { 0, 0, "" }, "", "", "12", "dotcode_3.5_ds0.4.gif", "" }, + /* 15*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 3.5, 1.1, { 0, 0, "" }, "", "", "12", "dotcode_3.5_ds1.1.gif", "" }, + /* 16*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 5, 0, { 0, 0, "" }, "", "", "12", "dotcode_5.0.gif", "" }, + /* 17*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 5, 0.2, { 0, 0, "" }, "", "", "12", "dotcode_5.0_ds0.2.gif", "" }, + /* 18*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 5, 1.1, { 0, 0, "" }, "", "", "12", "dotcode_5.0_ds1.1.gif", "" }, + /* 19*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 5, 1.7, { 0, 0, "" }, "", "", "12", "dotcode_5.0_ds1.7.gif", "" }, + /* 20*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 0, 0, { 0, 0, "" }, "2674C344", "FDFFC2CC", "12", "dotcode_bgfgalpha.gif", "" }, + /* 21*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 0, 0, { 0, 0, "" }, "00000000", "FFFFFF00", "12", "dotcode_bgfgtrans.gif", "" }, + /* 22*/ { BARCODE_ULTRA, 1, BARCODE_BOX, 1, 1, -1, -1, 0, 0, 0, { 0, 0, "" }, "0000FF", "FF0000", "12", "ultra_fgbg_hvwsp1_box1.gif", "" }, + /* 23*/ { BARCODE_ITF14, 4, BARCODE_BIND, 24, -1, -1, -1, 61.8, 3, 0, { 0, 0, "" }, "", "", "0501054800395", "itf14_height61.8_bind4_wsp24_3.gif", "#204 ARM-Cortex crash" }, + /* 24*/ { BARCODE_ITF14, 0, BARCODE_BIND, -1, -1, -1, -1, 0.5, 0.5, 0, { 0, 0, "" }, "", "", "0501054800395", "itf14_height0.5_box0_0.5.gif", "No box, no text" }, + /* 25*/ { BARCODE_ITF14, -1, -1, -1, -1, -1, -1, 0.5, 1.1, 0, { 0, 0, "" }, "", "", "0501054800395", "itf14_height0.5_1.1.gif", "" }, + /* 26*/ { BARCODE_CODE16K, -1, -1, 3, 5, -1, -1, 0.5, 0, 0, { 0, 0, "" }, "", "", "1234567890", "code16k_height0.5_wsp3_vwsp5.gif", "Separator covers bars" }, + /* 27*/ { BARCODE_CODE16K, -1, -1, 3, 5, -1, -1, 1.5, 0, 0, { 0, 0, "" }, "", "", "1234567890", "code16k_height1.5_wsp3_vwsp5.gif", "" }, + /* 28*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, -1, 0, 0, 0, { 2, 9, "001002" }, "", "", "1234567890", "datamatrix_seq2of9.gif", "" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -217,6 +219,9 @@ static void test_print(int index, int generate, int debug) { if (data[i].dot_size) { symbol->dot_size = data[i].dot_size; } + if (data[i].structapp.count) { + symbol->structapp = data[i].structapp; + } if (*data[i].fgcolour) { strcpy(symbol->fgcolour, data[i].fgcolour); } diff --git a/backend/tests/test_gridmtx.c b/backend/tests/test_gridmtx.c index 1fb2d914..df4a0f67 100644 --- a/backend/tests/test_gridmtx.c +++ b/backend/tests/test_gridmtx.c @@ -96,29 +96,40 @@ static void test_large(int index, int debug) { static void test_options(int index, int debug) { struct item { - char *data; int option_1; int option_2; + struct zint_structapp structapp; + char *data; int ret_encode; int ret_vector; int expected_size; + const char *expected_errtxt; }; // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) struct item data[] = { - /* 0*/ { "12345", 0, 0, 0, 0, 18 }, - /* 1*/ { "12345", 0, 1, 0, 0, 18 }, - /* 2*/ { "12345", 0, 2, 0, 0, 30 }, - /* 3*/ { "12345", 0, 14, 0, 0, 18 }, // Version > max version 13 so ignored - /* 4*/ { "12345", 0, 13, 0, 0, 162 }, - /* 5*/ { "1234567890123456789", 0, 1, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 6*/ { "1234567890123456789", 0, 2, 0, 0, 30 }, - /* 7*/ { "123456789012345678", 0, 0, 0, 0, 30 }, // Version auto-set to 2 - /* 8*/ { "123456789012345678", 0, 1, 0, 0, 18 }, - /* 9*/ { "123456789012345678", 5, 1, 0, 0, 18 }, // Version specified so overrides ECC level which gets reduced to 4 - /* 10*/ { "123456789012345678", 5, 0, 0, 0, 30 }, // Version not specified so increased to allow for ECC level - /* 11*/ { "123456789012345678", 6, 0, 0, 0, 30 }, // ECC > max ECC 5 so ignored and auto-settings version 2, ECC 4 used - /* 12*/ { "123456789012345678", 1, 0, 0, 0, 30 }, // ECC < min ECC 2, ECC 2 used - /* 13*/ { "123456789012345678", 4, 1, 0, 0, 18 }, + /* 0*/ { 0, 0, { 0, 0, "" }, "12345", 0, 0, 18, "" }, + /* 1*/ { 0, 1, { 0, 0, "" }, "12345", 0, 0, 18, "" }, + /* 2*/ { 0, 2, { 0, 0, "" }, "12345", 0, 0, 30, "" }, + /* 3*/ { 0, 14, { 0, 0, "" }, "12345", 0, 0, 18, "" }, // Version > max version 13 so ignored + /* 4*/ { 0, 13, { 0, 0, "" }, "12345", 0, 0, 162, "" }, + /* 5*/ { 0, 1, { 0, 0, "" }, "1234567890123456789", ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input data too long for selected symbol size" }, + /* 6*/ { 0, 2, { 0, 0, "" }, "1234567890123456789", 0, 0, 30, "" }, + /* 7*/ { 0, 0, { 0, 0, "" }, "123456789012345678", 0, 0, 30, "" }, // Version auto-set to 2 + /* 8*/ { 0, 1, { 0, 0, "" }, "123456789012345678", 0, 0, 18, "" }, + /* 9*/ { 5, 1, { 0, 0, "" }, "123456789012345678", 0, 0, 18, "" }, // Version specified so overrides ECC level which gets reduced to 4 + /* 10*/ { 5, 0, { 0, 0, "" }, "123456789012345678", 0, 0, 30, "" }, // Version not specified so increased to allow for ECC level + /* 11*/ { 6, 0, { 0, 0, "" }, "123456789012345678", 0, 0, 30, "" }, // ECC > max ECC 5 so ignored and auto-settings version 2, ECC 4 used + /* 12*/ { 1, 0, { 0, 0, "" }, "123456789012345678", 0, 0, 30, "" }, // ECC < min ECC 2, ECC 2 used + /* 13*/ { 4, 1, { 0, 0, "" }, "123456789012345678", 0, 0, 18, "" }, + /* 14*/ { 0, 0, { 1, 2, "" }, "12345", 0, 0, 18, "" }, + /* 15*/ { 0, 0, { 1, 1, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 536: Structured Append count out of range (2-16)" }, + /* 16*/ { 0, 0, { 1, 17, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 536: Structured Append count out of range (2-16)" }, + /* 17*/ { 0, 0, { 0, 2, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 537: Structured Append index out of range (1-2)" }, + /* 18*/ { 0, 0, { 3, 2, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 537: Structured Append index out of range (1-2)" }, + /* 19*/ { 0, 0, { 1, 2, "255" }, "12345", 0, 0, 18, "" }, + /* 20*/ { 0, 0, { 1, 2, "1234" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 538: Structured Append ID too long (3 digit maximum)" }, + /* 21*/ { 0, 0, { 1, 2, "A" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 539: Invalid Structured Append ID (digits only)" }, + /* 22*/ { 0, 0, { 1, 2, "256" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 530: Structured Append ID '256' out of range (0-255)" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -134,15 +145,21 @@ static void test_options(int index, int debug) { assert_nonnull(symbol, "Symbol not created\n"); length = testUtilSetSymbol(symbol, BARCODE_GRIDMATRIX, -1 /*input_mode*/, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug); + if (data[i].structapp.count) { + symbol->structapp = data[i].structapp; + } ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret_encode, symbol->errtxt); + if (ret < ZINT_ERROR) { + assert_equal(symbol->width, data[i].expected_size, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_size); + assert_equal(symbol->rows, data[i].expected_size, "i:%d symbol->rows %d != %d\n", i, symbol->rows, data[i].expected_size); + } + assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d symbol->errtxt %s != %s\n", i, symbol->errtxt, data[i].expected_errtxt); if (data[i].ret_vector != -1) { ret = ZBarcode_Buffer_Vector(symbol, 0); assert_equal(ret, data[i].ret_vector, "i:%d ZBarcode_Buffer_Vector ret %d != %d\n", i, ret, data[i].ret_vector); - assert_equal(symbol->width, data[i].expected_size, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_size); - assert_equal(symbol->rows, data[i].expected_size, "i:%d symbol->rows %d != %d\n", i, symbol->rows, data[i].expected_size); } ZBarcode_Delete(symbol); @@ -158,6 +175,7 @@ static void test_input(int index, int generate, int debug) { int eci; int output_options; int option_3; + struct zint_structapp structapp; char *data; int ret; int expected_eci; @@ -170,117 +188,122 @@ static void test_input(int index, int generate, int debug) { // ㈩ U+3229 in GB 2312 0x226E // 一 U+4E00 in GB 2312 0x523B struct item data[] = { - /* 0*/ { UNICODE_MODE, 0, -1, -1, "é", 0, 0, "30 01 69 00", "B1 (ISO 8859-1)" }, - /* 1*/ { UNICODE_MODE, 3, -1, -1, "é", 0, 3, "60 01 58 00 74 40", "ECI-3 B1 (ISO 8859-1)" }, - /* 2*/ { UNICODE_MODE, 29, -1, -1, "é", 0, 29, "60 0E 44 2A 37 7C 00", "ECI-29 H1 (GB 2312)" }, - /* 3*/ { UNICODE_MODE, 26, -1, -1, "é", 0, 26, "60 0D 18 01 61 6A 20", "ECI-26 B2 (UTF-8)" }, - /* 4*/ { UNICODE_MODE, 26, -1, ZINT_FULL_MULTIBYTE, "é", 0, 26, "60 0D 05 28 4F 7C 00", "ECI-26 H1 (UTF-8) (full multibyte)" }, - /* 5*/ { DATA_MODE, 0, -1, -1, "é", 0, 0, "30 03 43 54 40", "B2 (UTF-8)" }, - /* 6*/ { DATA_MODE, 0, -1, ZINT_FULL_MULTIBYTE, "é", 0, 0, "0A 51 1F 78 00", "H1 (UTF-8) (full multibyte)" }, - /* 7*/ { DATA_MODE, 0, -1, -1, "\351", 0, 0, "30 01 69 00", "B1 (ISO 8859-1) (0xE9)" }, - /* 8*/ { UNICODE_MODE, 0, -1, -1, "β", 0, 0, "08 40 2F 78 00", "H1 (GB 2312)" }, - /* 9*/ { UNICODE_MODE, 9, -1, -1, "β", 0, 9, "60 04 58 00 71 00", "ECI-9 B1 (ISO 8859-7)" }, - /* 10*/ { UNICODE_MODE, 29, -1, -1, "β", 0, 29, "60 0E 44 20 17 7C 00", "ECI-29 H1 (GB 2312)" }, - /* 11*/ { UNICODE_MODE, 26, -1, -1, "β", 0, 26, "60 0D 18 01 67 2C 40", "ECI-26 H1 (UTF-8)" }, - /* 12*/ { UNICODE_MODE, 26, -1, ZINT_FULL_MULTIBYTE, "β", 0, 26, "60 0D 05 6B 17 7C 00", "ECI-26 H1 (UTF-8) (full multibyte)" }, - /* 13*/ { DATA_MODE, 0, -1, -1, "β", 0, 0, "30 03 4E 59 00", "B2 (UTF-8)" }, - /* 14*/ { DATA_MODE, 0, -1, ZINT_FULL_MULTIBYTE, "β", 0, 0, "0B 56 2F 78 00", "H1 (UTF-8) (full multibyte)" }, - /* 15*/ { UNICODE_MODE, 0, -1, -1, "ÿ", 0, 0, "30 01 7F 00", "B1 (ISO 8859-1)" }, - /* 16*/ { UNICODE_MODE, 0, -1, -1, "ÿÿÿ", 0, 0, "30 05 7F 7F 7F 60", "B3 (ISO 8859-1)" }, - /* 17*/ { UNICODE_MODE, 0, -1, -1, "㈩一", 0, 0, "08 15 68 0E 7F 70 00", "H2 (GB 2312)" }, - /* 18*/ { UNICODE_MODE, 29, -1, -1, "㈩一", 0, 29, "60 0E 44 0A 74 07 3F 78 00", "ECI-29 H2 (GB 2312)" }, - /* 19*/ { DATA_MODE, 0, -1, -1, "\177\177", 0, 0, "30 02 7F 3F 40", "B2 (ASCII)" }, - /* 20*/ { DATA_MODE, 0, -1, -1, "\177\177\177", 0, 0, "30 04 7F 3F 5F 60", "B3 (ASCII)" }, - /* 21*/ { UNICODE_MODE, 0, -1, -1, "123", 0, 0, "10 1E 7F 68", "N3 (ASCII)" }, - /* 22*/ { UNICODE_MODE, 0, -1, -1, " 123", 0, 0, "11 7A 03 6F 7D 00", "N4 (ASCII)" }, - /* 23*/ { UNICODE_MODE, 0, -1, -1, "1+23", 0, 0, "11 7B 03 6F 7D 00", "N4 (ASCII)" }, - /* 24*/ { UNICODE_MODE, 0, -1, -1, "12.3", 0, 0, "11 7C 63 6F 7D 00", "N4 (ASCII)" }, - /* 25*/ { UNICODE_MODE, 0, -1, -1, "123,", 0, 0, "10 1E 7F 73 76 5E 60", "N3 L1 (ASCII)" }, - /* 26*/ { UNICODE_MODE, 0, -1, -1, "123,4", 0, 0, "14 1E 7F 51 48 3F 50", "N5 (ASCII)" }, - /* 27*/ { UNICODE_MODE, 0, -1, -1, "\015\012123", 0, 0, "11 7D 63 6F 7D 00", "N4 (ASCII) (EOL)" }, - /* 28*/ { UNICODE_MODE, 0, -1, -1, "1\015\01223", 0, 0, "11 7E 03 6F 7D 00", "N4 (ASCII) (EOL)" }, - /* 29*/ { UNICODE_MODE, 0, -1, -1, "12\015\0123", 0, 0, "11 7E 23 6F 7D 00", "N4 (ASCII) (EOL)" }, - /* 30*/ { UNICODE_MODE, 0, -1, -1, "123\015\012", 0, 0, "10 1E 7F 7C 01 06 42 40", "N3 B2 (ASCII) (EOL)" }, - /* 31*/ { UNICODE_MODE, 0, -1, -1, "123\015\0124", 0, 0, "14 1E 7F 5D 48 3F 50", "N5 (ASCII) (EOL)" }, - /* 32*/ { UNICODE_MODE, 0, -1, -1, "2.2.0", 0, 0, "15 7C 46 73 78 40 07 7A", "N5 (ASCII)" }, - /* 33*/ { UNICODE_MODE, 0, -1, -1, "2.2.0.5", 0, 0, "30 0C 32 17 0C 45 63 01 38 6A 00", "B7 (ASCII)" }, - /* 34*/ { UNICODE_MODE, 0, -1, -1, "2.2.0.56", 0, 0, "13 7C 46 73 78 40 07 71 46 0F 74", "N8 (ASCII)" }, - /* 35*/ { UNICODE_MODE, 0, -1, -1, "20.12.13.\015\012", 0, 0, "11 7C 66 27 79 0D 2F 7F 00 45 60 68 28 00", "N8 B3 (ASCII)" }, - /* 36*/ { UNICODE_MODE, 0, -1, -1, "ABCDE\011F", 0, 0, "20 01 08 32 3E 49 17 30", "U7 (ASCII)" }, - /* 37*/ { UNICODE_MODE, 0, -1, -1, "1 1234ABCD12.2abcd-12", 0, 0, "13 7A 23 41 2A 3F 68 01 08 3E 4F 66 1E 5F 70 00 44 1F 2F 6E 0F 0F 74", "N6 U4 N4 L4 N3 (ASCII)" }, - /* 38*/ { UNICODE_MODE, 0, -1, -1, "1 123ABCDE12.2abcd-12", 0, 0, "28 1F 40 42 06 28 59 43 27 01 05 7D 56 42 49 16 34 7F 6D 30 08 2F 60", "M21 (ASCII)" }, - /* 39*/ { UNICODE_MODE, 0, -1, -1, "国外通信教材 Matlab6.5", 0, 0, "09 63 27 20 4E 24 1F 05 21 58 22 13 7E 1E 4C 78 09 56 00 3D 3F 4A 45 3F 50", "H6 U2 L5 N3 (GB 2312) (Same as D.2 example)" }, - /* 40*/ { UNICODE_MODE, 0, -1, -1, "AAT", 0, 0, "20 00 4F 30", "U3 (ASCII)" }, - /* 41*/ { UNICODE_MODE, 0, -1, -1, "aat", 0, 0, "18 00 4F 30", "L3 (ASCII)" }, - /* 42*/ { UNICODE_MODE, 0, -1, -1, "AAT2556", 0, 0, "20 00 4F 58 7F 65 47 7A", "U3 N4 (ASCII) (note same bit count as M7)" }, - /* 43*/ { UNICODE_MODE, 0, -1, -1, "AAT2556 ", 0, 0, "29 22 4E 42 0A 14 37 6F 60", "M8 (ASCII)" }, - /* 44*/ { UNICODE_MODE, 0, -1, -1, "AAT2556 电", 0, 0, "29 22 4E 42 0A 14 37 6F 62 2C 1F 7E 00", "M8 H1 (GB 2312)" }, - /* 45*/ { UNICODE_MODE, 0, -1, -1, " 200", 0, 0, "11 7A 06 23 7D 00", "N4 (ASCII)" }, - /* 46*/ { UNICODE_MODE, 0, -1, -1, " 200mA至", 0, 0, "2F 60 40 00 60 2B 78 63 41 7F 40", "M6 H1 (GB 2312)" }, - /* 47*/ { UNICODE_MODE, 0, -1, -1, "2A tel:86 019 82512738", 0, 0, "28 22 5F 4F 29 48 5F 6D 7E 6F 55 57 1F 28 63 0F 5A 11 64 0F 74", "M2 L5(with control) N15 (ASCII)" }, - /* 48*/ { UNICODE_MODE, 0, -1, -1, "至2A tel:86 019 82512738", 0, 0, "30 07 56 60 4C 48 13 6A 32 17 7B 3F 5B 75 35 67 6A 18 63 76 44 39 03 7D 00", "B4 L5(with control) N15 (GB 2312)" }, - /* 49*/ { UNICODE_MODE, 0, -1, -1, "AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738", 0, 0, "(62) 29 22 22 1C 4E 41 42 7E 0A 40 14 00 37 7E 6F 00 62 7E 2C 00 1C 7E 4B 00 41 7E 18 00", "M8 H11 M6 B4 L5(with control) N15 (GB 2312) (*NOT SAME* as D3 example Figure D.1, M8 H11 M6 H1 M3 L4(with control) N15, which uses a few more bits)" }, - /* 50*/ { UNICODE_MODE, 0, -1, -1, "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::", 0, 0, "(588) 37 68 68 68 68 68 74 7E 74 74 74 74 74 3A 3A 3A 3A 3A 3A 3A 1D 1D 1D 1D 1D 1D 1D 0E", "B512 (ASCII)" }, - /* 51*/ { UNICODE_MODE, 0, -1, -1, "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::\177", 0, 0, "(591) 37 68 68 68 68 68 74 7E 74 74 74 74 74 3A 3A 3A 3A 3A 3A 3A 1D 1D 1D 1D 1D 1D 1D 0E", "B513 (ASCII)" }, - /* 52*/ { UNICODE_MODE, 0, -1, -1, ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::至", 0, 0, "(591) 37 68 68 68 68 68 74 7C 74 74 74 74 74 3A 3A 3A 3A 3A 3A 3A 1D 1D 1D 1D 1D 1D 1D 0E", "B511 H1 (GB 2312)" }, - /* 53*/ { UNICODE_MODE, 0, -1, -1, ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::至:", 0, 0, "(592) 37 68 68 68 68 68 74 7E 74 74 74 74 74 3A 3A 3A 3A 3A 3A 3A 1D 1D 1D 1D 1D 1D 1D 0E", "B513 (GB 2312)" }, - /* 54*/ { UNICODE_MODE, 0, -1, -1, "电电123456", 0, 0, "09 30 72 61 7F 70 41 76 72 1F 68", "H2 (GB 2312) N6" }, - /* 55*/ { UNICODE_MODE, 0, -1, -1, "电电abcdef", 0, 0, "09 30 72 61 7F 71 00 08 43 10 5D 40", "H2 (GB 2312) L6" }, - /* 56*/ { UNICODE_MODE, 0, -1, -1, "电电电电电\011\011\011", 0, 0, "09 30 72 61 65 43 4B 07 16 0F 7F 14 02 04 42 21 10", "H5 (GB 2312) B3" }, - /* 57*/ { UNICODE_MODE, 0, -1, -1, "1234567电电", 0, 0, "14 1E 6E 22 5E 3F 59 30 72 61 7F 70 00", "N7 H2 (GB 2312)" }, - /* 58*/ { UNICODE_MODE, 0, -1, -1, "12345678mA 2", 0, 0, "12 1E 6E 23 06 3F 76 02 5F 02 7E 00", "N8 M4" }, - /* 59*/ { UNICODE_MODE, 0, -1, -1, "ABCDEFG电电", 0, 0, "20 01 08 32 0A 37 05 43 4B 07 7F 40", "U7 H2 (GB 2312)" }, - /* 60*/ { UNICODE_MODE, 0, -1, -1, "ABCDEFGHIJ8mA 2", 0, 0, "20 01 08 32 0A 31 68 27 70 46 02 5F 02 7E 00", "U10 M5" }, - /* 61*/ { UNICODE_MODE, 0, -1, -1, "ABCDEFGHIJ\011\011\011\011", 0, 0, "20 01 08 32 0A 31 68 27 78 03 04 42 21 10 48 00", "U10 B4" }, - /* 62*/ { UNICODE_MODE, 0, -1, -1, "8mA B123456789", 0, 0, "29 0C 05 3E 17 7C 40 7B 39 0C 2B 7E 40", "M5 N9" }, - /* 63*/ { UNICODE_MODE, 0, -1, -1, "8mA aABCDEFGH", 0, 0, "29 0C 05 3E 49 7D 00 04 21 48 29 47 6C", "M5 U8" }, - /* 64*/ { UNICODE_MODE, 0, -1, -1, "\011\011\011\011123456", 0, 0, "30 06 09 04 42 21 12 03 6D 64 3F 50", "B4 N6" }, - /* 65*/ { UNICODE_MODE, 0, -1, -1, "\011\011\011\011ABCDEF", 0, 0, "30 06 09 04 42 21 14 00 11 06 21 3B", "B4 U6" }, - /* 66*/ { UNICODE_MODE, 0, -1, -1, "\011\011\011\0118mA 2", 0, 0, "30 06 09 04 42 21 15 11 40 57 60 5F 40", "B4 M5" }, - /* 67*/ { UNICODE_MODE, 0, -1, -1, "电电电电电\015\012", 0, 0, "09 30 72 61 65 43 4B 07 16 0F 73 03 7E 00", "H7 (GB 2312)" }, - /* 68*/ { UNICODE_MODE, 0, -1, -1, "电电电电电12", 0, 0, "09 30 72 61 65 43 4B 07 16 0F 7B 37 7E 00", "H7 (GB 2312)" }, - /* 69*/ { UNICODE_MODE, 0, -1, -1, "1234567.8\015\012123456", 0, 0, "10 1E 6E 23 79 30 67 77 0F 37 11 7E 40", "N17" }, - /* 70*/ { UNICODE_MODE, 0, -1, -1, "˘", ZINT_WARN_USES_ECI, 4, "Warning 60 02 18 00 51 00", "ECI-4 B1 (ISO 8859-2)" }, - /* 71*/ { UNICODE_MODE, 4, -1, -1, "˘", 0, 4, "60 02 18 00 51 00", "ECI-4 B1 (ISO 8859-2)" }, - /* 72*/ { UNICODE_MODE, 0, -1, -1, "Ħ", ZINT_WARN_USES_ECI, 5, "Warning 60 02 58 00 50 40", "ECI-5 B1 (ISO 8859-3)" }, - /* 73*/ { UNICODE_MODE, 5, -1, -1, "Ħ", 0, 5, "60 02 58 00 50 40", "ECI-5 B1 (ISO 8859-3)" }, - /* 74*/ { UNICODE_MODE, 6, -1, -1, "ĸ", 0, 6, "60 03 18 00 51 00", "ECI-6 B1 (ISO 8859-4)" }, - /* 75*/ { UNICODE_MODE, 7, -1, -1, "Ж", 0, 7, "60 03 58 00 5B 00", "ECI-7 B1 (ISO 8859-5)" }, - /* 76*/ { UNICODE_MODE, 0, -1, -1, "Ș", ZINT_WARN_USES_ECI, 18, "Warning 60 09 18 00 55 00", "ECI-18 B1 (ISO 8859-16)" }, - /* 77*/ { UNICODE_MODE, 18, -1, -1, "Ș", 0, 18, "60 09 18 00 55 00", "ECI-18 B1 (ISO 8859-16)" }, - /* 78*/ { UNICODE_MODE, 0, -1, -1, "テ", 0, 0, "08 34 6F 78 00", "H1 (GB 2312)" }, - /* 79*/ { UNICODE_MODE, 20, -1, -1, "テ", 0, 20, "60 0A 18 01 41 59 20", "ECI-20 B2 (SHIFT JIS)" }, - /* 80*/ { UNICODE_MODE, 20, -1, -1, "テテ", 0, 20, "60 0A 18 03 41 59 30 36 28 00", "ECI-20 B4 (SHIFT JIS)" }, - /* 81*/ { UNICODE_MODE, 20, -1, -1, "\\\\", 0, 20, "60 0A 18 03 40 57 70 15 78 00", "ECI-20 B4 (SHIFT JIS)" }, - /* 82*/ { UNICODE_MODE, 0, -1, -1, "…", 0, 0, "08 01 5F 78 00", "H1 (GB 2312)" }, - /* 83*/ { UNICODE_MODE, 21, -1, -1, "…", 0, 21, "60 0A 58 00 42 40", "ECI-21 B1 (Win 1250)" }, - /* 84*/ { UNICODE_MODE, 0, -1, -1, "Ґ", ZINT_WARN_USES_ECI, 22, "Warning 60 0B 18 00 52 40", "ECI-22 B1 (Win 1251)" }, - /* 85*/ { UNICODE_MODE, 22, -1, -1, "Ґ", 0, 22, "60 0B 18 00 52 40", "ECI-22 B1 (Win 1251)" }, - /* 86*/ { UNICODE_MODE, 0, -1, -1, "˜", ZINT_WARN_USES_ECI, 23, "Warning 60 0B 58 00 4C 00", "ECI-23 B1 (Win 1252)" }, - /* 87*/ { UNICODE_MODE, 23, -1, -1, "˜", 0, 23, "60 0B 58 00 4C 00", "ECI-23 B1 (Win 1252)" }, - /* 88*/ { UNICODE_MODE, 24, -1, -1, "پ", 0, 24, "60 0C 18 00 40 40", "ECI-24 B1 (Win 1256)" }, - /* 89*/ { UNICODE_MODE, 0, -1, -1, "က", ZINT_WARN_USES_ECI, 26, "Warning 60 0D 18 02 70 60 10 00", "ECI-26 B3 (UTF-8)" }, - /* 90*/ { UNICODE_MODE, 25, -1, -1, "က", 0, 25, "60 0C 58 01 08 00 00", "ECI-25 B2 (UCS-2BE)" }, - /* 91*/ { UNICODE_MODE, 25, -1, -1, "ကက", 0, 25, "60 0C 58 03 08 00 02 00 00 00", "ECI-25 B4 (UCS-2BE)" }, - /* 92*/ { UNICODE_MODE, 25, -1, -1, "12", 0, 25, "60 0C 58 03 00 0C 20 03 10 00", "ECI-25 B4 (UCS-2BE ASCII)" }, - /* 93*/ { UNICODE_MODE, 27, -1, -1, "@", 0, 27, "60 0D 4F 77 2E 60", "ECI-27 L1 (ASCII)" }, - /* 94*/ { UNICODE_MODE, 0, -1, -1, "龘", ZINT_WARN_USES_ECI, 26, "Warning 60 0D 18 02 74 6F 53 00", "ECI-26 B3 (UTF-8)" }, - /* 95*/ { UNICODE_MODE, 28, -1, -1, "龘", 0, 28, "60 0E 18 01 7C 75 20", "ECI-28 B2 (Big5)" }, - /* 96*/ { UNICODE_MODE, 28, -1, -1, "龘龘", 0, 28, "60 0E 18 03 7C 75 3F 1D 28 00", "ECI-28 B4 (Big5)" }, - /* 97*/ { UNICODE_MODE, 0, -1, -1, "齄", 0, 0, "0F 4B 6F 78 00", "H1 (GB 2312)" }, - /* 98*/ { UNICODE_MODE, 29, -1, -1, "齄", 0, 29, "60 0E 47 65 77 7C 00", "ECI-29 H1 (GB 2312)" }, - /* 99*/ { UNICODE_MODE, 29, -1, -1, "齄齄", 0, 29, "60 0E 47 65 77 4B 6F 78 00", "ECI-29 H2 (GB 2312)" }, - /*100*/ { UNICODE_MODE, 0, -1, -1, "가", ZINT_WARN_USES_ECI, 26, "Warning 60 0D 18 02 75 2C 10 00", "ECI-26 B3 (UTF-8)" }, - /*101*/ { UNICODE_MODE, 30, -1, -1, "가", 0, 30, "60 0F 18 01 58 28 20", "ECI-30 B2 (EUC-KR)" }, - /*102*/ { UNICODE_MODE, 30, -1, -1, "가가", 0, 30, "60 0F 18 03 58 28 36 0A 08 00", "ECI-30 B4 (EUC-KR)" }, - /*103*/ { UNICODE_MODE, 170, -1, -1, "?", 0, 170, "60 55 0F 77 26 60", "ECI-170 L1 (ASCII invariant)" }, - /*104*/ { DATA_MODE, 899, -1, -1, "\200", 0, 899, "63 41 58 00 40 00", "ECI-899 B1 (8-bit binary)" }, - /*105*/ { UNICODE_MODE, 900, -1, -1, "é", 0, 900, "63 42 18 01 61 6A 20", "ECI-900 B2 (no conversion)" }, - /*106*/ { UNICODE_MODE, 1024, -1, -1, "é", 0, 1024, "64 08 00 30 03 43 54 40", "ECI-1024 B2 (no conversion)" }, - /*107*/ { UNICODE_MODE, 32768, -1, -1, "é", 0, 32768, "66 08 00 01 40 0E 0E 52 00", "ECI-32768 B2 (no conversion)" }, - /*108*/ { UNICODE_MODE, 811800, -1, -1, "é", ZINT_ERROR_INVALID_OPTION, 811800, "Error 533: Invalid ECI", "" }, - /*109*/ { UNICODE_MODE, 3, -1, -1, "β", ZINT_ERROR_INVALID_DATA, 3, "Error 535: Invalid character in input data for ECI 3", "" }, - /*110*/ { UNICODE_MODE, 0, READER_INIT, -1, "12", 0, 0, "51 11 71 7E 40", "" }, + /* 0*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "é", 0, 0, "30 01 69 00", "B1 (ISO 8859-1)" }, + /* 1*/ { UNICODE_MODE, 3, -1, -1, { 0, 0, "" }, "é", 0, 3, "60 01 58 00 74 40", "ECI-3 B1 (ISO 8859-1)" }, + /* 2*/ { UNICODE_MODE, 29, -1, -1, { 0, 0, "" }, "é", 0, 29, "60 0E 44 2A 37 7C 00", "ECI-29 H1 (GB 2312)" }, + /* 3*/ { UNICODE_MODE, 26, -1, -1, { 0, 0, "" }, "é", 0, 26, "60 0D 18 01 61 6A 20", "ECI-26 B2 (UTF-8)" }, + /* 4*/ { UNICODE_MODE, 26, -1, ZINT_FULL_MULTIBYTE, { 0, 0, "" }, "é", 0, 26, "60 0D 05 28 4F 7C 00", "ECI-26 H1 (UTF-8) (full multibyte)" }, + /* 5*/ { DATA_MODE, 0, -1, -1, { 0, 0, "" }, "é", 0, 0, "30 03 43 54 40", "B2 (UTF-8)" }, + /* 6*/ { DATA_MODE, 0, -1, ZINT_FULL_MULTIBYTE, { 0, 0, "" }, "é", 0, 0, "0A 51 1F 78 00", "H1 (UTF-8) (full multibyte)" }, + /* 7*/ { DATA_MODE, 0, -1, -1, { 0, 0, "" }, "\351", 0, 0, "30 01 69 00", "B1 (ISO 8859-1) (0xE9)" }, + /* 8*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "β", 0, 0, "08 40 2F 78 00", "H1 (GB 2312)" }, + /* 9*/ { UNICODE_MODE, 9, -1, -1, { 0, 0, "" }, "β", 0, 9, "60 04 58 00 71 00", "ECI-9 B1 (ISO 8859-7)" }, + /* 10*/ { UNICODE_MODE, 29, -1, -1, { 0, 0, "" }, "β", 0, 29, "60 0E 44 20 17 7C 00", "ECI-29 H1 (GB 2312)" }, + /* 11*/ { UNICODE_MODE, 26, -1, -1, { 0, 0, "" }, "β", 0, 26, "60 0D 18 01 67 2C 40", "ECI-26 H1 (UTF-8)" }, + /* 12*/ { UNICODE_MODE, 26, -1, ZINT_FULL_MULTIBYTE, { 0, 0, "" }, "β", 0, 26, "60 0D 05 6B 17 7C 00", "ECI-26 H1 (UTF-8) (full multibyte)" }, + /* 13*/ { DATA_MODE, 0, -1, -1, { 0, 0, "" }, "β", 0, 0, "30 03 4E 59 00", "B2 (UTF-8)" }, + /* 14*/ { DATA_MODE, 0, -1, ZINT_FULL_MULTIBYTE, { 0, 0, "" }, "β", 0, 0, "0B 56 2F 78 00", "H1 (UTF-8) (full multibyte)" }, + /* 15*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "ÿ", 0, 0, "30 01 7F 00", "B1 (ISO 8859-1)" }, + /* 16*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "ÿÿÿ", 0, 0, "30 05 7F 7F 7F 60", "B3 (ISO 8859-1)" }, + /* 17*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "㈩一", 0, 0, "08 15 68 0E 7F 70 00", "H2 (GB 2312)" }, + /* 18*/ { UNICODE_MODE, 29, -1, -1, { 0, 0, "" }, "㈩一", 0, 29, "60 0E 44 0A 74 07 3F 78 00", "ECI-29 H2 (GB 2312)" }, + /* 19*/ { DATA_MODE, 0, -1, -1, { 0, 0, "" }, "\177\177", 0, 0, "30 02 7F 3F 40", "B2 (ASCII)" }, + /* 20*/ { DATA_MODE, 0, -1, -1, { 0, 0, "" }, "\177\177\177", 0, 0, "30 04 7F 3F 5F 60", "B3 (ASCII)" }, + /* 21*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "123", 0, 0, "10 1E 7F 68", "N3 (ASCII)" }, + /* 22*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, " 123", 0, 0, "11 7A 03 6F 7D 00", "N4 (ASCII)" }, + /* 23*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "1+23", 0, 0, "11 7B 03 6F 7D 00", "N4 (ASCII)" }, + /* 24*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "12.3", 0, 0, "11 7C 63 6F 7D 00", "N4 (ASCII)" }, + /* 25*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "123,", 0, 0, "10 1E 7F 73 76 5E 60", "N3 L1 (ASCII)" }, + /* 26*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "123,4", 0, 0, "14 1E 7F 51 48 3F 50", "N5 (ASCII)" }, + /* 27*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "\015\012123", 0, 0, "11 7D 63 6F 7D 00", "N4 (ASCII) (EOL)" }, + /* 28*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "1\015\01223", 0, 0, "11 7E 03 6F 7D 00", "N4 (ASCII) (EOL)" }, + /* 29*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "12\015\0123", 0, 0, "11 7E 23 6F 7D 00", "N4 (ASCII) (EOL)" }, + /* 30*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "123\015\012", 0, 0, "10 1E 7F 7C 01 06 42 40", "N3 B2 (ASCII) (EOL)" }, + /* 31*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "123\015\0124", 0, 0, "14 1E 7F 5D 48 3F 50", "N5 (ASCII) (EOL)" }, + /* 32*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "2.2.0", 0, 0, "15 7C 46 73 78 40 07 7A", "N5 (ASCII)" }, + /* 33*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "2.2.0.5", 0, 0, "30 0C 32 17 0C 45 63 01 38 6A 00", "B7 (ASCII)" }, + /* 34*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "2.2.0.56", 0, 0, "13 7C 46 73 78 40 07 71 46 0F 74", "N8 (ASCII)" }, + /* 35*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "20.12.13.\015\012", 0, 0, "11 7C 66 27 79 0D 2F 7F 00 45 60 68 28 00", "N8 B3 (ASCII)" }, + /* 36*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "ABCDE\011F", 0, 0, "20 01 08 32 3E 49 17 30", "U7 (ASCII)" }, + /* 37*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "1 1234ABCD12.2abcd-12", 0, 0, "13 7A 23 41 2A 3F 68 01 08 3E 4F 66 1E 5F 70 00 44 1F 2F 6E 0F 0F 74", "N6 U4 N4 L4 N3 (ASCII)" }, + /* 38*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "1 123ABCDE12.2abcd-12", 0, 0, "28 1F 40 42 06 28 59 43 27 01 05 7D 56 42 49 16 34 7F 6D 30 08 2F 60", "M21 (ASCII)" }, + /* 39*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "国外通信教材 Matlab6.5", 0, 0, "09 63 27 20 4E 24 1F 05 21 58 22 13 7E 1E 4C 78 09 56 00 3D 3F 4A 45 3F 50", "H6 U2 L5 N3 (GB 2312) (Same as D.2 example)" }, + /* 40*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "AAT", 0, 0, "20 00 4F 30", "U3 (ASCII)" }, + /* 41*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "aat", 0, 0, "18 00 4F 30", "L3 (ASCII)" }, + /* 42*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "AAT2556", 0, 0, "20 00 4F 58 7F 65 47 7A", "U3 N4 (ASCII) (note same bit count as M7)" }, + /* 43*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "AAT2556 ", 0, 0, "29 22 4E 42 0A 14 37 6F 60", "M8 (ASCII)" }, + /* 44*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "AAT2556 电", 0, 0, "29 22 4E 42 0A 14 37 6F 62 2C 1F 7E 00", "M8 H1 (GB 2312)" }, + /* 45*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, " 200", 0, 0, "11 7A 06 23 7D 00", "N4 (ASCII)" }, + /* 46*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, " 200mA至", 0, 0, "2F 60 40 00 60 2B 78 63 41 7F 40", "M6 H1 (GB 2312)" }, + /* 47*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "2A tel:86 019 82512738", 0, 0, "28 22 5F 4F 29 48 5F 6D 7E 6F 55 57 1F 28 63 0F 5A 11 64 0F 74", "M2 L5(with control) N15 (ASCII)" }, + /* 48*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "至2A tel:86 019 82512738", 0, 0, "30 07 56 60 4C 48 13 6A 32 17 7B 3F 5B 75 35 67 6A 18 63 76 44 39 03 7D 00", "B4 L5(with control) N15 (GB 2312)" }, + /* 49*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738", 0, 0, "(62) 29 22 22 1C 4E 41 42 7E 0A 40 14 00 37 7E 6F 00 62 7E 2C 00 1C 7E 4B 00 41 7E 18 00", "M8 H11 M6 B4 L5(with control) N15 (GB 2312) (*NOT SAME* as D3 example Figure D.1, M8 H11 M6 H1 M3 L4(with control) N15, which uses a few more bits)" }, + /* 50*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::", 0, 0, "(588) 37 68 68 68 68 68 74 7E 74 74 74 74 74 3A 3A 3A 3A 3A 3A 3A 1D 1D 1D 1D 1D 1D 1D 0E", "B512 (ASCII)" }, + /* 51*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::\177", 0, 0, "(591) 37 68 68 68 68 68 74 7E 74 74 74 74 74 3A 3A 3A 3A 3A 3A 3A 1D 1D 1D 1D 1D 1D 1D 0E", "B513 (ASCII)" }, + /* 52*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::至", 0, 0, "(591) 37 68 68 68 68 68 74 7C 74 74 74 74 74 3A 3A 3A 3A 3A 3A 3A 1D 1D 1D 1D 1D 1D 1D 0E", "B511 H1 (GB 2312)" }, + /* 53*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::至:", 0, 0, "(592) 37 68 68 68 68 68 74 7E 74 74 74 74 74 3A 3A 3A 3A 3A 3A 3A 1D 1D 1D 1D 1D 1D 1D 0E", "B513 (GB 2312)" }, + /* 54*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "电电123456", 0, 0, "09 30 72 61 7F 70 41 76 72 1F 68", "H2 (GB 2312) N6" }, + /* 55*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "电电abcdef", 0, 0, "09 30 72 61 7F 71 00 08 43 10 5D 40", "H2 (GB 2312) L6" }, + /* 56*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "电电电电电\011\011\011", 0, 0, "09 30 72 61 65 43 4B 07 16 0F 7F 14 02 04 42 21 10", "H5 (GB 2312) B3" }, + /* 57*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "1234567电电", 0, 0, "14 1E 6E 22 5E 3F 59 30 72 61 7F 70 00", "N7 H2 (GB 2312)" }, + /* 58*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "12345678mA 2", 0, 0, "12 1E 6E 23 06 3F 76 02 5F 02 7E 00", "N8 M4" }, + /* 59*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "ABCDEFG电电", 0, 0, "20 01 08 32 0A 37 05 43 4B 07 7F 40", "U7 H2 (GB 2312)" }, + /* 60*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "ABCDEFGHIJ8mA 2", 0, 0, "20 01 08 32 0A 31 68 27 70 46 02 5F 02 7E 00", "U10 M5" }, + /* 61*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "ABCDEFGHIJ\011\011\011\011", 0, 0, "20 01 08 32 0A 31 68 27 78 03 04 42 21 10 48 00", "U10 B4" }, + /* 62*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "8mA B123456789", 0, 0, "29 0C 05 3E 17 7C 40 7B 39 0C 2B 7E 40", "M5 N9" }, + /* 63*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "8mA aABCDEFGH", 0, 0, "29 0C 05 3E 49 7D 00 04 21 48 29 47 6C", "M5 U8" }, + /* 64*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "\011\011\011\011123456", 0, 0, "30 06 09 04 42 21 12 03 6D 64 3F 50", "B4 N6" }, + /* 65*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "\011\011\011\011ABCDEF", 0, 0, "30 06 09 04 42 21 14 00 11 06 21 3B", "B4 U6" }, + /* 66*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "\011\011\011\0118mA 2", 0, 0, "30 06 09 04 42 21 15 11 40 57 60 5F 40", "B4 M5" }, + /* 67*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "电电电电电\015\012", 0, 0, "09 30 72 61 65 43 4B 07 16 0F 73 03 7E 00", "H7 (GB 2312)" }, + /* 68*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "电电电电电12", 0, 0, "09 30 72 61 65 43 4B 07 16 0F 7B 37 7E 00", "H7 (GB 2312)" }, + /* 69*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "1234567.8\015\012123456", 0, 0, "10 1E 6E 23 79 30 67 77 0F 37 11 7E 40", "N17" }, + /* 70*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "˘", ZINT_WARN_USES_ECI, 4, "Warning 60 02 18 00 51 00", "ECI-4 B1 (ISO 8859-2)" }, + /* 71*/ { UNICODE_MODE, 4, -1, -1, { 0, 0, "" }, "˘", 0, 4, "60 02 18 00 51 00", "ECI-4 B1 (ISO 8859-2)" }, + /* 72*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "Ħ", ZINT_WARN_USES_ECI, 5, "Warning 60 02 58 00 50 40", "ECI-5 B1 (ISO 8859-3)" }, + /* 73*/ { UNICODE_MODE, 5, -1, -1, { 0, 0, "" }, "Ħ", 0, 5, "60 02 58 00 50 40", "ECI-5 B1 (ISO 8859-3)" }, + /* 74*/ { UNICODE_MODE, 6, -1, -1, { 0, 0, "" }, "ĸ", 0, 6, "60 03 18 00 51 00", "ECI-6 B1 (ISO 8859-4)" }, + /* 75*/ { UNICODE_MODE, 7, -1, -1, { 0, 0, "" }, "Ж", 0, 7, "60 03 58 00 5B 00", "ECI-7 B1 (ISO 8859-5)" }, + /* 76*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "Ș", ZINT_WARN_USES_ECI, 18, "Warning 60 09 18 00 55 00", "ECI-18 B1 (ISO 8859-16)" }, + /* 77*/ { UNICODE_MODE, 18, -1, -1, { 0, 0, "" }, "Ș", 0, 18, "60 09 18 00 55 00", "ECI-18 B1 (ISO 8859-16)" }, + /* 78*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "テ", 0, 0, "08 34 6F 78 00", "H1 (GB 2312)" }, + /* 79*/ { UNICODE_MODE, 20, -1, -1, { 0, 0, "" }, "テ", 0, 20, "60 0A 18 01 41 59 20", "ECI-20 B2 (SHIFT JIS)" }, + /* 80*/ { UNICODE_MODE, 20, -1, -1, { 0, 0, "" }, "テテ", 0, 20, "60 0A 18 03 41 59 30 36 28 00", "ECI-20 B4 (SHIFT JIS)" }, + /* 81*/ { UNICODE_MODE, 20, -1, -1, { 0, 0, "" }, "\\\\", 0, 20, "60 0A 18 03 40 57 70 15 78 00", "ECI-20 B4 (SHIFT JIS)" }, + /* 82*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "…", 0, 0, "08 01 5F 78 00", "H1 (GB 2312)" }, + /* 83*/ { UNICODE_MODE, 21, -1, -1, { 0, 0, "" }, "…", 0, 21, "60 0A 58 00 42 40", "ECI-21 B1 (Win 1250)" }, + /* 84*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "Ґ", ZINT_WARN_USES_ECI, 22, "Warning 60 0B 18 00 52 40", "ECI-22 B1 (Win 1251)" }, + /* 85*/ { UNICODE_MODE, 22, -1, -1, { 0, 0, "" }, "Ґ", 0, 22, "60 0B 18 00 52 40", "ECI-22 B1 (Win 1251)" }, + /* 86*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "˜", ZINT_WARN_USES_ECI, 23, "Warning 60 0B 58 00 4C 00", "ECI-23 B1 (Win 1252)" }, + /* 87*/ { UNICODE_MODE, 23, -1, -1, { 0, 0, "" }, "˜", 0, 23, "60 0B 58 00 4C 00", "ECI-23 B1 (Win 1252)" }, + /* 88*/ { UNICODE_MODE, 24, -1, -1, { 0, 0, "" }, "پ", 0, 24, "60 0C 18 00 40 40", "ECI-24 B1 (Win 1256)" }, + /* 89*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "က", ZINT_WARN_USES_ECI, 26, "Warning 60 0D 18 02 70 60 10 00", "ECI-26 B3 (UTF-8)" }, + /* 90*/ { UNICODE_MODE, 25, -1, -1, { 0, 0, "" }, "က", 0, 25, "60 0C 58 01 08 00 00", "ECI-25 B2 (UCS-2BE)" }, + /* 91*/ { UNICODE_MODE, 25, -1, -1, { 0, 0, "" }, "ကက", 0, 25, "60 0C 58 03 08 00 02 00 00 00", "ECI-25 B4 (UCS-2BE)" }, + /* 92*/ { UNICODE_MODE, 25, -1, -1, { 0, 0, "" }, "12", 0, 25, "60 0C 58 03 00 0C 20 03 10 00", "ECI-25 B4 (UCS-2BE ASCII)" }, + /* 93*/ { UNICODE_MODE, 27, -1, -1, { 0, 0, "" }, "@", 0, 27, "60 0D 4F 77 2E 60", "ECI-27 L1 (ASCII)" }, + /* 94*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "龘", ZINT_WARN_USES_ECI, 26, "Warning 60 0D 18 02 74 6F 53 00", "ECI-26 B3 (UTF-8)" }, + /* 95*/ { UNICODE_MODE, 28, -1, -1, { 0, 0, "" }, "龘", 0, 28, "60 0E 18 01 7C 75 20", "ECI-28 B2 (Big5)" }, + /* 96*/ { UNICODE_MODE, 28, -1, -1, { 0, 0, "" }, "龘龘", 0, 28, "60 0E 18 03 7C 75 3F 1D 28 00", "ECI-28 B4 (Big5)" }, + /* 97*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "齄", 0, 0, "0F 4B 6F 78 00", "H1 (GB 2312)" }, + /* 98*/ { UNICODE_MODE, 29, -1, -1, { 0, 0, "" }, "齄", 0, 29, "60 0E 47 65 77 7C 00", "ECI-29 H1 (GB 2312)" }, + /* 99*/ { UNICODE_MODE, 29, -1, -1, { 0, 0, "" }, "齄齄", 0, 29, "60 0E 47 65 77 4B 6F 78 00", "ECI-29 H2 (GB 2312)" }, + /*100*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "가", ZINT_WARN_USES_ECI, 26, "Warning 60 0D 18 02 75 2C 10 00", "ECI-26 B3 (UTF-8)" }, + /*101*/ { UNICODE_MODE, 30, -1, -1, { 0, 0, "" }, "가", 0, 30, "60 0F 18 01 58 28 20", "ECI-30 B2 (EUC-KR)" }, + /*102*/ { UNICODE_MODE, 30, -1, -1, { 0, 0, "" }, "가가", 0, 30, "60 0F 18 03 58 28 36 0A 08 00", "ECI-30 B4 (EUC-KR)" }, + /*103*/ { UNICODE_MODE, 170, -1, -1, { 0, 0, "" }, "?", 0, 170, "60 55 0F 77 26 60", "ECI-170 L1 (ASCII invariant)" }, + /*104*/ { DATA_MODE, 899, -1, -1, { 0, 0, "" }, "\200", 0, 899, "63 41 58 00 40 00", "ECI-899 B1 (8-bit binary)" }, + /*105*/ { UNICODE_MODE, 900, -1, -1, { 0, 0, "" }, "é", 0, 900, "63 42 18 01 61 6A 20", "ECI-900 B2 (no conversion)" }, + /*106*/ { UNICODE_MODE, 1024, -1, -1, { 0, 0, "" }, "é", 0, 1024, "64 08 00 30 03 43 54 40", "ECI-1024 B2 (no conversion)" }, + /*107*/ { UNICODE_MODE, 32768, -1, -1, { 0, 0, "" }, "é", 0, 32768, "66 08 00 01 40 0E 0E 52 00", "ECI-32768 B2 (no conversion)" }, + /*108*/ { UNICODE_MODE, 811800, -1, -1, { 0, 0, "" }, "é", ZINT_ERROR_INVALID_OPTION, 811800, "Error 533: Invalid ECI", "" }, + /*109*/ { UNICODE_MODE, 3, -1, -1, { 0, 0, "" }, "β", ZINT_ERROR_INVALID_DATA, 3, "Error 535: Invalid character in input data for ECI 3", "" }, + /*110*/ { UNICODE_MODE, 0, READER_INIT, -1, { 0, 0, "" }, "12", 0, 0, "51 11 71 7E 40", "" }, + /*111*/ { UNICODE_MODE, 0, -1, -1, { 1, 16, "" }, "12", 0, 0, "48 03 60 24 3C 3F 50", "FNC2 ID0 Cnt15 Ind0 N2" }, + /*112*/ { UNICODE_MODE, 0, READER_INIT, -1, { 1, 16, "" }, "12", 0, 0, "54 40 1E 02 23 63 7D 00", "FNC3 FNC2 ID0 Cnt15 Ind0 N2" }, + /*113*/ { UNICODE_MODE, 0, -1, -1, { 2, 16, "" }, "12", 0, 0, "48 03 62 24 3C 3F 50", "FNC2 ID0 Cnt15 Ind1 N2" }, + /*114*/ { UNICODE_MODE, 0, READER_INIT, -1, { 2, 16, "" }, "12", 0, 0, "48 03 62 24 3C 3F 50", "FNC2 ID0 Cnt15 Ind1 N2 (FNC3 omitted)" }, + /*115*/ { UNICODE_MODE, 0, -1, -1, { 3, 3, "255" }, "12", 0, 0, "4F 7C 44 24 3C 3F 50", "FNC2 ID256 Cnt2 Ind2 N2" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -300,13 +323,17 @@ static void test_input(int index, int generate, int debug) { debug |= ZINT_DEBUG_TEST; // Needed to get codeword dump in errtxt length = testUtilSetSymbol(symbol, BARCODE_GRIDMATRIX, data[i].input_mode, data[i].eci, -1 /*option_1*/, -1, data[i].option_3, data[i].output_options, data[i].data, -1, debug); + if (data[i].structapp.count) { + symbol->structapp = data[i].structapp; + } ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d\n", i, ret, data[i].ret); if (generate) { - printf(" /*%3d*/ { %s, %d, %s, %s, \"%s\", %s, %d, \"%s\", \"%s\" },\n", + printf(" /*%3d*/ { %s, %d, %s, %s, { %d, %d, \"%s\" }, \"%s\", %s, %d, \"%s\", \"%s\" },\n", i, testUtilInputModeName(data[i].input_mode), data[i].eci, testUtilOutputOptionsName(data[i].output_options), testUtilOption3Name(data[i].option_3), + data[i].structapp.index, data[i].structapp.count, data[i].structapp.id, testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), testUtilErrorName(data[i].ret), ret < ZINT_ERROR ? symbol->eci : -1, symbol->errtxt, data[i].comment); } else { diff --git a/backend/tests/test_library.c b/backend/tests/test_library.c index 55c83a84..67d93950 100644 --- a/backend/tests/test_library.c +++ b/backend/tests/test_library.c @@ -471,11 +471,11 @@ static void test_cap(int index) { /* 0*/ { BARCODE_CODE128, ZINT_CAP_HRT, ZINT_CAP_HRT }, /* 1*/ { BARCODE_CODE128, ZINT_CAP_HRT | ZINT_CAP_STACKABLE | ZINT_CAP_GS1, ZINT_CAP_HRT | ZINT_CAP_STACKABLE }, /* 2*/ { BARCODE_PDF417, ZINT_CAP_HRT | ZINT_CAP_ECI | ZINT_CAP_GS1 | ZINT_CAP_READER_INIT | ZINT_CAP_FULL_MULTIBYTE, ZINT_CAP_ECI | ZINT_CAP_READER_INIT }, - /* 3*/ { BARCODE_QRCODE, ZINT_CAP_HRT | ZINT_CAP_ECI | ZINT_CAP_GS1 | ZINT_CAP_DOTTY | ZINT_CAP_READER_INIT | ZINT_CAP_FULL_MULTIBYTE | ZINT_CAP_MASK, ZINT_CAP_ECI | ZINT_CAP_GS1 | ZINT_CAP_DOTTY | ZINT_CAP_FULL_MULTIBYTE | ZINT_CAP_MASK }, + /* 3*/ { BARCODE_QRCODE, ZINT_CAP_HRT | ZINT_CAP_ECI | ZINT_CAP_GS1 | ZINT_CAP_DOTTY | ZINT_CAP_READER_INIT | ZINT_CAP_FULL_MULTIBYTE | ZINT_CAP_MASK | ZINT_CAP_STRUCTAPP, ZINT_CAP_ECI | ZINT_CAP_GS1 | ZINT_CAP_DOTTY | ZINT_CAP_FULL_MULTIBYTE | ZINT_CAP_MASK | ZINT_CAP_STRUCTAPP }, /* 4*/ { BARCODE_EANX_CC, ZINT_CAP_HRT | ZINT_CAP_COMPOSITE | ZINT_CAP_EXTENDABLE | ZINT_CAP_ECI | ZINT_CAP_GS1 | ZINT_CAP_QUIET_ZONES, ZINT_CAP_HRT | ZINT_CAP_COMPOSITE | ZINT_CAP_EXTENDABLE | ZINT_CAP_GS1 | ZINT_CAP_QUIET_ZONES }, /* 5*/ { BARCODE_HANXIN, ZINT_CAP_DOTTY | ZINT_CAP_QUIET_ZONES | ZINT_CAP_FIXED_RATIO | ZINT_CAP_FULL_MULTIBYTE | ZINT_CAP_MASK, ZINT_CAP_DOTTY | ZINT_CAP_FIXED_RATIO | ZINT_CAP_FULL_MULTIBYTE | ZINT_CAP_MASK }, /* 6*/ { BARCODE_CODE11, ZINT_CAP_DOTTY | ZINT_CAP_FIXED_RATIO | ZINT_CAP_FIXED_RATIO | ZINT_CAP_READER_INIT | ZINT_CAP_FULL_MULTIBYTE, 0 }, - /* 7*/ { BARCODE_POSTNET, ZINT_CAP_HRT | ZINT_CAP_STACKABLE | ZINT_CAP_EXTENDABLE | ZINT_CAP_COMPOSITE | ZINT_CAP_ECI | ZINT_CAP_GS1 | ZINT_CAP_DOTTY | ZINT_CAP_FIXED_RATIO | ZINT_CAP_READER_INIT | ZINT_CAP_FULL_MULTIBYTE | ZINT_CAP_MASK, 0 }, + /* 7*/ { BARCODE_POSTNET, ZINT_CAP_HRT | ZINT_CAP_STACKABLE | ZINT_CAP_EXTENDABLE | ZINT_CAP_COMPOSITE | ZINT_CAP_ECI | ZINT_CAP_GS1 | ZINT_CAP_DOTTY | ZINT_CAP_FIXED_RATIO | ZINT_CAP_READER_INIT | ZINT_CAP_FULL_MULTIBYTE | ZINT_CAP_MASK | ZINT_CAP_STRUCTAPP, 0 }, /* 8*/ { 0, 0, 0 }, }; int data_size = ARRAY_SIZE(data); diff --git a/backend/tests/test_maxicode.c b/backend/tests/test_maxicode.c index 5096b9fa..3f7f11ba 100644 --- a/backend/tests/test_maxicode.c +++ b/backend/tests/test_maxicode.c @@ -122,6 +122,7 @@ static void test_input(int index, int generate, int debug) { int eci; int option_1; int option_2; + struct zint_structapp structapp; char *data; int length; char *primary; @@ -131,50 +132,56 @@ static void test_input(int index, int generate, int debug) { char *comment; }; struct item data[] = { - /* 0*/ { UNICODE_MODE, -1, -1, -1, "A", -1, "", 0, 30, "(144) 04 01 21 21 21 21 21 21 21 21 08 0E 19 2B 20 0C 24 06 32 1C 21 21 21 21 21 21 21 21", "" }, - /* 1*/ { UNICODE_MODE, -1, 2, -1, "A", -1, "", ZINT_ERROR_INVALID_DATA, 0, "Error 551: Invalid length for Primary Message", "" }, - /* 2*/ { UNICODE_MODE, -1, 2, -1, "A", -1, "A123456", ZINT_ERROR_INVALID_DATA, 0, "Error 555: Non-numeric postcode in Primary Message", "" }, - /* 3*/ { UNICODE_MODE, -1, 2, -1, "A", -1, "1123456", 0, 30, "(144) 12 00 00 00 00 10 30 1E 20 1C 1A 3D 1C 0D 1B 15 3C 17 3C 08 01 21 21 21 21 21 21 21", "1-digit postcode" }, - /* 4*/ { UNICODE_MODE, -1, 2, -1, "A", -1, "1 123456", 0, 30, "(144) 12 00 00 00 00 10 30 1E 20 1C 1A 3D 1C 0D 1B 15 3C 17 3C 08 01 21 21 21 21 21 21 21", "1-digit postcode" }, - /* 5*/ { UNICODE_MODE, -1, 2, -1, "A", -1, "123456789123456", 0, 30, "(144) 12 05 0D 2F 35 11 32 1E 20 1C 0D 1D 3B 12 22 3F 30 14 23 1A 01 21 21 21 21 21 21 21", "9-digit postcode" }, - /* 6*/ { UNICODE_MODE, -1, 2, -1, "A", -1, "1234567890123456", ZINT_ERROR_INVALID_DATA, 0, "Error 551: Invalid length for Primary Message", "10-digit postcode" }, - /* 7*/ { UNICODE_MODE, -1, -1, -1, "A", -1, "1123456", 0, 30, "(144) 12 00 00 00 00 10 30 1E 20 1C 1A 3D 1C 0D 1B 15 3C 17 3C 08 01 21 21 21 21 21 21 21", "1-digit postcode" }, - /* 8*/ { UNICODE_MODE, -1, -1, -1, "A", -1, "123456789123456", 0, 30, "(144) 12 05 0D 2F 35 11 32 1E 20 1C 0D 1D 3B 12 22 3F 30 14 23 1A 01 21 21 21 21 21 21 21", "9-digit postcode" }, - /* 9*/ { UNICODE_MODE, -1, -1, -1, "A", -1, "1234567890123456", ZINT_ERROR_INVALID_DATA, 0, "Error 551: Invalid length for Primary Message", "10-digit postcode" }, - /* 10*/ { UNICODE_MODE, -1, -1, -1, "A", -1, "123456", ZINT_ERROR_INVALID_DATA, 0, "Error 551: Invalid length for Primary Message", "0-digit postcode" }, - /* 11*/ { UNICODE_MODE, -1, -1, -1, "A", -1, "12345678123456", 0, 30, "(144) 22 13 21 31 0B 00 32 1E 20 1C 04 14 07 30 10 07 08 28 1D 09 01 21 21 21 21 21 21 21", "8-digit postcode" }, - /* 12*/ { UNICODE_MODE, -1, 3, -1, "A", -1, "", ZINT_ERROR_INVALID_DATA, 0, "Error 551: Invalid length for Primary Message", "" }, - /* 13*/ { UNICODE_MODE, -1, 3, -1, "A", -1, "A123456", 0, 30, "(144) 03 08 08 08 08 18 30 1E 20 1C 22 35 1C 0F 02 1A 26 04 10 31 01 21 21 21 21 21 21 21", "1-alphanumeric postcode" }, - /* 14*/ { UNICODE_MODE, -1, 3, -1, "A", -1, "1123456", 0, 30, "(144) 03 08 08 08 08 18 3C 1E 20 1C 13 37 07 2C 26 2D 18 29 3F 2C 01 21 21 21 21 21 21 21", "1-digit postcode" }, - /* 15*/ { UNICODE_MODE, -1, -1, -1, "A", -1, "A123456", 0, 30, "(144) 03 08 08 08 08 18 30 1E 20 1C 22 35 1C 0F 02 1A 26 04 10 31 01 21 21 21 21 21 21 21", "1-alphanumeric postcode" }, - /* 16*/ { UNICODE_MODE, -1, -1, -1, "A", -1, "ABCDEF123456", 0, 30, "(144) 23 11 01 31 20 10 30 1E 20 1C 3C 1D 22 03 19 15 0F 20 0F 2A 01 21 21 21 21 21 21 21", "6-alphanumeric postcode" }, - /* 17*/ { UNICODE_MODE, -1, -1, -1, "A", -1, "ABCDEFG123456", 0, 30, "(144) 23 11 01 31 20 10 30 1E 20 1C 3C 1D 22 03 19 15 0F 20 0F 2A 01 21 21 21 21 21 21 21", "7-alphanumeric postcode truncated" }, - /* 18*/ { UNICODE_MODE, -1, -1, -1, "A", -1, "ABCDE123456", 0, 30, "(144) 03 18 01 31 20 10 30 1E 20 1C 0F 38 38 1A 39 10 2F 37 22 12 01 21 21 21 21 21 21 21", "5-alphanumeric postcode" }, - /* 19*/ { UNICODE_MODE, -1, -1, -1, "A", -1, "AAAAAA 840001", 0, 30, "(144) 13 10 10 10 10 10 00 12 07 00 17 36 2E 38 04 29 16 0D 27 16 01 21 21 21 21 21 21 21", "6-alphanumeric postcode with padding" }, - /* 20*/ { UNICODE_MODE, -1, -1, -1, "A", -1, "AAAAA A840001", 0, 30, "(144) 03 18 10 10 10 10 00 12 07 00 19 07 29 31 26 01 23 2C 2E 07 01 21 21 21 21 21 21 21", "7-alphanumeric with embedded padding truncated" }, - /* 21*/ { UNICODE_MODE, -1, -1, -1, "A", -1, "AA\015AAA840001", ZINT_ERROR_INVALID_DATA, 0, "Error 556: Invalid character in postcode in Primary Message", "Alphanumeric postcode with CR" }, - /* 22*/ { UNICODE_MODE, -1, -1, -1, "A", -1, "A#%-/A840001", 0, 30, "(144) 13 30 1B 1B 39 18 00 12 07 00 3F 1E 25 07 2A 1E 14 3C 28 2D 01 21 21 21 21 21 21 21", "Alphanumeric postcode with non-control Code A chars" }, - /* 23*/ { UNICODE_MODE, -1, -1, -1, "A", -1, "1A23456", ZINT_ERROR_INVALID_DATA, 0, "Error 552: Non-numeric country code or service class in Primary Message", "Non-numeric country code" }, - /* 24*/ { UNICODE_MODE, -1, -1, -1, "A", -1, "12345678912345A", ZINT_ERROR_INVALID_DATA, 0, "Error 552: Non-numeric country code or service class in Primary Message", "Non-numeric service class" }, - /* 25*/ { UNICODE_MODE, -1, 0, -1, "A", -1, "123456789123456", 0, 30, "(144) 12 05 0D 2F 35 11 32 1E 20 1C 0D 1D 3B 12 22 3F 30 14 23 1A 01 21 21 21 21 21 21 21", "Auto-determine mode 2" }, - /* 26*/ { UNICODE_MODE, -1, 0, -1, "A", -1, "", ZINT_ERROR_INVALID_DATA, 0, "Error 554: Primary Message empty", "Auto-determine mode 2/3 requires primary message" }, - /* 27*/ { UNICODE_MODE, -1, 0, -1, "A", -1, "A23456123456", 0, 30, "(144) 23 1D 0D 3D 2C 1C 30 1E 20 1C 24 35 30 31 2A 0D 17 14 16 3D 01 21 21 21 21 21 21 21", "Auto-determine mode 3" }, - /* 28*/ { UNICODE_MODE, -1, -1, 100, "A", -1, "123456123456", 0, 30, "(144) 02 10 22 07 00 20 31 1E 20 1C 0E 29 13 1B 0D 26 36 25 3B 22 3B 2A 29 3B 28 1E 30 31", "SCM prefix version" }, - /* 29*/ { UNICODE_MODE, -1, -1, 101, "A", -1, "123456123456", ZINT_ERROR_INVALID_OPTION, 0, "Error 557: Invalid SCM prefix version", "SCM prefix version" }, - /* 30*/ { UNICODE_MODE, 3, -1, -1, "A", -1, "", 0, 30, "(144) 04 1B 03 01 21 21 21 21 21 21 2F 14 23 21 05 24 27 00 24 0C 21 21 21 21 21 21 21 21", "" }, - /* 31*/ { UNICODE_MODE, 31, -1, -1, "A", -1, "", 0, 30, "(144) 04 1B 1F 01 21 21 21 21 21 21 00 2F 0E 09 39 3B 24 1A 21 05 21 21 21 21 21 21 21 21", "ECI 0x1F" }, - /* 32*/ { UNICODE_MODE, 32, -1, -1, "A", -1, "", 0, 30, "(144) 04 1B 20 20 01 21 21 21 21 21 3D 15 0F 30 0D 22 24 35 22 06 21 21 21 21 21 21 21 21", "ECI 0x20" }, - /* 33*/ { UNICODE_MODE, 1023, -1, -1, "A", -1, "", 0, 30, "(144) 04 1B 2F 3F 01 21 21 21 21 21 2E 27 23 1D 35 19 21 04 3A 26 21 21 21 21 21 21 21 21", "ECI 0x3FF" }, - /* 34*/ { UNICODE_MODE, 1024, -1, -1, "A", -1, "", 0, 30, "(144) 04 1B 30 10 00 01 21 21 21 21 11 2F 15 10 1D 29 06 35 14 2B 21 21 21 21 21 21 21 21", "ECI 0x400" }, - /* 35*/ { UNICODE_MODE, 32767, -1, -1, "A", -1, "", 0, 30, "(144) 04 1B 37 3F 3F 01 21 21 21 21 3E 15 12 01 07 30 39 27 04 2B 21 21 21 21 21 21 21 21", "ECI 0x7FFF" }, - /* 36*/ { UNICODE_MODE, 32768, -1, -1, "A", -1, "", 0, 30, "(144) 04 1B 38 08 00 00 01 21 21 21 10 30 3A 04 26 23 0E 21 3D 0F 21 21 21 21 21 21 21 21", "ECI 0x8000" }, - /* 37*/ { UNICODE_MODE, 65535, -1, -1, "A", -1, "", 0, 30, "(144) 04 1B 38 0F 3F 3F 01 21 21 21 1C 0E 1D 39 3B 0D 38 25 00 30 21 21 21 21 21 21 21 21", "ECI 0xFFFF" }, - /* 38*/ { UNICODE_MODE, 65536, -1, -1, "A", -1, "", 0, 30, "(144) 04 1B 38 10 00 00 01 21 21 21 2B 1F 24 06 38 2E 17 1B 10 2F 21 21 21 21 21 21 21 21", "ECI 0x10000" }, - /* 39*/ { UNICODE_MODE, 131071, -1, -1, "A", -1, "", 0, 30, "(144) 04 1B 38 1F 3F 3F 01 21 21 21 0F 05 09 04 2F 3A 17 09 36 31 21 21 21 21 21 21 21 21", "ECI 0x1FFFF" }, - /* 40*/ { UNICODE_MODE, 999999, -1, -1, "A", -1, "", 0, 30, "(144) 04 1B 3B 34 08 3F 01 21 21 21 26 3B 2B 23 08 17 32 05 26 35 21 21 21 21 21 21 21 21", "Max ECI" }, - /* 41*/ { UNICODE_MODE, -1, 1, -1, "A", -1, "", ZINT_ERROR_INVALID_OPTION, 0, "Error 550: Invalid MaxiCode Mode", "" }, - /* 42*/ { UNICODE_MODE, -1, -1, -1, "\015", -1, "", 0, 30, "(144) 04 00 21 21 21 21 21 21 21 21 37 32 10 01 24 1B 10 11 38 0C 21 21 21 21 21 21 21 21", "" }, - /* 43*/ { UNICODE_MODE, -1, -1, -1, "\001\034\001\035\001\036\001a:b", -1, "", 0, 30, "(144) 04 3E 3E 01 20 01 21 01 22 01 27 0B 35 01 08 0D 16 02 17 1A 3F 01 33 02 21 21 21 21", "" }, + /* 0*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "", 0, 30, "(144) 04 01 21 21 21 21 21 21 21 21 08 0E 19 2B 20 0C 24 06 32 1C 21 21 21 21 21 21 21 21", "" }, + /* 1*/ { UNICODE_MODE, -1, 2, -1, { 0, 0, "" }, "A", -1, "", ZINT_ERROR_INVALID_DATA, 0, "Error 551: Invalid length for Primary Message", "" }, + /* 2*/ { UNICODE_MODE, -1, 2, -1, { 0, 0, "" }, "A", -1, "A123456", ZINT_ERROR_INVALID_DATA, 0, "Error 555: Non-numeric postcode in Primary Message", "" }, + /* 3*/ { UNICODE_MODE, -1, 2, -1, { 0, 0, "" }, "A", -1, "1123456", 0, 30, "(144) 12 00 00 00 00 10 30 1E 20 1C 1A 3D 1C 0D 1B 15 3C 17 3C 08 01 21 21 21 21 21 21 21", "1-digit postcode" }, + /* 4*/ { UNICODE_MODE, -1, 2, -1, { 0, 0, "" }, "A", -1, "1 123456", 0, 30, "(144) 12 00 00 00 00 10 30 1E 20 1C 1A 3D 1C 0D 1B 15 3C 17 3C 08 01 21 21 21 21 21 21 21", "1-digit postcode" }, + /* 5*/ { UNICODE_MODE, -1, 2, -1, { 0, 0, "" }, "A", -1, "123456789123456", 0, 30, "(144) 12 05 0D 2F 35 11 32 1E 20 1C 0D 1D 3B 12 22 3F 30 14 23 1A 01 21 21 21 21 21 21 21", "9-digit postcode" }, + /* 6*/ { UNICODE_MODE, -1, 2, -1, { 0, 0, "" }, "A", -1, "1234567890123456", ZINT_ERROR_INVALID_DATA, 0, "Error 551: Invalid length for Primary Message", "10-digit postcode" }, + /* 7*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "1123456", 0, 30, "(144) 12 00 00 00 00 10 30 1E 20 1C 1A 3D 1C 0D 1B 15 3C 17 3C 08 01 21 21 21 21 21 21 21", "1-digit postcode" }, + /* 8*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "123456789123456", 0, 30, "(144) 12 05 0D 2F 35 11 32 1E 20 1C 0D 1D 3B 12 22 3F 30 14 23 1A 01 21 21 21 21 21 21 21", "9-digit postcode" }, + /* 9*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "1234567890123456", ZINT_ERROR_INVALID_DATA, 0, "Error 551: Invalid length for Primary Message", "10-digit postcode" }, + /* 10*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "123456", ZINT_ERROR_INVALID_DATA, 0, "Error 551: Invalid length for Primary Message", "0-digit postcode" }, + /* 11*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "12345678123456", 0, 30, "(144) 22 13 21 31 0B 00 32 1E 20 1C 04 14 07 30 10 07 08 28 1D 09 01 21 21 21 21 21 21 21", "8-digit postcode" }, + /* 12*/ { UNICODE_MODE, -1, 3, -1, { 0, 0, "" }, "A", -1, "", ZINT_ERROR_INVALID_DATA, 0, "Error 551: Invalid length for Primary Message", "" }, + /* 13*/ { UNICODE_MODE, -1, 3, -1, { 0, 0, "" }, "A", -1, "A123456", 0, 30, "(144) 03 08 08 08 08 18 30 1E 20 1C 22 35 1C 0F 02 1A 26 04 10 31 01 21 21 21 21 21 21 21", "1-alphanumeric postcode" }, + /* 14*/ { UNICODE_MODE, -1, 3, -1, { 0, 0, "" }, "A", -1, "1123456", 0, 30, "(144) 03 08 08 08 08 18 3C 1E 20 1C 13 37 07 2C 26 2D 18 29 3F 2C 01 21 21 21 21 21 21 21", "1-digit postcode" }, + /* 15*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "A123456", 0, 30, "(144) 03 08 08 08 08 18 30 1E 20 1C 22 35 1C 0F 02 1A 26 04 10 31 01 21 21 21 21 21 21 21", "1-alphanumeric postcode" }, + /* 16*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "ABCDEF123456", 0, 30, "(144) 23 11 01 31 20 10 30 1E 20 1C 3C 1D 22 03 19 15 0F 20 0F 2A 01 21 21 21 21 21 21 21", "6-alphanumeric postcode" }, + /* 17*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "ABCDEFG123456", 0, 30, "(144) 23 11 01 31 20 10 30 1E 20 1C 3C 1D 22 03 19 15 0F 20 0F 2A 01 21 21 21 21 21 21 21", "7-alphanumeric postcode truncated" }, + /* 18*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "ABCDE123456", 0, 30, "(144) 03 18 01 31 20 10 30 1E 20 1C 0F 38 38 1A 39 10 2F 37 22 12 01 21 21 21 21 21 21 21", "5-alphanumeric postcode" }, + /* 19*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "AAAAAA 840001", 0, 30, "(144) 13 10 10 10 10 10 00 12 07 00 17 36 2E 38 04 29 16 0D 27 16 01 21 21 21 21 21 21 21", "6-alphanumeric postcode with padding" }, + /* 20*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "AAAAA A840001", 0, 30, "(144) 03 18 10 10 10 10 00 12 07 00 19 07 29 31 26 01 23 2C 2E 07 01 21 21 21 21 21 21 21", "7-alphanumeric with embedded padding truncated" }, + /* 21*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "AA\015AAA840001", ZINT_ERROR_INVALID_DATA, 0, "Error 556: Invalid character in postcode in Primary Message", "Alphanumeric postcode with CR" }, + /* 22*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "A#%-/A840001", 0, 30, "(144) 13 30 1B 1B 39 18 00 12 07 00 3F 1E 25 07 2A 1E 14 3C 28 2D 01 21 21 21 21 21 21 21", "Alphanumeric postcode with non-control Code A chars" }, + /* 23*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "1A23456", ZINT_ERROR_INVALID_DATA, 0, "Error 552: Non-numeric country code or service class in Primary Message", "Non-numeric country code" }, + /* 24*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "12345678912345A", ZINT_ERROR_INVALID_DATA, 0, "Error 552: Non-numeric country code or service class in Primary Message", "Non-numeric service class" }, + /* 25*/ { UNICODE_MODE, -1, 0, -1, { 0, 0, "" }, "A", -1, "123456789123456", 0, 30, "(144) 12 05 0D 2F 35 11 32 1E 20 1C 0D 1D 3B 12 22 3F 30 14 23 1A 01 21 21 21 21 21 21 21", "Auto-determine mode 2" }, + /* 26*/ { UNICODE_MODE, -1, 0, -1, { 0, 0, "" }, "A", -1, "", ZINT_ERROR_INVALID_DATA, 0, "Error 554: Primary Message empty", "Auto-determine mode 2/3 requires primary message" }, + /* 27*/ { UNICODE_MODE, -1, 0, -1, { 0, 0, "" }, "A", -1, "A23456123456", 0, 30, "(144) 23 1D 0D 3D 2C 1C 30 1E 20 1C 24 35 30 31 2A 0D 17 14 16 3D 01 21 21 21 21 21 21 21", "Auto-determine mode 3" }, + /* 28*/ { UNICODE_MODE, -1, -1, 100, { 0, 0, "" }, "A", -1, "123456123456", 0, 30, "(144) 02 10 22 07 00 20 31 1E 20 1C 0E 29 13 1B 0D 26 36 25 3B 22 3B 2A 29 3B 28 1E 30 31", "SCM prefix version" }, + /* 29*/ { UNICODE_MODE, -1, -1, 101, { 0, 0, "" }, "A", -1, "123456123456", ZINT_ERROR_INVALID_OPTION, 0, "Error 557: Invalid SCM prefix version", "SCM prefix version" }, + /* 30*/ { UNICODE_MODE, 3, -1, -1, { 0, 0, "" }, "A", -1, "", 0, 30, "(144) 04 1B 03 01 21 21 21 21 21 21 2F 14 23 21 05 24 27 00 24 0C 21 21 21 21 21 21 21 21", "" }, + /* 31*/ { UNICODE_MODE, 31, -1, -1, { 0, 0, "" }, "A", -1, "", 0, 30, "(144) 04 1B 1F 01 21 21 21 21 21 21 00 2F 0E 09 39 3B 24 1A 21 05 21 21 21 21 21 21 21 21", "ECI 0x1F" }, + /* 32*/ { UNICODE_MODE, 32, -1, -1, { 0, 0, "" }, "A", -1, "", 0, 30, "(144) 04 1B 20 20 01 21 21 21 21 21 3D 15 0F 30 0D 22 24 35 22 06 21 21 21 21 21 21 21 21", "ECI 0x20" }, + /* 33*/ { UNICODE_MODE, 1023, -1, -1, { 0, 0, "" }, "A", -1, "", 0, 30, "(144) 04 1B 2F 3F 01 21 21 21 21 21 2E 27 23 1D 35 19 21 04 3A 26 21 21 21 21 21 21 21 21", "ECI 0x3FF" }, + /* 34*/ { UNICODE_MODE, 1024, -1, -1, { 0, 0, "" }, "A", -1, "", 0, 30, "(144) 04 1B 30 10 00 01 21 21 21 21 11 2F 15 10 1D 29 06 35 14 2B 21 21 21 21 21 21 21 21", "ECI 0x400" }, + /* 35*/ { UNICODE_MODE, 32767, -1, -1, { 0, 0, "" }, "A", -1, "", 0, 30, "(144) 04 1B 37 3F 3F 01 21 21 21 21 3E 15 12 01 07 30 39 27 04 2B 21 21 21 21 21 21 21 21", "ECI 0x7FFF" }, + /* 36*/ { UNICODE_MODE, 32768, -1, -1, { 0, 0, "" }, "A", -1, "", 0, 30, "(144) 04 1B 38 08 00 00 01 21 21 21 10 30 3A 04 26 23 0E 21 3D 0F 21 21 21 21 21 21 21 21", "ECI 0x8000" }, + /* 37*/ { UNICODE_MODE, 65535, -1, -1, { 0, 0, "" }, "A", -1, "", 0, 30, "(144) 04 1B 38 0F 3F 3F 01 21 21 21 1C 0E 1D 39 3B 0D 38 25 00 30 21 21 21 21 21 21 21 21", "ECI 0xFFFF" }, + /* 38*/ { UNICODE_MODE, 65536, -1, -1, { 0, 0, "" }, "A", -1, "", 0, 30, "(144) 04 1B 38 10 00 00 01 21 21 21 2B 1F 24 06 38 2E 17 1B 10 2F 21 21 21 21 21 21 21 21", "ECI 0x10000" }, + /* 39*/ { UNICODE_MODE, 131071, -1, -1, { 0, 0, "" }, "A", -1, "", 0, 30, "(144) 04 1B 38 1F 3F 3F 01 21 21 21 0F 05 09 04 2F 3A 17 09 36 31 21 21 21 21 21 21 21 21", "ECI 0x1FFFF" }, + /* 40*/ { UNICODE_MODE, 999999, -1, -1, { 0, 0, "" }, "A", -1, "", 0, 30, "(144) 04 1B 3B 34 08 3F 01 21 21 21 26 3B 2B 23 08 17 32 05 26 35 21 21 21 21 21 21 21 21", "Max ECI" }, + /* 41*/ { UNICODE_MODE, -1, 1, -1, { 0, 0, "" }, "A", -1, "", ZINT_ERROR_INVALID_OPTION, 0, "Error 550: Invalid MaxiCode Mode", "" }, + /* 42*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "\015", -1, "", 0, 30, "(144) 04 00 21 21 21 21 21 21 21 21 37 32 10 01 24 1B 10 11 38 0C 21 21 21 21 21 21 21 21", "" }, + /* 43*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "\001\034\001\035\001\036\001a:b", -1, "", 0, 30, "(144) 04 3E 3E 01 20 01 21 01 22 01 27 0B 35 01 08 0D 16 02 17 1A 3F 01 33 02 21 21 21 21", "" }, + /* 44*/ { UNICODE_MODE, -1, -1, -1, { 1, 2, "" }, "A", -1, "", 0, 30, "(144) 04 21 01 01 21 21 21 21 21 21 09 0B 26 03 37 0E 25 27 07 1E 21 21 21 21 21 21 21 21", "" }, + /* 45*/ { UNICODE_MODE, -1, -1, -1, { 0, 2, "" }, "A", -1, "", ZINT_ERROR_INVALID_OPTION, 0, "Error 559: Structured Append index out of range (1-2)", "" }, + /* 46*/ { UNICODE_MODE, -1, -1, -1, { 1, 1, "" }, "A", -1, "", ZINT_ERROR_INVALID_OPTION, 0, "Error 558: Structured Append count out of range (2-8)", "" }, + /* 47*/ { UNICODE_MODE, -1, -1, -1, { 1, 9, "" }, "A", -1, "", ZINT_ERROR_INVALID_OPTION, 0, "Error 558: Structured Append count out of range (2-8)", "" }, + /* 48*/ { UNICODE_MODE, -1, -1, -1, { 3, 2, "" }, "A", -1, "", ZINT_ERROR_INVALID_OPTION, 0, "Error 559: Structured Append index out of range (1-2)", "" }, + /* 49*/ { UNICODE_MODE, -1, -1, -1, { 1, 2, "A" }, "A", -1, "", ZINT_ERROR_INVALID_OPTION, 0, "Error 549: Structured Append ID not available for MaxiCode", "" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -194,14 +201,18 @@ static void test_input(int index, int generate, int debug) { symbol->debug = ZINT_DEBUG_TEST; // Needed to get codeword dump in errtxt length = testUtilSetSymbol(symbol, BARCODE_MAXICODE, data[i].input_mode, data[i].eci, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug); + if (data[i].structapp.count) { + symbol->structapp = data[i].structapp; + } strcpy(symbol->primary, data[i].primary); 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, %d, \"%s\", %d, \"%s\", %s, %d, \"%s\", \"%s\" },\n", + printf(" /*%3d*/ { %s, %d, %d, %d, { %d, %d, \"%s\" }, \"%s\", %d, \"%s\", %s, %d, \"%s\", \"%s\" },\n", i, testUtilInputModeName(data[i].input_mode), data[i].eci, data[i].option_1, data[i].option_2, + data[i].structapp.index, data[i].structapp.count, data[i].structapp.id, testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), data[i].length, data[i].primary, testUtilErrorName(data[i].ret), symbol->width, symbol->errtxt, data[i].comment); } else { @@ -223,6 +234,7 @@ static void test_encode(int index, int generate, int debug) { int input_mode; int option_1; int option_2; + struct zint_structapp structapp; char *data; int length; char *primary; @@ -235,7 +247,7 @@ static void test_encode(int index, int generate, int debug) { char *expected; }; struct item data[] = { - /* 0*/ { -1, -1, -1, "THIS IS A 93 CHARACTER CODE SET A MESSAGE THAT FILLS A MODE 4, UNAPPENDED, MAXICODE SYMBOL...", -1, "", 0, 33, 30, 1, "ISO/IEC 16023:2000 Figure 2 (and L1), same", + /* 0*/ { -1, -1, -1, { 0, 0, "" }, "THIS IS A 93 CHARACTER CODE SET A MESSAGE THAT FILLS A MODE 4, UNAPPENDED, MAXICODE SYMBOL...", -1, "", 0, 33, 30, 1, "ISO/IEC 16023:2000 Figure 2 (and L1), same", "011111010000001000001000100111" "000100000001000000001010000000" "001011001100100110110010010010" @@ -270,7 +282,7 @@ static void test_encode(int index, int generate, int debug) { "001001101111101101101010011100" "001011000000111101100100001000" }, - /* 1*/ { -1, 4, -1, "MaxiCode (19 chars)", -1, "", 0, 33, 30, 0, "ISO/IEC 16023:2000 Figure H1 **NOT SAME** different encodation (figure uses '3 Shift A' among other differences); BWIPP different encodation again", + /* 1*/ { -1, 4, -1, { 0, 0, "" }, "MaxiCode (19 chars)", -1, "", 0, 33, 30, 0, "ISO/IEC 16023:2000 Figure H1 **NOT SAME** different encodation (figure uses '3 Shift A' among other differences); BWIPP different encodation again", "001101011111011100000010101111" "101100010001001100010000001100" "101100001010001111001001111101" @@ -305,7 +317,7 @@ static void test_encode(int index, int generate, int debug) { "010110010110001110100000010100" "010011110011000001010111100111" }, - /* 2*/ { DATA_MODE | ESCAPE_MODE, 2, 96, "1Z00004951\\GUPSN\\G06X610\\G159\\G1234567\\G1/1\\G\\GY\\G634 ALPHA DR\\GPITTSBURGH\\GPA\\R\\E", -1, "152382802840001", 0, 33, 30, 0, "ISO/IEC 16023:2000 Figure B2 **NOT SAME** uses different encodation (figure uses Latch B/Latch A instead of Shift B for '>\\R', and precedes PAD chars with Latch B); BWIPP different encodation again", + /* 2*/ { DATA_MODE | ESCAPE_MODE, 2, 96, { 0, 0, "" }, "1Z00004951\\GUPSN\\G06X610\\G159\\G1234567\\G1/1\\G\\GY\\G634 ALPHA DR\\GPITTSBURGH\\GPA\\R\\E", -1, "152382802840001", 0, 33, 30, 0, "ISO/IEC 16023:2000 Figure B2 **NOT SAME** uses different encodation (figure precedes PAD chars with Latch B); BWIPP different encodation again", "110101110110111110111111101111" "010101010111000011011000010010" "110110110001001010101010010011" @@ -340,7 +352,7 @@ static void test_encode(int index, int generate, int debug) { "010110101101000001111000100110" "110110100000010000001011110011" }, - /* 3*/ { -1, 3, -1, "CEN", -1, "B1050056999", 0, 33, 30, 1, "ISO/IEC 16023:2000 B.1 Example (primary only given, data arbitrary); verified manually against tec-it", + /* 3*/ { -1, 3, -1, { 0, 0, "" }, "CEN", -1, "B1050056999", 0, 33, 30, 1, "ISO/IEC 16023:2000 B.1 Example (primary only given, data arbitrary); verified manually against tec-it", "000000010101010101010101010111" "001011000000000000000000000010" "111001101010101010101010101000" @@ -375,7 +387,7 @@ static void test_encode(int index, int generate, int debug) { "010010001001110010000101000010" "010001011010000011010010011100" }, - /* 4*/ { UNICODE_MODE | ESCAPE_MODE, -1, -1, "Comité Européen de Normalisation\034rue de Stassart 36\034B-1050 BRUXELLES\034TEL +3225196811", -1, "", 0, 33, 30, 0, "ISO/IEC 16023:2000 Example F.5 **NOT SAME** uses different encodation (2 Shift A among other things); BWIPP different encodation again", + /* 4*/ { UNICODE_MODE | ESCAPE_MODE, -1, -1, { 0, 0, "" }, "Comité Européen de Normalisation\034rue de Stassart 36\034B-1050 BRUXELLES\034TEL +3225196811", -1, "", 0, 33, 30, 0, "ISO/IEC 16023:2000 Example F.5 **NOT SAME** uses different encodation (2 Shift A among other things); BWIPP different encodation again", "010010100010110000000100001111" "001010001100110110111110100110" "001010011100101010011100100000" @@ -410,7 +422,7 @@ static void test_encode(int index, int generate, int debug) { "001011110011100001001001101100" "000010111011111010110011000011" }, - /* 5*/ { -1, -1, -1, "999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999", -1, "", 0, 33, 30, 1, "Numeric compaction, verified manually against tec-it", + /* 5*/ { -1, -1, -1, { 0, 0, "" }, "999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999", -1, "", 0, 33, 30, 1, "Numeric compaction, verified manually against tec-it", "010111101101010111101101010111" "111011110110111011110110111010" "001111111101001111111101001100" @@ -445,7 +457,7 @@ static void test_encode(int index, int generate, int debug) { "111010101011001101111001011010" "011110011111000011101011111011" }, - /* 6*/ { -1, 5, -1, "\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\037\237\240\242\243\244\245\246\247\251\255\256\266\225\226\227\230\231\232\233\234\235\236", 51, "", 0, 33, 30, 1, "Mode 5 set E", + /* 6*/ { -1, 5, -1, { 0, 0, "" }, "\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\037\237\240\242\243\244\245\246\247\251\255\256\266\225\226\227\230\231\232\233\234\235\236", 51, "", 0, 33, 30, 1, "Mode 5 set E", "000000000000000000101010101011" "100101010111111111000000001010" "110010011100100111001001110010" @@ -480,7 +492,7 @@ static void test_encode(int index, int generate, int debug) { "100111110000101000000001110100" "100101010010100000010101000111" }, - /* 7*/ { -1, 6, -1, "\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377\241\250\253\257\260\264\267\270\273\277\212\213\214\215\216\217\220\221\222\223\224", -1, "", 0, 33, 30, 1, "Mode 6 set D", + /* 7*/ { -1, 6, -1, { 0, 0, "" }, "\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377\241\250\253\257\260\264\267\270\273\277\212\213\214\215\216\217\220\221\222\223\224", -1, "", 0, 33, 30, 1, "Mode 6 set D", "000000000000000000101010101011" "100101010111111111000000001010" "110010011100100111001001110001" @@ -515,7 +527,7 @@ static void test_encode(int index, int generate, int debug) { "011111001010000101000011000110" "101111010010011100100011110010" }, - /* 8*/ { -1, 6, -1, "\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\252\254\261\262\263\265\271\272\274\275\276\200\201\202\203\204\205\206\207\210\211", -1, "", 0, 33, 30, 1, "Mode 6 set C", + /* 8*/ { -1, 6, -1, { 0, 0, "" }, "\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\252\254\261\262\263\265\271\272\274\275\276\200\201\202\203\204\205\206\207\210\211", -1, "", 0, 33, 30, 1, "Mode 6 set C", "000000000000000000101010101011" "100101010111111111000000001010" "110010011100100111001001110001" @@ -550,7 +562,7 @@ static void test_encode(int index, int generate, int debug) { "011111001010000101000011000110" "101111010010011100100011110010" }, - /* 9*/ { UNICODE_MODE, 4, -1, "ABCDabcdAabcABabcABCabcABCDaABCabABCabcABCéa", -1, "", 0, 33, 30, 1, "Mode 4 LCHB SHA 2SHA 3SHA LCHA SHB LCHB 3SHA 3SHA SHD", + /* 9*/ { UNICODE_MODE, 4, -1, { 0, 0, "" }, "ABCDabcdAabcABabcABCabcABCDaABCabABCabcABCéa", -1, "", 0, 33, 30, 1, "Mode 4 LCHB SHA 2SHA 3SHA LCHA SHB LCHB 3SHA 3SHA SHD", "110000000011000000000011000011" "010000000001000000000001000000" "111010011100100110011110100101" @@ -585,7 +597,7 @@ static void test_encode(int index, int generate, int debug) { "110001000010011110111101111000" "011010011011111110001000000010" }, - /* 10*/ { UNICODE_MODE, 4, -1, "ÀÁÂÃ1", -1, "", 0, 33, 30, 1, "Mode 4 LCKC LCHA", + /* 10*/ { UNICODE_MODE, 4, -1, { 0, 0, "" }, "ÀÁÂÃ1", -1, "", 0, 33, 30, 1, "Mode 4 LCKC LCHA", "010101010101010101010101010111" "000000000000000000000000000000" "101010101010101010101010101010" @@ -620,7 +632,7 @@ static void test_encode(int index, int generate, int debug) { "010110101111010110101010111100" "010100000000010110101010010100" }, - /* 11*/ { UNICODE_MODE, 4, -1, "ÀÁÂÃ123456789", -1, "", 0, 33, 30, 1, "Mode 4 LCKC NS", + /* 11*/ { UNICODE_MODE, 4, -1, { 0, 0, "" }, "ÀÁÂÃ123456789", -1, "", 0, 33, 30, 1, "Mode 4 LCKC NS", "111110110101010101010101010111" "111010010000000000000000000000" "000010011010101010101010101000" @@ -655,7 +667,7 @@ static void test_encode(int index, int generate, int debug) { "000000111100011110100001110000" "101000000010100111001011110101" }, - /* 12*/ { UNICODE_MODE, 4, -1, "àáâã1", -1, "", 0, 33, 30, 1, "Mode 4 LCKD LCHA", + /* 12*/ { UNICODE_MODE, 4, -1, { 0, 0, "" }, "àáâã1", -1, "", 0, 33, 30, 1, "Mode 4 LCKD LCHA", "010101010101010101010101010111" "000000000000000000000000000000" "101010101010101010101010101010" @@ -690,7 +702,7 @@ static void test_encode(int index, int generate, int debug) { "010110101111010110101010111100" "010100000000010110101010010100" }, - /* 13*/ { UNICODE_MODE, 4, -1, "¢£¤¥1", -1, "", 0, 33, 30, 1, "Mode 4 LCKE LCHA", + /* 13*/ { UNICODE_MODE, 4, -1, { 0, 0, "" }, "¢£¤¥1", -1, "", 0, 33, 30, 1, "Mode 4 LCKE LCHA", "010101010101010101010101010111" "000000000000000000000000000000" "101010101010101010101010101010" @@ -725,7 +737,7 @@ static void test_encode(int index, int generate, int debug) { "010110101111010110101010111100" "010100000000010110101010010100" }, - /* 14*/ { UNICODE_MODE, 4, -1, "¢£¤¥123456789", -1, "", 0, 33, 30, 1, "Mode 4 LCKE NS", + /* 14*/ { UNICODE_MODE, 4, -1, { 0, 0, "" }, "¢£¤¥123456789", -1, "", 0, 33, 30, 1, "Mode 4 LCKE NS", "111110110101010101010101010111" "111010010000000000000000000000" "000010011010101010101010101000" @@ -760,7 +772,7 @@ static void test_encode(int index, int generate, int debug) { "000000111100011110100001110000" "101000000010100111001011110101" }, - /* 15*/ { UNICODE_MODE, 4, -1, "ABCDE12abcde1ÀÁÂ⣤¥1àáâãabcde123A123456789àáâ㢣¤¥abc", -1, "", 0, 33, 30, 1, "Mode 4 mixed sets", + /* 15*/ { UNICODE_MODE, 4, -1, { 0, 0, "" }, "ABCDE12abcde1ÀÁÂ⣤¥1àáâãabcde123A123456789àáâ㢣¤¥abc", -1, "", 0, 33, 30, 1, "Mode 4 mixed sets", "000000001111111100000000111111" "000010100100111100000000111100" "011100101110000000100111010100" @@ -795,6 +807,76 @@ static void test_encode(int index, int generate, int debug) { "100011000001110011101110101000" "001001110010111101100100010001" }, + /* 16*/ { UNICODE_MODE, 4, -1, { 3, 7, "" }, "THIS IS A 91 CHARACTER CODE SET A MESSAGE THAT FILLS A MODE 4, APPENDED, MAXICODE SYMBOL...", -1, "", 0, 33, 30, 1, "Mode 4 Structured Append", + "010001111101000000100000100011" + "000000010000000100000000101000" + "001000101000110010011011001000" + "000100011000100100000000011000" + "110000001010000010101100000010" + "100010000010110010001111000100" + "001010000000011000001001000010" + "100000001010001001001000100110" + "101111101110000000100000011010" + "000100010011101000000110000010" + "110000000111100010001100111100" + "100010001010000000000011000010" + "000000001010000000010101110101" + "111010110000000000010100101100" + "110010111100000000001100000011" + "000010010000000000001010000100" + "111000001000000000001000000000" + "011000010000000000001100100000" + "000000001100000000011001010000" + "101010010100000000000111001100" + "001000000000000000001000001001" + "000000000010000000000000100000" + "101011000110011011000001010001" + "100011111010000001000010001000" + "011010000000000101011111110010" + "000001110011111111111010100000" + "001110100111000101011001001100" + "011010010100110111100101011100" + "101101001001011111000110110111" + "110001110110110001000011001010" + "011100001000111100110111011110" + "010101011101100110111011100100" + "011001000011110011011110111010" + }, + /* 17*/ { UNICODE_MODE, 3, -1, { 1, 8, "" }, "COMMISSION FOR EUROPEAN NORMALIZATION, RUE DE STASSART 36, B-1050 BRUXELLES", -1, "B1050056999", 0, 33, 30, 1, "Mode 3 Structured Append", + "010000000000001010000000010011" + "001000111111010000011111001000" + "101111111010101111101101000101" + "000001000000100010100001100010" + "111100110010001100101000001110" + "110100011010001101101000011100" + "100000000010001000000001011010" + "001100110101001001111111000010" + "011010001001100010110100000111" + "100100000111100000100101001000" + "000010100001110000010100101010" + "110010001000000011010000101000" + "100010111100000000100010001001" + "100000001100000000011000000000" + "001011100100000000011111100100" + "010111011000000000000011011010" + "001110101000000000001000001000" + "000001110000000000001011000000" + "000111010000000000011111111101" + "001100101000000000011100100010" + "011010111100000000001000100000" + "000010101110000000011110000110" + "111001101110000001111000000000" + "001000101011011001000101010000" + "000010010101010101010000111101" + "111000000000000000001110100000" + "001011101010101010101000100010" + "001100110110100101101100010110" + "111100110000110110000010011001" + "011100011110101010001100000000" + "011001100010001111111000101001" + "011111110000111010001010001100" + "110010001001001011011111100111" + }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -816,14 +898,19 @@ static void test_encode(int index, int generate, int debug) { assert_nonnull(symbol, "Symbol not created\n"); length = testUtilSetSymbol(symbol, BARCODE_MAXICODE, 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); + if (data[i].structapp.count) { + symbol->structapp = data[i].structapp; + } strcpy(symbol->primary, data[i].primary); 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\", %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)), data[i].length, + printf(" /*%3d*/ { %s, %d, %d, { %d, %d, \"%s\" }, \"%s\", %d, \"%s\", %s, %d, %d, %d, \"%s\",\n", + i, testUtilInputModeName(data[i].input_mode), data[i].option_1, data[i].option_2, + data[i].structapp.index, data[i].structapp.count, data[i].structapp.id, + testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), data[i].length, data[i].primary, testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].bwipp_cmp, data[i].comment); testUtilModulesPrint(symbol, " ", "\n"); printf(" },\n"); diff --git a/backend/tests/test_pdf417.c b/backend/tests/test_pdf417.c index 4f9cb4b6..74415896 100644 --- a/backend/tests/test_pdf417.c +++ b/backend/tests/test_pdf417.c @@ -39,6 +39,7 @@ static void test_options(int index, int debug) { int option_2; int option_3; int warn_level; + struct zint_structapp structapp; char *data; int ret_encode; int ret_vector; @@ -47,31 +48,50 @@ static void test_options(int index, int debug) { int expected_option_2; int expected_rows; int expected_width; + const char *expected_errtxt; int compare_previous; }; // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) struct item data[] = { - /* 0*/ { BARCODE_PDF417, -1, -1, -1, 0, "12345", 0, 0, 2, 2, 6, 103, -1 }, // ECC auto-set to 2, cols auto-set to 2 - /* 1*/ { BARCODE_PDF417, -1, -1, 928, 0, "12345", 0, 0, 2, 2, 6, 103, 0 }, // Option 3 ignored - /* 2*/ { BARCODE_PDF417, -1, -1, 300, 0, "12345", 0, 0, 2, 2, 6, 103, 0 }, // Option 3 ignored - /* 3*/ { BARCODE_PDF417, 3, -1, -1, 0, "12345", 0, 0, 3, 3, 7, 120, -1 }, // ECC 3, cols auto-set to 3 - /* 4*/ { BARCODE_PDF417, 3, 2, -1, 0, "12345", 0, 0, 3, 2, 10, 103, -1 }, // ECC 3, cols 2 - /* 5*/ { BARCODE_PDF417, 8, 2, -1, 0, "12345", ZINT_ERROR_TOO_LONG, -1, 8, 3, 0, 0, -1 }, // ECC 8, cols 2, fails - /* 6*/ { BARCODE_PDF417, 7, 2, -1, 0, "12345", 0, 0, 7, 3, 87, 120, -1 }, // ECC 7, cols 2 auto-upped to 3 (no warning, unlike MICROPDF417) - /* 7*/ { BARCODE_PDF417, -1, 10, -1, 0, "12345", 0, 0, 2, 10, 3, 239, -1 }, // ECC auto-set to 2, cols 10 - /* 8*/ { BARCODE_PDF417, 9, -1, -1, 0, "12345", ZINT_WARN_INVALID_OPTION, 0, 2, 2, 6, 103, -1 }, // Invalid ECC, auto-set - /* 9*/ { BARCODE_PDF417, -1, 31, -1, 0, "12345", ZINT_WARN_INVALID_OPTION, 0, 2, 2, 6, 103, 0 }, // Invalid cols, auto-set - /* 10*/ { BARCODE_PDF417, 9, -1, -1, WARN_FAIL_ALL, "12345", ZINT_ERROR_INVALID_OPTION, -1, 9, 0, 0, 0, -1 }, // Invalid ECC - /* 11*/ { BARCODE_PDF417, -1, 31, -1, WARN_FAIL_ALL, "12345", ZINT_ERROR_INVALID_OPTION, -1, -1, 31, 0, 0, -1 }, // Invalid cols - /* 12*/ { BARCODE_PDF417, -1, 1, -1, 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI", ZINT_ERROR_TOO_LONG, -1, 4, 2, 0, 0, -1 }, // Cols 1 too small - /* 13*/ { BARCODE_MICROPDF417, -1, 5, -1, 0, "12345", ZINT_WARN_INVALID_OPTION, 0, -1, 1, 11, 38, -1 }, // Invalid cols, auto-set to 1 - /* 14*/ { BARCODE_MICROPDF417, -1, 5, -1, WARN_FAIL_ALL, "12345", ZINT_ERROR_INVALID_OPTION, -1, -1, 5, 0, 0, -1 }, // Invalid cols - /* 15*/ { BARCODE_MICROPDF417, -1, 1, -1, 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLM", ZINT_WARN_INVALID_OPTION, 0, -1, 2, 17, 55, -1 }, // Cols 1 too small, auto-upped to 2 with warning - /* 16*/ { BARCODE_MICROPDF417, -1, 1, -1, WARN_FAIL_ALL, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLM", ZINT_ERROR_INVALID_OPTION, 0, -1, 1, 0, 0, -1 }, // Cols 1 too small - /* 17*/ { BARCODE_MICROPDF417, -1, 2, -1, 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWX", ZINT_WARN_INVALID_OPTION, 0, -1, 4, 15, 99, -1 }, // Cols 2 too small, auto-upped to 4 with warning - /* 18*/ { BARCODE_MICROPDF417, -1, 2, -1, WARN_FAIL_ALL, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWX", ZINT_ERROR_INVALID_OPTION, 0, -1, 2, 0, 0, -1 }, // Cols 2 too small - /* 19*/ { BARCODE_MICROPDF417, -1, 3, -1, 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKL", ZINT_WARN_INVALID_OPTION, 0, -1, 4, 32, 99, -1 }, // Cols 3 too small, auto-upped to 4 with warning - /* 20*/ { BARCODE_MICROPDF417, -1, 3, -1, WARN_FAIL_ALL, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKL", ZINT_ERROR_INVALID_OPTION, 0, -1, 3, 0, 0, -1 }, // Cols 3 too small + /* 0*/ { BARCODE_PDF417, -1, -1, -1, 0, { 0, 0, "" }, "12345", 0, 0, 2, 2, 6, 103, "", -1 }, // ECC auto-set to 2, cols auto-set to 2 + /* 1*/ { BARCODE_PDF417, -1, -1, 928, 0, { 0, 0, "" }, "12345", 0, 0, 2, 2, 6, 103, "", 0 }, // Option 3 ignored + /* 2*/ { BARCODE_PDF417, -1, -1, 300, 0, { 0, 0, "" }, "12345", 0, 0, 2, 2, 6, 103, "", 0 }, // Option 3 ignored + /* 3*/ { BARCODE_PDF417, 3, -1, -1, 0, { 0, 0, "" }, "12345", 0, 0, 3, 3, 7, 120, "", -1 }, // ECC 3, cols auto-set to 3 + /* 4*/ { BARCODE_PDF417, 3, 2, -1, 0, { 0, 0, "" }, "12345", 0, 0, 3, 2, 10, 103, "", -1 }, // ECC 3, cols 2 + /* 5*/ { BARCODE_PDF417, 8, 2, -1, 0, { 0, 0, "" }, "12345", ZINT_ERROR_TOO_LONG, -1, 8, 3, 0, 0, "Error 465: Data too long for specified number of columns", -1 }, // ECC 8, cols 2, fails + /* 6*/ { BARCODE_PDF417, 7, 2, -1, 0, { 0, 0, "" }, "12345", 0, 0, 7, 3, 87, 120, "", -1 }, // ECC 7, cols 2 auto-upped to 3 (no warning, unlike MICROPDF417) + /* 7*/ { BARCODE_PDF417, -1, 10, -1, 0, { 0, 0, "" }, "12345", 0, 0, 2, 10, 3, 239, "", -1 }, // ECC auto-set to 2, cols 10 + /* 8*/ { BARCODE_PDF417, 9, -1, -1, 0, { 0, 0, "" }, "12345", ZINT_WARN_INVALID_OPTION, 0, 2, 2, 6, 103, "Warning 460: Security value out of range", -1 }, // Invalid ECC, auto-set + /* 9*/ { BARCODE_PDF417, -1, 31, -1, 0, { 0, 0, "" }, "12345", ZINT_WARN_INVALID_OPTION, 0, 2, 2, 6, 103, "Warning 461: Number of columns out of range", 0 }, // Invalid cols, auto-set + /* 10*/ { BARCODE_PDF417, 9, -1, -1, WARN_FAIL_ALL, { 0, 0, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, 9, 0, 0, 0, "Error 460: Security value out of range", -1 }, // Invalid ECC + /* 11*/ { BARCODE_PDF417, -1, 31, -1, WARN_FAIL_ALL, { 0, 0, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, -1, 31, 0, 0, "Error 461: Number of columns out of range", -1 }, // Invalid cols + /* 12*/ { BARCODE_PDF417, -1, 1, -1, 0, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI", ZINT_ERROR_TOO_LONG, -1, 4, 2, 0, 0, "Error 465: Data too long for specified number of columns", -1 }, // Cols 1 too small + /* 13*/ { BARCODE_MICROPDF417, -1, 5, -1, 0, { 0, 0, "" }, "12345", ZINT_WARN_INVALID_OPTION, 0, -1, 1, 11, 38, "Warning 468: Specified width out of range", -1 }, // Invalid cols, auto-set to 1 + /* 14*/ { BARCODE_MICROPDF417, -1, 5, -1, WARN_FAIL_ALL, { 0, 0, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, -1, 5, 0, 0, "Error 468: Specified width out of range", -1 }, // Invalid cols + /* 15*/ { BARCODE_MICROPDF417, -1, 1, -1, 0, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLM", ZINT_WARN_INVALID_OPTION, 0, -1, 2, 17, 55, "Warning 469: Specified symbol size too small for data", -1 }, // Cols 1 too small, auto-upped to 2 with warning + /* 16*/ { BARCODE_MICROPDF417, -1, 1, -1, WARN_FAIL_ALL, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLM", ZINT_ERROR_INVALID_OPTION, 0, -1, 1, 0, 0, "Error 469: Specified symbol size too small for data", -1 }, // Cols 1 too small + /* 17*/ { BARCODE_MICROPDF417, -1, 2, -1, 0, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWX", ZINT_WARN_INVALID_OPTION, 0, -1, 4, 15, 99, "Warning 470: Specified symbol size too small for data", -1 }, // Cols 2 too small, auto-upped to 4 with warning + /* 18*/ { BARCODE_MICROPDF417, -1, 2, -1, WARN_FAIL_ALL, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWX", ZINT_ERROR_INVALID_OPTION, 0, -1, 2, 0, 0, "Error 470: Specified symbol size too small for data", -1 }, // Cols 2 too small + /* 19*/ { BARCODE_MICROPDF417, -1, 3, -1, 0, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKL", ZINT_WARN_INVALID_OPTION, 0, -1, 4, 32, 99, "Warning 471: Specified symbol size too small for data", -1 }, // Cols 3 too small, auto-upped to 4 with warning + /* 20*/ { BARCODE_MICROPDF417, -1, 3, -1, WARN_FAIL_ALL, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKL", ZINT_ERROR_INVALID_OPTION, 0, -1, 3, 0, 0, "Error 471: Specified symbol size too small for data", -1 }, // Cols 3 too small + /* 21*/ { BARCODE_PDF417, -1, 1, -1, 0, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGH", 0, 0, 3, 2, 89, 103, "", -1 }, // Cols 1 just fits + /* 22*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGH", ZINT_ERROR_TOO_LONG, -1, 4, 2, 0, 0, "Error 465: Data too long for specified number of columns", -1 }, // Cols 1 too small with Structured Append + /* 23*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST", 0, 0, 3, 2, 89, 103, "", -1 }, // Cols 1 with Structured Append just fits + /* 24*/ { BARCODE_PDF417, -1, 1, -1, 0, { 2, 2, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTU", ZINT_ERROR_TOO_LONG, -1, 4, 2, 0, 0, "Error 465: Data too long for specified number of columns", -1 }, // Cols 1 too small with Structured Append as last symbol (uses extra terminating codeword) + /* 25*/ { BARCODE_PDF417, -1, 1, -1, 0, { 2, 2, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQR", 0, 0, 3, 2, 89, 103, "", -1 }, // Cols 1 with Structured Append as last symbol just fits with 1 less character pair + /* 26*/ { BARCODE_PDF417, -1, 1, -1, 0, { 3, 2, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST", ZINT_ERROR_INVALID_OPTION, -1, -1, 1, 0, 0, "Error 741: Structured Append index out of range (1-2)", -1 }, + /* 27*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 1, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST", ZINT_ERROR_INVALID_OPTION, -1, -1, 1, 0, 0, "Error 740: Structured Append count out of range (2-99999)", -1 }, + /* 28*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 100000, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST", ZINT_ERROR_INVALID_OPTION, -1, -1, 1, 0, 0, "Error 740: Structured Append count out of range (2-99999)", -1 }, + /* 29*/ { BARCODE_PDF417, -1, 1, -1, 0, { 0, 2, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST", ZINT_ERROR_INVALID_OPTION, -1, -1, 1, 0, 0, "Error 741: Structured Append index out of range (1-2)", -1 }, + /* 30*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "1" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQR", 0, 0, 3, 2, 89, 103, "", -1 }, + /* 31*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "123123" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOP", 0, 0, 3, 2, 89, 103, "", -1 }, + /* 32*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "123123123123123123123123123123" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 0, 3, 2, 89, 103, "", -1 }, + /* 33*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "1231231231231231231231231231231" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", ZINT_ERROR_INVALID_OPTION, -1, -1, 1, 0, 0, "Error 742: Structured Append ID too long (30 digit maximum)", -1 }, + /* 34*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "23123123123123123123123123123" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 0, 3, 2, 89, 103, "", -1 }, + /* 35*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "A" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQR", ZINT_ERROR_INVALID_OPTION, -1, -1, 1, 0, 0, "Error 743: Invalid Structured Append ID (digits only)", -1 }, + /* 36*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "900" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQR", ZINT_ERROR_INVALID_OPTION, -1, -1, 1, 0, 0, "Error 744: Structured Append ID triplet 1 '900' out of range (000-899)", -1 }, + /* 37*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "123123123123123123123123901123" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", ZINT_ERROR_INVALID_OPTION, -1, -1, 1, 0, 0, "Error 744: Structured Append ID triplet 9 '901' out of range (000-899)", -1 }, + /* 38*/ { BARCODE_MICROPDF417, -1, -1, -1, 0, { 1, 2, "1231231231231231231231231231231" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGH", ZINT_ERROR_INVALID_OPTION, -1, -1, 0, 0, 0, "Error 742: Structured Append ID too long (30 digit maximum)", -1 }, // Micro PDF417 same error checking code }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -92,6 +112,9 @@ static void test_options(int index, int debug) { if (data[i].warn_level) { symbol->warn_level = data[i].warn_level; } + if (data[i].structapp.count) { + symbol->structapp = data[i].structapp; + } ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret_encode, symbol->errtxt); @@ -106,6 +129,7 @@ static void test_options(int index, int debug) { assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, symbol->errtxt); assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, symbol->errtxt); + assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); if (index == -1 && data[i].compare_previous != -1) { ret = testUtilSymbolCmp(symbol, &previous_symbol); @@ -190,6 +214,7 @@ static void test_input(int index, int generate, int debug) { int eci; int option_1; int option_2; + struct zint_structapp structapp; char *data; int ret; int expected_eci; @@ -201,43 +226,51 @@ static void test_input(int index, int generate, int debug) { // é U+00E9 (\351, 233), UTF-8 C3A9 // β U+03B2 in ISO 8859-7 Greek (but not other ISO 8859 or Win page) (\342, 226), UTF-8 CEB2 struct item data[] = { - /* 0*/ { BARCODE_PDF417, UNICODE_MODE, -1, -1, -1, "é", 0, 0, 6, 103, "(12) 4 913 233 900 398 878 279 350 217 295 231 77", "" }, - /* 1*/ { BARCODE_PDF417, UNICODE_MODE, 3, -1, -1, "é", 0, 3, 7, 103, "(14) 6 927 3 913 233 900 162 81 551 529 607 384 164 108", "" }, - /* 2*/ { BARCODE_PDF417, UNICODE_MODE, 26, -1, -1, "é", 0, 26, 7, 103, "(14) 6 927 26 901 195 169 574 701 519 908 84 241 360 642", "" }, - /* 3*/ { BARCODE_PDF417, UNICODE_MODE, 9, -1, -1, "β", 0, 9, 7, 103, "(14) 6 927 9 913 226 900 487 92 418 278 838 500 576 84", "" }, - /* 4*/ { BARCODE_PDF417, UNICODE_MODE, -1, -1, -1, "β", ZINT_WARN_USES_ECI, 9, 7, 103, "Warning (14) 6 927 9 913 226 900 487 92 418 278 838 500 576 84", "" }, - /* 5*/ { BARCODE_PDF417, UNICODE_MODE, 3, -1, -1, "β", ZINT_ERROR_INVALID_DATA, 3, 0, 0, "Error 244: Invalid character in input data for ECI 3", "" }, - /* 6*/ { BARCODE_PDF417, UNICODE_MODE, 899, -1, -1, "A", 0, 899, 7, 103, "(14) 6 927 899 900 29 900 727 69 915 482 371 771 641 35", "" }, - /* 7*/ { BARCODE_PDF417, UNICODE_MODE, 900, -1, -1, "A", 0, 900, 7, 103, "(14) 6 926 0 0 900 29 56 795 921 763 468 267 410 129", "" }, - /* 8*/ { BARCODE_PDF417, UNICODE_MODE, 810899, -1, -1, "A", 0, 810899, 7, 103, "(14) 6 926 899 899 900 29 847 901 749 718 89 792 660 273", "" }, - /* 9*/ { BARCODE_PDF417, UNICODE_MODE, 810900, -1, -1, "A", 0, 810900, 7, 103, "(14) 6 925 0 900 29 900 652 613 857 390 38 450 415 899", "" }, - /* 10*/ { BARCODE_PDF417, UNICODE_MODE, 811799, -1, -1, "A", 0, 811799, 7, 103, "(14) 6 925 899 900 29 900 456 300 328 160 510 753 157 159", "" }, - /* 11*/ { BARCODE_PDF417, UNICODE_MODE, 811800, -1, -1, "A", ZINT_ERROR_INVALID_OPTION, 811800, 0, 0, "Error 472: Invalid ECI", "" }, - /* 12*/ { BARCODE_MICROPDF417, UNICODE_MODE, -1, -1, -1, "é", 0, 0, 11, 38, "(11) 913 233 900 900 805 609 847 211 598 4 603", "" }, - /* 13*/ { BARCODE_MICROPDF417, UNICODE_MODE, 3, -1, -1, "é", 0, 3, 11, 38, "(11) 927 3 913 233 803 477 85 249 824 813 830", "" }, - /* 14*/ { BARCODE_MICROPDF417, UNICODE_MODE, 26, -1, -1, "é", 0, 26, 6, 82, "(18) 927 26 901 195 169 900 288 96 509 365 709 784 713 403 219 81 851 866", "" }, - /* 15*/ { BARCODE_MICROPDF417, UNICODE_MODE, 9, -1, -1, "β", 0, 9, 11, 38, "(11) 927 9 913 226 23 103 74 194 394 667 324", "" }, - /* 16*/ { BARCODE_MICROPDF417, UNICODE_MODE, -1, -1, -1, "β", ZINT_WARN_USES_ECI, 9, 11, 38, "Warning (11) 927 9 913 226 23 103 74 194 394 667 324", "" }, - /* 17*/ { BARCODE_MICROPDF417, UNICODE_MODE, 3, -1, -1, "β", ZINT_ERROR_INVALID_DATA, 3, 0, 0, "Error 244: Invalid character in input data for ECI 3", "" }, - /* 18*/ { BARCODE_MICROPDF417, UNICODE_MODE, 899, -1, -1, "A", 0, 899, 11, 38, "(11) 927 899 900 29 533 437 884 3 617 241 747", "" }, - /* 19*/ { BARCODE_MICROPDF417, UNICODE_MODE, 900, -1, -1, "A", 0, 900, 6, 82, "(18) 926 0 0 900 29 900 913 543 414 141 214 886 461 1 419 422 54 495", "" }, - /* 20*/ { BARCODE_MICROPDF417, UNICODE_MODE, 810899, -1, -1, "A", 0, 810899, 6, 82, "(18) 926 899 899 900 29 900 351 555 241 509 787 583 3 326 41 628 534 151", "" }, - /* 21*/ { BARCODE_MICROPDF417, UNICODE_MODE, 810900, -1, -1, "A", 0, 810900, 11, 38, "(11) 925 0 900 29 233 533 43 483 708 659 704", "" }, - /* 22*/ { BARCODE_MICROPDF417, UNICODE_MODE, 811800, -1, -1, "A", ZINT_ERROR_INVALID_OPTION, 811800, 0, 0, "Error 473: Invalid ECI", "" }, - /* 23*/ { BARCODE_HIBC_PDF, UNICODE_MODE, -1, -1, -1, ",", ZINT_ERROR_INVALID_DATA, 0, 0, 0, "Error 203: Invalid character in data (alphanumerics, space and \"-.$/+%\" only)", "" }, - /* 24*/ { BARCODE_HIBC_MICPDF, UNICODE_MODE, -1, -1, -1, ",", ZINT_ERROR_INVALID_DATA, 0, 0, 0, "Error 203: Invalid character in data (alphanumerics, space and \"-.$/+%\" only)", "" }, - /* 25*/ { BARCODE_PDF417, UNICODE_MODE, -1, -1, -1, "AB{} C#+ de{} {}F 12{} G{} H", 0, 0, 12, 120, "(36) 28 1 865 807 896 782 855 626 807 94 865 807 896 808 776 839 176 808 32 776 839 806 208", "" }, - /* 26*/ { BARCODE_PDF417, UNICODE_MODE, -1, -1, -1, "{} #+ de{} 12{} {} H", 0, 0, 10, 120, "(30) 22 865 807 896 808 470 807 94 865 807 896 808 32 776 839 806 865 807 896 787 900 900", "" }, - /* 27*/ { BARCODE_PDF417, UNICODE_MODE, -1, -1, -1, "A", 0, 0, 5, 103, "(10) 2 29 478 509 903 637 74 490 760 21", "" }, - /* 28*/ { BARCODE_PDF417, UNICODE_MODE, -1, 0, -1, "A", 0, 0, 4, 86, "(4) 2 29 347 502", "" }, - /* 29*/ { BARCODE_PDF417, UNICODE_MODE, -1, 1, -1, "A", 0, 0, 6, 86, "(6) 2 29 752 533 551 139", "" }, - /* 30*/ { BARCODE_PDF417, UNICODE_MODE, -1, 2, -1, "A", 0, 0, 5, 103, "(10) 2 29 478 509 903 637 74 490 760 21", "" }, - /* 31*/ { BARCODE_PDF417, UNICODE_MODE, -1, 3, -1, "A", 0, 0, 9, 103, "(18) 2 29 290 888 64 789 390 182 22 197 347 41 298 467 387 917 455 196", "" }, - /* 32*/ { BARCODE_PDF417, UNICODE_MODE, -1, 4, -1, "A", 0, 0, 12, 120, "(36) 4 29 900 900 702 212 753 721 695 584 222 459 110 594 813 465 718 912 667 349 852 602", "" }, - /* 33*/ { BARCODE_PDF417, UNICODE_MODE, -1, 5, -1, "A", 0, 0, 14, 154, "(70) 6 29 900 900 900 900 774 599 527 418 850 374 921 763 922 772 572 661 584 902 578 696", "" }, - /* 34*/ { BARCODE_PDF417, UNICODE_MODE, -1, 6, -1, "A", 0, 0, 19, 188, "(133) 5 29 900 900 900 113 261 822 368 600 652 404 869 860 902 184 702 611 323 195 794 566", "" }, - /* 35*/ { BARCODE_PDF417, UNICODE_MODE, -1, 7, -1, "A", 0, 0, 29, 222, "(261) 5 29 900 900 900 384 614 456 20 422 177 78 492 215 859 765 864 755 572 621 891 97 538", "" }, - /* 36*/ { BARCODE_PDF417, UNICODE_MODE, -1, 8, -1, "A", 0, 0, 40, 290, "(520) 8 29 900 900 900 900 900 900 255 576 871 499 885 500 866 196 784 681 589 448 428 108", "" }, + /* 0*/ { BARCODE_PDF417, UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "é", 0, 0, 6, 103, "(12) 4 913 233 900 398 878 279 350 217 295 231 77", "" }, + /* 1*/ { BARCODE_PDF417, UNICODE_MODE, 3, -1, -1, { 0, 0, "" }, "é", 0, 3, 7, 103, "(14) 6 927 3 913 233 900 162 81 551 529 607 384 164 108", "" }, + /* 2*/ { BARCODE_PDF417, UNICODE_MODE, 26, -1, -1, { 0, 0, "" }, "é", 0, 26, 7, 103, "(14) 6 927 26 901 195 169 574 701 519 908 84 241 360 642", "" }, + /* 3*/ { BARCODE_PDF417, UNICODE_MODE, 9, -1, -1, { 0, 0, "" }, "β", 0, 9, 7, 103, "(14) 6 927 9 913 226 900 487 92 418 278 838 500 576 84", "" }, + /* 4*/ { BARCODE_PDF417, UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "β", ZINT_WARN_USES_ECI, 9, 7, 103, "Warning (14) 6 927 9 913 226 900 487 92 418 278 838 500 576 84", "" }, + /* 5*/ { BARCODE_PDF417, UNICODE_MODE, 3, -1, -1, { 0, 0, "" }, "β", ZINT_ERROR_INVALID_DATA, 3, 0, 0, "Error 244: Invalid character in input data for ECI 3", "" }, + /* 6*/ { BARCODE_PDF417, UNICODE_MODE, 899, -1, -1, { 0, 0, "" }, "A", 0, 899, 7, 103, "(14) 6 927 899 900 29 900 727 69 915 482 371 771 641 35", "" }, + /* 7*/ { BARCODE_PDF417, UNICODE_MODE, 900, -1, -1, { 0, 0, "" }, "A", 0, 900, 7, 103, "(14) 6 926 0 0 900 29 56 795 921 763 468 267 410 129", "" }, + /* 8*/ { BARCODE_PDF417, UNICODE_MODE, 810899, -1, -1, { 0, 0, "" }, "A", 0, 810899, 7, 103, "(14) 6 926 899 899 900 29 847 901 749 718 89 792 660 273", "" }, + /* 9*/ { BARCODE_PDF417, UNICODE_MODE, 810900, -1, -1, { 0, 0, "" }, "A", 0, 810900, 7, 103, "(14) 6 925 0 900 29 900 652 613 857 390 38 450 415 899", "" }, + /* 10*/ { BARCODE_PDF417, UNICODE_MODE, 811799, -1, -1, { 0, 0, "" }, "A", 0, 811799, 7, 103, "(14) 6 925 899 900 29 900 456 300 328 160 510 753 157 159", "" }, + /* 11*/ { BARCODE_PDF417, UNICODE_MODE, 811800, -1, -1, { 0, 0, "" }, "A", ZINT_ERROR_INVALID_OPTION, 811800, 0, 0, "Error 472: Invalid ECI", "" }, + /* 12*/ { BARCODE_MICROPDF417, UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "é", 0, 0, 11, 38, "(11) 913 233 900 900 805 609 847 211 598 4 603", "" }, + /* 13*/ { BARCODE_MICROPDF417, UNICODE_MODE, 3, -1, -1, { 0, 0, "" }, "é", 0, 3, 11, 38, "(11) 927 3 913 233 803 477 85 249 824 813 830", "" }, + /* 14*/ { BARCODE_MICROPDF417, UNICODE_MODE, 26, -1, -1, { 0, 0, "" }, "é", 0, 26, 6, 82, "(18) 927 26 901 195 169 900 288 96 509 365 709 784 713 403 219 81 851 866", "" }, + /* 15*/ { BARCODE_MICROPDF417, UNICODE_MODE, 9, -1, -1, { 0, 0, "" }, "β", 0, 9, 11, 38, "(11) 927 9 913 226 23 103 74 194 394 667 324", "" }, + /* 16*/ { BARCODE_MICROPDF417, UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "β", ZINT_WARN_USES_ECI, 9, 11, 38, "Warning (11) 927 9 913 226 23 103 74 194 394 667 324", "" }, + /* 17*/ { BARCODE_MICROPDF417, UNICODE_MODE, 3, -1, -1, { 0, 0, "" }, "β", ZINT_ERROR_INVALID_DATA, 3, 0, 0, "Error 244: Invalid character in input data for ECI 3", "" }, + /* 18*/ { BARCODE_MICROPDF417, UNICODE_MODE, 899, -1, -1, { 0, 0, "" }, "A", 0, 899, 11, 38, "(11) 927 899 900 29 533 437 884 3 617 241 747", "" }, + /* 19*/ { BARCODE_MICROPDF417, UNICODE_MODE, 900, -1, -1, { 0, 0, "" }, "A", 0, 900, 6, 82, "(18) 926 0 0 900 29 900 913 543 414 141 214 886 461 1 419 422 54 495", "" }, + /* 20*/ { BARCODE_MICROPDF417, UNICODE_MODE, 810899, -1, -1, { 0, 0, "" }, "A", 0, 810899, 6, 82, "(18) 926 899 899 900 29 900 351 555 241 509 787 583 3 326 41 628 534 151", "" }, + /* 21*/ { BARCODE_MICROPDF417, UNICODE_MODE, 810900, -1, -1, { 0, 0, "" }, "A", 0, 810900, 11, 38, "(11) 925 0 900 29 233 533 43 483 708 659 704", "" }, + /* 22*/ { BARCODE_MICROPDF417, UNICODE_MODE, 811800, -1, -1, { 0, 0, "" }, "A", ZINT_ERROR_INVALID_OPTION, 811800, 0, 0, "Error 472: Invalid ECI", "" }, + /* 23*/ { BARCODE_HIBC_PDF, UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, ",", ZINT_ERROR_INVALID_DATA, 0, 0, 0, "Error 203: Invalid character in data (alphanumerics, space and \"-.$/+%\" only)", "" }, + /* 24*/ { BARCODE_HIBC_MICPDF, UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, ",", ZINT_ERROR_INVALID_DATA, 0, 0, 0, "Error 203: Invalid character in data (alphanumerics, space and \"-.$/+%\" only)", "" }, + /* 25*/ { BARCODE_PDF417, UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "AB{} C#+ de{} {}F 12{} G{} H", 0, 0, 12, 120, "(36) 28 1 865 807 896 782 855 626 807 94 865 807 896 808 776 839 176 808 32 776 839 806 208", "" }, + /* 26*/ { BARCODE_PDF417, UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "{} #+ de{} 12{} {} H", 0, 0, 10, 120, "(30) 22 865 807 896 808 470 807 94 865 807 896 808 32 776 839 806 865 807 896 787 900 900", "" }, + /* 27*/ { BARCODE_PDF417, UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", 0, 0, 5, 103, "(10) 2 29 478 509 903 637 74 490 760 21", "" }, + /* 28*/ { BARCODE_PDF417, UNICODE_MODE, -1, 0, -1, { 0, 0, "" }, "A", 0, 0, 4, 86, "(4) 2 29 347 502", "" }, + /* 29*/ { BARCODE_PDF417, UNICODE_MODE, -1, 1, -1, { 0, 0, "" }, "A", 0, 0, 6, 86, "(6) 2 29 752 533 551 139", "" }, + /* 30*/ { BARCODE_PDF417, UNICODE_MODE, -1, 2, -1, { 0, 0, "" }, "A", 0, 0, 5, 103, "(10) 2 29 478 509 903 637 74 490 760 21", "" }, + /* 31*/ { BARCODE_PDF417, UNICODE_MODE, -1, 3, -1, { 0, 0, "" }, "A", 0, 0, 9, 103, "(18) 2 29 290 888 64 789 390 182 22 197 347 41 298 467 387 917 455 196", "" }, + /* 32*/ { BARCODE_PDF417, UNICODE_MODE, -1, 4, -1, { 0, 0, "" }, "A", 0, 0, 12, 120, "(36) 4 29 900 900 702 212 753 721 695 584 222 459 110 594 813 465 718 912 667 349 852 602", "" }, + /* 33*/ { BARCODE_PDF417, UNICODE_MODE, -1, 5, -1, { 0, 0, "" }, "A", 0, 0, 14, 154, "(70) 6 29 900 900 900 900 774 599 527 418 850 374 921 763 922 772 572 661 584 902 578 696", "" }, + /* 34*/ { BARCODE_PDF417, UNICODE_MODE, -1, 6, -1, { 0, 0, "" }, "A", 0, 0, 19, 188, "(133) 5 29 900 900 900 113 261 822 368 600 652 404 869 860 902 184 702 611 323 195 794 566", "" }, + /* 35*/ { BARCODE_PDF417, UNICODE_MODE, -1, 7, -1, { 0, 0, "" }, "A", 0, 0, 29, 222, "(261) 5 29 900 900 900 384 614 456 20 422 177 78 492 215 859 765 864 755 572 621 891 97 538", "" }, + /* 36*/ { BARCODE_PDF417, UNICODE_MODE, -1, 8, -1, { 0, 0, "" }, "A", 0, 0, 40, 290, "(520) 8 29 900 900 900 900 900 900 255 576 871 499 885 500 866 196 784 681 589 448 428 108", "" }, + /* 37*/ { BARCODE_PDF417, UNICODE_MODE, -1, 8, -1, { 1, 4, "017053" }, "A", 0, 0, 41, 290, "(533) 21 29 900 900 900 900 900 900 900 900 900 900 928 111 100 17 53 923 1 111 104 903 71", "H.4 example" }, + /* 38*/ { BARCODE_PDF417, UNICODE_MODE, -1, 8, -1, { 4, 4, "017053" }, "A", 0, 0, 41, 290, "(533) 21 29 900 900 900 900 900 900 900 900 900 928 111 103 17 53 923 1 111 104 922 772 754", "H.4 example last segment" }, + /* 39*/ { BARCODE_PDF417, UNICODE_MODE, -1, 8, -1, { 2, 4, "" }, "A", 0, 0, 41, 290, "(533) 21 29 900 900 900 900 900 900 900 900 900 900 900 900 928 111 101 923 1 111 104 583", "No ID" }, + /* 40*/ { BARCODE_PDF417, UNICODE_MODE, -1, 8, -1, { 99998, 99999, "12345" }, "A", 0, 0, 41, 290, "(533) 21 29 900 900 900 900 900 900 900 900 900 900 928 222 197 123 45 923 1 222 199 198", "IDs '123', '045'" }, + /* 41*/ { BARCODE_MICROPDF417, UNICODE_MODE, -1, -1, -1, { 1, 4, "017053" }, "A", 0, 0, 6, 99, "(24) 900 29 900 928 111 100 17 53 923 1 111 104 430 136 328 218 796 853 32 421 712 477 363", "H.4 example" }, + /* 42*/ { BARCODE_MICROPDF417, UNICODE_MODE, -1, -1, -1, { 4, 4, "017053" }, "A", 0, 0, 6, 99, "(24) 900 29 928 111 103 17 53 923 1 111 104 922 837 837 774 835 701 445 926 428 285 851 334", "H.4 example last segment" }, + /* 43*/ { BARCODE_MICROPDF417, UNICODE_MODE, -1, -1, -1, { 3, 4, "" }, "A", 0, 0, 17, 38, "(17) 900 29 900 928 111 102 923 1 111 104 343 717 634 693 618 860 618", "No ID" }, + /* 44*/ { BARCODE_MICROPDF417, UNICODE_MODE, -1, -1, -1, { 99999, 99999, "100200300" }, "A", 0, 0, 11, 55, "(22) 900 29 928 222 198 100 200 300 923 1 222 199 922 693 699 895 719 637 154 478 399 638", "IDs '100', '200', '300'" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -257,13 +290,17 @@ static void test_input(int index, int generate, int debug) { symbol->debug = ZINT_DEBUG_TEST; // Needed to get codeword dump in errtxt length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, data[i].eci, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug); + if (data[i].structapp.count) { + symbol->structapp = data[i].structapp; + } 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, %s, %d, %d, %d, \"%s\", %s, %d, %d, %d, \"%s\", \"%s\" },\n", + printf(" /*%3d*/ { %s, %s, %d, %d, %d, { %d, %d, \"%s\" }, \"%s\", %s, %d, %d, %d, \"%s\", \"%s\" },\n", i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), data[i].eci, data[i].option_1, data[i].option_2, + data[i].structapp.index, data[i].structapp.count, data[i].structapp.id, testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), testUtilErrorName(data[i].ret), symbol->eci, symbol->rows, symbol->width, symbol->errtxt, data[i].comment); } else { diff --git a/backend/tests/test_png.c b/backend/tests/test_png.c index 86e8bd9c..5399168f 100644 --- a/backend/tests/test_png.c +++ b/backend/tests/test_png.c @@ -131,6 +131,7 @@ static void test_print(int index, int generate, int debug) { int option_2; float height; float scale; + struct zint_structapp structapp; char *fgcolour; char *bgcolour; char *data; @@ -140,62 +141,62 @@ static void test_print(int index, int generate, int debug) { char *comment; }; struct item data[] = { - /* 0*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, -1, -1, -1, -1, -1, 0, 0, "", "", "Égjpqy", "", 0, "code128_egrave_bold.png", "" }, - /* 1*/ { BARCODE_CODE128, UNICODE_MODE, 3, BOLD_TEXT | BARCODE_BOX, -1, -1, -1, -1, -1, 0, 0, "", "", "Égjpqy", "", 0, "code128_egrave_bold_box3.png", "" }, - /* 2*/ { BARCODE_CODE128, UNICODE_MODE, 2, BOLD_TEXT | BARCODE_BOX, 2, 2, -1, -1, -1, 0, 0, "", "", "Égjpqy", "", 0, "code128_egrave_bold_hvwsp2_box2.png", "" }, - /* 3*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, -1, -1, 3, -1, 0, 0, "", "", "[00]030123456789012340", "[02]13012345678909[37]24[10]1234567ABCDEFG", 0, "gs1_128_cc_fig12.png", "" }, - /* 4*/ { BARCODE_CODABLOCKF, -1, 3, -1, -1, -1, -1, 3, -1, 0, 0, "", "", "AAAAAAAAA", "", 0, "codablockf_3rows.png", "" }, - /* 5*/ { BARCODE_CODABLOCKF, -1, -1, -1, 2, 2, -1, -1, -1, 0, 0, "", "", "AAAAAAAAA", "", 0, "codablockf_hvwsp2.png", "" }, - /* 6*/ { BARCODE_CODABLOCKF, -1, 2, BARCODE_BOX, 2, 2, -1, -1, -1, 0, 0, "", "", "AAAAAAAAA", "", 0, "codablockf_hvwsp2_box2.png", "" }, - /* 7*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "9771384524017+12", "", 0, "ean13_2addon_ggs_5.2.2.5.1-2.png", "" }, - /* 8*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "9780877799306+54321", "", 0, "ean13_5addon_ggs_5.2.2.5.2-2.png", "" }, - /* 9*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, 0, "", "", "123456789012+12", "[91]123456789012345678901", 0, "ean13_cc_2addon_cca_4x4.png", "" }, - /* 10*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, 0, "", "", "123456789012+54321", "[91]1234567890", 0, "ean13_cc_5addon_ccb_3x4.png", "" }, - /* 11*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, 0, 2, -1, 0, 0, "", "", "123456789012+54321", "[91]1234567890", 0, "ean13_cc_5addon_ccb_3x4_notext.png", "" }, - /* 12*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "012345678905+24", "", 0, "upca_2addon_ggs_5.2.6.6-5.png", "" }, - /* 13*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "614141234417+12345", "", 0, "upca_5addon.png", "" }, - /* 14*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, 0, -1, -1, 0, 0, "", "", "614141234417+12345", "", 0, "upca_5addon_notext.png", "" }, - /* 15*/ { BARCODE_UPCA, -1, 3, BARCODE_BIND, -1, -1, -1, -1, -1, 0, 0, "", "", "614141234417+12345", "", 0, "upca_5addon_bind3.png", "" }, - /* 16*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, 0, "", "", "12345678901+12", "[91]123456789", 0, "upca_cc_2addon_cca_3x4.png", "" }, - /* 17*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, 0, "", "", "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4.png", "" }, - /* 18*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, 0, 2, -1, 0, 0, "", "", "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4_notext.png", "" }, - /* 19*/ { BARCODE_UPCA_CC, -1, 3, BARCODE_BIND, -1, -1, -1, 2, -1, 0, 0, "", "", "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4_bind3.png", "" }, - /* 20*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "1234567+12", "", 0, "upce_2addon.png", "" }, - /* 21*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "1234567+12345", "", 0, "upce_5addon.png", "" }, - /* 22*/ { BARCODE_UPCE, -1, -1, SMALL_TEXT, -1, -1, -1, -1, -1, 0, 0, "", "", "1234567+12345", "", 0, "upce_5addon_small.png", "" }, - /* 23*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, 0, "", "", "0654321+89", "[91]1", 0, "upce_cc_2addon_cca_5x2.png", "" }, - /* 24*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, 0, "", "", "1876543+56789", "[91]12345", 0, "upce_cc_5addon_ccb_8x2.png", "" }, - /* 25*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, 0, 2, -1, 0, 0, "", "", "1876543+56789", "[91]12345", 0, "upce_cc_5addon_ccb_8x2_notext.png", "" }, - /* 26*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "1234567+12", "", 0, "ean8_2addon.png", "" }, - /* 27*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "1234567+12345", "", 0, "ean8_5addon.png", "" }, - /* 28*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "9876543+65", "[91]1234567", 0, "ean8_cc_2addon_cca_4x3.png", "" }, - /* 29*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "9876543+74083", "[91]123456789012345678", 0, "ean8_cc_5addon_ccb_8x3.png", "" }, - /* 30*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "12345", "", 0, "ean5.png", "" }, - /* 31*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "12", "", 0, "ean2.png", "" }, - /* 32*/ { BARCODE_CODE39, -1, -1, SMALL_TEXT, -1, -1, -1, -1, -1, 0, 0, "", "", "123", "", 0, "code39_small.png", "" }, - /* 33*/ { BARCODE_POSTNET, -1, -1, -1, -1, -1, -1, -1, -1, 0, 3.5, "", "", "12345", "", 0, "postnet_zip.png", "300 dpi, using 1/43in X, 300 / 43 / 2 = ~3.5 scale" }, - /* 34*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "CFCECDCC", "12345", "", 0, "pdf417_bgalpha.png", "" }, - /* 35*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "30313233", "", "12345", "", 0, "pdf417_fgalpha.png", "" }, - /* 36*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "20212244", "CFCECDCC", "12345", "", 0, "pdf417_bgfgalpha.png", "" }, - /* 37*/ { BARCODE_ULTRA, -1, -1, -1, 2, -1, -1, -1, -1, 0, 0, "0000007F", "FF000033", "12345", "", 0, "ultra_bgfgalpha.png", "" }, - /* 38*/ { BARCODE_ULTRA, -1, -1, -1, 2, -1, -1, -1, -1, 0, 0, "", "FF000033", "12345", "", 0, "ultra_bgalpha.png", "" }, - /* 39*/ { BARCODE_ULTRA, -1, -1, -1, 2, -1, -1, -1, -1, 0, 0, "0000007F", "FF0000", "12345", "", 0, "ultra_fgalpha.png", "" }, - /* 40*/ { BARCODE_ULTRA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "0000007F", "", "12345", "", 0, "ultra_fgalpha_nobg.png", "" }, - /* 41*/ { BARCODE_ULTRA, -1, 1, BARCODE_BOX, 1, 1, -1, -1, -1, 0, 0, "", "", "12345", "", 0, "ultra_hvwsp1_box1.png", "" }, - /* 42*/ { BARCODE_ULTRA, -1, 1, BARCODE_BOX, 1, 1, -1, -1, -1, 0, 0, "00FF007F", "BABDB6", "12345", "", 0, "ultra_fgalpha_hvwsp1_box1.png", "" }, - /* 43*/ { BARCODE_ULTRA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0.5, "", "", "1", "", 0, "ultra_odd.png", "" }, - /* 44*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0.5, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_0.5.png", "6 dpmm, 150 dpi" }, - /* 45*/ { BARCODE_MAXICODE, -1, 1, BARCODE_BOX, 3, -1, -1, -1, -1, 0, 0.7, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_0.7_wsp3_box1.png", "8 dpmm, 200 dpi" }, - /* 46*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1.4, "1111117F", "EEEEEEEE", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_1.4_bgfgalpha.png", "16 dpmm, 400 dpi" }, - /* 47*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 2.1, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_2.1.png", "24 dpmm, 600 dpi" }, - /* 48*/ { BARCODE_MAXICODE, -1, 2, BARCODE_BOX, 1, 1, -1, -1, -1, 0, 0, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_hvwsp1_box2.png", "" }, - /* 49*/ { BARCODE_MAXICODE, -1, 1, BARCODE_BIND, -1, 1, -1, -1, -1, 0, 0, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_vwsp1_bind1.png", "" }, - /* 50*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, -1, -1, -1, -1, -1, 0, 2.0f, "", "", "1234", "", 0, "datamatrix_2.0_bind1_dotty.png", "" }, - /* 51*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, 1, 1, -1, -1, -1, 0, 2.0f, "", "", "1234", "", 0, "datamatrix_2.0_hvwsp1_bind1_dotty.png", "" }, - /* 52*/ { BARCODE_DBAR_LTD, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "12345678909", "", 0, "dbar_ltd.png", "" }, - /* 53*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 5.0, 0, "", "", "Your Data Here!", "", ZINT_WARN_NONCOMPLIANT, "pdf417_height5.png", "" }, - /* 54*/ { BARCODE_USPS_IMAIL, -1, -1, -1, -1, -1, -1, -1, -1, 7.75, 0, "", "", "12345678901234567890", "", 0, "imail_height7.75.png", "" }, - /* 55*/ { BARCODE_AZTEC, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "1234567890", "", 0, "aztec.png", "" }, + /* 0*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "Égjpqy", "", 0, "code128_egrave_bold.png", "" }, + /* 1*/ { BARCODE_CODE128, UNICODE_MODE, 3, BOLD_TEXT | BARCODE_BOX, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "Égjpqy", "", 0, "code128_egrave_bold_box3.png", "" }, + /* 2*/ { BARCODE_CODE128, UNICODE_MODE, 2, BOLD_TEXT | BARCODE_BOX, 2, 2, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "Égjpqy", "", 0, "code128_egrave_bold_hvwsp2_box2.png", "" }, + /* 3*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, -1, -1, 3, -1, 0, 0, { 0, 0, "" }, "", "", "[00]030123456789012340", "[02]13012345678909[37]24[10]1234567ABCDEFG", 0, "gs1_128_cc_fig12.png", "" }, + /* 4*/ { BARCODE_CODABLOCKF, -1, 3, -1, -1, -1, -1, 3, -1, 0, 0, { 0, 0, "" }, "", "", "AAAAAAAAA", "", 0, "codablockf_3rows.png", "" }, + /* 5*/ { BARCODE_CODABLOCKF, -1, -1, -1, 2, 2, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "AAAAAAAAA", "", 0, "codablockf_hvwsp2.png", "" }, + /* 6*/ { BARCODE_CODABLOCKF, -1, 2, BARCODE_BOX, 2, 2, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "AAAAAAAAA", "", 0, "codablockf_hvwsp2_box2.png", "" }, + /* 7*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "9771384524017+12", "", 0, "ean13_2addon_ggs_5.2.2.5.1-2.png", "" }, + /* 8*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "9780877799306+54321", "", 0, "ean13_5addon_ggs_5.2.2.5.2-2.png", "" }, + /* 9*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, 0, { 0, 0, "" }, "", "", "123456789012+12", "[91]123456789012345678901", 0, "ean13_cc_2addon_cca_4x4.png", "" }, + /* 10*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, 0, { 0, 0, "" }, "", "", "123456789012+54321", "[91]1234567890", 0, "ean13_cc_5addon_ccb_3x4.png", "" }, + /* 11*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, 0, 2, -1, 0, 0, { 0, 0, "" }, "", "", "123456789012+54321", "[91]1234567890", 0, "ean13_cc_5addon_ccb_3x4_notext.png", "" }, + /* 12*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "012345678905+24", "", 0, "upca_2addon_ggs_5.2.6.6-5.png", "" }, + /* 13*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "614141234417+12345", "", 0, "upca_5addon.png", "" }, + /* 14*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, 0, -1, -1, 0, 0, { 0, 0, "" }, "", "", "614141234417+12345", "", 0, "upca_5addon_notext.png", "" }, + /* 15*/ { BARCODE_UPCA, -1, 3, BARCODE_BIND, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "614141234417+12345", "", 0, "upca_5addon_bind3.png", "" }, + /* 16*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, 0, { 0, 0, "" }, "", "", "12345678901+12", "[91]123456789", 0, "upca_cc_2addon_cca_3x4.png", "" }, + /* 17*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, 0, { 0, 0, "" }, "", "", "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4.png", "" }, + /* 18*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, 0, 2, -1, 0, 0, { 0, 0, "" }, "", "", "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4_notext.png", "" }, + /* 19*/ { BARCODE_UPCA_CC, -1, 3, BARCODE_BIND, -1, -1, -1, 2, -1, 0, 0, { 0, 0, "" }, "", "", "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4_bind3.png", "" }, + /* 20*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "1234567+12", "", 0, "upce_2addon.png", "" }, + /* 21*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "1234567+12345", "", 0, "upce_5addon.png", "" }, + /* 22*/ { BARCODE_UPCE, -1, -1, SMALL_TEXT, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "1234567+12345", "", 0, "upce_5addon_small.png", "" }, + /* 23*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, 0, { 0, 0, "" }, "", "", "0654321+89", "[91]1", 0, "upce_cc_2addon_cca_5x2.png", "" }, + /* 24*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, 0, { 0, 0, "" }, "", "", "1876543+56789", "[91]12345", 0, "upce_cc_5addon_ccb_8x2.png", "" }, + /* 25*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, 0, 2, -1, 0, 0, { 0, 0, "" }, "", "", "1876543+56789", "[91]12345", 0, "upce_cc_5addon_ccb_8x2_notext.png", "" }, + /* 26*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "1234567+12", "", 0, "ean8_2addon.png", "" }, + /* 27*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "1234567+12345", "", 0, "ean8_5addon.png", "" }, + /* 28*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "9876543+65", "[91]1234567", 0, "ean8_cc_2addon_cca_4x3.png", "" }, + /* 29*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "9876543+74083", "[91]123456789012345678", 0, "ean8_cc_5addon_ccb_8x3.png", "" }, + /* 30*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "12345", "", 0, "ean5.png", "" }, + /* 31*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "12", "", 0, "ean2.png", "" }, + /* 32*/ { BARCODE_CODE39, -1, -1, SMALL_TEXT, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "123", "", 0, "code39_small.png", "" }, + /* 33*/ { BARCODE_POSTNET, -1, -1, -1, -1, -1, -1, -1, -1, 0, 3.5, { 0, 0, "" }, "", "", "12345", "", 0, "postnet_zip.png", "300 dpi, using 1/43in X, 300 / 43 / 2 = ~3.5 scale" }, + /* 34*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "CFCECDCC", "12345", "", 0, "pdf417_bgalpha.png", "" }, + /* 35*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "30313233", "", "12345", "", 0, "pdf417_fgalpha.png", "" }, + /* 36*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "20212244", "CFCECDCC", "12345", "", 0, "pdf417_bgfgalpha.png", "" }, + /* 37*/ { BARCODE_ULTRA, -1, -1, -1, 2, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "0000007F", "FF000033", "12345", "", 0, "ultra_bgfgalpha.png", "" }, + /* 38*/ { BARCODE_ULTRA, -1, -1, -1, 2, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "FF000033", "12345", "", 0, "ultra_bgalpha.png", "" }, + /* 39*/ { BARCODE_ULTRA, -1, -1, -1, 2, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "0000007F", "FF0000", "12345", "", 0, "ultra_fgalpha.png", "" }, + /* 40*/ { BARCODE_ULTRA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "0000007F", "", "12345", "", 0, "ultra_fgalpha_nobg.png", "" }, + /* 41*/ { BARCODE_ULTRA, -1, 1, BARCODE_BOX, 1, 1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "12345", "", 0, "ultra_hvwsp1_box1.png", "" }, + /* 42*/ { BARCODE_ULTRA, -1, 1, BARCODE_BOX, 1, 1, -1, -1, -1, 0, 0, { 0, 0, "" }, "00FF007F", "BABDB6", "12345", "", 0, "ultra_fgalpha_hvwsp1_box1.png", "" }, + /* 43*/ { BARCODE_ULTRA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0.5, { 0, 0, "" }, "", "", "1", "", 0, "ultra_odd.png", "" }, + /* 44*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0.5, { 0, 0, "" }, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_0.5.png", "6 dpmm, 150 dpi" }, + /* 45*/ { BARCODE_MAXICODE, -1, 1, BARCODE_BOX, 3, -1, -1, -1, -1, 0, 0.7, { 0, 0, "" }, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_0.7_wsp3_box1.png", "8 dpmm, 200 dpi" }, + /* 46*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1.4, { 0, 0, "" }, "1111117F", "EEEEEEEE", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_1.4_bgfgalpha.png", "16 dpmm, 400 dpi" }, + /* 47*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 2.1, { 0, 0, "" }, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_2.1.png", "24 dpmm, 600 dpi" }, + /* 48*/ { BARCODE_MAXICODE, -1, 2, BARCODE_BOX, 1, 1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_hvwsp1_box2.png", "" }, + /* 49*/ { BARCODE_MAXICODE, -1, 1, BARCODE_BIND, -1, 1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_vwsp1_bind1.png", "" }, + /* 50*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, -1, -1, -1, -1, -1, 0, 2.0f, { 0, 0, "" }, "", "", "1234", "", 0, "datamatrix_2.0_bind1_dotty.png", "" }, + /* 51*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, 1, 1, -1, -1, -1, 0, 2.0f, { 0, 0, "" }, "", "", "1234", "", 0, "datamatrix_2.0_hvwsp1_bind1_dotty.png", "" }, + /* 52*/ { BARCODE_DBAR_LTD, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "12345678909", "", 0, "dbar_ltd.png", "" }, + /* 53*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 5.0, 0, { 0, 0, "" }, "", "", "Your Data Here!", "", ZINT_WARN_NONCOMPLIANT, "pdf417_height5.png", "" }, + /* 54*/ { BARCODE_USPS_IMAIL, -1, -1, -1, -1, -1, -1, -1, -1, 7.75, 0, { 0, 0, "" }, "", "", "12345678901234567890", "", 0, "imail_height7.75.png", "" }, + /* 55*/ { BARCODE_AZTEC, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 4, 7, "Z1.txt" }, "", "", "3456", "", 0, "aztec_z1_seq4of7.png", "" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -248,6 +249,9 @@ static void test_print(int index, int generate, int debug) { if (data[i].whitespace_height != -1) { symbol->whitespace_height = data[i].whitespace_height; } + if (data[i].structapp.count) { + symbol->structapp = data[i].structapp; + } if (*data[i].fgcolour) { strcpy(symbol->fgcolour, data[i].fgcolour); } diff --git a/backend/tests/test_qr.c b/backend/tests/test_qr.c index 2cc4cc4a..85b4271c 100644 --- a/backend/tests/test_qr.c +++ b/backend/tests/test_qr.c @@ -36,6 +36,7 @@ static void test_qr_options(int index, int debug) { struct item { int option_1; int option_2; + struct zint_structapp structapp; char *data; int ret_encode; int ret_vector; @@ -45,40 +46,48 @@ static void test_qr_options(int index, int debug) { // 貫 U+8CAB kanji, in Shift JIS 0x8AD1 (\212\321), UTF-8 E8B2AB // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) struct item data[] = { - /* 0*/ { -1, -1, "12345", 0, 0, 21, -1 }, // ECC auto-set to 1 (L), version auto-set to 1 - /* 1*/ { 5, -1, "12345", 0, 0, 21, 0 }, // ECC > 4 ignored - /* 2*/ { -1, 41, "12345", 0, 0, 21, 0 }, // Version > 40 ignored - /* 3*/ { -1, 2, "12345", 0, 0, 25, -1 }, // ECC auto-set to 4 (Q), version 2 - /* 4*/ { 4, 2, "12345", 0, 0, 25, 0 }, // ECC 4 (Q), version 2 - /* 5*/ { 1, 2, "12345", 0, 0, 25, 1 }, // ECC 1 (L), version 2 - /* 6*/ { -1, -1, "貫やぐ識禁", 0, 0, 21, -1 }, // ECC auto-set to 1 (L), version auto-set to 1 - /* 7*/ { 1, -1, "貫やぐ識禁", 0, 0, 21, 0 }, // Version auto-set to 1 - /* 8*/ { -1, 1, "貫やぐ識禁", 0, 0, 21, 0 }, // ECC auto-set to 1 (L) - /* 9*/ { 1, 1, "貫やぐ識禁", 0, 0, 21, 0 }, - /* 10*/ { 2, 1, "貫やぐ識禁", ZINT_ERROR_TOO_LONG, -1, 0, -1 }, // ECC 2 (M), version 1 - /* 11*/ { 2, -1, "貫やぐ識禁", 0, 0, 25, -1 }, // Version auto-set to 2 - /* 12*/ { 2, 2, "貫やぐ識禁", 0, 0, 25, 0 }, - /* 13*/ { 1, 2, "貫やぐ識禁", 0, 0, 25, 1 }, - /* 14*/ { -1, -1, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁", 0, 0, 29, -1 }, // ECC auto-set to 1 (L), version auto-set to 3 - /* 15*/ { 1, 3, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁", 0, 0, 29, 0 }, - /* 16*/ { 2, -1, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁", 0, 0, 33, -1 }, // ECC 2 (M), version auto-set to 4 - /* 17*/ { 2, 4, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁", 0, 0, 33, 0 }, - /* 18*/ { 3, -1, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁", 0, 0, 37, -1 }, // ECC 3 (Q), version auto-set to 5 - /* 19*/ { 3, 5, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁", 0, 0, 37, 0 }, - /* 20*/ { 4, -1, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁", 0, 0, 41, -1 }, // ECC 4 (H), version auto-set to 6 - /* 21*/ { 4, 6, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁", 0, 0, 41, 0 }, - /* 22*/ { -1, -1, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁花ほゃ過法ひなご札17能つーびれ投覧マ勝動エヨ額界よみ作皇ナヲニ打題ヌルヲ掲布益フが。入35能ト権話しこを断兆モヘ細情おじ名4減エヘイハ側機はょが意見想ハ業独案ユヲウ患職ヲ平美さ毎放どぽたけ家没べお化富べ町大シ情魚ッでれ一冬すぼめり。", 0, 0, 69, -1 }, // ECC auto-set to 1, version auto-set to 13 - /* 23*/ { 1, 13, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁花ほゃ過法ひなご札17能つーびれ投覧マ勝動エヨ額界よみ作皇ナヲニ打題ヌルヲ掲布益フが。入35能ト権話しこを断兆モヘ細情おじ名4減エヘイハ側機はょが意見想ハ業独案ユヲウ患職ヲ平美さ毎放どぽたけ家没べお化富べ町大シ情魚ッでれ一冬すぼめり。", 0, 0, 69, 0 }, - /* 24*/ { 4, -1, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁花ほゃ過法ひなご札17能つーびれ投覧マ勝動エヨ額界よみ作皇ナヲニ打題ヌルヲ掲布益フが。入35能ト権話しこを断兆モヘ細情おじ名4減エヘイハ側機はょが意見想ハ業独案ユヲウ患職ヲ平美さ毎放どぽたけ家没べお化富べ町大シ情魚ッでれ一冬すぼめり。", 0, 0, 101, -1 }, // ECC 4, version auto-set to 21 - /* 25*/ { 4, 21, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁花ほゃ過法ひなご札17能つーびれ投覧マ勝動エヨ額界よみ作皇ナヲニ打題ヌルヲ掲布益フが。入35能ト権話しこを断兆モヘ細情おじ名4減エヘイハ側機はょが意見想ハ業独案ユヲウ患職ヲ平美さ毎放どぽたけ家没べお化富べ町大シ情魚ッでれ一冬すぼめり。", 0, 0, 101, 0 }, - /* 26*/ { -1, -1, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁花ほゃ過法ひなご札17能つーびれ投覧マ勝動エヨ額界よみ作皇ナヲニ打題ヌルヲ掲布益フが。入35能ト権話しこを断兆モヘ細情おじ名4減エヘイハ側機はょが意見想ハ業独案ユヲウ患職ヲ平美さ毎放どぽたけ家没べお化富べ町大シ情魚ッでれ一冬すぼめり。社ト可化モマ試音ばじご育青康演ぴぎ権型固スで能麩ぜらもほ河都しちほラ収90作の年要とだむ部動ま者断チ第41一1米索焦茂げむしれ。測フ物使だて目月国スリカハ夏検にいへ児72告物ゆは載核ロアメヱ登輸どべゃ催行アフエハ議歌ワ河倫剖だ。記タケウ因載ヒイホヤ禁3輩彦関トえび肝区勝ワリロ成禁ぼよ界白ウヒキレ中島べせぜい各安うしぽリ覧生テ基一でむしゃ中新トヒキソ声碁スしび起田ア信大未ゅもばち。", 0, 0, 105, -1 }, // ECC auto-set to 1, version auto-set to 22 - /* 27*/ { 1, 22, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁花ほゃ過法ひなご札17能つーびれ投覧マ勝動エヨ額界よみ作皇ナヲニ打題ヌルヲ掲布益フが。入35能ト権話しこを断兆モヘ細情おじ名4減エヘイハ側機はょが意見想ハ業独案ユヲウ患職ヲ平美さ毎放どぽたけ家没べお化富べ町大シ情魚ッでれ一冬すぼめり。社ト可化モマ試音ばじご育青康演ぴぎ権型固スで能麩ぜらもほ河都しちほラ収90作の年要とだむ部動ま者断チ第41一1米索焦茂げむしれ。測フ物使だて目月国スリカハ夏検にいへ児72告物ゆは載核ロアメヱ登輸どべゃ催行アフエハ議歌ワ河倫剖だ。記タケウ因載ヒイホヤ禁3輩彦関トえび肝区勝ワリロ成禁ぼよ界白ウヒキレ中島べせぜい各安うしぽリ覧生テ基一でむしゃ中新トヒキソ声碁スしび起田ア信大未ゅもばち。", 0, 0, 105, 0 }, - /* 28*/ { 4, -1, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁花ほゃ過法ひなご札17能つーびれ投覧マ勝動エヨ額界よみ作皇ナヲニ打題ヌルヲ掲布益フが。入35能ト権話しこを断兆モヘ細情おじ名4減エヘイハ側機はょが意見想ハ業独案ユヲウ患職ヲ平美さ毎放どぽたけ家没べお化富べ町大シ情魚ッでれ一冬すぼめり。社ト可化モマ試音ばじご育青康演ぴぎ権型固スで能麩ぜらもほ河都しちほラ収90作の年要とだむ部動ま者断チ第41一1米索焦茂げむしれ。測フ物使だて目月国スリカハ夏検にいへ児72告物ゆは載核ロアメヱ登輸どべゃ催行アフエハ議歌ワ河倫剖だ。記タケウ因載ヒイホヤ禁3輩彦関トえび肝区勝ワリロ成禁ぼよ界白ウヒキレ中島べせぜい各安うしぽリ覧生テ基一でむしゃ中新トヒキソ声碁スしび起田ア信大未ゅもばち。", 0, 0, 153, 1 }, // ECC 4, version auto-set 34 - /* 29*/ { 4, 34, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁花ほゃ過法ひなご札17能つーびれ投覧マ勝動エヨ額界よみ作皇ナヲニ打題ヌルヲ掲布益フが。入35能ト権話しこを断兆モヘ細情おじ名4減エヘイハ側機はょが意見想ハ業独案ユヲウ患職ヲ平美さ毎放どぽたけ家没べお化富べ町大シ情魚ッでれ一冬すぼめり。社ト可化モマ試音ばじご育青康演ぴぎ権型固スで能麩ぜらもほ河都しちほラ収90作の年要とだむ部動ま者断チ第41一1米索焦茂げむしれ。測フ物使だて目月国スリカハ夏検にいへ児72告物ゆは載核ロアメヱ登輸どべゃ催行アフエハ議歌ワ河倫剖だ。記タケウ因載ヒイホヤ禁3輩彦関トえび肝区勝ワリロ成禁ぼよ界白ウヒキレ中島べせぜい各安うしぽリ覧生テ基一でむしゃ中新トヒキソ声碁スしび起田ア信大未ゅもばち。", 0, 0, 153, 0 }, - /* 30*/ { 4, -1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, 0, 177, -1 }, // 1852 alphanumerics max for ECC 4 (H) - /* 31*/ { 1, -1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, 0, 177, -1 }, // 4296 alphanumerics max for ECC 1 (L) - /* 32*/ { 4, -1, "貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫", 0, -1, 0, -1 }, // 424 Kanji, ECC 4 (Q), version 1 - /* 33*/ { 4, -1, "貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫", ZINT_ERROR_TOO_LONG, -1, 0, -1 }, // 425 Kanji, ECC 4 (Q), version 1 + /* 0*/ { -1, -1, { 0, 0, "" }, "12345", 0, 0, 21, -1 }, // ECC auto-set to 1 (L), version auto-set to 1 + /* 1*/ { 5, -1, { 0, 0, "" }, "12345", 0, 0, 21, 0 }, // ECC > 4 ignored + /* 2*/ { -1, 41, { 0, 0, "" }, "12345", 0, 0, 21, 0 }, // Version > 40 ignored + /* 3*/ { -1, 2, { 0, 0, "" }, "12345", 0, 0, 25, -1 }, // ECC auto-set to 4 (Q), version 2 + /* 4*/ { 4, 2, { 0, 0, "" }, "12345", 0, 0, 25, 0 }, // ECC 4 (Q), version 2 + /* 5*/ { 1, 2, { 0, 0, "" }, "12345", 0, 0, 25, 1 }, // ECC 1 (L), version 2 + /* 6*/ { -1, -1, { 0, 0, "" }, "貫やぐ識禁", 0, 0, 21, -1 }, // ECC auto-set to 1 (L), version auto-set to 1 + /* 7*/ { 1, -1, { 0, 0, "" }, "貫やぐ識禁", 0, 0, 21, 0 }, // Version auto-set to 1 + /* 8*/ { -1, 1, { 0, 0, "" }, "貫やぐ識禁", 0, 0, 21, 0 }, // ECC auto-set to 1 (L) + /* 9*/ { 1, 1, { 0, 0, "" }, "貫やぐ識禁", 0, 0, 21, 0 }, + /* 10*/ { 2, 1, { 0, 0, "" }, "貫やぐ識禁", ZINT_ERROR_TOO_LONG, -1, 0, -1 }, // ECC 2 (M), version 1 + /* 11*/ { 2, -1, { 0, 0, "" }, "貫やぐ識禁", 0, 0, 25, -1 }, // Version auto-set to 2 + /* 12*/ { 2, 2, { 0, 0, "" }, "貫やぐ識禁", 0, 0, 25, 0 }, + /* 13*/ { 1, 2, { 0, 0, "" }, "貫やぐ識禁", 0, 0, 25, 1 }, + /* 14*/ { -1, -1, { 0, 0, "" }, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁", 0, 0, 29, -1 }, // ECC auto-set to 1 (L), version auto-set to 3 + /* 15*/ { 1, 3, { 0, 0, "" }, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁", 0, 0, 29, 0 }, + /* 16*/ { 2, -1, { 0, 0, "" }, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁", 0, 0, 33, -1 }, // ECC 2 (M), version auto-set to 4 + /* 17*/ { 2, 4, { 0, 0, "" }, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁", 0, 0, 33, 0 }, + /* 18*/ { 3, -1, { 0, 0, "" }, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁", 0, 0, 37, -1 }, // ECC 3 (Q), version auto-set to 5 + /* 19*/ { 3, 5, { 0, 0, "" }, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁", 0, 0, 37, 0 }, + /* 20*/ { 4, -1, { 0, 0, "" }, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁", 0, 0, 41, -1 }, // ECC 4 (H), version auto-set to 6 + /* 21*/ { 4, 6, { 0, 0, "" }, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁", 0, 0, 41, 0 }, + /* 22*/ { -1, -1, { 0, 0, "" }, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁花ほゃ過法ひなご札17能つーびれ投覧マ勝動エヨ額界よみ作皇ナヲニ打題ヌルヲ掲布益フが。入35能ト権話しこを断兆モヘ細情おじ名4減エヘイハ側機はょが意見想ハ業独案ユヲウ患職ヲ平美さ毎放どぽたけ家没べお化富べ町大シ情魚ッでれ一冬すぼめり。", 0, 0, 69, -1 }, // ECC auto-set to 1, version auto-set to 13 + /* 23*/ { 1, 13, { 0, 0, "" }, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁花ほゃ過法ひなご札17能つーびれ投覧マ勝動エヨ額界よみ作皇ナヲニ打題ヌルヲ掲布益フが。入35能ト権話しこを断兆モヘ細情おじ名4減エヘイハ側機はょが意見想ハ業独案ユヲウ患職ヲ平美さ毎放どぽたけ家没べお化富べ町大シ情魚ッでれ一冬すぼめり。", 0, 0, 69, 0 }, + /* 24*/ { 4, -1, { 0, 0, "" }, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁花ほゃ過法ひなご札17能つーびれ投覧マ勝動エヨ額界よみ作皇ナヲニ打題ヌルヲ掲布益フが。入35能ト権話しこを断兆モヘ細情おじ名4減エヘイハ側機はょが意見想ハ業独案ユヲウ患職ヲ平美さ毎放どぽたけ家没べお化富べ町大シ情魚ッでれ一冬すぼめり。", 0, 0, 101, -1 }, // ECC 4, version auto-set to 21 + /* 25*/ { 4, 21, { 0, 0, "" }, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁花ほゃ過法ひなご札17能つーびれ投覧マ勝動エヨ額界よみ作皇ナヲニ打題ヌルヲ掲布益フが。入35能ト権話しこを断兆モヘ細情おじ名4減エヘイハ側機はょが意見想ハ業独案ユヲウ患職ヲ平美さ毎放どぽたけ家没べお化富べ町大シ情魚ッでれ一冬すぼめり。", 0, 0, 101, 0 }, + /* 26*/ { -1, -1, { 0, 0, "" }, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁花ほゃ過法ひなご札17能つーびれ投覧マ勝動エヨ額界よみ作皇ナヲニ打題ヌルヲ掲布益フが。入35能ト権話しこを断兆モヘ細情おじ名4減エヘイハ側機はょが意見想ハ業独案ユヲウ患職ヲ平美さ毎放どぽたけ家没べお化富べ町大シ情魚ッでれ一冬すぼめり。社ト可化モマ試音ばじご育青康演ぴぎ権型固スで能麩ぜらもほ河都しちほラ収90作の年要とだむ部動ま者断チ第41一1米索焦茂げむしれ。測フ物使だて目月国スリカハ夏検にいへ児72告物ゆは載核ロアメヱ登輸どべゃ催行アフエハ議歌ワ河倫剖だ。記タケウ因載ヒイホヤ禁3輩彦関トえび肝区勝ワリロ成禁ぼよ界白ウヒキレ中島べせぜい各安うしぽリ覧生テ基一でむしゃ中新トヒキソ声碁スしび起田ア信大未ゅもばち。", 0, 0, 105, -1 }, // ECC auto-set to 1, version auto-set to 22 + /* 27*/ { 1, 22, { 0, 0, "" }, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁花ほゃ過法ひなご札17能つーびれ投覧マ勝動エヨ額界よみ作皇ナヲニ打題ヌルヲ掲布益フが。入35能ト権話しこを断兆モヘ細情おじ名4減エヘイハ側機はょが意見想ハ業独案ユヲウ患職ヲ平美さ毎放どぽたけ家没べお化富べ町大シ情魚ッでれ一冬すぼめり。社ト可化モマ試音ばじご育青康演ぴぎ権型固スで能麩ぜらもほ河都しちほラ収90作の年要とだむ部動ま者断チ第41一1米索焦茂げむしれ。測フ物使だて目月国スリカハ夏検にいへ児72告物ゆは載核ロアメヱ登輸どべゃ催行アフエハ議歌ワ河倫剖だ。記タケウ因載ヒイホヤ禁3輩彦関トえび肝区勝ワリロ成禁ぼよ界白ウヒキレ中島べせぜい各安うしぽリ覧生テ基一でむしゃ中新トヒキソ声碁スしび起田ア信大未ゅもばち。", 0, 0, 105, 0 }, + /* 28*/ { 4, -1, { 0, 0, "" }, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁花ほゃ過法ひなご札17能つーびれ投覧マ勝動エヨ額界よみ作皇ナヲニ打題ヌルヲ掲布益フが。入35能ト権話しこを断兆モヘ細情おじ名4減エヘイハ側機はょが意見想ハ業独案ユヲウ患職ヲ平美さ毎放どぽたけ家没べお化富べ町大シ情魚ッでれ一冬すぼめり。社ト可化モマ試音ばじご育青康演ぴぎ権型固スで能麩ぜらもほ河都しちほラ収90作の年要とだむ部動ま者断チ第41一1米索焦茂げむしれ。測フ物使だて目月国スリカハ夏検にいへ児72告物ゆは載核ロアメヱ登輸どべゃ催行アフエハ議歌ワ河倫剖だ。記タケウ因載ヒイホヤ禁3輩彦関トえび肝区勝ワリロ成禁ぼよ界白ウヒキレ中島べせぜい各安うしぽリ覧生テ基一でむしゃ中新トヒキソ声碁スしび起田ア信大未ゅもばち。", 0, 0, 153, 1 }, // ECC 4, version auto-set 34 + /* 29*/ { 4, 34, { 0, 0, "" }, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁花ほゃ過法ひなご札17能つーびれ投覧マ勝動エヨ額界よみ作皇ナヲニ打題ヌルヲ掲布益フが。入35能ト権話しこを断兆モヘ細情おじ名4減エヘイハ側機はょが意見想ハ業独案ユヲウ患職ヲ平美さ毎放どぽたけ家没べお化富べ町大シ情魚ッでれ一冬すぼめり。社ト可化モマ試音ばじご育青康演ぴぎ権型固スで能麩ぜらもほ河都しちほラ収90作の年要とだむ部動ま者断チ第41一1米索焦茂げむしれ。測フ物使だて目月国スリカハ夏検にいへ児72告物ゆは載核ロアメヱ登輸どべゃ催行アフエハ議歌ワ河倫剖だ。記タケウ因載ヒイホヤ禁3輩彦関トえび肝区勝ワリロ成禁ぼよ界白ウヒキレ中島べせぜい各安うしぽリ覧生テ基一でむしゃ中新トヒキソ声碁スしび起田ア信大未ゅもばち。", 0, 0, 153, 0 }, + /* 30*/ { 4, -1, { 0, 0, "" }, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, 0, 177, -1 }, // 1852 alphanumerics max for ECC 4 (H) + /* 31*/ { 1, -1, { 0, 0, "" }, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, 0, 177, -1 }, // 4296 alphanumerics max for ECC 1 (L) + /* 32*/ { 4, -1, { 0, 0, "" }, "貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫", 0, -1, 0, -1 }, // 424 Kanji, ECC 4 (Q), version 1 + /* 33*/ { 4, -1, { 0, 0, "" }, "貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫", ZINT_ERROR_TOO_LONG, -1, 0, -1 }, // 425 Kanji, ECC 4 (Q), version 1 + /* 34*/ { 4, 1, { 0, 0, "" }, "12345678901234567", 0, 0, 21, -1 }, + /* 35*/ { 4, 1, { 1, 2, "" }, "12345678901234567", ZINT_ERROR_TOO_LONG, -1, 0, -1 }, + /* 36*/ { 4, 1, { 1, 2, "" }, "123456789012", ZINT_ERROR_TOO_LONG, -1, 0, -1 }, + /* 37*/ { 4, 1, { 1, 2, "" }, "12345678901", 0, 0, 21, -1 }, + /* 38*/ { 4, 1, { 3, 16, "123" }, "12345678901", 0, 0, 21, -1 }, + /* 39*/ { 4, 1, { 3, 17, "123" }, "12345678901", ZINT_ERROR_INVALID_OPTION, -1, 0, -1 }, // Bad Structured Append count + /* 40*/ { 4, 1, { 3, 2, "123" }, "12345678901", ZINT_ERROR_INVALID_OPTION, -1, 0, -1 }, // Bad Structured Append index + /* 41*/ { 4, 1, { 1, 2, "256" }, "12345678901", ZINT_ERROR_INVALID_OPTION, -1, 0, -1 }, // Bad Structured Append ID }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -97,6 +106,9 @@ static void test_qr_options(int index, int debug) { assert_nonnull(symbol, "Symbol not created\n"); length = testUtilSetSymbol(symbol, BARCODE_QRCODE, -1 /*input_mode*/, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug); + if (data[i].structapp.count) { + symbol->structapp = data[i].structapp; + } ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret_encode, symbol->errtxt); @@ -278,7 +290,7 @@ static void test_qr_input(int index, int generate, int debug) { int i, length, ret; struct zint_symbol *symbol; - char escaped[1024]; + char escaped[4096]; testStart("test_qr_input"); @@ -343,7 +355,7 @@ static void test_qr_gs1(int index, int generate, int debug) { int i, length, ret; struct zint_symbol *symbol; - char escaped[1024]; + char escaped[4096]; testStart("test_qr_gs1"); @@ -421,7 +433,7 @@ static void test_qr_optimize(int index, int generate, int debug) { int i, length, ret; struct zint_symbol *symbol; - char escaped[1024]; + char escaped[4096]; testStart("test_qr_optimize"); @@ -462,6 +474,7 @@ static void test_qr_encode(int index, int generate, int debug) { int option_1; int option_2; int option_3; + struct zint_structapp structapp; char *data; int ret; @@ -473,7 +486,7 @@ static void test_qr_encode(int index, int generate, int debug) { }; // や U+3084 kanji, in Shift JIS 0x82E2 (\202\342), UTF-8 E38284; its 2nd byte 0xE2 + 0x40-FC also form Shift JIS struct item data[] = { - /* 0*/ { BARCODE_QRCODE, UNICODE_MODE, -1, -1, -1, "QR Code Symbol", 0, 21, 21, 0, "ISO 18004 Figure 1 **NOT SAME** uses mask 110 instead of 101; BWIPP uses 101", + /* 0*/ { BARCODE_QRCODE, UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "QR Code Symbol", 0, 21, 21, 0, "ISO 18004 Figure 1 **NOT SAME** uses mask 110 instead of 101; BWIPP uses 101", "111111101001101111111" "100000101001101000001" "101110101100101011101" @@ -496,7 +509,7 @@ static void test_qr_encode(int index, int generate, int debug) { "100000100001101111111" "111111101001011000000" }, - /* 1*/ { BARCODE_QRCODE, UNICODE_MODE, -1, -1, 6 << 8, "QR Code Symbol", 0, 21, 21, 1, "ISO 18004 Figure 1, explicit mask 101, same", + /* 1*/ { BARCODE_QRCODE, UNICODE_MODE, -1, -1, 6 << 8, { 0, 0, "" }, "QR Code Symbol", 0, 21, 21, 1, "ISO 18004 Figure 1, explicit mask 101, same", "111111100001101111111" "100000101001101000001" "101110101110101011101" @@ -519,7 +532,7 @@ static void test_qr_encode(int index, int generate, int debug) { "100000100001110111100" "111111101011001010010" }, - /* 2*/ { BARCODE_QRCODE, UNICODE_MODE, 2, -1, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 33, 33, 1, "ISO 18004 Figure 29, same (mask 100)", + /* 2*/ { BARCODE_QRCODE, UNICODE_MODE, 2, -1, -1, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 33, 33, 1, "ISO 18004 Figure 29 (top), same (mask 100)", "111111101100110010010010101111111" "100000100010111010111000101000001" "101110100000001101101100001011101" @@ -554,7 +567,99 @@ static void test_qr_encode(int index, int generate, int debug) { "100000100010110111000110101001001" "111111101101101011010000111100011" }, - /* 3*/ { BARCODE_QRCODE, UNICODE_MODE, 2, 1, -1, "01234567", 0, 21, 21, 0, "ISO 18004 Annex I I.2, same (mask 010); BWIPP uses mask 000", + /* 3*/ { BARCODE_QRCODE, UNICODE_MODE, 2, -1, -1, { 1, 4, "1" }, "ABCDEFGHIJKLMN", 0, 21, 21, 1, "ISO 18004 Figure 29 (bottom 1st), same", + "111111100110001111111" + "100000101001101000001" + "101110100010001011101" + "101110100110001011101" + "101110101110101011101" + "100000100110101000001" + "111111101010101111111" + "000000000011100000000" + "101010100011000010010" + "100011011111010011011" + "100010111110101110101" + "010110000101011000000" + "110000111110110111001" + "000000001011010001010" + "111111100101110011101" + "100000100100001110101" + "101110101101011000101" + "101110100110100110110" + "101110101011010011101" + "100000100101110000001" + "111111101000110110101" + }, + /* 4*/ { BARCODE_QRCODE, UNICODE_MODE, 2, -1, 8 << 8, { 2, 4, "1" }, "OPQRSTUVWXYZ0123", 0, 21, 21, 1, "ISO 18004 Figure 29 (bottom 2nd), same with explicit mask 111 (auto 011)", + "111111100011101111111" + "100000100001101000001" + "101110100001101011101" + "101110100101101011101" + "101110100100101011101" + "100000101000001000001" + "111111101010101111111" + "000000000111000000000" + "100101101001010100000" + "010111001001110011011" + "011110101011010010111" + "010100011110100110101" + "011100101100111110101" + "000000001011011100000" + "111111100110100011100" + "100000101001010100001" + "101110100100101101111" + "101110101100000010001" + "101110100110101001101" + "100000100111100011111" + "111111101011011110100" + }, + /* 5*/ { BARCODE_QRCODE, UNICODE_MODE, 2, -1, -1, { 3, 4, "1" }, "456789ABCDEFGHIJ", 0, 21, 21, 1, "ISO 18004 Figure 29 (bottom 3rd), same", + "111111100101001111111" + "100000100011101000001" + "101110100010101011101" + "101110100111101011101" + "101110100010101011101" + "100000101110001000001" + "111111101010101111111" + "000000000001000000000" + "100101101101010100000" + "011011000001100111011" + "101010111101010110111" + "011001000101010100101" + "011111100110000110101" + "000000001010000111000" + "111111100100101101100" + "100000101101011001101" + "101110100010001101011" + "101110101101101110110" + "101110100100011001101" + "100000100011100101011" + "111111101011000011000" + }, + /* 6*/ { BARCODE_QRCODE, UNICODE_MODE, 2, -1, -1, { 4, 4, "1" }, "KLMNOPQRSTUVWXYZ", 0, 21, 21, 1, "ISO 18004 Figure 29 (bottom 4th), same", + "111111101011101111111" + "100000101010101000001" + "101110100011001011101" + "101110101100001011101" + "101110100111001011101" + "100000100110001000001" + "111111101010101111111" + "000000001101000000000" + "101101110110101001011" + "010001011000010000101" + "010000111010100101001" + "110101001110001000100" + "001101100000110000100" + "000000001010101001001" + "111111101111010111110" + "100000101000101000011" + "101110100101011000001" + "101110101001111100101" + "101110101001101111100" + "100000100010110010010" + "111111101110110101110" + }, + /* 7*/ { BARCODE_QRCODE, UNICODE_MODE, 2, 1, -1, { 0, 0, "" }, "01234567", 0, 21, 21, 0, "ISO 18004 Annex I I.2, same (mask 010); BWIPP uses mask 000", "111111100101101111111" "100000100111101000001" "101110101000001011101" @@ -577,7 +682,7 @@ static void test_qr_encode(int index, int generate, int debug) { "100000100000000110110" "111111101111010010100" }, - /* 4*/ { BARCODE_QRCODE, UNICODE_MODE, 2, 1, 1 << 8, "01234567", 0, 21, 21, 1, "ISO 18004 Annex I Figure I.2, explicit mask 000, same as BWIPP", + /* 8*/ { BARCODE_QRCODE, UNICODE_MODE, 2, 1, 1 << 8, { 0, 0, "" }, "01234567", 0, 21, 21, 1, "ISO 18004 Annex I Figure I.2, explicit mask 000, same as BWIPP", "111111100011101111111" "100000101110001000001" "101110100110001011101" @@ -600,7 +705,7 @@ static void test_qr_encode(int index, int generate, int debug) { "100000100001110111000" "111111101001011100101" }, - /* 5*/ { BARCODE_QRCODE, GS1_MODE, 1, -1, -1, "[01]09501101530003[8200]http://example.com", 0, 25, 25, 0, "GS1 General Specifications 21.0.1 Figure 5.1-7 **NOT SAME** figure uses Byte encodation only; BWIPP uses mask 001", + /* 9*/ { BARCODE_QRCODE, GS1_MODE, 1, -1, -1, { 0, 0, "" }, "[01]09501101530003[8200]http://example.com", 0, 25, 25, 0, "GS1 General Specifications 21.0.1 Figure 5.1-7 **NOT SAME** figure uses Byte encodation only; BWIPP uses mask 001", "1111111001101101001111111" "1000001010010101001000001" "1011101011111010101011101" @@ -627,7 +732,7 @@ static void test_qr_encode(int index, int generate, int debug) { "1000001010110101100111010" "1111111011101100010010111" }, - /* 6*/ { BARCODE_QRCODE, GS1_MODE, 1, -1, 2 << 8, "[01]09501101530003[8200]http://example.com", 0, 25, 25, 1, "GS1 General Specifications 21.0.1 Figure 5.1-7, explicit mask 001, same as BWIPP", + /* 10*/ { BARCODE_QRCODE, GS1_MODE, 1, -1, 2 << 8, { 0, 0, "" }, "[01]09501101530003[8200]http://example.com", 0, 25, 25, 1, "GS1 General Specifications 21.0.1 Figure 5.1-7, explicit mask 001, same as BWIPP", "1111111010111000001111111" "1000001011100100101000001" "1011101000111101101011101" @@ -654,7 +759,7 @@ static void test_qr_encode(int index, int generate, int debug) { "1000001011110010100000010" "1111111010111001000111101" }, - /* 7*/ { BARCODE_QRCODE, GS1_MODE, 2, -1, -1, "[01]00857674002010[8200]http://www.gs1.org/", 0, 29, 29, 0, "GS1 General Specifications 21.0.1 Figure 5.7.3-1, same (mask 011); BWIPP uses mask 101", + /* 11*/ { BARCODE_QRCODE, GS1_MODE, 2, -1, -1, { 0, 0, "" }, "[01]00857674002010[8200]http://www.gs1.org/", 0, 29, 29, 0, "GS1 General Specifications 21.0.1 Figure 5.7.3-1, same (mask 011); BWIPP uses mask 101", "11111110100101110101001111111" "10000010111101001000001000001" "10111010010000001110001011101" @@ -685,7 +790,7 @@ static void test_qr_encode(int index, int generate, int debug) { "10000010010111010001110010100" "11111110101111111011110100110" }, - /* 8*/ { BARCODE_QRCODE, GS1_MODE, 2, -1, 6 << 8, "[01]00857674002010[8200]http://www.gs1.org/", 0, 29, 29, 1, "GS1 General Specifications 21.0.1 Figure 5.7.3-1, explicit mask 101, same as BWIPP", + /* 12*/ { BARCODE_QRCODE, GS1_MODE, 2, -1, 6 << 8, { 0, 0, "" }, "[01]00857674002010[8200]http://www.gs1.org/", 0, 29, 29, 1, "GS1 General Specifications 21.0.1 Figure 5.7.3-1, explicit mask 101, same as BWIPP", "11111110001000011000101111111" "10000010111011101110101000001" "10111010101011010101001011101" @@ -716,7 +821,7 @@ static void test_qr_encode(int index, int generate, int debug) { "10000010001111101001001010011" "11111110111001001101000010000" }, - /* 9*/ { BARCODE_HIBC_QR, -1, 2, -1, -1, "H123ABC01234567890", 0, 21, 21, 1, "ANSI/HIBC 2.6 - 2016 Figure C5 same (mask 001)", + /* 13*/ { BARCODE_HIBC_QR, -1, 2, -1, -1, { 0, 0, "" }, "H123ABC01234567890", 0, 21, 21, 1, "ANSI/HIBC 2.6 - 2016 Figure C5 same (mask 001)", "111111101010001111111" "100000100100101000001" "101110101011001011101" @@ -739,7 +844,7 @@ static void test_qr_encode(int index, int generate, int debug) { "100000100100101111001" "111111101111011001111" }, - /* 10*/ { BARCODE_HIBC_QR, -1, 2, -1, -1, "/EU720060FF0/O523201", 0, 25, 25, 0, "HIBC/PAS Section 2.2 2nd Purchase Order **NOT SAME** uses mask 100 instead of 011; BWIPP uses mask 011", + /* 14*/ { BARCODE_HIBC_QR, -1, 2, -1, -1, { 0, 0, "" }, "/EU720060FF0/O523201", 0, 25, 25, 0, "HIBC/PAS Section 2.2 2nd Purchase Order **NOT SAME** uses mask 100 instead of 011; BWIPP uses mask 011", "1111111011011110101111111" "1000001001001111001000001" "1011101001010010001011101" @@ -766,7 +871,7 @@ static void test_qr_encode(int index, int generate, int debug) { "1000001000010100100011111" "1111111010101101111000001" }, - /* 11*/ { BARCODE_HIBC_QR, -1, 2, -1, 4 << 8, "/EU720060FF0/O523201", 0, 25, 25, 1, "HIBC/PAS Section 2.2 2nd Purchase Order same, explicit mask 011", + /* 15*/ { BARCODE_HIBC_QR, -1, 2, -1, 4 << 8, { 0, 0, "" }, "/EU720060FF0/O523201", 0, 25, 25, 1, "HIBC/PAS Section 2.2 2nd Purchase Order same, explicit mask 011", "1111111010011001101111111" "1000001011010011001000001" "1011101000000111001011101" @@ -793,7 +898,7 @@ static void test_qr_encode(int index, int generate, int debug) { "1000001001000001110110101" "1111111011101010111111001" }, - /* 12*/ { BARCODE_HIBC_QR, -1, 2, -1, -1, "/KN12345", 0, 21, 21, 1, "HIBC/PAS Section 2.2 Asset Tag **NOT SAME** uses mask 000 instead of 100", + /* 16*/ { BARCODE_HIBC_QR, -1, 2, -1, -1, { 0, 0, "" }, "/KN12345", 0, 21, 21, 1, "HIBC/PAS Section 2.2 Asset Tag **NOT SAME** uses mask 000 instead of 100", "111111100000101111111" "100000101010101000001" "101110100011001011101" @@ -816,7 +921,7 @@ static void test_qr_encode(int index, int generate, int debug) { "100000100100001100111" "111111101000101110101" }, - /* 13*/ { BARCODE_HIBC_QR, -1, 2, -1, 5 << 8, "/KN12345", 0, 21, 21, 1, "HIBC/PAS Section 2.2 Asset Tag, same, explicit mask 100", + /* 17*/ { BARCODE_HIBC_QR, -1, 2, -1, 5 << 8, { 0, 0, "" }, "/KN12345", 0, 21, 21, 1, "HIBC/PAS Section 2.2 Asset Tag, same, explicit mask 100", "111111101010101111111" "100000100111001000001" "101110100110101011101" @@ -839,7 +944,7 @@ static void test_qr_encode(int index, int generate, int debug) { "100000100110011110101" "111111101010111100111" }, - /* 14*/ { BARCODE_QRCODE, UNICODE_MODE, 1, -1, -1, "12345678901234567890123456789012345678901", 0, 21, 21, 1, "Max capacity ECC 1 Version 1 41 numbers", + /* 18*/ { BARCODE_QRCODE, UNICODE_MODE, 1, -1, -1, { 0, 0, "" }, "12345678901234567890123456789012345678901", 0, 21, 21, 1, "Max capacity ECC 1 Version 1 41 numbers", "111111101001001111111" "100000101100101000001" "101110101011101011101" @@ -862,7 +967,7 @@ static void test_qr_encode(int index, int generate, int debug) { "100000101000101001010" "111111101010110000111" }, - /* 15*/ { BARCODE_QRCODE, UNICODE_MODE, 2, -1, -1, "12345678901234567890123456789012345678901", 0, 25, 25, 1, "ECC 2 auto-sets version 2", + /* 19*/ { BARCODE_QRCODE, UNICODE_MODE, 2, -1, -1, { 0, 0, "" }, "12345678901234567890123456789012345678901", 0, 25, 25, 1, "ECC 2 auto-sets version 2", "1111111011001110101111111" "1000001001000000001000001" "1011101011001111101011101" @@ -889,7 +994,7 @@ static void test_qr_encode(int index, int generate, int debug) { "1000001000000100111010110" "1111111010011100001100111" }, - /* 16*/ { BARCODE_QRCODE, UNICODE_MODE, 4, 10, -1, "点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点", 0, 57, 57, 1, "Max capacity ECC 4 Version 10 74 kanji", + /* 20*/ { BARCODE_QRCODE, UNICODE_MODE, 4, 10, -1, { 0, 0, "" }, "点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点", 0, 57, 57, 1, "Max capacity ECC 4 Version 10 74 kanji", "111111100111100000011001000011111100010010011011001111111" "100000100011100101110000101000101001101111000001001000001" "101110101001011100010001111110111100101001100011001011101" @@ -948,7 +1053,7 @@ static void test_qr_encode(int index, int generate, int debug) { "100000100110011101110011001101110110101010001101000011011" "111111100010001101010110001001000001001011001001011001011" }, - /* 17*/ { BARCODE_QRCODE, UNICODE_MODE, 4, 27, -1, "点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点", 0, 125, 125, 1, "Max capacity ECC 4 Version 27 385 kanji", + /* 21*/ { BARCODE_QRCODE, UNICODE_MODE, 4, 27, -1, { 0, 0, "" }, "点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点", 0, 125, 125, 1, "Max capacity ECC 4 Version 27 385 kanji", "11111110101001001100111100100011110001010011110000001100010110100011101010111000011101101001011111001111101101101001101111111" "10000010110001101110011001101111000101001011011001100110101000101010011110000000101000100101101110110000011110100110001000001" "10111010100000000100000101000101111001011001010100100100100000000101100011010001100111101010010101101101101101101101001011101" @@ -1075,7 +1180,7 @@ static void test_qr_encode(int index, int generate, int debug) { "10000010010111001111010001100001010001010110110001100000111101011100000010010111101001001100101101111011011001000001101001110" "11111110000000010001110110000001010111011111000000111111010101110100101000110111000101101011001100000101101101101001100111111" }, - /* 18*/ { BARCODE_QRCODE, UNICODE_MODE, 4, 40, -1, "点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点" "点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点", 0, 177, 177, 1, "Max capacity ECC 4 Version 40 784 kanji", + /* 22*/ { BARCODE_QRCODE, UNICODE_MODE, 4, 40, -1, { 0, 0, "" }, "点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点" "点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点点", 0, 177, 177, 1, "Max capacity ECC 4 Version 40 784 kanji", "111111101010001111111101101110111010110111001110101000010001011011011101001110110011111011010000010101001010011110010000010110111111001001011111101000010010111111001010001111111" "100000101010110001001000101111011001001100100110110000000111110101111011110001101110000111000100101111010011001111100111111001001011011011110011011111111001000010010010101000001" "101110101001001101111001110010010100000000111001001011111000001001111111101010000111011010011010010001111010111001100011000011110100101110001010110001011110011011011010001011101" @@ -1253,9 +1358,8 @@ static void test_qr_encode(int index, int generate, int debug) { "101110101010001011100101111010101100101000101001100110010011111001110110010100001111001101110110111110001101101110111011011011011011110011010111110001011111101011011011011111100" "100000100000010000101110000100011000011110011100010100000011111110010100001100010010001001110010000000110010100111101101010110111111001000101010011011011000011110111110000000000" "111111100000001110110110101010011010010100111111101001111101110111010110101111000111011001110100010111000100111000011011001011010011010011010101111010000011100001000011111011001" - }, - /* 19*/ { BARCODE_QRCODE, UNICODE_MODE, 4, -1, ZINT_FULL_MULTIBYTE, "áA", 0, 21, 21, 1, "Mask automatic (001)", + /* 23*/ { BARCODE_QRCODE, UNICODE_MODE, 4, -1, ZINT_FULL_MULTIBYTE, { 0, 0, "" }, "áA", 0, 21, 21, 1, "Mask automatic (001)", "111111100101101111111" "100000101001101000001" "101110101010101011101" @@ -1278,7 +1382,7 @@ static void test_qr_encode(int index, int generate, int debug) { "100000100100111010000" "111111100011001000110" }, - /* 20*/ { BARCODE_QRCODE, UNICODE_MODE, 4, -1, ZINT_FULL_MULTIBYTE | (8 << 8), "áA", 0, 21, 21, 1, "Mask 111", + /* 24*/ { BARCODE_QRCODE, UNICODE_MODE, 4, -1, ZINT_FULL_MULTIBYTE | (8 << 8), { 0, 0, "" }, "áA", 0, 21, 21, 1, "Mask 111", "111111101000101111111" "100000101110101000001" "101110100110101011101" @@ -1301,7 +1405,7 @@ static void test_qr_encode(int index, int generate, int debug) { "100000100011111101000" "111111100111010100101" }, - /* 21*/ { BARCODE_QRCODE, UNICODE_MODE, 4, -1, ZINT_FULL_MULTIBYTE | (9 << 8), "áA", 0, 21, 21, 1, "Mask > 111 ignored", + /* 25*/ { BARCODE_QRCODE, UNICODE_MODE, 4, -1, ZINT_FULL_MULTIBYTE | (9 << 8), { 0, 0, "" }, "áA", 0, 21, 21, 1, "Mask > 111 ignored", "111111100101101111111" "100000101001101000001" "101110101010101011101" @@ -1324,7 +1428,7 @@ static void test_qr_encode(int index, int generate, int debug) { "100000100100111010000" "111111100011001000110" }, - /* 22*/ { BARCODE_QRCODE, UNICODE_MODE, 2, 1, -1, "1234567890", 0, 21, 21, 0, "test_print example, automatic mask 001 (same score as mask 010); BWIPP uses mask 010", + /* 26*/ { BARCODE_QRCODE, UNICODE_MODE, 2, 1, -1, { 0, 0, "" }, "1234567890", 0, 21, 21, 0, "test_print example, automatic mask 001 (same score as mask 010); BWIPP uses mask 010", "111111101001101111111" "100000100100101000001" "101110101001001011101" @@ -1347,7 +1451,7 @@ static void test_qr_encode(int index, int generate, int debug) { "100000100001011000010" "111111101011111111111" }, - /* 23*/ { BARCODE_QRCODE, UNICODE_MODE, 2, 1, 3 << 8, "1234567890", 0, 21, 21, 1, "test_print example, explicit mask 010", + /* 27*/ { BARCODE_QRCODE, UNICODE_MODE, 2, 1, 3 << 8, { 0, 0, "" }, "1234567890", 0, 21, 21, 1, "test_print example, explicit mask 010", "111111100010101111111" "100000100000001000001" "101110101010001011101" @@ -1370,7 +1474,7 @@ static void test_qr_encode(int index, int generate, int debug) { "100000100101111100110" "111111101000100100100" }, - /* 24*/ { BARCODE_QRCODE, UNICODE_MODE, 1, 2, 2 << 8, "?ややややwやややや ややややや", 0, 25, 25, 1, "Data with Shift JIS '2nd byte 1st byte' matches; explicit mask 001 (auto 000) to match BWIPP", + /* 28*/ { BARCODE_QRCODE, UNICODE_MODE, 1, 2, 2 << 8, { 0, 0, "" }, "?ややややwやややや ややややや", 0, 25, 25, 1, "Data with Shift JIS '2nd byte 1st byte' matches; explicit mask 001 (auto 000) to match BWIPP", "1111111010111110001111111" "1000001011100101001000001" "1011101000111110101011101" @@ -1402,7 +1506,7 @@ static void test_qr_encode(int index, int generate, int debug) { int i, length, ret; struct zint_symbol *symbol; - char escaped[1024]; + char escaped[4096]; char bwipp_buf[32768]; char bwipp_msg[1024]; @@ -1419,14 +1523,18 @@ static void test_qr_encode(int index, int generate, int debug) { assert_nonnull(symbol, "Symbol not created\n"); length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, data[i].option_3, -1 /*output_options*/, data[i].data, -1, debug); + if (data[i].structapp.count) { + symbol->structapp = data[i].structapp; + } 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, %s, %d, %d, %s, \"%s\", %s, %d, %d, %d, \"%s\",\n", + printf(" /*%3d*/ { %s, %s, %d, %d, %s, { %d, %d, \"%s\" }, \"%s\", %s, %d, %d, %d, \"%s\",\n", i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), data[i].option_1, data[i].option_2, testUtilOption3Name(data[i].option_3), + data[i].structapp.index, data[i].structapp.count, data[i].structapp.id, 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"); @@ -1718,7 +1826,7 @@ static void test_microqr_input(int index, int generate, int debug) { int i, length, ret; struct zint_symbol *symbol; - char escaped[1024]; + char escaped[4096]; testStart("test_microqr_input"); @@ -1801,7 +1909,7 @@ static void test_microqr_padding(int index, int generate, int debug) { int i, length, ret; struct zint_symbol *symbol; - char escaped[1024]; + char escaped[4096]; testStart("test_microqr_padding"); @@ -1871,7 +1979,7 @@ static void test_microqr_optimize(int index, int generate, int debug) { int i, length, ret; struct zint_symbol *symbol; - char escaped[1024]; + char escaped[4096]; testStart("test_microqr_optimize"); @@ -2203,7 +2311,7 @@ static void test_microqr_encode(int index, int generate, int debug) { int i, length, ret; struct zint_symbol *symbol; - char escaped[1024]; + char escaped[4096]; char bwipp_buf[32768]; char bwipp_msg[1024]; @@ -2355,7 +2463,7 @@ static void test_upnqr_input(int index, int generate, int debug) { int i, length, ret; struct zint_symbol *symbol; - char escaped[1024]; + char escaped[4096]; testStart("test_upnqr_input"); @@ -2775,7 +2883,7 @@ static void test_rmqr_input(int index, int generate, int debug) { int i, length, ret; struct zint_symbol *symbol; - char escaped[1024]; + char escaped[4096]; testStart("test_rmqr_input"); @@ -2839,7 +2947,7 @@ static void test_rmqr_gs1(int index, int generate, int debug) { int i, length, ret; struct zint_symbol *symbol; - char escaped[1024]; + char escaped[4096]; testStart("test_rmqr_gs1"); @@ -2908,7 +3016,7 @@ static void test_rmqr_optimize(int index, int generate, int debug) { int i, length, ret; struct zint_symbol *symbol; - char escaped[1024]; + char escaped[4096]; testStart("test_rmqr_optimize"); @@ -3328,7 +3436,7 @@ static void test_rmqr_encode(int index, int generate, int debug) { int i, length, ret; struct zint_symbol *symbol; - char escaped[1024]; + char escaped[4096]; char bwipp_buf[32768]; char bwipp_msg[1024]; diff --git a/backend/tests/test_ultra.c b/backend/tests/test_ultra.c index 6ddbec5a..52ac2a35 100644 --- a/backend/tests/test_ultra.c +++ b/backend/tests/test_ultra.c @@ -36,6 +36,7 @@ static void test_large(int index, int debug) { struct item { int option_1; int option_3; + struct zint_structapp structapp; char *pattern; int length; int ret; @@ -44,35 +45,43 @@ static void test_large(int index, int debug) { }; // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) struct item data[] = { - /* 0*/ { -1, -1, "1", 252, 0, 31, 66 }, // Default EC2 - /* 1*/ { -1, -1, "1", 253, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 2*/ { -1, -1, "1", ZINT_MAX_DATA_LEN, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 3*/ { -1, -1, "A", 252, 0, 31, 66 }, - /* 4*/ { -1, -1, "A", 253, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 5*/ { -1, -1, "\200", 252, 0, 31, 66 }, - /* 6*/ { -1, -1, "\200", 253, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 7*/ { -1, -1, "\001", 252, 0, 31, 66 }, - /* 8*/ { -1, -1, "\001", 253, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 9*/ { -1, ULTRA_COMPRESSION, "1", 504, 0, 31, 66 }, - /* 10*/ { -1, ULTRA_COMPRESSION, "1", 505, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 11*/ { -1, ULTRA_COMPRESSION, "A", 375, 0, 31, 66 }, - /* 12*/ { -1, ULTRA_COMPRESSION, "A", 376, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 13*/ { -1, ULTRA_COMPRESSION, "\200", 252, 0, 31, 66 }, - /* 14*/ { -1, ULTRA_COMPRESSION, "\200", 253, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 15*/ { -1, ULTRA_COMPRESSION, "\001", 252, 0, 31, 66 }, - /* 16*/ { -1, ULTRA_COMPRESSION, "\001", 253, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 17*/ { 1, -1, "1", 276, 0, 31, 66 }, - /* 18*/ { 1, -1, "1", 277, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 19*/ { 2, -1, "1", 263, 0, 31, 66 }, - /* 20*/ { 2, -1, "1", 264, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 21*/ { 3, -1, "1", 252, 0, 31, 66 }, - /* 22*/ { 3, -1, "1", 253, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 23*/ { 4, -1, "1", 234, 0, 31, 66 }, - /* 24*/ { 4, -1, "1", 235, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 25*/ { 5, -1, "1", 220, 0, 31, 66 }, - /* 26*/ { 5, -1, "1", 221, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 27*/ { 6, -1, "1", 202, 0, 31, 66 }, - /* 28*/ { 6, -1, "1", 203, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 0*/ { -1, -1, { 0, 0, "" }, "1", 252, 0, 31, 66 }, // Default EC2 + /* 1*/ { -1, -1, { 0, 0, "" }, "1", 253, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 2*/ { -1, -1, { 0, 0, "" }, "1", ZINT_MAX_DATA_LEN, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 3*/ { -1, -1, { 1, 2, "" }, "1", 251, 0, 31, 66 }, // Structured Append no File Number 1 codeword overhead + /* 4*/ { -1, -1, { 1, 2, "" }, "1", 252, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 5*/ { -1, -1, { 1, 2, "1" }, "1", 249, 0, 31, 66 }, // Structured Append with File Number 3 codewords overhead + /* 6*/ { -1, -1, { 1, 2, "1" }, "1", 250, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 7*/ { -1, -1, { 0, 0, "" }, "A", 252, 0, 31, 66 }, + /* 8*/ { -1, -1, { 0, 0, "" }, "A", 253, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 9*/ { -1, -1, { 0, 0, "" }, "\200", 252, 0, 31, 66 }, + /* 10*/ { -1, -1, { 0, 0, "" }, "\200", 253, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 11*/ { -1, -1, { 0, 0, "" }, "\001", 252, 0, 31, 66 }, + /* 12*/ { -1, -1, { 0, 0, "" }, "\001", 253, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 13*/ { -1, ULTRA_COMPRESSION, { 0, 0, "" }, "1", 504, 0, 31, 66 }, + /* 14*/ { -1, ULTRA_COMPRESSION, { 0, 0, "" }, "1", 505, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 15*/ { -1, ULTRA_COMPRESSION, { 0, 0, "" }, "A", 375, 0, 31, 66 }, + /* 16*/ { -1, ULTRA_COMPRESSION, { 0, 0, "" }, "A", 376, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 17*/ { -1, ULTRA_COMPRESSION, { 0, 0, "" }, "\200", 252, 0, 31, 66 }, + /* 18*/ { -1, ULTRA_COMPRESSION, { 0, 0, "" }, "\200", 253, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 19*/ { -1, ULTRA_COMPRESSION, { 0, 0, "" }, "\001", 252, 0, 31, 66 }, + /* 20*/ { -1, ULTRA_COMPRESSION, { 0, 0, "" }, "\001", 253, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 21*/ { 1, -1, { 0, 0, "" }, "1", 276, 0, 31, 66 }, + /* 22*/ { 1, -1, { 0, 0, "" }, "1", 277, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 23*/ { 1, -1, { 1, 2, "" }, "1", 275, 0, 31, 66 }, + /* 24*/ { 1, -1, { 1, 2, "" }, "1", 276, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 25*/ { 1, -1, { 1, 2, "1" }, "1", 273, 0, 31, 66 }, + /* 26*/ { 1, -1, { 1, 2, "1" }, "1", 274, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 27*/ { 2, -1, { 0, 0, "" }, "1", 263, 0, 31, 66 }, + /* 28*/ { 2, -1, { 0, 0, "" }, "1", 264, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 29*/ { 3, -1, { 0, 0, "" }, "1", 252, 0, 31, 66 }, + /* 30*/ { 3, -1, { 0, 0, "" }, "1", 253, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 31*/ { 4, -1, { 0, 0, "" }, "1", 234, 0, 31, 66 }, + /* 32*/ { 4, -1, { 0, 0, "" }, "1", 235, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 33*/ { 5, -1, { 0, 0, "" }, "1", 220, 0, 31, 66 }, + /* 34*/ { 5, -1, { 0, 0, "" }, "1", 221, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 35*/ { 6, -1, { 0, 0, "" }, "1", 202, 0, 31, 66 }, + /* 36*/ { 6, -1, { 0, 0, "" }, "1", 203, ZINT_ERROR_TOO_LONG, -1, -1 }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -93,6 +102,9 @@ static void test_large(int index, int debug) { assert_equal(data[i].length, (int) strlen(data_buf), "i:%d length %d != strlen(data_buf) %d\n", i, data[i].length, (int) strlen(data_buf)); length = testUtilSetSymbol(symbol, BARCODE_ULTRA, -1 /*input_mode*/, -1 /*eci*/, data[i].option_1, -1, data[i].option_3, -1 /*output_options*/, data_buf, data[i].length, debug); + if (data[i].structapp.count) { + symbol->structapp = data[i].structapp; + } ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); @@ -174,66 +186,77 @@ static void test_input(int index, int generate, int debug) { int eci; int option_1; int option_3; + struct zint_structapp structapp; char *data; int ret; char *expected; char *comment; }; struct item data[] = { - /* 0*/ { UNICODE_MODE, 0, -1, -1, "A", 0, "(2) 257 65", "" }, - /* 1*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "A", 0, "(2) 272 65", "" }, - /* 2*/ { UNICODE_MODE, 0, -1, -1, "12", 0, "(3) 257 49 50", "" }, - /* 3*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "12", 0, "(2) 272 140", "" }, - /* 4*/ { UNICODE_MODE, 0, -1, -1, "123", 0, "(4) 257 49 50 51", "" }, - /* 5*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "123", 0, "(3) 272 140 51", "" }, - /* 6*/ { UNICODE_MODE, 0, -1, -1, "ABC", 0, "(4) 257 65 66 67", "" }, - /* 7*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "ABC", 0, "(4) 272 65 66 67", "" }, - /* 8*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "ULTRACODE_123456789!", 0, "(17) 272 85 76 84 82 65 67 79 68 69 95 140 162 184 206 57 33", "" }, - /* 9*/ { UNICODE_MODE, 0, -1, -1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, "(253) 257 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65", "252 chars EC2" }, - /* 10*/ { UNICODE_MODE, 0, -1, -1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", ZINT_ERROR_TOO_LONG, "Error 591: Data too long for selected error correction capacity", "253 chars EC2" }, - /* 11*/ { UNICODE_MODE, 0, 1, -1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, "(277) 257 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65", "276 chars EC0" }, - /* 12*/ { UNICODE_MODE, 0, 1, -1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", ZINT_ERROR_TOO_LONG, "Error 591: Data too long for selected error correction capacity", "277 chars EC0" }, - /* 13*/ { UNICODE_MODE, 0, -1, -1, "é", 0, "(2) 257 233", "" }, - /* 14*/ { UNICODE_MODE, 0, -1, -1, "β", ZINT_WARN_USES_ECI, "Warning (2) 263 226", "" }, - /* 15*/ { UNICODE_MODE, 9, -1, -1, "β", 0, "(2) 263 226", "" }, - /* 16*/ { UNICODE_MODE, 9, -1, -1, "βAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, "(253) 263 226 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65", "249 chars EC2" }, - /* 17*/ { UNICODE_MODE, 9, -1, ULTRA_COMPRESSION, "A", 0, "(2) 272 65", "Note ECI ignored and not outputted if ULTRA_COMPRESSION and all ASCII" }, - /* 18*/ { UNICODE_MODE, 15, -1, -1, "Ŗ", 0, "(2) 268 170", "" }, - /* 19*/ { DATA_MODE, 898, -1, -1, "\001\002\003\004\377", 0, "(7) 278 130 1 2 3 4 255", "" }, - /* 20*/ { DATA_MODE, 899, -1, -1, "\001\002\003\004\377", 0, "(6) 280 1 2 3 4 255", "" }, - /* 21*/ { DATA_MODE, 900, -1, -1, "\001\002\003\004\377", 0, "(9) 257 274 137 128 1 2 3 4 255", "" }, - /* 22*/ { DATA_MODE, 9999, -1, -1, "\001\002\003\004\377", 0, "(9) 257 274 227 227 1 2 3 4 255", "" }, - /* 23*/ { DATA_MODE, 10000, -1, -1, "\001\002\003\004\377", 0, "(10) 257 275 129 128 128 1 2 3 4 255", "" }, - /* 24*/ { DATA_MODE, 811799, -1, -1, "\001\002\003\004\377", 0, "(10) 257 275 209 145 227 1 2 3 4 255", "" }, - /* 25*/ { DATA_MODE, 811800, -1, -1, "\001\002\003\004\377", ZINT_ERROR_INVALID_OPTION, "Error 590: ECI value not supported by Ultracode", "" }, - /* 26*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "123,456,789/12,/3,4,/5//", 0, "(15) 272 140 231 173 234 206 257 140 44 262 242 44 264 47 47", "Mode: a (24)" }, - /* 27*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "HEIMASÍÐA KENNARAHÁSKÓLA ÍSLANDS", 0, "(32) 257 256 46 151 78 210 205 208 258 5 148 28 72 2 167 52 127 193 83 75 211 267 76 65 32", "Mode: cccccc88cccccccccc8888aaa8cccccc (32)" }, - /* 28*/ { UNICODE_MODE, 0, -1, -1, "HEIMASÍÐA KENNARAHÁSKÓLA ÍSLANDS", 0, "(33) 257 72 69 73 77 65 83 205 208 65 32 75 69 78 78 65 82 65 72 193 83 75 211 76 65 32 205", "" }, - /* 29*/ { UNICODE_MODE, 10, -1, ULTRA_COMPRESSION, "אולטרה-קוד1234", 0, "(14) 264 224 229 236 232 248 228 45 247 229 227 267 140 162", "Mode: 8888888888aaaa (14); Figure G.3" }, - /* 30*/ { UNICODE_MODE, 10, -1, -1, "אולטרה-קוד1234", 0, "(15) 264 224 229 236 232 248 228 45 247 229 227 49 50 51 52", "" }, - /* 31*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "https://aimglobal.org/jcrv3tX", 0, "(16) 282 266 1 74 41 19 6 168 270 212 59 106 144 56 265 70", "Mode: c (21); Figure G.4a" }, - /* 32*/ { UNICODE_MODE, 0, -1, -1, "https://aimglobal.org/jcrv3tX", 0, "(22) 282 97 105 109 103 108 111 98 97 108 46 111 114 103 47 106 99 114 118 51 116 88", "" }, - /* 33*/ { GS1_MODE, 0, -1, -1, "[01]03453120000011[17]121125[10]ABCD1234", 0, "(20) 273 129 131 173 159 148 128 128 139 145 140 139 153 138 65 66 67 68 140 162", "Mode: a (34); Figure G.6 uses C43 for 6 of last 7 chars (same codeword count)" }, - /* 34*/ { GS1_MODE, 0, -1, -1, "[17]120508[10]ABCD1234[410]9501101020917", 0, "(21) 273 145 140 133 136 138 65 66 67 68 140 162 272 169 137 178 139 129 130 137 145", "Mode: a (35)" }, - /* 35*/ { GS1_MODE, 0, -1, -1, "[17]120508[10]ABCDEFGHI[410]9501101020917", 0, "(24) 273 145 140 133 136 138 65 66 67 68 69 70 71 72 73 272 169 137 178 139 129 130 137 145", "Mode: a (36)" }, - /* 36*/ { GS1_MODE | GS1PARENS_MODE, 0, -1, -1, "(17)120508(10)ABCDEFGHI(410)9501101020917", 0, "(24) 273 145 140 133 136 138 65 66 67 68 69 70 71 72 73 272 169 137 178 139 129 130 137 145", "Mode: a (36)" }, - /* 37*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "ftp://", 0, "(4) 272 278 269 165", "Mode: c (6)" }, - /* 38*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, ".cgi", 0, "(4) 272 278 274 131", "Mode: c (4)" }, - /* 39*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "ftp://a.cgi", 0, "(6) 272 280 269 123 274 131", "Mode: c (11)" }, - /* 40*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "e: file:f.shtml !", 0, "(12) 272 280 30 94 236 235 72 233 39 52 267 250", "Mode: c (17)" }, - /* 41*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "Aaatel:", 0, "(6) 272 280 262 76 6 89", "Mode: c (7)" }, - /* 42*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "Aatel:a", 0, "(6) 272 280 262 76 271 161", "Mode: c (7)" }, - /* 43*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "Atel:aAa", 0, "(8) 272 275 6 89 275 148 0 42", "Mode: c (8)" }, - /* 44*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "tel:AAaa", 0, "(8) 272 275 271 161 6 28 262 118", "Mode: c (8)" }, - /* 45*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "AAaatel:aA", 0, "(10) 272 276 0 42 0 41 118 46 6 156", "Mode: c (10)" }, - /* 46*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "émailto:étel:éfile:éhttp://éhttps://éftp://", 0, "(18) 257 233 276 282 233 277 282 233 278 282 233 279 282 233 280 282 233 281", "Mode: 8ccccccc8cccc8ccccc8ccccccc8cccccccc8cccccc (43)" }, - /* 47*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "éhttp://www.url.com", 0, "(9) 257 233 279 269 186 113 81 45 252", "Mode: 8cccccccccccccccccc (19)" }, - /* 48*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "éhttps://www.url.com", 0, "(9) 257 233 280 269 186 113 81 45 252", "Mode: 8ccccccccccccccccccc (20)" }, - /* 49*/ { UNICODE_MODE, 0, -1, -1, "http://url.com", 0, "(8) 281 117 114 108 46 99 111 109", "Mode: 8888888 (7)" }, - /* 50*/ { UNICODE_MODE, 0, -1, -1, "https://url.com", 0, "(8) 282 117 114 108 46 99 111 109", "Mode: 8888888 (7)" }, - /* 51*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "http://url.com", 0, "(6) 281 262 133 216 269 251", "Mode: ccccccc (7)" }, - /* 52*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "https://url.com", 0, "(6) 282 262 133 216 269 251", "Mode: ccccccc (7)" }, - /* 53*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "{", 0, "(2) 272 123", "Mode: a (1)" }, + /* 0*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "A", 0, "(2) 257 65", "" }, + /* 1*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "A", 0, "(2) 272 65", "" }, + /* 2*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "12", 0, "(3) 257 49 50", "" }, + /* 3*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "12", 0, "(2) 272 140", "" }, + /* 4*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "123", 0, "(4) 257 49 50 51", "" }, + /* 5*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "123", 0, "(3) 272 140 51", "" }, + /* 6*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "ABC", 0, "(4) 257 65 66 67", "" }, + /* 7*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "ABC", 0, "(4) 272 65 66 67", "" }, + /* 8*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "ULTRACODE_123456789!", 0, "(17) 272 85 76 84 82 65 67 79 68 69 95 140 162 184 206 57 33", "" }, + /* 9*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, "(253) 257 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65", "252 chars EC2" }, + /* 10*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", ZINT_ERROR_TOO_LONG, "Error 591: Data too long for selected error correction capacity", "253 chars EC2" }, + /* 11*/ { UNICODE_MODE, 0, 1, -1, { 0, 0, "" }, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, "(277) 257 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65", "276 chars EC0" }, + /* 12*/ { UNICODE_MODE, 0, 1, -1, { 0, 0, "" }, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", ZINT_ERROR_TOO_LONG, "Error 591: Data too long for selected error correction capacity", "277 chars EC0" }, + /* 13*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "é", 0, "(2) 257 233", "" }, + /* 14*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "β", ZINT_WARN_USES_ECI, "Warning (2) 263 226", "" }, + /* 15*/ { UNICODE_MODE, 9, -1, -1, { 0, 0, "" }, "β", 0, "(2) 263 226", "" }, + /* 16*/ { UNICODE_MODE, 9, -1, -1, { 0, 0, "" }, "βAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, "(253) 263 226 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65", "249 chars EC2" }, + /* 17*/ { UNICODE_MODE, 9, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "A", 0, "(2) 272 65", "Note ECI ignored and not outputted if ULTRA_COMPRESSION and all ASCII" }, + /* 18*/ { UNICODE_MODE, 15, -1, -1, { 0, 0, "" }, "Ŗ", 0, "(2) 268 170", "" }, + /* 19*/ { DATA_MODE, 898, -1, -1, { 0, 0, "" }, "\001\002\003\004\377", 0, "(7) 278 130 1 2 3 4 255", "" }, + /* 20*/ { DATA_MODE, 899, -1, -1, { 0, 0, "" }, "\001\002\003\004\377", 0, "(6) 280 1 2 3 4 255", "" }, + /* 21*/ { DATA_MODE, 900, -1, -1, { 0, 0, "" }, "\001\002\003\004\377", 0, "(9) 257 274 137 128 1 2 3 4 255", "" }, + /* 22*/ { DATA_MODE, 9999, -1, -1, { 0, 0, "" }, "\001\002\003\004\377", 0, "(9) 257 274 227 227 1 2 3 4 255", "" }, + /* 23*/ { DATA_MODE, 10000, -1, -1, { 0, 0, "" }, "\001\002\003\004\377", 0, "(10) 257 275 129 128 128 1 2 3 4 255", "" }, + /* 24*/ { DATA_MODE, 811799, -1, -1, { 0, 0, "" }, "\001\002\003\004\377", 0, "(10) 257 275 209 145 227 1 2 3 4 255", "" }, + /* 25*/ { DATA_MODE, 811800, -1, -1, { 0, 0, "" }, "\001\002\003\004\377", ZINT_ERROR_INVALID_OPTION, "Error 590: ECI value not supported by Ultracode", "" }, + /* 26*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "123,456,789/12,/3,4,/5//", 0, "(15) 272 140 231 173 234 206 257 140 44 262 242 44 264 47 47", "Mode: a (24)" }, + /* 27*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "HEIMASÍÐA KENNARAHÁSKÓLA ÍSLANDS", 0, "(32) 257 256 46 151 78 210 205 208 258 5 148 28 72 2 167 52 127 193 83 75 211 267 76 65 32", "Mode: cccccc88cccccccccc8888aaa8cccccc (32)" }, + /* 28*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "HEIMASÍÐA KENNARAHÁSKÓLA ÍSLANDS", 0, "(33) 257 72 69 73 77 65 83 205 208 65 32 75 69 78 78 65 82 65 72 193 83 75 211 76 65 32 205", "" }, + /* 29*/ { UNICODE_MODE, 10, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "אולטרה-קוד1234", 0, "(14) 264 224 229 236 232 248 228 45 247 229 227 267 140 162", "Mode: 8888888888aaaa (14); Figure G.3" }, + /* 30*/ { UNICODE_MODE, 10, -1, -1, { 0, 0, "" }, "אולטרה-קוד1234", 0, "(15) 264 224 229 236 232 248 228 45 247 229 227 49 50 51 52", "" }, + /* 31*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "https://aimglobal.org/jcrv3tX", 0, "(16) 282 266 1 74 41 19 6 168 270 212 59 106 144 56 265 70", "Mode: c (21); Figure G.4a" }, + /* 32*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "https://aimglobal.org/jcrv3tX", 0, "(22) 282 97 105 109 103 108 111 98 97 108 46 111 114 103 47 106 99 114 118 51 116 88", "" }, + /* 33*/ { GS1_MODE, 0, -1, -1, { 0, 0, "" }, "[01]03453120000011[17]121125[10]ABCD1234", 0, "(20) 273 129 131 173 159 148 128 128 139 145 140 139 153 138 65 66 67 68 140 162", "Mode: a (34); Figure G.6 uses C43 for 6 of last 7 chars (same codeword count)" }, + /* 34*/ { GS1_MODE, 0, -1, -1, { 0, 0, "" }, "[17]120508[10]ABCD1234[410]9501101020917", 0, "(21) 273 145 140 133 136 138 65 66 67 68 140 162 272 169 137 178 139 129 130 137 145", "Mode: a (35)" }, + /* 35*/ { GS1_MODE, 0, -1, -1, { 0, 0, "" }, "[17]120508[10]ABCDEFGHI[410]9501101020917", 0, "(24) 273 145 140 133 136 138 65 66 67 68 69 70 71 72 73 272 169 137 178 139 129 130 137 145", "Mode: a (36)" }, + /* 36*/ { GS1_MODE | GS1PARENS_MODE, 0, -1, -1, { 0, 0, "" }, "(17)120508(10)ABCDEFGHI(410)9501101020917", 0, "(24) 273 145 140 133 136 138 65 66 67 68 69 70 71 72 73 272 169 137 178 139 129 130 137 145", "Mode: a (36)" }, + /* 37*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "ftp://", 0, "(4) 272 278 269 165", "Mode: c (6)" }, + /* 38*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, ".cgi", 0, "(4) 272 278 274 131", "Mode: c (4)" }, + /* 39*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "ftp://a.cgi", 0, "(6) 272 280 269 123 274 131", "Mode: c (11)" }, + /* 40*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "e: file:f.shtml !", 0, "(12) 272 280 30 94 236 235 72 233 39 52 267 250", "Mode: c (17)" }, + /* 41*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "Aaatel:", 0, "(6) 272 280 262 76 6 89", "Mode: c (7)" }, + /* 42*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "Aatel:a", 0, "(6) 272 280 262 76 271 161", "Mode: c (7)" }, + /* 43*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "Atel:aAa", 0, "(8) 272 275 6 89 275 148 0 42", "Mode: c (8)" }, + /* 44*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "tel:AAaa", 0, "(8) 272 275 271 161 6 28 262 118", "Mode: c (8)" }, + /* 45*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "AAaatel:aA", 0, "(10) 272 276 0 42 0 41 118 46 6 156", "Mode: c (10)" }, + /* 46*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "émailto:étel:éfile:éhttp://éhttps://éftp://", 0, "(18) 257 233 276 282 233 277 282 233 278 282 233 279 282 233 280 282 233 281", "Mode: 8ccccccc8cccc8ccccc8ccccccc8cccccccc8cccccc (43)" }, + /* 47*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "éhttp://www.url.com", 0, "(9) 257 233 279 269 186 113 81 45 252", "Mode: 8cccccccccccccccccc (19)" }, + /* 48*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "éhttps://www.url.com", 0, "(9) 257 233 280 269 186 113 81 45 252", "Mode: 8ccccccccccccccccccc (20)" }, + /* 49*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "http://url.com", 0, "(8) 281 117 114 108 46 99 111 109", "Mode: 8888888 (7)" }, + /* 50*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "https://url.com", 0, "(8) 282 117 114 108 46 99 111 109", "Mode: 8888888 (7)" }, + /* 51*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "http://url.com", 0, "(6) 281 262 133 216 269 251", "Mode: ccccccc (7)" }, + /* 52*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "https://url.com", 0, "(6) 282 262 133 216 269 251", "Mode: ccccccc (7)" }, + /* 53*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "{", 0, "(2) 272 123", "Mode: a (1)" }, + /* 54*/ { UNICODE_MODE, 0, -1, -1, { 2, 3, "" }, "A", 0, "(2) 257 65", "" }, + /* 55*/ { UNICODE_MODE, 0, -1, -1, { 1, 1, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 558: Structured Append count out of range (2-8)", "" }, + /* 56*/ { UNICODE_MODE, 0, -1, -1, { 1, 9, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 558: Structured Append count out of range (2-8)", "" }, + /* 57*/ { UNICODE_MODE, 0, -1, -1, { 0, 3, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 559: Structured Append index out of range (1-3)", "" }, + /* 58*/ { UNICODE_MODE, 0, -1, -1, { 4, 3, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 559: Structured Append index out of range (1-3)", "" }, + /* 59*/ { UNICODE_MODE, 0, -1, -1, { 8, 8, "0" }, "A", 0, "(2) 257 65", "" }, + /* 60*/ { UNICODE_MODE, 0, -1, -1, { 8, 8, "80088" }, "A", 0, "(2) 257 65", "" }, + /* 61*/ { UNICODE_MODE, 0, -1, -1, { 8, 8, "123456" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 727: Structured Append ID too long (5 digit maximum)", "" }, + /* 62*/ { UNICODE_MODE, 0, -1, -1, { 8, 8, "A" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 728: Invalid Structured Append ID (digits only)", "" }, + /* 63*/ { UNICODE_MODE, 0, -1, -1, { 8, 8, "80089" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 729: Structured Append ID '80089' out of range (1-80088)", "" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -254,13 +277,17 @@ static void test_input(int index, int generate, int debug) { symbol->debug = ZINT_DEBUG_TEST; // Needed to get codeword dump in errtxt length = testUtilSetSymbol(symbol, BARCODE_ULTRA, data[i].input_mode, data[i].eci, data[i].option_1, -1, data[i].option_3, -1 /*output_options*/, data[i].data, -1, debug); + if (data[i].structapp.count) { + symbol->structapp = data[i].structapp; + } ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d\n", i, ret, data[i].ret); if (generate) { - printf(" /*%3d*/ { %s, %d, %d, %s, \"%s\", %s, \"%s\", \"%s\" },\n", + printf(" /*%3d*/ { %s, %d, %d, %s, { %d, %d, \"%s\" }, \"%s\", %s, \"%s\", \"%s\" },\n", i, testUtilInputModeName(data[i].input_mode), data[i].eci, data[i].option_1, testUtilOption3Name(data[i].option_3), + data[i].structapp.index, data[i].structapp.count, data[i].structapp.id, testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), testUtilErrorName(data[i].ret), symbol->errtxt, 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); @@ -279,6 +306,7 @@ static void test_encode(int index, int generate, int debug) { int eci; int option_1; int option_3; + struct zint_structapp structapp; char *data; int ret; @@ -291,7 +319,7 @@ static void test_encode(int index, int generate, int debug) { // Based on AIMD/TSC15032-43 (v 0.99c), with values updated from BWIPP update 2021-07-14 // https://github.com/bwipp/postscriptbarcode/commit/4255810845fa8d45c6192dd30aee1fdad1aaf0cc struct item data[] = { - /* 0*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "ULTRACODE_123456789!", 0, 13, 22, 1, "AIMD/TSC15032-43 Figure G.1 **NOT SAME** different compression", + /* 0*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "ULTRACODE_123456789!", 0, 13, 22, 1, "AIMD/TSC15032-43 Figure G.1 **NOT SAME** different compression", "7777777777777777777777" "7857865353533131551857" "7767853515611616136717" @@ -306,7 +334,7 @@ static void test_encode(int index, int generate, int debug) { "7817851653331136333857" "7777777777777777777777" }, - /* 1*/ { UNICODE_MODE, 0, -1, -1, "ULTRACODE_123456789!", 0, 13, 24, 1, "AIMD/TSC15032-43 Figure G.1 **NOT SAME** no compression", + /* 1*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "ULTRACODE_123456789!", 0, 13, 24, 1, "AIMD/TSC15032-43 Figure G.1 **NOT SAME** no compression", "777777777777777777777777" "785786533153313111181157" "776783361661161666676617" @@ -321,7 +349,7 @@ static void test_encode(int index, int generate, int debug) { "781786166533113663683357" "777777777777777777777777" }, - /* 2*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "HEIMASÍÐA KENNARAHÁSKÓLA ÍSLANDS", 0, 19, 23, 1, "AIMD/TSC15032-43 Figure G.2 **NOT SAME** different compression", + /* 2*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "HEIMASÍÐA KENNARAHÁSKÓLA ÍSLANDS", 0, 19, 23, 1, "AIMD/TSC15032-43 Figure G.2 **NOT SAME** different compression", "77777777777777777777777" "78878663151561555158557" "77878315565635366667617" @@ -342,7 +370,7 @@ static void test_encode(int index, int generate, int debug) { "78878333656153153368617" "77777777777777777777777" }, - /* 3*/ { DATA_MODE, 0, -1, -1, "\110\105\111\115\101\123\315\320\101\040\113\105\116\116\101\122\101\110\301\123\113\323\114\101\040\315\123\114\101\116\104\123", 0, 19, 23, 1, "AIMD/TSC15032-43 Figure G.2 **NOT SAME** no compression", + /* 3*/ { DATA_MODE, 0, -1, -1, { 0, 0, "" }, "\110\105\111\115\101\123\315\320\101\040\113\105\116\116\101\122\101\110\301\123\113\323\114\101\040\315\123\114\101\116\104\123", 0, 19, 23, 1, "AIMD/TSC15032-43 Figure G.2 **NOT SAME** no compression", "77777777777777777777777" "78878633151153313358137" "77878315666661161167617" @@ -363,7 +391,7 @@ static void test_encode(int index, int generate, int debug) { "78878361115516163138317" "77777777777777777777777" }, - /* 4*/ { UNICODE_MODE, 10, -1, ULTRA_COMPRESSION, "אולטרה-קוד1234", 0, 13, 19, 1, "AIMD/TSC15032-43 Figure G.3 Same except DCC correct whereas DCC in Figure G.3 is incorrent", + /* 4*/ { UNICODE_MODE, 10, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "אולטרה-קוד1234", 0, 13, 19, 1, "AIMD/TSC15032-43 Figure G.3 Same except DCC correct whereas DCC in Figure G.3 is incorrent", "7777777777777777777" "7857865565566616657" "7737853333613351517" @@ -378,7 +406,7 @@ static void test_encode(int index, int generate, int debug) { "7817851316355311357" "7777777777777777777" }, - /* 5*/ { DATA_MODE, 0, -1, -1, "\340\345\354\350\370\344\055\367\345\343\061\062\063\064", 0, 13, 20, 1, "AIMD/TSC15032-43 Figure G.3 **NOT SAME** no compression", + /* 5*/ { DATA_MODE, 0, -1, -1, { 0, 0, "" }, "\340\345\354\350\370\344\055\367\345\343\061\062\063\064", 0, 13, 20, 1, "AIMD/TSC15032-43 Figure G.3 **NOT SAME** no compression", "77777777777777777777" "78578611115666161157" "77678333656133516617" @@ -393,7 +421,7 @@ static void test_encode(int index, int generate, int debug) { "78178613653553116357" "77777777777777777777" }, - /* 6*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "https://aimglobal.org/jcrv3tX", 0, 13, 20, 1, "AIMD/TSC15032-43 Figure G.4a **NOT SAME** different compression; also DCC incorrect in figure", + /* 6*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "https://aimglobal.org/jcrv3tX", 0, 13, 20, 1, "AIMD/TSC15032-43 Figure G.4a **NOT SAME** different compression; also DCC incorrect in figure", "77777777777777777777" "78578655115631563137" "77678563356513315617" @@ -408,7 +436,7 @@ static void test_encode(int index, int generate, int debug) { "78178163363613633157" "77777777777777777777" }, - /* 7*/ { GS1_MODE, 0, -1, -1, "[01]03453120000011[17]121125[10]ABCD1234", 0, 13, 23, 1, "AIMD/TSC15032-43 Figure G.6 **NOT SAME** different compression and ECC; also DCC incorrect in figure", + /* 7*/ { GS1_MODE, 0, -1, -1, { 0, 0, "" }, "[01]03453120000011[17]121125[10]ABCD1234", 0, 13, 23, 1, "AIMD/TSC15032-43 Figure G.6 **NOT SAME** different compression and ECC; also DCC incorrect in figure", "77777777777777777777777" "78578616535355353318157" "77678553116631616667617" @@ -423,7 +451,7 @@ static void test_encode(int index, int generate, int debug) { "78178335533356531518357" "77777777777777777777777" }, - /* 8*/ { UNICODE_MODE, 0, -1, -1, "A", 0, 13, 13, 1, "", + /* 8*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "A", 0, 13, 13, 1, "", "7777777777777" "7857863335517" "7717835163667" @@ -438,7 +466,7 @@ static void test_encode(int index, int generate, int debug) { "7817833536357" "7777777777777" }, - /* 9*/ { UNICODE_MODE, 0, 2, -1, "1234567890123456789012", 0, 13, 24, 1, "Length 22 == 25 MCC (C) with EC1 so 6 ECC by Table 12", + /* 9*/ { UNICODE_MODE, 0, 2, -1, { 0, 0, "" }, "1234567890123456789012", 0, 13, 24, 1, "Length 22 == 25 MCC (C) with EC1 so 6 ECC by Table 12", "777777777777777777777777" "785786663111111111181117" "776783555536666666676667" @@ -453,7 +481,7 @@ static void test_encode(int index, int generate, int debug) { "781786155535516355186337" "777777777777777777777777" }, - /* 10*/ { UNICODE_MODE, 0, 2, -1, "12345678901234567890123", 0, 13, 25, 1, "Length 23 == 26 MCC (C) with EC1 so 7 ECC by Table 12", + /* 10*/ { UNICODE_MODE, 0, 2, -1, { 0, 0, "" }, "12345678901234567890123", 0, 13, 25, 1, "Length 23 == 26 MCC (C) with EC1 so 7 ECC by Table 12", "7777777777777777777777777" "7857863655511111111811117" "7767831563666666666766667" @@ -468,7 +496,7 @@ static void test_encode(int index, int generate, int debug) { "7817835653363636636836657" "7777777777777777777777777" }, - /* 11*/ { UNICODE_MODE, 0, 1, -1, "1", 0, 13, 11, 1, "Figure 3a min 2-row, EC0", + /* 11*/ { UNICODE_MODE, 0, 1, -1, { 0, 0, "" }, "1", 0, 13, 11, 1, "Figure 3a min 2-row, EC0", "77777777777" "78578661517" "77178355667" @@ -483,7 +511,7 @@ static void test_encode(int index, int generate, int debug) { "78178365567" "77777777777" }, - /* 12*/ { UNICODE_MODE, 0, 6, -1, "1234567890123456789012", 0, 13, 28, 0, "Figure 3a max 2-row, EC5 **NOT SAME** extra col due to BWIPP update 2021-07-14; BWIPP chooses 3 rows instead", + /* 12*/ { UNICODE_MODE, 0, 6, -1, { 0, 0, "" }, "1234567890123456789012", 0, 13, 28, 0, "Figure 3a max 2-row, EC5 **NOT SAME** extra col due to BWIPP update 2021-07-14; BWIPP chooses 3 rows instead", "7777777777777777777777777777" "7857863331131511111811111157" "7717835613316666666766666617" @@ -498,7 +526,7 @@ static void test_encode(int index, int generate, int debug) { "7817863633563563636863636637" "7777777777777777777777777777" }, - /* 13*/ { UNICODE_MODE, 0, 1, -1, "12345678901234567890123456789012345", 0, 19, 22, 1, "Figure 3b min 3-row, EC0 **NOT SAME** Zint min not same as real min as chooses lower rows first (would need row option)", + /* 13*/ { UNICODE_MODE, 0, 1, -1, { 0, 0, "" }, "12345678901234567890123456789012345", 0, 19, 22, 1, "Figure 3b min 3-row, EC0 **NOT SAME** Zint min not same as real min as chooses lower rows first (would need row option)", "7777777777777777777777" "7887866511111111111817" "7787833666666666666767" @@ -519,7 +547,7 @@ static void test_encode(int index, int generate, int debug) { "7887831331656665333867" "7777777777777777777777" }, - /* 14*/ { UNICODE_MODE, 0, 6, -1, "1234567890123456789012345678901234567890123456789012345", 0, 19, 38, 0, "Figure 3b max 3-row, EC5 **NOT SAME** extra col due to BWIPP update 2021-07-14; BWIPP chooses 4 rows instead", + /* 14*/ { UNICODE_MODE, 0, 6, -1, { 0, 0, "" }, "1234567890123456789012345678901234567890123456789012345", 0, 19, 38, 0, "Figure 3b max 3-row, EC5 **NOT SAME** extra col due to BWIPP update 2021-07-14; BWIPP chooses 4 rows instead", "77777777777777777777777777777777777777" "78878611311563611118111111111111111817" "77878366156351555667666666666666666767" @@ -540,7 +568,7 @@ static void test_encode(int index, int generate, int debug) { "78878166553313356538331656665333165837" "77777777777777777777777777777777777777" }, - /* 15*/ { UNICODE_MODE, 0, 1, -1, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012", 0, 25, 30, 1, "Figure 3c min 4-row, EC0 **NOT SAME** Zint min not same as real min as chooses lower rows first (would need row option)", + /* 15*/ { UNICODE_MODE, 0, 1, -1, { 0, 0, "" }, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012", 0, 25, 30, 1, "Figure 3c min 4-row, EC0 **NOT SAME** Zint min not same as real min as chooses lower rows first (would need row option)", "777777777777777777777777777777" "788786511111111111181111111117" "778783166666666666676666666667" @@ -567,7 +595,7 @@ static void test_encode(int index, int generate, int debug) { "788785533666336663386663366667" "777777777777777777777777777777" }, - /* 16*/ { UNICODE_MODE, 0, 6, -1, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456", 0, 25, 50, 0, "Figure 3c max 4-row **NOT SAME** extra col due to BWIPP update 2021-07-14; BWIPP chooses 5 rows instead", + /* 16*/ { UNICODE_MODE, 0, 6, -1, { 0, 0, "" }, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456", 0, 25, 50, 0, "Figure 3c max 4-row **NOT SAME** extra col due to BWIPP update 2021-07-14; BWIPP chooses 5 rows instead", "77777777777777777777777777777777777777777777777777" "78878631533313135518111111111111111811111111111117" "77878315116161313667666666666666666766666666666667" @@ -594,7 +622,7 @@ static void test_encode(int index, int generate, int debug) { "78878633351651561668633666336663366863366633666337" "77777777777777777777777777777777777777777777777777" }, - /* 17*/ { UNICODE_MODE, 0, 1, -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", 0, 31, 42, 1, "Figure 3d min 5-row, EC0 **NOT SAME** Zint min not same as real min as chooses lower rows first (would need row option)", + /* 17*/ { UNICODE_MODE, 0, 1, -1, { 0, 0, "" }, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", 0, 31, 42, 1, "Figure 3d min 5-row, EC0 **NOT SAME** Zint min not same as real min as chooses lower rows first (would need row option)", "777777777777777777777777777777777777777777" "788786511111111111181111111111111118111117" "778783366666666666676666666666666667666667" @@ -627,7 +655,7 @@ static void test_encode(int index, int generate, int debug) { "788783616161616161681616161616161618616167" "777777777777777777777777777777777777777777" }, - /* 18*/ { UNICODE_MODE, 0, 6, -1, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012", 0, 31, 66, 1, "Figure 3d max 5-row, EC5 **NOT SAME** Max columns due to 282 limit is 60 not 61 as shown", + /* 18*/ { UNICODE_MODE, 0, 6, -1, { 0, 0, "" }, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012", 0, 31, 66, 1, "Figure 3d max 5-row, EC5 **NOT SAME** Max columns due to 282 limit is 60 not 61 as shown", "777777777777777777777777777777777777777777777777777777777777777777" "788786563656553165385551111111111118111111111111111811111111111117" "778783136511335313673366666666666667666666666666666766666666666667" @@ -660,7 +688,7 @@ static void test_encode(int index, int generate, int debug) { "788786316551515665186353535353535358353535353535353853535353535357" "777777777777777777777777777777777777777777777777777777777777777777" }, - /* 19*/ { UNICODE_MODE | ESCAPE_MODE, 0, -1, -1, "[)>\\R06\\G17V12345\\G1P234TYU\\GS6789\\R\\E", 0, 13, 27, 0, "06 Macro; not supported by BWIPP", + /* 19*/ { UNICODE_MODE | ESCAPE_MODE, 0, -1, -1, { 0, 0, "" }, "[)>\\R06\\G17V12345\\G1P234TYU\\GS6789\\R\\E", 0, 13, 27, 0, "06 Macro; not supported by BWIPP", "777777777777777777777777777" "785786311655611111181311157" "771783153516566666676156617" @@ -675,7 +703,7 @@ static void test_encode(int index, int generate, int debug) { "781783531133356335585331617" "777777777777777777777777777" }, - /* 20*/ { UNICODE_MODE | ESCAPE_MODE, 0, -1, ULTRA_COMPRESSION, "[)>\\R06\\G17V12345\\G1P234TYU\\GS6789\\R\\E", 0, 13, 23, 0, "06 Macro; not supported by BWIPP", + /* 20*/ { UNICODE_MODE | ESCAPE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "[)>\\R06\\G17V12345\\G1P234TYU\\GS6789\\R\\E", 0, 13, 23, 0, "06 Macro; not supported by BWIPP", "77777777777777777777777" "78578613335635131318557" "77678536566511516157617" @@ -690,6 +718,36 @@ static void test_encode(int index, int generate, int debug) { "78178116153635315338657" "77777777777777777777777" }, + /* 21*/ { UNICODE_MODE, 0, -1, -1, { 1, 2, "" }, "A", 0, 13, 14, 1, "Structured Append without File Number", + "77777777777777" + "78578633165557" + "77378351336117" + "78178666115357" + "77578533636617" + "78378156565557" + "77878787878787" + "78678153513117" + "77178365631637" + "78578133353557" + "77678651566317" + "78178535111557" + "77777777777777" + }, + /* 22*/ { UNICODE_MODE, 0, -1, -1, { 8, 8, "283" }, "A", 0, 13, 15, 1, "Structured Append with File Number", + "777777777777777" + "785786353356157" + "773783115665317" + "781786661553157" + "776785535165317" + "783781613656557" + "778787878787877" + "786781563131117" + "771783651313637" + "786785336531557" + "773781115663317" + "781785653516557" + "777777777777777" + }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -712,13 +770,17 @@ static void test_encode(int index, int generate, int debug) { assert_nonnull(symbol, "Symbol not created\n"); length = testUtilSetSymbol(symbol, BARCODE_ULTRA, data[i].input_mode, data[i].eci, data[i].option_1, -1, data[i].option_3, -1 /*output_options*/, data[i].data, -1, debug); + if (data[i].structapp.count) { + symbol->structapp = data[i].structapp; + } 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\", %s, %d, %d, %d, \"%s\",\n", + printf(" /*%3d*/ { %s, %d, %d, %s, { %d, %d, \"%s\" }, \"%s\", %s, %d, %d, %d, \"%s\",\n", i, testUtilInputModeName(data[i].input_mode), data[i].eci, data[i].option_1, testUtilOption3Name(data[i].option_3), + data[i].structapp.index, data[i].structapp.count, data[i].structapp.id, 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"); diff --git a/backend/tests/testcommon.c b/backend/tests/testcommon.c index e8cce71b..d03d1721 100644 --- a/backend/tests/testcommon.c +++ b/backend/tests/testcommon.c @@ -728,7 +728,7 @@ char *testUtilEscape(char *buffer, int length, char *escaped, int escaped_size) for (i = 0; b < be && i < escaped_size; b++) { // For VC6-compatibility need to split literal strings into <= 2K chunks - if (i > 2040 && i / 2040 != chunk) { + if (i > 2040 && i / 2040 != chunk && (*b & 0xC0) != 0x80) { // Avoid UTF-8 continuations chunk = i / 2040; if (i + 3 < escaped_size) { escaped[i] = '"'; @@ -2195,6 +2195,13 @@ static const char *testUtilBwippName(int index, const struct zint_symbol *symbol } return NULL; } + if (symbol->structapp.count && symbology != BARCODE_MAXICODE) { + if (debug & ZINT_DEBUG_TEST_PRINT) { + printf("i:%d %s not BWIPP compatible, Structured Append not supported\n", + index, testUtilBarcodeName(symbology)); + } + return NULL; + } if (symbology == BARCODE_CODE11) { if (option_2 != 1 && option_2 != 2) { /* 2 check digits (Zint default) not supported */ @@ -2867,6 +2874,11 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int parse = 1; } } + if (symbol->structapp.count) { + sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%ssam=%c%c", + strlen(bwipp_opts_buf) ? " " : "", itoc(symbol->structapp.index), itoc(symbol->structapp.count)); + bwipp_opts = bwipp_opts_buf; + } } } diff --git a/backend/ultra.c b/backend/ultra.c index 3bebf3f9..890a1123 100644 --- a/backend/ultra.c +++ b/backend/ultra.c @@ -796,7 +796,7 @@ static int ultra_generate_codewords(struct zint_symbol *symbol, const unsigned c mode[crop_length] = '\0'; if (symbol->debug & ZINT_DEBUG_PRINT) { - printf("Mode: %s (%d)\n", mode, (int) strlen(mode)); + printf("Mode (%d): %s\n", (int) strlen(mode), mode); } /* Use results from test to perform actual mode switching */ @@ -858,6 +858,8 @@ static int ultra_generate_codewords(struct zint_symbol *symbol, const unsigned c INTERNAL int ultracode(struct zint_symbol *symbol, unsigned char source[], int length) { int data_cw_count = 0; int acc, qcc; + int scr[3] = {0}, scr_cw_count = 0; /* Symbol Control Region (only if have Structured Append) */ + int dr_count; int ecc_level; int rows, columns; int total_cws; @@ -875,16 +877,59 @@ INTERNAL int ultracode(struct zint_symbol *symbol, unsigned char source[], int l char *pattern; #endif /* _MSC_VER */ - cw_memalloc = length * 2; - if (cw_memalloc < 283) { - cw_memalloc = 283; - } - if (symbol->eci > 811799) { strcpy(symbol->errtxt, "590: ECI value not supported by Ultracode"); return ZINT_ERROR_INVALID_OPTION; } + if (symbol->structapp.count) { + int link2 = 2; /* Draft Table 7, Structured Append Group (SAG) with no File Number */ + + if (symbol->structapp.count < 2 || symbol->structapp.count > 8) { + strcpy(symbol->errtxt, "558: Structured Append count out of range (2-8)"); + return ZINT_ERROR_INVALID_OPTION; + } + if (symbol->structapp.index < 1 || symbol->structapp.index > symbol->structapp.count) { + sprintf(symbol->errtxt, "559: Structured Append index out of range (1-%d)", symbol->structapp.count); + return ZINT_ERROR_INVALID_OPTION; + } + scr_cw_count = 1; + + if (symbol->structapp.id[0]) { + int id, id_len; + + for (id_len = 0; id_len < 32 && symbol->structapp.id[id_len]; id_len++); + + if (id_len > 5) { /* 282 * 283 + 282 = 80088 */ + strcpy(symbol->errtxt, "727: Structured Append ID too long (5 digit maximum)"); + return ZINT_ERROR_INVALID_OPTION; + } + + id = to_int((const unsigned char *) symbol->structapp.id, id_len); + if (id == -1) { + strcpy(symbol->errtxt, "728: Invalid Structured Append ID (digits only)"); + return ZINT_ERROR_INVALID_OPTION; + } + if (id > 80088) { + sprintf(symbol->errtxt, "729: Structured Append ID '%d' out of range (1-80088)", id); + return ZINT_ERROR_INVALID_OPTION; + } + if (id) { + link2 = 3; /* Missing from draft Table 7 but mentioned 7.4.3 - SAG with File Number */ + scr[1] = id / 283; + scr[2] = id % 283; /* 7.4.3.2 says 1-282 but can be 0 if id >= 283 */ + scr_cw_count += 2; + } + } + + scr[0] = link2 * 70 + (symbol->structapp.count - 1) * 8 + symbol->structapp.index - 1; + } + + cw_memalloc = length * 2; + if (cw_memalloc < 283) { + cw_memalloc = 283; + } + #ifndef _MSC_VER int data_codewords[cw_memalloc]; #else @@ -906,7 +951,7 @@ INTERNAL int ultracode(struct zint_symbol *symbol, unsigned char source[], int l } #endif - data_cw_count += 2; // 2 == MCC + ACC (data codeword count includes start char) + data_cw_count += 2 + scr_cw_count; // 2 == MCC + ACC (data codeword count includes start char) /* Default ECC level is EC2 */ if ((symbol->option_1 <= 0) || (symbol->option_1 > 6)) { @@ -926,12 +971,25 @@ INTERNAL int ultracode(struct zint_symbol *symbol, unsigned char source[], int l } } - acc = qcc - 3; - if (symbol->debug & ZINT_DEBUG_PRINT) { printf("EC%d codewords: %d\n", ecc_level + 1, qcc); } + acc = qcc - 3; + if (scr_cw_count) { + acc += 70; /* Link1 = 1 (* 70) means SCR present */ + } + if (symbol->debug & ZINT_DEBUG_PRINT) { + printf("MCC: %d, ACC: %d, SCR: %d", data_cw_count, acc, scr_cw_count); + if (scr_cw_count) { + printf(", SCR0: %d", scr[0]); + if (scr_cw_count > 1) { + printf(", SCR1: %d, SCR2: %d", scr[1], scr[2]); + } + } + printf("\n"); + } + /* Maximum capacity is 282 codewords */ total_cws = data_cw_count + qcc + 3; // 3 == TCC pattern + RSEC pattern + QCC pattern if (total_cws - 3 > 282) { @@ -941,8 +999,8 @@ INTERNAL int ultracode(struct zint_symbol *symbol, unsigned char source[], int l rows = 5; for (i = 2; i >= 0; i--) { - // Total codewords less 6 overhead (Start + MCC + ACC + 3 TCC/RSEC/QCC patterns) - if (total_cws - 6 <= ultra_maxsize[i]) { + // Total codewords less 6 (+ SCR) overhead (Start + MCC + ACC (+ SCR) + 3 TCC/RSEC/QCC patterns) + if (total_cws - (6 + scr_cw_count) <= ultra_maxsize[i]) { rows--; } } @@ -957,17 +1015,19 @@ INTERNAL int ultracode(struct zint_symbol *symbol, unsigned char source[], int l columns += columns / 15; // Secondary vertical clock tracks if (symbol->debug & ZINT_DEBUG_PRINT) { - printf("Calculated size is %d rows by %d columns\n", rows, columns); + printf("Calculated size is %d rows by %d columns (pads %d)\n", rows, columns, pads); } - /* Insert MCC and ACC into data codewords */ - for (i = 282; i > 2; i--) { - data_codewords[i] = data_codewords[i - 2]; + /* Insert MCC and ACC and possibly SCR into data codewords */ + for (i = 282; i > 2 + scr_cw_count; i--) { + data_codewords[i] = data_codewords[i - (2 + scr_cw_count)]; } data_codewords[1] = data_cw_count; // MCC data_codewords[2] = acc; // ACC + for (i = 0; i < scr_cw_count; i++) { // SCR + data_codewords[3 + i] = scr[i]; + } - locn = 0; /* Calculate error correction codewords (RSEC) */ ultra_gf283((short) data_cw_count, (short) qcc, data_codewords); @@ -981,6 +1041,7 @@ INTERNAL int ultracode(struct zint_symbol *symbol, unsigned char source[], int l } /* Rearrange to make final codeword sequence */ + locn = 0; codeword[locn++] = data_codewords[282 - (data_cw_count + qcc)]; // Start Character codeword[locn++] = data_cw_count; // MCC for (i = 0; i < qcc; i++) { @@ -989,8 +1050,12 @@ INTERNAL int ultracode(struct zint_symbol *symbol, unsigned char source[], int l codeword[locn++] = data_cw_count + qcc; // TCC = C + Q - section 6.11.4 codeword[locn++] = 283; // Separator codeword[locn++] = acc; // ACC - for (i = 0; i < (data_cw_count - 3); i++) { - codeword[locn++] = data_codewords[(282 - ((data_cw_count - 3) + qcc)) + i]; // Data Region + for (i = 0; i < scr_cw_count; i++) { // SCR + codeword[locn++] = scr[i]; + } + dr_count = data_cw_count - (3 + scr_cw_count); + for (i = 0; i < dr_count; i++) { + codeword[locn++] = data_codewords[(282 - (dr_count + qcc)) + i]; // Data Region } for (i = 0; i < pads; i++) { codeword[locn++] = 284; // Pad pattern diff --git a/backend/upcean.c b/backend/upcean.c index 656fd959..6fe7617f 100644 --- a/backend/upcean.c +++ b/backend/upcean.c @@ -562,7 +562,7 @@ static int isbn(struct zint_symbol *symbol, unsigned char source[], const int sr /* "X" can only occur in last position */ error_number = is_sane(NEON, source, 12); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "277: Invalid character in data, \"X\" allowed in last position only"); + strcpy(symbol->errtxt, "282: Invalid character in data, \"X\" allowed in last position only"); return error_number; } @@ -586,7 +586,7 @@ static int isbn(struct zint_symbol *symbol, unsigned char source[], const int sr /* "X" can only occur in last position */ error_number = is_sane(NEON, source, 9); if (error_number == ZINT_ERROR_INVALID_DATA) { - strcpy(symbol->errtxt, "277: Invalid character in data, \"X\" allowed in last position only"); + strcpy(symbol->errtxt, "296: Invalid character in data, \"X\" allowed in last position only"); return error_number; } diff --git a/backend/vector.c b/backend/vector.c index b89d56e0..d04d0164 100644 --- a/backend/vector.c +++ b/backend/vector.c @@ -378,8 +378,8 @@ static void vector_reduce_rectangles(struct zint_symbol *symbol) { target = prev->next; while (target) { - if ((rect->x == target->x) && (rect->width == target->width) && (stripf(rect->y + rect->height) == target->y) - && (rect->colour == target->colour)) { + if ((rect->x == target->x) && (rect->width == target->width) + && (stripf(rect->y + rect->height) == target->y) && (rect->colour == target->colour)) { rect->height += target->height; prev->next = target->next; free(target); diff --git a/backend/zint.h b/backend/zint.h index 7ed98133..e5b13c48 100644 --- a/backend/zint.h +++ b/backend/zint.h @@ -81,6 +81,13 @@ extern "C" { struct zint_vector_circle *circles; /* Pointer to first circle */ }; + /* Structured Append info - ignored unless `zint_structapp.count` is set to non-zero value */ + struct zint_structapp { + int index; /* Position in Structured Append sequence, 1-based. Must be <= count */ + int count; /* Number of symbols in Structured Append sequence. Set >= 2 to add SA Info */ + char id[32]; /* Optional ID to distinguish sequence, ASCII, NUL-terminated unless max 32 long */ + }; + /* Main symbol structure */ struct zint_symbol { int symbology; /* Symbol to use (see BARCODE_XXX below) */ @@ -105,6 +112,7 @@ extern "C" { int eci; /* Extended Channel Interpretation. Default 0 (none) */ float dot_size; /* Size of dots used in BARCODE_DOTTY_MODE */ float guard_descent; /* Height in X-dimensions that UPC/EAN guard bars descend. Default 5 */ + struct zint_structapp structapp; /* Structured Append info. Default structapp.count 0 (none) */ int warn_level; /* Affects error/warning value returned by Zint API (see WARN_XXX below) */ int debug; /* Debugging flags */ unsigned char text[128]; /* Human Readable Text (if any), UTF-8, NUL-terminated (output only) */ @@ -314,6 +322,7 @@ extern "C" { #define ZINT_CAP_READER_INIT 0x0200 /* Supports Reader Initialisation? */ #define ZINT_CAP_FULL_MULTIBYTE 0x0400 /* Supports full-multibyte option? */ #define ZINT_CAP_MASK 0x0800 /* Is mask selectable? */ +#define ZINT_CAP_STRUCTAPP 0x1000 /* Supports Structured Append? */ /* The largest amount of data that can be encoded is 4350 4-byte UTF-8 chars in Han Xin Code */ #define ZINT_MAX_DATA_LEN 17400 diff --git a/backend_qt/qzint.cpp b/backend_qt/qzint.cpp index 7a2a644a..b884902c 100644 --- a/backend_qt/qzint.cpp +++ b/backend_qt/qzint.cpp @@ -57,6 +57,7 @@ namespace Zint { m_dotty = false; m_dot_size = 4.0f / 5.0f; m_guardDescent = 5.0f; + memset(&m_structapp, 0, sizeof(m_structapp)); m_whitespace = 0; m_vwhitespace = 0; m_gs1parens = false; @@ -104,6 +105,7 @@ namespace Zint { } m_zintSymbol->dot_size = m_dot_size; m_zintSymbol->guard_descent = m_guardDescent; + m_zintSymbol->structapp = m_structapp; m_zintSymbol->show_hrt = m_show_hrt ? 1 : 0; m_zintSymbol->eci = m_eci; m_zintSymbol->scale = m_scale; @@ -246,6 +248,31 @@ namespace Zint { m_guardDescent = guardDescent; } + void QZint::setStructApp(const int count, const int index, const QString& id) { + if (count) { + m_structapp.count = count; + m_structapp.index = index; + memset(m_structapp.id, 0, sizeof(m_structapp.id)); + if (!id.isEmpty()) { + QByteArray idArr = id.toLatin1(); +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstringop-truncation" +#endif + strncpy(m_structapp.id, idArr, sizeof(m_structapp.id)); +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic pop +#endif + } + } else { + clearStructApp(); + } + } + + void QZint::clearStructApp() { + memset(&m_structapp, 0, sizeof(m_structapp)); + } + QColor QZint::fgColor() const { return m_fgColor; } @@ -441,7 +468,8 @@ namespace Zint { resetSymbol(); strcpy(m_zintSymbol->outfile, filename.toLatin1().left(255)); QByteArray bstr = m_text.toUtf8(); - m_error = ZBarcode_Encode_and_Print(m_zintSymbol, (unsigned char *) bstr.data(), bstr.length(), m_rotate_angle); + m_error = ZBarcode_Encode_and_Print(m_zintSymbol, (unsigned char *) bstr.data(), bstr.length(), + m_rotate_angle); if (m_error >= ZINT_ERROR) { m_lastError = m_zintSymbol->errtxt; return false; @@ -479,6 +507,7 @@ namespace Zint { } } + /* Note: legacy argument `mode` is not used */ void QZint::render(QPainter& painter, const QRectF& paintRect, AspectRatioMode /*mode*/) { struct zint_vector_rect *rect; struct zint_vector_hexagon *hex; @@ -639,4 +668,4 @@ namespace Zint { painter.restore(); } -} +} /* namespace Zint */ diff --git a/backend_qt/qzint.h b/backend_qt/qzint.h index 6e4f0142..4cd9f864 100644 --- a/backend_qt/qzint.h +++ b/backend_qt/qzint.h @@ -72,6 +72,9 @@ public: float guardDescent() const; void setGuardDescent(float guardDescent); + void setStructApp(const int count, const int index, const QString& id); + void clearStructApp(); + QColor fgColor() const; void setFgColor(const QColor& fgColor); @@ -143,7 +146,7 @@ public: /* Note: legacy argument `mode` is not used */ void render(QPainter& painter, const QRectF& paintRect, AspectRatioMode mode = IgnoreAspectRatio); - + int getVersion() const; signals: @@ -181,6 +184,7 @@ private: bool m_dotty; float m_dot_size; float m_guardDescent; + struct zint_structapp m_structapp; bool m_gs1parens; bool m_gs1nocheck; bool m_gssep; @@ -193,6 +197,6 @@ private: int target_size_vert; /* Legacy */ }; -} +} /* namespace Zint */ #endif /* QZINT_H */ diff --git a/backend_tcl/zint.c b/backend_tcl/zint.c index 8b965749..e99b2e85 100644 --- a/backend_tcl/zint.c +++ b/backend_tcl/zint.c @@ -127,6 +127,9 @@ - iHeight check int -> double 2021-09-24 GL - Added -quietzones and -noquietzones options +2021-09-27 GL +- Added -structapp +- Split up -to parsing (could seg fault if given non-int for X0 or Y0) */ #if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) @@ -429,7 +432,6 @@ static int s_eci_number[] = { 3,4,5,6,7,8,9,10,11,12,13,15,16,17,18,20,21,22,23,24,25,26,27,28,29,30 }; - /* Version information */ static char version_string[] = VERSION; /* Help text */ @@ -489,6 +491,7 @@ static char help_message[] = "zint tcl(stub,obj) dll\n" /* cli option --small replaced by -smalltext */ " -smalltext bool: tiny interpretation line font\n" " -square bool: force Data Matrix symbols to be square\n" + " -structapp {index count ?id?}: set Structured Append info\n" /* cli option --types not supported */ " -vers integer: Symbology option\n" " -vwhitesp integer: vertical quiet zone in modules\n" @@ -717,7 +720,7 @@ static int Encode(Tcl_Interp *interp, int objc, "-height", "-init", "-mask", "-mode", "-nobackground", "-noquietzones", "-notext", "-primary", "-quietzones", "-reverse", "-rotate", "-rows", "-scale", "-scmvv", - "-secure", "-separator", "-smalltext", "-square", + "-secure", "-separator", "-smalltext", "-square", "-structapp", "-to", "-vers", "-vwhitesp", "-werror", "-whitesp", NULL}; enum iOption { @@ -727,7 +730,7 @@ static int Encode(Tcl_Interp *interp, int objc, iHeight, iInit, iMask, iMode, iNoBackground, iNoQuietZones, iNoText, iPrimary, iQuietZones, iReverse, iRotate, iRows, iScale, iSCMvv, - iSecure, iSeparator, iSmallText, iSquare, + iSecure, iSeparator, iSmallText, iSquare, iStructApp, iTo, iVers, iVWhiteSp, iWError, iWhiteSp }; int optionIndex; @@ -819,7 +822,7 @@ static int Encode(Tcl_Interp *interp, int objc, Tcl_UtfToExternalDString( hZINTEncoding, pStr, lStr, &dString); if (Tcl_DStringLength(&dString) > (optionIndex==iPrimary?90:250)) { Tcl_DStringFree(&dString); - Tcl_SetObjResult(interp,Tcl_NewStringObj("String to long", -1)); + Tcl_SetObjResult(interp,Tcl_NewStringObj("String too long", -1)); fError = 1; } break; @@ -1109,6 +1112,54 @@ static int Encode(Tcl_Interp *interp, int objc, case iWhiteSp: my_symbol->whitespace_width = intValue; break; + case iStructApp: + /* >> Decode the -structapp parameter as list of index count ?ID? */ + { + Tcl_Obj *poParam; + struct zint_structapp structapp = { 0, 0, "" }; + char *pStructAppId = NULL; + int lStructAppId = 0; + if (TCL_OK != Tcl_ListObjLength(interp, + objv[optionPos+1], &lStr)) + { + fError = 1; + } else if ( ! ( lStr == 2 || lStr == 3 ) ) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj( + "option -structapp not a list of 2 or 3", -1)); + fError = 1; + } else { + if (TCL_OK != Tcl_ListObjIndex(interp, objv[optionPos+1], + 0, &poParam) + || TCL_OK != Tcl_GetIntFromObj(interp, poParam, &structapp.index) + || TCL_OK != Tcl_ListObjIndex(interp, objv[optionPos+1], + 1, &poParam) + || TCL_OK != Tcl_GetIntFromObj(interp, poParam, &structapp.count)) + { + fError = 1; + } + if (!fError && lStr == 3 && ( + TCL_OK != Tcl_ListObjIndex(interp, objv[optionPos+1], + 2, &poParam) + || !(pStructAppId = Tcl_GetStringFromObj(poParam, &lStructAppId)) + || lStructAppId > 32 + )) + { + if (lStructAppId > 32) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("Structured Append ID too long", -1)); + } + fError = 1; + } + if (!fError) { + my_symbol->structapp = structapp; + if (lStr == 3 && pStructAppId && lStructAppId) { + strncpy(my_symbol->structapp.id, pStructAppId, lStructAppId); + } + } + } + } + break; case iTo: /* >> Decode the -to parameter as list of X0 Y0 ?Width Height? */ { @@ -1122,25 +1173,29 @@ static int Encode(Tcl_Interp *interp, int objc, Tcl_NewStringObj( "option -to not a list of 2 or 4", -1)); fError = 1; - } else if (( - TCL_OK != Tcl_ListObjIndex(interp, objv[optionPos+1], - 0, &poParam) - || TCL_OK != Tcl_GetIntFromObj(interp,poParam,&destX0) - || TCL_OK != Tcl_ListObjIndex(interp, objv[optionPos+1], - 1, &poParam) - || TCL_OK != Tcl_GetIntFromObj(interp,poParam,&destY0) - || lStr == 4) && ( - TCL_OK != Tcl_ListObjIndex(interp, objv[optionPos+1], - 2, &poParam) - || TCL_OK != Tcl_GetIntFromObj(interp,poParam, - &destWidth) - || TCL_OK != Tcl_ListObjIndex(interp, objv[optionPos+1], - 3, &poParam) - || TCL_OK != Tcl_GetIntFromObj(interp,poParam, - &destHeight) - )) - { - fError = 1; + } else { + if (TCL_OK != Tcl_ListObjIndex(interp, objv[optionPos+1], + 0, &poParam) + || TCL_OK != Tcl_GetIntFromObj(interp,poParam,&destX0) + || TCL_OK != Tcl_ListObjIndex(interp, objv[optionPos+1], + 1, &poParam) + || TCL_OK != Tcl_GetIntFromObj(interp,poParam,&destY0)) + { + fError = 1; + } + if (!fError && lStr == 4 && ( + TCL_OK != Tcl_ListObjIndex(interp, objv[optionPos+1], + 2, &poParam) + || TCL_OK != Tcl_GetIntFromObj(interp,poParam, + &destWidth) + || TCL_OK != Tcl_ListObjIndex(interp, objv[optionPos+1], + 3, &poParam) + || TCL_OK != Tcl_GetIntFromObj(interp,poParam, + &destHeight) + )) + { + fError = 1; + } } } break; diff --git a/docs/manual.txt b/docs/manual.txt index 63384958..e9cbce4e 100644 --- a/docs/manual.txt +++ b/docs/manual.txt @@ -478,7 +478,6 @@ vector files so that... zint --bg=ff0000 --fg=ffffff00 ... will give different results for PNG and SVG. Experimentation is advised! -Also note that these options don't work properly with MaxiCode yet. In addition the --nobackground option will simply remove the background from PNG, GIF, TIF, SVG, EMF and EPS files. @@ -765,7 +764,7 @@ PCX | ZSoft Paintbrush image PNG | Portable Network Graphic SVG | Scalable Vector Graphic TIF | Tagged Image File Format -TXT | Text file (see 4.16) +TXT | Text file (see 4.17) -------------------------------------------------------------- ============================================================================= @@ -799,7 +798,26 @@ minimum dot size is 0.01, the maximum is 20. The default and minimum scale for raster output in dotty mode is 1. -4.15 Help options +4.15 Structured Append +---------------------- +Structured Append is a method of splitting data among several symbols so that +they form a sequence that can be scanned and re-assembled in the correct order +on reading, and is available for Aztec Code, Code One, Data Matrix, DotCode, +Grid Matrix, MaxiCode, MicroPDF417, PDF417, QR Code and Ultracode. + +The --structapp option marks a symbol as part of a Structured Append sequence, +and has the format + +--structapp=I,C[,ID] + +where I is the index (position) of the symbol in the Structured Append sequence, +C is the count or total number of symbols in the sequence, and ID is an optional +identifier (not available for Code One, DotCode or MaxiCode) that is the same +for all symbols belonging to the same sequence. The index is 1-based and goes +from 1 to count. Count must be 2 or more. See the individual symbologies for +further details. + +4.16 Help options ----------------- There are three help options which give information about how to use the command line. The -h or --help option will display a list of all of the valid @@ -810,7 +828,7 @@ ID numbers and names. The -e or --ecinos option gives a list of the ECI codes. -4.16 Other output options +4.17 Other output options ------------------------- For linear barcodes the text present in the output image can be removed by using the --notext option. @@ -1108,6 +1126,9 @@ dot_size | float | Size of dots used in dotty | 4.0 / 5.0 | | mode. | guard_descent | float | Height of guard bar descent | 5.0 | | (UPC/EAN only). | +structapp | Structured | Mark a symbol as part of a | count 0 + | Append | sequence of symbols. | (disabled) + | structure | | warn_level | integer | Affects error/warning value | WARN_DEFAULT | | returned by Zint API. | text | unsigned | Human Readable Text, which | "" (empty) @@ -1512,11 +1533,13 @@ ZINT_CAP_ECI | Does the symbology support Extended Channel | Interpretations? ZINT_CAP_GS1 | Does the symbology support GS1 data? ZINT_CAP_DOTTY | Can the symbology be outputted as dots? +ZINT_CAP_QUIET_ZONES | Does the symbology have default quiet zones? ZINT_CAP_FIXED_RATIO | Does the symbology have a fixed width-to-height | (aspect) ratio? ZINT_CAP_READER_INIT | Does the symbology support Reader Initialisation? ZINT_CAP_FULL_MULTIBYTE | Is the ZINT_FULL_MULTIBYTE option applicable? ZINT_CAP_MASK | Is mask selection applicable? +ZINT_CAP_STRUCTAPP | Does the symbology support Structured Append? ------------------------------------------------------------------------------- For example: @@ -2050,6 +2073,13 @@ mechanism. A separate symbology ID can be used to encode Health Industry Barcode (HIBC) data which adds a leading '+' character and a modulo-49 check digit to the encoded data. +PDF417 supports Structured Append of up to a 99,999 symbols and a numeric ID of +up to 30 digits, which can be set by using the --structapp option (see section +4.15) or the API structapp variable. The ID consists of up to 10 triplets, each +ranging from "000" to "899". For instance "123456789" would be a valid ID of 3 +triplets. However "123456900" would not, as the last triplet "900" exceeds +"899". The triplets are 0-filled, for instance "1234" becomes "123004". + 6.2.5 Compact PDF417 -------------------- Previously known as Truncated PDF417. Options are the same as for PDF417 above. @@ -2065,7 +2095,8 @@ determined using the --cols switch or option_2 as with PDF417. This symbology uses Latin-1 character encoding by default but also supports the ECI encoding mechanism. A separate symbology ID can be used to encode Health Industry Barcode (HIBC) data which adds a leading '+' character and a modulo-49 check -digit to the encoded data. +digit to the encoded data. MicroPDF417 supports Structured Append the same as +PDF417, for which see details. 6.2.7 GS1 DataBar Stacked (ISO 24724) ------------------------------------- @@ -2380,8 +2411,16 @@ DMRE symbol sizes may be activated in automatic size mode using the option --dmre or by the API option_3 = DM_DMRE GS1 data may be encoded using FNC1 (preferred) or GS as separator. -Use the option --gssep to change to GS or use the API -output_options |= GS1_GS_SEPARATOR +Use the option --gssep to change to GS or use the API output_options |= +GS1_GS_SEPARATOR + +Data Matrix supports Structured Append of up to 16 symbols and a numeric ID +(file identifications), which can be set by using the --structapp option (see +section 4.15) or the API structapp variable. The ID consists of 2 numbers ID1 +and ID2, each of which can range from 1 to 254, and is specified as the single +number ID1 * 1000 + ID2, so for instance ID1 "123" and ID2 "234" would be given +as "123234". Note that both ID1 and ID2 must be non-zero, so e.g. "123000" or +"000123" would be invalid IDs. If an ID is not given it defaults to "001001". 6.6.2 QR Code (ISO 18004) ------------------------- @@ -2467,6 +2506,13 @@ by using the --mask= switch with values 0-7, or by setting option_3 to (N + 1) << 8 where N is 0-7. To use with ZINT_FULL_MULTIBYTE set option_3 = ZINT_FULL_MULTIBYTE | (N + 1) << 8. +QR Code supports Structured Append of up to 16 symbols and a numeric ID +(parity), which can be set by using the --structapp option (see section 4.15) or +the API structapp variable. The parity ID ranges from 0 and 255, and for full +compliance should be set to the value obtained by XOR-ing together each byte of +the complete data forming the sequence. Currently this calculation must be done +outside of Zint. If an ID is not given it defaults to 0. + 6.6.3 Micro QR Code (ISO 18004) ------------------------------- A miniature version of the QR Code symbol for short messages. ECC levels can be @@ -2651,6 +2697,10 @@ Mode | Maximum Data Length | Maximum Data Length | Number of Error ----------------------------------------------------------------------------- * - secondary only +MaxiCode supports Structured Append of up to 8 symbols, which can be set by +using the --structapp option (see section 4.15) or the API structapp variable. +It does not support specifying an ID. + MaxiCode uses a different scaling than other symbols for raster output, see 4.9.2. @@ -2736,11 +2786,16 @@ A separate symbology ID can be used to encode Health Industry Barcode (HIBC) data which adds a leading '+' character and a modulo-49 check digit to the encoded data. +Aztec Code supports Structured Append of up to 26 symbols and an optional +alphanumeric ID of up to 32 characters, which can be set by using the +--structapp option (see section 4.15) or the API structapp variable. The ID +cannot contain spaces. If an ID is not given, no ID is encoded. + 6.6.8 Aztec Runes ----------------- A truncated version of compact Aztec Code for encoding whole integers between 0 and 255. Includes Reed-Solomon error correction. As defined in ISO/IEC 24778 -Annex A. +Annex A. It does not support Structured Append. 6.6.9 Code One -------------- @@ -2770,6 +2825,11 @@ Input | Version | Size | Numeric | Alphanumeric Version S symbols can only encode numeric data. The width of version S and version T symbols is determined by the length of the input data. +Code One supports Structured Append of up to 128 symbols, which can be set by +using the --structapp option (see section 4.15) or the API structapp variable. +It does not support specifying an ID. Structured Append is not supported with +GS1 data nor for Version S symbols. + 6.6.10 Grid Matrix ----------------- By default Grid Matrix supports encoding in Latin-1 and Chinese characters @@ -2815,6 +2875,10 @@ Non-ASCII data density may be maximized by using the --fullmultibyte switch or by setting option_3 to ZINT_FULL_MULTIBYTE, but check that your barcode reader supports this before using. +Grid Matrix supports Structured Append of up to 16 symbols and a numeric ID +(file signature), which can be set by using the --structapp option (see section +4.15) or the API structapp variable. The ID ranges from 0 (default) and 255. + 6.6.11 DotCode ------------- DotCode uses a grid of dots in a rectangular formation to encode characters up @@ -2833,6 +2897,10 @@ selected automatically by Zint but may be manually specified by using the --mask= switch with values 0-7, where 4-7 denote 0'-3', or by setting option_3 to (N + 1) << 8 where N is 0-7. +DotCode supports Structured Append of up to 35 symbols, which can be set by +using the --structapp option (see section 4.15) or the API structapp variable. +It does not support specifying an ID. + 6.6.12 Han Xin Code ------------------- Also known as Chinese Sensible Code, Han Xin is a symbology which is still under @@ -2982,6 +3050,11 @@ symbol->option_3 = ULTRA_COMPRESSION; WARNING: Ultracode data compression is experimental and should not be used in a production environment. +Ultracode supports Structured Append of up to 8 symbols and an optional numeric +ID (File Number), which can be set by using the --structapp option (see section +4.15) or the API structapp variable. The ID ranges from 1 and 80088. If an ID +is not given, no ID is encoded. + 6.7 Other Barcode-Like Markings ------------------------------- 6.7.1. Facing Identification Mark (FIM) diff --git a/frontend/main.c b/frontend/main.c index c768d2bd..d09f239f 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -37,7 +37,7 @@ #endif /* _MSC_VER */ /* It's assumed that int is at least 32 bits, the following will compile-time fail if not - * https://stackoverflow.com/a/1980056/664741 */ + * https://stackoverflow.com/a/1980056 */ typedef int static_assert_int_at_least_32bits[CHAR_BIT != 8 || sizeof(int) < 4 ? -1 : 1]; #ifndef ARRAY_SIZE @@ -104,7 +104,7 @@ static void usage(void) { int version_minor = (zint_version % 10000) / 100; int version_release = zint_version % 100; int version_build; - + if (version_release >= 9) { /* This is a test release */ version_release = version_release / 10; @@ -114,7 +114,7 @@ static void usage(void) { /* This is a stable release */ printf( "Zint version %d.%d.%d\n", version_major, version_minor, version_release); } - + printf( "Encode input data in a barcode and save as BMP/EMF/EPS/GIF/PCX/PNG/SVG/TIF/TXT\n\n" " -b, --barcode=TYPE Number or name of barcode type. Default is 20 (CODE128)\n" " --addongap=NUMBER Set add-on gap in multiples of X-dimension for UPC/EAN\n" @@ -166,6 +166,7 @@ static void usage(void) { " --separator=NUMBER Set height of row separator bars (stacked symbologies)\n" " --small Use small text\n" " --square Force Data Matrix symbols to be square\n" + " --structapp=I,C[,ID] Set Structured Append info (I index, C count)\n" " -t, --types Display table of barcode types\n" " --vers=NUMBER Set symbol version (size, check digits, other options)\n" " --vwhitesp=NUMBER Set height of vertical whitespace in multiples of X-dim\n" @@ -497,6 +498,61 @@ static int is_raster(const char *filetype, const int no_png) { return 0; } +/* Parse and validate Structured Append argument "index,count[,ID]" to "--structapp" */ +int validate_structapp(const char *optarg, struct zint_structapp *structapp) { + char index[10] = {0}, count[10] = {0}; + const char *comma = strchr(optarg, ','); + const char *comma2; + if (!comma) { + fprintf(stderr, "Error 155: Invalid Structured Append argument, expect \"index,count[,ID]\"\n"); + return 0; + } + if (comma == optarg || comma - optarg > 9) { + fprintf(stderr, "Error 156: Structured Append index too %s\n", comma == optarg ? "short" : "long"); + return 0; + } + strncpy(index, optarg, comma - optarg); + comma++; + comma2 = strchr(comma, ','); + if (comma2) { + if (comma2 == comma || comma2 - comma > 9) { + fprintf(stderr, "Error 157: Structured Append count too %s\n", comma2 == comma ? "short" : "long"); + return 0; + } + strncpy(count, comma, comma2 - comma); + comma2++; + if (!*comma2 || strlen(comma2) > 32) { + fprintf(stderr, "Error 158: Structured Append ID too %s\n", !*comma2 ? "short" : "long"); + return 0; + } + strncpy(structapp->id, comma2, 32); + } else { + if (!*comma || strlen(comma) > 9) { + fprintf(stderr, "Error 159: Structured Append count too %s\n", !*comma ? "short" : "long"); + return 0; + } + strcpy(count, comma); + } + if (!validate_int(index, &structapp->index)) { + fprintf(stderr, "Error 160: Invalid Structured Append index (digits only)\n"); + return 0; + } + if (!validate_int(count, &structapp->count)) { + fprintf(stderr, "Error 161: Invalid Structured Append count (digits only)\n"); + return 0; + } + if (structapp->count < 2) { + fprintf(stderr, "Error 162: Invalid Structured Append count, must be >= 2\n"); + return 0; + } + if (structapp->index < 1 || structapp->index > structapp->count) { + fprintf(stderr, "Error 163: Structured Append index out of range (1-%d)\n", structapp->count); + return 0; + } + + return 1; +} + /* Batch mode - output symbol for each line of text in `filename` */ static int batch_process(struct zint_symbol *symbol, const char *filename, const int mirror_mode, const char *filetype, const int rotate_angle) { @@ -807,8 +863,8 @@ int main(int argc, char **argv) { OPT_HEIGHT, OPT_INIT, OPT_MIRROR, OPT_MASK, OPT_MODE, OPT_NOBACKGROUND, OPT_NOQUIETZONES, OPT_NOTEXT, OPT_PRIMARY, OPT_QUIETZONES, OPT_ROTATE, OPT_ROWS, OPT_SCALE, OPT_SCMVV, - OPT_SECURE, OPT_SEPARATOR, OPT_SMALL, OPT_SQUARE, OPT_VERBOSE, OPT_VERS, - OPT_VWHITESP, OPT_WERROR, + OPT_SECURE, OPT_SEPARATOR, OPT_SMALL, OPT_SQUARE, OPT_STRUCTAPP, + OPT_VERBOSE, OPT_VERS, OPT_VWHITESP, OPT_WERROR, }; int option_index = 0; static struct option long_options[] = { @@ -863,6 +919,7 @@ int main(int argc, char **argv) { {"separator", 1, NULL, OPT_SEPARATOR}, {"small", 0, NULL, OPT_SMALL}, {"square", 0, NULL, OPT_SQUARE}, + {"structapp", 1, NULL, OPT_STRUCTAPP}, {"types", 0, NULL, 't'}, {"verbose", 0, NULL, OPT_VERBOSE}, // Currently undocumented, output some debug info {"vers", 1, NULL, OPT_VERS}, @@ -1026,7 +1083,8 @@ int main(int argc, char **argv) { if (float_opt >= 0.0f && float_opt <= 50.0f) { my_symbol->guard_descent = float_opt; } else { - fprintf(stderr, "Warning 155: Guard bar descent '%g' out of range (0 to 50), ignoring\n", float_opt); + fprintf(stderr, "Warning 155: Guard bar descent '%g' out of range (0 to 50), ignoring\n", + float_opt); fflush(stderr); } break; @@ -1035,7 +1093,8 @@ int main(int argc, char **argv) { if (float_opt >= 0.5f && float_opt <= 1000.0f) { my_symbol->height = float_opt; } else { - fprintf(stderr, "Warning 110: Symbol height '%g' out of range (0.5 to 1000), ignoring\n", float_opt); + fprintf(stderr, "Warning 110: Symbol height '%g' out of range (0.5 to 1000), ignoring\n", + float_opt); fflush(stderr); } break; @@ -1179,6 +1238,12 @@ int main(int argc, char **argv) { case OPT_SQUARE: my_symbol->option_3 = DM_SQUARE; break; + case OPT_STRUCTAPP: + memset(&my_symbol->structapp, 0, sizeof(my_symbol->structapp)); + if (!validate_structapp(optarg, &my_symbol->structapp)) { + return do_exit(1); + } + break; case OPT_VERBOSE: my_symbol->debug = 1; break; diff --git a/frontend/tests/test_args.c b/frontend/tests/test_args.c index 678abd42..281077ed 100644 --- a/frontend/tests/test_args.c +++ b/frontend/tests/test_args.c @@ -922,6 +922,22 @@ static void test_other_opts(int index, int debug) { /* 21*/ { BARCODE_GS1_128, "[00]376104250021234568", -1, "", NULL, "Warning 261: AI (00) position 18: Bad checksum '8', expected '9'" }, /* 22*/ { BARCODE_GS1_128, "[00]376104250021234568", -1, " --gs1nocheck", NULL, "" }, /* 23*/ { BARCODE_GS1_128, "[00]376104250021234568", -1, " --werror", NULL, "Error 261: AI (00) position 18: Bad checksum '8', expected '9'" }, + /* 24*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "1", "Error 155: Invalid Structured Append argument, expect \"index,count[,ID]\"" }, + /* 25*/ { BARCODE_AZTEC, "1", -1, " --structapp=", ",", "Error 156: Structured Append index too short" }, + /* 26*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "1234567890,", "Error 156: Structured Append index too long" }, + /* 27*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,", "Error 159: Structured Append count too short" }, + /* 28*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,1234567890", "Error 159: Structured Append count too long" }, + /* 29*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,123456789,", "Error 158: Structured Append ID too short" }, + /* 30*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,1234567890,", "Error 157: Structured Append count too long" }, + /* 31*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,123456789,123456789012345678901234567890123", "Error 158: Structured Append ID too long" }, + /* 32*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,123456789,12345678901234567890123456789012", "Error 701: Structured Append count out of range (2-26)" }, + /* 33*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "26,26,12345678901234567890123456789012", "" }, + /* 34*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "A,26,12345678901234567890123456789012", "Error 160: Invalid Structured Append index (digits only)" }, + /* 35*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "26,A,12345678901234567890123456789012", "Error 161: Invalid Structured Append count (digits only)" }, + /* 36*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "26,1,12345678901234567890123456789012", "Error 162: Invalid Structured Append count, must be >= 2" }, + /* 37*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "0,2,12345678901234567890123456789012", "Error 163: Structured Append index out of range (1-2)" }, + /* 38*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "3,2,12345678901234567890123456789012", "Error 163: Structured Append index out of range (1-2)" }, + /* 39*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "2,3,12345678901234567890123456789012", "" }, }; int data_size = ARRAY_SIZE(data); int i; diff --git a/frontend_qt/datawindow.cpp b/frontend_qt/datawindow.cpp index ac361c5e..316c4e65 100644 --- a/frontend_qt/datawindow.cpp +++ b/frontend_qt/datawindow.cpp @@ -83,7 +83,8 @@ void DataWindow::from_file() QString escape_string; open_dialog.setWindowTitle("Open File"); - open_dialog.setDirectory(settings.value("studio/default_dir", QDir::toNativeSeparators(QDir::homePath())).toString()); + open_dialog.setDirectory(settings.value("studio/default_dir", + QDir::toNativeSeparators(QDir::homePath())).toString()); if (open_dialog.exec()) { filename = open_dialog.selectedFiles().at(0); diff --git a/frontend_qt/exportwindow.cpp b/frontend_qt/exportwindow.cpp index 2f44fe44..3c33d20d 100644 --- a/frontend_qt/exportwindow.cpp +++ b/frontend_qt/exportwindow.cpp @@ -34,7 +34,8 @@ ExportWindow::ExportWindow() #endif setupUi(this); - linDestPath->setText(settings.value("studio/export/destination", QDir::toNativeSeparators(QDir::homePath())).toString()); + linDestPath->setText(settings.value("studio/export/destination", + QDir::toNativeSeparators(QDir::homePath())).toString()); linPrefix->setText(settings.value("studio/export/file_prefix", "bcs_").toString()); cmbFileName->setCurrentIndex(settings.value("studio/export/name_format", 0).toInt()); cmbFileFormat->setCurrentIndex(settings.value("studio/export/filetype", 0).toInt()); diff --git a/frontend_qt/grpAztec.ui b/frontend_qt/grpAztec.ui index ad8df76f..aad58a84 100644 --- a/frontend_qt/grpAztec.ui +++ b/frontend_qt/grpAztec.ui @@ -27,6 +27,10 @@ Auto&matic Resizing + + Size, type and error correction level will +be set based on data + true @@ -40,6 +44,9 @@ Adjust Si&ze To: + + Set size (layers) and whether compact or not + buttonGroupAztecSizeECC @@ -50,6 +57,9 @@ false + + Set size (layers) and whether compact or not + 15 x 15 Compact @@ -237,6 +247,10 @@ Add Minimum E&rror Correction: + + Set minimum percentage of capacity to use +for error correction codewords + buttonGroupAztecSizeECC @@ -247,6 +261,10 @@ false + + Set minimum percentage of capacity to use +for error correction codewords + 10% + 3 words @@ -276,6 +294,9 @@ Encoding Mode + + How to process data + QLayout::SetMinimumSize @@ -283,7 +304,10 @@ - S&tandard Mode + S&tandard + + + Process data as normal true @@ -293,15 +317,409 @@ - GS&1 Data Mode + GS&1 Data + + + Process data as GS1 General Specifications data, +formatted with Application Identifiers (AIs) - + H&IBC Aztec Code + + Process data as a Health Industry Barcode (HIBC) +Labeler Identification Code (LIC) +For Provider Applications Standard (PAS), preface +the data with a slash "/" + + + + + + + + + + Structured Append + + + Aztec Code supports Structured Append of up to +26 symbols + + + + + + C&ount: + + + Qt::AlignLeft|Qt::AlignLeading|Qt::AlignVCenter + + + cmbAztecStructAppCount + + + Mark symbol as part of a Structured Append sequence +containing a total of this number of symbols +Value ranges from 2 to 26 + + + + + + + Mark symbol as part of a Structured Append sequence +containing a total of this number of symbols +Value ranges from 2 to 26 + + + + Disabled + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 10 + + + + + 11 + + + + + 12 + + + + + 13 + + + + + 14 + + + + + 15 + + + + + 16 + + + + + 17 + + + + + 18 + + + + + 19 + + + + + 20 + + + + + 21 + + + + + 22 + + + + + 23 + + + + + 24 + + + + + 25 + + + + + 26 + + + + + + + + Qt::Horizontal + + + + 10 + 20 + + + + + + + + false + + + Inde&x: + + + Qt::AlignLeft|Qt::AlignLeading|Qt::AlignVCenter + + + cmbAztecStructAppIndex + + + Position of symbol in Structured Append sequence +Value ranges from 1 to count +(ignored if disabled) + + + + + + + false + + + Position of symbol in Structured Append sequence +Value ranges from 1 to count +(ignored if disabled) + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 10 + + + + + 11 + + + + + 12 + + + + + 13 + + + + + 14 + + + + + 15 + + + + + 16 + + + + + 17 + + + + + 18 + + + + + 19 + + + + + 20 + + + + + 21 + + + + + 22 + + + + + 23 + + + + + 24 + + + + + 25 + + + + + 26 + + + + + + + + false + + + Optional ID to indicate that symbols belong to +the same Structured Append sequence +Maximum length 32 and cannot contain spaces +(ignored if disabled) + + + I&D: + + + Qt::AlignLeft|Qt::AlignLeading|Qt::AlignVCenter + + + txtAztecStructAppID + + + + + + + false + + + 32 + + + Optional ID to indicate that symbols belong to +the same Structured Append sequence +Maximum length 32 and cannot contain spaces +(ignored if disabled) + @@ -318,7 +736,7 @@ 20 - 43 + 0 diff --git a/frontend_qt/grpC128.ui b/frontend_qt/grpC128.ui index 12bc1810..4a73d764 100644 --- a/frontend_qt/grpC128.ui +++ b/frontend_qt/grpC128.ui @@ -25,6 +25,9 @@ Encoding Mode + + How to process data + QLayout::SetMinimumSize @@ -34,6 +37,9 @@ S&tandard Mode + + Process data as normal + true @@ -44,6 +50,10 @@ Subset &C Suppression + + Do not begin in Subset C mode, +even if initial data is numeric + @@ -51,6 +61,10 @@ GS&1-128 + + Process data as GS1 General Specifications data, +formatted with Application Identifiers (AIs) + @@ -58,6 +72,12 @@ H&IBC 128 + + Process data as a Health Industry Barcode (HIBC) +Labeler Identification Code (LIC) +For Provider Applications Standard (PAS), preface +the data with a slash "/" + diff --git a/frontend_qt/grpC16k.ui b/frontend_qt/grpC16k.ui index 4a282d3d..459f30b8 100644 --- a/frontend_qt/grpC16k.ui +++ b/frontend_qt/grpC16k.ui @@ -69,6 +69,9 @@ Encoding Mode + + How to process data + QLayout::SetMinimumSize diff --git a/frontend_qt/grpC49.ui b/frontend_qt/grpC49.ui index bdab46fb..691e6812 100644 --- a/frontend_qt/grpC49.ui +++ b/frontend_qt/grpC49.ui @@ -69,6 +69,9 @@ Encoding Mode + + How to process data + QLayout::SetMinimumSize diff --git a/frontend_qt/grpCodablockF.ui b/frontend_qt/grpCodablockF.ui index aee8a903..cc3887a0 100644 --- a/frontend_qt/grpCodablockF.ui +++ b/frontend_qt/grpCodablockF.ui @@ -640,6 +640,9 @@ Encoding Mode + + How to process data + QLayout::SetMinimumSize @@ -665,8 +668,8 @@ Process data as a Health Industry Barcode (HIBC) Labeler Identification Code (LIC) -For Provider Applications Standard (PAS), -preface the data with a slash "/" +For Provider Applications Standard (PAS), preface +the data with a slash "/" diff --git a/frontend_qt/grpCodeOne.ui b/frontend_qt/grpCodeOne.ui index ed09645c..0e84f484 100644 --- a/frontend_qt/grpCodeOne.ui +++ b/frontend_qt/grpCodeOne.ui @@ -27,6 +27,9 @@ Symbol Si&ze: + + Set size (version) of symbol + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter @@ -37,6 +40,9 @@ + + Set size (version) of symbol + Automatic @@ -101,6 +107,9 @@ Encoding Mode + + How to process data + QLayout::SetMinimumSize @@ -110,6 +119,9 @@ S&tandard Mode + + Process data as normal + true @@ -121,9 +133,168 @@ GS&1 Data Mode - GS1 system (Application Identifiers) + Process data as GS1 General Specifications data, +formatted with Application Identifiers (AIs) (ignored if disabled) - + + + + + + + + + + Structured Append + + + Code One supports Structured Append of up to +128 symbols + + + + + + C&ount: + + + Qt::AlignLeft|Qt::AlignLeading|Qt::AlignVCenter + + + spnC1StructAppCount + + + Mark symbol as part of a Structured Append sequence +containing a total of this number of symbols +Value ranges from 1 (Disabled) to 128 + + + + + + + Mark symbol as part of a Structured Append sequence +containing a total of this number of symbols +Value ranges from 1 (Disabled) to 128 + + + 1 (Disabled) + + + 1 + + + 128 + + + 1 + + + + + + + Qt::Horizontal + + + + 10 + 20 + + + + + + + + false + + + Inde&x: + + + Qt::AlignLeft|Qt::AlignLeading|Qt::AlignVCenter + + + spnC1StructAppIndex + + + Position of symbol in Structured Append sequence +Value ranges from 1 to count +(ignored if disabled) + + + + + + + false + + + Position of symbol in Structured Append sequence +Value ranges from 1 to count +(ignored if disabled) + + + 1 + + + 128 + + + 1 + + + + + + + Qt::Horizontal + + + + 10 + 20 + + + + + + + + false + + + Structured Append ID not available for Code One + + + ID: + + + Qt::AlignLeft|Qt::AlignLeading|Qt::AlignVCenter + + + txtC1StructAppIDDisabled + + + + + + + false + + + + 0 + 0 + + + + Structured Append ID not available for Code One + + + N/A + diff --git a/frontend_qt/grpDM.ui b/frontend_qt/grpDM.ui index bb64bbb5..402344d3 100644 --- a/frontend_qt/grpDM.ui +++ b/frontend_qt/grpDM.ui @@ -27,6 +27,9 @@ Si&ze: + + Set height and width (H x W) of symbol + cmbDM200Size @@ -34,6 +37,9 @@ + + Set height and width (H x W) of symbol + 21 @@ -291,6 +297,9 @@ Encoding Mode + + How to process data + QLayout::SetMinimumSize @@ -298,7 +307,10 @@ - S&tandard Mode + S&tandard + + + Process data as normal true @@ -308,15 +320,25 @@ - GS&1 Data Mode + GS&1 Data + + + Process data as GS1 General Specifications data, +formatted with Application Identifiers (AIs) - + H&IBC Data Matrix + + Process data as a Health Industry Barcode (HIBC) +Labeler Identification Code (LIC) +For Provider Applications Standard (PAS), preface +the data with a slash "/" + @@ -327,6 +349,10 @@ Suppress &Rectangular Symbols in Automatic Mode + + Only consider square versions on automatic symbol +size selection + true @@ -337,6 +363,10 @@ Allo&w DMRE in Automatic Mode + + Consider DMRE versions on automatic symbol +size selection + false @@ -347,11 +377,352 @@ &Use separator GS for GS1 + + Use Group Separator (ASCII 0x1D) to separate GS1 AIs +instead of the preferred FNC1 + false + + + + Structured Append + + + Data Matrix supports Structured Append of up to +16 symbols + + + + + + C&ount: + + + Qt::AlignLeft|Qt::AlignLeading|Qt::AlignVCenter + + + cmbDMStructAppCount + + + Mark symbol as part of a Structured Append sequence +containing a total of this number of symbols +Value ranges from 2 to 16 + + + + + + + + 0 + 0 + + + + Mark symbol as part of a Structured Append sequence +containing a total of this number of symbols +Value ranges from 2 to 16 + + + + Disabled + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 10 + + + + + 11 + + + + + 12 + + + + + 13 + + + + + 14 + + + + + 15 + + + + + 16 + + + + + + + + Qt::Horizontal + + + + 10 + 20 + + + + + + + + false + + + Inde&x: + + + Qt::AlignLeft|Qt::AlignLeading|Qt::AlignVCenter + + + cmbDMStructAppIndex + + + Position of symbol in Structured Append sequence +Value ranges from 1 to count +(ignored if disabled) + + + + + + + false + + + + 0 + 0 + + + + Position of symbol in Structured Append sequence +Value ranges from 1 to count +(ignored if disabled) + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 10 + + + + + 11 + + + + + 12 + + + + + 13 + + + + + 14 + + + + + 15 + + + + + 16 + + + + + + + + Qt::Horizontal + + + + 10 + 20 + + + + + + + + false + + + File IDs to indicate that symbols belong to +the same Structured Append sequence +Value of each ID ranges from 1 to 254 +(ignored if disabled) + + + I&D: + + + Qt::AlignLeft|Qt::AlignLeading|Qt::AlignVCenter + + + spnDMStructAppID + + + + + + + false + + + File ID1 to indicate that symbols belong to +the same Structured Append sequence +Value ranges from 1 to 254 +(ignored if disabled) + + + 1 + + + 254 + + + 1 + + + + + + + false + + + File ID2 to indicate that symbols belong to +the same Structured Append sequence +Value ranges from 1 to 254 +(ignored if disabled) + + + 1 + + + 254 + + + 1 + + + + + + @@ -360,7 +731,7 @@ 20 - 40 + 0 diff --git a/frontend_qt/grpDotCode.ui b/frontend_qt/grpDotCode.ui index 3673fa01..6d54a912 100644 --- a/frontend_qt/grpDotCode.ui +++ b/frontend_qt/grpDotCode.ui @@ -27,6 +27,9 @@ &Number of Data Columns: + + Set the width of the symbol + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter @@ -37,6 +40,9 @@ + + Set the width of the symbol + 21 @@ -1032,6 +1038,11 @@ &Mask: + + Manually specify which mask to use +The prime masks 0' to 3' are the same +as 0 to 3 with the corners lit + cmbDotMask @@ -1042,6 +1053,11 @@ 8 + + Manually specify which mask to use +The prime masks 0' to 3' are the same +as 0 to 3 with the corners lit + Automatic @@ -1096,6 +1112,9 @@ Encoding Mode + + How to process data + QLayout::SetMinimumSize @@ -1105,6 +1124,9 @@ S&tandard Mode + + Process data as normal + true @@ -1115,6 +1137,509 @@ GS&1 Data Mode + + Process data as GS1 General Specifications data, +formatted with Application Identifiers (AIs) + + + + + + + + + + Structured Append + + + DotCode supports Structured Append of up to +35 symbols + + + + + + C&ount: + + + Qt::AlignLeft|Qt::AlignLeading|Qt::AlignVCenter + + + cmbDotStructAppCount + + + Mark symbol as part of a Structured Append sequence +containing a total of this number of symbols +Value ranges from 2 to 35 + + + + + + + + 0 + 0 + + + + Mark symbol as part of a Structured Append sequence +containing a total of this number of symbols +Value ranges from 2 to 35 + + + + Disabled + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 10 + + + + + 11 + + + + + 12 + + + + + 13 + + + + + 14 + + + + + 15 + + + + + 16 + + + + + 17 + + + + + 18 + + + + + 19 + + + + + 20 + + + + + 21 + + + + + 22 + + + + + 23 + + + + + 24 + + + + + 25 + + + + + 26 + + + + + 27 + + + + + 28 + + + + + 29 + + + + + 30 + + + + + 31 + + + + + 32 + + + + + 33 + + + + + 34 + + + + + 35 + + + + + + + + Qt::Horizontal + + + + 10 + 20 + + + + + + + + false + + + Inde&x: + + + Qt::AlignLeft|Qt::AlignLeading|Qt::AlignVCenter + + + cmbDotStructAppIndex + + + Position of symbol in Structured Append sequence +Value ranges from 1 to count +(ignored if disabled) + + + + + + + false + + + + 0 + 0 + + + + Position of symbol in Structured Append sequence +Value ranges from 1 to count +(ignored if disabled) + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 10 + + + + + 11 + + + + + 12 + + + + + 13 + + + + + 14 + + + + + 15 + + + + + 16 + + + + + 17 + + + + + 18 + + + + + 19 + + + + + 20 + + + + + 21 + + + + + 22 + + + + + 23 + + + + + 24 + + + + + 25 + + + + + 26 + + + + + 27 + + + + + 28 + + + + + 29 + + + + + 30 + + + + + 31 + + + + + 32 + + + + + 33 + + + + + 34 + + + + + 35 + + + + + + + + Qt::Horizontal + + + + 10 + 20 + + + + + + + + false + + + Structured Append ID not available for DotCode + + + ID: + + + Qt::AlignLeft|Qt::AlignLeading|Qt::AlignVCenter + + + txtDotStructAppIDDisabled + + + + + + + false + + + + 0 + 0 + + + + Structured Append ID not available for DotCode + + + N/A + diff --git a/frontend_qt/grpGrid.ui b/frontend_qt/grpGrid.ui index ad615bf9..d60063e4 100644 --- a/frontend_qt/grpGrid.ui +++ b/frontend_qt/grpGrid.ui @@ -27,6 +27,9 @@ Si&ze: + + Set size (version) of symbol + cmbGridSize @@ -34,6 +37,9 @@ + + Set size (version) of symbol + Automatic @@ -111,6 +117,10 @@ E&rror Correction: + + Set percentage of capacity to use for +error correction codewords + cmbGridECC @@ -118,6 +128,10 @@ + + Set percentage of capacity to use for +error correction codewords + Automatic @@ -187,6 +201,321 @@ + + + + Structured Append + + + Grid Matrix supports Structured Append of up to +16 symbols + + + + + + C&ount: + + + Qt::AlignLeft|Qt::AlignLeading|Qt::AlignVCenter + + + cmbGridStructAppCount + + + Mark symbol as part of a Structured Append sequence +containing a total of this number of symbols +Value ranges from 2 to 16 + + + + + + + + 0 + 0 + + + + Mark symbol as part of a Structured Append sequence +containing a total of this number of symbols +Value ranges from 2 to 16 + + + + Disabled + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 10 + + + + + 11 + + + + + 12 + + + + + 13 + + + + + 14 + + + + + 15 + + + + + 16 + + + + + + + + Qt::Horizontal + + + + 10 + 20 + + + + + + + + false + + + Inde&x: + + + Qt::AlignLeft|Qt::AlignLeading|Qt::AlignVCenter + + + cmbGridStructAppIndex + + + Position of symbol in Structured Append sequence +Value ranges from 1 to count +(ignored if disabled) + + + + + + + false + + + + 0 + 0 + + + + Position of symbol in Structured Append sequence +Value ranges from 1 to count +(ignored if disabled) + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 10 + + + + + 11 + + + + + 12 + + + + + 13 + + + + + 14 + + + + + 15 + + + + + 16 + + + + + + + + Qt::Horizontal + + + + 10 + 20 + + + + + + + + false + + + ID (file signature) to indicate that symbols belong +to the same Structured Append sequence +Value ranges from 0 to 255 +(ignored if disabled) + + + I&D: + + + Qt::AlignLeft|Qt::AlignLeading|Qt::AlignVCenter + + + spnGridStructAppID + + + + + + + false + + + ID (file signature) to indicate that symbols belong +to the same Structured Append sequence +Value ranges from 0 to 255 +(ignored if disabled) + + + 0 + + + 255 + + + 0 + + + + + + diff --git a/frontend_qt/grpMaxicode.ui b/frontend_qt/grpMaxicode.ui index efbb0f39..ee0ae980 100644 --- a/frontend_qt/grpMaxicode.ui +++ b/frontend_qt/grpMaxicode.ui @@ -118,7 +118,7 @@ be padded with spaces - + false @@ -147,7 +147,7 @@ be padded with spaces false - ISO 3166 numeric country code + ISO 3166-1 numeric country code Value ranges from 000 to 999 (ignored if disabled) @@ -168,7 +168,7 @@ Value ranges from 000 to 999 false - ISO 3166 numeric country code + ISO 3166-1 numeric country code Value ranges from 000 to 999 (ignored if disabled) @@ -189,7 +189,20 @@ Value ranges from 000 to 999 - + + + + Qt::Horizontal + + + + 10 + 20 + + + + + false @@ -210,7 +223,7 @@ Value ranges from 000 to 999 - + false @@ -237,14 +250,15 @@ Value ranges from 000 to 999 - + false Prefix Structured Carrier Message with "[)>\R01\Gvv" -(ANS MH10.8.2 Format 01) where "vv" is version given below +(ANS MH10.8.2 Format 01) where "vv" is version +specified as follows (ignored if disabled) @@ -252,7 +266,20 @@ Value ranges from 000 to 999 - + + + + Qt::Horizontal + + + + 10 + 20 + + + + + false @@ -272,7 +299,7 @@ Value ranges from 000 to 999 - + false @@ -301,6 +328,235 @@ Value ranges from 000 to 999 + + + + Structured Append + + + MaxiCode supports Structured Append of up to +8 symbols + + + + + + Mark symbol as part of a Structured Append sequence +containing a total of this number of symbols +Value ranges from 2 to 8 + + + C&ount: + + + Qt::AlignLeft|Qt::AlignLeading|Qt::AlignVCenter + + + cmbMaxiStructAppCount + + + + + + + + 0 + 0 + + + + Mark symbol as part of a Structured Append sequence +containing a total of this number of symbols +Value ranges from 2 to 8 + + + + Disabled + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + + + + Qt::Horizontal + + + + 10 + 20 + + + + + + + + false + + + Position of symbol in Structured Append sequence +Value ranges from 1 to count +(ignored if disabled) + + + Inde&x: + + + Qt::AlignLeft|Qt::AlignLeading|Qt::AlignVCenter + + + cmbMaxiStructAppIndex + + + + + + + false + + + + 0 + 0 + + + + Position of symbol in Structured Append sequence +Value ranges from 1 to count +(ignored if disabled) + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + + + + Qt::Horizontal + + + + 10 + 20 + + + + + + + + false + + + Structured Append ID not available for MaxiCode + + + ID: + + + Qt::AlignLeft|Qt::AlignLeading|Qt::AlignVCenter + + + txtMaxiStructAppIDDisabled + + + + + + + false + + + + 0 + 0 + + + + Structured Append ID not available for MaxiCode + + + N/A + + + + + + diff --git a/frontend_qt/grpMicroPDF.ui b/frontend_qt/grpMicroPDF.ui index dd27e0b3..32edf2c1 100644 --- a/frontend_qt/grpMicroPDF.ui +++ b/frontend_qt/grpMicroPDF.ui @@ -27,6 +27,9 @@ &Number of Data Columns: + + Set number of data characters in a row + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter @@ -37,6 +40,9 @@ + + Set number of data characters in a row + Automatic @@ -71,6 +77,9 @@ Encoding Mode + + How to process data + QLayout::SetMinimumSize @@ -80,6 +89,9 @@ S&tandard Mode + + Process data as normal + true @@ -90,6 +102,151 @@ H&IBC MicroPDF417 + + Process data as a Health Industry Barcode (HIBC) +Labeler Identification Code (LIC) +For Provider Applications Standard (PAS), preface +the data with a slash "/" + + + + + + + + + + Structured Append + + + MicroPDF417 supports Structured Append of up to +99,999 symbols + + + + + + C&ount: + + + Qt::AlignLeft|Qt::AlignLeading|Qt::AlignVCenter + + + spnMPDFStructAppCount + + + Mark symbol as part of a Structured Append sequence +containing a total of this number of symbols +Value ranges from 1 (Disabled) to 99999 + + + + + + + Mark symbol as part of a Structured Append sequence +containing a total of this number of symbols +Value ranges from 1 (Disabled) to 99999 + + + 1 (Disabled) + + + 1 + + + 99999 + + + 1 + + + + + + + Qt::Horizontal + + + + + + + false + + + Inde&x: + + + Qt::AlignLeft|Qt::AlignLeading|Qt::AlignVCenter + + + spnMPDFStructAppIndex + + + Position of symbol in Structured Append sequence +Value ranges from 1 to count +(ignored if disabled) + + + + + + + false + + + Position of symbol in Structured Append sequence +Value ranges from 1 to count +(ignored if disabled) + + + 1 + + + 99999 + + + 1 + + + + + + + false + + + Optional ID to indicate that symbols belong to the same +Structured Append sequence +Numbers only, in triplets, maximum length 30 (10 triplets) +(ignored if disabled) + + + I&D: + + + Qt::AlignLeft|Qt::AlignLeading|Qt::AlignVCenter + + + txtMPDFStructAppID + + + + + + + false + + + 30 + + + Optional ID to indicate that symbols belong to the same +Structured Append sequence +Numbers only, in triplets, maximum length 30 (10 triplets) +(ignored if disabled) + diff --git a/frontend_qt/grpPDF417.ui b/frontend_qt/grpPDF417.ui index f61e429a..ae8c270e 100644 --- a/frontend_qt/grpPDF417.ui +++ b/frontend_qt/grpPDF417.ui @@ -26,6 +26,9 @@ &Number of Data Columns: + + Set number of data characters in a row + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter @@ -36,6 +39,9 @@ + + Set number of data characters in a row + Automatic @@ -141,6 +147,56 @@ 20 + + + 21 + + + + + 22 + + + + + 23 + + + + + 24 + + + + + 25 + + + + + 26 + + + + + 27 + + + + + 28 + + + + + 29 + + + + + 30 + + @@ -148,6 +204,9 @@ E&rror Correction Capacity: + + Set number of error correction characters + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter @@ -158,6 +217,9 @@ + + Set number of error correction characters + Automatic @@ -217,6 +279,9 @@ Encoding Mode + + How to process data + QLayout::SetMinimumSize @@ -226,6 +291,9 @@ S&tandard Mode + + Process data as normal + true @@ -236,6 +304,12 @@ H&IBC PDF417 + + Process data as a Health Industry Barcode (HIBC) +Labeler Identification Code (LIC) +For Provider Applications Standard (PAS), preface +the data with a slash "/" + @@ -243,6 +317,151 @@ &Compact PDF417 + + Compact PDF417 (Truncated PDF417) mode omits the +right row indicators and shortens the stop pattern + + + + + + + + + + Structured Append + + + PDF417 supports Structured Append of up to +99,999 symbols + + + + + + C&ount: + + + Qt::AlignLeft|Qt::AlignLeading|Qt::AlignVCenter + + + spnPDFStructAppCount + + + Mark symbol as part of a Structured Append sequence +containing a total of this number of symbols +Value ranges from 1 (Disabled) to 99999 + + + + + + + Mark symbol as part of a Structured Append sequence +containing a total of this number of symbols +Value ranges from 1 (Disabled) to 99999 + + + 1 (Disabled) + + + 1 + + + 99999 + + + 1 + + + + + + + Qt::Horizontal + + + + + + + false + + + Inde&x: + + + Qt::AlignLeft|Qt::AlignLeading|Qt::AlignVCenter + + + spnPDFStructAppIndex + + + Position of symbol in Structured Append sequence +Value ranges from 1 to count +(ignored if disabled) + + + + + + + false + + + Position of symbol in Structured Append sequence +Value ranges from 1 to count +(ignored if disabled) + + + 1 + + + 99999 + + + 1 + + + + + + + false + + + Optional ID to indicate that symbols belong to the same +Structured Append sequence +Numbers only, in triplets ranging from 000 to 899 +Maximum length 30 (10 triplets) +(ignored if disabled) + + + I&D: + + + Qt::AlignLeft|Qt::AlignLeading|Qt::AlignVCenter + + + txtPDFStructAppID + + + + + + + false + + + 30 + + + Optional ID to indicate that symbols belong to the same +Structured Append sequence +Numbers only, in triplets ranging from 000 to 899 +Maximum length 30 (10 triplets) +(ignored if disabled) + diff --git a/frontend_qt/grpQR.ui b/frontend_qt/grpQR.ui index 2c472595..3f3bbc0c 100644 --- a/frontend_qt/grpQR.ui +++ b/frontend_qt/grpQR.ui @@ -27,6 +27,9 @@ Si&ze: + + Set size (version) of symbol + cmbQRSize @@ -37,6 +40,9 @@ 21 + + Set size (version) of symbol + Automatic @@ -249,6 +255,10 @@ E&rror Correction: + + Set percentage of capacity to use for +error correction codewords + cmbQRECC @@ -256,6 +266,10 @@ + + Set percentage of capacity to use for +error correction codewords + Automatic @@ -288,6 +302,9 @@ &Mask: + + Manually specify which mask to use + cmbQRMask @@ -298,6 +315,9 @@ 8 + + Manually specify which mask to use + Automatic @@ -352,6 +372,9 @@ Encoding Mode + + How to process data + QLayout::SetMinimumSize @@ -359,7 +382,10 @@ - S&tandard Mode + S&tandard + + + Process data as normal true @@ -369,15 +395,25 @@ - GS&1 Data Mode + GS&1 Data + + + Process data as GS1 General Specifications data, +formatted with Application Identifiers (AIs) - + H&IBC QR Code + + Process data as a Health Industry Barcode (HIBC) +Labeler Identification Code (LIC) +For Provider Applications Standard (PAS), preface +the data with a slash "/" + @@ -396,6 +432,321 @@ + + + + Structured Append + + + QR Code supports Structured Append of up to +16 symbols + + + + + + C&ount: + + + Qt::AlignLeft|Qt::AlignLeading|Qt::AlignVCenter + + + cmbQRStructAppCount + + + Mark symbol as part of a Structured Append sequence +containing a total of this number of symbols +Value ranges from 2 to 16 + + + + + + + + 0 + 0 + + + + Mark symbol as part of a Structured Append sequence +containing a total of this number of symbols +Value ranges from 2 to 16 + + + + Disabled + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 10 + + + + + 11 + + + + + 12 + + + + + 13 + + + + + 14 + + + + + 15 + + + + + 16 + + + + + + + + Qt::Horizontal + + + + 10 + 20 + + + + + + + + false + + + Inde&x: + + + Qt::AlignLeft|Qt::AlignLeading|Qt::AlignVCenter + + + cmbQRStructAppIndex + + + Position of symbol in Structured Append sequence +Value ranges from 1 to count +(ignored if disabled) + + + + + + + false + + + + 0 + 0 + + + + Position of symbol in Structured Append sequence +Value ranges from 1 to count +(ignored if disabled) + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 10 + + + + + 11 + + + + + 12 + + + + + 13 + + + + + 14 + + + + + 15 + + + + + 16 + + + + + + + + Qt::Horizontal + + + + 10 + 20 + + + + + + + + false + + + ID (parity) to indicate that symbols belong +to the same Structured Append sequence +Value ranges from 0 to 255 +(ignored if disabled) + + + I&D: + + + Qt::AlignLeft|Qt::AlignLeading|Qt::AlignVCenter + + + spnQRStructAppID + + + + + + + false + + + ID (parity) to indicate that symbols belong +to the same Structured Append sequence +Value ranges from 0 to 255 +(ignored if disabled) + + + 0 + + + 255 + + + 0 + + + + + + @@ -407,7 +758,7 @@ 20 - 20 + 0 diff --git a/frontend_qt/grpRMQR.ui b/frontend_qt/grpRMQR.ui index a458ee79..72c2d009 100644 --- a/frontend_qt/grpRMQR.ui +++ b/frontend_qt/grpRMQR.ui @@ -27,6 +27,9 @@ Si&ze: + + Set height and width (H x W) of symbol + cmbRMQRSize @@ -34,6 +37,9 @@ + + Set height and width (H x W) of symbol + 21 @@ -239,6 +245,10 @@ E&rror Correction: + + Set percentage of capacity to use for +error correction codewords + cmbRMQRECC @@ -246,6 +256,10 @@ + + Set percentage of capacity to use for +error correction codewords + Automatic @@ -270,6 +284,9 @@ Encoding Mode + + How to process data + QLayout::SetMinimumSize @@ -279,6 +296,9 @@ S&tandard Mode + + Process data as normal + true @@ -289,6 +309,10 @@ GS&1 Data Mode + + Process data as GS1 General Specifications data, +formatted with Application Identifiers (AIs) + diff --git a/frontend_qt/grpUPCA.ui b/frontend_qt/grpUPCA.ui index 4d238b14..7271609f 100644 --- a/frontend_qt/grpUPCA.ui +++ b/frontend_qt/grpUPCA.ui @@ -78,7 +78,7 @@ Default 5 (ignored if disabled) - G&uard Height: + Guard Bar Des&cent: Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter diff --git a/frontend_qt/grpUPCEAN.ui b/frontend_qt/grpUPCEAN.ui index afdf28ca..150f87d7 100644 --- a/frontend_qt/grpUPCEAN.ui +++ b/frontend_qt/grpUPCEAN.ui @@ -88,7 +88,7 @@ Default 5 (ignored if disabled) - G&uard Bar Descent: + Guard Bar Des&cent: Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter diff --git a/frontend_qt/grpUltra.ui b/frontend_qt/grpUltra.ui index f066a3d9..ff286d4d 100644 --- a/frontend_qt/grpUltra.ui +++ b/frontend_qt/grpUltra.ui @@ -27,6 +27,10 @@ Auto&matic Resizing + + Size and error correction level will be set +based on data + true @@ -37,6 +41,10 @@ E&rror Correction Level: + + Set percentage of capacity to use for +error correction codewords + @@ -47,6 +55,10 @@ 0 + + Set percentage of capacity to use for +error correction codewords + ECO - Error Detection Only @@ -86,6 +98,9 @@ Encoding Mode + + How to process data + QLayout::SetMinimumSize @@ -95,6 +110,9 @@ S&tandard Mode + + Process data as normal + true @@ -105,6 +123,248 @@ GS&1 Data Mode + + Process data as GS1 General Specifications data, +formatted with Application Identifiers (AIs) + + + + + + + + + + Structured Append + + + Ultracode supports Structured Append of up to +8 symbols + + + + + + C&ount: + + + Qt::AlignLeft|Qt::AlignLeading|Qt::AlignVCenter + + + cmbUltraStructAppCount + + + Mark symbol as part of a Structured Append sequence +containing a total of this number of symbols +Value ranges from 2 to 16 + + + + + + + + 0 + 0 + + + + Mark symbol as part of a Structured Append sequence +containing a total of this number of symbols +Value ranges from 2 to 8 + + + + Disabled + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + + + + Qt::Horizontal + + + + 10 + 20 + + + + + + + + false + + + Inde&x: + + + Qt::AlignLeft|Qt::AlignLeading|Qt::AlignVCenter + + + cmbUltraStructAppIndex + + + Position of symbol in Structured Append sequence +Value ranges from 1 to count +(ignored if disabled) + + + + + + + false + + + + 0 + 0 + + + + Position of symbol in Structured Append sequence +Value ranges from 1 to count +(ignored if disabled) + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + + + + Qt::Horizontal + + + + 10 + 20 + + + + + + + + false + + + Optional ID (File Number) to indicate that symbols +belong to the same Structured Append sequence +Value ranges from 1 to 80088 +(ignored if disabled) + + + I&D: + + + Qt::AlignLeft|Qt::AlignLeading|Qt::AlignVCenter + + + spnUltraStructAppID + + + + + + + false + + + Optional ID (File Number) to indicate that symbols +belong to the same Structured Append sequence +Value ranges from 1 to 80088 +(ignored if disabled) + + + None + + + 0 + + + 80088 + + + 0 + diff --git a/frontend_qt/mainwindow.cpp b/frontend_qt/mainwindow.cpp index 8fdfdb83..193d7216 100644 --- a/frontend_qt/mainwindow.cpp +++ b/frontend_qt/mainwindow.cpp @@ -308,14 +308,21 @@ bool MainWindow::save() save_dialog.setAcceptMode(QFileDialog::AcceptSave); save_dialog.setWindowTitle(tr("Save Barcode Image")); - save_dialog.setDirectory(settings.value("studio/default_dir", QDir::toNativeSeparators(QDir::homePath())).toString()); + save_dialog.setDirectory(settings.value("studio/default_dir", + QDir::toNativeSeparators(QDir::homePath())).toString()); #ifdef NO_PNG suffix = settings.value("studio/default_suffix", "gif").toString(); - save_dialog.setNameFilter(tr("Encapsulated PostScript (*.eps);;Graphics Interchange Format (*.gif);;Scalable Vector Graphic (*.svg);;Windows Bitmap (*.bmp);;ZSoft PC Painter Image (*.pcx);;Enhanced Metafile (*.emf);;Tagged Image File Format (*.tif)")); + save_dialog.setNameFilter(tr( + "Encapsulated PostScript (*.eps);;Graphics Interchange Format (*.gif)" + ";;Scalable Vector Graphic (*.svg);;Windows Bitmap (*.bmp);;ZSoft PC Painter Image (*.pcx)" + ";;Enhanced Metafile (*.emf);;Tagged Image File Format (*.tif)")); #else suffix = settings.value("studio/default_suffix", "png").toString(); - save_dialog.setNameFilter(tr("Portable Network Graphic (*.png);;Encapsulated PostScript (*.eps);;Graphics Interchange Format (*.gif);;Scalable Vector Graphic (*.svg);;Windows Bitmap (*.bmp);;ZSoft PC Painter Image (*.pcx);;Enhanced Metafile (*.emf);;Tagged Image File Format (*.tif)")); + save_dialog.setNameFilter(tr( + "Portable Network Graphic (*.png);;Encapsulated PostScript (*.eps);;Graphics Interchange Format (*.gif)" + ";;Scalable Vector Graphic (*.svg);;Windows Bitmap (*.bmp);;ZSoft PC Painter Image (*.pcx)" + ";;Enhanced Metafile (*.emf);;Tagged Image File Format (*.tif)")); #endif if (QString::compare(suffix, "png", Qt::CaseInsensitive) == 0) @@ -378,7 +385,8 @@ void MainWindow::about() /* This is a test release */ version_release = version_release / 10; version_build = lib_version % 10; - QTextStream(&zint_version) << version_major << "." << version_minor << "." << version_release << "." << version_build << " (dev)"; + QTextStream(&zint_version) << version_major << "." << version_minor << "." << version_release + << "." << version_build << " (dev)"; } else { /* This is a stable release */ QTextStream(&zint_version) << version_major << "." << version_minor << "." << version_release; @@ -488,6 +496,79 @@ void MainWindow::dotty_ui_set() } } +void MainWindow::structapp_ui_set() +{ + int symbology = bstyle_items[bstyle->currentIndex()].symbology; + QString name; + bool enabled = false; + QWidget *widgetCount = NULL, *widgetIndex = NULL; + QLabel *lblID2 = NULL; + QWidget *widgetID = NULL, *widgetID2 = NULL; + + if (symbology == BARCODE_AZTEC) { + name = "Aztec"; + widgetID = m_optionWidget->findChild("txt" + name + "StructAppID"); + } else if (symbology == BARCODE_CODEONE) { + name = "C1"; + QSpinBox *spnCount = m_optionWidget->findChild("spn" + name + "StructAppCount"); + enabled = spnCount ? spnCount->value() > 1 : false; + widgetCount = spnCount; + widgetIndex = m_optionWidget->findChild("spn" + name + "StructAppIndex"); + } else if (symbology == BARCODE_DATAMATRIX) { + name = "DM"; + widgetID = m_optionWidget->findChild("spn" + name + "StructAppID"); + widgetID2 = m_optionWidget->findChild("spn" + name + "StructAppID2"); + } else if (symbology == BARCODE_DOTCODE) { + name = "Dot"; + } else if (symbology == BARCODE_MAXICODE) { + name = "Maxi"; + } else if (symbology == BARCODE_PDF417 || symbology == BARCODE_MICROPDF417) { + name = symbology == BARCODE_PDF417 ? "PDF" : "MPDF"; + QSpinBox *spnCount = m_optionWidget->findChild("spn" + name + "StructAppCount"); + enabled = spnCount ? spnCount->value() > 1 : false; + widgetCount = spnCount; + widgetIndex = m_optionWidget->findChild("spn" + name + "StructAppIndex"); + widgetID = m_optionWidget->findChild("txt" + name + "StructAppID"); + } else if (symbology == BARCODE_QRCODE) { + name = "QR"; + widgetID = m_optionWidget->findChild("spn" + name + "StructAppID"); + } else if (symbology == BARCODE_GRIDMATRIX) { + name = "Grid"; + widgetID = m_optionWidget->findChild("spn" + name + "StructAppID"); + } else if (symbology == BARCODE_ULTRA) { + name = "Ultra"; + widgetID = m_optionWidget->findChild("spn" + name + "StructAppID"); + } + if (!name.isEmpty()) { + QLabel *lblIndex = m_optionWidget->findChild("lbl" + name + "StructAppIndex"); + if (!widgetCount) { + QComboBox *cmbCount = m_optionWidget->findChild("cmb" + name + "StructAppCount"); + enabled = cmbCount ? cmbCount->currentIndex() != 0 : false; + widgetCount = cmbCount; + } + if (!widgetIndex) { + widgetIndex = m_optionWidget->findChild("cmb" + name + "StructAppIndex"); + } + if (lblIndex && widgetCount && widgetIndex) { + lblIndex->setEnabled(enabled); + widgetIndex->setEnabled(enabled); + QLabel *lblID = m_optionWidget->findChild("lbl" + name + "StructAppID"); + if (lblID) { + lblID->setEnabled(enabled); + if (lblID2) { + lblID2->setEnabled(enabled); + } + } + if (widgetID) { + widgetID->setEnabled(enabled); + if (widgetID2) { + widgetID2->setEnabled(enabled); + } + } + } + } +} + void MainWindow::on_encoded() { if (!chkAutoHeight->isEnabled() || chkAutoHeight->isChecked()) { @@ -499,7 +580,8 @@ void MainWindow::on_encoded() void MainWindow::filter_symbologies() { - QString filter = filter_bstyle->text().simplified(); /* `simplified()` trims and reduces inner whitespace to a single space - nice! */ + // `simplified()` trims and reduces inner whitespace to a single space - nice! + QString filter = filter_bstyle->text().simplified(); QListView *lview = qobject_cast(bstyle->view()); QStandardItemModel *model = qobject_cast(bstyle->model()); QStandardItem *item; @@ -639,11 +721,11 @@ void MainWindow::change_options() chkComposite->setText(tr("Add &2D Component (GS1-128 only)")); combobox_item_enabled(cmbCompType, 3, true); // CC-C set_smaller_font(m_optionWidget->findChild("noteC128CompositeEAN")); - connect(m_optionWidget->findChild("radC128EAN"), SIGNAL(toggled( bool )), SLOT(composite_ean_check())); - connect(m_optionWidget->findChild("radC128Stand"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radC128CSup"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radC128EAN"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radC128HIBC"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("radC128EAN"), SIGNAL(toggled( bool )), SLOT(composite_ean_check())); + connect(widget_obj("radC128Stand"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("radC128CSup"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("radC128EAN"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("radC128HIBC"), SIGNAL(clicked( bool )), SLOT(update_preview())); } else if (symbology == BARCODE_PDF417) { QFile file(":/grpPDF417.ui"); @@ -652,11 +734,15 @@ void MainWindow::change_options() m_optionWidget = uiload.load(&file); file.close(); tabMain->insertTab(1, m_optionWidget, tr("PDF41&7")); - connect(m_optionWidget->findChild("cmbPDFECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("cmbPDFCols"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radPDFTruncated"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radPDFStand"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radPDFHIBC"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("cmbPDFECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("cmbPDFCols"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("radPDFTruncated"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("radPDFStand"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("radPDFHIBC"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("spnPDFStructAppCount"), SIGNAL(valueChanged( int )), SLOT(update_preview())); + connect(widget_obj("spnPDFStructAppCount"), SIGNAL(valueChanged( int )), SLOT(structapp_ui_set())); + connect(widget_obj("spnPDFStructAppIndex"), SIGNAL(valueChanged( int )), SLOT(update_preview())); + connect(widget_obj("txtPDFStructAppID"), SIGNAL(textChanged( const QString& )), SLOT(update_preview())); } else if (symbology == BARCODE_MICROPDF417) { QFile file(":/grpMicroPDF.ui"); @@ -665,8 +751,12 @@ void MainWindow::change_options() m_optionWidget = uiload.load(&file); file.close(); tabMain->insertTab(1, m_optionWidget, tr("Micro PDF41&7")); - connect(m_optionWidget->findChild("cmbMPDFCols"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radMPDFStand"), SIGNAL(toggled( bool )), SLOT(update_preview())); + connect(widget_obj("cmbMPDFCols"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("radMPDFStand"), SIGNAL(toggled( bool )), SLOT(update_preview())); + connect(widget_obj("spnMPDFStructAppCount"), SIGNAL(valueChanged( int )), SLOT(update_preview())); + connect(widget_obj("spnMPDFStructAppCount"), SIGNAL(valueChanged( int )), SLOT(structapp_ui_set())); + connect(widget_obj("spnMPDFStructAppIndex"), SIGNAL(valueChanged( int )), SLOT(update_preview())); + connect(widget_obj("txtMPDFStructAppID"), SIGNAL(textChanged( const QString& )), SLOT(update_preview())); } else if (symbology == BARCODE_DOTCODE) { QFile file(":/grpDotCode.ui"); @@ -675,10 +765,13 @@ void MainWindow::change_options() m_optionWidget = uiload.load(&file); file.close(); tabMain->insertTab(1, m_optionWidget, tr("DotCod&e")); - connect(m_optionWidget->findChild("cmbDotCols"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("cmbDotMask"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radDotStand"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radDotGS1"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("cmbDotCols"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("cmbDotMask"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("radDotStand"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("radDotGS1"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("cmbDotStructAppCount"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("cmbDotStructAppCount"), SIGNAL(currentIndexChanged( int )), SLOT(structapp_ui_set())); + connect(widget_obj("cmbDotStructAppIndex"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); } else if (symbology == BARCODE_AZTEC) { QFile file(":/grpAztec.ui"); @@ -687,14 +780,18 @@ void MainWindow::change_options() m_optionWidget = uiload.load(&file); file.close(); tabMain->insertTab(1, m_optionWidget, tr("Aztec Cod&e")); - connect(m_optionWidget->findChild("radAztecAuto"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radAztecSize"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radAztecECC"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("cmbAztecSize"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("cmbAztecECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radAztecStand"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radAztecGS1"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radAztecHIBC"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("radAztecAuto"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("radAztecSize"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("radAztecECC"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("cmbAztecSize"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("cmbAztecECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("radAztecStand"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("radAztecGS1"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("radAztecHIBC"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("cmbAztecStructAppCount"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("cmbAztecStructAppCount"), SIGNAL(currentIndexChanged( int )), SLOT(structapp_ui_set())); + connect(widget_obj("cmbAztecStructAppIndex"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("txtAztecStructAppID"), SIGNAL(textChanged( const QString& )), SLOT(update_preview())); } else if (symbology == BARCODE_MSI_PLESSEY) { QFile file(":/grpMSICheck.ui"); @@ -703,9 +800,9 @@ void MainWindow::change_options() m_optionWidget = uiload.load(&file); file.close(); tabMain->insertTab(1, m_optionWidget, tr("MSI Pless&ey")); - connect(m_optionWidget->findChild("cmbMSICheck"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("cmbMSICheck"), SIGNAL(currentIndexChanged( int )), SLOT(msi_plessey_ui_set())); - connect(m_optionWidget->findChild("chkMSICheckText"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("cmbMSICheck"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("cmbMSICheck"), SIGNAL(currentIndexChanged( int )), SLOT(msi_plessey_ui_set())); + connect(widget_obj("chkMSICheckText"), SIGNAL(clicked( bool )), SLOT(update_preview())); } else if (symbology == BARCODE_CODE11) { QFile file(":/grpC11.ui"); @@ -714,9 +811,9 @@ void MainWindow::change_options() m_optionWidget = uiload.load(&file); file.close(); tabMain->insertTab(1, m_optionWidget, tr("Cod&e 11")); - connect(m_optionWidget->findChild("radC11TwoCheckDigits"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radC11OneCheckDigit"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radC11NoCheckDigits"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("radC11TwoCheckDigits"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("radC11OneCheckDigit"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("radC11NoCheckDigits"), SIGNAL(clicked( bool )), SLOT(update_preview())); } else if (symbology == BARCODE_C25STANDARD || symbology == BARCODE_C25INTER || symbology == BARCODE_C25IATA || symbology == BARCODE_C25LOGIC || symbology == BARCODE_C25IND) { @@ -724,12 +821,14 @@ void MainWindow::change_options() if (file.open(QIODevice::ReadOnly)) { m_optionWidget = uiload.load(&file); file.close(); - static const char *names[] = { "Standard (Matrix)", "Interleaved", "IATA", "", "Data Logic", "Industrial" }; + static const char *names[] = { + "Standard (Matrix)", "Interleaved", "IATA", "", "Data Logic", "Industrial" + }; /*: %1 is name of variant (Standard, Interleaved, IATA, Data Logic, Industrial) */ tabMain->insertTab(1, m_optionWidget, tr("Cod&e 2 of 5 %1").arg(names[symbology - BARCODE_C25STANDARD])); - connect(m_optionWidget->findChild("radC25Stand"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radC25Check"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radC25CheckHide"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("radC25Stand"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("radC25Check"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("radC25CheckHide"), SIGNAL(clicked( bool )), SLOT(update_preview())); } } else if (symbology == BARCODE_CODE39 || symbology == BARCODE_EXCODE39) { @@ -738,9 +837,9 @@ void MainWindow::change_options() return; m_optionWidget = uiload.load(&file); file.close(); - connect(m_optionWidget->findChild("radC39Stand"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radC39Check"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radC39HIBC"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("radC39Stand"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("radC39Check"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("radC39HIBC"), SIGNAL(clicked( bool )), SLOT(update_preview())); if (symbology == BARCODE_EXCODE39) { tabMain->insertTab(1, m_optionWidget, tr("Cod&e 39 Extended")); if (m_optionWidget->findChild("radC39HIBC")->isChecked()) { @@ -760,8 +859,8 @@ void MainWindow::change_options() m_optionWidget = uiload.load(&file); file.close(); tabMain->insertTab(1, m_optionWidget, tr("LOGM&ARS")); - connect(m_optionWidget->findChild("radLOGMARSStand"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radLOGMARSCheck"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("radLOGMARSStand"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("radLOGMARSCheck"), SIGNAL(clicked( bool )), SLOT(update_preview())); } else if (symbology == BARCODE_CODE16K) { QFile file(":/grpC16k.ui"); @@ -771,9 +870,9 @@ void MainWindow::change_options() file.close(); tabMain->insertTab(1, m_optionWidget, tr("Cod&e 16K")); btype->setItemText(0, tr("Default (bind)")); - connect(m_optionWidget->findChild("cmbC16kRowSepHeight"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radC16kStand"), SIGNAL(toggled( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("chkC16kNoQuietZones"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("cmbC16kRowSepHeight"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("radC16kStand"), SIGNAL(toggled( bool )), SLOT(update_preview())); + connect(widget_obj("chkC16kNoQuietZones"), SIGNAL(clicked( bool )), SLOT(update_preview())); } else if (symbology == BARCODE_CODABAR) { QFile file(":/grpCodabar.ui"); @@ -782,7 +881,7 @@ void MainWindow::change_options() m_optionWidget = uiload.load(&file); file.close(); tabMain->insertTab(1, m_optionWidget, tr("Cod&abar")); - connect(m_optionWidget->findChild("chkCodabarCheck"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("chkCodabarCheck"), SIGNAL(clicked( bool )), SLOT(update_preview())); } else if (symbology == BARCODE_CODABLOCKF) { QFile file (":/grpCodablockF.ui"); @@ -792,12 +891,12 @@ void MainWindow::change_options() file.close(); tabMain->insertTab(1, m_optionWidget, tr("Codablock&-F")); btype->setItemText(0, tr("Default (bind)")); - connect(m_optionWidget->findChild("cmbCbfWidth"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("cmbCbfHeight"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("cmbCbfRowSepHeight"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radCbfStand"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radCbfHIBC"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("chkCbfNoQuietZones"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("cmbCbfWidth"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("cmbCbfHeight"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("cmbCbfRowSepHeight"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("radCbfStand"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("radCbfHIBC"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("chkCbfNoQuietZones"), SIGNAL(clicked( bool )), SLOT(update_preview())); } else if (symbology == BARCODE_DAFT) { QFile file(":/grpDAFT.ui"); @@ -806,7 +905,7 @@ void MainWindow::change_options() file.close(); tabMain->insertTab(1, m_optionWidget, tr("DAFT")); set_smaller_font(m_optionWidget->findChild("noteTrackerRatios")); - connect(m_optionWidget->findChild("spnDAFTTrackerRatio"), SIGNAL(valueChanged( double )), SLOT(update_preview())); + connect(widget_obj("spnDAFTTrackerRatio"), SIGNAL(valueChanged( double )), SLOT(update_preview())); } } else if (symbology == BARCODE_DATAMATRIX) { @@ -816,13 +915,18 @@ void MainWindow::change_options() m_optionWidget = uiload.load(&file); file.close(); tabMain->insertTab(1, m_optionWidget, tr("D&ata Matrix")); - connect(m_optionWidget->findChild("radDM200Stand"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radDM200GS1"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radDM200HIBC"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("cmbDM200Size"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("chkDMRectangle"), SIGNAL(stateChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("chkDMRE"), SIGNAL(stateChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("chkDMGSSep"), SIGNAL(stateChanged( int )), SLOT(update_preview())); + connect(widget_obj("radDM200Stand"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("radDM200GS1"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("radDM200HIBC"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("cmbDM200Size"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("chkDMRectangle"), SIGNAL(stateChanged( int )), SLOT(update_preview())); + connect(widget_obj("chkDMRE"), SIGNAL(stateChanged( int )), SLOT(update_preview())); + connect(widget_obj("chkDMGSSep"), SIGNAL(stateChanged( int )), SLOT(update_preview())); + connect(widget_obj("cmbDMStructAppCount"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("cmbDMStructAppCount"), SIGNAL(currentIndexChanged( int )), SLOT(structapp_ui_set())); + connect(widget_obj("cmbDMStructAppIndex"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("spnDMStructAppID"), SIGNAL(valueChanged( int )), SLOT(update_preview())); + connect(widget_obj("spnDMStructAppID2"), SIGNAL(valueChanged( int )), SLOT(update_preview())); } else if (symbology == BARCODE_ITF14) { btype->setItemText(0, tr("Default (box, non-zero width)")); @@ -831,7 +935,7 @@ void MainWindow::change_options() m_optionWidget = uiload.load(&file); file.close(); tabMain->insertTab(1, m_optionWidget, tr("ITF-1&4")); - connect(m_optionWidget->findChild("chkITF14NoQuietZones"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("chkITF14NoQuietZones"), SIGNAL(clicked( bool )), SLOT(update_preview())); } } else if (symbology == BARCODE_QRCODE) { @@ -841,13 +945,17 @@ void MainWindow::change_options() m_optionWidget = uiload.load(&file); file.close(); tabMain->insertTab(1, m_optionWidget, tr("QR Cod&e")); - connect(m_optionWidget->findChild("cmbQRSize"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("cmbQRECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("cmbQRMask"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radQRStand"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radQRGS1"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radQRHIBC"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("chkQRFullMultibyte"), SIGNAL(stateChanged( int )), SLOT(update_preview())); + connect(widget_obj("cmbQRSize"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("cmbQRECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("cmbQRMask"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("radQRStand"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("radQRGS1"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("radQRHIBC"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("chkQRFullMultibyte"), SIGNAL(stateChanged( int )), SLOT(update_preview())); + connect(widget_obj("cmbQRStructAppCount"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("cmbQRStructAppCount"), SIGNAL(currentIndexChanged( int )), SLOT(structapp_ui_set())); + connect(widget_obj("cmbQRStructAppIndex"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("spnQRStructAppID"), SIGNAL(valueChanged( int )), SLOT(update_preview())); } else if (symbology == BARCODE_RMQR) { QFile file(":/grpRMQR.ui"); @@ -856,11 +964,11 @@ void MainWindow::change_options() m_optionWidget = uiload.load(&file); file.close(); tabMain->insertTab(1, m_optionWidget, tr("rMQR Cod&e")); - connect(m_optionWidget->findChild("cmbRMQRSize"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("cmbRMQRECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radRMQRStand"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radRMQRGS1"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("chkRMQRFullMultibyte"), SIGNAL(stateChanged( int )), SLOT(update_preview())); + connect(widget_obj("cmbRMQRSize"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("cmbRMQRECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("radRMQRStand"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("radRMQRGS1"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("chkRMQRFullMultibyte"), SIGNAL(stateChanged( int )), SLOT(update_preview())); } else if (symbology == BARCODE_HANXIN) { QFile file(":/grpHX.ui"); @@ -870,10 +978,10 @@ void MainWindow::change_options() file.close(); tabMain->insertTab(1, m_optionWidget, tr("Han Xin Cod&e")); cmbECI->setItemText(25, tr("29: GB 18030 (PRC)")); - connect(m_optionWidget->findChild("cmbHXSize"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("cmbHXECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("cmbHXMask"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("chkHXFullMultibyte"), SIGNAL(stateChanged( int )), SLOT(update_preview())); + connect(widget_obj("cmbHXSize"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("cmbHXECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("cmbHXMask"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("chkHXFullMultibyte"), SIGNAL(stateChanged( int )), SLOT(update_preview())); } else if (symbology == BARCODE_MICROQR) { QFile file(":/grpMQR.ui"); @@ -882,10 +990,10 @@ void MainWindow::change_options() m_optionWidget = uiload.load(&file); file.close(); tabMain->insertTab(1, m_optionWidget, tr("Micro QR Cod&e")); - connect(m_optionWidget->findChild("cmbMQRSize"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("cmbMQRECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("cmbMQRMask"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("chkMQRFullMultibyte"), SIGNAL(stateChanged( int )), SLOT(update_preview())); + connect(widget_obj("cmbMQRSize"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("cmbMQRECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("cmbMQRMask"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("chkMQRFullMultibyte"), SIGNAL(stateChanged( int )), SLOT(update_preview())); } else if (symbology == BARCODE_GRIDMATRIX) { QFile file(":/grpGrid.ui"); @@ -895,9 +1003,13 @@ void MainWindow::change_options() file.close(); tabMain->insertTab(1, m_optionWidget, tr("Grid M&atrix")); set_smaller_font(m_optionWidget->findChild("noteGridECC")); - connect(m_optionWidget->findChild("cmbGridSize"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("cmbGridECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("chkGridFullMultibyte"), SIGNAL(stateChanged( int )), SLOT(update_preview())); + connect(widget_obj("cmbGridSize"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("cmbGridECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("chkGridFullMultibyte"), SIGNAL(stateChanged( int )), SLOT(update_preview())); + connect(widget_obj("cmbGridStructAppCount"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("cmbGridStructAppCount"), SIGNAL(currentIndexChanged( int )), SLOT(structapp_ui_set())); + connect(widget_obj("cmbGridStructAppIndex"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("spnGridStructAppID"), SIGNAL(valueChanged( int )), SLOT(update_preview())); } else if (symbology == BARCODE_MAXICODE) { QFile file(":/grpMaxicode.ui"); @@ -906,14 +1018,17 @@ void MainWindow::change_options() m_optionWidget = uiload.load(&file); file.close(); tabMain->insertTab(1, m_optionWidget, tr("MaxiCod&e")); - connect(m_optionWidget->findChild("cmbMaxiMode"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("cmbMaxiMode"), SIGNAL(currentIndexChanged( int )), SLOT(maxi_scm())); - connect(m_optionWidget->findChild("txtMaxiSCMPostcode"), SIGNAL(textChanged( const QString& )), SLOT(update_preview())); - connect(m_optionWidget->findChild("spnMaxiSCMCountry"), SIGNAL(valueChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("spnMaxiSCMService"), SIGNAL(valueChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("chkMaxiSCMVV"), SIGNAL(stateChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("chkMaxiSCMVV"), SIGNAL(stateChanged( int )), SLOT(maxi_scm())); - connect(m_optionWidget->findChild("spnMaxiSCMVV"), SIGNAL(valueChanged( int )), SLOT(update_preview())); + connect(widget_obj("cmbMaxiMode"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("cmbMaxiMode"), SIGNAL(currentIndexChanged( int )), SLOT(maxi_scm())); + connect(widget_obj("txtMaxiSCMPostcode"), SIGNAL(textChanged( const QString& )), SLOT(update_preview())); + connect(widget_obj("spnMaxiSCMCountry"), SIGNAL(valueChanged( int )), SLOT(update_preview())); + connect(widget_obj("spnMaxiSCMService"), SIGNAL(valueChanged( int )), SLOT(update_preview())); + connect(widget_obj("chkMaxiSCMVV"), SIGNAL(stateChanged( int )), SLOT(update_preview())); + connect(widget_obj("chkMaxiSCMVV"), SIGNAL(stateChanged( int )), SLOT(maxi_scm())); + connect(widget_obj("spnMaxiSCMVV"), SIGNAL(valueChanged( int )), SLOT(update_preview())); + connect(widget_obj("cmbMaxiStructAppCount"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("cmbMaxiStructAppCount"), SIGNAL(currentIndexChanged( int )), SLOT(structapp_ui_set())); + connect(widget_obj("cmbMaxiStructAppIndex"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); } else if (symbology == BARCODE_CHANNEL) { QFile file(":/grpChannel.ui"); @@ -922,7 +1037,7 @@ void MainWindow::change_options() m_optionWidget = uiload.load(&file); file.close(); tabMain->insertTab(1, m_optionWidget, tr("Channel Cod&e")); - connect(m_optionWidget->findChild("cmbChannel"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("cmbChannel"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); } else if (symbology == BARCODE_CODEONE) { QFile file(":/grpCodeOne.ui"); @@ -931,8 +1046,11 @@ void MainWindow::change_options() m_optionWidget = uiload.load(&file); file.close(); tabMain->insertTab(1, m_optionWidget, tr("Code On&e")); - connect(m_optionWidget->findChild("cmbC1Size"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radC1GS1"), SIGNAL(toggled( bool )), SLOT(update_preview())); + connect(widget_obj("cmbC1Size"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("radC1GS1"), SIGNAL(toggled( bool )), SLOT(update_preview())); + connect(widget_obj("spnC1StructAppCount"), SIGNAL(valueChanged( int )), SLOT(update_preview())); + connect(widget_obj("spnC1StructAppCount"), SIGNAL(valueChanged( int )), SLOT(structapp_ui_set())); + connect(widget_obj("spnC1StructAppIndex"), SIGNAL(valueChanged( int )), SLOT(update_preview())); } else if (symbology == BARCODE_CODE49) { QFile file(":/grpC49.ui"); @@ -942,9 +1060,9 @@ void MainWindow::change_options() file.close(); tabMain->insertTab(1, m_optionWidget, tr("Cod&e 49")); btype->setItemText(0, tr("Default (bind)")); - connect(m_optionWidget->findChild("cmbC49RowSepHeight"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radC49GS1"), SIGNAL(toggled( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("chkC49NoQuietZones"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("cmbC49RowSepHeight"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("radC49GS1"), SIGNAL(toggled( bool )), SLOT(update_preview())); + connect(widget_obj("chkC49NoQuietZones"), SIGNAL(clicked( bool )), SLOT(update_preview())); } else if (symbology == BARCODE_CODE93) { QFile file(":/grpC93.ui"); @@ -952,7 +1070,7 @@ void MainWindow::change_options() m_optionWidget = uiload.load(&file); file.close(); tabMain->insertTab(1, m_optionWidget, tr("Cod&e 93")); - connect(m_optionWidget->findChild("chkC93ShowChecks"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("chkC93ShowChecks"), SIGNAL(clicked( bool )), SLOT(update_preview())); } } else if (symbology == BARCODE_DBAR_EXPSTK) { @@ -962,7 +1080,7 @@ void MainWindow::change_options() m_optionWidget = uiload.load(&file); file.close(); tabMain->insertTab(1, m_optionWidget, tr("GS1 DataBar Stack&ed")); - connect(m_optionWidget->findChild("cmbCols"), SIGNAL(currentIndexChanged ( int )), SLOT(update_preview())); + connect(widget_obj("cmbCols"), SIGNAL(currentIndexChanged ( int )), SLOT(update_preview())); } else if (symbology == BARCODE_ULTRA) { QFile file(":/grpUltra.ui"); @@ -971,11 +1089,15 @@ void MainWindow::change_options() m_optionWidget = uiload.load(&file); file.close(); tabMain->insertTab(1, m_optionWidget, tr("Ultracod&e")); - connect(m_optionWidget->findChild("radUltraAuto"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radUltraEcc"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("cmbUltraEcc"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radUltraStand"), SIGNAL(clicked( bool )), SLOT(update_preview())); - connect(m_optionWidget->findChild("radUltraGS1"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("radUltraAuto"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("radUltraEcc"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("cmbUltraEcc"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("radUltraStand"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("radUltraGS1"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("cmbUltraStructAppCount"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("cmbUltraStructAppCount"), SIGNAL(currentIndexChanged( int )), SLOT(structapp_ui_set())); + connect(widget_obj("cmbUltraStructAppIndex"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("spnUltraStructAppID"), SIGNAL(valueChanged( int )), SLOT(update_preview())); } else if (symbology == BARCODE_UPCA || symbology == BARCODE_UPCA_CHK || symbology == BARCODE_UPCA_CC) { QFile file(":/grpUPCA.ui"); @@ -988,9 +1110,9 @@ void MainWindow::change_options() if (cmbFontSetting->currentIndex() == 1) { cmbFontSetting->setCurrentIndex(0); } - connect(m_optionWidget->findChild("cmbUPCAAddonGap"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("spnUPCAGuardDescent"), SIGNAL(valueChanged( double )), SLOT(update_preview())); - connect(m_optionWidget->findChild("chkUPCANoQuietZones"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("cmbUPCAAddonGap"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("spnUPCAGuardDescent"), SIGNAL(valueChanged( double )), SLOT(update_preview())); + connect(widget_obj("chkUPCANoQuietZones"), SIGNAL(clicked( bool )), SLOT(update_preview())); } else if (symbology == BARCODE_EANX || symbology == BARCODE_EANX_CHK || symbology == BARCODE_EANX_CC || symbology == BARCODE_UPCE || symbology == BARCODE_UPCE_CHK || symbology == BARCODE_UPCE_CC @@ -1011,9 +1133,9 @@ void MainWindow::change_options() if (cmbFontSetting->currentIndex() == 1) { cmbFontSetting->setCurrentIndex(0); } - connect(m_optionWidget->findChild("cmbUPCEANAddonGap"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); - connect(m_optionWidget->findChild("spnUPCEANGuardDescent"), SIGNAL(valueChanged( double )), SLOT(update_preview())); - connect(m_optionWidget->findChild("chkUPCEANNoQuietZones"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("cmbUPCEANAddonGap"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(widget_obj("spnUPCEANGuardDescent"), SIGNAL(valueChanged( double )), SLOT(update_preview())); + connect(widget_obj("chkUPCEANNoQuietZones"), SIGNAL(clicked( bool )), SLOT(update_preview())); } else if (symbology == BARCODE_VIN) { QFile file(":/grpVIN.ui"); @@ -1022,7 +1144,7 @@ void MainWindow::change_options() m_optionWidget = uiload.load(&file); file.close(); tabMain->insertTab(1, m_optionWidget, tr("&VIN")); - connect(m_optionWidget->findChild("chkVINImportChar"), SIGNAL(clicked( bool )), SLOT(update_preview())); + connect(widget_obj("chkVINImportChar"), SIGNAL(clicked( bool )), SLOT(update_preview())); } switch (symbology) { @@ -1043,7 +1165,8 @@ void MainWindow::change_options() break; } - cmbECI->setEnabled(m_bc.bc.supportsECI(symbology)); /* Will need checking again in update_preview() as encoding mode dependent (HIBC) */ + // ECI will need checking again in update_preview() as encoding mode dependent (HIBC) + cmbECI->setEnabled(m_bc.bc.supportsECI(symbology)); chkGS1Parens->setEnabled(m_bc.bc.supportsGS1(symbology)); /* Ditto (GS1) */ chkGS1NoCheck->setEnabled(m_bc.bc.supportsGS1(symbology)); /* Ditto (GS1) */ chkRInit->setEnabled(m_bc.bc.supportsReaderInit(symbology)); /* Ditto (HIBC and GS1) */ @@ -1142,10 +1265,12 @@ void MainWindow::combobox_item_enabled(QComboBox *comboBox, int index, bool enab } } -void MainWindow::upcean_addon_gap(QComboBox *comboBox, QLabel *label, int base) +void MainWindow::upcean_addon_gap(const char *comboBoxName, const char *labelName, int base) { - const QRegularExpression addonRE("^[0-9X]+[+][0-9]+$"); + QComboBox *comboBox = m_optionWidget->findChild(comboBoxName); + QLabel *label = m_optionWidget->findChild(labelName); + const QRegularExpression addonRE("^[0-9X]+[+][0-9]+$"); bool enabled = txtData->text().contains(addonRE); if (comboBox) { comboBox->setEnabled(enabled); @@ -1161,8 +1286,11 @@ void MainWindow::upcean_addon_gap(QComboBox *comboBox, QLabel *label, int base) } } -void MainWindow::upcean_guard_descent(QDoubleSpinBox *spnBox, QLabel *label) +void MainWindow::upcean_guard_descent(const char *spnBoxName, const char *labelName) { + QDoubleSpinBox *spnBox = m_optionWidget->findChild(spnBoxName); + QLabel *label = m_optionWidget->findChild(labelName); + bool enabled = txtData->text().length() > 5; if (spnBox) { spnBox->setEnabled(enabled); @@ -1236,6 +1364,7 @@ void MainWindow::update_preview() m_bc.bc.setGSSep(false); m_bc.bc.setNoQuietZones(false); m_bc.bc.setDotSize(0.4f / 0.5f); + m_bc.bc.clearStructApp(); switch (symbology) { @@ -1263,8 +1392,8 @@ void MainWindow::update_preview() m_bc.bc.setSymbol(BARCODE_EANX_CC); else m_bc.bc.setSymbol(BARCODE_EANX); - upcean_addon_gap(m_optionWidget->findChild("cmbUPCEANAddonGap"), m_optionWidget->findChild("lblUPCEANAddonGap"), 7 /*base*/); - upcean_guard_descent(m_optionWidget->findChild("spnUPCEANGuardDescent"), m_optionWidget->findChild("lblUPCEANGuardDescent")); + upcean_addon_gap("cmbUPCEANAddonGap", "lblUPCEANAddonGap", 7 /*base*/); + upcean_guard_descent("spnUPCEANGuardDescent", "lblUPCEANGuardDescent"); if (get_checkbox_val("chkUPCEANNoQuietZones")) { m_bc.bc.setNoQuietZones(true); } @@ -1272,8 +1401,8 @@ void MainWindow::update_preview() case BARCODE_ISBNX: m_bc.bc.setSymbol(symbology); - upcean_addon_gap(m_optionWidget->findChild("cmbUPCEANAddonGap"), m_optionWidget->findChild("lblUPCEANAddonGap"), 7 /*base*/); - upcean_guard_descent(m_optionWidget->findChild("spnUPCEANGuardDescent"), m_optionWidget->findChild("lblUPCEANGuardDescent")); + upcean_addon_gap("cmbUPCEANAddonGap", "lblUPCEANAddonGap", 7 /*base*/); + upcean_guard_descent("spnUPCEANGuardDescent", "lblUPCEANGuardDescent"); if (get_checkbox_val("chkUPCEANNoQuietZones")) { m_bc.bc.setNoQuietZones(true); } @@ -1284,8 +1413,8 @@ void MainWindow::update_preview() m_bc.bc.setSymbol(BARCODE_UPCA_CC); else m_bc.bc.setSymbol(BARCODE_UPCA); - upcean_addon_gap(m_optionWidget->findChild("cmbUPCAAddonGap"), m_optionWidget->findChild("lblUPCAAddonGap"), 9 /*base*/); - upcean_guard_descent(m_optionWidget->findChild("spnUPCAGuardDescent"), m_optionWidget->findChild("lblUPCAGuardDescent")); + upcean_addon_gap("cmbUPCAAddonGap", "lblUPCAAddonGap", 9 /*base*/); + upcean_guard_descent("spnUPCAGuardDescent", "lblUPCAGuardDescent"); if (get_checkbox_val("chkUPCANoQuietZones")) { m_bc.bc.setNoQuietZones(true); } @@ -1296,8 +1425,8 @@ void MainWindow::update_preview() m_bc.bc.setSymbol(BARCODE_UPCE_CC); else m_bc.bc.setSymbol(BARCODE_UPCE); - upcean_addon_gap(m_optionWidget->findChild("cmbUPCEANAddonGap"), m_optionWidget->findChild("lblUPCEANAddonGap"), 7 /*base*/); - upcean_guard_descent(m_optionWidget->findChild("spnUPCEANGuardDescent"), m_optionWidget->findChild("lblUPCEANGuardDescent")); + upcean_addon_gap("cmbUPCEANAddonGap", "lblUPCEANAddonGap", 7 /*base*/); + upcean_guard_descent("spnUPCEANGuardDescent", "lblUPCEANGuardDescent"); if (get_checkbox_val("chkUPCEANNoQuietZones")) { m_bc.bc.setNoQuietZones(true); } @@ -1358,6 +1487,12 @@ void MainWindow::update_preview() m_bc.bc.setSymbol(BARCODE_HIBC_PDF); else m_bc.bc.setSymbol(BARCODE_PDF417); + + item_val = get_spinbox_val("spnPDFStructAppCount"); + if (item_val > 1) { + m_bc.bc.setStructApp(item_val, get_spinbox_val("spnPDFStructAppIndex"), + get_lineedit_val("txtPDFStructAppID")); + } break; case BARCODE_MICROPDF417: @@ -1367,6 +1502,12 @@ void MainWindow::update_preview() m_bc.bc.setSymbol(BARCODE_HIBC_MICPDF); else m_bc.bc.setSymbol(BARCODE_MICROPDF417); + + item_val = get_spinbox_val("spnMPDFStructAppCount"); + if (item_val > 1) { + m_bc.bc.setStructApp(item_val, get_spinbox_val("spnMPDFStructAppIndex"), + get_lineedit_val("txtMPDFStructAppID")); + } break; case BARCODE_DOTCODE: @@ -1380,19 +1521,31 @@ void MainWindow::update_preview() m_bc.bc.setOption3((item_val << 8) | m_bc.bc.option3()); } set_gs1_mode(m_optionWidget->findChild("radDotGS1")->isChecked()); + + item_val = get_combobox_index("cmbDotStructAppCount"); + if (item_val) { + QString id; // Dummy ID + m_bc.bc.setStructApp(item_val + 1, get_combobox_index("cmbDotStructAppIndex") + 1, id); + } break; case BARCODE_AZTEC: m_bc.bc.setSymbol(BARCODE_AZTEC); - if(m_optionWidget->findChild("radAztecSize")->isChecked()) + if (m_optionWidget->findChild("radAztecSize")->isChecked()) m_bc.bc.setOption2(m_optionWidget->findChild("cmbAztecSize")->currentIndex() + 1); - if(m_optionWidget->findChild("radAztecECC")->isChecked()) + if (m_optionWidget->findChild("radAztecECC")->isChecked()) m_bc.bc.setOption1(m_optionWidget->findChild("cmbAztecECC")->currentIndex() + 1); set_gs1_mode(m_optionWidget->findChild("radAztecGS1")->isChecked()); - if(m_optionWidget->findChild("radAztecHIBC")->isChecked()) + if (m_optionWidget->findChild("radAztecHIBC")->isChecked()) m_bc.bc.setSymbol(BARCODE_HIBC_AZTEC); + + item_val = get_combobox_index("cmbAztecStructAppCount"); + if (item_val) { + m_bc.bc.setStructApp(item_val + 1, get_combobox_index("cmbAztecStructAppIndex") + 1, + get_lineedit_val("txtAztecStructAppID")); + } break; case BARCODE_MSI_PLESSEY: @@ -1419,7 +1572,8 @@ void MainWindow::update_preview() case BARCODE_C25LOGIC: case BARCODE_C25IND: m_bc.bc.setSymbol(symbology); - m_bc.bc.setOption2(get_button_group_index(QStringList() << "radC25Stand" << "radC25Check" << "radC25CheckHide")); + m_bc.bc.setOption2(get_button_group_index( + QStringList() << "radC25Stand" << "radC25Check" << "radC25CheckHide")); break; case BARCODE_CODE39: @@ -1494,11 +1648,12 @@ void MainWindow::update_preview() case BARCODE_DAFT: m_bc.bc.setSymbol(BARCODE_DAFT); - m_bc.bc.setOption2((int) (get_doublespinbox_val("spnDAFTTrackerRatio") * 10)); // Kept as percentage, convert to thousandths + // Kept as percentage, convert to thousandths + m_bc.bc.setOption2((int) (get_doublespinbox_val("spnDAFTTrackerRatio") * 10)); break; case BARCODE_DATAMATRIX: - if(m_optionWidget->findChild("radDM200HIBC")->isChecked()) + if (m_optionWidget->findChild("radDM200HIBC")->isChecked()) m_bc.bc.setSymbol(BARCODE_HIBC_DM); else m_bc.bc.setSymbol(BARCODE_DATAMATRIX); @@ -1521,10 +1676,10 @@ void MainWindow::update_preview() // Supressing rectangles or allowing DMRE only makes sense if in automatic size mode findChild("chkDMRectangle")->setEnabled(true); findChild("chkDMRE")->setEnabled(true); - if(m_optionWidget->findChild("chkDMRectangle")->isChecked()) + if (m_optionWidget->findChild("chkDMRectangle")->isChecked()) m_bc.bc.setOption3(DM_SQUARE); else { - if(m_optionWidget->findChild("chkDMRE")->isChecked()) + if (m_optionWidget->findChild("chkDMRE")->isChecked()) m_bc.bc.setOption3(DM_DMRE); else m_bc.bc.setOption3(0); @@ -1534,6 +1689,15 @@ void MainWindow::update_preview() findChild("chkDMRE")->setEnabled(false); m_bc.bc.setOption3(0); } + + item_val = get_combobox_index("cmbDMStructAppCount"); + if (item_val) { + QString id; + int id1 = get_spinbox_val("spnDMStructAppID"); + int id2 = get_spinbox_val("spnDMStructAppID2"); + m_bc.bc.setStructApp(item_val + 1, get_combobox_index("cmbDMStructAppIndex") + 1, + id.setNum(id1 * 1000 + id2)); + } break; case BARCODE_ITF14: @@ -1566,6 +1730,13 @@ void MainWindow::update_preview() if (m_optionWidget->findChild("chkQRFullMultibyte")->isChecked()) { m_bc.bc.setOption3(ZINT_FULL_MULTIBYTE | m_bc.bc.option3()); } + + item_val = get_combobox_index("cmbQRStructAppCount"); + if (item_val) { + QString id; + int id_val = get_spinbox_val("spnQRStructAppID"); + m_bc.bc.setStructApp(item_val + 1, get_combobox_index("cmbQRStructAppIndex") + 1, id.setNum(id_val)); + } break; case BARCODE_MICROQR: @@ -1618,12 +1789,20 @@ void MainWindow::update_preview() if (m_optionWidget->findChild("chkGridFullMultibyte")->isChecked()) { m_bc.bc.setOption3(ZINT_FULL_MULTIBYTE); } + + item_val = get_combobox_index("cmbGridStructAppCount"); + if (item_val) { + QString id; + int id_val = get_spinbox_val("spnGridStructAppID"); + m_bc.bc.setStructApp(item_val + 1, get_combobox_index("cmbGridStructAppIndex") + 1, + id.setNum(id_val)); + } break; case BARCODE_MAXICODE: m_bc.bc.setSymbol(BARCODE_MAXICODE); if (m_optionWidget->findChild("cmbMaxiMode")->currentIndex() == 0) { - m_bc.bc.setOption1(0); /* Auto-determine mode 2 or 3 from primary message (checks that it isn't empty) */ + m_bc.bc.setOption1(0); // Auto-determine mode 2 or 3 from primary message (checks that it isn't empty) m_bc.bc.setPrimaryMessage(QString::asprintf("%s%03d%03d", get_lineedit_val("txtMaxiSCMPostcode").toUtf8().constData(), get_spinbox_val("spnMaxiSCMCountry"), get_spinbox_val("spnMaxiSCMService"))); @@ -1634,6 +1813,12 @@ void MainWindow::update_preview() } else { m_bc.bc.setOption1(m_optionWidget->findChild("cmbMaxiMode")->currentIndex() + 3); } + + item_val = get_combobox_index("cmbMaxiStructAppCount"); + if (item_val) { + QString id; // Dummy ID + m_bc.bc.setStructApp(item_val + 1, get_combobox_index("cmbMaxiStructAppIndex") + 1, id); + } break; case BARCODE_CHANNEL: @@ -1656,6 +1841,12 @@ void MainWindow::update_preview() m_optionWidget->findChild("radC1GS1")->setEnabled(true); set_gs1_mode(m_optionWidget->findChild("radC1GS1")->isChecked()); } + + item_val = get_spinbox_val("spnC1StructAppCount"); + if (item_val > 1) { + QString id; // Dummy ID + m_bc.bc.setStructApp(item_val, get_spinbox_val("spnC1StructAppIndex"), id); + } break; case BARCODE_CODE49: @@ -1699,9 +1890,17 @@ void MainWindow::update_preview() case BARCODE_ULTRA: m_bc.bc.setSymbol(BARCODE_ULTRA); - if(m_optionWidget->findChild("radUltraEcc")->isChecked()) + if (m_optionWidget->findChild("radUltraEcc")->isChecked()) m_bc.bc.setOption1(m_optionWidget->findChild("cmbUltraEcc")->currentIndex() + 1); set_gs1_mode(m_optionWidget->findChild("radUltraGS1")->isChecked()); + + item_val = get_combobox_index("cmbUltraStructAppCount"); + if (item_val) { + QString id; + int id_val = get_spinbox_val("spnUltraStructAppID"); + m_bc.bc.setStructApp(item_val + 1, get_combobox_index("cmbUltraStructAppIndex") + 1, + id.setNum(id_val)); + } break; case BARCODE_VIN: @@ -1760,6 +1959,11 @@ void MainWindow::update_preview() scene->update(); } +/* Shorthand to find widget child as generic QObject */ +QObject *MainWindow::widget_obj(const char *name) { + return m_optionWidget->findChild(name); +} + /* Return settings subsection name for a symbol */ const char *MainWindow::get_setting_name(int symbology) { struct item { @@ -1920,7 +2124,8 @@ const char *MainWindow::get_setting_name(int symbology) { if (symbology < 0 || symbology >= data_size) { return ""; } - if (ndata[symbology].val != symbology || (ndata[symbology].define != -1 && ndata[symbology].define != symbology)) { // Self-check + if (ndata[symbology].val != symbology || + (ndata[symbology].define != -1 && ndata[symbology].define != symbology)) { // Self-check fprintf(stderr, "MainWindow::get_setting_name: ndata table out of sync (%d)\n", symbology); return ""; } @@ -1942,7 +2147,8 @@ int MainWindow::get_button_group_index(const QStringList &children) { } /* Helper to set radio button in group from index in settings, checking for NULL */ -void MainWindow::set_radiobutton_from_setting(QSettings &settings, const QString &setting, const QStringList &children, int default_val) { +void MainWindow::set_radiobutton_from_setting(QSettings &settings, const QString &setting, + const QStringList &children, int default_val) { if (m_optionWidget) { int index = settings.value(setting, default_val).toInt(); QRadioButton *radioButton; @@ -1964,7 +2170,8 @@ int MainWindow::get_combobox_index(const QString &child) { } /* Helper to set item in combobox from index in settings, checking for NULL */ -void MainWindow::set_combobox_from_setting(QSettings &settings, const QString &setting, const QString &child, int default_val) { +void MainWindow::set_combobox_from_setting(QSettings &settings, const QString &setting, const QString &child, + int default_val) { QComboBox *comboBox = m_optionWidget ? m_optionWidget->findChild(child) : nullptr; if (comboBox) { comboBox->setCurrentIndex(settings.value(setting, default_val).toInt()); @@ -1978,7 +2185,8 @@ int MainWindow::get_checkbox_val(const QString &child) { } /* Helper to set checkbox from settings, checking for NULL */ -void MainWindow::set_checkbox_from_setting(QSettings &settings, const QString &setting, const QString &child, int default_val) { +void MainWindow::set_checkbox_from_setting(QSettings &settings, const QString &setting, const QString &child, + int default_val) { QCheckBox *checkBox = m_optionWidget ? m_optionWidget->findChild(child) : nullptr; if (checkBox) { checkBox->setChecked(settings.value(setting, default_val).toInt() ? true : false); @@ -1992,7 +2200,8 @@ double MainWindow::get_doublespinbox_val(const QString &child) { } /* Helper to set double spinner from settings, checking for NULL */ -void MainWindow::set_doublespinbox_from_setting(QSettings &settings, const QString &setting, const QString &child, float default_val) { +void MainWindow::set_doublespinbox_from_setting(QSettings &settings, const QString &setting, const QString &child, + float default_val) { QDoubleSpinBox *spinBox = m_optionWidget->findChild(child); if (spinBox) { spinBox->setValue(settings.value(setting, default_val).toFloat()); @@ -2006,7 +2215,8 @@ QString MainWindow::get_lineedit_val(const QString &child) { } /* Helper to set line edit from settings, checking for NULL */ -void MainWindow::set_lineedit_from_setting(QSettings &settings, const QString &setting, const QString &child, const char *default_val) { +void MainWindow::set_lineedit_from_setting(QSettings &settings, const QString &setting, const QString &child, + const char *default_val) { QLineEdit *lineEdit = m_optionWidget ? m_optionWidget->findChild(child) : nullptr; if (lineEdit) { lineEdit->setText(settings.value(setting, default_val).toString()); @@ -2020,7 +2230,8 @@ int MainWindow::get_spinbox_val(const QString &child) { } /* Helper to set spin box from settings, checking for NULL */ -void MainWindow::set_spinbox_from_setting(QSettings &settings, const QString &setting, const QString &child, int default_val) { +void MainWindow::set_spinbox_from_setting(QSettings &settings, const QString &setting, const QString &child, + int default_val) { QSpinBox *spinBox = m_optionWidget ? m_optionWidget->findChild(child) : nullptr; if (spinBox) { spinBox->setValue(settings.value(setting, default_val).toInt()); @@ -2049,7 +2260,8 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology) { settings.setValue(QString("studio/bc/%1/chk_gs1parens").arg(name), chkGS1Parens->isChecked() ? 1 : 0); settings.setValue(QString("studio/bc/%1/chk_gs1nocheck").arg(name), chkGS1NoCheck->isChecked() ? 1 : 0); if (chkAutoHeight->isEnabled()) { - settings.setValue(QString("studio/bc/%1/appearance/autoheight").arg(name), chkAutoHeight->isChecked() ? 1 : 0); + settings.setValue( + QString("studio/bc/%1/appearance/autoheight").arg(name), chkAutoHeight->isChecked() ? 1 : 0); settings.setValue(QString("studio/bc/%1/appearance/height").arg(name), heightb->value()); } settings.setValue(QString("studio/bc/%1/appearance/border").arg(name), bwidth->value()); @@ -2058,11 +2270,14 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology) { settings.setValue(QString("studio/bc/%1/appearance/scale").arg(name), spnScale->value()); settings.setValue(QString("studio/bc/%1/appearance/border_type").arg(name), btype->currentIndex()); if (chkHRTShow->isEnabled()) { - settings.setValue(QString("studio/bc/%1/appearance/font_setting").arg(name), cmbFontSetting->currentIndex()); - settings.setValue(QString("studio/bc/%1/appearance/chk_hrt_show").arg(name), chkHRTShow->isChecked() ? 1 : 0); + settings.setValue( + QString("studio/bc/%1/appearance/font_setting").arg(name), cmbFontSetting->currentIndex()); + settings.setValue( + QString("studio/bc/%1/appearance/chk_hrt_show").arg(name), chkHRTShow->isChecked() ? 1 : 0); } settings.setValue(QString("studio/bc/%1/appearance/chk_cmyk").arg(name), chkCMYK->isChecked() ? 1 : 0); - settings.setValue(QString("studio/bc/%1/appearance/chk_quietzones").arg(name), chkQuietZones->isChecked() ? 1 : 0); + settings.setValue( + QString("studio/bc/%1/appearance/chk_quietzones").arg(name), chkQuietZones->isChecked() ? 1 : 0); settings.setValue(QString("studio/bc/%1/appearance/rotate").arg(name), cmbRotate->currentIndex()); if (symbology == BARCODE_DOTCODE || chkDotty->isEnabled()) { settings.setValue(QString("studio/bc/%1/appearance/chk_dotty").arg(name), chkDotty->isChecked() ? 1 : 0); @@ -2084,7 +2299,8 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology) { case BARCODE_GS1_128: case BARCODE_GS1_128_CC: case BARCODE_HIBC_128: - settings.setValue("studio/bc/code128/encoding_mode", get_button_group_index(QStringList() << "radC128Stand" << "radC128EAN" << "radC128CSup" << "radC128HIBC")); + settings.setValue("studio/bc/code128/encoding_mode", get_button_group_index( + QStringList() << "radC128Stand" << "radC128EAN" << "radC128CSup" << "radC128HIBC")); break; case BARCODE_PDF417: @@ -2092,27 +2308,43 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology) { case BARCODE_HIBC_PDF: settings.setValue("studio/bc/pdf417/cols", get_combobox_index("cmbPDFCols")); settings.setValue("studio/bc/pdf417/ecc", get_combobox_index("cmbPDFECC")); - settings.setValue("studio/bc/pdf417/encoding_mode", get_button_group_index(QStringList() << "radPDFStand" << "radPDFTruncated" << "radPDFHIBC")); + settings.setValue("studio/bc/pdf417/encoding_mode", get_button_group_index( + QStringList() << "radPDFStand" << "radPDFTruncated" << "radPDFHIBC")); + settings.setValue("studio/bc/pdf417/structapp_count", get_spinbox_val("spnPDFStructAppCount")); + settings.setValue("studio/bc/pdf417/structapp_index", get_spinbox_val("spnPDFStructAppIndex")); + settings.setValue("studio/bc/pdf417/structapp_id", get_lineedit_val("txtPDFStructAppID")); break; case BARCODE_MICROPDF417: case BARCODE_HIBC_MICPDF: settings.setValue("studio/bc/micropdf417/cols", get_combobox_index("cmbMPDFCols")); - settings.setValue("studio/bc/micropdf417/encoding_mode", get_button_group_index(QStringList() << "radMPDFStand" << "radMPDFHIBC")); + settings.setValue("studio/bc/micropdf417/encoding_mode", get_button_group_index( + QStringList() << "radMPDFStand" << "radMPDFHIBC")); + settings.setValue("studio/bc/micropdf417/structapp_count", get_spinbox_val("spnMPDFStructAppCount")); + settings.setValue("studio/bc/micropdf417/structapp_index", get_spinbox_val("spnMPDFStructAppIndex")); + settings.setValue("studio/bc/micropdf417/structapp_id", get_lineedit_val("txtMPDFStructAppID")); break; case BARCODE_DOTCODE: settings.setValue("studio/bc/dotcode/cols", get_combobox_index("cmbDotCols")); settings.setValue("studio/bc/dotcode/mask", get_combobox_index("cmbDotMask")); - settings.setValue("studio/bc/dotcode/encoding_mode", get_button_group_index(QStringList() << "radDotStand" << "radDotGS1")); + settings.setValue("studio/bc/dotcode/encoding_mode", get_button_group_index( + QStringList() << "radDotStand" << "radDotGS1")); + settings.setValue("studio/bc/dotcode/structapp_count", get_combobox_index("cmbDotStructAppCount")); + settings.setValue("studio/bc/dotcode/structapp_index", get_combobox_index("cmbDotStructAppIndex")); break; case BARCODE_AZTEC: case BARCODE_HIBC_AZTEC: - settings.setValue("studio/bc/aztec/autoresizing", get_button_group_index(QStringList() << "radAztecAuto" << "radAztecSize" << "radAztecECC")); + settings.setValue("studio/bc/aztec/autoresizing", get_button_group_index( + QStringList() << "radAztecAuto" << "radAztecSize" << "radAztecECC")); settings.setValue("studio/bc/aztec/size", get_combobox_index("cmbAztecSize")); settings.setValue("studio/bc/aztec/ecc", get_combobox_index("cmbAztecECC")); - settings.setValue("studio/bc/aztec/encoding_mode", get_button_group_index(QStringList() << "radAztecStand" << "radAztecGS1" << "radAztecHIBC")); + settings.setValue("studio/bc/aztec/encoding_mode", get_button_group_index( + QStringList() << "radAztecStand" << "radAztecGS1" << "radAztecHIBC")); + settings.setValue("studio/bc/aztec/structapp_count", get_combobox_index("cmbAztecStructAppCount")); + settings.setValue("studio/bc/aztec/structapp_index", get_combobox_index("cmbAztecStructAppIndex")); + settings.setValue("studio/bc/aztec/structapp_id", get_lineedit_val("txtAztecStructAppID")); break; case BARCODE_MSI_PLESSEY: @@ -2121,41 +2353,51 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology) { break; case BARCODE_CODE11: - settings.setValue("studio/bc/code11/check_digit", get_button_group_index(QStringList() << "radC11TwoCheckDigits" << "radC11OneCheckDigit" << "radC11NoCheckDigits")); + settings.setValue("studio/bc/code11/check_digit", get_button_group_index( + QStringList() << "radC11TwoCheckDigits" << "radC11OneCheckDigit" << "radC11NoCheckDigits")); break; case BARCODE_C25STANDARD: - settings.setValue("studio/bc/c25standard/check_digit", get_button_group_index(QStringList() << "radC25Stand" << "radC25Check" << "radC25CheckHide")); + settings.setValue("studio/bc/c25standard/check_digit", get_button_group_index( + QStringList() << "radC25Stand" << "radC25Check" << "radC25CheckHide")); break; case BARCODE_C25INTER: - settings.setValue("studio/bc/c25inter/check_digit", get_button_group_index(QStringList() << "radC25Stand" << "radC25Check" << "radC25CheckHide")); + settings.setValue("studio/bc/c25inter/check_digit", get_button_group_index( + QStringList() << "radC25Stand" << "radC25Check" << "radC25CheckHide")); break; case BARCODE_C25IATA: - settings.setValue("studio/bc/c25iata/check_digit", get_button_group_index(QStringList() << "radC25Stand" << "radC25Check" << "radC25CheckHide")); + settings.setValue("studio/bc/c25iata/check_digit", get_button_group_index( + QStringList() << "radC25Stand" << "radC25Check" << "radC25CheckHide")); break; case BARCODE_C25LOGIC: - settings.setValue("studio/bc/c25logic/check_digit", get_button_group_index(QStringList() << "radC25Stand" << "radC25Check" << "radC25CheckHide")); + settings.setValue("studio/bc/c25logic/check_digit", get_button_group_index( + QStringList() << "radC25Stand" << "radC25Check" << "radC25CheckHide")); break; case BARCODE_C25IND: - settings.setValue("studio/bc/c25ind/check_digit", get_button_group_index(QStringList() << "radC25Stand" << "radC25Check" << "radC25CheckHide")); + settings.setValue("studio/bc/c25ind/check_digit", get_button_group_index( + QStringList() << "radC25Stand" << "radC25Check" << "radC25CheckHide")); break; case BARCODE_CODE39: case BARCODE_HIBC_39: - settings.setValue("studio/bc/code39/check_digit", get_button_group_index(QStringList() << "radC39Stand" << "radC39Check" << "radC39HIBC")); + settings.setValue("studio/bc/code39/check_digit", get_button_group_index( + QStringList() << "radC39Stand" << "radC39Check" << "radC39HIBC")); break; case BARCODE_EXCODE39: - settings.setValue("studio/bc/excode39/check_digit", get_button_group_index(QStringList() << "radC39Stand" << "radC39Check")); + settings.setValue("studio/bc/excode39/check_digit", get_button_group_index( + QStringList() << "radC39Stand" << "radC39Check")); break; case BARCODE_LOGMARS: - settings.setValue("studio/bc/logmars/check_digit", get_button_group_index(QStringList() << "radLOGMARSStand" << "radLOGMARSCheck")); + settings.setValue("studio/bc/logmars/check_digit", get_button_group_index( + QStringList() << "radLOGMARSStand" << "radLOGMARSCheck")); break; case BARCODE_CODE16K: settings.setValue("studio/bc/code16k/row_sep_height", get_combobox_index("cmbC16kRowSepHeight")); - settings.setValue("studio/bc/code16k/encoding_mode", get_button_group_index(QStringList() << "radC16kStand" << "radC16kGS1")); + settings.setValue("studio/bc/code16k/encoding_mode", get_button_group_index( + QStringList() << "radC16kStand" << "radC16kGS1")); settings.setValue("studio/bc/code16k/chk_no_quiet_zones", get_checkbox_val("chkC16kNoQuietZones")); break; @@ -2168,21 +2410,28 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology) { settings.setValue("studio/bc/codablockf/width", get_combobox_index("cmbCbfWidth")); settings.setValue("studio/bc/codablockf/height", get_combobox_index("cmbCbfHeight")); settings.setValue("studio/bc/codablockf/row_sep_height", get_combobox_index("cmbCbfRowSepHeight")); - settings.setValue("studio/bc/codablockf/encoding_mode", get_button_group_index(QStringList() << "radCbfStand" << "radCbfHIBC")); + settings.setValue("studio/bc/codablockf/encoding_mode", get_button_group_index( + QStringList() << "radCbfStand" << "radCbfHIBC")); settings.setValue("studio/bc/codablockf/chk_no_quiet_zones", get_checkbox_val("chkCbfNoQuietZones")); break; case BARCODE_DAFT: - settings.setValue("studio/bc/daft/tracker_ratio", QString::number(get_doublespinbox_val("spnDAFTTrackerRatio"), 'f', 1 /*precision*/)); + settings.setValue("studio/bc/daft/tracker_ratio", + QString::number(get_doublespinbox_val("spnDAFTTrackerRatio"), 'f', 1 /*precision*/)); break; case BARCODE_DATAMATRIX: case BARCODE_HIBC_DM: settings.setValue("studio/bc/datamatrix/size", get_combobox_index("cmbDM200Size")); - settings.setValue("studio/bc/datamatrix/encoding_mode", get_button_group_index(QStringList() << "radDM200Stand" << "radDM200GS1" << "radDM200HIBC")); + settings.setValue("studio/bc/datamatrix/encoding_mode", get_button_group_index( + QStringList() << "radDM200Stand" << "radDM200GS1" << "radDM200HIBC")); settings.setValue("studio/bc/datamatrix/chk_suppress_rect", get_checkbox_val("chkDMRectangle")); settings.setValue("studio/bc/datamatrix/chk_allow_dmre", get_checkbox_val("chkDMRE")); settings.setValue("studio/bc/datamatrix/chk_gs_sep", get_checkbox_val("chkDMGSSep")); + settings.setValue("studio/bc/datamatrix/structapp_count", get_combobox_index("cmbDMStructAppCount")); + settings.setValue("studio/bc/datamatrix/structapp_index", get_combobox_index("cmbDMStructAppIndex")); + settings.setValue("studio/bc/datamatrix/structapp_id", get_spinbox_val("spnDMStructAppID")); + settings.setValue("studio/bc/datamatrix/structapp_id2", get_spinbox_val("spnDMStructAppID2")); break; case BARCODE_ITF14: @@ -2194,14 +2443,19 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology) { settings.setValue("studio/bc/qrcode/size", get_combobox_index("cmbQRSize")); settings.setValue("studio/bc/qrcode/ecc", get_combobox_index("cmbQRECC")); settings.setValue("studio/bc/qrcode/mask", get_combobox_index("cmbQRMask")); - settings.setValue("studio/bc/qrcode/encoding_mode", get_button_group_index(QStringList() << "radDM200Stand" << "radQRGS1" << "radQRHIBC")); + settings.setValue("studio/bc/qrcode/encoding_mode", get_button_group_index( + QStringList() << "radDM200Stand" << "radQRGS1" << "radQRHIBC")); settings.setValue("studio/bc/qrcode/chk_full_multibyte", get_checkbox_val("chkQRFullMultibyte")); + settings.setValue("studio/bc/qrcode/structapp_count", get_combobox_index("cmbQRStructAppCount")); + settings.setValue("studio/bc/qrcode/structapp_index", get_combobox_index("cmbQRStructAppIndex")); + settings.setValue("studio/bc/qrcode/structapp_id", get_spinbox_val("spnQRStructAppID")); break; case BARCODE_RMQR: settings.setValue("studio/bc/rmqr/size", get_combobox_index("cmbRMQRSize")); settings.setValue("studio/bc/rmqr/ecc", get_combobox_index("cmbRMQRECC")); - settings.setValue("studio/bc/rmqr/encoding_mode", get_button_group_index(QStringList() << "radQRStand" << "radRMQRGS1")); + settings.setValue("studio/bc/rmqr/encoding_mode", get_button_group_index( + QStringList() << "radQRStand" << "radRMQRGS1")); settings.setValue("studio/bc/rmqr/chk_full_multibyte", get_checkbox_val("chkRMQRFullMultibyte")); break; @@ -2223,6 +2477,9 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology) { settings.setValue("studio/bc/gridmatrix/size", get_combobox_index("cmbGridSize")); settings.setValue("studio/bc/gridmatrix/ecc", get_combobox_index("cmbGridECC")); settings.setValue("studio/bc/gridmatrix/chk_full_multibyte", get_checkbox_val("chkGridFullMultibyte")); + settings.setValue("studio/bc/gridmatrix/structapp_count", get_combobox_index("cmbGridStructAppCount")); + settings.setValue("studio/bc/gridmatrix/structapp_index", get_combobox_index("cmbGridStructAppIndex")); + settings.setValue("studio/bc/gridmatrix/structapp_id", get_spinbox_val("spnGridStructAppID")); break; case BARCODE_MAXICODE: @@ -2232,16 +2489,22 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology) { settings.setValue("studio/bc/maxicode/scm_service", get_spinbox_val("spnMaxiSCMService")); settings.setValue("studio/bc/maxicode/chk_scm_vv", get_checkbox_val("chkMaxiSCMVV")); settings.setValue("studio/bc/maxicode/spn_scm_vv", get_spinbox_val("spnMaxiSCMVV")); + settings.setValue("studio/bc/maxicode/structapp_count", get_combobox_index("cmbMaxiStructAppCount")); + settings.setValue("studio/bc/maxicode/structapp_index", get_combobox_index("cmbMaxiStructAppIndex")); break; case BARCODE_CODEONE: settings.setValue("studio/bc/codeone/size", get_combobox_index("cmbC1Size")); - settings.setValue("studio/bc/codeone/encoding_mode", get_button_group_index(QStringList() << "radC1Stand" << "radC1GS1")); + settings.setValue("studio/bc/codeone/encoding_mode", get_button_group_index( + QStringList() << "radC1Stand" << "radC1GS1")); + settings.setValue("studio/bc/codeone/structapp_count", get_spinbox_val("spnC1StructAppCount")); + settings.setValue("studio/bc/codeone/structapp_index", get_spinbox_val("spnC1StructAppIndex")); break; case BARCODE_CODE49: settings.setValue("studio/bc/code49/row_sep_height", get_combobox_index("cmbC49RowSepHeight")); - settings.setValue("studio/bc/code49/encoding_mode", get_button_group_index(QStringList() << "radC49Stand" << "radC49GS1")); + settings.setValue("studio/bc/code49/encoding_mode", get_button_group_index( + QStringList() << "radC49Stand" << "radC49GS1")); settings.setValue("studio/bc/code49/chk_no_quiet_zones", get_checkbox_val("chkC49NoQuietZones")); break; @@ -2255,16 +2518,22 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology) { break; case BARCODE_ULTRA: - settings.setValue("studio/bc/ultra/autoresizing", get_button_group_index(QStringList() << "radUltraAuto" << "radUltraEcc")); + settings.setValue("studio/bc/ultra/autoresizing", get_button_group_index( + QStringList() << "radUltraAuto" << "radUltraEcc")); settings.setValue("studio/bc/ultra/ecc", get_combobox_index("cmbUltraEcc")); - settings.setValue("studio/bc/ultra/encoding_mode", get_button_group_index(QStringList() << "radUltraStand" << "radUltraGS1")); + settings.setValue("studio/bc/ultra/encoding_mode", get_button_group_index( + QStringList() << "radUltraStand" << "radUltraGS1")); + settings.setValue("studio/bc/ultra/structapp_count", get_combobox_index("cmbUltraStructAppCount")); + settings.setValue("studio/bc/ultra/structapp_index", get_combobox_index("cmbUltraStructAppIndex")); + settings.setValue("studio/bc/ultra/structapp_id", get_spinbox_val("spnUltraStructAppID")); break; case BARCODE_UPCA: case BARCODE_UPCA_CHK: case BARCODE_UPCA_CC: settings.setValue("studio/bc/upca/addongap", get_combobox_index("cmbUPCAAddonGap")); - settings.setValue("studio/bc/upca/guard_descent", QString::number(get_doublespinbox_val("spnUPCAGuardDescent"), 'f', 3 /*precision*/)); + settings.setValue("studio/bc/upca/guard_descent", + QString::number(get_doublespinbox_val("spnUPCAGuardDescent"), 'f', 3 /*precision*/)); settings.setValue("studio/bc/upca/chk_no_quiet_zones", get_checkbox_val("chkUPCANoQuietZones")); break; @@ -2272,7 +2541,8 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology) { case BARCODE_EANX_CHK: case BARCODE_EANX_CC: settings.setValue("studio/bc/eanx/addongap", get_combobox_index("cmbUPCEANAddonGap")); - settings.setValue("studio/bc/eanx/guard_descent", QString::number(get_doublespinbox_val("spnUPCEANGuardDescent"), 'f', 3 /*precision*/)); + settings.setValue("studio/bc/eanx/guard_descent", + QString::number(get_doublespinbox_val("spnUPCEANGuardDescent"), 'f', 3 /*precision*/)); settings.setValue("studio/bc/eanx/chk_no_quiet_zones", get_checkbox_val("chkUPCEANNoQuietZones")); break; @@ -2280,13 +2550,15 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology) { case BARCODE_UPCE_CHK: case BARCODE_UPCE_CC: settings.setValue("studio/bc/upce/addongap", get_combobox_index("cmbUPCEANAddonGap")); - settings.setValue("studio/bc/upce/guard_descent", QString::number(get_doublespinbox_val("spnUPCEANGuardDescent"), 'f', 3 /*precision*/)); + settings.setValue("studio/bc/upce/guard_descent", + QString::number(get_doublespinbox_val("spnUPCEANGuardDescent"), 'f', 3 /*precision*/)); settings.setValue("studio/bc/upce/chk_no_quiet_zones", get_checkbox_val("chkUPCEANNoQuietZones")); break; case BARCODE_ISBNX: settings.setValue("studio/bc/isnbx/addongap", get_combobox_index("cmbUPCEANAddonGap")); - settings.setValue("studio/bc/isnbx/guard_descent", QString::number(get_doublespinbox_val("spnUPCEANGuardDescent"), 'f', 3 /*precision*/)); + settings.setValue("studio/bc/isnbx/guard_descent", + QString::number(get_doublespinbox_val("spnUPCEANGuardDescent"), 'f', 3 /*precision*/)); settings.setValue("studio/bc/isnbx/chk_no_quiet_zones", get_checkbox_val("chkUPCEANNoQuietZones")); break; @@ -2306,11 +2578,13 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology) { txtData->setText(tdata); } if (!grpComposite->isHidden()) { - const QString &composite_text = settings.value(QString("studio/bc/%1/composite_text").arg(name), "").toString(); + const QString &composite_text = settings.value( + QString("studio/bc/%1/composite_text").arg(name), "").toString(); if (!composite_text.isEmpty()) { txtComposite->setText(composite_text); } - chkComposite->setChecked(settings.value(QString("studio/bc/%1/chk_composite").arg(name), 0).toInt() ? true : false); + chkComposite->setChecked(settings.value( + QString("studio/bc/%1/chk_composite").arg(name), 0).toInt() ? true : false); cmbCompType->setCurrentIndex(settings.value(QString("studio/bc/%1/comp_type").arg(name), 0).toInt()); } if (cmbECI->isEnabled()) { @@ -2321,10 +2595,13 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology) { if (chkRInit->isEnabled()) { chkRInit->setChecked(settings.value(QString("studio/bc/%1/chk_rinit").arg(name)).toInt() ? true : false); } - chkGS1Parens->setChecked(settings.value(QString("studio/bc/%1/chk_gs1parens").arg(name)).toInt() ? true : false); - chkGS1NoCheck->setChecked(settings.value(QString("studio/bc/%1/chk_gs1nocheck").arg(name)).toInt() ? true : false); + chkGS1Parens->setChecked(settings.value( + QString("studio/bc/%1/chk_gs1parens").arg(name)).toInt() ? true : false); + chkGS1NoCheck->setChecked(settings.value( + QString("studio/bc/%1/chk_gs1nocheck").arg(name)).toInt() ? true : false); if (chkAutoHeight->isEnabled()) { - chkAutoHeight->setChecked(settings.value(QString("studio/bc/%1/appearance/autoheight").arg(name), 1).toInt() ? true : false); + chkAutoHeight->setChecked(settings.value( + QString("studio/bc/%1/appearance/autoheight").arg(name), 1).toInt() ? true : false); heightb->setValue(settings.value(QString("studio/bc/%1/appearance/height").arg(name), 50.0f).toFloat()); } bwidth->setValue(settings.value(QString("studio/bc/%1/appearance/border").arg(name), 0).toInt()); @@ -2333,14 +2610,19 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology) { spnScale->setValue(settings.value(QString("studio/bc/%1/appearance/scale").arg(name), 1.0).toFloat()); btype->setCurrentIndex(settings.value(QString("studio/bc/%1/appearance/border_type").arg(name), 0).toInt()); if (chkHRTShow->isEnabled()) { - cmbFontSetting->setCurrentIndex(settings.value(QString("studio/bc/%1/appearance/font_setting").arg(name), 0).toInt()); - chkHRTShow->setChecked(settings.value(QString("studio/bc/%1/appearance/chk_hrt_show").arg(name), 1).toInt() ? true : false); + cmbFontSetting->setCurrentIndex(settings.value( + QString("studio/bc/%1/appearance/font_setting").arg(name), 0).toInt()); + chkHRTShow->setChecked(settings.value( + QString("studio/bc/%1/appearance/chk_hrt_show").arg(name), 1).toInt() ? true : false); } - chkCMYK->setChecked(settings.value(QString("studio/bc/%1/appearance/cmyk").arg(name), 0).toInt() ? true : false); + chkCMYK->setChecked(settings.value( + QString("studio/bc/%1/appearance/cmyk").arg(name), 0).toInt() ? true : false); cmbRotate->setCurrentIndex(settings.value(QString("studio/bc/%1/appearance/rotate").arg(name), 0).toInt()); if (symbology == BARCODE_DOTCODE || chkDotty->isEnabled()) { - chkDotty->setChecked(settings.value(QString("studio/bc/%1/appearance/chk_dotty").arg(name), 0).toInt() ? true : false); - spnDotSize->setValue(settings.value(QString("studio/bc/%1/appearance/dot_size").arg(name), 0.4f / 0.5f).toFloat()); + chkDotty->setChecked(settings.value( + QString("studio/bc/%1/appearance/chk_dotty").arg(name), 0).toInt() ? true : false); + spnDotSize->setValue(settings.value( + QString("studio/bc/%1/appearance/dot_size").arg(name), 0.4f / 0.5f).toFloat()); } m_fgcolor.setRgb(settings.value(QString("studio/bc/%1/ink/red").arg(name), 0).toInt(), settings.value(QString("studio/bc/%1/ink/green").arg(name), 0).toInt(), @@ -2358,7 +2640,8 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology) { case BARCODE_GS1_128: case BARCODE_GS1_128_CC: case BARCODE_HIBC_128: - set_radiobutton_from_setting(settings, "studio/bc/code128/encoding_mode", QStringList() << "radC128Stand" << "radC128EAN" << "radC128CSup" << "radC128HIBC"); + set_radiobutton_from_setting(settings, "studio/bc/code128/encoding_mode", + QStringList() << "radC128Stand" << "radC128EAN" << "radC128CSup" << "radC128HIBC"); break; case BARCODE_PDF417: @@ -2366,27 +2649,43 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology) { case BARCODE_HIBC_PDF: set_combobox_from_setting(settings, "studio/bc/pdf417/cols", "cmbPDFCols"); set_combobox_from_setting(settings, "studio/bc/pdf417/ecc", "cmbPDFECC"); - set_radiobutton_from_setting(settings, "studio/bc/pdf417/encoding_mode", QStringList() << "radPDFStand" << "radPDFTruncated" << "radPDFHIBC"); + set_radiobutton_from_setting(settings, "studio/bc/pdf417/encoding_mode", + QStringList() << "radPDFStand" << "radPDFTruncated" << "radPDFHIBC"); + set_spinbox_from_setting(settings, "studio/bc/pdf417/structapp_count", "spnPDFStructAppCount", 1); + set_spinbox_from_setting(settings, "studio/bc/pdf417/structapp_index", "spnPDFStructAppIndex", 0); + set_lineedit_from_setting(settings, "studio/bc/pdf417/structapp_id", "txtPDFStructAppID", ""); break; case BARCODE_MICROPDF417: case BARCODE_HIBC_MICPDF: set_combobox_from_setting(settings, "studio/bc/micropdf417/cols", "cmbMPDFCols"); - set_radiobutton_from_setting(settings, "studio/bc/micropdf417/encoding_mode", QStringList() << "radMPDFStand" << "radMPDFHIBC"); + set_radiobutton_from_setting(settings, "studio/bc/micropdf417/encoding_mode", + QStringList() << "radMPDFStand" << "radMPDFHIBC"); + set_spinbox_from_setting(settings, "studio/bc/micropdf417/structapp_count", "spnMPDFStructAppCount", 1); + set_spinbox_from_setting(settings, "studio/bc/micropdf417/structapp_index", "spnMPDFStructAppIndex", 0); + set_lineedit_from_setting(settings, "studio/bc/micropdf417/structapp_id", "txtMPDFStructAppID", ""); break; case BARCODE_DOTCODE: set_combobox_from_setting(settings, "studio/bc/dotcode/cols", "cmbDotCols"); set_combobox_from_setting(settings, "studio/bc/dotcode/mask", "cmbDotMask"); - set_radiobutton_from_setting(settings, "studio/bc/dotcode/encoding_mode", QStringList() << "radDotStand" << "radDotGS1"); + set_radiobutton_from_setting(settings, "studio/bc/dotcode/encoding_mode", + QStringList() << "radDotStand" << "radDotGS1"); + set_combobox_from_setting(settings, "studio/bc/dotcode/structapp_count", "cmbDotStructAppCount"); + set_combobox_from_setting(settings, "studio/bc/dotcode/structapp_index", "cmbDotStructAppIndex"); break; case BARCODE_AZTEC: case BARCODE_HIBC_AZTEC: - set_radiobutton_from_setting(settings, "studio/bc/aztec/autoresizing", QStringList() << "radAztecAuto" << "radAztecSize" << "radAztecECC"); + set_radiobutton_from_setting(settings, "studio/bc/aztec/autoresizing", + QStringList() << "radAztecAuto" << "radAztecSize" << "radAztecECC"); set_combobox_from_setting(settings, "studio/bc/aztec/size", "cmbAztecSize"); set_combobox_from_setting(settings, "studio/bc/aztec/ecc", "cmbAztecECC"); - set_radiobutton_from_setting(settings, "studio/bc/aztec/encoding_mode", QStringList() << "radAztecStand" << "radAztecGS1" << "radAztecHIBC"); + set_radiobutton_from_setting(settings, "studio/bc/aztec/encoding_mode", + QStringList() << "radAztecStand" << "radAztecGS1" << "radAztecHIBC"); + set_combobox_from_setting(settings, "studio/bc/aztec/structapp_count", "cmbAztecStructAppCount"); + set_combobox_from_setting(settings, "studio/bc/aztec/structapp_index", "cmbAztecStructAppIndex"); + set_lineedit_from_setting(settings, "studio/bc/aztec/structapp_id", "txtAztecStructAppID", ""); break; case BARCODE_MSI_PLESSEY: @@ -2396,41 +2695,51 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology) { break; case BARCODE_CODE11: - set_radiobutton_from_setting(settings, "studio/bc/code11/check_digit", QStringList() << "radC11TwoCheckDigits" << "radC11OneCheckDigit" << "radC11NoCheckDigits"); + set_radiobutton_from_setting(settings, "studio/bc/code11/check_digit", + QStringList() << "radC11TwoCheckDigits" << "radC11OneCheckDigit" << "radC11NoCheckDigits"); break; case BARCODE_C25STANDARD: - set_radiobutton_from_setting(settings, "studio/bc/c25standard/check_digit", QStringList() << "radC25Stand" << "radC25Check" << "radC25CheckHide"); + set_radiobutton_from_setting(settings, "studio/bc/c25standard/check_digit", + QStringList() << "radC25Stand" << "radC25Check" << "radC25CheckHide"); break; case BARCODE_C25INTER: - set_radiobutton_from_setting(settings, "studio/bc/c25inter/check_digit", QStringList() << "radC25Stand" << "radC25Check" << "radC25CheckHide"); + set_radiobutton_from_setting(settings, "studio/bc/c25inter/check_digit", + QStringList() << "radC25Stand" << "radC25Check" << "radC25CheckHide"); break; case BARCODE_C25IATA: - set_radiobutton_from_setting(settings, "studio/bc/c25iata/check_digit", QStringList() << "radC25Stand" << "radC25Check" << "radC25CheckHide"); + set_radiobutton_from_setting(settings, "studio/bc/c25iata/check_digit", + QStringList() << "radC25Stand" << "radC25Check" << "radC25CheckHide"); break; case BARCODE_C25LOGIC: - set_radiobutton_from_setting(settings, "studio/bc/c25logic/check_digit", QStringList() << "radC25Stand" << "radC25Check" << "radC25CheckHide"); + set_radiobutton_from_setting(settings, "studio/bc/c25logic/check_digit", + QStringList() << "radC25Stand" << "radC25Check" << "radC25CheckHide"); break; case BARCODE_C25IND: - set_radiobutton_from_setting(settings, "studio/bc/c25ind/check_digit", QStringList() << "radC25Stand" << "radC25Check" << "radC25CheckHide"); + set_radiobutton_from_setting(settings, "studio/bc/c25ind/check_digit", + QStringList() << "radC25Stand" << "radC25Check" << "radC25CheckHide"); break; case BARCODE_CODE39: case BARCODE_HIBC_39: - set_radiobutton_from_setting(settings, "studio/bc/code39/check_digit", QStringList() << "radC39Stand" << "radC39Check" << "radC39HIBC"); + set_radiobutton_from_setting(settings, "studio/bc/code39/check_digit", + QStringList() << "radC39Stand" << "radC39Check" << "radC39HIBC"); break; case BARCODE_EXCODE39: - set_radiobutton_from_setting(settings, "studio/bc/excode39/check_digit", QStringList() << "radC39Stand" << "radC39Check"); + set_radiobutton_from_setting(settings, "studio/bc/excode39/check_digit", + QStringList() << "radC39Stand" << "radC39Check"); break; case BARCODE_LOGMARS: - set_radiobutton_from_setting(settings, "studio/bc/logmars/check_digit", QStringList() << "radLOGMARSStand" << "radLOGMARSCheck"); + set_radiobutton_from_setting(settings, "studio/bc/logmars/check_digit", + QStringList() << "radLOGMARSStand" << "radLOGMARSCheck"); break; case BARCODE_CODE16K: set_combobox_from_setting(settings, "studio/bc/code16k/row_sep_height", "cmbC16kRowSepHeight"); - set_radiobutton_from_setting(settings, "studio/bc/code16k/encoding_mode", QStringList() << "radC16kStand" << "radC16kGS1"); + set_radiobutton_from_setting(settings, "studio/bc/code16k/encoding_mode", + QStringList() << "radC16kStand" << "radC16kGS1"); set_checkbox_from_setting(settings, "studio/bc/code16k/chk_no_quiet_zones", "chkC16kNoQuietZones"); break; @@ -2443,7 +2752,8 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology) { set_combobox_from_setting(settings, "studio/bc/codablockf/width", "cmbCbfWidth"); set_combobox_from_setting(settings, "studio/bc/codablockf/height", "cmbCbfHeight"); set_combobox_from_setting(settings, "studio/bc/codablockf/row_sep_height", "cmbCbfRowSepHeight"); - set_radiobutton_from_setting(settings, "studio/bc/codablockf/encoding_mode", QStringList() << "radCbfStand" << "radCbfHIBC"); + set_radiobutton_from_setting(settings, "studio/bc/codablockf/encoding_mode", + QStringList() << "radCbfStand" << "radCbfHIBC"); set_checkbox_from_setting(settings, "studio/bc/codablockf/chk_no_quiet_zones", "chkCbfNoQuietZones"); break; @@ -2454,10 +2764,15 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology) { case BARCODE_DATAMATRIX: case BARCODE_HIBC_DM: set_combobox_from_setting(settings, "studio/bc/datamatrix/size", "cmbDM200Size"); - set_radiobutton_from_setting(settings, "studio/bc/datamatrix/encoding_mode", QStringList() << "radDM200Stand" << "radDM200GS1" << "radDM200HIBC"); + set_radiobutton_from_setting(settings, "studio/bc/datamatrix/encoding_mode", + QStringList() << "radDM200Stand" << "radDM200GS1" << "radDM200HIBC"); set_checkbox_from_setting(settings, "studio/bc/datamatrix/chk_suppress_rect", "chkDMRectangle"); set_checkbox_from_setting(settings, "studio/bc/datamatrix/chk_allow_dmre", "chkDMRE"); set_checkbox_from_setting(settings, "studio/bc/datamatrix/chk_gs_sep", "chkDMGSSep"); + set_combobox_from_setting(settings, "studio/bc/datamatrix/structapp_count", "cmbDMStructAppCount"); + set_combobox_from_setting(settings, "studio/bc/datamatrix/structapp_index", "cmbDMStructAppIndex"); + set_spinbox_from_setting(settings, "studio/bc/datamatrix/structapp_id", "spnDMStructAppID", 1); + set_spinbox_from_setting(settings, "studio/bc/datamatrix/structapp_id2", "spnDMStructAppID2", 1); break; case BARCODE_ITF14: @@ -2469,14 +2784,19 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology) { set_combobox_from_setting(settings, "studio/bc/qrcode/size", "cmbQRSize"); set_combobox_from_setting(settings, "studio/bc/qrcode/ecc", "cmbQRECC"); set_combobox_from_setting(settings, "studio/bc/qrcode/mask", "cmbQRMask"); - set_radiobutton_from_setting(settings, "studio/bc/qrcode/encoding_mode", QStringList() << "radDM200Stand" << "radQRGS1" << "radQRHIBC"); + set_radiobutton_from_setting(settings, "studio/bc/qrcode/encoding_mode", + QStringList() << "radDM200Stand" << "radQRGS1" << "radQRHIBC"); set_checkbox_from_setting(settings, "studio/bc/qrcode/chk_full_multibyte", "chkQRFullMultibyte"); + set_combobox_from_setting(settings, "studio/bc/qrcode/structapp_count", "cmbQRStructAppCount"); + set_combobox_from_setting(settings, "studio/bc/qrcode/structapp_index", "cmbQRStructAppIndex"); + set_spinbox_from_setting(settings, "studio/bc/qrcode/structapp_id", "spnQRStructAppID", 0); break; case BARCODE_RMQR: set_combobox_from_setting(settings, "studio/bc/rmqr/size", "cmbRMQRSize"); set_combobox_from_setting(settings, "studio/bc/rmqr/ecc", "cmbRMQRECC"); - set_radiobutton_from_setting(settings, "studio/bc/rmqr/encoding_mode", QStringList() << "radQRStand" << "radRMQRGS1"); + set_radiobutton_from_setting(settings, "studio/bc/rmqr/encoding_mode", + QStringList() << "radQRStand" << "radRMQRGS1"); set_checkbox_from_setting(settings, "studio/bc/rmqr/chk_full_multibyte", "chkRMQRFullMultibyte"); break; @@ -2498,6 +2818,9 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology) { set_combobox_from_setting(settings, "studio/bc/gridmatrix/size", "cmbGridSize"); set_combobox_from_setting(settings, "studio/bc/gridmatrix/ecc", "cmbGridECC"); set_checkbox_from_setting(settings, "studio/bc/gridmatrix/chk_full_multibyte", "chkGridFullMultibyte"); + set_combobox_from_setting(settings, "studio/bc/gridmatrix/structapp_count", "cmbGridStructAppCount"); + set_combobox_from_setting(settings, "studio/bc/gridmatrix/structapp_index", "cmbGridStructAppIndex"); + set_spinbox_from_setting(settings, "studio/bc/gridmatrix/structapp_id", "spnGridStructAppID", 0); break; case BARCODE_MAXICODE: @@ -2506,17 +2829,24 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology) { set_spinbox_from_setting(settings, "studio/bc/maxicode/scm_country", "spnMaxiSCMCountry", 0); set_spinbox_from_setting(settings, "studio/bc/maxicode/scm_service", "spnMaxiSCMService", 0); set_checkbox_from_setting(settings, "studio/bc/maxicode/chk_scm_vv", "chkMaxiSCMVV"); - set_spinbox_from_setting(settings, "studio/bc/maxicode/spn_scm_vv", "spnMaxiSCMVV", 96); /* 96 is ASC MH10/SC 8 */ + // 96 is ASC MH10/SC 8 + set_spinbox_from_setting(settings, "studio/bc/maxicode/spn_scm_vv", "spnMaxiSCMVV", 96); + set_combobox_from_setting(settings, "studio/bc/maxicode/structapp_count", "cmbMaxiStructAppCount"); + set_combobox_from_setting(settings, "studio/bc/maxicode/structapp_index", "cmbMaxiStructAppIndex"); break; case BARCODE_CODEONE: set_combobox_from_setting(settings, "studio/bc/codeone/size", "cmbC1Size"); - set_radiobutton_from_setting(settings, "studio/bc/codeone/encoding_mode", QStringList() << "radC1Stand" << "radC1GS1"); + set_radiobutton_from_setting(settings, "studio/bc/codeone/encoding_mode", + QStringList() << "radC1Stand" << "radC1GS1"); + set_spinbox_from_setting(settings, "studio/bc/codeone/structapp_count", "spnC1StructAppCount", 1); + set_spinbox_from_setting(settings, "studio/bc/codeone/structapp_index", "spnC1StructAppIndex", 0); break; case BARCODE_CODE49: set_combobox_from_setting(settings, "studio/bc/code49/row_sep_height", "cmbC49RowSepHeight"); - set_radiobutton_from_setting(settings, "studio/bc/code49/encoding_mode", QStringList() << "radC49Stand" << "radC49GS1"); + set_radiobutton_from_setting(settings, "studio/bc/code49/encoding_mode", + QStringList() << "radC49Stand" << "radC49GS1"); set_checkbox_from_setting(settings, "studio/bc/code49/chk_no_quiet_zones", "chkC49NoQuietZones"); break; @@ -2529,9 +2859,14 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology) { break; case BARCODE_ULTRA: - set_radiobutton_from_setting(settings, "studio/bc/ultra/autoresizing", QStringList() << "radUltraAuto" << "radUltraEcc"); + set_radiobutton_from_setting(settings, "studio/bc/ultra/autoresizing", + QStringList() << "radUltraAuto" << "radUltraEcc"); set_combobox_from_setting(settings, "studio/bc/ultra/ecc", "cmbUltraEcc"); - set_radiobutton_from_setting(settings, "studio/bc/ultra/encoding_mode", QStringList() << "radUltraStand" << "radUltraGS1"); + set_radiobutton_from_setting(settings, "studio/bc/ultra/encoding_mode", + QStringList() << "radUltraStand" << "radUltraGS1"); + set_combobox_from_setting(settings, "studio/bc/ultra/structapp_count", "cmbUltraStructAppCount"); + set_combobox_from_setting(settings, "studio/bc/ultra/structapp_index", "cmbUltraStructAppIndex"); + set_spinbox_from_setting(settings, "studio/bc/ultra/structapp_id", "spnUltraStructAppID", 0); break; case BARCODE_UPCA: diff --git a/frontend_qt/mainwindow.h b/frontend_qt/mainwindow.h index 93ca4444..2640c1ef 100644 --- a/frontend_qt/mainwindow.h +++ b/frontend_qt/mainwindow.h @@ -49,31 +49,45 @@ public slots: void autoheight_ui_set(); void HRTShow_ui_set(); void dotty_ui_set(); + void structapp_ui_set(); void on_encoded(); void filter_symbologies(); protected: void resizeEvent(QResizeEvent *event); void combobox_item_enabled(QComboBox *comboBox, int index, bool enabled); - void upcean_addon_gap(QComboBox *comboBox, QLabel *label, int base); - void upcean_guard_descent(QDoubleSpinBox *spnBox, QLabel *label); + void upcean_addon_gap(const char *comboBoxName, const char *labelName, int base); + void upcean_guard_descent(const char *spnBoxName, const char *labelName); void set_gs1_mode(bool gs1_mode); void set_smaller_font(QLabel *note); + QObject *widget_obj(const char *name); + const char *get_setting_name(int symbology); int get_button_group_index(const QStringList &children); - void set_radiobutton_from_setting(QSettings &settings, const QString &setting, const QStringList &children, int default_val = 0); + void set_radiobutton_from_setting(QSettings &settings, const QString &setting, const QStringList &children, + int default_val = 0); + int get_combobox_index(const QString &child); - void set_combobox_from_setting(QSettings &settings, const QString &setting, const QString &child, int default_val = 0); + void set_combobox_from_setting(QSettings &settings, const QString &setting, const QString &child, + int default_val = 0); + int get_checkbox_val(const QString &child); - void set_checkbox_from_setting(QSettings &settings, const QString &setting, const QString &child, int default_val = 0); + void set_checkbox_from_setting(QSettings &settings, const QString &setting, const QString &child, + int default_val = 0); + double get_doublespinbox_val(const QString &child); - void set_doublespinbox_from_setting(QSettings &settings, const QString &setting, const QString &child, float default_val = 0.0f); + void set_doublespinbox_from_setting(QSettings &settings, const QString &setting, const QString &child, + float default_val = 0.0f); + QString get_lineedit_val(const QString &child); - void set_lineedit_from_setting(QSettings &settings, const QString &setting, const QString &child, const char *default_val = ""); + void set_lineedit_from_setting(QSettings &settings, const QString &setting, const QString &child, + const char *default_val = ""); + int get_spinbox_val(const QString &child); - void set_spinbox_from_setting(QSettings &settings, const QString &setting, const QString &child, int default_val = 0); + void set_spinbox_from_setting(QSettings &settings, const QString &setting, const QString &child, + int default_val = 0); void save_sub_settings(QSettings &settings, int symbology); void load_sub_settings(QSettings &settings, int symbology); diff --git a/frontend_qt/sequencewindow.cpp b/frontend_qt/sequencewindow.cpp index e01f4773..b0f6af65 100644 --- a/frontend_qt/sequencewindow.cpp +++ b/frontend_qt/sequencewindow.cpp @@ -183,7 +183,8 @@ void SequenceWindow::import() QByteArray outstream; import_dialog.setWindowTitle("Import File"); - import_dialog.setDirectory(settings.value("studio/default_dir", QDir::toNativeSeparators(QDir::homePath())).toString()); + import_dialog.setDirectory(settings.value("studio/default_dir", + QDir::toNativeSeparators(QDir::homePath())).toString()); if (import_dialog.exec()) { filename = import_dialog.selectedFiles().at(0);