home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.3 / 7.3.451 < prev    next >
Encoding:
Internet Message Format  |  2012-11-20  |  10.4 KB

  1. To: vim_dev@googlegroups.com
  2. Subject: Patch 7.3.451
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.3.451
  11. Problem:    Tcl doesn't work on 64 bit MS-Windows.
  12. Solution:   Make it work. (Dave Bodenstab)
  13. Files:        src/Make_mvc.mak, src/if_tcl.c
  14.  
  15.  
  16. *** ../vim-7.3.450/src/Make_mvc.mak    2012-02-12 01:55:50.000000000 +0100
  17. --- src/Make_mvc.mak    2012-02-22 15:43:01.000000000 +0100
  18. ***************
  19. *** 616,622 ****
  20.           -DDYNAMIC_TCL_VER=\"$(TCL_VER_LONG)\"
  21.   TCL_OBJ    = $(OUTDIR)\if_tcl.obj
  22.   TCL_INC    = /I "$(TCL)\Include" /I "$(TCL)"
  23. ! TCL_LIB = $(TCL)\lib\tclstub$(TCL_VER).lib
  24.   !else
  25.   CFLAGS  = $(CFLAGS) -DFEAT_TCL
  26.   TCL_OBJ    = $(OUTDIR)\if_tcl.obj
  27. --- 616,622 ----
  28.           -DDYNAMIC_TCL_VER=\"$(TCL_VER_LONG)\"
  29.   TCL_OBJ    = $(OUTDIR)\if_tcl.obj
  30.   TCL_INC    = /I "$(TCL)\Include" /I "$(TCL)"
  31. ! TCL_LIB = "$(TCL)\lib\tclstub$(TCL_VER).lib"
  32.   !else
  33.   CFLAGS  = $(CFLAGS) -DFEAT_TCL
  34.   TCL_OBJ    = $(OUTDIR)\if_tcl.obj
  35. *** ../vim-7.3.450/src/if_tcl.c    2011-07-27 14:15:41.000000000 +0200
  36. --- src/if_tcl.c    2012-02-22 15:47:00.000000000 +0100
  37. ***************
  38. *** 79,90 ****
  39.   typedef struct
  40.   {
  41.       Tcl_Interp *interp;
  42.       int range_start, range_end;
  43.       int lbase;
  44.       char *curbuf, *curwin;
  45.   } tcl_info;
  46.   
  47. ! static tcl_info tclinfo = { NULL, 0, 0, 0, NULL, NULL };
  48.   
  49.   #define VAR_RANGE1    "::vim::range(start)"
  50.   #define VAR_RANGE2    "::vim::range(begin)"
  51. --- 79,91 ----
  52.   typedef struct
  53.   {
  54.       Tcl_Interp *interp;
  55. +     int exitvalue;
  56.       int range_start, range_end;
  57.       int lbase;
  58.       char *curbuf, *curwin;
  59.   } tcl_info;
  60.   
  61. ! static tcl_info tclinfo = { NULL, 0, 0, 0, 0, NULL, NULL };
  62.   
  63.   #define VAR_RANGE1    "::vim::range(start)"
  64.   #define VAR_RANGE2    "::vim::range(begin)"
  65. ***************
  66. *** 279,294 ****
  67.    ****************************************************************************/
  68.   
  69.   /*
  70. !  * Replace standard "exit" and "catch" commands.
  71.    *
  72. !  * This is a design flaw in Tcl -  the standard "exit" command just calls
  73. !  * exit() and kills the application.  It should return TCL_EXIT to the
  74. !  * app, which then decides if it wants to terminate or not.  In our case,
  75. !  * we just delete the Tcl interpreter (and create a new one with the next
  76. !  * :tcl command).
  77.    */
  78. - #define TCL_EXIT    5
  79.       static int
  80.   exitcmd(dummy, interp, objc, objv)
  81.       ClientData dummy UNUSED;
  82. --- 280,298 ----
  83.    ****************************************************************************/
  84.   
  85.   /*
  86. !  * Replace standard "exit" command.
  87.    *
  88. !  * Delete the Tcl interpreter; a new one will be created with the next
  89. !  * :tcl command). The exit code is saved (and retrieved in tclexit()).
  90. !  * Since Tcl's exit is never expected to return and this replacement
  91. !  * does, then (except for a trivial case) additional Tcl commands will
  92. !  * be run. Since the interpreter is now marked as deleted, an error
  93. !  * will be returned -- typically "attempt to call eval in deleted
  94. !  * interpreter". Hopefully, at this point, checks for TCL_ERROR take
  95. !  * place and control percolates back up to Vim -- but with this new error
  96. !  * string in the interpreter's result value. Therefore it would be
  97. !  * useless for this routine to return the exit code via Tcl_SetResult().
  98.    */
  99.       static int
  100.   exitcmd(dummy, interp, objc, objv)
  101.       ClientData dummy UNUSED;
  102. ***************
  103. *** 305,351 ****
  104.           break;
  105.           /* FALLTHROUGH */
  106.       case 1:
  107. !         Tcl_SetObjResult(interp, Tcl_NewIntObj(value));
  108. !         return TCL_EXIT;
  109. !     default:
  110. !         Tcl_WrongNumArgs(interp, 1, objv, "?returnCode?");
  111. !     }
  112. !     return TCL_ERROR;
  113. ! }
  114.   
  115. !     static int
  116. ! catchcmd(dummy, interp, objc, objv)
  117. !     ClientData    dummy UNUSED;
  118. !     Tcl_Interp    *interp;
  119. !     int        objc;
  120. !     Tcl_Obj    *CONST objv[];
  121. ! {
  122. !     char    *varname = NULL;
  123. !     int        result;
  124. !     switch (objc)
  125. !     {
  126. !     case 3:
  127. !         varname = Tcl_GetStringFromObj(objv[2], NULL);
  128. !         /* fallthrough */
  129. !     case 2:
  130. !         Tcl_ResetResult(interp);
  131. !         Tcl_AllowExceptions(interp);
  132. !         result = Tcl_EvalObj(interp, objv[1]);
  133. !         if (result == TCL_EXIT)
  134. !         return result;
  135. !         if (varname)
  136. !         {
  137. !         if (Tcl_SetVar(interp, varname, Tcl_GetStringResult(interp), 0) == NULL)
  138. !         {
  139. !             Tcl_SetResult(interp, "couldn't save command result in variable", TCL_STATIC);
  140. !             return TCL_ERROR;
  141. !         }
  142. !         }
  143. !         Tcl_SetObjResult(interp, Tcl_NewIntObj(result));
  144. !         return TCL_OK;
  145.       default:
  146. !         Tcl_WrongNumArgs(interp, 1, objv, "command ?varName?");
  147.       }
  148.       return TCL_ERROR;
  149.   }
  150. --- 309,320 ----
  151.           break;
  152.           /* FALLTHROUGH */
  153.       case 1:
  154. !         tclinfo.exitvalue = value;
  155.   
  156. !         Tcl_DeleteInterp(interp);
  157. !         break;
  158.       default:
  159. !         Tcl_WrongNumArgs(interp, 1, objv, "?returnCode?");
  160.       }
  161.       return TCL_ERROR;
  162.   }
  163. ***************
  164. *** 372,377 ****
  165. --- 341,347 ----
  166.   /*
  167.    *  "::vim::buffer list" - create a list of buffer commands.
  168.    *  "::vim::buffer {N}" - create buffer command for buffer N.
  169. +  *  "::vim::buffer exists {N}" - test if buffer N exists.
  170.    *  "::vim::buffer new" - create a new buffer (not implemented)
  171.    */
  172.       static int
  173. ***************
  174. *** 1663,1669 ****
  175.   static Tcl_ChannelType channel_type =
  176.   {
  177.       "vimmessage",    /* typeName */
  178. !     NULL,        /* version */
  179.       channel_close,    /* closeProc */
  180.       channel_input,    /* inputProc */
  181.       channel_output,    /* outputProc */
  182. --- 1633,1639 ----
  183.   static Tcl_ChannelType channel_type =
  184.   {
  185.       "vimmessage",    /* typeName */
  186. !     TCL_CHANNEL_VERSION_2, /* version */
  187.       channel_close,    /* closeProc */
  188.       channel_input,    /* inputProc */
  189.       channel_output,    /* outputProc */
  190. ***************
  191. *** 1678,1683 ****
  192. --- 1648,1655 ----
  193.       NULL,        /* flushProc */
  194.       NULL,        /* handlerProc */
  195.   #endif
  196. + /* The following should not be necessary since TCL_CHANNEL_VERSION_2 was
  197. +  * set above */
  198.   #ifdef TCL_CHANNEL_VERSION_3
  199.       NULL,        /* wideSeekProc */
  200.   #endif
  201. ***************
  202. *** 1741,1747 ****
  203.       Tcl_Interp *interp;
  204.       static Tcl_Channel ch1, ch2;
  205.   
  206. !     /* replace stdout and stderr */
  207.       ch1 = Tcl_CreateChannel(&channel_type, "vimout", VIMOUT, TCL_WRITABLE);
  208.       ch2 = Tcl_CreateChannel(&channel_type, "vimerr", VIMERR, TCL_WRITABLE);
  209.       Tcl_SetStdChannel(ch1, TCL_STDOUT);
  210. --- 1713,1721 ----
  211.       Tcl_Interp *interp;
  212.       static Tcl_Channel ch1, ch2;
  213.   
  214. !     /* Create replacement channels for stdout and stderr; this has to be
  215. !      * done each time an interpreter is created since the channels are closed
  216. !      * when the interpreter is deleted */
  217.       ch1 = Tcl_CreateChannel(&channel_type, "vimout", VIMOUT, TCL_WRITABLE);
  218.       ch2 = Tcl_CreateChannel(&channel_type, "vimerr", VIMERR, TCL_WRITABLE);
  219.       Tcl_SetStdChannel(ch1, TCL_STDOUT);
  220. ***************
  221. *** 1761,1775 ****
  222.   #endif
  223.   
  224.       Tcl_SetChannelOption(interp, ch1, "-buffering", "line");
  225.       Tcl_SetChannelOption(interp, ch2, "-buffering", "line");
  226.   
  227. !     /* replace some standard Tcl commands */
  228.       Tcl_DeleteCommand(interp, "exit");
  229.       Tcl_CreateObjCommand(interp, "exit", exitcmd,
  230.           (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
  231. -     Tcl_DeleteCommand(interp, "catch");
  232. -     Tcl_CreateObjCommand(interp, "catch", catchcmd,
  233. -         (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
  234.   
  235.       /* new commands, in ::vim namespace */
  236.       Tcl_CreateObjCommand(interp, "::vim::buffer", buffercmd,
  237. --- 1735,1752 ----
  238.   #endif
  239.   
  240.       Tcl_SetChannelOption(interp, ch1, "-buffering", "line");
  241. + #ifdef WIN3264
  242. +     Tcl_SetChannelOption(interp, ch1, "-translation", "lf");
  243. + #endif
  244.       Tcl_SetChannelOption(interp, ch2, "-buffering", "line");
  245. + #ifdef WIN3264
  246. +     Tcl_SetChannelOption(interp, ch2, "-translation", "lf");
  247. + #endif
  248.   
  249. !     /* replace standard Tcl exit command */
  250.       Tcl_DeleteCommand(interp, "exit");
  251.       Tcl_CreateObjCommand(interp, "exit", exitcmd,
  252.           (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
  253.   
  254.       /* new commands, in ::vim namespace */
  255.       Tcl_CreateObjCommand(interp, "::vim::buffer", buffercmd,
  256. ***************
  257. *** 1821,1826 ****
  258. --- 1798,1805 ----
  259.       tclinfo.range_end = row2tcl(eap->line2);
  260.       tclupdatevars();
  261.       }
  262. +     tclinfo.exitvalue = 0;
  263.       return OK;
  264.   }
  265.   
  266. ***************
  267. *** 1884,1913 ****
  268.   {
  269.       int newerr = OK;
  270.   
  271. !     if (error == TCL_EXIT)
  272.       {
  273. -     int retval;
  274.       char buf[50];
  275. -     Tcl_Obj *robj;
  276.   
  277. !     robj = Tcl_GetObjResult(tclinfo.interp);
  278. !     if (Tcl_GetIntFromObj(tclinfo.interp, robj, &retval) != TCL_OK)
  279.       {
  280. !         EMSG(_("E281: TCL ERROR: exit code is not int!? Please report this to vim-dev@vim.org"));
  281. !         newerr = FAIL;
  282.       }
  283.       else
  284. !     {
  285. !         sprintf(buf, _("E572: exit code %d"), retval);
  286. !         tclerrmsg(buf);
  287. !         if (retval == 0)
  288. !         {
  289. !         did_emsg = 0;
  290. !         newerr = OK;
  291. !         }
  292. !         else
  293. !         newerr = FAIL;
  294. !     }
  295.   
  296.       tcldelthisinterp();
  297.       }
  298. --- 1863,1885 ----
  299.   {
  300.       int newerr = OK;
  301.   
  302. !     if (Tcl_InterpDeleted(tclinfo.interp)     /* True if we intercepted Tcl's exit command */
  303. ! #if (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION >= 5) || TCL_MAJOR_VERSION > 8
  304. !     || Tcl_LimitExceeded(tclinfo.interp)  /* True if the interpreter cannot continue */
  305. ! #endif
  306. !     )
  307.       {
  308.       char buf[50];
  309.   
  310. !     sprintf(buf, _("E572: exit code %d"), tclinfo.exitvalue);
  311. !     tclerrmsg(buf);
  312. !     if (tclinfo.exitvalue == 0)
  313.       {
  314. !         did_emsg = 0;
  315. !         newerr = OK;
  316.       }
  317.       else
  318. !         newerr = FAIL;
  319.   
  320.       tcldelthisinterp();
  321.       }
  322. ***************
  323. *** 2021,2027 ****
  324.       Tcl_SetVar(tclinfo.interp, var_line, line, 0);
  325.       Tcl_AllowExceptions(tclinfo.interp);
  326.       err = Tcl_Eval(tclinfo.interp, script);
  327. !     if (err != TCL_OK)
  328.           break;
  329.       line = (char *)Tcl_GetVar(tclinfo.interp, var_line, 0);
  330.       if (line)
  331. --- 1993,2004 ----
  332.       Tcl_SetVar(tclinfo.interp, var_line, line, 0);
  333.       Tcl_AllowExceptions(tclinfo.interp);
  334.       err = Tcl_Eval(tclinfo.interp, script);
  335. !     if (err != TCL_OK
  336. !         || Tcl_InterpDeleted(tclinfo.interp)
  337. ! #if (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION >= 5) || TCL_MAJOR_VERSION > 8
  338. !         || Tcl_LimitExceeded(tclinfo.interp)
  339. ! #endif
  340. !        )
  341.           break;
  342.       line = (char *)Tcl_GetVar(tclinfo.interp, var_line, 0);
  343.       if (line)
  344. *** ../vim-7.3.450/src/version.c    2012-02-22 15:34:05.000000000 +0100
  345. --- src/version.c    2012-02-22 16:00:49.000000000 +0100
  346. ***************
  347. *** 716,717 ****
  348. --- 716,719 ----
  349.   {   /* Add new patch number below this line */
  350. + /**/
  351. +     451,
  352.   /**/
  353.  
  354. -- 
  355. Where do you want to crash today?
  356.  
  357.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  358. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  359. \\\  an exciting new programming language -- http://www.Zimbu.org        ///
  360.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  361.