-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathvim-8.0.22-rocket.diff
378 lines (354 loc) · 10.2 KB
/
vim-8.0.22-rocket.diff
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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
#
# The Rocket team provides a port of vim at 8.0.22 tag level.
# The following is a diff of their source to the upstream 8.0.22
# which highlights the changes they made to get vim working at
# that level of 'vim'.
# It would be useful to consider these patches when creating
# patches for the latest level of vim.
#
diff --git a/configure b/configure
index 1d0c5b2ec..603af9009 100755
--- a/configure
+++ b/configure
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/env bash
# This is just a stub for the Unix configure script, to provide support for
# doing "./configure" in the top Vim directory.
diff --git a/src/auto/configure b/src/auto/configure
index b42f601db..b581d98eb 100755
--- a/src/auto/configure
+++ b/src/auto/configure
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/env bash
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69.
#
@@ -4564,7 +4564,7 @@ case "$cf_cv_ebcdic" in #(vi
line_break='"\\n"'
;;
- *) line_break='"\\012"';;
+ *) line_break='"\\n"';;
esac
@@ -4598,8 +4598,8 @@ case `uname` in
# Set CFLAGS for configure process.
# This will be reset later for config.mk.
# Use haltonmsg to force error for missing H files.
- CFLAGS="$CFLAGS -D_ALL_SOURCE -Wc,float(ieee),haltonmsg(3296)";
- LDFLAGS="$LDFLAGS -Wl,EDIT=NO"
+ #CFLAGS="$CFLAGS -D_ALL_SOURCE -Wc,float(ieee),haltonmsg(3296)";
+ #LDFLAGS="$LDFLAGS -Wl,EDIT=NO"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
;;
@@ -8242,9 +8242,10 @@ fi
if test "$zOSUnix" = "yes"; then
- CFLAGS="$CFLAGS -W c,dll"
- LDFLAGS="$LDFLAGS -W l,dll"
- X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE -lXmu"
+ #CFLAGS="$CFLAGS -W c,dll"
+ #LDFLAGS="$LDFLAGS -W l,dll"
+ #X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE -lXmu"
+ :
fi
@@ -14101,7 +14102,8 @@ fi
# IBM z/OS reset CFLAGS for config.mk
if test "$zOSUnix" = "yes"; then
- CFLAGS="-D_ALL_SOURCE -Wc,float\(ieee\),dll"
+ #CFLAGS="-D_ALL_SOURCE -Wc,float\(ieee\),dll"
+ :
fi
ac_config_files="$ac_config_files auto/config.mk:config.mk.in"
diff --git a/src/channel.c b/src/channel.c
index 13fb65302..d4ec60b75 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -2355,8 +2355,9 @@ may_invoke_callback(channel_T *channel, int part)
typval_T *listtv = NULL;
typval_T argv[CH_JSON_MAX_ARGS];
int seq_nr = -1;
- ch_mode_T ch_mode = channel->ch_part[part].ch_mode;
- cbq_T *cbhead = &channel->ch_part[part].ch_cb_head;
+ chanpart_T *ch_part = &channel->ch_part[part];
+ ch_mode_T ch_mode = ch_part->ch_mode;
+ cbq_T *cbhead = &ch_part->ch_cb_head;
cbq_T *cbitem;
char_u *callback = NULL;
partial_T *partial = NULL;
@@ -2376,10 +2377,10 @@ may_invoke_callback(channel_T *channel, int part)
callback = cbitem->cq_callback;
partial = cbitem->cq_partial;
}
- else if (channel->ch_part[part].ch_callback != NULL)
+ else if (ch_part->ch_callback != NULL)
{
- callback = channel->ch_part[part].ch_callback;
- partial = channel->ch_part[part].ch_partial;
+ callback = ch_part->ch_callback;
+ partial = ch_part->ch_partial;
}
else
{
@@ -2387,11 +2388,11 @@ may_invoke_callback(channel_T *channel, int part)
partial = channel->ch_partial;
}
- buffer = channel->ch_part[part].ch_bufref.br_buf;
- if (buffer != NULL && !bufref_valid(&channel->ch_part[part].ch_bufref))
+ buffer = ch_part->ch_bufref.br_buf;
+ if (buffer != NULL && !bufref_valid(&ch_part->ch_bufref))
{
/* buffer was wiped out */
- channel->ch_part[part].ch_bufref.br_buf = NULL;
+ ch_part->ch_bufref.br_buf = NULL;
buffer = NULL;
}
@@ -2452,7 +2453,7 @@ may_invoke_callback(channel_T *channel, int part)
if (ch_mode == MODE_NL)
{
- char_u *nl;
+ char_u *nl = NULL;
char_u *buf;
readq_T *node;
@@ -2465,10 +2466,25 @@ may_invoke_callback(channel_T *channel, int part)
if (nl != NULL)
break;
if (channel_collapse(channel, part, TRUE) == FAIL)
+ {
+ if (ch_part->ch_fd == INVALID_FD && node->rq_buflen > 0)
+ break;
return FALSE; /* incomplete message */
+ }
}
buf = node->rq_buffer;
+ if (nl == NULL)
+ {
+ /* Flush remaining message that is missing a NL. */
+ buf = vim_realloc(buf, node->rq_buflen + 1);
+ if (buf == NULL)
+ return FALSE;
+ node->rq_buffer = buf;
+ nl = buf + node->rq_buflen++;
+ *nl = NUL;
+ }
+
/* Convert NUL to NL, the internal representation. */
for (p = buf; p < nl && p < buf + node->rq_buflen; ++p)
if (*p == NUL)
diff --git a/src/configure b/src/configure
index d8595a524..d0a95cbc2 100755
--- a/src/configure
+++ b/src/configure
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/env bash
# run the automatically generated configure script
CONFIG_STATUS=auto/config.status \
auto/configure "$@" --srcdir="${srcdir:-.}" --cache-file=auto/config.cache
diff --git a/src/eval.c b/src/eval.c
index 3b5abe9c3..33b502381 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -243,8 +243,8 @@ static void list_one_var_a(char_u *prefix, char_u *name, int type, char_u *strin
static char_u *find_option_end(char_u **arg, int *opt_flags);
#ifdef EBCDIC
-static int compare_func_name(const void *s1, const void *s2);
-static void sortFunctions();
+int compare_func_name(const void *s1, const void *s2);
+void sortFunctions();
#endif
/* for VIM_VERSION_ defines */
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 84eaa8cbe..32306f6a2 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -925,7 +925,7 @@ get_expr_name(expand_T *xp, int idx)
/*
* Compare struct fst by function name.
*/
- static int
+ int
compare_func_name(const void *s1, const void *s2)
{
struct fst *p1 = (struct fst *)s1;
@@ -939,7 +939,7 @@ compare_func_name(const void *s1, const void *s2)
* The sorting of the table above is ASCII dependant.
* On machines using EBCDIC we have to sort it.
*/
- static void
+ void
sortFunctions(void)
{
int funcCnt = (int)(sizeof(functions) / sizeof(struct fst)) - 1;
diff --git a/src/fileio.c b/src/fileio.c
index bcb8fef8b..7471299f1 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -187,6 +187,56 @@ filemess(
msg_scrolled_ign = FALSE;
}
+/* */
+/* Functions to manipulate tag files in z/OS */
+#ifdef EBCDIC
+
+#include <_Ccsid.h>
+#define CCSID_ISO8859_1 (__ccsid_t) 819
+#define CCSID_IBM_1047 (__ccsid_t) 1047
+#define CCSID_DEFAULT CCSID_ISO8859_1
+static char NAME_CCSID_ISO8859_1[] = "ISO8859-1";
+static char NAME_CCSID_IBM_1047[] = "IBM-1047";
+static char * NAME_CCSID_DEFAULT = NAME_CCSID_ISO8859_1;
+
+static int set_tag_ccsid_fd(int fd, __ccsid_t ccsid)
+{
+ int rc;
+ attrib_t attrs;
+ struct stat st;
+ struct file_tag * tag = &st.st_tag;
+
+ fstat(fd, &st);
+
+ if(tag->ft_ccsid == FT_UNTAGGED){
+ memset(&attrs,0,sizeof(attrs));
+ attrs.att_filetagchg = 1;
+ attrs.att_filetag.ft_txtflag = (ccsid != FT_BINARY);
+ attrs.att_filetag.ft_ccsid = ccsid;
+ /*TODO check attribute file ( mode access, owner ) */
+ return __fchattr(fd, &attrs, sizeof(attrs));
+ }
+
+ return 0;
+}
+
+static int set_tag_fd(int fd, char *charset)
+{
+ int check_binary;
+ __ccsid_t ccsid;
+
+ if (charset == NULL)
+ return 0;
+
+ ccsid = __toCcsid(charset);
+
+ if(ccsid == 0)
+ ccsid = CCSID_DEFAULT;
+
+ return set_tag_ccsid_fd(fd, ccsid);
+}
+
+#endif
/*
* Read lines from file "fname" into the buffer after line "from".
*
@@ -788,6 +838,11 @@ readfile(
|| (using_b_fname && (old_b_fname != curbuf->b_fname))
|| (fd = mch_open((char *)fname, O_RDONLY | O_EXTRA, 0)) < 0))
{
+#ifdef EBCDIC
+ if(fd > 0){
+ set_tag_fd(fd,NAME_CCSID_DEFAULT);
+ }
+#endif
--no_wait_return;
msg_scroll = msg_save;
if (fd < 0)
@@ -3825,7 +3880,6 @@ buf_write(
#if defined(UNIX)
int did_set_shortname;
#endif
-
copybuf = alloc(BUFSIZE + 1);
if (copybuf == NULL)
{
@@ -4449,6 +4503,15 @@ restore_backup:
}
#endif
+#ifdef EBCDIC
+ if(newfile == TRUE){
+ set_tag_fd(fd,NAME_CCSID_DEFAULT);
+ }
+ else{
+ set_tag_ccsid_fd(fd,st_old.st_tag.ft_ccsid);
+ }
+#endif
+
write_info.bw_fd = fd;
#ifdef FEAT_CRYPT
@@ -4801,10 +4864,16 @@ restore_backup:
}
if ((fd = mch_open((char *)backup, O_RDONLY | O_EXTRA, 0)) >= 0)
{
+#ifdef EBCDIC
+ set_tag_fd(fd,NAME_CCSID_DEFAULT);
+#endif
if ((write_info.bw_fd = mch_open((char *)fname,
O_WRONLY | O_CREAT | O_TRUNC | O_EXTRA,
perm & 0777)) >= 0)
{
+#ifdef EBCDIC
+ set_tag_fd(write_info.bw_fd,NAME_CCSID_DEFAULT);
+#endif
/* copy the file. */
write_info.bw_buf = smallbuf;
#ifdef HAS_BW_FLAGS
@@ -6581,6 +6650,9 @@ vim_rename(char_u *from, char_u *to)
#endif
return -1;
}
+#ifdef EBCDIC
+ set_tag_fd(fd_in,NAME_CCSID_DEFAULT);
+#endif
/* Create the new file with same permissions as the original. */
fd_out = mch_open((char *)to,
@@ -6593,6 +6665,9 @@ vim_rename(char_u *from, char_u *to)
#endif
return -1;
}
+#ifdef EBCDIC
+ set_tag_fd(fd_out,NAME_CCSID_DEFAULT);
+#endif
buffer = (char *)alloc(BUFSIZE);
if (buffer == NULL)
diff --git a/src/testdir/test_channel.vim b/src/testdir/test_channel.vim
index eb75a0b1d..0756dd51c 100644
--- a/src/testdir/test_channel.vim
+++ b/src/testdir/test_channel.vim
@@ -1484,6 +1484,27 @@ func Test_raw_passes_nul()
bwipe!
endfunc
+func MyLineCountCb(ch, msg)
+ let g:linecount += 1
+endfunc
+
+func Test_read_nonl_line()
+ if !has('job')
+ return
+ endif
+
+ let g:linecount = 0
+ if has('win32')
+ " workaround: 'shellescape' does improper escaping double quotes
+ let arg = 'import sys;sys.stdout.write(\"1\n2\n3\")'
+ else
+ let arg = 'import sys;sys.stdout.write("1\n2\n3")'
+ endif
+ call job_start([s:python, '-c', arg], {'callback': 'MyLineCountCb'})
+ call WaitFor('3 <= g:linecount')
+ call assert_equal(3, g:linecount)
+endfunc
+
function Ch_test_close_lambda(port)
let handle = ch_open('localhost:' . a:port, s:chopt)
if ch_status(handle) == "fail"
diff --git a/src/version.c b/src/version.c
index dc8e9cf35..4fd2982a5 100644
--- a/src/version.c
+++ b/src/version.c
@@ -764,6 +764,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 22,
/**/
21,
/**/