mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
gs1: update to latest gs1-syntax-dictionary (cset64, separate
latitude/longitude, mediatype, new AIs 7241, 7242, 8030) TODO: integrate gs1-syntax-engine BWIPP: update to latest (bwipp_dump.ps) manual: README: pandoc latest
This commit is contained in:
parent
a324fe90f6
commit
6733e76be4
118
backend/gs1.c
118
backend/gs1.c
@ -129,6 +129,39 @@ static int cset39(const unsigned char *data, int data_len, int offset, int min,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Validate of character set 64 (GSCN 21-307 Figure 7.11-3) */
|
||||||
|
static int cset64(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no,
|
||||||
|
int *p_err_posn, char err_msg[50]) {
|
||||||
|
|
||||||
|
data_len -= offset;
|
||||||
|
|
||||||
|
if (data_len < min) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data_len) {
|
||||||
|
const unsigned char *d = data + offset;
|
||||||
|
const unsigned char *const de = d + (data_len > max ? max : data_len);
|
||||||
|
|
||||||
|
for (; d < de; d++) {
|
||||||
|
/* 0-9, A-Z, a-z and "-", "_" */
|
||||||
|
if ((*d < '0' && *d != '-') || (*d > '9' && *d < 'A') || (*d > 'Z' && *d < 'a' && *d != '_')
|
||||||
|
|| *d > 'z') {
|
||||||
|
/* One or two "="s can be used as padding to mod 3 length */
|
||||||
|
if (*d == '=' && (d + 1 == de || (d + 2 == de && *(d + 1) == '=')) && data_len % 3 == 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
*p_err_no = 3;
|
||||||
|
*p_err_posn = d - data + 1;
|
||||||
|
sprintf(err_msg, "Invalid CSET 64 character '%c'", *d);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check a check digit (GS1 General Specifications 7.9.1) */
|
/* Check a check digit (GS1 General Specifications 7.9.1) */
|
||||||
static int csum(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no,
|
static int csum(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no,
|
||||||
int *p_err_posn, char err_msg[50], const int length_only) {
|
int *p_err_posn, char err_msg[50], const int length_only) {
|
||||||
@ -167,7 +200,6 @@ static int csum(const unsigned char *data, int data_len, int offset, int min, in
|
|||||||
/* Check alphanumeric check characters (GS1 General Specifications 7.9.5) */
|
/* Check alphanumeric check characters (GS1 General Specifications 7.9.5) */
|
||||||
static int csumalpha(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no,
|
static int csumalpha(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no,
|
||||||
int *p_err_posn, char err_msg[50], const int length_only) {
|
int *p_err_posn, char err_msg[50], const int length_only) {
|
||||||
(void)max;
|
|
||||||
|
|
||||||
data_len -= offset;
|
data_len -= offset;
|
||||||
|
|
||||||
@ -1179,35 +1211,89 @@ static int couponposoffer(const unsigned char *data, int data_len, int offset, i
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check WSG 84 latitude, longitude */
|
/* Check WSG 84 latitude */
|
||||||
static int latlong(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no,
|
static int latitude(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no,
|
||||||
int *p_err_posn, char err_msg[50], const int length_only) {
|
int *p_err_posn, char err_msg[50], const int length_only) {
|
||||||
(void)max;
|
|
||||||
|
|
||||||
data_len -= offset;
|
data_len -= offset;
|
||||||
|
|
||||||
if (data_len < min || (data_len && data_len < 20)) {
|
if (data_len < min || (data_len && data_len < 10)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!length_only && data_len) {
|
if (!length_only && data_len) {
|
||||||
const unsigned char *d = data + offset;
|
const unsigned char *d = data + offset;
|
||||||
const unsigned char *const de = d + (data_len > max ? max : data_len);
|
const unsigned char *const de = d + (data_len > max ? max : data_len);
|
||||||
uint64_t lat = 0, lng = 0;
|
uint64_t lat = 0;
|
||||||
|
|
||||||
for (; d < de; d++) {
|
for (; d < de; d++) {
|
||||||
if (de - d > 10) {
|
lat *= 10;
|
||||||
lat *= 10;
|
lat += *d - '0';
|
||||||
lat += *d - '0';
|
|
||||||
} else {
|
|
||||||
lng *= 10;
|
|
||||||
lng += *d - '0';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (lat > 1800000000 || lng > 3600000000) {
|
if (lat > 1800000000) {
|
||||||
*p_err_no = 3;
|
*p_err_no = 3;
|
||||||
*p_err_posn = d - 1 - data + 1 - 10 * (lat > 1800000000);
|
*p_err_posn = d - 1 - data + 1;
|
||||||
sprintf(err_msg, "Invalid %s", lat > 1800000000 ? "latitude" : "longitude");
|
strcpy(err_msg, "Invalid latitude");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check WSG 84 longitude */
|
||||||
|
static int longitude(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no,
|
||||||
|
int *p_err_posn, char err_msg[50], const int length_only) {
|
||||||
|
|
||||||
|
data_len -= offset;
|
||||||
|
|
||||||
|
if (data_len < min || (data_len && data_len < 10)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!length_only && data_len) {
|
||||||
|
const unsigned char *d = data + offset;
|
||||||
|
const unsigned char *const de = d + (data_len > max ? max : data_len);
|
||||||
|
uint64_t lng = 0;
|
||||||
|
|
||||||
|
for (; d < de; d++) {
|
||||||
|
lng *= 10;
|
||||||
|
lng += *d - '0';
|
||||||
|
}
|
||||||
|
if (lng > 3600000000) {
|
||||||
|
*p_err_no = 3;
|
||||||
|
*p_err_posn = d - 1 - data + 1;
|
||||||
|
strcpy(err_msg, "Invalid longitude");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check AIDC media type (GSCN-22-345 Figure 3.8.22-2) */
|
||||||
|
static int mediatype(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no,
|
||||||
|
int *p_err_posn, char err_msg[50], const int length_only) {
|
||||||
|
|
||||||
|
data_len -= offset;
|
||||||
|
|
||||||
|
if (data_len < min || (data_len && data_len < 2)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!length_only && data_len) {
|
||||||
|
const unsigned char *d = data + offset;
|
||||||
|
const unsigned char *const de = d + (data_len > max ? max : data_len);
|
||||||
|
unsigned int val = 0;
|
||||||
|
|
||||||
|
for (; d < de; d++) {
|
||||||
|
val *= 10;
|
||||||
|
val += *d - '0';
|
||||||
|
}
|
||||||
|
if (val == 0 || (val > 10 && val < 80)) {
|
||||||
|
*p_err_no = 3;
|
||||||
|
*p_err_posn = d - data + 1;
|
||||||
|
strcpy(err_msg, "Invalid AIDC media type");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* GS1 AI checker generated by "backend/tools/gen_gs1_lint.php" from
|
* GS1 AI checker generated by "backend/tools/gen_gs1_lint.php" from
|
||||||
* https://ref.gs1.org/tools/gs1-barcode-syntax-resource/syntax-dictionary/
|
* https://raw.githubusercontent.com/gs1/gs1-syntax-dictionary/main/gs1-syntax-dictionary.txt
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
libzint - the open source barcode library
|
libzint - the open source barcode library
|
||||||
Copyright (C) 2021-2022 Robin Stuart <rstuart114@gmail.com>
|
Copyright (C) 2021-2023 Robin Stuart <rstuart114@gmail.com>
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
@ -36,7 +36,7 @@
|
|||||||
#ifndef Z_GS1_LINT_H
|
#ifndef Z_GS1_LINT_H
|
||||||
#define Z_GS1_LINT_H
|
#define Z_GS1_LINT_H
|
||||||
|
|
||||||
/* N18,csum,key (Used by SSCC) */
|
/* N18,csum,key (Used by SSCC, GSRN - PROVIDER, GSRN - RECIPIENT) */
|
||||||
static int n18_csum_key(const unsigned char *data, const int data_len,
|
static int n18_csum_key(const unsigned char *data, const int data_len,
|
||||||
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
return data_len == 18
|
return data_len == 18
|
||||||
@ -88,7 +88,7 @@ static int x__28(const unsigned char *data, const int data_len,
|
|||||||
&& cset82(data, data_len, 0, 1, 28, p_err_no, p_err_posn, err_msg);
|
&& cset82(data, data_len, 0, 1, 28, p_err_no, p_err_posn, err_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* X..30 (Used by ADDITIONAL ID, CUST. PART NO., SECONDARY SERIAL, REF. TO SOURCE...) */
|
/* X..30 (Used by ADDITIONAL ID, CUST. PART No., SECONDARY SERIAL, REF. TO SOURCE...) */
|
||||||
static int x__30(const unsigned char *data, const int data_len,
|
static int x__30(const unsigned char *data, const int data_len,
|
||||||
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
return data_len >= 1 && data_len <= 30
|
return data_len >= 1 && data_len <= 30
|
||||||
@ -257,13 +257,16 @@ static int x2_iso3166alpha2(const unsigned char *data, const int data_len,
|
|||||||
&& iso3166alpha2(data, data_len, 0, 2, 2, p_err_no, p_err_posn, err_msg, 0);
|
&& iso3166alpha2(data, data_len, 0, 2, 2, p_err_no, p_err_posn, err_msg, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* N20,latlong (Used by SHIP TO GEO) */
|
/* N10,latitude N10,longitude (Used by SHIP TO GEO) */
|
||||||
static int n20_latlong(const unsigned char *data, const int data_len,
|
static int n10_latitude_n10_longitude(const unsigned char *data, const int data_len,
|
||||||
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
return data_len == 20
|
return data_len == 20
|
||||||
&& latlong(data, data_len, 0, 20, 20, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
&& latitude(data, data_len, 0, 10, 10, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
&& numeric(data, data_len, 0, 20, 20, p_err_no, p_err_posn, err_msg)
|
&& longitude(data, data_len, 10, 10, 10, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
&& latlong(data, data_len, 0, 20, 20, p_err_no, p_err_posn, err_msg, 0);
|
&& numeric(data, data_len, 0, 10, 10, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& latitude(data, data_len, 0, 10, 10, p_err_no, p_err_posn, err_msg, 0)
|
||||||
|
&& numeric(data, data_len, 10, 10, 10, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& longitude(data, data_len, 10, 10, 10, p_err_no, p_err_posn, err_msg, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* N1,yesno (Used by DANGEROUS GOODS, AUTH TO LEAVE, SIG REQUIRED) */
|
/* N1,yesno (Used by DANGEROUS GOODS, AUTH TO LEAVE, SIG REQUIRED) */
|
||||||
@ -397,6 +400,22 @@ static int x2_x__28(const unsigned char *data, const int data_len,
|
|||||||
&& cset82(data, data_len, 2, 1, 28, p_err_no, p_err_posn, err_msg);
|
&& cset82(data, data_len, 2, 1, 28, p_err_no, p_err_posn, err_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* N2,mediatype (Used by AIDC MEDIA TYPE) */
|
||||||
|
static int n2_mediatype(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len == 2
|
||||||
|
&& mediatype(data, data_len, 0, 2, 2, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
||||||
|
&& numeric(data, data_len, 0, 2, 2, p_err_no, p_err_posn, err_msg)
|
||||||
|
&& mediatype(data, data_len, 0, 2, 2, p_err_no, p_err_posn, err_msg, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* X..25 (Used by VCN, REF No.) */
|
||||||
|
static int x__25(const unsigned char *data, const int data_len,
|
||||||
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
|
return data_len >= 1 && data_len <= 25
|
||||||
|
&& cset82(data, data_len, 0, 1, 25, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
/* N4,nonzero N5,nonzero N3,nonzero N1,winding N1 (Used by DIMENSIONS) */
|
/* N4,nonzero N5,nonzero N3,nonzero N1,winding N1 (Used by DIMENSIONS) */
|
||||||
static int n4_nonzero_n5_nonzero_n3_nonzero_n1_winding_n1(const unsigned char *data, const int data_len,
|
static int n4_nonzero_n5_nonzero_n3_nonzero_n1_winding_n1(const unsigned char *data, const int data_len,
|
||||||
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
@ -500,15 +519,6 @@ static int x__25_csumalpha_key(const unsigned char *data, const int data_len,
|
|||||||
&& key(data, data_len, 0, 1, 25, p_err_no, p_err_posn, err_msg, 0);
|
&& key(data, data_len, 0, 1, 25, p_err_no, p_err_posn, err_msg, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* N18,csum (Used by GSRN - PROVIDER, GSRN - RECIPIENT) */
|
|
||||||
static int n18_csum(const unsigned char *data, const int data_len,
|
|
||||||
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
|
||||||
return data_len == 18
|
|
||||||
&& csum(data, data_len, 0, 18, 18, p_err_no, p_err_posn, err_msg, 1 /*length_only*/)
|
|
||||||
&& numeric(data, data_len, 0, 18, 18, p_err_no, p_err_posn, err_msg)
|
|
||||||
&& csum(data, data_len, 0, 18, 18, p_err_no, p_err_posn, err_msg, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* N..10 (Used by SRIN) */
|
/* N..10 (Used by SRIN) */
|
||||||
static int n__10(const unsigned char *data, const int data_len,
|
static int n__10(const unsigned char *data, const int data_len,
|
||||||
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
@ -516,11 +526,11 @@ static int n__10(const unsigned char *data, const int data_len,
|
|||||||
&& numeric(data, data_len, 0, 1, 10, p_err_no, p_err_posn, err_msg);
|
&& numeric(data, data_len, 0, 1, 10, p_err_no, p_err_posn, err_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* X..25 (Used by REF NO.) */
|
/* Z..90 (Used by DIGSIG) */
|
||||||
static int x__25(const unsigned char *data, const int data_len,
|
static int z__90(const unsigned char *data, const int data_len,
|
||||||
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
int *p_err_no, int *p_err_posn, char err_msg[50]) {
|
||||||
return data_len >= 1 && data_len <= 25
|
return data_len >= 1 && data_len <= 90
|
||||||
&& cset82(data, data_len, 0, 1, 25, p_err_no, p_err_posn, err_msg);
|
&& cset64(data, data_len, 0, 1, 90, p_err_no, p_err_posn, err_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* X..70,couponcode */
|
/* X..70,couponcode */
|
||||||
@ -724,7 +734,7 @@ static int gs1_lint(const int ai, const unsigned char *data, const int data_len,
|
|||||||
return x__30(data, data_len, p_err_no, p_err_posn, err_msg);
|
return x__30(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
}
|
}
|
||||||
if (ai == 4309) {
|
if (ai == 4309) {
|
||||||
return n20_latlong(data, data_len, p_err_no, p_err_posn, err_msg);
|
return n10_latitude_n10_longitude(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
}
|
}
|
||||||
if (ai == 4318) {
|
if (ai == 4318) {
|
||||||
return x__20(data, data_len, p_err_no, p_err_posn, err_msg);
|
return x__20(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
@ -795,6 +805,12 @@ static int gs1_lint(const int ai, const unsigned char *data, const int data_len,
|
|||||||
if (ai == 7240) {
|
if (ai == 7240) {
|
||||||
return x__20(data, data_len, p_err_no, p_err_posn, err_msg);
|
return x__20(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
}
|
}
|
||||||
|
if (ai == 7241) {
|
||||||
|
return n2_mediatype(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
if (ai == 7242) {
|
||||||
|
return x__25(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
} else if (ai < 8100) {
|
} else if (ai < 8100) {
|
||||||
|
|
||||||
@ -835,7 +851,7 @@ static int gs1_lint(const int ai, const unsigned char *data, const int data_len,
|
|||||||
return x__25_csumalpha_key(data, data_len, p_err_no, p_err_posn, err_msg);
|
return x__25_csumalpha_key(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
}
|
}
|
||||||
if (ai == 8017 || ai == 8018) {
|
if (ai == 8017 || ai == 8018) {
|
||||||
return n18_csum(data, data_len, p_err_no, p_err_posn, err_msg);
|
return n18_csum_key(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
}
|
}
|
||||||
if (ai == 8019) {
|
if (ai == 8019) {
|
||||||
return n__10(data, data_len, p_err_no, p_err_posn, err_msg);
|
return n__10(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
@ -843,6 +859,9 @@ static int gs1_lint(const int ai, const unsigned char *data, const int data_len,
|
|||||||
if (ai == 8020) {
|
if (ai == 8020) {
|
||||||
return x__25(data, data_len, p_err_no, p_err_posn, err_msg);
|
return x__25(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
}
|
}
|
||||||
|
if (ai == 8030) {
|
||||||
|
return z__90(data, data_len, p_err_no, p_err_posn, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
} else if (ai < 8200) {
|
} else if (ai < 8200) {
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -2,7 +2,7 @@
|
|||||||
/* Generate GS1 verify include "backend/gs1_lint.h" for "backend/gs1.c" */
|
/* Generate GS1 verify include "backend/gs1_lint.h" for "backend/gs1.c" */
|
||||||
/*
|
/*
|
||||||
libzint - the open source barcode library
|
libzint - the open source barcode library
|
||||||
Copyright (C) 2021-2022 <rstuart114@gmail.com>
|
Copyright (C) 2021-2023 <rstuart114@gmail.com>
|
||||||
*/
|
*/
|
||||||
/* SPDX-License-Identifier: BSD-3-Clause */
|
/* SPDX-License-Identifier: BSD-3-Clause */
|
||||||
|
|
||||||
@ -15,7 +15,7 @@
|
|||||||
* php backend/tools/gen_gs1_lint.php -f <local-path>/gs1-syntax-dictionary.txt backend/gs1_lint.h
|
* php backend/tools/gen_gs1_lint.php -f <local-path>/gs1-syntax-dictionary.txt backend/gs1_lint.h
|
||||||
*
|
*
|
||||||
*************************************************************************************************
|
*************************************************************************************************
|
||||||
* NOTE: up-to-update version requires syntax dictionary available from
|
* NOTE: up-to-date version requires syntax dictionary available from
|
||||||
* https://ref.gs1.org/tools/gs1-barcode-syntax-resource/syntax-dictionary/
|
* https://ref.gs1.org/tools/gs1-barcode-syntax-resource/syntax-dictionary/
|
||||||
*************************************************************************************************
|
*************************************************************************************************
|
||||||
*/
|
*/
|
||||||
@ -27,7 +27,7 @@ $dirdirname = basename(dirname($dirname)) . '/' . basename($dirname);
|
|||||||
$opts = getopt('c:f:h:l:t:');
|
$opts = getopt('c:f:h:l:t:');
|
||||||
|
|
||||||
$print_copyright = isset($opts['c']) ? (bool) $opts['c'] : true;
|
$print_copyright = isset($opts['c']) ? (bool) $opts['c'] : true;
|
||||||
$file = isset($opts['f']) ? $opts['f'] : 'https://ref.gs1.org/tools/gs1-barcode-syntax-resource/syntax-dictionary/';
|
$file = isset($opts['f']) ? $opts['f'] : 'https://raw.githubusercontent.com/gs1/gs1-syntax-dictionary/main/gs1-syntax-dictionary.txt';
|
||||||
$print_h_guard = isset($opts['h']) ? (bool) $opts['h'] : true;
|
$print_h_guard = isset($opts['h']) ? (bool) $opts['h'] : true;
|
||||||
$use_length_only = isset($opts['l']) ? (bool) $opts['l'] : true;
|
$use_length_only = isset($opts['l']) ? (bool) $opts['l'] : true;
|
||||||
$tab = isset($opts['t']) ? $opts['t'] : ' ';
|
$tab = isset($opts['t']) ? $opts['t'] : ' ';
|
||||||
@ -55,7 +55,8 @@ foreach ($lines as $line) {
|
|||||||
if ($line === '' || $line[0] === '#') {
|
if ($line === '' || $line[0] === '#') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!preg_match('/^([0-9]+(?:-[0-9]+)?) +([ *] )([NXYC][0-9.][ NXYC0-9.,a-z=|\[\]]*)(?:# (.+))?$/', $line, $matches)) {
|
if (!preg_match('/^([0-9]+(?:-[0-9]+)?) +([ *] )([NXYZ][0-9.][ NXYZ0-9.,a-z=|\[\]]*)(?:# (.+))?$/', $line, $matches)) {
|
||||||
|
print $line . PHP_EOL;
|
||||||
exit("$basename:" . __LINE__ . " ERROR: Could not parse line $line_no" . PHP_EOL);
|
exit("$basename:" . __LINE__ . " ERROR: Could not parse line $line_no" . PHP_EOL);
|
||||||
}
|
}
|
||||||
$ai = $matches[1];
|
$ai = $matches[1];
|
||||||
@ -121,7 +122,7 @@ foreach ($lines as $line) {
|
|||||||
foreach ($parts as $part) {
|
foreach ($parts as $part) {
|
||||||
$checkers = explode(',', $part);
|
$checkers = explode(',', $part);
|
||||||
$validator = array_shift($checkers);
|
$validator = array_shift($checkers);
|
||||||
if (preg_match('/^([NXYC])([0-9]+)?(\.\.[0-9|]+)?$/', $validator, $matches)) {
|
if (preg_match('/^([NXYZ])([0-9]+)?(\.\.[0-9|]+)?$/', $validator, $matches)) {
|
||||||
if (count($matches) === 3) {
|
if (count($matches) === 3) {
|
||||||
$min = $max = (int) $matches[2];
|
$min = $max = (int) $matches[2];
|
||||||
} else {
|
} else {
|
||||||
@ -132,10 +133,12 @@ foreach ($lines as $line) {
|
|||||||
$validator = "numeric";
|
$validator = "numeric";
|
||||||
} elseif ($matches[1] === 'X') {
|
} elseif ($matches[1] === 'X') {
|
||||||
$validator = "cset82";
|
$validator = "cset82";
|
||||||
} else {
|
} elseif ($matches[1] === 'Y') {
|
||||||
$validator = "cset39";
|
$validator = "cset39";
|
||||||
|
} else { // 'Z'
|
||||||
|
$validator = "cset64";
|
||||||
}
|
}
|
||||||
} else if (preg_match('/^\[([NXYC])([1-9]+)?(\.\.[0-9|]+)?\]$/', $validator, $matches)) {
|
} else if (preg_match('/^\[([NXYZ])([1-9]+)?(\.\.[0-9|]+)?\]$/', $validator, $matches)) {
|
||||||
if (count($matches) === 3) {
|
if (count($matches) === 3) {
|
||||||
$min = 0;
|
$min = 0;
|
||||||
$max = (int) $matches[2];
|
$max = (int) $matches[2];
|
||||||
@ -147,8 +150,10 @@ foreach ($lines as $line) {
|
|||||||
$validator = "numeric";
|
$validator = "numeric";
|
||||||
} elseif ($matches[1] === 'X') {
|
} elseif ($matches[1] === 'X') {
|
||||||
$validator = "cset82";
|
$validator = "cset82";
|
||||||
} else {
|
} elseif ($matches[1] === 'Y') {
|
||||||
$validator = "cset39";
|
$validator = "cset39";
|
||||||
|
} else { // 'Z'
|
||||||
|
$validator = "cset64";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
exit("$basename:" . __LINE__ . " ERROR: Could not parse validator \"$validator\" line $line_no" . PHP_EOL);
|
exit("$basename:" . __LINE__ . " ERROR: Could not parse validator \"$validator\" line $line_no" . PHP_EOL);
|
||||||
@ -234,7 +239,7 @@ if ($print_copyright) {
|
|||||||
print <<<'EOD'
|
print <<<'EOD'
|
||||||
/*
|
/*
|
||||||
libzint - the open source barcode library
|
libzint - the open source barcode library
|
||||||
Copyright (C) 2021-2022 Robin Stuart <rstuart114@gmail.com>
|
Copyright (C) 2021-2023 Robin Stuart <rstuart114@gmail.com>
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
|
10
docs/README
10
docs/README
@ -2,8 +2,8 @@ For generation of "docs/manual.pdf" and "docs/manual.txt" from "manual.pmd" usin
|
|||||||
|
|
||||||
On Ubuntu/Debian (tested on Ubuntu 22.04)
|
On Ubuntu/Debian (tested on Ubuntu 22.04)
|
||||||
|
|
||||||
wget https://github.com/jgm/pandoc/releases/download/3.1.3/pandoc-3.1.3-1-amd64.deb
|
wget https://github.com/jgm/pandoc/releases/download/3.1.4/pandoc-3.1.4-1-amd64.deb
|
||||||
sudo dpkg -i pandoc-3.1.3-1-amd64.deb
|
sudo dpkg -i pandoc-3.1.4-1-amd64.deb
|
||||||
sudo apt install python3-pip
|
sudo apt install python3-pip
|
||||||
pip install pandoc-tablenos --user
|
pip install pandoc-tablenos --user
|
||||||
export PATH=~/.local/bin:"$PATH"
|
export PATH=~/.local/bin:"$PATH"
|
||||||
@ -18,9 +18,9 @@ On Ubuntu/Debian (tested on Ubuntu 22.04)
|
|||||||
|
|
||||||
On Fedora (tested on Fedora Linux 38 (Workstation Edition))
|
On Fedora (tested on Fedora Linux 38 (Workstation Edition))
|
||||||
|
|
||||||
wget https://github.com/jgm/pandoc/releases/download/3.1.3/pandoc-3.1.3-linux-amd64.tar.gz
|
wget https://github.com/jgm/pandoc/releases/download/3.1.4/pandoc-3.1.4-linux-amd64.tar.gz
|
||||||
tar xf pandoc-3.1.3-linux-amd64.tar.gz
|
tar xf pandoc-3.1.4-linux-amd64.tar.gz
|
||||||
sudo mv -i pandoc-3.1.3/bin/pandoc /usr/local/bin
|
sudo mv -i pandoc-3.1.4/bin/pandoc /usr/local/bin
|
||||||
sudo dnf install python3-pip
|
sudo dnf install python3-pip
|
||||||
pip install pandoc-tablenos --user
|
pip install pandoc-tablenos --user
|
||||||
export PATH=~/.local/bin:"$PATH"
|
export PATH=~/.local/bin:"$PATH"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
% Zint Barcode Generator and Zint Barcode Studio User Manual
|
% Zint Barcode Generator and Zint Barcode Studio User Manual
|
||||||
% Version 2.12.0.9
|
% Version 2.12.0.9
|
||||||
% June 2023
|
% July 2023
|
||||||
|
|
||||||
# 1. Introduction
|
# 1. Introduction
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
Zint Barcode Generator and Zint Barcode Studio User Manual
|
Zint Barcode Generator and Zint Barcode Studio User Manual
|
||||||
Version 2.12.0.9
|
Version 2.12.0.9
|
||||||
June 2023
|
July 2023
|
||||||
|
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
* For reference the following is a text-only version of the Zint manual, *
|
* For reference the following is a text-only version of the Zint manual, *
|
||||||
@ -4494,7 +4494,7 @@ defined.
|
|||||||
|
|
||||||
Annex B. Man Page ZINT(1)
|
Annex B. Man Page ZINT(1)
|
||||||
|
|
||||||
% ZINT(1) Version 2.12.0.9 % % June 2023
|
% ZINT(1) Version 2.12.0.9 % % July 2023
|
||||||
|
|
||||||
NAME
|
NAME
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
.\" Automatically generated by Pandoc 3.1.3
|
.\" Automatically generated by Pandoc 3.1.4
|
||||||
.\"
|
.\"
|
||||||
.\" Define V font for inline verbatim, using C font in formats
|
.\" Define V font for inline verbatim, using C font in formats
|
||||||
.\" that render this, and otherwise B font.
|
.\" that render this, and otherwise B font.
|
||||||
@ -14,7 +14,7 @@
|
|||||||
. ftr VB CB
|
. ftr VB CB
|
||||||
. ftr VBI CBI
|
. ftr VBI CBI
|
||||||
.\}
|
.\}
|
||||||
.TH "ZINT" "1" "June 2023" "Version 2.12.0.9" ""
|
.TH "ZINT" "1" "July 2023" "Version 2.12.0.9" ""
|
||||||
.hy
|
.hy
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.PP
|
.PP
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
% ZINT(1) Version 2.12.0.9
|
% ZINT(1) Version 2.12.0.9
|
||||||
%
|
%
|
||||||
% June 2023
|
% July 2023
|
||||||
|
|
||||||
# NAME
|
# NAME
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user