GS1 Barcode Syntax Tests reference
A reference to the AI component "linter" routines referred to by the GS1 Barcode Syntax Dictionary. Copyright (c) 2022-2024 GS1 AISBL.
|
Macros | |
#define | GCP_MIN_LENGTH 4 |
Currently the shortest GS1 Company Prefix is four digits. | |
The key
linter checks whether an input starts with a GS1 Company Prefix ("GCP").
GS1_SYNTAX_DICTIONARY_API gs1_lint_err_t gs1_lint_key | ( | const char *const | data, |
size_t *const | err_pos, | ||
size_t *const | err_len | ||
) |
Used to ensure that an AI component starts with a GCP.
GS1_LINTER_CUSTOM_GCP_LOOKUP
macro. valid
: Set to 1 if the GCP is valid (or should be treated as such). Otherwise 0.offline
: Set to 1 to indicate that the GCP data source is offline and the linter must fail. Otherwise 0.[in] | data | Pointer to the null-terminated data to be linted. Must not be NULL . |
[out] | err_pos | To facilitate error highlighting, the start position of the bad data is written to this pointer, if not NULL . |
[out] | err_len | The length of the bad data is written to this pointer, if not NULL . |
offline = 1
in order to return GS1_LINTER_GCP_DATASOURCE_OFFLINE when a user-provided GCP lookup service is unavailable is implementation specific. It depends on whether the desired behaviour is to fail open (return GS1_LINTER_OK) or to fail closed (return GS1_LINTER_GCP_DATASOURCE_OFFLINE). In the case that it is desirable to fail open then in addition to assigning offline = 0
it is necessary to assign valid = 1
to avoid returning GS1_LINTER_INVALID_GCP_PREFIX, which would be misleading in the event of service outage.