changeset 407:0f6afaf1b8d1

updated for version 7.0106
author vimboss
date Sat, 09 Jul 2005 21:08:57 +0000
parents aa550d9d2403
children 06234af3a8b7
files runtime/doc/mbyte.txt runtime/doc/tags runtime/spell/pl/main.aap src/ex_getln.c src/mbyte.c src/os_unix.c src/proto/eval.pro src/undo.c src/version.h
diffstat 9 files changed, 205 insertions(+), 66 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/doc/mbyte.txt
+++ b/runtime/doc/mbyte.txt
@@ -1,4 +1,4 @@
-*mbyte.txt*     For Vim version 7.0aa.  Last change: 2005 Mar 29
+*mbyte.txt*     For Vim version 7.0aa.  Last change: 2005 Jul 09
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar et al.
@@ -286,6 +286,29 @@ 1   koi8-r	Russian
 1   koi8-u	Ukrainian
 1   macroman    MacRoman (Macintosh encoding)
 1   8bit-{name} any 8-bit encoding (Vim specific name)
+1   cp437	similar to iso-8859-1
+1   cp737	similar to iso-8859-7
+1   cp775	Baltic
+1   cp850	similar to iso-8859-4
+1   cp852	similar to iso-8859-1
+1   cp855	similar to iso-8859-2
+1   cp857	similar to iso-8859-5
+1   cp860	similar to iso-8859-9
+1   cp861	similar to iso-8859-1
+1   cp862	similar to iso-8859-1
+1   cp863	similar to iso-8859-8
+1   cp865	similar to iso-8859-1
+1   cp866	similar to iso-8859-5
+1   cp869	similar to iso-8859-7
+1   cp874	Thai
+1   cp1250	Czech, Polish, etc.
+1   cp1251	Cyrillic
+1   cp1253	Greek
+1   cp1254	Turkish
+1   cp1255	Hebrew
+1   cp1256	Arabic
+1   cp1257	Baltic
+1   cp1258	Vietnamese
 1   cp{number}	MS-Windows: any installed single-byte codepage
 2   cp932	Japanese (Windows only)
 2   euc-jp	Japanese (Unix only)
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -5148,6 +5148,7 @@ hebrew	hebrew.txt	/*hebrew*
 hebrew.txt	hebrew.txt	/*hebrew.txt*
 help	various.txt	/*help*
 help-context	help.txt	/*help-context*
+help-tags	tags	1
 help-translated	various.txt	/*help-translated*
 help-xterm-window	various.txt	/*help-xterm-window*
 help.txt	help.txt	/*help.txt*
--- a/runtime/spell/pl/main.aap
+++ b/runtime/spell/pl/main.aap
@@ -18,10 +18,8 @@ all: $(SPELLDIR)/pl.iso-8859-2.spl $(SPE
 $(SPELLDIR)/pl.utf-8.spl : $(VIM) $(FILES)
         :sys env LANG=pl_PL.UTF-8 $(VIM) -e -c "mkspell! $(SPELLDIR)/pl pl_PL" -c q
 
-# On Unix 'encoding' can't be "cp1250", use "8bit-cp1250" instead.
 $(SPELLDIR)/pl.cp1250.spl : $(VIM) $(FILES)
-        :sys $(VIM) -e -c "set enc=8bit-cp1250" -c "mkspell! $(SPELLDIR)/pl pl_PL" -c q
-        :move {f} $(SPELLDIR)/pl.8bit-cp1250.spl $(SPELLDIR)/pl.cp1250.spl
+        :sys $(VIM) -e -c "set enc=cp1250" -c "mkspell! $(SPELLDIR)/pl pl_PL" -c q
 
 ../README_pl.txt: README_pl_PL.txt
         :copy $source $target
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -100,6 +100,7 @@ static int	expand_showtail __ARGS((expan
 static int	ExpandRTDir __ARGS((char_u *pat, int *num_file, char_u ***file, char *dirname));
 # if defined(FEAT_USR_CMDS) && defined(FEAT_EVAL)
 static int	ExpandUserDefined __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file));
+static int	ExpandUserList __ARGS((expand_T *xp, int *num_file, char_u ***file));
 # endif
 #endif
 
@@ -3702,7 +3703,8 @@ addstar(fname, len, context)
 
 		/* Custom expansion takes care of special things, match
 		 * backslashes literally (perhaps also for other types?) */
-		if (context == EXPAND_USER_DEFINED && fname[i] == '\\')
+		if ((context == EXPAND_USER_DEFINED ||
+		     context == EXPAND_USER_LIST) && fname[i] == '\\')
 		    new_len++;		/* '\' becomes "\\" */
 	    }
 	    retval = alloc(new_len);
@@ -3715,7 +3717,9 @@ addstar(fname, len, context)
 		    /* Skip backslash.  But why?  At least keep it for custom
 		     * expansion. */
 		    if (context != EXPAND_USER_DEFINED
-					    && fname[i] == '\\' && ++i == len)
+			    && context != EXPAND_USER_LIST
+			    && fname[i] == '\\'
+			    && ++i == len)
 			break;
 
 		    switch (fname[i])
@@ -3729,7 +3733,8 @@ addstar(fname, len, context)
 			case '.':   if (context == EXPAND_BUFFERS)
 					retval[j++] = '\\';
 				    break;
-			case '\\':  if (context == EXPAND_USER_DEFINED)
+			case '\\':  if (context == EXPAND_USER_DEFINED
+					    || context == EXPAND_USER_LIST)
 					retval[j++] = '\\';
 				    break;
 		    }
@@ -4029,6 +4034,10 @@ ExpandFromContext(xp, pat, num_file, fil
 	return ExpandRTDir(pat, num_file, file, "colors");
     if (xp->xp_context == EXPAND_COMPILER)
 	return ExpandRTDir(pat, num_file, file, "compiler");
+# if defined(FEAT_USR_CMDS) && defined(FEAT_EVAL)
+    if (xp->xp_context == EXPAND_USER_LIST)
+        return ExpandUserList(xp, num_file, file);
+# endif
 
     regmatch.regprog = vim_regcomp(pat, p_magic ? RE_MAGIC : 0);
     if (regmatch.regprog == NULL)
@@ -4185,27 +4194,25 @@ ExpandGeneric(xp, regmatch, num_file, fi
 
 # if defined(FEAT_USR_CMDS) && defined(FEAT_EVAL)
 /*
- * Expand names with a function defined by the user.
+ * call "user_expand_func()" to invoke a user defined VimL function and return
+ * the result (either a string or a List).
  */
-    static int
-ExpandUserDefined(xp, regmatch, num_file, file)
+    static void *
+call_user_expand_func(user_expand_func, xp, num_file, file)
+    void	*(*user_expand_func) __ARGS((char_u *, int, char_u **, int));
     expand_T	*xp;
-    regmatch_T	*regmatch;
     int		*num_file;
     char_u	***file;
 {
+    char_u	keep;
+    char_u	num[50];
     char_u	*args[3];
-    char_u	*all;
-    char_u	*s;
-    char_u	*e;
-    char_u      keep;
-    char_u      num[50];
-    garray_T	ga;
     int		save_current_SID = current_SID;
+    void	*ret;
     struct cmdline_info	    save_ccline;
 
     if (xp->xp_arg == NULL || xp->xp_arg[0] == '\0')
-	return FAIL;
+	return NULL;
     *num_file = 0;
     *file = NULL;
 
@@ -4222,17 +4229,38 @@ ExpandUserDefined(xp, regmatch, num_file
     ccline.cmdprompt = NULL;
     current_SID = xp->xp_scriptID;
 
-    all = call_vim_function(xp->xp_arg, 3, args, FALSE);
+    ret = user_expand_func(xp->xp_arg, 3, args, FALSE);
 
     ccline = save_ccline;
     current_SID = save_current_SID;
 
     ccline.cmdbuff[ccline.cmdlen] = keep;
-    if (all == NULL)
+
+    return ret;
+}
+
+/*
+ * Expand names with a function defined by the user.
+ */
+    static int
+ExpandUserDefined(xp, regmatch, num_file, file)
+    expand_T	*xp;
+    regmatch_T	*regmatch;
+    int		*num_file;
+    char_u	***file;
+{
+    char_u	*retstr;
+    char_u	*s;
+    char_u	*e;
+    char_u      keep;
+    garray_T	ga;
+
+    retstr = call_user_expand_func(call_func_retstr, xp, num_file, file);
+    if (retstr == NULL)
 	return FAIL;
 
     ga_init2(&ga, (int)sizeof(char *), 3);
-    for (s = all; *s != NUL; s = e)
+    for (s = retstr; *s != NUL; s = e)
     {
 	e = vim_strchr(s, '\n');
 	if (e == NULL)
@@ -4258,7 +4286,45 @@ ExpandUserDefined(xp, regmatch, num_file
 	if (*e != NUL)
 	    ++e;
     }
-    vim_free(all);
+    vim_free(retstr);
+    *file = ga.ga_data;
+    *num_file = ga.ga_len;
+    return OK;
+}
+
+/*
+ * Expand names with a list returned by a function defined by the user.
+ */
+    static int
+ExpandUserList(xp, num_file, file)
+    expand_T	*xp;
+    int		*num_file;
+    char_u	***file;
+{
+    list_T      *retlist;
+    listitem_T	*li;
+    garray_T	ga;
+
+    retlist = call_user_expand_func(call_func_retlist, xp, num_file, file);
+    if (retlist == NULL)
+	return FAIL;
+
+    ga_init2(&ga, (int)sizeof(char *), 3);
+    /* Loop over the items in the list. */
+    for (li = retlist->lv_first; li != NULL; li = li->li_next)
+    {
+	if (li->li_tv.v_type != VAR_STRING)
+	    continue;  /* Skip non-string items */
+
+	if (ga_grow(&ga, 1) == FAIL)
+	    break;
+
+	((char_u **)ga.ga_data)[ga.ga_len] =
+	    vim_strsave(li->li_tv.vval.v_string);
+	++ga.ga_len;
+    }
+    list_unref(retlist);
+
     *file = ga.ga_data;
     *num_file = ga.ga_len;
     return OK;
--- a/src/mbyte.c
+++ b/src/mbyte.c
@@ -201,67 +201,117 @@ enc_canon_table[] =
     {"iso-8859-6",	ENC_8BIT,		0},
 #define IDX_ISO_7	6
     {"iso-8859-7",	ENC_8BIT,		0},
-#define IDX_CP1255	7
-    {"cp1255",		ENC_8BIT,		1255}, /* close to iso-8859-8 */
-#define IDX_ISO_8	8
+#define IDX_ISO_8	7
     {"iso-8859-8",	ENC_8BIT,		0},
-#define IDX_ISO_9	9
+#define IDX_ISO_9	8
     {"iso-8859-9",	ENC_8BIT,		0},
-#define IDX_ISO_10	10
+#define IDX_ISO_10	9
     {"iso-8859-10",	ENC_8BIT,		0},
-#define IDX_ISO_11	11
+#define IDX_ISO_11	10
     {"iso-8859-11",	ENC_8BIT,		0},
-#define IDX_ISO_13	12
+#define IDX_ISO_13	11
     {"iso-8859-13",	ENC_8BIT,		0},
-#define IDX_ISO_14	13
+#define IDX_ISO_14	12
     {"iso-8859-14",	ENC_8BIT,		0},
-#define IDX_ISO_15	14
+#define IDX_ISO_15	13
     {"iso-8859-15",	ENC_8BIT + ENC_LATIN9,	0},
-#define IDX_KOI8_R	15
+#define IDX_KOI8_R	14
     {"koi8-r",		ENC_8BIT,		0},
-#define IDX_KOI8_U	16
+#define IDX_KOI8_U	15
     {"koi8-u",		ENC_8BIT,		0},
-#define IDX_UTF8	17
+#define IDX_UTF8	16
     {"utf-8",		ENC_UNICODE,		0},
-#define IDX_UCS2	18
+#define IDX_UCS2	17
     {"ucs-2",		ENC_UNICODE + ENC_ENDIAN_B + ENC_2BYTE, 0},
-#define IDX_UCS2LE	19
+#define IDX_UCS2LE	18
     {"ucs-2le",		ENC_UNICODE + ENC_ENDIAN_L + ENC_2BYTE, 0},
-#define IDX_UTF16	20
+#define IDX_UTF16	19
     {"utf-16",		ENC_UNICODE + ENC_ENDIAN_B + ENC_2WORD, 0},
-#define IDX_UTF16LE	21
+#define IDX_UTF16LE	20
     {"utf-16le",	ENC_UNICODE + ENC_ENDIAN_L + ENC_2WORD, 0},
-#define IDX_UCS4	22
+#define IDX_UCS4	21
     {"ucs-4",		ENC_UNICODE + ENC_ENDIAN_B + ENC_4BYTE, 0},
-#define IDX_UCS4LE	23
+#define IDX_UCS4LE	22
     {"ucs-4le",		ENC_UNICODE + ENC_ENDIAN_L + ENC_4BYTE, 0},
-#define IDX_DEBUG	24
+
+    /* For debugging DBCS encoding on Unix. */
+#define IDX_DEBUG	23
     {"debug",		ENC_DBCS,		DBCS_DEBUG},
-#define IDX_CP932	25
-    {"cp932",		ENC_DBCS,		DBCS_JPN},
-#define IDX_CP949	26
-    {"cp949",		ENC_DBCS,		DBCS_KOR},
-#define IDX_CP936	27
-    {"cp936",		ENC_DBCS,		DBCS_CHS},
-#define IDX_CP950	28
-    {"cp950",		ENC_DBCS,		DBCS_CHT},
-#define IDX_EUC_JP	29
+#define IDX_EUC_JP	24
     {"euc-jp",		ENC_DBCS,		DBCS_JPNU},
-#define IDX_SJIS	30
+#define IDX_SJIS	25
     {"sjis",		ENC_DBCS,		DBCS_JPN},
-#define IDX_EUC_KR	31
+#define IDX_EUC_KR	26
     {"euc-kr",		ENC_DBCS,		DBCS_KORU},
-#define IDX_EUC_CN	32
+#define IDX_EUC_CN	27
     {"euc-cn",		ENC_DBCS,		DBCS_CHSU},
-#define IDX_EUC_TW	33
+#define IDX_EUC_TW	28
     {"euc-tw",		ENC_DBCS,		DBCS_CHTU},
-#define IDX_BIG5	34
+#define IDX_BIG5	29
     {"big5",		ENC_DBCS,		DBCS_CHT},
-#define IDX_CP1251	35
-    {"cp1251",		ENC_8BIT,		1251},
-#define IDX_MACROMAN	36
-    {"macroman",	ENC_8BIT + ENC_MACROMAN, 0},
-#define IDX_COUNT	37
+
+    /* MS-DOS and MS-Windows codepages are included here, so that they can be
+     * used on Unix too.  Most of them are similar to ISO-8859 encodings, but
+     * not exactly the same. */
+#define IDX_CP437	30
+    {"cp437",		ENC_8BIT,		437}, /* like iso-8859-1 */
+#define IDX_CP737	31
+    {"cp737",		ENC_8BIT,		737}, /* like iso-8859-7 */
+#define IDX_CP775	32
+    {"cp775",		ENC_8BIT,		775}, /* Baltic */
+#define IDX_CP850	33
+    {"cp850",		ENC_8BIT,		850}, /* like iso-8859-4 */
+#define IDX_CP852	34
+    {"cp852",		ENC_8BIT,		852}, /* like iso-8859-1 */
+#define IDX_CP855	35
+    {"cp855",		ENC_8BIT,		855}, /* like iso-8859-2 */
+#define IDX_CP857	36
+    {"cp857",		ENC_8BIT,		857}, /* like iso-8859-5 */
+#define IDX_CP860	37
+    {"cp860",		ENC_8BIT,		860}, /* like iso-8859-9 */
+#define IDX_CP861	38
+    {"cp861",		ENC_8BIT,		861}, /* like iso-8859-1 */
+#define IDX_CP862	39
+    {"cp862",		ENC_8BIT,		862}, /* like iso-8859-1 */
+#define IDX_CP863	40
+    {"cp863",		ENC_8BIT,		863}, /* like iso-8859-8 */
+#define IDX_CP865	41
+    {"cp865",		ENC_8BIT,		865}, /* like iso-8859-1 */
+#define IDX_CP866	42
+    {"cp866",		ENC_8BIT,		866}, /* like iso-8859-5 */
+#define IDX_CP869	43
+    {"cp869",		ENC_8BIT,		869}, /* like iso-8859-7 */
+#define IDX_CP874	44
+    {"cp874",		ENC_8BIT,		874}, /* Thai */
+#define IDX_CP932	45
+    {"cp932",		ENC_DBCS,		DBCS_JPN},
+#define IDX_CP936	46
+    {"cp936",		ENC_DBCS,		DBCS_CHS},
+#define IDX_CP949	47
+    {"cp949",		ENC_DBCS,		DBCS_KOR},
+#define IDX_CP950	48
+    {"cp950",		ENC_DBCS,		DBCS_CHT},
+#define IDX_CP1250	49
+    {"cp1250",		ENC_8BIT,		1250}, /* Czech, Polish, etc. */
+#define IDX_CP1251	50
+    {"cp1251",		ENC_8BIT,		1251}, /* Cyrillic */
+    /* cp1252 is considered to be equal to latin1 */
+#define IDX_CP1253	51
+    {"cp1253",		ENC_8BIT,		1253}, /* Greek */
+#define IDX_CP1254	52
+    {"cp1254",		ENC_8BIT,		1254}, /* Turkish */
+#define IDX_CP1255	53
+    {"cp1255",		ENC_8BIT,		1255}, /* Hebrew */
+#define IDX_CP1256	54
+    {"cp1256",		ENC_8BIT,		1256}, /* Arabic */
+#define IDX_CP1257	55
+    {"cp1257",		ENC_8BIT,		1257}, /* Baltic */
+#define IDX_CP1258	56
+    {"cp1258",		ENC_8BIT,		1258}, /* Vietnamese */
+
+#define IDX_MACROMAN	57
+    {"macroman",	ENC_8BIT + ENC_MACROMAN, 0},	/* Mac OS */
+#define IDX_COUNT	58
 };
 
 /*
@@ -2882,7 +2932,7 @@ enc_locale()
 
     if (acp == 1200)
 	STRCPY(buf, "ucs-2le");
-    else if (acp == 1252)
+    else if (acp == 1252)	    /* cp1252 is used as latin1 */
 	STRCPY(buf, "latin1");
     else
 	sprintf(buf, "cp%ld", acp);
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -4432,7 +4432,7 @@ RealWaitForChar(fd, msec, check_for_gpm)
 #endif
 
 #ifdef MAY_LOOP
-    while (1)
+    for (;;)
 #endif
     {
 #ifdef MAY_LOOP
--- a/src/proto/eval.pro
+++ b/src/proto/eval.pro
@@ -22,7 +22,8 @@ char_u *eval_to_string_safe __ARGS((char
 int eval_to_number __ARGS((char_u *expr));
 list_T *eval_spell_expr __ARGS((char_u *badword, char_u *expr));
 int get_spellword __ARGS((list_T *list, char_u **pp));
-char_u *call_vim_function __ARGS((char_u *func, int argc, char_u **argv, int safe));
+void *call_func_retstr __ARGS((char_u *func, int argc, char_u **argv, int safe));
+void *call_func_retlist __ARGS((char_u *func, int argc, char_u **argv, int safe));
 void *save_funccal __ARGS((void));
 void restore_funccal __ARGS((void *vfc));
 void prof_child_enter __ARGS((proftime_T *tm));
--- a/src/undo.c
+++ b/src/undo.c
@@ -1372,7 +1372,7 @@ u_alloc_line(size)
     /* In this block find a chunk with enough space. */
     mprev = curbuf->b_m_search;
     mp = curbuf->b_m_search->m_next;
-    while (1)
+    for (;;)
     {
 	if (mp == NULL)			    /* at end of the list */
 	    mp = &(mbp->mb_info);	    /* wrap around to begin */
--- a/src/version.h
+++ b/src/version.h
@@ -36,5 +36,5 @@
 #define VIM_VERSION_NODOT	"vim70aa"
 #define VIM_VERSION_SHORT	"7.0aa"
 #define VIM_VERSION_MEDIUM	"7.0aa ALPHA"
-#define VIM_VERSION_LONG	"VIM - Vi IMproved 7.0aa ALPHA (2005 Jul 8)"
-#define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 7.0aa ALPHA (2005 Jul 8, compiled "
+#define VIM_VERSION_LONG	"VIM - Vi IMproved 7.0aa ALPHA (2005 Jul 9)"
+#define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 7.0aa ALPHA (2005 Jul 9, compiled "