Mercurial > vim
annotate src/arabic.c @ 12945:ffe901f0ba65
Added tag v8.0.1348 for changeset 2d54f1e7ba0fa718b6c88a833982ea59d9ceb5ea
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 26 Nov 2017 17:30:06 +0100 |
parents | 3fa27b97d263 |
children | 27b9a84395b5 |
rev | line source |
---|---|
10042
4aead6a9b7a9
commit https://github.com/vim/vim/commit/edf3f97ae2af024708ebb4ac614227327033ca47
Christian Brabandt <cb@256bit.org>
parents:
9403
diff
changeset
|
1 /* vi:set ts=8 sts=4 sw=4 noet: |
7 | 2 * |
3 * VIM - Vi IMproved by Bram Moolenaar | |
4 * | |
5 * Do ":help uganda" in Vim to read copying and usage conditions. | |
6 * Do ":help credits" in Vim to see a list of people who contributed. | |
7 * See README.txt for an overview of the Vim source code. | |
8 */ | |
9 | |
10 /* | |
11 * arabic.c: functions for Arabic language | |
12 * | |
13 * Author: Nadim Shaikli & Isam Bayazidi | |
14 */ | |
15 | |
9403
9b048dced116
commit https://github.com/vim/vim/commit/75464dc434c43efac60e8bfd9bec2a8b736407e9
Christian Brabandt <cb@256bit.org>
parents:
7817
diff
changeset
|
16 #include "vim.h" |
9b048dced116
commit https://github.com/vim/vim/commit/75464dc434c43efac60e8bfd9bec2a8b736407e9
Christian Brabandt <cb@256bit.org>
parents:
7817
diff
changeset
|
17 |
9b048dced116
commit https://github.com/vim/vim/commit/75464dc434c43efac60e8bfd9bec2a8b736407e9
Christian Brabandt <cb@256bit.org>
parents:
7817
diff
changeset
|
18 #if defined(FEAT_ARABIC) || defined(PROTO) |
9b048dced116
commit https://github.com/vim/vim/commit/75464dc434c43efac60e8bfd9bec2a8b736407e9
Christian Brabandt <cb@256bit.org>
parents:
7817
diff
changeset
|
19 |
7799
af3c41a3c53f
commit https://github.com/vim/vim/commit/f28dbcea371b3a35727d91afc90fb90e0527d78a
Christian Brabandt <cb@256bit.org>
parents:
3549
diff
changeset
|
20 static int A_is_a(int cur_c); |
af3c41a3c53f
commit https://github.com/vim/vim/commit/f28dbcea371b3a35727d91afc90fb90e0527d78a
Christian Brabandt <cb@256bit.org>
parents:
3549
diff
changeset
|
21 static int A_is_s(int cur_c); |
af3c41a3c53f
commit https://github.com/vim/vim/commit/f28dbcea371b3a35727d91afc90fb90e0527d78a
Christian Brabandt <cb@256bit.org>
parents:
3549
diff
changeset
|
22 static int A_is_f(int cur_c); |
af3c41a3c53f
commit https://github.com/vim/vim/commit/f28dbcea371b3a35727d91afc90fb90e0527d78a
Christian Brabandt <cb@256bit.org>
parents:
3549
diff
changeset
|
23 static int chg_c_a2s(int cur_c); |
af3c41a3c53f
commit https://github.com/vim/vim/commit/f28dbcea371b3a35727d91afc90fb90e0527d78a
Christian Brabandt <cb@256bit.org>
parents:
3549
diff
changeset
|
24 static int chg_c_a2i(int cur_c); |
af3c41a3c53f
commit https://github.com/vim/vim/commit/f28dbcea371b3a35727d91afc90fb90e0527d78a
Christian Brabandt <cb@256bit.org>
parents:
3549
diff
changeset
|
25 static int chg_c_a2m(int cur_c); |
af3c41a3c53f
commit https://github.com/vim/vim/commit/f28dbcea371b3a35727d91afc90fb90e0527d78a
Christian Brabandt <cb@256bit.org>
parents:
3549
diff
changeset
|
26 static int chg_c_a2f(int cur_c); |
11221
3fa27b97d263
patch 8.0.0497: arabic support is not fully tested
Christian Brabandt <cb@256bit.org>
parents:
11034
diff
changeset
|
27 #if 0 |
7799
af3c41a3c53f
commit https://github.com/vim/vim/commit/f28dbcea371b3a35727d91afc90fb90e0527d78a
Christian Brabandt <cb@256bit.org>
parents:
3549
diff
changeset
|
28 static int chg_c_i2m(int cur_c); |
11221
3fa27b97d263
patch 8.0.0497: arabic support is not fully tested
Christian Brabandt <cb@256bit.org>
parents:
11034
diff
changeset
|
29 #endif |
7799
af3c41a3c53f
commit https://github.com/vim/vim/commit/f28dbcea371b3a35727d91afc90fb90e0527d78a
Christian Brabandt <cb@256bit.org>
parents:
3549
diff
changeset
|
30 static int chg_c_f2m(int cur_c); |
af3c41a3c53f
commit https://github.com/vim/vim/commit/f28dbcea371b3a35727d91afc90fb90e0527d78a
Christian Brabandt <cb@256bit.org>
parents:
3549
diff
changeset
|
31 static int chg_c_laa2i(int hid_c); |
af3c41a3c53f
commit https://github.com/vim/vim/commit/f28dbcea371b3a35727d91afc90fb90e0527d78a
Christian Brabandt <cb@256bit.org>
parents:
3549
diff
changeset
|
32 static int chg_c_laa2f(int hid_c); |
af3c41a3c53f
commit https://github.com/vim/vim/commit/f28dbcea371b3a35727d91afc90fb90e0527d78a
Christian Brabandt <cb@256bit.org>
parents:
3549
diff
changeset
|
33 static int half_shape(int c); |
af3c41a3c53f
commit https://github.com/vim/vim/commit/f28dbcea371b3a35727d91afc90fb90e0527d78a
Christian Brabandt <cb@256bit.org>
parents:
3549
diff
changeset
|
34 static int A_firstc_laa(int c1, int c); |
af3c41a3c53f
commit https://github.com/vim/vim/commit/f28dbcea371b3a35727d91afc90fb90e0527d78a
Christian Brabandt <cb@256bit.org>
parents:
3549
diff
changeset
|
35 static int A_is_harakat(int c); |
af3c41a3c53f
commit https://github.com/vim/vim/commit/f28dbcea371b3a35727d91afc90fb90e0527d78a
Christian Brabandt <cb@256bit.org>
parents:
3549
diff
changeset
|
36 static int A_is_iso(int c); |
af3c41a3c53f
commit https://github.com/vim/vim/commit/f28dbcea371b3a35727d91afc90fb90e0527d78a
Christian Brabandt <cb@256bit.org>
parents:
3549
diff
changeset
|
37 static int A_is_formb(int c); |
af3c41a3c53f
commit https://github.com/vim/vim/commit/f28dbcea371b3a35727d91afc90fb90e0527d78a
Christian Brabandt <cb@256bit.org>
parents:
3549
diff
changeset
|
38 static int A_is_ok(int c); |
af3c41a3c53f
commit https://github.com/vim/vim/commit/f28dbcea371b3a35727d91afc90fb90e0527d78a
Christian Brabandt <cb@256bit.org>
parents:
3549
diff
changeset
|
39 static int A_is_valid(int c); |
af3c41a3c53f
commit https://github.com/vim/vim/commit/f28dbcea371b3a35727d91afc90fb90e0527d78a
Christian Brabandt <cb@256bit.org>
parents:
3549
diff
changeset
|
40 static int A_is_special(int c); |
7 | 41 |
42 | |
43 /* | |
44 * Returns True if c is an ISO-8859-6 shaped ARABIC letter (user entered) | |
45 */ | |
46 static int | |
7817
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
47 A_is_a(int cur_c) |
7 | 48 { |
49 switch (cur_c) | |
50 { | |
51 case a_HAMZA: | |
52 case a_ALEF_MADDA: | |
53 case a_ALEF_HAMZA_ABOVE: | |
54 case a_WAW_HAMZA: | |
55 case a_ALEF_HAMZA_BELOW: | |
56 case a_YEH_HAMZA: | |
57 case a_ALEF: | |
58 case a_BEH: | |
59 case a_TEH_MARBUTA: | |
60 case a_TEH: | |
61 case a_THEH: | |
62 case a_JEEM: | |
63 case a_HAH: | |
64 case a_KHAH: | |
65 case a_DAL: | |
66 case a_THAL: | |
67 case a_REH: | |
68 case a_ZAIN: | |
69 case a_SEEN: | |
70 case a_SHEEN: | |
71 case a_SAD: | |
72 case a_DAD: | |
73 case a_TAH: | |
74 case a_ZAH: | |
75 case a_AIN: | |
76 case a_GHAIN: | |
77 case a_TATWEEL: | |
78 case a_FEH: | |
79 case a_QAF: | |
80 case a_KAF: | |
81 case a_LAM: | |
82 case a_MEEM: | |
83 case a_NOON: | |
84 case a_HEH: | |
85 case a_WAW: | |
86 case a_ALEF_MAKSURA: | |
87 case a_YEH: | |
88 return TRUE; | |
89 } | |
90 | |
91 return FALSE; | |
92 } | |
93 | |
94 | |
95 /* | |
96 * Returns True if c is an Isolated Form-B ARABIC letter | |
97 */ | |
98 static int | |
7817
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
99 A_is_s(int cur_c) |
7 | 100 { |
101 switch (cur_c) | |
102 { | |
103 case a_s_HAMZA: | |
104 case a_s_ALEF_MADDA: | |
105 case a_s_ALEF_HAMZA_ABOVE: | |
106 case a_s_WAW_HAMZA: | |
107 case a_s_ALEF_HAMZA_BELOW: | |
108 case a_s_YEH_HAMZA: | |
109 case a_s_ALEF: | |
110 case a_s_BEH: | |
111 case a_s_TEH_MARBUTA: | |
112 case a_s_TEH: | |
113 case a_s_THEH: | |
114 case a_s_JEEM: | |
115 case a_s_HAH: | |
116 case a_s_KHAH: | |
117 case a_s_DAL: | |
118 case a_s_THAL: | |
119 case a_s_REH: | |
120 case a_s_ZAIN: | |
121 case a_s_SEEN: | |
122 case a_s_SHEEN: | |
123 case a_s_SAD: | |
124 case a_s_DAD: | |
125 case a_s_TAH: | |
126 case a_s_ZAH: | |
127 case a_s_AIN: | |
128 case a_s_GHAIN: | |
129 case a_s_FEH: | |
130 case a_s_QAF: | |
131 case a_s_KAF: | |
132 case a_s_LAM: | |
133 case a_s_MEEM: | |
134 case a_s_NOON: | |
135 case a_s_HEH: | |
136 case a_s_WAW: | |
137 case a_s_ALEF_MAKSURA: | |
138 case a_s_YEH: | |
139 return TRUE; | |
140 } | |
141 | |
142 return FALSE; | |
143 } | |
144 | |
145 | |
146 /* | |
147 * Returns True if c is a Final shape of an ARABIC letter | |
148 */ | |
149 static int | |
7817
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
150 A_is_f(int cur_c) |
7 | 151 { |
152 switch (cur_c) | |
153 { | |
154 case a_f_ALEF_MADDA: | |
155 case a_f_ALEF_HAMZA_ABOVE: | |
156 case a_f_WAW_HAMZA: | |
157 case a_f_ALEF_HAMZA_BELOW: | |
158 case a_f_YEH_HAMZA: | |
159 case a_f_ALEF: | |
160 case a_f_BEH: | |
161 case a_f_TEH_MARBUTA: | |
162 case a_f_TEH: | |
163 case a_f_THEH: | |
164 case a_f_JEEM: | |
165 case a_f_HAH: | |
166 case a_f_KHAH: | |
167 case a_f_DAL: | |
168 case a_f_THAL: | |
169 case a_f_REH: | |
170 case a_f_ZAIN: | |
171 case a_f_SEEN: | |
172 case a_f_SHEEN: | |
173 case a_f_SAD: | |
174 case a_f_DAD: | |
175 case a_f_TAH: | |
176 case a_f_ZAH: | |
177 case a_f_AIN: | |
178 case a_f_GHAIN: | |
179 case a_f_FEH: | |
180 case a_f_QAF: | |
181 case a_f_KAF: | |
182 case a_f_LAM: | |
183 case a_f_MEEM: | |
184 case a_f_NOON: | |
185 case a_f_HEH: | |
186 case a_f_WAW: | |
187 case a_f_ALEF_MAKSURA: | |
188 case a_f_YEH: | |
189 case a_f_LAM_ALEF_MADDA_ABOVE: | |
190 case a_f_LAM_ALEF_HAMZA_ABOVE: | |
191 case a_f_LAM_ALEF_HAMZA_BELOW: | |
192 case a_f_LAM_ALEF: | |
193 return TRUE; | |
194 } | |
195 return FALSE; | |
196 } | |
197 | |
198 | |
199 /* | |
200 * Change shape - from ISO-8859-6/Isolated to Form-B Isolated | |
201 */ | |
202 static int | |
7817
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
203 chg_c_a2s(int cur_c) |
7 | 204 { |
205 switch (cur_c) | |
206 { | |
11004
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
207 case a_HAMZA: return a_s_HAMZA; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
208 case a_ALEF_MADDA: return a_s_ALEF_MADDA; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
209 case a_ALEF_HAMZA_ABOVE: return a_s_ALEF_HAMZA_ABOVE; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
210 case a_WAW_HAMZA: return a_s_WAW_HAMZA; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
211 case a_ALEF_HAMZA_BELOW: return a_s_ALEF_HAMZA_BELOW; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
212 case a_YEH_HAMZA: return a_s_YEH_HAMZA; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
213 case a_ALEF: return a_s_ALEF; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
214 case a_TEH_MARBUTA: return a_s_TEH_MARBUTA; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
215 case a_DAL: return a_s_DAL; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
216 case a_THAL: return a_s_THAL; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
217 case a_REH: return a_s_REH; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
218 case a_ZAIN: return a_s_ZAIN; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
219 case a_TATWEEL: return cur_c; /* exceptions */ |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
220 case a_WAW: return a_s_WAW; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
221 case a_ALEF_MAKSURA: return a_s_ALEF_MAKSURA; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
222 case a_BEH: return a_s_BEH; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
223 case a_TEH: return a_s_TEH; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
224 case a_THEH: return a_s_THEH; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
225 case a_JEEM: return a_s_JEEM; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
226 case a_HAH: return a_s_HAH; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
227 case a_KHAH: return a_s_KHAH; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
228 case a_SEEN: return a_s_SEEN; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
229 case a_SHEEN: return a_s_SHEEN; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
230 case a_SAD: return a_s_SAD; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
231 case a_DAD: return a_s_DAD; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
232 case a_TAH: return a_s_TAH; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
233 case a_ZAH: return a_s_ZAH; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
234 case a_AIN: return a_s_AIN; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
235 case a_GHAIN: return a_s_GHAIN; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
236 case a_FEH: return a_s_FEH; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
237 case a_QAF: return a_s_QAF; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
238 case a_KAF: return a_s_KAF; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
239 case a_LAM: return a_s_LAM; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
240 case a_MEEM: return a_s_MEEM; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
241 case a_NOON: return a_s_NOON; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
242 case a_HEH: return a_s_HEH; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
243 case a_YEH: return a_s_YEH; |
7 | 244 } |
11004
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
245 return 0; |
7 | 246 } |
247 | |
248 | |
249 /* | |
250 * Change shape - from ISO-8859-6/Isolated to Initial | |
251 */ | |
252 static int | |
7817
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
253 chg_c_a2i(int cur_c) |
7 | 254 { |
255 switch (cur_c) | |
256 { | |
11004
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
257 case a_YEH_HAMZA: return a_i_YEH_HAMZA; |
7 | 258 case a_HAMZA: /* exceptions */ |
11004
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
259 return a_s_HAMZA; |
7 | 260 case a_ALEF_MADDA: /* exceptions */ |
11004
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
261 return a_s_ALEF_MADDA; |
7 | 262 case a_ALEF_HAMZA_ABOVE: /* exceptions */ |
11004
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
263 return a_s_ALEF_HAMZA_ABOVE; |
7 | 264 case a_WAW_HAMZA: /* exceptions */ |
11004
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
265 return a_s_WAW_HAMZA; |
7 | 266 case a_ALEF_HAMZA_BELOW: /* exceptions */ |
11004
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
267 return a_s_ALEF_HAMZA_BELOW; |
7 | 268 case a_ALEF: /* exceptions */ |
11004
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
269 return a_s_ALEF; |
7 | 270 case a_TEH_MARBUTA: /* exceptions */ |
11004
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
271 return a_s_TEH_MARBUTA; |
7 | 272 case a_DAL: /* exceptions */ |
11004
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
273 return a_s_DAL; |
7 | 274 case a_THAL: /* exceptions */ |
11004
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
275 return a_s_THAL; |
7 | 276 case a_REH: /* exceptions */ |
11004
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
277 return a_s_REH; |
7 | 278 case a_ZAIN: /* exceptions */ |
11004
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
279 return a_s_ZAIN; |
7 | 280 case a_TATWEEL: /* exceptions */ |
11004
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
281 return cur_c; |
7 | 282 case a_WAW: /* exceptions */ |
11004
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
283 return a_s_WAW; |
7 | 284 case a_ALEF_MAKSURA: /* exceptions */ |
11004
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
285 return a_s_ALEF_MAKSURA; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
286 case a_BEH: return a_i_BEH; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
287 case a_TEH: return a_i_TEH; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
288 case a_THEH: return a_i_THEH; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
289 case a_JEEM: return a_i_JEEM; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
290 case a_HAH: return a_i_HAH; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
291 case a_KHAH: return a_i_KHAH; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
292 case a_SEEN: return a_i_SEEN; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
293 case a_SHEEN: return a_i_SHEEN; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
294 case a_SAD: return a_i_SAD; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
295 case a_DAD: return a_i_DAD; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
296 case a_TAH: return a_i_TAH; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
297 case a_ZAH: return a_i_ZAH; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
298 case a_AIN: return a_i_AIN; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
299 case a_GHAIN: return a_i_GHAIN; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
300 case a_FEH: return a_i_FEH; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
301 case a_QAF: return a_i_QAF; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
302 case a_KAF: return a_i_KAF; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
303 case a_LAM: return a_i_LAM; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
304 case a_MEEM: return a_i_MEEM; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
305 case a_NOON: return a_i_NOON; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
306 case a_HEH: return a_i_HEH; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
307 case a_YEH: return a_i_YEH; |
7 | 308 } |
11004
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
309 return 0; |
7 | 310 } |
311 | |
312 | |
313 /* | |
314 * Change shape - from ISO-8859-6/Isolated to Medial | |
315 */ | |
316 static int | |
7817
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
317 chg_c_a2m(int cur_c) |
7 | 318 { |
319 switch (cur_c) | |
320 { | |
11004
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
321 case a_HAMZA: return a_s_HAMZA; /* exception */ |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
322 case a_ALEF_MADDA: return a_f_ALEF_MADDA; /* exception */ |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
323 case a_ALEF_HAMZA_ABOVE: return a_f_ALEF_HAMZA_ABOVE; /* exception */ |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
324 case a_WAW_HAMZA: return a_f_WAW_HAMZA; /* exception */ |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
325 case a_ALEF_HAMZA_BELOW: return a_f_ALEF_HAMZA_BELOW; /* exception */ |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
326 case a_YEH_HAMZA: return a_m_YEH_HAMZA; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
327 case a_ALEF: return a_f_ALEF; /* exception */ |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
328 case a_BEH: return a_m_BEH; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
329 case a_TEH_MARBUTA: return a_f_TEH_MARBUTA; /* exception */ |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
330 case a_TEH: return a_m_TEH; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
331 case a_THEH: return a_m_THEH; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
332 case a_JEEM: return a_m_JEEM; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
333 case a_HAH: return a_m_HAH; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
334 case a_KHAH: return a_m_KHAH; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
335 case a_DAL: return a_f_DAL; /* exception */ |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
336 case a_THAL: return a_f_THAL; /* exception */ |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
337 case a_REH: return a_f_REH; /* exception */ |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
338 case a_ZAIN: return a_f_ZAIN; /* exception */ |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
339 case a_SEEN: return a_m_SEEN; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
340 case a_SHEEN: return a_m_SHEEN; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
341 case a_SAD: return a_m_SAD; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
342 case a_DAD: return a_m_DAD; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
343 case a_TAH: return a_m_TAH; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
344 case a_ZAH: return a_m_ZAH; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
345 case a_AIN: return a_m_AIN; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
346 case a_GHAIN: return a_m_GHAIN; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
347 case a_TATWEEL: return cur_c; /* exception */ |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
348 case a_FEH: return a_m_FEH; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
349 case a_QAF: return a_m_QAF; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
350 case a_KAF: return a_m_KAF; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
351 case a_LAM: return a_m_LAM; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
352 case a_MEEM: return a_m_MEEM; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
353 case a_NOON: return a_m_NOON; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
354 case a_HEH: return a_m_HEH; |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
355 case a_WAW: return a_f_WAW; /* exception */ |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
356 case a_ALEF_MAKSURA: return a_f_ALEF_MAKSURA; /* exception */ |
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
357 case a_YEH: return a_m_YEH; |
7 | 358 } |
11004
f91d4c95b696
patch 8.0.0391: arabic support is verbose and not well tested
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
359 return 0; |
7 | 360 } |
361 | |
362 | |
363 /* | |
364 * Change shape - from ISO-8859-6/Isolated to final | |
365 */ | |
366 static int | |
7817
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
367 chg_c_a2f(int cur_c) |
7 | 368 { |
369 /* NOTE: these encodings need to be accounted for | |
11034
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
370 * a_f_ALEF_MADDA; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
371 * a_f_ALEF_HAMZA_ABOVE; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
372 * a_f_ALEF_HAMZA_BELOW; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
373 * a_f_LAM_ALEF_MADDA_ABOVE; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
374 * a_f_LAM_ALEF_HAMZA_ABOVE; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
375 * a_f_LAM_ALEF_HAMZA_BELOW; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
376 */ |
7 | 377 switch (cur_c) |
378 { | |
11034
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
379 case a_HAMZA: return a_s_HAMZA; /* exception */ |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
380 case a_ALEF_MADDA: return a_f_ALEF_MADDA; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
381 case a_ALEF_HAMZA_ABOVE: return a_f_ALEF_HAMZA_ABOVE; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
382 case a_WAW_HAMZA: return a_f_WAW_HAMZA; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
383 case a_ALEF_HAMZA_BELOW: return a_f_ALEF_HAMZA_BELOW; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
384 case a_YEH_HAMZA: return a_f_YEH_HAMZA; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
385 case a_ALEF: return a_f_ALEF; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
386 case a_BEH: return a_f_BEH; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
387 case a_TEH_MARBUTA: return a_f_TEH_MARBUTA; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
388 case a_TEH: return a_f_TEH; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
389 case a_THEH: return a_f_THEH; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
390 case a_JEEM: return a_f_JEEM; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
391 case a_HAH: return a_f_HAH; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
392 case a_KHAH: return a_f_KHAH; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
393 case a_DAL: return a_f_DAL; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
394 case a_THAL: return a_f_THAL; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
395 case a_REH: return a_f_REH; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
396 case a_ZAIN: return a_f_ZAIN; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
397 case a_SEEN: return a_f_SEEN; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
398 case a_SHEEN: return a_f_SHEEN; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
399 case a_SAD: return a_f_SAD; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
400 case a_DAD: return a_f_DAD; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
401 case a_TAH: return a_f_TAH; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
402 case a_ZAH: return a_f_ZAH; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
403 case a_AIN: return a_f_AIN; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
404 case a_GHAIN: return a_f_GHAIN; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
405 case a_TATWEEL: return cur_c; /* exception */ |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
406 case a_FEH: return a_f_FEH; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
407 case a_QAF: return a_f_QAF; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
408 case a_KAF: return a_f_KAF; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
409 case a_LAM: return a_f_LAM; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
410 case a_MEEM: return a_f_MEEM; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
411 case a_NOON: return a_f_NOON; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
412 case a_HEH: return a_f_HEH; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
413 case a_WAW: return a_f_WAW; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
414 case a_ALEF_MAKSURA: return a_f_ALEF_MAKSURA; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
415 case a_YEH: return a_f_YEH; |
7 | 416 } |
11034
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
417 return 0; |
7 | 418 } |
419 | |
420 | |
421 /* | |
422 * Change shape - from Initial to Medial | |
11221
3fa27b97d263
patch 8.0.0497: arabic support is not fully tested
Christian Brabandt <cb@256bit.org>
parents:
11034
diff
changeset
|
423 * This code is unreachable, because for the relevant characters ARABIC_CHAR() |
3fa27b97d263
patch 8.0.0497: arabic support is not fully tested
Christian Brabandt <cb@256bit.org>
parents:
11034
diff
changeset
|
424 * is FALSE; |
7 | 425 */ |
11221
3fa27b97d263
patch 8.0.0497: arabic support is not fully tested
Christian Brabandt <cb@256bit.org>
parents:
11034
diff
changeset
|
426 #if 0 |
7 | 427 static int |
7817
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
428 chg_c_i2m(int cur_c) |
7 | 429 { |
430 switch (cur_c) | |
431 { | |
11034
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
432 case a_i_YEH_HAMZA: return a_m_YEH_HAMZA; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
433 case a_i_BEH: return a_m_BEH; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
434 case a_i_TEH: return a_m_TEH; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
435 case a_i_THEH: return a_m_THEH; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
436 case a_i_JEEM: return a_m_JEEM; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
437 case a_i_HAH: return a_m_HAH; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
438 case a_i_KHAH: return a_m_KHAH; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
439 case a_i_SEEN: return a_m_SEEN; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
440 case a_i_SHEEN: return a_m_SHEEN; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
441 case a_i_SAD: return a_m_SAD; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
442 case a_i_DAD: return a_m_DAD; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
443 case a_i_TAH: return a_m_TAH; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
444 case a_i_ZAH: return a_m_ZAH; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
445 case a_i_AIN: return a_m_AIN; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
446 case a_i_GHAIN: return a_m_GHAIN; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
447 case a_i_FEH: return a_m_FEH; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
448 case a_i_QAF: return a_m_QAF; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
449 case a_i_KAF: return a_m_KAF; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
450 case a_i_LAM: return a_m_LAM; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
451 case a_i_MEEM: return a_m_MEEM; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
452 case a_i_NOON: return a_m_NOON; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
453 case a_i_HEH: return a_m_HEH; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
454 case a_i_YEH: return a_m_YEH; |
7 | 455 } |
11034
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
456 return 0; |
7 | 457 } |
11221
3fa27b97d263
patch 8.0.0497: arabic support is not fully tested
Christian Brabandt <cb@256bit.org>
parents:
11034
diff
changeset
|
458 #endif |
7 | 459 |
460 | |
461 /* | |
462 * Change shape - from Final to Medial | |
463 */ | |
464 static int | |
7817
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
465 chg_c_f2m(int cur_c) |
7 | 466 { |
467 switch (cur_c) | |
468 { | |
469 /* NOTE: these encodings are multi-positional, no ? | |
11034
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
470 * case a_f_ALEF_MADDA: |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
471 * case a_f_ALEF_HAMZA_ABOVE: |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
472 * case a_f_ALEF_HAMZA_BELOW: |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
473 */ |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
474 case a_f_YEH_HAMZA: return a_m_YEH_HAMZA; |
7 | 475 case a_f_WAW_HAMZA: /* exceptions */ |
476 case a_f_ALEF: | |
477 case a_f_TEH_MARBUTA: | |
478 case a_f_DAL: | |
479 case a_f_THAL: | |
480 case a_f_REH: | |
481 case a_f_ZAIN: | |
482 case a_f_WAW: | |
483 case a_f_ALEF_MAKSURA: | |
11034
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
484 return cur_c; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
485 case a_f_BEH: return a_m_BEH; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
486 case a_f_TEH: return a_m_TEH; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
487 case a_f_THEH: return a_m_THEH; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
488 case a_f_JEEM: return a_m_JEEM; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
489 case a_f_HAH: return a_m_HAH; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
490 case a_f_KHAH: return a_m_KHAH; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
491 case a_f_SEEN: return a_m_SEEN; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
492 case a_f_SHEEN: return a_m_SHEEN; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
493 case a_f_SAD: return a_m_SAD; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
494 case a_f_DAD: return a_m_DAD; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
495 case a_f_TAH: return a_m_TAH; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
496 case a_f_ZAH: return a_m_ZAH; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
497 case a_f_AIN: return a_m_AIN; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
498 case a_f_GHAIN: return a_m_GHAIN; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
499 case a_f_FEH: return a_m_FEH; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
500 case a_f_QAF: return a_m_QAF; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
501 case a_f_KAF: return a_m_KAF; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
502 case a_f_LAM: return a_m_LAM; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
503 case a_f_MEEM: return a_m_MEEM; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
504 case a_f_NOON: return a_m_NOON; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
505 case a_f_HEH: return a_m_HEH; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
506 case a_f_YEH: return a_m_YEH; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
507 |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
508 /* NOTE: these encodings are multi-positional, no ? |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
509 * case a_f_LAM_ALEF_MADDA_ABOVE: |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
510 * case a_f_LAM_ALEF_HAMZA_ABOVE: |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
511 * case a_f_LAM_ALEF_HAMZA_BELOW: |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
512 * case a_f_LAM_ALEF: |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
513 */ |
7 | 514 } |
11034
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
515 return 0; |
7 | 516 } |
517 | |
518 | |
519 /* | |
520 * Change shape - from Combination (2 char) to an Isolated | |
521 */ | |
522 static int | |
7817
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
523 chg_c_laa2i(int hid_c) |
7 | 524 { |
525 switch (hid_c) | |
526 { | |
11034
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
527 case a_ALEF_MADDA: return a_s_LAM_ALEF_MADDA_ABOVE; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
528 case a_ALEF_HAMZA_ABOVE: return a_s_LAM_ALEF_HAMZA_ABOVE; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
529 case a_ALEF_HAMZA_BELOW: return a_s_LAM_ALEF_HAMZA_BELOW; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
530 case a_ALEF: return a_s_LAM_ALEF; |
7 | 531 } |
11034
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
532 return 0; |
7 | 533 } |
534 | |
535 | |
536 /* | |
537 * Change shape - from Combination-Isolated to Final | |
538 */ | |
539 static int | |
7817
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
540 chg_c_laa2f(int hid_c) |
7 | 541 { |
542 switch (hid_c) | |
543 { | |
11034
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
544 case a_ALEF_MADDA: return a_f_LAM_ALEF_MADDA_ABOVE; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
545 case a_ALEF_HAMZA_ABOVE: return a_f_LAM_ALEF_HAMZA_ABOVE; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
546 case a_ALEF_HAMZA_BELOW: return a_f_LAM_ALEF_HAMZA_BELOW; |
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
547 case a_ALEF: return a_f_LAM_ALEF; |
7 | 548 } |
11034
8ae6d6052b14
patch 8.0.0406: arabic shaping code is verbose
Christian Brabandt <cb@256bit.org>
parents:
11004
diff
changeset
|
549 return 0; |
7 | 550 } |
551 | |
552 /* | |
553 * Do "half-shaping" on character "c". Return zero if no shaping. | |
554 */ | |
555 static int | |
7817
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
556 half_shape(int c) |
7 | 557 { |
558 if (A_is_a(c)) | |
559 return chg_c_a2i(c); | |
560 if (A_is_valid(c) && A_is_f(c)) | |
561 return chg_c_f2m(c); | |
562 return 0; | |
563 } | |
564 | |
565 /* | |
566 * Do Arabic shaping on character "c". Returns the shaped character. | |
567 * out: "ccp" points to the first byte of the character to be shaped. | |
568 * in/out: "c1p" points to the first composing char for "c". | |
569 * in: "prev_c" is the previous character (not shaped) | |
570 * in: "prev_c1" is the first composing char for the previous char | |
571 * (not shaped) | |
572 * in: "next_c" is the next character (not shaped). | |
573 */ | |
574 int | |
7817
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
575 arabic_shape( |
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
576 int c, |
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
577 int *ccp, |
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
578 int *c1p, |
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
579 int prev_c, |
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
580 int prev_c1, |
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
581 int next_c) |
7 | 582 { |
583 int curr_c; | |
584 int shape_c; | |
585 int curr_laa; | |
586 int prev_laa; | |
587 | |
588 /* Deal only with Arabic character, pass back all others */ | |
589 if (!A_is_ok(c)) | |
590 return c; | |
591 | |
592 /* half-shape current and previous character */ | |
593 shape_c = half_shape(prev_c); | |
594 | |
595 /* Save away current character */ | |
596 curr_c = c; | |
597 | |
598 curr_laa = A_firstc_laa(c, *c1p); | |
599 prev_laa = A_firstc_laa(prev_c, prev_c1); | |
600 | |
601 if (curr_laa) | |
602 { | |
603 if (A_is_valid(prev_c) && !A_is_f(shape_c) | |
604 && !A_is_s(shape_c) && !prev_laa) | |
605 curr_c = chg_c_laa2f(curr_laa); | |
606 else | |
607 curr_c = chg_c_laa2i(curr_laa); | |
608 | |
609 /* Remove the composing character */ | |
610 *c1p = 0; | |
611 } | |
612 else if (!A_is_valid(prev_c) && A_is_valid(next_c)) | |
613 curr_c = chg_c_a2i(c); | |
614 else if (!shape_c || A_is_f(shape_c) || A_is_s(shape_c) || prev_laa) | |
615 curr_c = A_is_valid(next_c) ? chg_c_a2i(c) : chg_c_a2s(c); | |
616 else if (A_is_valid(next_c)) | |
11221
3fa27b97d263
patch 8.0.0497: arabic support is not fully tested
Christian Brabandt <cb@256bit.org>
parents:
11034
diff
changeset
|
617 #if 0 |
7 | 618 curr_c = A_is_iso(c) ? chg_c_a2m(c) : chg_c_i2m(c); |
11221
3fa27b97d263
patch 8.0.0497: arabic support is not fully tested
Christian Brabandt <cb@256bit.org>
parents:
11034
diff
changeset
|
619 #else |
3fa27b97d263
patch 8.0.0497: arabic support is not fully tested
Christian Brabandt <cb@256bit.org>
parents:
11034
diff
changeset
|
620 curr_c = A_is_iso(c) ? chg_c_a2m(c) : 0; |
3fa27b97d263
patch 8.0.0497: arabic support is not fully tested
Christian Brabandt <cb@256bit.org>
parents:
11034
diff
changeset
|
621 #endif |
7 | 622 else if (A_is_valid(prev_c)) |
623 curr_c = chg_c_a2f(c); | |
624 else | |
625 curr_c = chg_c_a2s(c); | |
626 | |
627 /* Sanity check -- curr_c should, in the future, never be 0. | |
628 * We should, in the future, insert a fatal error here. */ | |
629 if (curr_c == NUL) | |
630 curr_c = c; | |
631 | |
632 if (curr_c != c && ccp != NULL) | |
633 { | |
3549 | 634 char_u buf[MB_MAXBYTES + 1]; |
7 | 635 |
636 /* Update the first byte of the character. */ | |
637 (*mb_char2bytes)(curr_c, buf); | |
638 *ccp = buf[0]; | |
639 } | |
640 | |
641 /* Return the shaped character */ | |
642 return curr_c; | |
643 } | |
644 | |
645 | |
646 /* | |
647 * A_firstc_laa returns first character of LAA combination if it exists | |
648 */ | |
649 static int | |
7817
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
650 A_firstc_laa( |
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
651 int c, /* base character */ |
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
652 int c1) /* first composing character */ |
7 | 653 { |
654 if (c1 != NUL && c == a_LAM && !A_is_harakat(c1)) | |
655 return c1; | |
656 return 0; | |
657 } | |
658 | |
659 | |
660 /* | |
661 * A_is_harakat returns TRUE if 'c' is an Arabic Harakat character | |
662 * (harakat/tanween) | |
663 */ | |
664 static int | |
7817
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
665 A_is_harakat(int c) |
7 | 666 { |
667 return (c >= a_FATHATAN && c <= a_SUKUN); | |
668 } | |
669 | |
670 | |
671 /* | |
672 * A_is_iso returns TRUE if 'c' is an Arabic ISO-8859-6 character | |
673 * (alphabet/number/punctuation) | |
674 */ | |
675 static int | |
7817
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
676 A_is_iso(int c) |
7 | 677 { |
678 return ((c >= a_HAMZA && c <= a_GHAIN) | |
679 || (c >= a_TATWEEL && c <= a_HAMZA_BELOW) | |
680 || c == a_MINI_ALEF); | |
681 } | |
682 | |
683 | |
684 /* | |
685 * A_is_formb returns TRUE if 'c' is an Arabic 10646-1 FormB character | |
686 * (alphabet/number/punctuation) | |
687 */ | |
688 static int | |
7817
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
689 A_is_formb(int c) |
7 | 690 { |
691 return ((c >= a_s_FATHATAN && c <= a_s_DAMMATAN) | |
692 || c == a_s_KASRATAN | |
693 || (c >= a_s_FATHA && c <= a_f_LAM_ALEF) | |
694 || c == a_BYTE_ORDER_MARK); | |
695 } | |
696 | |
697 | |
698 /* | |
699 * A_is_ok returns TRUE if 'c' is an Arabic 10646 (8859-6 or Form-B) | |
700 */ | |
701 static int | |
7817
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
702 A_is_ok(int c) |
7 | 703 { |
704 return (A_is_iso(c) || A_is_formb(c)); | |
705 } | |
706 | |
707 | |
708 /* | |
709 * A_is_valid returns TRUE if 'c' is an Arabic 10646 (8859-6 or Form-B) | |
710 * with some exceptions/exclusions | |
711 */ | |
712 static int | |
7817
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
713 A_is_valid(int c) |
7 | 714 { |
715 return (A_is_ok(c) && !A_is_special(c)); | |
716 } | |
717 | |
718 | |
719 /* | |
720 * A_is_special returns TRUE if 'c' is not a special Arabic character. | |
721 * Specials don't adhere to most of the rules. | |
722 */ | |
723 static int | |
7817
83861277e6a3
commit https://github.com/vim/vim/commit/7454a06e2642d2b37afad1c5e71cec68081ca4ff
Christian Brabandt <cb@256bit.org>
parents:
7799
diff
changeset
|
724 A_is_special(int c) |
7 | 725 { |
726 return (c == a_HAMZA || c == a_s_HAMZA); | |
727 } | |
9403
9b048dced116
commit https://github.com/vim/vim/commit/75464dc434c43efac60e8bfd9bec2a8b736407e9
Christian Brabandt <cb@256bit.org>
parents:
7817
diff
changeset
|
728 |
9b048dced116
commit https://github.com/vim/vim/commit/75464dc434c43efac60e8bfd9bec2a8b736407e9
Christian Brabandt <cb@256bit.org>
parents:
7817
diff
changeset
|
729 #endif /* FEAT_ARABIC */ |