jkunstle / rpms / vim

Forked from rpms/vim 3 years ago
Clone

Blame SOURCES/7.4.119

dcaee6
To: vim_dev@googlegroups.com
dcaee6
Subject: Patch 7.4.119
dcaee6
Fcc: outbox
dcaee6
From: Bram Moolenaar <Bram@moolenaar.net>
dcaee6
Mime-Version: 1.0
dcaee6
Content-Type: text/plain; charset=UTF-8
dcaee6
Content-Transfer-Encoding: 8bit
dcaee6
------------
dcaee6
dcaee6
Patch 7.4.119
dcaee6
Problem:    Vim doesn't work well on OpenVMS.
dcaee6
Solution:   Fix various problems. (Samuel Ferencik)
dcaee6
Files:	    src/os_unix.c, src/os_unix.h, src/os_vms.c
dcaee6
dcaee6
dcaee6
*** ../vim-7.4.118/src/os_unix.c	2013-12-11 13:21:44.000000000 +0100
dcaee6
--- src/os_unix.c	2013-12-11 16:16:03.000000000 +0100
dcaee6
***************
dcaee6
*** 168,174 ****
dcaee6
  static pid_t wait4pid __ARGS((pid_t, waitstatus *));
dcaee6
  
dcaee6
  static int  WaitForChar __ARGS((long));
dcaee6
! #if defined(__BEOS__)
dcaee6
  int  RealWaitForChar __ARGS((int, long, int *));
dcaee6
  #else
dcaee6
  static int  RealWaitForChar __ARGS((int, long, int *));
dcaee6
--- 168,174 ----
dcaee6
  static pid_t wait4pid __ARGS((pid_t, waitstatus *));
dcaee6
  
dcaee6
  static int  WaitForChar __ARGS((long));
dcaee6
! #if defined(__BEOS__) || defined(VMS)
dcaee6
  int  RealWaitForChar __ARGS((int, long, int *));
dcaee6
  #else
dcaee6
  static int  RealWaitForChar __ARGS((int, long, int *));
dcaee6
***************
dcaee6
*** 435,441 ****
dcaee6
  	/* Process the queued netbeans messages. */
dcaee6
  	netbeans_parse_messages();
dcaee6
  #endif
dcaee6
- #ifndef VMS  /* VMS: must try reading, WaitForChar() does nothing. */
dcaee6
  	/*
dcaee6
  	 * We want to be interrupted by the winch signal
dcaee6
  	 * or by an event on the monitored file descriptors.
dcaee6
--- 435,440 ----
dcaee6
***************
dcaee6
*** 446,452 ****
dcaee6
  		handle_resize();
dcaee6
  	    return 0;
dcaee6
  	}
dcaee6
- #endif
dcaee6
  
dcaee6
  	/* If input was put directly in typeahead buffer bail out here. */
dcaee6
  	if (typebuf_changed(tb_change_cnt))
dcaee6
--- 445,450 ----
dcaee6
***************
dcaee6
*** 5039,5044 ****
dcaee6
--- 5037,5043 ----
dcaee6
      return avail;
dcaee6
  }
dcaee6
  
dcaee6
+ #ifndef VMS
dcaee6
  /*
dcaee6
   * Wait "msec" msec until a character is available from file descriptor "fd".
dcaee6
   * "msec" == 0 will check for characters once.
dcaee6
***************
dcaee6
*** 5338,5350 ****
dcaee6
  	}
dcaee6
  # endif
dcaee6
  
dcaee6
- # ifdef OLD_VMS
dcaee6
- 	/* Old VMS as v6.2 and older have broken select(). It waits more than
dcaee6
- 	 * required. Should not be used */
dcaee6
- 	ret = 0;
dcaee6
- # else
dcaee6
  	ret = select(maxfd + 1, &rfds, NULL, &efds, tvp);
dcaee6
- # endif
dcaee6
  # ifdef EINTR
dcaee6
  	if (ret == -1 && errno == EINTR)
dcaee6
  	{
dcaee6
--- 5337,5343 ----
dcaee6
***************
dcaee6
*** 5466,5473 ****
dcaee6
      return (ret > 0);
dcaee6
  }
dcaee6
  
dcaee6
- #ifndef VMS
dcaee6
- 
dcaee6
  #ifndef NO_EXPANDPATH
dcaee6
  /*
dcaee6
   * Expand a path into all matching files and/or directories.  Handles "*",
dcaee6
--- 5459,5464 ----
dcaee6
*** ../vim-7.4.118/src/os_unix.h	2013-06-12 20:09:44.000000000 +0200
dcaee6
--- src/os_unix.h	2013-12-11 16:16:03.000000000 +0100
dcaee6
***************
dcaee6
*** 225,230 ****
dcaee6
--- 225,232 ----
dcaee6
  # include <starlet.h>
dcaee6
  # include <socket.h>
dcaee6
  # include <lib$routines.h>
dcaee6
+ # include <libdef.h>
dcaee6
+ # include <libdtdef.h>
dcaee6
  
dcaee6
  # ifdef FEAT_GUI_GTK
dcaee6
  #  include "gui_gtk_vms.h"
dcaee6
*** ../vim-7.4.118/src/os_vms.c	2010-06-26 06:03:31.000000000 +0200
dcaee6
--- src/os_vms.c	2013-12-11 17:10:24.000000000 +0100
dcaee6
***************
dcaee6
*** 11,16 ****
dcaee6
--- 11,33 ----
dcaee6
  
dcaee6
  #include	"vim.h"
dcaee6
  
dcaee6
+ /* define _generic_64 for use in time functions */
dcaee6
+ #ifndef VAX
dcaee6
+ #   include <gen64def.h>
dcaee6
+ #else
dcaee6
+ /* based on Alpha's gen64def.h; the file is absent on VAX */
dcaee6
+ typedef struct _generic_64 {
dcaee6
+ #   pragma __nomember_alignment
dcaee6
+     __union  {                          /* You can treat me as...  */
dcaee6
+ 	/* long long is not available on VAXen */
dcaee6
+ 	/* unsigned __int64 gen64$q_quadword; ...a single 64-bit value, or */
dcaee6
+ 
dcaee6
+ 	unsigned int gen64$l_longword [2]; /* ...two 32-bit values, or */
dcaee6
+ 	unsigned short int gen64$w_word [4]; /* ...four 16-bit values */
dcaee6
+     } gen64$r_quad_overlay;
dcaee6
+ } GENERIC_64;
dcaee6
+ #endif
dcaee6
+ 
dcaee6
  typedef struct
dcaee6
  {
dcaee6
      char	class;
dcaee6
***************
dcaee6
*** 669,671 ****
dcaee6
--- 686,777 ----
dcaee6
      }
dcaee6
      return ;
dcaee6
  }
dcaee6
+ 
dcaee6
+ struct typeahead_st {
dcaee6
+     unsigned short numchars;
dcaee6
+     unsigned char  firstchar;
dcaee6
+     unsigned char  reserved0;
dcaee6
+     unsigned long  reserved1;
dcaee6
+ } typeahead;
dcaee6
+ 
dcaee6
+ /*
dcaee6
+  * Wait "msec" msec until a character is available from file descriptor "fd".
dcaee6
+  * "msec" == 0 will check for characters once.
dcaee6
+  * "msec" == -1 will block until a character is available.
dcaee6
+  */
dcaee6
+     int
dcaee6
+ RealWaitForChar(fd, msec, check_for_gpm)
dcaee6
+     int		fd UNUSED; /* always read from iochan */
dcaee6
+     long	msec;
dcaee6
+     int		*check_for_gpm UNUSED;
dcaee6
+ {
dcaee6
+     int status;
dcaee6
+     struct _generic_64 time_curr;
dcaee6
+     struct _generic_64 time_diff;
dcaee6
+     struct _generic_64 time_out;
dcaee6
+     unsigned int convert_operation = LIB$K_DELTA_SECONDS_F;
dcaee6
+     float sec = (float) msec / 1000;
dcaee6
+ 
dcaee6
+     /* make sure the iochan is set */
dcaee6
+     if (!iochan)
dcaee6
+ 	get_tty();
dcaee6
+ 
dcaee6
+     if (msec > 0) {
dcaee6
+         /* time-out specified; convert it to absolute time */
dcaee6
+ 
dcaee6
+         /* get current time (number of 100ns ticks since the VMS Epoch) */
dcaee6
+         status = sys$gettim(&time_curr);
dcaee6
+         if (status != SS$_NORMAL)
dcaee6
+             return 0; /* error */
dcaee6
+ 
dcaee6
+         /* construct the delta time */
dcaee6
+         status = lib$cvtf_to_internal_time(
dcaee6
+                 &convert_operation, &sec, &time_diff);
dcaee6
+         if (status != LIB$_NORMAL)
dcaee6
+             return 0; /* error */
dcaee6
+ 
dcaee6
+         /* add them up */
dcaee6
+         status = lib$add_times(
dcaee6
+                 &time_curr,
dcaee6
+                 &time_diff,
dcaee6
+                 &time_out);
dcaee6
+         if (status != LIB$_NORMAL)
dcaee6
+             return 0; /* error */
dcaee6
+     }
dcaee6
+ 
dcaee6
+     while (TRUE) {
dcaee6
+         /* select() */
dcaee6
+         status = sys$qiow(0, iochan, IO$_SENSEMODE | IO$M_TYPEAHDCNT, iosb,
dcaee6
+                 0, 0, &typeahead, 8, 0, 0, 0, 0);
dcaee6
+ 	if (status != SS$_NORMAL || (iosb[0] & 0xFFFF) != SS$_NORMAL)
dcaee6
+             return 0; /* error */
dcaee6
+ 
dcaee6
+         if (typeahead.numchars)
dcaee6
+             return 1; /* ready to read */
dcaee6
+ 
dcaee6
+         /* there's nothing to read; what now? */
dcaee6
+         if (msec == 0) {
dcaee6
+             /* immediate time-out; return impatiently */
dcaee6
+             return 0;
dcaee6
+         }
dcaee6
+         else if (msec < 0) {
dcaee6
+             /* no time-out; wait on indefinitely */
dcaee6
+             continue;
dcaee6
+         }
dcaee6
+         else {
dcaee6
+             /* time-out needs to be checked */
dcaee6
+             status = sys$gettim(&time_curr);
dcaee6
+             if (status != SS$_NORMAL)
dcaee6
+                 return 0; /* error */
dcaee6
+ 
dcaee6
+             status = lib$sub_times(
dcaee6
+                     &time_out,
dcaee6
+                     &time_curr,
dcaee6
+                     &time_diff);
dcaee6
+             if (status != LIB$_NORMAL)
dcaee6
+                 return 0; /* error, incl. time_diff < 0 (i.e. time-out) */
dcaee6
+ 
dcaee6
+             /* otherwise wait some more */
dcaee6
+         }
dcaee6
+     }
dcaee6
+ }
dcaee6
*** ../vim-7.4.118/src/version.c	2013-12-11 15:51:54.000000000 +0100
dcaee6
--- src/version.c	2013-12-11 16:09:16.000000000 +0100
dcaee6
***************
dcaee6
*** 740,741 ****
dcaee6
--- 740,743 ----
dcaee6
  {   /* Add new patch number below this line */
dcaee6
+ /**/
dcaee6
+     119,
dcaee6
  /**/
dcaee6
dcaee6
-- 
dcaee6
It is hard to understand how a cemetery raised its burial
dcaee6
cost and blamed it on the cost of living.
dcaee6
dcaee6
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
dcaee6
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
dcaee6
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
dcaee6
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///