diff --git a/backend/code.c b/backend/code.c index 455491c7..74005a92 100644 --- a/backend/code.c +++ b/backend/code.c @@ -196,6 +196,10 @@ INTERNAL int code_11(struct zint_symbol *symbol, unsigned char source[], int len } } + if (symbol->debug & ZINT_DEBUG_PRINT) { + printf("Check digit (%d): %s\n", num_check_digits, num_check_digits ? checkstr : ""); + } + /* Stop character */ strcat(dest, "11221"); diff --git a/backend/code128.c b/backend/code128.c index b69613ab..814d96b8 100644 --- a/backend/code128.c +++ b/backend/code128.c @@ -33,7 +33,6 @@ /* vim: set ts=4 sw=4 et : */ #include -#include #ifdef _MSC_VER #include #endif @@ -648,7 +647,8 @@ INTERNAL int code_128(struct zint_symbol *symbol, const unsigned char source[], for (i = 0; i < bar_characters; i++) { printf(" %d", values[i]); } - printf("\n"); + printf(" (%d)\n", bar_characters); + printf("Barspaces: %s\n", dest); } #ifdef ZINT_TEST if (symbol->debug & ZINT_DEBUG_TEST) { @@ -951,7 +951,8 @@ INTERNAL int ean_128(struct zint_symbol *symbol, unsigned char source[], const s for (i = 0; i < bar_characters; i++) { printf(" %d", values[i]); } - printf("\n"); + printf(" (%d)\n", bar_characters); + printf("Barspaces: %s\n", dest); } #ifdef ZINT_TEST if (symbol->debug & ZINT_DEBUG_TEST) { diff --git a/backend/common.c b/backend/common.c index f2950990..8050bcfa 100644 --- a/backend/common.c +++ b/backend/common.c @@ -135,18 +135,6 @@ INTERNAL int posn(const char set_string[], const char data) { return -1; } -/* Returns the number of times a character occurs in a string */ -INTERNAL int ustrchr_cnt(const unsigned char string[], const size_t length, const unsigned char c) { - int count = 0; - unsigned int i; - for (i = 0; i < length; i++) { - if (string[i] == c) { - count++; - } - } - return count; -} - /* Return true (1) if a module is dark/black/colour, otherwise false (0) */ INTERNAL int module_is_set(const struct zint_symbol *symbol, const int y_coord, const int x_coord) { if (symbol->symbology == BARCODE_ULTRA) { @@ -272,7 +260,7 @@ INTERNAL int istwodigits(const unsigned char source[], const int length, const i } /* State machine to decode UTF-8 to Unicode codepoints (state 0 means done, state 12 means error) */ -INTERNAL unsigned int decode_utf8(unsigned int* state, unsigned int* codep, const unsigned char byte) { +INTERNAL unsigned int decode_utf8(unsigned int *state, unsigned int *codep, const unsigned char byte) { /* Copyright (c) 2008-2009 Bjoern Hoehrmann @@ -375,8 +363,9 @@ INTERNAL void set_minimum_height(struct zint_symbol *symbol, const int min_heigh } /* Calculate optimized encoding modes. Adapted from Project Nayuki */ -INTERNAL void pn_define_mode(char* mode, const unsigned int data[], const size_t length, const int debug, - unsigned int state[], const char mode_types[], const int num_modes, pn_head_costs head_costs, pn_switch_cost switch_cost, pn_eod_cost eod_cost, pn_cur_cost cur_cost) { +INTERNAL void pn_define_mode(char *mode, const unsigned int data[], const size_t length, const int debug, + unsigned int state[], const char mode_types[], const int num_modes, + pn_head_costs head_costs, pn_switch_cost switch_cost, pn_eod_cost eod_cost, pn_cur_cost cur_cost) { /* * Copyright (c) Project Nayuki. (MIT License) * https://www.nayuki.io/page/qr-code-generator-library @@ -398,12 +387,12 @@ INTERNAL void pn_define_mode(char* mode, const unsigned int data[], const size_t char char_modes[length * num_modes]; unsigned int cur_costs[num_modes]; #else - unsigned int* prev_costs; - char* char_modes; - unsigned int* cur_costs; - prev_costs = (unsigned int*) _alloca(num_modes * sizeof(unsigned int)); - char_modes = (char*) _alloca(length * num_modes); - cur_costs = (unsigned int*) _alloca(num_modes * sizeof(unsigned int)); + unsigned int *prev_costs; + char *char_modes; + unsigned int *cur_costs; + prev_costs = (unsigned int *) _alloca(num_modes * sizeof(unsigned int)); + char_modes = (char *) _alloca(length * num_modes); + cur_costs = (unsigned int *) _alloca(num_modes * sizeof(unsigned int)); #endif /* char_modes[i * num_modes + j] represents the mode to encode the code point at index i such that the final @@ -462,13 +451,13 @@ INTERNAL void pn_define_mode(char* mode, const unsigned int data[], const size_t } if (debug & ZINT_DEBUG_PRINT) { - printf(" Mode: %.*s\n", (int)length, mode); + printf(" Mode: %.*s\n", (int) length, mode); } } #ifdef ZINT_TEST /* Dumps hex-formatted codewords in symbol->errtxt (for use in testing) */ -void debug_test_codeword_dump(struct zint_symbol *symbol, unsigned char* codewords, int length) { +void debug_test_codeword_dump(struct zint_symbol *symbol, unsigned char *codewords, int length) { int i, max = length, cnt_len = 0; if (length > 30) { /* 30*3 < errtxt 92 (100 - "Warning ") chars */ sprintf(symbol->errtxt, "(%d) ", length); /* Place the number of codewords at the front */ @@ -481,7 +470,7 @@ void debug_test_codeword_dump(struct zint_symbol *symbol, unsigned char* codewor symbol->errtxt[strlen(symbol->errtxt) - 1] = '\0'; /* Zap last space */ } -void debug_test_codeword_dump_int(struct zint_symbol *symbol, int* codewords, int length) { +void debug_test_codeword_dump_int(struct zint_symbol *symbol, int *codewords, int length) { int i, max = 0, cnt_len, errtxt_len; char temp[20]; errtxt_len = sprintf(symbol->errtxt, "(%d) ", length); /* Place the number of codewords at the front */ diff --git a/backend/common.h b/backend/common.h index 649eaeb2..b86d2766 100644 --- a/backend/common.h +++ b/backend/common.h @@ -79,7 +79,6 @@ extern "C" { INTERNAL void bin_append(const int arg, const int length, char *binary); INTERNAL void bin_append_posn(const int arg, const int length, char *binary, size_t posn); INTERNAL int posn(const char set_string[], const char data); - INTERNAL int ustrchr_cnt(const unsigned char string[], const size_t length, const unsigned char c); INTERNAL int module_is_set(const struct zint_symbol *symbol, const int y_coord, const int x_coord); INTERNAL void set_module(struct zint_symbol *symbol, const int y_coord, const int x_coord); INTERNAL void set_module_colour(struct zint_symbol *symbol, const int y_coord, const int x_coord, const int colour); @@ -89,20 +88,22 @@ extern "C" { INTERNAL int is_extendable(const int symbology); INTERNAL int is_composite(const int symbology); INTERNAL int istwodigits(const unsigned char source[], int length, const int position); - INTERNAL unsigned int decode_utf8(unsigned int* state, unsigned int* codep, const unsigned char byte); + INTERNAL unsigned int decode_utf8(unsigned int *state, unsigned int *codep, const unsigned char byte); INTERNAL int utf8_to_unicode(struct zint_symbol *symbol, const unsigned char source[], unsigned int vals[], size_t *length, int disallow_4byte); INTERNAL void set_minimum_height(struct zint_symbol *symbol, const int min_height); - typedef unsigned int* (*pn_head_costs)(unsigned int state[]); + typedef unsigned int *(*pn_head_costs)(unsigned int state[]); typedef unsigned int (*pn_switch_cost)(unsigned int state[], const int k, const int j); typedef unsigned int (*pn_eod_cost)(unsigned int state[], const int k); - typedef void (*pn_cur_cost)(unsigned int state[], const unsigned int data[], const size_t length, const int i, char* char_modes, unsigned int prev_costs[], unsigned int cur_costs[]); - INTERNAL void pn_define_mode(char* mode, const unsigned int data[], const size_t length, const int debug, - unsigned int state[], const char mode_types[], const int num_modes, pn_head_costs head_costs, pn_switch_cost switch_cost, pn_eod_cost eod_cost, pn_cur_cost cur_cost); + typedef void (*pn_cur_cost)(unsigned int state[], const unsigned int data[], const size_t length, const int i, + char *char_modes, unsigned int prev_costs[], unsigned int cur_costs[]); + INTERNAL void pn_define_mode(char *mode, const unsigned int data[], const size_t length, const int debug, + unsigned int state[], const char mode_types[], const int num_modes, + pn_head_costs head_costs, pn_switch_cost switch_cost, pn_eod_cost eod_cost, pn_cur_cost cur_cost); #ifdef ZINT_TEST - void debug_test_codeword_dump(struct zint_symbol *symbol, unsigned char* codewords, int length); - void debug_test_codeword_dump_int(struct zint_symbol *symbol, int* codewords, int length); + void debug_test_codeword_dump(struct zint_symbol *symbol, unsigned char *codewords, int length); + void debug_test_codeword_dump_int(struct zint_symbol *symbol, int *codewords, int length); #endif #ifdef __cplusplus diff --git a/backend/composite.c b/backend/composite.c index 11849658..49f9f780 100644 --- a/backend/composite.c +++ b/backend/composite.c @@ -2,7 +2,7 @@ /* libzint - the open source barcode library - Copyright (C) 2008-2019 Robin Stuart + Copyright (C) 2008 - 2020 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -50,20 +50,18 @@ */ #include -#include -#include #include #include #ifdef _MSC_VER #include #endif #include "common.h" -#include "composite.h" #include "pdf417.h" #include "gs1.h" #include "general_field.h" #define UINT unsigned short +#include "composite.h" INTERNAL int eanx(struct zint_symbol *symbol, unsigned char source[], int length); INTERNAL int ean_128(struct zint_symbol *symbol, unsigned char source[], const size_t length); @@ -72,8 +70,6 @@ INTERNAL int rss14(struct zint_symbol *symbol, unsigned char source[], int lengt INTERNAL int rsslimited(struct zint_symbol *symbol, unsigned char source[], int length); INTERNAL int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int length); -static UINT pwr928[69][7]; - static int _min(int first, int second) { if (first <= second) @@ -87,26 +83,6 @@ static int getBit(UINT *bitStr, int bitPos) { return !!(bitStr[bitPos >> 4] & (0x8000 >> (bitPos & 15))); } -/* initialize pwr928 encoding table */ -static void init928(void) { - int i, j, v; - int cw[7]; - cw[6] = 1L; - for (i = 5; i >= 0; i--) - cw[i] = 0; - - for (i = 0; i < 7; i++) - pwr928[0][i] = cw[i]; - for (j = 1; j < 69; j++) { - for (v = 0, i = 6; i >= 1; i--) { - v = (2 * cw[i]) + (v / 928); - pwr928[j][i] = cw[i] = v % 928; - } - pwr928[j][0] = cw[0] = (2 * cw[0]) + (v / 928); - } - return; -} - /* converts bit string to base 928 values, codeWords[0] is highest order */ static int encode928(UINT bitString[], UINT codeWords[], int bitLng) { int i, j, b, cwNdx, cwLng; @@ -171,7 +147,6 @@ static int cc_a(struct zint_symbol *symbol, char source[], int cc_width) { } } - init928(); /* encode codeWords from bitStr */ cwCnt = encode928(bitStr, codeWords, bitlen); @@ -332,6 +307,10 @@ static int cc_a(struct zint_symbol *symbol, char source[], int cc_width) { } } + if (symbol->debug & ZINT_DEBUG_PRINT) { + printf("CC-A Columns: %d, Rows: %d\n", cc_width, symbol->rows); + } + return 0; } @@ -341,7 +320,7 @@ static int cc_b(struct zint_symbol *symbol, char source[], int cc_width) { #ifndef _MSC_VER unsigned char data_string[(strlen(source) / 8) + 3]; #else - unsigned char* data_string = (unsigned char*) _alloca((strlen(source) / 8) + 3); + unsigned char *data_string = (unsigned char *) _alloca((strlen(source) / 8) + 3); #endif int chainemc[180], mclength; int k, j, p, longueur, mccorrection[50], offset; @@ -584,6 +563,10 @@ static int cc_b(struct zint_symbol *symbol, char source[], int cc_width) { } } + if (symbol->debug & ZINT_DEBUG_PRINT) { + printf("CC-B Columns: %d, Rows: %d\n", cc_width, symbol->rows); + } + return 0; } @@ -593,7 +576,7 @@ static int cc_c(struct zint_symbol *symbol, char source[], int cc_width, int ecc #ifndef _MSC_VER unsigned char data_string[(strlen(source) / 8) + 4]; #else - unsigned char* data_string = (unsigned char*) _alloca((strlen(source) / 8) + 4); + unsigned char *data_string = (unsigned char *) _alloca((strlen(source) / 8) + 4); #endif int chainemc[1000], mclength, k; int offset, longueur, loop, total, j, mccorrection[520]; @@ -724,6 +707,10 @@ static int cc_c(struct zint_symbol *symbol, char source[], int cc_width, int ecc symbol->rows = (mclength / cc_width); symbol->width = (int)strlen(pattern); + if (symbol->debug & ZINT_DEBUG_PRINT) { + printf("CC-C Columns: %d, Rows: %d\n", cc_width, symbol->rows); + } + return 0; } @@ -788,9 +775,9 @@ static int calc_padding_cca(int binary_length, int cc_width) { target_bitsize = 78; } break; - } + } - return target_bitsize; + return target_bitsize; } static int calc_padding_ccb(int binary_length, int cc_width) { @@ -957,7 +944,8 @@ static int calc_padding_ccc(int binary_length, int *cc_width, int lin_width, int return target_bitsize; } -static int cc_binary_string(struct zint_symbol *symbol, const char source[], char binary_string[], int cc_mode, int *cc_width, int *ecc, int lin_width) { /* Handles all data encodation from section 5 of ISO/IEC 24723 */ +/* Handles all data encodation from section 5 of ISO/IEC 24723 */ +static int cc_binary_string(struct zint_symbol *symbol, const char source[], char binary_string[], int cc_mode, int *cc_width, int *ecc, int lin_width) { int encoding_method, read_posn, alpha_pad; int i, j, ai_crop, ai_crop_posn, fnc1_latch; int ai90_mode, last_digit, remainder, binary_length; @@ -966,9 +954,10 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha #ifndef _MSC_VER char general_field[source_len + 1]; #else - char* general_field = (char*) _alloca(source_len + 1); + char *general_field = (char *) _alloca(source_len + 1); #endif int target_bitsize; + int debug = symbol->debug & ZINT_DEBUG_PRINT; encoding_method = 1; read_posn = 0; @@ -976,7 +965,6 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha ai_crop_posn = -1; fnc1_latch = 0; alpha_pad = 0; - ai90_mode = 0; *ecc = 0; target_bitsize = 0; mode = NUMERIC; @@ -993,6 +981,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha if (encoding_method == 1) { strcat(binary_string, "0"); + if (debug) printf("CC-%c Encodation Method: 0\n", 'A' + (cc_mode - 1)); } if (encoding_method == 2) { @@ -1046,6 +1035,8 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha /* Note an alphanumeric FNC1 is also a numeric latch, so now in numeric mode */ } } + + if (debug) printf("CC-%c Encodation Method: 10, Compaction Field: %.*s\n", 'A' + (cc_mode - 1), read_posn, source); } if (encoding_method == 3) { @@ -1053,7 +1044,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha #ifndef _MSC_VER char ninety[source_len + 1]; #else - char* ninety = (char*) _alloca(source_len + 1); + char *ninety = (char *) _alloca(source_len + 1); #endif int ninety_len, alpha, alphanum, numeric, test1, test2, test3; @@ -1126,30 +1117,30 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha /* Alpha mode is a special mode for AI 90 */ if (alphanum == 0 && alpha > numeric) { - /* Alphabetic mode */ + /* Alpha mode */ strcat(binary_string, "11"); ai90_mode = 2; } else if (alphanum == 0 && alpha == 0) { /* Numeric mode */ strcat(binary_string, "10"); ai90_mode = 3; - } else { + } else { /* Note if first 4 are digits then it would be shorter to go into NUMERIC mode first; not implemented */ /* Alphanumeric mode */ strcat(binary_string, "0"); ai90_mode = 1; - mode = ALPHA; + mode = ALPHANUMERIC; } next_ai_posn = 2 + ninety_len; - if (source[next_ai_posn] == '[') { + if (next_ai_posn < source_len && source[next_ai_posn] == '[') { /* There are more AIs afterwards */ - if ((source[next_ai_posn + 1] == '2') && (source[next_ai_posn + 2] == '1')) { + if (next_ai_posn + 2 < source_len && (source[next_ai_posn + 1] == '2') && (source[next_ai_posn + 2] == '1')) { /* AI 21 follows */ ai_crop = 1; - } - - if ((source[next_ai_posn + 1] == '8') && (source[next_ai_posn + 2] == '0') && (source[next_ai_posn + 3] == '0') && (source[next_ai_posn + 4] == '4')) { + } else if (next_ai_posn + 4 < source_len + && (source[next_ai_posn + 1] == '8') && (source[next_ai_posn + 2] == '0') + && (source[next_ai_posn + 3] == '0') && (source[next_ai_posn + 4] == '4')) { /* AI 8004 follows */ ai_crop = 3; } @@ -1220,10 +1211,15 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha alpha_pad = 1; /* This is overwritten if a general field is encoded */ } + if (debug) { + printf("CC-%c Encodation Method: 11, Compaction Field: %.*s, Binary: %s (%d)\n", + 'A' + (cc_mode - 1), read_posn, source, binary_string, (int) strlen(binary_string)); + } } else { /* Use general field encodation instead */ strcat(binary_string, "0"); read_posn = 0; + if (debug) printf("CC-%c Encodation Method: 0\n", 'A' + (cc_mode - 1)); } } @@ -1249,6 +1245,12 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha } general_field[j] = '\0'; + if (debug) { + printf("Mode %s, General Field: %.40s%s\n", + mode == NUMERIC ? "NUMERIC" : mode == ALPHANUMERIC ? "ALPHANUMERIC" : "ISO646", + general_field, strlen(general_field) > 40 ? "..." : ""); + } + if (strlen(general_field) != 0) { alpha_pad = 0; } @@ -1322,7 +1324,6 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha /* Now add padding to binary string */ if (alpha_pad == 1) { strcat(binary_string, "11111"); - alpha_pad = 0; /* Extra FNC1 character required after Alpha encodation (section 5.3.3) */ } @@ -1339,6 +1340,11 @@ static int cc_binary_string(struct zint_symbol *symbol, const char source[], cha } } + if (debug) { + printf("ECC: %d, CC width %d\n", *ecc, *cc_width); + printf("Binary: %s (%d)\n", binary_string, (int) strlen(binary_string)); + } + return 0; } @@ -1368,7 +1374,7 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l #ifndef _MSC_VER char binary_string[bs]; #else - char* binary_string = (char*) _alloca(bs); + char *binary_string = (char *) _alloca(bs); #endif unsigned int pri_len; struct zint_symbol *linear; @@ -1402,6 +1408,9 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l strcpy(symbol->errtxt, "448: Invalid data"); return ZINT_ERROR_INVALID_DATA; } + if (symbol->debug & ZINT_DEBUG_PRINT) { + printf("GS1-128 linear width: %d\n", linear_width); + } } switch (symbol->symbology) { @@ -1412,7 +1421,7 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l int padded_pri_len; char padded_pri[20]; padded_pri[0] = '\0'; - ean_leading_zeroes(symbol, (unsigned char*) symbol->primary, (unsigned char*) padded_pri); + ean_leading_zeroes(symbol, (unsigned char *) symbol->primary, (unsigned char *) padded_pri); padded_pri_len = strlen(padded_pri); if (padded_pri_len <= 7) { /* EAN-8 */ cc_width = 3; @@ -1511,6 +1520,7 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l linear = ZBarcode_Create(); /* Symbol contains the 2D component and Linear contains the rest */ linear->symbology = symbol->symbology; + linear->debug = symbol->debug; if (linear->symbology != BARCODE_EAN128_CC) { /* Set the "component linkage" flag in the linear component */ @@ -1598,7 +1608,7 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l break; case BARCODE_RSS14_CC: bottom_shift = 4; break; - case BARCODE_RSS_LTD_CC: + case BARCODE_RSS_LTD_CC: if (cc_mode == 1) { top_shift = 1; } else { @@ -1627,6 +1637,10 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l break; } + if (symbol->debug & ZINT_DEBUG_PRINT) { + printf("Top shift: %d, Bottom shift: %d\n", top_shift, bottom_shift); + } + if (top_shift != 0) { /* Move the 2d component of the symbol horizontally */ for (i = 0; i <= symbol->rows; i++) { @@ -1660,7 +1674,8 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l symbol->width += top_shift; } symbol->rows += linear->rows; - ustrcpy(symbol->text, (unsigned char *) linear->text); + + ustrcpy(symbol->text, linear->text); ZBarcode_Delete(linear); diff --git a/backend/composite.h b/backend/composite.h index 6195d293..5fa610f8 100644 --- a/backend/composite.h +++ b/backend/composite.h @@ -2,7 +2,7 @@ /* libzint - the open source barcode library - Copyright (C) 2008-2017 Robin Stuart + Copyright (C) 2008 - 2020 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -65,3 +65,76 @@ static const char aRAPTable[68] = { }; /* Row Address Patterns are as defined in pdf417.h */ + +/* Generated by tools/gen_pwr928_table.php */ +static UINT pwr928[69][7] = { + { 0, 0, 0, 0, 0, 0, 1, }, + { 0, 0, 0, 0, 0, 0, 2, }, + { 0, 0, 0, 0, 0, 0, 4, }, + { 0, 0, 0, 0, 0, 0, 8, }, + { 0, 0, 0, 0, 0, 0, 16, }, + { 0, 0, 0, 0, 0, 0, 32, }, + { 0, 0, 0, 0, 0, 0, 64, }, + { 0, 0, 0, 0, 0, 0, 128, }, + { 0, 0, 0, 0, 0, 0, 256, }, + { 0, 0, 0, 0, 0, 0, 512, }, + { 0, 0, 0, 0, 0, 1, 96, }, + { 0, 0, 0, 0, 0, 2, 192, }, + { 0, 0, 0, 0, 0, 4, 384, }, + { 0, 0, 0, 0, 0, 8, 768, }, + { 0, 0, 0, 0, 0, 17, 608, }, + { 0, 0, 0, 0, 0, 35, 288, }, + { 0, 0, 0, 0, 0, 70, 576, }, + { 0, 0, 0, 0, 0, 141, 224, }, + { 0, 0, 0, 0, 0, 282, 448, }, + { 0, 0, 0, 0, 0, 564, 896, }, + { 0, 0, 0, 0, 1, 201, 864, }, + { 0, 0, 0, 0, 2, 403, 800, }, + { 0, 0, 0, 0, 4, 807, 672, }, + { 0, 0, 0, 0, 9, 687, 416, }, + { 0, 0, 0, 0, 19, 446, 832, }, + { 0, 0, 0, 0, 38, 893, 736, }, + { 0, 0, 0, 0, 77, 859, 544, }, + { 0, 0, 0, 0, 155, 791, 160, }, + { 0, 0, 0, 0, 311, 654, 320, }, + { 0, 0, 0, 0, 623, 380, 640, }, + { 0, 0, 0, 1, 318, 761, 352, }, + { 0, 0, 0, 2, 637, 594, 704, }, + { 0, 0, 0, 5, 347, 261, 480, }, + { 0, 0, 0, 10, 694, 523, 32, }, + { 0, 0, 0, 21, 461, 118, 64, }, + { 0, 0, 0, 42, 922, 236, 128, }, + { 0, 0, 0, 85, 916, 472, 256, }, + { 0, 0, 0, 171, 905, 16, 512, }, + { 0, 0, 0, 343, 882, 33, 96, }, + { 0, 0, 0, 687, 836, 66, 192, }, + { 0, 0, 1, 447, 744, 132, 384, }, + { 0, 0, 2, 895, 560, 264, 768, }, + { 0, 0, 5, 863, 192, 529, 608, }, + { 0, 0, 11, 798, 385, 131, 288, }, + { 0, 0, 23, 668, 770, 262, 576, }, + { 0, 0, 47, 409, 612, 525, 224, }, + { 0, 0, 94, 819, 297, 122, 448, }, + { 0, 0, 189, 710, 594, 244, 896, }, + { 0, 0, 379, 493, 260, 489, 864, }, + { 0, 0, 759, 58, 521, 51, 800, }, + { 0, 1, 590, 117, 114, 103, 672, }, + { 0, 3, 252, 234, 228, 207, 416, }, + { 0, 6, 504, 468, 456, 414, 832, }, + { 0, 13, 81, 8, 912, 829, 736, }, + { 0, 26, 162, 17, 897, 731, 544, }, + { 0, 52, 324, 35, 867, 535, 160, }, + { 0, 104, 648, 71, 807, 142, 320, }, + { 0, 209, 368, 143, 686, 284, 640, }, + { 0, 418, 736, 287, 444, 569, 352, }, + { 0, 837, 544, 574, 889, 210, 704, }, + { 1, 747, 161, 221, 850, 421, 480, }, + { 3, 566, 322, 443, 772, 843, 32, }, + { 7, 204, 644, 887, 617, 758, 64, }, + { 14, 409, 361, 847, 307, 588, 128, }, + { 28, 818, 723, 766, 615, 248, 256, }, + { 57, 709, 519, 605, 302, 496, 512, }, + { 115, 491, 111, 282, 605, 65, 96, }, + { 231, 54, 222, 565, 282, 130, 192, }, + { 462, 108, 445, 202, 564, 260, 384, }, +}; diff --git a/backend/general_field.c b/backend/general_field.c index 13c5ed00..b82522e4 100644 --- a/backend/general_field.c +++ b/backend/general_field.c @@ -2,7 +2,7 @@ /* libzint - the open source barcode library - Copyright (C) 2008-2019 Robin Stuart + Copyright (C) 2019 - 2020 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -31,7 +31,6 @@ */ /* vim: set ts=4 sw=4 et : */ -#include #include "common.h" #include "general_field.h" @@ -39,12 +38,12 @@ static char alphanum_puncs[] = "*,-./"; static char isoiec_puncs[] = "!\"%&'()*+,-./:;<=>?_ "; /* Returns type of char at `i`. FNC1 counted as NUMERIC. Returns 0 if invalid char */ -static int general_field_type(char* general_field, int i) { +static int general_field_type(char *general_field, int i) { if (general_field[i] == '[' || (general_field[i] >= '0' && general_field[i] <= '9')) { return NUMERIC; } if ((general_field[i] >= 'A' && general_field[i] <= 'Z') || strchr(alphanum_puncs, general_field[i])) { - return ALPHA; + return ALPHANUMERIC; } if ((general_field[i] >= 'a' && general_field[i] <= 'z') || strchr(isoiec_puncs, general_field[i])) { return ISOIEC; @@ -53,7 +52,7 @@ static int general_field_type(char* general_field, int i) { } /* Returns true if next (including `i`) `num` chars of type `type`, or if given (non-zero), `type2` */ -static int general_field_next(char* general_field, int i, int general_field_len, int num, int type, int type2) { +static int general_field_next(char *general_field, int i, int general_field_len, int num, int type, int type2) { if (i + num > general_field_len) { return 0; } @@ -67,7 +66,7 @@ static int general_field_next(char* general_field, int i, int general_field_len, } /* Returns true if next (including `i`) `num` up to `max_num` chars of type `type` and occur at end */ -static int general_field_next_terminate(char* general_field, int i, int general_field_len, int num, int max_num, int type) { +static int general_field_next_terminate(char *general_field, int i, int general_field_len, int num, int max_num, int type) { if (i + max_num < general_field_len) { return 0; } @@ -80,7 +79,7 @@ static int general_field_next_terminate(char* general_field, int i, int general_ } /* Returns true if none of the next (including `i`) `num` chars (or end occurs) of type `type` */ -static int general_field_next_none(char* general_field, int i, int general_field_len, int num, int type) { +static int general_field_next_none(char *general_field, int i, int general_field_len, int num, int type) { for (; i < general_field_len && num; i++, num--) { if (general_field_type(general_field, i) == type) { return 0; @@ -91,7 +90,7 @@ static int general_field_next_none(char* general_field, int i, int general_field /* Attempts to apply encoding rules from sections 7.2.5.5.1 to 7.2.5.5.3 * of ISO/IEC 24724:2011 (same as sections 5.4.1 to 5.4.3 of ISO/IEC 24723:2010) */ -INTERNAL int general_field_encode(char* general_field, int* p_mode, int* p_last_digit, char binary_string[]) { +INTERNAL int general_field_encode(char *general_field, int *p_mode, int *p_last_digit, char binary_string[]) { int i, d1, d2; int mode = *p_mode; int last_digit = 0; /* Set to odd remaining digit at end if any */ @@ -107,7 +106,7 @@ INTERNAL int general_field_encode(char* general_field, int* p_mode, int* p_last_ if (i < general_field_len - 1) { /* If at least 2 characters remain */ if (type != NUMERIC || general_field_type(general_field, i + 1) != NUMERIC) { /* 7.2.5.5.1/5.4.1 a) */ strcat(binary_string, "0000"); /* Alphanumeric latch */ - mode = ALPHA; + mode = ALPHANUMERIC; } else { d1 = general_field[i] == '[' ? 10 : ctoi(general_field[i]); d2 = general_field[i + 1] == '[' ? 10 : ctoi(general_field[i + 1]); @@ -117,14 +116,14 @@ INTERNAL int general_field_encode(char* general_field, int* p_mode, int* p_last_ } else { /* If 1 character remains */ if (type != NUMERIC) { /* 7.2.5.5.1/5.4.1 b) */ strcat(binary_string, "0000"); /* Alphanumeric latch */ - mode = ALPHA; + mode = ALPHANUMERIC; } else { last_digit = general_field[i]; /* Ending with single digit. 7.2.5.5.1 c) and 5.4.1 c) dealt with separately outside this procedure */ i++; } } break; - case ALPHA: + case ALPHANUMERIC: if (general_field[i] == '[') { /* 7.2.5.5.2/5.4.2 a) */ strcat(binary_string, "01111"); mode = NUMERIC; @@ -132,7 +131,7 @@ INTERNAL int general_field_encode(char* general_field, int* p_mode, int* p_last_ } else if (type == ISOIEC) { /* 7.2.5.5.2/5.4.2 b) */ strcat(binary_string, "00100"); /* ISO/IEC 646 latch */ mode = ISOIEC; - } else if (general_field_next(general_field, i, general_field_len, 6, NUMERIC, 0)) { /* 7.2.5.5.2/5.4.2 c) */ + } else if (general_field_next(general_field, i, general_field_len, 6, NUMERIC, 0)) { /* 7.2.5.5.2/5.4.2 c) */ strcat(binary_string, "000"); /* Numeric latch */ mode = NUMERIC; } else if (general_field_next_terminate(general_field, i, general_field_len, 4, 5 /*Can limit to 5 max due to above*/, NUMERIC)) { /* 7.2.5.5.2/5.4.2 d) */ @@ -159,10 +158,10 @@ INTERNAL int general_field_encode(char* general_field, int* p_mode, int* p_last_ if (next_10_not_isoiec && general_field_next(general_field, i, general_field_len, 4, NUMERIC, 0)) { /* 7.2.5.5.3/5.4.3 b) */ strcat(binary_string, "000"); /* Numeric latch */ mode = NUMERIC; - } else if (next_10_not_isoiec && general_field_next(general_field, i, general_field_len, 5, ALPHA, NUMERIC)) { /* 7.2.5.5.3/5.4.3 c) */ + } else if (next_10_not_isoiec && general_field_next(general_field, i, general_field_len, 5, ALPHANUMERIC, NUMERIC)) { /* 7.2.5.5.3/5.4.3 c) */ /* Note this rule can produce longer bitstreams if most of the alphanumerics are numeric */ strcat(binary_string, "00100"); /* Alphanumeric latch */ - mode = ALPHA; + mode = ALPHANUMERIC; } else if ((general_field[i] >= '0') && (general_field[i] <= '9')) { bin_append(general_field[i] - 43, 5, binary_string); i++; diff --git a/backend/general_field.h b/backend/general_field.h index 11db0710..184eb291 100644 --- a/backend/general_field.h +++ b/backend/general_field.h @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2007-2017 Robin Stuart + Copyright (C) 2019 - 2020 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -33,13 +33,13 @@ #define __GENERAL_FIELD_H #define NUMERIC 110 -#define ALPHA 97 +#define ALPHANUMERIC 97 #define ISOIEC 105 #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ - INTERNAL int general_field_encode(char* general_field, int* p_mode, int* p_last_digit, char binary_string[]); + INTERNAL int general_field_encode(char *general_field, int *p_mode, int *p_last_digit, char binary_string[]); #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/backend/gs1.c b/backend/gs1.c index 39791f8e..2bee8631 100644 --- a/backend/gs1.c +++ b/backend/gs1.c @@ -31,7 +31,6 @@ */ /* vim: set ts=4 sw=4 et : */ -#include #include #ifdef _MSC_VER #include @@ -69,6 +68,18 @@ static void itostr(char ai_string[], int ai_value) { strcat(ai_string, ")"); } +/* Returns the number of times a character occurs in a string */ +static int ustrchr_cnt(const unsigned char string[], const size_t length, const unsigned char c) { + int count = 0; + unsigned int i; + for (i = 0; i < length; i++) { + if (string[i] == c) { + count++; + } + } + return count; +} + INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[], const size_t src_len, char reduced[]) { int i, j, last_ai, ai_latch; char ai_string[7]; /* 6 char max "(NNNN)" */ diff --git a/backend/rss.c b/backend/rss.c index d71177be..84ebb099 100644 --- a/backend/rss.c +++ b/backend/rss.c @@ -109,16 +109,15 @@ static int combins(int n, int r) { * routine to generate widths for RSS elements for a given value.# * * Calling arguments: + * int widths[] = element widths * val = required value * n = number of modules * elements = elements in a set (RSS-14 & Expanded = 4; RSS Limited = 7) * maxWidth = maximum module width of an element * noNarrow = 0 will skip patterns without a one module wide element * - * Return: - * static int widths[] = element widths **********************************************************************/ -static void getRSSwidths(int val, int n, int elements, int maxWidth, int noNarrow) { +static void getRSSwidths(int widths[], int val, int n, int elements, int maxWidth, int noNarrow) { int bar; int elmWidth; int mxwElement; @@ -158,19 +157,132 @@ static void getRSSwidths(int val, int n, int elements, int maxWidth, int noNarro return; } -/* GS1 DataBar-14 */ +/* Calculate check digit from Annex A */ +static int calc_check_digit(unsigned char *src) { + int i, check_digit; + int count = 0; + + for (i = 0; i < 13; i++) { + count += (i & 1) ? ctoi(src[i]) : 3 * ctoi(src[i]); + } + check_digit = 10 - (count % 10); + if (check_digit == 10) { + check_digit = 0; + } + + return check_digit; +} + +/* Set GTIN-14 human readable text */ +static void set_gtin14_hrt(struct zint_symbol *symbol, unsigned char *source, int src_len) { + int i; + unsigned char hrt[15]; + + ustrcpy(symbol->text, "(01)"); + for (i = 0; i < 12; i++) { + hrt[i] = '0'; + } + for (i = 0; i < src_len; i++) { + hrt[12 - i] = source[src_len - i - 1]; + } + + hrt[13] = itoc(calc_check_digit(hrt)); + hrt[14] = '\0'; + + ustrcat(symbol->text, hrt); +} + +/* Expand from a width pattern to a bit pattern */ +static int rss_expand(struct zint_symbol *symbol, int writer, char *p_latch, int width) { + int j; + int latch = *p_latch; + + for (j = 0; j < width; j++) { + if (latch == '1') { + set_module(symbol, symbol->rows, writer); + } else { + unset_module(symbol, symbol->rows, writer); + } + writer++; + } + if (latch == '1') { + *p_latch = '0'; + } else { + *p_latch = '1'; + } + + return writer; +} + +/* Adjust top/bottom separator for finder patterns */ +static void rss14_finder_adjust(struct zint_symbol *symbol, int separator_row, int above_below, int finder_start) { + int i, finder_end; + int module_row = separator_row + above_below; + int latch; + + /* Alternation is always left-to-right for Omnidirectional separators (unlike for Expanded) */ + latch = '1'; + for (i = finder_start, finder_end = finder_start + 13; i < finder_end; i++) { + if (!module_is_set(symbol, module_row, i)) { + if (latch == '1') { + set_module(symbol, separator_row, i); + latch = '0'; + } else { + unset_module(symbol, separator_row, i); + latch = '1'; + } + } else { + unset_module(symbol, separator_row, i); + latch = '1'; + } + } +} + +/* Top/bottom separator for DataBar */ +static void rss14_separator(struct zint_symbol *symbol, int width, int separator_row, int above_below, int finder_start, int finder2_start, int bottom_finder_value_3) { + int i, finder_end, finder_value_3_set; + int module_row = separator_row + above_below; + + for (i = 4, width -= 4; i < width; i++) { + if (!module_is_set(symbol, module_row, i)) { + set_module(symbol, separator_row, i); + } + } + if (bottom_finder_value_3) { + /* ISO/IEC 24724:2011 5.3.2.2 "The single dark module that occurs in the 13 modules over finder value 3 is + * shifted one module to the right so that it is over the start of the three module-wide finder bar." */ + finder_value_3_set = finder_start + 10; + for (i = finder_start, finder_end = finder_start + 13; i < finder_end; i++) { + if (i == finder_value_3_set) { + set_module(symbol, separator_row, i); + } else { + unset_module(symbol, separator_row, i); + } + } + } else { + if (finder_start) { + rss14_finder_adjust(symbol, separator_row, above_below, finder_start); + } + if (finder2_start) { + rss14_finder_adjust(symbol, separator_row, above_below, finder2_start); + } + } +} + +/* GS1 DataBar Omnidirectional/Truncated/Stacked */ INTERNAL int rss14(struct zint_symbol *symbol, unsigned char source[], int src_len) { - int error_number = 0, i, j; + int error_number = 0, i; large_int accum; uint64_t left_pair, right_pair; int data_character[4] = {0}, data_group[4] = {0}, v_odd[4], v_even[4]; int data_widths[8][4], checksum, c_left, c_right, total_widths[46], writer; char latch; int separator_row; + int widths[4]; separator_row = 0; - if (src_len > 13) { + if (src_len > 14) { /* Allow check digit to be specified (will be verified and ignored) */ strcpy(symbol->errtxt, "380: Input too long"); return ZINT_ERROR_TOO_LONG; } @@ -180,6 +292,14 @@ INTERNAL int rss14(struct zint_symbol *symbol, unsigned char source[], int src_l return error_number; } + if (src_len == 14) { /* Verify check digit */ + if (calc_check_digit(source) != ctoi(source[13])) { + strcpy(symbol->errtxt, "388: Invalid check digit"); + return ZINT_ERROR_INVALID_CHECK; + } + src_len--; /* Ignore */ + } + /* make some room for a separator row for composite symbols */ switch (symbol->symbology) { case BARCODE_RSS14_CC: @@ -228,6 +348,7 @@ INTERNAL int rss14(struct zint_symbol *symbol, unsigned char source[], int src_l if ((data_character[0] >= 2715) && (data_character[0] <= 2840)) { data_group[0] = 4; } + if ((data_character[1] >= 0) && (data_character[1] <= 335)) { data_group[1] = 5; } @@ -240,6 +361,7 @@ INTERNAL int rss14(struct zint_symbol *symbol, unsigned char source[], int src_l if ((data_character[1] >= 1516) && (data_character[1] <= 1596)) { data_group[1] = 8; } + if ((data_character[3] >= 0) && (data_character[3] <= 335)) { data_group[3] = 5; } @@ -252,6 +374,7 @@ INTERNAL int rss14(struct zint_symbol *symbol, unsigned char source[], int src_l if ((data_character[3] >= 1516) && (data_character[3] <= 1596)) { data_group[3] = 8; } + if ((data_character[2] >= 0) && (data_character[2] <= 160)) { data_group[2] = 0; } @@ -281,23 +404,23 @@ INTERNAL int rss14(struct zint_symbol *symbol, unsigned char source[], int src_l /* Use RSS subset width algorithm */ for (i = 0; i < 4; i++) { if ((i == 0) || (i == 2)) { - getRSSwidths(v_odd[i], modules_odd[data_group[i]], 4, widest_odd[data_group[i]], 1); + getRSSwidths(widths, v_odd[i], modules_odd[data_group[i]], 4, widest_odd[data_group[i]], 1); data_widths[0][i] = widths[0]; data_widths[2][i] = widths[1]; data_widths[4][i] = widths[2]; data_widths[6][i] = widths[3]; - getRSSwidths(v_even[i], modules_even[data_group[i]], 4, widest_even[data_group[i]], 0); + getRSSwidths(widths, v_even[i], modules_even[data_group[i]], 4, widest_even[data_group[i]], 0); data_widths[1][i] = widths[0]; data_widths[3][i] = widths[1]; data_widths[5][i] = widths[2]; data_widths[7][i] = widths[3]; } else { - getRSSwidths(v_odd[i], modules_odd[data_group[i]], 4, widest_odd[data_group[i]], 0); + getRSSwidths(widths, v_odd[i], modules_odd[data_group[i]], 4, widest_odd[data_group[i]], 0); data_widths[0][i] = widths[0]; data_widths[2][i] = widths[1]; data_widths[4][i] = widths[2]; data_widths[6][i] = widths[3]; - getRSSwidths(v_even[i], modules_even[data_group[i]], 4, widest_even[data_group[i]], 1); + getRSSwidths(widths, v_even[i], modules_even[data_group[i]], 4, widest_even[data_group[i]], 1); data_widths[1][i] = widths[0]; data_widths[3][i] = widths[1]; data_widths[5][i] = widths[2]; @@ -326,6 +449,10 @@ INTERNAL int rss14(struct zint_symbol *symbol, unsigned char source[], int src_l c_left = checksum / 9; c_right = checksum % 9; + if (symbol->debug & ZINT_DEBUG_PRINT) { + printf("c_left: %d, c_right: %d\n", c_left, c_right); + } + /* Put element widths together */ total_widths[0] = 1; total_widths[1] = 1; @@ -344,95 +471,22 @@ INTERNAL int rss14(struct zint_symbol *symbol, unsigned char source[], int src_l /* Put this data into the symbol */ if ((symbol->symbology == BARCODE_RSS14) || (symbol->symbology == BARCODE_RSS14_CC)) { - int count; - int check_digit; - char hrt[15]; writer = 0; latch = '0'; for (i = 0; i < 46; i++) { - for (j = 0; j < total_widths[i]; j++) { - if (latch == '1') { - set_module(symbol, symbol->rows, writer); - } - writer++; - } - if (latch == '1') { - latch = '0'; - } else { - latch = '1'; - } + writer = rss_expand(symbol, writer, &latch, total_widths[i]); } if (symbol->width < writer) { symbol->width = writer; } if (symbol->symbology == BARCODE_RSS14_CC) { /* separator pattern for composite symbol */ - for (i = 4; i < 92; i++) { - if (!(module_is_set(symbol, separator_row + 1, i))) { - set_module(symbol, separator_row, i); - } - } - latch = '1'; - for (i = 16; i < 32; i++) { - if (!(module_is_set(symbol, separator_row + 1, i))) { - if (latch == '1') { - set_module(symbol, separator_row, i); - latch = '0'; - } else { - unset_module(symbol, separator_row, i); - latch = '1'; - } - } else { - unset_module(symbol, separator_row, i); - latch = '1'; - } - } - latch = '1'; - for (i = 63; i < 78; i++) { - if (!(module_is_set(symbol, separator_row + 1, i))) { - if (latch == '1') { - set_module(symbol, separator_row, i); - latch = '0'; - } else { - unset_module(symbol, separator_row, i); - latch = '1'; - } - } else { - unset_module(symbol, separator_row, i); - latch = '1'; - } - } + rss14_separator(symbol, 96, separator_row, 1 /*above*/, 18, 63, 0 /*bottom_finder_value_3*/); } symbol->rows = symbol->rows + 1; - count = 0; - check_digit = 0; - - /* Calculate check digit from Annex A and place human readable text */ - ustrcpy(symbol->text, (unsigned char*) "(01)"); - for (i = 0; i < 14; i++) { - hrt[i] = '0'; - } - for (i = 0; i < src_len; i++) { - hrt[12 - i] = source[src_len - i - 1]; - } - hrt[14] = '\0'; - - for (i = 0; i < 13; i++) { - count += ctoi(hrt[i]); - - if (!(i & 1)) { - count += 2 * (ctoi(hrt[i])); - } - } - - check_digit = 10 - (count % 10); - if (check_digit == 10) { - check_digit = 0; - } - hrt[13] = itoc(check_digit); - - strcat((char*) symbol->text, hrt); + /* Set human readable text */ + set_gtin14_hrt(symbol, source, src_len); set_minimum_height(symbol, 14); // Minimum height is 14X for truncated symbol } @@ -442,46 +496,25 @@ INTERNAL int rss14(struct zint_symbol *symbol, unsigned char source[], int src_l writer = 0; latch = '0'; for (i = 0; i < 23; i++) { - for (j = 0; j < total_widths[i]; j++) { - if (latch == '1') { - set_module(symbol, symbol->rows, writer); - } else { - unset_module(symbol, symbol->rows, writer); - } - writer++; - } - if (latch == '1') { - latch = '0'; - } else { - latch = '1'; - } + writer = rss_expand(symbol, writer, &latch, total_widths[i]); } set_module(symbol, symbol->rows, writer); unset_module(symbol, symbol->rows, writer + 1); symbol->row_height[symbol->rows] = 5; + /* bottom row */ symbol->rows = symbol->rows + 2; set_module(symbol, symbol->rows, 0); unset_module(symbol, symbol->rows, 1); - writer = 0; + writer = 2; latch = '1'; for (i = 23; i < 46; i++) { - for (j = 0; j < total_widths[i]; j++) { - if (latch == '1') { - set_module(symbol, symbol->rows, writer + 2); - } else { - unset_module(symbol, symbol->rows, writer + 2); - } - writer++; - } - if (latch == '1') { - latch = '0'; - } else { - latch = '1'; - } + writer = rss_expand(symbol, writer, &latch, total_widths[i]); } symbol->row_height[symbol->rows] = 7; + /* separator pattern */ + /* See #183 for this interpretation of ISO/IEC 24724:2011 5.3.2.1 */ for (i = 1; i < 46; i++) { if (module_is_set(symbol, symbol->rows - 2, i) == module_is_set(symbol, symbol->rows, i)) { if (!(module_is_set(symbol, symbol->rows - 2, i))) { @@ -497,28 +530,10 @@ INTERNAL int rss14(struct zint_symbol *symbol, unsigned char source[], int src_l unset_module(symbol, symbol->rows - 1, 2); unset_module(symbol, symbol->rows - 1, 3); symbol->row_height[symbol->rows - 1] = 1; + if (symbol->symbology == BARCODE_RSS14STACK_CC) { /* separator pattern for composite symbol */ - for (i = 4; i < 46; i++) { - if (!(module_is_set(symbol, separator_row + 1, i))) { - set_module(symbol, separator_row, i); - } - } - latch = '1'; - for (i = 16; i < 32; i++) { - if (!(module_is_set(symbol, separator_row + 1, i))) { - if (latch == '1') { - set_module(symbol, separator_row, i); - latch = '0'; - } else { - unset_module(symbol, separator_row, i); - latch = '1'; - } - } else { - unset_module(symbol, separator_row, i); - latch = '1'; - } - } + rss14_separator(symbol, 50, separator_row, 1 /*above*/, 18, 0, 0 /*bottom_finder_value_3*/); } symbol->rows = symbol->rows + 1; if (symbol->width < 50) { @@ -531,120 +546,48 @@ INTERNAL int rss14(struct zint_symbol *symbol, unsigned char source[], int src_l writer = 0; latch = '0'; for (i = 0; i < 23; i++) { - for (j = 0; j < total_widths[i]; j++) { - if (latch == '1') { - set_module(symbol, symbol->rows, writer); - } else { - unset_module(symbol, symbol->rows, writer); - } - writer++; - } - latch = (latch == '1' ? '0' : '1'); + writer = rss_expand(symbol, writer, &latch, total_widths[i]); } set_module(symbol, symbol->rows, writer); unset_module(symbol, symbol->rows, writer + 1); + /* bottom row */ symbol->rows = symbol->rows + 4; set_module(symbol, symbol->rows, 0); unset_module(symbol, symbol->rows, 1); - writer = 0; + writer = 2; latch = '1'; for (i = 23; i < 46; i++) { - for (j = 0; j < total_widths[i]; j++) { - if (latch == '1') { - set_module(symbol, symbol->rows, writer + 2); - } else { - unset_module(symbol, symbol->rows, writer + 2); - } - writer++; - } - if (latch == '1') { - latch = '0'; - } else { - latch = '1'; - } + writer = rss_expand(symbol, writer, &latch, total_widths[i]); } + /* middle separator */ for (i = 5; i < 46; i += 2) { set_module(symbol, symbol->rows - 2, i); } symbol->row_height[symbol->rows - 2] = 1; + /* top separator */ - for (i = 4; i < 46; i++) { - if (!(module_is_set(symbol, symbol->rows - 4, i))) { - set_module(symbol, symbol->rows - 3, i); - } - } - latch = '1'; - for (i = 17; i < 33; i++) { - if (!(module_is_set(symbol, symbol->rows - 4, i))) { - if (latch == '1') { - set_module(symbol, symbol->rows - 3, i); - latch = '0'; - } else { - unset_module(symbol, symbol->rows - 3, i); - latch = '1'; - } - } else { - unset_module(symbol, symbol->rows - 3, i); - latch = '1'; - } - } + rss14_separator(symbol, 50, symbol->rows - 3, -1 /*below*/, 18, 0, 0 /*bottom_finder_value_3*/); symbol->row_height[symbol->rows - 3] = 1; + /* bottom separator */ - for (i = 4; i < 46; i++) { - if (!(module_is_set(symbol, symbol->rows, i))) { - set_module(symbol, symbol->rows - 1, i); - } - } - latch = '1'; - for (i = 16; i < 32; i++) { - if (!(module_is_set(symbol, symbol->rows, i))) { - if (latch == '1') { - set_module(symbol, symbol->rows - 1, i); - latch = '0'; - } else { - unset_module(symbol, symbol->rows - 1, i); - latch = '1'; - } - } else { - unset_module(symbol, symbol->rows - 1, i); - latch = '1'; - } - } + /* 17 == 2 (guard) + 15 (inner char); +2 to skip over finder elements 4 & 5 (right to left) */ + rss14_separator(symbol, 50, symbol->rows - 1, 1 /*above*/, 17 + 2, 0, c_right == 3); symbol->row_height[symbol->rows - 1] = 1; if (symbol->width < 50) { symbol->width = 50; } + if (symbol->symbology == BARCODE_RSS14_OMNI_CC) { /* separator pattern for composite symbol */ - for (i = 4; i < 46; i++) { - if (!(module_is_set(symbol, separator_row + 1, i))) { - set_module(symbol, separator_row, i); - } - } - latch = '1'; - for (i = 16; i < 32; i++) { - if (!(module_is_set(symbol, separator_row + 1, i))) { - if (latch == '1') { - set_module(symbol, separator_row, i); - latch = '0'; - } else { - unset_module(symbol, separator_row, i); - latch = '1'; - } - } else { - unset_module(symbol, separator_row, i); - latch = '1'; - } - } + rss14_separator(symbol, 50, separator_row, 1 /*above*/, 18, 0, 0 /*bottom_finder_value_3*/); } symbol->rows = symbol->rows + 1; set_minimum_height(symbol, 33); } - return error_number; } @@ -655,13 +598,14 @@ INTERNAL int rsslimited(struct zint_symbol *symbol, unsigned char source[], int uint64_t left_character, right_character; int left_group, right_group, left_odd, left_even, right_odd, right_even; int left_widths[14], right_widths[14]; - int checksum, check_elements[14], total_widths[46], writer, j, check_digit, count; - char latch, hrt[15]; + int checksum, check_elements[14], total_widths[46], writer; + char latch; int separator_row; + int widths[7]; separator_row = 0; - if (src_len > 13) { + if (src_len > 14) { /* Allow check digit to be specified (will be verified and ignored) */ strcpy(symbol->errtxt, "382: Input too long"); return ZINT_ERROR_TOO_LONG; } @@ -670,6 +614,15 @@ INTERNAL int rsslimited(struct zint_symbol *symbol, unsigned char source[], int strcpy(symbol->errtxt, "383: Invalid characters in data"); return error_number; } + + if (src_len == 14) { /* Verify check digit */ + if (calc_check_digit(source) != ctoi(source[13])) { + strcpy(symbol->errtxt, "389: Invalid check digit"); + return ZINT_ERROR_INVALID_CHECK; + } + src_len--; /* Ignore */ + } + if (src_len == 13) { if ((source[0] != '0') && (source[0] != '1')) { strcpy(symbol->errtxt, "384: Input out of range"); @@ -745,38 +698,22 @@ INTERNAL int rsslimited(struct zint_symbol *symbol, unsigned char source[], int right_odd = right_character / t_even_ltd[right_group]; right_even = right_character % t_even_ltd[right_group]; - getRSSwidths(left_odd, modules_odd_ltd[left_group], 7, widest_odd_ltd[left_group], 1); - left_widths[0] = widths[0]; - left_widths[2] = widths[1]; - left_widths[4] = widths[2]; - left_widths[6] = widths[3]; - left_widths[8] = widths[4]; - left_widths[10] = widths[5]; - left_widths[12] = widths[6]; - getRSSwidths(left_even, modules_even_ltd[left_group], 7, widest_even_ltd[left_group], 0); - left_widths[1] = widths[0]; - left_widths[3] = widths[1]; - left_widths[5] = widths[2]; - left_widths[7] = widths[3]; - left_widths[9] = widths[4]; - left_widths[11] = widths[5]; - left_widths[13] = widths[6]; - getRSSwidths(right_odd, modules_odd_ltd[right_group], 7, widest_odd_ltd[right_group], 1); - right_widths[0] = widths[0]; - right_widths[2] = widths[1]; - right_widths[4] = widths[2]; - right_widths[6] = widths[3]; - right_widths[8] = widths[4]; - right_widths[10] = widths[5]; - right_widths[12] = widths[6]; - getRSSwidths(right_even, modules_even_ltd[right_group], 7, widest_even_ltd[right_group], 0); - right_widths[1] = widths[0]; - right_widths[3] = widths[1]; - right_widths[5] = widths[2]; - right_widths[7] = widths[3]; - right_widths[9] = widths[4]; - right_widths[11] = widths[5]; - right_widths[13] = widths[6]; + getRSSwidths(widths, left_odd, modules_odd_ltd[left_group], 7, widest_odd_ltd[left_group], 1); + for (i = 0; i <= 6; i++) { + left_widths[i * 2] = widths[i]; + } + getRSSwidths(widths, left_even, modules_even_ltd[left_group], 7, widest_even_ltd[left_group], 0); + for (i = 0; i <= 6; i++) { + left_widths[i * 2 + 1] = widths[i]; + } + getRSSwidths(widths, right_odd, modules_odd_ltd[right_group], 7, widest_odd_ltd[right_group], 1); + for (i = 0; i <= 6; i++) { + right_widths[i * 2] = widths[i]; + } + getRSSwidths(widths, right_even, modules_even_ltd[right_group], 7, widest_even_ltd[right_group], 0); + for (i = 0; i <= 6; i++) { + right_widths[i * 2 + 1] = widths[i]; + } checksum = 0; /* Calculate the checksum */ @@ -803,15 +740,7 @@ INTERNAL int rsslimited(struct zint_symbol *symbol, unsigned char source[], int writer = 0; latch = '0'; for (i = 0; i < 46; i++) { - for (j = 0; j < total_widths[i]; j++) { - if (latch == '1') { - set_module(symbol, symbol->rows, writer); - } else { - unset_module(symbol, symbol->rows, writer); - } - writer++; - } - latch = (latch == '1' ? '0' : '1'); + writer = rss_expand(symbol, writer, &latch, total_widths[i]); } if (symbol->width < writer) { symbol->width = writer; @@ -827,36 +756,8 @@ INTERNAL int rsslimited(struct zint_symbol *symbol, unsigned char source[], int } } - /* Calculate check digit from Annex A and place human readable text */ - - check_digit = 0; - count = 0; - - ustrcpy(symbol->text, (unsigned char*) "(01)"); - for (i = 0; i < 14; i++) { - hrt[i] = '0'; - } - for (i = 0; i < src_len; i++) { - hrt[12 - i] = source[src_len - i - 1]; - } - - for (i = 0; i < 13; i++) { - count += ctoi(hrt[i]); - - if (!(i & 1)) { - count += 2 * (ctoi(hrt[i])); - } - } - - check_digit = 10 - (count % 10); - if (check_digit == 10) { - check_digit = 0; - } - - hrt[13] = itoc(check_digit); - hrt[14] = '\0'; - - strcat((char*) symbol->text, hrt); + /* Set human readable text */ + set_gtin14_hrt(symbol, source, src_len); set_minimum_height(symbol, 10); @@ -875,8 +776,6 @@ static int rss_binary_string(struct zint_symbol *symbol, char source[], char bin int remainder, d1, d2; char padstring[40]; - read_posn = 0; - /* Decide whether a compressed data field is required and if so what method to use - method 2 = no compressed data field */ @@ -1315,6 +1214,67 @@ static int rss_binary_string(struct zint_symbol *symbol, char source[], char bin return 0; } +static void rssexp_separator(struct zint_symbol *symbol, int width, int cols, int separator_row, int above_below, int special_case_row, int left_to_right, int odd_last_row, int *p_v2_latch) { + int i, i_start, i_end, j, k; + int module_row = separator_row + above_below; + int v2_latch = p_v2_latch ? *p_v2_latch : 0; + int space_latch = 0; + + for (j = 4 + special_case_row, width -= 4; j < width; j++) { + if (module_is_set(symbol, module_row, j)) { + unset_module(symbol, separator_row, j); + } else { + set_module(symbol, separator_row, j); + } + } + + /* finder adjustment */ + for (j = 0; j < cols; j++) { + k = (49 * j) + 19 + special_case_row; /* 49 == data (17) + finder (15) + data(17) triplet, 19 == 2 (guard) + 17 (initial check/data character) */ + if (left_to_right) { + i_start = v2_latch ? 2 : 0; /* Last 13 modules of version 2 finder and first 13 modules of version 1 finder */ + i_end = v2_latch ? 15 : 13; + for (i = i_start; i < i_end; i++) { + if (module_is_set(symbol, module_row, i + k)) { + unset_module(symbol, separator_row, i + k); + space_latch = 0; + } else { + if (space_latch) { + unset_module(symbol, separator_row, i + k); + } else { + set_module(symbol, separator_row, i + k); + } + space_latch = !space_latch; + } + } + } else { + if (odd_last_row) { + k -= 17; /* No data char at beginning of row, i.e. ends with finder */ + } + i_start = v2_latch ? 14 : 12; /* First 13 modules of version 1 finder and last 13 modules of version 2 finder */ + i_end = v2_latch ? 2 : 0; + for (i = i_start; i >= i_end; i--) { + if (module_is_set(symbol, module_row, i + k)) { + unset_module(symbol, separator_row, i + k); + space_latch = 0; + } else { + if (space_latch) { + unset_module(symbol, separator_row, i + k); + } else { + set_module(symbol, separator_row, i + k); + } + space_latch = !space_latch; + } + } + } + v2_latch = !v2_latch; + } + + if (p_v2_latch && above_below == -1) { /* Only set if below */ + *p_v2_latch = v2_latch; + } +} + /* GS1 DataBar Expanded */ INTERNAL int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len) { int i, j, k, p, data_chars, vs[21], group[21], v_odd[21], v_even[21]; @@ -1323,6 +1283,7 @@ INTERNAL int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int int check_char, c_odd, c_even, elements[235], pattern_width, reader, writer; int separator_row; unsigned int bin_len = 13 * src_len + 200 + 1; /* Allow for 8 bits + 5-bit latch per char + 200 bits overhead/padding */ + int widths[4]; #ifndef _MSC_VER char reduced[src_len + 1], binary_string[bin_len]; #else @@ -1330,9 +1291,6 @@ INTERNAL int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int char* binary_string = (char*) _alloca(bin_len); #endif - separator_row = 0; - reader = 0; - i = gs1_verify(symbol, source, src_len, reduced); if (i != 0) { return i; @@ -1347,7 +1305,7 @@ INTERNAL int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int strcpy(binary_string, ""); - if (symbol->option_1 == 2) { + if (symbol->option_1 == 2) { /* The "component linkage" flag */ strcat(binary_string, "1"); } else { strcat(binary_string, "0"); @@ -1395,12 +1353,12 @@ INTERNAL int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int v_odd[i] = (vs[i] - g_sum_exp[group[i] - 1]) / t_even_exp[group[i] - 1]; v_even[i] = (vs[i] - g_sum_exp[group[i] - 1]) % t_even_exp[group[i] - 1]; - getRSSwidths(v_odd[i], modules_odd_exp[group[i] - 1], 4, widest_odd_exp[group[i] - 1], 0); + getRSSwidths(widths, v_odd[i], modules_odd_exp[group[i] - 1], 4, widest_odd_exp[group[i] - 1], 0); char_widths[i][0] = widths[0]; char_widths[i][2] = widths[1]; char_widths[i][4] = widths[2]; char_widths[i][6] = widths[3]; - getRSSwidths(v_even[i], modules_even_exp[group[i] - 1], 4, widest_even_exp[group[i] - 1], 1); + getRSSwidths(widths, v_even[i], modules_even_exp[group[i] - 1], 4, widest_even_exp[group[i] - 1], 1); char_widths[i][1] = widths[0]; char_widths[i][3] = widths[1]; char_widths[i][5] = widths[2]; @@ -1421,6 +1379,10 @@ INTERNAL int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int check_char = (211 * ((data_chars + 1) - 4)) + (checksum % 211); + if (symbol->debug & ZINT_DEBUG_PRINT) { + printf("Data chars: %d, Check char: %d\n", data_chars, check_char); + } + if (check_char <= 347) { c_group = 1; } @@ -1440,12 +1402,12 @@ INTERNAL int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int c_odd = (check_char - g_sum_exp[c_group - 1]) / t_even_exp[c_group - 1]; c_even = (check_char - g_sum_exp[c_group - 1]) % t_even_exp[c_group - 1]; - getRSSwidths(c_odd, modules_odd_exp[c_group - 1], 4, widest_odd_exp[c_group - 1], 0); + getRSSwidths(widths, c_odd, modules_odd_exp[c_group - 1], 4, widest_odd_exp[c_group - 1], 0); check_widths[0] = widths[0]; check_widths[2] = widths[1]; check_widths[4] = widths[2]; check_widths[6] = widths[3]; - getRSSwidths(c_even, modules_even_exp[c_group - 1], 4, widest_even_exp[c_group - 1], 1); + getRSSwidths(widths, c_even, modules_even_exp[c_group - 1], 4, widest_even_exp[c_group - 1], 1); check_widths[1] = widths[0]; check_widths[3] = widths[1]; check_widths[5] = widths[2]; @@ -1496,44 +1458,12 @@ INTERNAL int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int writer = 0; latch = '0'; for (i = 0; i < pattern_width; i++) { - for (j = 0; j < elements[i]; j++) { - if (latch == '1') { - set_module(symbol, symbol->rows, writer); - } else { - unset_module(symbol, symbol->rows, writer); - } - writer++; - } - if (latch == '1') { - latch = '0'; - } else { - latch = '1'; - } + writer = rss_expand(symbol, writer, &latch, elements[i]); } if (symbol->width < writer) { symbol->width = writer; } symbol->rows = symbol->rows + 1; - if (symbol->symbology == BARCODE_RSS_EXP_CC) { - for (j = 4; j < (symbol->width - 4); j++) { - if (module_is_set(symbol, separator_row + 1, j)) { - unset_module(symbol, separator_row, j); - } else { - set_module(symbol, separator_row, j); - } - } - /* finder bar adjustment */ - for (j = 0; j < (writer / 49); j++) { - k = (49 * j) + 18; - for (i = 0; i < 15; i++) { - if ((!(module_is_set(symbol, separator_row + 1, i + k - 1))) && - (!(module_is_set(symbol, separator_row + 1, i + k))) && - module_is_set(symbol, separator_row, i + k - 1)) { - unset_module(symbol, separator_row, i + k); - } - } - } - } /* Add human readable text */ for (i = 0; i <= src_len; i++) { @@ -1552,6 +1482,7 @@ INTERNAL int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int } else { int stack_rows; int current_row, current_block, left_to_right; + int v2_latch = 0; /* RSS Expanded Stacked */ /* Bug corrected: Character missing for message @@ -1560,8 +1491,7 @@ INTERNAL int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int */ int codeblocks = (data_chars + 1) / 2 + ((data_chars + 1) % 2); - - if ((symbol->option_2 < 1) || (symbol->option_2 > 10)) { + if ((symbol->option_2 < 1) || (symbol->option_2 > 11)) { symbol->option_2 = 2; } if ((symbol->option_1 == 2) && (symbol->option_2 == 1)) { @@ -1591,27 +1521,30 @@ INTERNAL int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int elements_in_sub = 2; /* Row Data */ + if (((symbol->option_2 & 1) || (current_row & 1)) || + ((current_row == stack_rows) && (codeblocks != (current_row * symbol->option_2)) && + (((current_row * symbol->option_2) - codeblocks) & 1))) { + left_to_right = 1; + } else { + left_to_right = 0; + } reader = 0; do { - if (((symbol->option_2 & 1) || (current_row & 1)) || - ((current_row == stack_rows) && (codeblocks != (current_row * symbol->option_2)) && - (((current_row * symbol->option_2) - codeblocks) & 1))) { + if (left_to_right) { /* left to right */ - left_to_right = 1; i = 2 + (current_block * 21); for (j = 0; j < 21; j++) { if ((i + j) < pattern_width) { - sub_elements[j + (reader * 21) + 2] = elements[i + j]; + sub_elements[j + (reader * 21) + 2] = elements[i + j]; } elements_in_sub++; } } else { /* right to left */ - left_to_right = 0; i = 2 + (((current_row * symbol->option_2) - reader - 1) * 21); for (j = 0; j < 21; j++) { if ((i + j) < pattern_width) { - sub_elements[(20 - j) + (reader * 21) + 2] = elements[i + j]; + sub_elements[(20 - j) + (reader * 21) + 2] = elements[i + j]; } elements_in_sub++; } @@ -1637,122 +1570,40 @@ INTERNAL int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int writer = 0; for (i = 0; i < elements_in_sub; i++) { - for (j = 0; j < sub_elements[i]; j++) { - if (latch == '1') { - set_module(symbol, symbol->rows, writer); - } else { - unset_module(symbol, symbol->rows, writer); - } - writer++; - } - if (latch == '1') { - latch = '0'; - } else { - latch = '1'; - } + writer = rss_expand(symbol, writer, &latch, sub_elements[i]); } if (symbol->width < writer) { symbol->width = writer; } if (current_row != 1) { + int odd_last_row = (current_row == stack_rows) && (data_chars % 2 == 0); + /* middle separator pattern (above current row) */ for (j = 5; j < (49 * symbol->option_2); j += 2) { set_module(symbol, symbol->rows - 2, j); } symbol->row_height[symbol->rows - 2] = 1; + /* bottom separator pattern (above current row) */ - for (j = 4 + special_case_row; j < (writer - 4); j++) { - if (module_is_set(symbol, symbol->rows, j)) { - unset_module(symbol, symbol->rows - 1, j); - } else { - set_module(symbol, symbol->rows - 1, j); - } - } + rssexp_separator(symbol, writer, reader, symbol->rows - 1, 1 /*above*/, special_case_row, left_to_right, odd_last_row, &v2_latch); symbol->row_height[symbol->rows - 1] = 1; - /* finder bar adjustment */ - for (j = 0; j < reader; j++) { - k = (49 * j) + 18 + special_case_row; - if (left_to_right) { - for (i = 0; i < 15; i++) { - if ((!(module_is_set(symbol, symbol->rows, i + k - 1))) && - (!(module_is_set(symbol, symbol->rows, i + k))) && - module_is_set(symbol, symbol->rows - 1, i + k - 1)) { - unset_module(symbol, symbol->rows - 1, i + k); - } - } - } else { - if ((current_row == stack_rows) && (data_chars % 2 == 0)) { - k -= 18; - } - for (i = 14; i >= 0; i--) { - if ((!(module_is_set(symbol, symbol->rows, i + k + 1))) && - (!(module_is_set(symbol, symbol->rows, i + k))) && - module_is_set(symbol, symbol->rows - 1, i + k + 1)) { - unset_module(symbol, symbol->rows - 1, i + k); - } - } - } - } } if (current_row != stack_rows) { /* top separator pattern (below current row) */ - for (j = 4; j < (writer - 4); j++) { - if (module_is_set(symbol, symbol->rows, j)) { - unset_module(symbol, symbol->rows + 1, j); - } else { - set_module(symbol, symbol->rows + 1, j); - } - } + rssexp_separator(symbol, writer, reader, symbol->rows + 1, -1 /*below*/, 0 /*special_case_row*/, left_to_right, 0 /*odd_last_row*/, &v2_latch); symbol->row_height[symbol->rows + 1] = 1; - /* finder bar adjustment */ - for (j = 0; j < reader; j++) { - k = (49 * j) + 18; - if (left_to_right) { - for (i = 0; i < 15; i++) { - if ((!(module_is_set(symbol, symbol->rows, i + k - 1))) && - (!(module_is_set(symbol, symbol->rows, i + k))) && - module_is_set(symbol, symbol->rows + 1, i + k - 1)) { - unset_module(symbol, symbol->rows + 1, i + k); - } - } - } else { - for (i = 14; i >= 0; i--) { - if ((!(module_is_set(symbol, symbol->rows, i + k + 1))) && - (!(module_is_set(symbol, symbol->rows, i + k))) && - module_is_set(symbol, symbol->rows + 1, i + k + 1)) { - unset_module(symbol, symbol->rows + 1, i + k); - } - } - } - } } symbol->rows = symbol->rows + 4; } symbol->rows = symbol->rows - 3; - if (symbol->symbology == BARCODE_RSS_EXPSTACK_CC) { - for (j = 4; j < (symbol->width - 4); j++) { - if (module_is_set(symbol, separator_row + 1, j)) { - unset_module(symbol, separator_row, j); - } else { - set_module(symbol, separator_row, j); - } - } - /* finder bar adjustment */ - for (j = 0; j < reader; j++) { - k = (49 * j) + 18; - for (i = 0; i < 15; i++) { - if ((!(module_is_set(symbol, separator_row + 1, i + k - 1))) && - (!(module_is_set(symbol, separator_row + 1, i + k))) && - module_is_set(symbol, separator_row, i + k - 1)) { - unset_module(symbol, separator_row, i + k); - } - } - } - } + } + if (symbol->symbology == BARCODE_RSS_EXP_CC || symbol->symbology == BARCODE_RSS_EXPSTACK_CC) { + /* Composite separator */ + rssexp_separator(symbol, symbol->width, 4, separator_row, 1 /*above*/, 0 /*special_case_row*/, 1 /*left_to_right*/, 0 /*odd_last_row*/, NULL); } for (i = 0; i < symbol->rows; i++) { diff --git a/backend/rss.h b/backend/rss.h index d6c1fb95..5676a572 100644 --- a/backend/rss.h +++ b/backend/rss.h @@ -2,7 +2,7 @@ /* libzint - the open source barcode library - Copyright (C) 2007-2017 Robin Stuart + Copyright (C) 2007 - 2020 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -56,7 +56,6 @@ static const char widest_even[9] = { 1, 3, 5, 6, 8, 7, 5, 3, 1 }; -static int widths[8]; static const char finder_pattern[45] = { 3, 8, 2, 1, 1, 3, 5, 5, 1, 1, diff --git a/backend/tests/CMakeLists.txt b/backend/tests/CMakeLists.txt index f3f55690..492bc8a9 100644 --- a/backend/tests/CMakeLists.txt +++ b/backend/tests/CMakeLists.txt @@ -22,6 +22,14 @@ else() add_definitions(-DNO_PNG) endif() +set(BWIPP_TAR ${CMAKE_CURRENT_SOURCE_DIR}/tools/bwipp_dump.ps.tar.xz) +set(BWIPP_PS ${CMAKE_CURRENT_SOURCE_DIR}/tools/bwipp_dump.ps) + +if(NOT EXISTS ${BWIPP_PS}) + execute_process(COMMAND ${CMAKE_COMMAND} -E tar -xf ${BWIPP_TAR} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tools) +endif() + if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") if(ZINT_DEBUG) add_compile_options("-g") diff --git a/backend/tests/test_channel.c b/backend/tests/test_channel.c index 2882bdae..6eaf2643 100644 --- a/backend/tests/test_channel.c +++ b/backend/tests/test_channel.c @@ -122,6 +122,8 @@ static void test_encode(int index, int generate, int debug) { testStart(""); + int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise + int ret; struct item { int option_2; @@ -348,6 +350,8 @@ static void test_encode(int index, int generate, int debug) { int data_size = ARRAY_SIZE(data); char escaped[1024]; + char bwipp_buf[8192]; + char bwipp_msg[1024]; for (int i = 0; i < data_size; i++) { @@ -377,6 +381,15 @@ static void test_encode(int index, int generate, int debug) { ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row); assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data); } + + if (do_bwipp && testUtilCanBwipp(symbol->symbology, -1, data[i].option_2, -1, debug)) { + ret = testUtilBwipp(symbol, -1, data[i].option_2, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf)); + assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); + + ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected); + assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", + i, testUtilBarcodeName(symbol->symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); + } } } diff --git a/backend/tests/test_codablock.c b/backend/tests/test_codablock.c index 7b757540..83ddbf89 100644 --- a/backend/tests/test_codablock.c +++ b/backend/tests/test_codablock.c @@ -320,6 +320,8 @@ static void test_encode(int index, int generate, int debug) { testStart(""); + int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise + int ret; struct item { int symbology; @@ -330,54 +332,55 @@ static void test_encode(int index, int generate, int debug) { int expected_rows; int expected_width; + int bwipp_cmp; char *comment; char *expected; }; struct item data[] = { - /* 0*/ { BARCODE_CODABLOCKF, 1, -1, "AIM", 0, 1, 68, "Same as CODE128", + /* 0*/ { BARCODE_CODABLOCKF, 1, -1, "AIM", 0, 1, 68, 1, "Same as CODE128 (not supported by BWIPP)", "11010010000101000110001100010001010111011000101110110001100011101011" }, - /* 1*/ { BARCODE_CODABLOCKF, -1, -1, "AAAAAAA", 0, 3, 101, "Defaults to rows 3, columns 9 (4 data); verified manually against bwipp and tec-it", + /* 1*/ { BARCODE_CODABLOCKF, -1, -1, "AAAAAAA", 0, 3, 101, 1, "Defaults to rows 3, columns 9 (4 data); verified manually against tec-it", "11010000100101111011101001011000010100011000101000110001010001100010100011000110110011001100011101011" "11010000100101111011101100010010010100011000101000110001010001100010111011110100100111101100011101011" "11010000100101111011101011001110010111011110101111011101100001010011011101110111100101001100011101011" }, - /* 2*/ { BARCODE_CODABLOCKF, -1, -1, "AAAAAAAAAA", 0, 3, 101, "Defaults to rows 3, columns 9 (4 data); verified manually against bwipp and tec-it", + /* 2*/ { BARCODE_CODABLOCKF, -1, -1, "AAAAAAAAAA", 0, 3, 101, 1, "Defaults to rows 3, columns 9 (4 data); verified manually against tec-it", "11010000100101111011101001011000010100011000101000110001010001100010100011000110110011001100011101011" "11010000100101111011101100010010010100011000101000110001010001100010100011000111101000101100011101011" "11010000100101111011101011001110010100011000101000110001110110010010010110000111000101101100011101011" }, - /* 3*/ { BARCODE_CODABLOCKF, -1, -1, "AAAAAAAAAAA", 0, 4, 101, "Defaults to rows 4, columns 9 (4 data); verified manually against bwipp and tec-it", + /* 3*/ { BARCODE_CODABLOCKF, -1, -1, "AAAAAAAAAAA", 0, 4, 101, 1, "Defaults to rows 4, columns 9 (4 data); verified manually against tec-it", "11010000100101111011101001000011010100011000101000110001010001100010100011000110011001101100011101011" "11010000100101111011101100010010010100011000101000110001010001100010100011000111101000101100011101011" "11010000100101111011101011001110010100011000101000110001010001100010111011110100111101001100011101011" "11010000100101111011101001101110010111011110101111011101110101100011101100100110010111001100011101011" }, - /* 4*/ { BARCODE_CODABLOCKF, -1, -1, "AAAAAAAAAAAAAA", 0, 4, 101, "Defaults to rows 4, columns 9 (4 data); verified manually against bwipp and tec-it", + /* 4*/ { BARCODE_CODABLOCKF, -1, -1, "AAAAAAAAAAAAAA", 0, 4, 101, 1, "Defaults to rows 4, columns 9 (4 data); verified manually against tec-it", "11010000100101111011101001000011010100011000101000110001010001100010100011000110011001101100011101011" "11010000100101111011101100010010010100011000101000110001010001100010100011000111101000101100011101011" "11010000100101111011101011001110010100011000101000110001010001100010100011000101111011101100011101011" "11010000100101111011101001101110010100011000101000110001011110100010111011000100110000101100011101011" }, - /* 5*/ { BARCODE_CODABLOCKF, -1, -1, "AAAAAAAAAAAAAAA", 0, 5, 101, "Defaults to rows 5, columns 9 (4 data); verified manually against bwipp (columns=4) and tec-it", + /* 5*/ { BARCODE_CODABLOCKF, -1, -1, "AAAAAAAAAAAAAAA", 0, 5, 101, 1, "Defaults to rows 5, columns 9 (4 data); verified manually against tec-it", "11010000100101111011101000010110010100011000101000110001010001100010100011000100100011001100011101011" "11010000100101111011101100010010010100011000101000110001010001100010100011000111101000101100011101011" "11010000100101111011101011001110010100011000101000110001010001100010100011000101111011101100011101011" "11010000100101111011101001101110010100011000101000110001010001100010111011110111101001001100011101011" "11010000100101111011101001100111010111011110101111011101000110001010111101000110001010001100011101011" }, - /* 6*/ { BARCODE_CODABLOCKF, -1, 14, "AAAAAAAAAAAAAAA", 0, 2, 156, "Rows 2, columns 14 (9 data); verified manually against bwipp (columns=9) and tec-it", + /* 6*/ { BARCODE_CODABLOCKF, -1, 14, "AAAAAAAAAAAAAAA", 0, 2, 156, 1, "Rows 2, columns 14 (9 data); verified manually against tec-it", "110100001001011110111010100001100101000110001010001100010100011000101000110001010001100010100011000101000110001010001100010100011000110001000101100011101011" "110100001001011110111011000100100101000110001010001100010100011000101000110001010001100010100011000101110111101110111101011011000110111000101101100011101011" }, - /* 7*/ { BARCODE_CODABLOCKF, -1, -1, "AAAAAAAAAAAAAAAA", 0, 5, 101, "Defaults to rows 5, columns 9 (4 data); verified manually against bwipp (columns=4) and tec-it", + /* 7*/ { BARCODE_CODABLOCKF, -1, -1, "AAAAAAAAAAAAAAAA", 0, 5, 101, 1, "Defaults to rows 5, columns 9 (4 data); verified manually against tec-it", "11010000100101111011101000010110010100011000101000110001010001100010100011000100100011001100011101011" "11010000100101111011101100010010010100011000101000110001010001100010100011000111101000101100011101011" "11010000100101111011101011001110010100011000101000110001010001100010100011000101111011101100011101011" "11010000100101111011101001101110010100011000101000110001010001100010100011000111101011101100011101011" "11010000100101111011101001100111010111011110101111011101011100011010001100010100011101101100011101011" }, - /* 8*/ { BARCODE_CODABLOCKF, -1, -1, "AAAAAAAAAAAAAAAAAAAAAAAAA", 0, 6, 112, "Defaults to rows 6, columns 10 (5 data); verified manually against bwipp (columns=5) and tec-it", + /* 8*/ { BARCODE_CODABLOCKF, -1, -1, "AAAAAAAAAAAAAAAAAAAAAAAAA", 0, 6, 112, 1, "Defaults to rows 6, columns 10 (5 data); verified manually against tec-it", "1101000010010111101110100001001101010001100010100011000101000110001010001100010100011000110110001101100011101011" "1101000010010111101110110001001001010001100010100011000101000110001010001100010100011000110010011101100011101011" "1101000010010111101110101100111001010001100010100011000101000110001010001100010100011000110011101001100011101011" @@ -385,23 +388,23 @@ static void test_encode(int index, int generate, int debug) { "1101000010010111101110100110011101010001100010100011000101000110001010001100010100011000111001001101100011101011" "1101000010010111101110101110011001011101111010111101110101110111101110100011010100001100110001010001100011101011" }, - /* 9*/ { BARCODE_CODABLOCKF, 4, -1, "CODABLOCK F 34567890123456789010040digit", 0, 4, 145, "AIM ISS-X-24 Figure 1", + /* 9*/ { BARCODE_CODABLOCKF, 4, -1, "CODABLOCK F 34567890123456789010040digit", 0, 4, 145, 1, "AIM ISS-X-24 Figure 1", "1101000010010111101110100100001101000100011010001110110101100010001010001100010001011000100011011101000111011010001000110110110011001100011101011" "1101000010010111101110110001001001011000111011011001100100011000101101100110010111011110100010110001110001011011000010100101100111001100011101011" "1101000010010111011110100011011101101111011010110011100100010110001110001011011000010100110111101101100100010010010001100100011000101100011101011" "1101000010010111101110100110111001001110110010000100110100001101001001101000010000110100100111101001101110111010111000110110010000101100011101011" }, - /* 10*/ { BARCODE_CODABLOCKF, 3, -1, "CODABLOCK F Symbology", 0, 3, 145, "AIM ISS-X-24 Figure on front page", + /* 10*/ { BARCODE_CODABLOCKF, 3, -1, "CODABLOCK F Symbology", 0, 3, 145, 1, "AIM ISS-X-24 Figure on front page", "1101000010010111101110100101100001000100011010001110110101100010001010001100010001011000100011011101000111011010001000110111010111101100011101011" "1101000010010111101110110001001001011000111011011001100100011000101101100110011011101000110110111101111011101010010000110100100111101100011101011" "1101000010010111101110101100111001000111101011001010000100011110101001101000011011011110101110111101000011001011011101110101001111001100011101011" }, - /* 11*/ { BARCODE_HIBC_BLOCKF, 3, -1, "A123BJC5D6E71", 0, 3, 123, "Verified manually against tec-it; differs from bwipp (columns=6) which uses Code C for final 71 (same no. of codewords)", + /* 11*/ { BARCODE_HIBC_BLOCKF, 3, -1, "A123BJC5D6E71", 0, 3, 123, 0, "Verified manually against tec-it; differs from BWIPP (columns=6) which uses Code C for final 71 (same no. of codewords)", "110100001001011110111010010110000110001001001010001100010011100110110011100101100101110010001011000100100001101100011101011" "110100001001011110111011000100100101101110001000100011011011100100101100010001100111010010001101000111001001101100011101011" "110100001001011110111010110011100111011011101001110011011010001000101110111101011100011011001110100100100110001100011101011" }, - /* 12*/ { BARCODE_HIBC_BLOCKF, -1, -1, "$$52001510X3G", 0, 4, 101, "Verified manually against bwipp (columns=4); tec-it differs as adds unnecessary Code C at end of 1st line", + /* 12*/ { BARCODE_HIBC_BLOCKF, -1, -1, "$$52001510X3G", 0, 4, 101, 1, "tec-it differs as adds unnecessary Code C at end of 1st line", "11010000100101111011101001000011011000100100100100011001001000110011011100100101110011001100011101011" "11010000100101110111101011000111011001001110110011011001101110100010111101110100001100101100011101011" "11010000100101111011101011001110010011101100111000101101100101110011010001000100100011001100011101011" @@ -411,6 +414,8 @@ static void test_encode(int index, int generate, int debug) { int data_size = ARRAY_SIZE(data); char escaped[1024]; + char bwipp_buf[8192]; + char bwipp_msg[1024]; for (int i = 0; i < data_size; i++) { @@ -425,9 +430,9 @@ static void test_encode(int index, int generate, int debug) { assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { - printf(" /*%3d*/ { %s, %d, %d, \"%s\", %s, %d, %d, \"%s\",\n", + printf(" /*%3d*/ { %s, %d, %d, \"%s\", %s, %d, %d, %d, \"%s\",\n", i, testUtilBarcodeName(data[i].symbology), data[i].option_1, data[i].option_2, testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), - testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].comment); + testUtilErrorName(data[i].ret), symbol->rows, data[i].bwipp_cmp, symbol->width, data[i].comment); testUtilModulesDump(symbol, " ", "\n"); printf(" },\n"); } else { @@ -440,6 +445,19 @@ static void test_encode(int index, int generate, int debug) { ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row); assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data); } + + if (do_bwipp && testUtilCanBwipp(symbol->symbology, data[i].option_1, data[i].option_2, -1, debug)) { + if (!data[i].bwipp_cmp) { + if (debug & ZINT_DEBUG_TEST_PRINT) printf("%d: %s skipped, not BWIPP compatible\n", i, testUtilBarcodeName(symbol->symbology)); + } else { + ret = testUtilBwipp(symbol, data[i].option_1, data[i].option_2, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf)); + assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), ret); + + ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected); + assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", + i, testUtilBarcodeName(data[i].symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); + } + } } } diff --git a/backend/tests/test_code.c b/backend/tests/test_code.c index bffc7f8a..50cd81a9 100644 --- a/backend/tests/test_code.c +++ b/backend/tests/test_code.c @@ -241,6 +241,8 @@ static void test_encode(int index, int generate, int debug) { testStart(""); + int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise + int ret; struct item { int symbology; @@ -337,6 +339,8 @@ static void test_encode(int index, int generate, int debug) { int data_size = ARRAY_SIZE(data); char escaped[1024]; + char bwipp_buf[8192]; + char bwipp_msg[1024]; for (int i = 0; i < data_size; i++) { @@ -366,6 +370,15 @@ static void test_encode(int index, int generate, int debug) { ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row); assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data); } + + if (do_bwipp && testUtilCanBwipp(symbol->symbology, -1, data[i].option_2, -1, debug)) { + ret = testUtilBwipp(symbol, -1, data[i].option_2, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf)); + assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), ret); + + ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected); + assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", + i, testUtilBarcodeName(data[i].symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); + } } } diff --git a/backend/tests/test_code128.c b/backend/tests/test_code128.c index d9a2ba61..a3e41743 100644 --- a/backend/tests/test_code128.c +++ b/backend/tests/test_code128.c @@ -432,6 +432,8 @@ static void test_encode(int index, int generate, int debug) { testStart(""); + int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise + int ret; struct item { int symbology; @@ -521,10 +523,10 @@ static void test_encode(int index, int generate, int debug) { /* 24*/ { BARCODE_EAN128, GS1_MODE, "[00]340433935039756615", 0, 1, 156, "DHL Identcode https://www.dhl.de/de/geschaeftskunden/paket/information/geschaeftskunden/abrechnung/leitcodierung.html", "110100111001111010111011011001100100010110001001000110010100011000101000111101100010111011010001000110000100101001000011010111001100100111001101100011101011" }, - /* 25*/ { BARCODE_EAN14, GS1_MODE, "4070071967072", 0, 1, 134, "Verified manually against bwipp and tec-it", + /* 25*/ { BARCODE_EAN14, GS1_MODE, "4070071967072", 0, 1, 134, "Verified manually against tec-it", "11010011100111101011101100110110011000101000101100001001001100010011001011100100001011001001100010011001001110110111001001100011101011" }, - /* 26*/ { BARCODE_NVE18, GS1_MODE, "40700000071967072", 0, 1, 156, "Verified manually against bwipp (sscc18) and tec-it", + /* 26*/ { BARCODE_NVE18, GS1_MODE, "40700000071967072", 0, 1, 156, "Verified manually against tec-it", "110100111001111010111011011001100110001010001011000010011011001100110110011001001100010011001011100100001011001001100010011001001110110111011101100011101011" }, /* 27*/ { BARCODE_HIBC_128, UNICODE_MODE, "83278F8G9H0J2G", 0, 1, 211, "ANSI/HIBC 2.6 - 2016 Section 4.1, not same, uses different encoding (eg begins StartA instead of StartB)", @@ -540,6 +542,8 @@ static void test_encode(int index, int generate, int debug) { int data_size = sizeof(data) / sizeof(struct item); char escaped[1024]; + char bwipp_buf[8192]; + char bwipp_msg[1024]; for (int i = 0; i < data_size; i++) { @@ -569,6 +573,15 @@ static void test_encode(int index, int generate, int debug) { ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row); assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data); } + + if (do_bwipp && testUtilCanBwipp(symbol->symbology, -1, -1, -1, debug)) { + ret = testUtilBwipp(symbol, -1, -1, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf)); + assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), ret); + + ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected); + assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", + i, testUtilBarcodeName(data[i].symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); + } } } diff --git a/backend/tests/test_composite.c b/backend/tests/test_composite.c index 87c2ed5e..c98eec27 100644 --- a/backend/tests/test_composite.c +++ b/backend/tests/test_composite.c @@ -38,8 +38,8 @@ static void test_eanx_leading_zeroes(int index, int debug) { int ret; struct item { int symbology; - unsigned char *data; - unsigned char *composite; + char *data; + char *composite; int ret; int expected_rows; @@ -90,10 +90,13 @@ static void test_eanx_leading_zeroes(int index, int debug) { int composite_length = strlen(data[i].composite); - ret = ZBarcode_Encode(symbol, data[i].composite, composite_length); - assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret); - assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n", i, symbol->rows, data[i].expected_rows); - assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width); + ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].composite, composite_length); + assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); + + if (ret < 5) { + assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n", i, symbol->rows, data[i].expected_rows); + assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width); + } ZBarcode_Delete(symbol); } @@ -101,41 +104,57 @@ static void test_eanx_leading_zeroes(int index, int debug) { testFinish(); } -static void test_helper_generate(const struct zint_symbol *symbol, int ret, int i, unsigned char *data, unsigned char *composite, int option_1, int option_2, int option_3, char *comment) { +static void test_helper_generate(const struct zint_symbol *symbol, int ret, int i, char *data, char *composite, int option_1, char *comment, int bwipp_cmp) { + char esc_data[1024]; + char esc_composite[4096]; + + testUtilEscape(data, strlen(data), esc_data, sizeof(esc_data)); + testUtilEscape(composite, strlen(composite), esc_composite, sizeof(esc_composite)); + if (ret == 0) { - printf(" /*%2d*/ { %s, \"%s\", \"%s\", %d, %d, %d, %d, %d, %d, \"%s\",\n", - i, testUtilBarcodeName(symbol->symbology), data, composite, option_1, option_2, option_3, ret, symbol->rows, symbol->width, comment); + if (bwipp_cmp == -1) { + printf(" /*%2d*/ { %s, %d, \"%s\", \"%s\", %d, %d, %d, \"%s\",\n", + i, testUtilBarcodeName(symbol->symbology), option_1, esc_data, esc_composite, ret, symbol->rows, symbol->width, comment); + } else { + printf(" /*%2d*/ { %s, %d, \"%s\", \"%s\", %d, %d, %d, %d, \"%s\",\n", + i, testUtilBarcodeName(symbol->symbology), option_1, esc_data, esc_composite, ret, symbol->rows, symbol->width, bwipp_cmp, comment); + } testUtilModulesDump(symbol, " ", "\n"); printf(" },\n"); } else { - printf(" /*%2d*/ { %s, \"%s\", \"%s\", %d, %d, %d, %s, %d, %d, \"%s\", \"\" },\n", - i, testUtilBarcodeName(symbol->symbology), data, composite, option_1, option_2, option_3, testUtilErrorName(ret), symbol->rows, symbol->width, comment); + if (bwipp_cmp == -1) { + printf(" /*%2d*/ { %s, %d, \"%s\", \"%s\", %s, %d, %d, \"%s\", \"\" },\n", + i, testUtilBarcodeName(symbol->symbology), option_1, esc_data, esc_composite, testUtilErrorName(ret), symbol->rows, symbol->width, comment); + } else { + printf(" /*%2d*/ { %s, %d, \"%s\", \"%s\", %s, %d, %d, %d, \"%s\", \"\" },\n", + i, testUtilBarcodeName(symbol->symbology), option_1, esc_data, esc_composite, testUtilErrorName(ret), symbol->rows, symbol->width, bwipp_cmp, comment); + } } } -// Replicate examples from GS1 General Specifications 19.1 and ISO/IEC 24723:2010 +// Replicate examples from GS1 General Specifications 20.0 and ISO/IEC 24723:2010 static void test_examples(int index, int generate, int debug) { testStart(""); + int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise + int ret; struct item { int symbology; - unsigned char *data; - unsigned char *composite; int option_1; - int option_2; - int option_3; + char *data; + char *composite; int ret; int expected_rows; int expected_width; char *comment; - unsigned char *expected; + char *expected; }; - // Verified manually against GS1 General Specifications 19.1 and ISO/IEC 24723:2010, with noted exceptions + // Verified manually against GS1 General Specifications 20.0 (GGS) and ISO/IEC 24723:2010, with noted exceptions, and verified via bwipp_dump.ps against BWIPP struct item data[] = { - /* 0*/ { BARCODE_RSS14_OMNI_CC, "0401234567890", "[17]050101[10]ABC123", 1, 0, 0, 0, 11, 56, "Figure 5.1-5. GS1 DataBar Stacked Omnidirectional barcode with a Composite Component", + /* 0*/ { BARCODE_RSS14_OMNI_CC, 1, "0401234567890", "[17]050101[10]ABC123", 0, 11, 56, "GSS Figure 5.1-5. GS1 DataBar Stacked Omnidirectional barcode with a Composite Component", "01101100110101110001001100001000000110100111011110101001" "01101101110110001100010100001100001000010110011100101001" "01101101100111000101110001101001100011111010011101101001" @@ -148,7 +167,7 @@ static void test_examples(int index, int generate, int debug) { "00001000110000101010000000101010111011001111000000000000" "10100111001111010101111111000001000100110000110101000000" }, - /* 1*/ { BARCODE_RSS_LTD_CC, "1311234567890", "[17]010615[10]A123456", 1, 0, 0, 0, 6, 74, "Figure 5.9.2-1. GS1 DataBar Limited Composite symbol with CC-A", + /* 1*/ { BARCODE_RSS_LTD_CC, 1, "1311234567890", "[17]010615[10]A123456", 0, 6, 74, "GGS Figure 5.9.2-1. (24723:2010 Figure 1) GS1 DataBar Limited Composite symbol with CC-A", "01111000101101100010100110001111101001100111011101001111001110111010011010" "01001111100011010010101110001111011110101111010011110111001110111010111010" "01001100110100000010101100001110010001101111011110111100101000111010110010" @@ -156,7 +175,7 @@ static void test_examples(int index, int generate, int debug) { "00000011000001010100110011101010110101001100101011110001011001101001110000" "01011100111110101011001100010101001010110011010100001110100110010110000101" }, - /* 2*/ { BARCODE_EAN128_CC, "[01]03812345678908", "[10]ABCD123456[410]3898765432108", 3, 0, 0, 0, 7, 154, "Figure 5.9.2-2. GS1-128 Composite symbol with CC-C **NOT SAME** (uses encodation '10')", + /* 2*/ { BARCODE_EAN128_CC, 3, "[01]03812345678908", "[10]ABCD123456[410]3898765432108", 0, 7, 154, "GGS Figure 5.9.2-2. GS1-128 Composite symbol with CC-C **NOT SAME** as zint uses encodation '10', same if '0' forced", "1111111101010100011110101011110000111101011001111101110111110111010010000010000100010110010000101100001111011110110011011110101001111000111111101000101001" "1111111101010100011111101010001110100001000111101001100101110010000011100001011000100100100111110110001011100001011111011111101010111000111111101000101001" "1111111101010100011101010011111100110001111010001101000101011110000010001111101100010111101101111101001001011000111110011101010001111110111111101000101001" @@ -165,7 +184,16 @@ static void test_examples(int index, int generate, int debug) { "0000000001011000110000101000100110010011011011001110110100001100010010001010001001110111101001100100100001011100110110100001000100100001001001110001010000" "0000000110100111001111010111011001101100100100110001001011110011101101110101110110001000010110011011011110100011001001011110111011011110110110001110101100" }, - /* 3*/ { BARCODE_EANX_CC, "331234567890", "[21]1234-abcd", 1, 0, 0, 0, 7, 99, "Figure 5.9.8-1. EAN-13 symbol with a four-column CC-A component (note [21] not [99])", + /* 3*/ { BARCODE_EAN128_CC, 3, "[01]93812345678901", "[10]ABCD123456[410]3898765432108", 0, 7, 154, "24723:2010 Figure 2 GS1-128 Composite symbol with 5-row CC-C **NOT SAME** ditto as above", + "1111111101010100011110101011110000111101011001111101110111110111010010000010000100010110010000101100001111011110110011011110101001111000111111101000101001" + "1111111101010100011111101010001110100001000111101001100101110010000011100001011000100100100111110110001011100001011111011111101010111000111111101000101001" + "1111111101010100011101010011111100110001111010001101000101011110000010001111101100010111101101111101001001011000111110011101010001111110111111101000101001" + "1111111101010100010101111001111000110010011001110001111010100111100010011110111101000110000110001000101100001011101111011111010111111010111111101000101001" + "1111111101010100011101011100001100101000111111011101011110001001111011111011001000100111100111011101001101101111001000011101011100110000111111101000101001" + "0000000001011000110000101000100110010011010111000010110100001100010010001010001001110111101001100100100001001100100110100001000100001001001001110001010000" + "0000000110100111001111010111011001101100101000111101001011110011101101110101110110001000010110011011011110110011011001011110111011110110110110001110101100" + }, + /* 4*/ { BARCODE_EANX_CC, 1, "331234567890", "[21]1234-abcd", 0, 7, 99, "GGS Figure 5.9.8-1. EAN-13 symbol with a four-column CC-A component (note [21] not [99])", "110110111011010000100000110100110011101100001001110100100001011001100001100111000110001011011000101" "110110110011000110111100010111011001110000101001100100100000010111101001101011100010000011001000101" "110110100010011010001110000111111010001100101001100110111111010001101001010000011011111011101000101" @@ -174,7 +202,16 @@ static void test_examples(int index, int generate, int debug) { "000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010" "000101011110100110010011011010000100111010110001010101010000100010010010001110100111001010000101010" }, - /* 4*/ { BARCODE_UPCA_CC, "61414101234", "[91]abcdefghijklmnopqrstuvwxyz", 2, 0, 0, 0, 14, 99, "Figure 5.9.8-2. UPC-A symbol with a four-column CC-B component **NOT SAME** (using [91] not [10] as length > 20 max for [10])", + /* 5*/ { BARCODE_EANX_CC, 1, "331234567890", "[99]1234-abcd", 0, 7, 99, "24723:2010 Figure 5 An EAN-13 composite symbol (with CC-A)", + "110110111011100110111011110100010100000010001001110100111011010110000001100110010000100011011000101" + "110110110011100010011101100111110001000101101001100100100001101011111101101011100010000011001000101" + "110110100010001011101111110110011100100011101001100110100000011101011001011110001001000011101000101" + "000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010" + "001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001" + "000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010" + "000101011110100110010011011010000100111010110001010101010000100010010010001110100111001010000101010" + }, + /* 6*/ { BARCODE_UPCA_CC, 2, "61414101234", "[91]abcdefghijklmnopqrstuvwxyz", 0, 14, 99, "GGS Figure 5.9.8-2. UPC-A symbol with a four-column CC-B component **NOT SAME** (using [91] not [10] as length > 20 max for [10])", "110001001010000001110010110110011111101100101001111010100100101111000001110101001111110011000100101" "111001001011101110101000000111101101000111001011111010100011000110000101110011010000110011100100101" "111101001011110110001101000111101000100000101011110010101001111001000001011111010001110011110100101" @@ -190,7 +227,7 @@ static void test_examples(int index, int generate, int debug) { "000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010" "000101010111100110010100011001100101000110011001010101110010110011011011001000010101110010000101010" }, - /* 5*/ { BARCODE_EANX_CC, "1234567", "[21]A12345678", -1, 0, 0, 0, 8, 72, "Figure 5.9.8-3. EAN-8 symbol with a three-column CC-A", + /* 7*/ { BARCODE_EANX_CC, -1, "1234567", "[21]A12345678", 0, 8, 72, "GGS Figure 5.9.8-3. (24723:2010 Figure 4) EAN-8 symbol with a three-column CC-A", "101001111000001001010011000111110101110111101001101001111110011101001101" "111110010011100101010111000101110011011100001111110100011001011101011101" "110011001000010001010110000101000001000010001001000110110000011101011001" @@ -200,7 +237,7 @@ static void test_examples(int index, int generate, int debug) { "000010000000000000000000000000000000000000000000000000000000000000000010" "000010100110010010011011110101000110101010011101010000100010011100101010" }, - /* 6*/ { BARCODE_UPCE_CC, "121230", "[15]021231", 1, 0, 0, 0, 9, 55, "Figure 5.9.8-4. UPC-E symbol with a two-column CC-A", + /* 8*/ { BARCODE_UPCE_CC, 1, "0121230", "[15]021231", 0, 9, 55, "GGS Figure 5.9.8-4. (24723:2010 Figure 3) UPC-E symbol with a two-column CC-A", "1101100110111010011111010001100111100010110011110101001" "1101101110110010010000110001101000011011100011100101001" "1101101100111101001000000101000101111000010011101101001" @@ -211,14 +248,14 @@ static void test_examples(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010110011001001100110010011011011110101001110101010" }, - /* 7*/ { BARCODE_RSS14_CC, "0361234567890", "[11]990102", 1, 0, 0, 0, 5, 100, "Figure 5.9.8-5. GS1 DataBar Omnidirectional symbol with a four-column CC-A", + /* 9*/ { BARCODE_RSS14_CC, 1, "0361234567890", "[11]990102", 0, 5, 100, "GGS Figure 5.9.8-5. (24723:2010 Figure 8) GS1 DataBar Omnidirectional symbol with a four-column CC-A", "1101101110110000101000110001111001010111100010011101001110011101100110011001001100111000110110001010" "1101101100110111011111001001000011010111111010011001001101000000111010010010111111001110110010001010" "1101101000110010010111110001011001101111000010011001101111010011110010010000011001011100111010001010" "0000000000010110001110100000000101001011010111111011001101010000011010000000010100101000110011110000" "0000010011101001110001001111111000010100101000000100110010101111100101111111100011010111001100001101" }, - /* 8*/ { BARCODE_RSS14STACK_CC, "0341234567890", "[17]010200", 1, 0, 0, 0, 9, 56, "Figure 5.9.8-6. GS1 DataBar Stacked symbol with a two-column CC-A", + /*10*/ { BARCODE_RSS14STACK_CC, 1, "0341234567890", "[17]010200", 0, 9, 56, "GGS Figure 5.9.8-6. (24723:2010 Figure 6) GS1 DataBar Stacked symbol with a two-column CC-A", "01101100110101110011100111101010000100001111011110101001" "01101101110110110001000010001110111101100100011100101001" "01101101100110100001111011001111110011010110011101101001" @@ -229,7 +266,7 @@ static void test_examples(int index, int generate, int debug) { "00000011010111101010000010101010101001001101010000000000" "10101100111000010101111111110111000110110011100101000000" }, - /* 9*/ { BARCODE_RSS_LTD_CC, "0351234567890", "[91]abcdefghijklmnopqrstuv", 2, 0, 0, 0, 17, 83, "Figure 5.9.8-7. GS1 DataBar Limited symbol with a three-column CC-B **NOT SAME** (using [91] not [21] as length > 20 max for [21])", + /*11*/ { BARCODE_RSS_LTD_CC, 2, "0351234567890", "[91]abcdefghijklmnopqrstuv", 0, 17, 83, "GGS Figure 5.9.8-7. (24723:2010 Figure 7) GS1 DataBar Limited symbol with a three-column CC-B **NOT SAME** (using [91] not [21] as length > 20 max for [21])", "11011101001110111110111010010110001001000001000010001011111011010011110110111010010" "11011001001111110101001110010110001101111011000011001010100001111000100110110010010" "11011001101001111000010010010100001101110111001011110011011100100011100110110011010" @@ -248,14 +285,14 @@ static void test_examples(int index, int generate, int debug) { "00000000000001111011100011010001110101010110101001100101110100100111000110101110000" "00000000001010000100011100101110001010101001010110011010001011011000111001010000101" }, - /*10*/ { BARCODE_RSS_EXP_CC, "[01]93712345678904[3103]001234", "[91]1A2B3C4D5E", 1, 0, 0, 0, 5, 151, "Figure 5.9.8-8. GS1 DataBar Expanded symbol with a four-column CC-A", + /*12*/ { BARCODE_RSS_EXP_CC, 1, "[01]93712345678904[3103]001234", "[91]1A2B3C4D5E", 0, 5, 151, "GGS Figure 5.9.8-8. (24723:2010 Figure 9) GS1 DataBar Expanded symbol with a four-column CC-A, same, verified against BWIPP and tec-it", "0011011011101110011010011000011100011100110110100111010011010001000011000101101110011000001101100010100000000000000000000000000000000000000000000000000" "0011011011001101110111110100011010001111001100100110010010111111001001100100101111110011101100100010100000000000000000000000000000000000000000000000000" "0011011010001010111011111100011111011011110010100110011011000011010011110100001011001111101110100010100000000000000000000000000000000000000000000000000" - "0000011011111011000100000000101001010000011101001110100110001100111001000010101000011010001110001000100001010000111001010000001010010111000110010110000" + "0000011011111011000100000000101001010000011101001110100110001100111101000010101000011010001110001000100001010000111001010000001010010111000110010110000" "0101100100000100111011111111000010101111100010110001011001110011000010111100000011100101110001110111011110101111000110001111110000101000111001101000010" }, - /*11*/ { BARCODE_EAN128_CC, "[01]03212345678906", "[21]A1B2C3D4E5F6G7H8", 1, 0, 0, 0, 6, 145, "Figure 5.9.8-9. GS1-128 symbol with a four-column CC-A", + /*13*/ { BARCODE_EAN128_CC, 1, "[01]03212345678906", "[21]A1B2C3D4E5F6G7H8", 0, 6, 145, "GGS Figure 5.9.8-9. (24723:2010 Figure 11) GS1-128 symbol with a four-column CC-A", "0000000000000000000001101001000110100001000001101101011110111110010010001101010000010010000011101110100010000111011001010000000000000000000000000" "0000000000000000000001101011000110101111001100001111010001101100010010000101111000011001101011100101100001000110011001010000000000000000000000000" "0000000000000000000001101011100100011001100111101011000101110000010110000101001100110011110011011110011001110110111001010000000000000000000000000" @@ -263,11 +300,11 @@ static void test_examples(int index, int generate, int debug) { "0010110001100001010001001100100110110110011100100011011000100100010100010011101111010011001001000010110011011100010100001000100010010011100010100" "1101001110011110101110110011011001001001100011011100100111011011101011101100010000101100110110111101001100100011101011110111011101101100011101011" }, - /*12*/ { BARCODE_RSS_EXPSTACK_CC, "[01]00012345678905[10]ABCDEF", "[21]12345678", 1, 0, 0, 0, 13, 102, "24723:2010 Figure 10 — A GS1 DataBar Expanded Stacked Composite symbol (with CC-A)", + /*14*/ { BARCODE_RSS_EXPSTACK_CC, 1, "[01]00012345678905[10]ABCDEF", "[21]12345678", 0, 13, 102, "24723:2010 Figure 10 — A GS1 DataBar Expanded Stacked Composite symbol (with CC-A) **NOT SAME** bottom 1st and top 2nd linear row separators different; zint same as BWIPP and hard to see how figure in standard could be correct", "001101101110110100001000001101001100111011000010011101001000110011100110010100111011100000110110001010" "001101101100101111110100011001111101101000001010011001001011111011011110011010111000100000110010001010" "001101101000100101001111000001000111011101111010011001101011110110110000011010001011111000111010001010" - "000001000111011100010000000010100100001101100000101010000110010000010100000111111001110100111100100000" + "000001000111011100010000000010100100001101100000101010000110010000010100000101010001110100111100100000" "010110111000100011101111111100001011110010011111010101111001101111101011111000000110001011000011011101" "000001000111011100010000000010100100001101100000101010000110010000010100000101010001110100111100100000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" @@ -278,7 +315,7 @@ static void test_examples(int index, int generate, int debug) { "000000111001111101010100001010100101011111000010100000000000000000000000000000000000000000000000000000" "010111000110000010100011110000001010100000111101000100000000000000000000000000000000000000000000000000" }, - /*13*/ { BARCODE_EAN128_CC, "[00]030123456789012340", "[02]13012345678909[37]24[10]1234567ABCDEFG", 3, 0, 0, 0, 7, 174, "24723:2010 Figure 12 — A GS1-128 Composite symbol (with CC-C)", + /*15*/ { BARCODE_EAN128_CC, 3, "[00]030123456789012340", "[02]13012345678909[37]24[10]1234567ABCDEFG", 0, 7, 174, "24723:2010 Figure 12 — A GS1-128 Composite symbol (with CC-C)", "111111110101010001111010101111000011010111011110000111011111011101001000001000010001011110101100111110111010010001110001000100011000011011111010100111110111111101000101001000" "111111110101010001111110101000111010000100111101000110011110101111101111010001010000011111000110010100111001011100011001001001111101100011111101010111000111111101000101001000" "111111110101010001010100011110000011001111100001010110100010111110001110111101011100011000001101011110101111001000000101100001011111101011101010001111110111111101000101001000" @@ -287,20 +324,827 @@ static void test_examples(int index, int generate, int debug) { "000000000101100011000010100010010011001101101100111001100100110001001000101000100111011110100110010010000100110010011000100100010011101011101000010001000100001010011100010100" "000000011010011100111101011101101100110010010011000110011011001110110111010111011000100001011001101101111011001101100111011011101100010100010111101110111011110101100011101011" }, + /*16*/ { BARCODE_RSS14STACK_CC, 1, "12345678901231", "[91]12345678901234567890", 0, 10, 56, "Example with CC-A 2 cols, 6 rows", + "01100100010111100110100111001011101110001000011100101101" + "01110100010110001011101000001000111010111110011000101101" + "01110110010110101100111111001000111100001001011000101001" + "01100110010111100100010111101101100100100000011001101001" + "01101110010111110011010010001011111101000011011011101001" + "01101111010111111001011010001000001100010111011011001001" + "00000110001100011010100000000100101101110000100000000000" + "01001001110011100100011111111001010010001111011010000000" + "00000110001101011010101010101010101101010000100000000000" + "10101001111010000101100000000111000010100111011101000000" + }, + /*17*/ { BARCODE_RSS14_OMNI_CC, 1, "12345678901231", "[91]1234567890123456789012", 0, 13, 56, "Example with CC-A 2 cols, 7 rows", + "01110110110100100011111001101110001011100110011100010101" + "01110010110111000110101111101001111100110010011000010101" + "01100010110111010110011110001110001110110011011000110101" + "01100010100110010111101100001001011111001100011000100101" + "01100110100101110000001011001110111010011110011100100101" + "01101110100110100000010001101100011010010000011110100101" + "01101100100111001011000100001111000001001010011110101101" + "00000110001100011010100000000100101101110000100000000000" + "01001001110011100100011111111001010010001111011010000000" + "00000110001100011010100000000100101101110000100000000000" + "00000101010101010101010101010101010101010101010000000000" + "00000110000101111010010101010000111101011000100000000000" + "10101001111010000101100000000111000010100111011101000000" + }, + /*18*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]1234567890123456789012345678", 0, 12, 55, "Example with CC-A 3 cols, 8 rows", + "1110111010100100011111001101110001011100110011011011101" + "1110011010111000110101111101001111100110010011011011001" + "1111011010111010110011110001110001110110011011011010001" + "1111001010110010111101100001101101111000010011010010001" + "1110001010100011111011001001000000100101111011010110001" + "1100001010111001111011000101110011001100111011010111001" + "1100011010111011100111100101111110011100101011010111101" + "1100010010101111100011010001111110010111011011010011101" + "0001000000000000000000000000000000000000000000000000010" + "0010000000000000000000000000000000000000000000000000001" + "0001000000000000000000000000000000000000000000000000010" + "0001010010011011110101000110111001000010100100010101010" + }, + /*19*/ { BARCODE_RSS14STACK_CC, 1, "12345678901231", "[91]1234567890123456789012345678901", 0, 13, 56, "Example with CC-A 2 cols, 9 rows", + "01100011010100100011111001101110001011100110011010111101" + "01100010010111000110101111101001111100110010011010011101" + "01110010010111010110011110001110001110110011011010011001" + "01111010010110010111101100001111001000101000011010001001" + "01111010110100111000010011001000111110001101011010001101" + "01111010100111000100010011101010000010000100011010000101" + "01110010100101100111111011001100010111000010011011000101" + "01110110100100011001000111001000010010111100011001000101" + "01110100100111001110011001101011000011101100011101000101" + "00000110001100011010100000000100101101110000100000000000" + "01001001110011100100011111111001010010001111011010000000" + "00000110001101011010101010101010101101010000100000000000" + "10101001111010000101100000000111000010100111011101000000" + }, + /*20*/ { BARCODE_RSS14_OMNI_CC, 1, "12345678901231", "[91]1234567890123456789012345678901234567", 0, 16, 56, "Example with CC-A 2 cols, 10 rows", + "01101001000111100110100111001011101110001000011101001101" + "01101011000110001011101000001000111010111110011101011101" + "01101011100110101100111111001000111100001001011101011001" + "01101011110111100100010111101000100110000110011101010001" + "01101001110111000101110110001111011011100110011001010001" + "01101001100101111100001100101000111100010100011001011001" + "01101000100101000001101100001111101111001011011001011101" + "01101000110111000101100100001111001001000001011001001101" + "01101000010101100111011111001000011101001100011001101101" + "01101100010110001101010000001000100001110111011101101101" + "00000110001100011010100000000100101101110000100000000000" + "01001001110011100100011111111001010010001111011010000000" + "00000110001100011010100000000100101101110000100000000000" + "00000101010101010101010101010101010101010101010000000000" + "00000110000101111010010101010000111101011000100000000000" + "10101001111010000101100000000111000010100111011101000000" + }, + /*21*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]123456789012345678901234567890123456789012334", 0, 16, 55, "Example with CC-A 2 cols, 12 rows", + "1110010100100100011111001101110001011100110011011000101" + "1110110100111000110101111101001111100110010011001000101" + "1110100100111010110011110001110001110110011011101000101" + "1110100110110010111101100001001000011110001011101100101" + "1110101110100011010011100001100010100111110011001100101" + "1110101100111101111001001001100001101100011011011100101" + "1110101000111010001100010001101111010111110011011110101" + "1100101000100110000001011101000111100100010011001110101" + "1100101100100010011101110001110000110100110011101110101" + "1100101110111101000000100101111001010000001011100110101" + "1100100110111110010111101101100011100100111011110110101" + "1100110110100011101110100001000110011101100011110010101" + "0001000000000000000000000000000000000000000000000000010" + "0010000000000000000000000000000000000000000000000000001" + "0001000000000000000000000000000000000000000000000000010" + "0001010010011011110101000110111001000010100100010101010" + }, + /*22*/ { BARCODE_RSS_LTD_CC, 1, "12345678901231", "[91]1234567890123456789012345", 0, 7, 74, "Example with CC-A 3 cols, 5 rows", + "01111001101001110010011010001011101110001000010111011100100000110000101010" + "01000111010111110010111010001110101100100000011001111010111110110001101010" + "01011001110111110010110010001101100000101111011100010111110010110001001010" + "01011001111000111010110011001100110000110011010001000110011000111001001010" + "01111101010110000010110001001100010111100011011011101111101000111101001010" + "00001011101000001010111000001010101000110110101101010110101111100011100000" + "01010100010111110101000111110101010111001001010010101001010000011100011101" + }, + /*23*/ { BARCODE_EANX_CC, 1, "1234567", "[91]1234567890123456789012345678901", 0, 10, 72, "Example with CC-A 3 cols, 6 rows", + "100100011111001101011000100111000101110011001100010111010000011110100101" + "100111110011001001011000110110101100111111001000111100001001011110101101" + "111100100010111101010000110111011000001011001000010100001000011110101001" + "101111110010011001010001110111100010110011001111101000110111011100101001" + "101110111000111101010001100100001001011110001000110010001110011101101001" + "101110111000010001010011100111001110011001101011000011101100011101001001" + "000010000000000000000000000000000000000000000000000000000000000000000010" + "000100000000000000000000000000000000000000000000000000000000000000000001" + "000010000000000000000000000000000000000000000000000000000000000000000010" + "000010100110010010011011110101000110101010011101010000100010011100101010" + }, + /*24*/ { BARCODE_RSS_LTD_CC, 1, "12345678901231", "[91]1234567890123456789012345678901234567", 0, 9, 74, "Example with CC-A 3 cols, 7 rows", + "01000100011011111010110100001100011010001111011100011010111110110010100010" + "01100000100110111010010100001110101100111100011100011101100110110010110010" + "01100101111011000010010110001001000011110001011100010111011000110010111010" + "01100010100111110010010111001011111000011001010001111000101000110010011010" + "01010000011011000010110111001111101111001011011000011011001100110011011010" + "01100100001110100010110111101011111010011100010110000101111110111011011010" + "01010001100011111010110011101011001100111100010011011011110000111001011010" + "00001011101000001010111000001010101000110110101101010110101111100011100000" + "01010100010111110101000111110101010111001001010010101001010000011100011101" + }, + /*25*/ { BARCODE_UPCA_CC, 1, "12345678901", "[91]12345678901234567890", 0, 7, 99, "Example with CC-A 4 cols, 3 rows", + "110110111011110011010011100101110111000100001001110100101110111001000001100000100110111011011000101" + "110110110011101011001000000110011110101111101001100100110010111101100001110010111011000011001000101" + "110110100010011101000001100100111111011101001001100110111111001011010001000001100010111011101000101" + "000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010" + "001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001" + "000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010" + "000101001100100100110111101010001101100010101111010101000100100100011101001110010110011011011001010" + }, + /*26*/ { BARCODE_RSS14_CC, 1, "12345678901231", "[91]1234567890123456789012345678", 0, 6, 100, "Example with CC-A 4 cols, 4 rows", + "1101001000111100110100111001011101110001000010010001101011101110010000011000001001101110111011001010" + "1101011000111010110010000001100111101011111010010000101100101111011000011011011110000100110011001010" + "1101011100100011111011001001000000100101111010110000101100011111010010011000110101111000110111001010" + "1101011110100011011001000001110011100010001010111000101101111011110011011100101000111000110111101010" + "0000000001100011000110101000000001001011011100001001010110000101111010010101010000111101011000100000" + "0000010010011100111001000111111110010100100011110110101001111010000101100000000111000010100111011101" + }, + /*27*/ { BARCODE_RSS_EXP_CC, 1, "[01]12345678901231", "[91]1234567890123456789012345678901234567", 0, 7, 134, "Example with CC-A 4 cols, 5 rows", + "00110101111011110011010011100101110111000100001011100010101110111001000001100000100110111011011110101000000000000000000000000000000000" + "00110100111011101011001000000110011110101111101011100110110010111101100001001000011110001011001110101000000000000000000000000000000000" + "00110100110010001101001110000110001010011111001011100100101111100001100101000111100010100011101110101000000000000000000000000000000000" + "00110100010010100000110110000111110111100101101011101100110001000100110001101100010001000011100110101000000000000000000000000000000000" + "00110100011011001011110110000100111001001111101001101100111110011000101001001101111110011011110110101000000000000000000000000000000000" + "00001011100111110001000000001010010011000000101001100011100100111011010000101010000111000011110101001101011110000010010100000010100000" + "01010100011000001110111111110000101100111111010110011100011011000100101111000000111000111100001010110010100001111101100011111100001010" + }, + /*28*/ { BARCODE_RSS_EXPSTACK_CC, 1, "[01]12345678901231", "[91]123456789012345678901234567890123456789012345", 0, 12, 102, "Example with CC-A 4 cols, 6 rows", + "001100010110111100110100111001011101110001000010011100101011101110010000011000001001101110110101111010" + "001100010100111010110010000001100111101011111010011110101100101111011000010010000111100010110100111010" + "001100110100100011010011100001100010100111110010111110101011111000011001010001111000101000110100110010" + "001101110100101000001101100001110011100010100010111100101111011101100111010000010110110000110100010010" + "001101100100111110001010001101100000101111011010111101101111000101110111010011110010111100110100011010" + "001101100110110101100111111001110001001111101010011101101001111000101000011001110100111000110100001010" + "000001101110011110010000000010100100001100110001001000111001001110110100001010100001110000111101010000" + "010110010001100001101111111100001011110011001110110111000110110001001011110000001110001111000010101101" + "000001101110011110010000000010100100001100110001001000111001001110110100001010100001110000111101010000" + "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "000000101111000001001010000001010010111100111110110000000000000000000000000000000000000000000000000000" + "001001010000111110110001111110000101000011000001001010000000000000000000000000000000000000000000000000" + }, + /*29*/ { BARCODE_EANX_CC, 1, "123456789012", "[91]123456789012345678901234567890123456789012345678901234", 0, 11, 99, "Example with CC-A 4 cols, 7 rows", + "110010111010010001111100110111000101110011001000011010110001011101000001000111010111110011011011001" + "110010011011010110011111100100011110000100101000111010101100111011111001011100010011000011011010001" + "110011011011011101110011000101100011010000001000110010111101111001001001100001101100011011010010001" + "111011011011101000110001000110111101011111001000100010101110010111110001110100011000001011010110001" + "111001011010011110001010000100111110000110101001100010111001101001111101000011110100001011010111001" + "110001011011001110001100010111011111011100101001110010111010000101110001110011000010110011010111101" + "110001010011110100110011000111101000010010001001111010111110100010011001001001111001000011010011101" + "000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010" + "001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001" + "000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010" + "000101001001101111010011101011000100001010010001010101001000111010011100101100110110110010010001010" + }, + /*30*/ { BARCODE_UPCE_CC, 2, "1234567", "[91]1234567890123", 0, 12, 55, "Example with CC-B 2 cols, 8 rows", + "1100100010111011111011101001000001000010001011001000101" + "1110100010110100001111011001100101110000100011101000101" + "1110110010101100100111000001011111011000001011101100101" + "1100110010110000110010100001010001000010000011001100101" + "1101110010111110110001001001100100111110111011011100101" + "1101111010100001111000101001110111111001001011011110101" + "1100111010100010001000000101110010000101110011001110101" + "1110111010111110001010110001111000100101000011101110101" + "0001000000000000000000000000000000000000000000000000010" + "0010000000000000000000000000000000000000000000000000001" + "0001000000000000000000000000000000000000000000000000010" + "0001010010011011110101000110111001000010100100010101010" + }, + /*31*/ { BARCODE_RSS14STACK_CC, 2, "12345678901231", "[91]123456789012345678901234567", 0, 15, 56, "Example with CC-B 2 cols, 11 rows", + "01100100010111011111011101001000001000010001011100110101" + "01110100010110100001111011001100101110000100011110110101" + "01110110010101100100111000001011111011000001011110010101" + "01100110010110000110010100001111100101011111011100010101" + "01101110010111011001111001101110100011000010011000010101" + "01101111010101100010111000001111101001110100011000110101" + "01100111010111011010110000001000110000111011011000100101" + "01110111010100010111110110001001001111010000011100100101" + "01110011010100111101000001001010110001111100011110100101" + "01111011010100010000111011101001100001100100011110101101" + "01111001010111101010000100001001110010111110011110101001" + "00000110001100011010100000000100101101110000100000000000" + "01001001110011100100011111111001010010001111011010000000" + "00000110001101011010101010101010101101010000100000000000" + "10101001111010000101100000000111000010100111011101000000" + }, + /*32*/ { BARCODE_RSS14_OMNI_CC, 2, "12345678901231", "[91]1234567890123456789012345678901234567890123", 0, 20, 56, "Example with CC-B 2 cols, 14 rows", + "01110111010100011111010011101101111110101110011101110101" + "01110011010100100101111000001001000100001111011100110101" + "01111011010101101111001110001111011110101000011110110101" + "01111001010110001110111110101110100011100011011110010101" + "01110001010110011001000111101001010000111100011100010101" + "01100001010110010001000011001101001111011111011000010101" + "01100011010110110111101000001111101100011011011000110101" + "01100010010100111100000100101011000101110000011000100101" + "01110010010100101110001110001111101101011110011100100101" + "01111010010111010000110100001001111101001110011110100101" + "01111010110100111100011011001011110001101100011110101101" + "01111010100111101110101100001111010001011110011110101001" + "01110010100100010111100000101101100111110011011100101001" + "01110110100101100100000111001000000110100111011101101001" + "00000110001100011010100000000100101101110000100000000000" + "01001001110011100100011111111001010010001111011010000000" + "00000110001100011010100000000100101101110000100000000000" + "00000101010101010101010101010101010101010101010000000000" + "00000110000101111010010101010000111101011000100000000000" + "10101001111010000101100000000111000010100111011101000000" + }, + /*33*/ { BARCODE_UPCE_CC, 2, "1234567", "[91]123456789012345678901234567890123456789012345678901234567", 0, 21, 55, "Example with CC-B 2 cols, 17 rows", + "1100110100100000011100101101100111111011001011001101001" + "1101110100111110110100111101110110010000110011011101001" + "1101100100111001011001000001110001101110100011011001001" + "1101100110110111111001101001100101100111111011011001101" + "1101101110100010110001100001010000011000110011011011101" + "1101101100100101111101100001111110100101110011011011001" + "1101101000100010110001111101011100100001100011011010001" + "1101001000111110111100101101100100010000110011010010001" + "1101011000111010000110010001110110111000100011010110001" + "1101011100101110110000111001011110110011000011010111001" + "1101011110110111100111010001000010010000100011010111101" + "1101001110101001111000100001110100110000010011010011101" + "1101001100111010011111101101101110010000111011010011001" + "1101000100110001000110011101101100111001110011010001001" + "1101000110100111110100011101100100000111001011010001101" + "1101000010101111000001101101001000000101111011010000101" + "1101100010110001100001101101011101110001000011011000101" + "0001000000000000000000000000000000000000000000000000010" + "0010000000000000000000000000000000000000000000000000001" + "0001000000000000000000000000000000000000000000000000010" + "0001010010011011110101000110111001000010100100010101010" + }, + /*34*/ { BARCODE_RSS14STACK_CC, 2, "12345678901231", "[91]1234567890123456789012345678901234567890123456789012345678901234567890", 0, 24, 56, "Example with CC-B 2 cols, 20 rows", + "01111010100111011111011101001000001000010001011110101001" + "01110010100110100001111011001100101110000100011100101001" + "01110110100101100100111000001011111011000001011101101001" + "01110100100110000110010100001111100101011111011101001001" + "01110100110111011001111001101110100011000010011101001101" + "01110101110101100010111000001111101001110100011101011101" + "01110101100101100011000010001100110110110000011101011001" + "01110101000100011001111100101001011111011000011101010001" + "01100101000101101001110000001100010100011111011001010001" + "01100101100100010110000011001000100001000001011001011001" + "01100101110111110001100010101101110011111010011001011101" + "01100100110100100101111000001100111001011100011001001101" + "01100110110111101001001111001001000010010000011001101101" + "01110110110100100001111010001010011111101110011101101101" + "01110010110111010001011111101011110111101111011100101101" + "01100010110100001001110111001000110110000100011000101101" + "01100010100111100100100001001000110011111001011000101001" + "01100110100110111010001110001001101001110000011001101001" + "01101110100101010000010000001110100010011100011011101001" + "01101100100101111101011100001001110100111110011011001001" + "00000110001100011010100000000100101101110000100000000000" + "01001001110011100100011111111001010010001111011010000000" + "00000110001101011010101010101010101101010000100000000000" + "10101001111010000101100000000111000010100111011101000000" + }, + /*35*/ { BARCODE_RSS14_OMNI_CC, 2, "12345678901231", "[91]1234567890123456789012345678901234567890123456789012345678901234567890123456789012", 0, 29, 56, "Example with CC-B 2 cols, 23 rows", + "01110011010100000011100101101100111111011001011110100101" + "01111011010111110110100111101110110010000110011110101101" + "01111001010111001011001000001110001101110100011110101001" + "01110001010110111111001101001100101100111111011100101001" + "01100001010100010110001100001010000011000110011101101001" + "01100011010100101111101100001111110100101110011101001001" + "01100010010100010110001111101011100100001100011101001101" + "01110010010111110111100101101100100010000110011101011101" + "01111010010111010000110010001110110111000100011101011001" + "01111010110101110110000111001011110110011000011101010001" + "01111010100110111100111010001000010010000100011001010001" + "01110010100110100001111011001100110111100010011001011001" + "01110110100111101011111001101000101000111100011001011101" + "01110100100111001101110111101011011000100000011001001101" + "01110100110111111010100011101110011001110100011001101101" + "01110101110100000010101111001001110111001111011101101101" + "01110101100111010010001110001101110011000100011100101101" + "01110101000100010111100000101010011110000100011000101101" + "01100101000101100110001111001011010000001110011000101001" + "01100101100110001000010110001011110111101000011001101001" + "01100101110111111010010011101000101111100011011011101001" + "01100100110110111101000001101110111101001110011011001001" + "01100110110110000010010011001101110001100100011011001101" + "00000110001100011010100000000100101101110000100000000000" + "01001001110011100100011111111001010010001111011010000000" + "00000110001100011010100000000100101101110000100000000000" + "00000101010101010101010101010101010101010101010000000000" + "00000110000101111010010101010000111101011000100000000000" + "10101001111010000101100000000111000010100111011101000000" + }, + /*36*/ { BARCODE_UPCE_CC, 2, "1234567", "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, 30, 55, "Example with CC-B 2 cols, 26 rows", + "1100101000100000011100101101000001111001010011000101001" + "1100101100111110110100111101110110010000110011001101001" + "1100101110111001011001000001110001101110100011011101001" + "1100100110110111111001101001100101100111111011011001001" + "1100110110100010110001100001010000011000110011011001101" + "1110110110100101111101100001111110100101110011011011101" + "1110010110100010110001111101011100100001100011011011001" + "1100010110111110111100101101100100010000110011011010001" + "1100010100111010000110010001110110111000100011010010001" + "1100110100101110110000111001011110110011000011010110001" + "1101110100110111100111010001000010010000100011010111001" + "1101100100110100001111011001100110111100010011010111101" + "1101100110111101011111001101000101000111100011010011101" + "1101101110111001101110111101011011000100000011010011001" + "1101101100111111010100011101110011001110100011010001001" + "1101101000100000010101111001001110111001111011010001101" + "1101001000110100010110000001100110001000001011010000101" + "1101011000100110011111000101101011110110000011011000101" + "1101011100100110011011110001100111111001101011001000101" + "1101011110101001110001110001010011000011000011101000101" + "1101001110111101011100011101110101100010000011101100101" + "1101001100110011111000101001000011001101111011001100101" + "1101000100101000001001000001100011001001000011011100101" + "1101000110100010111111011101101000000111010011011110101" + "1101000010111111010001100101011001100111100011001110101" + "1101100010111011000110011101100001000001011011101110101" + "0001000000000000000000000000000000000000000000000000010" + "0010000000000000000000000000000000000000000000000000001" + "0001000000000000000000000000000000000000000000000000010" + "0001010010011011110101000110111001000010100100010101010" + }, + /*37*/ { BARCODE_RSS_LTD_CC, 2, "12345678901231", "[91]123456", 0, 8, 83, "Example with CC-B 3 cols, 6 rows", + "11001000101110111110111010010110011101000001000010001011101000010001110110010001010" + "11101000101110101111011100010010011101010000111100100011010111000000100111010001010" + "11101100101100110100001111010011011101101111101000100010110010011100000111011001010" + "11001100101110001001000111010001011101110111100011010011100111011001100110011001010" + "11011100101111001011100111010001001101111010001000010011110100010000100110111001010" + "11011110101001111001001000010001101101000011110011011010111001110011110110111101010" + "00000000000001011101000001010111000001010101000110110101101010110101111100011100000" + "00000000001010100010111110101000111110101010111001001010010101001010000011100011101" + }, + /*38*/ { BARCODE_EANX_CC, 2, "1234567", "[91]123456789012345678", 0, 12, 82, "Example with CC-B 3 cols, 8 rows", + "1100111010111011111011101001000010110100000100001000101111101101001111011001110101" + "1110111010110010111000010001000010010111001011001000001110001101110100011101110101" + "1110011010110111111001101001000011010101000101111000001100100110111111011100110101" + "1111011010111011010000110001000111010110000110110011001110011010011000011110110101" + "1111001010111011011100100001000110010111011101111001001010011110000100011110010101" + "1110001010111111010110001001000100010111001011111101101001111000011011011100010101" + "1100001010111100100010111101001100010111001111001100101001110001110010011000010101" + "1100011010110011001111010001001110010111110111101110101011100111111001011000110101" + "0000000000000010000000000000000000000000000000000000000000000000000000000000000010" + "0000000000000100000000000000000000000000000000000000000000000000000000000000000001" + "0000000000000010000000000000000000000000000000000000000000000000000000000000000010" + "0000000000000010100110010010011011110101000110101010011101010000100010011100101010" + }, + /*39*/ { BARCODE_RSS_LTD_CC, 2, "12345678901231", "[91]12345678901234567890123456789", 0, 12, 83, "Example with CC-B 3 cols, 10 rows", + "11000100101000000111001011010011110101100111111011001010010010111100000110001001010" + "11100100101110110010000110010111110101011011110011100011110111101010000111001001010" + "11110100101100011101111101010111100101110100011100011011101100111100110111101001010" + "11110101101001010000111100010111101101011000101110000011111010011101000111101011010" + "11110101001110110100011000010011101101101000010011000011100111101100100111101010010" + "11100101001011111100100011010011101001001100111110001011110101100001100111001010010" + "11101101001000010100001111010011001001011110100000010010010011101111110111011010010" + "11101001001100100010000110010011001101110111001100110011101110100010000111010010010" + "11101001101110001100111001010010001101100010011110110011110110001100010111010011010" + "11101011101101111101000100010010000101011110011000011011011101001110000111010111010" + "00000000000001011101000001010111000001010101000110110101101010110101111100011100000" + "00000000001010100010111110101000111110101010111001001010010101001010000011100011101" + }, + /*40*/ { BARCODE_EANX_CC, 2, "1234567", "[91]12345678901234567890123456789012345678901", 0, 16, 82, "Example with CC-B 3 cols, 12 rows", + "1110101100111011111011101001011000010100000100001000101111101101001111011101011001" + "1110101000110010111000010001011100010111001011001000001110001101110100011101010001" + "1100101000110111111001101001011100110110010110011111101100110010001111011001010001" + "1100101100101000001100011001011100100110010001000011001101001111011111011001011001" + "1100101110110110111101000001011101100111110110001101101000110011111001011001011101" + "1100100110101100010111000001001101100101101001110000001011010000011100011001001101" + "1100110110101110011111011101000101100111100111001011001100011000011011011001101101" + "1110110110111110100100110001000101000100111111010110001000010011111011011101101101" + "1110010110101101100000111101001101000101101110001111101011000000101110011100101101" + "1100010110101101100001000001011101000110011000100001001101110110001000011000101101" + "1100010100100001110101111101011001000101111011001111101111000110110001011000101001" + "1100110100100000110010011101011001100110000100101111101101111000101100011001101001" + "0000000000000010000000000000000000000000000000000000000000000000000000000000000010" + "0000000000000100000000000000000000000000000000000000000000000000000000000000000001" + "0000000000000010000000000000000000000000000000000000000000000000000000000000000010" + "0000000000000010100110010010011011110101000110101010011101010000100010011100101010" + }, + /*41*/ { BARCODE_RSS_LTD_CC, 2, "12345678901231", "[91]123456789012345678901234567890123456789012345678901234567", 0, 17, 83, "Example with CC-B 3 cols, 15 rows", + "11011101001110111110111010010110001001000001000010001011111011010011110110111010010" + "11011001001100101110000100010110001101110010110010000011100011011101000110110010010" + "11011001101101111110011010010100001101100101100111111011001100100011110110110011010" + "11011011101010000011000110010100011101100100010000110011010011110111110110110111010" + "11011011001101101111010000010100011001111101100011011010001100111110010110110110010" + "11011010001011000101110000010100111001011010011100000011000101000111110110110100010" + "11010010001000101100000110010100110001000100001000001011011110011101000110100100010" + "11010110001101110011111010010101110001010011110001000011101001100000100110101100010" + "11010111001000001111010001010101100001000000110100111011010110111111000110101110010" + "11010111101011100111110111010100100001111001101001110010000110001110110110101111010" + "11010011101110111011110010010110100001110010000001101011011110100111110110100111010" + "11010011001110001111010111010010100001011101100011100010000011010011100110100110010" + "11010001001001100111100111010010110001000110011110111010000110111000110110100010010" + "11010001101111010000100001010010111001110000100001101010111111010001100110100011010" + "11010000101011111100111010010110111001110110101111100011000101111110100110100001010" + "00000000000001011101000001010111000001010101000110110101101010110101111100011100000" + "00000000001010100010111110101000111110101010111001001010010101001010000011100011101" + }, + /*42*/ { BARCODE_EANX_CC, 2, "1234567", "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]12345678901234567890123", 0, 30, 82, "Example with CC-B 3 cols, 26 rows", + "1100100010111011111011101001000011010100000100001000101111101101001111011110100101" + "1110100010110010111000010001000111010111001011001000001110001101110100011110101101" + "1110110010110111111001101001000110010110010110011111101100110010001111011110101001" + "1100110010101000001100011001000100010110010001000011001101001111011111011100101001" + "1101110010110110111101000001001100010111110110001101101000110011111001011101101001" + "1101111010101100010111000001001110010101101001110000001100010100011111011101001001" + "1100111010100010110000011001001111010100010000100000101101111001110100011101001101" + "1110111010110111001111101001011111010110100001111011001100110111100010011101011101" + "1110011010111101011111001101011110010100010100011110001001100011001111011101011001" + "1111011010101101100010000001011110110111010100011100001011100011110110011101010001" + "1111001010101111010111100001001110110111100010011011001111110100100111011001010001" + "1110001010101111010010000001001110100110111100001011001110100101111110011001011001" + "1100001010110001010011000001001100100110010001100011101110111001000001011001011101" + "1100011010100111011111101001001100110111110011011001101000111010011111011001001101" + "1100010010111101000111101001001000110101100100000011101010110001111100011001101101" + "1110010010101000001000010001001000010110010001100011101011011100011000011101101101" + "1111010010111100011001101001011000010111011101111010001101100001111010011100101101" + "1111010110100001001011110001011100010110001110001011101110111000101111011000101101" + "1111010100111001011101111101011100110111101110100110001001000011011000011000101001" + "1110010100100111011111101001011100100101011110000100001110010001100100011001101001" + "1110110100101111001001000001011101100110001110100111001100111010011100011011101001" + "1110100100110100000010011001001101100100001001100001101011000111101110011011001001" + "1110100110111001000110100001000101100110101111000001101000110010111111011011001101" + "1110101110110000110101111001000101000101110011001110001000011100100011011011011101" + "1110101100110000110000100101001101000101011110011110001101000111011110011011011001" + "1110101000111011011110011001011101000110011011110001001111000101100110011011010001" + "0000000000000010000000000000000000000000000000000000000000000000000000000000000010" + "0000000000000100000000000000000000000000000000000000000000000000000000000000000001" + "0000000000000010000000000000000000000000000000000000000000000000000000000000000010" + "0000000000000010100110010010011011110101000110101010011101010000100010011100101010" + }, + /*43*/ { BARCODE_RSS_LTD_CC, 2, "12345678901231", "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]1234567890123456789012345678901", 0, 46, 83, "Example with CC-B 3 cols, 44 rows", + "11001000101110111110111010010110000101100011100011010011111011010011110110100010010" + "11101000101100101110000100010111000101110010110010000011100011011101000110100011010" + "11101100101101111110011010010111001101100101100111111011001100100011110110100001010" + "11001100101010000011000110010111001001100100010000110011010011110111110110110001010" + "11011100101101101111010000010111011001111101100011011010001100111110010110010001010" + "11011110101011000101110000010011011001011010011100000011000101000111110111010001010" + "11001110101000101100000110010001011001000100001000001011011110011101000111011001010" + "11101110101101110011111010010001010001101000011110110011001101111000100110011001010" + "11100110101111010111110011010011010001000101000111100010011000110011110110111001010" + "11110110101011011000100000010111010001110101000111000010111000111101100110111101010" + "11110010101011110101111000010110010001111000100110110011111101001001110110011101010" + "11100010101011110100100000010110011001101111000010110011101001011111100111011101010" + "11000010101100010100110000010110001001100100011000111011101110010000010111001101010" + "11000110101001110111111010010110001101111100110110011010001110100111110111101101010" + "11000100101110110100011111010100001101100111100010011010001110001000110111100101010" + "11100100101000110000110010010100011101100011101100001011101001100011110111000101010" + "11110100101111100010101100010100011001110000001011001011111011010000100110000101010" + "11110101101100111110001001010100111001111010111110110010001111011101110110001101010" + "11110101001100011011000011010100110001011100111100110010110000011000100110001001010" + "11100101001110010111001100010101110001110000010011001011010000111000100111001001010" + "11101101001000100000101111010101100001000110100000111011111101001100100111101001010" + "11101001001111010001011110010100100001000100111011100010110000011001000111101011010" + "11101001101111101000001011010110100001111010000011011011101000011010000111101010010" + "11101011101011000001101111010010100001000111101000010011011101000011100111001010010" + "11101011001001000001010000010010110001101100001000001010110111000110000111011010010" + "11101010001111100111011001010010111001110000101100001011101000001110110111010010010" + "11001010001110101111110110010110111001110011110010111010011110001100110111010011010" + "11001011001111011101101110010110111101100100000101100010101000000100000111010111010" + "11001011101011010111111000010110011101001110111111001010111100010111100111010110010" + "11001001101110100111110001010010011101000010101111000011100101111100010111010100010" + "11001101101001101100000100010011011101101001101110000011110110001001110110010100010" + "11101101101001000111100100010001011101011011111000010010010111100000100110010110010" + "11100101101101111110011001010001001101011110111000111010000100010111100110010111010" + "11000101101100011011000011010001101101110101100111100011100110001011000110010011010" + "11000101001000010111110011010000101101100100111001000011011011110001000110011011010" + "11001101001110100011111010010000100101011110000011011011100100101111110111011011010" + "11011101001001100011100110010000110101000011011101100010011011000001000111001011010" + "11011001001000110011111010010001110101100001011100010011110001011101110110001011010" + "11011001101101111010001100010001100101011111000011001011001011111101000110001010010" + "11011011101000010110001100010001000101101000111011110011001110011010000110011010010" + "11011011001111100100110111010011000101111011100111001011100110011101000110111010010" + "11011010001110110100111110010011100101000111100000101011011111001000100110110010010" + "11010010001001000001001000010011110101001100001100001011011010001000000110110011010" + "11010110001100001001111011010111110101111000101000010011000010111000100110110111010" + "00000000000001011101000001010111000001010101000110110101101010110101111100011100000" + "00000000001010100010111110101000111110101010111001001010010101001010000011100011101" + }, + /*44*/ { BARCODE_UPCA_CC, 2, "12345678901", "[91]1234567890123", 0, 8, 99, "Example with CC-B 4 cols, 4 rows", + "110100111010001111101001110110111111010111001001110110110100001111011001100101110000100011010010001" + "110100110010110010011100000101111101100000101001110100110111111001101001110100111110010011010110001" + "110100010011100110100001100110010000010110001001100100100111101111010001110001110100010011010111001" + "110100011011000101110000010111011011100100001001100110111110001010110001111000100101000011010111101" + "000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010" + "001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001" + "000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010" + "000101001100100100110111101010001101100010101111010101000100100100011101001110010110011011011001010" + }, + /*45*/ { BARCODE_EANX_CC, 2, "123456789012", "[91]1234567890123456789012345", 0, 10, 99, "Example with CC-B 4 cols, 6 rows", + "110010001011101111101110100110001110001101001011001110111110110100111101110110010000110011001000101" + "111010001011100101100100000111000110111010001001001110110001110111110101110100011100011011101000101" + "111011001011001100100011110100101000011110001001101110101100010111000001010011000111110011101100101" + "110011001011000010010110000100111101111101101000101110111110101001111101100110000101000011001100101" + "110111001011111001000010110111110011010000101000100110111111001010111001110100001101000011011100101" + "110111101010011100001000110110011100010111001000110110100000100010111101111110010011010011011110101" + "000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010" + "001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001" + "000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010" + "000101001001101111010011101011000100001010010001010101001000111010011100101100110110110010010001010" + }, + /*46*/ { BARCODE_EAN128_CC, 2, "[01]12345678901231", "[91]12345678901234567890123456789012345678901", 0, 10, 145, "Example with CC-B 4 cols, 8 rows", + "0000000000000000000001100111010111011111011101001000001000010001010000101101111101101001111011101100100001100110011101010000000000000000000000000" + "0000000000000000000001110111010111001011001000001110001101110100010000100101100011101111101011101000111000110111011101010000000000000000000000000" + "0000000000000000000001110011010110011001000111101001010000111100010000110101011000101110000011111010011101000111001101010000000000000000000000000" + "0000000000000000000001111011010101100011000010001100110110110000010001110101111101111001011011001000100001100111101101010000000000000000000000000" + "0000000000000000000001111001010111010000110010001101000011100010010001100101000001001111010011100110001110010111100101010000000000000000000000000" + "0000000000000000000001110001010110001010111110001001010011110000010001000101011111101111011011011111100110010111000101010000000000000000000000000" + "0000000000000000000001100001010101000110001100001101100001000100010011000101011110011111011011000010001011000110000101010000000000000000000000000" + "0000000000000000000001100011010110111000111110101111100010010011010011100101000011010111111011001100001111010110001101010000000000000000000000000" + "0010110001100001010001001100100110100110001101110100111000111010010011110101100100001001010011000110010011100100010100001000101001110011100010100" + "1101001110011110101110110011011001011001110010001011000111000101101100001010011011110110101100111001101100011011101011110111010110001100011101011" + }, + /*47*/ { BARCODE_RSS14_CC, 2, "12345678901231", "[91]123456789012345678901234567890123456789012345678901234567", 0, 12, 100, "Example with CC-B 4 cols, 10 rows", + "1100010010100000011100101101100111111011001010011110101001001011110000010010001000011110110001001010" + "1110010010101101111001110001111011110101000010111110101100001100101000011111001010111110111001001010" + "1111010010111011001111001101110100011000010010111100101001011111011000011111101001011100111101001010" + "1111010110100010110001111101011100100001100010111101101001111000001001010110001011100000111101011010" + "1111010100100101110001110001100100001001100010011101101000101100000110010001000010000010111101010010" + "1110010100111110001100010101101110011111010010011101001010011110001000011101001100000100111001010010" + "1110110100100000111101101101101110000101110010011001001100011110100011010000100101111000111011010010" + "1110100100100110111000110001000100001100110010011001101000101000000100011100010010011100111010010010" + "1110100110110110011110000101110000100011010010010001101111101100001010010110011111000100111010011010" + "1110101110101111000010010001011110000010001010010000101001010000111100011011110001011000111010111010" + "0000000001100011000110101000000001001011011100001001010110000101111010010101010000111101011000100000" + "0000010010011100111001000111111110010100100011110110101001111010000101100000000111000010100111011101" + }, + /*48*/ { BARCODE_RSS_EXP_CC, 2, "[01]12345678901231", "[91]1234567890123456789012345678901234567890123456789012345678901234567890123", 0, 14, 134, "Example with CC-B 4 cols, 12 rows", + "00111010110011101111101110100100000100001000101011000010111110110100111101110110010000110011101011001000000000000000000000000000000000" + "00111010100011100101100100000111000110111010001011100010110001110111110101110100011100011011101010001000000000000000000000000000000000" + "00110010100011001100100011110100101000011110001011100110101100010111000001111101001110100011001010001000000000000000000000000000000000" + "00110010110010110001100001000110011011011000001011100100111110111100101101100100010000110011001011001000000000000000000000000000000000" + "00110010111011101000011001000111011011100010001011101100110110011110000101001101111101000011001011101000000000000000000000000000000000" + "00110010011010000111010001100110001110101110001001101100100100101111000001100111001011100011001001101000000000000000000000000000000000" + "00110011011011110100100111100100100001001000001000101100111001101110111101101000011000111011001101101000000000000000000000000000000000" + "00111011011011101001100000010111010011000100001000101000111110111101110101001111010111100011101101101000000000000000000000000000000000" + "00111001011010100101111000000111010111110100001001101000101111011000011001100011001001111011100101101000000000000000000000000000000000" + "00110001011011101110001000010111001110010100001011101000100001000100001001100111100111010011000101101000000000000000000000000000000000" + "00110001010010000001011110100111100110110100001011001000111011011100010001101000111000010011000101001000000000000000000000000000000000" + "00110011010011111101001110110110110001011110001011001100110001111010011001000001110110111011001101001000000000000000000000000000000000" + "00001011100111110001000000001010010011000000101001100011100100111011010000101010000111000011110101001101011110000010010100000010100000" + "01010100011000001110111111110000101100111111010110011100011011000100101111000000111000111100001010110010100001111101100011111100001010" + }, + /*49*/ { BARCODE_RSS_EXPSTACK_CC, 2, "[01]12345678901231", "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]1234567890123456789012345678901234567890123456", 0, 26, 102, "Example with CC-B 4 cols, 20 rows", + "001100100010111011111011101001000001000010001010111100101111101101001111011101100100001100111001011010" + "001110100010111001011001000001110001101110100010111101101100011101111101011101000111000110110001011010" + "001110110010110011001000111101001010000111100010011101101011000101110000011111010011101000110001010010" + "001100110010101100011000010001100110110110000010011101001111101111001011011001000100001100110011010010" + "001101110010111010000110010001110110111000100010011001001101100111100001010011011111010000110111010010" + "001101111010100001110100011001100011101011100010011001101001001011110000011001110010111000110110010010" + "001100111010111101001001111001001000010010000010010001101110011011101111010110110001000000110110011010" + "001110111010111111010100011101110011001110100010010000101011110101111000011110001001101100110110111010" + "001110011010111110100111001001011110100100000010110000101101111000010110011101001011111100110110110010" + "001111011010110001010011000001100100011000111010111000101110111001000001011110111100101000110110100010" + "001111001010111110011011001101000111010011111010111001101110100001110110010011101001111100110100100010" + "001110001010100011100010001101000111101000100010111001001011111100111001011010010000111110110101100010" + "001100001010110111011000100001110001110010100010111011001001000111011100011000111011010000110101110010" + "001100011010111101011000011001110101111001110010011011001100001000111010011100010110001000110101111010" + "001100010010111001111110100101001001100011111010001011001110101011111100011101100111111010110100111010" + "001110010010100110000110000101000001000110011010001010001110001010111000011010010001100000110100110010" + "001111010010111100000101010001000110111111011010011010001001110111111010010011111000101110110100010010" + "001111010110111110001011101001001110011101111010111010001111110100011010010011100100110000110100011010" + "001111010100111110111010011101001000110000011010110010001101011100011110010000110111101110110100001010" + "001110010100100111111010110001010011111000011010110011001110010001110110011110010000110110110110001010" + "000001101110011110010000000010100100001100110001001000111001001110110100001010100001110000111101010000" + "010110010001100001101111111100001011110011001110110111000110110001001011110000001110001111000010101101" + "000001101110011110010000000010100100001100110001001000111001001110110100001010100001110000111101010000" + "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "000000101111000001001010000001010010111100111110110000000000000000000000000000000000000000000000000000" + "001001010000111110110001111110000101000011000001001010000000000000000000000000000000000000000000000000" + }, + /*50*/ { BARCODE_UPCA_CC, 2, "12345678901", "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567", 0, 48, 99, "Example with CC-B 4 cols, 44 rows", + "110010001011101111101110100100000100001000101011000010111110110100111101110110010000110011010001001" + "111010001011100101100100000111000110111010001011100010110001110111110101110100011100011011010001101" + "111011001011001100100011110100101000011110001011100110101100010111000001111101001110100011010000101" + "110011001010110001100001000110011011011000001011100100111110111100101101100100010000110011011000101" + "110111001011101000011001000111011011100010001011101100110110011110000101001101111101000011001000101" + "110111101010000111010001100110001110101110001001101100100100101111000001100111001011100011101000101" + "110011101011110100100111100100100001001000001000101100111001101110111101011011000100000011101100101" + "111011101011111101010001110111001100111010001000101000101111010111100001111000100110110011001100101" + "111001101011111010011100100101111010010000001001101000110111100001011001110100101111110011011100101" + "111101101011000101001100000110010001100011101011101000111011100100000101111011110010100011011110101" + "111100101011111001101100110100011101001111101011001000111010000111011001001110100111110011001110101" + "111000101010001110001000110100011110100010001011001100101111110011100101101001000011111011101110101" + "110000101011011101100010000111000111001010001011000100100100011101110001100011101101000011100110101" + "110001101011010111000001000101111000101111001011000110100010000111101001001101111110110011110110101" + "110001001011110111010111110110010001001111101010000110111001111100101101011010000011100011110010101" + "111001001011101110100100000110011001100001101010001110111010011101111101111010001011110011100010101" + "111101001010010000111110110111101100110010001010001100111110100000101101111010000011011011000010101" + "111101011011101101011111000101100000110111101010011100100011110100001001101110100001110011000110101" + "111101010010010000010100000110110000100000101010011000101101110001100001000110001101000011000100101" + "111001010011100001011000010111010000011101101010111000101011110010000001000110100111111011100100101" + "111011010010011110001100110101110000010110001010110000101100000100111001011011000011110011110100101" + "111010010011101110001000010111101100100011101010010000110101101110000001100101000011000011110101101" + "111010011011111011100011010110000010011100101011010000111101000100001001100010011110110011110101001" + "111010111011111001011101000111000111010111101001010000100111100111011101011101110011110011100101001" + "111010110010010000110000110100100001000010001001011000101100111000110001010011000110000011101101001" + "111010100011000010011101000110111001111101001001011100110010011100001001110001011100011011101001001" + "110010100011100111110101100100010100011110001011011100100011110001010001000100011011111011101001101" + "110010110011000100001000110110001000110011101011011110111011110110010001001110000111010011101011101" + "110010111011101000110001000110010111100011001011001110110010001111011001110001101110100011101011001" + "110010011010011000110011110110100010111110001001001110100001110001011001101110100111000011101010001" + "110011011011100110100011000111100111101000101001101110111110010101111101111010010011110011001010001" + "111011011011110100111011100110100000011100101000101110111101101110011001101111110101110011001011001" + "111001011010000111000100110101100100001110001000100110110011100001011101011100001011000011001011101" + "110001011010000010100010000110100110111000001000110110100100000110110001001000011011000011001001101" + "110001010010100001111100110101101111110001101000010110111110010001001101111100010110111011001101101" + "110011010011011010011110000110111001000111001000010010110111010000111001001111100110001011101101101" + "110111010011000011010010000111101100100011101000011010100001100111011001110111101100010011100101101" + "110110010010101111110111000110101111100111001000111010100100011111001101111000001010010011000101101" + "110110011010110100000011100100000100100111101000110010100001011001111101000111101001000011000101001" + "110110111011001111011100100110111000110010001000100010100100001100110001110001110011011011001101001" + "110110110010111101000011110100100001111001001001100010111001110111100101111010100000010011011101001" + "110110100011011100100111000110001111010110001001110010100011101101110001100010001011111011011001001" + "110100100010001110111010000111000100001011101001111010110000110110001101100110000100100011011001101" + "110101100011100000010110100111100010001010001011111010111101000101000001001111101011100011011011101" + "000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010" + "001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001" + "000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010" + "000101001100100100110111101010001101100010101111010101000100100100011101001110010110011011011001010" + }, + /*51*/ { BARCODE_EAN128_CC, 3, "[01]12345678901231", "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]12345678901234567890123456789012345678901234567890123456789012345678901234567", 0, 32, 154, "Example with CC-C 5 cols, 30 rows", + "1111111101010100010101000001000000101000001000001001110111110111010010000010000100010111110110100111101110110010000110011110101001111000111111101000101001" + "1111111101010100011111010100000110111001011001000001110001101110100011000111011111010111010001110001101110110011110011011111010100001100111111101000101001" + "1111111101010100011101010011111100100101000011110001011000101110000011111010011101000100010110001111101011100100001100011111101011010000111111101000101001" + "1111111101010100011101001001110000111110111100101101100100010000110010010111000111000110010000100110001000101100000110011111010111111010111111101000101001" + "1111111101010100011010111101100000100110111110100001111100011000101011011100111110100110100001111011001100110111100010011101011100000110111111101000101001" + "1111111101010100011111010111100110111101011111001101000101000111100010011000110011110101101110111110001110101000111111011101011111000100111111101000101001" + "1111111101010100010100111100111100101110001111011001111011110010001011100110001000110110100010110000001100110001000001011010011100111100111111101000101001" + "1111111101010100011111101001001110100110011111000101010111100001000011110010001101100101101001111110001111001101101000011110100100100000111111101000101001" + "1111111101010100011010011001111110101111100001101001000010001011110010001111000100010111011010001111101100111100010011011111010011100100111111101000101001" + "1111111101010100010100011110111100111100111001011001000110000110010011000111011000010111010011000111101101110110001000010100011101110000111111101000101001" + "1111111101010100011010011100000010111000000101100101111101101000010010000010001111010110101110000010001011110001011110011101001110000110111111101000101001" + "1111111101010100010100010000011110110001110100111001100011000101111011110111010111110110010001001111101110011111001011011111010001110100111111101000101001" + "1111111101010100011101000001001110111110110101111001110111010010000011001100110000110111010011101111101111010001011110010100000101000000111111101000101001" + "1111111101010100011110100011011000100100001111101101111011001100100011111010000010110111101000001101101110100001101000011110100010000010111111101000101001" + "1111111101010100010100000100111100101100000110111101000111101000010011011101000011100100110110111100001100010010111110011100101011111100111111101000101001" + "1111111101010100011001011001110000101101110001100001000110001101000011000110010000010110110110011000001101001000011000010010100000100000111111101000101001" + "1111111101010100010100011111101110100011010011111101111000010001001011100100000011010111101101100001001110100000110100010100011111001100111111101000101001" + "1111111101010100011111001011100010100001000010111101101100110011111010101101111100000100101110011111101000011001000111011100101111100100111111101000101001" + "1111111101010100011101101000001100110000110110011001101000001001100010011000110000100110010100011000001100001001000011011110110100011100111111101000101001" + "1111111101010100011110100000100010110000100111101101011001111100001010010011110100000111001001110110001111101101000100011111010000010110111111101000101001" + "1111111101010100010110110111100000110100100011111001011111011101100011000111010111000111000101111100101000110100000111010010010000111100111111101000101001" + "1111111101010100010110111000011000110111100011100101001000010010000011000011011000110111100110100111001100010000100011010110111001100000111111101000101001" + "1111111101010100011110010100000010110001011110011001100011011110001011110000010100100111010001100010001100101111000110011111001010000110111111101000101001" + "1111111101010100011110010011110010101110110000011101011111011000001010011000110011110110100010111110001000011100010110011001001111110010111111101000101001" + "1111111101010100011001000100110000110001010110000001110011010001100011110011110100010110110010000010001111011001011100011011001000000100111111101000101001" + "1111111101010100011100101111001110110001011100100001110010111101110010011110101111000111010110001000001111100100001011010010111100100000111111101000101001" + "1111111101010100011111100100011010100110100111000001011000110001111011000011010111100111110100111010001011100000010110011111011001111010111111101000101001" + "1111111101010100010010001110001110111001101000110001100100010000011010001110011110110101001100110000001000110001101000010010001110111000111111101000101001" + "1111111101010100011111101101101110100100111101000001010000111110011011110110011010000111110011001000101101000001110100011110110110100000111111101000101001" + "1111111101010100010110001110111110100111000000101101000001101000111011111001011101000101111101111011101000111011001110010010000010111100111111101000101001" + "0000000001011000110000101000100110010011010011000110111010011100011101001001111010110010000100101001100011001001110010100001000101110010001001110001010000" + "0000000110100111001111010111011001101100101100111001000101100011100010110110000101001101111011010110011100110110001101011110111010001101110110001110101100" + }, + /*52*/ { BARCODE_EAN128_CC, 3, "[01]12345678901231", "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]12345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, 28, 171, "Example with CC-C 6 cols, 25 rows", + "111111110101010001101010000110000011010000001001100111011111011101001000001000010001011111011010011110111011001000011001011011110011100011111010100111110111111101000101001" + "111111110101010001111010100000100011100011011101000110001110111110101110100011100011011101100111100110111010001100001001001011111011000011110101000010000111111101000101001" + "111111110101010001010100011110000011111010011101000100010110001111101011100100001100010011110000010010101100010111000001011010011100000010101000001111000111111101000101001" + "111111110101010001101001001100000011001000010011000100010110000011001000100001000001011011110011101000100001001000010001111101101001111011101001011100000111111101000101001" + "111111110101010001101011100000010011001101111000100110101110000001001111001001100011010010000111101000101000001111010001111110101000111011010111000001000111111101000101001" + "111111110101010001111010111100010010001100001011100100000010101111001001110111001111011111010011100100101111010010000001101111000010110011110101111100110111111101000101001" + "111111110101010001101001111011111011101001101111000110001010011000001100100011000111011101110010000010111101111001010001101110011010000010100111000111000111111101000101001" + "111111110101010001111101001001100010001110100111110111010000111011001001110100111110011000110111101000110000100001110101000111001011111011111101001011100111111101000101001" + "111111110101010001111110100110001011010010000111110101110000011011101000011110110110010110001110111110110011111000100101111010111110110010100111011111100111111101000101001" + "111111110101010001010001110001110011001110000110100110001101100001101011100111100110010110000011000100110110010001000001000011011010000011010001110111100111111101000101001" + "111111110101010001101001110000010011010000111000100111001000001100101110001011100011010101111110111000111110100100011001001000011111011011010011100001000111111101000101001" + "111111110101010001111110100011010011101110101111000110010010001111101001001000001111011101101011111000101100000110111101000111101000010010100011000111110111111101000101001" + "111111110101010001101000001001100011000101000110000100100000101000001101100001000001010110111000110000100011000110100001100011001000001011010000010110000111111101000101001" + "111111110101010001110100011010000011101000001110110101011110010000001000110100111111011110000100010010111001000000110101111011011000010011110100010000100111111101000101001" + "111111110101010001010000010001111010110110000111100100001000010111101101100110011111010101101111100000100101110011111101000011001000111011001010111110000111111101000101001" + "111111110101010001001011001100000011000011011001100110100000100110001001100011000010011001010001100000110000100100001101110111101100010011001011011100000111111101000101001" + "111111110101010001010001111100011010110011111000010100100111101000001110010011101100011111011010001000110101111101110001100001001110100011010001111101110111111101000101001" + "111111110101010001111001011110100011000111010111000111000101111100101000110100000111011100111110101100100010100011110001000111100010100011110010111110110111111101000101001" + "111111110101010001101101000001000011110011010011100110001000010001101100010001100111011101111011001000100111000011101001010000011011000011011010000100000111111101000101001" + "111111110101010001111010000010010011001011110001100110010001111011001110001101110100010010000111101000111101001100001101000001011110001011110100000101000111111101000101001" + "111111110101010001001001001111000011011101001110000101110111101111101000001110010110010110011000011110101100100000011101000110100011100010110110001111000111111101000101001" + "111111110101010001001001100001100011011001101100000110001110110010001101011000111000011100010010111000101100011110111001001000110000110011011011100111000111111101000101001" + "111111110101010001111001010000010011110111001110010101001111110111001101100011110010011110110110000100100001101111101001100001001111011011110010100001000111111101000101001" + "111111110101010001111011011111001011010110011111100100101001111000001101110010000111010001111100011010100001001001111001101001111110100011001001111110100111111101000101001" + "111111110101010001101100110110000011110100010011110110001000010001101010011101110000011011100011000010111100111000101101011011000010000011001000101100000111111101000101001" + "111111110101010001100101111001100011011110101111100111110010000101101000010011111011011110011011100110111000100011101101100000010111010011100101111011100111111101000101001" + "000000000101100011000010100010011001001101001100011011101001110001110100100111101011001000010010100110001100100111001010000100010111001000100111000101000000000000000000000" + "000000011010011100111101011101100110110010110011100100010110001110001011011000010100110111101101011001110011011000110101111011101000110111011000111010110000000000000000000" + }, + /*53*/ { BARCODE_EAN128_CC, 3, "[01]12345678901231", "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[95]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[96]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[97]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[98]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[99]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[95]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[96]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[97]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[98]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[99]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]1234567890123456789012345678901234567890", 0, 32, 528, "Example with CC-C 27 cols, 30 rows", + "111111110101010001010100000100000010000100001000010111011111011101001000001000010001011111011010011110111011001000011001011011110011100011110111101010000110000110010100001111100101011111010001011000110000101000001100011001100100010000110011010011110111110101100011000010001100110110110000011111011110010110110010001000011001001011100011100011001000010011000100010110000011001000100001000001011011110011101000100001001000010001111101101001111010111001110010000111101001001111001001000010010000011101011100111110111111101000101001" + "111111110101010001111010110011000010010000111101000101000001111010001111110101000111011100110011101000101111010111100001111000100110110011111101001001110111001101110010001001100111110001010101111000010000111100100011011001011010011111100011110011011010000100111011111101001111100110110011010001110100111110111010000111011001001110100111110011000110111101000110000100001110101000111001011111010101111100110000111110001010110001110000001011001011111011010000100100000100011110101101011100000100011111010100001100111111101000101001" + "111111110101010001111110101110011010001111011101110110001110100111001100011000101111011110111010111110110010001001111101110011111001011010110100000111000100010000010111101000110100000111011111101001100100111110100111000101011100010001100011101110101111000110010010001111101001001000001111011101101011111000101100000110111101000111101000010011011101000011100100110110111100001100010010111110011101101111110100100111100011011001000111001000011011001001101111110111010111111011001110011110010111011111101011000100111111101000101001" + "111111110101010001110100100111000010011100111010000111101110110111001111011000100111011110010010111100111011100010000101111011001000111011010110111000000110010100001100001000010011000011011000011011001100110100000100110001001100011000010011001010001100000110000100100001101110111101100010011111001101011110100100001100001101001000010000100010110011100011000101001100011000001111011110100001010000100100001000110010000110011101100110011000011011011110001110010100100001001000001100001101100011011010011000111000111111101000101001" + "111111110101010001010111100010000010010001111100110111001101111001101100010111100110011000110111100010111100000101001001110100011000100011001011110001100110010001111011001110001101110100010010000111101000111101001100001101000001011110001011110010001000010111110110001010001110000001011010011100101110000110111001011000000101100010111001000011100101111011100100111101011110001110101100010000011111001000010110111001001111011101111110110100011011110111001110010101001111110111001110010000111011011101011100000110111111101000101001" + "111111110101010001010010000111100010100010011110000111001001111100101110111110100011010100110011111000110110011001111101011011110111111011001001101111110101111101100000101111100100011101010110001000001110100110110000111101000110000100111010001111001100110110010111111001001011110000010100011010001111110100100111110111011001000111101000010011100010111110100101011100111111001100011110001011011110101111010000100001100110111101111110010110010010011100110111000101100001001110001111010000111101011010111111000100111111101000101001" + "111111110101010001010011110011110011010100011000000111101000100111101100111000110010011000100110111000110100111001111001100100011001110011101100010001100111101100001011101000011011110111010001100011100110110110010000010001001000100010000010110111100111000110110010010000001100011000011011011001110110000010110010000110111001110100011001111011100011010000110111001110001010001010000011001100011100100100111000101100111011000001110110010000110010000010100010000110011011011000001010011110111100011101000110111100111111101000101001" + "111111110101010001111010010000001011110011001100010110111001111100101111000001010010011011100011111010110010111110111001110010000111011011110010100100000100011001111101001001111001001111011110100010100000101110110011111101000010111100001011110001000100010100100001111101101111100101101110011110100000010010111010000011000101001111000101111011110100010000010110100011110011001110111011110010011000101110001000111100000101101101001001111010000011001000111001000110000101111001101101000001110010011110100100100000111111101000101001" + "111111110101010001010001011110000010001100001001110100001110101100001111110001001101011101111000101110100100110001111101000111100001010010011111001100100110001010011111001110001011111010011010001001111100101001110111111001110111111010100011001100100111100110101100011111101011100000100110010100000010111100110001011011111101101100000101111011011000010011110100000101000111101101101001111000011001100001011110111101011111011001001100110001111011110101111001000101011000011111001100001011111101011110100111100010111111101000101001" + "111111110101010001010001111011110010010001110111000110010011001110001010001000010000010010011101110000110011100011010001001001111001111011101011101111100110000110101000001111011011001111010011101111001100110010110111000001001100111101110011110111100100010110001011100111101101110011000010011010001110011110111101110000101101001100001100100010011011001000000101101100010000001101100110110000011011000100000010100000101010000001111011100110111010011100111100110100100000100000101110011101000010010100001100110000111111101000101001" + "111111110101010001110100111100111011010001110010000100010111110110001110110001110001011111011010000010111100111011100101110011011101000011111011100011010110100001111011001111001000110110011101000011010000111101010000100001110101110000011011101011110011100111001001101000001110001100111001011111011010000100111000100110100001110100011000010010100001111000010101111001011110001011101011111000011110010011011000101100111110001001111010000110110011100001000110100101001111010000001001000011111011011101001110000110111111101000101001" + "111111110101010001111110100001101010111001110111100101110100000110001110010111110001011101001111100100110011100001011101000111100010001011011100100011100101011001111100001101100010011110010000010110111110111001010111111001110111000101111011000100100111110101001000001111001101100010011110010110000100111000101000010011110001010001110111111010001100010011100100011110111011101001111101110011011000100111111010101111001001000001011110100001000011000111001001110100111110110000101010000100001111011101000111110010111111101000101001" + "111111110101010001110100000100111010101000000100000100000100010100001110111000101000011011110001110010101000100010000001001110111101100011000101110011110110010010110000001111011110100010010100100000010000100011000110010001101100010010000010001101111011100110100001011000001010000010100000011001010011000000111000011001001101111011110100010010100000100000100111001010111000001110100000010111010110001110110000110100011011100001110001100101100011110110010111000100011011100011001000101000010000011001010011000000111111101000101001" + "111111110101010001110100011000010011111001000100110100010111111011101011000101111110011101001100000010100010111100000101110001000110010011111101010111000111010001110001101110110011110011011101000110000100100101111101100001111110100101110011011011110100000111110110001101101000110011111001010010111110110000111010000110010001110110111000100011011001111000010100110111110100001111100011000101011011100111110100110100001111011001100110111100010010101111001000000101110100001111101100011000111101011110100010000010111111101000101001" + "111111110101010001111110010110001010001000100011110100110110001111001001110011101111011000111100101100100001101101111001101110101110000011111100101110110110101011111000001111100010111001010111110001101000101100011001111001000110010001110010111110000110100100001000101111001000111100010001011101101000111110110011110001001101000111000100011010001111010001000101111110011100101101001000011111010111000001101110100001111011011001011000111011111011001111100010010111101011111011001000111101110111010010100001111000111111101000101001" + "111111110101010001100101100111000011000110110000110101110011110011001011000001100010011011001000100000100001101100001001110010001011100011010000010001100100001100110010001011011000100000011101010001110000101110001111011001111011110010001011100110001000110110100010110000001100110001000001011000010110011100111010010001110001000110000110100010010000010100000110110000100000101011011100011000010001100011010000110001100100000101101101100110000011010010000110000110000100011011101001110011101000011101101011000000111111101000101001" + "111111110101010001111010000100001011100100000011010111101101100001001110100000110100011111101110100010110010111000100001111010100000010010100011110001000111110111000110101100000100111001011110100010000100110001001111011001010001111100011011100001000110100100010000111100101000111100101111010000101111010000101011111101110001111101001000110010010000111110110111101100110010001111101000001011011110100000110110111010000110100001111110010010111011110010000100010110010011100000101001000111110011010100011111001100111111101000101001" + "111111110101010001011010000111000010011100101100000100011011000111101000011000010111011100111110100110100101000111100001111011001111101010111011000001110101111101100000101001100011001111011010001011111000100001110001011001101110100111000010111011110111110100000111001011001011001100001111010110010000001110100011010001110001001000110011111010000111100100010101100100001110001110010100111111011101111001001110111101011110001001001100101110000011111100010110010100100001000111101101001000111110011011010111100000111111101000101001" + "111111110101010001110110100000110011110111101000010100001001000010001100100001100111011101110110000110111011000010011001110100100011100011000010001000110111001000100111001011001110110000011011000011001100111101110000101101110000110100110010010111011100000100001011110111101110100001000111011000011010010000101111001111010001001000011001100010101110001110000100001101100001001010111100111100010000100111001110111001010111000001001100011100011010010001110011100111101101001110001111011101000110010110110000010000111111101000101001" + "111111110101010001110100000111011011101011000100000111110010000101101110010011110111011111101101000110111101110011100101010011111101110011100100001110110111010011000000101111001010000100010000101111100110111010111001100001101011100001000010111000010111110110100001110010001000100111110110011101101111001100111010011000000101111000100001001011011110101111100111101000110001101110100000110001011111011010100000110010111000010001100000101110100011111011000110110111110100101100001111001100110001011111010000010110111111101000101001" + "111111110101010001111100100111010010001110100110000111001111101001101100111101001100011011000101111000100110001000011101110001011111010010111100010000010101110011000011101111010011110010010000111010000110100010000101111001101001100111111011001000010111110100100000010111101100110100011110010011111001110110101111100011101101001010000111100011111001011100100101111001110011101000110100001110010001111001010000110011010111100001100110010011110011110111110101110111111011011101001000110000100111011001001101111110111111101000101001" + "111111110101010001011011100001100011000110000101000110010000010001101001100000110100010110110000100000111000011001001101100000100110111010110001101000000100100001100110001010001100011000010100111100011110111000011010001101000101100110000011101101011000000110110001110011101110101101111000011001110011010000101000011000001101100010000010110011001110111001100110111000111001101000100111011100011001001110011110110110110000110001110010010011100010011101111011000100011000110010001001000111011100011101100100110000111111101000101001" + "111111110101010001111100101100111011111100101011100111110100110111001111001010000010010011100100111110111001011000010001111010110000110011111000011010100110100000111000101111000110110010010100011110000100100010111111011101011110101111000010010001111001000111100010011001101110100111000110011101110111101000111100010001001001111011000110001011010000011110110111101001000001001001011110000010011000100011110110101110110011111101101001110000010011110010010000100111111001001011101111000100001001011111001010000110111111101000101001" + "111111110101010001011001101111000011011010011110000110011000010111101111010111110110010111011100111100111001111010111001000010010011110011001010011111000110111010001110001110110101111100010101000011110000111010111110010001110101111110011010110000011011110101111100011010001011000111011111010001100110011110100101000011110001001001001111000011000111101101110100111001100111001011000000101110010011001100111100111101101011111101101111100010010010100011101111110110111000100011101011101000000110011101100100111110111111101000101001" + "111111110101010001100100010011000011001101100011000110110100001000001001100111101110011111011110100110110001110110010001001000001000001011100111010000100101000000100000101101110111100111010011011000010000110010001110111101101100010001000010000110110010000110001001011000001000010010000001011010000100000110111101000010111101000100001110111011001110000110100110000110100010001100100000010110011101110001100110100010000100100001110001100100011010000010110000110111010000110111101010100000010000010010001100110000111111101000101001" + "111111110101010001001011111011000010011110110111110101110101111100001011110000101111011110100100000010111110000100101101100100011110011010000101111101100110001101111001001110110011100100011110100001010000111110100110111001100110011110001010001110100111110111101100011010001111110101101111010010111110001100111101110011101001110100011010000011101000111001100110100011101000001110010011100011011110100110001100111110000101011001110010110000001011111001100001010111101100111001101111100100010011010010111100100000111111101000101001" + "111111110101010001001000010111100010011101000110000110111001011100001010001001111000011001110101110000100111000110111001110101011111100011001011001111110110011001000111101001010000111100010110001011100000111110100111010001000101100011111010111001000000110101100010111000001101001100111111011001001000111110101001011110000001011111001110011010110000010111000100000100010111101010001100011111010100000100111100111111001011000101000111100001010010001110001011000100110010000011101000100010001111010110001011100000111111101000101001" + "111111110101010001001000111000111011001000001001100100110000111011001100110011100111011010011100111100110010011101111001000101111011110010100001110001110100011000011010001101111011100010010100110001100000101100011110111001111011110101000010000010001101100100011011001000001101010000110000011010011100011110111010110011110001100001100001010010100100000100000101100111011000001111011110110011010001101100010000111000011000101101111001110101100011011110011100010110110000100100001000011000110010011100100001011100111111101000101001" + "111111110101010001111011011000010011111101011011110111101010000010001111001011000110011111011101100100110100011100000101010111110001100011010111111011110100011110100111101101011110001100010110111111001100111110100010001101011010011111100010011101011111000111110110100010001110001101110001010000001011110010100101111110011101100001011110011011110100111011100111001001110001101111010001000001010111000100111110100001011110010001101110111110100011111011010001000111001011000001001100110001111001011110110110100000111111101000101001" + "111111110101010001000101001111000010011101001100000100001100010111001000001101000111010001011011111000101011000011111001011001100111100011011110000100110101101111011111101011111101110001011110110111110010110001111101010001001111010100000011100011110101110100110000100111001010001000111100010110111011111000111111010011001001001111001110111010111011000111000101100000100011101010010000111100010010001101111100100100110111110001100111101011000011110010001111010111011101000111101100111110100010010110000010011100111111101000101001" + "000000000101100011000010100010011001001101001100011011101001110001110100100111101011001000010010100110001100100111001010000100010111001000100111000101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "000000011010011100111101011101100110110010110011100100010110001110001011011000010100110111101101011001110011011000110101111011101000110111011000111010110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + /*54*/ { BARCODE_EAN128_CC, 3, "[01]12345678901231", "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[95]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[96]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[97]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[98]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[99]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[95]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[96]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[97]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[98]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[99]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[95]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[96]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[97]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[98]123456789012345678901234567890123456789012345", 0, 32, 579, "Example with CC-C 30 cols, 30 rows (max)", + "111111110101010001010100000100000010001110111000100111011111011101001100011100011010011111011010011110111011001000011001011011110011100011110111101010000110000110010100001111100101011111010001011000110000101000001100011001100100010000110011010011110111110101100011000010001100110110110000011111011110010110110010001000011001001011100011100011001000010011000100010110000011001000100001000001011011110011101000100001001000010001111101101001111010111001110010000111101001001111001001000010010000011100110111011110101101100010000001110101000111000010101111011110000111111101000101001" + "111111110101010001111101011011100011100110011101000101111010111100001111000100110110011111101001001110111001101110010001001100111110001010101111000010000111100100011011001011010011111100011110011011010000100111011111101001111100110110011010001110100111110111010000111011001001110100111110011000110111101000110000100001110101000111001011111010101111100110000111110001010110001110000001011001011111011010000100100000100011110101101011100000100010111100010111100100010000111101001001101111110110011111011001100110111001011100110001110000010011001011111010100001100111111101000101001" + "111111110101010001010111000111111010110100000111000100010000010111101000110100000111011111101001100100111110100111000101011100010001100011101110101111000110010010001111101001001000001111011101101011111000101100000110111101000111101000010011011101000011100100110110111100001100010010111110011101101111110100100111100011011001000111001000011011001001101111110111010111111011001110011110010111010011110001100110101110000010110001011000001001110010110110000111100100001000010111101101100110011111010101101111100000100101110011111101000011001000111011111101011001000111111101000101001" + "111111110101010001110100100111000011000011011001100110100000100110001001100011000010011001010001100000110000100100001101110111101100010011111001101011110100100001100001101001000010000100010110011100011000101001100011000001111011110100001010000100100001000110010000110011101100110011000011011011110001110010100100001001000001100001101100011011110011010011100110001000010001101100010001100111011101111011001000100111000011101001010000011011000011101100110011100110001011101111001111011110101000011100110111011110101000110011000001000001011101110011010011000011100111111101000101001" + "111111110101010001010111100100000011110010001000010111110110001010001110000001011010011100101110000110111001011000000101100010111001000011100101111011100100111101011110001110101100010000011111001000010110111001001111011101111110110100011011110111001110010101001111110111001110010000111011011101001100000010111100101000010001000010111110011011010111111011110110010111000100001111001010100000011101000001110110111000110111010001100101111001100011111011010100000100100111111011101110111011110100011111000011010010111110100001001101011100100011111011101011100000110111111101000101001" + "111111110101010001111110100110100011010001111110100100111110111011001000111101000010011100010111110100101011100111111001100011110001011011110101111010000100001100110111101111110010110010010011100110111000101100001001110001111010000111101011010100011111000111101001111001001000011101000011010001000010111100110100110011111101100100001011111010010000001011110110011010001111001001111100111011010111110001110110101100110000111101111001000111101010110010011100000110010001011111001000111101001000010011110110000110111100010111101001010001001111000011101011111101100111111101000101001" + "111111110101010001010011110011110011100011010000110111001110001010001010000011001100011100100100111000101100111011000001110110010000110010000010100010000110011011011000001010011110111100010111000111000100100011011000010001001110000111010011110011101001100101100110000100001001101100000100011100100110011110100111001111001101000001000100001010100001100000110110001000001011001100111011100110011011100011100110100010011101110001100100111001111011011011000011000111001001001110001000111011110110011101000001001110100101000010000001100110000010010011101000110011110111111101000101001" + "111111110101010001111010010000100011000101110001000111100000101101101001001111010000011001000111001000110000101111001101101000001110010011101110111101000111111011110110101111101100101000011000100011101000111101000000101001000111011111101010001110101111100111101101110011001101101111000100011010011101000000111110100100110001111000011011010011001000111001000111010110001000001100100000011101011111010001000110110010011101000001111001001000010011111100100101110111100010000100101111010000110011011110010000010100110101110000010001001000111110110011110100100100000111111101000101001" + "111111110101010001010001001111000011110101111001000101011000011111001100001011111101010110001110111110111100100111101001110100111110010011001001111110100100001110100110001011001000011100011111101011101100100001110001001101111110010011001011001111001000110111100101111010001001110100011000010000001010111100110001000101111101111011110101111011010001101111110100011000010011101100111000101110010111001000000110101101110111110001001000110011111010001010111100000100011110010100001000010001001111011011111000010010100010011001111101100111101000110011110100111101000111111101000101001" + "111111110101010001010001111011110010100000010000010110111011110011101001101100001000011001000111011110101111011110100001101110011000100010000100110000110111110110100111101100010100110000010010111001110000110101000011000001110100100111000010100100000100000110110001000010001101111011110011010010001110111000111011100110011001010000011000110011011010000100000101111001111000101110111000101000011101100010000110111001101011000001100101110011110010011100111001000111101000010111101000100111011100010001001100110000111000101000111001100101100011100011010000110001110111111101000101001" + "111111110101010001110100111101110011111010011011100110011001111000101000111010011111011110110001101000111111010110111101001011111000110011110111001110100111101000110110001011000111110010010110111111011000110101111100111001001011111000110011111001001011000101001111000001001010011110100000010011011111100110101111000101111001111000001001010011110010001001000111111011101101101110001001110110011110000101101100100000101111001001010011111001100011111010100000110100111101101111101011101011111000010111100001011110111101001000000101111100001001011011101001110000110111111101000101001" + "111111110101010001111101000011101011000100010111110101101100011110001000111000100110010100101111000000101111100111001101011000001011100010000010001011110101000110001111101010000010011110011111100101100010100011110000101001000111000100110011100101001111110111111001011001001001010000011110011110001011110010110100111111000101001111010000010010110010000001110100011101100111001101110100000111011011101011100000100111010001100001101110010111000010100010011110000110011101011100001001110001101110011101010111111000110010110011111101100110010001111011110100011110100111111101000101001" + "111111110101010001110100000100111010100000110001100110010001000011001101001111011111010110001100001000110011011011000001111101111001011011001000100001100100101110001110001100100001001100010001011000001100100010000100000101101111001110100010000100100001000111110110100111101011100111001000011010010000110000111001100001011001000010000010001011110011010111000110010000010011001110011000010110010000010100100000100011011001000001001000000100100011100101000111000111010101110000001001000011011000011011110111100110110010001100011101110111001000001011001010001100000111111101000101001" + "111111110101010001111010001100110010011101111110100111110011011001101000111010011111011101000011101100100111010011111001100011011110100011000010000111010100011100101111101010111110011000011111000101011000111000000101100101111101101000010010000010001111010110101110000010001011110001011110010001000011110100100110111111011001111101100110011011100101110011000100001101111101001001011110100000011110100011011000101111101000111001010000011110100011111101010001110111001100111010001011110101111000011110001001101100111111010010011101110011011100100011110100010000010111111101000101001" + "111111110101010001111100101110100011011110000101100111010111110000101110001111010111010011011011110000110001001011111001110110111111010010011110001101100100011100100001101100100110111111011101011111101100111001111001011101001111000110011010111000001011000101100000100111001011011000011110010000100001011110110110011001111101010110111110000010010111001111110100001100100011101100111110010001010100000010011110110011100100111001111001011111011011011111000100100110001110100011101100011111001010010011110111001110111111010011001001111101001110001011100101001111110111111101000101001" + "111111110101010001100101100111000010001001110111000101100000110010001110110100000110011011011011000000100101110011100001011001111001110011100010010011100110110001110011101111001101001110011000100001000110110001000110011101110111101100100010011100001110100101000001101100001110110011001110011000101110111100111101111010100001110011011101111010100011001100000100000101110111001100010101100000011100110100011000111100111101000101101100100000100011110110010111000110001000100001101101100110110000011000011000100010100100111100111101010000010000010011101101001100000111111101000101001" + "111111110101010001111010000100100010011001001111110111101011100011101110010001100001011100100111011000111110110100010001101011111011100011000010011101000110111001111101001100100111000010011110001010001000110010011110001101110101111011100011000010111100110110010111100110001111101101010000010010011111101110111011101111010001111100001101001011111010000100110101110010001111101010011110001000010000110101111110110011100111110101101101111000100011101011101100000100001101111101001110101110011000011110111000111010111010001110011001000100111110011010100011111001100111111101000101001" + "111111110101010001101101000001111010110000100111000101101000000111001101110000101110011010110001111110101110010001100001001101001110000010110001100011110110000110101111001111101000011101010011000100001110101000100111100001110010011111001011101111101000110111101011110100001111010111100001010011110100001000101101000011100001000110001011100011110001011110100101000100111100001000001010001111010000001010011110110010100011111001111110010011010010110001000001110100100010000111101100111110110110010111001000011000101001100001111101101111001100111011100101111110110111111101000101001" + "111111110101010001110110100000110010001101100001000100111000011101001111001110100110010110011000010000100110110000010001001000011001100011000010100110000100010011011000001111010001001111011001110001100100110001001101110001101001110011110011001000110011100111011000100011001111011000010111010000110111101110100011000111001101010000011000110010010100001000000110011000001001001001100110000100010000010101000000100100001100001101000101100110000011000010001000110111011011001110001111011100001011011000110000101000110010000010001101001100000110100011100100110111100111111101000101001" + "111111110101010001110100000110010011110100000010100100011101111110101000111010111110011110110111001100110110111100010001101001110100000011111010010011000111100001101101001100100011100100011010000111001000110010011100000101111010110110000010001101111100010111101000101000001011101100111111010000101111000010111100010001000101001000011111011011111001011011100111101000000100101110100000110001011111000010010110111100111011101001111101101000010011111100101011100111110100110111001111001010000010010011100100111110111001011000010001111010110000110011111010000010110111111101000101001" + "111111110101010001111100100111001010000111000100110111111001001100101100111100100011011110010111101000100111010001100001000000101011110011000100010111110111101111010111101101000110111111010001100001001110110011100010111001011100100000011010010011001111100111101001111001001100100011111101010111100011001100101111001000010001010001100011111011011000001011110110110000100111101000001010001111011011010011110000110011000010111101111010111110110010111011100111100111001111010111001000010010011110011001010011111000110111010001110001110110101111100010110110000011110111111101000101001" + "111111110101010001011011100001100011010100001100000111010010011100001010010000010000011011000100001000110111101111001101001000111011100011101110011001100101000001100011001101101000010000010111100111100010111011100010100001110110001000011011100110101100000110010111001111001001110011100100011110100001011110110001001110111101100010100001100011001101100011000110110100001000001001100111101110011111011110100110110001110110010001001000001000001011100111010000100101000000100000101101110111100111010011011000010000110010001110111101101100010001000011101100100011000111111101000101001" + "111111110101010001111100101101110011000011011110100111100100001010001001100011111010010100111100000100101001111010000001001101111110011010111100010111100111100000100101001111001000100100011111101110110110111000100111011001111000010110110010000010111100100101001111100110001111101010000011010011110110111110101110101111100001011110000101111011110100100000010111110000100101101100100011110011010000101111101100110001101111001001110110011100100011110100001010000111110100110111001100110011110001010001110100111110111101100011010001111110101101111011111001010000110111111101000101001" + "111111110101010001011001100111100011011000100111100100000101101111101100101011111000011111100101100100100101000001111001111000101111001011010011111100010100111101000001001011001000000111010001110110011100110111010000011101101110101110000010011101000110000110111001011100001010001001111000011001110101110000100111000110111001110101011111100011001011001111110110011001000111101001010000111100010110001011100000111110100111010001000101100011111010111001000000110101100010111000001101001100111111011001001000111110101001011110000001011111001110011011101100101111100111111101000101001" + "111111110101010001100100010011000011011000100100000100011011110111001101000010110000010100000101000000110010100110000001110000110010011011111011110101100100010111011100001111001101011100011001000001001100111001100001011001000001010010000010001101100100000100100000010010001110010100011100011101010111000000100100001101100001101111011110011011001000110001110111011100100000101111011110010100011011100110100000100001101110110001001011111011111011101111011100110111100111001011001000110000110010011000111011000010110100111011110001000100011011000011011001110011100111111101000101001" + "111111110101010001001011110000100011100100011100110101110010001111101111010011001100011101101110001000110110011110000101001101111101000011111000110001010110111001111101001101000011110110011001101111000100110101110000001001111001001100011010010000111101000101000001111010001111110101000111011100110011101000101111010111100001111000100110110011111101001001110111001101110010001001100111110001011101011110111000111000110001110101001001111101100010010011110000010111110010100011001111100111011001011100001011000010111010000011101101010111100100000010010111100100000111111101000101001" + "111111110101010001001000010011110011100111100101110100111100011001101000010100001111011001100010111100110011111001010001100010111111001011101111100010110111010111111001101111010111110110010001111011101110110001110100111001100011000101111011110111010111110110010001001111101110011111001011010110100000111000100010000010111101000110100000111011111101001100100111110100111000101011100010001100011101110101111000110010010001111101001001000001111011101101011111000110110000100111101011100100000110011000101111110010100010001101111101001110010110000011100100011111010111111101000101001" + "111111110101010001001000111000111011000100011001110111011110110010001001110000111010010100000110110000111011001100111001100010111011110011001110011001000101100001100001001111011000100111011110010010111100111011100010000101111011001000111011010110111000000110010100001100001000010011000011011000011011001100110100000100110001001100011000010011001010001100000110000100100001101110111101100010011111001101011110100100001100001101001000010000100010110011100011000101001100011000001111011110100001010000100100001000110010000110011101110111011000011011001000010011000111111101000101001" + "111111110101010001111100100100011011001001111000110111010111101110001100001011110011011001011110011000111110110101000001001001111110111011101110111101000111110000110100101111101000010011010111001000111110111010001110011001110110111100110010110101111110000111101001100001101000001011110001011110010001000010111110110001010001110000001011010011100101110000110111001011000000101100010111001000011100101111011100100111101011110001110101100010000011111001000010110111001001111011101111110110100011011110011000110010110110000111101001001110111111001011110110110100000111111101000101001" + "111111110101010001100010100011111011011101000111000100010010011110001001100011001111010001101100011110110000111110100101010000110011111011000011111010100100010011011111001010001000011110010011110011000110101111000110001101111011011111010010111001000011000110010010011111001110000101111101010101110011111100111111000101100101111110100110001011111100101110110100010011011111001001100011011110010111101100000110101111011001100001111100010111001010100010111100000110100100011111001110111100101110010000111010001100111111010011001001010001000011110010110000110011110111111101000101001" + "000000000101100011000010100010011001001101001100011011101001110001110100100111101011001000010010100110001100100111001010000100010111001000100111000101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "000000011010011100111101011101100110110010110011100100010110001110001011011000010100110111101101011001110011011000110101111011101000110111011000111010110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + /*55*/ { BARCODE_EAN128_CC, 3, "[01]12345678901231", "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[94]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[95]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[96]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[97]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[98]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[99]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[94]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[95]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[96]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEF", 0, 32, 579, "Example with CC-C 30 cols, 30 rows (max)", + "111111110101010001010100000100000010001110111000100111011111011101001100011100011010011111011010011110110100100110000001001100110100000011001100100100000100011000001101001011001100001000010001100001100010100001011000001101110111101101000010000010100001000100100001100110001011000111000011010011000001100010111011001000011001110110100000110010001010000001000100011000110000101100110000100001011110110101110000111011001000110001100100010110000011101100101100000100101110111000001100001011001110011000010000100110110010000100110001110011101000010010101111011110000111111101000101001" + "111111110101010001111101011011100011010001110000100111010001100010001010011111101110011111011001100110111010000011010001111010001000100011111101110110110111100110110010001111001011000011011110001000100010101110011011111101111110011010011011110000101000010111100100100001001110100111101110010001000111100100111101011101110001110101111000111011111101100101100100010011110100001110001000110010011111100010101110101101111100001001111001010000100011110101100110000111010000111011001111101100010100011000100011110110111111011010001101111101100000101011111010100001100111111101000101001" + "111111110101010001010111000111111010010111011111100100001101000011101111110110011101011101011111000100110110001001111001001110011001110010011000011011110111001111100101101110110001011111010010010111100000110001101011110001101110101110000010010110001111100101001011110000001101000100111110011100110100111110111010111110000101101110011001111011100100011111010110111111001100101010010011110000011101011111010000110011000101111001001001100011111010001110110001110111001110101111001110111111010010010000011010011100110111000101110001100111000101110011111101011001000111111101000101001" + "111111110101010001110100100111000010001001000001000100011000110100001010001100110000010010011001100000100110011000010001100111000110010011001010000110000111101111001101101110010100011100011001001110111100110111001101000001110011010000110010111011110110000100010110110000001101000000100011010001001111011110110110001100001101111011110100100011110010110111110111010011011110001101100010100000010001001100110000110110111100111101101000111011110010000100010000010110011000110011001000001000100001010110110000010000110110001100001101001001100110000011010011000011100111111101000101001" + "111111110101010001010111100100000010110000101111110111101011101110001010111110011000011010111111011110111111010110111101101000000111001010011010001111110110011011110001001111010010000010011110111011101000111000100000110101001100111111011010001000111100100110100111010000001110010110000100011010000011100010100001011110001001111000100001001011111011010000100110100111100110001110010001101000010000010111101000111111011010110001111011011000010010111000010111110111000001011010001110101100010000010010011111000110111011011100001001011011111010000011101011100000110111111101000101001" + "111111110101010001111110100110100011100010011111010101000001101111101101110010001110010100100001111000110010010011111001011100011000111011001111110110100111010111111001101111110100111011011101111100010110110001111101010001110100011111010011111101000011010111010011111101101011100100001100011011100010001110111101101111101001100100100111110010100011011111000100110110001111001111100001011101010011101000110000100101011110000001011000010000111010001111000100100111001010111111001011100100001100010100110111110000111001001111100101111110101100010011101011111101100111111101000101001" + "111111110101010001010011110011110010010111110111110111001101000110001100001010000110010010001100001100111100110010111001100101101110000011000011010001000111000111001010001110110000100110011110011110100100101000001100110001110110000010011011011001100001100110001011100111101000101101100000010110110000100000111010101110000001000011001100001010110011000010000100011000011000101000010110000011011101111011010000100000101000010001001000011001100010110001110000110100110000011000101110110010000110011101101000001100100010100000010001000110001100001011101000110011110111111101000101001" + "111111110101010001111010010000100010011001001111110111010000111001101111001011100111011001011100000010111001011000001001111101000010011010011001111100010111100011001101001110110111000100010111000111111010110100011100001001110100011000100010100111111011100111110110011001101110100000110100011110100010001000111111011101101101111001101100100011110010110000110111100010001000101011100110111111011111100110100110111100001010000101111001001000010011110100110001100111100010011011001000010011111011010100000111100100111101001110011101111110001101011011110100100100000111111101000101001" + "111111110101010001010001001111000010111101000000100110000011101011101111100100111010011100010111110100100111000001011001101110000010111010001111010100000110111000100011101010001110111111011011110100110000111111000101101001000110101110000010111100010100000111010111110001001101100010011110010011100110011100100110000110111101110011111001011011101100010111110100100101111000001100011010111100011011101011100000100101100011111001010010111100000011010001001111100111001101001111101110101111100001011011100110011110111001000111110101101111110011001011110100111101000111111101000101001" + "111111110101010001010001111011110011110100110111110111110100101111101110011011001110010110110000100000100001001110111001101110111100111011000011010000010111101111001101101100010011000111010011000011001000100010010000010001000110001101000010100011001100000100100110011000001001100110000100011001110001100100110010100001100001111011110011011011100101000111000110010011101111001101110011010000011100110100001100111101110101100001010111000111000010000101000010000100010110001100001011001100100000011101011011110000101100111100011101000011011000001011010000110001110111111101000101001" + "111111110101010001110100111101110011110100011011000111011000111101101100011001111010011100100110010000100010111110011001111001100110001011100010011000010111100001101101001100100111001000011010001111011000111100000110110101000111010111110011110000010110110110101111110111101111110101101111011010000001110010100110100011111101100110111100010011110100100000100111101110111010001110001000001101010011001111110110100010001111001001101001110100000011100101100001000110100000111000101000010111100010011110001000010010111110110100001001101001111001100011101001110000110111111101000101001" + "111111110101010001111101000011101010111010001100000100111110110001001001000010111100010110000010011100100111101000010001100111110100001011010110001111110100110110001111001000101000001111011001101001111000111000100111110101010000011011111011011100100011100101001000011110001100100100111110010111000110001110110011111101101001110101111110011011111101001110110111011111000101101000011100010110011100101001111110101111110011100101101100100001111011001110001001110101111000001101101001110100000011010011110110110000110110000010111101111010001111010011110100011110100111111101000101001" + "111111110101010001110100000100111011000010100000110110101110001111001101001101110000010110000110001000101110011100010001011100011110011011001100100001000110110000100001001001001100001100011110101100111110100101111101111101110011010001100011000010100001100100100011000011001111001100101110011001011011100000110000110100010001110001110010100011101100001001100111100111101001001010000011001100011101100000100110110110011000011001100010111001111010001011011000000101101100001000001110101011100000010000110011000010101100110000100001000110000110001011001010001100000111111101000101001" + "111111110101010001111010001100110011111101110010100110000100111001001110000010111011011011011110001000110010011110110001100010001110010011001011100001000111110100000101101110110011100001011100111011110010100110010011111101110100001110011011110010111001110110010111000000101110010110000010011111010000100110100110011111000101111000110011010011110010100100000111010001100100001111101001000011011111010010110000111111001001011101110100011110111011110010100000010111110011011001101111101100010010010001011110001000110010001110100001111010001110111011110100010000010111111101000101001" + "111111110101010001111100101110100010111000110111000111110001011101001100011100010111011110010111100100111010010111111001011000011011110010111001110111100110110010011110001111110100011010011011111010000010101111010000001001100000111010111011111001001110100111000101111101001001110000010110011011100000101110100011110101000001101110001000111010100011101111110110111101001100001111110001011010010001101011100000101111000101000001110101111100010011011000100111100100111001100111001001100001101111011100111110010110111011000101111101001001011110000011100101001111110111111101000101001" + "111111110101010001100101100111000011100110011001110100100000010010001110010100111000010100100000010000101000110001100001101100001010000011101001000111000100110110000100001110010001000111011100011101101100111101001101111101111101001011111011100110110011100101101100001000001000010011101110011011101111001110100110000011010001110001110011011011010011000111000111011010000110001111101110101110010001110011101000101001000001000001010011110011110010111101111010000111001111011001001010000100010000010100001100110000101000100000010001100110110110000011101101001100000111111101000101001" + "111111110101010001111010000100100010110001111110110111100101001000001010000111110110011010011100010000100100111110001101110001011001000010001011111101110111101000100000101111001001001000010000110111110010111101000110110001110110001111011011000110011110100111001001100100001000101111100110011110011001100010111000100110000101111000011011010011001001110010000110100011110110001111000001101101010001110101111100111100000101101101101011111101111011111101011011110110100000011100101001101000111111011001101111000100111101001000001001111011101110100010100011111001100111111101000101001" + "111111110101010001101101000001111010001110111011110101111000010001001011110001100011011010001001111100101100100001110001111110010011001011011111010010000100000101000111101011000111011111011101000111110100101110100011000001001111101100010010010000101111000101100000100111001101110100111000010011111011000010100111100110011001011110111001110010010001101111100101100100000111001100101111110010011011110000101100101111100111011001100010100011111011001111010001100111111001011000101001010001111000011111010000111010111101110101111101011011000011110011100101111110110111111101000101001" + "111111110101010001110110100000110011101000001011100111011100011001101111001100010111010110111110011110110111000111001101110001101001100011110111001011000110011101100100001110110001001100011010000100110000110000101000001101101011100011110011010011011100000101100001100010001011100111000100010111000111100110110011001000010001101100001000010010010011000011000111101011001111101001011111011111011100110100011000110000101000011001001000110000110011110011001011100110010110111000001100001101000100011100011100101000111011000010011001111001111010010011100100110111100111111101000101001" + "111111110101010001110100000110010011110100011000110111110010001011001001011111001100010010001111001000110010001110100001111010000001010011111010101100000101111100101110001100101111101110010000100001111010111111011100101001100011011110100010111110000101110111101011011000001001100100111111011100010011001000111101000001101101001011111000011011110100000010100111100010000010101000101111101100011110000110110010101111010001111001001000011110010011110001000100100110010000111010001111100111011001011110100110000110111110010101100001100010111000100011111010000010110111111101000101001" + "111111110101010001111100100111001010000111010000110100101110011111101000001101001110011111100101110110110010011111100101000010001011110011101110010111100100001001101111101110011001011111010010110111110000101110001101110001111100010111010011000111000101110111100101111001001110100101111110010110000110111100101110011101111001101100100111100011111101000110100110111110100000101011110100000010011000001110101110111110010011101001110001011111010010011100000101100110111000001011101000111101010000011011100010001110101000111011111101101111010011000010110110000011110111111101000101001" + "111111110101010001011011100001100011011000110011000110011001100110001100110000010001011010010001100000100100010000001001110111000101000011110111010011000100001101101000001101100110000110011110110100111000100100001010000001000010011100111011110101001111000100100011101110001010000100010000011110001010111100100000101100110001001000110011000011110110001001110111001110100000101011110001111001011010110001110000110010000010011001011000110010000010110001111001110111011000001001101110100000101110011110001001011110110100110001110001110110100001100011101100100011000111111101000101001" + "111111110101010001111100101101110011101100001110100100111110110111101110101111001110011110100100100000111100111011100101000000101111010011010011110011000110100111110011101111101001100111011111011000110110101100011111101101111001010010000010100001111101100110100111000100001001001111100011011100010110010000100010111111011101111010001000001011110010010010000100001101111100101111010001101100011101100011110110110001100111101001110010011001000010001011111001100111100110011000101110001001100001011110000110110100110010011100100001101000111101100011111001010000110111111101000101001" + "111111110101010001011001100111100011000111110100100100111110011001001000111100101000010100110011111000101011001111100001111100100111001010011101101110000101111010000010001101110010001110011110111101011110101111101110001101001100100111000010111101111011110110110001011110001000011100101100010111100001000010101111101110011001100011110010011011100010111110100111001101011111001011110001000100010010001000011110110010010001111101100110010111100010011110000100100111011110010011101101101000011110010110011001111000100100011011111001011001000001110011101100101111100111111101000101001" + "111111110101010001100100010011000010010111011100000110000101100111001100001000010011011001000010011000111001110100001001100101001100000010100000110110000110100001100011101011000001100010011110010010111100111010000010111001110111000110011011110011000101110101101111100111101101110001110011011100011010011000111101110010110001100111011001000011101100010011000110100001001100001100001010000011011010111000111100110100110111000001011000011000100010111001110001000101110001111001101100110010000100011011000010000100100100110000110001111010110011111011011001110011100111111101000101001" + "111111110101010001001011110000100011101000011101100111110110001010001100010001111011011111101101000110111110110000010101010001111001000010011000111110010100000100111100101101011110110000010010111110001100101110101111100001110110000111001011100000100110010100101111100110001101000011110110011100010110000010111110010001001101101000111000001011010111100011000110100111010000001001001111001000011101011110111000111011000111000101001011110000100010000110011111010110101111000011001110101110000110011110010000110110111101000000101001111000100000101010010111100100000111111101000101001" + "111111110101010001001000010011110011100111010111100111011111101001001000001101001110011011100010111000110011100010111001011100110001110010011110001101100110100010111110001111101101111001010001101000011100100001110100001101001011100111111010000011010011100111111001011101101100100111111001010000100010111100111011100101111001000010011011111011100110010111110100101101111100001011100011011100011111000101110100110001110001011101111001011110010011101001011111100101100001101111001011100111011110011011001001111000111111010001101001101111101000001011100100011111010111111101000101001" + "111111110101010001001000111000111011001100011001100100000100010000101011011000001000011011000110000110101101111101111001010000011001100011011000100100000100001001100110001010011100111000011010110011100000111001001101111001111011100100110010111001110010000111101000100111101100110000110011010001101111001110100001011000011001100001010000011010100011000110000100100111100111101111011011001111010011101110010000111000110100001101001000111011100010100001000100000111100010101111001000001011001100010010001100110000111101100010011101110011101000001011001000010011000111111101000101001" + "111111110101010001111100100100011011100000101101000111010110001000001001001111100011011101101110000100101101111101000001111100100010110011110100010001000111101100011010001110101111101111010100001111101100111011000011101001001111101101111011101011110011100111101001001000001111001110111001010000001011110100110100111100110001101001111100111011111010011001110111110110001101101011000111111011011110010100100000101000011111011001101001110001000010010011111000110111000101100100001000101111110111011111010001011000100101111000010001111110011101010011110110110100000111111101000101001" + "111111110101010001100010100011111011011000001011110110011101000011101110101111101000010011110110110000110001110100111001100011111010001011100100101111110100011110110011001100111010111000011011111010001000110011111010001001010110011111000010011111001101000101111100011001001110110101111100011001101011110000110001111010110001110111101000111010010111001111110100111000000101101111110101101000010111100100100000110001110010011101101011111100010010011110000010010100001110100001101000001110010110010001110001101110100111010001100001110110111111001010110000110011110111111101000101001" + "000000000101100011000010100010011001001101001100011011101001110001110100100111101011001000010010100110001100100111001010000100010111001000100111000101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "000000011010011100111101011101100110110010110011100100010110001110001011011000010100110111101101011001110011011000110101111011101000110111011000111010110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, }; int data_size = sizeof(data) / sizeof(struct item); + char bwipp_buf[32768]; + char bwipp_msg[1024]; + for (int i = 0; i < data_size; i++) { if (index != -1 && i != index) continue; + if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d\n", i); struct zint_symbol *symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); symbol->symbology = data[i].symbology; symbol->option_1 = data[i].option_1; - symbol->option_2 = data[i].option_2; - symbol->option_3 = data[i].option_3; symbol->debug |= debug; int length = strlen(data[i].data); @@ -309,11 +1153,11 @@ static void test_examples(int index, int generate, int debug) { int composite_length = strlen(data[i].composite); - ret = ZBarcode_Encode(symbol, data[i].composite, composite_length); - assert_equal(ret, data[i].ret, "i:%d ret %d != %d %s\n", i, ret, data[i].ret, symbol->errtxt); + ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].composite, composite_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) { - test_helper_generate(symbol, ret, i, data[i].data, data[i].composite, data[i].option_1, data[i].option_2, data[i].option_3, data[i].comment); + test_helper_generate(symbol, ret, i, data[i].data, data[i].composite, data[i].option_1, data[i].comment, -1 /*bwipp_cmp*/); } else { assert_equal(symbol->rows, data[i].expected_rows, "i:%d %s symbol->rows %d != %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), symbol->rows, data[i].expected_rows, data[i].data); assert_equal(symbol->width, data[i].expected_width, "i:%d %s symbol->width %d != %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), symbol->width, data[i].expected_width, data[i].data); @@ -322,6 +1166,15 @@ static void test_examples(int index, int generate, int debug) { int width, row; ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row); assert_zero(ret, "i:%d %s testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, width, row, data[i].data); + + if (do_bwipp && testUtilCanBwipp(symbol->symbology, data[i].option_1, -1, -1, debug)) { + ret = testUtilBwipp(symbol, data[i].option_1, -1, -1, data[i].composite, composite_length, symbol->primary, bwipp_buf, sizeof(bwipp_buf)); + assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), ret); + + ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected); + assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", + i, testUtilBarcodeName(data[i].symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); + } } } @@ -335,24 +1188,24 @@ static void test_odd_numbered_numeric(int index, int generate, int debug) { testStart(""); + int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise + int ret; struct item { int symbology; - unsigned char *data; - unsigned char *composite; int option_1; - int option_2; - int option_3; + char *data; + char *composite; int ret; int expected_rows; int expected_width; char *comment; - unsigned char *expected; + char *expected; }; - // Verified manually against tec-it.com and bwipp + // Verified via bwipp_dump.ps against BWIPP, and manually against tec-it.com struct item data[] = { - /* 0*/ { BARCODE_UPCE_CC, "1234567", "[91]1234567890123", 1, 0, 0, 0, 9, 55, "Test odd-numbered numeric, 1st fit, 9-bit remainder, 7-bit final, 2-bit alphanumeric latch, no padding", + /* 0*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]1234567890123", 0, 9, 55, "Test odd-numbered numeric, 1st fit, 9-bit remainder, 7-bit final, 2-bit alphanumeric latch, no padding", "1101100110111011101011110001001111100110010011110101001" "1101101110110001100001000101100010000100110011100101001" "1101101100111110001001001101100100111110111011101101001" @@ -363,7 +1216,7 @@ static void test_odd_numbered_numeric(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /* 1*/ { BARCODE_UPCE_CC, "1234567", "[91]12345678901234", 1, 0, 0, 0, 9, 55, "Test even-numbered numeric, 1st fit, 2-bit remainder, 2-bit alphanumeric latch, no padding", + /* 1*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]12345678901234", 0, 9, 55, "Test even-numbered numeric, 1st fit, 2-bit remainder, 2-bit alphanumeric latch, no padding", "1101100110111011101011110001001111100110010011110101001" "1101101110110001100001000101100010000100110011100101001" "1101101100111110001001001101100100111001000011101101001" @@ -374,7 +1227,7 @@ static void test_odd_numbered_numeric(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /* 2*/ { BARCODE_UPCE_CC, "1234567", "[91]123456789012345", 1, 0, 0, 0, 10, 55, "Test odd-numbered numeric, 2nd fit, alphanumeric latch, padding", + /* 2*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]123456789012345", 0, 10, 55, "Test odd-numbered numeric, 2nd fit, alphanumeric latch, padding", "1100100010111100110100111001011101110001000011100101101" "1110100010110001011101000001000111010111110011000101101" "1110110010110101100111111001000111100001001011000101001" @@ -386,7 +1239,7 @@ static void test_odd_numbered_numeric(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /* 3*/ { BARCODE_UPCE_CC, "1234567", "[91]ABCD12345678901", 1, 0, 0, 0, 10, 55, "Test odd-numbered numeric, 1st fit, 4-bit final, no alphanumeric latch or padding", + /* 3*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]ABCD12345678901", 0, 10, 55, "Test odd-numbered numeric, 1st fit, 4-bit final, no alphanumeric latch or padding", "1100100010111100110100111001110101110111110011100101101" "1110100010101111100110111101111000001000101011000101101" "1110110010110111100001001101101000111111001011000101001" @@ -398,7 +1251,7 @@ static void test_odd_numbered_numeric(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /* 4*/ { BARCODE_UPCE_CC, "1234567", "[91]ABCDE123456789", 1, 0, 0, 0, 10, 55, "Test odd-numbered numeric, 1st fit, 5-bit final, no alphanumeric latch or padding", + /* 4*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]ABCDE123456789", 0, 10, 55, "Test odd-numbered numeric, 1st fit, 5-bit final, no alphanumeric latch or padding", "1100100010111100110100111001110101110111110011100101101" "1110100010101111100110111101100000100011101011000101101" "1110110010100110000010111001111101011110011011000101001" @@ -410,7 +1263,7 @@ static void test_odd_numbered_numeric(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /* 5*/ { BARCODE_UPCE_CC, "1234567", "[91]1234567890123456789", 1, 0, 0, 0, 10, 55, "Test odd-numbered numeric, 1st fit, 7-bit final, no alphanumeric latch or padding", + /* 5*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]1234567890123456789", 0, 10, 55, "Test odd-numbered numeric, 1st fit, 7-bit final, no alphanumeric latch or padding", "1100100010111100110100111001011101110001000011100101101" "1110100010110001011101000001000111010111110011000101101" "1110110010110101100111111001000111100001001011000101001" @@ -422,7 +1275,7 @@ static void test_odd_numbered_numeric(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /* 6*/ { BARCODE_UPCE_CC, "1234567", "[91]1234A", 1, 0, 0, 0, 9, 55, "Test even-numbered numeric, ending in non-digit", + /* 6*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]1234A", 0, 9, 55, "Test even-numbered numeric, ending in non-digit", "1101100110111011101011110001001111100110010011110101001" "1101101110100001000100001001110110011001110011100101001" "1101101100100101111100110001000001011111011011101101001" @@ -433,7 +1286,7 @@ static void test_odd_numbered_numeric(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /* 7*/ { BARCODE_UPCE_CC, "1234567", "[91]12345A", 1, 0, 0, 0, 9, 55, "Test odd-numbered numeric, ending in non-digit", + /* 7*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]12345A", 0, 9, 55, "Test odd-numbered numeric, ending in non-digit", "1101100110111011101011110001001111100110010011110101001" "1101101110100111011100100001100010110001110011100101001" "1101101100100100011111001101111101001101110011101101001" @@ -447,17 +1300,19 @@ static void test_odd_numbered_numeric(int index, int generate, int debug) { }; int data_size = sizeof(data) / sizeof(struct item); + char bwipp_buf[8192]; + char bwipp_msg[1024]; + for (int i = 0; i < data_size; i++) { if (index != -1 && i != index) continue; + if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d\n", i); struct zint_symbol *symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); symbol->symbology = data[i].symbology; symbol->option_1 = data[i].option_1; - symbol->option_2 = data[i].option_2; - symbol->option_3 = data[i].option_3; symbol->debug |= debug; int length = strlen(data[i].data); @@ -466,11 +1321,11 @@ static void test_odd_numbered_numeric(int index, int generate, int debug) { int composite_length = strlen(data[i].composite); - ret = ZBarcode_Encode(symbol, data[i].composite, composite_length); - assert_equal(ret, data[i].ret, "i:%d ret %d != %d %s\n", i, ret, data[i].ret, symbol->errtxt); + ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].composite, composite_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) { - test_helper_generate(symbol, ret, i, data[i].data, data[i].composite, data[i].option_1, data[i].option_2, data[i].option_3, data[i].comment); + test_helper_generate(symbol, ret, i, data[i].data, data[i].composite, data[i].option_1, data[i].comment, -1 /*bwipp_cmp*/); } else { assert_equal(symbol->rows, data[i].expected_rows, "i:%d %s symbol->rows %d != %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), symbol->rows, data[i].expected_rows, data[i].data); assert_equal(symbol->width, data[i].expected_width, "i:%d %s symbol->width %d != %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), symbol->width, data[i].expected_width, data[i].data); @@ -479,6 +1334,15 @@ static void test_odd_numbered_numeric(int index, int generate, int debug) { int width, row; ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row); assert_zero(ret, "i:%d %s testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, width, row, data[i].data); + + if (do_bwipp && testUtilCanBwipp(symbol->symbology, data[i].option_1, -1, -1, debug)) { + ret = testUtilBwipp(symbol, data[i].option_1, -1, -1, data[i].composite, composite_length, symbol->primary, bwipp_buf, sizeof(bwipp_buf)); + assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), ret); + + ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected); + assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", + i, testUtilBarcodeName(data[i].symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); + } } } @@ -492,66 +1356,86 @@ static void test_ean128_cc_shift(int index, int generate, int debug) { testStart(""); + int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise + int ret; struct item { int symbology; - unsigned char *data; - unsigned char *composite; int option_1; - int option_2; - int option_3; + char *data; + char *composite; int ret; int expected_rows; int expected_width; + int bwipp_cmp; char *comment; - unsigned char *expected; + char *expected; }; - // Verified manually with bwipp (tec-it.com seems to be off by 2 for top shifts > 1) + // Verified via bwipp_dump.ps against BWIPP except where noted, when shift verified manually (tec-it.com seems to be off by 2 for top shifts > 1) struct item data[] = { - /* 0*/ { BARCODE_EAN128_CC, "[91]A", "[21]A1B2C3D4E5F6G7H8", -1, 0, 0, 0, 6, 100, "CC-A alignment, bottom shift 10", + /* 0*/ { BARCODE_EAN128_CC, -1, "[91]1", "[21]A1B2C3D4E5F6G7H8", 0, 6, 100, 0, "CC-A alignment, bottom shift 10, **NOT SAME** as BWIPP, Start B whereas BWIPP uses Start C, codeword count the same", "1101001000110100001000001101101011110111110010010001101010000010010000011101110100010000111011001010" "1101011000110101111001100001111010001101100010010000101111000011001101011100101100001000110011001010" "1101011100100011001100111101011000101110000010110000101001100110011110011011110011001110110111001010" "1101011110111000111011011001110010001011100010111000101011000011100110010000100000100010110111101010" - "0000000000001011011110000101000100011010011011000110010101110011101000100001011001110110011100010100" - "0000000000110100100001111010111011100101100100111001101010001100010111011110100110001001100011101011" + "0000000000001011011110000101000100011010011011000110010110001100101000100001010001110010011100010100" + "0000000000110100100001111010111011100101100100111001101001110011010111011110101110001101100011101011" }, - /* 1*/ { BARCODE_EAN128_CC, "[91]AB", "[21]A1B2C3D4E5F6G7H8", -1, 0, 0, 0, 6, 101, "CC-A alignment, top shift 1", + /* 1*/ { BARCODE_EAN128_CC, -1, "[91]12", "[21]A1B2C3D4E5F6G7H8", 0, 6, 99, 1, "CC-A alignment, bottom shift 12", + "110100100011010000100000110110101111011111001001000110101000001001000001110111010001000011101100101" + "110101100011010111100110000111101000110110001001000010111100001100110101110010110000100011001100101" + "110101110010001100110011110101100010111000001011000010100110011001111001101111001100111011011100101" + "110101111011100011101101100111001000101110001011100010101100001110011001000010000010001011011110101" + "000000000000001011000110000101000100001001001010011000110001010000101110110011001110001010000000000" + "000000000000110100111001111010111011110110110101100111001110101111010001001100110001110101100000000" + }, + /* 2*/ { BARCODE_EAN128_CC, -1, "[91]123", "[21]A1B2C3D4E5F6G7H8", 0, 6, 101, 1, "CC-A alignment, top shift 1", "01101001000110100001000001101101011110111110010010001101010000010010000011101110100010000111011001010" "01101011000110101111001100001111010001101100010010000101111000011001101011100101100001000110011001010" "01101011100100011001100111101011000101110000010110000101001100110011110011011110011001110110111001010" "01101011110111000111011011001110010001011100010111000101011000011100110010000100000100010110111101010" - "00101101111000010100010001101001101100011001010111001110111010011101000100001010011110110011100010100" - "11010010000111101011101110010110010011100110101000110001000101100010111011110101100001001100011101011" + "00101100011000010100010000100100101001100011010000100010011010001101000100001011001111010011100010100" + "11010011100111101011101111011011010110011100101111011101100101110010111011110100110000101100011101011" }, - /* 2*/ { BARCODE_EAN128_CC, "[91]ABC", "[21]A1B2C3D4E5F6G7H8", -1, 0, 0, 0, 6, 112, "CC-A alignment, top shift 12", + /* 3*/ { BARCODE_EAN128_CC, -1, "[91]12345", "[21]A1B2C3D4E5F6G7H8", 0, 6, 112, 1, "CC-A alignment, top shift 12", "0000000000001101001000110100001000001101101011110111110010010001101010000010010000011101110100010000111011001010" "0000000000001101011000110101111001100001111010001101100010010000101111000011001101011100101100001000110011001010" "0000000000001101011100100011001100111101011000101110000010110000101001100110011110011011110011001110110111001010" "0000000000001101011110111000111011011001110010001011100010111000101011000011100110010000100000100010110111101010" - "0010110111100001010001000110100110110001100101011100111011101001110111011100101000100001010011110110011100010100" - "1101001000011110101110111001011001001110011010100011000100010110001000100011010111011110101100001001100011101011" + "0010110001100001010001000010010010100110001101110100111010000100010010001101101000100001000110110010011100010100" + "1101001110011110101110111101101101011001110010001011000101111011101101110010010111011110111001001101100011101011" }, - /* 3*/ { BARCODE_EAN128_CC, "[91]ABCD", "[21]A1B2C3D4E5F6G7H8", -1, 0, 0, 0, 6, 123, "CC-A alignment, top shift 10", + /* 4*/ { BARCODE_EAN128_CC, -1, "[91]1234567", "[21]A1B2C3D4E5F6G7H8", 0, 6, 123, 1, "CC-A alignment, top shift 10", "000000000011010010001101000010000011011010111101111100100100011010100000100100000111011101000100001110110010100000000000000" "000000000011010110001101011110011000011110100011011000100100001011110000110011010111001011000010001100110010100000000000000" "000000000011010111001000110011001111010110001011100000101100001010011001100111100110111100110011101101110010100000000000000" "000000000011010111101110001110110110011100100010111000101110001010110000111001100100001000001000101101111010100000000000000" - "001011011110000101000100011010011011000110010101110011101110100111011101110010100111011101000100001001101101110011100010100" - "110100100001111010111011100101100100111001101010001100010001011000100010001101011000100010111011110110010010001100011101011" + "001011000110000101000100001001001010011000110111010011100011101001010000100010001001000101000100001000110100110011100010100" + "110100111001111010111011110110110101100111001000101100011100010110101111011101110110111010111011110111001011001100011101011" }, - /* 4*/ { BARCODE_EAN128_CC, "[91]ABCDEF", "[21]A1B2C3D4E5F6G7H8", -1, 0, 0, 0, 6, 145, "CC-A alignment, top shift 21", + /* 5*/ { BARCODE_EAN128_CC, -1, "[91]123456789", "[21]A1B2C3D4E5F6G7H8", 0, 6, 134, 1, "CC-A alignment, top shift 21", + "00000000000000000000011010010001101000010000011011010111101111100100100011010100000100100000111011101000100001110110010100000000000000" + "00000000000000000000011010110001101011110011000011110100011011000100100001011110000110011010111001011000010001100110010100000000000000" + "00000000000000000000011010111001000110011001111010110001011100000101100001010011001100111100110111100110011101101110010100000000000000" + "00000000000000000000011010111101110001110110110011100100010111000101110001010110000111001100100001000001000101101111010100000000000000" + "00101100011000010100010000100100101001100011011101001110001110100100111101011010000100010001101001101000100001001101110110011100010100" + "11010011100111101011101111011011010110011100100010110001110001011011000010100101111011101110010110010111011110110010001001100011101011" + }, + /* 6*/ { BARCODE_EAN128_CC, -1, "[91]12345678901", "[21]A1B2C3D4E5F6G7H8", 0, 6, 145, 1, "CC-A alignment, top shift 21", "0000000000000000000001101001000110100001000001101101011110111110010010001101010000010010000011101110100010000111011001010000000000000000000000000" "0000000000000000000001101011000110101111001100001111010001101100010010000101111000011001101011100101100001000110011001010000000000000000000000000" "0000000000000000000001101011100100011001100111101011000101110000010110000101001100110011110011011110011001110110111001010000000000000000000000000" "0000000000000000000001101011110111000111011011001110010001011100010111000101011000011100110010000100000100010110111101010000000000000000000000000" - "0010110111100001010001000110100110110001100101011100111011101001110111011100101001110111011100101110111001110101000100001001000110110011100010100" - "1101001000011110101110111001011001001110011010100011000100010110001000100011010110001000100011010001000110001010111011110110111001001100011101011" + "0010110001100001010001000010010010100110001101110100111000111010010011110101100100001001010000100010110001100101000100001011001011110011100010100" + "1101001110011110101110111101101101011001110010001011000111000101101100001010011011110110101111011101001110011010111011110100110100001100011101011" }, }; int data_size = sizeof(data) / sizeof(struct item); + char bwipp_buf[8192]; + char bwipp_msg[1024]; + for (int i = 0; i < data_size; i++) { if (index != -1 && i != index) continue; @@ -561,8 +1445,6 @@ static void test_ean128_cc_shift(int index, int generate, int debug) { symbol->symbology = data[i].symbology; symbol->option_1 = data[i].option_1; - symbol->option_2 = data[i].option_2; - symbol->option_3 = data[i].option_3; symbol->debug |= debug; int length = strlen(data[i].data); @@ -571,11 +1453,11 @@ static void test_ean128_cc_shift(int index, int generate, int debug) { int composite_length = strlen(data[i].composite); - ret = ZBarcode_Encode(symbol, data[i].composite, composite_length); - assert_equal(ret, data[i].ret, "i:%d ret %d != %d %s\n", i, ret, data[i].ret, symbol->errtxt); + ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].composite, composite_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) { - test_helper_generate(symbol, ret, i, data[i].data, data[i].composite, data[i].option_1, data[i].option_2, data[i].option_3, data[i].comment); + test_helper_generate(symbol, ret, i, data[i].data, data[i].composite, data[i].option_1, data[i].comment, data[i].bwipp_cmp); } else { assert_equal(symbol->rows, data[i].expected_rows, "i:%d %s symbol->rows %d != %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), symbol->rows, data[i].expected_rows, data[i].data); assert_equal(symbol->width, data[i].expected_width, "i:%d %s symbol->width %d != %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), symbol->width, data[i].expected_width, data[i].data); @@ -584,6 +1466,19 @@ static void test_ean128_cc_shift(int index, int generate, int debug) { int width, row; ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row); assert_zero(ret, "i:%d %s testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, width, row, data[i].data); + + if (do_bwipp && testUtilCanBwipp(symbol->symbology, data[i].option_1, -1, -1, debug)) { + if (!data[i].bwipp_cmp) { + if (debug & ZINT_DEBUG_TEST_PRINT) printf("%d: %s skipped, not BWIPP compatible\n", i, testUtilBarcodeName(symbol->symbology)); + } else { + ret = testUtilBwipp(symbol, data[i].option_1, -1, -1, data[i].composite, composite_length, symbol->primary, bwipp_buf, sizeof(bwipp_buf)); + assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), ret); + + ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected); + assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", + i, testUtilBarcodeName(data[i].symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); + } + } } } @@ -599,15 +1494,15 @@ static void test_ean128_cc_width(int index, int generate, int debug) { int ret; struct item { - unsigned char *data; - unsigned char *composite; + char *data; + char *composite; int ret; int expected_rows; int expected_width; char *comment; }; - // Verified manually with bwipp (except very large tests) + // Verified manually with BWIPP (except very large tests) struct item data[] = { /* 0*/ { "[91]1", "[02]13012345678909", 0, 11, 103, "" }, /* 1*/ { "[91]12", "[02]13012345678909", 0, 20, 86, "" }, @@ -642,8 +1537,8 @@ static void test_ean128_cc_width(int index, int generate, int debug) { int composite_length = strlen(data[i].composite); - ret = ZBarcode_Encode(symbol, data[i].composite, composite_length); - assert_equal(ret, data[i].ret, "i:%d ret %d != %d %s\n", i, ret, data[i].ret, symbol->errtxt); + ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].composite, composite_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(" /*%2d*/ { \"%s\", \"%s\", %s, %d, %d, \"%s\" },\n", @@ -664,24 +1559,24 @@ static void test_encodation_0(int index, int generate, int debug) { testStart(""); + int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise + int ret; struct item { int symbology; - unsigned char *data; - unsigned char *composite; int option_1; - int option_2; - int option_3; + char *data; + char *composite; int ret; int expected_rows; int expected_width; char *comment; - unsigned char *expected; + char *expected; }; - // Verified manually against tec-it.com (with noted exception) and/or bwipp + // Verified via bwipp_dump.ps against BWIPP and manually against tec-it.com (with noted exception) struct item data[] = { - /* 0*/ { BARCODE_UPCE_CC, "1234567", "[91]1", 1, 0, 0, 0, 9, 55, "Single numeric", + /* 0*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]1", 0, 9, 55, "Single numeric", "1101100110111101110101111101010001000111100011110101001" "1101101110111011000010001101110010101110000011100101001" "1101101100110001011111011101111010000100100011101101001" @@ -692,7 +1587,7 @@ static void test_encodation_0(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /* 1*/ { BARCODE_UPCE_CC, "1234567", "[91]12", 1, 0, 0, 0, 9, 55, "2 numerics", + /* 1*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]12", 0, 9, 55, "2 numerics", "1101100110111011101011110001101111110110010011110101001" "1101101110101110011110011001001100110000100011100101001" "1101101100100101111010000001101000001110100011101101001" @@ -703,7 +1598,7 @@ static void test_encodation_0(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /* 2*/ { BARCODE_UPCE_CC, "1234567", "[91]123", 1, 0, 0, 0, 9, 55, "Odd-numbered numeric", + /* 2*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]123", 0, 9, 55, "Odd-numbered numeric", "1101100110111011101011110001000111100010001011110101001" "1101101110100111000111001001101000010001100011100101001" "1101101100110101110001000001111010001000001011101101001" @@ -714,7 +1609,7 @@ static void test_encodation_0(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /* 3*/ { BARCODE_UPCE_CC, "1234567", "[91]1234", 1, 0, 0, 0, 9, 55, "Even-numbered numeric", + /* 3*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]1234", 0, 9, 55, "Even-numbered numeric", "1101100110111011101011110001001111100110010011110101001" "1101101110110001100110011001101100100000010011100101001" "1101101100101111101001110001001110010111110011101101001" @@ -725,7 +1620,7 @@ static void test_encodation_0(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /* 4*/ { BARCODE_UPCE_CC, "1234567", "[20]12[91]12", 1, 0, 0, 0, 9, 55, "Fixed len + even-numbered numeric", + /* 4*/ { BARCODE_UPCE_CC, 1, "1234567", "[20]12[91]12", 0, 9, 55, "Fixed len + even-numbered numeric", "1101100110111111010001100101001111010001000011110101001" "1101101110100011001110011001110010000010111011100101001" "1101101100101111000101111001111010010001000011101101001" @@ -736,7 +1631,7 @@ static void test_encodation_0(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /* 5*/ { BARCODE_UPCE_CC, "1234567", "[20]12[91]123", 1, 0, 0, 0, 9, 55, "Fixed len + odd-numbered numeric", + /* 5*/ { BARCODE_UPCE_CC, 1, "1234567", "[20]12[91]123", 0, 9, 55, "Fixed len + odd-numbered numeric", "1101100110111111010001100101001111010001000011110101001" "1101101110100011001110011001100001101000100011100101001" "1101101100101110010001111101111000010001010011101101001" @@ -747,7 +1642,7 @@ static void test_encodation_0(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /* 6*/ { BARCODE_UPCE_CC, "1234567", "[91]A1234567C", 1, 0, 0, 0, 9, 55, "Alphanumeric followed by 7 digits and alphanumeric", + /* 6*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]A1234567C", 0, 9, 55, "Alphanumeric followed by 7 digits and alphanumeric", "1101100110111011101011110001011100010001100011110101001" "1101101110111001001011100001110010001011100011100101001" "1101101100111000001000110101001011111100111011101101001" @@ -758,7 +1653,7 @@ static void test_encodation_0(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /* 7*/ { BARCODE_UPCE_CC, "1234567", "[91]A123456C", 1, 0, 0, 0, 9, 55, "Alphanumeric followed by 6 digits and alphanumeric", + /* 7*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]A123456C", 0, 9, 55, "Alphanumeric followed by 6 digits and alphanumeric", "1101100110111011101011110001011100010001100011110101001" "1101101110111001001011100001110010001011100011100101001" "1101101100111000011001110101111110011010110011101101001" @@ -769,7 +1664,7 @@ static void test_encodation_0(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /* 8*/ { BARCODE_UPCE_CC, "1234567", "[91]A12345B", 1, 0, 0, 0, 9, 55, "Alphanumeric followed by 5 digits and alphanumeric", + /* 8*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]A12345B", 0, 9, 55, "Alphanumeric followed by 5 digits and alphanumeric", "1101100110111011101011110001011100010001100011110101001" "1101101110110011101100100001110110001000110011100101001" "1101101100101111100110111101111110100101110011101101001" @@ -780,7 +1675,7 @@ static void test_encodation_0(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /* 9*/ { BARCODE_UPCE_CC, "1234567", "[91]A1234567", 1, 0, 0, 0, 9, 55, "Alphanumeric followed by 7 digits, terminating", + /* 9*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]A1234567", 0, 9, 55, "Alphanumeric followed by 7 digits, terminating", "1101100110111011101011110001011100010001100011110101001" "1101101110111001001011100001111001000101111011100101001" "1101101100111101011001100001111100110001010011101101001" @@ -791,7 +1686,7 @@ static void test_encodation_0(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*10*/ { BARCODE_UPCE_CC, "1234567", "[91]A123456", 1, 0, 0, 0, 9, 55, "Alphanumeric followed by 6 digits, terminating", + /*10*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]A123456", 0, 9, 55, "Alphanumeric followed by 6 digits, terminating", "1101100110111011101011110001011100010001100011110101001" "1101101110111001001011100001110010001011100011100101001" "1101101100111100000100010101001111101000111011101101001" @@ -802,7 +1697,7 @@ static void test_encodation_0(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*11*/ { BARCODE_UPCE_CC, "1234567", "[91]A12345", 1, 0, 0, 0, 9, 55, "Alphanumeric followed by 5 digits, terminating", + /*11*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]A12345", 0, 9, 55, "Alphanumeric followed by 5 digits, terminating", "1101100110111011101011110001011100010001100011110101001" "1101101110111001001011100001111001000101111011100101001" "1101101100111000101110001101001111001011110011101101001" @@ -813,7 +1708,7 @@ static void test_encodation_0(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*12*/ { BARCODE_UPCE_CC, "1234567", "[91]A1234", 1, 0, 0, 0, 9, 55, "Alphanumeric followed by 4 digits, terminating", + /*12*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]A1234", 0, 9, 55, "Alphanumeric followed by 4 digits, terminating", "1101100110111011101011110001011100010001100011110101001" "1101101110111001001011100001110110010011000011100101001" "1101101100111100110111001101011111101011000011101101001" @@ -824,7 +1719,7 @@ static void test_encodation_0(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*13*/ { BARCODE_UPCE_CC, "1234567", "[91]A123", 1, 0, 0, 0, 9, 55, "Alphanumeric followed by 3 digits, terminating", + /*13*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]A123", 0, 9, 55, "Alphanumeric followed by 3 digits, terminating", "1101100110111011101011110001011100010001100011110101001" "1101101110110011101100100001001000111001110011100101001" "1101101100100101111100110001011101001111100011101101001" @@ -835,7 +1730,7 @@ static void test_encodation_0(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*14*/ { BARCODE_UPCE_CC, "1234567", "[91]A123[10]C", 1, 0, 0, 0, 9, 55, "Alphanumeric followed by 3 digits, 2-digit AI (3 numerics including FNC1) and alphanumeric", + /*14*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]A123[10]C", 0, 9, 55, "Alphanumeric followed by 3 digits, 2-digit AI (3 numerics including FNC1) and alphanumeric", "1101100110111011101011110001011100010001100011110101001" "1101101110111001001011100001100010101100000011100101001" "1101101100110100001110010001110111101111101011101101001" @@ -846,7 +1741,7 @@ static void test_encodation_0(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*15*/ { BARCODE_UPCE_CC, "1234567", "[91]A12[10]C", 1, 0, 0, 0, 9, 55, "Alphanumeric followed by 2 digits, 2-digit AI (3 numerics including FNC1) and alphanumeric", + /*15*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]A12[10]C", 0, 9, 55, "Alphanumeric followed by 2 digits, 2-digit AI (3 numerics including FNC1) and alphanumeric", "1101100110111011101011110001011100010001100011110101001" "1101101110110011101100100001000001001010000011100101001" "1101101100111110110100001001111110111101101011101101001" @@ -857,7 +1752,7 @@ static void test_encodation_0(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*16*/ { BARCODE_UPCE_CC, "1234567", "[91]A12[10]1", 1, 0, 0, 0, 9, 55, "Alphanumeric followed by 2 digits, 2-digit AI (3 numerics including FNC1) and 1 digit, terminating", + /*16*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]A12[10]1", 0, 9, 55, "Alphanumeric followed by 2 digits, 2-digit AI (3 numerics including FNC1) and 1 digit, terminating", "1101100110111011101011110001011100010001100011110101001" "1101101110111100100101111001000010000110110011100101001" "1101101100100100011110010001001110010111110011101101001" @@ -868,7 +1763,7 @@ static void test_encodation_0(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*17*/ { BARCODE_UPCE_CC, "1234567", "[91]A1[10]1", 1, 0, 0, 0, 9, 55, "Alphanumeric followed by 1 digit, 2-digit AI (3 numerics including FNC1) and 1 digit, terminating; **NOT SAME** as tec-it.com, which does not switch to numeric mode after 'A'; same as bwipp", + /*17*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]A1[10]1", 0, 9, 55, "Alphanumeric followed by 1 digit, 2-digit AI (3 numerics including FNC1) and 1 digit, terminating; **NOT SAME** as tec-it.com, which does not switch to numeric mode after 'A'; same as BWIPP", "1101100110111011101011110001011100010001100011110101001" "1101101110110010011001110001110010010011100011100101001" "1101101100111110110001001001010111111000111011101101001" @@ -879,7 +1774,7 @@ static void test_encodation_0(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*18*/ { BARCODE_UPCE_CC, "1234567", "[91]A[10]1", 1, 0, 0, 0, 9, 55, "Alphanumeric followed by 2-digit AI (3 numerics including FNC1) and 1 digit, terminating", + /*18*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]A[10]1", 0, 9, 55, "Alphanumeric followed by 2-digit AI (3 numerics including FNC1) and 1 digit, terminating", "1101100110111011101011110001101110001000111011110101001" "1101101110111001100010110001100010000010110011100101001" "1101101100101111110010011001001101111110110011101101001" @@ -890,7 +1785,7 @@ static void test_encodation_0(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*19*/ { BARCODE_UPCE_CC, "1234567", "[91]a1234ABCDEFGb", 1, 0, 0, 0, 12, 55, "ISO-646 followed by 11 non-ISO-646 non-terminating, starting 4 digits", + /*19*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]a1234ABCDEFGb", 0, 12, 55, "ISO-646 followed by 11 non-ISO-646 non-terminating, starting 4 digits", "1110111010101100111111011001011111000100111011011011101" "1110011010101100001100111101011101000001100011011011001" "1111011010100100001001000001001110011110110011011010001" @@ -904,7 +1799,7 @@ static void test_encodation_0(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*20*/ { BARCODE_UPCE_CC, "1234567", "[91]a1234ABCDEFb", 1, 0, 0, 0, 12, 55, "ISO-646 followed by 10 non-ISO-646 non-terminating, starting 4 digits", + /*20*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]a1234ABCDEFb", 0, 12, 55, "ISO-646 followed by 10 non-ISO-646 non-terminating, starting 4 digits", "1110111010101100111111011001011111000100111011011011101" "1110011010101100001100111101011101000001100011011011001" "1111011010100100001001000001001110011110110011011010001" @@ -918,7 +1813,7 @@ static void test_encodation_0(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*21*/ { BARCODE_UPCE_CC, "1234567", "[91]a1234ABCDEF", 1, 0, 0, 0, 11, 55, "ISO-646 followed by 10 non-ISO-646 terminating, starting 4 digits", + /*21*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]a1234ABCDEF", 0, 11, 55, "ISO-646 followed by 10 non-ISO-646 terminating, starting 4 digits", "1110110110101100111111011001011111000100111011100010101" "1110010110101100001100111101011101000001100011000010101" "1100010110100100001001000001001110011110110011000110101" @@ -931,7 +1826,7 @@ static void test_encodation_0(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*22*/ { BARCODE_UPCE_CC, "1234567", "[91]a1234ABCDEb", 1, 0, 0, 0, 11, 55, "ISO-646 followed by 9 non-ISO-646 non-terminating, starting 4 digits", + /*22*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]a1234ABCDEb", 0, 11, 55, "ISO-646 followed by 9 non-ISO-646 non-terminating, starting 4 digits", "1110110110101100111111011001011111000100111011100010101" "1110010110101100000010011101110111100010111011000010101" "1100010110110010011100111101011000111100111011000110101" @@ -944,7 +1839,7 @@ static void test_encodation_0(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*23*/ { BARCODE_UPCE_CC, "1234567", "[91]a1234ABCDE", 1, 0, 0, 0, 10, 55, "ISO-646 followed by 9 non-ISO-646 terminating, starting 4 digits", + /*23*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]a1234ABCDE", 0, 10, 55, "ISO-646 followed by 9 non-ISO-646 terminating, starting 4 digits", "1100100010111001101001100001111001111010100011100101101" "1110100010111110010010001101110110011100100011000101101" "1110110010100010100011110001001111000011011011000101001" @@ -956,7 +1851,7 @@ static void test_encodation_0(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*24*/ { BARCODE_UPCE_CC, "1234567", "[91]a123ABCDEFGb", 1, 0, 0, 0, 12, 55, "ISO-646 followed by 10 non-ISO-646 non-terminating, starting 3 digits (5 alphanumerics rule applies)", + /*24*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]a123ABCDEFGb", 0, 12, 55, "ISO-646 followed by 10 non-ISO-646 non-terminating, starting 3 digits (5 alphanumerics rule applies)", "1110111010101100111111011001011111000100111011011011101" "1110011010100100000010111101101111001100111011011011001" "1111011010111101100100011101001011110111100011011010001" @@ -970,7 +1865,7 @@ static void test_encodation_0(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*25*/ { BARCODE_UPCE_CC, "1234567", "[91]aABCDEF12345b", 1, 0, 0, 0, 12, 55, "ISO-646 followed by 11 non-ISO-646 non-terminating, starting 6 letters", + /*25*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]aABCDEF12345b", 0, 12, 55, "ISO-646 followed by 11 non-ISO-646 non-terminating, starting 6 letters", "1110111010101100111111011001011111000100111011011011101" "1110011010101100000110111101111010011111011011011011001" "1111011010100001001100001101010010000010000011011010001" @@ -984,7 +1879,7 @@ static void test_encodation_0(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*26*/ { BARCODE_UPCE_CC, "1234567", "[91]aABCDEF1234b", 1, 0, 0, 0, 12, 55, "ISO-646 followed by 10 non-ISO-646 non-terminating, starting 6 letters", + /*26*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]aABCDEF1234b", 0, 12, 55, "ISO-646 followed by 10 non-ISO-646 non-terminating, starting 6 letters", "1110111010101100111111011001011111000100111011011011101" "1110011010101100000110111101111010011111011011011011001" "1111011010100001001100001101010010000010000011011010001" @@ -998,7 +1893,7 @@ static void test_encodation_0(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*27*/ { BARCODE_UPCE_CC, "1234567", "[91]aABCDE12345b", 1, 0, 0, 0, 12, 55, "ISO-646 followed by 10 non-ISO-646 non-terminating, starting 5 letters", + /*27*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]aABCDE12345b", 0, 12, 55, "ISO-646 followed by 10 non-ISO-646 non-terminating, starting 5 letters", "1110111010101100111111011001011111000100111011011011101" "1110011010101100000110111101111010011111011011011011001" "1111011010100001001100001101010010000010000011011010001" @@ -1012,7 +1907,7 @@ static void test_encodation_0(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*28*/ { BARCODE_UPCE_CC, "1234567", "[91]aABCDE12345", 1, 0, 0, 0, 11, 55, "ISO-646 followed by 10 non-ISO-646 terminating, starting 5 letters", + /*28*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]aABCDE12345", 0, 11, 55, "ISO-646 followed by 10 non-ISO-646 terminating, starting 5 letters", "1110110110101100111111011001011111000100111011100010101" "1110010110101100000110111101111010011111011011000010101" "1100010110100001001100001101010010000010000011000110101" @@ -1025,7 +1920,7 @@ static void test_encodation_0(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*29*/ { BARCODE_UPCE_CC, "1234567", "[91]aABCD012345b", 1, 0, 0, 0, 12, 55, "ISO-646 followed by 10 non-ISO-646 non-terminating, starting 4 letters + numeric", + /*29*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]aABCD012345b", 0, 12, 55, "ISO-646 followed by 10 non-ISO-646 non-terminating, starting 4 letters + numeric", "1110111010101100111111011001011111000100111011011011101" "1110011010101100000110111101111010011111011011011011001" "1111011010100001001100001101110101000111000011011010001" @@ -1039,7 +1934,7 @@ static void test_encodation_0(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*30*/ { BARCODE_UPCE_CC, "1234567", "[91]aABCD012345", 1, 0, 0, 0, 10, 55, "ISO-646 followed by 10 non-ISO-646 terminating, starting 4 letters + numeric", + /*30*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]aABCD012345", 0, 10, 55, "ISO-646 followed by 10 non-ISO-646 terminating, starting 4 letters + numeric", "1100100010111001101001100001111001111010100011100101101" "1110100010111001001101000001111010011011000011000101101" "1110110010100001100100011101110101000111111011000101001" @@ -1051,7 +1946,7 @@ static void test_encodation_0(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*31*/ { BARCODE_UPCE_CC, "1234567", "[91]aABCDE1234b", 1, 0, 0, 0, 11, 55, "ISO-646 followed by 9 non-ISO-646 non-terminating, starting 5 letters", + /*31*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]aABCDE1234b", 0, 11, 55, "ISO-646 followed by 9 non-ISO-646 non-terminating, starting 5 letters", "1110110110101100111111011001011111000100111011100010101" "1110010110100010110001111101011000001101111011000010101" "1100010110111101101100111101000110000110100011000110101" @@ -1064,7 +1959,7 @@ static void test_encodation_0(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*32*/ { BARCODE_UPCE_CC, "1234567", "[91]aABCDE1234", 1, 0, 0, 0, 10, 55, "ISO-646 followed by 9 non-ISO-646 terminating, starting 5 letters", + /*32*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]aABCDE1234", 0, 10, 55, "ISO-646 followed by 9 non-ISO-646 terminating, starting 5 letters", "1100100010111001101001100001111001111010100011100101101" "1110100010111001001101000001111010011011000011000101101" "1110110010100001100100011101110101111110011011000101001" @@ -1076,7 +1971,7 @@ static void test_encodation_0(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*33*/ { BARCODE_UPCE_CC, "1234567", "[91]aABCDE123", 1, 0, 0, 0, 10, 55, "ISO-646 followed by 8 non-ISO-646 terminating, starting 5 letters", + /*33*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]aABCDE123", 0, 10, 55, "ISO-646 followed by 8 non-ISO-646 terminating, starting 5 letters", "1100100010111001101001100001111001111010100011100101101" "1110100010111001001101000001111010011011000011000101101" "1110110010100001100100011101110101111110011011000101001" @@ -1091,6 +1986,9 @@ static void test_encodation_0(int index, int generate, int debug) { }; int data_size = sizeof(data) / sizeof(struct item); + char bwipp_buf[8192]; + char bwipp_msg[1024]; + for (int i = 0; i < data_size; i++) { if (index != -1 && i != index) continue; @@ -1100,8 +1998,6 @@ static void test_encodation_0(int index, int generate, int debug) { symbol->symbology = data[i].symbology; symbol->option_1 = data[i].option_1; - symbol->option_2 = data[i].option_2; - symbol->option_3 = data[i].option_3; symbol->debug |= debug; int length = strlen(data[i].data); @@ -1110,11 +2006,11 @@ static void test_encodation_0(int index, int generate, int debug) { int composite_length = strlen(data[i].composite); - ret = ZBarcode_Encode(symbol, data[i].composite, composite_length); - assert_equal(ret, data[i].ret, "i:%d ret %d != %d %s\n", i, ret, data[i].ret, symbol->errtxt); + ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].composite, composite_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) { - test_helper_generate(symbol, ret, i, data[i].data, data[i].composite, data[i].option_1, data[i].option_2, data[i].option_3, data[i].comment); + test_helper_generate(symbol, ret, i, data[i].data, data[i].composite, data[i].option_1, data[i].comment, -1 /*bwipp_cmp*/); } else { assert_equal(symbol->rows, data[i].expected_rows, "i:%d %s symbol->rows %d != %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), symbol->rows, data[i].expected_rows, data[i].data); assert_equal(symbol->width, data[i].expected_width, "i:%d %s symbol->width %d != %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), symbol->width, data[i].expected_width, data[i].data); @@ -1123,6 +2019,15 @@ static void test_encodation_0(int index, int generate, int debug) { int width, row; ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row); assert_zero(ret, "i:%d %s testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, width, row, data[i].data); + + if (do_bwipp && testUtilCanBwipp(symbol->symbology, data[i].option_1, -1, -1, debug)) { + ret = testUtilBwipp(symbol, data[i].option_1, -1, -1, data[i].composite, composite_length, symbol->primary, bwipp_buf, sizeof(bwipp_buf)); + assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), ret); + + ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected); + assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", + i, testUtilBarcodeName(data[i].symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); + } } } @@ -1136,24 +2041,24 @@ static void test_encodation_10(int index, int generate, int debug) { testStart(""); + int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise + int ret; struct item { int symbology; - unsigned char *data; - unsigned char *composite; int option_1; - int option_2; - int option_3; + char *data; + char *composite; int ret; int expected_rows; int expected_width; char *comment; - unsigned char *expected; + char *expected; }; - // Verified manually against bwipp (and with noted exceptions, tec-it.com) + // Verified via bwipp_dump.ps against BWIPP, and manually, with noted exceptions, against tec-it.com struct item data[] = { - /* 0*/ { BARCODE_UPCE_CC, "1234567", "[11]201001[10]AB1234", 1, 0, 0, 0, 9, 55, "Mode '10' date + even-numbered numeric lot, 1st fit, alphanumeric latch and padding", + /* 0*/ { BARCODE_UPCE_CC, 1, "1234567", "[11]201001[10]AB1234", 0, 9, 55, "Mode '10' date + even-numbered numeric lot, 1st fit, alphanumeric latch and padding", "1101100110101110000100011001001000100111100011110101001" "1101101110110010100011000001100110010000001011100101001" "1101101100111011011101000001110100111000110011101101001" @@ -1164,7 +2069,7 @@ static void test_encodation_10(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /* 1*/ { BARCODE_UPCE_CC, "1234567", "[11]201001[10]AB12345", 1, 0, 0, 0, 9, 55, "Mode '10' date + odd-numbered numeric lot, 1st fit, 7-bit final, no alphanumeric latch or padding", + /* 1*/ { BARCODE_UPCE_CC, 1, "1234567", "[11]201001[10]AB12345", 0, 9, 55, "Mode '10' date + odd-numbered numeric lot, 1st fit, 7-bit final, no alphanumeric latch or padding", "1101100110101110000100011001001000100111100011110101001" "1101101110110010100011000001100110010000001011100101001" "1101101100111011011101000001111010000110110011101101001" @@ -1175,7 +2080,7 @@ static void test_encodation_10(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /* 2*/ { BARCODE_UPCE_CC, "1234567", "[11]201001", 1, 0, 0, 0, 9, 55, "Mode '10' date, no lot or other data", + /* 2*/ { BARCODE_UPCE_CC, 1, "1234567", "[11]201001", 0, 9, 55, "Mode '10' date, no lot or other data", "1101100110101110000100011001001000100111100011110101001" "1101101110110010100110000001010000010010000011100101001" "1101101100111011000001110101000001011111011011101101001" @@ -1186,7 +2091,7 @@ static void test_encodation_10(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /* 3*/ { BARCODE_UPCE_CC, "1234567", "[11]201001[20]12", 1, 0, 0, 0, 9, 55, "Mode '10' date, no lot, other data", + /* 3*/ { BARCODE_UPCE_CC, 1, "1234567", "[11]201001[20]12", 0, 9, 55, "Mode '10' date, no lot, other data", "1101100110101110000100011001100100010011111011110101001" "1101101110101110111010000001000101100001100011100101001" "1101101100111010011000100001111110101001110011101101001" @@ -1197,7 +2102,7 @@ static void test_encodation_10(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /* 4*/ { BARCODE_UPCE_CC, "1234567", "[10]1234", 1, 0, 0, 0, 9, 55, "Mode '10' no date, numeric lot, no other data; **NOT SAME** as tec-it.com; same as bwipp", + /* 4*/ { BARCODE_UPCE_CC, 1, "1234567", "[10]1234", 0, 9, 55, "Mode '10' no date, numeric lot, no other data; **NOT SAME** as tec-it.com; same as BWIPP", "1101100110100111000110011101110011100101111011110101001" "1101101110110100100110000001111011100101100011100101001" "1101101100100111101011110001111110011010110011101101001" @@ -1208,7 +2113,7 @@ static void test_encodation_10(int index, int generate, int debug) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /* 5*/ { BARCODE_UPCE_CC, "1234567", "[10]ABCD", 1, 0, 0, 0, 9, 55, "Mode '10' no date, alphanumeric lot, no other data; **NOT SAME** as tec-it.com; same as bwipp", + /* 5*/ { BARCODE_UPCE_CC, 1, "1234567", "[10]ABCD", 0, 9, 55, "Mode '10' no date, alphanumeric lot, no other data; **NOT SAME** as tec-it.com; same as BWIPP", "1101100110101111001100011001111000010111101011110101001" "1101101110100010111100111101100110010010000011100101001" "1101101100100111101001111001000010111110110011101101001" @@ -1222,6 +2127,9 @@ static void test_encodation_10(int index, int generate, int debug) { }; int data_size = sizeof(data) / sizeof(struct item); + char bwipp_buf[8192]; + char bwipp_msg[1024]; + for (int i = 0; i < data_size; i++) { if (index != -1 && i != index) continue; @@ -1231,8 +2139,6 @@ static void test_encodation_10(int index, int generate, int debug) { symbol->symbology = data[i].symbology; symbol->option_1 = data[i].option_1; - symbol->option_2 = data[i].option_2; - symbol->option_3 = data[i].option_3; symbol->debug |= debug; int length = strlen(data[i].data); @@ -1241,11 +2147,11 @@ static void test_encodation_10(int index, int generate, int debug) { int composite_length = strlen(data[i].composite); - ret = ZBarcode_Encode(symbol, data[i].composite, composite_length); - assert_equal(ret, data[i].ret, "i:%d ret %d != %d %s\n", i, ret, data[i].ret, symbol->errtxt); + ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].composite, composite_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) { - test_helper_generate(symbol, ret, i, data[i].data, data[i].composite, data[i].option_1, data[i].option_2, data[i].option_3, data[i].comment); + test_helper_generate(symbol, ret, i, data[i].data, data[i].composite, data[i].option_1, data[i].comment, -1 /*bwipp_cmp*/); } else { assert_equal(symbol->rows, data[i].expected_rows, "i:%d %s symbol->rows %d != %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), symbol->rows, data[i].expected_rows, data[i].data); assert_equal(symbol->width, data[i].expected_width, "i:%d %s symbol->width %d != %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), symbol->width, data[i].expected_width, data[i].data); @@ -1254,6 +2160,15 @@ static void test_encodation_10(int index, int generate, int debug) { int width, row; ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row); assert_zero(ret, "i:%d %s testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, width, row, data[i].data); + + if (do_bwipp && testUtilCanBwipp(symbol->symbology, data[i].option_1, -1, -1, debug)) { + ret = testUtilBwipp(symbol, data[i].option_1, -1, -1, data[i].composite, composite_length, symbol->primary, bwipp_buf, sizeof(bwipp_buf)); + assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), ret); + + ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected); + assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", + i, testUtilBarcodeName(data[i].symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); + } } } @@ -1267,24 +2182,24 @@ static void test_encodation_11(int index, int generate, int debug) { testStart(""); + int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise + int ret; struct item { int symbology; - unsigned char *data; - unsigned char *composite; int option_1; - int option_2; - int option_3; + char *data; + char *composite; int ret; int expected_rows; int expected_width; char *comment; - unsigned char *expected; + char *expected; }; - // Verified manually against tec-it.com (with noted exception) (bwipp 2019-10-13 has some issues with encodation 11 so not used) + // Verified via bwipp_dump.ps against BWIPP, and manually against tec-it.com (with noted exception) struct item data[] = { - /* 0*/ { BARCODE_UPCE_CC, "1234567", "[90]A", 1, 0, 0, 0, 9, 55, "Mode '11', letter prefix only", + /* 0*/ { BARCODE_UPCE_CC, 1, "1234567", "[90]A", 0, 9, 55, "Mode '11', letter prefix only", "1101100110100111100000101001110110010011111011110101001" "1101101110110001000101100001100011010010000011100101001" "1101101100110001000011100101001110010011111011101101001" @@ -1295,7 +2210,7 @@ static void test_encodation_11(int index, int generate, int debug) "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /* 1*/ { BARCODE_UPCE_CC, "1234567", "[90]1A", 1, 0, 0, 0, 9, 55, "Mode '11', 1 digit letter prefix only", + /* 1*/ { BARCODE_UPCE_CC, 1, "1234567", "[90]1A", 0, 9, 55, "Mode '11', 1 digit letter prefix only", "1101100110100111100000101001011001000111000011110101001" "1101101110101101111011100001011100111010000011100101001" "1101101100111000010011010001101011100001000011101101001" @@ -1306,7 +2221,7 @@ static void test_encodation_11(int index, int generate, int debug) "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /* 2*/ { BARCODE_UPCE_CC, "1234567", "[90]12A", 1, 0, 0, 0, 9, 55, "Mode '11', 2 digit letter prefix only", + /* 2*/ { BARCODE_UPCE_CC, 1, "1234567", "[90]12A", 0, 9, 55, "Mode '11', 2 digit letter prefix only", "1101100110100111100000101001011001101111000011110101001" "1101101110110001010000110001110111010000010011100101001" "1101101100111110011010000101111100100110111011101101001" @@ -1317,7 +2232,7 @@ static void test_encodation_11(int index, int generate, int debug) "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /* 3*/ { BARCODE_UPCE_CC, "1234567", "[90]123A", 1, 0, 0, 0, 9, 55, "Mode '11', 3 digit letter prefix only", + /* 3*/ { BARCODE_UPCE_CC, 1, "1234567", "[90]123A", 0, 9, 55, "Mode '11', 3 digit letter prefix only", "1101100110100111100000101001100110101111000011110101001" "1101101110100001001010000001101110110100000011100101001" "1101101100111110110000101001100101111100111011101101001" @@ -1328,7 +2243,7 @@ static void test_encodation_11(int index, int generate, int debug) "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /* 4*/ { BARCODE_UPCE_CC, "1234567", "[90]A1234", 1, 0, 0, 0, 9, 55, "Mode '11', even-numbered numeric [90]", + /* 4*/ { BARCODE_UPCE_CC, 1, "1234567", "[90]A1234", 0, 9, 55, "Mode '11', even-numbered numeric [90]", "1101100110100111100000101001110110010011111011110101001" "1101101110110001000100110001101000100110000011100101001" "1101101100111100010111011101100011011110100011101101001" @@ -1339,7 +2254,7 @@ static void test_encodation_11(int index, int generate, int debug) "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /* 5*/ { BARCODE_UPCE_CC, "1234567", "[90]A12345", 1, 0, 0, 0, 9, 55, "Mode '11', odd-numbered numeric [90]", + /* 5*/ { BARCODE_UPCE_CC, 1, "1234567", "[90]A12345", 0, 9, 55, "Mode '11', odd-numbered numeric [90]", "1101100110100111100000101001110110010011111011110101001" "1101101110110001000100110001110100010011100011100101001" "1101101100101000011110010001110100011010000011101101001" @@ -1350,7 +2265,7 @@ static void test_encodation_11(int index, int generate, int debug) "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /* 6*/ { BARCODE_UPCE_CC, "1234567", "[90]1ABC4", 1, 0, 0, 0, 9, 55, "Mode '11', alpha [90]", + /* 6*/ { BARCODE_UPCE_CC, 1, "1234567", "[90]1ABC4", 0, 9, 55, "Mode '11', alpha [90]", "1101100110100111110110010001001110011000111011110101001" "1101101110110110011000011001010011000011000011100101001" "1101101100101000111100000101110000100110010011101101001" @@ -1361,7 +2276,7 @@ static void test_encodation_11(int index, int generate, int debug) "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /* 7*/ { BARCODE_UPCE_CC, "1234567", "[90]1AB34", 1, 0, 0, 0, 9, 55, "Mode '11', alphanumeric [90] (letters <= numbers)", + /* 7*/ { BARCODE_UPCE_CC, 1, "1234567", "[90]1AB34", 0, 9, 55, "Mode '11', alphanumeric [90] (letters <= numbers)", "1101100110100011100110111001011111101110010011110101001" "1101101110110000110100010001100101100011100011100101001" "1101101100110010000011100101101100011110001011101101001" @@ -1372,7 +2287,7 @@ static void test_encodation_11(int index, int generate, int debug) "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /* 8*/ { BARCODE_UPCE_CC, "1234567", "[90]1AB.D", 1, 0, 0, 0, 9, 55, "Mode '11', alphanumeric [90]", + /* 8*/ { BARCODE_UPCE_CC, 1, "1234567", "[90]1AB.D", 0, 9, 55, "Mode '11', alphanumeric [90]", "1101100110100011100110111001011111101110010011110101001" "1101101110110000110100010001000010100000100011100101001" "1101101100101110100001111101110111000111101011101101001" @@ -1383,7 +2298,7 @@ static void test_encodation_11(int index, int generate, int debug) "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /* 9*/ { BARCODE_UPCE_CC, "1234567", "[90]1AB+D", 1, 0, 0, 0, 9, 55, "Mode '11', ISO-646 [90]", + /* 9*/ { BARCODE_UPCE_CC, 1, "1234567", "[90]1AB+D", 0, 9, 55, "Mode '11', ISO-646 [90]", "1101100110100011100110111001011111101110010011110101001" "1101101110110000110100010001101000111001111011100101001" "1101101100111110110100001001100101111101110011101101001" @@ -1394,7 +2309,7 @@ static void test_encodation_11(int index, int generate, int debug) "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*10*/ { BARCODE_UPCE_CC, "1234567", "[90]1A+BD", 1, 0, 0, 0, 9, 55, "Mode '11', immediate ISO-646 [90]", + /*10*/ { BARCODE_UPCE_CC, 1, "1234567", "[90]1A+BD", 0, 9, 55, "Mode '11', immediate ISO-646 [90]", "1101100110100011100110111001011111101110010011110101001" "1101101110101111000111100101111011101011000011100101001" "1101101100101000011110010001001111001011110011101101001" @@ -1405,8 +2320,8 @@ static void test_encodation_11(int index, int generate, int debug) "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*11*/ { BARCODE_UPCE_CC, "1234567", "[90]1AB#D", 1, 0, 0, ZINT_ERROR_INVALID_DATA, 0, 0, "Mode '11', invalid char [90]", "" }, - /*12*/ { BARCODE_UPCE_CC, "1234567", "[90]A12345[21]AB", 1, 0, 0, 0, 10, 55, "Mode '11', numeric [90], with [21]", + /*11*/ { BARCODE_UPCE_CC, 1, "1234567", "[90]1AB#D", ZINT_ERROR_INVALID_DATA, 0, 0, "Mode '11', invalid char [90]", "" }, + /*12*/ { BARCODE_UPCE_CC, 1, "1234567", "[90]A12345[21]AB", 0, 10, 55, "Mode '11', numeric [90], with [21]", "1100100010111000111011011001001100011000010011100101101" "1110100010101000001111001001111100110100010011000101101" "1110110010101110010000110001100111000100111011000101001" @@ -1418,7 +2333,7 @@ static void test_encodation_11(int index, int generate, int debug) "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*13*/ { BARCODE_UPCE_CC, "1234567", "[90]1ABC4[21]AB12", 1, 0, 0, 0, 10, 55, "Mode '11', alpha [90], with [21]", + /*13*/ { BARCODE_UPCE_CC, 1, "1234567", "[90]1ABC4[21]AB12", 0, 10, 55, "Mode '11', alpha [90], with [21]", "1100100010100011100111101101011000111000110011100101101" "1110100010111010000110001001110100011000001011000101101" "1110110010100001100100011101110111111010100011000101001" @@ -1430,7 +2345,7 @@ static void test_encodation_11(int index, int generate, int debug) "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*14*/ { BARCODE_UPCE_CC, "1234567", "[90]1AB.D[21]AB", 1, 0, 0, 0, 10, 55, "Mode '11', alphanumeric [90], with [21]", + /*14*/ { BARCODE_UPCE_CC, 1, "1234567", "[90]1AB.D[21]AB", 0, 10, 55, "Mode '11', alphanumeric [90], with [21]", "1100100010110011100011000101110001110110011011100101101" "1110100010111101101100100001110010011100011011000101101" "1110110010110000110101111001011100110001110011000101001" @@ -1442,7 +2357,7 @@ static void test_encodation_11(int index, int generate, int debug) "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*15*/ { BARCODE_UPCE_CC, "1234567", "[90]1AB+D[21]A.", 1, 0, 0, 0, 10, 55, "Mode '11', ISO-646 [90], with [21]; **NOT SAME** as tec-it.com, which probably includes '21' in 5 alphanumeric count", + /*15*/ { BARCODE_UPCE_CC, 1, "1234567", "[90]1AB+D[21]A.", 0, 10, 55, "Mode '11', ISO-646 [90], with [21]; **NOT SAME** as tec-it.com, which probably includes '21' in 5 alphanumeric count", "1100100010110011100011000101110001110110011011100101101" "1110100010111101101100100001110101110001100011000101101" "1110110010100000111000101101110010111110001011000101001" @@ -1454,7 +2369,7 @@ static void test_encodation_11(int index, int generate, int debug) "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*16*/ { BARCODE_UPCE_CC, "1234567", "[90]1A+BD[21]A12", 1, 0, 0, 0, 11, 55, "Mode '11', immediate ISO-646 [90], with [21]; tec-it.com same, probably since have 5 alphanumerics with or without '21'", + /*16*/ { BARCODE_UPCE_CC, 1, "1234567", "[90]1A+BD[21]A12", 0, 11, 55, "Mode '11', immediate ISO-646 [90], with [21]; tec-it.com same, probably since have 5 alphanumerics with or without '21'", "1110110110111100011000110101100111101011111011100010101" "1110010110100100001101111101000100010111100011000010101" "1100010110100010100000100001110011101000001011000110101" @@ -1467,7 +2382,7 @@ static void test_encodation_11(int index, int generate, int debug) "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*17*/ { BARCODE_UPCE_CC, "1234567", "[90]A12[8004]12", 1, 0, 0, 0, 9, 55, "Mode '11', numeric [90], with [8004]", + /*17*/ { BARCODE_UPCE_CC, 1, "1234567", "[90]A12[8004]12", 0, 9, 55, "Mode '11', numeric [90], with [8004]", "1101100110110001111010011001000001101101111011110101001" "1101101110110100100000110001011100111101100011100101001" "1101101100110100000111010001100100001110001011101101001" @@ -1478,7 +2393,7 @@ static void test_encodation_11(int index, int generate, int debug) "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*18*/ { BARCODE_UPCE_CC, "1234567", "[90]AB[8004]12", 1, 0, 0, 0, 9, 55, "Mode '11', alpha [90], with [8004]", + /*18*/ { BARCODE_UPCE_CC, 1, "1234567", "[90]AB[8004]12", 0, 9, 55, "Mode '11', alpha [90], with [8004]", "1101100110100111110011001001100101111110010011110101001" "1101101110101000100000100001011000111001100011100101001" "1101101100100111110100011101111000100001001011101101001" @@ -1489,7 +2404,7 @@ static void test_encodation_11(int index, int generate, int debug) "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*19*/ { BARCODE_UPCE_CC, "1234567", "[90]A.[8004]12", 1, 0, 0, 0, 9, 55, "Mode '11', alphanumeric [90], with [8004]", + /*19*/ { BARCODE_UPCE_CC, 1, "1234567", "[90]A.[8004]12", 0, 9, 55, "Mode '11', alphanumeric [90], with [8004]", "1101100110110111110011001101111110100110001011110101001" "1101101110100010001001000001100101100011100011100101001" "1101101100100001011110001001100001100111101011101101001" @@ -1500,7 +2415,7 @@ static void test_encodation_11(int index, int generate, int debug) "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*20*/ { BARCODE_UPCE_CC, "1234567", "[90]A+[8004]12", 1, 0, 0, 0, 9, 55, "Mode '11', ISO-646 [90], with [8004]", + /*20*/ { BARCODE_UPCE_CC, 1, "1234567", "[90]A+[8004]12", 0, 9, 55, "Mode '11', ISO-646 [90], with [8004]", "1101100110110111110011001101111110100110001011110101001" "1101101110111100110010111001001110001110100011100101001" "1101101100111001011100011001101001110000010011101101001" @@ -1511,7 +2426,7 @@ static void test_encodation_11(int index, int generate, int debug) "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*21*/ { BARCODE_UPCE_CC, "1234567", "[90]12A1[10]12", 1, 0, 0, 0, 9, 55, "Mode '11', numeric [90], other data", + /*21*/ { BARCODE_UPCE_CC, 1, "1234567", "[90]12A1[10]12", 0, 9, 55, "Mode '11', numeric [90], other data", "1101100110100111100000101001011001101111000011110101001" "1101101110111000101101111001110110100001100011100101001" "1101101100111100001010001001110000100110010011101101001" @@ -1522,7 +2437,7 @@ static void test_encodation_11(int index, int generate, int debug) "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*22*/ { BARCODE_UPCE_CC, "1234567", "[90]123AB[10]12", 1, 0, 0, 0, 9, 55, "Mode '11', alpha [90], other data", + /*22*/ { BARCODE_UPCE_CC, 1, "1234567", "[90]123AB[10]12", 0, 9, 55, "Mode '11', alpha [90], other data", "1101100110100111110110010001100011101000111011110101001" "1101101110111001110100000101100110001100110011100101001" "1101101100110110011111001101111010100001000011101101001" @@ -1533,7 +2448,7 @@ static void test_encodation_11(int index, int generate, int debug) "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*23*/ { BARCODE_UPCE_CC, "1234567", "[90]123AB.D[10]12", 1, 0, 0, 0, 10, 55, "Mode '11', alphanumeric [90], other data", + /*23*/ { BARCODE_UPCE_CC, 1, "1234567", "[90]123AB.D[10]12", 0, 10, 55, "Mode '11', alphanumeric [90], other data", "1100100010100011000110000101110110000100110011100101101" "1110100010101101111100100001011111001001110011000101101" "1110110010101111100110001001101111001000110011000101001" @@ -1545,7 +2460,7 @@ static void test_encodation_11(int index, int generate, int debug) "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*24*/ { BARCODE_UPCE_CC, "1234567", "[90]123AB+D[10]12", 1, 0, 0, 0, 10, 55, "Mode '11', ISO-646 [90], other data", + /*24*/ { BARCODE_UPCE_CC, 1, "1234567", "[90]123AB+D[10]12", 0, 10, 55, "Mode '11', ISO-646 [90], other data", "1100100010100011000110000101110110000100110011100101101" "1110100010101101111100100001100100111000001011000101101" "1110110010100010110011111001000110100111000011000101001" @@ -1557,7 +2472,7 @@ static void test_encodation_11(int index, int generate, int debug) "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*25*/ { BARCODE_UPCE_CC, "1234567", "[90]A123[21]AB[91]A123", 1, 0, 0, 0, 12, 55, "Mode '11', numeric [90], with [21], other data", + /*25*/ { BARCODE_UPCE_CC, 1, "1234567", "[90]A123[21]AB[91]A123", 0, 12, 55, "Mode '11', numeric [90], with [21], other data", "1110111010100001100111110101100010011110110011011011101" "1110011010111111011011100101001110110011100011011011001" "1111011010101000111011100001001011110011110011011010001" @@ -1571,7 +2486,7 @@ static void test_encodation_11(int index, int generate, int debug) "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*26*/ { BARCODE_UPCE_CC, "1234567", "[90]AB[8004]1[10]12", 1, 0, 0, 0, 9, 55, "Mode '11', alpha [90], with [8004], other data", + /*26*/ { BARCODE_UPCE_CC, 1, "1234567", "[90]AB[8004]1[10]12", 0, 9, 55, "Mode '11', alpha [90], with [8004], other data", "1101100110100111110011001001100101111110010011110101001" "1101101110101000100000100001101100011100111011100101001" "1101101100100010011111011001100110011110001011101101001" @@ -1582,9 +2497,23 @@ static void test_encodation_11(int index, int generate, int debug) "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, + /*27*/ { BARCODE_UPCE_CC, 1, "1234567", "[90]12A1234B", 0, 9, 55, "Mode '11', alphanumeric [90], with first 4 digits (choosing NUMERIC would be better, not implemented)", + "1101100110100011100110111001001111100011001011110101001" + "1101101110100101100000110001111010110011111011100101001" + "1101101100111100000101001001111110111101101011101101001" + "1101101000100000011101011001001110100000110011101001001" + "1101001000111000110100011001100011000010001011101001101" + "0001000000000000000000000000000000000000000000000000010" + "0010000000000000000000000000000000000000000000000000001" + "0001000000000000000000000000000000000000000000000000010" + "0001010010011011110101000110111001000010100100010101010" + }, }; int data_size = sizeof(data) / sizeof(struct item); + char bwipp_buf[8192]; + char bwipp_msg[1024]; + for (int i = 0; i < data_size; i++) { if (index != -1 && i != index) continue; @@ -1594,8 +2523,6 @@ static void test_encodation_11(int index, int generate, int debug) symbol->symbology = data[i].symbology; symbol->option_1 = data[i].option_1; - symbol->option_2 = data[i].option_2; - symbol->option_3 = data[i].option_3; symbol->debug |= debug; int length = strlen(data[i].data); @@ -1604,11 +2531,11 @@ static void test_encodation_11(int index, int generate, int debug) int composite_length = strlen(data[i].composite); - ret = ZBarcode_Encode(symbol, data[i].composite, composite_length); - assert_equal(ret, data[i].ret, "i:%d ret %d != %d %s\n", i, ret, data[i].ret, symbol->errtxt); + ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].composite, composite_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) { - test_helper_generate(symbol, ret, i, data[i].data, data[i].composite, data[i].option_1, data[i].option_2, data[i].option_3, data[i].comment); + test_helper_generate(symbol, ret, i, data[i].data, data[i].composite, data[i].option_1, data[i].comment, -1 /*bwipp_cmp*/); } else { assert_equal(symbol->rows, data[i].expected_rows, "i:%d %s symbol->rows %d != %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), symbol->rows, data[i].expected_rows, data[i].data); assert_equal(symbol->width, data[i].expected_width, "i:%d %s symbol->width %d != %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), symbol->width, data[i].expected_width, data[i].data); @@ -1617,6 +2544,15 @@ static void test_encodation_11(int index, int generate, int debug) int width, row; ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row); assert_zero(ret, "i:%d %s testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, width, row, data[i].data); + + if (do_bwipp && testUtilCanBwipp(symbol->symbology, data[i].option_1, -1, -1, debug)) { + ret = testUtilBwipp(symbol, data[i].option_1, -1, -1, data[i].composite, composite_length, symbol->primary, bwipp_buf, sizeof(bwipp_buf)); + assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), ret); + + ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected); + assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", + i, testUtilBarcodeName(data[i].symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); + } } } @@ -1634,9 +2570,9 @@ static void test_fuzz(int index, int debug) int ret; struct item { int symbology; - unsigned char *data; + char *data; int length; - unsigned char *composite; + char *composite; int ret; }; // s/\/\*[ 0-9]*\*\//\=printf("\/*%2d*\/", line(".") - line("'<")) @@ -1668,8 +2604,8 @@ static void test_fuzz(int index, int debug) int composite_length = strlen(data[i].composite); - ret = ZBarcode_Encode(symbol, data[i].composite, composite_length); - assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); + ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].composite, composite_length); + assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); ZBarcode_Delete(symbol); } diff --git a/backend/tests/test_gs1.c b/backend/tests/test_gs1.c index 82d794a8..7b95e953 100644 --- a/backend/tests/test_gs1.c +++ b/backend/tests/test_gs1.c @@ -38,6 +38,8 @@ static void test_gs1_reduce(int index, int generate, int debug) { testStart(""); + int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise + int ret; struct item { int symbology; @@ -51,7 +53,7 @@ static void test_gs1_reduce(int index, int generate, int debug) { }; struct item data[] = { /* 0*/ { BARCODE_EAN128, -1, "12345678901234", "", ZINT_ERROR_INVALID_DATA, "GS1 data required", "" }, - /* 1*/ { BARCODE_EAN128, -1, "[01]12345678901234", "", 0, "Input mode ignored; verified manually against bwipp and tec-it", + /* 1*/ { BARCODE_EAN128, -1, "[01]12345678901234", "", 0, "Input mode ignored; verified manually against tec-it", "11010011100111101011101100110110010110011100100010110001110001011011000010100110111101101011001110010001011000111010111101100011101011" }, /* 2*/ { BARCODE_EAN128, GS1_MODE, "[01]12345678901234", "", 0, "Input mode ignored", @@ -81,7 +83,7 @@ static void test_gs1_reduce(int index, int generate, int debug) { "0010110001100001010001001100100110100110001101110100111000111010010011110101100100001001010011000110111010011100010100001011010000110011100010100" "1101001110011110101110110011011001011001110010001011000111000101101100001010011011110110101100111001000101100011101011110100101111001100011101011" }, - /* 7*/ { BARCODE_EAN14, -1, "1234567890123", "", 0, "Input mode ignored; verified manually against bwipp and tec-it", + /* 7*/ { BARCODE_EAN14, -1, "1234567890123", "", 0, "Input mode ignored; verified manually against tec-it", "11010011100111101011101100110110010110011100100010110001110001011011000010100110111101101011001110011011000110100001100101100011101011" }, /* 8*/ { BARCODE_EAN14, GS1_MODE, "1234567890123", "", 0, "Input mode ignored", @@ -90,7 +92,7 @@ static void test_gs1_reduce(int index, int generate, int debug) { /* 9*/ { BARCODE_EAN14, UNICODE_MODE, "1234567890123", "", 0, "Input mode ignored", "11010011100111101011101100110110010110011100100010110001110001011011000010100110111101101011001110011011000110100001100101100011101011" }, - /*10*/ { BARCODE_NVE18, -1, "12345678901234567", "", 0, "Input mode ignored; verified manually against bwipp (sscc18) and tec-it", + /*10*/ { BARCODE_NVE18, -1, "12345678901234567", "", 0, "Input mode ignored; verified manually against tec-it", "110100111001111010111011011001100101100111001000101100011100010110110000101001101111011010110011100100010110001110001011011000010010101101110001100011101011" }, /*11*/ { BARCODE_NVE18, GS1_MODE, "12345678901234567", "", 0, "Input mode ignored", @@ -109,25 +111,25 @@ static void test_gs1_reduce(int index, int generate, int debug) { /*16*/ { BARCODE_RSS_EXP, UNICODE_MODE, "[20]12", "", 0, "Input mode ignored", "010010000010000101101111111100001010000010000110010101111100101110001011110000000010101111100001011101" }, - /*17*/ { BARCODE_RSS_EXP_CC, -1, "[20]12", "[21]1234", 0, "Input mode ignored", + /*17*/ { BARCODE_RSS_EXP_CC, -1, "[20]12", "[21]1234", 0, "Input mode ignored; verified manually against tec-it", "001101101110110100001000001101001100111011000010011101001100001010001100010010011011000000110110001010" "001101101100111110100010011001101011100100000010011001001001111001011110011101011001000000110010001010" "001101101000101111100110000101001111010000001010011001101011101110011110010011110110000110111010001010" - "000001111111010110010000000010100100111001100001011010000011010001100100001010101001010000011110100000" + "000001111111010110010000000010100100111001100001011010000011010001110100001010101001010000011110100000" "010010000000101001101111111100001011000110011110100101111100101110001011110000000010101111100001011101" }, /*18*/ { BARCODE_RSS_EXP_CC, GS1_MODE, "[20]12", "[21]1234", 0, "Input mode ignored", "001101101110110100001000001101001100111011000010011101001100001010001100010010011011000000110110001010" "001101101100111110100010011001101011100100000010011001001001111001011110011101011001000000110010001010" "001101101000101111100110000101001111010000001010011001101011101110011110010011110110000110111010001010" - "000001111111010110010000000010100100111001100001011010000011010001100100001010101001010000011110100000" + "000001111111010110010000000010100100111001100001011010000011010001110100001010101001010000011110100000" "010010000000101001101111111100001011000110011110100101111100101110001011110000000010101111100001011101" }, /*19*/ { BARCODE_RSS_EXP_CC, UNICODE_MODE, "[20]12", "[21]1234", 0, "Input mode ignored", "001101101110110100001000001101001100111011000010011101001100001010001100010010011011000000110110001010" "001101101100111110100010011001101011100100000010011001001001111001011110011101011001000000110010001010" "001101101000101111100110000101001111010000001010011001101011101110011110010011110110000110111010001010" - "000001111111010110010000000010100100111001100001011010000011010001100100001010101001010000011110100000" + "000001111111010110010000000010100100111001100001011010000011010001110100001010101001010000011110100000" "010010000000101001101111111100001011000110011110100101111100101110001011110000000010101111100001011101" }, /*20*/ { BARCODE_RSS_EXPSTACK, -1, "12", "", ZINT_ERROR_INVALID_DATA, "GS1 data required", "" }, @@ -141,25 +143,25 @@ static void test_gs1_reduce(int index, int generate, int debug) { "010010000010000101101111111100001010000010000110010101111100101110001011110000000010101111100001011101" }, /*24*/ { BARCODE_RSS_EXPSTACK_CC, -1, "12", "[21]1234", ZINT_ERROR_INVALID_DATA, "GS1 data required", "" }, - /*25*/ { BARCODE_RSS_EXPSTACK_CC, -1, "[20]12", "[21]1234", 0, "Input mode ignored", + /*25*/ { BARCODE_RSS_EXPSTACK_CC, -1, "[20]12", "[21]1234", 0, "Input mode ignored; verified manually against tec-it (same as BARCODE_RSS_EXP_CC above)", "001101101110110100001000001101001100111011000010011101001100001010001100010010011011000000110110001010" "001101101100111110100010011001101011100100000010011001001001111001011110011101011001000000110010001010" "001101101000101111100110000101001111010000001010011001101011101110011110010011110110000110111010001010" - "000001111111010110010000000010100100111001100001011010000011010001100100001010101001010000011110100000" + "000001111111010110010000000010100100111001100001011010000011010001110100001010101001010000011110100000" "010010000000101001101111111100001011000110011110100101111100101110001011110000000010101111100001011101" }, /*26*/ { BARCODE_RSS_EXPSTACK_CC, GS1_MODE, "[20]12", "[21]1234", 0, "Input mode ignored", "001101101110110100001000001101001100111011000010011101001100001010001100010010011011000000110110001010" "001101101100111110100010011001101011100100000010011001001001111001011110011101011001000000110010001010" "001101101000101111100110000101001111010000001010011001101011101110011110010011110110000110111010001010" - "000001111111010110010000000010100100111001100001011010000011010001100100001010101001010000011110100000" + "000001111111010110010000000010100100111001100001011010000011010001110100001010101001010000011110100000" "010010000000101001101111111100001011000110011110100101111100101110001011110000000010101111100001011101" }, /*27*/ { BARCODE_RSS_EXPSTACK_CC, UNICODE_MODE, "[20]12", "[21]1234", 0, "Input mode ignored", "001101101110110100001000001101001100111011000010011101001100001010001100010010011011000000110110001010" "001101101100111110100010011001101011100100000010011001001001111001011110011101011001000000110010001010" "001101101000101111100110000101001111010000001010011001101011101110011110010011110110000110111010001010" - "000001111111010110010000000010100100111001100001011010000011010001100100001010101001010000011110100000" + "000001111111010110010000000010100100111001100001011010000011010001110100001010101001010000011110100000" "010010000000101001101111111100001011000110011110100101111100101110001011110000000010101111100001011101" }, }; @@ -167,6 +169,9 @@ static void test_gs1_reduce(int index, int generate, int debug) { char *text; + char bwipp_buf[8196]; + char bwipp_msg[1024]; + for (int i = 0; i < data_size; i++) { if (index != -1 && i != index) continue; @@ -207,6 +212,15 @@ static void test_gs1_reduce(int index, int generate, int debug) { int width, row; ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row); assert_zero(ret, "i:%d %s testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, width, row, data[i].data); + + if (do_bwipp && testUtilCanBwipp(symbol->symbology, -1, -1, -1, debug)) { + ret = testUtilBwipp(symbol, -1, -1, -1, text, length, symbol->primary, bwipp_buf, sizeof(bwipp_buf)); + assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), ret); + + ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected); + assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", + i, testUtilBarcodeName(data[i].symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); + } } } diff --git a/backend/tests/test_rss.c b/backend/tests/test_rss.c index 6e864ca5..9074bc57 100644 --- a/backend/tests/test_rss.c +++ b/backend/tests/test_rss.c @@ -35,96 +35,99 @@ static void test_binary_div_modulo_divisor(int index, int generate, int debug) { testStart(""); + int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise + int ret; struct item { int symbology; - unsigned char *data; - int ret_encode; + char *data; float w; float h; - int ret_vector; int expected_rows; int expected_width; - unsigned char *expected; + char *expected; }; struct item data[] = { - /* 0*/ { BARCODE_RSS14, "1234567890123", 0, 100, 30, 0, 1, 96, "010111010010000001001110000000010100001011111010110100011001100101111111110001011011000111000101" }, - /* 1*/ { BARCODE_RSS14, "0000004537076", 0, 100, 30, 0, 1, 96, "010101001000000001000100000000010111111100101010111101111101010101111111110111010100100000000101" }, - /* 2*/ { BARCODE_RSS14, "0000004537077", 0, 100, 30, 0, 1, 96, "010101001000000001000111000000010111111101001010101010110000000101111100000111011111111011010101" }, - /* 3*/ { BARCODE_RSS14, "0000004537078", 0, 100, 30, 0, 1, 96, "010101001000000001000111000000010111111101001010101011010000000101111000000011011111111011010101" }, - /* 4*/ { BARCODE_RSS14, "0000000001596", 0, 100, 30, 0, 1, 96, "010101001000000001001111100000010111111100101010111101111101010101111100000111011111111011010101" }, - /* 5*/ { BARCODE_RSS14, "0000000001597", 0, 100, 30, 0, 1, 96, "010101001000000001011111000000010111111100101010101010110000000101111100000111011111110111010101" }, - /* 6*/ { BARCODE_RSS14, "0000000001598", 0, 100, 30, 0, 1, 96, "010101001000000001011111000000010111111100101010101011010000000101111000000011011111110111010101" }, - /* 7*/ { BARCODE_RSS14, "0000000000000", 0, 100, 30, 0, 1, 96, "010101001000000001000111111110010111111100101010101010110000000101111111110111011111111011010101" }, - /* 8*/ { BARCODE_RSS14, "0000000257117", 0, 100, 30, 0, 1, 96, "010101001000000001001111100000010111111100101010101010110000000101111110000011000111111011010101" }, - /* 9*/ { BARCODE_RSS14, "0000000536592", 0, 100, 30, 0, 1, 96, "010101001000000001000111000000010111111100101010101010110000000101100000000111011101100011110101" }, - /* 10*/ { BARCODE_RSS14, "0000001644132", 0, 100, 30, 0, 1, 96, "010101001000000001001111100000010111111100101010100100001111010101111100000111000001101111010101" }, - /* 11*/ { BARCODE_RSS14, "0000002421052", 0, 100, 30, 0, 1, 96, "010101001000000001011111000000010111111100101010101010110000000101111100000111011100010001101101" }, - /* 12*/ { BARCODE_RSS14, "0000003217955", 0, 100, 30, 0, 1, 96, "010101001000000001000111000000010111111100101010101010110000000101111111000001000000111001010101" }, - /* 13*/ { BARCODE_RSS14, "0000004792584", 0, 100, 30, 0, 1, 96, "010101001000000001000111110000010111111101001010111011111101010101111111110111010110101111111101" }, - /* 14*/ { BARCODE_RSS14, "0000006062184", 0, 100, 30, 0, 1, 96, "010101001000000001000111111110010111111101001010110111111101010101111111110111001010011011111101" }, - /* 15*/ { BARCODE_RSS14, "0000007734882", 0, 100, 30, 0, 1, 96, "010101001000000001000111111110010111111101001010110111000010010101111111000111001010001100111101" }, - /* 16*/ { BARCODE_RSS14, "0000008845782", 0, 100, 30, 0, 1, 96, "010101001000000001011111000000010111111101001010111101111101010101111111000001000010101000011101" }, - /* 17*/ { BARCODE_RSS14, "0000009329661", 0, 100, 30, 0, 1, 96, "010101001000000001001111111000010111111101010010111011111101010101111000000011010110101111111101" }, - /* 18*/ { BARCODE_RSS14, "0000009607386", 0, 100, 30, 0, 1, 96, "010101001000000001011111000000010111111101010010100111001011110101111111110111011100011011110101" }, - /* 19*/ { BARCODE_RSS14, "0000010718286", 0, 100, 30, 0, 1, 96, "010101001000000001000111110000010111111101010010100100001111010101111100000111000001101111010101" }, - /* 20*/ { BARCODE_RSS14, "0000011607006", 0, 100, 30, 0, 1, 96, "010101001000000001000111111110010111111101010010101101000100000101111000000011010011100001101101" }, - /* 21*/ { BARCODE_RSS14, "0004360130997", 0, 100, 30, 0, 1, 96, "010101001000000001000100000000010110010010011110101010110000000101111000000011011111111011010101" }, - /* 22*/ { BARCODE_RSS14, "0004360386504", 0, 100, 30, 0, 1, 96, "010101001000000001000111000000010110010010011110111011111101010101111111100011010110101111111101" }, - /* 23*/ { BARCODE_RSS14, "0009142746747", 0, 100, 30, 0, 1, 96, "010101000100000001000111111110010100111110001010101010110000000101111111000111011101100011110101" }, - /* 24*/ { BARCODE_RSS14, "0012319818547", 0, 100, 30, 0, 1, 96, "010101000100000001000100000000010110001100101000101010110000000101111111000111001100011110010101" }, - /* 25*/ { BARCODE_RSS14, "0013775011335", 0, 100, 30, 0, 1, 96, "010101000100000001000100000000010101001100000110101010110000000101111100000111011111010011100101" }, - /* 26*/ { BARCODE_RSS14, "0018894538190", 0, 100, 30, 0, 1, 96, "010101000010000001000100000000010110100100111100101010110000000101111111110001010001100011110101" }, - /* 27*/ { BARCODE_RSS14, "0021059247735", 0, 100, 30, 0, 1, 96, "010101000010000001000100000000010101000011001100101010110000000101111111100011010110111000001101" }, - /* 28*/ { BARCODE_RSS14, "0024094346235", 0, 100, 30, 0, 1, 96, "010101000001000001000100000000010111010000111010101010110000000101100000000111000110011001101101" }, - /* 29*/ { BARCODE_RSS14, "1995000595035", 0, 100, 30, 0, 1, 96, "010100011011000001001110000000010111010111010000101010110000000101111000000011000110011001101101" }, - /* 30*/ { BARCODE_RSS14, "9999999999999", 0, 100, 30, 0, 1, 96, "010010111011100001000111111110010111101101001110100011111101010101111111000001000111110101011101" }, - /* 31*/ { BARCODE_RSS14_CC, "0000000000000", 0, 100, 30, 0, 5, 100, "0000010010111011100001001110000000010111101101001110110001010111110101111111110001000111110101011101" }, - /* 32*/ { BARCODE_RSS14_CC, "0000729476171", 0, 100, 30, 0, 5, 100, "0000010010111011100001011100000000010111100110100010101010110000000101111111100011011111111011010101" }, - /* 33*/ { BARCODE_RSS14_CC, "0004359674363", 0, 100, 30, 0, 5, 100, "0000010010111011100001011100000000010101110010000100101010110000000101111000000011011101100011110101" }, - /* 34*/ { BARCODE_RSS14_CC, "0009142871421", 0, 100, 30, 0, 5, 100, "0000010010111101000011000111111110010100010111110010101010110000000101111111000111001100011110010101" }, - /* 35*/ { BARCODE_RSS14_CC, "0012319591881", 0, 100, 30, 0, 5, 100, "0000010010111101000011000100000000010101000111010000101010110000000101111111000111011100010001101101" }, - /* 36*/ { BARCODE_RSS14_CC, "6975446373038", 0, 100, 30, 0, 5, 100, "0000010111001110010111001111111000010101000111010000101010110000000101111100000111011111111011010101" }, - /* 37*/ { BARCODE_RSS14_CC, "9999999999999", 0, 100, 30, 0, 5, 100, "0000010110101111011111001111111000010110111100100010100110111001110101111111110001001100110001110101" }, - /* 38*/ { BARCODE_RSS_LTD, "1234567890123", 0, 100, 30, 0, 1, 74, "01001100111100101000100111010110101011001001010010101001010000011100011101" }, - /* 39*/ { BARCODE_RSS_LTD, "0000002013570", 0, 100, 30, 0, 1, 74, "01010101010100000010000001110100101101011001010111111110111111010101010101" }, - /* 40*/ { BARCODE_RSS_LTD, "0000002013571", 0, 100, 30, 0, 1, 74, "01010101010100000011000000110101011010100011010101010101000000100000011101" }, - /* 41*/ { BARCODE_RSS_LTD, "0000002013572", 0, 100, 30, 0, 1, 74, "01010101010100000011000000110101010010111001010101010101000000110000001101" }, - /* 42*/ { BARCODE_RSS_LTD, "0000000917879", 0, 100, 30, 0, 1, 74, "01010101010100000010000001110100110101010011010100110111011111010110011101" }, - /* 43*/ { BARCODE_RSS_LTD, "0000000000000", 0, 100, 30, 0, 1, 74, "01010101010100000010000001110101110101001001010101010101000000100000011101" }, - /* 44*/ { BARCODE_RSS_LTD, "0000000183063", 0, 100, 30, 0, 1, 74, "01010101010100000010000001110110101010010011010000001110000001010101010101" }, - /* 45*/ { BARCODE_RSS_LTD, "0000000183064", 0, 100, 30, 0, 1, 74, "01010101010100000010000001110010101010111001010101010101000111100000111101" }, - /* 46*/ { BARCODE_RSS_LTD, "0000000820063", 0, 100, 30, 0, 1, 74, "01010101010100000010000001110010101010011011010000011110001111010101010101" }, - /* 47*/ { BARCODE_RSS_LTD, "0000000820064", 0, 100, 30, 0, 1, 74, "01010101010100000010000001110110101101001001010101010101011111100011111101" }, - /* 48*/ { BARCODE_RSS_LTD, "0000001000775", 0, 100, 30, 0, 1, 74, "01010101010100000010000001110010110101011001010001111110111111010101010101" }, - /* 49*/ { BARCODE_RSS_LTD, "0000001000776", 0, 100, 30, 0, 1, 74, "01010101010100000010000001110101110101010001010101010101000001100000111101" }, - /* 50*/ { BARCODE_RSS_LTD, "0000001491020", 0, 100, 30, 0, 1, 74, "01010101010100000010000001110010101010110011010000011110000011010101010101" }, - /* 51*/ { BARCODE_RSS_LTD, "0000001491021", 0, 100, 30, 0, 1, 74, "01010101010100000010000001110101001010110011010101010101001111100001111101" }, - /* 52*/ { BARCODE_RSS_LTD, "0000001979844", 0, 100, 30, 0, 1, 74, "01010101010100000010000001110101010100011011010000111110011111010101010101" }, - /* 53*/ { BARCODE_RSS_LTD, "0000001979845", 0, 100, 30, 0, 1, 74, "01010101010100000010000001110101110100101001010101010101000000100000000101" }, - /* 54*/ { BARCODE_RSS_LTD, "0000001996938", 0, 100, 30, 0, 1, 74, "01010101010100000010000001110101101010001011010000000010000001010101010101" }, - /* 55*/ { BARCODE_RSS_LTD, "0000001996939", 0, 100, 30, 0, 1, 74, "01010101010100000010000001110110110101010001010101010101011111101111111101" }, - /* 56*/ { BARCODE_RSS_LTD, "0000012013571", 0, 100, 30, 0, 1, 74, "01010101010111000000100000010101010010100111010001110111100101001101101101" }, - /* 57*/ { BARCODE_RSS_LTD, "0368610347973", 0, 100, 30, 0, 1, 74, "01000000111000000101010101010010101011101001010101010101000000100000011101" }, - /* 58*/ { BARCODE_RSS_LTD, "0368612361544", 0, 100, 30, 0, 1, 74, "01010101010100011110000011110101001101010011010101010101000000100000011101" }, - /* 59*/ { BARCODE_RSS_LTD, "1651255074973", 0, 100, 30, 0, 1, 74, "01000001111000111101010101010101101001010011010101010101000000100000011101" }, - /* 60*/ { BARCODE_RSS_LTD, "1651257088544", 0, 100, 30, 0, 1, 74, "01010101010101111110001111110101101001101001010101010101000000100000011101" }, - /* 61*/ { BARCODE_RSS_LTD, "1999999999999", 0, 100, 30, 0, 1, 74, "01001111001101101011011111010101011010110001010100001011100011010111100101" }, - /* 62*/ { BARCODE_RSS_LTD_CC, "0000000000000", 0, 100, 30, 0, 6, 74, "01010101010100000110000011110100101011010011010101010101000000100000011101" }, - /* 63*/ { BARCODE_RSS_LTD_CC, "0000002013571", 0, 100, 30, 0, 6, 74, "01010101010100000111000001110101101010001011010101010101000000100000011101" }, - /* 64*/ { BARCODE_RSS_LTD_CC, "0987141101324", 0, 100, 30, 0, 6, 74, "01000001111000001101010101010110101010100011010101010101000000100000011101" }, - /* 65*/ { BARCODE_RSS_LTD_CC, "0987143114895", 0, 100, 30, 0, 6, 74, "01010101010100111110000111110101110101010001010101010101000000100000011101" }, - /* 66*/ { BARCODE_RSS_LTD_CC, "1971422931828", 0, 100, 30, 0, 6, 74, "01000011111001111101010101010100101010100111010101010101000000100000011101" }, - /* 67*/ { BARCODE_RSS_LTD_CC, "1971424945399", 0, 100, 30, 0, 6, 74, "01010101010100000010000000010110101010010011010101010101000000100000011101" }, - /* 68*/ { BARCODE_RSS_LTD_CC, "1999999999999", 0, 100, 30, 0, 6, 74, "01000010000001010101000001010110101101001001010100001011100011010111100101" }, - /* 69*/ { BARCODE_RSS_LTD, "1651257071912", 0, 100, 30, 0, 1, 74, "01000001111000111101010101010101110101001001010101010101011111101111111101" }, - /* 70*/ { BARCODE_RSS_LTD_CC, "0987144605916", 0, 100, 30, 0, 6, 74, "01010101010100111110000111110110101101001001010101010101001111100001111101" }, + /* 0*/ { BARCODE_RSS14, "1234567890123", 100, 30, 1, 96, "010111010010000001001110000000010100001011111010110100011001100101111111110001011011000111000101" }, + /* 1*/ { BARCODE_RSS14, "0000004537076", 100, 30, 1, 96, "010101001000000001000100000000010111111100101010111101111101010101111111110111010100100000000101" }, + /* 2*/ { BARCODE_RSS14, "0000004537077", 100, 30, 1, 96, "010101001000000001000111000000010111111101001010101010110000000101111100000111011111111011010101" }, + /* 3*/ { BARCODE_RSS14, "0000004537078", 100, 30, 1, 96, "010101001000000001000111000000010111111101001010101011010000000101111000000011011111111011010101" }, + /* 4*/ { BARCODE_RSS14, "0000000001596", 100, 30, 1, 96, "010101001000000001001111100000010111111100101010111101111101010101111100000111011111111011010101" }, + /* 5*/ { BARCODE_RSS14, "0000000001597", 100, 30, 1, 96, "010101001000000001011111000000010111111100101010101010110000000101111100000111011111110111010101" }, + /* 6*/ { BARCODE_RSS14, "0000000001598", 100, 30, 1, 96, "010101001000000001011111000000010111111100101010101011010000000101111000000011011111110111010101" }, + /* 7*/ { BARCODE_RSS14, "0000000000000", 100, 30, 1, 96, "010101001000000001000111111110010111111100101010101010110000000101111111110111011111111011010101" }, + /* 8*/ { BARCODE_RSS14, "0000000257117", 100, 30, 1, 96, "010101001000000001001111100000010111111100101010101010110000000101111110000011000111111011010101" }, + /* 9*/ { BARCODE_RSS14, "0000000536592", 100, 30, 1, 96, "010101001000000001000111000000010111111100101010101010110000000101100000000111011101100011110101" }, + /* 10*/ { BARCODE_RSS14, "0000001644132", 100, 30, 1, 96, "010101001000000001001111100000010111111100101010100100001111010101111100000111000001101111010101" }, + /* 11*/ { BARCODE_RSS14, "0000002421052", 100, 30, 1, 96, "010101001000000001011111000000010111111100101010101010110000000101111100000111011100010001101101" }, + /* 12*/ { BARCODE_RSS14, "0000003217955", 100, 30, 1, 96, "010101001000000001000111000000010111111100101010101010110000000101111111000001000000111001010101" }, + /* 13*/ { BARCODE_RSS14, "0000004792584", 100, 30, 1, 96, "010101001000000001000111110000010111111101001010111011111101010101111111110111010110101111111101" }, + /* 14*/ { BARCODE_RSS14, "0000006062184", 100, 30, 1, 96, "010101001000000001000111111110010111111101001010110111111101010101111111110111001010011011111101" }, + /* 15*/ { BARCODE_RSS14, "0000007734882", 100, 30, 1, 96, "010101001000000001000111111110010111111101001010110111000010010101111111000111001010001100111101" }, + /* 16*/ { BARCODE_RSS14, "0000008845782", 100, 30, 1, 96, "010101001000000001011111000000010111111101001010111101111101010101111111000001000010101000011101" }, + /* 17*/ { BARCODE_RSS14, "0000009329661", 100, 30, 1, 96, "010101001000000001001111111000010111111101010010111011111101010101111000000011010110101111111101" }, + /* 18*/ { BARCODE_RSS14, "0000009607386", 100, 30, 1, 96, "010101001000000001011111000000010111111101010010100111001011110101111111110111011100011011110101" }, + /* 19*/ { BARCODE_RSS14, "0000010718286", 100, 30, 1, 96, "010101001000000001000111110000010111111101010010100100001111010101111100000111000001101111010101" }, + /* 20*/ { BARCODE_RSS14, "0000011607006", 100, 30, 1, 96, "010101001000000001000111111110010111111101010010101101000100000101111000000011010011100001101101" }, + /* 21*/ { BARCODE_RSS14, "0004360130997", 100, 30, 1, 96, "010101001000000001000100000000010110010010011110101010110000000101111000000011011111111011010101" }, + /* 22*/ { BARCODE_RSS14, "0004360386504", 100, 30, 1, 96, "010101001000000001000111000000010110010010011110111011111101010101111111100011010110101111111101" }, + /* 23*/ { BARCODE_RSS14, "0009142746747", 100, 30, 1, 96, "010101000100000001000111111110010100111110001010101010110000000101111111000111011101100011110101" }, + /* 24*/ { BARCODE_RSS14, "0012319818547", 100, 30, 1, 96, "010101000100000001000100000000010110001100101000101010110000000101111111000111001100011110010101" }, + /* 25*/ { BARCODE_RSS14, "0013775011335", 100, 30, 1, 96, "010101000100000001000100000000010101001100000110101010110000000101111100000111011111010011100101" }, + /* 26*/ { BARCODE_RSS14, "0018894538190", 100, 30, 1, 96, "010101000010000001000100000000010110100100111100101010110000000101111111110001010001100011110101" }, + /* 27*/ { BARCODE_RSS14, "0021059247735", 100, 30, 1, 96, "010101000010000001000100000000010101000011001100101010110000000101111111100011010110111000001101" }, + /* 28*/ { BARCODE_RSS14, "0024094346235", 100, 30, 1, 96, "010101000001000001000100000000010111010000111010101010110000000101100000000111000110011001101101" }, + /* 29*/ { BARCODE_RSS14, "1995000595035", 100, 30, 1, 96, "010100011011000001001110000000010111010111010000101010110000000101111000000011000110011001101101" }, + /* 30*/ { BARCODE_RSS14, "9999999999999", 100, 30, 1, 96, "010010111011100001000111111110010111101101001110100011111101010101111111000001000111110101011101" }, + /* 31*/ { BARCODE_RSS14_CC, "0000000000000", 100, 30, 5, 100, "0000010010111011100001001110000000010111101101001110110001010111110101111111110001000111110101011101" }, + /* 32*/ { BARCODE_RSS14_CC, "0000729476171", 100, 30, 5, 100, "0000010010111011100001011100000000010111100110100010101010110000000101111111100011011111111011010101" }, + /* 33*/ { BARCODE_RSS14_CC, "0004359674363", 100, 30, 5, 100, "0000010010111011100001011100000000010101110010000100101010110000000101111000000011011101100011110101" }, + /* 34*/ { BARCODE_RSS14_CC, "0009142871421", 100, 30, 5, 100, "0000010010111101000011000111111110010100010111110010101010110000000101111111000111001100011110010101" }, + /* 35*/ { BARCODE_RSS14_CC, "0012319591881", 100, 30, 5, 100, "0000010010111101000011000100000000010101000111010000101010110000000101111111000111011100010001101101" }, + /* 36*/ { BARCODE_RSS14_CC, "6975446373038", 100, 30, 5, 100, "0000010111001110010111001111111000010101000111010000101010110000000101111100000111011111111011010101" }, + /* 37*/ { BARCODE_RSS14_CC, "9999999999999", 100, 30, 5, 100, "0000010110101111011111001111111000010110111100100010100110111001110101111111110001001100110001110101" }, + /* 38*/ { BARCODE_RSS_LTD, "1234567890123", 100, 30, 1, 74, "01001100111100101000100111010110101011001001010010101001010000011100011101" }, + /* 39*/ { BARCODE_RSS_LTD, "0000002013570", 100, 30, 1, 74, "01010101010100000010000001110100101101011001010111111110111111010101010101" }, + /* 40*/ { BARCODE_RSS_LTD, "0000002013571", 100, 30, 1, 74, "01010101010100000011000000110101011010100011010101010101000000100000011101" }, + /* 41*/ { BARCODE_RSS_LTD, "0000002013572", 100, 30, 1, 74, "01010101010100000011000000110101010010111001010101010101000000110000001101" }, + /* 42*/ { BARCODE_RSS_LTD, "0000000917879", 100, 30, 1, 74, "01010101010100000010000001110100110101010011010100110111011111010110011101" }, + /* 43*/ { BARCODE_RSS_LTD, "0000000000000", 100, 30, 1, 74, "01010101010100000010000001110101110101001001010101010101000000100000011101" }, + /* 44*/ { BARCODE_RSS_LTD, "0000000183063", 100, 30, 1, 74, "01010101010100000010000001110110101010010011010000001110000001010101010101" }, + /* 45*/ { BARCODE_RSS_LTD, "0000000183064", 100, 30, 1, 74, "01010101010100000010000001110010101010111001010101010101000111100000111101" }, + /* 46*/ { BARCODE_RSS_LTD, "0000000820063", 100, 30, 1, 74, "01010101010100000010000001110010101010011011010000011110001111010101010101" }, + /* 47*/ { BARCODE_RSS_LTD, "0000000820064", 100, 30, 1, 74, "01010101010100000010000001110110101101001001010101010101011111100011111101" }, + /* 48*/ { BARCODE_RSS_LTD, "0000001000775", 100, 30, 1, 74, "01010101010100000010000001110010110101011001010001111110111111010101010101" }, + /* 49*/ { BARCODE_RSS_LTD, "0000001000776", 100, 30, 1, 74, "01010101010100000010000001110101110101010001010101010101000001100000111101" }, + /* 50*/ { BARCODE_RSS_LTD, "0000001491020", 100, 30, 1, 74, "01010101010100000010000001110010101010110011010000011110000011010101010101" }, + /* 51*/ { BARCODE_RSS_LTD, "0000001491021", 100, 30, 1, 74, "01010101010100000010000001110101001010110011010101010101001111100001111101" }, + /* 52*/ { BARCODE_RSS_LTD, "0000001979844", 100, 30, 1, 74, "01010101010100000010000001110101010100011011010000111110011111010101010101" }, + /* 53*/ { BARCODE_RSS_LTD, "0000001979845", 100, 30, 1, 74, "01010101010100000010000001110101110100101001010101010101000000100000000101" }, + /* 54*/ { BARCODE_RSS_LTD, "0000001996938", 100, 30, 1, 74, "01010101010100000010000001110101101010001011010000000010000001010101010101" }, + /* 55*/ { BARCODE_RSS_LTD, "0000001996939", 100, 30, 1, 74, "01010101010100000010000001110110110101010001010101010101011111101111111101" }, + /* 56*/ { BARCODE_RSS_LTD, "0000012013571", 100, 30, 1, 74, "01010101010111000000100000010101010010100111010001110111100101001101101101" }, + /* 57*/ { BARCODE_RSS_LTD, "0368610347973", 100, 30, 1, 74, "01000000111000000101010101010010101011101001010101010101000000100000011101" }, + /* 58*/ { BARCODE_RSS_LTD, "0368612361544", 100, 30, 1, 74, "01010101010100011110000011110101001101010011010101010101000000100000011101" }, + /* 59*/ { BARCODE_RSS_LTD, "1651255074973", 100, 30, 1, 74, "01000001111000111101010101010101101001010011010101010101000000100000011101" }, + /* 60*/ { BARCODE_RSS_LTD, "1651257088544", 100, 30, 1, 74, "01010101010101111110001111110101101001101001010101010101000000100000011101" }, + /* 61*/ { BARCODE_RSS_LTD, "1999999999999", 100, 30, 1, 74, "01001111001101101011011111010101011010110001010100001011100011010111100101" }, + /* 62*/ { BARCODE_RSS_LTD_CC, "0000000000000", 100, 30, 6, 74, "01010101010100000110000011110100101011010011010101010101000000100000011101" }, + /* 63*/ { BARCODE_RSS_LTD_CC, "0000002013571", 100, 30, 6, 74, "01010101010100000111000001110101101010001011010101010101000000100000011101" }, + /* 64*/ { BARCODE_RSS_LTD_CC, "0987141101324", 100, 30, 6, 74, "01000001111000001101010101010110101010100011010101010101000000100000011101" }, + /* 65*/ { BARCODE_RSS_LTD_CC, "0987143114895", 100, 30, 6, 74, "01010101010100111110000111110101110101010001010101010101000000100000011101" }, + /* 66*/ { BARCODE_RSS_LTD_CC, "1971422931828", 100, 30, 6, 74, "01000011111001111101010101010100101010100111010101010101000000100000011101" }, + /* 67*/ { BARCODE_RSS_LTD_CC, "1971424945399", 100, 30, 6, 74, "01010101010100000010000000010110101010010011010101010101000000100000011101" }, + /* 68*/ { BARCODE_RSS_LTD_CC, "1999999999999", 100, 30, 6, 74, "01000010000001010101000001010110101101001001010100001011100011010111100101" }, + /* 69*/ { BARCODE_RSS_LTD, "1651257071912", 100, 30, 1, 74, "01000001111000111101010101010101110101001001010101010101011111101111111101" }, + /* 70*/ { BARCODE_RSS_LTD_CC, "0987144605916", 100, 30, 6, 74, "01010101010100111110000111110110101101001001010101010101001111100001111101" }, }; int data_size = sizeof(data) / sizeof(struct item); char *text; + char bwipp_buf[1024]; + char bwipp_msg[1024]; + for (int i = 0; i < data_size; i++) { if (index != -1 && i != index) continue; @@ -143,12 +146,12 @@ static void test_binary_div_modulo_divisor(int index, int generate, int debug) { } int length = strlen(text); - ret = ZBarcode_Encode(symbol, text, 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); + ret = ZBarcode_Encode(symbol, (const unsigned char *) text, length); + assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 (%s)\n", i, ret, symbol->errtxt); if (generate) { - printf(" /*%3d*/ { %s, \"%s\", %d, %.0f, %.0f, %d, %d, %d, ", - i, testUtilBarcodeName(data[i].symbology), data[i].data, ret, data[i].w, data[i].h, data[i].ret_vector, symbol->rows, symbol->width); + printf(" /*%3d*/ { %s, \"%s\", %.0f, %.0f, %d, %d, ", + i, testUtilBarcodeName(data[i].symbology), data[i].data, data[i].w, data[i].h, symbol->rows, symbol->width); testUtilModulesDumpRow(symbol, symbol->rows - 1, "", " },\n"); } else { assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n", i, symbol->rows, data[i].expected_rows); @@ -159,7 +162,16 @@ static void test_binary_div_modulo_divisor(int index, int generate, int debug) { assert_zero(ret, "i:%d testUtilModulesCmpRow ret %d != 0 width %d row %d\n", i, ret, width, symbol->rows - 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_zero(ret, "i:%d ZBarcode_Buffer_Vector ret %d != 0\n", i, ret); + + if (do_bwipp && testUtilCanBwipp(symbol->symbology, -1, -1, -1, debug)) { + ret = testUtilBwipp(symbol, -1, -1, -1, text, length, symbol->primary, bwipp_buf, sizeof(bwipp_buf)); + assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), ret); + + ret = testUtilBwippCmpRow(symbol, symbol->rows - 1, bwipp_msg, bwipp_buf, data[i].expected); + assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", + i, testUtilBarcodeName(data[i].symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); + } } ZBarcode_Delete(symbol); @@ -173,147 +185,450 @@ static void test_examples(int index, int generate, int debug) { testStart(""); + int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise + int ret; struct item { int symbology; int option_2; - unsigned char *data; - int ret; + char *data; int expected_rows; int expected_width; char *comment; - unsigned char *expected; + char *expected; }; - // Verified manually against GS1 General Specifications 20.0 and ISO/IEC 24724:2011 + // Verified manually against GS1 General Specifications 20.0 (GGS) and ISO/IEC 24724:2011, and verified via bwipp_dump.ps against BWIPP struct item data[] = { - /* 0*/ { BARCODE_RSS14, -1, "0950110153001", 0, 1, 96, "Figure 5.5.2.1.1-1. GS1 DataBar Omnidirectional", - "010000010100000101000111110000010111101101011100100011011101000101100000000111001110110111001101" - }, - /* 1*/ { BARCODE_RSS_EXP, -1, "[01]90614141000015[3202]000150", 0, 1, 151, "Figure 5.5.2.3.1-1. GS1 DataBar Expanded", - "0101100011001100001011111111000010100100010000111101110011100010100010111100000011100111010111111011010100000100000110001111110000101000000100011010010" - }, - /* 2*/ { BARCODE_RSS_EXPSTACK, -1, "[01]90614141000015[3202]000150", 0, 5, 102, "Figure 5.5.2.3.2-1. GS1 DataBar Expanded Stacked", - "010110001100110000101111111100001010010001000011110111001110001010001011110000001110011101011111101101" - "000001110011001111010000000010100101101110111100001000110001110101100100001010100001100010100000010000" - "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" - "000001011111011111001010000001010010111111011100100000000000000000000000000000000000000000000000000000" - "001010100000100000110001111110000101000000100011010010000000000000000000000000000000000000000000000000" - }, - /* 3*/ { BARCODE_RSS14, -1, "2001234567890", 0, 1, 96, "24724:2011 Figure 1 — GS1 DataBar Omnidirectional", - "010100011101000001001111111000010100110110111110110000010010100101100000000111000110110110001101" - }, - /* 4*/ { BARCODE_RSS14, -1, "0441234567890", 0, 1, 96, "24724:2011 Figure 2 — GS1 DataBar Omnidirectional", - "010010001000010001000111000000010101000001100110101100100100000101111110000011000010100011100101" - }, - /* 5*/ { BARCODE_RSS14, -1, "0001234567890", 0, 1, 96, "24724:2011 Figure 4 — GS1 DataBar Truncated", - "010101001000000001001111111000010111001011011110111001010110000101111111000111001100111101110101" - }, - /* 6*/ { BARCODE_RSS14STACK, -1, "0001234567890", 0, 3, 50, "24724:2011 Figure 5 — GS1 DataBar Stacked", - "01010100100000000100111111100001011100101101111010" - "00001010101011111010000000111010100011010010000000" - "10111001010110000101111111000111001100111101110101" - }, - /* 7*/ { BARCODE_RSS14STACK_OMNI, -1, "0003456789012", 0, 5, 50, "24724:2011 Figure 6 — GS1 DataBar Stacked Omnidirectional", - "01010100100000000100111110000001010011100110011010" - "00001011011111111010000001010100101100011001100000" - "00000101010101010101010101010101010101010101010000" - "00001000100010111010010101010000111101001101110000" - "10110111011101000101100000000111000010110010001101" - }, - /* 8*/ { BARCODE_RSS_LTD, -1, "1501234567890", 0, 1, 74, "24724:2011 Figure 7 — GS1 DataBar Limited", - "01000110011000110110101001110100101011010011010010010110001101110011001101" - }, - /* 9*/ { BARCODE_RSS_LTD, -1, "0031234567890", 0, 1, 74, "24724:2011 Figure 8 — (a) GS1 DataBar Limited", - "01010100000100100010000101110010101101101001010110000010100100101100000101" - }, - /*10*/ { BARCODE_RSS_EXP, -1, "[01]98898765432106[3202]012345[15]991231", 0, 1, 200, "24724:2011 Figure 10 — GS1 DataBar Expanded", - "01001000011000110110111111110000101110000110010100011010000001100010101111110000111010011100000010010100111110111001100011111100001011101100000100100100011110010110001011111111001110001101111010000101" - }, - /*11*/ { BARCODE_RSS_EXP, -1, "[01]90012345678908[3103]001750", 0, 1, 151, "24724:2011 Figure 11 — GS1 DataBar Expanded", - "0101110010000010011011111111000010111000010011000101011110111001100010111100000011100101110001110111011110101111000110001111110000101011000010011111010" - }, - /*12*/ { BARCODE_RSS_EXPSTACK, -1, "[01]98898765432106[3202]012345[15]991231", 0, 5, 102, "24724:2011 Figure 12 — GS1 DataBar Expanded Stacked symbol", - "010010000110001101101111111100001011100001100101000110100000011000101011111100001110100111000000100101" - "000001111001110010010000000010100100011110011010111001011111100111010100000010100001011000111111010000" - "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" - "000011101000010011100001000000001011100101100001110110110111110010001001010000001010011000100000110000" - "101000010111101100011100111111110100011010011110001001001000001101110100001111110001100111011111001010" - }, - /*13*/ { BARCODE_RSS_EXPSTACK, -1, "[01]95012345678903[3103]000123", 0, 5, 102, "24724:2011 Figure 13 — GS1 DataBar Expanded Stacked", - "010100010001111000101111111100001010111000001100010111000110001001101011110000001110010111000111011101" - "000011101110000111010000000010100101000111110011101000111001110110010100001010100001101000111000100000" - "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" - "000000001010000111001010000001010010111011011111100000000000000000000000000000000000000000000000000000" - "001011110101111000110001111110000101000100100000011010000000000000000000000000000000000000000000000000" - }, - /*14*/ { BARCODE_RSS_LTD, -1, "0009876543210", 0, 1, 74, "24724:2011 Figure F.2 — GS1 DataBar Limited", - "01010100100100110000110000010101101001011001010001000101000100000100100101" - }, - /*15*/ { BARCODE_RSS_EXP, -1, "[10]12A", 0, 1, 102, "24724:2011 Figure F.3 — GS1 DataBar Expanded", - "010100000110100000101111111100001010001000000010110101111100100111001011110000000010011101111111010101" - }, - /*16*/ { BARCODE_RSS14STACK, -1, "0000000000000", 0, 3, 50, "#183 GS1 DataBar Stacked separator alternation; verified manually against tec-it.com (bwipp differs)", - "01010100100000000100011111111001011111110010101010" - "00000101011111111010100000001010100000001101010000" - "10101010110000000101111111110111011111111011010101" - }, - /*17*/ { BARCODE_RSS_EXP, -1, "[255]95011015340010123456789", 0, 1, 232, "2.6.2.1 Example 1", - "0100011000110001011011111111000010100000010101100001100001100111001010111110000001100100001110100001001000011011111010001111110000101001011111100111011001000111100100101111111100111011111001100100110010011100010111100011110000001010" - }, - /*18*/ { BARCODE_RSS_EXP, -1, "[255]95011015340010123456789[3900]000", 0, 1, 298, "2.6.2.1 Example 2", - "0101100011111010001011111111000010100001000001001101100001100111001010111110000001100100001110100001001000011011111010001111110000101001011111100111011001000111100100101111111100111011111001100100110010011100010111100011000000001010111111011101000100001000110001101011111111100110011110010010001101" - }, - /*19*/ { BARCODE_RSS_EXP, -1, "[255]9501101534001[17]160531[3902]050", 0, 1, 281, "2.6.2.1 Example 3", - "01011001000110011110111111110000101000000101011000011000011001110010101111100000011001000011101000010010000110111110100011111100001010010111111001110111000010010100001011111111001110000100001100110100010000001101001000110000000010111010011110011101110010110001100010111111111001101" - }, - /*20*/ { BARCODE_RSS_EXPSTACK, 3, "[255]9501101534001012345[8111]0500", 0, 5, 151, "2.6.2.1 Example 4 **NOT SAME** separator bar differs TODO: investigate", - "0101100111100011001011111111000010100000010101100001100001100111001010111110000001100100001110100001001000011011111010001111110000101001011111100111010" - "0000011000011100110100000000101001011111101010011110011110011000110101000001010100011011110001011110110111100100000101010000001010010110100000011000000" - "0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" - "0000110111000011010010000000010000100000100111011001100001100100010010100101010100101110110001111001011101100011101100100000000010000000000000000000000" - "1011001000111100100101111111100111011111011000100110011110011011101100011000000001010001001110000110100010011100010001011111111100110100000000000000000" - }, - /*21*/ { BARCODE_RSS_EXPSTACK, 3, "[255]9501101534001[3941]0035", 0, 5, 151, "2.6.2.1 Example 5 **NOT SAME** separator bar differs TODO: investigate", - "0100001101011000011011111111000010100000010101100001100001100111001010111110000001100100001110100001001000011011111010001111110000101001011111100111010" - "0000110010100111100100000000101001011111101010011110011110011000110101000001010100011011110001011110110111100100000101010000001010010110100000011000000" - "0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" - "0000011011111011110010000000010000111100101011111001000100011100111010100001010100000000000000000000000000000000000000000000000000000000000000000000000" - "1010100100000100000101111111100111000011010100000110111011100011000100011110000001010000000000000000000000000000000000000000000000000000000000000000000" - }, + /* 0*/ { BARCODE_RSS14, -1, "0950110153001", 1, 96, "GGS Figure 5.5.2.1.1-1. GS1 DataBar Omnidirectional", + "010000010100000101000111110000010111101101011100100011011101000101100000000111001110110111001101" + }, + /* 1*/ { BARCODE_RSS_EXP, -1, "[01]90614141000015[3202]000150", 1, 151, "GGS Figure 5.5.2.3.1-1. GS1 DataBar Expanded", + "0101100011001100001011111111000010100100010000111101110011100010100010111100000011100111010111111011010100000100000110001111110000101000000100011010010" + }, + /* 2*/ { BARCODE_RSS_EXPSTACK, -1, "[01]90614141000015[3202]000150", 5, 102, "GGS Figure 5.5.2.3.2-1. GS1 DataBar Expanded Stacked, same (tec-it separator differs)", + "010110001100110000101111111100001010010001000011110111001110001010001011110000001110011101011111101101" + "000001110011001111010000000010100101101110111100001000110001110101110100001010100001100010100000010000" + "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "000001011111011111001010000001010010111111011100100000000000000000000000000000000000000000000000000000" + "001010100000100000110001111110000101000000100011010010000000000000000000000000000000000000000000000000" + }, + /* 3*/ { BARCODE_RSS14, -1, "2001234567890", 1, 96, "24724:2011 Figure 1 — GS1 DataBar Omnidirectional", + "010100011101000001001111111000010100110110111110110000010010100101100000000111000110110110001101" + }, + /* 4*/ { BARCODE_RSS14, -1, "0441234567890", 1, 96, "24724:2011 Figure 2 — GS1 DataBar Omnidirectional", + "010010001000010001000111000000010101000001100110101100100100000101111110000011000010100011100101" + }, + /* 5*/ { BARCODE_RSS14, -1, "0001234567890", 1, 96, "24724:2011 Figure 4 — GS1 DataBar Truncated", + "010101001000000001001111111000010111001011011110111001010110000101111111000111001100111101110101" + }, + /* 6*/ { BARCODE_RSS14STACK, -1, "0001234567890", 3, 50, "24724:2011 Figure 5 — GS1 DataBar Stacked NOTE: Figure 5 separator differs from GGS Figure 5.5.2.1.3-1. which has ends set", + "01010100100000000100111111100001011100101101111010" + "00001010101011111010000000111010100011010010000000" + "10111001010110000101111111000111001100111101110101" + }, + /* 7*/ { BARCODE_RSS14STACK_OMNI, -1, "0003456789012", 5, 50, "24724:2011 Figure 6 — GS1 DataBar Stacked Omnidirectional", + "01010100100000000100111110000001010011100110011010" + "00001011011111111010000001010100101100011001100000" + "00000101010101010101010101010101010101010101010000" + "00001000100010111010010101010000111101001101110000" + "10110111011101000101100000000111000010110010001101" + }, + /* 8*/ { BARCODE_RSS_LTD, -1, "1501234567890", 1, 74, "24724:2011 Figure 7 — GS1 DataBar Limited", + "01000110011000110110101001110100101011010011010010010110001101110011001101" + }, + /* 9*/ { BARCODE_RSS_LTD, -1, "0031234567890", 1, 74, "24724:2011 Figure 8 — (a) GS1 DataBar Limited", + "01010100000100100010000101110010101101101001010110000010100100101100000101" + }, + /* 10*/ { BARCODE_RSS_EXP, -1, "[01]98898765432106[3202]012345[15]991231", 1, 200, "24724:2011 Figure 10 — GS1 DataBar Expanded", + "01001000011000110110111111110000101110000110010100011010000001100010101111110000111010011100000010010100111110111001100011111100001011101100000100100100011110010110001011111111001110001101111010000101" + }, + /* 11*/ { BARCODE_RSS_EXP, -1, "[01]90012345678908[3103]001750", 1, 151, "24724:2011 Figure 11 — GS1 DataBar Expanded", + "0101110010000010011011111111000010111000010011000101011110111001100010111100000011100101110001110111011110101111000110001111110000101011000010011111010" + }, + /* 12*/ { BARCODE_RSS_EXPSTACK, -1, "[01]98898765432106[3202]012345[15]991231", 5, 102, "24724:2011 Figure 12 — GS1 DataBar Expanded Stacked symbol", + "010010000110001101101111111100001011100001100101000110100000011000101011111100001110100111000000100101" + "000001111001110010010000000010100100011110011010111001011111100111010100000010100001011000111111010000" + "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "000011101000010011100001000000001011100101100001110110110111110010001001010000001010011000100000110000" + "101000010111101100011100111111110100011010011110001001001000001101110100001111110001100111011111001010" + }, + /* 13*/ { BARCODE_RSS_EXPSTACK, -1, "[01]95012345678903[3103]000123", 5, 102, "24724:2011 Figure 13 — GS1 DataBar Expanded Stacked", + "010100010001111000101111111100001010111000001100010111000110001001101011110000001110010111000111011101" + "000011101110000111010000000010100101000111110011101000111001110110010100001010100001101000111000100000" + "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "000000001010000111001010000001010010111011011111100000000000000000000000000000000000000000000000000000" + "001011110101111000110001111110000101000100100000011010000000000000000000000000000000000000000000000000" + }, + /* 14*/ { BARCODE_RSS_LTD, -1, "0009876543210", 1, 74, "24724:2011 Figure F.2 — GS1 DataBar Limited", + "01010100100100110000110000010101101001011001010001000101000100000100100101" + }, + /* 15*/ { BARCODE_RSS_EXP, -1, "[10]12A", 1, 102, "24724:2011 Figure F.3 — GS1 DataBar Expanded", + "010100000110100000101111111100001010001000000010110101111100100111001011110000000010011101111111010101" + }, + /* 16*/ { BARCODE_RSS14STACK, -1, "0000000000000", 3, 50, "#183 GS1 DataBar Stacked separator alternation; verified manually against tec-it.com", + "01010100100000000100011111111001011111110010101010" + "00000101011111111010100000001010100000001101010000" + "10101010110000000101111111110111011111111011010101" + }, + /* 17*/ { BARCODE_RSS_EXP, -1, "[255]95011015340010123456789", 1, 232, "GGS 2.6.2.1 Example 1", + "0100011000110001011011111111000010100000010101100001100001100111001010111110000001100100001110100001001000011011111010001111110000101001011111100111011001000111100100101111111100111011111001100100110010011100010111100011110000001010" + }, + /* 18*/ { BARCODE_RSS_EXP, -1, "[255]95011015340010123456789[3900]000", 1, 298, "GGS 2.6.2.1 Example 2", + "0101100011111010001011111111000010100001000001001101100001100111001010111110000001100100001110100001001000011011111010001111110000101001011111100111011001000111100100101111111100111011111001100100110010011100010111100011000000001010111111011101000100001000110001101011111111100110011110010010001101" + }, + /* 19*/ { BARCODE_RSS_EXP, -1, "[255]9501101534001[17]160531[3902]050", 1, 281, "GGS 2.6.2.1 Example 3", + "01011001000110011110111111110000101000000101011000011000011001110010101111100000011001000011101000010010000110111110100011111100001010010111111001110111000010010100001011111111001110000100001100110100010000001101001000110000000010111010011110011101110010110001100010111111111001101" + }, + /* 20*/ { BARCODE_RSS_EXPSTACK, 3, "[255]9501101534001012345[8111]0500", 5, 151, "GGS 2.6.2.1 Example 4, same (tec-it separator differs)", + "0101100111100011001011111111000010100000010101100001100001100111001010111110000001100100001110100001001000011011111010001111110000101001011111100111010" + "0000011000011100110100000000101001011111101010011110011110011000110101000001010100011011110001011110110111100100000101010000001010010110100000011000000" + "0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" + "0000110111000011011010000000010000100000100111011001100001100100010010100101010100101110110001111001011101100011101110100000000010000000000000000000000" + "1011001000111100100101111111100111011111011000100110011110011011101100011000000001010001001110000110100010011100010001011111111100110100000000000000000" + }, + /* 21*/ { BARCODE_RSS_EXPSTACK, 3, "[255]9501101534001[3941]0035", 5, 151, "GGS 2.6.2.1 Example 5, same (tec-it separator differs)", + "0100001101011000011011111111000010100000010101100001100001100111001010111110000001100100001110100001001000011011111010001111110000101001011111100111010" + "0000110010100111100100000000101001011111101010011110011110011000110101000001010100011011110001011110110111100100000101010000001010010110100000011000000" + "0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" + "0000011011111011111010000000010000111100101011111001000100011100111010100001010100000000000000000000000000000000000000000000000000000000000000000000000" + "1010100100000100000101111111100111000011010100000110111011100011000100011110000001010000000000000000000000000000000000000000000000000000000000000000000" + }, + /* 22*/ { BARCODE_RSS14, -1, "0950110153000", 1, 96, "https://www.gs1.org/standards/barcodes/databar, same, verified manually against tec-it", + "010000010100000101000111111110010111101101011100100011011011000101111110000011001110110111001101" + }, + /* 23*/ { BARCODE_RSS14STACK, -1, "0950110153000", 3, 50, "https://www.gs1.org/standards/barcodes/databar, same, verified manually against tec-it", + "01000001010000010100011111111001011110110101110010" + "00001100101101101010100001010100100001001010100000" + "10100011011011000101111110000011001110110111001101" + }, + /* 24*/ { BARCODE_RSS_EXPSTACK, -1, "[01]09501101530003[17]140704[10]AB-123", 9, 102, "https://www.gs1.org/standards/barcodes/databar, same (tec-it separator differs)", + "010101111100001001101111111100001011100001110110010100000011011010001011111000000110011010000001001101" + "000010000011110110010000000010100100011110001001101011111100100101110100000101010001100101111110110000" + "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "000011011001001111100001000000001011011111000110110110110000111110101001010000001010011101110100010000" + "101000100110110000011100111111110100100000111001001001001111000001010100001111110001100010001011100010" + "000011011001001111100001000000001011011111000110110110110000111110101001010000001010011101110100010000" + "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "000010111101011110010100101010100100111100110010111001001100011111010100000000010000000000000000000000" + "010001000010100001100011000000001011000011001101000110110011100000101011111111100110100000000000000000" + }, + /* 25*/ { BARCODE_RSS_EXP, -1, "[01]09501101530003[17]140704[10]AB-123", 1, 281, "https://www.gs1.org/standards/barcodes/databar, same, verified manually against tec-it", + "01010111110000100110111111110000101110000111011001010000001101101000101111100000011001101000000100110001110100010001100011111100001010100000111100100100100111000001001011111111001110000011011001000100010000101000011000110000000010110000110011010001101100111000001010111111111001101" + }, + /* 26*/ { BARCODE_RSS14STACK, -1, "07010001234567", 3, 50, "https://www.gs1.no/support/standardbibliotek/datafangst/gs1-databar, same, verified manually against tec-it", + "01000100001010000100011100000001011000100110001010" + "00000011010101011010101011111010100111010101010000" + "10111100101110100101100000000111011000001000110101" + }, + /* 27*/ { BARCODE_RSS14STACK_OMNI, -1, "12380000000008", 5, 50, "Example with finder values 3 & 3; for bottom row see 5.3.2.2, same as BWIPP (tec-it and IDAutomation differ (ie no shift))", + "01011101001000000100010000000001010000001101011010" + "00000010110111111010101010101010101111110010100000" + "00000101010101010101010101010101010101010101010000" + "00001101100011001010000000000100101100111011110000" + "10100010011100110101111111110111010011000100001101" + }, + /* 28*/ { BARCODE_RSS14STACK_OMNI, -1, "99991234912372", 5, 50, "Example with finder values 8 & 6, same as BWIPP, verified manually against tec-it and IDAutomation", + "01001011101110000101110000000001011111011100101010" + "00000100010001111010001010101010100000100011010000" + "00000101010101010101010101010101010101010101010000" + "00001000100011001010000000010100100001000100100000" + "10100111011100110101111111100011011110111011011101" + }, + /* 29*/ { BARCODE_RSS14STACK_OMNI, -1, "32219876543217", 5, 50, "Example with finder values 6 & 1, same as BWIPP, verified manually against tec-it and IDAutomation", + "01001011000010001100111000000001011100010101000010" + "00000100111101110010000101010100100011101010110000" + "00000101010101010101010101010101010101010101010000" + "00001110011100101010000010101000110100001000010000" + "10110001100011010101111100000111001011110111100101" + }, + /* 30*/ { BARCODE_RSS14STACK_OMNI, -1, "32219876543255", 5, 50, "Example with finder values 7 & 7, same as BWIPP, verified manually against tec-it and IDAutomation", + "01001011000010001101111100000001011100010101000010" + "00000100111101110010000010101010100011101010110000" + "00000101010101010101010101010101010101010101010000" + "00000111001110101010000000101010110100001000010000" + "10111000110001010101111111000001001011110111100101" + }, + /* 31*/ { BARCODE_RSS14STACK_OMNI, -1, "04072912296211", 5, 50, "Example with finder values 7 & 8, same as BWIPP, verified manually against tec-it and IDAutomation", + "01001001000000010101111100000001011111000100101010" + "00000110111111101010000010101010100000111011010000" + "00000101010101010101010101010101010101010101010000" + "00001110100010111010000000001010111010000111010000" + "10110001011101000101111111110001000101111000101101" + }, + /* 32*/ { BARCODE_RSS14STACK_OMNI, -1, "06666666666666", 5, 50, "Example with finder values 6 & 4, same as BWIPP, verified manually against tec-it and IDAutomation", + "01000100010010000100111000000001011110111100101010" + "00001011101101111010000101010100100001000011010000" + "00000101010101010101010101010101010101010101010000" + "00000100011111001010000101010100101001100001110000" + "10101011100000110101111000000011010110011110000101" + }, + /* 33*/ { BARCODE_RSS_EXPSTACK, -1, "[90]12345678901234567", 5, 102, "Example with 7 chars, 1 full row, bottom 3 chars", + "010010100001111000101111111100001010000010001110110100111110001011101011111100001110001111010011000101" + "000001011110000111010000000010100101111101110001001011000001110100010100000010100001110000101100110000" + "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "000000100000000101111110110001101011110001110011010100101000000101000010010111000000000000000000000000" + "101110011111111010000001001110010100001110001100101010000111111000111101101000111101000000000000000000" + }, + /* 34*/ { BARCODE_RSS_EXPSTACK, -1, "[90]123456789012345678901234567", 9, 102, "Example with 10 chars, 2 full rows, bottom 2 chars", + "010000111100100010101111111100001010001000100000110100111110001011101011111000000110001111010011000101" + "000011000011011101010000000010100101110111011111001011000001110100010100000101010001110000101100110000" + "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "000010111011100011100001000000001011101111100011010111100011100110101001010000001010000100101110000000" + "101001000100011100011100111111110100010000011100101000011100011001010100001111110001111011010001111010" + "000010111011100011100001000000001011101111100011010111100011100110101001010000001010000100101110000000" + "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "000010000110110001010100001010100100000111010011000000000000000000000000000000000000000000000000000000" + "010001111001001110100011110000001011111000101100100100000000000000000000000000000000000000000000000000" + }, + /* 35*/ { BARCODE_RSS_EXPSTACK, -1, "[90]123456789012345678901234567890", 9, 102, "Example with 11 chars, 2 full rows, bottom 3 chars", + "010111011100010001101111111100001010000010001110110100111110001011101011111000000110001111010011000101" + "000000100011101110010000000010100101111101110001001011000001110100010100000101010001110000101100110000" + "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "000010111011100011100001000000001011101111100011010111100011100110101001010000001010000100101110000000" + "101001000100011100011100111111110100010000011100101000011100011001010100001111110001111011010001111010" + "000010111011100011100001000000001011101111100011010111100011100110101001010000001010000100101110000000" + "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "000010000110110001010100101010100100111000100011011011000110001101110100000000010000000000000000000000" + "010001111001001110100011000000001011000111011100100100111001110010001011111111100110100000000000000000" + }, + /* 36*/ { BARCODE_RSS_EXPSTACK, -1, "[91]1234567890123456789012345678901234", 9, 102, "Example with 12 chars, 3 full rows", + "010100010011111001101111111100001011001000010000010100111110001011101011111000000110001111010011000101" + "000011101100000110010000000010100100110111101111101011000001110100010100000101010001110000101100110000" + "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "000010111011100011100001000000001011101111100011010111100011100110101001010000001010000100101110000000" + "101001000100011100011100111111110100010000011100101000011100011001010100001111110001111011010001111010" + "000010111011100011100001000000001011101111100011010111100011100110101001010000001010000100101110000000" + "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "000010000110110001010100101010100100111000100011011011000110001110110100000000010001101110100001000000" + "010001111001001110100011000000001011000111011100100100111001110001001011111111100110010001011110111101" + }, + /* 37*/ { BARCODE_RSS_EXPSTACK, -1, "[91]123456789012345678901234567890123456789012", 13, 102, "Example with 15 chars, 3 full rows, bottom 7 chars", + "010010000111101011101111111100001011100000101100010100111110001011101011110000000010001111010011000101" + "000001111000010100010000000010100100011111010011101011000001110100010100001010101001110000101100110000" + "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "000010111011100011100001010100001011101111100011010111100011100110101001010000001010000100101110000000" + "101001000100011100011100000011110100010000011100101000011100011001010100001111110001111011010001111010" + "000010111011100011100001010100001011101111100011010111100011100110101001010000001010000100101110000000" + "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "000010000110110001010100001010100100111000100011011011000110001110110100000010100001011110100001000000" + "010001111001001110100011110000001011000111011100100100111001110001001011111100001110100001011110111101" + "000010000110110001010100001010100100111000100011011011000110001110110100000010100001011110100001000000" + "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "000000100000000101001001111101100011000010000110010100101010100101011111011100100000000000000000000000" + "101110011111111010110110000010011100111101111001101010000000011000100000100011011101000000000000000000" + }, + /* 38*/ { BARCODE_RSS_EXPSTACK, 3, "[91]123456789012345678901234567890123456789012", 9, 151, "Example with 15 chars, 2 full rows, bottom 3 chars", + "0100100001111010111011111111000010111000001011000101001111100010111010111100000000100011110100110001011110001011011110001111110000101010011000111000010" + "0000011110000101000100000000101001000111110100111010110000011101000101000010101010011100001011001110100001110100100001010000001010010101100111000110000" + "0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" + "0000011000111110111010000101010000111000111011101101110000110110001010100001010100100111000100011011011000110001110110100000010100001011110100001000000" + "1010100111000001000101111000000111000111000100010010001111001001110100011110000001011000111011100100100111001110001001011111100001110100001011110111101" + "0000011000111110111010000101010000111000111011101101110000110110001010100001010100100111000100011011011000110001110110100000010100001011110100001000000" + "0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" + "0000001001110111110101001010101001010011000010000110001101111100100101000000001000000000000000000000000000000000000000000000000000000000000000000000000" + "0101110110001000001000110000000010101100111101111001110010000011011010111111110011101000000000000000000000000000000000000000000000000000000000000000000" + }, + /* 39*/ { BARCODE_RSS_EXPSTACK, -1, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", 17, 102, "Example with 19 chars, 4 full rows, bottom 3 chars", + "010101111100011101101111111100001011100000101100010101111110011110101011110000000010111000111110010101" + "000010000011100010010000000010100100011111010011101010000001100001010100001010101001000111000001100000" + "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "000011110000110101100001010100001011001011000011110100001001101111001001010000001010100011100111100000" + "101100001111001010011100000011110100110100111100001011110110010000110100001111110001011100011000010010" + "000011110000110101100001010100001011001011000011110100001001101111001001010000001010100011100111100000" + "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "000001000010000111010100001010100101000010000111001011010111011111110100000010100001100011000010010000" + "010110111101111000100011110000001010111101111000110100101000100000001011111100001110011100111101100101" + "000001000010000111010100001010100101000010000111001011010111011111110100000010100001100011000010010000" + "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "000010000110111011100010101000001011000011110110100101001111000011001001010101001010011111001010010000" + "101101111001000100011000000111110100111100001001011010110000111100110100000000110001100000110101100010" + "000010000110111011100010101000001011000011110110100101001111000011001001010101001010011111001010010000" + "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "000010011111000111010001010101010101000111001111011011110100110000110100000000010000000000000000000000" + "010101100000111000100110000000001010111000110000100100001011001111001011111111100110100000000000000000" + }, + /* 40*/ { BARCODE_RSS_EXPSTACK, -1, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 21, 102, "Example with 22 chars, 5 full rows, bottom 2 chars", + "010101011110111111101111111100001011001000000101000100111110001011101011110000000010001111010011000101" + "000010100001000000010000000010100100110111111010111011000001110100010100001010101001110000101100110000" + "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "000010111011100011100001010100001011101111100011010111100011100110101001010000001010000100101110000000" + "101001000100011100011100000011110100010000011100101000011100011001010100001111110001111011010001111010" + "000010111011100011100001010100001011101111100011010111100011100110101001010000001010000100101110000000" + "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "000010000110110001010100001010100100111000100011011011000110001110110100000000100001011110100001000000" + "010001111001001110100011110000001011000111011100100100111001110001001011111111001110100001011110111101" + "000010000110110001010100001010100100111000100011011011000110001110110100000000100001011110100001000000" + "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "000010110011000001100010101000001011101111010001000110000100001100101001010101001010111110111001000000" + "101101001100111110011000000111110100010000101110111001111011110011010100000000110001000001000110111010" + "000010110011000001100010101000001011101111010001000110000100001100101001010101001010111110111001000000" + "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "000000110001100010010000000101010100000111100110101011011100010001110100000000010001011111010001100000" + "010111001110011101100111111000001011111000011001010100100011101110001011111111100110100000101110011101" + "000000110001100010010000000101010100000111100110101011011100010001110100000000010001011111010001100000" + "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "000001000111010000101000101010101010100001011000110000000000000000000000000000000000000000000000000000" + "001000111000101111010011000000000101011110100111000010000000000000000000000000000000000000000000000000" + }, + /* 41*/ { BARCODE_RSS_EXPSTACK, 3, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 13, 151, "Example with 22 chars, 3 full rows, bottom 4 chars", + "0101010111101111111011111111000010110010000001010001001111100010111010111100000000100011110100110001011110001011011110001111110000101010011000111000010" + "0000101000010000000100000000101001001101111110101110110000011101000101000010101010011100001011001110100001110100100001010000001010010101100111000110000" + "0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" + "0000011000111110111010000101010000111000111011101101110000110110001010100001010100100111000100011011011000110001110110100000000100001011110100001000000" + "1010100111000001000101111000000111000111000100010010001111001001110100011110000001011000111011100100100111001110001001011111111001110100001011110111101" + "0000011000111110111010000101010000111000111011101101110000110110001010100001010100100111000100011011011000110001110110100000000100001011110100001000000" + "0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" + "0000001001110111110101001010101001010011000010000110001000101111011101000001010100011000001100110100100011000110001001000000010101010000011110011010000" + "0101110110001000001000110000000010101100111101111001110111010000100010111110000001100111110011001011011100111001110110011111100000101111100001100101010" + "0000001001110111110101001010101001010011000010000110001000101111011101000001010100011000001100110100100011000110001001000000010101010000011110011010000" + "0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" + "0000101110001000111010000000001000101111101000110001110001110100001010001010101010101000010110001100000000000000000000000000000000000000000000000000000" + "1010010001110111000101111111110011010000010111001110001110001011110100110000000001010111101001110000100000000000000000000000000000000000000000000000000" + }, + /* 42*/ { BARCODE_RSS_EXPSTACK, 4, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 9, 200, "Example with 22 chars, 2 full rows, bottom 6 chars", + "01010101111011111110111111110000101100100000010100010011111000101110101111000000001000111101001100010111100010110111100011111100001010100110001110000101001110000010001011110000001110001110001000100101" + "00001010000100000001000000001010010011011111101011101100000111010001010000101010100111000010110011101000011101001000010100000010100101011001110001111010110001111101110100001010100001110001110111010000" + "00000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "00001011001100000110001010100000101110111101000100011000010000110010100101010100101011111011100100010000100001011110100001000000001011011100011000110110110001000111001001010100001010100011011000010000" + "10110100110011111001100000011111010001000010111011100111101111001101010000000011000100000100011011101111011110100001011100111111110100100011100111001001001110111000110100000011110001011100100111100010" + "00001011001100000110001010100000101110111101000100011000010000110010100101010100101011111011100100010000100001011110100001000000001011011100011000110110110001000111001001010100001010100011011000010000" + "00000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "00000011000110001001000000010101010000011110011010101101110001000111010000000001000101111101000110001110001110100001010001010101010101000010110001100000000000000000000000000000000000000000000000000000" + "01011100111001110110011111100000101111100001100101010010001110111000101111111110011010000010111001110001110001011110100110000000001010111101001110000100000000000000000000000000000000000000000000000000" + }, + /* 43*/ { BARCODE_RSS_EXPSTACK, 5, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 9, 249, "Example with 22 chars, 2 full rows, bottom 2 chars", + "010101011110111111101111111100001011001000000101000100111110001011101011110000000010001111010011000101111000101101111000111111000010101001100011100001010011100000100010111100000011100011100010001001000111100100111010001111000000101100011101110010010" + "000010100001000000010000000010100100110111111010111011000001110100010100001010101001110000101100111010000111010010000101000000101001010110011100011110101100011111011101000010101000011100011101110110111000011011000101010000101010010011100010001100000" + "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" + "000010001100011101101000000001000010111101000010000100010011101111101010010101010010100110000100001100010001011110111010000010101000110000011001101001000110001100010010000000101010100000111100110101011011100010001110100000000010001011111010001100000" + "101001110011100010010111111110011101000010111101111011101100010000010001100000000101011001111011110011101110100001000101111100000011001111100110010110111001110011101100111111000001011111000011001010100100011101110001011111111100110100000101110011101" + "000010001100011101101000000001000010111101000010000100010011101111101010010101010010100110000100001100010001011110111010000010101000110000011001101001000110001100010010000000101010100000111100110101011011100010001110100000000010001011111010001100000" + "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" + "000010001110100001010001010101010101000010110001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "010001110001011110100110000000001010111101001110000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + /* 44*/ { BARCODE_RSS_EXPSTACK, 6, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 5, 298, "Example with 22 chars, 1 full row, bottom 10 chars", + "0101010111101111111011111111000010110010000001010001001111100010111010111100000000100011110100110001011110001011011110001111110000101010011000111000010100111000001000101111000000111000111000100010010001111001001110100011110000001011000111011100100100111001110001001011111111001110100001011110111101" + "0000101000010000000100000000101001001101111110101110110000011101000101000010101010011100001011001110100001110100100001010000001010010101100111000111101011000111110111010000101010000111000111011101101110000110110001010100001010100100111000100011011011000110001110110100000000100001011110100001000000" + "0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "0000000100111011111010100101010100101001100001000011000100010111101110100000101010001100000110011010010001100011000100100000001010101000001111001101010110111000100011101000000000100010111110100011000111000111010000101000101010101010100001011000110000000000000000000000000000000000000000000000000000" + "0010111011000100000100011000000001010110011110111100111011101000010001011111000000110011111001100101101110011100111011001111110000010111110000110010101001000111011100010111111111001101000001011100111000111000101111010011000000000101011110100111000010000000000000000000000000000000000000000000000000" + }, + /* 45*/ { BARCODE_RSS_EXPSTACK, 7, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 5, 347, "Example with 22 chars, 1 full row, bottom 8 chars", + "01010101111011111110111111110000101100100000010100010011111000101110101111000000001000111101001100010111100010110111100011111100001010100110001110000101001110000010001011110000001110001110001000100100011110010011101000111100000010110001110111001001001110011100010010111111110011101000010111101111011101100010000010001100000000101011001111011110010" + "00001010000100000001000000001010010011011111101011101100000111010001010000101010100111000010110011101000011101001000010100000010100101011001110001111010110001111101110100001010100001110001110111011011100001101100010101000010101001001110001000110110110001100011101101000000001000010111101000010000100010011101111101010010101010010100110000100000000" + "00000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" + "00000100010111101110100000101010001100000110011010010001100011000100100000001010101000001111001101010110111000100011101000000000100010111110100011000111000111010000101000101010101010100001011000110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "10111011101000010001011111000000110011111001100101101110011100111011001111110000010111110000110010101001000111011100010111111111001101000001011100111000111000101111010011000000000101011110100111000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + /* 46*/ { BARCODE_RSS_EXPSTACK, 8, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 5, 396, "Example with 22 chars, 1 full row, bottom 6 chars", + "010101011110111111101111111100001011001000000101000100111110001011101011110000000010001111010011000101111000101101111000111111000010101001100011100001010011100000100010111100000011100011100010001001000111100100111010001111000000101100011101110010010011100111000100101111111100111010000101111011110111011000100000100011000000001010110011110111100111011101000010001011111000000110011111001100101101" + "000010100001000000010000000010100100110111111010111011000001110100010100001010101001110000101100111010000111010010000101000000101001010110011100011110101100011111011101000010101000011100011101110110111000011011000101010000101010010011100010001101101100011000111011010000000010000101111010000100001000100111011111010100101010100101001100001000011000100010111101110100000101010001100000110011010000" + "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "000000011000110001001000000010101010000011110011010101101110001000111010000000001000101111101000110001110001110100001010001010101010101000010110001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "001011100111001110110011111100000101111100001100101010010001110111000101111111110011010000010111001110001110001011110100110000000001010111101001110000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + /* 47*/ { BARCODE_RSS_EXPSTACK, 9, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 5, 445, "Example with 22 chars, 1 full row, bottom 4 chars", + "0101010111101111111011111111000010110010000001010001001111100010111010111100000000100011110100110001011110001011011110001111110000101010011000111000010100111000001000101111000000111000111000100010010001111001001110100011110000001011000111011100100100111001110001001011111111001110100001011110111101110110001000001000110000000010101100111101111001110111010000100010111110000001100111110011001011011100111001110110011111100000101111100001100101010" + "0000101000010000000100000000101001001101111110101110110000011101000101000010101010011100001011001110100001110100100001010000001010010101100111000111101011000111110111010000101010000111000111011101101110000110110001010100001010100100111000100011011011000110001110110100000000100001011110100001000010001001110111110101001010101001010011000010000110001000101111011101000001010100011000001100110100100011000110001001000000010101010000011110011010000" + "0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" + "0000101110001000111010000000001000101111101000110001110001110100001010001010101010101000010110001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "1010010001110111000101111111110011010000010111001110001110001011110100110000000001010111101001110000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + /* 48*/ { BARCODE_RSS_EXPSTACK, 10, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 5, 494, "Example with 22 chars, 1 full row, bottom 2 chars", + "01010101111011111110111111110000101100100000010100010011111000101110101111000000001000111101001100010111100010110111100011111100001010100110001110000101001110000010001011110000001110001110001000100100011110010011101000111100000010110001110111001001001110011100010010111111110011101000010111101111011101100010000010001100000000101011001111011110011101110100001000101111100000011001111100110010110111001110011101100111111000001011111000011001010100100011101110001011111111100110100000101110011101" + "00001010000100000001000000001010010011011111101011101100000111010001010000101010100111000010110011101000011101001000010100000010100101011001110001111010110001111101110100001010100001110001110111011011100001101100010101000010101001001110001000110110110001100011101101000000001000010111101000010000100010011101111101010010101010010100110000100001100010001011110111010000010101000110000011001101001000110001100010010000000101010100000111100110101011011100010001110100000000010001011111010001100000" + "00000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "00000100011101000010100010101010101010000101100011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00100011100010111101001100000000010101111010011100001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + /* 49*/ { BARCODE_RSS_EXPSTACK, 11, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 1, 543, "Example with 22 chars, 1 row", + "010101011110111111101111111100001011001000000101000100111110001011101011110000000010001111010011000101111000101101111000111111000010101001100011100001010011100000100010111100000011100011100010001001000111100100111010001111000000101100011101110010010011100111000100101111111100111010000101111011110111011000100000100011000000001010110011110111100111011101000010001011111000000110011111001100101101110011100111011001111110000010111110000110010101001000111011100010111111111001101000001011100111000111000101111010011000000000101011110100111000010" + }, + /* 50*/ { BARCODE_RSS_EXPSTACK, 1, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 41, 53, "Example with 22 chars, 11 rows", + "01010101111011111110111111110000101100100000010100010" + "00001010000100000001000000001010010011011111101010000" + "00000101010101010101010101010101010101010101010100000" + "00001000001110100010100001010101001110000101100110000" + "10100111110001011101011110000000010001111010011000101" + "00001000001110100010100001010101001110000101100110000" + "00000101010101010101010101010101010101010101010100000" + "00000001110100100001010000001010010101100111000110000" + "01011110001011011110001111110000101010011000111000010" + "00000001110100100001010000001010010101100111000110000" + "00000101010101010101010101010101010101010101010100000" + "00000110001111101110100001010100001110001110111010000" + "10101001110000010001011110000001110001110001000100101" + "00000110001111101110100001010100001110001110111010000" + "00000101010101010101010101010101010101010101010100000" + "00001000011011000101010000101010010011100010001100000" + "01000111100100111010001111000000101100011101110010010" + "00001000011011000101010000101010010011100010001100000" + "00000101010101010101010101010101010101010101010100000" + "00001000110001110110100000000100001011110100001000000" + "10100111001110001001011111111001110100001011110111101" + "00001000110001110110100000000100001011110100001000000" + "00000101010101010101010101010101010101010101010100000" + "00000010011101111101010010101010010100110000100000000" + "01011101100010000010001100000000101011001111011110010" + "00000010011101111101010010101010010100110000100000000" + "00000101010101010101010101010101010101010101010100000" + "00000100010111101110100000101010001100000110011010000" + "10111011101000010001011111000000110011111001100101101" + "00000100010111101110100000101010001100000110011010000" + "00000101010101010101010101010101010101010101010100000" + "00000011000110001001000000010101010000011110011010000" + "01011100111001110110011111100000101111100001100101010" + "00000011000110001001000000010101010000011110011010000" + "00000101010101010101010101010101010101010101010100000" + "00001011100010001110100000000010001011111010001100000" + "10100100011101110001011111111100110100000101110011101" + "00001011100010001110100000000010001011111010001100000" + "00000101010101010101010101010101010101010101010100000" + "00001000111010000101000101010101010100001011000110000" + "01000111000101111010011000000000101011110100111000010" + }, }; int data_size = sizeof(data) / sizeof(struct item); + char bwipp_buf[4096]; + char bwipp_msg[1024]; + int pix; + for (int i = 0; i < data_size; i++) { if (index != -1 && i != index) continue; + if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d\n", i); struct zint_symbol *symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); - assert_equal(ret, data[i].ret, "i:%d ret %d != %d %s\n", i, ret, data[i].ret, symbol->errtxt); + ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].data, length); + assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 (%s)\n", i, ret, symbol->errtxt); if (generate) { - if (ret == 0) { - printf(" /*%2d*/ { %s, %d, \"%s\", %d, %d, %d, \"%s\",\n", - i, testUtilBarcodeName(symbol->symbology), data[i].option_2, data[i].data, ret, symbol->rows, symbol->width, data[i].comment); - testUtilModulesDump(symbol, " ", "\n"); - printf(" },\n"); - } else { - printf(" /*%2d*/ { %s, \"%s\", %s, %d, %d, \"%s\", \"\" },\n", - i, testUtilBarcodeName(symbol->symbology), data[i].data, testUtilErrorName(ret), symbol->rows, symbol->width, data[i].comment); - } + printf(" /*%3d*/ { %s, %d, \"%s\", %d, %d, %d, \"%s\",\n", + i, testUtilBarcodeName(symbol->symbology), data[i].option_2, data[i].data, ret, symbol->rows, symbol->width, data[i].comment); + testUtilModulesDump(symbol, " ", "\n"); + printf(" },\n"); } else { assert_equal(symbol->rows, data[i].expected_rows, "i:%d %s symbol->rows %d != %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), symbol->rows, data[i].expected_rows, data[i].data); assert_equal(symbol->width, data[i].expected_width, "i:%d %s symbol->width %d != %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), symbol->width, data[i].expected_width, data[i].data); - if (ret == 0) { - int width, row; - ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row); - assert_zero(ret, "i:%d %s testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, width, row, data[i].data); + int width, row; + ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row); + assert_zero(ret, "i:%d %s testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, width, row, data[i].data); + + if (do_bwipp && testUtilCanBwipp(symbol->symbology, -1, data[i].option_2, -1, debug)) { + ret = testUtilBwipp(symbol, -1, data[i].option_2, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf)); + assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), ret); + + ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected); + assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", + i, testUtilBarcodeName(data[i].symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); } } @@ -331,154 +646,153 @@ static void test_general_field(int index, int generate, int debug) { int ret; struct item { int symbology; - unsigned char *data; - int ret; + char *data; int expected_rows; int expected_width; char *comment; - unsigned char *expected; + char *expected; }; - // Verified manually against bwipp and tec-it.com (bottom separator differs from tec-it.com where noted) + // Verified via bwipp_dump.ps against BWIPP and manually against tec-it.com (some separators differ from tec-it.com where noted) struct item data[] = { - /* 0*/ { BARCODE_RSS_EXP, "[91]1", 0, 1, 102, "Single numeric", + /* 0*/ { BARCODE_RSS_EXP, "[91]1", 1, 102, "Single numeric", "010100000001000101101111111100001011001000010000010110111110101100001011110000000010101111100001011101" }, - /* 1*/ { BARCODE_RSS_EXP, "[91]12", 0, 1, 102, "2 numerics", + /* 1*/ { BARCODE_RSS_EXP, "[91]12", 1, 102, "2 numerics", "010010000010000101101111111100001011001000010000010101111100101110001011110000000010101111100001011101" }, - /* 2*/ { BARCODE_RSS_EXP, "[91]123", 0, 1, 102, "Odd-numbered numeric", + /* 2*/ { BARCODE_RSS_EXP, "[91]123", 1, 102, "Odd-numbered numeric", "010100000110000100101111111100001011001000010000010100011111010111001011110000000010000011000110100101" }, - /* 3*/ { BARCODE_RSS_EXP, "[91]1234", 0, 1, 102, "Even-numbered numeric", + /* 3*/ { BARCODE_RSS_EXP, "[91]1234", 1, 102, "Even-numbered numeric", "010110010000001000101111111100001011001000010000010100111110001011101011110000000010001101111001011101" }, - /* 4*/ { BARCODE_RSS_EXP, "[91]A1234567C", 0, 1, 183, "Alphanumeric followed by 7 digits and alphanumeric", + /* 4*/ { BARCODE_RSS_EXP, "[91]A1234567C", 1, 183, "Alphanumeric followed by 7 digits and alphanumeric", "010100000111001001101111111100001011000001000101110101111110111101001011111100001110100110111110111100001111010110011000111111000010110001000001101101110111101111010010111111110011101" }, - /* 5*/ { BARCODE_RSS_EXP, "[91]A123456C", 0, 1, 151, "Alphanumeric followed by 6 digits and alphanumeric", + /* 5*/ { BARCODE_RSS_EXP, "[91]A123456C", 1, 151, "Alphanumeric followed by 6 digits and alphanumeric", "0101100111001000001011111111000010110010000100000101011111101111010010111100000011101001101111101111000011110101100110001111110000101000100011000111010" }, - /* 6*/ { BARCODE_RSS_EXP, "[91]A12345B", 0, 1, 151, "Alphanumeric followed by 5 digits and alphanumeric", + /* 6*/ { BARCODE_RSS_EXP, "[91]A12345B", 1, 151, "Alphanumeric followed by 5 digits and alphanumeric", "0101111001000001001011111111000010110010000100000101011111101111010010111100000011100000010111001001010000111101000010001111110000101100000001001010010" }, - /* 7*/ { BARCODE_RSS_EXP, "[91]A1234567", 0, 1, 151, "Alphanumeric followed by 7 digits, terminating", + /* 7*/ { BARCODE_RSS_EXP, "[91]A1234567", 1, 151, "Alphanumeric followed by 7 digits, terminating", "0101100100011100001011111111000010110010000100000101011111101111010010111100000011101001101111101111000011110110100110001111110000101101011110111100010" }, - /* 8*/ { BARCODE_RSS_EXP, "[91]A123456", 0, 1, 134, "Alphanumeric followed by 6 digits, terminating", + /* 8*/ { BARCODE_RSS_EXP, "[91]A123456", 1, 134, "Alphanumeric followed by 6 digits, terminating", "01000101001100000010111111110000101100000100010111010111111011110100101111000000111010011011111011110000111101011001100011111100001010" }, - /* 9*/ { BARCODE_RSS_EXP, "[91]A12345", 0, 1, 134, "Alphanumeric followed by 5 digits, terminating", + /* 9*/ { BARCODE_RSS_EXP, "[91]A12345", 1, 134, "Alphanumeric followed by 5 digits, terminating", "01000110010100000010111111110000101100000100010111010111111011110100101111000000111010011011111011110000101100111110100011111100001010" }, - /*10*/ { BARCODE_RSS_EXP, "[91]A1234", 0, 1, 134, "Alphanumeric followed by 4 digits, terminating", + /*10*/ { BARCODE_RSS_EXP, "[91]A1234", 1, 134, "Alphanumeric followed by 4 digits, terminating", "01011101000010000110111111110000101100000100010111010111111011110100101111000000111010011011111011110001101111100100100011111100001010" }, - /*11*/ { BARCODE_RSS_EXP, "[91]A123", 0, 1, 134, "Alphanumeric followed by 3 digits, terminating", + /*11*/ { BARCODE_RSS_EXP, "[91]A123", 1, 134, "Alphanumeric followed by 3 digits, terminating", "01000010110010000010111111110000101100000100010111010111111011110100101111000000111000000101110010010001000010000101100011111100001010" }, - /*12*/ { BARCODE_RSS_EXP, "[91]a1234ABCDEFGb", 0, 1, 249, "ISO-646 followed by 11 non-ISO-646 non-terminating, starting 4 digits", + /*12*/ { BARCODE_RSS_EXP, "[91]a1234ABCDEFGb", 1, 249, "ISO-646 followed by 11 non-ISO-646 non-terminating, starting 4 digits", "010000100011100110101111111100001011001000010000010101101111110011101011111000000110000110110100011100001110000101011000111111000010100111000010110001000000100110110010111111110011101000001110010001010011011111100110001111000000101110111010011000010" }, - /*13*/ { BARCODE_RSS_EXP, "[91]a1234ABCDEFb", 0, 1, 249, "ISO-646 followed by 10 non-ISO-646 non-terminating, starting 4 digits", + /*13*/ { BARCODE_RSS_EXP, "[91]a1234ABCDEFb", 1, 249, "ISO-646 followed by 10 non-ISO-646 non-terminating, starting 4 digits", "010111010001110001101111111100001011001000010000010101101111110011101011111000000110000110110100011100001110000101011000111111000010100111000010110001000000100110110010111111110011101000001110010001001100011011100110001111000000101101000111001110010" }, - /*14*/ { BARCODE_RSS_EXP, "[91]a1234ABCDEF", 0, 1, 232, "ISO-646 followed by 10 non-ISO-646 terminating, starting 4 digits", + /*14*/ { BARCODE_RSS_EXP, "[91]a1234ABCDEF", 1, 232, "ISO-646 followed by 10 non-ISO-646 terminating, starting 4 digits", "0100001011010000111011111111000010110000010001011101011011111100111010111110000001100001101101000111000011100001010110001111110000101001110000101100010000001001101100101111111100111010000011100100010011100111000101100011110000001010" }, - /*15*/ { BARCODE_RSS_EXP, "[91]a1234ABCDEb", 0, 1, 232, "ISO-646 followed by 9 non-ISO-646 non-terminating, starting 4 digits", + /*15*/ { BARCODE_RSS_EXP, "[91]a1234ABCDEb", 1, 232, "ISO-646 followed by 9 non-ISO-646 non-terminating, starting 4 digits", "0100001011011000011011111111000010110000010001011101011011111100111010111110000001100100011100100111011110010111110010001111110000101111100011001010010110001000011110101111111100111011100101111000110111001000011110100011110000001010" }, - /*16*/ { BARCODE_RSS_EXP, "[91]a1234ABCDE", 0, 1, 200, "ISO-646 followed by 9 non-ISO-646 terminating, starting 4 digits", + /*16*/ { BARCODE_RSS_EXP, "[91]a1234ABCDE", 1, 200, "ISO-646 followed by 9 non-ISO-646 terminating, starting 4 digits", "01001000011000111010111111110000101100100001000001010110111111001110101111110000111000011011010001110000111000010101100011111100001010011100001011000100000010011011001011111111001110010011100000100101" }, - /*17*/ { BARCODE_RSS_EXP, "[91]aABCDEF12345b", 0, 1, 249, "ISO-646 followed by 11 non-ISO-646 non-terminating, starting 6 letters", + /*17*/ { BARCODE_RSS_EXP, "[91]aABCDEF12345b", 1, 249, "ISO-646 followed by 11 non-ISO-646 non-terminating, starting 6 letters", "010000100010100111101111111100001011001000010000010101101111110011101011111000000110100001110001011100010000010100011000111111000010111101000100100001100111010000110010111111110011101000001110011011000100000110101110001111000000101011110010001110010" }, - /*18*/ { BARCODE_RSS_EXP, "[91]aABCDEF1234b", 0, 1, 249, "ISO-646 followed by 10 non-ISO-646 non-terminating, starting 6 letters", + /*18*/ { BARCODE_RSS_EXP, "[91]aABCDEF1234b", 1, 249, "ISO-646 followed by 10 non-ISO-646 non-terminating, starting 6 letters", "010110111100110000101111111100001011001000010000010101101111110011101011111000000110100001110001011100010000010100011000111111000010111101000100100001100111010000110010111111110011101000001110011011000100001001110110001111000000101111110110110001010" }, - /*19*/ { BARCODE_RSS_EXP, "[91]aABCDE12345b", 0, 1, 249, "ISO-646 followed by 10 non-ISO-646 non-terminating, starting 5 letters", + /*19*/ { BARCODE_RSS_EXP, "[91]aABCDE12345b", 1, 249, "ISO-646 followed by 10 non-ISO-646 non-terminating, starting 5 letters", "010000100010011011101111111100001011001000010000010101101111110011101011111000000110100001110001011100010000010100011000111111000010111101000100100001100100001110011010111111110011100110110010000111000101111000101110001111000000101111011001101000010" }, - /*20*/ { BARCODE_RSS_EXP, "[91]aABCDE1234", 0, 1, 200, "ISO-646 followed by 10 non-ISO-646 terminating, starting 5 letters", + /*20*/ { BARCODE_RSS_EXP, "[91]aABCDE1234", 1, 200, "ISO-646 followed by 10 non-ISO-646 terminating, starting 5 letters", "01000101100011100010111111110000101100100001000001010110111111001110101111110000111010000111000101110001000001010001100011111100001011110100010010000110000100101111001011111111001110010010001110011101" }, - /*21*/ { BARCODE_RSS_EXP, "[91]aABCDE1234b", 0, 1, 232, "ISO-646 followed by 9 non-ISO-646 non-terminating, starting 5 letters", + /*21*/ { BARCODE_RSS_EXP, "[91]aABCDE1234b", 1, 232, "ISO-646 followed by 9 non-ISO-646 non-terminating, starting 5 letters", "0100010000110011011011111111000010110000010001011101011011111100111010111110000001100001000110110111010000010110000010001111110000101000011101001100011001000011100110101111111100111011001100100001110111001000011110100011110000001010" }, - /*22*/ { BARCODE_RSS_EXP, "[91]aABCDE1234", 0, 1, 200, "ISO-646 followed by 9 non-ISO-646 terminating, starting 5 letters", + /*22*/ { BARCODE_RSS_EXP, "[91]aABCDE1234", 1, 200, "ISO-646 followed by 9 non-ISO-646 terminating, starting 5 letters", "01000101100011100010111111110000101100100001000001010110111111001110101111110000111010000111000101110001000001010001100011111100001011110100010010000110000100101111001011111111001110010010001110011101" }, - /*23*/ { BARCODE_RSS_EXPSTACK, "[91]1", 0, 1, 102, "Single numeric", + /*23*/ { BARCODE_RSS_EXPSTACK, "[91]1", 1, 102, "Single numeric", "010100000001000101101111111100001011001000010000010110111110101100001011110000000010101111100001011101" }, - /*24*/ { BARCODE_RSS_EXPSTACK, "[91]12", 0, 1, 102, "2 numerics", + /*24*/ { BARCODE_RSS_EXPSTACK, "[91]12", 1, 102, "2 numerics", "010010000010000101101111111100001011001000010000010101111100101110001011110000000010101111100001011101" }, - /*25*/ { BARCODE_RSS_EXPSTACK, "[91]123", 0, 1, 102, "Odd-numbered numeric", + /*25*/ { BARCODE_RSS_EXPSTACK, "[91]123", 1, 102, "Odd-numbered numeric", "010100000110000100101111111100001011001000010000010100011111010111001011110000000010000011000110100101" }, - /*26*/ { BARCODE_RSS_EXPSTACK, "[91]1234", 0, 1, 102, "Even-numbered numeric", + /*26*/ { BARCODE_RSS_EXPSTACK, "[91]1234", 1, 102, "Even-numbered numeric", "010110010000001000101111111100001011001000010000010100111110001011101011110000000010001101111001011101" }, - /*27*/ { BARCODE_RSS_EXPSTACK, "[91]A1234567C", 0, 5, 102, "Alphanumeric followed by 7 digits and alphanumeric", + /*27*/ { BARCODE_RSS_EXPSTACK, "[91]A1234567C", 5, 102, "Alphanumeric followed by 7 digits and alphanumeric **NOTE** bottom separator differs from tec-it, same as BWIPP", "010100000111001001101111111100001011000001000101110101111110111101001011111100001110100110111110111101" - "000011111000110110010000000010100100111110111010001010000001000010100100000010100001011001000001000000" + "000011111000110110010000000010100100111110111010001010000001000010110100000010100001011001000001000000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" - "000000100000000101101000010000100010010011111011100100101000000011001100101000011000000000000000000000" + "000000100000000101101000010000100010010011111011100100101000000101001100101000011000000000000000000000" "101110011111111010010111101111011101101100000100011010000111111000110011010111100001000000000000000000" }, - /*28*/ { BARCODE_RSS_EXPSTACK, "[91]A123456C", 0, 5, 102, "Alphanumeric followed by 6 digits and alphanumeric", + /*28*/ { BARCODE_RSS_EXPSTACK, "[91]A123456C", 5, 102, "Alphanumeric followed by 6 digits and alphanumeric **NOTE** bottom separator differs from tec-it, same as BWIPP", "010110011100100000101111111100001011001000010000010101111110111101001011110000001110100110111110111101" - "000001100011011111010000000010100100110111101111101010000001000010100100001010100001011001000001000000" + "000001100011011111010000000010100100110111101111101010000001000010110100001010100001011001000001000000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" "000001100001010011001010000001010010111011100111000000000000000000000000000000000000000000000000000000" "001000011110101100110001111110000101000100011000111010000000000000000000000000000000000000000000000000" }, - /*29*/ { BARCODE_RSS_EXPSTACK, "[91]A12345B", 0, 5, 102, "Alphanumeric followed by 5 digits and alphanumeric", + /*29*/ { BARCODE_RSS_EXPSTACK, "[91]A12345B", 5, 102, "Alphanumeric followed by 5 digits and alphanumeric **NOTE** ditto", "010111100100000100101111111100001011001000010000010101111110111101001011110000001110000001011100100101" - "000000011011111011010000000010100100110111101111101010000001000010100100001010100001111110100011010000" + "000000011011111011010000000010100100110111101111101010000001000010110100001010100001111110100011010000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" "000001111000010111101010000001010010011111110110100000000000000000000000000000000000000000000000000000" "001010000111101000010001111110000101100000001001010010000000000000000000000000000000000000000000000000" }, - /*30*/ { BARCODE_RSS_EXPSTACK, "[91]A1234567", 0, 5, 102, "Alphanumeric followed by 7 digits, terminating **NOTE** bottom separator differs from tec-it.com, same as bwipp", + /*30*/ { BARCODE_RSS_EXPSTACK, "[91]A1234567", 5, 102, "Alphanumeric followed by 7 digits, terminating **NOTE** ditto", "010110010001110000101111111100001011001000010000010101111110111101001011110000001110100110111110111101" - "000001101110001111010000000010100100110111101111101010000001000010100100001010100001011001000001000000" + "000001101110001111010000000010100100110111101111101010000001000010110100001010100001011001000001000000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" "000001100001001011001010000001010010010100001000010000000000000000000000000000000000000000000000000000" "001000011110110100110001111110000101101011110111100010000000000000000000000000000000000000000000000000" }, - /*31*/ { BARCODE_RSS_EXPSTACK, "[91]A123456", 0, 5, 102, "Alphanumeric followed by 6 digits, terminating **NOTE** ditto", + /*31*/ { BARCODE_RSS_EXPSTACK, "[91]A123456", 5, 102, "Alphanumeric followed by 6 digits, terminating **NOTE** ditto", "010100001100111000101111111100001011001000010000010101111110111101001011110000001110100110111110111101" - "000011110011000111010000000010100100110111101111101010000001000010100100001010100001011001000001000000" + "000011110011000111010000000010100100110111101111101010000001000010110100001010100001011001000001000000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" "000001100001010011001010000001010010011101011111110000000000000000000000000000000000000000000000000000" "001000011110101100110001111110000101100010100000001010000000000000000000000000000000000000000000000000" }, - /*32*/ { BARCODE_RSS_EXPSTACK, "[91]A12345", 0, 5, 102, "Alphanumeric followed by 5 digits, terminating **NOTE** ditto", + /*32*/ { BARCODE_RSS_EXPSTACK, "[91]A12345", 5, 102, "Alphanumeric followed by 5 digits, terminating **NOTE** ditto", "010100100011000011101111111100001011001000010000010101111110111101001011110000001110100110111110111101" - "000011011100111100010000000010100100110111101111101010000001000010100100001010100001011001000001000000" + "000011011100111100010000000010100100110111101111101010000001000010110100001010100001011001000001000000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" "000001101001100000101010000001010010011101011111110000000000000000000000000000000000000000000000000000" "001000010110011111010001111110000101100010100000001010000000000000000000000000000000000000000000000000" }, - /*33*/ { BARCODE_RSS_EXPSTACK, "[91]A1234", 0, 5, 102, "Alphanumeric followed by 4 digits, terminating **NOTE** ditto", + /*33*/ { BARCODE_RSS_EXPSTACK, "[91]A1234", 5, 102, "Alphanumeric followed by 4 digits, terminating **NOTE** ditto", "010111000010010001101111111100001011001000010000010101111110111101001011110000001110100110111110111101" - "000000111101101110010000000010100100110111101111101010000001000010100100001010100001011001000001000000" + "000000111101101110010000000010100100110111101111101010000001000010110100001010100001011001000001000000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" "000001001000001101101010000001010010000111011101110000000000000000000000000000000000000000000000000000" "001000110111110010010001111110000101111000100010001010000000000000000000000000000000000000000000000000" }, - /*34*/ { BARCODE_RSS_EXPSTACK, "[91]A123", 0, 5, 102, "Alphanumeric followed by 3 digits, terminating **NOTE** ditto", + /*34*/ { BARCODE_RSS_EXPSTACK, "[91]A123", 5, 102, "Alphanumeric followed by 3 digits, terminating **NOTE** ditto", "010110000100111000101111111100001011001000010000010101111110111101001011110000001110000001011100100101" - "000001111011000111010000000010100100110111101111101010000001000010100100001010100001111110100011010000" + "000001111011000111010000000010100100110111101111101010000001000010110100001010100001111110100011010000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" "000001011110111101001010000001010010101111100001010000000000000000000000000000000000000000000000000000" "001000100001000010110001111110000101010000011110100010000000000000000000000000000000000000000000000000" }, - /*35*/ { BARCODE_RSS_EXPSTACK, "[91]a1234ABCDEFGb", 0, 9, 102, "ISO-646 followed by 11 non-ISO-646 non-terminating, starting 4 digits **NOTE** ditto", + /*35*/ { BARCODE_RSS_EXPSTACK, "[91]a1234ABCDEFGb", 9, 102, "ISO-646 followed by 11 non-ISO-646 non-terminating, starting 4 digits **NOTE** separators differ from tec-it, same as BWIPP", "010000100011100110101111111100001011001000010000010101101111110011101011111000000110000110110100011101" "000011011100011001010000000010100100110111101111101010010000001100010100000101010001111001001011100000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" @@ -489,7 +803,7 @@ static void test_general_field(int index, int generate, int debug) { "000011001000000110010100001010100100010001011001100000000000000000000000000000000000000000000000000000" "010100110111111001100011110000001011101110100110000100000000000000000000000000000000000000000000000000" }, - /*36*/ { BARCODE_RSS_EXPSTACK, "[91]a1234ABCDEFb", 0, 9, 102, "ISO-646 followed by 10 non-ISO-646 non-terminating, starting 4 digits", + /*36*/ { BARCODE_RSS_EXPSTACK, "[91]a1234ABCDEFb", 9, 102, "ISO-646 followed by 10 non-ISO-646 non-terminating, starting 4 digits **NOTE** top separator differs from tec-it, same as BWIPP", "010111010001110001101111111100001011001000010000010101101111110011101011111000000110000110110100011101" "000000101110001110010000000010100100110111101111101010010000001100010100000101010001111001001011100000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" @@ -500,7 +814,7 @@ static void test_general_field(int index, int generate, int debug) { "000000111001000110010100001010100100101110001100000000000000000000000000000000000000000000000000000000" "010011000110111001100011110000001011010001110011100100000000000000000000000000000000000000000000000000" }, - /*37*/ { BARCODE_RSS_EXPSTACK, "[91]a1234ABCDEF", 0, 9, 102, "ISO-646 followed by 10 non-ISO-646 terminating, starting 4 digits **NOTE** ditto", + /*37*/ { BARCODE_RSS_EXPSTACK, "[91]a1234ABCDEF", 9, 102, "ISO-646 followed by 10 non-ISO-646 terminating, starting 4 digits **NOTE** separators differ from tec-it, same as BWIPP", "010110111001000011101111111100001011001000010000010101101111110011101011111000000110000110110100011101" "000001000110111100010000000010100100110111101111101010010000001100010100000101010001111001001011100000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" @@ -511,7 +825,7 @@ static void test_general_field(int index, int generate, int debug) { "000000011000111010010100001010100101011111000010100000000000000000000000000000000000000000000000000000" "010011100111000101100011110000001010100000111101000100000000000000000000000000000000000000000000000000" }, - /*38*/ { BARCODE_RSS_EXPSTACK, "[91]a1234ABCDEb", 0, 9, 102, "ISO-646 followed by 9 non-ISO-646 non-terminating, starting 4 digits **NOTE** ditto", + /*38*/ { BARCODE_RSS_EXPSTACK, "[91]a1234ABCDEb", 9, 102, "ISO-646 followed by 9 non-ISO-646 non-terminating, starting 4 digits **NOTE** ditto", "010110111001100001101111111100001011001000010000010101101111110011101011111000000110010001110010011101" "000001000110011110010000000010100100110111101111101010010000001100010100000101010001101110001101100000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" @@ -522,14 +836,14 @@ static void test_general_field(int index, int generate, int debug) { "000000110111100001010100001010100101011111000010100000000000000000000000000000000000000000000000000000" "010111001000011110100011110000001010100000111101000100000000000000000000000000000000000000000000000000" }, - /*39*/ { BARCODE_RSS_EXPSTACK, "[91]a1234ABCDE", 0, 5, 102, "ISO-646 followed by 9 non-ISO-646 terminating, starting 4 digits", + /*39*/ { BARCODE_RSS_EXPSTACK, "[91]a1234ABCDE", 5, 102, "ISO-646 followed by 9 non-ISO-646 terminating, starting 4 digits **NOTE** bottom separator differs from tec-it, same as BWIPP", "010010000110001110101111111100001011001000010000010101101111110011101011111100001110000110110100011101" "000001111001110001010000000010100100110111101111101010010000001100010100000010100001111001001011100000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" "000010111110001101100001000000001011001001101111110111001011110001101001010000001010010101111000110000" "101001000001110010011100111111110100110110010000001000110100001110010100001111110001101010000111000010" }, - /*40*/ { BARCODE_RSS_EXPSTACK, "[91]aABCDEF12345b", 0, 9, 102, "ISO-646 followed by 11 non-ISO-646 non-terminating, starting 6 letters", + /*40*/ { BARCODE_RSS_EXPSTACK, "[91]aABCDEF12345b", 9, 102, "ISO-646 followed by 11 non-ISO-646 non-terminating, starting 6 letters **NOTE** top separator differs from tec-it, same as BWIPP", "010000100010100111101111111100001011001000010000010101101111110011101011111000000110100001110001011101" "000011011101011000010000000010100100110111101111101010010000001100010100000101010001011110001110100000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" @@ -540,7 +854,7 @@ static void test_general_field(int index, int generate, int debug) { "000010111110010100010100001010100101000011011100000000000000000000000000000000000000000000000000000000" "010001000001101011100011110000001010111100100011100100000000000000000000000000000000000000000000000000" }, - /*41*/ { BARCODE_RSS_EXPSTACK, "[91]aABCDEF1234b", 0, 9, 102, "ISO-646 followed by 10 non-ISO-646 non-terminating, starting 6 letters **NOTE** ditto", + /*41*/ { BARCODE_RSS_EXPSTACK, "[91]aABCDEF1234b", 9, 102, "ISO-646 followed by 10 non-ISO-646 non-terminating, starting 6 letters **NOTE** separators differ from tec-it, same as BWIPP", "010110111100110000101111111100001011001000010000010101101111110011101011111000000110100001110001011101" "000001000011001111010000000010100100110111101111101010010000001100010100000101010001011110001110100000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" @@ -551,7 +865,7 @@ static void test_general_field(int index, int generate, int debug) { "000010111101100010010100001010100100000010010011100000000000000000000000000000000000000000000000000000" "010001000010011101100011110000001011111101101100010100000000000000000000000000000000000000000000000000" }, - /*42*/ { BARCODE_RSS_EXPSTACK, "[91]aABCDE12345b", 0, 9, 102, "ISO-646 followed by 10 non-ISO-646 non-terminating, starting 5 letters **NOTE** ditto", + /*42*/ { BARCODE_RSS_EXPSTACK, "[91]aABCDE12345b", 9, 102, "ISO-646 followed by 10 non-ISO-646 non-terminating, starting 5 letters **NOTE** ditto", "010000100010011011101111111100001011001000010000010101101111110011101011111000000110100001110001011101" "000011011101100100010000000010100100110111101111101010010000001100010100000101010001011110001110100000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" @@ -562,14 +876,14 @@ static void test_general_field(int index, int generate, int debug) { "000010100001110100010100001010100100001001100101100000000000000000000000000000000000000000000000000000" "010001011110001011100011110000001011110110011010000100000000000000000000000000000000000000000000000000" }, - /*43*/ { BARCODE_RSS_EXPSTACK, "[91]aABCDE1234", 0, 5, 102, "ISO-646 followed by 10 non-ISO-646 terminating, starting 5 letters", + /*43*/ { BARCODE_RSS_EXPSTACK, "[91]aABCDE1234", 5, 102, "ISO-646 followed by 10 non-ISO-646 terminating, starting 5 letters **NOTE** bottom separator differs from tec-it, same as BWIPP", "010001011000111000101111111100001011001000010000010101101111110011101011111100001110100001110001011101" "000010100111000111010000000010100100110111101111101010010000001100010100000010100001011110001110100000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" "000001100011101101100001000000001011000010110111100111101101110100001001010000001010011101011111010000" "101110011100010010011100111111110100111101001000011000010010001011110100001111110001100010100000100010" }, - /*44*/ { BARCODE_RSS_EXPSTACK, "[91]aABCDE1234b", 0, 9, 102, "ISO-646 followed by 9 non-ISO-646 non-terminating, starting 5 letters **NOTE** ditto", + /*44*/ { BARCODE_RSS_EXPSTACK, "[91]aABCDE1234b", 9, 102, "ISO-646 followed by 9 non-ISO-646 non-terminating, starting 5 letters **NOTE** separators differ from tec-it, same as BWIPP", "010000100001110110101111111100001011001000010000010101101111110011101011111000000110000100011011011101" "000011011110001001010000000010100100110111101111101010010000001100010100000101010001111011100100100000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" @@ -580,7 +894,7 @@ static void test_general_field(int index, int generate, int debug) { "000000110111100001010100001010100101011111000010100000000000000000000000000000000000000000000000000000" "010111001000011110100011110000001010100000111101000100000000000000000000000000000000000000000000000000" }, - /*45*/ { BARCODE_RSS_EXPSTACK, "[91]aABCDE1234", 0, 5, 102, "ISO-646 followed by 9 non-ISO-646 terminating, starting 5 letters", + /*45*/ { BARCODE_RSS_EXPSTACK, "[91]aABCDE1234", 5, 102, "ISO-646 followed by 9 non-ISO-646 terminating, starting 5 letters **NOTE** bottom separator differs from tec-it, same as BWIPP", "010001011000111000101111111100001011001000010000010101101111110011101011111100001110100001110001011101" "000010100111000111010000000010100100110111101111101010010000001100010100000010100001011110001110100000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" @@ -602,28 +916,21 @@ static void test_general_field(int index, int generate, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); - assert_equal(ret, data[i].ret, "i:%d ret %d != %d %s\n", i, ret, data[i].ret, symbol->errtxt); + ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].data, length); + assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 (%s)\n", i, ret, symbol->errtxt); if (generate) { - if (ret == 0) { - printf(" /*%2d*/ { %s, \"%s\", %d, %d, %d, \"%s\",\n", - i, testUtilBarcodeName(symbol->symbology), data[i].data, ret, symbol->rows, symbol->width, data[i].comment); - testUtilModulesDump(symbol, " ", "\n"); - printf(" },\n"); - } else { - printf(" /*%2d*/ { %s, \"%s\", %s, %d, %d, \"%s\", \"\" },\n", - i, testUtilBarcodeName(symbol->symbology), data[i].data, testUtilErrorName(ret), symbol->rows, symbol->width, data[i].comment); - } + printf(" /*%2d*/ { %s, \"%s\", %d, %d, %d, \"%s\",\n", + i, testUtilBarcodeName(symbol->symbology), data[i].data, ret, symbol->rows, symbol->width, data[i].comment); + testUtilModulesDump(symbol, " ", "\n"); + printf(" },\n"); } else { assert_equal(symbol->rows, data[i].expected_rows, "i:%d %s symbol->rows %d != %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), symbol->rows, data[i].expected_rows, data[i].data); assert_equal(symbol->width, data[i].expected_width, "i:%d %s symbol->width %d != %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), symbol->width, data[i].expected_width, data[i].data); - if (ret == 0) { - int width, row; - ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row); - assert_zero(ret, "i:%d %s testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, width, row, data[i].data); - } + int width, row; + ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row); + assert_zero(ret, "i:%d %s testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, width, row, data[i].data); } ZBarcode_Delete(symbol); @@ -638,7 +945,7 @@ static void test_binary_buffer_size(int index, int generate, int debug) { int ret; struct item { - unsigned char *data; + char *data; int ret; int expected_rows; @@ -669,8 +976,8 @@ static void test_binary_buffer_size(int index, int generate, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); - assert_equal(ret, data[i].ret, "i:%d ret %d != %d %s\n", i, ret, data[i].ret, symbol->errtxt); + ret = ZBarcode_Encode(symbol, (const 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(" /*%2d*/ { \"%s\", %s, %d, %d, \"%s\" },\n", @@ -686,6 +993,117 @@ static void test_binary_buffer_size(int index, int generate, int debug) { testFinish(); } +static void test_hrt(int index, int debug) { + + testStart(""); + + int ret; + struct item { + int symbology; + char *data; + + char *expected; + }; + // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) + struct item data[] = { + /* 0*/ { BARCODE_RSS14, "1234567890123", "(01)12345678901231" }, + /* 1*/ { BARCODE_RSS14, "12345678901231", "(01)12345678901231" }, + /* 2*/ { BARCODE_RSS14, "1000000000009", "(01)10000000000090" }, + /* 3*/ { BARCODE_RSS_LTD, "1341056790138", "(01)13410567901384" }, + /* 4*/ { BARCODE_RSS_LTD, "13410567901384", "(01)13410567901384" }, + /* 5*/ { BARCODE_RSS_EXP, "[01]12345678901234", "(01)12345678901234" }, + /* 6*/ { BARCODE_RSS14STACK, "12345678901231", "" }, + /* 7*/ { BARCODE_RSS14STACK_OMNI, "10000000000090", "" }, + /* 8*/ { BARCODE_RSS_EXPSTACK, "[01]12345678901234", "" }, + }; + int data_size = ARRAY_SIZE(data); + + char *text; + + for (int i = 0; i < data_size; i++) { + + if (index != -1 && i != index) continue; + + struct zint_symbol *symbol = ZBarcode_Create(); + assert_nonnull(symbol, "Symbol not created\n"); + + int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); + + ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].data, length); + assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt); + + assert_zero(strcmp((const char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected); + + ZBarcode_Delete(symbol); + } + + testFinish(); +} + +static void test_input(int index, int debug) { + + testStart(""); + + int ret; + struct item { + int symbology; + char *data; + int ret; + int expected_rows; + int expected_width; + }; + // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) + struct item data[] = { + /* 0*/ { BARCODE_RSS14, "1234567890123", 0, 1, 96 }, + /* 1*/ { BARCODE_RSS14, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1 }, + /* 2*/ { BARCODE_RSS14, "12345678901234", ZINT_ERROR_INVALID_CHECK, -1, -1 }, + /* 3*/ { BARCODE_RSS14, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 4*/ { BARCODE_RSS_LTD, "1234567890123", 0, 1, 74 }, + /* 5*/ { BARCODE_RSS_LTD, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1 }, + /* 6*/ { BARCODE_RSS_LTD, "12345678901235", ZINT_ERROR_INVALID_CHECK, -1, -1 }, + /* 7*/ { BARCODE_RSS_LTD, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 8*/ { BARCODE_RSS_LTD, "2234567890123", ZINT_ERROR_INVALID_DATA, -1, -1 }, + /* 9*/ { BARCODE_RSS_LTD, "22345678901238", ZINT_ERROR_INVALID_DATA, -1, -1 }, + /* 10*/ { BARCODE_RSS_EXP, "[01]12345678901234", 0, 1, 134 }, + /* 11*/ { BARCODE_RSS_EXP, "[01]1234567890123A", ZINT_ERROR_INVALID_DATA, -1, -1 }, + /* 12*/ { BARCODE_RSS_EXP, "[01]123456789012315", ZINT_ERROR_INVALID_DATA, -1, -1 }, + /* 13*/ { BARCODE_RSS14STACK, "1234567890123", 0, 3, 50 }, + /* 14*/ { BARCODE_RSS14STACK, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1 }, + /* 15*/ { BARCODE_RSS14STACK, "12345678901235", ZINT_ERROR_INVALID_CHECK, -1, -1 }, + /* 16*/ { BARCODE_RSS14STACK, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 17*/ { BARCODE_RSS14STACK_OMNI, "1234567890123", 0, 5, 50 }, + /* 18*/ { BARCODE_RSS14STACK_OMNI, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1 }, + /* 19*/ { BARCODE_RSS14STACK_OMNI, "12345678901236", ZINT_ERROR_INVALID_CHECK, -1, -1 }, + /* 20*/ { BARCODE_RSS14STACK_OMNI, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 21*/ { BARCODE_RSS_EXPSTACK, "[01]12345678901234", 0, 5, 102 }, + /* 22*/ { BARCODE_RSS_EXPSTACK, "[01]123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1 }, + /* 23*/ { BARCODE_RSS_EXPSTACK, "[01]123456789012315", ZINT_ERROR_INVALID_DATA, -1, -1 }, + }; + int data_size = ARRAY_SIZE(data); + + for (int i = 0; i < data_size; i++) { + + if (index != -1 && i != index) continue; + + struct zint_symbol *symbol = ZBarcode_Create(); + assert_nonnull(symbol, "Symbol not created\n"); + + int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); + + ret = ZBarcode_Encode(symbol, (const 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 (ret < 5) { + assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n", i, symbol->rows, data[i].expected_rows); + assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width); + } + + ZBarcode_Delete(symbol); + } + + testFinish(); +} + int main(int argc, char *argv[]) { testFunction funcs[] = { /* name, func, has_index, has_generate, has_debug */ @@ -693,6 +1111,8 @@ int main(int argc, char *argv[]) { { "test_examples", test_examples, 1, 1, 1 }, { "test_general_field", test_general_field, 1, 1, 1 }, { "test_binary_buffer_size", test_binary_buffer_size, 1, 1, 1 }, + { "test_hrt", test_hrt, 1, 0, 1 }, + { "test_input", test_input, 1, 0, 1 }, }; testRun(argc, argv, funcs, ARRAY_SIZE(funcs)); diff --git a/backend/tests/test_telepen.c b/backend/tests/test_telepen.c index 428120ec..0ba3332a 100644 --- a/backend/tests/test_telepen.c +++ b/backend/tests/test_telepen.c @@ -184,6 +184,8 @@ static void test_encode(int index, int generate, int debug) { testStart(""); + int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise + int ret; struct item { int symbology; @@ -228,6 +230,8 @@ static void test_encode(int index, int generate, int debug) { int data_size = ARRAY_SIZE(data); char escaped[1024]; + char bwipp_buf[8192]; + char bwipp_msg[1024]; for (int i = 0; i < data_size; i++) { @@ -257,6 +261,15 @@ static void test_encode(int index, int generate, int debug) { ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row); assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data); } + + if (do_bwipp && testUtilCanBwipp(symbol->symbology, -1, -1, -1, debug)) { + ret = testUtilBwipp(symbol, -1, -1, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf)); + assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), ret); + + ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected); + assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", + i, testUtilBarcodeName(data[i].symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); + } } } diff --git a/backend/tests/test_tif.c b/backend/tests/test_tif.c index ad535b13..96d85f83 100644 --- a/backend/tests/test_tif.c +++ b/backend/tests/test_tif.c @@ -120,7 +120,7 @@ static void test_pixel_plot(int index, int debug) { ret = testUtilVerifyIdentify(symbol->outfile, debug); assert_zero(ret, "i:%d identify %s ret %d != 0\n", i, symbol->outfile, ret); - if (!(debug & 8)) { + if (!(debug & ZINT_DEBUG_TEST_KEEP_OUTFILE)) { assert_zero(remove(symbol->outfile), "i:%d remove(%s) != 0\n", i, symbol->outfile); } diff --git a/backend/tests/testcommon.c b/backend/tests/testcommon.c index c2fe68de..bbc13c83 100644 --- a/backend/tests/testcommon.c +++ b/backend/tests/testcommon.c @@ -225,157 +225,157 @@ void testRun(int argc, char *argv[], testFunction funcs[], int funcs_size) { char *testUtilBarcodeName(int symbology) { struct item { - int define; char *name; + int define; int val; }; struct item data[] = { - { -1, "", 0 }, - { BARCODE_CODE11, "BARCODE_CODE11", 1 }, - { BARCODE_C25MATRIX, "BARCODE_C25MATRIX", 2 }, - { BARCODE_C25INTER, "BARCODE_C25INTER", 3 }, - { BARCODE_C25IATA, "BARCODE_C25IATA", 4 }, - { -1, "", 5 }, - { BARCODE_C25LOGIC, "BARCODE_C25LOGIC", 6 }, - { BARCODE_C25IND, "BARCODE_C25IND", 7 }, - { BARCODE_CODE39, "BARCODE_CODE39", 8 }, - { BARCODE_EXCODE39, "BARCODE_EXCODE39", 9 }, - { -1, "", 10 }, - { -1, "", 11 }, - { -1, "", 12 }, - { BARCODE_EANX, "BARCODE_EANX", 13 }, - { BARCODE_EANX_CHK, "BARCODE_EANX_CHK", 14 }, - { -1, "", 15 }, - { BARCODE_EAN128, "BARCODE_EAN128", 16 }, - { -1, "", 17 }, - { BARCODE_CODABAR, "BARCODE_CODABAR", 18 }, - { -1, "", 19 }, - { BARCODE_CODE128, "BARCODE_CODE128", 20 }, - { BARCODE_DPLEIT, "BARCODE_DPLEIT", 21 }, - { BARCODE_DPIDENT, "BARCODE_DPIDENT", 22 }, - { BARCODE_CODE16K, "BARCODE_CODE16K", 23 }, - { BARCODE_CODE49, "BARCODE_CODE49", 24 }, - { BARCODE_CODE93, "BARCODE_CODE93", 25 }, - { -1, "", 26 }, - { -1, "", 27 }, - { BARCODE_FLAT, "BARCODE_FLAT", 28 }, - { BARCODE_RSS14, "BARCODE_RSS14", 29 }, - { BARCODE_RSS_LTD, "BARCODE_RSS_LTD", 30 }, - { BARCODE_RSS_EXP, "BARCODE_RSS_EXP", 31 }, - { BARCODE_TELEPEN, "BARCODE_TELEPEN", 32 }, - { -1, "", 33 }, - { BARCODE_UPCA, "BARCODE_UPCA", 34 }, - { BARCODE_UPCA_CHK, "BARCODE_UPCA_CHK", 35 }, - { -1, "", 36 }, - { BARCODE_UPCE, "BARCODE_UPCE", 37 }, - { BARCODE_UPCE_CHK, "BARCODE_UPCE_CHK", 38 }, - { -1, "", 39 }, - { BARCODE_POSTNET, "BARCODE_POSTNET", 40 }, - { -1, "", 41 }, - { -1, "", 42 }, - { -1, "", 43 }, - { -1, "", 44 }, - { -1, "", 45 }, - { -1, "", 46 }, - { BARCODE_MSI_PLESSEY, "BARCODE_MSI_PLESSEY", 47 }, - { -1, "", 48 }, - { BARCODE_FIM, "BARCODE_FIM", 49 }, - { BARCODE_LOGMARS, "BARCODE_LOGMARS", 50 }, - { BARCODE_PHARMA, "BARCODE_PHARMA", 51 }, - { BARCODE_PZN, "BARCODE_PZN", 52 }, - { BARCODE_PHARMA_TWO, "BARCODE_PHARMA_TWO", 53 }, - { -1, "", 54 }, - { BARCODE_PDF417, "BARCODE_PDF417", 55 }, - { BARCODE_PDF417TRUNC, "BARCODE_PDF417TRUNC", 56 }, - { BARCODE_MAXICODE, "BARCODE_MAXICODE", 57 }, - { BARCODE_QRCODE, "BARCODE_QRCODE", 58 }, - { -1, "", 59 }, - { BARCODE_CODE128B, "BARCODE_CODE128B", 60 }, - { -1, "", 61 }, - { -1, "", 62 }, - { BARCODE_AUSPOST, "BARCODE_AUSPOST", 63 }, - { -1, "", 64 }, - { -1, "", 65 }, - { BARCODE_AUSREPLY, "BARCODE_AUSREPLY", 66 }, - { BARCODE_AUSROUTE, "BARCODE_AUSROUTE", 67 }, - { BARCODE_AUSREDIRECT, "BARCODE_AUSREDIRECT", 68 }, - { BARCODE_ISBNX, "BARCODE_ISBNX", 69 }, - { BARCODE_RM4SCC, "BARCODE_RM4SCC", 70 }, - { BARCODE_DATAMATRIX, "BARCODE_DATAMATRIX", 71 }, - { BARCODE_EAN14, "BARCODE_EAN14", 72 }, - { BARCODE_VIN, "BARCODE_VIN", 73 }, - { BARCODE_CODABLOCKF, "BARCODE_CODABLOCKF", 74 }, - { BARCODE_NVE18, "BARCODE_NVE18", 75 }, - { BARCODE_JAPANPOST, "BARCODE_JAPANPOST", 76 }, - { BARCODE_KOREAPOST, "BARCODE_KOREAPOST", 77 }, - { -1, "", 78 }, - { BARCODE_RSS14STACK, "BARCODE_RSS14STACK", 79 }, - { BARCODE_RSS14STACK_OMNI, "BARCODE_RSS14STACK_OMNI", 80 }, - { BARCODE_RSS_EXPSTACK, "BARCODE_RSS_EXPSTACK", 81 }, - { BARCODE_PLANET, "BARCODE_PLANET", 82 }, - { -1, "", 83 }, - { BARCODE_MICROPDF417, "BARCODE_MICROPDF417", 84 }, - { BARCODE_ONECODE, "BARCODE_ONECODE", 85 }, - { BARCODE_PLESSEY, "BARCODE_PLESSEY", 86 }, - { BARCODE_TELEPEN_NUM, "BARCODE_TELEPEN_NUM", 87 }, - { -1, "", 88 }, - { BARCODE_ITF14, "BARCODE_ITF14", 89 }, - { BARCODE_KIX, "BARCODE_KIX", 90 }, - { -1, "", 91 }, - { BARCODE_AZTEC, "BARCODE_AZTEC", 92 }, - { BARCODE_DAFT, "BARCODE_DAFT", 93 }, - { -1, "", 94 }, - { -1, "", 95 }, - { -1, "", 96 }, - { BARCODE_MICROQR, "BARCODE_MICROQR", 97 }, - { BARCODE_HIBC_128, "BARCODE_HIBC_128", 98 }, - { BARCODE_HIBC_39, "BARCODE_HIBC_39", 99 }, - { -1, "", 100 }, - { -1, "", 101 }, - { BARCODE_HIBC_DM, "BARCODE_HIBC_DM", 102 }, - { -1, "", 103 }, - { BARCODE_HIBC_QR, "BARCODE_HIBC_QR", 104 }, - { -1, "", 105 }, - { BARCODE_HIBC_PDF, "BARCODE_HIBC_PDF", 106 }, - { -1, "", 107 }, - { BARCODE_HIBC_MICPDF, "BARCODE_HIBC_MICPDF", 108 }, - { -1, "", 109 }, - { BARCODE_HIBC_BLOCKF, "BARCODE_HIBC_BLOCKF", 110 }, - { -1, "", 111 }, - { BARCODE_HIBC_AZTEC, "BARCODE_HIBC_AZTEC", 112 }, - { -1, "", 113 }, - { -1, "", 114 }, - { BARCODE_DOTCODE, "BARCODE_DOTCODE", 115 }, - { BARCODE_HANXIN, "BARCODE_HANXIN", 116 }, - { -1, "", 117 }, - { -1, "", 118 }, - { -1, "", 119 }, - { -1, "", 120 }, - { BARCODE_MAILMARK, "BARCODE_MAILMARK", 121 }, - { -1, "", 122 }, - { -1, "", 123 }, - { -1, "", 124 }, - { -1, "", 125 }, - { -1, "", 126 }, - { -1, "", 127 }, - { BARCODE_AZRUNE, "BARCODE_AZRUNE", 128 }, - { BARCODE_CODE32, "BARCODE_CODE32", 129 }, - { BARCODE_EANX_CC, "BARCODE_EANX_CC", 130 }, - { BARCODE_EAN128_CC, "BARCODE_EAN128_CC", 131 }, - { BARCODE_RSS14_CC, "BARCODE_RSS14_CC", 132 }, - { BARCODE_RSS_LTD_CC, "BARCODE_RSS_LTD_CC", 133 }, - { BARCODE_RSS_EXP_CC, "BARCODE_RSS_EXP_CC", 134 }, - { BARCODE_UPCA_CC, "BARCODE_UPCA_CC", 135 }, - { BARCODE_UPCE_CC, "BARCODE_UPCE_CC", 136 }, - { BARCODE_RSS14STACK_CC, "BARCODE_RSS14STACK_CC", 137 }, - { BARCODE_RSS14_OMNI_CC, "BARCODE_RSS14_OMNI_CC", 138 }, - { BARCODE_RSS_EXPSTACK_CC, "BARCODE_RSS_EXPSTACK_CC", 139 }, - { BARCODE_CHANNEL, "BARCODE_CHANNEL", 140 }, - { BARCODE_CODEONE, "BARCODE_CODEONE", 141 }, - { BARCODE_GRIDMATRIX, "BARCODE_GRIDMATRIX", 142 }, - { BARCODE_UPNQR, "BARCODE_UPNQR", 143 }, - { BARCODE_ULTRA, "BARCODE_ULTRA", 144 }, - { BARCODE_RMQR, "BARCODE_RMQR", 145 }, + { "", -1, 0 }, + { "BARCODE_CODE11", BARCODE_CODE11, 1 }, + { "BARCODE_C25MATRIX", BARCODE_C25MATRIX, 2 }, + { "BARCODE_C25INTER", BARCODE_C25INTER, 3 }, + { "BARCODE_C25IATA", BARCODE_C25IATA, 4 }, + { "", -1, 5 }, + { "BARCODE_C25LOGIC", BARCODE_C25LOGIC, 6 }, + { "BARCODE_C25IND", BARCODE_C25IND, 7 }, + { "BARCODE_CODE39", BARCODE_CODE39, 8 }, + { "BARCODE_EXCODE39", BARCODE_EXCODE39, 9 }, + { "", -1, 10 }, + { "", -1, 11 }, + { "", -1, 12 }, + { "BARCODE_EANX", BARCODE_EANX, 13 }, + { "BARCODE_EANX_CHK", BARCODE_EANX_CHK, 14 }, + { "", -1, 15 }, + { "BARCODE_EAN128", BARCODE_EAN128, 16 }, + { "", -1, 17 }, + { "BARCODE_CODABAR", BARCODE_CODABAR, 18 }, + { "", -1, 19 }, + { "BARCODE_CODE128", BARCODE_CODE128, 20 }, + { "BARCODE_DPLEIT", BARCODE_DPLEIT, 21 }, + { "BARCODE_DPIDENT", BARCODE_DPIDENT, 22 }, + { "BARCODE_CODE16K", BARCODE_CODE16K, 23 }, + { "BARCODE_CODE49", BARCODE_CODE49, 24 }, + { "BARCODE_CODE93", BARCODE_CODE93, 25 }, + { "", -1, 26 }, + { "", -1, 27 }, + { "BARCODE_FLAT", BARCODE_FLAT, 28 }, + { "BARCODE_RSS14", BARCODE_RSS14, 29 }, + { "BARCODE_RSS_LTD", BARCODE_RSS_LTD, 30 }, + { "BARCODE_RSS_EXP", BARCODE_RSS_EXP, 31 }, + { "BARCODE_TELEPEN", BARCODE_TELEPEN, 32 }, + { "", -1, 33 }, + { "BARCODE_UPCA", BARCODE_UPCA, 34 }, + { "BARCODE_UPCA_CHK", BARCODE_UPCA_CHK, 35 }, + { "", -1, 36 }, + { "BARCODE_UPCE", BARCODE_UPCE, 37 }, + { "BARCODE_UPCE_CHK", BARCODE_UPCE_CHK, 38 }, + { "", -1, 39 }, + { "BARCODE_POSTNET", BARCODE_POSTNET, 40 }, + { "", -1, 41 }, + { "", -1, 42 }, + { "", -1, 43 }, + { "", -1, 44 }, + { "", -1, 45 }, + { "", -1, 46 }, + { "BARCODE_MSI_PLESSEY", BARCODE_MSI_PLESSEY, 47 }, + { "", -1, 48 }, + { "BARCODE_FIM", BARCODE_FIM, 49 }, + { "BARCODE_LOGMARS", BARCODE_LOGMARS, 50 }, + { "BARCODE_PHARMA", BARCODE_PHARMA, 51 }, + { "BARCODE_PZN", BARCODE_PZN, 52 }, + { "BARCODE_PHARMA_TWO", BARCODE_PHARMA_TWO, 53 }, + { "", -1, 54 }, + { "BARCODE_PDF417", BARCODE_PDF417, 55 }, + { "BARCODE_PDF417TRUNC", BARCODE_PDF417TRUNC, 56 }, + { "BARCODE_MAXICODE", BARCODE_MAXICODE, 57 }, + { "BARCODE_QRCODE", BARCODE_QRCODE, 58 }, + { "", -1, 59 }, + { "BARCODE_CODE128B", BARCODE_CODE128B, 60 }, + { "", -1, 61 }, + { "", -1, 62 }, + { "BARCODE_AUSPOST", BARCODE_AUSPOST, 63 }, + { "", -1, 64 }, + { "", -1, 65 }, + { "BARCODE_AUSREPLY", BARCODE_AUSREPLY, 66 }, + { "BARCODE_AUSROUTE", BARCODE_AUSROUTE, 67 }, + { "BARCODE_AUSREDIRECT", BARCODE_AUSREDIRECT, 68 }, + { "BARCODE_ISBNX", BARCODE_ISBNX, 69 }, + { "BARCODE_RM4SCC", BARCODE_RM4SCC, 70 }, + { "BARCODE_DATAMATRIX", BARCODE_DATAMATRIX, 71 }, + { "BARCODE_EAN14", BARCODE_EAN14, 72 }, + { "BARCODE_VIN", BARCODE_VIN, 73 }, + { "BARCODE_CODABLOCKF", BARCODE_CODABLOCKF, 74 }, + { "BARCODE_NVE18", BARCODE_NVE18, 75 }, + { "BARCODE_JAPANPOST", BARCODE_JAPANPOST, 76 }, + { "BARCODE_KOREAPOST", BARCODE_KOREAPOST, 77 }, + { "", -1, 78 }, + { "BARCODE_RSS14STACK", BARCODE_RSS14STACK, 79 }, + { "BARCODE_RSS14STACK_OMNI", BARCODE_RSS14STACK_OMNI, 80 }, + { "BARCODE_RSS_EXPSTACK", BARCODE_RSS_EXPSTACK, 81 }, + { "BARCODE_PLANET", BARCODE_PLANET, 82 }, + { "", -1, 83 }, + { "BARCODE_MICROPDF417", BARCODE_MICROPDF417, 84 }, + { "BARCODE_ONECODE", BARCODE_ONECODE, 85 }, + { "BARCODE_PLESSEY", BARCODE_PLESSEY, 86 }, + { "BARCODE_TELEPEN_NUM", BARCODE_TELEPEN_NUM, 87 }, + { "", -1, 88 }, + { "BARCODE_ITF14", BARCODE_ITF14, 89 }, + { "BARCODE_KIX", BARCODE_KIX, 90 }, + { "", -1, 91 }, + { "BARCODE_AZTEC", BARCODE_AZTEC, 92 }, + { "BARCODE_DAFT", BARCODE_DAFT, 93 }, + { "", -1, 94 }, + { "", -1, 95 }, + { "", -1, 96 }, + { "BARCODE_MICROQR", BARCODE_MICROQR, 97 }, + { "BARCODE_HIBC_128", BARCODE_HIBC_128, 98 }, + { "BARCODE_HIBC_39", BARCODE_HIBC_39, 99 }, + { "", -1, 100 }, + { "", -1, 101 }, + { "BARCODE_HIBC_DM", BARCODE_HIBC_DM, 102 }, + { "", -1, 103 }, + { "BARCODE_HIBC_QR", BARCODE_HIBC_QR, 104 }, + { "", -1, 105 }, + { "BARCODE_HIBC_PDF", BARCODE_HIBC_PDF, 106 }, + { "", -1, 107 }, + { "BARCODE_HIBC_MICPDF", BARCODE_HIBC_MICPDF, 108 }, + { "", -1, 109 }, + { "BARCODE_HIBC_BLOCKF", BARCODE_HIBC_BLOCKF, 110 }, + { "", -1, 111 }, + { "BARCODE_HIBC_AZTEC", BARCODE_HIBC_AZTEC, 112 }, + { "", -1, 113 }, + { "", -1, 114 }, + { "BARCODE_DOTCODE", BARCODE_DOTCODE, 115 }, + { "BARCODE_HANXIN", BARCODE_HANXIN, 116 }, + { "", -1, 117 }, + { "", -1, 118 }, + { "", -1, 119 }, + { "", -1, 120 }, + { "BARCODE_MAILMARK", BARCODE_MAILMARK, 121 }, + { "", -1, 122 }, + { "", -1, 123 }, + { "", -1, 124 }, + { "", -1, 125 }, + { "", -1, 126 }, + { "", -1, 127 }, + { "BARCODE_AZRUNE", BARCODE_AZRUNE, 128 }, + { "BARCODE_CODE32", BARCODE_CODE32, 129 }, + { "BARCODE_EANX_CC", BARCODE_EANX_CC, 130 }, + { "BARCODE_EAN128_CC", BARCODE_EAN128_CC, 131 }, + { "BARCODE_RSS14_CC", BARCODE_RSS14_CC, 132 }, + { "BARCODE_RSS_LTD_CC", BARCODE_RSS_LTD_CC, 133 }, + { "BARCODE_RSS_EXP_CC", BARCODE_RSS_EXP_CC, 134 }, + { "BARCODE_UPCA_CC", BARCODE_UPCA_CC, 135 }, + { "BARCODE_UPCE_CC", BARCODE_UPCE_CC, 136 }, + { "BARCODE_RSS14STACK_CC", BARCODE_RSS14STACK_CC, 137 }, + { "BARCODE_RSS14_OMNI_CC", BARCODE_RSS14_OMNI_CC, 138 }, + { "BARCODE_RSS_EXPSTACK_CC", BARCODE_RSS_EXPSTACK_CC, 139 }, + { "BARCODE_CHANNEL", BARCODE_CHANNEL, 140 }, + { "BARCODE_CODEONE", BARCODE_CODEONE, 141 }, + { "BARCODE_GRIDMATRIX", BARCODE_GRIDMATRIX, 142 }, + { "BARCODE_UPNQR", BARCODE_UPNQR, 143 }, + { "BARCODE_ULTRA", BARCODE_ULTRA, 144 }, + { "BARCODE_RMQR", BARCODE_RMQR, 145 }, }; int data_size = sizeof(data) / sizeof(struct item); @@ -419,23 +419,23 @@ int testUtilSetSymbol(struct zint_symbol *symbol, int symbology, int input_mode, char *testUtilErrorName(int error_number) { struct item { - int define; char *name; + int define; int val; }; struct item data[] = { - { 0, "0", 0 }, - { -1, "", 1 }, - { ZINT_WARN_INVALID_OPTION, "ZINT_WARN_INVALID_OPTION", 2 }, - { ZINT_WARN_USES_ECI, "ZINT_WARN_USES_ECI", 3 }, - { -1, "", 4 }, - { ZINT_ERROR_TOO_LONG, "ZINT_ERROR_TOO_LONG", 5 }, - { ZINT_ERROR_INVALID_DATA, "ZINT_ERROR_INVALID_DATA", 6 }, - { ZINT_ERROR_INVALID_CHECK, "ZINT_ERROR_INVALID_CHECK", 7 }, - { ZINT_ERROR_INVALID_OPTION, "ZINT_ERROR_INVALID_OPTION", 8 }, - { ZINT_ERROR_ENCODING_PROBLEM, "ZINT_ERROR_ENCODING_PROBLEM", 9 }, - { ZINT_ERROR_FILE_ACCESS, "ZINT_ERROR_FILE_ACCESS", 10 }, - { ZINT_ERROR_MEMORY, "ZINT_ERROR_MEMORY", 11 }, + { "0", 0, 0 }, + { "", -1, 1 }, + { "ZINT_WARN_INVALID_OPTION", ZINT_WARN_INVALID_OPTION, 2 }, + { "ZINT_WARN_USES_ECI", ZINT_WARN_USES_ECI, 3 }, + { "", -1, 4 }, + { "ZINT_ERROR_TOO_LONG", ZINT_ERROR_TOO_LONG, 5 }, + { "ZINT_ERROR_INVALID_DATA", ZINT_ERROR_INVALID_DATA, 6 }, + { "ZINT_ERROR_INVALID_CHECK", ZINT_ERROR_INVALID_CHECK, 7 }, + { "ZINT_ERROR_INVALID_OPTION", ZINT_ERROR_INVALID_OPTION, 8 }, + { "ZINT_ERROR_ENCODING_PROBLEM", ZINT_ERROR_ENCODING_PROBLEM, 9 }, + { "ZINT_ERROR_FILE_ACCESS", ZINT_ERROR_FILE_ACCESS, 10 }, + { "ZINT_ERROR_MEMORY", ZINT_ERROR_MEMORY, 11 }, }; int data_size = sizeof(data) / sizeof(struct item); @@ -451,22 +451,22 @@ char *testUtilErrorName(int error_number) { char *testUtilInputModeName(int input_mode) { struct item { - int define; char *name; + int define; int val; }; struct item data[] = { - { DATA_MODE, "DATA_MODE", 0 }, - { UNICODE_MODE, "UNICODE_MODE", 1 }, - { GS1_MODE, "GS1_MODE", 2 }, - { -1, "", 3 }, - { -1, "", 4 }, - { -1, "", 5 }, - { -1, "", 6 }, - { -1, "", 7 }, - { DATA_MODE | ESCAPE_MODE, "DATA_MODE | ESCAPE_MODE", 8 }, - { UNICODE_MODE | ESCAPE_MODE, "UNICODE_MODE | ESCAPE_MODE", 9 }, - { GS1_MODE | ESCAPE_MODE, "GS1_MODE | ESCAPE_MODE", 10 }, + { "DATA_MODE", DATA_MODE, 0 }, + { "UNICODE_MODE", UNICODE_MODE, 1 }, + { "GS1_MODE", GS1_MODE, 2 }, + { "", -1, 3 }, + { "", -1, 4 }, + { "", -1, 5 }, + { "", -1, 6 }, + { "", -1, 7 }, + { "DATA_MODE | ESCAPE_MODE", DATA_MODE | ESCAPE_MODE, 8 }, + { "UNICODE_MODE | ESCAPE_MODE", UNICODE_MODE | ESCAPE_MODE, 9 }, + { "GS1_MODE | ESCAPE_MODE", GS1_MODE | ESCAPE_MODE, 10 }, }; int data_size = sizeof(data) / sizeof(struct item); @@ -1391,9 +1391,9 @@ int testUtilVerifyIdentify(char *filename, int debug) { return -1; } // Verbose option does a more thorough check - if (debug & ZINT_DEBUG_PRINT) { + if (debug & ZINT_DEBUG_TEST_PRINT) { // Verbose very noisy though so for quick check just return default output - if (debug & 4) { + if (debug & ZINT_DEBUG_TEST_LESS_NOISY) { sprintf(buf, "identify %s", filename); } else { sprintf(buf, "identify -verbose %s", filename); @@ -1416,7 +1416,7 @@ int testUtilVerifyInkscape(char *filename, int debug) { if (strlen(filename) > 512) { return -1; } - if (debug & ZINT_DEBUG_PRINT) { + if (debug & ZINT_DEBUG_TEST_PRINT) { sprintf(buf, "inkscape -z -f %s", filename); // Prints nothing unless bad printf("%s\n", buf); } else { @@ -1437,12 +1437,522 @@ int testUtilVerifyGhostscript(char *filename, int debug) { if (strlen(filename) > 512) { return -1; } - if (debug & ZINT_DEBUG_PRINT) { - sprintf(buf, "gs -dNOPAUSE -dBATCH -sDEVICE=nullpage -q %s", filename); // Prints nothing of interest with or without -q unless bad + if (debug & ZINT_DEBUG_TEST_PRINT) { + sprintf(buf, "gs -dNOPAUSE -dBATCH -dNODISPLAY -q %s", filename); // Prints nothing of interest with or without -q unless bad printf("%s\n", buf); } else { - sprintf(buf, "gs -dNOPAUSE -dBATCH -sDEVICE=nullpage -q %s", filename); + sprintf(buf, "gs -dNOPAUSE -dBATCH -dNODISPLAY -q %s", filename); } return system(buf); } + +static char *testUtilBwippName(int symbology, int option_1, int option_2, int option_3, int *linear_row_height, int *gs1_cvt) { + struct item { + char *name; + int define; + int val; + int can_option_1; + int can_option_2; + int can_option_3; + int linear_row_height; + int gs1_cvt; + }; + struct item data[] = { + { "", -1, 0, 0, 0, 0, 0, 0, }, + { "code11", BARCODE_CODE11, 1, 0, 1, 0, 0, 0, }, + { "matrix2of5", BARCODE_C25MATRIX, 2, 0, 0, 0, 0, 0, }, + { "interleaved2of5", BARCODE_C25INTER, 3, 0, 0, 0, 0, 0, }, + { "iata2of5", BARCODE_C25IATA, 4, 0, 0, 0, 0, 0, }, + { "", -1, 5, 0, 0, 0, 0, 0, }, + { "datalogic2of5", BARCODE_C25LOGIC, 6, 0, 0, 0, 0, 0, }, + { "industrial2of5", BARCODE_C25IND, 7, 0, 0, 0, 0, 0, }, + { "code39", BARCODE_CODE39, 8, 0, 1, 0, 0, 0, }, + { "code39ext", BARCODE_EXCODE39, 9, 0, 1, 0, 0, 0, }, + { "", -1, 10, 0, 0, 0, 0, 0, }, + { "", -1, 11, 0, 0, 0, 0, 0, }, + { "", -1, 12, 0, 0, 0, 0, 0, }, + { "ean13", BARCODE_EANX, 13, 0, 0, 0, 0, 0, }, + { "ean13", BARCODE_EANX_CHK, 14, 0, 0, 0, 0, 0, }, + { "", -1, 15, 0, 0, 0, 0, 0, }, + { "gs1-128", BARCODE_EAN128, 16, 0, 0, 0, 0, 1 /*gs1_cnt*/, }, + { "", -1, 17, 0, 0, 0, 0, 0, }, + { "rationalizedCodabar", BARCODE_CODABAR, 18, 0, 0, 0, 0, 0, }, + { "", -1, 19, 0, 0, 0, 0, 0, }, + { "code128", BARCODE_CODE128, 20, 0, 0, 0, 0, 0, }, + { "leitcode", BARCODE_DPLEIT, 21, 0, 0, 0, 0, 0, }, + { "identcode", BARCODE_DPIDENT, 22, 0, 0, 0, 0, 0, }, + { "code16k", BARCODE_CODE16K, 23, 0, 0, 0, 0, 0, }, + { "code49", BARCODE_CODE49, 24, 0, 0, 0, 0, 0, }, + { "code93", BARCODE_CODE93, 25, 0, 0, 0, 0, 0, }, + { "", -1, 26, 0, 0, 0, 0, 0, }, + { "", -1, 27, 0, 0, 0, 0, 0, }, + { "flattermarken", BARCODE_FLAT, 28, 0, 0, 0, 0, 0, }, + { "databaromni", BARCODE_RSS14, 29, 0, 0, 0, 0, 1 /*gs1_cvt*/, }, + { "databarlimited", BARCODE_RSS_LTD, 30, 0, 0, 0, 0, 1, }, + { "databarexpanded", BARCODE_RSS_EXP, 31, 0, 1, 0, 1 /*linear_row_height*/, 1, }, + { "telepen", BARCODE_TELEPEN, 32, 0, 0, 0, 0, 0, }, + { "", -1, 33, 0, 0, 0, 0, 0, }, + { "upca", BARCODE_UPCA, 34, 0, 0, 0, 0, 0, }, + { "upca", BARCODE_UPCA_CHK, 35, 0, 0, 0, 0, 0, }, + { "", -1, 36, 0, 0, 0, 0, 0, }, + { "upce", BARCODE_UPCE, 37, 0, 0, 0, 0, 0, }, + { "upce", BARCODE_UPCE_CHK, 38, 0, 0, 0, 0, 0, }, + { "", -1, 39, 0, 0, 0, 0, 0, }, + { "postnet", BARCODE_POSTNET, 40, 0, 0, 0, 0, 0, }, + { "", -1, 41, 0, 0, 0, 0, 0, }, + { "", -1, 42, 0, 0, 0, 0, 0, }, + { "", -1, 43, 0, 0, 0, 0, 0, }, + { "", -1, 44, 0, 0, 0, 0, 0, }, + { "", -1, 45, 0, 0, 0, 0, 0, }, + { "", -1, 46, 0, 0, 0, 0, 0, }, + { "msi", BARCODE_MSI_PLESSEY, 47, 0, 0, 0, 0, 0, }, + { "", -1, 48, 0, 0, 0, 0, 0, }, + { "symbol", BARCODE_FIM, 49, 0, 0, 0, 0, 0, }, + { "code39", BARCODE_LOGMARS, 50, 0, 1, 0, 0, 0, }, + { "pharmacode", BARCODE_PHARMA, 51, 0, 0, 0, 0, 0, }, + { "pzn", BARCODE_PZN, 52, 0, 0, 0, 0, 0, }, + { "pharmacode2", BARCODE_PHARMA_TWO, 53, 0, 0, 0, 0, 0, }, + { "", -1, 54, 0, 0, 0, 0, 0, }, + { "pdf417", BARCODE_PDF417, 55, 0, 0, 0, 0, 0, }, + { "pdf417compact", BARCODE_PDF417TRUNC, 56, 0, 0, 0, 0, 0, }, + { "maxicode", BARCODE_MAXICODE, 57, 0, 0, 0, 0, 0, }, + { "qrcode", BARCODE_QRCODE, 58, 0, 0, 0, 0, 0, }, + { "", -1, 59, 0, 0, 0, 0, 0, }, + { "", BARCODE_CODE128B, 60, 0, 0, 0, 0, 0, }, + { "", -1, 61, 0, 0, 0, 0, 0, }, + { "", -1, 62, 0, 0, 0, 0, 0, }, + { "auspost", BARCODE_AUSPOST, 63, 0, 0, 0, 0, 0, }, + { "", -1, 64, 0, 0, 0, 0, 0, }, + { "", -1, 65, 0, 0, 0, 0, 0, }, + { "", BARCODE_AUSREPLY, 66, 0, 0, 0, 0, 0, }, + { "", BARCODE_AUSROUTE, 67, 0, 0, 0, 0, 0, }, + { "", BARCODE_AUSREDIRECT, 68, 0, 0, 0, 0, 0, }, + { "isbn", BARCODE_ISBNX, 69, 0, 0, 0, 0, 0, }, + { "royalmail", BARCODE_RM4SCC, 70, 0, 0, 0, 0, 0, }, + { "datamatrix", BARCODE_DATAMATRIX, 71, 0, 0, 0, 0, 0, }, + { "ean14", BARCODE_EAN14, 72, 0, 0, 0, 0, 1 /*gs1_cvt*/, }, + { "code39", BARCODE_VIN, 73, 0, 0, 0, 0, 0, }, + { "codablockf", BARCODE_CODABLOCKF, 74, 1, 1, 0, 0, 0, }, + { "sscc18", BARCODE_NVE18, 75, 0, 0, 0, 0, 1 /*gs1_cvt*/, }, + { "japanpost", BARCODE_JAPANPOST, 76, 0, 0, 0, 0, 0, }, + { "", BARCODE_KOREAPOST, 77, 0, 0, 0, 0, 0, }, + { "", -1, 78, 0, 0, 0, 0, 0, }, + { "databarstacked", BARCODE_RSS14STACK, 79, 0, 0, 0, 0, 1 /*gs1_cvt*/, }, + { "databarstackedomni", BARCODE_RSS14STACK_OMNI, 80, 0, 0, 0, 0, 1, }, + { "databarexpandedstacked", BARCODE_RSS_EXPSTACK, 81, 0, 1, 0, 0, 1, }, + { "planet", BARCODE_PLANET, 82, 0, 0, 0, 0, 0, }, + { "", -1, 83, 0, 0, 0, 0, 0, }, + { "micropdf417", BARCODE_MICROPDF417, 84, 0, 0, 0, 0, 0, }, + { "onecode", BARCODE_ONECODE, 85, 0, 0, 0, 0, 0, }, + { "plessey", BARCODE_PLESSEY, 86, 0, 0, 0, 0, 0, }, + { "telepennumeric", BARCODE_TELEPEN_NUM, 87, 0, 0, 0, 0, 0, }, + { "", -1, 88, 0, 0, 0, 0, 0, }, + { "itf14", BARCODE_ITF14, 89, 0, 0, 0, 0, 0, }, + { "kix", BARCODE_KIX, 90, 0, 0, 0, 0, 0, }, + { "", -1, 91, 0, 0, 0, 0, 0, }, + { "azteccode", BARCODE_AZTEC, 92, 0, 0, 0, 0, 0, }, + { "daft", BARCODE_DAFT, 93, 0, 0, 0, 0, 0, }, + { "", -1, 94, 0, 0, 0, 0, 0, }, + { "", -1, 95, 0, 0, 0, 0, 0, }, + { "", -1, 96, 0, 0, 0, 0, 0, }, + { "microqrcode", BARCODE_MICROQR, 97, 0, 0, 0, 0, 0, }, + { "hibccode128", BARCODE_HIBC_128, 98, 0, 0, 0, 0, 0, }, + { "hibccode39", BARCODE_HIBC_39, 99, 0, 0, 0, 0, 0, }, + { "", -1, 100, 0, 0, 0, 0, 0, }, + { "", -1, 101, 0, 0, 0, 0, 0, }, + { "hibcdatamatrix", BARCODE_HIBC_DM, 102, 0, 0, 0, 0, 0, }, + { "", -1, 103, 0, 0, 0, 0, 0, }, + { "hibcqrcode", BARCODE_HIBC_QR, 104, 0, 0, 0, 0, 0, }, + { "", -1, 105, 0, 0, 0, 0, 0, }, + { "hibcpdf417", BARCODE_HIBC_PDF, 106, 0, 0, 0, 0, 0, }, + { "", -1, 107, 0, 0, 0, 0, 0, }, + { "hibcmicropdf417", BARCODE_HIBC_MICPDF, 108, 0, 0, 0, 0, 0, }, + { "", -1, 109, 0, 0, 0, 0, 0, }, + { "hibccodablockf", BARCODE_HIBC_BLOCKF, 110, 1, 1, 0, 0, 0, }, + { "", -1, 111, 0, 0, 0, 0, 0, }, + { "hibcazteccode", BARCODE_HIBC_AZTEC, 112, 0, 0, 0, 0, 0, }, + { "", -1, 113, 0, 0, 0, 0, 0, }, + { "", -1, 114, 0, 0, 0, 0, 0, }, + { "dotcode", BARCODE_DOTCODE, 115, 0, 0, 0, 0, 0, }, + { "hanxin", BARCODE_HANXIN, 116, 0, 0, 0, 0, 0, }, + { "", -1, 117, 0, 0, 0, 0, 0, }, + { "", -1, 118, 0, 0, 0, 0, 0, }, + { "", -1, 119, 0, 0, 0, 0, 0, }, + { "", -1, 120, 0, 0, 0, 0, 0, }, + { "mailmark", BARCODE_MAILMARK, 121, 0, 0, 0, 0, 0, }, + { "", -1, 122, 0, 0, 0, 0, 0, }, + { "", -1, 123, 0, 0, 0, 0, 0, }, + { "", -1, 124, 0, 0, 0, 0, 0, }, + { "", -1, 125, 0, 0, 0, 0, 0, }, + { "", -1, 126, 0, 0, 0, 0, 0, }, + { "", -1, 127, 0, 0, 0, 0, 0, }, + { "aztecrune", BARCODE_AZRUNE, 128, 0, 0, 0, 0, 0, }, + { "code32", BARCODE_CODE32, 129, 0, 0, 0, 0, 0, }, + { "ean13composite", BARCODE_EANX_CC, 130, 1, 0, 0, 72 /*linear_row_height*/, 1 /*gs1_cvt*/, }, + { "gs1-128composite", BARCODE_EAN128_CC, 131, 1, 0, 0, 36, 1, }, + { "databaromnicomposite", BARCODE_RSS14_CC, 132, 1, 0, 0, 33, 1, }, + { "databarlimitedcomposite", BARCODE_RSS_LTD_CC, 133, 1, 0, 0, 0, 1, }, + { "databarexpandedcomposite", BARCODE_RSS_EXP_CC, 134, 1, 1, 0, 0, 1, }, + { "upcacomposite", BARCODE_UPCA_CC, 135, 1, 0, 0, 72, 1, }, + { "upcecomposite", BARCODE_UPCE_CC, 136, 1, 0, 0, 72, 1, }, + { "databarstackedcomposite", BARCODE_RSS14STACK_CC, 137, 1, 0, 0, 0, 1, }, + { "databarstackedomnicomposite", BARCODE_RSS14_OMNI_CC, 138, 1, 0, 0, 0, 1, }, + { "databarexpandedstackedcomposite", BARCODE_RSS_EXPSTACK_CC, 139, 1, 1, 0, 0, 1, }, + { "channelcode", BARCODE_CHANNEL, 140, 0, 0, 0, 0, 0, }, + { "codeone", BARCODE_CODEONE, 141, 0, 0, 0, 0, 0, }, + { "", BARCODE_GRIDMATRIX, 142, 0, 0, 0, 0, 0, }, + { "", BARCODE_UPNQR, 143, 0, 0, 0, 0, 0, }, + { "ultracode", BARCODE_ULTRA, 144, 0, 0, 0, 0, 0, }, + { "rectangularmicroqrcode", BARCODE_RMQR, 145, 0, 0, 0, 0, 0, }, + }; + int data_size = ARRAY_SIZE(data); + + if (symbology < 0 || symbology >= data_size) { + return NULL; + } + if (data[symbology].val != symbology || (data[symbology].define != -1 && data[symbology].define != symbology)) { // Self-check + fprintf(stderr, "testUtilBarcodeName data table out of sync (%d)\n", symbology); + abort(); + } + if (data[symbology].name[0] == '\0') { + return NULL; + } + if ((option_1 != -1 && !data[symbology].can_option_1) || (option_2 != -1 && !data[symbology].can_option_2) + || (option_3 != -1 && !data[symbology].can_option_3)) { + return NULL; + } + + if (symbology == BARCODE_CODE11) { + if (option_2 != 1 && option_2 != 2) { /* 2 check digits (Zint default) not supported */ + return NULL; + } + } else if (symbology == BARCODE_CODABLOCKF || symbology == BARCODE_HIBC_BLOCKF) { + if (option_1 == 1) { /* Single row i.e. CODE128 not supported */ + return NULL; + } + } + + if (linear_row_height) { + *linear_row_height = data[symbology].linear_row_height; + } + if (gs1_cvt) { + *gs1_cvt = data[symbology].gs1_cvt; + } + + return data[symbology].name; +} + +int testUtilCanBwipp(int symbology, int option_1, int option_2, int option_3, int debug) { + if (testUtilBwippName(symbology, option_1, option_2, option_3, NULL, NULL) != NULL) { + return 1; + } + if (debug & ZINT_DEBUG_TEST_PRINT) { + printf("testUtilCanBwipp: not supported %s, option_1 %d, option_2 %d, option_3 %d\n", testUtilBarcodeName(symbology), option_1, option_2, option_3); + } + + return 0; +} + +static void testUtilBwippCvtGS1Data(char *bwipp_data) { + char *b; + + for (b = bwipp_data; *b; b++) { + if (*b == '[') { + *b = '('; + } else if (*b == ']') { + *b = ')'; + } + } +} + +static char *testUtilBwippEscape(char *bwipp_data, int bwipp_data_size, const char *data, int length, int *parse) { + char *b = bwipp_data; + char *be = b + bwipp_data_size; + unsigned char *d = (unsigned char *) data; + unsigned char *de = (unsigned char *) data + length; + + *parse = 0; + + while (b < be && d < de) { + if (*d < 0x20 || *d >= 0x7F || *d == '\'') { /* Escape single quote also to avoid having to do proper shell escaping TODO: proper shell escaping */ + sprintf(b, "^%03u", *d++); + b += 4; + *parse = 1; + } else { + *b++ = *d++; + } + } + + if (b == be && d < de) { + fprintf(stderr, "testUtilBwippEscape: bwipp_data buffer full\n"); + return NULL; + } + *b = '\0'; + + return bwipp_data; +} + +#define GS_INITIAL_LEN 35 /* Length of cmd up to -q */ + +int testUtilBwipp(const struct zint_symbol *symbol, int option_1, int option_2, int option_3, const char *data, int length, const char *primary, char *buffer, int buffer_size) { + const char *cmd_fmt = "gs -dNOPAUSE -dBATCH -dNODISPLAY -q -sb=%s -sd='%s' ../tools/bwipp_dump.ps"; + const char *cmd_opts_fmt = "gs -dNOPAUSE -dBATCH -dNODISPLAY -q -sb=%s -sd='%s' -so='%s' ../tools/bwipp_dump.ps"; + const char *cmd_fmt2 = "gs -dNOPAUSE -dBATCH -dNODISPLAY -q -sb=%s -sd='%.2043s' -sd2='%s' ../tools/bwipp_dump.ps"; // If data > 2K + const char *cmd_opts_fmt2 = "gs -dNOPAUSE -dBATCH -dNODISPLAY -q -sb=%s -sd='%.2043s' -sd2='%s' -so='%s' ../tools/bwipp_dump.ps"; + + int symbology = symbol->symbology; + int data_len = length == -1 ? (int) strlen(data) : length; + int primary_len = primary ? (int) strlen(primary) : 0; + int max_data_len = 4 + primary_len + 1 + 1 + data_len * 4; /* 4 AI prefix + primary + '|' + leading zero + escaped data */ + + char cmd[max_data_len + 1024]; + char *bwipp_barcode = NULL; + char *bwipp_opts = NULL; + char bwipp_data[max_data_len + 1]; + char bwipp_opts_buf[512]; + int bwipp_row_height[symbol->rows]; + int linear_row_height; + int gs1_cvt; + + FILE *fp = NULL; + int cnt; + + char *b = buffer; + char *be = buffer + buffer_size; + int r, h; + int parse; + + bwipp_data[0] = bwipp_opts_buf[0] = '\0'; + + bwipp_barcode = testUtilBwippName(symbology, option_1, option_2, option_3, &linear_row_height, &gs1_cvt); + if (!bwipp_barcode) { + fprintf(stderr, "testUtilBwipp: no mapping for %s, option_1 %d, option_2 %d, option_3 %d\n", testUtilBarcodeName(symbology), option_1, option_2, option_3); + return -1; + } + + for (r = 0; r < symbol->rows; r++) { + bwipp_row_height[r] = symbol->row_height[r]; + } + if (linear_row_height) { + bwipp_row_height[symbol->rows - 1] = linear_row_height; + } + + if (is_composite(symbology)) { + if (symbology == BARCODE_EANX_CC && primary_len <= 7) { + bwipp_barcode = "ean8composite"; + } + if (!primary) { + fprintf(stderr, "testUtilBwipp: no primary data given %s\n", testUtilBarcodeName(symbology)); + return -1; + } + if (*primary != '[' && symbology != BARCODE_EANX_CC && symbology != BARCODE_UPCE_CC && symbology != BARCODE_UPCA_CC) { + strcat(bwipp_data, "(01)"); + } + strcat(bwipp_data, primary); + strcat(bwipp_data, "|"); + strcat(bwipp_data, data); + testUtilBwippCvtGS1Data(bwipp_data); + + if (option_1 > 0) { + sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%sccversion=%c", strlen(bwipp_opts_buf) ? " " : "", option_1 == 1 ? 'a' : option_1 == 2 ? 'b' : 'c'); + bwipp_opts = bwipp_opts_buf; + } + if (option_2 > 0) { + sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%ssegments=%d", strlen(bwipp_opts_buf) ? " " : "", option_2 * 2); + bwipp_opts = bwipp_opts_buf; + } + } else { + if (gs1_cvt) { + if (*data != '[') { + strcat(bwipp_data, symbology == BARCODE_NVE18 ? "(00)" : "(01)"); + } + strcat(bwipp_data, data); + testUtilBwippCvtGS1Data(bwipp_data); + + if (option_2 > 0) { + if (symbology == BARCODE_RSS_EXP || symbology == BARCODE_RSS_EXPSTACK) { + sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%ssegments=%d", strlen(bwipp_opts_buf) ? " " : "", option_2 * 2); + bwipp_opts = bwipp_opts_buf; + } + } + } else { + testUtilBwippEscape(bwipp_data, sizeof(bwipp_data), data, data_len, &parse); + if (parse) { + sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%sparse", strlen(bwipp_opts_buf) ? " " : ""); + bwipp_opts = bwipp_opts_buf; + } + + if (symbology == BARCODE_CODE93) { + sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%sincludecheck", strlen(bwipp_opts_buf) ? " " : ""); + if (parse) { + bwipp_barcode = "code93ext"; + } + bwipp_opts = bwipp_opts_buf; + } else if (symbology == BARCODE_PZN) { + sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%spzn8", strlen(bwipp_opts_buf) ? " " : ""); + bwipp_opts = bwipp_opts_buf; + } else if (symbology == BARCODE_TELEPEN_NUM) { + if (data_len & 1) { // Add leading zero + memmove(bwipp_data + 1, bwipp_data, strlen(bwipp_data) + 1); + *bwipp_data = '0'; + } + } else if (symbology == BARCODE_CODABLOCKF || symbology == BARCODE_HIBC_BLOCKF) { + sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%ssepheight=0", strlen(bwipp_opts_buf) ? " " : ""); + if (option_1 > 0) { + sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%srows=%d", strlen(bwipp_opts_buf) ? " " : "", option_1); + } + //} else { /* BWIPP does not really support both row and column given */ + if (option_2 > 0) { + sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%scolumns=%d", strlen(bwipp_opts_buf) ? " " : "", option_2 - 5); + } else { + sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%scolumns=%d", strlen(bwipp_opts_buf) ? " " : "", (symbol->width - 57) / 11); + } + //} + bwipp_opts = bwipp_opts_buf; + } else if (symbology == BARCODE_CODE11 || symbology == BARCODE_CODE39 || symbology == BARCODE_EXCODE39 || symbology == BARCODE_LOGMARS) { + if (option_2 > 0) { + if (option_2 == 1) { + sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%sincludecheck", strlen(bwipp_opts_buf) ? " " : ""); + } + bwipp_opts = bwipp_opts_buf; /* Set always as option_2 == 2 is bwipp default */ + } + } + } + } + + if ((option_1 != -1 || option_2 != -1 || option_3 != -1) && !bwipp_opts) { + fprintf(stderr, "testUtilBwipp: no mapping option_1 %d, option_2 %d, option_3 %d for symbology %s\n", option_1, option_2, option_3, testUtilBarcodeName(symbology)); + return -1; + } + + if (bwipp_opts) { + if (data_len >= 2043) { /* Ghostscript's `arg_str_max` 2048 less "-sd=" */ + sprintf(cmd, cmd_opts_fmt2, bwipp_barcode, bwipp_data, bwipp_data + 2043, bwipp_opts); + } else { + sprintf(cmd, cmd_opts_fmt, bwipp_barcode, bwipp_data, bwipp_opts); + } + } else { + if (data_len >= 2043) { + sprintf(cmd, cmd_fmt2, bwipp_barcode, bwipp_data, bwipp_data + 2043); + } else { + sprintf(cmd, cmd_fmt, bwipp_barcode, bwipp_data); + } + } + + /* Hack in various adjustments */ + if (symbology == BARCODE_RSS14 || symbology == BARCODE_RSS_LTD || symbology == BARCODE_RSS_EXP) { + /* Begin with space */ + memmove(cmd + GS_INITIAL_LEN + 5, cmd + GS_INITIAL_LEN, strlen(cmd) + 1 - GS_INITIAL_LEN); + memcpy(cmd + GS_INITIAL_LEN, " -sbs", 5); + } + if (symbology == BARCODE_CODE11 || symbology == BARCODE_CODE39 || symbology == BARCODE_EXCODE39 || symbology == BARCODE_PZN || symbology == BARCODE_VIN) { + /* Ratio 3 width bar/space -> 2 width */ + memmove(cmd + GS_INITIAL_LEN + 8, cmd + GS_INITIAL_LEN, strlen(cmd) + 1 - GS_INITIAL_LEN); + memcpy(cmd + GS_INITIAL_LEN, " -sr=0.6", 8); + } + if (symbology == BARCODE_CODE11 || symbology == BARCODE_CODE39 || symbology == BARCODE_EXCODE39 || symbology == BARCODE_HIBC_39 + || symbology == BARCODE_LOGMARS || symbology == BARCODE_PZN || symbology == BARCODE_VIN) { + /* End sbs loop on bar */ + memmove(cmd + GS_INITIAL_LEN + 6, cmd + GS_INITIAL_LEN, strlen(cmd) + 1 - GS_INITIAL_LEN); + memcpy(cmd + GS_INITIAL_LEN, " -selb", 6); + } + + if (symbol->debug & ZINT_DEBUG_TEST_PRINT) { + printf("testUtilBwipp: cmd %s\n", cmd); + } + + fp = popen(cmd, "r"); + if (!fp) { + fprintf(stderr, "testUtilBwipp: failed to run '%s'\n", cmd); + return -1; + } + + for (r = 0; r < symbol->rows; r++) { + if (b + symbol->width > be) { + fprintf(stderr, "testUtilBwipp: row %d, width %d, row width iteration overrun (%s)\n", r, symbol->width, cmd); + pclose(fp); + return -1; + } + cnt = fread(b, 1, symbol->width, fp); + if (cnt != symbol->width) { + fprintf(stderr, "testUtilBwipp: failed to read symbol->width %d bytes, cnt %d (%s)\n", symbol->width, cnt, cmd); + pclose(fp); + return -1; + } + b += cnt; + for (h = bwipp_row_height[r]; h > 1; h--) { /* Ignore row copies if any */ + cnt = fread(b, 1, symbol->width, fp); + if (cnt != symbol->width) { + fprintf(stderr, "testUtilBwipp: failed to read/ignore symbol->width %d bytes, cnt %d (%s)\n", symbol->width, cnt, cmd); + pclose(fp); + return -1; + } + } + } + *b = '\0'; + + if (fgetc(fp) != EOF) { + fprintf(stderr, "testUtilBwipp: failed to read full stream (%s)\n", cmd); + pclose(fp); + return -1; + } + + pclose(fp); + + return 0; +} + +int testUtilBwippCmp(const struct zint_symbol *symbol, char *msg, const char *bwipp_buf, const char *expected) { + int bwipp_len = strlen(bwipp_buf); + int expected_len = strlen(expected); + int ret_memcmp; + int i; + + (void)symbol; + + if (bwipp_len != expected_len) { + sprintf(msg, "bwipp_len %d != expected_len %d", bwipp_len, expected_len); + return 2; + } + + ret_memcmp = memcmp(bwipp_buf, expected, expected_len); + if (ret_memcmp != 0) { + for (i = 0; i < expected_len; i++) { + if (bwipp_buf[i] != expected[i]) { + break; + } + } + sprintf(msg, "bwipp memcmp %d != 0, at %d, len %d", ret_memcmp, i, expected_len); + return ret_memcmp; + } + + return 0; +} + +int testUtilBwippCmpRow(const struct zint_symbol *symbol, int row, char *msg, const char *bwipp_buf, const char *expected) { + int bwipp_len = strlen(bwipp_buf); + int expected_len = strlen(expected); + int ret_memcmp; + int i, j; + + (void)symbol; + + if (bwipp_len != expected_len * symbol->rows) { + sprintf(msg, "bwipp_len %d != expected_len %d * symbol->rows %d", bwipp_len, expected_len, symbol->rows); + return 2; + } + + ret_memcmp = memcmp(bwipp_buf + expected_len * row, expected, expected_len); + if (ret_memcmp != 0) { + for (i = 0, j = expected_len * row; i < expected_len; i++, j++) { + if (bwipp_buf[j] != expected[i]) { + break; + } + } + sprintf(msg, "bwipp memcmp %d != 0, at %d (%d), len %d", ret_memcmp, i, j, expected_len); + return ret_memcmp; + } + + return 0; +} diff --git a/backend/tests/testcommon.h b/backend/tests/testcommon.h index b6047696..ac690b8a 100644 --- a/backend/tests/testcommon.h +++ b/backend/tests/testcommon.h @@ -69,6 +69,11 @@ void testRun(int argc, char *argv[], testFunction funcs[], int funcs_size); #define assert_fail(...) assert_exp(0, __VA_ARGS__) #define assert_nothing(__exp__, ...) {printf(__VA_ARGS__); __exp__;} +#define ZINT_DEBUG_TEST_PRINT 16 +#define ZINT_DEBUG_TEST_LESS_NOISY 32 +#define ZINT_DEBUG_TEST_KEEP_OUTFILE 64 +#define ZINT_DEBUG_TEST_BWIPP 128 + extern void vector_free(struct zint_symbol *symbol); /* Free vector structures */ int testUtilSetSymbol(struct zint_symbol *symbol, int symbology, int input_mode, int eci, int option_1, int option_2, int option_3, int output_options, char *data, int length, int debug); @@ -104,5 +109,9 @@ int testUtilHaveInkscape(); int testUtilVerifyInkscape(char *filename, int debug); int testUtilHaveGhostscript(); int testUtilVerifyGhostscript(char *filename, int debug); +int testUtilCanBwipp(int symbology, int option_1, int option_2, int option_3, int debug); +int testUtilBwipp(const struct zint_symbol *symbol, int option_1, int option_2, int option_3, const char *data, int length, const char *primary, char *buffer, int buffer_size); +int testUtilBwippCmp(const struct zint_symbol *symbol, char *msg, const char *bwipp_buf, const char *expected); +int testUtilBwippCmpRow(const struct zint_symbol *symbol, int row, char *msg, const char *bwipp_buf, const char *expected); #endif /* TESTCOMMON_H */ diff --git a/backend/tests/tools/bwipp_dump-barcode.ps.diff b/backend/tests/tools/bwipp_dump-barcode.ps.diff new file mode 100644 index 00000000..fb044787 --- /dev/null +++ b/backend/tests/tools/bwipp_dump-barcode.ps.diff @@ -0,0 +1,1154 @@ +--- ../../../../postscriptbarcode/build/monolithic/barcode.ps 2020-07-10 13:08:57.215118693 +0100 ++++ ../tools/bwipp_dump.ps 2020-07-10 13:44:00.892056648 +0100 +@@ -29,6 +29,8 @@ + % CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + % IN THE SOFTWARE. + ++% vim: set ts=4 sw=4 et : ++ + % --BEGIN TEMPLATE-- + + % --BEGIN RESOURCE preamble-- +@@ -24484,34 +24486,72 @@ + pop + } ifelse + +- gsave ++ dontdraw not { gsave } if + + options (lintype) (ean13) put + options (inkspread) (0) put + options (dontdraw) true put + + % Plot the linear part +- linear options //ean13 exec //renlinear exec ++ linear options //ean13 exec ++ dontdraw not { ++ //renlinear exec ++ ++ % Plot the separator ++ -1 72 rmoveto << ++ /ren //renmatrix ++ /pixs [ ++ 0 1 93 {0} repeat 1 0 ++ 1 0 93 {0} repeat 0 1 ++ 0 1 93 {0} repeat 1 0 ++ ] ++ /pixx 97 ++ /pixy 3 ++ /height 6 72 div ++ /width 97 72 div ++ /opt options ++ >> //renmatrix exec + +- % Plot the separator +- -1 72 rmoveto << +- /ren //renmatrix +- /pixs [ +- 0 1 93 {0} repeat 1 0 +- 1 0 93 {0} repeat 0 1 +- 0 1 93 {0} repeat 1 0 +- ] +- /pixx 97 +- /pixy 3 +- /height 6 72 div +- /width 97 72 div +- /opt options +- >> //renmatrix exec ++ % Plot the 2D part ++ -2 6 rmoveto comp options //gs1-cc exec //renmatrix exec + +- % Plot the 2D part +- -2 6 rmoveto comp options //gs1-cc exec //renmatrix exec ++ grestore ++ } { ++ /linsym exch def ++ /linpixs [ ++ linsym /sbs get { 1 index 1 eq {{0}} {{1}} ifelse repeat } forall % Alternates x 1/0's ++ ] def ++ /linheight linsym /bhs get 0 get 72 mul cvi def + +- grestore ++ /compsym comp options //gs1-cc exec def ++ /ccpixs compsym /pixs get def ++ /ccpixx compsym /pixx get def ++ ++ /linpad [ ccpixx 97 sub {0} repeat ] def ++ ++ /pixs [ ++ 0 ccpixx ccpixs length 1 sub { ++ /i exch def ++ 2 { ccpixs i ccpixx getinterval aload pop } repeat ++ } for ++ 2 { linpad aload pop 0 1 93 {0} repeat 1 0 } repeat ++ 2 { linpad aload pop 1 0 93 {0} repeat 0 1 } repeat ++ 2 { linpad aload pop 0 1 93 {0} repeat 1 0 } repeat ++ linheight { linpad aload pop 0 linpixs aload pop 0 } repeat ++ ] def ++ ++ /pixx ccpixx def ++ /pixy pixs length pixx idiv def ++ << ++ /ren //renmatrix ++ /pixs pixs ++ /pixx pixx ++ /pixy pixy ++ /height pixy 72 div ++ /width pixx 72 div ++ /opt options ++ >> ++ } ifelse + + end + +@@ -24570,7 +24610,7 @@ + pop + } ifelse + +- gsave ++ dontdraw not { gsave } if + + % Get the result of encoding with ean8 and gs1-cc + options (lintype) (ean8) put +@@ -24578,29 +24618,67 @@ + options (dontdraw) true put + + % Plot the linear part +- linear options //ean8 exec //renlinear exec ++ linear options //ean8 exec ++ dontdraw not { ++ //renlinear exec ++ ++ % Plot the separator ++ -1 72 rmoveto << ++ /ren //renmatrix ++ /pixs [ ++ 0 1 65 {0} repeat 1 0 ++ 1 0 65 {0} repeat 0 1 ++ 0 1 65 {0} repeat 1 0 ++ ] ++ /pixx 69 ++ /pixy 3 ++ /height 6 72 div ++ /width 69 72 div ++ /opt options ++ >> //renmatrix exec ++ ++ % Plot the 2D part ++ comp options //gs1-cc exec ++ dup (pixx) get 69 exch sub 6 rmoveto ++ //renmatrix exec + +- % Plot the separator +- -1 72 rmoveto << +- /ren //renmatrix +- /pixs [ +- 0 1 65 {0} repeat 1 0 +- 1 0 65 {0} repeat 0 1 +- 0 1 65 {0} repeat 1 0 +- ] +- /pixx 69 +- /pixy 3 +- /height 6 72 div +- /width 69 72 div +- /opt options +- >> //renmatrix exec ++ grestore ++ } { ++ /linsym exch def ++ /linpixs [ ++ linsym /sbs get { 1 index 1 eq {{0}} {{1}} ifelse repeat } forall % Alternates x 1/0's ++ ] def ++ /linheight linsym /bhs get 0 get 72 mul cvi def + +- % Plot the 2D part +- comp options //gs1-cc exec +- dup (pixx) get 69 exch sub 6 rmoveto +- //renmatrix exec ++ /compsym comp options //gs1-cc exec def ++ /ccpixs compsym /pixs get def ++ /ccpixx compsym /pixx get def + +- grestore ++ /linpad [ ccpixx 69 sub {0} repeat ] def ++ ++ /pixs [ ++ 0 ccpixx ccpixs length 1 sub { ++ /i exch def ++ 2 { ccpixs i ccpixx getinterval aload pop } repeat ++ } for ++ 2 { linpad aload pop 0 1 65 {0} repeat 1 0 } repeat ++ 2 { linpad aload pop 1 0 65 {0} repeat 0 1 } repeat ++ 2 { linpad aload pop 0 1 65 {0} repeat 1 0 } repeat ++ linheight { linpad aload pop 0 linpixs aload pop 0 } repeat ++ ] def ++ ++ /pixx ccpixx def ++ /pixy pixs length pixx idiv def ++ << ++ /ren //renmatrix ++ /pixs pixs ++ /pixx pixx ++ /pixy pixy ++ /height pixy 72 div ++ /width pixx 72 div ++ /opt options ++ >> ++ } ifelse + + end + +@@ -24659,34 +24737,72 @@ + pop + } ifelse + +- gsave ++ dontdraw not { gsave } if + + options (lintype) (ean13) put + options (inkspread) (0) put + options (dontdraw) true put + + % Plot the linear part +- linear options //upca exec //renlinear exec ++ linear options //upca exec ++ dontdraw not { ++ //renlinear exec ++ ++ % Plot the separator ++ -1 72 rmoveto << ++ /ren //renmatrix ++ /pixs [ ++ 0 1 93 {0} repeat 1 0 ++ 1 0 93 {0} repeat 0 1 ++ 0 1 93 {0} repeat 1 0 ++ ] ++ /pixx 97 ++ /pixy 3 ++ /height 6 72 div ++ /width 97 72 div ++ /opt options ++ >> //renmatrix exec + +- % Plot the separator +- -1 72 rmoveto << +- /ren //renmatrix +- /pixs [ +- 0 1 93 {0} repeat 1 0 +- 1 0 93 {0} repeat 0 1 +- 0 1 93 {0} repeat 1 0 +- ] +- /pixx 97 +- /pixy 3 +- /height 6 72 div +- /width 97 72 div +- /opt options +- >> //renmatrix exec ++ % Plot the 2D part ++ -2 6 rmoveto comp options //gs1-cc exec //renmatrix exec + +- % Plot the 2D part +- -2 6 rmoveto comp options //gs1-cc exec //renmatrix exec ++ grestore ++ } { ++ /linsym exch def ++ /linpixs [ ++ linsym /sbs get { 1 index 1 eq {{0}} {{1}} ifelse repeat } forall % Alternates x 1/0's ++ ] def ++ /linheight linsym /bhs get 0 get 72 mul cvi def + +- grestore ++ /compsym comp options //gs1-cc exec def ++ /ccpixs compsym /pixs get def ++ /ccpixx compsym /pixx get def ++ ++ /linpad [ ccpixx 97 sub {0} repeat ] def ++ ++ /pixs [ ++ 0 ccpixx ccpixs length 1 sub { ++ /i exch def ++ 2 { ccpixs i ccpixx getinterval aload pop } repeat ++ } for ++ 2 { linpad aload pop 0 1 93 {0} repeat 1 0 } repeat ++ 2 { linpad aload pop 1 0 93 {0} repeat 0 1 } repeat ++ 2 { linpad aload pop 0 1 93 {0} repeat 1 0 } repeat ++ linheight { linpad aload pop 0 linpixs aload pop 0 } repeat ++ ] def ++ ++ /pixx ccpixx def ++ /pixy pixs length pixx idiv def ++ << ++ /ren //renmatrix ++ /pixs pixs ++ /pixx pixx ++ /pixy pixy ++ /height pixy 72 div ++ /width pixx 72 div ++ /opt options ++ >> ++ } ifelse + + end + +@@ -24760,34 +24876,72 @@ + /opt options + >> def + +- gsave ++ dontdraw not { gsave } if + + options (lintype) (upce) put + options (inkspread) (0) put + options (dontdraw) true put + + % Plot the linear part +- linear options //upce exec //renlinear exec ++ linear options //upce exec ++ dontdraw not { ++ //renlinear exec ++ ++ % Plot the separator ++ -1 72 rmoveto << ++ /ren //renmatrix ++ /pixs [ ++ 0 1 49 {0} repeat 1 0 ++ 1 0 49 {0} repeat 0 1 ++ 0 1 49 {0} repeat 1 0 ++ ] ++ /pixx 53 ++ /pixy 3 ++ /height 6 72 div ++ /width 53 72 div ++ /opt options ++ >> //renmatrix exec + +- % Plot the separator +- -1 72 rmoveto << +- /ren //renmatrix +- /pixs [ +- 0 1 49 {0} repeat 1 0 +- 1 0 49 {0} repeat 0 1 +- 0 1 49 {0} repeat 1 0 +- ] +- /pixx 53 +- /pixy 3 +- /height 6 72 div +- /width 53 72 div +- /opt options +- >> //renmatrix exec ++ % Plot the 2D part ++ -2 6 rmoveto comp options //gs1-cc exec //renmatrix exec + +- % Plot the 2D part +- -2 6 rmoveto comp options //gs1-cc exec //renmatrix exec ++ grestore ++ } { ++ /linsym exch def ++ /linpixs [ ++ linsym /sbs get { 1 index 1 eq {{0}} {{1}} ifelse repeat } forall % Alternates x 1/0's ++ ] def ++ /linheight linsym /bhs get 0 get 72 mul cvi def + +- grestore ++ /compsym comp options //gs1-cc exec def ++ /ccpixs compsym /pixs get def ++ /ccpixx compsym /pixx get def ++ ++ /linpad [ ccpixx 53 sub {0} repeat ] def ++ ++ /pixs [ ++ 0 ccpixx ccpixs length 1 sub { ++ /i exch def ++ 2 { ccpixs i ccpixx getinterval aload pop } repeat ++ } for ++ 2 { linpad aload pop 0 1 49 {0} repeat 1 0 } repeat ++ 2 { linpad aload pop 1 0 49 {0} repeat 0 1 } repeat ++ 2 { linpad aload pop 0 1 49 {0} repeat 1 0 } repeat ++ linheight { linpad aload pop 0 linpixs aload pop 0 } repeat ++ ] def ++ ++ /pixx ccpixx def ++ /pixy pixs length pixx idiv def ++ << ++ /ren //renmatrix ++ /pixs pixs ++ /pixx pixx ++ /pixy pixy ++ /height pixy 72 div ++ /width pixx 72 div ++ /opt options ++ >> ++ } ifelse + + end + +@@ -24846,7 +25000,7 @@ + pop + } ifelse + +- gsave ++ dontdraw not { gsave } if + + options (lintype) (databaromni) put + options (linkage) true put +@@ -24857,7 +25011,7 @@ + linear options //databaromni exec + dup (sbs) get /linsbs exch def + dup (bhs) get 0 get 72 mul /linheight exch def +- //renlinear exec ++ dontdraw not { //renlinear exec } { pop } ifelse + + % Plot the separator + /sepfinder { +@@ -24888,20 +25042,66 @@ + sep 0 [0 0 0] putinterval + sep sep length 4 sub [0 0 0 0] putinterval + 18 sepfinder 64 sepfinder +- 0 linheight rmoveto << +- /ren //renmatrix +- /pixs sep +- /pixx sep length +- /pixy 1 +- /height 1 72 div +- /width sep length 72 div +- /opt options +- >> //renmatrix exec ++ dontdraw not { ++ 0 linheight rmoveto << ++ /ren //renmatrix ++ /pixs sep ++ /pixx sep length ++ /pixy 1 ++ /height 1 72 div ++ /width sep length 72 div ++ /opt options ++ >> //renmatrix exec + +- % Plot the 2D part +- -5 1 rmoveto comp options //gs1-cc exec //renmatrix exec ++ % Plot the 2D part ++ -5 1 rmoveto comp options //gs1-cc exec //renmatrix exec + +- grestore ++ grestore ++ } { ++ /compsym comp options //gs1-cc exec def ++ /ccpixs compsym /pixs get def ++ /ccpixx compsym /pixx get def ++ ++ /linpixs [ 0 % Begin with left guard space ++ linsbs { 1 index 0 eq {{1}} {{0}} ifelse repeat } forall % Alternates x 1/0's ++ ] def ++ /sep [ 0 sep aload pop ] def % Pad with left guard space ++ ++ /linheight linheight cvi def ++ /diff linpixs length ccpixx sub def ++ diff 0 gt { % Centre align composite, doubling up rows ++ /ccpad [ diff 2 idiv {0} repeat ] def ++ /pixs [ ++ 0 ccpixx ccpixs length 1 sub { ++ /i exch def ++ 2 { ccpad aload pop ccpixs i ccpixx getinterval aload pop ccpad aload pop } repeat ++ } for ++ sep aload pop linheight { linpixs aload pop } repeat ++ ] def ++ /pixx linpixs length def ++ } { % Right pad composite, doubling up rows, and left pad (right align) separator/linear ++ /linpad [ diff neg 1 add {0} repeat ] def ++ /pixs [ ++ 0 ccpixx ccpixs length 1 sub { % Right pad composite with 1 space ++ /i exch def ++ 2 { ccpixs i ccpixx getinterval aload pop 0 } repeat ++ } for ++ linpad aload pop sep aload pop linheight { linpad aload pop linpixs aload pop } repeat ++ ] def ++ /pixx ccpixx 1 add def ++ } ifelse ++ ++ /pixy pixs length pixx idiv def ++ << ++ /ren //renmatrix ++ /pixs pixs ++ /pixx pixx ++ /pixy pixy ++ /height pixy 72 div ++ /width pixx 72 div ++ /opt options ++ >> ++ } ifelse + + end + +@@ -24959,7 +25159,7 @@ + pop + } ifelse + +- gsave ++ dontdraw not { gsave } if + + options (lintype) (databarstacked) put + options (linkage) true put +@@ -24970,7 +25170,7 @@ + linear options //databarstacked exec + dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def + dup (pixy) get /linheight exch def +- //renmatrix exec ++ dontdraw not { //renmatrix exec } { /pixs get /linpixs exch def } ifelse + + % Plot the separator + /sepfinder { +@@ -24998,20 +25198,52 @@ + sep 0 [ 0 0 0 0 ] putinterval + sep sep length 4 sub [ 0 0 0 0 ] putinterval + 18 sepfinder +- 0 linheight rmoveto << +- /ren //renmatrix +- /pixs sep +- /pixx sep length +- /pixy 1 +- /height 1 72 div +- /width sep length 72 div +- /opt options +- >> //renmatrix exec ++ dontdraw not { ++ 0 linheight rmoveto << ++ /ren //renmatrix ++ /pixs sep ++ /pixx sep length ++ /pixy 1 ++ /height 1 72 div ++ /width sep length 72 div ++ /opt options ++ >> //renmatrix exec + +- % Plot the 2D part +- 1 1 rmoveto comp options //gs1-cc exec //renmatrix exec ++ % Plot the 2D part ++ 1 1 rmoveto comp options //gs1-cc exec //renmatrix exec + +- grestore ++ grestore ++ } { ++ /compsym comp options //gs1-cc exec def ++ /ccpixs compsym /pixs get def ++ /ccpixx compsym /pixx get def ++ ++ /linwidth sep length def ++ /pixx ccpixx 1 add def ++ /linpad [ pixx linwidth sub {0} repeat ] def ++ /pixs [ ++ 0 ccpixx ccpixs length 1 sub { % Left pad composite with 1 space, doubling up rows ++ /i exch def ++ 2 { 0 ccpixs i ccpixx getinterval aload pop } repeat ++ } for ++ sep aload pop linpad aload pop ++ 0 linwidth linpixs length 1 sub { % Right pad linear ++ /i exch def ++ linpixs i linwidth getinterval aload pop linpad aload pop ++ } for ++ ] def ++ ++ /pixy pixs length pixx idiv def ++ << ++ /ren //renmatrix ++ /pixs pixs ++ /pixx pixx ++ /pixy pixy ++ /height pixy 72 div ++ /width pixx 72 div ++ /opt options ++ >> ++ } ifelse + + end + +@@ -25069,7 +25301,7 @@ + pop + } ifelse + +- gsave ++ dontdraw not { gsave } if + + options (lintype) (databarstackedomni) put + options (linkage) true put +@@ -25080,7 +25312,7 @@ + linear options //databarstackedomni exec + dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def + dup (pixy) get /linheight exch def +- //renmatrix exec ++ dontdraw not { //renmatrix exec } { /pixs get /linpixs exch def } ifelse + + % Plot the separator + /sepfinder { +@@ -25108,20 +25340,52 @@ + sep 0 [ 0 0 0 0 ] putinterval + sep sep length 4 sub [ 0 0 0 0 ] putinterval + 18 sepfinder +- 0 linheight rmoveto << +- /ren //renmatrix +- /pixs sep +- /pixx sep length +- /pixy 1 +- /height 1 72 div +- /width sep length 72 div +- /opt options +- >> //renmatrix exec ++ dontdraw not { ++ 0 linheight rmoveto << ++ /ren //renmatrix ++ /pixs sep ++ /pixx sep length ++ /pixy 1 ++ /height 1 72 div ++ /width sep length 72 div ++ /opt options ++ >> //renmatrix exec + +- % Plot the 2D part +- 1 1 rmoveto comp options //gs1-cc exec //renmatrix exec ++ % Plot the 2D part ++ 1 1 rmoveto comp options //gs1-cc exec //renmatrix exec + +- grestore ++ grestore ++ } { ++ /compsym comp options //gs1-cc exec def ++ /ccpixs compsym /pixs get def ++ /ccpixx compsym /pixx get def ++ ++ /linwidth sep length def ++ /pixx ccpixx 1 add def ++ /linpad [ pixx linwidth sub {0} repeat ] def ++ /pixs [ ++ 0 ccpixx ccpixs length 1 sub { % Left pad composite with 1 space, doubling up rows ++ /i exch def ++ 2 { 0 ccpixs i ccpixx getinterval aload pop } repeat ++ } for ++ sep aload pop linpad aload pop ++ 0 linwidth linpixs length 1 sub { % Right pad linear ++ /i exch def ++ linpixs i linwidth getinterval aload pop linpad aload pop ++ } for ++ ] def ++ ++ /pixy pixs length pixx idiv def ++ << ++ /ren //renmatrix ++ /pixs pixs ++ /pixx pixx ++ /pixy pixy ++ /height pixy 72 div ++ /width pixx 72 div ++ /opt options ++ >> ++ } ifelse + + end + +@@ -25294,7 +25558,7 @@ + pop + } ifelse + +- gsave ++ dontdraw not { gsave } if + + options (lintype) (databarlimited) put + options (linkage) true put +@@ -25305,7 +25569,7 @@ + linear options //databarlimited exec + dup (sbs) get /linsbs exch def + dup (bhs) get 0 get 72 mul /linheight exch def +- //renlinear exec ++ dontdraw not { //renlinear exec } { pop } ifelse + + % Plot the separator + mark +@@ -25313,22 +25577,68 @@ + counttomark 1 sub array astore /sep exch def pop pop + sep 0 [0 0 0] putinterval + sep sep length 4 sub [0 0 0 0] putinterval +- 0 linheight rmoveto << +- /ren //renmatrix +- /pixs sep +- /pixx sep length +- /pixy 1 +- /height 1 72 div +- /width sep length 72 div +- /opt options +- >> //renmatrix exec ++ dontdraw not { ++ 0 linheight rmoveto << ++ /ren //renmatrix ++ /pixs sep ++ /pixx sep length ++ /pixy 1 ++ /height 1 72 div ++ /width sep length 72 div ++ /opt options ++ >> //renmatrix exec ++ ++ % Plot the 2D part ++ comp options //gs1-cc exec ++ dup (pixx) get 72 exch sub 1 rmoveto ++ //renmatrix exec + +- % Plot the 2D part +- comp options //gs1-cc exec +- dup (pixx) get 72 exch sub 1 rmoveto +- //renmatrix exec ++ grestore ++ } { ++ /compsym comp options //gs1-cc exec def ++ /ccpixs compsym /pixs get def ++ /ccpixx compsym /pixx get def + +- grestore ++ /linpixs [ 0 % Begin with left guard space ++ linsbs { 1 index 0 eq {{1}} {{0}} ifelse repeat } forall % Alternates x 1/0's ++ ] def ++ /sep [ 0 sep aload pop ] def % Offset by 1 ++ ++ /linheight linheight cvi def ++ /diff linpixs length ccpixx sub def ++ diff 0 gt { % 2 column - centre align ++ /ccpad [ diff 2 idiv {0} repeat ] def ++ /pixs [ ++ 0 ccpixx ccpixs length 1 sub { ++ /i exch def ++ 2 { ccpad aload pop ccpixs i ccpixx getinterval aload pop ccpad aload pop } repeat ++ } for ++ sep aload pop linheight { linpixs aload pop } repeat ++ ] def ++ /pixx linpixs length def ++ } { % 3/4 column - right pad 1 and right align separator/linear ++ /linpad [ diff neg 1 add {0} repeat ] def ++ /pixs [ ++ 0 ccpixx ccpixs length 1 sub { % Right pad composite with 1 space ++ /i exch def ++ 2 { ccpixs i ccpixx getinterval aload pop 0 } repeat ++ } for ++ linpad aload pop sep aload pop linheight { linpad aload pop linpixs aload pop } repeat ++ ] def ++ /pixx ccpixx 1 add def ++ } ifelse ++ ++ /pixy pixs length pixx idiv def ++ << ++ /ren //renmatrix ++ /pixs pixs ++ /pixx pixx ++ /pixy pixy ++ /height pixy 72 div ++ /width pixx 72 div ++ /opt options ++ >> ++ } ifelse + + end + +@@ -25387,7 +25697,7 @@ + pop + } ifelse + +- gsave ++ dontdraw not { gsave } if + + options (lintype) (databarexpanded) put + options (linkage) true put +@@ -25398,7 +25708,7 @@ + linear options //databarexpanded exec + dup (sbs) get /linsbs exch def + dup (bhs) get 0 get 72 mul /linheight exch def +- //renlinear exec ++ dontdraw not { //renlinear exec } { pop } ifelse + + % Plot the separator + /sepfinder { +@@ -25427,20 +25737,60 @@ + 18 98 bot length 13 sub {} for + 69 98 bot length 13 sub {} for + ] {sepfinder} forall +- 0 linheight rmoveto << +- /ren //renmatrix +- /pixs sep +- /pixx sep length +- /pixy 1 +- /height 1 72 div +- /width sep length 72 div +- /opt options +- >> //renmatrix exec ++ dontdraw not { ++ 0 linheight rmoveto << ++ /ren //renmatrix ++ /pixs sep ++ /pixx sep length ++ /pixy 1 ++ /height 1 72 div ++ /width sep length 72 div ++ /opt options ++ >> //renmatrix exec + +- % Plot the 2D part +- 1 1 rmoveto comp options //gs1-cc exec //renmatrix exec ++ % Plot the 2D part ++ 1 1 rmoveto comp options //gs1-cc exec //renmatrix exec + +- grestore ++ grestore ++ } { ++ /compsym comp options //gs1-cc exec def ++ /ccpixs compsym /pixs get def ++ /ccpixx compsym /pixx get def ++ ++ /linpixs [ 0 % Begin with left guard space ++ linsbs { 1 index 0 eq {{1}} {{0}} ifelse repeat } forall % Alternates x 1/0's ++ ] def ++ /sep [ 0 sep aload pop ] def % Offset by 1 ++ ++ /linheight linheight cvi def ++ /diff linpixs length ccpixx sub def ++ diff 2 ge { ++ /cclpad [ 0 0 ] def ++ /ccrpad [ diff 2 sub {0} repeat ] def ++ } { ++ /cclpad [ diff {0} repeat ] def ++ /ccrpad 0 array def ++ } ifelse ++ /pixs [ ++ 0 ccpixx ccpixs length 1 sub { ++ /i exch def ++ 2 { cclpad aload pop ccpixs i ccpixx getinterval aload pop ccrpad aload pop } repeat ++ } for ++ sep aload pop linheight { linpixs aload pop } repeat ++ ] def ++ ++ /pixx linpixs length def ++ /pixy pixs length pixx idiv def ++ << ++ /ren //renmatrix ++ /pixs pixs ++ /pixx pixx ++ /pixy pixy ++ /height pixy 72 div ++ /width pixx 72 div ++ /opt options ++ >> ++ } ifelse + + end + +@@ -25498,7 +25848,7 @@ + pop + } ifelse + +- gsave ++ dontdraw not { gsave } if + + options (lintype) (databarexpandedstacked) put + options (linkage) true put +@@ -25509,7 +25859,7 @@ + linear options //databarexpandedstacked exec + dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def + dup (pixy) get /linheight exch def +- //renmatrix exec ++ dontdraw not { //renmatrix exec } { /pixs get /linpixs exch def } ifelse + + % Plot the separator + /sepfinder { +@@ -25529,27 +25879,55 @@ + } for + } bind def + /sep [ bot {1 exch sub} forall ] def +- sep 0 [ 0 0 0 ] putinterval ++ sep 0 [ 0 0 0 0 ] putinterval + sep sep length 4 sub [ 0 0 0 0 ] putinterval + [ % Finder pattern module positions + 19 98 bot length 13 sub {} for + 70 98 bot length 13 sub {} for + ] {sepfinder} forall +- 0 linheight rmoveto << +- /ren //renmatrix +- /pixs sep +- /pixx sep length +- /pixy 1 +- /height 1 72 div +- /width sep length 72 div +- /opt options +- >> //renmatrix exec ++ dontdraw not { ++ 0 linheight rmoveto << ++ /ren //renmatrix ++ /pixs sep ++ /pixx sep length ++ /pixy 1 ++ /height 1 72 div ++ /width sep length 72 div ++ /opt options ++ >> //renmatrix exec ++ ++ % Plot the 2D part ++ bot 0 get 0 eq {2} {0} ifelse 1 rmoveto ++ comp options //gs1-cc exec //renmatrix exec + +- % Plot the 2D part +- bot 0 get 0 eq {2} {0} ifelse 1 rmoveto +- comp options //gs1-cc exec //renmatrix exec ++ grestore ++ } { ++ /compsym comp options //gs1-cc exec def ++ /ccpixs compsym /pixs get def ++ /ccpixx compsym /pixx get def ++ ++ /pixx sep length def ++ /cclpad [ pixx ccpixx sub 1 add 2 idiv {0} repeat ] def % Add 1 to allow for odd difference ++ /ccrpad [ pixx ccpixx sub 2 idiv {0} repeat ] def ++ /pixs [ ++ 0 ccpixx ccpixs length 1 sub { % Centre align composite ++ /i exch def ++ 2 { cclpad aload pop ccpixs i ccpixx getinterval aload pop ccrpad aload pop } repeat ++ } for ++ sep aload pop linpixs aload pop ++ ] def + +- grestore ++ /pixy pixs length pixx idiv def ++ << ++ /ren //renmatrix ++ /pixs pixs ++ /pixx pixx ++ /pixy pixy ++ /height pixy 72 div ++ /width pixx 72 div ++ /opt options ++ >> ++ } ifelse + + end + +@@ -25608,7 +25986,7 @@ + pop + } ifelse + +- gsave ++ dontdraw not { gsave } if + + options (inkspread) (0) put + options (dontdraw) true put +@@ -25635,35 +26013,87 @@ + linear << options {} forall >> //gs1-128 exec + dup (sbs) get /linsbs exch def + dup (bhs) get 0 get 72 mul /linheight exch def +- //renlinear exec ++ dontdraw not { //renlinear exec } { pop } ifelse + + % Plot the separator + mark + 1 linsbs {1 index 0 eq {{1}} {{0}} ifelse repeat} forall + counttomark 1 sub array astore /sep exch def pop pop +- 0 linheight rmoveto << +- /ren //renmatrix +- /pixs sep +- /pixx sep length +- /pixy 1 +- /height 1 72 div +- /width sep length 72 div +- /opt options +- >> //renmatrix exec ++ dontdraw not { ++ 0 linheight rmoveto << ++ /ren //renmatrix ++ /pixs sep ++ /pixx sep length ++ /pixy 1 ++ /height 1 72 div ++ /width sep length 72 div ++ /opt options ++ >> //renmatrix exec ++ } if + + % Plot the 2D part + linktype (a) eq { + /s linwidth 2 sub 11 idiv def + /p s 9 sub 2 idiv def + /x s p sub 1 sub 11 mul 10 add p 0 eq {2 add} if 99 sub def +- x 1 rmoveto ++ dontdraw not { x 1 rmoveto } if + } { +- -7 1 rmoveto ++ dontdraw not { -7 1 rmoveto } { /x -7 def } ifelse + } ifelse + +- compsym //renmatrix exec ++ dontdraw not { ++ compsym //renmatrix exec + +- grestore ++ grestore ++ } { ++ /ccpixs compsym /pixs get def ++ /ccpixx compsym /pixx get def ++ ++ /linpixs [ ++ linsbs { 1 index 1 eq {{0}} {{1}} ifelse repeat } forall % Alternates x 1/0's ++ ] def ++ ++ x 0 gt { % Left pad composite ++ /cclpad [ x {0} repeat ] def ++ /linlpad 0 array def ++ /diff linwidth ccpixx x add sub def ++ } { % Left pad linear ++ /cclpad 0 array def ++ /linlpad [ x neg {0} repeat ] def ++ /diff linwidth x sub ccpixx sub def ++ } ifelse ++ ++ diff 0 gt { % Right pad composite ++ /ccrpad [ diff {0} repeat ] def ++ /linrpad 0 array def ++ } { % Right pad linear ++ /ccrpad 0 array def ++ /linrpad [ diff neg {0} repeat ] def ++ } ifelse ++ ++ /linheight linheight cvi def ++ /ccrepeat linktype (a) eq {2} {3} ifelse def ++ /pixs [ ++ 0 ccpixx ccpixs length 1 sub { ++ /i exch def ++ ccrepeat { cclpad aload pop ccpixs i ccpixx getinterval aload pop ccrpad aload pop } repeat ++ } for ++ linlpad aload pop sep aload pop linrpad aload pop ++ linheight { linlpad aload pop linpixs aload pop linrpad aload pop } repeat ++ ] def ++ ++ /pixx cclpad length ccpixx add ccrpad length add def ++ /pixy pixs length pixx idiv def ++ << ++ /ren //renmatrix ++ /pixs pixs ++ /pixx pixx ++ /pixy pixy ++ /height pixy 72 div ++ /width pixx 72 div ++ /opt options ++ >> ++ } ifelse + + end + +@@ -26961,3 +27391,115 @@ + % --END ENCODER hibcazteccode-- + + % --END TEMPLATE-- ++%!PS ++ ++% To compress: tar cv bwipp_dump.ps | xz -e9 > bwipp_dump.ps.tar.xz ++ ++% Dumps bwipp barcode binary to stdout. If `-sn` given, appends a newline after each symbol row, otherwise doesn't. ++% ++% To run e.g. gs -dNOPAUSE -dBATCH -dNODISPLAY -q -sb=databarexpanded -sd='(01)98898765432106' -so='includetext segments=6' bwipp_dump.ps ++% where ++% `-sb=` is the bwipp barcode routine name ++% `-sd=` is the data (`sd2=` is also available for overspill data > 2K to get around Ghostscript arg_str_max) ++% `-so=` are options (as space separated key=val pairs (or just key if boolean true)) ++ ++% Command line "-s" options put into system dictionary as strings ++/n systemdict /n known def ++ ++% Append d2 to d if given ++systemdict /d2 known { ++ /d d length d2 length add string dup dup 0 d putinterval d length d2 putinterval def ++} if ++ ++% Strip start/end parens from data if any ++d 0 1 getinterval (\() eq d d length 1 sub 1 getinterval (\)) eq and { ++ /d d 1 d length 2 sub getinterval d length 2 sub string copy def ++} if ++ ++% Options ++systemdict /o known { ++ o type /stringtype eq o length 0 gt and { ++ o length 2 ge { ++ % Strip start/end parens from options if any ++ o 0 1 getinterval (\() eq o o length 1 sub 1 getinterval (\)) eq and { ++ /o o 1 o length 2 sub getinterval o length 2 sub string copy def ++ } if ++ } if ++ 3 dict begin ++ o { ++ token not {exit} if ++ dup length string cvs (=) search { ++ cvlit exch pop exch def ++ } { ++ cvlit true def ++ } ifelse ++ } loop ++ currentdict end /o exch def ++ } { ++ /o 1 dict def ++ } ifelse ++} { ++ /o 1 dict def ++} ifelse ++ ++o (dontdraw) true put ++ ++/ret d o b cvn /uk.co.terryburton.bwipp findresource exec def ++ ++% pixs is renmatrix input ++ret /pixs known { ++ /pixs ret /pixs get def ++ ++ n ret /pixx known and { % If newlines requested and have row width ++ /pixx ret /pixx get def ++ 0 pixx pixs length 1 sub { % For i = 0; i < pixs length; i += pixx ++ pixs exch pixx getinterval { % For j = i; j < i + pixx; j++ ++ 1 string cvs print ++ } forall ++ (\n) print ++ } for ++ } { % Else dump the whole thing, no newlines ++ pixs { 1 string cvs print } forall ++ } ifelse ++} { ++ % sbs is renlinear input ++ ret /sbs known { ++ /sbs ret /sbs get def ++ ++ % Check if given ratio arg to adjust width of bars/spaces (eg "0.6" reduces 3 -> 2) ++ systemdict /r known { ++ /r systemdict /r get cvr def ++ /f { r mul ceiling cvi } def ++ } { ++ /f {} def ++ } ifelse ++ ++ % If should begin with space ++ systemdict /bs known { (0) print } if ++ ++ % If should end sbs loop on bar (i.e. ignore last index of even-length sbs) ++ /limit systemdict /elb known { ++ sbs length 1 add 2 idiv 2 mul 2 sub ++ } { ++ sbs length 1 sub ++ } ifelse def ++ ++ 0 1 limit { ++ /i exch def ++ i 2 mod 0 eq { % i is even ++ sbs i get f { (1) print } repeat ++ } { ++ sbs i get f { (0) print } repeat ++ } ifelse ++ } for ++ n { (\n) print } if ++ } if ++} ifelse ++ ++% If have renderer ++ret /ren known { ++ % Scale ++ /s systemdict /s known { systemdict /s get cvi } { 2 } ifelse def ++ % If not -dNODISPLAY then render for debugging ++ currentpagedevice /Name get (nullpage) ne { s s scale 10 10 moveto ret ret /ren get exec } if ++} if diff --git a/backend/tests/tools/bwipp_dump.ps.tar.xz b/backend/tests/tools/bwipp_dump.ps.tar.xz new file mode 100644 index 00000000..447a11c9 Binary files /dev/null and b/backend/tests/tools/bwipp_dump.ps.tar.xz differ diff --git a/backend/upcean.c b/backend/upcean.c index 15fac07f..5355fc6e 100644 --- a/backend/upcean.c +++ b/backend/upcean.c @@ -1,7 +1,7 @@ /* upcean.c - Handles UPC, EAN and ISBN libzint - the open source barcode library - Copyright (C) 2008-2017 Robin Stuart + Copyright (C) 2008 - 2020 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -30,13 +30,11 @@ */ /* vim: set ts=4 sw=4 et : */ -#define SODIUM "0123456789+" -#define EAN2 102 -#define EAN5 105 +#define SODIUM "0123456789+" +#define EAN2 102 +#define EAN5 105 #include -#include -#include #include "common.h" /* UPC and EAN tables checked against EN 797:1996 */ @@ -265,6 +263,10 @@ static int upce(struct zint_symbol *symbol, unsigned char source[], char dest[]) check_digit = upc_check(equivalent); + if (symbol->debug & ZINT_DEBUG_PRINT) { + printf("UPC-E: %s, Check digit: %c\n", equivalent, check_digit); + } + /* Use the number system and check digit information to choose a parity scheme */ if (num_system == 1) { strcpy(parity, UPCParity1[ctoi(check_digit)]); diff --git a/docs/manual.txt b/docs/manual.txt index 99e1c0e6..5c4de702 100644 --- a/docs/manual.txt +++ b/docs/manual.txt @@ -267,14 +267,14 @@ Numeric Value | Barcode Name 24 | Code 49 25 | Code 93 28 | Flattermarken -29 | GS1 DataBar-14 +29 | GS1 DataBar Omnidirectional (including GS1 DataBar Truncated) 30 | GS1 DataBar Limited 31 | GS1 DataBar Expanded 32 | Telepen Alpha -34 | UPC A -35 | UPC A + Check Digit -37 | UPC E -38 | UPC E + Check Digit +34 | UPC-A +35 | UPC-A + Check Digit +37 | UPC-E +38 | UPC-E + Check Digit 40 | PostNet 47 | MSI Plessey 49 | FIM @@ -295,17 +295,17 @@ Numeric Value | Barcode Name 70 | Royal Mail 4 State (RM4SCC) 71 | Data Matrix (ECC200) 72 | EAN-14 -73 | Vehicle Identification Number (America) +73 | Vehicle Identification Number 74 | Codablock-F 75 | NVE-18 76 | Japanese Postal Code 77 | Korea Post -79 | GS1 DataBar-14 Stacked -80 | GS1 DataBar-14 Stacked Omnidirectional +79 | GS1 DataBar Stacked (stacked version of GS1 DataBar Truncated) +80 | GS1 DataBar Stacked Omnidirectional 81 | GS1 DataBar Expanded Stacked 82 | PLANET 84 | MicroPDF417 -85 | USPS OneCode +85 | USPS Intelligent Mail (OneCode) 86 | Plessey Code 87 | Telepen Numeric 89 | ITF-14 @@ -327,13 +327,14 @@ Numeric Value | Barcode Name 129 | Code 32 130 | Composite Symbol with EAN linear component 131 | Composite Symbol with GS1-128 linear component -132 | Composite Symbol with GS1 DataBar-14 linear component -133 | Composite Symbol with GS1 DataBar Limited component -134 | Composite Symbol with GS1 DataBar Expanded component -135 | Composite Symbol with UPC A linear component -136 | Composite Symbol with UPC E linear component -137 | Composite Symbol with GS1 DataBar-14 Stacked component -138 | Composite Symbol with GS1 DataBar-14 Stacked Omnidirectional +132 | Composite Symbol with GS1 DataBar Omnidirectional linear + | component +133 | Composite Symbol with GS1 DataBar Limited linear component +134 | Composite Symbol with GS1 DataBar Expanded linear component +135 | Composite Symbol with UPC-A linear component +136 | Composite Symbol with UPC-E linear component +137 | Composite Symbol with GS1 DataBar Stacked component +138 | Composite Symbol with GS1 DataBar Stacked Omnidirectional | component 139 | Composite Symbol with GS1 DataBar Expanded Stacked component 140 | Channel Code @@ -434,8 +435,9 @@ have been inserted into a symbol. GS1 data can be encoded in a number of symbologies. Application identifiers should be enclosed in [square brackets] followed by the data to be encoded (see 5.1.12.3). To encode GS1 data use the --gs1 option. GS1 mode is assumed (and -doesn't need to be set) for EAN-128, DataBar and Composite symbologies but is -also available for Code 16k, Data Matrix, Aztec Code, DotCode and QR Code. +doesn't need to be set) for GS1-128, EAN-14, DataBar and Composite symbologies +but is also available for Aztec Code, Code 16k, Code 49, Code One, Data Matrix, +DotCode, QR Code and Ultracode. HIBC data may also be encoded in the symbologies Code 39, Code128, Codablock-F, Data Matrix, QR Code, PDF417 and Aztec Code. Within this mode, the leading '+' @@ -999,14 +1001,14 @@ Value | 24 | BARCODE_CODE49 | Code 49 25 | BARCODE_CODE93 | Code 93 28 | BARCODE_FLAT | Flattermarken -29 | BARCODE_RSS14 | GS1 DataBar-14 +29 | BARCODE_RSS14 | GS1 DataBar Omnidirectional 30 | BARCODE_RSS_LTD | GS1 DataBar Limited 31 | BARCODE_RSS_EXP | GS1 DataBar Expanded 32 | BARCODE_TELEPEN | Telepen Alpha -34 | BARCODE_UPCA | UPC A -35 | BARCODE_UPCA_CHK | UPC A + Check Digit -37 | BARCODE_UPCE | UPC E -38 | BARCODE_UPCE_CHK | UPC E + Check Digit +34 | BARCODE_UPCA | UPC-A +35 | BARCODE_UPCA_CHK | UPC-A + Check Digit +37 | BARCODE_UPCE | UPC-E +38 | BARCODE_UPCE_CHK | UPC-E + Check Digit 40 | BARCODE_POSTNET | PostNet 47 | BARCODE_MSI_PLESSEY | MSI Plessey 49 | BARCODE_FIM | FIM @@ -1032,12 +1034,12 @@ Value | 75 | BARCODE_NVE18 | NVE-18 76 | BARCODE_JAPANPOST | Japanese Postal Code 77 | BARCODE_KOREAPOST | Korea Post -79 | BARCODE_RSS14STACK | GS1 DataBar-14 Stacked -80 | BARCODE_RSS14STACK_OMNI | GS1 DataBar-14 Stacked Omnidirectional +79 | BARCODE_RSS14STACK | GS1 DataBar Stacked +80 | BARCODE_RSS14STACK_OMNI | GS1 DataBar Stacked Omnidirectional 81 | BARCODE_RSS_EXPSTACK | GS1 DataBar Expanded Stacked 82 | BARCODE_PLANET | PLANET 84 | BARCODE_MICROPDF417 | MicroPDF417 -85 | BARCODE_ONECODE | USPS OneCode +85 | BARCODE_ONECODE | USPS Intelligent Mail (OneCode) 86 | BARCODE_PLESSEY | Plessey Code 87 | BARCODE_TELEPEN_NUM | Telepen Numeric 89 | BARCODE_ITF14 | ITF-14 @@ -1061,18 +1063,18 @@ Value | 130 | BARCODE_EANX_CC | Composite Symbol with EAN linear component 131 | BARCODE_EAN128_CC | Composite Symbol with GS1-128 linear | | component -132 | BARCODE_RSS14_CC | Composite Symbol with GS1 DataBar-14 linear - | | component +132 | BARCODE_RSS14_CC | Composite Symbol with GS1 DataBar + | | Omnidirectional linear component 133 | BARCODE_RSS_LTD_CC | Composite Symbol with GS1 DataBar Limited - | | component + | | linear component 134 | BARCODE_RSS_EXP_CC | Composite Symbol with GS1 DataBar Expanded + | | linear component +135 | BARCODE_UPCA_CC | Composite Symbol with UPC-A linear component +136 | BARCODE_UPCE_CC | Composite Symbol with UPC-E linear component +137 | BARCODE_RSS14STACK_CC | Composite Symbol with GS1 DataBar Stacked | | component -135 | BARCODE_UPCA_CC | Composite Symbol with UPC A linear component -136 | BARCODE_UPCE_CC | Composite Symbol with UPC E linear component -137 | BARCODE_RSS14STACK_CC | Composite Symbol with GS1 DataBar-14 - | | Stacked component -138 | BARCODE_RSS14_OMNI_CC | Composite Symbol with GS1 DataBar-14 - | | Stacked Omnidirectional component +138 | BARCODE_RSS14_OMNI_CC | Composite Symbol with GS1 DataBar Stacked + | | Omnidirectional component 139 | BARCODE_RSS_EXPSTACK_CC | Composite Symbol with GS1 DataBar Expanded | | Stacked component 140 | BARCODE_CHANNEL | Channel Code @@ -1152,8 +1154,8 @@ if (ZBarcode_ValidID(BARCODE_PDF417) != 0) { } [1] This value is ignored for Australia Post 4-State Barcodes, PostNet, PLANET, -USPS OneCode, RM4SCC, PDF417, Data Matrix, Maxicode, QR Code, GS1 -DataBar-14 Stacked, PDF417 and MicroPDF417 - all of which have a fixed height. +USPS Intelligent Mail, RM4SCC, PDF417, Data Matrix, Maxicode, QR Code, GS1 +DataBar Stacked, PDF417 and MicroPDF417 - all of which have a fixed height. [2] This value is ignored for Code 16k, Codablock-F and ITF-14 symbols. @@ -1435,15 +1437,15 @@ suppresses mode C in favour of mode B. 6.1.11.3 GS1-128 ---------------- -A variation of Code 128 also known as UCC/EAN-128, this symbology is defined by -the GS1 General Specification. Application Identifiers (AIs) should be entered -using [square bracket] notation. These will be converted to (round brackets) -for the human readable text. This will allow round brackets to be used in the -data strings to be encoded. Fixed length data should be entered at the -appropriate length for correct encoding. GS1-128 does not support extended -ASCII characters. Check digits for GTIN data (AI 01) are not generated and -need to be included in the input data. The following is an example of a valid -GS1-128 input: +A variation of Code 128 previously known as UCC/EAN-128, this symbology is +defined by the GS1 General Specifications. Application Identifiers (AIs) should +be entered using [square bracket] notation. These will be converted to (round +brackets) for the human readable text. This will allow round brackets to be used +in the data strings to be encoded. Fixed length data should be entered at the +appropriate length for correct encoding. GS1-128 does not support extended ASCII +characters. Check digits for GTIN data (AI 01) are not generated and need to be +included in the input data. The following is an example of a valid GS1-128 +input: zint --barcode=16 -d "[01]98898765432106[3202]012345[15]991231" @@ -1466,39 +1468,42 @@ standards. 6.1.12 GS1 DataBar (ISO 24724) ------------------------------ -Also known as RSS (Reduced Spaced Symbology) these symbols are due to replace -GS1-128 symbols in accordance with the GS1 General Specification. If a GS1 -DataBar symbol is to be printed with a 2D component as specified in ISO 24723 -set option_1 = 2 or use the option --mode=2 at the command prompt. See section -6.3 of this manual to find out how to generate DataBar symbols with 2D +Previously known as RSS (Reduced Spaced Symbology) these symbols are due to +replace GS1-128 symbols in accordance with the GS1 General Specifications. If a +GS1 DataBar symbol is to be printed with a 2D component as specified in ISO +24723 set option_1 = 2 or use the option --mode=2 at the command prompt. See +section 6.3 of this manual to find out how to generate DataBar symbols with 2D components. -6.1.12.1 DataBar-14 and DataBar-14 Truncated --------------------------------------------- -Also known as RSS-14 this standard encodes a 13 digit item code. A check digit -and application identifier of (01) are added by Zint. To produce a truncated -symbol set the symbol height to a value between 32 and 13. Normal DataBar-14 -symbols should have a height of 33 or greater. +6.1.12.1 DataBar Omnidirectional and DataBar Truncated +------------------------------------------------------ +Previously known as RSS-14 this standard encodes a 13 digit item code. A check +digit and application identifier of (01) are added by Zint. (A 14 digit code +that appends the check digit may be given, in which case the check digit will be +verified.) To produce a truncated symbol set the symbol height to a value +between 32 and 13. Normal DataBar Omnidirectional symbols should have a height +of 33 or greater. 6.1.12.2 DataBar Limited ------------------------ -Also known as RSS Limited this standard encodes a 13 digit item code and can be -used in the same way as DataBar-14 above. DataBar Limited, however, is limited -to data starting with digits 0 and 1 (i.e. numbers in the range 0 to -1999999999999). As with DataBar-14 a check digit and application identifier of -(01) are added by Zint. +Previously known as RSS Limited this standard encodes a 13 digit item code and +can be used in the same way as DataBar above. DataBar Limited, however, is +limited to data starting with digits 0 and 1 (i.e. numbers in the range 0 to +1999999999999). As with DataBar Omnidirectional a check digit and application +identifier of (01) are added by Zint, and a 14 digit code may be given in which +case the check digit will be verified. 6.1.12.3 DataBar Expanded ------------------------- -Also known as RSS Expanded this is a variable length symbology capable of +Previously known as RSS Expanded this is a variable length symbology capable of encoding data from a number of AIs in a single symbol. AIs should be encased in [square brackets] in the input data. This will be converted to (rounded brackets) before it is included in the human readable text attached to the symbol. This method allows the inclusion of rounded brackets in the data to be encoded. GTIN data (AI 01) should also include the check digit data as this is not calculated by Zint when this symbology is encoded. Fixed length data should -be entered at the appropriate length for correct encoding. The following is -an example of a valid DataBar Expanded input: +be entered at the appropriate length for correct encoding. The following is an +example of a valid DataBar Expanded input: zint --barcode=31 -d "[01]98898765432106[3202]012345[15]991231" @@ -1612,19 +1617,19 @@ 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. -6.2.7 GS1 DataBar-14 Stacked (ISO 24724) ----------------------------------------- -A stacked variation of the GS1 DataBar-14 symbol requiring the same input (see -section 6.1.12.1). The height of this symbol is fixed. The data is encoded in -two rows of bars with a central finder pattern. This symbol can be generated +6.2.7 GS1 DataBar Stacked (ISO 24724) +------------------------------------- +A stacked variation of the GS1 DataBar Truncated symbol requiring the same input +(see section 6.1.12.1). The height of this symbol is fixed. The data is encoded +in two rows of bars with a central finder pattern. This symbol can be generated with a two-dimensional component to make a composite symbol. -6.2.8 GS1 DataBar-14 Stacked Omnidirectional (ISO 24724) --------------------------------------------------------- -Another variation of the GS1 DataBar-14 symbol requiring the same input (see -section 6.1.12.1). The data is encoded in two rows of bars with a central -finder pattern. This symbol can be generated with a two-dimensional component -to make a composite symbol. +6.2.8 GS1 DataBar Stacked Omnidirectional (ISO 24724) +----------------------------------------------------- +A stacked variation of the GS1 DataBar Omnidirectional symbol requiring the same +input (see section 6.1.12.1). The data is encoded in two rows of bars with a +central finder pattern. This symbol can be generated with a two-dimensional +component to make a composite symbol. 6.2.9 GS1 DataBar Expanded Stacked (ISO 24724) ---------------------------------------------- @@ -1647,7 +1652,7 @@ characters or 81 numeric digits. GS1 data encoding is also supported. --------------------------------- Composite symbols employ a mixture of components to give more comprehensive information about a product. The permissible contents of a composite symbol is -determined by the terms of the GS1 General Specification. Composite symbols +determined by the terms of the GS1 General Specifications. Composite symbols consist of a linear component which can be an EAN, UPC, GS1-128 or GS1 DataBar symbol, a 2D component which is based on PDF417 or MicroPDF417, and a separator pattern. The type of linear component to be used is determined using the -b or @@ -1661,18 +1666,18 @@ Value | 130 | BARCODE_EANX_CC | Composite Symbol with EAN linear component 131 | BARCODE_EAN128_CC | Composite Symbol with GS1-128 linear | | component -132 | BARCODE_RSS14_CC | Composite Symbol with GS1 DataBar-14 linear - | | component +132 | BARCODE_RSS14_CC | Composite Symbol with GS1 DataBar + | | Omnidirectional linear component 133 | BARCODE_RSS_LTD_CC | Composite Symbol with GS1 DataBar Limited - | | component + | | linear component 134 | BARCODE_RSS_EXP_CC | Composite Symbol with GS1 DataBar Expanded + | | linear component +135 | BARCODE_UPCA_CC | Composite Symbol with UPC-A linear component +136 | BARCODE_UPCE_CC | Composite Symbol with UPC-E linear component +137 | BARCODE_RSS14STACK_CC | Composite Symbol with GS1 DataBar Stacked | | component -135 | BARCODE_UPCA_CC | Composite Symbol with UPC A linear component -136 | BARCODE_UPCE_CC | Composite Symbol with UPC E linear component -137 | BARCODE_RSS14STACK_CC | Composite Symbol with GS1 DataBar-14 - | | Stacked component -138 | BARCODE_RSS14_OMNI_CC | Composite Symbol with GS1 DataBar-14 - | | Stacked Omnidirectional component +138 | BARCODE_RSS14_OMNI_CC | Composite Symbol with GS1 DataBar Stacked + | | Omnidirectional component 139 | BARCODE_RSS_EXPSTACK_CC | Composite Symbol with GS1 DataBar Expanded | | Stacked component -------------------------------------------------------------------------------- @@ -1817,15 +1822,15 @@ Reed Solomon error correction. Input is a pre-formatted alphanumeric string of trailing space characters - these will be appended by Zint if not included in the input data. -6.5.5 USPS OneCode ------------------- -Also known as the Intelligent Mail Barcode and used in the US by the United -States Postal Service (USPS), the OneCode system replaced the PostNet and -PLANET symbologies in 2009. OneCode is a fixed length (65-bar) symbol which +6.5.5 USPS Intelligent Mail +--------------------------- +Also known as the OneCode barcode and used in the US by the United States Postal +Service (USPS), the Intelligent Mail system replaced the PostNet and PLANET +symbologies in 2009. Intelligent Mail is a fixed length (65-bar) symbol which combines routing and customer information in a single symbol. Input data consists of a 20 digit tracking code, followed by a dash (-), followed by a -delivery point zip-code which can be 0, 5, 9 or 11 digits in length. For -example all of the following inputs are valid data entries: +delivery point zip-code which can be 0, 5, 9 or 11 digits in length. For example +all of the following inputs are valid data entries: "01234567094987654321" diff --git a/frontend/main.c b/frontend/main.c index 0e9234a1..ef47fa92 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -53,17 +53,17 @@ static void types(void) { "20: Code 128 70: RM4SCC 128: Aztec Runes\n" "21: Leitcode 71: Data Matrix 129: Code 32\n" "22: Identcode 72: EAN-14 130: Comp EAN\n" - "23: Code 16k 73: VIN (North America) 131: Comp GS1-128\n" + "23: Code 16k 73: VIN 131: Comp GS1-128\n" "24: Code 49 74: Codablock-F 132: Comp DataBar Omni\n" "25: Code 93 75: NVE-18 133: Comp DataBar Ltd\n" - "28: Flattermarken 76: Japanese Post 134: Comp DataBar ExpOm\n" + "28: Flattermarken 76: Japanese Post 134: Comp DataBar Exp\n" "29: GS1 DataBar Omni 77: Korea Post 135: Comp UPC-A\n" "30: GS1 DataBar Ltd 79: GS1 DataBar Stack 136: Comp UPC-E\n" - "31: GS1 DataBar ExpOm 80: GS1 DataBar Stack Omni 137: Comp DataBar Stack\n" - "32: Telepen Alpha 81: GS1 DataBar ESO 138: Comp DataBar Stack Omni\n" - "34: UPC-A 82: Planet 139: Comp DataBar ESO\n" + "31: GS1 DataBar Exp 80: GS1 DataBar Stack Omni 137: Comp DataBar Stack\n" + "32: Telepen Alpha 81: GS1 DataBar Exp Stack 138: Comp DataBar Stack Omni\n" + "34: UPC-A 82: Planet 139: Comp DataBar Exp Stack\n" "35: UPC-A + Check 84: MicroPDF 140: Channel Code\n" - "37: UPC-E 85: USPS OneCode 141: Code One\n" + "37: UPC-E 85: USPS Intelligent Mail 141: Code One\n" "38: UPC-E + Check 86: UK Plessey 142: Grid Matrix\n" "40: Postnet 87: Telepen Numeric 143: UPNQR\n" "47: MSI Plessey 89: ITF-14 144: Ultracode\n" diff --git a/frontend_qt/grpChannel.ui b/frontend_qt/grpChannel.ui index 8b4e84a0..1c6964bb 100644 --- a/frontend_qt/grpChannel.ui +++ b/frontend_qt/grpChannel.ui @@ -9,6 +9,12 @@ 78 + + + 600 + 16777215 + + Form diff --git a/frontend_qt/grpDBExtend.ui b/frontend_qt/grpDBExtend.ui index b3941203..46d63443 100644 --- a/frontend_qt/grpDBExtend.ui +++ b/frontend_qt/grpDBExtend.ui @@ -44,47 +44,57 @@ - 1 + 1 (2 segments) - 2 + 2 (4 segments) - 3 + 3 (6 segments) - 4 + 4 (8 segments) - 5 + 5 (10 segments) - 6 + 6 (12 segments) - 7 + 7 (14 segments) - 8 + 8 (16 segments) - 9 + 9 (18 segments) + + + + + 10 (20 segments) + + + + + 11 (22 segments) diff --git a/frontend_qt/mainWindow.ui b/frontend_qt/mainWindow.ui index 911bac2f..558524e6 100644 --- a/frontend_qt/mainWindow.ui +++ b/frontend_qt/mainWindow.ui @@ -454,7 +454,7 @@ p, li { white-space: pre-wrap; } - &Whitespace: + Horizontal &Whitespace: Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter diff --git a/frontend_qt/mainwindow.cpp b/frontend_qt/mainwindow.cpp index 7e0c3d2c..8d9a24ac 100644 --- a/frontend_qt/mainwindow.cpp +++ b/frontend_qt/mainwindow.cpp @@ -37,7 +37,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl) : QWidget(parent, fl), m_optionWidget(0) { - m_bc.bc.setDebug(QCoreApplication::arguments().contains("--verbose")); + m_bc.bc.setDebug(QCoreApplication::arguments().contains("--verbose")); // Undocumented command line debug flag QCoreApplication::setOrganizationName("zint"); QCoreApplication::setOrganizationDomain("zint.org.uk"); @@ -80,15 +80,15 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl) "Facing Identification Mark (FIM)", "Flattermarken", "Grid Matrix", - "GS1 DataBar Expanded Omnidirectional", - "GS1 DataBar Expanded Stacked Omnidirectional", + "GS1 DataBar Expanded", + "GS1 DataBar Expanded Stacked", "GS1 DataBar Limited", - "GS1 DataBar Omnidirectional", + "GS1 DataBar Omnidirectional (and Truncated)", "GS1 DataBar Stacked", "GS1 DataBar Stacked Omnidirectional", "Han Xin (Chinese Sensible) Code", - "ITF-14", "International Standard Book Number (ISBN)", + "ITF-14", "Japanese Postal Barcode", "Korean Postal Barcode", "LOGMARS", @@ -111,10 +111,10 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl) "Telepen Numeric", "UK Plessey", "Ultracode", - "UPNQR", "Universal Product Code (UPC-A)", "Universal Product Code (UPC-E)", - "USPS Intelligent Mail", + "UPNQR", + "USPS Intelligent Mail (OneCode)", "VIN (Vehicle Identification Number)" }; @@ -124,26 +124,32 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl) view->setScene(scene); m_fgcolor=qRgb(settings.value("studio/ink/red", 0).toInt(), - settings.value("studio/ink/green", 0).toInt(), - settings.value("studio/ink/blue", 0).toInt()); + settings.value("studio/ink/green", 0).toInt(), + settings.value("studio/ink/blue", 0).toInt()); m_bgcolor=qRgb(settings.value("studio/paper/red", 0xff).toInt(), - settings.value("studio/paper/green", 0xff).toInt(), - settings.value("studio/paper/blue", 0xff).toInt()); - for (int i=0;ienumerator(0).keyCount();i++) { + settings.value("studio/paper/green", 0xff).toInt(), + settings.value("studio/paper/blue", 0xff).toInt()); + + for (int i = 0; i < metaObject()->enumerator(0).keyCount(); i++) { bstyle->addItem(metaObject()->enumerator(0).key(i)); - bstyle->setItemText(i,bstyle_text[i]); + bstyle->setItemText(i, bstyle_text[i]); } + bstyle->setCurrentIndex(settings.value("studio/symbology", 10).toInt()); - txtData->setText(settings.value("studio/data", "Your Data Here!").toString()); - txtComposite->setText(settings.value("studio/composite_text", "Your Data Here!").toString()); - heightb->setValue(settings.value("studio/appearance/height", 50).toInt()); - bwidth->setValue(settings.value("studio/appearance/border", 50).toInt()); - spnWhitespace->setValue(settings.value("studio/appearance/whitespace", 0).toInt()); - spnScale->setValue(settings.value("studio/appearance/scale", 1.0).toFloat()); - btype->setCurrentIndex(settings.value("studio/appearance/border_type", 0).toInt()); + + txtData->setText(settings.value("studio/data", "Your Data Here!").toString()); + txtComposite->setText(settings.value("studio/composite_text", "Your Data Here!").toString()); + heightb->setValue(settings.value("studio/appearance/height", 50).toInt()); + bwidth->setValue(settings.value("studio/appearance/border", 50).toInt()); + spnWhitespace->setValue(settings.value("studio/appearance/whitespace", 0).toInt()); + spnScale->setValue(settings.value("studio/appearance/scale", 1.0).toFloat()); + btype->setCurrentIndex(settings.value("studio/appearance/border_type", 0).toInt()); + change_options(); - scene->addItem(&m_bc); + scene->addItem(&m_bc); + update_preview(); + connect(bstyle, SIGNAL(currentIndexChanged( int )), SLOT(change_options())); connect(bstyle, SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(heightb, SIGNAL(valueChanged( int )), SLOT(update_preview())); @@ -253,17 +259,17 @@ bool MainWindow::save() } if(m_bc.bc.save_to_file(filename) == false) { - if (m_bc.bc.getError() > 4) { - QMessageBox::critical(this,tr("Save Error"),m_bc.bc.error_message()); - return false; - } else { - QMessageBox::warning(this, tr("Save Warning"),m_bc.bc.error_message()); - return true; - } + if (m_bc.bc.getError() > 4) { + QMessageBox::critical(this, tr("Save Error"), m_bc.bc.error_message()); + return false; + } else { + QMessageBox::warning(this, tr("Save Warning"), m_bc.bc.error_message()); + return true; + } } - settings.setValue("studio/default_dir", filename.mid(0, filename.lastIndexOf(QDir::separator()))); - settings.setValue("studio/default_suffix", suffix); + settings.setValue("studio/default_dir", filename.mid(0, filename.lastIndexOf(QDir::separator()))); + settings.setValue("studio/default_suffix", suffix); return true; } @@ -1092,12 +1098,10 @@ void MainWindow::update_preview() if(m_optionWidget->findChild("radQRGS1")->isChecked()) m_bc.bc.setInputMode(GS1_MODE); - printf("cmbQRSize stylesheet %s\n", (const char *) m_optionWidget->findChild("cmbQRSize")->styleSheet().toLatin1()); item_val = m_optionWidget->findChild("cmbQRSize")->currentIndex(); if (item_val) { m_bc.bc.setOption2(item_val); } - printf("cmbQRECC stylesheet %s\n", (const char *) m_optionWidget->findChild("cmbQRECC")->styleSheet().toLatin1()); item_val = m_optionWidget->findChild("cmbQRECC")->currentIndex(); if (item_val) { m_bc.bc.setSecurityLevel(item_val); diff --git a/frontend_qt/mainwindow.h b/frontend_qt/mainwindow.h index c73c9280..f8123fea 100644 --- a/frontend_qt/mainwindow.h +++ b/frontend_qt/mainwindow.h @@ -80,8 +80,8 @@ public: RSS14STACK = 79, RSS14STACK_OMNI = 80, HANXIN = 116, - ITF14 = 89, ISBNX = 69, + ITF14 = 89, JAPANPOST = 76, KOREAPOST = 77, LOGMARS = 50, @@ -104,9 +104,9 @@ public: TELEPEN_NUM = 87, PLESSEY = 86, ULTRA = 144, - UPNQR = 143, UPCA = 34, UPCE = 37, + UPNQR = 143, ONECODE = 85, VIN = 73 };