1
0
mirror of https://github.com/woo-j/zint.git synced 2024-12-23 01:33:55 +03:00

ULTRA: add revision 2 support (based on BWIPP 2021-09-28 update)

GUI: DMATRIX: disable DMRE if SQUARE checked; ULTRA: Size/Ecc buttongroup
This commit is contained in:
gitlost 2021-09-29 16:25:59 +01:00
parent 14c236644f
commit 206ae26d20
13 changed files with 263 additions and 153 deletions

View File

@ -26,6 +26,7 @@ Changes
- raster.c: improve non-half-integer interpolation performance
- Add Structured Append support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, MAXICODE, MICROPDF417, PDF417, QRCODE, ULTRA
- ULTRA: add revision 2 support (based on BWIPP 2021-09-28 update)
Bugs
----

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 B

View File

@ -169,6 +169,7 @@ static void test_print(int index, int generate, int debug) {
/* 26*/ { BARCODE_CODE16K, -1, -1, 3, 5, -1, -1, 0.5, 0, 0, { 0, 0, "" }, "", "", "1234567890", "code16k_height0.5_wsp3_vwsp5.gif", "Separator covers bars" },
/* 27*/ { BARCODE_CODE16K, -1, -1, 3, 5, -1, -1, 1.5, 0, 0, { 0, 0, "" }, "", "", "1234567890", "code16k_height1.5_wsp3_vwsp5.gif", "" },
/* 28*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, -1, 0, 0, 0, { 2, 9, "001002" }, "", "", "1234567890", "datamatrix_seq2of9.gif", "" },
/* 29*/ { BARCODE_ULTRA, -1, -1, 1, -1, -1, 2, 0, 0, 0, { 0, 0, "" }, "", "", "12", "ultra_rev2.gif", "Revision 2" },
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;

View File

@ -185,6 +185,7 @@ static void test_input(int index, int generate, int debug) {
int input_mode;
int eci;
int option_1;
int option_2;
int option_3;
struct zint_structapp structapp;
char *data;
@ -193,70 +194,73 @@ static void test_input(int index, int generate, int debug) {
char *comment;
};
struct item data[] = {
/* 0*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "A", 0, "(2) 257 65", "" },
/* 1*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "A", 0, "(2) 272 65", "" },
/* 2*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "12", 0, "(3) 257 49 50", "" },
/* 3*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "12", 0, "(2) 272 140", "" },
/* 4*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "123", 0, "(4) 257 49 50 51", "" },
/* 5*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "123", 0, "(3) 272 140 51", "" },
/* 6*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "ABC", 0, "(4) 257 65 66 67", "" },
/* 7*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "ABC", 0, "(4) 272 65 66 67", "" },
/* 8*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "ULTRACODE_123456789!", 0, "(17) 272 85 76 84 82 65 67 79 68 69 95 140 162 184 206 57 33", "" },
/* 9*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, "(253) 257 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65", "252 chars EC2" },
/* 10*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", ZINT_ERROR_TOO_LONG, "Error 591: Data too long for selected error correction capacity", "253 chars EC2" },
/* 11*/ { UNICODE_MODE, 0, 1, -1, { 0, 0, "" }, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, "(277) 257 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65", "276 chars EC0" },
/* 12*/ { UNICODE_MODE, 0, 1, -1, { 0, 0, "" }, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", ZINT_ERROR_TOO_LONG, "Error 591: Data too long for selected error correction capacity", "277 chars EC0" },
/* 13*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "é", 0, "(2) 257 233", "" },
/* 14*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "β", ZINT_WARN_USES_ECI, "Warning (2) 263 226", "" },
/* 15*/ { UNICODE_MODE, 9, -1, -1, { 0, 0, "" }, "β", 0, "(2) 263 226", "" },
/* 16*/ { UNICODE_MODE, 9, -1, -1, { 0, 0, "" }, "βAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, "(253) 263 226 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65", "249 chars EC2" },
/* 17*/ { UNICODE_MODE, 9, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "A", 0, "(2) 272 65", "Note ECI ignored and not outputted if ULTRA_COMPRESSION and all ASCII" },
/* 18*/ { UNICODE_MODE, 15, -1, -1, { 0, 0, "" }, "Ŗ", 0, "(2) 268 170", "" },
/* 19*/ { DATA_MODE, 898, -1, -1, { 0, 0, "" }, "\001\002\003\004\377", 0, "(7) 278 130 1 2 3 4 255", "" },
/* 20*/ { DATA_MODE, 899, -1, -1, { 0, 0, "" }, "\001\002\003\004\377", 0, "(6) 280 1 2 3 4 255", "" },
/* 21*/ { DATA_MODE, 900, -1, -1, { 0, 0, "" }, "\001\002\003\004\377", 0, "(9) 257 274 137 128 1 2 3 4 255", "" },
/* 22*/ { DATA_MODE, 9999, -1, -1, { 0, 0, "" }, "\001\002\003\004\377", 0, "(9) 257 274 227 227 1 2 3 4 255", "" },
/* 23*/ { DATA_MODE, 10000, -1, -1, { 0, 0, "" }, "\001\002\003\004\377", 0, "(10) 257 275 129 128 128 1 2 3 4 255", "" },
/* 24*/ { DATA_MODE, 811799, -1, -1, { 0, 0, "" }, "\001\002\003\004\377", 0, "(10) 257 275 209 145 227 1 2 3 4 255", "" },
/* 25*/ { DATA_MODE, 811800, -1, -1, { 0, 0, "" }, "\001\002\003\004\377", ZINT_ERROR_INVALID_OPTION, "Error 590: ECI value not supported by Ultracode", "" },
/* 26*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "123,456,789/12,/3,4,/5//", 0, "(15) 272 140 231 173 234 206 257 140 44 262 242 44 264 47 47", "Mode: a (24)" },
/* 27*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "HEIMASÍÐA KENNARAHÁSKÓLA ÍSLANDS", 0, "(32) 257 256 46 151 78 210 205 208 258 5 148 28 72 2 167 52 127 193 83 75 211 267 76 65 32", "Mode: cccccc88cccccccccc8888aaa8cccccc (32)" },
/* 28*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "HEIMASÍÐA KENNARAHÁSKÓLA ÍSLANDS", 0, "(33) 257 72 69 73 77 65 83 205 208 65 32 75 69 78 78 65 82 65 72 193 83 75 211 76 65 32 205", "" },
/* 29*/ { UNICODE_MODE, 10, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "אולטרה-קוד1234", 0, "(14) 264 224 229 236 232 248 228 45 247 229 227 267 140 162", "Mode: 8888888888aaaa (14); Figure G.3" },
/* 30*/ { UNICODE_MODE, 10, -1, -1, { 0, 0, "" }, "אולטרה-קוד1234", 0, "(15) 264 224 229 236 232 248 228 45 247 229 227 49 50 51 52", "" },
/* 31*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "https://aimglobal.org/jcrv3tX", 0, "(16) 282 266 1 74 41 19 6 168 270 212 59 106 144 56 265 70", "Mode: c (21); Figure G.4a" },
/* 32*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "https://aimglobal.org/jcrv3tX", 0, "(22) 282 97 105 109 103 108 111 98 97 108 46 111 114 103 47 106 99 114 118 51 116 88", "" },
/* 33*/ { GS1_MODE, 0, -1, -1, { 0, 0, "" }, "[01]03453120000011[17]121125[10]ABCD1234", 0, "(20) 273 129 131 173 159 148 128 128 139 145 140 139 153 138 65 66 67 68 140 162", "Mode: a (34); Figure G.6 uses C43 for 6 of last 7 chars (same codeword count)" },
/* 34*/ { GS1_MODE, 0, -1, -1, { 0, 0, "" }, "[17]120508[10]ABCD1234[410]9501101020917", 0, "(21) 273 145 140 133 136 138 65 66 67 68 140 162 272 169 137 178 139 129 130 137 145", "Mode: a (35)" },
/* 35*/ { GS1_MODE, 0, -1, -1, { 0, 0, "" }, "[17]120508[10]ABCDEFGHI[410]9501101020917", 0, "(24) 273 145 140 133 136 138 65 66 67 68 69 70 71 72 73 272 169 137 178 139 129 130 137 145", "Mode: a (36)" },
/* 36*/ { GS1_MODE | GS1PARENS_MODE, 0, -1, -1, { 0, 0, "" }, "(17)120508(10)ABCDEFGHI(410)9501101020917", 0, "(24) 273 145 140 133 136 138 65 66 67 68 69 70 71 72 73 272 169 137 178 139 129 130 137 145", "Mode: a (36)" },
/* 37*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "ftp://", 0, "(4) 272 278 269 165", "Mode: c (6)" },
/* 38*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, ".cgi", 0, "(4) 272 278 274 131", "Mode: c (4)" },
/* 39*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "ftp://a.cgi", 0, "(6) 272 280 269 123 274 131", "Mode: c (11)" },
/* 40*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "e: file:f.shtml !", 0, "(12) 272 280 30 94 236 235 72 233 39 52 267 250", "Mode: c (17)" },
/* 41*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "Aaatel:", 0, "(6) 272 280 262 76 6 89", "Mode: c (7)" },
/* 42*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "Aatel:a", 0, "(6) 272 280 262 76 271 161", "Mode: c (7)" },
/* 43*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "Atel:aAa", 0, "(8) 272 275 6 89 275 148 0 42", "Mode: c (8)" },
/* 44*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "tel:AAaa", 0, "(8) 272 275 271 161 6 28 262 118", "Mode: c (8)" },
/* 45*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "AAaatel:aA", 0, "(10) 272 276 0 42 0 41 118 46 6 156", "Mode: c (10)" },
/* 46*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "émailto:étel:éfile:éhttp://éhttps://éftp://", 0, "(18) 257 233 276 282 233 277 282 233 278 282 233 279 282 233 280 282 233 281", "Mode: 8ccccccc8cccc8ccccc8ccccccc8cccccccc8cccccc (43)" },
/* 47*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "éhttp://www.url.com", 0, "(9) 257 233 279 269 186 113 81 45 252", "Mode: 8cccccccccccccccccc (19)" },
/* 48*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "éhttps://www.url.com", 0, "(9) 257 233 280 269 186 113 81 45 252", "Mode: 8ccccccccccccccccccc (20)" },
/* 49*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "http://url.com", 0, "(8) 281 117 114 108 46 99 111 109", "Mode: 8888888 (7)" },
/* 50*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "https://url.com", 0, "(8) 282 117 114 108 46 99 111 109", "Mode: 8888888 (7)" },
/* 51*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "http://url.com", 0, "(6) 281 262 133 216 269 251", "Mode: ccccccc (7)" },
/* 52*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "https://url.com", 0, "(6) 282 262 133 216 269 251", "Mode: ccccccc (7)" },
/* 53*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "{", 0, "(2) 272 123", "Mode: a (1)" },
/* 54*/ { UNICODE_MODE, 0, -1, -1, { 2, 3, "" }, "A", 0, "(2) 257 65", "" },
/* 55*/ { UNICODE_MODE, 0, -1, -1, { 1, 1, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 558: Structured Append count out of range (2-8)", "" },
/* 56*/ { UNICODE_MODE, 0, -1, -1, { 1, 9, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 558: Structured Append count out of range (2-8)", "" },
/* 57*/ { UNICODE_MODE, 0, -1, -1, { 0, 3, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 559: Structured Append index out of range (1-3)", "" },
/* 58*/ { UNICODE_MODE, 0, -1, -1, { 4, 3, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 559: Structured Append index out of range (1-3)", "" },
/* 59*/ { UNICODE_MODE, 0, -1, -1, { 8, 8, "0" }, "A", 0, "(2) 257 65", "" },
/* 60*/ { UNICODE_MODE, 0, -1, -1, { 8, 8, "80088" }, "A", 0, "(2) 257 65", "" },
/* 61*/ { UNICODE_MODE, 0, -1, -1, { 8, 8, "123456" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 727: Structured Append ID too long (5 digit maximum)", "" },
/* 62*/ { UNICODE_MODE, 0, -1, -1, { 8, 8, "A" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 728: Invalid Structured Append ID (digits only)", "" },
/* 63*/ { UNICODE_MODE, 0, -1, -1, { 8, 8, "80089" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 729: Structured Append ID '80089' out of range (1-80088)", "" },
/* 0*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 0, "" }, "A", 0, "(2) 257 65", "Default (Revision 1)" },
/* 1*/ { UNICODE_MODE, 0, -1, 1, -1, { 0, 0, "" }, "A", 0, "(2) 257 65", "Revision 1" },
/* 2*/ { UNICODE_MODE, 0, -1, 2, -1, { 0, 0, "" }, "A", 0, "(2) 257 65", "Revision 2 (no codeword changes)" },
/* 3*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "A", 0, "(2) 272 65", "" },
/* 4*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 0, "" }, "12", 0, "(3) 257 49 50", "" },
/* 5*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "12", 0, "(2) 272 140", "" },
/* 6*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 0, "" }, "123", 0, "(4) 257 49 50 51", "" },
/* 7*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "123", 0, "(3) 272 140 51", "" },
/* 8*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 0, "" }, "ABC", 0, "(4) 257 65 66 67", "" },
/* 9*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "ABC", 0, "(4) 272 65 66 67", "" },
/* 10*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "ULTRACODE_123456789!", 0, "(17) 272 85 76 84 82 65 67 79 68 69 95 140 162 184 206 57 33", "" },
/* 11*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 0, "" }, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, "(253) 257 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65", "252 chars EC2" },
/* 12*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 0, "" }, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", ZINT_ERROR_TOO_LONG, "Error 591: Data too long for selected error correction capacity", "253 chars EC2" },
/* 13*/ { UNICODE_MODE, 0, 1, -1, -1, { 0, 0, "" }, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, "(277) 257 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65", "276 chars EC0" },
/* 14*/ { UNICODE_MODE, 0, 1, -1, -1, { 0, 0, "" }, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", ZINT_ERROR_TOO_LONG, "Error 591: Data too long for selected error correction capacity", "277 chars EC0" },
/* 15*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 0, "" }, "é", 0, "(2) 257 233", "" },
/* 16*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 0, "" }, "β", ZINT_WARN_USES_ECI, "Warning (2) 263 226", "" },
/* 17*/ { UNICODE_MODE, 9, -1, -1, -1, { 0, 0, "" }, "β", 0, "(2) 263 226", "" },
/* 18*/ { UNICODE_MODE, 9, -1, -1, -1, { 0, 0, "" }, "βAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, "(253) 263 226 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65", "249 chars EC2" },
/* 19*/ { UNICODE_MODE, 9, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "A", 0, "(2) 272 65", "Note ECI ignored and not outputted if ULTRA_COMPRESSION and all ASCII" },
/* 20*/ { UNICODE_MODE, 15, -1, -1, -1, { 0, 0, "" }, "Ŗ", 0, "(2) 268 170", "" },
/* 21*/ { DATA_MODE, 898, -1, -1, -1, { 0, 0, "" }, "\001\002\003\004\377", 0, "(7) 278 130 1 2 3 4 255", "" },
/* 22*/ { DATA_MODE, 899, -1, -1, -1, { 0, 0, "" }, "\001\002\003\004\377", 0, "(6) 280 1 2 3 4 255", "" },
/* 23*/ { DATA_MODE, 900, -1, -1, -1, { 0, 0, "" }, "\001\002\003\004\377", 0, "(9) 257 274 137 128 1 2 3 4 255", "" },
/* 24*/ { DATA_MODE, 9999, -1, -1, -1, { 0, 0, "" }, "\001\002\003\004\377", 0, "(9) 257 274 227 227 1 2 3 4 255", "" },
/* 25*/ { DATA_MODE, 10000, -1, -1, -1, { 0, 0, "" }, "\001\002\003\004\377", 0, "(10) 257 275 129 128 128 1 2 3 4 255", "" },
/* 26*/ { DATA_MODE, 811799, -1, -1, -1, { 0, 0, "" }, "\001\002\003\004\377", 0, "(10) 257 275 209 145 227 1 2 3 4 255", "" },
/* 27*/ { DATA_MODE, 811800, -1, -1, -1, { 0, 0, "" }, "\001\002\003\004\377", ZINT_ERROR_INVALID_OPTION, "Error 590: ECI value not supported by Ultracode", "" },
/* 28*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "123,456,789/12,/3,4,/5//", 0, "(15) 272 140 231 173 234 206 257 140 44 262 242 44 264 47 47", "Mode: a (24)" },
/* 29*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "HEIMASÍÐA KENNARAHÁSKÓLA ÍSLANDS", 0, "(32) 257 256 46 151 78 210 205 208 258 5 148 28 72 2 167 52 127 193 83 75 211 267 76 65 32", "Mode: cccccc88cccccccccc8888aaa8cccccc (32)" },
/* 30*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 0, "" }, "HEIMASÍÐA KENNARAHÁSKÓLA ÍSLANDS", 0, "(33) 257 72 69 73 77 65 83 205 208 65 32 75 69 78 78 65 82 65 72 193 83 75 211 76 65 32 205", "" },
/* 31*/ { UNICODE_MODE, 10, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "אולטרה-קוד1234", 0, "(14) 264 224 229 236 232 248 228 45 247 229 227 267 140 162", "Mode: 8888888888aaaa (14); Figure G.3" },
/* 32*/ { UNICODE_MODE, 10, -1, -1, -1, { 0, 0, "" }, "אולטרה-קוד1234", 0, "(15) 264 224 229 236 232 248 228 45 247 229 227 49 50 51 52", "" },
/* 33*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "https://aimglobal.org/jcrv3tX", 0, "(16) 282 266 1 74 41 19 6 168 270 212 59 106 144 56 265 70", "Mode: c (21); Figure G.4a" },
/* 34*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 0, "" }, "https://aimglobal.org/jcrv3tX", 0, "(22) 282 97 105 109 103 108 111 98 97 108 46 111 114 103 47 106 99 114 118 51 116 88", "" },
/* 35*/ { GS1_MODE, 0, -1, -1, -1, { 0, 0, "" }, "[01]03453120000011[17]121125[10]ABCD1234", 0, "(20) 273 129 131 173 159 148 128 128 139 145 140 139 153 138 65 66 67 68 140 162", "Mode: a (34); Figure G.6 uses C43 for 6 of last 7 chars (same codeword count)" },
/* 36*/ { GS1_MODE, 0, -1, -1, -1, { 0, 0, "" }, "[17]120508[10]ABCD1234[410]9501101020917", 0, "(21) 273 145 140 133 136 138 65 66 67 68 140 162 272 169 137 178 139 129 130 137 145", "Mode: a (35)" },
/* 37*/ { GS1_MODE, 0, -1, -1, -1, { 0, 0, "" }, "[17]120508[10]ABCDEFGHI[410]9501101020917", 0, "(24) 273 145 140 133 136 138 65 66 67 68 69 70 71 72 73 272 169 137 178 139 129 130 137 145", "Mode: a (36)" },
/* 38*/ { GS1_MODE | GS1PARENS_MODE, 0, -1, -1, -1, { 0, 0, "" }, "(17)120508(10)ABCDEFGHI(410)9501101020917", 0, "(24) 273 145 140 133 136 138 65 66 67 68 69 70 71 72 73 272 169 137 178 139 129 130 137 145", "Mode: a (36)" },
/* 39*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "ftp://", 0, "(4) 272 278 269 165", "Mode: c (6)" },
/* 40*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, ".cgi", 0, "(4) 272 278 274 131", "Mode: c (4)" },
/* 41*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "ftp://a.cgi", 0, "(6) 272 280 269 123 274 131", "Mode: c (11)" },
/* 42*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "e: file:f.shtml !", 0, "(12) 272 280 30 94 236 235 72 233 39 52 267 250", "Mode: c (17)" },
/* 43*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "Aaatel:", 0, "(6) 272 280 262 76 6 89", "Mode: c (7)" },
/* 44*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "Aatel:a", 0, "(6) 272 280 262 76 271 161", "Mode: c (7)" },
/* 45*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "Atel:aAa", 0, "(8) 272 275 6 89 275 148 0 42", "Mode: c (8)" },
/* 46*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "tel:AAaa", 0, "(8) 272 275 271 161 6 28 262 118", "Mode: c (8)" },
/* 47*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "AAaatel:aA", 0, "(10) 272 276 0 42 0 41 118 46 6 156", "Mode: c (10)" },
/* 48*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "émailto:étel:éfile:éhttp://éhttps://éftp://", 0, "(18) 257 233 276 282 233 277 282 233 278 282 233 279 282 233 280 282 233 281", "Mode: 8ccccccc8cccc8ccccc8ccccccc8cccccccc8cccccc (43)" },
/* 49*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "éhttp://www.url.com", 0, "(9) 257 233 279 269 186 113 81 45 252", "Mode: 8cccccccccccccccccc (19)" },
/* 50*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "éhttps://www.url.com", 0, "(9) 257 233 280 269 186 113 81 45 252", "Mode: 8ccccccccccccccccccc (20)" },
/* 51*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 0, "" }, "http://url.com", 0, "(8) 281 117 114 108 46 99 111 109", "Mode: 8888888 (7)" },
/* 52*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 0, "" }, "https://url.com", 0, "(8) 282 117 114 108 46 99 111 109", "Mode: 8888888 (7)" },
/* 53*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "http://url.com", 0, "(6) 281 262 133 216 269 251", "Mode: ccccccc (7)" },
/* 54*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "https://url.com", 0, "(6) 282 262 133 216 269 251", "Mode: ccccccc (7)" },
/* 55*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "{", 0, "(2) 272 123", "Mode: a (1)" },
/* 56*/ { UNICODE_MODE, 0, -1, -1, -1, { 2, 3, "" }, "A", 0, "(2) 257 65", "" },
/* 57*/ { UNICODE_MODE, 0, -1, -1, -1, { 1, 1, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 558: Structured Append count out of range (2-8)", "" },
/* 58*/ { UNICODE_MODE, 0, -1, -1, -1, { 1, 9, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 558: Structured Append count out of range (2-8)", "" },
/* 59*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 3, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 559: Structured Append index out of range (1-3)", "" },
/* 60*/ { UNICODE_MODE, 0, -1, -1, -1, { 4, 3, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 559: Structured Append index out of range (1-3)", "" },
/* 61*/ { UNICODE_MODE, 0, -1, -1, -1, { 8, 8, "0" }, "A", 0, "(2) 257 65", "" },
/* 62*/ { UNICODE_MODE, 0, -1, -1, -1, { 8, 8, "80088" }, "A", 0, "(2) 257 65", "" },
/* 63*/ { UNICODE_MODE, 0, -1, -1, -1, { 8, 8, "123456" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 727: Structured Append ID too long (5 digit maximum)", "" },
/* 64*/ { UNICODE_MODE, 0, -1, -1, -1, { 8, 8, "A" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 728: Invalid Structured Append ID (digits only)", "" },
/* 65*/ { UNICODE_MODE, 0, -1, -1, -1, { 8, 8, "80089" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 729: Structured Append ID '80089' out of range (1-80088)", "" },
/* 66*/ { UNICODE_MODE, 0, -1, 3, -1, { 0, 0, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 592: Revision must be 1 or 2", "" },
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
@ -276,7 +280,7 @@ static void test_input(int index, int generate, int debug) {
symbol->debug = ZINT_DEBUG_TEST; // Needed to get codeword dump in errtxt
length = testUtilSetSymbol(symbol, BARCODE_ULTRA, data[i].input_mode, data[i].eci, data[i].option_1, -1, data[i].option_3, -1 /*output_options*/, data[i].data, -1, debug);
length = testUtilSetSymbol(symbol, BARCODE_ULTRA, data[i].input_mode, data[i].eci, data[i].option_1, data[i].option_2, data[i].option_3, -1 /*output_options*/, data[i].data, -1, debug);
if (data[i].structapp.count) {
symbol->structapp = data[i].structapp;
}
@ -285,8 +289,8 @@ static void test_input(int index, int generate, int debug) {
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d\n", i, ret, data[i].ret);
if (generate) {
printf(" /*%3d*/ { %s, %d, %d, %s, { %d, %d, \"%s\" }, \"%s\", %s, \"%s\", \"%s\" },\n",
i, testUtilInputModeName(data[i].input_mode), data[i].eci, data[i].option_1, testUtilOption3Name(data[i].option_3),
printf(" /*%3d*/ { %s, %d, %d, %d, %s, { %d, %d, \"%s\" }, \"%s\", %s, \"%s\", \"%s\" },\n",
i, testUtilInputModeName(data[i].input_mode), data[i].eci, data[i].option_1, data[i].option_2, testUtilOption3Name(data[i].option_3),
data[i].structapp.index, data[i].structapp.count, data[i].structapp.id,
testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), testUtilErrorName(data[i].ret), symbol->errtxt, data[i].comment);
} else {
@ -305,6 +309,7 @@ static void test_encode(int index, int generate, int debug) {
int input_mode;
int eci;
int option_1;
int option_2;
int option_3;
struct zint_structapp structapp;
char *data;
@ -319,7 +324,7 @@ static void test_encode(int index, int generate, int debug) {
// Based on AIMD/TSC15032-43 (v 0.99c), with values updated from BWIPP update 2021-07-14
// https://github.com/bwipp/postscriptbarcode/commit/4255810845fa8d45c6192dd30aee1fdad1aaf0cc
struct item data[] = {
/* 0*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "ULTRACODE_123456789!", 0, 13, 22, 1, "AIMD/TSC15032-43 Figure G.1 **NOT SAME** different compression",
/* 0*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "ULTRACODE_123456789!", 0, 13, 22, 1, "AIMD/TSC15032-43 Figure G.1 **NOT SAME** different compression",
"7777777777777777777777"
"7857865353533131551857"
"7767853515611616136717"
@ -334,7 +339,7 @@ static void test_encode(int index, int generate, int debug) {
"7817851653331136333857"
"7777777777777777777777"
},
/* 1*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "ULTRACODE_123456789!", 0, 13, 24, 1, "AIMD/TSC15032-43 Figure G.1 **NOT SAME** no compression",
/* 1*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 0, "" }, "ULTRACODE_123456789!", 0, 13, 24, 1, "AIMD/TSC15032-43 Figure G.1 **NOT SAME** no compression",
"777777777777777777777777"
"785786533153313111181157"
"776783361661161666676617"
@ -349,7 +354,7 @@ static void test_encode(int index, int generate, int debug) {
"781786166533113663683357"
"777777777777777777777777"
},
/* 2*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "HEIMASÍÐA KENNARAHÁSKÓLA ÍSLANDS", 0, 19, 23, 1, "AIMD/TSC15032-43 Figure G.2 **NOT SAME** different compression",
/* 2*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "HEIMASÍÐA KENNARAHÁSKÓLA ÍSLANDS", 0, 19, 23, 1, "AIMD/TSC15032-43 Figure G.2 **NOT SAME** different compression",
"77777777777777777777777"
"78878663151561555158557"
"77878315565635366667617"
@ -370,7 +375,7 @@ static void test_encode(int index, int generate, int debug) {
"78878333656153153368617"
"77777777777777777777777"
},
/* 3*/ { DATA_MODE, 0, -1, -1, { 0, 0, "" }, "\110\105\111\115\101\123\315\320\101\040\113\105\116\116\101\122\101\110\301\123\113\323\114\101\040\315\123\114\101\116\104\123", 0, 19, 23, 1, "AIMD/TSC15032-43 Figure G.2 **NOT SAME** no compression",
/* 3*/ { DATA_MODE, 0, -1, -1, -1, { 0, 0, "" }, "\110\105\111\115\101\123\315\320\101\040\113\105\116\116\101\122\101\110\301\123\113\323\114\101\040\315\123\114\101\116\104\123", 0, 19, 23, 1, "AIMD/TSC15032-43 Figure G.2 **NOT SAME** no compression",
"77777777777777777777777"
"78878633151153313358137"
"77878315666661161167617"
@ -391,7 +396,7 @@ static void test_encode(int index, int generate, int debug) {
"78878361115516163138317"
"77777777777777777777777"
},
/* 4*/ { UNICODE_MODE, 10, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "אולטרה-קוד1234", 0, 13, 19, 1, "AIMD/TSC15032-43 Figure G.3 Same except DCC correct whereas DCC in Figure G.3 is incorrent",
/* 4*/ { UNICODE_MODE, 10, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "אולטרה-קוד1234", 0, 13, 19, 1, "AIMD/TSC15032-43 Figure G.3 Same except DCC correct whereas DCC in Figure G.3 is incorrent",
"7777777777777777777"
"7857865565566616657"
"7737853333613351517"
@ -406,7 +411,7 @@ static void test_encode(int index, int generate, int debug) {
"7817851316355311357"
"7777777777777777777"
},
/* 5*/ { DATA_MODE, 0, -1, -1, { 0, 0, "" }, "\340\345\354\350\370\344\055\367\345\343\061\062\063\064", 0, 13, 20, 1, "AIMD/TSC15032-43 Figure G.3 **NOT SAME** no compression",
/* 5*/ { DATA_MODE, 0, -1, -1, -1, { 0, 0, "" }, "\340\345\354\350\370\344\055\367\345\343\061\062\063\064", 0, 13, 20, 1, "AIMD/TSC15032-43 Figure G.3 **NOT SAME** no compression",
"77777777777777777777"
"78578611115666161157"
"77678333656133516617"
@ -421,7 +426,7 @@ static void test_encode(int index, int generate, int debug) {
"78178613653553116357"
"77777777777777777777"
},
/* 6*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "https://aimglobal.org/jcrv3tX", 0, 13, 20, 1, "AIMD/TSC15032-43 Figure G.4a **NOT SAME** different compression; also DCC incorrect in figure",
/* 6*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "https://aimglobal.org/jcrv3tX", 0, 13, 20, 1, "AIMD/TSC15032-43 Figure G.4a **NOT SAME** different compression; also DCC incorrect in figure",
"77777777777777777777"
"78578655115631563137"
"77678563356513315617"
@ -436,7 +441,7 @@ static void test_encode(int index, int generate, int debug) {
"78178163363613633157"
"77777777777777777777"
},
/* 7*/ { GS1_MODE, 0, -1, -1, { 0, 0, "" }, "[01]03453120000011[17]121125[10]ABCD1234", 0, 13, 23, 1, "AIMD/TSC15032-43 Figure G.6 **NOT SAME** different compression and ECC; also DCC incorrect in figure",
/* 7*/ { GS1_MODE, 0, -1, -1, -1, { 0, 0, "" }, "[01]03453120000011[17]121125[10]ABCD1234", 0, 13, 23, 1, "AIMD/TSC15032-43 Figure G.6 **NOT SAME** different compression and ECC; also DCC incorrect in figure",
"77777777777777777777777"
"78578616535355353318157"
"77678553116631616667617"
@ -451,7 +456,7 @@ static void test_encode(int index, int generate, int debug) {
"78178335533356531518357"
"77777777777777777777777"
},
/* 8*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "A", 0, 13, 13, 1, "",
/* 8*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 0, "" }, "A", 0, 13, 13, 1, "",
"7777777777777"
"7857863335517"
"7717835163667"
@ -466,7 +471,7 @@ static void test_encode(int index, int generate, int debug) {
"7817833536357"
"7777777777777"
},
/* 9*/ { UNICODE_MODE, 0, 2, -1, { 0, 0, "" }, "1234567890123456789012", 0, 13, 24, 1, "Length 22 == 25 MCC (C) with EC1 so 6 ECC by Table 12",
/* 9*/ { UNICODE_MODE, 0, 2, -1, -1, { 0, 0, "" }, "1234567890123456789012", 0, 13, 24, 1, "Length 22 == 25 MCC (C) with EC1 so 6 ECC by Table 12",
"777777777777777777777777"
"785786663111111111181117"
"776783555536666666676667"
@ -481,7 +486,7 @@ static void test_encode(int index, int generate, int debug) {
"781786155535516355186337"
"777777777777777777777777"
},
/* 10*/ { UNICODE_MODE, 0, 2, -1, { 0, 0, "" }, "12345678901234567890123", 0, 13, 25, 1, "Length 23 == 26 MCC (C) with EC1 so 7 ECC by Table 12",
/* 10*/ { UNICODE_MODE, 0, 2, -1, -1, { 0, 0, "" }, "12345678901234567890123", 0, 13, 25, 1, "Length 23 == 26 MCC (C) with EC1 so 7 ECC by Table 12",
"7777777777777777777777777"
"7857863655511111111811117"
"7767831563666666666766667"
@ -496,7 +501,7 @@ static void test_encode(int index, int generate, int debug) {
"7817835653363636636836657"
"7777777777777777777777777"
},
/* 11*/ { UNICODE_MODE, 0, 1, -1, { 0, 0, "" }, "1", 0, 13, 11, 1, "Figure 3a min 2-row, EC0",
/* 11*/ { UNICODE_MODE, 0, 1, -1, -1, { 0, 0, "" }, "1", 0, 13, 11, 1, "Figure 3a min 2-row, EC0",
"77777777777"
"78578661517"
"77178355667"
@ -511,7 +516,7 @@ static void test_encode(int index, int generate, int debug) {
"78178365567"
"77777777777"
},
/* 12*/ { UNICODE_MODE, 0, 6, -1, { 0, 0, "" }, "1234567890123456789012", 0, 13, 28, 0, "Figure 3a max 2-row, EC5 **NOT SAME** extra col due to BWIPP update 2021-07-14; BWIPP chooses 3 rows instead",
/* 12*/ { UNICODE_MODE, 0, 6, -1, -1, { 0, 0, "" }, "1234567890123456789012", 0, 13, 28, 0, "Figure 3a max 2-row, EC5 **NOT SAME** extra col due to BWIPP update 2021-07-14; BWIPP chooses 3 rows instead",
"7777777777777777777777777777"
"7857863331131511111811111157"
"7717835613316666666766666617"
@ -526,7 +531,7 @@ static void test_encode(int index, int generate, int debug) {
"7817863633563563636863636637"
"7777777777777777777777777777"
},
/* 13*/ { UNICODE_MODE, 0, 1, -1, { 0, 0, "" }, "12345678901234567890123456789012345", 0, 19, 22, 1, "Figure 3b min 3-row, EC0 **NOT SAME** Zint min not same as real min as chooses lower rows first (would need row option)",
/* 13*/ { UNICODE_MODE, 0, 1, -1, -1, { 0, 0, "" }, "12345678901234567890123456789012345", 0, 19, 22, 1, "Figure 3b min 3-row, EC0 **NOT SAME** Zint min not same as real min as chooses lower rows first (would need row option)",
"7777777777777777777777"
"7887866511111111111817"
"7787833666666666666767"
@ -547,7 +552,7 @@ static void test_encode(int index, int generate, int debug) {
"7887831331656665333867"
"7777777777777777777777"
},
/* 14*/ { UNICODE_MODE, 0, 6, -1, { 0, 0, "" }, "1234567890123456789012345678901234567890123456789012345", 0, 19, 38, 0, "Figure 3b max 3-row, EC5 **NOT SAME** extra col due to BWIPP update 2021-07-14; BWIPP chooses 4 rows instead",
/* 14*/ { UNICODE_MODE, 0, 6, -1, -1, { 0, 0, "" }, "1234567890123456789012345678901234567890123456789012345", 0, 19, 38, 0, "Figure 3b max 3-row, EC5 **NOT SAME** extra col due to BWIPP update 2021-07-14; BWIPP chooses 4 rows instead",
"77777777777777777777777777777777777777"
"78878611311563611118111111111111111817"
"77878366156351555667666666666666666767"
@ -568,7 +573,7 @@ static void test_encode(int index, int generate, int debug) {
"78878166553313356538331656665333165837"
"77777777777777777777777777777777777777"
},
/* 15*/ { UNICODE_MODE, 0, 1, -1, { 0, 0, "" }, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012", 0, 25, 30, 1, "Figure 3c min 4-row, EC0 **NOT SAME** Zint min not same as real min as chooses lower rows first (would need row option)",
/* 15*/ { UNICODE_MODE, 0, 1, -1, -1, { 0, 0, "" }, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012", 0, 25, 30, 1, "Figure 3c min 4-row, EC0 **NOT SAME** Zint min not same as real min as chooses lower rows first (would need row option)",
"777777777777777777777777777777"
"788786511111111111181111111117"
"778783166666666666676666666667"
@ -595,7 +600,7 @@ static void test_encode(int index, int generate, int debug) {
"788785533666336663386663366667"
"777777777777777777777777777777"
},
/* 16*/ { UNICODE_MODE, 0, 6, -1, { 0, 0, "" }, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456", 0, 25, 50, 0, "Figure 3c max 4-row **NOT SAME** extra col due to BWIPP update 2021-07-14; BWIPP chooses 5 rows instead",
/* 16*/ { UNICODE_MODE, 0, 6, -1, -1, { 0, 0, "" }, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456", 0, 25, 50, 0, "Figure 3c max 4-row **NOT SAME** extra col due to BWIPP update 2021-07-14; BWIPP chooses 5 rows instead",
"77777777777777777777777777777777777777777777777777"
"78878631533313135518111111111111111811111111111117"
"77878315116161313667666666666666666766666666666667"
@ -622,7 +627,7 @@ static void test_encode(int index, int generate, int debug) {
"78878633351651561668633666336663366863366633666337"
"77777777777777777777777777777777777777777777777777"
},
/* 17*/ { UNICODE_MODE, 0, 1, -1, { 0, 0, "" }, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", 0, 31, 42, 1, "Figure 3d min 5-row, EC0 **NOT SAME** Zint min not same as real min as chooses lower rows first (would need row option)",
/* 17*/ { UNICODE_MODE, 0, 1, -1, -1, { 0, 0, "" }, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", 0, 31, 42, 1, "Figure 3d min 5-row, EC0 **NOT SAME** Zint min not same as real min as chooses lower rows first (would need row option)",
"777777777777777777777777777777777777777777"
"788786511111111111181111111111111118111117"
"778783366666666666676666666666666667666667"
@ -655,7 +660,7 @@ static void test_encode(int index, int generate, int debug) {
"788783616161616161681616161616161618616167"
"777777777777777777777777777777777777777777"
},
/* 18*/ { UNICODE_MODE, 0, 6, -1, { 0, 0, "" }, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012", 0, 31, 66, 1, "Figure 3d max 5-row, EC5 **NOT SAME** Max columns due to 282 limit is 60 not 61 as shown",
/* 18*/ { UNICODE_MODE, 0, 6, -1, -1, { 0, 0, "" }, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012", 0, 31, 66, 1, "Figure 3d max 5-row, EC5 **NOT SAME** Max columns due to 282 limit is 60 not 61 as shown",
"777777777777777777777777777777777777777777777777777777777777777777"
"788786563656553165385551111111111118111111111111111811111111111117"
"778783136511335313673366666666666667666666666666666766666666666667"
@ -688,7 +693,7 @@ static void test_encode(int index, int generate, int debug) {
"788786316551515665186353535353535358353535353535353853535353535357"
"777777777777777777777777777777777777777777777777777777777777777777"
},
/* 19*/ { UNICODE_MODE | ESCAPE_MODE, 0, -1, -1, { 0, 0, "" }, "[)>\\R06\\G17V12345\\G1P234TYU\\GS6789\\R\\E", 0, 13, 27, 0, "06 Macro; not supported by BWIPP",
/* 19*/ { UNICODE_MODE | ESCAPE_MODE, 0, -1, -1, -1, { 0, 0, "" }, "[)>\\R06\\G17V12345\\G1P234TYU\\GS6789\\R\\E", 0, 13, 27, 0, "06 Macro; not supported by BWIPP",
"777777777777777777777777777"
"785786311655611111181311157"
"771783153516566666676156617"
@ -703,7 +708,7 @@ static void test_encode(int index, int generate, int debug) {
"781783531133356335585331617"
"777777777777777777777777777"
},
/* 20*/ { UNICODE_MODE | ESCAPE_MODE, 0, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "[)>\\R06\\G17V12345\\G1P234TYU\\GS6789\\R\\E", 0, 13, 23, 0, "06 Macro; not supported by BWIPP",
/* 20*/ { UNICODE_MODE | ESCAPE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "[)>\\R06\\G17V12345\\G1P234TYU\\GS6789\\R\\E", 0, 13, 23, 0, "06 Macro; not supported by BWIPP",
"77777777777777777777777"
"78578613335635131318557"
"77678536566511516157617"
@ -718,7 +723,7 @@ static void test_encode(int index, int generate, int debug) {
"78178116153635315338657"
"77777777777777777777777"
},
/* 21*/ { UNICODE_MODE, 0, -1, -1, { 1, 2, "" }, "A", 0, 13, 14, 1, "Structured Append without File Number",
/* 21*/ { UNICODE_MODE, 0, -1, -1, -1, { 1, 2, "" }, "A", 0, 13, 14, 1, "Structured Append without File Number",
"77777777777777"
"78578633165557"
"77378351336117"
@ -733,7 +738,7 @@ static void test_encode(int index, int generate, int debug) {
"78178535111557"
"77777777777777"
},
/* 22*/ { UNICODE_MODE, 0, -1, -1, { 8, 8, "283" }, "A", 0, 13, 15, 1, "Structured Append with File Number",
/* 22*/ { UNICODE_MODE, 0, -1, -1, -1, { 8, 8, "283" }, "A", 0, 13, 15, 1, "Structured Append with File Number",
"777777777777777"
"785786353356157"
"773783115665317"
@ -748,6 +753,21 @@ static void test_encode(int index, int generate, int debug) {
"781785653516557"
"777777777777777"
},
/* 23*/ { UNICODE_MODE, 0, -1, 2, -1, { 0, 0, "" }, "ULTRACODE_123456789!", 0, 13, 24, 1, "Revision 2",
"777777777777777777777777"
"781786533153313111181157"
"776783361661161666676617"
"781786115156555511383357"
"775785556561633656175517"
"786781311653551535581657"
"778787878787878787878787"
"783781656113311311181117"
"776783333531166566676537"
"783786651315555113383357"
"776785515161666351175517"
"785786166533113663683357"
"777777777777777777777777"
},
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
@ -769,7 +789,7 @@ static void test_encode(int index, int generate, int debug) {
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
length = testUtilSetSymbol(symbol, BARCODE_ULTRA, data[i].input_mode, data[i].eci, data[i].option_1, -1, data[i].option_3, -1 /*output_options*/, data[i].data, -1, debug);
length = testUtilSetSymbol(symbol, BARCODE_ULTRA, data[i].input_mode, data[i].eci, data[i].option_1, data[i].option_2, data[i].option_3, -1 /*output_options*/, data[i].data, -1, debug);
if (data[i].structapp.count) {
symbol->structapp = data[i].structapp;
}
@ -778,8 +798,8 @@ static void test_encode(int index, int generate, int debug) {
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (generate) {
printf(" /*%3d*/ { %s, %d, %d, %s, { %d, %d, \"%s\" }, \"%s\", %s, %d, %d, %d, \"%s\",\n",
i, testUtilInputModeName(data[i].input_mode), data[i].eci, data[i].option_1, testUtilOption3Name(data[i].option_3),
printf(" /*%3d*/ { %s, %d, %d, %d, %s, { %d, %d, \"%s\" }, \"%s\", %s, %d, %d, %d, \"%s\",\n",
i, testUtilInputModeName(data[i].input_mode), data[i].eci, data[i].option_1, data[i].option_2, testUtilOption3Name(data[i].option_3),
data[i].structapp.index, data[i].structapp.count, data[i].structapp.id,
testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), testUtilErrorName(data[i].ret),
symbol->rows, symbol->width, data[i].bwipp_cmp, data[i].comment);
@ -794,11 +814,11 @@ static void test_encode(int index, int generate, int debug) {
ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row);
assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data);
if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, -1, data[i].option_3, debug)) {
if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, data[i].option_2, data[i].option_3, debug)) {
if (!data[i].bwipp_cmp) {
if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment);
} else {
ret = testUtilBwipp(i, symbol, data[i].option_1, -1, data[i].option_3, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf));
ret = testUtilBwipp(i, symbol, data[i].option_1, data[i].option_2, data[i].option_3, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf));
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected);

View File

@ -2164,7 +2164,7 @@ static const char *testUtilBwippName(int index, const struct zint_symbol *symbol
{ "codeone", BARCODE_CODEONE, 141, 0, 1, 0, 0, 0, },
{ "", BARCODE_GRIDMATRIX, 142, 0, 0, 0, 0, 0, },
{ "", BARCODE_UPNQR, 143, 0, 0, 0, 0, 0, },
{ "ultracode", BARCODE_ULTRA, 144, 1, 0, 0, 0, 0, },
{ "ultracode", BARCODE_ULTRA, 144, 1, 1, 0, 0, 0, },
{ "rectangularmicroqrcode", BARCODE_RMQR, 145, 1, 1, 0, 0, 0, },
};
static const int data_size = ARRAY_SIZE(data);
@ -2970,6 +2970,11 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
strlen(bwipp_opts_buf) ? " " : "", option_1 - 1);
bwipp_opts = bwipp_opts_buf;
}
if (option_2 >= 1 && option_2 <= 2) {
sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%srev=%d",
strlen(bwipp_opts_buf) ? " " : "", option_2);
bwipp_opts = bwipp_opts_buf;
}
}
}

View File

@ -1,6 +1,6 @@
--- /home/mburke/code/bwipp/postscriptbarcode/build/monolithic/barcode.ps 2021-08-18 23:59:51.940354995 +0100
+++ backend/tests/tools/bwipp_dump.ps 2021-08-19 00:18:26.935249878 +0100
@@ -26304,34 +26304,80 @@
--- /home/mburke/code/bwipp/postscriptbarcode/build/monolithic/barcode.ps 2021-09-29 13:06:28.204962959 +0100
+++ backend/tests/tools/bwipp_dump.ps 2021-09-29 13:09:29.965621202 +0100
@@ -26338,34 +26338,80 @@
pop
} ifelse
@ -100,7 +100,7 @@
end
@@ -26390,7 +26436,7 @@
@@ -26424,7 +26470,7 @@
pop
} ifelse
@ -109,7 +109,7 @@
% Get the result of encoding with ean8 and gs1-cc
options (lintype) (ean8) put
@@ -26398,29 +26444,75 @@
@@ -26432,29 +26478,75 @@
options (dontdraw) true put
% Plot the linear part
@ -205,7 +205,7 @@
end
@@ -26479,34 +26571,80 @@
@@ -26513,34 +26605,80 @@
pop
} ifelse
@ -305,7 +305,7 @@
end
@@ -26580,34 +26718,80 @@
@@ -26614,34 +26752,80 @@
/opt options
>> def
@ -405,7 +405,7 @@
end
@@ -26666,7 +26850,7 @@
@@ -26700,7 +26884,7 @@
pop
} ifelse
@ -414,7 +414,7 @@
options (lintype) (databaromni) put
options (linkage) true put
@@ -26677,7 +26861,7 @@
@@ -26711,7 +26895,7 @@
linear options //databaromni exec
dup (sbs) get /linsbs exch def
dup (bhs) get 0 get 72 mul /linheight exch def
@ -423,7 +423,7 @@
% Plot the separator
/sepfinder {
@@ -26708,20 +26892,66 @@
@@ -26742,20 +26926,66 @@
sep 0 [0 0 0] putinterval
sep sep length 4 sub [0 0 0 0] putinterval
18 sepfinder 64 sepfinder
@ -502,7 +502,7 @@
end
@@ -26779,7 +27009,7 @@
@@ -26813,7 +27043,7 @@
pop
} ifelse
@ -511,7 +511,7 @@
options (lintype) (databarstacked) put
options (linkage) true put
@@ -26790,7 +27020,7 @@
@@ -26824,7 +27054,7 @@
linear options //databarstacked exec
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
dup (pixy) get /linheight exch def
@ -520,7 +520,7 @@
% Plot the separator
/sepfinder {
@@ -26818,20 +27048,52 @@
@@ -26852,20 +27082,52 @@
sep 0 [ 0 0 0 0 ] putinterval
sep sep length 4 sub [ 0 0 0 0 ] putinterval
18 sepfinder
@ -585,7 +585,7 @@
end
@@ -26889,7 +27151,7 @@
@@ -26923,7 +27185,7 @@
pop
} ifelse
@ -594,7 +594,7 @@
options (lintype) (databarstackedomni) put
options (linkage) true put
@@ -26900,7 +27162,7 @@
@@ -26934,7 +27196,7 @@
linear options //databarstackedomni exec
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
dup (pixy) get /linheight exch def
@ -603,7 +603,7 @@
% Plot the separator
/sepfinder {
@@ -26928,20 +27190,52 @@
@@ -26962,20 +27224,52 @@
sep 0 [ 0 0 0 0 ] putinterval
sep sep length 4 sub [ 0 0 0 0 ] putinterval
18 sepfinder
@ -668,7 +668,7 @@
end
@@ -27114,7 +27408,7 @@
@@ -27148,7 +27442,7 @@
pop
} ifelse
@ -677,7 +677,7 @@
options (lintype) (databarlimited) put
options (linkage) true put
@@ -27125,7 +27419,7 @@
@@ -27159,7 +27453,7 @@
linear options //databarlimited exec
dup (sbs) get /linsbs exch def
dup (bhs) get 0 get 72 mul /linheight exch def
@ -686,7 +686,7 @@
% Plot the separator
mark
@@ -27133,22 +27427,68 @@
@@ -27167,22 +27461,68 @@
counttomark 1 sub array astore /sep exch def pop pop
sep 0 [0 0 0] putinterval
sep sep length 9 sub [0 0 0 0 0 0 0 0 0] putinterval % 4 + 5 right guard spaces
@ -769,7 +769,7 @@
end
@@ -27207,7 +27547,7 @@
@@ -27241,7 +27581,7 @@
pop
} ifelse
@ -778,7 +778,7 @@
options (lintype) (databarexpanded) put
options (linkage) true put
@@ -27218,7 +27558,7 @@
@@ -27252,7 +27592,7 @@
linear options //databarexpanded exec
dup (sbs) get /linsbs exch def
dup (bhs) get 0 get 72 mul /linheight exch def
@ -787,7 +787,7 @@
% Plot the separator
/sepfinder {
@@ -27247,20 +27587,60 @@
@@ -27281,20 +27621,60 @@
18 98 bot length 13 sub {} for
69 98 bot length 13 sub {} for
] {sepfinder} forall
@ -860,7 +860,7 @@
end
@@ -27318,7 +27698,7 @@
@@ -27352,7 +27732,7 @@
pop
} ifelse
@ -869,7 +869,7 @@
options (lintype) (databarexpandedstacked) put
options (linkage) true put
@@ -27329,7 +27709,7 @@
@@ -27363,7 +27743,7 @@
linear options //databarexpandedstacked exec
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
dup (pixy) get /linheight exch def
@ -878,7 +878,7 @@
% Plot the separator
/sepfinder {
@@ -27355,21 +27735,49 @@
@@ -27389,21 +27769,49 @@
19 98 bot length 13 sub {} for
70 98 bot length 13 sub {} for
] {sepfinder} forall
@ -941,7 +941,7 @@
end
@@ -27428,7 +27836,7 @@
@@ -27462,7 +27870,7 @@
pop
} ifelse
@ -950,7 +950,7 @@
options (inkspread) (0) put
options (dontdraw) true put
@@ -27455,35 +27863,87 @@
@@ -27489,35 +27897,87 @@
linear << options {} forall >> //gs1-128 exec
dup (sbs) get /linsbs exch def
dup (bhs) get 0 get 72 mul /linheight exch def
@ -1052,7 +1052,7 @@
end
@@ -28916,3 +29376,189 @@
@@ -28950,3 +29410,189 @@
% --END ENCODER hibcazteccode--
% --END TEMPLATE--

View File

@ -65,18 +65,35 @@ static const int ultra_mincols[] = {5, 13, 22, 29};
static const int kec[] = {0, 1, 2, 4, 6, 8}; // Value K(EC) from Table 12
static const int dccu[] = {
051363, 051563, 051653, 053153, 053163, 053513, 053563, 053613, // 0-7
053653, 056153, 056163, 056313, 056353, 056363, 056513, 056563, // 8-15
051316, 051356, 051536, 051616, 053156, 053516, 053536, 053616, // 16-23
053636, 053656, 056136, 056156, 056316, 056356, 056516, 056536 // 24-31
/* Taken from BWIPP - change in DCCU/DCCL tiles for revision 2 2021-09-28 */
static const unsigned short dccu[2][32] = {
{ // Revision 1
051363, 051563, 051653, 053153, 053163, 053513, 053563, 053613, // 0-7
053653, 056153, 056163, 056313, 056353, 056363, 056513, 056563, // 8-15
051316, 051356, 051536, 051616, 053156, 053516, 053536, 053616, // 16-23
053636, 053656, 056136, 056156, 056316, 056356, 056516, 056536 // 24-31
},
{ // Revision 2 (inversion of DCCL Revision 1)
015316, 016316, 013516, 016516, 013616, 015616, 013136, 015136, // 0-7
016136, 013536, 016536, 013636, 013156, 016156, 015356, 013656, // 8-15
015313, 016313, 013513, 016513, 013613, 015613, 013153, 015153, // 16-23
016153, 016353, 013653, 015653, 013163, 015163, 015363, 013563 // 24-31
},
};
static const int dccl[] = {
061351, 061361, 061531, 061561, 061631, 061651, 063131, 063151, // 0-7
063161, 063531, 063561, 063631, 065131, 065161, 065351, 065631, // 8-15
031351, 031361, 031531, 031561, 031631, 031651, 035131, 035151, // 16-23
035161, 035361, 035631, 035651, 036131, 036151, 036351, 036531 // 24-31
static const unsigned short dccl[2][32] = {
{ // Revision 1
061351, 061361, 061531, 061561, 061631, 061651, 063131, 063151, // 0-7
063161, 063531, 063561, 063631, 065131, 065161, 065351, 065631, // 8-15
031351, 031361, 031531, 031561, 031631, 031651, 035131, 035151, // 16-23
035161, 035361, 035631, 035651, 036131, 036151, 036351, 036531 // 24-31
},
{ // Revision 2 (inversion of DCCU Revision 1)
036315, 036515, 035615, 035135, 036135, 031535, 036535, 031635, // 0-7
035635, 035165, 036165, 031365, 035365, 036365, 031565, 036565, // 8-15
061315, 065315, 063515, 061615, 065135, 061535, 063535, 061635, // 16-23
063635, 065635, 063165, 065165, 061365, 065365, 061565, 063565 // 24-31
},
};
static const int tiles[] = {
@ -872,6 +889,7 @@ INTERNAL int ultracode(struct zint_symbol *symbol, unsigned char source[], int l
char tilepat[6];
int tilex, tiley;
int dcc;
int revision_idx = 0;
#ifdef _MSC_VER
int *data_codewords;
char *pattern;
@ -953,6 +971,16 @@ INTERNAL int ultracode(struct zint_symbol *symbol, unsigned char source[], int l
data_cw_count += 2 + scr_cw_count; // 2 == MCC + ACC (data codeword count includes start char)
if (symbol->option_2 > 0) {
if (symbol->option_2 > 2) {
strcpy(symbol->errtxt, "592: Revision must be 1 or 2");
return ZINT_ERROR_INVALID_OPTION;
}
if (symbol->option_2 == 2) { /* Revision 2, swop and inversion of DCCU/DCCL tiles */
revision_idx = 1;
}
}
/* Default ECC level is EC2 */
if ((symbol->option_1 <= 0) || (symbol->option_1 > 6)) {
ecc_level = 2;
@ -1147,7 +1175,7 @@ INTERNAL int ultracode(struct zint_symbol *symbol, unsigned char source[], int l
tiley = (total_height - 11) / 2;
/* DCCU */
for (j = 0; j < 5; j++) {
tilepat[4 - j] = ultra_colour[(dccu[dcc] >> (3 * j)) & 0x07];
tilepat[4 - j] = ultra_colour[(dccu[revision_idx][dcc] >> (3 * j)) & 0x07];
}
for (j = 0; j < 5; j++) {
pattern[((tiley + j) * total_width) + tilex] = tilepat[j];
@ -1155,7 +1183,7 @@ INTERNAL int ultracode(struct zint_symbol *symbol, unsigned char source[], int l
/* DCCL */
tiley += 6;
for (j = 0; j < 5; j++) {
tilepat[4 - j] = ultra_colour[(dccl[dcc] >> (3 * j)) & 0x07];
tilepat[4 - j] = ultra_colour[(dccl[revision_idx][dcc] >> (3 * j)) & 0x07];
}
for (j = 0; j < 5; j++) {
pattern[((tiley + j) * total_width) + tilex] = tilepat[j];

View File

@ -3052,6 +3052,10 @@ symbol->option_3 = ULTRA_COMPRESSION;
WARNING: Ultracode data compression is experimental and should not be used
in a production environment.
Revision 2 of Ultracode (2021) which swops and inverts the DCCU and DCCL tiles
may be specified using the --vers= switch with a value of 2 or by setting
option_2 to 2.
Ultracode supports Structured Append of up to 8 symbols and an optional numeric
ID (File Number), which can be set by using the --structapp option (see section
4.15) or the API structapp variable. The ID ranges from 1 to 80088. If an ID is

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>grpChannel</class>
<widget class="QWidget" name="grpChannel">
<class>grpCodeOne</class>
<widget class="QWidget" name="grpCodeOne">
<property name="geometry">
<rect>
<x>0</x>
@ -23,7 +23,7 @@
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="lblChannel">
<widget class="QLabel" name="lblC1Size">
<property name="text">
<string>Symbol Si&amp;ze:</string>
</property>
@ -103,7 +103,7 @@
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<widget class="QGroupBox" name="groupBoxC1EncodingMode">
<property name="title">
<string>Encoding Mode</string>
</property>

View File

@ -351,7 +351,8 @@ the data with a slash &quot;/&quot;</string>
</property>
<property name="toolTip">
<string>Only consider square versions on automatic symbol
size selection</string>
size selection
(ignored if disabled)</string>
</property>
<property name="checked">
<bool>true</bool>
@ -365,7 +366,8 @@ size selection</string>
</property>
<property name="toolTip">
<string>Consider DMRE versions on automatic symbol
size selection</string>
size selection
(ignored if disabled)</string>
</property>
<property name="checked">
<bool>false</bool>
@ -375,11 +377,12 @@ size selection</string>
<item>
<widget class="QCheckBox" name="chkDMGSSep">
<property name="text">
<string>&amp;Use separator GS for GS1</string>
<string>Use separator GS &amp;for GS1</string>
</property>
<property name="toolTip">
<string>Use Group Separator (ASCII 0x1D) to separate GS1 AIs
instead of the preferred FNC1</string>
instead of the preferred FNC1
(ignored if disabled)</string>
</property>
<property name="checked">
<bool>false</bool>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>grpAztec</class>
<widget class="QWidget" name="grpAztec">
<class>grpUltra</class>
<widget class="QWidget" name="grpUltra">
<property name="geometry">
<rect>
<x>0</x>
@ -34,6 +34,9 @@ based on data</string>
<property name="checked">
<bool>true</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroupUltraSizeECC</string>
</attribute>
</widget>
</item>
<item row="1" column="0">
@ -45,6 +48,9 @@ based on data</string>
<string>Set percentage of capacity to use for
error correction codewords</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroupUltraSizeECC</string>
</attribute>
</widget>
</item>
<item row="1" column="1">
@ -91,10 +97,40 @@ error correction codewords</string>
</item>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelUltraRevision">
<property name="text">
<string>Rev&amp;ision:</string>
</property>
<property name="toolTip">
<string>Set revision to use on output</string>
</property>
<property name="buddy">
<cstring>cmbUltraRevision</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="cmbUltraRevision">
<property name="toolTip">
<string>Set revision to use on output</string>
</property>
<item>
<property name="text">
<string>1 (default)</string>
</property>
</item>
<item>
<property name="text">
<string>2</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="grpUltraEncodingMode">
<widget class="QGroupBox" name="groupBoxUltraEncodingMode">
<property name="title">
<string>Encoding Mode</string>
</property>
@ -381,7 +417,7 @@ Value ranges from 1 to 80088
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>43</height>
<height>10</height>
</size>
</property>
</spacer>
@ -407,4 +443,7 @@ Value ranges from 1 to 80088
</hints>
</connection>
</connections>
<buttongroups>
<buttongroup name="buttonGroupUltraSizeECC"/>
</buttongroups>
</ui>

View File

@ -1092,6 +1092,7 @@ void MainWindow::change_options()
connect(widget_obj("radUltraAuto"), SIGNAL(clicked( bool )), SLOT(update_preview()));
connect(widget_obj("radUltraEcc"), SIGNAL(clicked( bool )), SLOT(update_preview()));
connect(widget_obj("cmbUltraEcc"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
connect(widget_obj("cmbUltraRevision"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
connect(widget_obj("radUltraStand"), SIGNAL(clicked( bool )), SLOT(update_preview()));
connect(widget_obj("radUltraGS1"), SIGNAL(clicked( bool )), SLOT(update_preview()));
connect(widget_obj("cmbUltraStructAppCount"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
@ -1675,10 +1676,11 @@ void MainWindow::update_preview()
if (m_optionWidget->findChild<QComboBox*>("cmbDM200Size")->currentIndex() == 0) {
// Supressing rectangles or allowing DMRE only makes sense if in automatic size mode
findChild<QCheckBox*>("chkDMRectangle")->setEnabled(true);
findChild<QCheckBox*>("chkDMRE")->setEnabled(true);
if (m_optionWidget->findChild<QCheckBox*>("chkDMRectangle")->isChecked())
m_bc.bc.setOption3(DM_SQUARE);
else {
if (m_optionWidget->findChild<QCheckBox*>("chkDMRectangle")->isChecked()) {
m_bc.bc.setOption3(DM_SQUARE);
findChild<QCheckBox*>("chkDMRE")->setEnabled(false);
} else {
findChild<QCheckBox*>("chkDMRE")->setEnabled(true);
if (m_optionWidget->findChild<QCheckBox*>("chkDMRE")->isChecked())
m_bc.bc.setOption3(DM_DMRE);
else
@ -1891,9 +1893,14 @@ void MainWindow::update_preview()
case BARCODE_ULTRA:
m_bc.bc.setSymbol(BARCODE_ULTRA);
if (m_optionWidget->findChild<QRadioButton*>("radUltraEcc")->isChecked())
m_bc.bc.setOption1(m_optionWidget->findChild<QComboBox*>("cmbUltraEcc")->currentIndex() + 1);
m_bc.bc.setOption1(get_combobox_index("cmbUltraEcc") + 1);
set_gs1_mode(m_optionWidget->findChild<QRadioButton*>("radUltraGS1")->isChecked());
item_val = get_combobox_index("cmbUltraRevision");
if (item_val > 0) {
m_bc.bc.setOption2(item_val + 1); // Combobox 0-based
}
item_val = get_combobox_index("cmbUltraStructAppCount");
if (item_val) {
QString id;
@ -2521,6 +2528,7 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology) {
settings.setValue("studio/bc/ultra/autoresizing", get_button_group_index(
QStringList() << "radUltraAuto" << "radUltraEcc"));
settings.setValue("studio/bc/ultra/ecc", get_combobox_index("cmbUltraEcc"));
settings.setValue("studio/bc/ultra/revision", get_combobox_index("cmbUltraRevision"));
settings.setValue("studio/bc/ultra/encoding_mode", get_button_group_index(
QStringList() << "radUltraStand" << "radUltraGS1"));
settings.setValue("studio/bc/ultra/structapp_count", get_combobox_index("cmbUltraStructAppCount"));
@ -2862,6 +2870,7 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology) {
set_radiobutton_from_setting(settings, "studio/bc/ultra/autoresizing",
QStringList() << "radUltraAuto" << "radUltraEcc");
set_combobox_from_setting(settings, "studio/bc/ultra/ecc", "cmbUltraEcc");
set_combobox_from_setting(settings, "studio/bc/ultra/revision", "cmbUltraRevision");
set_radiobutton_from_setting(settings, "studio/bc/ultra/encoding_mode",
QStringList() << "radUltraStand" << "radUltraGS1");
set_combobox_from_setting(settings, "studio/bc/ultra/structapp_count", "cmbUltraStructAppCount");