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 / 6.2.475 < prev    next >
Encoding:
Internet Message Format  |  2004-04-15  |  9.6 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.2.475
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=ISO-8859-1
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 6.2.475
  11. Problem:    Commands after "perl <<EOF" are parsed as Vim commands when they
  12.         are not executed.
  13. Solution:   Properly skip over the perl commands.
  14. Files:        src/ex_docmd.c, src/ex_getln.c, src/if_perl.xs, src/if_python.c,
  15.         src/if_ruby.c, src/if_tcl.c, src/misc2.c
  16.  
  17.  
  18. *** ../vim-6.2.474/src/ex_docmd.c    Wed Apr 14 11:08:53 2004
  19. --- src/ex_docmd.c    Fri Apr 16 10:13:10 2004
  20. ***************
  21. *** 127,132 ****
  22. --- 127,136 ----
  23.   
  24.   static int    check_more __ARGS((int, int));
  25.   static linenr_T get_address __ARGS((char_u **, int skip, int to_other_file));
  26. + #if !defined(FEAT_PERL) || !defined(FEAT_PYTHON) || !defined(FEAT_TCL) \
  27. +     || !defined(FEAT_RUBY)
  28. + static void    ex_script_ni __ARGS((exarg_T *eap));
  29. + #endif
  30.   static char_u    *invalid_range __ARGS((exarg_T *eap));
  31.   static void    correct_range __ARGS((exarg_T *eap));
  32.   static char_u    *repl_cmdline __ARGS((exarg_T *eap, char_u *src, int srclen, char_u *repl, char_u **cmdlinep));
  33. ***************
  34. *** 217,236 ****
  35.   # define ex_syntax        ex_ni
  36.   #endif
  37.   #ifndef FEAT_PERL
  38. ! # define ex_perl        ex_ni
  39.   # define ex_perldo        ex_ni
  40.   #endif
  41.   #ifndef FEAT_PYTHON
  42. ! # define ex_python        ex_ni
  43.   # define ex_pyfile        ex_ni
  44.   #endif
  45.   #ifndef FEAT_TCL
  46. ! # define ex_tcl            ex_ni
  47.   # define ex_tcldo        ex_ni
  48.   # define ex_tclfile        ex_ni
  49.   #endif
  50.   #ifndef FEAT_RUBY
  51. ! # define ex_ruby        ex_ni
  52.   # define ex_rubydo        ex_ni
  53.   # define ex_rubyfile        ex_ni
  54.   #endif
  55. --- 221,240 ----
  56.   # define ex_syntax        ex_ni
  57.   #endif
  58.   #ifndef FEAT_PERL
  59. ! # define ex_perl        ex_script_ni
  60.   # define ex_perldo        ex_ni
  61.   #endif
  62.   #ifndef FEAT_PYTHON
  63. ! # define ex_python        ex_script_ni
  64.   # define ex_pyfile        ex_ni
  65.   #endif
  66.   #ifndef FEAT_TCL
  67. ! # define ex_tcl            ex_script_ni
  68.   # define ex_tcldo        ex_ni
  69.   # define ex_tclfile        ex_ni
  70.   #endif
  71.   #ifndef FEAT_RUBY
  72. ! # define ex_ruby        ex_script_ni
  73.   # define ex_rubydo        ex_ni
  74.   # define ex_rubyfile        ex_ni
  75.   #endif
  76. ***************
  77. *** 2367,2381 ****
  78.           case CMD_let:
  79.           case CMD_lockmarks:
  80.           case CMD_match:
  81.           case CMD_psearch:
  82.           case CMD_return:
  83. -         case CMD_throw:
  84.           case CMD_rightbelow:
  85.           case CMD_silent:
  86.           case CMD_smagic:
  87.           case CMD_snomagic:
  88.           case CMD_substitute:
  89.           case CMD_syntax:
  90.           case CMD_tilde:
  91.           case CMD_topleft:
  92.           case CMD_unlet:
  93. --- 2369,2387 ----
  94.           case CMD_let:
  95.           case CMD_lockmarks:
  96.           case CMD_match:
  97. +         case CMD_perl:
  98.           case CMD_psearch:
  99. +         case CMD_python:
  100.           case CMD_return:
  101.           case CMD_rightbelow:
  102. +         case CMD_ruby:
  103.           case CMD_silent:
  104.           case CMD_smagic:
  105.           case CMD_snomagic:
  106.           case CMD_substitute:
  107.           case CMD_syntax:
  108. +         case CMD_tcl:
  109. +         case CMD_throw:
  110.           case CMD_tilde:
  111.           case CMD_topleft:
  112.           case CMD_unlet:
  113. ***************
  114. *** 3779,3784 ****
  115. --- 3785,3807 ----
  116.       if (!eap->skip)
  117.       eap->errmsg = (char_u *)N_("E319: Sorry, the command is not available in this version");
  118.   }
  119. + #if !defined(FEAT_PERL) || !defined(FEAT_PYTHON) || !defined(FEAT_TCL) \
  120. +     || !defined(FEAT_RUBY)
  121. + /*
  122. +  * Function called for script command which is Not Implemented.  NI!
  123. +  * Skips over ":perl <<EOF" constructs.
  124. +  */
  125. +     static void
  126. + ex_script_ni(eap)
  127. +     exarg_T    *eap;
  128. + {
  129. +     if (!eap->skip)
  130. +     ex_ni(eap);
  131. +     else
  132. +     vim_free(script_get(eap, eap->arg));
  133. + }
  134. + #endif
  135.   
  136.   /*
  137.    * Check range in Ex command for validity.
  138. *** ../vim-6.2.474/src/ex_getln.c    Mon Apr  5 20:28:39 2004
  139. --- src/ex_getln.c    Fri Apr 16 10:00:28 2004
  140. ***************
  141. *** 5302,5309 ****
  142.   }
  143.   #endif /* FEAT_CMDWIN */
  144.   
  145. - #if defined(FEAT_PYTHON) || defined(FEAT_RUBY) || defined(FEAT_TCL) \
  146. -     || defined(FEAT_PERL) || defined(PROTO)
  147.   /*
  148.    * Used for commands that either take a simple command string argument, or:
  149.    *    cmd << endmarker
  150. --- 5302,5307 ----
  151. ***************
  152. *** 5349,5352 ****
  153.   
  154.       return (char_u *)ga.ga_data;
  155.   }
  156. - #endif /* SCRIPTS */
  157. --- 5347,5349 ----
  158. *** ../vim-6.2.474/src/if_perl.xs    Wed Oct 29 14:45:27 2003
  159. --- src/if_perl.xs    Fri Apr 16 09:57:54 2004
  160. ***************
  161. *** 567,578 ****
  162. --- 567,586 ----
  163.       SV        *sv;
  164.       SV        *safe;
  165.   
  166. +     script = (char *)script_get(eap, eap->arg);
  167. +     if (eap->skip)
  168. +     {
  169. +     vim_free(script);
  170. +     return;
  171. +     }
  172.       if (perl_interp == NULL)
  173.       {
  174.   #ifdef DYNAMIC_PERL
  175.       if (!perl_enabled(TRUE))
  176.       {
  177.           EMSG(_(e_noperl));
  178. +         vim_free(script);
  179.           return;
  180.       }
  181.   #endif
  182. ***************
  183. *** 584,590 ****
  184.       ENTER;
  185.       SAVETMPS;
  186.   
  187. -     script = (char *)script_get(eap, eap->arg);
  188.       if (script == NULL)
  189.       sv = newSVpv((char *)eap->arg, 0);
  190.       else
  191. --- 592,597 ----
  192. *** ../vim-6.2.474/src/if_python.c    Tue Apr  6 20:19:26 2004
  193. --- src/if_python.c    Fri Apr 16 10:03:07 2004
  194. ***************
  195. *** 524,530 ****
  196.       else
  197.       {
  198.       /* Need to make a copy, value may change when setting new locale. */
  199. !     saved_locale = vim_strsave(saved_locale);
  200.       (void)setlocale(LC_NUMERIC, "C");
  201.       }
  202.   #endif
  203. --- 524,530 ----
  204.       else
  205.       {
  206.       /* Need to make a copy, value may change when setting new locale. */
  207. !     saved_locale = (char *)vim_strsave((char_u *)saved_locale);
  208.       (void)setlocale(LC_NUMERIC, "C");
  209.       }
  210.   #endif
  211. ***************
  212. *** 573,585 ****
  213.       char_u *script;
  214.   
  215.       script = script_get(eap, eap->arg);
  216. !     if (script == NULL)
  217. !     DoPythonCommand(eap, (char *)eap->arg);
  218. !     else
  219.       {
  220. !     DoPythonCommand(eap, (char *)script);
  221. !     vim_free(script);
  222.       }
  223.   }
  224.   
  225.   #define BUFFER_SIZE 1024
  226. --- 573,586 ----
  227.       char_u *script;
  228.   
  229.       script = script_get(eap, eap->arg);
  230. !     if (!eap->skip)
  231.       {
  232. !     if (script == NULL)
  233. !         DoPythonCommand(eap, (char *)eap->arg);
  234. !     else
  235. !         DoPythonCommand(eap, (char *)script);
  236.       }
  237. +     vim_free(script);
  238.   }
  239.   
  240.   #define BUFFER_SIZE 1024
  241. *** ../vim-6.2.474/src/if_ruby.c    Thu Mar 18 12:18:09 2004
  242. --- src/if_ruby.c    Fri Apr 16 10:05:10 2004
  243. ***************
  244. *** 325,343 ****
  245.       int state;
  246.       char *script = NULL;
  247.   
  248. !     if (ensure_ruby_initialized())
  249.       {
  250. -     script = script_get(eap, eap->arg);
  251.       if (script == NULL)
  252.           rb_eval_string_protect((char *)eap->arg, &state);
  253.       else
  254. -     {
  255.           rb_eval_string_protect(script, &state);
  256. -         vim_free(script);
  257. -     }
  258.       if (state)
  259.           error_print(state);
  260.       }
  261.   }
  262.   
  263.   void ex_rubydo(exarg_T *eap)
  264. --- 325,341 ----
  265.       int state;
  266.       char *script = NULL;
  267.   
  268. !     script = script_get(eap, eap->arg);
  269. !     if (!eap->skip && ensure_ruby_initialized())
  270.       {
  271.       if (script == NULL)
  272.           rb_eval_string_protect((char *)eap->arg, &state);
  273.       else
  274.           rb_eval_string_protect(script, &state);
  275.       if (state)
  276.           error_print(state);
  277.       }
  278. +     vim_free(script);
  279.   }
  280.   
  281.   void ex_rubydo(exarg_T *eap)
  282. *** ../vim-6.2.474/src/if_tcl.c    Sat Apr 19 15:21:27 2003
  283. --- src/if_tcl.c    Fri Apr 16 10:04:05 2004
  284. ***************
  285. *** 1931,1950 ****
  286.       char_u    *script;
  287.       int        err;
  288.   
  289. !     err = tclinit(eap);
  290. !     if (err == OK)
  291.       {
  292. !     Tcl_AllowExceptions(tclinfo.interp);
  293. !     script = script_get(eap, eap->arg);
  294. !     if (script == NULL)
  295. !         err = Tcl_Eval(tclinfo.interp, (char *)eap->arg);
  296. !     else
  297.       {
  298. !         err = Tcl_Eval(tclinfo.interp, (char *)script);
  299. !         vim_free(script);
  300.       }
  301. -     err = tclexit(err);
  302.       }
  303.   }
  304.   
  305.   /*
  306. --- 1931,1951 ----
  307.       char_u    *script;
  308.       int        err;
  309.   
  310. !     script = script_get(eap, eap->arg);
  311. !     if (!eap->skip)
  312.       {
  313. !     err = tclinit(eap);
  314. !     if (err == OK)
  315.       {
  316. !         Tcl_AllowExceptions(tclinfo.interp);
  317. !         if (script == NULL)
  318. !         err = Tcl_Eval(tclinfo.interp, (char *)eap->arg);
  319. !         else
  320. !         err = Tcl_Eval(tclinfo.interp, (char *)script);
  321. !         err = tclexit(err);
  322.       }
  323.       }
  324. +     vim_free(script);
  325.   }
  326.   
  327.   /*
  328. *** ../vim-6.2.474/src/misc2.c    Wed Apr  7 13:14:18 2004
  329. --- src/misc2.c    Fri Apr 16 10:18:55 2004
  330. ***************
  331. *** 1582,1592 ****
  332.       return OK;
  333.   }
  334.   
  335. - #if defined(FEAT_EVAL) || defined(FEAT_CMDL_COMPL) || defined(FEAT_PYTHON) \
  336. -     || defined(FEAT_RUBY) || defined(FEAT_TCL) || defined(FEAT_PERL) \
  337. -     || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MOTIF) \
  338. -     || defined(MSWIN_FIND_REPLACE) \
  339. -     || defined(FEAT_CLIENTSERVER) || defined(PROTO)
  340.   /*
  341.    * Concatenate a string to a growarray which contains characters.
  342.    * Note: Does NOT copy the NUL at the end!
  343. --- 1582,1587 ----
  344. ***************
  345. *** 1605,1618 ****
  346.       gap->ga_room -= len;
  347.       }
  348.   }
  349. - #endif
  350.   
  351. - #if defined(FEAT_EVAL) || defined(FEAT_CMDL_COMPL) || defined(FEAT_PYTHON) \
  352. -     || defined(FEAT_RUBY) || defined(FEAT_TCL) || defined(FEAT_PERL) \
  353. -     || defined(FEAT_CLIENTSERVER) \
  354. -     || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MOTIF) \
  355. -     || defined(MSWIN_FIND_REPLACE) \
  356. -     || (defined(FEAT_PRINTER) && defined(FEAT_POSTSCRIPT)) || defined(PROTO)
  357.   /*
  358.    * Append one byte to a growarray which contains bytes.
  359.    */
  360. --- 1600,1606 ----
  361. ***************
  362. *** 1628,1634 ****
  363.       --gap->ga_room;
  364.       }
  365.   }
  366. - #endif
  367.   
  368.   /************************************************************************
  369.    * functions that use lookup tables for various things, generally to do with
  370. --- 1616,1621 ----
  371. *** ../vim-6.2.474/src/version.c    Fri Apr 16 11:08:02 2004
  372. --- src/version.c    Fri Apr 16 11:10:14 2004
  373. ***************
  374. *** 639,640 ****
  375. --- 639,642 ----
  376.   {   /* Add new patch number below this line */
  377. + /**/
  378. +     475,
  379.   /**/
  380.  
  381. -- 
  382. Men may not be seen publicly in any kind of strapless gown.
  383.         [real standing law in Florida, United States of America]
  384.  
  385.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  386. ///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  387. \\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
  388.  \\\  Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
  389.