GS1 Syntax Dictionary: Linter reference
A reference to the AI component linter routines referred to by the GS1 Syntax Dictionary.
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".
53 {
54 
55  assert(data);
56 
57  /*
58  * The data must be either "0", "1" or "9".
59  *
60  */
61  if (strcmp(data, "0") != 0 && strcmp(data, "1") != 0 && strcmp(data, "9") != 0) {
62  if (err_pos) *err_pos = 0;
63  if (err_len) *err_len = strlen(data);
65  }
66 
67  return GS1_LINTER_OK;
68 
69 }
@ GS1_LINTER_OK
No issues were detected by the linter.
Definition: gs1syntaxdictionary.h:66
@ GS1_LINTER_INVALID_WINDING_DIRECTION
The winding direction must be either "0", "1" or "9".
Definition: gs1syntaxdictionary.h:85