To: vim-dev@vim.org
Subject: Patch 6.0.250 (extra)
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 6.0.250 (extra)
Problem:    Macintosh: Various problems when compiling.
Solution:   Various fixes, mostly #ifdefs.
Files:	    src/gui_mac.c, src/main.c, src/misc2.c, src/os_mac.h,
	    src/os_mac.pbproj/project.pbxproj, src/os_unix.c


*** ../vim60.249/src/gui_mac.c	Mon Aug 27 17:23:35 2001
--- src/gui_mac.c	Thu Feb 21 19:07:01 2002
***************
*** 1882,1893 ****
  
      whichWindow = (WindowPtr) event->message;
      if ((event->modifiers) & activeFlag)
! 	/* Activate */
! 	gui.in_focus = TRUE;
      else
      {
  	/* Deactivate */
! 	gui.in_focus = FALSE;
  /*	DON'T KNOW what the code below was doing
  	found in the deactivate clause, but the
  	clause writting TRUE into in_focus (BUG)
--- 1882,1893 ----
  
      whichWindow = (WindowPtr) event->message;
      if ((event->modifiers) & activeFlag)
!     	/* Activate */
! 	gui_focus_change(TRUE);
      else
      {
  	/* Deactivate */
! 	gui_focus_change(FALSE);
  /*	DON'T KNOW what the code below was doing
  	found in the deactivate clause, but the
  	clause writting TRUE into in_focus (BUG)
***************
*** 1899,1905 ****
  	SetOutlinePreferred (a_bool);
  #endif
      }
-     gui_update_cursor(TRUE, FALSE);
  }
  
  
--- 1899,1904 ----
***************
*** 1921,1932 ****
       * get an activate/desactivate event
       */
      if (event->message & 1)
! 	/* Resume */
! 	gui.in_focus = TRUE;
      else
! 	/* Suspend */
! 	gui.in_focus = FALSE;
!     gui_update_cursor(TRUE, FALSE);
  }
  
  /*
--- 1920,1930 ----
       * get an activate/desactivate event
       */
      if (event->message & 1)
!     	/* Resume */
! 	gui_focus_change(TRUE);
      else
!     	/* Suspend */
! 	gui_focus_change(FALSE);
  }
  
  /*
*** ../vim60.249/src/main.c	Thu Feb 21 17:40:20 2002
--- src/main.c	Thu Feb 21 19:07:01 2002
***************
*** 171,177 ****
      qnx_init();		/* PhAttach() for clipboard, (and gui) */
  #endif
  
! #ifdef FEAT_GUI_MAC
      /* Macintosh needs this before any memory is allocated. */
      gui_prepare(&argc, argv);	/* Prepare for possibly starting GUI sometime */
      TIME_MSG("GUI prepared");
--- 171,177 ----
      qnx_init();		/* PhAttach() for clipboard, (and gui) */
  #endif
  
! #ifdef MAC_OS_CLASSIC
      /* Macintosh needs this before any memory is allocated. */
      gui_prepare(&argc, argv);	/* Prepare for possibly starting GUI sometime */
      TIME_MSG("GUI prepared");
***************
*** 301,307 ****
  #ifdef FEAT_SUN_WORKSHOP
      findYourself(argv[0]);
  #endif
! #if defined(FEAT_GUI) && !defined(FEAT_GUI_MAC)
      gui_prepare(&argc, argv);	/* Prepare for possibly starting GUI sometime */
      TIME_MSG("GUI prepared");
  #endif
--- 301,307 ----
  #ifdef FEAT_SUN_WORKSHOP
      findYourself(argv[0]);
  #endif
! #if defined(FEAT_GUI) && !defined(MAC_OS_CLASSIC)
      gui_prepare(&argc, argv);	/* Prepare for possibly starting GUI sometime */
      TIME_MSG("GUI prepared");
  #endif
***************
*** 642,650 ****
  		   -psn_0_10223617 is passed in when invoke from Finder
  		   or with the 'open' command */
  	    case 'p':
- 		mch_errmsg("What does this mean: ");
- 		mch_errmsg(argv[0]);
- 		mch_errmsg("\n");
  		argv_idx = -1; /* bypass full -psn */
  		break;
  #endif
--- 642,647 ----
*** ../vim60.249/src/misc2.c	Thu Feb  7 15:41:28 2002
--- src/misc2.c	Thu Feb 21 19:07:01 2002
***************
*** 5266,5272 ****
  #define EXTRASIZE 5		/* increment to add to env. size */
  
  static int  envsize = -1;	/* current size of environment */
! #ifndef MACOS
  extern
  #endif
         char **environ;		/* the global which is your env. */
--- 5272,5278 ----
  #define EXTRASIZE 5		/* increment to add to env. size */
  
  static int  envsize = -1;	/* current size of environment */
! #ifndef MACOS_CLASSIC
  extern
  #endif
         char **environ;		/* the global which is your env. */
*** ../vim60.249/src/os_mac.h	Thu Aug 23 11:06:28 2001
--- src/os_mac.h	Thu Feb 21 19:07:01 2002
***************
*** 29,63 ****
  #include <OSUtils.h>
  #include <Files.h>
  #ifdef FEAT_MBYTE
! #include <Script.h>
  #endif
  
  /*
   * Unix interface
   */
! #if defined(__MWERKS__)/* Only for metrowerks and MacOSX Compilers */
  # include <unistd.h>
  # include <utsname.h>
- # include <stat.h>
  # include <unix.h>
  #endif
! #if defined(__APPLE_CC__)
  # include <unistd.h>
- # include <sys/stat.h>
- # include <curses.h>
-   /* Remove some BACKWARD compatibilty stuff */
- # undef reg
- # undef ospeed
  #endif
! #include <signal.h>
! #include <errno.h>
! #include <stdio.h>
! #include <stdlib.h>
! #include <time.h>
! #ifdef MACOS_X
! # include <dirent.h>
  #endif
  #if defined(__MRC__) || defined(__SC__) /* for Apple MPW Compilers */
  # ifdef powerc
  #  pragma options align=power
  # endif
--- 29,57 ----
  #include <OSUtils.h>
  #include <Files.h>
  #ifdef FEAT_MBYTE
! # include <Script.h>
  #endif
  
  /*
   * Unix interface
   */
! #if defined(__MWERKS__) /* for CodeWarrior */
  # include <unistd.h>
  # include <utsname.h>
  # include <unix.h>
  #endif
! #if defined(__APPLE_CC__) /* for Project Builder and ... */
  # include <unistd.h>
  #endif
! /* Get stat.h or something similar. Comment: How come some OS get in in vim.h */
! #if defined(__MWERKS__)
! # include <stat.h>
! #endif
! #if defined(__APPLE_CC__)
! # include <sys/stat.h>
  #endif
  #if defined(__MRC__) || defined(__SC__) /* for Apple MPW Compilers */
+ /* There's no stat.h for MPW? */
  # ifdef powerc
  #  pragma options align=power
  # endif
***************
*** 71,88 ****
  #  pragma options align=reset
  # endif
  #endif
! 
! /*
!  * Allow use of MacOS memory allocation subroutine
!  */
! #if 0	    /* this doesn't work, because realloc() isn't redefined */
! /*
!  * Use Macintosh subroutine to alloc the memory.
!  * (malloc generate Ptr format hard to debug with ZoneRanger)
!  */
! # define malloc(x) NewPtr(x)
! # define free(x)   DisposePtr((char *) x)
! # define realloc() something
  #endif
  
  /*
--- 65,84 ----
  #  pragma options align=reset
  # endif
  #endif
! #if defined(__APPLE_CC__) /* && defined(HAVE_CURSE) */
! /* The curses.h from MacOS X provides by default some BACKWARD compatibilty
!  * definition which can cause us problem later on. So we undefine a few of them. */
! # include <curses.h>
! # undef reg
! # undef ospeed
! #endif
! #include <signal.h>
! #include <errno.h>
! #include <stdio.h>
! #include <stdlib.h>
! #include <time.h>
! #ifdef MACOS_X
! # include <dirent.h>
  #endif
  
  /*
***************
*** 100,106 ****
  #  error "You must compile with enums always int!"
  # endif
  # if defined(__MWERKS__) && !defined(__fourbyteints__)
! #  error "You must compile the projecct with 4-byte ints"
  /* MPW ints are always 4 byte long */
  # endif
  #endif
--- 96,102 ----
  #  error "You must compile with enums always int!"
  # endif
  # if defined(__MWERKS__) && !defined(__fourbyteints__)
! #  error "You must compile the project with 4-byte ints"
  /* MPW ints are always 4 byte long */
  # endif
  #endif
***************
*** 134,140 ****
  #define CASE_INSENSITIVE_FILENAME   /* ignore case when comparing file names */
  #define SPACE_IN_FILENAME
  #define BREAKCHECK_SKIP	   32	    /* call mch_breakcheck() each time, it's
! 				       quite fast */
  
  
  #undef  USE_FNAME_CASE	    /* So that :e os_Mac.c, :w, save back the file as os_mac.c */
--- 130,136 ----
  #define CASE_INSENSITIVE_FILENAME   /* ignore case when comparing file names */
  #define SPACE_IN_FILENAME
  #define BREAKCHECK_SKIP	   32	    /* call mch_breakcheck() each time, it's
! 				       quite fast. Did I forgot to update the comment */
  
  
  #undef  USE_FNAME_CASE	    /* So that :e os_Mac.c, :w, save back the file as os_mac.c */
***************
*** 323,328 ****
--- 319,325 ----
  
  #define WILDCHAR_LIST "*?[{`$"
  
+ /**************/
  #define mch_rename(src, dst) rename(src, dst)
  #define mch_remove(x) unlink((char *)(x))
  #if defined(__MRC__) || defined(__SC__)
***************
*** 330,336 ****
  # define mch_setenv(name, val, x) setenv((name), (val))
  #elif defined(__APPLE_CC__)
  # define mch_getenv(name)  ((char_u *)getenv((char *)(name)))
! # define mch_setenv(name, val, x) setenv((name), (val))
  #else
   /* vim_getenv() is in pty.c */
  # define USE_VIMPTY_GETENV
--- 327,334 ----
  # define mch_setenv(name, val, x) setenv((name), (val))
  #elif defined(__APPLE_CC__)
  # define mch_getenv(name)  ((char_u *)getenv((char *)(name)))
! /*# define mch_setenv(name, val, x) setenv((name), (val)) */ /* Obsoleted by Dany on Oct 30, 2001 */
! # define mch_setenv(name, val, x) setenv(name, val, x)
  #else
   /* vim_getenv() is in pty.c */
  # define USE_VIMPTY_GETENV
***************
*** 357,371 ****
  # define SIGPROTOARG	(int)
  # define SIGDEFARG(s)	(s) int s;
  # define SIGDUMMYARG	0
! # define USE_SYSTEM  /* Output ship do debugger :(, but ot compile */
  # define HAVE_TERMIOS_H 1
  # define SYS_SELECT_WITH_SYS_TIME 1
  # define HAVE_SELECT 1
  # define HAVE_SYS_SELECT_H 1
  # undef  HAVE_AVAIL_MEM
  # define mch_chdir(s) chdir(s)
  #endif
  
! /* A Mac constat causing big problem to syntax highlighting */
  #define UNKNOWN_CREATOR '????'
  
--- 355,373 ----
  # define SIGPROTOARG	(int)
  # define SIGDEFARG(s)	(s) int s;
  # define SIGDUMMYARG	0
! /*# define USE_SYSTEM */  /* Output ship do debugger :(, but ot compile */
! # define HAVE_SYS_WAIT_H 1 /* Attempt */
  # define HAVE_TERMIOS_H 1
  # define SYS_SELECT_WITH_SYS_TIME 1
  # define HAVE_SELECT 1
  # define HAVE_SYS_SELECT_H 1
  # undef  HAVE_AVAIL_MEM
+ # define HAVE_PUTENV
+ # define HAVE_SETENV
+ # define HAVE_RENAME
  # define mch_chdir(s) chdir(s)
  #endif
  
! /* A Mac constant causing big problem to syntax highlighting */
  #define UNKNOWN_CREATOR '????'
  
*** ../vim60.249/src/os_mac.pbproj/project.pbxproj	Tue Jul 10 16:10:02 2001
--- src/os_mac.pbproj/project.pbxproj	Thu Feb 21 19:08:14 2002
***************
*** 3,9 ****
  	archiveVersion = 1;
  	classes = {
  	};
! 	objectVersion = 32;
  	objects = {
  		00EF808200C49A857F000001 = {
  			isa = PBXFileReference;
--- 3,9 ----
  	archiveVersion = 1;
  	classes = {
  	};
! 	objectVersion = 34;
  	objects = {
  		00EF808200C49A857F000001 = {
  			isa = PBXFileReference;
***************
*** 121,126 ****
--- 121,127 ----
  			);
  			buildSettings = {
  				COPY_PHASE_STRIP = NO;
+ 				OPTIMIZATION_CFLAGS = "-O0";
  			};
  			isa = PBXBuildStyle;
  			name = Development;
***************
*** 373,379 ****
  				HEADER_SEARCH_PATHS = "proto /Developer/Headers/FlatCarbon";
  				INSTALL_PATH = "$(HOME)/Applications";
  				LIBRARY_SEARCH_PATHS = "";
- 				OPTIMIZATION_CFLAGS = "";
  				OTHER_CFLAGS = "-DMACOS_X";
  				OTHER_LDFLAGS = "";
  				OTHER_REZFLAGS = "";
--- 374,379 ----
***************
*** 496,501 ****
--- 496,502 ----
  				06B64A4B00BBD0257F000001,
  				F5D0FB2D00F8C2BF01000001,
  				F5E2C54000FACD0901000001,
+ 				F5CC3220018E3F6801891561,
  			);
  			isa = PBXSourcesBuildPhase;
  			name = Sources;
***************
*** 1445,1450 ****
--- 1446,1457 ----
  //F52
  //F53
  //F54
+ 		F5CC3220018E3F6801891561 = {
+ 			fileRef = 273798E200B36B037F000001;
+ 			isa = PBXBuildFile;
+ 			settings = {
+ 			};
+ 		};
  		F5D0FB2B00F8C29A01000001 = {
  			children = (
  				F5D0FB2C00F8C2BF01000001,
*** ../vim60.249/src/os_unix.c	Thu Feb 21 12:58:20 2002
--- src/os_unix.c	Thu Feb 21 19:07:10 2002
***************
*** 3457,3468 ****
  finished:
  		p_more = p_more_save;
  
  		/*
  		 * Give all typeahead that wasn't used back to ui_inchar().
  		 */
  		if (ta_len)
  		    ui_inchar_undo(ta_buf, ta_len);
! 
  		State = old_State;
  		if (toshell_fd >= 0)
  		    close(toshell_fd);
--- 3511,3523 ----
  finished:
  		p_more = p_more_save;
  
+ #ifndef MACOS_X_UNIX /* TODO: Is it needed for MACOS_X ? */
  		/*
  		 * Give all typeahead that wasn't used back to ui_inchar().
  		 */
  		if (ta_len)
  		    ui_inchar_undo(ta_buf, ta_len);
! #endif
  		State = old_State;
  		if (toshell_fd >= 0)
  		    close(toshell_fd);
***************
*** 3978,3984 ****
      }
  
      /* compile the regexp into a program */
! #ifdef MACOS_X
      regmatch.rm_ic = TRUE;		/* Behave like Terminal.app */
  #else
      regmatch.rm_ic = FALSE;		/* Don't ever ignore case */
--- 4033,4039 ----
      }
  
      /* compile the regexp into a program */
! #ifdef MACOS_X /* Can/Should we use CASE_INSENSITIVE_FILENAME instead ?*/
      regmatch.rm_ic = TRUE;		/* Behave like Terminal.app */
  #else
      regmatch.rm_ic = FALSE;		/* Don't ever ignore case */
*** ../vim60.249/src/version.c	Thu Feb 21 17:40:20 2002
--- src/version.c	Thu Feb 21 19:17:17 2002
***************
*** 608,609 ****
--- 608,611 ----
  {   /* Add new patch number below this line */
+ /**/
+     250,
  /**/

-- 
The fastest way to get an engineer to solve a problem is to declare that the
problem is unsolvable.  No engineer can walk away from an unsolvable problem
until it's solved.
				(Scott Adams - The Dilbert principle)

 ///  Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net  \\\
///   Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim   \\\
\\\           Project leader for A-A-P -- http://www.a-a-p.org           ///
 \\\  Help me helping AIDS orphans in Uganda - http://iccf-holland.org  ///