make/tools/src/build/tools/charsetmapping/GenerateSBCS.java

Print this page




  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  22  * CA 95054 USA or visit www.sun.com if you need additional information or
  23  * have any questions.
  24  */
  25 
  26 package build.tools.charsetmapping;
  27 
  28 import java.io.*;
  29 import java.util.ArrayList;
  30 import java.util.Scanner;
  31 import java.util.Formatter;
  32 import java.util.regex.*;
  33 import java.nio.charset.*;
  34 import static build.tools.charsetmapping.CharsetMapping.*;
  35 
  36 public class GenerateSBCS {
  37     public static void main(String args[]) throws Exception {
  38         if (args.length < 3) {
  39             System.err.println("Usage: java GenSBCS srcDir dstDir config");
  40             System.exit(1);
  41         }
  42 


  43         Scanner s = new Scanner(new File(args[0], args[2]));
  44         while (s.hasNextLine()) {
  45             String line = s.nextLine();
  46             if (line.startsWith("#") || line.length() == 0)
  47                 continue;
  48             String[] fields = line.split("\\s+");
  49             if (fields.length < 5) {
  50                 System.err.println("Misconfiged sbcs line <" + line + ">?");
  51                 continue;
  52             }
  53             String clzName = fields[0];
  54             String csName  = fields[1];
  55             String hisName = fields[2];
  56             boolean isASCII = Boolean.valueOf(fields[3]);
  57             String pkgName  = fields[4];
  58             System.out.printf("%s,%s,%s,%b,%s%n", clzName, csName, hisName, isASCII, pkgName);
  59 
  60             StringBuilder b2c = new StringBuilder();
  61             int c2bLen = genB2C(
  62                 new FileInputStream(new File(args[0], clzName+".map")), b2c);




  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  22  * CA 95054 USA or visit www.sun.com if you need additional information or
  23  * have any questions.
  24  */
  25 
  26 package build.tools.charsetmapping;
  27 
  28 import java.io.*;
  29 import java.util.ArrayList;
  30 import java.util.Scanner;
  31 import java.util.Formatter;
  32 import java.util.regex.*;
  33 import java.nio.charset.*;
  34 import static build.tools.charsetmapping.CharsetMapping.*;
  35 
  36 public class GenerateSBCS {





  37 
  38     public static void genSBCS(String args[]) throws Exception {
  39 
  40         Scanner s = new Scanner(new File(args[0], args[2]));
  41         while (s.hasNextLine()) {
  42             String line = s.nextLine();
  43             if (line.startsWith("#") || line.length() == 0)
  44                 continue;
  45             String[] fields = line.split("\\s+");
  46             if (fields.length < 5) {
  47                 System.err.println("Misconfiged sbcs line <" + line + ">?");
  48                 continue;
  49             }
  50             String clzName = fields[0];
  51             String csName  = fields[1];
  52             String hisName = fields[2];
  53             boolean isASCII = Boolean.valueOf(fields[3]);
  54             String pkgName  = fields[4];
  55             System.out.printf("%s,%s,%s,%b,%s%n", clzName, csName, hisName, isASCII, pkgName);
  56 
  57             StringBuilder b2c = new StringBuilder();
  58             int c2bLen = genB2C(
  59                 new FileInputStream(new File(args[0], clzName+".map")), b2c);