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.
lint_winding.c File Reference

Purpose

The winding linter ensures that the given data represents a meaningful Winding Direction on a roll, either "0" (face out), "1" (face in) or "9" (undefined).

Remarks
The Winding Direction is defined in the GS1 General Specifications section "Roll products - width, length, core diameter, direction, splices: AI (8001)".

Functional Description

◆ gs1_lint_winding()

GS1_SYNTAX_DICTIONARY_API gs1_lint_err_t gs1_lint_winding ( const char *const  data,
size_t *const  err_pos,
size_t *const  err_len 
)

Used to validate that an AI component is the string "0", "1" or "9".

Parameters
[in]dataPointer to the null-terminated data to be linted. Must not be NULL.
[out]err_posTo facilitate error highlighting, the start position of the bad data is written to this pointer, if not NULL.
[out]err_lenThe length of the bad data is written to this pointer, if not NULL.
Returns
GS1_LINTER_OK if okay.
GS1_LINTER_INVALID_WINDING_DIRECTION if the data is not "0", "1" or "9".
54{
55
56 assert(data);
57
58 /*
59 * The data must be either "0", "1" or "9".
60 *
61 */
62 if (strcmp(data, "0") != 0 && strcmp(data, "1") != 0 && strcmp(data, "9") != 0)
65 0,
66 strlen(data)
67 );
68
70
71}
#define GS1_LINTER_RETURN_ERROR(error, position, length)
Return from a linter indicating that a problem was detected with the given data.
Definition gs1syntaxdictionary-utils.h:77
#define GS1_LINTER_RETURN_OK
Return from a linter indicating that no problem was detected with the given data.
Definition gs1syntaxdictionary-utils.h:62
@ GS1_LINTER_INVALID_WINDING_DIRECTION
The winding direction must be either "0", "1" or "9".
Definition gs1syntaxdictionary.h:96