git.shiar.nl
/
sheet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
charset: avoid intermediate endpoint variable
[sheet.git]
/
charset.plp
diff --git
a/charset.plp
b/charset.plp
index 54e3b45761017930cf0b466d7d0c3295d995e7f5..b1167ea8a1a7056646941013be51188927bc9c14 100644
(file)
--- a/
charset.plp
+++ b/
charset.plp
@@
-126,7
+126,6
@@
sub tabinput {
state $visible = {}; # all present tables
my %row = (offset => 0, cols => 16);
state $visible = {}; # all present tables
my %row = (offset => 0, cols => 16);
- my $endpoint = 255;
my $params = $input =~ s/[+](.*)\z// ? $1 : undef;
if (not defined $params) {
my $params = $input =~ s/[+](.*)\z// ? $1 : undef;
if (not defined $params) {
@@
-238,7
+237,7
@@
sub tabinput {
]);
$row{offset} = $+{offset};
]);
$row{offset} = $+{offset};
- $
endpoint
= $+{endpoint} if $+{endpoint};
+ $
row{endpoint}
= $+{endpoint} if $+{endpoint};
if (my $restart = $+{restart}) {
my $skip = int(($+{stop} || $row{offset}) / $row{cols});
for ($skip + 1 .. ($restart / $row{cols}) - 1) {
if (my $restart = $+{restart}) {
my $skip = int(($+{stop} || $row{offset}) / $row{cols});
for ($skip + 1 .. ($restart / $row{cols}) - 1) {
@@
-267,7
+266,8
@@
sub tabinput {
$row{cell} = do 'charset-unicode.inc.pl'
or Alert('Table data could not be read', $@ || $!);
$row{cell} = do 'charset-unicode.inc.pl'
or Alert('Table data could not be read', $@ || $!);
- $row{endpoint } = $row{cell}->{colsize} * ($endpoint || 8191);
+ $row{endpoint} ||= 8191;
+ $row{endpoint} *= $row{cell}->{colsize};
$row{startpoint} = $row{cell}->{colsize} * $row{offset};
$row{offset} = 0;
$row{set} = 'Unicode ' . (
$row{startpoint} = $row{cell}->{colsize} * $row{offset};
$row{offset} = 0;
$row{set} = 'Unicode ' . (
@@
-283,18
+283,19
@@
sub tabinput {
$row{endpoint} = 255;
}
else {
$row{endpoint} = 255;
}
else {
+ $row{endpoint} ||= 255;
if ($row{set} eq 'MacHebrew' or $row{set} eq 'MacThai') {
# array of possibly multiple characters per code point
$row{table} = [
if ($row{set} eq 'MacHebrew' or $row{set} eq 'MacThai') {
# array of possibly multiple characters per code point
$row{table} = [
- map { Encode::decode($row{set}, pack 'C*', $_) } $row{offset} .. $
endpoint
+ map { Encode::decode($row{set}, pack 'C*', $_) } $row{offset} .. $
row{endpoint}
];
}
else {
# ~16x faster than decoding in loop;
# substr strings is twice as fast as splitting to an array
];
}
else {
# ~16x faster than decoding in loop;
# substr strings is twice as fast as splitting to an array
- $row{table} = Encode::decode($row{set}, pack 'C*', $row{offset} .. $
endpoint
);
+ $row{table} = Encode::decode($row{set}, pack 'C*', $row{offset} .. $
row{endpoint}
);
}
}
- $row{endpoint}
= $endpoint -
$row{offset};
+ $row{endpoint}
-=
$row{offset};
if ($row{set} eq 'cp437' and !$row{offset}) {
substr($row{table}, 237, 1) = pack 'U*', 0x3D5; # phi sign
if ($row{set} eq 'cp437' and !$row{offset}) {
substr($row{table}, 237, 1) = pack 'U*', 0x3D5; # phi sign