mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
frontend: batch: for @ use + instead of * on Windows as * not allowed
in filenames GUI: sequence: similarly for * use + instead of * on Windows
This commit is contained in:
parent
d6dddfa2ce
commit
8525597b81
@ -342,10 +342,10 @@ format of the automatically generated sequence where characters have the
|
||||
meanings as given below:
|
||||
|
||||
| Character | Effect |
|
||||
|:-------------------|:------------------------|
|
||||
|`#` | Insert leading spaces |
|
||||
|:-------------------|:---------------------------------------------------|
|
||||
|`$` | Insert leading zeroes |
|
||||
|`*` | Insert leading asterisks|
|
||||
|`#` | Insert leading spaces |
|
||||
|`*` | Insert leading asterisks (or plus signs on Windows)|
|
||||
|Any other character | Interpreted literally |
|
||||
|
||||
Table: {#tbl:sequence_format_characters tag=": Sequence Format Characters"}
|
||||
@ -1243,10 +1243,10 @@ with `--batch` using special characters in the output filename as shown in the
|
||||
table below:
|
||||
|
||||
Input Character Interpretation
|
||||
--------------- ------------------------
|
||||
--------------- ------------------------------------------
|
||||
`~` Insert a number or 0
|
||||
`#` Insert a number or space
|
||||
`@` Insert a number or `*`
|
||||
`@` Insert a number or `*` (or `+` on Windows)
|
||||
Any other Insert literally
|
||||
|
||||
Table: {#tbl:batch_filename_formatting tag=": Batch Filename Formatting"}
|
||||
@ -1254,9 +1254,10 @@ Table: {#tbl:batch_filename_formatting tag=": Batch Filename Formatting"}
|
||||
The following table shows some examples to clarify this method:
|
||||
|
||||
Input Filenames Generated
|
||||
----------------- ------------------------------------------------
|
||||
----------------- ---------------------------------------------------
|
||||
`-o file~~~.svg` `file001.svg`, `file002.svg`, `file003.svg`
|
||||
`-o @@@@bar.png` `***1.png`, `***2.png`, `***3.png`
|
||||
`-o @@@@bar.png` `***1.png`, `***2.png`, `***3.png` (except Windows)
|
||||
`-o @@@@bar.png` `+++1.png`, `+++2.png`, `+++3.png` (on Windows)
|
||||
`-o my~~~bar.eps` `my001.bar.eps`, `my002.bar.eps`, `my003bar.eps`
|
||||
`-o t@es~t~.png` `t*es0t1.png`, `t*es0t2.png`, `t*es0t3.png`
|
||||
|
||||
|
@ -502,10 +502,10 @@ format of the automatically generated sequence where characters have the
|
||||
meanings as given below:
|
||||
|
||||
Character Effect
|
||||
--------------------- --------------------------
|
||||
# Insert leading spaces
|
||||
--------------------- -----------------------------------------------------
|
||||
$ Insert leading zeroes
|
||||
* Insert leading asterisks
|
||||
# Insert leading spaces
|
||||
* Insert leading asterisks (or plus signs on Windows)
|
||||
Any other character Interpreted literally
|
||||
|
||||
: Table : Sequence Format Characters:
|
||||
@ -1319,10 +1319,10 @@ By default Zint will output numbered filenames starting with 00001.png,
|
||||
below:
|
||||
|
||||
Input Character Interpretation
|
||||
----------------- --------------------------
|
||||
----------------- ----------------------------------------
|
||||
~ Insert a number or 0
|
||||
# Insert a number or space
|
||||
@ Insert a number or *
|
||||
@ Insert a number or * (or + on Windows)
|
||||
Any other Insert literally
|
||||
|
||||
: Table : Batch Filename Formatting:
|
||||
@ -1330,9 +1330,10 @@ below:
|
||||
The following table shows some examples to clarify this method:
|
||||
|
||||
Input Filenames Generated
|
||||
----------------- --------------------------------------------
|
||||
----------------- -----------------------------------------------
|
||||
-o file~~~.svg file001.svg, file002.svg, file003.svg
|
||||
-o @@@@bar.png ***1.png, ***2.png, ***3.png
|
||||
-o @@@@bar.png ***1.png, ***2.png, ***3.png (except Windows)
|
||||
-o @@@@bar.png +++1.png, +++2.png, +++3.png (on Windows)
|
||||
-o my~~~bar.eps my001.bar.eps, my002.bar.eps, my003bar.eps
|
||||
-o t@es~t~.png t*es0t1.png, t*es0t2.png, t*es0t3.png
|
||||
|
||||
|
@ -702,7 +702,8 @@ static int batch_process(struct zint_symbol *symbol, const char *filename, const
|
||||
} else {
|
||||
file = fopen(filename, "rb");
|
||||
if (!file) {
|
||||
sprintf(symbol->errtxt, "102: Unable to read input file '%s'", filename);
|
||||
fprintf(stderr, "Error 102: Unable to read input file '%s'\n", filename);
|
||||
fflush(stderr);
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
@ -765,7 +766,11 @@ static int batch_process(struct zint_symbol *symbol, const char *filename, const
|
||||
adjusted[0] = reverse_number[inpos - 1];
|
||||
inpos--;
|
||||
} else {
|
||||
#ifndef _WIN32
|
||||
adjusted[0] = '*';
|
||||
#else
|
||||
adjusted[0] = '+';
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -469,6 +469,11 @@ static void test_input(int index, int debug) {
|
||||
|
||||
#define TEST_INPUT_LONG "test_67890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
|
||||
|
||||
#ifndef _WIN32
|
||||
#define TEST_INPUT_AMPERSAND_EXPECTED "***1.gif\000***2.gif"
|
||||
#else
|
||||
#define TEST_INPUT_AMPERSAND_EXPECTED "+++1.gif\000+++2.gif"
|
||||
#endif
|
||||
struct item {
|
||||
int b;
|
||||
int batch;
|
||||
@ -485,7 +490,7 @@ static void test_input(int index, int debug) {
|
||||
struct item data[] = {
|
||||
/* 0*/ { BARCODE_CODE128, 1, -1, 0, "gif", "123\n456\n", "", 2, "00001.gif\00000002.gif" },
|
||||
/* 1*/ { BARCODE_CODE128, 1, -1, 0, "gif", "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n", "~~~.gif", 10, "001.gif\000002.gif\000003.gif\000004.gif\000005.gif\000006.gif\000007.gif\000008.gif\000009.gif\000010.gif" },
|
||||
/* 2*/ { BARCODE_CODE128, 1, -1, 0, "gif", "123\n456\n", "@@@@.gif", 2, "***1.gif\000***2.gif" },
|
||||
/* 2*/ { BARCODE_CODE128, 1, -1, 0, "gif", "123\n456\n", "@@@@.gif", 2, TEST_INPUT_AMPERSAND_EXPECTED },
|
||||
/* 3*/ { BARCODE_CODE128, 1, -1, 0, "gif", "123\n456\n789\n", "#####.gif", 3, " 1.gif\000 2.gif\000 3.gif" },
|
||||
/* 4*/ { BARCODE_CODE128, 1, -1, 0, "gif", "123\n456\n", "test_batch~.gif", 2, "test_batch1.gif\000test_batch2.gif" },
|
||||
/* 5*/ { BARCODE_CODE128, 1, -1, 1, "gif", "123\n456\n7890123456789\n", NULL, 3, "123.gif\000456.gif\0007890123456789.gif" },
|
||||
|
@ -119,9 +119,9 @@
|
||||
<widget class="QLabel" name="lblSeqFormat">
|
||||
<property name="toolTip">
|
||||
<string>Format sequence using special characters<table cellspacing="3">
|
||||
<tr><td>#</td><td>Number or space</td></tr>
|
||||
<tr><td>$</td><td>Number or '0'</td></tr>
|
||||
<tr><td>*</td><td>Number or '*'</td></tr>
|
||||
<tr><td>#</td><td>Number or space</td></tr>
|
||||
<tr><td>*</td><td>Number or '*' ('+' on Windows)</td></tr>
|
||||
<tr><td>Other</td><td>Insert literally</td></tr>
|
||||
</table></string>
|
||||
</property>
|
||||
@ -137,9 +137,9 @@
|
||||
<widget class="QLineEdit" name="linSeqFormat">
|
||||
<property name="toolTip">
|
||||
<string>Format sequence using special characters<table cellspacing="3">
|
||||
<tr><td>#</td><td>Number or space</td></tr>
|
||||
<tr><td>$</td><td>Number or '0'</td></tr>
|
||||
<tr><td>*</td><td>Number or '*'</td></tr>
|
||||
<tr><td>#</td><td>Number or space</td></tr>
|
||||
<tr><td>*</td><td>Number or '*' ('+' on Windows)</td></tr>
|
||||
<tr><td>Other</td><td>Insert literally</td></tr>
|
||||
</table></string>
|
||||
</property>
|
||||
|
@ -120,7 +120,11 @@ QString SequenceWindow::apply_format(const QString& raw_number)
|
||||
adjusted += raw_number[inpos - 1];
|
||||
inpos--;
|
||||
} else {
|
||||
#ifndef _WIN32
|
||||
adjusted += '*';
|
||||
#else
|
||||
adjusted += '+';
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -129,7 +133,7 @@ QString SequenceWindow::apply_format(const QString& raw_number)
|
||||
}
|
||||
}
|
||||
|
||||
for(i = format_len; i > 0; i--) {
|
||||
for (i = format_len; i > 0; i--) {
|
||||
reversed += adjusted[i - 1];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user