1
0
mirror of https://git.code.sf.net/p/zint/code synced 2026-06-15 10:03:36 +00:00

TELEPEN/TELEPEN_NUM: support AIM-defined Start/Stop characters

with option "--vers=1" (API `option_2 = 1`);
  define minimum height based on AIM USS Telepen
TELEPEN_NUM: support switching to Full ASCII mode with DLE;
  max digits 136 -> 138
TELEPEN: support switching to Compressed Numeric Mode with DLE
  if AIM-defined Start/Stop enabled
CLI: make args for  "--dmb256", "--dmc40", "--scalexdimdp" and
  "--scmvv" optional
library: new escape sequences `\L`, `\F`, `\N`, & refactor parsing
  to use `escs` table
ZBarcode_Scale_From_XdimDp: allow TXT filetype (so "--dump" test
  works)
output: Telepen default quiet zone confirmed as 10X
aztec/dmatrix: fix source line too long
man page: embolden options and emphasize args;
  add barcode names to standards; various other fixes
This commit is contained in:
gitlost
2026-05-26 20:32:51 +01:00
parent 07777d044a
commit 771a1b3cdd
34 changed files with 2167 additions and 1155 deletions
+10 -3
View File
@@ -1,9 +1,9 @@
Version 2.16.0.9 (dev) not released yet (2026-04-27) Version 2.16.0.9 (dev) not released yet (2026-05-26)
==================================================== ====================================================
**Incompatible changes** **Incompatible changes**
------------------------ ------------------------
- Code 128 now errors on unrecognized extra escape sequences - Code 128 now errors on unrecognised extra escape sequences
(previously just passed them through) (previously just passed them through)
- Aztec error codeword percentages adjusted to be at least advertised values - Aztec error codeword percentages adjusted to be at least advertised values
(may cause symbol size change, and generation failure if specified) (may cause symbol size change, and generation failure if specified)
@@ -13,6 +13,7 @@ Version 2.16.0.9 (dev) not released yet (2026-04-27)
option for processing GS1 input option for processing GS1 input
- CLI now warns if both "--dmre" and "--square" are given - CLI now warns if both "--dmre" and "--square" are given
(previously silently ignored "--dmre") (previously silently ignored "--dmre")
- New escape sequences `\L` (DLE), `\F` (FS), `\N` (US)
Changes Changes
------- -------
@@ -20,6 +21,7 @@ Changes
`BARCODE_MEMORY_FILE` and use in GUI for pasting to clipboard instead of `BARCODE_MEMORY_FILE` and use in GUI for pasting to clipboard instead of
creating temporary file creating temporary file
- CLI: allow "tiff" as filetype (saved as ".tif"); - CLI: allow "tiff" as filetype (saved as ".tif");
make args for "--scalexdimdp" and "--scmvv" optional;
add `ZINT_TEST`-only "--test" option to do various internal tests add `ZINT_TEST`-only "--test" option to do various internal tests
- GS1SE: exclude GS1_128 from requisite AIs check as may be spread across more - GS1SE: exclude GS1_128 from requisite AIs check as may be spread across more
than one barcode (ticket #348, props Harald Oehlmann and Terry Burton) than one barcode (ticket #348, props Harald Oehlmann and Terry Burton)
@@ -31,12 +33,17 @@ Changes
- GS1: new `GS1RAW_MODE` (CLI "--gs1raw") and GS1 Syntax Engine "Unbracketed AI - GS1: new `GS1RAW_MODE` (CLI "--gs1raw") and GS1 Syntax Engine "Unbracketed AI
element strings" (caret) options for specifying GS1 input (ticket #350, props element strings" (caret) options for specifying GS1 input (ticket #350, props
Mario Verbruggen) Mario Verbruggen)
- DATAMATRIX: new options "--dmb256=" (`option_3 = DM_B256_START`) & "--dmc40=" - DATAMATRIX: new options "--dmb256" (`option_3 = DM_B256_START`) & "--dmc40"
(`option_3 = DM_C40_START`) to allow forcing of initial encodation for given (`option_3 = DM_C40_START`) to allow forcing of initial encodation for given
no. (`option_1`) of initial characters, with 0 meaning all no. (`option_1`) of initial characters, with 0 meaning all
- AZTEC/DATAMATRIX: add manual FNC1 support - AZTEC/DATAMATRIX: add manual FNC1 support
- AUSPOST: support FCC 00 Null (DPID all zeroes) and allow variable length data - AUSPOST: support FCC 00 Null (DPID all zeroes) and allow variable length data
input input
- general: new escape sequences `\L` (DLE), `\F` (FS), `\N` (US)
- TELEPEN/TELEPEN_NUM: support AIM-defined Start/Stop characters with option
"--vers=1" (API `option_2 = 1`)
- TELEPEN_NUM: support switching to Full ASCII mode with DLE
- TELEPEN: support switching to Compressed Numeric Mode with DLE if AIM enabled
Bugs Bugs
---- ----
+2 -1
View File
@@ -1625,7 +1625,8 @@ INTERNAL int zint_aztec(struct zint_symbol *symbol, struct zint_seg segs[], cons
return z_errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 806, "Cannot use Extra Escape mode in GS1 mode"); return z_errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 806, "Cannot use Extra Escape mode in GS1 mode");
} }
if (reader_init) { if (reader_init) {
return z_errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 807, "Cannot use Reader Initialisation in Extra Escape mode"); return z_errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 807,
"Cannot use Reader Initialisation in Extra Escape mode");
} }
} }
+2 -1
View File
@@ -1771,7 +1771,8 @@ static int dm_encode_segs(struct zint_symbol *symbol, struct zint_seg segs[], co
"Cannot have Structured Append and Reader Initialisation at the same time"); "Cannot have Structured Append and Reader Initialisation at the same time");
} }
if (extra_escape_mode) { if (extra_escape_mode) {
return z_errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 847, "Cannot use Reader Initialisation in Extra Escape mode"); return z_errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 847,
"Cannot use Reader Initialisation in Extra Escape mode");
} }
target[tp++] = 234; /* Reader Programming */ target[tp++] = 234; /* Reader Programming */
if (debug_print) fputs("RP ", stdout); if (debug_print) fputs("RP ", stdout);
+120 -127
View File
@@ -716,13 +716,18 @@ static int esc_base(struct zint_symbol *symbol, const unsigned char *input_strin
/* Helper to parse escape sequences. If `escaped_string` NULL, calculates length only */ /* Helper to parse escape sequences. If `escaped_string` NULL, calculates length only */
static int escape_char_process(struct zint_symbol *symbol, const unsigned char *input_string, int *p_length, static int escape_char_process(struct zint_symbol *symbol, const unsigned char *input_string, int *p_length,
unsigned char *escaped_string) { unsigned char *escaped_string) {
/* NUL EOT BEL BS HT LF VT FF CR ESC GS RS \ */ /* NOTE: if add escape character, must also update regex `escRE` in "frontend_qt/datawindow.php" */
static const char escs[] = { '0', 'E', 'a', 'b', 't', 'n', 'v', 'f', 'r', 'e', 'G', 'R', '\\', '\0' }; static const char escs[] = {
static const char vals[] = { 0x00, 0x04, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x1B, 0x1D, 0x1E, 0x5C }; /* NUL EOT BEL BS HT LF VT FF CR DLE ESC FS GS RS US \ */
'0', 'E', 'a', 'b', 't', 'n', 'v', 'f', 'r', 'L', 'e', 'F', 'G', 'R', 'N', '\\', '\0'
};
static const char vals[] = {
0x00, 0x04, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x10, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x5C
};
const int length = *p_length; const int length = *p_length;
int in_posn = 0, out_posn = 0; int in_posn = 0, out_posn = 0;
unsigned char ch; unsigned char ch;
int val; int val, esc_posn;
int i; int i;
unsigned int unicode; unsigned int unicode;
const int extra_escape_mode = symbol->input_mode & EXTRA_ESCAPE_MODE; const int extra_escape_mode = symbol->input_mode & EXTRA_ESCAPE_MODE;
@@ -736,135 +741,123 @@ static int escape_char_process(struct zint_symbol *symbol, const unsigned char *
return z_errtxt(ZINT_ERROR_INVALID_DATA, symbol, 236, "Incomplete escape character in input"); return z_errtxt(ZINT_ERROR_INVALID_DATA, symbol, 236, "Incomplete escape character in input");
} }
ch = input_string[in_posn + 1]; ch = input_string[in_posn + 1];
/* NOTE: if add escape character, must also update regex in "frontend_qt/datawindow.php" */ if ((esc_posn = z_posn(escs, ch)) != -1) {
switch (ch) { if (escaped_string) escaped_string[out_posn] = vals[esc_posn];
case '0': in_posn += 2;
case 'E': /* Note: if given double backslash following by caret "\\^" then will be passed through as "\^",
case 'a': i.e. the start of an extra escape sequence, avoiding the check below, so each symbology needs
case 'b': to also check themselves */
case 't': } else {
case 'n': switch (ch) {
case 'v': case '^': /* Symbology specific */
case 'f': if (!extra_escape_mode || !can_extra_escape) {
case 'r': if (!extra_escape_mode) {
case 'e': return z_errtxt(ZINT_ERROR_INVALID_DATA, symbol, 798,
case 'G': "Escape '\\^' only valid in Extra Escape mode");
case 'R': }
case '\\': return z_errtxt(ZINT_ERROR_INVALID_DATA, symbol, 213,
if (escaped_string) escaped_string[out_posn] = vals[z_posn(escs, ch)]; "Extra escape '\\^' not valid for this symbology and/or input mode");
in_posn += 2;
/* Note: if given double backslash following by caret "\\^" then will be passed through as "\^",
i.e. the start of an extra escape sequence, avoiding the check below, so each symbology needs
to also check themselves */
break;
case '^': /* Symbology specific */
if (!extra_escape_mode || !can_extra_escape) {
if (!extra_escape_mode) {
return z_errtxt(ZINT_ERROR_INVALID_DATA, symbol, 798,
"Escape '\\^' only valid in Extra Escape mode");
} }
return z_errtxt(ZINT_ERROR_INVALID_DATA, symbol, 213, /* Pass thru unaltered */
"Extra escape '\\^' not valid for this symbology and/or input mode");
}
/* Pass thru unaltered */
if (escaped_string) {
escaped_string[out_posn++] = '\\';
escaped_string[out_posn] = '^';
} else {
out_posn++;
}
in_posn += 2;
if (in_posn < length) { /* Note allowing '\\^' on its own at end */
if (escaped_string) { if (escaped_string) {
escaped_string[++out_posn] = input_string[in_posn++]; escaped_string[out_posn++] = '\\';
} else { escaped_string[out_posn] = '^';
++out_posn;
in_posn++;
}
}
break;
case '(':
case ')':
if (!escape_parens) {
return z_errtxt(ZINT_ERROR_INVALID_DATA, symbol, 853,
"Escaped parentheses only valid in GS1 mode with GS1 parentheses flag");
}
/* Pass through unaltered */
if (escaped_string) {
escaped_string[out_posn++] = '\\';
escaped_string[out_posn] = ch;
} else {
out_posn++;
}
in_posn += 2;
break;
case 'd':
case 'o':
case 'x':
if ((val = esc_base(symbol, input_string, length, in_posn + 2, ch)) == -1) {
return ZINT_ERROR_INVALID_DATA;
}
if (escaped_string) escaped_string[out_posn] = val;
in_posn += 4 + (ch != 'x');
break;
case 'u':
case 'U':
if (in_posn + 6 > length || (ch == 'U' && in_posn + 8 > length)) {
return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 209,
"Incomplete '\\%c' escape sequence in input", ch);
}
unicode = 0;
for (i = 0; i < 6; i++) {
if ((val = z_ctoi(input_string[in_posn + i + 2])) == -1) {
return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 211,
"Invalid character for '\\%c' escape sequence in input (hexadecimal only)",
ch);
}
unicode = (unicode << 4) | val;
if (i == 3 && ch == 'u') {
break;
}
}
/* Exclude reversed BOM and surrogates and out-of-range */
if (unicode == 0xFFFE || (unicode >= 0xD800 && unicode < 0xE000) || unicode > 0x10FFFF) {
return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 216,
"Value of escape sequence '%.*s' in input out of range",
ch == 'u' ? 6 : 8, input_string + in_posn);
}
if (unicode < 0x80) {
if (escaped_string) escaped_string[out_posn] = (unsigned char) unicode;
} else if (unicode < 0x800) {
if (escaped_string) {
escaped_string[out_posn++] = (unsigned char) (0xC0 | (unicode >> 6));
escaped_string[out_posn] = (unsigned char) (0x80 | (unicode & 0x3F));
} else { } else {
out_posn++; out_posn++;
} }
} else if (unicode < 0x10000) { in_posn += 2;
if (escaped_string) { if (in_posn < length) { /* Note allowing '\\^' on its own at end */
escaped_string[out_posn++] = (unsigned char) (0xE0 | (unicode >> 12)); if (escaped_string) {
escaped_string[out_posn++] = (unsigned char) (0x80 | ((unicode >> 6) & 0x3F)); escaped_string[++out_posn] = input_string[in_posn++];
escaped_string[out_posn] = (unsigned char) (0x80 | (unicode & 0x3F)); } else {
} else { ++out_posn;
out_posn += 2; in_posn++;
}
} }
} else { break;
if (escaped_string) { case '(':
escaped_string[out_posn++] = (unsigned char) (0xF0 | (unicode >> 18)); case ')':
escaped_string[out_posn++] = (unsigned char) (0x80 | ((unicode >> 12) & 0x3F)); if (!escape_parens) {
escaped_string[out_posn++] = (unsigned char) (0x80 | ((unicode >> 6) & 0x3F)); return z_errtxt(ZINT_ERROR_INVALID_DATA, symbol, 853,
escaped_string[out_posn] = (unsigned char) (0x80 | (unicode & 0x3F)); "Escaped parentheses only valid in GS1 mode with GS1 parentheses flag");
} else {
out_posn += 3;
} }
} /* Pass through unaltered */
in_posn += 6 + (ch == 'U') * 2; if (escaped_string) {
break; escaped_string[out_posn++] = '\\';
default: escaped_string[out_posn] = ch;
return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 234, } else {
"Unrecognised escape character '\\%c' in input", out_posn++;
!z_isascii(ch) || z_iscntrl(ch) ? '?' : ch); }
break; in_posn += 2;
break;
case 'd':
case 'o':
case 'x':
if ((val = esc_base(symbol, input_string, length, in_posn + 2, ch)) == -1) {
return ZINT_ERROR_INVALID_DATA;
}
if (escaped_string) escaped_string[out_posn] = val;
in_posn += 4 + (ch != 'x');
break;
case 'u':
case 'U':
if (in_posn + 6 > length || (ch == 'U' && in_posn + 8 > length)) {
return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 209,
"Incomplete '\\%c' escape sequence in input", ch);
}
unicode = 0;
for (i = 0; i < 6; i++) {
if ((val = z_ctoi(input_string[in_posn + i + 2])) == -1) {
return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 211,
"Invalid character for '\\%c' escape sequence in input (hexadecimal only)",
ch);
}
unicode = (unicode << 4) | val;
if (i == 3 && ch == 'u') {
break;
}
}
/* Exclude reversed BOM and surrogates and out-of-range */
if (unicode == 0xFFFE || (unicode >= 0xD800 && unicode < 0xE000) || unicode > 0x10FFFF) {
return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 216,
"Value of escape sequence '%.*s' in input out of range",
ch == 'u' ? 6 : 8, input_string + in_posn);
}
if (unicode < 0x80) {
if (escaped_string) escaped_string[out_posn] = (unsigned char) unicode;
} else if (unicode < 0x800) {
if (escaped_string) {
escaped_string[out_posn++] = (unsigned char) (0xC0 | (unicode >> 6));
escaped_string[out_posn] = (unsigned char) (0x80 | (unicode & 0x3F));
} else {
out_posn++;
}
} else if (unicode < 0x10000) {
if (escaped_string) {
escaped_string[out_posn++] = (unsigned char) (0xE0 | (unicode >> 12));
escaped_string[out_posn++] = (unsigned char) (0x80 | ((unicode >> 6) & 0x3F));
escaped_string[out_posn] = (unsigned char) (0x80 | (unicode & 0x3F));
} else {
out_posn += 2;
}
} else {
if (escaped_string) {
escaped_string[out_posn++] = (unsigned char) (0xF0 | (unicode >> 18));
escaped_string[out_posn++] = (unsigned char) (0x80 | ((unicode >> 12) & 0x3F));
escaped_string[out_posn++] = (unsigned char) (0x80 | ((unicode >> 6) & 0x3F));
escaped_string[out_posn] = (unsigned char) (0x80 | (unicode & 0x3F));
} else {
out_posn += 3;
}
}
in_posn += 6 + (ch == 'U') * 2;
break;
default:
return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 234,
"Unrecognised escape character '\\%c' in input",
!z_isascii(ch) || z_iscntrl(ch) ? '?' : ch);
break;
}
} }
} else { } else {
if (escaped_string) escaped_string[out_posn] = input_string[in_posn]; if (escaped_string) escaped_string[out_posn] = input_string[in_posn];
@@ -2096,7 +2089,7 @@ float ZBarcode_Scale_From_XdimDp(int symbol_id, float x_dim_mm, float dpmm, cons
return 0.0f; return 0.0f;
} }
if (filetype && *filetype) { if (filetype && *filetype) {
if ((i = filetype_idx(filetype)) < 0 || filetypes[i].filetype == 0) { /* Not found or TXT */ if ((i = filetype_idx(filetype)) < 0) { /* Not found */
return 0.0f; return 0.0f;
} }
} else { } else {
+1 -2
View File
@@ -486,8 +486,7 @@ static int out_quiet_zones(const struct zint_symbol *symbol, const int hide_text
case BARCODE_TELEPEN: case BARCODE_TELEPEN:
case BARCODE_TELEPEN_NUM: case BARCODE_TELEPEN_NUM:
/* Appears to be ~10X from diagram in Telepen Barcode Symbology information and History */ /* AIM Europe USS Telepen - 10X */
/* TODO: Find better doc */
*left = *right = 10.0f; *left = *right = 10.0f;
done = 1; done = 1;
break; break;
+249 -100
View File
@@ -31,88 +31,193 @@
/* SPDX-License-Identifier: BSD-3-Clause */ /* SPDX-License-Identifier: BSD-3-Clause */
/* Telepen Barcode Symbology information and History (BSiH) /* Telepen Barcode Symbology information and History (BSiH)
https://telepen.co.uk/wp-content/uploads/2018/10/Barcode-Symbology-information-and-History.pdf */ https://advanova.co.uk/wp-content/uploads/2022/05/Barcode-Symbology-information-and-History.pdf */
/* AIM Europe USS Telepen (1991) */
#define SODIUM_X_F (IS_NUM_F | IS_UX__F | IS_LX__F) /* SODIUM "0123456789Xx" */ #define SODIUM_X_F (IS_NUM_F | IS_UX__F | IS_LX__F) /* SODIUM "0123456789Xx" */
#define TELE_SYMBOL_MAX 69 /* 16 * (1 (Start) + 69 + 1 (check digit) + 1 (Stop)) = 1152 */
#define TELE_SYMBOL_MAX_S "69" /* String version of above */
#define TELE_LENGTH_MAX 200 /* Max possible is 138 - use > for better error messages */
#include <assert.h>
#include <stdio.h> #include <stdio.h>
#include "common.h" #include "common.h"
static const char TeleTable[128][16] = { /* Copied into "test_telepen.c" for lengths generator - see below */
{ "31313131" }, { "1131313111" }, { "33313111" }, { "1111313131" }, static const char TeleTable[132][16] = {
{ "3111313111" }, { "11333131" }, { "13133131" }, { "111111313111" }, { "31313131" }, { "1131313111" }, { "33313111" }, { "1111313131" }, /*00-03*/
{ "31333111" }, { "1131113131" }, { "33113131" }, { "1111333111" }, { "3111313111" }, { "11333131" }, { "13133131" }, { "111111313111" }, /*04-07*/
{ "3111113131" }, { "1113133111" }, { "1311133111" }, { "111111113131" }, { "31333111" }, { "1131113131" }, { "33113131" }, { "1111333111" }, /*08-0B*/
{ "3131113111" }, { "11313331" }, { "333331" }, { "111131113111" }, { "3111113131" }, { "1113133111" }, { "1311133111" }, { "111111113131" }, /*0C-0F*/
{ "31113331" }, { "1133113111" }, { "1313113111" }, { "1111113331" }, { "3131113111" }, { "11313331" }, { "333331" }, { "111131113111" }, /*10-13*/
{ "31131331" }, { "113111113111" }, { "3311113111" }, { "1111131331" }, { "31113331" }, { "1133113111" }, { "1313113111" }, { "1111113331" }, /*14-17*/
{ "311111113111" }, { "1113111331" }, { "1311111331" }, { "11111111113111" }, { "31131331" }, { "113111113111" }, { "3311113111" }, { "1111131331" }, /*18-1B*/
{ "31313311" }, { "1131311131" }, { "33311131" }, { "1111313311" }, { "311111113111" }, { "1113111331" }, { "1311111331" }, { "11111111113111" }, /*1C-1F*/
{ "3111311131" }, { "11333311" }, { "13133311" }, { "111111311131" }, { "31313311" }, { "1131311131" }, { "33311131" }, { "1111313311" }, /*20-23*/
{ "31331131" }, { "1131113311" }, { "33113311" }, { "1111331131" }, { "3111311131" }, { "11333311" }, { "13133311" }, { "111111311131" }, /*24-27*/
{ "3111113311" }, { "1113131131" }, { "1311131131" }, { "111111113311" }, { "31331131" }, { "1131113311" }, { "33113311" }, { "1111331131" }, /*28-2B*/
{ "3131111131" }, { "1131131311" }, { "33131311" }, { "111131111131" }, { "3111113311" }, { "1113131131" }, { "1311131131" }, { "111111113311" }, /*2C-2F*/
{ "3111131311" }, { "1133111131" }, { "1313111131" }, { "111111131311" }, { "3131111131" }, { "1131131311" }, { "33131311" }, { "111131111131" }, /*30-33*/
{ "3113111311" }, { "113111111131" }, { "3311111131" }, { "111113111311" }, { "3111131311" }, { "1133111131" }, { "1313111131" }, { "111111131311" }, /*34-37*/
{ "311111111131" }, { "111311111311" }, { "131111111311" }, { "11111111111131" }, { "3113111311" }, { "113111111131" }, { "3311111131" }, { "111113111311" }, /*38-3B*/
{ "3131311111" }, { "11313133" }, { "333133" }, { "111131311111" }, { "311111111131" }, { "111311111311" }, { "131111111311" }, { "11111111111131" }, /*3C-3F*/
{ "31113133" }, { "1133311111" }, { "1313311111" }, { "1111113133" }, { "3131311111" }, { "11313133" }, { "333133" }, { "111131311111" }, /*40-43*/
{ "313333" }, { "113111311111" }, { "3311311111" }, { "11113333" }, { "31113133" }, { "1133311111" }, { "1313311111" }, { "1111113133" }, /*44-47*/
{ "311111311111" }, { "11131333" }, { "13111333" }, { "11111111311111" }, { "313333" }, { "113111311111" }, { "3311311111" }, { "11113333" }, /*48-4B*/
{ "31311133" }, { "1131331111" }, { "33331111" }, { "1111311133" }, { "311111311111" }, { "11131333" }, { "13111333" }, { "11111111311111" }, /*4C-4F*/
{ "3111331111" }, { "11331133" }, { "13131133" }, { "111111331111" }, { "31311133" }, { "1131331111" }, { "33331111" }, { "1111311133" }, /*50-53*/
{ "3113131111" }, { "1131111133" }, { "33111133" }, { "111113131111" }, { "3111331111" }, { "11331133" }, { "13131133" }, { "111111331111" }, /*54-57*/
{ "3111111133" }, { "111311131111" }, { "131111131111" }, { "111111111133" }, { "3113131111" }, { "1131111133" }, { "33111133" }, { "111113131111" }, /*58-5B*/
{ "31311313" }, { "113131111111" }, { "3331111111" }, { "1111311313" }, { "3111111133" }, { "111311131111" }, { "131111131111" }, { "111111111133" /*START*/ }, /*5C-5F*/
{ "311131111111" }, { "11331313" }, { "13131313" }, { "11111131111111" }, { "31311313" }, { "113131111111" }, { "3331111111" }, { "1111311313" }, /*60-63*/
{ "3133111111" }, { "1131111313" }, { "33111313" }, { "111133111111" }, { "311131111111" }, { "11331313" }, { "13131313" }, { "11111131111111" }, /*64-67*/
{ "3111111313" }, { "111313111111" }, { "131113111111" }, { "111111111313" }, { "3133111111" }, { "1131111313" }, { "33111313" }, { "111133111111" }, /*68-6B*/
{ "313111111111" }, { "1131131113" }, { "33131113" }, { "11113111111111" }, { "3111111313" }, { "111313111111" }, { "131113111111" }, { "111111111313" }, /*6C-6F*/
{ "3111131113" }, { "113311111111" }, { "131311111111" }, { "111111131113" }, { "313111111111" }, { "1131131113" }, { "33131113" }, { "11113111111111" }, /*70-73*/
{ "3113111113" }, { "11311111111111" }, { "331111111111" }, { "111113111113" }, { "3111131113" }, { "113311111111" }, { "131311111111" }, { "111111131113" }, /*74-77*/
{ "31111111111111" }, { "111311111113" }, { "131111111113" }, { "3113111113" }, { "11311111111111" }, { "331111111111" /*STOP*/ }, { "111113111113" }, /*78-7B*/
{'1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1'}, { "31111111111111" }, { "111311111113" }, { "131111111113" }, /*7C-7E*/
{'1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1'}, /*7F*/
{ "111111113113" /*START 2*/ }, { "311311111111" /*STOP 2*/ }, /*80-81*/
{ "111111311113" /*START 3*/ }, { "311113111111" /*STOP 3*/ }, /*82-83*/
}; };
/* Generated by "backend/tests/test_telepen -f generate_lens -g" */ /* Generated by "backend/tests/test_telepen -f generate_lens -g" */
static const char TeleLens[128] = { static const char TeleLens[128] = {
8, 10, 8, 10, 10, 8, 8, 12, 8, 10, 8, 10, 10, 10, 10, 12, 8, 10, 8, 10, 10, 8, 8, 12, 8, 10, 8, 10, 10, 10, 10, 12, /*00-0F*/
10, 8, 6, 12, 8, 10, 10, 10, 8, 12, 10, 10, 12, 10, 10, 14, 10, 8, 6, 12, 8, 10, 10, 10, 8, 12, 10, 10, 12, 10, 10, 14, /*10-1F*/
8, 10, 8, 10, 10, 8, 8, 12, 8, 10, 8, 10, 10, 10, 10, 12, 8, 10, 8, 10, 10, 8, 8, 12, 8, 10, 8, 10, 10, 10, 10, 12, /*20-2F*/
10, 10, 8, 12, 10, 10, 10, 12, 10, 12, 10, 12, 12, 12, 12, 14, 10, 10, 8, 12, 10, 10, 10, 12, 10, 12, 10, 12, 12, 12, 12, 14, /*30-3F*/
10, 8, 6, 12, 8, 10, 10, 10, 6, 12, 10, 8, 12, 8, 8, 14, 10, 8, 6, 12, 8, 10, 10, 10, 6, 12, 10, 8, 12, 8, 8, 14, /*40-4F*/
8, 10, 8, 10, 10, 8, 8, 12, 10, 10, 8, 12, 10, 12, 12, 12, 8, 10, 8, 10, 10, 8, 8, 12, 10, 10, 8, 12, 10, 12, 12, 12, /*50-5F*/
8, 12, 10, 10, 12, 8, 8, 14, 10, 10, 8, 12, 10, 12, 12, 12, 8, 12, 10, 10, 12, 8, 8, 14, 10, 10, 8, 12, 10, 12, 12, 12, /*60-6F*/
12, 10, 8, 14, 10, 12, 12, 12, 10, 14, 12, 12, 14, 12, 12, 16 12, 10, 8, 14, 10, 12, 12, 12, 10, 14, 12, 12, 14, 12, 12, 16 /*70-7F*/
}; };
/* Expand numeric data */
static char *tele_num(struct zint_symbol *symbol, const unsigned char source[], const int length, int i, char *d,
int *p_count) {
assert((length & 1) == (i & 1));
for (; i < length; i += 2) {
int glyph;
if (source[i] == 'X') {
(void) z_errtxtf(0, symbol, 394, "Invalid odd position %d of \"X\" in Telepen data", i + 1);
return NULL;
}
glyph = source[i + 1] == 'X' ? z_ctoi(source[i]) + 17 : 10 * z_ctoi(source[i]) + z_ctoi(source[i + 1]) + 27;
*p_count += glyph;
memcpy(d, TeleTable[glyph], TeleLens[glyph]);
d += TeleLens[glyph];
}
return d;
}
/* Set height according to various Telepen docs and AIM USS Telepen (1991) */
static int tele_set_height(struct zint_symbol *symbol, const int asc_length, const int num_length,
const int have_dle) {
int warn_number = 0;
assert(asc_length > 0 || num_length > 0);
assert(!(num_length & 1));
if (symbol->output_options & COMPLIANT_HEIGHT) {
/* Following based on various Telepen docs and USS Telepen Section 3.2 Dimensions.
Recommended X between 0.01" & 0.0125" (0.254mm & 0.3175mm), so average is 0.01125" (0.28575mm).
Default height based on default 26pt at average X 0.01125" is then (26 / 72) / 0.01125 ~ 32X.
Per USS Telepen min height is 6.35mm or 15% of the symbol length whichever is greater, with
symbol length calculated as 16 * X * (3 + C + D/2 + S) + 2Q where
C is ASCII count, D numeric count, S whether have DLE or not, and Q quiet zone width (10X).
As don't have max X, use 15% as min height */
const float mult = 0.4584f; /* 0.191 * 16 * 15% */
const float min_height = z_stripf(mult * (3.0f + asc_length + num_length / 2 + have_dle) + 3.0f /*20*15%*/);
if (symbol->debug & ZINT_DEBUG_PRINT) printf("Min height: %.8g\n", min_height);
warn_number = z_set_height(symbol, min_height, min_height > 32.0f ? min_height : 32.0f, 0, 0 /*no_errtxt*/);
} else {
(void) z_set_height(symbol, 0.0f, 50.0f, 0, 1 /*no_errtxt*/);
}
return warn_number;
}
/* Telepen Alpha (Full ASCII) */
INTERNAL int zint_telepen(struct zint_symbol *symbol, unsigned char source[], int length) { INTERNAL int zint_telepen(struct zint_symbol *symbol, unsigned char source[], int length) {
int i, count, check_digit; int count, check_digit;
int error_number; int error_number;
int i;
int symbol_chars = length;
char dest[1145]; /* 12 (Start) + 69 * 16 (max for DELs) + 16 (Check) + 12 (stop) + 1 = 1145 */ char dest[1145]; /* 12 (Start) + 69 * 16 (max for DELs) + 16 (Check) + 12 (stop) + 1 = 1145 */
char *d = dest; char *d = dest;
unsigned char local_source[138];
int asc_length = length, num_length = 0, have_dle = 0;
const int asc_comp_num = symbol->option_2 == 1; /* AIM Full ASCII + Compressed Numeric mode */
const int content_segs = symbol->output_options & BARCODE_CONTENT_SEGS; const int content_segs = symbol->output_options & BARCODE_CONTENT_SEGS;
error_number = 0; /* Check for DLE (Compressed Numeric tail) only if AIM mode enabled */
if (asc_comp_num && length <= TELE_LENGTH_MAX) {
count = 0; for (i = 0; i < length; i++) {
if (source[i] == 0x10 /*DLE*/) {
if (length > 69) { /* 16 (Start) + 69 * 16 + 16 (Check) + 16 (Stop) = 1152 */ if (i == 0) {
return z_errtxtf(ZINT_ERROR_TOO_LONG, symbol, 390, "Input length %d too long (maximum 69)", length); return z_errtxt(ZINT_ERROR_INVALID_DATA, symbol, 397,
"DLE (ASCII 16) cannot be first character in Full ASCII + Compressed Numeric Mode");
}
asc_length = i + 1; /* Include DLE */
num_length = length - asc_length;
symbol_chars = asc_length + ((num_length + 1) >> 1);
have_dle = 1;
break;
}
}
} }
if (symbol_chars > TELE_SYMBOL_MAX) {
if (length <= TELE_LENGTH_MAX) {
return ZEXT z_errtxtf(ZINT_ERROR_TOO_LONG, symbol, 390,
"Input length %1$d too long, requires %2$d symbol characters (maximum "
TELE_SYMBOL_MAX_S ")", length, symbol_chars);
}
return z_errtxtf(ZINT_ERROR_TOO_LONG, symbol, 399,
"Input length %d too long, requires too many symbol characters (maximum "
TELE_SYMBOL_MAX_S ")", length);
}
/* Start character */ /* Start character */
memcpy(d, TeleTable['_'], 12); memcpy(d, TeleTable[asc_comp_num ? 0x82 : 0x5F], 12);
d += 12; d += 12;
for (i = 0; i < length; i++) { count = 0;
if (!z_isascii(source[i])) { for (i = 0; i < asc_length; i++) {
const unsigned char ch = source[i];
if (!z_isascii(ch)) {
/* Cannot encode extended ASCII */ /* Cannot encode extended ASCII */
return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 391, return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 391,
"Invalid character at position %d in input, extended ASCII not allowed", i + 1); "Invalid character at position %d in input, extended ASCII not allowed", i + 1);
} }
memcpy(d, TeleTable[source[i]], TeleLens[source[i]]); memcpy(d, TeleTable[ch], TeleLens[ch]);
d += TeleLens[source[i]]; d += TeleLens[ch];
count += source[i]; count += ch;
}
if (num_length) {
/* Compressed Numeric Mode tail */
if ((i = z_not_sane(SODIUM_X_F, source + asc_length, num_length))) {
return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 396,
"Invalid character at position %d in input (digits and \"X\" only)", asc_length + i);
}
memcpy(local_source, source, asc_length - 1); /* Exclude DLE */
/* Add a leading zero if required */
if (num_length & 1) {
local_source[asc_length - 1] = '0'; /* Replaces DLE */
memcpy(local_source + asc_length, source + asc_length, num_length++);
} else {
memcpy(local_source + asc_length - 1, source + asc_length, num_length);
length--; /* Less DLE */
}
asc_length--; /* Less DLE */
z_to_upper(local_source + asc_length, num_length);
if (!(d = tele_num(symbol, local_source, length, asc_length, d, &count))) {
return ZINT_ERROR_INVALID_DATA;
}
} }
check_digit = 127 - (count % 127); check_digit = 127 - (count % 127);
@@ -125,76 +230,110 @@ INTERNAL int zint_telepen(struct zint_symbol *symbol, unsigned char source[], in
if (symbol->debug & ZINT_DEBUG_PRINT) printf("Check digit: %d\n", check_digit); if (symbol->debug & ZINT_DEBUG_PRINT) printf("Check digit: %d\n", check_digit);
/* Stop character */ /* Stop character */
memcpy(d, TeleTable['z'], 12); memcpy(d, TeleTable[asc_comp_num ? 0x83 : 0x7A], 12);
d += 12; d += 12;
z_expand(symbol, dest, (int) (d - dest)); z_expand(symbol, dest, (int) (d - dest));
if (symbol->output_options & COMPLIANT_HEIGHT) { error_number = tele_set_height(symbol, asc_length, num_length, have_dle);
/* Default height from various Telepen docs is based on default 26pt at X 0.01125"
(average of 0.01" - 0.0125") = (26 / 72) / 0.01125 ~ 32; no min height specified */ if (num_length) {
(void) z_set_height(symbol, 0.0f, 32.0f, 0, 1 /*no_errtxt*/); z_hrt_cpy_iso8859_1(symbol, local_source, length); /* `local_source` HRT-ready */
} else { } else {
(void) z_set_height(symbol, 0.0f, 50.0f, 0, 1 /*no_errtxt*/); /* Chop off any trailing DLE if Full ASCII + Compressed Numeric mode */
z_hrt_cpy_iso8859_1(symbol, source, length - (asc_comp_num && source[length - 1] == 0x10));
} }
z_hrt_cpy_iso8859_1(symbol, source, length); if (content_segs) {
if (asc_length < length) {
if (content_segs && z_ct_cpy_cat(symbol, source, length, (char) check_digit, NULL /*cat*/, 0)) { local_source[length++] = check_digit;
return ZINT_ERROR_MEMORY; /* `z_ct_cpy_cat()` only fails with OOM */ if (z_ct_cpy_cat(symbol, source, asc_length, '\x10' /*DLE*/,
local_source + asc_length, length - asc_length)) {
return ZINT_ERROR_MEMORY; /* `z_ct_cpy_cat()` only fails with OOM */
}
} else if (z_ct_cpy_cat(symbol, source, length, (char) check_digit, NULL /*cat*/, 0)) {
return ZINT_ERROR_MEMORY; /* `z_ct_cpy_cat()` only fails with OOM */
}
} }
return error_number; return error_number;
} }
/* Telepen Numeric (Compressed Numeric Mode) */
INTERNAL int zint_telepen_num(struct zint_symbol *symbol, unsigned char source[], int length) { INTERNAL int zint_telepen_num(struct zint_symbol *symbol, unsigned char source[], int length) {
int count, check_digit, glyph; int count, check_digit;
int error_number = 0; int error_number = 0;
int i; int i;
char dest[1129]; /* 12 (Start) + 68 * 16 (max for DELs) + 16 (Check) + 12 (Stop) + 1 = 1129 */ int symbol_chars = (length + 1) >> 1;
char dest[1145]; /* 12 (Start) + 69 * 16 (max for DELs) + 16 (Check) + 12 (stop) + 1 = 1145 */
char *d = dest; char *d = dest;
unsigned char local_source[137]; unsigned char local_source[136 + 1 + 1];
int num_length = length, have_dle = 0;
const int comp_num_asc = symbol->option_2 == 1; /* AIM Compressed Numeric + Full ASCII mode */
const int content_segs = symbol->output_options & BARCODE_CONTENT_SEGS; const int content_segs = symbol->output_options & BARCODE_CONTENT_SEGS;
count = 0; /* Check for DLE (Full ASCII tail) whether AIM mode or not */
if (length <= TELE_LENGTH_MAX) { /* Max possible is 138 digits */
if (length > 136) { /* 68*2 */ for (i = 0; i < length; i++) {
return z_errtxtf(ZINT_ERROR_TOO_LONG, symbol, 392, "Input length %d too long (maximum 136)", length); if (source[i] == 0x10 /*DLE*/) {
if (i == 0) {
return z_errtxt(ZINT_ERROR_INVALID_DATA, symbol, 398,
"DLE (ASCII 16) cannot be first character in Compressed Numeric Mode");
}
num_length = i; /* DLE not counted */
symbol_chars = length - num_length + ((num_length + 1) >> 1);
have_dle = 1;
break;
}
}
} }
if ((i = z_not_sane(SODIUM_X_F, source, length))) {
if (symbol_chars > TELE_SYMBOL_MAX) {
if (length <= TELE_LENGTH_MAX) {
return ZEXT z_errtxtf(ZINT_ERROR_TOO_LONG, symbol, 392,
"Input length %1$d too long, requires %2$d symbol characters (maximum "
TELE_SYMBOL_MAX_S ")", length, symbol_chars);
}
return z_errtxtf(ZINT_ERROR_TOO_LONG, symbol, 400,
"Input length %d too long, requires too many symbol characters (maximum "
TELE_SYMBOL_MAX_S ")", length);
}
if ((i = z_not_sane(SODIUM_X_F, source, num_length))) {
return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 393, return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 393,
"Invalid character at position %d in input (digits and \"X\" only)", i); "Invalid character at position %d in input (digits and \"X\" only)", i);
} }
/* Add a leading zero if required */ /* Add a leading zero if required */
if (length & 1) { if (num_length & 1) {
memcpy(local_source + 1, source, length++); memcpy(local_source + 1, source, length++);
local_source[0] = '0'; local_source[0] = '0';
num_length++;
} else { } else {
memcpy(local_source, source, length); memcpy(local_source, source, length);
} }
z_to_upper(local_source, length); z_to_upper(local_source, num_length);
/* Start character */ /* Start character */
memcpy(d, TeleTable['_'], 12); memcpy(d, TeleTable[comp_num_asc ? 0x80 : 0x5F], 12);
d += 12; d += 12;
for (i = 0; i < length; i += 2) { count = 0;
if (local_source[i] == 'X') { if (!(d = tele_num(symbol, local_source, num_length, 0 /*i*/, d, &count))) {
return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 394, "Invalid odd position %d of \"X\" in Telepen data", return ZINT_ERROR_INVALID_DATA;
i + 1); }
for (i = num_length; i < length; i++) {
/* Full ASCII tail */
const unsigned char ch = local_source[i];
assert(i > num_length || ch == '\x10'); /* 1st char DLE */
if (!z_isascii(ch)) {
/* Cannot encode extended ASCII */
return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 395,
"Invalid character at position %d in input, extended ASCII not allowed", i + 1);
} }
memcpy(d, TeleTable[ch], TeleLens[ch]);
if (local_source[i + 1] == 'X') { d += TeleLens[ch];
glyph = z_ctoi(local_source[i]) + 17; count += ch;
count += glyph;
} else {
glyph = 10 * z_ctoi(local_source[i]) + z_ctoi(local_source[i + 1]);
glyph += 27;
count += glyph;
}
memcpy(d, TeleTable[glyph], TeleLens[glyph]);
d += TeleLens[glyph];
} }
check_digit = 127 - (count % 127); check_digit = 127 - (count % 127);
@@ -207,21 +346,31 @@ INTERNAL int zint_telepen_num(struct zint_symbol *symbol, unsigned char source[]
if (symbol->debug & ZINT_DEBUG_PRINT) printf("Check digit: %d\n", check_digit); if (symbol->debug & ZINT_DEBUG_PRINT) printf("Check digit: %d\n", check_digit);
/* Stop character */ /* Stop character */
memcpy(d, TeleTable['z'], 12); memcpy(d, TeleTable[comp_num_asc ? 0x81 : 0x7A], 12);
d += 12; d += 12;
z_expand(symbol, dest, (int) (d - dest)); z_expand(symbol, dest, (int) (d - dest));
if (symbol->output_options & COMPLIANT_HEIGHT) { error_number = tele_set_height(symbol, length - num_length /*asc_length*/, num_length, have_dle);
(void) z_set_height(symbol, 0.0f, 32.0f, 0, 1 /*no_errtxt*/); /* Same as alphanumeric Telepen */
if (num_length < length) {
/* Omit DLE */
z_hrt_cpy_cat_nochk(symbol, local_source, num_length, '\xFF' /*separator (none)*/,
local_source + num_length + 1, length - (num_length + 1));
} else { } else {
(void) z_set_height(symbol, 0.0f, 50.0f, 0, 1 /*no_errtxt*/); z_hrt_cpy_nochk(symbol, local_source, length);
} }
z_hrt_cpy_nochk(symbol, local_source, length); if (content_segs) {
if (num_length < length) {
if (content_segs && z_ct_cpy_cat(symbol, local_source, length, (char) check_digit, NULL /*cat*/, 0)) { local_source[length++] = check_digit;
return ZINT_ERROR_MEMORY; /* `z_ct_cpy_cat()` only fails with OOM */ if (z_ct_cpy_cat(symbol, local_source, num_length, '\xFF' /*separator (none)*/,
local_source + num_length, length - num_length)) {
return ZINT_ERROR_MEMORY; /* `z_ct_cpy_cat()` only fails with OOM */
}
} else if (z_ct_cpy_cat(symbol, local_source, length, (char) check_digit, NULL /*cat*/, 0)) {
return ZINT_ERROR_MEMORY; /* `z_ct_cpy_cat()` only fails with OOM */
}
} }
return error_number; return error_number;
+196 -165
View File
@@ -256,7 +256,7 @@ static void test_checks(const testCtx *const p_ctx) {
symbol->warn_level = data[i].warn_level; symbol->warn_level = data[i].warn_level;
} }
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length); ret = ZBarcode_Encode(symbol, ZCUCP(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode(%d) ret %d != %d (%s)\n", assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode(%d) ret %d != %d (%s)\n",
i, data[i].symbology, ret, data[i].ret, symbol->errtxt); i, data[i].symbology, ret, data[i].ret, symbol->errtxt);
@@ -298,18 +298,18 @@ static void test_checks_segs(const testCtx *const p_ctx) {
/* 0*/ { BARCODE_CODE128, -1, { { NULL, 0, 0 }, { NULL, 0, 0 } }, 0, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 205: No input data" }, /* 0*/ { BARCODE_CODE128, -1, { { NULL, 0, 0 }, { NULL, 0, 0 } }, 0, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 205: No input data" },
/* 1*/ { BARCODE_CODE128, -1, { { NULL, 0, 0 }, { NULL, 0, 0 } }, 257, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 771: Too many input segments (maximum 256)" }, /* 1*/ { BARCODE_CODE128, -1, { { NULL, 0, 0 }, { NULL, 0, 0 } }, 257, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 771: Too many input segments (maximum 256)" },
/* 2*/ { BARCODE_CODE128, -1, { { NULL, 0, 0 }, { NULL, 0, 0 } }, 1, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 772: Input segment 0 source NULL" }, /* 2*/ { BARCODE_CODE128, -1, { { NULL, 0, 0 }, { NULL, 0, 0 } }, 1, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 772: Input segment 0 source NULL" },
/* 3*/ { BARCODE_CODE128, -1, { { TU(""), 0, 0 }, { NULL, 0, 0 } }, 1, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 778: No input data" }, /* 3*/ { BARCODE_CODE128, -1, { { ZUCP(""), 0, 0 }, { NULL, 0, 0 } }, 1, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 778: No input data" },
/* 4*/ { BARCODE_CODE128, -1, { { TU("A"), 0, 0 }, { NULL, 0, 0 } }, 2, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 772: Input segment 1 source NULL" }, /* 4*/ { BARCODE_CODE128, -1, { { ZUCP("A"), 0, 0 }, { NULL, 0, 0 } }, 2, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 772: Input segment 1 source NULL" },
/* 5*/ { BARCODE_CODE128, -1, { { TU("A"), 0, 0 }, { TU(""), 0, 0 } }, 2, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 773: Input segment 1 empty" }, /* 5*/ { BARCODE_CODE128, -1, { { ZUCP("A"), 0, 0 }, { ZUCP(""), 0, 0 } }, 2, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 773: Input segment 1 empty" },
/* 6*/ { BARCODE_CODE128, -1, { { TU("A"), 0, 3 }, { TU("B"), 0, 0 } }, 2, -1, 4, -1, ZINT_ERROR_INVALID_OPTION, "Error 774: Symbol ECI '4' must match segment zero ECI '3'" }, /* 6*/ { BARCODE_CODE128, -1, { { ZUCP("A"), 0, 3 }, { ZUCP("B"), 0, 0 } }, 2, -1, 4, -1, ZINT_ERROR_INVALID_OPTION, "Error 774: Symbol ECI '4' must match segment zero ECI '3'" },
/* 7*/ { BARCODE_CODE128, -1, { { TU("A"), 0, 3 }, { TU("B"), 0, 4 } }, 2, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 775: Symbology does not support multiple segments" }, /* 7*/ { BARCODE_CODE128, -1, { { ZUCP("A"), 0, 3 }, { ZUCP("B"), 0, 4 } }, 2, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 775: Symbology does not support multiple segments" },
/* 8*/ { BARCODE_CODE128, -1, { { TU("A"), 0, 3 }, { NULL, 0, 0 } }, 1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 217: Symbology does not support ECI switching" }, /* 8*/ { BARCODE_CODE128, -1, { { ZUCP("A"), 0, 3 }, { NULL, 0, 0 } }, 1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 217: Symbology does not support ECI switching" },
/* 9*/ { BARCODE_AZTEC, -1, { { TU("A"), 0, 3 }, { TU("B"), 0, 1 } }, 2, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 218: ECI code '1' out of range (0 to 999999, excluding 1, 2, 14 and 19)" }, /* 9*/ { BARCODE_AZTEC, -1, { { ZUCP("A"), 0, 3 }, { ZUCP("B"), 0, 1 } }, 2, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 218: ECI code '1' out of range (0 to 999999, excluding 1, 2, 14 and 19)" },
/* 10*/ { BARCODE_AZTEC, -1, { { TU("A"), 0, 3 }, { TU("B"), 0, 4 } }, 2, GS1_MODE, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 776: GS1 mode not supported for multiple segments" }, /* 10*/ { BARCODE_AZTEC, -1, { { ZUCP("A"), 0, 3 }, { ZUCP("B"), 0, 4 } }, 2, GS1_MODE, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 776: GS1 mode not supported for multiple segments" },
/* 11*/ { BARCODE_AZTEC, -1, { { TU("A"), 0, 3 }, { TU("\200"), 0, 4 } }, 2, UNICODE_MODE, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 215: Invalid UTF-8 in input" }, /* 11*/ { BARCODE_AZTEC, -1, { { ZUCP("A"), 0, 3 }, { ZUCP("\200"), 0, 4 } }, 2, UNICODE_MODE, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 215: Invalid UTF-8 in input" },
/* 12*/ { BARCODE_AZTEC, -1, { { TU("A"), 0, 3 }, { TU("B"), 0, 4 } }, 2, -1, -1, -1, 0, "" }, /* 12*/ { BARCODE_AZTEC, -1, { { ZUCP("A"), 0, 3 }, { ZUCP("B"), 0, 4 } }, 2, -1, -1, -1, 0, "" },
/* 13*/ { BARCODE_AZTEC, -1, { { TU("A"), 0, 0 }, { TU("B"), 0, 4 } }, 2, -1, 3, -1, 0, "" }, /* 13*/ { BARCODE_AZTEC, -1, { { ZUCP("A"), 0, 0 }, { ZUCP("B"), 0, 4 } }, 2, -1, 3, -1, 0, "" },
/* 14*/ { BARCODE_AZTEC, -1, { { TU("A"), ZINT_MAX_DATA_LEN, 3 }, { TU("B"), 1, 4 } }, 2, -1, -1, -1, ZINT_ERROR_TOO_LONG, "Error 214: Input too long" }, /* 14*/ { BARCODE_AZTEC, -1, { { ZUCP("A"), ZINT_MAX_DATA_LEN, 3 }, { ZUCP("B"), 1, 4 } }, 2, -1, -1, -1, ZINT_ERROR_TOO_LONG, "Error 214: Input too long" },
}; };
const int data_size = ARRAY_SIZE(data); const int data_size = ARRAY_SIZE(data);
int i, ret; int i, ret;
@@ -393,7 +393,7 @@ static void test_input_data(const testCtx *const p_ctx) {
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, -1 /*output_options*/, -1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, -1 /*output_options*/,
text, -1, debug); text, -1, debug);
ret = ZBarcode_Encode(symbol, TCU(text), length); ret = ZBarcode_Encode(symbol, ZCUCP(text), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode(%d) ret %d != %d (%s)\n", assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode(%d) ret %d != %d (%s)\n",
i, data[i].symbology, ret, data[i].ret, symbol->errtxt); i, data[i].symbology, ret, data[i].ret, symbol->errtxt);
@@ -579,7 +579,7 @@ static void test_symbologies(const testCtx *const p_ctx) {
if (testContinue(p_ctx, i)) continue; if (testContinue(p_ctx, i)) continue;
symbol->symbology = i; symbol->symbology = i;
ret = ZBarcode_Encode(symbol, TCU(""), 0); ret = ZBarcode_Encode(symbol, ZCUCP(""), 0);
assert_notequal(ret, ZINT_ERROR_ENCODING_PROBLEM, "i:%d Encoding problem (%s)\n", i, symbol->errtxt); assert_notequal(ret, ZINT_ERROR_ENCODING_PROBLEM, "i:%d Encoding problem (%s)\n", i, symbol->errtxt);
if (!ZBarcode_ValidID(i)) { if (!ZBarcode_ValidID(i)) {
@@ -654,7 +654,7 @@ static void test_input_mode(const testCtx *const p_ctx) {
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, -1 /*output_options*/, -1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, -1 /*output_options*/,
data[i].data, -1, debug); data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length); ret = ZBarcode_Encode(symbol, ZCUCP(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n",
i, ret, data[i].ret, symbol->errtxt); i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->input_mode, data[i].expected_input_mode, "i:%d symbol->input_mode %d != %d\n", assert_equal(symbol->input_mode, data[i].expected_input_mode, "i:%d symbol->input_mode %d != %d\n",
@@ -684,115 +684,146 @@ static void test_escape_char_process(const testCtx *const p_ctx) {
const char *comment; const char *comment;
}; };
static const struct item data[] = { static const struct item data[] = {
/* 0*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", "", 0, 26, "01 05 08 09 0A 0B 0C 0D 0E 1C 1E 1F EB 02 5D 81 21 0D 92 2E 3D FD B6 9A 37 2A CD 61 FB 95", 0, "" }, /* 0*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\L\\e\\F\\G\\R\\N\\x81\\\\", "", 0, 18, "(32) 01 05 08 09 0A 0B 0C 0D 0E 11 1C 1D 1E 1F 20 EB 02 5D EE 69 A6 C6 63 7C FC 73 CE F7", 0, "" },
/* 1*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", "", 0, 101, "(45) 67 62 43 40 44 47 48 29 6A 67 62 0B 49 4A 4B 4C 18 6A 67 62 0C 4D 5B 5D 5E 62 6A 67", 0, "" }, /* 1*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\L\\e\\F\\G\\R\\N\\x81\\\\", "", 0, 101, "(54) 67 62 44 40 44 47 48 2B 6A 67 62 0B 49 4A 4B 4C 18 6A 67 62 0C 4D 50 5B 5C 20 6A 67", 0, "" },
/* 2*/ { BARCODE_CODE16K, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", "", 0, 70, "(20) 14 64 68 71 72 73 74 75 76 77 91 93 94 101 65 60 103 103 45 61", 0, "" }, /* 2*/ { BARCODE_CODE16K, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\L\\e\\F\\G\\R\\N\\x81\\\\", "", 0, 70, "(25) 21 64 68 71 72 73 74 75 76 77 80 91 92 93 94 95 101 65 60 103 103 103 103 38 59", 0, "" },
/* 3*/ { BARCODE_DOTCODE, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", "", 0, 28, "65 40 44 47 48 49 4A 4B 4C 4D 5B 5D 5E 6E 41 3C 6A", 0, "" }, /* 3*/ { BARCODE_DOTCODE, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\L\\e\\F\\G\\R\\N\\x81\\\\", "", 0, 29, "65 40 44 47 48 49 4A 4B 4C 4D 50 5B 5C 5D 5E 5F 6E 41 3C", 0, "" },
/* 4*/ { BARCODE_GRIDMATRIX, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", "", 0, 30, "30 1A 00 02 01 61 00 48 28 16 0C 06 46 63 51 74 05 38 00", 0, "" }, /* 4*/ { BARCODE_GRIDMATRIX, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\L\\e\\F\\G\\R\\N\\x81\\\\", "", 0, 30, "30 20 00 02 01 61 00 48 28 16 0C 06 44 03 31 60 74 3C 1F 40 57 00", 0, "" },
/* 5*/ { BARCODE_HANXIN, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", "", 0, 23, "2F 80 10 72 09 28 B3 0D 6F F3 00 20 E8 F4 0A E0 00", 0, "" }, /* 5*/ { BARCODE_HANXIN, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\L\\e\\F\\G\\R\\N\\x81\\\\", "", 0, 23, "2F 80 10 72 09 28 B3 0D 41 BF CC 00 C3 83 A3 C3 F0 2B 80 00 00", 0, "" },
/* 6*/ { BARCODE_MAXICODE, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", "", 0, 30, "(144) 04 3E 3E 00 04 07 08 09 0A 0B 03 3D 2C 24 19 1E 23 1B 18 0E 0C 0D 1E 3F 1D 1E 3C 31", 0, "" }, /* 6*/ { BARCODE_MAXICODE, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\L\\e\\F\\G\\R\\N\\x81\\\\", "", 0, 30, "(144) 04 3E 3E 00 04 07 08 09 0A 0B 03 3D 2C 24 19 1E 23 1B 18 0E 0C 0D 10 1E 20 21 22 23", 0, "" },
/* 7*/ { BARCODE_PDF417, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", "", 0, 120, "(24) 16 901 0 23 655 318 98 18 461 639 893 122 129 92 900 900 872 438 359 646 522 773 831", 0, "" }, /* 7*/ { BARCODE_PDF417, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\L\\e\\F\\G\\R\\N\\x81\\\\", "", 0, 120, "(27) 19 901 0 23 655 318 98 18 461 639 91 512 29 30 31 129 92 900 900 114 476 670 717 35", 0, "" },
/* 8*/ { BARCODE_ULTRA, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", "", 0, 20, "(28) 257 17 262 228 6 273 193 226 91 24 283 4 0 4 7 8 9 10 11 12 13 27 29 30 129 92 284 7", 0, "" }, /* 8*/ { BARCODE_ULTRA, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\L\\e\\F\\G\\R\\N\\x81\\\\", "", 0, 22, "(30) 257 20 227 30 152 79 176 10 152 27 283 4 0 4 7 8 9 10 11 12 13 16 27 28 29 30 31 129", 0, "" },
/* 9*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\d129\\o201\\\\", "", 0, 18, "(32) 01 05 08 09 0A 0B 0C 0D 0E 1C 1E 1F E7 32 45 DB 70 5D E3 16 7B 2B 44 60 E1 55 F7 08", 0, "" }, /* 9*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\L\\e\\F\\G\\R\\N\\x81\\d129\\o201\\\\", "", 0, 20, "(40) 01 05 08 09 0A 0B 0C 0D 0E 11 1C 1D 1E 1F 20 E7 F2 06 9C 31 5D 81 AE E5 8D 14 8D 36", 0, "" },
/* 10*/ { BARCODE_HANXIN, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\d129\\o201\\\\", "", 0, 23, "2F 80 10 72 09 28 B3 0D 6F F3 00 30 E8 F4 0C 0C 0A E0 00 00 00", 0, "" }, /* 10*/ { BARCODE_HANXIN, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\L\\e\\F\\G\\R\\N\\x81\\d129\\o201\\\\", "", 0, 23, "2F 80 10 72 09 28 B3 0D 41 BF CC 01 03 83 A3 C3 F0 30 30 2B 80", 0, "" },
/* 11*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\c", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\c' in input", 0, "" }, /* 11*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\c", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\c' in input", 0, "" },
/* 12*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\", "", ZINT_ERROR_INVALID_DATA, 0, "Error 236: Incomplete escape character in input", 0, "" }, /* 12*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\g", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\g' in input", 0, "" },
/* 13*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\x", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\x' escape sequence in input", 0, "" }, /* 13*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\h", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\h' in input", 0, "" },
/* 14*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\x1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\x' escape sequence in input", 0, "" }, /* 14*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\i", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\i' in input", 0, "" },
/* 15*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\x1g", "", ZINT_ERROR_INVALID_DATA, 0, "Error 238: Invalid character in escape sequence '\\x1g' in input (hexadecimal only)", 0, "" }, /* 15*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\j", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\j' in input", 0, "" },
/* 16*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\d' escape sequence in input", 0, "" }, /* 16*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\k", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\k' in input", 0, "" },
/* 17*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\d' escape sequence in input", 0, "" }, /* 17*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\l", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\l' in input", 0, "" },
/* 18*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d12", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\d' escape sequence in input", 0, "" }, /* 18*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\m", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\m' in input", 0, "" },
/* 19*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d12a", "", ZINT_ERROR_INVALID_DATA, 0, "Error 238: Invalid character in escape sequence '\\d12a' in input (decimal only)", 0, "" }, /* 19*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\p", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\p' in input", 0, "" },
/* 20*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d256", "", ZINT_ERROR_INVALID_DATA, 0, "Error 237: Value of escape sequence '\\d256' in input out of range (000 to 255)", 0, "" }, /* 20*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\q", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\q' in input", 0, "" },
/* 21*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\o' escape sequence in input", 0, "" }, /* 21*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\s", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\s' in input", 0, "" },
/* 22*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\o' escape sequence in input", 0, "" }, /* 22*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\w", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\w' in input", 0, "" },
/* 23*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o12", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\o' escape sequence in input", 0, "" }, /* 23*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\y", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\y' in input", 0, "" },
/* 24*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o128", "", ZINT_ERROR_INVALID_DATA, 0, "Error 238: Invalid character in escape sequence '\\o128' in input (octal only)", 0, "" }, /* 24*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\z", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\z' in input", 0, "" },
/* 25*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o400", "", ZINT_ERROR_INVALID_DATA, 0, "Error 237: Value of escape sequence '\\o400' in input out of range (000 to 377)", 0, "" }, /* 25*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\A", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\A' in input", 0, "" },
/* 26*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\xA01\\xFF", "", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 0, "" }, /* 26*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\B", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\B' in input", 0, "" },
/* 27*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d1601\\d255", "", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 1, "" }, /* 27*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\C", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\C' in input", 0, "" },
/* 28*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o2401\\o377", "", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 1, "" }, /* 28*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\D", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\D' in input", 0, "" },
/* 29*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\u00A01\\u00FF", "", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 1, "" }, /* 29*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\H", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\H' in input", 0, "" },
/* 30*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\U0000A01\\U0000FF", "", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 1, "" }, /* 30*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\I", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\I' in input", 0, "" },
/* 31*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\xc3\\xbF", "", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 0, "" }, /* 31*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\J", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\J' in input", 0, "" },
/* 32*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d195\\d191", "", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 1, "" }, /* 32*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\K", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\K' in input", 0, "" },
/* 33*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o303\\o277", "", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 1, "" }, /* 33*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\M", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\M' in input", 0, "" },
/* 34*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u00fF", "", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 1, "" }, /* 34*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\O", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\O' in input", 0, "" },
/* 35*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U0000fF", "", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 1, "" }, /* 35*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\P", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\P' in input", 0, "" },
/* 36*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\xc3\\xbF", "", 0, 10, "EB 80 81 47 1E 45 FC 93", 0, "" }, /* 36*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\Q", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\Q' in input", 0, "" },
/* 37*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\d195\\d191", "", 0, 10, "EB 80 81 47 1E 45 FC 93", 1, "" }, /* 37*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\S", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\S' in input", 0, "" },
/* 38*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\o303\\o277", "", 0, 10, "EB 80 81 47 1E 45 FC 93", 1, "" }, /* 38*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\T", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\T' in input", 0, "" },
/* 39*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\u00fF", "", 0, 10, "EB 80 81 47 1E 45 FC 93", 1, "" }, /* 39*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\V", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\V' in input", 0, "" },
/* 40*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\U0000fF", "", 0, 10, "EB 80 81 47 1E 45 FC 93", 1, "" }, /* 40*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\W", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\W' in input", 0, "" },
/* 41*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input", 0, "" }, /* 41*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\X", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\X' in input", 0, "" },
/* 42*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\uF", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input", 0, "" }, /* 42*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\Y", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\Y' in input", 0, "" },
/* 43*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u0F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input", 0, "" }, /* 43*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\Z", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\Z' in input", 0, "" },
/* 44*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\uFG", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input", 0, "" }, /* 44*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\", "", ZINT_ERROR_INVALID_DATA, 0, "Error 236: Incomplete escape character in input", 0, "" },
/* 45*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u00F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input", 0, "" }, /* 45*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\x", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\x' escape sequence in input", 0, "" },
/* 46*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u00FG", "", ZINT_ERROR_INVALID_DATA, 0, "Error 211: Invalid character for '\\u' escape sequence in input (hexadecimal only)", 0, "" }, /* 46*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\x1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\x' escape sequence in input", 0, "" },
/* 47*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\ufffe", "", ZINT_ERROR_INVALID_DATA, 0, "Error 216: Value of escape sequence '\\ufffe' in input out of range", 0, "Reversed BOM" }, /* 47*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\x1g", "", ZINT_ERROR_INVALID_DATA, 0, "Error 238: Invalid character in escape sequence '\\x1g' in input (hexadecimal only)", 0, "" },
/* 48*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\ud800", "", ZINT_ERROR_INVALID_DATA, 0, "Error 216: Value of escape sequence '\\ud800' in input out of range", 0, "Surrogate" }, /* 48*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\d' escape sequence in input", 0, "" },
/* 49*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\udfff", "", ZINT_ERROR_INVALID_DATA, 0, "Error 216: Value of escape sequence '\\udfff' in input out of range", 0, "Surrogate" }, /* 49*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\d' escape sequence in input", 0, "" },
/* 50*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\uffff", "", 0, 12, "E7 2C B0 16 AB A1 1F 85 EB 50 A1 4C", 0, "" }, /* 50*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d12", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\d' escape sequence in input", 0, "" },
/* 51*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 17, "\\xE2\\x82\\xAC", "", 0, 12, "F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E", 0, "Zint manual 4.10 Ex1" }, /* 51*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d12a", "", ZINT_ERROR_INVALID_DATA, 0, "Error 238: Invalid character in escape sequence '\\d12a' in input (decimal only)", 0, "" },
/* 52*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 17, "\\u20AC", "", 0, 12, "F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E", 1, "" }, /* 52*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d256", "", ZINT_ERROR_INVALID_DATA, 0, "Error 237: Value of escape sequence '\\d256' in input out of range (000 to 255)", 0, "" },
/* 53*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 17, "\\U0020AC", "", 0, 12, "F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E", 1, "" }, /* 53*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\o' escape sequence in input", 0, "" },
/* 54*/ { BARCODE_DATAMATRIX, DATA_MODE, 17, "\\xA4", "", 0, 12, "F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E", 1, "" }, /* 54*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\o' escape sequence in input", 0, "" },
/* 55*/ { BARCODE_DATAMATRIX, DATA_MODE, 28, "\\xB1\\x60", "", 0, 12, "F1 1D EB 32 61 D9 1C 0C C2 46 C3 B2", 0, "Zint manual 4.10 Ex2" }, /* 55*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o12", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\o' escape sequence in input", 0, "" },
/* 56*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 28, "\\u5E38", "", 0, 12, "F1 1D EB 32 61 D9 1C 0C C2 46 C3 B2", 1, "" }, /* 56*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o128", "", ZINT_ERROR_INVALID_DATA, 0, "Error 238: Invalid character in escape sequence '\\o128' in input (octal only)", 0, "" },
/* 57*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 28, "\\U005E38", "", 0, 12, "F1 1D EB 32 61 D9 1C 0C C2 46 C3 B2", 1, "" }, /* 57*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o400", "", ZINT_ERROR_INVALID_DATA, 0, "Error 237: Value of escape sequence '\\o400' in input out of range (000 to 377)", 0, "" },
/* 58*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\u007F", "", 0, 10, "80 81 46 73 64 88 6A 84", 0, "" }, /* 58*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\xA01\\xFF", "", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 0, "" },
/* 59*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\U00007F", "", 0, 10, "80 81 46 73 64 88 6A 84", 0, "" }, /* 59*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d1601\\d255", "", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 1, "" },
/* 60*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" }, /* 60*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o2401\\o377", "", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 1, "" },
/* 61*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\UF", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" }, /* 61*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\u00A01\\u00FF", "", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 1, "" },
/* 62*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U0F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" }, /* 62*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\U0000A01\\U0000FF", "", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 1, "" },
/* 63*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\UFG", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" }, /* 63*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\xc3\\xbF", "", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 0, "" },
/* 64*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U00F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" }, /* 64*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d195\\d191", "", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 1, "" },
/* 65*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U00FG", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" }, /* 65*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o303\\o277", "", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 1, "" },
/* 66*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\Ufffe", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "Reversed BOM" }, /* 66*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u00fF", "", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 1, "" },
/* 67*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\Ud800", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "Surrogate" }, /* 67*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U0000fF", "", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 1, "" },
/* 68*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\Udfff", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "Surrogate" }, /* 68*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\xc3\\xbF", "", 0, 10, "EB 80 81 47 1E 45 FC 93", 0, "" },
/* 69*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U000F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" }, /* 69*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\d195\\d191", "", 0, 10, "EB 80 81 47 1E 45 FC 93", 1, "" },
/* 70*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U0000F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" }, /* 70*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\o303\\o277", "", 0, 10, "EB 80 81 47 1E 45 FC 93", 1, "" },
/* 71*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U110000", "", ZINT_ERROR_INVALID_DATA, 0, "Error 216: Value of escape sequence '\\U110000' in input out of range", 0, "" }, /* 71*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\u00fF", "", 0, 10, "EB 80 81 47 1E 45 FC 93", 1, "" },
/* 72*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 25, "\\U10FFFF", "", 0, 14, "F1 1A E7 57 C7 81 F7 AC 09 06 28 51 F3 00 E1 8C 2A 1C", 0, "" }, /* 72*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\U0000fF", "", 0, 10, "EB 80 81 47 1E 45 FC 93", 1, "" },
/* 73*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 26, "\\U10FFFF", "", 0, 14, "F1 1B E7 57 E0 11 D7 6C 4F 45 E2 B3 FF F1 72 AB 54 9F", 0, "" }, /* 73*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input", 0, "" },
/* 74*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 32, "\\U10FFFF", "", 0, 14, "F1 21 EB 64 33 EB 1B 36 1D F7 B1 6D 8C A6 34 64 19 3A", 0, "" }, /* 74*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\uF", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input", 0, "" },
/* 75*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 33, "\\U10FFFF", "", 0, 14, "F1 22 E7 57 EB 5D 17 8C C1 B0 B6 B2 53 78 E4 7D 61 CB", 0, "" }, /* 75*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u0F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input", 0, "" },
/* 76*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 34, "\\U10FFFF", "", 0, 14, "F1 23 01 11 EB 80 EB 80 90 33 51 1B FA AE 78 F7 05 44", 0, "" }, /* 76*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\uFG", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input", 0, "" },
/* 77*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 35, "\\U10FFFF", "", 0, 14, "F1 24 EB 80 EB 80 11 01 17 BA C6 05 9F 4C EA E5 18 31", 0, "" }, /* 77*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u00F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input", 0, "" },
/* 78*/ { BARCODE_GS1_128_CC, GS1_MODE, -1, "[20]10", "[10]A", 0, 99, "(7) 105 102 20 10 100 59 106", 0, "" }, /* 78*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u00FG", "", ZINT_ERROR_INVALID_DATA, 0, "Error 211: Invalid character for '\\u' escape sequence in input (hexadecimal only)", 0, "" },
/* 79*/ { BARCODE_GS1_128_CC, GS1_MODE, -1, "[2\\x30]1\\d048", "[\\x310]\\x41", 0, 99, "(7) 105 102 20 10 100 59 106", 1, "" }, /* 79*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\ufffe", "", ZINT_ERROR_INVALID_DATA, 0, "Error 216: Value of escape sequence '\\ufffe' in input out of range", 0, "Reversed BOM" },
/* 80*/ { BARCODE_AZTEC, DATA_MODE, -1, "\\^11", "", ZINT_ERROR_INVALID_DATA, 0, "Error 798: Escape '\\^' only valid in Extra Escape mode", 0, "" }, /* 80*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\ud800", "", ZINT_ERROR_INVALID_DATA, 0, "Error 216: Value of escape sequence '\\ud800' in input out of range", 0, "Surrogate" },
/* 81*/ { BARCODE_AZTEC, GS1_MODE, -1, "\\^11", "", ZINT_ERROR_INVALID_DATA, 0, "Error 798: Escape '\\^' only valid in Extra Escape mode", 0, "" }, /* 81*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\udfff", "", ZINT_ERROR_INVALID_DATA, 0, "Error 216: Value of escape sequence '\\udfff' in input out of range", 0, "Surrogate" },
/* 82*/ { BARCODE_AZTEC, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\^11", "", 0, 15, "(102) 31 31 30 30 31 31 30 31 31 31 30 30 31 31 30 30 31 31 30 31 30 30 31 30 30 30 30 30", 0, "" }, /* 82*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\uffff", "", 0, 12, "E7 2C B0 16 AB A1 1F 85 EB 50 A1 4C", 0, "" },
/* 83*/ { BARCODE_AZTEC, DATA_MODE, -1, "\\\\^11", "", 0, 15, "(102) 30 31 31 30 31 31 31 30 31 31 30 30 31 31 31 31 30 31 31 30 31 31 30 30 31 31 31 31", 0, "Note double-backslash caret passed thru as backslash caret but does not error in non-EXTRA_ESCAPE_MODE, treated literally" }, /* 83*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 17, "\\xE2\\x82\\xAC", "", 0, 12, "F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E", 0, "Zint manual 4.10 Ex1" },
/* 84*/ { BARCODE_AZTEC, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\\\^11", "", 0, 15, "(102) 31 31 30 30 31 31 30 31 31 31 30 30 31 31 30 30 31 31 30 31 30 30 31 30 30 30 30 30", 0, "Treated as backslash caret 1 (FNC1)" }, /* 84*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 17, "\\u20AC", "", 0, 12, "F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E", 1, "" },
/* 85*/ { BARCODE_AZTEC, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\\\^A1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 717: Unrecognized extra escape \"\\^A\"", 0, "" }, /* 85*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 17, "\\U0020AC", "", 0, 12, "F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E", 1, "" },
/* 86*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\^11", "", ZINT_ERROR_INVALID_DATA, 0, "Error 798: Escape '\\^' only valid in Extra Escape mode", 0, "" }, /* 86*/ { BARCODE_DATAMATRIX, DATA_MODE, 17, "\\xA4", "", 0, 12, "F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E", 1, "" },
/* 87*/ { BARCODE_DATAMATRIX, GS1_MODE, -1, "\\^11", "", ZINT_ERROR_INVALID_DATA, 0, "Error 798: Escape '\\^' only valid in Extra Escape mode", 0, "" }, /* 87*/ { BARCODE_DATAMATRIX, DATA_MODE, 28, "\\xB1\\x60", "", 0, 12, "F1 1D EB 32 61 D9 1C 0C C2 46 C3 B2", 0, "Zint manual 4.10 Ex2" },
/* 88*/ { BARCODE_DATAMATRIX, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\^11", "", 0, 10, "E8 32 81 98 94 7B 7F 6D", 0, "" }, /* 88*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 28, "\\u5E38", "", 0, 12, "F1 1D EB 32 61 D9 1C 0C C2 46 C3 B2", 1, "" },
/* 89*/ { BARCODE_DATAMATRIX, UNICODE_MODE | EXTRA_ESCAPE_MODE, -1, "\\^A1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 717: Unrecognized extra escape \"\\^A\"", 0, "" }, /* 89*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 28, "\\U005E38", "", 0, 12, "F1 1D EB 32 61 D9 1C 0C C2 46 C3 B2", 1, "" },
/* 90*/ { BARCODE_DATAMATRIX, GS1_MODE | EXTRA_ESCAPE_MODE, -1, "\\^11", "", ZINT_ERROR_INVALID_DATA, 0, "Error 213: Extra escape '\\^' not valid for this symbology and/or input mode", 0, "Not allowed of DATAMATRIX in GS1_MODE" }, /* 90*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\u007F", "", 0, 10, "80 81 46 73 64 88 6A 84", 0, "" },
/* 91*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\\\^11", "", 0, 10, "5D 5F 8D 5C FB D1 69 3F", 0, "Note double-backslash caret passed thru as backslash caret but does not error in non-EXTRA_ESCAPE_MODE, treated literally" }, /* 91*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\U00007F", "", 0, 10, "80 81 46 73 64 88 6A 84", 0, "" },
/* 92*/ { BARCODE_DATAMATRIX, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\\\^11", "", 0, 10, "E8 32 81 98 94 7B 7F 6D", 0, "Treated as backslash caret 1 (FNC1)" }, /* 92*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" },
/* 93*/ { BARCODE_DATAMATRIX, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\\\^B2", "", ZINT_ERROR_INVALID_DATA, 0, "Error 717: Unrecognized extra escape \"\\^B\"", 0, "Passed thru as backslash caret B" }, /* 93*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\UF", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" },
/* 94*/ { BARCODE_DATAMATRIX, UNICODE_MODE | EXTRA_ESCAPE_MODE, 18, "A\\^1B", "", 0, 12, "42 E8 F1 13 43 F5 A4 26 80 68 7A AD", 0, "" }, /* 94*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U0F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" },
/* 95*/ { BARCODE_DATAMATRIX, UNICODE_MODE | EXTRA_ESCAPE_MODE, 20, "A\\^1B", "", ZINT_ERROR_INVALID_OPTION, 0, "Error 716: Extra Escape mode requires ASCII-compatible ECI", 0, "" }, /* 95*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\UFG", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" },
/* 96*/ { BARCODE_DATAMATRIX, UNICODE_MODE | EXTRA_ESCAPE_MODE, 20, "\\^1ーコ\\^1ード\\^1東京\\^1都", "", ZINT_ERROR_INVALID_OPTION, 0, "Error 716: Extra Escape mode requires ASCII-compatible ECI", 0, "" }, /* 96*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U00F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" },
/* 97*/ { BARCODE_DATAMATRIX, UNICODE_MODE | EXTRA_ESCAPE_MODE, 25, "A\\^1B", "", ZINT_ERROR_INVALID_OPTION, 0, "Error 716: Extra Escape mode requires ASCII-compatible ECI", 0, "" }, /* 97*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U00FG", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" },
/* 98*/ { BARCODE_DATAMATRIX, UNICODE_MODE | EXTRA_ESCAPE_MODE, 33, "A\\^1B", "", ZINT_ERROR_INVALID_OPTION, 0, "Error 716: Extra Escape mode requires ASCII-compatible ECI", 0, "" }, /* 98*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\Ufffe", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "Reversed BOM" },
/* 99*/ { BARCODE_DATAMATRIX, UNICODE_MODE | EXTRA_ESCAPE_MODE, 170, "A\\^1B", "", ZINT_ERROR_INVALID_DATA, 0, "Error 244: Invalid character in input for ECI '170'", 0, "" }, /* 99*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\Ud800", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "Surrogate" },
/*100*/ { BARCODE_DATAMATRIX, UNICODE_MODE | EXTRA_ESCAPE_MODE, 899, "A\\^1B", "", ZINT_ERROR_INVALID_OPTION, 0, "Error 716: Extra Escape mode requires ASCII-compatible ECI", 0, "" }, /*100*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\Udfff", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "Surrogate" },
/*101*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\w", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\w' in input", 0, "" }, /*101*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U000F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" },
/*102*/ { BARCODE_CODE128, DATA_MODE, -1, "\\^A1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 798: Escape '\\^' only valid in Extra Escape mode", 0, "" }, /*102*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U0000F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" },
/*103*/ { BARCODE_CODE128, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\^A1", "", 0, 46, "(4) 103 17 17 106", 0, "" }, /*103*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U110000", "", ZINT_ERROR_INVALID_DATA, 0, "Error 216: Value of escape sequence '\\U110000' in input out of range", 0, "" },
/*104*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, "\\^", "", 0, 57, "(5) 104 60 62 82 106", 0, "Partial special escape '\\^' at end allowed" }, /*104*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 25, "\\U10FFFF", "", 0, 14, "F1 1A E7 57 C7 81 F7 AC 09 06 28 51 F3 00 E1 8C 2A 1C", 0, "" },
/*105*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, "\\^D1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 348: Unrecognized extra escape \"\\^D\"", 0, "" }, /*105*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 26, "\\U10FFFF", "", 0, 14, "F1 1B E7 57 E0 11 D7 6C 4F 45 E2 B3 FF F1 72 AB 54 9F", 0, "" },
/*106*/ { BARCODE_CODE128, DATA_MODE, -1, "\\\\^A1", "", 0, 79, "(7) 104 60 62 33 17 43 106", 0, "Treated as literal backslash caret A" }, /*106*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 32, "\\U10FFFF", "", 0, 14, "F1 21 EB 64 33 EB 1B 36 1D F7 B1 6D 8C A6 34 64 19 3A", 0, "" },
/*107*/ { BARCODE_CODE128, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\\\^A1", "", 0, 46, "(4) 103 17 17 106", 0, "Treated as backslash caret A (manual Code Set A)" }, /*107*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 33, "\\U10FFFF", "", 0, 14, "F1 22 E7 57 EB 5D 17 8C C1 B0 B6 B2 53 78 E4 7D 61 CB", 0, "" },
/*108*/ { BARCODE_CODE128, DATA_MODE, -1, "\\c", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\c' in input", 0, "" }, /*108*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 34, "\\U10FFFF", "", 0, 14, "F1 23 01 11 EB 80 EB 80 90 33 51 1B FA AE 78 F7 05 44", 0, "" },
/*109*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 35, "\\U10FFFF", "", 0, 14, "F1 24 EB 80 EB 80 11 01 17 BA C6 05 9F 4C EA E5 18 31", 0, "" },
/*110*/ { BARCODE_GS1_128_CC, GS1_MODE, -1, "[20]10", "[10]A", 0, 99, "(7) 105 102 20 10 100 59 106", 0, "" },
/*111*/ { BARCODE_GS1_128_CC, GS1_MODE, -1, "[2\\x30]1\\d048", "[\\x310]\\x41", 0, 99, "(7) 105 102 20 10 100 59 106", 1, "" },
/*112*/ { BARCODE_AZTEC, DATA_MODE, -1, "\\^11", "", ZINT_ERROR_INVALID_DATA, 0, "Error 798: Escape '\\^' only valid in Extra Escape mode", 0, "" },
/*113*/ { BARCODE_AZTEC, GS1_MODE, -1, "\\^11", "", ZINT_ERROR_INVALID_DATA, 0, "Error 798: Escape '\\^' only valid in Extra Escape mode", 0, "" },
/*114*/ { BARCODE_AZTEC, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\^11", "", 0, 15, "(102) 31 31 30 30 31 31 30 31 31 31 30 30 31 31 30 30 31 31 30 31 30 30 31 30 30 30 30 30", 0, "" },
/*115*/ { BARCODE_AZTEC, DATA_MODE, -1, "\\\\^11", "", 0, 15, "(102) 30 31 31 30 31 31 31 30 31 31 30 30 31 31 31 31 30 31 31 30 31 31 30 30 31 31 31 31", 0, "Note double-backslash caret passed thru as backslash caret but does not error in non-EXTRA_ESCAPE_MODE, treated literally" },
/*116*/ { BARCODE_AZTEC, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\\\^11", "", 0, 15, "(102) 31 31 30 30 31 31 30 31 31 31 30 30 31 31 30 30 31 31 30 31 30 30 31 30 30 30 30 30", 0, "Treated as backslash caret 1 (FNC1)" },
/*117*/ { BARCODE_AZTEC, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\\\^A1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 717: Unrecognized extra escape \"\\^A\"", 0, "" },
/*118*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\^11", "", ZINT_ERROR_INVALID_DATA, 0, "Error 798: Escape '\\^' only valid in Extra Escape mode", 0, "" },
/*119*/ { BARCODE_DATAMATRIX, GS1_MODE, -1, "\\^11", "", ZINT_ERROR_INVALID_DATA, 0, "Error 798: Escape '\\^' only valid in Extra Escape mode", 0, "" },
/*120*/ { BARCODE_DATAMATRIX, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\^11", "", 0, 10, "E8 32 81 98 94 7B 7F 6D", 0, "" },
/*121*/ { BARCODE_DATAMATRIX, UNICODE_MODE | EXTRA_ESCAPE_MODE, -1, "\\^A1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 717: Unrecognized extra escape \"\\^A\"", 0, "" },
/*122*/ { BARCODE_DATAMATRIX, GS1_MODE | EXTRA_ESCAPE_MODE, -1, "\\^11", "", ZINT_ERROR_INVALID_DATA, 0, "Error 213: Extra escape '\\^' not valid for this symbology and/or input mode", 0, "Not allowed of DATAMATRIX in GS1_MODE" },
/*123*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\\\^11", "", 0, 10, "5D 5F 8D 5C FB D1 69 3F", 0, "Note double-backslash caret passed thru as backslash caret but does not error in non-EXTRA_ESCAPE_MODE, treated literally" },
/*124*/ { BARCODE_DATAMATRIX, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\\\^11", "", 0, 10, "E8 32 81 98 94 7B 7F 6D", 0, "Treated as backslash caret 1 (FNC1)" },
/*125*/ { BARCODE_DATAMATRIX, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\\\^B2", "", ZINT_ERROR_INVALID_DATA, 0, "Error 717: Unrecognized extra escape \"\\^B\"", 0, "Passed thru as backslash caret B" },
/*126*/ { BARCODE_DATAMATRIX, UNICODE_MODE | EXTRA_ESCAPE_MODE, 18, "A\\^1B", "", 0, 12, "42 E8 F1 13 43 F5 A4 26 80 68 7A AD", 0, "" },
/*127*/ { BARCODE_DATAMATRIX, UNICODE_MODE | EXTRA_ESCAPE_MODE, 20, "A\\^1B", "", ZINT_ERROR_INVALID_OPTION, 0, "Error 716: Extra Escape mode requires ASCII-compatible ECI", 0, "" },
/*128*/ { BARCODE_DATAMATRIX, UNICODE_MODE | EXTRA_ESCAPE_MODE, 20, "\\^1ーコ\\^1ード\\^1東京\\^1都", "", ZINT_ERROR_INVALID_OPTION, 0, "Error 716: Extra Escape mode requires ASCII-compatible ECI", 0, "" },
/*129*/ { BARCODE_DATAMATRIX, UNICODE_MODE | EXTRA_ESCAPE_MODE, 25, "A\\^1B", "", ZINT_ERROR_INVALID_OPTION, 0, "Error 716: Extra Escape mode requires ASCII-compatible ECI", 0, "" },
/*130*/ { BARCODE_DATAMATRIX, UNICODE_MODE | EXTRA_ESCAPE_MODE, 33, "A\\^1B", "", ZINT_ERROR_INVALID_OPTION, 0, "Error 716: Extra Escape mode requires ASCII-compatible ECI", 0, "" },
/*131*/ { BARCODE_DATAMATRIX, UNICODE_MODE | EXTRA_ESCAPE_MODE, 170, "A\\^1B", "", ZINT_ERROR_INVALID_DATA, 0, "Error 244: Invalid character in input for ECI '170'", 0, "" },
/*132*/ { BARCODE_DATAMATRIX, UNICODE_MODE | EXTRA_ESCAPE_MODE, 899, "A\\^1B", "", ZINT_ERROR_INVALID_OPTION, 0, "Error 716: Extra Escape mode requires ASCII-compatible ECI", 0, "" },
/*133*/ { BARCODE_CODE128, DATA_MODE, -1, "\\^A1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 798: Escape '\\^' only valid in Extra Escape mode", 0, "" },
/*134*/ { BARCODE_CODE128, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\^A1", "", 0, 46, "(4) 103 17 17 106", 0, "" },
/*135*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, "\\^", "", 0, 57, "(5) 104 60 62 82 106", 0, "Partial special escape '\\^' at end allowed" },
/*136*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, "\\^D1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 348: Unrecognized extra escape \"\\^D\"", 0, "" },
/*137*/ { BARCODE_CODE128, DATA_MODE, -1, "\\\\^A1", "", 0, 79, "(7) 104 60 62 33 17 43 106", 0, "Treated as literal backslash caret A" },
/*138*/ { BARCODE_CODE128, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\\\^A1", "", 0, 46, "(4) 103 17 17 106", 0, "Treated as backslash caret A (manual Code Set A)" },
/*139*/ { BARCODE_CODE128, DATA_MODE, -1, "\\c", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\c' in input", 0, "" },
}; };
const int data_size = ARRAY_SIZE(data); const int data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
@@ -827,7 +858,7 @@ static void test_escape_char_process(const testCtx *const p_ctx) {
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, -1 /*output_options*/, -1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, -1 /*output_options*/,
text, -1, debug); text, -1, debug);
ret = ZBarcode_Encode(symbol, TCU(text), length); ret = ZBarcode_Encode(symbol, ZCUCP(text), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n",
i, ret, data[i].ret, symbol->errtxt); i, ret, data[i].ret, symbol->errtxt);
@@ -911,7 +942,7 @@ static void test_escape_char_process_test(const testCtx *const p_ctx) {
}; };
static const struct item data[] = { static const struct item data[] = {
/* 0*/ { 0, 0, "BLANK", 0, "BLANK", 5 }, /* 0*/ { 0, 0, "BLANK", 0, "BLANK", 5 },
/* 1*/ { 0, 0, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\\\o201\\d255", 0, "\000\004\a\b\t\n\v\f\r\033\035\036\201\\\201\377", 16 }, /* 1*/ { 0, 0, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\L\\e\\F\\G\\R\\N\\x81\\\\\\o201\\d255", 0, "\000\004\a\b\t\n\v\f\r\020\033\034\035\036\037\201\\\201\377", 19 },
/* 2*/ { 0, 0, "\\U010283", 0, "\360\220\212\203", 4 }, /* 2*/ { 0, 0, "\\U010283", 0, "\360\220\212\203", 4 },
/* 3*/ { 0, 0, "\\u007F\\u0080\\u011E\\u13C9\\U010283", 0, "\177\302\200\304\236\341\217\211\360\220\212\203", 12 }, /* 3*/ { 0, 0, "\\u007F\\u0080\\u011E\\u13C9\\U010283", 0, "\177\302\200\304\236\341\217\211\360\220\212\203", 12 },
/* 4*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, "\\^A\\^^\\^B", 0, "\\^A\\^^\\^B", 9 }, /* 4*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, "\\^A\\^^\\^B", 0, "\\^A\\^^\\^B", 9 },
@@ -1249,7 +1280,7 @@ static void test_cap_stackable(const testCtx *const p_ctx) {
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, -1 /*output_options*/, -1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, -1 /*output_options*/,
text, -1, debug); text, -1, debug);
ret = ZBarcode_Encode(symbol, TCU(text), length); ret = ZBarcode_Encode(symbol, ZCUCP(text), length);
assert_zero(ret, "i:%d ZBarcode_Encode prestacked ret %d != 0 %s\n", i, ret, symbol->errtxt); assert_zero(ret, "i:%d ZBarcode_Encode prestacked ret %d != 0 %s\n", i, ret, symbol->errtxt);
prestacked_rows = symbol->rows; prestacked_rows = symbol->rows;
@@ -1259,7 +1290,7 @@ static void test_cap_stackable(const testCtx *const p_ctx) {
symbol->option_1 = -1; symbol->option_1 = -1;
symbol->option_2 = symbol->option_3 = 0; symbol->option_2 = symbol->option_3 = 0;
ret = ZBarcode_Encode(symbol, TCU(text), length); ret = ZBarcode_Encode(symbol, ZCUCP(text), length);
assert_zero(ret, "i:%d ZBarcode_Encode stacked ret %d != 0 %s\n", i, ret, symbol->errtxt); assert_zero(ret, "i:%d ZBarcode_Encode stacked ret %d != 0 %s\n", i, ret, symbol->errtxt);
stacked_rows = symbol->rows; stacked_rows = symbol->rows;
@@ -1328,14 +1359,14 @@ static void test_bindable(const testCtx *const p_ctx) {
text, -1, debug); text, -1, debug);
if (stackable) { if (stackable) {
ret = ZBarcode_Encode(symbol, TCU(text), length); ret = ZBarcode_Encode(symbol, ZCUCP(text), length);
assert_zero(ret, "i:%d ZBarcode_Encode prebind ret %d != 0 %s\n", i, ret, symbol->errtxt); assert_zero(ret, "i:%d ZBarcode_Encode prebind ret %d != 0 %s\n", i, ret, symbol->errtxt);
symbol->option_1 = -1; symbol->option_1 = -1;
symbol->option_2 = 0; symbol->option_2 = 0;
symbol->option_3 = option_3; symbol->option_3 = option_3;
} }
ret = ZBarcode_Encode_and_Print(symbol, TCU(text), length, 0 /*rotate*/); ret = ZBarcode_Encode_and_Print(symbol, ZCUCP(text), length, 0 /*rotate*/);
assert_zero(ret, "i:%d ZBarcode_Encode_and_Print prebind ret %d != 0 %s\n", i, ret, symbol->errtxt); assert_zero(ret, "i:%d ZBarcode_Encode_and_Print prebind ret %d != 0 %s\n", i, ret, symbol->errtxt);
assert_nonzero(symbol->memfile_size, "i:%d prebind memfile_size zero\n", i); assert_nonzero(symbol->memfile_size, "i:%d prebind memfile_size zero\n", i);
@@ -1361,14 +1392,14 @@ static void test_bindable(const testCtx *const p_ctx) {
text, -1, debug); text, -1, debug);
if (stackable) { if (stackable) {
ret = ZBarcode_Encode(symbol, TCU(text), length); ret = ZBarcode_Encode(symbol, ZCUCP(text), length);
assert_zero(ret, "i:%d ZBarcode_Encode bind ret %d != 0 %s\n", i, ret, symbol->errtxt); assert_zero(ret, "i:%d ZBarcode_Encode bind ret %d != 0 %s\n", i, ret, symbol->errtxt);
symbol->option_1 = -1; symbol->option_1 = -1;
symbol->option_2 = 0; symbol->option_2 = 0;
symbol->option_3 = option_3; symbol->option_3 = option_3;
} }
ret = ZBarcode_Encode_and_Print(symbol, TCU(text), length, 0 /*rotate*/); ret = ZBarcode_Encode_and_Print(symbol, ZCUCP(text), length, 0 /*rotate*/);
assert_zero(ret, "i:%d ZBarcode_Encode_and_Print bind ret %d != 0 %s\n", i, ret, symbol->errtxt); assert_zero(ret, "i:%d ZBarcode_Encode_and_Print bind ret %d != 0 %s\n", i, ret, symbol->errtxt);
assert_nonzero(symbol->memfile_size, "i:%d bind memfile_size zero\n", i); assert_nonzero(symbol->memfile_size, "i:%d bind memfile_size zero\n", i);
@@ -1645,7 +1676,7 @@ static void test_encode_print_outfile_directory(const testCtx *const p_ctx) {
assert_zero(ret, "testUtilMkDir(%s) %d != 0 (%d: %s)\n", dirname, ret, errno, strerror(errno)); assert_zero(ret, "testUtilMkDir(%s) %d != 0 (%d: %s)\n", dirname, ret, errno, strerror(errno));
strcpy(symbol->outfile, dirname); strcpy(symbol->outfile, dirname);
ret = ZBarcode_Encode_and_Print(symbol, TCU("1"), 0, 0); ret = ZBarcode_Encode_and_Print(symbol, ZCUCP("1"), 0, 0);
assert_equal(ret, ZINT_ERROR_FILE_ACCESS, "ret %d != ZINT_ERROR_FILE_ACCESS (%s)\n", ret, symbol->errtxt); assert_equal(ret, ZINT_ERROR_FILE_ACCESS, "ret %d != ZINT_ERROR_FILE_ACCESS (%s)\n", ret, symbol->errtxt);
assert_zero(strncmp(symbol->errtxt, expected, sizeof(expected) - 1), "strncmp(%s, %s) != 0\n", assert_zero(strncmp(symbol->errtxt, expected, sizeof(expected) - 1), "strncmp(%s, %s) != 0\n",
symbol->errtxt, expected); symbol->errtxt, expected);
@@ -1665,9 +1696,9 @@ static void test_bad_args(const testCtx *const p_ctx) {
const char *data = "1"; const char *data = "1";
const char *filename = "1.png"; const char *filename = "1.png";
const char *empty = ""; const char *empty = "";
struct zint_seg seg = { TU("1"), -1, 4 }; struct zint_seg seg = { ZUCP("1"), -1, 4 };
struct zint_seg seg_empty = { TU(""), -1, 4 }; struct zint_seg seg_empty = { ZUCP(""), -1, 4 };
struct zint_seg seg_too_long = { TU("1"), ZINT_MAX_DATA_LEN + 1, 4 }; struct zint_seg seg_too_long = { ZUCP("1"), ZINT_MAX_DATA_LEN + 1, 4 };
const char *expected[] = { const char *expected[] = {
"Error 772: Input segment 0 source NULL", "Error 772: Input segment 0 source NULL",
"Error 200: Input segments NULL", "Error 200: Input segments NULL",
@@ -1701,7 +1732,7 @@ static void test_bad_args(const testCtx *const p_ctx) {
assert_zero(uret, "ZBarcode_Cap(17, ~0) uret 0x%X != 0\n", uret); assert_zero(uret, "ZBarcode_Cap(17, ~0) uret 0x%X != 0\n", uret);
/* NULL symbol */ /* NULL symbol */
assert_equal(ZBarcode_Encode(NULL, TCU(data), 1), ZINT_ERROR_INVALID_DATA, assert_equal(ZBarcode_Encode(NULL, ZCUCP(data), 1), ZINT_ERROR_INVALID_DATA,
"ZBarcode_Encode(NULL, data, 1) != ZINT_ERROR_INVALID_DATA\n"); "ZBarcode_Encode(NULL, data, 1) != ZINT_ERROR_INVALID_DATA\n");
assert_equal(ZBarcode_Encode_Segs(NULL, &seg, 1), ZINT_ERROR_INVALID_DATA, assert_equal(ZBarcode_Encode_Segs(NULL, &seg, 1), ZINT_ERROR_INVALID_DATA,
"ZBarcode_Encode_Segs(NULL, &seg, 1) != ZINT_ERROR_INVALID_DATA\n"); "ZBarcode_Encode_Segs(NULL, &seg, 1) != ZINT_ERROR_INVALID_DATA\n");
@@ -1711,15 +1742,15 @@ static void test_bad_args(const testCtx *const p_ctx) {
"ZBarcode_Buffer(NULL, 0) != ZINT_ERROR_INVALID_DATA\n"); "ZBarcode_Buffer(NULL, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_equal(ZBarcode_Buffer_Vector(NULL, 0), ZINT_ERROR_INVALID_DATA, assert_equal(ZBarcode_Buffer_Vector(NULL, 0), ZINT_ERROR_INVALID_DATA,
"ZBarcode_Buffer_Vector(NULL, 0) != ZINT_ERROR_INVALID_DATA\n"); "ZBarcode_Buffer_Vector(NULL, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_equal(ZBarcode_Encode_and_Print(NULL, TCU(data), 1, 0), ZINT_ERROR_INVALID_DATA, assert_equal(ZBarcode_Encode_and_Print(NULL, ZCUCP(data), 1, 0), ZINT_ERROR_INVALID_DATA,
"ZBarcode_Encode_and_Print(NULL, data, 1, 0) != ZINT_ERROR_INVALID_DATA\n"); "ZBarcode_Encode_and_Print(NULL, data, 1, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_equal(ZBarcode_Encode_Segs_and_Print(NULL, &seg, 1, 0), ZINT_ERROR_INVALID_DATA, assert_equal(ZBarcode_Encode_Segs_and_Print(NULL, &seg, 1, 0), ZINT_ERROR_INVALID_DATA,
"ZBarcode_Encode_Seg_and_Print(NULL, &seg, 1, 0) != ZINT_ERROR_INVALID_DATA\n"); "ZBarcode_Encode_Seg_and_Print(NULL, &seg, 1, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_equal(ZBarcode_Encode_and_Buffer(NULL, TCU(data), 1, 0), ZINT_ERROR_INVALID_DATA, assert_equal(ZBarcode_Encode_and_Buffer(NULL, ZCUCP(data), 1, 0), ZINT_ERROR_INVALID_DATA,
"ZBarcode_Encode_and_Buffer(NULL, data, 1, 0) != ZINT_ERROR_INVALID_DATA\n"); "ZBarcode_Encode_and_Buffer(NULL, data, 1, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_equal(ZBarcode_Encode_Segs_and_Buffer(NULL, &seg, 1, 0), ZINT_ERROR_INVALID_DATA, assert_equal(ZBarcode_Encode_Segs_and_Buffer(NULL, &seg, 1, 0), ZINT_ERROR_INVALID_DATA,
"ZBarcode_Encode_Segs_and_Buffer(NULL, &seg, 1, 0) != ZINT_ERROR_INVALID_DATA\n"); "ZBarcode_Encode_Segs_and_Buffer(NULL, &seg, 1, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_equal(ZBarcode_Encode_and_Buffer_Vector(NULL, TCU(data), 1, 0), ZINT_ERROR_INVALID_DATA, assert_equal(ZBarcode_Encode_and_Buffer_Vector(NULL, ZCUCP(data), 1, 0), ZINT_ERROR_INVALID_DATA,
"ZBarcode_Encode_and_Buffer_Vector(NULL, data, 1, 0) != ZINT_ERROR_INVALID_DATA\n"); "ZBarcode_Encode_and_Buffer_Vector(NULL, data, 1, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_equal(ZBarcode_Encode_Segs_and_Buffer_Vector(NULL, &seg, 1, 0), ZINT_ERROR_INVALID_DATA, assert_equal(ZBarcode_Encode_Segs_and_Buffer_Vector(NULL, &seg, 1, 0), ZINT_ERROR_INVALID_DATA,
"ZBarcode_Encode_Segs_and_Buffer_Vector(NULL, &seg, 1, 0) != ZINT_ERROR_INVALID_DATA\n"); "ZBarcode_Encode_Segs_and_Buffer_Vector(NULL, &seg, 1, 0) != ZINT_ERROR_INVALID_DATA\n");
@@ -1797,26 +1828,26 @@ static void test_bad_args(const testCtx *const p_ctx) {
/* Empty data/segs/filename */ /* Empty data/segs/filename */
symbol->errtxt[0] = '\0'; symbol->errtxt[0] = '\0';
assert_equal(ZBarcode_Encode(symbol, TCU(empty), 0), ZINT_ERROR_INVALID_DATA, assert_equal(ZBarcode_Encode(symbol, ZCUCP(empty), 0), ZINT_ERROR_INVALID_DATA,
"ZBarcode_Encode(symbol, empty, 0) != ZINT_ERROR_INVALID_DATA\n"); "ZBarcode_Encode(symbol, empty, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_zero(strcmp(expected[3], symbol->errtxt), assert_zero(strcmp(expected[3], symbol->errtxt),
"ZBarcode_Encode(symbol, TCU(empty), 0) strcmp(%s, %s) != 0\n", expected[3], symbol->errtxt); "ZBarcode_Encode(symbol, ZCUCP(empty), 0) strcmp(%s, %s) != 0\n", expected[3], symbol->errtxt);
symbol->errtxt[0] = '\0'; symbol->errtxt[0] = '\0';
assert_equal(ZBarcode_Encode_Segs(symbol, &seg_empty, 1), ZINT_ERROR_INVALID_DATA, assert_equal(ZBarcode_Encode_Segs(symbol, &seg_empty, 1), ZINT_ERROR_INVALID_DATA,
"ZBarcode_Encode_Segs(symbol, &seg_empty, 1) != ZINT_ERROR_INVALID_DATA\n"); "ZBarcode_Encode_Segs(symbol, &seg_empty, 1) != ZINT_ERROR_INVALID_DATA\n");
assert_zero(strcmp(expected[3], symbol->errtxt), assert_zero(strcmp(expected[3], symbol->errtxt),
"ZBarcode_Encode_Segs(symbol, &seg_empty, 1) strcmp(%s, %s) != 0\n", expected[3], symbol->errtxt); "ZBarcode_Encode_Segs(symbol, &seg_empty, 1) strcmp(%s, %s) != 0\n", expected[3], symbol->errtxt);
symbol->errtxt[0] = '\0'; symbol->errtxt[0] = '\0';
assert_equal(ZBarcode_Encode_and_Print(symbol, TCU(empty), 0, 0), ZINT_ERROR_INVALID_DATA, assert_equal(ZBarcode_Encode_and_Print(symbol, ZCUCP(empty), 0, 0), ZINT_ERROR_INVALID_DATA,
"ZBarcode_Encode_and_Print(symbol, empty, 0, 0) != ZINT_ERROR_INVALID_DATA\n"); "ZBarcode_Encode_and_Print(symbol, empty, 0, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_zero(strcmp(expected[3], symbol->errtxt), assert_zero(strcmp(expected[3], symbol->errtxt),
"ZBarcode_Encode_and_Print(symbol, TCU(empty), 0, 0) strcmp(%s, %s) != 0\n", "ZBarcode_Encode_and_Print(symbol, ZCUCP(empty), 0, 0) strcmp(%s, %s) != 0\n",
expected[3], symbol->errtxt); expected[3], symbol->errtxt);
symbol->errtxt[0] = '\0'; symbol->errtxt[0] = '\0';
assert_equal(ZBarcode_Encode_and_Buffer(symbol, TCU(empty), 0, 0), ZINT_ERROR_INVALID_DATA, assert_equal(ZBarcode_Encode_and_Buffer(symbol, ZCUCP(empty), 0, 0), ZINT_ERROR_INVALID_DATA,
"ZBarcode_Encode_and_Buffer(symbol, empty, 0, 0) != ZINT_ERROR_INVALID_DATA\n"); "ZBarcode_Encode_and_Buffer(symbol, empty, 0, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_zero(strcmp(expected[3], symbol->errtxt), assert_zero(strcmp(expected[3], symbol->errtxt),
"ZBarcode_Encode_and_Buffer(symbol, TCU(empty), 0, 0) strcmp(%s, %s) != 0\n", "ZBarcode_Encode_and_Buffer(symbol, ZCUCP(empty), 0, 0) strcmp(%s, %s) != 0\n",
expected[3], symbol->errtxt); expected[3], symbol->errtxt);
symbol->errtxt[0] = '\0'; symbol->errtxt[0] = '\0';
assert_equal(ZBarcode_Encode_Segs_and_Buffer(symbol, &seg_empty, 1, 0), ZINT_ERROR_INVALID_DATA, assert_equal(ZBarcode_Encode_Segs_and_Buffer(symbol, &seg_empty, 1, 0), ZINT_ERROR_INVALID_DATA,
@@ -1825,10 +1856,10 @@ static void test_bad_args(const testCtx *const p_ctx) {
"ZBarcode_Encode_Segs_and_Buffer(symbol, &seg_empty, 1, 0) strcmp(%s, %s) != 0\n", "ZBarcode_Encode_Segs_and_Buffer(symbol, &seg_empty, 1, 0) strcmp(%s, %s) != 0\n",
expected[3], symbol->errtxt); expected[3], symbol->errtxt);
symbol->errtxt[0] = '\0'; symbol->errtxt[0] = '\0';
assert_equal(ZBarcode_Encode_and_Buffer_Vector(symbol, TCU(empty), 0, 0), ZINT_ERROR_INVALID_DATA, assert_equal(ZBarcode_Encode_and_Buffer_Vector(symbol, ZCUCP(empty), 0, 0), ZINT_ERROR_INVALID_DATA,
"ZBarcode_Encode_and_Buffer_Vector(symbol, empty, 0, 0) != ZINT_ERROR_INVALID_DATA\n"); "ZBarcode_Encode_and_Buffer_Vector(symbol, empty, 0, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_zero(strcmp(expected[3], symbol->errtxt), assert_zero(strcmp(expected[3], symbol->errtxt),
"ZBarcode_Encode_and_Buffer_Vector(symbol, TCU(empty), 0, 0) strcmp(%s, %s) != 0\n", "ZBarcode_Encode_and_Buffer_Vector(symbol, ZCUCP(empty), 0, 0) strcmp(%s, %s) != 0\n",
expected[3], symbol->errtxt); expected[3], symbol->errtxt);
symbol->errtxt[0] = '\0'; symbol->errtxt[0] = '\0';
assert_equal(ZBarcode_Encode_Segs_and_Buffer_Vector(symbol, &seg_empty, 1, 0), ZINT_ERROR_INVALID_DATA, assert_equal(ZBarcode_Encode_Segs_and_Buffer_Vector(symbol, &seg_empty, 1, 0), ZINT_ERROR_INVALID_DATA,
@@ -1881,10 +1912,10 @@ static void test_bad_args(const testCtx *const p_ctx) {
/* Data/seg too big */ /* Data/seg too big */
symbol->errtxt[0] = '\0'; symbol->errtxt[0] = '\0';
assert_equal(ZBarcode_Encode(symbol, TCU(empty), ZINT_MAX_DATA_LEN + 1), ZINT_ERROR_TOO_LONG, assert_equal(ZBarcode_Encode(symbol, ZCUCP(empty), ZINT_MAX_DATA_LEN + 1), ZINT_ERROR_TOO_LONG,
"ZBarcode_Encode(symbol, empty, ZINT_MAX_DATA_LEN + 1) != ZINT_ERROR_TOO_LONG\n"); "ZBarcode_Encode(symbol, empty, ZINT_MAX_DATA_LEN + 1) != ZINT_ERROR_TOO_LONG\n");
assert_zero(strcmp(expected[7], symbol->errtxt), assert_zero(strcmp(expected[7], symbol->errtxt),
"ZBarcode_Encode(symbol, TCU(empty), ZINT_MAX_DATA_LEN + 1) strcmp(%s, %s) != 0\n", "ZBarcode_Encode(symbol, ZCUCP(empty), ZINT_MAX_DATA_LEN + 1) strcmp(%s, %s) != 0\n",
expected[7], symbol->errtxt); expected[7], symbol->errtxt);
symbol->errtxt[0] = '\0'; symbol->errtxt[0] = '\0';
assert_equal(ZBarcode_Encode_Segs(symbol, &seg_too_long, 1), ZINT_ERROR_TOO_LONG, assert_equal(ZBarcode_Encode_Segs(symbol, &seg_too_long, 1), ZINT_ERROR_TOO_LONG,
@@ -1913,10 +1944,10 @@ static void test_stacking(const testCtx *const p_ctx) {
assert_nonnull(symbol, "Symbol not created\n"); assert_nonnull(symbol, "Symbol not created\n");
for (i = 0; i < ARRAY_SIZE(symbol->row_height); i++) { for (i = 0; i < ARRAY_SIZE(symbol->row_height); i++) {
ret = ZBarcode_Encode(symbol, TCU(data), 0); ret = ZBarcode_Encode(symbol, ZCUCP(data), 0);
assert_zero(ret, "i:%d ZBarcode_Encode(%s) ret %d != 0 (%s)\n", i, data, ret, symbol->errtxt); assert_zero(ret, "i:%d ZBarcode_Encode(%s) ret %d != 0 (%s)\n", i, data, ret, symbol->errtxt);
} }
ret = ZBarcode_Encode(symbol, TCU(data), 0); ret = ZBarcode_Encode(symbol, ZCUCP(data), 0);
assert_equal(ret, ZINT_ERROR_TOO_LONG, "i:%d ZBarcode_Encode ret %d != ZINT_ERROR_TOO_LONG (%s)\n", assert_equal(ret, ZINT_ERROR_TOO_LONG, "i:%d ZBarcode_Encode ret %d != ZINT_ERROR_TOO_LONG (%s)\n",
i, ret, symbol->errtxt); i, ret, symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, expected_error), "i:%d strcmp(%s, %s) != 0\n", assert_zero(strcmp(symbol->errtxt, expected_error), "i:%d strcmp(%s, %s) != 0\n",
@@ -1924,11 +1955,11 @@ static void test_stacking(const testCtx *const p_ctx) {
ZBarcode_Clear(symbol); ZBarcode_Clear(symbol);
ret = ZBarcode_Encode(symbol, TCU(data), 0); ret = ZBarcode_Encode(symbol, ZCUCP(data), 0);
assert_zero(ret, "i:%d ZBarcode_Encode(%s) ret %d != 0 (%s)\n", i, data, ret, symbol->errtxt); assert_zero(ret, "i:%d ZBarcode_Encode(%s) ret %d != 0 (%s)\n", i, data, ret, symbol->errtxt);
symbol->output_options |= BARCODE_CONTENT_SEGS; symbol->output_options |= BARCODE_CONTENT_SEGS;
ret = ZBarcode_Encode(symbol, TCU(data), 0); ret = ZBarcode_Encode(symbol, ZCUCP(data), 0);
assert_equal(ret, ZINT_ERROR_INVALID_OPTION, "i:%d ZBarcode_Encode ret %d != ZINT_ERROR_INVALID_OPTION (%s)\n", assert_equal(ret, ZINT_ERROR_INVALID_OPTION, "i:%d ZBarcode_Encode ret %d != ZINT_ERROR_INVALID_OPTION (%s)\n",
i, ret, symbol->errtxt); i, ret, symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, expected_error_content), "i:%d strcmp(%s, %s) != 0\n", assert_zero(strcmp(symbol->errtxt, expected_error_content), "i:%d strcmp(%s, %s) != 0\n",
@@ -2254,7 +2285,7 @@ static void test_strip_bom(const testCtx *const p_ctx) {
strcpy(buf, data); strcpy(buf, data);
length = (int) strlen(buf); length = (int) strlen(buf);
zint_test_strip_bom(TU(buf), &length); zint_test_strip_bom(ZUCP(buf), &length);
assert_equal(length, 1, "length %d != 1\n", length); assert_equal(length, 1, "length %d != 1\n", length);
assert_zero(buf[1], "buf[1] %d != 0\n", buf[1]); assert_zero(buf[1], "buf[1] %d != 0\n", buf[1]);
@@ -2262,7 +2293,7 @@ static void test_strip_bom(const testCtx *const p_ctx) {
strcpy(buf, bom_only); strcpy(buf, bom_only);
length = (int) strlen(buf); length = (int) strlen(buf);
zint_test_strip_bom(TU(buf), &length); zint_test_strip_bom(ZUCP(buf), &length);
assert_equal(length, 3, "BOM only length %d != 3\n", length); assert_equal(length, 3, "BOM only length %d != 3\n", length);
ret = strcmp(buf, bom_only); ret = strcmp(buf, bom_only);
assert_zero(ret, "BOM only strcmp ret %d != 0\n", ret); assert_zero(ret, "BOM only strcmp ret %d != 0\n", ret);
@@ -2286,7 +2317,7 @@ static void test_zero_outfile(const testCtx *const p_ctx) {
assert_nonzero(symbol->outfile[0], "ZBarcode_Create() outfile zero\n"); assert_nonzero(symbol->outfile[0], "ZBarcode_Create() outfile zero\n");
symbol->outfile[0] = '\0'; symbol->outfile[0] = '\0';
ret = ZBarcode_Encode(symbol, TCU(data), 0); ret = ZBarcode_Encode(symbol, ZCUCP(data), 0);
assert_zero(ret, "ZBarcode_Encode(%s) ret %d != 0 (%s)\n", data, ret, symbol->errtxt); assert_zero(ret, "ZBarcode_Encode(%s) ret %d != 0 (%s)\n", data, ret, symbol->errtxt);
assert_zero(symbol->outfile[0], "ZBarcode_Encode() outfile non-zero\n"); assert_zero(symbol->outfile[0], "ZBarcode_Encode() outfile non-zero\n");
@@ -2327,7 +2358,7 @@ static void test_clear(const testCtx *const p_ctx) {
/* Raster */ /* Raster */
ret = ZBarcode_Encode(symbol, TCU(data), 0); ret = ZBarcode_Encode(symbol, ZCUCP(data), 0);
assert_zero(ret, "ZBarcode_Encode() ret %d != 0 (%s)\n", ret, symbol->errtxt); assert_zero(ret, "ZBarcode_Encode() ret %d != 0 (%s)\n", ret, symbol->errtxt);
assert_nonzero(symbol->rows, "ZBarcode_Encode() rows 0\n"); assert_nonzero(symbol->rows, "ZBarcode_Encode() rows 0\n");
@@ -2358,7 +2389,7 @@ static void test_clear(const testCtx *const p_ctx) {
/* Vector */ /* Vector */
ret = ZBarcode_Encode(symbol, TCU(data), 0); ret = ZBarcode_Encode(symbol, ZCUCP(data), 0);
assert_zero(ret, "ZBarcode_Encode() ret %d != 0 (%s)\n", ret, symbol->errtxt); assert_zero(ret, "ZBarcode_Encode() ret %d != 0 (%s)\n", ret, symbol->errtxt);
assert_nonzero(symbol->rows, "ZBarcode_Encode() rows 0\n"); assert_nonzero(symbol->rows, "ZBarcode_Encode() rows 0\n");
@@ -2444,7 +2475,7 @@ static void test_reset(const testCtx *const p_ctx) {
/* Raster */ /* Raster */
ret = ZBarcode_Encode(symbol, TCU(data), 0); ret = ZBarcode_Encode(symbol, ZCUCP(data), 0);
assert_zero(ret, "ZBarcode_Encode() ret %d != 0 (%s)\n", ret, symbol->errtxt); assert_zero(ret, "ZBarcode_Encode() ret %d != 0 (%s)\n", ret, symbol->errtxt);
assert_nonzero(symbol->rows, "ZBarcode_Encode() rows 0\n"); assert_nonzero(symbol->rows, "ZBarcode_Encode() rows 0\n");
@@ -2501,7 +2532,7 @@ static void test_reset(const testCtx *const p_ctx) {
set_symbol_fields(symbol); set_symbol_fields(symbol);
ret = ZBarcode_Encode(symbol, TCU(data), 0); ret = ZBarcode_Encode(symbol, ZCUCP(data), 0);
assert_zero(ret, "ZBarcode_Encode() ret %d != 0 (%s)\n", ret, symbol->errtxt); assert_zero(ret, "ZBarcode_Encode() ret %d != 0 (%s)\n", ret, symbol->errtxt);
assert_nonzero(symbol->rows, "ZBarcode_Encode() rows 0\n"); assert_nonzero(symbol->rows, "ZBarcode_Encode() rows 0\n");
@@ -2858,7 +2889,7 @@ static void test_utf8_to_eci(const testCtx *const p_ctx) {
length = data[i].length == -1 && data[i].data ? (int) strlen(data[i].data) : data[i].length; length = data[i].length == -1 && data[i].data ? (int) strlen(data[i].data) : data[i].length;
ret_dest = ZBarcode_Dest_Len_ECI(data[i].eci, TCU(data[i].data), length, &dest_length); ret_dest = ZBarcode_Dest_Len_ECI(data[i].eci, ZCUCP(data[i].data), length, &dest_length);
assert_equal(ret_dest, data[i].ret_dest, "i:%d ZBarcode_Dest_Len_ECI(%d, %s) ret_dest %d != %d\n", assert_equal(ret_dest, data[i].ret_dest, "i:%d ZBarcode_Dest_Len_ECI(%d, %s) ret_dest %d != %d\n",
i, data[i].eci, data[i].data, ret_dest, data[i].ret_dest); i, data[i].eci, data[i].data, ret_dest, data[i].ret_dest);
@@ -2868,7 +2899,7 @@ static void test_utf8_to_eci(const testCtx *const p_ctx) {
i, dest_length, data[i].expected_dest_length); i, dest_length, data[i].expected_dest_length);
expected_length = data[i].expected_length == -1 ? (int) strlen(data[i].expected) : data[i].expected_length; expected_length = data[i].expected_length == -1 ? (int) strlen(data[i].expected) : data[i].expected_length;
ret = ZBarcode_UTF8_To_ECI(data[i].eci, TCU(data[i].data), length, dest, &dest_length); ret = ZBarcode_UTF8_To_ECI(data[i].eci, ZCUCP(data[i].data), length, dest, &dest_length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_UTF8_To_ECI(%d, %s) ret %d != %d\n", assert_equal(ret, data[i].ret, "i:%d ZBarcode_UTF8_To_ECI(%d, %s) ret %d != %d\n",
i, data[i].eci, data[i].data, ret, data[i].ret); i, data[i].eci, data[i].data, ret, data[i].ret);
if (ret < ZINT_ERROR) { if (ret < ZINT_ERROR) {
@@ -2876,7 +2907,7 @@ static void test_utf8_to_eci(const testCtx *const p_ctx) {
"i:%d ZBarcode_UTF8_To_ECI dest_length %d != expected_length %d\n", "i:%d ZBarcode_UTF8_To_ECI dest_length %d != expected_length %d\n",
i, dest_length, expected_length); i, dest_length, expected_length);
#if 0 #if 0
printf("dest_length %d\n", dest_length); z_debug_print_escape(TCU(dest), dest_length, NULL); printf("dest_length %d\n", dest_length); z_debug_print_escape(ZCUCP(dest), dest_length, NULL);
printf("\n"); printf("\n");
#endif #endif
assert_zero(memcmp(dest, data[i].expected, expected_length), assert_zero(memcmp(dest, data[i].expected, expected_length),
@@ -3046,7 +3077,7 @@ static void test_content_segs(const testCtx *const p_ctx) {
expected = data[i].expected[0] ? data[i].expected : data[i].data; expected = data[i].expected[0] ? data[i].expected : data[i].data;
expected_length = (int) strlen(expected); expected_length = (int) strlen(expected);
ret = ZBarcode_Encode(symbol, TCU(text), length); ret = ZBarcode_Encode(symbol, ZCUCP(text), length);
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt); assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt);
assert_nonnull(symbol->content_segs, "i:%d content_segs NULL\n", i); assert_nonnull(symbol->content_segs, "i:%d content_segs NULL\n", i);
+6 -6
View File
@@ -2545,9 +2545,9 @@ static void test_height(const testCtx *const p_ctx) {
/*110*/ { BARCODE_DBAR_EXP, -1, 33, "[01]12345678901231", "", 0, 33, 1, 134, 268, 66, "", "" }, /*110*/ { BARCODE_DBAR_EXP, -1, 33, "[01]12345678901231", "", 0, 33, 1, 134, 268, 66, "", "" },
/*111*/ { BARCODE_DBAR_EXP, COMPLIANT_HEIGHT, 33, "[01]12345678901231", "", ZINT_WARN_NONCOMPLIANT, 33, 1, 134, 268, 66, "Warning 247: Height not compliant with standards (too small)", "" }, /*111*/ { BARCODE_DBAR_EXP, COMPLIANT_HEIGHT, 33, "[01]12345678901231", "", ZINT_WARN_NONCOMPLIANT, 33, 1, 134, 268, 66, "Warning 247: Height not compliant with standards (too small)", "" },
/*112*/ { BARCODE_DBAR_EXP, COMPLIANT_HEIGHT, 34, "[01]12345678901231", "", 0, 34, 1, 134, 268, 68, "", "" }, /*112*/ { BARCODE_DBAR_EXP, COMPLIANT_HEIGHT, 34, "[01]12345678901231", "", 0, 34, 1, 134, 268, 68, "", "" },
/*113*/ { BARCODE_TELEPEN, -1, 1, "1234567890", "", 0, 1, 1, 208, 416, 2, "", "" }, /*113*/ { BARCODE_TELEPEN, -1, 8.9, "1234567890", "", 0, 9, 1, 208, 416, 18, "", "" },
/*114*/ { BARCODE_TELEPEN, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 208, 416, 2, "", "No known min" }, /*114*/ { BARCODE_TELEPEN, COMPLIANT_HEIGHT, 8.9, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 9, 1, 208, 416, 18, "Warning 247: Height not compliant with standards (too small)", "" },
/*115*/ { BARCODE_TELEPEN, -1, 4, "1234567890", "", 0, 4, 1, 208, 416, 8, "", "" }, /*115*/ { BARCODE_TELEPEN, COMPLIANT_HEIGHT, 9, "1234567890", "", 0, 9, 1, 208, 416, 18, "", "" },
/*116*/ { BARCODE_UPCA, -1, 1, "12345678901", "", 0, 1, 1, 95, 226, 12, "", "" }, /*116*/ { BARCODE_UPCA, -1, 1, "12345678901", "", 0, 1, 1, 95, 226, 12, "", "" },
/*117*/ { BARCODE_UPCA, -1, 69, "12345678901", "", 0, 69, 1, 95, 226, 148, "", "" }, /*117*/ { BARCODE_UPCA, -1, 69, "12345678901", "", 0, 69, 1, 95, 226, 148, "", "" },
/*118*/ { BARCODE_UPCA, COMPLIANT_HEIGHT, 69, "12345678901", "", ZINT_WARN_NONCOMPLIANT, 69, 1, 95, 226, 148, "Warning 247: Height not compliant with standards (too small)", "" }, /*118*/ { BARCODE_UPCA, COMPLIANT_HEIGHT, 69, "12345678901", "", ZINT_WARN_NONCOMPLIANT, 69, 1, 95, 226, 148, "Warning 247: Height not compliant with standards (too small)", "" },
@@ -2764,9 +2764,9 @@ static void test_height(const testCtx *const p_ctx) {
/*329*/ { BARCODE_PLESSEY, -1, 1, "1234567890", "", 0, 1, 1, 227, 454, 2, "", "" }, /*329*/ { BARCODE_PLESSEY, -1, 1, "1234567890", "", 0, 1, 1, 227, 454, 2, "", "" },
/*330*/ { BARCODE_PLESSEY, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 227, 454, 2, "", "TODO: Find doc" }, /*330*/ { BARCODE_PLESSEY, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 227, 454, 2, "", "TODO: Find doc" },
/*331*/ { BARCODE_PLESSEY, -1, 4, "1234567890", "", 0, 4, 1, 227, 454, 8, "", "" }, /*331*/ { BARCODE_PLESSEY, -1, 4, "1234567890", "", 0, 4, 1, 227, 454, 8, "", "" },
/*332*/ { BARCODE_TELEPEN_NUM, -1, 1, "1234567890", "", 0, 1, 1, 128, 256, 2, "", "" }, /*332*/ { BARCODE_TELEPEN_NUM, -1, 6.6, "1234567890", "", 0, 6.5, 1, 128, 256, 13, "", "" },
/*333*/ { BARCODE_TELEPEN_NUM, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 128, 256, 2, "", "No known min" }, /*333*/ { BARCODE_TELEPEN_NUM, COMPLIANT_HEIGHT, 6.6, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 6.5, 1, 128, 256, 13, "Warning 247: Height not compliant with standards (too small)", "" },
/*334*/ { BARCODE_TELEPEN_NUM, -1, 4, "1234567890", "", 0, 4, 1, 128, 256, 8, "", "" }, /*334*/ { BARCODE_TELEPEN_NUM, COMPLIANT_HEIGHT, 6.7, "1234567890", "", 0, 6.5, 1, 128, 256, 13, "", "" },
/*335*/ { BARCODE_ITF14, -1, 1, "1234567890", "", 0, 1, 1, 135, 330, 22, "", "" }, /*335*/ { BARCODE_ITF14, -1, 1, "1234567890", "", 0, 1, 1, 135, 330, 22, "", "" },
/*336*/ { BARCODE_ITF14, -1, 5.7, "1234567890", "", 0, 5.5, 1, 135, 330, 31, "", "" }, /*336*/ { BARCODE_ITF14, -1, 5.7, "1234567890", "", 0, 5.5, 1, 135, 330, 31, "", "" },
/*337*/ { BARCODE_ITF14, COMPLIANT_HEIGHT, 5.7, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 5.5, 1, 135, 330, 31, "Warning 247: Height not compliant with standards (too small)", "" }, /*337*/ { BARCODE_ITF14, COMPLIANT_HEIGHT, 5.7, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 5.5, 1, 135, 330, 31, "Warning 247: Height not compliant with standards (too small)", "" },
+350 -130
View File
@@ -1,6 +1,6 @@
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2020-2025 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2020-2026 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions modification, are permitted provided that the following conditions
@@ -36,6 +36,7 @@ static void test_large(const testCtx *const p_ctx) {
struct item { struct item {
int symbology; int symbology;
int option_2;
const char *pattern; const char *pattern;
int length; int length;
int ret; int ret;
@@ -45,10 +46,40 @@ static void test_large(const testCtx *const p_ctx) {
}; };
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = { static const struct item data[] = {
/* 0*/ { BARCODE_TELEPEN, "\177", 69, 0, 1, 1152, "" }, /* 0*/ { BARCODE_TELEPEN, -1, "\177", 69, 0, 1, 1152, "" },
/* 1*/ { BARCODE_TELEPEN, "\177", 70, ZINT_ERROR_TOO_LONG, -1, -1, "Error 390: Input length 70 too long (maximum 69)" }, /* 1*/ { BARCODE_TELEPEN, -1, "\177", 70, ZINT_ERROR_TOO_LONG, -1, -1, "Error 390: Input length 70 too long, requires 70 symbol characters (maximum 69)" },
/* 2*/ { BARCODE_TELEPEN_NUM, "1", 136, 0, 1, 1136, "" }, /* 2*/ { BARCODE_TELEPEN, 1, "\177", 69, 0, 1, 1152, "" },
/* 3*/ { BARCODE_TELEPEN_NUM, "1", 137, ZINT_ERROR_TOO_LONG, -1, -1, "Error 392: Input length 137 too long (maximum 136)" }, /* 3*/ { BARCODE_TELEPEN, 1, "\177", 70, ZINT_ERROR_TOO_LONG, -1, -1, "Error 390: Input length 70 too long, requires 70 symbol characters (maximum 69)" },
/* 4*/ { BARCODE_TELEPEN, 1, "\177", 136, ZINT_ERROR_TOO_LONG, -1, -1, "Error 390: Input length 136 too long, requires 136 symbol characters (maximum 69)" },
/* 5*/ { BARCODE_TELEPEN, 1, "\177", 137, ZINT_ERROR_TOO_LONG, -1, -1, "Error 390: Input length 137 too long, requires 137 symbol characters (maximum 69)" },
/* 6*/ { BARCODE_TELEPEN, 1, "\177", 200, ZINT_ERROR_TOO_LONG, -1, -1, "Error 390: Input length 200 too long, requires 200 symbol characters (maximum 69)" },
/* 7*/ { BARCODE_TELEPEN, 1, "\177", 201, ZINT_ERROR_TOO_LONG, -1, -1, "Error 399: Input length 201 too long, requires too many symbol characters (maximum 69)" },
/* 8*/ { BARCODE_TELEPEN, -1, "\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\020", 69, 0, 1, 1152, "" },
/* 9*/ { BARCODE_TELEPEN, 1, "\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\020", 69, 0, 1, 1152, "" },
/* 10*/ { BARCODE_TELEPEN, 1, "\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\0201", 69, 0, 1, 1152, "" },
/* 11*/ { BARCODE_TELEPEN, 1, "\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\02012", 70, 0, 1, 1152, "" },
/* 12*/ { BARCODE_TELEPEN, 1, "\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\020123", 71, ZINT_ERROR_TOO_LONG, -1, -1, "Error 390: Input length 71 too long, requires 70 symbol characters (maximum 69)" },
/* 13*/ { BARCODE_TELEPEN, 1, "\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\0201234", 72, ZINT_ERROR_TOO_LONG, -1, -1, "Error 390: Input length 72 too long, requires 70 symbol characters (maximum 69)" },
/* 14*/ { BARCODE_TELEPEN, 1, "\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\0201234", 71, 0, 1, 1152, "" },
/* 15*/ { BARCODE_TELEPEN, 1, "\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\02012345", 72, ZINT_ERROR_TOO_LONG, -1, -1, "Error 390: Input length 72 too long, requires 70 symbol characters (maximum 69)" },
/* 16*/ { BARCODE_TELEPEN, 1, "\177\02012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234", 136, 0, 1, 1152, "" },
/* 17*/ { BARCODE_TELEPEN, 1, "\177\020123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345", 137, ZINT_ERROR_TOO_LONG, -1, -1, "Error 390: Input length 137 too long, requires 70 symbol characters (maximum 69)" },
/* 18*/ { BARCODE_TELEPEN, 1, "\177\177\020123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012", 135, 0, 1, 1152, "" },
/* 19*/ { BARCODE_TELEPEN, 1, "\177\177\0201234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123", 136, ZINT_ERROR_TOO_LONG, -1, -1, "Error 390: Input length 136 too long, requires 70 symbol characters (maximum 69)" },
/* 20*/ { BARCODE_TELEPEN_NUM, -1, "1", 138, 0, 1, 1152, "" },
/* 21*/ { BARCODE_TELEPEN_NUM, -1, "1", 139, ZINT_ERROR_TOO_LONG, -1, -1, "Error 392: Input length 139 too long, requires 70 symbol characters (maximum 69)" },
/* 22*/ { BARCODE_TELEPEN_NUM, 1, "1", 138, 0, 1, 1152, "" },
/* 23*/ { BARCODE_TELEPEN_NUM, 1, "1", 139, ZINT_ERROR_TOO_LONG, -1, -1, "Error 392: Input length 139 too long, requires 70 symbol characters (maximum 69)" },
/* 24*/ { BARCODE_TELEPEN_NUM, 1, "1", 200, ZINT_ERROR_TOO_LONG, -1, -1, "Error 392: Input length 200 too long, requires 100 symbol characters (maximum 69)" },
/* 25*/ { BARCODE_TELEPEN_NUM, 1, "1", 201, ZINT_ERROR_TOO_LONG, -1, -1, "Error 400: Input length 201 too long, requires too many symbol characters (maximum 69)" },
/* 26*/ { BARCODE_TELEPEN_NUM, -1, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456\020", 137, 0, 1, 1152, "" },
/* 27*/ { BARCODE_TELEPEN_NUM, -1, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567\020", 138, ZINT_ERROR_TOO_LONG, -1, -1, "Error 392: Input length 138 too long, requires 70 symbol characters (maximum 69)" },
/* 28*/ { BARCODE_TELEPEN_NUM, -1, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234\020\177", 136, 0, 1, 1152, "" },
/* 29*/ { BARCODE_TELEPEN_NUM, -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345\020\177", 137, ZINT_ERROR_TOO_LONG, -1, -1, "Error 392: Input length 137 too long, requires 70 symbol characters (maximum 69)" },
/* 30*/ { BARCODE_TELEPEN_NUM, -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012\020\177\177", 135, 0, 1, 1152, "" },
/* 31*/ { BARCODE_TELEPEN_NUM, -1, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123\020\177\177", 136, ZINT_ERROR_TOO_LONG, -1, -1, "Error 392: Input length 136 too long, requires 70 symbol characters (maximum 69)" },
/* 32*/ { BARCODE_TELEPEN_NUM, -1, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\020\177\177\177", 134, 0, 1, 1152, "" },
/* 33*/ { BARCODE_TELEPEN_NUM, -1, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901\020\177\177\177", 135, ZINT_ERROR_TOO_LONG, -1, -1, "Error 392: Input length 135 too long, requires 70 symbol characters (maximum 69)" },
}; };
const int data_size = ARRAY_SIZE(data); const int data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
@@ -56,6 +87,15 @@ static void test_large(const testCtx *const p_ctx) {
char data_buf[256]; char data_buf[256];
char escaped[8192];
char escaped2[8192];
char cmp_buf[8192];
char cmp_msg[1024];
char ret_buf[8192];
/* Only do zxing-cpp tests if asked, too slow otherwise */
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder();
testStartSymbol(p_ctx->func_name, &symbol); testStartSymbol(p_ctx->func_name, &symbol);
for (i = 0; i < data_size; i++) { for (i = 0; i < data_size; i++) {
@@ -66,18 +106,44 @@ static void test_large(const testCtx *const p_ctx) {
assert_nonnull(symbol, "Symbol not created\n"); assert_nonnull(symbol, "Symbol not created\n");
testUtilStrCpyRepeat(data_buf, data[i].pattern, data[i].length); testUtilStrCpyRepeat(data_buf, data[i].pattern, data[i].length);
assert_equal(data[i].length, (int) strlen(data_buf), "i:%d length %d != strlen(data_buf) %d\n", i, data[i].length, (int) strlen(data_buf)); assert_equal(data[i].length, (int) strlen(data_buf), "i:%d length %d != strlen(data_buf) %d\n",
i, data[i].length, (int) strlen(data_buf));
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data_buf, data[i].length, debug); length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/,
-1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/,
data_buf, data[i].length, debug);
ret = ZBarcode_Encode(symbol, TCU(data_buf), length); ret = ZBarcode_Encode(symbol, ZCUCP(data_buf), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n",
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt); i, ret, data[i].ret, symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n",
i, ret ? "set" : "empty", symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n",
i, symbol->errtxt, data[i].expected_errtxt);
if (ret < ZINT_ERROR) { if (ret < ZINT_ERROR) {
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->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n",
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width); 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);
if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data_buf, length, debug)) {
int cmp_len, ret_len;
char modules_dump[4096];
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)),-1,
"i:%d testUtilModulesDump == -1\n", i);
ret = testUtilZXingCPP(i, symbol, data_buf, length, modules_dump, 3 /*zxingcpp_cmp*/, cmp_buf,
sizeof(cmp_buf), &cmp_len);
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n",
i, testUtilBarcodeName(symbol->symbology), ret);
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data_buf, length,
NULL /*primary*/, ret_buf, &ret_len);
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg,
testUtilEscape(cmp_buf, cmp_len, escaped, sizeof(escaped)),
testUtilEscape(ret_buf, ret_len, escaped2, sizeof(escaped2)));
}
} }
ZBarcode_Delete(symbol); ZBarcode_Delete(symbol);
@@ -91,6 +157,7 @@ static void test_hrt(const testCtx *const p_ctx) {
struct item { struct item {
int symbology; int symbology;
int option_2;
int output_options; int output_options;
const char *data; const char *data;
int length; int length;
@@ -102,30 +169,63 @@ static void test_hrt(const testCtx *const p_ctx) {
}; };
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = { static const struct item data[] = {
/* 0*/ { BARCODE_TELEPEN, -1, "ABC1234.;$", -1, "ABC1234.;$", -1, "", -1 }, /* 0*/ { BARCODE_TELEPEN, -1, -1, "ABC1234.;$", -1, "ABC1234.;$", -1, "", -1 },
/* 1*/ { BARCODE_TELEPEN, BARCODE_CONTENT_SEGS, "ABC1234.;$", -1, "ABC1234.;$", -1, "ABC1234.;$^", -1 }, /* 1*/ { BARCODE_TELEPEN, -1, BARCODE_CONTENT_SEGS, "ABC1234.;$", -1, "ABC1234.;$", -1, "ABC1234.;$^", -1 },
/* 2*/ { BARCODE_TELEPEN, -1, "abc1234.;$", -1, "abc1234.;$", -1, "", -1 }, /* 2*/ { BARCODE_TELEPEN, -1, -1, "abc1234.;$", -1, "abc1234.;$", -1, "", -1 },
/* 3*/ { BARCODE_TELEPEN, BARCODE_CONTENT_SEGS, "abc1234.;$", -1, "abc1234.;$", -1, "abc1234.;$}", -1 }, /* 3*/ { BARCODE_TELEPEN, -1, BARCODE_CONTENT_SEGS, "abc1234.;$", -1, "abc1234.;$", -1, "abc1234.;$}", -1 },
/* 4*/ { BARCODE_TELEPEN, -1, "ABC1234\001", -1, "ABC1234 ", -1, "", -1 }, /* Note used to put control chars (apart from NUL) in HRT */ /* 4*/ { BARCODE_TELEPEN, -1, -1, "ABC1234\001", -1, "ABC1234 ", -1, "", -1 }, /* Note used to put control chars (apart from NUL) in HRT */
/* 5*/ { BARCODE_TELEPEN, BARCODE_CONTENT_SEGS, "ABC1234\001", -1, "ABC1234 ", -1, "ABC1234\001k", -1 }, /* 5*/ { BARCODE_TELEPEN, -1, BARCODE_CONTENT_SEGS, "ABC1234\001", -1, "ABC1234 ", -1, "ABC1234\001k", -1 },
/* 6*/ { BARCODE_TELEPEN, -1, "ABC\0001234", 8, "ABC 1234", -1, "", -1 }, /* 6*/ { BARCODE_TELEPEN, -1, -1, "ABC\0001234", 8, "ABC 1234", -1, "", -1 },
/* 7*/ { BARCODE_TELEPEN, BARCODE_CONTENT_SEGS, "ABC\0001234", 8, "ABC 1234", -1, "ABC\0001234l", 9 }, /* 7*/ { BARCODE_TELEPEN, -1, BARCODE_CONTENT_SEGS, "ABC\0001234", 8, "ABC 1234", -1, "ABC\0001234l", 9 },
/* 8*/ { BARCODE_TELEPEN, -1, "ABK0", -1, "ABK0", -1, "", -1 }, /* 8*/ { BARCODE_TELEPEN, -1, -1, "ABK0", -1, "ABK0", -1, "", -1 },
/* 9*/ { BARCODE_TELEPEN, BARCODE_CONTENT_SEGS, "ABK0", -1, "ABK0", -1, "ABK0\000", 5 }, /* 9*/ { BARCODE_TELEPEN, -1, BARCODE_CONTENT_SEGS, "ABK0", -1, "ABK0", -1, "ABK0\000", 5 },
/* 10*/ { BARCODE_TELEPEN_NUM, -1, "1234", -1, "1234", -1, "", -1 }, /* 10*/ { BARCODE_TELEPEN, -1, -1, "ABK0\020", -1, "ABK0 ", -1, "", -1 }, /* Trailing DLE is literal DLE, space in HRT */
/* 11*/ { BARCODE_TELEPEN_NUM, BARCODE_CONTENT_SEGS, "1234", -1, "1234", -1, "1234\033", -1 }, /* 11*/ { BARCODE_TELEPEN, -1, BARCODE_CONTENT_SEGS, "ABK0\020", -1, "ABK0 ", -1, "ABK0\020o", -1 },
/* 12*/ { BARCODE_TELEPEN_NUM, -1, "123X", -1, "123X", -1, "", -1 }, /* 12*/ { BARCODE_TELEPEN, 1, -1, "ABK0\020", -1, "ABK0", -1, "", -1 }, /* Trailing DLE in Full ASCII + Compressed Numeric mode, remove from HRT */
/* 13*/ { BARCODE_TELEPEN_NUM, BARCODE_CONTENT_SEGS, "123X", -1, "123X", -1, "123XD", -1 }, /* 13*/ { BARCODE_TELEPEN, 1, BARCODE_CONTENT_SEGS, "ABK0\020", -1, "ABK0", -1, "ABK0\020o", -1 },
/* 14*/ { BARCODE_TELEPEN_NUM, -1, "123x", -1, "123X", -1, "", -1 }, /* Converts to upper */ /* 14*/ { BARCODE_TELEPEN, 1, -1, "ABC\0201234", -1, "ABC1234", -1, "", -1 }, /* Trailing numeric, no leading zero needed */
/* 15*/ { BARCODE_TELEPEN_NUM, BARCODE_CONTENT_SEGS, "123x", -1, "123X", -1, "123XD", -1 }, /* 15*/ { BARCODE_TELEPEN, 1, BARCODE_CONTENT_SEGS, "ABC\0201234", -1, "ABC1234", -1, "ABC\0201234C", -1 },
/* 16*/ { BARCODE_TELEPEN_NUM, -1, "12345", -1, "012345", -1, "", -1 }, /* Adds leading zero if odd */ /* 16*/ { BARCODE_TELEPEN, 1, -1, "ABC\020123", -1, "ABC0123", -1, "", -1 }, /* Trailing numeric, add leading zero */
/* 17*/ { BARCODE_TELEPEN_NUM, BARCODE_CONTENT_SEGS, "12345", -1, "012345", -1, "012345h", -1 }, /* 17*/ { BARCODE_TELEPEN, 1, BARCODE_CONTENT_SEGS, "ABC\020123", -1, "ABC0123", -1, "ABC\0200123Y", -1 },
/* 18*/ { BARCODE_TELEPEN, 1, -1, "ABC\020123x", -1, "ABC123X", -1, "", -1 }, /* Converts to upper */
/* 19*/ { BARCODE_TELEPEN, 1, BARCODE_CONTENT_SEGS, "ABC\020123x", -1, "ABC123X", -1, "ABC\020123Xl", -1 },
/* 20*/ { BARCODE_TELEPEN_NUM, -1, -1, "1234", -1, "1234", -1, "", -1 },
/* 21*/ { BARCODE_TELEPEN_NUM, -1, BARCODE_CONTENT_SEGS, "1234", -1, "1234", -1, "1234\033", -1 },
/* 22*/ { BARCODE_TELEPEN_NUM, -1, -1, "123X", -1, "123X", -1, "", -1 },
/* 23*/ { BARCODE_TELEPEN_NUM, -1, BARCODE_CONTENT_SEGS, "123X", -1, "123X", -1, "123XD", -1 },
/* 24*/ { BARCODE_TELEPEN_NUM, -1, -1, "123x", -1, "123X", -1, "", -1 }, /* Converts to upper */
/* 25*/ { BARCODE_TELEPEN_NUM, -1, BARCODE_CONTENT_SEGS, "123x", -1, "123X", -1, "123XD", -1 },
/* 26*/ { BARCODE_TELEPEN_NUM, -1, -1, "12345", -1, "012345", -1, "", -1 }, /* Adds leading zero if odd */
/* 27*/ { BARCODE_TELEPEN_NUM, -1, BARCODE_CONTENT_SEGS, "12345", -1, "012345", -1, "012345h", -1 },
/* 28*/ { BARCODE_TELEPEN_NUM, -1, -1, "1234\0205", -1, "12345", -1, "", -1 }, /* Trailing ASCII, no leading zero needed */
/* 29*/ { BARCODE_TELEPEN_NUM, -1, BARCODE_CONTENT_SEGS, "1234\0205", -1, "12345", -1, "1234\0205U", -1 },
/* 30*/ { BARCODE_TELEPEN_NUM, -1, -1, "123\020AB", -1, "0123AB", -1, "", -1 }, /* Trailing ASCII, add leading zero */
/* 31*/ { BARCODE_TELEPEN_NUM, -1, BARCODE_CONTENT_SEGS, "123\020AB", -1, "0123AB", -1, "0123\020AB\035", -1 },
/* 32*/ { BARCODE_TELEPEN_NUM, -1, -1, "123\020", -1, "0123", -1, "", -1 }, /* Trailing DLE, remove from HRT */
/* 33*/ { BARCODE_TELEPEN_NUM, -1, BARCODE_CONTENT_SEGS, "123\020", -1, "0123", -1, "0123\020!", -1 },
/* 34*/ { BARCODE_TELEPEN_NUM, 1, -1, "12345", -1, "012345", -1, "", -1 },
/* 35*/ { BARCODE_TELEPEN_NUM, 1, BARCODE_CONTENT_SEGS, "12345", -1, "012345", -1, "012345h", -1 },
/* 36*/ { BARCODE_TELEPEN_NUM, 1, -1, "1234\020567", -1, "1234567", -1, "", -1 },
/* 37*/ { BARCODE_TELEPEN_NUM, 1, BARCODE_CONTENT_SEGS, "1234\020567", -1, "1234567", -1, "1234\020567g", -1 },
/* 38*/ { BARCODE_TELEPEN_NUM, 1, -1, "12345\020A", -1, "012345A", -1, "", -1 },
/* 39*/ { BARCODE_TELEPEN_NUM, 1, BARCODE_CONTENT_SEGS, "12345\020A", -1, "012345A", -1, "012345\020A\027", -1 },
/* 40*/ { BARCODE_TELEPEN_NUM, 1, -1, "123\020", -1, "0123", -1, "", -1 },
/* 41*/ { BARCODE_TELEPEN_NUM, 1, BARCODE_CONTENT_SEGS, "123\020", -1, "0123", -1, "0123\020!", -1 },
}; };
const int data_size = ARRAY_SIZE(data); const int data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
struct zint_symbol *symbol = NULL; struct zint_symbol *symbol = NULL;
int expected_length, expected_content_length; int expected_length, expected_content_length;
char escaped[1024];
char escaped2[1024];
char cmp_buf[8192];
char cmp_msg[1024];
char ret_buf[8192];
/* Only do zxing-cpp tests if asked, too slow otherwise */
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder();
testStartSymbol(p_ctx->func_name, &symbol); testStartSymbol(p_ctx->func_name, &symbol);
for (i = 0; i < data_size; i++) { for (i = 0; i < data_size; i++) {
@@ -136,32 +236,60 @@ static void test_hrt(const testCtx *const p_ctx) {
assert_nonnull(symbol, "Symbol not created\n"); assert_nonnull(symbol, "Symbol not created\n");
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/,
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, data[i].output_options, -1 /*option_1*/, data[i].option_2, -1 /*option_3*/, data[i].output_options,
data[i].data, data[i].length, debug); data[i].data, data[i].length, debug);
expected_length = data[i].expected_length == -1 ? (int) strlen(data[i].expected) : data[i].expected_length; expected_length = data[i].expected_length == -1 ? (int) strlen(data[i].expected) : data[i].expected_length;
expected_content_length = data[i].expected_content_length == -1 ? (int) strlen(data[i].expected_content) : data[i].expected_content_length; expected_content_length = data[i].expected_content_length == -1
? (int) strlen(data[i].expected_content) : data[i].expected_content_length;
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length); ret = ZBarcode_Encode(symbol, ZCUCP(data[i].data), length);
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt); assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt);
assert_equal(symbol->text_length, expected_length, "i:%d text_length %d != expected_length %d\n", assert_equal(symbol->text_length, expected_length, "i:%d text_length %d != expected_length %d (%s, %s)\n",
i, symbol->text_length, expected_length); i, symbol->text_length, expected_length,
assert_zero(memcmp(symbol->text, data[i].expected, expected_length), "i:%d memcmp(%s, %s, %d) != 0\n", testUtilEscape(ZCCP(symbol->text), symbol->text_length, escaped, sizeof(escaped)),
i, symbol->text, data[i].expected, expected_length); testUtilEscape(data[i].expected, expected_length, escaped2, sizeof(escaped2)));
assert_zero(memcmp(symbol->text, data[i].expected, expected_length), "i:%d text memcmp(%s, %s, %d) != 0\n",
i, testUtilEscape(ZCCP(symbol->text), symbol->text_length, escaped, sizeof(escaped)),
testUtilEscape(data[i].expected, expected_length, escaped2, sizeof(escaped2)), expected_length);
if (symbol->output_options & BARCODE_CONTENT_SEGS) { if (symbol->output_options & BARCODE_CONTENT_SEGS) {
assert_nonnull(symbol->content_segs, "i:%d content_segs NULL\n", i); assert_nonnull(symbol->content_segs, "i:%d content_segs NULL\n", i);
assert_nonnull(symbol->content_segs[0].source, "i:%d content_segs[0].source NULL\n", i); assert_nonnull(symbol->content_segs[0].source, "i:%d content_segs[0].source NULL\n", i);
assert_equal(symbol->content_segs[0].length, expected_content_length, assert_equal(symbol->content_segs[0].length, expected_content_length,
"i:%d content_segs[0].length %d != expected_content_length %d\n", "i:%d content_segs[0].length %d != expected_content_length %d (%s, %s)\n",
i, symbol->content_segs[0].length, expected_content_length); i, symbol->content_segs[0].length, expected_content_length,
testUtilEscape(ZCCP(symbol->content_segs[0].source), symbol->content_segs[0].length, escaped,
sizeof(escaped)),
testUtilEscape(data[i].expected_content, expected_content_length, escaped2,
sizeof(escaped2)));
assert_zero(memcmp(symbol->content_segs[0].source, data[i].expected_content, expected_content_length), assert_zero(memcmp(symbol->content_segs[0].source, data[i].expected_content, expected_content_length),
"i:%d memcmp(%.*s, %.*s, %d) != 0\n", "i:%d content_segs[0].source memcmp(%s, %s, %d) != 0\n", i,
i, symbol->content_segs[0].length, symbol->content_segs[0].source, expected_content_length, testUtilEscape(ZCCP(symbol->content_segs[0].source), symbol->content_segs[0].length, escaped,
data[i].expected_content, expected_content_length); sizeof(escaped)),
testUtilEscape(data[i].expected_content, expected_content_length, escaped2,
sizeof(escaped2)), expected_content_length);
} else { } else {
assert_null(symbol->content_segs, "i:%d content_segs not NULL\n", i); assert_null(symbol->content_segs, "i:%d content_segs not NULL\n", i);
} }
if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) {
int cmp_len, ret_len;
char modules_dump[4096];
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)),-1,
"i:%d testUtilModulesDump == -1\n", i);
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, 3 /*zxingcpp_cmp*/, cmp_buf,
sizeof(cmp_buf), &cmp_len);
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n",
i, testUtilBarcodeName(symbol->symbology), ret);
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length,
NULL /*primary*/, ret_buf, &ret_len);
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg,
testUtilEscape(cmp_buf, cmp_len, escaped, sizeof(escaped)),
testUtilEscape(ret_buf, ret_len, escaped2, sizeof(escaped2)));
}
ZBarcode_Delete(symbol); ZBarcode_Delete(symbol);
} }
@@ -173,6 +301,7 @@ static void test_input(const testCtx *const p_ctx) {
struct item { struct item {
int symbology; int symbology;
int option_2;
const char *data; const char *data;
int length; int length;
int ret; int ret;
@@ -182,20 +311,37 @@ static void test_input(const testCtx *const p_ctx) {
}; };
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = { static const struct item data[] = {
/* 0*/ { BARCODE_TELEPEN, " !\"#$%&'()*+,-./0123456789:;<", -1, 0, 1, 512, "" }, /* 0*/ { BARCODE_TELEPEN, -1, " !\"#$%&'()*+,-./0123456789:;<", -1, 0, 1, 512, "" },
/* 1*/ { BARCODE_TELEPEN, "AZaz\176\001", -1, 0, 1, 144, "" }, /* 1*/ { BARCODE_TELEPEN, -1, "AZaz\176\001", -1, 0, 1, 144, "" },
/* 2*/ { BARCODE_TELEPEN, "\000\177", 2, 0, 1, 80, "" }, /* 2*/ { BARCODE_TELEPEN, -1, "\000\177", 2, 0, 1, 80, "" },
/* 3*/ { BARCODE_TELEPEN, "é", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 391: Invalid character at position 1 in input, extended ASCII not allowed" }, /* 3*/ { BARCODE_TELEPEN, -1, "é", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 391: Invalid character at position 1 in input, extended ASCII not allowed" },
/* 4*/ { BARCODE_TELEPEN_NUM, "1234567890", -1, 0, 1, 128, "" }, /* 4*/ { BARCODE_TELEPEN, -1, "\020", -1, 0, 1, 64, "" },
/* 5*/ { BARCODE_TELEPEN_NUM, "123456789A", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 393: Invalid character at position 10 in input (digits and \"X\" only)" }, /* 5*/ { BARCODE_TELEPEN, 1, "\020", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 397: DLE (ASCII 16) cannot be first character in Full ASCII + Compressed Numeric Mode" },
/* 6*/ { BARCODE_TELEPEN_NUM, "123456789X", -1, 0, 1, 128, "" }, /* [0-9]X allowed */ /* 6*/ { BARCODE_TELEPEN, -1, "A\020B", -1, 0, 1, 96, "" },
/* 7*/ { BARCODE_TELEPEN_NUM, "12345678X9", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 394: Invalid odd position 9 of \"X\" in Telepen data" }, /* X[0-9] not allowed */ /* 7*/ { BARCODE_TELEPEN, 1, "A\020B", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 396: Invalid character at position 3 in input (digits and \"X\" only)" },
/* 8*/ { BARCODE_TELEPEN_NUM, "1X34567X9X", -1, 0, 1, 128, "" }, /* [0-9]X allowed multiple times */ /* 8*/ { BARCODE_TELEPEN_NUM, -1, "1234567890", -1, 0, 1, 128, "" },
/* 9*/ { BARCODE_TELEPEN_NUM, -1, "123456789A", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 393: Invalid character at position 10 in input (digits and \"X\" only)" },
/* 10*/ { BARCODE_TELEPEN_NUM, -1, "123456789X", -1, 0, 1, 128, "" }, /* [0-9]X allowed */
/* 11*/ { BARCODE_TELEPEN_NUM, -1, "12345678X9", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 394: Invalid odd position 9 of \"X\" in Telepen data" }, /* X[0-9] not allowed */
/* 12*/ { BARCODE_TELEPEN_NUM, -1, "1X34567X9X", -1, 0, 1, 128, "" }, /* [0-9]X allowed multiple times */
/* 13*/ { BARCODE_TELEPEN_NUM, -1, "\020", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 398: DLE (ASCII 16) cannot be first character in Compressed Numeric Mode" },
/* 14*/ { BARCODE_TELEPEN_NUM, 1, "\020", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 398: DLE (ASCII 16) cannot be first character in Compressed Numeric Mode" },
/* 15*/ { BARCODE_TELEPEN_NUM, -1, "12\020é", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 395: Invalid character at position 4 in input, extended ASCII not allowed" },
/* 16*/ { BARCODE_TELEPEN_NUM, 1, "12\020é", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 395: Invalid character at position 4 in input, extended ASCII not allowed" },
}; };
const int data_size = ARRAY_SIZE(data); const int data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
struct zint_symbol *symbol = NULL; struct zint_symbol *symbol = NULL;
char escaped[1024];
char escaped2[1024];
char cmp_buf[8192];
char cmp_msg[1024];
char ret_buf[8192];
/* Only do zxing-cpp tests if asked, too slow otherwise */
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder();
testStartSymbol(p_ctx->func_name, &symbol); testStartSymbol(p_ctx->func_name, &symbol);
for (i = 0; i < data_size; i++) { for (i = 0; i < data_size; i++) {
@@ -205,16 +351,41 @@ static void test_input(const testCtx *const p_ctx) {
symbol = ZBarcode_Create(); symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n"); assert_nonnull(symbol, "Symbol not created\n");
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, data[i].length, debug); 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, data[i].length, debug);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length); ret = ZBarcode_Encode(symbol, ZCUCP(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); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n",
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt); i, ret, data[i].ret, symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n",
i, ret ? "set" : "empty", symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n",
i, symbol->errtxt, data[i].expected_errtxt);
if (ret < ZINT_ERROR) { if (ret < ZINT_ERROR) {
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->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n",
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width); 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);
if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) {
int cmp_len, ret_len;
char modules_dump[4096];
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)),-1,
"i:%d testUtilModulesDump == -1\n", i);
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, 3 /*zxingcpp_cmp*/, cmp_buf,
sizeof(cmp_buf), &cmp_len);
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n",
i, testUtilBarcodeName(symbol->symbology), ret);
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length,
NULL /*primary*/, ret_buf, &ret_len);
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg,
testUtilEscape(cmp_buf, cmp_len, escaped, sizeof(escaped)),
testUtilEscape(ret_buf, ret_len, escaped2, sizeof(escaped2)));
}
} }
ZBarcode_Delete(symbol); ZBarcode_Delete(symbol);
@@ -224,14 +395,15 @@ static void test_input(const testCtx *const p_ctx) {
} }
/* Telepen Barcode Symbology information and History (BSiH) /* Telepen Barcode Symbology information and History (BSiH)
https://telepen.co.uk/wp-content/uploads/2018/10/Barcode-Symbology-information-and-History.pdf */ https://advanova.co.uk/wp-content/uploads/2022/05/Barcode-Symbology-information-and-History.pdf */
/* E2326U: SB Telepen Barcode Fonts Guide Issue 2 (Apr 2009) /* E2326U: SB Telepen Fonts Guide. Issue 3 13/5/2022
https://telepen.co.uk/wp-content/uploads/2018/09/SB-Telepen-Barcode-Fonts-V2.pdf */ https://advanova.co.uk/wp-content/uploads/2022/05/SB-Telepen-Barcode-Fonts-V3.pdf */
static void test_encode(const testCtx *const p_ctx) { static void test_encode(const testCtx *const p_ctx) {
int debug = p_ctx->debug; int debug = p_ctx->debug;
struct item { struct item {
int symbology; int symbology;
int option_2;
const char *data; const char *data;
int length; int length;
int ret; int ret;
@@ -241,35 +413,48 @@ static void test_encode(const testCtx *const p_ctx) {
const char *comment; const char *comment;
const char *expected; const char *expected;
}; };
/* s/\v(\/\*)[ 0-9]*(\*\/)/\=printf("%s%3d%s", submatch(1), (@z+setreg('z',@z+1)), submatch(2))/ | let @z=0: */
static const struct item data[] = { static const struct item data[] = {
/* 0*/ { BARCODE_TELEPEN, "1A", -1, 0, 1, 80, "Telepen BSiH Example, same", /* 0*/ { BARCODE_TELEPEN, -1, "1A", -1, 0, 1, 80, "Telepen BSiH Example, same",
"10101010101110001011101000100010101110111011100010100010001110101110001010101010" "10101010101110001011101000100010101110111011100010100010001110101110001010101010"
}, },
/* 1*/ { BARCODE_TELEPEN, "ABC", -1, 0, 1, 96, "Telepen E2326U Example, same", /* 1*/ { BARCODE_TELEPEN, -1, "ABC", -1, 0, 1, 96, "Telepen E2326U Example, same",
"101010101011100010111011101110001110001110111000101011101110101011101000101000101110001010101010" "101010101011100010111011101110001110001110111000101011101110101011101000101000101110001010101010"
}, },
/* 2*/ { BARCODE_TELEPEN, "RST", -1, 0, 1, 96, "Verified manually against tec-it", /* 2*/ { BARCODE_TELEPEN, -1, "RST", -1, 0, 1, 96, "Verified manually against TEC-IT",
"101010101011100011100011100010101010111010111000111010111000101010111000111011101110001010101010" "101010101011100011100011100010101010111010111000111010111000101010111000111011101110001010101010"
}, },
/* 3*/ { BARCODE_TELEPEN, "?@", -1, 0, 1, 80, "ASCII count 127, check 0; verified manually against tec-it", /* 3*/ { BARCODE_TELEPEN, -1, "?@", -1, 0, 1, 80, "ASCII count 127, check 0; verified manually against TEC-IT",
"10101010101110001010101010101110111011101110101011101110111011101110001010101010" "10101010101110001010101010101110111011101110101011101110111011101110001010101010"
}, },
/* 4*/ { BARCODE_TELEPEN, "\000", 1, 0, 1, 64, "Verified manually against tec-it", /* 4*/ { BARCODE_TELEPEN, -1, "\000", 1, 0, 1, 64, "Verified manually against TEC-IT",
"1010101010111000111011101110111011101110111011101110001010101010" "1010101010111000111011101110111011101110111011101110001010101010"
}, },
/* 5*/ { BARCODE_TELEPEN_NUM, "1234567890", -1, 0, 1, 128, "Verified manually against tec-it", /* 5*/ { BARCODE_TELEPEN, 1, "AB\0201234", -1, 0, 1, 128, "",
"10101011101010001011101110111000111000111011100011101110101110101010101110101110101000101010001010101011101110101110101000101010"
},
/* 6*/ { BARCODE_TELEPEN, 1, "AB\020123", -1, 0, 1, 128, "",
"10101011101010001011101110111000111000111011100011101110101110101110101010111010111000100010001010100010100011101110101000101010"
},
/* 7*/ { BARCODE_TELEPEN, 1, "AB\020", -1, 0, 1, 96, "",
"101010111010100010111011101110001110001110111000111011101011101010101110001010101110101000101010"
},
/* 8*/ { BARCODE_TELEPEN, 1, "AB", -1, 0, 1, 80, "",
"10101011101010001011101110111000111000111011100010101000101010001110101000101010"
},
/* 9*/ { BARCODE_TELEPEN_NUM, -1, "1234567890", -1, 0, 1, 128, "Verified manually against TEC-IT",
"10101010101110001010101110101110101000101010001010101110101110001011101010001000101110001010101010101011101010101110001010101010" "10101010101110001010101110101110101000101010001010101110101110001011101010001000101110001010101010101011101010101110001010101010"
}, },
/* 6*/ { BARCODE_TELEPEN_NUM, "123456789", -1, 0, 1, 128, "Verified manually against tec-it (012345679)", /* 10*/ { BARCODE_TELEPEN_NUM, -1, "123456789", -1, 0, 1, 128, "Verified manually against TEC-IT (012345679)",
"10101010101110001110101010111010111000100010001011101110001110001000101010001010111010100010100010111000101110101110001010101010" "10101010101110001110101010111010111000100010001011101110001110001000101010001010111010100010100010111000101110101110001010101010"
}, },
/* 7*/ { BARCODE_TELEPEN_NUM, "123X", -1, 0, 1, 80, "Verified manually against tec-it", /* 11*/ { BARCODE_TELEPEN_NUM, -1, "123X", -1, 0, 1, 80, "Verified manually against TEC-IT",
"10101010101110001010101110101110111010111000111011101011101110001110001010101010" "10101010101110001010101110101110111010111000111011101011101110001110001010101010"
}, },
/* 8*/ { BARCODE_TELEPEN_NUM, "1X3X", -1, 0, 1, 80, "Verified manually against tec-it", /* 12*/ { BARCODE_TELEPEN_NUM, -1, "1X3X", -1, 0, 1, 80, "Verified manually against TEC-IT",
"10101010101110001110001110001110111010111000111010111010101110001110001010101010" "10101010101110001110001110001110111010111000111010111010101110001110001010101010"
}, },
/* 9*/ { BARCODE_TELEPEN_NUM, "3637", -1, 0, 1, 80, "Glyph count 127, check 0; verified manually against tec-it", /* 13*/ { BARCODE_TELEPEN_NUM, -1, "3637", -1, 0, 1, 80, "Glyph count 127, check 0; verified manually against TEC-IT",
"10101010101110001010101010101110111011101110101011101110111011101110001010101010" "10101010101110001010101010101110111011101110101011101110111011101110001010101010"
}, },
}; };
@@ -278,10 +463,14 @@ static void test_encode(const testCtx *const p_ctx) {
struct zint_symbol *symbol = NULL; struct zint_symbol *symbol = NULL;
char escaped[1024]; char escaped[1024];
char bwipp_buf[8192]; char escaped2[1024];
char bwipp_msg[1024]; char cmp_buf[8192];
char cmp_msg[1024];
char ret_buf[8192];
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */ /* Only do BWIPP/zxing-cpp tests if asked, too slow otherwise */
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript();
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder();
testStartSymbol(p_ctx->func_name, &symbol); testStartSymbol(p_ctx->func_name, &symbol);
@@ -292,14 +481,18 @@ static void test_encode(const testCtx *const p_ctx) {
symbol = ZBarcode_Create(); symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n"); assert_nonnull(symbol, "Symbol not created\n");
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, data[i].length, debug); 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, data[i].length, debug);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length); ret = ZBarcode_Encode(symbol, ZCUCP(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); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n",
i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) { if (p_ctx->generate) {
printf(" /*%3d*/ { %s, \"%s\", %d, %s, %d, %d, \"%s\",\n", printf(" /*%3d*/ { %s, %d, \"%s\", %d, %s, %d, %d, \"%s\",\n",
i, testUtilBarcodeName(data[i].symbology), testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), data[i].length, i, testUtilBarcodeName(data[i].symbology), data[i].option_2,
testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), data[i].length,
testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].comment); testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].comment);
testUtilModulesPrint(symbol, " ", "\n"); testUtilModulesPrint(symbol, " ", "\n");
printf(" },\n"); printf(" },\n");
@@ -307,19 +500,41 @@ static void test_encode(const testCtx *const p_ctx) {
if (ret < ZINT_ERROR) { if (ret < ZINT_ERROR) {
int width, row; int width, row;
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, data[i].data); assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n",
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data); i, symbol->rows, data[i].expected_rows, data[i].data);
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n",
i, symbol->width, data[i].expected_width, data[i].data);
ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row); 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); assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n",
i, ret, width, row, data[i].data);
if (do_bwipp && testUtilCanBwipp(i, symbol, -1, -1, -1, debug)) { if (do_bwipp && testUtilCanBwipp(i, symbol, -1, data[i].option_2, -1, debug)) {
ret = testUtilBwipp(i, symbol, -1, -1, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf), NULL); ret = testUtilBwipp(i, symbol, -1, data[i].option_2, -1, data[i].data, length, NULL, cmp_buf,
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); sizeof(cmp_buf), NULL /*p_parsefnc*/);
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); ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, data[i].expected);
assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", 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); i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, data[i].expected);
}
if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) {
int cmp_len, ret_len;
char modules_dump[4096];
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)),-1,
"i:%d testUtilModulesDump == -1\n", i);
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, 3 /*zxingcpp_cmp*/, cmp_buf,
sizeof(cmp_buf), &cmp_len);
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n",
i, testUtilBarcodeName(symbol->symbology), ret);
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length,
NULL /*primary*/, ret_buf, &ret_len);
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg,
testUtilEscape(cmp_buf, cmp_len, escaped, sizeof(escaped)),
testUtilEscape(ret_buf, ret_len, escaped2, sizeof(escaped2)));
} }
} }
} }
@@ -347,7 +562,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
/* 1*/ { BARCODE_TELEPEN, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 70, ZINT_ERROR_TOO_LONG }, /* 1*/ { BARCODE_TELEPEN, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 70, ZINT_ERROR_TOO_LONG },
/* 2*/ { BARCODE_TELEPEN_NUM, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 70, ZINT_ERROR_INVALID_DATA }, /* 2*/ { BARCODE_TELEPEN_NUM, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 70, ZINT_ERROR_INVALID_DATA },
/* 3*/ { BARCODE_TELEPEN_NUM, "0404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404", 136, 0 }, /* 3*/ { BARCODE_TELEPEN_NUM, "0404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404", 136, 0 },
/* 4*/ { BARCODE_TELEPEN_NUM, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567", 137, ZINT_ERROR_TOO_LONG }, /* 4*/ { BARCODE_TELEPEN_NUM, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567", 137, 0 },
/* 5*/ { BARCODE_TELEPEN_NUM, "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000X", 136, 0 }, /* 5*/ { BARCODE_TELEPEN_NUM, "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000X", 136, 0 },
/* 6*/ { BARCODE_TELEPEN_NUM, "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999", 136, 0 }, /* 6*/ { BARCODE_TELEPEN_NUM, "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999", 136, 0 },
/* 7*/ { BARCODE_TELEPEN_NUM, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 4, 0 }, /* Length given, strlen > 137, so pseudo not NUL-terminated */ /* 7*/ { BARCODE_TELEPEN_NUM, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 4, 0 }, /* Length given, strlen > 137, so pseudo not NUL-terminated */
@@ -370,8 +585,9 @@ static void test_fuzz(const testCtx *const p_ctx) {
length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length; length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length;
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length); ret = ZBarcode_Encode(symbol, ZCUCP(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); 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); ZBarcode_Delete(symbol);
} }
@@ -379,40 +595,43 @@ static void test_fuzz(const testCtx *const p_ctx) {
testFinish(); testFinish();
} }
static const char TeleTable[128][16] = { /* Copy of "telepen.c" one */
{ "31313131" }, { "1131313111" }, { "33313111" }, { "1111313131" }, static const char TeleTable[132][16] = {
{ "3111313111" }, { "11333131" }, { "13133131" }, { "111111313111" }, { "31313131" }, { "1131313111" }, { "33313111" }, { "1111313131" }, /*00-03*/
{ "31333111" }, { "1131113131" }, { "33113131" }, { "1111333111" }, { "3111313111" }, { "11333131" }, { "13133131" }, { "111111313111" }, /*04-07*/
{ "3111113131" }, { "1113133111" }, { "1311133111" }, { "111111113131" }, { "31333111" }, { "1131113131" }, { "33113131" }, { "1111333111" }, /*08-0B*/
{ "3131113111" }, { "11313331" }, { "333331" }, { "111131113111" }, { "3111113131" }, { "1113133111" }, { "1311133111" }, { "111111113131" }, /*0C-0F*/
{ "31113331" }, { "1133113111" }, { "1313113111" }, { "1111113331" }, { "3131113111" }, { "11313331" }, { "333331" }, { "111131113111" }, /*10-13*/
{ "31131331" }, { "113111113111" }, { "3311113111" }, { "1111131331" }, { "31113331" }, { "1133113111" }, { "1313113111" }, { "1111113331" }, /*14-17*/
{ "311111113111" }, { "1113111331" }, { "1311111331" }, { "11111111113111" }, { "31131331" }, { "113111113111" }, { "3311113111" }, { "1111131331" }, /*18-1B*/
{ "31313311" }, { "1131311131" }, { "33311131" }, { "1111313311" }, { "311111113111" }, { "1113111331" }, { "1311111331" }, { "11111111113111" }, /*1C-1F*/
{ "3111311131" }, { "11333311" }, { "13133311" }, { "111111311131" }, { "31313311" }, { "1131311131" }, { "33311131" }, { "1111313311" }, /*20-23*/
{ "31331131" }, { "1131113311" }, { "33113311" }, { "1111331131" }, { "3111311131" }, { "11333311" }, { "13133311" }, { "111111311131" }, /*24-27*/
{ "3111113311" }, { "1113131131" }, { "1311131131" }, { "111111113311" }, { "31331131" }, { "1131113311" }, { "33113311" }, { "1111331131" }, /*28-2B*/
{ "3131111131" }, { "1131131311" }, { "33131311" }, { "111131111131" }, { "3111113311" }, { "1113131131" }, { "1311131131" }, { "111111113311" }, /*2C-2F*/
{ "3111131311" }, { "1133111131" }, { "1313111131" }, { "111111131311" }, { "3131111131" }, { "1131131311" }, { "33131311" }, { "111131111131" }, /*30-33*/
{ "3113111311" }, { "113111111131" }, { "3311111131" }, { "111113111311" }, { "3111131311" }, { "1133111131" }, { "1313111131" }, { "111111131311" }, /*34-37*/
{ "311111111131" }, { "111311111311" }, { "131111111311" }, { "11111111111131" }, { "3113111311" }, { "113111111131" }, { "3311111131" }, { "111113111311" }, /*38-3B*/
{ "3131311111" }, { "11313133" }, { "333133" }, { "111131311111" }, { "311111111131" }, { "111311111311" }, { "131111111311" }, { "11111111111131" }, /*3C-3F*/
{ "31113133" }, { "1133311111" }, { "1313311111" }, { "1111113133" }, { "3131311111" }, { "11313133" }, { "333133" }, { "111131311111" }, /*40-43*/
{ "313333" }, { "113111311111" }, { "3311311111" }, { "11113333" }, { "31113133" }, { "1133311111" }, { "1313311111" }, { "1111113133" }, /*44-47*/
{ "311111311111" }, { "11131333" }, { "13111333" }, { "11111111311111" }, { "313333" }, { "113111311111" }, { "3311311111" }, { "11113333" }, /*48-4B*/
{ "31311133" }, { "1131331111" }, { "33331111" }, { "1111311133" }, { "311111311111" }, { "11131333" }, { "13111333" }, { "11111111311111" }, /*4C-4F*/
{ "3111331111" }, { "11331133" }, { "13131133" }, { "111111331111" }, { "31311133" }, { "1131331111" }, { "33331111" }, { "1111311133" }, /*50-53*/
{ "3113131111" }, { "1131111133" }, { "33111133" }, { "111113131111" }, { "3111331111" }, { "11331133" }, { "13131133" }, { "111111331111" }, /*54-57*/
{ "3111111133" }, { "111311131111" }, { "131111131111" }, { "111111111133" }, { "3113131111" }, { "1131111133" }, { "33111133" }, { "111113131111" }, /*58-5B*/
{ "31311313" }, { "113131111111" }, { "3331111111" }, { "1111311313" }, { "3111111133" }, { "111311131111" }, { "131111131111" }, { "111111111133" /*START*/ }, /*5C-5F*/
{ "311131111111" }, { "11331313" }, { "13131313" }, { "11111131111111" }, { "31311313" }, { "113131111111" }, { "3331111111" }, { "1111311313" }, /*60-63*/
{ "3133111111" }, { "1131111313" }, { "33111313" }, { "111133111111" }, { "311131111111" }, { "11331313" }, { "13131313" }, { "11111131111111" }, /*64-67*/
{ "3111111313" }, { "111313111111" }, { "131113111111" }, { "111111111313" }, { "3133111111" }, { "1131111313" }, { "33111313" }, { "111133111111" }, /*68-6B*/
{ "313111111111" }, { "1131131113" }, { "33131113" }, { "11113111111111" }, { "3111111313" }, { "111313111111" }, { "131113111111" }, { "111111111313" }, /*6C-6F*/
{ "3111131113" }, { "113311111111" }, { "131311111111" }, { "111111131113" }, { "313111111111" }, { "1131131113" }, { "33131113" }, { "11113111111111" }, /*70-73*/
{ "3113111113" }, { "11311111111111" }, { "331111111111" }, { "111113111113" }, { "3111131113" }, { "113311111111" }, { "131311111111" }, { "111111131113" }, /*74-77*/
{ "31111111111111" }, { "111311111113" }, { "131111111113" }, { "3113111113" }, { "11311111111111" }, { "331111111111" /*STOP*/ }, { "111113111113" }, /*78-7B*/
{'1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1'}, { "31111111111111" }, { "111311111113" }, { "131111111113" }, /*7C-7E*/
{'1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1'}, /*7F*/
{ "111111113113" /*START 2*/ }, { "311311111111" /*STOP 2*/ }, /*80-81*/
{ "111111311113" /*START 3*/ }, { "311113111111" /*STOP 3*/ }, /*82-83*/
}; };
/* Dummy to generate lengths table */ /* Dummy to generate lengths table */
@@ -424,15 +643,16 @@ static void test_generate_lens(const testCtx *const p_ctx) {
return; return;
} }
printf("static const char TeleLens[128] = {"); printf("static const char TeleLens[128] = {\n ");
for (i = 0; i < 127; i++) { for (i = 0; i < 127; i++) {
if ((i % 16) == 0) { if (i && (i % 16) == 0) {
printf("\n %2d,", (int) strlen(TeleTable[i])); printf(" /*%02X-%02X*/\n %2d,", i - 16, i - 1, (int) strlen(TeleTable[i]));
} else { } else {
printf(" %2d,", (int) strlen(TeleTable[i])); printf(" %2d,", (int) strlen(TeleTable[i]));
} }
} }
printf(" 16\n};\n"); printf(" 16 /*70-7F*/\n};\n");
/* Not bothering with START/STOP 2/3 */
} }
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
+6 -6
View File
@@ -2545,9 +2545,9 @@ static void test_height(const testCtx *const p_ctx) {
/*110*/ { BARCODE_DBAR_EXP, -1, 33, "[01]12345678901231", "", 0, 33, 1, 134, 268, 66, "" }, /*110*/ { BARCODE_DBAR_EXP, -1, 33, "[01]12345678901231", "", 0, 33, 1, 134, 268, 66, "" },
/*111*/ { BARCODE_DBAR_EXP, COMPLIANT_HEIGHT, 33, "[01]12345678901231", "", ZINT_WARN_NONCOMPLIANT, 33, 1, 134, 268, 66, "" }, /*111*/ { BARCODE_DBAR_EXP, COMPLIANT_HEIGHT, 33, "[01]12345678901231", "", ZINT_WARN_NONCOMPLIANT, 33, 1, 134, 268, 66, "" },
/*112*/ { BARCODE_DBAR_EXP, COMPLIANT_HEIGHT, 34, "[01]12345678901231", "", 0, 34, 1, 134, 268, 68, "" }, /*112*/ { BARCODE_DBAR_EXP, COMPLIANT_HEIGHT, 34, "[01]12345678901231", "", 0, 34, 1, 134, 268, 68, "" },
/*113*/ { BARCODE_TELEPEN, -1, 1, "1234567890", "", 0, 1, 1, 208, 416, 2, "" }, /*113*/ { BARCODE_TELEPEN, -1, 8.95, "1234567890", "", 0, 8.95, 1, 208, 416, 17.9, "" },
/*114*/ { BARCODE_TELEPEN, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 208, 416, 2, "No known min" }, /*114*/ { BARCODE_TELEPEN, COMPLIANT_HEIGHT, 8.95, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 8.95, 1, 208, 416, 17.9, "" },
/*115*/ { BARCODE_TELEPEN, -1, 4, "1234567890", "", 0, 4, 1, 208, 416, 8, "" }, /*115*/ { BARCODE_TELEPEN, COMPLIANT_HEIGHT, 9, "1234567890", "", 0, 9, 1, 208, 416, 18, "" },
/*116*/ { BARCODE_UPCA, -1, 1, "12345678901", "", 0, 1, 1, 95, 226, 12, "" }, /*116*/ { BARCODE_UPCA, -1, 1, "12345678901", "", 0, 1, 1, 95, 226, 12, "" },
/*117*/ { BARCODE_UPCA, -1, 69, "12345678901", "", 0, 69, 1, 95, 226, 148, "" }, /*117*/ { BARCODE_UPCA, -1, 69, "12345678901", "", 0, 69, 1, 95, 226, 148, "" },
/*118*/ { BARCODE_UPCA, COMPLIANT_HEIGHT, 69, "12345678901", "", ZINT_WARN_NONCOMPLIANT, 69, 1, 95, 226, 148, "" }, /*118*/ { BARCODE_UPCA, COMPLIANT_HEIGHT, 69, "12345678901", "", ZINT_WARN_NONCOMPLIANT, 69, 1, 95, 226, 148, "" },
@@ -2764,9 +2764,9 @@ static void test_height(const testCtx *const p_ctx) {
/*329*/ { BARCODE_PLESSEY, -1, 1, "1234567890", "", 0, 1, 1, 227, 454, 2, "" }, /*329*/ { BARCODE_PLESSEY, -1, 1, "1234567890", "", 0, 1, 1, 227, 454, 2, "" },
/*330*/ { BARCODE_PLESSEY, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 227, 454, 2, "TODO: Find doc" }, /*330*/ { BARCODE_PLESSEY, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 227, 454, 2, "TODO: Find doc" },
/*331*/ { BARCODE_PLESSEY, -1, 4, "1234567890", "", 0, 4, 1, 227, 454, 8, "" }, /*331*/ { BARCODE_PLESSEY, -1, 4, "1234567890", "", 0, 4, 1, 227, 454, 8, "" },
/*332*/ { BARCODE_TELEPEN_NUM, -1, 1, "1234567890", "", 0, 1, 1, 128, 256, 2, "" }, /*332*/ { BARCODE_TELEPEN_NUM, -1, 6.65, "1234567890", "", 0, 6.65, 1, 128, 256, 13.3, "" },
/*333*/ { BARCODE_TELEPEN_NUM, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 128, 256, 2, "No known min" }, /*333*/ { BARCODE_TELEPEN_NUM, COMPLIANT_HEIGHT, 6.65, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 6.65, 1, 128, 256, 13.3, "" },
/*334*/ { BARCODE_TELEPEN_NUM, -1, 4, "1234567890", "", 0, 4, 1, 128, 256, 8, "" }, /*334*/ { BARCODE_TELEPEN_NUM, COMPLIANT_HEIGHT, 6.7, "1234567890", "", 0, 6.7, 1, 128, 256, 13.4, "" },
/*335*/ { BARCODE_ITF14, -1, 1, "1234567890", "", 0, 1, 1, 135, 330, 22, "" }, /*335*/ { BARCODE_ITF14, -1, 1, "1234567890", "", 0, 1, 1, 135, 330, 22, "" },
/*336*/ { BARCODE_ITF14, -1, 5.7, "1234567890", "", 0, 5.6999998, 1, 135, 330, 31.4, "" }, /*336*/ { BARCODE_ITF14, -1, 5.7, "1234567890", "", 0, 5.6999998, 1, 135, 330, 31.4, "" },
/*337*/ { BARCODE_ITF14, COMPLIANT_HEIGHT, 5.7, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 5.6999998, 1, 135, 330, 31.4, "" }, /*337*/ { BARCODE_ITF14, COMPLIANT_HEIGHT, 5.7, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 5.6999998, 1, 135, 330, 31.4, "" },
+52 -2
View File
@@ -3985,7 +3985,7 @@ static const char *testUtilZXingCPPName(int index, const struct zint_symbol *sym
{ "DataBar", BARCODE_DBAR_OMN, 29, }, { "DataBar", BARCODE_DBAR_OMN, 29, },
{ "DataBarLimited", BARCODE_DBAR_LTD, 30, }, { "DataBarLimited", BARCODE_DBAR_LTD, 30, },
{ "DataBarExpanded", BARCODE_DBAR_EXP, 31, }, { "DataBarExpanded", BARCODE_DBAR_EXP, 31, },
{ "", BARCODE_TELEPEN, 32, }, { "TelepenAlpha", BARCODE_TELEPEN, 32, },
{ "", -1, 33, }, { "", -1, 33, },
{ "UPC-A", BARCODE_UPCA, 34, }, { "UPC-A", BARCODE_UPCA, 34, },
{ "UPC-A", BARCODE_UPCA_CHK, 35, }, { "UPC-A", BARCODE_UPCA_CHK, 35, },
@@ -4040,7 +4040,7 @@ static const char *testUtilZXingCPPName(int index, const struct zint_symbol *sym
{ "MicroPDF417", BARCODE_MICROPDF417, 84, }, { "MicroPDF417", BARCODE_MICROPDF417, 84, },
{ "", BARCODE_USPS_IMAIL, 85, }, { "", BARCODE_USPS_IMAIL, 85, },
{ "", BARCODE_PLESSEY, 86, }, { "", BARCODE_PLESSEY, 86, },
{ "", BARCODE_TELEPEN_NUM, 87, }, { "TelepenNumeric", BARCODE_TELEPEN_NUM, 87, },
{ "", -1, 88, }, { "", -1, 88, },
{ "ITF", BARCODE_ITF14, 89, }, { "ITF", BARCODE_ITF14, 89, },
{ "", BARCODE_KIX, 90, }, { "", BARCODE_KIX, 90, },
@@ -4400,6 +4400,8 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in
char *pzn = symbology == BARCODE_PZN ? (char *) z_alloca(expected_len + 1 + 1) : NULL; char *pzn = symbology == BARCODE_PZN ? (char *) z_alloca(expected_len + 1 + 1) : NULL;
char *dxfe = symbology == BARCODE_DXFILMEDGE ? (char *) z_alloca(expected_len * 2 + 1) : NULL; char *dxfe = symbology == BARCODE_DXFILMEDGE ? (char *) z_alloca(expected_len * 2 + 1) : NULL;
char azrune[4]; char azrune[4];
char *telepen = symbology == BARCODE_TELEPEN || symbology == BARCODE_TELEPEN_NUM
? (char *) z_alloca(expected_len + 1 + 1 + 1) : NULL;
int ret; int ret;
int ret_memcmp; int ret_memcmp;
@@ -4740,6 +4742,54 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in
} else if ((symbology == BARCODE_CODE39 || symbology == BARCODE_EXCODE39 || symbology == BARCODE_LOGMARS) } else if ((symbology == BARCODE_CODE39 || symbology == BARCODE_EXCODE39 || symbology == BARCODE_LOGMARS)
&& have_ccheckdigit) { && have_ccheckdigit) {
cmp_len--; /* Too tedious to calculate so ignore */ cmp_len--; /* Too tedious to calculate so ignore */
} else if (symbology == BARCODE_TELEPEN_NUM) {
const int dle_posn = z_posn(expected, '\x10');
if (dle_posn != -1) {
if (dle_posn & 1) {
telepen[0] = '0';
memcpy(telepen + 1, expected, dle_posn);
z_to_upper(ZUCP(telepen + 1), dle_posn);
memcpy(telepen + dle_posn + 1, expected + dle_posn + 1, expected_len - (dle_posn + 1));
expected = telepen;
} else {
memcpy(telepen, expected, dle_posn);
z_to_upper(ZUCP(telepen), dle_posn);
memcpy(telepen + dle_posn, expected + dle_posn + 1, expected_len - (dle_posn + 1));
expected = telepen;
expected_len--;
}
} else if (expected_len & 1) {
telepen[0] = '0';
memcpy(telepen + 1, expected, expected_len);
z_to_upper(ZUCP(telepen + 1), expected_len);
expected = telepen;
expected_len++;
} else {
memcpy(telepen, expected, expected_len);
z_to_upper(ZUCP(telepen), expected_len);
expected = telepen;
}
} else if (symbology == BARCODE_TELEPEN && symbol->option_2 == 1) {
const int dle_posn = z_posn(expected, '\x10');
if (dle_posn != -1) {
memcpy(telepen, expected, dle_posn);
if (dle_posn + 1 < expected_len) {
if ((expected_len - (dle_posn + 1)) & 1) {
telepen[dle_posn] = '0';
memcpy(telepen + dle_posn + 1, expected + dle_posn + 1, expected_len - (dle_posn + 1));
z_to_upper(ZUCP(telepen + dle_posn + 1), expected_len - (dle_posn + 1));
} else {
memcpy(telepen + dle_posn, expected + dle_posn + 1, expected_len - (dle_posn + 1));
z_to_upper(ZUCP(telepen + dle_posn), expected_len - (dle_posn + 1));
expected_len--;
}
} else {
expected_len--;
}
expected = telepen;
}
} }
if (ret_buf) { if (ret_buf) {
@@ -56,5 +56,6 @@ run_zxingcpp_test "test_pdf417" "fuzz"
run_zxingcpp_test "test_qr" run_zxingcpp_test "test_qr"
run_zxingcpp_test "test_rss" "binary_div_modulo_divisor" run_zxingcpp_test "test_rss" "binary_div_modulo_divisor"
run_zxingcpp_test "test_rss" "examples" run_zxingcpp_test "test_rss" "examples"
run_zxingcpp_test "test_telepen"
run_zxingcpp_test "test_upcean" "upce_input" run_zxingcpp_test "test_upcean" "upce_input"
run_zxingcpp_test "test_upcean" "encode" run_zxingcpp_test "test_upcean" "encode"
+1
View File
@@ -1531,6 +1531,7 @@ namespace Zint {
|| m_symbol == BARCODE_QRCODE || m_symbol == BARCODE_HIBC_QR || m_symbol == BARCODE_MICROQR || m_symbol == BARCODE_QRCODE || m_symbol == BARCODE_HIBC_QR || m_symbol == BARCODE_MICROQR
|| m_symbol == BARCODE_RMQR || m_symbol == BARCODE_GRIDMATRIX || m_symbol == BARCODE_HANXIN || m_symbol == BARCODE_RMQR || m_symbol == BARCODE_GRIDMATRIX || m_symbol == BARCODE_HANXIN
|| m_symbol == BARCODE_CHANNEL || m_symbol == BARCODE_CODEONE || m_symbol == BARCODE_CODE93 || m_symbol == BARCODE_CHANNEL || m_symbol == BARCODE_CODEONE || m_symbol == BARCODE_CODE93
|| m_symbol == BARCODE_TELEPEN || m_symbol == BARCODE_TELEPEN_NUM
|| m_symbol == BARCODE_ULTRA || m_symbol == BARCODE_VIN) { || m_symbol == BARCODE_ULTRA || m_symbol == BARCODE_VIN) {
arg_int(cmd, "--vers=", option2()); arg_int(cmd, "--vers=", option2());
} else if (m_symbol == BARCODE_DAFT && option2() != 250) { } else if (m_symbol == BARCODE_DAFT && option2() != 250) {
+16
View File
@@ -1353,6 +1353,22 @@ private slots:
<< "zint.exe -b 145 --eci=20 -d \"\" --rotate=180 --vers=8" << "zint.exe -b 145 --eci=20 -d \"\" --rotate=180 --vers=8"
<< "" << "" << "" << ""; << "" << "" << "" << "";
QTest::newRow("BARCODE_TELEPEN") << false << 0.0f << ""
<< BARCODE_TELEPEN << (DATA_MODE | ESCAPE_MODE) // symbology-inputMode
<< "ABCDE\\L123" << "" // text-primary
<< 0.0f << -1 << 1 << 0 << 1.0f // height-scale
<< 0.0f << false << 0.8f << 1.0f // dpmm-textGap
<< 5.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting
<< true << false << false << false << true << 0 // showText-rotateAngle
<< 0 << false << false << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 32 --binary --compliantheight -d 'ABCDE\\L123' --esc --vers=1"
<< "zint.exe -b 32 --binary --compliantheight -d \"ABCDE\\L123\" --esc --vers=1"
<< "" << "" << "" << "";
QTest::newRow("BARCODE_ULTRA") << false << 0.0f << "" QTest::newRow("BARCODE_ULTRA") << false << 0.0f << ""
<< BARCODE_ULTRA << (GS1_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE) // symbology-inputMode << BARCODE_ULTRA << (GS1_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE) // symbology-inputMode
<< "(01)1" << "" // text-primary << "(01)1" << "" // text-primary
+5 -5
View File
@@ -1,12 +1,12 @@
<?xml version="1.0" standalone="no"?> <?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="461" height="193" version="1.1" xmlns="http://www.w3.org/2000/svg"> <svg width="615" height="193" version="1.1" xmlns="http://www.w3.org/2000/svg">
<desc>Zint Generated Symbol</desc> <desc>Zint Generated Symbol</desc>
<g id="barcode" fill="#000000"> <g id="barcode" fill="#000000">
<rect x="0" y="0" width="461" height="193" fill="#FFFFFF"/> <rect x="0" y="0" width="615" height="193" fill="#FFFFFF"/>
<path d="M0 0h4.8v153.6h-4.8ZM9.6 0h4.8v153.6h-4.8ZM19.2 0h4.8v153.6h-4.8ZM28.8 0h4.8v153.6h-4.8ZM38.4 0h4.8v153.6h-4.8ZM48 0h14.4v153.6h-14.4ZM76.8 0h14.4v153.6h-14.4ZM105.6 0h4.8v153.6h-4.8ZM115.2 0h4.8v153.6h-4.8ZM124.8 0h14.4v153.6h-14.4ZM153.6 0h14.4v153.6h-14.4ZM172.8 0h4.8v153.6h-4.8ZM192 0h4.8v153.6h-4.8ZM201.6 0h4.8v153.6h-4.8ZM220.8 0h4.8v153.6h-4.8ZM230.4 0h14.4v153.6h-14.4ZM249.6 0h14.4v153.6h-14.4ZM268.8 0h4.8v153.6h-4.8ZM278.4 0h4.8v153.6h-4.8ZM288 0h14.4v153.6h-14.4ZM307.2 0h14.4v153.6h-14.4ZM326.4 0h4.8v153.6h-4.8ZM336 0h4.8v153.6h-4.8ZM345.6 0h4.8v153.6h-4.8ZM355.2 0h4.8v153.6h-4.8ZM364.8 0h14.4v153.6h-14.4ZM384 0h14.4v153.6h-14.4ZM412.8 0h4.8v153.6h-4.8ZM422.4 0h4.8v153.6h-4.8ZM432 0h4.8v153.6h-4.8ZM441.6 0h4.8v153.6h-4.8ZM451.2 0h4.8v153.6h-4.8Z"/> <path d="M0 0h4.8v153.6h-4.8ZM9.6 0h4.8v153.6h-4.8ZM19.2 0h4.8v153.6h-4.8ZM28.8 0h4.8v153.6h-4.8ZM38.4 0h4.8v153.6h-4.8ZM48 0h14.4v153.6h-14.4ZM76.8 0h14.4v153.6h-14.4ZM105.6 0h4.8v153.6h-4.8ZM115.2 0h4.8v153.6h-4.8ZM124.8 0h14.4v153.6h-14.4ZM153.6 0h14.4v153.6h-14.4ZM172.8 0h4.8v153.6h-4.8ZM192 0h4.8v153.6h-4.8ZM201.6 0h4.8v153.6h-4.8ZM220.8 0h4.8v153.6h-4.8ZM230.4 0h14.4v153.6h-14.4ZM249.6 0h14.4v153.6h-14.4ZM268.8 0h4.8v153.6h-4.8ZM278.4 0h4.8v153.6h-4.8ZM288 0h14.4v153.6h-14.4ZM307.2 0h14.4v153.6h-14.4ZM326.4 0h14.4v153.6h-14.4ZM345.6 0h4.8v153.6h-4.8ZM355.2 0h4.8v153.6h-4.8ZM364.8 0h14.4v153.6h-14.4ZM384 0h14.4v153.6h-14.4ZM403.2 0h14.4v153.6h-14.4ZM422.4 0h4.8v153.6h-4.8ZM432 0h4.8v153.6h-4.8ZM441.6 0h14.4v153.6h-14.4ZM460.8 0h4.8v153.6h-4.8ZM470.4 0h4.8v153.6h-4.8ZM480 0h4.8v153.6h-4.8ZM499.2 0h4.8v153.6h-4.8ZM518.4 0h4.8v153.6h-4.8ZM528 0h4.8v153.6h-4.8ZM537.6 0h14.4v153.6h-14.4ZM566.4 0h4.8v153.6h-4.8ZM576 0h4.8v153.6h-4.8ZM585.6 0h4.8v153.6h-4.8ZM595.2 0h4.8v153.6h-4.8ZM604.8 0h4.8v153.6h-4.8Z"/>
<text x="230.4" y="185.63" text-anchor="middle" font-family="Arimo, Arial, sans-serif" font-size="33.6"> <text x="307.2" y="185.63" text-anchor="middle" font-family="Arimo, Arial, sans-serif" font-size="33.6">
Z80 Z8000
</text> </text>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="538" height="193" version="1.1" xmlns="http://www.w3.org/2000/svg">
<desc>Zint Generated Symbol</desc>
<g id="barcode" fill="#000000">
<rect x="0" y="0" width="538" height="193" fill="#FFFFFF"/>
<path d="M0 0h4.8v153.6h-4.8ZM9.6 0h4.8v153.6h-4.8ZM19.2 0h4.8v153.6h-4.8ZM28.8 0h14.4v153.6h-14.4ZM48 0h4.8v153.6h-4.8ZM57.6 0h4.8v153.6h-4.8ZM76.8 0h14.4v153.6h-14.4ZM105.6 0h4.8v153.6h-4.8ZM115.2 0h4.8v153.6h-4.8ZM124.8 0h14.4v153.6h-14.4ZM153.6 0h14.4v153.6h-14.4ZM172.8 0h14.4v153.6h-14.4ZM192 0h4.8v153.6h-4.8ZM201.6 0h14.4v153.6h-14.4ZM220.8 0h4.8v153.6h-4.8ZM230.4 0h4.8v153.6h-4.8ZM240 0h4.8v153.6h-4.8ZM249.6 0h14.4v153.6h-14.4ZM278.4 0h4.8v153.6h-4.8ZM288 0h4.8v153.6h-4.8ZM297.6 0h4.8v153.6h-4.8ZM307.2 0h4.8v153.6h-4.8ZM316.8 0h4.8v153.6h-4.8ZM326.4 0h4.8v153.6h-4.8ZM345.6 0h4.8v153.6h-4.8ZM364.8 0h14.4v153.6h-14.4ZM384 0h4.8v153.6h-4.8ZM403.2 0h4.8v153.6h-4.8ZM412.8 0h4.8v153.6h-4.8ZM432 0h14.4v153.6h-14.4ZM451.2 0h4.8v153.6h-4.8ZM460.8 0h14.4v153.6h-14.4ZM480 0h4.8v153.6h-4.8ZM489.6 0h4.8v153.6h-4.8ZM508.8 0h4.8v153.6h-4.8ZM518.4 0h4.8v153.6h-4.8ZM528 0h4.8v153.6h-4.8Z"/>
<text x="268.8" y="185.63" text-anchor="middle" font-family="Arimo, Arial, sans-serif" font-size="33.6">
Z8000
</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="538" height="193" version="1.1" xmlns="http://www.w3.org/2000/svg">
<desc>Zint Generated Symbol</desc>
<g id="barcode" fill="#000000">
<rect x="0" y="0" width="538" height="193" fill="#FFFFFF"/>
<path d="M0 0h4.8v153.6h-4.8ZM9.6 0h4.8v153.6h-4.8ZM19.2 0h4.8v153.6h-4.8ZM28.8 0h4.8v153.6h-4.8ZM38.4 0h4.8v153.6h-4.8ZM48 0h14.4v153.6h-14.4ZM76.8 0h4.8v153.6h-4.8ZM86.4 0h4.8v153.6h-4.8ZM96 0h4.8v153.6h-4.8ZM105.6 0h14.4v153.6h-14.4ZM124.8 0h4.8v153.6h-4.8ZM134.4 0h14.4v153.6h-14.4ZM153.6 0h14.4v153.6h-14.4ZM172.8 0h14.4v153.6h-14.4ZM192 0h4.8v153.6h-4.8ZM201.6 0h14.4v153.6h-14.4ZM220.8 0h4.8v153.6h-4.8ZM230.4 0h4.8v153.6h-4.8ZM240 0h14.4v153.6h-14.4ZM259.2 0h14.4v153.6h-14.4ZM278.4 0h14.4v153.6h-14.4ZM307.2 0h14.4v153.6h-14.4ZM336 0h14.4v153.6h-14.4ZM355.2 0h14.4v153.6h-14.4ZM384 0h14.4v153.6h-14.4ZM403.2 0h4.8v153.6h-4.8ZM412.8 0h14.4v153.6h-14.4ZM432 0h14.4v153.6h-14.4ZM460.8 0h14.4v153.6h-14.4ZM489.6 0h4.8v153.6h-4.8ZM499.2 0h4.8v153.6h-4.8ZM508.8 0h4.8v153.6h-4.8ZM518.4 0h4.8v153.6h-4.8ZM528 0h4.8v153.6h-4.8Z"/>
<text x="268.8" y="185.63" text-anchor="middle" font-family="Arimo, Arial, sans-serif" font-size="33.6">
12AB
</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="461" height="193" version="1.1" xmlns="http://www.w3.org/2000/svg">
<desc>Zint Generated Symbol</desc>
<g id="barcode" fill="#000000">
<rect x="0" y="0" width="461" height="193" fill="#FFFFFF"/>
<path d="M0 0h4.8v153.6h-4.8ZM9.6 0h4.8v153.6h-4.8ZM19.2 0h4.8v153.6h-4.8ZM28.8 0h4.8v153.6h-4.8ZM38.4 0h4.8v153.6h-4.8ZM48 0h14.4v153.6h-14.4ZM76.8 0h4.8v153.6h-4.8ZM86.4 0h4.8v153.6h-4.8ZM96 0h4.8v153.6h-4.8ZM105.6 0h14.4v153.6h-14.4ZM124.8 0h4.8v153.6h-4.8ZM134.4 0h14.4v153.6h-14.4ZM153.6 0h14.4v153.6h-14.4ZM172.8 0h14.4v153.6h-14.4ZM192 0h4.8v153.6h-4.8ZM201.6 0h14.4v153.6h-14.4ZM220.8 0h4.8v153.6h-4.8ZM230.4 0h4.8v153.6h-4.8ZM240 0h4.8v153.6h-4.8ZM249.6 0h14.4v153.6h-14.4ZM268.8 0h4.8v153.6h-4.8ZM278.4 0h4.8v153.6h-4.8ZM288 0h14.4v153.6h-14.4ZM307.2 0h4.8v153.6h-4.8ZM316.8 0h14.4v153.6h-14.4ZM345.6 0h4.8v153.6h-4.8ZM355.2 0h14.4v153.6h-14.4ZM374.4 0h4.8v153.6h-4.8ZM384 0h14.4v153.6h-14.4ZM412.8 0h4.8v153.6h-4.8ZM422.4 0h4.8v153.6h-4.8ZM432 0h4.8v153.6h-4.8ZM441.6 0h4.8v153.6h-4.8ZM451.2 0h4.8v153.6h-4.8Z"/>
<text x="230.4" y="185.63" text-anchor="middle" font-family="Arimo, Arial, sans-serif" font-size="33.6">
123
</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

+351 -255
View File
File diff suppressed because it is too large Load Diff
+54 -13
View File
@@ -1,6 +1,6 @@
% Zint Barcode Generator and Zint Barcode Studio User Manual % Zint Barcode Generator and Zint Barcode Studio User Manual
% Version 2.16.0.9 % Version 2.16.0.9
% April 2026 % May 2026
[//]: # ( vim: set ts=4 sw=4 et : ) [//]: # ( vim: set ts=4 sw=4 et : )
@@ -560,12 +560,18 @@ Sequence Equivalent
`\r` 0x0D `CR` Carriage Return `\r` 0x0D `CR` Carriage Return
`\L` 0x10 `DLE` Data Link Escape
`\e` 0x1B `ESC` Escape `\e` 0x1B `ESC` Escape
`\F` 0x1C `FS` File Separator
`\G` 0x1D `GS` Group Separator `\G` 0x1D `GS` Group Separator
`\R` 0x1E `RS` Record Separator `\R` 0x1E `RS` Record Separator
`\N` 0x1F `US` Unit Separator
`\(` 0x28 `(` Opening parenthesis (only with `--gs1parens`) `\(` 0x28 `(` Opening parenthesis (only with `--gs1parens`)
`\)` 0x29 `)` Closing parenthesis (only with `--gs1parens`) `\)` 0x29 `)` Closing parenthesis (only with `--gs1parens`)
@@ -619,7 +625,7 @@ Sequence
Table: Extra Escape Sequences {#tbl:extra_escapes} Table: Extra Escape Sequences {#tbl:extra_escapes}
Currently the only special character recognized is the Function Code 1 character Currently the only special character recognised is the Function Code 1 character
`FNC1`. If your data contains the sequence "`\^`" then it must be escaped using `FNC1`. If your data contains the sequence "`\^`" then it must be escaped using
the extra escape sequence "`\^^`", i.e. by doubling the caret. the extra escape sequence "`\^^`", i.e. by doubling the caret.
@@ -1176,21 +1182,21 @@ account, is to specify measurable units using the `--scalexdimdp` option, which
has the format has the format
``` ```
--scalexdimdp=X[,R] --scalexdimdp[=X[,R]]
``` ```
where `X` is the X-dimension (in mm by default) and `R` is the resolution (in where `X` is the X-dimension (in mm by default) and `R` is the resolution (in
dpmm, dots per mm, by default). `R` is optional, and defaults to 12 dpmm, and dpmm, dots per mm, by default). `R` is optional, and defaults to 12 dpmm, and
`X` may be zero, in which case it uses a symbology-specific default. The units `X` is optional or may be zero, in which case it uses a symbology-specific
may be given in inches for `X` by appending `"in"`, and in dpi (dots per inch) default. The units may be given in inches for `X` by appending `"in"`, and in
for `R` by appending `"dpi"`. For example dpi (dots per inch) for `R` by appending `"dpi"`. For example
```bash ```bash
zint -d "1234" --scalexdimdp=0.013in,300dpi zint -d "1234" --scalexdimdp=0.013in,300dpi
``` ```
Explicit metric units may also be given by appending `"mm"` and `"dpmm"` as Explicit metric units may also be given (for clarity) by appending `"mm"` and
appropriate, and may be mixed with U.S. units: `"dpmm"` as appropriate, and may be mixed with U.S. units:
```bash ```bash
zint -d "1234" --scalexdimdp=0.33mm,300dpi zint -d "1234" --scalexdimdp=0.33mm,300dpi
@@ -1212,7 +1218,7 @@ This will result in output of 37.29mm x 25.56mm (WxH) at 12 dpmm. The same
result can be achieved using the `--scalexdimdp` option with result can be achieved using the `--scalexdimdp` option with
```bash ```bash
zint -b EAN13 -d "501234567890" --compliantheight --scalexdimdp=0 zint -b EAN13 -d "501234567890" --compliantheight --scalexdimdp
``` ```
as 0.33mm is the default X-dimension for EAN, and 12 dpmm the default as 0.33mm is the default X-dimension for EAN, and 12 dpmm the default
@@ -3325,20 +3331,47 @@ Telepen Alpha was developed in 1972 by SB Electronic Systems Limited and can
encode ASCII text input, up to a maximum of 69 characters. Telepen includes a encode ASCII text input, up to a maximum of 69 characters. Telepen includes a
hidden modulo-127 check digit, added by Zint. hidden modulo-127 check digit, added by Zint.
![`zint -b TELEPEN --compliantheight -d "Z80"`](images/telepen.svg){.lin} ![`zint -b TELEPEN --compliantheight -d "Z8000"`](images/telepen.svg){.lin}
Full ASCII + Compressed Numeric Mode, which uses different AIM-defined
Start/Stop characters, may be enabled by setting `--vers=1` (API
`option_2 = 1`). In this mode control character `DLE` (ASCII 16, escape sequence
`\L`) indicates a switch from Full ASCII to Compressed Numeric, where each
symbol character encodes a digit pair:
![`zint -b TELEPEN --compliantheight -d
"Z\L8000" -esc --vers=1`](images/telepen_aim.svg){.lin}
However not all barcode readers recognise this mode so check before using.
#### 6.1.6.2 Telepen Numeric #### 6.1.6.2 Telepen Numeric
Telepen Numeric allows compression of numeric data into a Telepen symbol. Data Telepen Numeric allows compression of numeric data into a Telepen symbol. Data
can consist of pairs of numbers or pairs consisting of a numerical digit can consist of pairs of numbers or pairs consisting of a numerical digit
followed an X character. For example: 466333 and 466X33 are valid codes whereas followed an X character. For example: 466333 and 466X33 are valid codes whereas
46X333 is not (the digit pair `"X3"` is not valid). Up to 136 digits can be 46X333 is not (the digit pair `"X3"` is not valid). Up to 138 digits can be
encoded. Telepen Numeric includes a hidden modulo-127 check digit which is added encoded. Telepen Numeric includes a hidden modulo-127 check digit which is added
by Zint. by Zint.
![`zint -b TELEPEN_NUM --compliantheight -d ![`zint -b TELEPEN_NUM --compliantheight -d
"466X33"`](images/telepen_num.svg){.lin} "466X33"`](images/telepen_num.svg){.lin}
Trailing ASCII characters may also be encoded by prefixing them with a `DLE`
control character (ASCII 16, escape sequence `\L`) and appending them to the
numeric data:
![`zint -b TELEPEN_NUM --compliantheight -d
"12\LAB"` --esc](images/telepen_num_asc.svg){.lin}
This method allows odd numbers to be encoded without a leading zero:
![`zint -b TELEPEN_NUM --compliantheight -d
"123\L4"` --esc](images/telepen_num_odd.svg){.lin}
AIM-defined Start/Stop characters may be enabled by setting `--vers=1` (API
`option_2 = 1`). This allows barcode readers that recognise them to detect
Compressed Numeric data automatically.
### 6.1.7 Code 39 ### 6.1.7 Code 39
#### 6.1.7.1 Standard Code 39 (ISO 16388) #### 6.1.7.1 Standard Code 39 (ISO 16388)
@@ -5286,13 +5319,13 @@ international standards:
- AIM Uniform Symbology Specification Code One (1994) - AIM Uniform Symbology Specification Code One (1994)
- ISO/IEC 16022:2024 Information technology - Automatic identification and data - ISO/IEC 16022:2024 Information technology - Automatic identification and data
capture techniques - Data Matrix bar code symbology specification capture techniques - Data Matrix bar code symbology specification
- ISO/IEC 21471:2020 Information technology - Automatic identification and data - ISO/IEC 21471:2025 Information technology - Automatic identification and data
capture techniques - Extended rectangular data matrix (DMRE) bar code capture techniques - Extended rectangular data matrix (DMRE) bar code
symbology specification symbology specification
- AIM TSC1705001 (v 4.0 Draft 0.15) - Information technology - Automatic - AIM TSC1705001 (v 4.0 Draft 0.15) - Information technology - Automatic
identification and data capture techniques - Bar code symbology identification and data capture techniques - Bar code symbology
specification - DotCode (Revised 28th May 2019) specification - DotCode (Revised 28th May 2019)
- ISO/IEC 15420:2009 Information technology - Automatic identification and data - ISO/IEC 15420:2025 Information technology - Automatic identification and data
capture techniques - EAN/UPC bar code symbology specification capture techniques - EAN/UPC bar code symbology specification
- AIMD014 (v 1.63) - Information technology, Automatic identification and data - AIMD014 (v 1.63) - Information technology, Automatic identification and data
capture techniques - Bar code symbology specification - Grid Matrix capture techniques - Bar code symbology specification - Grid Matrix
@@ -5316,6 +5349,7 @@ international standards:
- ISO/IEC 23941:2022 Information technology - Automatic identification and data - ISO/IEC 23941:2022 Information technology - Automatic identification and data
capture techniques - Rectangular Micro QR Code (rMQR) bar code symbology capture techniques - Rectangular Micro QR Code (rMQR) bar code symbology
specification specification
- AIM Europe X-25 - Uniform Symbology Specification Telepen (1991)
- AIMD/TSC15032-43 (v 0.99c) - International Technical Specification - Ultracode - AIMD/TSC15032-43 (v 0.99c) - International Technical Specification - Ultracode
Symbology (Draft) (Released 4th Nov 2015) Symbology (Draft) (Released 4th Nov 2015)
@@ -5334,6 +5368,13 @@ company references in particular.
- GS1 General Specifications Release 26.0 (Jan 2026) - GS1 General Specifications Release 26.0 (Jan 2026)
- ANSI/HIBC 2.6-2016 - The Health Industry Bar Code (HIBC) Supplier Labeling - ANSI/HIBC 2.6-2016 - The Health Industry Bar Code (HIBC) Supplier Labeling
Standard Standard
- ANSI/HIBC 1.3-2010 - The Health Industry Bar Code (HIBC) Provider Applications
Standard
- ISO/IEC 15424:2025 Information technology - Automatic identification and data
capture techniques - Data carrier identifiers (including symbology
identifiers)
- ISO/IEC 15434:2019 Information technology — Automatic identification and data
capture techniques — Syntax for high-capacity ADC media
# Annex A. Character Encoding # Annex A. Character Encoding
+94 -44
View File
@@ -1,6 +1,6 @@
Zint Barcode Generator and Zint Barcode Studio User Manual Zint Barcode Generator and Zint Barcode Studio User Manual
Version 2.16.0.9 Version 2.16.0.9
April 2026 May 2026
******************************************************************************* *******************************************************************************
* For reference the following is a text-only version of the Zint manual, * * For reference the following is a text-only version of the Zint manual, *
@@ -716,12 +716,18 @@ sequences are shown in the table below.
\r 0x0D CR Carriage Return \r 0x0D CR Carriage Return
\L 0x10 DLE Data Link Escape
\e 0x1B ESC Escape \e 0x1B ESC Escape
\F 0x1C FS File Separator
\G 0x1D GS Group Separator \G 0x1D GS Group Separator
\R 0x1E RS Record Separator \R 0x1E RS Record Separator
\N 0x1F US Unit Separator
\( 0x28 ( Opening parenthesis (only with --gs1parens) \( 0x28 ( Opening parenthesis (only with --gs1parens)
\) 0x29 ) Closing parenthesis (only with --gs1parens) \) 0x29 ) Closing parenthesis (only with --gs1parens)
@@ -771,7 +777,7 @@ the sequence backslash caret (“\^”):
Table 3: Extra Escape Sequences Table 3: Extra Escape Sequences
Currently the only special character recognized is the Function Code 1 character Currently the only special character recognised is the Function Code 1 character
FNC1. If your data contains the sequence “\^” then it must be escaped using the FNC1. If your data contains the sequence “\^” then it must be escaped using the
extra escape sequence “\^^”, i.e. by doubling the caret. extra escape sequence “\^^”, i.e. by doubling the caret.
@@ -1278,18 +1284,18 @@ An alternative way to specify the scale, which takes the above details into
account, is to specify measurable units using the --scalexdimdp option, which account, is to specify measurable units using the --scalexdimdp option, which
has the format has the format
--scalexdimdp=X[,R] --scalexdimdp[=X[,R]]
where X is the X-dimension (in mm by default) and R is the resolution (in dpmm, where X is the X-dimension (in mm by default) and R is the resolution (in dpmm,
dots per mm, by default). R is optional, and defaults to 12 dpmm, and X may be dots per mm, by default). R is optional, and defaults to 12 dpmm, and X is
zero, in which case it uses a symbology-specific default. The units may be given optional or may be zero, in which case it uses a symbology-specific default. The
in inches for X by appending "in", and in dpi (dots per inch) for R by appending units may be given in inches for X by appending "in", and in dpi (dots per inch)
"dpi". For example for R by appending "dpi". For example
zint -d "1234" --scalexdimdp=0.013in,300dpi zint -d "1234" --scalexdimdp=0.013in,300dpi
Explicit metric units may also be given by appending "mm" and "dpmm" as Explicit metric units may also be given (for clarity) by appending "mm" and
appropriate, and may be mixed with U.S. units: "dpmm" as appropriate, and may be mixed with U.S. units:
zint -d "1234" --scalexdimdp=0.33mm,300dpi zint -d "1234" --scalexdimdp=0.33mm,300dpi
@@ -1306,7 +1312,7 @@ pixels, or 4 pixels rounding to the nearest pixel:
This will result in output of 37.29mm x 25.56mm (WxH) at 12 dpmm. The same This will result in output of 37.29mm x 25.56mm (WxH) at 12 dpmm. The same
result can be achieved using the --scalexdimdp option with result can be achieved using the --scalexdimdp option with
zint -b EAN13 -d "501234567890" --compliantheight --scalexdimdp=0 zint -b EAN13 -d "501234567890" --compliantheight --scalexdimdp
as 0.33mm is the default X-dimension for EAN, and 12 dpmm the default as 0.33mm is the default X-dimension for EAN, and 12 dpmm the default
resolution. resolution.
@@ -3190,19 +3196,43 @@ Telepen Alpha was developed in 1972 by SB Electronic Systems Limited and can
encode ASCII text input, up to a maximum of 69 characters. Telepen includes a encode ASCII text input, up to a maximum of 69 characters. Telepen includes a
hidden modulo-127 check digit, added by Zint. hidden modulo-127 check digit, added by Zint.
[zint -b TELEPEN --compliantheight -d "Z80"] [zint -b TELEPEN --compliantheight -d "Z8000"]
Full ASCII + Compressed Numeric Mode, which uses different AIM-defined
Start/Stop characters, may be enabled by setting --vers=1 (API option_2 = 1). In
this mode control character DLE (ASCII 16, escape sequence \L) indicates a
switch from Full ASCII to Compressed Numeric, where each symbol character
encodes a digit pair:
[zint -b TELEPEN --compliantheight -d "Z\L8000" -esc --vers=1]
However not all barcode readers recognise this mode so check before using.
6.1.6.2 Telepen Numeric 6.1.6.2 Telepen Numeric
Telepen Numeric allows compression of numeric data into a Telepen symbol. Data Telepen Numeric allows compression of numeric data into a Telepen symbol. Data
can consist of pairs of numbers or pairs consisting of a numerical digit can consist of pairs of numbers or pairs consisting of a numerical digit
followed an X character. For example: 466333 and 466X33 are valid codes whereas followed an X character. For example: 466333 and 466X33 are valid codes whereas
46X333 is not (the digit pair "X3" is not valid). Up to 136 digits can be 46X333 is not (the digit pair "X3" is not valid). Up to 138 digits can be
encoded. Telepen Numeric includes a hidden modulo-127 check digit which is added encoded. Telepen Numeric includes a hidden modulo-127 check digit which is added
by Zint. by Zint.
[zint -b TELEPEN_NUM --compliantheight -d "466X33"] [zint -b TELEPEN_NUM --compliantheight -d "466X33"]
Trailing ASCII characters may also be encoded by prefixing them with a DLE
control character (ASCII 16, escape sequence \L) and appending them to the
numeric data:
[zint -b TELEPEN_NUM --compliantheight -d "12\LAB" esc]
This method allows odd numbers to be encoded without a leading zero:
[zint -b TELEPEN_NUM --compliantheight -d "123\L4" esc]
AIM-defined Start/Stop characters may be enabled by setting --vers=1 (API
option_2 = 1). This allows barcode readers that recognise them to detect
Compressed Numeric data automatically.
6.1.7 Code 39 6.1.7 Code 39
6.1.7.1 Standard Code 39 (ISO 16388) 6.1.7.1 Standard Code 39 (ISO 16388)
@@ -5054,13 +5084,13 @@ international standards:
- AIM Uniform Symbology Specification Code One (1994) - AIM Uniform Symbology Specification Code One (1994)
- ISO/IEC 16022:2024 Information technology - Automatic identification and data - ISO/IEC 16022:2024 Information technology - Automatic identification and data
capture techniques - Data Matrix bar code symbology specification capture techniques - Data Matrix bar code symbology specification
- ISO/IEC 21471:2020 Information technology - Automatic identification and data - ISO/IEC 21471:2025 Information technology - Automatic identification and data
capture techniques - Extended rectangular data matrix (DMRE) bar code capture techniques - Extended rectangular data matrix (DMRE) bar code
symbology specification symbology specification
- AIM TSC1705001 (v 4.0 Draft 0.15) - Information technology - Automatic - AIM TSC1705001 (v 4.0 Draft 0.15) - Information technology - Automatic
identification and data capture techniques - Bar code symbology identification and data capture techniques - Bar code symbology
specification - DotCode (Revised 28th May 2019) specification - DotCode (Revised 28th May 2019)
- ISO/IEC 15420:2009 Information technology - Automatic identification and data - ISO/IEC 15420:2025 Information technology - Automatic identification and data
capture techniques - EAN/UPC bar code symbology specification capture techniques - EAN/UPC bar code symbology specification
- AIMD014 (v 1.63) - Information technology, Automatic identification and data - AIMD014 (v 1.63) - Information technology, Automatic identification and data
capture techniques - Bar code symbology specification - Grid Matrix (Released capture techniques - Bar code symbology specification - Grid Matrix (Released
@@ -5084,6 +5114,7 @@ international standards:
- ISO/IEC 23941:2022 Information technology - Automatic identification and data - ISO/IEC 23941:2022 Information technology - Automatic identification and data
capture techniques - Rectangular Micro QR Code (rMQR) bar code symbology capture techniques - Rectangular Micro QR Code (rMQR) bar code symbology
specification specification
- AIM Europe X-25 - Uniform Symbology Specification Telepen (1991)
- AIMD/TSC15032-43 (v 0.99c) - International Technical Specification - Ultracode - AIMD/TSC15032-43 (v 0.99c) - International Technical Specification - Ultracode
Symbology (Draft) (Released 4th Nov 2015) Symbology (Draft) (Released 4th Nov 2015)
@@ -5102,6 +5133,13 @@ company references in particular.
- GS1 General Specifications Release 26.0 (Jan 2026) - GS1 General Specifications Release 26.0 (Jan 2026)
- ANSI/HIBC 2.6-2016 - The Health Industry Bar Code (HIBC) Supplier Labeling - ANSI/HIBC 2.6-2016 - The Health Industry Bar Code (HIBC) Supplier Labeling
Standard Standard
- ANSI/HIBC 1.3-2010 - The Health Industry Bar Code (HIBC) Provider Applications
Standard
- ISO/IEC 15424:2025 Information technology - Automatic identification and data
capture techniques - Data carrier identifiers (including symbology
identifiers)
- ISO/IEC 15434:2019 Information technology — Automatic identification and data
capture techniques — Syntax for high-capacity ADC media
Annex A. Character Encoding Annex A. Character Encoding
@@ -5253,7 +5291,7 @@ configured barcode is updated when the "Generate" button is pressed.
Annex D. Man Page ZINT(1) Annex D. Man Page ZINT(1)
% ZINT(1) Version 2.16.0.9 % % April 2026 % ZINT(1) Version 2.16.0.9 % % May 2026
NAME NAME
@@ -5368,7 +5406,7 @@ OPTIONS
the barcodes specification, or if --height is not given, default to the the barcodes specification, or if --height is not given, default to the
height specified by the specification (if any). height specified by the specification (if any).
-d, --data=DATA -d DATA, --data=DATA
Specify the input DATA to encode. The --esc option may be used to enter Specify the input DATA to encode. The --esc option may be used to enter
non-printing characters using escape sequences. The DATA should be UTF-8, non-printing characters using escape sequences. The DATA should be UTF-8,
@@ -5379,15 +5417,15 @@ OPTIONS
Send output to stdout, which in most cases should be re-directed to a pipe Send output to stdout, which in most cases should be re-directed to a pipe
or a file. Use --filetype to specify output format. or a file. Use --filetype to specify output format.
--dmb256=INTEGER --dmb256[=INTEGER]
For Data Matrix symbols, encode the first INTEGER input characters in Base For Data Matrix symbols, encode the first INTEGER (optional, 0 if not given)
256 mode. 0 means all input. input characters in Base 256 mode. 0 means all input.
--dmc40=INTEGER --dmc40[=INTEGER]
For Data Matrix symbols, encode the first INTEGER input characters in C40 For Data Matrix symbols, encode the first INTEGER (optional, 0 if not given)
mode. 0 means all input. input characters in C40 mode. 0 means all input.
--dmiso144 --dmiso144
@@ -5445,9 +5483,12 @@ OPTIONS
\v (0x0B) VT Vertical Tab \v (0x0B) VT Vertical Tab
\f (0x0C) FF Form Feed \f (0x0C) FF Form Feed
\r (0x0D) CR Carriage Return \r (0x0D) CR Carriage Return
\L (0x10) DLE Data Link Escape
\e (0x1B) ESC Escape \e (0x1B) ESC Escape
\F (0x1C) FS File Separator
\G (0x1D) GS Group Separator \G (0x1D) GS Group Separator
\R (0x1E) RS Record Separator \R (0x1E) RS Record Separator
\N (0x1F) US Unit Separator
\( (0x28) ( Opening parenthesis (only with \( (0x28) ( Opening parenthesis (only with
--gs1parens) --gs1parens)
\) (0x29) ) Closing parenthesis (only with \) (0x29) ) Closing parenthesis (only with
@@ -5475,8 +5516,8 @@ OPTIONS
--fast --fast
Use faster if less optimal encodation or other shortcuts (affects Data Use faster if less optimal encodation or other shortcuts (affects Aztec
Matrix, MicroPDF417, PDF417, QRCODE & UPNQR only). Code, Data Matrix, MicroPDF417, PDF417, QR Code & UPNQR only).
--fg=COLOUR --fg=COLOUR
@@ -5550,7 +5591,7 @@ OPTIONS
Treat height as per-row. Affects Codablock F, Code 16K, Code 49, GS1 DataBar Treat height as per-row. Affects Codablock F, Code 16K, Code 49, GS1 DataBar
Expanded Stacked (DBAR_EXPSTK), MicroPDF417 and PDF417. Expanded Stacked (DBAR_EXPSTK), MicroPDF417 and PDF417.
-i, --input=FILE -i FILE, --input=FILE
Read the input data from FILE. Specify a single hyphen (-) for FILE to read Read the input data from FILE. Specify a single hyphen (-) for FILE to read
from stdin. from stdin.
@@ -5602,7 +5643,7 @@ OPTIONS
Remove the Human Readable Text (HRT). Remove the Human Readable Text (HRT).
-o, --output=FILE -o FILE, --output=FILE
Send the output to FILE. When not in batch mode, the default is “out.png” Send the output to FILE. When not in batch mode, the default is “out.png”
(or “out.gif” if zint built without PNG support). When in batch mode (or “out.gif” if zint built without PNG support). When in batch mode
@@ -5654,22 +5695,23 @@ OPTIONS
See also --scalexdimdp below. See also --scalexdimdp below.
--scalexdimdp=X[,R] --scalexdimdp[=X[,R]]
Scale the image according to X-dimension X and resolution R, where X is in Scale the image according to X-dimension X and resolution R, where X is in
mm and R is in dpmm (dots per mm). X and R may be floating-point. R is mm and R is in dpmm (dots per mm). X and R may be floating-point. R is
optional and defaults to 12 dpmm (approximately 300 dpi). X may be zero in optional and defaults to 12 dpmm (approximately 300 dpi). X is optional or
which case a symbology-specific default is used. may be zero in which case a symbology-specific default is used.
The scaling takes into account the output filetype, and deals with all the The scaling takes into account the output filetype, and deals with all the
details mentioned above. Units may be specified for X by appending “in” details mentioned above in --scale. Units may be specified for X by
(inch) or “mm”, and for R by appending “dpi” (dots per inch) or “dpmm” - appending “in” (inch) or “mm”, and for R by appending “dpi” (dots per inch)
e.g. --scalexdimdp=0.013in,300dpi. or “dpmm” - e.g. --scalexdimdp=0.013in,300dpi.
--scmvv=INTEGER --scmvv[=INTEGER]
For MaxiCode, prefix the Structured Carrier Message (SCM) with For MaxiCode, prefix the Structured Carrier Message (SCM) with
"[)>\R01\Gvv", where vv is a 2-digit INTEGER. "[)>\R01\Gvv", where vv is an optional 2-digit INTEGER. If INTEGER is
omitted it defaults to 96 (ASC MH10/SC 8).
--secure=INTEGER --secure=INTEGER
@@ -5711,7 +5753,8 @@ OPTIONS
number of symbols in the sequence, and ID, which is optional, is the number of symbols in the sequence, and ID, which is optional, is the
identifier that all symbols in the sequence share. Structured Append is identifier that all symbols in the sequence share. Structured Append is
supported by Aztec Code, Code One, Data Matrix, DotCode, Grid Matrix, supported by Aztec Code, Code One, Data Matrix, DotCode, Grid Matrix,
MaxiCode, MicroPDF417, PDF417, QR Code and Ultracode. MaxiCode, MicroPDF417, PDF417, QR Code and Ultracode. Code One, DotCode and
MaxiCode do not support an ID.
-t, --types -t, --types
@@ -5870,12 +5913,14 @@ OPTIONS
5, 6 (mod-11 NCR, mod-11 NCR + mod-10) 5, 6 (mod-11 NCR, mod-11 NCR + mod-10)
+10 (hide) +10 (hide)
For a few other symbologies, it specifies other characteristics: For some other symbologies, it specifies other characteristics:
Channel Code 3 to 8 (no. of channels) Channel Code 3 to 8 (no. of channels)
DAFT 50 to 900 (permille tracker ratio) DAFT 50 to 900 (permille tracker ratio)
DPD 1 (relabel) DPD 1 (relabel)
PZN 1 (PZN7 instead of default PZN8) PZN 1 (PZN7 instead of default PZN8)
Telepen 1 (use AIM-defined Start/Stop)
Telepen Numeric 1 (use AIM-defined Start/Stop)
Ultracode 2 (revision 2) Ultracode 2 (revision 2)
VIN 1 (add international prefix) VIN 1 (add international prefix)
@@ -5888,7 +5933,7 @@ OPTIONS
Set the height of vertical whitespace above and below the barcode, where Set the height of vertical whitespace above and below the barcode, where
INTEGER is in integral multiples of the X-dimension. INTEGER is in integral multiples of the X-dimension.
-w, --whitesp=INTEGER -w INTEGER, --whitesp=INTEGER
Set the width of horizontal whitespace either side of the barcode, where Set the width of horizontal whitespace either side of the barcode, where
INTEGER is in integral multiples of the X-dimension. INTEGER is in integral multiples of the X-dimension.
@@ -5987,13 +6032,18 @@ CONFORMING TO
Zint is designed to be compliant with a number of international standards, Zint is designed to be compliant with a number of international standards,
including: including:
ISO/IEC 24778:2024, ANSI/AIM BC12-1998, EN 798:1996, AIM ISS-X-24 (1995), ISO/IEC 24778:2024 (Aztec Code), SEMI T1-95 (1996) (BC412), ANSI/AIM BC12-1998
ISO/IEC 15417:2007, EN 12323:2005, ISO/IEC 16388:2023, ANSI/AIM BC6-2000, (Channel Code), EN 798:1996 (Codabar), AIM ISS-X-24 (1995) (Codablock F),
ANSI/AIM BC5-1995, AIM USS Code One (1994), ISO/IEC 16022:2024, ISO/IEC ISO/IEC 15417:2007 (Code 128), EN 12323:2005 (Code 16K), ISO/IEC 16388:2023
21471:2019, ISO/IEC 15420:2009, AIMD014 (v 1.63) (2008), ISO/IEC 24723:2010, (Code 39), ANSI/AIM BC6-2000 (Code 49), ANSI/AIM BC5-1995 (Code 93), AIM USS
ISO/IEC 24724:2011, ISO/IEC 20830:2021, ISO/IEC 16390:2007, ISO/IEC 16023:2000, Code One (1994), ISO/IEC 16022:2024 (Data Matrix), ISO/IEC 21471:2025 (DMRE),
ISO/IEC 24728:2006, ISO/IEC 15438:2015, ISO/IEC 18004:2024, ISO/IEC 23941:2022, AIM TSC1705001 (2019) (DotCode), ISO/IEC 15420:2025 (EAN/UPC), AIMD014 (v 1.63)
AIM ITS/04-023 (2022) (2008) (Grid Matrix), ISO/IEC 24723:2010 (GS1 Composite), ISO/IEC 24724:2011
(GS1 DataBar), ISO/IEC 20830:2021 (Han Xin Code), ISO/IEC 16390:2007
(Interleaved 2 of 5), ISO/IEC 16023:2000 (MaxiCode), ISO/IEC 24728:2006
(MicroPDF417), ISO/IEC 15438:2015 (PDF417), ISO/IEC 18004:2024 (QR Code),
ISO/IEC 23941:2022 (rMQR), AIM Europe X-25 (1991) (Telepen), AIMD/TSC15032-43
(2015) (Ultracode)
COPYRIGHT COPYRIGHT
+168 -142
View File
@@ -1,15 +1,15 @@
.\" Automatically generated by Pandoc 3.9.0.2 .\" Automatically generated by Pandoc 3.9.0.2
.\" .\"
.TH "ZINT" "1" "April 2026" "Version 2.16.0.9" .TH "ZINT" "1" "May 2026" "Version 2.16.0.9"
.SH NAME .SH NAME
\f[CR]zint\f[R] \- encode data as a barcode image \f[CR]zint\f[R] \- encode data as a barcode image
.SH SYNOPSIS .SH SYNOPSIS
.PP .PP
\f[CR]zint\f[R] [\f[CR]\-h\f[R] | \f[CR]\-\-help\f[R]] \f[B]\f[CB]zint\f[B]\f[R] [\f[CR]\-h\f[R] | \f[CR]\-\-help\f[R]]
.PD 0 .PD 0
.P .P
.PD .PD
\f[CR]zint\f[R] [\f[I]options\f[R]] \f[B]\f[CB]zint\f[B]\f[R] [\f[I]options\f[R]]
.SH DESCRIPTION .SH DESCRIPTION
zint takes input data from the command line or a file to encode in a zint takes input data from the command line or a file to encode in a
barcode which is then output to an image file. barcode which is then output to an image file.
@@ -28,29 +28,31 @@ Format (\f[CR]PNG\f[R]), Scalable Vector Graphic (\f[CR]SVG\f[R]), or
Tagged Image File Format (\f[CR]TIF\f[R]). Tagged Image File Format (\f[CR]TIF\f[R]).
.SH OPTIONS .SH OPTIONS
.TP .TP
\f[CR]\-h\f[R], \f[CR]\-\-help\f[R] \f[B]\f[CB]\-h\f[B]\f[R], \f[B]\f[CB]\-\-help\f[B]\f[R]
Print usage information summarizing command line options. Print usage information summarizing command line options.
.TP .TP
\f[CR]\-b TYPE\f[R], \f[CR]\-\-barcode=TYPE\f[R] \f[B]\f[CB]\-b\f[B]\f[R] \f[I]\f[CI]TYPE\f[I]\f[R], \f[B]\f[CB]\-\-barcode=\f[B]\f[R]\f[I]\f[CI]TYPE\f[I]\f[R]
Set the barcode symbology that will be used to encode the data. Set the barcode symbology that will be used to encode the data.
\f[I]TYPE\f[R] is the number or name of the barcode symbology. \f[I]\f[CI]TYPE\f[I]\f[R] is the number or name of the barcode
symbology.
If not given, the symbology defaults to 20 (Code 128). If not given, the symbology defaults to 20 (Code 128).
To see what types are available, use the \f[CR]\-t\f[R] | To see what types are available, use the \f[CR]\-t\f[R] |
\f[CR]\-\-types\f[R] option. \f[CR]\-\-types\f[R] option.
Type names are case\-insensitive, and non\-alphanumerics are ignored. Type names are case\-insensitive, and non\-alphanumerics are ignored.
.TP .TP
\f[CR]\-\-addongap=INTEGER\f[R] \f[B]\f[CB]\-\-addongap=\f[B]\f[R]\f[I]\f[CI]INTEGER\f[I]\f[R]
For EAN/UPC symbologies, set the gap between the main data and the For EAN/UPC symbologies, set the gap between the main data and the
add\-on. add\-on.
\f[I]INTEGER\f[R] is in integral multiples of the X\-dimension. \f[I]\f[CI]INTEGER\f[I]\f[R] is in integral multiples of the
X\-dimension.
The maximum gap that can be set is 12. The maximum gap that can be set is 12.
The minimum is 7, except for UPC\-A, when the minimum is 9. The minimum is 7, except for UPC\-A, when the minimum is 9.
.TP .TP
\f[CR]\-\-azfull\f[R] \f[B]\f[CB]\-\-azfull\f[B]\f[R]
For Aztec Code symbols, exclude Compact versions when considering For Aztec Code symbols, exclude Compact versions when considering
automatic sizes (i.e.\ consider Full versions only). automatic sizes (i.e.\ consider Full versions only).
.TP .TP
\f[CR]\-\-batch\f[R] \f[B]\f[CB]\-\-batch\f[B]\f[R]
Treat each line of an input file specified with \f[CR]\-i\f[R] | Treat each line of an input file specified with \f[CR]\-i\f[R] |
\f[CR]\-\-input\f[R] as a separate data set and produce a barcode image \f[CR]\-\-input\f[R] as a separate data set and produce a barcode image
for each one. for each one.
@@ -58,18 +60,18 @@ The barcode images are outputted by default to numbered filenames
starting with \(lq00001.png\(rq, \(lq00002.png\(rq etc., which can be starting with \(lq00001.png\(rq, \(lq00002.png\(rq etc., which can be
changed by using the \f[CR]\-o\f[R] | \f[CR]\-\-output\f[R] option. changed by using the \f[CR]\-o\f[R] | \f[CR]\-\-output\f[R] option.
.TP .TP
\f[CR]\-\-bg=COLOUR\f[R] \f[B]\f[CB]\-\-bg=\f[B]\f[R]\f[I]\f[CI]COLOUR\f[I]\f[R]
Specify a background (paper) colour where \f[I]COLOUR\f[R] is in Specify a background (paper) colour where \f[I]\f[CI]COLOUR\f[I]\f[R] is
hexadecimal \f[CR]RRGGBB\f[R] or \f[CR]RRGGBBAA\f[R] format or in in hexadecimal \f[CR]RRGGBB\f[R] or \f[CR]RRGGBBAA\f[R] format or in
decimal \f[CR]C,M,Y,K\f[R] percentages format. decimal \f[CR]C,M,Y,K\f[R] percentages format.
.TP .TP
\f[CR]\-\-binary\f[R] \f[B]\f[CB]\-\-binary\f[B]\f[R]
Treat input data as raw 8\-bit binary data instead of the default Treat input data as raw 8\-bit binary data instead of the default
UTF\-8. UTF\-8.
Automatic code page translation to an ECI page is disabled, and no Automatic code page translation to an ECI page is disabled, and no
validation of the data\(cqs character encoding takes place. validation of the data\(cqs character encoding takes place.
.TP .TP
\f[CR]\-\-bind\f[R] \f[B]\f[CB]\-\-bind\f[B]\f[R]
Add horizontal boundary bars (also known as bearer bars) to the symbol. Add horizontal boundary bars (also known as bearer bars) to the symbol.
The width of the boundary bars is specified by the \f[CR]\-\-border\f[R] The width of the boundary bars is specified by the \f[CR]\-\-border\f[R]
option. option.
@@ -78,105 +80,108 @@ symbols stacked with multiple \f[CR]\-d\f[R] | \f[CR]\-\-data\f[R]
inputs, in which case the width of the separator bars is specified with inputs, in which case the width of the separator bars is specified with
the \f[CR]\-\-separator\f[R] option. the \f[CR]\-\-separator\f[R] option.
.TP .TP
\f[CR]\-\-bindtop\f[R] \f[B]\f[CB]\-\-bindtop\f[B]\f[R]
Add a horizontal boundary bar to the top of the symbol. Add a horizontal boundary bar to the top of the symbol.
The width of the boundary bar is specified by the \f[CR]\-\-border\f[R] The width of the boundary bar is specified by the \f[CR]\-\-border\f[R]
option. option.
.TP .TP
\f[CR]\-\-bold\f[R] \f[B]\f[CB]\-\-bold\f[B]\f[R]
Use a bold font for the Human Readable Text (HRT). Use a bold font for the Human Readable Text (HRT).
.TP .TP
\f[CR]\-\-border=INTEGER\f[R] \f[B]\f[CB]\-\-border=\f[B]\f[R]\f[I]\f[CI]INTEGER\f[I]\f[R]
Set the width of boundary bars (\f[CR]\-\-bind\f[R] or Set the width of boundary bars (\f[CR]\-\-bind\f[R] or
\f[CR]\-\-bindtop\f[R]) or box borders (\f[CR]\-\-box\f[R]), where \f[CR]\-\-bindtop\f[R]) or box borders (\f[CR]\-\-box\f[R]), where
\f[I]INTEGER\f[R] is in integral multiples of the X\-dimension. \f[I]\f[CI]INTEGER\f[I]\f[R] is in integral multiples of the
X\-dimension.
The default is zero. The default is zero.
.TP .TP
\f[CR]\-\-box\f[R] \f[B]\f[CB]\-\-box\f[B]\f[R]
Add a box around the symbol. Add a box around the symbol.
The width of the borders is specified by the \f[CR]\-\-border\f[R] The width of the borders is specified by the \f[CR]\-\-border\f[R]
option. option.
.TP .TP
\f[CR]\-\-cmyk\f[R] \f[B]\f[CB]\-\-cmyk\f[B]\f[R]
Use the CMYK colour space when outputting to Encapsulated PostScript Use the CMYK colour space when outputting to Encapsulated PostScript
(EPS) or TIF files. (EPS) or TIF files.
.TP .TP
\f[CR]\-\-cols=INTEGER\f[R] \f[B]\f[CB]\-\-cols=\f[B]\f[R]\f[I]\f[CI]INTEGER\f[I]\f[R]
Set the number of data columns in the symbol to \f[I]INTEGER\f[R]. Set the number of data columns in the symbol to
\f[I]\f[CI]INTEGER\f[I]\f[R].
Affects Codablock F, DotCode, GS1 DataBar Expanded Stacked Affects Codablock F, DotCode, GS1 DataBar Expanded Stacked
(DBAR_EXPSTK), MicroPDF417 and PDF417 symbols. (DBAR_EXPSTK), MicroPDF417 and PDF417 symbols.
.TP .TP
\f[CR]\-\-compliantheight\f[R] \f[B]\f[CB]\-\-compliantheight\f[B]\f[R]
Warn if the height specified by the \f[CR]\-\-height\f[R] option is not Warn if the height specified by the \f[CR]\-\-height\f[R] option is not
compliant with the barcode\(cqs specification, or if compliant with the barcode\(cqs specification, or if
\f[CR]\-\-height\f[R] is not given, default to the height specified by \f[CR]\-\-height\f[R] is not given, default to the height specified by
the specification (if any). the specification (if any).
.TP .TP
\f[CR]\-d\f[R], \f[CR]\-\-data=DATA\f[R] \f[B]\f[CB]\-d\f[B]\f[R] \f[I]\f[CI]DATA\f[I]\f[R], \f[B]\f[CB]\-\-data=\f[B]\f[R]\f[I]\f[CI]DATA\f[I]\f[R]
Specify the input \f[I]DATA\f[R] to encode. Specify the input \f[I]\f[CI]DATA\f[I]\f[R] to encode.
The \f[CR]\-\-esc\f[R] option may be used to enter non\-printing The \f[CR]\-\-esc\f[R] option may be used to enter non\-printing
characters using escape sequences. characters using escape sequences.
The \f[I]DATA\f[R] should be UTF\-8, unless the \f[CR]\-\-binary\f[R] The \f[I]\f[CI]DATA\f[I]\f[R] should be UTF\-8, unless the
option is given, in which case it can be anything. \f[CR]\-\-binary\f[R] option is given, in which case it can be anything.
.TP .TP
\f[CR]\-\-direct\f[R] \f[B]\f[CB]\-\-direct\f[B]\f[R]
Send output to stdout, which in most cases should be re\-directed to a Send output to stdout, which in most cases should be re\-directed to a
pipe or a file. pipe or a file.
Use \f[CR]\-\-filetype\f[R] to specify output format. Use \f[CR]\-\-filetype\f[R] to specify output format.
.TP .TP
\f[CR]\-\-dmb256=INTEGER\f[R] \f[B]\f[CB]\-\-dmb256[=\f[B]\f[R]\f[I]\f[CI]INTEGER\f[I]\f[R]\f[CR]]\f[R]
For Data Matrix symbols, encode the first \f[I]INTEGER\f[R] input For Data Matrix symbols, encode the first \f[I]\f[CI]INTEGER\f[I]\f[R]
characters in Base 256 mode. (optional, 0 if not given) input characters in Base 256 mode.
0 means all input. 0 means all input.
.TP .TP
\f[CR]\-\-dmc40=INTEGER\f[R] \f[B]\f[CB]\-\-dmc40[=\f[B]\f[R]\f[I]\f[CI]INTEGER\f[I]\f[R]\f[CR]]\f[R]
For Data Matrix symbols, encode the first \f[I]INTEGER\f[R] input For Data Matrix symbols, encode the first \f[I]\f[CI]INTEGER\f[I]\f[R]
characters in C40 mode. (optional, 0 if not given) input characters in C40 mode.
0 means all input. 0 means all input.
.TP .TP
\f[CR]\-\-dmiso144\f[R] \f[B]\f[CB]\-\-dmiso144\f[B]\f[R]
For Data Matrix symbols, use the standard ISO/IEC codeword placement for For Data Matrix symbols, use the standard ISO/IEC codeword placement for
144 x 144 (\f[CR]\-\-vers=24\f[R]) sized symbols, instead of the default 144 x 144 (\f[CR]\-\-vers=24\f[R]) sized symbols, instead of the default
\(lqde facto\(rq placement (which rotates the placement of ECC \(lqde facto\(rq placement (which rotates the placement of ECC
codewords). codewords).
.TP .TP
\f[CR]\-\-dmre\f[R] \f[B]\f[CB]\-\-dmre\f[B]\f[R]
For Data Matrix symbols, allow Data Matrix Rectangular Extended (DMRE) For Data Matrix symbols, allow Data Matrix Rectangular Extended (DMRE)
sizes when considering automatic sizes. sizes when considering automatic sizes.
See also \f[CR]\-\-square\f[R]. See also \f[CR]\-\-square\f[R].
.TP .TP
\f[CR]\-\-dotsize=NUMBER\f[R] \f[B]\f[CB]\-\-dotsize=\f[B]\f[R]\f[I]\f[CI]NUMBER\f[I]\f[R]
Set the radius of the dots in dotty mode (\f[CR]\-\-dotty\f[R]). Set the radius of the dots in dotty mode (\f[CR]\-\-dotty\f[R]).
\f[I]NUMBER\f[R] is in X\-dimensions, and may be floating\-point. \f[I]\f[CI]NUMBER\f[I]\f[R] is in X\-dimensions, and may be
floating\-point.
The default is 0.8. The default is 0.8.
.TP .TP
\f[CR]\-\-dotty\f[R] \f[B]\f[CB]\-\-dotty\f[B]\f[R]
Use dots instead of squares for matrix symbols. Use dots instead of squares for matrix symbols.
DotCode is always in dotty mode. DotCode is always in dotty mode.
.TP .TP
\f[CR]\-\-dump\f[R] \f[B]\f[CB]\-\-dump\f[B]\f[R]
Dump a hexadecimal representation of the symbol\(cqs encodation to Dump a hexadecimal representation of the symbol\(cqs encodation to
stdout. stdout.
The same representation may be outputted to a file by using a The same representation may be outputted to a file by using a
\f[CR].txt\f[R] extension with \f[CR]\-o\f[R] | \f[CR]\-\-output\f[R] or \f[CR].txt\f[R] extension with \f[CR]\-o\f[R] | \f[CR]\-\-output\f[R] or
by specifying \f[CR]\-\-filetype=txt\f[R]. by specifying \f[CR]\-\-filetype=txt\f[R].
.TP .TP
\f[CR]\-e\f[R], \f[CR]\-\-ecinos\f[R] \f[B]\f[CB]\-e\f[B]\f[R], \f[B]\f[CB]\-\-ecinos\f[B]\f[R]
Display the table of ECIs (Extended Channel Interpretations). Display the table of ECIs (Extended Channel Interpretations).
.TP .TP
\f[CR]\-\-eci=INTEGER\f[R] \f[B]\f[CB]\-\-eci=\f[B]\f[R]\f[I]\f[CI]INTEGER\f[I]\f[R]
Set the ECI code for the input data to \f[I]INTEGER\f[R]. Set the ECI code for the input data to \f[I]\f[CI]INTEGER\f[I]\f[R].
See \f[CR]\-e\f[R] | \f[CR]\-\-ecinos\f[R] for a list of the ECIs See \f[CR]\-e\f[R] | \f[CR]\-\-ecinos\f[R] for a list of the ECIs
available. available.
ECIs are supported by Aztec Code, Code One, Data Matrix, DotCode, Grid ECIs are supported by Aztec Code, Code One, Data Matrix, DotCode, Grid
Matrix, Han Xin Code, MaxiCode, MicroPDF417, PDF417, QR Code, rMQR and Matrix, Han Xin Code, MaxiCode, MicroPDF417, PDF417, QR Code, rMQR and
Ultracode. Ultracode.
.TP .TP
\f[CR]\-\-embedfont\f[R] \f[B]\f[CB]\-\-embedfont\f[B]\f[R]
For vector output, embed the font in the file for portability. For vector output, embed the font in the file for portability.
Currently only available for SVG output. Currently only available for SVG output.
.TP .TP
\f[CR]\-\-esc\f[R] \f[B]\f[CB]\-\-esc\f[B]\f[R]
Process escape characters in the input data. Process escape characters in the input data.
The escape sequences are: The escape sequences are:
.RS .RS
@@ -191,9 +196,12 @@ The escape sequences are:
\(rsv (0x0B) VT Vertical Tab \(rsv (0x0B) VT Vertical Tab
\(rsf (0x0C) FF Form Feed \(rsf (0x0C) FF Form Feed
\(rsr (0x0D) CR Carriage Return \(rsr (0x0D) CR Carriage Return
\(rsL (0x10) DLE Data Link Escape
\(rse (0x1B) ESC Escape \(rse (0x1B) ESC Escape
\(rsF (0x1C) FS File Separator
\(rsG (0x1D) GS Group Separator \(rsG (0x1D) GS Group Separator
\(rsR (0x1E) RS Record Separator \(rsR (0x1E) RS Record Separator
\(rsN (0x1F) US Unit Separator
\(rs( (0x28) ( Opening parenthesis (only with \(rs( (0x28) ( Opening parenthesis (only with
\-\-gs1parens) \-\-gs1parens)
\(rs) (0x29) ) Closing parenthesis (only with \(rs) (0x29) ) Closing parenthesis (only with
@@ -212,7 +220,7 @@ The escape sequences are:
.EE .EE
.RE .RE
.TP .TP
\f[CR]\-\-extraesc\f[R] \f[B]\f[CB]\-\-extraesc\f[B]\f[R]
As well as processing the normal escape sequences above, process the As well as processing the normal escape sequences above, process the
special escape sequences beginning with \f[CR]\(rs\(ha\f[R]. special escape sequences beginning with \f[CR]\(rs\(ha\f[R].
For Aztec Code, Code 128 and Data Matrix, process the escape sequence For Aztec Code, Code 128 and Data Matrix, process the escape sequence
@@ -224,26 +232,26 @@ For Code 128 only, process the escape sequences \f[CR]\(rs\(haA\f[R],
that allow manual switching of Code Sets. that allow manual switching of Code Sets.
The sequence \f[CR]\(rs\(ha\(at\f[R] turns off manual switching. The sequence \f[CR]\(rs\(ha\(at\f[R] turns off manual switching.
.TP .TP
\f[CR]\-\-fast\f[R] \f[B]\f[CB]\-\-fast\f[B]\f[R]
Use faster if less optimal encodation or other shortcuts (affects Data Use faster if less optimal encodation or other shortcuts (affects Aztec
Matrix, MicroPDF417, PDF417, QRCODE & UPNQR only). Code, Data Matrix, MicroPDF417, PDF417, QR Code & UPNQR only).
.TP .TP
\f[CR]\-\-fg=COLOUR\f[R] \f[B]\f[CB]\-\-fg=\f[B]\f[R]\f[I]\f[CI]COLOUR\f[I]\f[R]
Specify a foreground (ink) colour where \f[I]COLOUR\f[R] is in Specify a foreground (ink) colour where \f[I]\f[CI]COLOUR\f[I]\f[R] is
hexadecimal \f[CR]RRGGBB\f[R] or \f[CR]RRGGBBAA\f[R] format or in in hexadecimal \f[CR]RRGGBB\f[R] or \f[CR]RRGGBBAA\f[R] format or in
decimal \f[CR]C,M,Y,K\f[R] percentages format. decimal \f[CR]C,M,Y,K\f[R] percentages format.
.TP .TP
\f[CR]\-\-filetype=TYPE\f[R] \f[B]\f[CB]\-\-filetype=\f[B]\f[R]\f[I]\f[CI]TYPE\f[I]\f[R]
Set the output file type to \f[I]TYPE\f[R], which is one of Set the output file type to \f[I]\f[CI]TYPE\f[I]\f[R], which is one of
\f[CR]BMP\f[R], \f[CR]EMF\f[R], \f[CR]EPS\f[R], \f[CR]GIF\f[R], \f[CR]BMP\f[R], \f[CR]EMF\f[R], \f[CR]EPS\f[R], \f[CR]GIF\f[R],
\f[CR]PCX\f[R], \f[CR]PNG\f[R], \f[CR]SVG\f[R], \f[CR]TIF\f[R], \f[CR]PCX\f[R], \f[CR]PNG\f[R], \f[CR]SVG\f[R], \f[CR]TIF\f[R],
\f[CR]TXT\f[R]. \f[CR]TXT\f[R].
.TP .TP
\f[CR]\-\-fullmultibyte\f[R] \f[B]\f[CB]\-\-fullmultibyte\f[B]\f[R]
Use the multibyte modes of Grid Matrix, Han Xin and QR Code for Use the multibyte modes of Grid Matrix, Han Xin and QR Code for
non\-ASCII data. non\-ASCII data.
.TP .TP
\f[CR]\-\-gs1\f[R] \f[B]\f[CB]\-\-gs1\f[B]\f[R]
Treat input as GS1 compatible data. Treat input as GS1 compatible data.
A number of input formats are available. A number of input formats are available.
Application Identifiers (AIs) may be placed in square brackets Application Identifiers (AIs) may be placed in square brackets
@@ -255,18 +263,18 @@ For matrix symbologies, GS1 Digital Link URIs (unverified) may be given.
Further input options are available with \f[CR]\-\-gs1parens\f[R] and Further input options are available with \f[CR]\-\-gs1parens\f[R] and
\f[CR]\-\-gs1raw\f[R]. \f[CR]\-\-gs1raw\f[R].
.TP .TP
\f[CR]\-\-gs1nocheck\f[R] \f[B]\f[CB]\-\-gs1nocheck\f[B]\f[R]
Treat input as GS1 compatible data (as \f[CR]\-\-gs1\f[R]) but do not Treat input as GS1 compatible data (as \f[CR]\-\-gs1\f[R]) but do not
check the validity of the data. check the validity of the data.
.TP .TP
\f[CR]\-\-gs1parens\f[R] \f[B]\f[CB]\-\-gs1parens\f[B]\f[R]
Treat input as GS1 compatible data (as \f[CR]\-\-gs1\f[R]) but process Treat input as GS1 compatible data (as \f[CR]\-\-gs1\f[R]) but process
parentheses \f[CR]\(dq()\(dq\f[R] as GS1 AI delimiters, rather than parentheses \f[CR]\(dq()\(dq\f[R] as GS1 AI delimiters, rather than
square brackets \f[CR]\(dq[]\(dq\f[R]. square brackets \f[CR]\(dq[]\(dq\f[R].
If the AI data contains opening parentheses, they must be backslashed If the AI data contains opening parentheses, they must be backslashed
(\f[CR]\(dq\(rs(\(dq\f[R]). (\f[CR]\(dq\(rs(\(dq\f[R]).
.TP .TP
\f[CR]\-\-gs1raw\f[R] \f[B]\f[CB]\-\-gs1raw\f[B]\f[R]
Treat input as GS1 compatible data (as \f[CR]\-\-gs1\f[R]), but process Treat input as GS1 compatible data (as \f[CR]\-\-gs1\f[R]), but process
literally, with any required \f[CR]FNC1\f[R]s represented by literally, with any required \f[CR]FNC1\f[R]s represented by
\f[CR]GS\f[R] (0x1D). \f[CR]GS\f[R] (0x1D).
@@ -276,55 +284,55 @@ AIs are not delimited by brackets (\f[CR]\(dq[]\(dq\f[R] or
except using \f[CR]GS\f[R]s instead of carets, and without any initial except using \f[CR]GS\f[R]s instead of carets, and without any initial
\f[CR]GS\f[R].) \f[CR]GS\f[R].)
.TP .TP
\f[CR]\-\-gs1strict\f[R] \f[B]\f[CB]\-\-gs1strict\f[B]\f[R]
Treat input as GS1 compatible data (as \f[CR]\-\-gs1\f[R]) and use the Treat input as GS1 compatible data (as \f[CR]\-\-gs1\f[R]) and use the
GS1 Syntax Engine (if available) to strictly verify the GS1 data, GS1 Syntax Engine (if available) to strictly verify the GS1 data,
including GS1 Digital Link URIs. including GS1 Digital Link URIs.
Ignored if \f[CR]\-\-gs1nocheck\f[R] also given. Ignored if \f[CR]\-\-gs1nocheck\f[R] also given.
.TP .TP
\f[CR]\-\-gssep\f[R] \f[B]\f[CB]\-\-gssep\f[B]\f[R]
For Data Matrix in GS1 mode, use \f[CR]GS\f[R] (0x1D) as the GS1 data For Data Matrix in GS1 mode, use \f[CR]GS\f[R] (0x1D) as the GS1 data
separator instead of \f[CR]FNC1\f[R]. separator instead of \f[CR]FNC1\f[R].
.TP .TP
\f[CR]\-\-guarddescent=NUMBER\f[R] \f[B]\f[CB]\-\-guarddescent=\f[B]\f[R]\f[I]\f[CI]NUMBER\f[I]\f[R]
For EAN/UPC symbols, set the height the guard bars descend below the For EAN/UPC symbols, set the height the guard bars descend below the
main bars, where \f[I]NUMBER\f[R] is in X\-dimensions. main bars, where \f[I]\f[CI]NUMBER\f[I]\f[R] is in X\-dimensions.
\f[I]NUMBER\f[R] may be floating\-point. \f[I]\f[CI]NUMBER\f[I]\f[R] may be floating\-point.
.TP .TP
\f[CR]\-\-guardwhitespace\f[R] \f[B]\f[CB]\-\-guardwhitespace\f[B]\f[R]
For EAN/UPC symbols, add quiet zone indicators \f[CR]\(dq<\(dq\f[R] For EAN/UPC symbols, add quiet zone indicators \f[CR]\(dq<\(dq\f[R]
and/or \f[CR]\(dq>\(dq\f[R] to HRT where applicable. and/or \f[CR]\(dq>\(dq\f[R] to HRT where applicable.
.TP .TP
\f[CR]\-\-height=NUMBER\f[R] \f[B]\f[CB]\-\-height=\f[B]\f[R]\f[I]\f[CI]NUMBER\f[I]\f[R]
Set the height of the symbol in X\-dimensions. Set the height of the symbol in X\-dimensions.
\f[I]NUMBER\f[R] may be floating\-point. \f[I]\f[CI]NUMBER\f[I]\f[R] may be floating\-point.
.TP .TP
\f[CR]\-\-heightperrow\f[R] \f[B]\f[CB]\-\-heightperrow\f[B]\f[R]
Treat height as per\-row. Treat height as per\-row.
Affects Codablock F, Code 16K, Code 49, GS1 DataBar Expanded Stacked Affects Codablock F, Code 16K, Code 49, GS1 DataBar Expanded Stacked
(DBAR_EXPSTK), MicroPDF417 and PDF417. (DBAR_EXPSTK), MicroPDF417 and PDF417.
.TP .TP
\f[CR]\-i\f[R], \f[CR]\-\-input=FILE\f[R] \f[B]\f[CB]\-i\f[B]\f[R] \f[I]\f[CI]FILE\f[I]\f[R], \f[B]\f[CB]\-\-input=\f[B]\f[R]\f[I]\f[CI]FILE\f[I]\f[R]
Read the input data from \f[I]FILE\f[R]. Read the input data from \f[I]\f[CI]FILE\f[I]\f[R].
Specify a single hyphen (\f[CR]\-\f[R]) for \f[I]FILE\f[R] to read from Specify a single hyphen (\f[CR]\-\f[R]) for \f[I]\f[CI]FILE\f[I]\f[R] to
stdin. read from stdin.
.TP .TP
\f[CR]\-\-init\f[R] \f[B]\f[CB]\-\-init\f[B]\f[R]
Create a Reader Initialisation (Programming) symbol. Create a Reader Initialisation (Programming) symbol.
.TP .TP
\f[CR]\-\-mask=INTEGER\f[R] \f[B]\f[CB]\-\-mask=\f[B]\f[R]\f[I]\f[CI]INTEGER\f[I]\f[R]
Set the masking pattern to use for DotCode, Han Xin or QR Code to Set the masking pattern to use for DotCode, Han Xin or QR Code to
\f[I]INTEGER\f[R], overriding the automatic selection. \f[I]\f[CI]INTEGER\f[I]\f[R], overriding the automatic selection.
.TP .TP
\f[CR]\-\-mirror\f[R] \f[B]\f[CB]\-\-mirror\f[B]\f[R]
Use the batch data to determine the filename in batch mode Use the batch data to determine the filename in batch mode
(\f[CR]\-\-batch\f[R]). (\f[CR]\-\-batch\f[R]).
The \f[CR]\-o\f[R] | \f[CR]\-\-output\f[R] option can be used to specify The \f[CR]\-o\f[R] | \f[CR]\-\-output\f[R] option can be used to specify
an output directory (any filename will be ignored). an output directory (any filename will be ignored).
.TP .TP
\f[CR]\-\-mode=INTEGER\f[R] \f[B]\f[CB]\-\-mode=\f[B]\f[R]\f[I]\f[CI]INTEGER\f[I]\f[R]
For MaxiCode and GS1 Composite symbols, set the encoding mode to For MaxiCode and GS1 Composite symbols, set the encoding mode to
\f[I]INTEGER\f[R]. \f[I]\f[CI]INTEGER\f[I]\f[R].
.RS .RS
.PP .PP
For MaxiCode (SCM is Structured Carrier Message, with 3 fields: For MaxiCode (SCM is Structured Carrier Message, with 3 fields:
@@ -349,17 +357,17 @@ i.e.\ \f[CR]EAN8_CC\f[R], \f[CR]EAN13_CC\f[R], \f[CR]GS1_128_CC\f[R],
.EE .EE
.RE .RE
.TP .TP
\f[CR]\-\-nobackground\f[R] \f[B]\f[CB]\-\-nobackground\f[B]\f[R]
Remove the background colour (EMF, EPS, GIF, PNG, SVG and TIF only). Remove the background colour (EMF, EPS, GIF, PNG, SVG and TIF only).
.TP .TP
\f[CR]\-\-noquietzones\f[R] \f[B]\f[CB]\-\-noquietzones\f[B]\f[R]
Disable any quiet zones for symbols that define them by default. Disable any quiet zones for symbols that define them by default.
.TP .TP
\f[CR]\-\-notext\f[R] \f[B]\f[CB]\-\-notext\f[B]\f[R]
Remove the Human Readable Text (HRT). Remove the Human Readable Text (HRT).
.TP .TP
\f[CR]\-o\f[R], \f[CR]\-\-output=FILE\f[R] \f[B]\f[CB]\-o\f[B]\f[R] \f[I]\f[CI]FILE\f[I]\f[R], \f[B]\f[CB]\-\-output=\f[B]\f[R]\f[I]\f[CI]FILE\f[I]\f[R]
Send the output to \f[I]FILE\f[R]. Send the output to \f[I]\f[CI]FILE\f[I]\f[R].
When not in batch mode, the default is \(lqout.png\(rq (or When not in batch mode, the default is \(lqout.png\(rq (or
\(lqout.gif\(rq if zint built without PNG support). \(lqout.gif\(rq if zint built without PNG support).
When in batch mode (\f[CR]\-\-batch\f[R]), special characters can be When in batch mode (\f[CR]\-\-batch\f[R]), special characters can be
@@ -374,33 +382,34 @@ Any other Insert literally
.EE .EE
.RE .RE
.TP .TP
\f[CR]\-\-primary=STRING\f[R] \f[B]\f[CB]\-\-primary=\f[B]\f[R]\f[I]STRING\f[R]
For MaxiCode, set the content of the primary message. For MaxiCode, set the content of the primary message.
For GS1 Composite symbols, set the content of the linear symbol. For GS1 Composite symbols, set the content of the linear symbol.
.TP .TP
\f[CR]\-\-quietzones\f[R] \f[B]\f[CB]\-\-quietzones\f[B]\f[R]
Add compliant quiet zones for symbols that specify them. Add compliant quiet zones for symbols that specify them.
This is in addition to any whitespace specified by \f[CR]\-w\f[R] | This is in addition to any whitespace specified by \f[CR]\-w\f[R] |
\f[CR]\-\-whitesp\f[R] or \f[CR]\-\-vwhitesp\f[R]. \f[CR]\-\-whitesp\f[R] or \f[CR]\-\-vwhitesp\f[R].
.TP .TP
\f[CR]\-r\f[R], \f[CR]\-\-reverse\f[R] \f[B]\f[CB]\-r\f[B]\f[R], \f[B]\f[CB]\-\-reverse\f[B]\f[R]
Reverse the foreground and background colours (white on black). Reverse the foreground and background colours (white on black).
Known as \(lqreflectance reversal\(rq or \(lqreversed reflectance\(rq. Known as \(lqreflectance reversal\(rq or \(lqreversed reflectance\(rq.
.TP .TP
\f[CR]\-\-rotate=INTEGER\f[R] \f[B]\f[CB]\-\-rotate=\f[B]\f[R]\f[I]\f[CI]INTEGER\f[I]\f[R]
Rotate the symbol by \f[I]INTEGER\f[R] degrees, where \f[I]INTEGER\f[R] Rotate the symbol by \f[I]\f[CI]INTEGER\f[I]\f[R] degrees, where
can be 0, 90, 270 or 360. \f[I]\f[CI]INTEGER\f[I]\f[R] can be 0, 90, 270 or 360.
.TP .TP
\f[CR]\-\-rows=INTEGER\f[R] \f[B]\f[CB]\-\-rows=\f[B]\f[R]\f[I]\f[CI]INTEGER\f[I]\f[R]
Set the number of rows for Codablock F or PDF417 to \f[I]INTEGER\f[R]. Set the number of rows for Codablock F or PDF417 to
\f[I]\f[CI]INTEGER\f[I]\f[R].
It will also set the minimum number of rows for Code 16K or Code 49, and It will also set the minimum number of rows for Code 16K or Code 49, and
the maximum number of rows for GS1 DataBar Expanded Stacked the maximum number of rows for GS1 DataBar Expanded Stacked
(DBAR_EXPSTK). (DBAR_EXPSTK).
.TP .TP
\f[CR]\-\-scale=NUMBER\f[R] \f[B]\f[CB]\-\-scale=\f[B]\f[R]\f[I]\f[CI]NUMBER\f[I]\f[R]
Adjust the size of the X\-dimension. Adjust the size of the X\-dimension.
\f[I]NUMBER\f[R] may be floating\-point, and is multiplied by 2 (except \f[I]\f[CI]NUMBER\f[I]\f[R] may be floating\-point, and is multiplied by
for MaxiCode) before being applied. 2 (except for MaxiCode) before being applied.
The default scale is 1. The default scale is 1.
.RS .RS
.PP .PP
@@ -415,30 +424,34 @@ less than 1.
See also \f[CR]\-\-scalexdimdp\f[R] below. See also \f[CR]\-\-scalexdimdp\f[R] below.
.RE .RE
.TP .TP
\f[CR]\-\-scalexdimdp=X[,R]\f[R] \f[B]\f[CB]\-\-scalexdimdp[=\f[B]\f[R]\f[I]\f[CI]X\f[I]\f[R]\f[CR][,\f[R]\f[I]\f[CI]R\f[I]\f[R]\f[CR]]]\f[R]
Scale the image according to X\-dimension \f[I]X\f[R] and resolution Scale the image according to X\-dimension \f[I]\f[CI]X\f[I]\f[R] and
\f[I]R\f[R], where \f[I]X\f[R] is in mm and \f[I]R\f[R] is in dpmm (dots resolution \f[I]\f[CI]R\f[I]\f[R], where \f[I]\f[CI]X\f[I]\f[R] is in mm
per mm). and \f[I]\f[CI]R\f[I]\f[R] is in dpmm (dots per mm).
\f[I]X\f[R] and \f[I]R\f[R] may be floating\-point. \f[I]\f[CI]X\f[I]\f[R] and \f[I]\f[CI]R\f[I]\f[R] may be
\f[I]R\f[R] is optional and defaults to 12 dpmm (approximately 300 dpi). floating\-point.
\f[I]X\f[R] may be zero in which case a symbology\-specific default is \f[I]\f[CI]R\f[I]\f[R] is optional and defaults to 12 dpmm
used. (approximately 300 dpi).
\f[I]\f[CI]X\f[I]\f[R] is optional or may be zero in which case a
symbology\-specific default is used.
.RS .RS
.PP .PP
The scaling takes into account the output filetype, and deals with all The scaling takes into account the output filetype, and deals with all
the details mentioned above. the details mentioned above in \f[CR]\-\-scale\f[R].
Units may be specified for \f[I]X\f[R] by appending \(lqin\(rq (inch) or Units may be specified for \f[I]X\f[R] by appending \(lqin\(rq (inch) or
\(lqmm\(rq, and for \f[I]R\f[R] by appending \(lqdpi\(rq (dots per inch) \(lqmm\(rq, and for \f[I]R\f[R] by appending \(lqdpi\(rq (dots per inch)
or \(lqdpmm\(rq \- e.g.\ \f[CR]\-\-scalexdimdp=0.013in,300dpi\f[R]. or \(lqdpmm\(rq \- e.g.\ \f[CR]\-\-scalexdimdp=0.013in,300dpi\f[R].
.RE .RE
.TP .TP
\f[CR]\-\-scmvv=INTEGER\f[R] \f[B]\f[CB]\-\-scmvv[=\f[B]\f[R]\f[I]\f[CI]INTEGER\f[I]\f[R]\f[CR]]\f[R]
For MaxiCode, prefix the Structured Carrier Message (SCM) with For MaxiCode, prefix the Structured Carrier Message (SCM) with
\f[CR]\(dq[)>\(rsR01\(rsGvv\(dq\f[R], where \f[CR]vv\f[R] is a 2\-digit \f[CR]\(dq[)>\(rsR01\(rsGvv\(dq\f[R], where \f[CR]vv\f[R] is an optional
\f[I]INTEGER\f[R]. 2\-digit \f[I]\f[CI]INTEGER\f[I]\f[R].
If \f[I]\f[CI]INTEGER\f[I]\f[R] is omitted it defaults to 96 (ASC
MH10/SC 8).
.TP .TP
\f[CR]\-\-secure=INTEGER\f[R] \f[B]\f[CB]\-\-secure=\f[B]\f[R]\f[I]\f[CI]INTEGER\f[I]\f[R]
Set the error correction level (ECC) to \f[I]INTEGER\f[R]. Set the error correction level (ECC) to \f[I]\f[CI]INTEGER\f[I]\f[R].
The meaning is specific to the following matrix symbols (all except The meaning is specific to the following matrix symbols (all except
PDF417 are approximate): PDF417 are approximate):
.RS .RS
@@ -455,52 +468,56 @@ Ultracode 1 to 6 (0%, 5%, 9%, 17%, 25%, 33%)
.EE .EE
.RE .RE
.TP .TP
\f[CR]\-\-segN=ECI,DATA\f[R] \f[B]\f[CB]\-\-segN=\f[B]\f[R]\f[I]\f[CI]ECI\f[I]\f[R]\f[CR],\f[R]\f[I]\f[CI]DATA\f[I]\f[R]
Set the \f[I]ECI\f[R] & \f[I]DATA\f[R] content for segment N, where N is Set the \f[I]\f[CI]ECI\f[I]\f[R] & \f[I]\f[CI]DATA\f[I]\f[R] content for
1 to 9. segment N, where N is 1 to 9.
\f[CR]\-d\f[R] | \f[CR]\-\-data\f[R] must still be given, and counts as \f[CR]\-d\f[R] | \f[CR]\-\-data\f[R] must still be given, and counts as
segment 0, its ECI given by \f[CR]\-\-eci\f[R]. segment 0, its ECI given by \f[CR]\-\-eci\f[R].
Segments must be consecutive. Segments must be consecutive.
.TP .TP
\f[CR]\-\-separator=INTEGER\f[R] \f[B]\f[CB]\-\-separator=\f[B]\f[R]\f[I]\f[CI]INTEGER\f[I]\f[R]
Set the height of row separator bars for stacked symbologies, where Set the height of row separator bars for stacked symbologies, where
\f[I]INTEGER\f[R] is in integral multiples of the X\-dimension. \f[I]\f[CI]INTEGER\f[I]\f[R] is in integral multiples of the
X\-dimension.
The default is zero. The default is zero.
.TP .TP
\f[CR]\-\-small\f[R] \f[B]\f[CB]\-\-small\f[B]\f[R]
Use a smaller font for Human Readable Text (HRT). Use a smaller font for Human Readable Text (HRT).
.TP .TP
\f[CR]\-\-square\f[R] \f[B]\f[CB]\-\-square\f[B]\f[R]
For Data Matrix symbols, exclude rectangular sizes when considering For Data Matrix symbols, exclude rectangular sizes when considering
automatic sizes. automatic sizes.
See also \f[CR]\-\-dmre\f[R]. See also \f[CR]\-\-dmre\f[R].
.TP .TP
\f[CR]\-\-structapp=I,C[,ID]\f[R] \f[B]\f[CB]\-\-structapp=\f[B]\f[R]\f[I]\f[CI]I\f[I]\f[R]\f[CR],\f[R]\f[I]\f[CI]C\f[I]\f[R]\f[CR][,\f[R]\f[I]\f[CI]ID\f[I]\f[R]\f[CR]]\f[R]
Set Structured Append info, where \f[I]I\f[R] is the 1\-based index, Set Structured Append info, where \f[I]\f[CI]I\f[I]\f[R] is the 1\-based
\f[I]C\f[R] is the total number of symbols in the sequence, and index, \f[I]\f[CI]C\f[I]\f[R] is the total number of symbols in the
\f[I]ID\f[R], which is optional, is the identifier that all symbols in sequence, and \f[I]\f[CI]ID\f[I]\f[R], which is optional, is the
the sequence share. identifier that all symbols in the sequence share.
Structured Append is supported by Aztec Code, Code One, Data Matrix, Structured Append is supported by Aztec Code, Code One, Data Matrix,
DotCode, Grid Matrix, MaxiCode, MicroPDF417, PDF417, QR Code and DotCode, Grid Matrix, MaxiCode, MicroPDF417, PDF417, QR Code and
Ultracode. Ultracode.
Code One, DotCode and MaxiCode do not support an
\f[I]\f[CI]ID\f[I]\f[R].
.TP .TP
\f[CR]\-t\f[R], \f[CR]\-\-types\f[R] \f[B]\f[CB]\-t\f[B]\f[R], \f[B]\f[CB]\-\-types\f[B]\f[R]
Display the table of barcode types (symbologies). Display the table of barcode types (symbologies).
The numbers or names can be used with \f[CR]\-b\f[R] | The numbers or names can be used with \f[CR]\-b\f[R] |
\f[CR]\-\-barcode\f[R]. \f[CR]\-\-barcode\f[R].
.TP .TP
\f[CR]\-\-textgap=NUMBER\f[R] \f[B]\f[CB]\-\-textgap=\f[B]\f[R]\f[I]\f[CI]NUMBER\f[I]\f[R]
Adjust the gap between the barcode and the Human Readable Text (HRT). Adjust the gap between the barcode and the Human Readable Text (HRT).
\f[I]NUMBER\f[R] is in X\-dimensions, and may be floating\-point. \f[I]\f[CI]NUMBER\f[I]\f[R] is in X\-dimensions, and may be
floating\-point.
Maximum is 10 and minimum is \-5. Maximum is 10 and minimum is \-5.
The default is 1. The default is 1.
.TP .TP
\f[CR]\-\-verbose\f[R] \f[B]\f[CB]\-\-verbose\f[B]\f[R]
Output debug information to stdout. Output debug information to stdout.
.TP .TP
\f[CR]\-\-vers=INTEGER\f[R] \f[B]\f[CB]\-\-vers=\f[B]\f[R]\f[I]\f[CI]INTEGER\f[I]\f[R]
Set the symbol version (size, check digits, other options) to Set the symbol version (size, check digits, other options) to
\f[I]INTEGER\f[R]. \f[I]\f[CI]INTEGER\f[I]\f[R].
The meaning is symbol\-specific. The meaning is symbol\-specific.
.RS .RS
.PP .PP
@@ -646,30 +663,34 @@ MSI Plessey 0 to 6 (none to various visible options)
+10 (hide) +10 (hide)
.EE .EE
.PP .PP
For a few other symbologies, it specifies other characteristics: For some other symbologies, it specifies other characteristics:
.IP .IP
.EX .EX
Channel Code 3 to 8 (no. of channels) Channel Code 3 to 8 (no. of channels)
DAFT 50 to 900 (permille tracker ratio) DAFT 50 to 900 (permille tracker ratio)
DPD 1 (relabel) DPD 1 (relabel)
PZN 1 (PZN7 instead of default PZN8) PZN 1 (PZN7 instead of default PZN8)
Telepen 1 (use AIM\-defined Start/Stop)
Telepen Numeric 1 (use AIM\-defined Start/Stop)
Ultracode 2 (revision 2) Ultracode 2 (revision 2)
VIN 1 (add international prefix) VIN 1 (add international prefix)
.EE .EE
.RE .RE
.TP .TP
\f[CR]\-v\f[R], \f[CR]\-\-version\f[R] \f[B]\f[CB]\-v\f[B]\f[R], \f[B]\f[CB]\-\-version\f[B]\f[R]
Display zint version. Display zint version.
.TP .TP
\f[CR]\-\-vwhitesp=INTEGER\f[R] \f[B]\f[CB]\-\-vwhitesp=\f[B]\f[R]\f[I]\f[CI]INTEGER\f[I]\f[R]
Set the height of vertical whitespace above and below the barcode, where Set the height of vertical whitespace above and below the barcode, where
\f[I]INTEGER\f[R] is in integral multiples of the X\-dimension. \f[I]\f[CI]INTEGER\f[I]\f[R] is in integral multiples of the
X\-dimension.
.TP .TP
\f[CR]\-w\f[R], \f[CR]\-\-whitesp=INTEGER\f[R] \f[B]\f[CB]\-w\f[B]\f[R] \f[I]\f[CI]INTEGER\f[I]\f[R], \f[B]\f[CB]\-\-whitesp=\f[B]\f[R]\f[I]\f[CI]INTEGER\f[I]\f[R]
Set the width of horizontal whitespace either side of the barcode, where Set the width of horizontal whitespace either side of the barcode, where
\f[I]INTEGER\f[R] is in integral multiples of the X\-dimension. \f[I]\f[CI]INTEGER\f[I]\f[R] is in integral multiples of the
X\-dimension.
.TP .TP
\f[CR]\-\-werror\f[R] \f[B]\f[CB]\-\-werror\f[B]\f[R]
Convert all warnings into errors. Convert all warnings into errors.
.SH EXIT STATUS .SH EXIT STATUS
.TP .TP
@@ -772,14 +793,19 @@ and at
Zint is designed to be compliant with a number of international Zint is designed to be compliant with a number of international
standards, including: standards, including:
.PP .PP
ISO/IEC 24778:2024, ANSI/AIM BC12\-1998, EN 798:1996, AIM ISS\-X\-24 ISO/IEC 24778:2024 (Aztec Code), SEMI T1\-95 (1996) (BC412), ANSI/AIM
(1995), ISO/IEC 15417:2007, EN 12323:2005, ISO/IEC 16388:2023, ANSI/AIM BC12\-1998 (Channel Code), EN 798:1996 (Codabar), AIM ISS\-X\-24 (1995)
BC6\-2000, ANSI/AIM BC5\-1995, AIM USS Code One (1994), ISO/IEC (Codablock F), ISO/IEC 15417:2007 (Code 128), EN 12323:2005 (Code 16K),
16022:2024, ISO/IEC 21471:2019, ISO/IEC 15420:2009, AIMD014 (v 1.63) ISO/IEC 16388:2023 (Code 39), ANSI/AIM BC6\-2000 (Code 49), ANSI/AIM
(2008), ISO/IEC 24723:2010, ISO/IEC 24724:2011, ISO/IEC 20830:2021, BC5\-1995 (Code 93), AIM USS Code One (1994), ISO/IEC 16022:2024 (Data
ISO/IEC 16390:2007, ISO/IEC 16023:2000, ISO/IEC 24728:2006, ISO/IEC Matrix), ISO/IEC 21471:2025 (DMRE), AIM TSC1705001 (2019) (DotCode),
15438:2015, ISO/IEC 18004:2024, ISO/IEC 23941:2022, AIM ITS/04\-023 ISO/IEC 15420:2025 (EAN/UPC), AIMD014 (v 1.63) (2008) (Grid Matrix),
(2022) ISO/IEC 24723:2010 (GS1 Composite), ISO/IEC 24724:2011 (GS1 DataBar),
ISO/IEC 20830:2021 (Han Xin Code), ISO/IEC 16390:2007 (Interleaved 2 of
5), ISO/IEC 16023:2000 (MaxiCode), ISO/IEC 24728:2006 (MicroPDF417),
ISO/IEC 15438:2015 (PDF417), ISO/IEC 18004:2024 (QR Code), ISO/IEC
23941:2022 (rMQR), AIM Europe X\-25 (1991) (Telepen), AIMD/TSC15032\-43
(2015) (Ultracode)
.SH COPYRIGHT .SH COPYRIGHT
Copyright © 2026 Robin Stuart. Copyright © 2026 Robin Stuart.
Released under GNU GPL 3.0 or later. Released under GNU GPL 3.0 or later.
+146 -136
View File
@@ -1,6 +1,6 @@
% ZINT(1) Version 2.16.0.9 % ZINT(1) Version 2.16.0.9
% %
% April 2026 % May 2026
[//]: # ( vim: set ts=4 sw=4 et : ) [//]: # ( vim: set ts=4 sw=4 et : )
@@ -10,8 +10,8 @@
# SYNOPSIS # SYNOPSIS
| `zint` [`-h` | `--help`] | **`zint`** [`-h` | `--help`]
| `zint` [*options*] | **`zint`** [*options*]
# DESCRIPTION # DESCRIPTION
@@ -28,138 +28,140 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
# OPTIONS # OPTIONS
`-h`, `--help` **`-h`**, **`--help`**
: Print usage information summarizing command line options. : Print usage information summarizing command line options.
`-b TYPE`, `--barcode=TYPE` **`-b`** *`TYPE`*, **`--barcode=`***`TYPE`*
: Set the barcode symbology that will be used to encode the data. *TYPE* is the number or name of the barcode : Set the barcode symbology that will be used to encode the data. *`TYPE`* is the number or name of the barcode
symbology. If not given, the symbology defaults to 20 (Code 128). To see what types are available, use the `-t` | symbology. If not given, the symbology defaults to 20 (Code 128). To see what types are available, use the `-t` |
`--types` option. Type names are case-insensitive, and non-alphanumerics are ignored. `--types` option. Type names are case-insensitive, and non-alphanumerics are ignored.
`--addongap=INTEGER` **`--addongap=`***`INTEGER`*
: For EAN/UPC symbologies, set the gap between the main data and the add-on. *INTEGER* is in integral multiples of : For EAN/UPC symbologies, set the gap between the main data and the add-on. *`INTEGER`* is in integral multiples of
the X-dimension. The maximum gap that can be set is 12. The minimum is 7, except for UPC-A, when the minimum is 9. the X-dimension. The maximum gap that can be set is 12. The minimum is 7, except for UPC-A, when the minimum is 9.
`--azfull` **`--azfull`**
: For Aztec Code symbols, exclude Compact versions when considering automatic sizes (i.e. consider Full versions : For Aztec Code symbols, exclude Compact versions when considering automatic sizes (i.e. consider Full versions
only). only).
`--batch` **`--batch`**
: Treat each line of an input file specified with `-i` | `--input` as a separate data set and produce a barcode : Treat each line of an input file specified with `-i` | `--input` as a separate data set and produce a barcode
image for each one. The barcode images are outputted by default to numbered filenames starting with "00001.png", image for each one. The barcode images are outputted by default to numbered filenames starting with "00001.png",
"00002.png" etc., which can be changed by using the `-o` | `--output` option. "00002.png" etc., which can be changed by using the `-o` | `--output` option.
`--bg=COLOUR` **`--bg=`***`COLOUR`*
: Specify a background (paper) colour where *COLOUR* is in hexadecimal `RRGGBB` or `RRGGBBAA` format or in decimal : Specify a background (paper) colour where *`COLOUR`* is in hexadecimal `RRGGBB` or `RRGGBBAA` format or in decimal
`C,M,Y,K` percentages format. `C,M,Y,K` percentages format.
`--binary` **`--binary`**
: Treat input data as raw 8-bit binary data instead of the default UTF-8. Automatic code page translation to an ECI : Treat input data as raw 8-bit binary data instead of the default UTF-8. Automatic code page translation to an ECI
page is disabled, and no validation of the data's character encoding takes place. page is disabled, and no validation of the data's character encoding takes place.
`--bind` **`--bind`**
: Add horizontal boundary bars (also known as bearer bars) to the symbol. The width of the boundary bars is : Add horizontal boundary bars (also known as bearer bars) to the symbol. The width of the boundary bars is
specified by the `--border` option. `--bind` can also be used to add row separator bars to symbols stacked with specified by the `--border` option. `--bind` can also be used to add row separator bars to symbols stacked with
multiple `-d` | `--data` inputs, in which case the width of the separator bars is specified with the `--separator` multiple `-d` | `--data` inputs, in which case the width of the separator bars is specified with the `--separator`
option. option.
`--bindtop` **`--bindtop`**
: Add a horizontal boundary bar to the top of the symbol. The width of the boundary bar is specified by the : Add a horizontal boundary bar to the top of the symbol. The width of the boundary bar is specified by the
`--border` option. `--border` option.
`--bold` **`--bold`**
: Use a bold font for the Human Readable Text (HRT). : Use a bold font for the Human Readable Text (HRT).
`--border=INTEGER` **`--border=`***`INTEGER`*
: Set the width of boundary bars (`--bind` or `--bindtop`) or box borders (`--box`), where *INTEGER* is in integral : Set the width of boundary bars (`--bind` or `--bindtop`) or box borders (`--box`), where *`INTEGER`* is in
multiples of the X-dimension. The default is zero. integral multiples of the X-dimension. The default is zero.
`--box` **`--box`**
: Add a box around the symbol. The width of the borders is specified by the `--border` option. : Add a box around the symbol. The width of the borders is specified by the `--border` option.
`--cmyk` **`--cmyk`**
: Use the CMYK colour space when outputting to Encapsulated PostScript (EPS) or TIF files. : Use the CMYK colour space when outputting to Encapsulated PostScript (EPS) or TIF files.
`--cols=INTEGER` **`--cols=`***`INTEGER`*
: Set the number of data columns in the symbol to *INTEGER*. Affects Codablock F, DotCode, GS1 DataBar Expanded : Set the number of data columns in the symbol to *`INTEGER`*. Affects Codablock F, DotCode, GS1 DataBar Expanded
Stacked (DBAR_EXPSTK), MicroPDF417 and PDF417 symbols. Stacked (DBAR_EXPSTK), MicroPDF417 and PDF417 symbols.
`--compliantheight` **`--compliantheight`**
: Warn if the height specified by the `--height` option is not compliant with the barcode's specification, or if : Warn if the height specified by the `--height` option is not compliant with the barcode's specification, or if
`--height` is not given, default to the height specified by the specification (if any). `--height` is not given, default to the height specified by the specification (if any).
`-d`, `--data=DATA` **`-d`** *`DATA`*, **`--data=`***`DATA`*
: Specify the input *DATA* to encode. The `--esc` option may be used to enter non-printing characters using escape : Specify the input *`DATA`* to encode. The `--esc` option may be used to enter non-printing characters using escape
sequences. The *DATA* should be UTF-8, unless the `--binary` option is given, in which case it can be anything. sequences. The *`DATA`* should be UTF-8, unless the `--binary` option is given, in which case it can be anything.
`--direct` **`--direct`**
: Send output to stdout, which in most cases should be re-directed to a pipe or a file. Use `--filetype` to specify : Send output to stdout, which in most cases should be re-directed to a pipe or a file. Use `--filetype` to specify
output format. output format.
`--dmb256=INTEGER` **`--dmb256[=`***`INTEGER`*`]`
: For Data Matrix symbols, encode the first *INTEGER* input characters in Base 256 mode. 0 means all input. : For Data Matrix symbols, encode the first *`INTEGER`* (optional, 0 if not given) input characters in Base 256
mode. 0 means all input.
`--dmc40=INTEGER` **`--dmc40[=`***`INTEGER`*`]`
: For Data Matrix symbols, encode the first *INTEGER* input characters in C40 mode. 0 means all input. : For Data Matrix symbols, encode the first *`INTEGER`* (optional, 0 if not given) input characters in C40 mode. 0
means all input.
`--dmiso144` **`--dmiso144`**
: For Data Matrix symbols, use the standard ISO/IEC codeword placement for 144 x 144 (`--vers=24`) sized symbols, : For Data Matrix symbols, use the standard ISO/IEC codeword placement for 144 x 144 (`--vers=24`) sized symbols,
instead of the default "de facto" placement (which rotates the placement of ECC codewords). instead of the default "de facto" placement (which rotates the placement of ECC codewords).
`--dmre` **`--dmre`**
: For Data Matrix symbols, allow Data Matrix Rectangular Extended (DMRE) sizes when considering automatic sizes. See : For Data Matrix symbols, allow Data Matrix Rectangular Extended (DMRE) sizes when considering automatic sizes. See
also `--square`. also `--square`.
`--dotsize=NUMBER` **`--dotsize=`***`NUMBER`*
: Set the radius of the dots in dotty mode (`--dotty`). *NUMBER* is in X-dimensions, and may be floating-point. The : Set the radius of the dots in dotty mode (`--dotty`). *`NUMBER`* is in X-dimensions, and may be floating-point.
default is 0.8. The default is 0.8.
`--dotty` **`--dotty`**
: Use dots instead of squares for matrix symbols. DotCode is always in dotty mode. : Use dots instead of squares for matrix symbols. DotCode is always in dotty mode.
`--dump` **`--dump`**
: Dump a hexadecimal representation of the symbol's encodation to stdout. The same representation may be outputted : Dump a hexadecimal representation of the symbol's encodation to stdout. The same representation may be outputted
to a file by using a `.txt` extension with `-o` | `--output` or by specifying `--filetype=txt`. to a file by using a `.txt` extension with `-o` | `--output` or by specifying `--filetype=txt`.
`-e`, `--ecinos` **`-e`**, **`--ecinos`**
: Display the table of ECIs (Extended Channel Interpretations). : Display the table of ECIs (Extended Channel Interpretations).
`--eci=INTEGER` **`--eci=`***`INTEGER`*
: Set the ECI code for the input data to *INTEGER*. See `-e` | `--ecinos` for a list of the ECIs available. ECIs are : Set the ECI code for the input data to *`INTEGER`*. See `-e` | `--ecinos` for a list of the ECIs available. ECIs
supported by Aztec Code, Code One, Data Matrix, DotCode, Grid Matrix, Han Xin Code, MaxiCode, MicroPDF417, PDF417, are supported by Aztec Code, Code One, Data Matrix, DotCode, Grid Matrix, Han Xin Code, MaxiCode, MicroPDF417,
QR Code, rMQR and Ultracode. PDF417, QR Code, rMQR and Ultracode.
`--embedfont` **`--embedfont`**
: For vector output, embed the font in the file for portability. Currently only available for SVG output. : For vector output, embed the font in the file for portability. Currently only available for SVG output.
`--esc` **`--esc`**
: Process escape characters in the input data. The escape sequences are: : Process escape characters in the input data. The escape sequences are:
@@ -172,9 +174,12 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
\v (0x0B) VT Vertical Tab \v (0x0B) VT Vertical Tab
\f (0x0C) FF Form Feed \f (0x0C) FF Form Feed
\r (0x0D) CR Carriage Return \r (0x0D) CR Carriage Return
\L (0x10) DLE Data Link Escape
\e (0x1B) ESC Escape \e (0x1B) ESC Escape
\F (0x1C) FS File Separator
\G (0x1D) GS Group Separator \G (0x1D) GS Group Separator
\R (0x1E) RS Record Separator \R (0x1E) RS Record Separator
\N (0x1F) US Unit Separator
\( (0x28) ( Opening parenthesis (only with \( (0x28) ( Opening parenthesis (only with
--gs1parens) --gs1parens)
\) (0x29) ) Closing parenthesis (only with \) (0x29) ) Closing parenthesis (only with
@@ -191,100 +196,101 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
\UNNNNNN (U+NNNNNN) Any 21-bit Unicode character \UNNNNNN (U+NNNNNN) Any 21-bit Unicode character
where NNNNNN is hexadecimal where NNNNNN is hexadecimal
`--extraesc` **`--extraesc`**
: As well as processing the normal escape sequences above, process the special escape sequences beginning with `\^`. : As well as processing the normal escape sequences above, process the special escape sequences beginning with `\^`.
For Aztec Code, Code 128 and Data Matrix, process the escape sequence `\^1` that inserts an `FNC1` character, and For Aztec Code, Code 128 and Data Matrix, process the escape sequence `\^1` that inserts an `FNC1` character, and
the escaping sequence `\^^` that encodes a literal `\^`. For Code 128 only, process the escape sequences `\^A`, the escaping sequence `\^^` that encodes a literal `\^`. For Code 128 only, process the escape sequences `\^A`,
`\^B`, `\^C` and `\^@` that allow manual switching of Code Sets. The sequence `\^@` turns off manual switching. `\^B`, `\^C` and `\^@` that allow manual switching of Code Sets. The sequence `\^@` turns off manual switching.
`--fast` **`--fast`**
: Use faster if less optimal encodation or other shortcuts (affects Data Matrix, MicroPDF417, PDF417, QRCODE & UPNQR : Use faster if less optimal encodation or other shortcuts (affects Aztec Code, Data Matrix, MicroPDF417, PDF417, QR
only). Code & UPNQR only).
`--fg=COLOUR` **`--fg=`***`COLOUR`*
: Specify a foreground (ink) colour where *COLOUR* is in hexadecimal `RRGGBB` or `RRGGBBAA` format or in decimal : Specify a foreground (ink) colour where *`COLOUR`* is in hexadecimal `RRGGBB` or `RRGGBBAA` format or in decimal
`C,M,Y,K` percentages format. `C,M,Y,K` percentages format.
`--filetype=TYPE` **`--filetype=`***`TYPE`*
: Set the output file type to *TYPE*, which is one of `BMP`, `EMF`, `EPS`, `GIF`, `PCX`, `PNG`, `SVG`, `TIF`, `TXT`. : Set the output file type to *`TYPE`*, which is one of `BMP`, `EMF`, `EPS`, `GIF`, `PCX`, `PNG`, `SVG`, `TIF`,
`TXT`.
`--fullmultibyte` **`--fullmultibyte`**
: Use the multibyte modes of Grid Matrix, Han Xin and QR Code for non-ASCII data. : Use the multibyte modes of Grid Matrix, Han Xin and QR Code for non-ASCII data.
`--gs1` **`--gs1`**
: Treat input as GS1 compatible data. A number of input formats are available. Application Identifiers (AIs) may be : Treat input as GS1 compatible data. A number of input formats are available. Application Identifiers (AIs) may be
placed in square brackets `"[]"`. Alternatively the GS1 Syntax Engine "Unbracketed AI" format may be used, which placed in square brackets `"[]"`. Alternatively the GS1 Syntax Engine "Unbracketed AI" format may be used, which
starts with a caret (`^`) and uses carets to indicate required `FNC1`s. For matrix symbologies, GS1 Digital Link starts with a caret (`^`) and uses carets to indicate required `FNC1`s. For matrix symbologies, GS1 Digital Link
URIs (unverified) may be given. Further input options are available with `--gs1parens` and `--gs1raw`. URIs (unverified) may be given. Further input options are available with `--gs1parens` and `--gs1raw`.
`--gs1nocheck` **`--gs1nocheck`**
: Treat input as GS1 compatible data (as `--gs1`) but do not check the validity of the data. : Treat input as GS1 compatible data (as `--gs1`) but do not check the validity of the data.
`--gs1parens` **`--gs1parens`**
: Treat input as GS1 compatible data (as `--gs1`) but process parentheses `"()"` as GS1 AI delimiters, rather than : Treat input as GS1 compatible data (as `--gs1`) but process parentheses `"()"` as GS1 AI delimiters, rather than
square brackets `"[]"`. If the AI data contains opening parentheses, they must be backslashed (`"\("`). square brackets `"[]"`. If the AI data contains opening parentheses, they must be backslashed (`"\("`).
`--gs1raw` **`--gs1raw`**
: Treat input as GS1 compatible data (as `--gs1`), but process literally, with any required `FNC1`s represented by : Treat input as GS1 compatible data (as `--gs1`), but process literally, with any required `FNC1`s represented by
`GS` (0x1D). AIs are not delimited by brackets (`"[]"` or `"()"`). (Similar to the GS1 Syntax Engine "Unbracketed `GS` (0x1D). AIs are not delimited by brackets (`"[]"` or `"()"`). (Similar to the GS1 Syntax Engine "Unbracketed
AI" entry mode except using `GS`s instead of carets, and without any initial `GS`.) AI" entry mode except using `GS`s instead of carets, and without any initial `GS`.)
`--gs1strict` **`--gs1strict`**
: Treat input as GS1 compatible data (as `--gs1`) and use the GS1 Syntax Engine (if available) to strictly verify : Treat input as GS1 compatible data (as `--gs1`) and use the GS1 Syntax Engine (if available) to strictly verify
the GS1 data, including GS1 Digital Link URIs. Ignored if `--gs1nocheck` also given. the GS1 data, including GS1 Digital Link URIs. Ignored if `--gs1nocheck` also given.
`--gssep` **`--gssep`**
: For Data Matrix in GS1 mode, use `GS` (0x1D) as the GS1 data separator instead of `FNC1`. : For Data Matrix in GS1 mode, use `GS` (0x1D) as the GS1 data separator instead of `FNC1`.
`--guarddescent=NUMBER` **`--guarddescent=`***`NUMBER`*
: For EAN/UPC symbols, set the height the guard bars descend below the main bars, where *NUMBER* is in X-dimensions. : For EAN/UPC symbols, set the height the guard bars descend below the main bars, where *`NUMBER`* is in
*NUMBER* may be floating-point. X-dimensions. *`NUMBER`* may be floating-point.
`--guardwhitespace` **`--guardwhitespace`**
: For EAN/UPC symbols, add quiet zone indicators `"<"` and/or `">"` to HRT where applicable. : For EAN/UPC symbols, add quiet zone indicators `"<"` and/or `">"` to HRT where applicable.
`--height=NUMBER` **`--height=`***`NUMBER`*
: Set the height of the symbol in X-dimensions. *NUMBER* may be floating-point. : Set the height of the symbol in X-dimensions. *`NUMBER`* may be floating-point.
`--heightperrow` **`--heightperrow`**
: Treat height as per-row. Affects Codablock F, Code 16K, Code 49, GS1 DataBar Expanded Stacked (DBAR_EXPSTK), : Treat height as per-row. Affects Codablock F, Code 16K, Code 49, GS1 DataBar Expanded Stacked (DBAR_EXPSTK),
MicroPDF417 and PDF417. MicroPDF417 and PDF417.
`-i`, `--input=FILE` **`-i`** *`FILE`*, **`--input=`***`FILE`*
: Read the input data from *FILE*. Specify a single hyphen (`-`) for *FILE* to read from stdin. : Read the input data from *`FILE`*. Specify a single hyphen (`-`) for *`FILE`* to read from stdin.
`--init` **`--init`**
: Create a Reader Initialisation (Programming) symbol. : Create a Reader Initialisation (Programming) symbol.
`--mask=INTEGER` **`--mask=`***`INTEGER`*
: Set the masking pattern to use for DotCode, Han Xin or QR Code to *INTEGER*, overriding the automatic selection. : Set the masking pattern to use for DotCode, Han Xin or QR Code to *`INTEGER`*, overriding the automatic selection.
`--mirror` **`--mirror`**
: Use the batch data to determine the filename in batch mode (`--batch`). The `-o` | `--output` option can be used : Use the batch data to determine the filename in batch mode (`--batch`). The `-o` | `--output` option can be used
to specify an output directory (any filename will be ignored). to specify an output directory (any filename will be ignored).
`--mode=INTEGER` **`--mode=`***`INTEGER`*
: For MaxiCode and GS1 Composite symbols, set the encoding mode to *INTEGER*. : For MaxiCode and GS1 Composite symbols, set the encoding mode to *`INTEGER`*.
For MaxiCode (SCM is Structured Carrier Message, with 3 fields: postcode, 3-digit ISO 3166-1 country code, 3-digit For MaxiCode (SCM is Structured Carrier Message, with 3 fields: postcode, 3-digit ISO 3166-1 country code, 3-digit
service code): service code):
@@ -301,21 +307,21 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
2 CC-B 2 CC-B
3 CC-C (GS1_128_CC only) 3 CC-C (GS1_128_CC only)
`--nobackground` **`--nobackground`**
: Remove the background colour (EMF, EPS, GIF, PNG, SVG and TIF only). : Remove the background colour (EMF, EPS, GIF, PNG, SVG and TIF only).
`--noquietzones` **`--noquietzones`**
: Disable any quiet zones for symbols that define them by default. : Disable any quiet zones for symbols that define them by default.
`--notext` **`--notext`**
: Remove the Human Readable Text (HRT). : Remove the Human Readable Text (HRT).
`-o`, `--output=FILE` **`-o`** *`FILE`*, **`--output=`***`FILE`*
: Send the output to *FILE*. When not in batch mode, the default is "out.png" (or "out.gif" if zint built without : Send the output to *`FILE`*. When not in batch mode, the default is "out.png" (or "out.gif" if zint built without
PNG support). When in batch mode (`--batch`), special characters can be used to format the output filenames: PNG support). When in batch mode (`--batch`), special characters can be used to format the output filenames:
~ Insert a number or 0 ~ Insert a number or 0
@@ -323,33 +329,33 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
@ Insert a number or * (+ on Windows) @ Insert a number or * (+ on Windows)
Any other Insert literally Any other Insert literally
`--primary=STRING` **`--primary=`***STRING*
: For MaxiCode, set the content of the primary message. For GS1 Composite symbols, set the content of the linear : For MaxiCode, set the content of the primary message. For GS1 Composite symbols, set the content of the linear
symbol. symbol.
`--quietzones` **`--quietzones`**
: Add compliant quiet zones for symbols that specify them. This is in addition to any whitespace specified by `-w` | : Add compliant quiet zones for symbols that specify them. This is in addition to any whitespace specified by `-w` |
`--whitesp` or `--vwhitesp`. `--whitesp` or `--vwhitesp`.
`-r`, `--reverse` **`-r`**, **`--reverse`**
: Reverse the foreground and background colours (white on black). Known as "reflectance reversal" or "reversed : Reverse the foreground and background colours (white on black). Known as "reflectance reversal" or "reversed
reflectance". reflectance".
`--rotate=INTEGER` **`--rotate=`***`INTEGER`*
: Rotate the symbol by *INTEGER* degrees, where *INTEGER* can be 0, 90, 270 or 360. : Rotate the symbol by *`INTEGER`* degrees, where *`INTEGER`* can be 0, 90, 270 or 360.
`--rows=INTEGER` **`--rows=`***`INTEGER`*
: Set the number of rows for Codablock F or PDF417 to *INTEGER*. It will also set the minimum number of rows for : Set the number of rows for Codablock F or PDF417 to *`INTEGER`*. It will also set the minimum number of rows for
Code 16K or Code 49, and the maximum number of rows for GS1 DataBar Expanded Stacked (DBAR_EXPSTK). Code 16K or Code 49, and the maximum number of rows for GS1 DataBar Expanded Stacked (DBAR_EXPSTK).
`--scale=NUMBER` **`--scale=`***`NUMBER`*
: Adjust the size of the X-dimension. *NUMBER* may be floating-point, and is multiplied by 2 (except for MaxiCode) : Adjust the size of the X-dimension. *`NUMBER`* may be floating-point, and is multiplied by 2 (except for MaxiCode)
before being applied. The default scale is 1. before being applied. The default scale is 1.
For MaxiCode, the scale is multiplied by 10 for raster output, by 40 for EMF output, and by 2 otherwise. For MaxiCode, the scale is multiplied by 10 for raster output, by 40 for EMF output, and by 2 otherwise.
@@ -359,23 +365,24 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
See also `--scalexdimdp` below. See also `--scalexdimdp` below.
`--scalexdimdp=X[,R]` **`--scalexdimdp[=`***`X`*`[,`*`R`*`]]`
: Scale the image according to X-dimension *X* and resolution *R*, where *X* is in mm and *R* is in dpmm (dots per : Scale the image according to X-dimension *`X`* and resolution *`R`*, where *`X`* is in mm and *`R`* is in dpmm
mm). *X* and *R* may be floating-point. *R* is optional and defaults to 12 dpmm (approximately 300 dpi). *X* may (dots per mm). *`X`* and *`R`* may be floating-point. *`R`* is optional and defaults to 12 dpmm (approximately 300
be zero in which case a symbology-specific default is used. dpi). *`X`* is optional or may be zero in which case a symbology-specific default is used.
The scaling takes into account the output filetype, and deals with all the details mentioned above. Units may be The scaling takes into account the output filetype, and deals with all the details mentioned above in `--scale`.
specified for *X* by appending "in" (inch) or "mm", and for *R* by appending "dpi" (dots per inch) or "dpmm" - Units may be specified for *X* by appending "in" (inch) or "mm", and for *R* by appending "dpi" (dots per inch) or
e.g. `--scalexdimdp=0.013in,300dpi`. "dpmm" - e.g. `--scalexdimdp=0.013in,300dpi`.
`--scmvv=INTEGER` **`--scmvv[=`***`INTEGER`*`]`
: For MaxiCode, prefix the Structured Carrier Message (SCM) with `"[)>\R01\Gvv"`, where `vv` is a 2-digit *INTEGER*. : For MaxiCode, prefix the Structured Carrier Message (SCM) with `"[)>\R01\Gvv"`, where `vv` is an optional 2-digit
*`INTEGER`*. If *`INTEGER`* is omitted it defaults to 96 (ASC MH10/SC 8).
`--secure=INTEGER` **`--secure=`***`INTEGER`*
: Set the error correction level (ECC) to *INTEGER*. The meaning is specific to the following matrix symbols (all : Set the error correction level (ECC) to *`INTEGER`*. The meaning is specific to the following matrix symbols (all
except PDF417 are approximate): except PDF417 are approximate):
Aztec Code 1 to 4 (10%, 23%, 36%, 50%) Aztec Code 1 to 4 (10%, 23%, 36%, 50%)
@@ -387,47 +394,47 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
rMQR 2 or 4 (15% or 30%) (M or H) rMQR 2 or 4 (15% or 30%) (M or H)
Ultracode 1 to 6 (0%, 5%, 9%, 17%, 25%, 33%) Ultracode 1 to 6 (0%, 5%, 9%, 17%, 25%, 33%)
`--segN=ECI,DATA` **`--segN=`***`ECI`*`,`*`DATA`*
: Set the *ECI* & *DATA* content for segment N, where N is 1 to 9. `-d` | `--data` must still be given, and counts : Set the *`ECI`* & *`DATA`* content for segment N, where N is 1 to 9. `-d` | `--data` must still be given, and
as segment 0, its ECI given by `--eci`. Segments must be consecutive. counts as segment 0, its ECI given by `--eci`. Segments must be consecutive.
`--separator=INTEGER` **`--separator=`***`INTEGER`*
: Set the height of row separator bars for stacked symbologies, where *INTEGER* is in integral multiples of the : Set the height of row separator bars for stacked symbologies, where *`INTEGER`* is in integral multiples of the
X-dimension. The default is zero. X-dimension. The default is zero.
`--small` **`--small`**
: Use a smaller font for Human Readable Text (HRT). : Use a smaller font for Human Readable Text (HRT).
`--square` **`--square`**
: For Data Matrix symbols, exclude rectangular sizes when considering automatic sizes. See also `--dmre`. : For Data Matrix symbols, exclude rectangular sizes when considering automatic sizes. See also `--dmre`.
`--structapp=I,C[,ID]` **`--structapp=`***`I`*`,`*`C`*`[,`*`ID`*`]`
: Set Structured Append info, where *I* is the 1-based index, *C* is the total number of symbols in the sequence, : Set Structured Append info, where *`I`* is the 1-based index, *`C`* is the total number of symbols in the
and *ID*, which is optional, is the identifier that all symbols in the sequence share. Structured Append is sequence, and *`ID`*, which is optional, is the identifier that all symbols in the sequence share. Structured
supported by Aztec Code, Code One, Data Matrix, DotCode, Grid Matrix, MaxiCode, MicroPDF417, PDF417, QR Code and Append is supported by Aztec Code, Code One, Data Matrix, DotCode, Grid Matrix, MaxiCode, MicroPDF417, PDF417, QR
Ultracode. Code and Ultracode. Code One, DotCode and MaxiCode do not support an *`ID`*.
`-t`, `--types` **`-t`**, **`--types`**
: Display the table of barcode types (symbologies). The numbers or names can be used with `-b` | `--barcode`. : Display the table of barcode types (symbologies). The numbers or names can be used with `-b` | `--barcode`.
`--textgap=NUMBER` **`--textgap=`***`NUMBER`*
: Adjust the gap between the barcode and the Human Readable Text (HRT). *NUMBER* is in X-dimensions, and may be : Adjust the gap between the barcode and the Human Readable Text (HRT). *`NUMBER`* is in X-dimensions, and may be
floating-point. Maximum is 10 and minimum is -5. The default is 1. floating-point. Maximum is 10 and minimum is -5. The default is 1.
`--verbose` **`--verbose`**
: Output debug information to stdout. : Output debug information to stdout.
`--vers=INTEGER` **`--vers=`***`INTEGER`*
: Set the symbol version (size, check digits, other options) to *INTEGER*. The meaning is symbol-specific. : Set the symbol version (size, check digits, other options) to *`INTEGER`*. The meaning is symbol-specific.
For most matrix symbols, it specifies size: For most matrix symbols, it specifies size:
@@ -566,30 +573,32 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
5, 6 (mod-11 NCR, mod-11 NCR + mod-10) 5, 6 (mod-11 NCR, mod-11 NCR + mod-10)
+10 (hide) +10 (hide)
For a few other symbologies, it specifies other characteristics: For some other symbologies, it specifies other characteristics:
Channel Code 3 to 8 (no. of channels) Channel Code 3 to 8 (no. of channels)
DAFT 50 to 900 (permille tracker ratio) DAFT 50 to 900 (permille tracker ratio)
DPD 1 (relabel) DPD 1 (relabel)
PZN 1 (PZN7 instead of default PZN8) PZN 1 (PZN7 instead of default PZN8)
Telepen 1 (use AIM-defined Start/Stop)
Telepen Numeric 1 (use AIM-defined Start/Stop)
Ultracode 2 (revision 2) Ultracode 2 (revision 2)
VIN 1 (add international prefix) VIN 1 (add international prefix)
`-v`, `--version` **`-v`**, **`--version`**
: Display zint version. : Display zint version.
`--vwhitesp=INTEGER` **`--vwhitesp=`***`INTEGER`*
: Set the height of vertical whitespace above and below the barcode, where *INTEGER* is in integral multiples of the : Set the height of vertical whitespace above and below the barcode, where *`INTEGER`* is in integral multiples of
X-dimension. the X-dimension.
`-w`, `--whitesp=INTEGER` **`-w`** *`INTEGER`*, **`--whitesp=`***`INTEGER`*
: Set the width of horizontal whitespace either side of the barcode, where *INTEGER* is in integral multiples of the : Set the width of horizontal whitespace either side of the barcode, where *`INTEGER`* is in integral multiples of
X-dimension. the X-dimension.
`--werror` **`--werror`**
: Convert all warnings into errors. : Convert all warnings into errors.
@@ -684,14 +693,15 @@ and at
Zint is designed to be compliant with a number of international standards, including: Zint is designed to be compliant with a number of international standards, including:
ISO/IEC 24778:2024, ANSI/AIM BC12-1998, EN 798:1996, ISO/IEC 24778:2024 (Aztec Code), SEMI T1-95 (1996) (BC412), ANSI/AIM BC12-1998 (Channel Code),
AIM ISS-X-24 (1995), ISO/IEC 15417:2007, EN 12323:2005, EN 798:1996 (Codabar), AIM ISS-X-24 (1995) (Codablock F), ISO/IEC 15417:2007 (Code 128),
ISO/IEC 16388:2023, ANSI/AIM BC6-2000, ANSI/AIM BC5-1995, EN 12323:2005 (Code 16K), ISO/IEC 16388:2023 (Code 39), ANSI/AIM BC6-2000 (Code 49),
AIM USS Code One (1994), ISO/IEC 16022:2024, ISO/IEC 21471:2019, ANSI/AIM BC5-1995 (Code 93), AIM USS Code One (1994), ISO/IEC 16022:2024 (Data Matrix),
ISO/IEC 15420:2009, AIMD014 (v 1.63) (2008), ISO/IEC 24723:2010, ISO/IEC 21471:2025 (DMRE), AIM TSC1705001 (2019) (DotCode), ISO/IEC 15420:2025 (EAN/UPC),
ISO/IEC 24724:2011, ISO/IEC 20830:2021, ISO/IEC 16390:2007, AIMD014 (v 1.63) (2008) (Grid Matrix), ISO/IEC 24723:2010 (GS1 Composite), ISO/IEC 24724:2011 (GS1 DataBar),
ISO/IEC 16023:2000, ISO/IEC 24728:2006, ISO/IEC 15438:2015, ISO/IEC 20830:2021 (Han Xin Code), ISO/IEC 16390:2007 (Interleaved 2 of 5), ISO/IEC 16023:2000 (MaxiCode),
ISO/IEC 18004:2024, ISO/IEC 23941:2022, AIM ITS/04-023 (2022) ISO/IEC 24728:2006 (MicroPDF417), ISO/IEC 15438:2015 (PDF417), ISO/IEC 18004:2024 (QR Code),
ISO/IEC 23941:2022 (rMQR), AIM Europe X-25 USS Telepen (1991), AIMD/TSC15032-43 (2015) (Ultracode)
# COPYRIGHT # COPYRIGHT
+4 -1
View File
@@ -62,8 +62,11 @@ zint -b EAN_2ADDON --compliantheight -d "12" --scale=$SCALE_UPCEAN -o images/ean
zint -b EAN_5ADDON --compliantheight -d "54321" --guardwhitespace --scale=$SCALE_UPCEAN -o images/ean_5addon_gws.svg zint -b EAN_5ADDON --compliantheight -d "54321" --guardwhitespace --scale=$SCALE_UPCEAN -o images/ean_5addon_gws.svg
zint -b PLESSEY -d "C64" --scale=$SCALE_LINEAR -o images/plessey.svg zint -b PLESSEY -d "C64" --scale=$SCALE_LINEAR -o images/plessey.svg
zint -b MSI_PLESSEY -d "6502" --vers=2 --scale=$SCALE_LINEAR -o images/msi_plessey.svg zint -b MSI_PLESSEY -d "6502" --vers=2 --scale=$SCALE_LINEAR -o images/msi_plessey.svg
zint -b TELEPEN --compliantheight -d "Z80" --scale=$SCALE_LINEAR -o images/telepen.svg zint -b TELEPEN --compliantheight -d "Z8000" --scale=$SCALE_LINEAR -o images/telepen.svg
zint -b TELEPEN --compliantheight -d "Z\L8000" --esc --vers=1 --scale=$SCALE_LINEAR -o images/telepen_aim.svg
zint -b TELEPEN_NUM --compliantheight -d "466X33" --scale=$SCALE_LINEAR -o images/telepen_num.svg zint -b TELEPEN_NUM --compliantheight -d "466X33" --scale=$SCALE_LINEAR -o images/telepen_num.svg
zint -b TELEPEN_NUM --compliantheight -d "12\LAB" --esc --scale=$SCALE_LINEAR -o images/telepen_num_asc.svg
zint -b TELEPEN_NUM --compliantheight -d "12\L3" --esc --scale=$SCALE_LINEAR -o images/telepen_num_odd.svg
zint -b CODE39 --compliantheight -d "1A" --vers=1 --scale=$SCALE_LINEAR -o images/code39.svg zint -b CODE39 --compliantheight -d "1A" --vers=1 --scale=$SCALE_LINEAR -o images/code39.svg
zint -b EXCODE39 --compliantheight -d "123.45#@fd" --scale=$SCALE_LINEAR -o images/excode39.svg zint -b EXCODE39 --compliantheight -d "123.45#@fd" --scale=$SCALE_LINEAR -o images/excode39.svg
zint -b CODE93 --compliantheight -d "C93" --scale=$SCALE_LINEAR -o images/code93.svg zint -b CODE93 --compliantheight -d "C93" --scale=$SCALE_LINEAR -o images/code93.svg
+20 -14
View File
@@ -184,8 +184,8 @@ static void usage(const int no_png, const int have_gs1syntaxengine) {
" --compliantheight Warn if height not compliant, and use standard default\n" " --compliantheight Warn if height not compliant, and use standard default\n"
" -d, --data=DATA Set the symbol data content (segment 0)\n", stdout); " -d, --data=DATA Set the symbol data content (segment 0)\n", stdout);
fputs( " --direct Send output to stdout\n" fputs( " --direct Send output to stdout\n"
" --dmb256=INTEGER Start Data Matrix in Base 256 for given length (0 all)\n" " --dmb256[=INTEGER] Start Data Matrix in Base 256 for given length (0 all)\n"
" --dmc40=INTEGER Start Data Matrix in C40 mode for given length (0 all)\n" " --dmc40[=INTEGER] Start Data Matrix in C40 mode for given length (0 all)\n"
" --dmiso144 Use ISO format for 144x144 Data Matrix symbols\n" " --dmiso144 Use ISO format for 144x144 Data Matrix symbols\n"
" --dmre Allow Data Matrix Rectangular Extended\n", stdout); " --dmre Allow Data Matrix Rectangular Extended\n", stdout);
fputs( " --dotsize=NUMBER Set radius of dots in dotty mode\n" fputs( " --dotsize=NUMBER Set radius of dots in dotty mode\n"
@@ -228,8 +228,8 @@ if (have_gs1syntaxengine) {
" --rotate=INTEGER Rotate symbol by INTEGER (0, 90, 180, 270) degrees\n" " --rotate=INTEGER Rotate symbol by INTEGER (0, 90, 180, 270) degrees\n"
" --rows=INTEGER Set number of rows (Codablock F/PDF417)\n", stdout); " --rows=INTEGER Set number of rows (Codablock F/PDF417)\n", stdout);
fputs( " --scale=NUMBER Adjust size of X-dimension\n" fputs( " --scale=NUMBER Adjust size of X-dimension\n"
" --scalexdimdp=X[,R] Adjust size to X-dimension X at resolution R\n" " --scalexdimdp[=X[,R]] Adjust size to X-dimension X at resolution R\n"
" --scmvv=INTEGER Prefix SCM with \"[)>\\R01\\Gvv\" (vv is INTEGER) (MaxiCode)\n" " --scmvv[=INTEGER] Prefix SCM with \"[)>\\R01\\Gvv\" (vv is INTEGER) (MaxiCode)\n"
" --secure=INTEGER Set error correction level (ECC)\n" " --secure=INTEGER Set error correction level (ECC)\n"
" --segN=ECI,DATA Set the ECI & data content for segment N, where N 1 to 9\n", stdout); " --segN=ECI,DATA Set the ECI & data content for segment N, where N 1 to 9\n", stdout);
fputs( " --separator=INTEGER Set height of row separator bars (stacked symbologies)\n" fputs( " --separator=INTEGER Set height of row separator bars (stacked symbologies)\n"
@@ -830,7 +830,7 @@ static int validate_scalexdimdp(const char *const arg, float *const p_x_dim_mm,
int units_i; /* For `validate_units()` */ int units_i; /* For `validate_units()` */
char *units_err; /* For `validate_units()` */ char *units_err; /* For `validate_units()` */
char errbuf_float[ERRBUF_SIZE]; /* For `validate_float()` */ char errbuf_float[ERRBUF_SIZE]; /* For `validate_float()` */
const char *comma = strchr(arg, ','); const char *comma = arg ? strchr(arg, ',') : NULL;
if (comma) { if (comma) {
if (comma == arg || comma - arg >= ARRAY_SIZE(x_buf)) { if (comma == arg || comma - arg >= ARRAY_SIZE(x_buf)) {
cpy_str(errbuf, ERRBUF_SIZE, comma == arg ? "scalexdimdp X-dim too short" : "scalexdimdp X-dim too long"); cpy_str(errbuf, ERRBUF_SIZE, comma == arg ? "scalexdimdp X-dim too short" : "scalexdimdp X-dim too long");
@@ -845,11 +845,11 @@ static int validate_scalexdimdp(const char *const arg, float *const p_x_dim_mm,
} }
cpy_str(r_buf, ARRAY_SIZE(r_buf), comma); cpy_str(r_buf, ARRAY_SIZE(r_buf), comma);
} else { } else {
if (!*arg || strlen(arg) >= ARRAY_SIZE(x_buf)) { if (arg && (!*arg || strlen(arg) >= ARRAY_SIZE(x_buf))) {
cpy_str(errbuf, ERRBUF_SIZE, !*arg ? "scalexdimdp X-dim too short" : "scalexdimdp X-dim too long"); cpy_str(errbuf, ERRBUF_SIZE, !*arg ? "scalexdimdp X-dim too short" : "scalexdimdp X-dim too long");
return 0; return 0;
} }
cpy_str(x_buf, ARRAY_SIZE(x_buf), arg); cpy_str(x_buf, ARRAY_SIZE(x_buf), arg ? arg : "0");
} }
if ((units_i = validate_units(x_buf, x_units, ARRAY_SIZE(x_units), &units_err)) < 0) { if ((units_i = validate_units(x_buf, x_units, ARRAY_SIZE(x_units), &units_err)) < 0) {
cpycat_str(errbuf, ERRBUF_SIZE, "scalexdimdp X-dim unknown units: ", units_err); cpycat_str(errbuf, ERRBUF_SIZE, "scalexdimdp X-dim unknown units: ", units_err);
@@ -1583,8 +1583,8 @@ int main(int argc, char **argv) {
{"compliantheight", 0, NULL, OPT_COMPLIANTHEIGHT}, {"compliantheight", 0, NULL, OPT_COMPLIANTHEIGHT},
{"data", 1, NULL, 'd'}, {"data", 1, NULL, 'd'},
{"direct", 0, NULL, OPT_DIRECT}, {"direct", 0, NULL, OPT_DIRECT},
{"dmb256", 1, NULL, OPT_DMB256}, {"dmb256", 2, NULL, OPT_DMB256},
{"dmc40", 1, NULL, OPT_DMC40}, {"dmc40", 2, NULL, OPT_DMC40},
{"dmiso144", 0, NULL, OPT_DMISO144}, {"dmiso144", 0, NULL, OPT_DMISO144},
{"dmre", 0, NULL, OPT_DMRE}, {"dmre", 0, NULL, OPT_DMRE},
{"dotsize", 1, NULL, OPT_DOTSIZE}, {"dotsize", 1, NULL, OPT_DOTSIZE},
@@ -1627,8 +1627,8 @@ int main(int argc, char **argv) {
{"rotate", 1, NULL, OPT_ROTATE}, {"rotate", 1, NULL, OPT_ROTATE},
{"rows", 1, NULL, OPT_ROWS}, {"rows", 1, NULL, OPT_ROWS},
{"scale", 1, NULL, OPT_SCALE}, {"scale", 1, NULL, OPT_SCALE},
{"scalexdimdp", 1, NULL, OPT_SCALEXDIM}, {"scalexdimdp", 2, NULL, OPT_SCALEXDIM},
{"scmvv", 1, NULL, OPT_SCMVV}, {"scmvv", 2, NULL, OPT_SCMVV},
{"secure", 1, NULL, OPT_SECURE}, {"secure", 1, NULL, OPT_SECURE},
{"seg1", 1, NULL, OPT_SEG1}, {"seg1", 1, NULL, OPT_SEG1},
{"seg2", 1, NULL, OPT_SEG2}, {"seg2", 1, NULL, OPT_SEG2},
@@ -1741,7 +1741,9 @@ int main(int argc, char **argv) {
my_symbol->output_options |= BARCODE_STDOUT; my_symbol->output_options |= BARCODE_STDOUT;
break; break;
case OPT_DMB256: case OPT_DMB256:
if (!validate_int(optarg, -1 /*len*/, &val)) { if (!optarg) {
val = 0;
} else if (!validate_int(optarg, -1 /*len*/, &val)) {
fprintf(stderr, "Error 158: Invalid Data Matrix Base 256 mode length value (digits only)\n"); fprintf(stderr, "Error 158: Invalid Data Matrix Base 256 mode length value (digits only)\n");
return do_exit(ZINT_ERROR_INVALID_OPTION); return do_exit(ZINT_ERROR_INVALID_OPTION);
} }
@@ -1756,7 +1758,9 @@ int main(int argc, char **argv) {
} }
break; break;
case OPT_DMC40: case OPT_DMC40:
if (!validate_int(optarg, -1 /*len*/, &val)) { if (!optarg) {
val = 0;
} else if (!validate_int(optarg, -1 /*len*/, &val)) {
fprintf(stderr, "Error 160: Invalid Data Matrix C40 mode length value (digits only)\n"); fprintf(stderr, "Error 160: Invalid Data Matrix C40 mode length value (digits only)\n");
return do_exit(ZINT_ERROR_INVALID_OPTION); return do_exit(ZINT_ERROR_INVALID_OPTION);
} }
@@ -2026,7 +2030,9 @@ int main(int argc, char **argv) {
} }
break; break;
case OPT_SCMVV: case OPT_SCMVV:
if (!validate_int(optarg, -1 /*len*/, &val)) { if (!optarg) {
val = 96; /* ASC MH10/SC 8 */
} else if (!validate_int(optarg, -1 /*len*/, &val)) {
fprintf(stderr, "Error 149: Invalid Structured Carrier Message version value (digits only)\n"); fprintf(stderr, "Error 149: Invalid Structured Carrier Message version value (digits only)\n");
return do_exit(ZINT_ERROR_INVALID_OPTION); return do_exit(ZINT_ERROR_INVALID_OPTION);
} }
+54
View File
@@ -361,6 +361,8 @@ static void test_dump_args(const testCtx *const p_ctx) {
/* 46*/ { BARCODE_HANXIN, "é", NULL, NULL, NULL, DATA_MODE, -1, 0, -1, -1, -1, 0, -1, 1, -1, -1, NULL, -1, -1, 0, -1, "FE 8A FE\n80 28 02\nBE E8 FA\nA0 94 0A\nAE 3E EA\nAE D2 EA\nAE 74 EA\n00 AA 00\n15 B4 80\n0B 48 74\nA2 4A A4\nB5 56 2C\nA8 5A A8\n9F 18 50\n02 07 50\n00 A6 00\nFE 20 EA\n02 C2 EA\nFA C4 EA\n0A 42 0A\nEA 52 FA\nEA 24 02\nEA AA FE" }, /* 46*/ { BARCODE_HANXIN, "é", NULL, NULL, NULL, DATA_MODE, -1, 0, -1, -1, -1, 0, -1, 1, -1, -1, NULL, -1, -1, 0, -1, "FE 8A FE\n80 28 02\nBE E8 FA\nA0 94 0A\nAE 3E EA\nAE D2 EA\nAE 74 EA\n00 AA 00\n15 B4 80\n0B 48 74\nA2 4A A4\nB5 56 2C\nA8 5A A8\n9F 18 50\n02 07 50\n00 A6 00\nFE 20 EA\n02 C2 EA\nFA C4 EA\n0A 42 0A\nEA 52 FA\nEA 24 02\nEA AA FE" },
/* 47*/ { BARCODE_HANXIN, "é", NULL, NULL, NULL, DATA_MODE, -1, 0, -1, -1, -1, 0, -1, 1, 3, -1, NULL, -1, -1, 0, -1, "FE 16 FE\n80 E2 02\nBE C2 FA\nA0 A0 0A\nAE F6 EA\nAE 98 EA\nAE BA EA\n00 E0 00\n15 83 80\n44 7E AE\n92 9C 78\n25 BF 08\n47 4B 8C\n0D F9 74\n03 E7 50\n00 3A 00\nFE C2 EA\n02 22 EA\nFA DA EA\n0A 22 0A\nEA B2 FA\nEA 9A 02\nEA E8 FE" }, /* 47*/ { BARCODE_HANXIN, "é", NULL, NULL, NULL, DATA_MODE, -1, 0, -1, -1, -1, 0, -1, 1, 3, -1, NULL, -1, -1, 0, -1, "FE 16 FE\n80 E2 02\nBE C2 FA\nA0 A0 0A\nAE F6 EA\nAE 98 EA\nAE BA EA\n00 E0 00\n15 83 80\n44 7E AE\n92 9C 78\n25 BF 08\n47 4B 8C\n0D F9 74\n03 E7 50\n00 3A 00\nFE C2 EA\n02 22 EA\nFA DA EA\n0A 22 0A\nEA B2 FA\nEA 9A 02\nEA E8 FE" },
/* 48*/ { BARCODE_HANXIN, "é", NULL, NULL, NULL, DATA_MODE, -1, 0, -1, -1, -1, 0, -1, 1, 4, -1, NULL, -1, -1, 0, -1, "FE 8A FE\n80 28 02\nBE E8 FA\nA0 94 0A\nAE 3E EA\nAE D2 EA\nAE 74 EA\n00 AA 00\n15 B4 80\n0B 48 74\nA2 4A A4\nB5 56 2C\nA8 5A A8\n9F 18 50\n02 07 50\n00 A6 00\nFE 20 EA\n02 C2 EA\nFA C4 EA\n0A 42 0A\nEA 52 FA\nEA 24 02\nEA AA FE" }, /* 48*/ { BARCODE_HANXIN, "é", NULL, NULL, NULL, DATA_MODE, -1, 0, -1, -1, -1, 0, -1, 1, 4, -1, NULL, -1, -1, 0, -1, "FE 8A FE\n80 28 02\nBE E8 FA\nA0 94 0A\nAE 3E EA\nAE D2 EA\nAE 74 EA\n00 AA 00\n15 B4 80\n0B 48 74\nA2 4A A4\nB5 56 2C\nA8 5A A8\n9F 18 50\n02 07 50\n00 A6 00\nFE 20 EA\n02 C2 EA\nFA C4 EA\n0A 42 0A\nEA 52 FA\nEA 24 02\nEA AA FE" },
/* 49*/ { BARCODE_TELEPEN, "ABC\020123", NULL, NULL, NULL, DATA_MODE, -1, 0, -1, -1, -1, 0, -1, -1, -1, -1, NULL, -1, -1, 0, 1, "AB A8 BB B8 E3 B8 AE EA EE BA EA BA E2 22 BA B8 EA 2A" },
/* 50*/ { BARCODE_TELEPEN_NUM, "123\020ABC", NULL, NULL, NULL, DATA_MODE, -1, 0, -1, -1, -1, 0, -1, -1, -1, -1, NULL, -1, -1, 0, 1, "AA E8 EA BA E2 22 EE BA BB B8 E3 B8 AE EA BA B8 E8 AA" },
}; };
int data_size = ARRAY_SIZE(data); int data_size = ARRAY_SIZE(data);
int i; int i;
@@ -1362,6 +1364,57 @@ static void test_too_many_args(const testCtx *const p_ctx) {
testFinish(); testFinish();
} }
static void test_optional_args(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
struct item {
int b;
const char *data;
const char *primary;
const char *opt;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = {
/* 0*/ { BARCODE_DATAMATRIX, "123", NULL, " --dmb256", "AA A\n88 F\nD0 C\nC7 F\nAF A\nFF 3\nF5 4\nA1 B\nB5 0\nE1 D\nE9 A\nFF F" },
/* 1*/ { BARCODE_DATAMATRIX, "123", NULL, " --dmc40", "AA 8\n80 4\nC0 8\n81 C\nB7 0\nAB C\nE1 0\nE5 4\nBC 0\nFF C" },
/* 2*/ { BARCODE_EAN13, "123", NULL, " --scalexdimdp", "A3 46 8D 1A 34 6A B9 72 CD B2 15 0A" },
/* 3*/ { BARCODE_MAXICODE, "123", "1234567", " --scmvv", "D7 6F BF FC\n55 70 D8 08\nDB 12 A6 78\n55 55 55 50\n00 00 00 08\nAA AA AA A8\n55 55 55 54\n00 00 00 00\nAA AA AA AC\n55 B1 35 58\n00 90 08 0C\nAA C0 52 A8\n54 40 05 50\n01 00 08 00\nAA C0 0A AC\n55 00 01 58\n02 80 08 0C\nAB 80 1E A0\n54 00 05 5C\n03 80 0C 08\nA8 00 02 A4\n55 40 25 58\n00 60 40 08\nAA 60 66 A0\n55 55 5B FC\n00 00 02 30\nAA AA A1 E0\n5E CF C1 E8\nD0 62 E5 84\n20 1B 10 D8\nDB 8E B6 80\n21 96 26 C0\nC3 C9 89 F8" },
};
int data_size = ARRAY_SIZE(data);
int i;
char cmd[4096];
char buf[8192];
testStart("test_optional_args");
for (i = 0; i < data_size; i++) {
if (testContinue(p_ctx, i)) continue;
strcpy(cmd, "zint --dump");
if (debug & ZINT_DEBUG_PRINT) {
strcat(cmd, " --verbose");
}
arg_int(cmd, "-b ", data[i].b);
if (data[i].primary) {
arg_data(cmd, "--primary=", data[i].primary);
}
arg_data(cmd, "-d ", data[i].data);
strcat(cmd, data[i].opt);
strcat(cmd, " 2>&1");
assert_nonnull(exec(cmd, buf, sizeof(buf) - 1, debug, i, NULL), "i:%d exec(%s) NULL\n", i, cmd);
assert_zero(strcmp(buf, data[i].expected), "i:%d buf (%s) != expected (%s) (%s)\n", i, buf, data[i].expected, cmd);
}
testFinish();
}
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
testFunction funcs[] = { /* name, func */ testFunction funcs[] = { /* name, func */
@@ -1378,6 +1431,7 @@ int main(int argc, char *argv[]) {
{ "test_exit_status", test_exit_status }, { "test_exit_status", test_exit_status },
{ "test_bad_args", test_bad_args }, { "test_bad_args", test_bad_args },
{ "test_too_many_args", test_too_many_args }, { "test_too_many_args", test_too_many_args },
{ "test_optional_args", test_optional_args },
}; };
testRun(argc, argv, funcs, ARRAY_SIZE(funcs)); testRun(argc, argv, funcs, ARRAY_SIZE(funcs));
+2 -2
View File
@@ -63,8 +63,8 @@ DataWindow::DataWindow(const QString &input, bool isEscaped, int seg_no) : Valid
QString out; QString out;
out.reserve(input.length()); out.reserve(input.length());
QZINT_SIZETYPE lastPosn = 0; QZINT_SIZETYPE lastPosn = 0;
QRegularExpression escRE(QSL("\\\\(?:[0EabtnvfreGR\\\\]|d[0-9]{3}|o[0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}" QRegularExpression escRE(QSL("\\\\(?:[0EabtnvfrLeFGRN\\\\]|d[0-9]{3}|o[0-7]{3}|x[0-9A-Fa-f]{2}"
"|U[0-9A-Fa-f]{6})")); "|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{6})"));
QRegularExpressionMatchIterator matchI = escRE.globalMatch(input); QRegularExpressionMatchIterator matchI = escRE.globalMatch(input);
while (matchI.hasNext()) { while (matchI.hasNext()) {
QRegularExpressionMatch match = matchI.next(); QRegularExpressionMatch match = matchI.next();
+2
View File
@@ -57,6 +57,8 @@ FORMS += extCLI.ui \
grpPZN.ui \ grpPZN.ui \
grpQR.ui \ grpQR.ui \
grpRMQR.ui \ grpRMQR.ui \
grpTelepen.ui \
grpTelepenNum.ui \
grpUltra.ui \ grpUltra.ui \
grpUPCA.ui \ grpUPCA.ui \
grpUPCEAN.ui \ grpUPCEAN.ui \
+2
View File
@@ -49,6 +49,8 @@ FORMS += extCLI.ui \
grpPZN.ui \ grpPZN.ui \
grpQR.ui \ grpQR.ui \
grpRMQR.ui \ grpRMQR.ui \
grpTelepen.ui \
grpTelepenNum.ui \
grpUltra.ui \ grpUltra.ui \
grpUPCA.ui \ grpUPCA.ui \
grpUPCEAN.ui \ grpUPCEAN.ui \
+80
View File
@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>grpTelepen</class>
<widget class="QWidget" name="grpTelepen">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>186</width>
<height>123</height>
</rect>
</property>
<property name="maximumSize">
<size>
<width>600</width>
<height>16777215</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="vLayoutTelepen">
<property name="contentMargins">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="chkTelepenAIM">
<property name="text">
<string>Enable &amp;AIM Full ASCII + Compressed Numeric Mode</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Use different Start/Stop characters that indicate
the use of Full ASCII + Compressed Numeric Mode
where DLE (ASCII 16, escape '\L') indicates switch
to Compressed Numeric Mode</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="noteTelepenDLE">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Note: DLE only indicates switch to Compressed Numeric if AIM enabled.</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
+78
View File
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>grpTelepenNum</class>
<widget class="QWidget" name="grpTelepenNum">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>186</width>
<height>123</height>
</rect>
</property>
<property name="maximumSize">
<size>
<width>600</width>
<height>16777215</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="vLayoutTelepenNum">
<property name="contentMargins">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="chkTelepenNumAIM">
<property name="text">
<string>Enable &amp;AIM Compressed Numeric Mode (+ Full ASCII)</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Use different Start/Stop characters that indicate
the use of Compressed Numeric Mode (+ Full ASCII)</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="noteTelepenNumDLE">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Note: DLE (ASCII 16, escape '\L') may always be used to indicate switch to Full ASCII.</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
+3
View File
@@ -1558,9 +1558,12 @@ or import from file</string>
&lt;tr&gt;&lt;td&gt;\v&amp;nbsp;&lt;/td&gt;&lt;td&gt;Vertical Tab (0x0B)&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;\v&amp;nbsp;&lt;/td&gt;&lt;td&gt;Vertical Tab (0x0B)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;\f&amp;nbsp;&lt;/td&gt;&lt;td&gt;Form Feed (0x0C)&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;\f&amp;nbsp;&lt;/td&gt;&lt;td&gt;Form Feed (0x0C)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;\r&amp;nbsp;&lt;/td&gt;&lt;td&gt;Carriage Return (0x0D)&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;\r&amp;nbsp;&lt;/td&gt;&lt;td&gt;Carriage Return (0x0D)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;\L&amp;nbsp;&lt;/td&gt;&lt;td&gt;Data Link Escape (0x10)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;\e&amp;nbsp;&lt;/td&gt;&lt;td&gt;Escape (0x1B)&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;\e&amp;nbsp;&lt;/td&gt;&lt;td&gt;Escape (0x1B)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;\F&amp;nbsp;&lt;/td&gt;&lt;td&gt;File Separator (0x1C)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;\G&amp;nbsp;&lt;/td&gt;&lt;td&gt;Group Separator (0x1D)&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;\G&amp;nbsp;&lt;/td&gt;&lt;td&gt;Group Separator (0x1D)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;\R&amp;nbsp;&lt;/td&gt;&lt;td&gt;Record Separator (0x1E)&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;\R&amp;nbsp;&lt;/td&gt;&lt;td&gt;Record Separator (0x1E)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;\N&amp;nbsp;&lt;/td&gt;&lt;td&gt;Unit Separator (0x1F)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;\(&amp;nbsp;&lt;/td&gt;&lt;td&gt;Opening parenthesis (0x28) ("GS1 ()" only) &lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;\(&amp;nbsp;&lt;/td&gt;&lt;td&gt;Opening parenthesis (0x28) ("GS1 ()" only) &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;\)&amp;nbsp;&lt;/td&gt;&lt;td&gt;Closing parenthesis (0x29) ("GS1 ()" only) &lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;\)&amp;nbsp;&lt;/td&gt;&lt;td&gt;Closing parenthesis (0x29) ("GS1 ()" only) &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;\\&amp;nbsp;&lt;/td&gt;&lt;td&gt;Backslash (0x5C)&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;\\&amp;nbsp;&lt;/td&gt;&lt;td&gt;Backslash (0x5C)&lt;/td&gt;&lt;/tr&gt;
+54
View File
@@ -2297,6 +2297,30 @@ void MainWindow::change_options()
connect(get_widget(QSL("chkPlesseyShowChecks")), SIGNAL(toggled(bool)), SLOT(update_preview())); connect(get_widget(QSL("chkPlesseyShowChecks")), SIGNAL(toggled(bool)), SLOT(update_preview()));
} }
} else if (symbology == BARCODE_TELEPEN) {
QFile file(QSL(":/grpTelepen.ui"));
if (file.open(QIODevice::ReadOnly)) {
m_optionWidget = uiload.load(&file);
file.close();
load_sub_settings(settings, symbology);
vLayoutSpecific->addWidget(m_optionWidget);
set_smaller_font(QSL("noteTelepenDLE"));
grpSpecific->show();
connect(get_widget(QSL("chkTelepenAIM")), SIGNAL(toggled(bool)), SLOT(update_preview()));
}
} else if (symbology == BARCODE_TELEPEN_NUM) {
QFile file(QSL(":/grpTelepenNum.ui"));
if (file.open(QIODevice::ReadOnly)) {
m_optionWidget = uiload.load(&file);
file.close();
load_sub_settings(settings, symbology);
vLayoutSpecific->addWidget(m_optionWidget);
set_smaller_font(QSL("noteTelepenNumDLE"));
grpSpecific->show();
connect(get_widget(QSL("chkTelepenNumAIM")), SIGNAL(toggled(bool)), SLOT(update_preview()));
}
} else if (symbology == BARCODE_ULTRA) { } else if (symbology == BARCODE_ULTRA) {
QFile file(QSL(":/grpUltra.ui")); QFile file(QSL(":/grpUltra.ui"));
if (!file.open(QIODevice::ReadOnly)) if (!file.open(QIODevice::ReadOnly))
@@ -3402,6 +3426,20 @@ void MainWindow::update_preview()
} }
break; break;
case BARCODE_TELEPEN:
m_bc.bc.setSymbol(BARCODE_TELEPEN);
if (get_chk_val(QSL("chkTelepenAIM"))) {
m_bc.bc.setOption2(1);
}
break;
case BARCODE_TELEPEN_NUM:
m_bc.bc.setSymbol(BARCODE_TELEPEN_NUM);
if (get_chk_val(QSL("chkTelepenNumAIM"))) {
m_bc.bc.setOption2(1);
}
break;
case BARCODE_ULTRA: case BARCODE_ULTRA:
m_bc.bc.setSymbol(BARCODE_ULTRA); m_bc.bc.setSymbol(BARCODE_ULTRA);
if (get_rad_val(QSL("radUltraEcc"))) if (get_rad_val(QSL("radUltraEcc")))
@@ -4697,6 +4735,14 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology)
settings.setValue(QSL("studio/bc/plessey/chk_show_checks"), get_chk_val(QSL("chkPlesseyShowChecks"))); settings.setValue(QSL("studio/bc/plessey/chk_show_checks"), get_chk_val(QSL("chkPlesseyShowChecks")));
break; break;
case BARCODE_TELEPEN:
settings.setValue(QSL("studio/bc/telepen/chk_aim"), get_chk_val(QSL("chkTelepenAIM")));
break;
case BARCODE_TELEPEN_NUM:
settings.setValue(QSL("studio/bc/telepen_num/chk_aim"), get_chk_val(QSL("chkTelepenNumAIM")));
break;
case BARCODE_ULTRA: case BARCODE_ULTRA:
settings.setValue(QSL("studio/bc/ultra/autoresizing"), get_rad_grp_index( settings.setValue(QSL("studio/bc/ultra/autoresizing"), get_rad_grp_index(
QStringList() << QSL("radUltraAuto") << QSL("radUltraEcc"))); QStringList() << QSL("radUltraAuto") << QSL("radUltraEcc")));
@@ -5176,6 +5222,14 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology)
set_chk_from_setting(settings, QSL("studio/bc/plessey/chk_show_checks"), QSL("chkPlesseyShowChecks")); set_chk_from_setting(settings, QSL("studio/bc/plessey/chk_show_checks"), QSL("chkPlesseyShowChecks"));
break; break;
case BARCODE_TELEPEN:
set_chk_from_setting(settings, QSL("studio/bc/telepen/chk_aim"), QSL("chkTelepenAIM"));
break;
case BARCODE_TELEPEN_NUM:
set_chk_from_setting(settings, QSL("studio/bc/telepen_num/chk_aim"), QSL("chkTelepenNumAIM"));
break;
case BARCODE_ULTRA: case BARCODE_ULTRA:
set_rad_from_setting(settings, QSL("studio/bc/ultra/autoresizing"), set_rad_from_setting(settings, QSL("studio/bc/ultra/autoresizing"),
QStringList() << QSL("radUltraAuto") << QSL("radUltraEcc")); QStringList() << QSL("radUltraAuto") << QSL("radUltraEcc"));
+2
View File
@@ -31,6 +31,8 @@
<file>grpPZN.ui</file> <file>grpPZN.ui</file>
<file>grpQR.ui</file> <file>grpQR.ui</file>
<file>grpRMQR.ui</file> <file>grpRMQR.ui</file>
<file>grpTelepen.ui</file>
<file>grpTelepenNum.ui</file>
<file>grpUltra.ui</file> <file>grpUltra.ui</file>
<file>grpUPCA.ui</file> <file>grpUPCA.ui</file>
<file>grpUPCEAN.ui</file> <file>grpUPCEAN.ui</file>