1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* COPYRIGHT AND PERMISSION NOTICE
*
* Copyright (c) 1991-2005 Unicode, Inc. All rights reserved. Distributed
* under the Terms of Use in http://www.unicode.org/copyright.html.
*
* This file has been modified by Sun Microsystems, Inc.
*
*/
/*
* Copyright(c) 2008 Sun Microsystems, Inc.
* All rights reserved.
*/
#ifndef _VI_COMBINE_H_
#define _VI_COMBINE_H_
#define VOWEL_NUM 24
/*
* Unicode of combining characters:
* 0x0300, 0x0301, 0x0303, 0x0309, 0x0323.
* */
typedef struct _combine_map {
unsigned short base;
unsigned short composed[5];
} Combine_map;
#define ISCOMB_UNI(uni) ((uni)>=0x0300 && (uni)<=0x0323)
/* Composition tables for each of the relevant combining characters. */
Combine_map vi_comb_data[VOWEL_NUM] = {
{ 0x0041, {0x00C0, 0x00C1, 0x00C3, 0x1EA2, 0x1EA0}},
{ 0x0045, {0x00C8, 0x00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, 0x1EE8, 0x1EEE, 0x1EEC, 0x1EF0}},
{ 0x01B0, {0x1EEB, 0x1EE9, 0x1EEF, 0x1EED, 0x1EF1}},
};
/* MASK_NUM = (0x01B0 - 0x0041) / 32(bit of unsigned int) + 1 */
#define MASK_NUM 12
/* Possible Compbine base make.
* The possible bases in vi_comb_data:
* 0x0041, 0x0045, 0x0049, 0x004F, 0x0055, 0x0059, 0x0061, 0x0065,
* 0x0069, 0x006F, 0x0075, 0x0079, 0x00C2, 0x00CA, 0x00D4, 0x00E2,
* 0x00EA, 0x00F4, 0x0102, 0x0103, 0x01A0, 0x01A1, 0x01AF, 0x01B0.
* */
static const unsigned long tcvn_comp_bases_mask[MASK_NUM] = {
0x02208222, 0x02208222, 0x00000000, 0x00000000,
0x00100404, 0x00100404, 0x0000000c, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00018003
};
/*
* TCVN code of combining characters:
* 0xb0...0xb4.
* */
typedef struct _combine_map_tcvn {
unsigned char base;
unsigned char composed[5];
} Combine_map_tcvn;
#define ISCOMB_TCVN(ch) ((ch)>=0xb0 && (ch)<=0xb4)
/* Composition tables for each of the relevant combining characters. */
Combine_map_tcvn tcvn_comb_data[VOWEL_NUM] = {
{0x41, { 0x80, 0x81, 0x82, 0x83, 0x84 }},
{0x45, { 0x87, 0x88, 0x89, 0x8a, 0x8b }},
{0x49, { 0x8d, 0x8e, 0x8f, 0x90, 0x91 }},
{0x4f, { 0x92, 0x93, 0x94, 0x95, 0x96 }},
{0x55, { 0x9d, 0x9e, 0x9f, 0x01, 0x02 }},
{0x59, { 0x13, 0x14, 0x15, 0x16, 0x17 }},
{0x61, { 0xb5, 0xb6, 0xb7, 0xb8, 0xb9 }},
{0x65, { 0xcc, 0xce, 0xcf, 0xd0, 0xd1 }},
{0x69, { 0xd7, 0xd8, 0xdc, 0xdd, 0xde }},
{0x6f, { 0xdf, 0xe1, 0xe2, 0xe3, 0xe4 }},
{0x75, { 0xef, 0xf1, 0xf2, 0xf3, 0xf4 }},
{0x79, { 0xfa, 0xfb, 0xfc, 0xfd, 0xfe }},
{0xa1, { 0xaf, 0xba, 0xbf, 0xc0, 0x85 }},
{0xa2, { 0xc1, 0xc2, 0xc3, 0xc4, 0x86 }},
{0xa3, { 0xc5, 0xcd, 0xd9, 0xda, 0x8c }},
{0xa4, { 0xdb, 0xe0, 0xf0, 0xff, 0x97 }},
{0xa5, { 0x98, 0x99, 0x9a, 0x9b, 0x9c }},
{0xa6, { 0x04, 0x05, 0x06, 0x11, 0x12 }},
{0xa8, { 0xbb, 0xbc, 0xbd, 0xbe, 0xc6 }},
{0xa9, { 0xc7, 0xc8, 0xc9, 0xca, 0xcb }},
{0xaa, { 0xd2, 0xd3, 0xd4, 0xd5, 0xd6 }},
{0xab, { 0xe5, 0xe6, 0xe7, 0xe8, 0xe9 }},
{0xac, { 0xea, 0xeb, 0xec, 0xed, 0xee }},
{0xad, { 0xf5, 0xf6, 0xf7, 0xf8, 0xf9 }},
};
/* MASK_NUM = (0xad - 0x40) / 32 (bit of unsigned int) + 1 */
#define MASK_NUM_TCVN 4
static const unsigned int tcvn_comp_bases_mask0[MASK_NUM_TCVN] = {
0x02208222, 0x02208222,
0x00000000, 0x00003f7e,
};
#endif
|