You've already forked lazarus-ccr
lazbarcodes: Refactor avoiding trivial usage of function IsTrue(boolean) (not complete).
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8239 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -94,12 +94,12 @@ matrixrsblock: array [0..29] of integer = (
|
||||
|
||||
procedure ecc200placementbit(parray: PInteger; NR: Integer; NC: Integer; r: Integer; c: Integer; p: Integer; b: BYTE);
|
||||
begin
|
||||
if IsTrue(r < 0) then
|
||||
if (r < 0) then
|
||||
begin
|
||||
r := r + NR;
|
||||
c := c + (4 - ((NR + 4) mod 8));
|
||||
end;
|
||||
if IsTrue(c < 0) then
|
||||
if (c < 0) then
|
||||
begin
|
||||
c := c + NC;
|
||||
r := r + (4 - ((NC + 4) mod 8));
|
||||
@ -188,51 +188,51 @@ begin
|
||||
r := 4;
|
||||
c := 0;
|
||||
repeat
|
||||
if IsTrue(IsTrue(r = NR) AND IsTrue(BooleanNot (c))) then
|
||||
if IsTrue((r = NR) and IsTrue(BooleanNot (c))) then
|
||||
begin
|
||||
ecc200placementcornerA (parray, NR, NC, PostInc (p));
|
||||
end;
|
||||
if IsTrue(IsTrue(IsTrue(r = NR - 2) AND IsTrue(BooleanNot (c))) AND IsTrue(NC mod 4)) then
|
||||
if IsTrue(IsTrue((r = NR - 2) AND IsTrue(BooleanNot (c))) AND IsTrue(NC mod 4)) then
|
||||
begin
|
||||
ecc200placementcornerB (parray, NR, NC, PostInc (p));
|
||||
end;
|
||||
if IsTrue(IsTrue(IsTrue(r = NR - 2) AND IsTrue(BooleanNot (c))) AND IsTrue((NC mod 8) = 4)) then
|
||||
if IsTrue(IsTrue((r = NR - 2) AND IsTrue(BooleanNot (c))) AND IsTrue((NC mod 8) = 4)) then
|
||||
begin
|
||||
ecc200placementcornerC (parray, NR, NC, PostInc (p));
|
||||
end;
|
||||
if IsTrue(IsTrue(IsTrue(r = NR + 4) AND IsTrue(c = 2)) AND IsTrue(BooleanNot ((NC mod 8)))) then
|
||||
if IsTrue(IsTrue((r = NR + 4) AND IsTrue(c = 2)) AND IsTrue(BooleanNot ((NC mod 8)))) then
|
||||
begin
|
||||
ecc200placementcornerD (parray, NR, NC, PostInc (p));
|
||||
end;
|
||||
repeat
|
||||
if IsTrue(IsTrue(IsTrue(r < NR) AND IsTrue(c >= 0)) AND IsTrue(BooleanNot (parray[r * NC + c]))) then
|
||||
if IsTrue((r < NR) and (c >= 0) AND IsTrue(BooleanNot (parray[r * NC + c]))) then
|
||||
begin
|
||||
ecc200placementblock (parray, NR, NC, r, c, PostInc (p));
|
||||
end;
|
||||
r := r - 2;
|
||||
c := c + 2;
|
||||
until not (IsTrue(r >= 0) AND IsTrue(c < NC));
|
||||
until not ((r >= 0) and (c < NC));
|
||||
Inc (r);
|
||||
c := c + 3;
|
||||
repeat
|
||||
if IsTrue(IsTrue(IsTrue(r >= 0) AND IsTrue(c < NC)) AND IsTrue(BooleanNot (parray[r * NC + c]))) then
|
||||
if IsTrue(IsTrue((r >= 0) and (c < NC)) AND IsTrue(BooleanNot (parray[r * NC + c]))) then
|
||||
begin
|
||||
ecc200placementblock (parray, NR, NC, r, c, PostInc (p));
|
||||
end;
|
||||
r := r + 2;
|
||||
c := c - 2;
|
||||
until not (IsTrue(r < NR) AND IsTrue(c >= 0));
|
||||
until not ((r < NR) and (c >= 0));
|
||||
r := r + 3;
|
||||
Inc (c);
|
||||
until not (IsTrue(r < NR) OR IsTrue(c < NC));
|
||||
if IsTrue(BooleanNot (parray[NR * NC - 1])) then
|
||||
until not ((r < NR) or (c < NC));
|
||||
if BooleanNot(parray[NR * NC - 1]) then
|
||||
begin
|
||||
parray[NR * NC - NC - 2] := 1;
|
||||
parray[NR * NC - 1] := 1;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure ecc200(binary: PBYTE; bytes: Integer; datablock: Integer; rsblock: Integer; skew: Integer);
|
||||
procedure ecc200(binary: PByte; bytes, datablock, rsblock, skew: Integer);
|
||||
var
|
||||
b: Integer;
|
||||
blocks: Integer;
|
||||
@ -259,9 +259,9 @@ begin
|
||||
n := b;
|
||||
while n < rsblock * blocks do
|
||||
begin
|
||||
if IsTrue(skew) then
|
||||
if skew <> 0 then
|
||||
begin
|
||||
if IsTrue(b < 8) then
|
||||
if b < 8 then
|
||||
begin
|
||||
binary[bytes + n + 2] := ecc[PostDec (p)];
|
||||
end else begin
|
||||
@ -277,33 +277,9 @@ begin
|
||||
rs_free;
|
||||
end;
|
||||
|
||||
function isx12(source: BYTE): Integer;
|
||||
function isx12(source: Byte): Boolean;
|
||||
begin
|
||||
if IsTrue(source = 13) then
|
||||
begin
|
||||
exit (1);
|
||||
end;
|
||||
if IsTrue(source = 42) then
|
||||
begin
|
||||
exit (1);
|
||||
end;
|
||||
if IsTrue(source = 62) then
|
||||
begin
|
||||
exit (1);
|
||||
end;
|
||||
if IsTrue(source = 32) then
|
||||
begin
|
||||
exit (1);
|
||||
end;
|
||||
if IsTrue(IsTrue((source >= BYTE('0'))) AND IsTrue((source <= BYTE('9')))) then
|
||||
begin
|
||||
exit (1);
|
||||
end;
|
||||
if IsTrue(IsTrue((source >= BYTE('A'))) AND IsTrue((source <= BYTE('Z')))) then
|
||||
begin
|
||||
exit (1);
|
||||
end;
|
||||
exit (0);
|
||||
Result := source in [13, 42, 62, 32, byte('0')..byte('9'), byte('A')..byte('Z')];
|
||||
end;
|
||||
|
||||
procedure dminsert(binary_string: PChar; posn: Integer; newbit: Char);
|
||||
@ -348,7 +324,7 @@ var
|
||||
sp: Integer;
|
||||
reduced_char: Char;
|
||||
begin
|
||||
if IsTrue(current_mode = DM_ASCII) then
|
||||
if current_mode = DM_ASCII then
|
||||
begin
|
||||
ascii_count := 0.0;
|
||||
c40_count := 1.0;
|
||||
@ -372,94 +348,94 @@ begin
|
||||
DM_BASE256: b256_count := 0.0;
|
||||
end;
|
||||
sp := position;
|
||||
while IsTrue((sp < sourcelen)) AND IsTrue((sp <= (position + 8))) do
|
||||
while (sp < sourcelen) and (sp <= position + 8) do
|
||||
begin
|
||||
if IsTrue(source[sp] <= 127) then
|
||||
if source[sp] <= 127 then
|
||||
begin
|
||||
reduced_char := char(source[sp]);
|
||||
end else begin
|
||||
reduced_char := char(source[sp] - 127);
|
||||
end;
|
||||
if IsTrue(IsTrue((source[sp] >= BYTE('0'))) AND IsTrue((source[sp] <= BYTE('9')))) then
|
||||
if (source[sp] in [byte('0')..byte('9')]) then
|
||||
begin
|
||||
ascii_count := ascii_count + 0.5;
|
||||
end else begin
|
||||
ascii_count := ascii_count + 1.0;
|
||||
end;
|
||||
if IsTrue(source[sp] > 127) then
|
||||
if source[sp] > 127 then
|
||||
begin
|
||||
ascii_count := ascii_count + 1.0;
|
||||
end;
|
||||
done := 0;
|
||||
if IsTrue(reduced_char = ' ') then
|
||||
if reduced_char = ' ' then
|
||||
begin
|
||||
c40_count := c40_count + ((2.0 / 3.0));
|
||||
done := 1;
|
||||
end;
|
||||
if IsTrue(IsTrue((reduced_char >= '0')) AND IsTrue((reduced_char <= '9'))) then
|
||||
if (reduced_char in ['0'..'9']) then
|
||||
begin
|
||||
c40_count := c40_count + ((2.0 / 3.0));
|
||||
done := 1;
|
||||
end;
|
||||
if IsTrue(IsTrue((reduced_char >= 'A')) AND IsTrue((reduced_char <= 'Z'))) then
|
||||
if (reduced_char in ['A'..'Z']) then
|
||||
begin
|
||||
c40_count := c40_count + ((2.0 / 3.0));
|
||||
done := 1;
|
||||
end;
|
||||
if IsTrue(source[sp] > 127) then
|
||||
if source[sp] > 127 then
|
||||
begin
|
||||
c40_count := c40_count + ((4.0 / 3.0));
|
||||
end;
|
||||
if IsTrue(done = 0) then
|
||||
if done = 0 then
|
||||
begin
|
||||
c40_count := c40_count + ((4.0 / 3.0));
|
||||
end;
|
||||
done := 0;
|
||||
if IsTrue(reduced_char = ' ') then
|
||||
if reduced_char = ' ' then
|
||||
begin
|
||||
text_count := text_count + ((2.0 / 3.0));
|
||||
done := 1;
|
||||
end;
|
||||
if IsTrue(IsTrue((reduced_char >= '0')) AND IsTrue((reduced_char <= '9'))) then
|
||||
if (reduced_char in ['0'..'9']) then
|
||||
begin
|
||||
text_count := text_count + ((2.0 / 3.0));
|
||||
done := 1;
|
||||
end;
|
||||
if IsTrue(IsTrue((reduced_char >= 'a')) AND IsTrue((reduced_char <= 'z'))) then
|
||||
if (reduced_char in ['a'..'z']) then
|
||||
begin
|
||||
text_count := text_count + ((2.0 / 3.0));
|
||||
done := 1;
|
||||
end;
|
||||
if IsTrue(source[sp] > 127) then
|
||||
if source[sp] > 127 then
|
||||
begin
|
||||
text_count := text_count + ((4.0 / 3.0));
|
||||
end;
|
||||
if IsTrue(done = 0) then
|
||||
if done = 0 then
|
||||
begin
|
||||
text_count := text_count + ((4.0 / 3.0));
|
||||
end;
|
||||
if IsTrue(isx12 (source[sp])) then
|
||||
if isx12(source[sp]) then
|
||||
begin
|
||||
x12_count := x12_count + ((2.0 / 3.0));
|
||||
end else begin
|
||||
x12_count := x12_count + 4.0;
|
||||
end;
|
||||
done := 0;
|
||||
if IsTrue(IsTrue((source[sp] >= BYTE(' '))) AND IsTrue((source[sp] <= BYTE('^')))) then
|
||||
if (source[sp] in [Byte(' ')..Byte('^')]) then
|
||||
begin
|
||||
edf_count := edf_count + ((3.0 / 4.0));
|
||||
end else begin
|
||||
edf_count := edf_count + 6.0;
|
||||
end;
|
||||
if IsTrue(IsTrue(gs1) AND IsTrue((source[sp] = BYTE('[')))) then
|
||||
if IsTrue(gs1) and (source[sp] = Byte('[')) then
|
||||
begin
|
||||
edf_count := edf_count + 6.0;
|
||||
end;
|
||||
if IsTrue(sp >= (sourcelen - 5)) then
|
||||
if sp >= (sourcelen - 5) then
|
||||
begin
|
||||
edf_count := edf_count + 6.0;
|
||||
end;
|
||||
if IsTrue(IsTrue(gs1) AND IsTrue((source[sp] = BYTE('[')))) then
|
||||
if IsTrue(gs1) and (source[sp] = BYTE('[')) then
|
||||
begin
|
||||
b256_count := b256_count + 4.0;
|
||||
end else begin
|
||||
@ -469,27 +445,27 @@ begin
|
||||
end;
|
||||
best_count := ascii_count;
|
||||
best_scheme := DM_ASCII;
|
||||
if IsTrue(b256_count <= best_count) then
|
||||
if b256_count <= best_count then
|
||||
begin
|
||||
best_count := b256_count;
|
||||
best_scheme := DM_BASE256;
|
||||
end;
|
||||
if IsTrue(edf_count <= best_count) then
|
||||
if edf_count <= best_count then
|
||||
begin
|
||||
best_count := edf_count;
|
||||
best_scheme := DM_EDIFACT;
|
||||
end;
|
||||
if IsTrue(text_count <= best_count) then
|
||||
if text_count <= best_count then
|
||||
begin
|
||||
best_count := text_count;
|
||||
best_scheme := DM_TEXT;
|
||||
end;
|
||||
if IsTrue(x12_count <= best_count) then
|
||||
if x12_count <= best_count then
|
||||
begin
|
||||
best_count := x12_count;
|
||||
best_scheme := DM_X12;
|
||||
end;
|
||||
if IsTrue(c40_count <= best_count) then
|
||||
if c40_count <= best_count then
|
||||
begin
|
||||
best_count := c40_count;
|
||||
best_scheme := DM_C40;
|
||||
@ -539,7 +515,7 @@ begin
|
||||
strcpy (binary, '');
|
||||
current_mode := DM_ASCII;
|
||||
next_mode := DM_ASCII;
|
||||
if IsTrue(symbol^.input_mode = GS1_MODE) then
|
||||
if symbol^.input_mode = GS1_MODE then
|
||||
begin
|
||||
gs1 := 1;
|
||||
end else begin
|
||||
@ -555,7 +531,7 @@ begin
|
||||
write( format ('FN1 ',[]) );
|
||||
end;
|
||||
end;
|
||||
if IsTrue(symbol^.output_options and READER_INIT) then
|
||||
if (symbol^.output_options and READER_INIT <> 0) then
|
||||
begin
|
||||
if IsTrue(gs1) then
|
||||
begin
|
||||
@ -574,7 +550,7 @@ begin
|
||||
while sp < inputlen do
|
||||
begin
|
||||
current_mode := next_mode;
|
||||
if IsTrue(current_mode = DM_ASCII) then
|
||||
if (current_mode = DM_ASCII) then
|
||||
begin
|
||||
next_mode := DM_ASCII;
|
||||
if IsTrue(IsTrue(istwodigits (source, sp)) AND IsTrue(((sp + 1) <> inputlen))) then
|
||||
@ -589,7 +565,7 @@ begin
|
||||
sp := sp + 2;
|
||||
end else begin
|
||||
next_mode := look_ahead_test (source, inputlen, sp, current_mode, gs1);
|
||||
if IsTrue(next_mode <> DM_ASCII) then
|
||||
if (next_mode <> DM_ASCII) then
|
||||
begin
|
||||
case next_mode of
|
||||
DM_C40:
|
||||
@ -644,7 +620,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
end else begin
|
||||
if IsTrue(source[sp] > 127) then
|
||||
if (source[sp] > 127) then
|
||||
begin
|
||||
target[tp] := 235;
|
||||
if IsTrue(debug) then
|
||||
@ -660,7 +636,7 @@ begin
|
||||
Inc (tp);
|
||||
concat (binary, ' ');
|
||||
end else begin
|
||||
if IsTrue(IsTrue(gs1) AND IsTrue((source[sp] = BYTE('[')))) then
|
||||
if IsTrue(gs1) and (source[sp] = Byte('[')) then
|
||||
begin
|
||||
target[tp] := 232;
|
||||
if IsTrue(debug) then
|
||||
@ -681,14 +657,14 @@ begin
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
if IsTrue(current_mode = DM_C40) then
|
||||
if (current_mode = DM_C40) then
|
||||
begin
|
||||
next_mode := DM_C40;
|
||||
if IsTrue(c40_p = 0) then
|
||||
if (c40_p = 0) then
|
||||
begin
|
||||
next_mode := look_ahead_test (source, inputlen, sp, current_mode, gs1);
|
||||
end;
|
||||
if IsTrue(next_mode <> DM_C40) then
|
||||
if (next_mode <> DM_C40) then
|
||||
begin
|
||||
target[tp] := 254;
|
||||
Inc (tp);
|
||||
@ -699,7 +675,7 @@ begin
|
||||
write( format ('ASC ',[]) );
|
||||
end;
|
||||
end else begin
|
||||
if IsTrue(source[sp] > 127) then
|
||||
if (source[sp] > 127) then
|
||||
begin
|
||||
c40_buffer[c40_p] := 1;
|
||||
Inc (c40_p);
|
||||
@ -711,19 +687,19 @@ begin
|
||||
shift_set := c40_shift[source[sp]];
|
||||
value := c40_value[source[sp]];
|
||||
end;
|
||||
if IsTrue(IsTrue(gs1) AND IsTrue((source[sp] = BYTE('[')))) then
|
||||
if IsTrue(gs1) and (source[sp] = Byte('[')) then
|
||||
begin
|
||||
shift_set := 2;
|
||||
value := 27;
|
||||
end;
|
||||
if IsTrue(shift_set <> 0) then
|
||||
if (shift_set <> 0) then
|
||||
begin
|
||||
c40_buffer[c40_p] := shift_set - 1;
|
||||
Inc (c40_p);
|
||||
end;
|
||||
c40_buffer[c40_p] := value;
|
||||
Inc (c40_p);
|
||||
if IsTrue(c40_p >= 3) then
|
||||
if (c40_p >= 3) then
|
||||
begin
|
||||
iv := (1600 * c40_buffer[0]) + (40 * c40_buffer[1]) + (c40_buffer[2]) + 1;
|
||||
target[tp] := iv div 256;
|
||||
@ -746,14 +722,14 @@ begin
|
||||
Inc (sp);
|
||||
end;
|
||||
end;
|
||||
if IsTrue(current_mode = DM_TEXT) then
|
||||
if (current_mode = DM_TEXT) then
|
||||
begin
|
||||
next_mode := DM_TEXT;
|
||||
if IsTrue(text_p = 0) then
|
||||
if (text_p = 0) then
|
||||
begin
|
||||
next_mode := look_ahead_test (source, inputlen, sp, current_mode, gs1);
|
||||
end;
|
||||
if IsTrue(next_mode <> DM_TEXT) then
|
||||
if (next_mode <> DM_TEXT) then
|
||||
begin
|
||||
target[tp] := 254;
|
||||
Inc (tp);
|
||||
@ -764,7 +740,7 @@ begin
|
||||
write( format ('ASC ',[]) );
|
||||
end;
|
||||
end else begin
|
||||
if IsTrue(source[sp] > 127) then
|
||||
if (source[sp] > 127) then
|
||||
begin
|
||||
text_buffer[text_p] := 1;
|
||||
Inc (text_p);
|
||||
@ -776,19 +752,19 @@ begin
|
||||
shift_set := text_shift[source[sp]];
|
||||
value := text_value[source[sp]];
|
||||
end;
|
||||
if IsTrue(IsTrue(gs1) AND IsTrue((source[sp] = BYTE('[')))) then
|
||||
if IsTrue(gs1) and (source[sp] = Byte('[')) then
|
||||
begin
|
||||
shift_set := 2;
|
||||
value := 27;
|
||||
end;
|
||||
if IsTrue(shift_set <> 0) then
|
||||
if (shift_set <> 0) then
|
||||
begin
|
||||
text_buffer[text_p] := shift_set - 1;
|
||||
Inc (text_p);
|
||||
end;
|
||||
text_buffer[text_p] := value;
|
||||
Inc (text_p);
|
||||
if IsTrue(text_p >= 3) then
|
||||
if (text_p >= 3) then
|
||||
begin
|
||||
iv := (1600 * text_buffer[0]) + (40 * text_buffer[1]) + (text_buffer[2]) + 1;
|
||||
target[tp] := iv div 256;
|
||||
@ -811,15 +787,15 @@ begin
|
||||
Inc (sp);
|
||||
end;
|
||||
end;
|
||||
if IsTrue(current_mode = DM_X12) then
|
||||
if (current_mode = DM_X12) then
|
||||
begin
|
||||
{INITCODE} value := 0;
|
||||
next_mode := DM_X12;
|
||||
if IsTrue(text_p = 0) then
|
||||
if (text_p = 0) then
|
||||
begin
|
||||
next_mode := look_ahead_test (source, inputlen, sp, current_mode, gs1);
|
||||
end;
|
||||
if IsTrue(next_mode <> DM_X12) then
|
||||
if (next_mode <> DM_X12) then
|
||||
begin
|
||||
target[tp] := 254;
|
||||
Inc (tp);
|
||||
@ -830,33 +806,33 @@ begin
|
||||
write( format ('ASC ',[]) );
|
||||
end;
|
||||
end else begin
|
||||
if IsTrue(source[sp] = 13) then
|
||||
if (source[sp] = 13) then
|
||||
begin
|
||||
value := 0;
|
||||
end;
|
||||
if IsTrue(source[sp] = BYTE('*')) then
|
||||
if (source[sp] = Byte('*')) then
|
||||
begin
|
||||
value := 1;
|
||||
end;
|
||||
if IsTrue(source[sp] = BYTE('>')) then
|
||||
if (source[sp] = Byte('>')) then
|
||||
begin
|
||||
value := 2;
|
||||
end;
|
||||
if IsTrue(source[sp] = BYTE(' ')) then
|
||||
if (source[sp] = Byte(' ')) then
|
||||
begin
|
||||
value := 3;
|
||||
end;
|
||||
if IsTrue(IsTrue((source[sp] >= BYTE('0'))) AND IsTrue((source[sp] <= BYTE('9')))) then
|
||||
if source[sp] in [Byte('0')..Byte('9')] then
|
||||
begin
|
||||
value := (source[sp] - BYTE('0')) + 4;
|
||||
end;
|
||||
if IsTrue(IsTrue((source[sp] >= BYTE('A'))) AND IsTrue((source[sp] <= BYTE('Z')))) then
|
||||
if source[sp] in [Byte('A')..Byte('Z')] then
|
||||
begin
|
||||
value := (source[sp] - BYTE('A')) + 14;
|
||||
value := (source[sp] - Byte('A')) + 14;
|
||||
end;
|
||||
x12_buffer[x12_p] := value;
|
||||
Inc (x12_p);
|
||||
if IsTrue(x12_p >= 3) then
|
||||
Inc(x12_p);
|
||||
if (x12_p >= 3) then
|
||||
begin
|
||||
iv := (1600 * x12_buffer[0]) + (40 * x12_buffer[1]) + (x12_buffer[2]) + 1;
|
||||
target[tp] := iv div 256;
|
||||
@ -879,25 +855,25 @@ begin
|
||||
Inc (sp);
|
||||
end;
|
||||
end;
|
||||
if IsTrue(current_mode = DM_EDIFACT) then
|
||||
if (current_mode = DM_EDIFACT) then
|
||||
begin
|
||||
{INITCODE} value := 0;
|
||||
next_mode := DM_EDIFACT;
|
||||
if IsTrue(edifact_p = 3) then
|
||||
if (edifact_p = 3) then
|
||||
begin
|
||||
next_mode := look_ahead_test (source, inputlen, sp, current_mode, gs1);
|
||||
end;
|
||||
if IsTrue(next_mode <> DM_EDIFACT) then
|
||||
if (next_mode <> DM_EDIFACT) then
|
||||
begin
|
||||
edifact_buffer[edifact_p] := 31;
|
||||
Inc (edifact_p);
|
||||
next_mode := DM_ASCII;
|
||||
end else begin
|
||||
if IsTrue(IsTrue((source[sp] >= BYTE('@'))) AND IsTrue((source[sp] <= BYTE('^')))) then
|
||||
if source[sp] in [Byte('@')..Byte('^')] then
|
||||
begin
|
||||
value := source[sp] - BYTE('@');
|
||||
end;
|
||||
if IsTrue(IsTrue((source[sp] >= BYTE(' '))) AND IsTrue((source[sp] <= BYTE('?')))) then
|
||||
if source[sp] in [Byte(' ')..Byte('?')] then
|
||||
begin
|
||||
value := source[sp];
|
||||
end;
|
||||
@ -905,7 +881,7 @@ begin
|
||||
Inc (edifact_p);
|
||||
Inc (sp);
|
||||
end;
|
||||
if IsTrue(edifact_p >= 4) then
|
||||
if (edifact_p >= 4) then
|
||||
begin
|
||||
target[tp] := (edifact_buffer[0] shl 2) + ((edifact_buffer[1] and $30) shr 4);
|
||||
Inc (tp);
|
||||
@ -929,7 +905,7 @@ begin
|
||||
edifact_p := edifact_p - 4;
|
||||
end;
|
||||
end;
|
||||
if IsTrue(current_mode = DM_BASE256) then
|
||||
if (current_mode = DM_BASE256) then
|
||||
begin
|
||||
next_mode := look_ahead_test (source, inputlen, sp, current_mode, gs1);
|
||||
if IsTrue(next_mode = DM_BASE256) then
|
||||
@ -950,12 +926,12 @@ begin
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
if IsTrue(tp > 1558) then
|
||||
if (tp > 1558) then
|
||||
begin
|
||||
exit (0);
|
||||
end;
|
||||
end;
|
||||
if IsTrue(c40_p = 2) then
|
||||
if (c40_p = 2) then
|
||||
begin
|
||||
target[tp] := 254;
|
||||
Inc (tp);
|
||||
@ -970,7 +946,7 @@ begin
|
||||
end;
|
||||
current_mode := DM_ASCII;
|
||||
end;
|
||||
if IsTrue(c40_p = 1) then
|
||||
if (c40_p = 1) then
|
||||
begin
|
||||
target[tp] := 254;
|
||||
Inc (tp);
|
||||
@ -983,7 +959,7 @@ begin
|
||||
end;
|
||||
current_mode := DM_ASCII;
|
||||
end;
|
||||
if IsTrue(text_p = 2) then
|
||||
if (text_p = 2) then
|
||||
begin
|
||||
target[tp] := 254;
|
||||
Inc (tp);
|
||||
@ -998,7 +974,7 @@ begin
|
||||
end;
|
||||
current_mode := DM_ASCII;
|
||||
end;
|
||||
if IsTrue(text_p = 1) then
|
||||
if (text_p = 1) then
|
||||
begin
|
||||
target[tp] := 254;
|
||||
Inc (tp);
|
||||
@ -1011,7 +987,7 @@ begin
|
||||
end;
|
||||
current_mode := DM_ASCII;
|
||||
end;
|
||||
if IsTrue(x12_p = 2) then
|
||||
if (x12_p = 2) then
|
||||
begin
|
||||
target[tp] := 254;
|
||||
Inc (tp);
|
||||
@ -1026,7 +1002,7 @@ begin
|
||||
end;
|
||||
current_mode := DM_ASCII;
|
||||
end;
|
||||
if IsTrue(x12_p = 1) then
|
||||
if (x12_p = 1) then
|
||||
begin
|
||||
target[tp] := 254;
|
||||
Inc (tp);
|
||||
@ -1042,16 +1018,16 @@ begin
|
||||
i := 0;
|
||||
while i < tp do
|
||||
begin
|
||||
if IsTrue(binary[i] = 'b') then
|
||||
if (binary[i] = 'b') then
|
||||
begin
|
||||
if IsTrue(IsTrue((i = 0)) OR IsTrue((IsTrue((i <> 0)) AND IsTrue((binary[i - 1] <> 'b'))))) then
|
||||
if (i = 0) or ((i <> 0) and (binary[i - 1] <> 'b')) then
|
||||
begin
|
||||
binary_count := 0;
|
||||
while binary[binary_count + i] = 'b' do
|
||||
begin
|
||||
Inc (binary_count);
|
||||
end;
|
||||
if IsTrue(binary_count <= 249) then
|
||||
if binary_count <= 249 then
|
||||
begin
|
||||
dminsert (@binary[0], i, 'b');
|
||||
insert_value (target, i, tp, binary_count);
|
||||
@ -1071,11 +1047,11 @@ begin
|
||||
i := 0;
|
||||
while i < tp do
|
||||
begin
|
||||
if IsTrue(binary[i] = 'b') then
|
||||
if (binary[i] = 'b') then
|
||||
begin
|
||||
prn := ((149 * (i + 1)) mod 255) + 1;
|
||||
temp := target[i] + prn;
|
||||
if IsTrue(temp <= 255) then
|
||||
if (temp <= 255) then
|
||||
begin
|
||||
target[i] := temp;
|
||||
end else begin
|
||||
@ -1119,14 +1095,14 @@ begin
|
||||
i := tail_length;
|
||||
while i > 0 do
|
||||
begin
|
||||
if IsTrue(i = tail_length) then
|
||||
if (i = tail_length) then
|
||||
begin
|
||||
target[tp] := 129;
|
||||
Inc (tp);
|
||||
end else begin
|
||||
prn := ((149 * (tp + 1)) mod 253) + 1;
|
||||
temp := 129 + prn;
|
||||
if IsTrue(temp <= 254) then
|
||||
if (temp <= 254) then
|
||||
begin
|
||||
target[tp] := temp;
|
||||
Inc (tp);
|
||||
@ -1175,12 +1151,12 @@ begin
|
||||
{INITCODE} grid := nil;
|
||||
//inputlen := length;
|
||||
binlen := dm200encode (symbol, source, binary, @last_mode, length);
|
||||
if IsTrue(binlen = 0) then
|
||||
if (binlen = 0) then
|
||||
begin
|
||||
strcpy (symbol^.errtxt, 'Data too long to fit in symbol');
|
||||
exit (ERROR_TOO_LONG);
|
||||
end;
|
||||
if IsTrue(IsTrue((symbol^.option_2 >= 1)) AND IsTrue((symbol^.option_2 <= 30))) then
|
||||
if symbol^.option_2 in [1..30] then
|
||||
begin
|
||||
optionsize := intsymbol[symbol^.option_2 - 1];
|
||||
end else begin
|
||||
@ -1190,13 +1166,13 @@ begin
|
||||
i := 29;
|
||||
while i > -1 do
|
||||
begin
|
||||
if IsTrue(matrixbytes[i] >= binlen) then
|
||||
if (matrixbytes[i] >= binlen) then
|
||||
begin
|
||||
calcsize := i;
|
||||
end;
|
||||
Dec (i);
|
||||
end;
|
||||
if IsTrue(symbol^.option_3 = DM_SQUARE) then
|
||||
if (symbol^.option_3 = DM_SQUARE) then
|
||||
begin
|
||||
case calcsize of
|
||||
2,
|
||||
@ -1209,10 +1185,10 @@ begin
|
||||
end;
|
||||
end;
|
||||
symbolsize := optionsize;
|
||||
if IsTrue(calcsize > optionsize) then
|
||||
if (calcsize > optionsize) then
|
||||
begin
|
||||
symbolsize := calcsize;
|
||||
if IsTrue(optionsize <> -1) then
|
||||
if (optionsize <> -1) then
|
||||
begin
|
||||
error_number := WARN_INVALID_OPTION;
|
||||
strcpy (symbol^.errtxt, 'Data does not fit in selected symbol size');
|
||||
@ -1226,11 +1202,11 @@ begin
|
||||
datablock := matrixdatablock[symbolsize];
|
||||
rsblock := matrixrsblock[symbolsize];
|
||||
taillength := bytes - binlen;
|
||||
if IsTrue(taillength <> 0) then
|
||||
if (taillength <> 0) then
|
||||
begin
|
||||
add_tail (binary, binlen, taillength, last_mode);
|
||||
end;
|
||||
if IsTrue(symbolsize = 29) then
|
||||
if (symbolsize = 29) then
|
||||
begin
|
||||
skew := 1;
|
||||
end;
|
||||
@ -1316,7 +1292,7 @@ function dmatrix(symbol: PointerTo_zint_symbol; source: PBYTE; length: Integer):
|
||||
var
|
||||
error_number: Integer;
|
||||
begin
|
||||
if IsTrue(symbol^.option_1 <= 1) then
|
||||
if (symbol^.option_1 <= 1) then
|
||||
begin
|
||||
error_number := data_matrix_200 (symbol, source, length);
|
||||
end else begin
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user