1/*
2 *******************************************************************************
3 * Copyright (C) 1996-2007, International Business Machines Corporation and    *
4 * others. All Rights Reserved.                                                *
5 *******************************************************************************
6 */
7
8package com.ibm.icu.text;
9
10/**
11 * An interface defining  constants for the Standard Compression Scheme
12 * for Unicode (SCSU) as outlined in <A
13 * HREF="http://www.unicode.org/unicode/reports/tr6">Unicode Technical
14 * Report #6</A>.
15 *
16 * @author Stephen F. Booth
17 * @version 1.1 05 Aug 99
18 * @version 1.0 26 Jul 99
19 */
20interface SCSU
21{
22    //==========================
23    // Generic window shift
24    //==========================
25    final static int COMPRESSIONOFFSET           = 0x80;
26
27    //==========================
28    // Number of windows
29    //==========================
30    final static int NUMWINDOWS                  = 8;
31    final static int NUMSTATICWINDOWS            = 8;
32
33    //==========================
34    // Indicates a window index is invalid
35    //==========================
36    final static int INVALIDWINDOW               = -1;
37
38    //==========================
39    // Indicates a character doesn't exist in input (past end of buffer)
40    //==========================
41    final static int INVALIDCHAR                 = -1;
42
43    //==========================
44    // Compression modes
45    //==========================
46    final static int SINGLEBYTEMODE              = 0;
47    final static int UNICODEMODE                 = 1;
48
49    //==========================
50    // Maximum value for a window's index
51    //==========================
52    final static int MAXINDEX                    = 0xFF;
53
54    //==========================
55    // Reserved index value (characters belongs to first block)
56    //==========================
57    final static int RESERVEDINDEX               = 0x00;
58
59    //==========================
60    // Indices for scripts which cross a half-block boundary
61    //==========================
62    final static int LATININDEX                  = 0xF9;
63    final static int IPAEXTENSIONINDEX           = 0xFA;
64    final static int GREEKINDEX                  = 0xFB;
65    final static int ARMENIANINDEX               = 0xFC;
66    final static int HIRAGANAINDEX               = 0xFD;
67    final static int KATAKANAINDEX               = 0xFE;
68    final static int HALFWIDTHKATAKANAINDEX      = 0xFF;
69
70    //==========================
71    // Single-byte mode tags
72    //==========================
73    final static int SDEFINEX                    = 0x0B;
74    final static int SRESERVED                   = 0x0C;  // reserved value
75    final static int SQUOTEU                     = 0x0E;
76    final static int SCHANGEU                    = 0x0F;
77
78    final static int SQUOTE0                     = 0x01;
79    final static int SQUOTE1                     = 0x02;
80    final static int SQUOTE2                     = 0x03;
81    final static int SQUOTE3                     = 0x04;
82    final static int SQUOTE4                     = 0x05;
83    final static int SQUOTE5                     = 0x06;
84    final static int SQUOTE6                     = 0x07;
85    final static int SQUOTE7                     = 0x08;
86
87    final static int SCHANGE0                    = 0x10;
88    final static int SCHANGE1                    = 0x11;
89    final static int SCHANGE2                    = 0x12;
90    final static int SCHANGE3                    = 0x13;
91    final static int SCHANGE4                    = 0x14;
92    final static int SCHANGE5                    = 0x15;
93    final static int SCHANGE6                    = 0x16;
94    final static int SCHANGE7                    = 0x17;
95
96    final static int SDEFINE0                    = 0x18;
97    final static int SDEFINE1                    = 0x19;
98    final static int SDEFINE2                    = 0x1A;
99    final static int SDEFINE3                    = 0x1B;
100    final static int SDEFINE4                    = 0x1C;
101    final static int SDEFINE5                    = 0x1D;
102    final static int SDEFINE6                    = 0x1E;
103    final static int SDEFINE7                    = 0x1F;
104
105    //==========================
106    // Unicode mode tags
107    //==========================
108    final static int UCHANGE0                    = 0xE0;
109    final static int UCHANGE1                    = 0xE1;
110    final static int UCHANGE2                    = 0xE2;
111    final static int UCHANGE3                    = 0xE3;
112    final static int UCHANGE4                    = 0xE4;
113    final static int UCHANGE5                    = 0xE5;
114    final static int UCHANGE6                    = 0xE6;
115    final static int UCHANGE7                    = 0xE7;
116
117    final static int UDEFINE0                    = 0xE8;
118    final static int UDEFINE1                    = 0xE9;
119    final static int UDEFINE2                    = 0xEA;
120    final static int UDEFINE3                    = 0xEB;
121    final static int UDEFINE4                    = 0xEC;
122    final static int UDEFINE5                    = 0xED;
123    final static int UDEFINE6                    = 0xEE;
124    final static int UDEFINE7                    = 0xEF;
125
126    final static int UQUOTEU                     = 0xF0;
127    final static int UDEFINEX                    = 0xF1;
128    final static int URESERVED                   = 0xF2;  // reserved value
129
130
131    //==========================
132    // Class variables
133    //==========================
134
135    /** For window offset mapping */
136    final static int [] sOffsetTable = {
137        // table generated by CompressionTableGenerator
138        0x0, 0x80, 0x100, 0x180, 0x200, 0x280, 0x300, 0x380, 0x400,
139    0x480, 0x500, 0x580, 0x600, 0x680, 0x700, 0x780, 0x800, 0x880,
140    0x900, 0x980, 0xa00, 0xa80, 0xb00, 0xb80, 0xc00, 0xc80, 0xd00,
141    0xd80, 0xe00, 0xe80, 0xf00, 0xf80, 0x1000, 0x1080, 0x1100,
142    0x1180, 0x1200, 0x1280, 0x1300, 0x1380, 0x1400, 0x1480,
143    0x1500, 0x1580, 0x1600, 0x1680, 0x1700, 0x1780, 0x1800,
144    0x1880, 0x1900, 0x1980, 0x1a00, 0x1a80, 0x1b00, 0x1b80,
145    0x1c00, 0x1c80, 0x1d00, 0x1d80, 0x1e00, 0x1e80, 0x1f00,
146    0x1f80, 0x2000, 0x2080, 0x2100, 0x2180, 0x2200, 0x2280,
147    0x2300, 0x2380, 0x2400, 0x2480, 0x2500, 0x2580, 0x2600,
148    0x2680, 0x2700, 0x2780, 0x2800, 0x2880, 0x2900, 0x2980,
149    0x2a00, 0x2a80, 0x2b00, 0x2b80, 0x2c00, 0x2c80, 0x2d00,
150    0x2d80, 0x2e00, 0x2e80, 0x2f00, 0x2f80, 0x3000, 0x3080,
151    0x3100, 0x3180, 0x3200, 0x3280, 0x3300, 0x3380, 0xe000,
152    0xe080, 0xe100, 0xe180, 0xe200, 0xe280, 0xe300, 0xe380,
153    0xe400, 0xe480, 0xe500, 0xe580, 0xe600, 0xe680, 0xe700,
154    0xe780, 0xe800, 0xe880, 0xe900, 0xe980, 0xea00, 0xea80,
155    0xeb00, 0xeb80, 0xec00, 0xec80, 0xed00, 0xed80, 0xee00,
156    0xee80, 0xef00, 0xef80, 0xf000, 0xf080, 0xf100, 0xf180,
157    0xf200, 0xf280, 0xf300, 0xf380, 0xf400, 0xf480, 0xf500,
158    0xf580, 0xf600, 0xf680, 0xf700, 0xf780, 0xf800, 0xf880,
159    0xf900, 0xf980, 0xfa00, 0xfa80, 0xfb00, 0xfb80, 0xfc00,
160    0xfc80, 0xfd00, 0xfd80, 0xfe00, 0xfe80, 0xff00, 0xff80, 0x0,
161    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
162    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
163    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
164    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
165    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
166    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
167    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0, 0x250, 0x370,
168    0x530, 0x3040, 0x30a0, 0xff60
169    };
170
171    /** Static compression window offsets */
172    final static int [] sOffsets = {
173        0x0000,  // for quoting single-byte mode tags
174        0x0080,  // Latin-1 Supplement
175        0x0100,  // Latin Extended-A
176        0x0300,  // Combining Diacritical Marks
177        0x2000,  // General Punctuation
178        0x2080,  // Curency Symbols
179        0x2100,  // Letterlike Symbols and Number Forms
180        0x3000   // CJK Symbols and Punctuation
181    };
182
183}
184
185