Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
97225da2
Commit
97225da2
authored
Nov 24, 2002
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sort names independent of the Python version. Fix hex constant warning.
Include all First/Last blocks.
parent
5b21df4a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
Tools/unicode/makeunicodedata.py
Tools/unicode/makeunicodedata.py
+11
-7
No files found.
Tools/unicode/makeunicodedata.py
View file @
97225da2
...
...
@@ -16,6 +16,7 @@
# 2002-09-11 wd use string methods
# 2002-10-18 mvl update to Unicode 3.2
# 2002-10-22 mvl generate NFC tables
# 2002-11-24 mvl expand all ranges, sort names version-independently
#
# written by Fredrik Lundh (fredrik@pythonware.com)
#
...
...
@@ -403,10 +404,13 @@ def makeunicodename(unicode, trace):
wordlist
=
words
.
items
()
# sort on falling frequency
# XXX: different Python versions produce a different order
# for words with equal frequency
wordlist
.
sort
(
lambda
a
,
b
:
len
(
b
[
1
])
-
len
(
a
[
1
]))
# sort on falling frequency, then by name
def
cmpwords
((
aword
,
alist
),(
bword
,
blist
)):
r
=
-
cmp
(
len
(
alist
),
len
(
blist
))
if
r
:
return
r
return
cmp
(
aword
,
bword
)
wordlist
.
sort
(
cmpwords
)
# figure out how many phrasebook escapes we need
escapes
=
0
...
...
@@ -541,10 +545,10 @@ class UnicodeData:
char
=
int
(
s
[
0
],
16
)
table
[
char
]
=
s
# expand first-last ranges
(ignore surrogates and private use)
# expand first-last ranges
if
expand
:
field
=
None
for
i
in
range
(
0
,
0x
D8
00
):
for
i
in
range
(
0
,
0x
1100
00
):
s
=
table
[
i
]
if
s
:
if
s
[
1
][
-
6
:]
==
"First>"
:
...
...
@@ -587,7 +591,7 @@ def myhash(s, magic):
h
=
0
for
c
in
map
(
ord
,
s
.
upper
()):
h
=
(
h
*
magic
)
+
c
ix
=
h
&
0xff000000
ix
=
h
&
0xff000000
L
if
ix
:
h
=
(
h
^
((
ix
>>
24
)
&
0xff
))
&
0x00ffffff
return
h
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment