Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
  • Loading branch information
sorcio and corona10 authored May 28, 2022
commit 9a008bdc9bc3cb6ae745d88af5372802501afb12
12 changes: 5 additions & 7 deletions Tools/unicode/genmap_tchinese.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@
#
# Original Author: Hye-Shik Chang <perky@FreeBSD.org>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW @hyeshik doesn't seem to be active on this repo, but he signed the CLA in 2005 (https://bugs.python.org/user1298), so it should be ok to include it here.

If this script is based on his script, you might want to clarify that in the comment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ezio-melotti do you have a suggestion on how to amend the comment to clarify that? The mention of "Original Author" is what it currently looks like in the other genmap_* scripts, so I didn't take the liberty to sway from that style.

The original source (as for the other equivalent scripts) is https://github.com/BackupTheBerlios/cjkpython/blob/master/cjkcodecs/tools/genmap_tchinese.py which was originally under 2-clause BSD. I might have made a wrong assumption that it was ok to include in CPython, since the other scripts followed the same process?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(In case it matters, the script in this PR is heavily modified, so while it probably still counts as derivative, it would be easy to do a full rewrite)

#
from genmap_support import (
open_mapping_file,
loadmap,
DecodeMapWriter,
EncodeMapWriter,
BufferedFiller,
)
import os

from genmap_support import *


# ranges for (lead byte, follower byte)
Expand Down Expand Up @@ -173,6 +169,7 @@ def main_tw():
del cp950decmap[c1][c2]

with open('mappings_tw.h', 'w') as fp:
print_autogen(fp, os.path.basename(__file__))
write_big5_maps(fp, 'BIG5', 'big5', big5decmap, big5encmap)
Comment thread
sorcio marked this conversation as resolved.
write_big5_maps(fp, 'CP950', 'cp950ext', cp950decmap, cp950encmap)

Expand Down Expand Up @@ -217,6 +214,7 @@ def main_hkscs():
)
with open('mappings_hk.h', 'w') as fp:
print('Generating BIG5HKSCS decode map...')
print_autogen(fp, os.path.basename(__file__))
writer = DecodeMapWriter(fp, 'big5hkscs', hkscsdecmap)
Comment thread
sorcio marked this conversation as resolved.
writer.update_decode_map(BIG5HKSCS_C1, BIG5HKSCS_C2)
writer.generate()
Expand Down