git.shiar.nl
/
sheet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
e820f6a
)
charset: length not derived from table
author
Mischa POSLAWSKY
<perl@shiar.org>
Sat, 8 Apr 2017 01:06:05 +0000
(
03:06
+0200)
committer
Mischa POSLAWSKY
<perl@shiar.org>
Mon, 24 Apr 2017 23:51:41 +0000
(
01:51
+0200)
charset.plp
patch
|
blob
|
history
diff --git
a/charset.plp
b/charset.plp
index f80a25012543a130f66470c87d695ea578eaa789..16a49e92cd132dbf2220cd37cd404955628b8703 100644
(file)
--- a/
charset.plp
+++ b/
charset.plp
@@
-137,10
+137,11
@@
sub tabinput {
my $end = $2 ? hex($2) << 4 : $start + 240;
$row{table} = join '', map { chr } $start .. $end+15;
utf8::upgrade($row{table}); # prevent latin1 output
my $end = $2 ? hex($2) << 4 : $start + 240;
$row{table} = join '', map { chr } $start .. $end+15;
utf8::upgrade($row{table}); # prevent latin1 output
+ $row{len} = length $row{table};
$row{set} = sprintf 'Unicode block U+%02Xxx', $start >> 8;
}
elsif ($input eq 'U') {
$row{set} = sprintf 'Unicode block U+%02Xxx', $start >> 8;
}
elsif ($input eq 'U') {
- $row{
table} = ' ' x
1024;
+ $row{
len} =
1024;
$row{set} = 'Unicode planes';
$row{cell} = do 'charset-ucplanes.inc.pl'
or Alert('Table data could not be read', $@ || $!);
$row{set} = 'Unicode planes';
$row{cell} = do 'charset-ucplanes.inc.pl'
or Alert('Table data could not be read', $@ || $!);
@@
-148,18
+149,19
@@
sub tabinput {
}
elsif ($row{set} = Encode::resolve_alias($input)) {
if ($row{set} eq 'Internal') {
}
elsif ($row{set} = Encode::resolve_alias($input)) {
if ($row{set} eq 'Internal') {
- $row{
table} = ' ' x ($endpoint < 255 ? 640 : 8192)
;
+ $row{
len} = $endpoint < 255 ? 640 : 8192
;
$row{set} = 'Unicode BMP';
$row{cell} = do 'charset-unicode.inc.pl'
or Alert('Table data could not be read', $@ || $!);
}
elsif ($row{set} eq 'utf-8-strict') {
$row{set} = 'Unicode BMP';
$row{cell} = do 'charset-unicode.inc.pl'
or Alert('Table data could not be read', $@ || $!);
}
elsif ($row{set} eq 'utf-8-strict') {
- $row{
table} = undef
;
+ $row{
len} = 256
;
$row{set} = 'UTF-8';
$row{cell} = do 'charset-utf8.inc.pl'
or Alert('Table data could not be read', $@ || $!);
}
else {
$row{set} = 'UTF-8';
$row{cell} = do 'charset-utf8.inc.pl'
or Alert('Table data could not be read', $@ || $!);
}
else {
+ $row{len} = $endpoint - $row{offset};
$row{table} = Encode::decode($row{set}, pack 'C*', $row{offset} .. $endpoint);
# (~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);
# (~16x faster than decoding in loop;
# substr strings is twice as fast as splitting to an array)
@@
-247,7
+249,7
@@
for my $row (@request) {
my $rowdiv = 16 ** $coldigits; # row divide for column digits
$rowdiv = 1 if $rowdiv != $cols * $colsize; # divide only if all columns are matched
my $offset = 0;
my $rowdiv = 16 ** $coldigits; # row divide for column digits
$rowdiv = 1 if $rowdiv != $cols * $colsize; # divide only if all columns are matched
my $offset = 0;
- my $endpoint = $offset +
(length($row->{table}) || 256)
* $colsize;
+ my $endpoint = $offset +
$row->{len}
* $colsize;
printf '<div class="section"><table class="glyphs%s">', !$row->{cell} && ' charmap';
my $title = $row->{set};
printf '<div class="section"><table class="glyphs%s">', !$row->{cell} && ' charmap';
my $title = $row->{set};