Thread: [KoCo-CVS] [Commit] cjkcodecs/tools genmap_support.py
Brought to you by:
perky
From: Hye-Shik C. <pe...@us...> - 2003-06-02 11:21:09
|
perky 03/06/02 04:21:06 Modified: tools genmap_support.py Log: Enable load sbcs mappings. Revision Changes Path 1.6 +6 -8 cjkcodecs/tools/genmap_support.py Index: genmap_support.py =================================================================== RCS file: /cvsroot/koco/cjkcodecs/tools/genmap_support.py,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- genmap_support.py 17 May 2003 21:17:39 -0000 1.5 +++ genmap_support.py 2 Jun 2003 11:21:06 -0000 1.6 @@ -26,14 +26,14 @@ # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # -# $Id: genmap_support.py,v 1.5 2003/05/17 21:17:39 perky Exp $ +# $Id: genmap_support.py,v 1.6 2003/06/02 11:21:06 perky Exp $ # import re COPYRIGHT_HEADER = """\ /* - * $Id: genmap_support.py,v 1.5 2003/05/17 21:17:39 perky Exp $ + * $Id: genmap_support.py,v 1.6 2003/06/02 11:21:06 perky Exp $ */ """ re_UNIMAPDATE = re.compile('Date:\s*([ a-zA-Z0-9/]*)') @@ -142,15 +142,13 @@ print >> fo, "};" print >> fo -def loadmap(fo, sethighbit=0, natcol=0, unicol=1): +def loadmap(fo, natcol=0, unicol=1, sbcs=0): fo.seek(0, 0) head = fo.read(1024) mapdatever = '%s-%s' % ( re_UNIMAPVERSION.findall(head)[0], re_UNIMAPDATE.findall(head)[0] ) - if sethighbit: - sethighbit = 0x80 fo.seek(0, 0) decmap = {} @@ -160,9 +158,9 @@ row = map(eval, line.split()) loc, uni = row[natcol], row[unicol] - if loc >= 0x100: - decmap.setdefault((loc >> 8) | sethighbit, {}) - decmap[(loc >> 8)|sethighbit][(loc & 0xff)|sethighbit] = uni + if loc >= 0x100 or sbcs: + decmap.setdefault((loc >> 8), {}) + decmap[(loc >> 8)][(loc & 0xff)] = uni return mapdatever, decmap |
From: Hye-Shik C. <pe...@us...> - 2003-07-06 18:44:42
|
perky 03/07/06 11:44:41 Modified: tools genmap_support.py Log: Remove needless old code Revision Changes Path 1.8 +2 -6 cjkcodecs/tools/genmap_support.py Index: genmap_support.py =================================================================== RCS file: /cvsroot/koco/cjkcodecs/tools/genmap_support.py,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- genmap_support.py 10 Jun 2003 11:12:12 -0000 1.7 +++ genmap_support.py 6 Jul 2003 18:44:41 -0000 1.8 @@ -26,14 +26,14 @@ # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # -# $Id: genmap_support.py,v 1.7 2003/06/10 11:12:12 perky Exp $ +# $Id: genmap_support.py,v 1.8 2003/07/06 18:44:41 perky Exp $ # import re COPYRIGHT_HEADER = """\ /* - * $Id: genmap_support.py,v 1.7 2003/06/10 11:12:12 perky Exp $ + * $Id: genmap_support.py,v 1.8 2003/07/06 18:44:41 perky Exp $ */ """ @@ -141,10 +141,6 @@ print >> fo def loadmap(fo, natcol=0, unicol=1, sbcs=0): - fo.seek(0, 0) - head = fo.read(1024) - - fo.seek(0, 0) decmap = {} for line in fo: line = line.split('#', 1)[0].strip() |
From: Hye-Shik C. <pe...@us...> - 2003-07-06 23:19:32
|
perky 03/07/06 16:19:26 Modified: tools genmap_support.py Log: - Change internal unicode type from Py_UNICODE to ucs2_t (we use only ucs2 range of Py_UNICODE even on ucs4 python) - Seek from first of maps Revision Changes Path 1.9 +5 -3 cjkcodecs/tools/genmap_support.py Index: genmap_support.py =================================================================== RCS file: /cvsroot/koco/cjkcodecs/tools/genmap_support.py,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- genmap_support.py 6 Jul 2003 18:44:41 -0000 1.8 +++ genmap_support.py 6 Jul 2003 23:19:26 -0000 1.9 @@ -26,14 +26,14 @@ # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # -# $Id: genmap_support.py,v 1.8 2003/07/06 18:44:41 perky Exp $ +# $Id: genmap_support.py,v 1.9 2003/07/06 23:19:26 perky Exp $ # import re COPYRIGHT_HEADER = """\ /* - * $Id: genmap_support.py,v 1.8 2003/07/06 18:44:41 perky Exp $ + * $Id: genmap_support.py,v 1.9 2003/07/06 23:19:26 perky Exp $ */ """ @@ -113,7 +113,7 @@ codebunch.append('UNIINV,') def print_decmap(fo, codebunch, fmapprefix, fmap, f2map={}, f2mapprefix=''): - print >> fo, ("static const Py_UNICODE __%s_decmap[%d] = {" % ( + print >> fo, ("static const ucs2_t __%s_decmap[%d] = {" % ( fmapprefix, len(codebunch))) i = 0 while i < len(codebunch): @@ -141,6 +141,8 @@ print >> fo def loadmap(fo, natcol=0, unicol=1, sbcs=0): + print "Loading from", fo + fo.seek(0, 0) decmap = {} for line in fo: line = line.split('#', 1)[0].strip() |