6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
6911753: NSN wants to add Big5 HKSCS-2004 support Support HKSCS2008 in Big5_HKSCS and MS950_HKSCS Reviewed-by: okutsu
This commit is contained in:
parent
0f50eeb222
commit
0020f5af66
@ -42,8 +42,6 @@ FILES_src = \
|
||||
sun/io/ByteToCharBig5_Solaris.java \
|
||||
sun/io/ByteToCharBig5_HKSCS.java \
|
||||
sun/io/ByteToCharMS950_HKSCS.java \
|
||||
sun/io/ByteToCharHKSCS.java \
|
||||
sun/io/ByteToCharHKSCS_2001.java \
|
||||
sun/io/ByteToCharGB18030.java \
|
||||
sun/io/ByteToCharGB18030DB.java \
|
||||
sun/io/ByteToCharCp037.java \
|
||||
@ -173,8 +171,6 @@ FILES_src = \
|
||||
sun/io/CharToByteBig5.java \
|
||||
sun/io/CharToByteBig5_Solaris.java \
|
||||
sun/io/CharToByteBig5_HKSCS.java \
|
||||
sun/io/CharToByteHKSCS.java \
|
||||
sun/io/CharToByteHKSCS_2001.java \
|
||||
sun/io/CharToByteMS950_HKSCS.java \
|
||||
sun/io/CharToByteGB18030.java \
|
||||
sun/io/CharToByteCp037.java \
|
||||
@ -374,6 +370,9 @@ FILES_gen_extcs = \
|
||||
sun/nio/cs/ext/MacUkraine.java \
|
||||
sun/nio/cs/ext/TIS_620.java \
|
||||
sun/nio/cs/ext/EUC_TWMapping.java \
|
||||
sun/nio/cs/ext/HKSCSMapping.java \
|
||||
sun/nio/cs/ext/HKSCS2001Mapping.java \
|
||||
sun/nio/cs/ext/HKSCS_XPMapping.java \
|
||||
sun/nio/cs/ext/IBM1381.java \
|
||||
sun/nio/cs/ext/IBM1383.java \
|
||||
sun/nio/cs/ext/IBM930.java \
|
||||
@ -394,7 +393,8 @@ FILES_gen_extcs = \
|
||||
sun/nio/cs/ext/MS936.java \
|
||||
sun/nio/cs/ext/MS949.java \
|
||||
sun/nio/cs/ext/MS950.java \
|
||||
sun/nio/cs/ext/GBK.java
|
||||
sun/nio/cs/ext/GBK.java \
|
||||
sun/nio/cs/ext/Big5.java
|
||||
|
||||
FILES_java = $(FILES_src) $(FILES_gen_extcs)
|
||||
|
||||
|
@ -93,7 +93,9 @@ $(FILES_genout_extcs): \
|
||||
$(MKDIR) -p $(GENCSEXT)
|
||||
$(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) extsbcs
|
||||
$(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) euctw \
|
||||
$(GENCSSRCDIR)/GenerateEUC_TW.java
|
||||
$(GENCSSRCDIR)/EUC_TW.java
|
||||
$(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) hkscs \
|
||||
$(GENCSSRCDIR)/HKSCS.java
|
||||
$(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) dbcs
|
||||
|
||||
$(CLASSDESTDIR)/$(SERVICE_DESCRIPTION_PATH): \
|
||||
|
8
jdk/make/tools/CharsetMapping/Big5.c2b
Normal file
8
jdk/make/tools/CharsetMapping/Big5.c2b
Normal file
@ -0,0 +1,8 @@
|
||||
#Add the following 5 characters which are duplicated
|
||||
#or have conflicts with other characters.
|
||||
0xA1C4 0xFF3F #REGWARN Fallback 0xA1C4 SPACING UNDERSCORE
|
||||
0xA2AC 0x2571 #REGWARN Fallback 0xA2AC LT DIAG UP RIGHT TO LOW LEFT
|
||||
0xA2AD 0x2572 #REGWARN Fallback 0xA2AD LT DIAG UP LEFT TO LOW RIGHT
|
||||
0xA451 0x5341 #REGWARN Fallback 0xA451 HANGZHOU NUMERAL TEN
|
||||
0xA4CA 0x5345 #REGWARN Fallback 0xA4CA HANGZHOU NUMERAL THIRTY
|
||||
#
|
13837
jdk/make/tools/CharsetMapping/Big5.map
Normal file
13837
jdk/make/tools/CharsetMapping/Big5.map
Normal file
File diff suppressed because it is too large
Load Diff
5
jdk/make/tools/CharsetMapping/Big5.nr
Normal file
5
jdk/make/tools/CharsetMapping/Big5.nr
Normal file
@ -0,0 +1,5 @@
|
||||
0xA15A 0xFF3F #SPACING UNDERSCORE
|
||||
0xA1FE 0x2571 #LT DIAG UP RIGHT TO LOW LEFT
|
||||
0xA240 0x2572 #LT DIAG UP LEFT TO LOW RIGHTG
|
||||
0xA2CC 0x5341 #HANGHZOU NUMERAL TEN
|
||||
0xA2CE 0x5345 #HANGZHOU NUMERAL THIRTY
|
2187
jdk/make/tools/CharsetMapping/HKSCS2001.c2b
Normal file
2187
jdk/make/tools/CharsetMapping/HKSCS2001.c2b
Normal file
File diff suppressed because it is too large
Load Diff
4821
jdk/make/tools/CharsetMapping/HKSCS2001.map
Normal file
4821
jdk/make/tools/CharsetMapping/HKSCS2001.map
Normal file
File diff suppressed because it is too large
Load Diff
4969
jdk/make/tools/CharsetMapping/HKSCS2008.c2b
Normal file
4969
jdk/make/tools/CharsetMapping/HKSCS2008.c2b
Normal file
File diff suppressed because it is too large
Load Diff
5019
jdk/make/tools/CharsetMapping/HKSCS2008.map
Normal file
5019
jdk/make/tools/CharsetMapping/HKSCS2008.map
Normal file
File diff suppressed because it is too large
Load Diff
529
jdk/make/tools/CharsetMapping/HKSCS_XP.c2b
Normal file
529
jdk/make/tools/CharsetMapping/HKSCS_XP.c2b
Normal file
@ -0,0 +1,529 @@
|
||||
# Generated from HKSCS.Encoder
|
||||
#
|
||||
0xFA45 0xE005
|
||||
0xFA48 0xE008
|
||||
0xFA68 0xE028
|
||||
0xFA6B 0xE02B
|
||||
0xFAA5 0xE043
|
||||
0xFACC 0xE06A
|
||||
0xFACD 0xE06B
|
||||
0xFAD0 0xE06E
|
||||
0xFAE0 0xE07E
|
||||
0xFAE8 0xE086
|
||||
0xFAFA 0xE098
|
||||
0xFAFD 0xE09B
|
||||
0xFB43 0xE0A0
|
||||
0xFB4B 0xE0A8
|
||||
0xFB5E 0xE0BB
|
||||
0xFB65 0xE0C2
|
||||
0xFB70 0xE0CD
|
||||
0xFB7A 0xE0D7
|
||||
0xFB7D 0xE0DA
|
||||
0xFBB6 0xE0F1
|
||||
0xFBB9 0xE0F4
|
||||
0xFBBF 0xE0FA
|
||||
0xFBC1 0xE0FC
|
||||
0xFBC9 0xE104
|
||||
0xFBCA 0xE105
|
||||
0xFBD3 0xE10E
|
||||
0xFBDC 0xE117
|
||||
0xFBEA 0xE125
|
||||
0xFBEF 0xE12A
|
||||
0xFBF0 0xE12B
|
||||
0xFC42 0xE13C
|
||||
0xFC49 0xE143
|
||||
0xFC4A 0xE144
|
||||
0xFC59 0xE153
|
||||
0xFC64 0xE15E
|
||||
0xFC65 0xE15F
|
||||
0xFC66 0xE160
|
||||
0xFC6A 0xE164
|
||||
0xFCA6 0xE17E
|
||||
0xFCB4 0xE18C
|
||||
0xFCC2 0xE19A
|
||||
0xFCC4 0xE19C
|
||||
0xFCCF 0xE1A7
|
||||
0xFCD1 0xE1A9
|
||||
0xFCEE 0xE1C6
|
||||
0xFCF7 0xE1CF
|
||||
0xFD49 0xE1E0
|
||||
0xFD4A 0xE1E1
|
||||
0xFD4C 0xE1E3
|
||||
0xFD50 0xE1E7
|
||||
0xFD53 0xE1EA
|
||||
0xFD5D 0xE1F4
|
||||
0xFD61 0xE1F8
|
||||
0xFD6C 0xE203
|
||||
0xFD7A 0xE211
|
||||
0xFDA2 0xE217
|
||||
0xFDA3 0xE218
|
||||
0xFDC4 0xE239
|
||||
0xFDCA 0xE23F
|
||||
0xFDCE 0xE243
|
||||
0xFDD1 0xE246
|
||||
0xFDE8 0xE25D
|
||||
0xFDE9 0xE25E
|
||||
0xFE4D 0xE281
|
||||
0xFE56 0xE28A
|
||||
0xFE64 0xE298
|
||||
0xFE6E 0xE2A2
|
||||
0xFE78 0xE2AC
|
||||
0xFE7D 0xE2B1
|
||||
0xFEB6 0xE2C8
|
||||
0xFEC5 0xE2D7
|
||||
0xFEFB 0xE30D
|
||||
0x8E45 0xE316
|
||||
0x8E55 0xE326
|
||||
0x8E59 0xE32A
|
||||
0x8E6B 0xE33C
|
||||
0x8EA2 0xE351
|
||||
0x8EAF 0xE35E
|
||||
0x8EB9 0xE368
|
||||
0x8EC7 0xE376
|
||||
0x8EC9 0xE378
|
||||
0x8ED8 0xE387
|
||||
0x8EED 0xE39C
|
||||
0x8EFE 0xE3AD
|
||||
0x8F45 0xE3B3
|
||||
0x8F50 0xE3BE
|
||||
0x8F54 0xE3C2
|
||||
0x8F59 0xE3C7
|
||||
0x8F5D 0xE3CB
|
||||
0x8F63 0xE3D1
|
||||
0x8F64 0xE3D2
|
||||
0x8F70 0xE3DE
|
||||
0x8F74 0xE3E2
|
||||
0x8F76 0xE3E4
|
||||
0x8F7A 0xE3E8
|
||||
0x8F7C 0xE3EA
|
||||
0x8FA9 0xE3F5
|
||||
0x8FAB 0xE3F7
|
||||
0x8FBA 0xE406
|
||||
0x8FC2 0xE40E
|
||||
0x8FDB 0xE427
|
||||
0x8FEB 0xE437
|
||||
0x8FF1 0xE43D
|
||||
0x8FFD 0xE449
|
||||
0x9044 0xE44F
|
||||
0x9055 0xE460
|
||||
0x9060 0xE46B
|
||||
0x906F 0xE47A
|
||||
0x90AA 0xE493
|
||||
0x90B7 0xE4A0
|
||||
0x90BC 0xE4A5
|
||||
0x90C0 0xE4A9
|
||||
0x90C9 0xE4B2
|
||||
0x90D5 0xE4BE
|
||||
0x90D6 0xE4BF
|
||||
0x90D7 0xE4C0
|
||||
0x90F5 0xE4DE
|
||||
0x90FA 0xE4E3
|
||||
0x90FC 0xE4E5
|
||||
0x9145 0xE4ED
|
||||
0x914F 0xE4F7
|
||||
0x9158 0xE500
|
||||
0x915F 0xE507
|
||||
0x9166 0xE50E
|
||||
0x91AE 0xE534
|
||||
0x91B3 0xE539
|
||||
0x91B4 0xE53A
|
||||
0x91B5 0xE53B
|
||||
0x91B7 0xE53D
|
||||
0x91BB 0xE541
|
||||
0x91CD 0xE553
|
||||
0x91E3 0xE569
|
||||
0x91EE 0xE574
|
||||
0x91F2 0xE578
|
||||
0x91F5 0xE57B
|
||||
0x91F9 0xE57F
|
||||
0x924C 0xE591
|
||||
0x9251 0xE596
|
||||
0x9252 0xE597
|
||||
0x9253 0xE598
|
||||
0x9257 0xE59C
|
||||
0x9269 0xE5AE
|
||||
0x9274 0xE5B9
|
||||
0x9277 0xE5BC
|
||||
0x92BD 0xE5E0
|
||||
0x92C9 0xE5EC
|
||||
0x92D2 0xE5F5
|
||||
0x92D7 0xE5FA
|
||||
0x92DB 0xE5FE
|
||||
0x92E9 0xE60C
|
||||
0x92FA 0xE61D
|
||||
0x9347 0xE629
|
||||
0x934B 0xE62D
|
||||
0x9357 0xE639
|
||||
0x9359 0xE63B
|
||||
0x935B 0xE63D
|
||||
0x936F 0xE651
|
||||
0x93A4 0xE664
|
||||
0x93B5 0xE675
|
||||
0x93C1 0xE681
|
||||
0x93C2 0xE682
|
||||
0x93CD 0xE68D
|
||||
0x93D4 0xE694
|
||||
0x93DD 0xE69D
|
||||
0x93E0 0xE6A0
|
||||
0x93E4 0xE6A4
|
||||
0x93E9 0xE6A9
|
||||
0x93EB 0xE6AB
|
||||
0x93F6 0xE6B6
|
||||
0x9449 0xE6C8
|
||||
0x9463 0xE6E2
|
||||
0x9464 0xE6E3
|
||||
0x9469 0xE6E8
|
||||
0x946E 0xE6ED
|
||||
0x9470 0xE6EF
|
||||
0x9472 0xE6F1
|
||||
0x9475 0xE6F4
|
||||
0x9479 0xE6F8
|
||||
0x947E 0xE6FD
|
||||
0x94A1 0xE6FE
|
||||
0x94A3 0xE700
|
||||
0x94B5 0xE712
|
||||
0x94B9 0xE716
|
||||
0x94BC 0xE719
|
||||
0x94C9 0xE726
|
||||
0x94D1 0xE72E
|
||||
0x94D3 0xE730
|
||||
0x94DB 0xE738
|
||||
0x94DD 0xE73A
|
||||
0x94DE 0xE73B
|
||||
0x94EC 0xE749
|
||||
0x94EF 0xE74C
|
||||
0x9544 0xE760
|
||||
0x955A 0xE776
|
||||
0x9562 0xE77E
|
||||
0x9564 0xE780
|
||||
0x9573 0xE78F
|
||||
0x95B0 0xE7AA
|
||||
0x95B2 0xE7AC
|
||||
0x95B3 0xE7AD
|
||||
0x95B4 0xE7AE
|
||||
0x95C6 0xE7C0
|
||||
0x95C7 0xE7C1
|
||||
0x95CD 0xE7C7
|
||||
0x95D1 0xE7CB
|
||||
0x95D6 0xE7D0
|
||||
0x95DB 0xE7D5
|
||||
0x95DF 0xE7D9
|
||||
0x95EC 0xE7E6
|
||||
0x95F0 0xE7EA
|
||||
0x95F6 0xE7F0
|
||||
0x95FC 0xE7F6
|
||||
0x9641 0xE7FA
|
||||
0x964D 0xE806
|
||||
0x965C 0xE815
|
||||
0x9662 0xE81B
|
||||
0x9664 0xE81D
|
||||
0x9669 0xE822
|
||||
0x966B 0xE824
|
||||
0x9675 0xE82E
|
||||
0x9678 0xE831
|
||||
0x9679 0xE832
|
||||
0x96A6 0xE83D
|
||||
0x96A8 0xE83F
|
||||
0x96B9 0xE850
|
||||
0x96BC 0xE853
|
||||
0x96C8 0xE85F
|
||||
0x96D4 0xE86B
|
||||
0x96D6 0xE86D
|
||||
0x96DF 0xE876
|
||||
0x96E9 0xE880
|
||||
0x96F7 0xE88E
|
||||
0x9743 0xE899
|
||||
0x9745 0xE89B
|
||||
0x9746 0xE89C
|
||||
0x975D 0xE8B3
|
||||
0x9761 0xE8B7
|
||||
0x9766 0xE8BC
|
||||
0x977C 0xE8D2
|
||||
0x97AE 0xE8E2
|
||||
0x97B0 0xE8E4
|
||||
0x97B8 0xE8EC
|
||||
0x97BA 0xE8EE
|
||||
0x97C0 0xE8F4
|
||||
0x97C2 0xE8F6
|
||||
0x97C3 0xE8F7
|
||||
0x97C5 0xE8F9
|
||||
0x97C6 0xE8FA
|
||||
0x97C9 0xE8FD
|
||||
0x97CD 0xE901
|
||||
0x97D2 0xE906
|
||||
0x97D7 0xE90B
|
||||
0x97DA 0xE90E
|
||||
0x97DB 0xE90F
|
||||
0x97DC 0xE910
|
||||
0x97DD 0xE911
|
||||
0x97DE 0xE912
|
||||
0x97E1 0xE915
|
||||
0x97E7 0xE91B
|
||||
0x97FD 0xE931
|
||||
0x97FE 0xE932
|
||||
0x9853 0xE946
|
||||
0x9856 0xE949
|
||||
0x9872 0xE965
|
||||
0x9879 0xE96C
|
||||
0x98A8 0xE979
|
||||
0x98BC 0xE98D
|
||||
0x98C3 0xE994
|
||||
0x98C5 0xE996
|
||||
0x98CB 0xE99C
|
||||
0x98CC 0xE99D
|
||||
0x98CD 0xE99E
|
||||
0x98CE 0xE99F
|
||||
0x98D0 0xE9A1
|
||||
0x98D1 0xE9A2
|
||||
0x98D6 0xE9A7
|
||||
0x98D9 0xE9AA
|
||||
0x98DB 0xE9AC
|
||||
0x98DD 0xE9AE
|
||||
0x98E4 0xE9B5
|
||||
0x98E6 0xE9B7
|
||||
0x98E8 0xE9B9
|
||||
0x98E9 0xE9BA
|
||||
0x98EB 0xE9BC
|
||||
0x98EC 0xE9BD
|
||||
0x98F4 0xE9C5
|
||||
0x98FE 0xE9CF
|
||||
0x9940 0xE9D0
|
||||
0x9946 0xE9D6
|
||||
0x9948 0xE9D8
|
||||
0x994B 0xE9DB
|
||||
0x994E 0xE9DE
|
||||
0x9955 0xE9E5
|
||||
0x9956 0xE9E6
|
||||
0x9959 0xE9E9
|
||||
0x995B 0xE9EB
|
||||
0x9967 0xE9F7
|
||||
0x996E 0xE9FE
|
||||
0x9973 0xEA03
|
||||
0x997A 0xEA0A
|
||||
0x997B 0xEA0B
|
||||
0x99A1 0xEA0F
|
||||
0x99A5 0xEA13
|
||||
0x99A7 0xEA15
|
||||
0x99AD 0xEA1B
|
||||
0x99B3 0xEA21
|
||||
0x99BC 0xEA2A
|
||||
0x99C3 0xEA31
|
||||
0x99C7 0xEA35
|
||||
0x99CE 0xEA3C
|
||||
0x99CF 0xEA3D
|
||||
0x99DE 0xEA4C
|
||||
0x99E1 0xEA4F
|
||||
0x99E9 0xEA57
|
||||
0x99F5 0xEA63
|
||||
0x99F8 0xEA66
|
||||
0x9A48 0xEA75
|
||||
0x9A49 0xEA76
|
||||
0x9A50 0xEA7D
|
||||
0x9A55 0xEA82
|
||||
0x9A58 0xEA85
|
||||
0x9A5A 0xEA87
|
||||
0x9A5C 0xEA89
|
||||
0x9A60 0xEA8D
|
||||
0x9A63 0xEA90
|
||||
0x9A6E 0xEA9B
|
||||
0x9A70 0xEA9D
|
||||
0x9A79 0xEAA6
|
||||
0x9A7B 0xEAA8
|
||||
0x9ABD 0xEAC8
|
||||
0x9AEC 0xEAF7
|
||||
0x9B4D 0xEB17
|
||||
0x9BA9 0xEB51
|
||||
0x9BAA 0xEB52
|
||||
0x9BB8 0xEB60
|
||||
0x9BBE 0xEB66
|
||||
0x9BC2 0xEB6A
|
||||
0x9BDF 0xEB87
|
||||
0x9BE3 0xEB8B
|
||||
0x9BEA 0xEB92
|
||||
0x9BEE 0xEB96
|
||||
0x9C4A 0xEBB1
|
||||
0x9C5C 0xEBC3
|
||||
0x9C6F 0xEBD6
|
||||
0x9C79 0xEBE0
|
||||
0x9CA1 0xEBE6
|
||||
0x9CA5 0xEBEA
|
||||
0x9CBA 0xEBFF
|
||||
0x9CBB 0xEC00
|
||||
0x9CBE 0xEC03
|
||||
0x9CC6 0xEC0B
|
||||
0x9CC8 0xEC0D
|
||||
0x9CD1 0xEC16
|
||||
0x9CF8 0xEC3D
|
||||
0x9D46 0xEC4A
|
||||
0x9D49 0xEC4D
|
||||
0x9D4F 0xEC53
|
||||
0x9D51 0xEC55
|
||||
0x9D5D 0xEC61
|
||||
0x9D73 0xEC77
|
||||
0x9D78 0xEC7C
|
||||
0x9D7B 0xEC7F
|
||||
0x9DA5 0xEC87
|
||||
0x9DAA 0xEC8C
|
||||
0x9DAD 0xEC8F
|
||||
0x9DB5 0xEC97
|
||||
0x9DCC 0xECAE
|
||||
0x9DCE 0xECB0
|
||||
0x9DEE 0xECD0
|
||||
0x9DF3 0xECD5
|
||||
0x9E53 0xECF4
|
||||
0x9E64 0xED05
|
||||
0x9E7A 0xED1B
|
||||
0x9E7E 0xED1F
|
||||
0x9EA4 0xED23
|
||||
0x9EB4 0xED33
|
||||
0x9EB8 0xED37
|
||||
0x9EB9 0xED38
|
||||
0x9EBB 0xED3A
|
||||
0x9EC5 0xED44
|
||||
0x9EC9 0xED48
|
||||
0x9ECD 0xED4C
|
||||
0x9EDA 0xED59
|
||||
0x9EDD 0xED5C
|
||||
0x9EDE 0xED5D
|
||||
0x9EDF 0xED5E
|
||||
0x9EE5 0xED64
|
||||
0x9EE7 0xED66
|
||||
0x9EEE 0xED6D
|
||||
0x9EF0 0xED6F
|
||||
0x9EFC 0xED7B
|
||||
0x9F70 0xEDAE
|
||||
0x9FA5 0xEDC1
|
||||
0x9FD7 0xEDF3
|
||||
0x9FD9 0xEDF5
|
||||
0xA053 0xEE2E
|
||||
0xA068 0xEE43
|
||||
0xA06A 0xEE45
|
||||
0xA06F 0xEE4A
|
||||
0xA078 0xEE53
|
||||
0xA07E 0xEE59
|
||||
0xA0AC 0xEE65
|
||||
0xA0D0 0xEE89
|
||||
0xA0DA 0xEE93
|
||||
0xA0DE 0xEE97
|
||||
0xA0E6 0xEE9F
|
||||
0xA0F9 0xEEB2
|
||||
0x89B7 0xF3F5
|
||||
0x89BA 0xF3F8
|
||||
0x89BF 0xF3FD
|
||||
0x89C5 0xF403
|
||||
0x89D5 0xF413
|
||||
0x89D7 0xF415
|
||||
0x89DA 0xF418
|
||||
0x89DB 0xF419
|
||||
0x89DC 0xF41A
|
||||
0x89E6 0xF424
|
||||
0x89E8 0xF426
|
||||
0x89EA 0xF428
|
||||
0x89ED 0xF42B
|
||||
0x89EE 0xF42C
|
||||
0x89EF 0xF42D
|
||||
0x89F9 0xF437
|
||||
0x89FB 0xF439
|
||||
0x89FC 0xF43A
|
||||
0x89FE 0xF43C
|
||||
0x8A48 0xF445
|
||||
0x8A4D 0xF44A
|
||||
0x8A51 0xF44E
|
||||
0x8A52 0xF44F
|
||||
0x8A67 0xF464
|
||||
0x8A6B 0xF468
|
||||
0x8A6D 0xF46A
|
||||
0x8A6E 0xF46B
|
||||
0x8A76 0xF473
|
||||
0x8A7D 0xF47A
|
||||
0x8AAC 0xF487
|
||||
0x8AAE 0xF489
|
||||
0x8AB8 0xF493
|
||||
0x8AB9 0xF494
|
||||
0x8ABB 0xF496
|
||||
0x8AC2 0xF49D
|
||||
0x8AC7 0xF4A2
|
||||
0x8AD0 0xF4AB
|
||||
0x8AD1 0xF4AC
|
||||
0x8AD3 0xF4AE
|
||||
0x8ADA 0xF4B5
|
||||
0x8AEB 0xF4C6
|
||||
0x8AF0 0xF4CB
|
||||
0x8AFB 0xF4D6
|
||||
0x8B47 0xF4E1
|
||||
0x8B60 0xF4FA
|
||||
0x8B68 0xF502
|
||||
0x8B6A 0xF504
|
||||
0x8BA6 0xF51E
|
||||
0x8BB1 0xF529
|
||||
0x8BB5 0xF52D
|
||||
0x8BB6 0xF52E
|
||||
0x8BB8 0xF530
|
||||
0x8BBE 0xF536
|
||||
0x8BC8 0xF540
|
||||
0x8BCC 0xF544
|
||||
0x8BDC 0xF554
|
||||
0x8D63 0xF637
|
||||
0x8D64 0xF638
|
||||
0x8D67 0xF63B
|
||||
0x8D68 0xF63C
|
||||
0x8D6D 0xF641
|
||||
0x8D6E 0xF642
|
||||
0x8D6F 0xF643
|
||||
0x8D70 0xF644
|
||||
0x8D74 0xF648
|
||||
0x8D78 0xF64C
|
||||
0x8D7D 0xF651
|
||||
0x8DA1 0xF653
|
||||
0x8DA6 0xF658
|
||||
0x8DAB 0xF65D
|
||||
0x8DAD 0xF65F
|
||||
0x8DB0 0xF662
|
||||
0x8DB2 0xF664
|
||||
0x8DB4 0xF666
|
||||
0x8DB7 0xF669
|
||||
0x8DBA 0xF66C
|
||||
0x8DBB 0xF66D
|
||||
0x8DBC 0xF66E
|
||||
0x8DC3 0xF675
|
||||
0x8DC5 0xF677
|
||||
0x8DCA 0xF67C
|
||||
0x8DCC 0xF67E
|
||||
0x8DD6 0xF688
|
||||
0x8DDB 0xF68D
|
||||
0x8DEB 0xF69D
|
||||
0x8DEF 0xF6A1
|
||||
0x8DF0 0xF6A2
|
||||
0x8DF3 0xF6A5
|
||||
0x8DF5 0xF6A7
|
||||
0x8DFC 0xF6AE
|
||||
0x8DFD 0xF6AF
|
||||
0xC6CD 0xF6DD
|
||||
0xC8D6 0xF820
|
||||
0xC8D7 0xF821
|
||||
0xC8D8 0xF822
|
||||
0xC8D9 0xF823
|
||||
0xC8DA 0xF824
|
||||
0xC8DB 0xF825
|
||||
0xC8DC 0xF826
|
||||
0xC8DD 0xF827
|
||||
0xC8DE 0xF828
|
||||
0xC8DF 0xF829
|
||||
0xC8E0 0xF82A
|
||||
0xC8E1 0xF82B
|
||||
0xC8E2 0xF82C
|
||||
0xC8E3 0xF82D
|
||||
0xC8E4 0xF82E
|
||||
0xC8E5 0xF82F
|
||||
0xC8E6 0xF830
|
||||
0xC8E7 0xF831
|
||||
0xC8E8 0xF832
|
||||
0xC8E9 0xF833
|
||||
0xC8EA 0xF834
|
||||
0xC8EB 0xF835
|
||||
0xC8EC 0xF836
|
||||
0xC8ED 0xF837
|
||||
0xC8EE 0xF838
|
||||
0xC8EF 0xF839
|
||||
0xC8F0 0xF83A
|
||||
0xC8F1 0xF83B
|
4704
jdk/make/tools/CharsetMapping/HKSCS_XP.map
Normal file
4704
jdk/make/tools/CharsetMapping/HKSCS_XP.map
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,7 @@
|
||||
#
|
||||
#clzName csName hisName dbtype pkg ascii b1min b1max b2min b2max
|
||||
#
|
||||
Big5 Big5 Big5 basic sun.nio.cs.ext true 0xa1 0xf9 0x40 0xfe
|
||||
Johab x-Johab x-Johab basic sun.nio.cs.ext true 0x84 0xf9 0x31 0xfe
|
||||
EUC_CN GB2312 EUC_CN basic sun.nio.cs.ext true 0xa1 0xf7 0xa1 0xfe
|
||||
EUC_KR EUC-KR EUC_KR basic sun.nio.cs.ext true 0xa1 0xfd 0xa1 0xfe
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -31,12 +31,13 @@ import java.util.Scanner;
|
||||
import java.util.Formatter;
|
||||
import java.util.regex.*;
|
||||
import java.nio.charset.*;
|
||||
import static build.tools.charsetmapping.CharsetMapping.*;
|
||||
import static build.tools.charsetmapping.Utils.*;
|
||||
|
||||
public class GenerateDBCS {
|
||||
public class DBCS {
|
||||
// pattern used by this class to read in mapping table
|
||||
static Pattern mPattern = Pattern.compile("(?:0x)?(\\p{XDigit}++)\\s++(?:0x)?(\\p{XDigit}++)(?:\\s++#.*)?");
|
||||
public static void genDBCS(String args[]) throws Exception {
|
||||
|
||||
public static void genClass(String args[]) throws Exception {
|
||||
|
||||
Scanner s = new Scanner(new File(args[0], args[2]));
|
||||
while (s.hasNextLine()) {
|
||||
@ -63,81 +64,29 @@ public class GenerateDBCS {
|
||||
int b2Min = toInteger(fields[8]);
|
||||
int b2Max = toInteger(fields[9]);
|
||||
System.out.printf("%s,%s,%s,%b,%s%n", clzName, csName, hisName, isASCII, pkgName);
|
||||
genClass(args[0], args[1], "DoubleByte-X.java.template",
|
||||
genClass0(args[0], args[1], "DoubleByte-X.java.template",
|
||||
clzName, csName, hisName, pkgName,
|
||||
isASCII, type,
|
||||
b1Min, b1Max, b2Min, b2Max);
|
||||
}
|
||||
}
|
||||
|
||||
private static int toInteger(String s) {
|
||||
static int toInteger(String s) {
|
||||
if (s.startsWith("0x") || s.startsWith("0X"))
|
||||
return Integer.valueOf(s.substring(2), 16);
|
||||
else
|
||||
return Integer.valueOf(s);
|
||||
}
|
||||
|
||||
private static void outString(Formatter out,
|
||||
char[] cc, int off, int end,
|
||||
String closure)
|
||||
{
|
||||
while (off < end) {
|
||||
out.format(" \"");
|
||||
for (int j = 0; j < 8; j++) {
|
||||
if (off == end)
|
||||
break;
|
||||
char c = cc[off++];
|
||||
switch (c) {
|
||||
case '\b':
|
||||
out.format("\\b"); break;
|
||||
case '\t':
|
||||
out.format("\\t"); break;
|
||||
case '\n':
|
||||
out.format("\\n"); break;
|
||||
case '\f':
|
||||
out.format("\\f"); break;
|
||||
case '\r':
|
||||
out.format("\\r"); break;
|
||||
case '\"':
|
||||
out.format("\\\""); break;
|
||||
case '\'':
|
||||
out.format("\\'"); break;
|
||||
case '\\':
|
||||
out.format("\\\\"); break;
|
||||
default:
|
||||
out.format("\\u%04X", c & 0xffff);
|
||||
}
|
||||
}
|
||||
if (off == end)
|
||||
out.format("\" %s%n", closure);
|
||||
else
|
||||
out.format("\" + %n");
|
||||
}
|
||||
}
|
||||
|
||||
private static void outString(Formatter out,
|
||||
char[] db,
|
||||
int b1,
|
||||
int b2Min, int b2Max,
|
||||
String closure)
|
||||
{
|
||||
char[] cc = new char[b2Max - b2Min + 1];
|
||||
int off = 0;
|
||||
for (int b2 = b2Min; b2 <= b2Max; b2++) {
|
||||
cc[off++] = db[(b1 << 8) | b2];
|
||||
}
|
||||
outString(out, cc, 0, cc.length, closure);
|
||||
}
|
||||
|
||||
private static void genClass(String srcDir, String dstDir, String template,
|
||||
String clzName,
|
||||
String csName,
|
||||
String hisName,
|
||||
String pkgName,
|
||||
boolean isASCII,
|
||||
String type,
|
||||
int b1Min, int b1Max,
|
||||
int b2Min, int b2Max)
|
||||
private static void genClass0(String srcDir, String dstDir, String template,
|
||||
String clzName,
|
||||
String csName,
|
||||
String hisName,
|
||||
String pkgName,
|
||||
boolean isASCII,
|
||||
String type,
|
||||
int b1Min, int b1Max,
|
||||
int b2Min, int b2Max)
|
||||
throws Exception
|
||||
{
|
||||
|
||||
@ -172,21 +121,21 @@ public class GenerateDBCS {
|
||||
c2bIndex[e.cp>>8] = 1;
|
||||
}
|
||||
}
|
||||
Formatter fm = new Formatter(b2cSB);
|
||||
fm.format("%n static final String b2cSBStr =%n");
|
||||
outString(fm, db, 0x00, 0x100, ";");
|
||||
Output out = new Output(new Formatter(b2cSB));
|
||||
out.format("%n static final String b2cSBStr =%n");
|
||||
out.format(db, 0x00, 0x100, ";");
|
||||
|
||||
fm.format("%n static final String[] b2cStr = {%n");
|
||||
out.format("%n static final String[] b2cStr = {%n");
|
||||
for (int i = 0; i < 0x100; i++) {
|
||||
if (b2cIndex[i] == UNMAPPABLE_DECODING) {
|
||||
fm.format(" null,%n"); //unmappable segments
|
||||
out.format(" null,%n"); //unmappable segments
|
||||
} else {
|
||||
outString(fm, db, i, b2Min, b2Max, ",");
|
||||
out.format(db, i, b2Min, b2Max, ",");
|
||||
}
|
||||
}
|
||||
|
||||
fm.format(" };%n");
|
||||
fm.close();
|
||||
out.format(" };%n");
|
||||
out.close();
|
||||
|
||||
// (2)now parse the .nr file which includes "b->c" non-roundtrip entries
|
||||
File f = new File(srcDir, clzName + ".nr");
|
||||
@ -201,10 +150,10 @@ public class GenerateDBCS {
|
||||
sb.append((char)e.cp);
|
||||
}
|
||||
char[] nr = sb.toString().toCharArray();
|
||||
fm = new Formatter(b2cNRSB);
|
||||
fm.format("String b2cNR =%n");
|
||||
outString(fm, nr, 0, nr.length, ";");
|
||||
fm.close();
|
||||
out = new Output(new Formatter(b2cNRSB));
|
||||
out.format("String b2cNR =%n");
|
||||
out.format(nr, 0, nr.length, ";");
|
||||
out.close();
|
||||
} else {
|
||||
b2cNRSB.append("String b2cNR = null;");
|
||||
}
|
||||
@ -226,10 +175,10 @@ public class GenerateDBCS {
|
||||
sb.append((char)e.cp);
|
||||
}
|
||||
char[] nr = sb.toString().toCharArray();
|
||||
fm = new Formatter(c2bNRSB);
|
||||
fm.format("String c2bNR =%n");
|
||||
outString(fm, nr, 0, nr.length, ";");
|
||||
fm.close();
|
||||
out = new Output(new Formatter(c2bNRSB));
|
||||
out.format("String c2bNR =%n");
|
||||
out.format(nr, 0, nr.length, ";");
|
||||
out.close();
|
||||
} else {
|
||||
c2bNRSB.append("String c2bNR = null;");
|
||||
}
|
||||
@ -240,15 +189,15 @@ public class GenerateDBCS {
|
||||
String c2bNR = c2bNRSB.toString();
|
||||
|
||||
Scanner s = new Scanner(new File(srcDir, template));
|
||||
PrintStream out = new PrintStream(new FileOutputStream(
|
||||
new File(dstDir, clzName + ".java")));
|
||||
PrintStream ops = new PrintStream(new FileOutputStream(
|
||||
new File(dstDir, clzName + ".java")));
|
||||
if (hisName == null)
|
||||
hisName = "";
|
||||
|
||||
while (s.hasNextLine()) {
|
||||
String line = s.nextLine();
|
||||
if (line.indexOf("$") == -1) {
|
||||
out.println(line);
|
||||
ops.println(line);
|
||||
continue;
|
||||
}
|
||||
line = line.replace("$PACKAGE$" , pkgName)
|
||||
@ -280,8 +229,8 @@ public class GenerateDBCS {
|
||||
.replace("$NONROUNDTRIP_B2C$", b2cNR)
|
||||
.replace("$NONROUNDTRIP_C2B$", c2bNR);
|
||||
|
||||
out.println(line);
|
||||
ops.println(line);
|
||||
}
|
||||
out.close();
|
||||
ops.close();
|
||||
}
|
||||
}
|
177
jdk/make/tools/src/build/tools/charsetmapping/EUC_TW.java
Normal file
177
jdk/make/tools/src/build/tools/charsetmapping/EUC_TW.java
Normal file
@ -0,0 +1,177 @@
|
||||
/*
|
||||
* Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Sun designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Sun in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
package build.tools.charsetmapping;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Scanner;
|
||||
import java.util.Formatter;
|
||||
import java.util.regex.*;
|
||||
import java.nio.charset.*;
|
||||
import static build.tools.charsetmapping.Utils.*;
|
||||
|
||||
public class EUC_TW {
|
||||
|
||||
static char[] toCharArray(int[] db,
|
||||
int b1Min, int b1Max,
|
||||
int b2Min, int b2Max)
|
||||
{
|
||||
char[] ca = new char[(b1Max - b1Min + 1) * (b2Max - b2Min + 1)];
|
||||
int off = 0;
|
||||
for (int b1 = b1Min; b1 <= b1Max; b1++) {
|
||||
for (int b2 = b2Min; b2 <= b2Max; b2++) {
|
||||
ca[off++] = (char)(db[b1 * 256 + b2] & 0xffff);
|
||||
}
|
||||
}
|
||||
return ca;
|
||||
}
|
||||
|
||||
static char[] toCharArray(byte[] ba,
|
||||
int b1Min, int b1Max,
|
||||
int b2Min, int b2Max)
|
||||
{
|
||||
char[] ca = new char[(b1Max - b1Min + 1) * (b2Max - b2Min + 1)];
|
||||
int off = 0;
|
||||
for (int b1 = b1Min; b1 <= b1Max; b1++) {
|
||||
int b2 = b2Min;
|
||||
while (b2 <= b2Max) {
|
||||
ca[off++] = (char)(((ba[b1 * 256 + b2++] & 0xff) << 8) |
|
||||
(ba[b1 * 256 + b2++] & 0xff));
|
||||
}
|
||||
}
|
||||
return ca;
|
||||
}
|
||||
|
||||
private static int initC2BIndex(char[] index) {
|
||||
int off = 0;
|
||||
for (int i = 0; i < index.length; i++) {
|
||||
if (index[i] != 0) {
|
||||
index[i] = (char)off;
|
||||
off += 0x100;
|
||||
} else {
|
||||
index[i] = UNMAPPABLE_ENCODING;
|
||||
}
|
||||
}
|
||||
return off;
|
||||
}
|
||||
|
||||
private static Pattern euctw = Pattern.compile("(?:8ea)?(\\p{XDigit}++)\\s++(\\p{XDigit}++)?\\s*+.*");
|
||||
|
||||
static void genClass(String args[]) throws Exception
|
||||
{
|
||||
InputStream is = new FileInputStream(new File(args[0], "euc_tw.map"));
|
||||
PrintStream ps = new PrintStream(new File(args[1], "EUC_TWMapping.java"),
|
||||
"ISO-8859-1");
|
||||
String copyright = getCopyright(new File(args[3]));
|
||||
|
||||
|
||||
// ranges of byte1 and byte2, something should come from a "config" file
|
||||
int b1Min = 0xa1;
|
||||
int b1Max = 0xfe;
|
||||
int b2Min = 0xa1;
|
||||
int b2Max = 0xfe;
|
||||
|
||||
try {
|
||||
int[][] db = new int[8][0x10000]; // doublebyte
|
||||
byte[] suppFlag = new byte[0x10000]; // doublebyte
|
||||
char[] indexC2B = new char[256];
|
||||
char[] indexC2BSupp = new char[256];
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
for (int j = 0; j < 0x10000; j++)
|
||||
db[i][j] = UNMAPPABLE_DECODING;
|
||||
|
||||
Parser p = new Parser(is, euctw);
|
||||
Entry e = null;
|
||||
while ((e = p.next()) != null) {
|
||||
int plane = 0;
|
||||
if (e.bs >= 0x10000) {
|
||||
plane = ((e.bs >> 16) & 0xff) - 1;
|
||||
if (plane >= 14)
|
||||
plane = 7;
|
||||
e.bs = e.bs & 0xffff;
|
||||
}
|
||||
db[plane][e.bs] = e.cp;
|
||||
if (e.cp < 0x10000) {
|
||||
indexC2B[e.cp>>8] = 1;
|
||||
} else {
|
||||
indexC2BSupp[(e.cp&0xffff)>>8] = 1;
|
||||
suppFlag[e.bs] |= (1 << plane);
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Output out = new Output(new Formatter(sb));
|
||||
|
||||
out.format(copyright);
|
||||
out.format("%n// -- This file was mechanically generated: Do not edit! -- //%n");
|
||||
out.format("package sun.nio.cs.ext;%n%n");
|
||||
out.format("class EUC_TWMapping {%n%n");
|
||||
|
||||
// boundaries
|
||||
out.format(" final static int b1Min = 0x%x;%n", b1Min);
|
||||
out.format(" final static int b1Max = 0x%x;%n", b1Max);
|
||||
out.format(" final static int b2Min = 0x%x;%n", b2Min);
|
||||
out.format(" final static int b2Max = 0x%x;%n", b2Max);
|
||||
|
||||
// b2c tables
|
||||
out.format("%n final static String[] b2c = {%n");
|
||||
for (int plane = 0; plane < 8; plane++) {
|
||||
out.format(" // Plane %d%n", plane);
|
||||
out.format(toCharArray(db[plane], b1Min, b1Max, b2Min, b2Max),
|
||||
",");
|
||||
out.format("%n");
|
||||
}
|
||||
out.format(" };%n");
|
||||
|
||||
// c2bIndex
|
||||
out.format("%n static final int C2BSIZE = 0x%x;%n",
|
||||
initC2BIndex(indexC2B));
|
||||
out.format("%n static char[] c2bIndex = new char[] {%n");
|
||||
out.format(indexC2B);
|
||||
out.format(" };%n");
|
||||
|
||||
// c2bIndexSupp
|
||||
out.format("%n static final int C2BSUPPSIZE = 0x%x;%n",
|
||||
initC2BIndex(indexC2BSupp));
|
||||
out.format("%n static char[] c2bSuppIndex = new char[] {%n");
|
||||
out.format(indexC2BSupp);
|
||||
out.format(" };%n");
|
||||
|
||||
// suppFlags
|
||||
out.format("%n static String b2cIsSuppStr =%n");
|
||||
out.format(toCharArray(suppFlag, b1Min, b1Max, b2Min, b2Max),
|
||||
";");
|
||||
out.format("}");
|
||||
out.close();
|
||||
|
||||
ps.println(sb.toString());
|
||||
ps.close();
|
||||
} catch (Exception x) {
|
||||
x.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,246 +0,0 @@
|
||||
/*
|
||||
* Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Sun designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Sun in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
package build.tools.charsetmapping;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Scanner;
|
||||
import java.util.Formatter;
|
||||
import java.util.regex.*;
|
||||
import java.nio.charset.*;
|
||||
import static build.tools.charsetmapping.CharsetMapping.*;
|
||||
|
||||
public class GenerateEUC_TW {
|
||||
|
||||
public static void genEUC_TW(String args[]) throws Exception {
|
||||
genClass(new FileInputStream(new File(args[0], "euc_tw.map")),
|
||||
new PrintStream(new File(args[1], "EUC_TWMapping.java"), "ISO-8859-1"),
|
||||
getCopyright(new File(args[3])));
|
||||
}
|
||||
|
||||
private static String getCopyright(File f) throws IOException {
|
||||
Scanner s = new Scanner(f, "ISO-8859-1");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
while (s.hasNextLine()) {
|
||||
String ln = s.nextLine();
|
||||
sb.append(ln + "\n");
|
||||
// assume we have the copyright as the first comment
|
||||
if (ln.matches("^\\s\\*\\/$"))
|
||||
break;
|
||||
}
|
||||
s.close();
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static char[] toCharArray(int[] db,
|
||||
int b1Min, int b1Max,
|
||||
int b2Min, int b2Max)
|
||||
{
|
||||
char[] ca = new char[(b1Max - b1Min + 1) * (b2Max - b2Min + 1)];
|
||||
int off = 0;
|
||||
for (int b1 = b1Min; b1 <= b1Max; b1++) {
|
||||
for (int b2 = b2Min; b2 <= b2Max; b2++) {
|
||||
ca[off++] = (char)(db[b1 * 256 + b2] & 0xffff);
|
||||
}
|
||||
}
|
||||
return ca;
|
||||
}
|
||||
|
||||
private static void toChar(Formatter out, String fmt, char c) {
|
||||
switch (c) {
|
||||
case '\b':
|
||||
out.format("\\b"); break;
|
||||
case '\t':
|
||||
out.format("\\t"); break;
|
||||
case '\n':
|
||||
out.format("\\n"); break;
|
||||
case '\f':
|
||||
out.format("\\f"); break;
|
||||
case '\r':
|
||||
out.format("\\r"); break;
|
||||
case '\"':
|
||||
out.format("\\\""); break;
|
||||
case '\'':
|
||||
out.format("\\'"); break;
|
||||
case '\\':
|
||||
out.format("\\\\"); break;
|
||||
default:
|
||||
out.format(fmt, c & 0xffff);
|
||||
}
|
||||
}
|
||||
|
||||
private static void toString(Formatter out, char[] date, String endStr)
|
||||
{
|
||||
int off = 0;
|
||||
int end = date.length;
|
||||
while (off < end) {
|
||||
out.format(" \"");
|
||||
for (int j = 0; j < 8 && off < end; j++) {
|
||||
toChar(out, "\\u%04X", date[off++]);
|
||||
}
|
||||
if (off == end)
|
||||
out.format("\"%s%n", endStr);
|
||||
else
|
||||
out.format("\" +%n");
|
||||
}
|
||||
}
|
||||
|
||||
private static char[] toCharArray(byte[] ba,
|
||||
int b1Min, int b1Max,
|
||||
int b2Min, int b2Max)
|
||||
{
|
||||
char[] ca = new char[(b1Max - b1Min + 1) * (b2Max - b2Min + 1)];
|
||||
int off = 0;
|
||||
for (int b1 = b1Min; b1 <= b1Max; b1++) {
|
||||
int b2 = b2Min;
|
||||
while (b2 <= b2Max) {
|
||||
ca[off++] = (char)(((ba[b1 * 256 + b2++] & 0xff) << 8) |
|
||||
(ba[b1 * 256 + b2++] & 0xff));
|
||||
}
|
||||
}
|
||||
return ca;
|
||||
}
|
||||
|
||||
private static void toCharArray(Formatter out, char[] date) {
|
||||
int off = 0;
|
||||
int end = date.length;
|
||||
while (off < end) {
|
||||
out.format(" ");
|
||||
for (int j = 0; j < 8 && off < end; j++) {
|
||||
toChar(out, "'\\u%04X',", date[off++]);
|
||||
}
|
||||
out.format("%n");
|
||||
}
|
||||
}
|
||||
|
||||
private static int initC2BIndex(char[] index) {
|
||||
int off = 0;
|
||||
for (int i = 0; i < index.length; i++) {
|
||||
if (index[i] != 0) {
|
||||
index[i] = (char)off;
|
||||
off += 0x100;
|
||||
} else {
|
||||
index[i] = CharsetMapping.UNMAPPABLE_ENCODING;
|
||||
}
|
||||
}
|
||||
return off;
|
||||
}
|
||||
|
||||
private static Pattern euctw = Pattern.compile("(?:8ea)?(\\p{XDigit}++)\\s++(\\p{XDigit}++)?\\s*+.*");
|
||||
|
||||
private static void genClass(InputStream is, PrintStream ps, String copyright)
|
||||
throws Exception
|
||||
{
|
||||
// ranges of byte1 and byte2, something should come from a "config" file
|
||||
int b1Min = 0xa1;
|
||||
int b1Max = 0xfe;
|
||||
int b2Min = 0xa1;
|
||||
int b2Max = 0xfe;
|
||||
|
||||
try {
|
||||
int[][] db = new int[8][0x10000]; // doublebyte
|
||||
byte[] suppFlag = new byte[0x10000]; // doublebyte
|
||||
char[] indexC2B = new char[256];
|
||||
char[] indexC2BSupp = new char[256];
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
for (int j = 0; j < 0x10000; j++)
|
||||
db[i][j] = CharsetMapping.UNMAPPABLE_DECODING;
|
||||
|
||||
CharsetMapping.Parser p = new CharsetMapping.Parser(is, euctw);
|
||||
CharsetMapping.Entry e = null;
|
||||
while ((e = p.next()) != null) {
|
||||
int plane = 0;
|
||||
if (e.bs >= 0x10000) {
|
||||
plane = ((e.bs >> 16) & 0xff) - 1;
|
||||
if (plane >= 14)
|
||||
plane = 7;
|
||||
e.bs = e.bs & 0xffff;
|
||||
}
|
||||
db[plane][e.bs] = e.cp;
|
||||
if (e.cp < 0x10000) {
|
||||
indexC2B[e.cp>>8] = 1;
|
||||
} else {
|
||||
indexC2BSupp[(e.cp&0xffff)>>8] = 1;
|
||||
suppFlag[e.bs] |= (1 << plane);
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder out = new StringBuilder();
|
||||
Formatter fm = new Formatter(out);
|
||||
|
||||
fm.format(copyright);
|
||||
fm.format("%n// -- This file was mechanically generated: Do not edit! -- //%n");
|
||||
fm.format("package sun.nio.cs.ext;%n%n");
|
||||
fm.format("class EUC_TWMapping {%n%n");
|
||||
|
||||
// boundaries
|
||||
fm.format(" final static int b1Min = 0x%x;%n", b1Min);
|
||||
fm.format(" final static int b1Max = 0x%x;%n", b1Max);
|
||||
fm.format(" final static int b2Min = 0x%x;%n", b2Min);
|
||||
fm.format(" final static int b2Max = 0x%x;%n", b2Max);
|
||||
|
||||
// b2c tables
|
||||
fm.format("%n final static String[] b2c = {%n");
|
||||
for (int plane = 0; plane < 8; plane++) {
|
||||
fm.format(" // Plane %d%n", plane);
|
||||
toString(fm, toCharArray(db[plane],
|
||||
b1Min, b1Max, b2Min, b2Max),
|
||||
",");
|
||||
fm.format("%n");
|
||||
}
|
||||
fm.format(" };%n");
|
||||
|
||||
// c2bIndex
|
||||
fm.format("%n static final int C2BSIZE = 0x%x;%n",
|
||||
initC2BIndex(indexC2B));
|
||||
fm.format("%n static char[] c2bIndex = new char[] {%n");
|
||||
toCharArray(fm, indexC2B);
|
||||
fm.format(" };%n");
|
||||
|
||||
// c2bIndexSupp
|
||||
fm.format("%n static final int C2BSUPPSIZE = 0x%x;%n",
|
||||
initC2BIndex(indexC2BSupp));
|
||||
fm.format("%n static char[] c2bSuppIndex = new char[] {%n");
|
||||
toCharArray(fm, indexC2BSupp);
|
||||
fm.format(" };%n");
|
||||
|
||||
// suppFlags
|
||||
fm.format("%n static String b2cIsSuppStr =%n");
|
||||
toString(fm, toCharArray(suppFlag,
|
||||
b1Min, b1Max, b2Min, b2Max),
|
||||
";");
|
||||
|
||||
fm.format("}");
|
||||
fm.close();
|
||||
|
||||
ps.println(out.toString());
|
||||
ps.close();
|
||||
} catch (Exception x) {
|
||||
x.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,95 +0,0 @@
|
||||
/*
|
||||
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Sun designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Sun in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
package build.tools.charsetmapping;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.regex.*;
|
||||
import static build.tools.charsetmapping.CharsetMapping.*;
|
||||
|
||||
public class GenerateMapping {
|
||||
|
||||
public static void genMapping(String argv[]) throws IOException {
|
||||
genDataJIS0213(new FileInputStream(argv[0]),
|
||||
new FileOutputStream(argv[1]));
|
||||
}
|
||||
|
||||
// regex pattern to parse the "jis0213.map" file
|
||||
static Pattern sjis0213 = Pattern.compile("0x(\\p{XDigit}++)\\s++U\\+(\\p{XDigit}++)(?:\\+(\\p{XDigit}++))?\\s++#.*");
|
||||
private static void genDataJIS0213(InputStream in, OutputStream out)
|
||||
{
|
||||
int[] sb = new int[0x100]; // singlebyte
|
||||
int[] db = new int[0x10000]; // doublebyte
|
||||
int[] indexC2B = new int[256];
|
||||
Entry[] supp = new Entry[0x10000];
|
||||
Entry[] comp = new Entry[0x100];
|
||||
int suppTotal = 0;
|
||||
int compTotal = 0;
|
||||
|
||||
int b1Min1 = 0x81;
|
||||
int b1Max1 = 0x9f;
|
||||
int b1Min2 = 0xe0;
|
||||
int b1Max2 = 0xfc;
|
||||
int b2Min = 0x40;
|
||||
int b2Max = 0xfe;
|
||||
|
||||
//init
|
||||
for (int i = 0; i < 0x80; i++) sb[i] = i;
|
||||
for (int i = 0x80; i < 0x100; i++) sb[i] = UNMAPPABLE_DECODING;
|
||||
for (int i = 0; i < 0x10000; i++) db[i] = UNMAPPABLE_DECODING;
|
||||
try {
|
||||
Parser p = new Parser(in, sjis0213);
|
||||
Entry e = null;
|
||||
while ((e = p.next()) != null) {
|
||||
if (e.cp2 != 0) {
|
||||
comp[compTotal++] = e;
|
||||
} else {
|
||||
if (e.cp <= 0xffff) {
|
||||
if (e.bs <= 0xff)
|
||||
sb[e.bs] = e.cp;
|
||||
else
|
||||
db[e.bs] = e.cp;
|
||||
indexC2B[e.cp>>8] = 1;
|
||||
} else {
|
||||
supp[suppTotal++] = e;
|
||||
}
|
||||
}
|
||||
}
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
// c2b Index Table, always the first one
|
||||
writeINDEXC2B(baos, indexC2B);
|
||||
writeSINGLEBYTE(baos, sb);
|
||||
writeDOUBLEBYTE1(baos, db, b1Min1, b1Max1, b2Min, b2Max);
|
||||
writeDOUBLEBYTE2(baos, db, b1Min2, b1Max2, b2Min, b2Max);
|
||||
writeSUPPLEMENT(baos, supp, suppTotal);
|
||||
writeCOMPOSITE(baos, comp, compTotal);
|
||||
writeSIZE(out, baos.size());
|
||||
baos.writeTo(out);
|
||||
out.close();
|
||||
} catch (Exception x) {
|
||||
x.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
190
jdk/make/tools/src/build/tools/charsetmapping/HKSCS.java
Normal file
190
jdk/make/tools/src/build/tools/charsetmapping/HKSCS.java
Normal file
@ -0,0 +1,190 @@
|
||||
/*
|
||||
* Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Sun designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Sun in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
package build.tools.charsetmapping;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Scanner;
|
||||
import java.util.Formatter;
|
||||
import java.util.regex.*;
|
||||
import java.nio.charset.*;
|
||||
import static build.tools.charsetmapping.Utils.*;
|
||||
|
||||
public class HKSCS {
|
||||
|
||||
// HKSCS2001.map has the third column for "UnicodeAlternate", which
|
||||
// is for c->b non-roundtrip mapping.
|
||||
// For HKSCS2008, those non-roundtrip mappings are in .nr file
|
||||
private static Pattern hkscs =
|
||||
Pattern.compile("(?:0x)?+(\\p{XDigit}++)\\s++(?:0x|U\\+)?+(\\p{XDigit}++)?\\s*+(?:0x|U\\+)?(\\p{XDigit}++)?\\s*+.*");
|
||||
|
||||
static void genClass(String args[]) throws Exception {
|
||||
|
||||
// hkscs2008
|
||||
genClass0(new FileInputStream(new File(args[0], "HKSCS2008.map")),
|
||||
new FileInputStream(new File(args[0], "HKSCS2008.c2b")),
|
||||
new PrintStream(new File(args[1], "HKSCSMapping.java"),
|
||||
"ISO-8859-1"),
|
||||
"HKSCSMapping",
|
||||
getCopyright(new File(args[3])));
|
||||
|
||||
|
||||
// xp2001
|
||||
genClass0(new FileInputStream(new File(args[0], "HKSCS_XP.map")),
|
||||
null,
|
||||
new PrintStream(new File(args[1], "HKSCS_XPMapping.java"),
|
||||
"ISO-8859-1"),
|
||||
"HKSCS_XPMapping",
|
||||
getCopyright(new File(args[3])));
|
||||
|
||||
// hkscs2001
|
||||
genClass0(new FileInputStream(new File(args[0], "HKSCS2001.map")),
|
||||
new FileInputStream(new File(args[0], "HKSCS2001.c2b")),
|
||||
new PrintStream(new File(args[1], "HKSCS2001Mapping.java"),
|
||||
"ISO-8859-1"),
|
||||
"HKSCS2001Mapping",
|
||||
getCopyright(new File(args[3])));
|
||||
}
|
||||
|
||||
static void genClass0(InputStream isB2C,
|
||||
InputStream isC2B,
|
||||
PrintStream ps,
|
||||
String clzName,
|
||||
String copyright)
|
||||
throws Exception
|
||||
{
|
||||
// ranges of byte1 and byte2, something should come from a "config" file
|
||||
int b1Min = 0x87;
|
||||
int b1Max = 0xfe;
|
||||
int b2Min = 0x40;
|
||||
int b2Max = 0xfe;
|
||||
|
||||
try {
|
||||
char[] bmp = new char[0x10000];
|
||||
char[] supp = new char[0x10000];
|
||||
|
||||
boolean[] b2cBmp = new boolean[0x100];
|
||||
boolean[] b2cSupp = new boolean[0x100];
|
||||
// pua should be in range of e000-f8ff. Expand
|
||||
// it to 0xf93b becase the hkscs2001.c2b has
|
||||
// the f920-f93b filled
|
||||
//char[] pua = new char[0xF8FF - 0xE000 + 1];
|
||||
char[] pua = new char[0xF93b - 0xE000 + 1];
|
||||
boolean hasSupp = false;
|
||||
boolean hasPua = false;
|
||||
|
||||
Arrays.fill(bmp, UNMAPPABLE_DECODING);
|
||||
Arrays.fill(supp, UNMAPPABLE_DECODING);
|
||||
Arrays.fill(pua, UNMAPPABLE_DECODING);
|
||||
|
||||
Parser p = new Parser(isB2C, hkscs);
|
||||
Entry e = null;
|
||||
while ((e = p.next()) != null) {
|
||||
if (e.cp >= 0x10000) {
|
||||
supp[e.bs] = (char)e.cp;
|
||||
b2cSupp[e.bs>>8] = true;
|
||||
hasSupp = true;
|
||||
} else {
|
||||
bmp[e.bs] = (char)e.cp;
|
||||
b2cBmp[e.bs>>8] = true;
|
||||
}
|
||||
if (e.cp2 != 0 && e.cp2 >= 0xe000 && e.cp2 <= 0xf8ff) {
|
||||
hasPua = true;
|
||||
pua[e.cp2 - 0xE000] = (char)e.bs;
|
||||
}
|
||||
}
|
||||
|
||||
if (isC2B != null) {
|
||||
p = new Parser(isC2B, hkscs);
|
||||
e = null;
|
||||
while ((e = p.next()) != null) {
|
||||
pua[e.cp - 0xE000] = (char)e.bs;
|
||||
}
|
||||
hasPua = true;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Output out = new Output(new Formatter(sb));
|
||||
|
||||
out.format(copyright);
|
||||
out.format("%n// -- This file was mechanically generated: Do not edit! -- //%n");
|
||||
out.format("package sun.nio.cs.ext;%n%n");
|
||||
out.format("class %s {%n%n", clzName);
|
||||
|
||||
/* hardcoded in sun.nio.cs.ext.HKSCS.java
|
||||
out.format(" final static int b1Min = 0x%x;%n", b1Min);
|
||||
out.format(" final static int b1Max = 0x%x;%n", b1Max);
|
||||
out.format(" final static int b2Min = 0x%x;%n", b2Min);
|
||||
out.format(" final static int b2Max = 0x%x;%n", b2Max);
|
||||
*/
|
||||
|
||||
// bmp tables
|
||||
out.format("%n static final String[] b2cBmpStr = new String[] {%n");
|
||||
for (int i = 0; i < 0x100; i++) {
|
||||
if (b2cBmp[i])
|
||||
out.format(bmp, i, b2Min, b2Max, ",");
|
||||
else
|
||||
out.format(" null,%n"); //unmappable segments
|
||||
}
|
||||
out.format(" };%n");
|
||||
|
||||
// supp tables
|
||||
out.format("%n static final String[] b2cSuppStr =");
|
||||
if (hasSupp) {
|
||||
out.format(" new String[] {%n");
|
||||
for (int i = 0; i < 0x100; i++) {
|
||||
if (b2cSupp[i])
|
||||
out.format(supp, i, b2Min, b2Max, ",");
|
||||
else
|
||||
out.format(" null,%n"); //unmappable segments
|
||||
}
|
||||
out.format(" };%n");
|
||||
} else {
|
||||
out.format(" null;%n");
|
||||
}
|
||||
|
||||
// private area tables
|
||||
out.format("%n final static String pua =");
|
||||
if (hasPua) {
|
||||
out.format("%n");
|
||||
out.format(pua, 0, pua.length, ";");
|
||||
} else {
|
||||
out.format(" null;%n");
|
||||
}
|
||||
out.format("%n");
|
||||
out.format("}");
|
||||
|
||||
out.close();
|
||||
|
||||
ps.println(sb.toString());
|
||||
ps.close();
|
||||
|
||||
} catch (Exception x) {
|
||||
x.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -25,29 +25,71 @@
|
||||
|
||||
package build.tools.charsetmapping;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.io.*;
|
||||
import java.util.regex.*;
|
||||
import java.util.*;
|
||||
import static build.tools.charsetmapping.Utils.*;
|
||||
|
||||
public class CharsetMapping {
|
||||
public final static char UNMAPPABLE_DECODING = '\uFFFD';
|
||||
public final static int UNMAPPABLE_ENCODING = 0xFFFD;
|
||||
public class JIS0213 {
|
||||
|
||||
public static class Entry {
|
||||
public int bs; //byte sequence reps
|
||||
public int cp; //Unicode codepoint
|
||||
public int cp2; //CC of composite
|
||||
// regex pattern to parse the "jis0213.map" file
|
||||
static Pattern sjis0213 = Pattern.compile("0x(\\p{XDigit}++)\\s++U\\+(\\p{XDigit}++)(?:\\+(\\p{XDigit}++))?\\s++#.*");
|
||||
|
||||
public Entry () {}
|
||||
public Entry (int bytes, int cp, int cp2) {
|
||||
this.bs = bytes;
|
||||
this.cp = cp;
|
||||
this.cp2 = cp2;
|
||||
static void genClass(String argv[]) throws IOException
|
||||
{
|
||||
InputStream in = new FileInputStream(argv[0]) ;
|
||||
OutputStream out = new FileOutputStream(argv[1]);
|
||||
|
||||
int[] sb = new int[0x100]; // singlebyte
|
||||
int[] db = new int[0x10000]; // doublebyte
|
||||
int[] indexC2B = new int[256];
|
||||
Entry[] supp = new Entry[0x10000];
|
||||
Entry[] comp = new Entry[0x100];
|
||||
int suppTotal = 0;
|
||||
int compTotal = 0;
|
||||
|
||||
int b1Min1 = 0x81;
|
||||
int b1Max1 = 0x9f;
|
||||
int b1Min2 = 0xe0;
|
||||
int b1Max2 = 0xfc;
|
||||
int b2Min = 0x40;
|
||||
int b2Max = 0xfe;
|
||||
|
||||
//init
|
||||
for (int i = 0; i < 0x80; i++) sb[i] = i;
|
||||
for (int i = 0x80; i < 0x100; i++) sb[i] = UNMAPPABLE_DECODING;
|
||||
for (int i = 0; i < 0x10000; i++) db[i] = UNMAPPABLE_DECODING;
|
||||
try {
|
||||
Parser p = new Parser(in, sjis0213);
|
||||
Entry e = null;
|
||||
while ((e = p.next()) != null) {
|
||||
if (e.cp2 != 0) {
|
||||
comp[compTotal++] = e;
|
||||
} else {
|
||||
if (e.cp <= 0xffff) {
|
||||
if (e.bs <= 0xff)
|
||||
sb[e.bs] = e.cp;
|
||||
else
|
||||
db[e.bs] = e.cp;
|
||||
indexC2B[e.cp>>8] = 1;
|
||||
} else {
|
||||
supp[suppTotal++] = e;
|
||||
}
|
||||
}
|
||||
}
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
// c2b Index Table, always the first one
|
||||
writeINDEXC2B(baos, indexC2B);
|
||||
writeSINGLEBYTE(baos, sb);
|
||||
writeDOUBLEBYTE1(baos, db, b1Min1, b1Max1, b2Min, b2Max);
|
||||
writeDOUBLEBYTE2(baos, db, b1Min2, b1Max2, b2Min, b2Max);
|
||||
writeSUPPLEMENT(baos, supp, suppTotal);
|
||||
writeCOMPOSITE(baos, comp, compTotal);
|
||||
writeSIZE(out, baos.size());
|
||||
baos.writeTo(out);
|
||||
out.close();
|
||||
} catch (Exception x) {
|
||||
x.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,76 +103,6 @@ public class CharsetMapping {
|
||||
}
|
||||
};
|
||||
|
||||
public static class Parser {
|
||||
static final Pattern basic = Pattern.compile("(?:0x)?(\\p{XDigit}++)\\s++(?:0x)?(\\p{XDigit}++)?\\s*+.*");
|
||||
static final int gBS = 1;
|
||||
static final int gCP = 2;
|
||||
static final int gCP2 = 3;
|
||||
|
||||
BufferedReader reader;
|
||||
boolean closed;
|
||||
Matcher matcher;
|
||||
int gbs, gcp, gcp2;
|
||||
|
||||
public Parser (InputStream in, Pattern p, int gbs, int gcp, int gcp2)
|
||||
throws IOException
|
||||
{
|
||||
this.reader = new BufferedReader(new InputStreamReader(in));
|
||||
this.closed = false;
|
||||
this.matcher = p.matcher("");
|
||||
this.gbs = gbs;
|
||||
this.gcp = gcp;
|
||||
this.gcp2 = gcp2;
|
||||
}
|
||||
|
||||
public Parser (InputStream in, Pattern p) throws IOException {
|
||||
this(in, p, gBS, gCP, gCP2);
|
||||
}
|
||||
|
||||
public Parser (InputStream in) throws IOException {
|
||||
this(in, basic, gBS, gCP, gCP2);
|
||||
}
|
||||
|
||||
protected boolean isDirective(String line) {
|
||||
return line.startsWith("#");
|
||||
}
|
||||
|
||||
protected Entry parse(Matcher matcher, Entry mapping) {
|
||||
mapping.bs = Integer.parseInt(matcher.group(gbs), 16);
|
||||
mapping.cp = Integer.parseInt(matcher.group(gcp), 16);
|
||||
if (gcp2 <= matcher.groupCount() &&
|
||||
matcher.group(gcp2) != null)
|
||||
mapping.cp2 = Integer.parseInt(matcher.group(gcp2), 16);
|
||||
else
|
||||
mapping.cp2 = 0;
|
||||
return mapping;
|
||||
}
|
||||
|
||||
public Entry next() throws Exception {
|
||||
return next(new Entry());
|
||||
}
|
||||
|
||||
// returns null and closes the input stream if the eof has beenreached.
|
||||
public Entry next(Entry mapping) throws Exception {
|
||||
if (closed)
|
||||
return null;
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
if (isDirective(line))
|
||||
continue;
|
||||
matcher.reset(line);
|
||||
if (!matcher.lookingAt()) {
|
||||
//System.out.println("Missed: " + line);
|
||||
continue;
|
||||
}
|
||||
return parse(matcher, mapping);
|
||||
}
|
||||
reader.close();
|
||||
closed = true;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// tags of different charset mapping tables
|
||||
private final static int MAP_SINGLEBYTE = 0x1; // 0..256 : c
|
||||
private final static int MAP_DOUBLEBYTE1 = 0x2; // min..max: c
|
||||
@ -161,7 +133,7 @@ public class CharsetMapping {
|
||||
}
|
||||
}
|
||||
|
||||
public static final void writeSIZE(OutputStream out, int data)
|
||||
private static final void writeSIZE(OutputStream out, int data)
|
||||
throws IOException
|
||||
{
|
||||
out.write((data >>> 24) & 0xFF);
|
||||
@ -170,7 +142,7 @@ public class CharsetMapping {
|
||||
out.write((data ) & 0xFF);
|
||||
}
|
||||
|
||||
public static void writeINDEXC2B(OutputStream out, int[] indexC2B)
|
||||
private static void writeINDEXC2B(OutputStream out, int[] indexC2B)
|
||||
throws IOException
|
||||
{
|
||||
writeShort(out, MAP_INDEXC2B);
|
||||
@ -186,7 +158,7 @@ public class CharsetMapping {
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeSINGLEBYTE(OutputStream out, int[] sb)
|
||||
private static void writeSINGLEBYTE(OutputStream out, int[] sb)
|
||||
throws IOException
|
||||
{
|
||||
writeShortArray(out, MAP_SINGLEBYTE, sb, 0, 256);
|
||||
@ -212,7 +184,8 @@ public class CharsetMapping {
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void writeDOUBLEBYTE1(OutputStream out,
|
||||
|
||||
private static void writeDOUBLEBYTE1(OutputStream out,
|
||||
int[] db,
|
||||
int b1Min, int b1Max,
|
||||
int b2Min, int b2Max)
|
||||
@ -221,7 +194,7 @@ public class CharsetMapping {
|
||||
writeDOUBLEBYTE(out, MAP_DOUBLEBYTE1, db, b1Min, b1Max, b2Min, b2Max);
|
||||
}
|
||||
|
||||
public static void writeDOUBLEBYTE2(OutputStream out,
|
||||
private static void writeDOUBLEBYTE2(OutputStream out,
|
||||
int[] db,
|
||||
int b1Min, int b1Max,
|
||||
int b2Min, int b2Max)
|
||||
@ -231,7 +204,7 @@ public class CharsetMapping {
|
||||
}
|
||||
|
||||
// the c2b table is output as well
|
||||
public static void writeSUPPLEMENT(OutputStream out, Entry[] supp, int size)
|
||||
private static void writeSUPPLEMENT(OutputStream out, Entry[] supp, int size)
|
||||
throws IOException
|
||||
{
|
||||
writeShort(out, MAP_SUPPLEMENT);
|
||||
@ -256,7 +229,7 @@ public class CharsetMapping {
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeCOMPOSITE(OutputStream out, Entry[] comp, int size)
|
||||
private static void writeCOMPOSITE(OutputStream out, Entry[] comp, int size)
|
||||
throws IOException
|
||||
{
|
||||
writeShort(out, MAP_COMPOSITE);
|
@ -32,23 +32,19 @@ public class Main {
|
||||
|
||||
public static void main(String args[]) throws Exception {
|
||||
if (args.length < 3 ) {
|
||||
System.out.println("Usage: java -jar charsetmapping.jar src dst mType...");
|
||||
System.out.println("Usage: java -jar charsetmapping.jar src dst mType [copyrightSrc]");
|
||||
System.exit(1);
|
||||
}
|
||||
if ("sbcs".equals(args[2]) || "extsbcs".equals(args[2])) {
|
||||
GenerateSBCS.genSBCS(args);
|
||||
SBCS.genClass(args);
|
||||
} else if ("dbcs".equals(args[2])) {
|
||||
GenerateDBCS.genDBCS(args);
|
||||
|
||||
DBCS.genClass(args);
|
||||
} else if ("euctw".equals(args[2])) {
|
||||
if (args.length != 4) {
|
||||
System.out.println("Usage: java -jar charsetmapping.jar srcDir dstDir euctw copyrightSrc");
|
||||
System.exit(1);
|
||||
}
|
||||
GenerateEUC_TW.genEUC_TW(args);
|
||||
EUC_TW.genClass(args);
|
||||
} else if ("sjis0213".equals(args[2])) {
|
||||
GenerateMapping.genMapping(args);
|
||||
JIS0213.genClass(args);
|
||||
} else if ("hkscs".equals(args[2])) {
|
||||
HKSCS.genClass(args);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -32,11 +32,11 @@ import java.util.Scanner;
|
||||
import java.util.Formatter;
|
||||
import java.util.regex.*;
|
||||
import java.nio.charset.*;
|
||||
import static build.tools.charsetmapping.CharsetMapping.*;
|
||||
import static build.tools.charsetmapping.Utils.*;
|
||||
|
||||
public class GenerateSBCS {
|
||||
public class SBCS {
|
||||
|
||||
public static void genSBCS(String args[]) throws Exception {
|
||||
public static void genClass(String args[]) throws Exception {
|
||||
|
||||
Scanner s = new Scanner(new File(args[0], args[2]));
|
||||
while (s.hasNextLine()) {
|
||||
@ -55,8 +55,8 @@ public class GenerateSBCS {
|
||||
String pkgName = fields[4];
|
||||
System.out.printf("%s,%s,%s,%b,%s%n", clzName, csName, hisName, isASCII, pkgName);
|
||||
|
||||
genClass(args[0], args[1], "SingleByte-X.java.template",
|
||||
clzName, csName, hisName, pkgName, isASCII);
|
||||
genClass0(args[0], args[1], "SingleByte-X.java.template",
|
||||
clzName, csName, hisName, pkgName, isASCII);
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,13 +108,13 @@ public class GenerateSBCS {
|
||||
|
||||
static Pattern sbmap = Pattern.compile("0x(\\p{XDigit}++)\\s++U\\+(\\p{XDigit}++)(\\s++#.*)?");
|
||||
|
||||
private static void genClass(String srcDir, String dstDir,
|
||||
String template,
|
||||
String clzName,
|
||||
String csName,
|
||||
String hisName,
|
||||
String pkgName,
|
||||
boolean isASCII)
|
||||
private static void genClass0(String srcDir, String dstDir,
|
||||
String template,
|
||||
String clzName,
|
||||
String csName,
|
||||
String hisName,
|
||||
String pkgName,
|
||||
boolean isASCII)
|
||||
throws Exception
|
||||
{
|
||||
StringBuilder b2cSB = new StringBuilder();
|
221
jdk/make/tools/src/build/tools/charsetmapping/Utils.java
Normal file
221
jdk/make/tools/src/build/tools/charsetmapping/Utils.java
Normal file
@ -0,0 +1,221 @@
|
||||
/*
|
||||
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Sun designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Sun in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
package build.tools.charsetmapping;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.Scanner;
|
||||
import java.util.Formatter;
|
||||
|
||||
public class Utils {
|
||||
|
||||
public final static char UNMAPPABLE_DECODING = '\uFFFD';
|
||||
public final static int UNMAPPABLE_ENCODING = 0xFFFD;
|
||||
|
||||
public static class Entry {
|
||||
public int bs; //byte sequence reps
|
||||
public int cp; //Unicode codepoint
|
||||
public int cp2; //CC of composite
|
||||
|
||||
public Entry () {}
|
||||
public Entry (int bytes, int cp, int cp2) {
|
||||
this.bs = bytes;
|
||||
this.cp = cp;
|
||||
this.cp2 = cp2;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Parser {
|
||||
static final Pattern basic = Pattern.compile("(?:0x)?(\\p{XDigit}++)\\s++(?:0x)?(\\p{XDigit}++)?\\s*+.*");
|
||||
static final int gBS = 1;
|
||||
static final int gCP = 2;
|
||||
static final int gCP2 = 3;
|
||||
|
||||
BufferedReader reader;
|
||||
boolean closed;
|
||||
Matcher matcher;
|
||||
int gbs, gcp, gcp2;
|
||||
|
||||
public Parser (InputStream in, Pattern p, int gbs, int gcp, int gcp2)
|
||||
throws IOException
|
||||
{
|
||||
this.reader = new BufferedReader(new InputStreamReader(in));
|
||||
this.closed = false;
|
||||
this.matcher = p.matcher("");
|
||||
this.gbs = gbs;
|
||||
this.gcp = gcp;
|
||||
this.gcp2 = gcp2;
|
||||
}
|
||||
|
||||
public Parser (InputStream in, Pattern p) throws IOException {
|
||||
this(in, p, gBS, gCP, gCP2);
|
||||
}
|
||||
|
||||
public Parser (InputStream in) throws IOException {
|
||||
this(in, basic, gBS, gCP, gCP2);
|
||||
}
|
||||
|
||||
protected boolean isDirective(String line) {
|
||||
return line.startsWith("#");
|
||||
}
|
||||
|
||||
protected Entry parse(Matcher matcher, Entry mapping) {
|
||||
mapping.bs = Integer.parseInt(matcher.group(gbs), 16);
|
||||
mapping.cp = Integer.parseInt(matcher.group(gcp), 16);
|
||||
if (gcp2 <= matcher.groupCount() &&
|
||||
matcher.group(gcp2) != null)
|
||||
mapping.cp2 = Integer.parseInt(matcher.group(gcp2), 16);
|
||||
else
|
||||
mapping.cp2 = 0;
|
||||
return mapping;
|
||||
}
|
||||
|
||||
public Entry next() throws Exception {
|
||||
return next(new Entry());
|
||||
}
|
||||
|
||||
// returns null and closes the input stream if the eof has beenreached.
|
||||
public Entry next(Entry mapping) throws Exception {
|
||||
if (closed)
|
||||
return null;
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
if (isDirective(line))
|
||||
continue;
|
||||
matcher.reset(line);
|
||||
if (!matcher.lookingAt()) {
|
||||
//System.out.println("Missed: " + line);
|
||||
continue;
|
||||
}
|
||||
return parse(matcher, mapping);
|
||||
}
|
||||
reader.close();
|
||||
closed = true;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Output {
|
||||
private Formatter out;
|
||||
|
||||
public Output(Formatter out) {
|
||||
this.out = out;
|
||||
}
|
||||
|
||||
public void close() {
|
||||
out.close();
|
||||
}
|
||||
|
||||
private void toChar(String fmt, char c) {
|
||||
switch (c) {
|
||||
case '\b':
|
||||
out.format("\\b"); break;
|
||||
case '\t':
|
||||
out.format("\\t"); break;
|
||||
case '\n':
|
||||
out.format("\\n"); break;
|
||||
case '\f':
|
||||
out.format("\\f"); break;
|
||||
case '\r':
|
||||
out.format("\\r"); break;
|
||||
case '\"':
|
||||
out.format("\\\""); break;
|
||||
case '\'':
|
||||
out.format("\\'"); break;
|
||||
case '\\':
|
||||
out.format("\\\\"); break;
|
||||
default:
|
||||
out.format(fmt, c & 0xffff);
|
||||
}
|
||||
}
|
||||
|
||||
public void format(String fmt, Object ... args) {
|
||||
out.format(fmt, args);
|
||||
}
|
||||
|
||||
public void format(char[] cc, int off, int end, String closure) {
|
||||
while (off < end) {
|
||||
out.format(" \"");
|
||||
for (int j = 0; j < 8; j++) {
|
||||
if (off == end)
|
||||
break;
|
||||
toChar("\\u%04X", cc[off++]);
|
||||
}
|
||||
if (off == end)
|
||||
out.format("\" %s%n", closure);
|
||||
else
|
||||
out.format("\" + %n");
|
||||
}
|
||||
}
|
||||
|
||||
public void format(char[] cc, String closure) {
|
||||
format(cc, 0, cc.length, closure);
|
||||
}
|
||||
|
||||
public void format(char[] db, int b1, int b2Min, int b2Max,
|
||||
String closure)
|
||||
{
|
||||
char[] cc = new char[b2Max - b2Min + 1];
|
||||
int off = 0;
|
||||
for (int b2 = b2Min; b2 <= b2Max; b2++) {
|
||||
cc[off++] = db[(b1 << 8) | b2];
|
||||
}
|
||||
format(cc, 0, cc.length, closure);
|
||||
}
|
||||
|
||||
public void format(char[] date) {
|
||||
int off = 0;
|
||||
int end = date.length;
|
||||
while (off < end) {
|
||||
out.format(" ");
|
||||
for (int j = 0; j < 8 && off < end; j++) {
|
||||
toChar("'\\u%04X',", date[off++]);
|
||||
}
|
||||
out.format("%n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static String getCopyright(File f) throws IOException {
|
||||
Scanner s = new Scanner(f, "ISO-8859-1");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
while (s.hasNextLine()) {
|
||||
String ln = s.nextLine();
|
||||
sb.append(ln + "\n");
|
||||
// assume we have the copyright as the first comment
|
||||
if (ln.matches("^\\s\\*\\/$"))
|
||||
break;
|
||||
}
|
||||
s.close();
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@ -34,7 +34,7 @@ import java.nio.charset.CharsetDecoder;
|
||||
ExtendedCharsets class, because if we want to have a public HKSCS,
|
||||
it probably should be HKSCS_2001 not HKSCS.
|
||||
*/
|
||||
public class HKSCS extends sun.nio.cs.ext.HKSCS {
|
||||
public class HKSCS extends sun.nio.cs.ext.MS950_HKSCS_XP {
|
||||
public HKSCS () {
|
||||
super();
|
||||
}
|
||||
|
@ -26,26 +26,24 @@
|
||||
|
||||
package sun.io;
|
||||
|
||||
import sun.nio.cs.ext.DoubleByte;
|
||||
import sun.nio.cs.ext.Big5;
|
||||
|
||||
/**
|
||||
* Tables and data to convert Big5 to Unicode
|
||||
*
|
||||
* @author ConverterGenerator tool
|
||||
*/
|
||||
|
||||
public class ByteToCharBig5 extends ByteToCharDoubleByte {
|
||||
public class ByteToCharBig5 extends ByteToCharDBCS_ASCII {
|
||||
|
||||
private final static Big5 nioCoder = new Big5();
|
||||
private static DoubleByte.Decoder dec =
|
||||
(DoubleByte.Decoder)new Big5().newDecoder();
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "Big5";
|
||||
}
|
||||
|
||||
public ByteToCharBig5() {
|
||||
super.index1 = nioCoder.getDecoderIndex1();
|
||||
super.index2 = nioCoder.getDecoderIndex2();
|
||||
start = 0x40;
|
||||
end = 0xFE;
|
||||
super(dec);
|
||||
}
|
||||
}
|
||||
|
@ -25,15 +25,28 @@
|
||||
|
||||
package sun.io;
|
||||
|
||||
public class ByteToCharBig5_HKSCS extends ByteToCharHKSCS_2001 {
|
||||
ByteToCharBig5 bcBig5 = new ByteToCharBig5();
|
||||
import sun.nio.cs.ext.Big5_HKSCS;
|
||||
import sun.nio.cs.ext.HKSCS;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class ByteToCharBig5_HKSCS extends ByteToCharDBCS_ASCII {
|
||||
|
||||
protected static HKSCS.Decoder dec =
|
||||
(HKSCS.Decoder)new Big5_HKSCS().newDecoder();
|
||||
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "Big5_HKSCS";
|
||||
}
|
||||
|
||||
protected char getUnicode(int byte1, int byte2) {
|
||||
char c = super.getUnicode(byte1, byte2);
|
||||
return (c != REPLACE_CHAR) ? c : bcBig5.getUnicode(byte1, byte2);
|
||||
public ByteToCharBig5_HKSCS() {
|
||||
super(dec);
|
||||
}
|
||||
|
||||
protected char decodeDouble(int byte1, int byte2) {
|
||||
char c = dec.decodeDouble(byte1, byte2);
|
||||
if (c == UNMAPPABLE_DECODING)
|
||||
c = dec.decodeBig5(byte1, byte2);
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
@ -25,49 +25,19 @@
|
||||
|
||||
package sun.io;
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ByteToCharBig5_Solaris extends ByteToCharBig5 {
|
||||
public ByteToCharBig5_Solaris() {}
|
||||
import sun.nio.cs.ext.DoubleByte;
|
||||
import sun.nio.cs.ext.Big5_Solaris;
|
||||
|
||||
public class ByteToCharBig5_Solaris extends ByteToCharDBCS_ASCII {
|
||||
|
||||
private static DoubleByte.Decoder dec =
|
||||
(DoubleByte.Decoder)new Big5_Solaris().newDecoder();
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "Big5_Solaris";
|
||||
}
|
||||
|
||||
protected char getUnicode(int byte1, int byte2) {
|
||||
//
|
||||
char c = super.getUnicode(byte1, byte2);
|
||||
if (c == REPLACE_CHAR) {
|
||||
if (byte1 == 0xf9) {
|
||||
switch (byte2) {
|
||||
case 0xD6:
|
||||
c = (char)0x7881;
|
||||
break;
|
||||
case 0xD7:
|
||||
c = (char)0x92B9;
|
||||
break;
|
||||
case 0xD8:
|
||||
c = (char)0x88CF;
|
||||
break;
|
||||
case 0xD9:
|
||||
c = (char)0x58BB;
|
||||
break;
|
||||
case 0xDA:
|
||||
c = (char)0x6052;
|
||||
break;
|
||||
case 0xDB:
|
||||
c = (char)0x7CA7;
|
||||
break;
|
||||
case 0xDC:
|
||||
c = (char)0x5AFA;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return c;
|
||||
public ByteToCharBig5_Solaris() {
|
||||
super(dec);
|
||||
}
|
||||
}
|
||||
|
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright 2001-2007 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Sun designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Sun in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
package sun.io;
|
||||
|
||||
import sun.nio.cs.ext.HKSCS;
|
||||
|
||||
/**
|
||||
* Tables and data to convert HKSCS to Unicode
|
||||
*
|
||||
* @author ConverterGenerator tool
|
||||
*/
|
||||
|
||||
public class ByteToCharHKSCS extends ByteToCharDoubleByte {
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "HKSCS";
|
||||
}
|
||||
|
||||
public ByteToCharHKSCS() {
|
||||
super.index1 = HKSCS.getDecoderIndex1();
|
||||
super.index2= HKSCS.getDecoderIndex2();
|
||||
start = 0x40;
|
||||
end = 0xFE;
|
||||
}
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Sun designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Sun in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
package sun.io;
|
||||
|
||||
import sun.nio.cs.ext.HKSCS_2001;
|
||||
|
||||
/**
|
||||
* Tables and data to convert HKSCS (2001 revision) to Unicode
|
||||
*
|
||||
* @author ConverterGenerator tool
|
||||
*/
|
||||
|
||||
public class ByteToCharHKSCS_2001 extends ByteToCharDoubleByte {
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "HKSCS_2001";
|
||||
}
|
||||
|
||||
public ByteToCharHKSCS_2001() {
|
||||
super.index1 = HKSCS_2001.getDecoderIndex1();
|
||||
super.index2= HKSCS_2001.getDecoderIndex2();
|
||||
start = 0x40;
|
||||
end = 0xFE;
|
||||
}
|
||||
}
|
@ -25,15 +25,27 @@
|
||||
|
||||
package sun.io;
|
||||
|
||||
public class ByteToCharMS950_HKSCS extends ByteToCharHKSCS {
|
||||
ByteToCharMS950 bcMS950 = new ByteToCharMS950();
|
||||
import sun.nio.cs.ext.HKSCS;
|
||||
import sun.nio.cs.ext.MS950_HKSCS;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class ByteToCharMS950_HKSCS extends ByteToCharDBCS_ASCII {
|
||||
|
||||
private static HKSCS.Decoder dec =
|
||||
(HKSCS.Decoder)new MS950_HKSCS().newDecoder();
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "MS950_HKSCS";
|
||||
}
|
||||
|
||||
protected char getUnicode(int byte1, int byte2) {
|
||||
char c = super.getUnicode(byte1, byte2);
|
||||
return (c != REPLACE_CHAR) ? c : bcMS950.decodeDouble(byte1, byte2);
|
||||
public ByteToCharMS950_HKSCS() {
|
||||
super(dec);
|
||||
}
|
||||
|
||||
protected char decodeDouble(int byte1, int byte2) {
|
||||
char c = dec.decodeDouble(byte1, byte2);
|
||||
if (c == UNMAPPABLE_DECODING)
|
||||
c = dec.decodeBig5(byte1, byte2);
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
@ -26,24 +26,24 @@
|
||||
|
||||
package sun.io;
|
||||
|
||||
import sun.nio.cs.ext.DoubleByte;
|
||||
import sun.nio.cs.ext.Big5;
|
||||
|
||||
/**
|
||||
* Tables and data to convert Unicode to Big5
|
||||
*
|
||||
* @author ConverterGenerator tool
|
||||
*/
|
||||
|
||||
public class CharToByteBig5 extends CharToByteDoubleByte {
|
||||
public class CharToByteBig5 extends CharToByteDBCS_ASCII {
|
||||
|
||||
private static final Big5 nioCoder = new Big5();
|
||||
private static DoubleByte.Encoder enc =
|
||||
(DoubleByte.Encoder)new Big5().newEncoder();
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "Big5";
|
||||
}
|
||||
|
||||
public CharToByteBig5() {
|
||||
super.index1 = nioCoder.getEncoderIndex1();
|
||||
super.index2 = nioCoder.getEncoderIndex2();
|
||||
super(enc);
|
||||
}
|
||||
}
|
||||
|
@ -25,15 +25,18 @@
|
||||
|
||||
package sun.io;
|
||||
|
||||
public class CharToByteBig5_HKSCS extends CharToByteHKSCS_2001 {
|
||||
CharToByteBig5 cbBig5 = new CharToByteBig5();
|
||||
import sun.nio.cs.ext.DoubleByte;
|
||||
import sun.nio.cs.ext.Big5_HKSCS;
|
||||
|
||||
public class CharToByteBig5_HKSCS extends CharToByteDBCS_ASCII {
|
||||
private static DoubleByte.Encoder enc =
|
||||
(DoubleByte.Encoder)new Big5_HKSCS().newEncoder();
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "Big5_HKSCS";
|
||||
}
|
||||
|
||||
protected int getNative(char ch) {
|
||||
int r = super.getNative(ch);
|
||||
return (r != 0) ? r : cbBig5.getNative(ch);
|
||||
public CharToByteBig5_HKSCS() {
|
||||
super(enc);
|
||||
}
|
||||
}
|
||||
|
@ -23,48 +23,21 @@
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
|
||||
package sun.io;
|
||||
|
||||
/**
|
||||
*/
|
||||
import sun.nio.cs.ext.DoubleByte;
|
||||
import sun.nio.cs.ext.Big5_Solaris;
|
||||
|
||||
public class CharToByteBig5_Solaris extends CharToByteBig5 {
|
||||
public class CharToByteBig5_Solaris extends CharToByteDBCS_ASCII {
|
||||
|
||||
private static DoubleByte.Encoder enc =
|
||||
(DoubleByte.Encoder)new Big5_Solaris().newEncoder();
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "Big5_Solaris";
|
||||
}
|
||||
|
||||
protected int getNative(char ch) {
|
||||
int nativeVal;
|
||||
|
||||
if ((nativeVal = super.getNative(ch)) != 0) {
|
||||
return nativeVal;
|
||||
}
|
||||
|
||||
switch (ch) {
|
||||
case 0x7881:
|
||||
nativeVal = 0xF9D6;
|
||||
break;
|
||||
case 0x92B9:
|
||||
nativeVal = 0xF9D7;
|
||||
break;
|
||||
case 0x88CF:
|
||||
nativeVal = 0xF9D8;
|
||||
break;
|
||||
case 0x58BB:
|
||||
nativeVal = 0xF9D9;
|
||||
break;
|
||||
case 0x6052:
|
||||
nativeVal = 0xF9DA;
|
||||
break;
|
||||
case 0x7CA7:
|
||||
nativeVal = 0xF9DB;
|
||||
break;
|
||||
case 0x5AFA:
|
||||
nativeVal = 0xF9DC;
|
||||
break;
|
||||
}
|
||||
return nativeVal;
|
||||
public CharToByteBig5_Solaris() {
|
||||
super(enc);
|
||||
}
|
||||
}
|
||||
|
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright 2001-2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Sun designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Sun in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sun.io;
|
||||
|
||||
import sun.nio.cs.ext.HKSCS;
|
||||
|
||||
/**
|
||||
* Tables and data to convert Unicode to HKSCS
|
||||
*
|
||||
* @author ConverterGenerator tool
|
||||
*/
|
||||
|
||||
public class CharToByteHKSCS extends CharToByteDoubleByte {
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "HKSCS";
|
||||
}
|
||||
|
||||
public CharToByteHKSCS() {
|
||||
super.index1 = HKSCS.getEncoderIndex1();
|
||||
super.index2 = HKSCS.getEncoderIndex2();
|
||||
}
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Sun designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Sun in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sun.io;
|
||||
|
||||
import sun.nio.cs.ext.HKSCS_2001;
|
||||
|
||||
/**
|
||||
* Tables and data to convert Unicode to HKSCS (2001 revision)
|
||||
*
|
||||
* @author ConverterGenerator tool
|
||||
*/
|
||||
|
||||
public class CharToByteHKSCS_2001 extends CharToByteDoubleByte {
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "HKSCS_2001";
|
||||
}
|
||||
|
||||
public CharToByteHKSCS_2001() {
|
||||
super.index1 = HKSCS_2001.getEncoderIndex1();
|
||||
super.index2 = HKSCS_2001.getEncoderIndex2();
|
||||
}
|
||||
}
|
@ -25,15 +25,19 @@
|
||||
|
||||
package sun.io;
|
||||
|
||||
public class CharToByteMS950_HKSCS extends CharToByteHKSCS {
|
||||
CharToByteMS950 cbMS950 = new CharToByteMS950();
|
||||
import sun.nio.cs.ext.DoubleByte;
|
||||
import sun.nio.cs.ext.MS950_HKSCS;
|
||||
|
||||
public class CharToByteMS950_HKSCS extends CharToByteDBCS_ASCII {
|
||||
|
||||
private static DoubleByte.Encoder enc =
|
||||
(DoubleByte.Encoder)new MS950_HKSCS().newEncoder();
|
||||
|
||||
public String getCharacterEncoding() {
|
||||
return "MS950_HKSCS";
|
||||
}
|
||||
|
||||
protected int getNative(char ch) {
|
||||
int r = super.getNative(ch);
|
||||
return (r != 0) ? r : cbMS950.encodeChar(ch);
|
||||
public CharToByteMS950_HKSCS() {
|
||||
super(enc);
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2004 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -23,15 +23,13 @@
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class Big5_HKSCS extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
@ -57,33 +55,35 @@ public class Big5_HKSCS extends Charset implements HistoricallyNamedCharset
|
||||
return new Encoder(this);
|
||||
}
|
||||
|
||||
private static class Decoder extends HKSCS_2001.Decoder {
|
||||
static class Decoder extends HKSCS.Decoder {
|
||||
private static DoubleByte.Decoder big5 =
|
||||
(DoubleByte.Decoder)new Big5().newDecoder();
|
||||
|
||||
Big5.Decoder big5Dec;
|
||||
|
||||
protected char decodeDouble(int byte1, int byte2) {
|
||||
char c = super.decodeDouble(byte1, byte2);
|
||||
return (c != REPLACE_CHAR) ? c : big5Dec.decodeDouble(byte1, byte2);
|
||||
private static char[][] b2cBmp = new char[0x100][];
|
||||
private static char[][] b2cSupp = new char[0x100][];
|
||||
static {
|
||||
initb2c(b2cBmp, HKSCSMapping.b2cBmpStr);
|
||||
initb2c(b2cSupp, HKSCSMapping.b2cSuppStr);
|
||||
}
|
||||
|
||||
private Decoder(Charset cs) {
|
||||
super(cs);
|
||||
big5Dec = new Big5.Decoder(cs);
|
||||
super(cs, big5, b2cBmp, b2cSupp);
|
||||
}
|
||||
}
|
||||
|
||||
private static class Encoder extends HKSCS_2001.Encoder {
|
||||
static class Encoder extends HKSCS.Encoder {
|
||||
private static DoubleByte.Encoder big5 =
|
||||
(DoubleByte.Encoder)new Big5().newEncoder();
|
||||
|
||||
private Big5.Encoder big5Enc;
|
||||
|
||||
protected int encodeDouble(char ch) {
|
||||
int r = super.encodeDouble(ch);
|
||||
return (r != 0) ? r : big5Enc.encodeDouble(ch);
|
||||
static char[][] c2bBmp = new char[0x100][];
|
||||
static char[][] c2bSupp = new char[0x100][];
|
||||
static {
|
||||
initc2b(c2bBmp, HKSCSMapping.b2cBmpStr, HKSCSMapping.pua);
|
||||
initc2b(c2bSupp, HKSCSMapping.b2cSuppStr, null);
|
||||
}
|
||||
|
||||
private Encoder(Charset cs) {
|
||||
super(cs);
|
||||
big5Enc = new Big5.Encoder(cs);
|
||||
super(cs, big5, c2bBmp, c2bSupp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
85
jdk/src/share/classes/sun/nio/cs/ext/Big5_HKSCS_2001.java
Normal file
85
jdk/src/share/classes/sun/nio/cs/ext/Big5_HKSCS_2001.java
Normal file
@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright 2002-2004 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Sun designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Sun in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
|
||||
public class Big5_HKSCS_2001 extends Charset
|
||||
{
|
||||
public Big5_HKSCS_2001() {
|
||||
super("x-Big5-HKSCS-2001", ExtendedCharsets.aliasesFor("x-Big5-HKSCS-2001"));
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return ((cs.name().equals("US-ASCII"))
|
||||
|| (cs instanceof Big5)
|
||||
|| (cs instanceof Big5_HKSCS_2001));
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new Decoder(this);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new Encoder(this);
|
||||
}
|
||||
|
||||
private static class Decoder extends HKSCS.Decoder {
|
||||
private static DoubleByte.Decoder big5 =
|
||||
(DoubleByte.Decoder)new Big5().newDecoder();
|
||||
|
||||
private static char[][] b2cBmp = new char[0x100][];
|
||||
private static char[][] b2cSupp = new char[0x100][];
|
||||
static {
|
||||
initb2c(b2cBmp, HKSCS2001Mapping.b2cBmpStr);
|
||||
initb2c(b2cSupp, HKSCS2001Mapping.b2cSuppStr);
|
||||
}
|
||||
|
||||
private Decoder(Charset cs) {
|
||||
super(cs, big5, b2cBmp, b2cSupp);
|
||||
}
|
||||
}
|
||||
|
||||
private static class Encoder extends HKSCS.Encoder {
|
||||
private static DoubleByte.Encoder big5 =
|
||||
(DoubleByte.Encoder)new Big5().newEncoder();
|
||||
|
||||
static char[][] c2bBmp = new char[0x100][];
|
||||
static char[][] c2bSupp = new char[0x100][];
|
||||
static {
|
||||
initc2b(c2bBmp, HKSCS2001Mapping.b2cBmpStr,
|
||||
HKSCS2001Mapping.pua);
|
||||
initc2b(c2bSupp, HKSCS2001Mapping.b2cSuppStr, null);
|
||||
}
|
||||
|
||||
private Encoder(Charset cs) {
|
||||
super(cs, big5, c2bBmp, c2bSupp);
|
||||
}
|
||||
}
|
||||
}
|
@ -23,15 +23,14 @@
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import java.util.Arrays;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class Big5_Solaris extends Charset implements HistoricallyNamedCharset
|
||||
{
|
||||
@ -50,90 +49,78 @@ public class Big5_Solaris extends Charset implements HistoricallyNamedCharset
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new Decoder(this);
|
||||
initb2c();
|
||||
return new DoubleByte.Decoder(this, b2c, b2cSB, 0x40, 0xfe);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new Encoder(this);
|
||||
initc2b();
|
||||
return new DoubleByte.Encoder(this, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
private static class Decoder extends Big5.Decoder {
|
||||
|
||||
protected char decodeDouble(int byte1, int byte2) {
|
||||
char c = super.decodeDouble(byte1, byte2);
|
||||
static char[][] b2c;
|
||||
static char[] b2cSB;
|
||||
private static volatile boolean b2cInitialized = false;
|
||||
|
||||
static void initb2c() {
|
||||
if (b2cInitialized)
|
||||
return;
|
||||
synchronized (Big5_Solaris.class) {
|
||||
if (b2cInitialized)
|
||||
return;
|
||||
Big5.initb2c();
|
||||
b2c = Big5.b2c.clone();
|
||||
// Big5 Solaris implementation has 7 additional mappings
|
||||
|
||||
if (c == REPLACE_CHAR) {
|
||||
if (byte1 == 0xf9) {
|
||||
switch (byte2) {
|
||||
case 0xD6:
|
||||
c = (char)0x7881;
|
||||
break;
|
||||
case 0xD7:
|
||||
c = (char)0x92B9;
|
||||
break;
|
||||
case 0xD8:
|
||||
c = (char)0x88CF;
|
||||
break;
|
||||
case 0xD9:
|
||||
c = (char)0x58BB;
|
||||
break;
|
||||
case 0xDA:
|
||||
c = (char)0x6052;
|
||||
break;
|
||||
case 0xDB:
|
||||
c = (char)0x7CA7;
|
||||
break;
|
||||
case 0xDC:
|
||||
c = (char)0x5AFA;
|
||||
break;
|
||||
}
|
||||
}
|
||||
int[] sol = new int[] {
|
||||
0xF9D6, 0x7881,
|
||||
0xF9D7, 0x92B9,
|
||||
0xF9D8, 0x88CF,
|
||||
0xF9D9, 0x58BB,
|
||||
0xF9DA, 0x6052,
|
||||
0xF9DB, 0x7CA7,
|
||||
0xF9DC, 0x5AFA };
|
||||
if (b2c[0xf9] == DoubleByte.B2C_UNMAPPABLE) {
|
||||
b2c[0xf9] = new char[0xfe - 0x40 + 1];
|
||||
Arrays.fill(b2c[0xf9], UNMAPPABLE_DECODING);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
private Decoder(Charset cs) {
|
||||
super(cs);
|
||||
for (int i = 0; i < sol.length;) {
|
||||
b2c[0xf9][sol[i++] & 0xff - 0x40] = (char)sol[i++];
|
||||
}
|
||||
b2cSB = Big5.b2cSB;
|
||||
b2cInitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
private static class Encoder extends Big5.Encoder {
|
||||
static char[] c2b;
|
||||
static char[] c2bIndex;
|
||||
private static volatile boolean c2bInitialized = false;
|
||||
|
||||
protected int encodeDouble(char ch) {
|
||||
int r = super.encodeDouble(ch);
|
||||
static void initc2b() {
|
||||
if (c2bInitialized)
|
||||
return;
|
||||
synchronized (Big5_Solaris.class) {
|
||||
if (c2bInitialized)
|
||||
return;
|
||||
Big5.initc2b();
|
||||
c2b = Big5.c2b.clone();
|
||||
c2bIndex = Big5.c2bIndex.clone();
|
||||
int[] sol = new int[] {
|
||||
0x7881, 0xF9D6,
|
||||
0x92B9, 0xF9D7,
|
||||
0x88CF, 0xF9D8,
|
||||
0x58BB, 0xF9D9,
|
||||
0x6052, 0xF9DA,
|
||||
0x7CA7, 0xF9DB,
|
||||
0x5AFA, 0xF9DC };
|
||||
|
||||
if (r == 0) {
|
||||
switch (ch) {
|
||||
case 0x7881:
|
||||
r = 0xF9D6;
|
||||
break;
|
||||
case 0x92B9:
|
||||
r = 0xF9D7;
|
||||
break;
|
||||
case 0x88CF:
|
||||
r = 0xF9D8;
|
||||
break;
|
||||
case 0x58BB:
|
||||
r = 0xF9D9;
|
||||
break;
|
||||
case 0x6052:
|
||||
r = 0xF9DA;
|
||||
break;
|
||||
case 0x7CA7:
|
||||
r = 0xF9DB;
|
||||
break;
|
||||
case 0x5AFA:
|
||||
r = 0xF9DC;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
private Encoder(Charset cs) {
|
||||
super(cs);
|
||||
for (int i = 0; i < sol.length;) {
|
||||
int c = sol[i++];
|
||||
// no need to check c2bIndex[c >>8], we know it points
|
||||
// to the appropriate place.
|
||||
c2b[c2bIndex[c >> 8] + (c & 0xff)] = (char)sol[i++];
|
||||
}
|
||||
c2bInitialized = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -55,10 +55,15 @@ public class ExtendedCharsets
|
||||
"csBig5"
|
||||
});
|
||||
|
||||
charset("x-MS950-HKSCS-XP", "MS950_HKSCS_XP",
|
||||
new String[] {
|
||||
"MS950_HKSCS_XP" // JDK historical;
|
||||
});
|
||||
|
||||
charset("x-MS950-HKSCS", "MS950_HKSCS",
|
||||
new String[] {
|
||||
// IANA aliases
|
||||
"MS950_HKSCS" // JDK historical;
|
||||
"MS950_HKSCS" // JDK historical;
|
||||
});
|
||||
|
||||
charset("x-windows-950", "MS950",
|
||||
@ -86,8 +91,16 @@ public class ExtendedCharsets
|
||||
"Big5_HKSCS", // JDK historical
|
||||
"big5hk",
|
||||
"big5-hkscs",
|
||||
"big5hkscs" // Linux alias
|
||||
});
|
||||
|
||||
charset("x-Big5-HKSCS-2001", "Big5_HKSCS_2001",
|
||||
new String[] {
|
||||
"Big5_HKSCS_2001",
|
||||
"big5hk-2001",
|
||||
"big5-hkscs-2001",
|
||||
"big5-hkscs:unicode3.0",
|
||||
"big5hkscs" // Linux alias
|
||||
"big5hkscs-2001",
|
||||
});
|
||||
|
||||
charset("x-Big5-Solaris", "Big5_Solaris",
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2004 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -55,47 +55,35 @@ public class MS950_HKSCS extends Charset implements HistoricallyNamedCharset
|
||||
return new Encoder(this);
|
||||
}
|
||||
|
||||
private static class Decoder extends HKSCS.Decoder {
|
||||
|
||||
private static DoubleByte.Decoder ms950Dec =
|
||||
static class Decoder extends HKSCS.Decoder {
|
||||
private static DoubleByte.Decoder ms950 =
|
||||
(DoubleByte.Decoder)new MS950().newDecoder();
|
||||
|
||||
/*
|
||||
* Note current decoder decodes 0x8BC2 --> U+F53A
|
||||
* ie. maps to Unicode PUA.
|
||||
* Unaccounted discrepancy between this mapping
|
||||
* inferred from MS950/windows-950 and the published
|
||||
* MS HKSCS mappings which maps 0x8BC2 --> U+5C22
|
||||
* a character defined with the Unified CJK block
|
||||
*/
|
||||
|
||||
protected char decodeDouble(int byte1, int byte2) {
|
||||
char c = super.decodeDouble(byte1, byte2);
|
||||
return (c != UNMAPPABLE_DECODING) ? c : ms950Dec.decodeDouble(byte1, byte2);
|
||||
private static char[][] b2cBmp = new char[0x100][];
|
||||
private static char[][] b2cSupp = new char[0x100][];
|
||||
static {
|
||||
initb2c(b2cBmp, HKSCSMapping.b2cBmpStr);
|
||||
initb2c(b2cSupp, HKSCSMapping.b2cSuppStr);
|
||||
}
|
||||
|
||||
private Decoder(Charset cs) {
|
||||
super(cs);
|
||||
super(cs, ms950, b2cBmp, b2cSupp);
|
||||
}
|
||||
}
|
||||
|
||||
private static class Encoder extends HKSCS.Encoder {
|
||||
|
||||
private static DoubleByte.Encoder ms950Enc =
|
||||
private static DoubleByte.Encoder ms950 =
|
||||
(DoubleByte.Encoder)new MS950().newEncoder();
|
||||
|
||||
/*
|
||||
* Note current encoder encodes U+F53A --> 0x8BC2
|
||||
* Published MS HKSCS mappings show
|
||||
* U+5C22 <--> 0x8BC2
|
||||
*/
|
||||
protected int encodeDouble(char ch) {
|
||||
int r = super.encodeDouble(ch);
|
||||
return (r != UNMAPPABLE_ENCODING) ? r : ms950Enc.encodeChar(ch);
|
||||
static char[][] c2bBmp = new char[0x100][];
|
||||
static char[][] c2bSupp = new char[0x100][];
|
||||
static {
|
||||
initc2b(c2bBmp, HKSCSMapping.b2cBmpStr, HKSCSMapping.pua);
|
||||
initc2b(c2bSupp, HKSCSMapping.b2cSuppStr, null);
|
||||
}
|
||||
|
||||
private Encoder(Charset cs) {
|
||||
super(cs);
|
||||
super(cs, ms950, c2bBmp, c2bSupp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
102
jdk/src/share/classes/sun/nio/cs/ext/MS950_HKSCS_XP.java
Normal file
102
jdk/src/share/classes/sun/nio/cs/ext/MS950_HKSCS_XP.java
Normal file
@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright 2002-2004 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Sun designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Sun in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class MS950_HKSCS_XP extends Charset
|
||||
{
|
||||
public MS950_HKSCS_XP() {
|
||||
super("x-MS950-HKSCS-XP", ExtendedCharsets.aliasesFor("x-MS950-HKSCS-XP"));
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
return ((cs.name().equals("US-ASCII"))
|
||||
|| (cs instanceof MS950)
|
||||
|| (cs instanceof MS950_HKSCS_XP));
|
||||
}
|
||||
|
||||
public CharsetDecoder newDecoder() {
|
||||
return new Decoder(this);
|
||||
}
|
||||
|
||||
public CharsetEncoder newEncoder() {
|
||||
return new Encoder(this);
|
||||
}
|
||||
|
||||
static class Decoder extends HKSCS.Decoder {
|
||||
private static DoubleByte.Decoder ms950 =
|
||||
(DoubleByte.Decoder)new MS950().newDecoder();
|
||||
|
||||
/*
|
||||
* Note current decoder decodes 0x8BC2 --> U+F53A
|
||||
* ie. maps to Unicode PUA.
|
||||
* Unaccounted discrepancy between this mapping
|
||||
* inferred from MS950/windows-950 and the published
|
||||
* MS HKSCS mappings which maps 0x8BC2 --> U+5C22
|
||||
* a character defined with the Unified CJK block
|
||||
*/
|
||||
private static char[][] b2cBmp = new char[0x100][];
|
||||
static {
|
||||
initb2c(b2cBmp, HKSCS_XPMapping.b2cBmpStr);
|
||||
}
|
||||
|
||||
public char decodeDoubleEx(int b1, int b2) {
|
||||
return UNMAPPABLE_DECODING;
|
||||
}
|
||||
|
||||
private Decoder(Charset cs) {
|
||||
super(cs, ms950, b2cBmp, null);
|
||||
}
|
||||
}
|
||||
|
||||
private static class Encoder extends HKSCS.Encoder {
|
||||
private static DoubleByte.Encoder ms950 =
|
||||
(DoubleByte.Encoder)new MS950().newEncoder();
|
||||
|
||||
/*
|
||||
* Note current encoder encodes U+F53A --> 0x8BC2
|
||||
* Published MS HKSCS mappings show
|
||||
* U+5C22 <--> 0x8BC2
|
||||
*/
|
||||
static char[][] c2bBmp = new char[0x100][];
|
||||
static {
|
||||
initc2b(c2bBmp, HKSCS_XPMapping.b2cBmpStr, null);
|
||||
}
|
||||
|
||||
public int encodeSupp(int cp) {
|
||||
return UNMAPPABLE_ENCODING;
|
||||
}
|
||||
|
||||
private Encoder(Charset cs) {
|
||||
super(cs, ms950, c2bBmp, null);
|
||||
}
|
||||
}
|
||||
}
|
@ -352,7 +352,7 @@ sequence.allfonts=latin-1,dingbats,symbol
|
||||
|
||||
sequence.allfonts.Big5=latin-1,chinese-big5,dingbats,symbol
|
||||
|
||||
sequence.allfonts.Big5-HKSCS=latin-1,chinese-big5,chinese-hkscs,dingbats,symbol
|
||||
sequence.allfonts.Big5-HKSCS-2001=latin-1,chinese-big5,chinese-hkscs,dingbats,symbol
|
||||
|
||||
sequence.allfonts.windows-1251=cyrillic-cp1251,latin-1,dingbats,symbol
|
||||
|
||||
|
@ -337,22 +337,24 @@ GetJavaProperties(JNIEnv *env)
|
||||
std_encoding = "EUC-JP-LINUX";
|
||||
}
|
||||
#else
|
||||
/* For Solaris use customized vendor defined character
|
||||
* customized EUC-JP converter
|
||||
*/
|
||||
if (strcmp(p,"eucJP") == 0) {
|
||||
/* For Solaris use customized vendor defined character
|
||||
* customized EUC-JP converter
|
||||
*/
|
||||
std_encoding = "eucJP-open";
|
||||
}
|
||||
#endif
|
||||
#ifndef __linux__
|
||||
/*
|
||||
* Remap the encoding string to Big5_Solaris which augments
|
||||
* the default converter for Solaris Big5 locales to include
|
||||
* seven additional ideographic characters beyond those included
|
||||
* in the Java "Big5" converter.
|
||||
*/
|
||||
if (strcmp(p, "Big5") == 0) {
|
||||
std_encoding = "Big5_Solaris";
|
||||
} else if (strcmp(p, "Big5") == 0 || strcmp(p, "BIG5") == 0) {
|
||||
/*
|
||||
* Remap the encoding string to Big5_Solaris which augments
|
||||
* the default converter for Solaris Big5 locales to include
|
||||
* seven additional ideographic characters beyond those included
|
||||
* in the Java "Big5" converter.
|
||||
*/
|
||||
std_encoding = "Big5_Solaris";
|
||||
} else if (strcmp(p, "Big5-HKSCS") == 0) {
|
||||
/*
|
||||
* Solaris uses HKSCS2001
|
||||
*/
|
||||
std_encoding = "Big5-HKSCS-2001";
|
||||
}
|
||||
#endif
|
||||
sprops.encoding = std_encoding;
|
||||
|
@ -210,6 +210,12 @@ sequence.monospaced.x-MS950-HKSCS=chinese-ms950,alphabetic,chinese-hkscs,dingbat
|
||||
sequence.dialog.x-MS950-HKSCS=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol,chinese-ms950-extb
|
||||
sequence.dialoginput.x-MS950-HKSCS=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol,chinese-ms950-extb
|
||||
|
||||
sequence.serif.x-MS950-HKSCS-XP=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol,chinese-ms950-extb
|
||||
sequence.sansserif.x-MS950-HKSCS-XP=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol,chinese-ms950-extb
|
||||
sequence.monospaced.x-MS950-HKSCS-XP=chinese-ms950,alphabetic,chinese-hkscs,dingbats,symbol,chinese-ms950-extb
|
||||
sequence.dialog.x-MS950-HKSCS-XP=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol,chinese-ms950-extb
|
||||
sequence.dialoginput.x-MS950-HKSCS-XP=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol,chinese-ms950-extb
|
||||
|
||||
sequence.allfonts.UTF-8.hi=alphabetic/1252,devanagari,dingbats,symbol
|
||||
sequence.allfonts.UTF-8.ja=alphabetic,japanese,devanagari,dingbats,symbol
|
||||
|
||||
|
@ -451,7 +451,7 @@ getEncodingInternal(int index)
|
||||
{
|
||||
char * ret = encoding_names[langIDMap[index].encoding];
|
||||
|
||||
//Traditional Chinese Windows should use MS950_HKSCS as the
|
||||
//Traditional Chinese Windows should use MS950_HKSCS_XP as the
|
||||
//default encoding, if HKSCS patch has been installed.
|
||||
// "old" MS950 0xfa41 -> u+e001
|
||||
// "new" MS950 0xfa41 -> u+92db
|
||||
@ -460,7 +460,7 @@ getEncodingInternal(int index)
|
||||
WCHAR unicodeChar;
|
||||
MultiByteToWideChar(CP_ACP, 0, mbChar, 2, &unicodeChar, 1);
|
||||
if (unicodeChar == 0x92db) {
|
||||
ret = "MS950_HKSCS";
|
||||
ret = "MS950_HKSCS_XP";
|
||||
}
|
||||
} else {
|
||||
//SimpChinese Windows should use GB18030 as the default
|
||||
@ -650,6 +650,8 @@ GetJavaProperties(JNIEnv* env)
|
||||
{
|
||||
static java_props_t sprops = {0};
|
||||
|
||||
OSVERSIONINFOEX ver;
|
||||
|
||||
if (sprops.user_dir) {
|
||||
return &sprops;
|
||||
}
|
||||
@ -676,10 +678,10 @@ GetJavaProperties(JNIEnv* env)
|
||||
sprops.font_dir = (path != 0) ? strdup(path) : NULL;
|
||||
}
|
||||
|
||||
|
||||
/* OS properties */
|
||||
{
|
||||
char buf[100];
|
||||
OSVERSIONINFOEX ver;
|
||||
SYSTEM_INFO si;
|
||||
PGNSI pGNSI;
|
||||
|
||||
@ -932,6 +934,17 @@ GetJavaProperties(JNIEnv* env)
|
||||
} else {
|
||||
sprops.sun_jnu_encoding = getEncodingInternal(index);
|
||||
}
|
||||
if (langID == 0x0c04 && ver.dwMajorVersion == 6) {
|
||||
// MS claims "Vista has built-in support for HKSCS-2004.
|
||||
// All of the HKSCS-2004 characters have Unicode 4.1.
|
||||
// PUA code point assignments". But what it really means
|
||||
// is that the HKSCS-2004 is ONLY supported in Unicode.
|
||||
// Test indicates the MS950 in its zh_HK locale is a
|
||||
// "regular" MS950 which does not handle HKSCS-2004 at
|
||||
// all. Set encoding to MS950_HKSCS.
|
||||
sprops.encoding = "MS950_HKSCS";
|
||||
sprops.sun_jnu_encoding = "MS950_HKSCS";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 4777124 6920545
|
||||
* @bug 4777124 6920545 6911753
|
||||
* @summary Verify that all Charset subclasses are available through the API
|
||||
*/
|
||||
|
||||
@ -65,8 +65,6 @@ public class NIOCharsetAvailabilityTest {
|
||||
// remove the known pseudo-charsets that serve only to implement
|
||||
// other charsets, but shouldn't be known to the public
|
||||
charsets.remove(Class.forName("sun.nio.cs.Unicode"));
|
||||
charsets.remove(Class.forName("sun.nio.cs.ext.HKSCS"));
|
||||
charsets.remove(Class.forName("sun.nio.cs.ext.HKSCS_2001"));
|
||||
charsets.remove(Class.forName("sun.nio.cs.ext.ISO2022"));
|
||||
charsets.remove(Class.forName("sun.nio.cs.ext.ISO2022_CN_GB"));
|
||||
charsets.remove(Class.forName("sun.nio.cs.ext.ISO2022_CN_CNS"));
|
||||
|
@ -22,7 +22,7 @@
|
||||
*/
|
||||
|
||||
/* @test
|
||||
* @bug 4473201 4696726 4652234 4482298 4784385 4966197 4267354 5015668
|
||||
* @bug 4473201 4696726 4652234 4482298 4784385 4966197 4267354 5015668 6911753
|
||||
* @summary Check that registered charsets are actually registered
|
||||
*/
|
||||
|
||||
@ -240,7 +240,6 @@ public class RegisteredCharsets {
|
||||
"Big5_HKSCS",
|
||||
"big5hk",
|
||||
"big5-hkscs",
|
||||
"big5-hkscs:unicode3.0",
|
||||
"big5hkscs"
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user