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:
gitlost 2022-07-04 21:55:06 +01:00
parent d6dddfa2ce
commit 8525597b81
6 changed files with 40 additions and 24 deletions

View File

@ -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`

View File

@ -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

View File

@ -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:

View File

@ -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" },

View File

@ -119,9 +119,9 @@
<widget class="QLabel" name="lblSeqFormat">
<property name="toolTip">
<string>Format sequence using special characters&lt;table cellspacing=&quot;3&quot;&gt;
&lt;tr&gt;&lt;td&gt;#&lt;/td&gt;&lt;td&gt;Number or space&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;$&lt;/td&gt;&lt;td&gt;Number or '0'&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;*&lt;/td&gt;&lt;td&gt;Number or '*'&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;#&lt;/td&gt;&lt;td&gt;Number or space&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;*&lt;/td&gt;&lt;td&gt;Number or '*' ('+' on Windows)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Other&lt;/td&gt;&lt;td&gt;Insert literally&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</string>
</property>
@ -137,9 +137,9 @@
<widget class="QLineEdit" name="linSeqFormat">
<property name="toolTip">
<string>Format sequence using special characters&lt;table cellspacing=&quot;3&quot;&gt;
&lt;tr&gt;&lt;td&gt;#&lt;/td&gt;&lt;td&gt;Number or space&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;$&lt;/td&gt;&lt;td&gt;Number or '0'&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;*&lt;/td&gt;&lt;td&gt;Number or '*'&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;#&lt;/td&gt;&lt;td&gt;Number or space&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;*&lt;/td&gt;&lt;td&gt;Number or '*' ('+' on Windows)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Other&lt;/td&gt;&lt;td&gt;Insert literally&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</string>
</property>

View File

@ -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: