author | ihse |
Thu, 14 Nov 2013 11:19:32 +0100 | |
changeset 21805 | c7d7946239de |
parent 5506 | jdk/make/tools/src/build/tools/charsetmapping/HKSCS.java@202f599c92aa |
child 23010 | 6dadb192ad81 |
permissions | -rw-r--r-- |
5167
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
1 |
/* |
5506 | 2 |
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. |
5167
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
4 |
* |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
5167
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
5167
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
10 |
* |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
15 |
* accompanied this code). |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
16 |
* |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
20 |
* |
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
5167
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
24 |
*/ |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
25 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
26 |
package build.tools.charsetmapping; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
27 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
28 |
import java.io.*; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
29 |
import java.util.Arrays; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
30 |
import java.util.ArrayList; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
31 |
import java.util.Scanner; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
32 |
import java.util.Formatter; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
33 |
import java.util.regex.*; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
34 |
import java.nio.charset.*; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
35 |
import static build.tools.charsetmapping.Utils.*; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
36 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
37 |
public class HKSCS { |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
38 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
39 |
// HKSCS2001.map has the third column for "UnicodeAlternate", which |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
40 |
// is for c->b non-roundtrip mapping. |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
41 |
// For HKSCS2008, those non-roundtrip mappings are in .nr file |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
42 |
private static Pattern hkscs = |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
43 |
Pattern.compile("(?:0x)?+(\\p{XDigit}++)\\s++(?:0x|U\\+)?+(\\p{XDigit}++)?\\s*+(?:0x|U\\+)?(\\p{XDigit}++)?\\s*+.*"); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
44 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
45 |
static void genClass(String args[]) throws Exception { |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
46 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
47 |
// hkscs2008 |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
48 |
genClass0(new FileInputStream(new File(args[0], "HKSCS2008.map")), |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
49 |
new FileInputStream(new File(args[0], "HKSCS2008.c2b")), |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
50 |
new PrintStream(new File(args[1], "HKSCSMapping.java"), |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
51 |
"ISO-8859-1"), |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
52 |
"HKSCSMapping", |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
53 |
getCopyright(new File(args[3]))); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
54 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
55 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
56 |
// xp2001 |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
57 |
genClass0(new FileInputStream(new File(args[0], "HKSCS_XP.map")), |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
58 |
null, |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
59 |
new PrintStream(new File(args[1], "HKSCS_XPMapping.java"), |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
60 |
"ISO-8859-1"), |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
61 |
"HKSCS_XPMapping", |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
62 |
getCopyright(new File(args[3]))); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
63 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
64 |
// hkscs2001 |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
65 |
genClass0(new FileInputStream(new File(args[0], "HKSCS2001.map")), |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
66 |
new FileInputStream(new File(args[0], "HKSCS2001.c2b")), |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
67 |
new PrintStream(new File(args[1], "HKSCS2001Mapping.java"), |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
68 |
"ISO-8859-1"), |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
69 |
"HKSCS2001Mapping", |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
70 |
getCopyright(new File(args[3]))); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
71 |
} |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
72 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
73 |
static void genClass0(InputStream isB2C, |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
74 |
InputStream isC2B, |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
75 |
PrintStream ps, |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
76 |
String clzName, |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
77 |
String copyright) |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
78 |
throws Exception |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
79 |
{ |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
80 |
// ranges of byte1 and byte2, something should come from a "config" file |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
81 |
int b1Min = 0x87; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
82 |
int b1Max = 0xfe; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
83 |
int b2Min = 0x40; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
84 |
int b2Max = 0xfe; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
85 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
86 |
try { |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
87 |
char[] bmp = new char[0x10000]; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
88 |
char[] supp = new char[0x10000]; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
89 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
90 |
boolean[] b2cBmp = new boolean[0x100]; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
91 |
boolean[] b2cSupp = new boolean[0x100]; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
92 |
// pua should be in range of e000-f8ff. Expand |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
93 |
// it to 0xf93b becase the hkscs2001.c2b has |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
94 |
// the f920-f93b filled |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
95 |
//char[] pua = new char[0xF8FF - 0xE000 + 1]; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
96 |
char[] pua = new char[0xF93b - 0xE000 + 1]; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
97 |
boolean hasSupp = false; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
98 |
boolean hasPua = false; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
99 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
100 |
Arrays.fill(bmp, UNMAPPABLE_DECODING); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
101 |
Arrays.fill(supp, UNMAPPABLE_DECODING); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
102 |
Arrays.fill(pua, UNMAPPABLE_DECODING); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
103 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
104 |
Parser p = new Parser(isB2C, hkscs); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
105 |
Entry e = null; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
106 |
while ((e = p.next()) != null) { |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
107 |
if (e.cp >= 0x10000) { |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
108 |
supp[e.bs] = (char)e.cp; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
109 |
b2cSupp[e.bs>>8] = true; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
110 |
hasSupp = true; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
111 |
} else { |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
112 |
bmp[e.bs] = (char)e.cp; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
113 |
b2cBmp[e.bs>>8] = true; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
114 |
} |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
115 |
if (e.cp2 != 0 && e.cp2 >= 0xe000 && e.cp2 <= 0xf8ff) { |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
116 |
hasPua = true; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
117 |
pua[e.cp2 - 0xE000] = (char)e.bs; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
118 |
} |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
119 |
} |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
120 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
121 |
if (isC2B != null) { |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
122 |
p = new Parser(isC2B, hkscs); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
123 |
e = null; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
124 |
while ((e = p.next()) != null) { |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
125 |
pua[e.cp - 0xE000] = (char)e.bs; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
126 |
} |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
127 |
hasPua = true; |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
128 |
} |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
129 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
130 |
StringBuilder sb = new StringBuilder(); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
131 |
Output out = new Output(new Formatter(sb)); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
132 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
133 |
out.format(copyright); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
134 |
out.format("%n// -- This file was mechanically generated: Do not edit! -- //%n"); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
135 |
out.format("package sun.nio.cs.ext;%n%n"); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
136 |
out.format("class %s {%n%n", clzName); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
137 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
138 |
/* hardcoded in sun.nio.cs.ext.HKSCS.java |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
139 |
out.format(" final static int b1Min = 0x%x;%n", b1Min); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
140 |
out.format(" final static int b1Max = 0x%x;%n", b1Max); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
141 |
out.format(" final static int b2Min = 0x%x;%n", b2Min); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
142 |
out.format(" final static int b2Max = 0x%x;%n", b2Max); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
143 |
*/ |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
144 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
145 |
// bmp tables |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
146 |
out.format("%n static final String[] b2cBmpStr = new String[] {%n"); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
147 |
for (int i = 0; i < 0x100; i++) { |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
148 |
if (b2cBmp[i]) |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
149 |
out.format(bmp, i, b2Min, b2Max, ","); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
150 |
else |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
151 |
out.format(" null,%n"); //unmappable segments |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
152 |
} |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
153 |
out.format(" };%n"); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
154 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
155 |
// supp tables |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
156 |
out.format("%n static final String[] b2cSuppStr ="); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
157 |
if (hasSupp) { |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
158 |
out.format(" new String[] {%n"); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
159 |
for (int i = 0; i < 0x100; i++) { |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
160 |
if (b2cSupp[i]) |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
161 |
out.format(supp, i, b2Min, b2Max, ","); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
162 |
else |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
163 |
out.format(" null,%n"); //unmappable segments |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
164 |
} |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
165 |
out.format(" };%n"); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
166 |
} else { |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
167 |
out.format(" null;%n"); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
168 |
} |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
169 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
170 |
// private area tables |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
171 |
out.format("%n final static String pua ="); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
172 |
if (hasPua) { |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
173 |
out.format("%n"); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
174 |
out.format(pua, 0, pua.length, ";"); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
175 |
} else { |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
176 |
out.format(" null;%n"); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
177 |
} |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
178 |
out.format("%n"); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
179 |
out.format("}"); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
180 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
181 |
out.close(); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
182 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
183 |
ps.println(sb.toString()); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
184 |
ps.close(); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
185 |
|
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
186 |
} catch (Exception x) { |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
187 |
x.printStackTrace(); |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
188 |
} |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
189 |
} |
dbd299f8fdae
6902790: Converting/displaying HKSCs characters issue on Vista and Windows7
sherman
parents:
diff
changeset
|
190 |
} |