diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-03-04 14:50:19 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-03-04 14:50:19 +0100 |
commit | 7f73b54631af3f0e6f0acd1a1b4c9e8436784705 (patch) | |
tree | 94bf4f1e8162dc3553b3aa3ab0f6fe9fd5398737 /src/arabic.c | |
parent | 08cab9608781c975b4acbad875862b842b29258d (diff) | |
download | vim-git-7f73b54631af3f0e6f0acd1a1b4c9e8436784705.tar.gz |
patch 8.0.0406: arabic shaping code is verbosev8.0.0406
Problem: The arabic shaping code is verbose.
Solution: Shorten the code without changing the functionality.
Diffstat (limited to 'src/arabic.c')
-rw-r--r-- | src/arabic.c | 442 |
1 files changed, 115 insertions, 327 deletions
diff --git a/src/arabic.c b/src/arabic.c index 4ad2c6e89..cb43b802e 100644 --- a/src/arabic.c +++ b/src/arabic.c @@ -240,7 +240,6 @@ chg_c_a2s(int cur_c) case a_HEH: return a_s_HEH; case a_YEH: return a_s_YEH; } - return 0; } @@ -305,7 +304,6 @@ chg_c_a2i(int cur_c) case a_HEH: return a_i_HEH; case a_YEH: return a_i_YEH; } - return 0; } @@ -356,7 +354,6 @@ chg_c_a2m(int cur_c) case a_ALEF_MAKSURA: return a_f_ALEF_MAKSURA; /* exception */ case a_YEH: return a_m_YEH; } - return 0; } @@ -367,136 +364,55 @@ chg_c_a2m(int cur_c) static int chg_c_a2f(int cur_c) { - int tempc; - /* NOTE: these encodings need to be accounted for - - a_f_ALEF_MADDA; - a_f_ALEF_HAMZA_ABOVE; - a_f_ALEF_HAMZA_BELOW; - a_f_LAM_ALEF_MADDA_ABOVE; - a_f_LAM_ALEF_HAMZA_ABOVE; - a_f_LAM_ALEF_HAMZA_BELOW; - */ - + * a_f_ALEF_MADDA; + * a_f_ALEF_HAMZA_ABOVE; + * a_f_ALEF_HAMZA_BELOW; + * a_f_LAM_ALEF_MADDA_ABOVE; + * a_f_LAM_ALEF_HAMZA_ABOVE; + * a_f_LAM_ALEF_HAMZA_BELOW; + */ switch (cur_c) { - case a_HAMZA: /* exception */ - tempc = a_s_HAMZA; - break; - case a_ALEF_MADDA: - tempc = a_f_ALEF_MADDA; - break; - case a_ALEF_HAMZA_ABOVE: - tempc = a_f_ALEF_HAMZA_ABOVE; - break; - case a_WAW_HAMZA: - tempc = a_f_WAW_HAMZA; - break; - case a_ALEF_HAMZA_BELOW: - tempc = a_f_ALEF_HAMZA_BELOW; - break; - case a_YEH_HAMZA: - tempc = a_f_YEH_HAMZA; - break; - case a_ALEF: - tempc = a_f_ALEF; - break; - case a_BEH: - tempc = a_f_BEH; - break; - case a_TEH_MARBUTA: - tempc = a_f_TEH_MARBUTA; - break; - case a_TEH: - tempc = a_f_TEH; - break; - case a_THEH: - tempc = a_f_THEH; - break; - case a_JEEM: - tempc = a_f_JEEM; - break; - case a_HAH: - tempc = a_f_HAH; - break; - case a_KHAH: - tempc = a_f_KHAH; - break; - case a_DAL: - tempc = a_f_DAL; - break; - case a_THAL: - tempc = a_f_THAL; - break; - case a_REH: - tempc = a_f_REH; - break; - case a_ZAIN: - tempc = a_f_ZAIN; - break; - case a_SEEN: - tempc = a_f_SEEN; - break; - case a_SHEEN: - tempc = a_f_SHEEN; - break; - case a_SAD: - tempc = a_f_SAD; - break; - case a_DAD: - tempc = a_f_DAD; - break; - case a_TAH: - tempc = a_f_TAH; - break; - case a_ZAH: - tempc = a_f_ZAH; - break; - case a_AIN: - tempc = a_f_AIN; - break; - case a_GHAIN: - tempc = a_f_GHAIN; - break; - case a_TATWEEL: /* exception */ - tempc = cur_c; - break; - case a_FEH: - tempc = a_f_FEH; - break; - case a_QAF: - tempc = a_f_QAF; - break; - case a_KAF: - tempc = a_f_KAF; - break; - case a_LAM: - tempc = a_f_LAM; - break; - case a_MEEM: - tempc = a_f_MEEM; - break; - case a_NOON: - tempc = a_f_NOON; - break; - case a_HEH: - tempc = a_f_HEH; - break; - case a_WAW: - tempc = a_f_WAW; - break; - case a_ALEF_MAKSURA: - tempc = a_f_ALEF_MAKSURA; - break; - case a_YEH: - tempc = a_f_YEH; - break; - default: - tempc = 0; + case a_HAMZA: return a_s_HAMZA; /* exception */ + case a_ALEF_MADDA: return a_f_ALEF_MADDA; + case a_ALEF_HAMZA_ABOVE: return a_f_ALEF_HAMZA_ABOVE; + case a_WAW_HAMZA: return a_f_WAW_HAMZA; + case a_ALEF_HAMZA_BELOW: return a_f_ALEF_HAMZA_BELOW; + case a_YEH_HAMZA: return a_f_YEH_HAMZA; + case a_ALEF: return a_f_ALEF; + case a_BEH: return a_f_BEH; + case a_TEH_MARBUTA: return a_f_TEH_MARBUTA; + case a_TEH: return a_f_TEH; + case a_THEH: return a_f_THEH; + case a_JEEM: return a_f_JEEM; + case a_HAH: return a_f_HAH; + case a_KHAH: return a_f_KHAH; + case a_DAL: return a_f_DAL; + case a_THAL: return a_f_THAL; + case a_REH: return a_f_REH; + case a_ZAIN: return a_f_ZAIN; + case a_SEEN: return a_f_SEEN; + case a_SHEEN: return a_f_SHEEN; + case a_SAD: return a_f_SAD; + case a_DAD: return a_f_DAD; + case a_TAH: return a_f_TAH; + case a_ZAH: return a_f_ZAH; + case a_AIN: return a_f_AIN; + case a_GHAIN: return a_f_GHAIN; + case a_TATWEEL: return cur_c; /* exception */ + case a_FEH: return a_f_FEH; + case a_QAF: return a_f_QAF; + case a_KAF: return a_f_KAF; + case a_LAM: return a_f_LAM; + case a_MEEM: return a_f_MEEM; + case a_NOON: return a_f_NOON; + case a_HEH: return a_f_HEH; + case a_WAW: return a_f_WAW; + case a_ALEF_MAKSURA: return a_f_ALEF_MAKSURA; + case a_YEH: return a_f_YEH; } - - return tempc; + return 0; } @@ -506,84 +422,33 @@ chg_c_a2f(int cur_c) static int chg_c_i2m(int cur_c) { - int tempc; - switch (cur_c) { - case a_i_YEH_HAMZA: - tempc = a_m_YEH_HAMZA; - break; - case a_i_BEH: - tempc = a_m_BEH; - break; - case a_i_TEH: - tempc = a_m_TEH; - break; - case a_i_THEH: - tempc = a_m_THEH; - break; - case a_i_JEEM: - tempc = a_m_JEEM; - break; - case a_i_HAH: - tempc = a_m_HAH; - break; - case a_i_KHAH: - tempc = a_m_KHAH; - break; - case a_i_SEEN: - tempc = a_m_SEEN; - break; - case a_i_SHEEN: - tempc = a_m_SHEEN; - break; - case a_i_SAD: - tempc = a_m_SAD; - break; - case a_i_DAD: - tempc = a_m_DAD; - break; - case a_i_TAH: - tempc = a_m_TAH; - break; - case a_i_ZAH: - tempc = a_m_ZAH; - break; - case a_i_AIN: - tempc = a_m_AIN; - break; - case a_i_GHAIN: - tempc = a_m_GHAIN; - break; - case a_i_FEH: - tempc = a_m_FEH; - break; - case a_i_QAF: - tempc = a_m_QAF; - break; - case a_i_KAF: - tempc = a_m_KAF; - break; - case a_i_LAM: - tempc = a_m_LAM; - break; - case a_i_MEEM: - tempc = a_m_MEEM; - break; - case a_i_NOON: - tempc = a_m_NOON; - break; - case a_i_HEH: - tempc = a_m_HEH; - break; - case a_i_YEH: - tempc = a_m_YEH; - break; - default: - tempc = 0; + case a_i_YEH_HAMZA: return a_m_YEH_HAMZA; + case a_i_BEH: return a_m_BEH; + case a_i_TEH: return a_m_TEH; + case a_i_THEH: return a_m_THEH; + case a_i_JEEM: return a_m_JEEM; + case a_i_HAH: return a_m_HAH; + case a_i_KHAH: return a_m_KHAH; + case a_i_SEEN: return a_m_SEEN; + case a_i_SHEEN: return a_m_SHEEN; + case a_i_SAD: return a_m_SAD; + case a_i_DAD: return a_m_DAD; + case a_i_TAH: return a_m_TAH; + case a_i_ZAH: return a_m_ZAH; + case a_i_AIN: return a_m_AIN; + case a_i_GHAIN: return a_m_GHAIN; + case a_i_FEH: return a_m_FEH; + case a_i_QAF: return a_m_QAF; + case a_i_KAF: return a_m_KAF; + case a_i_LAM: return a_m_LAM; + case a_i_MEEM: return a_m_MEEM; + case a_i_NOON: return a_m_NOON; + case a_i_HEH: return a_m_HEH; + case a_i_YEH: return a_m_YEH; } - - return tempc; + return 0; } @@ -593,18 +458,14 @@ chg_c_i2m(int cur_c) static int chg_c_f2m(int cur_c) { - int tempc; - switch (cur_c) { /* NOTE: these encodings are multi-positional, no ? - case a_f_ALEF_MADDA: - case a_f_ALEF_HAMZA_ABOVE: - case a_f_ALEF_HAMZA_BELOW: - */ - case a_f_YEH_HAMZA: - tempc = a_m_YEH_HAMZA; - break; + * case a_f_ALEF_MADDA: + * case a_f_ALEF_HAMZA_ABOVE: + * case a_f_ALEF_HAMZA_BELOW: + */ + case a_f_YEH_HAMZA: return a_m_YEH_HAMZA; case a_f_WAW_HAMZA: /* exceptions */ case a_f_ALEF: case a_f_TEH_MARBUTA: @@ -614,85 +475,38 @@ chg_c_f2m(int cur_c) case a_f_ZAIN: case a_f_WAW: case a_f_ALEF_MAKSURA: - tempc = cur_c; - break; - case a_f_BEH: - tempc = a_m_BEH; - break; - case a_f_TEH: - tempc = a_m_TEH; - break; - case a_f_THEH: - tempc = a_m_THEH; - break; - case a_f_JEEM: - tempc = a_m_JEEM; - break; - case a_f_HAH: - tempc = a_m_HAH; - break; - case a_f_KHAH: - tempc = a_m_KHAH; - break; - case a_f_SEEN: - tempc = a_m_SEEN; - break; - case a_f_SHEEN: - tempc = a_m_SHEEN; - break; - case a_f_SAD: - tempc = a_m_SAD; - break; - case a_f_DAD: - tempc = a_m_DAD; - break; - case a_f_TAH: - tempc = a_m_TAH; - break; - case a_f_ZAH: - tempc = a_m_ZAH; - break; - case a_f_AIN: - tempc = a_m_AIN; - break; - case a_f_GHAIN: - tempc = a_m_GHAIN; - break; - case a_f_FEH: - tempc = a_m_FEH; - break; - case a_f_QAF: - tempc = a_m_QAF; - break; - case a_f_KAF: - tempc = a_m_KAF; - break; - case a_f_LAM: - tempc = a_m_LAM; - break; - case a_f_MEEM: - tempc = a_m_MEEM; - break; - case a_f_NOON: - tempc = a_m_NOON; - break; - case a_f_HEH: - tempc = a_m_HEH; - break; - case a_f_YEH: - tempc = a_m_YEH; - break; - /* NOTE: these encodings are multi-positional, no ? - case a_f_LAM_ALEF_MADDA_ABOVE: - case a_f_LAM_ALEF_HAMZA_ABOVE: - case a_f_LAM_ALEF_HAMZA_BELOW: - case a_f_LAM_ALEF: - */ - default: - tempc = 0; - } + return cur_c; + case a_f_BEH: return a_m_BEH; + case a_f_TEH: return a_m_TEH; + case a_f_THEH: return a_m_THEH; + case a_f_JEEM: return a_m_JEEM; + case a_f_HAH: return a_m_HAH; + case a_f_KHAH: return a_m_KHAH; + case a_f_SEEN: return a_m_SEEN; + case a_f_SHEEN: return a_m_SHEEN; + case a_f_SAD: return a_m_SAD; + case a_f_DAD: return a_m_DAD; + case a_f_TAH: return a_m_TAH; + case a_f_ZAH: return a_m_ZAH; + case a_f_AIN: return a_m_AIN; + case a_f_GHAIN: return a_m_GHAIN; + case a_f_FEH: return a_m_FEH; + case a_f_QAF: return a_m_QAF; + case a_f_KAF: return a_m_KAF; + case a_f_LAM: return a_m_LAM; + case a_f_MEEM: return a_m_MEEM; + case a_f_NOON: return a_m_NOON; + case a_f_HEH: return a_m_HEH; + case a_f_YEH: return a_m_YEH; - return tempc; + /* NOTE: these encodings are multi-positional, no ? + * case a_f_LAM_ALEF_MADDA_ABOVE: + * case a_f_LAM_ALEF_HAMZA_ABOVE: + * case a_f_LAM_ALEF_HAMZA_BELOW: + * case a_f_LAM_ALEF: + */ + } + return 0; } @@ -702,27 +516,14 @@ chg_c_f2m(int cur_c) static int chg_c_laa2i(int hid_c) { - int tempc; - switch (hid_c) { - case a_ALEF_MADDA: - tempc = a_s_LAM_ALEF_MADDA_ABOVE; - break; - case a_ALEF_HAMZA_ABOVE: - tempc = a_s_LAM_ALEF_HAMZA_ABOVE; - break; - case a_ALEF_HAMZA_BELOW: - tempc = a_s_LAM_ALEF_HAMZA_BELOW; - break; - case a_ALEF: - tempc = a_s_LAM_ALEF; - break; - default: - tempc = 0; + case a_ALEF_MADDA: return a_s_LAM_ALEF_MADDA_ABOVE; + case a_ALEF_HAMZA_ABOVE: return a_s_LAM_ALEF_HAMZA_ABOVE; + case a_ALEF_HAMZA_BELOW: return a_s_LAM_ALEF_HAMZA_BELOW; + case a_ALEF: return a_s_LAM_ALEF; } - - return tempc; + return 0; } @@ -732,27 +533,14 @@ chg_c_laa2i(int hid_c) static int chg_c_laa2f(int hid_c) { - int tempc; - switch (hid_c) { - case a_ALEF_MADDA: - tempc = a_f_LAM_ALEF_MADDA_ABOVE; - break; - case a_ALEF_HAMZA_ABOVE: - tempc = a_f_LAM_ALEF_HAMZA_ABOVE; - break; - case a_ALEF_HAMZA_BELOW: - tempc = a_f_LAM_ALEF_HAMZA_BELOW; - break; - case a_ALEF: - tempc = a_f_LAM_ALEF; - break; - default: - tempc = 0; + case a_ALEF_MADDA: return a_f_LAM_ALEF_MADDA_ABOVE; + case a_ALEF_HAMZA_ABOVE: return a_f_LAM_ALEF_HAMZA_ABOVE; + case a_ALEF_HAMZA_BELOW: return a_f_LAM_ALEF_HAMZA_BELOW; + case a_ALEF: return a_f_LAM_ALEF; } - - return tempc; + return 0; } /* |