Mercurial > vim
comparison src/hangulin.c @ 7823:bcef391c101c v7.4.1208
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jan 30 17:24:07 2016 +0100
patch 7.4.1208
Problem: Using old style function declarations.
Solution: Change to new style function declarations. (script by Hirohito
Higashi)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 30 Jan 2016 17:30:04 +0100 |
parents | 37c929c4a073 |
children | 4aead6a9b7a9 |
comparison
equal
deleted
inserted
replaced
7822:c357d21dc1b5 | 7823:bcef391c101c |
---|---|
94 /* 3 ¹ú½Ä¿¡¼ (ÇöÀçÃʼº, ÀԷ¿µ¹®) -> º¹ÇÕÃʼº ó¸® | 94 /* 3 ¹ú½Ä¿¡¼ (ÇöÀçÃʼº, ÀԷ¿µ¹®) -> º¹ÇÕÃʼº ó¸® |
95 * 3 bulsik: (current initial sound, input english) -> compound initial sound. | 95 * 3 bulsik: (current initial sound, input english) -> compound initial sound. |
96 */ | 96 */ |
97 | 97 |
98 static int | 98 static int |
99 comfcon3(v, c) | 99 comfcon3(int v, int c) |
100 int v; | |
101 int c; | |
102 { | 100 { |
103 if (v == 2 && c == 2) | 101 if (v == 2 && c == 2) |
104 return 3; | 102 return 3; |
105 if (v == 5 && c == 5) | 103 if (v == 5 && c == 5) |
106 return 6; | 104 return 6; |
116 /* 3 ¹ú½Ä¿¡¼ (ÇöÀç¸ðÀ½, ÀÔ·Â ¿µ¹®) -> º¹ÇÕ ¸ðÀ½ ó¸® | 114 /* 3 ¹ú½Ä¿¡¼ (ÇöÀç¸ðÀ½, ÀÔ·Â ¿µ¹®) -> º¹ÇÕ ¸ðÀ½ ó¸® |
117 * 3 bulsik: (current vowel, input english) -> compound vowel. | 115 * 3 bulsik: (current vowel, input english) -> compound vowel. |
118 */ | 116 */ |
119 | 117 |
120 static int | 118 static int |
121 comvow3(v, c) | 119 comvow3(int v, int c) |
122 int v; | |
123 int c; | |
124 { | 120 { |
125 switch (v) | 121 switch (v) |
126 { | 122 { |
127 case 13: /* ¤Ç */ | 123 case 13: /* ¤Ç */ |
128 switch (c) { | 124 switch (c) { |
157 * (I cannot find the real english from my dictionary. Sorry!) | 153 * (I cannot find the real english from my dictionary. Sorry!) |
158 * VIM: V = initial sound, I = medial vowel, M = final consonant. | 154 * VIM: V = initial sound, I = medial vowel, M = final consonant. |
159 */ | 155 */ |
160 | 156 |
161 static int | 157 static int |
162 comcon3(k, c) | 158 comcon3(int k, int c) |
163 int k; | |
164 int c; | |
165 { | 159 { |
166 switch (k) | 160 switch (k) |
167 { | 161 { |
168 case 2: /* ¤¡ */ | 162 case 2: /* ¤¡ */ |
169 switch (c) { | 163 switch (c) { |
215 /**********************************************************************/ | 209 /**********************************************************************/ |
216 /****** 2 ¹ú½ÄÀÚÆÇÀ» À§ÇÑ ·çƾ (Routines for 2 bulsik keyboard) ******/ | 210 /****** 2 ¹ú½ÄÀÚÆÇÀ» À§ÇÑ ·çƾ (Routines for 2 bulsik keyboard) ******/ |
217 /**********************************************************************/ | 211 /**********************************************************************/ |
218 | 212 |
219 static int | 213 static int |
220 kind_table_for_2(c) | 214 kind_table_for_2(int c) |
221 int c; | |
222 { | 215 { |
223 static char_u table[] = | 216 static char_u table[] = |
224 { | 217 { |
225 /* a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s */ | 218 /* a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s */ |
226 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, | 219 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, |
239 /* 2 ¹ú½Ä¿¡¼ ¿µ¹®ÀÚ -> Á¶ÇÕÇü Ãʼº º¯È¯ | 232 /* 2 ¹ú½Ä¿¡¼ ¿µ¹®ÀÚ -> Á¶ÇÕÇü Ãʼº º¯È¯ |
240 * (2 bulsik: conversion english char. to initial sound of compound type) | 233 * (2 bulsik: conversion english char. to initial sound of compound type) |
241 * °á°ú: ÃʼºÀÌ ¾Æ´Ï¸é 0 (If it is not initial sound, return 0). | 234 * °á°ú: ÃʼºÀÌ ¾Æ´Ï¸é 0 (If it is not initial sound, return 0). |
242 */ | 235 */ |
243 static int | 236 static int |
244 fcon(c) | 237 fcon(int c) |
245 int c; | |
246 { | 238 { |
247 static char_u table[] = | 239 static char_u table[] = |
248 { | 240 { |
249 /*E */ 6 , /*F */ 0 , /*G */ 0 , /*H */ 0 , /*I */ 0 , /*J */ 0 , /*K */ 0 , | 241 /*E */ 6 , /*F */ 0 , /*G */ 0 , /*H */ 0 , /*I */ 0 , /*J */ 0 , /*K */ 0 , |
250 /*L */ 0 , /*M */ 0 , /*N */ 0 , /*O */ 0 , /*P */ 0 , /*Q */ 10, /*R */ 3 , | 242 /*L */ 0 , /*M */ 0 , /*N */ 0 , /*O */ 0 , /*P */ 0 , /*Q */ 10, /*R */ 3 , |
264 /* 2 ¹ú½Ä¿¡¼ ¿µ¹®ÀÚ -> Áß¼º º¯È¯ | 256 /* 2 ¹ú½Ä¿¡¼ ¿µ¹®ÀÚ -> Áß¼º º¯È¯ |
265 * (2 bulsik: conversion english char. to medial vowel) | 257 * (2 bulsik: conversion english char. to medial vowel) |
266 * °á°ú: Áß¼ºÀÌ ¾Æ´Ï¸é 0 (If it is not medial vowel, return 0). | 258 * °á°ú: Áß¼ºÀÌ ¾Æ´Ï¸é 0 (If it is not medial vowel, return 0). |
267 */ | 259 */ |
268 static int | 260 static int |
269 vow(c) | 261 vow(int c) |
270 int c; | |
271 { | 262 { |
272 static char_u table[] = | 263 static char_u table[] = |
273 { | 264 { |
274 /*O */ 6 , /*P */ 12, /*Q */ 0 , /*R */ 0 , /*S */ 0 , /*T */ 0 , /*U */ 0 , | 265 /*O */ 6 , /*P */ 12, /*Q */ 0 , /*R */ 0 , /*S */ 0 , /*T */ 0 , /*U */ 0 , |
275 /*V */ 0 , /*W */ 0 , /*X */ 0 , /*Y */ 0 , /*Z */ 0 , /*[ */ 0 , /*\ */ 0 , | 266 /*V */ 0 , /*W */ 0 , /*X */ 0 , /*Y */ 0 , /*Z */ 0 , /*[ */ 0 , /*\ */ 0 , |
287 /* 2¹ú½Ä¿¡¼ ¿µ¹®ÀÚ -> ¹Þħ º¯È¯ | 278 /* 2¹ú½Ä¿¡¼ ¿µ¹®ÀÚ -> ¹Þħ º¯È¯ |
288 * (2 bulsik: conversion english char. to prop) | 279 * (2 bulsik: conversion english char. to prop) |
289 * °á°ú: ¹ÞħÀÌ ¾Æ´Ï¸é 0 (If not prop, return 0) | 280 * °á°ú: ¹ÞħÀÌ ¾Æ´Ï¸é 0 (If not prop, return 0) |
290 */ | 281 */ |
291 static int | 282 static int |
292 lcon(c) | 283 lcon(int c) |
293 int c; | |
294 { | 284 { |
295 static char_u table[] = | 285 static char_u table[] = |
296 { | 286 { |
297 /*R */ 3 , /*S */ 0 , /*T */ 22, /*U */ 0 , /*V */ 0 , /*W */ 0 , /*X */ 0 , | 287 /*R */ 3 , /*S */ 0 , /*T */ 22, /*U */ 0 , /*V */ 0 , /*W */ 0 , /*X */ 0 , |
298 /*Y */ 0 , /*Z */ 0 , /*[ */ 0 , /*\ */ 0 , /*] */ 0 , /*^ */ 0 , /*_ */ 0 , | 288 /*Y */ 0 , /*Z */ 0 , /*[ */ 0 , /*\ */ 0 , /*] */ 0 , /*^ */ 0 , /*_ */ 0 , |
310 /* 2 ¹ú½Ä¿¡¼ (ÇöÀç ¹Þħ, ¿µ¹®ÀÚ ÀÔ·Â) -> ¹Þħ º¯È¯ | 300 /* 2 ¹ú½Ä¿¡¼ (ÇöÀç ¹Þħ, ¿µ¹®ÀÚ ÀÔ·Â) -> ¹Þħ º¯È¯ |
311 * (2 bulsik: conversion (curr. prop, input english) to prop) | 301 * (2 bulsik: conversion (curr. prop, input english) to prop) |
312 */ | 302 */ |
313 | 303 |
314 static int | 304 static int |
315 comcon2(k, c) | 305 comcon2(int k, int c) |
316 int k; | |
317 int c; | |
318 { | 306 { |
319 switch (k) | 307 switch (k) |
320 { | 308 { |
321 case 2: /* ¤¡ */ | 309 case 2: /* ¤¡ */ |
322 switch (c) { | 310 switch (c) { |
367 * (2 bulsik: conversion (curr. medial vowel, input english) to medial | 355 * (2 bulsik: conversion (curr. medial vowel, input english) to medial |
368 * vowel) | 356 * vowel) |
369 */ | 357 */ |
370 | 358 |
371 static int | 359 static int |
372 comvow2(v, c) | 360 comvow2(int v, int c) |
373 int v; | |
374 int c; | |
375 { | 361 { |
376 switch (v) | 362 switch (v) |
377 { | 363 { |
378 case 13: /* ¤Ç */ | 364 case 13: /* ¤Ç */ |
379 switch (c) { | 365 switch (c) { |
406 } | 392 } |
407 return 0; | 393 return 0; |
408 } | 394 } |
409 | 395 |
410 int | 396 int |
411 hangul_input_state_get() | 397 hangul_input_state_get(void) |
412 { | 398 { |
413 return hangul_input_state; | 399 return hangul_input_state; |
414 } | 400 } |
415 | 401 |
416 void | 402 void |
417 hangul_input_state_set(state) | 403 hangul_input_state_set(int state) |
418 int state; | |
419 { | 404 { |
420 hangul_input_state = state; | 405 hangul_input_state = state; |
421 hangul_input_clear(); | 406 hangul_input_clear(); |
422 } | 407 } |
423 | 408 |
424 int | 409 int |
425 im_get_status() | 410 im_get_status(void) |
426 { | 411 { |
427 return hangul_input_state_get(); | 412 return hangul_input_state_get(); |
428 } | 413 } |
429 | 414 |
430 void | 415 void |
431 hangul_input_state_toggle() | 416 hangul_input_state_toggle(void) |
432 { | 417 { |
433 if (hangul_input_state_get()) | 418 if (hangul_input_state_get()) |
434 { | 419 { |
435 hangul_input_state_set(0); | 420 hangul_input_state_set(0); |
436 if (composing_hangul) | 421 if (composing_hangul) |
450 | 435 |
451 gui_update_cursor(TRUE, FALSE); | 436 gui_update_cursor(TRUE, FALSE); |
452 } | 437 } |
453 | 438 |
454 static int | 439 static int |
455 hangul_automata2(buf, c) | 440 hangul_automata2(char_u *buf, int_u *c) |
456 char_u *buf; | |
457 int_u *c; | |
458 { | 441 { |
459 int t,t2; | 442 int t,t2; |
460 | 443 |
461 if (*c == BS) | 444 if (*c == BS) |
462 { | 445 { |
612 } | 595 } |
613 return AUTOMATA_ERROR; /* RrEeAaLlLlYy EeRrRrOoRr */ | 596 return AUTOMATA_ERROR; /* RrEeAaLlLlYy EeRrRrOoRr */ |
614 } | 597 } |
615 | 598 |
616 static int | 599 static int |
617 hangul_automata3(buf, c) | 600 hangul_automata3(char_u *buf, int_u *c) |
618 char_u *buf; | |
619 int_u *c; | |
620 { | 601 { |
621 int t, t2; | 602 int t, t2; |
622 | 603 |
623 if (*c >= '!' && *c <= 'z') | 604 if (*c >= '!' && *c <= 'z') |
624 { | 605 { |
723 hangul_input_clear(); | 704 hangul_input_clear(); |
724 return AUTOMATA_SPECIAL; | 705 return AUTOMATA_SPECIAL; |
725 } | 706 } |
726 | 707 |
727 void | 708 void |
728 hangul_keyboard_set() | 709 hangul_keyboard_set(void) |
729 { | 710 { |
730 int keyboard; | 711 int keyboard; |
731 char *s; | 712 char *s; |
732 | 713 |
733 hangul_input_clear(); | 714 hangul_input_clear(); |
744 hangul_keyboard_type = keyboard; | 725 hangul_keyboard_type = keyboard; |
745 } | 726 } |
746 } | 727 } |
747 | 728 |
748 int | 729 int |
749 hangul_input_process(s, len) | 730 hangul_input_process(char_u *s, int len) |
750 char_u *s; | |
751 int len; | |
752 { | 731 { |
753 int n; | 732 int n; |
754 unsigned int c; | 733 unsigned int c; |
755 char_u hanbuf[20]; | 734 char_u hanbuf[20]; |
756 | 735 |
829 } | 808 } |
830 return len; | 809 return len; |
831 } | 810 } |
832 | 811 |
833 void | 812 void |
834 hangul_input_clear() | 813 hangul_input_clear(void) |
835 { | 814 { |
836 sp = 0; | 815 sp = 0; |
837 f = F_NULL; | 816 f = F_NULL; |
838 m = M_NULL; | 817 m = M_NULL; |
839 l = L_NULL; | 818 l = L_NULL; |
1501 0xb5, 0xb6, 0xb7, 0xb8, 0xba, /* ¤µ, ¤¶, ¤·, ¤¸, ¤º */ | 1480 0xb5, 0xb6, 0xb7, 0xb8, 0xba, /* ¤µ, ¤¶, ¤·, ¤¸, ¤º */ |
1502 0xbb, 0xbc, 0xbd, 0xbe /* ¤», ¤¼, ¤½, ¤¾ */ | 1481 0xbb, 0xbc, 0xbd, 0xbe /* ¤», ¤¼, ¤½, ¤¾ */ |
1503 }; | 1482 }; |
1504 | 1483 |
1505 static void | 1484 static void |
1506 convert_ks_to_3(src, fp, mp, lp) | 1485 convert_ks_to_3( |
1507 const char_u *src; | 1486 const char_u *src, |
1508 int *fp; | 1487 int *fp, |
1509 int *mp; | 1488 int *mp, |
1510 int *lp; | 1489 int *lp) |
1511 { | 1490 { |
1512 int h = *src; | 1491 int h = *src; |
1513 int low = *(src + 1); | 1492 int low = *(src + 1); |
1514 int c; | 1493 int c; |
1515 int i; | 1494 int i; |
1537 *lp = low; | 1516 *lp = low; |
1538 } | 1517 } |
1539 } | 1518 } |
1540 | 1519 |
1541 static int | 1520 static int |
1542 convert_3_to_ks(fv, mv, lv, des) | 1521 convert_3_to_ks( |
1543 int fv; | 1522 int fv, |
1544 int mv; | 1523 int mv, |
1545 int lv; | 1524 int lv, |
1546 char_u *des; | 1525 char_u *des) |
1547 { | 1526 { |
1548 char_u key[3]; | 1527 char_u key[3]; |
1549 register int hi, lo, mi = 0, result, found; | 1528 register int hi, lo, mi = 0, result, found; |
1550 | 1529 |
1551 if (fv == 0xff) | 1530 if (fv == 0xff) |
1619 *des++ = johab_lcon_to_wan[lv]; | 1598 *des++ = johab_lcon_to_wan[lv]; |
1620 return 8; | 1599 return 8; |
1621 } | 1600 } |
1622 | 1601 |
1623 char_u * | 1602 char_u * |
1624 hangul_string_convert(buf, p_len) | 1603 hangul_string_convert(char_u *buf, int *p_len) |
1625 char_u *buf; | |
1626 int *p_len; | |
1627 { | 1604 { |
1628 char_u *tmpbuf = NULL; | 1605 char_u *tmpbuf = NULL; |
1629 vimconv_T vc; | 1606 vimconv_T vc; |
1630 | 1607 |
1631 if (enc_utf8) | 1608 if (enc_utf8) |
1640 | 1617 |
1641 return tmpbuf; | 1618 return tmpbuf; |
1642 } | 1619 } |
1643 | 1620 |
1644 char_u * | 1621 char_u * |
1645 hangul_composing_buffer_get(p_len) | 1622 hangul_composing_buffer_get(int *p_len) |
1646 int *p_len; | |
1647 { | 1623 { |
1648 char_u *tmpbuf = NULL; | 1624 char_u *tmpbuf = NULL; |
1649 | 1625 |
1650 if (composing_hangul) | 1626 if (composing_hangul) |
1651 { | 1627 { |