summaryrefslogtreecommitdiffstats
path: root/patches/source/vim/patches/7.4.119
blob: 061b81a55ea72c19ce75097ccfa17c2ea490dc62 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
To: vim_dev@googlegroups.com
Subject: Patch 7.4.119
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.4.119
Problem:    Vim doesn't work well on OpenVMS.
Solution:   Fix various problems. (Samuel Ferencik)
Files:	    src/os_unix.c, src/os_unix.h, src/os_vms.c


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

-- 
It is hard to understand how a cemetery raised its burial
cost and blamed it on the cost of living.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///