[Python-checkins] python/dist/src/Tools/unicode makeunicodedata.py,1.15,1.16
loewis@users.sourceforge.net
loewis@users.sourceforge.net
Sun, 24 Nov 2002 15:05:12 -0800
Update of /cvsroot/python/python/dist/src/Tools/unicode
In directory sc8-pr-cvs1:/tmp/cvs-serv10896/Tools/unicode
Modified Files:
makeunicodedata.py
Log Message:
Sort names independent of the Python version. Fix hex constant warning.
Include all First/Last blocks.
Index: makeunicodedata.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/unicode/makeunicodedata.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** makeunicodedata.py 23 Nov 2002 22:08:15 -0000 1.15
--- makeunicodedata.py 24 Nov 2002 23:05:09 -0000 1.16
***************
*** 17,20 ****
--- 17,21 ----
# 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)
***************
*** 404,411 ****
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]))
# figure out how many phrasebook escapes we need
--- 405,415 ----
wordlist = words.items()
! # 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
***************
*** 542,549 ****
table[char] = s
! # expand first-last ranges (ignore surrogates and private use)
if expand:
field = None
! for i in range(0, 0xD800):
s = table[i]
if s:
--- 546,553 ----
table[char] = s
! # expand first-last ranges
if expand:
field = None
! for i in range(0, 0x110000):
s = table[i]
if s:
***************
*** 588,592 ****
for c in map(ord, s.upper()):
h = (h * magic) + c
! ix = h & 0xff000000
if ix:
h = (h ^ ((ix>>24) & 0xff)) & 0x00ffffff
--- 592,596 ----
for c in map(ord, s.upper()):
h = (h * magic) + c
! ix = h & 0xff000000L
if ix:
h = (h ^ ((ix>>24) & 0xff)) & 0x00ffffff