GS1PARENS_MODE: allow parentheses in AI data if backslashed and

in `ESCAPE_MODE`
composite: empty primary now returns `ZINT_ERROR_INVALID_DATA`
  rather than `ZINT_ERROR_INVALID_OPTION`;
  check that primary NUL-terminated
library: check that `outfile` NUL-terminated
gs1: preface all routines and linters with "gs1_"
general: some code fiddling
This commit is contained in:
gitlost 2025-04-24 18:40:50 +01:00
parent 51ebca182c
commit fcb3f9b422
29 changed files with 1586 additions and 1184 deletions

View file

@ -676,10 +676,10 @@ Non-printing characters can be entered on the command line using backslash (\)
as an escape character in combination with the --esc switch. Permissible
sequences are shown in the table below.
----------------------------------------------------------------------------
------------------------------------------------------------------------------
Escape ASCII Name Interpretation
Sequence Equivalent
----------- ------------ ------- -------------------------------------------
----------- ------------ ------- ---------------------------------------------
\0 0x00 NUL Null character
\E 0x04 EOT End of Transmission
@ -704,6 +704,10 @@ sequences are shown in the table below.
\R 0x1E RS Record Separator
\( 0x28 ( Opening parenthesis (only with --gs1parens)
\) 0x29 ) Closing parenthesis (only with --gs1parens)
\\ 0x5C \ Backslash
\dNNN NNN Any 8-bit character where NNN is decimal
@ -718,9 +722,9 @@ sequences are shown in the table below.
\uNNNN Any 16-bit Unicode BMP[2] character where
NNNN is hexadecimal (0000-FFFF)
\UNNNNNN Any 21-bit Unicode character where NNNNNN
is hexadecimal (000000-10FFFF)
----------------------------------------------------------------------------
\UNNNNNN Any 21-bit Unicode character where NNNNNN is
hexadecimal (000000-10FFFF)
------------------------------------------------------------------------------
Table : Escape Sequences
@ -2359,7 +2363,8 @@ member. Valid values are shown in the table below.
GS1PARENS_MODE Parentheses (round brackets) used in GS1 data instead of
square brackets to delimit Application Identifiers
(parentheses must not otherwise occur in the data).
(parentheses in the data must be escaped and ESCAPE_MODE
selected).
GS1NOCHECK_MODE Do not check GS1 data for validity, i.e. suppress checks
for valid AIs and data lengths. Invalid characters (e.g.
@ -3198,11 +3203,13 @@ A variation of Code 128 previously known as UCC/EAN-128, this symbology is
defined by the GS1 General Specifications. Application Identifiers (AIs) should
be entered using [square bracket] notation. These will be converted to
parentheses (round brackets) for the Human Readable Text. This method allows the
inclusion of parentheses in the AI data.
inclusion of parentheses in the AI data without escaping.
For compatibility with data entry in other systems, if the data does not include
parentheses, the option --gs1parens (API input_mode |= GS1PARENS_MODE) may be
used to signal that AIs are encased in round brackets instead of square ones.
For compatibility with data entry in other systems, the option --gs1parens (API
input_mode |= GS1PARENS_MODE) may be used to signal that AIs are encased in
parentheses. If there are any parentheses in the AI data, they must be escaped
with a backslash (\( or \)) and the option --esc (API input_mode |= ESCAPE_MODE)
selected.
Fixed length data should be entered at the appropriate length for correct
encoding. GS1-128 does not support extended ASCII (ISO/IEC 8859-1) characters.
@ -3341,9 +3348,8 @@ Previously known as RSS Expanded this is a variable length symbology capable of
encoding data from a number of AIs in a single symbol. AIs should be encased in
[square brackets] in the input data, which will be displayed as parentheses
(round brackets) in the Human Readable Text. This method allows the inclusion of
parentheses in the AI data. If the data does not include parentheses, the AIs
may alternatively be encased in parentheses using the --gs1parens switch - see
6.1.10.3 GS1-128.
parentheses in the AI data without escaping. The AIs may alternatively be
encased in parentheses using the --gs1parens switch - see 6.1.10.3 GS1-128.
The GTIN-14 data for AI (01) must include the standard GS1 check digit as this
is not calculated by Zint when this symbology is encoded. Data for fixed-length
@ -5187,6 +5193,10 @@ OPTIONS
\e (0x1B) ESC Escape
\G (0x1D) GS Group Separator
\R (0x1E) RS Record Separator
\( (0x28) ( Opening parenthesis (only with
--gs1parens)
\) (0x29) ) Closing parenthesis (only with
--gs1parens)
\\ (0x5C) \ Backslash
\dNNN (NNN) Any 8-bit character where NNN is
decimal (000-255)
@ -5239,7 +5249,8 @@ OPTIONS
--gs1parens
Process parentheses "()" as GS1 AI delimiters, rather than square brackets
"[]". The input data must not otherwise contain parentheses.
"[]". If the AI data contains parentheses, they must be backslashed ("\(" or
"\)") and the --esc option selected.
--gssep