make/jdk/src/classes/build/tools/charsetmapping/Main.java
changeset 48031 d0cf025a5e79
parent 47216 71c04702a3d5
child 57136 c9bcd764f1f4
equal deleted inserted replaced
48030:b8a119027122 48031:d0cf025a5e79
     1 /*
     1 /*
     2  * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    52         if (isStandard || isExtended) {
    52         if (isStandard || isExtended) {
    53             LinkedHashMap<String, Charset> charsets = getCharsets(
    53             LinkedHashMap<String, Charset> charsets = getCharsets(
    54                 new File(args[SRC_DIR], args[CHARSETS]));
    54                 new File(args[SRC_DIR], args[CHARSETS]));
    55             String[] osStdcs = getOSStdCSList(new File(args[SRC_DIR], args[OS]));
    55             String[] osStdcs = getOSStdCSList(new File(args[SRC_DIR], args[OS]));
    56             boolean hasBig5_HKSCS = false;
    56             boolean hasBig5_HKSCS = false;
       
    57             boolean hasMS950_HKSCS = false;
    57             boolean hasMS950_HKSCS_XP = false;
    58             boolean hasMS950_HKSCS_XP = false;
    58             boolean hasEUC_TW = false;
    59             boolean hasEUC_TW = false;
    59             for (String name : osStdcs) {
    60             for (String name : osStdcs) {
    60                 Charset cs = charsets.get(name);
    61                 Charset cs = charsets.get(name);
    61                 if (cs != null) {
    62                 if (cs != null) {
    62                     cs.pkgName = "sun.nio.cs";
    63                     cs.pkgName = "sun.nio.cs";
    63                 }
    64                 }
    64                 if (name.equals("Big5_HKSCS")) {
    65                 if (name.equals("Big5_HKSCS")) {
    65                     hasBig5_HKSCS = true;
    66                     hasBig5_HKSCS = true;
       
    67                 } else if (name.equals("MS950_HKSCS")) {
       
    68                     hasMS950_HKSCS = true;
    66                 } else if (name.equals("MS950_HKSCS_XP")) {
    69                 } else if (name.equals("MS950_HKSCS_XP")) {
    67                     hasMS950_HKSCS_XP = true;
    70                     hasMS950_HKSCS_XP = true;
    68                 } else if (name.equals("EUC_TW")) {
    71                 } else if (name.equals("EUC_TW")) {
    69                     hasEUC_TW = true;
    72                     hasEUC_TW = true;
    70                 }
    73                 }
    96             SPI.genClass(args[TYPE], charsets,
    99             SPI.genClass(args[TYPE], charsets,
    97                          args[SRC_DIR], args[DST_DIR],
   100                          args[SRC_DIR], args[DST_DIR],
    98                          args[TEMPLATE],
   101                          args[TEMPLATE],
    99                          args[OS].endsWith("windows") ? "windows" : "unix");
   102                          args[OS].endsWith("windows") ? "windows" : "unix");
   100 
   103 
   101             // HKSCSMapping2008/XP.java goes together with Big5/MS950XP_HKSCS
   104             // HKSCSMapping(2008).java goes std if one of Big5_HKSCS MS950_HKSCS
   102             if (isStandard && hasBig5_HKSCS || isExtended && !hasBig5_HKSCS) {
   105             // is in std
       
   106             if (isStandard && (hasBig5_HKSCS || hasMS950_HKSCS) ||
       
   107                 isExtended && !(hasBig5_HKSCS  || hasMS950_HKSCS)) {
   103                 HKSCS.genClass2008(args[SRC_DIR], args[DST_DIR],
   108                 HKSCS.genClass2008(args[SRC_DIR], args[DST_DIR],
   104                                    isStandard ? "sun.nio.cs" : "sun.nio.cs.ext",
   109                                    isStandard ? "sun.nio.cs" : "sun.nio.cs.ext",
   105                                    new File(args[COPYRIGHT_SRC], "HKSCS.java"));
   110                                    new File(args[COPYRIGHT_SRC], "HKSCS.java"));
   106             }
   111             }
       
   112             // HKSCS_XPMapping.java goes together with MS950XP_HKSCS
   107             if (isStandard && hasMS950_HKSCS_XP || isExtended && !hasMS950_HKSCS_XP) {
   113             if (isStandard && hasMS950_HKSCS_XP || isExtended && !hasMS950_HKSCS_XP) {
   108                 HKSCS.genClassXP(args[SRC_DIR], args[DST_DIR],
   114                 HKSCS.genClassXP(args[SRC_DIR], args[DST_DIR],
   109                                  isStandard ? "sun.nio.cs" : "sun.nio.cs.ext",
   115                                  isStandard ? "sun.nio.cs" : "sun.nio.cs.ext",
   110                                  new File(args[COPYRIGHT_SRC], "HKSCS.java"));
   116                                  new File(args[COPYRIGHT_SRC], "HKSCS.java"));
   111             }
   117             }