Skip to content

Commit

Permalink
Codablock F: more fixes and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gredler committed Nov 25, 2024
1 parent 701bfc3 commit 67ed487
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 12 deletions.
17 changes: 5 additions & 12 deletions src/main/java/uk/org/okapibarcode/backend/CodablockF.java
Original file line number Diff line number Diff line change
Expand Up @@ -357,15 +357,13 @@ private void data_encode_blockf() {
input_position++;
done = true;
}

if ((findSubset(inputData[input_position]) == Mode.SHIFTB) && (c == 1)) {
/* Needs two symbols */
blockmatrix[current_row][column_position] = 100; /* Code B */
column_position++;
c--;
done = true;
}

if ((inputData[input_position] >= 244) && (!done)) {
/* Needs three symbols */
blockmatrix[current_row][column_position] = 100; /* Code B */
Expand All @@ -378,7 +376,6 @@ private void data_encode_blockf() {
}
done = true;
}

if ((inputData[input_position] >= 128) && (!done) && c == 1) {
/* Needs two symbols */
blockmatrix[current_row][column_position] = 100; /* Code B */
Expand All @@ -395,15 +392,13 @@ private void data_encode_blockf() {
input_position++;
done = true;
}

if ((findSubset(inputData[input_position]) == Mode.SHIFTA) && (c == 1)) {
/* Needs two symbols */
blockmatrix[current_row][column_position] = 101; /* Code A */
column_position++;
c--;
done = true;
}

if (((inputData[input_position] >= 128)
&& (inputData[input_position] <= 159)) && (!done)) {
/* Needs three symbols */
Expand All @@ -417,7 +412,6 @@ private void data_encode_blockf() {
}
done = true;
}

if ((inputData[input_position] >= 160) && (!done) && c == 1) {
/* Needs two symbols */
blockmatrix[current_row][column_position] = 101; /* Code A */
Expand All @@ -434,7 +428,6 @@ private void data_encode_blockf() {
c--;
done = true;
}

if (((findSubset(inputData[input_position]) == Mode.ABORC)
&& (findSubset(inputData[input_position + 1]) != Mode.ABORC))
&& (c == 1)) {
Expand All @@ -444,7 +437,6 @@ private void data_encode_blockf() {
c--;
done = true;
}

if (inputData[input_position] >= 128) {
/* Needs three symbols */
blockmatrix[current_row][column_position] = 101; /* Code A */
Expand All @@ -455,6 +447,7 @@ private void data_encode_blockf() {
column_position++;
c--;
}
done = true;
}
break;
}
Expand Down Expand Up @@ -587,7 +580,7 @@ private void data_encode_blockf() {
c--;
if (inputData[input_position] >= 128) {
/* Extended ASCII character */
blockmatrix[current_row][column_position] = 100; /* FNC4 */
blockmatrix[current_row][column_position] = 101; /* FNC4 */
column_position++;
c--;
}
Expand All @@ -602,7 +595,7 @@ private void data_encode_blockf() {
c--;
if (inputData[input_position] >= 128) {
/* Extended ASCII character */
blockmatrix[current_row][column_position] = 100; /* FNC4 */
blockmatrix[current_row][column_position] = 101; /* FNC4 */
column_position++;
c--;
}
Expand Down Expand Up @@ -632,7 +625,7 @@ private void data_encode_blockf() {
c--;
if (inputData[input_position] >= 128) {
/* Extended ASCII character */
blockmatrix[current_row][column_position] = 101; /* FNC4 */
blockmatrix[current_row][column_position] = 100; /* FNC4 */
column_position++;
c--;
}
Expand All @@ -647,7 +640,7 @@ private void data_encode_blockf() {
c--;
if (inputData[input_position] >= 128) {
/* Extended ASCII character */
blockmatrix[current_row][column_position] = 101; /* FNC4 */
blockmatrix[current_row][column_position] = 100; /* FNC4 */
column_position++;
c--;
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
PROPERTIES

content=2610\u00F2

LOG

Grid Size: 4 X 2
K1 Check Digit: 51
K2 Check Digit: 38
Encoding: MODEC 0 26 10 101 100 (86) MODEB 11 100 82 51 38 (100)
Blocks Merged: 59 -> 49

CODEWORDS

2114121131412122223212212213123111411141314112122331112
2114121141312312121141311212412131131323111141312331112
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
PROPERTIES

content=*\r\xF2\x82\x82(\x982\x82\x82*\r\xF2\x82\xA8\x82\x82\x82\x82

LOG

Grid Size: 7 X 7
K1 Check Digit: 4
K2 Check Digit: 76
Encoding: MODEB 69 10 101 77 100 100 82 101 (8) MODEA 11 101 66 101 66 8 101 88 (51) MODEC 44 100 18 101 101 66 101 66 (32) MODEB 13 10 101 77 100 100 82 101 (102) MODEA 14 101 66 101 8 101 66 100 (85) MODEA 15 101 66 101 66 101 66 100 (23) MODEA 26 100 101 100 101 100 4 76 (80)
Blocks Merged: 267 -> 175

CODEWORDS

2114121141311122142213123111414131111141311141311212413111411322122331112
2114124113112312123111411214213111411214211322123111414212112131132331112
2114121131411321311141312232113111413111411214213111411214212321212331112
2114121141311221322213123111414131111141311141311212413111414111312331112
2114124113111222313111411214213111411322123111411214211141311242112331112
2114124113111132223111411214213111411214213111411214211141313121312331112
2114124113113212211141313111411141313111411141311213222211141112422331112
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
PROPERTIES

content=\u0018\u00F2

LOG

Grid Size: 4 X 2
K1 Check Digit: 56
K2 Check Digit: 48
Encoding: MODEA 64 88 100 100 82 (28) MODEA 11 100 101 56 48 (53)
Blocks Merged: 59 -> 49

CODEWORDS

2114124113111114224212111141311141311212413221122331112
2114124113112312121141313111413311213131212131312331112

0 comments on commit 67ed487

Please sign in to comment.