Hi,

Farsi is quite similar to arabic except for a few letters.  This patch
merges farsi support into arabic.c.  AFAICS, farsi.c and fkmap option
seem to be obsolete (unless someone is still using the pcf fonts).

Also it might make sense to add a new farsi option, just like the arabic
option, that when set implies "set rl" and "set keymap=persian".

Regards,
Ali

diff --git a/src/arabic.c b/src/arabic.c
index 8c1f64c..24c0b0f 100644
--- a/src/arabic.c
+++ b/src/arabic.c
@@ -15,6 +15,7 @@
  * --
  *
  * Author: Nadim Shaikli & Isam Bayazidi
+ * Farsi support added by: Ali Gholami Rudi
  *
  */
 
@@ -56,16 +57,19 @@ A_is_a(cur_c)
        case a_YEH_HAMZA:
        case a_ALEF:
        case a_BEH:
+       case a_PEH:
        case a_TEH_MARBUTA:
        case a_TEH:
        case a_THEH:
        case a_JEEM:
+       case a_TCHEH:
        case a_HAH:
        case a_KHAH:
        case a_DAL:
        case a_THAL:
        case a_REH:
        case a_ZAIN:
+       case a_JEH:
        case a_SEEN:
        case a_SHEEN:
        case a_SAD:
@@ -78,6 +82,8 @@ A_is_a(cur_c)
        case a_FEH:
        case a_QAF:
        case a_KAF:
+       case a_FKAF:
+       case a_GAF:
        case a_LAM:
        case a_MEEM:
        case a_NOON:
@@ -85,6 +91,7 @@ A_is_a(cur_c)
        case a_WAW:
        case a_ALEF_MAKSURA:
        case a_YEH:
+       case a_FYEH:
            return TRUE;
     }
 
@@ -109,16 +116,19 @@ A_is_s(cur_c)
        case a_s_YEH_HAMZA:
        case a_s_ALEF:
        case a_s_BEH:
+       case a_s_PEH:
        case a_s_TEH_MARBUTA:
        case a_s_TEH:
        case a_s_THEH:
        case a_s_JEEM:
+       case a_s_TCHEH:
        case a_s_HAH:
        case a_s_KHAH:
        case a_s_DAL:
        case a_s_THAL:
        case a_s_REH:
        case a_s_ZAIN:
+       case a_s_JEH:
        case a_s_SEEN:
        case a_s_SHEEN:
        case a_s_SAD:
@@ -130,6 +140,8 @@ A_is_s(cur_c)
        case a_s_FEH:
        case a_s_QAF:
        case a_s_KAF:
+       case a_s_FKAF:
+       case a_s_GAF:
        case a_s_LAM:
        case a_s_MEEM:
        case a_s_NOON:
@@ -137,6 +149,7 @@ A_is_s(cur_c)
        case a_s_WAW:
        case a_s_ALEF_MAKSURA:
        case a_s_YEH:
+       case a_s_FYEH:
            return TRUE;
     }
 
@@ -160,16 +173,19 @@ A_is_f(cur_c)
        case a_f_YEH_HAMZA:
        case a_f_ALEF:
        case a_f_BEH:
+       case a_f_PEH:
        case a_f_TEH_MARBUTA:
        case a_f_TEH:
        case a_f_THEH:
        case a_f_JEEM:
+       case a_f_TCHEH:
        case a_f_HAH:
        case a_f_KHAH:
        case a_f_DAL:
        case a_f_THAL:
        case a_f_REH:
        case a_f_ZAIN:
+       case a_f_JEH:
        case a_f_SEEN:
        case a_f_SHEEN:
        case a_f_SAD:
@@ -181,6 +197,8 @@ A_is_f(cur_c)
        case a_f_FEH:
        case a_f_QAF:
        case a_f_KAF:
+       case a_f_FKAF:
+       case a_f_GAF:
        case a_f_LAM:
        case a_f_MEEM:
        case a_f_NOON:
@@ -188,6 +206,7 @@ A_is_f(cur_c)
        case a_f_WAW:
        case a_f_ALEF_MAKSURA:
        case a_f_YEH:
+       case a_f_FYEH:
        case a_f_LAM_ALEF_MADDA_ABOVE:
        case a_f_LAM_ALEF_HAMZA_ABOVE:
        case a_f_LAM_ALEF_HAMZA_BELOW:
@@ -245,6 +264,9 @@ chg_c_a2s(cur_c)
        case a_ZAIN:
            tempc = a_s_ZAIN;
            break;
+       case a_JEH:
+           tempc = a_s_JEH;
+           break;
        case a_TATWEEL:                 /* exceptions */
            tempc = cur_c;
            break;
@@ -257,6 +279,9 @@ chg_c_a2s(cur_c)
        case a_BEH:
            tempc = a_s_BEH;
            break;
+       case a_PEH:
+           tempc = a_s_PEH;
+           break;
        case a_TEH:
            tempc = a_s_TEH;
            break;
@@ -266,6 +291,9 @@ chg_c_a2s(cur_c)
        case a_JEEM:
            tempc = a_s_JEEM;
            break;
+       case a_TCHEH:
+           tempc = a_s_TCHEH;
+           break;
        case a_HAH:
            tempc = a_s_HAH;
            break;
@@ -305,6 +333,12 @@ chg_c_a2s(cur_c)
        case a_KAF:
            tempc = a_s_KAF;
            break;
+       case a_FKAF:
+           tempc = a_s_FKAF;
+           break;
+       case a_GAF:
+           tempc = a_s_GAF;
+           break;
        case a_LAM:
            tempc = a_s_LAM;
            break;
@@ -320,6 +354,9 @@ chg_c_a2s(cur_c)
        case a_YEH:
            tempc = a_s_YEH;
            break;
+       case a_FYEH:
+           tempc = a_s_FYEH;
+           break;
        default:
            tempc = 0;
     }
@@ -375,6 +412,9 @@ chg_c_a2i(cur_c)
        case a_ZAIN:                    /* exceptions */
            tempc = a_s_ZAIN;
            break;
+       case a_JEH:                     /* exceptions */
+           tempc = a_s_JEH;
+           break;
        case a_TATWEEL:                 /* exceptions */
            tempc = cur_c;
            break;
@@ -387,6 +427,9 @@ chg_c_a2i(cur_c)
        case a_BEH:
            tempc = a_i_BEH;
            break;
+       case a_PEH:
+           tempc = a_i_PEH;
+           break;
        case a_TEH:
            tempc = a_i_TEH;
            break;
@@ -396,6 +439,9 @@ chg_c_a2i(cur_c)
        case a_JEEM:
            tempc = a_i_JEEM;
            break;
+       case a_TCHEH:
+           tempc = a_i_TCHEH;
+           break;
        case a_HAH:
            tempc = a_i_HAH;
            break;
@@ -435,6 +481,12 @@ chg_c_a2i(cur_c)
        case a_KAF:
            tempc = a_i_KAF;
            break;
+       case a_FKAF:
+           tempc = a_i_FKAF;
+           break;
+       case a_GAF:
+           tempc = a_i_GAF;
+           break;
        case a_LAM:
            tempc = a_i_LAM;
            break;
@@ -450,6 +502,9 @@ chg_c_a2i(cur_c)
        case a_YEH:
            tempc = a_i_YEH;
            break;
+       case a_FYEH:
+           tempc = a_i_FYEH;
+           break;
        default:
            tempc = 0;
     }
@@ -493,6 +548,9 @@ chg_c_a2m(cur_c)
        case a_BEH:
            tempc = a_m_BEH;
            break;
+       case a_PEH:
+           tempc = a_m_PEH;
+           break;
        case a_TEH_MARBUTA:             /* exception */
            tempc = a_f_TEH_MARBUTA;
            break;
@@ -505,6 +563,9 @@ chg_c_a2m(cur_c)
        case a_JEEM:
            tempc = a_m_JEEM;
            break;
+       case a_TCHEH:
+           tempc = a_m_TCHEH;
+           break;
        case a_HAH:
            tempc = a_m_HAH;
            break;
@@ -523,6 +584,9 @@ chg_c_a2m(cur_c)
        case a_ZAIN:                    /* exception */
            tempc = a_f_ZAIN;
            break;
+       case a_JEH:                     /* exception */
+           tempc = a_f_JEH;
+           break;
        case a_SEEN:
            tempc = a_m_SEEN;
            break;
@@ -559,6 +623,12 @@ chg_c_a2m(cur_c)
        case a_KAF:
            tempc = a_m_KAF;
            break;
+       case a_FKAF:
+           tempc = a_m_FKAF;
+           break;
+       case a_GAF:
+           tempc = a_m_GAF;
+           break;
        case a_LAM:
            tempc = a_m_LAM;
            break;
@@ -580,6 +650,9 @@ chg_c_a2m(cur_c)
        case a_YEH:
            tempc = a_m_YEH;
            break;
+       case a_FYEH:
+           tempc = a_m_FYEH;
+           break;
        default:
            tempc = 0;
     }
@@ -633,6 +706,9 @@ chg_c_a2f(cur_c)
        case a_BEH:
            tempc = a_f_BEH;
            break;
+       case a_PEH:
+           tempc = a_f_PEH;
+           break;
        case a_TEH_MARBUTA:
            tempc = a_f_TEH_MARBUTA;
            break;
@@ -645,6 +721,9 @@ chg_c_a2f(cur_c)
        case a_JEEM:
            tempc = a_f_JEEM;
            break;
+       case a_TCHEH:
+           tempc = a_f_TCHEH;
+           break;
        case a_HAH:
            tempc = a_f_HAH;
            break;
@@ -663,6 +742,9 @@ chg_c_a2f(cur_c)
        case a_ZAIN:
            tempc = a_f_ZAIN;
            break;
+       case a_JEH:
+           tempc = a_f_JEH;
+           break;
        case a_SEEN:
            tempc = a_f_SEEN;
            break;
@@ -699,6 +781,12 @@ chg_c_a2f(cur_c)
        case a_KAF:
            tempc = a_f_KAF;
            break;
+       case a_FKAF:
+           tempc = a_f_FKAF;
+           break;
+       case a_GAF:
+           tempc = a_f_GAF;
+           break;
        case a_LAM:
            tempc = a_f_LAM;
            break;
@@ -720,6 +808,9 @@ chg_c_a2f(cur_c)
        case a_YEH:
            tempc = a_f_YEH;
            break;
+       case a_FYEH:
+           tempc = a_f_FYEH;
+           break;
        default:
            tempc = 0;
     }
@@ -745,6 +836,9 @@ chg_c_i2m(cur_c)
        case a_i_BEH:
            tempc = a_m_BEH;
            break;
+       case a_i_PEH:
+           tempc = a_m_PEH;
+           break;
        case a_i_TEH:
            tempc = a_m_TEH;
            break;
@@ -754,6 +848,9 @@ chg_c_i2m(cur_c)
        case a_i_JEEM:
            tempc = a_m_JEEM;
            break;
+       case a_i_TCHEH:
+           tempc = a_m_TCHEH;
+           break;
        case a_i_HAH:
            tempc = a_m_HAH;
            break;
@@ -793,6 +890,12 @@ chg_c_i2m(cur_c)
        case a_i_KAF:
            tempc = a_m_KAF;
            break;
+       case a_i_FKAF:
+           tempc = a_m_FKAF;
+           break;
+       case a_i_GAF:
+           tempc = a_m_GAF;
+           break;
        case a_i_LAM:
            tempc = a_m_LAM;
            break;
@@ -808,6 +911,9 @@ chg_c_i2m(cur_c)
        case a_i_YEH:
            tempc = a_m_YEH;
            break;
+       case a_i_FYEH:
+           tempc = a_m_FYEH;
+           break;
        default:
            tempc = 0;
     }
@@ -842,6 +948,7 @@ chg_c_f2m(cur_c)
        case a_f_THAL:
        case a_f_REH:
        case a_f_ZAIN:
+       case a_f_JEH:
        case a_f_WAW:
        case a_f_ALEF_MAKSURA:
            tempc = cur_c;
@@ -849,6 +956,9 @@ chg_c_f2m(cur_c)
        case a_f_BEH:
            tempc = a_m_BEH;
            break;
+       case a_f_PEH:
+           tempc = a_m_PEH;
+           break;
        case a_f_TEH:
            tempc = a_m_TEH;
            break;
@@ -858,6 +968,9 @@ chg_c_f2m(cur_c)
        case a_f_JEEM:
            tempc = a_m_JEEM;
            break;
+       case a_f_TCHEH:
+           tempc = a_m_TCHEH;
+           break;
        case a_f_HAH:
            tempc = a_m_HAH;
            break;
@@ -897,6 +1010,12 @@ chg_c_f2m(cur_c)
        case a_f_KAF:
            tempc = a_m_KAF;
            break;
+       case a_f_FKAF:
+           tempc = a_m_FKAF;
+           break;
+       case a_f_GAF:
+           tempc = a_m_GAF;
+           break;
        case a_f_LAM:
            tempc = a_m_LAM;
            break;
@@ -912,6 +1031,9 @@ chg_c_f2m(cur_c)
        case a_f_YEH:
            tempc = a_m_YEH;
            break;
+       case a_f_FYEH:
+           tempc = a_m_FYEH;
+           break;
            /* NOTE: these encodings are multi-positional, no ?
                case a_f_LAM_ALEF_MADDA_ABOVE:
                case a_f_LAM_ALEF_HAMZA_ABOVE:
@@ -1112,9 +1234,19 @@ A_is_harakat(c)
 A_is_iso(c)
     int c;
 {
-    return ((c >= a_HAMZA && c <= a_GHAIN)
-           || (c >= a_TATWEEL && c <= a_HAMZA_BELOW)
-           || c == a_MINI_ALEF);
+    switch (c){
+    case a_MINI_ALEF:
+    case a_PEH:
+    case a_TCHEH:
+    case a_JEH:
+    case a_FKAF:
+    case a_GAF:
+    case a_FYEH:
+       return TRUE;
+    default:
+       return ((c >= a_HAMZA && c <= a_GHAIN)
+               || (c >= a_TATWEEL && c <= a_HAMZA_BELOW));
+    }
 }
 
 
diff --git a/src/arabic.h b/src/arabic.h
index 3a948d0..24ddfef 100644
--- a/src/arabic.h
+++ b/src/arabic.h
@@ -19,6 +19,7 @@
  *
  * Author: Nadim Shaikli & Isam Bayazidi
  * - (based on Unicode)
+ * Farsi support added by: Ali Gholami Rudi
  *
  */
 
@@ -40,16 +41,19 @@
 #define a_YEH_HAMZA                    0x0626
 #define a_ALEF                         0x0627
 #define a_BEH                          0x0628
+#define a_PEH                          0x067e
 #define a_TEH_MARBUTA                  0x0629
 #define a_TEH                          0x062a
 #define a_THEH                         0x062b
 #define a_JEEM                         0x062c
+#define a_TCHEH                                0x0686
 #define a_HAH                          0x062d
 #define a_KHAH                         0x062e
 #define a_DAL                          0x062f
 #define a_THAL                         0x0630
 #define a_REH                          0x0631
 #define a_ZAIN                         0x0632
+#define a_JEH                          0x0698
 #define a_SEEN                         0x0633
 #define a_SHEEN                                0x0634
 #define a_SAD                          0x0635
@@ -62,6 +66,8 @@
 #define a_FEH                          0x0641
 #define a_QAF                          0x0642
 #define a_KAF                          0x0643
+#define a_FKAF                         0x06a9
+#define a_GAF                          0x06af
 #define a_LAM                          0x0644
 #define a_MEEM                         0x0645
 #define a_NOON                         0x0646
@@ -69,6 +75,7 @@
 #define a_WAW                          0x0648
 #define a_ALEF_MAKSURA                 0x0649
 #define a_YEH                          0x064a
+#define a_FYEH                         0x06cc
 
 #define a_FATHATAN                     0x064b
 #define a_DAMMATAN                     0x064c
@@ -145,6 +152,10 @@
 #define a_f_BEH                                0xfe90
 #define a_i_BEH                                0xfe91
 #define a_m_BEH                                0xfe92
+#define a_s_PEH                                0xfb56
+#define a_f_PEH                                0xfb57
+#define a_i_PEH                                0xfb58
+#define a_m_PEH                                0xfb59
 #define a_s_TEH_MARBUTA                        0xfe93
 #define a_f_TEH_MARBUTA                        0xfe94
 #define a_s_TEH                                0xfe95
@@ -159,6 +170,10 @@
 #define a_f_JEEM                       0xfe9e
 #define a_i_JEEM                       0xfe9f
 #define a_m_JEEM                       0xfea0
+#define a_s_TCHEH                      0xfb7a
+#define a_f_TCHEH                      0xfb7b
+#define a_i_TCHEH                      0xfb7c
+#define a_m_TCHEH                      0xfb7d
 #define a_s_HAH                                0xfea1
 #define a_f_HAH                                0xfea2
 #define a_i_HAH                                0xfea3
@@ -175,6 +190,8 @@
 #define a_f_REH                                0xfeae
 #define a_s_ZAIN                       0xfeaf
 #define a_f_ZAIN                       0xfeb0
+#define a_s_JEH                                0xfb8a
+#define a_f_JEH                                0xfb8b
 #define a_s_SEEN                       0xfeb1
 #define a_f_SEEN                       0xfeb2
 #define a_i_SEEN                       0xfeb3
@@ -219,6 +236,14 @@
 #define a_f_KAF                                0xfeda
 #define a_i_KAF                                0xfedb
 #define a_m_KAF                                0xfedc
+#define a_s_FKAF                       0xfb8e
+#define a_f_FKAF                       0xfb8f
+#define a_i_FKAF                       0xfb90
+#define a_m_FKAF                       0xfb91
+#define a_s_GAF                                0xfb92
+#define a_f_GAF                                0xfb93
+#define a_i_GAF                                0xfb94
+#define a_m_GAF                                0xfb95
 #define a_s_LAM                                0xfedd
 #define a_f_LAM                                0xfede
 #define a_i_LAM                                0xfedf
@@ -243,6 +268,10 @@
 #define a_f_YEH                                0xfef2
 #define a_i_YEH                                0xfef3
 #define a_m_YEH                                0xfef4
+#define a_s_FYEH                       0xfbfc
+#define a_f_FYEH                       0xfbfd
+#define a_i_FYEH                       0xfbfe
+#define a_m_FYEH                       0xfbff
 #define a_s_LAM_ALEF_MADDA_ABOVE       0xfef5
 #define a_f_LAM_ALEF_MADDA_ABOVE       0xfef6
 #define a_s_LAM_ALEF_HAMZA_ABOVE       0xfef7
@@ -255,4 +284,4 @@
 #define a_BYTE_ORDER_MARK              0xfeff
 
 /* Range of Arabic characters that might be shaped. */
-#define ARABIC_CHAR(c)         ((c) >= a_HAMZA && (c) <= a_MINI_ALEF)
+#define ARABIC_CHAR(c)         ((c) >= a_HAMZA && (c) <= a_FYEH)

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui