summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorse <se@FreeBSD.org>2014-08-20 07:46:28 +0000
committerse <se@FreeBSD.org>2014-08-20 07:46:28 +0000
commitc430a5c3c1e5d5b66d3e7bc4424716b62bf6168b (patch)
tree7f6ef09963eafa5603d859653478f6fb58e0dad9 /tools
parent746eb54add91be6c3e673f114fc09e2f892c6f85 (diff)
downloadFreeBSD-src-c430a5c3c1e5d5b66d3e7bc4424716b62bf6168b.zip
FreeBSD-src-c430a5c3c1e5d5b66d3e7bc4424716b62bf6168b.tar.gz
Fix further conversion errors found while testing the converted keymaps.
MFC after: 3 days
Diffstat (limited to 'tools')
-rwxr-xr-xtools/tools/vt/keymaps/convert-keymap.pl31
-rwxr-xr-xtools/tools/vt/keymaps/convert-keymaps.pl2
2 files changed, 25 insertions, 8 deletions
diff --git a/tools/tools/vt/keymaps/convert-keymap.pl b/tools/tools/vt/keymaps/convert-keymap.pl
index 42349fa..f2a0799 100755
--- a/tools/tools/vt/keymaps/convert-keymap.pl
+++ b/tools/tools/vt/keymaps/convert-keymap.pl
@@ -35,33 +35,50 @@ sub local_to_UCS_code
return prettyprint_token(ord(Encode::decode("UTF-8", local_to_UCS_string($char))));
}
+sub malformed_to_UCS_code
+{
+ my ($char) = @_;
+
+ return prettyprint_token(ord(Encode::decode("UTF-8", $char)));
+}
sub convert_token
{
my ($C) = @_;
return $1
- if $C =~ m/^([a-z][a-z0-9]*)$/; # key token
+ if $C =~ m/^([a-z][a-z0-9]*)$/; # key token
return local_to_UCS_code(chr($1))
- if $C =~ m/^(\d+)$/; # decimal number
+ if $C =~ m/^(\d+)$/; # decimal number
return local_to_UCS_code(chr(hex($1)))
- if $C =~ m/^0x([0-9a-f]+)$/i; # hex number
+ if $C =~ m/^0x([0-9a-f]+)$/i; # hex number
return local_to_UCS_code(chr(ord($1)))
- if $C =~ m/^'(.)'$/; # character
- return "<?$C?>"; # uncovered case
+ if $C =~ m/^'(.)'$/; # character
+ return malformed_to_UCS_code($1)
+ if $C =~ m/^'(.+)'$/; # character
+ return "<?$C?>"; # uncovered case
}
sub tokenize { # split on white space and parentheses (but not within token)
my ($line) = @_;
- $line =~ s/' '/ _spc_ /g; # prevent splitting of ' '
+#print "<< $line";
$line =~ s/'\('/ _lpar_ /g; # prevent splitting of '('
$line =~ s/'\)'/ _rpar_ /g; # prevent splitting of ')'
+ $line =~ s/'''/'_squote_'/g; # remove quoted single quotes from matches below
$line =~ s/([()])/ $1 /g; # insert blanks around remaining parentheses
+ my $matches;
+ do {
+ $matches = ($line =~ s/^([^']*)'([^']+)'/$1_squoteL_$2_squoteR_/g);
+# print "-> $line<> $matches: ('$1','$2')\n";
+ } while $matches;
+ $line =~ s/_squoteL_ _squoteR_/ _spc_ /g; # prevent splitting of ' '
my @KEYTOKEN = split (" ", $line);
+ grep(s/_squote[LR]?_/'/g, @KEYTOKEN);
grep(s/_spc_/' '/, @KEYTOKEN);
grep(s/_lpar_/'('/, @KEYTOKEN);
grep(s/_rpar_/')'/, @KEYTOKEN);
+#printf ">> $line%s\n", join('|', @KEYTOKEN);
return @KEYTOKEN;
}
@@ -85,7 +102,7 @@ while (<FH>) {
} elsif ($C eq "(") {
printf "%17s", "( "; # paren continues accent definition
} else {
- print "UNKNOWN DEFINITION: $_";
+ print "Unknown input line format: $_";
}
$at_bol = 0;
} else {
diff --git a/tools/tools/vt/keymaps/convert-keymaps.pl b/tools/tools/vt/keymaps/convert-keymaps.pl
index d60b797..dd452af 100755
--- a/tools/tools/vt/keymaps/convert-keymaps.pl
+++ b/tools/tools/vt/keymaps/convert-keymaps.pl
@@ -94,6 +94,6 @@ foreach $kbdfile (glob("$dir_keymaps_syscons/*.kbd")) {
print "$kbdfile not found\n";
}
} else {
- print "Unknown input file: $basename\n";
+ print "Ignore '$basename': No encoding defined in KBDFILES.map\n";
}
}
OpenPOWER on IntegriCloud