1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #include <sal/types.h>
28 
29 static sal_uInt16 idx[] = {
30 	0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,  // 0000
31 	0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,  // 1000
32 	0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,  // 2000
33 	0x0000, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 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xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,  // b000
42 	0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,  // c000
43 	0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,  // d000
44 	0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,  // e000
45 	0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x0100,  // f000
46 };
47 
48 static sal_Unicode syllable[] = {
49 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // 3000
50 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // 3010
51 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // 3020
52 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // 3030
53 	0x3040, 0x3042, 0x3042, 0x3044, 0x3044, 0x3046, 0x3046, 0x3048, 0x3048, 0x304a, 0x304a, 0x304b, 0x304b, 0x304d, 0x304d, 0x304f,  // 3040
54 	0x304f, 0x3051, 0x3051, 0x3053, 0x3053, 0x3055, 0x3055, 0x3057, 0x3057, 0x3059, 0x3059, 0x305b, 0x305b, 0x305d, 0x305d, 0x305f,  // 3050
55 	0x305f, 0x3061, 0x3061, 0x3064, 0x3064, 0x3064, 0x3066, 0x3066, 0x3068, 0x3068, 0x306a, 0x306b, 0x306c, 0x306d, 0x306e, 0x306f,  // 3060
56 	0x306f, 0x306f, 0x3072, 0x3072, 0x3072, 0x3075, 0x3075, 0x3075, 0x3078, 0x3078, 0x3078, 0x307b, 0x307b, 0x307b, 0x307E, 0x307F,  // 3070
57 	0x3080, 0x3081, 0x3082, 0x3084, 0x3084, 0x3086, 0x3086, 0x3088, 0x3088, 0x3089, 0x308a, 0x308b, 0x308c, 0x308d, 0x308f, 0x308f,  // 3080
58 	0x3090, 0x3091, 0x3092, 0x3093, 0x3046, 0x304b, 0x3051, 0x3097, 0x3098, 0x3099, 0x309a, 0x309b, 0x309c, 0x309d, 0x309e, 0x309f,  // 3090
59 	0x30a0, 0x3042, 0x3042, 0x3044, 0x3044, 0x3046, 0x3046, 0x3048, 0x3048, 0x304a, 0x304a, 0x304b, 0x304b, 0x304d, 0x304d, 0x304f,  // 30A0
60 	0x304f, 0x3051, 0x3051, 0x3053, 0x3053, 0x3055, 0x3055, 0x3057, 0x3057, 0x3059, 0x3059, 0x305b, 0x305b, 0x305d, 0x305d, 0x305f,  // 30B0
61 	0x305f, 0x3061, 0x3061, 0x3064, 0x3064, 0x3064, 0x3066, 0x3066, 0x3068, 0x3068, 0x306a, 0x306b, 0x306c, 0x306d, 0x306e, 0x306f,  // 30C0
62 	0x306f, 0x306f, 0x3072, 0x3072, 0x3072, 0x3075, 0x3075, 0x3075, 0x3078, 0x3078, 0x3078, 0x307b, 0x307b, 0x307b, 0x307e, 0x307f,  // 30D0
63 	0x3080, 0x3081, 0x3082, 0x3084, 0x3084, 0x3086, 0x3086, 0x3088, 0x3088, 0x3089, 0x308a, 0x308b, 0x308c, 0x308d, 0x308f, 0x308f,  // 30E0
64 	0x3090, 0x3091, 0x3092, 0x3093, 0x3046, 0x304b, 0x3051, 0x308f, 0x3090, 0x3091, 0x3092, 0x30FB, 0x30FC, 0x30FE, 0x30FE, 0x30FF,  // 30F0
65 
66 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FF00
67 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FF10
68 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FF20
69 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FF30
70 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FF40
71 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FF50
72 	0xFF60, 0xFF61, 0xFF62, 0xFF63, 0xFF64, 0xFF65, 0x3092, 0x3042, 0x3044, 0x3046, 0x3048, 0x304A, 0x3084, 0x3086, 0x3088, 0x3064,  // FF60
73 	0xFF70, 0x3042, 0x3044, 0x3046, 0x3048, 0x304A, 0x304B, 0x304D, 0x304F, 0x3051, 0x3053, 0x3055, 0x3057, 0x3059, 0x305B, 0x305D,  // FF70
74 	0x305F, 0x3061, 0x3064, 0x3066, 0x3068, 0x306A, 0x306B, 0x306C, 0x306D, 0x306E, 0x306F, 0x3072, 0x3075, 0x3078, 0x307B, 0x307E,  // FF80
75 	0x307F, 0x3080, 0x3081, 0x3082, 0x3084, 0x3086, 0x3088, 0x3089, 0x308A, 0x308B, 0x308C, 0x308D, 0x308F, 0x3093, 0xFF9E, 0xFF9F,  // FF90
76 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FFA0
77 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FFB0
78 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FFC0
79 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FFD0
80 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FFE0
81 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000   // FFF0
82 };
83 
84 
85 static sal_Unicode consonant[] = {
86 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // 3000
87 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // 3010
88 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // 3020
89 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // 3030
90 	0x3040, 0x3042, 0x3042, 0x3042, 0x3042, 0x3042, 0x3042, 0x3042, 0x3042, 0x3042, 0x3042, 0x304B, 0x304B, 0x304B, 0x304B, 0x304B,  // 3040
91 	0x304B, 0x304B, 0x304B, 0x304B, 0x304B, 0x3055, 0x3055, 0x3055, 0x3055, 0x3055, 0x3055, 0x3055, 0x3055, 0x3055, 0x3055, 0x305F,  // 3050
92 	0x305F, 0x305F, 0x305F, 0x305F, 0x305F, 0x305F, 0x305F, 0x305F, 0x305F, 0x305F, 0x306A, 0x306A, 0x306A, 0x306A, 0x306A, 0x306F,  // 3060
93 	0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x307E, 0x307E,  // 3070
94 	0x307E, 0x307E, 0x307E, 0x3084, 0x3084, 0x3084, 0x3084, 0x3084, 0x3084, 0x3089, 0x3089, 0x3089, 0x3089, 0x3089, 0x308F, 0x308F,  // 3080
95 	0x308F, 0x308F, 0x308F, 0x308F, 0x3042, 0x304B, 0x304B, 0x3097, 0x3098, 0x3099, 0x309A, 0x309B, 0x309C, 0x309D, 0x309E, 0x309F,  // 3090
96 	0x30a0, 0x3042, 0x3042, 0x3042, 0x3042, 0x3042, 0x3042, 0x3042, 0x3042, 0x3042, 0x3042, 0x304B, 0x304B, 0x304B, 0x304B, 0x304B,  // 30A0
97 	0x304B, 0x304B, 0x304B, 0x304B, 0x304B, 0x3055, 0x3055, 0x3055, 0x3055, 0x3055, 0x3055, 0x3055, 0x3055, 0x3055, 0x3055, 0x305F,  // 30B0
98 	0x305F, 0x305F, 0x305F, 0x305F, 0x305F, 0x305F, 0x305F, 0x305F, 0x305F, 0x305F, 0x306A, 0x306A, 0x306A, 0x306A, 0x306A, 0x306F,  // 30C0
99 	0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x307E, 0x307E,  // 30D0
100 	0x307E, 0x307E, 0x307E, 0x3084, 0x3084, 0x3084, 0x3084, 0x3084, 0x3084, 0x3089, 0x3089, 0x3089, 0x3089, 0x3089, 0x308F, 0x308F,  // 30E0
101 	0x308F, 0x308F, 0x308F, 0x308F, 0x3042, 0x304B, 0x304B, 0x308F, 0x308F, 0x308F, 0x308F, 0x30FB, 0x30FC, 0x30FD, 0x30FE, 0x30FF,  // 30F0
102 
103 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FF00
104 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FF10
105 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FF20
106 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FF30
107 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FF40
108 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FF50
109 	0xFF60, 0xFF61, 0xFF62, 0xFF63, 0xFF64, 0xFF65, 0x308F, 0x3042, 0x3042, 0x3042, 0x3042, 0x3042, 0x3084, 0x3084, 0x3084, 0x305F,  // FF60
110 	0xFF70, 0x3042, 0x3042, 0x3042, 0x3042, 0x3042, 0x304B, 0x304B, 0x304B, 0x304B, 0x304B, 0x3055, 0x3055, 0x3055, 0x3055, 0x3055,  // FF70
111 	0x305F, 0x305F, 0x305F, 0x305F, 0x305F, 0x306A, 0x306A, 0x306A, 0x306A, 0x306A, 0x306F, 0x306F, 0x306F, 0x306F, 0x306F, 0x307E,  // FF80
112 	0x307E, 0x307E, 0x307E, 0x307E, 0x3084, 0x3084, 0x3084, 0x3089, 0x3089, 0x3089, 0x3089, 0x3089, 0x308F, 0x308F, 0xFF9E, 0xFF9F,  // FF90
113 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FFA0
114 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FFB0
115 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FFC0
116 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FFD0
117 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // FFE0
118 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000   // FFF0
119 };
120 
121