Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,

GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
  better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
  namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
This commit is contained in:
gitlost
2022-05-09 19:50:50 +01:00
parent 3b9d989894
commit f58c80e290
81 changed files with 12026 additions and 4701 deletions

View File

@ -2,7 +2,7 @@
/*
libzint - the open source barcode library
Copyright (C) 2009 - 2021 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2009-2022 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -29,10 +29,9 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
/* vim: set ts=4 sw=4 et : */
#ifndef __COMMON_H
#define __COMMON_H
#ifndef Z_COMMON_H
#define Z_COMMON_H
#ifndef FALSE
#define FALSE 0
@ -49,19 +48,20 @@
/* `is_sane()` flags */
#define IS_SPC_F 0x0001 /* Space */
#define IS_HSH_F 0x0002 /* Hash sign # */
#define IS_PLS_F 0x0004 /* Plus sign + */
#define IS_MNS_F 0x0008 /* Minus sign - */
#define IS_NUM_F 0x0010 /* Number 0-9 */
#define IS_UPO_F 0x0020 /* Uppercase letter, apart from A-F and X */
#define IS_UHX_F 0x0040 /* Uppercase hex A-F */
#define IS_UX__F 0x0080 /* Uppercase X */
#define IS_LWO_F 0x0100 /* Lowercase letter, apart from a-f and x */
#define IS_LHX_F 0x0200 /* Lowercase hex a-f */
#define IS_LX__F 0x0400 /* Lowercase x */
#define IS_C82_F 0x0800 /* CSET82 punctuation (apart from - and +) */
#define IS_SIL_F 0x1000 /* SILVER/TECHNETIUM punctuation .$/% (apart from space, - and +) */
#define IS_CLI_F 0x2000 /* CALCIUM INNER punctuation $:/. (apart from - and +) (Codabar) */
#define IS_ARS_F 0x4000 /* ARSENIC uppercase subset (VIN) */
#define IS_AST_F 0x0004 /* Asterisk sign * */
#define IS_PLS_F 0x0008 /* Plus sign + */
#define IS_MNS_F 0x0010 /* Minus sign - */
#define IS_NUM_F 0x0020 /* Number 0-9 */
#define IS_UPO_F 0x0040 /* Uppercase letter, apart from A-F and X */
#define IS_UHX_F 0x0080 /* Uppercase hex A-F */
#define IS_UX__F 0x0100 /* Uppercase X */
#define IS_LWO_F 0x0200 /* Lowercase letter, apart from a-f and x */
#define IS_LHX_F 0x0400 /* Lowercase hex a-f */
#define IS_LX__F 0x0800 /* Lowercase x */
#define IS_C82_F 0x1000 /* CSET82 punctuation (apart from *, + and -) */
#define IS_SIL_F 0x2000 /* SILVER/TECHNETIUM punctuation .$/% (apart from space, + and -) */
#define IS_CLI_F 0x4000 /* CALCIUM INNER punctuation $:/. (apart from + and -) (Codabar) */
#define IS_ARS_F 0x8000 /* ARSENIC uppercase subset (VIN) */
#define IS_UPR_F (IS_UPO_F | IS_UHX_F | IS_UX__F) /* Uppercase letters */
#define IS_LWR_F (IS_LWO_F | IS_LHX_F | IS_LX__F) /* Lowercase letters */
@ -121,9 +121,9 @@
#define STATIC_UNLESS_ZINT_TEST static
#endif
#define COMMON_INLINE 1
#define Z_COMMON_INLINE 1
#ifdef COMMON_INLINE
#ifdef Z_COMMON_INLINE
/* Return true (1) if a module is dark/black, otherwise false (0) */
# define module_is_set(s, y, x) (((s)->encoded_data[(y)][(x) >> 3] >> ((x) & 0x07)) & 1)
@ -147,6 +147,7 @@ extern "C" {
INTERNAL void to_upper(unsigned char source[], const int length);
INTERNAL int chr_cnt(const unsigned char string[], const int length, const unsigned char c);
INTERNAL int is_chr(const unsigned int flg, const unsigned int c);
INTERNAL int is_sane(const unsigned int flg, const unsigned char source[], const int length);
INTERNAL int is_sane_lookup(const char test_string[], const int test_length, const unsigned char source[],
const int length, int *posns);
@ -154,7 +155,7 @@ extern "C" {
INTERNAL int bin_append_posn(const int arg, const int length, char *binary, const int bin_posn);
#ifndef COMMON_INLINE
#ifndef Z_COMMON_INLINE
INTERNAL int module_is_set(const struct zint_symbol *symbol, const int y_coord, const int x_coord);
INTERNAL void set_module(struct zint_symbol *symbol, const int y_coord, const int x_coord);
INTERNAL int module_colour_is_set(const struct zint_symbol *symbol, const int y_coord, const int x_coord);
@ -183,6 +184,9 @@ extern "C" {
INTERNAL float stripf(const float arg);
INTERNAL int segs_length(const struct zint_seg segs[], const int seg_count);
INTERNAL void segs_cpy(const struct zint_seg segs[], const int seg_count, struct zint_seg local_segs[]);
INTERNAL int colour_to_red(const int colour);
INTERNAL int colour_to_green(const int colour);
INTERNAL int colour_to_blue(const int colour);
@ -197,4 +201,5 @@ extern "C" {
}
#endif /* __cplusplus */
#endif /* __COMMON_H */
/* vim: set ts=4 sw=4 et : */
#endif /* Z_COMMON_H */