To: vim-dev@vim.org Subject: Patch 6.2.378 (extra) Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.2.378 (extra, after 6.2.118) Problem: Mac: cannot build with Project Builder. Solution: Add remove_tail_with_ext() to locate and remove the "build" directory from the runtime path. Include os_unix.c when needed. (Dany St Amant) Files: src/misc1.c, src/os_macosx.c, src/vim.h *** ../vim-6.2.377/src/misc1.c Fri Mar 12 21:58:35 2004 --- src/misc1.c Thu Mar 18 14:05:52 2004 *************** *** 20,25 **** --- 20,28 ---- static char_u *vim_version_dir __ARGS((char_u *vimdir)); static char_u *remove_tail __ARGS((char_u *p, char_u *pend, char_u *name)); + #if defined(USE_EXE_NAME) && defined(MACOS_X) + static char_u *remove_tail_with_ext __ARGS((char_u *p, char_u *pend, char_u *ext)); + #endif static int get_indent_str __ARGS((char_u *ptr, int ts)); static int copy_indent __ARGS((int size, char_u *src)); *************** *** 3535,3542 **** /* remove "build/..." from exe_name, if present */ if (p == exe_name) { ! pend = remove_tail(p, pend, (char_u *)"Contents/MacOS"); ! pend = remove_tail(p, pend, (char_u *)"build"); } # endif /* remove "src/" from exe_name, if present */ --- 3538,3553 ---- /* remove "build/..." from exe_name, if present */ if (p == exe_name) { ! char_u *pend1; ! char_u *pend2; ! ! pend1 = remove_tail(p, pend, (char_u *)"Contents/MacOS"); ! pend2 = remove_tail_with_ext(p, pend1, (char_u *)".app"); ! pend = remove_tail(p, pend2, (char_u *)"build"); ! /* When runnig from project builder get rid of the ! * build/???.app, otherwise keep the ???.app */ ! if (pend2 == pend) ! pend = pend1; } # endif /* remove "src/" from exe_name, if present */ *************** *** 3681,3686 **** --- 3692,3720 ---- return newend; return pend; } + + #if defined(USE_EXE_NAME) && defined(MACOS_X) + /* + * If the string between "p" and "pend" ends in "???.ext/", return "pend" + * minus the length of "???.ext/". Otherwise return "pend". + */ + static char_u * + remove_tail_with_ext(p, pend, ext) + char_u *p; + char_u *pend; + char_u *ext; + { + int len = (int)STRLEN(ext) + 1; + char_u *newend = pend - len; + + if (newend >= p && fnamencmp(newend, ext, len - 1) == 0) + while (newend != p && !vim_ispathsep(*(newend - 1))) + --newend; + if (newend == p || vim_ispathsep(*(newend - 1))) + return newend; + return pend; + } + #endif /* * Call expand_env() and store the result in an allocated string. *** ../vim-6.2.377/src/os_macosx.c Mon Oct 13 22:21:06 2003 --- src/os_macosx.c Thu Mar 18 14:07:31 2004 *************** *** 13,24 **** */ #ifdef MACOS_X_UNIX ! # include "vim.h" #else # include "os_mac.c" # include #endif void Trace(char* fmt, ...) { --- 13,29 ---- */ #ifdef MACOS_X_UNIX ! # ifdef HAVE_CONFIG_H /* Using Makefile. */ ! # include "vim.h" ! # else ! # include "os_unix.c" /* Using Project Builder */ ! # endif #else # include "os_mac.c" # include #endif + #ifdef _DEBUG void Trace(char* fmt, ...) { *************** *** 30,35 **** --- 35,41 ---- fprintf(stderr, "%s", buf); va_end(args); } + #endif #ifdef MACOS_X_ICONVEMU /* *** ../vim-6.2.377/src/vim.h Wed Mar 17 18:17:24 2004 --- src/vim.h Thu Mar 18 14:09:26 2004 *************** *** 74,79 **** --- 74,83 ---- #if defined(MACOS_X) && defined(MACOS_CLASSIC) Error: To compile for both MACOS X and Classic use a Classic Carbon #endif + /* Unless made through the Makefile enforce GUI on Mac */ + #if defined(MACOS) && !defined(HAVE_CONFIG_H) + # define FEAT_GUI_MAC + #endif #if defined(FEAT_GUI_MOTIF) \ *** ../vim-6.2.377/src/version.c Thu Mar 18 12:20:26 2004 --- src/version.c Thu Mar 18 14:38:32 2004 *************** *** 639,640 **** --- 639,642 ---- { /* Add new patch number below this line */ + /**/ + 378, /**/ -- hundred-and-one symptoms of being an internet addict: 58. You turn on your computer and turn off your wife. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///