1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #include <sal/types.h>
24 
25 static sal_uInt16 idx[] = {
26 	0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,  // 0000
27 	0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,  // 1000
28 	0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,  // 2000
29 	0x0000, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,  // 3000
30 	0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF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0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,  // c000
39 	0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,  // d000
40 	0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,  // e000
41 	0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x0100,  // f000
42 };
43 
44 static sal_Unicode syllable[] = {
45 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // 3000
46 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // 3010
47 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // 3020
48 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // 3030
49 	0x3040, 0x3042, 0x3042, 0x3044, 0x3044, 0x3046, 0x3046, 0x3048, 0x3048, 0x304a, 0x304a, 0x304b, 0x304b, 0x304d, 0x304d, 0x304f,  // 3040
50 	0x304f, 0x3051, 0x3051, 0x3053, 0x3053, 0x3055, 0x3055, 0x3057, 0x3057, 0x3059, 0x3059, 0x305b, 0x305b, 0x305d, 0x305d, 0x305f,  // 3050
51 	0x305f, 0x3061, 0x3061, 0x3064, 0x3064, 0x3064, 0x3066, 0x3066, 0x3068, 0x3068, 0x306a, 0x306b, 0x306c, 0x306d, 0x306e, 0x306f,  // 3060
52 	0x306f, 0x306f, 0x3072, 0x3072, 0x3072, 0x3075, 0x3075, 0x3075, 0x3078, 0x3078, 0x3078, 0x307b, 0x307b, 0x307b, 0x307E, 0x307F,  // 3070
53 	0x3080, 0x3081, 0x3082, 0x3084, 0x3084, 0x3086, 0x3086, 0x3088, 0x3088, 0x3089, 0x308a, 0x308b, 0x308c, 0x308d, 0x308f, 0x308f,  // 3080
54 	0x3090, 0x3091, 0x3092, 0x3093, 0x3046, 0x304b, 0x3051, 0x3097, 0x3098, 0x3099, 0x309a, 0x309b, 0x309c, 0x309d, 0x309e, 0x309f,  // 3090
55 	0x30a0, 0x3042, 0x3042, 0x3044, 0x3044, 0x3046, 0x3046, 0x3048, 0x3048, 0x304a, 0x304a, 0x304b, 0x304b, 0x304d, 0x304d, 0x304f,  // 30A0
56 	0x304f, 0x3051, 0x3051, 0x3053, 0x3053, 0x3055, 0x3055, 0x3057, 0x3057, 0x3059, 0x3059, 0x305b, 0x305b, 0x305d, 0x305d, 0x305f,  // 30B0
57 	0x305f, 0x3061, 0x3061, 0x3064, 0x3064, 0x3064, 0x3066, 0x3066, 0x3068, 0x3068, 0x306a, 0x306b, 0x306c, 0x306d, 0x306e, 0x306f,  // 30C0
58 	0x306f, 0x306f, 0x3072, 0x3072, 0x3072, 0x3075, 0x3075, 0x3075, 0x3078, 0x3078, 0x3078, 0x307b, 0x307b, 0x307b, 0x307e, 0x307f,  // 30D0
59 	0x3080, 0x3081, 0x3082, 0x3084, 0x3084, 0x3086, 0x3086, 0x3088, 0x3088, 0x3089, 0x308a, 0x308b, 0x308c, 0x308d, 0x308f, 0x308f,  // 30E0
60 	0x3090, 0x3091, 0x3092, 0x3093, 0x3046, 0x304b, 0x3051, 0x308f, 0x3090, 0x3091, 0x3092, 0x30FB, 0x30FC, 0x30FE, 0x30FE, 0x30FF,  // 30F0
61 
62 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FF00
63 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FF10
64 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FF20
65 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FF30
66 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FF40
67 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FF50
68 	0xFF60, 0xFF61, 0xFF62, 0xFF63, 0xFF64, 0xFF65, 0x3092, 0x3042, 0x3044, 0x3046, 0x3048, 0x304A, 0x3084, 0x3086, 0x3088, 0x3064,  // FF60
69 	0xFF70, 0x3042, 0x3044, 0x3046, 0x3048, 0x304A, 0x304B, 0x304D, 0x304F, 0x3051, 0x3053, 0x3055, 0x3057, 0x3059, 0x305B, 0x305D,  // FF70
70 	0x305F, 0x3061, 0x3064, 0x3066, 0x3068, 0x306A, 0x306B, 0x306C, 0x306D, 0x306E, 0x306F, 0x3072, 0x3075, 0x3078, 0x307B, 0x307E,  // FF80
71 	0x307F, 0x3080, 0x3081, 0x3082, 0x3084, 0x3086, 0x3088, 0x3089, 0x308A, 0x308B, 0x308C, 0x308D, 0x308F, 0x3093, 0xFF9E, 0xFF9F,  // FF90
72 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FFA0
73 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FFB0
74 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FFC0
75 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FFD0
76 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FFE0
77 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000   // FFF0
78 };
79 
80 
81 static sal_Unicode consonant[] = {
82 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // 3000
83 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // 3010
84 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // 3020
85 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // 3030
86 	0x3040, 0x3042, 0x3042, 0x3042, 0x3042, 0x3042, 0x3042, 0x3042, 0x3042, 0x3042, 0x3042, 0x304B, 0x304B, 0x304B, 0x304B, 0x304B,  // 3040
87 	0x304B, 0x304B, 0x304B, 0x304B, 0x304B, 0x3055, 0x3055, 0x3055, 0x3055, 0x3055, 0x3055, 0x3055, 0x3055, 0x3055, 0x3055, 0x305F,  // 3050
88 	0x305F, 0x305F, 0x305F, 0x305F, 0x305F, 0x305F, 0x305F, 0x305F, 0x305F, 0x305F, 0x306A, 0x306A, 0x306A, 0x306A, 0x306A, 0x306F,  // 3060
89 	0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x307E, 0x307E,  // 3070
90 	0x307E, 0x307E, 0x307E, 0x3084, 0x3084, 0x3084, 0x3084, 0x3084, 0x3084, 0x3089, 0x3089, 0x3089, 0x3089, 0x3089, 0x308F, 0x308F,  // 3080
91 	0x308F, 0x308F, 0x308F, 0x308F, 0x3042, 0x304B, 0x304B, 0x3097, 0x3098, 0x3099, 0x309A, 0x309B, 0x309C, 0x309D, 0x309E, 0x309F,  // 3090
92 	0x30a0, 0x3042, 0x3042, 0x3042, 0x3042, 0x3042, 0x3042, 0x3042, 0x3042, 0x3042, 0x3042, 0x304B, 0x304B, 0x304B, 0x304B, 0x304B,  // 30A0
93 	0x304B, 0x304B, 0x304B, 0x304B, 0x304B, 0x3055, 0x3055, 0x3055, 0x3055, 0x3055, 0x3055, 0x3055, 0x3055, 0x3055, 0x3055, 0x305F,  // 30B0
94 	0x305F, 0x305F, 0x305F, 0x305F, 0x305F, 0x305F, 0x305F, 0x305F, 0x305F, 0x305F, 0x306A, 0x306A, 0x306A, 0x306A, 0x306A, 0x306F,  // 30C0
95 	0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x307E, 0x307E,  // 30D0
96 	0x307E, 0x307E, 0x307E, 0x3084, 0x3084, 0x3084, 0x3084, 0x3084, 0x3084, 0x3089, 0x3089, 0x3089, 0x3089, 0x3089, 0x308F, 0x308F,  // 30E0
97 	0x308F, 0x308F, 0x308F, 0x308F, 0x3042, 0x304B, 0x304B, 0x308F, 0x308F, 0x308F, 0x308F, 0x30FB, 0x30FC, 0x30FD, 0x30FE, 0x30FF,  // 30F0
98 
99 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FF00
100 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FF10
101 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FF20
102 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FF30
103 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FF40
104 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FF50
105 	0xFF60, 0xFF61, 0xFF62, 0xFF63, 0xFF64, 0xFF65, 0x308F, 0x3042, 0x3042, 0x3042, 0x3042, 0x3042, 0x3084, 0x3084, 0x3084, 0x305F,  // FF60
106 	0xFF70, 0x3042, 0x3042, 0x3042, 0x3042, 0x3042, 0x304B, 0x304B, 0x304B, 0x304B, 0x304B, 0x3055, 0x3055, 0x3055, 0x3055, 0x3055,  // FF70
107 	0x305F, 0x305F, 0x305F, 0x305F, 0x305F, 0x306A, 0x306A, 0x306A, 0x306A, 0x306A, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x307E,  // FF80
108 	0x307E, 0x307E, 0x307E, 0x307E, 0x3084, 0x3084, 0x3084, 0x3089, 0x3089, 0x3089, 0x3089, 0x3089, 0x308F, 0x308F, 0xFF9E, 0xFF9F,  // FF90
109 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FFA0
110 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FFB0
111 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FFC0
112 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FFD0
113 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FFE0
114 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000   // FFF0
115 };
116 
117