From 7e371e08cd8fc558e005c1bff3672a8a69a1495b Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Mon, 28 Mar 2022 17:13:07 +0000 Subject: [PATCH] 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 --- components/lazbarcodes/src/lbc_datamatrix.pas | 232 ++++----- components/lazbarcodes/src/lbc_qr.pas | 462 +++++++++--------- 2 files changed, 335 insertions(+), 359 deletions(-) diff --git a/components/lazbarcodes/src/lbc_datamatrix.pas b/components/lazbarcodes/src/lbc_datamatrix.pas index 2e5942cf2..6cef8c0e2 100644 --- a/components/lazbarcodes/src/lbc_datamatrix.pas +++ b/components/lazbarcodes/src/lbc_datamatrix.pas @@ -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 diff --git a/components/lazbarcodes/src/lbc_qr.pas b/components/lazbarcodes/src/lbc_qr.pas index 024a0f8d5..985cd2302 100644 --- a/components/lazbarcodes/src/lbc_qr.pas +++ b/components/lazbarcodes/src/lbc_qr.pas @@ -485,15 +485,15 @@ begin begin concat (binary, '0101'); end; - if IsTrue(version <= 9) then + if version <= 9 then begin scheme := 1; end else begin - if IsTrue(((version >= 10)) and ((version <= 26))) then + if (version >= 10) and (version <= 26) then begin scheme := 2; end else begin - if IsTrue(version >= 27) then + if version >= 27 then begin scheme := 3; end; @@ -529,7 +529,7 @@ begin while i < short_data_block_length do begin {INITCODE} jis := jisdata[position + i]; - if IsTrue(jis > $9FFF) then + if jis > $9FFF then begin jis := jis - $C140; end; @@ -589,7 +589,7 @@ begin begin {INITCODE} second := 0; {INITCODE} first := 0; - if IsTrue(percent = 0) then + if percent = 0 then begin if IsTrue(gs1) and ((jisdata[position + i] = integer('%'))) then begin @@ -608,7 +608,7 @@ begin count := 1; Inc (i); prod := first; - if IsTrue(mode[position + i] = 'A') then + if mode[position + i] = 'A' then begin if IsTrue(gs1) and ((jisdata[position + i] = integer('%'))) then begin @@ -635,7 +635,7 @@ begin Inc (i); prod := first; percent := 0; - if IsTrue(mode[position + i] = 'A') then + if mode[position + i] = 'A' then begin if IsTrue(gs1) and ((jisdata[position + i] = integer('%'))) then begin @@ -684,12 +684,12 @@ begin first := posn (NEON, Char (jisdata[position + i])); count := 1; prod := first; - if IsTrue(mode[position + i + 1] = 'N') then + if mode[position + i + 1] = 'N' then begin second := posn (NEON, Char (jisdata[position + i + 1])); count := 2; prod := (prod * 10) + second; - if IsTrue(mode[position + i + 2] = 'N') then + if mode[position + i + 2] = 'N' then begin third := posn (NEON, Char (jisdata[position + i + 2])); count := 3; @@ -714,7 +714,7 @@ begin concat (binary, '0000'); current_binlen := strlen (binary); padbits := 8 - (current_binlen mod 8); - if IsTrue(padbits = 8) then + if padbits = 8 then begin padbits := 0; end; @@ -729,35 +729,35 @@ begin while i < current_bytes do begin datastream[i] := $00; - if IsTrue(binary[i * 8] = '1') then + if binary[i * 8] = '1' then begin datastream[i] := datastream[i] + $80; end; - if IsTrue(binary[i * 8 + 1] = '1') then + if binary[i * 8 + 1] = '1' then begin datastream[i] := datastream[i] + $40; end; - if IsTrue(binary[i * 8 + 2] = '1') then + if binary[i * 8 + 2] = '1' then begin datastream[i] := datastream[i] + $20; end; - if IsTrue(binary[i * 8 + 3] = '1') then + if binary[i * 8 + 3] = '1' then begin datastream[i] := datastream[i] + $10; end; - if IsTrue(binary[i * 8 + 4] = '1') then + if binary[i * 8 + 4] = '1' then begin datastream[i] := datastream[i] + $08; end; - if IsTrue(binary[i * 8 + 5] = '1') then + if binary[i * 8 + 5] = '1' then begin datastream[i] := datastream[i] + $04; end; - if IsTrue(binary[i * 8 + 6] = '1') then + if binary[i * 8 + 6] = '1' then begin datastream[i] := datastream[i] + $02; end; - if IsTrue(binary[i * 8 + 7] = '1') then + if binary[i * 8 + 7] = '1' then begin datastream[i] := datastream[i] + $01; end; @@ -767,7 +767,7 @@ begin i := current_bytes; while i < target_binlen do begin - if IsTrue(toggle = 0) then + if toggle = 0 then begin datastream[i] := $EC; toggle := 1; @@ -825,7 +825,7 @@ begin i := 0; while i < blocks do begin - if IsTrue(i < qty_short_blocks) then + if i < qty_short_blocks then begin length_this_block := short_data_block_length; end else begin @@ -856,7 +856,7 @@ begin write( format ('%2X ',[data_block[j]]) ); Inc (j); end; - if IsTrue(i < qty_short_blocks) then + if i < qty_short_blocks then begin write( format (' ',[]) ); end; @@ -875,7 +875,7 @@ begin interleaved_data[(j * blocks) + i] := Integer (data_block[j]); Inc (j); end; - if IsTrue(i >= qty_short_blocks) then + if i >= qty_short_blocks then begin interleaved_data[(short_data_block_length * blocks) + (i - qty_short_blocks)] := Integer (data_block[short_data_block_length]); end; @@ -934,7 +934,7 @@ begin yp := 0; while yp < 7 do begin - if IsTrue(finder[xp + (7 * yp)] = 1) then + if finder[xp + (7 * yp)] = 1 then begin grid[((yp + y) * size) + (xp + x)] := $11; end else begin @@ -967,7 +967,7 @@ begin yp := 0; while yp < 5 do begin - if IsTrue(alignment[xp + (5 * yp)] = 1) then + if alignment[xp + (5 * yp)] = 1 then begin grid[((yp + y) * size) + (xp + x)] := $11; end else begin @@ -994,7 +994,7 @@ begin i := 0; while i < size do begin - if IsTrue(toggle = 1) then + if toggle = 1 then begin grid[(6 * size) + i] := $21; grid[(i * size) + 6] := $21; @@ -1023,7 +1023,7 @@ begin grid[(7 * size) + 7] := $10; grid[(7 * size) + (size - 8)] := $10; grid[((size - 8) * size) + 7] := $10; - if IsTrue(version <> 1) then + if version <> 1 then begin loopsize := qr_align_loopsize[version - 1]; x := 0; @@ -1054,7 +1054,7 @@ begin end; grid[(8 * size) + 8] := grid[(8 * size) + 8] + 20; grid[((size - 1 - 7) * size) + 8] := $21; - if IsTrue(version >= 7) then + if version >= 7 then begin i := 0; while i < 6 do @@ -1082,7 +1082,7 @@ begin case bit of 0: begin - if IsTrue(datastream[word] and $80) then + if (datastream[word] and $80 <> 0) then begin resultant := 1; end else begin @@ -1091,7 +1091,7 @@ begin end; 1: begin - if IsTrue(datastream[word] and $40) then + if (datastream[word] and $40 <> 0) then begin resultant := 1; end else begin @@ -1100,7 +1100,7 @@ begin end; 2: begin - if IsTrue(datastream[word] and $20) then + if (datastream[word] and $20 <> 0) then begin resultant := 1; end else begin @@ -1109,7 +1109,7 @@ begin end; 3: begin - if IsTrue(datastream[word] and $10) then + if (datastream[word] and $10 <> 0) then begin resultant := 1; end else begin @@ -1118,7 +1118,7 @@ begin end; 4: begin - if IsTrue(datastream[word] and $08) then + if (datastream[word] and $08 <> 0) then begin resultant := 1; end else begin @@ -1127,7 +1127,7 @@ begin end; 5: begin - if IsTrue(datastream[word] and $04) then + if (datastream[word] and $04 <> 0) then begin resultant := 1; end else begin @@ -1136,7 +1136,7 @@ begin end; 6: begin - if IsTrue(datastream[word] and $02) then + if (datastream[word] and $02 <> 0) then begin resultant := 1; end else begin @@ -1145,7 +1145,7 @@ begin end; 7: begin - if IsTrue(datastream[word] and $01) then + if (datastream[word] and $01 <> 0) then begin resultant := 1; end else begin @@ -1172,7 +1172,7 @@ begin i := 0; repeat x := (size - 2) - (row * 2); - if IsTrue(x < 6) then + if (x < 6) then begin Dec (x); end; @@ -1186,7 +1186,7 @@ begin end; Inc (i); end; - if IsTrue(i < n) then + if (i < n) then begin if not IsTrue((grid[(y * size) + x] and $F0)) then begin @@ -1205,13 +1205,13 @@ begin end else begin Inc (y); end; - if IsTrue(y = -1) then + if (y = -1) then begin Inc (row); y := 0; direction := 0; end; - if IsTrue(y = size) then + if (y = size) then begin Inc (row); y := size - 1; @@ -1327,11 +1327,11 @@ begin y := 0; while y < size do begin - if IsTrue(local[(y * size) + x] = state) then + if (local[(y * size) + x] = state) then begin Inc (block); end else begin - if IsTrue(block > 5) then + if (block > 5) then begin resultcode := resultcode + ((3 + block)); end; @@ -1340,7 +1340,7 @@ begin end; Inc (y); end; - if IsTrue(block > 5) then + if (block > 5) then begin resultcode := resultcode + ((3 + block)); end; @@ -1354,11 +1354,11 @@ begin x := 0; while x < size do begin - if IsTrue(local[(y * size) + x] = state) then + if (local[(y * size) + x] = state) then begin Inc (block); end else begin - if IsTrue(block > 5) then + if (block > 5) then begin resultcode := resultcode + ((3 + block)); end; @@ -1367,7 +1367,7 @@ begin end; Inc (x); end; - if IsTrue(block > 5) then + if (block > 5) then begin resultcode := resultcode + ((3 + block)); end; @@ -1380,35 +1380,35 @@ begin while y < (size - 7) do begin p := 0; - if IsTrue(local[(y * size) + x] = '1') then + if (local[(y * size) + x] = '1') then begin p := p + $40; end; - if IsTrue(local[((y + 1) * size) + x] = '1') then + if (local[((y + 1) * size) + x] = '1') then begin p := p + $20; end; - if IsTrue(local[((y + 2) * size) + x] = '1') then + if (local[((y + 2) * size) + x] = '1') then begin p := p + $10; end; - if IsTrue(local[((y + 3) * size) + x] = '1') then + if (local[((y + 3) * size) + x] = '1') then begin p := p + $08; end; - if IsTrue(local[((y + 4) * size) + x] = '1') then + if (local[((y + 4) * size) + x] = '1') then begin p := p + $04; end; - if IsTrue(local[((y + 5) * size) + x] = '1') then + if (local[((y + 5) * size) + x] = '1') then begin p := p + $02; end; - if IsTrue(local[((y + 6) * size) + x] = '1') then + if (local[((y + 6) * size) + x] = '1') then begin p := p + $01; end; - if IsTrue(p = $5D) then + if (p = $5D) then begin resultcode := resultcode + 40; end; @@ -1423,35 +1423,35 @@ begin while x < (size - 7) do begin p := 0; - if IsTrue(local[(y * size) + x] = '1') then + if (local[(y * size) + x] = '1') then begin p := p + $40; end; - if IsTrue(local[(y * size) + x + 1] = '1') then + if (local[(y * size) + x + 1] = '1') then begin p := p + $20; end; - if IsTrue(local[(y * size) + x + 2] = '1') then + if (local[(y * size) + x + 2] = '1') then begin p := p + $10; end; - if IsTrue(local[(y * size) + x + 3] = '1') then + if (local[(y * size) + x + 3] = '1') then begin p := p + $08; end; - if IsTrue(local[(y * size) + x + 4] = '1') then + if (local[(y * size) + x + 4] = '1') then begin p := p + $04; end; - if IsTrue(local[(y * size) + x + 5] = '1') then + if (local[(y * size) + x + 5] = '1') then begin p := p + $02; end; - if IsTrue(local[(y * size) + x + 6] = '1') then + if (local[(y * size) + x + 6] = '1') then begin p := p + $01; end; - if IsTrue(p = $5D) then + if (p = $5D) then begin resultcode := resultcode + 40; end; @@ -1466,7 +1466,7 @@ begin y := 0; while y < size do begin - if IsTrue(local[(y * size) + x] = '1') then + if (local[(y * size) + x] = '1') then begin Inc (dark_mods); end; @@ -1475,7 +1475,7 @@ begin Inc (x); end; percentage := 100 * (dark_mods div (size * size)); - if IsTrue(percentage <= 50) then + if (percentage <= 50) then begin k := ((100 - percentage) - 50) div 5; end else begin @@ -1509,19 +1509,19 @@ begin mask[(y * size) + x] := $00; if not IsTrue((grid[(y * size) + x] and $F0)) then begin - if IsTrue(((y + x) and 1) = 0) then + if ((y + x) and 1 = 0) then begin mask[(y * size) + x] := mask[(y * size) + x] + $01; end; - if IsTrue((y and 1) = 0) then + if (y and 1 = 0) then begin mask[(y * size) + x] := mask[(y * size) + x] + $02; end; - if IsTrue((x mod 3) = 0) then + if ((x mod 3) = 0) then begin mask[(y * size) + x] := mask[(y * size) + x] + $04; end; - if IsTrue(((y + x) mod 3) = 0) then + if ((y + x) mod 3 = 0) then begin mask[(y * size) + x] := mask[(y * size) + x] + $08; end; @@ -1574,7 +1574,7 @@ begin pattern := 1; while pattern < 8 do begin - if IsTrue(penalty[pattern] < best_val) then + if (penalty[pattern] < best_val) then begin best_pattern := pattern; best_val := penalty[pattern]; @@ -1591,71 +1591,71 @@ begin case best_pattern of 0: begin - if IsTrue(mask[(y * size) + x] and $01) then + if (mask[(y * size) + x] and $01 <> 0) then begin bit := 1; end; end; 1: begin - if IsTrue(mask[(y * size) + x] and $02) then + if (mask[(y * size) + x] and $02 <> 0) then begin bit := 1; end; end; 2: begin - if IsTrue(mask[(y * size) + x] and $04) then + if (mask[(y * size) + x] and $04 <> 0) then begin bit := 1; end; end; 3: begin - if IsTrue(mask[(y * size) + x] and $08) then + if (mask[(y * size) + x] and $08 <> 0) then begin bit := 1; end; end; 4: begin - if IsTrue(mask[(y * size) + x] and $10) then + if (mask[(y * size) + x] and $10 <> 0) then begin bit := 1; end; end; 5: begin - if IsTrue(mask[(y * size) + x] and $20) then + if (mask[(y * size) + x] and $20 <> 0) then begin bit := 1; end; end; 6: begin - if IsTrue(mask[(y * size) + x] and $40) then + if (mask[(y * size) + x] and $40 <> 0) then begin bit := 1; end; end; 7: begin - if IsTrue(mask[(y * size) + x] and $80) then + if (mask[(y * size) + x] and $80 <> 0) then begin bit := 1; end; end; end; - if IsTrue(bit = 1) then + if (bit = 1) then begin - if IsTrue(grid[(y * size) + x] and $01) then + if (grid[(y * size) + x] and $01 <> 0) then begin grid[(y * size) + x] := $00; end else begin grid[(y * size) + x] := $01; end; end; - Inc (y); + Inc(y); end; Inc (x); end; @@ -1764,27 +1764,27 @@ begin otherwise begin error_number := utf8toutf16 (symbol, source, @utfdata[0], @length); - if IsTrue(error_number <> 0) then + if (error_number <> 0) then begin exit (error_number); end; i := 0; while i < length do begin - if IsTrue(utfdata[i] <= $FF) then + if (utfdata[i] <= $FF) then begin jisdata[i] := utfdata[i]; end else begin j := 0; glyph := 0; repeat - if IsTrue(sjis_lookup[j * 2] = utfdata[i]) then + if (sjis_lookup[j * 2] = utfdata[i]) then begin glyph := sjis_lookup[(j * 2) + 1]; end; Inc (j); until NotBoolean (((j < 6843)) and ((glyph = 0))); - if IsTrue(glyph = 0) then + if (glyph = 0) then begin strcpy (symbol^.errtxt, 'Invalid character in input data'); exit (ERROR_INVALID_DATA); @@ -1799,7 +1799,7 @@ begin est_binlen := estimate_binary_length (@mode[0], length, gs1); ecc_level := LEVEL_L; max_cw := 2956; - if IsTrue(((symbol^.option_1 >= 1)) and ((symbol^.option_1 <= 4))) then + if (symbol^.option_1 >= 1) and (symbol^.option_1 <= 4) then begin case symbol^.option_1 of 1: @@ -1824,7 +1824,7 @@ begin end; end; end; - if IsTrue(est_binlen > (8 * max_cw)) then + if est_binlen > 8 * max_cw then begin strcpy (symbol^.errtxt, 'Input too long for selected error correction level'); exit (ERROR_TOO_LONG); @@ -1836,28 +1836,28 @@ begin case ecc_level of LEVEL_L: begin - if IsTrue((8 * qr_data_codewords_L[i]) >= est_binlen) then + if ((8 * qr_data_codewords_L[i]) >= est_binlen) then begin autosize := i + 1; end; end; LEVEL_M: begin - if IsTrue((8 * qr_data_codewords_M[i]) >= est_binlen) then + if ((8 * qr_data_codewords_M[i]) >= est_binlen) then begin autosize := i + 1; end; end; LEVEL_Q: begin - if IsTrue((8 * qr_data_codewords_Q[i]) >= est_binlen) then + if ((8 * qr_data_codewords_Q[i]) >= est_binlen) then begin autosize := i + 1; end; end; LEVEL_H: begin - if IsTrue((8 * qr_data_codewords_H[i]) >= est_binlen) then + if ((8 * qr_data_codewords_H[i]) >= est_binlen) then begin autosize := i + 1; end; @@ -1865,9 +1865,9 @@ begin end; Dec (i); end; - if IsTrue(((symbol^.option_2 >= 1)) and ((symbol^.option_2 <= 40))) then + if (symbol^.option_2 >= 1) and (symbol^.option_2 <= 40) then begin - if IsTrue(symbol^.option_2 > autosize) then + if symbol^.option_2 > autosize then begin version := symbol^.option_2; end else begin @@ -1876,15 +1876,15 @@ begin end else begin version := autosize; end; - if IsTrue(est_binlen <= qr_data_codewords_M[version - 1]) then + if est_binlen <= qr_data_codewords_M[version - 1] then begin ecc_level := LEVEL_M; end; - if IsTrue(est_binlen <= qr_data_codewords_Q[version - 1]) then + if est_binlen <= qr_data_codewords_Q[version - 1] then begin ecc_level := LEVEL_Q; end; - if IsTrue(est_binlen <= qr_data_codewords_H[version - 1]) then + if est_binlen <= qr_data_codewords_H[version - 1] then begin ecc_level := LEVEL_H; end; @@ -1928,7 +1928,7 @@ begin populate_grid (@grid[0], size, @fullstream[0], qr_total_codewords[version - 1]); bitmask := apply_bitmask (@grid[0], size); add_format_info (@grid[0], size, ecc_level, bitmask); - if IsTrue(version >= 7) then + if (version >= 7) then begin add_version_info (@grid[0], size, version); end; @@ -1940,7 +1940,7 @@ begin j := 0; while j < size do begin - if IsTrue(grid[(i * size) + j] and $01) then + if (grid[(i * size) + j] and $01 <> 0) then begin set_module (symbol, i, j); end; @@ -1990,7 +1990,7 @@ begin write( LineEnding ); end; repeat - if IsTrue(sysutils.strlen (binary) > 128) then + if (sysutils.strlen (binary) > 128) then begin exit (ERROR_TOO_LONG); end; @@ -2015,7 +2015,7 @@ begin while i < short_data_block_length do begin {INITCODE} jis := jisdata[position + i]; - if IsTrue(jis > $9FFF) then + if (jis > $9FFF) then begin jis := jis - $C140; end; @@ -2027,7 +2027,7 @@ begin begin write( format ('0x%.4X ',[prod]) ); end; - if IsTrue(sysutils.strlen (binary) > 128) then + if (sysutils.strlen (binary) > 128) then begin exit (ERROR_TOO_LONG); end; @@ -2058,7 +2058,7 @@ begin begin write( format ('0x%.4X ',[byte]) ); end; - if IsTrue(sysutils.strlen (binary) > 128) then + if (sysutils.strlen (binary) > 128) then begin exit (ERROR_TOO_LONG); end; @@ -2088,7 +2088,7 @@ begin first := posn (RHODIUM, Char (jisdata[position + i])); count := 1; prod := first; - if IsTrue(mode[position + i + 1] = 'A') then + if (mode[position + i + 1] = 'A') then begin second := posn (RHODIUM, Char (jisdata[position + i + 1])); count := 2; @@ -2099,7 +2099,7 @@ begin begin write( format ('0x%.4X ',[prod]) ); end; - if IsTrue(sysutils.strlen (binary) > 128) then + if (sysutils.strlen (binary) > 128) then begin exit (ERROR_TOO_LONG); end; @@ -2129,13 +2129,13 @@ begin first := posn (NEON, Char (jisdata[position + i])); count := 1; prod := first; - if IsTrue(mode[position + i + 1] = 'N') then + if (mode[position + i + 1] = 'N') then begin second := posn (NEON, Char (jisdata[position + i + 1])); count := 2; prod := (prod * 10) + second; end; - if IsTrue(mode[position + i + 2] = 'N') then + if (mode[position + i + 2] = 'N') then begin third := posn (NEON, Char (jisdata[position + i + 2])); count := 3; @@ -2146,7 +2146,7 @@ begin begin write( format ('0x%.4X (%d)',[prod, prod]) ); end; - if IsTrue(sysutils.strlen (binary) > 128) then + if (sysutils.strlen (binary) > 128) then begin exit (ERROR_TOO_LONG); end; @@ -2177,7 +2177,7 @@ begin end; i := 0; repeat - if IsTrue(((stream[i] = '0')) or ((stream[i] = '1'))) then + if (stream[i] = '0') or (stream[i] = '1') then begin Inc (count[0]); Inc (count[1]); @@ -2294,7 +2294,7 @@ begin bits_total := 20; latch := 0; bits_left := bits_total - sysutils.strlen (binary_data); - if IsTrue(bits_left <= 3) then + if (bits_left <= 3) then begin i := 0; while i < bits_left do @@ -2306,10 +2306,10 @@ begin end else begin concat (binary_data, '000'); end; - if IsTrue(latch = 0) then + if (latch = 0) then begin bits_left := bits_total - sysutils.strlen (binary_data); - if IsTrue(bits_left <= 4) then + if (bits_left <= 4) then begin i := 0; while i < bits_left do @@ -2320,10 +2320,10 @@ begin latch := 1; end; end; - if IsTrue(latch = 0) then + if (latch = 0) then begin remainder := 8 - (sysutils.strlen (binary_data) mod 8); - if IsTrue(remainder = 8) then + if (remainder = 8) then begin remainder := 0; end; @@ -2334,13 +2334,13 @@ begin Inc (i); end; bits_left := bits_total - sysutils.strlen (binary_data); - if IsTrue(bits_left > 4) then + if (bits_left > 4) then begin remainder := (bits_left - 4) div 8; i := 0; while i < remainder do begin - if IsTrue(i and 1) then begin + if i and 1 <> 0 then begin concat (binary_data, '00010001'); end else begin concat (binary_data, '11101100'); @@ -2356,54 +2356,54 @@ begin while i < (data_codewords - 1) do begin data_blocks[i] := 0; - if IsTrue(binary_data[i * 8] = '1') then + if (binary_data[i * 8] = '1') then begin data_blocks[i] := data_blocks[i] + $80; end; - if IsTrue(binary_data[(i * 8) + 1] = '1') then + if (binary_data[(i * 8) + 1] = '1') then begin data_blocks[i] := data_blocks[i] + $40; end; - if IsTrue(binary_data[(i * 8) + 2] = '1') then + if (binary_data[(i * 8) + 2] = '1') then begin data_blocks[i] := data_blocks[i] + $20; end; - if IsTrue(binary_data[(i * 8) + 3] = '1') then + if (binary_data[(i * 8) + 3] = '1') then begin data_blocks[i] := data_blocks[i] + $10; end; - if IsTrue(binary_data[(i * 8) + 4] = '1') then + if (binary_data[(i * 8) + 4] = '1') then begin data_blocks[i] := data_blocks[i] + $08; end; - if IsTrue(binary_data[(i * 8) + 5] = '1') then + if (binary_data[(i * 8) + 5] = '1') then begin data_blocks[i] := data_blocks[i] + $04; end; - if IsTrue(binary_data[(i * 8) + 6] = '1') then + if (binary_data[(i * 8) + 6] = '1') then begin data_blocks[i] := data_blocks[i] + $02; end; - if IsTrue(binary_data[(i * 8) + 7] = '1') then + if (binary_data[(i * 8) + 7] = '1') then begin data_blocks[i] := data_blocks[i] + $01; end; Inc (i); end; data_blocks[2] := 0; - if IsTrue(binary_data[16] = '1') then + if (binary_data[16] = '1') then begin data_blocks[2] := data_blocks[2] + $08; end; - if IsTrue(binary_data[17] = '1') then + if (binary_data[17] = '1') then begin data_blocks[2] := data_blocks[2] + $04; end; - if IsTrue(binary_data[18] = '1') then + if (binary_data[18] = '1') then begin data_blocks[2] := data_blocks[2] + $02; end; - if IsTrue(binary_data[19] = '1') then + if (binary_data[19] = '1') then begin data_blocks[2] := data_blocks[2] + $01; end; @@ -2432,16 +2432,16 @@ var data_blocks: array [0..6-1] of BYTE; begin latch := 0; - if IsTrue(ecc_mode = LEVEL_L) then + if (ecc_mode = LEVEL_L) then begin bits_total := 40; end; - if IsTrue(ecc_mode = LEVEL_M) then + if (ecc_mode = LEVEL_M) then begin bits_total := 32; end; bits_left := bits_total - sysutils.strlen (binary_data); - if IsTrue(bits_left <= 5) then + if (bits_left <= 5) then begin i := 0; while i < bits_left do @@ -2453,10 +2453,10 @@ begin end else begin concat (binary_data, '00000'); end; - if IsTrue(latch = 0) then + if (latch = 0) then begin remainder := 8 - (sysutils.strlen (binary_data) mod 8); - if IsTrue(remainder = 8) then + if (remainder = 8) then begin remainder := 0; end; @@ -2475,12 +2475,12 @@ begin Inc (i); end; end; - if IsTrue(ecc_mode = LEVEL_L) then + if (ecc_mode = LEVEL_L) then begin data_codewords := 5; ecc_codewords := 5; end; - if IsTrue(ecc_mode = LEVEL_M) then + if (ecc_mode = LEVEL_M) then begin data_codewords := 4; ecc_codewords := 6; @@ -2489,35 +2489,35 @@ begin while i < data_codewords do begin data_blocks[i] := 0; - if IsTrue(binary_data[i * 8] = '1') then + if (binary_data[i * 8] = '1') then begin data_blocks[i] := data_blocks[i] + $80; end; - if IsTrue(binary_data[(i * 8) + 1] = '1') then + if (binary_data[(i * 8) + 1] = '1') then begin data_blocks[i] := data_blocks[i] + $40; end; - if IsTrue(binary_data[(i * 8) + 2] = '1') then + if (binary_data[(i * 8) + 2] = '1') then begin data_blocks[i] := data_blocks[i] + $20; end; - if IsTrue(binary_data[(i * 8) + 3] = '1') then + if (binary_data[(i * 8) + 3] = '1') then begin data_blocks[i] := data_blocks[i] + $10; end; - if IsTrue(binary_data[(i * 8) + 4] = '1') then + if (binary_data[(i * 8) + 4] = '1') then begin data_blocks[i] := data_blocks[i] + $08; end; - if IsTrue(binary_data[(i * 8) + 5] = '1') then + if (binary_data[(i * 8) + 5] = '1') then begin data_blocks[i] := data_blocks[i] + $04; end; - if IsTrue(binary_data[(i * 8) + 6] = '1') then + if (binary_data[(i * 8) + 6] = '1') then begin data_blocks[i] := data_blocks[i] + $02; end; - if IsTrue(binary_data[(i * 8) + 7] = '1') then + if (binary_data[(i * 8) + 7] = '1') then begin data_blocks[i] := data_blocks[i] + $01; end; @@ -2549,16 +2549,16 @@ var data_blocks: array [0..12-1] of BYTE; begin latch := 0; - if IsTrue(ecc_mode = LEVEL_L) then + if (ecc_mode = LEVEL_L) then begin bits_total := 84; end; - if IsTrue(ecc_mode = LEVEL_M) then + if (ecc_mode = LEVEL_M) then begin bits_total := 68; end; bits_left := bits_total - sysutils.strlen (binary_data); - if IsTrue(bits_left <= 7) then + if (bits_left <= 7) then begin i := 0; while i < bits_left do @@ -2570,10 +2570,10 @@ begin end else begin concat (binary_data, '0000000'); end; - if IsTrue(latch = 0) then + if (latch = 0) then begin bits_left := bits_total - sysutils.strlen (binary_data); - if IsTrue(bits_left <= 4) then + if (bits_left <= 4) then begin i := 0; while i < bits_left do @@ -2584,10 +2584,10 @@ begin latch := 1; end; end; - if IsTrue(latch = 0) then + if (latch = 0) then begin remainder := 8 - (sysutils.strlen (binary_data) mod 8); - if IsTrue(remainder = 8) then + if (remainder = 8) then begin remainder := 0; end; @@ -2598,7 +2598,7 @@ begin Inc (i); end; bits_left := bits_total - sysutils.strlen (binary_data); - if IsTrue(bits_left > 4) then + if (bits_left > 4) then begin remainder := (bits_left - 4) div 8; i := 0; @@ -2610,12 +2610,12 @@ begin end; concat (binary_data, '0000'); end; - if IsTrue(ecc_mode = LEVEL_L) then + if (ecc_mode = LEVEL_L) then begin data_codewords := 11; ecc_codewords := 6; end; - if IsTrue(ecc_mode = LEVEL_M) then + if (ecc_mode = LEVEL_M) then begin data_codewords := 9; ecc_codewords := 8; @@ -2624,76 +2624,76 @@ begin while i < (data_codewords - 1) do begin data_blocks[i] := 0; - if IsTrue(binary_data[i * 8] = '1') then + if (binary_data[i * 8] = '1') then begin data_blocks[i] := data_blocks[i] + $80; end; - if IsTrue(binary_data[(i * 8) + 1] = '1') then + if (binary_data[(i * 8) + 1] = '1') then begin data_blocks[i] := data_blocks[i] + $40; end; - if IsTrue(binary_data[(i * 8) + 2] = '1') then + if (binary_data[(i * 8) + 2] = '1') then begin data_blocks[i] := data_blocks[i] + $20; end; - if IsTrue(binary_data[(i * 8) + 3] = '1') then + if (binary_data[(i * 8) + 3] = '1') then begin data_blocks[i] := data_blocks[i] + $10; end; - if IsTrue(binary_data[(i * 8) + 4] = '1') then + if (binary_data[(i * 8) + 4] = '1') then begin data_blocks[i] := data_blocks[i] + $08; end; - if IsTrue(binary_data[(i * 8) + 5] = '1') then + if (binary_data[(i * 8) + 5] = '1') then begin data_blocks[i] := data_blocks[i] + $04; end; - if IsTrue(binary_data[(i * 8) + 6] = '1') then + if (binary_data[(i * 8) + 6] = '1') then begin data_blocks[i] := data_blocks[i] + $02; end; - if IsTrue(binary_data[(i * 8) + 7] = '1') then + if (binary_data[(i * 8) + 7] = '1') then begin data_blocks[i] := data_blocks[i] + $01; end; Inc (i); end; - if IsTrue(ecc_mode = LEVEL_L) then + if (ecc_mode = LEVEL_L) then begin data_blocks[11] := 0; - if IsTrue(binary_data[80] = '1') then + if (binary_data[80] = '1') then begin data_blocks[2] := data_blocks[2] + $08; end; - if IsTrue(binary_data[81] = '1') then + if (binary_data[81] = '1') then begin data_blocks[2] := data_blocks[2] + $04; end; - if IsTrue(binary_data[82] = '1') then + if (binary_data[82] = '1') then begin data_blocks[2] := data_blocks[2] + $02; end; - if IsTrue(binary_data[83] = '1') then + if (binary_data[83] = '1') then begin data_blocks[2] := data_blocks[2] + $01; end; end; - if IsTrue(ecc_mode = LEVEL_M) then + if (ecc_mode = LEVEL_M) then begin data_blocks[9] := 0; - if IsTrue(binary_data[64] = '1') then + if (binary_data[64] = '1') then begin data_blocks[2] := data_blocks[2] + $08; end; - if IsTrue(binary_data[65] = '1') then + if (binary_data[65] = '1') then begin data_blocks[2] := data_blocks[2] + $04; end; - if IsTrue(binary_data[66] = '1') then + if (binary_data[66] = '1') then begin data_blocks[2] := data_blocks[2] + $02; end; - if IsTrue(binary_data[67] = '1') then + if (binary_data[67] = '1') then begin data_blocks[2] := data_blocks[2] + $01; end; @@ -2724,20 +2724,20 @@ var data_blocks: array [0..17-1] of BYTE; begin latch := 0; - if IsTrue(ecc_mode = LEVEL_L) then + if (ecc_mode = LEVEL_L) then begin bits_total := 128; end; - if IsTrue(ecc_mode = LEVEL_M) then + if (ecc_mode = LEVEL_M) then begin bits_total := 112; end; - if IsTrue(ecc_mode = LEVEL_Q) then + if (ecc_mode = LEVEL_Q) then begin bits_total := 80; end; bits_left := bits_total - sysutils.strlen (binary_data); - if IsTrue(bits_left <= 9) then + if (bits_left <= 9) then begin i := 0; while i < bits_left do @@ -2749,10 +2749,10 @@ begin end else begin concat (binary_data, '000000000'); end; - if IsTrue(latch = 0) then + if (latch = 0) then begin remainder := 8 - (sysutils.strlen (binary_data) mod 8); - if IsTrue(remainder = 8) then + if (remainder = 8) then begin remainder := 0; end; @@ -2771,17 +2771,17 @@ begin Inc (i); end; end; - if IsTrue(ecc_mode = LEVEL_L) then + if (ecc_mode = LEVEL_L) then begin data_codewords := 16; ecc_codewords := 8; end; - if IsTrue(ecc_mode = LEVEL_M) then + if (ecc_mode = LEVEL_M) then begin data_codewords := 14; ecc_codewords := 10; end; - if IsTrue(ecc_mode = LEVEL_Q) then + if (ecc_mode = LEVEL_Q) then begin data_codewords := 10; ecc_codewords := 14; @@ -2790,35 +2790,35 @@ begin while i < data_codewords do begin data_blocks[i] := 0; - if IsTrue(binary_data[i * 8] = '1') then + if (binary_data[i * 8] = '1') then begin data_blocks[i] := data_blocks[i] + $80; end; - if IsTrue(binary_data[(i * 8) + 1] = '1') then + if (binary_data[(i * 8) + 1] = '1') then begin data_blocks[i] := data_blocks[i] + $40; end; - if IsTrue(binary_data[(i * 8) + 2] = '1') then + if (binary_data[(i * 8) + 2] = '1') then begin data_blocks[i] := data_blocks[i] + $20; end; - if IsTrue(binary_data[(i * 8) + 3] = '1') then + if (binary_data[(i * 8) + 3] = '1') then begin data_blocks[i] := data_blocks[i] + $10; end; - if IsTrue(binary_data[(i * 8) + 4] = '1') then + if (binary_data[(i * 8) + 4] = '1') then begin data_blocks[i] := data_blocks[i] + $08; end; - if IsTrue(binary_data[(i * 8) + 5] = '1') then + if (binary_data[(i * 8) + 5] = '1') then begin data_blocks[i] := data_blocks[i] + $04; end; - if IsTrue(binary_data[(i * 8) + 6] = '1') then + if (binary_data[(i * 8) + 6] = '1') then begin data_blocks[i] := data_blocks[i] + $02; end; - if IsTrue(binary_data[(i * 8) + 7] = '1') then + if (binary_data[(i * 8) + 7] = '1') then begin data_blocks[i] := data_blocks[i] + $01; end; @@ -2846,7 +2846,7 @@ begin i := 0; while i < size do begin - if IsTrue(toggle = 1) then + if (toggle = 1) then begin grid[i] := $21; grid[(i * size)] := $21; @@ -2895,7 +2895,7 @@ begin x := (size - 2) - (row * 2); if not IsTrue((grid[(y * size) + (x + 1)] and $F0)) then begin - if IsTrue(full_stream[i] = '1') then + if (full_stream[i] = '1') then begin grid[(y * size) + (x + 1)] := $01; end else begin @@ -2903,11 +2903,11 @@ begin end; Inc (i); end; - if IsTrue(i < n) then + if (i < n) then begin if not IsTrue((grid[(y * size) + x] and $F0)) then begin - if IsTrue(full_stream[i] = '1') then + if (full_stream[i] = '1') then begin grid[(y * size) + x] := $01; end else begin @@ -2922,13 +2922,13 @@ begin end else begin Inc (y); end; - if IsTrue(y = 0) then + if (y = 0) then begin Inc (row); y := 1; direction := 0; end; - if IsTrue(y = size) then + if (y = size) then begin Inc (row); y := size - 1; @@ -2970,7 +2970,7 @@ begin end; Inc (i); end; - if IsTrue(sum1 <= sum2) then + if (sum1 <= sum2) then begin retval := (sum1 * 16) + sum2; end else begin @@ -3003,19 +3003,19 @@ begin mask[(y * size) + x] := $00; if not IsTrue((grid[(y * size) + x] and $F0)) then begin - if IsTrue((y and 1) = 0) then + if ((y and 1) = 0) then begin mask[(y * size) + x] := mask[(y * size) + x] + $01; end; - if IsTrue((((y div 2) + (x div 3)) and 1) = 0) then + if ((((y div 2) + (x div 3)) and 1) = 0) then begin mask[(y * size) + x] := mask[(y * size) + x] + $02; end; - if IsTrue(((((y * x) and 1) + ((y * x) mod 3)) and 1) = 0) then + if (((((y * x) and 1) + ((y * x) mod 3)) and 1) = 0) then begin mask[(y * size) + x] := mask[(y * size) + x] + $04; end; - if IsTrue(((((y + x) and 1) + ((y * x) mod 3)) and 1) = 0) then + if (((((y + x) and 1) + ((y * x) mod 3)) and 1) = 0) then begin mask[(y * size) + x] := mask[(y * size) + x] + $08; end; @@ -3052,7 +3052,7 @@ begin pattern := 1; while pattern < 4 do begin - if IsTrue(value[pattern] > best_val) then + if (value[pattern] > best_val) then begin best_pattern := pattern; best_val := value[pattern]; @@ -3096,7 +3096,7 @@ begin end; end; end; - if IsTrue(bit = 1) then + if (bit = 1) then begin if IsTrue(grid[(y * size) + x] and $01) then begin @@ -3143,7 +3143,7 @@ begin {INITCODE} alphanum_used := 0; {INITCODE} kanji_used := 0; {INITCODE} error_number := 0; - if IsTrue(length > 35) then + if (length > 35) then begin strcpy (symbol^.errtxt, 'Input data too long'); exit (ERROR_TOO_LONG); @@ -3167,27 +3167,27 @@ begin otherwise begin error_number := utf8toutf16 (symbol, source, utfdata, @length); - if IsTrue(error_number <> 0) then + if (error_number <> 0) then begin exit (error_number); end; i := 0; while i < length do begin - if IsTrue(utfdata[i] <= $FF) then + if (utfdata[i] <= $FF) then begin jisdata[i] := utfdata[i]; end else begin j := 0; glyph := 0; repeat - if IsTrue(sjis_lookup[j * 2] = utfdata[i]) then + if (sjis_lookup[j * 2] = utfdata[i]) then begin glyph := sjis_lookup[(j * 2) + 1]; end; Inc (j); until not (((j < 6843)) and ((glyph = 0))); - if IsTrue(glyph = 0) then + if (glyph = 0) then begin strcpy (symbol^.errtxt, 'Invalid character in input data'); exit (ERROR_INVALID_DATA); @@ -3204,7 +3204,7 @@ begin i := 0; while i < length do begin - if IsTrue(((jisdata[i] >= integer('0'))) and ((jisdata[i] <= integer('9')))) then + if (jisdata[i] >= integer('0')) and (jisdata[i] <= integer('9')) then begin Inc (n_count); end; @@ -3214,7 +3214,7 @@ begin end; Inc (i); end; - if IsTrue(a_count = length) then + if (a_count = length) then begin i := 0; while i < length do @@ -3223,7 +3223,7 @@ begin Inc (i); end; end; - if IsTrue(n_count = length) then + if (n_count = length) then begin i := 0; while i < length do @@ -3233,7 +3233,7 @@ begin end; end; error_number := micro_qr_intermediate (binary_stream, jisdata, mode, length, @kanji_used, @alphanum_used, @byte_used); - if IsTrue(error_number <> 0) then + if (error_number <> 0) then begin strcpy (symbol^.errtxt, 'Input data too long'); exit (error_number); @@ -3253,103 +3253,103 @@ begin version_valid[0] := 0; version_valid[1] := 0; end; - if IsTrue(binary_count[0] > 20) then + if (binary_count[0] > 20) then begin version_valid[0] := 0; end; - if IsTrue(binary_count[1] > 40) then + if (binary_count[1] > 40) then begin version_valid[1] := 0; end; - if IsTrue(binary_count[2] > 84) then + if (binary_count[2] > 84) then begin version_valid[2] := 0; end; - if IsTrue(binary_count[3] > 128) then + if (binary_count[3] > 128) then begin strcpy (symbol^.errtxt, 'Input data too long'); exit (ERROR_TOO_LONG); end; ecc_level := LEVEL_L; - if IsTrue(((symbol^.option_1 >= 1)) and ((symbol^.option_2 <= 4))) then + if (symbol^.option_1 >= 1) and (symbol^.option_2 <= 4) then begin ecc_level := symbol^.option_1; end; - if IsTrue(ecc_level = LEVEL_H) then + if (ecc_level = LEVEL_H) then begin strcpy (symbol^.errtxt, 'Error correction level H not available'); exit (ERROR_INVALID_OPTION); end; - if IsTrue(ecc_level = LEVEL_Q) then + if (ecc_level = LEVEL_Q) then begin version_valid[0] := 0; version_valid[1] := 0; version_valid[2] := 0; - if IsTrue(binary_count[3] > 80) then + if (binary_count[3] > 80) then begin strcpy (symbol^.errtxt, 'Input data too long'); exit (ERROR_TOO_LONG); end; end; - if IsTrue(ecc_level = LEVEL_M) then + if (ecc_level = LEVEL_M) then begin version_valid[0] := 0; - if IsTrue(binary_count[1] > 32) then + if (binary_count[1] > 32) then begin version_valid[1] := 0; end; - if IsTrue(binary_count[2] > 68) then + if (binary_count[2] > 68) then begin version_valid[2] := 0; end; - if IsTrue(binary_count[3] > 112) then + if (binary_count[3] > 112) then begin strcpy (symbol^.errtxt, 'Input data too long'); exit (ERROR_TOO_LONG); end; end; autoversion := 3; - if IsTrue(version_valid[2]) then + if (version_valid[2] <> 0) then begin autoversion := 2; end; - if IsTrue(version_valid[1]) then + if (version_valid[1] <> 0) then begin autoversion := 1; end; - if IsTrue(version_valid[0]) then + if (version_valid[0] <> 0) then begin autoversion := 0; end; version := autoversion; - if IsTrue(((symbol^.option_2 >= 1)) and ((symbol^.option_2 <= 4))) then + if (symbol^.option_2 >= 1) and (symbol^.option_2 <= 4) then begin - if IsTrue(symbol^.option_2 >= autoversion) then + if (symbol^.option_2 >= autoversion) then begin version := symbol^.option_2; end; end; - if IsTrue(version = 3) then + if (version = 3) then begin - if IsTrue(binary_count[3] <= 112) then + if (binary_count[3] <= 112) then begin ecc_level := LEVEL_M; end; - if IsTrue(binary_count[3] <= 80) then + if (binary_count[3] <= 80) then begin ecc_level := LEVEL_Q; end; end; - if IsTrue(version = 2) then + if (version = 2) then begin - if IsTrue(binary_count[2] <= 68) then + if (binary_count[2] <= 68) then begin ecc_level := LEVEL_M; end; end; - if IsTrue(version = 1) then + if (version = 1) then begin - if IsTrue(binary_count[1] <= 32) then + if (binary_count[1] <= 32) then begin ecc_level := LEVEL_M; end;