diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-03-11 22:52:15 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-03-11 22:52:15 +0100 |
commit | 509ce2a558e7e0c03242e32e844255af52f1c821 (patch) | |
tree | a79ac8c1e42f2f9eefa81016328194a346dade06 /src | |
parent | de27989157f35172b25f9e01e0c147ed8f6ae3ce (diff) | |
download | vim-git-509ce2a558e7e0c03242e32e844255af52f1c821.tar.gz |
patch 7.4.1537v7.4.1537
Problem: Too many feature flags for pipes, jobs and channels.
Solution: Only use FEAT_JOB_CHANNEL.
Diffstat (limited to 'src')
-rw-r--r-- | src/Make_bc5.mak | 2 | ||||
-rw-r--r-- | src/Make_cyg_ming.mak | 2 | ||||
-rw-r--r-- | src/Make_mvc.mak | 2 | ||||
-rwxr-xr-x | src/auto/configure | 2 | ||||
-rw-r--r-- | src/channel.c | 81 | ||||
-rw-r--r-- | src/config.h.in | 2 | ||||
-rw-r--r-- | src/configure.in | 2 | ||||
-rw-r--r-- | src/eval.c | 82 | ||||
-rw-r--r-- | src/feature.h | 11 | ||||
-rw-r--r-- | src/gui.c | 2 | ||||
-rw-r--r-- | src/macros.h | 2 | ||||
-rw-r--r-- | src/main.c | 2 | ||||
-rw-r--r-- | src/memline.c | 2 | ||||
-rw-r--r-- | src/misc2.c | 8 | ||||
-rw-r--r-- | src/os_mswin.c | 6 | ||||
-rw-r--r-- | src/os_unix.c | 29 | ||||
-rw-r--r-- | src/os_win32.c | 14 | ||||
-rw-r--r-- | src/proto.h | 2 | ||||
-rw-r--r-- | src/structs.h | 9 | ||||
-rw-r--r-- | src/ui.c | 2 | ||||
-rw-r--r-- | src/version.c | 6 | ||||
-rw-r--r-- | src/vim.h | 2 |
22 files changed, 72 insertions, 200 deletions
diff --git a/src/Make_bc5.mak b/src/Make_bc5.mak index 012866be1..532160f61 100644 --- a/src/Make_bc5.mak +++ b/src/Make_bc5.mak @@ -464,7 +464,7 @@ NBDEBUG_DEP = nbdebug.h nbdebug.c !endif !if ("$(CHANNEL)"=="yes") -DEFINES = $(DEFINES) -DFEAT_CHANNEL +DEFINES = $(DEFINES) -DFEAT_JOB_CHANNEL !endif !ifdef XPM diff --git a/src/Make_cyg_ming.mak b/src/Make_cyg_ming.mak index f6ab0dbbf..d6e0d0a58 100644 --- a/src/Make_cyg_ming.mak +++ b/src/Make_cyg_ming.mak @@ -529,7 +529,7 @@ endif endif ifeq ($(CHANNEL),yes) -DEFINES += -DFEAT_CHANNEL +DEFINES += -DFEAT_JOB_CHANNEL endif # DirectWrite (DirectX) diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak index 4378e0077..841dbd4ef 100644 --- a/src/Make_mvc.mak +++ b/src/Make_mvc.mak @@ -332,7 +332,7 @@ XPM_INC = -I $(XPM)\include -I $(XPM)\..\include !if "$(CHANNEL)" == "yes" CHANNEL_PRO = proto/channel.pro CHANNEL_OBJ = $(OBJDIR)/channel.obj -CHANNEL_DEFS = -DFEAT_CHANNEL +CHANNEL_DEFS = -DFEAT_JOB_CHANNEL NETBEANS_LIB = WSock32.lib !endif diff --git a/src/auto/configure b/src/auto/configure index bf0bfee19..a7082300b 100755 --- a/src/auto/configure +++ b/src/auto/configure @@ -7427,7 +7427,7 @@ if test "$enable_netbeans" = "yes"; then fi if test "$enable_channel" = "yes"; then - $as_echo "#define FEAT_CHANNEL 1" >>confdefs.h + $as_echo "#define FEAT_JOB_CHANNEL 1" >>confdefs.h CHANNEL_SRC="channel.c" diff --git a/src/channel.c b/src/channel.c index f65b31fb1..e17fc5207 100644 --- a/src/channel.c +++ b/src/channel.c @@ -12,7 +12,7 @@ #include "vim.h" -#if defined(FEAT_CHANNEL) || defined(PROTO) +#if defined(FEAT_JOB_CHANNEL) || defined(PROTO) /* TRUE when netbeans is running with a GUI. */ #ifdef FEAT_GUI @@ -294,11 +294,7 @@ add_channel(void) channel->ch_id = next_ch_id++; ch_log(channel, "Created channel"); -#ifdef CHANNEL_PIPES for (part = PART_SOCK; part <= PART_IN; ++part) -#else - part = PART_SOCK; -#endif { channel->ch_part[part].ch_fd = INVALID_FD; #ifdef FEAT_GUI_X11 @@ -330,10 +326,8 @@ add_channel(void) channel_still_useful(channel_T *channel) { int has_sock_msg; -#ifdef CHANNEL_PIPES int has_out_msg; int has_err_msg; -#endif /* If the job was killed the channel is not expected to work anymore. */ if (channel->ch_job_killed && channel->ch_job == NULL) @@ -348,24 +342,16 @@ channel_still_useful(channel_T *channel) has_sock_msg = channel->ch_part[PART_SOCK].ch_fd != INVALID_FD || channel->ch_part[PART_SOCK].ch_head.rq_next != NULL || channel->ch_part[PART_SOCK].ch_json_head.jq_next != NULL; -#ifdef CHANNEL_PIPES has_out_msg = channel->ch_part[PART_OUT].ch_fd != INVALID_FD || channel->ch_part[PART_OUT].ch_head.rq_next != NULL || channel->ch_part[PART_OUT].ch_json_head.jq_next != NULL; has_err_msg = channel->ch_part[PART_ERR].ch_fd != INVALID_FD || channel->ch_part[PART_ERR].ch_head.rq_next != NULL || channel->ch_part[PART_ERR].ch_json_head.jq_next != NULL; -#endif return (channel->ch_callback != NULL && (has_sock_msg -#ifdef CHANNEL_PIPES - || has_out_msg || has_err_msg -#endif - )) -#ifdef CHANNEL_PIPES + || has_out_msg || has_err_msg)) || (channel->ch_part[PART_OUT].ch_callback != NULL && has_out_msg) - || (channel->ch_part[PART_ERR].ch_callback != NULL && has_err_msg) -#endif - ; + || (channel->ch_part[PART_ERR].ch_callback != NULL && has_err_msg); } /* @@ -507,12 +493,10 @@ channel_gui_register(channel_T *channel) { if (channel->CH_SOCK_FD != INVALID_FD) channel_gui_register_one(channel, PART_SOCK); -# ifdef CHANNEL_PIPES if (channel->CH_OUT_FD != INVALID_FD) channel_gui_register_one(channel, PART_OUT); if (channel->CH_ERR_FD != INVALID_FD) channel_gui_register_one(channel, PART_ERR); -# endif } /* @@ -557,14 +541,8 @@ channel_gui_unregister(channel_T *channel) { int part; -#ifdef CHANNEL_PIPES for (part = PART_SOCK; part < PART_IN; ++part) -#else - part = PART_SOCK; -#endif - { channel_gui_unregister_one(channel, part); - } } #endif @@ -842,7 +820,6 @@ channel_open( return channel; } -#if defined(CHANNEL_PIPES) || defined(PROTO) static void may_close_part(sock_T *fd) { @@ -884,7 +861,6 @@ channel_set_pipes(channel_T *channel, sock_T in, sock_T out, sock_T err) # endif } } -#endif /* * Sets the job the channel is associated with and associated options. @@ -1897,10 +1873,7 @@ may_invoke_callback(channel_T *channel, int part) channel_can_write_to(channel_T *channel) { return channel != NULL && (channel->CH_SOCK_FD != INVALID_FD -#ifdef CHANNEL_PIPES - || channel->CH_IN_FD != INVALID_FD -#endif - ); + || channel->CH_IN_FD != INVALID_FD); } /* @@ -1911,12 +1884,9 @@ channel_can_write_to(channel_T *channel) channel_is_open(channel_T *channel) { return channel != NULL && (channel->CH_SOCK_FD != INVALID_FD -#ifdef CHANNEL_PIPES || channel->CH_IN_FD != INVALID_FD || channel->CH_OUT_FD != INVALID_FD - || channel->CH_ERR_FD != INVALID_FD -#endif - ); + || channel->CH_ERR_FD != INVALID_FD); } /* @@ -1951,11 +1921,9 @@ channel_close(channel_T *channel, int invoke_close_cb) sock_close(channel->CH_SOCK_FD); channel->CH_SOCK_FD = INVALID_FD; } -#if defined(CHANNEL_PIPES) may_close_part(&channel->CH_IN_FD); may_close_part(&channel->CH_OUT_FD); may_close_part(&channel->CH_ERR_FD); -#endif if (invoke_close_cb && channel->ch_close_cb != NULL) { @@ -2036,10 +2004,8 @@ channel_clear(channel_T *channel) { ch_log(channel, "Clearing channel"); channel_clear_one(channel, PART_SOCK); -#ifdef CHANNEL_PIPES channel_clear_one(channel, PART_OUT); channel_clear_one(channel, PART_ERR); -#endif vim_free(channel->ch_callback); channel->ch_callback = NULL; vim_free(channel->ch_close_cb); @@ -2357,11 +2323,7 @@ channel_fd2channel(sock_T fd, int *partp) for (channel = first_channel; channel != NULL; channel = channel->ch_next) { -# ifdef CHANNEL_PIPES for (part = PART_SOCK; part < PART_IN; ++part) -# else - part = PART_SOCK; -# endif if (channel->ch_part[part].ch_fd == fd) { *partp = part; @@ -2386,13 +2348,8 @@ channel_handle_events(void) for (channel = first_channel; channel != NULL; channel = channel->ch_next) { -# ifdef CHANNEL_PIPES /* check the socket and pipes */ for (part = PART_SOCK; part <= PART_ERR; ++part) -# else - /* only check the socket */ - part = PART_SOCK; -# endif { fd = channel->ch_part[part].ch_fd; if (fd != INVALID_FD && channel_wait(channel, fd, 0) == OK) @@ -2471,11 +2428,7 @@ channel_poll_setup(int nfd_in, void *fds_in) for (channel = first_channel; channel != NULL; channel = channel->ch_next) { -# ifdef CHANNEL_PIPES for (part = PART_SOCK; part < PART_IN; ++part) -# else - part = PART_SOCK; -# endif { if (channel->ch_part[part].ch_fd != INVALID_FD) { @@ -2505,11 +2458,7 @@ channel_poll_check(int ret_in, void *fds_in) for (channel = first_channel; channel != NULL; channel = channel->ch_next) { -# ifdef CHANNEL_PIPES for (part = PART_SOCK; part < PART_IN; ++part) -# else - part = PART_SOCK; -# endif { int idx = channel->ch_part[part].ch_poll_idx; @@ -2539,11 +2488,7 @@ channel_select_setup(int maxfd_in, void *rfds_in) for (channel = first_channel; channel != NULL; channel = channel->ch_next) { -# ifdef CHANNEL_PIPES for (part = PART_SOCK; part < PART_IN; ++part) -# else - part = PART_SOCK; -# endif { sock_T fd = channel->ch_part[part].ch_fd; @@ -2572,11 +2517,7 @@ channel_select_check(int ret_in, void *rfds_in) for (channel = first_channel; channel != NULL; channel = channel->ch_next) { -# ifdef CHANNEL_PIPES for (part = PART_SOCK; part < PART_IN; ++part) -# else - part = PART_SOCK; -# endif { sock_T fd = channel->ch_part[part].ch_fd; @@ -2657,11 +2598,9 @@ channel_parse_messages(void) continue; } } -#ifdef CHANNEL_PIPES if (part < PART_ERR) ++part; else -#endif { channel = channel->ch_next; part = PART_SOCK; @@ -2692,11 +2631,7 @@ set_ref_in_channel(int copyID) for (channel = first_channel; channel != NULL; channel = channel->ch_next) { -#ifdef CHANNEL_PIPES for (part = PART_SOCK; part < PART_IN; ++part) -#else - part = PART_SOCK; -#endif { jsonq_T *head = &channel->ch_part[part].ch_json_head; jsonq_T *item = head->jq_next; @@ -2723,10 +2658,8 @@ set_ref_in_channel(int copyID) int channel_part_send(channel_T *channel) { -#ifdef CHANNEL_PIPES if (channel->CH_SOCK_FD == INVALID_FD) return PART_IN; -#endif return PART_SOCK; } @@ -2736,10 +2669,8 @@ channel_part_send(channel_T *channel) int channel_part_read(channel_T *channel) { -#ifdef CHANNEL_PIPES if (channel->CH_SOCK_FD == INVALID_FD) return PART_OUT; -#endif return PART_SOCK; } @@ -2764,4 +2695,4 @@ channel_get_timeout(channel_T *channel, int part) return channel->ch_part[part].ch_timeout; } -#endif /* FEAT_CHANNEL */ +#endif /* FEAT_JOB_CHANNEL */ diff --git a/src/config.h.in b/src/config.h.in index f8475a14f..9d35e48fa 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -432,7 +432,7 @@ #undef FEAT_NETBEANS_INTG /* Define if you want to include process communication. */ -#undef FEAT_CHANNEL +#undef FEAT_JOB_CHANNEL /* Define default global runtime path */ #undef RUNTIME_GLOBAL diff --git a/src/configure.in b/src/configure.in index b618b8c36..f29b62c1f 100644 --- a/src/configure.in +++ b/src/configure.in @@ -2014,7 +2014,7 @@ if test "$enable_netbeans" = "yes"; then AC_SUBST(NETBEANS_OBJ) fi if test "$enable_channel" = "yes"; then - AC_DEFINE(FEAT_CHANNEL) + AC_DEFINE(FEAT_JOB_CHANNEL) CHANNEL_SRC="channel.c" AC_SUBST(CHANNEL_SRC) CHANNEL_OBJ="objects/channel.o" diff --git a/src/eval.c b/src/eval.c index f3ebaa5e0..e78bbb067 100644 --- a/src/eval.c +++ b/src/eval.c @@ -496,14 +496,12 @@ static void f_call(typval_T *argvars, typval_T *rettv); #ifdef FEAT_FLOAT static void f_ceil(typval_T *argvars, typval_T *rettv); #endif -#ifdef FEAT_CHANNEL +#ifdef FEAT_JOB_CHANNEL static void f_ch_close(typval_T *argvars, typval_T *rettv); static void f_ch_evalexpr(typval_T *argvars, typval_T *rettv); static void f_ch_evalraw(typval_T *argvars, typval_T *rettv); static void f_ch_getbufnr(typval_T *argvars, typval_T *rettv); -# ifdef FEAT_JOB static void f_ch_getjob(typval_T *argvars, typval_T *rettv); -# endif static void f_ch_log(typval_T *argvars, typval_T *rettv); static void f_ch_logfile(typval_T *argvars, typval_T *rettv); static void f_ch_open(typval_T *argvars, typval_T *rettv); @@ -632,10 +630,8 @@ static void f_islocked(typval_T *argvars, typval_T *rettv); static void f_isnan(typval_T *argvars, typval_T *rettv); #endif static void f_items(typval_T *argvars, typval_T *rettv); -#ifdef FEAT_JOB -# ifdef FEAT_CHANNEL +#ifdef FEAT_JOB_CHANNEL static void f_job_getchannel(typval_T *argvars, typval_T *rettv); -# endif static void f_job_setoptions(typval_T *argvars, typval_T *rettv); static void f_job_start(typval_T *argvars, typval_T *rettv); static void f_job_stop(typval_T *argvars, typval_T *rettv); @@ -6236,11 +6232,11 @@ tv_equal( return tv1->vval.v_float == tv2->vval.v_float; #endif case VAR_JOB: -#ifdef FEAT_JOB +#ifdef FEAT_JOB_CHANNEL return tv1->vval.v_job == tv2->vval.v_job; #endif case VAR_CHANNEL: -#ifdef FEAT_CHANNEL +#ifdef FEAT_JOB_CHANNEL return tv1->vval.v_channel == tv2->vval.v_channel; #endif case VAR_UNKNOWN: @@ -6926,7 +6922,7 @@ garbage_collect(void) abort = abort || set_ref_in_python3(copyID); #endif -#ifdef FEAT_CHANNEL +#ifdef FEAT_JOB_CHANNEL abort = abort || set_ref_in_channel(copyID); #endif @@ -7738,7 +7734,7 @@ failret: return OK; } -#if defined(FEAT_CHANNEL) || defined(PROTO) +#if defined(FEAT_JOB_CHANNEL) || defined(PROTO) /* * Decrement the reference count on "channel" and maybe free it when it goes * down to zero. Don't free it if there is a pending action. @@ -7751,15 +7747,12 @@ channel_unref(channel_T *channel) return channel_may_free(channel); return FALSE; } -#endif -#if defined(FEAT_JOB) || defined(PROTO) static job_T *first_job = NULL; static void job_free(job_T *job) { -# ifdef FEAT_CHANNEL ch_log(job->jv_channel, "Freeing job"); if (job->jv_channel != NULL) { @@ -7771,7 +7764,6 @@ job_free(job_T *job) job->jv_channel->ch_job = NULL; channel_unref(job->jv_channel); } -# endif mch_clear_job(job); if (job->jv_next != NULL) @@ -7798,7 +7790,6 @@ job_unref(job_T *job) { job_free(job); } -# ifdef FEAT_CHANNEL else if (job->jv_channel != NULL) { /* Do remove the link to the channel, otherwise it hangs @@ -7807,7 +7798,6 @@ job_unref(job_T *job) channel_unref(job->jv_channel); job->jv_channel = NULL; } -# endif } } @@ -8204,14 +8194,12 @@ static struct fst #ifdef FEAT_FLOAT {"ceil", 1, 1, f_ceil}, #endif -#ifdef FEAT_CHANNEL +#ifdef FEAT_JOB_CHANNEL {"ch_close", 1, 1, f_ch_close}, {"ch_evalexpr", 2, 3, f_ch_evalexpr}, {"ch_evalraw", 2, 3, f_ch_evalraw}, {"ch_getbufnr", 2, 2, f_ch_getbufnr}, -# ifdef FEAT_JOB {"ch_getjob", 1, 1, f_ch_getjob}, -# endif {"ch_log", 1, 2, f_ch_log}, {"ch_logfile", 1, 2, f_ch_logfile}, {"ch_open", 1, 2, f_ch_open}, @@ -8344,10 +8332,8 @@ static struct fst {"isnan", 1, 1, f_isnan}, #endif {"items", 1, 1, f_items}, -#ifdef FEAT_JOB -# ifdef FEAT_CHANNEL +#ifdef FEAT_JOB_CHANNEL {"job_getchannel", 1, 1, f_job_getchannel}, -# endif {"job_setoptions", 2, 2, f_job_setoptions}, {"job_start", 1, 2, f_job_start}, {"job_status", 1, 1, f_job_status}, @@ -9955,7 +9941,7 @@ f_ceil(typval_T *argvars, typval_T *rettv) } #endif -#if defined(FEAT_CHANNEL) || defined(FEAT_JOB) +#if defined(FEAT_JOB_CHANNEL) /* * Get a callback from "arg". It can be a Funcref or a function name. * When "arg" is zero return an empty string. @@ -10312,7 +10298,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported) } #endif -#ifdef FEAT_CHANNEL +#ifdef FEAT_JOB_CHANNEL /* * Get the channel from the argument. * Returns NULL if the handle is invalid. @@ -10387,7 +10373,6 @@ f_ch_getbufnr(typval_T *argvars, typval_T *rettv) } } -# ifdef FEAT_JOB /* * "ch_getjob()" function */ @@ -10404,7 +10389,6 @@ f_ch_getjob(typval_T *argvars, typval_T *rettv) ++channel->ch_job->jv_refcount; } } -# endif /* * "ch_log()" function @@ -11427,13 +11411,13 @@ f_empty(typval_T *argvars, typval_T *rettv) break; case VAR_JOB: -#ifdef FEAT_JOB +#ifdef FEAT_JOB_CHANNEL n = argvars[0].vval.v_job == NULL || argvars[0].vval.v_job->jv_status != JOB_STARTED; break; #endif case VAR_CHANNEL: -#ifdef FEAT_CHANNEL +#ifdef FEAT_JOB_CHANNEL n = argvars[0].vval.v_channel == NULL || !channel_is_open(argvars[0].vval.v_channel); break; @@ -13815,7 +13799,7 @@ f_has(typval_T *argvars, typval_T *rettv) #ifdef FEAT_BYTEOFF "byte_offset", #endif -#ifdef FEAT_CHANNEL +#ifdef FEAT_JOB_CHANNEL "channel", #endif #ifdef FEAT_CINDENT @@ -13951,7 +13935,7 @@ f_has(typval_T *argvars, typval_T *rettv) #ifdef FEAT_INS_EXPAND "insert_expand", #endif -#ifdef FEAT_JOB +#ifdef FEAT_JOB_CHANNEL "job", #endif #ifdef FEAT_JUMPLIST @@ -15092,7 +15076,7 @@ f_items(typval_T *argvars, typval_T *rettv) dict_list(argvars, rettv, 2); } -#if defined(FEAT_JOB) || defined(PROTO) +#if defined(FEAT_JOB_CHANNEL) || defined(PROTO) /* * Get the job from the argument. * Returns NULL if the job is invalid. @@ -15114,7 +15098,6 @@ get_job_arg(typval_T *tv) return job; } -# ifdef FEAT_CHANNEL /* * "job_getchannel()" function */ @@ -15131,7 +15114,6 @@ f_job_getchannel(typval_T *argvars, typval_T *rettv) ++job->jv_channel->ch_refcount; } } -# endif /* * "job_setoptions()" function @@ -15298,7 +15280,6 @@ f_job_start(typval_T *argvars, typval_T *rettv) } #ifdef USE_ARGV -# ifdef FEAT_CHANNEL if (ch_log_active()) { garray_T ga; @@ -15314,20 +15295,15 @@ f_job_start(typval_T *argvars, typval_T *rettv) ch_logs(NULL, "Starting job: %s", (char *)ga.ga_data); ga_clear(&ga); } -# endif mch_start_job(argv, job, &opt); #else -# ifdef FEAT_CHANNEL ch_logs(NULL, "Starting job: %s", (char *)cmd); -# endif mch_start_job((char *)cmd, job, &opt); #endif -#ifdef FEAT_CHANNEL /* If the channel is reading from a buffer, write lines now. */ if (job->jv_channel != NULL) channel_write_in(job->jv_channel); -#endif theend: #ifdef USE_ARGV @@ -15354,10 +15330,8 @@ job_status(job_T *job) else { result = mch_job_status(job); -# ifdef FEAT_CHANNEL if (job->jv_status == JOB_ENDED) ch_log(job->jv_channel, "Job ended"); -# endif if (job->jv_status == JOB_ENDED && job->jv_exit_cb != NULL) { typval_T argv[3]; @@ -15450,9 +15424,7 @@ f_job_stop(typval_T *argvars UNUSED, typval_T *rettv UNUSED) return; } } -# ifdef FEAT_CHANNEL ch_logs(job->jv_channel, "Stopping job with '%s'", (char *)arg); -# endif if (mch_stop_job(job, arg) == FAIL) rettv->vval.v_number = 0; else @@ -22414,12 +22386,12 @@ free_tv(typval_T *varp) dict_unref(varp->vval.v_dict); break; case VAR_JOB: -#ifdef FEAT_JOB +#ifdef FEAT_JOB_CHANNEL job_unref(varp->vval.v_job); break; #endif case VAR_CHANNEL: -#ifdef FEAT_CHANNEL +#ifdef FEAT_JOB_CHANNEL channel_unref(varp->vval.v_channel); break; #endif @@ -22468,13 +22440,13 @@ clear_tv(typval_T *varp) break; #endif case VAR_JOB: -#ifdef FEAT_JOB +#ifdef FEAT_JOB_CHANNEL job_unref(varp->vval.v_job); varp->vval.v_job = NULL; #endif break; case VAR_CHANNEL: -#ifdef FEAT_CHANNEL +#ifdef FEAT_JOB_CHANNEL channel_unref(varp->vval.v_channel); varp->vval.v_channel = NULL; #endif @@ -22543,12 +22515,12 @@ get_tv_number_chk(typval_T *varp, int *denote) return varp->vval.v_number == VVAL_TRUE ? 1 : 0; break; case VAR_JOB: -#ifdef FEAT_JOB +#ifdef FEAT_JOB_CHANNEL EMSG(_("E910: Using a Job as a Number")); break; #endif case VAR_CHANNEL: -#ifdef FEAT_CHANNEL +#ifdef FEAT_JOB_CHANNEL EMSG(_("E913: Using a Channel as a Number")); break; #endif @@ -22589,12 +22561,12 @@ get_tv_float(typval_T *varp) EMSG(_("E907: Using a special value as a Float")); break; case VAR_JOB: -# ifdef FEAT_JOB +# ifdef FEAT_JOB_CHANNEL EMSG(_("E911: Using a Job as a Float")); break; # endif case VAR_CHANNEL: -# ifdef FEAT_CHANNEL +# ifdef FEAT_JOB_CHANNEL EMSG(_("E914: Using a Channel as a Float")); break; # endif @@ -22711,7 +22683,7 @@ get_tv_string_buf_chk(typval_T *varp, char_u *buf) STRCPY(buf, get_var_special_name(varp->vval.v_number)); return buf; case VAR_JOB: -#ifdef FEAT_JOB +#ifdef FEAT_JOB_CHANNEL { job_T *job = varp->vval.v_job; char *status; @@ -22738,7 +22710,7 @@ get_tv_string_buf_chk(typval_T *varp, char_u *buf) #endif break; case VAR_CHANNEL: -#ifdef FEAT_CHANNEL +#ifdef FEAT_JOB_CHANNEL { channel_T *channel = varp->vval.v_channel; char *status = channel_status(channel); @@ -23377,14 +23349,14 @@ copy_tv(typval_T *from, typval_T *to) break; #endif case VAR_JOB: -#ifdef FEAT_JOB +#ifdef FEAT_JOB_CHANNEL to->vval.v_job = from->vval.v_job; if (to->vval.v_job != NULL) ++to->vval.v_job->jv_refcount; break; #endif case VAR_CHANNEL: -#ifdef FEAT_CHANNEL +#ifdef FEAT_JOB_CHANNEL to->vval.v_channel = from->vval.v_channel; if (to->vval.v_channel != NULL) ++to->vval.v_channel->ch_refcount; diff --git a/src/feature.h b/src/feature.h index f75322756..957bbf27d 100644 --- a/src/feature.h +++ b/src/feature.h @@ -1250,15 +1250,8 @@ /* * The +channel feature requires +eval. */ -#if !defined(FEAT_EVAL) && defined(FEAT_CHANNEL) -# undef FEAT_CHANNEL -#endif - -/* - * The +job feature requires +eval and Unix or MS-Windows. - */ -#if (defined(UNIX) || defined(WIN32)) && defined(FEAT_EVAL) -# define FEAT_JOB +#if !defined(FEAT_EVAL) && defined(FEAT_JOB_CHANNEL) +# undef FEAT_JOB_CHANNEL #endif /* @@ -4949,7 +4949,7 @@ ex_gui(exarg_T *eap) * of the argument ending up after the shell prompt. */ msg_clr_eos_force(); gui_start(); -#ifdef FEAT_CHANNEL +#ifdef FEAT_JOB_CHANNEL channel_gui_register_all(); #endif } diff --git a/src/macros.h b/src/macros.h index 7b7b17d1a..ca54cb42e 100644 --- a/src/macros.h +++ b/src/macros.h @@ -317,7 +317,7 @@ # define PLINES_NOFILL(x) plines(x) #endif -#if defined(FEAT_CHANNEL) || defined(FEAT_JOB) || defined(FEAT_CLIENTSERVER) +#if defined(FEAT_JOB_CHANNEL) || defined(FEAT_CLIENTSERVER) # define MESSAGE_QUEUE #endif diff --git a/src/main.c b/src/main.c index a7bc9e9a7..076898c34 100644 --- a/src/main.c +++ b/src/main.c @@ -1488,7 +1488,7 @@ getout(int exitval) windgoto((int)Rows - 1, 0); #endif -#ifdef FEAT_JOB +#ifdef FEAT_JOB_CHANNEL job_stop_on_exit(); #endif #ifdef FEAT_LUA diff --git a/src/memline.c b/src/memline.c index 334392b36..1c2ddbf7b 100644 --- a/src/memline.c +++ b/src/memline.c @@ -3059,7 +3059,7 @@ ml_append_int( (char_u *)"\n", 1); } #endif -#ifdef FEAT_CHANNEL +#ifdef FEAT_JOB_CHANNEL if (buf->b_write_to_channel) channel_write_new_lines(buf); #endif diff --git a/src/misc2.c b/src/misc2.c index 48acde8b6..e247a92ac 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -1127,7 +1127,7 @@ free_all_mem(void) # ifdef FEAT_DIFF diff_clear(curtab); # endif -# ifdef FEAT_CHANNEL +# ifdef FEAT_JOB_CHANNEL channel_free_all(); # endif clear_sb_text(); /* free any scrollback text */ @@ -6221,7 +6221,7 @@ has_non_ascii(char_u *s) parse_queued_messages(void) { /* For Win32 mch_breakcheck() does not check for input, do it here. */ -# if defined(WIN32) && defined(FEAT_CHANNEL) +# if defined(WIN32) && defined(FEAT_JOB_CHANNEL) channel_handle_events(); # endif @@ -6229,7 +6229,7 @@ parse_queued_messages(void) /* Process the queued netbeans messages. */ netbeans_parse_messages(); # endif -# ifdef FEAT_CHANNEL +# ifdef FEAT_JOB_CHANNEL /* Process the messages queued on channels. */ channel_parse_messages(); # endif @@ -6237,7 +6237,7 @@ parse_queued_messages(void) /* Process the queued clientserver messages. */ server_parse_messages(); # endif -# ifdef FEAT_JOB +# ifdef FEAT_JOB_CHANNEL /* Check if any jobs have ended. */ job_check_ended(); # endif diff --git a/src/os_mswin.c b/src/os_mswin.c index 46b3780c4..2a80381a0 100644 --- a/src/os_mswin.c +++ b/src/os_mswin.c @@ -144,7 +144,7 @@ extern HWND s_hwnd; static HWND s_hwnd = 0; /* console window handle, set by GetConsoleHwnd() */ #endif -#ifdef FEAT_CHANNEL +#ifdef FEAT_JOB_CHANNEL int WSInitialized = FALSE; /* WinSock is initialized */ #endif @@ -216,7 +216,7 @@ mch_exit(int r) # ifdef FEAT_OLE UninitOLE(); # endif -# ifdef FEAT_CHANNEL +# ifdef FEAT_JOB_CHANNEL if (WSInitialized) { WSInitialized = FALSE; @@ -3018,7 +3018,7 @@ theend: #endif /* defined(FEAT_GUI) || defined(FEAT_PRINTER) */ -#if defined(FEAT_CHANNEL) || defined(PROTO) +#if defined(FEAT_JOB_CHANNEL) || defined(PROTO) /* * Initialize the Winsock dll. */ diff --git a/src/os_unix.c b/src/os_unix.c index 8a611666f..f2ae513cf 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -3919,7 +3919,7 @@ wait4pid(pid_t child, waitstatus *status) return wait_pid; } -#if defined(FEAT_JOB) || !defined(USE_SYSTEM) || defined(PROTO) +#if defined(FEAT_JOB_CHANNEL) || !defined(USE_SYSTEM) || defined(PROTO) /* * Parse "cmd" and put the white-separated parts in "argv". * "argv" is an allocated array with "argc" entries. @@ -3984,7 +3984,7 @@ mch_parse_cmd(char_u *cmd, int use_shcf, char ***argv, int *argc) } #endif -#if !defined(USE_SYSTEM) || defined(FEAT_JOB) +#if !defined(USE_SYSTEM) || defined(FEAT_JOB_CHANNEL) static void set_child_environment(void) { @@ -5035,12 +5035,11 @@ error: #endif /* USE_SYSTEM */ } -#if defined(FEAT_JOB) || defined(PROTO) +#if defined(FEAT_JOB_CHANNEL) || defined(PROTO) void mch_start_job(char **argv, job_T *job, jobopt_T *options UNUSED) { pid_t pid; -# ifdef FEAT_CHANNEL int fd_in[2]; /* for stdin */ int fd_out[2]; /* for stdout */ int fd_err[2]; /* for stderr */ @@ -5122,7 +5121,6 @@ mch_start_job(char **argv, job_T *job, jobopt_T *options UNUSED) if (channel == NULL) goto failed; } -# endif pid = fork(); /* maybe we should use vfork() */ if (pid == -1) @@ -5133,9 +5131,7 @@ mch_start_job(char **argv, job_T *job, jobopt_T *options UNUSED) if (pid == 0) { -# ifdef FEAT_CHANNEL int null_fd = -1; -# endif /* child */ reset_signals(); /* handle signals normally */ @@ -5149,8 +5145,6 @@ mch_start_job(char **argv, job_T *job, jobopt_T *options UNUSED) set_child_environment(); - /* TODO: re-enable this when pipes connect without a channel */ -# ifdef FEAT_CHANNEL if (use_null_for_in || use_null_for_out || use_null_for_err) null_fd = open("/dev/null", O_RDWR | O_EXTRA, 0); @@ -5205,7 +5199,6 @@ mch_start_job(char **argv, job_T *job, jobopt_T *options UNUSED) } if (null_fd >= 0) close(null_fd); -# endif /* See above for type of argv. */ execvp(argv[0], argv); @@ -5217,11 +5210,8 @@ mch_start_job(char **argv, job_T *job, jobopt_T *options UNUSED) /* parent */ job->jv_pid = pid; job->jv_status = JOB_STARTED; -# ifdef FEAT_CHANNEL job->jv_channel = channel; /* ch_refcount was set above */ -# endif -# ifdef FEAT_CHANNEL /* child stdin, stdout and stderr */ if (!use_file_for_in) close(fd_in[0]); @@ -5240,13 +5230,11 @@ mch_start_job(char **argv, job_T *job, jobopt_T *options UNUSED) ? INVALID_FD : fd_err[0]); channel_set_job(channel, job, options); } -# endif /* success! */ return; -failed: ; -# ifdef FEAT_CHANNEL +failed: channel_unref(channel); if (fd_in[0] >= 0) close(fd_in[0]); @@ -5260,7 +5248,6 @@ failed: ; close(fd_err[0]); if (fd_err[1] >= 0) close(fd_err[1]); -# endif } char * @@ -5560,7 +5547,7 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED) nfd++; } # endif -#ifdef FEAT_CHANNEL +#ifdef FEAT_JOB_CHANNEL nfd = channel_poll_setup(nfd, &fds); #endif @@ -5608,7 +5595,7 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED) finished = FALSE; /* Try again */ } # endif -#ifdef FEAT_CHANNEL +#ifdef FEAT_JOB_CHANNEL if (ret > 0) ret = channel_poll_check(ret, &fds); #endif @@ -5690,7 +5677,7 @@ select_eintr: maxfd = xsmp_icefd; } # endif -# ifdef FEAT_CHANNEL +# ifdef FEAT_JOB_CHANNEL maxfd = channel_select_setup(maxfd, &rfds); # endif @@ -5772,7 +5759,7 @@ select_eintr: } } # endif -#ifdef FEAT_CHANNEL +#ifdef FEAT_JOB_CHANNEL if (ret > 0) ret = channel_select_check(ret, &rfds); #endif diff --git a/src/os_win32.c b/src/os_win32.c index 49fd0f703..d7b563459 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -1492,7 +1492,7 @@ WaitForChar(long msec) { DWORD dwWaitTime = dwEndTime - dwNow; -#ifdef FEAT_CHANNEL +#ifdef FEAT_JOB_CHANNEL /* Check channel while waiting input. */ if (dwWaitTime > 100) dwWaitTime = 100; @@ -4991,7 +4991,7 @@ mch_call_shell( return x; } -#if defined(FEAT_JOB) || defined(PROTO) +#if defined(FEAT_JOB_CHANNEL) || defined(PROTO) static HANDLE job_io_file_open( char_u *fname, @@ -5033,7 +5033,6 @@ mch_start_job(char *cmd, job_T *job, jobopt_T *options) STARTUPINFO si; PROCESS_INFORMATION pi; HANDLE jo; -# ifdef FEAT_CHANNEL SECURITY_ATTRIBUTES saAttr; channel_T *channel = NULL; HANDLE ifd[2]; @@ -5057,7 +5056,6 @@ mch_start_job(char *cmd, job_T *job, jobopt_T *options) ofd[1] = INVALID_HANDLE_VALUE; efd[0] = INVALID_HANDLE_VALUE; efd[1] = INVALID_HANDLE_VALUE; -# endif jo = CreateJobObject(NULL, NULL); if (jo == NULL) @@ -5072,7 +5070,6 @@ mch_start_job(char *cmd, job_T *job, jobopt_T *options) si.dwFlags |= STARTF_USESHOWWINDOW; si.wShowWindow = SW_HIDE; -# ifdef FEAT_CHANNEL saAttr.nLength = sizeof(SECURITY_ATTRIBUTES); saAttr.bInheritHandle = TRUE; saAttr.lpSecurityDescriptor = NULL; @@ -5149,7 +5146,6 @@ mch_start_job(char *cmd, job_T *job, jobopt_T *options) if (channel == NULL) goto failed; } -# endif if (!vim_create_process(cmd, TRUE, CREATE_SUSPENDED | @@ -5176,7 +5172,6 @@ mch_start_job(char *cmd, job_T *job, jobopt_T *options) job->jv_job_object = jo; job->jv_status = JOB_STARTED; -# ifdef FEAT_CHANNEL if (!use_file_for_in) CloseHandle(ifd[0]); if (!use_file_for_out) @@ -5196,11 +5191,9 @@ mch_start_job(char *cmd, job_T *job, jobopt_T *options) ? INVALID_FD : (sock_T)efd[0]); channel_set_job(channel, job, options); } -# endif return; failed: -# ifdef FEAT_CHANNEL CloseHandle(ifd[0]); CloseHandle(ofd[0]); CloseHandle(efd[0]); @@ -5208,9 +5201,6 @@ failed: CloseHandle(ofd[1]); CloseHandle(efd[1]); channel_unref(channel); -# else - ; /* make compiler happy */ -# endif } char * diff --git a/src/proto.h b/src/proto.h index 7e4180b7d..d975f924d 100644 --- a/src/proto.h +++ b/src/proto.h @@ -193,7 +193,7 @@ void qsort(void *base, size_t elm_count, size_t elm_size, int (*cmp)(const void # ifdef FEAT_NETBEANS_INTG # include "netbeans.pro" # endif -# ifdef FEAT_CHANNEL +# ifdef FEAT_JOB_CHANNEL # include "channel.pro" # endif diff --git a/src/structs.h b/src/structs.h index 9ccc09a12..6bf21263a 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1147,10 +1147,8 @@ typedef struct char_u *v_string; /* string value (can be NULL!) */ list_T *v_list; /* list value (can be NULL!) */ dict_T *v_dict; /* dict value (can be NULL!) */ -#ifdef FEAT_JOB +#ifdef FEAT_JOB_CHANNEL job_T *v_job; /* job value (can be NULL!) */ -#endif -#ifdef FEAT_CHANNEL channel_T *v_channel; /* channel value (can be NULL!) */ #endif } vval; @@ -1312,8 +1310,7 @@ typedef enum #define PART_SOCK 0 #define CH_SOCK_FD ch_part[PART_SOCK].ch_fd -#if defined(UNIX) || defined(WIN32) -# define CHANNEL_PIPES +#ifdef FEAT_JOB_CHANNEL # define INVALID_FD (-1) # define PART_OUT 1 @@ -2057,7 +2054,7 @@ struct file_buffer int b_netbeans_file; /* TRUE when buffer is owned by NetBeans */ int b_was_netbeans_file;/* TRUE if b_netbeans_file was once set */ #endif -#ifdef FEAT_CHANNEL +#ifdef FEAT_JOB_CHANNEL int b_write_to_channel; /* TRUE when appended lines are written to * a channel. */ #endif @@ -1531,7 +1531,7 @@ clip_gen_owner_exists(VimClipboard *cbd UNUSED) * descriptions which would otherwise overflow. The buffer is considered full * when only this extra space (or part of it) remains. */ -#if defined(FEAT_SUN_WORKSHOP) || defined(FEAT_CHANNEL) \ +#if defined(FEAT_SUN_WORKSHOP) || defined(FEAT_JOB_CHANNEL) \ || defined(FEAT_CLIENTSERVER) /* * Sun WorkShop and NetBeans stuff debugger commands into the input buffer. diff --git a/src/version.c b/src/version.c index 4f6c51d60..c290b5040 100644 --- a/src/version.c +++ b/src/version.c @@ -106,7 +106,7 @@ static char *(features[]) = #else "-byte_offset", #endif -#ifdef FEAT_CHANNEL +#ifdef FEAT_JOB_CHANNEL "+channel", #else "-channel", @@ -289,7 +289,7 @@ static char *(features[]) = #else "-insert_expand", #endif -#ifdef FEAT_JOB +#ifdef FEAT_JOB_CHANNEL "+job", #else "-job", @@ -744,6 +744,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1537, +/**/ 1536, /**/ 1535, @@ -2273,7 +2273,7 @@ typedef int VimClipboard; /* This is required for the prototypes. */ # define SET_NO_HLSEARCH(flag) no_hlsearch = (flag) #endif -#ifdef FEAT_CHANNEL +#ifdef FEAT_JOB_CHANNEL # define MAX_OPEN_CHANNELS 10 #else # define MAX_OPEN_CHANNELS 0 |