mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
DATAMATRIX: add DM_ISO_144
(--dmiso144) option for ISO placement
of ECC codewords instead of default "de facto"
This commit is contained in:
@ -159,17 +159,18 @@ static void usage(const int no_png) {
|
||||
" --compliantheight Warn if height not compliant, and use standard default\n"
|
||||
" -d, --data=DATA Set the symbol data content (segment 0)\n"
|
||||
" --direct Send output to stdout\n", stdout);
|
||||
fputs( " --dmre Allow Data Matrix Rectangular Extended\n"
|
||||
fputs( " --dmiso144 Use ISO format for 144x144 Data Matrix symbols\n"
|
||||
" --dmre Allow Data Matrix Rectangular Extended\n"
|
||||
" --dotsize=NUMBER Set radius of dots in dotty mode\n"
|
||||
" --dotty Use dots instead of squares for matrix symbols\n"
|
||||
" --dump Dump hexadecimal representation to stdout\n"
|
||||
" -e, --ecinos Display ECI (Extended Channel Interpretation) table\n", stdout);
|
||||
fputs( " --eci=INTEGER Set the ECI code for the data (segment 0)\n"
|
||||
" --dump Dump hexadecimal representation to stdout\n", stdout);
|
||||
fputs( " -e, --ecinos Display ECI (Extended Channel Interpretation) table\n"
|
||||
" --eci=INTEGER Set the ECI code for the data (segment 0)\n"
|
||||
" --embedfont Embed font in vector output (SVG only)\n"
|
||||
" --esc Process escape sequences in input data\n"
|
||||
" --extraesc Process symbology-specific escape sequences (Code 128)\n"
|
||||
" --fast Use faster encodation or other shortcuts if available\n", stdout);
|
||||
fputs( " --fg=COLOUR Specify a foreground colour (as RGB(A) or \"C,M,Y,K\")\n", stdout);
|
||||
" --extraesc Process symbology-specific escape sequences (Code 128)\n", stdout);
|
||||
fputs( " --fast Use faster encodation or other shortcuts if available\n"
|
||||
" --fg=COLOUR Specify a foreground colour (as RGB(A) or \"C,M,Y,K\")\n", stdout);
|
||||
printf(" --filetype=TYPE Set output file type BMP/EMF/EPS/GIF/PCX%s/SVG/TIF/TXT\n", no_png_type);
|
||||
fputs( " --fullmultibyte Use multibyte for binary/Latin (QR/Han Xin/Grid Matrix)\n"
|
||||
" --gs1 Treat input as GS1 compatible data\n"
|
||||
@ -1429,7 +1430,8 @@ int main(int argc, char **argv) {
|
||||
while (1) {
|
||||
enum options {
|
||||
OPT_ADDONGAP = 128, OPT_BATCH, OPT_BINARY, OPT_BG, OPT_BIND, OPT_BIND_TOP, OPT_BOLD, OPT_BORDER, OPT_BOX,
|
||||
OPT_CMYK, OPT_COLS, OPT_COMPLIANTHEIGHT, OPT_DIRECT, OPT_DMRE, OPT_DOTSIZE, OPT_DOTTY, OPT_DUMP,
|
||||
OPT_CMYK, OPT_COLS, OPT_COMPLIANTHEIGHT,
|
||||
OPT_DIRECT, OPT_DMISO144, OPT_DMRE, OPT_DOTSIZE, OPT_DOTTY, OPT_DUMP,
|
||||
OPT_ECI, OPT_EMBEDFONT, OPT_ESC, OPT_EXTRAESC, OPT_FAST, OPT_FG, OPT_FILETYPE, OPT_FULLMULTIBYTE,
|
||||
OPT_GS1, OPT_GS1NOCHECK, OPT_GS1PARENS, OPT_GSSEP, OPT_GUARDDESCENT, OPT_GUARDWHITESPACE,
|
||||
OPT_HEIGHT, OPT_HEIGHTPERROW, OPT_INIT, OPT_MIRROR, OPT_MASK, OPT_MODE,
|
||||
@ -1457,6 +1459,7 @@ int main(int argc, char **argv) {
|
||||
{"compliantheight", 0, NULL, OPT_COMPLIANTHEIGHT},
|
||||
{"data", 1, NULL, 'd'},
|
||||
{"direct", 0, NULL, OPT_DIRECT},
|
||||
{"dmiso144", 0, NULL, OPT_DMISO144},
|
||||
{"dmre", 0, NULL, OPT_DMRE},
|
||||
{"dotsize", 1, NULL, OPT_DOTSIZE},
|
||||
{"dotty", 0, NULL, OPT_DOTTY},
|
||||
@ -1602,10 +1605,13 @@ int main(int argc, char **argv) {
|
||||
case OPT_DIRECT:
|
||||
my_symbol->output_options |= BARCODE_STDOUT;
|
||||
break;
|
||||
case OPT_DMISO144:
|
||||
my_symbol->option_3 |= DM_ISO_144;
|
||||
break;
|
||||
case OPT_DMRE:
|
||||
/* Square overwrites DMRE */
|
||||
if (my_symbol->option_3 != DM_SQUARE) {
|
||||
my_symbol->option_3 = DM_DMRE;
|
||||
if ((my_symbol->option_3 & 0x7F) != DM_SQUARE) {
|
||||
my_symbol->option_3 = DM_DMRE | (my_symbol->option_3 & ~0x7F);
|
||||
}
|
||||
break;
|
||||
case OPT_DOTSIZE:
|
||||
@ -1913,7 +1919,7 @@ int main(int argc, char **argv) {
|
||||
my_symbol->output_options |= SMALL_TEXT;
|
||||
break;
|
||||
case OPT_SQUARE:
|
||||
my_symbol->option_3 = DM_SQUARE;
|
||||
my_symbol->option_3 = DM_SQUARE | (my_symbol->option_3 & ~0x7F);
|
||||
break;
|
||||
case OPT_STRUCTAPP:
|
||||
memset(&my_symbol->structapp, 0, sizeof(my_symbol->structapp));
|
||||
@ -2045,7 +2051,19 @@ int main(int argc, char **argv) {
|
||||
|
||||
case '?':
|
||||
if (optopt) {
|
||||
fprintf(stderr, "Error 109: option '%s' requires an argument\n", argv[optind - 1]);
|
||||
for (i = 0; i < ARRAY_SIZE(long_options) && long_options[i].val != optopt; i++);
|
||||
if (i == ARRAY_SIZE(long_options)) { /* Shouldn't happen */
|
||||
fprintf(stderr, "Error 125: ?? unknown optopt '%d'\n", optopt); /* Not reached */
|
||||
return do_exit(ZINT_ERROR_ENCODING_PROBLEM);
|
||||
}
|
||||
if (long_options[i].has_arg) {
|
||||
fprintf(stderr, "Error 109: option '%s' requires an argument\n", argv[optind - 1]);
|
||||
} else {
|
||||
const char *eqs = strchr(argv[optind - 1], '=');
|
||||
const int optlen = eqs ? (int) (eqs - argv[optind - 1]) : (int) strlen(argv[optind - 1]);
|
||||
fprintf(stderr, "Error 126: option '%.*s' does not take an argument\n", optlen,
|
||||
argv[optind - 1]);
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "Error 101: unknown option '%s'\n", argv[optind - 1]);
|
||||
}
|
||||
|
@ -1181,56 +1181,57 @@ static void test_other_opts(const testCtx *const p_ctx) {
|
||||
/* 11*/ { BARCODE_CODE128, "1", -1, " --fgcolor=", "111111", "", 0 },
|
||||
/* 12*/ { BARCODE_CODE128, "1", -1, " --fgcolour=", "111111", "", 0 },
|
||||
/* 13*/ { BARCODE_CODE128, "1", -1, " --compliantheight", "", "", 0 },
|
||||
/* 14*/ { BARCODE_EANX, "123456", -1, " --guardwhitespace", "", "", 0 },
|
||||
/* 15*/ { BARCODE_EANX, "123456", -1, " --embedfont", "", "", 0 },
|
||||
/* 16*/ { BARCODE_CODE128, "1", -1, " --nobackground", "", "", 0 },
|
||||
/* 17*/ { BARCODE_CODE128, "1", -1, " --noquietzones", "", "", 0 },
|
||||
/* 18*/ { BARCODE_CODE128, "1", -1, " --notext", "", "", 0 },
|
||||
/* 19*/ { BARCODE_CODE128, "1", -1, " --quietzones", "", "", 0 },
|
||||
/* 20*/ { BARCODE_CODE128, "1", -1, " --reverse", "", "", 0 },
|
||||
/* 21*/ { BARCODE_CODE128, "1", -1, " --werror", NULL, "", 0 },
|
||||
/* 22*/ { 19, "1", -1, " --werror", NULL, "Error 207: Codabar 18 not supported", 0 },
|
||||
/* 23*/ { BARCODE_GS1_128, "[01]12345678901231", -1, "", NULL, "", 0 },
|
||||
/* 24*/ { BARCODE_GS1_128, "0112345678901231", -1, "", NULL, "Error 252: Data does not start with an AI", 0 },
|
||||
/* 25*/ { BARCODE_GS1_128, "0112345678901231", -1, " --gs1nocheck", NULL, "Error 252: Data does not start with an AI", 0 },
|
||||
/* 26*/ { BARCODE_GS1_128, "[00]376104250021234569", -1, "", NULL, "", 0 },
|
||||
/* 27*/ { BARCODE_GS1_128, "[00]376104250021234568", -1, "", NULL, "Warning 261: AI (00) position 18: Bad checksum '8', expected '9'", 0 },
|
||||
/* 28*/ { BARCODE_GS1_128, "[00]376104250021234568", -1, " --gs1nocheck", NULL, "", 0 },
|
||||
/* 29*/ { BARCODE_GS1_128, "[00]376104250021234568", -1, " --werror", NULL, "Error 261: AI (00) position 18: Bad checksum '8', expected '9'", 0 },
|
||||
/* 30*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "1", "Error 155: Invalid Structured Append argument, expect \"index,count[,ID]\"", 0 },
|
||||
/* 31*/ { BARCODE_AZTEC, "1", -1, " --structapp=", ",", "Error 156: Structured Append index too short", 0 },
|
||||
/* 32*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "1234567890,", "Error 156: Structured Append index too long", 0 },
|
||||
/* 33*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,", "Error 159: Structured Append count too short", 0 },
|
||||
/* 34*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,1234567890", "Error 159: Structured Append count too long", 0 },
|
||||
/* 35*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,123456789,", "Error 158: Structured Append ID too short", 0 },
|
||||
/* 36*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,1234567890,", "Error 157: Structured Append count too long", 0 },
|
||||
/* 37*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,123456789,123456789012345678901234567890123", "Error 158: Structured Append ID too long", 0 },
|
||||
/* 38*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,123456789,12345678901234567890123456789012", "Error 701: Structured Append count out of range (2-26)", 0 },
|
||||
/* 39*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "26,26,12345678901234567890123456789012", "", 0 },
|
||||
/* 40*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "A,26,12345678901234567890123456789012", "Error 160: Invalid Structured Append index (digits only)", 0 },
|
||||
/* 41*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "26,A,12345678901234567890123456789012", "Error 161: Invalid Structured Append count (digits only)", 0 },
|
||||
/* 42*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "26,1,12345678901234567890123456789012", "Error 162: Invalid Structured Append count, must be >= 2", 0 },
|
||||
/* 43*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "0,2,12345678901234567890123456789012", "Error 163: Structured Append index out of range (1-2)", 0 },
|
||||
/* 44*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "3,2,12345678901234567890123456789012", "Error 163: Structured Append index out of range (1-2)", 0 },
|
||||
/* 45*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "2,3,12345678901234567890123456789012", "", 0 },
|
||||
/* 46*/ { BARCODE_PDF417, "1", -1, " --heightperrow", "", "", 0 },
|
||||
/* 47*/ { -1, NULL, -1, " -v", NULL, "Zint version ", 1 },
|
||||
/* 48*/ { -1, NULL, -1, " --version", NULL, "Zint version ", 1 },
|
||||
/* 49*/ { -1, NULL, -1, " -h", NULL, "Encode input data in a barcode ", 1 },
|
||||
/* 50*/ { -1, NULL, -1, " -e", NULL, "3: ISO/IEC 8859-1 ", 1 },
|
||||
/* 51*/ { -1, NULL, -1, " -t", NULL, "1 CODE11 ", 1 },
|
||||
/* 52*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12345678", "Error 178: scalexdimdp X-dim invalid floating point (integer part must be 7 digits maximum)", 0 },
|
||||
/* 53*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "1234567890123", "Error 176: scalexdimdp X-dim too long", 0 },
|
||||
/* 54*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "123456.12", "Error 178: scalexdimdp X-dim invalid floating point (7 significant digits maximum)", 0 },
|
||||
/* 55*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", ",12.34", "Error 174: scalexdimdp X-dim too short", 0 },
|
||||
/* 56*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12.34,", "Error 175: scalexdimdp resolution too short", 0 },
|
||||
/* 57*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12mm1", "Error 177: scalexdimdp X-dim units must occur at end", 0 },
|
||||
/* 58*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "1inc", "Error 177: scalexdimdp X-dim units must occur at end", 0 },
|
||||
/* 59*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "1234x", "Error 178: scalexdimdp X-dim invalid floating point (integer part must be digits only)", 0 },
|
||||
/* 60*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12.34in,123x", "Error 180: scalexdimdp resolution invalid floating point (integer part must be digits only)", 0 },
|
||||
/* 61*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12,123.45678", "Error 180: scalexdimdp resolution invalid floating point (7 significant digits maximum)", 0 },
|
||||
/* 62*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "10.1,1000", "Warning 185: scalexdimdp X-dim (10.1) out of range (> 10), ignoring", 0 },
|
||||
/* 63*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "10,1000.1", "Warning 186: scalexdimdp resolution (1000.1) out of range (> 1000), ignoring", 0 },
|
||||
/* 14*/ { BARCODE_DATAMATRIX, "1", -1, " --dmiso144", "", "", 0 },
|
||||
/* 15*/ { BARCODE_EANX, "123456", -1, " --guardwhitespace", "", "", 0 },
|
||||
/* 16*/ { BARCODE_EANX, "123456", -1, " --embedfont", "", "", 0 },
|
||||
/* 17*/ { BARCODE_CODE128, "1", -1, " --nobackground", "", "", 0 },
|
||||
/* 18*/ { BARCODE_CODE128, "1", -1, " --noquietzones", "", "", 0 },
|
||||
/* 19*/ { BARCODE_CODE128, "1", -1, " --notext", "", "", 0 },
|
||||
/* 20*/ { BARCODE_CODE128, "1", -1, " --quietzones", "", "", 0 },
|
||||
/* 21*/ { BARCODE_CODE128, "1", -1, " --reverse", "", "", 0 },
|
||||
/* 22*/ { BARCODE_CODE128, "1", -1, " --werror", NULL, "", 0 },
|
||||
/* 23*/ { 19, "1", -1, " --werror", NULL, "Error 207: Codabar 18 not supported", 0 },
|
||||
/* 24*/ { BARCODE_GS1_128, "[01]12345678901231", -1, "", NULL, "", 0 },
|
||||
/* 25*/ { BARCODE_GS1_128, "0112345678901231", -1, "", NULL, "Error 252: Data does not start with an AI", 0 },
|
||||
/* 26*/ { BARCODE_GS1_128, "0112345678901231", -1, " --gs1nocheck", NULL, "Error 252: Data does not start with an AI", 0 },
|
||||
/* 27*/ { BARCODE_GS1_128, "[00]376104250021234569", -1, "", NULL, "", 0 },
|
||||
/* 28*/ { BARCODE_GS1_128, "[00]376104250021234568", -1, "", NULL, "Warning 261: AI (00) position 18: Bad checksum '8', expected '9'", 0 },
|
||||
/* 29*/ { BARCODE_GS1_128, "[00]376104250021234568", -1, " --gs1nocheck", NULL, "", 0 },
|
||||
/* 30*/ { BARCODE_GS1_128, "[00]376104250021234568", -1, " --werror", NULL, "Error 261: AI (00) position 18: Bad checksum '8', expected '9'", 0 },
|
||||
/* 31*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "1", "Error 155: Invalid Structured Append argument, expect \"index,count[,ID]\"", 0 },
|
||||
/* 32*/ { BARCODE_AZTEC, "1", -1, " --structapp=", ",", "Error 156: Structured Append index too short", 0 },
|
||||
/* 33*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "1234567890,", "Error 156: Structured Append index too long", 0 },
|
||||
/* 34*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,", "Error 159: Structured Append count too short", 0 },
|
||||
/* 35*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,1234567890", "Error 159: Structured Append count too long", 0 },
|
||||
/* 36*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,123456789,", "Error 158: Structured Append ID too short", 0 },
|
||||
/* 37*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,1234567890,", "Error 157: Structured Append count too long", 0 },
|
||||
/* 38*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,123456789,123456789012345678901234567890123", "Error 158: Structured Append ID too long", 0 },
|
||||
/* 39*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,123456789,12345678901234567890123456789012", "Error 701: Structured Append count out of range (2-26)", 0 },
|
||||
/* 40*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "26,26,12345678901234567890123456789012", "", 0 },
|
||||
/* 41*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "A,26,12345678901234567890123456789012", "Error 160: Invalid Structured Append index (digits only)", 0 },
|
||||
/* 42*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "26,A,12345678901234567890123456789012", "Error 161: Invalid Structured Append count (digits only)", 0 },
|
||||
/* 43*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "26,1,12345678901234567890123456789012", "Error 162: Invalid Structured Append count, must be >= 2", 0 },
|
||||
/* 44*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "0,2,12345678901234567890123456789012", "Error 163: Structured Append index out of range (1-2)", 0 },
|
||||
/* 45*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "3,2,12345678901234567890123456789012", "Error 163: Structured Append index out of range (1-2)", 0 },
|
||||
/* 46*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "2,3,12345678901234567890123456789012", "", 0 },
|
||||
/* 47*/ { BARCODE_PDF417, "1", -1, " --heightperrow", "", "", 0 },
|
||||
/* 48*/ { -1, NULL, -1, " -v", NULL, "Zint version ", 1 },
|
||||
/* 49*/ { -1, NULL, -1, " --version", NULL, "Zint version ", 1 },
|
||||
/* 50*/ { -1, NULL, -1, " -h", NULL, "Encode input data in a barcode ", 1 },
|
||||
/* 51*/ { -1, NULL, -1, " -e", NULL, "3: ISO/IEC 8859-1 ", 1 },
|
||||
/* 52*/ { -1, NULL, -1, " -t", NULL, "1 CODE11 ", 1 },
|
||||
/* 53*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12345678", "Error 178: scalexdimdp X-dim invalid floating point (integer part must be 7 digits maximum)", 0 },
|
||||
/* 54*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "1234567890123", "Error 176: scalexdimdp X-dim too long", 0 },
|
||||
/* 55*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "123456.12", "Error 178: scalexdimdp X-dim invalid floating point (7 significant digits maximum)", 0 },
|
||||
/* 56*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", ",12.34", "Error 174: scalexdimdp X-dim too short", 0 },
|
||||
/* 57*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12.34,", "Error 175: scalexdimdp resolution too short", 0 },
|
||||
/* 58*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12mm1", "Error 177: scalexdimdp X-dim units must occur at end", 0 },
|
||||
/* 59*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "1inc", "Error 177: scalexdimdp X-dim units must occur at end", 0 },
|
||||
/* 60*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "1234x", "Error 178: scalexdimdp X-dim invalid floating point (integer part must be digits only)", 0 },
|
||||
/* 61*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12.34in,123x", "Error 180: scalexdimdp resolution invalid floating point (integer part must be digits only)", 0 },
|
||||
/* 62*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12,123.45678", "Error 180: scalexdimdp resolution invalid floating point (7 significant digits maximum)", 0 },
|
||||
/* 63*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "10.1,1000", "Warning 185: scalexdimdp X-dim (10.1) out of range (> 10), ignoring", 0 },
|
||||
/* 64*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "10,1000.1", "Warning 186: scalexdimdp resolution (1000.1) out of range (> 1000), ignoring", 0 },
|
||||
};
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
int i;
|
||||
|
Reference in New Issue
Block a user