summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Filelist9
-rw-r--r--runtime/doc/eval.txt26
-rw-r--r--runtime/doc/tags3
-rw-r--r--runtime/doc/todo.txt42
-rw-r--r--runtime/doc/version7.txt16
-rw-r--r--src/Makefile30
-rwxr-xr-xsrc/auto/configure8
-rw-r--r--src/config.mk.in2
-rw-r--r--src/configure.in7
-rw-r--r--src/eval.c79
-rw-r--r--src/fileio.c78
-rw-r--r--src/mbyte.c111
-rw-r--r--src/mysign2
-rw-r--r--src/option.c8
-rw-r--r--src/os_mac.h38
-rw-r--r--src/os_mac.pbproj/project.pbxproj1537
-rw-r--r--src/os_mac_conv.c230
-rw-r--r--src/os_macosx.c34
-rw-r--r--src/testdir/test11.in5
-rw-r--r--src/vim.h31
20 files changed, 2038 insertions, 258 deletions
diff --git a/Filelist b/Filelist
index 627837c053..889b8e856c 100644
--- a/Filelist
+++ b/Filelist
@@ -358,7 +358,14 @@ SRC_MAC = \
src/gui_mac.c \
src/gui_mac.icns \
src/gui_mac.r \
- src/os_mac* \
+ src/os_mac.build \
+ src/os_mac.c \
+ src/os_mac.h \
+ src/os_mac.rsr.hqx \
+ src/os_mac.sit.hqx \
+ src/os_mac_conv.c \
+ src/os_macosx.c \
+ src/os_mac.pbproj/project.pbxproj
src/proto/gui_mac.pro \
src/proto/os_mac.pro \
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index e51d372675..400eb76a56 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1,4 +1,4 @@
-*eval.txt* For Vim version 7.0aa. Last change: 2004 Jul 05
+*eval.txt* For Vim version 7.0aa. Last change: 2004 Jul 18
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -814,6 +814,7 @@ bufname( {expr}) String Name of the buffer {expr}
bufnr( {expr}) Number Number of the buffer {expr}
bufwinnr( {expr}) Number window number of buffer {expr}
byte2line( {byte}) Number line number at byte count {byte}
+byteidx( {expr}, {nr}) Number byte index of {nr}'th char in {expr}
char2nr( {expr}) Number ASCII value of first char in {expr}
cindent( {lnum}) Number C indent for line {lnum}
col( {expr}) Number column nr of cursor or mark
@@ -897,6 +898,7 @@ remote_read( {serverid}) String read reply string
remote_send( {server}, {string} [, {idvar}])
String send key sequence
rename( {from}, {to}) Number rename (move) file from {from} to {to}
+repeat( {expr}, {count}) String repeat {expr} {count} times
resolve( {filename}) String get filename a shortcut points to
search( {pattern} [, {flags}]) Number search for {pattern}
searchpair( {start}, {middle}, {end} [, {flags} [, {skip}]])
@@ -1072,6 +1074,22 @@ byte2line({byte}) *byte2line()*
{not available when compiled without the |+byte_offset|
feature}
+byteidx({expr}, {nr}) *byteidx()*
+ Return byte index of the {nr}'th character in the string
+ {expr}. Use zero for the first character, it returns zero.
+ This function is only useful when there are multibyte
+ characters, otherwise the returned value is equal to {nr}.
+ Composing characters are counted as a separate character.
+ Example : >
+ echo matchstr(str, ".", byteidx(str, 3))
+< will display the fourth character. Another way to do the
+ same: >
+ let s = strpart(str, byteidx(str, 3))
+ echo strpart(s, 0, byteidx(s, 1))
+< If there are less than {nr} characters -1 is returned.
+ If there are exactly {nr} characters the length of the string
+ is returned.
+
char2nr({expr}) *char2nr()*
Return number value of the first char in {expr}. Examples: >
char2nr(" ") returns 32
@@ -2179,6 +2197,12 @@ rename({from}, {to}) *rename()*
successfully, and non-zero when the renaming failed.
This function is not available in the |sandbox|.
+repeat({expr}, {count}) *repeat()*
+ Repeat {expr} {count} times and return the concatenated
+ result. Example: >
+ :let seperator = repeat('-', 80)
+< When {count} is zero or negative the result is empty.
+
resolve({filename}) *resolve()* *E655*
On MS-Windows, when {filename} is a shortcut (a .lnk file),
returns the path the shortcut points to in a simplified form.
diff --git a/runtime/doc/tags b/runtime/doc/tags
index fe79d84d1d..e44ac444f7 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -5789,6 +5789,7 @@ remove-filetype filetype.txt /*remove-filetype*
remove-option-flags options.txt /*remove-option-flags*
rename() eval.txt /*rename()*
rename-files tips.txt /*rename-files*
+repeat() eval.txt /*repeat()*
repeat.txt repeat.txt /*repeat.txt*
repeating repeat.txt /*repeating*
replacing change.txt /*replacing*
@@ -5866,6 +5867,8 @@ s<CR> change.txt /*s<CR>*
sandbox eval.txt /*sandbox*
save-file editing.txt /*save-file*
save-settings starting.txt /*save-settings*
+scheme-syntax syntax.txt /*scheme-syntax*
+scheme.vim syntax.txt /*scheme.vim*
scp pi_netrw.txt /*scp*
script-here if_perl.txt /*script-here*
script-local map.txt /*script-local*
diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt
index fa1ddffd2c..ba4af3ef07 100644
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1,4 +1,4 @@
-*todo.txt* For Vim version 7.0aa. Last change: 2004 Jul 16
+*todo.txt* For Vim version 7.0aa. Last change: 2004 Jul 18
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -30,37 +30,12 @@ be worked on, but only if you sponsor Vim development. See |sponsor|.
*known-bugs*
-------------------- Known bugs and current work -----------------------
-When switching between Aap script and make Vim won't always run.
+Add fix for zh_cn to Vim 6.3? (Liang)
-Mac: Compiling --enable-gui=athena doesn't work. Try to fix without disabling
-Carbon. Otherwise adjust configure to disable Darwin. (raf)
-
-Mac: "make install" doesn't install. Patch from RAF.
-
-UTF-8 in 'comments' causes wrong indent. Counting bytes instead of char
-width? (Nikolai Weibull)
For version 7.0:
- Include many PATCHES:
8 Add functions:
- strrep() Repeat a string (patch from Christophe Poucet,
- 2003 Sep 12, also contains XX)
- Alt: repeat(expr, count) werkt ook voor lists.
- mousex() mousey() get position of mouse pointer (patch by Ross
- Presser)
- He will send a new patch.
- Is this really useful?
- multibyteidx(string, idx) Byte index in multi-byte character.
- Patch by Ilya Sher, 2004 Feb 25
- Update June 18 (third one).
- menuprop({name}, {idx}, {what})
- Get menu property of menu {name} item {idx}.
- menuprop("", 1, "name") returns "File".
- menuprop("File", 1, "n") returns "nmenu
- File.Open..." argument.
- Patch by Ilya Sher, 2004 Apr 22
- mapname({idx}, mode) return the name of the idx'th mapping.
- Patch by Ilya Sher, 2004 Mar 4.
match({pat}, {string} [,start] [,count]) get index of count'th match
Patch by Ilya Sher, 2004 Jun 19
find() find file in 'path' (patch from Johannes
@@ -287,6 +262,8 @@ For version 7.0:
- When using 'incsearch" CTRL-R CTRL-W gets the word under the cursor, but
the part that already matched is doubled then. Remove the part of the
word that would be doubled. Make it work line CTRL-N in Insert mode.
+- Add Lua interface? (Wolfgang Oertl)
+
Vi incompatibility:
8 With undo/redo only marks in the changed lines should be changed. Other
@@ -1486,6 +1463,17 @@ Built-in script language:
7 Add argument to winwidth() to subtract the space taken by 'foldcolumn',
signs and/or 'number'.
8 Add functions:
+ menuprop({name}, {idx}, {what})
+ Get menu property of menu {name} item {idx}.
+ menuprop("", 1, "name") returns "File".
+ menuprop("File", 1, "n") returns "nmenu
+ File.Open..." argument.
+ Patch by Ilya Sher, 2004 Apr 22
+ Return a list of menus and/or a dictionary
+ with properties instead.
+ mapname({idx}, mode) return the name of the idx'th mapping.
+ Patch by Ilya Sher, 2004 Mar 4.
+ Return a list instead.
sprintf(format, arg, ..) How to prevent a crash???
attributes() return file protection flags "drwxrwxrwx"
mkdir(dir) Create directory
diff --git a/runtime/doc/version7.txt b/runtime/doc/version7.txt
index a1c902cf2c..a7f7d1997c 100644
--- a/runtime/doc/version7.txt
+++ b/runtime/doc/version7.txt
@@ -1,4 +1,4 @@
-*version7.txt* For Vim version 7.0aa. Last change: 2004 Jul 16
+*version7.txt* For Vim version 7.0aa. Last change: 2004 Jul 18
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -123,7 +123,10 @@ Win32: The ":winpos" command now also works in the console. (Vipin Aravind)
New functions: ~
-tr(expr, from, to) |tr()| Translate characters. (Ron Aaron)
+repeat(expr, count) |repeat()| Repeat "expr" "count" times.
+ (Christophe Poucet)
+tr(expr, from, to) |tr()| Translate characters. (Ron Aaron)
+byteidx(expr, nr) |byteidx()| Index of a character. (Ilya Sher)
New autocommand events: ~
@@ -182,6 +185,12 @@ For lisp indenting and matching parenthesis: (Sergey Khorev)
==============================================================================
COMPILE TIME CHANGES *compile-changes-7*
+Mac: "make" now creates the Vim.app directory and "make install" copies it to
+its final destination. (Raf)
+
+Mac: Made it possible to compile with Motif, Athena or GTK without tricks and
+still being able to use the MacRoman conversion. Added the os_mac_conv.c
+file.
==============================================================================
BUG FIXES *bug-fixes-7*
@@ -255,4 +264,7 @@ When 'comments' includes multi-byte characters inserting the middle part and
alignment may go wrong. 'cindent' also suffers from this for right-aligned
items.
+The default for 'helplang' was "zh" for both "zh_cn" and "zh_tw". Now use
+"cn" or "tw" as intended.
+
vim:tw=78:ts=8:ft=help:norl:
diff --git a/src/Makefile b/src/Makefile
index bfdd769396..e080477d6e 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1196,7 +1196,9 @@ CARBONGUI_LIBS2 =
CARBONGUI_INSTALL = install_macosx
CARBONGUI_TARGETS =
CARBONGUI_MAN_TARGETS =
-CARBONGUI_TESTTARGET =
+CARBONGUI_TESTTARGET = gui
+CARBONGUI_BUNDLE = $(VIMNAME).app
+CARBONGUI_TESTARG = VIMPROG=../$(CARBONGUI_BUNDLE)/Contents/MacOS/$(VIMTARGET)
# All GUI files
ALL_GUI_SRC = gui.c gui_gtk.c gui_gtk_f.c gui_motif.c gui_athena.c gui_gtk_x11.c gui_x11.c gui_at_sb.c gui_at_fs.c pty.c gui_kde.cc gui_kde_widget.cc gui_kde_x11.cc gui_kde_widget_moc.cc
@@ -1465,7 +1467,7 @@ PRO_MANUAL = os_amiga.pro os_msdos.pro os_win16.pro os_win32.pro \
os_mswin.pro os_beos.pro os_vms.pro os_riscos.pro $(PERL_PRO)
# Default target is making the executable and tools
-all: $(VIMTARGET) $(TOOLS) languages
+all: $(VIMTARGET) $(TOOLS) languages $(GUI_BUNDLE)
tools: $(TOOLS)
@@ -1641,7 +1643,7 @@ types.vim: $(TAGS_SRC) $(TAGS_INCL)
#
test check:
$(MAKE) -f Makefile $(VIMTARGET)
- cd testdir; $(MAKE) -f Makefile $(GUI_TESTTARGET) VIMPROG=../$(VIMTARGET)
+ cd testdir; $(MAKE) -f Makefile $(GUI_TESTTARGET) VIMPROG=../$(VIMTARGET) $(GUI_TESTARG)
testclean:
cd testdir; $(MAKE) -f Makefile clean
@@ -2035,6 +2037,7 @@ clean celan: testclean
-rm -f *.o objects/* core $(VIMTARGET).core $(VIMTARGET) xxd/*.o
-rm -f $(TOOLS) auto/osdef.h auto/pathdef.c auto/if_perl.c
-rm -f conftest* *~ auto/link.sed
+ -rm -rf $(GUI_BUNDLE)
-rm -f gui_kde_widget_moc.cc kvim_iface_skel.cc *.kidl
if test -d $(PODIR); then \
cd $(PODIR); $(MAKE) prefix=$(DESTDIR)$(prefix) clean; \
@@ -2327,6 +2330,9 @@ objects/os_qnx.o: os_qnx.c
objects/os_macosx.o: os_macosx.c
$(CCC) -o $@ os_macosx.c
+objects/os_mac_conv.o: os_mac_conv.c
+ $(CCC) -o $@ os_mac_conv.c
+
objects/os_unix.o: os_unix.c
$(CCC) -o $@ os_unix.c
@@ -2410,13 +2416,11 @@ Makefile:
###############################################################################
### MacOS X installation
###
-### This creates a runnable Vim.app in the src directory
+### This installs a runnable Vim.app in $(prefix)
REZ = /Developer/Tools/Rez
-APPDIR = $(VIMNAME).app
+APPDIR = $(GUI_BUNDLE)
RESDIR = $(APPDIR)/Contents/Resources
-# FIXME: i'm sure someone else can do something clever with grep
-# sed and version.h here
VERSION = $(VIMMAJOR).$(VIMMINOR)
### Common flags
@@ -2434,7 +2438,10 @@ ICONS = $(RESDIR)/$(ICON_APP)
#ICON_DOCTXT = $(shell if [ -e doc-txt.icns ] ; then echo doc-txt.icns ; else echo ; fi)
#ICONS = $(addprefix $(RESDIR)/, $(ICON_APP) $(ICON_DOC) $(ICON_DOCTXT))
-install_macosx: bundle-dir bundle-executable bundle-info bundle-resource \
+install_macosx: $(APPDIR)
+ $(INSTALL_DATA_R) $(APPDIR) $(DESTDIR)$(prefix)
+
+$(APPDIR): bundle-dir bundle-executable bundle-info bundle-resource \
bundle-language
bundle-dir: $(APPDIR)/Contents $(VIMTARGET)
@@ -2473,11 +2480,8 @@ bundle-rsrc: os_mac.rsr.hqx
bundle-language: bundle-dir
$(APPDIR)/Contents:
- mkdir $(APPDIR)
- mkdir $(APPDIR)/Contents
- mkdir $(APPDIR)/Contents/MacOS
- mkdir $(RESDIR)
- mkdir $(RESDIR)/English.lproj
+ -$(SHELL) ./mkinstalldirs $(APPDIR)/Contents/MacOS
+ -$(SHELL) ./mkinstalldirs $(RESDIR)/English.lproj
$(RESDIR)/%.icns: %.icns
cp $< $@
diff --git a/src/auto/configure b/src/auto/configure
index 220a981be6..4b03c678b7 100755
--- a/src/auto/configure
+++ b/src/auto/configure
@@ -1239,11 +1239,11 @@ echo "configure:1230: checking if Darwin files are there" >&5
if test "$enable_darwin" = "yes"; then
MACOSX=yes
- OS_EXTRA_SCR="os_macosx.c";
- OS_EXTRA_OBJ="objects/os_macosx.o"
+ OS_EXTRA_SCR="os_macosx.c os_mac_conv.c";
+ OS_EXTRA_OBJ="objects/os_macosx.o objects/os_mac_conv.o"
CPPFLAGS="$CPPFLAGS -DMACOS_X_UNIX -I/Developer/Headers/FlatCarbon -no-cpp-precomp"
- ac_safe=`echo "Carbon/Carbon.h" | sed 'y%./+-%__p_%'`
+ ac_safe=`echo "Carbon/Carbon.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for Carbon/Carbon.h""... $ac_c" 1>&6
echo "configure:1249: checking for Carbon/Carbon.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
@@ -1277,7 +1277,7 @@ else
fi
if test "x$CARBON" = "xyes"; then
- if test -z "$with_x"; then
+ if test -z "$with_x" -a "X$enable_gui" != Xmotif -a "X$enable_gui" != Xathena -a "X$enable_gui" != Xgtk -a "X$enable_gui" != Xgtk2; then
with_x=no
DEFAULT_VIMNAME=Vim
fi
diff --git a/src/config.mk.in b/src/config.mk.in
index ed5f686ff4..d5103ecd4c 100644
--- a/src/config.mk.in
+++ b/src/config.mk.in
@@ -126,6 +126,8 @@ GUI_INSTALL = $(@GUITYPE@_INSTALL)
GUI_TARGETS = $(@GUITYPE@_TARGETS)
GUI_MAN_TARGETS = $(@GUITYPE@_MAN_TARGETS)
GUI_TESTTARGET = $(@GUITYPE@_TESTTARGET)
+GUI_TESTARG = $(@GUITYPE@_TESTARG)
+GUI_BUNDLE = $(@GUITYPE@_BUNDLE)
NARROW_PROTO = @NARROW_PROTO@
GUI_X_LIBS = @GUI_X_LIBS@
MOTIF_LIBNAME = @MOTIF_LIBNAME@
diff --git a/src/configure.in b/src/configure.in
index a71c20ddf4..4b119f32ec 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -103,15 +103,16 @@ if test "`(uname) 2>/dev/null`" = Darwin; then
if test "$enable_darwin" = "yes"; then
MACOSX=yes
- OS_EXTRA_SCR="os_macosx.c";
- OS_EXTRA_OBJ="objects/os_macosx.o"
+ OS_EXTRA_SCR="os_macosx.c os_mac_conv.c";
+ OS_EXTRA_OBJ="objects/os_macosx.o objects/os_mac_conv.o"
CPPFLAGS="$CPPFLAGS -DMACOS_X_UNIX -I/Developer/Headers/FlatCarbon -no-cpp-precomp"
dnl If Carbon is found, assume we don't want X11
dnl unless it was specifically asked for (--with-x)
+ dnl or Motif, Athena or GTK GUI is used.
AC_CHECK_HEADER(Carbon/Carbon.h, CARBON=yes)
if test "x$CARBON" = "xyes"; then
- if test -z "$with_x"; then
+ if test -z "$with_x" -a "X$enable_gui" != Xmotif -a "X$enable_gui" != Xathena -a "X$enable_gui" != Xgtk -a "X$enable_gui" != Xgtk2; then
with_x=no
DEFAULT_VIMNAME=Vim
fi
diff --git a/src/eval.c b/src/eval.c
index fa3bad6ab0..21c10fd67c 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -263,6 +263,7 @@ static void f_bufname __ARGS((VAR argvars, VAR retvar));
static void f_bufnr __ARGS((VAR argvars, VAR retvar));
static void f_bufwinnr __ARGS((VAR argvars, VAR retvar));
static void f_byte2line __ARGS((VAR argvars, VAR retvar));
+static void f_byteidx __ARGS((VAR argvars, VAR retvar));
static void f_char2nr __ARGS((VAR argvars, VAR retvar));
static void f_cindent __ARGS((VAR argvars, VAR retvar));
static void f_col __ARGS((VAR argvars, VAR retvar));
@@ -349,6 +350,7 @@ static void f_remote_foreground __ARGS((VAR argvars, VAR retvar));
static void f_remote_peek __ARGS((VAR argvars, VAR retvar));
static void f_remote_read __ARGS((VAR argvars, VAR retvar));
static void f_remote_send __ARGS((VAR argvars, VAR retvar));
+static void f_repeat __ARGS((VAR argvars, VAR retvar));
static void f_server2client __ARGS((VAR argvars, VAR retvar));
static void f_serverlist __ARGS((VAR argvars, VAR retvar));
static void f_setline __ARGS((VAR argvars, VAR retvar));
@@ -2817,6 +2819,7 @@ static struct fst
{"bufnr", 1, 1, f_bufnr},
{"bufwinnr", 1, 1, f_bufwinnr},
{"byte2line", 1, 1, f_byte2line},
+ {"byteidx", 2, 2, f_byteidx},
{"char2nr", 1, 1, f_char2nr},
{"cindent", 1, 1, f_cindent},
{"col", 1, 1, f_col},
@@ -2896,6 +2899,7 @@ static struct fst
{"remote_read", 1, 1, f_remote_read},
{"remote_send", 2, 3, f_remote_send},
{"rename", 2, 2, f_rename},
+ {"repeat", 2, 2, f_repeat},
{"resolve", 1, 1, f_resolve},
{"search", 1, 2, f_search},
{"searchpair", 3, 5, f_searchpair},
@@ -3588,6 +3592,42 @@ f_byte2line(argvars, retvar)
}
/*
+ * "byteidx()" function
+ */
+/*ARGSUSED*/
+ static void
+f_byteidx(argvars, retvar)
+ VAR argvars;
+ VAR retvar;
+{
+#ifdef FEAT_MBYTE
+ char_u *t;
+#endif
+ char_u *str;
+ long idx;
+
+ str = get_var_string(&argvars[0]);
+ idx = get_var_number(&argvars[1]);
+ retvar->var_val.var_number = -1;
+ if (idx < 0)
+ return;
+
+#ifdef FEAT_MBYTE
+ t = str;
+ for ( ; idx > 0; idx--)
+ {
+ if (*t == NUL) /* EOL reached */
+ return;
+ t += mb_ptr2len_check(t);
+ }
+ retvar->var_val.var_number = t - str;
+#else
+ if (idx <= STRLEN(str))
+ retvar->var_val.var_number = idx;
+#endif
+}
+
+/*
* "char2nr(string)" function
*/
static void
@@ -6920,6 +6960,45 @@ f_remote_foreground(argvars, retvar)
#endif
}
+/*
+ * "repeat()" function
+ */
+/*ARGSUSED*/
+ static void
+f_repeat(argvars, retvar)
+ VAR argvars;
+ VAR retvar;
+{
+ char_u *p;
+ int n;
+ int slen;
+ int len;
+ char_u *r;
+ int i;
+
+ p = get_var_string(&argvars[0]);
+ n = get_var_number(&argvars[1]);
+
+ retvar->var_type = VAR_STRING;
+ retvar->var_val.var_string = NULL;
+
+ slen = (int)STRLEN(p);
+ len = slen * n;
+
+ if (len <= 0)
+ return;
+
+ r = alloc(len + 1);
+ if (r != NULL)
+ {
+ for (i = 0; i < n; i++)
+ mch_memmove(r + i * slen, p, (size_t)slen);
+ r[len] = NUL;
+ }
+
+ retvar->var_val.var_string = r;
+}
+
#ifdef HAVE_STRFTIME
/*
* "strftime({format}[, {time}])" function
diff --git a/src/fileio.c b/src/fileio.c
index 02e5ad1e12..d1c11a0461 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1498,40 +1498,14 @@ retry:
# ifdef MACOS_X
if (fio_flags & FIO_MACROMAN)
{
+ extern int macroman2enc __ARGS((char_u *ptr, long *sizep, long
+ real_size));
/*
* Conversion from Apple MacRoman char encoding to UTF-8 or
- * latin1, using standard Carbon framework.
+ * latin1. This is in os_mac_conv.c.
*/
- CFStringRef cfstr;
- CFRange r;
- CFIndex len = size;
-
- /* MacRoman is an 8-bit encoding, no need to move bytes to
- * conv_rest[]. */
- cfstr = CFStringCreateWithBytes(NULL, ptr, len,
- kCFStringEncodingMacRoman, 0);
- /*
- * If there is a conversion error, try using another
- * conversion.
- */
- if (cfstr == NULL)
+ if (macroman2enc(ptr, &size, real_size) == FAIL)
goto rewind_retry;
-
- r.location = 0;
- r.length = CFStringGetLength(cfstr);
- if (r.length != CFStringGetBytes(cfstr, r,
- (enc_utf8) ? kCFStringEncodingUTF8
- : kCFStringEncodingISOLatin1,
- 0, /* no lossy conversion */
- 0, /* not external representation */
- ptr + size, real_size - size, &len))
- {
- CFRelease(cfstr);
- goto rewind_retry;
- }
- CFRelease(cfstr);
- mch_memmove(ptr, ptr + size, len);
- size = len;
}
else
# endif
@@ -2744,7 +2718,7 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit,
if (!(did_cmd = apply_autocmds_exarg(EVENT_FILEAPPENDCMD,
sfname, sfname, FALSE, curbuf, eap)))
{
- if (bt_nofile(curbuf))
+ if (overwriting && bt_nofile(curbuf))
nofile_err = TRUE;
else
apply_autocmds_exarg(EVENT_FILEAPPENDPRE,
@@ -4789,11 +4763,11 @@ buf_write_bytes(ip)
/*
* Convert UTF-8 or latin1 to Apple MacRoman.
*/
- CFStringRef cfstr;
- CFRange r;
- CFIndex l;
char_u *from;
size_t fromlen;
+ extern int enc2macroman __ARGS((char_u *from, size_t fromlen,
+ char_u *to, int *tolenp, int maxtolen, char_u *rest,
+ int *restlenp));
if (ip->bw_restlen > 0)
{
@@ -4811,41 +4785,14 @@ buf_write_bytes(ip)
fromlen = len;
}
- ip->bw_restlen = 0;
- cfstr = CFStringCreateWithBytes(NULL, from, fromlen,
- (enc_utf8) ?
- kCFStringEncodingUTF8 : kCFStringEncodingISOLatin1,
- 0);
- while (cfstr == NULL && ip->bw_restlen < 3 && fromlen > 1)
+ if (enc2macroman(from, fromlen,
+ ip->bw_conv_buf, &len, ip->bw_conv_buflen,
+ ip->bw_rest, &ip->bw_restlen) == FAIL)
{
- ip->bw_rest[ip->bw_restlen++] = from[--fromlen];
- cfstr = CFStringCreateWithBytes(NULL, from, fromlen,
- (enc_utf8) ?
- kCFStringEncodingUTF8 : kCFStringEncodingISOLatin1,
- 0);
- }
- if (cfstr == NULL)
- {
- ip->bw_conv_error = TRUE;
- return FAIL;
- }
-
- r.location = 0;
- r.length = CFStringGetLength(cfstr);
- if (r.length != CFStringGetBytes(cfstr, r,
- kCFStringEncodingMacRoman,
- 0, /* no lossy conversion */
- 0, /* not external representation (since vim
- * handles this internally */
- ip->bw_conv_buf, ip->bw_conv_buflen, &l))
- {
- CFRelease(cfstr);
ip->bw_conv_error = TRUE;
return FAIL;
}
- CFRelease(cfstr);
buf = ip->bw_conv_buf;
- len = l;
}
# endif
@@ -6696,7 +6643,8 @@ static AutoPat *first_autopat[NUM_EVENTS] =
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
};
/*
diff --git a/src/mbyte.c b/src/mbyte.c
index db7c6524dd..407f6674b6 100644
--- a/src/mbyte.c
+++ b/src/mbyte.c
@@ -5553,99 +5553,8 @@ convert_input_safe(ptr, len, maxlen, restp, restlenp)
}
#if defined(MACOS_X)
-static char_u *mac_string_convert __ARGS((char_u *ptr, int len, int *lenp, int fail_on_error, CFStringEncoding from, CFStringEncoding to, int *unconvlenp));
-
-/*
- * A Mac version of string_convert_ext() for special cases.
- */
- static char_u *
-mac_string_convert(ptr, len, lenp, fail_on_error, from, to, unconvlenp)
- char_u *ptr;
- int len;
- int *lenp;
- int fail_on_error;
- CFStringEncoding from;
- CFStringEncoding to;
- int *unconvlenp;
-{
- char_u *retval, *d;
- CFStringRef cfstr;
- int buflen, in, out, l, i;
-
- if (unconvlenp != NULL)
- *unconvlenp = 0;
- cfstr = CFStringCreateWithBytes(NULL, ptr, len, from, 0);
- /* When conversion failed, try excluding bytes from the end, helps when
- * there is an incomplete byte sequence. Only do up to 6 bytes to avoid
- * looping a long time when there really is something unconvertable. */
- while (cfstr == NULL && unconvlenp != NULL && len > 1 && *unconvlenp < 6)
- {
- --len;
- ++*unconvlenp;
- cfstr = CFStringCreateWithBytes(NULL, ptr, len, from, 0);
- }
- if (cfstr == NULL)
- return NULL;
- if (to == kCFStringEncodingUTF8)
- buflen = len * 6 + 1;
- else
- buflen = len + 1;
- retval = alloc(buflen);
- if (retval == NULL)
- {
- CFRelease(cfstr);
- return NULL;
- }
- if (!CFStringGetCString(cfstr, retval, buflen, to))
- {
- CFRelease(cfstr);
- if (fail_on_error)
- {
- vim_free(retval);
- return NULL;
- }
-
- /* conversion failed for the whole string, but maybe it will work
- * for each character */
- for (d = retval, in = 0, out = 0; in < len && out < buflen - 1;)
- {
- if (from == kCFStringEncodingUTF8)
- l = utf_ptr2len_check(ptr + in);
- else
- l = 1;
- cfstr = CFStringCreateWithBytes(NULL, ptr + in, l, from, 0);
- if (cfstr == NULL)
- {
- *d++ = '?';
- out++;
- }
- else
- {
- if (!CFStringGetCString(cfstr, d, buflen - out, to))
- {
- *d++ = '?';
- out++;
- }
- else
- {
- i = strlen(d);
- d += i;
- out += i;
- }
- CFRelease(cfstr);
- }
- in += l;
- }
- *d = NUL;
- if (lenp != NULL)
- *lenp = out;
- return retval;
- }
- CFRelease(cfstr);
- if (lenp != NULL)
- *lenp = strlen(retval);
- return retval;
-}
+/* This is in os_mac_conv.c. */
+extern char_u *mac_string_convert __ARGS((char_u *ptr, int len, int *lenp, int fail_on_error, int from, int to, int *unconvlenp));
#endif
/*
@@ -5762,30 +5671,22 @@ string_convert_ext(vcp, ptr, lenp, unconvlenp)
# ifdef MACOS_X
case CONV_MAC_LATIN1:
retval = mac_string_convert(ptr, len, lenp, vcp->vc_fail,
- kCFStringEncodingMacRoman,
- kCFStringEncodingISOLatin1,
- unconvlenp);
+ 'm', 'l', unconvlenp);
break;
case CONV_LATIN1_MAC:
retval = mac_string_convert(ptr, len, lenp, vcp->vc_fail,
- kCFStringEncodingISOLatin1,
- kCFStringEncodingMacRoman,
- unconvlenp);
+ 'l', 'm', unconvlenp);
break;
case CONV_MAC_UTF8:
retval = mac_string_convert(ptr, len, lenp, vcp->vc_fail,
- kCFStringEncodingMacRoman,
- kCFStringEncodingUTF8,
- unconvlenp);
+ 'm', 'u', unconvlenp);
break;
case CONV_UTF8_MAC:
retval = mac_string_convert(ptr, len, lenp, vcp->vc_fail,
- kCFStringEncodingUTF8,
- kCFStringEncodingMacRoman,
- unconvlenp);
+ 'u', 'm', unconvlenp);
break;
# endif
diff --git a/src/mysign b/src/mysign
index dea18b49fc..1581aa7438 100644
--- a/src/mysign
+++ b/src/mysign
@@ -1 +1 @@
-=auto/configure-lastupdate=1089626426.19-@buildcheck=2c92a9e4676b2304fab9af16f1664194=configure.in@md5=021fe2d41058c80f220721c96886b73b
+=auto/configure-lastupdate=1090067895.52-@buildcheck=2c92a9e4676b2304fab9af16f1664194=configure.in@md5=9058353ef67f4d224686695cb80f645e
diff --git a/src/option.c b/src/option.c
index 0dee50b976..bcf4183783 100644
--- a/src/option.c
+++ b/src/option.c
@@ -3237,7 +3237,15 @@ set_helplang_default(lang)
if (p_hlg == NULL)
p_hlg = empty_option;
else
+ {
+ /* zh_CN becomes "cn", zh_TW becomes "tw". */
+ if (STRNICMP(p_hlg, "zh_", 3) == 0 && STRLEN(p_hlg) >= 5)
+ {
+ p_hlg[0] = TOLOWER_ASC(p_hlg[3]);
+ p_hlg[1] = TOLOWER_ASC(p_hlg[4]);
+ }
p_hlg[2] = NUL;
+ }
options[idx].flags |= P_ALLOCED;
}
}
diff --git a/src/os_mac.h b/src/os_mac.h
index 7991769673..940e267b99 100644
--- a/src/os_mac.h
+++ b/src/os_mac.h
@@ -18,18 +18,23 @@
/*
* Macintosh machine-dependent things.
+ *
+ * Include the Mac header files, unless also compiling with X11 (the header
+ * files have many conflicts).
*/
-#include <QuickDraw.h>
-#include <ToolUtils.h>
-#include <LowMem.h>
-#include <Scrap.h>
-#include <Sound.h>
-#include <TextUtils.h>
-#include <Memory.h>
-#include <OSUtils.h>
-#include <Files.h>
-#ifdef FEAT_MBYTE
-# include <Script.h>
+#ifndef FEAT_X11
+# include <QuickDraw.h>
+# include <ToolUtils.h>
+# include <LowMem.h>
+# include <Scrap.h>
+# include <Sound.h>
+# include <TextUtils.h>
+# include <Memory.h>
+# include <OSUtils.h>
+# include <Files.h>
+# ifdef FEAT_MBYTE
+# include <Script.h>
+# endif
#endif
/*
@@ -303,10 +308,13 @@
#endif
#define DFLT_ERRORFILE "errors.err"
-#ifdef COLON_AS_PATHSEP
-# define DFLT_RUNTIMEPATH "$VIM:vimfiles,$VIMRUNTIME,$VIM:vimfiles:after"
-#else
-# define DFLT_RUNTIMEPATH "~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.vim/after"
+
+#ifndef DFLT_RUNTIMEPATH
+# ifdef COLON_AS_PATHSEP
+# define DFLT_RUNTIMEPATH "$VIM:vimfiles,$VIMRUNTIME,$VIM:vimfiles:after"
+# else
+# define DFLT_RUNTIMEPATH "~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.vim/after"
+# endif
#endif
/*
diff --git a/src/os_mac.pbproj/project.pbxproj b/src/os_mac.pbproj/project.pbxproj
new file mode 100644
index 0000000000..cacf9c9ff8
--- /dev/null
+++ b/src/os_mac.pbproj/project.pbxproj
@@ -0,0 +1,1537 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 34;
+ objects = {
+ 00EF808200C49A857F000001 = {
+ isa = PBXFileReference;
+ path = gui_mac.rsrc;
+ refType = 2;
+ };
+ 00EF808300C49A857F000001 = {
+ fileRef = 00EF808200C49A857F000001;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+//000
+//001
+//002
+//003
+//004
+//010
+//011
+//012
+//013
+//014
+ 014D3B8900BB52A07F000001 = {
+ children = (
+ 273798BE00B36B037F000001,
+ 273798C600B36B037F000001,
+ 273798CA00B36B037F000001,
+ 273798CE00B36B037F000001,
+ 273798D200B36B037F000001,
+ 273798D400B36B037F000001,
+ 273798D500B36B037F000001,
+ 273798D600B36B037F000001,
+ 273798E000B36B037F000001,
+ 273798E100B36B037F000001,
+ 273798E500B36B037F000001,
+ 273798E800B36B037F000001,
+ 273798EC00B36B047F000001,
+ 273798F100B36B047F000001,
+ 273798F200B36B047F000001,
+ 2737992C00B36BA77F000001,
+ );
+ isa = PBXGroup;
+ name = Headers;
+ refType = 4;
+ };
+ 014D3B8B00BB59CA7F000001 = {
+ children = (
+ 273798E200B36B037F000001,
+ 273798ED00B36B047F000001,
+ 273798D300B36B037F000001,
+ );
+ isa = PBXGroup;
+ name = "Unused Source";
+ path = "";
+ refType = 4;
+ };
+//010
+//011
+//012
+//013
+//014
+//020
+//021
+//022
+//023
+//024
+ 0249A665FF388DC511CA2CEA = {
+ isa = PBXApplicationReference;
+ path = Vim.app;
+ refType = 3;
+ };
+ 0249A669FF388E3911CA2CEA = {
+ isa = PBXFileReference;
+ name = "libstdc++.a";
+ path = "/usr/lib/libstdc++.a";
+ refType = 0;
+ };
+ 0249A66AFF388E3911CA2CEA = {
+ fileRef = 0249A669FF388E3911CA2CEA;<