Skip to content
This repository was archived by the owner on Jun 8, 2018. It is now read-only.

Commit d3ea32a

Browse files
committed
sjisutf8: Better local variable names
1 parent 865d6b2 commit d3ea32a

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

sjisutf8.pas

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,34 +1010,36 @@ function GetUTF8(sjis : dword) : string;
10101010
// Output: a string of 1-3 bytes, with this code point in UTF-8.
10111011
//
10121012
// If the input value is invalid, returns an empty string.
1013-
var ivar : dword;
1013+
var i : dword;
10141014
begin
1015-
ivar := 0;
1015+
i := 0;
10161016

10171017
// -----------------------------------------------------------------
10181018
// Single-byte encodings
10191019
if sjis <= $FF then begin
10201020
case sjis of
1021-
$20..$5B, $5D..$7D: ivar := sjis; // plain ASCII
1022-
$5C: ivar := $A5C2; // 0xC2A5, yen sign
1023-
$7E: ivar := $BE80E2; // 0xE280BE, overline
1024-
$A1..$BF: ivar := sjis shl 16 + $BDEF; // halfwidth katakana
1025-
$C0..$DF: ivar := sjis shl 16 - $3F4111; // more halfwidth katakana
1021+
$20..$5B, $5D..$7D: i := sjis; // plain ASCII
1022+
$5C: i := $A5C2; // 0xC2A5, yen sign
1023+
$7E: i := $BE80E2; // 0xE280BE, overline
1024+
$A1..$BF: i := sjis shl 16 + $BDEF; // halfwidth katakana
1025+
$C0..$DF: i := sjis shl 16 - $3F4111; // more halfwidth katakana
10261026
end;
10271027
end
10281028

10291029
// -----------------------------------------------------------------
10301030
// Double-byte encodings
1031-
else if (sjis >= $E040) and (sjis <= $EAA4) then ivar := group3[sjis]
1032-
else if (sjis >= $889F) and (sjis <= $9FFC) then ivar := group2[sjis]
1033-
else if (sjis >= $8140) and (sjis <= $84BE) then ivar := group1[sjis]
1031+
else if (sjis >= $E040) and (sjis <= $EAA4) then i := group3[sjis]
1032+
else if (sjis >= $889F) and (sjis <= $9FFC) then i := group2[sjis]
1033+
else if (sjis >= $8140) and (sjis <= $84BE) then i := group1[sjis]
10341034
;
10351035

10361036
byte(GetUTF8[0]) := 3;
1037-
dword((@GetUTF8[1])^) := ivar;
1038-
if ivar <= $FF then byte(GetUTF8[0]) := 1
1039-
else if ivar <= $FFFF then byte(GetUTF8[0]) := 2;
1037+
dword((@GetUTF8[1])^) := i;
1038+
if i <= $FF then byte(GetUTF8[0]) := 1
1039+
else if i <= $FFFF then byte(GetUTF8[0]) := 2;
10401040
end;
10411041

1042-
begin
1042+
// ------------------------------------------------------------------
1043+
initialization
1044+
finalization
10431045
end.

0 commit comments

Comments
 (0)