eci: All ECIs: update CLI main.c and tcl zint.c

This commit is contained in:
gitlost 2021-01-12 14:11:53 +00:00
parent 7fe930b4dc
commit e1e0aa7ac4
5 changed files with 74 additions and 79 deletions

View File

@ -662,13 +662,29 @@ static void test_utf8_to_eci_sb(int index) {
if (index != -1 && i != index) continue; if (index != -1 && i != index) continue;
for (int j = 0; j < 128; j++) { for (int j = 0; j < 128; j++) {
if (data[i].tab[j]) {
int k = j + 128; int k = j + 128;
if (data[i].tab[j]) {
int length = to_utf8(data[i].tab[j], source); int length = to_utf8(data[i].tab[j], source);
assert_nonzero(length, "i:%d to_utf8 length %d == 0\n", i, length); assert_nonzero(length, "i:%d to_utf8 length %d == 0\n", i, length);
ret = utf8_to_eci(data[i].eci, source, dest, &length); ret = utf8_to_eci(data[i].eci, source, dest, &length);
assert_zero(ret, "i:%d utf8_to_eci ret %d != 0\n", i, ret); assert_zero(ret, "i:%d utf8_to_eci ret %d != 0\n", i, ret);
assert_equal(*dest, k, "i:%d j:%d eci:%d codepoint:0x%x *dest 0x%X (%d) != 0x%X (%d)\n", i, j, data[i].eci, data[i].tab[j], *dest, *dest, k, k); assert_equal(*dest, k, "i:%d j:%d eci:%d codepoint:0x%x *dest 0x%X (%d) != 0x%X (%d)\n", i, j, data[i].eci, data[i].tab[j], *dest, *dest, k, k);
} else {
int length = to_utf8(k, source);
assert_nonzero(length, "i:%d to_utf8 length %d == 0\n", i, length);
ret = utf8_to_eci(data[i].eci, source, dest, &length);
if (ret == 0) { // Should be mapping for this codepoint in another entry
int found = 0;
for (int m = 0; m < 128; m++) {
if (data[i].tab[m] == k) {
found = 1;
break;
}
}
assert_nonzero(found, "i:%d j:%d eci:%d codepoint:0x%x source:%s not found utf8_to_eci ret %d == 0\n", i, j, data[i].eci, k, source, ret);
} else {
assert_equal(ret, ZINT_ERROR_INVALID_DATA, "i:%d j:%d eci:%d codepoint:0x%x source:%s utf8_to_eci ret %d != ZINT_ERROR_INVALID_DATA\n", i, j, data[i].eci, k, source, ret);
}
} }
} }
} }

18
backend_tcl/configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for zint 2.9.1.9. # Generated by GNU Autoconf 2.69 for zint 2.9.1.
# #
# #
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@ -577,8 +577,8 @@ MAKEFLAGS=
# Identity of this package. # Identity of this package.
PACKAGE_NAME='zint' PACKAGE_NAME='zint'
PACKAGE_TARNAME='zint' PACKAGE_TARNAME='zint'
PACKAGE_VERSION='2.9.1.9' PACKAGE_VERSION='2.9.1'
PACKAGE_STRING='zint 2.9.1.9' PACKAGE_STRING='zint 2.9.1'
PACKAGE_BUGREPORT='' PACKAGE_BUGREPORT=''
PACKAGE_URL='' PACKAGE_URL=''
@ -1318,7 +1318,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing. # Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh. # This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF cat <<_ACEOF
\`configure' configures zint 2.9.1.9 to adapt to many kinds of systems. \`configure' configures zint 2.9.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]... Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1380,7 +1380,7 @@ fi
if test -n "$ac_init_help"; then if test -n "$ac_init_help"; then
case $ac_init_help in case $ac_init_help in
short | recursive ) echo "Configuration of zint 2.9.1.9:";; short | recursive ) echo "Configuration of zint 2.9.1:";;
esac esac
cat <<\_ACEOF cat <<\_ACEOF
@ -1482,7 +1482,7 @@ fi
test -n "$ac_init_help" && exit $ac_status test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then if $ac_init_version; then
cat <<\_ACEOF cat <<\_ACEOF
zint configure 2.9.1.9 zint configure 2.9.1
generated by GNU Autoconf 2.69 generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc. Copyright (C) 2012 Free Software Foundation, Inc.
@ -1847,7 +1847,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
It was created by zint $as_me 2.9.1.9, which was It was created by zint $as_me 2.9.1, which was
generated by GNU Autoconf 2.69. Invocation command line was generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@ $ $0 $@
@ -9595,7 +9595,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their # report actual input values of CONFIG_FILES etc. instead of their
# values after options handling. # values after options handling.
ac_log=" ac_log="
This file was extended by zint $as_me 2.9.1.9, which was This file was extended by zint $as_me 2.9.1, which was
generated by GNU Autoconf 2.69. Invocation command line was generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES CONFIG_FILES = $CONFIG_FILES
@ -9648,7 +9648,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\ ac_cs_version="\\
zint config.status 2.9.1.9 zint config.status 2.9.1
configured by $0, generated by GNU Autoconf 2.69, configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\" with options \\"\$ac_cs_config\\"

View File

@ -384,17 +384,17 @@ static char *s_eci_list[] = {
"iso8859-14", /*16: ISO-8859-14 - Latin alphabet No. 8 (Celtic)*/ "iso8859-14", /*16: ISO-8859-14 - Latin alphabet No. 8 (Celtic)*/
"iso8859-15", /*17: ISO-8859-15 - Latin alphabet No. 9*/ "iso8859-15", /*17: ISO-8859-15 - Latin alphabet No. 9*/
"iso8859-16", /*18: ISO-8859-16 - Latin alphabet No. 10*/ "iso8859-16", /*18: ISO-8859-16 - Latin alphabet No. 10*/
"jis0208", /*20: ** Shift-JIS (JISX 0208 amd JISX 0201)*/ "jis0208", /*20: Shift JIS (JIS X 0208 and JIS X 0201)*/
"cp1250", /*21: Windows-1250*/ "cp1250", /*21: Windows-1250*/
"cp1251", /*22: Windows-1251*/ "cp1251", /*22: Windows-1251*/
"cp1252", /*23: Windows-1252*/ "cp1252", /*23: Windows-1252*/
"cp1256", /*24: Windows-1256*/ "cp1256", /*24: Windows-1256*/
"unicode", /*25: ** UCS-2 Unicode (High order byte first)*/ "unicode", /*25: UCS-2BE (High order byte first) Unicode BMP*/
"utf-8", /*26: Unicode (UTF-8)*/ "utf-8", /*26: Unicode (UTF-8)*/
"ascii", /*27: ISO-646:1991 7-bit character set*/ "ascii", /*27: ISO-646:1991 7-bit character set*/
"big5", /*28: ** Big-5 (Taiwan) Chinese Character Set*/ "big5", /*28: Big5 (Taiwan) Chinese Character Set*/
"euc-cn", /*29: ** GB (PRC) Chinese Character Set*/ "euc-cn", /*29: GB (PRC) Chinese Character Set*/
"iso2022-kr", /*30: ** Korean Character Set (KSX1001:1998)*/ "iso2022-kr", /*30: Korean Character Set (KS X 1001:2002)*/
NULL NULL
}; };
@ -403,15 +403,6 @@ static int s_eci_number[] = {
3,4,5,6,7,8,9,10,11,12,13,15,16,17,18,20,21,22,23,24,25,26,27,28,29,30 3,4,5,6,7,8,9,10,11,12,13,15,16,17,18,20,21,22,23,24,25,26,27,28,29,30
}; };
/* Flag if an encoding is delivered as unicode. If not, native encoding is
* required.
* Those encodings are marked with "**" in the upper comments.
*/
static int s_eci_unicode_input[] = {
/* 3,4,5,6,7,8,9,10,11,12,13,15,16,17,18,20,21,22,23,24,25,26,27,28,29,30 */
1,1,1,1,1,1,1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0
};
/* Version information */ /* Version information */
static char version_string[] = VERSION; static char version_string[] = VERSION;
@ -1100,26 +1091,13 @@ static int Encode(Tcl_Interp *interp, int objc,
/* Binary data */ /* Binary data */
pStr = (char *) Tcl_GetByteArrayFromObj(objv[2], &lStr); pStr = (char *) Tcl_GetByteArrayFromObj(objv[2], &lStr);
} else { } else {
/* UTF8 Data (or ECI encoding) */ /* UTF8 Data */
if ( ! s_eci_unicode_input[ECIIndex]) {
/* For this ECI, the Data must be encoded in the ECI encoding */
Tcl_FreeEncoding(hZINTEncoding);
hZINTEncoding = Tcl_GetEncoding(interp, s_eci_list[ECIIndex]);
if (NULL == hZINTEncoding) {
/* Interpreter has error message */
fError = 1;
}
/* we must indicate binary data */
my_symbol->input_mode = DATA_MODE;
}
if (! fError ) {
pStr = Tcl_GetStringFromObj(objv[2], &lStr); pStr = Tcl_GetStringFromObj(objv[2], &lStr);
Tcl_UtfToExternalDString( hZINTEncoding, pStr, lStr, &dsInput); Tcl_UtfToExternalDString( hZINTEncoding, pStr, lStr, &dsInput);
pStr = Tcl_DStringValue( &dsInput ); pStr = Tcl_DStringValue( &dsInput );
lStr = Tcl_DStringLength( &dsInput ); lStr = Tcl_DStringLength( &dsInput );
} }
} }
}
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/* >>> Build symbol graphic */ /* >>> Build symbol graphic */
if (! fError ) { if (! fError ) {

View File

@ -532,11 +532,11 @@ ECI Code | Character Encoding Scheme
16 | ISO/IEC 8859-14 - Latin alphabet No. 8 (Celtic) 16 | ISO/IEC 8859-14 - Latin alphabet No. 8 (Celtic)
17 | ISO/IEC 8859-15 - Latin alphabet No. 9 17 | ISO/IEC 8859-15 - Latin alphabet No. 9
18 | ISO/IEC 8859-16 - Latin alphabet No. 10 18 | ISO/IEC 8859-16 - Latin alphabet No. 10
20 | Shift JIS (JIS X 0208 amd JIS X 0201) 20 | Shift JIS (JIS X 0208 and JIS X 0201)
21 | Windows-1250 - Latin 2 (Central Europe) 21 | Windows 1250 - Latin 2 (Central Europe)
22 | Windows-1251 - Cyrillic 22 | Windows 1251 - Cyrillic
23 | Windows-1252 - Latin 1 23 | Windows 1252 - Latin 1
24 | Windows-1256 - Arabic 24 | Windows 1256 - Arabic
25 | UCS-2BE (High order byte first) (Unicode BMP) 25 | UCS-2BE (High order byte first) (Unicode BMP)
26 | UTF-8 (Unicode) 26 | UTF-8 (Unicode)
27 | ISO/IEC 646:1991 7-bit character set (ASCII) 27 | ISO/IEC 646:1991 7-bit character set (ASCII)
@ -858,7 +858,7 @@ Variable Name | Type | Meaning | Default Value
symbology | integer | Symbol to use (see section | BARCODE_CODE128 symbology | integer | Symbol to use (see section | BARCODE_CODE128
| | 5.7). | | | 5.7). |
height | integer | Symbol height. [1] | 50 height | integer | Symbol height. [1] | 50
whitespace_width | integer | Whtespace width. | 0 whitespace_width | integer | Whitespace width. | 0
border_width | integer | Border width. | 0 border_width | integer | Border width. | 0
output_options | integer | Set various output file | 0 (none) output_options | integer | Set various output file | 0 (none)
| | parameters (see section | | | parameters (see section |
@ -1525,7 +1525,7 @@ PZN encodes a 7 digit number to which Zint will add a modulo-11 check digit.
6.1.8.5 LOGMARS 6.1.8.5 LOGMARS
--------------- ---------------
LOGMARS (Logistics Applications of Automated Marking and Reading Symbols) is a LOGMARS (Logistics Applications of Automated Marking and Reading Symbols) is a
variation of the Code 39 symbology used by the US Department of Defence. variation of the Code 39 symbology used by the US Department of Defense.
LOGMARS encodes the same character set as Standard Code 39. It does not require LOGMARS encodes the same character set as Standard Code 39. It does not require
a check digit but a modulo-43 check digit can be added by setting option_2 = 1 a check digit but a modulo-43 check digit can be added by setting option_2 = 1
or using --vers=1. or using --vers=1.
@ -1863,7 +1863,7 @@ symbol as described in section 6.1.3 and 5.1.4.
The 2D component of a composite symbol can use one of three systems: CC-A, CC-B The 2D component of a composite symbol can use one of three systems: CC-A, CC-B
and CC-C as described below. The 2D component type can be selected and CC-C as described below. The 2D component type can be selected
automatically by Zint dependant on the length of the input string. automatically by Zint dependent on the length of the input string.
Alternatively the three methods can be accessed using the --mode= prompt Alternatively the three methods can be accessed using the --mode= prompt
followed by 1, 2 or 3 for CC-A, CC-B or CC-C respectively, or by using the followed by 1, 2 or 3 for CC-A, CC-B or CC-C respectively, or by using the
option_1 variable as shown above. option_1 variable as shown above.
@ -2979,7 +2979,7 @@ Bar Code 1 Specification Source Page
SB Electronic Systems Telepen website SB Electronic Systems Telepen website
Pharmacode specifications from Laetus Pharmacode specifications from Laetus
Morovia RM4SCC specification Morovia RM4SCC specification
Austalia Post's 'A Guide to Printing the 4-State Barcode' and bcsample source Australia Post's 'A Guide to Printing the 4-State Barcode' and bcsample source
code code
Plessey algorithm from GNU-Barcode v0.98 by Leonid A. Broukhis Plessey algorithm from GNU-Barcode v0.98 by Leonid A. Broukhis
GS1 General Specifications v 8.0 Issue 2 GS1 General Specifications v 8.0 Issue 2
@ -3033,7 +3033,7 @@ international standards:
> ANSI/HIBC 2.6-2016 - The Health Industry Bar Code (HIBC) Supplier Labeling > ANSI/HIBC 2.6-2016 - The Health Industry Bar Code (HIBC) Supplier Labeling
Standard Standard
> AIM ISS-X-24 - Uniform Symbology Specification Codablock F > AIM ISS-X-24 - Uniform Symbology Specification Codablock F
> AIMD013 (v 1.34a) Information technology Automaic identification and data > AIMD013 (v 1.34a) Information technology Automatic identification and data
capture techniques Bar code symbology specification DotCode (Revised capture techniques Bar code symbology specification DotCode (Revised
19th Feb 2009) 19th Feb 2009)
> AIMD014 (v 1.63) - Information technology, Automatic identification and data > AIMD014 (v 1.63) - Information technology, Automatic identification and data

View File

@ -150,33 +150,34 @@ static void usage(void) {
/* Display supported ECI codes */ /* Display supported ECI codes */
static void show_eci(void) { static void show_eci(void) {
printf( " 3: ISO-8859-1 - Latin alphabet No. 1 (default)\n" printf( " 3: ISO/IEC 8859-1 - Latin alphabet No. 1 (default)\n"
" 4: ISO-8859-2 - Latin alphabet No. 2\n" " 4: ISO/IEC 8859-2 - Latin alphabet No. 2\n"
" 5: ISO-8859-3 - Latin alphabet No. 3\n" " 5: ISO/IEC 8859-3 - Latin alphabet No. 3\n"
" 6: ISO-8859-4 - Latin alphabet No. 4\n" " 6: ISO/IEC 8859-4 - Latin alphabet No. 4\n"
" 7: ISO-8859-5 - Latin/Cyrillic alphabet\n" " 7: ISO/IEC 8859-5 - Latin/Cyrillic alphabet\n"
" 8: ISO-8859-6 - Latin/Arabic alphabet\n" " 8: ISO/IEC 8859-6 - Latin/Arabic alphabet\n"
" 9: ISO-8859-7 - Latin/Greek alphabet\n" " 9: ISO/IEC 8859-7 - Latin/Greek alphabet\n"
"10: ISO-8859-8 - Latin/Hebrew alphabet\n" " 10: ISO/IEC 8859-8 - Latin/Hebrew alphabet\n"
"11: ISO-8859-9 - Latin alphabet No. 5\n" " 11: ISO/IEC 8859-9 - Latin alphabet No. 5 (Turkish)\n"
"12: ISO-8859-10 - Latin alphabet No. 6\n" " 12: ISO/IEC 8859-10 - Latin alphabet No. 6 (Nordic)\n"
"13: ISO-8859-11 - Latin/Thai alphabet\n" " 13: ISO/IEC 8859-11 - Latin/Thai alphabet\n"
"15: ISO-8859-13 - Latin alphabet No. 7\n" " 15: ISO/IEC 8859-13 - Latin alphabet No. 7 (Baltic)\n"
"16: ISO-8859-14 - Latin alphabet No. 8 (Celtic)\n" " 16: ISO/IEC 8859-14 - Latin alphabet No. 8 (Celtic)\n"
"17: ISO-8859-15 - Latin alphabet No. 9\n" " 17: ISO/IEC 8859-15 - Latin alphabet No. 9\n"
"18: ISO-8859-16 - Latin alphabet No. 10\n" " 18: ISO/IEC 8859-16 - Latin alphabet No. 10\n"
"20: ** Shift-JIS (JISX 0208 amd JISX 0201)\n" " 20: Shift JIS (JIS X 0208 and JIS X 0201)\n"
"21: Windows-1250\n" " 21: Windows 1250 - Latin 2 (Central Europe)\n"
"22: Windows-1251\n" " 22: Windows 1251 - Cyrillic\n"
"23: Windows-1252\n" " 23: Windows 1252 - Latin 1\n"
"24: Windows-1256\n" " 24: Windows 1256 - Arabic\n"
"25: ** UCS-2 Unicode (High order byte first)\n" " 25: UCS-2BE (High order byte first) (Unicode BMP)\n"
"26: Unicode (UTF-8)\n" " 26: UTF-8 (Unicode)\n"
"27: ISO-646:1991 7-bit character set\n" " 27: ISO/IEC 646:1991 7-bit character set (ASCII)\n"
"28: ** Big5 (Taiwan) Chinese Character Set\n" " 28: Big5 (Taiwan) Chinese Character Set\n"
" 29: ** GB (PRC) Chinese Character Set\n" " 29: ** GB (PRC) Chinese Character Set\n"
"30: ** Korean Character Set (KSX1001:1998)\n" " 30: Korean Character Set (KS X 1001:2002)\n"
"** See note in section 4.10 of the manual\n" "899: 8-bit binary data\n"
"** ECI 29 is GB 2312 except for Han Xin, when it is GB 18030\n"
); );
} }