aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/xkeyboard-config/tests/ruby/find_match.rb
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-08-02 09:00:24 +0000
committermarha <marha@users.sourceforge.net>2010-08-02 09:00:24 +0000
commit240baf59a219841c5f8942c82f7ed61da9d2323b (patch)
tree76937e127002c1ba58c5a379651f20a17e866627 /xorg-server/xkeyboard-config/tests/ruby/find_match.rb
parent6c5a4ae0c8e57225ce31fb0a39c87ec9a5eed2b5 (diff)
parentd2758df0a0091496717fe7a65c3e7563e7c82785 (diff)
downloadvcxsrv-240baf59a219841c5f8942c82f7ed61da9d2323b.tar.gz
vcxsrv-240baf59a219841c5f8942c82f7ed61da9d2323b.tar.bz2
vcxsrv-240baf59a219841c5f8942c82f7ed61da9d2323b.zip
svn merge ^/branches/released .
Diffstat (limited to 'xorg-server/xkeyboard-config/tests/ruby/find_match.rb')
-rw-r--r--xorg-server/xkeyboard-config/tests/ruby/find_match.rb42
1 files changed, 42 insertions, 0 deletions
diff --git a/xorg-server/xkeyboard-config/tests/ruby/find_match.rb b/xorg-server/xkeyboard-config/tests/ruby/find_match.rb
new file mode 100644
index 000000000..43af93482
--- /dev/null
+++ b/xorg-server/xkeyboard-config/tests/ruby/find_match.rb
@@ -0,0 +1,42 @@
+#!/usr/bin/ruby
+#
+# $Id$
+# The script finds best matching xkb_symbols in symbols/in
+#
+# Parameters: $0 - the name of the file with new xkb_symbols
+# $1 - max number of non-matching mappings (0 by default)
+#
+
+require "xkbparser.rb"
+
+baseDir = "../.."
+
+symbolsDir = "#{baseDir}/symbols"
+#symbolsDir = "."
+
+parser = Parser.new
+
+allSyms = parser.parse("#{symbolsDir}/inet")
+
+newSyms = parser.parse(ARGV[0])
+limit = ARGV[1].to_i
+
+newSyms.find_all do | key, value |
+
+ if value.hidden?
+ next
+ end
+
+ puts "Existing xkb_symbols matching #{key}: "
+
+ sorted = allSyms.match_symbols(value,limit).sort_by do | symsName, diff |
+ sprintf "%03d_%s", diff.size, symsName
+ end
+
+ sorted.find_all do | symsName, diff |
+ puts " #{symsName}, up to #{allSyms[symsName].size} keys (difference #{diff.size})-> #{diff}"
+ end
+
+end
+
+