summaryrefslogtreecommitdiff
path: root/src/arabic.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-03-01 14:02:30 +0100
committerBram Moolenaar <Bram@vim.org>2017-03-01 14:02:30 +0100
commit5f53dd3f747711be90879fa2f22a207970b86750 (patch)
tree425fc754acbac96ee86873b6c435de9d7a41e318 /src/arabic.c
parentcb03642399ae4f3c47a006f608a6b912f9d98b5f (diff)
downloadvim-git-5f53dd3f747711be90879fa2f22a207970b86750.tar.gz
patch 8.0.0391: arabic support is verbose and not well testedv8.0.0391
Problem: Arabic support is verbose and not well tested. Solution: Simplify the code. Add more tests.
Diffstat (limited to 'src/arabic.c')
-rw-r--r--src/arabic.c448
1 files changed, 114 insertions, 334 deletions
diff --git a/src/arabic.c b/src/arabic.c
index fa5e940de..4ad2c6e89 100644
--- a/src/arabic.c
+++ b/src/arabic.c
@@ -200,126 +200,48 @@ A_is_f(int cur_c)
static int
chg_c_a2s(int cur_c)
{
- int tempc;
-
switch (cur_c)
{
- case a_HAMZA:
- tempc = a_s_HAMZA;
- break;
- case a_ALEF_MADDA:
- tempc = a_s_ALEF_MADDA;
- break;
- case a_ALEF_HAMZA_ABOVE:
- tempc = a_s_ALEF_HAMZA_ABOVE;
- break;
- case a_WAW_HAMZA:
- tempc = a_s_WAW_HAMZA;
- break;
- case a_ALEF_HAMZA_BELOW:
- tempc = a_s_ALEF_HAMZA_BELOW;
- break;
- case a_YEH_HAMZA:
- tempc = a_s_YEH_HAMZA;
- break;
- case a_ALEF:
- tempc = a_s_ALEF;
- break;
- case a_TEH_MARBUTA:
- tempc = a_s_TEH_MARBUTA;
- break;
- case a_DAL:
- tempc = a_s_DAL;
- break;
- case a_THAL:
- tempc = a_s_THAL;
- break;
- case a_REH:
- tempc = a_s_REH;
- break;
- case a_ZAIN:
- tempc = a_s_ZAIN;
- break;
- case a_TATWEEL: /* exceptions */
- tempc = cur_c;
- break;
- case a_WAW:
- tempc = a_s_WAW;
- break;
- case a_ALEF_MAKSURA:
- tempc = a_s_ALEF_MAKSURA;
- break;
- case a_BEH:
- tempc = a_s_BEH;
- break;
- case a_TEH:
- tempc = a_s_TEH;
- break;
- case a_THEH:
- tempc = a_s_THEH;
- break;
- case a_JEEM:
- tempc = a_s_JEEM;
- break;
- case a_HAH:
- tempc = a_s_HAH;
- break;
- case a_KHAH:
- tempc = a_s_KHAH;
- break;
- case a_SEEN:
- tempc = a_s_SEEN;
- break;
- case a_SHEEN:
- tempc = a_s_SHEEN;
- break;
- case a_SAD:
- tempc = a_s_SAD;
- break;
- case a_DAD:
- tempc = a_s_DAD;
- break;
- case a_TAH:
- tempc = a_s_TAH;
- break;
- case a_ZAH:
- tempc = a_s_ZAH;
- break;
- case a_AIN:
- tempc = a_s_AIN;
- break;
- case a_GHAIN:
- tempc = a_s_GHAIN;
- break;
- case a_FEH:
- tempc = a_s_FEH;
- break;
- case a_QAF:
- tempc = a_s_QAF;
- break;
- case a_KAF:
- tempc = a_s_KAF;
- break;
- case a_LAM:
- tempc = a_s_LAM;
- break;
- case a_MEEM:
- tempc = a_s_MEEM;
- break;
- case a_NOON:
- tempc = a_s_NOON;
- break;
- case a_HEH:
- tempc = a_s_HEH;
- break;
- case a_YEH:
- tempc = a_s_YEH;
- break;
- default:
- tempc = 0;
+ case a_HAMZA: return a_s_HAMZA;
+ case a_ALEF_MADDA: return a_s_ALEF_MADDA;
+ case a_ALEF_HAMZA_ABOVE: return a_s_ALEF_HAMZA_ABOVE;
+ case a_WAW_HAMZA: return a_s_WAW_HAMZA;
+ case a_ALEF_HAMZA_BELOW: return a_s_ALEF_HAMZA_BELOW;
+ case a_YEH_HAMZA: return a_s_YEH_HAMZA;
+ case a_ALEF: return a_s_ALEF;
+ case a_TEH_MARBUTA: return a_s_TEH_MARBUTA;
+ case a_DAL: return a_s_DAL;
+ case a_THAL: return a_s_THAL;
+ case a_REH: return a_s_REH;
+ case a_ZAIN: return a_s_ZAIN;
+ case a_TATWEEL: return cur_c; /* exceptions */
+ case a_WAW: return a_s_WAW;
+ case a_ALEF_MAKSURA: return a_s_ALEF_MAKSURA;
+ case a_BEH: return a_s_BEH;
+ case a_TEH: return a_s_TEH;
+ case a_THEH: return a_s_THEH;
+ case a_JEEM: return a_s_JEEM;
+ case a_HAH: return a_s_HAH;
+ case a_KHAH: return a_s_KHAH;
+ case a_SEEN: return a_s_SEEN;
+ case a_SHEEN: return a_s_SHEEN;
+ case a_SAD: return a_s_SAD;
+ case a_DAD: return a_s_DAD;
+ case a_TAH: return a_s_TAH;
+ case a_ZAH: return a_s_ZAH;
+ case a_AIN: return a_s_AIN;
+ case a_GHAIN: return a_s_GHAIN;
+ case a_FEH: return a_s_FEH;
+ case a_QAF: return a_s_QAF;
+ case a_KAF: return a_s_KAF;
+ case a_LAM: return a_s_LAM;
+ case a_MEEM: return a_s_MEEM;
+ case a_NOON: return a_s_NOON;
+ case a_HEH: return a_s_HEH;
+ case a_YEH: return a_s_YEH;
}
- return tempc;
+ return 0;
}
@@ -329,126 +251,62 @@ chg_c_a2s(int cur_c)
static int
chg_c_a2i(int cur_c)
{
- int tempc;
-
switch (cur_c)
{
- case a_YEH_HAMZA:
- tempc = a_i_YEH_HAMZA;
- break;
+ case a_YEH_HAMZA: return a_i_YEH_HAMZA;
case a_HAMZA: /* exceptions */
- tempc = a_s_HAMZA;
- break;
+ return a_s_HAMZA;
case a_ALEF_MADDA: /* exceptions */
- tempc = a_s_ALEF_MADDA;
- break;
+ return a_s_ALEF_MADDA;
case a_ALEF_HAMZA_ABOVE: /* exceptions */
- tempc = a_s_ALEF_HAMZA_ABOVE;
- break;
+ return a_s_ALEF_HAMZA_ABOVE;
case a_WAW_HAMZA: /* exceptions */
- tempc = a_s_WAW_HAMZA;
- break;
+ return a_s_WAW_HAMZA;
case a_ALEF_HAMZA_BELOW: /* exceptions */
- tempc = a_s_ALEF_HAMZA_BELOW;
- break;
+ return a_s_ALEF_HAMZA_BELOW;
case a_ALEF: /* exceptions */
- tempc = a_s_ALEF;
- break;
+ return a_s_ALEF;
case a_TEH_MARBUTA: /* exceptions */
- tempc = a_s_TEH_MARBUTA;
- break;
+ return a_s_TEH_MARBUTA;
case a_DAL: /* exceptions */
- tempc = a_s_DAL;
- break;
+ return a_s_DAL;
case a_THAL: /* exceptions */
- tempc = a_s_THAL;
- break;
+ return a_s_THAL;
case a_REH: /* exceptions */
- tempc = a_s_REH;
- break;
+ return a_s_REH;
case a_ZAIN: /* exceptions */
- tempc = a_s_ZAIN;
- break;
+ return a_s_ZAIN;
case a_TATWEEL: /* exceptions */
- tempc = cur_c;
- break;
+ return cur_c;
case a_WAW: /* exceptions */
- tempc = a_s_WAW;
- break;
+ return a_s_WAW;
case a_ALEF_MAKSURA: /* exceptions */
- tempc = a_s_ALEF_MAKSURA;
- break;
- case a_BEH:
- tempc = a_i_BEH;
- break;
- case a_TEH:
- tempc = a_i_TEH;
- break;
- case a_THEH:
- tempc = a_i_THEH;
- break;
- case a_JEEM:
- tempc = a_i_JEEM;
- break;
- case a_HAH:
- tempc = a_i_HAH;
- break;
- case a_KHAH:
- tempc = a_i_KHAH;
- break;
- case a_SEEN:
- tempc = a_i_SEEN;
- break;
- case a_SHEEN:
- tempc = a_i_SHEEN;
- break;
- case a_SAD:
- tempc = a_i_SAD;
- break;
- case a_DAD:
- tempc = a_i_DAD;
- break;
- case a_TAH:
- tempc = a_i_TAH;
- break;
- case a_ZAH:
- tempc = a_i_ZAH;
- break;
- case a_AIN:
- tempc = a_i_AIN;
- break;
- case a_GHAIN:
- tempc = a_i_GHAIN;
- break;
- case a_FEH:
- tempc = a_i_FEH;
- break;
- case a_QAF:
- tempc = a_i_QAF;
- break;
- case a_KAF:
- tempc = a_i_KAF;
- break;
- case a_LAM:
- tempc = a_i_LAM;
- break;
- case a_MEEM:
- tempc = a_i_MEEM;
- break;
- case a_NOON:
- tempc = a_i_NOON;
- break;
- case a_HEH:
- tempc = a_i_HEH;
- break;
- case a_YEH:
- tempc = a_i_YEH;
- break;
- default:
- tempc = 0;
+ return a_s_ALEF_MAKSURA;
+ case a_BEH: return a_i_BEH;
+ case a_TEH: return a_i_TEH;
+ case a_THEH: return a_i_THEH;
+ case a_JEEM: return a_i_JEEM;
+ case a_HAH: return a_i_HAH;
+ case a_KHAH: return a_i_KHAH;
+ case a_SEEN: return a_i_SEEN;
+ case a_SHEEN: return a_i_SHEEN;
+ case a_SAD: return a_i_SAD;
+ case a_DAD: return a_i_DAD;
+ case a_TAH: return a_i_TAH;
+ case a_ZAH: return a_i_ZAH;
+ case a_AIN: return a_i_AIN;
+ case a_GHAIN: return a_i_GHAIN;
+ case a_FEH: return a_i_FEH;
+ case a_QAF: return a_i_QAF;
+ case a_KAF: return a_i_KAF;
+ case a_LAM: return a_i_LAM;
+ case a_MEEM: return a_i_MEEM;
+ case a_NOON: return a_i_NOON;
+ case a_HEH: return a_i_HEH;
+ case a_YEH: return a_i_YEH;
}
- return tempc;
+ return 0;
}
@@ -458,126 +316,48 @@ chg_c_a2i(int cur_c)
static int
chg_c_a2m(int cur_c)
{
- int tempc;
-
switch (cur_c)
{
- case a_HAMZA: /* exception */
- tempc = a_s_HAMZA;
- break;
- case a_ALEF_MADDA: /* exception */
- tempc = a_f_ALEF_MADDA;
- break;
- case a_ALEF_HAMZA_ABOVE: /* exception */
- tempc = a_f_ALEF_HAMZA_ABOVE;
- break;
- case a_WAW_HAMZA: /* exception */
- tempc = a_f_WAW_HAMZA;
- break;
- case a_ALEF_HAMZA_BELOW: /* exception */
- tempc = a_f_ALEF_HAMZA_BELOW;
- break;
- case a_YEH_HAMZA:
- tempc = a_m_YEH_HAMZA;
- break;
- case a_ALEF: /* exception */
- tempc = a_f_ALEF;
- break;
- case a_BEH:
- tempc = a_m_BEH;
- break;
- case a_TEH_MARBUTA: /* exception */
- tempc = a_f_TEH_MARBUTA;
- break;
- case a_TEH:
- tempc = a_m_TEH;
- break;
- case a_THEH:
- tempc = a_m_THEH;
- break;
- case a_JEEM:
- tempc = a_m_JEEM;
- break;
- case a_HAH:
- tempc = a_m_HAH;
- break;
- case a_KHAH:
- tempc = a_m_KHAH;
- break;
- case a_DAL: /* exception */
- tempc = a_f_DAL;
- break;
- case a_THAL: /* exception */
- tempc = a_f_THAL;
- break;
- case a_REH: /* exception */
- tempc = a_f_REH;
- break;
- case a_ZAIN: /* exception */
- tempc = a_f_ZAIN;
- break;
- case a_SEEN:
- tempc = a_m_SEEN;
- break;
- case a_SHEEN:
- tempc = a_m_SHEEN;
- break;
- case a_SAD:
- tempc = a_m_SAD;
- break;
- case a_DAD:
- tempc = a_m_DAD;
- break;
- case a_TAH:
- tempc = a_m_TAH;
- break;
- case a_ZAH:
- tempc = a_m_ZAH;
- break;
- case a_AIN:
- tempc = a_m_AIN;
- break;
- case a_GHAIN:
- tempc = a_m_GHAIN;
- break;
- case a_TATWEEL: /* exception */
- tempc = cur_c;
- break;
- case a_FEH:
- tempc = a_m_FEH;
- break;
- case a_QAF:
- tempc = a_m_QAF;
- break;
- case a_KAF:
- tempc = a_m_KAF;
- break;
- case a_LAM:
- tempc = a_m_LAM;
- break;
- case a_MEEM:
- tempc = a_m_MEEM;
- break;
- case a_NOON:
- tempc = a_m_NOON;
- break;
- case a_HEH:
- tempc = a_m_HEH;
- break;
- case a_WAW: /* exception */
- tempc = a_f_WAW;
- break;
- case a_ALEF_MAKSURA: /* exception */
- tempc = a_f_ALEF_MAKSURA;
- break;
- case a_YEH:
- tempc = a_m_YEH;
- break;
- default:
- tempc = 0;
+ case a_HAMZA: return a_s_HAMZA; /* exception */
+ case a_ALEF_MADDA: return a_f_ALEF_MADDA; /* exception */
+ case a_ALEF_HAMZA_ABOVE: return a_f_ALEF_HAMZA_ABOVE; /* exception */
+ case a_WAW_HAMZA: return a_f_WAW_HAMZA; /* exception */
+ case a_ALEF_HAMZA_BELOW: return a_f_ALEF_HAMZA_BELOW; /* exception */
+ case a_YEH_HAMZA: return a_m_YEH_HAMZA;
+ case a_ALEF: return a_f_ALEF; /* exception */
+ case a_BEH: return a_m_BEH;
+ case a_TEH_MARBUTA: return a_f_TEH_MARBUTA; /* exception */
+ case a_TEH: return a_m_TEH;
+ case a_THEH: return a_m_THEH;
+ case a_JEEM: return a_m_JEEM;
+ case a_HAH: return a_m_HAH;
+ case a_KHAH: return a_m_KHAH;
+ case a_DAL: return a_f_DAL; /* exception */
+ case a_THAL: return a_f_THAL; /* exception */
+ case a_REH: return a_f_REH; /* exception */
+ case a_ZAIN: return a_f_ZAIN; /* exception */
+ case a_SEEN: return a_m_SEEN;
+ case a_SHEEN: return a_m_SHEEN;
+ case a_SAD: return a_m_SAD;
+ case a_DAD: return a_m_DAD;
+ case a_TAH: return a_m_TAH;
+ case a_ZAH: return a_m_ZAH;
+ case a_AIN: return a_m_AIN;
+ case a_GHAIN: return a_m_GHAIN;
+ case a_TATWEEL: return cur_c; /* exception */
+ case a_FEH: return a_m_FEH;
+ case a_QAF: return a_m_QAF;
+ case a_KAF: return a_m_KAF;
+ case a_LAM: return a_m_LAM;
+ case a_MEEM: return a_m_MEEM;
+ case a_NOON: return a_m_NOON;
+ case a_HEH: return a_m_HEH;
+ case a_WAW: return a_f_WAW; /* exception */
+ case a_ALEF_MAKSURA: return a_f_ALEF_MAKSURA; /* exception */
+ case a_YEH: return a_m_YEH;
}
- return tempc;
+ return 0;
}