backend: non-functional code-fiddling: format codablock.c (clang-format

+ manual); add SPDX to all files; prefix include guards with Z_;
  move vim comment to bottom; remove some trailing spaces
This commit is contained in:
gitlost 2022-09-13 21:16:31 +01:00
parent ee23f92151
commit e1522e0808
29 changed files with 500 additions and 510 deletions

View File

@ -1,6 +1,6 @@
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2020 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2020-2022 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
@ -27,7 +27,10 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
*/ */
/* vim: set ts=4 sw=4 et : */ /* SPDX-License-Identifier: BSD-3-Clause */
#ifndef Z_CHANNEL_PRECALCS_H
#define Z_CHANNEL_PRECALCS_H
/* Channel code precalculated values to avoid excessive looping */ /* Channel code precalculated values to avoid excessive looping */
/* To generate uncomment CHANNEL_GENERATE_PRECALCS define and run "backend/tests/test_channel -f generate -g" */ /* To generate uncomment CHANNEL_GENERATE_PRECALCS define and run "backend/tests/test_channel -f generate -g" */
@ -104,3 +107,6 @@ static channel_precalc channel_precalcs8[] = {
{ 7504623, { 1, 1, 3, 4, 3, 1, 1, 1, }, { 5, 2, 1, 1, 1, 1, 1, 3, }, { 8, 8, 8, 6, 3, 1, 1, }, { 8, 4, 3, 3, 3, 3, 3, }, }, { 7504623, { 1, 1, 3, 4, 3, 1, 1, 1, }, { 5, 2, 1, 1, 1, 1, 1, 3, }, { 8, 8, 8, 6, 3, 1, 1, }, { 8, 4, 3, 3, 3, 3, 3, }, },
{ 7623744, { 3, 1, 1, 2, 2, 1, 2, 3, }, { 5, 2, 1, 1, 1, 2, 1, 2, }, { 8, 6, 6, 6, 5, 4, 4, }, { 8, 4, 3, 3, 3, 3, 2, }, }, { 7623744, { 3, 1, 1, 2, 2, 1, 2, 3, }, { 5, 2, 1, 1, 1, 2, 1, 2, }, { 8, 6, 6, 6, 5, 4, 4, }, { 8, 4, 3, 3, 3, 3, 2, }, },
}; };
/* vim: set ts=4 sw=4 et : */
#endif /* Z_CHANNEL_PRECALCS_H */

View File

@ -1,4 +1,4 @@
/* codablock.c - Handles Codablock-F and Codablock-E */ /* codablock.c - Handles Codablock-F */
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2016-2022 Harald Oehlmann Copyright (C) 2016-2022 Harald Oehlmann
@ -30,11 +30,11 @@
*/ */
/* SPDX-License-Identifier: BSD-3-Clause */ /* SPDX-License-Identifier: BSD-3-Clause */
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include "common.h" #include "common.h"
#include "code128.h" #include "code128.h"
#include <assert.h>
#include <math.h>
#include <stdio.h>
#define uchar unsigned char #define uchar unsigned char
@ -51,18 +51,17 @@
#define ZTFNC1 (CodeA + CodeB + CodeC + CodeFNC1) #define ZTFNC1 (CodeA + CodeB + CodeC + CodeFNC1)
/* ASCII-Extension for Codablock-F */ /* ASCII-Extension for Codablock-F */
#define aFNC1 (uchar)(128) #define aFNC1 ((uchar) 128)
#define aFNC2 (uchar)(129) #define aFNC2 ((uchar) 129)
#define aFNC3 (uchar)(130) #define aFNC3 ((uchar) 130)
#define aFNC4 (uchar)(131) #define aFNC4 ((uchar) 131)
#define aCodeA (uchar)(132) #define aCodeA ((uchar) 132)
#define aCodeB (uchar)(133) #define aCodeB ((uchar) 133)
#define aCodeC (uchar)(134) #define aCodeC ((uchar) 134)
#define aShift (uchar)(135) #define aShift ((uchar) 135)
/* Code F Analysing-Chart */ /* Code F Analysing-Chart */
typedef struct sCharacterSetTable typedef struct sCharacterSetTable {
{
int CharacterSet; /* Still possible character sets for actual*/ int CharacterSet; /* Still possible character sets for actual*/
int AFollowing; /* Still following Characters in Charset A */ int AFollowing; /* Still following Characters in Charset A */
int BFollowing; /* Still following Characters in Charset B */ int BFollowing; /* Still following Characters in Charset B */
@ -73,8 +72,7 @@ typedef struct sCharacterSetTable
* The result is an or of CodeA, CodeB, CodeC, CodeFNC1, CodeFNC4 depending on the * The result is an or of CodeA, CodeB, CodeC, CodeFNC1, CodeFNC4 depending on the
* possible Code 128 character sets. * possible Code 128 character sets.
*/ */
static int GetPossibleCharacterSet(unsigned char C) static int GetPossibleCharacterSet(unsigned char C) {
{
if (C <= '\x1f') /* Control chars */ if (C <= '\x1f') /* Control chars */
return CodeA; return CodeA;
if (z_isdigit(C)) if (z_isdigit(C))
@ -97,8 +95,7 @@ static int GetPossibleCharacterSet(unsigned char C)
* int CFollowing The number of characters encodable in CodeC if we * int CFollowing The number of characters encodable in CodeC if we
* start here. * start here.
*/ */
static void CreateCharacterSetTable(CharacterSetTable T[], unsigned char *data, const int dataLength) static void CreateCharacterSetTable(CharacterSetTable T[], unsigned char *data, const int dataLength) {
{
int charCur; int charCur;
int runChar; int runChar;
@ -109,32 +106,24 @@ static void CreateCharacterSetTable(CharacterSetTable T[], unsigned char *data,
T[charCur].BFollowing = ((T[charCur].CharacterSet & CodeB) == 0) ? 0 : 1; T[charCur].BFollowing = ((T[charCur].CharacterSet & CodeB) == 0) ? 0 : 1;
T[charCur].CFollowing = 0; T[charCur].CFollowing = 0;
for (charCur--;charCur>=0;charCur--) for (charCur--; charCur >= 0; charCur--) {
{
T[charCur].CharacterSet = GetPossibleCharacterSet(data[charCur]); T[charCur].CharacterSet = GetPossibleCharacterSet(data[charCur]);
T[charCur].AFollowing= T[charCur].AFollowing = ((T[charCur].CharacterSet & CodeA) == 0) ? 0 : T[charCur + 1].AFollowing + 1;
((T[charCur].CharacterSet & CodeA)==0)?0:T[charCur+1].AFollowing+1; T[charCur].BFollowing = ((T[charCur].CharacterSet & CodeB) == 0) ? 0 : T[charCur + 1].BFollowing + 1;
T[charCur].BFollowing=
((T[charCur].CharacterSet & CodeB)==0)?0:T[charCur+1].BFollowing+1;
T[charCur].CFollowing = 0; T[charCur].CFollowing = 0;
} }
/* Find the CodeC-chains */ /* Find the CodeC-chains */
for (charCur=0;charCur<dataLength;charCur++) for (charCur = 0; charCur < dataLength; charCur++) {
{
T[charCur].CFollowing = 0; T[charCur].CFollowing = 0;
if ((T[charCur].CharacterSet & CodeC)!=0) if ((T[charCur].CharacterSet & CodeC) != 0) {
{
/* CodeC possible */ /* CodeC possible */
runChar = charCur; runChar = charCur;
do { do {
/* Whether this is FNC1, whether next is */ /* Whether this is FNC1, whether next is */
/* numeric */ /* numeric */
if (T[runChar].CharacterSet == ZTFNC1) /* FNC1s (GS1) not used */ if (T[runChar].CharacterSet == ZTFNC1) /* FNC1s (GS1) not used */
/* FNC1 */
++(T[charCur].CFollowing); /* Not reached */ ++(T[charCur].CFollowing); /* Not reached */
else else {
{
++runChar; ++runChar;
if (runChar >= dataLength) if (runChar >= dataLength)
break; break;
@ -154,16 +143,13 @@ static void CreateCharacterSetTable(CharacterSetTable T[], unsigned char *data,
* one bundle into the line (up to here). This is calculated online because * one bundle into the line (up to here). This is calculated online because
* it depends on the space in the line. * it depends on the space in the line.
*/ */
static int RemainingDigits(CharacterSetTable *T, int charCur,int emptyColumns) static int RemainingDigits(CharacterSetTable *T, int charCur, int emptyColumns) {
{
int digitCount; /* Numerical digits fitting in the line */ int digitCount; /* Numerical digits fitting in the line */
int runChar; int runChar;
runChar = charCur; runChar = charCur;
digitCount = 0; digitCount = 0;
while(emptyColumns>0 && runChar<charCur+T[charCur].CFollowing) while (emptyColumns > 0 && runChar < charCur + T[charCur].CFollowing) {
{ if (T[runChar].CharacterSet != ZTFNC1) {
if (T[runChar].CharacterSet!=ZTFNC1)
{
/* NOT FNC1 */ /* NOT FNC1 */
digitCount += 2; digitCount += 2;
runChar++; runChar++;
@ -184,10 +170,8 @@ static int RemainingDigits(CharacterSetTable *T, int charCur,int emptyColumns)
* pSet Output of the character sets used, allocated by me. * pSet Output of the character sets used, allocated by me.
* Return value Resulting row count * Return value Resulting row count
*/ */
static int Columns2Rows(struct zint_symbol *symbol, CharacterSetTable *T, const int dataLength, int *pRows,
static int Columns2Rows(struct zint_symbol *symbol, CharacterSetTable *T, const int dataLength, int *pUseColumns, int *pSet, int *pFillings) {
int * pRows, int * pUseColumns, int * pSet, int * pFillings)
{
int useColumns; /* Usable Characters per line */ int useColumns; /* Usable Characters per line */
int fillings = 0; /* Number of filling characters */ int fillings = 0; /* Number of filling characters */
int rowsCur; int rowsCur;
@ -203,7 +187,7 @@ static int Columns2Rows(struct zint_symbol *symbol, CharacterSetTable *T, const
/* >>> Loop until rowsCur <= 44 */ /* >>> Loop until rowsCur <= 44 */
do { do {
int charCur = 0; int charCur = 0;
memset(pSet,0,dataLength*sizeof(int)); memset(pSet, 0, sizeof(int) * dataLength);
rowsCur = 0; rowsCur = 0;
/* >>> Line Loop */ /* >>> Line Loop */
@ -214,14 +198,11 @@ static int Columns2Rows(struct zint_symbol *symbol, CharacterSetTable *T, const
/* >>Choose in Set A or B */ /* >>Choose in Set A or B */
/* (C is changed as an option later on) */ /* (C is changed as an option later on) */
pSet[charCur]=characterSetCur= pSet[charCur] = characterSetCur = (T[charCur].AFollowing > T[charCur].BFollowing) ? CodeA : CodeB;
(T[charCur].AFollowing > T[charCur].BFollowing)
? CodeA : CodeB;
/* >> Test on Numeric Mode C */ /* >> Test on Numeric Mode C */
CPaires = RemainingDigits(T, charCur, emptyColumns); CPaires = RemainingDigits(T, charCur, emptyColumns);
if (CPaires>=4) if (CPaires >= 4) {
{
/* 4 Digits in Numeric compression ->OK */ /* 4 Digits in Numeric compression ->OK */
/* > May an odd start find more ? */ /* > May an odd start find more ? */
/* Skip leading <FNC1>'s */ /* Skip leading <FNC1>'s */
@ -229,13 +210,11 @@ static int Columns2Rows(struct zint_symbol *symbol, CharacterSetTable *T, const
/* Test if numeric after one isn't better.*/ /* Test if numeric after one isn't better.*/
runChar = charCur; runChar = charCur;
emptyColumns2 = emptyColumns; emptyColumns2 = emptyColumns;
while (T[runChar].CharacterSet==ZTFNC1) /* FNC1s (GS1) not used */ while (T[runChar].CharacterSet == ZTFNC1) { /* FNC1s (GS1) not used */
{
++runChar; /* Not reached */ ++runChar; /* Not reached */
--emptyColumns2; --emptyColumns2;
} }
if (CPaires>=RemainingDigits(T,runChar+1,emptyColumns2-1)) if (CPaires >= RemainingDigits(T, runChar + 1, emptyColumns2 - 1)) {
{
/* Start odd is not better */ /* Start odd is not better */
/* We start in C */ /* We start in C */
pSet[charCur] = characterSetCur = CodeC; pSet[charCur] = characterSetCur = CodeC;
@ -248,8 +227,7 @@ static int Columns2Rows(struct zint_symbol *symbol, CharacterSetTable *T, const
--emptyColumns; --emptyColumns;
/* >> Following characters */ /* >> Following characters */
while(emptyColumns>0 && charCur<dataLength) while (emptyColumns > 0 && charCur < dataLength) {
{
isFNC4 = (T[charCur].CharacterSet & CodeFNC4); isFNC4 = (T[charCur].CharacterSet & CodeFNC4);
switch (characterSetCur) { switch (characterSetCur) {
case CodeA: case CodeA:
@ -262,28 +240,23 @@ static int Columns2Rows(struct zint_symbol *symbol, CharacterSetTable *T, const
*/ */
if (T[charCur].CharacterSet == ZTNum if (T[charCur].CharacterSet == ZTNum
&& (CPaires = RemainingDigits(T, charCur, emptyColumns - 1)) >= 4 && (CPaires = RemainingDigits(T, charCur, emptyColumns - 1)) >= 4
&& CPaires > RemainingDigits(T,charCur+1,emptyColumns-2)) && CPaires > RemainingDigits(T, charCur + 1, emptyColumns - 2)) {
{
/* > Change to C */ /* > Change to C */
pSet[charCur] = characterSetCur = CodeC; pSet[charCur] = characterSetCur = CodeC;
charCur += 2; /* 2 Digit */ charCur += 2; /* 2 Digit */
emptyColumns -= 2; /* <SwitchC>12 */ emptyColumns -= 2; /* <SwitchC>12 */
} else if (characterSetCur==CodeA) } else if (characterSetCur == CodeA) {
{ if (T[charCur].AFollowing == 0 || (isFNC4 && T[charCur].AFollowing == 1)) {
if (T[charCur].AFollowing == 0 || (isFNC4 && T[charCur].AFollowing == 1))
{
/* Must change to B */ /* Must change to B */
if (emptyColumns == 1 || (isFNC4 && emptyColumns == 2)) if (emptyColumns == 1 || (isFNC4 && emptyColumns == 2)) {
{
/* Can't switch: */ /* Can't switch: */
pSet[charCur - 1] |= CEnd + CFill; pSet[charCur - 1] |= CEnd + CFill;
emptyColumns = 0; emptyColumns = 0;
} else { } else {
/* <Shift> or <switchB>? */ /* <Shift> or <switchB>? */
if (T[charCur].BFollowing == 1 || (isFNC4 && T[charCur].BFollowing == 2)) if (T[charCur].BFollowing == 1 || (isFNC4 && T[charCur].BFollowing == 2)) {
{ /* Note using order "FNC4 shift char" (same as CODE128) not "shift FNC4 char"
/* Note using order "FNC4 shift char" (same as CODE128) not "shift FNC4 char" as as given in Table B.1 and Table B.2 */
given in Table B.1 and Table B.2 */
if (isFNC4) { /* So skip FNC4 and shift value instead */ if (isFNC4) { /* So skip FNC4 and shift value instead */
--emptyColumns; --emptyColumns;
++charCur; ++charCur;
@ -305,20 +278,17 @@ static int Columns2Rows(struct zint_symbol *symbol, CharacterSetTable *T, const
++charCur; ++charCur;
} }
} else { /* Last possibility : CodeB */ } else { /* Last possibility : CodeB */
if (T[charCur].BFollowing == 0 || (isFNC4 && T[charCur].BFollowing == 1)) if (T[charCur].BFollowing == 0 || (isFNC4 && T[charCur].BFollowing == 1)) {
{
/* Must change to A */ /* Must change to A */
if (emptyColumns == 1 || (isFNC4 && emptyColumns == 2)) if (emptyColumns == 1 || (isFNC4 && emptyColumns == 2)) {
{
/* Can't switch: */ /* Can't switch: */
pSet[charCur - 1] |= CEnd + CFill; pSet[charCur - 1] |= CEnd + CFill;
emptyColumns = 0; emptyColumns = 0;
} else { } else {
/* <Shift> or <switchA>? */ /* <Shift> or <switchA>? */
if (T[charCur].AFollowing == 1 || (isFNC4 && T[charCur].AFollowing == 2)) if (T[charCur].AFollowing == 1 || (isFNC4 && T[charCur].AFollowing == 2)) {
{ /* Note using order "FNC4 shift char" (same as CODE128) not "shift FNC4 char"
/* Note using order "FNC4 shift char" (same as CODE128) not "shift FNC4 char" as as given in Table B.1 and Table B.2 */
given in Table B.1 and Table B.2 */
if (isFNC4) { /* So skip FNC4 and shift value instead */ if (isFNC4) { /* So skip FNC4 and shift value instead */
--emptyColumns; --emptyColumns;
++charCur; ++charCur;
@ -342,22 +312,19 @@ static int Columns2Rows(struct zint_symbol *symbol, CharacterSetTable *T, const
} }
break; break;
case CodeC: case CodeC:
if(T[charCur].CFollowing>0) if (T[charCur].CFollowing > 0) {
{
charCur += (T[charCur].CharacterSet == ZTFNC1) ? 1 : 2; charCur += (T[charCur].CharacterSet == ZTFNC1) ? 1 : 2;
emptyColumns--; emptyColumns--;
} else { } else {
/* Must change to A or B */ /* Must change to A or B */
if (emptyColumns==1) if (emptyColumns == 1) {
{
/* Can't switch: */ /* Can't switch: */
pSet[charCur - 1] |= CEnd + CFill; pSet[charCur - 1] |= CEnd + CFill;
emptyColumns = 0; emptyColumns = 0;
} else { } else {
/*<SwitchA> or <switchA>?*/ /*<SwitchA> or <switchA>?*/
characterSetCur=pSet[charCur]= characterSetCur = pSet[charCur]
(T[charCur].AFollowing > T[charCur].BFollowing) = (T[charCur].AFollowing > T[charCur].BFollowing) ? CodeA : CodeB;
?CodeA:CodeB;
emptyColumns -= 2; emptyColumns -= 2;
++charCur; ++charCur;
} }
@ -380,12 +347,8 @@ static int Columns2Rows(struct zint_symbol *symbol, CharacterSetTable *T, const
++rowsCur; ++rowsCur;
fillings = useColumns - 2 + emptyColumns; fillings = useColumns - 2 + emptyColumns;
break; break;
case 2: case 2: fillings = 0; break;
fillings=0; default: pSet[charCur - 1] |= CFill; fillings = emptyColumns - 2;
break;
default:
pSet[charCur-1]|=CFill;
fillings=emptyColumns-2;
} }
if (rowsCur > 44) { if (rowsCur > 44) {
@ -409,9 +372,8 @@ static int Columns2Rows(struct zint_symbol *symbol, CharacterSetTable *T, const
/* Find columns if row count is given. /* Find columns if row count is given.
*/ */
static int Rows2Columns(struct zint_symbol *symbol, CharacterSetTable *T, const int dataLength, static int Rows2Columns(struct zint_symbol *symbol, CharacterSetTable *T, const int dataLength, int *pRows,
int * pRows, int * pUseColumns, int * pSet, int * pFillings) int *pUseColumns, int *pSet, int *pFillings) {
{
int rowsCur; int rowsCur;
int rowsRequested; /* Number of requested rows */ int rowsRequested; /* Number of requested rows */
int columnsRequested; /* Number of requested columns (if any) */ int columnsRequested; /* Number of requested columns (if any) */
@ -471,12 +433,12 @@ static int Rows2Columns(struct zint_symbol *symbol, CharacterSetTable *T, const
return 0; return 0;
} }
/* > Test more rows (shorter CDB) */ /* > Test more rows (shorter CDB) */
memcpy(pBackupSet,pSet,dataLength*sizeof(int)); memcpy(pBackupSet, pSet, sizeof(int) * dataLength);
--testColumns; --testColumns;
} else { } else {
/* > Too many rows */ /* > Too many rows */
/* > Test less rows (longer code) */ /* > Test less rows (longer code) */
memcpy(pBackupSet,pSet,dataLength*sizeof(int)); memcpy(pBackupSet, pSet, sizeof(int) * dataLength);
if (++testColumns > 62) { if (++testColumns > 62) {
return ZINT_ERROR_TOO_LONG; return ZINT_ERROR_TOO_LONG;
} }
@ -486,8 +448,7 @@ static int Rows2Columns(struct zint_symbol *symbol, CharacterSetTable *T, const
/* Print a character in character set A /* Print a character in character set A
*/ */
static void A2C128_A(uchar **ppOutPos,uchar c) static void A2C128_A(uchar **ppOutPos, uchar c) {
{
uchar *pOutPos = *ppOutPos; uchar *pOutPos = *ppOutPos;
switch (c) { switch (c) {
case aCodeB: *pOutPos = 100; break; case aCodeB: *pOutPos = 100; break;
@ -510,8 +471,7 @@ static void A2C128_A(uchar **ppOutPos,uchar c)
/* Output c in Set B /* Output c in Set B
*/ */
static void A2C128_B(uchar **ppOutPos,uchar c) static void A2C128_B(uchar **ppOutPos, uchar c) {
{
uchar *pOutPos = *ppOutPos; uchar *pOutPos = *ppOutPos;
switch (c) { switch (c) {
case aFNC1: *pOutPos = 102; break; /* FNC1s (GS1) not used */ /* Not reached */ case aFNC1: *pOutPos = 102; break; /* FNC1s (GS1) not used */ /* Not reached */
@ -528,22 +488,20 @@ static void A2C128_B(uchar **ppOutPos,uchar c)
/* Output c1, c2 in Set C /* Output c1, c2 in Set C
*/ */
static void A2C128_C(uchar **ppOutPos,uchar c1,uchar c2) static void A2C128_C(uchar **ppOutPos, uchar c1, uchar c2) {
{
uchar *pOutPos = *ppOutPos; uchar *pOutPos = *ppOutPos;
switch (c1) { switch (c1) {
case aFNC1: *pOutPos = 102; break; /* FNC1s (GS1) not used */ /* Not reached */ case aFNC1: *pOutPos = 102; break; /* FNC1s (GS1) not used */ /* Not reached */
case aCodeB: *pOutPos = 100; break; case aCodeB: *pOutPos = 100; break;
case aCodeA: *pOutPos = 101; break; case aCodeA: *pOutPos = 101; break;
default: *pOutPos=(char)(10 * (c1- '0') + (c2 - '0'));break; default: *pOutPos = (uchar) (10 * (c1 - '0') + (c2 - '0')); break;
} }
(*ppOutPos)++; (*ppOutPos)++;
} }
/* Output a character in Characterset /* Output a character in Characterset
*/ */
static void ASCIIZ128(uchar **ppOutPos, int CharacterSet,uchar c1, uchar c2) static void ASCIIZ128(uchar **ppOutPos, int CharacterSet, uchar c1, uchar c2) {
{
if (CharacterSet == CodeA) if (CharacterSet == CodeA)
A2C128_A(ppOutPos, c1); A2C128_A(ppOutPos, c1);
else if (CharacterSet == CodeB) else if (CharacterSet == CodeB)
@ -554,8 +512,7 @@ static void ASCIIZ128(uchar **ppOutPos, int CharacterSet,uchar c1, uchar c2)
/* XLate Tables D.2, D.3 and F.1 of Codablock-F Specification and call output /* XLate Tables D.2, D.3 and F.1 of Codablock-F Specification and call output
*/ */
static void SumASCII(uchar **ppOutPos, int Sum, int CharacterSet) static void SumASCII(uchar **ppOutPos, int Sum, int CharacterSet) {
{
switch (CharacterSet) { switch (CharacterSet) {
case CodeA: /* Row # Indicators and Data Check Characters K1/K2 for CodeA and CodeB are the same */ case CodeA: /* Row # Indicators and Data Check Characters K1/K2 for CodeA and CodeB are the same */
case CodeB: case CodeB:
@ -567,8 +524,7 @@ static void SumASCII(uchar **ppOutPos, int Sum, int CharacterSet)
A2C128_B(ppOutPos, (uchar) (Sum + 10)); A2C128_B(ppOutPos, (uchar) (Sum + 10));
break; break;
case CodeC: case CodeC:
A2C128_C(ppOutPos A2C128_C(ppOutPos, (uchar) (Sum / 10 + '0'), (uchar) (Sum % 10 + '0'));
,(char)(Sum/10+'0') ,(uchar)(Sum%10+'0'));
break; break;
} }
} }
@ -591,6 +547,7 @@ INTERNAL int codablockf(struct zint_symbol *symbol, unsigned char source[], int
unsigned char *data; unsigned char *data;
int *pSet; int *pSet;
uchar *pOutput; uchar *pOutput;
/* Suppresses clang-analyzer-core.VLASize warning */ /* Suppresses clang-analyzer-core.VLASize warning */
assert(length > 0); assert(length > 0);
@ -635,8 +592,7 @@ INTERNAL int codablockf(struct zint_symbol *symbol, unsigned char source[], int
} }
/* Replace all Codes>127 with <fnc4>Code-128 */ /* Replace all Codes>127 with <fnc4>Code-128 */
for (charCur = 0; charCur < length; charCur++) { for (charCur = 0; charCur < length; charCur++) {
if (source[charCur]>127) if (source[charCur] > 127) {
{
data[dataLength] = aFNC4; data[dataLength] = aFNC4;
dataLength++; dataLength++;
data[dataLength] = (unsigned char) (source[charCur] & 127); data[dataLength] = (unsigned char) (source[charCur] & 127);
@ -726,8 +682,7 @@ INTERNAL int codablockf(struct zint_symbol *symbol, unsigned char source[], int
charCur = 0; charCur = 0;
/* >> Loop over rows */ /* >> Loop over rows */
for (rowCur = 0; rowCur < rows; rowCur++) { for (rowCur = 0; rowCur < rows; rowCur++) {
if (charCur>=dataLength) if (charCur >= dataLength) {
{
/* >> Empty line with StartA, aCodeB, row #, and then filler aCodeC aCodeB etc */ /* >> Empty line with StartA, aCodeB, row #, and then filler aCodeC aCodeB etc */
*pOutPos = '\x67'; *pOutPos = '\x67';
pOutPos++; pOutPos++;
@ -739,10 +694,8 @@ INTERNAL int codablockf(struct zint_symbol *symbol, unsigned char source[], int
if (rowCur == rows - 1) { if (rowCur == rows - 1) {
emptyColumns -= 2; emptyColumns -= 2;
} }
while (emptyColumns>0) while (emptyColumns > 0) {
{ if (characterSetCur == CodeC) {
if(characterSetCur==CodeC)
{
A2C128_C(&pOutPos, aCodeB, '\0'); A2C128_C(&pOutPos, aCodeB, '\0');
characterSetCur = CodeB; characterSetCur = CodeB;
} else { } else {
@ -784,33 +737,27 @@ INTERNAL int codablockf(struct zint_symbol *symbol, unsigned char source[], int
/* >>> Data */ /* >>> Data */
emptyColumns = useColumns; emptyColumns = useColumns;
/* >> Character loop */ /* >> Character loop */
while (emptyColumns > 0 && charCur < dataLength) while (emptyColumns > 0 && charCur < dataLength) {
{
/* ? Change character set */ /* ? Change character set */
if (emptyColumns < useColumns) if (emptyColumns < useColumns) {
{ if ((pSet[charCur] & CodeA) != 0) {
if ((pSet[charCur]&CodeA)!=0)
{
/* Change to A */ /* Change to A */
ASCIIZ128(&pOutPos, characterSetCur, aCodeA, '\0'); ASCIIZ128(&pOutPos, characterSetCur, aCodeA, '\0');
--emptyColumns; --emptyColumns;
characterSetCur = CodeA; characterSetCur = CodeA;
} else if ((pSet[charCur]&CodeB)!=0) } else if ((pSet[charCur] & CodeB) != 0) {
{
/* Change to B */ /* Change to B */
ASCIIZ128(&pOutPos, characterSetCur, aCodeB, '\0'); ASCIIZ128(&pOutPos, characterSetCur, aCodeB, '\0');
--emptyColumns; --emptyColumns;
characterSetCur = CodeB; characterSetCur = CodeB;
} else if ((pSet[charCur]&CodeC)!=0) } else if ((pSet[charCur] & CodeC) != 0) {
{
/* Change to C */ /* Change to C */
ASCIIZ128(&pOutPos, characterSetCur, aCodeC, '\0'); ASCIIZ128(&pOutPos, characterSetCur, aCodeC, '\0');
--emptyColumns; --emptyColumns;
characterSetCur = CodeC; characterSetCur = CodeC;
} }
} }
if ((pSet[charCur]&CShift)!=0) if ((pSet[charCur] & CShift) != 0) {
{
/* >> Shift it and put out the shifted character */ /* >> Shift it and put out the shifted character */
ASCIIZ128(&pOutPos, characterSetCur, aShift, '\0'); ASCIIZ128(&pOutPos, characterSetCur, aShift, '\0');
emptyColumns -= 2; emptyColumns -= 2;
@ -819,12 +766,10 @@ INTERNAL int codablockf(struct zint_symbol *symbol, unsigned char source[], int
characterSetCur = (characterSetCur == CodeB) ? CodeA : CodeB; characterSetCur = (characterSetCur == CodeB) ? CodeA : CodeB;
} else { } else {
/* Normal Character */ /* Normal Character */
if (characterSetCur==CodeC) if (characterSetCur == CodeC) {
{
if (data[charCur] == aFNC1) /* FNC1s (GS1) not used */ if (data[charCur] == aFNC1) /* FNC1s (GS1) not used */
A2C128_C(&pOutPos, aFNC1, '\0'); /* Not reached */ A2C128_C(&pOutPos, aFNC1, '\0'); /* Not reached */
else else {
{
A2C128_C(&pOutPos, data[charCur], A2C128_C(&pOutPos, data[charCur],
(uchar) (charCur + 1 < dataLength ? data[charCur + 1] : 0)); (uchar) (charCur + 1 < dataLength ? data[charCur + 1] : 0));
++charCur; ++charCur;
@ -836,14 +781,12 @@ INTERNAL int codablockf(struct zint_symbol *symbol, unsigned char source[], int
--emptyColumns; --emptyColumns;
} }
/* >> End Criteria */ /* >> End Criteria */
if ((pSet[charCur] & CFill) || (pSet[charCur] & CEnd)) if ((pSet[charCur] & CFill) || (pSet[charCur] & CEnd)) {
{
/* Fill Line but leave space for checks in last line */ /* Fill Line but leave space for checks in last line */
if (rowCur == rows - 1) { if (rowCur == rows - 1) {
emptyColumns -= 2; emptyColumns -= 2;
} }
while(emptyColumns>0) while (emptyColumns > 0) {
{
switch (characterSetCur) { switch (characterSetCur) {
case CodeC: case CodeC:
A2C128_C(&pOutPos, aCodeB, '\0'); A2C128_C(&pOutPos, aCodeB, '\0');
@ -866,8 +809,7 @@ INTERNAL int codablockf(struct zint_symbol *symbol, unsigned char source[], int
} /* if filling-Line / normal */ } /* if filling-Line / normal */
/* Add checksum in last line */ /* Add checksum in last line */
if (rowCur == rows - 1) if (rowCur == rows - 1) {
{
SumASCII(&pOutPos, Sum1, characterSetCur); SumASCII(&pOutPos, Sum1, characterSetCur);
SumASCII(&pOutPos, Sum2, characterSetCur); SumASCII(&pOutPos, Sum2, characterSetCur);
} }
@ -875,8 +817,7 @@ INTERNAL int codablockf(struct zint_symbol *symbol, unsigned char source[], int
{ {
int Sum = pOutput[columns * rowCur] % 103; int Sum = pOutput[columns * rowCur] % 103;
int Pos = 1; int Pos = 1;
for ( ; Pos < useColumns+3 ; Pos++) for (; Pos < useColumns + 3; Pos++) {
{
Sum = (Sum + pOutput[columns * rowCur + Pos] * Pos) % 103; Sum = (Sum + pOutput[columns * rowCur + Pos] * Pos) % 103;
} }
*pOutPos = (uchar) Sum; *pOutPos = (uchar) Sum;
@ -893,10 +834,8 @@ INTERNAL int codablockf(struct zint_symbol *symbol, unsigned char source[], int
printf("\nCode 128 Code Numbers:\n"); printf("\nCode 128 Code Numbers:\n");
{ /* start a new level of local variables */ { /* start a new level of local variables */
int DPos, DPos2; int DPos, DPos2;
for (DPos=0 ; DPos< rows ; DPos++) for (DPos = 0; DPos < rows; DPos++) {
{ for (DPos2 = 0; DPos2 < columns; DPos2++) {
for (DPos2=0 ; DPos2 < columns ; DPos2++)
{
printf("%3d ", (int) (pOutput[DPos * columns + DPos2])); printf("%3d ", (int) (pOutput[DPos * columns + DPos2]));
} }
printf("\n"); printf("\n");

View File

@ -1,8 +1,7 @@
/* code1.h - Lookup info for USS Code One */ /* code1.h - Lookup info for USS Code One */
/* /*
libzint - the open source barcode library 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 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
@ -29,7 +28,10 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
*/ */
/* vim: set ts=4 sw=4 et : */ /* SPDX-License-Identifier: BSD-3-Clause */
#ifndef Z_CODE1_H
#define Z_CODE1_H
static const char c40_shift[] = { static const char c40_shift[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@ -59,39 +61,39 @@ static const char text_value[] = {
22, 23, 24, 25, 26, 0, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 27, 28, 29, 30, 31 22, 23, 24, 25, 26, 0, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 27, 28, 29, 30, 31
}; };
static const unsigned short int c1_height[] = { static const unsigned short c1_height[] = {
16, 22, 28, 40, 52, 70, 104, 148 16, 22, 28, 40, 52, 70, 104, 148
}; };
static const unsigned short int c1_width[] = { static const unsigned short c1_width[] = {
18, 22, 32, 42, 54, 76, 98, 134 18, 22, 32, 42, 54, 76, 98, 134
}; };
static const unsigned short int c1_data_length[] = { static const unsigned short c1_data_length[] = {
10, 19, 44, 91, 182, 370, 732, 1480 10, 19, 44, 91, 182, 370, 732, 1480
}; };
static const unsigned short int c1_ecc_length[] = { static const unsigned short c1_ecc_length[] = {
10, 16, 26, 44, 70, 140, 280, 560 10, 16, 26, 44, 70, 140, 280, 560
}; };
static const unsigned short int c1_blocks[] = { static const unsigned short c1_blocks[] = {
1, 1, 1, 1, 1, 2, 4, 8 1, 1, 1, 1, 1, 2, 4, 8
}; };
static const unsigned short int c1_data_blocks[] = { static const unsigned short c1_data_blocks[] = {
10, 19, 44, 91, 182, 185, 183, 185 10, 19, 44, 91, 182, 185, 183, 185
}; };
static const unsigned short int c1_ecc_blocks[] = { static const unsigned short c1_ecc_blocks[] = {
10, 16, 26, 44, 70, 70, 70, 70 10, 16, 26, 44, 70, 70, 70, 70
}; };
static const unsigned short int c1_grid_width[] = { static const unsigned short c1_grid_width[] = {
4, 5, 7, 9, 12, 17, 22, 30 4, 5, 7, 9, 12, 17, 22, 30
}; };
static const unsigned short int c1_grid_height[] = { static const unsigned short c1_grid_height[] = {
5, 7, 10, 15, 21, 30, 46, 68 5, 7, 10, 15, 21, 30, 46, 68
}; };
@ -101,3 +103,6 @@ static const unsigned short int c1_grid_height[] = {
#define C1_TEXT 4 #define C1_TEXT 4
#define C1_EDI 5 #define C1_EDI 5
#define C1_BYTE 6 #define C1_BYTE 6
/* vim: set ts=4 sw=4 et : */
#endif /* Z_CODE1_H */

View File

@ -1,6 +1,6 @@
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2020 - 2021 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2020-2022 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
@ -27,10 +27,10 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
*/ */
/* vim: set ts=4 sw=4 et : */ /* SPDX-License-Identifier: BSD-3-Clause */
#ifndef CODE128_H #ifndef Z_CODE128_H
#define CODE128_H #define Z_CODE128_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -63,4 +63,5 @@ INTERNAL_DATA_EXTERN const char C128Table[107][6];
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
#endif /* CODE128_H */ /* vim: set ts=4 sw=4 et : */
#endif /* Z_CODE128_H */

View File

@ -1,8 +1,7 @@
/* code16k.c - Handles Code 16k stacked symbology */ /* code16k.c - Handles Code 16k stacked symbology */
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2008 - 2021 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2008-2022 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
@ -29,16 +28,16 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
*/ */
/* vim: set ts=4 sw=4 et : */ /* SPDX-License-Identifier: BSD-3-Clause */
/* Updated to comply with BS EN 12323:2005 */ /* Updated to comply with BS EN 12323:2005 */
/* Code 16k can hold up to 77 characters or 154 numbers */ /* Code 16k can hold up to 77 characters or 154 numbers */
#include <stdio.h>
#include <assert.h>
#include "common.h" #include "common.h"
#include "code128.h" #include "code128.h"
#include <assert.h>
#include <stdio.h>
/* Note using C128Table with extra entry at 106 (Triple Shift) for C16KTable */ /* Note using C128Table with extra entry at 106 (Triple Shift) for C16KTable */
@ -413,3 +412,5 @@ INTERNAL int code16k(struct zint_symbol *symbol, unsigned char source[], int len
return error_number; return error_number;
} }
/* vim: set ts=4 sw=4 et : */

View File

@ -1,8 +1,7 @@
/* code49.h - Code 49 Tables */ /* code49.h - Code 49 Tables */
/* /*
libzint - the open source barcode library 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 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
@ -29,7 +28,10 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
*/ */
/* vim: set ts=4 sw=4 et : */ /* SPDX-License-Identifier: BSD-3-Clause */
#ifndef Z_CODE49_H
#define Z_CODE49_H
/* This data set taken from ANSI/AIM-BC6-2000, 4th April 2000 */ /* This data set taken from ANSI/AIM-BC6-2000, 4th April 2000 */
@ -72,7 +74,7 @@ static const char c49_table4[8][4] = {
{'O','E','O','E'}, {'E','O','O','E'}, {'O','O','O','O'}, {'E','E','E','E'} {'O','E','O','E'}, {'E','O','O','E'}, {'O','O','O','O'}, {'E','E','E','E'}
}; };
static const unsigned short int c49_even_bitpattern[] = { static const unsigned short c49_even_bitpattern[] = {
/* Appendix E - Code 49 Encodation Patterns (Even Symbol Character Parity) */ /* Appendix E - Code 49 Encodation Patterns (Even Symbol Character Parity) */
0xBE5C, 0xC16E, 0x86DC, 0xC126, 0x864C, 0x9EDC, 0xC726, 0x9E4C, 0xDF26, 0x82CC, 0xBE5C, 0xC16E, 0x86DC, 0xC126, 0x864C, 0x9EDC, 0xC726, 0x9E4C, 0xDF26, 0x82CC,
0x8244, 0x8ECC, 0xC322, 0x8E44, 0xBECC, 0xCF22, 0xBE44, 0xC162, 0x86C4, 0xC762, 0x8244, 0x8ECC, 0xC322, 0x8E44, 0xBECC, 0xCF22, 0xBE44, 0xC162, 0x86C4, 0xC762,
@ -317,7 +319,7 @@ static const unsigned short int c49_even_bitpattern[] = {
0xCF2E 0xCF2E
}; };
static const unsigned short int c49_odd_bitpattern[] = { static const unsigned short c49_odd_bitpattern[] = {
/* Appendix E - Code 49 Encodation Patterns (Odd Symbol Character Parity) */ /* Appendix E - Code 49 Encodation Patterns (Odd Symbol Character Parity) */
0xC940, 0xF250, 0xECA0, 0xFB28, 0xE5A0, 0xF968, 0xDB40, 0xF6D0, 0xFDB4, 0xC4A0, 0xC940, 0xF250, 0xECA0, 0xFB28, 0xE5A0, 0xF968, 0xDB40, 0xF6D0, 0xFDB4, 0xC4A0,
0xF128, 0x9940, 0xE650, 0xF994, 0xDCA0, 0xF728, 0xFDCA, 0x8B40, 0xE2D0, 0xCDA0, 0xF128, 0x9940, 0xE650, 0xF994, 0xDCA0, 0xF728, 0xFDCA, 0x8B40, 0xE2D0, 0xCDA0,
@ -561,3 +563,6 @@ static const unsigned short int c49_odd_bitpattern[] = {
0x990E, 0x8B0E, 0x8906, 0xBB0E, 0xB906, 0x9B06, 0x9902, 0xA2FC, 0xD37E, 0xD13E, 0x990E, 0x8B0E, 0x8906, 0xBB0E, 0xB906, 0x9B06, 0x9902, 0xA2FC, 0xD37E, 0xD13E,
0xAEFC 0xAEFC
}; };
/* vim: set ts=4 sw=4 et : */
#endif /* Z_CODE49_H */

View File

@ -1,8 +1,7 @@
/* composite.c - Tables for UCC.EAN Composite Symbols */ /* composite.c - Tables for UCC.EAN Composite Symbols */
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2008 - 2020 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2008-2022 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
@ -29,10 +28,13 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
*/ */
/* vim: set ts=4 sw=4 et : */ /* SPDX-License-Identifier: BSD-3-Clause */
#ifndef Z_COMPOSITE_H
#define Z_COMPOSITE_H
/* CC-A component coefficients from ISO/IEC 24728:2006 Annex F */ /* CC-A component coefficients from ISO/IEC 24728:2006 Annex F */
static const unsigned short int ccaCoeffs[30] = { static const unsigned short ccaCoeffs[30] = {
/* k = 4 */ /* k = 4 */
522, 568, 723, 809, 522, 568, 723, 809,
@ -138,3 +140,6 @@ static const UINT pwr928[69][7] = {
{ 231, 54, 222, 565, 282, 130, 192, }, { 231, 54, 222, 565, 282, 130, 192, },
{ 462, 108, 445, 202, 564, 260, 384, }, { 462, 108, 445, 202, 564, 260, 384, },
}; };
/* vim: set ts=4 sw=4 et : */
#endif /* Z_COMPOSITE_H */

View File

@ -1,8 +1,7 @@
/* Sed: http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/programmersguide/versions.asp */ /* Sed: http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/programmersguide/versions.asp */
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2008 - 2021 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2008-2022 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
@ -29,7 +28,8 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
*/ */
/* vim: set ts=4 sw=4 et : */ /* SPDX-License-Identifier: BSD-3-Clause */
#if defined (_WIN32) && (defined(_USRDLL) || defined(DLL_EXPORT) || defined(PIC)) #if defined (_WIN32) && (defined(_USRDLL) || defined(DLL_EXPORT) || defined(PIC))
#include <windows.h> #include <windows.h>
#include <shlwapi.h> #include <shlwapi.h>
@ -46,8 +46,7 @@ __declspec(dllexport) HRESULT DllGetVersion (DLLVERSIONINFO2* pdvi);
} }
#endif #endif
HRESULT DllGetVersion (DLLVERSIONINFO2* pdvi) HRESULT DllGetVersion(DLLVERSIONINFO2 *pdvi) {
{
if (!pdvi || (sizeof(*pdvi) != pdvi->info1.cbSize)) if (!pdvi || (sizeof(*pdvi) != pdvi->info1.cbSize))
return (E_INVALIDARG); return (E_INVALIDARG);
@ -64,4 +63,5 @@ HRESULT DllGetVersion (DLLVERSIONINFO2* pdvi)
#else #else
/* https://stackoverflow.com/a/26541331 Suppresses gcc warning ISO C forbids an empty translation unit */ /* https://stackoverflow.com/a/26541331 Suppresses gcc warning ISO C forbids an empty translation unit */
typedef int make_iso_compilers_happy; typedef int make_iso_compilers_happy;
/* vim: set ts=4 sw=4 et : */
#endif /* _WIN32 */ #endif /* _WIN32 */

View File

@ -75,11 +75,11 @@ static const char dm_text_value[] = {
}; };
/* Position in option array [symbol option value - 1] /* Position in option array [symbol option value - 1]
// The position in the option array is by increasing total data codewords with square first The position in the option array is by increasing total data codewords with square first
// The last comment value is the total data codewords value. The last comment value is the total data codewords value.
// The index of this array is the --vers parameter value -1 and is given as first comment value */ The index of this array is the --vers parameter value -1 and is given as first comment value */
static const unsigned short int dm_intsymbol[] = { static const unsigned short dm_intsymbol[] = {
/* Standard DM */ /* Standard DM */
0, /* 1: 10x10 , 3*/ 1, /* 2: 12x12 , 5*/ 3, /* 3: 14x14 , 8*/ 5, /* 4: 16x16 , 12*/ 0, /* 1: 10x10 , 3*/ 1, /* 2: 12x12 , 5*/ 3, /* 3: 14x14 , 8*/ 5, /* 4: 16x16 , 12*/
7, /* 5: 18x18 , 18*/ 9, /* 6: 20x20 , 22*/ 12, /* 7: 22x22 , 30*/ 15, /* 8: 24x24 , 36*/ 7, /* 5: 18x18 , 18*/ 9, /* 6: 20x20 , 22*/ 12, /* 7: 22x22 , 30*/ 15, /* 8: 24x24 , 36*/
@ -122,7 +122,7 @@ static const char dm_isDMRE[] = {
/* Horizontal matrix size */ /* Horizontal matrix size */
static const unsigned short int dm_matrixH[] = { static const unsigned short dm_matrixH[] = {
/* 0*/ 10, /* 10x10 , 3*/ 12, /* 12x12 , 5 */ 8, /* 8x18 , 5*/ 14, /* 14x14 , 8*/ /* 0*/ 10, /* 10x10 , 3*/ 12, /* 12x12 , 5 */ 8, /* 8x18 , 5*/ 14, /* 14x14 , 8*/
/* 4*/ 8, /* 8x32 , 10*/ 16, /* 16x16 , 12*/ 12, /* 12x26 , 16*/ 18, /* 18x18 , 18*/ /* 4*/ 8, /* 8x32 , 10*/ 16, /* 16x16 , 12*/ 12, /* 12x26 , 16*/ 18, /* 18x18 , 18*/
/* 8*/ 8, /* 8x48 , 18*/ 20, /* 20x20 , 22*/ 12, /* 12x36 , 22*/ 8, /* 8x64 , 24*/ /* 8*/ 8, /* 8x48 , 18*/ 20, /* 20x20 , 22*/ 12, /* 12x36 , 22*/ 8, /* 8x64 , 24*/
@ -139,7 +139,7 @@ static const unsigned short int dm_matrixH[] = {
/* Vertical matrix sizes */ /* Vertical matrix sizes */
static const unsigned short int dm_matrixW[] = { static const unsigned short dm_matrixW[] = {
/* 0*/ 10, /* 10x10 */ 12, /* 12x12 */ 18, /* 8x18 */ 14, /* 14x14 */ /* 0*/ 10, /* 10x10 */ 12, /* 12x12 */ 18, /* 8x18 */ 14, /* 14x14 */
/* 4*/ 32, /* 8x32 */ 16, /* 16x16 */ 26, /* 12x26 */ 18, /* 18x18 */ /* 4*/ 32, /* 8x32 */ 16, /* 16x16 */ 26, /* 12x26 */ 18, /* 18x18 */
/* 8*/ 48, /* 8x48 */ 20, /* 20x20 */ 36, /* 12x36 */ 64, /* 8x64 */ /* 8*/ 48, /* 8x48 */ 20, /* 20x20 */ 36, /* 12x36 */ 64, /* 8x64 */
@ -157,7 +157,7 @@ static const unsigned short int dm_matrixW[] = {
/* Horizontal submodule size (including subfinder) */ /* Horizontal submodule size (including subfinder) */
static const unsigned short int dm_matrixFH[] = { static const unsigned short dm_matrixFH[] = {
/* 0*/ 10, /* 10x10 */ 12, /* 12x12 */ 8, /* 8x18 */ 14, /* 14x14 */ /* 0*/ 10, /* 10x10 */ 12, /* 12x12 */ 8, /* 8x18 */ 14, /* 14x14 */
/* 4*/ 8, /* 8x32 */ 16, /* 16x16 */ 12, /* 12x26 */ 18, /* 18x18 */ /* 4*/ 8, /* 8x32 */ 16, /* 16x16 */ 12, /* 12x26 */ 18, /* 18x18 */
/* 8*/ 8, /* 8x48 */ 20, /* 20x20 */ 12, /* 12x36 */ 8, /* 8x64 */ /* 8*/ 8, /* 8x48 */ 20, /* 20x20 */ 12, /* 12x36 */ 8, /* 8x64 */
@ -174,7 +174,7 @@ static const unsigned short int dm_matrixFH[] = {
/* Vertical submodule size (including subfinder) */ /* Vertical submodule size (including subfinder) */
static const unsigned short int dm_matrixFW[] = { static const unsigned short dm_matrixFW[] = {
/* 0*/ 10, /* 10x10 */ 12, /* 12x12 */ 18, /* 8x18 */ 14, /* 14x14 */ /* 0*/ 10, /* 10x10 */ 12, /* 12x12 */ 18, /* 8x18 */ 14, /* 14x14 */
/* 4*/ 16, /* 8x32 */ 16, /* 16x16 */ 26, /* 12x26 */ 18, /* 18x18 */ /* 4*/ 16, /* 8x32 */ 16, /* 16x16 */ 26, /* 12x26 */ 18, /* 18x18 */
/* 8*/ 24, /* 8x48 */ 20, /* 20x20 */ 18, /* 12x36 */ 16, /* 8x64 */ /* 8*/ 24, /* 8x48 */ 20, /* 20x20 */ 18, /* 12x36 */ 16, /* 8x64 */
@ -191,7 +191,7 @@ static const unsigned short int dm_matrixFW[] = {
/* Total Data Codewords */ /* Total Data Codewords */
static const unsigned short int dm_matrixbytes[] = { static const unsigned short dm_matrixbytes[] = {
/* 0*/ 3, /* 10x10 */ 5, /* 12x12 */ 5, /* 8x18 */ 8, /* 14x14 */ /* 0*/ 3, /* 10x10 */ 5, /* 12x12 */ 5, /* 8x18 */ 8, /* 14x14 */
/* 4*/ 10, /* 8x32 */ 12, /* 16x16 */ 16, /* 12x26 */ 18, /* 18x18 */ /* 4*/ 10, /* 8x32 */ 12, /* 16x16 */ 16, /* 12x26 */ 18, /* 18x18 */
/* 8*/ 18, /* 8x48 */ 22, /* 20x20 */ 22, /* 12x36 */ 24, /* 8x64 */ /* 8*/ 18, /* 8x48 */ 22, /* 20x20 */ 22, /* 12x36 */ 24, /* 8x64 */
@ -208,7 +208,7 @@ static const unsigned short int dm_matrixbytes[] = {
/* Data Codewords per RS-Block */ /* Data Codewords per RS-Block */
static const unsigned short int dm_matrixdatablock[] = { static const unsigned short dm_matrixdatablock[] = {
/* 0*/ 3, /* 10x10 */ 5, /* 12x12 */ 5, /* 8x18 */ 8, /* 14x14 */ /* 0*/ 3, /* 10x10 */ 5, /* 12x12 */ 5, /* 8x18 */ 8, /* 14x14 */
/* 4*/ 10, /* 8x32 */ 12, /* 16x16 */ 16, /* 12x26 */ 18, /* 18x18 */ /* 4*/ 10, /* 8x32 */ 12, /* 16x16 */ 16, /* 12x26 */ 18, /* 18x18 */
/* 8*/ 18, /* 8x48 */ 22, /* 20x20 */ 22, /* 12x36 */ 24, /* 8x64 */ /* 8*/ 18, /* 8x48 */ 22, /* 20x20 */ 22, /* 12x36 */ 24, /* 8x64 */
@ -225,7 +225,7 @@ static const unsigned short int dm_matrixdatablock[] = {
/* ECC Codewords per RS-Block */ /* ECC Codewords per RS-Block */
static const unsigned short int dm_matrixrsblock[] = { static const unsigned short dm_matrixrsblock[] = {
/* 0*/ 5, /* 10x10 */ 7, /* 12x12 */ 7, /* 8x18 */ 10, /* 14x14 */ /* 0*/ 5, /* 10x10 */ 7, /* 12x12 */ 7, /* 8x18 */ 10, /* 14x14 */
/* 4*/ 11, /* 8x32 */ 12, /* 16x16 */ 14, /* 12x26 */ 14, /* 18x18 */ /* 4*/ 11, /* 8x32 */ 12, /* 16x16 */ 14, /* 12x26 */ 14, /* 18x18 */
/* 8*/ 15, /* 8x48 */ 18, /* 20x20 */ 18, /* 12x36 */ 18, /* 8x64 */ /* 8*/ 15, /* 8x48 */ 18, /* 20x20 */ 18, /* 12x36 */ 18, /* 8x64 */

View File

@ -1,8 +1,7 @@
/* dmatrix_trace.h - Trace routines for DM_COMPRESSION algorithm */ /* dmatrix_trace.h - Trace routines for DM_COMPRESSION algorithm */
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2021 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2021-2022 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
@ -29,7 +28,7 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
*/ */
/* vim: set ts=4 sw=4 et : */ /* SPDX-License-Identifier: BSD-3-Clause */
#ifndef Z_DMATRIX_TRACE_H #ifndef Z_DMATRIX_TRACE_H
#define Z_DMATRIX_TRACE_H #define Z_DMATRIX_TRACE_H
@ -151,4 +150,5 @@ static void DM_TRACE_NotAddEdge(const unsigned char *source, const int length, s
} }
#endif /* DM_TRACE */ #endif /* DM_TRACE */
/* vim: set ts=4 sw=4 et : */
#endif /* Z_DMATRIX_TRACE_H */ #endif /* Z_DMATRIX_TRACE_H */

View File

@ -1,5 +1,5 @@
/* eci.c - Extended Channel Interpretations to Unicode tables /* eci.c - Extended Channel Interpretations to Unicode tables */
/*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2009-2022 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2009-2022 Robin Stuart <rstuart114@gmail.com>
@ -28,6 +28,7 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
*/ */
/* SPDX-License-Identifier: BSD-3-Clause */
#ifndef Z_ECI_H #ifndef Z_ECI_H
#define Z_ECI_H #define Z_ECI_H

View File

@ -27,6 +27,7 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
*/ */
/* SPDX-License-Identifier: BSD-3-Clause */
#ifndef Z_GENERAL_FIELD_H #ifndef Z_GENERAL_FIELD_H
#define Z_GENERAL_FIELD_H #define Z_GENERAL_FIELD_H

View File

@ -1,5 +1,4 @@
/* gs1.h - Verifies GS1 data */ /* gs1.h - Verifies GS1 data */
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2009-2022 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2009-2022 Robin Stuart <rstuart114@gmail.com>
@ -29,6 +28,8 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
*/ */
/* SPDX-License-Identifier: BSD-3-Clause */
#ifndef Z_GS1_H #ifndef Z_GS1_H
#define Z_GS1_H #define Z_GS1_H

View File

@ -1,8 +1,7 @@
/* imail.c - Handles Intelligent Mail (aka OneCode) for USPS */ /* imail.c - Handles Intelligent Mail (aka OneCode) for USPS */
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2008 - 2021 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2008-2022 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
@ -29,14 +28,14 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
*/ */
/* vim: set ts=4 sw=4 et : */ /* SPDX-License-Identifier: BSD-3-Clause */
/* The function "USPS_MSB_Math_CRC11GenerateFrameCheckSequence" /* The function "USPS_MSB_Math_CRC11GenerateFrameCheckSequence"
is Copyright (C) 2006 United States Postal Service */ is Copyright (C) 2006 United States Postal Service */
#include <stdio.h>
#include "common.h" #include "common.h"
#include "large.h" #include "large.h"
#include <stdio.h>
#define SODIUM_MNS_F (IS_NUM_F | IS_MNS_F) /* SODIUM "0123456789-" */ #define SODIUM_MNS_F (IS_NUM_F | IS_MNS_F) /* SODIUM "0123456789-" */
@ -187,7 +186,7 @@ static const unsigned short AppxD_II[78] = {
0x0801, 0x1002, 0x1001, 0x0802, 0x0404, 0x0208, 0x0110, 0x00A0 0x0801, 0x1002, 0x1001, 0x0802, 0x0404, 0x0208, 0x0110, 0x00A0
}; };
static const unsigned short int AppxD_IV[130] = { static const unsigned short AppxD_IV[130] = {
/* Appendix D Table IV - Bar-to-Character Mapping (reverse lookup) */ /* Appendix D Table IV - Bar-to-Character Mapping (reverse lookup) */
67, 6, 78, 16, 86, 95, 34, 40, 45, 113, 117, 121, 62, 87, 18, 104, 41, 76, 57, 119, 115, 72, 97, 67, 6, 78, 16, 86, 95, 34, 40, 45, 113, 117, 121, 62, 87, 18, 104, 41, 76, 57, 119, 115, 72, 97,
2, 127, 26, 105, 35, 122, 52, 114, 7, 24, 82, 68, 63, 94, 44, 77, 112, 70, 100, 39, 30, 107, 2, 127, 26, 105, 35, 122, 52, 114, 7, 24, 82, 68, 63, 94, 44, 77, 112, 70, 100, 39, 30, 107,
@ -255,7 +254,7 @@ INTERNAL int usps_imail(struct zint_symbol *symbol, unsigned char source[], int
unsigned short usps_crc; unsigned short usps_crc;
unsigned int codeword[10]; unsigned int codeword[10];
unsigned short characters[10]; unsigned short characters[10];
short int bar_map[130]; short bar_map[130];
int zip_len, len; int zip_len, len;
if (length > 32) { if (length > 32) {
@ -453,3 +452,5 @@ INTERNAL int usps_imail(struct zint_symbol *symbol, unsigned char source[], int
symbol->width = read - 1; symbol->width = read - 1;
return error_number; return error_number;
} }
/* vim: set ts=4 sw=4 et : */

View File

@ -3,7 +3,7 @@
*/ */
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2021 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2021-2022 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
@ -30,9 +30,10 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
*/ */
/* SPDX-License-Identifier: BSD-3-Clause */
#ifndef ISO3166_H #ifndef Z_ISO3166_H
#define ISO3166_H #define Z_ISO3166_H
/* Whether ISO 3166-1 numeric */ /* Whether ISO 3166-1 numeric */
static int iso3166_numeric(int cc) { static int iso3166_numeric(int cc) {
@ -85,4 +86,4 @@ static int iso3166_alpha2(const char *cc) {
return codes[cc_int >> 3] & (1 << (cc_int & 0x7)) ? 1 : 0; return codes[cc_int >> 3] & (1 << (cc_int & 0x7)) ? 1 : 0;
} }
#endif /* ISO3166_H */ #endif /* Z_ISO3166_H */

View File

@ -1,8 +1,7 @@
/* maxicode.h - Handles Maxicode */ /* maxicode.h - Handles Maxicode */
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2008-2017 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2008-2022 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
@ -29,8 +28,12 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
*/ */
/* SPDX-License-Identifier: BSD-3-Clause */
static const unsigned short int MaxiGrid[] = { #ifndef Z_MAXICODE_H
#define Z_MAXICODE_H
static const unsigned short MaxiGrid[] = {
/* ISO/IEC 16023 Figure 5 - MaxiCode Module Sequence */ /* 30 x 33 data grid */ /* ISO/IEC 16023 Figure 5 - MaxiCode Module Sequence */ /* 30 x 33 data grid */
122, 121, 128, 127, 134, 133, 140, 139, 146, 145, 152, 151, 158, 157, 164, 163, 170, 169, 176, 175, 182, 181, 188, 187, 194, 193, 200, 199, 0, 0, 122, 121, 128, 127, 134, 133, 140, 139, 146, 145, 152, 151, 158, 157, 164, 163, 170, 169, 176, 175, 182, 181, 188, 187, 194, 193, 200, 199, 0, 0,
124, 123, 130, 129, 136, 135, 142, 141, 148, 147, 154, 153, 160, 159, 166, 165, 172, 171, 178, 177, 184, 183, 190, 189, 196, 195, 202, 201, 817, 0, 124, 123, 130, 129, 136, 135, 142, 141, 148, 147, 154, 153, 160, 159, 166, 165, 172, 171, 178, 177, 184, 183, 190, 189, 196, 195, 202, 201, 817, 0,
@ -102,3 +105,5 @@ static const char maxiSymbolChar[256] = {
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 32, 33, 34, 35, 36 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 32, 33, 34, 35, 36
}; };
/* vim: set ts=4 sw=4 et : */
#endif /* Z_MAXICODE_H */

View File

@ -1,5 +1,4 @@
/* medical.c - Handles 1 track and 2 track pharmacode and Codabar */ /* medical.c - Handles 1 track and 2 track pharmacode and Codabar */
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2008-2022 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2008-2022 Robin Stuart <rstuart114@gmail.com>
@ -29,9 +28,10 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
*/ */
/* SPDX-License-Identifier: BSD-3-Clause */
#include <stdio.h>
#include "common.h" #include "common.h"
#include <stdio.h>
INTERNAL int code39(struct zint_symbol *symbol, unsigned char source[], int length); INTERNAL int code39(struct zint_symbol *symbol, unsigned char source[], int length);

View File

@ -1,7 +1,7 @@
/* output.h - Common routines for raster/vector /* output.h - Common routines for raster/vector */
/*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2020 - 2021 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2020-2022 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
@ -28,7 +28,7 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
*/ */
/* vim: set ts=4 sw=4 et : */ /* SPDX-License-Identifier: BSD-3-Clause */
#ifndef Z_OUTPUT_H #ifndef Z_OUTPUT_H
#define Z_OUTPUT_H #define Z_OUTPUT_H
@ -52,4 +52,5 @@ INTERNAL void out_upcean_split_text(int upceanflag, unsigned char text[],
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
/* vim: set ts=4 sw=4 et : */
#endif /* Z_OUTPUT_H */ #endif /* Z_OUTPUT_H */

View File

@ -1,5 +1,4 @@
/* pdf417.h - PDF417 tables and coefficients declarations */ /* pdf417.h - PDF417 tables and coefficients declarations */
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2008-2022 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2008-2022 Robin Stuart <rstuart114@gmail.com>
@ -30,6 +29,7 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
*/ */
/* SPDX-License-Identifier: BSD-3-Clause */
/* See "pdf417_tabs.h" for table definitions */ /* See "pdf417_tabs.h" for table definitions */

View File

@ -1,5 +1,4 @@
/* pdf417_tabs.h - PDF417 tables and coefficients */ /* pdf417_tabs.h - PDF417 tables and coefficients */
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2008-2022 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2008-2022 Robin Stuart <rstuart114@gmail.com>
@ -30,6 +29,7 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
*/ */
/* SPDX-License-Identifier: BSD-3-Clause */
/* this file contains the character table, the pre-calculated coefficients and the /* this file contains the character table, the pre-calculated coefficients and the
codeword patterns taken from lines 416 to 454 of pdf417.frm */ codeword patterns taken from lines 416 to 454 of pdf417.frm */

View File

@ -1,7 +1,10 @@
/* /*
This is a simple Reed-Solomon encoder This is a simple Reed-Solomon encoder
(C) Cliff Hones 2004 (C) Cliff Hones 2004
*/
/*
libzint - the open source barcode library
Copyright (C) 2009-2022 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
@ -29,7 +32,7 @@
SUCH DAMAGE. SUCH DAMAGE.
*/ */
/* vim: set ts=4 sw=4 et : */ /* SPDX-License-Identifier: BSD-3-Clause */
#ifndef Z_REEDSOL_H #ifndef Z_REEDSOL_H
#define Z_REEDSOL_H #define Z_REEDSOL_H
@ -72,4 +75,5 @@ INTERNAL void rs_uint_free(rs_uint_t *rs_uint);
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
/* vim: set ts=4 sw=4 et : */
#endif /* Z_REEDSOL_H */ #endif /* Z_REEDSOL_H */

View File

@ -1,7 +1,7 @@
/* reedsol_logs.h - Log and antilog tables for Reed-Solomon /* reedsol_logs.h - Log and antilog tables for Reed-Solomon */
/*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2020 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2020-2022 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
@ -28,10 +28,10 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
*/ */
/* vim: set ts=4 sw=4 et : */ /* SPDX-License-Identifier: BSD-3-Clause */
#ifndef REEDSOL_LOGS_H #ifndef Z_REEDSOL_LOGS_H
#define REEDSOL_LOGS_H #define Z_REEDSOL_LOGS_H
/* Static log/antilog tables for prime polys of up to degree 8 (> 8 too large so generated at runtime instead). /* Static log/antilog tables for prime polys of up to degree 8 (> 8 too large so generated at runtime instead).
* Antilog tables doubled to avoid mod. */ * Antilog tables doubled to avoid mod. */
@ -261,4 +261,5 @@ static const unsigned char alog_0x163[510] = {
0x4C, 0x98, 0x53, 0xA6, 0x2F, 0x5E, 0xBC, 0x1B, 0x36, 0x6C, 0xD8, 0xD3, 0xC5, 0xE9, 0xB1, 0x4C, 0x98, 0x53, 0xA6, 0x2F, 0x5E, 0xBC, 0x1B, 0x36, 0x6C, 0xD8, 0xD3, 0xC5, 0xE9, 0xB1,
}; };
#endif /* REEDSOL_LOGS_H */ /* vim: set ts=4 sw=4 et : */
#endif /* Z_REEDSOL_LOGS_H */

View File

@ -1,8 +1,7 @@
/* rss.h - Data tables for Reduced Space Symbology */ /* rss.h - Data tables for Reduced Space Symbology */
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2007 - 2020 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2007-2022 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
@ -29,10 +28,13 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
*/ */
/* vim: set ts=4 sw=4 et : */ /* SPDX-License-Identifier: BSD-3-Clause */
#ifndef Z_RSS_H
#define Z_RSS_H
/* RSS-14 Tables */ /* RSS-14 Tables */
static const unsigned short int g_sum_table[9] = { static const unsigned short g_sum_table[9] = {
0, 161, 961, 2015, 2715, 0, 336, 1036, 1516 0, 161, 961, 2015, 2715, 0, 336, 1036, 1516
}; };
@ -77,7 +79,7 @@ static const char checksum_weight[32] = {
}; };
/* RSS Limited Tables */ /* RSS Limited Tables */
static const unsigned short int t_even_ltd[7] = { static const unsigned short t_even_ltd[7] = {
28, 728, 6454, 203, 2408, 1, 16632 28, 728, 6454, 203, 2408, 1, 16632
}; };
@ -196,11 +198,11 @@ static const char finder_pattern_ltd[1246] = {
}; };
/* RSS Expanded Tables */ /* RSS Expanded Tables */
static const unsigned short int g_sum_exp[5] = { static const unsigned short g_sum_exp[5] = {
0, 348, 1388, 2948, 3988 0, 348, 1388, 2948, 3988
}; };
static const unsigned short int t_even_exp[5] = { static const unsigned short t_even_exp[5] = {
4, 20, 52, 104, 204 4, 20, 52, 104, 204
}; };
@ -220,7 +222,7 @@ static const char widest_even_exp[5] = {
2, 4, 5, 6, 8 2, 4, 5, 6, 8
}; };
static const unsigned short int checksum_weight_exp[184] = { static const unsigned short checksum_weight_exp[184] = {
/* Table 14 */ /* Table 14 */
1, 3, 9, 27, 81, 32, 96, 77, 1, 3, 9, 27, 81, 32, 96, 77,
20, 60, 180, 118, 143, 7, 21, 63, 20, 60, 180, 118, 143, 7, 21, 63,
@ -290,3 +292,5 @@ static const char weight_rows[210] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 13, 14, 11, 12, 17, 18, 15, 16, 21, 22, 19, 20 0, 1, 2, 3, 4, 5, 6, 7, 8, 13, 14, 11, 12, 17, 18, 15, 16, 21, 22, 19, 20
}; };
/* vim: set ts=4 sw=4 et : */
#endif /* Z_RSS_H */

View File

@ -1,8 +1,7 @@
/* telepen.c - Handles Telepen and Telepen numeric */ /* telepen.c - Handles Telepen and Telepen numeric */
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2008-2021 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2008-2022 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
@ -29,15 +28,15 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
*/ */
/* vim: set ts=4 sw=4 et : */ /* SPDX-License-Identifier: BSD-3-Clause */
/* Telepen Barcode Symbology information and History (BSiH) /* Telepen Barcode Symbology information and History (BSiH)
https://telepen.co.uk/wp-content/uploads/2018/10/Barcode-Symbology-information-and-History.pdf */ https://telepen.co.uk/wp-content/uploads/2018/10/Barcode-Symbology-information-and-History.pdf */
#define SODIUM_X_F (IS_NUM_F | IS_UX__F | IS_LX__F) /* SODIUM "0123456789Xx" */ #define SODIUM_X_F (IS_NUM_F | IS_UX__F | IS_LX__F) /* SODIUM "0123456789Xx" */
#include <stdio.h>
#include "common.h" #include "common.h"
#include <stdio.h>
static const char TeleTable[128][16] = { static const char TeleTable[128][16] = {
{ "31313131" }, { "1131313111" }, { "33313111" }, { "1111313131" }, { "31313131" }, { "1131313111" }, { "33313111" }, { "1111313131" },
@ -74,6 +73,7 @@ static const char TeleTable[128][16] = {
{ "31111111111111" }, { "111311111113" }, { "131111111113" }, { "31111111111111" }, { "111311111113" }, { "131111111113" },
{'1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1'}, {'1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1'},
}; };
/* Generated by "backend/tests/test_telepen -f generate_lens -g" */ /* Generated by "backend/tests/test_telepen -f generate_lens -g" */
static const char TeleLens[128] = { static const char TeleLens[128] = {
8, 10, 8, 10, 10, 8, 8, 12, 8, 10, 8, 10, 10, 10, 10, 12, 8, 10, 8, 10, 10, 8, 8, 12, 8, 10, 8, 10, 10, 10, 10, 12,
@ -224,3 +224,5 @@ INTERNAL int telepen_num(struct zint_symbol *symbol, unsigned char source[], int
ustrcpy(symbol->text, temp); ustrcpy(symbol->text, temp);
return error_number; return error_number;
} }
/* vim: set ts=4 sw=4 et : */

View File

@ -1,7 +1,7 @@
/* tif_lzw.h - LZW compression for TIFF /* tif_lzw.h - LZW compression for TIFF */
/*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2021 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2021-2022 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
@ -28,10 +28,10 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
*/ */
/* vim: set ts=4 sw=4 et : */ /* SPDX-License-Identifier: BSD-3-Clause */
#ifndef TIF_LZW_H #ifndef Z_TIF_LZW_H
#define TIF_LZW_H #define Z_TIF_LZW_H
/* /*
* Adapted from TIFF Library 4.2.0 libtiff/tif_lzw.c */ * Adapted from TIFF Library 4.2.0 libtiff/tif_lzw.c */
@ -370,4 +370,5 @@ static void tif_lzw_init(tif_lzw_state *sp) {
sp->enc_hashtab = NULL; sp->enc_hashtab = NULL;
} }
#endif /* TIF_LZW_H */ /* vim: set ts=4 sw=4 et : */
#endif /* Z_TIF_LZW_H */

View File

@ -2,13 +2,14 @@
/* Generate ISO 3166 include "backend/iso3166.h" for "backend/gs1.c" */ /* Generate ISO 3166 include "backend/iso3166.h" for "backend/gs1.c" */
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2021 <rstuart114@gmail.com> Copyright (C) 2021-2022 Robin Stuart <rstuart114@gmail.com>
*/ */
/* SPDX-License-Identifier: BSD-3-Clause */
/* To create "backend/iso3166.h" (from project directory): /* To create "backend/iso3166.h" (from project directory):
* *
* php backend/tools/gen_iso3166_h.php > backend/iso3166.h * php backend/tools/gen_iso3166_h.php > backend/iso3166.h
*/ */
/* vim: set ts=4 sw=4 et : */
$basename = basename(__FILE__); $basename = basename(__FILE__);
$dirname = dirname(__FILE__); $dirname = dirname(__FILE__);
@ -122,7 +123,7 @@ if ($print_copyright) {
print <<<'EOD' print <<<'EOD'
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2021 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2021-2022 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
@ -149,6 +150,7 @@ print <<<'EOD'
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
*/ */
/* SPDX-License-Identifier: BSD-3-Clause */
EOD; EOD;
@ -156,8 +158,8 @@ EOD;
if ($print_h_guard) { if ($print_h_guard) {
print <<<'EOD' print <<<'EOD'
#ifndef ISO3166_H #ifndef Z_ISO3166_H
#define ISO3166_H #define Z_ISO3166_H
EOD; EOD;
} }
@ -219,7 +221,9 @@ EOD;
if ($print_h_guard) { if ($print_h_guard) {
print <<<'EOD' print <<<'EOD'
#endif /* ISO3166_H */ #endif /* Z_ISO3166_H */
EOD; EOD;
} }
/* vim: set ts=4 sw=4 et : */

View File

@ -1,7 +1,7 @@
/* zintconfig.h - the configured options and settings for libzint /* zintconfig.h - the configured options and settings for libzint */
/*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2021 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2021-2022 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
@ -28,7 +28,7 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
*/ */
/* vim: set ts=4 sw=4 et : */ /* SPDX-License-Identifier: BSD-3-Clause */
#ifndef ZINTCONFIG_H #ifndef ZINTCONFIG_H
#define ZINTCONFIG_H #define ZINTCONFIG_H
@ -38,4 +38,5 @@
#define ZINT_VERSION_RELEASE 1 #define ZINT_VERSION_RELEASE 1
#define ZINT_VERSION_BUILD 9 #define ZINT_VERSION_BUILD 9
/* vim: set ts=4 sw=4 et : */
#endif /* ZINTCONFIG_H */ #endif /* ZINTCONFIG_H */