From owner-svn-src-head@FreeBSD.ORG Wed Aug 20 07:46:29 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E21E171C; Wed, 20 Aug 2014 07:46:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CDA4E3A05; Wed, 20 Aug 2014 07:46:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7K7kSe0050654; Wed, 20 Aug 2014 07:46:28 GMT (envelope-from se@FreeBSD.org) Received: (from se@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7K7kS7B050652; Wed, 20 Aug 2014 07:46:28 GMT (envelope-from se@FreeBSD.org) Message-Id: <201408200746.s7K7kS7B050652@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: se set sender to se@FreeBSD.org using -f From: Stefan Esser Date: Wed, 20 Aug 2014 07:46:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r270199 - head/tools/tools/vt/keymaps X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Aug 2014 07:46:29 -0000 Author: se Date: Wed Aug 20 07:46:28 2014 New Revision: 270199 URL: http://svnweb.freebsd.org/changeset/base/270199 Log: Fix further conversion errors found while testing the converted keymaps. MFC after: 3 days Modified: head/tools/tools/vt/keymaps/convert-keymap.pl head/tools/tools/vt/keymaps/convert-keymaps.pl Modified: head/tools/tools/vt/keymaps/convert-keymap.pl ============================================================================== --- head/tools/tools/vt/keymaps/convert-keymap.pl Wed Aug 20 06:34:24 2014 (r270198) +++ head/tools/tools/vt/keymaps/convert-keymap.pl Wed Aug 20 07:46:28 2014 (r270199) @@ -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 ""; # uncovered case + if $C =~ m/^'(.)'$/; # character + return malformed_to_UCS_code($1) + if $C =~ m/^'(.+)'$/; # character + return ""; # 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 () { } elsif ($C eq "(") { printf "%17s", "( "; # paren continues accent definition } else { - print "UNKNOWN DEFINITION: $_"; + print "Unknown input line format: $_"; } $at_bol = 0; } else { Modified: head/tools/tools/vt/keymaps/convert-keymaps.pl ============================================================================== --- head/tools/tools/vt/keymaps/convert-keymaps.pl Wed Aug 20 06:34:24 2014 (r270198) +++ head/tools/tools/vt/keymaps/convert-keymaps.pl Wed Aug 20 07:46:28 2014 (r270199) @@ -94,6 +94,6 @@ foreach $kbdfile (glob("$dir_keymaps_sys print "$kbdfile not found\n"; } } else { - print "Unknown input file: $basename\n"; + print "Ignore '$basename': No encoding defined in KBDFILES.map\n"; } }