]> gitweb.fperrin.net Git - Dictionary.git/blob - jars/icu4j-4_2_1-src/src/com/ibm/icu/charset/CharsetISCII.java
go
[Dictionary.git] / jars / icu4j-4_2_1-src / src / com / ibm / icu / charset / CharsetISCII.java
1 /*\r
2  *******************************************************************************\r
3  * Copyright (C) 2008, International Business Machines Corporation and         *\r
4  * others. All Rights Reserved.                                                *\r
5  *******************************************************************************\r
6  */\r
7 package com.ibm.icu.charset;\r
8 \r
9 import java.nio.ByteBuffer;\r
10 import java.nio.CharBuffer;\r
11 import java.nio.IntBuffer;\r
12 import java.nio.charset.CharsetDecoder;\r
13 import java.nio.charset.CharsetEncoder;\r
14 import java.nio.charset.CoderResult;\r
15 \r
16 import com.ibm.icu.text.UTF16;\r
17 import com.ibm.icu.text.UnicodeSet;\r
18 \r
19 /**\r
20  * @author Michael Ow\r
21  *\r
22  */\r
23 class CharsetISCII extends CharsetICU {\r
24     private static final short UCNV_OPTIONS_VERSION_MASK = 0X0f;\r
25     //private static final short NUKTA = 0x093c;\r
26     //private static final short HALANT = 0x094d;\r
27     private static final short ZWNJ = 0x200c; /* Zero Width Non Joiner */\r
28     private static final short ZWJ = 0x200d; /* Zero Width Joiner */\r
29     //private static final int   INVALID_CHAR = 0xffff;\r
30     private static final short ATR = 0xef; /* Attribute code */\r
31     private static final short EXT = 0xf0; /* Extension code */\r
32     private static final short DANDA = 0x0964;\r
33     private static final short DOUBLE_DANDA = 0x0965;\r
34     private static final short ISCII_NUKTA = 0xe9;\r
35     private static final short ISCII_HALANT = 0xe8;\r
36     private static final short ISCII_DANDA = 0xea;\r
37     private static final short ISCII_VOWEL_SIGN_E = 0xe0;\r
38     private static final short ISCII_INV = 0xd9;\r
39     private static final short INDIC_BLOCK_BEGIN = 0x0900;\r
40     private static final short INDIC_BLOCK_END = 0x0d7f;\r
41     private static final short INDIC_RANGE = (INDIC_BLOCK_END - INDIC_BLOCK_BEGIN);\r
42     private static final short VOCALLIC_RR = 0x0931;\r
43     private static final short LF = 0x0a;\r
44     private static final short ASCII_END = 0xa0;\r
45     private static final short TELUGU_DELTA = (UniLang.DELTA * UniLang.TELUGU);\r
46     private static final short DEV_ABBR_SIGN = 0x0970;\r
47     private static final short DEV_ANUDATTA = 0x0952;\r
48     private static final short EXT_RANGE_BEGIN = 0xa1;\r
49     private static final short EXT_RANGE_END = 0xee;\r
50     private static final short PNJ_DELTA = 0x100;\r
51     private static final int   NO_CHAR_MARKER = 0xfffe;\r
52     \r
53     /* Used for proper conversion to and from Gurmukhi */\r
54     private static UnicodeSet  PNJ_BINDI_TIPPI_SET;\r
55     private static UnicodeSet  PNJ_CONSONANT_SET;\r
56     private static final short PNJ_BINDI        = 0x0a02;\r
57     private static final short PNJ_TIPPI        = 0x0a70;\r
58     private static final short PNJ_SIGN_VIRAMA  = 0x0a4d;\r
59     private static final short PNJ_ADHAK        = 0x0a71;\r
60     private static final short PNJ_HA           = 0x0a39;\r
61     private static final short PNJ_RRA          = 0x0a5c;\r
62     \r
63     private static final class UniLang {\r
64         static final short DEVALANGARI = 0;\r
65         static final short BENGALI = DEVALANGARI + 1;\r
66         static final short GURMUKHI = BENGALI + 1;\r
67         static final short GUJARATI = GURMUKHI + 1;\r
68         static final short ORIYA = GUJARATI + 1;\r
69         static final short TAMIL = ORIYA + 1;\r
70         static final short TELUGU = TAMIL + 1;\r
71         static final short KANNADA = TELUGU + 1;\r
72         static final short MALAYALAM = KANNADA + 1;\r
73         static final short DELTA = 0x80;\r
74     }\r
75     \r
76     private static final class ISCIILang {\r
77         static final short DEF = 0x40;\r
78         static final short RMN = 0x41;\r
79         static final short DEV = 0x42;\r
80         static final short BNG = 0x43;\r
81         static final short TML = 0x44;\r
82         static final short TLG = 0x45;\r
83         static final short ASM = 0x46;\r
84         static final short ORI = 0x47;\r
85         static final short KND = 0x48;\r
86         static final short MLM = 0x49;\r
87         static final short GJR = 0x4a;\r
88         static final short PNJ = 0x4b;\r
89         static final short ARB = 0x71;\r
90         static final short PES = 0x72;\r
91         static final short URD = 0x73;\r
92         static final short SND = 0x74;\r
93         static final short KSM = 0x75;\r
94         static final short PST = 0x76;\r
95     }\r
96     \r
97     private static final class MaskEnum {\r
98         static final short DEV_MASK = 0x80;\r
99         static final short PNJ_MASK = 0x40;\r
100         static final short GJR_MASK = 0x20;\r
101         static final short ORI_MASK = 0x10;\r
102         static final short BNG_MASK = 0x08;\r
103         static final short KND_MASK = 0x04;\r
104         static final short MLM_MASK = 0x02;\r
105         static final short TML_MASK = 0x01;\r
106         static final short ZERO = 0x00;\r
107     }\r
108     \r
109     private final String ISCII_CNV_PREFIX = "ISCII,version=";\r
110     \r
111     private final class UConverterDataISCII {\r
112         int option;\r
113         int contextCharToUnicode;      /* previous Unicode codepoint for contextual analysis */\r
114         int contextCharFromUnicode;    /* previous Unicode codepoint for contextual analysis */\r
115         short defDeltaToUnicode;             /* delta for switching to default state when DEF is encountered */\r
116         short currentDeltaFromUnicode;   /* current delta in Indic block */\r
117         short currentDeltaToUnicode;         /* current delta in Indic block */\r
118         short currentMaskFromUnicode;    /* mask for current state in fromUnicode */\r
119         short currentMaskToUnicode;          /* mask for current state in toUnicode */\r
120         short defMaskToUnicode;           /* mask for default state in toUnicode */\r
121         boolean isFirstBuffer;          /* boolean for fromUnicode to see if we need to announce the first script */\r
122         boolean resetToDefaultToUnicode;    /* boolean for reseting to default delta and mask when a newline is encountered */\r
123         String name;\r
124         int prevToUnicodeStatus;        /* Hold the previous toUnicodeStatus. This is necessary because we may need to know the last two code points. */\r
125         \r
126         UConverterDataISCII(int option, String name) {\r
127             this.option = option;\r
128             this.name = name;\r
129             \r
130             initialize();\r
131         }\r
132         \r
133         void initialize() {          \r
134             this.contextCharToUnicode = NO_CHAR_MARKER; /* contextCharToUnicode */\r
135             this.currentDeltaFromUnicode = 0x0000; /* contextCharFromUnicode */\r
136             this.defDeltaToUnicode = (short)(lookupInitialData[option & UCNV_OPTIONS_VERSION_MASK].uniLang * UniLang.DELTA); /* defDeltaToUnicode */ \r
137             this.currentDeltaFromUnicode = (short)(lookupInitialData[option & UCNV_OPTIONS_VERSION_MASK].uniLang * UniLang.DELTA); /* currentDeltaFromUnicode */ \r
138             this.currentDeltaToUnicode = (short)(lookupInitialData[option & UCNV_OPTIONS_VERSION_MASK].uniLang * UniLang.DELTA); /* currentDeltaToUnicode */ \r
139             this.currentMaskToUnicode = (short)lookupInitialData[option & UCNV_OPTIONS_VERSION_MASK].maskEnum; /* currentMaskToUnicode */\r
140             this.currentMaskFromUnicode = (short)lookupInitialData[option & UCNV_OPTIONS_VERSION_MASK].maskEnum; /* currentMaskFromUnicode */\r
141             this.defMaskToUnicode = (short)lookupInitialData[option & UCNV_OPTIONS_VERSION_MASK].maskEnum; /* defMaskToUnicode */\r
142             this.isFirstBuffer = true; /* isFirstBuffer */\r
143             this.resetToDefaultToUnicode = false; /* resetToDefaultToUnicode */   \r
144             this.prevToUnicodeStatus = 0x0000;\r
145         }\r
146     }\r
147     \r
148     private static final class LookupDataStruct {\r
149         short uniLang;\r
150         short maskEnum;\r
151         short isciiLang;\r
152         \r
153         LookupDataStruct(short uniLang, short maskEnum, short isciiLang) {\r
154             this.uniLang = uniLang;\r
155             this.maskEnum = maskEnum;\r
156             this.isciiLang = isciiLang;\r
157         }\r
158     }\r
159     \r
160     private static final LookupDataStruct [] lookupInitialData = {\r
161         new LookupDataStruct(UniLang.DEVALANGARI, MaskEnum.DEV_MASK, ISCIILang.DEV),\r
162         new LookupDataStruct(UniLang.BENGALI, MaskEnum.BNG_MASK, ISCIILang.BNG),\r
163         new LookupDataStruct(UniLang.GURMUKHI, MaskEnum.PNJ_MASK, ISCIILang.PNJ),\r
164         new LookupDataStruct(UniLang.GUJARATI, MaskEnum.GJR_MASK, ISCIILang.GJR),\r
165         new LookupDataStruct(UniLang.ORIYA, MaskEnum.ORI_MASK, ISCIILang.ORI),\r
166         new LookupDataStruct(UniLang.TAMIL, MaskEnum.TML_MASK, ISCIILang.TML),\r
167         new LookupDataStruct(UniLang.TELUGU, MaskEnum.KND_MASK, ISCIILang.TLG),\r
168         new LookupDataStruct(UniLang.KANNADA, MaskEnum.KND_MASK, ISCIILang.KND),\r
169         new LookupDataStruct(UniLang.MALAYALAM, MaskEnum.MLM_MASK, ISCIILang.MLM)\r
170     };\r
171     \r
172     /*\r
173      * The values in validity table are indexed by the lower bits of Unicode\r
174      * range 0x0900 - 0x09ff. The values have a structure like:\r
175      * -----------------------------------------------------------------\r
176      * |DEV | PNJ | GJR | ORI | BNG | TLG | MLM | TML |\r
177      * |    |    |    |    | ASM | KND |    |    |\r
178      * -----------------------------------------------------------------\r
179      * If a code point is valid in a particular script\r
180      * then that bit is turned on\r
181      * \r
182      * Unicode does not distinguish between Bengali and Assamese aso we use 1 bit for\r
183      * to represent these languages\r
184      * \r
185      * Telugu and Kannda have same codepoints except for Vocallic_RR which we special case\r
186      * and combine and use 1 bit to represent these languages\r
187      */\r
188     private static final short validityTable[] = {\r
189         /* This state table is tool generated so please do not edit unless you know exactly what you are doing */\r
190         /* Note:  This table was edited to mirror the Windows XP implementation */\r
191         /* ISCII: Valid: Unicode */\r
192         /* 0xa0: 0x00: 0x900 */ MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO,\r
193         /* 0xa1: 0xb8: 0x901 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO,\r
194         /* 0xa2: 0xfe: 0x902 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK, \r
195         /* 0xa3: 0xbf: 0x903 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
196         /* 0x00: 0x00: 0x904 */ MaskEnum.DEV_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO,\r
197         /* 0xa4: 0xff: 0x905 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
198         /* 0xa5: 0xff: 0x906 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
199         /* 0xa6: 0xff: 0x907 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
200         /* 0xa7: 0xff: 0x908 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
201         /* 0xa8: 0xff: 0x909 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
202         /* 0xa9: 0xff: 0x90a */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
203         /* 0xaa: 0xfe: 0x90b */ MaskEnum.DEV_MASK + MaskEnum.ZERO + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.ZERO,\r
204         /* 0x00: 0x00: 0x90c */ MaskEnum.DEV_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.ZERO,\r
205         /* 0xae: 0x80: 0x90d */ MaskEnum.DEV_MASK + MaskEnum.ZERO + MaskEnum.GJR_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO,\r
206         /* 0xab: 0x87: 0x90e */ MaskEnum.DEV_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
207         /* 0xac: 0xff: 0x90f */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
208         /* 0xad: 0xff: 0x910 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
209         /* 0xb2: 0x80: 0x911 */ MaskEnum.DEV_MASK + MaskEnum.ZERO + MaskEnum.GJR_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO,\r
210         /* 0xaf: 0x87: 0x912 */ MaskEnum.DEV_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
211         /* 0xb0: 0xff: 0x913 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
212         /* 0xb1: 0xff: 0x914 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
213         /* 0xb3: 0xff: 0x915 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
214         /* 0xb4: 0xfe: 0x916 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.ZERO,\r
215         /* 0xb5: 0xfe: 0x917 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.ZERO,\r
216         /* 0xb6: 0xfe: 0x918 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.ZERO,\r
217         /* 0xb7: 0xff: 0x919 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
218         /* 0xb8: 0xff: 0x91a */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
219         /* 0xb9: 0xfe: 0x91b */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.ZERO,\r
220         /* 0xba: 0xff: 0x91c */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
221         /* 0xbb: 0xfe: 0x91d */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.ZERO,\r
222         /* 0xbc: 0xff: 0x91e */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
223         /* 0xbd: 0xff: 0x91f */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
224         /* 0xbe: 0xfe: 0x920 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.ZERO,\r
225         /* 0xbf: 0xfe: 0x921 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.ZERO,\r
226         /* 0xc0: 0xfe: 0x922 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.ZERO,\r
227         /* 0xc1: 0xff: 0x923 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
228         /* 0xc2: 0xff: 0x924 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
229         /* 0xc3: 0xfe: 0x925 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.ZERO,\r
230         /* 0xc4: 0xfe: 0x926 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.ZERO,\r
231         /* 0xc5: 0xfe: 0x927 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.ZERO,\r
232         /* 0xc6: 0xff: 0x928 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
233         /* 0xc7: 0x81: 0x929 */ MaskEnum.DEV_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.TML_MASK,\r
234         /* 0xc8: 0xff: 0x92a */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
235         /* 0xc9: 0xfe: 0x92b */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.ZERO,\r
236         /* 0xca: 0xfe: 0x92c */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.ZERO,\r
237         /* 0xcb: 0xfe: 0x92d */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.ZERO,\r
238         /* 0xcc: 0xfe: 0x92e */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
239         /* 0xcd: 0xff: 0x92f */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
240         /* 0xcf: 0xff: 0x930 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
241         /* 0xd0: 0x87: 0x931 */ MaskEnum.DEV_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
242         /* 0xd1: 0xff: 0x932 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
243         /* 0xd2: 0xb7: 0x933 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.ZERO + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
244         /* 0xd3: 0x83: 0x934 */ MaskEnum.DEV_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
245         /* 0xd4: 0xff: 0x935 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.ZERO + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
246         /* 0xd5: 0xfe: 0x936 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.ZERO,\r
247         /* 0xd6: 0xbf: 0x937 */ MaskEnum.DEV_MASK + MaskEnum.ZERO + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
248         /* 0xd7: 0xff: 0x938 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
249         /* 0xd8: 0xff: 0x939 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
250         /* 0x00: 0x00: 0x93a */ MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO,\r
251         /* 0x00: 0x00: 0x93b */ MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO,\r
252         /* 0xe9: 0xda: 0x93c */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.ZERO + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO,\r
253         /* 0x00: 0x00: 0x93d */ MaskEnum.DEV_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO,\r
254         /* 0xda: 0xff: 0x93e */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
255         /* 0xdb: 0xff: 0x93f */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
256         /* 0xdc: 0xff: 0x940 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
257         /* 0xdd: 0xff: 0x941 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
258         /* 0xde: 0xff: 0x942 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
259         /* 0xdf: 0xbe: 0x943 */ MaskEnum.DEV_MASK + MaskEnum.ZERO + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.ZERO,\r
260         /* 0x00: 0x00: 0x944 */ MaskEnum.DEV_MASK + MaskEnum.ZERO + MaskEnum.GJR_MASK + MaskEnum.ZERO + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.ZERO + MaskEnum.ZERO,\r
261         /* 0xe3: 0x80: 0x945 */ MaskEnum.DEV_MASK + MaskEnum.ZERO + MaskEnum.GJR_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO,\r
262         /* 0xe0: 0x87: 0x946 */ MaskEnum.DEV_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
263         /* 0xe1: 0xff: 0x947 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
264         /* 0xe2: 0xff: 0x948 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
265         /* 0xe7: 0x80: 0x949 */ MaskEnum.DEV_MASK + MaskEnum.ZERO + MaskEnum.GJR_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO,\r
266         /* 0xe4: 0x87: 0x94a */ MaskEnum.DEV_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
267         /* 0xe5: 0xff: 0x94b */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
268         /* 0xe6: 0xff: 0x94c */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
269         /* 0xe8: 0xff: 0x94d */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
270         /* 0xec: 0x00: 0x94e */ MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO,\r
271         /* 0xed: 0x00: 0x94f */ MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO,\r
272         /* 0x00: 0x00: 0x950 */ MaskEnum.DEV_MASK + MaskEnum.ZERO + MaskEnum.GJR_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO,\r
273         /* 0x00: 0x00: 0x951 */ MaskEnum.DEV_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO,\r
274         /* 0x00: 0x00: 0x952 */ MaskEnum.DEV_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO,\r
275         /* 0x00: 0x00: 0x953 */ MaskEnum.DEV_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO,\r
276         /* 0x00: 0x00: 0x954 */ MaskEnum.DEV_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO,\r
277         /* 0x00: 0x00: 0x955 */ MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.KND_MASK + MaskEnum.ZERO + MaskEnum.ZERO,\r
278         /* 0x00: 0x00: 0x956 */ MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ORI_MASK + MaskEnum.ZERO + MaskEnum.KND_MASK + MaskEnum.ZERO + MaskEnum.ZERO,\r
279         /* 0x00: 0x00: 0x957 */ MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.ZERO + MaskEnum.MLM_MASK + MaskEnum.ZERO,\r
280         /* 0x00: 0x00: 0x958 */ MaskEnum.DEV_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO,\r
281         /* 0x00: 0x00: 0x959 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO,\r
282         /* 0x00: 0x00: 0x95a */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO,\r
283         /* 0x00: 0x00: 0x95b */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO,\r
284         /* 0x00: 0x00: 0x95c */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.BNG_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO,\r
285         /* 0x00: 0x00: 0x95d */ MaskEnum.DEV_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO,\r
286         /* 0x00: 0x00: 0x95e */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO,\r
287         /* 0xce: 0x98: 0x95f */ MaskEnum.DEV_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO,\r
288         /* 0x00: 0x00: 0x960 */ MaskEnum.DEV_MASK + MaskEnum.ZERO + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.ZERO,\r
289         /* 0x00: 0x00: 0x961 */ MaskEnum.DEV_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.ZERO,\r
290         /* 0x00: 0x00: 0x962 */ MaskEnum.DEV_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.BNG_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO,\r
291         /* 0x00: 0x00: 0x963 */ MaskEnum.DEV_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.BNG_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO,\r
292         /* 0xea: 0xf8: 0x964 */ MaskEnum.DEV_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO,\r
293         /* 0xeaea: 0x00: 0x965 */ MaskEnum.DEV_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO,\r
294         /* 0xf1: 0xff: 0x966 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
295         /* 0xf2: 0xff: 0x967 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
296         /* 0xf3: 0xff: 0x968 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
297         /* 0xf4: 0xff: 0x969 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
298         /* 0xf5: 0xff: 0x96a */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
299         /* 0xf6: 0xff: 0x96b */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
300         /* 0xf7: 0xff: 0x96c */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
301         /* 0xf8: 0xff: 0x96d */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
302         /* 0xf9: 0xff: 0x96e */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
303         /* 0xfa: 0xff: 0x96f */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.GJR_MASK + MaskEnum.ORI_MASK + MaskEnum.BNG_MASK + MaskEnum.KND_MASK + MaskEnum.MLM_MASK + MaskEnum.TML_MASK,\r
304         /* 0x00: 0x80: 0x970 */ MaskEnum.DEV_MASK + MaskEnum.PNJ_MASK + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO + MaskEnum.ZERO,\r
305         \r
306         /*\r
307          * The length of the array is 128 to provide values for 0x900..0x97f.\r
308          * The last 15 entries for 0x971..0x97f of the table are all zero\r
309          * because no Indic script uses such Unicode code points.\r
310          */\r
311         \r
312         /* 0x00: 0x00: 0x971 */ MaskEnum.ZERO,\r
313         /* 0x00: 0x00: 0x972 */ MaskEnum.ZERO,\r
314         /* 0x00: 0x00: 0x973 */ MaskEnum.ZERO,\r
315         /* 0x00: 0x00: 0x974 */ MaskEnum.ZERO,\r
316         /* 0x00: 0x00: 0x975 */ MaskEnum.ZERO,\r
317         /* 0x00: 0x00: 0x976 */ MaskEnum.ZERO,\r
318         /* 0x00: 0x00: 0x977 */ MaskEnum.ZERO,\r
319         /* 0x00: 0x00: 0x978 */ MaskEnum.ZERO,\r
320         /* 0x00: 0x00: 0x979 */ MaskEnum.ZERO,\r
321         /* 0x00: 0x00: 0x97A */ MaskEnum.ZERO,\r
322         /* 0x00: 0x00: 0x97B */ MaskEnum.ZERO,\r
323         /* 0x00: 0x00: 0x97C */ MaskEnum.ZERO,\r
324         /* 0x00: 0x00: 0x97D */ MaskEnum.ZERO,\r
325         /* 0x00: 0x00: 0x97E */ MaskEnum.ZERO,\r
326         /* 0x00: 0x00: 0x97F */ MaskEnum.ZERO,\r
327     };\r
328     \r
329     private static final char fromUnicodeTable[] = {\r
330       0x00a0, /* 0x0900 */ \r
331       0x00a1, /* 0x0901 */\r
332       0x00a2, /* 0x0902 */\r
333       0x00a3, /* 0x0903 */\r
334       0xa4e0, /* 0x0904 */\r
335       0x00a4, /* 0x0905 */\r
336       0x00a5, /* 0x0906 */\r
337       0x00a6, /* 0x0907 */\r
338       0x00a7, /* 0x0908 */ \r
339       0x00a8, /* 0x0909 */\r
340       0x00a9, /* 0x090a */\r
341       0x00aa, /* 0x090b */\r
342       0xA6E9, /* 0x090c */\r
343       0x00ae, /* 0x090d */\r
344       0x00ab, /* 0x090e */\r
345       0x00ac, /* 0x090f */\r
346       0x00ad, /* 0x0910 */ \r
347       0x00b2, /* 0x0911 */\r
348       0x00af, /* 0x0912 */\r
349       0x00b0, /* 0x0913 */\r
350       0x00b1, /* 0x0914 */\r
351       0x00b3, /* 0x0915 */\r
352       0x00b4, /* 0x0916 */\r
353       0x00b5, /* 0x0917 */\r
354       0x00b6, /* 0x0918 */ \r
355       0x00b7, /* 0x0919 */\r
356       0x00b8, /* 0x091a */\r
357       0x00b9, /* 0x091b */\r
358       0x00ba, /* 0x091c */\r
359       0x00bb, /* 0x091d */\r
360       0x00bc, /* 0x091e */\r
361       0x00bd, /* 0x091f */\r
362       0x00be, /* 0x0920 */ \r
363       0x00bf, /* 0x0921 */\r
364       0x00c0, /* 0x0922 */\r
365       0x00c1, /* 0x0923 */\r
366       0x00c2, /* 0x0924 */\r
367       0x00c3, /* 0x0925 */\r
368       0x00c4, /* 0x0926 */\r
369       0x00c5, /* 0x0927 */\r
370       0x00c6, /* 0x0928 */ \r
371       0x00c7, /* 0x0929 */\r
372       0x00c8, /* 0x092a */\r
373       0x00c9, /* 0x092b */\r
374       0x00ca, /* 0x092c */\r
375       0x00cb, /* 0x092d */\r
376       0x00cc, /* 0x092e */\r
377       0x00cd, /* 0x092f */\r
378       0x00cf, /* 0x0930 */ \r
379       0x00d0, /* 0x0931 */\r
380       0x00d1, /* 0x0932 */\r
381       0x00d2, /* 0x0933 */\r
382       0x00d3, /* 0x0934 */\r
383       0x00d4, /* 0x0935 */\r
384       0x00d5, /* 0x0936 */\r
385       0x00d6, /* 0x0937 */\r
386       0x00d7, /* 0x0938 */ \r
387       0x00d8, /* 0x0939 */\r
388       0xFFFF, /* 0x093a */\r
389       0xFFFF, /* 0x093b */\r
390       0x00e9, /* 0x093c */\r
391       0xEAE9, /* 0x093d */\r
392       0x00da, /* 0x093e */\r
393       0x00db, /* 0x093f */\r
394       0x00dc, /* 0x0940 */ \r
395       0x00dd, /* 0x0941 */\r
396       0x00de, /* 0x0942 */\r
397       0x00df, /* 0x0943 */\r
398       0xDFE9, /* 0x0944 */\r
399       0x00e3, /* 0x0945 */\r
400       0x00e0, /* 0x0946 */\r
401       0x00e1, /* 0x0947 */\r
402       0x00e2, /* 0x0948 */ \r
403       0x00e7, /* 0x0949 */\r
404       0x00e4, /* 0x094a */\r
405       0x00e5, /* 0x094b */\r
406       0x00e6, /* 0x094c */\r
407       0x00e8, /* 0x094d */\r
408       0x00ec, /* 0x094e */\r
409       0x00ed, /* 0x094f */\r
410       0xA1E9, /* 0x0950 */ /* OM Symbol */ \r
411       0xFFFF, /* 0x0951 */\r
412       0xF0B8, /* 0x0952 */\r
413       0xFFFF, /* 0x0953 */\r
414       0xFFFF, /* 0x0954 */\r
415       0xFFFF, /* 0x0955 */\r
416       0xFFFF, /* 0x0956 */\r
417       0xFFFF, /* 0x0957 */\r
418       0xb3e9, /* 0x0958 */ \r
419       0xb4e9, /* 0x0959 */\r
420       0xb5e9, /* 0x095a */\r
421       0xbae9, /* 0x095b */\r
422       0xbfe9, /* 0x095c */\r
423       0xC0E9, /* 0x095d */\r
424       0xc9e9, /* 0x095e */\r
425       0x00ce, /* 0x095f */\r
426       0xAAe9, /* 0x0960 */ \r
427       0xA7E9, /* 0x0961 */\r
428       0xDBE9, /* 0x0962 */\r
429       0xDCE9, /* 0x0963 */\r
430       0x00ea, /* 0x0964 */\r
431       0xeaea, /* 0x0965 */\r
432       0x00f1, /* 0x0966 */\r
433       0x00f2, /* 0x0967 */\r
434       0x00f3, /* 0x0968 */ \r
435       0x00f4, /* 0x0969 */\r
436       0x00f5, /* 0x096a */\r
437       0x00f6, /* 0x096b */\r
438       0x00f7, /* 0x096c */\r
439       0x00f8, /* 0x096d */\r
440       0x00f9, /* 0x096e */\r
441       0x00fa, /* 0x096f */\r
442       0xF0BF, /* 0x0970 */ \r
443       0xFFFF, /* 0x0971 */\r
444       0xFFFF, /* 0x0972 */\r
445       0xFFFF, /* 0x0973 */\r
446       0xFFFF, /* 0x0974 */\r
447       0xFFFF, /* 0x0975 */\r
448       0xFFFF, /* 0x0976 */\r
449       0xFFFF, /* 0x0977 */\r
450       0xFFFF, /* 0x0978 */ \r
451       0xFFFF, /* 0x0979 */\r
452       0xFFFF, /* 0x097a */\r
453       0xFFFF, /* 0x097b */\r
454       0xFFFF, /* 0x097c */\r
455       0xFFFF, /* 0x097d */\r
456       0xFFFF, /* 0x097e */\r
457       0xFFFF, /* 0x097f */\r
458     };\r
459     private static final char toUnicodeTable[] = {\r
460         0x0000, /* 0x00 */\r
461         0x0001, /* 0x01 */\r
462         0x0002, /* 0x02 */\r
463         0x0003, /* 0x03 */\r
464         0x0004, /* 0x04 */\r
465         0x0005, /* 0x05 */\r
466         0x0006, /* 0x06 */\r
467         0x0007, /* 0x07 */\r
468         0x0008, /* 0x08 */\r
469         0x0009, /* 0x09 */\r
470         0x000a, /* 0x0a */\r
471         0x000b, /* 0x0b */\r
472         0x000c, /* 0x0c */\r
473         0x000d, /* 0x0d */\r
474         0x000e, /* 0x0e */\r
475         0x000f, /* 0x0f */\r
476         0x0010, /* 0x10 */\r
477         0x0011, /* 0x11 */\r
478         0x0012, /* 0x12 */\r
479         0x0013, /* 0x13 */\r
480         0x0014, /* 0x14 */\r
481         0x0015, /* 0x15 */\r
482         0x0016, /* 0x16 */\r
483         0x0017, /* 0x17 */\r
484         0x0018, /* 0x18 */\r
485         0x0019, /* 0x19 */\r
486         0x001a, /* 0x1a */\r
487         0x001b, /* 0x1b */\r
488         0x001c, /* 0x1c */\r
489         0x001d, /* 0x1d */\r
490         0x001e, /* 0x1e */\r
491         0x001f, /* 0x1f */\r
492         0x0020, /* 0x20 */\r
493         0x0021, /* 0x21 */\r
494         0x0022, /* 0x22 */\r
495         0x0023, /* 0x23 */\r
496         0x0024, /* 0x24 */\r
497         0x0025, /* 0x25 */\r
498         0x0026, /* 0x26 */\r
499         0x0027, /* 0x27 */\r
500         0x0028, /* 0x28 */\r
501         0x0029, /* 0x29 */\r
502         0x002a, /* 0x2a */\r
503         0x002b, /* 0x2b */\r
504         0x002c, /* 0x2c */\r
505         0x002d, /* 0x2d */\r
506         0x002e, /* 0x2e */\r
507         0x002f, /* 0x2f */\r
508         0x0030, /* 0x30 */\r
509         0x0031, /* 0x31 */\r
510         0x0032, /* 0x32 */\r
511         0x0033, /* 0x33 */\r
512         0x0034, /* 0x34 */\r
513         0x0035, /* 0x35 */\r
514         0x0036, /* 0x36 */\r
515         0x0037, /* 0x37 */\r
516         0x0038, /* 0x38 */\r
517         0x0039, /* 0x39 */\r
518         0x003A, /* 0x3A */\r
519         0x003B, /* 0x3B */\r
520         0x003c, /* 0x3c */\r
521         0x003d, /* 0x3d */\r
522         0x003e, /* 0x3e */\r
523         0x003f, /* 0x3f */\r
524         0x0040, /* 0x40 */\r
525         0x0041, /* 0x41 */\r
526         0x0042, /* 0x42 */\r
527         0x0043, /* 0x43 */\r
528         0x0044, /* 0x44 */\r
529         0x0045, /* 0x45 */\r
530         0x0046, /* 0x46 */\r
531         0x0047, /* 0x47 */\r
532         0x0048, /* 0x48 */\r
533         0x0049, /* 0x49 */\r
534         0x004a, /* 0x4a */\r
535         0x004b, /* 0x4b */\r
536         0x004c, /* 0x4c */\r
537         0x004d, /* 0x4d */\r
538         0x004e, /* 0x4e */\r
539         0x004f, /* 0x4f */\r
540         0x0050, /* 0x50 */\r
541         0x0051, /* 0x51 */\r
542         0x0052, /* 0x52 */\r
543         0x0053, /* 0x53 */\r
544         0x0054, /* 0x54 */\r
545         0x0055, /* 0x55 */\r
546         0x0056, /* 0x56 */\r
547         0x0057, /* 0x57 */\r
548         0x0058, /* 0x58 */\r
549         0x0059, /* 0x59 */\r
550         0x005a, /* 0x5a */\r
551         0x005b, /* 0x5b */\r
552         0x005c, /* 0x5c */\r
553         0x005d, /* 0x5d */\r
554         0x005e, /* 0x5e */\r
555         0x005f, /* 0x5f */\r
556         0x0060, /* 0x60 */\r
557         0x0061, /* 0x61 */\r
558         0x0062, /* 0x62 */\r
559         0x0063, /* 0x63 */\r
560         0x0064, /* 0x64 */\r
561         0x0065, /* 0x65 */\r
562         0x0066, /* 0x66 */\r
563         0x0067, /* 0x67 */\r
564         0x0068, /* 0x68 */\r
565         0x0069, /* 0x69 */\r
566         0x006a, /* 0x6a */\r
567         0x006b, /* 0x6b */\r
568         0x006c, /* 0x6c */\r
569         0x006d, /* 0x6d */\r
570         0x006e, /* 0x6e */\r
571         0x006f, /* 0x6f */\r
572         0x0070, /* 0x70 */\r
573         0x0071, /* 0x71 */\r
574         0x0072, /* 0x72 */\r
575         0x0073, /* 0x73 */\r
576         0x0074, /* 0x74 */\r
577         0x0075, /* 0x75 */\r
578         0x0076, /* 0x76 */\r
579         0x0077, /* 0x77 */\r
580         0x0078, /* 0x78 */\r
581         0x0079, /* 0x79 */\r
582         0x007a, /* 0x7a */\r
583         0x007b, /* 0x7b */\r
584         0x007c, /* 0x7c */\r
585         0x007d, /* 0x7d */\r
586         0x007e, /* 0x7e */\r
587         0x007f, /* 0x7f */\r
588         0x0080, /* 0x80 */\r
589         0x0081, /* 0x81 */\r
590         0x0082, /* 0x82 */\r
591         0x0083, /* 0x83 */\r
592         0x0084, /* 0x84 */\r
593         0x0085, /* 0x85 */\r
594         0x0086, /* 0x86 */\r
595         0x0087, /* 0x87 */\r
596         0x0088, /* 0x88 */\r
597         0x0089, /* 0x89 */\r
598         0x008a, /* 0x8a */\r
599         0x008b, /* 0x8b */\r
600         0x008c, /* 0x8c */\r
601         0x008d, /* 0x8d */\r
602         0x008e, /* 0x8e */\r
603         0x008f, /* 0x8f */\r
604         0x0090, /* 0x90 */\r
605         0x0091, /* 0x91 */\r
606         0x0092, /* 0x92 */\r
607         0x0093, /* 0x93 */\r
608         0x0094, /* 0x94 */\r
609         0x0095, /* 0x95 */\r
610         0x0096, /* 0x96 */\r
611         0x0097, /* 0x97 */\r
612         0x0098, /* 0x98 */\r
613         0x0099, /* 0x99 */\r
614         0x009a, /* 0x9a */\r
615         0x009b, /* 0x9b */\r
616         0x009c, /* 0x9c */\r
617         0x009d, /* 0x9d */\r
618         0x009e, /* 0x9e */\r
619         0x009f, /* 0x9f */\r
620         0x00A0, /* 0xa0 */\r
621         0x0901, /* 0xa1 */\r
622         0x0902, /* 0xa2 */\r
623         0x0903, /* 0xa3 */\r
624         0x0905, /* 0xa4 */\r
625         0x0906, /* 0xa5 */\r
626         0x0907, /* 0xa6 */\r
627         0x0908, /* 0xa7 */\r
628         0x0909, /* 0xa8 */\r
629         0x090a, /* 0xa9 */\r
630         0x090b, /* 0xaa */\r
631         0x090e, /* 0xab */\r
632         0x090f, /* 0xac */\r
633         0x0910, /* 0xad */\r
634         0x090d, /* 0xae */\r
635         0x0912, /* 0xaf */\r
636         0x0913, /* 0xb0 */\r
637         0x0914, /* 0xb1 */\r
638         0x0911, /* 0xb2 */\r
639         0x0915, /* 0xb3 */\r
640         0x0916, /* 0xb4 */\r
641         0x0917, /* 0xb5 */\r
642         0x0918, /* 0xb6 */\r
643         0x0919, /* 0xb7 */\r
644         0x091a, /* 0xb8 */\r
645         0x091b, /* 0xb9 */\r
646         0x091c, /* 0xba */\r
647         0x091d, /* 0xbb */\r
648         0x091e, /* 0xbc */\r
649         0x091f, /* 0xbd */\r
650         0x0920, /* 0xbe */\r
651         0x0921, /* 0xbf */\r
652         0x0922, /* 0xc0 */\r
653         0x0923, /* 0xc1 */\r
654         0x0924, /* 0xc2 */\r
655         0x0925, /* 0xc3 */\r
656         0x0926, /* 0xc4 */\r
657         0x0927, /* 0xc5 */\r
658         0x0928, /* 0xc6 */\r
659         0x0929, /* 0xc7 */\r
660         0x092a, /* 0xc8 */\r
661         0x092b, /* 0xc9 */\r
662         0x092c, /* 0xca */\r
663         0x092d, /* 0xcb */\r
664         0x092e, /* 0xcc */\r
665         0x092f, /* 0xcd */\r
666         0x095f, /* 0xce */\r
667         0x0930, /* 0xcf */\r
668         0x0931, /* 0xd0 */\r
669         0x0932, /* 0xd1 */\r
670         0x0933, /* 0xd2 */\r
671         0x0934, /* 0xd3 */\r
672         0x0935, /* 0xd4 */\r
673         0x0936, /* 0xd5 */\r
674         0x0937, /* 0xd6 */\r
675         0x0938, /* 0xd7 */\r
676         0x0939, /* 0xd8 */\r
677         0x200D, /* 0xd9 */\r
678         0x093e, /* 0xda */\r
679         0x093f, /* 0xdb */\r
680         0x0940, /* 0xdc */\r
681         0x0941, /* 0xdd */\r
682         0x0942, /* 0xde */\r
683         0x0943, /* 0xdf */\r
684         0x0946, /* 0xe0 */\r
685         0x0947, /* 0xe1 */\r
686         0x0948, /* 0xe2 */\r
687         0x0945, /* 0xe3 */\r
688         0x094a, /* 0xe4 */\r
689         0x094b, /* 0xe5 */\r
690         0x094c, /* 0xe6 */\r
691         0x0949, /* 0xe7 */\r
692         0x094d, /* 0xe8 */\r
693         0x093c, /* 0xe9 */\r
694         0x0964, /* 0xea */\r
695         0xFFFF, /* 0xeb */\r
696         0xFFFF, /* 0xec */\r
697         0xFFFF, /* 0xed */\r
698         0xFFFF, /* 0xee */\r
699         0xFFFF, /* 0xef */\r
700         0xFFFF, /* 0xf0 */\r
701         0x0966, /* 0xf1 */\r
702         0x0967, /* 0xf2 */\r
703         0x0968, /* 0xf3 */\r
704         0x0969, /* 0xf4 */\r
705         0x096a, /* 0xf5 */\r
706         0x096b, /* 0xf6 */\r
707         0x096c, /* 0xf7 */\r
708         0x096d, /* 0xf8 */\r
709         0x096e, /* 0xf9 */\r
710         0x096f, /* 0xfa */\r
711         0xFFFF, /* 0xfb */\r
712         0xFFFF, /* 0xfc */\r
713         0xFFFF, /* 0xfd */\r
714         0xFFFF, /* 0xfe */\r
715         0xFFFF, /* 0xff */\r
716     };\r
717     private static final char nuktaSpecialCases[][] = {\r
718         { 16 /* length of array */ , 0 },\r
719         { 0xa6, 0x090c },\r
720         { 0xea, 0x093d },\r
721         { 0xdf, 0x0944 },\r
722         { 0xa1, 0x0950 },\r
723         { 0xb3, 0x0958 },\r
724         { 0xb4, 0x0959 },\r
725         { 0xb5, 0x095a },\r
726         { 0xba, 0x095b },\r
727         { 0xbf, 0x095c },\r
728         { 0xc0, 0x095d },\r
729         { 0xc9, 0x095e },\r
730         { 0xaa, 0x0960 },\r
731         { 0xa7, 0x0961 },\r
732         { 0xdb, 0x0962 },\r
733         { 0xdc, 0x0963 }\r
734     };\r
735     private static final char vowelSignESpecialCases[][] = {\r
736         { 2 /* length of array */ , 0 },\r
737         { 0xA4, 0x0904 }\r
738     };\r
739     \r
740     private static final short lookupTable[][] = {\r
741         { MaskEnum.ZERO, MaskEnum.ZERO }, /* DEFAULT */\r
742         { MaskEnum.ZERO, MaskEnum.ZERO }, /* ROMAN */\r
743         { UniLang.DEVALANGARI, MaskEnum.DEV_MASK },\r
744         { UniLang.BENGALI, MaskEnum.BNG_MASK },\r
745         { UniLang.TAMIL, MaskEnum.TML_MASK },\r
746         { UniLang.TELUGU, MaskEnum.KND_MASK },\r
747         { UniLang.BENGALI, MaskEnum.BNG_MASK },\r
748         { UniLang.ORIYA, MaskEnum.ORI_MASK },\r
749         { UniLang.KANNADA, MaskEnum.KND_MASK },\r
750         { UniLang.MALAYALAM, MaskEnum.MLM_MASK },\r
751         { UniLang.GUJARATI, MaskEnum.GJR_MASK },\r
752         { UniLang.GURMUKHI, MaskEnum.PNJ_MASK }\r
753     };\r
754     \r
755     private UConverterDataISCII extraInfo = null;\r
756     protected byte[] fromUSubstitution = new byte[]{(byte)0x1A};\r
757     \r
758     public CharsetISCII(String icuCanonicalName, String javaCanonicalName, String[] aliases) {\r
759         super(icuCanonicalName, javaCanonicalName, aliases);\r
760         maxBytesPerChar = 4; \r
761         minBytesPerChar = 1;\r
762         maxCharsPerByte = 1;\r
763         //get the version number of the ISCII converter\r
764         int option = Integer.parseInt(icuCanonicalName.substring(14));\r
765         \r
766         extraInfo = new UConverterDataISCII( \r
767                             option,\r
768                             new String(ISCII_CNV_PREFIX + (option & UCNV_OPTIONS_VERSION_MASK))  /* name */\r
769                         );\r
770         \r
771         initializePNJSets();\r
772     }\r
773     \r
774     /* Initialize the two UnicodeSets use for proper Gurmukhi conversion if they have not already been created. */\r
775     private void initializePNJSets() {\r
776         if (PNJ_BINDI_TIPPI_SET != null && PNJ_CONSONANT_SET != null) {\r
777             return;\r
778         }\r
779         PNJ_BINDI_TIPPI_SET = new UnicodeSet();\r
780         PNJ_CONSONANT_SET = new UnicodeSet();\r
781         \r
782         PNJ_CONSONANT_SET.add(0x0a15, 0x0a28);\r
783         PNJ_CONSONANT_SET.add(0x0a2a, 0x0a30);\r
784         PNJ_CONSONANT_SET.add(0x0a35, 0x0a36);\r
785         PNJ_CONSONANT_SET.add(0x0a38, 0x0a39);\r
786         \r
787         PNJ_BINDI_TIPPI_SET.addAll(PNJ_CONSONANT_SET);\r
788         PNJ_BINDI_TIPPI_SET.add(0x0a05);\r
789         PNJ_BINDI_TIPPI_SET.add(0x0a07);\r
790         \r
791         PNJ_BINDI_TIPPI_SET.add(0x0a41, 0x0a42);\r
792         PNJ_BINDI_TIPPI_SET.add(0x0a3f);\r
793         \r
794         PNJ_CONSONANT_SET.compact();\r
795         PNJ_BINDI_TIPPI_SET.compact();\r
796     }\r
797     \r
798     /*\r
799      * Rules for ISCII to Unicode converter\r
800      * ISCII is a stateful encoding. To convert ISCII bytes to Unicode,\r
801      * which is both precomposed and decomposed from characters\r
802      * pre-context and post-context need to be considered.\r
803      * \r
804      * Post context\r
805      * i) ATR : Attribute code is used to declare the font and script switching.\r
806      *    Currently we only switch scripts and font codes consumed without generating an error\r
807      * ii) EXT : Extention code is used to declare switching to Sanskrit and for obscure,\r
808      *     obsolete characters\r
809      * Pre context\r
810      * i) Halant: if preceeded by a halant then it is a explicit halant\r
811      * ii) Nukta:\r
812      *     a) if preceeded by a halant then it is a soft halant\r
813      *     b) if preceeded by specific consonants and the ligatures have pre-composed\r
814      *        characters in Unicode then convert to pre-composed characters\r
815      * iii) Danda: If Danda is preceeded by a Danda then convert to Double Danda \r
816      */\r
817     class CharsetDecoderISCII extends CharsetDecoderICU {\r
818         public CharsetDecoderISCII(CharsetICU cs) {\r
819             super(cs);\r
820             implReset();\r
821         }\r
822     \r
823         protected void implReset() {\r
824             super.implReset();\r
825             this.toUnicodeStatus = 0xFFFF;\r
826             extraInfo.initialize();\r
827         }\r
828         \r
829         protected CoderResult decodeLoop(ByteBuffer source, CharBuffer target, IntBuffer offsets, boolean flush) { \r
830             CoderResult cr = CoderResult.UNDERFLOW;\r
831             int targetUniChar = 0x0000;\r
832             short sourceChar = 0x0000;\r
833             UConverterDataISCII data;\r
834             boolean gotoCallBack = false;\r
835             int offset = 0;\r
836             \r
837             data = extraInfo;\r
838             //data.contextCharToUnicode; /* contains previous ISCII codepoint visited */\r
839             //this.toUnicodeStatus; /* contains the mapping to Unicode of the above codepoint */\r
840             \r
841             while (source.hasRemaining()) {\r
842                 targetUniChar = UConverterConstants.missingCharMarker;\r
843                 \r
844                 if (target.hasRemaining()) {\r
845                     sourceChar = (short)((short)source.get() & UConverterConstants.UNSIGNED_BYTE_MASK);\r
846                     \r
847                     /* look at the post-context perform special processing */\r
848                     if (data.contextCharToUnicode == ATR) {\r
849                         /* If we have ATR in data.contextCharToUnicode then we need to change our\r
850                          * state to Indic Script specified by sourceChar\r
851                          */\r
852                         /* check if the sourceChar is supported script range */\r
853                         if (((short)(ISCIILang.PNJ - sourceChar) & UConverterConstants.UNSIGNED_BYTE_MASK) <= (ISCIILang.PNJ - ISCIILang.DEV)) {\r
854                             data.currentDeltaToUnicode = (short)(lookupTable[sourceChar & 0x0F][0] * UniLang.DELTA);\r
855                             data.currentMaskToUnicode = lookupTable[sourceChar & 0x0F][1];\r
856                         } else if (sourceChar == ISCIILang.DEF) {\r
857                             /* switch back to default */\r
858                             data.currentDeltaToUnicode = data.defDeltaToUnicode;\r
859                             data.currentMaskToUnicode = data.defMaskToUnicode;\r
860                         } else {\r
861                             if ((sourceChar >= 0x21 && sourceChar <= 0x3F)) {\r
862                                 /* these are display codes consume and continue */\r
863                             } else {\r
864                                 cr = CoderResult.malformedForLength(1);\r
865                                 /* reset */\r
866                                 data.contextCharToUnicode = NO_CHAR_MARKER;\r
867                                 gotoCallBack = true;\r
868                             }\r
869                         }\r
870                         /* reset */\r
871                         if (!gotoCallBack) {\r
872                             data.contextCharToUnicode = NO_CHAR_MARKER;\r
873                             continue;\r
874                         }\r
875                     } else if (data.contextCharToUnicode == EXT) {\r
876                         /* check if sourceChar is in 0xA1 - 0xEE range */\r
877                         if (((short)(EXT_RANGE_END - sourceChar) & UConverterConstants.UNSIGNED_BYTE_MASK) <= (EXT_RANGE_END - EXT_RANGE_BEGIN)) {\r
878                             /* We currently support only Anudatta and Devanagari abbreviation sign */\r
879                             if (sourceChar == 0xBF || sourceChar == 0xB8) {\r
880                                 targetUniChar = (sourceChar == 0xBF) ? DEV_ABBR_SIGN : DEV_ANUDATTA;\r
881                                 \r
882                                 /* find out if the mappling is valid in this state */\r
883                                 if ((validityTable[((short)targetUniChar) & UConverterConstants.UNSIGNED_BYTE_MASK] & data.currentMaskToUnicode) > 0) {\r
884                                     data.contextCharToUnicode = NO_CHAR_MARKER;\r
885                                     \r
886                                     /* Write the previous toUnicodeStatus, this was delayed to handle consonant clustering for Gurmukhi script. */\r
887                                     if (data.prevToUnicodeStatus != 0) {\r
888                                         cr = WriteToTargetToU(offsets, (source.position() - 1), source, target, data.prevToUnicodeStatus, (short)0);\r
889                                         data.prevToUnicodeStatus = 0x0000;\r
890                                     }\r
891                                     /* write to target */\r
892                                     cr = WriteToTargetToU(offsets, (source.position() - 2), source, target, targetUniChar, data.currentDeltaToUnicode);\r
893                                     \r
894                                     continue;\r
895                                 }\r
896                             }\r
897                             /* byte unit is unassigned */\r
898                             targetUniChar = UConverterConstants.missingCharMarker;\r
899                             cr = CoderResult.unmappableForLength(1);\r
900                         } else {\r
901                             /* only 0xA1 - 0xEE are legal after EXT char */\r
902                             data.contextCharToUnicode = NO_CHAR_MARKER;\r
903                             cr = CoderResult.malformedForLength(1); \r
904                         }\r
905                         gotoCallBack = true;\r
906                     } else if (data.contextCharToUnicode == ISCII_INV) {\r
907                         if (sourceChar == ISCII_HALANT) {\r
908                             targetUniChar = 0x0020; /* replace with space according to Indic FAQ */\r
909                         } else {\r
910                             targetUniChar = ZWJ;\r
911                         }\r
912                         \r
913                         /* Write the previous toUnicodeStatus, this was delayed to handle consonant clustering for Gurmukhi script. */\r
914                         if (data.prevToUnicodeStatus != 0) {\r
915                             cr = WriteToTargetToU(offsets, (source.position() - 1), source, target, data.prevToUnicodeStatus, (short)0);\r
916                             data.prevToUnicodeStatus = 0x0000;\r
917                         }\r
918                         \r
919                         /* write to target */\r
920                         cr = WriteToTargetToU(offsets, (source.position() - 2), source, target, targetUniChar, data.currentDeltaToUnicode);\r
921                         /* reset */\r
922                         data.contextCharToUnicode = NO_CHAR_MARKER;\r
923                     }\r
924                     \r
925                     /* look at the pre-context and perform special processing */\r
926                     if (!gotoCallBack) {\r
927                         switch (sourceChar) {\r
928                         case ISCII_INV:\r
929                         case EXT: /* falls through */\r
930                         case ATR:\r
931                             data.contextCharToUnicode = (char)sourceChar;\r
932                             \r
933                             if (this.toUnicodeStatus != UConverterConstants.missingCharMarker) {\r
934                                 /* Write the previous toUnicodeStatus, this was delayed to handle consonant clustering for Gurmukhi script. */\r
935                                 if (data.prevToUnicodeStatus != 0) {\r
936                                     cr = WriteToTargetToU(offsets, (source.position() - 1), source, target, data.prevToUnicodeStatus, (short)0);\r
937                                     data.prevToUnicodeStatus = 0x0000;\r
938                                 }\r
939                                 cr = WriteToTargetToU(offsets, (source.position() - 2), source, target, this.toUnicodeStatus, data.currentDeltaToUnicode); \r
940                                 this.toUnicodeStatus = UConverterConstants.missingCharMarker;\r
941                             }\r
942                             continue;\r
943                         case ISCII_DANDA:\r
944                             /* handle double danda */\r
945                             if (data.contextCharToUnicode == ISCII_DANDA) {\r
946                                 targetUniChar = DOUBLE_DANDA;\r
947                                 /* clear the context */\r
948                                 data.contextCharToUnicode = NO_CHAR_MARKER;\r
949                                 this.toUnicodeStatus = UConverterConstants.missingCharMarker;\r
950                             } else {\r
951                                 targetUniChar = GetMapping(sourceChar, targetUniChar, data);\r
952                                 data.contextCharToUnicode = (char)sourceChar;\r
953                             }\r
954                             break;\r
955                         case ISCII_HALANT:\r
956                             /* handle explicit halant */\r
957                             if (data.contextCharToUnicode == ISCII_HALANT) {\r
958                                 targetUniChar = ZWNJ;\r
959                                 /* clear context */\r
960                                 data.contextCharToUnicode = NO_CHAR_MARKER;\r
961                             } else {\r
962                                 targetUniChar = GetMapping(sourceChar, targetUniChar, data);\r
963                                 data.contextCharToUnicode = (char)sourceChar;\r
964                             }\r
965                             break;\r
966                         case 0x0A:\r
967                             /* fall through */\r
968                         case 0x0D:\r
969                             data.resetToDefaultToUnicode = true;\r
970                             targetUniChar = GetMapping(sourceChar, targetUniChar, data);\r
971                             data.contextCharToUnicode = (char)sourceChar;\r
972                             break;\r
973                         case ISCII_VOWEL_SIGN_E:\r
974                             /* find <CHAR> + SIGN_VOWEL_E special mapping */\r
975                             int n = 1;\r
976                             boolean find = false;\r
977                             for (; n < vowelSignESpecialCases[0][0]; n++) {\r
978                                 if (vowelSignESpecialCases[n][0] == ((short)data.contextCharToUnicode & UConverterConstants.UNSIGNED_BYTE_MASK)) {\r
979                                     targetUniChar = vowelSignESpecialCases[n][1];\r
980                                     find = true;\r
981                                     break;\r
982                                 }\r
983                             }\r
984                             if (find) {\r
985                                 /* find out if the mapping is valid in this state */\r
986                                 if ((validityTable[(byte)targetUniChar] & data.currentMaskFromUnicode) > 0) {\r
987                                     data.contextCharToUnicode = NO_CHAR_MARKER;\r
988                                     this.toUnicodeStatus = UConverterConstants.missingCharMarker;\r
989                                     break;\r
990                                 }\r
991                             }\r
992                             targetUniChar = GetMapping(sourceChar, targetUniChar, data);\r
993                             data.contextCharToUnicode = (char)sourceChar;\r
994                             break;                         \r
995                         case ISCII_NUKTA:\r
996                             /* handle soft halant */\r
997                             if (data.contextCharToUnicode == ISCII_HALANT) {\r
998                                 targetUniChar = ZWJ;\r
999                                 /* clear the context */\r
1000                                 data.contextCharToUnicode = NO_CHAR_MARKER;\r
1001                                 break;\r
1002                             } else if (data.currentDeltaToUnicode == PNJ_DELTA && data.contextCharToUnicode == 0xc0) {\r
1003                                 /* We got here because ISCII_NUKTA was preceded by 0xc0 and we are converting Gurmukhi.\r
1004                                  * In that case we must convert (0xc0 0xe9) to (\u0a5c\u0a4d\u0a39).\r
1005                                  * WriteToTargetToU is given 0x095c instead of 0xa5c because that method will automatically\r
1006                                  * convert the code point given based on the delta provided.\r
1007                                  */\r
1008                                 cr = WriteToTargetToU(offsets, (source.position() - 2), source, target, PNJ_RRA, (short)0);\r
1009                                 if (!cr.isOverflow()) {\r
1010                                     cr = WriteToTargetToU(offsets, (source.position() - 2), source, target, PNJ_SIGN_VIRAMA, (short)0);\r
1011                                     if (!cr.isOverflow()) {\r
1012                                         cr = WriteToTargetToU(offsets, (source.position() - 2), source, target, PNJ_HA, (short)0);\r
1013                                     } else {\r
1014                                         this.charErrorBufferArray[this.charErrorBufferLength++] = PNJ_HA;\r
1015                                     }\r
1016                                 } else {\r
1017                                     this.charErrorBufferArray[this.charErrorBufferLength++] = PNJ_SIGN_VIRAMA;\r
1018                                     this.charErrorBufferArray[this.charErrorBufferLength++] = PNJ_HA;\r
1019                                 }\r
1020                                 this.toUnicodeStatus = UConverterConstants.missingCharMarker;\r
1021                                 data.contextCharToUnicode = NO_CHAR_MARKER;\r
1022                                 if (!cr.isError()) {\r
1023                                     continue;\r
1024                                 }\r
1025                                 break;\r
1026                             } else {\r
1027                                 /* try to handle <CHAR> + ISCII_NUKTA special mappings */\r
1028                                 int i = 1;\r
1029                                 boolean found = false;\r
1030                                 for (; i < nuktaSpecialCases[0][0]; i++) {\r
1031                                     if (nuktaSpecialCases[i][0] == ((short)data.contextCharToUnicode & UConverterConstants.UNSIGNED_BYTE_MASK)) {\r
1032                                         targetUniChar  = nuktaSpecialCases[i][1];\r
1033                                         found = true;\r
1034                                         break;\r
1035                                     }\r
1036                                 }\r
1037                                 if (found) {\r
1038                                     /* find out if the mapping is valid in this state */\r
1039                                     if ((validityTable[(byte)targetUniChar] & data.currentMaskToUnicode) > 0) {\r
1040                                         data.contextCharToUnicode = NO_CHAR_MARKER;\r
1041                                         this.toUnicodeStatus = UConverterConstants.missingCharMarker;\r
1042                                         if (data.currentDeltaToUnicode == PNJ_DELTA) {\r
1043                                             /* Write the previous toUnicodeStatus, this was delayed to handle consonant clustering for Gurmukhi script. */\r
1044                                             if (data.prevToUnicodeStatus != 0) {\r
1045                                                 cr = WriteToTargetToU(offsets, (source.position() - 1), source, target, data.prevToUnicodeStatus, (short)0);\r
1046                                                 data.prevToUnicodeStatus = 0x0000;\r
1047                                             }\r
1048                                             cr = WriteToTargetToU(offsets, (source.position() - 2), source, target, targetUniChar, data.currentDeltaToUnicode);\r
1049                                             continue;\r
1050                                         }\r
1051                                         break;\r
1052                                     }\r
1053                                     /* else fall through to default */\r
1054                                 }\r
1055                                 /* else fall through to default */\r
1056                             }\r
1057                         \r
1058                         default:\r
1059                             targetUniChar = GetMapping(sourceChar, targetUniChar, data);\r
1060                             data.contextCharToUnicode = (char)sourceChar;\r
1061                             break;\r
1062                         } //end of switch\r
1063                     }//end of CallBack if statement\r
1064                     \r
1065                     if (!gotoCallBack && this.toUnicodeStatus != UConverterConstants.missingCharMarker) {\r
1066                         /* Check to make sure that consonant clusters are handled correctly for Gurmukhi script. */\r
1067                         if (data.currentDeltaToUnicode == PNJ_DELTA && data.prevToUnicodeStatus != 0 && PNJ_CONSONANT_SET.contains(data.prevToUnicodeStatus) &&\r
1068                                 (this.toUnicodeStatus + PNJ_DELTA) == PNJ_SIGN_VIRAMA && (targetUniChar + PNJ_DELTA) == data.prevToUnicodeStatus) {\r
1069                             if (offsets != null) {\r
1070                                 offset = source.position() - 3;\r
1071                             }\r
1072                             cr = WriteToTargetToU(offsets, offset, source, target, PNJ_ADHAK, (short)0);\r
1073                             cr = WriteToTargetToU(offsets, offset, source, target, data.prevToUnicodeStatus, (short)0);\r
1074                             data.prevToUnicodeStatus = 0x0000; /* reset the previous unicode code point */\r
1075                             toUnicodeStatus = UConverterConstants.missingCharMarker;\r
1076                             continue;\r
1077                         } else {\r
1078                             /* Write the previous toUnicodeStatus, this was delayed to handle consonant clustering for Gurmukhi script. */\r
1079                             if (data.prevToUnicodeStatus != 0) {\r
1080                                 cr = WriteToTargetToU(offsets, (source.position() - 1), source, target, data.prevToUnicodeStatus, (short)0);\r
1081                                 data.prevToUnicodeStatus = 0x0000;\r
1082                             }\r
1083                             /* Check to make sure that Bindi and Tippi are handled correctly for Gurmukhi script. \r
1084                              * If 0xA2 is preceded by a codepoint in the PNJ_BINDI_TIPPI_SET then the target codepoint should be Tippi instead of Bindi.\r
1085                              */\r
1086                             if (data.currentDeltaToUnicode == PNJ_DELTA  && (targetUniChar + PNJ_DELTA) == PNJ_BINDI && PNJ_BINDI_TIPPI_SET.contains(this.toUnicodeStatus + PNJ_DELTA)) {\r
1087                                 targetUniChar = PNJ_TIPPI - PNJ_DELTA;\r
1088                                 cr = WriteToTargetToU(offsets, (source.position() - 2), source, target, this.toUnicodeStatus, PNJ_DELTA);\r
1089                             } else if (data.currentDeltaToUnicode == PNJ_DELTA && (targetUniChar + PNJ_DELTA) == PNJ_SIGN_VIRAMA && PNJ_CONSONANT_SET.contains(this.toUnicodeStatus + PNJ_DELTA)) {\r
1090                                 /* Store the current toUnicodeStatus code point for later handling of consonant cluster in Gurmukhi. */\r
1091                                 data.prevToUnicodeStatus = this.toUnicodeStatus + PNJ_DELTA;\r
1092                             } else {\r
1093                                 /* write the previously mapped codepoint */\r
1094                                 cr = WriteToTargetToU(offsets, (source.position() - 2), source, target, this.toUnicodeStatus, data.currentDeltaToUnicode);\r
1095                             }\r
1096                         }\r
1097                         this.toUnicodeStatus = UConverterConstants.missingCharMarker;\r
1098                     }\r
1099                     \r
1100                     if (!gotoCallBack && targetUniChar != UConverterConstants.missingCharMarker) {\r
1101                         /* now save the targetUniChar for delayed write */\r
1102                         this.toUnicodeStatus = (char)targetUniChar;\r
1103                         if (data.resetToDefaultToUnicode) {\r
1104                             data.currentDeltaToUnicode = data.defDeltaToUnicode;\r
1105                             data.currentMaskToUnicode = data.defMaskToUnicode;\r
1106                             data.resetToDefaultToUnicode = false;\r
1107                         }\r
1108                     } else {\r
1109                         /* we reach here only if targetUniChar == missingCharMarker\r
1110                          * so assign codes to reason and err\r
1111                          */\r
1112                         if (!gotoCallBack) {\r
1113                             cr = CoderResult.unmappableForLength(1);\r
1114                         }\r
1115 //CallBack :\r
1116                         toUBytesArray[0] = (byte)sourceChar;\r
1117                         toULength = 1;\r
1118                         gotoCallBack = false;\r
1119                         break;\r
1120                     }\r
1121                 } else {\r
1122                     cr = CoderResult.OVERFLOW;\r
1123                     break;\r
1124                 }\r
1125                 \r
1126             } //end of while\r
1127             \r
1128             if (cr.isUnderflow() && flush && !source.hasRemaining()) {\r
1129                 /*end of the input stream */\r
1130                 if (data.contextCharToUnicode == ATR || data.contextCharToUnicode == EXT || data.contextCharToUnicode == ISCII_INV) {\r
1131                     /* set toUBytes[] */\r
1132                     toUBytesArray[0] = (byte)data.contextCharToUnicode;\r
1133                     toULength = 1;\r
1134                     \r
1135                     /* avoid looping on truncated sequences */\r
1136                     data.contextCharToUnicode = NO_CHAR_MARKER;\r
1137                 } else {\r
1138                     toULength = 0;\r
1139                 }\r
1140                 \r
1141                 if (this.toUnicodeStatus != UConverterConstants.missingCharMarker) {\r
1142                     /* output a remaining target character */\r
1143                     WriteToTargetToU(offsets, (source.position() - 2), source, target, this.toUnicodeStatus, data.currentDeltaToUnicode);\r
1144                     this.toUnicodeStatus = UConverterConstants.missingCharMarker;    \r
1145                 }\r
1146             }\r
1147             return cr;\r
1148         }\r
1149         \r
1150         private CoderResult WriteToTargetToU(IntBuffer offsets, int offset, ByteBuffer source, CharBuffer target, int targetUniChar, short delta) {\r
1151             CoderResult cr = CoderResult.UNDERFLOW;\r
1152             /* add offset to current Indic Block */\r
1153             if (targetUniChar > ASCII_END &&\r
1154                     targetUniChar != ZWJ &&\r
1155                     targetUniChar != ZWNJ &&\r
1156                     targetUniChar != DANDA &&\r
1157                     targetUniChar != DOUBLE_DANDA) {\r
1158                 targetUniChar += delta;\r
1159             }\r
1160             \r
1161             /* now write the targetUniChar */\r
1162             if (target.hasRemaining()) {\r
1163                 target.put((char)targetUniChar);\r
1164                 if (offsets != null) {\r
1165                     offsets.put(offset);\r
1166                 }\r
1167             } else {\r
1168                 charErrorBufferArray[charErrorBufferLength++] = (char)targetUniChar;\r
1169                 cr = CoderResult.OVERFLOW;\r
1170             }\r
1171             return cr;\r
1172         }\r
1173         \r
1174         private int GetMapping(short sourceChar, int targetUniChar, UConverterDataISCII data) {\r
1175             targetUniChar = toUnicodeTable[sourceChar];\r
1176             /* is the code point valid in current script? */\r
1177             if (sourceChar > ASCII_END &&\r
1178                     (validityTable[(short)targetUniChar & UConverterConstants.UNSIGNED_BYTE_MASK] & data.currentMaskToUnicode) == 0) {\r
1179                 /* Vocallic RR is assigne in ISCII Telugu and Unicode */\r
1180                 if (data.currentDeltaToUnicode != (TELUGU_DELTA) || targetUniChar != VOCALLIC_RR) {\r
1181                     targetUniChar = UConverterConstants.missingCharMarker;\r
1182                 }\r
1183             }\r
1184             return targetUniChar;\r
1185         }\r
1186     }\r
1187     \r
1188     /*\r
1189      * Rules:\r
1190      *   Explicit Halant :\r
1191      *     <HALANT> + <ZWNJ>\r
1192      *   Soft Halant :\r
1193      *     <HALANT> + <ZWJ>\r
1194      */\r
1195     class CharsetEncoderISCII extends CharsetEncoderICU {\r
1196         public CharsetEncoderISCII(CharsetICU cs) {\r
1197             super(cs, fromUSubstitution);\r
1198             implReset();\r
1199         }\r
1200         \r
1201         protected void implReset() {\r
1202             super.implReset();\r
1203             extraInfo.initialize();\r
1204         }\r
1205         \r
1206         protected CoderResult encodeLoop(CharBuffer source, ByteBuffer target, IntBuffer offsets, boolean flush) {\r
1207             int targetByteUnit = 0x0000;\r
1208             int sourceChar = 0x0000;\r
1209             UConverterDataISCII converterData;\r
1210             short newDelta = 0;\r
1211             short range = 0;\r
1212             boolean deltaChanged = false;\r
1213             int tempContextFromUnicode = 0x0000;    /* For special handling of the Gurmukhi script. */\r
1214             CoderResult cr = CoderResult.UNDERFLOW;\r
1215             \r
1216             /* initialize data */\r
1217             converterData = extraInfo;\r
1218             newDelta = converterData.currentDeltaFromUnicode;\r
1219             range = (short)(newDelta / UniLang.DELTA);\r
1220             \r
1221             if ((sourceChar = fromUChar32) != 0) {\r
1222                 cr = handleSurrogates(source, (char) sourceChar);\r
1223                 return (cr != null) ? cr : CoderResult.unmappableForLength(2);\r
1224             }\r
1225             \r
1226             /* writing the char to the output stream */\r
1227             while (source.hasRemaining()) {\r
1228                 if (!target.hasRemaining()) {\r
1229                     return CoderResult.OVERFLOW;\r
1230                 }\r
1231                 \r
1232                 /* Write the language code following LF only if LF is not the last character. */\r
1233                 if (fromUnicodeStatus == LF) {\r
1234                     targetByteUnit = ATR << 8;\r
1235                     targetByteUnit += (byte)lookupInitialData[range].isciiLang;\r
1236                     fromUnicodeStatus = 0x0000;\r
1237                     /* now append ATR and language code */\r
1238                     cr = WriteToTargetFromU(offsets, source, target, targetByteUnit);\r
1239                     if (cr.isOverflow()) {\r
1240                         break;\r
1241                     }\r
1242                 }\r
1243                 \r
1244                 sourceChar = source.get();\r
1245                 tempContextFromUnicode = converterData.contextCharFromUnicode;\r
1246                 \r
1247                 targetByteUnit = UConverterConstants.missingCharMarker;\r
1248                 \r
1249                 /* check if input is in ASCII and C0 control codes range */\r
1250                 if (sourceChar <= ASCII_END) {\r
1251                     fromUnicodeStatus = sourceChar;\r
1252                     cr = WriteToTargetFromU(offsets, source, target, sourceChar);\r
1253                     if (cr.isOverflow()) {\r
1254                         break;\r
1255                     }\r
1256                     continue;\r
1257                 }\r
1258                 \r
1259                 switch (sourceChar) {\r
1260                 case ZWNJ:\r
1261                     /* contextChar has HALANT */\r
1262                     if (converterData.contextCharFromUnicode != 0) {\r
1263                         converterData.contextCharFromUnicode = 0x00;\r
1264                         targetByteUnit = ISCII_HALANT;\r
1265                     } else {\r
1266                         /* consume ZWNJ and continue */\r
1267                         converterData.contextCharFromUnicode = 0x00;\r
1268                         continue;\r
1269                     }\r
1270                     break;\r
1271                 case ZWJ:\r
1272                     /* contextChar has HALANT */\r
1273                     if (converterData.contextCharFromUnicode != 0) {\r
1274                         targetByteUnit = ISCII_NUKTA;\r
1275                     } else {\r
1276                         targetByteUnit = ISCII_INV;\r
1277                     }\r
1278                     converterData.contextCharFromUnicode = 0x00;\r
1279                     break;\r
1280                 default:\r
1281                     /* is the sourceChar in the INDIC_RANGE? */\r
1282                     if((char)(INDIC_BLOCK_END - sourceChar) <= INDIC_RANGE) {\r
1283                         /* Danda and Doube Danda are valid in Northern scripts.. since Unicode\r
1284                          * does not include these codepoints in all Northern scripts we need to\r
1285                          * filter them out\r
1286                          */\r
1287                         if (sourceChar != DANDA && sourceChar != DOUBLE_DANDA) {\r
1288                             /* find out to which block the sourceChar belongs */\r
1289                             range = (short)((sourceChar - INDIC_BLOCK_BEGIN) / UniLang.DELTA);\r
1290                             newDelta = (short)(range * UniLang.DELTA);\r
1291                         \r
1292                             /* Now are we in the same block as previous? */\r
1293                             if (newDelta != converterData.currentDeltaFromUnicode || converterData.isFirstBuffer) {\r
1294                                 converterData.currentDeltaFromUnicode = newDelta;\r
1295                                 converterData.currentMaskFromUnicode = lookupInitialData[range].maskEnum;\r
1296                                 deltaChanged = true;\r
1297                                 converterData.isFirstBuffer = false;\r
1298                             }\r
1299                             if (converterData.currentDeltaFromUnicode == PNJ_DELTA) {\r
1300                                 if (sourceChar == PNJ_TIPPI) {\r
1301                                     /* Make sure Tippi is converterd to Bindi. */\r
1302                                     sourceChar = PNJ_BINDI;\r
1303                                 } else if (sourceChar == PNJ_ADHAK) {\r
1304                                     /* This is for consonant cluster handling. */\r
1305                                     converterData.contextCharFromUnicode = PNJ_ADHAK;\r
1306                                 }\r
1307                             }\r
1308                             /* Normalize all Indic codepoints to Devanagari and map them to ISCII */\r
1309                             /* now subtract the new delta from sourceChar */\r
1310                             sourceChar -= converterData.currentDeltaFromUnicode;\r
1311                         }\r
1312                         /* get the target byte unit */\r
1313                         targetByteUnit = fromUnicodeTable[(short)sourceChar & UConverterConstants.UNSIGNED_BYTE_MASK];\r
1314                         \r
1315                         /* is the code point valid in current script? */\r
1316                         if ((validityTable[(short)sourceChar & UConverterConstants.UNSIGNED_BYTE_MASK] & converterData.currentMaskFromUnicode) == 0) {\r
1317                             /* Vocallic RR is assigned in ISCII Telugu and Unicode */\r
1318                             if (converterData.currentDeltaFromUnicode != (TELUGU_DELTA) || sourceChar != VOCALLIC_RR) {\r
1319                                 targetByteUnit = UConverterConstants.missingCharMarker;\r
1320                             }\r
1321                         }\r
1322                         \r
1323                         if (deltaChanged) {\r
1324                             /* we are in a script block which is different than\r
1325                              * previous sourceChar's script block write ATR and language codes\r
1326                              */\r
1327                             char temp = 0;\r
1328                             temp = (char)(ATR << 8);\r
1329                             temp += (char)((short)lookupInitialData[range].isciiLang & UConverterConstants.UNSIGNED_BYTE_MASK);\r
1330                             /* reset */\r
1331                             deltaChanged = false;\r
1332                             /* now append ATR and language code */\r
1333                             cr = WriteToTargetFromU(offsets, source, target, temp);\r
1334                             if (cr.isOverflow()) {\r
1335                                 break;\r
1336                             }\r
1337                         }\r
1338                         if (converterData.currentDeltaFromUnicode == PNJ_DELTA && (sourceChar + PNJ_DELTA) == PNJ_ADHAK) {\r
1339                             continue;\r
1340                         }\r
1341                     }\r
1342                     /* reset context char */\r
1343                     converterData.contextCharFromUnicode = 0x00;\r
1344                     break;\r
1345                 } //end of switch\r
1346                 if (converterData.currentDeltaFromUnicode == PNJ_DELTA && tempContextFromUnicode == PNJ_ADHAK && PNJ_CONSONANT_SET.contains(sourceChar + PNJ_DELTA)) {\r
1347                     /* If the previous codepoint is Adhak and the current codepoint is a consonant, the targetByteUnit should be C + Halant + C. */\r
1348                     /* reset context char */\r
1349                     converterData.contextCharFromUnicode = 0x0000;\r
1350                     targetByteUnit = targetByteUnit << 16 | ISCII_HALANT << 8 | targetByteUnit;\r
1351                     /*write targetByteUnit to target */\r
1352                     cr = WriteToTargetFromU(offsets, source, target, targetByteUnit);\r
1353                     if (cr.isOverflow()) {\r
1354                         break;\r
1355                     }\r
1356                 } else if (targetByteUnit != UConverterConstants.missingCharMarker) {\r
1357                     if (targetByteUnit == ISCII_HALANT) {\r
1358                         converterData.contextCharFromUnicode = (char)targetByteUnit;\r
1359                     }\r
1360                     /*write targetByteUnit to target */\r
1361                     cr = WriteToTargetFromU(offsets, source, target, targetByteUnit);\r
1362                     if (cr.isOverflow()) {\r
1363                         break;\r
1364                     }\r
1365                 } else if (UTF16.isSurrogate((char)sourceChar)) {\r
1366                     cr = handleSurrogates(source, (char) sourceChar);\r
1367                     return (cr != null) ? cr : CoderResult.unmappableForLength(2);\r
1368                 } else {\r
1369                     return CoderResult.unmappableForLength(1);\r
1370                 }\r
1371             } /* end of while */\r
1372             \r
1373             /* save the state and return */\r
1374             return cr;\r
1375         }\r
1376         \r
1377         private CoderResult WriteToTargetFromU(IntBuffer offsets, CharBuffer source, ByteBuffer target, int targetByteUnit) {\r
1378             CoderResult cr = CoderResult.UNDERFLOW;\r
1379             int offset = source.position() - 1;\r
1380             /* write the targetUniChar to target */\r
1381             if (target.hasRemaining()) {\r
1382                 if (targetByteUnit <= 0xFF) {\r
1383                     target.put((byte)targetByteUnit);\r
1384                     if (offsets != null) {\r
1385                         offsets.put(offset);\r
1386                     }\r
1387                 } else {\r
1388                     if (targetByteUnit > 0xFFFF) {\r
1389                         target.put((byte)(targetByteUnit >> 16));\r
1390                         if (offsets != null) {\r
1391                             --offset;\r
1392                             offsets.put(offset);\r
1393                         }\r
1394                     } \r
1395                     if (!target.hasRemaining()) {\r
1396                         errorBuffer[errorBufferLength++] = (byte)(targetByteUnit >> 8);\r
1397                         errorBuffer[errorBufferLength++] = (byte)targetByteUnit;\r
1398                         cr = CoderResult.OVERFLOW;\r
1399                         return cr;\r
1400                     }\r
1401                     target.put((byte)(targetByteUnit >> 8));\r
1402                     if (offsets != null) {\r
1403                         offsets.put(offset);\r
1404                     }\r
1405                     if (target.hasRemaining()) {\r
1406                         target.put((byte)targetByteUnit);\r
1407                         if (offsets != null) {\r
1408                             offsets.put(offset);\r
1409                         }\r
1410                     } else {\r
1411                         errorBuffer[errorBufferLength++] = (byte)targetByteUnit;\r
1412                         cr = CoderResult.OVERFLOW;\r
1413                     }\r
1414                 }\r
1415             } else {\r
1416                 if ((targetByteUnit > 0xFFFF)) {\r
1417                     errorBuffer[errorBufferLength++] = (byte)(targetByteUnit >> 16);\r
1418                 } else if ((targetByteUnit & 0xFF00) > 0) {\r
1419                     errorBuffer[errorBufferLength++] = (byte)(targetByteUnit >> 8);\r
1420                 }\r
1421                 errorBuffer[errorBufferLength++] = (byte)(targetByteUnit);\r
1422                 cr = CoderResult.OVERFLOW;\r
1423             }\r
1424             return cr;\r
1425         }\r
1426     }\r
1427     \r
1428     public CharsetDecoder newDecoder() {\r
1429         return new CharsetDecoderISCII(this);\r
1430     }\r
1431     \r
1432     public CharsetEncoder newEncoder() {\r
1433         return new CharsetEncoderISCII(this);\r
1434     }\r
1435     \r
1436     void getUnicodeSetImpl( UnicodeSet setFillIn, int which){\r
1437         int idx,script;\r
1438         char mask;\r
1439         \r
1440         setFillIn.add(0,ASCII_END );\r
1441         for(script = UniLang.DEVALANGARI ; script<= UniLang.MALAYALAM ;script++){\r
1442             mask = (char)lookupInitialData[script].maskEnum;\r
1443             for(idx=0; idx < UniLang.DELTA ; idx++){\r
1444                 // Special check for telugu character\r
1445                 if((validityTable[idx] & mask)!=0 || (script == UniLang.TELUGU && idx==0x31)){ \r
1446                    setFillIn.add(idx+(script*UniLang.DELTA)+INDIC_BLOCK_BEGIN );\r
1447                 }\r
1448             }\r
1449         }\r
1450         setFillIn.add(DANDA);\r
1451         setFillIn.add(DOUBLE_DANDA);\r
1452         setFillIn.add(ZWNJ);\r
1453         setFillIn.add(ZWJ);\r
1454              \r
1455     }\r
1456 }\r