Mercurial > vim
changeset 18:293621502c4d v7.0010
updated for version 7.0010
author | vimboss |
---|---|
date | Sun, 18 Jul 2004 21:34:53 +0000 |
parents | 9be87deaeb52 |
children | a81bc802c17c |
files | Filelist runtime/doc/eval.txt runtime/doc/tags runtime/doc/todo.txt runtime/doc/version7.txt src/Makefile src/auto/configure src/config.mk.in src/configure.in src/eval.c src/fileio.c src/mbyte.c src/mysign src/option.c src/os_mac.h src/os_mac.pbproj/project.pbxproj src/os_mac_conv.c src/os_macosx.c src/testdir/test11.in src/vim.h |
diffstat | 20 files changed, 2038 insertions(+), 258 deletions(-) [+] |
line wrap: on
line diff
--- 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 \
--- 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 buf 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 rep 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.
--- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -5789,6 +5789,7 @@ remove-filetype filetype.txt /*remove-fi 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*
--- 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 Vi *known-bugs* -------------------- Known bugs and current work ----------------------- -When switching between Aap script and make Vim won't always run. - -Mac: Compiling --enable-gui=athena doesn't work. Try to fix without disabling -Carbon. Otherwise adjust configure to disable Darwin. (raf) +Add fix for zh_cn to Vim 6.3? (Liang) -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 @@ 7 Make ":startinsert" command work dir - 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 @@ 7 Add "n" flag to search() function, j 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
--- 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 wo 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 parenthe ============================================================================== 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 char 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:
--- 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 o 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 $< $@
--- a/src/auto/configure +++ b/src/auto/configure @@ -1239,11 +1239,11 @@ echo "configure:1230: checking if Darwin 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
--- 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@
--- a/src/configure.in +++ b/src/configure.in @@ -103,15 +103,16 @@ if test "`(uname) 2>/dev/null`" = Darwin 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
--- a/src/eval.c +++ b/src/eval.c @@ -263,6 +263,7 @@ static void f_bufname __ARGS((VAR argvar 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(( 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
--- 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 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) - { - ip->bw_rest[ip->bw_restlen++] = from[--fromlen]; - cfstr = CFStringCreateWithBytes(NULL, from, fromlen, - (enc_utf8) ? - kCFStringEncodingUTF8 : kCFStringEncodingISOLatin1, - 0); - } - if (cfstr == NULL) + if (enc2macroman(from, fromlen, + ip->bw_conv_buf, &len, ip->bw_conv_buflen, + ip->bw_rest, &ip->bw_restlen) == FAIL) { 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 }; /*
--- a/src/mbyte.c +++ b/src/mbyte.c @@ -5553,99 +5553,8 @@ convert_input_safe(ptr, len, maxlen, res } #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, uncon # 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
--- a/src/mysign +++ b/src/mysign @@ -1,1 +1,1 @@ -=auto/configure-lastupdate=1089626426.19-@buildcheck=2c92a9e4676b2304fab9af16f1664194=configure.in@md5=021fe2d41058c80f220721c96886b73b +=auto/configure-lastupdate=1090067895.52-@buildcheck=2c92a9e4676b2304fab9af16f1664194=configure.in@md5=9058353ef67f4d224686695cb80f645e
--- 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; } }
--- 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 /*
new file mode 100644 --- /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; + isa = PBXBuildFile; + settings = { + }; + }; +//020 +//021 +//022 +//023 +//024 +//040 +//041 +//042 +//043 +//044 + 04313892FE3035C9C02AAC07 = { + buildActionMask = 2147483647; + files = ( + 2737992900B36B047F000001, + 00EF808300C49A857F000001, + ); + isa = PBXRezBuildPhase; + name = "ResourceManager Resources"; + }; +//040 +//041 +//042 +//043 +//044 +//050 +//051 +//052 +//053 +//054 + 05952DFCFFF02D1B11CA0E50 = { + buildRules = ( + ); + buildSettings = { + COPY_PHASE_STRIP = NO; + OPTIMIZATION_CFLAGS = "-O0"; + }; + isa = PBXBuildStyle; + name = Development; + }; + 05952DFDFFF02D1B11CA0E50 = { + buildRules = ( + ); + buildSettings = { + COPY_PHASE_STRIP = YES; + }; + isa = PBXBuildStyle; + name = Deployment; + }; +//050 +//051 +//052 +//053 +//054 +//060 +//061 +//062 +//063 +//064 + 0640BAA4FFF0323A11CA0E50 = { + isa = PBXFrameworkReference; + name = ApplicationServices.framework; + path = /System/Library/Frameworks/ApplicationServices.framework; + refType = 0; + }; + 0640BAA5FFF0323A11CA0E50 = { + isa = PBXFrameworkReference; + name = CoreServices.framework; + path = /System/Library/Frameworks/CoreServices.framework; + refType = 0; + }; + 06B64A4A00BBD0257F000001 = { + isa = PBXFileReference; + path = move.c; + refType = 4; + }; + 06B64A4B00BBD0257F000001 = { + fileRef = 06B64A4A00BBD0257F000001; + isa = PBXBuildFile; + settings = { + }; + }; +//060 +//061 +//062 +//063 +//064 +//0C0 +//0C1 +//0C2 +//0C3 +//0C4 + 0C11626000BD3A897F000001 = { + isa = PBXFileReference; + path = os_unix.c; + refType = 4; + }; +//0C0 +//0C1 +//0C2 +//0C3 +//0C4 +//0D0 +//0D1 +//0D2 +//0D3 +//0D4 + 0D29631B00C303B07F000001 = { + children = ( + 273798CF00B36B037F000001, + 273798DF00B36B037F000001, + 0C11626000BD3A897F000001, + F5E2C53F00FACD0901000001, + ); + isa = PBXGroup; + name = "Mac Port Sources"; + refType = 4; + }; +//0D0 +//0D1 +//0D2 +//0D3 +//0D4 +//120 +//121 +//122 +//123 +//124 + 12FD6A1900C500167F000001 = { + isa = PBXFileReference; + path = gui_mac.icns; + refType = 4; + }; + 12FD6A1A00C500167F000001 = { + fileRef = 12FD6A1900C500167F000001; + isa = PBXBuildFile; + settings = { + }; + }; +//120 +//121 +//122 +//123 +//124 +//190 +//191 +//192 +//193 +//194 + 195DF8C9FE9D4F0611CA2CBB = { + children = ( + 0249A665FF388DC511CA2CEA, + ); + isa = PBXGroup; + name = Products; + refType = 4; + }; +//190 +//191 +//192 +//193 +//194 +//200 +//201 +//202 +//203 +//204 + 20286C28FDCF999611CA2CEA = { + buildStyles = ( + 05952DFCFFF02D1B11CA0E50, + 05952DFDFFF02D1B11CA0E50, + ); + isa = PBXProject; + mainGroup = 20286C29FDCF999611CA2CEA; + projectDirPath = ""; + targets = ( + 20286C34FDCF999611CA2CEA, + ); + }; + 20286C29FDCF999611CA2CEA = { + children = ( + 2737993000B36BF77F000001, + 014D3B8900BB52A07F000001, + 014D3B8B00BB59CA7F000001, + F5D0FB2B00F8C29A01000001, + 0D29631B00C303B07F000001, + 20286C2AFDCF999611CA2CEA, + 20286C2CFDCF999611CA2CEA, + 20286C32FDCF999611CA2CEA, + 195DF8C9FE9D4F0611CA2CBB, + ); + isa = PBXGroup; + name = vim; + path = ""; + refType = 4; + }; + 20286C2AFDCF999611CA2CEA = { + children = ( + 20286C2BFDCF999611CA2CEA, + 273798BF00B36B037F000001, + 273798C000B36B037F000001, + 273798C100B36B037F000001, + 273798C200B36B037F000001, + 273798C300B36B037F000001, + 273798C400B36B037F000001, + 273798C500B36B037F000001, + 273798C700B36B037F000001, + 273798C800B36B037F000001, + 7E3AAAD704841C0000EFC20E, + 273798C900B36B037F000001, + 273798CB00B36B037F000001, + 273798CC00B36B037F000001, + 273798CD00B36B037F000001, + 273798D100B36B037F000001, + 273798D700B36B037F000001, + 273798D800B36B037F000001, + 273798D900B36B037F000001, + 273798DA00B36B037F000001, + 273798DB00B36B037F000001, + 273798DC00B36B037F000001, + 273798DD00B36B037F000001, + 06B64A4A00BBD0257F000001, + 2737992A00B36BA77F000001, + 2737992B00B36BA77F000001, + 273798DE00B36B037F000001, + 273798E300B36B037F000001, + 273798E400B36B037F000001, + 273798E600B36B037F000001, + 273798E700B36B037F000001, + 273798E900B36B037F000001, + 273798EA00B36B037F000001, + 273798EB00B36B047F000001, + 273798EE00B36B047F000001, + 273798EF00B36B047F000001, + 273798F000B36B047F000001, + 273798F300B36B047F000001, + ); + isa = PBXGroup; + name = Sources; + path = ""; + refType = 4; + }; + 20286C2BFDCF999611CA2CEA = { + isa = PBXFileReference; + path = main.c; + refType = 4; + }; + 20286C2CFDCF999611CA2CEA = { + children = ( + 12FD6A1900C500167F000001, + 00EF808200C49A857F000001, + 273798D000B36B037F000001, + ); + isa = PBXGroup; + name = Resources; + path = ""; + refType = 4; + }; + 20286C32FDCF999611CA2CEA = { + children = ( + 20286C33FDCF999611CA2CEA, + 0249A669FF388E3911CA2CEA, + 0640BAA4FFF0323A11CA0E50, + 0640BAA5FFF0323A11CA0E50, + ); + isa = PBXGroup; + name = "External Frameworks and Libraries"; + path = ""; + refType = 4; + }; + 20286C33FDCF999611CA2CEA = { + isa = PBXFrameworkReference; + name = Carbon.framework; + path = /System/Library/Frameworks/Carbon.framework; + refType = 0; + }; + 20286C34FDCF999611CA2CEA = { + buildPhases = ( + 20286C35FDCF999611CA2CEA, + 20286C36FDCF999611CA2CEA, + 20286C38FDCF999611CA2CEA, + 20286C3BFDCF999611CA2CEA, + 04313892FE3035C9C02AAC07, + ); + buildSettings = { + FRAMEWORK_SEARCH_PATHS = ""; + HEADER_SEARCH_PATHS = "proto /Developer/Headers/FlatCarbon"; + INSTALL_PATH = "$(HOME)/Applications"; + LIBRARY_SEARCH_PATHS = ""; + OTHER_CFLAGS = "-DMACOS_X_UNIX"; + OTHER_LDFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = Vim; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas"; + WRAPPER_EXTENSION = app; + }; + dependencies = ( + ); + isa = PBXApplicationTarget; + name = vim; + productInstallPath = "$(HOME)/Applications"; + productName = vim; + productReference = 0249A665FF388DC511CA2CEA; + productSettingsXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> +<!DOCTYPE plist SYSTEM \"file://localhost/System/Library/DTDs/PropertyList.dtd\"> +<plist version=\"0.9\"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleDocumentTypes</key> + <array> + <dict> + <key>CFBundleTypeExtensions</key> + <array> + <string>*</string> + </array> + <key>CFBundleTypeIconFile</key> + <string>txt.icns</string> + <key>CFBundleTypeName</key> + <string>NSStringPboardType</string> + <key>CFBundleTypeOSTypes</key> + <array> + <string>****</string> + </array> + <key>CFBundleTypeRole</key> + <string>Editor</string> + </dict> + </array> + <key>CFBundleExecutable</key> + <string>Vim</string> + <key>CFBundleGetInfoString</key> + <string></string> + <key>CFBundleIconFile</key> + <string>gui_mac.icns</string> + <key>CFBundleIdentifier</key> + <string></string> + <key>CFBundleInfoDictionaryVersion</key> + <string>7.0aa</string> + <key>CFBundleName</key> + <string>Vim</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleShortVersionString</key> + <string>Vim 7.0aa</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleVersion</key> + <string>0.1</string> + <key>CSResourcesFileMapped</key> + <true/> +</dict> +</plist> +"; + shouldUseHeadermap = 1; + }; + 20286C35FDCF999611CA2CEA = { + buildActionMask = 2147483647; + files = ( + 273798F400B36B047F000001, + 273798F500B36B047F000001, + 273798F600B36B047F000001, + 273798F700B36B047F000001, + 273798F800B36B047F000001, + 273798F900B36B047F000001, + 273798FA00B36B047F000001, + 273798FB00B36B047F000001, + 273798FC00B36B047F000001, + 273798FD00B36B047F000001, + 273798FE00B36B047F000001, + 273798FF00B36B047F000001, + 2737990000B36B047F000001, + 2737990100B36B047F000001, + 2737990200B36B047F000001, + 2737992D00B36BA77F000001, + ); + isa = PBXHeadersBuildPhase; + name = Headers; + }; + 20286C36FDCF999611CA2CEA = { + buildActionMask = 2147483647; + files = ( + 12FD6A1A00C500167F000001, + ); + isa = PBXResourcesBuildPhase; + name = "Bundle Resources"; + }; + 20286C38FDCF999611CA2CEA = { + buildActionMask = 2147483647; + files = ( + 20286C39FDCF999611CA2CEA, + 2737990300B36B047F000001, + 2737990400B36B047F000001, + 2737990500B36B047F000001, + 2737990600B36B047F000001, + 2737990700B36B047F000001, + 2737990800B36B047F000001, + 2737990900B36B047F000001, + 2737990A00B36B047F000001, + 2737990B00B36B047F000001, + 2737990C00B36B047F000001, + 2737990D00B36B047F000001, + 2737990E00B36B047F000001, + 2737990F00B36B047F000001, + 2737991000B36B047F000001, + 2737991100B36B047F000001, + 2737991300B36B047F000001, + 2737991400B36B047F000001, + 2737991500B36B047F000001, + 2737991600B36B047F000001, + 2737991700B36B047F000001, + 2737991800B36B047F000001, + 2737991900B36B047F000001, + 2737991A00B36B047F000001, + 2737991D00B36B047F000001, + 2737991E00B36B047F000001, + 2737991F00B36B047F000001, + 2737992000B36B047F000001, + 2737992100B36B047F000001, + 2737992200B36B047F000001, + 2737992300B36B047F000001, + 2737992500B36B047F000001, + 2737992600B36B047F000001, + 2737992700B36B047F000001, + 2737992800B36B047F000001, + 2737992E00B36BA77F000001, + 2737992F00B36BA77F000001, + 06B64A4B00BBD0257F000001, + F5D0FB2D00F8C2BF01000001, + F5E2C54000FACD0901000001, + F5CC3220018E3F6801891561, + 7E3AAAD804841C0000EFC20E, + 7E556E1404841F7900882585, + ); + isa = PBXSourcesBuildPhase; + name = Sources; + }; + 20286C39FDCF999611CA2CEA = { + fileRef = 20286C2BFDCF999611CA2CEA; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + ); + }; + }; + 20286C3BFDCF999611CA2CEA = { + buildActionMask = 2147483647; + files = ( + 20286C3CFDCF999611CA2CEA, + 0249A66AFF388E3911CA2CEA, + ); + isa = PBXFrameworksBuildPhase; + name = "Frameworks & Libraries"; + }; + 20286C3CFDCF999611CA2CEA = { + fileRef = 20286C33FDCF999611CA2CEA; + isa = PBXBuildFile; + settings = { + }; + }; +//200 +//201 +//202 +//203 +//204 +//270 +//271 +//272 +//273 +//274 + 273798BE00B36B037F000001 = { + isa = PBXFileReference; + path = ascii.h; + refType = 4; + }; + 273798BF00B36B037F000001 = { + isa = PBXFileReference; + path = buffer.c; + refType = 4; + }; + 273798C000B36B037F000001 = { + isa = PBXFileReference; + path = charset.c; + refType = 4; + }; + 273798C100B36B037F000001 = { + isa = PBXFileReference; + path = diff.c; + refType = 4; + }; + 273798C200B36B037F000001 = { + isa = PBXFileReference; + path = digraph.c; + refType = 4; + }; + 273798C300B36B037F000001 = { + isa = PBXFileReference; + path = edit.c; + refType = 4; + }; + 273798C400B36B037F000001 = { + isa = PBXFileReference; + path = eval.c; + refType = 4; + }; + 273798C500B36B037F000001 = { + isa = PBXFileReference; + path = ex_cmds.c; + refType = 4; + }; + 273798C600B36B037F000001 = { + isa = PBXFileReference; + path = ex_cmds.h; + refType = 4; + }; + 273798C700B36B037F000001 = { + isa = PBXFileReference; + path = ex_cmds2.c; + refType = 4; + }; + 273798C800B36B037F000001 = { + isa = PBXFileReference; + path = ex_docmd.c; + refType = 4; + }; + 273798C900B36B037F000001 = { + isa = PBXFileReference; + path = ex_getln.c; + refType = 4; + }; + 273798CA00B36B037F000001 = { + isa = PBXFileReference; + path = feature.h; + refType = 4; + }; + 273798CB00B36B037F000001 = { + isa = PBXFileReference; + path = fileio.c; + refType = 4; + }; + 273798CC00B36B037F000001 = { + isa = PBXFileReference; + path = fold.c; + refType = 4; + }; + 273798CD00B36B037F000001 = { + isa = PBXFileReference; + path = getchar.c; + refType = 4; + }; + 273798CE00B36B037F000001 = { + isa = PBXFileReference; + path = globals.h; + refType = 4; + }; + 273798CF00B36B037F000001 = { + isa = PBXFileReference; + path = gui_mac.c; + refType = 4; + }; + 273798D000B36B037F000001 = { + isa = PBXFileReference; + path = gui_mac.r; + refType = 4; + }; + 273798D100B36B037F000001 = { + isa = PBXFileReference; + path = gui.c; + refType = 4; + }; + 273798D200B36B037F000001 = { + isa = PBXFileReference; + path = gui.h; + refType = 4; + }; + 273798D300B36B037F000001 = { + isa = PBXFileReference; + path = integration.c; + refType = 4; + }; + 273798D400B36B037F000001 = { + isa = PBXFileReference; + path = integration.h; + refType = 4; + }; + 273798D500B36B037F000001 = { + isa = PBXFileReference; + path = keymap.h; + refType = 4; + }; + 273798D600B36B037F000001 = { + isa = PBXFileReference; + path = macros.h; + refType = 4; + }; + 273798D700B36B037F000001 = { + isa = PBXFileReference; + path = mark.c; + refType = 4; + }; + 273798D800B36B037F000001 = { + isa = PBXFileReference; + path = memfile.c; + refType = 4; + }; + 273798D900B36B037F000001 = { + isa = PBXFileReference; + path = memline.c; + refType = 4; + }; + 273798DA00B36B037F000001 = { + isa = PBXFileReference; + path = menu.c; + refType = 4; + }; + 273798DB00B36B037F000001 = { + isa = PBXFileReference; + path = message.c; + refType = 4; + }; + 273798DC00B36B037F000001 = { + isa = PBXFileReference; + path = misc1.c; + refType = 4; + }; + 273798DD00B36B037F000001 = { + isa = PBXFileReference; + path = misc2.c; + refType = 4; + }; + 273798DE00B36B037F000001 = { + isa = PBXFileReference; + path = ops.c; + refType = 4; + }; + 273798DF00B36B037F000001 = { + isa = PBXFileReference; + path = os_mac.c; + refType = 4; + }; + 273798E000B36B037F000001 = { + isa = PBXFileReference; + path = os_mac.h; + refType = 4; + }; + 273798E100B36B037F000001 = { + isa = PBXFileReference; + path = proto.h; + refType = 4; + }; + 273798E200B36B037F000001 = { + isa = PBXFileReference; + path = pty.c; + refType = 4; + }; + 273798E300B36B037F000001 = { + isa = PBXFileReference; + path = quickfix.c; + refType = 4; + }; + 273798E400B36B037F000001 = { + isa = PBXFileReference; + path = regexp.c; + refType = 4; + }; + 273798E500B36B037F000001 = { + isa = PBXFileReference; + path = regexp.h; + refType = 4; + }; + 273798E600B36B037F000001 = { + isa = PBXFileReference; + path = screen.c; + refType = 4; + }; + 273798E700B36B037F000001 = { + isa = PBXFileReference; + path = search.c; + refType = 4; + }; + 273798E800B36B037F000001 = { + isa = PBXFileReference; + path = structs.h; + refType = 4; + }; + 273798E900B36B037F000001 = { + isa = PBXFileReference; + path = syntax.c; + refType = 4; + }; + 273798EA00B36B037F000001 = { + isa = PBXFileReference; + path = tag.c; + refType = 4; + }; + 273798EB00B36B047F000001 = { + isa = PBXFileReference; + path = term.c; + refType = 4; + }; + 273798EC00B36B047F000001 = { + isa = PBXFileReference; + path = term.h; + refType = 4; + }; + 273798ED00B36B047F000001 = { + isa = PBXFileReference; + path = termlib.c; + refType = 4; + }; + 273798EE00B36B047F000001 = { + isa = PBXFileReference; + path = ui.c; + refType = 4; + }; + 273798EF00B36B047F000001 = { + isa = PBXFileReference; + path = undo.c; + refType = 4; + }; + 273798F000B36B047F000001 = { + isa = PBXFileReference; + path = version.c; + refType = 4; + }; + 273798F100B36B047F000001 = { + isa = PBXFileReference; + path = version.h; + refType = 4; + }; + 273798F200B36B047F000001 = { + isa = PBXFileReference; + path = vim.h; + refType = 4; + }; + 273798F300B36B047F000001 = { + isa = PBXFileReference; + path = window.c; + refType = 4; + }; + 273798F400B36B047F000001 = { + fileRef = 273798BE00B36B037F000001; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + ); + }; + }; + 273798F500B36B047F000001 = { + fileRef = 273798C600B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 273798F600B36B047F000001 = { + fileRef = 273798CA00B36B037F000001; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + ); + }; + }; + 273798F700B36B047F000001 = { + fileRef = 273798CE00B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 273798F800B36B047F000001 = { + fileRef = 273798D200B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 273798F900B36B047F000001 = { + fileRef = 273798D400B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 273798FA00B36B047F000001 = { + fileRef = 273798D500B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 273798FB00B36B047F000001 = { + fileRef = 273798D600B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 273798FC00B36B047F000001 = { + fileRef = 273798E000B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 273798FD00B36B047F000001 = { + fileRef = 273798E100B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 273798FE00B36B047F000001 = { + fileRef = 273798E500B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 273798FF00B36B047F000001 = { + fileRef = 273798E800B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737990000B36B047F000001 = { + fileRef = 273798EC00B36B047F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737990100B36B047F000001 = { + fileRef = 273798F100B36B047F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737990200B36B047F000001 = { + fileRef = 273798F200B36B047F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737990300B36B047F000001 = { + fileRef = 273798BF00B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737990400B36B047F000001 = { + fileRef = 273798C000B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737990500B36B047F000001 = { + fileRef = 273798C100B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737990600B36B047F000001 = { + fileRef = 273798C200B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737990700B36B047F000001 = { + fileRef = 273798C300B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737990800B36B047F000001 = { + fileRef = 273798C400B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737990900B36B047F000001 = { + fileRef = 273798C500B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737990A00B36B047F000001 = { + fileRef = 273798C700B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737990B00B36B047F000001 = { + fileRef = 273798C800B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737990C00B36B047F000001 = { + fileRef = 273798C900B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737990D00B36B047F000001 = { + fileRef = 273798CB00B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737990E00B36B047F000001 = { + fileRef = 273798CC00B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737990F00B36B047F000001 = { + fileRef = 273798CD00B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737991000B36B047F000001 = { + fileRef = 273798CF00B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737991100B36B047F000001 = { + fileRef = 273798D100B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737991300B36B047F000001 = { + fileRef = 273798D700B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737991400B36B047F000001 = { + fileRef = 273798D800B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737991500B36B047F000001 = { + fileRef = 273798D900B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737991600B36B047F000001 = { + fileRef = 273798DA00B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737991700B36B047F000001 = { + fileRef = 273798DB00B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737991800B36B047F000001 = { + fileRef = 273798DC00B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737991900B36B047F000001 = { + fileRef = 273798DD00B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737991A00B36B047F000001 = { + fileRef = 273798DE00B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737991D00B36B047F000001 = { + fileRef = 273798E300B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737991E00B36B047F000001 = { + fileRef = 273798E400B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737991F00B36B047F000001 = { + fileRef = 273798E600B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737992000B36B047F000001 = { + fileRef = 273798E700B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737992100B36B047F000001 = { + fileRef = 273798E900B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737992200B36B047F000001 = { + fileRef = 273798EA00B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737992300B36B047F000001 = { + fileRef = 273798EB00B36B047F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737992500B36B047F000001 = { + fileRef = 273798EE00B36B047F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737992600B36B047F000001 = { + fileRef = 273798EF00B36B047F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737992700B36B047F000001 = { + fileRef = 273798F000B36B047F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737992800B36B047F000001 = { + fileRef = 273798F300B36B047F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737992900B36B047F000001 = { + fileRef = 273798D000B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737992A00B36BA77F000001 = { + isa = PBXFileReference; + path = normal.c; + refType = 4; + }; + 2737992B00B36BA77F000001 = { + isa = PBXFileReference; + path = option.c; + refType = 4; + }; + 2737992C00B36BA77F000001 = { + isa = PBXFileReference; + path = option.h; + refType = 4; + }; + 2737992D00B36BA77F000001 = { + fileRef = 2737992C00B36BA77F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737992E00B36BA77F000001 = { + fileRef = 2737992A00B36BA77F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737992F00B36BA77F000001 = { + fileRef = 2737992B00B36BA77F000001; + isa = PBXBuildFile; + settings = { + }; + }; + 2737993000B36BF77F000001 = { + children = ( + 2737993100B36C397F000001, + 2737993200B36C397F000001, + 2737993300B36C397F000001, + 2737993400B36C397F000001, + 2737993500B36C397F000001, + 2737993600B36C397F000001, + 2737993700B36C397F000001, + 2737993800B36C397F000001, + 2737993900B36C397F000001, + 2737993A00B36C397F000001, + 2737993B00B36C397F000001, + 2737993C00B36C397F000001, + 2737993D00B36C397F000001, + 2737993E00B36C397F000001, + 2737993F00B36C397F000001, + 2737994000B36C397F000001, + 2737994100B36C397F000001, + 2737994200B36C397F000001, + 2737994300B36C397F000001, + 2737994400B36C397F000001, + 2737994500B36C397F000001, + 2737994600B36C397F000001, + 2737994700B36C397F000001, + 2737994800B36C397F000001, + 2737994900B36C397F000001, + 2737994A00B36C397F000001, + 2737994B00B36C397F000001, + 2737994C00B36C397F000001, + 2737994D00B36C397F000001, + 2737994E00B36C397F000001, + 2737994F00B36C397F000001, + 2737995000B36C397F000001, + 2737995100B36C397F000001, + 2737995200B36C397F000001, + 2737995300B36C397F000001, + 2737995400B36C397F000001, + 2737995500B36C397F000001, + 2737995600B36C397F000001, + 2737995700B36C397F000001, + 2737995800B36C397F000001, + 2737995900B36C397F000001, + ); + isa = PBXGroup; + name = Prototype; + path = proto; + refType = 4; + }; + 2737993100B36C397F000001 = { + isa = PBXFileReference; + name = buffer.pro; + path = proto/buffer.pro; + refType = 4; + }; + 2737993200B36C397F000001 = { + isa = PBXFileReference; + name = charset.pro; + path = proto/charset.pro; + refType = 4; + }; + 2737993300B36C397F000001 = { + isa = PBXFileReference; + name = diff.pro; + path = proto/diff.pro; + refType = 4; + }; + 2737993400B36C397F000001 = { + isa = PBXFileReference; + name = digraph.pro; + path = proto/digraph.pro; + refType = 4; + }; + 2737993500B36C397F000001 = { + isa = PBXFileReference; + name = edit.pro; + path = proto/edit.pro; + refType = 4; + }; + 2737993600B36C397F000001 = { + isa = PBXFileReference; + name = eval.pro; + path = proto/eval.pro; + refType = 4; + }; + 2737993700B36C397F000001 = { + isa = PBXFileReference; + name = ex_cmds.pro; + path = proto/ex_cmds.pro; + refType = 4; + }; + 2737993800B36C397F000001 = { + isa = PBXFileReference; + name = ex_cmds2.pro; + path = proto/ex_cmds2.pro; + refType = 4; + }; + 2737993900B36C397F000001 = { + isa = PBXFileReference; + name = ex_docmd.pro; + path = proto/ex_docmd.pro; + refType = 4; + }; + 2737993A00B36C397F000001 = { + isa = PBXFileReference; + name = ex_getln.pro; + path = proto/ex_getln.pro; + refType = 4; + }; + 2737993B00B36C397F000001 = { + isa = PBXFileReference; + name = fileio.pro; + path = proto/fileio.pro; + refType = 4; + }; + 2737993C00B36C397F000001 = { + isa = PBXFileReference; + name = fold.pro; + path = proto/fold.pro; + refType = 4; + }; + 2737993D00B36C397F000001 = { + isa = PBXFileReference; + name = getchar.pro; + path = proto/getchar.pro; + refType = 4; + }; + 2737993E00B36C397F000001 = { + isa = PBXFileReference; + name = gui_mac.pro; + path = proto/gui_mac.pro; + refType = 4; + }; + 2737993F00B36C397F000001 = { + isa = PBXFileReference; + name = gui.pro; + path = proto/gui.pro; + refType = 4; + }; + 2737994000B36C397F000001 = { + isa = PBXFileReference; + name = main.pro; + path = proto/main.pro; + refType = 4; + }; + 2737994100B36C397F000001 = { + isa = PBXFileReference; + name = mark.pro; + path = proto/mark.pro; + refType = 4; + }; + 2737994200B36C397F000001 = { + isa = PBXFileReference; + name = memfile.pro; + path = proto/memfile.pro; + refType = 4; + }; + 2737994300B36C397F000001 = { + isa = PBXFileReference; + name = memline.pro; + path = proto/memline.pro; + refType = 4; + }; + 2737994400B36C397F000001 = { + isa = PBXFileReference; + name = menu.pro; + path = proto/menu.pro; + refType = 4; + }; + 2737994500B36C397F000001 = { + isa = PBXFileReference; + name = message.pro; + path = proto/message.pro; + refType = 4; + }; + 2737994600B36C397F000001 = { + isa = PBXFileReference; + name = misc1.pro; + path = proto/misc1.pro; + refType = 4; + }; + 2737994700B36C397F000001 = { + isa = PBXFileReference; + name = misc2.pro; + path = proto/misc2.pro; + refType = 4; + }; + 2737994800B36C397F000001 = { + isa = PBXFileReference; + name = move.pro; + path = proto/move.pro; + refType = 4; + }; + 2737994900B36C397F000001 = { + isa = PBXFileReference; + name = normal.pro; + path = proto/normal.pro; + refType = 4; + }; + 2737994A00B36C397F000001 = { + isa = PBXFileReference; + name = ops.pro; + path = proto/ops.pro; + refType = 4; + }; + 2737994B00B36C397F000001 = { + isa = PBXFileReference; + name = option.pro; + path = proto/option.pro; + refType = 4; + }; + 2737994C00B36C397F000001 = { + isa = PBXFileReference; + name = os_mac.pro; + path = proto/os_mac.pro; + refType = 4; + }; + 2737994D00B36C397F000001 = { + isa = PBXFileReference; + name = pty.pro; + path = proto/pty.pro; + refType = 4; + }; + 2737994E00B36C397F000001 = { + isa = PBXFileReference; + name = quickfix.pro; + path = proto/quickfix.pro; + refType = 4; + }; + 2737994F00B36C397F000001 = { + isa = PBXFileReference; + name = regexp.pro; + path = proto/regexp.pro; + refType = 4; + }; + 2737995000B36C397F000001 = { + isa = PBXFileReference; + name = screen.pro; + path = proto/screen.pro; + refType = 4; + }; + 2737995100B36C397F000001 = { + isa = PBXFileReference; + name = search.pro; + path = proto/search.pro; + refType = 4; + }; + 2737995200B36C397F000001 = { + isa = PBXFileReference; + name = syntax.pro; + path = proto/syntax.pro; + refType = 4; + }; + 2737995300B36C397F000001 = { + isa = PBXFileReference; + name = tag.pro; + path = proto/tag.pro; + refType = 4; + }; + 2737995400B36C397F000001 = { + isa = PBXFileReference; + name = term.pro; + path = proto/term.pro; + refType = 4; + }; + 2737995500B36C397F000001 = { + isa = PBXFileReference; + name = termlib.pro; + path = proto/termlib.pro; + refType = 4; + }; + 2737995600B36C397F000001 = { + isa = PBXFileReference; + name = ui.pro; + path = proto/ui.pro; + refType = 4; + }; + 2737995700B36C397F000001 = { + isa = PBXFileReference; + name = undo.pro; + path = proto/undo.pro; + refType = 4; + }; + 2737995800B36C397F000001 = { + isa = PBXFileReference; + name = version.pro; + path = proto/version.pro; + refType = 4; + }; + 2737995900B36C397F000001 = { + isa = PBXFileReference; + name = window.pro; + path = proto/window.pro; + refType = 4; + }; +//270 +//271 +//272 +//273 +//274 +//7E0 +//7E1 +//7E2 +//7E3 +//7E4 + 7E3AAAD704841C0000EFC20E = { + isa = PBXFileReference; + path = ex_eval.c; + refType = 4; + }; + 7E3AAAD804841C0000EFC20E = { + fileRef = 7E3AAAD704841C0000EFC20E; + isa = PBXBuildFile; + settings = { + }; + }; + 7E556E1404841F7900882585 = { + fileRef = 273798ED00B36B047F000001; + isa = PBXBuildFile; + settings = { + }; + }; +//7E0 +//7E1 +//7E2 +//7E3 +//7E4 +//F50 +//F51 +//F52 +//F53 +//F54 + F5CC3220018E3F6801891561 = { + fileRef = 273798E200B36B037F000001; + isa = PBXBuildFile; + settings = { + }; + }; + F5D0FB2B00F8C29A01000001 = { + children = ( + F5D0FB2C00F8C2BF01000001, + ); + isa = PBXGroup; + name = "Optional Source"; + path = ""; + refType = 4; + }; + F5D0FB2C00F8C2BF01000001 = { + isa = PBXFileReference; + path = mbyte.c; + refType = 4; + }; + F5D0FB2D00F8C2BF01000001 = { + fileRef = F5D0FB2C00F8C2BF01000001; + isa = PBXBuildFile; + settings = { + }; + }; + F5E2C53F00FACD0901000001 = { + isa = PBXFileReference; + path = os_macosx.c; + refType = 4; + }; + F5E2C54000FACD0901000001 = { + fileRef = F5E2C53F00FACD0901000001; + isa = PBXBuildFile; + settings = { + }; + }; + }; + rootObject = 20286C28FDCF999611CA2CEA; +}
new file mode 100644 --- /dev/null +++ b/src/os_mac_conv.c @@ -0,0 +1,230 @@ +/* vi:set ts=8 sts=4 sw=4: + * + * VIM - Vi IMproved by Bram Moolenaar + * + * Do ":help uganda" in Vim to read copying and usage conditions. + * Do ":help credits" in Vim to see a list of people who contributed. + * See README.txt for an overview of the Vim source code. + */ +/* + * os_mac_conv.c: Code specifically for Mac string conversions. + * + * This code has been put in a separate file to avoid the conflicts that are + * caused by including both the X11 and Carbon header files. + */ + +#define NO_X11_INCLUDES +#include "vim.h" + +extern char_u *mac_string_convert __ARGS((char_u *ptr, int len, int *lenp, int fail_on_error, int from, int to, int *unconvlenp)); +extern int macroman2enc __ARGS((char_u *ptr, long *sizep, long real_size)); +extern int enc2macroman __ARGS((char_u *from, size_t fromlen, char_u *to, int *tolenp, int maxtolen, char_u *rest, int *restlenp)); + +/* + * A Mac version of string_convert_ext() for special cases. + */ + char_u * +mac_string_convert(ptr, len, lenp, fail_on_error, from_enc, to_enc, unconvlenp) + char_u *ptr; + int len; + int *lenp; + int fail_on_error; + int from_enc; + int to_enc; + int *unconvlenp; +{ + char_u *retval, *d; + CFStringRef cfstr; + int buflen, in, out, l, i; + CFStringEncoding from; + CFStringEncoding to; + + switch (from_enc) + { + case 'l': from = kCFStringEncodingISOLatin1; break; + case 'm': from = kCFStringEncodingMacRoman; break; + case 'u': from = kCFStringEncodingUTF8; break; + default: return NULL; + } + switch (to_enc) + { + case 'l': to = kCFStringEncodingISOLatin1; break; + case 'm': to = kCFStringEncodingMacRoman; break; + case 'u': to = kCFStringEncodingUTF8; break; + default: return NULL; + } + + 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; +} + +/* + * Conversion from Apple MacRoman char encoding to UTF-8 or latin1, using + * standard Carbon framework. + * Input: "ptr[*sizep]". + * "real_size" is the size of the buffer that "ptr" points to. + * output is in-place, "sizep" is adjusted. + * Returns OK or FAIL. + */ + int +macroman2enc(ptr, sizep, real_size) + char_u *ptr; + long *sizep; + long real_size; +{ + CFStringRef cfstr; + CFRange r; + CFIndex len = *sizep; + + /* 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) + return FAIL; + + 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 + *sizep, real_size - *sizep, &len)) + { + CFRelease(cfstr); + return FAIL; + } + CFRelease(cfstr); + mch_memmove(ptr, ptr + *sizep, len); + *sizep = len; + + return OK; +} + +/* + * Conversion from UTF-8 or latin1 to MacRoman. + * Input: "from[fromlen]" + * Output: "to[maxtolen]" length in "*tolenp" + * Unconverted rest in rest[*restlenp]. + * Returns OK or FAIL. + */ + int +enc2macroman(from, fromlen, to, tolenp, maxtolen, rest, restlenp) + char_u *from; + size_t fromlen; + char_u *to; + int *tolenp; + int maxtolen; + char_u *rest; + int *restlenp; +{ + CFStringRef cfstr; + CFRange r; + CFIndex l; + + *restlenp = 0; + cfstr = CFStringCreateWithBytes(NULL, from, fromlen, + (enc_utf8) ? kCFStringEncodingUTF8 : kCFStringEncodingISOLatin1, + 0); + while (cfstr == NULL && *restlenp < 3 && fromlen > 1) + { + rest[*restlenp++] = from[--fromlen]; + cfstr = CFStringCreateWithBytes(NULL, from, fromlen, + (enc_utf8) ? kCFStringEncodingUTF8 : kCFStringEncodingISOLatin1, + 0); + } + if (cfstr == NULL) + 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 */ + to, maxtolen, &l)) + { + CFRelease(cfstr); + return FAIL; + } + CFRelease(cfstr); + *tolenp = l; + return OK; +}
--- a/src/os_macosx.c +++ b/src/os_macosx.c @@ -338,8 +338,8 @@ ICONV_OPEN_ERR: * TECCreateConverter() failed. */ static size_t -null_conv(iconv_t cd, const char** inbuf, size_t *inbytesleft, - char** outbuf, size_t *outbytesleft) +null_conv(iconv_t cd, const char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft) { const char* buf_in = inbuf && *inbuf ? *inbuf : NULL; char* buf_out = outbuf && *outbuf ? *outbuf : NULL; @@ -375,14 +375,14 @@ null_conv(iconv_t cd, const char** inbuf } size_t -iconv(iconv_t cd, const char** inbuf, size_t *inbytesleft, - char** outbuf, size_t *outbytesleft) +iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft) { - ConstTextPtr buf_in; - TextPtr buf_out; - ByteCount out_len, out_true; - ByteCount in_len, in_true; - OSStatus st; + ConstTextPtr buf_in; + TextPtr buf_out; + ByteCount out_len, out_true; + ByteCount in_len, in_true; + OSStatus st; if (!cd) { @@ -537,7 +537,7 @@ iconv_close(iconv_t cd) } } - int* + int * iconv_errno() { return &last_errno; @@ -549,8 +549,8 @@ iconv_errno() #define GETTEXT_BUFNUM 64 #define GETTEXT_BUFSIZE 256 - char* -mch_gettext(const char* msgid) + char * +mch_gettext(const char *msgid) { static char buf[GETTEXT_BUFNUM][GETTEXT_BUFSIZE]; static int bufnum = 0; @@ -593,18 +593,18 @@ MCH_GETTEXT_FINISH: CFRelease(strkey); if (strmsg) CFRelease(strmsg); - return (char*)(msg ? msg : msgid); + return (char *)(msg ? msg : msgid); } - char* -mch_bindtextdomain(const char* domain, const char* dirname) + char * +mch_bindtextdomain(const char *domain, const char *dirname) { TRACE("mch_bindtextdomain(%s, %s)\n", domain, dirname); return (char*)dirname; } - char* -mch_textdomain(const char* domain) + char * +mch_textdomain(const char *domain) { TRACE("mch_textdomain(%s)\n", domain); return (char*)domain;
--- a/src/testdir/test11.in +++ b/src/testdir/test11.in @@ -20,13 +20,12 @@ STARTTEST :set bin :au FileWritePre *.gz '[,']!gzip :au FileWritePost *.gz undo -:/start of testfile/,/end of testfile/w! Xtestfile.gz +:/^start of testfile/,/^end of testfile/w! Xtestfile.gz :au FileReadPost *.gz '[,']!gzip -d :$r Xtestfile.gz " Read and decompress the testfile :?startstart?,$w! test.out " Write contents of this file :au BufNewFile *.c read Xtest.c -gg/^end of testfile -:/start of test.c/+1,/end of test.c/-1w! Xtest.c +:/^start of test.c/+1,/^end of test.c/-1w! Xtest.c :e! foo.c " Will load Xtest.c :au FileAppendPre *.out '[,']s/new/NEW/ :au FileAppendPost *.out !cat Xtest.c >>test.out
--- a/src/vim.h +++ b/src/vim.h @@ -91,7 +91,7 @@ || defined(FEAT_GUI_AMIGA) \ || defined(FEAT_GUI_PHOTON) \ || defined(FEAT_GUI_KDE) -# ifndef FEAT_GUI +# if !defined(FEAT_GUI) && !defined(NO_X11_INCLUDES) # define FEAT_GUI # endif #endif @@ -160,6 +160,35 @@ # define FEAT_X11 #endif +#ifdef NO_X11_INCLUDES + /* In os_mac_conv.c NO_X11_INCLUDES is defined to avoid X11 headers. + * Disable all X11 related things to avoid conflicts. */ +# ifdef FEAT_X11 +# undef FEAT_X11 +# endif +# ifdef FEAT_XCLIPBOARD +# undef FEAT_XCLIPBOARD +# endif +# ifdef FEAT_GUI_MOTIF +# undef FEAT_GUI_MOTIF +# endif +# ifdef FEAT_GUI_ATHENA +# undef FEAT_GUI_ATHENA +# endif +# ifdef FEAT_GUI_GTK +# undef FEAT_GUI_GTK +# endif +# ifdef FEAT_BEVAL_TIP +# undef FEAT_BEVAL_TIP +# endif +# ifdef FEAT_XIM +# undef FEAT_XIM +# endif +# ifdef FEAT_CLIENTSERVER +# undef FEAT_CLIENTSERVER +# endif +#endif + /* Can't use "PACKAGE" here, conflicts with a Perl include file. */ #ifndef VIMPACKAGE # define VIMPACKAGE "vim"