]> git.proxmox.com Git - mirror_edk2.git/blame - AppPkg/Applications/Python/Python-2.7.2/Demo/scripts/find-uname.py
EmbeddedPkg: Extend NvVarStoreFormattedLib LIBRARY_CLASS
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.2 / Demo / scripts / find-uname.py
CommitLineData
4710c53d 1#!/usr/bin/env python\r
2\r
3"""\r
4For each argument on the command line, look for it in the set of all Unicode\r
5names. Arguments are treated as case-insensitive regular expressions, e.g.:\r
6\r
7 % find-uname 'small letter a$' 'horizontal line'\r
8 *** small letter a$ matches ***\r
9 LATIN SMALL LETTER A (97)\r
10 COMBINING LATIN SMALL LETTER A (867)\r
11 CYRILLIC SMALL LETTER A (1072)\r
12 PARENTHESIZED LATIN SMALL LETTER A (9372)\r
13 CIRCLED LATIN SMALL LETTER A (9424)\r
14 FULLWIDTH LATIN SMALL LETTER A (65345)\r
15 *** horizontal line matches ***\r
16 HORIZONTAL LINE EXTENSION (9135)\r
17"""\r
18\r
19import unicodedata\r
20import sys\r
21import re\r
22\r
23def main(args):\r
24 unicode_names = []\r
25 for ix in range(sys.maxunicode+1):\r
26 try:\r
27 unicode_names.append((ix, unicodedata.name(unichr(ix))))\r
28 except ValueError: # no name for the character\r
29 pass\r
30 for arg in args:\r
31 pat = re.compile(arg, re.I)\r
32 matches = [(y,x) for (x,y) in unicode_names\r
33 if pat.search(y) is not None]\r
34 if matches:\r
35 print "***", arg, "matches", "***"\r
36 for match in matches:\r
37 print "%s (%d)" % match\r
38\r
39if __name__ == "__main__":\r
40 main(sys.argv[1:])\r