|
Karsten Hopp |
48ab2c |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
48ab2c |
Subject: Patch 7.3.056
|
|
Karsten Hopp |
48ab2c |
Fcc: outbox
|
|
Karsten Hopp |
48ab2c |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
48ab2c |
Mime-Version: 1.0
|
|
Karsten Hopp |
48ab2c |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
48ab2c |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
48ab2c |
------------
|
|
Karsten Hopp |
48ab2c |
|
|
Karsten Hopp |
48ab2c |
Patch 7.3.056
|
|
Karsten Hopp |
48ab2c |
Problem: "getline" argument in do_cmdline() shadows global.
|
|
Karsten Hopp |
48ab2c |
Solution: Rename the argument.
|
|
Karsten Hopp |
48ab2c |
Files: src/ex_docmd.c
|
|
Karsten Hopp |
48ab2c |
|
|
Karsten Hopp |
48ab2c |
|
|
Karsten Hopp |
48ab2c |
*** ../vim-7.3.055/src/ex_docmd.c 2010-11-10 18:59:50.000000000 +0100
|
|
Karsten Hopp |
48ab2c |
--- src/ex_docmd.c 2010-11-16 11:24:40.000000000 +0100
|
|
Karsten Hopp |
48ab2c |
***************
|
|
Karsten Hopp |
48ab2c |
*** 733,739 ****
|
|
Karsten Hopp |
48ab2c |
* do_cmdline(): execute one Ex command line
|
|
Karsten Hopp |
48ab2c |
*
|
|
Karsten Hopp |
48ab2c |
* 1. Execute "cmdline" when it is not NULL.
|
|
Karsten Hopp |
48ab2c |
! * If "cmdline" is NULL, or more lines are needed, getline() is used.
|
|
Karsten Hopp |
48ab2c |
* 2. Split up in parts separated with '|'.
|
|
Karsten Hopp |
48ab2c |
*
|
|
Karsten Hopp |
48ab2c |
* This function can be called recursively!
|
|
Karsten Hopp |
48ab2c |
--- 733,739 ----
|
|
Karsten Hopp |
48ab2c |
* do_cmdline(): execute one Ex command line
|
|
Karsten Hopp |
48ab2c |
*
|
|
Karsten Hopp |
48ab2c |
* 1. Execute "cmdline" when it is not NULL.
|
|
Karsten Hopp |
48ab2c |
! * If "cmdline" is NULL, or more lines are needed, fgetline() is used.
|
|
Karsten Hopp |
48ab2c |
* 2. Split up in parts separated with '|'.
|
|
Karsten Hopp |
48ab2c |
*
|
|
Karsten Hopp |
48ab2c |
* This function can be called recursively!
|
|
Karsten Hopp |
48ab2c |
***************
|
|
Karsten Hopp |
48ab2c |
*** 741,747 ****
|
|
Karsten Hopp |
48ab2c |
* flags:
|
|
Karsten Hopp |
48ab2c |
* DOCMD_VERBOSE - The command will be included in the error message.
|
|
Karsten Hopp |
48ab2c |
* DOCMD_NOWAIT - Don't call wait_return() and friends.
|
|
Karsten Hopp |
48ab2c |
! * DOCMD_REPEAT - Repeat execution until getline() returns NULL.
|
|
Karsten Hopp |
48ab2c |
* DOCMD_KEYTYPED - Don't reset KeyTyped.
|
|
Karsten Hopp |
48ab2c |
* DOCMD_EXCRESET - Reset the exception environment (used for debugging).
|
|
Karsten Hopp |
48ab2c |
* DOCMD_KEEPLINE - Store first typed line (for repeating with ".").
|
|
Karsten Hopp |
48ab2c |
--- 741,747 ----
|
|
Karsten Hopp |
48ab2c |
* flags:
|
|
Karsten Hopp |
48ab2c |
* DOCMD_VERBOSE - The command will be included in the error message.
|
|
Karsten Hopp |
48ab2c |
* DOCMD_NOWAIT - Don't call wait_return() and friends.
|
|
Karsten Hopp |
48ab2c |
! * DOCMD_REPEAT - Repeat execution until fgetline() returns NULL.
|
|
Karsten Hopp |
48ab2c |
* DOCMD_KEYTYPED - Don't reset KeyTyped.
|
|
Karsten Hopp |
48ab2c |
* DOCMD_EXCRESET - Reset the exception environment (used for debugging).
|
|
Karsten Hopp |
48ab2c |
* DOCMD_KEEPLINE - Store first typed line (for repeating with ".").
|
|
Karsten Hopp |
48ab2c |
***************
|
|
Karsten Hopp |
48ab2c |
*** 749,763 ****
|
|
Karsten Hopp |
48ab2c |
* return FAIL if cmdline could not be executed, OK otherwise
|
|
Karsten Hopp |
48ab2c |
*/
|
|
Karsten Hopp |
48ab2c |
int
|
|
Karsten Hopp |
48ab2c |
! do_cmdline(cmdline, getline, cookie, flags)
|
|
Karsten Hopp |
48ab2c |
char_u *cmdline;
|
|
Karsten Hopp |
48ab2c |
! char_u *(*getline) __ARGS((int, void *, int));
|
|
Karsten Hopp |
48ab2c |
! void *cookie; /* argument for getline() */
|
|
Karsten Hopp |
48ab2c |
int flags;
|
|
Karsten Hopp |
48ab2c |
{
|
|
Karsten Hopp |
48ab2c |
char_u *next_cmdline; /* next cmd to execute */
|
|
Karsten Hopp |
48ab2c |
char_u *cmdline_copy = NULL; /* copy of cmd line */
|
|
Karsten Hopp |
48ab2c |
! int used_getline = FALSE; /* used "getline" to obtain command */
|
|
Karsten Hopp |
48ab2c |
static int recursive = 0; /* recursive depth */
|
|
Karsten Hopp |
48ab2c |
int msg_didout_before_start = 0;
|
|
Karsten Hopp |
48ab2c |
int count = 0; /* line number count */
|
|
Karsten Hopp |
48ab2c |
--- 749,763 ----
|
|
Karsten Hopp |
48ab2c |
* return FAIL if cmdline could not be executed, OK otherwise
|
|
Karsten Hopp |
48ab2c |
*/
|
|
Karsten Hopp |
48ab2c |
int
|
|
Karsten Hopp |
48ab2c |
! do_cmdline(cmdline, fgetline, cookie, flags)
|
|
Karsten Hopp |
48ab2c |
char_u *cmdline;
|
|
Karsten Hopp |
48ab2c |
! char_u *(*fgetline) __ARGS((int, void *, int));
|
|
Karsten Hopp |
48ab2c |
! void *cookie; /* argument for fgetline() */
|
|
Karsten Hopp |
48ab2c |
int flags;
|
|
Karsten Hopp |
48ab2c |
{
|
|
Karsten Hopp |
48ab2c |
char_u *next_cmdline; /* next cmd to execute */
|
|
Karsten Hopp |
48ab2c |
char_u *cmdline_copy = NULL; /* copy of cmd line */
|
|
Karsten Hopp |
48ab2c |
! int used_getline = FALSE; /* used "fgetline" to obtain command */
|
|
Karsten Hopp |
48ab2c |
static int recursive = 0; /* recursive depth */
|
|
Karsten Hopp |
48ab2c |
int msg_didout_before_start = 0;
|
|
Karsten Hopp |
48ab2c |
int count = 0; /* line number count */
|
|
Karsten Hopp |
48ab2c |
***************
|
|
Karsten Hopp |
48ab2c |
*** 775,788 ****
|
|
Karsten Hopp |
48ab2c |
struct msglist **saved_msg_list = NULL;
|
|
Karsten Hopp |
48ab2c |
struct msglist *private_msg_list;
|
|
Karsten Hopp |
48ab2c |
|
|
Karsten Hopp |
48ab2c |
! /* "getline" and "cookie" passed to do_one_cmd() */
|
|
Karsten Hopp |
48ab2c |
char_u *(*cmd_getline) __ARGS((int, void *, int));
|
|
Karsten Hopp |
48ab2c |
void *cmd_cookie;
|
|
Karsten Hopp |
48ab2c |
struct loop_cookie cmd_loop_cookie;
|
|
Karsten Hopp |
48ab2c |
void *real_cookie;
|
|
Karsten Hopp |
48ab2c |
int getline_is_func;
|
|
Karsten Hopp |
48ab2c |
#else
|
|
Karsten Hopp |
48ab2c |
! # define cmd_getline getline
|
|
Karsten Hopp |
48ab2c |
# define cmd_cookie cookie
|
|
Karsten Hopp |
48ab2c |
#endif
|
|
Karsten Hopp |
48ab2c |
static int call_depth = 0; /* recursiveness */
|
|
Karsten Hopp |
48ab2c |
--- 775,788 ----
|
|
Karsten Hopp |
48ab2c |
struct msglist **saved_msg_list = NULL;
|
|
Karsten Hopp |
48ab2c |
struct msglist *private_msg_list;
|
|
Karsten Hopp |
48ab2c |
|
|
Karsten Hopp |
48ab2c |
! /* "fgetline" and "cookie" passed to do_one_cmd() */
|
|
Karsten Hopp |
48ab2c |
char_u *(*cmd_getline) __ARGS((int, void *, int));
|
|
Karsten Hopp |
48ab2c |
void *cmd_cookie;
|
|
Karsten Hopp |
48ab2c |
struct loop_cookie cmd_loop_cookie;
|
|
Karsten Hopp |
48ab2c |
void *real_cookie;
|
|
Karsten Hopp |
48ab2c |
int getline_is_func;
|
|
Karsten Hopp |
48ab2c |
#else
|
|
Karsten Hopp |
48ab2c |
! # define cmd_getline fgetline
|
|
Karsten Hopp |
48ab2c |
# define cmd_cookie cookie
|
|
Karsten Hopp |
48ab2c |
#endif
|
|
Karsten Hopp |
48ab2c |
static int call_depth = 0; /* recursiveness */
|
|
Karsten Hopp |
48ab2c |
***************
|
|
Karsten Hopp |
48ab2c |
*** 822,831 ****
|
|
Karsten Hopp |
48ab2c |
cstack.cs_lflags = 0;
|
|
Karsten Hopp |
48ab2c |
ga_init2(&lines_ga, (int)sizeof(wcmd_T), 10);
|
|
Karsten Hopp |
48ab2c |
|
|
Karsten Hopp |
48ab2c |
! real_cookie = getline_cookie(getline, cookie);
|
|
Karsten Hopp |
48ab2c |
|
|
Karsten Hopp |
48ab2c |
/* Inside a function use a higher nesting level. */
|
|
Karsten Hopp |
48ab2c |
! getline_is_func = getline_equal(getline, cookie, get_func_line);
|
|
Karsten Hopp |
48ab2c |
if (getline_is_func && ex_nesting_level == func_level(real_cookie))
|
|
Karsten Hopp |
48ab2c |
++ex_nesting_level;
|
|
Karsten Hopp |
48ab2c |
|
|
Karsten Hopp |
48ab2c |
--- 822,831 ----
|
|
Karsten Hopp |
48ab2c |
cstack.cs_lflags = 0;
|
|
Karsten Hopp |
48ab2c |
ga_init2(&lines_ga, (int)sizeof(wcmd_T), 10);
|
|
Karsten Hopp |
48ab2c |
|
|
Karsten Hopp |
48ab2c |
! real_cookie = getline_cookie(fgetline, cookie);
|
|
Karsten Hopp |
48ab2c |
|
|
Karsten Hopp |
48ab2c |
/* Inside a function use a higher nesting level. */
|
|
Karsten Hopp |
48ab2c |
! getline_is_func = getline_equal(fgetline, cookie, get_func_line);
|
|
Karsten Hopp |
48ab2c |
if (getline_is_func && ex_nesting_level == func_level(real_cookie))
|
|
Karsten Hopp |
48ab2c |
++ex_nesting_level;
|
|
Karsten Hopp |
48ab2c |
|
|
Karsten Hopp |
48ab2c |
***************
|
|
Karsten Hopp |
48ab2c |
*** 837,843 ****
|
|
Karsten Hopp |
48ab2c |
breakpoint = func_breakpoint(real_cookie);
|
|
Karsten Hopp |
48ab2c |
dbg_tick = func_dbg_tick(real_cookie);
|
|
Karsten Hopp |
48ab2c |
}
|
|
Karsten Hopp |
48ab2c |
! else if (getline_equal(getline, cookie, getsourceline))
|
|
Karsten Hopp |
48ab2c |
{
|
|
Karsten Hopp |
48ab2c |
fname = sourcing_name;
|
|
Karsten Hopp |
48ab2c |
breakpoint = source_breakpoint(real_cookie);
|
|
Karsten Hopp |
48ab2c |
--- 837,843 ----
|
|
Karsten Hopp |
48ab2c |
breakpoint = func_breakpoint(real_cookie);
|
|
Karsten Hopp |
48ab2c |
dbg_tick = func_dbg_tick(real_cookie);
|
|
Karsten Hopp |
48ab2c |
}
|
|
Karsten Hopp |
48ab2c |
! else if (getline_equal(fgetline, cookie, getsourceline))
|
|
Karsten Hopp |
48ab2c |
{
|
|
Karsten Hopp |
48ab2c |
fname = sourcing_name;
|
|
Karsten Hopp |
48ab2c |
breakpoint = source_breakpoint(real_cookie);
|
|
Karsten Hopp |
48ab2c |
***************
|
|
Karsten Hopp |
48ab2c |
*** 881,887 ****
|
|
Karsten Hopp |
48ab2c |
* KeyTyped is only set when calling vgetc(). Reset it here when not
|
|
Karsten Hopp |
48ab2c |
* calling vgetc() (sourced command lines).
|
|
Karsten Hopp |
48ab2c |
*/
|
|
Karsten Hopp |
48ab2c |
! if (!(flags & DOCMD_KEYTYPED) && !getline_equal(getline, cookie, getexline))
|
|
Karsten Hopp |
48ab2c |
KeyTyped = FALSE;
|
|
Karsten Hopp |
48ab2c |
|
|
Karsten Hopp |
48ab2c |
/*
|
|
Karsten Hopp |
48ab2c |
--- 881,888 ----
|
|
Karsten Hopp |
48ab2c |
* KeyTyped is only set when calling vgetc(). Reset it here when not
|
|
Karsten Hopp |
48ab2c |
* calling vgetc() (sourced command lines).
|
|
Karsten Hopp |
48ab2c |
*/
|
|
Karsten Hopp |
48ab2c |
! if (!(flags & DOCMD_KEYTYPED)
|
|
Karsten Hopp |
48ab2c |
! && !getline_equal(fgetline, cookie, getexline))
|
|
Karsten Hopp |
48ab2c |
KeyTyped = FALSE;
|
|
Karsten Hopp |
48ab2c |
|
|
Karsten Hopp |
48ab2c |
/*
|
|
Karsten Hopp |
48ab2c |
***************
|
|
Karsten Hopp |
48ab2c |
*** 894,900 ****
|
|
Karsten Hopp |
48ab2c |
do
|
|
Karsten Hopp |
48ab2c |
{
|
|
Karsten Hopp |
48ab2c |
#ifdef FEAT_EVAL
|
|
Karsten Hopp |
48ab2c |
! getline_is_func = getline_equal(getline, cookie, get_func_line);
|
|
Karsten Hopp |
48ab2c |
#endif
|
|
Karsten Hopp |
48ab2c |
|
|
Karsten Hopp |
48ab2c |
/* stop skipping cmds for an error msg after all endif/while/for */
|
|
Karsten Hopp |
48ab2c |
--- 895,901 ----
|
|
Karsten Hopp |
48ab2c |
do
|
|
Karsten Hopp |
48ab2c |
{
|
|
Karsten Hopp |
48ab2c |
#ifdef FEAT_EVAL
|
|
Karsten Hopp |
48ab2c |
! getline_is_func = getline_equal(fgetline, cookie, get_func_line);
|
|
Karsten Hopp |
48ab2c |
#endif
|
|
Karsten Hopp |
48ab2c |
|
|
Karsten Hopp |
48ab2c |
/* stop skipping cmds for an error msg after all endif/while/for */
|
|
Karsten Hopp |
48ab2c |
***************
|
|
Karsten Hopp |
48ab2c |
*** 909,915 ****
|
|
Karsten Hopp |
48ab2c |
|
|
Karsten Hopp |
48ab2c |
/*
|
|
Karsten Hopp |
48ab2c |
* 1. If repeating a line in a loop, get a line from lines_ga.
|
|
Karsten Hopp |
48ab2c |
! * 2. If no line given: Get an allocated line with getline().
|
|
Karsten Hopp |
48ab2c |
* 3. If a line is given: Make a copy, so we can mess with it.
|
|
Karsten Hopp |
48ab2c |
*/
|
|
Karsten Hopp |
48ab2c |
|
|
Karsten Hopp |
48ab2c |
--- 910,916 ----
|
|
Karsten Hopp |
48ab2c |
|
|
Karsten Hopp |
48ab2c |
/*
|
|
Karsten Hopp |
48ab2c |
* 1. If repeating a line in a loop, get a line from lines_ga.
|
|
Karsten Hopp |
48ab2c |
! * 2. If no line given: Get an allocated line with fgetline().
|
|
Karsten Hopp |
48ab2c |
* 3. If a line is given: Make a copy, so we can mess with it.
|
|
Karsten Hopp |
48ab2c |
*/
|
|
Karsten Hopp |
48ab2c |
|
|
Karsten Hopp |
48ab2c |
***************
|
|
Karsten Hopp |
48ab2c |
*** 938,949 ****
|
|
Karsten Hopp |
48ab2c |
}
|
|
Karsten Hopp |
48ab2c |
#ifdef FEAT_PROFILE
|
|
Karsten Hopp |
48ab2c |
else if (do_profiling == PROF_YES
|
|
Karsten Hopp |
48ab2c |
! && getline_equal(getline, cookie, getsourceline))
|
|
Karsten Hopp |
48ab2c |
script_line_end();
|
|
Karsten Hopp |
48ab2c |
#endif
|
|
Karsten Hopp |
48ab2c |
|
|
Karsten Hopp |
48ab2c |
/* Check if a sourced file hit a ":finish" command. */
|
|
Karsten Hopp |
48ab2c |
! if (source_finished(getline, cookie))
|
|
Karsten Hopp |
48ab2c |
{
|
|
Karsten Hopp |
48ab2c |
retval = FAIL;
|
|
Karsten Hopp |
48ab2c |
break;
|
|
Karsten Hopp |
48ab2c |
--- 939,950 ----
|
|
Karsten Hopp |
48ab2c |
}
|
|
Karsten Hopp |
48ab2c |
#ifdef FEAT_PROFILE
|
|
Karsten Hopp |
48ab2c |
else if (do_profiling == PROF_YES
|
|
Karsten Hopp |
48ab2c |
! && getline_equal(fgetline, cookie, getsourceline))
|
|
Karsten Hopp |
48ab2c |
script_line_end();
|
|
Karsten Hopp |
48ab2c |
#endif
|
|
Karsten Hopp |
48ab2c |
|
|
Karsten Hopp |
48ab2c |
/* Check if a sourced file hit a ":finish" command. */
|
|
Karsten Hopp |
48ab2c |
! if (source_finished(fgetline, cookie))
|
|
Karsten Hopp |
48ab2c |
{
|
|
Karsten Hopp |
48ab2c |
retval = FAIL;
|
|
Karsten Hopp |
48ab2c |
break;
|
|
Karsten Hopp |
48ab2c |
***************
|
|
Karsten Hopp |
48ab2c |
*** 954,960 ****
|
|
Karsten Hopp |
48ab2c |
&& *dbg_tick != debug_tick)
|
|
Karsten Hopp |
48ab2c |
{
|
|
Karsten Hopp |
48ab2c |
*breakpoint = dbg_find_breakpoint(
|
|
Karsten Hopp |
48ab2c |
! getline_equal(getline, cookie, getsourceline),
|
|
Karsten Hopp |
48ab2c |
fname, sourcing_lnum);
|
|
Karsten Hopp |
48ab2c |
*dbg_tick = debug_tick;
|
|
Karsten Hopp |
48ab2c |
}
|
|
Karsten Hopp |
48ab2c |
--- 955,961 ----
|
|
Karsten Hopp |
48ab2c |
&& *dbg_tick != debug_tick)
|
|
Karsten Hopp |
48ab2c |
{
|
|
Karsten Hopp |
48ab2c |
*breakpoint = dbg_find_breakpoint(
|
|
Karsten Hopp |
48ab2c |
! getline_equal(fgetline, cookie, getsourceline),
|
|
Karsten Hopp |
48ab2c |
fname, sourcing_lnum);
|
|
Karsten Hopp |
48ab2c |
*dbg_tick = debug_tick;
|
|
Karsten Hopp |
48ab2c |
}
|
|
Karsten Hopp |
48ab2c |
***************
|
|
Karsten Hopp |
48ab2c |
*** 969,975 ****
|
|
Karsten Hopp |
48ab2c |
dbg_breakpoint(fname, sourcing_lnum);
|
|
Karsten Hopp |
48ab2c |
/* Find next breakpoint. */
|
|
Karsten Hopp |
48ab2c |
*breakpoint = dbg_find_breakpoint(
|
|
Karsten Hopp |
48ab2c |
! getline_equal(getline, cookie, getsourceline),
|
|
Karsten Hopp |
48ab2c |
fname, sourcing_lnum);
|
|
Karsten Hopp |
48ab2c |
*dbg_tick = debug_tick;
|
|
Karsten Hopp |
48ab2c |
}
|
|
Karsten Hopp |
48ab2c |
--- 970,976 ----
|
|
Karsten Hopp |
48ab2c |
dbg_breakpoint(fname, sourcing_lnum);
|
|
Karsten Hopp |
48ab2c |
/* Find next breakpoint. */
|
|
Karsten Hopp |
48ab2c |
*breakpoint = dbg_find_breakpoint(
|
|
Karsten Hopp |
48ab2c |
! getline_equal(fgetline, cookie, getsourceline),
|
|
Karsten Hopp |
48ab2c |
fname, sourcing_lnum);
|
|
Karsten Hopp |
48ab2c |
*dbg_tick = debug_tick;
|
|
Karsten Hopp |
48ab2c |
}
|
|
Karsten Hopp |
48ab2c |
***************
|
|
Karsten Hopp |
48ab2c |
*** 978,984 ****
|
|
Karsten Hopp |
48ab2c |
{
|
|
Karsten Hopp |
48ab2c |
if (getline_is_func)
|
|
Karsten Hopp |
48ab2c |
func_line_start(real_cookie);
|
|
Karsten Hopp |
48ab2c |
! else if (getline_equal(getline, cookie, getsourceline))
|
|
Karsten Hopp |
48ab2c |
script_line_start();
|
|
Karsten Hopp |
48ab2c |
}
|
|
Karsten Hopp |
48ab2c |
# endif
|
|
Karsten Hopp |
48ab2c |
--- 979,985 ----
|
|
Karsten Hopp |
48ab2c |
{
|
|
Karsten Hopp |
48ab2c |
if (getline_is_func)
|
|
Karsten Hopp |
48ab2c |
func_line_start(real_cookie);
|
|
Karsten Hopp |
48ab2c |
! else if (getline_equal(fgetline, cookie, getsourceline))
|
|
Karsten Hopp |
48ab2c |
script_line_start();
|
|
Karsten Hopp |
48ab2c |
}
|
|
Karsten Hopp |
48ab2c |
# endif
|
|
Karsten Hopp |
48ab2c |
***************
|
|
Karsten Hopp |
48ab2c |
*** 987,993 ****
|
|
Karsten Hopp |
48ab2c |
if (cstack.cs_looplevel > 0)
|
|
Karsten Hopp |
48ab2c |
{
|
|
Karsten Hopp |
48ab2c |
/* Inside a while/for loop we need to store the lines and use them
|
|
Karsten Hopp |
48ab2c |
! * again. Pass a different "getline" function to do_one_cmd()
|
|
Karsten Hopp |
48ab2c |
* below, so that it stores lines in or reads them from
|
|
Karsten Hopp |
48ab2c |
* "lines_ga". Makes it possible to define a function inside a
|
|
Karsten Hopp |
48ab2c |
* while/for loop. */
|
|
Karsten Hopp |
48ab2c |
--- 988,994 ----
|
|
Karsten Hopp |
48ab2c |
if (cstack.cs_looplevel > 0)
|
|
Karsten Hopp |
48ab2c |
{
|
|
Karsten Hopp |
48ab2c |
/* Inside a while/for loop we need to store the lines and use them
|
|
Karsten Hopp |
48ab2c |
! * again. Pass a different "fgetline" function to do_one_cmd()
|
|
Karsten Hopp |
48ab2c |
* below, so that it stores lines in or reads them from
|
|
Karsten Hopp |
48ab2c |
* "lines_ga". Makes it possible to define a function inside a
|
|
Karsten Hopp |
48ab2c |
* while/for loop. */
|
|
Karsten Hopp |
48ab2c |
***************
|
|
Karsten Hopp |
48ab2c |
*** 995,1021 ****
|
|
Karsten Hopp |
48ab2c |
cmd_cookie = (void *)&cmd_loop_cookie;
|
|
Karsten Hopp |
48ab2c |
cmd_loop_cookie.lines_gap = &lines_ga;
|
|
Karsten Hopp |
48ab2c |
cmd_loop_cookie.current_line = current_line;
|
|
Karsten Hopp |
48ab2c |
! cmd_loop_cookie.getline = getline;
|
|
Karsten Hopp |
48ab2c |
cmd_loop_cookie.cookie = cookie;
|
|
Karsten Hopp |
48ab2c |
cmd_loop_cookie.repeating = (current_line < lines_ga.ga_len);
|
|
Karsten Hopp |
48ab2c |
}
|
|
Karsten Hopp |
48ab2c |
else
|
|
Karsten Hopp |
48ab2c |
{
|
|
Karsten Hopp |
48ab2c |
! cmd_getline = getline;
|
|
Karsten Hopp |
48ab2c |
cmd_cookie = cookie;
|
|
Karsten Hopp |
48ab2c |
}
|
|
Karsten Hopp |
48ab2c |
#endif
|
|
Karsten Hopp |
48ab2c |
|
|
Karsten Hopp |
48ab2c |
! /* 2. If no line given, get an allocated line with getline(). */
|
|
Karsten Hopp |
48ab2c |
if (next_cmdline == NULL)
|
|
Karsten Hopp |
48ab2c |
{
|
|
Karsten Hopp |
48ab2c |
/*
|
|
Karsten Hopp |
48ab2c |
* Need to set msg_didout for the first line after an ":if",
|
|
Karsten Hopp |
48ab2c |
* otherwise the ":if" will be overwritten.
|
|
Karsten Hopp |
48ab2c |
*/
|
|
Karsten Hopp |
48ab2c |
! if (count == 1 && getline_equal(getline, cookie, getexline))
|
|
Karsten Hopp |
48ab2c |
msg_didout = TRUE;
|
|
Karsten Hopp |
48ab2c |
! if (getline == NULL || (next_cmdline = getline(':', cookie,
|
|
Karsten Hopp |
48ab2c |
#ifdef FEAT_EVAL
|
|
Karsten Hopp |
48ab2c |
cstack.cs_idx < 0 ? 0 : (cstack.cs_idx + 1) * 2
|
|
Karsten Hopp |
48ab2c |
#else
|
|
Karsten Hopp |
48ab2c |
--- 996,1022 ----
|
|
Karsten Hopp |
48ab2c |
cmd_cookie = (void *)&cmd_loop_cookie;
|
|
Karsten Hopp |
48ab2c |
cmd_loop_cookie.lines_gap = &lines_ga;
|
|
Karsten Hopp |
48ab2c |
cmd_loop_cookie.current_line = current_line;
|
|
Karsten Hopp |
48ab2c |
! cmd_loop_cookie.getline = fgetline;
|
|
Karsten Hopp |
48ab2c |
cmd_loop_cookie.cookie = cookie;
|
|
Karsten Hopp |
48ab2c |
cmd_loop_cookie.repeating = (current_line < lines_ga.ga_len);
|
|
Karsten Hopp |
48ab2c |
}
|
|
Karsten Hopp |
48ab2c |
else
|
|
Karsten Hopp |
48ab2c |
{
|
|
Karsten Hopp |
48ab2c |
! cmd_getline = fgetline;
|
|
Karsten Hopp |
48ab2c |
cmd_cookie = cookie;
|
|
Karsten Hopp |
48ab2c |
}
|
|
Karsten Hopp |
48ab2c |
#endif
|
|
Karsten Hopp |
48ab2c |
|
|
Karsten Hopp |
48ab2c |
! /* 2. If no line given, get an allocated line with fgetline(). */
|
|
Karsten Hopp |
48ab2c |
if (next_cmdline == NULL)
|
|
Karsten Hopp |
48ab2c |
{
|
|
Karsten Hopp |
48ab2c |
/*
|
|
Karsten Hopp |
48ab2c |
* Need to set msg_didout for the first line after an ":if",
|
|
Karsten Hopp |
48ab2c |
* otherwise the ":if" will be overwritten.
|
|
Karsten Hopp |
48ab2c |
*/
|
|
Karsten Hopp |
48ab2c |
! if (count == 1 && getline_equal(fgetline, cookie, getexline))
|
|
Karsten Hopp |
48ab2c |
msg_didout = TRUE;
|
|
Karsten Hopp |
48ab2c |
! if (fgetline == NULL || (next_cmdline = fgetline(':', cookie,
|
|
Karsten Hopp |
48ab2c |
#ifdef FEAT_EVAL
|
|
Karsten Hopp |
48ab2c |
cstack.cs_idx < 0 ? 0 : (cstack.cs_idx + 1) * 2
|
|
Karsten Hopp |
48ab2c |
#else
|
|
Karsten Hopp |
48ab2c |
***************
|
|
Karsten Hopp |
48ab2c |
*** 1142,1148 ****
|
|
Karsten Hopp |
48ab2c |
* If the command was typed, remember it for the ':' register.
|
|
Karsten Hopp |
48ab2c |
* Do this AFTER executing the command to make :@: work.
|
|
Karsten Hopp |
48ab2c |
*/
|
|
Karsten Hopp |
48ab2c |
! if (getline_equal(getline, cookie, getexline)
|
|
Karsten Hopp |
48ab2c |
&& new_last_cmdline != NULL)
|
|
Karsten Hopp |
48ab2c |
{
|
|
Karsten Hopp |
48ab2c |
vim_free(last_cmdline);
|
|
Karsten Hopp |
48ab2c |
--- 1143,1149 ----
|
|
Karsten Hopp |
48ab2c |
* If the command was typed, remember it for the ':' register.
|
|
Karsten Hopp |
48ab2c |
* Do this AFTER executing the command to make :@: work.
|
|
Karsten Hopp |
48ab2c |
*/
|
|
Karsten Hopp |
48ab2c |
! if (getline_equal(fgetline, cookie, getexline)
|
|
Karsten Hopp |
48ab2c |
&& new_last_cmdline != NULL)
|
|
Karsten Hopp |
48ab2c |
{
|
|
Karsten Hopp |
48ab2c |
vim_free(last_cmdline);
|
|
Karsten Hopp |
48ab2c |
***************
|
|
Karsten Hopp |
48ab2c |
*** 1163,1169 ****
|
|
Karsten Hopp |
48ab2c |
#ifdef FEAT_EVAL
|
|
Karsten Hopp |
48ab2c |
/* reset did_emsg for a function that is not aborted by an error */
|
|
Karsten Hopp |
48ab2c |
if (did_emsg && !force_abort
|
|
Karsten Hopp |
48ab2c |
! && getline_equal(getline, cookie, get_func_line)
|
|
Karsten Hopp |
48ab2c |
&& !func_has_abort(real_cookie))
|
|
Karsten Hopp |
48ab2c |
did_emsg = FALSE;
|
|
Karsten Hopp |
48ab2c |
|
|
Karsten Hopp |
48ab2c |
--- 1164,1170 ----
|
|
Karsten Hopp |
48ab2c |
#ifdef FEAT_EVAL
|
|
Karsten Hopp |
48ab2c |
/* reset did_emsg for a function that is not aborted by an error */
|
|
Karsten Hopp |
48ab2c |
if (did_emsg && !force_abort
|
|
Karsten Hopp |
48ab2c |
! && getline_equal(fgetline, cookie, get_func_line)
|
|
Karsten Hopp |
48ab2c |
&& !func_has_abort(real_cookie))
|
|
Karsten Hopp |
48ab2c |
did_emsg = FALSE;
|
|
Karsten Hopp |
48ab2c |
|
|
Karsten Hopp |
48ab2c |
***************
|
|
Karsten Hopp |
48ab2c |
*** 1202,1208 ****
|
|
Karsten Hopp |
48ab2c |
if (breakpoint != NULL)
|
|
Karsten Hopp |
48ab2c |
{
|
|
Karsten Hopp |
48ab2c |
*breakpoint = dbg_find_breakpoint(
|
|
Karsten Hopp |
48ab2c |
! getline_equal(getline, cookie, getsourceline),
|
|
Karsten Hopp |
48ab2c |
fname,
|
|
Karsten Hopp |
48ab2c |
((wcmd_T *)lines_ga.ga_data)[current_line].lnum-1);
|
|
Karsten Hopp |
48ab2c |
*dbg_tick = debug_tick;
|
|
Karsten Hopp |
48ab2c |
--- 1203,1209 ----
|
|
Karsten Hopp |
48ab2c |
if (breakpoint != NULL)
|
|
Karsten Hopp |
48ab2c |
{
|
|
Karsten Hopp |
48ab2c |
*breakpoint = dbg_find_breakpoint(
|
|
Karsten Hopp |
48ab2c |
! getline_equal(fgetline, cookie, getsourceline),
|
|
Karsten Hopp |
48ab2c |
fname,
|
|
Karsten Hopp |
48ab2c |
((wcmd_T *)lines_ga.ga_data)[current_line].lnum-1);
|
|
Karsten Hopp |
48ab2c |
*dbg_tick = debug_tick;
|
|
Karsten Hopp |
48ab2c |
***************
|
|
Karsten Hopp |
48ab2c |
*** 1296,1303 ****
|
|
Karsten Hopp |
48ab2c |
#endif
|
|
Karsten Hopp |
48ab2c |
)
|
|
Karsten Hopp |
48ab2c |
&& !(did_emsg && used_getline
|
|
Karsten Hopp |
48ab2c |
! && (getline_equal(getline, cookie, getexmodeline)
|
|
Karsten Hopp |
48ab2c |
! || getline_equal(getline, cookie, getexline)))
|
|
Karsten Hopp |
48ab2c |
&& (next_cmdline != NULL
|
|
Karsten Hopp |
48ab2c |
#ifdef FEAT_EVAL
|
|
Karsten Hopp |
48ab2c |
|| cstack.cs_idx >= 0
|
|
Karsten Hopp |
48ab2c |
--- 1297,1304 ----
|
|
Karsten Hopp |
48ab2c |
#endif
|
|
Karsten Hopp |
48ab2c |
)
|
|
Karsten Hopp |
48ab2c |
&& !(did_emsg && used_getline
|
|
Karsten Hopp |
48ab2c |
! && (getline_equal(fgetline, cookie, getexmodeline)
|
|
Karsten Hopp |
48ab2c |
! || getline_equal(fgetline, cookie, getexline)))
|
|
Karsten Hopp |
48ab2c |
&& (next_cmdline != NULL
|
|
Karsten Hopp |
48ab2c |
#ifdef FEAT_EVAL
|
|
Karsten Hopp |
48ab2c |
|| cstack.cs_idx >= 0
|
|
Karsten Hopp |
48ab2c |
***************
|
|
Karsten Hopp |
48ab2c |
*** 1316,1324 ****
|
|
Karsten Hopp |
48ab2c |
* unclosed conditional.
|
|
Karsten Hopp |
48ab2c |
*/
|
|
Karsten Hopp |
48ab2c |
if (!got_int && !did_throw
|
|
Karsten Hopp |
48ab2c |
! && ((getline_equal(getline, cookie, getsourceline)
|
|
Karsten Hopp |
48ab2c |
! && !source_finished(getline, cookie))
|
|
Karsten Hopp |
48ab2c |
! || (getline_equal(getline, cookie, get_func_line)
|
|
Karsten Hopp |
48ab2c |
&& !func_has_ended(real_cookie))))
|
|
Karsten Hopp |
48ab2c |
{
|
|
Karsten Hopp |
48ab2c |
if (cstack.cs_flags[cstack.cs_idx] & CSF_TRY)
|
|
Karsten Hopp |
48ab2c |
--- 1317,1325 ----
|
|
Karsten Hopp |
48ab2c |
* unclosed conditional.
|
|
Karsten Hopp |
48ab2c |
*/
|
|
Karsten Hopp |
48ab2c |
if (!got_int && !did_throw
|
|
Karsten Hopp |
48ab2c |
! && ((getline_equal(fgetline, cookie, getsourceline)
|
|
Karsten Hopp |
48ab2c |
! && !source_finished(fgetline, cookie))
|
|
Karsten Hopp |
48ab2c |
! || (getline_equal(fgetline, cookie, get_func_line)
|
|
Karsten Hopp |
48ab2c |
&& !func_has_ended(real_cookie))))
|
|
Karsten Hopp |
48ab2c |
{
|
|
Karsten Hopp |
48ab2c |
if (cstack.cs_flags[cstack.cs_idx] & CSF_TRY)
|
|
Karsten Hopp |
48ab2c |
***************
|
|
Karsten Hopp |
48ab2c |
*** 1354,1360 ****
|
|
Karsten Hopp |
48ab2c |
/* If a missing ":endtry", ":endwhile", ":endfor", or ":endif" or a memory
|
|
Karsten Hopp |
48ab2c |
* lack was reported above and the error message is to be converted to an
|
|
Karsten Hopp |
48ab2c |
* exception, do this now after rewinding the cstack. */
|
|
Karsten Hopp |
48ab2c |
! do_errthrow(&cstack, getline_equal(getline, cookie, get_func_line)
|
|
Karsten Hopp |
48ab2c |
? (char_u *)"endfunction" : (char_u *)NULL);
|
|
Karsten Hopp |
48ab2c |
|
|
Karsten Hopp |
48ab2c |
if (trylevel == 0)
|
|
Karsten Hopp |
48ab2c |
--- 1355,1361 ----
|
|
Karsten Hopp |
48ab2c |
/* If a missing ":endtry", ":endwhile", ":endfor", or ":endif" or a memory
|
|
Karsten Hopp |
48ab2c |
* lack was reported above and the error message is to be converted to an
|
|
Karsten Hopp |
48ab2c |
* exception, do this now after rewinding the cstack. */
|
|
Karsten Hopp |
48ab2c |
! do_errthrow(&cstack, getline_equal(fgetline, cookie, get_func_line)
|
|
Karsten Hopp |
48ab2c |
? (char_u *)"endfunction" : (char_u *)NULL);
|
|
Karsten Hopp |
48ab2c |
|
|
Karsten Hopp |
48ab2c |
if (trylevel == 0)
|
|
Karsten Hopp |
48ab2c |
***************
|
|
Karsten Hopp |
48ab2c |
*** 1449,1457 ****
|
|
Karsten Hopp |
48ab2c |
*/
|
|
Karsten Hopp |
48ab2c |
if (did_throw)
|
|
Karsten Hopp |
48ab2c |
need_rethrow = TRUE;
|
|
Karsten Hopp |
48ab2c |
! if ((getline_equal(getline, cookie, getsourceline)
|
|
Karsten Hopp |
48ab2c |
&& ex_nesting_level > source_level(real_cookie))
|
|
Karsten Hopp |
48ab2c |
! || (getline_equal(getline, cookie, get_func_line)
|
|
Karsten Hopp |
48ab2c |
&& ex_nesting_level > func_level(real_cookie) + 1))
|
|
Karsten Hopp |
48ab2c |
{
|
|
Karsten Hopp |
48ab2c |
if (!did_throw)
|
|
Karsten Hopp |
48ab2c |
--- 1450,1458 ----
|
|
Karsten Hopp |
48ab2c |
*/
|
|
Karsten Hopp |
48ab2c |
if (did_throw)
|
|
Karsten Hopp |
48ab2c |
need_rethrow = TRUE;
|
|
Karsten Hopp |
48ab2c |
! if ((getline_equal(fgetline, cookie, getsourceline)
|
|
Karsten Hopp |
48ab2c |
&& ex_nesting_level > source_level(real_cookie))
|
|
Karsten Hopp |
48ab2c |
! || (getline_equal(fgetline, cookie, get_func_line)
|
|
Karsten Hopp |
48ab2c |
&& ex_nesting_level > func_level(real_cookie) + 1))
|
|
Karsten Hopp |
48ab2c |
{
|
|
Karsten Hopp |
48ab2c |
if (!did_throw)
|
|
Karsten Hopp |
48ab2c |
***************
|
|
Karsten Hopp |
48ab2c |
*** 1460,1475 ****
|
|
Karsten Hopp |
48ab2c |
else
|
|
Karsten Hopp |
48ab2c |
{
|
|
Karsten Hopp |
48ab2c |
/* When leaving a function, reduce nesting level. */
|
|
Karsten Hopp |
48ab2c |
! if (getline_equal(getline, cookie, get_func_line))
|
|
Karsten Hopp |
48ab2c |
--ex_nesting_level;
|
|
Karsten Hopp |
48ab2c |
/*
|
|
Karsten Hopp |
48ab2c |
* Go to debug mode when returning from a function in which we are
|
|
Karsten Hopp |
48ab2c |
* single-stepping.
|
|
Karsten Hopp |
48ab2c |
*/
|
|
Karsten Hopp |
48ab2c |
! if ((getline_equal(getline, cookie, getsourceline)
|
|
Karsten Hopp |
48ab2c |
! || getline_equal(getline, cookie, get_func_line))
|
|
Karsten Hopp |
48ab2c |
&& ex_nesting_level + 1 <= debug_break_level)
|
|
Karsten Hopp |
48ab2c |
! do_debug(getline_equal(getline, cookie, getsourceline)
|
|
Karsten Hopp |
48ab2c |
? (char_u *)_("End of sourced file")
|
|
Karsten Hopp |
48ab2c |
: (char_u *)_("End of function"));
|
|
Karsten Hopp |
48ab2c |
}
|
|
Karsten Hopp |
48ab2c |
--- 1461,1476 ----
|
|
Karsten Hopp |
48ab2c |
else
|
|
Karsten Hopp |
48ab2c |
{
|
|
Karsten Hopp |
48ab2c |
/* When leaving a function, reduce nesting level. */
|
|
Karsten Hopp |
48ab2c |
! if (getline_equal(fgetline, cookie, get_func_line))
|
|
Karsten Hopp |
48ab2c |
--ex_nesting_level;
|
|
Karsten Hopp |
48ab2c |
/*
|
|
Karsten Hopp |
48ab2c |
* Go to debug mode when returning from a function in which we are
|
|
Karsten Hopp |
48ab2c |
* single-stepping.
|
|
Karsten Hopp |
48ab2c |
*/
|
|
Karsten Hopp |
48ab2c |
! if ((getline_equal(fgetline, cookie, getsourceline)
|
|
Karsten Hopp |
48ab2c |
! || getline_equal(fgetline, cookie, get_func_line))
|
|
Karsten Hopp |
48ab2c |
&& ex_nesting_level + 1 <= debug_break_level)
|
|
Karsten Hopp |
48ab2c |
! do_debug(getline_equal(fgetline, cookie, getsourceline)
|
|
Karsten Hopp |
48ab2c |
? (char_u *)_("End of sourced file")
|
|
Karsten Hopp |
48ab2c |
: (char_u *)_("End of function"));
|
|
Karsten Hopp |
48ab2c |
}
|
|
Karsten Hopp |
48ab2c |
*** ../vim-7.3.055/src/version.c 2010-11-16 11:28:33.000000000 +0100
|
|
Karsten Hopp |
48ab2c |
--- src/version.c 2010-11-16 11:27:09.000000000 +0100
|
|
Karsten Hopp |
48ab2c |
***************
|
|
Karsten Hopp |
48ab2c |
*** 716,717 ****
|
|
Karsten Hopp |
48ab2c |
--- 716,719 ----
|
|
Karsten Hopp |
48ab2c |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
48ab2c |
+ /**/
|
|
Karsten Hopp |
48ab2c |
+ 56,
|
|
Karsten Hopp |
48ab2c |
/**/
|
|
Karsten Hopp |
48ab2c |
|
|
Karsten Hopp |
48ab2c |
--
|
|
Karsten Hopp |
48ab2c |
Lawmakers made it obligatory for everybody to take at least one bath
|
|
Karsten Hopp |
48ab2c |
each week -- on Saturday night.
|
|
Karsten Hopp |
48ab2c |
[real standing law in Vermont, United States of America]
|
|
Karsten Hopp |
48ab2c |
|
|
Karsten Hopp |
48ab2c |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
48ab2c |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
48ab2c |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
48ab2c |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|