mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Replace local concat() and roundup() with C library defaults
Patch by Oxy (Michael) <virtual_worlds@gmx.de> Ref: https://sourceforge.net/p/zint/mailman/message/34896811/
This commit is contained in:
parent
0a034fd5ea
commit
f17f10fa7c
@ -84,7 +84,7 @@ int matrix_two_of_five(struct zint_symbol *symbol, unsigned char source[], int l
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Stop character */
|
/* Stop character */
|
||||||
concat(dest, "41111");
|
strcat(dest, "41111");
|
||||||
|
|
||||||
expand(symbol, dest);
|
expand(symbol, dest);
|
||||||
ustrcpy(symbol->text, source);
|
ustrcpy(symbol->text, source);
|
||||||
@ -117,7 +117,7 @@ int industrial_two_of_five(struct zint_symbol *symbol, unsigned char source[], i
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Stop character */
|
/* Stop character */
|
||||||
concat(dest, "31113");
|
strcat(dest, "31113");
|
||||||
|
|
||||||
expand(symbol, dest);
|
expand(symbol, dest);
|
||||||
ustrcpy(symbol->text, source);
|
ustrcpy(symbol->text, source);
|
||||||
@ -149,7 +149,7 @@ int iata_two_of_five(struct zint_symbol *symbol, unsigned char source[], int len
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* stop */
|
/* stop */
|
||||||
concat(dest, "311");
|
strcat(dest, "311");
|
||||||
|
|
||||||
expand(symbol, dest);
|
expand(symbol, dest);
|
||||||
ustrcpy(symbol->text, source);
|
ustrcpy(symbol->text, source);
|
||||||
@ -182,7 +182,7 @@ int logic_two_of_five(struct zint_symbol *symbol, unsigned char source[], int le
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Stop character */
|
/* Stop character */
|
||||||
concat(dest, "311");
|
strcat(dest, "311");
|
||||||
|
|
||||||
expand(symbol, dest);
|
expand(symbol, dest);
|
||||||
ustrcpy(symbol->text, source);
|
ustrcpy(symbol->text, source);
|
||||||
@ -219,7 +219,7 @@ int interleaved_two_of_five(struct zint_symbol *symbol, unsigned char source[],
|
|||||||
ustrcpy(temp, (unsigned char *) "0");
|
ustrcpy(temp, (unsigned char *) "0");
|
||||||
length++;
|
length++;
|
||||||
}
|
}
|
||||||
uconcat(temp, source);
|
strcat((char*)temp, (char*)source);
|
||||||
|
|
||||||
/* start character */
|
/* start character */
|
||||||
strcpy(dest, "1111");
|
strcpy(dest, "1111");
|
||||||
@ -240,11 +240,11 @@ int interleaved_two_of_five(struct zint_symbol *symbol, unsigned char source[],
|
|||||||
k++;
|
k++;
|
||||||
}
|
}
|
||||||
mixed[k] = '\0';
|
mixed[k] = '\0';
|
||||||
concat(dest, mixed);
|
strcat(dest, mixed);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Stop character */
|
/* Stop character */
|
||||||
concat(dest, "311");
|
strcat(dest, "311");
|
||||||
|
|
||||||
expand(symbol, dest);
|
expand(symbol, dest);
|
||||||
ustrcpy(symbol->text, temp);
|
ustrcpy(symbol->text, temp);
|
||||||
|
@ -88,7 +88,7 @@ void rs_error(char data_pattern[]) {
|
|||||||
rs_encode(triple_writer, (unsigned char*) inv_triple, result);
|
rs_encode(triple_writer, (unsigned char*) inv_triple, result);
|
||||||
|
|
||||||
for (reader = 4; reader > 0; reader--) {
|
for (reader = 4; reader > 0; reader--) {
|
||||||
concat(data_pattern, AusBarTable[(int) result[reader - 1]]);
|
strcat(data_pattern, AusBarTable[(int) result[reader - 1]]);
|
||||||
}
|
}
|
||||||
rs_free();
|
rs_free();
|
||||||
}
|
}
|
||||||
@ -164,7 +164,7 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[], int lengt
|
|||||||
localstr[8] = '\0';
|
localstr[8] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
concat(localstr, (char*) source);
|
strcat(localstr, (char*) source);
|
||||||
h = strlen(localstr);
|
h = strlen(localstr);
|
||||||
error_number = is_sane(GDSET, (unsigned char *) localstr, h);
|
error_number = is_sane(GDSET, (unsigned char *) localstr, h);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
@ -215,7 +215,7 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[], int lengt
|
|||||||
case 22:
|
case 22:
|
||||||
case 37:
|
case 37:
|
||||||
case 52:
|
case 52:
|
||||||
concat(data_pattern, "3");
|
strcat(data_pattern, "3");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -225,7 +225,7 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[], int lengt
|
|||||||
rs_error(data_pattern);
|
rs_error(data_pattern);
|
||||||
|
|
||||||
/* Stop character */
|
/* Stop character */
|
||||||
concat(data_pattern, "13");
|
strcat(data_pattern, "13");
|
||||||
|
|
||||||
/* Turn the symbol into a bar pattern ready for plotting */
|
/* Turn the symbol into a bar pattern ready for plotting */
|
||||||
writer = 0;
|
writer = 0;
|
||||||
|
172
backend/aztec.c
172
backend/aztec.c
@ -311,21 +311,21 @@ int aztec_text_process(unsigned char source[], const unsigned int src_len, char
|
|||||||
case (64 + UPPER): /* To UPPER */
|
case (64 + UPPER): /* To UPPER */
|
||||||
switch (curtable) {
|
switch (curtable) {
|
||||||
case LOWER: /* US */
|
case LOWER: /* US */
|
||||||
concat(binary_string, hexbit[28]);
|
strcat(binary_string, hexbit[28]);
|
||||||
if (debug) printf("US ");
|
if (debug) printf("US ");
|
||||||
break;
|
break;
|
||||||
case MIXED: /* UL */
|
case MIXED: /* UL */
|
||||||
concat(binary_string, hexbit[29]);
|
strcat(binary_string, hexbit[29]);
|
||||||
if (debug) printf("UL ");
|
if (debug) printf("UL ");
|
||||||
newtable = UPPER;
|
newtable = UPPER;
|
||||||
break;
|
break;
|
||||||
case PUNC: /* UL */
|
case PUNC: /* UL */
|
||||||
concat(binary_string, hexbit[31]);
|
strcat(binary_string, hexbit[31]);
|
||||||
if (debug) printf("UL ");
|
if (debug) printf("UL ");
|
||||||
newtable = UPPER;
|
newtable = UPPER;
|
||||||
break;
|
break;
|
||||||
case DIGIT: /* US */
|
case DIGIT: /* US */
|
||||||
concat(binary_string, pentbit[15]);
|
strcat(binary_string, pentbit[15]);
|
||||||
if (debug) printf("US ");
|
if (debug) printf("US ");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -333,26 +333,26 @@ int aztec_text_process(unsigned char source[], const unsigned int src_len, char
|
|||||||
case (64 + LOWER): /* To LOWER */
|
case (64 + LOWER): /* To LOWER */
|
||||||
switch (curtable) {
|
switch (curtable) {
|
||||||
case UPPER: /* LL */
|
case UPPER: /* LL */
|
||||||
concat(binary_string, hexbit[28]);
|
strcat(binary_string, hexbit[28]);
|
||||||
if (debug) printf("LL ");
|
if (debug) printf("LL ");
|
||||||
newtable = LOWER;
|
newtable = LOWER;
|
||||||
break;
|
break;
|
||||||
case MIXED: /* LL */
|
case MIXED: /* LL */
|
||||||
concat(binary_string, hexbit[28]);
|
strcat(binary_string, hexbit[28]);
|
||||||
if (debug) printf("LL ");
|
if (debug) printf("LL ");
|
||||||
newtable = LOWER;
|
newtable = LOWER;
|
||||||
break;
|
break;
|
||||||
case PUNC: /* UL LL */
|
case PUNC: /* UL LL */
|
||||||
concat(binary_string, hexbit[31]);
|
strcat(binary_string, hexbit[31]);
|
||||||
if (debug) printf("UL ");
|
if (debug) printf("UL ");
|
||||||
concat(binary_string, hexbit[28]);
|
strcat(binary_string, hexbit[28]);
|
||||||
if (debug) printf("LL ");
|
if (debug) printf("LL ");
|
||||||
newtable = LOWER;
|
newtable = LOWER;
|
||||||
break;
|
break;
|
||||||
case DIGIT: /* UL LL */
|
case DIGIT: /* UL LL */
|
||||||
concat(binary_string, pentbit[14]);
|
strcat(binary_string, pentbit[14]);
|
||||||
if (debug) printf("UL ");
|
if (debug) printf("UL ");
|
||||||
concat(binary_string, hexbit[28]);
|
strcat(binary_string, hexbit[28]);
|
||||||
if (debug) printf("LL ");
|
if (debug) printf("LL ");
|
||||||
newtable = LOWER;
|
newtable = LOWER;
|
||||||
break;
|
break;
|
||||||
@ -361,26 +361,26 @@ int aztec_text_process(unsigned char source[], const unsigned int src_len, char
|
|||||||
case (64 + MIXED): /* To MIXED */
|
case (64 + MIXED): /* To MIXED */
|
||||||
switch (curtable) {
|
switch (curtable) {
|
||||||
case UPPER: /* ML */
|
case UPPER: /* ML */
|
||||||
concat(binary_string, hexbit[29]);
|
strcat(binary_string, hexbit[29]);
|
||||||
if (debug) printf("ML ");
|
if (debug) printf("ML ");
|
||||||
newtable = MIXED;
|
newtable = MIXED;
|
||||||
break;
|
break;
|
||||||
case LOWER: /* ML */
|
case LOWER: /* ML */
|
||||||
concat(binary_string, hexbit[29]);
|
strcat(binary_string, hexbit[29]);
|
||||||
if (debug) printf("ML ");
|
if (debug) printf("ML ");
|
||||||
newtable = MIXED;
|
newtable = MIXED;
|
||||||
break;
|
break;
|
||||||
case PUNC: /* UL ML */
|
case PUNC: /* UL ML */
|
||||||
concat(binary_string, hexbit[31]);
|
strcat(binary_string, hexbit[31]);
|
||||||
if (debug) printf("UL ");
|
if (debug) printf("UL ");
|
||||||
concat(binary_string, hexbit[29]);
|
strcat(binary_string, hexbit[29]);
|
||||||
if (debug) printf("ML ");
|
if (debug) printf("ML ");
|
||||||
newtable = MIXED;
|
newtable = MIXED;
|
||||||
break;
|
break;
|
||||||
case DIGIT: /* UL ML */
|
case DIGIT: /* UL ML */
|
||||||
concat(binary_string, pentbit[14]);
|
strcat(binary_string, pentbit[14]);
|
||||||
if (debug) printf("UL ");
|
if (debug) printf("UL ");
|
||||||
concat(binary_string, hexbit[29]);
|
strcat(binary_string, hexbit[29]);
|
||||||
if (debug) printf("ML ");
|
if (debug) printf("ML ");
|
||||||
newtable = MIXED;
|
newtable = MIXED;
|
||||||
break;
|
break;
|
||||||
@ -389,19 +389,19 @@ int aztec_text_process(unsigned char source[], const unsigned int src_len, char
|
|||||||
case (64 + PUNC): /* To PUNC */
|
case (64 + PUNC): /* To PUNC */
|
||||||
switch (curtable) {
|
switch (curtable) {
|
||||||
case UPPER: /* PS */
|
case UPPER: /* PS */
|
||||||
concat(binary_string, hexbit[0]);
|
strcat(binary_string, hexbit[0]);
|
||||||
if (debug) printf("PS ");
|
if (debug) printf("PS ");
|
||||||
break;
|
break;
|
||||||
case LOWER: /* PS */
|
case LOWER: /* PS */
|
||||||
concat(binary_string, hexbit[0]);
|
strcat(binary_string, hexbit[0]);
|
||||||
if (debug) printf("PS ");
|
if (debug) printf("PS ");
|
||||||
break;
|
break;
|
||||||
case MIXED: /* PS */
|
case MIXED: /* PS */
|
||||||
concat(binary_string, hexbit[0]);
|
strcat(binary_string, hexbit[0]);
|
||||||
if (debug) printf("PS ");
|
if (debug) printf("PS ");
|
||||||
break;
|
break;
|
||||||
case DIGIT: /* PS */
|
case DIGIT: /* PS */
|
||||||
concat(binary_string, pentbit[0]);
|
strcat(binary_string, pentbit[0]);
|
||||||
if (debug) printf("PS ");
|
if (debug) printf("PS ");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -409,26 +409,26 @@ int aztec_text_process(unsigned char source[], const unsigned int src_len, char
|
|||||||
case (64 + DIGIT): /* To DIGIT */
|
case (64 + DIGIT): /* To DIGIT */
|
||||||
switch (curtable) {
|
switch (curtable) {
|
||||||
case UPPER: /* DL */
|
case UPPER: /* DL */
|
||||||
concat(binary_string, hexbit[30]);
|
strcat(binary_string, hexbit[30]);
|
||||||
if (debug) printf("DL ");
|
if (debug) printf("DL ");
|
||||||
newtable = DIGIT;
|
newtable = DIGIT;
|
||||||
break;
|
break;
|
||||||
case LOWER: /* DL */
|
case LOWER: /* DL */
|
||||||
concat(binary_string, hexbit[30]);
|
strcat(binary_string, hexbit[30]);
|
||||||
if (debug) printf("DL ");
|
if (debug) printf("DL ");
|
||||||
newtable = DIGIT;
|
newtable = DIGIT;
|
||||||
break;
|
break;
|
||||||
case MIXED: /* UL DL */
|
case MIXED: /* UL DL */
|
||||||
concat(binary_string, hexbit[29]);
|
strcat(binary_string, hexbit[29]);
|
||||||
if (debug) printf("UL ");
|
if (debug) printf("UL ");
|
||||||
concat(binary_string, hexbit[30]);
|
strcat(binary_string, hexbit[30]);
|
||||||
if (debug) printf("DL ");
|
if (debug) printf("DL ");
|
||||||
newtable = DIGIT;
|
newtable = DIGIT;
|
||||||
break;
|
break;
|
||||||
case PUNC: /* UL DL */
|
case PUNC: /* UL DL */
|
||||||
concat(binary_string, hexbit[31]);
|
strcat(binary_string, hexbit[31]);
|
||||||
if (debug) printf("UL ");
|
if (debug) printf("UL ");
|
||||||
concat(binary_string, hexbit[30]);
|
strcat(binary_string, hexbit[30]);
|
||||||
if (debug) printf("DL ");
|
if (debug) printf("DL ");
|
||||||
newtable = DIGIT;
|
newtable = DIGIT;
|
||||||
break;
|
break;
|
||||||
@ -441,24 +441,24 @@ int aztec_text_process(unsigned char source[], const unsigned int src_len, char
|
|||||||
case UPPER: /* To UPPER */
|
case UPPER: /* To UPPER */
|
||||||
switch (curtable) {
|
switch (curtable) {
|
||||||
case LOWER: /* ML UL */
|
case LOWER: /* ML UL */
|
||||||
concat(binary_string, hexbit[29]);
|
strcat(binary_string, hexbit[29]);
|
||||||
if (debug) printf("ML ");
|
if (debug) printf("ML ");
|
||||||
concat(binary_string, hexbit[29]);
|
strcat(binary_string, hexbit[29]);
|
||||||
if (debug) printf("UL ");
|
if (debug) printf("UL ");
|
||||||
newtable = UPPER;
|
newtable = UPPER;
|
||||||
break;
|
break;
|
||||||
case MIXED: /* UL */
|
case MIXED: /* UL */
|
||||||
concat(binary_string, hexbit[29]);
|
strcat(binary_string, hexbit[29]);
|
||||||
if (debug) printf("UL ");
|
if (debug) printf("UL ");
|
||||||
newtable = UPPER;
|
newtable = UPPER;
|
||||||
break;
|
break;
|
||||||
case PUNC: /* UL */
|
case PUNC: /* UL */
|
||||||
concat(binary_string, hexbit[31]);
|
strcat(binary_string, hexbit[31]);
|
||||||
if (debug) printf("UL ");
|
if (debug) printf("UL ");
|
||||||
newtable = UPPER;
|
newtable = UPPER;
|
||||||
break;
|
break;
|
||||||
case DIGIT: /* UL */
|
case DIGIT: /* UL */
|
||||||
concat(binary_string, pentbit[14]);
|
strcat(binary_string, pentbit[14]);
|
||||||
if (debug) printf("UL ");
|
if (debug) printf("UL ");
|
||||||
newtable = UPPER;
|
newtable = UPPER;
|
||||||
break;
|
break;
|
||||||
@ -467,26 +467,26 @@ int aztec_text_process(unsigned char source[], const unsigned int src_len, char
|
|||||||
case LOWER: /* To LOWER */
|
case LOWER: /* To LOWER */
|
||||||
switch (curtable) {
|
switch (curtable) {
|
||||||
case UPPER: /* LL */
|
case UPPER: /* LL */
|
||||||
concat(binary_string, hexbit[28]);
|
strcat(binary_string, hexbit[28]);
|
||||||
if (debug) printf("LL ");
|
if (debug) printf("LL ");
|
||||||
newtable = LOWER;
|
newtable = LOWER;
|
||||||
break;
|
break;
|
||||||
case MIXED: /* LL */
|
case MIXED: /* LL */
|
||||||
concat(binary_string, hexbit[28]);
|
strcat(binary_string, hexbit[28]);
|
||||||
if (debug) printf("LL ");
|
if (debug) printf("LL ");
|
||||||
newtable = LOWER;
|
newtable = LOWER;
|
||||||
break;
|
break;
|
||||||
case PUNC: /* UL LL */
|
case PUNC: /* UL LL */
|
||||||
concat(binary_string, hexbit[31]);
|
strcat(binary_string, hexbit[31]);
|
||||||
if (debug) printf("UL ");
|
if (debug) printf("UL ");
|
||||||
concat(binary_string, hexbit[28]);
|
strcat(binary_string, hexbit[28]);
|
||||||
if (debug) printf("LL ");
|
if (debug) printf("LL ");
|
||||||
newtable = LOWER;
|
newtable = LOWER;
|
||||||
break;
|
break;
|
||||||
case DIGIT: /* UL LL */
|
case DIGIT: /* UL LL */
|
||||||
concat(binary_string, pentbit[14]);
|
strcat(binary_string, pentbit[14]);
|
||||||
if (debug) printf("UL ");
|
if (debug) printf("UL ");
|
||||||
concat(binary_string, hexbit[28]);
|
strcat(binary_string, hexbit[28]);
|
||||||
if (debug) printf("LL ");
|
if (debug) printf("LL ");
|
||||||
newtable = LOWER;
|
newtable = LOWER;
|
||||||
break;
|
break;
|
||||||
@ -495,26 +495,26 @@ int aztec_text_process(unsigned char source[], const unsigned int src_len, char
|
|||||||
case MIXED: /* To MIXED */
|
case MIXED: /* To MIXED */
|
||||||
switch (curtable) {
|
switch (curtable) {
|
||||||
case UPPER: /* ML */
|
case UPPER: /* ML */
|
||||||
concat(binary_string, hexbit[29]);
|
strcat(binary_string, hexbit[29]);
|
||||||
if (debug) printf("ML ");
|
if (debug) printf("ML ");
|
||||||
newtable = MIXED;
|
newtable = MIXED;
|
||||||
break;
|
break;
|
||||||
case LOWER: /* ML */
|
case LOWER: /* ML */
|
||||||
concat(binary_string, hexbit[29]);
|
strcat(binary_string, hexbit[29]);
|
||||||
if (debug) printf("ML ");
|
if (debug) printf("ML ");
|
||||||
newtable = MIXED;
|
newtable = MIXED;
|
||||||
break;
|
break;
|
||||||
case PUNC: /* UL ML */
|
case PUNC: /* UL ML */
|
||||||
concat(binary_string, hexbit[31]);
|
strcat(binary_string, hexbit[31]);
|
||||||
if (debug) printf("UL ");
|
if (debug) printf("UL ");
|
||||||
concat(binary_string, hexbit[29]);
|
strcat(binary_string, hexbit[29]);
|
||||||
if (debug) printf("ML ");
|
if (debug) printf("ML ");
|
||||||
newtable = MIXED;
|
newtable = MIXED;
|
||||||
break;
|
break;
|
||||||
case DIGIT: /* UL ML */
|
case DIGIT: /* UL ML */
|
||||||
concat(binary_string, pentbit[14]);
|
strcat(binary_string, pentbit[14]);
|
||||||
if (debug) printf("UL ");
|
if (debug) printf("UL ");
|
||||||
concat(binary_string, hexbit[29]);
|
strcat(binary_string, hexbit[29]);
|
||||||
if (debug) printf("ML ");
|
if (debug) printf("ML ");
|
||||||
newtable = MIXED;
|
newtable = MIXED;
|
||||||
break;
|
break;
|
||||||
@ -523,30 +523,30 @@ int aztec_text_process(unsigned char source[], const unsigned int src_len, char
|
|||||||
case PUNC: /* To PUNC */
|
case PUNC: /* To PUNC */
|
||||||
switch (curtable) {
|
switch (curtable) {
|
||||||
case UPPER: /* ML PL */
|
case UPPER: /* ML PL */
|
||||||
concat(binary_string, hexbit[29]);
|
strcat(binary_string, hexbit[29]);
|
||||||
if (debug) printf("ML ");
|
if (debug) printf("ML ");
|
||||||
concat(binary_string, hexbit[30]);
|
strcat(binary_string, hexbit[30]);
|
||||||
if (debug) printf("PL ");
|
if (debug) printf("PL ");
|
||||||
newtable = PUNC;
|
newtable = PUNC;
|
||||||
break;
|
break;
|
||||||
case LOWER: /* ML PL */
|
case LOWER: /* ML PL */
|
||||||
concat(binary_string, hexbit[29]);
|
strcat(binary_string, hexbit[29]);
|
||||||
if (debug) printf("ML ");
|
if (debug) printf("ML ");
|
||||||
concat(binary_string, hexbit[30]);
|
strcat(binary_string, hexbit[30]);
|
||||||
if (debug) printf("PL ");
|
if (debug) printf("PL ");
|
||||||
newtable = PUNC;
|
newtable = PUNC;
|
||||||
break;
|
break;
|
||||||
case MIXED: /* PL */
|
case MIXED: /* PL */
|
||||||
concat(binary_string, hexbit[30]);
|
strcat(binary_string, hexbit[30]);
|
||||||
if (debug) printf("PL ");
|
if (debug) printf("PL ");
|
||||||
newtable = PUNC;
|
newtable = PUNC;
|
||||||
break;
|
break;
|
||||||
case DIGIT: /* UL ML PL */
|
case DIGIT: /* UL ML PL */
|
||||||
concat(binary_string, pentbit[14]);
|
strcat(binary_string, pentbit[14]);
|
||||||
if (debug) printf("UL ");
|
if (debug) printf("UL ");
|
||||||
concat(binary_string, hexbit[29]);
|
strcat(binary_string, hexbit[29]);
|
||||||
if (debug) printf("ML ");
|
if (debug) printf("ML ");
|
||||||
concat(binary_string, hexbit[30]);
|
strcat(binary_string, hexbit[30]);
|
||||||
if (debug) printf("PL ");
|
if (debug) printf("PL ");
|
||||||
newtable = PUNC;
|
newtable = PUNC;
|
||||||
break;
|
break;
|
||||||
@ -555,26 +555,26 @@ int aztec_text_process(unsigned char source[], const unsigned int src_len, char
|
|||||||
case DIGIT: /* To DIGIT */
|
case DIGIT: /* To DIGIT */
|
||||||
switch (curtable) {
|
switch (curtable) {
|
||||||
case UPPER: /* DL */
|
case UPPER: /* DL */
|
||||||
concat(binary_string, hexbit[30]);
|
strcat(binary_string, hexbit[30]);
|
||||||
if (debug) printf("DL ");
|
if (debug) printf("DL ");
|
||||||
newtable = DIGIT;
|
newtable = DIGIT;
|
||||||
break;
|
break;
|
||||||
case LOWER: /* DL */
|
case LOWER: /* DL */
|
||||||
concat(binary_string, hexbit[30]);
|
strcat(binary_string, hexbit[30]);
|
||||||
if (debug) printf("DL ");
|
if (debug) printf("DL ");
|
||||||
newtable = DIGIT;
|
newtable = DIGIT;
|
||||||
break;
|
break;
|
||||||
case MIXED: /* UL DL */
|
case MIXED: /* UL DL */
|
||||||
concat(binary_string, hexbit[29]);
|
strcat(binary_string, hexbit[29]);
|
||||||
if (debug) printf("UL ");
|
if (debug) printf("UL ");
|
||||||
concat(binary_string, hexbit[30]);
|
strcat(binary_string, hexbit[30]);
|
||||||
if (debug) printf("DL ");
|
if (debug) printf("DL ");
|
||||||
newtable = DIGIT;
|
newtable = DIGIT;
|
||||||
break;
|
break;
|
||||||
case PUNC: /* UL DL */
|
case PUNC: /* UL DL */
|
||||||
concat(binary_string, hexbit[31]);
|
strcat(binary_string, hexbit[31]);
|
||||||
if (debug) printf("UL ");
|
if (debug) printf("UL ");
|
||||||
concat(binary_string, hexbit[30]);
|
strcat(binary_string, hexbit[30]);
|
||||||
if (debug) printf("DL ");
|
if (debug) printf("DL ");
|
||||||
newtable = DIGIT;
|
newtable = DIGIT;
|
||||||
break;
|
break;
|
||||||
@ -584,32 +584,32 @@ int aztec_text_process(unsigned char source[], const unsigned int src_len, char
|
|||||||
lasttable = curtable;
|
lasttable = curtable;
|
||||||
switch (curtable) {
|
switch (curtable) {
|
||||||
case UPPER: /* BS */
|
case UPPER: /* BS */
|
||||||
concat(binary_string, hexbit[31]);
|
strcat(binary_string, hexbit[31]);
|
||||||
if (debug) printf("BS ");
|
if (debug) printf("BS ");
|
||||||
newtable = BINARY;
|
newtable = BINARY;
|
||||||
break;
|
break;
|
||||||
case LOWER: /* BS */
|
case LOWER: /* BS */
|
||||||
concat(binary_string, hexbit[31]);
|
strcat(binary_string, hexbit[31]);
|
||||||
if (debug) printf("BS ");
|
if (debug) printf("BS ");
|
||||||
newtable = BINARY;
|
newtable = BINARY;
|
||||||
break;
|
break;
|
||||||
case MIXED: /* BS */
|
case MIXED: /* BS */
|
||||||
concat(binary_string, hexbit[31]);
|
strcat(binary_string, hexbit[31]);
|
||||||
if (debug) printf("BS ");
|
if (debug) printf("BS ");
|
||||||
newtable = BINARY;
|
newtable = BINARY;
|
||||||
break;
|
break;
|
||||||
case PUNC: /* UL BS */
|
case PUNC: /* UL BS */
|
||||||
concat(binary_string, hexbit[31]);
|
strcat(binary_string, hexbit[31]);
|
||||||
if (debug) printf("UL ");
|
if (debug) printf("UL ");
|
||||||
concat(binary_string, hexbit[31]);
|
strcat(binary_string, hexbit[31]);
|
||||||
if (debug) printf("BS ");
|
if (debug) printf("BS ");
|
||||||
lasttable = UPPER;
|
lasttable = UPPER;
|
||||||
newtable = BINARY;
|
newtable = BINARY;
|
||||||
break;
|
break;
|
||||||
case DIGIT: /* UL BS */
|
case DIGIT: /* UL BS */
|
||||||
concat(binary_string, pentbit[14]);
|
strcat(binary_string, pentbit[14]);
|
||||||
if (debug) printf("UL ");
|
if (debug) printf("UL ");
|
||||||
concat(binary_string, hexbit[31]);
|
strcat(binary_string, hexbit[31]);
|
||||||
if (debug) printf("BS ");
|
if (debug) printf("BS ");
|
||||||
lasttable = UPPER;
|
lasttable = UPPER;
|
||||||
newtable = BINARY;
|
newtable = BINARY;
|
||||||
@ -628,22 +628,22 @@ int aztec_text_process(unsigned char source[], const unsigned int src_len, char
|
|||||||
|
|
||||||
if (bytes > 31) {
|
if (bytes > 31) {
|
||||||
/* Put 00000 followed by 11-bit number of bytes less 31 */
|
/* Put 00000 followed by 11-bit number of bytes less 31 */
|
||||||
concat(binary_string, "00000");
|
strcat(binary_string, "00000");
|
||||||
|
|
||||||
for (p = 0; p < 11; p++) {
|
for (p = 0; p < 11; p++) {
|
||||||
if ((bytes - 31) & (0x400 >> p)) {
|
if ((bytes - 31) & (0x400 >> p)) {
|
||||||
concat(binary_string, "1");
|
strcat(binary_string, "1");
|
||||||
} else {
|
} else {
|
||||||
concat(binary_string, "0");
|
strcat(binary_string, "0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Put 5-bit number of bytes */
|
/* Put 5-bit number of bytes */
|
||||||
for (p = 0; p < 5; p++) {
|
for (p = 0; p < 5; p++) {
|
||||||
if (bytes & (0x10 >> p)) {
|
if (bytes & (0x10 >> p)) {
|
||||||
concat(binary_string, "1");
|
strcat(binary_string, "1");
|
||||||
} else {
|
} else {
|
||||||
concat(binary_string, "0");
|
strcat(binary_string, "0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -665,24 +665,24 @@ int aztec_text_process(unsigned char source[], const unsigned int src_len, char
|
|||||||
case MIXED:
|
case MIXED:
|
||||||
case PUNC:
|
case PUNC:
|
||||||
if (charmap[i] >= 400) {
|
if (charmap[i] >= 400) {
|
||||||
concat(binary_string, tribit[charmap[i] - 400]);
|
strcat(binary_string, tribit[charmap[i] - 400]);
|
||||||
if (debug) printf("FLG(%d) ", charmap[i] - 400);
|
if (debug) printf("FLG(%d) ", charmap[i] - 400);
|
||||||
} else {
|
} else {
|
||||||
concat(binary_string, hexbit[charmap[i]]);
|
strcat(binary_string, hexbit[charmap[i]]);
|
||||||
if (!((chartype == PUNC) && (charmap[i] == 0)))
|
if (!((chartype == PUNC) && (charmap[i] == 0)))
|
||||||
if (debug) printf("%d ", charmap[i]);
|
if (debug) printf("%d ", charmap[i]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DIGIT:
|
case DIGIT:
|
||||||
concat(binary_string, pentbit[charmap[i]]);
|
strcat(binary_string, pentbit[charmap[i]]);
|
||||||
if (debug) printf("%d ", charmap[i]);
|
if (debug) printf("%d ", charmap[i]);
|
||||||
break;
|
break;
|
||||||
case BINARY:
|
case BINARY:
|
||||||
for (p = 0; p < 8; p++) {
|
for (p = 0; p < 8; p++) {
|
||||||
if (charmap[i] & (0x80 >> p)) {
|
if (charmap[i] & (0x80 >> p)) {
|
||||||
concat(binary_string, "1");
|
strcat(binary_string, "1");
|
||||||
} else {
|
} else {
|
||||||
concat(binary_string, "0");
|
strcat(binary_string, "0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (debug) printf("%d ", charmap[i]);
|
if (debug) printf("%d ", charmap[i]);
|
||||||
@ -1065,7 +1065,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < padbits; i++) {
|
for (i = 0; i < padbits; i++) {
|
||||||
concat(adjusted_string, "1");
|
strcat(adjusted_string, "1");
|
||||||
}
|
}
|
||||||
adjusted_length = strlen(adjusted_string);
|
adjusted_length = strlen(adjusted_string);
|
||||||
|
|
||||||
@ -1171,7 +1171,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < padbits; i++) {
|
for (i = 0; i < padbits; i++) {
|
||||||
concat(adjusted_string, "1");
|
strcat(adjusted_string, "1");
|
||||||
}
|
}
|
||||||
adjusted_length = strlen(adjusted_string);
|
adjusted_length = strlen(adjusted_string);
|
||||||
|
|
||||||
@ -1266,9 +1266,9 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
for (i = (ecc_blocks - 1); i >= 0; i--) {
|
for (i = (ecc_blocks - 1); i >= 0; i--) {
|
||||||
for (p = 0; p < 6; p++) {
|
for (p = 0; p < 6; p++) {
|
||||||
if (ecc_part[i] & (0x20 >> p)) {
|
if (ecc_part[i] & (0x20 >> p)) {
|
||||||
concat(adjusted_string, "1");
|
strcat(adjusted_string, "1");
|
||||||
} else {
|
} else {
|
||||||
concat(adjusted_string, "0");
|
strcat(adjusted_string, "0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1288,9 +1288,9 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
for (i = (ecc_blocks - 1); i >= 0; i--) {
|
for (i = (ecc_blocks - 1); i >= 0; i--) {
|
||||||
for (p = 0; p < 8; p++) {
|
for (p = 0; p < 8; p++) {
|
||||||
if (ecc_part[i] & (0x80 >> p)) {
|
if (ecc_part[i] & (0x80 >> p)) {
|
||||||
concat(adjusted_string, "1");
|
strcat(adjusted_string, "1");
|
||||||
} else {
|
} else {
|
||||||
concat(adjusted_string, "0");
|
strcat(adjusted_string, "0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1310,9 +1310,9 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
for (i = (ecc_blocks - 1); i >= 0; i--) {
|
for (i = (ecc_blocks - 1); i >= 0; i--) {
|
||||||
for (p = 0; p < 10; p++) {
|
for (p = 0; p < 10; p++) {
|
||||||
if (ecc_part[i] & (0x200 >> p)) {
|
if (ecc_part[i] & (0x200 >> p)) {
|
||||||
concat(adjusted_string, "1");
|
strcat(adjusted_string, "1");
|
||||||
} else {
|
} else {
|
||||||
concat(adjusted_string, "0");
|
strcat(adjusted_string, "0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1332,9 +1332,9 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
for (i = (ecc_blocks - 1); i >= 0; i--) {
|
for (i = (ecc_blocks - 1); i >= 0; i--) {
|
||||||
for (p = 0; p < 12; p++) {
|
for (p = 0; p < 12; p++) {
|
||||||
if (ecc_part[i] & (0x800 >> p)) {
|
if (ecc_part[i] & (0x800 >> p)) {
|
||||||
concat(adjusted_string, "1");
|
strcat(adjusted_string, "1");
|
||||||
} else {
|
} else {
|
||||||
concat(adjusted_string, "0");
|
strcat(adjusted_string, "0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1654,9 +1654,9 @@ int aztec_runes(struct zint_symbol *symbol, unsigned char source[], int length)
|
|||||||
strcpy(binary_string, "");
|
strcpy(binary_string, "");
|
||||||
for (p = 0; p < 8; p++) {
|
for (p = 0; p < 8; p++) {
|
||||||
if (input_value & (0x80 >> p)) {
|
if (input_value & (0x80 >> p)) {
|
||||||
concat(binary_string, "1");
|
strcat(binary_string, "1");
|
||||||
} else {
|
} else {
|
||||||
concat(binary_string, "0");
|
strcat(binary_string, "0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,12 +177,12 @@ int code_11(struct zint_symbol *symbol, unsigned char source[], int length) { /*
|
|||||||
lookup(SODIUM, C11Table, checkstr[1], dest);
|
lookup(SODIUM, C11Table, checkstr[1], dest);
|
||||||
|
|
||||||
/* Stop character */
|
/* Stop character */
|
||||||
concat(dest, "11221");
|
strcat(dest, "11221");
|
||||||
|
|
||||||
expand(symbol, dest);
|
expand(symbol, dest);
|
||||||
|
|
||||||
ustrcpy(symbol->text, source);
|
ustrcpy(symbol->text, source);
|
||||||
uconcat(symbol->text, (unsigned char*) checkstr);
|
strcat((char*) symbol->text, checkstr);
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,7 +265,7 @@ int c39(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Stop character */
|
/* Stop character */
|
||||||
concat(dest, "121121211");
|
strcat(dest, "121121211");
|
||||||
|
|
||||||
if ((symbol->symbology == BARCODE_LOGMARS) || (symbol->symbology == BARCODE_HIBC_39)) {
|
if ((symbol->symbology == BARCODE_LOGMARS) || (symbol->symbology == BARCODE_HIBC_39)) {
|
||||||
/* LOGMARS uses wider 'wide' bars than normal Code 39 */
|
/* LOGMARS uses wider 'wide' bars than normal Code 39 */
|
||||||
@ -280,13 +280,13 @@ int c39(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
expand(symbol, dest);
|
expand(symbol, dest);
|
||||||
|
|
||||||
if (symbol->symbology == BARCODE_CODE39) {
|
if (symbol->symbology == BARCODE_CODE39) {
|
||||||
ustrcpy(symbol->text, (unsigned char*) "*");
|
strcpy((char*) symbol->text, "*");
|
||||||
uconcat(symbol->text, source);
|
strcat((char*) symbol->text, (char*) source);
|
||||||
uconcat(symbol->text, (unsigned char*) localstr);
|
strcat((char*) symbol->text, localstr);
|
||||||
uconcat(symbol->text, (unsigned char*) "*");
|
strcat((char*) symbol->text, "*");
|
||||||
} else {
|
} else {
|
||||||
ustrcpy(symbol->text, source);
|
strcpy((char*) symbol->text, (char*) source);
|
||||||
uconcat(symbol->text, (unsigned char*) localstr);
|
strcat((char*) symbol->text, localstr);
|
||||||
}
|
}
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
@ -333,7 +333,7 @@ int pharmazentral(struct zint_symbol *symbol, unsigned char source[], int length
|
|||||||
}
|
}
|
||||||
error_number = c39(symbol, (unsigned char *) localstr, strlen(localstr));
|
error_number = c39(symbol, (unsigned char *) localstr, strlen(localstr));
|
||||||
ustrcpy(symbol->text, (unsigned char *) "PZN");
|
ustrcpy(symbol->text, (unsigned char *) "PZN");
|
||||||
uconcat(symbol->text, (unsigned char *) localstr);
|
strcat((char*) symbol->text, localstr);
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -358,7 +358,7 @@ int ec39(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
strcpy(symbol->errtxt, "Invalid characters in input data");
|
strcpy(symbol->errtxt, "Invalid characters in input data");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
concat((char*) buffer, EC39Ctrl[source[i]]);
|
strcat((char*) buffer, EC39Ctrl[source[i]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Then sends the buffer to the C39 function */
|
/* Then sends the buffer to the C39 function */
|
||||||
@ -399,7 +399,7 @@ int c93(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
strcpy(symbol->errtxt, "Invalid characters in input data");
|
strcpy(symbol->errtxt, "Invalid characters in input data");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
concat(buffer, C93Ctrl[source[i]]);
|
strcat(buffer, C93Ctrl[source[i]]);
|
||||||
symbol->text[i] = source[i] ? source[i] : ' ';
|
symbol->text[i] = source[i] ? source[i] : ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -450,7 +450,7 @@ int c93(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Stop character */
|
/* Stop character */
|
||||||
concat(dest, "1111411");
|
strcat(dest, "1111411");
|
||||||
expand(symbol, dest);
|
expand(symbol, dest);
|
||||||
|
|
||||||
symbol->text[length] = set_copy[c];
|
symbol->text[length] = set_copy[c];
|
||||||
@ -482,7 +482,7 @@ void CheckCharacter() {
|
|||||||
part[0] = itoc(S[i]);
|
part[0] = itoc(S[i]);
|
||||||
part[1] = itoc(B[i]);
|
part[1] = itoc(B[i]);
|
||||||
part[2] = '\0';
|
part[2] = '\0';
|
||||||
concat(pattern, part);
|
strcat(pattern, part);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include "large.h"
|
#include "large.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <math.h>
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include <sys/malloc.h>
|
#include <sys/malloc.h>
|
||||||
#else
|
#else
|
||||||
@ -187,7 +188,7 @@ int c1_look_ahead_test(unsigned char source[], int sourcelen, int position, int
|
|||||||
if ((source[sp] >= '0') && (source[sp] <= '9')) {
|
if ((source[sp] >= '0') && (source[sp] <= '9')) {
|
||||||
ascii_count += 0.5;
|
ascii_count += 0.5;
|
||||||
} else {
|
} else {
|
||||||
ascii_count = froundup(ascii_count);
|
ascii_count = ceil(ascii_count);
|
||||||
if (source[sp] > 127) {
|
if (source[sp] > 127) {
|
||||||
ascii_count += 2.0;
|
ascii_count += 2.0;
|
||||||
} else {
|
} else {
|
||||||
@ -280,34 +281,34 @@ int c1_look_ahead_test(unsigned char source[], int sourcelen, int position, int
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ascii_count = froundup(ascii_count);
|
ascii_count = ceil(ascii_count);
|
||||||
c40_count = froundup(c40_count);
|
c40_count = ceil(c40_count);
|
||||||
text_count = froundup(text_count);
|
text_count = ceil(text_count);
|
||||||
edi_count = froundup(edi_count);
|
edi_count = ceil(edi_count);
|
||||||
byte_count = froundup(byte_count);
|
byte_count = ceil(byte_count);
|
||||||
best_scheme = C1_ASCII;
|
best_scheme = C1_ASCII;
|
||||||
|
|
||||||
if (sp == sourcelen) {
|
if (sp == sourcelen) {
|
||||||
/* Step K */
|
/* Step K */
|
||||||
best_count = (int)edi_count;
|
best_count = (int) edi_count;
|
||||||
|
|
||||||
if (text_count <= best_count) {
|
if (text_count <= best_count) {
|
||||||
best_count = (int)text_count;
|
best_count = (int) text_count;
|
||||||
best_scheme = C1_TEXT;
|
best_scheme = C1_TEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c40_count <= best_count) {
|
if (c40_count <= best_count) {
|
||||||
best_count = (int)c40_count;
|
best_count = (int) c40_count;
|
||||||
best_scheme = C1_C40;
|
best_scheme = C1_C40;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ascii_count <= best_count) {
|
if (ascii_count <= best_count) {
|
||||||
best_count = (int)ascii_count;
|
best_count = (int) ascii_count;
|
||||||
best_scheme = C1_ASCII;
|
best_scheme = C1_ASCII;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (byte_count <= best_count) {
|
if (byte_count <= best_count) {
|
||||||
best_count = (int)byte_count;
|
best_count = (int) byte_count;
|
||||||
best_scheme = C1_BYTE;
|
best_scheme = C1_BYTE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -382,7 +383,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
|
|||||||
/* FNC1 */
|
/* FNC1 */
|
||||||
target[tp] = 232;
|
target[tp] = 232;
|
||||||
tp++;
|
tp++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Step A */
|
/* Step A */
|
||||||
current_mode = C1_ASCII;
|
current_mode = C1_ASCII;
|
||||||
@ -518,7 +519,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
|
|||||||
if (source[sp] > 127) {
|
if (source[sp] > 127) {
|
||||||
/* Step B7 */
|
/* Step B7 */
|
||||||
target[tp] = 235; /* FNC4 */
|
target[tp] = 235; /* FNC4 */
|
||||||
tp++;
|
tp++;
|
||||||
target[tp] = (source[sp] - 128) + 1;
|
target[tp] = (source[sp] - 128) + 1;
|
||||||
tp++;
|
tp++;
|
||||||
sp++;
|
sp++;
|
||||||
@ -527,7 +528,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
|
|||||||
if ((gs1) && (source[sp] == '[')) {
|
if ((gs1) && (source[sp] == '[')) {
|
||||||
target[tp] = 232; /* FNC1 */
|
target[tp] = 232; /* FNC1 */
|
||||||
tp++;
|
tp++;
|
||||||
sp++;
|
sp++;
|
||||||
} else {
|
} else {
|
||||||
target[tp] = source[sp] + 1;
|
target[tp] = source[sp] + 1;
|
||||||
tp++;
|
tp++;
|
||||||
@ -594,13 +595,13 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
|
|||||||
|
|
||||||
if (next_mode != C1_C40) {
|
if (next_mode != C1_C40) {
|
||||||
target[tp] = 255; /* Unlatch */
|
target[tp] = 255; /* Unlatch */
|
||||||
tp++;
|
tp++;
|
||||||
} else {
|
} else {
|
||||||
if (source[sp] > 127) {
|
if (source[sp] > 127) {
|
||||||
c40_buffer[c40_p] = 1;
|
c40_buffer[c40_p] = 1;
|
||||||
c40_p++;
|
c40_p++;
|
||||||
c40_buffer[c40_p] = 30; /* Upper Shift */
|
c40_buffer[c40_p] = 30; /* Upper Shift */
|
||||||
c40_p++;
|
c40_p++;
|
||||||
shift_set = c40_shift[source[sp] - 128];
|
shift_set = c40_shift[source[sp] - 128];
|
||||||
value = c40_value[source[sp] - 128];
|
value = c40_value[source[sp] - 128];
|
||||||
} else {
|
} else {
|
||||||
@ -794,7 +795,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
|
|||||||
|
|
||||||
if (next_mode != C1_EDI) {
|
if (next_mode != C1_EDI) {
|
||||||
target[tp] = 255; /* Unlatch */
|
target[tp] = 255; /* Unlatch */
|
||||||
tp++;
|
tp++;
|
||||||
} else {
|
} else {
|
||||||
if (source[sp] == 13) {
|
if (source[sp] == 13) {
|
||||||
value = 0;
|
value = 0;
|
||||||
@ -869,7 +870,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
|
|||||||
int sub_target;
|
int sub_target;
|
||||||
/* Finish Decimal mode and go back to ASCII */
|
/* Finish Decimal mode and go back to ASCII */
|
||||||
|
|
||||||
concat(decimal_binary, "111111"); /* Unlatch */
|
strcat(decimal_binary, "111111"); /* Unlatch */
|
||||||
|
|
||||||
target_count = 3;
|
target_count = 3;
|
||||||
if (strlen(decimal_binary) <= 16) {
|
if (strlen(decimal_binary) <= 16) {
|
||||||
@ -884,7 +885,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (bits_left_in_byte == 2) {
|
if (bits_left_in_byte == 2) {
|
||||||
concat(decimal_binary, "01");
|
strcat(decimal_binary, "01");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((bits_left_in_byte == 4) || (bits_left_in_byte == 6)) {
|
if ((bits_left_in_byte == 4) || (bits_left_in_byte == 6)) {
|
||||||
@ -892,33 +893,33 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
|
|||||||
int sub_value = ctoi(source[sp]) + 1;
|
int sub_value = ctoi(source[sp]) + 1;
|
||||||
|
|
||||||
if (sub_value & 0x08) {
|
if (sub_value & 0x08) {
|
||||||
concat(decimal_binary, "1");
|
strcat(decimal_binary, "1");
|
||||||
} else {
|
} else {
|
||||||
concat(decimal_binary, "0");
|
strcat(decimal_binary, "0");
|
||||||
}
|
}
|
||||||
if (sub_value & 0x04) {
|
if (sub_value & 0x04) {
|
||||||
concat(decimal_binary, "1");
|
strcat(decimal_binary, "1");
|
||||||
} else {
|
} else {
|
||||||
concat(decimal_binary, "0");
|
strcat(decimal_binary, "0");
|
||||||
}
|
}
|
||||||
if (sub_value & 0x02) {
|
if (sub_value & 0x02) {
|
||||||
concat(decimal_binary, "1");
|
strcat(decimal_binary, "1");
|
||||||
} else {
|
} else {
|
||||||
concat(decimal_binary, "0");
|
strcat(decimal_binary, "0");
|
||||||
}
|
}
|
||||||
if (sub_value & 0x01) {
|
if (sub_value & 0x01) {
|
||||||
concat(decimal_binary, "1");
|
strcat(decimal_binary, "1");
|
||||||
} else {
|
} else {
|
||||||
concat(decimal_binary, "0");
|
strcat(decimal_binary, "0");
|
||||||
}
|
}
|
||||||
sp++;
|
sp++;
|
||||||
} else {
|
} else {
|
||||||
concat(decimal_binary, "1111");
|
strcat(decimal_binary, "1111");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bits_left_in_byte == 6) {
|
if (bits_left_in_byte == 6) {
|
||||||
concat(decimal_binary, "01");
|
strcat(decimal_binary, "01");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Binary buffer is full - transfer to target */
|
/* Binary buffer is full - transfer to target */
|
||||||
@ -1017,9 +1018,9 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
|
|||||||
|
|
||||||
for (p = 0; p < 10; p++) {
|
for (p = 0; p < 10; p++) {
|
||||||
if (value & (0x200 >> p)) {
|
if (value & (0x200 >> p)) {
|
||||||
concat(decimal_binary, "1");
|
strcat(decimal_binary, "1");
|
||||||
} else {
|
} else {
|
||||||
concat(decimal_binary, "0");
|
strcat(decimal_binary, "0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1031,7 +1032,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
|
|||||||
char temp_binary[40];
|
char temp_binary[40];
|
||||||
|
|
||||||
/* Binary buffer is full - transfer to target */
|
/* Binary buffer is full - transfer to target */
|
||||||
|
|
||||||
for (p = 0; p < 8; p++) {
|
for (p = 0; p < 8; p++) {
|
||||||
if (decimal_binary[p] == '1') {
|
if (decimal_binary[p] == '1') {
|
||||||
target1 += (0x80 >> p);
|
target1 += (0x80 >> p);
|
||||||
@ -1052,7 +1053,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
|
|||||||
|
|
||||||
strcpy(temp_binary, "");
|
strcpy(temp_binary, "");
|
||||||
if (strlen(decimal_binary) > 24) {
|
if (strlen(decimal_binary) > 24) {
|
||||||
for(i = 0; i <= (int)(strlen(decimal_binary) - 24); i++) {
|
for (i = 0; i <= (int) (strlen(decimal_binary) - 24); i++) {
|
||||||
temp_binary[i] = decimal_binary[i + 24];
|
temp_binary[i] = decimal_binary[i + 24];
|
||||||
}
|
}
|
||||||
strcpy(decimal_binary, temp_binary);
|
strcpy(decimal_binary, temp_binary);
|
||||||
@ -1158,7 +1159,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
|
|||||||
int sub_target;
|
int sub_target;
|
||||||
/* Finish Decimal mode and go back to ASCII */
|
/* Finish Decimal mode and go back to ASCII */
|
||||||
|
|
||||||
concat(decimal_binary, "111111"); /* Unlatch */
|
strcat(decimal_binary, "111111"); /* Unlatch */
|
||||||
|
|
||||||
target_count = 3;
|
target_count = 3;
|
||||||
if (strlen(decimal_binary) <= 16) {
|
if (strlen(decimal_binary) <= 16) {
|
||||||
@ -1173,15 +1174,15 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (bits_left_in_byte == 2) {
|
if (bits_left_in_byte == 2) {
|
||||||
concat(decimal_binary, "01");
|
strcat(decimal_binary, "01");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((bits_left_in_byte == 4) || (bits_left_in_byte == 6)) {
|
if ((bits_left_in_byte == 4) || (bits_left_in_byte == 6)) {
|
||||||
concat(decimal_binary, "1111");
|
strcat(decimal_binary, "1111");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bits_left_in_byte == 6) {
|
if (bits_left_in_byte == 6) {
|
||||||
concat(decimal_binary, "01");
|
strcat(decimal_binary, "01");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Binary buffer is full - transfer to target */
|
/* Binary buffer is full - transfer to target */
|
||||||
@ -1357,13 +1358,13 @@ int code_one(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
sub_version = 2;
|
sub_version = 2;
|
||||||
codewords = 8;
|
codewords = 8;
|
||||||
block_width = 4;
|
block_width = 4;
|
||||||
}
|
}
|
||||||
if (length <= 6) {
|
if (length <= 6) {
|
||||||
/* Version S-10 */
|
/* Version S-10 */
|
||||||
sub_version = 1;
|
sub_version = 1;
|
||||||
codewords = 4;
|
codewords = 4;
|
||||||
block_width = 2;
|
block_width = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
binary_load(elreg, (char *) source, length);
|
binary_load(elreg, (char *) source, length);
|
||||||
|
|
||||||
|
@ -244,18 +244,18 @@ void c128_set_a(unsigned char source, char dest[], int values[], int *bar_chars)
|
|||||||
|
|
||||||
if (source > 127) {
|
if (source > 127) {
|
||||||
if (source < 160) {
|
if (source < 160) {
|
||||||
concat(dest, C128Table[(source - 128) + 64]);
|
strcat(dest, C128Table[(source - 128) + 64]);
|
||||||
values[(*bar_chars)] = (source - 128) + 64;
|
values[(*bar_chars)] = (source - 128) + 64;
|
||||||
} else {
|
} else {
|
||||||
concat(dest, C128Table[(source - 128) - 32]);
|
strcat(dest, C128Table[(source - 128) - 32]);
|
||||||
values[(*bar_chars)] = (source - 128) - 32;
|
values[(*bar_chars)] = (source - 128) - 32;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (source < 32) {
|
if (source < 32) {
|
||||||
concat(dest, C128Table[source + 64]);
|
strcat(dest, C128Table[source + 64]);
|
||||||
values[(*bar_chars)] = source + 64;
|
values[(*bar_chars)] = source + 64;
|
||||||
} else {
|
} else {
|
||||||
concat(dest, C128Table[source - 32]);
|
strcat(dest, C128Table[source - 32]);
|
||||||
values[(*bar_chars)] = source - 32;
|
values[(*bar_chars)] = source - 32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -269,10 +269,10 @@ void c128_set_a(unsigned char source, char dest[], int values[], int *bar_chars)
|
|||||||
*/
|
*/
|
||||||
void c128_set_b(unsigned char source, char dest[], int values[], int *bar_chars) {
|
void c128_set_b(unsigned char source, char dest[], int values[], int *bar_chars) {
|
||||||
if (source > 127) {
|
if (source > 127) {
|
||||||
concat(dest, C128Table[source - 32 - 128]);
|
strcat(dest, C128Table[source - 32 - 128]);
|
||||||
values[(*bar_chars)] = source - 32 - 128;
|
values[(*bar_chars)] = source - 32 - 128;
|
||||||
} else {
|
} else {
|
||||||
concat(dest, C128Table[source - 32]);
|
strcat(dest, C128Table[source - 32]);
|
||||||
values[(*bar_chars)] = source - 32;
|
values[(*bar_chars)] = source - 32;
|
||||||
}
|
}
|
||||||
(*bar_chars)++;
|
(*bar_chars)++;
|
||||||
@ -285,7 +285,7 @@ void c128_set_c(unsigned char source_a, unsigned char source_b, char dest[], int
|
|||||||
int weight;
|
int weight;
|
||||||
|
|
||||||
weight = (10 * ctoi(source_a)) + ctoi(source_b);
|
weight = (10 * ctoi(source_a)) + ctoi(source_b);
|
||||||
concat(dest, C128Table[weight]);
|
strcat(dest, C128Table[weight]);
|
||||||
values[(*bar_chars)] = weight;
|
values[(*bar_chars)] = weight;
|
||||||
(*bar_chars)++;
|
(*bar_chars)++;
|
||||||
}
|
}
|
||||||
@ -491,27 +491,27 @@ int code_128(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
/* Reader Initialisation mode */
|
/* Reader Initialisation mode */
|
||||||
switch (set[0]) {
|
switch (set[0]) {
|
||||||
case 'A': /* Start A */
|
case 'A': /* Start A */
|
||||||
concat(dest, C128Table[103]);
|
strcat(dest, C128Table[103]);
|
||||||
values[0] = 103;
|
values[0] = 103;
|
||||||
current_set = 'A';
|
current_set = 'A';
|
||||||
concat(dest, C128Table[96]); /* FNC3 */
|
strcat(dest, C128Table[96]); /* FNC3 */
|
||||||
values[1] = 96;
|
values[1] = 96;
|
||||||
bar_characters++;
|
bar_characters++;
|
||||||
break;
|
break;
|
||||||
case 'B': /* Start B */
|
case 'B': /* Start B */
|
||||||
concat(dest, C128Table[104]);
|
strcat(dest, C128Table[104]);
|
||||||
values[0] = 104;
|
values[0] = 104;
|
||||||
current_set = 'B';
|
current_set = 'B';
|
||||||
concat(dest, C128Table[96]); /* FNC3 */
|
strcat(dest, C128Table[96]); /* FNC3 */
|
||||||
values[1] = 96;
|
values[1] = 96;
|
||||||
bar_characters++;
|
bar_characters++;
|
||||||
break;
|
break;
|
||||||
case 'C': /* Start C */
|
case 'C': /* Start C */
|
||||||
concat(dest, C128Table[104]); /* Start B */
|
strcat(dest, C128Table[104]); /* Start B */
|
||||||
values[0] = 105;
|
values[0] = 105;
|
||||||
concat(dest, C128Table[96]); /* FNC3 */
|
strcat(dest, C128Table[96]); /* FNC3 */
|
||||||
values[1] = 96;
|
values[1] = 96;
|
||||||
concat(dest, C128Table[99]); /* Code C */
|
strcat(dest, C128Table[99]); /* Code C */
|
||||||
values[2] = 99;
|
values[2] = 99;
|
||||||
bar_characters += 2;
|
bar_characters += 2;
|
||||||
current_set = 'C';
|
current_set = 'C';
|
||||||
@ -521,17 +521,17 @@ int code_128(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
/* Normal mode */
|
/* Normal mode */
|
||||||
switch (set[0]) {
|
switch (set[0]) {
|
||||||
case 'A': /* Start A */
|
case 'A': /* Start A */
|
||||||
concat(dest, C128Table[103]);
|
strcat(dest, C128Table[103]);
|
||||||
values[0] = 103;
|
values[0] = 103;
|
||||||
current_set = 'A';
|
current_set = 'A';
|
||||||
break;
|
break;
|
||||||
case 'B': /* Start B */
|
case 'B': /* Start B */
|
||||||
concat(dest, C128Table[104]);
|
strcat(dest, C128Table[104]);
|
||||||
values[0] = 104;
|
values[0] = 104;
|
||||||
current_set = 'B';
|
current_set = 'B';
|
||||||
break;
|
break;
|
||||||
case 'C': /* Start C */
|
case 'C': /* Start C */
|
||||||
concat(dest, C128Table[105]);
|
strcat(dest, C128Table[105]);
|
||||||
values[0] = 105;
|
values[0] = 105;
|
||||||
current_set = 'C';
|
current_set = 'C';
|
||||||
break;
|
break;
|
||||||
@ -543,14 +543,14 @@ int code_128(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
if (fset[0] == 'F') {
|
if (fset[0] == 'F') {
|
||||||
switch (current_set) {
|
switch (current_set) {
|
||||||
case 'A':
|
case 'A':
|
||||||
concat(dest, C128Table[101]);
|
strcat(dest, C128Table[101]);
|
||||||
concat(dest, C128Table[101]);
|
strcat(dest, C128Table[101]);
|
||||||
values[bar_characters] = 101;
|
values[bar_characters] = 101;
|
||||||
values[bar_characters + 1] = 101;
|
values[bar_characters + 1] = 101;
|
||||||
break;
|
break;
|
||||||
case 'B':
|
case 'B':
|
||||||
concat(dest, C128Table[100]);
|
strcat(dest, C128Table[100]);
|
||||||
concat(dest, C128Table[100]);
|
strcat(dest, C128Table[100]);
|
||||||
values[bar_characters] = 100;
|
values[bar_characters] = 100;
|
||||||
values[bar_characters + 1] = 100;
|
values[bar_characters + 1] = 100;
|
||||||
break;
|
break;
|
||||||
@ -566,17 +566,17 @@ int code_128(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
if ((read != 0) && (set[read] != current_set)) {
|
if ((read != 0) && (set[read] != current_set)) {
|
||||||
/* Latch different code set */
|
/* Latch different code set */
|
||||||
switch (set[read]) {
|
switch (set[read]) {
|
||||||
case 'A': concat(dest, C128Table[101]);
|
case 'A': strcat(dest, C128Table[101]);
|
||||||
values[bar_characters] = 101;
|
values[bar_characters] = 101;
|
||||||
bar_characters++;
|
bar_characters++;
|
||||||
current_set = 'A';
|
current_set = 'A';
|
||||||
break;
|
break;
|
||||||
case 'B': concat(dest, C128Table[100]);
|
case 'B': strcat(dest, C128Table[100]);
|
||||||
values[bar_characters] = 100;
|
values[bar_characters] = 100;
|
||||||
bar_characters++;
|
bar_characters++;
|
||||||
current_set = 'B';
|
current_set = 'B';
|
||||||
break;
|
break;
|
||||||
case 'C': concat(dest, C128Table[99]);
|
case 'C': strcat(dest, C128Table[99]);
|
||||||
values[bar_characters] = 99;
|
values[bar_characters] = 99;
|
||||||
bar_characters++;
|
bar_characters++;
|
||||||
current_set = 'C';
|
current_set = 'C';
|
||||||
@ -589,14 +589,14 @@ int code_128(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
/* Latch beginning of extended mode */
|
/* Latch beginning of extended mode */
|
||||||
switch (current_set) {
|
switch (current_set) {
|
||||||
case 'A':
|
case 'A':
|
||||||
concat(dest, C128Table[101]);
|
strcat(dest, C128Table[101]);
|
||||||
concat(dest, C128Table[101]);
|
strcat(dest, C128Table[101]);
|
||||||
values[bar_characters] = 101;
|
values[bar_characters] = 101;
|
||||||
values[bar_characters + 1] = 101;
|
values[bar_characters + 1] = 101;
|
||||||
break;
|
break;
|
||||||
case 'B':
|
case 'B':
|
||||||
concat(dest, C128Table[100]);
|
strcat(dest, C128Table[100]);
|
||||||
concat(dest, C128Table[100]);
|
strcat(dest, C128Table[100]);
|
||||||
values[bar_characters] = 100;
|
values[bar_characters] = 100;
|
||||||
values[bar_characters + 1] = 100;
|
values[bar_characters + 1] = 100;
|
||||||
break;
|
break;
|
||||||
@ -608,14 +608,14 @@ int code_128(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
/* Latch end of extended mode */
|
/* Latch end of extended mode */
|
||||||
switch (current_set) {
|
switch (current_set) {
|
||||||
case 'A':
|
case 'A':
|
||||||
concat(dest, C128Table[101]);
|
strcat(dest, C128Table[101]);
|
||||||
concat(dest, C128Table[101]);
|
strcat(dest, C128Table[101]);
|
||||||
values[bar_characters] = 101;
|
values[bar_characters] = 101;
|
||||||
values[bar_characters + 1] = 101;
|
values[bar_characters + 1] = 101;
|
||||||
break;
|
break;
|
||||||
case 'B':
|
case 'B':
|
||||||
concat(dest, C128Table[100]);
|
strcat(dest, C128Table[100]);
|
||||||
concat(dest, C128Table[100]);
|
strcat(dest, C128Table[100]);
|
||||||
values[bar_characters] = 100;
|
values[bar_characters] = 100;
|
||||||
values[bar_characters + 1] = 100;
|
values[bar_characters + 1] = 100;
|
||||||
break;
|
break;
|
||||||
@ -629,11 +629,11 @@ int code_128(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
/* Shift to or from extended mode */
|
/* Shift to or from extended mode */
|
||||||
switch (current_set) {
|
switch (current_set) {
|
||||||
case 'A':
|
case 'A':
|
||||||
concat(dest, C128Table[101]); /* FNC 4 */
|
strcat(dest, C128Table[101]); /* FNC 4 */
|
||||||
values[bar_characters] = 101;
|
values[bar_characters] = 101;
|
||||||
break;
|
break;
|
||||||
case 'B':
|
case 'B':
|
||||||
concat(dest, C128Table[100]); /* FNC 4 */
|
strcat(dest, C128Table[100]); /* FNC 4 */
|
||||||
values[bar_characters] = 100;
|
values[bar_characters] = 100;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -642,7 +642,7 @@ int code_128(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
|
|
||||||
if ((set[read] == 'a') || (set[read] == 'b')) {
|
if ((set[read] == 'a') || (set[read] == 'b')) {
|
||||||
/* Insert shift character */
|
/* Insert shift character */
|
||||||
concat(dest, C128Table[98]);
|
strcat(dest, C128Table[98]);
|
||||||
values[bar_characters] = 98;
|
values[bar_characters] = 98;
|
||||||
bar_characters++;
|
bar_characters++;
|
||||||
}
|
}
|
||||||
@ -672,10 +672,10 @@ int code_128(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
}
|
}
|
||||||
total_sum += values[i];
|
total_sum += values[i];
|
||||||
}
|
}
|
||||||
concat(dest, C128Table[total_sum % 103]);
|
strcat(dest, C128Table[total_sum % 103]);
|
||||||
|
|
||||||
/* Stop character */
|
/* Stop character */
|
||||||
concat(dest, C128Table[106]);
|
strcat(dest, C128Table[106]);
|
||||||
expand(symbol, dest);
|
expand(symbol, dest);
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
@ -850,21 +850,21 @@ int ean_128(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
/* So now we know what start character to use - we can get on with it! */
|
/* So now we know what start character to use - we can get on with it! */
|
||||||
switch (set[0]) {
|
switch (set[0]) {
|
||||||
case 'A': /* Start A */
|
case 'A': /* Start A */
|
||||||
concat(dest, C128Table[103]);
|
strcat(dest, C128Table[103]);
|
||||||
values[0] = 103;
|
values[0] = 103;
|
||||||
break;
|
break;
|
||||||
case 'B': /* Start B */
|
case 'B': /* Start B */
|
||||||
concat(dest, C128Table[104]);
|
strcat(dest, C128Table[104]);
|
||||||
values[0] = 104;
|
values[0] = 104;
|
||||||
break;
|
break;
|
||||||
case 'C': /* Start C */
|
case 'C': /* Start C */
|
||||||
concat(dest, C128Table[105]);
|
strcat(dest, C128Table[105]);
|
||||||
values[0] = 105;
|
values[0] = 105;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
bar_characters++;
|
bar_characters++;
|
||||||
|
|
||||||
concat(dest, C128Table[102]);
|
strcat(dest, C128Table[102]);
|
||||||
values[1] = 102;
|
values[1] = 102;
|
||||||
bar_characters++;
|
bar_characters++;
|
||||||
|
|
||||||
@ -874,15 +874,15 @@ int ean_128(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
|
|
||||||
if ((read != 0) && (set[read] != set[read - 1])) { /* Latch different code set */
|
if ((read != 0) && (set[read] != set[read - 1])) { /* Latch different code set */
|
||||||
switch (set[read]) {
|
switch (set[read]) {
|
||||||
case 'A': concat(dest, C128Table[101]);
|
case 'A': strcat(dest, C128Table[101]);
|
||||||
values[bar_characters] = 101;
|
values[bar_characters] = 101;
|
||||||
bar_characters++;
|
bar_characters++;
|
||||||
break;
|
break;
|
||||||
case 'B': concat(dest, C128Table[100]);
|
case 'B': strcat(dest, C128Table[100]);
|
||||||
values[bar_characters] = 100;
|
values[bar_characters] = 100;
|
||||||
bar_characters++;
|
bar_characters++;
|
||||||
break;
|
break;
|
||||||
case 'C': concat(dest, C128Table[99]);
|
case 'C': strcat(dest, C128Table[99]);
|
||||||
values[bar_characters] = 99;
|
values[bar_characters] = 99;
|
||||||
bar_characters++;
|
bar_characters++;
|
||||||
break;
|
break;
|
||||||
@ -891,7 +891,7 @@ int ean_128(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
|
|
||||||
if ((set[read] == 'a') || (set[read] == 'b')) {
|
if ((set[read] == 'a') || (set[read] == 'b')) {
|
||||||
/* Insert shift character */
|
/* Insert shift character */
|
||||||
concat(dest, C128Table[98]);
|
strcat(dest, C128Table[98]);
|
||||||
values[bar_characters] = 98;
|
values[bar_characters] = 98;
|
||||||
bar_characters++;
|
bar_characters++;
|
||||||
}
|
}
|
||||||
@ -914,7 +914,7 @@ int ean_128(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
concat(dest, C128Table[102]);
|
strcat(dest, C128Table[102]);
|
||||||
values[bar_characters] = 102;
|
values[bar_characters] = 102;
|
||||||
bar_characters++;
|
bar_characters++;
|
||||||
read++;
|
read++;
|
||||||
@ -953,7 +953,7 @@ int ean_128(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (linkage_flag != 0) {
|
if (linkage_flag != 0) {
|
||||||
concat(dest, C128Table[linkage_flag]);
|
strcat(dest, C128Table[linkage_flag]);
|
||||||
values[bar_characters] = linkage_flag;
|
values[bar_characters] = linkage_flag;
|
||||||
bar_characters++;
|
bar_characters++;
|
||||||
}
|
}
|
||||||
@ -967,12 +967,12 @@ int ean_128(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
}
|
}
|
||||||
total_sum += values[i];
|
total_sum += values[i];
|
||||||
}
|
}
|
||||||
concat(dest, C128Table[total_sum % 103]);
|
strcat(dest, C128Table[total_sum % 103]);
|
||||||
values[bar_characters] = total_sum % 103;
|
values[bar_characters] = total_sum % 103;
|
||||||
bar_characters++;
|
bar_characters++;
|
||||||
|
|
||||||
/* Stop character */
|
/* Stop character */
|
||||||
concat(dest, C128Table[106]);
|
strcat(dest, C128Table[106]);
|
||||||
values[bar_characters] = 106;
|
values[bar_characters] = 106;
|
||||||
bar_characters++;
|
bar_characters++;
|
||||||
expand(symbol, dest);
|
expand(symbol, dest);
|
||||||
|
@ -695,12 +695,12 @@ int code16k(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
for (current_row = 0; current_row < rows_needed; current_row++) {
|
for (current_row = 0; current_row < rows_needed; current_row++) {
|
||||||
|
|
||||||
strcpy(width_pattern, "");
|
strcpy(width_pattern, "");
|
||||||
concat(width_pattern, C16KStartStop[C16KStartValues[current_row]]);
|
strcat(width_pattern, C16KStartStop[C16KStartValues[current_row]]);
|
||||||
concat(width_pattern, "1");
|
strcat(width_pattern, "1");
|
||||||
for (i = 0; i < 5; i++) {
|
for (i = 0; i < 5; i++) {
|
||||||
concat(width_pattern, C16KTable[values[(current_row * 5) + i]]);
|
strcat(width_pattern, C16KTable[values[(current_row * 5) + i]]);
|
||||||
}
|
}
|
||||||
concat(width_pattern, C16KStartStop[C16KStopValues[current_row]]);
|
strcat(width_pattern, C16KStartStop[C16KStopValues[current_row]]);
|
||||||
|
|
||||||
/* Write the information into the symbol */
|
/* Write the information into the symbol */
|
||||||
writer = 0;
|
writer = 0;
|
||||||
|
@ -40,8 +40,8 @@
|
|||||||
|
|
||||||
/* "!" represents Shift 1 and "&" represents Shift 2, "*" represents FNC1 */
|
/* "!" represents Shift 1 and "&" represents Shift 2, "*" represents FNC1 */
|
||||||
|
|
||||||
int code_49(struct zint_symbol *symbol, unsigned char source[], int length) {
|
int code_49(struct zint_symbol *symbol, unsigned char source[], const int length) {
|
||||||
int i, j, rows, M, x_count, y_count, z_count, posn_val, local_value, h;
|
int i, j, rows, M, x_count, y_count, z_count, posn_val, local_value;
|
||||||
char intermediate[170] = "";
|
char intermediate[170] = "";
|
||||||
int codewords[170], codeword_count;
|
int codewords[170], codeword_count;
|
||||||
int c_grid[8][8]; /* Refers to table 3 */
|
int c_grid[8][8]; /* Refers to table 3 */
|
||||||
@ -49,6 +49,7 @@ int code_49(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
int pad_count = 0;
|
int pad_count = 0;
|
||||||
char pattern[40];
|
char pattern[40];
|
||||||
int gs1;
|
int gs1;
|
||||||
|
size_t h;
|
||||||
|
|
||||||
if (length > 81) {
|
if (length > 81) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long");
|
||||||
@ -67,9 +68,9 @@ int code_49(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
if (gs1 && (source[i] == '['))
|
if (gs1 && (source[i] == '['))
|
||||||
concat(intermediate, "*"); /* FNC1 */
|
strcat(intermediate, "*"); /* FNC1 */
|
||||||
else
|
else
|
||||||
concat(intermediate, c49_table7[source[i]]);
|
strcat(intermediate, c49_table7[source[i]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
codeword_count = 0;
|
codeword_count = 0;
|
||||||
@ -310,17 +311,17 @@ int code_49(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
if (i != (rows - 1)) {
|
if (i != (rows - 1)) {
|
||||||
if (c49_table4[i][j] == 'E') {
|
if (c49_table4[i][j] == 'E') {
|
||||||
/* Even Parity */
|
/* Even Parity */
|
||||||
concat(pattern, c49_appxe_even[w_grid[i][j]]);
|
strcat(pattern, c49_appxe_even[w_grid[i][j]]);
|
||||||
} else {
|
} else {
|
||||||
/* Odd Parity */
|
/* Odd Parity */
|
||||||
concat(pattern, c49_appxe_odd[w_grid[i][j]]);
|
strcat(pattern, c49_appxe_odd[w_grid[i][j]]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Last row uses all even parity */
|
/* Last row uses all even parity */
|
||||||
concat(pattern, c49_appxe_even[w_grid[i][j]]);
|
strcat(pattern, c49_appxe_even[w_grid[i][j]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
concat(pattern, "4"); /* Stop character */
|
strcat(pattern, "4"); /* Stop character */
|
||||||
|
|
||||||
/* Expand into symbol */
|
/* Expand into symbol */
|
||||||
symbol->row_height[i] = 10;
|
symbol->row_height[i] = 10;
|
||||||
|
@ -36,42 +36,13 @@
|
|||||||
|
|
||||||
/* Local replacement for strlen() with unsigned char strings */
|
/* Local replacement for strlen() with unsigned char strings */
|
||||||
int ustrlen(const unsigned char data[]) {
|
int ustrlen(const unsigned char data[]) {
|
||||||
int i;
|
return strlen((const char*) data);
|
||||||
for (i = 0; data[i]; i++);
|
|
||||||
|
|
||||||
return i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Local replacement for strcpy() with unsigned char strings */
|
/* Local replacement for strcpy() with unsigned char strings */
|
||||||
|
|
||||||
void ustrcpy(unsigned char target[], const unsigned char source[]) {
|
void ustrcpy(unsigned char target[], const unsigned char source[]) {
|
||||||
int i, len;
|
strcpy((char *) target, (const char*) source);
|
||||||
|
|
||||||
len = ustrlen(source);
|
|
||||||
for (i = 0; i < len; i++) {
|
|
||||||
target[i] = source[i];
|
|
||||||
}
|
|
||||||
target[i] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Concatinates dest[] with the contents of source[], copying /0 as well */
|
|
||||||
void concat(char dest[], const char source[]) {
|
|
||||||
size_t i, j, n;
|
|
||||||
|
|
||||||
j = strlen(dest);
|
|
||||||
n = strlen(source);
|
|
||||||
for (i = 0; i <= n; i++) {
|
|
||||||
dest[i + j] = source[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Concatinates dest[] with the contents of source[], copying /0 as well */
|
|
||||||
void uconcat(unsigned char dest[], const unsigned char source[]) {
|
|
||||||
unsigned int i, j;
|
|
||||||
|
|
||||||
j = ustrlen(dest);
|
|
||||||
for (i = 0; i <= ustrlen(source); i++) {
|
|
||||||
dest[i + j] = source[i];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Converts a character 0-9 to its equivalent integer value */
|
/* Converts a character 0-9 to its equivalent integer value */
|
||||||
@ -140,7 +111,7 @@ void lookup(char set_string[], const char *table[], const char data, char dest[]
|
|||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
if (data == set_string[i]) {
|
if (data == set_string[i]) {
|
||||||
concat(dest, table[i]);
|
strcat(dest, table[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -195,7 +166,7 @@ void expand(struct zint_symbol *symbol, char data[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Indicates which symbologies can have row binding */
|
/* Indicates which symbologies can have row binding */
|
||||||
int is_stackable(int symbology) {
|
int is_stackable(const int symbology) {
|
||||||
if (symbology < BARCODE_PDF417) {
|
if (symbology < BARCODE_PDF417) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -257,20 +228,6 @@ int is_extendable(const int symbology) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int roundup(const float input) {
|
|
||||||
float remainder;
|
|
||||||
int integer_part;
|
|
||||||
|
|
||||||
integer_part = (int) input;
|
|
||||||
remainder = input - integer_part;
|
|
||||||
|
|
||||||
if (remainder > 0.1F) {
|
|
||||||
integer_part++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return integer_part;
|
|
||||||
}
|
|
||||||
|
|
||||||
int istwodigits(const unsigned char source[], const int position) {
|
int istwodigits(const unsigned char source[], const int position) {
|
||||||
if ((source[position] >= '0') && (source[position] <= '9')) {
|
if ((source[position] >= '0') && (source[position] <= '9')) {
|
||||||
if ((source[position + 1] >= '0') && (source[position + 1] <= '9')) {
|
if ((source[position + 1] >= '0') && (source[position + 1] <= '9')) {
|
||||||
@ -281,19 +238,6 @@ int istwodigits(const unsigned char source[], const int position) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
double froundup(const double input) {
|
|
||||||
double fraction, output = 0.0;
|
|
||||||
|
|
||||||
fraction = input - (int) input;
|
|
||||||
if (fraction > 0.01) {
|
|
||||||
output = (input - fraction) + 1.0;
|
|
||||||
} else {
|
|
||||||
output = input;
|
|
||||||
}
|
|
||||||
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Convert Unicode to Latin-1 for those symbologies which only support Latin-1 */
|
/* Convert Unicode to Latin-1 for those symbologies which only support Latin-1 */
|
||||||
int latin1_process(struct zint_symbol *symbol, const unsigned char source[], unsigned char preprocessed[], int *length) {
|
int latin1_process(struct zint_symbol *symbol, const unsigned char source[], unsigned char preprocessed[], int *length) {
|
||||||
int j, i, next;
|
int j, i, next;
|
||||||
|
@ -53,8 +53,6 @@ extern "C" {
|
|||||||
|
|
||||||
extern int ustrlen(const unsigned char source[]);
|
extern int ustrlen(const unsigned char source[]);
|
||||||
extern void ustrcpy(unsigned char target[], const unsigned char source[]);
|
extern void ustrcpy(unsigned char target[], const unsigned char source[]);
|
||||||
extern void concat(char dest[], const char source[]);
|
|
||||||
extern void uconcat(unsigned char dest[], const unsigned char source[]);
|
|
||||||
extern int ctoi(const char source);
|
extern int ctoi(const char source);
|
||||||
extern char itoc(const int source);
|
extern char itoc(const int source);
|
||||||
extern void to_upper(unsigned char source[]);
|
extern void to_upper(unsigned char source[]);
|
||||||
|
@ -274,33 +274,33 @@ int cc_a(struct zint_symbol *symbol, char source[], int cc_width) {
|
|||||||
dummy[j + 1] = codeWords[i * cc_width + j];
|
dummy[j + 1] = codeWords[i * cc_width + j];
|
||||||
}
|
}
|
||||||
/* Copy the data into codebarre */
|
/* Copy the data into codebarre */
|
||||||
concat(codebarre, RAPLR[LeftRAP]);
|
strcat(codebarre, RAPLR[LeftRAP]);
|
||||||
concat(codebarre, "1");
|
strcat(codebarre, "1");
|
||||||
concat(codebarre, codagemc[offset + dummy[1]]);
|
strcat(codebarre, codagemc[offset + dummy[1]]);
|
||||||
concat(codebarre, "1");
|
strcat(codebarre, "1");
|
||||||
if (cc_width == 3) {
|
if (cc_width == 3) {
|
||||||
concat(codebarre, RAPC[CentreRAP]);
|
strcat(codebarre, RAPC[CentreRAP]);
|
||||||
}
|
}
|
||||||
if (cc_width >= 2) {
|
if (cc_width >= 2) {
|
||||||
concat(codebarre, "1");
|
strcat(codebarre, "1");
|
||||||
concat(codebarre, codagemc[offset + dummy[2]]);
|
strcat(codebarre, codagemc[offset + dummy[2]]);
|
||||||
concat(codebarre, "1");
|
strcat(codebarre, "1");
|
||||||
}
|
}
|
||||||
if (cc_width == 4) {
|
if (cc_width == 4) {
|
||||||
concat(codebarre, RAPC[CentreRAP]);
|
strcat(codebarre, RAPC[CentreRAP]);
|
||||||
}
|
}
|
||||||
if (cc_width >= 3) {
|
if (cc_width >= 3) {
|
||||||
concat(codebarre, "1");
|
strcat(codebarre, "1");
|
||||||
concat(codebarre, codagemc[offset + dummy[3]]);
|
strcat(codebarre, codagemc[offset + dummy[3]]);
|
||||||
concat(codebarre, "1");
|
strcat(codebarre, "1");
|
||||||
}
|
}
|
||||||
if (cc_width == 4) {
|
if (cc_width == 4) {
|
||||||
concat(codebarre, "1");
|
strcat(codebarre, "1");
|
||||||
concat(codebarre, codagemc[offset + dummy[4]]);
|
strcat(codebarre, codagemc[offset + dummy[4]]);
|
||||||
concat(codebarre, "1");
|
strcat(codebarre, "1");
|
||||||
}
|
}
|
||||||
concat(codebarre, RAPLR[RightRAP]);
|
strcat(codebarre, RAPLR[RightRAP]);
|
||||||
concat(codebarre, "1"); /* stop */
|
strcat(codebarre, "1"); /* stop */
|
||||||
|
|
||||||
/* Now codebarre is a mixture of letters and numbers */
|
/* Now codebarre is a mixture of letters and numbers */
|
||||||
|
|
||||||
@ -558,33 +558,33 @@ int cc_b(struct zint_symbol *symbol, char source[], int cc_width) {
|
|||||||
dummy[j + 1] = chainemc[i * symbol->option_2 + j];
|
dummy[j + 1] = chainemc[i * symbol->option_2 + j];
|
||||||
}
|
}
|
||||||
/* Copy the data into codebarre */
|
/* Copy the data into codebarre */
|
||||||
concat(codebarre, RAPLR[LeftRAP]);
|
strcat(codebarre, RAPLR[LeftRAP]);
|
||||||
concat(codebarre, "1");
|
strcat(codebarre, "1");
|
||||||
concat(codebarre, codagemc[offset + dummy[1]]);
|
strcat(codebarre, codagemc[offset + dummy[1]]);
|
||||||
concat(codebarre, "1");
|
strcat(codebarre, "1");
|
||||||
if (cc_width == 3) {
|
if (cc_width == 3) {
|
||||||
concat(codebarre, RAPC[CentreRAP]);
|
strcat(codebarre, RAPC[CentreRAP]);
|
||||||
}
|
}
|
||||||
if (cc_width >= 2) {
|
if (cc_width >= 2) {
|
||||||
concat(codebarre, "1");
|
strcat(codebarre, "1");
|
||||||
concat(codebarre, codagemc[offset + dummy[2]]);
|
strcat(codebarre, codagemc[offset + dummy[2]]);
|
||||||
concat(codebarre, "1");
|
strcat(codebarre, "1");
|
||||||
}
|
}
|
||||||
if (cc_width == 4) {
|
if (cc_width == 4) {
|
||||||
concat(codebarre, RAPC[CentreRAP]);
|
strcat(codebarre, RAPC[CentreRAP]);
|
||||||
}
|
}
|
||||||
if (cc_width >= 3) {
|
if (cc_width >= 3) {
|
||||||
concat(codebarre, "1");
|
strcat(codebarre, "1");
|
||||||
concat(codebarre, codagemc[offset + dummy[3]]);
|
strcat(codebarre, codagemc[offset + dummy[3]]);
|
||||||
concat(codebarre, "1");
|
strcat(codebarre, "1");
|
||||||
}
|
}
|
||||||
if (cc_width == 4) {
|
if (cc_width == 4) {
|
||||||
concat(codebarre, "1");
|
strcat(codebarre, "1");
|
||||||
concat(codebarre, codagemc[offset + dummy[4]]);
|
strcat(codebarre, codagemc[offset + dummy[4]]);
|
||||||
concat(codebarre, "1");
|
strcat(codebarre, "1");
|
||||||
}
|
}
|
||||||
concat(codebarre, RAPLR[RightRAP]);
|
strcat(codebarre, RAPLR[RightRAP]);
|
||||||
concat(codebarre, "1"); /* stop */
|
strcat(codebarre, "1"); /* stop */
|
||||||
|
|
||||||
/* Now codebarre is a mixture of letters and numbers */
|
/* Now codebarre is a mixture of letters and numbers */
|
||||||
|
|
||||||
@ -772,10 +772,10 @@ int cc_c(struct zint_symbol *symbol, char source[], int cc_width, int ecc_level)
|
|||||||
default: offset = 0; /* cluster(0) */
|
default: offset = 0; /* cluster(0) */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
concat(codebarre, codagemc[offset + dummy[j]]);
|
strcat(codebarre, codagemc[offset + dummy[j]]);
|
||||||
concat(codebarre, "*");
|
strcat(codebarre, "*");
|
||||||
}
|
}
|
||||||
concat(codebarre, "-");
|
strcat(codebarre, "-");
|
||||||
|
|
||||||
strcpy(pattern, "");
|
strcpy(pattern, "");
|
||||||
for (loop = 0; loop < (int) strlen(codebarre); loop++) {
|
for (loop = 0; loop < (int) strlen(codebarre); loop++) {
|
||||||
@ -829,17 +829,17 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (encoding_method == 1) {
|
if (encoding_method == 1) {
|
||||||
concat(binary_string, "0");
|
strcat(binary_string, "0");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (encoding_method == 2) {
|
if (encoding_method == 2) {
|
||||||
/* Encoding Method field "10" - date and lot number */
|
/* Encoding Method field "10" - date and lot number */
|
||||||
|
|
||||||
concat(binary_string, "10");
|
strcat(binary_string, "10");
|
||||||
|
|
||||||
if (source[1] == '0') {
|
if (source[1] == '0') {
|
||||||
/* No date data */
|
/* No date data */
|
||||||
concat(binary_string, "11");
|
strcat(binary_string, "11");
|
||||||
read_posn = 2;
|
read_posn = 2;
|
||||||
} else {
|
} else {
|
||||||
/* Production Date (11) or Expiration Date (17) */
|
/* Production Date (11) or Expiration Date (17) */
|
||||||
@ -859,19 +859,19 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
|||||||
mask = 0x8000;
|
mask = 0x8000;
|
||||||
for (j = 0; j < 16; j++) {
|
for (j = 0; j < 16; j++) {
|
||||||
if ((group_val & mask) == 0x00) {
|
if ((group_val & mask) == 0x00) {
|
||||||
concat(binary_string, "0");
|
strcat(binary_string, "0");
|
||||||
} else {
|
} else {
|
||||||
concat(binary_string, "1");
|
strcat(binary_string, "1");
|
||||||
}
|
}
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source[1] == '1') {
|
if (source[1] == '1') {
|
||||||
/* Production Date AI 11 */
|
/* Production Date AI 11 */
|
||||||
concat(binary_string, "0");
|
strcat(binary_string, "0");
|
||||||
} else {
|
} else {
|
||||||
/* Expiration Date AI 17 */
|
/* Expiration Date AI 17 */
|
||||||
concat(binary_string, "1");
|
strcat(binary_string, "1");
|
||||||
}
|
}
|
||||||
read_posn = 8;
|
read_posn = 8;
|
||||||
}
|
}
|
||||||
@ -967,7 +967,7 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
|||||||
|
|
||||||
if ((test1 != -1) && (test2 != 1) && (test3 == 0)) {
|
if ((test1 != -1) && (test2 != 1) && (test3 == 0)) {
|
||||||
/* Encodation method "11" can be used */
|
/* Encodation method "11" can be used */
|
||||||
concat(binary_string, "11");
|
strcat(binary_string, "11");
|
||||||
|
|
||||||
numeric -= test1;
|
numeric -= test1;
|
||||||
alpha--;
|
alpha--;
|
||||||
@ -977,16 +977,16 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
|||||||
|
|
||||||
if (alphanum > 0) {
|
if (alphanum > 0) {
|
||||||
/* Alphanumeric mode */
|
/* Alphanumeric mode */
|
||||||
concat(binary_string, "0");
|
strcat(binary_string, "0");
|
||||||
ai90_mode = 1;
|
ai90_mode = 1;
|
||||||
} else {
|
} else {
|
||||||
if (alpha > numeric) {
|
if (alpha > numeric) {
|
||||||
/* Alphabetic mode */
|
/* Alphabetic mode */
|
||||||
concat(binary_string, "11");
|
strcat(binary_string, "11");
|
||||||
ai90_mode = 2;
|
ai90_mode = 2;
|
||||||
} else {
|
} else {
|
||||||
/* Numeric mode */
|
/* Numeric mode */
|
||||||
concat(binary_string, "10");
|
strcat(binary_string, "10");
|
||||||
ai90_mode = 3;
|
ai90_mode = 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1007,11 +1007,11 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (ai_crop) {
|
switch (ai_crop) {
|
||||||
case 0: concat(binary_string, "0");
|
case 0: strcat(binary_string, "0");
|
||||||
break;
|
break;
|
||||||
case 1: concat(binary_string, "10");
|
case 1: strcat(binary_string, "10");
|
||||||
break;
|
break;
|
||||||
case 2: concat(binary_string, "11");
|
case 2: strcat(binary_string, "11");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1070,9 +1070,9 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
|||||||
mask = 0x10;
|
mask = 0x10;
|
||||||
for (j = 0; j < 5; j++) {
|
for (j = 0; j < 5; j++) {
|
||||||
if ((numeric_value & mask) == 0x00) {
|
if ((numeric_value & mask) == 0x00) {
|
||||||
concat(binary_string, "0");
|
strcat(binary_string, "0");
|
||||||
} else {
|
} else {
|
||||||
concat(binary_string, "1");
|
strcat(binary_string, "1");
|
||||||
}
|
}
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
@ -1081,22 +1081,22 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
|||||||
mask = 0x08;
|
mask = 0x08;
|
||||||
for (j = 0; j < 4; j++) {
|
for (j = 0; j < 4; j++) {
|
||||||
if ((table3_letter & mask) == 0x00) {
|
if ((table3_letter & mask) == 0x00) {
|
||||||
concat(binary_string, "0");
|
strcat(binary_string, "0");
|
||||||
} else {
|
} else {
|
||||||
concat(binary_string, "1");
|
strcat(binary_string, "1");
|
||||||
}
|
}
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Encoding is done according to 5.2.2 c) 3) */
|
/* Encoding is done according to 5.2.2 c) 3) */
|
||||||
concat(binary_string, "11111");
|
strcat(binary_string, "11111");
|
||||||
/* ten bit representation of number */
|
/* ten bit representation of number */
|
||||||
mask = 0x200;
|
mask = 0x200;
|
||||||
for (j = 0; j < 10; j++) {
|
for (j = 0; j < 10; j++) {
|
||||||
if ((numeric_value & mask) == 0x00) {
|
if ((numeric_value & mask) == 0x00) {
|
||||||
concat(binary_string, "0");
|
strcat(binary_string, "0");
|
||||||
} else {
|
} else {
|
||||||
concat(binary_string, "1");
|
strcat(binary_string, "1");
|
||||||
}
|
}
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
@ -1105,9 +1105,9 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
|||||||
mask = 0x10;
|
mask = 0x10;
|
||||||
for (j = 0; j < 5; j++) {
|
for (j = 0; j < 5; j++) {
|
||||||
if (((ninety[test1] - 65) & mask) == 0x00) {
|
if (((ninety[test1] - 65) & mask) == 0x00) {
|
||||||
concat(binary_string, "0");
|
strcat(binary_string, "0");
|
||||||
} else {
|
} else {
|
||||||
concat(binary_string, "1");
|
strcat(binary_string, "1");
|
||||||
}
|
}
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
@ -1116,7 +1116,7 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
|||||||
read_posn = test1 + 3;
|
read_posn = test1 + 3;
|
||||||
} else {
|
} else {
|
||||||
/* Use general field encodation instead */
|
/* Use general field encodation instead */
|
||||||
concat(binary_string, "0");
|
strcat(binary_string, "0");
|
||||||
read_posn = 0;
|
read_posn = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1129,9 +1129,9 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
|||||||
mask = 0x10;
|
mask = 0x10;
|
||||||
for (j = 0; j < 5; j++) {
|
for (j = 0; j < 5; j++) {
|
||||||
if (((source[read_posn] + 4) & mask) == 0x00) {
|
if (((source[read_posn] + 4) & mask) == 0x00) {
|
||||||
concat(binary_string, "0");
|
strcat(binary_string, "0");
|
||||||
} else {
|
} else {
|
||||||
concat(binary_string, "1");
|
strcat(binary_string, "1");
|
||||||
}
|
}
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
@ -1141,16 +1141,16 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
|||||||
mask = 0x20;
|
mask = 0x20;
|
||||||
for (j = 0; j < 6; j++) {
|
for (j = 0; j < 6; j++) {
|
||||||
if (((source[read_posn] - 65) & mask) == 0x00) {
|
if (((source[read_posn] - 65) & mask) == 0x00) {
|
||||||
concat(binary_string, "0");
|
strcat(binary_string, "0");
|
||||||
} else {
|
} else {
|
||||||
concat(binary_string, "1");
|
strcat(binary_string, "1");
|
||||||
}
|
}
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source[read_posn] == '[') {
|
if (source[read_posn] == '[') {
|
||||||
concat(binary_string, "11111");
|
strcat(binary_string, "11111");
|
||||||
}
|
}
|
||||||
|
|
||||||
read_posn++;
|
read_posn++;
|
||||||
@ -1165,9 +1165,9 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
|||||||
mask = 0x10;
|
mask = 0x10;
|
||||||
for (j = 0; j < 5; j++) {
|
for (j = 0; j < 5; j++) {
|
||||||
if (((source[read_posn] - 43) & mask) == 0x00) {
|
if (((source[read_posn] - 43) & mask) == 0x00) {
|
||||||
concat(binary_string, "0");
|
strcat(binary_string, "0");
|
||||||
} else {
|
} else {
|
||||||
concat(binary_string, "1");
|
strcat(binary_string, "1");
|
||||||
}
|
}
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
@ -1177,26 +1177,26 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
|||||||
mask = 0x20;
|
mask = 0x20;
|
||||||
for (j = 0; j < 6; j++) {
|
for (j = 0; j < 6; j++) {
|
||||||
if (((source[read_posn] - 33) & mask) == 0x00) {
|
if (((source[read_posn] - 33) & mask) == 0x00) {
|
||||||
concat(binary_string, "0");
|
strcat(binary_string, "0");
|
||||||
} else {
|
} else {
|
||||||
concat(binary_string, "1");
|
strcat(binary_string, "1");
|
||||||
}
|
}
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (source[read_posn]) {
|
switch (source[read_posn]) {
|
||||||
case '[': concat(binary_string, "01111");
|
case '[': strcat(binary_string, "01111");
|
||||||
break;
|
break;
|
||||||
case '*': concat(binary_string, "111010");
|
case '*': strcat(binary_string, "111010");
|
||||||
break;
|
break;
|
||||||
case ',': concat(binary_string, "111011");
|
case ',': strcat(binary_string, "111011");
|
||||||
break;
|
break;
|
||||||
case '-': concat(binary_string, "111100");
|
case '-': strcat(binary_string, "111100");
|
||||||
break;
|
break;
|
||||||
case '.': concat(binary_string, "111101");
|
case '.': strcat(binary_string, "111101");
|
||||||
break;
|
break;
|
||||||
case '/': concat(binary_string, "111110");
|
case '/': strcat(binary_string, "111110");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1322,7 +1322,7 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
|||||||
|
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
if ((general_field_type[i - 1] != NUMERIC) && (general_field[i - 1] != '[')) {
|
if ((general_field_type[i - 1] != NUMERIC) && (general_field[i - 1] != '[')) {
|
||||||
concat(binary_string, "000"); /* Numeric latch */
|
strcat(binary_string, "000"); /* Numeric latch */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1343,9 +1343,9 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
|||||||
mask = 0x40;
|
mask = 0x40;
|
||||||
for (j = 0; j < 7; j++) {
|
for (j = 0; j < 7; j++) {
|
||||||
if ((value & mask) == 0x00) {
|
if ((value & mask) == 0x00) {
|
||||||
concat(binary_string, "0");
|
strcat(binary_string, "0");
|
||||||
} else {
|
} else {
|
||||||
concat(binary_string, "1");
|
strcat(binary_string, "1");
|
||||||
}
|
}
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
@ -1357,10 +1357,10 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
|||||||
|
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
if ((general_field_type[i - 1] == NUMERIC) || (general_field[i - 1] == '[')) {
|
if ((general_field_type[i - 1] == NUMERIC) || (general_field[i - 1] == '[')) {
|
||||||
concat(binary_string, "0000"); /* Alphanumeric latch */
|
strcat(binary_string, "0000"); /* Alphanumeric latch */
|
||||||
}
|
}
|
||||||
if (general_field_type[i - 1] == ISOIEC) {
|
if (general_field_type[i - 1] == ISOIEC) {
|
||||||
concat(binary_string, "00100"); /* ISO/IEC 646 latch */
|
strcat(binary_string, "00100"); /* ISO/IEC 646 latch */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1371,9 +1371,9 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
|||||||
mask = 0x10;
|
mask = 0x10;
|
||||||
for (j = 0; j < 5; j++) {
|
for (j = 0; j < 5; j++) {
|
||||||
if ((value & mask) == 0x00) {
|
if ((value & mask) == 0x00) {
|
||||||
concat(binary_string, "0");
|
strcat(binary_string, "0");
|
||||||
} else {
|
} else {
|
||||||
concat(binary_string, "1");
|
strcat(binary_string, "1");
|
||||||
}
|
}
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
@ -1386,20 +1386,20 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
|||||||
mask = 0x20;
|
mask = 0x20;
|
||||||
for (j = 0; j < 6; j++) {
|
for (j = 0; j < 6; j++) {
|
||||||
if ((value & mask) == 0x00) {
|
if ((value & mask) == 0x00) {
|
||||||
concat(binary_string, "0");
|
strcat(binary_string, "0");
|
||||||
} else {
|
} else {
|
||||||
concat(binary_string, "1");
|
strcat(binary_string, "1");
|
||||||
}
|
}
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (general_field[i] == '[') concat(binary_string, "01111"); /* FNC1/Numeric latch */
|
if (general_field[i] == '[') strcat(binary_string, "01111"); /* FNC1/Numeric latch */
|
||||||
if (general_field[i] == '*') concat(binary_string, "111010"); /* asterisk */
|
if (general_field[i] == '*') strcat(binary_string, "111010"); /* asterisk */
|
||||||
if (general_field[i] == ',') concat(binary_string, "111011"); /* comma */
|
if (general_field[i] == ',') strcat(binary_string, "111011"); /* comma */
|
||||||
if (general_field[i] == '-') concat(binary_string, "111100"); /* minus or hyphen */
|
if (general_field[i] == '-') strcat(binary_string, "111100"); /* minus or hyphen */
|
||||||
if (general_field[i] == '.') concat(binary_string, "111101"); /* period or full stop */
|
if (general_field[i] == '.') strcat(binary_string, "111101"); /* period or full stop */
|
||||||
if (general_field[i] == '/') concat(binary_string, "111110"); /* slash or solidus */
|
if (general_field[i] == '/') strcat(binary_string, "111110"); /* slash or solidus */
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
break;
|
break;
|
||||||
@ -1408,11 +1408,11 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
|||||||
|
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
if ((general_field_type[i - 1] == NUMERIC) || (general_field[i - 1] == '[')) {
|
if ((general_field_type[i - 1] == NUMERIC) || (general_field[i - 1] == '[')) {
|
||||||
concat(binary_string, "0000"); /* Alphanumeric latch */
|
strcat(binary_string, "0000"); /* Alphanumeric latch */
|
||||||
concat(binary_string, "00100"); /* ISO/IEC 646 latch */
|
strcat(binary_string, "00100"); /* ISO/IEC 646 latch */
|
||||||
}
|
}
|
||||||
if (general_field_type[i - 1] == ALPHA) {
|
if (general_field_type[i - 1] == ALPHA) {
|
||||||
concat(binary_string, "00100"); /* ISO/IEC 646 latch */
|
strcat(binary_string, "00100"); /* ISO/IEC 646 latch */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1423,9 +1423,9 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
|||||||
mask = 0x10;
|
mask = 0x10;
|
||||||
for (j = 0; j < 5; j++) {
|
for (j = 0; j < 5; j++) {
|
||||||
if ((value & mask) == 0x00) {
|
if ((value & mask) == 0x00) {
|
||||||
concat(binary_string, "0");
|
strcat(binary_string, "0");
|
||||||
} else {
|
} else {
|
||||||
concat(binary_string, "1");
|
strcat(binary_string, "1");
|
||||||
}
|
}
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
@ -1438,9 +1438,9 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
|||||||
mask = 0x40;
|
mask = 0x40;
|
||||||
for (j = 0; j < 7; j++) {
|
for (j = 0; j < 7; j++) {
|
||||||
if ((value & mask) == 0x00) {
|
if ((value & mask) == 0x00) {
|
||||||
concat(binary_string, "0");
|
strcat(binary_string, "0");
|
||||||
} else {
|
} else {
|
||||||
concat(binary_string, "1");
|
strcat(binary_string, "1");
|
||||||
}
|
}
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
@ -1453,36 +1453,36 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
|||||||
mask = 0x40;
|
mask = 0x40;
|
||||||
for (j = 0; j < 7; j++) {
|
for (j = 0; j < 7; j++) {
|
||||||
if ((value & mask) == 0x00) {
|
if ((value & mask) == 0x00) {
|
||||||
concat(binary_string, "0");
|
strcat(binary_string, "0");
|
||||||
} else {
|
} else {
|
||||||
concat(binary_string, "1");
|
strcat(binary_string, "1");
|
||||||
}
|
}
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (general_field[i] == '[') concat(binary_string, "01111"); /* FNC1/Numeric latch */
|
if (general_field[i] == '[') strcat(binary_string, "01111"); /* FNC1/Numeric latch */
|
||||||
if (general_field[i] == '!') concat(binary_string, "11101000"); /* exclamation mark */
|
if (general_field[i] == '!') strcat(binary_string, "11101000"); /* exclamation mark */
|
||||||
if (general_field[i] == 34) concat(binary_string, "11101001"); /* quotation mark */
|
if (general_field[i] == 34) strcat(binary_string, "11101001"); /* quotation mark */
|
||||||
if (general_field[i] == 37) concat(binary_string, "11101010"); /* percent sign */
|
if (general_field[i] == 37) strcat(binary_string, "11101010"); /* percent sign */
|
||||||
if (general_field[i] == '&') concat(binary_string, "11101011"); /* ampersand */
|
if (general_field[i] == '&') strcat(binary_string, "11101011"); /* ampersand */
|
||||||
if (general_field[i] == 39) concat(binary_string, "11101100"); /* apostrophe */
|
if (general_field[i] == 39) strcat(binary_string, "11101100"); /* apostrophe */
|
||||||
if (general_field[i] == '(') concat(binary_string, "11101101"); /* left parenthesis */
|
if (general_field[i] == '(') strcat(binary_string, "11101101"); /* left parenthesis */
|
||||||
if (general_field[i] == ')') concat(binary_string, "11101110"); /* right parenthesis */
|
if (general_field[i] == ')') strcat(binary_string, "11101110"); /* right parenthesis */
|
||||||
if (general_field[i] == '*') concat(binary_string, "11101111"); /* asterisk */
|
if (general_field[i] == '*') strcat(binary_string, "11101111"); /* asterisk */
|
||||||
if (general_field[i] == '+') concat(binary_string, "11110000"); /* plus sign */
|
if (general_field[i] == '+') strcat(binary_string, "11110000"); /* plus sign */
|
||||||
if (general_field[i] == ',') concat(binary_string, "11110001"); /* comma */
|
if (general_field[i] == ',') strcat(binary_string, "11110001"); /* comma */
|
||||||
if (general_field[i] == '-') concat(binary_string, "11110010"); /* minus or hyphen */
|
if (general_field[i] == '-') strcat(binary_string, "11110010"); /* minus or hyphen */
|
||||||
if (general_field[i] == '.') concat(binary_string, "11110011"); /* period or full stop */
|
if (general_field[i] == '.') strcat(binary_string, "11110011"); /* period or full stop */
|
||||||
if (general_field[i] == '/') concat(binary_string, "11110100"); /* slash or solidus */
|
if (general_field[i] == '/') strcat(binary_string, "11110100"); /* slash or solidus */
|
||||||
if (general_field[i] == ':') concat(binary_string, "11110101"); /* colon */
|
if (general_field[i] == ':') strcat(binary_string, "11110101"); /* colon */
|
||||||
if (general_field[i] == ';') concat(binary_string, "11110110"); /* semicolon */
|
if (general_field[i] == ';') strcat(binary_string, "11110110"); /* semicolon */
|
||||||
if (general_field[i] == '<') concat(binary_string, "11110111"); /* less-than sign */
|
if (general_field[i] == '<') strcat(binary_string, "11110111"); /* less-than sign */
|
||||||
if (general_field[i] == '=') concat(binary_string, "11111000"); /* equals sign */
|
if (general_field[i] == '=') strcat(binary_string, "11111000"); /* equals sign */
|
||||||
if (general_field[i] == '>') concat(binary_string, "11111001"); /* greater-than sign */
|
if (general_field[i] == '>') strcat(binary_string, "11111001"); /* greater-than sign */
|
||||||
if (general_field[i] == '?') concat(binary_string, "11111010"); /* question mark */
|
if (general_field[i] == '?') strcat(binary_string, "11111010"); /* question mark */
|
||||||
if (general_field[i] == '_') concat(binary_string, "11111011"); /* underline or low line */
|
if (general_field[i] == '_') strcat(binary_string, "11111011"); /* underline or low line */
|
||||||
if (general_field[i] == ' ') concat(binary_string, "11111100"); /* space */
|
if (general_field[i] == ' ') strcat(binary_string, "11111100"); /* space */
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
break;
|
break;
|
||||||
@ -1744,9 +1744,9 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
|||||||
mask = 0x08;
|
mask = 0x08;
|
||||||
for (j = 0; j < 4; j++) {
|
for (j = 0; j < 4; j++) {
|
||||||
if ((value & mask) == 0x00) {
|
if ((value & mask) == 0x00) {
|
||||||
concat(binary_string, "0");
|
strcat(binary_string, "0");
|
||||||
} else {
|
} else {
|
||||||
concat(binary_string, "1");
|
strcat(binary_string, "1");
|
||||||
}
|
}
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
@ -1759,9 +1759,9 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
|||||||
mask = 0x40;
|
mask = 0x40;
|
||||||
for (j = 0; j < 7; j++) {
|
for (j = 0; j < 7; j++) {
|
||||||
if ((value & mask) == 0x00) {
|
if ((value & mask) == 0x00) {
|
||||||
concat(binary_string, "0");
|
strcat(binary_string, "0");
|
||||||
} else {
|
} else {
|
||||||
concat(binary_string, "1");
|
strcat(binary_string, "1");
|
||||||
}
|
}
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
@ -2022,17 +2022,17 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
|||||||
if (binary_length < target_bitsize) {
|
if (binary_length < target_bitsize) {
|
||||||
/* Now add padding to binary string */
|
/* Now add padding to binary string */
|
||||||
if (alpha_pad == 1) {
|
if (alpha_pad == 1) {
|
||||||
concat(binary_string, "11111");
|
strcat(binary_string, "11111");
|
||||||
alpha_pad = 0;
|
alpha_pad = 0;
|
||||||
/* Extra FNC1 character required after Alpha encodation (section 5.2.3) */
|
/* Extra FNC1 character required after Alpha encodation (section 5.2.3) */
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((strlen(general_field) != 0) && (general_field_type[strlen(general_field) - 1] == NUMERIC)) {
|
if ((strlen(general_field) != 0) && (general_field_type[strlen(general_field) - 1] == NUMERIC)) {
|
||||||
concat(binary_string, "0000");
|
strcat(binary_string, "0000");
|
||||||
}
|
}
|
||||||
|
|
||||||
while (strlen(binary_string) < (unsigned int) target_bitsize) {
|
while (strlen(binary_string) < (unsigned int) target_bitsize) {
|
||||||
concat(binary_string, "00100");
|
strcat(binary_string, "00100");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen(binary_string) > (unsigned int) target_bitsize) {
|
if (strlen(binary_string) > (unsigned int) target_bitsize) {
|
||||||
@ -2170,7 +2170,7 @@ int composite(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
|
|
||||||
if (error_number != 0) {
|
if (error_number != 0) {
|
||||||
strcpy(symbol->errtxt, linear->errtxt);
|
strcpy(symbol->errtxt, linear->errtxt);
|
||||||
concat(symbol->errtxt, " in linear component");
|
strcat(symbol->errtxt, " in linear component");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
53
backend/dmatrix.c
Executable file → Normal file
53
backend/dmatrix.c
Executable file → Normal file
@ -258,10 +258,10 @@ static void insert_value(unsigned char binary_stream[], const int posn, const in
|
|||||||
for (i = streamlen; i > posn; i--) {
|
for (i = streamlen; i > posn; i--) {
|
||||||
binary_stream[i] = binary_stream[i - 1];
|
binary_stream[i] = binary_stream[i - 1];
|
||||||
}
|
}
|
||||||
binary_stream[posn] = newbit;
|
binary_stream[posn] = (unsigned char) newbit;
|
||||||
}
|
}
|
||||||
|
|
||||||
int p_r_6_2_1(const unsigned char inputData[], int position, const int sourcelen) {
|
static int p_r_6_2_1(const unsigned char inputData[], const int position, const int sourcelen) {
|
||||||
/* Annex P section (r)(6)(ii)(I)
|
/* Annex P section (r)(6)(ii)(I)
|
||||||
"If one of the three X12 terminator/separator characters first
|
"If one of the three X12 terminator/separator characters first
|
||||||
occurs in the yet to be processed data before a non-X12 character..."
|
occurs in the yet to be processed data before a non-X12 character..."
|
||||||
@ -522,8 +522,7 @@ static int look_ahead_test(const unsigned char inputData[], const int sourcelen,
|
|||||||
|
|
||||||
/* Encodes data using ASCII, C40, Text, X12, EDIFACT or Base 256 modes as appropriate
|
/* Encodes data using ASCII, C40, Text, X12, EDIFACT or Base 256 modes as appropriate
|
||||||
Supports encoding FNC1 in supporting systems */
|
Supports encoding FNC1 in supporting systems */
|
||||||
int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned char target[], int *last_mode, int *length_p, int process_buffer[], int *process_p) {
|
static int dm200encode(struct zint_symbol *symbol, const unsigned char source[], unsigned char target[], int *last_mode, int *length_p, int process_buffer[], int *process_p) {
|
||||||
|
|
||||||
|
|
||||||
int sp, tp, i, gs1;
|
int sp, tp, i, gs1;
|
||||||
int current_mode, next_mode;
|
int current_mode, next_mode;
|
||||||
@ -554,7 +553,7 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
|||||||
if (gs1) {
|
if (gs1) {
|
||||||
target[tp] = 232;
|
target[tp] = 232;
|
||||||
tp++;
|
tp++;
|
||||||
concat(binary, " ");
|
strcat(binary, " ");
|
||||||
if (debug) printf("FN1 ");
|
if (debug) printf("FN1 ");
|
||||||
} /* FNC1 */
|
} /* FNC1 */
|
||||||
|
|
||||||
@ -565,7 +564,7 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
|||||||
} else {
|
} else {
|
||||||
target[tp] = 234;
|
target[tp] = 234;
|
||||||
tp++; /* Reader Programming */
|
tp++; /* Reader Programming */
|
||||||
concat(binary, " ");
|
strcat(binary, " ");
|
||||||
if (debug) printf("RP ");
|
if (debug) printf("RP ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -588,7 +587,7 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
|||||||
if (debug) printf("Macro06 ");
|
if (debug) printf("Macro06 ");
|
||||||
}
|
}
|
||||||
tp++;
|
tp++;
|
||||||
concat(binary, " ");
|
strcat(binary, " ");
|
||||||
/* Remove macro characters from input string */
|
/* Remove macro characters from input string */
|
||||||
sp = 7;
|
sp = 7;
|
||||||
inputlen -= 2;
|
inputlen -= 2;
|
||||||
@ -605,10 +604,10 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
|||||||
next_mode = DM_ASCII;
|
next_mode = DM_ASCII;
|
||||||
|
|
||||||
if (istwodigits(source, sp) && ((sp + 1) != inputlen)) {
|
if (istwodigits(source, sp) && ((sp + 1) != inputlen)) {
|
||||||
target[tp] = (10 * ctoi(source[sp])) + ctoi(source[sp + 1]) + 130;
|
target[tp] = (unsigned char) ((10 * ctoi(source[sp])) + ctoi(source[sp + 1]) + 130);
|
||||||
if (debug) printf("N%d ", target[tp] - 130);
|
if (debug) printf("N%d ", target[tp] - 130);
|
||||||
tp++;
|
tp++;
|
||||||
concat(binary, " ");
|
strcat(binary, " ");
|
||||||
sp += 2;
|
sp += 2;
|
||||||
} else {
|
} else {
|
||||||
next_mode = look_ahead_test(source, inputlen, sp, current_mode, gs1);
|
next_mode = look_ahead_test(source, inputlen, sp, current_mode, gs1);
|
||||||
@ -617,27 +616,27 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
|||||||
switch (next_mode) {
|
switch (next_mode) {
|
||||||
case DM_C40: target[tp] = 230;
|
case DM_C40: target[tp] = 230;
|
||||||
tp++;
|
tp++;
|
||||||
concat(binary, " ");
|
strcat(binary, " ");
|
||||||
if (debug) printf("C40 ");
|
if (debug) printf("C40 ");
|
||||||
break;
|
break;
|
||||||
case DM_TEXT: target[tp] = 239;
|
case DM_TEXT: target[tp] = 239;
|
||||||
tp++;
|
tp++;
|
||||||
concat(binary, " ");
|
strcat(binary, " ");
|
||||||
if (debug) printf("TEX ");
|
if (debug) printf("TEX ");
|
||||||
break;
|
break;
|
||||||
case DM_X12: target[tp] = 238;
|
case DM_X12: target[tp] = 238;
|
||||||
tp++;
|
tp++;
|
||||||
concat(binary, " ");
|
strcat(binary, " ");
|
||||||
if (debug) printf("X12 ");
|
if (debug) printf("X12 ");
|
||||||
break;
|
break;
|
||||||
case DM_EDIFACT: target[tp] = 240;
|
case DM_EDIFACT: target[tp] = 240;
|
||||||
tp++;
|
tp++;
|
||||||
concat(binary, " ");
|
strcat(binary, " ");
|
||||||
if (debug) printf("EDI ");
|
if (debug) printf("EDI ");
|
||||||
break;
|
break;
|
||||||
case DM_BASE256: target[tp] = 231;
|
case DM_BASE256: target[tp] = 231;
|
||||||
tp++;
|
tp++;
|
||||||
concat(binary, " ");
|
strcat(binary, " ");
|
||||||
if (debug) printf("BAS ");
|
if (debug) printf("BAS ");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -649,7 +648,7 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
|||||||
target[tp] = (source[sp] - 128) + 1;
|
target[tp] = (source[sp] - 128) + 1;
|
||||||
if (debug) printf("A%02X ", target[tp] - 1);
|
if (debug) printf("A%02X ", target[tp] - 1);
|
||||||
tp++;
|
tp++;
|
||||||
concat(binary, " ");
|
strcat(binary, " ");
|
||||||
} else {
|
} else {
|
||||||
if (gs1 && (source[sp] == '[')) {
|
if (gs1 && (source[sp] == '[')) {
|
||||||
target[tp] = 232; /* FNC1 */
|
target[tp] = 232; /* FNC1 */
|
||||||
@ -659,7 +658,7 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
|||||||
if (debug) printf("A%02X ", target[tp] - 1);
|
if (debug) printf("A%02X ", target[tp] - 1);
|
||||||
}
|
}
|
||||||
tp++;
|
tp++;
|
||||||
concat(binary, " ");
|
strcat(binary, " ");
|
||||||
}
|
}
|
||||||
sp++;
|
sp++;
|
||||||
}
|
}
|
||||||
@ -679,7 +678,7 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
|||||||
if (next_mode != DM_C40) {
|
if (next_mode != DM_C40) {
|
||||||
target[tp] = 254;
|
target[tp] = 254;
|
||||||
tp++;
|
tp++;
|
||||||
concat(binary, " "); /* Unlatch */
|
strcat(binary, " "); /* Unlatch */
|
||||||
next_mode = DM_ASCII;
|
next_mode = DM_ASCII;
|
||||||
if (debug) printf("ASC ");
|
if (debug) printf("ASC ");
|
||||||
} else {
|
} else {
|
||||||
@ -715,7 +714,7 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
|||||||
tp++;
|
tp++;
|
||||||
target[tp] = iv % 256;
|
target[tp] = iv % 256;
|
||||||
tp++;
|
tp++;
|
||||||
concat(binary, " ");
|
strcat(binary, " ");
|
||||||
if (debug) printf("[%d %d %d] ", process_buffer[0], process_buffer[1], process_buffer[2]);
|
if (debug) printf("[%d %d %d] ", process_buffer[0], process_buffer[1], process_buffer[2]);
|
||||||
|
|
||||||
process_buffer[0] = process_buffer[3];
|
process_buffer[0] = process_buffer[3];
|
||||||
@ -742,7 +741,7 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
|||||||
if (next_mode != DM_TEXT) {
|
if (next_mode != DM_TEXT) {
|
||||||
target[tp] = 254;
|
target[tp] = 254;
|
||||||
tp++;
|
tp++;
|
||||||
concat(binary, " "); /* Unlatch */
|
strcat(binary, " "); /* Unlatch */
|
||||||
next_mode = DM_ASCII;
|
next_mode = DM_ASCII;
|
||||||
if (debug) printf("ASC ");
|
if (debug) printf("ASC ");
|
||||||
} else {
|
} else {
|
||||||
@ -778,7 +777,7 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
|||||||
tp++;
|
tp++;
|
||||||
target[tp] = iv % 256;
|
target[tp] = iv % 256;
|
||||||
tp++;
|
tp++;
|
||||||
concat(binary, " ");
|
strcat(binary, " ");
|
||||||
if (debug) printf("[%d %d %d] ", process_buffer[0], process_buffer[1], process_buffer[2]);
|
if (debug) printf("[%d %d %d] ", process_buffer[0], process_buffer[1], process_buffer[2]);
|
||||||
|
|
||||||
process_buffer[0] = process_buffer[3];
|
process_buffer[0] = process_buffer[3];
|
||||||
@ -805,7 +804,7 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
|||||||
if (next_mode != DM_X12) {
|
if (next_mode != DM_X12) {
|
||||||
target[tp] = 254;
|
target[tp] = 254;
|
||||||
tp++;
|
tp++;
|
||||||
concat(binary, " "); /* Unlatch */
|
strcat(binary, " "); /* Unlatch */
|
||||||
next_mode = DM_ASCII;
|
next_mode = DM_ASCII;
|
||||||
if (debug) printf("ASC ");
|
if (debug) printf("ASC ");
|
||||||
} else {
|
} else {
|
||||||
@ -839,7 +838,7 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
|||||||
tp++;
|
tp++;
|
||||||
target[tp] = iv % 256;
|
target[tp] = iv % 256;
|
||||||
tp++;
|
tp++;
|
||||||
concat(binary, " ");
|
strcat(binary, " ");
|
||||||
if (debug) printf("[%d %d %d] ", process_buffer[0], process_buffer[1], process_buffer[2]);
|
if (debug) printf("[%d %d %d] ", process_buffer[0], process_buffer[1], process_buffer[2]);
|
||||||
|
|
||||||
process_buffer[0] = process_buffer[3];
|
process_buffer[0] = process_buffer[3];
|
||||||
@ -888,7 +887,7 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
|||||||
tp++;
|
tp++;
|
||||||
target[tp] = ((process_buffer[2] & 0x03) << 6) + process_buffer[3];
|
target[tp] = ((process_buffer[2] & 0x03) << 6) + process_buffer[3];
|
||||||
tp++;
|
tp++;
|
||||||
concat(binary, " ");
|
strcat(binary, " ");
|
||||||
if (debug) printf("[%d %d %d %d] ", process_buffer[0], process_buffer[1], process_buffer[2], process_buffer[3]);
|
if (debug) printf("[%d %d %d %d] ", process_buffer[0], process_buffer[1], process_buffer[2], process_buffer[3]);
|
||||||
|
|
||||||
process_buffer[0] = process_buffer[4];
|
process_buffer[0] = process_buffer[4];
|
||||||
@ -912,7 +911,7 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
|||||||
if (debug) printf("B%02X ", target[tp]);
|
if (debug) printf("B%02X ", target[tp]);
|
||||||
tp++;
|
tp++;
|
||||||
sp++;
|
sp++;
|
||||||
concat(binary, "b");
|
strcat(binary, "b");
|
||||||
} else {
|
} else {
|
||||||
next_mode = DM_ASCII;
|
next_mode = DM_ASCII;
|
||||||
if (debug) printf("ASC ");
|
if (debug) printf("ASC ");
|
||||||
@ -970,7 +969,7 @@ int dm200encode(struct zint_symbol *symbol, unsigned char source[], unsigned cha
|
|||||||
return tp;
|
return tp;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dm200encode_remainder(unsigned char target[], int target_length, unsigned char source[], int inputlen, int last_mode, int process_buffer[], int process_p, int symbols_left) {
|
static int dm200encode_remainder(unsigned char target[], int target_length, const unsigned char source[], const int inputlen, const int last_mode, const int process_buffer[], const int process_p, const int symbols_left) {
|
||||||
int debug = 0;
|
int debug = 0;
|
||||||
|
|
||||||
switch (last_mode) {
|
switch (last_mode) {
|
||||||
@ -1120,7 +1119,7 @@ int dm200encode_remainder(unsigned char target[], int target_length, unsigned ch
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* add pad bits */
|
/* add pad bits */
|
||||||
void add_tail(unsigned char target[], int tp, int tail_length) {
|
static void add_tail(unsigned char target[], int tp, const int tail_length) {
|
||||||
int i, prn, temp;
|
int i, prn, temp;
|
||||||
|
|
||||||
for (i = tail_length; i > 0; i--) {
|
for (i = tail_length; i > 0; i--) {
|
||||||
@ -1141,7 +1140,7 @@ void add_tail(unsigned char target[], int tp, int tail_length) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int data_matrix_200(struct zint_symbol *symbol, unsigned char source[], int length) {
|
int data_matrix_200(struct zint_symbol *symbol, unsigned char source[], const int length) {
|
||||||
int inputlen, i, skew = 0;
|
int inputlen, i, skew = 0;
|
||||||
unsigned char binary[2200];
|
unsigned char binary[2200];
|
||||||
int binlen;
|
int binlen;
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
extern int data_matrix_200(struct zint_symbol *symbol, unsigned char source[], int length);
|
extern int data_matrix_200(struct zint_symbol *symbol, unsigned char source[], const int length);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
@ -105,45 +105,45 @@ static const int intsymbol[] = {
|
|||||||
26, /* 41: 26x48 , 90*/ 29, /* 42: 26x64 ,118*/
|
26, /* 41: 26x48 , 90*/ 29, /* 42: 26x64 ,118*/
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
// Number of DM Sizes
|
// Number of DM Sizes
|
||||||
#define DMSIZESCOUNT 42
|
#define DMSIZESCOUNT 42
|
||||||
// Number of 144x144 for special interlace
|
// Number of 144x144 for special interlace
|
||||||
#define INTSYMBOL144 41
|
#define INTSYMBOL144 41
|
||||||
|
|
||||||
// Is the current code a DMRE code ?
|
// Is the current code a DMRE code ?
|
||||||
// This is the case, if intsymbol index >= 30
|
// This is the case, if intsymbol index >= 30
|
||||||
|
|
||||||
static const int isDMRE[] = {
|
static const int isDMRE[] = {
|
||||||
/*0*/ 0, /* 10x10 ,3 */ 0, /* 12x12 ,5 */ 0, /* 8x18 ,5 */ 0, /* 14x14 , 8 */
|
/*0*/ 0, /* 10x10 ,3 */ 0, /* 12x12 ,5 */ 0, /* 8x18 ,5 */ 0, /* 14x14 , 8 */
|
||||||
/*4*/ 0, /* 8x32 ,10 */ 0, /* 16x16 ,12 */ 0, /* 12x26 ,16 */ 0, /* 18x18 ,18 */
|
/*4*/ 0, /* 8x32 ,10 */ 0, /* 16x16 ,12 */ 0, /* 12x26 ,16 */ 0, /* 18x18 ,18 */
|
||||||
/*8*/ 1, /* 8x48 ,18 */ 0, /* 20x20 ,22 */ 0, /* 12x36 ,22 */ 1, /* 8x64 ,24 */
|
/*8*/ 1, /* 8x48 ,18 */ 0, /* 20x20 ,22 */ 0, /* 12x36 ,22 */ 1, /* 8x64 ,24 */
|
||||||
/*12*/ 0, /* 22x22 ,30 */ 0, /* 16x36 ,32 */ 0, /* 24x24 ,36 */ 1, /* 12x64 ,43 */
|
/*12*/ 0, /* 22x22 ,30 */ 0, /* 16x36 ,32 */ 0, /* 24x24 ,36 */ 1, /* 12x64 ,43 */
|
||||||
/*16*/ 0, /* 26x26 ,44 */ 0, /* 16x48 ,49 */ 1, /* 24x32 ,49 */ 1, /* 26x32 ,52 */
|
/*16*/ 0, /* 26x26 ,44 */ 0, /* 16x48 ,49 */ 1, /* 24x32 ,49 */ 1, /* 26x32 ,52 */
|
||||||
/*20*/ 1, /* 24x36 ,55 */ 0, /* 32x32 ,62 */ 1, /* 16x64 ,62 */ 1, /* 26x40 ,70 */
|
/*20*/ 1, /* 24x36 ,55 */ 0, /* 32x32 ,62 */ 1, /* 16x64 ,62 */ 1, /* 26x40 ,70 */
|
||||||
/*24*/ 1, /* 24x48 ,80 */ 0, /* 36x36 ,86 */ 1, /* 26x48 ,90 */ 1, /* 24x64 ,108*/
|
/*24*/ 1, /* 24x48 ,80 */ 0, /* 36x36 ,86 */ 1, /* 26x48 ,90 */ 1, /* 24x64 ,108*/
|
||||||
/*28*/ 0, /* 40x40 ,114*/ 1, /* 26x64 ,118*/ 0, /* 44x44 ,144*/ 0, /* 48x48,174 */
|
/*28*/ 0, /* 40x40 ,114*/ 1, /* 26x64 ,118*/ 0, /* 44x44 ,144*/ 0, /* 48x48,174 */
|
||||||
/*32*/ 0, /* 52x52,204 */ 0, /* 64x64,280 */ 0, /* 72x72,368 */ 0, /* 80x80,456 */
|
/*32*/ 0, /* 52x52,204 */ 0, /* 64x64,280 */ 0, /* 72x72,368 */ 0, /* 80x80,456 */
|
||||||
/*36*/ 0, /* 88x88,576 */ 0, /* 96x96,696 */ 0, /*104x104,816*/ 0, /*120x120,1050*/
|
/*36*/ 0, /* 88x88,576 */ 0, /* 96x96,696 */ 0, /*104x104,816*/ 0, /*120x120,1050*/
|
||||||
/*40*/ 0, /*132x132,1304*/0 /*144x144,1558*/
|
/*40*/ 0, /*132x132,1304*/0 /*144x144,1558*/
|
||||||
};
|
};
|
||||||
|
|
||||||
// Horizontal matrix size
|
// Horizontal matrix size
|
||||||
|
|
||||||
static const int matrixH[] = {
|
static const int 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 */
|
||||||
/*12*/ 22, /* 22x22 ,30 */ 16, /* 16x36 ,32 */ 24, /* 24x24 ,36 */ 12, /* 12x64 ,43 */
|
/*12*/ 22, /* 22x22 ,30 */ 16, /* 16x36 ,32 */ 24, /* 24x24 ,36 */ 12, /* 12x64 ,43 */
|
||||||
/*16*/ 26, /* 26x26 ,44 */ 16, /* 16x48 ,49 */ 24, /* 24x32 ,49 */ 26, /* 26x32 ,52 */
|
/*16*/ 26, /* 26x26 ,44 */ 16, /* 16x48 ,49 */ 24, /* 24x32 ,49 */ 26, /* 26x32 ,52 */
|
||||||
/*20*/ 24, /* 24x36 ,55 */ 32, /* 32x32 ,62 */ 16, /* 16x64 ,62 */ 26, /* 26x40 ,70 */
|
/*20*/ 24, /* 24x36 ,55 */ 32, /* 32x32 ,62 */ 16, /* 16x64 ,62 */ 26, /* 26x40 ,70 */
|
||||||
/*24*/ 24, /* 24x48 ,80 */ 36, /* 36x36 ,86 */ 26, /* 26x48 ,90 */ 24, /* 24x64 ,108*/
|
/*24*/ 24, /* 24x48 ,80 */ 36, /* 36x36 ,86 */ 26, /* 26x48 ,90 */ 24, /* 24x64 ,108*/
|
||||||
/*28*/ 40, /* 40x40 ,114*/ 26, /* 26x64 ,118*/ 44, /* 44x44 ,144*/ 48, /* 48x48,174 */
|
/*28*/ 40, /* 40x40 ,114*/ 26, /* 26x64 ,118*/ 44, /* 44x44 ,144*/ 48, /* 48x48,174 */
|
||||||
/*32*/ 52, /* 52x52,204 */ 64, /* 64x64,280 */ 72, /* 72x72,368 */ 80, /* 80x80,456 */
|
/*32*/ 52, /* 52x52,204 */ 64, /* 64x64,280 */ 72, /* 72x72,368 */ 80, /* 80x80,456 */
|
||||||
/*36*/ 88, /* 88x88,576 */ 96, /* 96x96,696 */ 104, /*104x104,816*/ 120, /*120x120,1050*/
|
/*36*/ 88, /* 88x88,576 */ 96, /* 96x96,696 */ 104, /*104x104,816*/ 120, /*120x120,1050*/
|
||||||
/*40*/ 132, /*132x132,1304*/144/*144x144,1558*/
|
/*40*/ 132, /*132x132,1304*/144/*144x144,1558*/
|
||||||
};
|
};
|
||||||
|
|
||||||
// Vertical matrix sizes
|
// Vertical matrix sizes
|
||||||
|
|
||||||
static const int matrixW[] = {
|
static const int matrixW[] = {
|
||||||
|
@ -341,9 +341,9 @@ void add_shift_char(char binary[], int shifty) {
|
|||||||
|
|
||||||
for (p = 0; p < 6; p++) {
|
for (p = 0; p < 6; p++) {
|
||||||
if (glyph & (0x20 >> p)) {
|
if (glyph & (0x20 >> p)) {
|
||||||
concat(binary, "1");
|
strcat(binary, "1");
|
||||||
} else {
|
} else {
|
||||||
concat(binary, "0");
|
strcat(binary, "0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -368,7 +368,7 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) {
|
|||||||
number_pad_posn = 0;
|
number_pad_posn = 0;
|
||||||
|
|
||||||
if (reader) {
|
if (reader) {
|
||||||
concat(binary, "1010"); /* FNC3 - Reader Initialisation */
|
strcat(binary, "1010"); /* FNC3 - Reader Initialisation */
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
@ -378,31 +378,31 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) {
|
|||||||
switch (current_mode) {
|
switch (current_mode) {
|
||||||
case 0:
|
case 0:
|
||||||
switch (next_mode) {
|
switch (next_mode) {
|
||||||
case GM_CHINESE: concat(binary, "0001");
|
case GM_CHINESE: strcat(binary, "0001");
|
||||||
break;
|
break;
|
||||||
case GM_NUMBER: concat(binary, "0010");
|
case GM_NUMBER: strcat(binary, "0010");
|
||||||
break;
|
break;
|
||||||
case GM_LOWER: concat(binary, "0011");
|
case GM_LOWER: strcat(binary, "0011");
|
||||||
break;
|
break;
|
||||||
case GM_UPPER: concat(binary, "0100");
|
case GM_UPPER: strcat(binary, "0100");
|
||||||
break;
|
break;
|
||||||
case GM_MIXED: concat(binary, "0101");
|
case GM_MIXED: strcat(binary, "0101");
|
||||||
break;
|
break;
|
||||||
case GM_BYTE: concat(binary, "0111");
|
case GM_BYTE: strcat(binary, "0111");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GM_CHINESE:
|
case GM_CHINESE:
|
||||||
switch (next_mode) {
|
switch (next_mode) {
|
||||||
case GM_NUMBER: concat(binary, "1111111100001");
|
case GM_NUMBER: strcat(binary, "1111111100001");
|
||||||
break; // 8161
|
break; // 8161
|
||||||
case GM_LOWER: concat(binary, "1111111100010");
|
case GM_LOWER: strcat(binary, "1111111100010");
|
||||||
break; // 8162
|
break; // 8162
|
||||||
case GM_UPPER: concat(binary, "1111111100011");
|
case GM_UPPER: strcat(binary, "1111111100011");
|
||||||
break; // 8163
|
break; // 8163
|
||||||
case GM_MIXED: concat(binary, "1111111100100");
|
case GM_MIXED: strcat(binary, "1111111100100");
|
||||||
break; // 8164
|
break; // 8164
|
||||||
case GM_BYTE: concat(binary, "1111111100101");
|
case GM_BYTE: strcat(binary, "1111111100101");
|
||||||
break; // 8165
|
break; // 8165
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -420,45 +420,45 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) {
|
|||||||
break; // 0 pad digits
|
break; // 0 pad digits
|
||||||
}
|
}
|
||||||
switch (next_mode) {
|
switch (next_mode) {
|
||||||
case GM_CHINESE: concat(binary, "1111111011");
|
case GM_CHINESE: strcat(binary, "1111111011");
|
||||||
break; // 1019
|
break; // 1019
|
||||||
case GM_LOWER: concat(binary, "1111111100");
|
case GM_LOWER: strcat(binary, "1111111100");
|
||||||
break; // 1020
|
break; // 1020
|
||||||
case GM_UPPER: concat(binary, "1111111101");
|
case GM_UPPER: strcat(binary, "1111111101");
|
||||||
break; // 1021
|
break; // 1021
|
||||||
case GM_MIXED: concat(binary, "1111111110");
|
case GM_MIXED: strcat(binary, "1111111110");
|
||||||
break; // 1022
|
break; // 1022
|
||||||
case GM_BYTE: concat(binary, "1111111111");
|
case GM_BYTE: strcat(binary, "1111111111");
|
||||||
break; // 1023
|
break; // 1023
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GM_LOWER:
|
case GM_LOWER:
|
||||||
case GM_UPPER:
|
case GM_UPPER:
|
||||||
switch (next_mode) {
|
switch (next_mode) {
|
||||||
case GM_CHINESE: concat(binary, "11100");
|
case GM_CHINESE: strcat(binary, "11100");
|
||||||
break; // 28
|
break; // 28
|
||||||
case GM_NUMBER: concat(binary, "11101");
|
case GM_NUMBER: strcat(binary, "11101");
|
||||||
break; // 29
|
break; // 29
|
||||||
case GM_LOWER:
|
case GM_LOWER:
|
||||||
case GM_UPPER: concat(binary, "11110");
|
case GM_UPPER: strcat(binary, "11110");
|
||||||
break; // 30
|
break; // 30
|
||||||
case GM_MIXED: concat(binary, "1111100");
|
case GM_MIXED: strcat(binary, "1111100");
|
||||||
break; // 124
|
break; // 124
|
||||||
case GM_BYTE: concat(binary, "1111110");
|
case GM_BYTE: strcat(binary, "1111110");
|
||||||
break; // 126
|
break; // 126
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GM_MIXED:
|
case GM_MIXED:
|
||||||
switch (next_mode) {
|
switch (next_mode) {
|
||||||
case GM_CHINESE: concat(binary, "1111110001");
|
case GM_CHINESE: strcat(binary, "1111110001");
|
||||||
break; // 1009
|
break; // 1009
|
||||||
case GM_NUMBER: concat(binary, "1111110010");
|
case GM_NUMBER: strcat(binary, "1111110010");
|
||||||
break; // 1010
|
break; // 1010
|
||||||
case GM_LOWER: concat(binary, "1111110011");
|
case GM_LOWER: strcat(binary, "1111110011");
|
||||||
break; // 1011
|
break; // 1011
|
||||||
case GM_UPPER: concat(binary, "1111110100");
|
case GM_UPPER: strcat(binary, "1111110100");
|
||||||
break; // 1012
|
break; // 1012
|
||||||
case GM_BYTE: concat(binary, "1111110111");
|
case GM_BYTE: strcat(binary, "1111110111");
|
||||||
break; // 1015
|
break; // 1015
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -467,15 +467,15 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) {
|
|||||||
add_byte_count(binary, byte_count_posn, byte_count);
|
add_byte_count(binary, byte_count_posn, byte_count);
|
||||||
byte_count = 0;
|
byte_count = 0;
|
||||||
switch (next_mode) {
|
switch (next_mode) {
|
||||||
case GM_CHINESE: concat(binary, "0001");
|
case GM_CHINESE: strcat(binary, "0001");
|
||||||
break; // 1
|
break; // 1
|
||||||
case GM_NUMBER: concat(binary, "0010");
|
case GM_NUMBER: strcat(binary, "0010");
|
||||||
break; // 2
|
break; // 2
|
||||||
case GM_LOWER: concat(binary, "0011");
|
case GM_LOWER: strcat(binary, "0011");
|
||||||
break; // 3
|
break; // 3
|
||||||
case GM_UPPER: concat(binary, "0100");
|
case GM_UPPER: strcat(binary, "0100");
|
||||||
break; // 4
|
break; // 4
|
||||||
case GM_MIXED: concat(binary, "0101");
|
case GM_MIXED: strcat(binary, "0101");
|
||||||
break; // 5
|
break; // 5
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -547,9 +547,9 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) {
|
|||||||
|
|
||||||
for (q = 0; q < 13; q++) {
|
for (q = 0; q < 13; q++) {
|
||||||
if (glyph & (0x1000 >> q)) {
|
if (glyph & (0x1000 >> q)) {
|
||||||
concat(binary, "1");
|
strcat(binary, "1");
|
||||||
} else {
|
} else {
|
||||||
concat(binary, "0");
|
strcat(binary, "0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sp++;
|
sp++;
|
||||||
@ -559,7 +559,7 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) {
|
|||||||
if (last_mode != current_mode) {
|
if (last_mode != current_mode) {
|
||||||
/* Reserve a space for numeric digit padding value (2 bits) */
|
/* Reserve a space for numeric digit padding value (2 bits) */
|
||||||
number_pad_posn = strlen(binary);
|
number_pad_posn = strlen(binary);
|
||||||
concat(binary, "XX");
|
strcat(binary, "XX");
|
||||||
}
|
}
|
||||||
p = 0;
|
p = 0;
|
||||||
ppos = -1;
|
ppos = -1;
|
||||||
@ -621,9 +621,9 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) {
|
|||||||
|
|
||||||
for (q = 0; q < 10; q++) {
|
for (q = 0; q < 10; q++) {
|
||||||
if (glyph & (0x200 >> q)) {
|
if (glyph & (0x200 >> q)) {
|
||||||
concat(binary, "1");
|
strcat(binary, "1");
|
||||||
} else {
|
} else {
|
||||||
concat(binary, "0");
|
strcat(binary, "0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -635,9 +635,9 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) {
|
|||||||
|
|
||||||
for (q = 0; q < 10; q++) {
|
for (q = 0; q < 10; q++) {
|
||||||
if (glyph & (0x200 >> q)) {
|
if (glyph & (0x200 >> q)) {
|
||||||
concat(binary, "1");
|
strcat(binary, "1");
|
||||||
} else {
|
} else {
|
||||||
concat(binary, "0");
|
strcat(binary, "0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -646,14 +646,14 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) {
|
|||||||
if (last_mode != current_mode) {
|
if (last_mode != current_mode) {
|
||||||
/* Reserve space for byte block length indicator (9 bits) */
|
/* Reserve space for byte block length indicator (9 bits) */
|
||||||
byte_count_posn = strlen(binary);
|
byte_count_posn = strlen(binary);
|
||||||
concat(binary, "LLLLLLLLL");
|
strcat(binary, "LLLLLLLLL");
|
||||||
}
|
}
|
||||||
if (byte_count == 512) {
|
if (byte_count == 512) {
|
||||||
/* Maximum byte block size is 512 bytes. If longer is needed then start a new block */
|
/* Maximum byte block size is 512 bytes. If longer is needed then start a new block */
|
||||||
add_byte_count(binary, byte_count_posn, byte_count);
|
add_byte_count(binary, byte_count_posn, byte_count);
|
||||||
concat(binary, "0111");
|
strcat(binary, "0111");
|
||||||
byte_count_posn = strlen(binary);
|
byte_count_posn = strlen(binary);
|
||||||
concat(binary, "LLLLLLLLL");
|
strcat(binary, "LLLLLLLLL");
|
||||||
byte_count = 0;
|
byte_count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -663,9 +663,9 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) {
|
|||||||
}
|
}
|
||||||
for (q = 0; q < 8; q++) {
|
for (q = 0; q < 8; q++) {
|
||||||
if (glyph & (0x80 >> q)) {
|
if (glyph & (0x80 >> q)) {
|
||||||
concat(binary, "1");
|
strcat(binary, "1");
|
||||||
} else {
|
} else {
|
||||||
concat(binary, "0");
|
strcat(binary, "0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sp++;
|
sp++;
|
||||||
@ -696,14 +696,14 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) {
|
|||||||
|
|
||||||
for (q = 0; q < 6; q++) {
|
for (q = 0; q < 6; q++) {
|
||||||
if (glyph & (0x20 >> q)) {
|
if (glyph & (0x20 >> q)) {
|
||||||
concat(binary, "1");
|
strcat(binary, "1");
|
||||||
} else {
|
} else {
|
||||||
concat(binary, "0");
|
strcat(binary, "0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Shift Mode character */
|
/* Shift Mode character */
|
||||||
concat(binary, "1111110110"); /* 1014 - shift indicator */
|
strcat(binary, "1111110110"); /* 1014 - shift indicator */
|
||||||
add_shift_char(binary, gbdata[sp]);
|
add_shift_char(binary, gbdata[sp]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -728,14 +728,14 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) {
|
|||||||
|
|
||||||
for (q = 0; q < 5; q++) {
|
for (q = 0; q < 5; q++) {
|
||||||
if (glyph & (0x10 >> q)) {
|
if (glyph & (0x10 >> q)) {
|
||||||
concat(binary, "1");
|
strcat(binary, "1");
|
||||||
} else {
|
} else {
|
||||||
concat(binary, "0");
|
strcat(binary, "0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Shift Mode character */
|
/* Shift Mode character */
|
||||||
concat(binary, "1111101"); /* 127 - shift indicator */
|
strcat(binary, "1111101"); /* 127 - shift indicator */
|
||||||
add_shift_char(binary, gbdata[sp]);
|
add_shift_char(binary, gbdata[sp]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -760,14 +760,14 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) {
|
|||||||
|
|
||||||
for (q = 0; q < 5; q++) {
|
for (q = 0; q < 5; q++) {
|
||||||
if (glyph & (0x10 >> q)) {
|
if (glyph & (0x10 >> q)) {
|
||||||
concat(binary, "1");
|
strcat(binary, "1");
|
||||||
} else {
|
} else {
|
||||||
concat(binary, "0");
|
strcat(binary, "0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Shift Mode character */
|
/* Shift Mode character */
|
||||||
concat(binary, "1111101"); /* 127 - shift indicator */
|
strcat(binary, "1111101"); /* 127 - shift indicator */
|
||||||
add_shift_char(binary, gbdata[sp]);
|
add_shift_char(binary, gbdata[sp]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -802,16 +802,16 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) {
|
|||||||
|
|
||||||
/* Add "end of data" character */
|
/* Add "end of data" character */
|
||||||
switch (current_mode) {
|
switch (current_mode) {
|
||||||
case GM_CHINESE: concat(binary, "1111111100000");
|
case GM_CHINESE: strcat(binary, "1111111100000");
|
||||||
break; // 8160
|
break; // 8160
|
||||||
case GM_NUMBER: concat(binary, "1111111010");
|
case GM_NUMBER: strcat(binary, "1111111010");
|
||||||
break; // 1018
|
break; // 1018
|
||||||
case GM_LOWER:
|
case GM_LOWER:
|
||||||
case GM_UPPER: concat(binary, "11011");
|
case GM_UPPER: strcat(binary, "11011");
|
||||||
break; // 27
|
break; // 27
|
||||||
case GM_MIXED: concat(binary, "1111110000");
|
case GM_MIXED: strcat(binary, "1111110000");
|
||||||
break; // 1008
|
break; // 1008
|
||||||
case GM_BYTE: concat(binary, "0000");
|
case GM_BYTE: strcat(binary, "0000");
|
||||||
break; // 0
|
break; // 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -821,7 +821,7 @@ int gm_encode(int gbdata[], int length, char binary[], int reader) {
|
|||||||
p = 0;
|
p = 0;
|
||||||
}
|
}
|
||||||
for (i = 0; i < p; i++) {
|
for (i = 0; i < p; i++) {
|
||||||
concat(binary, "0");
|
strcat(binary, "0");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen(binary) > 9191) {
|
if (strlen(binary) > 9191) {
|
||||||
|
@ -56,17 +56,17 @@ void itostr(char ai_string[], int ai_value) {
|
|||||||
temp[1] = '\0';
|
temp[1] = '\0';
|
||||||
if (ai_value >= 1000) {
|
if (ai_value >= 1000) {
|
||||||
temp[0] = itoc(thou);
|
temp[0] = itoc(thou);
|
||||||
concat(ai_string, temp);
|
strcat(ai_string, temp);
|
||||||
}
|
}
|
||||||
if (ai_value >= 100) {
|
if (ai_value >= 100) {
|
||||||
temp[0] = itoc(hund);
|
temp[0] = itoc(hund);
|
||||||
concat(ai_string, temp);
|
strcat(ai_string, temp);
|
||||||
}
|
}
|
||||||
temp[0] = itoc(ten);
|
temp[0] = itoc(ten);
|
||||||
concat(ai_string, temp);
|
strcat(ai_string, temp);
|
||||||
temp[0] = itoc(unit);
|
temp[0] = itoc(unit);
|
||||||
concat(ai_string, temp);
|
strcat(ai_string, temp);
|
||||||
concat(ai_string, ")");
|
strcat(ai_string, ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
int gs1_verify(struct zint_symbol *symbol, const unsigned char source[], const unsigned int src_len, char reduced[]) {
|
int gs1_verify(struct zint_symbol *symbol, const unsigned char source[], const unsigned int src_len, char reduced[]) {
|
||||||
@ -287,13 +287,13 @@ int gs1_verify(struct zint_symbol *symbol, const unsigned char source[], const u
|
|||||||
|
|
||||||
if (error_latch == 5) {
|
if (error_latch == 5) {
|
||||||
strcpy(symbol->errtxt, "Invalid data length for AI ");
|
strcpy(symbol->errtxt, "Invalid data length for AI ");
|
||||||
concat(symbol->errtxt, ai_string);
|
strcat(symbol->errtxt, ai_string);
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error_latch == 6) {
|
if (error_latch == 6) {
|
||||||
strcpy(symbol->errtxt, "Invalid AI value ");
|
strcpy(symbol->errtxt, "Invalid AI value ");
|
||||||
concat(symbol->errtxt, ai_string);
|
strcat(symbol->errtxt, ai_string);
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -652,7 +652,7 @@ int imail(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
if (bar_map[i + 65] == 0)
|
if (bar_map[i + 65] == 0)
|
||||||
j += 2;
|
j += 2;
|
||||||
temp[0] = itoc(j);
|
temp[0] = itoc(j);
|
||||||
concat(data_pattern, temp);
|
strcat(data_pattern, temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Translate 4-state data pattern to symbol */
|
/* Translate 4-state data pattern to symbol */
|
||||||
|
14
backend/library.c
Executable file → Normal file
14
backend/library.c
Executable file → Normal file
@ -204,7 +204,7 @@ void error_tag(char error_string[], int error_number) {
|
|||||||
strcpy(error_string, "warning: ");
|
strcpy(error_string, "warning: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
concat(error_string, error_buffer);
|
strcat(error_string, error_buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,23 +315,23 @@ int hibc(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
temp[0] = check_digit;
|
temp[0] = check_digit;
|
||||||
temp[1] = '\0';
|
temp[1] = '\0';
|
||||||
|
|
||||||
concat(to_process, (char *) source);
|
strcat(to_process, (char *) source);
|
||||||
concat(to_process, temp);
|
strcat(to_process, temp);
|
||||||
length = strlen(to_process);
|
length = strlen(to_process);
|
||||||
|
|
||||||
switch (symbol->symbology) {
|
switch (symbol->symbology) {
|
||||||
case BARCODE_HIBC_128:
|
case BARCODE_HIBC_128:
|
||||||
error_number = code_128(symbol, (unsigned char *) to_process, length);
|
error_number = code_128(symbol, (unsigned char *) to_process, length);
|
||||||
ustrcpy(symbol->text, (unsigned char*) "*");
|
ustrcpy(symbol->text, (unsigned char*) "*");
|
||||||
uconcat(symbol->text, (unsigned char*) to_process);
|
strcat((char*) symbol->text, to_process);
|
||||||
uconcat(symbol->text, (unsigned char*) "*");
|
strcat((char*) symbol->text, "*");
|
||||||
break;
|
break;
|
||||||
case BARCODE_HIBC_39:
|
case BARCODE_HIBC_39:
|
||||||
symbol->option_2 = 0;
|
symbol->option_2 = 0;
|
||||||
error_number = c39(symbol, (unsigned char *) to_process, length);
|
error_number = c39(symbol, (unsigned char *) to_process, length);
|
||||||
ustrcpy(symbol->text, (unsigned char*) "*");
|
ustrcpy(symbol->text, (unsigned char*) "*");
|
||||||
uconcat(symbol->text, (unsigned char*) to_process);
|
strcat((char*) symbol->text, to_process);
|
||||||
uconcat(symbol->text, (unsigned char*) "*");
|
strcat((char*) symbol->text, "*");
|
||||||
break;
|
break;
|
||||||
case BARCODE_HIBC_DM:
|
case BARCODE_HIBC_DM:
|
||||||
error_number = dmatrix(symbol, (unsigned char *) to_process, length);
|
error_number = dmatrix(symbol, (unsigned char *) to_process, length);
|
||||||
|
@ -85,10 +85,10 @@ int pharma_one(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
if (!(tester & 1)) {
|
if (!(tester & 1)) {
|
||||||
concat(inter, "W");
|
strcat(inter, "W");
|
||||||
tester = (tester - 2) / 2;
|
tester = (tester - 2) / 2;
|
||||||
} else {
|
} else {
|
||||||
concat(inter, "N");
|
strcat(inter, "N");
|
||||||
tester = (tester - 1) / 2;
|
tester = (tester - 1) / 2;
|
||||||
}
|
}
|
||||||
} while (tester != 0);
|
} while (tester != 0);
|
||||||
@ -97,9 +97,9 @@ int pharma_one(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
*dest = '\0';
|
*dest = '\0';
|
||||||
for (counter = h; counter >= 0; counter--) {
|
for (counter = h; counter >= 0; counter--) {
|
||||||
if (inter[counter] == 'W') {
|
if (inter[counter] == 'W') {
|
||||||
concat(dest, "32");
|
strcat(dest, "32");
|
||||||
} else {
|
} else {
|
||||||
concat(dest, "12");
|
strcat(dest, "12");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,15 +130,15 @@ int pharma_two_calc(struct zint_symbol *symbol, unsigned char source[], char des
|
|||||||
do {
|
do {
|
||||||
switch (tester % 3) {
|
switch (tester % 3) {
|
||||||
case 0:
|
case 0:
|
||||||
concat(inter, "3");
|
strcat(inter, "3");
|
||||||
tester = (tester - 3) / 3;
|
tester = (tester - 3) / 3;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
concat(inter, "1");
|
strcat(inter, "1");
|
||||||
tester = (tester - 1) / 3;
|
tester = (tester - 1) / 3;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
concat(inter, "2");
|
strcat(inter, "2");
|
||||||
tester = (tester - 2) / 3;
|
tester = (tester - 2) / 3;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -194,7 +194,7 @@ int pharma_two(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* The Codabar system consisting of simple substitution */
|
/* The Codabar system consisting of simple substitution */
|
||||||
int codabar(struct zint_symbol *symbol, unsigned char source[], int length) {
|
int codabar(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||||
|
|
||||||
int i, error_number;
|
int i, error_number;
|
||||||
char dest[512];
|
char dest[512];
|
||||||
@ -213,7 +213,7 @@ int codabar(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
/* Codabar must begin and end with the characters A, B, C or D */
|
/* Codabar must begin and end with the characters A, B, C or D */
|
||||||
if ((source[0] != 'A') && (source[0] != 'B') && (source[0] != 'C')
|
if ((source[0] != 'A') && (source[0] != 'B') && (source[0] != 'C')
|
||||||
&& (source[0] != 'D')) {
|
&& (source[0] != 'D')) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
@ -235,7 +235,7 @@ int codabar(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Italian Pharmacode */
|
/* Italian Pharmacode */
|
||||||
int code32(struct zint_symbol *symbol, unsigned char source[], int length) {
|
int code32(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||||
int i, zeroes, error_number, checksum, checkpart, checkdigit;
|
int i, zeroes, error_number, checksum, checkpart, checkdigit;
|
||||||
char localstr[10], risultante[7];
|
char localstr[10], risultante[7];
|
||||||
long int pharmacode, remainder, devisor;
|
long int pharmacode, remainder, devisor;
|
||||||
@ -302,8 +302,8 @@ int code32(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Override the normal text output with the Pharmacode number */
|
/* Override the normal text output with the Pharmacode number */
|
||||||
ustrcpy(symbol->text, (unsigned char*) "A");
|
strcpy((char*) symbol->text, "A");
|
||||||
uconcat(symbol->text, (unsigned char*) localstr);
|
strcat((char*) symbol->text, (char*) localstr);
|
||||||
|
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ static const int asciiy[95] = {
|
|||||||
|
|
||||||
/* Automatic sizing table */
|
/* Automatic sizing table */
|
||||||
|
|
||||||
static const 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,
|
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
|
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
|
||||||
};
|
};
|
||||||
@ -510,7 +510,7 @@ void numbprocess(int *chainemc, int *mclength, char chaine[], int start, int len
|
|||||||
if (longueur > 44) {
|
if (longueur > 44) {
|
||||||
longueur = 44;
|
longueur = 44;
|
||||||
}
|
}
|
||||||
concat(chainemod, "1");
|
strcat(chainemod, "1");
|
||||||
for (loop = 1; loop <= longueur; loop++) {
|
for (loop = 1; loop <= longueur; loop++) {
|
||||||
chainemod[loop] = chaine[start + loop + j - 1];
|
chainemod[loop] = chaine[start + loop + j - 1];
|
||||||
}
|
}
|
||||||
@ -529,7 +529,7 @@ void numbprocess(int *chainemc, int *mclength, char chaine[], int start, int len
|
|||||||
}
|
}
|
||||||
if (nombre < diviseur) {
|
if (nombre < diviseur) {
|
||||||
if (strlen(chainemult) != 0) {
|
if (strlen(chainemult) != 0) {
|
||||||
concat(chainemult, "0");
|
strcat(chainemult, "0");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
temp = (nombre / diviseur) + '0';
|
temp = (nombre / diviseur) + '0';
|
||||||
@ -777,8 +777,8 @@ int pdf417(struct zint_symbol *symbol, unsigned char chaine[], int length) {
|
|||||||
default: offset = 0;
|
default: offset = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
concat(codebarre, codagemc[offset + dummy[j]]);
|
strcat(codebarre, codagemc[offset + dummy[j]]);
|
||||||
concat(codebarre, "*");
|
strcat(codebarre, "*");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* normal PDF417 symbol */
|
/* normal PDF417 symbol */
|
||||||
@ -791,10 +791,10 @@ int pdf417(struct zint_symbol *symbol, unsigned char chaine[], int length) {
|
|||||||
default: offset = 0;
|
default: offset = 0;
|
||||||
/* cluster(0) */ break;
|
/* cluster(0) */ break;
|
||||||
}
|
}
|
||||||
concat(codebarre, codagemc[offset + dummy[j]]);
|
strcat(codebarre, codagemc[offset + dummy[j]]);
|
||||||
concat(codebarre, "*");
|
strcat(codebarre, "*");
|
||||||
}
|
}
|
||||||
concat(codebarre, "-");
|
strcat(codebarre, "-");
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(pattern, "");
|
strcpy(pattern, "");
|
||||||
@ -1194,33 +1194,33 @@ int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], int length)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the data into codebarre */
|
/* Copy the data into codebarre */
|
||||||
concat(codebarre, RAPLR[LeftRAP]);
|
strcat(codebarre, RAPLR[LeftRAP]);
|
||||||
concat(codebarre, "1");
|
strcat(codebarre, "1");
|
||||||
concat(codebarre, codagemc[offset + dummy[1]]);
|
strcat(codebarre, codagemc[offset + dummy[1]]);
|
||||||
concat(codebarre, "1");
|
strcat(codebarre, "1");
|
||||||
if (symbol->option_2 == 3) {
|
if (symbol->option_2 == 3) {
|
||||||
concat(codebarre, RAPC[CentreRAP]);
|
strcat(codebarre, RAPC[CentreRAP]);
|
||||||
}
|
}
|
||||||
if (symbol->option_2 >= 2) {
|
if (symbol->option_2 >= 2) {
|
||||||
concat(codebarre, "1");
|
strcat(codebarre, "1");
|
||||||
concat(codebarre, codagemc[offset + dummy[2]]);
|
strcat(codebarre, codagemc[offset + dummy[2]]);
|
||||||
concat(codebarre, "1");
|
strcat(codebarre, "1");
|
||||||
}
|
}
|
||||||
if (symbol->option_2 == 4) {
|
if (symbol->option_2 == 4) {
|
||||||
concat(codebarre, RAPC[CentreRAP]);
|
strcat(codebarre, RAPC[CentreRAP]);
|
||||||
}
|
}
|
||||||
if (symbol->option_2 >= 3) {
|
if (symbol->option_2 >= 3) {
|
||||||
concat(codebarre, "1");
|
strcat(codebarre, "1");
|
||||||
concat(codebarre, codagemc[offset + dummy[3]]);
|
strcat(codebarre, codagemc[offset + dummy[3]]);
|
||||||
concat(codebarre, "1");
|
strcat(codebarre, "1");
|
||||||
}
|
}
|
||||||
if (symbol->option_2 == 4) {
|
if (symbol->option_2 == 4) {
|
||||||
concat(codebarre, "1");
|
strcat(codebarre, "1");
|
||||||
concat(codebarre, codagemc[offset + dummy[4]]);
|
strcat(codebarre, codagemc[offset + dummy[4]]);
|
||||||
concat(codebarre, "1");
|
strcat(codebarre, "1");
|
||||||
}
|
}
|
||||||
concat(codebarre, RAPLR[RightRAP]);
|
strcat(codebarre, RAPLR[RightRAP]);
|
||||||
concat(codebarre, "1"); /* stop */
|
strcat(codebarre, "1"); /* stop */
|
||||||
if (debug) printf("%s\n", codebarre);
|
if (debug) printf("%s\n", codebarre);
|
||||||
|
|
||||||
/* Now codebarre is a mixture of letters and numbers */
|
/* Now codebarre is a mixture of letters and numbers */
|
||||||
|
@ -49,7 +49,7 @@ static const char *MSITable[10] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Not MSI/Plessey but the older Plessey standard */
|
/* Not MSI/Plessey but the older Plessey standard */
|
||||||
int plessey(struct zint_symbol *symbol, unsigned char source[], int length) {
|
int plessey(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||||
|
|
||||||
unsigned int i, check;
|
unsigned int i, check;
|
||||||
unsigned char *checkptr;
|
unsigned char *checkptr;
|
||||||
@ -95,15 +95,15 @@ int plessey(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
|
|
||||||
for (i = 0; i < 8; i++) {
|
for (i = 0; i < 8; i++) {
|
||||||
switch (checkptr[length * 4 + i]) {
|
switch (checkptr[length * 4 + i]) {
|
||||||
case 0: concat(dest, "13");
|
case 0: strcat(dest, "13");
|
||||||
break;
|
break;
|
||||||
case 1: concat(dest, "31");
|
case 1: strcat(dest, "31");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Stop character */
|
/* Stop character */
|
||||||
concat(dest, "331311313");
|
strcat(dest, "331311313");
|
||||||
|
|
||||||
expand(symbol, dest);
|
expand(symbol, dest);
|
||||||
ustrcpy(symbol->text, source);
|
ustrcpy(symbol->text, source);
|
||||||
@ -112,7 +112,7 @@ int plessey(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Plain MSI Plessey - does not calculate any check character */
|
/* Plain MSI Plessey - does not calculate any check character */
|
||||||
int msi_plessey(struct zint_symbol *symbol, unsigned char source[], int length) {
|
int msi_plessey(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||||
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
char dest[512]; /* 2 + 55 * 8 + 3 + 1 ~ 512 */
|
char dest[512]; /* 2 + 55 * 8 + 3 + 1 ~ 512 */
|
||||||
@ -130,7 +130,7 @@ int msi_plessey(struct zint_symbol *symbol, unsigned char source[], int length)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Stop character */
|
/* Stop character */
|
||||||
concat(dest, "121");
|
strcat(dest, "121");
|
||||||
|
|
||||||
expand(symbol, dest);
|
expand(symbol, dest);
|
||||||
ustrcpy(symbol->text, source);
|
ustrcpy(symbol->text, source);
|
||||||
@ -139,8 +139,8 @@ int msi_plessey(struct zint_symbol *symbol, unsigned char source[], int length)
|
|||||||
|
|
||||||
/* MSI Plessey with Modulo 10 check digit - algorithm from Barcode Island
|
/* MSI Plessey with Modulo 10 check digit - algorithm from Barcode Island
|
||||||
* http://www.barcodeisland.com/ */
|
* http://www.barcodeisland.com/ */
|
||||||
int msi_plessey_mod10(struct zint_symbol *symbol, unsigned char source[], int length) {
|
int msi_plessey_mod10(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||||
|
|
||||||
|
|
||||||
unsigned long i, wright, dau, pedwar, pump, n;
|
unsigned long i, wright, dau, pedwar, pump, n;
|
||||||
char un[200], tri[32];
|
char un[200], tri[32];
|
||||||
@ -195,7 +195,7 @@ int msi_plessey_mod10(struct zint_symbol *symbol, unsigned char source[], int le
|
|||||||
lookup(NEON, MSITable, itoc(pump), dest);
|
lookup(NEON, MSITable, itoc(pump), dest);
|
||||||
|
|
||||||
/* Stop character */
|
/* Stop character */
|
||||||
concat(dest, "121");
|
strcat(dest, "121");
|
||||||
expand(symbol, dest);
|
expand(symbol, dest);
|
||||||
|
|
||||||
ustrcpy(symbol->text, source);
|
ustrcpy(symbol->text, source);
|
||||||
@ -206,8 +206,8 @@ int msi_plessey_mod10(struct zint_symbol *symbol, unsigned char source[], int le
|
|||||||
|
|
||||||
/* MSI Plessey with two Modulo 10 check digits - algorithm from
|
/* MSI Plessey with two Modulo 10 check digits - algorithm from
|
||||||
* Barcode Island http://www.barcodeisland.com/ */
|
* Barcode Island http://www.barcodeisland.com/ */
|
||||||
int msi_plessey_mod1010(struct zint_symbol *symbol, unsigned char source[], const unsigned int src_len) {
|
int msi_plessey_mod1010(struct zint_symbol *symbol, unsigned char source[], const unsigned int src_len) {
|
||||||
|
|
||||||
|
|
||||||
unsigned long i, n, wright, dau, pedwar, pump, chwech;
|
unsigned long i, n, wright, dau, pedwar, pump, chwech;
|
||||||
char un[16], tri[32];
|
char un[16], tri[32];
|
||||||
@ -296,7 +296,7 @@ int msi_plessey_mod1010(struct zint_symbol *symbol, unsigned char source[], cons
|
|||||||
lookup(NEON, MSITable, itoc(chwech), dest);
|
lookup(NEON, MSITable, itoc(chwech), dest);
|
||||||
|
|
||||||
/* Stop character */
|
/* Stop character */
|
||||||
concat(dest, "121");
|
strcat(dest, "121");
|
||||||
|
|
||||||
expand(symbol, dest);
|
expand(symbol, dest);
|
||||||
|
|
||||||
@ -351,13 +351,13 @@ int msi_plessey_mod11(struct zint_symbol *symbol, unsigned char source[], const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* stop character */
|
/* stop character */
|
||||||
concat(dest, "121");
|
strcat(dest, "121");
|
||||||
|
|
||||||
expand(symbol, dest);
|
expand(symbol, dest);
|
||||||
|
|
||||||
ustrcpy(symbol->text, source);
|
ustrcpy(symbol->text, source);
|
||||||
if (check == 10) {
|
if (check == 10) {
|
||||||
concat((char*) symbol->text, "10");
|
strcat((char*) symbol->text, "10");
|
||||||
} else {
|
} else {
|
||||||
symbol->text[src_len] = itoc(check);
|
symbol->text[src_len] = itoc(check);
|
||||||
symbol->text[src_len + 1] = '\0';
|
symbol->text[src_len + 1] = '\0';
|
||||||
@ -410,7 +410,7 @@ int msi_plessey_mod1110(struct zint_symbol *symbol, unsigned char source[], cons
|
|||||||
if (check == 10) {
|
if (check == 10) {
|
||||||
lookup(NEON, MSITable, '1', dest);
|
lookup(NEON, MSITable, '1', dest);
|
||||||
lookup(NEON, MSITable, '0', dest);
|
lookup(NEON, MSITable, '0', dest);
|
||||||
uconcat(temp, (unsigned char *) "10");
|
strcat((char*) temp, "10");
|
||||||
temp_len += 2;
|
temp_len += 2;
|
||||||
} else {
|
} else {
|
||||||
lookup(NEON, MSITable, itoc(check), dest);
|
lookup(NEON, MSITable, itoc(check), dest);
|
||||||
@ -451,7 +451,7 @@ int msi_plessey_mod1110(struct zint_symbol *symbol, unsigned char source[], cons
|
|||||||
lookup(NEON, MSITable, itoc(pump), dest);
|
lookup(NEON, MSITable, itoc(pump), dest);
|
||||||
|
|
||||||
/* stop character */
|
/* stop character */
|
||||||
concat(dest, "121");
|
strcat(dest, "121");
|
||||||
expand(symbol, dest);
|
expand(symbol, dest);
|
||||||
|
|
||||||
temp[temp_len++] = itoc(pump);
|
temp[temp_len++] = itoc(pump);
|
||||||
|
@ -111,10 +111,10 @@ int postnet(struct zint_symbol *symbol, unsigned char source[], char dest[], int
|
|||||||
}
|
}
|
||||||
|
|
||||||
check_digit = (10 - (sum % 10)) % 10;
|
check_digit = (10 - (sum % 10)) % 10;
|
||||||
concat(dest, PNTable[check_digit]);
|
strcat(dest, PNTable[check_digit]);
|
||||||
|
|
||||||
/* stop character */
|
/* stop character */
|
||||||
concat(dest, "L");
|
strcat(dest, "L");
|
||||||
|
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
@ -177,10 +177,10 @@ int planet(struct zint_symbol *symbol, unsigned char source[], char dest[], int
|
|||||||
}
|
}
|
||||||
|
|
||||||
check_digit = (10 - (sum % 10)) % 10;
|
check_digit = (10 - (sum % 10)) % 10;
|
||||||
concat(dest, PLTable[check_digit]);
|
strcat(dest, PLTable[check_digit]);
|
||||||
|
|
||||||
/* stop character */
|
/* stop character */
|
||||||
concat(dest, "L");
|
strcat(dest, "L");
|
||||||
|
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
@ -216,7 +216,7 @@ int planet_plot(struct zint_symbol *symbol, unsigned char source[], int length)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Korean Postal Authority */
|
/* Korean Postal Authority */
|
||||||
int korea_post(struct zint_symbol *symbol, unsigned char source[], int length) {
|
int korea_post(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||||
int total, loop, check, zeroes, error_number;
|
int total, loop, check, zeroes, error_number;
|
||||||
char localstr[8], dest[80];
|
char localstr[8], dest[80];
|
||||||
|
|
||||||
@ -257,7 +257,7 @@ int korea_post(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
/* The simplest barcode symbology ever! Supported by MS Word, so here it is!
|
/* The simplest barcode symbology ever! Supported by MS Word, so here it is!
|
||||||
glyphs from http://en.wikipedia.org/wiki/Facing_Identification_Mark */
|
glyphs from http://en.wikipedia.org/wiki/Facing_Identification_Mark */
|
||||||
int fim(struct zint_symbol *symbol, unsigned char source[], int length) {
|
int fim(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||||
|
|
||||||
|
|
||||||
char dest[16] = {0};
|
char dest[16] = {0};
|
||||||
|
|
||||||
@ -322,10 +322,10 @@ char rm4scc(char source[], unsigned char dest[], int length) {
|
|||||||
column = 5;
|
column = 5;
|
||||||
}
|
}
|
||||||
check_digit = (6 * row) + column;
|
check_digit = (6 * row) + column;
|
||||||
concat((char*) dest, RoyalTable[check_digit]);
|
strcat((char*) dest, RoyalTable[check_digit]);
|
||||||
|
|
||||||
/* stop character */
|
/* stop character */
|
||||||
concat((char*) dest, "0");
|
strcat((char*) dest, "0");
|
||||||
|
|
||||||
return set_copy[check_digit];
|
return set_copy[check_digit];
|
||||||
}
|
}
|
||||||
@ -448,16 +448,16 @@ int daft_code(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
|
|
||||||
for (i = 0; i < length; i++) {
|
for (i = 0; i < length; i++) {
|
||||||
if (source[i] == 'D') {
|
if (source[i] == 'D') {
|
||||||
concat(height_pattern, "2");
|
strcat(height_pattern, "2");
|
||||||
}
|
}
|
||||||
if (source[i] == 'A') {
|
if (source[i] == 'A') {
|
||||||
concat(height_pattern, "1");
|
strcat(height_pattern, "1");
|
||||||
}
|
}
|
||||||
if (source[i] == 'F') {
|
if (source[i] == 'F') {
|
||||||
concat(height_pattern, "0");
|
strcat(height_pattern, "0");
|
||||||
}
|
}
|
||||||
if (source[i] == 'T') {
|
if (source[i] == 'T') {
|
||||||
concat(height_pattern, "3");
|
strcat(height_pattern, "3");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -484,7 +484,7 @@ int daft_code(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Flattermarken - Not really a barcode symbology! */
|
/* Flattermarken - Not really a barcode symbology! */
|
||||||
int flattermarken(struct zint_symbol *symbol, unsigned char source[], int length) {
|
int flattermarken(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||||
int loop, error_number;
|
int loop, error_number;
|
||||||
char dest[512]; /* 90 * 4 + 1 ~ */
|
char dest[512]; /* 90 * 4 + 1 ~ */
|
||||||
|
|
||||||
@ -509,7 +509,7 @@ int flattermarken(struct zint_symbol *symbol, unsigned char source[], int length
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Japanese Postal Code (Kasutama Barcode) */
|
/* Japanese Postal Code (Kasutama Barcode) */
|
||||||
int japan_post(struct zint_symbol *symbol, unsigned char source[], int length) {
|
int japan_post(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||||
int error_number, h;
|
int error_number, h;
|
||||||
char pattern[69];
|
char pattern[69];
|
||||||
int writer, loopey, inter_posn, i, sum, check;
|
int writer, loopey, inter_posn, i, sum, check;
|
||||||
@ -570,7 +570,7 @@ int japan_post(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
|
|
||||||
sum = 0;
|
sum = 0;
|
||||||
for (i = 0; i < 20; i++) {
|
for (i = 0; i < 20; i++) {
|
||||||
concat(pattern, JapanTable[posn(KASUTSET, inter[i])]);
|
strcat(pattern, JapanTable[posn(KASUTSET, inter[i])]);
|
||||||
sum += posn(CHKASUTSET, inter[i]);
|
sum += posn(CHKASUTSET, inter[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -588,9 +588,9 @@ int japan_post(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
if (check >= 11) {
|
if (check >= 11) {
|
||||||
check_char = (check - 11) + 'a';
|
check_char = (check - 11) + 'a';
|
||||||
}
|
}
|
||||||
concat(pattern, JapanTable[posn(KASUTSET, check_char)]);
|
strcat(pattern, JapanTable[posn(KASUTSET, check_char)]);
|
||||||
|
|
||||||
concat(pattern, "31"); /* Stop */
|
strcat(pattern, "31"); /* Stop */
|
||||||
|
|
||||||
/* Resolve pattern to 4-state symbols */
|
/* Resolve pattern to 4-state symbols */
|
||||||
writer = 0;
|
writer = 0;
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <math.h>
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#define SSET "0123456789ABCDEF"
|
#define SSET "0123456789ABCDEF"
|
||||||
@ -198,9 +199,9 @@ int ps_plot(struct zint_symbol *symbol) {
|
|||||||
}
|
}
|
||||||
fprintf(feps, "%%%%Pages: 0\n");
|
fprintf(feps, "%%%%Pages: 0\n");
|
||||||
if (symbol->symbology != BARCODE_MAXICODE) {
|
if (symbol->symbology != BARCODE_MAXICODE) {
|
||||||
fprintf(feps, "%%%%BoundingBox: 0 0 %d %d\n", roundup((symbol->width + xoffset + xoffset) * scaler), roundup((symbol->height + textoffset + yoffset + yoffset) * scaler));
|
fprintf(feps, "%%%%BoundingBox: 0 0 %d %d\n", (int)ceil((symbol->width + xoffset + xoffset) * scaler), (int)ceil((symbol->height + textoffset + yoffset + yoffset) * scaler));
|
||||||
} else {
|
} else {
|
||||||
fprintf(feps, "%%%%BoundingBox: 0 0 %d %d\n", roundup((74.0 + xoffset + xoffset) * scaler), roundup((72.0 + yoffset + yoffset) * scaler));
|
fprintf(feps, "%%%%BoundingBox: 0 0 %d %d\n", (int)ceil((74.0F + xoffset + xoffset) * scaler), (int)ceil((72.0F + yoffset + yoffset) * scaler));
|
||||||
}
|
}
|
||||||
fprintf(feps, "%%%%EndComments\n");
|
fprintf(feps, "%%%%EndComments\n");
|
||||||
|
|
||||||
|
112
backend/qr.c
112
backend/qr.c
@ -188,7 +188,7 @@ int estimate_binary_length(char mode[], int length, int gs1) {
|
|||||||
|
|
||||||
static void qr_bscan(char *binary, int data, int h) {
|
static void qr_bscan(char *binary, int data, int h) {
|
||||||
for (; h; h >>= 1) {
|
for (; h; h >>= 1) {
|
||||||
concat(binary, data & h ? "1" : "0");
|
strcat(binary, data & h ? "1" : "0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,7 +208,7 @@ void qr_binary(int datastream[], int version, int target_binlen, char mode[], in
|
|||||||
strcpy(binary, "");
|
strcpy(binary, "");
|
||||||
|
|
||||||
if (gs1) {
|
if (gs1) {
|
||||||
concat(binary, "0101"); /* FNC1 */
|
strcat(binary, "0101"); /* FNC1 */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version <= 9) {
|
if (version <= 9) {
|
||||||
@ -233,14 +233,14 @@ void qr_binary(int datastream[], int version, int target_binlen, char mode[], in
|
|||||||
short_data_block_length = 0;
|
short_data_block_length = 0;
|
||||||
do {
|
do {
|
||||||
short_data_block_length++;
|
short_data_block_length++;
|
||||||
} while (((short_data_block_length + position) < length)
|
} while (((short_data_block_length + position) < length)
|
||||||
&& (mode[position + short_data_block_length] == data_block));
|
&& (mode[position + short_data_block_length] == data_block));
|
||||||
|
|
||||||
switch (data_block) {
|
switch (data_block) {
|
||||||
case 'K':
|
case 'K':
|
||||||
/* Kanji mode */
|
/* Kanji mode */
|
||||||
/* Mode indicator */
|
/* Mode indicator */
|
||||||
concat(binary, "1000");
|
strcat(binary, "1000");
|
||||||
|
|
||||||
/* Character count indicator */
|
/* Character count indicator */
|
||||||
qr_bscan(binary, short_data_block_length, 0x20 << (scheme * 2)); /* scheme = 1..3 */
|
qr_bscan(binary, short_data_block_length, 0x20 << (scheme * 2)); /* scheme = 1..3 */
|
||||||
@ -276,7 +276,7 @@ void qr_binary(int datastream[], int version, int target_binlen, char mode[], in
|
|||||||
case 'B':
|
case 'B':
|
||||||
/* Byte mode */
|
/* Byte mode */
|
||||||
/* Mode indicator */
|
/* Mode indicator */
|
||||||
concat(binary, "0100");
|
strcat(binary, "0100");
|
||||||
|
|
||||||
/* Character count indicator */
|
/* Character count indicator */
|
||||||
qr_bscan(binary, short_data_block_length, scheme > 1 ? 0x8000 : 0x80); /* scheme = 1..3 */
|
qr_bscan(binary, short_data_block_length, scheme > 1 ? 0x8000 : 0x80); /* scheme = 1..3 */
|
||||||
@ -308,7 +308,7 @@ void qr_binary(int datastream[], int version, int target_binlen, char mode[], in
|
|||||||
case 'A':
|
case 'A':
|
||||||
/* Alphanumeric mode */
|
/* Alphanumeric mode */
|
||||||
/* Mode indicator */
|
/* Mode indicator */
|
||||||
concat(binary, "0010");
|
strcat(binary, "0010");
|
||||||
|
|
||||||
/* Character count indicator */
|
/* Character count indicator */
|
||||||
qr_bscan(binary, short_data_block_length, 0x40 << (2 * scheme)); /* scheme = 1..3 */
|
qr_bscan(binary, short_data_block_length, 0x40 << (2 * scheme)); /* scheme = 1..3 */
|
||||||
@ -399,7 +399,7 @@ void qr_binary(int datastream[], int version, int target_binlen, char mode[], in
|
|||||||
case 'N':
|
case 'N':
|
||||||
/* Numeric mode */
|
/* Numeric mode */
|
||||||
/* Mode indicator */
|
/* Mode indicator */
|
||||||
concat(binary, "0001");
|
strcat(binary, "0001");
|
||||||
|
|
||||||
/* Character count indicator */
|
/* Character count indicator */
|
||||||
qr_bscan(binary, short_data_block_length, 0x80 << (2 * scheme)); /* scheme = 1..3 */
|
qr_bscan(binary, short_data_block_length, 0x80 << (2 * scheme)); /* scheme = 1..3 */
|
||||||
@ -450,7 +450,7 @@ void qr_binary(int datastream[], int version, int target_binlen, char mode[], in
|
|||||||
} while (position < length);
|
} while (position < length);
|
||||||
|
|
||||||
/* Terminator */
|
/* Terminator */
|
||||||
concat(binary, "0000");
|
strcat(binary, "0000");
|
||||||
|
|
||||||
current_binlen = strlen(binary);
|
current_binlen = strlen(binary);
|
||||||
padbits = 8 - (current_binlen % 8);
|
padbits = 8 - (current_binlen % 8);
|
||||||
@ -461,7 +461,7 @@ void qr_binary(int datastream[], int version, int target_binlen, char mode[], in
|
|||||||
|
|
||||||
/* Padding bits */
|
/* Padding bits */
|
||||||
for (i = 0; i < padbits; i++) {
|
for (i = 0; i < padbits; i++) {
|
||||||
concat(binary, "0");
|
strcat(binary, "0");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Put data into 8-bit codewords */
|
/* Put data into 8-bit codewords */
|
||||||
@ -1138,8 +1138,7 @@ int apply_bitmask(unsigned char *grid, int size, int ecc_level) {
|
|||||||
for (y = 0; y < size; y++) {
|
for (y = 0; y < size; y++) {
|
||||||
if (grid[(y * size) + x] & 0x01) {
|
if (grid[(y * size) + x] & 0x01) {
|
||||||
p = 0xff;
|
p = 0xff;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
p = 0x00;
|
p = 0x00;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1296,12 +1295,12 @@ int tribus(int version, int a, int b, int c) {
|
|||||||
/* Implements a custom optimisation algorithm, more efficient than that
|
/* Implements a custom optimisation algorithm, more efficient than that
|
||||||
given in Annex J. */
|
given in Annex J. */
|
||||||
void applyOptimisation(int version, char inputMode[], int inputLength) {
|
void applyOptimisation(int version, char inputMode[], int inputLength) {
|
||||||
|
|
||||||
|
|
||||||
int blockCount = 0, block;
|
int blockCount = 0, block;
|
||||||
int i, j;
|
int i, j;
|
||||||
char currentMode = ' '; // Null
|
char currentMode = ' '; // Null
|
||||||
int *blockLength;
|
int *blockLength;
|
||||||
char *blockMode;
|
char *blockMode;
|
||||||
|
|
||||||
for (i = 0; i < inputLength; i++) {
|
for (i = 0; i < inputLength; i++) {
|
||||||
@ -1311,13 +1310,12 @@ void applyOptimisation(int version, char inputMode[], int inputLength) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
blockLength=(int*)malloc(sizeof(int)*blockCount);
|
blockLength = (int*) malloc(sizeof (int)*blockCount);
|
||||||
assert(blockLength);
|
assert(blockLength);
|
||||||
if (!blockLength) return;
|
if (!blockLength) return;
|
||||||
blockMode=(char*)malloc(sizeof(char)*blockCount);
|
blockMode = (char*) malloc(sizeof (char)*blockCount);
|
||||||
assert(blockMode);
|
assert(blockMode);
|
||||||
if (!blockMode)
|
if (!blockMode) {
|
||||||
{
|
|
||||||
free(blockLength);
|
free(blockLength);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1773,13 +1771,13 @@ int micro_qr_intermediate(char binary[], int jisdata[], char mode[], int length,
|
|||||||
case 'K':
|
case 'K':
|
||||||
/* Kanji mode */
|
/* Kanji mode */
|
||||||
/* Mode indicator */
|
/* Mode indicator */
|
||||||
concat(binary, "K");
|
strcat(binary, "K");
|
||||||
*kanji_used = 1;
|
*kanji_used = 1;
|
||||||
|
|
||||||
/* Character count indicator */
|
/* Character count indicator */
|
||||||
buffer[0] = short_data_block_length;
|
buffer[0] = short_data_block_length;
|
||||||
buffer[1] = '\0';
|
buffer[1] = '\0';
|
||||||
concat(binary, buffer);
|
strcat(binary, buffer);
|
||||||
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
printf("Kanji block (length %d)\n\t", short_data_block_length);
|
printf("Kanji block (length %d)\n\t", short_data_block_length);
|
||||||
@ -1816,13 +1814,13 @@ int micro_qr_intermediate(char binary[], int jisdata[], char mode[], int length,
|
|||||||
case 'B':
|
case 'B':
|
||||||
/* Byte mode */
|
/* Byte mode */
|
||||||
/* Mode indicator */
|
/* Mode indicator */
|
||||||
concat(binary, "B");
|
strcat(binary, "B");
|
||||||
*byte_used = 1;
|
*byte_used = 1;
|
||||||
|
|
||||||
/* Character count indicator */
|
/* Character count indicator */
|
||||||
buffer[0] = short_data_block_length;
|
buffer[0] = short_data_block_length;
|
||||||
buffer[1] = '\0';
|
buffer[1] = '\0';
|
||||||
concat(binary, buffer);
|
strcat(binary, buffer);
|
||||||
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
printf("Byte block (length %d)\n\t", short_data_block_length);
|
printf("Byte block (length %d)\n\t", short_data_block_length);
|
||||||
@ -1851,13 +1849,13 @@ int micro_qr_intermediate(char binary[], int jisdata[], char mode[], int length,
|
|||||||
case 'A':
|
case 'A':
|
||||||
/* Alphanumeric mode */
|
/* Alphanumeric mode */
|
||||||
/* Mode indicator */
|
/* Mode indicator */
|
||||||
concat(binary, "A");
|
strcat(binary, "A");
|
||||||
*alphanum_used = 1;
|
*alphanum_used = 1;
|
||||||
|
|
||||||
/* Character count indicator */
|
/* Character count indicator */
|
||||||
buffer[0] = short_data_block_length;
|
buffer[0] = short_data_block_length;
|
||||||
buffer[1] = '\0';
|
buffer[1] = '\0';
|
||||||
concat(binary, buffer);
|
strcat(binary, buffer);
|
||||||
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
printf("Alpha block (length %d)\n\t", short_data_block_length);
|
printf("Alpha block (length %d)\n\t", short_data_block_length);
|
||||||
@ -1900,12 +1898,12 @@ int micro_qr_intermediate(char binary[], int jisdata[], char mode[], int length,
|
|||||||
case 'N':
|
case 'N':
|
||||||
/* Numeric mode */
|
/* Numeric mode */
|
||||||
/* Mode indicator */
|
/* Mode indicator */
|
||||||
concat(binary, "N");
|
strcat(binary, "N");
|
||||||
|
|
||||||
/* Character count indicator */
|
/* Character count indicator */
|
||||||
buffer[0] = short_data_block_length;
|
buffer[0] = short_data_block_length;
|
||||||
buffer[1] = '\0';
|
buffer[1] = '\0';
|
||||||
concat(binary, buffer);
|
strcat(binary, buffer);
|
||||||
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
printf("Number block (length %d)\n\t", short_data_block_length);
|
printf("Number block (length %d)\n\t", short_data_block_length);
|
||||||
@ -2014,21 +2012,21 @@ void microqr_expand_binary(char binary_stream[], char full_stream[], int version
|
|||||||
i = 0;
|
i = 0;
|
||||||
do {
|
do {
|
||||||
switch (binary_stream[i]) {
|
switch (binary_stream[i]) {
|
||||||
case '1': concat(full_stream, "1");
|
case '1': strcat(full_stream, "1");
|
||||||
i++;
|
i++;
|
||||||
break;
|
break;
|
||||||
case '0': concat(full_stream, "0");
|
case '0': strcat(full_stream, "0");
|
||||||
i++;
|
i++;
|
||||||
break;
|
break;
|
||||||
case 'N':
|
case 'N':
|
||||||
/* Numeric Mode */
|
/* Numeric Mode */
|
||||||
/* Mode indicator */
|
/* Mode indicator */
|
||||||
switch (version) {
|
switch (version) {
|
||||||
case 1: concat(full_stream, "0");
|
case 1: strcat(full_stream, "0");
|
||||||
break;
|
break;
|
||||||
case 2: concat(full_stream, "00");
|
case 2: strcat(full_stream, "00");
|
||||||
break;
|
break;
|
||||||
case 3: concat(full_stream, "000");
|
case 3: strcat(full_stream, "000");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2041,11 +2039,11 @@ void microqr_expand_binary(char binary_stream[], char full_stream[], int version
|
|||||||
/* Alphanumeric Mode */
|
/* Alphanumeric Mode */
|
||||||
/* Mode indicator */
|
/* Mode indicator */
|
||||||
switch (version) {
|
switch (version) {
|
||||||
case 1: concat(full_stream, "1");
|
case 1: strcat(full_stream, "1");
|
||||||
break;
|
break;
|
||||||
case 2: concat(full_stream, "01");
|
case 2: strcat(full_stream, "01");
|
||||||
break;
|
break;
|
||||||
case 3: concat(full_stream, "001");
|
case 3: strcat(full_stream, "001");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2058,9 +2056,9 @@ void microqr_expand_binary(char binary_stream[], char full_stream[], int version
|
|||||||
/* Byte Mode */
|
/* Byte Mode */
|
||||||
/* Mode indicator */
|
/* Mode indicator */
|
||||||
switch (version) {
|
switch (version) {
|
||||||
case 2: concat(full_stream, "10");
|
case 2: strcat(full_stream, "10");
|
||||||
break;
|
break;
|
||||||
case 3: concat(full_stream, "010");
|
case 3: strcat(full_stream, "010");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2073,9 +2071,9 @@ void microqr_expand_binary(char binary_stream[], char full_stream[], int version
|
|||||||
/* Kanji Mode */
|
/* Kanji Mode */
|
||||||
/* Mode indicator */
|
/* Mode indicator */
|
||||||
switch (version) {
|
switch (version) {
|
||||||
case 2: concat(full_stream, "11");
|
case 2: strcat(full_stream, "11");
|
||||||
break;
|
break;
|
||||||
case 3: concat(full_stream, "011");
|
case 3: strcat(full_stream, "011");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2102,11 +2100,11 @@ void micro_qr_m1(char binary_data[]) {
|
|||||||
bits_left = bits_total - strlen(binary_data);
|
bits_left = bits_total - strlen(binary_data);
|
||||||
if (bits_left <= 3) {
|
if (bits_left <= 3) {
|
||||||
for (i = 0; i < bits_left; i++) {
|
for (i = 0; i < bits_left; i++) {
|
||||||
concat(binary_data, "0");
|
strcat(binary_data, "0");
|
||||||
}
|
}
|
||||||
latch = 1;
|
latch = 1;
|
||||||
} else {
|
} else {
|
||||||
concat(binary_data, "000");
|
strcat(binary_data, "000");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (latch == 0) {
|
if (latch == 0) {
|
||||||
@ -2114,7 +2112,7 @@ void micro_qr_m1(char binary_data[]) {
|
|||||||
bits_left = bits_total - strlen(binary_data);
|
bits_left = bits_total - strlen(binary_data);
|
||||||
if (bits_left <= 4) {
|
if (bits_left <= 4) {
|
||||||
for (i = 0; i < bits_left; i++) {
|
for (i = 0; i < bits_left; i++) {
|
||||||
concat(binary_data, "0");
|
strcat(binary_data, "0");
|
||||||
}
|
}
|
||||||
latch = 1;
|
latch = 1;
|
||||||
}
|
}
|
||||||
@ -2127,7 +2125,7 @@ void micro_qr_m1(char binary_data[]) {
|
|||||||
remainder = 0;
|
remainder = 0;
|
||||||
}
|
}
|
||||||
for (i = 0; i < remainder; i++) {
|
for (i = 0; i < remainder; i++) {
|
||||||
concat(binary_data, "0");
|
strcat(binary_data, "0");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add padding */
|
/* Add padding */
|
||||||
@ -2135,10 +2133,10 @@ void micro_qr_m1(char binary_data[]) {
|
|||||||
if (bits_left > 4) {
|
if (bits_left > 4) {
|
||||||
remainder = (bits_left - 4) / 8;
|
remainder = (bits_left - 4) / 8;
|
||||||
for (i = 0; i < remainder; i++) {
|
for (i = 0; i < remainder; i++) {
|
||||||
concat(binary_data, i & 1 ? "00010001" : "11101100");
|
strcat(binary_data, i & 1 ? "00010001" : "11101100");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
concat(binary_data, "0000");
|
strcat(binary_data, "0000");
|
||||||
}
|
}
|
||||||
|
|
||||||
data_codewords = 3;
|
data_codewords = 3;
|
||||||
@ -2217,11 +2215,11 @@ void micro_qr_m2(char binary_data[], int ecc_mode) {
|
|||||||
bits_left = bits_total - strlen(binary_data);
|
bits_left = bits_total - strlen(binary_data);
|
||||||
if (bits_left <= 5) {
|
if (bits_left <= 5) {
|
||||||
for (i = 0; i < bits_left; i++) {
|
for (i = 0; i < bits_left; i++) {
|
||||||
concat(binary_data, "0");
|
strcat(binary_data, "0");
|
||||||
}
|
}
|
||||||
latch = 1;
|
latch = 1;
|
||||||
} else {
|
} else {
|
||||||
concat(binary_data, "00000");
|
strcat(binary_data, "00000");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (latch == 0) {
|
if (latch == 0) {
|
||||||
@ -2231,14 +2229,14 @@ void micro_qr_m2(char binary_data[], int ecc_mode) {
|
|||||||
remainder = 0;
|
remainder = 0;
|
||||||
}
|
}
|
||||||
for (i = 0; i < remainder; i++) {
|
for (i = 0; i < remainder; i++) {
|
||||||
concat(binary_data, "0");
|
strcat(binary_data, "0");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add padding */
|
/* Add padding */
|
||||||
bits_left = bits_total - strlen(binary_data);
|
bits_left = bits_total - strlen(binary_data);
|
||||||
remainder = bits_left / 8;
|
remainder = bits_left / 8;
|
||||||
for (i = 0; i < remainder; i++) {
|
for (i = 0; i < remainder; i++) {
|
||||||
concat(binary_data, i & 1 ? "00010001" : "11101100");
|
strcat(binary_data, i & 1 ? "00010001" : "11101100");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2313,11 +2311,11 @@ void micro_qr_m3(char binary_data[], int ecc_mode) {
|
|||||||
bits_left = bits_total - strlen(binary_data);
|
bits_left = bits_total - strlen(binary_data);
|
||||||
if (bits_left <= 7) {
|
if (bits_left <= 7) {
|
||||||
for (i = 0; i < bits_left; i++) {
|
for (i = 0; i < bits_left; i++) {
|
||||||
concat(binary_data, "0");
|
strcat(binary_data, "0");
|
||||||
}
|
}
|
||||||
latch = 1;
|
latch = 1;
|
||||||
} else {
|
} else {
|
||||||
concat(binary_data, "0000000");
|
strcat(binary_data, "0000000");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (latch == 0) {
|
if (latch == 0) {
|
||||||
@ -2325,7 +2323,7 @@ void micro_qr_m3(char binary_data[], int ecc_mode) {
|
|||||||
bits_left = bits_total - strlen(binary_data);
|
bits_left = bits_total - strlen(binary_data);
|
||||||
if (bits_left <= 4) {
|
if (bits_left <= 4) {
|
||||||
for (i = 0; i < bits_left; i++) {
|
for (i = 0; i < bits_left; i++) {
|
||||||
concat(binary_data, "0");
|
strcat(binary_data, "0");
|
||||||
}
|
}
|
||||||
latch = 1;
|
latch = 1;
|
||||||
}
|
}
|
||||||
@ -2338,7 +2336,7 @@ void micro_qr_m3(char binary_data[], int ecc_mode) {
|
|||||||
remainder = 0;
|
remainder = 0;
|
||||||
}
|
}
|
||||||
for (i = 0; i < remainder; i++) {
|
for (i = 0; i < remainder; i++) {
|
||||||
concat(binary_data, "0");
|
strcat(binary_data, "0");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add padding */
|
/* Add padding */
|
||||||
@ -2346,10 +2344,10 @@ void micro_qr_m3(char binary_data[], int ecc_mode) {
|
|||||||
if (bits_left > 4) {
|
if (bits_left > 4) {
|
||||||
remainder = (bits_left - 4) / 8;
|
remainder = (bits_left - 4) / 8;
|
||||||
for (i = 0; i < remainder; i++) {
|
for (i = 0; i < remainder; i++) {
|
||||||
concat(binary_data, i & 1 ? "00010001" : "11101100");
|
strcat(binary_data, i & 1 ? "00010001" : "11101100");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
concat(binary_data, "0000");
|
strcat(binary_data, "0000");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ecc_mode == LEVEL_L) {
|
if (ecc_mode == LEVEL_L) {
|
||||||
@ -2458,11 +2456,11 @@ void micro_qr_m4(char binary_data[], int ecc_mode) {
|
|||||||
bits_left = bits_total - strlen(binary_data);
|
bits_left = bits_total - strlen(binary_data);
|
||||||
if (bits_left <= 9) {
|
if (bits_left <= 9) {
|
||||||
for (i = 0; i < bits_left; i++) {
|
for (i = 0; i < bits_left; i++) {
|
||||||
concat(binary_data, "0");
|
strcat(binary_data, "0");
|
||||||
}
|
}
|
||||||
latch = 1;
|
latch = 1;
|
||||||
} else {
|
} else {
|
||||||
concat(binary_data, "000000000");
|
strcat(binary_data, "000000000");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (latch == 0) {
|
if (latch == 0) {
|
||||||
@ -2472,14 +2470,14 @@ void micro_qr_m4(char binary_data[], int ecc_mode) {
|
|||||||
remainder = 0;
|
remainder = 0;
|
||||||
}
|
}
|
||||||
for (i = 0; i < remainder; i++) {
|
for (i = 0; i < remainder; i++) {
|
||||||
concat(binary_data, "0");
|
strcat(binary_data, "0");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add padding */
|
/* Add padding */
|
||||||
bits_left = bits_total - strlen(binary_data);
|
bits_left = bits_total - strlen(binary_data);
|
||||||
remainder = bits_left / 8;
|
remainder = bits_left / 8;
|
||||||
for (i = 0; i < remainder; i++) {
|
for (i = 0; i < remainder; i++) {
|
||||||
concat(binary_data, i & 1 ? "00010001" : "11101100");
|
strcat(binary_data, i & 1 ? "00010001" : "11101100");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,8 +51,6 @@
|
|||||||
#include <stdio.h> // only needed for debug (main)
|
#include <stdio.h> // only needed for debug (main)
|
||||||
#include <stdlib.h> // only needed for malloc/free
|
#include <stdlib.h> // only needed for malloc/free
|
||||||
#include "reedsol.h"
|
#include "reedsol.h"
|
||||||
static int gfpoly;
|
|
||||||
static int symsize; // in bits
|
|
||||||
static int logmod; // 2**symsize - 1
|
static int logmod; // 2**symsize - 1
|
||||||
static int rlen;
|
static int rlen;
|
||||||
|
|
||||||
@ -76,8 +74,6 @@ void rs_init_gf(const int poly) {
|
|||||||
m++;
|
m++;
|
||||||
b >>= 1;
|
b >>= 1;
|
||||||
m--;
|
m--;
|
||||||
gfpoly = poly;
|
|
||||||
symsize = m;
|
|
||||||
|
|
||||||
// Calculate the log/alog tables
|
// Calculate the log/alog tables
|
||||||
logmod = (1 << m) - 1;
|
logmod = (1 << m) - 1;
|
||||||
@ -100,7 +96,7 @@ void rs_init_gf(const int poly) {
|
|||||||
// (x + 2**i)*(x + 2**(i+1))*... [nsym terms]
|
// (x + 2**i)*(x + 2**(i+1))*... [nsym terms]
|
||||||
// For ECC200, index is 1.
|
// For ECC200, index is 1.
|
||||||
|
|
||||||
void rs_init_code(const int nsym,int index) {
|
void rs_init_code(const int nsym, int index) {
|
||||||
int i, k;
|
int i, k;
|
||||||
|
|
||||||
rspoly = (int *) malloc(sizeof (int) * (nsym + 1));
|
rspoly = (int *) malloc(sizeof (int) * (nsym + 1));
|
||||||
@ -120,7 +116,7 @@ void rs_init_code(const int nsym,int index) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void rs_encode(const int len,const unsigned char *data, unsigned char *res) {
|
void rs_encode(const int len, const unsigned char *data, unsigned char *res) {
|
||||||
int i, k, m;
|
int i, k, m;
|
||||||
for (i = 0; i < rlen; i++)
|
for (i = 0; i < rlen; i++)
|
||||||
res[i] = 0;
|
res[i] = 0;
|
||||||
@ -128,19 +124,19 @@ void rs_encode(const int len,const unsigned char *data, unsigned char *res) {
|
|||||||
m = res[rlen - 1] ^ data[i];
|
m = res[rlen - 1] ^ data[i];
|
||||||
for (k = rlen - 1; k > 0; k--) {
|
for (k = rlen - 1; k > 0; k--) {
|
||||||
if (m && rspoly[k])
|
if (m && rspoly[k])
|
||||||
res[k] = res[k - 1] ^ alog[(logt[m] + logt[rspoly[k]]) % logmod];
|
res[k] = (unsigned char) (res[k - 1] ^ alog[(logt[m] + logt[rspoly[k]]) % logmod]);
|
||||||
else
|
else
|
||||||
res[k] = res[k - 1];
|
res[k] = res[k - 1];
|
||||||
}
|
}
|
||||||
if (m && rspoly[0])
|
if (m && rspoly[0])
|
||||||
res[0] = alog[(logt[m] + logt[rspoly[0]]) % logmod];
|
res[0] = (unsigned char) (alog[(logt[m] + logt[rspoly[0]]) % logmod]);
|
||||||
else
|
else
|
||||||
res[0] = 0;
|
res[0] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The same as above but for larger bitlengths - Aztec code compatible */
|
/* The same as above but for larger bitlengths - Aztec code compatible */
|
||||||
void rs_encode_long(const int len,const unsigned int *data, unsigned int *res) {
|
void rs_encode_long(const int len, const unsigned int *data, unsigned int *res) {
|
||||||
int i, k, m;
|
int i, k, m;
|
||||||
for (i = 0; i < rlen; i++)
|
for (i = 0; i < rlen; i++)
|
||||||
res[i] = 0;
|
res[i] = 0;
|
||||||
@ -160,7 +156,7 @@ void rs_encode_long(const int len,const unsigned int *data, unsigned int *res) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Free memory */
|
/* Free memory */
|
||||||
void rs_free(void) {
|
void rs_free(void) {
|
||||||
free(logt);
|
free(logt);
|
||||||
free(alog);
|
free(alog);
|
||||||
free(rspoly);
|
free(rspoly);
|
||||||
|
@ -56,7 +56,7 @@ int render_plot_add_hexagon(struct zint_symbol *symbol, struct zint_render_hexag
|
|||||||
|
|
||||||
int render_plot_add_string(struct zint_symbol *symbol, unsigned char *text, float x, float y, float fsize, float width, struct zint_render_string **last_string);
|
int render_plot_add_string(struct zint_symbol *symbol, unsigned char *text, float x, float y, float fsize, float width, struct zint_render_string **last_string);
|
||||||
|
|
||||||
int render_plot(struct zint_symbol *symbol,const float width,const float height) {
|
int render_plot(struct zint_symbol *symbol, const float width, const float height) {
|
||||||
struct zint_render *render;
|
struct zint_render *render;
|
||||||
struct zint_render_line *line, *last_line = NULL;
|
struct zint_render_line *line, *last_line = NULL;
|
||||||
struct zint_render_string *last_string = NULL;
|
struct zint_render_string *last_string = NULL;
|
||||||
@ -81,6 +81,7 @@ int render_plot(struct zint_symbol *symbol,const float width,const float height
|
|||||||
|
|
||||||
// Allocate memory for the rendered version
|
// Allocate memory for the rendered version
|
||||||
render = symbol->rendered = (struct zint_render *) malloc(sizeof (struct zint_render));
|
render = symbol->rendered = (struct zint_render *) malloc(sizeof (struct zint_render));
|
||||||
|
if (!symbol->rendered) return ZINT_ERROR_MEMORY;
|
||||||
render->lines = NULL;
|
render->lines = NULL;
|
||||||
render->strings = NULL;
|
render->strings = NULL;
|
||||||
render->rings = NULL;
|
render->rings = NULL;
|
||||||
@ -172,8 +173,7 @@ int render_plot(struct zint_symbol *symbol,const float width,const float height
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (((symbol->symbology == BARCODE_UPCA) && (symbol->rows == 1)) || (symbol->symbology == BARCODE_UPCA_CC)) {
|
||||||
else if (((symbol->symbology == BARCODE_UPCA) && (symbol->rows == 1)) || (symbol->symbology == BARCODE_UPCA_CC)) {
|
|
||||||
upceanflag = 12;
|
upceanflag = 12;
|
||||||
if (symbol->whitespace_width < 10) {
|
if (symbol->whitespace_width < 10) {
|
||||||
symbol->whitespace_width = 10;
|
symbol->whitespace_width = 10;
|
||||||
@ -190,8 +190,7 @@ int render_plot(struct zint_symbol *symbol,const float width,const float height
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (((symbol->symbology == BARCODE_UPCE) && (symbol->rows == 1)) || (symbol->symbology == BARCODE_UPCE_CC)) {
|
||||||
else if (((symbol->symbology == BARCODE_UPCE) && (symbol->rows == 1)) || (symbol->symbology == BARCODE_UPCE_CC)) {
|
|
||||||
upceanflag = 6;
|
upceanflag = 6;
|
||||||
if (symbol->whitespace_width == 0) {
|
if (symbol->whitespace_width == 0) {
|
||||||
symbol->whitespace_width = 10;
|
symbol->whitespace_width = 10;
|
||||||
@ -228,7 +227,7 @@ int render_plot(struct zint_symbol *symbol,const float width,const float height
|
|||||||
if (large_bar_count == 0) {
|
if (large_bar_count == 0) {
|
||||||
required_aspect = width / height;
|
required_aspect = width / height;
|
||||||
symbol_aspect = (total_symbol_width_x + (2 * xoffset)) / (preset_height + (2 * yoffset) + text_offset + text_height);
|
symbol_aspect = (total_symbol_width_x + (2 * xoffset)) / (preset_height + (2 * yoffset) + text_offset + text_height);
|
||||||
symbol->height = (int)preset_height;
|
symbol->height = (int) preset_height;
|
||||||
if (required_aspect > symbol_aspect) {
|
if (required_aspect > symbol_aspect) {
|
||||||
/* the area is too wide */
|
/* the area is too wide */
|
||||||
scaler = height / (preset_height + (2 * yoffset) + text_offset + text_height);
|
scaler = height / (preset_height + (2 * yoffset) + text_offset + text_height);
|
||||||
@ -242,7 +241,7 @@ int render_plot(struct zint_symbol *symbol,const float width,const float height
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
scaler = width / (total_symbol_width_x + (2 * xoffset));
|
scaler = width / (total_symbol_width_x + (2 * xoffset));
|
||||||
symbol->height = (int)((height / scaler) - ((2 * yoffset) + text_offset + text_height));
|
symbol->height = (int) ((height / scaler) - ((2 * yoffset) + text_offset + text_height));
|
||||||
|
|
||||||
render->width = width;
|
render->width = width;
|
||||||
render->height = height;
|
render->height = height;
|
||||||
@ -276,8 +275,7 @@ int render_plot(struct zint_symbol *symbol,const float width,const float height
|
|||||||
render->height = ((x_dimension * ((2 * symbol->border_width) + text_offset + text_height)) + 5.0) * GL_CONST;
|
render->height = ((x_dimension * ((2 * symbol->border_width) + text_offset + text_height)) + 5.0) * GL_CONST;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (symbol->symbology == BARCODE_CODE49) {
|
||||||
else if(symbol->symbology == BARCODE_CODE49) {
|
|
||||||
/* The minimum X-dimension of Code 49 is 0.191mm */
|
/* The minimum X-dimension of Code 49 is 0.191mm */
|
||||||
if (x_dimension < 0.191) {
|
if (x_dimension < 0.191) {
|
||||||
render->width = 0.191 * GL_CONST * total_area_width_x;
|
render->width = 0.191 * GL_CONST * total_area_width_x;
|
||||||
@ -315,21 +313,18 @@ int render_plot(struct zint_symbol *symbol,const float width,const float height
|
|||||||
render->width = 0.508 * GL_CONST * total_area_width_x;
|
render->width = 0.508 * GL_CONST * total_area_width_x;
|
||||||
render->height = 4.064 * GL_CONST;
|
render->height = 4.064 * GL_CONST;
|
||||||
}
|
}
|
||||||
|
else if ((symbol->symbology == BARCODE_POSTNET) || (symbol->symbology == BARCODE_PLANET)) {
|
||||||
else if((symbol->symbology == BARCODE_POSTNET) || (symbol->symbology == BARCODE_PLANET)) {
|
|
||||||
/* The size of PostNet and PLANET are fized */
|
/* The size of PostNet and PLANET are fized */
|
||||||
render->width = 0.508 * GL_CONST * total_area_width_x;
|
render->width = 0.508 * GL_CONST * total_area_width_x;
|
||||||
render->height = 2.921 * GL_CONST;
|
render->height = 2.921 * GL_CONST;
|
||||||
}
|
}
|
||||||
|
else if (((symbol->symbology == BARCODE_AUSPOST) || (symbol->symbology == BARCODE_AUSREPLY)) ||
|
||||||
else if(((symbol->symbology == BARCODE_AUSPOST) || (symbol->symbology == BARCODE_AUSREPLY)) ||
|
|
||||||
((symbol->symbology == BARCODE_AUSROUTE) || (symbol->symbology == BARCODE_AUSREDIRECT))) {
|
((symbol->symbology == BARCODE_AUSROUTE) || (symbol->symbology == BARCODE_AUSREDIRECT))) {
|
||||||
/* Australia Post use the same sizes as USPS */
|
/* Australia Post use the same sizes as USPS */
|
||||||
render->width = 0.508 * GL_CONST * total_area_width_x;
|
render->width = 0.508 * GL_CONST * total_area_width_x;
|
||||||
render->height = 4.064 * GL_CONST;
|
render->height = 4.064 * GL_CONST;
|
||||||
}
|
}
|
||||||
|
else if ((symbol->symbology == BARCODE_RM4SCC) || (symbol->symbology == BARCODE_KIX)) {
|
||||||
else if((symbol->symbology == BARCODE_RM4SCC) || (symbol->symbology == BARCODE_KIX)) {
|
|
||||||
/* Royal Mail and KIX Code uses 22 bars per inch */
|
/* Royal Mail and KIX Code uses 22 bars per inch */
|
||||||
render->width = 0.577 * GL_CONST * total_area_width_x;
|
render->width = 0.577 * GL_CONST * total_area_width_x;
|
||||||
render->height = 5.22 * GL_CONST;
|
render->height = 5.22 * GL_CONST;
|
||||||
@ -696,7 +691,7 @@ struct zint_render_line *render_plot_create_line(float x, float y, float width,
|
|||||||
* next value.
|
* next value.
|
||||||
*/
|
*/
|
||||||
int render_plot_add_line(struct zint_symbol *symbol, struct zint_render_line *line, struct zint_render_line **last_line) {
|
int render_plot_add_line(struct zint_symbol *symbol, struct zint_render_line *line, struct zint_render_line **last_line) {
|
||||||
if (!line) return ZINT_ERROR_MEMORY;
|
if (!line) return ZINT_ERROR_MEMORY;
|
||||||
if (*last_line)
|
if (*last_line)
|
||||||
(*last_line)->next = line;
|
(*last_line)->next = line;
|
||||||
else
|
else
|
||||||
@ -721,7 +716,7 @@ struct zint_render_ring *render_plot_create_ring(float x, float y, float radius,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int render_plot_add_ring(struct zint_symbol *symbol, struct zint_render_ring *ring, struct zint_render_ring **last_ring) {
|
int render_plot_add_ring(struct zint_symbol *symbol, struct zint_render_ring *ring, struct zint_render_ring **last_ring) {
|
||||||
if (!ring) return ZINT_ERROR_MEMORY;
|
if (!ring) return ZINT_ERROR_MEMORY;
|
||||||
if (*last_ring)
|
if (*last_ring)
|
||||||
(*last_ring)->next = ring;
|
(*last_ring)->next = ring;
|
||||||
else
|
else
|
||||||
@ -744,7 +739,7 @@ struct zint_render_hexagon *render_plot_create_hexagon(float x, float y) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int render_plot_add_hexagon(struct zint_symbol *symbol, struct zint_render_hexagon *hexagon, struct zint_render_hexagon **last_hexagon) {
|
int render_plot_add_hexagon(struct zint_symbol *symbol, struct zint_render_hexagon *hexagon, struct zint_render_hexagon **last_hexagon) {
|
||||||
if (!hexagon) return ZINT_ERROR_MEMORY;
|
if (!hexagon) return ZINT_ERROR_MEMORY;
|
||||||
if (*last_hexagon)
|
if (*last_hexagon)
|
||||||
(*last_hexagon)->next = hexagon;
|
(*last_hexagon)->next = hexagon;
|
||||||
else
|
else
|
||||||
|
188
backend/rss.c
188
backend/rss.c
@ -159,7 +159,7 @@ void getRSSwidths(int val, int n, int elements, int maxWidth, int noNarrow) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* GS1 DataBar-14 */
|
/* GS1 DataBar-14 */
|
||||||
int rss14(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
int rss14(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
||||||
int error_number = 0, i, j, mask;
|
int error_number = 0, i, j, mask;
|
||||||
short int accum[112], left_reg[112], right_reg[112], x_reg[112], y_reg[112];
|
short int accum[112], left_reg[112], right_reg[112], x_reg[112], y_reg[112];
|
||||||
int data_character[4], data_group[4], v_odd[4], v_even[4];
|
int data_character[4], data_group[4], v_odd[4], v_even[4];
|
||||||
@ -513,7 +513,7 @@ int rss14(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
|||||||
}
|
}
|
||||||
hrt[13] = itoc(check_digit);
|
hrt[13] = itoc(check_digit);
|
||||||
|
|
||||||
uconcat(symbol->text, (unsigned char*) hrt);
|
strcat((char*) symbol->text, hrt);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((symbol->symbology == BARCODE_RSS14STACK) || (symbol->symbology == BARCODE_RSS14STACK_CC)) {
|
if ((symbol->symbology == BARCODE_RSS14STACK) || (symbol->symbology == BARCODE_RSS14STACK_CC)) {
|
||||||
@ -723,7 +723,7 @@ int rss14(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* GS1 DataBar Limited */
|
/* GS1 DataBar Limited */
|
||||||
int rsslimited(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
int rsslimited(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
||||||
int error_number = 0, i, mask;
|
int error_number = 0, i, mask;
|
||||||
short int accum[112], left_reg[112], right_reg[112], x_reg[112], y_reg[112];
|
short int accum[112], left_reg[112], right_reg[112], x_reg[112], y_reg[112];
|
||||||
int left_group, right_group, left_odd, left_even, right_odd, right_even;
|
int left_group, right_group, left_odd, left_even, right_odd, right_even;
|
||||||
@ -1041,15 +1041,15 @@ int rsslimited(struct zint_symbol *symbol, unsigned char source[], int src_len)
|
|||||||
hrt[13] = itoc(check_digit);
|
hrt[13] = itoc(check_digit);
|
||||||
hrt[14] = '\0';
|
hrt[14] = '\0';
|
||||||
|
|
||||||
uconcat(symbol->text, (unsigned char*) hrt);
|
strcat((char*) symbol->text, hrt);
|
||||||
|
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Attempts to apply encoding rules from secions 7.2.5.5.1 to 7.2.5.5.3
|
/* Attempts to apply encoding rules from secions 7.2.5.5.1 to 7.2.5.5.3
|
||||||
* of ISO/IEC 24724:2006 */
|
* of ISO/IEC 24724:2006 */
|
||||||
int general_rules(char field[], char type[]) {
|
int general_rules(char field[], char type[]) {
|
||||||
|
|
||||||
int block[2][200], block_count, i, j, k;
|
int block[2][200], block_count, i, j, k;
|
||||||
char current, next, last;
|
char current, next, last;
|
||||||
|
|
||||||
@ -1165,7 +1165,7 @@ int general_rules(char field[], char type[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Handles all data encodation from section 7.2.5 of ISO/IEC 24724 */
|
/* Handles all data encodation from section 7.2.5 of ISO/IEC 24724 */
|
||||||
int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_string[]) {
|
int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_string[]) {
|
||||||
int encoding_method, i, mask, j, read_posn, latch, debug = 0, last_mode = ISOIEC;
|
int encoding_method, i, mask, j, read_posn, latch, debug = 0, last_mode = ISOIEC;
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
char general_field[strlen(source) + 1], general_field_type[strlen(source) + 1];
|
char general_field[strlen(source) + 1], general_field_type[strlen(source) + 1];
|
||||||
@ -1270,12 +1270,12 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
|||||||
/* (01) and (3202)/(3203) */
|
/* (01) and (3202)/(3203) */
|
||||||
|
|
||||||
if (source[19] == '3') {
|
if (source[19] == '3') {
|
||||||
weight = atof(weight_str) / 1000.0;
|
weight = (float) (atof(weight_str) / 1000.0F);
|
||||||
if (weight <= 22.767) {
|
if (weight <= 22.767) {
|
||||||
encoding_method = 4;
|
encoding_method = 4;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
weight = atof(weight_str) / 100.0;
|
weight = (float) (atof(weight_str) / 100.0F);
|
||||||
if (weight <= 99.99) {
|
if (weight <= 99.99) {
|
||||||
encoding_method = 4;
|
encoding_method = 4;
|
||||||
}
|
}
|
||||||
@ -1325,46 +1325,46 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (encoding_method) { /* Encoding method - Table 10 */
|
switch (encoding_method) { /* Encoding method - Table 10 */
|
||||||
case 1: concat(binary_string, "1XX");
|
case 1: strcat(binary_string, "1XX");
|
||||||
read_posn = 16;
|
read_posn = 16;
|
||||||
break;
|
break;
|
||||||
case 2: concat(binary_string, "00XX");
|
case 2: strcat(binary_string, "00XX");
|
||||||
read_posn = 0;
|
read_posn = 0;
|
||||||
break;
|
break;
|
||||||
case 3: concat(binary_string, "0100");
|
case 3: strcat(binary_string, "0100");
|
||||||
read_posn = strlen(source);
|
read_posn = strlen(source);
|
||||||
break;
|
break;
|
||||||
case 4: concat(binary_string, "0101");
|
case 4: strcat(binary_string, "0101");
|
||||||
read_posn = strlen(source);
|
read_posn = strlen(source);
|
||||||
break;
|
break;
|
||||||
case 5: concat(binary_string, "01100XX");
|
case 5: strcat(binary_string, "01100XX");
|
||||||
read_posn = 20;
|
read_posn = 20;
|
||||||
break;
|
break;
|
||||||
case 6: concat(binary_string, "01101XX");
|
case 6: strcat(binary_string, "01101XX");
|
||||||
read_posn = 23;
|
read_posn = 23;
|
||||||
break;
|
break;
|
||||||
case 7: concat(binary_string, "0111000");
|
case 7: strcat(binary_string, "0111000");
|
||||||
read_posn = strlen(source);
|
read_posn = strlen(source);
|
||||||
break;
|
break;
|
||||||
case 8: concat(binary_string, "0111001");
|
case 8: strcat(binary_string, "0111001");
|
||||||
read_posn = strlen(source);
|
read_posn = strlen(source);
|
||||||
break;
|
break;
|
||||||
case 9: concat(binary_string, "0111010");
|
case 9: strcat(binary_string, "0111010");
|
||||||
read_posn = strlen(source);
|
read_posn = strlen(source);
|
||||||
break;
|
break;
|
||||||
case 10: concat(binary_string, "0111011");
|
case 10: strcat(binary_string, "0111011");
|
||||||
read_posn = strlen(source);
|
read_posn = strlen(source);
|
||||||
break;
|
break;
|
||||||
case 11: concat(binary_string, "0111100");
|
case 11: strcat(binary_string, "0111100");
|
||||||
read_posn = strlen(source);
|
read_posn = strlen(source);
|
||||||
break;
|
break;
|
||||||
case 12: concat(binary_string, "0111101");
|
case 12: strcat(binary_string, "0111101");
|
||||||
read_posn = strlen(source);
|
read_posn = strlen(source);
|
||||||
break;
|
break;
|
||||||
case 13: concat(binary_string, "0111110");
|
case 13: strcat(binary_string, "0111110");
|
||||||
read_posn = strlen(source);
|
read_posn = strlen(source);
|
||||||
break;
|
break;
|
||||||
case 14: concat(binary_string, "0111111");
|
case 14: strcat(binary_string, "0111111");
|
||||||
read_posn = strlen(source);
|
read_posn = strlen(source);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1399,7 +1399,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
|||||||
|
|
||||||
mask = 0x08;
|
mask = 0x08;
|
||||||
for (j = 0; j < 4; j++) {
|
for (j = 0; j < 4; j++) {
|
||||||
concat(binary_string, (group_val & mask) ? "1" : "0");
|
strcat(binary_string, (group_val & mask) ? "1" : "0");
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1412,7 +1412,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
|||||||
|
|
||||||
mask = 0x200;
|
mask = 0x200;
|
||||||
for (j = 0; j < 10; j++) {
|
for (j = 0; j < 10; j++) {
|
||||||
concat(binary_string, (group_val & mask) ? "1" : "0");
|
strcat(binary_string, (group_val & mask) ? "1" : "0");
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1435,7 +1435,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
|||||||
|
|
||||||
mask = 0x200;
|
mask = 0x200;
|
||||||
for (j = 0; j < 10; j++) {
|
for (j = 0; j < 10; j++) {
|
||||||
concat(binary_string, (group_val & mask) ? "1" : "0");
|
strcat(binary_string, (group_val & mask) ? "1" : "0");
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1448,7 +1448,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
|||||||
|
|
||||||
mask = 0x4000;
|
mask = 0x4000;
|
||||||
for (j = 0; j < 15; j++) {
|
for (j = 0; j < 15; j++) {
|
||||||
concat(binary_string, (group_val & mask) ? "1" : "0");
|
strcat(binary_string, (group_val & mask) ? "1" : "0");
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1469,7 +1469,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
|||||||
|
|
||||||
mask = 0x200;
|
mask = 0x200;
|
||||||
for (j = 0; j < 10; j++) {
|
for (j = 0; j < 10; j++) {
|
||||||
concat(binary_string, (group_val & mask) ? "1" : "0");
|
strcat(binary_string, (group_val & mask) ? "1" : "0");
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1486,7 +1486,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
|||||||
|
|
||||||
mask = 0x4000;
|
mask = 0x4000;
|
||||||
for (j = 0; j < 15; j++) {
|
for (j = 0; j < 15; j++) {
|
||||||
concat(binary_string, (group_val & mask) ? "1" : "0");
|
strcat(binary_string, (group_val & mask) ? "1" : "0");
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1509,7 +1509,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
|||||||
|
|
||||||
mask = 0x200;
|
mask = 0x200;
|
||||||
for (j = 0; j < 10; j++) {
|
for (j = 0; j < 10; j++) {
|
||||||
concat(binary_string, (group_val & mask) ? "1" : "0");
|
strcat(binary_string, (group_val & mask) ? "1" : "0");
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1524,7 +1524,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
|||||||
|
|
||||||
mask = 0x80000;
|
mask = 0x80000;
|
||||||
for (j = 0; j < 20; j++) {
|
for (j = 0; j < 20; j++) {
|
||||||
concat(binary_string, (group_val & mask) ? "1" : "0");
|
strcat(binary_string, (group_val & mask) ? "1" : "0");
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1548,7 +1548,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
|||||||
|
|
||||||
mask = 0x8000;
|
mask = 0x8000;
|
||||||
for (j = 0; j < 16; j++) {
|
for (j = 0; j < 16; j++) {
|
||||||
concat(binary_string, (group_val & mask) ? "1" : "0");
|
strcat(binary_string, (group_val & mask) ? "1" : "0");
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1567,19 +1567,19 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
|||||||
|
|
||||||
mask = 0x200;
|
mask = 0x200;
|
||||||
for (j = 0; j < 10; j++) {
|
for (j = 0; j < 10; j++) {
|
||||||
concat(binary_string, (group_val & mask) ? "1" : "0");
|
strcat(binary_string, (group_val & mask) ? "1" : "0");
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (source[19]) {
|
switch (source[19]) {
|
||||||
case '0': concat(binary_string, "00");
|
case '0': strcat(binary_string, "00");
|
||||||
break;
|
break;
|
||||||
case '1': concat(binary_string, "01");
|
case '1': strcat(binary_string, "01");
|
||||||
break;
|
break;
|
||||||
case '2': concat(binary_string, "10");
|
case '2': strcat(binary_string, "10");
|
||||||
break;
|
break;
|
||||||
case '3': concat(binary_string, "11");
|
case '3': strcat(binary_string, "11");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1601,19 +1601,19 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
|||||||
|
|
||||||
mask = 0x200;
|
mask = 0x200;
|
||||||
for (j = 0; j < 10; j++) {
|
for (j = 0; j < 10; j++) {
|
||||||
concat(binary_string, (group_val & mask) ? "1" : "0");
|
strcat(binary_string, (group_val & mask) ? "1" : "0");
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (source[19]) {
|
switch (source[19]) {
|
||||||
case '0': concat(binary_string, "00");
|
case '0': strcat(binary_string, "00");
|
||||||
break;
|
break;
|
||||||
case '1': concat(binary_string, "01");
|
case '1': strcat(binary_string, "01");
|
||||||
break;
|
break;
|
||||||
case '2': concat(binary_string, "10");
|
case '2': strcat(binary_string, "10");
|
||||||
break;
|
break;
|
||||||
case '3': concat(binary_string, "11");
|
case '3': strcat(binary_string, "11");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1625,7 +1625,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
|||||||
|
|
||||||
mask = 0x200;
|
mask = 0x200;
|
||||||
for (j = 0; j < 10; j++) {
|
for (j = 0; j < 10; j++) {
|
||||||
concat(binary_string, (group_val & mask) ? "1" : "0");
|
strcat(binary_string, (group_val & mask) ? "1" : "0");
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1734,12 +1734,12 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
|||||||
|
|
||||||
/* Set initial mode if not NUMERIC */
|
/* Set initial mode if not NUMERIC */
|
||||||
if (general_field_type[0] == ALPHA) {
|
if (general_field_type[0] == ALPHA) {
|
||||||
concat(binary_string, "0000"); /* Alphanumeric latch */
|
strcat(binary_string, "0000"); /* Alphanumeric latch */
|
||||||
last_mode = ALPHA;
|
last_mode = ALPHA;
|
||||||
}
|
}
|
||||||
if (general_field_type[0] == ISOIEC) {
|
if (general_field_type[0] == ISOIEC) {
|
||||||
concat(binary_string, "0000"); /* Alphanumeric latch */
|
strcat(binary_string, "0000"); /* Alphanumeric latch */
|
||||||
concat(binary_string, "00100"); /* ISO/IEC 646 latch */
|
strcat(binary_string, "00100"); /* ISO/IEC 646 latch */
|
||||||
last_mode = ISOIEC;
|
last_mode = ISOIEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1751,7 +1751,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
|||||||
if (debug) printf("as NUMERIC:");
|
if (debug) printf("as NUMERIC:");
|
||||||
|
|
||||||
if (last_mode != NUMERIC) {
|
if (last_mode != NUMERIC) {
|
||||||
concat(binary_string, "000"); /* Numeric latch */
|
strcat(binary_string, "000"); /* Numeric latch */
|
||||||
if (debug) printf("<NUMERIC LATCH>\n");
|
if (debug) printf("<NUMERIC LATCH>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1772,7 +1772,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
|||||||
|
|
||||||
mask = 0x40;
|
mask = 0x40;
|
||||||
for (j = 0; j < 7; j++) {
|
for (j = 0; j < 7; j++) {
|
||||||
concat(binary_string, (value & mask) ? "1" : "0");
|
strcat(binary_string, (value & mask) ? "1" : "0");
|
||||||
if (debug) {
|
if (debug) {
|
||||||
printf("%d", !!(value & mask));
|
printf("%d", !!(value & mask));
|
||||||
}
|
}
|
||||||
@ -1788,10 +1788,10 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
|||||||
if (debug) printf("as ALPHA\n");
|
if (debug) printf("as ALPHA\n");
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
if (last_mode == NUMERIC) {
|
if (last_mode == NUMERIC) {
|
||||||
concat(binary_string, "0000"); /* Alphanumeric latch */
|
strcat(binary_string, "0000"); /* Alphanumeric latch */
|
||||||
}
|
}
|
||||||
if (last_mode == ISOIEC) {
|
if (last_mode == ISOIEC) {
|
||||||
concat(binary_string, "00100"); /* Alphanumeric latch */
|
strcat(binary_string, "00100"); /* Alphanumeric latch */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1801,7 +1801,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
|||||||
|
|
||||||
mask = 0x10;
|
mask = 0x10;
|
||||||
for (j = 0; j < 5; j++) {
|
for (j = 0; j < 5; j++) {
|
||||||
concat(binary_string, (value & mask) ? "1" : "0");
|
strcat(binary_string, (value & mask) ? "1" : "0");
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1812,21 +1812,21 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
|||||||
|
|
||||||
mask = 0x20;
|
mask = 0x20;
|
||||||
for (j = 0; j < 6; j++) {
|
for (j = 0; j < 6; j++) {
|
||||||
concat(binary_string, (value & mask) ? "1" : "0");
|
strcat(binary_string, (value & mask) ? "1" : "0");
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
last_mode = ALPHA;
|
last_mode = ALPHA;
|
||||||
if (general_field[i] == '[') {
|
if (general_field[i] == '[') {
|
||||||
concat(binary_string, "01111");
|
strcat(binary_string, "01111");
|
||||||
last_mode = NUMERIC;
|
last_mode = NUMERIC;
|
||||||
} /* FNC1/Numeric latch */
|
} /* FNC1/Numeric latch */
|
||||||
if (general_field[i] == '*') concat(binary_string, "111010"); /* asterisk */
|
if (general_field[i] == '*') strcat(binary_string, "111010"); /* asterisk */
|
||||||
if (general_field[i] == ',') concat(binary_string, "111011"); /* comma */
|
if (general_field[i] == ',') strcat(binary_string, "111011"); /* comma */
|
||||||
if (general_field[i] == '-') concat(binary_string, "111100"); /* minus or hyphen */
|
if (general_field[i] == '-') strcat(binary_string, "111100"); /* minus or hyphen */
|
||||||
if (general_field[i] == '.') concat(binary_string, "111101"); /* period or full stop */
|
if (general_field[i] == '.') strcat(binary_string, "111101"); /* period or full stop */
|
||||||
if (general_field[i] == '/') concat(binary_string, "111110"); /* slash or solidus */
|
if (general_field[i] == '/') strcat(binary_string, "111110"); /* slash or solidus */
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
break;
|
break;
|
||||||
@ -1835,11 +1835,11 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
|||||||
if (debug) printf("as ISOIEC\n");
|
if (debug) printf("as ISOIEC\n");
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
if (last_mode == NUMERIC) {
|
if (last_mode == NUMERIC) {
|
||||||
concat(binary_string, "0000"); /* Alphanumeric latch */
|
strcat(binary_string, "0000"); /* Alphanumeric latch */
|
||||||
concat(binary_string, "00100"); /* ISO/IEC 646 latch */
|
strcat(binary_string, "00100"); /* ISO/IEC 646 latch */
|
||||||
}
|
}
|
||||||
if (last_mode == ALPHA) {
|
if (last_mode == ALPHA) {
|
||||||
concat(binary_string, "00100"); /* ISO/IEC 646 latch */
|
strcat(binary_string, "00100"); /* ISO/IEC 646 latch */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1849,7 +1849,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
|||||||
|
|
||||||
mask = 0x10;
|
mask = 0x10;
|
||||||
for (j = 0; j < 5; j++) {
|
for (j = 0; j < 5; j++) {
|
||||||
concat(binary_string, (value & mask) ? "1" : "0");
|
strcat(binary_string, (value & mask) ? "1" : "0");
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1860,7 +1860,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
|||||||
|
|
||||||
mask = 0x40;
|
mask = 0x40;
|
||||||
for (j = 0; j < 7; j++) {
|
for (j = 0; j < 7; j++) {
|
||||||
concat(binary_string, (value & mask) ? "1" : "0");
|
strcat(binary_string, (value & mask) ? "1" : "0");
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1871,37 +1871,37 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
|||||||
|
|
||||||
mask = 0x40;
|
mask = 0x40;
|
||||||
for (j = 0; j < 7; j++) {
|
for (j = 0; j < 7; j++) {
|
||||||
concat(binary_string, (value & mask) ? "1" : "0");
|
strcat(binary_string, (value & mask) ? "1" : "0");
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
last_mode = ISOIEC;
|
last_mode = ISOIEC;
|
||||||
if (general_field[i] == '[') {
|
if (general_field[i] == '[') {
|
||||||
concat(binary_string, "01111");
|
strcat(binary_string, "01111");
|
||||||
last_mode = NUMERIC;
|
last_mode = NUMERIC;
|
||||||
} /* FNC1/Numeric latch */
|
} /* FNC1/Numeric latch */
|
||||||
if (general_field[i] == '!') concat(binary_string, "11101000"); /* exclamation mark */
|
if (general_field[i] == '!') strcat(binary_string, "11101000"); /* exclamation mark */
|
||||||
if (general_field[i] == 34) concat(binary_string, "11101001"); /* quotation mark */
|
if (general_field[i] == 34) strcat(binary_string, "11101001"); /* quotation mark */
|
||||||
if (general_field[i] == 37) concat(binary_string, "11101010"); /* percent sign */
|
if (general_field[i] == 37) strcat(binary_string, "11101010"); /* percent sign */
|
||||||
if (general_field[i] == '&') concat(binary_string, "11101011"); /* ampersand */
|
if (general_field[i] == '&') strcat(binary_string, "11101011"); /* ampersand */
|
||||||
if (general_field[i] == 39) concat(binary_string, "11101100"); /* apostrophe */
|
if (general_field[i] == 39) strcat(binary_string, "11101100"); /* apostrophe */
|
||||||
if (general_field[i] == '(') concat(binary_string, "11101101"); /* left parenthesis */
|
if (general_field[i] == '(') strcat(binary_string, "11101101"); /* left parenthesis */
|
||||||
if (general_field[i] == ')') concat(binary_string, "11101110"); /* right parenthesis */
|
if (general_field[i] == ')') strcat(binary_string, "11101110"); /* right parenthesis */
|
||||||
if (general_field[i] == '*') concat(binary_string, "11101111"); /* asterisk */
|
if (general_field[i] == '*') strcat(binary_string, "11101111"); /* asterisk */
|
||||||
if (general_field[i] == '+') concat(binary_string, "11110000"); /* plus sign */
|
if (general_field[i] == '+') strcat(binary_string, "11110000"); /* plus sign */
|
||||||
if (general_field[i] == ',') concat(binary_string, "11110001"); /* comma */
|
if (general_field[i] == ',') strcat(binary_string, "11110001"); /* comma */
|
||||||
if (general_field[i] == '-') concat(binary_string, "11110010"); /* minus or hyphen */
|
if (general_field[i] == '-') strcat(binary_string, "11110010"); /* minus or hyphen */
|
||||||
if (general_field[i] == '.') concat(binary_string, "11110011"); /* period or full stop */
|
if (general_field[i] == '.') strcat(binary_string, "11110011"); /* period or full stop */
|
||||||
if (general_field[i] == '/') concat(binary_string, "11110100"); /* slash or solidus */
|
if (general_field[i] == '/') strcat(binary_string, "11110100"); /* slash or solidus */
|
||||||
if (general_field[i] == ':') concat(binary_string, "11110101"); /* colon */
|
if (general_field[i] == ':') strcat(binary_string, "11110101"); /* colon */
|
||||||
if (general_field[i] == ';') concat(binary_string, "11110110"); /* semicolon */
|
if (general_field[i] == ';') strcat(binary_string, "11110110"); /* semicolon */
|
||||||
if (general_field[i] == '<') concat(binary_string, "11110111"); /* less-than sign */
|
if (general_field[i] == '<') strcat(binary_string, "11110111"); /* less-than sign */
|
||||||
if (general_field[i] == '=') concat(binary_string, "11111000"); /* equals sign */
|
if (general_field[i] == '=') strcat(binary_string, "11111000"); /* equals sign */
|
||||||
if (general_field[i] == '>') concat(binary_string, "11111001"); /* greater-than sign */
|
if (general_field[i] == '>') strcat(binary_string, "11111001"); /* greater-than sign */
|
||||||
if (general_field[i] == '?') concat(binary_string, "11111010"); /* question mark */
|
if (general_field[i] == '?') strcat(binary_string, "11111010"); /* question mark */
|
||||||
if (general_field[i] == '_') concat(binary_string, "11111011"); /* underline or low line */
|
if (general_field[i] == '_') strcat(binary_string, "11111011"); /* underline or low line */
|
||||||
if (general_field[i] == ' ') concat(binary_string, "11111100"); /* space */
|
if (general_field[i] == ' ') strcat(binary_string, "11111100"); /* space */
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
break;
|
break;
|
||||||
@ -1929,7 +1929,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
|||||||
|
|
||||||
mask = 0x08;
|
mask = 0x08;
|
||||||
for (j = 0; j < 4; j++) {
|
for (j = 0; j < 4; j++) {
|
||||||
concat(binary_string, (value & mask) ? "1" : "0");
|
strcat(binary_string, (value & mask) ? "1" : "0");
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1940,7 +1940,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
|||||||
|
|
||||||
mask = 0x40;
|
mask = 0x40;
|
||||||
for (j = 0; j < 7; j++) {
|
for (j = 0; j < 7; j++) {
|
||||||
concat(binary_string, (value & mask) ? "1" : "0");
|
strcat(binary_string, (value & mask) ? "1" : "0");
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1949,7 +1949,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
|||||||
|
|
||||||
mask = 0x10;
|
mask = 0x10;
|
||||||
for (j = 0; j < 5; j++) {
|
for (j = 0; j < 5; j++) {
|
||||||
concat(binary_string, (value & mask) ? "1" : "0");
|
strcat(binary_string, (value & mask) ? "1" : "0");
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1979,11 +1979,11 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
|||||||
strcpy(padstring, "");
|
strcpy(padstring, "");
|
||||||
}
|
}
|
||||||
for (; i > 0; i -= 5) {
|
for (; i > 0; i -= 5) {
|
||||||
concat(padstring, "00100");
|
strcat(padstring, "00100");
|
||||||
}
|
}
|
||||||
|
|
||||||
padstring[remainder] = '\0';
|
padstring[remainder] = '\0';
|
||||||
concat(binary_string, padstring);
|
strcat(binary_string, padstring);
|
||||||
|
|
||||||
/* Patch variable length symbol bit field */
|
/* Patch variable length symbol bit field */
|
||||||
d1 = ((strlen(binary_string) / 12) + 1) & 1;
|
d1 = ((strlen(binary_string) / 12) + 1) & 1;
|
||||||
@ -2011,7 +2011,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* GS1 DataBar Expanded */
|
/* GS1 DataBar Expanded */
|
||||||
int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
||||||
int i, j, k, l, p, data_chars, vs[21], group[21], v_odd[21], v_even[21];
|
int i, j, k, l, p, data_chars, vs[21], group[21], v_odd[21], v_even[21];
|
||||||
char substring[21][14], latch;
|
char substring[21][14], latch;
|
||||||
int char_widths[21][8], checksum, check_widths[8], c_group;
|
int char_widths[21][8], checksum, check_widths[8], c_group;
|
||||||
@ -2047,9 +2047,9 @@ int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len)
|
|||||||
strcpy(binary_string, "");
|
strcpy(binary_string, "");
|
||||||
|
|
||||||
if (symbol->option_1 == 2) {
|
if (symbol->option_1 == 2) {
|
||||||
concat(binary_string, "1");
|
strcat(binary_string, "1");
|
||||||
} else {
|
} else {
|
||||||
concat(binary_string, "0");
|
strcat(binary_string, "0");
|
||||||
}
|
}
|
||||||
|
|
||||||
i = rss_binary_string(symbol, reduced, binary_string);
|
i = rss_binary_string(symbol, reduced, binary_string);
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <math.h>
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#define SSET "0123456789ABCDEF"
|
#define SSET "0123456789ABCDEF"
|
||||||
@ -178,9 +179,9 @@ int svg_plot(struct zint_symbol *symbol) {
|
|||||||
fprintf(fsvg, "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n");
|
fprintf(fsvg, "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n");
|
||||||
fprintf(fsvg, " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n");
|
fprintf(fsvg, " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n");
|
||||||
if (symbol->symbology != BARCODE_MAXICODE) {
|
if (symbol->symbology != BARCODE_MAXICODE) {
|
||||||
fprintf(fsvg, "<svg width=\"%d\" height=\"%d\" version=\"1.1\"\n", roundup((symbol->width + xoffset + xoffset) * scaler), roundup((symbol->height + textoffset + yoffset + yoffset) * scaler));
|
fprintf(fsvg, "<svg width=\"%d\" height=\"%d\" version=\"1.1\"\n", (int)ceil((symbol->width + xoffset + xoffset) * scaler), (int)ceil((symbol->height + textoffset + yoffset + yoffset) * scaler));
|
||||||
} else {
|
} else {
|
||||||
fprintf(fsvg, "<svg width=\"%d\" height=\"%d\" version=\"1.1\"\n", roundup((74.0 + xoffset + xoffset) * scaler), roundup((72.0 + yoffset + yoffset) * scaler));
|
fprintf(fsvg, "<svg width=\"%d\" height=\"%d\" version=\"1.1\"\n", (int)ceil((74.0F + xoffset + xoffset) * scaler), (int)ceil((72.0F + yoffset + yoffset) * scaler));
|
||||||
}
|
}
|
||||||
fprintf(fsvg, " xmlns=\"http://www.w3.org/2000/svg\">\n");
|
fprintf(fsvg, " xmlns=\"http://www.w3.org/2000/svg\">\n");
|
||||||
if (ustrlen(symbol->text) != 0) {
|
if (ustrlen(symbol->text) != 0) {
|
||||||
@ -192,9 +193,9 @@ int svg_plot(struct zint_symbol *symbol) {
|
|||||||
fprintf(fsvg, "\n <g id=\"barcode\" fill=\"#%s\">\n", symbol->fgcolour);
|
fprintf(fsvg, "\n <g id=\"barcode\" fill=\"#%s\">\n", symbol->fgcolour);
|
||||||
|
|
||||||
if (symbol->symbology != BARCODE_MAXICODE) {
|
if (symbol->symbology != BARCODE_MAXICODE) {
|
||||||
fprintf(fsvg, " <rect x=\"0\" y=\"0\" width=\"%d\" height=\"%d\" fill=\"#%s\" />\n", roundup((symbol->width + xoffset + xoffset) * scaler), roundup((symbol->height + textoffset + yoffset + yoffset) * scaler), symbol->bgcolour);
|
fprintf(fsvg, " <rect x=\"0\" y=\"0\" width=\"%d\" height=\"%d\" fill=\"#%s\" />\n", (int)ceil((symbol->width + xoffset + xoffset) * scaler), (int)ceil((symbol->height + textoffset + yoffset + yoffset) * scaler), symbol->bgcolour);
|
||||||
} else {
|
} else {
|
||||||
fprintf(fsvg, " <rect x=\"0\" y=\"0\" width=\"%d\" height=\"%d\" fill=\"#%s\" />\n", roundup((74.0 + xoffset + xoffset) * scaler), roundup((72.0 + yoffset + yoffset) * scaler), symbol->bgcolour);
|
fprintf(fsvg, " <rect x=\"0\" y=\"0\" width=\"%d\" height=\"%d\" fill=\"#%s\" />\n", (int)ceil((74.0F + xoffset + xoffset) * scaler), (int)ceil((72.0F + yoffset + yoffset) * scaler), symbol->bgcolour);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((symbol->output_options & BARCODE_BOX) != 0) || ((symbol->output_options & BARCODE_BIND) != 0)) {
|
if (((symbol->output_options & BARCODE_BOX) != 0) || ((symbol->output_options & BARCODE_BIND) != 0)) {
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
static char *TeleTable[] ={
|
static char *TeleTable[] = {
|
||||||
"1111111111111111", "1131313111", "33313111", "1111313131", "3111313111", "11333131", "13133131", "111111313111",
|
"1111111111111111", "1131313111", "33313111", "1111313131", "3111313111", "11333131", "13133131", "111111313111",
|
||||||
"31333111", "1131113131", "33113131", "1111333111", "3111113131", "1113133111", "1311133111", "111111113131",
|
"31333111", "1131113131", "33113131", "1111333111", "3111113131", "1113133111", "1311133111", "111111113131",
|
||||||
"3131113111", "11313331", "333331", "111131113111", "31113331", "1133113111", "1313113111", "1111113331",
|
"3131113111", "11313331", "333331", "111131113111", "31113331", "1133113111", "1313113111", "1111113331",
|
||||||
@ -78,7 +78,7 @@ int telepen(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
|||||||
strcpy(symbol->errtxt, "Invalid characters in input data");
|
strcpy(symbol->errtxt, "Invalid characters in input data");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
concat(dest, TeleTable[source[i]]);
|
strcat(dest, TeleTable[source[i]]);
|
||||||
count += source[i];
|
count += source[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,10 +86,10 @@ int telepen(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
|||||||
if (check_digit == 127) {
|
if (check_digit == 127) {
|
||||||
check_digit = 0;
|
check_digit = 0;
|
||||||
}
|
}
|
||||||
concat(dest, TeleTable[check_digit]);
|
strcat(dest, TeleTable[check_digit]);
|
||||||
|
|
||||||
/* Stop character */
|
/* Stop character */
|
||||||
concat(dest, TeleTable['z']);
|
strcat(dest, TeleTable['z']);
|
||||||
|
|
||||||
expand(symbol, dest);
|
expand(symbol, dest);
|
||||||
for (i = 0; i < src_len; i++) {
|
for (i = 0; i < src_len; i++) {
|
||||||
@ -149,17 +149,17 @@ int telepen_num(struct zint_symbol *symbol, unsigned char source[], int src_len)
|
|||||||
glyph += 27;
|
glyph += 27;
|
||||||
count += glyph;
|
count += glyph;
|
||||||
}
|
}
|
||||||
concat(dest, TeleTable[glyph]);
|
strcat(dest, TeleTable[glyph]);
|
||||||
}
|
}
|
||||||
|
|
||||||
check_digit = 127 - (count % 127);
|
check_digit = 127 - (count % 127);
|
||||||
if (check_digit == 127) {
|
if (check_digit == 127) {
|
||||||
check_digit = 0;
|
check_digit = 0;
|
||||||
}
|
}
|
||||||
concat(dest, TeleTable[check_digit]);
|
strcat(dest, TeleTable[check_digit]);
|
||||||
|
|
||||||
/* Stop character */
|
/* Stop character */
|
||||||
concat(dest, TeleTable['z']);
|
strcat(dest, TeleTable['z']);
|
||||||
|
|
||||||
expand(symbol, dest);
|
expand(symbol, dest);
|
||||||
ustrcpy(symbol->text, temp);
|
ustrcpy(symbol->text, temp);
|
||||||
|
@ -50,7 +50,7 @@ static const char *UPCParity1[10] = {
|
|||||||
/* Not covered by BS EN 797:1995 */
|
/* Not covered by BS EN 797:1995 */
|
||||||
"AAABBB", "AABABB", "AABBAB", "AABBBA", "ABAABB", "ABBAAB", "ABBBAA",
|
"AAABBB", "AABABB", "AABBAB", "AABBBA", "ABAABB", "ABBAAB", "ABBBAA",
|
||||||
"ABABAB", "ABABBA", "ABBABA"
|
"ABABAB", "ABABBA", "ABBABA"
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *EAN2Parity[4] = {
|
static const char *EAN2Parity[4] = {
|
||||||
/* Number sets for 2-digit add-on (EN Table 6) */
|
/* Number sets for 2-digit add-on (EN Table 6) */
|
||||||
@ -71,16 +71,16 @@ static const char *EAN13Parity[10] = {
|
|||||||
|
|
||||||
static const char *EANsetA[10] = {
|
static const char *EANsetA[10] = {
|
||||||
/* Representation set A and C (EN Table 1) */
|
/* Representation set A and C (EN Table 1) */
|
||||||
"3211", "2221", "2122", "1411", "1132", "1231", "1114", "1312", "1213","3112"
|
"3211", "2221", "2122", "1411", "1132", "1231", "1114", "1312", "1213", "3112"
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *EANsetB[10] = {
|
static const char *EANsetB[10] = {
|
||||||
/* Representation set B (EN Table 1) */
|
/* Representation set B (EN Table 1) */
|
||||||
"1123", "1222", "2212", "1141", "2311", "1321", "4111", "2131", "3121", "2113"
|
"1123", "1222", "2212", "1141", "2311", "1321", "4111", "2131", "3121", "2113"
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Calculate the correct check digit for a UPC barcode */
|
/* Calculate the correct check digit for a UPC barcode */
|
||||||
char upc_check(char source[]) {
|
char upc_check(char source[]) {
|
||||||
unsigned int i, count, check_digit;
|
unsigned int i, count, check_digit;
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
@ -101,30 +101,30 @@ char upc_check(char source[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* UPC A is usually used for 12 digit numbers, but this function takes a source of any length */
|
/* UPC A is usually used for 12 digit numbers, but this function takes a source of any length */
|
||||||
void upca_draw(char source[], char dest[]) {
|
void upca_draw(char source[], char dest[]) {
|
||||||
unsigned int i, half_way;
|
unsigned int i, half_way;
|
||||||
|
|
||||||
half_way = strlen(source) / 2;
|
half_way = strlen(source) / 2;
|
||||||
|
|
||||||
/* start character */
|
/* start character */
|
||||||
concat(dest, "111");
|
strcat(dest, "111");
|
||||||
|
|
||||||
for (i = 0; i <= strlen(source); i++) {
|
for (i = 0; i <= strlen(source); i++) {
|
||||||
if (i == half_way) {
|
if (i == half_way) {
|
||||||
/* middle character - separates manufacturer no. from product no. */
|
/* middle character - separates manufacturer no. from product no. */
|
||||||
/* also inverts right hand characters */
|
/* also inverts right hand characters */
|
||||||
concat(dest, "11111");
|
strcat(dest, "11111");
|
||||||
}
|
}
|
||||||
|
|
||||||
lookup(NEON, EANsetA, source[i], dest);
|
lookup(NEON, EANsetA, source[i], dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* stop character */
|
/* stop character */
|
||||||
concat(dest, "111");
|
strcat(dest, "111");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make a UPC A barcode when we haven't been given the check digit */
|
/* Make a UPC A barcode when we haven't been given the check digit */
|
||||||
void upca(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
void upca(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
||||||
int length;
|
int length;
|
||||||
char gtin[15];
|
char gtin[15];
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ void upca(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* UPC E is a zero-compressed version of UPC A */
|
/* UPC E is a zero-compressed version of UPC A */
|
||||||
void upce(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
void upce(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
||||||
unsigned int i, num_system;
|
unsigned int i, num_system;
|
||||||
char emode, equivalent[12], check_digit, parity[8], temp[8];
|
char emode, equivalent[12], check_digit, parity[8], temp[8];
|
||||||
char hrt[9];
|
char hrt[9];
|
||||||
@ -162,7 +162,7 @@ void upce(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
|||||||
num_system = 0;
|
num_system = 0;
|
||||||
hrt[0] = '0';
|
hrt[0] = '0';
|
||||||
hrt[1] = '\0';
|
hrt[1] = '\0';
|
||||||
concat(hrt, (char*) source);
|
strcat(hrt, (char*) source);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Expand the zero-compressed UPCE code to make a UPCA equivalent (EN Table 5) */
|
/* Expand the zero-compressed UPCE code to make a UPCA equivalent (EN Table 5) */
|
||||||
@ -234,7 +234,7 @@ void upce(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
|||||||
/* Take all this information and make the barcode pattern */
|
/* Take all this information and make the barcode pattern */
|
||||||
|
|
||||||
/* start character */
|
/* start character */
|
||||||
concat(dest, "111");
|
strcat(dest, "111");
|
||||||
|
|
||||||
for (i = 0; i <= ustrlen(source); i++) {
|
for (i = 0; i <= ustrlen(source); i++) {
|
||||||
switch (parity[i]) {
|
switch (parity[i]) {
|
||||||
@ -246,7 +246,7 @@ void upce(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* stop character */
|
/* stop character */
|
||||||
concat(dest, "111111");
|
strcat(dest, "111111");
|
||||||
|
|
||||||
hrt[7] = check_digit;
|
hrt[7] = check_digit;
|
||||||
hrt[8] = '\0';
|
hrt[8] = '\0';
|
||||||
@ -254,17 +254,17 @@ void upce(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* EAN-2 and EAN-5 add-on codes */
|
/* EAN-2 and EAN-5 add-on codes */
|
||||||
void add_on(unsigned char source[], char dest[], int mode) {
|
void add_on(unsigned char source[], char dest[], int mode) {
|
||||||
char parity[6];
|
char parity[6];
|
||||||
unsigned int i, code_type;
|
unsigned int i, code_type;
|
||||||
|
|
||||||
/* If an add-on then append with space */
|
/* If an add-on then append with space */
|
||||||
if (mode != 0) {
|
if (mode != 0) {
|
||||||
concat(dest, "9");
|
strcat(dest, "9");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Start character */
|
/* Start character */
|
||||||
concat(dest, "112");
|
strcat(dest, "112");
|
||||||
|
|
||||||
/* Determine EAN2 or EAN5 add-on */
|
/* Determine EAN2 or EAN5 add-on */
|
||||||
if (ustrlen(source) == 2) {
|
if (ustrlen(source) == 2) {
|
||||||
@ -306,14 +306,15 @@ void add_on(unsigned char source[], char dest[], int mode) {
|
|||||||
|
|
||||||
/* Glyph separator */
|
/* Glyph separator */
|
||||||
if (i != (ustrlen(source) - 1)) {
|
if (i != (ustrlen(source) - 1)) {
|
||||||
concat(dest, "11");
|
strcat(dest, "11");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************ EAN-13 ****************** */
|
/* ************************ EAN-13 ****************** */
|
||||||
|
|
||||||
/* Calculate the correct check digit for a EAN-13 barcode */
|
/* Calculate the correct check digit for a EAN-13 barcode */
|
||||||
char ean_check(char source[]) {
|
char ean_check(char source[]) {
|
||||||
int i;
|
int i;
|
||||||
unsigned int h, count, check_digit;
|
unsigned int h, count, check_digit;
|
||||||
|
|
||||||
@ -354,13 +355,13 @@ void ean13(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
|||||||
half_way = 7;
|
half_way = 7;
|
||||||
|
|
||||||
/* start character */
|
/* start character */
|
||||||
concat(dest, "111");
|
strcat(dest, "111");
|
||||||
length = strlen(gtin);
|
length = strlen(gtin);
|
||||||
for (i = 1; i <= length; i++) {
|
for (i = 1; i <= length; i++) {
|
||||||
if (i == half_way) {
|
if (i == half_way) {
|
||||||
/* middle character - separates manufacturer no. from product no. */
|
/* middle character - separates manufacturer no. from product no. */
|
||||||
/* also inverses right hand characters */
|
/* also inverses right hand characters */
|
||||||
concat(dest, "11111");
|
strcat(dest, "11111");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((i > 1) && (i < 7)) && (parity[i - 2] == 'B')) {
|
if (((i > 1) && (i < 7)) && (parity[i - 2] == 'B')) {
|
||||||
@ -371,13 +372,13 @@ void ean13(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* stop character */
|
/* stop character */
|
||||||
concat(dest, "111");
|
strcat(dest, "111");
|
||||||
|
|
||||||
ustrcpy(symbol->text, (unsigned char*) gtin);
|
ustrcpy(symbol->text, (unsigned char*) gtin);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make an EAN-8 barcode when we haven't been given the check digit */
|
/* Make an EAN-8 barcode when we haven't been given the check digit */
|
||||||
void ean8(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
void ean8(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
||||||
/* EAN-8 is basically the same as UPC-A but with fewer digits */
|
/* EAN-8 is basically the same as UPC-A but with fewer digits */
|
||||||
int length;
|
int length;
|
||||||
char gtin[10];
|
char gtin[10];
|
||||||
@ -599,19 +600,19 @@ void ean_leading_zeroes(struct zint_symbol *symbol, unsigned char source[], unsi
|
|||||||
|
|
||||||
/* Add leading zeroes */
|
/* Add leading zeroes */
|
||||||
for (i = 0; i < (zfirst_len - first_len); i++) {
|
for (i = 0; i < (zfirst_len - first_len); i++) {
|
||||||
uconcat(zfirst_part, (unsigned char *) "0");
|
strcat((char*) zfirst_part, "0");
|
||||||
}
|
}
|
||||||
uconcat(zfirst_part, first_part);
|
strcat((char*) zfirst_part, (char*) first_part);
|
||||||
for (i = 0; i < (zsecond_len - second_len); i++) {
|
for (i = 0; i < (zsecond_len - second_len); i++) {
|
||||||
uconcat(zsecond_part, (unsigned char *) "0");
|
strcat((char*) zsecond_part, "0");
|
||||||
}
|
}
|
||||||
uconcat(zsecond_part, second_part);
|
strcat((char*) zsecond_part, (char*) second_part);
|
||||||
|
|
||||||
/* Copy adjusted data back to local_source */
|
/* Copy adjusted data back to local_source */
|
||||||
uconcat(local_source, zfirst_part);
|
strcat((char*) local_source, (char*) zfirst_part);
|
||||||
if (zsecond_len != 0) {
|
if (zsecond_len != 0) {
|
||||||
uconcat(local_source, (unsigned char *) "+");
|
strcat((char*) local_source, "+");
|
||||||
uconcat(local_source, zsecond_part);
|
strcat((char*) local_source, (char*) zsecond_part);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -794,13 +795,13 @@ int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
|||||||
case 0: break;
|
case 0: break;
|
||||||
case 2:
|
case 2:
|
||||||
add_on(second_part, (char*) dest, 1);
|
add_on(second_part, (char*) dest, 1);
|
||||||
uconcat(symbol->text, (unsigned char*) "+");
|
strcat((char*) symbol->text, "+");
|
||||||
uconcat(symbol->text, second_part);
|
strcat((char*) symbol->text, (char*) second_part);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
add_on(second_part, (char*) dest, 1);
|
add_on(second_part, (char*) dest, 1);
|
||||||
uconcat(symbol->text, (unsigned char*) "+");
|
strcat((char*) symbol->text, "+");
|
||||||
uconcat(symbol->text, second_part);
|
strcat((char*) symbol->text, (char*) second_part);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
strcpy(symbol->errtxt, "Invalid length input");
|
strcpy(symbol->errtxt, "Invalid length input");
|
||||||
|
Loading…
Reference in New Issue
Block a user