|
| 1 | +# |
| 2 | +# The Rocket team provides a port of vim at 8.0.22 tag level. |
| 3 | +# The following is a diff of their source to the upstream 8.0.22 |
| 4 | +# which highlights the changes they made to get vim working at |
| 5 | +# that level of 'vim'. |
| 6 | +# It would be useful to consider these patches when creating |
| 7 | +# patches for the latest level of vim. |
| 8 | +# |
| 9 | +diff --git a/configure b/configure |
| 10 | +index 1d0c5b2ec..603af9009 100755 |
| 11 | +--- a/configure |
| 12 | ++++ b/configure |
| 13 | +@@ -1,4 +1,4 @@ |
| 14 | +-#! /bin/sh |
| 15 | ++#!/bin/env bash |
| 16 | + |
| 17 | + # This is just a stub for the Unix configure script, to provide support for |
| 18 | + # doing "./configure" in the top Vim directory. |
| 19 | +diff --git a/src/auto/configure b/src/auto/configure |
| 20 | +index b42f601db..b581d98eb 100755 |
| 21 | +--- a/src/auto/configure |
| 22 | ++++ b/src/auto/configure |
| 23 | +@@ -1,4 +1,4 @@ |
| 24 | +-#! /bin/sh |
| 25 | ++#!/bin/env bash |
| 26 | + # Guess values for system-dependent variables and create Makefiles. |
| 27 | + # Generated by GNU Autoconf 2.69. |
| 28 | + # |
| 29 | +@@ -4564,7 +4564,7 @@ case "$cf_cv_ebcdic" in #(vi |
| 30 | + |
| 31 | + line_break='"\\n"' |
| 32 | + ;; |
| 33 | +- *) line_break='"\\012"';; |
| 34 | ++ *) line_break='"\\n"';; |
| 35 | + esac |
| 36 | + |
| 37 | + |
| 38 | +@@ -4598,8 +4598,8 @@ case `uname` in |
| 39 | + # Set CFLAGS for configure process. |
| 40 | + # This will be reset later for config.mk. |
| 41 | + # Use haltonmsg to force error for missing H files. |
| 42 | +- CFLAGS="$CFLAGS -D_ALL_SOURCE -Wc,float(ieee),haltonmsg(3296)"; |
| 43 | +- LDFLAGS="$LDFLAGS -Wl,EDIT=NO" |
| 44 | ++ #CFLAGS="$CFLAGS -D_ALL_SOURCE -Wc,float(ieee),haltonmsg(3296)"; |
| 45 | ++ #LDFLAGS="$LDFLAGS -Wl,EDIT=NO" |
| 46 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 |
| 47 | + $as_echo "yes" >&6; } |
| 48 | + ;; |
| 49 | +@@ -8242,9 +8242,10 @@ fi |
| 50 | + |
| 51 | + |
| 52 | + if test "$zOSUnix" = "yes"; then |
| 53 | +- CFLAGS="$CFLAGS -W c,dll" |
| 54 | +- LDFLAGS="$LDFLAGS -W l,dll" |
| 55 | +- X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE -lXmu" |
| 56 | ++ #CFLAGS="$CFLAGS -W c,dll" |
| 57 | ++ #LDFLAGS="$LDFLAGS -W l,dll" |
| 58 | ++ #X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE -lXmu" |
| 59 | ++ : |
| 60 | + fi |
| 61 | + |
| 62 | + |
| 63 | +@@ -14101,7 +14102,8 @@ fi |
| 64 | + |
| 65 | + # IBM z/OS reset CFLAGS for config.mk |
| 66 | + if test "$zOSUnix" = "yes"; then |
| 67 | +- CFLAGS="-D_ALL_SOURCE -Wc,float\(ieee\),dll" |
| 68 | ++ #CFLAGS="-D_ALL_SOURCE -Wc,float\(ieee\),dll" |
| 69 | ++ : |
| 70 | + fi |
| 71 | + |
| 72 | + ac_config_files="$ac_config_files auto/config.mk:config.mk.in" |
| 73 | +diff --git a/src/channel.c b/src/channel.c |
| 74 | +index 13fb65302..d4ec60b75 100644 |
| 75 | +--- a/src/channel.c |
| 76 | ++++ b/src/channel.c |
| 77 | +@@ -2355,8 +2355,9 @@ may_invoke_callback(channel_T *channel, int part) |
| 78 | + typval_T *listtv = NULL; |
| 79 | + typval_T argv[CH_JSON_MAX_ARGS]; |
| 80 | + int seq_nr = -1; |
| 81 | +- ch_mode_T ch_mode = channel->ch_part[part].ch_mode; |
| 82 | +- cbq_T *cbhead = &channel->ch_part[part].ch_cb_head; |
| 83 | ++ chanpart_T *ch_part = &channel->ch_part[part]; |
| 84 | ++ ch_mode_T ch_mode = ch_part->ch_mode; |
| 85 | ++ cbq_T *cbhead = &ch_part->ch_cb_head; |
| 86 | + cbq_T *cbitem; |
| 87 | + char_u *callback = NULL; |
| 88 | + partial_T *partial = NULL; |
| 89 | +@@ -2376,10 +2377,10 @@ may_invoke_callback(channel_T *channel, int part) |
| 90 | + callback = cbitem->cq_callback; |
| 91 | + partial = cbitem->cq_partial; |
| 92 | + } |
| 93 | +- else if (channel->ch_part[part].ch_callback != NULL) |
| 94 | ++ else if (ch_part->ch_callback != NULL) |
| 95 | + { |
| 96 | +- callback = channel->ch_part[part].ch_callback; |
| 97 | +- partial = channel->ch_part[part].ch_partial; |
| 98 | ++ callback = ch_part->ch_callback; |
| 99 | ++ partial = ch_part->ch_partial; |
| 100 | + } |
| 101 | + else |
| 102 | + { |
| 103 | +@@ -2387,11 +2388,11 @@ may_invoke_callback(channel_T *channel, int part) |
| 104 | + partial = channel->ch_partial; |
| 105 | + } |
| 106 | + |
| 107 | +- buffer = channel->ch_part[part].ch_bufref.br_buf; |
| 108 | +- if (buffer != NULL && !bufref_valid(&channel->ch_part[part].ch_bufref)) |
| 109 | ++ buffer = ch_part->ch_bufref.br_buf; |
| 110 | ++ if (buffer != NULL && !bufref_valid(&ch_part->ch_bufref)) |
| 111 | + { |
| 112 | + /* buffer was wiped out */ |
| 113 | +- channel->ch_part[part].ch_bufref.br_buf = NULL; |
| 114 | ++ ch_part->ch_bufref.br_buf = NULL; |
| 115 | + buffer = NULL; |
| 116 | + } |
| 117 | + |
| 118 | +@@ -2452,7 +2453,7 @@ may_invoke_callback(channel_T *channel, int part) |
| 119 | + |
| 120 | + if (ch_mode == MODE_NL) |
| 121 | + { |
| 122 | +- char_u *nl; |
| 123 | ++ char_u *nl = NULL; |
| 124 | + char_u *buf; |
| 125 | + readq_T *node; |
| 126 | + |
| 127 | +@@ -2465,10 +2466,25 @@ may_invoke_callback(channel_T *channel, int part) |
| 128 | + if (nl != NULL) |
| 129 | + break; |
| 130 | + if (channel_collapse(channel, part, TRUE) == FAIL) |
| 131 | ++ { |
| 132 | ++ if (ch_part->ch_fd == INVALID_FD && node->rq_buflen > 0) |
| 133 | ++ break; |
| 134 | + return FALSE; /* incomplete message */ |
| 135 | ++ } |
| 136 | + } |
| 137 | + buf = node->rq_buffer; |
| 138 | + |
| 139 | ++ if (nl == NULL) |
| 140 | ++ { |
| 141 | ++ /* Flush remaining message that is missing a NL. */ |
| 142 | ++ buf = vim_realloc(buf, node->rq_buflen + 1); |
| 143 | ++ if (buf == NULL) |
| 144 | ++ return FALSE; |
| 145 | ++ node->rq_buffer = buf; |
| 146 | ++ nl = buf + node->rq_buflen++; |
| 147 | ++ *nl = NUL; |
| 148 | ++ } |
| 149 | ++ |
| 150 | + /* Convert NUL to NL, the internal representation. */ |
| 151 | + for (p = buf; p < nl && p < buf + node->rq_buflen; ++p) |
| 152 | + if (*p == NUL) |
| 153 | +diff --git a/src/configure b/src/configure |
| 154 | +index d8595a524..d0a95cbc2 100755 |
| 155 | +--- a/src/configure |
| 156 | ++++ b/src/configure |
| 157 | +@@ -1,4 +1,4 @@ |
| 158 | +-#! /bin/sh |
| 159 | ++#!/bin/env bash |
| 160 | + # run the automatically generated configure script |
| 161 | + CONFIG_STATUS=auto/config.status \ |
| 162 | + auto/configure "$@" --srcdir="${srcdir:-.}" --cache-file=auto/config.cache |
| 163 | +diff --git a/src/eval.c b/src/eval.c |
| 164 | +index 3b5abe9c3..33b502381 100644 |
| 165 | +--- a/src/eval.c |
| 166 | ++++ b/src/eval.c |
| 167 | +@@ -243,8 +243,8 @@ static void list_one_var_a(char_u *prefix, char_u *name, int type, char_u *strin |
| 168 | + static char_u *find_option_end(char_u **arg, int *opt_flags); |
| 169 | + |
| 170 | + #ifdef EBCDIC |
| 171 | +-static int compare_func_name(const void *s1, const void *s2); |
| 172 | +-static void sortFunctions(); |
| 173 | ++int compare_func_name(const void *s1, const void *s2); |
| 174 | ++void sortFunctions(); |
| 175 | + #endif |
| 176 | + |
| 177 | + /* for VIM_VERSION_ defines */ |
| 178 | +diff --git a/src/evalfunc.c b/src/evalfunc.c |
| 179 | +index 84eaa8cbe..32306f6a2 100644 |
| 180 | +--- a/src/evalfunc.c |
| 181 | ++++ b/src/evalfunc.c |
| 182 | +@@ -925,7 +925,7 @@ get_expr_name(expand_T *xp, int idx) |
| 183 | + /* |
| 184 | + * Compare struct fst by function name. |
| 185 | + */ |
| 186 | +- static int |
| 187 | ++ int |
| 188 | + compare_func_name(const void *s1, const void *s2) |
| 189 | + { |
| 190 | + struct fst *p1 = (struct fst *)s1; |
| 191 | +@@ -939,7 +939,7 @@ compare_func_name(const void *s1, const void *s2) |
| 192 | + * The sorting of the table above is ASCII dependant. |
| 193 | + * On machines using EBCDIC we have to sort it. |
| 194 | + */ |
| 195 | +- static void |
| 196 | ++ void |
| 197 | + sortFunctions(void) |
| 198 | + { |
| 199 | + int funcCnt = (int)(sizeof(functions) / sizeof(struct fst)) - 1; |
| 200 | +diff --git a/src/fileio.c b/src/fileio.c |
| 201 | +index bcb8fef8b..7471299f1 100644 |
| 202 | +--- a/src/fileio.c |
| 203 | ++++ b/src/fileio.c |
| 204 | +@@ -187,6 +187,56 @@ filemess( |
| 205 | + msg_scrolled_ign = FALSE; |
| 206 | + } |
| 207 | + |
| 208 | ++/* */ |
| 209 | ++/* Functions to manipulate tag files in z/OS */ |
| 210 | ++#ifdef EBCDIC |
| 211 | ++ |
| 212 | ++#include <_Ccsid.h> |
| 213 | ++#define CCSID_ISO8859_1 (__ccsid_t) 819 |
| 214 | ++#define CCSID_IBM_1047 (__ccsid_t) 1047 |
| 215 | ++#define CCSID_DEFAULT CCSID_ISO8859_1 |
| 216 | ++static char NAME_CCSID_ISO8859_1[] = "ISO8859-1"; |
| 217 | ++static char NAME_CCSID_IBM_1047[] = "IBM-1047"; |
| 218 | ++static char * NAME_CCSID_DEFAULT = NAME_CCSID_ISO8859_1; |
| 219 | ++ |
| 220 | ++static int set_tag_ccsid_fd(int fd, __ccsid_t ccsid) |
| 221 | ++{ |
| 222 | ++ int rc; |
| 223 | ++ attrib_t attrs; |
| 224 | ++ struct stat st; |
| 225 | ++ struct file_tag * tag = &st.st_tag; |
| 226 | ++ |
| 227 | ++ fstat(fd, &st); |
| 228 | ++ |
| 229 | ++ if(tag->ft_ccsid == FT_UNTAGGED){ |
| 230 | ++ memset(&attrs,0,sizeof(attrs)); |
| 231 | ++ attrs.att_filetagchg = 1; |
| 232 | ++ attrs.att_filetag.ft_txtflag = (ccsid != FT_BINARY); |
| 233 | ++ attrs.att_filetag.ft_ccsid = ccsid; |
| 234 | ++ /*TODO check attribute file ( mode access, owner ) */ |
| 235 | ++ return __fchattr(fd, &attrs, sizeof(attrs)); |
| 236 | ++ } |
| 237 | ++ |
| 238 | ++ return 0; |
| 239 | ++} |
| 240 | ++ |
| 241 | ++static int set_tag_fd(int fd, char *charset) |
| 242 | ++{ |
| 243 | ++ int check_binary; |
| 244 | ++ __ccsid_t ccsid; |
| 245 | ++ |
| 246 | ++ if (charset == NULL) |
| 247 | ++ return 0; |
| 248 | ++ |
| 249 | ++ ccsid = __toCcsid(charset); |
| 250 | ++ |
| 251 | ++ if(ccsid == 0) |
| 252 | ++ ccsid = CCSID_DEFAULT; |
| 253 | ++ |
| 254 | ++ return set_tag_ccsid_fd(fd, ccsid); |
| 255 | ++} |
| 256 | ++ |
| 257 | ++#endif |
| 258 | + /* |
| 259 | + * Read lines from file "fname" into the buffer after line "from". |
| 260 | + * |
| 261 | +@@ -788,6 +838,11 @@ readfile( |
| 262 | + || (using_b_fname && (old_b_fname != curbuf->b_fname)) |
| 263 | + || (fd = mch_open((char *)fname, O_RDONLY | O_EXTRA, 0)) < 0)) |
| 264 | + { |
| 265 | ++#ifdef EBCDIC |
| 266 | ++ if(fd > 0){ |
| 267 | ++ set_tag_fd(fd,NAME_CCSID_DEFAULT); |
| 268 | ++ } |
| 269 | ++#endif |
| 270 | + --no_wait_return; |
| 271 | + msg_scroll = msg_save; |
| 272 | + if (fd < 0) |
| 273 | +@@ -3825,7 +3880,6 @@ buf_write( |
| 274 | + #if defined(UNIX) |
| 275 | + int did_set_shortname; |
| 276 | + #endif |
| 277 | +- |
| 278 | + copybuf = alloc(BUFSIZE + 1); |
| 279 | + if (copybuf == NULL) |
| 280 | + { |
| 281 | +@@ -4449,6 +4503,15 @@ restore_backup: |
| 282 | + } |
| 283 | + #endif |
| 284 | + |
| 285 | ++#ifdef EBCDIC |
| 286 | ++ if(newfile == TRUE){ |
| 287 | ++ set_tag_fd(fd,NAME_CCSID_DEFAULT); |
| 288 | ++ } |
| 289 | ++ else{ |
| 290 | ++ set_tag_ccsid_fd(fd,st_old.st_tag.ft_ccsid); |
| 291 | ++ } |
| 292 | ++#endif |
| 293 | ++ |
| 294 | + write_info.bw_fd = fd; |
| 295 | + |
| 296 | + #ifdef FEAT_CRYPT |
| 297 | +@@ -4801,10 +4864,16 @@ restore_backup: |
| 298 | + } |
| 299 | + if ((fd = mch_open((char *)backup, O_RDONLY | O_EXTRA, 0)) >= 0) |
| 300 | + { |
| 301 | ++#ifdef EBCDIC |
| 302 | ++ set_tag_fd(fd,NAME_CCSID_DEFAULT); |
| 303 | ++#endif |
| 304 | + if ((write_info.bw_fd = mch_open((char *)fname, |
| 305 | + O_WRONLY | O_CREAT | O_TRUNC | O_EXTRA, |
| 306 | + perm & 0777)) >= 0) |
| 307 | + { |
| 308 | ++#ifdef EBCDIC |
| 309 | ++ set_tag_fd(write_info.bw_fd,NAME_CCSID_DEFAULT); |
| 310 | ++#endif |
| 311 | + /* copy the file. */ |
| 312 | + write_info.bw_buf = smallbuf; |
| 313 | + #ifdef HAS_BW_FLAGS |
| 314 | +@@ -6581,6 +6650,9 @@ vim_rename(char_u *from, char_u *to) |
| 315 | + #endif |
| 316 | + return -1; |
| 317 | + } |
| 318 | ++#ifdef EBCDIC |
| 319 | ++ set_tag_fd(fd_in,NAME_CCSID_DEFAULT); |
| 320 | ++#endif |
| 321 | + |
| 322 | + /* Create the new file with same permissions as the original. */ |
| 323 | + fd_out = mch_open((char *)to, |
| 324 | +@@ -6593,6 +6665,9 @@ vim_rename(char_u *from, char_u *to) |
| 325 | + #endif |
| 326 | + return -1; |
| 327 | + } |
| 328 | ++#ifdef EBCDIC |
| 329 | ++ set_tag_fd(fd_out,NAME_CCSID_DEFAULT); |
| 330 | ++#endif |
| 331 | + |
| 332 | + buffer = (char *)alloc(BUFSIZE); |
| 333 | + if (buffer == NULL) |
| 334 | +diff --git a/src/testdir/test_channel.vim b/src/testdir/test_channel.vim |
| 335 | +index eb75a0b1d..0756dd51c 100644 |
| 336 | +--- a/src/testdir/test_channel.vim |
| 337 | ++++ b/src/testdir/test_channel.vim |
| 338 | +@@ -1484,6 +1484,27 @@ func Test_raw_passes_nul() |
| 339 | + bwipe! |
| 340 | + endfunc |
| 341 | + |
| 342 | ++func MyLineCountCb(ch, msg) |
| 343 | ++ let g:linecount += 1 |
| 344 | ++endfunc |
| 345 | ++ |
| 346 | ++func Test_read_nonl_line() |
| 347 | ++ if !has('job') |
| 348 | ++ return |
| 349 | ++ endif |
| 350 | ++ |
| 351 | ++ let g:linecount = 0 |
| 352 | ++ if has('win32') |
| 353 | ++ " workaround: 'shellescape' does improper escaping double quotes |
| 354 | ++ let arg = 'import sys;sys.stdout.write(\"1\n2\n3\")' |
| 355 | ++ else |
| 356 | ++ let arg = 'import sys;sys.stdout.write("1\n2\n3")' |
| 357 | ++ endif |
| 358 | ++ call job_start([s:python, '-c', arg], {'callback': 'MyLineCountCb'}) |
| 359 | ++ call WaitFor('3 <= g:linecount') |
| 360 | ++ call assert_equal(3, g:linecount) |
| 361 | ++endfunc |
| 362 | ++ |
| 363 | + function Ch_test_close_lambda(port) |
| 364 | + let handle = ch_open('localhost:' . a:port, s:chopt) |
| 365 | + if ch_status(handle) == "fail" |
| 366 | +diff --git a/src/version.c b/src/version.c |
| 367 | +index dc8e9cf35..4fd2982a5 100644 |
| 368 | +--- a/src/version.c |
| 369 | ++++ b/src/version.c |
| 370 | +@@ -764,6 +764,8 @@ static char *(features[]) = |
| 371 | + |
| 372 | + static int included_patches[] = |
| 373 | + { /* Add new patch number below this line */ |
| 374 | ++/**/ |
| 375 | ++ 22, |
| 376 | + /**/ |
| 377 | + 21, |
| 378 | + /**/ |
0 commit comments