X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/1d37e00ff50c4cee3f23749febcfe6e33e1f608a..1b025f386b84705e81bd75c166bf0f08d5891608:/charset.plp diff --git a/charset.plp b/charset.plp index bce918b..28c21c9 100644 --- a/charset.plp +++ b/charset.plp @@ -1,48 +1,44 @@ -<: -use utf8; -use strict; -use warnings; -use open IO => ':utf8'; - -our $VERSION = 'v1.0'; - -$header{content_type} = 'text/html; charset=utf-8'; - -:> - +<(common.inc.plp)><: -
-Encoding $input unknown
\n"; + Alert("Encoding$inputunknown"); } - \%row; + $row{set} ? \%row : (); } else { (); } } map { defined $ALIAS{$_} ? @{ $ALIAS{$_} } : $_ } - $ENV{PATH_INFO} =~ /\w/ ? split(m{[/+\s]}, $ENV{PATH_INFO}) : 'default'; + $Request =~ /\w/ ? split(m{[/+\s]}, $Request) : 'default'; my $NOCHAR = chr 0xFFFD; for my $cp437 (grep {$request[$_]->{set} eq 'cp437'} 0 .. $#request) { @@ -101,63 +105,112 @@ for my $cp437 (grep {$request[$_]->{set} eq 'cp437'} 0 .. $#request) { ); } -sub quote { - local $_ = shift; - s/"/"/g; - s/</g; - s/>/>/g; - return $_; -} +sub range_cell { + my ($info, $offset) = @_; + my $table = $info->{cell} or return; + my $def = $table->{$offset} or return; + my ($len, $class, $name, $title) = @{$def}; + + my $cols = $info->{cols}; + my $colsize = $table->{colsize} || 1; + my $attr = ''; + $len /= $colsize; + $name //= $len <= 2 ? 'res' : 'reserved'; -print "
â±"; - print ' | ', $_ for @nibble; + print "<$section> | |
---|---|---|
", $rowdiv == 1 ? '+' : 'â±'; + printf ' | %0*X', $coldigits, $_ * $colsize for 0 .. $cols - 1; print "\n"; } print ' | |
%X', $msb + ($row->{offset} >> 4); - for my $lsb (0 .. $#nibble) { + while ($offset < $endpoint - 1) { + print ' | ||
'; + { + if (my $rowmod = $offset % $rowdiv) { + # offset in column units + printf '+%X', $rowmod; + } + else { + # divided row offset + printf '%X', ($offset + $row->{offset}) / $rowdiv; + } + } + for (1 .. $cols) { if ($row->{cell}) { - print $row->{cell}->(($msb<<4) + $lsb); + print range_cell($row, $offset); next; } - my $glyph = substr $row->{table}, ($msb<<4) + $lsb, 1; + my $glyph = substr $row->{table}, $offset, 1; if ($glyph eq $NOCHAR) { print ' | '; next; } - my $info = [ord $glyph]; - if (defined (my $mnem = $di{ord $glyph})) { - $info = $diinfo->{$mnem}; - } - my ($codepoint, $name, $prop, $script, $string) = @$info; - - $glyph = quote($string || $glyph); - my $desc = sprintf 'U+%04X%s', $codepoint, $name && " ($name)"; - my @class = ('X', grep {$_} $prop, $script); - - $glyph = "$glyph" if $prop eq 'Zs'; - - printf "\n".' | %s', - join(' ', @class), quote($desc), $glyph; + print "\n".$glyphs->glyph_cell($glyph); + } + continue { + $offset += $colsize; } print "\n"; } - print " |
unicode 5.0 + | unicode 7.0 | proposed | deprecated | unassigned @@ -202,12 +255,3 @@ print "\n"; |