mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
code reworked
This commit is contained in:
parent
f48d7ab6a6
commit
bf2dbe7494
@ -3,20 +3,6 @@
|
||||
/*
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2008 Robin Stuart <robin@zint.org.uk>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
@ -27,13 +13,13 @@
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
static char *C25MatrixTable[10] = {"113311", "311131", "131131", "331111", "113131", "313111",
|
||||
static const char *C25MatrixTable[10] = {"113311", "311131", "131131", "331111", "113131", "313111",
|
||||
"133111", "111331", "311311", "131311"};
|
||||
|
||||
static char *C25IndustTable[10] = {"1111313111", "3111111131", "1131111131", "3131111111", "1111311131",
|
||||
static const char *C25IndustTable[10] = {"1111313111", "3111111131", "1131111131", "3131111111", "1111311131",
|
||||
"3111311111", "1131311111", "1111113131", "3111113111", "1131113111"};
|
||||
|
||||
static char *C25InterTable[10] = {"11331", "31113", "13113", "33111", "11313", "31311", "13311", "11133",
|
||||
static const char *C25InterTable[10] = {"11331", "31113", "13113", "33111", "11313", "31311", "13311", "11133",
|
||||
"31131", "13131"};
|
||||
|
||||
static inline char check_digit(unsigned int count)
|
||||
|
@ -26,7 +26,7 @@ POSTAL:= postal.c auspost.c imail.c
|
||||
POSTAL_OBJ:= postal.o auspost.o imail.o
|
||||
TWODIM:= code16k.c dmatrix.c pdf417.c qr.c maxicode.c composite.c aztec.c code49.c code1.c gridmtx.c
|
||||
TWODIM_OBJ:= code16k.o dmatrix.o pdf417.o qr.o maxicode.o composite.o aztec.o code49.o code1.o gridmtx.o
|
||||
LIBS:= `libpng12-config --I_opts --L_opts --ldflags` -lz -lm
|
||||
LIBS:= -lz -lm -lpng
|
||||
|
||||
libzint: code.c code128.c 2of5.c upcean.c medical.c telepen.c plessey.c postal.c auspost.c imail.c code16k.c dmatrix.c reedsol.c pdf417.c maxicode.c rss.c common.c render.c png.c library.c ps.c qr.c large.c composite.c aztec.c gs1.c svg.c code49.c code1.c gridmtx.c
|
||||
$(CC) -Wall -fPIC $(CFLAGS) $(ZINT_VERSION) -c $(ONEDIM)
|
||||
|
@ -3,34 +3,20 @@
|
||||
/*
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2008 Robin Stuart <robin@zint.org.uk>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#define GDSET "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz #"
|
||||
|
||||
static char *AusNTable[10] = {"00", "01", "02", "10", "11", "12", "20", "21", "22", "30"};
|
||||
static const char *AusNTable[10] = {"00", "01", "02", "10", "11", "12", "20", "21", "22", "30"};
|
||||
|
||||
static char *AusCTable[64] = {"222", "300", "301", "302", "310", "311", "312", "320", "321", "322",
|
||||
static const char *AusCTable[64] = {"222", "300", "301", "302", "310", "311", "312", "320", "321", "322",
|
||||
"000", "001", "002", "010", "011", "012", "020", "021", "022", "100", "101", "102", "110",
|
||||
"111", "112", "120", "121", "122", "200", "201", "202", "210", "211", "212", "220", "221",
|
||||
"023", "030", "031", "032", "033", "103", "113", "123", "130", "131", "132", "133", "203",
|
||||
"213", "223", "230", "231", "232", "233", "303", "313", "323", "330", "331", "332", "333",
|
||||
"003", "013"};
|
||||
|
||||
static char *AusBarTable[64] = {"000", "001", "002", "003", "010", "011", "012", "013", "020", "021",
|
||||
static const char *AusBarTable[64] = {"000", "001", "002", "003", "010", "011", "012", "013", "020", "021",
|
||||
"022", "023", "030", "031", "032", "033", "100", "101", "102", "103", "110", "111", "112",
|
||||
"113", "120", "121", "122", "123", "130", "131", "132", "133", "200", "201", "202", "203",
|
||||
"210", "211", "212", "213", "220", "221", "222", "223", "230", "231", "232", "233", "300",
|
||||
@ -96,7 +82,7 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[], int lengt
|
||||
unsigned int loopey, reader, h;
|
||||
|
||||
char data_pattern[200];
|
||||
char fcc[3], dpid[10];
|
||||
char fcc[3] = {0, 0}, dpid[10];
|
||||
char localstr[30];
|
||||
|
||||
error_number = 0;
|
||||
@ -201,14 +187,15 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[], int lengt
|
||||
|
||||
/* Filler bar */
|
||||
h = strlen(data_pattern);
|
||||
if(h == 22) {
|
||||
concat(data_pattern, "3");
|
||||
}
|
||||
else if(h == 37) {
|
||||
concat(data_pattern, "3");
|
||||
}
|
||||
else if(h == 52) {
|
||||
switch (h)
|
||||
{
|
||||
case 22:
|
||||
case 37:
|
||||
case 52:
|
||||
concat(data_pattern, "3");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* Reed Solomon error correction */
|
||||
|
@ -29,15 +29,20 @@
|
||||
#include "aztec.h"
|
||||
#include "reedsol.h"
|
||||
|
||||
/**
|
||||
* Shorten the string by one character
|
||||
*/
|
||||
void mapshorten(int *charmap, int *typemap, int start, int length)
|
||||
{ /* Shorten the string by one character */
|
||||
|
||||
{
|
||||
memmove(charmap + start + 1 , charmap + start + 2, (length - 1) * sizeof(int));
|
||||
memmove(typemap + start + 1 , typemap + start + 2, (length - 1) * sizeof(int));
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert a character into the middle of a string at position posn
|
||||
*/
|
||||
void insert(char binary_string[], int posn, char newbit)
|
||||
{ /* Insert a character into the middle of a string at position posn */
|
||||
{
|
||||
int i, end;
|
||||
|
||||
end = strlen(binary_string);
|
||||
@ -47,8 +52,11 @@ void insert(char binary_string[], int posn, char newbit)
|
||||
binary_string[posn] = newbit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode input data into a binary string
|
||||
*/
|
||||
int aztec_text_process(unsigned char source[], const unsigned int src_len, char binary_string[], int gs1)
|
||||
{ /* Encode input data into a binary string */
|
||||
{
|
||||
int i, j, k, bytes;
|
||||
int curtable, newtable, lasttable, chartype, maplength, blocks, debug;
|
||||
#ifndef _MSC_VER
|
||||
|
@ -3,20 +3,6 @@
|
||||
/*
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2008 Robin Stuart <robin@zint.org.uk>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#define UPPER 1
|
||||
@ -26,7 +12,7 @@
|
||||
#define DIGIT 16
|
||||
#define BINARY 32
|
||||
|
||||
static int AztecMap[] = { /* 151 x 151 data grid */
|
||||
static const int AztecMap[] = { /* 151 x 151 data grid */
|
||||
19969,19968,18851,18853,18855,18857,18859,18861,18863,18865,18867,0,18869,18871,18873,18875,18877,18879,18881,18883,18885,18887,18889,18891,18893,18895,18897,0,18899,18901,18903,18905,18907,18909,18911,18913,18915,18917,18919,18921,18923,18925,18927,0,18929,18931,18933,18935,18937,18939,18941,18943,18945,18947,18949,18951,18953,18955,18957,0,18959,18961,18963,18965,18967,18969,18971,18973,18975,18977,18979,18981,18983,18985,18987,0,18989,18991,18993,18995,18997,18999,19001,19003,19005,19007,19009,19011,19013,19015,19017,0,19019,19021,19023,19025,19027,19029,19031,19033,19035,19037,19039,19041,19043,19045,19047,0,19049,19051,19053,19055,19057,19059,19061,19063,19065,19067,19069,19071,19073,19075,19077,0,19079,19081,19083,19085,19087,19089,19091,19093,19095,19097,19099,19101,19103,19105,19107,0,19109,19111,19113,19115,19117,19119,19121,19123,19125,19127,19129,
|
||||
19967,19966,18850,18852,18854,18856,18858,18860,18862,18864,18866,1,18868,18870,18872,18874,18876,18878,18880,18882,18884,18886,18888,18890,18892,18894,18896,1,18898,18900,18902,18904,18906,18908,18910,18912,18914,18916,18918,18920,18922,18924,18926,1,18928,18930,18932,18934,18936,18938,18940,18942,18944,18946,18948,18950,18952,18954,18956,1,18958,18960,18962,18964,18966,18968,18970,18972,18974,18976,18978,18980,18982,18984,18986,1,18988,18990,18992,18994,18996,18998,19000,19002,19004,19006,19008,19010,19012,19014,19016,1,19018,19020,19022,19024,19026,19028,19030,19032,19034,19036,19038,19040,19042,19044,19046,1,19048,19050,19052,19054,19056,19058,19060,19062,19064,19066,19068,19070,19072,19074,19076,1,19078,19080,19082,19084,19086,19088,19090,19092,19094,19096,19098,19100,19102,19104,19106,1,19108,19110,19112,19114,19116,19118,19120,19122,19124,19126,19128,
|
||||
19965,19964,18849,18848,17763,17765,17767,17769,17771,17773,17775,0,17777,17779,17781,17783,17785,17787,17789,17791,17793,17795,17797,17799,17801,17803,17805,0,17807,17809,17811,17813,17815,17817,17819,17821,17823,17825,17827,17829,17831,17833,17835,0,17837,17839,17841,17843,17845,17847,17849,17851,17853,17855,17857,17859,17861,17863,17865,0,17867,17869,17871,17873,17875,17877,17879,17881,17883,17885,17887,17889,17891,17893,17895,0,17897,17899,17901,17903,17905,17907,17909,17911,17913,17915,17917,17919,17921,17923,17925,0,17927,17929,17931,17933,17935,17937,17939,17941,17943,17945,17947,17949,17951,17953,17955,0,17957,17959,17961,17963,17965,17967,17969,17971,17973,17975,17977,17979,17981,17983,17985,0,17987,17989,17991,17993,17995,17997,17999,18001,18003,18005,18007,18009,18011,18013,18015,0,18017,18019,18021,18023,18025,18027,18029,18031,18033,19130,19131,
|
||||
@ -180,7 +166,7 @@ static int AztecMap[] = { /* 151 x 151 data grid */
|
||||
19689,19687,19685,19683,19681,19679,19677,19675,19673,19671,19669,0,19667,19665,19663,19661,19659,19657,19655,19653,19651,19649,19647,19645,19643,19641,19639,0,19637,19635,19633,19631,19629,19627,19625,19623,19621,19619,19617,19615,19613,19611,19609,0,19607,19605,19603,19601,19599,19597,19595,19593,19591,19589,19587,19585,19583,19581,19579,0,19577,19575,19573,19571,19569,19567,19565,19563,19561,19559,19557,19555,19553,19551,19549,0,19547,19545,19543,19541,19539,19537,19535,19533,19531,19529,19527,19525,19523,19521,19519,0,19517,19515,19513,19511,19509,19507,19505,19503,19501,19499,19497,19495,19493,19491,19489,0,19487,19485,19483,19481,19479,19477,19475,19473,19471,19469,19467,19465,19463,19461,19459,0,19457,19455,19453,19451,19449,19447,19445,19443,19441,19439,19437,19435,19433,19431,19429,0,19427,19425,19423,19421,19419,19417,19415,19413,19411,19408,19409
|
||||
};
|
||||
|
||||
static int CompactAztecMap[] = { /* 27 x 27 data grid */
|
||||
static const int CompactAztecMap[] = { /* 27 x 27 data grid */
|
||||
609,608,411,413,415,417,419,421,423,425,427,429,431,433,435,437,439,441,443,445,447,449,451,453,455,457,459,
|
||||
607,606,410,412,414,416,418,420,422,424,426,428,430,432,434,436,438,440,442,444,446,448,450,452,454,456,458,
|
||||
605,604,409,408,243,245,247,249,251,253,255,257,259,261,263,265,267,269,271,273,275,277,279,281,283,460,461,
|
||||
@ -210,7 +196,7 @@ static int CompactAztecMap[] = { /* 27 x 27 data grid */
|
||||
559,557,555,553,551,549,547,545,543,541,539,537,535,533,531,529,527,525,523,521,519,517,515,513,511,508,509
|
||||
};
|
||||
|
||||
int AztecCodeSet[128] = { /* From Table 2 */
|
||||
const int AztecCodeSet[128] = { /* From Table 2 */
|
||||
32, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 12, 32, 32, 32, 32, 32, 32,
|
||||
32, 32, 32, 32, 32, 32, 32, 4, 4, 4, 4, 4, 23, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 24, 8, 24, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 8, 8,
|
||||
@ -220,7 +206,7 @@ int AztecCodeSet[128] = { /* From Table 2 */
|
||||
2, 2, 2, 8, 4, 8, 4, 4
|
||||
};
|
||||
|
||||
int AztecSymbolChar[128] = { /* From Table 2 */
|
||||
const int AztecSymbolChar[128] = { /* From Table 2 */
|
||||
0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 300, 14, 15, 16, 17, 18, 19,
|
||||
20, 21, 22, 23, 24, 25, 26, 15, 16, 17, 18, 19, 1, 6, 7, 8, 9, 10, 11, 12,
|
||||
13, 14, 15, 16, 301, 18, 302, 20, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 21, 22,
|
||||
@ -236,56 +222,56 @@ int AztecSymbolChar[128] = { /* From Table 2 */
|
||||
302: Full Stop (ASCII 46)
|
||||
*/
|
||||
|
||||
static char *hexbit[32] = {"00000", "00001", "00010", "00011", "00100", "00101", "00110", "00111", "01000", "01001",
|
||||
static const char *hexbit[32] = {"00000", "00001", "00010", "00011", "00100", "00101", "00110", "00111", "01000", "01001",
|
||||
"01010", "01011", "01100", "01101", "01110", "01111", "10000", "10001", "10010", "10011", "10100", "10101",
|
||||
"10110", "10111", "11000", "11001", "11010", "11011", "11100", "11101", "11110", "11111"
|
||||
};
|
||||
|
||||
static char *pentbit[16] = {"0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", "1000", "1001",
|
||||
static const char *pentbit[16] = {"0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", "1000", "1001",
|
||||
"1010", "1011", "1100", "1101", "1110", "1111"
|
||||
};
|
||||
|
||||
static char *tribit[8] = {"000", "001", "010", "011", "100", "101", "110", "111"};
|
||||
static const char *tribit[8] = {"000", "001", "010", "011", "100", "101", "110", "111"};
|
||||
|
||||
static int AztecSizes[32] = { /* Codewords per symbol */
|
||||
static const int AztecSizes[32] = { /* Codewords per symbol */
|
||||
21, 48, 60, 88, 120, 156, 196, 240, 230, 272, 316, 364, 416, 470, 528, 588, 652, 720, 790,
|
||||
864, 940, 1020, 920, 992, 1066, 1144, 1224, 1306, 1392, 1480, 1570, 1664
|
||||
};
|
||||
|
||||
static int AztecCompactSizes[4] = { 17, 40, 51, 76 };
|
||||
static const int AztecCompactSizes[4] = { 17, 40, 51, 76 };
|
||||
|
||||
static int Aztec10DataSizes[32] = { /* Data bits per symbol maximum with 10% error correction */
|
||||
static const int Aztec10DataSizes[32] = { /* Data bits per symbol maximum with 10% error correction */
|
||||
96, 246, 408, 616, 840, 1104, 1392, 1704, 2040, 2420, 2820, 3250, 3720, 4200, 4730,
|
||||
5270, 5840, 6450, 7080, 7750, 8430, 9150, 9900, 10680, 11484, 12324, 13188, 14076,
|
||||
15000, 15948, 16920, 17940
|
||||
};
|
||||
|
||||
static int Aztec23DataSizes[32] = { /* Data bits per symbol maximum with 23% error correction */
|
||||
static const int Aztec23DataSizes[32] = { /* Data bits per symbol maximum with 23% error correction */
|
||||
84, 204, 352, 520, 720, 944, 1184, 1456, 1750, 2070, 2410, 2780, 3180, 3590, 4040,
|
||||
4500, 5000, 5520, 6060, 6630, 7210, 7830, 8472, 9132, 9816, 10536, 11280, 12036,
|
||||
12828, 13644, 14472, 15348
|
||||
};
|
||||
|
||||
static int Aztec36DataSizes[32] = { /* Data bits per symbol maximum with 36% error correction */
|
||||
static const int Aztec36DataSizes[32] = { /* Data bits per symbol maximum with 36% error correction */
|
||||
66, 168, 288, 432, 592, 776, 984, 1208, 1450, 1720, 2000, 2300, 2640, 2980, 3350,
|
||||
3740, 4150, 4580, 5030, 5500, 5990, 6500, 7032, 7584, 8160, 8760, 9372, 9996, 10656,
|
||||
11340, 12024, 12744
|
||||
};
|
||||
|
||||
static int Aztec50DataSizes[32] = { /* Data bits per symbol maximum with 50% error correction */
|
||||
static const int Aztec50DataSizes[32] = { /* Data bits per symbol maximum with 50% error correction */
|
||||
48, 126, 216, 328, 456, 600, 760, 936, 1120, 1330, 1550, 1790, 2050, 2320, 2610,
|
||||
2910, 3230, 3570, 3920, 4290, 4670, 5070, 5484, 5916, 6360, 6828, 7308, 7800, 8316,
|
||||
8844, 9384, 9948
|
||||
};
|
||||
|
||||
static int AztecCompact10DataSizes [4] = { 78, 198, 336, 520 };
|
||||
static int AztecCompact23DataSizes [4] = { 66, 168, 288, 440 };
|
||||
static int AztecCompact36DataSizes [4] = { 48, 138, 232, 360 };
|
||||
static int AztecCompact50DataSizes [4] = { 36, 102, 176, 280 };
|
||||
static const int AztecCompact10DataSizes [4] = { 78, 198, 336, 520 };
|
||||
static const int AztecCompact23DataSizes [4] = { 66, 168, 288, 440 };
|
||||
static const int AztecCompact36DataSizes [4] = { 48, 138, 232, 360 };
|
||||
static const int AztecCompact50DataSizes [4] = { 36, 102, 176, 280 };
|
||||
|
||||
static int AztecOffset[32] = {
|
||||
static const int AztecOffset[32] = {
|
||||
66, 64, 62, 60, 57, 55, 53, 51, 49, 47, 45, 42, 40, 38, 36, 34, 32, 30, 28, 25, 23, 21,
|
||||
19, 17, 15, 13, 10, 8, 6, 4, 2, 0
|
||||
};
|
||||
|
||||
static int AztecCompactOffset[4] = { 6, 4, 2, 0 };
|
||||
static const int AztecCompactOffset[4] = { 6, 4, 2, 0 };
|
||||
|
@ -3,20 +3,6 @@
|
||||
/*
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2008 Robin Stuart <robin@zint.org.uk>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
/* In version 0.5 this file was 1,553 lines long! */
|
||||
@ -29,7 +15,7 @@
|
||||
#define SODIUM "0123456789-"
|
||||
#define SILVER "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd"
|
||||
|
||||
static char *C11Table[11] = {"111121", "211121", "121121", "221111", "112121", "212111", "122111",
|
||||
static const char *C11Table[11] = {"111121", "211121", "121121", "221111", "112121", "212111", "122111",
|
||||
"111221", "211211", "211111", "112111"};
|
||||
|
||||
|
||||
@ -37,7 +23,7 @@ static char *C11Table[11] = {"111121", "211121", "121121", "221111", "112121", "
|
||||
|
||||
/* Incorporates Table A1 */
|
||||
|
||||
static char *C39Table[43] = { "1112212111", "2112111121", "1122111121", "2122111111", "1112211121",
|
||||
static const char *C39Table[43] = { "1112212111", "2112111121", "1122111121", "2122111111", "1112211121",
|
||||
"2112211111", "1122211111", "1112112121", "2112112111", "1122112111", "2111121121",
|
||||
"1121121121", "2121121111", "1111221121", "2111221111", "1121221111", "1111122121",
|
||||
"2111122111", "1121122111", "1111222111", "2111111221", "1121111221", "2121111211",
|
||||
@ -47,7 +33,7 @@ static char *C39Table[43] = { "1112212111", "2112111121", "1122111121", "2122111
|
||||
"1211121211", "1112121211"};
|
||||
/* Code 39 character assignments (Table 1) */
|
||||
|
||||
static char *EC39Ctrl[128] = {"%U", "$A", "$B", "$C", "$D", "$E", "$F", "$G", "$H", "$I", "$J", "$K",
|
||||
static const char *EC39Ctrl[128] = {"%U", "$A", "$B", "$C", "$D", "$E", "$F", "$G", "$H", "$I", "$J", "$K",
|
||||
"$L", "$M", "$N", "$O", "$P", "$Q", "$R", "$S", "$T", "$U", "$V", "$W", "$X", "$Y", "$Z",
|
||||
"%A", "%B", "%C", "%D", "%E", " ", "/A", "/B", "/C", "/D", "/E", "/F", "/G", "/H", "/I", "/J",
|
||||
"/K", "/L", "-", ".", "/O", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "/Z", "%F",
|
||||
@ -57,7 +43,7 @@ static char *EC39Ctrl[128] = {"%U", "$A", "$B", "$C", "$D", "$E", "$F", "$G", "$
|
||||
"+P", "+Q", "+R", "+S", "+T", "+U", "+V", "+W", "+X", "+Y", "+Z", "%P", "%Q", "%R", "%S", "%T"};
|
||||
/* Encoding the full ASCII character set in Code 39 (Table A2) */
|
||||
|
||||
static char *C93Ctrl[128] = {"bU", "aA", "aB", "aC", "aD", "aE", "aF", "aG", "aH", "aI", "aJ", "aK",
|
||||
static const char *C93Ctrl[128] = {"bU", "aA", "aB", "aC", "aD", "aE", "aF", "aG", "aH", "aI", "aJ", "aK",
|
||||
"aL", "aM", "aN", "aO", "aP", "aQ", "aR", "aS", "aT", "aU", "aV", "aW", "aX", "aY", "aZ",
|
||||
"bA", "bB", "bC", "bD", "bE", " ", "cA", "cB", "cC", "cD", "cE", "cF", "cG", "cH", "cI", "cJ",
|
||||
"cK", "cL", "cM", "cN", "cO", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "cZ", "bF",
|
||||
@ -66,7 +52,7 @@ static char *C93Ctrl[128] = {"bU", "aA", "aB", "aC", "aD", "aE", "aF", "aG", "aH
|
||||
"bW", "dA", "dB", "dC", "dD", "dE", "dF", "dG", "dH", "dI", "dJ", "dK", "dL", "dM", "dN", "dO",
|
||||
"dP", "dQ", "dR", "dS", "dT", "dU", "dV", "dW", "dX", "dY", "dZ", "bP", "bQ", "bR", "bS", "bT"};
|
||||
|
||||
static char *C93Table[47] = {"131112", "111213", "111312", "111411", "121113", "121212", "121311",
|
||||
static const char *C93Table[47] = {"131112", "111213", "111312", "111411", "121113", "121212", "121311",
|
||||
"111114", "131211", "141111", "211113", "211212", "211311", "221112", "221211", "231111",
|
||||
"112113", "112212", "112311", "122112", "132111", "111123", "111222", "111321", "121122",
|
||||
"131121", "212112", "212211", "211122", "211221", "221121", "222111", "112122", "112221",
|
||||
|
@ -593,7 +593,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
|
||||
}
|
||||
|
||||
if(current_mode == C1_EDI) { /* Step E - EDI Encodation */
|
||||
int value = 0, done = 0, latch = 0;
|
||||
int value = 0,latch = 0;
|
||||
|
||||
next_mode = C1_EDI;
|
||||
if(edi_p == 0) {
|
||||
@ -605,7 +605,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
|
||||
}
|
||||
|
||||
if (j == 12) {
|
||||
next_mode = C1_ASCII; done = 1;
|
||||
next_mode = C1_ASCII;
|
||||
}
|
||||
}
|
||||
|
||||
@ -626,7 +626,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
|
||||
}
|
||||
|
||||
if ((j == 8) && latch) {
|
||||
next_mode = C1_ASCII; done = 1;
|
||||
next_mode = C1_ASCII;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,20 +4,6 @@
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2008 Robin Stuart <robin@zint.org.uk>
|
||||
Bugfixes thanks to Christian Sakowski and BogDan Vatra
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@ -193,9 +179,9 @@ void c128_set_c(unsigned char source_a, unsigned char source_b, char dest[], int
|
||||
|
||||
int code_128(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
{ /* Handle Code 128 and NVE-18 */
|
||||
int i, j, k, e_count, values[170] = { 0 }, bar_characters, read, total_sum, nve_check;
|
||||
int i, j, k,values[170] = { 0 }, bar_characters, read, total_sum;
|
||||
int error_number, indexchaine, indexliste, sourcelen, f_state;
|
||||
char set[170] = { ' ' }, fset[170] = { ' ' }, mode, last_set, last_fset, current_set = ' ';
|
||||
char set[170] = { ' ' }, fset[170] = { ' ' }, mode, last_set, current_set = ' ';
|
||||
float glyph_count;
|
||||
char dest[1000];
|
||||
|
||||
@ -205,9 +191,7 @@ int code_128(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
sourcelen = length;
|
||||
|
||||
j = 0;
|
||||
e_count = 0;
|
||||
bar_characters = 0;
|
||||
nve_check = 0;
|
||||
f_state = 0;
|
||||
|
||||
if(sourcelen > 160) {
|
||||
@ -346,7 +330,6 @@ int code_128(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
/* Now we can calculate how long the barcode is going to be - and stop it from
|
||||
being too long */
|
||||
last_set = ' ';
|
||||
last_fset = ' ';
|
||||
glyph_count = 0.0;
|
||||
for(i = 0; i < sourcelen; i++) {
|
||||
if((set[i] == 'a') || (set[i] == 'b')) {
|
||||
@ -363,16 +346,13 @@ int code_128(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
}
|
||||
if(i == 0) {
|
||||
if(fset[i] == 'F') {
|
||||
last_fset = 'F';
|
||||
glyph_count = glyph_count + 2.0;
|
||||
}
|
||||
} else {
|
||||
if((fset[i] == 'F') && (fset[i - 1] != 'F')) {
|
||||
last_fset = 'F';
|
||||
glyph_count = glyph_count + 2.0;
|
||||
}
|
||||
if((fset[i] != 'F') && (fset[i - 1] == 'F')) {
|
||||
last_fset = ' ';
|
||||
glyph_count = glyph_count + 2.0;
|
||||
}
|
||||
}
|
||||
@ -592,7 +572,7 @@ int code_128(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
int ean_128(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
{ /* Handle EAN-128 (Now known as GS1-128) */
|
||||
int i, j, e_count, values[170], bar_characters, read, total_sum;
|
||||
int i, j,values[170], bar_characters, read, total_sum;
|
||||
int error_number, indexchaine, indexliste;
|
||||
char set[170], mode, last_set;
|
||||
float glyph_count;
|
||||
@ -608,7 +588,6 @@ int ean_128(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
linkage_flag = 0;
|
||||
|
||||
j = 0;
|
||||
e_count = 0;
|
||||
bar_characters = 0;
|
||||
separator_row = 0;
|
||||
|
||||
|
@ -3,20 +3,6 @@
|
||||
/*
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2008 Robin Stuart <robin@zint.org.uk>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
/* Updated to comply with BS EN 12323:2005 */
|
||||
@ -44,7 +30,7 @@
|
||||
static int list[2][170];
|
||||
|
||||
/* EN 12323 Table 1 - "Code 16K" character encodations */
|
||||
static char *C16KTable[107] = {"212222", "222122", "222221", "121223", "121322", "131222", "122213",
|
||||
static const char *C16KTable[107] = {"212222", "222122", "222221", "121223", "121322", "131222", "122213",
|
||||
"122312", "132212", "221213", "221312", "231212", "112232", "122132", "122231", "113222",
|
||||
"123122", "123221", "223211", "221132", "221231", "213212", "223112", "312131", "311222",
|
||||
"321122", "321221", "312212", "322112", "322211", "212123", "212321", "232121", "111323",
|
||||
@ -59,11 +45,11 @@ static char *C16KTable[107] = {"212222", "222122", "222221", "121223", "121322",
|
||||
"211133"};
|
||||
|
||||
/* EN 12323 Table 3 and Table 4 - Start patterns and stop patterns */
|
||||
static char *C16KStartStop[8] = {"3211", "2221", "2122", "1411", "1132", "1231", "1114", "3112"};
|
||||
static const char *C16KStartStop[8] = {"3211", "2221", "2122", "1411", "1132", "1231", "1114", "3112"};
|
||||
|
||||
/* EN 12323 Table 5 - Start and stop values defining row numbers */
|
||||
static int C16KStartValues[16] = {0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7};
|
||||
static int C16KStopValues[16] = {0, 1, 2, 3, 4, 5, 6, 7, 4, 5, 6, 7, 0, 1, 2, 3};
|
||||
static const int C16KStartValues[16] = {0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7};
|
||||
static const int C16KStopValues[16] = {0, 1, 2, 3, 4, 5, 6, 7, 4, 5, 6, 7, 0, 1, 2, 3};
|
||||
|
||||
void grwp16(int *indexliste)
|
||||
{
|
||||
@ -172,8 +158,8 @@ int code16k(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
char width_pattern[100];
|
||||
int current_row, rows_needed, flip_flop, looper, first_check, second_check;
|
||||
int indexliste, indexchaine, pads_needed, f_state;
|
||||
char set[160] = { ' ' }, fset[160] = { ' ' }, mode, last_set, last_fset, current_set;
|
||||
unsigned int i, j, k, m, e_count, read, mx_reader, writer;
|
||||
char set[160] = { ' ' }, fset[160] = { ' ' }, mode, last_set,current_set;
|
||||
unsigned int i, j, k, m,read, mx_reader, writer;
|
||||
unsigned int values[160] = { 0 };
|
||||
unsigned int bar_characters;
|
||||
float glyph_count;
|
||||
@ -192,7 +178,6 @@ int code16k(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
return ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
e_count = 0;
|
||||
bar_characters = 0;
|
||||
|
||||
/* Detect extended ASCII characters */
|
||||
@ -331,7 +316,6 @@ int code16k(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
|
||||
/* Make sure the data will fit in the symbol */
|
||||
last_set = ' ';
|
||||
last_fset = ' ';
|
||||
glyph_count = 0.0;
|
||||
for(i = 0; i < input_length; i++) {
|
||||
if((set[i] == 'a') || (set[i] == 'b')) {
|
||||
@ -356,16 +340,13 @@ int code16k(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
}
|
||||
}
|
||||
if(fset[i] == 'F') {
|
||||
last_fset = 'F';
|
||||
glyph_count = glyph_count + 2.0;
|
||||
}
|
||||
} else {
|
||||
if((fset[i] == 'F') && (fset[i - 1] != 'F')) {
|
||||
last_fset = 'F';
|
||||
glyph_count = glyph_count + 2.0;
|
||||
}
|
||||
if((fset[i] != 'F') && (fset[i - 1] == 'F')) {
|
||||
last_fset = ' ';
|
||||
glyph_count = glyph_count + 2.0;
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ void ustrcpy(unsigned char target[], unsigned char source[]) {
|
||||
target[i] = '\0';
|
||||
}
|
||||
|
||||
void concat(char dest[], char source[])
|
||||
void concat(char dest[],const char source[])
|
||||
{ /* Concatinates dest[] with the contents of source[], copying /0 as well */
|
||||
unsigned int i, j, n;
|
||||
|
||||
@ -117,7 +117,7 @@ int posn(char set_string[], char data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void lookup(char set_string[], char *table[], char data, char dest[])
|
||||
void lookup(char set_string[],const char *table[], char data, char dest[])
|
||||
{ /* Replaces huge switch statements for looking up in tables */
|
||||
unsigned int i, n = strlen(set_string);
|
||||
|
||||
|
@ -3,20 +3,6 @@
|
||||
/*
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2009 Robin Stuart <robin@zint.org.uk>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
/* Used in some logic */
|
||||
@ -43,13 +29,13 @@ extern "C"
|
||||
|
||||
extern int ustrlen(unsigned char source[]);
|
||||
extern void ustrcpy(unsigned char target[], unsigned char source[]);
|
||||
extern void concat(char dest[], char source[]);
|
||||
extern void concat(char dest[],const char source[]);
|
||||
extern void uconcat(unsigned char dest[], unsigned char source[]);
|
||||
extern int ctoi(char source);
|
||||
extern char itoc(int source);
|
||||
extern void to_upper(unsigned char source[]);
|
||||
extern int is_sane(char test_string[], unsigned char source[], int length);
|
||||
extern void lookup(char set_string[], char *table[], char data, char dest[]);
|
||||
extern void lookup(char set_string[],const char *table[], char data, char dest[]);
|
||||
extern int posn(char set_string[], char data);
|
||||
extern void expand(struct zint_symbol *symbol, char data[]);
|
||||
extern int is_stackable(int symbology);
|
||||
|
@ -3,20 +3,6 @@
|
||||
/*
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2008 Robin Stuart <robin@zint.org.uk>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
/* The functions "getBit", "init928" and "encode928" are copyright BSI and are
|
||||
@ -710,7 +696,7 @@ int cc_c(struct zint_symbol *symbol, char source[], int cc_width, int ecc_level)
|
||||
int cc_binary_string(struct zint_symbol *symbol, const char source[], char binary_string[], int cc_mode, int *cc_width, int *ecc, int lin_width)
|
||||
{ /* Handles all data encodation from section 5 of ISO/IEC 24723 */
|
||||
int encoding_method, read_posn, d1, d2, value, alpha_pad;
|
||||
int i, j, mask, ai_crop, ai_crop_posn, fnc1_latch;
|
||||
int i, j, mask, ai_crop,fnc1_latch;
|
||||
long int group_val;
|
||||
int ai90_mode, latch, remainder, binary_length;
|
||||
char date_str[4];
|
||||
@ -725,7 +711,6 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
encoding_method = 1;
|
||||
read_posn = 0;
|
||||
ai_crop = 0;
|
||||
ai_crop_posn = -1;
|
||||
fnc1_latch = 0;
|
||||
alpha_pad = 0;
|
||||
ai90_mode = 0;
|
||||
@ -910,13 +895,11 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
||||
if((source[next_ai_posn + 1] == '2') && (source[next_ai_posn + 2] == '1')) {
|
||||
/* AI 21 follows */
|
||||
ai_crop = 1;
|
||||
ai_crop_posn = next_ai_posn + 1;
|
||||
}
|
||||
|
||||
if((source[next_ai_posn + 1] == '8') && (source[next_ai_posn + 2] == '0') && (source[next_ai_posn + 3] == '0') && (source[next_ai_posn + 4] == '4')) {
|
||||
/* AI 8004 follows */
|
||||
ai_crop = 2;
|
||||
ai_crop_posn = next_ai_posn + 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1740,7 +1723,7 @@ void add_leading_zeroes(struct zint_symbol *symbol)
|
||||
int composite(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
{
|
||||
int error_number, cc_mode, cc_width, ecc_level;
|
||||
int j, i, k, separator_row;
|
||||
int j, i, k;
|
||||
unsigned int rs = length + 1;
|
||||
unsigned int bs = 20 * rs;
|
||||
unsigned int pri_len;
|
||||
@ -1755,7 +1738,6 @@ int composite(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
int top_shift, bottom_shift;
|
||||
|
||||
error_number = 0;
|
||||
separator_row = 0;
|
||||
pri_len = strlen(symbol->primary);
|
||||
if(pri_len == 0) {
|
||||
strcpy(symbol->errtxt, "No primary (linear) message in 2D composite");
|
||||
|
@ -3,20 +3,6 @@
|
||||
/*
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2008 Robin Stuart <robin@zint.org.uk>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#define NUMERIC 110
|
||||
@ -27,7 +13,7 @@
|
||||
#define ALPHA_OR_ISO 121
|
||||
|
||||
/* CC-A component coefficients from ISO/IEC 24728:2006 Annex F */
|
||||
static int ccaCoeffs[30] = {
|
||||
static const int ccaCoeffs[30] = {
|
||||
/* k = 4 */
|
||||
522, 568, 723, 809,
|
||||
|
||||
@ -45,14 +31,14 @@ static int ccaCoeffs[30] = {
|
||||
};
|
||||
|
||||
/* rows, error codewords, k-offset of valid CC-A sizes from ISO/IEC 24723:2006 Table 9 */
|
||||
static int ccaVariants[51] = {
|
||||
static const int ccaVariants[51] = {
|
||||
5, 6, 7, 8, 9, 10, 12, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7,
|
||||
4, 4, 5, 5, 6, 6, 7, 4, 5, 6, 7, 7, 4, 5, 6, 7, 8,
|
||||
0, 0, 4, 4, 9, 9, 15, 0, 4, 9, 15, 15, 0, 4, 9, 15, 22
|
||||
};
|
||||
|
||||
/* following is Left RAP, Centre RAP, Right RAP and Start Cluster from ISO/IEC 24723:2006 tables 10 and 11 */
|
||||
static int aRAPTable[68] = {
|
||||
static const int aRAPTable[68] = {
|
||||
39, 1, 32, 8, 14, 43, 20, 11, 1, 5, 15, 21, 40, 43, 46, 34, 29,
|
||||
0, 0, 0, 0, 0, 0, 0, 43, 33, 37, 47, 1, 20, 23, 26, 14, 9,
|
||||
19, 33, 12, 40, 46, 23, 52, 23, 13, 17, 27, 33, 52, 3, 6, 46, 41,
|
||||
|
@ -775,7 +775,7 @@ void add_tail(unsigned char target[], int tp, int tail_length, int last_mode)
|
||||
|
||||
int data_matrix_200(struct zint_symbol *symbol, unsigned char source[], int length)
|
||||
{
|
||||
int inputlen, i, skew = 0;
|
||||
int i, skew = 0;
|
||||
unsigned char binary[2200];
|
||||
int binlen;
|
||||
int symbolsize, optionsize, calcsize;
|
||||
@ -783,7 +783,6 @@ int data_matrix_200(struct zint_symbol *symbol, unsigned char source[], int leng
|
||||
int H, W, FH, FW, datablock, bytes, rsblock;
|
||||
int last_mode;
|
||||
unsigned char *grid = 0;
|
||||
inputlen = length;
|
||||
|
||||
binlen = dm200encode(symbol, source, binary, &last_mode, length);
|
||||
|
||||
|
@ -732,13 +732,12 @@ int gm_encode(int gbdata[], int length, char binary[], int reader)
|
||||
|
||||
void gm_add_ecc(char binary[], int data_posn, int layers, int ecc_level, int word[])
|
||||
{
|
||||
int total_cw, data_cw, i, j, wp;
|
||||
int data_cw, i, j, wp;
|
||||
int n1, b1, n2, b2, e1, b3, e2;
|
||||
int block_size, data_size, ecc_size, toggle;
|
||||
int block_size, data_size, ecc_size;
|
||||
int data[1320], block[130];
|
||||
unsigned char data_block[115], ecc_block[70];
|
||||
|
||||
total_cw = gm_total_cw[(layers - 1)];
|
||||
data_cw = gm_data_codewords[((layers - 1) * 5) + (ecc_level - 1)];
|
||||
|
||||
for(i = 0; i < 1320; i++) {
|
||||
@ -761,10 +760,8 @@ void gm_add_ecc(char binary[], int data_posn, int layers, int ecc_level, int wor
|
||||
for(i = (data_posn + 1); i < data_cw; i++) {
|
||||
if(i & 1) {
|
||||
data[i] = 0x7e;
|
||||
toggle = 1;
|
||||
} else {
|
||||
data[i] = 0x00;
|
||||
toggle = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#define EUROPIUM "0123456789ABCDEFGHIJKLMOPRSTUVWXYZabcdefghijklmnopqrstuvwxyz "
|
||||
|
||||
static char shift_set[] = {
|
||||
static const char shift_set[] = {
|
||||
/* From Table 7 - Encoding of control characters */
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* NULL -> SI */
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* DLE -> US */
|
||||
@ -36,11 +36,11 @@ static char shift_set[] = {
|
||||
';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '_', '`', '{', '|', '}', '~'
|
||||
};
|
||||
|
||||
static int gm_recommend_cw[] = { 9, 30, 59, 114, 170, 237, 315, 405, 506, 618, 741, 875, 1021 };
|
||||
static int gm_max_cw[] = { 11, 40, 79, 146, 218, 305, 405, 521, 650, 794, 953, 1125, 1313 };
|
||||
static int gm_total_cw[] = { 18, 50, 98, 162, 242, 338, 450, 578, 722, 882, 1058, 1250, 1458 };
|
||||
static const int gm_recommend_cw[] = { 9, 30, 59, 114, 170, 237, 315, 405, 506, 618, 741, 875, 1021 };
|
||||
static const int gm_max_cw[] = { 11, 40, 79, 146, 218, 305, 405, 521, 650, 794, 953, 1125, 1313 };
|
||||
//static const int gm_total_cw[] = { 18, 50, 98, 162, 242, 338, 450, 578, 722, 882, 1058, 1250, 1458 };
|
||||
|
||||
static int gm_data_codewords[] = {
|
||||
static const int gm_data_codewords[] = {
|
||||
0, 15, 13, 11, 9,
|
||||
45, 40, 35, 30, 25,
|
||||
89, 79, 69, 59, 49,
|
||||
@ -56,11 +56,11 @@ static int gm_data_codewords[] = {
|
||||
1313, 1167, 1021, 875, 729
|
||||
};
|
||||
|
||||
static int gm_n1[] = { 18, 50, 98, 81, 121, 113, 113, 116, 121, 126, 118, 125, 122 };
|
||||
static int gm_b1[] = { 1, 1, 1, 2, 2, 2, 2, 3, 2, 7, 5, 10, 6 };
|
||||
static int gm_b2[] = { 0, 0, 0, 0, 0, 1, 2, 2, 4, 0, 4, 0, 6 };
|
||||
static const int gm_n1[] = { 18, 50, 98, 81, 121, 113, 113, 116, 121, 126, 118, 125, 122 };
|
||||
static const int gm_b1[] = { 1, 1, 1, 2, 2, 2, 2, 3, 2, 7, 5, 10, 6 };
|
||||
static const int gm_b2[] = { 0, 0, 0, 0, 0, 1, 2, 2, 4, 0, 4, 0, 6 };
|
||||
|
||||
static int gm_ebeb[] = {
|
||||
static const int gm_ebeb[] = {
|
||||
/* E1 B3 E2 B4 */
|
||||
0, 0, 0, 0, // version 1
|
||||
3, 1, 0, 0,
|
||||
@ -129,7 +129,7 @@ static int gm_ebeb[] = {
|
||||
61, 9, 60, 3
|
||||
};
|
||||
|
||||
static int gm_macro_matrix[] = {
|
||||
static const int gm_macro_matrix[] = {
|
||||
728,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,
|
||||
727,624,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,651,
|
||||
726,623,528,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,553,652,
|
||||
|
@ -80,8 +80,10 @@ void ZBarcode_Clear(struct zint_symbol *symbol)
|
||||
symbol->text[0] = '\0';
|
||||
symbol->errtxt[0] = '\0';
|
||||
if (symbol->bitmap != NULL)
|
||||
{
|
||||
free(symbol->bitmap);
|
||||
symbol->bitmap = NULL;
|
||||
}
|
||||
symbol->bitmap_width = 0;
|
||||
symbol->bitmap_height = 0;
|
||||
}
|
||||
@ -225,7 +227,11 @@ int dump_plot(struct zint_symbol *symbol)
|
||||
}
|
||||
fputs("]\n", f);
|
||||
|
||||
if(symbol->output_options & BARCODE_STDOUT) {
|
||||
fflush(f);
|
||||
} else {
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -836,6 +842,7 @@ int ZBarcode_Encode_File(struct zint_symbol *symbol, char *filename)
|
||||
buffer = (unsigned char *)malloc(fileLen * sizeof(unsigned char));
|
||||
if(!buffer) {
|
||||
strcpy(symbol->errtxt, "Internal memory error");
|
||||
if (strcmp(filename, "-"))
|
||||
fclose(file);
|
||||
return ERROR_MEMORY;
|
||||
}
|
||||
|
@ -3,20 +3,6 @@
|
||||
/*
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2008 Robin Stuart <robin@zint.org.uk>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@ -29,7 +15,7 @@ extern int c39(struct zint_symbol *symbol, unsigned char source[], int length);
|
||||
|
||||
#define CALCIUM "0123456789-$:/.+ABCD"
|
||||
|
||||
static char *CodaTable[20] = {"11111221", "11112211", "11121121", "22111111", "11211211", "21111211",
|
||||
static const char *CodaTable[20] = {"11111221", "11112211", "11121121", "22111111", "11211211", "21111211",
|
||||
"12111121", "12112111", "12211111", "21121111", "11122111", "11221111", "21112121", "21211121",
|
||||
"21212111", "11212121", "11221211", "12121121", "11121221", "11122211"};
|
||||
|
||||
|
@ -4,20 +4,6 @@
|
||||
Copyright (C) 2008 Robin Stuart <robin@zint.org.uk>
|
||||
Portions Copyright (C) 2004 Grandzebu
|
||||
Bug Fixes thanks to KL Chin <klchin@users.sourceforge.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
/* This code is adapted from "Code barre PDF 417 / PDF 417 barcode" v2.5.0
|
||||
@ -53,19 +39,19 @@
|
||||
|
||||
/* text mode processing tables */
|
||||
|
||||
static int asciix[95] = { 7, 8, 8, 4, 12, 4, 4, 8, 8, 8, 12, 4, 12, 12, 12, 12, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
static const int asciix[95] = { 7, 8, 8, 4, 12, 4, 4, 8, 8, 8, 12, 4, 12, 12, 12, 12, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 12, 8, 8, 4, 8, 8, 8, 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, 8, 8, 8, 4, 8, 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 8, 8, 8, 8 };
|
||||
|
||||
static int asciiy[95] = { 26, 10, 20, 15, 18, 21, 10, 28, 23, 24, 22, 20, 13, 16, 17, 19, 0, 1, 2, 3,
|
||||
static const int asciiy[95] = { 26, 10, 20, 15, 18, 21, 10, 28, 23, 24, 22, 20, 13, 16, 17, 19, 0, 1, 2, 3,
|
||||
4, 5, 6, 7, 8, 9, 14, 0, 1, 23, 2, 25, 3, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||||
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 4, 5, 6, 24, 7, 8, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
|
||||
11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 21, 27, 9 };
|
||||
|
||||
/* Automatic sizing table */
|
||||
|
||||
static int MicroAutosize[56] =
|
||||
static const int MicroAutosize[56] =
|
||||
{ 4, 6, 7, 8, 10, 12, 13, 14, 16, 18, 19, 20, 24, 29, 30, 33, 34, 37, 39, 46, 54, 58, 70, 72, 82, 90, 108, 126,
|
||||
1, 14, 2, 7, 3, 25, 8, 16, 5, 17, 9, 6, 10, 11, 28, 12, 19, 13, 29, 20, 30, 21, 22, 31, 23, 32, 33, 34
|
||||
};
|
||||
|
@ -4,20 +4,6 @@
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2008 Robin Stuart <robin@zint.org.uk>
|
||||
Portions Copyright (C) 2004 Grandzebu
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
/* this file contains the character table, the pre-calculated coefficients and the
|
||||
@ -32,7 +18,7 @@
|
||||
#define BRSET "ABCDEFabcdefghijklmnopqrstuvwxyz*+-"
|
||||
|
||||
/* PDF417 error correction coefficients from Grand Zebu */
|
||||
static int coefrs[1022] = {
|
||||
static const int coefrs[1022] = {
|
||||
/* k = 2 */
|
||||
27, 917,
|
||||
|
||||
@ -118,7 +104,7 @@ static int coefrs[1022] = {
|
||||
63, 310, 863, 251, 366, 304, 282, 738, 675, 410, 389, 244, 31, 121, 303, 263 };
|
||||
|
||||
|
||||
static char *codagemc[2787] = { "urA", "xfs", "ypy", "unk", "xdw", "yoz", "pDA", "uls", "pBk", "eBA",
|
||||
static const char *codagemc[2787] = { "urA", "xfs", "ypy", "unk", "xdw", "yoz", "pDA", "uls", "pBk", "eBA",
|
||||
"pAs", "eAk", "prA", "uvs", "xhy", "pnk", "utw", "xgz", "fDA", "pls", "fBk", "frA", "pvs",
|
||||
"uxy", "fnk", "ptw", "uwz", "fls", "psy", "fvs", "pxy", "ftw", "pwz", "fxy", "yrx", "ufk",
|
||||
"xFw", "ymz", "onA", "uds", "xEy", "olk", "ucw", "dBA", "oks", "uci", "dAk", "okg", "dAc",
|
||||
@ -335,13 +321,13 @@ static char *codagemc[2787] = { "urA", "xfs", "ypy", "unk", "xdw", "yoz", "pDA",
|
||||
"Ayv", "kze", "kzd", "Aye", "Byu", "Ayd", "Byt", "szp" };
|
||||
|
||||
/* converts values into bar patterns - replacing Grand Zebu's true type font */
|
||||
static char *PDFttf[35] = { "00000", "00001", "00010", "00011", "00100", "00101", "00110", "00111",
|
||||
static const char *PDFttf[35] = { "00000", "00001", "00010", "00011", "00100", "00101", "00110", "00111",
|
||||
"01000", "01001", "01010", "01011", "01100", "01101", "01110", "01111", "10000", "10001",
|
||||
"10010", "10011", "10100", "10101", "10110", "10111", "11000", "11001", "11010",
|
||||
"11011", "11100", "11101", "11110", "11111", "01", "1111111101010100", "11111101000101001"};
|
||||
|
||||
/* MicroPDF417 coefficients from ISO/IEC 24728:2006 Annex F */
|
||||
static int Microcoeffs[344] = {
|
||||
static const int Microcoeffs[344] = {
|
||||
/* k = 7 */
|
||||
76, 925, 537, 597, 784, 691, 437,
|
||||
|
||||
@ -405,7 +391,7 @@ static int Microcoeffs[344] = {
|
||||
718, 435 };
|
||||
|
||||
/* rows, columns, error codewords, k-offset of valid MicroPDF417 sizes from ISO/IEC 24728:2006 */
|
||||
static int MicroVariants[170] =
|
||||
static const int MicroVariants[170] =
|
||||
{ 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
11, 14, 17, 20, 24, 28, 8, 11, 14, 17, 20, 23, 26, 6, 8, 10, 12, 15, 20, 26, 32, 38, 44, 4, 6, 8, 10, 12, 15, 20, 26, 32, 38, 44,
|
||||
7, 7, 7, 8, 8, 8, 8, 9, 9, 10, 11, 13, 15, 12, 14, 16, 18, 21, 26, 32, 38, 44, 50, 8, 12, 14, 16, 18, 21, 26, 32, 38, 44, 50,
|
||||
@ -413,14 +399,14 @@ static int MicroVariants[170] =
|
||||
/* rows, columns, error codewords, k-offset */
|
||||
|
||||
/* following is Left RAP, Centre RAP, Right RAP and Start Cluster from ISO/IEC 24728:2006 tables 10, 11 and 12 */
|
||||
static int RAPTable[136] =
|
||||
static const int RAPTable[136] =
|
||||
{ 1, 8, 36, 19, 9, 25, 1, 1, 8, 36, 19, 9, 27, 1, 7, 15, 25, 37, 1, 1, 21, 15, 1, 47, 1, 7, 15, 25, 37, 1, 1, 21, 15, 1,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7, 15, 25, 37, 17, 9, 29, 31, 25, 19, 1, 7, 15, 25, 37, 17, 9, 29, 31, 25,
|
||||
9, 8, 36, 19, 17, 33, 1, 9, 8, 36, 19, 17, 35, 1, 7, 15, 25, 37, 33, 17, 37, 47, 49, 43, 1, 7, 15, 25, 37, 33, 17, 37, 47, 49,
|
||||
0, 3, 6, 0, 6, 0, 0, 0, 3, 6, 0, 6, 6, 0, 0, 6, 0, 0, 0, 0, 6, 6, 0, 3, 0, 0, 6, 0, 0, 0, 0, 6, 6, 0 };
|
||||
|
||||
/* Left and Right Row Address Pattern from Table 2 */
|
||||
static char *RAPLR[53] = {"", "221311", "311311", "312211", "222211", "213211", "214111", "223111",
|
||||
static const char *RAPLR[53] = {"", "221311", "311311", "312211", "222211", "213211", "214111", "223111",
|
||||
"313111", "322111", "412111", "421111", "331111", "241111", "232111", "231211", "321211",
|
||||
"411211", "411121", "411112", "321112", "312112", "311212", "311221", "311131", "311122",
|
||||
"311113", "221113", "221122", "221131", "221221", "222121", "312121", "321121", "231121",
|
||||
@ -428,7 +414,7 @@ static char *RAPLR[53] = {"", "221311", "311311", "312211", "222211", "213211",
|
||||
"211123", "211132", "211141", "211231", "211222", "211312", "211321", "211411", "212311" };
|
||||
|
||||
/* Centre Row Address Pattern from Table 2 */
|
||||
static char *RAPC[53] = {"", "112231", "121231", "122131", "131131", "131221", "132121", "141121",
|
||||
static const char *RAPC[53] = {"", "112231", "121231", "122131", "131131", "131221", "132121", "141121",
|
||||
"141211", "142111", "133111", "132211", "131311", "122311", "123211", "124111", "115111",
|
||||
"114211", "114121", "123121", "123112", "122212", "122221", "121321", "121411", "112411",
|
||||
"113311", "113221", "113212", "113122", "122122", "131122", "131113", "122113", "113113",
|
||||
|
@ -26,11 +26,11 @@
|
||||
|
||||
|
||||
#define SSET "0123456789ABCDEF"
|
||||
static char *PlessTable[16] = {"13131313", "31131313", "13311313", "31311313", "13133113", "31133113",
|
||||
static const char *PlessTable[16] = {"13131313", "31131313", "13311313", "31311313", "13133113", "31133113",
|
||||
"13313113", "31313113", "13131331", "31131331", "13311331", "31311331", "13133131",
|
||||
"31133131", "13313131", "31313131"};
|
||||
|
||||
static char *MSITable[10] = {"12121212", "12121221", "12122112", "12122121", "12211212", "12211221",
|
||||
static const char *MSITable[10] = {"12121212", "12121221", "12122112", "12122121", "12211212", "12211221",
|
||||
"12212112", "12212121", "21121212", "21121221"};
|
||||
|
||||
|
||||
|
@ -82,7 +82,6 @@ int png_pixel_plot(struct zint_symbol *symbol, int image_height, int image_width
|
||||
png_structp png_ptr;
|
||||
png_infop info_ptr;
|
||||
graphic = &wpng_info;
|
||||
unsigned long rowbytes;
|
||||
unsigned char *image_data;
|
||||
int i, row, column, errno;
|
||||
int fgred, fggrn, fgblu, bgred, bggrn, bgblu;
|
||||
@ -171,7 +170,7 @@ int png_pixel_plot(struct zint_symbol *symbol, int image_height, int image_width
|
||||
png_init_io(png_ptr, graphic->outfile);
|
||||
|
||||
/* set compression */
|
||||
png_set_compression_level(png_ptr, Z_BEST_COMPRESSION);
|
||||
png_set_compression_level(png_ptr,9);
|
||||
|
||||
/* set Header block */
|
||||
png_set_IHDR(png_ptr, info_ptr, graphic->width, graphic->height,
|
||||
@ -185,9 +184,6 @@ int png_pixel_plot(struct zint_symbol *symbol, int image_height, int image_width
|
||||
into bytes (one, two or four pixels per byte) */
|
||||
png_set_packing(png_ptr);
|
||||
|
||||
/* set rowbytes - depends on picture depth */
|
||||
rowbytes = wpng_info.width * 3;
|
||||
|
||||
/* Pixel Plotting */
|
||||
|
||||
switch(rotate_angle) {
|
||||
@ -304,7 +300,6 @@ int png_pixel_plot(struct zint_symbol *symbol, int image_height, int image_width
|
||||
|
||||
int bmp_pixel_plot(struct zint_symbol *symbol, int image_height, int image_width, char *pixelbuf, int rotate_angle)
|
||||
{
|
||||
unsigned long rowbytes;
|
||||
int i, row, column, errno;
|
||||
int fgred, fggrn, fgblu, bgred, bggrn, bgblu;
|
||||
|
||||
@ -357,9 +352,6 @@ int bmp_pixel_plot(struct zint_symbol *symbol, int image_height, int image_width
|
||||
bggrn = (16 * ctoi(symbol->bgcolour[2])) + ctoi(symbol->bgcolour[3]);
|
||||
bgblu = (16 * ctoi(symbol->bgcolour[4])) + ctoi(symbol->bgcolour[5]);
|
||||
|
||||
/* set rowbytes - depends on picture depth */
|
||||
rowbytes = symbol->bitmap_width * 3;
|
||||
|
||||
/* Pixel Plotting */
|
||||
i = 0;
|
||||
switch(rotate_angle) {
|
||||
|
18
backend/ps.c
18
backend/ps.c
@ -3,20 +3,6 @@
|
||||
/*
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2009 Robin Stuart <robin@zint.org.uk>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <locale.h>
|
||||
@ -751,7 +737,11 @@ int ps_plot(struct zint_symbol *symbol)
|
||||
}
|
||||
fprintf(feps, "\nshowpage\n");
|
||||
|
||||
if(symbol->output_options & BARCODE_STDOUT) {
|
||||
fflush(feps);
|
||||
} else {
|
||||
fclose(feps);
|
||||
}
|
||||
|
||||
if (locale)
|
||||
setlocale(LC_ALL, locale);
|
||||
|
@ -3,20 +3,6 @@
|
||||
/*
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2009 Robin Stuart <robin@zint.org.uk>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <locale.h>
|
||||
@ -32,8 +18,6 @@ int svg_plot(struct zint_symbol *symbol)
|
||||
int i, block_width, latch, r, this_row;
|
||||
float textpos, large_bar_height, preset_height, row_height, row_posn = 0.0;
|
||||
FILE *fsvg;
|
||||
int fgred, fggrn, fgblu, bgred, bggrn, bgblu;
|
||||
float red_ink, green_ink, blue_ink, red_paper, green_paper, blue_paper;
|
||||
int error_number = 0;
|
||||
int textoffset, xoffset, yoffset, textdone, main_width;
|
||||
char textpart[10], addon[6];
|
||||
@ -85,19 +69,6 @@ int svg_plot(struct zint_symbol *symbol)
|
||||
}
|
||||
locale = setlocale(LC_ALL, "C");
|
||||
|
||||
fgred = (16 * ctoi(symbol->fgcolour[0])) + ctoi(symbol->fgcolour[1]);
|
||||
fggrn = (16 * ctoi(symbol->fgcolour[2])) + ctoi(symbol->fgcolour[3]);
|
||||
fgblu = (16 * ctoi(symbol->fgcolour[4])) + ctoi(symbol->fgcolour[5]);
|
||||
bgred = (16 * ctoi(symbol->bgcolour[0])) + ctoi(symbol->bgcolour[1]);
|
||||
bggrn = (16 * ctoi(symbol->bgcolour[2])) + ctoi(symbol->bgcolour[3]);
|
||||
bgblu = (16 * ctoi(symbol->bgcolour[4])) + ctoi(symbol->bgcolour[5]);
|
||||
red_ink = fgred / 256.0;
|
||||
green_ink = fggrn / 256.0;
|
||||
blue_ink = fgblu / 256.0;
|
||||
red_paper = bgred / 256.0;
|
||||
green_paper = bggrn / 256.0;
|
||||
blue_paper = bgblu / 256.0;
|
||||
|
||||
if (symbol->height == 0) {
|
||||
symbol->height = 50;
|
||||
}
|
||||
@ -604,7 +575,11 @@ int svg_plot(struct zint_symbol *symbol)
|
||||
fprintf(fsvg, " </g>\n");
|
||||
fprintf(fsvg, "</svg>\n");
|
||||
|
||||
if(symbol->output_options & BARCODE_STDOUT) {
|
||||
fflush(fsvg);
|
||||
} else {
|
||||
fclose(fsvg);
|
||||
}
|
||||
|
||||
if (locale)
|
||||
setlocale(LC_ALL, locale);
|
||||
|
@ -29,18 +29,18 @@
|
||||
|
||||
/* UPC and EAN tables checked against EN 797:1996 */
|
||||
|
||||
static char *UPCParity0[10] = {"BBBAAA", "BBABAA", "BBAABA", "BBAAAB", "BABBAA", "BAABBA", "BAAABB",
|
||||
static const char *UPCParity0[10] = {"BBBAAA", "BBABAA", "BBAABA", "BBAAAB", "BABBAA", "BAABBA", "BAAABB",
|
||||
"BABABA", "BABAAB", "BAABAB"}; /* Number set for UPC-E symbol (EN Table 4) */
|
||||
static char *UPCParity1[10] = {"AAABBB", "AABABB", "AABBAB", "AABBBA", "ABAABB", "ABBAAB", "ABBBAA",
|
||||
static const char *UPCParity1[10] = {"AAABBB", "AABABB", "AABBAB", "AABBBA", "ABAABB", "ABBAAB", "ABBBAA",
|
||||
"ABABAB", "ABABBA", "ABBABA"}; /* Not covered by BS EN 797:1995 */
|
||||
static char *EAN2Parity[4] = {"AA", "AB", "BA", "BB"}; /* Number sets for 2-digit add-on (EN Table 6) */
|
||||
static char *EAN5Parity[10] = {"BBAAA", "BABAA", "BAABA", "BAAAB", "ABBAA", "AABBA", "AAABB", "ABABA",
|
||||
static const char *EAN2Parity[4] = {"AA", "AB", "BA", "BB"}; /* Number sets for 2-digit add-on (EN Table 6) */
|
||||
static const char *EAN5Parity[10] = {"BBAAA", "BABAA", "BAABA", "BAAAB", "ABBAA", "AABBA", "AAABB", "ABABA",
|
||||
"ABAAB", "AABAB"}; /* Number set for 5-digit add-on (EN Table 7) */
|
||||
static char *EAN13Parity[10] = {"AAAAA", "ABABB", "ABBAB", "ABBBA", "BAABB", "BBAAB", "BBBAA", "BABAB",
|
||||
static const char *EAN13Parity[10] = {"AAAAA", "ABABB", "ABBAB", "ABBBA", "BAABB", "BBAAB", "BBBAA", "BABAB",
|
||||
"BABBA", "BBABA"}; /* Left hand of the EAN-13 symbol (EN Table 3) */
|
||||
static char *EANsetA[10] = {"3211", "2221", "2122", "1411", "1132", "1231", "1114", "1312", "1213",
|
||||
static const char *EANsetA[10] = {"3211", "2221", "2122", "1411", "1132", "1231", "1114", "1312", "1213",
|
||||
"3112"}; /* Representation set A and C (EN Table 1) */
|
||||
static char *EANsetB[10] = {"1123", "1222", "2212", "1141", "2311", "1321", "4111", "2131", "3121",
|
||||
static const char *EANsetB[10] = {"1123", "1222", "2212", "1141", "2311", "1321", "4111", "2131", "3121",
|
||||
"2113"}; /* Representation set B (EN Table 1) */
|
||||
|
||||
char upc_check(char source[])
|
||||
|
Loading…
Reference in New Issue
Block a user