make/src/classes/build/tools/charsetmapping/EUC_TW.java

Print this page




  65         return ca;
  66     }
  67 
  68     private static int initC2BIndex(char[] index) {
  69         int off = 0;
  70         for (int i = 0; i < index.length; i++) {
  71             if (index[i] != 0) {
  72                 index[i] = (char)off;
  73                 off += 0x100;
  74             } else {
  75                 index[i] = UNMAPPABLE_ENCODING;
  76             }
  77         }
  78         return off;
  79     }
  80 
  81     private static Pattern euctw = Pattern.compile("(?:8ea)?(\\p{XDigit}++)\\s++(\\p{XDigit}++)?\\s*+.*");
  82 
  83     static void genClass(String pkg, String args[]) throws Exception
  84     {
  85         InputStream is = new FileInputStream(new File(args[0], "euc_tw.map"));
  86         PrintStream ps = new PrintStream(new File(args[1], "EUC_TWMapping.java"),
  87                                          "ISO-8859-1");
  88         String copyright = getCopyright(new File(args[7], "EUC_TW.java"));
  89 
  90 
  91         // ranges of byte1 and byte2, something should come from a "config" file
  92         int b1Min = 0xa1;
  93         int b1Max = 0xfe;
  94         int b2Min = 0xa1;
  95         int b2Max = 0xfe;
  96 
  97         try {
  98             int[][] db = new int[8][0x10000];        // doublebyte
  99             byte[]  suppFlag = new byte[0x10000];    // doublebyte
 100             char[]  indexC2B = new char[256];
 101             char[]  indexC2BSupp = new char[256];
 102 
 103             for (int i = 0; i < 8; i++)
 104                 for (int j = 0; j < 0x10000; j++)
 105                     db[i][j] = UNMAPPABLE_DECODING;




  65         return ca;
  66     }
  67 
  68     private static int initC2BIndex(char[] index) {
  69         int off = 0;
  70         for (int i = 0; i < index.length; i++) {
  71             if (index[i] != 0) {
  72                 index[i] = (char)off;
  73                 off += 0x100;
  74             } else {
  75                 index[i] = UNMAPPABLE_ENCODING;
  76             }
  77         }
  78         return off;
  79     }
  80 
  81     private static Pattern euctw = Pattern.compile("(?:8ea)?(\\p{XDigit}++)\\s++(\\p{XDigit}++)?\\s*+.*");
  82 
  83     static void genClass(String pkg, String args[]) throws Exception
  84     {
  85         InputStream is = new FileInputStream(new File(args[0], "EUC_TW.map"));
  86         PrintStream ps = new PrintStream(new File(args[1], "EUC_TWMapping.java"),
  87                                          "ISO-8859-1");
  88         String copyright = getCopyright(new File(args[7], "EUC_TW.java"));
  89 
  90 
  91         // ranges of byte1 and byte2, something should come from a "config" file
  92         int b1Min = 0xa1;
  93         int b1Max = 0xfe;
  94         int b2Min = 0xa1;
  95         int b2Max = 0xfe;
  96 
  97         try {
  98             int[][] db = new int[8][0x10000];        // doublebyte
  99             byte[]  suppFlag = new byte[0x10000];    // doublebyte
 100             char[]  indexC2B = new char[256];
 101             char[]  indexC2BSupp = new char[256];
 102 
 103             for (int i = 0; i < 8; i++)
 104                 for (int j = 0; j < 0x10000; j++)
 105                     db[i][j] = UNMAPPABLE_DECODING;