mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Initial FNC1 bug correction
This commit is contained in:
parent
8a71220ed6
commit
4de53b3e09
102
backend/aztec.c
102
backend/aztec.c
@ -52,20 +52,22 @@ int aztec_text_process(unsigned char source[], char binary_string[], int gs1)
|
|||||||
int i, j, k, bytes;
|
int i, j, k, bytes;
|
||||||
int charmap[ustrlen(source)], typemap[ustrlen(source)], maplength;
|
int charmap[ustrlen(source)], typemap[ustrlen(source)], maplength;
|
||||||
int curtable, newtable, lasttable, chartype;
|
int curtable, newtable, lasttable, chartype;
|
||||||
int blockmap[2][ustrlen(source)], blocks;
|
int blockmap[2][ustrlen(source)], blocks, debug;
|
||||||
|
|
||||||
/* Lookup input string in encoding table */
|
/* Lookup input string in encoding table */
|
||||||
maplength = 0;
|
maplength = 0;
|
||||||
if((gs1) && (i == 0)) {
|
debug = 0;
|
||||||
/* Add FNC1 to beginning of GS1 messages */
|
|
||||||
charmap[maplength] = 0;
|
|
||||||
typemap[maplength] = 8;
|
|
||||||
maplength++;
|
|
||||||
charmap[maplength] = 400;
|
|
||||||
typemap[maplength] = 8;
|
|
||||||
maplength++;
|
|
||||||
}
|
|
||||||
for(i = 0; i < ustrlen(source); i++) {
|
for(i = 0; i < ustrlen(source); i++) {
|
||||||
|
if(gs1 && (i == 0)) {
|
||||||
|
/* Add FNC1 to beginning of GS1 messages */
|
||||||
|
charmap[maplength] = 0;
|
||||||
|
typemap[maplength] = PUNC;
|
||||||
|
maplength++;
|
||||||
|
charmap[maplength] = 400;
|
||||||
|
typemap[maplength] = PUNC;
|
||||||
|
maplength++;
|
||||||
|
}
|
||||||
if(source[i] > 127) {
|
if(source[i] > 127) {
|
||||||
charmap[maplength] = source[i];
|
charmap[maplength] = source[i];
|
||||||
typemap[maplength] = BINARY;
|
typemap[maplength] = BINARY;
|
||||||
@ -76,10 +78,10 @@ int aztec_text_process(unsigned char source[], char binary_string[], int gs1)
|
|||||||
if((gs1) && (source[i] == '[')) {
|
if((gs1) && (source[i] == '[')) {
|
||||||
/* FNC1 represented by FLG(0) */
|
/* FNC1 represented by FLG(0) */
|
||||||
charmap[maplength] = 0;
|
charmap[maplength] = 0;
|
||||||
typemap[maplength] = 8;
|
typemap[maplength] = PUNC;
|
||||||
maplength++;
|
maplength++;
|
||||||
charmap[maplength] = 400;
|
charmap[maplength] = 400;
|
||||||
typemap[maplength] = 8;
|
typemap[maplength] = PUNC;
|
||||||
}
|
}
|
||||||
maplength++;
|
maplength++;
|
||||||
}
|
}
|
||||||
@ -205,7 +207,7 @@ int aztec_text_process(unsigned char source[], char binary_string[], int gs1)
|
|||||||
|
|
||||||
/* Problem characters (those that appear in different tables with different values) can now be resolved into their tables */
|
/* Problem characters (those that appear in different tables with different values) can now be resolved into their tables */
|
||||||
for(i = 0; i < maplength; i++) {
|
for(i = 0; i < maplength; i++) {
|
||||||
if(charmap[i] >= 300) {
|
if((charmap[i] >= 300) && (charmap[i] < 400)) {
|
||||||
curtable = typemap[i];
|
curtable = typemap[i];
|
||||||
if(curtable > 64) {
|
if(curtable > 64) {
|
||||||
curtable -= 64;
|
curtable -= 64;
|
||||||
@ -241,7 +243,7 @@ int aztec_text_process(unsigned char source[], char binary_string[], int gs1)
|
|||||||
lasttable = UPPER;
|
lasttable = UPPER;
|
||||||
for(i = 0; i < maplength; i++) {
|
for(i = 0; i < maplength; i++) {
|
||||||
newtable = curtable;
|
newtable = curtable;
|
||||||
if(typemap[i] != curtable) {
|
if((typemap[i] != curtable) && (charmap[i] < 400)) {
|
||||||
/* Change table */
|
/* Change table */
|
||||||
if(curtable == BINARY) {
|
if(curtable == BINARY) {
|
||||||
/* If ending binary mode the current table is the same as when entering binary mode */
|
/* If ending binary mode the current table is the same as when entering binary mode */
|
||||||
@ -255,17 +257,21 @@ int aztec_text_process(unsigned char source[], char binary_string[], int gs1)
|
|||||||
switch(curtable) {
|
switch(curtable) {
|
||||||
case LOWER: /* US */
|
case LOWER: /* US */
|
||||||
concat(binary_string, hexbit[28]);
|
concat(binary_string, hexbit[28]);
|
||||||
|
if(debug) printf("US ");
|
||||||
break;
|
break;
|
||||||
case MIXED: /* UL */
|
case MIXED: /* UL */
|
||||||
concat(binary_string, hexbit[29]);
|
concat(binary_string, hexbit[29]);
|
||||||
|
if(debug) printf("UL ");
|
||||||
newtable = UPPER;
|
newtable = UPPER;
|
||||||
break;
|
break;
|
||||||
case PUNC: /* UL */
|
case PUNC: /* UL */
|
||||||
concat(binary_string, hexbit[31]);
|
concat(binary_string, hexbit[31]);
|
||||||
|
if(debug) printf("UL ");
|
||||||
newtable = UPPER;
|
newtable = UPPER;
|
||||||
break;
|
break;
|
||||||
case DIGIT: /* US */
|
case DIGIT: /* US */
|
||||||
concat(binary_string, pentbit[15]);
|
concat(binary_string, pentbit[15]);
|
||||||
|
if(debug) printf("US ");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -273,20 +279,26 @@ int aztec_text_process(unsigned char source[], char binary_string[], int gs1)
|
|||||||
switch(curtable) {
|
switch(curtable) {
|
||||||
case UPPER: /* LL */
|
case UPPER: /* LL */
|
||||||
concat(binary_string, hexbit[28]);
|
concat(binary_string, hexbit[28]);
|
||||||
|
if(debug) printf("LL ");
|
||||||
newtable = LOWER;
|
newtable = LOWER;
|
||||||
break;
|
break;
|
||||||
case MIXED: /* LL */
|
case MIXED: /* LL */
|
||||||
concat(binary_string, hexbit[28]);
|
concat(binary_string, hexbit[28]);
|
||||||
|
if(debug) printf("LL ");
|
||||||
newtable = LOWER;
|
newtable = LOWER;
|
||||||
break;
|
break;
|
||||||
case PUNC: /* UL LL */
|
case PUNC: /* UL LL */
|
||||||
concat(binary_string, hexbit[31]);
|
concat(binary_string, hexbit[31]);
|
||||||
|
if(debug) printf("UL ");
|
||||||
concat(binary_string, hexbit[28]);
|
concat(binary_string, hexbit[28]);
|
||||||
|
if(debug) printf("LL ");
|
||||||
newtable = LOWER;
|
newtable = LOWER;
|
||||||
break;
|
break;
|
||||||
case DIGIT: /* UL LL */
|
case DIGIT: /* UL LL */
|
||||||
concat(binary_string, pentbit[14]);
|
concat(binary_string, pentbit[14]);
|
||||||
|
if(debug) printf("UL ");
|
||||||
concat(binary_string, hexbit[28]);
|
concat(binary_string, hexbit[28]);
|
||||||
|
if(debug) printf("LL ");
|
||||||
newtable = LOWER;
|
newtable = LOWER;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -295,20 +307,26 @@ int aztec_text_process(unsigned char source[], char binary_string[], int gs1)
|
|||||||
switch(curtable) {
|
switch(curtable) {
|
||||||
case UPPER: /* ML */
|
case UPPER: /* ML */
|
||||||
concat(binary_string, hexbit[29]);
|
concat(binary_string, hexbit[29]);
|
||||||
|
if(debug) printf("ML ");
|
||||||
newtable = MIXED;
|
newtable = MIXED;
|
||||||
break;
|
break;
|
||||||
case LOWER: /* ML */
|
case LOWER: /* ML */
|
||||||
concat(binary_string, hexbit[29]);
|
concat(binary_string, hexbit[29]);
|
||||||
|
if(debug) printf("ML ");
|
||||||
newtable = MIXED;
|
newtable = MIXED;
|
||||||
break;
|
break;
|
||||||
case PUNC: /* UL ML */
|
case PUNC: /* UL ML */
|
||||||
concat(binary_string, hexbit[31]);
|
concat(binary_string, hexbit[31]);
|
||||||
|
if(debug) printf("UL ");
|
||||||
concat(binary_string, hexbit[29]);
|
concat(binary_string, hexbit[29]);
|
||||||
|
if(debug) printf("ML ");
|
||||||
newtable = MIXED;
|
newtable = MIXED;
|
||||||
break;
|
break;
|
||||||
case DIGIT: /* UL ML */
|
case DIGIT: /* UL ML */
|
||||||
concat(binary_string, pentbit[14]);
|
concat(binary_string, pentbit[14]);
|
||||||
|
if(debug) printf("UL ");
|
||||||
concat(binary_string, hexbit[29]);
|
concat(binary_string, hexbit[29]);
|
||||||
|
if(debug) printf("ML ");
|
||||||
newtable = MIXED;
|
newtable = MIXED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -317,15 +335,19 @@ int aztec_text_process(unsigned char source[], char binary_string[], int gs1)
|
|||||||
switch(curtable) {
|
switch(curtable) {
|
||||||
case UPPER: /* PS */
|
case UPPER: /* PS */
|
||||||
concat(binary_string, hexbit[0]);
|
concat(binary_string, hexbit[0]);
|
||||||
|
if(debug) printf("PS ");
|
||||||
break;
|
break;
|
||||||
case LOWER: /* PS */
|
case LOWER: /* PS */
|
||||||
concat(binary_string, hexbit[0]);
|
concat(binary_string, hexbit[0]);
|
||||||
|
if(debug) printf("PS ");
|
||||||
break;
|
break;
|
||||||
case MIXED: /* PS */
|
case MIXED: /* PS */
|
||||||
concat(binary_string, hexbit[0]);
|
concat(binary_string, hexbit[0]);
|
||||||
|
if(debug) printf("PS ");
|
||||||
break;
|
break;
|
||||||
case DIGIT: /* PS */
|
case DIGIT: /* PS */
|
||||||
concat(binary_string, pentbit[0]);
|
concat(binary_string, pentbit[0]);
|
||||||
|
if(debug) printf("PS ");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -333,20 +355,26 @@ int aztec_text_process(unsigned char source[], char binary_string[], int gs1)
|
|||||||
switch(curtable) {
|
switch(curtable) {
|
||||||
case UPPER: /* DL */
|
case UPPER: /* DL */
|
||||||
concat(binary_string, hexbit[30]);
|
concat(binary_string, hexbit[30]);
|
||||||
|
if(debug) printf("DL ");
|
||||||
newtable = DIGIT;
|
newtable = DIGIT;
|
||||||
break;
|
break;
|
||||||
case LOWER: /* DL */
|
case LOWER: /* DL */
|
||||||
concat(binary_string, hexbit[30]);
|
concat(binary_string, hexbit[30]);
|
||||||
|
if(debug) printf("DL ");
|
||||||
newtable = DIGIT;
|
newtable = DIGIT;
|
||||||
break;
|
break;
|
||||||
case MIXED: /* UL DL */
|
case MIXED: /* UL DL */
|
||||||
concat(binary_string, hexbit[29]);
|
concat(binary_string, hexbit[29]);
|
||||||
|
if(debug) printf("UL ");
|
||||||
concat(binary_string, hexbit[30]);
|
concat(binary_string, hexbit[30]);
|
||||||
|
if(debug) printf("DL ");
|
||||||
newtable = DIGIT;
|
newtable = DIGIT;
|
||||||
break;
|
break;
|
||||||
case PUNC: /* UL DL */
|
case PUNC: /* UL DL */
|
||||||
concat(binary_string, hexbit[31]);
|
concat(binary_string, hexbit[31]);
|
||||||
|
if(debug) printf("UL ");
|
||||||
concat(binary_string, hexbit[30]);
|
concat(binary_string, hexbit[30]);
|
||||||
|
if(debug) printf("DL ");
|
||||||
newtable = DIGIT;
|
newtable = DIGIT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -359,19 +387,24 @@ int aztec_text_process(unsigned char source[], char binary_string[], int gs1)
|
|||||||
switch(curtable) {
|
switch(curtable) {
|
||||||
case LOWER: /* ML UL */
|
case LOWER: /* ML UL */
|
||||||
concat(binary_string, hexbit[29]);
|
concat(binary_string, hexbit[29]);
|
||||||
|
if(debug) printf("ML ");
|
||||||
concat(binary_string, hexbit[29]);
|
concat(binary_string, hexbit[29]);
|
||||||
|
if(debug) printf("UL ");
|
||||||
newtable = UPPER;
|
newtable = UPPER;
|
||||||
break;
|
break;
|
||||||
case MIXED: /* UL */
|
case MIXED: /* UL */
|
||||||
concat(binary_string, hexbit[29]);
|
concat(binary_string, hexbit[29]);
|
||||||
|
if(debug) printf("UL ");
|
||||||
newtable = UPPER;
|
newtable = UPPER;
|
||||||
break;
|
break;
|
||||||
case PUNC: /* UL */
|
case PUNC: /* UL */
|
||||||
concat(binary_string, hexbit[31]);
|
concat(binary_string, hexbit[31]);
|
||||||
|
if(debug) printf("UL ");
|
||||||
newtable = UPPER;
|
newtable = UPPER;
|
||||||
break;
|
break;
|
||||||
case DIGIT: /* UL */
|
case DIGIT: /* UL */
|
||||||
concat(binary_string, pentbit[14]);
|
concat(binary_string, pentbit[14]);
|
||||||
|
if(debug) printf("UL ");
|
||||||
newtable = UPPER;
|
newtable = UPPER;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -380,20 +413,26 @@ int aztec_text_process(unsigned char source[], char binary_string[], int gs1)
|
|||||||
switch(curtable) {
|
switch(curtable) {
|
||||||
case UPPER: /* LL */
|
case UPPER: /* LL */
|
||||||
concat(binary_string, hexbit[28]);
|
concat(binary_string, hexbit[28]);
|
||||||
|
if(debug) printf("LL ");
|
||||||
newtable = LOWER;
|
newtable = LOWER;
|
||||||
break;
|
break;
|
||||||
case MIXED: /* LL */
|
case MIXED: /* LL */
|
||||||
concat(binary_string, hexbit[28]);
|
concat(binary_string, hexbit[28]);
|
||||||
|
if(debug) printf("LL ");
|
||||||
newtable = LOWER;
|
newtable = LOWER;
|
||||||
break;
|
break;
|
||||||
case PUNC: /* UL LL */
|
case PUNC: /* UL LL */
|
||||||
concat(binary_string, hexbit[31]);
|
concat(binary_string, hexbit[31]);
|
||||||
|
if(debug) printf("UL ");
|
||||||
concat(binary_string, hexbit[28]);
|
concat(binary_string, hexbit[28]);
|
||||||
|
if(debug) printf("LL ");
|
||||||
newtable = LOWER;
|
newtable = LOWER;
|
||||||
break;
|
break;
|
||||||
case DIGIT: /* UL LL */
|
case DIGIT: /* UL LL */
|
||||||
concat(binary_string, pentbit[14]);
|
concat(binary_string, pentbit[14]);
|
||||||
|
if(debug) printf("UL ");
|
||||||
concat(binary_string, hexbit[28]);
|
concat(binary_string, hexbit[28]);
|
||||||
|
if(debug) printf("LL ");
|
||||||
newtable = LOWER;
|
newtable = LOWER;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -402,20 +441,26 @@ int aztec_text_process(unsigned char source[], char binary_string[], int gs1)
|
|||||||
switch(curtable) {
|
switch(curtable) {
|
||||||
case UPPER: /* ML */
|
case UPPER: /* ML */
|
||||||
concat(binary_string, hexbit[29]);
|
concat(binary_string, hexbit[29]);
|
||||||
|
if(debug) printf("ML ");
|
||||||
newtable = MIXED;
|
newtable = MIXED;
|
||||||
break;
|
break;
|
||||||
case LOWER: /* ML */
|
case LOWER: /* ML */
|
||||||
concat(binary_string, hexbit[29]);
|
concat(binary_string, hexbit[29]);
|
||||||
|
if(debug) printf("ML ");
|
||||||
newtable = MIXED;
|
newtable = MIXED;
|
||||||
break;
|
break;
|
||||||
case PUNC: /* UL ML */
|
case PUNC: /* UL ML */
|
||||||
concat(binary_string, hexbit[31]);
|
concat(binary_string, hexbit[31]);
|
||||||
|
if(debug) printf("UL ");
|
||||||
concat(binary_string, hexbit[29]);
|
concat(binary_string, hexbit[29]);
|
||||||
|
if(debug) printf("ML ");
|
||||||
newtable = MIXED;
|
newtable = MIXED;
|
||||||
break;
|
break;
|
||||||
case DIGIT: /* UL ML */
|
case DIGIT: /* UL ML */
|
||||||
concat(binary_string, pentbit[14]);
|
concat(binary_string, pentbit[14]);
|
||||||
|
if(debug) printf("UL ");
|
||||||
concat(binary_string, hexbit[29]);
|
concat(binary_string, hexbit[29]);
|
||||||
|
if(debug) printf("ML ");
|
||||||
newtable = MIXED;
|
newtable = MIXED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -424,22 +469,30 @@ int aztec_text_process(unsigned char source[], char binary_string[], int gs1)
|
|||||||
switch(curtable) {
|
switch(curtable) {
|
||||||
case UPPER: /* ML PL */
|
case UPPER: /* ML PL */
|
||||||
concat(binary_string, hexbit[29]);
|
concat(binary_string, hexbit[29]);
|
||||||
|
if(debug) printf("ML ");
|
||||||
concat(binary_string, hexbit[30]);
|
concat(binary_string, hexbit[30]);
|
||||||
|
if(debug) printf("PL ");
|
||||||
newtable = PUNC;
|
newtable = PUNC;
|
||||||
break;
|
break;
|
||||||
case LOWER: /* ML PL */
|
case LOWER: /* ML PL */
|
||||||
concat(binary_string, hexbit[29]);
|
concat(binary_string, hexbit[29]);
|
||||||
|
if(debug) printf("ML ");
|
||||||
concat(binary_string, hexbit[30]);
|
concat(binary_string, hexbit[30]);
|
||||||
|
if(debug) printf("PL ");
|
||||||
newtable = PUNC;
|
newtable = PUNC;
|
||||||
break;
|
break;
|
||||||
case MIXED: /* PL */
|
case MIXED: /* PL */
|
||||||
concat(binary_string, hexbit[30]);
|
concat(binary_string, hexbit[30]);
|
||||||
|
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]);
|
concat(binary_string, pentbit[14]);
|
||||||
|
if(debug) printf("UL ");
|
||||||
concat(binary_string, hexbit[29]);
|
concat(binary_string, hexbit[29]);
|
||||||
|
if(debug) printf("ML ");
|
||||||
concat(binary_string, hexbit[30]);
|
concat(binary_string, hexbit[30]);
|
||||||
|
if(debug) printf("PL ");
|
||||||
newtable = PUNC;
|
newtable = PUNC;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -448,20 +501,26 @@ int aztec_text_process(unsigned char source[], char binary_string[], int gs1)
|
|||||||
switch(curtable) {
|
switch(curtable) {
|
||||||
case UPPER: /* DL */
|
case UPPER: /* DL */
|
||||||
concat(binary_string, hexbit[30]);
|
concat(binary_string, hexbit[30]);
|
||||||
|
if(debug) printf("DL ");
|
||||||
newtable = DIGIT;
|
newtable = DIGIT;
|
||||||
break;
|
break;
|
||||||
case LOWER: /* DL */
|
case LOWER: /* DL */
|
||||||
concat(binary_string, hexbit[30]);
|
concat(binary_string, hexbit[30]);
|
||||||
|
if(debug) printf("DL ");
|
||||||
newtable = DIGIT;
|
newtable = DIGIT;
|
||||||
break;
|
break;
|
||||||
case MIXED: /* UL DL */
|
case MIXED: /* UL DL */
|
||||||
concat(binary_string, hexbit[29]);
|
concat(binary_string, hexbit[29]);
|
||||||
|
if(debug) printf("UL ");
|
||||||
concat(binary_string, hexbit[30]);
|
concat(binary_string, hexbit[30]);
|
||||||
|
if(debug) printf("DL ");
|
||||||
newtable = DIGIT;
|
newtable = DIGIT;
|
||||||
break;
|
break;
|
||||||
case PUNC: /* UL DL */
|
case PUNC: /* UL DL */
|
||||||
concat(binary_string, hexbit[31]);
|
concat(binary_string, hexbit[31]);
|
||||||
|
if(debug) printf("UL ");
|
||||||
concat(binary_string, hexbit[30]);
|
concat(binary_string, hexbit[30]);
|
||||||
|
if(debug) printf("DL ");
|
||||||
newtable = DIGIT;
|
newtable = DIGIT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -471,24 +530,31 @@ int aztec_text_process(unsigned char source[], char binary_string[], int gs1)
|
|||||||
switch(curtable) {
|
switch(curtable) {
|
||||||
case UPPER: /* BS */
|
case UPPER: /* BS */
|
||||||
concat(binary_string, hexbit[31]);
|
concat(binary_string, hexbit[31]);
|
||||||
|
if(debug) printf("BS ");
|
||||||
newtable = BINARY;
|
newtable = BINARY;
|
||||||
break;
|
break;
|
||||||
case LOWER: /* BS */
|
case LOWER: /* BS */
|
||||||
concat(binary_string, hexbit[31]);
|
concat(binary_string, hexbit[31]);
|
||||||
|
if(debug) printf("BS ");
|
||||||
newtable = BINARY;
|
newtable = BINARY;
|
||||||
break;
|
break;
|
||||||
case MIXED: /* BS */
|
case MIXED: /* BS */
|
||||||
concat(binary_string, hexbit[31]);
|
concat(binary_string, hexbit[31]);
|
||||||
|
if(debug) printf("BS ");
|
||||||
newtable = BINARY;
|
newtable = BINARY;
|
||||||
break;
|
break;
|
||||||
case PUNC: /* UL BS */
|
case PUNC: /* UL BS */
|
||||||
concat(binary_string, hexbit[31]);
|
concat(binary_string, hexbit[31]);
|
||||||
|
if(debug) printf("UL ");
|
||||||
concat(binary_string, hexbit[31]);
|
concat(binary_string, hexbit[31]);
|
||||||
|
if(debug) printf("BS ");
|
||||||
newtable = BINARY;
|
newtable = BINARY;
|
||||||
break;
|
break;
|
||||||
case DIGIT: /* UL BS */
|
case DIGIT: /* UL BS */
|
||||||
concat(binary_string, pentbit[14]);
|
concat(binary_string, pentbit[14]);
|
||||||
|
if(debug) printf("UL ");
|
||||||
concat(binary_string, hexbit[31]);
|
concat(binary_string, hexbit[31]);
|
||||||
|
if(debug) printf("BS ");
|
||||||
newtable = BINARY;
|
newtable = BINARY;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -525,6 +591,7 @@ int aztec_text_process(unsigned char source[], char binary_string[], int gs1)
|
|||||||
if(bytes & 0x02) { concat(binary_string, "1"); } else { concat(binary_string, "0"); }
|
if(bytes & 0x02) { concat(binary_string, "1"); } else { concat(binary_string, "0"); }
|
||||||
if(bytes & 0x01) { concat(binary_string, "1"); } else { concat(binary_string, "0"); }
|
if(bytes & 0x01) { concat(binary_string, "1"); } else { concat(binary_string, "0"); }
|
||||||
}
|
}
|
||||||
|
if(debug) printf("(%d bytes) ", bytes);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -541,12 +608,16 @@ int aztec_text_process(unsigned char source[], char binary_string[], int gs1)
|
|||||||
case PUNC:
|
case PUNC:
|
||||||
if(charmap[i] >= 400) {
|
if(charmap[i] >= 400) {
|
||||||
concat(binary_string, tribit[charmap[i] - 400]);
|
concat(binary_string, tribit[charmap[i] - 400]);
|
||||||
|
if(debug) printf("FLG(%d) ",charmap[i] - 400);
|
||||||
} else {
|
} else {
|
||||||
concat(binary_string, hexbit[charmap[i]]);
|
concat(binary_string, hexbit[charmap[i]]);
|
||||||
|
if(!((chartype == PUNC) && (charmap[i] == 0)))
|
||||||
|
if(debug) printf("%d ",charmap[i]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DIGIT:
|
case DIGIT:
|
||||||
concat(binary_string, pentbit[charmap[i]]);
|
concat(binary_string, pentbit[charmap[i]]);
|
||||||
|
if(debug) printf("%d ",charmap[i]);
|
||||||
break;
|
break;
|
||||||
case BINARY:
|
case BINARY:
|
||||||
if(charmap[i] & 0x80) { concat(binary_string, "1"); } else { concat(binary_string, "0"); }
|
if(charmap[i] & 0x80) { concat(binary_string, "1"); } else { concat(binary_string, "0"); }
|
||||||
@ -557,11 +628,14 @@ int aztec_text_process(unsigned char source[], char binary_string[], int gs1)
|
|||||||
if(charmap[i] & 0x04) { concat(binary_string, "1"); } else { concat(binary_string, "0"); }
|
if(charmap[i] & 0x04) { concat(binary_string, "1"); } else { concat(binary_string, "0"); }
|
||||||
if(charmap[i] & 0x02) { concat(binary_string, "1"); } else { concat(binary_string, "0"); }
|
if(charmap[i] & 0x02) { concat(binary_string, "1"); } else { concat(binary_string, "0"); }
|
||||||
if(charmap[i] & 0x01) { concat(binary_string, "1"); } else { concat(binary_string, "0"); }
|
if(charmap[i] & 0x01) { concat(binary_string, "1"); } else { concat(binary_string, "0"); }
|
||||||
|
if(debug) printf("%d ",charmap[i]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(debug) printf("\n");
|
||||||
|
|
||||||
if(strlen(binary_string) > 14970) {
|
if(strlen(binary_string) > 14970) {
|
||||||
return ERROR_TOO_LONG;
|
return ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user