[KoCo-CVS] [Commit] cjkcodecs/tools genmap_tchinese.py
Brought to you by:
perky
From: Hye-Shik C. <pe...@us...> - 2003-05-28 06:51:35
|
perky 03/05/27 23:51:34 Modified: tools genmap_tchinese.py Log: Fix wrong overriding cp950 encmap over big5's. Revision Changes Path 1.2 +9 -3 cjkcodecs/tools/genmap_tchinese.py Index: genmap_tchinese.py =================================================================== RCS file: /cvsroot/koco/cjkcodecs/tools/genmap_tchinese.py,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- genmap_tchinese.py 17 May 2003 20:33:06 -0000 1.1 +++ genmap_tchinese.py 28 May 2003 06:51:33 -0000 1.2 @@ -26,7 +26,7 @@ # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # -# $Id: genmap_tchinese.py,v 1.1 2003/05/17 20:33:06 perky Exp $ +# $Id: genmap_tchinese.py,v 1.2 2003/05/28 06:51:33 perky Exp $ # from genmap_support import * @@ -60,13 +60,19 @@ if not (not big5decmap.has_key(c1) or not big5decmap[c1].has_key(c2) or big5decmap[c1][c2] != code): del cp950decmap[c1][c2] - else: - cp950encmap.setdefault(code >> 8, {}) + cp950encmap.setdefault(code >> 8, {}) + if not cp950encmap[code >> 8].has_key(code & 0xff): cp950encmap[code >> 8][code & 0xff] = c1 << 8 | c2 for c1, m in big5decmap.items(): for c2, code in m.items(): big5encmap.setdefault(code >> 8, {}) big5encmap[code >> 8][code & 0xff] = c1 << 8 | c2 + if (cp950encmap.has_key(code >> 8) and + cp950encmap[code >> 8].has_key(code & 0xff) and + cp950encmap[code >> 8][code & 0xff] == c1 << 8 | c2): + del cp950encmap[code >> 8][code & 0xff] + if not cp950encmap[code >> 8]: + del cp950encmap[code >>8] omap = open('map_big5.h', 'w') printcopyright(omap) |