this file is the patch to add feature Process Interaction to Vim.
base on Vim-7.2.108.

THIS FILE IS UNSTABLE!! AND ONLY ON WINDOWS NOW!!

made by StarWing <weasley_wx AT qq DOT com>


changed:
        eval.txt (for functions added)
        feature.h (add a new feature)
        if_proc.c (main file, implement Process Interaction on Windows)
        main.c (some clear work)
        makefile (mvc and ming)
        options.c & options.h (a new option)
        proto.h (add if_proc.pro file included)

        other file is just patch ( some have GCC warnings, use minGW 3.4.5 -
Wall )

patch a bug of readfile(), it can't read oneline-file on Windows. now
i draw
out some code for common use ( if_proc add a function acted like
readfile() ).
and change one line.

it can be maked by VC2005 and minGW3.4.5 now , i didn't have borland
C :-(

some bug and todo list:

------------

it only run on Windows now. Unix-version is developing.

it can't hold sh.exe's prompt output ($PS1), which is should be
stderr, but i
already hand the stderr. it's inexplicability... and it can't hold the
output
of programs sh.exe executes. and it's a little slow for sh.exe (one
word, it
act terrible on sh.exe).

i didn't test it with gdb, but it works well with cscope (because this
interface is based on if_cscope...)

i think i should add timer-support. i won't use SetTimer, because it
requires
GUI support. i can't use multi-thread, because it complex and slow,
and there
are no signal on windows... this is a big problem (sh is slow, if we
can add a
autocmd to notice whether the new message come from sh.exe, i think
it's good)

in one word, we have still a lot of work to do. after the develop of
interface
, we must implement vimshell and vimgdb with this interface. but after
all
work completed, you see, you can add any support for other program.
just write
a vim script!

if any one want to work together with me, email to me (weasley_wx AT
qq DOT
com).

------------------------------------------------------------------------------
diff -cdrN ../vim-7.2.108/src/Make_ming.mak src/Make_ming.mak
*** ../vim-7.2.108/src/Make_ming.mak    Sat Aug  9 18:29:26 2008
--- src/Make_ming.mak   Thu Feb 26 03:50:59 2009
***************
*** 52,57 ****
--- 52,59 ----
  WINVER = 0x0400
  # Set to yes to enable Cscope support
  CSCOPE=yes
+ # Set to yes to enable Process Interaction support
+ PROC=yes
  # Set to yes to enable Netbeans support
  NETBEANS=$(GUI)

***************
*** 317,322 ****
--- 319,328 ----
  DEFINES += -DFEAT_CSCOPE
  endif

+ ifeq ($(PROC),yes)
+ DEFINES += -DFEAT_PROC
+ endif
+
  ifeq ($(NETBEANS),yes)
  # Only allow NETBEANS for a GUI build.
  ifeq (yes, $(GUI))
***************
*** 422,427 ****
--- 428,436 ----
  endif
  ifeq ($(CSCOPE),yes)
  OBJ += $(OUTDIR)/if_cscope.o
+ endif
+ ifeq ($(PROC),yes)
+ OBJ += $(OUTDIR)/if_proc.o
  endif
  ifeq ($(NETBEANS),yes)
  # Only allow NETBEANS for a GUI build.
diff -cdrN ../vim-7.2.108/src/Make_mvc.mak src/Make_mvc.mak
*** ../vim-7.2.108/src/Make_mvc.mak     Tue Feb 24 17:23:18 2009
--- src/Make_mvc.mak    Thu Feb 26 17:20:39 2009
***************
*** 243,248 ****
--- 243,258 ----
  CSCOPE_DEFS  = -DFEAT_CSCOPE
  !endif

+ !ifndef PROC
+ PROC = yes
+ !endif
+
+ !if "$(PROC)" == "yes"
+ # PROC - Include support for process Interaction
+ PROC_OBJ     = $(OBJDIR)/if_proc.obj
+ PROC_DEFS  = -DFEAT_PROC
+ !endif
+
  !ifndef NETBEANS
  NETBEANS = $(GUI)
  !endif
***************
*** 306,312 ****

  CFLAGS = -c /W3 /nologo $(CVARS) -I. -Iproto -DHAVE_PATHDEF -DWIN32
\
                $(SNIFF_DEFS) $(CSCOPE_DEFS) $(NETBEANS_DEFS) \
!               $(NBDEBUG_DEFS) $(XPM_DEFS) \
                $(DEFINES) -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) \
                /Fo$(OUTDIR)/

--- 316,322 ----

  CFLAGS = -c /W3 /nologo $(CVARS) -I. -Iproto -DHAVE_PATHDEF -DWIN32
\
                $(SNIFF_DEFS) $(CSCOPE_DEFS) $(NETBEANS_DEFS) \
!               $(NBDEBUG_DEFS) $(XPM_DEFS) $(PROC_DEFS)\
                $(DEFINES) -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) \
                /Fo$(OUTDIR)/

***************
*** 782,793 ****

  $(VIM).exe: $(OUTDIR) $(OBJ) $(GUI_OBJ) $(OLE_OBJ) $(OLE_IDL) $
(MZSCHEME_OBJ) \
                $(PERL_OBJ) $(PYTHON_OBJ) $(RUBY_OBJ) $(TCL_OBJ) $(SNIFF_OBJ) \
!               $(CSCOPE_OBJ) $(NETBEANS_OBJ) $(XPM_OBJ) version.c version.h
        $(CC) $(CFLAGS) version.c
        $(link) $(LINKARGS1) -out:$(VIM).exe $(OBJ) $(GUI_OBJ) $(OLE_OBJ) \
                $(MZSCHEME_OBJ) $(PERL_OBJ) $(PYTHON_OBJ) $(RUBY_OBJ) \
!               $(TCL_OBJ) $(SNIFF_OBJ) $(CSCOPE_OBJ) $(NETBEANS_OBJ) \
!               $(XPM_OBJ) $(OUTDIR)\version.obj $(LINKARGS2)

  $(VIM): $(VIM).exe

--- 792,803 ----

  $(VIM).exe: $(OUTDIR) $(OBJ) $(GUI_OBJ) $(OLE_OBJ) $(OLE_IDL) $
(MZSCHEME_OBJ) \
                $(PERL_OBJ) $(PYTHON_OBJ) $(RUBY_OBJ) $(TCL_OBJ) $(SNIFF_OBJ) \
!               $(CSCOPE_OBJ) $(PROC_OBJ) $(NETBEANS_OBJ) $(XPM_OBJ) version.c
version.h
        $(CC) $(CFLAGS) version.c
        $(link) $(LINKARGS1) -out:$(VIM).exe $(OBJ) $(GUI_OBJ) $(OLE_OBJ) \
                $(MZSCHEME_OBJ) $(PERL_OBJ) $(PYTHON_OBJ) $(RUBY_OBJ) \
!               $(TCL_OBJ) $(SNIFF_OBJ) $(CSCOPE_OBJ) $(PROC_OBJ) \
!               $(NETBEANS_OBJ) $(XPM_OBJ) $(OUTDIR)\version.obj $(LINKARGS2)

  $(VIM): $(VIM).exe

***************
*** 919,924 ****
--- 929,936 ----
  $(OUTDIR)/gui_w32.obj:        $(OUTDIR) gui_w32.c gui_w48.c $(INCL) $
(GUI_INCL)

  $(OUTDIR)/if_cscope.obj: $(OUTDIR) if_cscope.c  $(INCL)
+
+ $(OUTDIR)/if_proc.obj: $(OUTDIR) if_proc.c  $(INCL)

  if_perl.c : if_perl.xs typemap
        $(PERL_EXE) $(XSUBPP) -prototypes -typemap $(XSUBPP_TYPEMAP) \
diff -cdrN ../vim-7.2.108/src/eval.c src/eval.c
*** ../vim-7.2.108/src/eval.c   Tue Feb 24 17:23:16 2009
--- src/eval.c  Wed Feb 25 23:56:18 2009
***************
*** 632,637 ****
--- 632,647 ----
  #endif
  static void f_prevnonblank __ARGS((typval_T *argvars, typval_T
*rettv));
  static void f_printf __ARGS((typval_T *argvars, typval_T *rettv));
+ #if defined(FEAT_PROC)
+ static void f_proc_check __ARGS((typval_T *argvars, typval_T
*rettv));
+ static void f_proc_connect __ARGS((typval_T *argvars, typval_T
*rettv));
+ static void f_proc_disconnect __ARGS((typval_T *argvars, typval_T
*rettv));
+ static void f_proc_getinfo __ARGS((typval_T *argvars, typval_T
*rettv));
+ static void f_proc_read __ARGS((typval_T *argvars, typval_T
*rettv));
+ static void f_proc_settimeout __ARGS((typval_T *argvars, typval_T
*rettv));
+ static void f_proc_write __ARGS((typval_T *argvars, typval_T
*rettv));
+ #endif /* defined(FEAT_PROC) */
+ static void fread2list __ARGS((FILE *fp, typval_T *rettv, int
bianry, long maxline, size_t (*pfread)(void*, size_t, size_t,
FILE*)));
  static void f_pumvisible __ARGS((typval_T *argvars, typval_T
*rettv));
  static void f_range __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_readfile __ARGS((typval_T *argvars, typval_T *rettv));
***************
*** 7652,7657 ****
--- 7662,7676 ----
  #endif
      {"prevnonblank",  1, 1, f_prevnonblank},
      {"printf",                2, 19, f_printf},
+ #if defined(FEAT_PROC)
+     {"proc_check",      1, 2, f_proc_check},
+     {"proc_connect",    1, 2, f_proc_connect},
+     {"proc_disconnect", 1, 1, f_proc_disconnect},
+     {"proc_getinfo",    2, 2, f_proc_getinfo},
+     {"proc_read",       1, 3, f_proc_read},
+     {"proc_settimeout", 2, 2, f_proc_settimeout},
+     {"proc_write",      2, 3, f_proc_write},
+ #endif /* defined(FEAT_PROC) */
      {"pumvisible",    0, 0, f_pumvisible},
      {"range",         1, 3, f_range},
      {"readfile",      1, 3, f_readfile},
***************
*** 11710,11715 ****
--- 11729,11737 ----
  #ifdef FEAT_PRINTER
        "printer",
  #endif
+ #ifdef FEAT_PROC
+       "proc",
+ #endif /* FEAT_PROC */
  #ifdef FEAT_PROFILE
        "profile",
  #endif
***************
*** 13761,13837 ****
  #endif
  }

  /*
!  * "pumvisible()" function
   */
- /*ARGSUSED*/
      static void
! f_pumvisible(argvars, rettv)
      typval_T  *argvars;
      typval_T  *rettv;
  {
!     rettv->vval.v_number = 0;
! #ifdef FEAT_INS_EXPAND
!     if (pum_visible())
!       rettv->vval.v_number = 1;
! #endif
  }

  /*
!  * "range()" function
   */
      static void
! f_range(argvars, rettv)
      typval_T  *argvars;
      typval_T  *rettv;
  {
!     long      start;
!     long      end;
!     long      stride = 1;
!     long      i;
!     int               error = FALSE;

!     start = get_tv_number_chk(&argvars[0], &error);
!     if (argvars[1].v_type == VAR_UNKNOWN)
      {
!       end = start - 1;
!       start = 0;
      }
!     else
      {
!       end = get_tv_number_chk(&argvars[1], &error);
        if (argvars[2].v_type != VAR_UNKNOWN)
!           stride = get_tv_number_chk(&argvars[2], &error);
      }

!     rettv->vval.v_number = 0;
!     if (error)
!       return;         /* type error; errmsg already given */
!     if (stride == 0)
!       EMSG(_("E726: Stride is zero"));
!     else if (stride > 0 ? end + 1 < start : end - 1 > start)
!       EMSG(_("E727: Start past end"));
!     else
      {
!       if (rettv_list_alloc(rettv) == OK)
!           for (i = start; stride > 0 ? i <= end : i >= end; i += stride)
!               if (list_append_number(rettv->vval.v_list,
!                                                     (varnumber_T)i) == FAIL)
!                   break;
      }
  }

  /*
!  * "readfile()" function
   */
      static void
! f_readfile(argvars, rettv)
      typval_T  *argvars;
      typval_T  *rettv;
  {
      int               binary = FALSE;
!     char_u    *fname;
      FILE      *fd;
      listitem_T        *li;
  #define FREAD_SIZE 200            /* optimized for text lines */
      char_u    buf[FREAD_SIZE];
--- 13783,14040 ----
  #endif
  }

+ #ifdef FEAT_PROC
+
  /*
!  * "proc_check" function
!  *
!  * check the process is ready. return "active" when the process is
running,
!  * "invaild" when this idx isn't connect a process yet. if the
process is
!  * exited, return the return code of process.
   */
      static void
! f_proc_check(argvars, rettv)
      typval_T  *argvars;
      typval_T  *rettv;
  {
!     char_u    buf[NUMBUFLEN];
!     int               error = FALSE;
!     int               purge = FALSE;
!     int               ret_code;
!     int               running = FALSE;
!     long      idx = 0;
!
!     idx = get_tv_number_chk(&argvars[0], &error);
!
!     if (error)
!       return;
!
!     if (argvars[1].v_type != VAR_UNKNOWN)
!       purge = get_tv_number_chk(&argvars[1], &error);
!
!     ret_code = do_proc_check((int)idx, purge, (int*)&running);
!
!     rettv->v_type = VAR_STRING;
!     if (running)
!       rettv->vval.v_string = vim_strsave((char_u*)"active");
!     else if (ret_code == -1)
!       rettv->vval.v_string = vim_strsave((char_u*)"invaild");
!     else
!     {
!       (void)vim_snprintf(buf, NUMBUFLEN, "exit:" PRINTF_HEX_LONG_U,
ret_code);
!       rettv->vval.v_string = vim_strsave((char_u*)buf);
!     }
  }

  /*
!  * "proc_connect" function
   */
      static void
! f_proc_connect(argvars, rettv)
      typval_T  *argvars;
      typval_T  *rettv;
  {
!     int               error;
!     int               ret = -1;
!     int               saved_did_emsg = did_emsg;
!     int               timeout;
!     char_u    buf[NUMBUFLEN];
!     char_u    *proc_name;

!     did_emsg = FALSE;
!     proc_name = get_tv_string_buf(&argvars[0], buf);
!
!     if (!did_emsg)
!       ret = do_proc_connect(proc_name);
!
!     did_emsg |= saved_did_emsg;
!
!     if (ret != -1 && argvars[1].v_type != VAR_UNKNOWN)
      {
!       timeout = get_tv_number_chk(&argvars[1], &error);
!
!       if (!error)
!           (void)do_proc_settimeout(ret, timeout);
      }
!
!     rettv->vval.v_number = ret;
! }
!
! /*
!  * "proc_disconnect" function
!  */
!     static void
! f_proc_disconnect(argvars, rettv)
!     typval_T  *argvars;
!     typval_T  *rettv;
! {
!     long      idx;
!     int               error = FALSE;
!
!     rettv->vval.v_number = -1;
!
!     idx = get_tv_number_chk(&argvars[0], &error);
!
!     /* -1 means disconnect all process */
!     if (!error && (idx == -1 || proc_check_idx(idx) >= 0))
!       rettv->vval.v_number = do_proc_disconnect((int)idx);
! }
!
! /*
!  * "proc_getinfo" function
!  */
!     static void
! f_proc_getinfo(argvars, rettv)
!     typval_T  *argvars;
!     typval_T  *rettv;
! {
!     char_u    *attr;
!     char_u    buf[NUMBUFLEN];
!     int               saved_did_emsg = did_emsg;
!     int               error = FALSE;
!     long      idx;
!
!     rettv->vval.v_number = -1;
!
!     idx = get_tv_number_chk(&argvars[0], &error);
!
!     if (error || proc_check_idx(idx) < 0)
!       return;
!
!     did_emsg = FALSE;
!     attr = get_tv_string_buf(&argvars[1], buf);
!
!     if (!did_emsg)
!       rettv->vval.v_number = do_proc_getinfo((int)idx, attr);
!
!     did_emsg |= saved_did_emsg;
! }
!
!
! /*
!  * "proc_read" function
!  */
!     static void
! f_proc_read(argvars, rettv)
!     typval_T  *argvars;
!     typval_T  *rettv;
! {
!     int               binary = FALSE;
!     int               error = FALSE;
!     int               idx;
!     long      maxline = MAXLNUM;
!
!     if (rettv_list_alloc(rettv) != OK)
!       return;
!
!     idx = (int)get_tv_number_chk(&argvars[0], &error);
!
!     if (error || proc_check_idx(idx) < 0)
!       return;
!
!     if (argvars[1].v_type != VAR_UNKNOWN)
      {
!       if (STRCMP(get_tv_string(&argvars[1]), "b") == 0)
!           binary = TRUE;
        if (argvars[2].v_type != VAR_UNKNOWN)
!           maxline = get_tv_number(&argvars[2]);
      }

!     fread2list((FILE*)idx, rettv, binary, maxline, proc_fread);
! }
!
! /*
!  * "proc_settimeout" function
!  */
!     static void
! f_proc_settimeout(argvars, rettv)
!     typval_T  *argvars;
!     typval_T  *rettv;
! {
!     long      idx;
!     long      timeout;
!     int               error = FALSE;
!
!     idx = get_tv_number_chk(&argvars[0], &error);
!
!     if (!error && proc_check_idx(idx) >= 0)
      {
!       timeout = get_tv_number_chk(&argvars[1], &error);
!
!       if (!error)
!           rettv->vval.v_number = do_proc_settimeout(idx, timeout);
      }
+     else
+       rettv->vval.v_number = -1;
  }

  /*
!  * "proc_write" function
   */
      static void
! f_proc_write(argvars, rettv)
      typval_T  *argvars;
      typval_T  *rettv;
  {
+     int               idx;
+     int               ret = 0;
+     int               error = FALSE;
      int               binary = FALSE;
!     listitem_T        *li;
!
!     idx = (int)get_tv_number_chk(&argvars[1], &error);
!
!     if (error || proc_check_idx(idx) < 0)
!       return;
!
!     if (argvars[0].v_type == VAR_STRING)
!     {
!       rettv->vval.v_number = proc_write_string(idx,
!               get_tv_string(&argvars[0]), TRUE) < 0 ? -1 : 0;
!       return;
!     }
!     else if (argvars[0].v_type != VAR_LIST)
!     {
!       EMSG2(_(e_listarg), "proc_write()");
!       return;
!     }
!
!     if (argvars[0].vval.v_list == NULL)
!       return;
!
!     if (argvars[2].v_type != VAR_UNKNOWN
!                   && STRCMP(get_tv_string(&argvars[2]), "b") == 0)
!       binary = TRUE;
!
!     /* now write list from argvars[1] to pipe... */
!     for (li = argvars[0].vval.v_list->lv_first;
!           li != NULL && ret >= 0;
!           li = li->li_next)
!       ret = proc_write_string(idx,
!               get_tv_string(&li->li_tv), !binary || li->li_next != NULL);
!
!     if (ret < 0)
!       EMSG(_(e_write));
!
!     rettv->vval.v_number = ret < 0 ? -1 : 0;
! }
!
! #endif /* FEAT_PROC */
!
! /*
!  * PRIVATE: fread2list
!  *
!  * read string into list from process.
!  * this function is draw out from f_readfile for common use.
!  */
!     static void
! fread2list(fd, rettv, binary, maxline, pfread)
      FILE      *fd;
+     typval_T  *rettv;
+     int               binary;
+     long      maxline;
+     size_t    (*pfread)(void*, size_t, size_t, FILE*);
+ {
      listitem_T        *li;
  #define FREAD_SIZE 200            /* optimized for text lines */
      char_u    buf[FREAD_SIZE];
***************
*** 13844,13876 ****
      int               prevlen = 0;    /* length of "prev" if not NULL */
      char_u    *s;
      int               len;
-     long      maxline = MAXLNUM;
      long      cnt = 0;

-     if (argvars[1].v_type != VAR_UNKNOWN)
-     {
-       if (STRCMP(get_tv_string(&argvars[1]), "b") == 0)
-           binary = TRUE;
-       if (argvars[2].v_type != VAR_UNKNOWN)
-           maxline = get_tv_number(&argvars[2]);
-     }
-
-     if (rettv_list_alloc(rettv) == FAIL)
-       return;
-
-     /* Always open the file in binary mode, library functions have a
mind of
-      * their own about CR-LF conversion. */
-     fname = get_tv_string(&argvars[0]);
-     if (*fname == NUL || (fd = mch_fopen((char *)fname, READBIN)) ==
NULL)
-     {
-       EMSG2(_(e_notopen), *fname == NUL ? (char_u *)_("<empty>") :
fname);
-       return;
-     }
-
      filtd = 0;
      while (cnt < maxline || maxline < 0)
      {
!       readlen = (int)fread(buf + filtd, 1, FREAD_SIZE - filtd, fd);
        buflen = filtd + readlen;
        tolist = 0;
        for ( ; filtd < buflen || readlen <= 0; ++filtd)
--- 14047,14058 ----
      int               prevlen = 0;    /* length of "prev" if not NULL */
      char_u    *s;
      int               len;
      long      cnt = 0;

      filtd = 0;
      while (cnt < maxline || maxline < 0)
      {
!       readlen = (int)pfread(buf + filtd, 1, FREAD_SIZE - filtd, fd);
        buflen = filtd + readlen;
        tolist = 0;
        for ( ; filtd < buflen || readlen <= 0; ++filtd)
***************
*** 13879,13885 ****
            {
                /* Only when in binary mode add an empty list item when the
                 * last line ends in a '\n'. */
!               if (!binary && readlen == 0 && filtd == 0)
                    break;

                /* Found end-of-line or end-of-file: add a text line to the
--- 14061,14072 ----
            {
                /* Only when in binary mode add an empty list item when the
                 * last line ends in a '\n'. */
!               /* prev == NULL added by StarWing<weasley_wx AT qq DOT com>:
!                * fix a bug of f_readfile: on Windows, it can't read one-line
!                * file (that is, no any NL char in the file (i hasn't tested
!                * it on other system)
!                */
!               if (!binary && readlen == 0 && filtd == 0 && prev == NULL)
                    break;

                /* Found end-of-line or end-of-file: add a text line to the
***************
*** 13969,13974 ****
--- 14156,14257 ----
        }

      vim_free(prev);
+ }
+
+ /*
+  * "pumvisible()" function
+  */
+ /*ARGSUSED*/
+     static void
+ f_pumvisible(argvars, rettv)
+     typval_T  *argvars;
+     typval_T  *rettv;
+ {
+     rettv->vval.v_number = 0;
+ #ifdef FEAT_INS_EXPAND
+     if (pum_visible())
+       rettv->vval.v_number = 1;
+ #endif
+ }
+
+ /*
+  * "range()" function
+  */
+     static void
+ f_range(argvars, rettv)
+     typval_T  *argvars;
+     typval_T  *rettv;
+ {
+     long      start;
+     long      end;
+     long      stride = 1;
+     long      i;
+     int               error = FALSE;
+
+     start = get_tv_number_chk(&argvars[0], &error);
+     if (argvars[1].v_type == VAR_UNKNOWN)
+     {
+       end = start - 1;
+       start = 0;
+     }
+     else
+     {
+       end = get_tv_number_chk(&argvars[1], &error);
+       if (argvars[2].v_type != VAR_UNKNOWN)
+           stride = get_tv_number_chk(&argvars[2], &error);
+     }
+
+     rettv->vval.v_number = 0;
+     if (error)
+       return;         /* type error; errmsg already given */
+     if (stride == 0)
+       EMSG(_("E726: Stride is zero"));
+     else if (stride > 0 ? end + 1 < start : end - 1 > start)
+       EMSG(_("E727: Start past end"));
+     else
+     {
+       if (rettv_list_alloc(rettv) == OK)
+           for (i = start; stride > 0 ? i <= end : i >= end; i += stride)
+               if (list_append_number(rettv->vval.v_list,
+                                                     (varnumber_T)i) == FAIL)
+                   break;
+     }
+ }
+
+ /*
+  * "readfile()" function
+  */
+     static void
+ f_readfile(argvars, rettv)
+     typval_T  *argvars;
+     typval_T  *rettv;
+ {
+     int               binary = FALSE;
+     char_u    *fname;
+     FILE      *fd;
+     long      maxline = MAXLNUM;
+
+     if (argvars[1].v_type != VAR_UNKNOWN)
+     {
+       if (STRCMP(get_tv_string(&argvars[1]), "b") == 0)
+           binary = TRUE;
+       if (argvars[2].v_type != VAR_UNKNOWN)
+           maxline = get_tv_number(&argvars[2]);
+     }
+
+     if (rettv_list_alloc(rettv) == FAIL)
+       return;
+
+     /* Always open the file in binary mode, library functions have a
mind of
+      * their own about CR-LF conversion. */
+     fname = get_tv_string(&argvars[0]);
+     if (*fname == NUL || (fd = mch_fopen((char *)fname, READBIN)) ==
NULL)
+     {
+       EMSG2(_(e_notopen), *fname == NUL ? (char_u *)_("<empty>") :
fname);
+       return;
+     }
+
+     fread2list(fd, rettv, binary, maxline, fread);
      fclose(fd);
  }

diff -cdrN ../vim-7.2.108/src/ex_docmd.c src/ex_docmd.c
*** ../vim-7.2.108/src/ex_docmd.c       Tue Feb 24 17:23:08 2009
--- src/ex_docmd.c      Thu Feb 26 03:39:42 2009
***************
*** 5915,5922 ****
      char_u    *p;
      char_u    *q;

!     char_u    *start;
!     char_u    *end;
      char_u    *ksp;
      size_t    len, totlen;

--- 5915,5922 ----
      char_u    *p;
      char_u    *q;

!     char_u    *start = NULL;
!     char_u    *end = NULL; /* GCC warning: end might not init. */
      char_u    *ksp;
      size_t    len, totlen;

diff -cdrN ../vim-7.2.108/src/feature.h src/feature.h
*** ../vim-7.2.108/src/feature.h        Tue Feb 24 17:21:49 2009
--- src/feature.h       Thu Feb 26 04:35:29 2009
***************
*** 374,379 ****
--- 374,391 ----
  #endif

  /*
+  * +proc                Win32 only: Process Interaction support.
+  *
+  * define PROC_DYNAMIC_SIZE will change the size of proc-table
dynamic.
+  * using a option named 'procmaxcount'
+  */
+ #if defined(FEAT_PROC) && !defined(WIN32)
+ #  undef FEAT_PROC
+ #else
+ #  define PROC_DYNAMIC_SIZE
+ #endif /* defined(FEAT_PROC) && !defined(WIN32) */
+
+ /*
   * +eval              Built-in script language and expression evaluation,
   *                    ":let", ":if", etc.
   * +float             Floating point variables.
diff -cdrN ../vim-7.2.108/src/fileio.c src/fileio.c
*** ../vim-7.2.108/src/fileio.c Tue Feb 24 17:22:59 2009
--- src/fileio.c        Thu Feb 26 03:40:44 2009
***************
*** 1502,1508 ****
            {
                char_u  *src, *dst;
                WCHAR   ucs2buf[3];
!               int     ucs2len;
                int     codepage = FIO_GET_CP(fio_flags);
                int     bytelen;
                int     found_bad;
--- 1502,1508 ----
            {
                char_u  *src, *dst;
                WCHAR   ucs2buf[3];
!               int     ucs2len = 0; /* fileio.c:1505: warning: 'ucs2len' might 
be
used uninit */
                int     codepage = FIO_GET_CP(fio_flags);
                int     bytelen;
                int     found_bad;
diff -cdrN ../vim-7.2.108/src/gui_w32.c src/gui_w32.c
*** ../vim-7.2.108/src/gui_w32.c        Tue Feb 24 17:23:11 2009
--- src/gui_w32.c       Thu Feb 26 03:48:17 2009
***************
*** 4531,4541 ****
                UINT vlen = 0;
                void *data = alloc(len);

!               if (data != NULL
                        && GetFileVersionInfo(comctl_dll, 0, len, data)
                        && VerQueryValue(data, "\\", (void **)&ver, &vlen)
                        && vlen
!                       && HIWORD(ver->dwFileVersionMS) > 4
                        || (HIWORD(ver->dwFileVersionMS) == 4
                            && LOWORD(ver->dwFileVersionMS) >= 70))
                {
--- 4531,4541 ----
                UINT vlen = 0;
                void *data = alloc(len);

!               if ((data != NULL
                        && GetFileVersionInfo(comctl_dll, 0, len, data)
                        && VerQueryValue(data, "\\", (void **)&ver, &vlen)
                        && vlen
!                       && HIWORD(ver->dwFileVersionMS) > 4)
                        || (HIWORD(ver->dwFileVersionMS) == 4
                            && LOWORD(ver->dwFileVersionMS) >= 70))
                {
diff -cdrN ../vim-7.2.108/src/if_proc.c src/if_proc.c
*** ../vim-7.2.108/src/if_proc.c        Thu Jan  1 08:00:00 1970
--- src/if_proc.c       Thu Feb 26 13:18:34 2009
***************
*** 0 ****
--- 1,667 ----
+ /* vi:set ts=8 sts=4 sw=4:
+  *
+  * Process Interaction support for Vim added by StarWing
+  * <[email protected]>
+  *
+  * ONLY ON WINDOWS!
+  *
+  * the idea of this support was borrowed from CSCOOPE support of Vim
+  *
+  * See README.txt for an overview of the Vim source code.
+  */
+
+ #if defined(MSDOS) || defined(WIN16) || defined(WIN32) || defined
(_WIN64)
+ # include "vimio.h"   /* for mch_open(), must be before vim.h */
+ #endif
+
+ #include "vim.h"
+
+ #if defined(FEAT_PROC) || defined(PROTO)
+
+ #include <errno.h>
+ #include <assert.h>
+
+ #if defined(UNIX)
+ # include <sys/types.h>               /* pid_t */
+ # include <sys/stat.h>                /* dev_t, ino_t */
+ # include <sys/wait.h>
+ #else
+ # if defined (WIN32)
+ #  ifndef WIN32_LEAN_AND_MEAN
+ #   define WIN32_LEAN_AND_MEAN
+ #  endif
+ #  include <windows.h>
+ # endif
+ #endif
+
+ #define PROC_SUCCESS            0
+ #define PROC_FAILURE            -1
+ #ifdef PROC_DYNAMIC_SIZE
+ #  define PROC_INFO_MAX         p_pmc
+ #else
+ #  define PROC_INFO_MAX         20
+ #endif
+ #define PROC_BUF_SIZE           200
+
+ #ifdef PROC_DYNAMIC_SIZE
+ #  define PROC_CHECK_IDX(idx) \
+     assert(idx >= 0 && idx < PROC_INFO_MAX \
+             && pinfo != NULL && pinfo[idx].pid != 0)
+ #else
+ #  define PROC_CHECK_IDX(idx) \
+     assert(idx >= 0 && idx < PROC_INFO_MAX && pinfo[idx].pid != 0)
+ #endif
+
+ typedef struct
+ {
+ #if defined(WIN32)
+     DWORD           pid;        /* PID of the connected process */
+     HANDLE          hProc;      /* handle of process */
+     HANDLE          hStdOut;    /* From process, FILE */
+     HANDLE          hStdIn;     /* To process, FILE */
+ #endif /* defined(WIN32) */
+
+ #if defined(UNIX)
+     pid_t           pid;        /* PID of the connect process */
+     int             stdout_fd;  /* From process, fd number */
+     int             stdin_fd;   /* to process, fd number */
+ #endif /* defined(UNIX) */
+
+     int timeout;
+ } proc_info_T;
+
+ typedef struct proc_buffer_S
+ {
+     char_u data[PROC_BUF_SIZE];
+     struct proc_buffer_S *next;
+ } proc_buf_T;
+
+ #ifdef PROC_DYNAMIC_SIZE
+ static proc_info_T  *pinfo = NULL;
+ #else
+ static proc_info_T  pinfo[PROC_INFO_MAX];
+ #endif
+
+ static char_u       *e_idxinvaild = N_("E630: process %d wasn't
connect yet");
+ static char_u       *e_connect = N_("E631: Could not spawn
process");
+ #if !defined(WIN32)
+ static char_u       *e_noimpl = N_("E632: this function isn't
implement now");
+ #endif /* !defined(WIN32) */
+ static char_u       *e_pipe = N_("E633: Could not create process
pipes");
+ static char_u       *e_readpipe = N_("E634: can't read data from
process %d");
+ static char_u       *e_writepipe = N_("E635: can't write data to
process %d");
+ static char_u       *e_changepmi = N_("E636: need at least %d items
space");
+
+ static int          alloc_free_idx __ARGS((void));
+ static void         cleanup_idx __ARGS((int idx));
+ static size_t       proc_write_buf __ARGS((int idx, char_u *buf,
size_t bufsize));
+ static size_t       proc_read_buf __ARGS((int idx, char_u *buf,
size_t buflen));
+ #if defined(WIN32)
+ static void         win32_EMSG __ARGS((char_u *msg));
+ #endif /* defined(WIN32) */
+
+ /*
+  * PRIVATE: alloc_free_idx
+  *
+  * alloc a new idx for the process connecting. if no free idx
exists, return
+  * PROC_FAILURE.
+  */
+     static int
+ alloc_free_idx()
+ {
+     int         idx;
+
+ #ifdef PROC_DYNAMIC_SIZE
+     if (pinfo == NULL)
+     {
+         if (PROC_INFO_MAX == 0
+                 || proc_resize_table(PROC_INFO_MAX, NULL, 0) != NULL
+                 || pinfo == NULL)
+             return PROC_FAILURE;
+     }
+ #endif
+
+     for (idx = 0; idx < PROC_INFO_MAX && pinfo[idx].pid != 0; ++idx)
+         ;
+
+     if (idx == PROC_INFO_MAX)
+         return PROC_FAILURE;
+
+     return idx;
+ }
+
+ /*
+  * PRIVATE: cleanup_idx
+  *
+  * clean up the info
+  */
+     static void
+ cleanup_idx(idx)
+     int         idx;
+ {
+ #ifdef WIN32
+     CloseHandle(pinfo[idx].hProc);
+     CloseHandle(pinfo[idx].hStdIn);
+     CloseHandle(pinfo[idx].hStdOut);
+ #endif
+
+     vim_memset(&pinfo[idx], 0, sizeof(proc_info_T));
+ }
+
+ #ifdef WIN32
+ /*
+  * PRIVATE: win32_EMSG
+  *
+  * output the error message on Windows, using GetLastError function.
+  */
+     static void
+ win32_EMSG(msg)
+     char_u      *msg;
+ {
+     LPVOID      lpMsgBuf;
+     DWORD       dw = GetLastError();
+
+     FormatMessage(
+         FORMAT_MESSAGE_ALLOCATE_BUFFER |
+         FORMAT_MESSAGE_FROM_SYSTEM,
+         NULL,
+         dw,
+         MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT),
+         (LPTSTR)&lpMsgBuf,
+         0, NULL);
+
+     (void)EMSG3("%s: %s", msg, lpMsgBuf);
+
+     LocalFree(lpMsgBuf);
+ }
+ #endif /* WIN32 */
+
+ /*
+  * PUBLIC: proc_check_idx
+  */
+     int
+ proc_check_idx(idx)
+     int         idx;
+ {
+     if (idx < 0 || idx >= PROC_INFO_MAX
+ #ifdef PROC_DYNAMIC_SIZE
+             || pinfo == NULL
+ #endif
+             || pinfo[idx].pid == 0)
+     {
+         EMSGN(_(e_idxinvaild), idx);
+         return PROC_FAILURE;
+     }
+
+     return PROC_SUCCESS;
+ }
+
+ #ifdef PROC_DYNAMIC_SIZE
+ /*
+  * PUBLIC: proc_resize_table
+  *
+  * resize pinfo table
+  */
+     char_u *
+ proc_resize_table(old_value, errbuf, errbuflen)
+     long        old_value;
+     char_u      *errbuf;
+     size_t      errbuflen;
+ {
+     int         i = old_value - 1;
+     proc_info_T *new_table = NULL;
+
+     if (pinfo != NULL)
+     {
+         for (; i >= 0 && pinfo[i].pid == 0; --i)
+             ;
+
+         if (i >= PROC_INFO_MAX)
+         {
+             PROC_INFO_MAX = old_value;
+             vim_snprintf((char*)errbuf, errbuflen, _(e_changepmi), i
+ 1);
+             return errbuf;
+         }
+     }
+
+     if (PROC_INFO_MAX == 0)
+     {
+         vim_free(pinfo);
+         pinfo = NULL;
+         return NULL;
+     }
+
+     new_table = (proc_info_T*)alloc_clear(PROC_INFO_MAX * sizeof
(proc_info_T));
+
+     if (new_table == NULL)
+     {
+         PROC_INFO_MAX = old_value;
+         return e_outofmem;
+     }
+     else if (pinfo != NULL)
+     {
+         mch_memmove(new_table, pinfo, (i + 1) * sizeof
(proc_info_T));
+         vim_free(pinfo);
+     }
+
+     pinfo = new_table;
+     return NULL;
+ }
+ #endif
+
+ /*
+  * PUBLIC: do_proc_connect
+  */
+     int
+ do_proc_connect(pname)
+     char_u *    pname;
+ #ifdef WIN32
+ {
+     int         idx;
+     int         succ1 = FALSE;
+     int         succ2 = FALSE;
+     HANDLE      stdin_rd, stdout_rd;
+     HANDLE      stdin_wr, stdout_wr;
+     STARTUPINFO si;
+     SECURITY_ATTRIBUTES sa;
+     PROCESS_INFORMATION pi;
+
+     if ((idx = alloc_free_idx()) == PROC_FAILURE)
+         return PROC_FAILURE;
+
+     sa.nLength = sizeof(SECURITY_ATTRIBUTES);
+     sa.bInheritHandle = TRUE;
+     sa.lpSecurityDescriptor = NULL;
+
+     if (!(succ1 = CreatePipe(&stdin_rd, &stdin_wr, &sa, 0))
+             || !(succ2 = CreatePipe(&stdout_rd, &stdout_wr, &sa,
0)))
+     {
+         (void)EMSG(_(e_pipe));
+
+ err_exiting:
+
+         if (succ1)
+         {
+             CloseHandle(stdin_rd);
+             CloseHandle(stdin_wr);
+         }
+         if (succ2)
+         {
+             CloseHandle(stdout_rd);
+             CloseHandle(stdout_wr);
+         }
+         return PROC_FAILURE;
+     }
+
+     GetStartupInfo(&si);
+     si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
+     si.wShowWindow = SW_HIDE;
+     si.hStdError = stdout_wr;
+     si.hStdOutput = stdout_wr;
+     si.hStdInput = stdin_rd;
+
+     if (!CreateProcess(NULL, (LPSTR)pname, NULL, NULL,
+                        TRUE, CREATE_NEW_CONSOLE, NULL, NULL, &si,
&pi))
+     {
+       (void)EMSG(_(e_connect));
+
+         goto err_exiting;
+     }
+
+     pinfo[idx].pid = pi.dwProcessId;
+     pinfo[idx].hProc = pi.hProcess;
+     CloseHandle(pi.hThread);
+
+     pinfo[idx].hStdIn = stdin_wr;
+     pinfo[idx].hStdOut = stdout_rd;
+
+     CloseHandle(stdin_rd);
+     CloseHandle(stdout_wr);
+
+     return idx;
+ }
+ #else /* WIN32 */
+ {
+     (void)EMSG(_(e_noimpl));
+     return PROC_FAILURE;
+ }
+ #endif /* WIN32 */
+
+ /*
+  * PUBLIC: do_proc_check
+  *
+  * check the process of speciefied has already exiting
+  */
+     int
+ do_proc_check(idx, purge, pruning)
+     int         idx;
+     int         purge;      /* purge current process if it exited.
*/
+     int         *pruning;   /* return whether current process
isrunning */
+ #ifdef WIN32
+ {
+     DWORD       ret_code = 0;
+
+     /* this function simply return failed, didn't use assert. */
+     if (idx < 0 || idx >= PROC_INFO_MAX
+ #ifdef PROC_DYNAMIC_SIZE
+             || pinfo == NULL
+ #endif
+             || pinfo[idx].pid == 0)
+         return PROC_FAILURE;
+
+     if (!GetExitCodeProcess(pinfo[idx].hProc, &ret_code))
+     {
+         win32_EMSG("E636: Error ocurred at GetExitCodeProcess");
+
+         return PROC_FAILURE;
+     }
+
+     if (pruning != NULL)
+         *pruning = (ret_code == STILL_ACTIVE);
+
+     if (ret_code != STILL_ACTIVE)
+     {
+         if (purge)
+             cleanup_idx(idx);
+         return (int)ret_code;
+     }
+
+     return 0;
+ }
+ #else /* WIN32 */
+ {
+     (void)EMSG(_(e_noimpl));
+     return PROC_FAILURE;
+ }
+ #endif /* WIN32 */
+
+ /*
+  * PUBLIC: do_proc_getinfo
+  */
+     int
+ do_proc_getinfo(idx, attr)
+     int         idx;
+     char_u      *attr;
+ {
+     int         i;
+     static char *attr_list[] =
+     {
+         "pid",
+         "timeout",
+         NULL,
+     };
+
+     PROC_CHECK_IDX(idx);
+
+     for (i = 0; attr_list[i] != NULL; ++i)
+       if (STRICMP(attr, attr_list[i]) == 0)
+         {
+             switch (i)
+             {
+             case 0: return pinfo[idx].pid;
+             case 1: return pinfo[idx].timeout;
+             }
+         }
+
+     return PROC_FAILURE;
+ }
+
+ /*
+  * PUBLIC: do_proc_disconnect
+  */
+     int
+ do_proc_disconnect(idx)
+     int         idx;
+ #ifdef WIN32
+ {
+     int         ret_code = 0;
+     int         running = TRUE;
+
+     if (idx == -1)
+     {
+ #ifdef PROC_DYNAMIC_SIZE
+         if (pinfo == NULL)
+             return 0;
+ #endif
+
+         for (idx = 0; idx < PROC_INFO_MAX; ++idx)
+         {
+             if (pinfo[idx].pid != 0)
+                 if (do_proc_disconnect(idx) == PROC_FAILURE)
+                     ret_code = idx;
+         }
+         return ret_code;
+     }
+
+     PROC_CHECK_IDX(idx);
+
+     switch (WaitForSingleObject(pinfo[idx].hProc, pinfo
[idx].timeout))
+     {
+     case WAIT_FAILED:
+         win32_EMSG("E637: Error ocurred at WaitForSingleObject");
+         return PROC_FAILURE;
+
+     case WAIT_TIMEOUT:
+         if (!TerminateProcess(pinfo[idx].hProc, 0))
+         {
+             win32_EMSG("E638: Error ocurred at TerminateProcess");
+             return PROC_FAILURE;
+         }
+         break;
+
+     default:
+         ret_code = do_proc_check(idx, 0, &running);
+     }
+
+     cleanup_idx(idx);
+     return ret_code;
+ }
+ #else /* WIN32 */
+ {
+     (void)EMSG(_(e_noimpl));
+     return PROC_FAILURE;
+ }
+ #endif /* WIN32 */
+
+ /*
+  * PUBLIC: do_proc_settimeout
+  */
+     int
+ do_proc_settimeout(idx, timeout)
+     int         idx;
+     int         timeout;
+ {
+     int old_timeout = 0;
+
+     PROC_CHECK_IDX(idx);
+
+     old_timeout = pinfo[idx].timeout;
+     pinfo[idx].timeout = timeout;
+
+     return old_timeout;
+ }
+
+ /*
+  * PRIVATE: proc_read_buf
+  *
+  * read data from pipe to buffer.
+  */
+     static size_t
+ proc_read_buf(idx, buf, buflen)
+     int         idx;
+     char_u      *buf;
+     size_t      buflen;
+ #ifdef WIN32
+ {
+     DWORD       time;
+     DWORD       count = 0;
+     DWORD       readlen = 0;
+
+     if (buf == NULL || buflen == 0)
+         return 0;
+
+     PROC_CHECK_IDX(idx);
+     time = GetTickCount();
+
+     do
+     {
+         /* quiet return fail when PeekNamedPipe failed */
+         if (!PeekNamedPipe(pinfo[idx].hStdOut, NULL,
+                     0, NULL, &count, NULL))
+             return PROC_FAILURE;
+
+         if (count != 0)
+         {
+             if (count > buflen)
+                 count = buflen;
+
+             if (!ReadFile(pinfo[idx].hStdOut, buf,
+                         count, &readlen, NULL))
+             {
+                 EMSGN(_(e_readpipe), idx);
+                 return PROC_FAILURE;
+             }
+             return (size_t)readlen;
+         }
+     }
+     while (GetTickCount() - time <= pinfo[idx].timeout);
+
+     return 0;
+ }
+ #else /* WIN32 */
+ {
+     (void)EMSG(_(e_noimpl));
+     return PROC_FAILURE;
+ }
+ #endif /* WIN32 */
+
+ /*
+  * PUBLIC: proc_fread
+  *
+  * fread-like interface for process reading
+  */
+     size_t
+ proc_fread(buf, item, count, idx)
+     void        *buf;
+     size_t      item;
+     size_t      count;
+     FILE        *idx;
+ {
+     return proc_read_buf((int)idx, (char_u*)buf, (size_t)(item *
count));
+ }
+
+ /*
+  * PRIVATE: proc_write_buf
+  *
+  * write data in buffer to pipe.
+  */
+     static size_t
+ proc_write_buf(idx, buf, bufsize)
+     int         idx;
+     char_u      *buf;
+     size_t      bufsize;
+ #ifdef WIN32
+ {
+     DWORD         write_size = 0;
+
+     if (buf == NULL || bufsize == 0)
+         return 0;
+
+     PROC_CHECK_IDX(idx);
+
+     if (!WriteFile(pinfo[idx].hStdIn,
+                 buf,
+                 bufsize,
+                 &write_size,
+                 NULL))
+     {
+         EMSGN(_(e_writepipe), idx);
+         return PROC_FAILURE;
+     }
+
+     if (!FlushFileBuffers(pinfo[idx].hStdIn))
+     {
+         EMSGN(_(e_writepipe), idx);
+         return PROC_FAILURE;
+     }
+
+     return (size_t)write_size;
+ }
+ #else /* WIN32 */
+ {
+     (void)EMSG(_(e_noimpl));
+     return PROC_FAILURE;
+ }
+ #endif /* WIN32 */
+
+ /*
+  * PUBLIC: proc_write_string
+  *
+  * a helper function using string to fill the buffer
+  */
+     int
+ proc_write_string(idx, string, writenl)
+     int         idx;
+     char_u      *string;
+     int         writenl; /* if it's TRUE, write a '\n' after string
*/
+ {
+     char_u      buf[PROC_BUF_SIZE];
+     int         ret = 0;
+     int         c = 0;
+
+     PROC_CHECK_IDX(idx);
+
+     for (; *string != NUL; ++string)
+     {
+         if (*string == '\n')
+             buf[c++] = NUL;
+         else
+             buf[c++] = *string;
+
+         if (c == PROC_BUF_SIZE)
+         {
+             c = 0;
+             ret = proc_write_buf(idx, buf, PROC_BUF_SIZE);
+             if (ret == PROC_FAILURE)
+                 break;
+         }
+     }
+
+     if (ret >= 0 && writenl)
+     {
+         buf[c++] = '\n';
+
+         if (c == PROC_BUF_SIZE)
+         {
+             c = 0;
+             ret = proc_write_buf(idx, buf, PROC_BUF_SIZE);
+         }
+     }
+
+     if (c != 0)
+         ret = proc_write_buf(idx, buf, c);
+
+     return ret < 0 ? PROC_FAILURE : PROC_SUCCESS;
+ }
+
+ /*
+  * PUBLIC: proc_end
+  */
+     void
+ proc_end()
+ {
+     int         idx;
+
+ #ifdef PROC_DYNAMIC_SIZE
+     if (pinfo == NULL)
+         return;
+ #endif
+
+     for (idx = 0; idx < PROC_INFO_MAX; ++idx)
+         cleanup_idx(idx);
+
+     vim_free(pinfo);
+     pinfo = NULL;
+ }
+
+ #endif /* defined(FEAT_PROC) || defined(PROTO) */
diff -cdrN ../vim-7.2.108/src/main.c src/main.c
*** ../vim-7.2.108/src/main.c   Tue Feb 24 17:22:32 2009
--- src/main.c  Thu Feb 26 03:09:26 2009
***************
*** 1333,1338 ****
--- 1333,1341 ----
  #ifdef FEAT_CSCOPE
      cs_end();
  #endif
+ #ifdef FEAT_PROC
+     proc_end();
+ #endif
  #ifdef FEAT_EVAL
      if (garbage_collect_at_exit)
        garbage_collect();
diff -cdrN ../vim-7.2.108/src/option.c src/option.c
*** ../vim-7.2.108/src/option.c Tue Feb 24 17:23:25 2009
--- src/option.c        Thu Feb 26 04:36:40 2009
***************
*** 1968,1973 ****
--- 1968,1978 ----
                            {(char_u *)NULL, (char_u *)0L}
  #endif
                            },
+ #if defined(FEAT_PROC) && defined(PROC_DYNAMIC_SIZE)
+     {"procmaxcount",    "pmc",   P_NUM|P_VIM,
+                           (char_u *)&p_pmc, PV_NONE,
+                           {(char_u *)0L, (char_u *)20L}},
+ #endif
      {"prompt",            NULL,   P_BOOL|P_VI_DEF,
                            (char_u *)&p_prompt, PV_NONE,
                            {(char_u *)TRUE, (char_u *)0L}},
***************
*** 7926,7931 ****
--- 7931,7952 ----
            curwin->w_p_nuw = 10;
        }
        curwin->w_nrwidth_line_count = 0;
+     }
+ #endif
+
+ #if defined(FEAT_PROC) && defined(PROC_DYNAMIC_SIZE)
+     /* 'procmaxidx' must be positive. and when it changes from zero
to
+      * non-zero, set the size of proc-info table. */
+     else if (pp == &p_pmc)
+     {
+       if (p_pmc < 0)
+       {
+           p_pmc = old_value;
+           errmsg = e_positive;
+       }
+
+       if (p_pmc != old_value)
+           errmsg = proc_resize_table(old_value, errbuf, errbuflen);
      }
  #endif

diff -cdrN ../vim-7.2.108/src/option.h src/option.h
*** ../vim-7.2.108/src/option.h Sat Aug  9 18:29:02 2008
--- src/option.h        Thu Feb 26 04:34:50 2009
***************
*** 395,400 ****
--- 395,403 ----
  EXTERN long   p_cspc;         /* 'cscopepathcomp' */
  EXTERN int    p_csverbose;    /* 'cscopeverbose' */
  #endif
+ #if defined(FEAT_PROC) && defined(PROC_DYNAMIC_SIZE)
+ EXTERN long     p_pmc;          /* 'procmaxcount' */
+ #endif
  EXTERN char_u *p_debug;       /* 'debug' */
  #ifdef FEAT_FIND_ID
  EXTERN char_u *p_def;         /* 'define' */
diff -cdrN ../vim-7.2.108/src/proto/if_proc.pro src/proto/if_proc.pro
*** ../vim-7.2.108/src/proto/if_proc.pro        Thu Jan  1 08:00:00 1970
--- src/proto/if_proc.pro       Thu Feb 26 03:10:29 2009
***************
*** 0 ****
--- 1,12 ----
+ /* if_proc.c */
+ char_u *proc_resize_table __ARGS((long old_value, char_u *errbuf,
size_t errbuflen));
+ int do_proc_check __ARGS((int idx, int purge, int *prunning));
+ int do_proc_connect __ARGS((char_u *pname));
+ int do_proc_disconnect __ARGS((int idx));
+ int do_proc_getinfo __ARGS((int idx, char_u *attr));
+ int do_proc_settimeout __ARGS((int idx, int timeout));
+ int proc_check_idx __ARGS((int idx));
+ int proc_write_string __ARGS((int idx, char_u *string, int
writenl));
+ size_t proc_fread __ARGS((void *buf, size_t item, size_t count, FILE
*idx));
+ void proc_end __ARGS((void));
+ /* vim: set ft=c : */
diff -cdrN ../vim-7.2.108/src/proto.h src/proto.h
*** ../vim-7.2.108/src/proto.h  Sat Aug  9 18:29:18 2008
--- src/proto.h Mon Feb 23 02:04:53 2009
***************
*** 74,79 ****
--- 74,82 ----
  # ifdef FEAT_CSCOPE
  #  include "if_cscope.pro"
  # endif
+ # ifdef FEAT_PROC
+ #  include "if_proc.pro"
+ # endif
  # include "diff.pro"
  # include "digraph.pro"
  # include "edit.pro"
diff -cdrN ../vim-7.2.108/src/version.c src/version.c
*** ../vim-7.2.108/src/version.c        Tue Feb 24 17:23:25 2009
--- src/version.c       Thu Feb 26 00:02:16 2009
***************
*** 436,441 ****
--- 436,446 ----
  #else
        "-printer",
  #endif
+ #ifdef FEAT_PROC
+       "+proc",
+ #else
+       "-proc",
+ #endif /* FEAT_PROC */
  #ifdef FEAT_PROFILE
        "+profile",
  #else

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui