Used to ensure that an AI component conforms to the modernised North American positive offer file coupon code standard, as carried in AI (8112).
73{
74
75 size_t pos;
76 int vli;
77 const char *p, *q;
78
79 assert(data);
80
81
82
83
84
85
86 for (pos = 0; data[pos] != '\0'; pos++) {
90 pos,
91 1
92 );
93 }
94
95 p = data;
96 q = data + pos;
97
98
99
100
101
102
103
104
108 0,
109 (size_t)(q - data)
110 );
111
115 (size_t)(p - data),
116 1
117 );
118
119
120
121
122
123
124
128 0,
129 (size_t)(q - data)
130 );
134 (size_t)(p - data),
135 1
136 );
137 vli = *p - '0' + 6;
138
142 (p == q) ? 0 : (size_t)(p - data),
143 (p == q) ? (size_t)(q - data) : (size_t)(q - p)
144 );
145
146 p += vli;
147
148
149
150
151
152
156 (p == q) ? 0 : (size_t)(p - data),
157 (p == q) ? (size_t)(q - data) : (size_t)(q - p)
158 );
159
160 p += 6;
161
162
163
164
165
166
167
171 0,
172 (size_t)(q - data)
173 );
174 vli = *p - '0' + 6;
175
179 (p == q) ? 0 : (size_t)(p - data),
180 (p == q) ? (size_t)(q - data) : (size_t)(q - p)
181 );
182
183 p += vli;
184
185
186
187
188
189
193 (size_t)(p - data),
194 (size_t)(q - p)
195 );
196
198
199}
#define GS1_LINTER_UNLIKELY(x)
Implemention may provide hint to the compiler that the expression is likely to be false.
Definition gs1syntaxdictionary-utils.h:76
#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:103
#define GS1_LINTER_RETURN_OK
Return from a linter indicating that no problem was detected with the given data.
Definition gs1syntaxdictionary-utils.h:88
@ GS1_LINTER_COUPON_MISSING_FORMAT_CODE
The coupon's Format Code is missing.
Definition gs1syntaxdictionary.h:123
@ GS1_LINTER_COUPON_INVALID_FORMAT_CODE
The coupon's Format Code must be "0" or "1".
Definition gs1syntaxdictionary.h:124
@ GS1_LINTER_COUPON_MISSING_SERIAL_NUMBER_VLI
The coupon's Serial Number VLI is missing.
Definition gs1syntaxdictionary.h:129
@ GS1_LINTER_COUPON_TRUNCATED_SERIAL_NUMBER
The coupon's Serial Number is shorter than what is indicated by its VLI.
Definition gs1syntaxdictionary.h:130
@ GS1_LINTER_COUPON_MISSING_FUNDER_VLI
The coupon's Funder VLI is missing.
Definition gs1syntaxdictionary.h:125
@ GS1_LINTER_COUPON_TRUNCATED_OFFER_CODE
The coupon's Offer Code is shorter than the required six digits.
Definition gs1syntaxdictionary.h:128
@ GS1_LINTER_COUPON_EXCESS_DATA
The coupon contains excess data after the recognised optional fields.
Definition gs1syntaxdictionary.h:178
@ GS1_LINTER_COUPON_INVALID_FUNDER_LENGTH
The coupon's Funder VLI must be "0" to "6".
Definition gs1syntaxdictionary.h:126
@ GS1_LINTER_NON_DIGIT_CHARACTER
A non-digit character was found where a digit is expected.
Definition gs1syntaxdictionary.h:78
@ GS1_LINTER_COUPON_TRUNCATED_FUNDER
The coupon's Funder is shorter than what is indicated by its VLI.
Definition gs1syntaxdictionary.h:127