home *** CD-ROM | disk | FTP | other *** search
- To: vim-dev@vim.org
- Subject: Patch 6.2.475
- Fcc: outbox
- From: Bram Moolenaar <Bram@moolenaar.net>
- Mime-Version: 1.0
- Content-Type: text/plain; charset=ISO-8859-1
- Content-Transfer-Encoding: 8bit
- ------------
-
- Patch 6.2.475
- Problem: Commands after "perl <<EOF" are parsed as Vim commands when they
- are not executed.
- Solution: Properly skip over the perl commands.
- Files: src/ex_docmd.c, src/ex_getln.c, src/if_perl.xs, src/if_python.c,
- src/if_ruby.c, src/if_tcl.c, src/misc2.c
-
-
- *** ../vim-6.2.474/src/ex_docmd.c Wed Apr 14 11:08:53 2004
- --- src/ex_docmd.c Fri Apr 16 10:13:10 2004
- ***************
- *** 127,132 ****
- --- 127,136 ----
-
- static int check_more __ARGS((int, int));
- static linenr_T get_address __ARGS((char_u **, int skip, int to_other_file));
- + #if !defined(FEAT_PERL) || !defined(FEAT_PYTHON) || !defined(FEAT_TCL) \
- + || !defined(FEAT_RUBY)
- + static void ex_script_ni __ARGS((exarg_T *eap));
- + #endif
- static char_u *invalid_range __ARGS((exarg_T *eap));
- static void correct_range __ARGS((exarg_T *eap));
- static char_u *repl_cmdline __ARGS((exarg_T *eap, char_u *src, int srclen, char_u *repl, char_u **cmdlinep));
- ***************
- *** 217,236 ****
- # define ex_syntax ex_ni
- #endif
- #ifndef FEAT_PERL
- ! # define ex_perl ex_ni
- # define ex_perldo ex_ni
- #endif
- #ifndef FEAT_PYTHON
- ! # define ex_python ex_ni
- # define ex_pyfile ex_ni
- #endif
- #ifndef FEAT_TCL
- ! # define ex_tcl ex_ni
- # define ex_tcldo ex_ni
- # define ex_tclfile ex_ni
- #endif
- #ifndef FEAT_RUBY
- ! # define ex_ruby ex_ni
- # define ex_rubydo ex_ni
- # define ex_rubyfile ex_ni
- #endif
- --- 221,240 ----
- # define ex_syntax ex_ni
- #endif
- #ifndef FEAT_PERL
- ! # define ex_perl ex_script_ni
- # define ex_perldo ex_ni
- #endif
- #ifndef FEAT_PYTHON
- ! # define ex_python ex_script_ni
- # define ex_pyfile ex_ni
- #endif
- #ifndef FEAT_TCL
- ! # define ex_tcl ex_script_ni
- # define ex_tcldo ex_ni
- # define ex_tclfile ex_ni
- #endif
- #ifndef FEAT_RUBY
- ! # define ex_ruby ex_script_ni
- # define ex_rubydo ex_ni
- # define ex_rubyfile ex_ni
- #endif
- ***************
- *** 2367,2381 ****
- case CMD_let:
- case CMD_lockmarks:
- case CMD_match:
- case CMD_psearch:
- case CMD_return:
- - case CMD_throw:
- case CMD_rightbelow:
- case CMD_silent:
- case CMD_smagic:
- case CMD_snomagic:
- case CMD_substitute:
- case CMD_syntax:
- case CMD_tilde:
- case CMD_topleft:
- case CMD_unlet:
- --- 2369,2387 ----
- case CMD_let:
- case CMD_lockmarks:
- case CMD_match:
- + case CMD_perl:
- case CMD_psearch:
- + case CMD_python:
- case CMD_return:
- case CMD_rightbelow:
- + case CMD_ruby:
- case CMD_silent:
- case CMD_smagic:
- case CMD_snomagic:
- case CMD_substitute:
- case CMD_syntax:
- + case CMD_tcl:
- + case CMD_throw:
- case CMD_tilde:
- case CMD_topleft:
- case CMD_unlet:
- ***************
- *** 3779,3784 ****
- --- 3785,3807 ----
- if (!eap->skip)
- eap->errmsg = (char_u *)N_("E319: Sorry, the command is not available in this version");
- }
- +
- + #if !defined(FEAT_PERL) || !defined(FEAT_PYTHON) || !defined(FEAT_TCL) \
- + || !defined(FEAT_RUBY)
- + /*
- + * Function called for script command which is Not Implemented. NI!
- + * Skips over ":perl <<EOF" constructs.
- + */
- + static void
- + ex_script_ni(eap)
- + exarg_T *eap;
- + {
- + if (!eap->skip)
- + ex_ni(eap);
- + else
- + vim_free(script_get(eap, eap->arg));
- + }
- + #endif
-
- /*
- * Check range in Ex command for validity.
- *** ../vim-6.2.474/src/ex_getln.c Mon Apr 5 20:28:39 2004
- --- src/ex_getln.c Fri Apr 16 10:00:28 2004
- ***************
- *** 5302,5309 ****
- }
- #endif /* FEAT_CMDWIN */
-
- - #if defined(FEAT_PYTHON) || defined(FEAT_RUBY) || defined(FEAT_TCL) \
- - || defined(FEAT_PERL) || defined(PROTO)
- /*
- * Used for commands that either take a simple command string argument, or:
- * cmd << endmarker
- --- 5302,5307 ----
- ***************
- *** 5349,5352 ****
-
- return (char_u *)ga.ga_data;
- }
- - #endif /* SCRIPTS */
- --- 5347,5349 ----
- *** ../vim-6.2.474/src/if_perl.xs Wed Oct 29 14:45:27 2003
- --- src/if_perl.xs Fri Apr 16 09:57:54 2004
- ***************
- *** 567,578 ****
- --- 567,586 ----
- SV *sv;
- SV *safe;
-
- + script = (char *)script_get(eap, eap->arg);
- + if (eap->skip)
- + {
- + vim_free(script);
- + return;
- + }
- +
- if (perl_interp == NULL)
- {
- #ifdef DYNAMIC_PERL
- if (!perl_enabled(TRUE))
- {
- EMSG(_(e_noperl));
- + vim_free(script);
- return;
- }
- #endif
- ***************
- *** 584,590 ****
- ENTER;
- SAVETMPS;
-
- - script = (char *)script_get(eap, eap->arg);
- if (script == NULL)
- sv = newSVpv((char *)eap->arg, 0);
- else
- --- 592,597 ----
- *** ../vim-6.2.474/src/if_python.c Tue Apr 6 20:19:26 2004
- --- src/if_python.c Fri Apr 16 10:03:07 2004
- ***************
- *** 524,530 ****
- else
- {
- /* Need to make a copy, value may change when setting new locale. */
- ! saved_locale = vim_strsave(saved_locale);
- (void)setlocale(LC_NUMERIC, "C");
- }
- #endif
- --- 524,530 ----
- else
- {
- /* Need to make a copy, value may change when setting new locale. */
- ! saved_locale = (char *)vim_strsave((char_u *)saved_locale);
- (void)setlocale(LC_NUMERIC, "C");
- }
- #endif
- ***************
- *** 573,585 ****
- char_u *script;
-
- script = script_get(eap, eap->arg);
- ! if (script == NULL)
- ! DoPythonCommand(eap, (char *)eap->arg);
- ! else
- {
- ! DoPythonCommand(eap, (char *)script);
- ! vim_free(script);
- }
- }
-
- #define BUFFER_SIZE 1024
- --- 573,586 ----
- char_u *script;
-
- script = script_get(eap, eap->arg);
- ! if (!eap->skip)
- {
- ! if (script == NULL)
- ! DoPythonCommand(eap, (char *)eap->arg);
- ! else
- ! DoPythonCommand(eap, (char *)script);
- }
- + vim_free(script);
- }
-
- #define BUFFER_SIZE 1024
- *** ../vim-6.2.474/src/if_ruby.c Thu Mar 18 12:18:09 2004
- --- src/if_ruby.c Fri Apr 16 10:05:10 2004
- ***************
- *** 325,343 ****
- int state;
- char *script = NULL;
-
- ! if (ensure_ruby_initialized())
- {
- - script = script_get(eap, eap->arg);
- if (script == NULL)
- rb_eval_string_protect((char *)eap->arg, &state);
- else
- - {
- rb_eval_string_protect(script, &state);
- - vim_free(script);
- - }
- if (state)
- error_print(state);
- }
- }
-
- void ex_rubydo(exarg_T *eap)
- --- 325,341 ----
- int state;
- char *script = NULL;
-
- ! script = script_get(eap, eap->arg);
- ! if (!eap->skip && ensure_ruby_initialized())
- {
- if (script == NULL)
- rb_eval_string_protect((char *)eap->arg, &state);
- else
- rb_eval_string_protect(script, &state);
- if (state)
- error_print(state);
- }
- + vim_free(script);
- }
-
- void ex_rubydo(exarg_T *eap)
- *** ../vim-6.2.474/src/if_tcl.c Sat Apr 19 15:21:27 2003
- --- src/if_tcl.c Fri Apr 16 10:04:05 2004
- ***************
- *** 1931,1950 ****
- char_u *script;
- int err;
-
- ! err = tclinit(eap);
- ! if (err == OK)
- {
- ! Tcl_AllowExceptions(tclinfo.interp);
- ! script = script_get(eap, eap->arg);
- ! if (script == NULL)
- ! err = Tcl_Eval(tclinfo.interp, (char *)eap->arg);
- ! else
- {
- ! err = Tcl_Eval(tclinfo.interp, (char *)script);
- ! vim_free(script);
- }
- - err = tclexit(err);
- }
- }
-
- /*
- --- 1931,1951 ----
- char_u *script;
- int err;
-
- ! script = script_get(eap, eap->arg);
- ! if (!eap->skip)
- {
- ! err = tclinit(eap);
- ! if (err == OK)
- {
- ! Tcl_AllowExceptions(tclinfo.interp);
- ! if (script == NULL)
- ! err = Tcl_Eval(tclinfo.interp, (char *)eap->arg);
- ! else
- ! err = Tcl_Eval(tclinfo.interp, (char *)script);
- ! err = tclexit(err);
- }
- }
- + vim_free(script);
- }
-
- /*
- *** ../vim-6.2.474/src/misc2.c Wed Apr 7 13:14:18 2004
- --- src/misc2.c Fri Apr 16 10:18:55 2004
- ***************
- *** 1582,1592 ****
- return OK;
- }
-
- - #if defined(FEAT_EVAL) || defined(FEAT_CMDL_COMPL) || defined(FEAT_PYTHON) \
- - || defined(FEAT_RUBY) || defined(FEAT_TCL) || defined(FEAT_PERL) \
- - || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MOTIF) \
- - || defined(MSWIN_FIND_REPLACE) \
- - || defined(FEAT_CLIENTSERVER) || defined(PROTO)
- /*
- * Concatenate a string to a growarray which contains characters.
- * Note: Does NOT copy the NUL at the end!
- --- 1582,1587 ----
- ***************
- *** 1605,1618 ****
- gap->ga_room -= len;
- }
- }
- - #endif
-
- - #if defined(FEAT_EVAL) || defined(FEAT_CMDL_COMPL) || defined(FEAT_PYTHON) \
- - || defined(FEAT_RUBY) || defined(FEAT_TCL) || defined(FEAT_PERL) \
- - || defined(FEAT_CLIENTSERVER) \
- - || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MOTIF) \
- - || defined(MSWIN_FIND_REPLACE) \
- - || (defined(FEAT_PRINTER) && defined(FEAT_POSTSCRIPT)) || defined(PROTO)
- /*
- * Append one byte to a growarray which contains bytes.
- */
- --- 1600,1606 ----
- ***************
- *** 1628,1634 ****
- --gap->ga_room;
- }
- }
- - #endif
-
- /************************************************************************
- * functions that use lookup tables for various things, generally to do with
- --- 1616,1621 ----
- *** ../vim-6.2.474/src/version.c Fri Apr 16 11:08:02 2004
- --- src/version.c Fri Apr 16 11:10:14 2004
- ***************
- *** 639,640 ****
- --- 639,642 ----
- { /* Add new patch number below this line */
- + /**/
- + 475,
- /**/
-
- --
- Men may not be seen publicly in any kind of strapless gown.
- [real standing law in Florida, United States of America]
-
- /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
- /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
- \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
- \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
-