-# generate character table(s)
-# (~16x faster than decoding in loop;
-# substr strings is twice as fast as splitting to an array)
-my %ALIAS = (
-# default => [qw(unicode utf-8 iso-8859-1 cp437 -cp1252- --iso-8859-15- -koi8-f)],
- default => [qw(unicode- utf-8 iso-8859-1 -cp1252- --iso-8859-15- cp437 -cp850)],
- 0 => [qw(cp437 -cp863)],
- 1 => [qw(iso-8859-1 -cp1252 -MacRoman -cp850)],
- 2 => [qw(iso-8859-2 -cp1250 -cp852 -MacCentralEurRoman -MacCroatian -MacRumanian)],
- 5 => [qw(koi8-f -iso-8859-5 -cp1251 -MacCyrillic -cp855 -cp866)],
- 7 => [qw(iso-8859-7 -cp1253 -MacGreek -cp737 -cp869)],
- 8 => [qw(iso-8859-8 -cp1255 -MacHebrew -cp862)],
-);
-my @request = map {
- if (my $input = $_) {
- my %row = (offset => 0, cols => 16);
- my $endpoint = 255;
- if ($input =~ s/^--//) {
- $row{offset} = $endpoint > 160 ? 160 : 48;
- }
- elsif ($input =~ s/^-//) {
- $row{offset} = $endpoint > 128 ? 128 : 32;
+my $charsets = Data('charset');
+
+sub tabinput {
+ # generate character table(s)
+ my $input = shift or return;
+ my $params = $input =~ s/[+](.*)\z// ? $1 : undef;
+ my $charset = $charsets->{lc $input} || {};
+
+ if (ref $charset ne 'HASH') {
+ $params and Alert("Parameters ignored for $input",
+ "Cannot apply <q>$params</q> to multiple charsets.",
+ );
+ tabinput($_) for ref $charset ? @{$charset} : $charset;
+ return;
+ }
+
+ state $visible = {'' => 1}; # all present tables
+ my %row = (offset => 0, cols => 16);
+ $row{$_} = $charset->{$_} for qw( note table ); # copy metadata
+
+ if (not defined $params) {
+ my @parents = @{ $charset->{inherit} || [] };
+
+ if (my ($parent, $part) = pairfirst { defined $visible->{$a} } @parents) {
+ $row{parent} = $parent;
+ $params = $part;
+ $params = 80 unless $visible->{$parent}
+ or ($input eq 'MacCroatian' and defined $visible->{MacRomanian});