forked from aniani/vim
patch 7.4.1210
Problem: Using old style function declarations. Solution: Change to new style function declarations. (script by Hirohito Higashi)
This commit is contained in:
parent
02fdaeaa69
commit
52ea13da0f
134
src/main.c
134
src/main.c
@ -165,9 +165,7 @@ VimMain
|
||||
# else
|
||||
main
|
||||
# endif
|
||||
(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
(int argc, char **argv)
|
||||
{
|
||||
char_u *fname = NULL; /* file name from command line */
|
||||
mparm_T params; /* various parameters passed between
|
||||
@ -1534,10 +1532,10 @@ getout(int exitval)
|
||||
* Get a (optional) count for a Vim argument.
|
||||
*/
|
||||
static int
|
||||
get_number_arg(p, idx, def)
|
||||
char_u *p; /* pointer to argument */
|
||||
int *idx; /* index in argument, is incremented */
|
||||
int def; /* default value */
|
||||
get_number_arg(
|
||||
char_u *p, /* pointer to argument */
|
||||
int *idx, /* index in argument, is incremented */
|
||||
int def) /* default value */
|
||||
{
|
||||
if (vim_isdigit(p[*idx]))
|
||||
{
|
||||
@ -1553,7 +1551,7 @@ get_number_arg(p, idx, def)
|
||||
* Setup to use the current locale (for ctype() and many other things).
|
||||
*/
|
||||
static void
|
||||
init_locale()
|
||||
init_locale(void)
|
||||
{
|
||||
setlocale(LC_ALL, "");
|
||||
|
||||
@ -1609,8 +1607,7 @@ init_locale()
|
||||
* by "im" use improved Ex mode.
|
||||
*/
|
||||
static void
|
||||
parse_command_name(parmp)
|
||||
mparm_T *parmp;
|
||||
parse_command_name(mparm_T *parmp)
|
||||
{
|
||||
char_u *initstr;
|
||||
|
||||
@ -1700,8 +1697,7 @@ parse_command_name(parmp)
|
||||
* Also find the --server... arguments and --socketid and --windowid
|
||||
*/
|
||||
static void
|
||||
early_arg_scan(parmp)
|
||||
mparm_T *parmp UNUSED;
|
||||
early_arg_scan(mparm_T *parmp UNUSED)
|
||||
{
|
||||
#if defined(FEAT_XCLIPBOARD) || defined(FEAT_CLIENTSERVER) \
|
||||
|| !defined(FEAT_NETBEANS_INTG)
|
||||
@ -1792,8 +1788,7 @@ early_arg_scan(parmp)
|
||||
* Scan the command line arguments.
|
||||
*/
|
||||
static void
|
||||
command_line_scan(parmp)
|
||||
mparm_T *parmp;
|
||||
command_line_scan(mparm_T *parmp)
|
||||
{
|
||||
int argc = parmp->argc;
|
||||
char **argv = parmp->argv;
|
||||
@ -2512,8 +2507,7 @@ scripterror:
|
||||
* When starting in Ex mode and commands come from a file, set Silent mode.
|
||||
*/
|
||||
static void
|
||||
check_tty(parmp)
|
||||
mparm_T *parmp;
|
||||
check_tty(mparm_T *parmp)
|
||||
{
|
||||
int input_isatty; /* is active input a terminal? */
|
||||
|
||||
@ -2559,7 +2553,7 @@ check_tty(parmp)
|
||||
* Read text from stdin.
|
||||
*/
|
||||
static void
|
||||
read_stdin()
|
||||
read_stdin(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -2593,8 +2587,7 @@ read_stdin()
|
||||
* Also does recovery if "recoverymode" set.
|
||||
*/
|
||||
static void
|
||||
create_windows(parmp)
|
||||
mparm_T *parmp UNUSED;
|
||||
create_windows(mparm_T *parmp UNUSED)
|
||||
{
|
||||
#ifdef FEAT_WINDOWS
|
||||
int dorewind;
|
||||
@ -2747,9 +2740,9 @@ create_windows(parmp)
|
||||
* windows. make_windows() has already opened the windows.
|
||||
*/
|
||||
static void
|
||||
edit_buffers(parmp, cwd)
|
||||
mparm_T *parmp;
|
||||
char_u *cwd; /* current working dir */
|
||||
edit_buffers(
|
||||
mparm_T *parmp,
|
||||
char_u *cwd) /* current working dir */
|
||||
{
|
||||
int arg_idx; /* index in argument list */
|
||||
int i;
|
||||
@ -2876,8 +2869,7 @@ edit_buffers(parmp, cwd)
|
||||
* Execute the commands from --cmd arguments "cmds[cnt]".
|
||||
*/
|
||||
static void
|
||||
exe_pre_commands(parmp)
|
||||
mparm_T *parmp;
|
||||
exe_pre_commands(mparm_T *parmp)
|
||||
{
|
||||
char_u **cmds = parmp->pre_commands;
|
||||
int cnt = parmp->n_pre_commands;
|
||||
@ -2904,8 +2896,7 @@ exe_pre_commands(parmp)
|
||||
* Execute "+", "-c" and "-S" arguments.
|
||||
*/
|
||||
static void
|
||||
exe_commands(parmp)
|
||||
mparm_T *parmp;
|
||||
exe_commands(mparm_T *parmp)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -2949,8 +2940,7 @@ exe_commands(parmp)
|
||||
* Source startup scripts.
|
||||
*/
|
||||
static void
|
||||
source_startup_scripts(parmp)
|
||||
mparm_T *parmp;
|
||||
source_startup_scripts(mparm_T *parmp)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -3108,7 +3098,7 @@ source_startup_scripts(parmp)
|
||||
* Setup to start using the GUI. Exit with an error when not available.
|
||||
*/
|
||||
static void
|
||||
main_start_gui()
|
||||
main_start_gui(void)
|
||||
{
|
||||
#ifdef FEAT_GUI
|
||||
gui.starting = TRUE; /* start GUI a bit later */
|
||||
@ -3126,9 +3116,9 @@ main_start_gui()
|
||||
* Returns FAIL if the environment variable was not executed, OK otherwise.
|
||||
*/
|
||||
int
|
||||
process_env(env, is_viminit)
|
||||
char_u *env;
|
||||
int is_viminit; /* when TRUE, called for VIMINIT */
|
||||
process_env(
|
||||
char_u *env,
|
||||
int is_viminit) /* when TRUE, called for VIMINIT */
|
||||
{
|
||||
char_u *initstr;
|
||||
char_u *save_sourcing_name;
|
||||
@ -3167,8 +3157,7 @@ process_env(env, is_viminit)
|
||||
* Use both stat() and lstat() for extra security.
|
||||
*/
|
||||
static int
|
||||
file_owned(fname)
|
||||
char *fname;
|
||||
file_owned(char *fname)
|
||||
{
|
||||
struct stat s;
|
||||
# ifdef UNIX
|
||||
@ -3189,9 +3178,9 @@ file_owned(fname)
|
||||
* Give an error message main_errors["n"] and exit.
|
||||
*/
|
||||
static void
|
||||
mainerr(n, str)
|
||||
int n; /* one of the ME_ defines */
|
||||
char_u *str; /* extra argument or NULL */
|
||||
mainerr(
|
||||
int n, /* one of the ME_ defines */
|
||||
char_u *str) /* extra argument or NULL */
|
||||
{
|
||||
#if defined(UNIX) || defined(__EMX__) || defined(VMS)
|
||||
reset_signals(); /* kill us with CTRL-C here, if you like */
|
||||
@ -3212,8 +3201,7 @@ mainerr(n, str)
|
||||
}
|
||||
|
||||
void
|
||||
mainerr_arg_missing(str)
|
||||
char_u *str;
|
||||
mainerr_arg_missing(char_u *str)
|
||||
{
|
||||
mainerr(ME_ARG_MISSING, str);
|
||||
}
|
||||
@ -3223,8 +3211,7 @@ mainerr_arg_missing(str)
|
||||
* print a message with three spaces prepended and '\n' appended.
|
||||
*/
|
||||
static void
|
||||
main_msg(s)
|
||||
char *s;
|
||||
main_msg(char *s)
|
||||
{
|
||||
mch_msg(" ");
|
||||
mch_msg(s);
|
||||
@ -3235,7 +3222,7 @@ main_msg(s)
|
||||
* Print messages for "vim -h" or "vim --help" and exit.
|
||||
*/
|
||||
static void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
int i;
|
||||
static char *(use[]) =
|
||||
@ -3431,7 +3418,7 @@ usage()
|
||||
* When "Recover" selected, recover the file.
|
||||
*/
|
||||
static void
|
||||
check_swap_exists_action()
|
||||
check_swap_exists_action(void)
|
||||
{
|
||||
if (swap_exists_action == SEA_QUIT)
|
||||
getout(1);
|
||||
@ -3465,8 +3452,7 @@ gettimeofday(struct timeval *tv, char *dummy)
|
||||
* set "*tv_rel" to the time elapsed so far.
|
||||
*/
|
||||
void
|
||||
time_push(tv_rel, tv_start)
|
||||
void *tv_rel, *tv_start;
|
||||
time_push(void *tv_rel, void *tv_start)
|
||||
{
|
||||
*((struct timeval *)tv_rel) = prev_timeval;
|
||||
gettimeofday(&prev_timeval, NULL);
|
||||
@ -3489,8 +3475,8 @@ time_push(tv_rel, tv_start)
|
||||
* have struct timeval.
|
||||
*/
|
||||
void
|
||||
time_pop(tp)
|
||||
void *tp; /* actually (struct timeval *) */
|
||||
time_pop(
|
||||
void *tp) /* actually (struct timeval *) */
|
||||
{
|
||||
prev_timeval.tv_usec -= ((struct timeval *)tp)->tv_usec;
|
||||
prev_timeval.tv_sec -= ((struct timeval *)tp)->tv_sec;
|
||||
@ -3502,9 +3488,7 @@ time_pop(tp)
|
||||
}
|
||||
|
||||
static void
|
||||
time_diff(then, now)
|
||||
struct timeval *then;
|
||||
struct timeval *now;
|
||||
time_diff(struct timeval *then, struct timeval *now)
|
||||
{
|
||||
long usec;
|
||||
long msec;
|
||||
@ -3516,9 +3500,9 @@ time_diff(then, now)
|
||||
}
|
||||
|
||||
void
|
||||
time_msg(mesg, tv_start)
|
||||
char *mesg;
|
||||
void *tv_start; /* only for do_source: start time; actually
|
||||
time_msg(
|
||||
char *mesg,
|
||||
void *tv_start) /* only for do_source: start time; actually
|
||||
(struct timeval *) */
|
||||
{
|
||||
static struct timeval start;
|
||||
@ -3562,8 +3546,7 @@ static char_u *build_drop_cmd(int filec, char **filev, int tabs, int sendReply);
|
||||
* Do the client-server stuff, unless "--servername ''" was used.
|
||||
*/
|
||||
static void
|
||||
exec_on_server(parmp)
|
||||
mparm_T *parmp;
|
||||
exec_on_server(mparm_T *parmp)
|
||||
{
|
||||
if (parmp->serverName_arg == NULL || *parmp->serverName_arg != NUL)
|
||||
{
|
||||
@ -3605,8 +3588,7 @@ exec_on_server(parmp)
|
||||
* Prepare for running as a Vim server.
|
||||
*/
|
||||
static void
|
||||
prepare_server(parmp)
|
||||
mparm_T *parmp;
|
||||
prepare_server(mparm_T *parmp)
|
||||
{
|
||||
# if defined(FEAT_X11)
|
||||
/*
|
||||
@ -3648,11 +3630,11 @@ prepare_server(parmp)
|
||||
}
|
||||
|
||||
static void
|
||||
cmdsrv_main(argc, argv, serverName_arg, serverStr)
|
||||
int *argc;
|
||||
char **argv;
|
||||
char_u *serverName_arg;
|
||||
char_u **serverStr;
|
||||
cmdsrv_main(
|
||||
int *argc,
|
||||
char **argv,
|
||||
char_u *serverName_arg,
|
||||
char_u **serverStr)
|
||||
{
|
||||
char_u *res;
|
||||
int i;
|
||||
@ -3924,11 +3906,11 @@ cmdsrv_main(argc, argv, serverName_arg, serverStr)
|
||||
* Build a ":drop" command to send to a Vim server.
|
||||
*/
|
||||
static char_u *
|
||||
build_drop_cmd(filec, filev, tabs, sendReply)
|
||||
int filec;
|
||||
char **filev;
|
||||
int tabs; /* Use ":tab drop" instead of ":drop". */
|
||||
int sendReply;
|
||||
build_drop_cmd(
|
||||
int filec,
|
||||
char **filev,
|
||||
int tabs, /* Use ":tab drop" instead of ":drop". */
|
||||
int sendReply)
|
||||
{
|
||||
garray_T ga;
|
||||
int i;
|
||||
@ -4044,9 +4026,7 @@ build_drop_cmd(filec, filev, tabs, sendReply)
|
||||
* Return the name in allocated memory. This doesn't include a serial number.
|
||||
*/
|
||||
static char_u *
|
||||
serverMakeName(arg, cmd)
|
||||
char_u *arg;
|
||||
char *cmd;
|
||||
serverMakeName(char_u *arg, char *cmd)
|
||||
{
|
||||
char_u *p;
|
||||
|
||||
@ -4068,8 +4048,7 @@ serverMakeName(arg, cmd)
|
||||
* Replace termcodes such as <CR> and insert as key presses if there is room.
|
||||
*/
|
||||
void
|
||||
server_to_input_buf(str)
|
||||
char_u *str;
|
||||
server_to_input_buf(char_u *str)
|
||||
{
|
||||
char_u *ptr = NULL;
|
||||
char_u *cpo_save = p_cpo;
|
||||
@ -4110,8 +4089,7 @@ server_to_input_buf(str)
|
||||
* Evaluate an expression that the client sent to a string.
|
||||
*/
|
||||
char_u *
|
||||
eval_client_expr_to_string(expr)
|
||||
char_u *expr;
|
||||
eval_client_expr_to_string(char_u *expr)
|
||||
{
|
||||
char_u *res;
|
||||
int save_dbl = debug_break_level;
|
||||
@ -4151,10 +4129,10 @@ eval_client_expr_to_string(expr)
|
||||
* "*tofree" is set to the result when it needs to be freed later.
|
||||
*/
|
||||
char_u *
|
||||
serverConvert(client_enc, data, tofree)
|
||||
char_u *client_enc UNUSED;
|
||||
char_u *data;
|
||||
char_u **tofree;
|
||||
serverConvert(
|
||||
char_u *client_enc UNUSED,
|
||||
char_u *data,
|
||||
char_u **tofree)
|
||||
{
|
||||
char_u *res = data;
|
||||
|
||||
|
168
src/mark.c
168
src/mark.c
@ -43,8 +43,7 @@ static void write_one_filemark(FILE *fp, xfmark_T *fm, int c1, int c2);
|
||||
* Returns OK on success, FAIL if bad name given.
|
||||
*/
|
||||
int
|
||||
setmark(c)
|
||||
int c;
|
||||
setmark(int c)
|
||||
{
|
||||
return setmark_pos(c, &curwin->w_cursor, curbuf->b_fnum);
|
||||
}
|
||||
@ -55,10 +54,7 @@ setmark(c)
|
||||
* Returns OK on success, FAIL if bad name given.
|
||||
*/
|
||||
int
|
||||
setmark_pos(c, pos, fnum)
|
||||
int c;
|
||||
pos_T *pos;
|
||||
int fnum;
|
||||
setmark_pos(int c, pos_T *pos, int fnum)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -138,7 +134,7 @@ setmark_pos(c, pos, fnum)
|
||||
* jump list.
|
||||
*/
|
||||
void
|
||||
setpcmark()
|
||||
setpcmark(void)
|
||||
{
|
||||
#ifdef FEAT_JUMPLIST
|
||||
int i;
|
||||
@ -198,7 +194,7 @@ setpcmark()
|
||||
* If pcmark was deleted (with "dG") the previous mark is restored.
|
||||
*/
|
||||
void
|
||||
checkpcmark()
|
||||
checkpcmark(void)
|
||||
{
|
||||
if (curwin->w_prev_pcmark.lnum != 0
|
||||
&& (equalpos(curwin->w_pcmark, curwin->w_cursor)
|
||||
@ -214,8 +210,7 @@ checkpcmark()
|
||||
* move "count" positions in the jump list (count may be negative)
|
||||
*/
|
||||
pos_T *
|
||||
movemark(count)
|
||||
int count;
|
||||
movemark(int count)
|
||||
{
|
||||
pos_T *pos;
|
||||
xfmark_T *jmp;
|
||||
@ -274,8 +269,7 @@ movemark(count)
|
||||
* Move "count" positions in the changelist (count may be negative).
|
||||
*/
|
||||
pos_T *
|
||||
movechangelist(count)
|
||||
int count;
|
||||
movechangelist(int count)
|
||||
{
|
||||
int n;
|
||||
|
||||
@ -314,28 +308,23 @@ movechangelist(count)
|
||||
* - -1 if mark is in other file and jumped there (only if changefile is TRUE)
|
||||
*/
|
||||
pos_T *
|
||||
getmark_buf(buf, c, changefile)
|
||||
buf_T *buf;
|
||||
int c;
|
||||
int changefile;
|
||||
getmark_buf(buf_T *buf, int c, int changefile)
|
||||
{
|
||||
return getmark_buf_fnum(buf, c, changefile, NULL);
|
||||
}
|
||||
|
||||
pos_T *
|
||||
getmark(c, changefile)
|
||||
int c;
|
||||
int changefile;
|
||||
getmark(int c, int changefile)
|
||||
{
|
||||
return getmark_buf_fnum(curbuf, c, changefile, NULL);
|
||||
}
|
||||
|
||||
pos_T *
|
||||
getmark_buf_fnum(buf, c, changefile, fnum)
|
||||
buf_T *buf;
|
||||
int c;
|
||||
int changefile;
|
||||
int *fnum;
|
||||
getmark_buf_fnum(
|
||||
buf_T *buf,
|
||||
int c,
|
||||
int changefile,
|
||||
int *fnum)
|
||||
{
|
||||
pos_T *posp;
|
||||
pos_T *startp, *endp;
|
||||
@ -472,10 +461,10 @@ getmark_buf_fnum(buf, c, changefile, fnum)
|
||||
* Returns pointer to pos_T of the next mark or NULL if no mark is found.
|
||||
*/
|
||||
pos_T *
|
||||
getnextmark(startpos, dir, begin_line)
|
||||
pos_T *startpos; /* where to start */
|
||||
int dir; /* direction for search */
|
||||
int begin_line;
|
||||
getnextmark(
|
||||
pos_T *startpos, /* where to start */
|
||||
int dir, /* direction for search */
|
||||
int begin_line)
|
||||
{
|
||||
int i;
|
||||
pos_T *result = NULL;
|
||||
@ -520,8 +509,7 @@ getnextmark(startpos, dir, begin_line)
|
||||
* until the mark is used to avoid a long startup delay.
|
||||
*/
|
||||
static void
|
||||
fname2fnum(fm)
|
||||
xfmark_T *fm;
|
||||
fname2fnum(xfmark_T *fm)
|
||||
{
|
||||
char_u *p;
|
||||
|
||||
@ -561,8 +549,7 @@ fname2fnum(fm)
|
||||
* Used for marks that come from the .viminfo file.
|
||||
*/
|
||||
void
|
||||
fmarks_check_names(buf)
|
||||
buf_T *buf;
|
||||
fmarks_check_names(buf_T *buf)
|
||||
{
|
||||
char_u *name;
|
||||
int i;
|
||||
@ -592,10 +579,7 @@ fmarks_check_names(buf)
|
||||
}
|
||||
|
||||
static void
|
||||
fmarks_check_one(fm, name, buf)
|
||||
xfmark_T *fm;
|
||||
char_u *name;
|
||||
buf_T *buf;
|
||||
fmarks_check_one(xfmark_T *fm, char_u *name, buf_T *buf)
|
||||
{
|
||||
if (fm->fmark.fnum == 0
|
||||
&& fm->fname != NULL
|
||||
@ -612,8 +596,7 @@ fmarks_check_one(fm, name, buf)
|
||||
* Give and error message and return FAIL if not.
|
||||
*/
|
||||
int
|
||||
check_mark(pos)
|
||||
pos_T *pos;
|
||||
check_mark(pos_T *pos)
|
||||
{
|
||||
if (pos == NULL)
|
||||
{
|
||||
@ -642,8 +625,7 @@ check_mark(pos)
|
||||
* Used mainly when trashing the entire buffer during ":e" type commands
|
||||
*/
|
||||
void
|
||||
clrallmarks(buf)
|
||||
buf_T *buf;
|
||||
clrallmarks(buf_T *buf)
|
||||
{
|
||||
static int i = -1;
|
||||
|
||||
@ -676,9 +658,7 @@ clrallmarks(buf)
|
||||
* Returns an allocated string.
|
||||
*/
|
||||
char_u *
|
||||
fm_getname(fmark, lead_len)
|
||||
fmark_T *fmark;
|
||||
int lead_len;
|
||||
fm_getname(fmark_T *fmark, int lead_len)
|
||||
{
|
||||
if (fmark->fnum == curbuf->b_fnum) /* current buffer */
|
||||
return mark_line(&(fmark->mark), lead_len);
|
||||
@ -690,9 +670,7 @@ fm_getname(fmark, lead_len)
|
||||
* The returned string has been allocated.
|
||||
*/
|
||||
static char_u *
|
||||
mark_line(mp, lead_len)
|
||||
pos_T *mp;
|
||||
int lead_len;
|
||||
mark_line(pos_T *mp, int lead_len)
|
||||
{
|
||||
char_u *s, *p;
|
||||
int len;
|
||||
@ -718,8 +696,7 @@ mark_line(mp, lead_len)
|
||||
* print the marks
|
||||
*/
|
||||
void
|
||||
do_marks(eap)
|
||||
exarg_T *eap;
|
||||
do_marks(exarg_T *eap)
|
||||
{
|
||||
char_u *arg = eap->arg;
|
||||
int i;
|
||||
@ -757,12 +734,12 @@ do_marks(eap)
|
||||
}
|
||||
|
||||
static void
|
||||
show_one_mark(c, arg, p, name, current)
|
||||
int c;
|
||||
char_u *arg;
|
||||
pos_T *p;
|
||||
char_u *name;
|
||||
int current; /* in current file */
|
||||
show_one_mark(
|
||||
int c,
|
||||
char_u *arg,
|
||||
pos_T *p,
|
||||
char_u *name,
|
||||
int current) /* in current file */
|
||||
{
|
||||
static int did_title = FALSE;
|
||||
int mustfree = FALSE;
|
||||
@ -815,8 +792,7 @@ show_one_mark(c, arg, p, name, current)
|
||||
* ":delmarks[!] [marks]"
|
||||
*/
|
||||
void
|
||||
ex_delmarks(eap)
|
||||
exarg_T *eap;
|
||||
ex_delmarks(exarg_T *eap)
|
||||
{
|
||||
char_u *p;
|
||||
int from, to;
|
||||
@ -899,8 +875,7 @@ ex_delmarks(eap)
|
||||
* print the jumplist
|
||||
*/
|
||||
void
|
||||
ex_jumps(eap)
|
||||
exarg_T *eap UNUSED;
|
||||
ex_jumps(exarg_T *eap UNUSED)
|
||||
{
|
||||
int i;
|
||||
char_u *name;
|
||||
@ -947,8 +922,7 @@ ex_jumps(eap)
|
||||
* print the changelist
|
||||
*/
|
||||
void
|
||||
ex_changes(eap)
|
||||
exarg_T *eap UNUSED;
|
||||
ex_changes(exarg_T *eap UNUSED)
|
||||
{
|
||||
int i;
|
||||
char_u *name;
|
||||
@ -1025,11 +999,11 @@ ex_changes(eap)
|
||||
* or: mark_adjust(56, 55, MAXLNUM, 2);
|
||||
*/
|
||||
void
|
||||
mark_adjust(line1, line2, amount, amount_after)
|
||||
linenr_T line1;
|
||||
linenr_T line2;
|
||||
long amount;
|
||||
long amount_after;
|
||||
mark_adjust(
|
||||
linenr_T line1,
|
||||
linenr_T line2,
|
||||
long amount,
|
||||
long amount_after)
|
||||
{
|
||||
int i;
|
||||
int fnum = curbuf->b_fnum;
|
||||
@ -1207,11 +1181,11 @@ mark_adjust(line1, line2, amount, amount_after)
|
||||
* position.
|
||||
*/
|
||||
void
|
||||
mark_col_adjust(lnum, mincol, lnum_amount, col_amount)
|
||||
linenr_T lnum;
|
||||
colnr_T mincol;
|
||||
long lnum_amount;
|
||||
long col_amount;
|
||||
mark_col_adjust(
|
||||
linenr_T lnum,
|
||||
colnr_T mincol,
|
||||
long lnum_amount,
|
||||
long col_amount)
|
||||
{
|
||||
int i;
|
||||
int fnum = curbuf->b_fnum;
|
||||
@ -1291,7 +1265,7 @@ mark_col_adjust(lnum, mincol, lnum_amount, col_amount)
|
||||
* jumplist. They will be removed here for the current window.
|
||||
*/
|
||||
static void
|
||||
cleanup_jumplist()
|
||||
cleanup_jumplist(void)
|
||||
{
|
||||
int i;
|
||||
int from, to;
|
||||
@ -1323,9 +1297,7 @@ cleanup_jumplist()
|
||||
* Copy the jumplist from window "from" to window "to".
|
||||
*/
|
||||
void
|
||||
copy_jumplist(from, to)
|
||||
win_T *from;
|
||||
win_T *to;
|
||||
copy_jumplist(win_T *from, win_T *to)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -1343,8 +1315,7 @@ copy_jumplist(from, to)
|
||||
* Free items in the jumplist of window "wp".
|
||||
*/
|
||||
void
|
||||
free_jumplist(wp)
|
||||
win_T *wp;
|
||||
free_jumplist(win_T *wp)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -1355,8 +1326,7 @@ free_jumplist(wp)
|
||||
#endif /* FEAT_JUMPLIST */
|
||||
|
||||
void
|
||||
set_last_cursor(win)
|
||||
win_T *win;
|
||||
set_last_cursor(win_T *win)
|
||||
{
|
||||
if (win->w_buffer != NULL)
|
||||
win->w_buffer->b_last_cursor = win->w_cursor;
|
||||
@ -1364,7 +1334,7 @@ set_last_cursor(win)
|
||||
|
||||
#if defined(EXITFREE) || defined(PROTO)
|
||||
void
|
||||
free_all_marks()
|
||||
free_all_marks(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -1376,9 +1346,7 @@ free_all_marks()
|
||||
|
||||
#if defined(FEAT_VIMINFO) || defined(PROTO)
|
||||
int
|
||||
read_viminfo_filemark(virp, force)
|
||||
vir_T *virp;
|
||||
int force;
|
||||
read_viminfo_filemark(vir_T *virp, int force)
|
||||
{
|
||||
char_u *str;
|
||||
xfmark_T *fm;
|
||||
@ -1438,8 +1406,7 @@ read_viminfo_filemark(virp, force)
|
||||
}
|
||||
|
||||
void
|
||||
write_viminfo_filemarks(fp)
|
||||
FILE *fp;
|
||||
write_viminfo_filemarks(FILE *fp)
|
||||
{
|
||||
int i;
|
||||
char_u *name;
|
||||
@ -1499,11 +1466,11 @@ write_viminfo_filemarks(fp)
|
||||
}
|
||||
|
||||
static void
|
||||
write_one_filemark(fp, fm, c1, c2)
|
||||
FILE *fp;
|
||||
xfmark_T *fm;
|
||||
int c1;
|
||||
int c2;
|
||||
write_one_filemark(
|
||||
FILE *fp,
|
||||
xfmark_T *fm,
|
||||
int c1,
|
||||
int c2)
|
||||
{
|
||||
char_u *name;
|
||||
|
||||
@ -1529,8 +1496,7 @@ write_one_filemark(fp, fm, c1, c2)
|
||||
* Return TRUE if "name" is on removable media (depending on 'viminfo').
|
||||
*/
|
||||
int
|
||||
removable(name)
|
||||
char_u *name;
|
||||
removable(char_u *name)
|
||||
{
|
||||
char_u *p;
|
||||
char_u part[51];
|
||||
@ -1565,8 +1531,7 @@ static void write_one_mark(FILE *fp_out, int c, pos_T *pos);
|
||||
* Return the number of buffers for which marks have been written.
|
||||
*/
|
||||
int
|
||||
write_viminfo_marks(fp_out)
|
||||
FILE *fp_out;
|
||||
write_viminfo_marks(FILE *fp_out)
|
||||
{
|
||||
int count;
|
||||
buf_T *buf;
|
||||
@ -1632,10 +1597,7 @@ write_viminfo_marks(fp_out)
|
||||
}
|
||||
|
||||
static void
|
||||
write_one_mark(fp_out, c, pos)
|
||||
FILE *fp_out;
|
||||
int c;
|
||||
pos_T *pos;
|
||||
write_one_mark(FILE *fp_out, int c, pos_T *pos)
|
||||
{
|
||||
if (pos->lnum != 0)
|
||||
fprintf(fp_out, "\t%c\t%ld\t%d\n", c, (long)pos->lnum, (int)pos->col);
|
||||
@ -1648,12 +1610,12 @@ write_one_mark(fp_out, c, pos)
|
||||
* fp_out == NULL && (flags & VIF_GET_OLDFILES | VIF_FORCEIT): fill v:oldfiles
|
||||
*/
|
||||
void
|
||||
copy_viminfo_marks(virp, fp_out, count, eof, flags)
|
||||
vir_T *virp;
|
||||
FILE *fp_out;
|
||||
int count;
|
||||
int eof;
|
||||
int flags;
|
||||
copy_viminfo_marks(
|
||||
vir_T *virp,
|
||||
FILE *fp_out,
|
||||
int count,
|
||||
int eof,
|
||||
int flags)
|
||||
{
|
||||
char_u *line = virp->vir_line;
|
||||
buf_T *buf;
|
||||
|
425
src/mbyte.c
425
src/mbyte.c
File diff suppressed because it is too large
Load Diff
160
src/memfile.c
160
src/memfile.c
@ -121,9 +121,7 @@ static int mf_hash_grow(mf_hashtab_T *);
|
||||
* return value: identifier for this memory block file.
|
||||
*/
|
||||
memfile_T *
|
||||
mf_open(fname, flags)
|
||||
char_u *fname;
|
||||
int flags;
|
||||
mf_open(char_u *fname, int flags)
|
||||
{
|
||||
memfile_T *mfp;
|
||||
off_t size;
|
||||
@ -223,9 +221,7 @@ mf_open(fname, flags)
|
||||
* return value: FAIL if file could not be opened, OK otherwise
|
||||
*/
|
||||
int
|
||||
mf_open_file(mfp, fname)
|
||||
memfile_T *mfp;
|
||||
char_u *fname;
|
||||
mf_open_file(memfile_T *mfp, char_u *fname)
|
||||
{
|
||||
mf_do_open(mfp, fname, O_RDWR|O_CREAT|O_EXCL); /* try to open the file */
|
||||
|
||||
@ -240,9 +236,7 @@ mf_open_file(mfp, fname)
|
||||
* Close a memory file and delete the associated file if 'del_file' is TRUE.
|
||||
*/
|
||||
void
|
||||
mf_close(mfp, del_file)
|
||||
memfile_T *mfp;
|
||||
int del_file;
|
||||
mf_close(memfile_T *mfp, int del_file)
|
||||
{
|
||||
bhdr_T *hp, *nextp;
|
||||
|
||||
@ -275,9 +269,9 @@ mf_close(mfp, del_file)
|
||||
* Close the swap file for a memfile. Used when 'swapfile' is reset.
|
||||
*/
|
||||
void
|
||||
mf_close_file(buf, getlines)
|
||||
buf_T *buf;
|
||||
int getlines; /* get all lines into memory? */
|
||||
mf_close_file(
|
||||
buf_T *buf,
|
||||
int getlines) /* get all lines into memory? */
|
||||
{
|
||||
memfile_T *mfp;
|
||||
linenr_T lnum;
|
||||
@ -315,9 +309,7 @@ mf_close_file(buf, getlines)
|
||||
* and the size it indicates differs from what was guessed.
|
||||
*/
|
||||
void
|
||||
mf_new_page_size(mfp, new_size)
|
||||
memfile_T *mfp;
|
||||
unsigned new_size;
|
||||
mf_new_page_size(memfile_T *mfp, unsigned new_size)
|
||||
{
|
||||
/* Correct the memory used for block 0 to the new size, because it will be
|
||||
* freed with that size later on. */
|
||||
@ -331,10 +323,7 @@ mf_new_page_size(mfp, new_size)
|
||||
* negative: TRUE if negative block number desired (data block)
|
||||
*/
|
||||
bhdr_T *
|
||||
mf_new(mfp, negative, page_count)
|
||||
memfile_T *mfp;
|
||||
int negative;
|
||||
int page_count;
|
||||
mf_new(memfile_T *mfp, int negative, int page_count)
|
||||
{
|
||||
bhdr_T *hp; /* new bhdr_T */
|
||||
bhdr_T *freep; /* first block in free list */
|
||||
@ -424,10 +413,7 @@ mf_new(mfp, negative, page_count)
|
||||
* Note: The caller should first check a negative nr with mf_trans_del()
|
||||
*/
|
||||
bhdr_T *
|
||||
mf_get(mfp, nr, page_count)
|
||||
memfile_T *mfp;
|
||||
blocknr_T nr;
|
||||
int page_count;
|
||||
mf_get(memfile_T *mfp, blocknr_T nr, int page_count)
|
||||
{
|
||||
bhdr_T *hp;
|
||||
/* doesn't exist */
|
||||
@ -485,11 +471,11 @@ mf_get(mfp, nr, page_count)
|
||||
* no return value, function cannot fail
|
||||
*/
|
||||
void
|
||||
mf_put(mfp, hp, dirty, infile)
|
||||
memfile_T *mfp;
|
||||
bhdr_T *hp;
|
||||
int dirty;
|
||||
int infile;
|
||||
mf_put(
|
||||
memfile_T *mfp,
|
||||
bhdr_T *hp,
|
||||
int dirty,
|
||||
int infile)
|
||||
{
|
||||
int flags;
|
||||
|
||||
@ -512,9 +498,7 @@ mf_put(mfp, hp, dirty, infile)
|
||||
* block *hp is no longer in used, may put it in the free list of memfile *mfp
|
||||
*/
|
||||
void
|
||||
mf_free(mfp, hp)
|
||||
memfile_T *mfp;
|
||||
bhdr_T *hp;
|
||||
mf_free(memfile_T *mfp, bhdr_T *hp)
|
||||
{
|
||||
vim_free(hp->bh_data); /* free the memory */
|
||||
mf_rem_hash(mfp, hp); /* get *hp out of the hash list */
|
||||
@ -553,9 +537,7 @@ fdtofh(int filedescriptor)
|
||||
* Return FAIL for failure, OK otherwise
|
||||
*/
|
||||
int
|
||||
mf_sync(mfp, flags)
|
||||
memfile_T *mfp;
|
||||
int flags;
|
||||
mf_sync(memfile_T *mfp, int flags)
|
||||
{
|
||||
int status;
|
||||
bhdr_T *hp;
|
||||
@ -722,8 +704,7 @@ mf_sync(mfp, flags)
|
||||
* created swapfile.
|
||||
*/
|
||||
void
|
||||
mf_set_dirty(mfp)
|
||||
memfile_T *mfp;
|
||||
mf_set_dirty(memfile_T *mfp)
|
||||
{
|
||||
bhdr_T *hp;
|
||||
|
||||
@ -737,9 +718,7 @@ mf_set_dirty(mfp)
|
||||
* insert block *hp in front of hashlist of memfile *mfp
|
||||
*/
|
||||
static void
|
||||
mf_ins_hash(mfp, hp)
|
||||
memfile_T *mfp;
|
||||
bhdr_T *hp;
|
||||
mf_ins_hash(memfile_T *mfp, bhdr_T *hp)
|
||||
{
|
||||
mf_hash_add_item(&mfp->mf_hash, (mf_hashitem_T *)hp);
|
||||
}
|
||||
@ -748,9 +727,7 @@ mf_ins_hash(mfp, hp)
|
||||
* remove block *hp from hashlist of memfile list *mfp
|
||||
*/
|
||||
static void
|
||||
mf_rem_hash(mfp, hp)
|
||||
memfile_T *mfp;
|
||||
bhdr_T *hp;
|
||||
mf_rem_hash(memfile_T *mfp, bhdr_T *hp)
|
||||
{
|
||||
mf_hash_rem_item(&mfp->mf_hash, (mf_hashitem_T *)hp);
|
||||
}
|
||||
@ -759,9 +736,7 @@ mf_rem_hash(mfp, hp)
|
||||
* look in hash lists of memfile *mfp for block header with number 'nr'
|
||||
*/
|
||||
static bhdr_T *
|
||||
mf_find_hash(mfp, nr)
|
||||
memfile_T *mfp;
|
||||
blocknr_T nr;
|
||||
mf_find_hash(memfile_T *mfp, blocknr_T nr)
|
||||
{
|
||||
return (bhdr_T *)mf_hash_find(&mfp->mf_hash, nr);
|
||||
}
|
||||
@ -770,9 +745,7 @@ mf_find_hash(mfp, nr)
|
||||
* insert block *hp in front of used list of memfile *mfp
|
||||
*/
|
||||
static void
|
||||
mf_ins_used(mfp, hp)
|
||||
memfile_T *mfp;
|
||||
bhdr_T *hp;
|
||||
mf_ins_used(memfile_T *mfp, bhdr_T *hp)
|
||||
{
|
||||
hp->bh_next = mfp->mf_used_first;
|
||||
mfp->mf_used_first = hp;
|
||||
@ -789,9 +762,7 @@ mf_ins_used(mfp, hp)
|
||||
* remove block *hp from used list of memfile *mfp
|
||||
*/
|
||||
static void
|
||||
mf_rem_used(mfp, hp)
|
||||
memfile_T *mfp;
|
||||
bhdr_T *hp;
|
||||
mf_rem_used(memfile_T *mfp, bhdr_T *hp)
|
||||
{
|
||||
if (hp->bh_next == NULL) /* last block in used list */
|
||||
mfp->mf_used_last = hp->bh_prev;
|
||||
@ -815,9 +786,7 @@ mf_rem_used(mfp, hp)
|
||||
* Returns NULL if no block is released.
|
||||
*/
|
||||
static bhdr_T *
|
||||
mf_release(mfp, page_count)
|
||||
memfile_T *mfp;
|
||||
int page_count;
|
||||
mf_release(memfile_T *mfp, int page_count)
|
||||
{
|
||||
bhdr_T *hp;
|
||||
int need_release;
|
||||
@ -899,7 +868,7 @@ mf_release(mfp, page_count)
|
||||
* return TRUE if any memory was released
|
||||
*/
|
||||
int
|
||||
mf_release_all()
|
||||
mf_release_all(void)
|
||||
{
|
||||
buf_T *buf;
|
||||
memfile_T *mfp;
|
||||
@ -943,9 +912,7 @@ mf_release_all()
|
||||
* Allocate a block header and a block of memory for it
|
||||
*/
|
||||
static bhdr_T *
|
||||
mf_alloc_bhdr(mfp, page_count)
|
||||
memfile_T *mfp;
|
||||
int page_count;
|
||||
mf_alloc_bhdr(memfile_T *mfp, int page_count)
|
||||
{
|
||||
bhdr_T *hp;
|
||||
|
||||
@ -966,8 +933,7 @@ mf_alloc_bhdr(mfp, page_count)
|
||||
* Free a block header and the block of memory for it
|
||||
*/
|
||||
static void
|
||||
mf_free_bhdr(hp)
|
||||
bhdr_T *hp;
|
||||
mf_free_bhdr(bhdr_T *hp)
|
||||
{
|
||||
vim_free(hp->bh_data);
|
||||
vim_free(hp);
|
||||
@ -977,9 +943,7 @@ mf_free_bhdr(hp)
|
||||
* insert entry *hp in the free list
|
||||
*/
|
||||
static void
|
||||
mf_ins_free(mfp, hp)
|
||||
memfile_T *mfp;
|
||||
bhdr_T *hp;
|
||||
mf_ins_free(memfile_T *mfp, bhdr_T *hp)
|
||||
{
|
||||
hp->bh_next = mfp->mf_free_first;
|
||||
mfp->mf_free_first = hp;
|
||||
@ -990,8 +954,7 @@ mf_ins_free(mfp, hp)
|
||||
* Note: caller must check that mfp->mf_free_first is not NULL!
|
||||
*/
|
||||
static bhdr_T *
|
||||
mf_rem_free(mfp)
|
||||
memfile_T *mfp;
|
||||
mf_rem_free(memfile_T *mfp)
|
||||
{
|
||||
bhdr_T *hp;
|
||||
|
||||
@ -1006,9 +969,7 @@ mf_rem_free(mfp)
|
||||
* Return FAIL for failure, OK otherwise
|
||||
*/
|
||||
static int
|
||||
mf_read(mfp, hp)
|
||||
memfile_T *mfp;
|
||||
bhdr_T *hp;
|
||||
mf_read(memfile_T *mfp, bhdr_T *hp)
|
||||
{
|
||||
off_t offset;
|
||||
unsigned page_size;
|
||||
@ -1047,9 +1008,7 @@ mf_read(mfp, hp)
|
||||
* Return FAIL for failure, OK otherwise
|
||||
*/
|
||||
static int
|
||||
mf_write(mfp, hp)
|
||||
memfile_T *mfp;
|
||||
bhdr_T *hp;
|
||||
mf_write(memfile_T *mfp, bhdr_T *hp)
|
||||
{
|
||||
off_t offset; /* offset in the file */
|
||||
blocknr_T nr; /* block nr which is being written */
|
||||
@ -1126,11 +1085,11 @@ mf_write(mfp, hp)
|
||||
* Return FAIL or OK.
|
||||
*/
|
||||
static int
|
||||
mf_write_block(mfp, hp, offset, size)
|
||||
memfile_T *mfp;
|
||||
bhdr_T *hp;
|
||||
off_t offset UNUSED;
|
||||
unsigned size;
|
||||
mf_write_block(
|
||||
memfile_T *mfp,
|
||||
bhdr_T *hp,
|
||||
off_t offset UNUSED,
|
||||
unsigned size)
|
||||
{
|
||||
char_u *data = hp->bh_data;
|
||||
int result = OK;
|
||||
@ -1162,9 +1121,7 @@ mf_write_block(mfp, hp, offset, size)
|
||||
* Return FAIL for failure, OK otherwise
|
||||
*/
|
||||
static int
|
||||
mf_trans_add(mfp, hp)
|
||||
memfile_T *mfp;
|
||||
bhdr_T *hp;
|
||||
mf_trans_add(memfile_T *mfp, bhdr_T *hp)
|
||||
{
|
||||
bhdr_T *freep;
|
||||
blocknr_T new_bnum;
|
||||
@ -1227,9 +1184,7 @@ mf_trans_add(mfp, hp)
|
||||
* Return the positive new number when found, the old number when not found
|
||||
*/
|
||||
blocknr_T
|
||||
mf_trans_del(mfp, old_nr)
|
||||
memfile_T *mfp;
|
||||
blocknr_T old_nr;
|
||||
mf_trans_del(memfile_T *mfp, blocknr_T old_nr)
|
||||
{
|
||||
NR_TRANS *np;
|
||||
blocknr_T new_bnum;
|
||||
@ -1256,8 +1211,7 @@ mf_trans_del(mfp, old_nr)
|
||||
* name so we must work out the full path name.
|
||||
*/
|
||||
void
|
||||
mf_set_ffname(mfp)
|
||||
memfile_T *mfp;
|
||||
mf_set_ffname(memfile_T *mfp)
|
||||
{
|
||||
mfp->mf_ffname = FullName_save(mfp->mf_fname, FALSE);
|
||||
}
|
||||
@ -1267,8 +1221,7 @@ mf_set_ffname(mfp)
|
||||
* Used before doing a :cd
|
||||
*/
|
||||
void
|
||||
mf_fullname(mfp)
|
||||
memfile_T *mfp;
|
||||
mf_fullname(memfile_T *mfp)
|
||||
{
|
||||
if (mfp != NULL && mfp->mf_fname != NULL && mfp->mf_ffname != NULL)
|
||||
{
|
||||
@ -1282,8 +1235,7 @@ mf_fullname(mfp)
|
||||
* return TRUE if there are any translations pending for 'mfp'
|
||||
*/
|
||||
int
|
||||
mf_need_trans(mfp)
|
||||
memfile_T *mfp;
|
||||
mf_need_trans(memfile_T *mfp)
|
||||
{
|
||||
return (mfp->mf_fname != NULL && mfp->mf_neg_count > 0);
|
||||
}
|
||||
@ -1294,10 +1246,10 @@ mf_need_trans(mfp)
|
||||
* error occurs).
|
||||
*/
|
||||
static void
|
||||
mf_do_open(mfp, fname, flags)
|
||||
memfile_T *mfp;
|
||||
char_u *fname;
|
||||
int flags; /* flags for open() */
|
||||
mf_do_open(
|
||||
memfile_T *mfp,
|
||||
char_u *fname,
|
||||
int flags) /* flags for open() */
|
||||
{
|
||||
#ifdef HAVE_LSTAT
|
||||
struct stat sb;
|
||||
@ -1385,8 +1337,7 @@ mf_do_open(mfp, fname, flags)
|
||||
* Initialize an empty hash table.
|
||||
*/
|
||||
static void
|
||||
mf_hash_init(mht)
|
||||
mf_hashtab_T *mht;
|
||||
mf_hash_init(mf_hashtab_T *mht)
|
||||
{
|
||||
vim_memset(mht, 0, sizeof(mf_hashtab_T));
|
||||
mht->mht_buckets = mht->mht_small_buckets;
|
||||
@ -1398,8 +1349,7 @@ mf_hash_init(mht)
|
||||
* The hash table must not be used again without another mf_hash_init() call.
|
||||
*/
|
||||
static void
|
||||
mf_hash_free(mht)
|
||||
mf_hashtab_T *mht;
|
||||
mf_hash_free(mf_hashtab_T *mht)
|
||||
{
|
||||
if (mht->mht_buckets != mht->mht_small_buckets)
|
||||
vim_free(mht->mht_buckets);
|
||||
@ -1409,8 +1359,7 @@ mf_hash_free(mht)
|
||||
* Free the array of a hash table and all the items it contains.
|
||||
*/
|
||||
static void
|
||||
mf_hash_free_all(mht)
|
||||
mf_hashtab_T *mht;
|
||||
mf_hash_free_all(mf_hashtab_T *mht)
|
||||
{
|
||||
long_u idx;
|
||||
mf_hashitem_T *mhi;
|
||||
@ -1431,9 +1380,7 @@ mf_hash_free_all(mht)
|
||||
* Returns a pointer to a mf_hashitem_T or NULL if the item was not found.
|
||||
*/
|
||||
static mf_hashitem_T *
|
||||
mf_hash_find(mht, key)
|
||||
mf_hashtab_T *mht;
|
||||
blocknr_T key;
|
||||
mf_hash_find(mf_hashtab_T *mht, blocknr_T key)
|
||||
{
|
||||
mf_hashitem_T *mhi;
|
||||
|
||||
@ -1449,9 +1396,7 @@ mf_hash_find(mht, key)
|
||||
* "mhi" must not be NULL.
|
||||
*/
|
||||
static void
|
||||
mf_hash_add_item(mht, mhi)
|
||||
mf_hashtab_T *mht;
|
||||
mf_hashitem_T *mhi;
|
||||
mf_hash_add_item(mf_hashtab_T *mht, mf_hashitem_T *mhi)
|
||||
{
|
||||
long_u idx;
|
||||
|
||||
@ -1484,9 +1429,7 @@ mf_hash_add_item(mht, mhi)
|
||||
* "mhi" must not be NULL and must have been inserted into "mht".
|
||||
*/
|
||||
static void
|
||||
mf_hash_rem_item(mht, mhi)
|
||||
mf_hashtab_T *mht;
|
||||
mf_hashitem_T *mhi;
|
||||
mf_hash_rem_item(mf_hashtab_T *mht, mf_hashitem_T *mhi)
|
||||
{
|
||||
if (mhi->mhi_prev == NULL)
|
||||
mht->mht_buckets[mhi->mhi_key & mht->mht_mask] = mhi->mhi_next;
|
||||
@ -1508,8 +1451,7 @@ mf_hash_rem_item(mht, mhi)
|
||||
* Returns FAIL when out of memory.
|
||||
*/
|
||||
static int
|
||||
mf_hash_grow(mht)
|
||||
mf_hashtab_T *mht;
|
||||
mf_hash_grow(mf_hashtab_T *mht)
|
||||
{
|
||||
long_u i, j;
|
||||
int shift;
|
||||
|
@ -31,7 +31,7 @@ static void test_mf_hash(void);
|
||||
* Test mf_hash_*() functions.
|
||||
*/
|
||||
static void
|
||||
test_mf_hash()
|
||||
test_mf_hash(void)
|
||||
{
|
||||
mf_hashtab_T ht;
|
||||
mf_hashitem_T *item;
|
||||
@ -138,7 +138,7 @@ test_mf_hash()
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
main(void)
|
||||
{
|
||||
test_mf_hash();
|
||||
return 0;
|
||||
|
297
src/memline.c
297
src/memline.c
@ -278,8 +278,7 @@ static void ml_updatechunk(buf_T *buf, long line, long len, int updtype);
|
||||
* Return FAIL for failure, OK otherwise.
|
||||
*/
|
||||
int
|
||||
ml_open(buf)
|
||||
buf_T *buf;
|
||||
ml_open(buf_T *buf)
|
||||
{
|
||||
memfile_T *mfp;
|
||||
bhdr_T *hp = NULL;
|
||||
@ -437,8 +436,7 @@ error:
|
||||
* Prepare encryption for "buf" for the current key and method.
|
||||
*/
|
||||
static void
|
||||
ml_set_mfp_crypt(buf)
|
||||
buf_T *buf;
|
||||
ml_set_mfp_crypt(buf_T *buf)
|
||||
{
|
||||
if (*buf->b_p_key != NUL)
|
||||
{
|
||||
@ -456,9 +454,7 @@ ml_set_mfp_crypt(buf)
|
||||
* Prepare encryption for "buf" with block 0 "b0p".
|
||||
*/
|
||||
static void
|
||||
ml_set_b0_crypt(buf, b0p)
|
||||
buf_T *buf;
|
||||
ZERO_BL *b0p;
|
||||
ml_set_b0_crypt(buf_T *buf, ZERO_BL *b0p)
|
||||
{
|
||||
if (*buf->b_p_key == NUL)
|
||||
b0p->b0_id[1] = BLOCK0_ID1;
|
||||
@ -485,10 +481,10 @@ ml_set_b0_crypt(buf, b0p)
|
||||
* 'cryptmethod' when 'key' is changed.
|
||||
*/
|
||||
void
|
||||
ml_set_crypt_key(buf, old_key, old_cm)
|
||||
buf_T *buf;
|
||||
char_u *old_key;
|
||||
char_u *old_cm;
|
||||
ml_set_crypt_key(
|
||||
buf_T *buf,
|
||||
char_u *old_key,
|
||||
char_u *old_cm)
|
||||
{
|
||||
memfile_T *mfp = buf->b_ml.ml_mfp;
|
||||
bhdr_T *hp;
|
||||
@ -639,8 +635,7 @@ ml_set_crypt_key(buf, old_key, old_cm)
|
||||
* It may rename the swap file.
|
||||
*/
|
||||
void
|
||||
ml_setname(buf)
|
||||
buf_T *buf;
|
||||
ml_setname(buf_T *buf)
|
||||
{
|
||||
int success = FALSE;
|
||||
memfile_T *mfp;
|
||||
@ -747,7 +742,7 @@ ml_setname(buf)
|
||||
* Used when 'updatecount' changes from zero to non-zero.
|
||||
*/
|
||||
void
|
||||
ml_open_files()
|
||||
ml_open_files(void)
|
||||
{
|
||||
buf_T *buf;
|
||||
|
||||
@ -762,8 +757,7 @@ ml_open_files()
|
||||
* and the memfile will be in memory only (no recovery possible).
|
||||
*/
|
||||
void
|
||||
ml_open_file(buf)
|
||||
buf_T *buf;
|
||||
ml_open_file(buf_T *buf)
|
||||
{
|
||||
memfile_T *mfp;
|
||||
char_u *fname;
|
||||
@ -844,8 +838,8 @@ ml_open_file(buf)
|
||||
* file, or reading into an existing buffer, create a swap file now.
|
||||
*/
|
||||
void
|
||||
check_need_swap(newfile)
|
||||
int newfile; /* reading file into new buffer */
|
||||
check_need_swap(
|
||||
int newfile) /* reading file into new buffer */
|
||||
{
|
||||
if (curbuf->b_may_swap && (!curbuf->b_p_ro || !newfile))
|
||||
ml_open_file(curbuf);
|
||||
@ -856,9 +850,7 @@ check_need_swap(newfile)
|
||||
* If 'del_file' is TRUE, delete the swap file
|
||||
*/
|
||||
void
|
||||
ml_close(buf, del_file)
|
||||
buf_T *buf;
|
||||
int del_file;
|
||||
ml_close(buf_T *buf, int del_file)
|
||||
{
|
||||
if (buf->b_ml.ml_mfp == NULL) /* not open */
|
||||
return;
|
||||
@ -884,8 +876,7 @@ ml_close(buf, del_file)
|
||||
* But don't delete files that were ":preserve"d when we are POSIX compatible.
|
||||
*/
|
||||
void
|
||||
ml_close_all(del_file)
|
||||
int del_file;
|
||||
ml_close_all(int del_file)
|
||||
{
|
||||
buf_T *buf;
|
||||
|
||||
@ -905,7 +896,7 @@ ml_close_all(del_file)
|
||||
* Only use just before exiting!
|
||||
*/
|
||||
void
|
||||
ml_close_notmod()
|
||||
ml_close_notmod(void)
|
||||
{
|
||||
buf_T *buf;
|
||||
|
||||
@ -919,8 +910,7 @@ ml_close_notmod()
|
||||
* Used when the file has been written.
|
||||
*/
|
||||
void
|
||||
ml_timestamp(buf)
|
||||
buf_T *buf;
|
||||
ml_timestamp(buf_T *buf)
|
||||
{
|
||||
ml_upd_block0(buf, UB_FNAME);
|
||||
}
|
||||
@ -929,8 +919,7 @@ ml_timestamp(buf)
|
||||
* Return FAIL when the ID of "b0p" is wrong.
|
||||
*/
|
||||
static int
|
||||
ml_check_b0_id(b0p)
|
||||
ZERO_BL *b0p;
|
||||
ml_check_b0_id(ZERO_BL *b0p)
|
||||
{
|
||||
if (b0p->b0_id[0] != BLOCK0_ID0
|
||||
|| (b0p->b0_id[1] != BLOCK0_ID1
|
||||
@ -946,9 +935,7 @@ ml_check_b0_id(b0p)
|
||||
* Update the timestamp or the B0_SAME_DIR flag of the .swp file.
|
||||
*/
|
||||
static void
|
||||
ml_upd_block0(buf, what)
|
||||
buf_T *buf;
|
||||
upd_block0_T what;
|
||||
ml_upd_block0(buf_T *buf, upd_block0_T what)
|
||||
{
|
||||
memfile_T *mfp;
|
||||
bhdr_T *hp;
|
||||
@ -991,9 +978,7 @@ ml_upd_block0(buf, what)
|
||||
* Don't use NameBuff[]!!!
|
||||
*/
|
||||
static void
|
||||
set_b0_fname(b0p, buf)
|
||||
ZERO_BL *b0p;
|
||||
buf_T *buf;
|
||||
set_b0_fname(ZERO_BL *b0p, buf_T *buf)
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
@ -1072,9 +1057,7 @@ set_b0_fname(b0p, buf)
|
||||
* not set.
|
||||
*/
|
||||
static void
|
||||
set_b0_dir_flag(b0p, buf)
|
||||
ZERO_BL *b0p;
|
||||
buf_T *buf;
|
||||
set_b0_dir_flag(ZERO_BL *b0p, buf_T *buf)
|
||||
{
|
||||
if (same_directory(buf->b_ml.ml_mfp->mf_fname, buf->b_ffname))
|
||||
b0p->b0_flags |= B0_SAME_DIR;
|
||||
@ -1087,9 +1070,9 @@ set_b0_dir_flag(b0p, buf)
|
||||
* When there is room, add the 'fileencoding' to block zero.
|
||||
*/
|
||||
static void
|
||||
add_b0_fenc(b0p, buf)
|
||||
ZERO_BL *b0p;
|
||||
buf_T *buf;
|
||||
add_b0_fenc(
|
||||
ZERO_BL *b0p,
|
||||
buf_T *buf)
|
||||
{
|
||||
int n;
|
||||
int size = B0_FNAME_SIZE_NOCRYPT;
|
||||
@ -1120,7 +1103,7 @@ add_b0_fenc(b0p, buf)
|
||||
* Try to recover curbuf from the .swp file.
|
||||
*/
|
||||
void
|
||||
ml_recover()
|
||||
ml_recover(void)
|
||||
{
|
||||
buf_T *buf = NULL;
|
||||
memfile_T *mfp = NULL;
|
||||
@ -1778,11 +1761,11 @@ theend:
|
||||
* - find the name of the n'th swap file when recovering
|
||||
*/
|
||||
int
|
||||
recover_names(fname, list, nr, fname_out)
|
||||
char_u *fname; /* base for swap file name */
|
||||
int list; /* when TRUE, list the swap file names */
|
||||
int nr; /* when non-zero, return nr'th swap file name */
|
||||
char_u **fname_out; /* result when "nr" > 0 */
|
||||
recover_names(
|
||||
char_u *fname, /* base for swap file name */
|
||||
int list, /* when TRUE, list the swap file names */
|
||||
int nr, /* when non-zero, return nr'th swap file name */
|
||||
char_u **fname_out) /* result when "nr" > 0 */
|
||||
{
|
||||
int num_names;
|
||||
char_u *(names[6]);
|
||||
@ -2038,9 +2021,7 @@ recover_names(fname, list, nr, fname_out)
|
||||
* signs, to dir. An unnamed buffer is handled as "" (<currentdir>/"")
|
||||
*/
|
||||
static char_u *
|
||||
make_percent_swname(dir, name)
|
||||
char_u *dir;
|
||||
char_u *name;
|
||||
make_percent_swname(char_u *dir, char_u *name)
|
||||
{
|
||||
char_u *d, *s, *f;
|
||||
|
||||
@ -2073,8 +2054,7 @@ static int process_still_running;
|
||||
* Returns timestamp (0 when unknown).
|
||||
*/
|
||||
static time_t
|
||||
swapfile_info(fname)
|
||||
char_u *fname;
|
||||
swapfile_info(char_u *fname)
|
||||
{
|
||||
struct stat st;
|
||||
int fd;
|
||||
@ -2188,10 +2168,7 @@ swapfile_info(fname)
|
||||
}
|
||||
|
||||
static int
|
||||
recov_file_names(names, path, prepend_dot)
|
||||
char_u **names;
|
||||
char_u *path;
|
||||
int prepend_dot;
|
||||
recov_file_names(char_u **names, char_u *path, int prepend_dot)
|
||||
{
|
||||
int num_names;
|
||||
|
||||
@ -2298,9 +2275,7 @@ end:
|
||||
* always sync at least one block.
|
||||
*/
|
||||
void
|
||||
ml_sync_all(check_file, check_char)
|
||||
int check_file;
|
||||
int check_char;
|
||||
ml_sync_all(int check_file, int check_char)
|
||||
{
|
||||
buf_T *buf;
|
||||
struct stat st;
|
||||
@ -2350,9 +2325,7 @@ ml_sync_all(check_file, check_char)
|
||||
* when message is TRUE the success of preserving is reported
|
||||
*/
|
||||
void
|
||||
ml_preserve(buf, message)
|
||||
buf_T *buf;
|
||||
int message;
|
||||
ml_preserve(buf_T *buf, int message)
|
||||
{
|
||||
bhdr_T *hp;
|
||||
linenr_T lnum;
|
||||
@ -2436,8 +2409,7 @@ theend:
|
||||
* having to check for error everywhere).
|
||||
*/
|
||||
char_u *
|
||||
ml_get(lnum)
|
||||
linenr_T lnum;
|
||||
ml_get(linenr_T lnum)
|
||||
{
|
||||
return ml_get_buf(curbuf, lnum, FALSE);
|
||||
}
|
||||
@ -2446,8 +2418,7 @@ ml_get(lnum)
|
||||
* Return pointer to position "pos".
|
||||
*/
|
||||
char_u *
|
||||
ml_get_pos(pos)
|
||||
pos_T *pos;
|
||||
ml_get_pos(pos_T *pos)
|
||||
{
|
||||
return (ml_get_buf(curbuf, pos->lnum, FALSE) + pos->col);
|
||||
}
|
||||
@ -2456,7 +2427,7 @@ ml_get_pos(pos)
|
||||
* Return pointer to cursor line.
|
||||
*/
|
||||
char_u *
|
||||
ml_get_curline()
|
||||
ml_get_curline(void)
|
||||
{
|
||||
return ml_get_buf(curbuf, curwin->w_cursor.lnum, FALSE);
|
||||
}
|
||||
@ -2465,7 +2436,7 @@ ml_get_curline()
|
||||
* Return pointer to cursor position.
|
||||
*/
|
||||
char_u *
|
||||
ml_get_cursor()
|
||||
ml_get_cursor(void)
|
||||
{
|
||||
return (ml_get_buf(curbuf, curwin->w_cursor.lnum, FALSE) +
|
||||
curwin->w_cursor.col);
|
||||
@ -2478,10 +2449,10 @@ ml_get_cursor()
|
||||
* changed)
|
||||
*/
|
||||
char_u *
|
||||
ml_get_buf(buf, lnum, will_change)
|
||||
buf_T *buf;
|
||||
linenr_T lnum;
|
||||
int will_change; /* line will be changed */
|
||||
ml_get_buf(
|
||||
buf_T *buf,
|
||||
linenr_T lnum,
|
||||
int will_change) /* line will be changed */
|
||||
{
|
||||
bhdr_T *hp;
|
||||
DATA_BL *dp;
|
||||
@ -2554,7 +2525,7 @@ errorret:
|
||||
* is in allocated memory.
|
||||
*/
|
||||
int
|
||||
ml_line_alloced()
|
||||
ml_line_alloced(void)
|
||||
{
|
||||
return (curbuf->b_ml.ml_flags & ML_LINE_DIRTY);
|
||||
}
|
||||
@ -2572,11 +2543,11 @@ ml_line_alloced()
|
||||
* return FAIL for failure, OK otherwise
|
||||
*/
|
||||
int
|
||||
ml_append(lnum, line, len, newfile)
|
||||
linenr_T lnum; /* append after this line (can be 0) */
|
||||
char_u *line; /* text of the new line */
|
||||
colnr_T len; /* length of new line, including NUL, or 0 */
|
||||
int newfile; /* flag, see above */
|
||||
ml_append(
|
||||
linenr_T lnum, /* append after this line (can be 0) */
|
||||
char_u *line, /* text of the new line */
|
||||
colnr_T len, /* length of new line, including NUL, or 0 */
|
||||
int newfile) /* flag, see above */
|
||||
{
|
||||
/* When starting up, we might still need to create the memfile */
|
||||
if (curbuf->b_ml.ml_mfp == NULL && open_buffer(FALSE, NULL, 0) == FAIL)
|
||||
@ -2593,12 +2564,12 @@ ml_append(lnum, line, len, newfile)
|
||||
* a memline.
|
||||
*/
|
||||
int
|
||||
ml_append_buf(buf, lnum, line, len, newfile)
|
||||
buf_T *buf;
|
||||
linenr_T lnum; /* append after this line (can be 0) */
|
||||
char_u *line; /* text of the new line */
|
||||
colnr_T len; /* length of new line, including NUL, or 0 */
|
||||
int newfile; /* flag, see above */
|
||||
ml_append_buf(
|
||||
buf_T *buf,
|
||||
linenr_T lnum, /* append after this line (can be 0) */
|
||||
char_u *line, /* text of the new line */
|
||||
colnr_T len, /* length of new line, including NUL, or 0 */
|
||||
int newfile) /* flag, see above */
|
||||
{
|
||||
if (buf->b_ml.ml_mfp == NULL)
|
||||
return FAIL;
|
||||
@ -2610,13 +2581,13 @@ ml_append_buf(buf, lnum, line, len, newfile)
|
||||
#endif
|
||||
|
||||
static int
|
||||
ml_append_int(buf, lnum, line, len, newfile, mark)
|
||||
buf_T *buf;
|
||||
linenr_T lnum; /* append after this line (can be 0) */
|
||||
char_u *line; /* text of the new line */
|
||||
colnr_T len; /* length of line, including NUL, or 0 */
|
||||
int newfile; /* flag, see above */
|
||||
int mark; /* mark the new line */
|
||||
ml_append_int(
|
||||
buf_T *buf,
|
||||
linenr_T lnum, /* append after this line (can be 0) */
|
||||
char_u *line, /* text of the new line */
|
||||
colnr_T len, /* length of line, including NUL, or 0 */
|
||||
int newfile, /* flag, see above */
|
||||
int mark) /* mark the new line */
|
||||
{
|
||||
int i;
|
||||
int line_count; /* number of indexes in current block */
|
||||
@ -3119,10 +3090,7 @@ ml_append_int(buf, lnum, line, len, newfile, mark)
|
||||
* return FAIL for failure, OK otherwise
|
||||
*/
|
||||
int
|
||||
ml_replace(lnum, line, copy)
|
||||
linenr_T lnum;
|
||||
char_u *line;
|
||||
int copy;
|
||||
ml_replace(linenr_T lnum, char_u *line, int copy)
|
||||
{
|
||||
if (line == NULL) /* just checking... */
|
||||
return FAIL;
|
||||
@ -3160,19 +3128,14 @@ ml_replace(lnum, line, copy)
|
||||
* return FAIL for failure, OK otherwise
|
||||
*/
|
||||
int
|
||||
ml_delete(lnum, message)
|
||||
linenr_T lnum;
|
||||
int message;
|
||||
ml_delete(linenr_T lnum, int message)
|
||||
{
|
||||
ml_flush_line(curbuf);
|
||||
return ml_delete_int(curbuf, lnum, message);
|
||||
}
|
||||
|
||||
static int
|
||||
ml_delete_int(buf, lnum, message)
|
||||
buf_T *buf;
|
||||
linenr_T lnum;
|
||||
int message;
|
||||
ml_delete_int(buf_T *buf, linenr_T lnum, int message)
|
||||
{
|
||||
bhdr_T *hp;
|
||||
memfile_T *mfp;
|
||||
@ -3332,8 +3295,7 @@ ml_delete_int(buf, lnum, message)
|
||||
* set the B_MARKED flag for line 'lnum'
|
||||
*/
|
||||
void
|
||||
ml_setmarked(lnum)
|
||||
linenr_T lnum;
|
||||
ml_setmarked(linenr_T lnum)
|
||||
{
|
||||
bhdr_T *hp;
|
||||
DATA_BL *dp;
|
||||
@ -3362,7 +3324,7 @@ ml_setmarked(lnum)
|
||||
* find the first line with its B_MARKED flag set
|
||||
*/
|
||||
linenr_T
|
||||
ml_firstmarked()
|
||||
ml_firstmarked(void)
|
||||
{
|
||||
bhdr_T *hp;
|
||||
DATA_BL *dp;
|
||||
@ -3406,7 +3368,7 @@ ml_firstmarked()
|
||||
* clear all DB_MARKED flags
|
||||
*/
|
||||
void
|
||||
ml_clearmarked()
|
||||
ml_clearmarked(void)
|
||||
{
|
||||
bhdr_T *hp;
|
||||
DATA_BL *dp;
|
||||
@ -3448,8 +3410,7 @@ ml_clearmarked()
|
||||
* flush ml_line if necessary
|
||||
*/
|
||||
static void
|
||||
ml_flush_line(buf)
|
||||
buf_T *buf;
|
||||
ml_flush_line(buf_T *buf)
|
||||
{
|
||||
bhdr_T *hp;
|
||||
DATA_BL *dp;
|
||||
@ -3554,10 +3515,7 @@ ml_flush_line(buf)
|
||||
* create a new, empty, data block
|
||||
*/
|
||||
static bhdr_T *
|
||||
ml_new_data(mfp, negative, page_count)
|
||||
memfile_T *mfp;
|
||||
int negative;
|
||||
int page_count;
|
||||
ml_new_data(memfile_T *mfp, int negative, int page_count)
|
||||
{
|
||||
bhdr_T *hp;
|
||||
DATA_BL *dp;
|
||||
@ -3578,8 +3536,7 @@ ml_new_data(mfp, negative, page_count)
|
||||
* create a new, empty, pointer block
|
||||
*/
|
||||
static bhdr_T *
|
||||
ml_new_ptr(mfp)
|
||||
memfile_T *mfp;
|
||||
ml_new_ptr(memfile_T *mfp)
|
||||
{
|
||||
bhdr_T *hp;
|
||||
PTR_BL *pp;
|
||||
@ -3612,10 +3569,7 @@ ml_new_ptr(mfp)
|
||||
* return: NULL for failure, pointer to block header otherwise
|
||||
*/
|
||||
static bhdr_T *
|
||||
ml_find_line(buf, lnum, action)
|
||||
buf_T *buf;
|
||||
linenr_T lnum;
|
||||
int action;
|
||||
ml_find_line(buf_T *buf, linenr_T lnum, int action)
|
||||
{
|
||||
DATA_BL *dp;
|
||||
PTR_BL *pp;
|
||||
@ -3817,8 +3771,7 @@ error_noblock:
|
||||
* return -1 for failure, number of the new entry otherwise
|
||||
*/
|
||||
static int
|
||||
ml_add_stack(buf)
|
||||
buf_T *buf;
|
||||
ml_add_stack(buf_T *buf)
|
||||
{
|
||||
int top;
|
||||
infoptr_T *newstack;
|
||||
@ -3857,9 +3810,7 @@ ml_add_stack(buf)
|
||||
* Count is the number of lines added, negative if lines have been deleted.
|
||||
*/
|
||||
static void
|
||||
ml_lineadd(buf, count)
|
||||
buf_T *buf;
|
||||
int count;
|
||||
ml_lineadd(buf_T *buf, int count)
|
||||
{
|
||||
int idx;
|
||||
infoptr_T *ip;
|
||||
@ -3894,9 +3845,7 @@ ml_lineadd(buf, count)
|
||||
* Otherwise returns FAIL.
|
||||
*/
|
||||
int
|
||||
resolve_symlink(fname, buf)
|
||||
char_u *fname;
|
||||
char_u *buf;
|
||||
resolve_symlink(char_u *fname, char_u *buf)
|
||||
{
|
||||
char_u tmp[MAXPATHL];
|
||||
int ret;
|
||||
@ -3970,11 +3919,11 @@ resolve_symlink(fname, buf)
|
||||
* Returns pointer to allocated memory or NULL.
|
||||
*/
|
||||
char_u *
|
||||
makeswapname(fname, ffname, buf, dir_name)
|
||||
char_u *fname;
|
||||
char_u *ffname UNUSED;
|
||||
buf_T *buf;
|
||||
char_u *dir_name;
|
||||
makeswapname(
|
||||
char_u *fname,
|
||||
char_u *ffname UNUSED,
|
||||
buf_T *buf,
|
||||
char_u *dir_name)
|
||||
{
|
||||
char_u *r, *s;
|
||||
char_u *fname_res = fname;
|
||||
@ -4044,9 +3993,9 @@ makeswapname(fname, ffname, buf, dir_name)
|
||||
* The return value is an allocated string and can be NULL.
|
||||
*/
|
||||
char_u *
|
||||
get_file_in_dir(fname, dname)
|
||||
char_u *fname;
|
||||
char_u *dname; /* don't use "dirname", it is a global for Alpha */
|
||||
get_file_in_dir(
|
||||
char_u *fname,
|
||||
char_u *dname) /* don't use "dirname", it is a global for Alpha */
|
||||
{
|
||||
char_u *t;
|
||||
char_u *tail;
|
||||
@ -4095,9 +4044,9 @@ static void attention_message(buf_T *buf, char_u *fname);
|
||||
* Print the ATTENTION message: info about an existing swap file.
|
||||
*/
|
||||
static void
|
||||
attention_message(buf, fname)
|
||||
buf_T *buf; /* buffer being edited */
|
||||
char_u *fname; /* swap file name */
|
||||
attention_message(
|
||||
buf_T *buf, /* buffer being edited */
|
||||
char_u *fname) /* swap file name */
|
||||
{
|
||||
struct stat st;
|
||||
time_t x, sx;
|
||||
@ -4154,9 +4103,7 @@ static int do_swapexists(buf_T *buf, char_u *fname);
|
||||
* 6: abort
|
||||
*/
|
||||
static int
|
||||
do_swapexists(buf, fname)
|
||||
buf_T *buf;
|
||||
char_u *fname;
|
||||
do_swapexists(buf_T *buf, char_u *fname)
|
||||
{
|
||||
set_vim_var_string(VV_SWAPNAME, fname, -1);
|
||||
set_vim_var_string(VV_SWAPCHOICE, NULL, -1);
|
||||
@ -4195,10 +4142,10 @@ do_swapexists(buf, fname)
|
||||
* Note: May trigger SwapExists autocmd, pointers may change!
|
||||
*/
|
||||
static char_u *
|
||||
findswapname(buf, dirp, old_fname)
|
||||
buf_T *buf;
|
||||
char_u **dirp; /* pointer to list of directories */
|
||||
char_u *old_fname; /* don't give warning for this file name */
|
||||
findswapname(
|
||||
buf_T *buf,
|
||||
char_u **dirp, /* pointer to list of directories */
|
||||
char_u *old_fname) /* don't give warning for this file name */
|
||||
{
|
||||
char_u *fname;
|
||||
int n;
|
||||
@ -4676,8 +4623,7 @@ findswapname(buf, dirp, old_fname)
|
||||
}
|
||||
|
||||
static int
|
||||
b0_magic_wrong(b0p)
|
||||
ZERO_BL *b0p;
|
||||
b0_magic_wrong(ZERO_BL *b0p)
|
||||
{
|
||||
return (b0p->b0_magic_long != (long)B0_MAGIC_LONG
|
||||
|| b0p->b0_magic_int != (int)B0_MAGIC_INT
|
||||
@ -4736,10 +4682,10 @@ b0_magic_wrong(b0p)
|
||||
*/
|
||||
|
||||
static int
|
||||
fnamecmp_ino(fname_c, fname_s, ino_block0)
|
||||
char_u *fname_c; /* current file name */
|
||||
char_u *fname_s; /* file name from swap file */
|
||||
long ino_block0;
|
||||
fnamecmp_ino(
|
||||
char_u *fname_c, /* current file name */
|
||||
char_u *fname_s, /* file name from swap file */
|
||||
long ino_block0)
|
||||
{
|
||||
struct stat st;
|
||||
ino_t ino_c = 0; /* ino of current file */
|
||||
@ -4789,9 +4735,7 @@ fnamecmp_ino(fname_c, fname_s, ino_block0)
|
||||
* Used for machine independency in block zero.
|
||||
*/
|
||||
static void
|
||||
long_to_char(n, s)
|
||||
long n;
|
||||
char_u *s;
|
||||
long_to_char(long n, char_u *s)
|
||||
{
|
||||
s[0] = (char_u)(n & 0xff);
|
||||
n = (unsigned)n >> 8;
|
||||
@ -4803,8 +4747,7 @@ long_to_char(n, s)
|
||||
}
|
||||
|
||||
static long
|
||||
char_to_long(s)
|
||||
char_u *s;
|
||||
char_to_long(char_u *s)
|
||||
{
|
||||
long retval;
|
||||
|
||||
@ -4826,8 +4769,7 @@ char_to_long(s)
|
||||
* - 'fileencoding'
|
||||
*/
|
||||
void
|
||||
ml_setflags(buf)
|
||||
buf_T *buf;
|
||||
ml_setflags(buf_T *buf)
|
||||
{
|
||||
bhdr_T *hp;
|
||||
ZERO_BL *b0p;
|
||||
@ -4859,11 +4801,11 @@ ml_setflags(buf)
|
||||
* Otherwise return "data".
|
||||
*/
|
||||
char_u *
|
||||
ml_encrypt_data(mfp, data, offset, size)
|
||||
memfile_T *mfp;
|
||||
char_u *data;
|
||||
off_t offset;
|
||||
unsigned size;
|
||||
ml_encrypt_data(
|
||||
memfile_T *mfp,
|
||||
char_u *data,
|
||||
off_t offset,
|
||||
unsigned size)
|
||||
{
|
||||
DATA_BL *dp = (DATA_BL *)data;
|
||||
char_u *head_end;
|
||||
@ -4904,11 +4846,11 @@ ml_encrypt_data(mfp, data, offset, size)
|
||||
* Decrypt the text in "data" if it points to an encrypted data block.
|
||||
*/
|
||||
void
|
||||
ml_decrypt_data(mfp, data, offset, size)
|
||||
memfile_T *mfp;
|
||||
char_u *data;
|
||||
off_t offset;
|
||||
unsigned size;
|
||||
ml_decrypt_data(
|
||||
memfile_T *mfp,
|
||||
char_u *data,
|
||||
off_t offset,
|
||||
unsigned size)
|
||||
{
|
||||
DATA_BL *dp = (DATA_BL *)data;
|
||||
char_u *head_end;
|
||||
@ -4941,10 +4883,7 @@ ml_decrypt_data(mfp, data, offset, size)
|
||||
* Return an allocated cryptstate_T *.
|
||||
*/
|
||||
static cryptstate_T *
|
||||
ml_crypt_prepare(mfp, offset, reading)
|
||||
memfile_T *mfp;
|
||||
off_t offset;
|
||||
int reading;
|
||||
ml_crypt_prepare(memfile_T *mfp, off_t offset, int reading)
|
||||
{
|
||||
buf_T *buf = mfp->mf_buffer;
|
||||
char_u salt[50];
|
||||
@ -4999,11 +4938,11 @@ ml_crypt_prepare(mfp, offset, reading)
|
||||
* ML_CHNK_UPDLINE: Add len to parent chunk, as a signed entity.
|
||||
*/
|
||||
static void
|
||||
ml_updatechunk(buf, line, len, updtype)
|
||||
buf_T *buf;
|
||||
linenr_T line;
|
||||
long len;
|
||||
int updtype;
|
||||
ml_updatechunk(
|
||||
buf_T *buf,
|
||||
linenr_T line,
|
||||
long len,
|
||||
int updtype)
|
||||
{
|
||||
static buf_T *ml_upd_lastbuf = NULL;
|
||||
static linenr_T ml_upd_lastline;
|
||||
@ -5241,10 +5180,7 @@ ml_updatechunk(buf, line, len, updtype)
|
||||
* return -1 if information is not available
|
||||
*/
|
||||
long
|
||||
ml_find_line_or_offset(buf, lnum, offp)
|
||||
buf_T *buf;
|
||||
linenr_T lnum;
|
||||
long *offp;
|
||||
ml_find_line_or_offset(buf_T *buf, linenr_T lnum, long *offp)
|
||||
{
|
||||
linenr_T curline;
|
||||
int curix;
|
||||
@ -5371,8 +5307,7 @@ ml_find_line_or_offset(buf, lnum, offp)
|
||||
* Goto byte in buffer with offset 'cnt'.
|
||||
*/
|
||||
void
|
||||
goto_byte(cnt)
|
||||
long cnt;
|
||||
goto_byte(long cnt)
|
||||
{
|
||||
long boff = cnt;
|
||||
linenr_T lnum;
|
||||
|
191
src/menu.c
191
src/menu.c
@ -86,8 +86,8 @@ static const char *toolbar_names[] =
|
||||
* Do the :menu command and relatives.
|
||||
*/
|
||||
void
|
||||
ex_menu(eap)
|
||||
exarg_T *eap; /* Ex command arguments */
|
||||
ex_menu(
|
||||
exarg_T *eap) /* Ex command arguments */
|
||||
{
|
||||
char_u *menu_path;
|
||||
int modes;
|
||||
@ -410,19 +410,16 @@ theend:
|
||||
* Add the menu with the given name to the menu hierarchy
|
||||
*/
|
||||
static int
|
||||
add_menu_path(menu_path, menuarg, pri_tab, call_data
|
||||
#ifdef FEAT_GUI_W32
|
||||
, addtearoff
|
||||
#endif
|
||||
)
|
||||
char_u *menu_path;
|
||||
vimmenu_T *menuarg; /* passes modes, iconfile, iconidx,
|
||||
add_menu_path(
|
||||
char_u *menu_path,
|
||||
vimmenu_T *menuarg, /* passes modes, iconfile, iconidx,
|
||||
icon_builtin, silent[0], noremap[0] */
|
||||
int *pri_tab;
|
||||
char_u *call_data;
|
||||
int *pri_tab,
|
||||
char_u *call_data
|
||||
#ifdef FEAT_GUI_W32
|
||||
int addtearoff; /* may add tearoff item */
|
||||
, int addtearoff /* may add tearoff item */
|
||||
#endif
|
||||
)
|
||||
{
|
||||
char_u *path_name;
|
||||
int modes = menuarg->modes;
|
||||
@ -807,11 +804,11 @@ erret:
|
||||
* Called recursively.
|
||||
*/
|
||||
static int
|
||||
menu_nable_recurse(menu, name, modes, enable)
|
||||
vimmenu_T *menu;
|
||||
char_u *name;
|
||||
int modes;
|
||||
int enable;
|
||||
menu_nable_recurse(
|
||||
vimmenu_T *menu,
|
||||
char_u *name,
|
||||
int modes,
|
||||
int enable)
|
||||
{
|
||||
char_u *p;
|
||||
|
||||
@ -872,11 +869,11 @@ menu_nable_recurse(menu, name, modes, enable)
|
||||
* Called recursively.
|
||||
*/
|
||||
static int
|
||||
remove_menu(menup, name, modes, silent)
|
||||
vimmenu_T **menup;
|
||||
char_u *name;
|
||||
int modes;
|
||||
int silent; /* don't give error messages */
|
||||
remove_menu(
|
||||
vimmenu_T **menup,
|
||||
char_u *name,
|
||||
int modes,
|
||||
int silent) /* don't give error messages */
|
||||
{
|
||||
vimmenu_T *menu;
|
||||
vimmenu_T *child;
|
||||
@ -992,8 +989,7 @@ remove_menu(menup, name, modes, silent)
|
||||
* Free the given menu structure and remove it from the linked list.
|
||||
*/
|
||||
static void
|
||||
free_menu(menup)
|
||||
vimmenu_T **menup;
|
||||
free_menu(vimmenu_T **menup)
|
||||
{
|
||||
int i;
|
||||
vimmenu_T *menu;
|
||||
@ -1037,9 +1033,7 @@ free_menu(menup)
|
||||
* Free the menu->string with the given index.
|
||||
*/
|
||||
static void
|
||||
free_menu_string(menu, idx)
|
||||
vimmenu_T *menu;
|
||||
int idx;
|
||||
free_menu_string(vimmenu_T *menu, int idx)
|
||||
{
|
||||
int count = 0;
|
||||
int i;
|
||||
@ -1056,9 +1050,7 @@ free_menu_string(menu, idx)
|
||||
* Show the mapping associated with a menu item or hierarchy in a sub-menu.
|
||||
*/
|
||||
static int
|
||||
show_menus(path_name, modes)
|
||||
char_u *path_name;
|
||||
int modes;
|
||||
show_menus(char_u *path_name, int modes)
|
||||
{
|
||||
char_u *p;
|
||||
char_u *name;
|
||||
@ -1119,10 +1111,7 @@ show_menus(path_name, modes)
|
||||
* Recursively show the mappings associated with the menus under the given one
|
||||
*/
|
||||
static void
|
||||
show_menus_recursive(menu, modes, depth)
|
||||
vimmenu_T *menu;
|
||||
int modes;
|
||||
int depth;
|
||||
show_menus_recursive(vimmenu_T *menu, int modes, int depth)
|
||||
{
|
||||
int i;
|
||||
int bit;
|
||||
@ -1208,11 +1197,11 @@ static int expand_emenu; /* TRUE for ":emenu" command */
|
||||
* Work out what to complete when doing command line completion of menu names.
|
||||
*/
|
||||
char_u *
|
||||
set_context_in_menu_cmd(xp, cmd, arg, forceit)
|
||||
expand_T *xp;
|
||||
char_u *cmd;
|
||||
char_u *arg;
|
||||
int forceit;
|
||||
set_context_in_menu_cmd(
|
||||
expand_T *xp,
|
||||
char_u *cmd,
|
||||
char_u *arg,
|
||||
int forceit)
|
||||
{
|
||||
char_u *after_dot;
|
||||
char_u *p;
|
||||
@ -1327,9 +1316,7 @@ set_context_in_menu_cmd(xp, cmd, arg, forceit)
|
||||
* entries).
|
||||
*/
|
||||
char_u *
|
||||
get_menu_name(xp, idx)
|
||||
expand_T *xp UNUSED;
|
||||
int idx;
|
||||
get_menu_name(expand_T *xp UNUSED, int idx)
|
||||
{
|
||||
static vimmenu_T *menu = NULL;
|
||||
char_u *str;
|
||||
@ -1389,9 +1376,7 @@ get_menu_name(xp, idx)
|
||||
* entries.
|
||||
*/
|
||||
char_u *
|
||||
get_menu_names(xp, idx)
|
||||
expand_T *xp UNUSED;
|
||||
int idx;
|
||||
get_menu_names(expand_T *xp UNUSED, int idx)
|
||||
{
|
||||
static vimmenu_T *menu = NULL;
|
||||
#define TBUFFER_LEN 256
|
||||
@ -1483,8 +1468,7 @@ get_menu_names(xp, idx)
|
||||
* "name" may be modified.
|
||||
*/
|
||||
char_u *
|
||||
menu_name_skip(name)
|
||||
char_u *name;
|
||||
menu_name_skip(char_u *name)
|
||||
{
|
||||
char_u *p;
|
||||
|
||||
@ -1507,9 +1491,7 @@ menu_name_skip(name)
|
||||
* two ways: raw menu name and menu name without '&'. ignore part after a TAB.
|
||||
*/
|
||||
static int
|
||||
menu_name_equal(name, menu)
|
||||
char_u *name;
|
||||
vimmenu_T *menu;
|
||||
menu_name_equal(char_u *name, vimmenu_T *menu)
|
||||
{
|
||||
#ifdef FEAT_MULTI_LANG
|
||||
if (menu->en_name != NULL
|
||||
@ -1521,9 +1503,7 @@ menu_name_equal(name, menu)
|
||||
}
|
||||
|
||||
static int
|
||||
menu_namecmp(name, mname)
|
||||
char_u *name;
|
||||
char_u *mname;
|
||||
menu_namecmp(char_u *name, char_u *mname)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -1543,11 +1523,11 @@ menu_namecmp(name, mname)
|
||||
* whether the command is an "unmenu" command.
|
||||
*/
|
||||
static int
|
||||
get_menu_cmd_modes(cmd, forceit, noremap, unmenu)
|
||||
char_u *cmd;
|
||||
int forceit; /* Was there a "!" after the command? */
|
||||
int *noremap;
|
||||
int *unmenu;
|
||||
get_menu_cmd_modes(
|
||||
char_u *cmd,
|
||||
int forceit, /* Was there a "!" after the command? */
|
||||
int *noremap,
|
||||
int *unmenu)
|
||||
{
|
||||
int modes;
|
||||
|
||||
@ -1607,9 +1587,7 @@ get_menu_cmd_modes(cmd, forceit, noremap, unmenu)
|
||||
* Returns the name in allocated memory (NULL for failure).
|
||||
*/
|
||||
static char_u *
|
||||
popup_mode_name(name, idx)
|
||||
char_u *name;
|
||||
int idx;
|
||||
popup_mode_name(char_u *name, int idx)
|
||||
{
|
||||
char_u *p;
|
||||
int len = (int)STRLEN(name);
|
||||
@ -1630,9 +1608,7 @@ popup_mode_name(name, idx)
|
||||
* given menu in the current mode.
|
||||
*/
|
||||
int
|
||||
get_menu_index(menu, state)
|
||||
vimmenu_T *menu;
|
||||
int state;
|
||||
get_menu_index(vimmenu_T *menu, int state)
|
||||
{
|
||||
int idx;
|
||||
|
||||
@ -1670,10 +1646,7 @@ get_menu_index(menu, state)
|
||||
* If actext != NULL, *actext is set to the text after the first TAB.
|
||||
*/
|
||||
static char_u *
|
||||
menu_text(str, mnemonic, actext)
|
||||
char_u *str;
|
||||
int *mnemonic;
|
||||
char_u **actext;
|
||||
menu_text(char_u *str, int *mnemonic, char_u **actext)
|
||||
{
|
||||
char_u *p;
|
||||
char_u *text;
|
||||
@ -1724,8 +1697,7 @@ menu_text(str, mnemonic, actext)
|
||||
* Return TRUE if "name" can be a menu in the MenuBar.
|
||||
*/
|
||||
int
|
||||
menu_is_menubar(name)
|
||||
char_u *name;
|
||||
menu_is_menubar(char_u *name)
|
||||
{
|
||||
return (!menu_is_popup(name)
|
||||
&& !menu_is_toolbar(name)
|
||||
@ -1736,8 +1708,7 @@ menu_is_menubar(name)
|
||||
* Return TRUE if "name" is a popup menu name.
|
||||
*/
|
||||
int
|
||||
menu_is_popup(name)
|
||||
char_u *name;
|
||||
menu_is_popup(char_u *name)
|
||||
{
|
||||
return (STRNCMP(name, "PopUp", 5) == 0);
|
||||
}
|
||||
@ -1747,8 +1718,7 @@ menu_is_popup(name)
|
||||
* Return TRUE if "name" is part of a popup menu.
|
||||
*/
|
||||
int
|
||||
menu_is_child_of_popup(menu)
|
||||
vimmenu_T *menu;
|
||||
menu_is_child_of_popup(vimmenu_T *menu)
|
||||
{
|
||||
while (menu->parent != NULL)
|
||||
menu = menu->parent;
|
||||
@ -1760,8 +1730,7 @@ menu_is_child_of_popup(menu)
|
||||
* Return TRUE if "name" is a toolbar menu name.
|
||||
*/
|
||||
int
|
||||
menu_is_toolbar(name)
|
||||
char_u *name;
|
||||
menu_is_toolbar(char_u *name)
|
||||
{
|
||||
return (STRNCMP(name, "ToolBar", 7) == 0);
|
||||
}
|
||||
@ -1771,8 +1740,7 @@ menu_is_toolbar(name)
|
||||
* with '-'
|
||||
*/
|
||||
int
|
||||
menu_is_separator(name)
|
||||
char_u *name;
|
||||
menu_is_separator(char_u *name)
|
||||
{
|
||||
return (name[0] == '-' && name[STRLEN(name) - 1] == '-');
|
||||
}
|
||||
@ -1781,8 +1749,7 @@ menu_is_separator(name)
|
||||
* Return TRUE if the menu is hidden: Starts with ']'
|
||||
*/
|
||||
static int
|
||||
menu_is_hidden(name)
|
||||
char_u *name;
|
||||
menu_is_hidden(char_u *name)
|
||||
{
|
||||
return (name[0] == ']') || (menu_is_popup(name) && name[5] != NUL);
|
||||
}
|
||||
@ -1793,8 +1760,7 @@ menu_is_hidden(name)
|
||||
* Return TRUE if the menu is the tearoff menu.
|
||||
*/
|
||||
static int
|
||||
menu_is_tearoff(name)
|
||||
char_u *name UNUSED;
|
||||
menu_is_tearoff(char_u *name UNUSED)
|
||||
{
|
||||
#ifdef FEAT_GUI
|
||||
return (STRCMP(name, TEAR_STRING) == 0);
|
||||
@ -1807,7 +1773,7 @@ menu_is_tearoff(name)
|
||||
#ifdef FEAT_GUI
|
||||
|
||||
static int
|
||||
get_menu_mode()
|
||||
get_menu_mode(void)
|
||||
{
|
||||
if (VIsual_active)
|
||||
{
|
||||
@ -1835,9 +1801,7 @@ get_menu_mode()
|
||||
* Return OK or FAIL. Used recursively.
|
||||
*/
|
||||
int
|
||||
check_menu_pointer(root, menu_to_check)
|
||||
vimmenu_T *root;
|
||||
vimmenu_T *menu_to_check;
|
||||
check_menu_pointer(vimmenu_T *root, vimmenu_T *menu_to_check)
|
||||
{
|
||||
vimmenu_T *p;
|
||||
|
||||
@ -1857,8 +1821,7 @@ check_menu_pointer(root, menu_to_check)
|
||||
* gui_create_initial_menus(root_menu, NULL);
|
||||
*/
|
||||
void
|
||||
gui_create_initial_menus(menu)
|
||||
vimmenu_T *menu;
|
||||
gui_create_initial_menus(vimmenu_T *menu)
|
||||
{
|
||||
int idx = 0;
|
||||
|
||||
@ -1884,9 +1847,7 @@ gui_create_initial_menus(menu)
|
||||
* Used recursively by gui_update_menus (see below)
|
||||
*/
|
||||
static void
|
||||
gui_update_menus_recurse(menu, mode)
|
||||
vimmenu_T *menu;
|
||||
int mode;
|
||||
gui_update_menus_recurse(vimmenu_T *menu, int mode)
|
||||
{
|
||||
int grey;
|
||||
|
||||
@ -1926,8 +1887,7 @@ gui_update_menus_recurse(menu, mode)
|
||||
* since last time. If "modes" is not 0, then we use these modes instead.
|
||||
*/
|
||||
void
|
||||
gui_update_menus(modes)
|
||||
int modes;
|
||||
gui_update_menus(int modes)
|
||||
{
|
||||
static int prev_mode = -1;
|
||||
int mode = 0;
|
||||
@ -1964,8 +1924,7 @@ gui_update_menus(modes)
|
||||
* Case of the key is ignored.
|
||||
*/
|
||||
int
|
||||
gui_is_menu_shortcut(key)
|
||||
int key;
|
||||
gui_is_menu_shortcut(int key)
|
||||
{
|
||||
vimmenu_T *menu;
|
||||
|
||||
@ -1985,7 +1944,7 @@ gui_is_menu_shortcut(key)
|
||||
* etc.
|
||||
*/
|
||||
void
|
||||
gui_show_popupmenu()
|
||||
gui_show_popupmenu(void)
|
||||
{
|
||||
vimmenu_T *menu;
|
||||
int mode;
|
||||
@ -2044,11 +2003,11 @@ gui_mch_toggle_tearoffs(int enable)
|
||||
* Recursively add tearoff items
|
||||
*/
|
||||
static void
|
||||
gui_create_tearoffs_recurse(menu, pname, pri_tab, pri_idx)
|
||||
vimmenu_T *menu;
|
||||
const char_u *pname;
|
||||
int *pri_tab;
|
||||
int pri_idx;
|
||||
gui_create_tearoffs_recurse(
|
||||
vimmenu_T *menu,
|
||||
const char_u *pname,
|
||||
int *pri_tab,
|
||||
int pri_idx)
|
||||
{
|
||||
char_u *newpname = NULL;
|
||||
int len;
|
||||
@ -2102,10 +2061,7 @@ gui_create_tearoffs_recurse(menu, pname, pri_tab, pri_idx)
|
||||
* "tearpath" is the menu path, and must have room to add TEAR_STRING.
|
||||
*/
|
||||
static void
|
||||
gui_add_tearoff(tearpath, pri_tab, pri_idx)
|
||||
char_u *tearpath;
|
||||
int *pri_tab;
|
||||
int pri_idx;
|
||||
gui_add_tearoff(char_u *tearpath, int *pri_tab, int pri_idx)
|
||||
{
|
||||
char_u *tbuf;
|
||||
int t;
|
||||
@ -2151,8 +2107,7 @@ gui_add_tearoff(tearpath, pri_tab, pri_idx)
|
||||
* Recursively destroy tearoff items
|
||||
*/
|
||||
static void
|
||||
gui_destroy_tearoffs_recurse(menu)
|
||||
vimmenu_T *menu;
|
||||
gui_destroy_tearoffs_recurse(vimmenu_T *menu)
|
||||
{
|
||||
while (menu)
|
||||
{
|
||||
@ -2178,8 +2133,7 @@ gui_destroy_tearoffs_recurse(menu)
|
||||
* execute it.
|
||||
*/
|
||||
void
|
||||
ex_emenu(eap)
|
||||
exarg_T *eap;
|
||||
ex_emenu(exarg_T *eap)
|
||||
{
|
||||
vimmenu_T *menu;
|
||||
char_u *name;
|
||||
@ -2317,8 +2271,7 @@ ex_emenu(eap)
|
||||
* Given a menu descriptor, e.g. "File.New", find it in the menu hierarchy.
|
||||
*/
|
||||
vimmenu_T *
|
||||
gui_find_menu(path_name)
|
||||
char_u *path_name;
|
||||
gui_find_menu(char_u *path_name)
|
||||
{
|
||||
vimmenu_T *menu = NULL;
|
||||
char_u *name;
|
||||
@ -2394,8 +2347,7 @@ static garray_T menutrans_ga = {0, 0, 0, 0, NULL};
|
||||
* case the commands are ignored.
|
||||
*/
|
||||
void
|
||||
ex_menutranslate(eap)
|
||||
exarg_T *eap UNUSED;
|
||||
ex_menutranslate(exarg_T *eap UNUSED)
|
||||
{
|
||||
#ifdef FEAT_MULTI_LANG
|
||||
char_u *arg = eap->arg;
|
||||
@ -2473,8 +2425,7 @@ ex_menutranslate(eap)
|
||||
* Find the character just after one part of a menu name.
|
||||
*/
|
||||
static char_u *
|
||||
menu_skip_part(p)
|
||||
char_u *p;
|
||||
menu_skip_part(char_u *p)
|
||||
{
|
||||
while (*p != NUL && *p != '.' && !vim_iswhite(*p))
|
||||
{
|
||||
@ -2492,9 +2443,7 @@ menu_skip_part(p)
|
||||
* Return a pointer to the translation or NULL if not found.
|
||||
*/
|
||||
static char_u *
|
||||
menutrans_lookup(name, len)
|
||||
char_u *name;
|
||||
int len;
|
||||
menutrans_lookup(char_u *name, int len)
|
||||
{
|
||||
menutrans_T *tp = (menutrans_T *)menutrans_ga.ga_data;
|
||||
int i;
|
||||
@ -2527,8 +2476,7 @@ menutrans_lookup(name, len)
|
||||
* Unescape the name in the translate dictionary table.
|
||||
*/
|
||||
static void
|
||||
menu_unescape_name(name)
|
||||
char_u *name;
|
||||
menu_unescape_name(char_u *name)
|
||||
{
|
||||
char_u *p;
|
||||
|
||||
@ -2543,8 +2491,7 @@ menu_unescape_name(name)
|
||||
* Skip the menu name, and translate <Tab> into a real TAB.
|
||||
*/
|
||||
static char_u *
|
||||
menu_translate_tab_and_shift(arg_start)
|
||||
char_u *arg_start;
|
||||
menu_translate_tab_and_shift(char_u *arg_start)
|
||||
{
|
||||
char_u *arg = arg_start;
|
||||
|
||||
|
413
src/message.c
413
src/message.c
@ -102,8 +102,7 @@ static int verbose_did_open = FALSE;
|
||||
* return TRUE if wait_return not called
|
||||
*/
|
||||
int
|
||||
msg(s)
|
||||
char_u *s;
|
||||
msg(char_u *s)
|
||||
{
|
||||
return msg_attr_keep(s, 0, FALSE);
|
||||
}
|
||||
@ -114,8 +113,7 @@ msg(s)
|
||||
* Like msg() but keep it silent when 'verbosefile' is set.
|
||||
*/
|
||||
int
|
||||
verb_msg(s)
|
||||
char_u *s;
|
||||
verb_msg(char_u *s)
|
||||
{
|
||||
int n;
|
||||
|
||||
@ -128,18 +126,16 @@ verb_msg(s)
|
||||
#endif
|
||||
|
||||
int
|
||||
msg_attr(s, attr)
|
||||
char_u *s;
|
||||
int attr;
|
||||
msg_attr(char_u *s, int attr)
|
||||
{
|
||||
return msg_attr_keep(s, attr, FALSE);
|
||||
}
|
||||
|
||||
int
|
||||
msg_attr_keep(s, attr, keep)
|
||||
char_u *s;
|
||||
int attr;
|
||||
int keep; /* TRUE: set keep_msg if it doesn't scroll */
|
||||
msg_attr_keep(
|
||||
char_u *s,
|
||||
int attr,
|
||||
int keep) /* TRUE: set keep_msg if it doesn't scroll */
|
||||
{
|
||||
static int entered = 0;
|
||||
int retval;
|
||||
@ -197,9 +193,9 @@ msg_attr_keep(s, attr, keep)
|
||||
* Returns an allocated string or NULL when no truncating is done.
|
||||
*/
|
||||
char_u *
|
||||
msg_strtrunc(s, force)
|
||||
char_u *s;
|
||||
int force; /* always truncate */
|
||||
msg_strtrunc(
|
||||
char_u *s,
|
||||
int force) /* always truncate */
|
||||
{
|
||||
char_u *buf = NULL;
|
||||
int len;
|
||||
@ -242,11 +238,11 @@ msg_strtrunc(s, force)
|
||||
* "s" and "buf" may be equal.
|
||||
*/
|
||||
void
|
||||
trunc_string(s, buf, room, buflen)
|
||||
char_u *s;
|
||||
char_u *buf;
|
||||
int room;
|
||||
int buflen;
|
||||
trunc_string(
|
||||
char_u *s,
|
||||
char_u *buf,
|
||||
int room,
|
||||
int buflen)
|
||||
{
|
||||
int half;
|
||||
int len;
|
||||
@ -388,7 +384,7 @@ static char_u *last_sourcing_name = NULL;
|
||||
* for the next error message;
|
||||
*/
|
||||
void
|
||||
reset_last_sourcing()
|
||||
reset_last_sourcing(void)
|
||||
{
|
||||
vim_free(last_sourcing_name);
|
||||
last_sourcing_name = NULL;
|
||||
@ -399,7 +395,7 @@ reset_last_sourcing()
|
||||
* Return TRUE if "sourcing_name" differs from "last_sourcing_name".
|
||||
*/
|
||||
static int
|
||||
other_sourcing_name()
|
||||
other_sourcing_name(void)
|
||||
{
|
||||
if (sourcing_name != NULL)
|
||||
{
|
||||
@ -416,7 +412,7 @@ other_sourcing_name()
|
||||
* Returns NULL when no message is to be given.
|
||||
*/
|
||||
static char_u *
|
||||
get_emsg_source()
|
||||
get_emsg_source(void)
|
||||
{
|
||||
char_u *Buf, *p;
|
||||
|
||||
@ -437,7 +433,7 @@ get_emsg_source()
|
||||
* Returns NULL when no message is to be given.
|
||||
*/
|
||||
static char_u *
|
||||
get_emsg_lnum()
|
||||
get_emsg_lnum(void)
|
||||
{
|
||||
char_u *Buf, *p;
|
||||
|
||||
@ -462,8 +458,7 @@ get_emsg_lnum()
|
||||
* is only displayed if it changed.
|
||||
*/
|
||||
void
|
||||
msg_source(attr)
|
||||
int attr;
|
||||
msg_source(int attr)
|
||||
{
|
||||
char_u *p;
|
||||
|
||||
@ -501,7 +496,7 @@ msg_source(attr)
|
||||
* If "emsg_skip" is set: never do error messages.
|
||||
*/
|
||||
int
|
||||
emsg_not_now()
|
||||
emsg_not_now(void)
|
||||
{
|
||||
if ((emsg_off > 0 && vim_strchr(p_debug, 'm') == NULL
|
||||
&& vim_strchr(p_debug, 't') == NULL)
|
||||
@ -522,8 +517,7 @@ emsg_not_now()
|
||||
* return TRUE if wait_return not called
|
||||
*/
|
||||
int
|
||||
emsg(s)
|
||||
char_u *s;
|
||||
emsg(char_u *s)
|
||||
{
|
||||
int attr;
|
||||
char_u *p;
|
||||
@ -633,8 +627,7 @@ emsg(s)
|
||||
* Print an error message with one "%s" and one string argument.
|
||||
*/
|
||||
int
|
||||
emsg2(s, a1)
|
||||
char_u *s, *a1;
|
||||
emsg2(char_u *s, char_u *a1)
|
||||
{
|
||||
return emsg3(s, a1, NULL);
|
||||
}
|
||||
@ -642,8 +635,7 @@ emsg2(s, a1)
|
||||
/* emsg3() and emsgn() are in misc2.c to avoid warnings for the prototypes. */
|
||||
|
||||
void
|
||||
emsg_invreg(name)
|
||||
int name;
|
||||
emsg_invreg(int name)
|
||||
{
|
||||
EMSG2(_("E354: Invalid register name: '%s'"), transchar(name));
|
||||
}
|
||||
@ -655,10 +647,7 @@ emsg_invreg(name)
|
||||
* Returns a pointer to the printed message, if wait_return() not called.
|
||||
*/
|
||||
char_u *
|
||||
msg_trunc_attr(s, force, attr)
|
||||
char_u *s;
|
||||
int force;
|
||||
int attr;
|
||||
msg_trunc_attr(char_u *s, int force, int attr)
|
||||
{
|
||||
int n;
|
||||
|
||||
@ -682,9 +671,7 @@ msg_trunc_attr(s, force, attr)
|
||||
* Note: May change the message by replacing a character with '<'.
|
||||
*/
|
||||
char_u *
|
||||
msg_may_trunc(force, s)
|
||||
int force;
|
||||
char_u *s;
|
||||
msg_may_trunc(int force, char_u *s)
|
||||
{
|
||||
int n;
|
||||
int room;
|
||||
@ -717,10 +704,10 @@ msg_may_trunc(force, s)
|
||||
}
|
||||
|
||||
static void
|
||||
add_msg_hist(s, len, attr)
|
||||
char_u *s;
|
||||
int len; /* -1 for undetermined length */
|
||||
int attr;
|
||||
add_msg_hist(
|
||||
char_u *s,
|
||||
int len, /* -1 for undetermined length */
|
||||
int attr)
|
||||
{
|
||||
struct msg_hist *p;
|
||||
|
||||
@ -762,7 +749,7 @@ add_msg_hist(s, len, attr)
|
||||
* Returns FAIL if there are no messages.
|
||||
*/
|
||||
int
|
||||
delete_first_msg()
|
||||
delete_first_msg(void)
|
||||
{
|
||||
struct msg_hist *p;
|
||||
|
||||
@ -782,8 +769,7 @@ delete_first_msg()
|
||||
* ":messages" command.
|
||||
*/
|
||||
void
|
||||
ex_messages(eap)
|
||||
exarg_T *eap UNUSED;
|
||||
ex_messages(exarg_T *eap UNUSED)
|
||||
{
|
||||
struct msg_hist *p;
|
||||
char_u *s;
|
||||
@ -809,7 +795,7 @@ ex_messages(eap)
|
||||
* and a delay.
|
||||
*/
|
||||
void
|
||||
msg_end_prompt()
|
||||
msg_end_prompt(void)
|
||||
{
|
||||
need_wait_return = FALSE;
|
||||
emsg_on_display = FALSE;
|
||||
@ -827,8 +813,7 @@ msg_end_prompt()
|
||||
* if 'redraw' is -1, don't redraw at all
|
||||
*/
|
||||
void
|
||||
wait_return(redraw)
|
||||
int redraw;
|
||||
wait_return(int redraw)
|
||||
{
|
||||
int c;
|
||||
int oldState;
|
||||
@ -1076,7 +1061,7 @@ wait_return(redraw)
|
||||
* Write the hit-return prompt.
|
||||
*/
|
||||
static void
|
||||
hit_return_msg()
|
||||
hit_return_msg(void)
|
||||
{
|
||||
int save_p_more = p_more;
|
||||
|
||||
@ -1096,9 +1081,7 @@ hit_return_msg()
|
||||
* Set "keep_msg" to "s". Free the old value and check for NULL pointer.
|
||||
*/
|
||||
void
|
||||
set_keep_msg(s, attr)
|
||||
char_u *s;
|
||||
int attr;
|
||||
set_keep_msg(char_u *s, int attr)
|
||||
{
|
||||
vim_free(keep_msg);
|
||||
if (s != NULL && msg_silent == 0)
|
||||
@ -1115,7 +1098,7 @@ set_keep_msg(s, attr)
|
||||
* that it will be displayed again after redraw.
|
||||
*/
|
||||
void
|
||||
set_keep_msg_from_hist()
|
||||
set_keep_msg_from_hist(void)
|
||||
{
|
||||
if (keep_msg == NULL && last_msg_hist != NULL && msg_scrolled == 0
|
||||
&& (State & NORMAL))
|
||||
@ -1127,7 +1110,7 @@ set_keep_msg_from_hist()
|
||||
* Prepare for outputting characters in the command line.
|
||||
*/
|
||||
void
|
||||
msg_start()
|
||||
msg_start(void)
|
||||
{
|
||||
int did_return = FALSE;
|
||||
|
||||
@ -1180,23 +1163,20 @@ msg_start()
|
||||
* Note that the current msg position is where messages start.
|
||||
*/
|
||||
void
|
||||
msg_starthere()
|
||||
msg_starthere(void)
|
||||
{
|
||||
lines_left = cmdline_row;
|
||||
msg_didany = FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
msg_putchar(c)
|
||||
int c;
|
||||
msg_putchar(int c)
|
||||
{
|
||||
msg_putchar_attr(c, 0);
|
||||
}
|
||||
|
||||
void
|
||||
msg_putchar_attr(c, attr)
|
||||
int c;
|
||||
int attr;
|
||||
msg_putchar_attr(int c, int attr)
|
||||
{
|
||||
#ifdef FEAT_MBYTE
|
||||
char_u buf[MB_MAXBYTES + 1];
|
||||
@ -1224,8 +1204,7 @@ msg_putchar_attr(c, attr)
|
||||
}
|
||||
|
||||
void
|
||||
msg_outnum(n)
|
||||
long n;
|
||||
msg_outnum(long n)
|
||||
{
|
||||
char_u buf[20];
|
||||
|
||||
@ -1234,25 +1213,21 @@ msg_outnum(n)
|
||||
}
|
||||
|
||||
void
|
||||
msg_home_replace(fname)
|
||||
char_u *fname;
|
||||
msg_home_replace(char_u *fname)
|
||||
{
|
||||
msg_home_replace_attr(fname, 0);
|
||||
}
|
||||
|
||||
#if defined(FEAT_FIND_ID) || defined(PROTO)
|
||||
void
|
||||
msg_home_replace_hl(fname)
|
||||
char_u *fname;
|
||||
msg_home_replace_hl(char_u *fname)
|
||||
{
|
||||
msg_home_replace_attr(fname, hl_attr(HLF_D));
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
msg_home_replace_attr(fname, attr)
|
||||
char_u *fname;
|
||||
int attr;
|
||||
msg_home_replace_attr(char_u *fname, int attr)
|
||||
{
|
||||
char_u *name;
|
||||
|
||||
@ -1269,24 +1244,19 @@ msg_home_replace_attr(fname, attr)
|
||||
* Return the number of characters it takes on the screen.
|
||||
*/
|
||||
int
|
||||
msg_outtrans(str)
|
||||
char_u *str;
|
||||
msg_outtrans(char_u *str)
|
||||
{
|
||||
return msg_outtrans_attr(str, 0);
|
||||
}
|
||||
|
||||
int
|
||||
msg_outtrans_attr(str, attr)
|
||||
char_u *str;
|
||||
int attr;
|
||||
msg_outtrans_attr(char_u *str, int attr)
|
||||
{
|
||||
return msg_outtrans_len_attr(str, (int)STRLEN(str), attr);
|
||||
}
|
||||
|
||||
int
|
||||
msg_outtrans_len(str, len)
|
||||
char_u *str;
|
||||
int len;
|
||||
msg_outtrans_len(char_u *str, int len)
|
||||
{
|
||||
return msg_outtrans_len_attr(str, len, 0);
|
||||
}
|
||||
@ -1296,9 +1266,7 @@ msg_outtrans_len(str, len)
|
||||
* Handles multi-byte characters.
|
||||
*/
|
||||
char_u *
|
||||
msg_outtrans_one(p, attr)
|
||||
char_u *p;
|
||||
int attr;
|
||||
msg_outtrans_one(char_u *p, int attr)
|
||||
{
|
||||
#ifdef FEAT_MBYTE
|
||||
int l;
|
||||
@ -1314,10 +1282,7 @@ msg_outtrans_one(p, attr)
|
||||
}
|
||||
|
||||
int
|
||||
msg_outtrans_len_attr(msgstr, len, attr)
|
||||
char_u *msgstr;
|
||||
int len;
|
||||
int attr;
|
||||
msg_outtrans_len_attr(char_u *msgstr, int len, int attr)
|
||||
{
|
||||
int retval = 0;
|
||||
char_u *str = msgstr;
|
||||
@ -1406,8 +1371,7 @@ msg_outtrans_len_attr(msgstr, len, attr)
|
||||
|
||||
#if defined(FEAT_QUICKFIX) || defined(PROTO)
|
||||
void
|
||||
msg_make(arg)
|
||||
char_u *arg;
|
||||
msg_make(char_u *arg)
|
||||
{
|
||||
int i;
|
||||
static char_u *str = (char_u *)"eeffoc", *rs = (char_u *)"Plon#dqg#vxjduB";
|
||||
@ -1440,9 +1404,9 @@ msg_make(arg)
|
||||
* the character/string -- webb
|
||||
*/
|
||||
int
|
||||
msg_outtrans_special(strstart, from)
|
||||
char_u *strstart;
|
||||
int from; /* TRUE for lhs of a mapping */
|
||||
msg_outtrans_special(
|
||||
char_u *strstart,
|
||||
int from) /* TRUE for lhs of a mapping */
|
||||
{
|
||||
char_u *str = strstart;
|
||||
int retval = 0;
|
||||
@ -1479,9 +1443,9 @@ msg_outtrans_special(strstart, from)
|
||||
* strings, in an allocated string.
|
||||
*/
|
||||
char_u *
|
||||
str2special_save(str, is_lhs)
|
||||
char_u *str;
|
||||
int is_lhs; /* TRUE for lhs, FALSE for rhs */
|
||||
str2special_save(
|
||||
char_u *str,
|
||||
int is_lhs) /* TRUE for lhs, FALSE for rhs */
|
||||
{
|
||||
garray_T ga;
|
||||
char_u *p = str;
|
||||
@ -1500,9 +1464,9 @@ str2special_save(str, is_lhs)
|
||||
* Advances "sp" to the next code.
|
||||
*/
|
||||
char_u *
|
||||
str2special(sp, from)
|
||||
char_u **sp;
|
||||
int from; /* TRUE for lhs of mapping */
|
||||
str2special(
|
||||
char_u **sp,
|
||||
int from) /* TRUE for lhs of mapping */
|
||||
{
|
||||
int c;
|
||||
static char_u buf[7];
|
||||
@ -1577,10 +1541,7 @@ str2special(sp, from)
|
||||
* Translate a key sequence into special key names.
|
||||
*/
|
||||
void
|
||||
str2specialbuf(sp, buf, len)
|
||||
char_u *sp;
|
||||
char_u *buf;
|
||||
int len;
|
||||
str2specialbuf(char_u *sp, char_u *buf, int len)
|
||||
{
|
||||
char_u *s;
|
||||
|
||||
@ -1597,9 +1558,7 @@ str2specialbuf(sp, buf, len)
|
||||
* print line for :print or :list command
|
||||
*/
|
||||
void
|
||||
msg_prt_line(s, list)
|
||||
char_u *s;
|
||||
int list;
|
||||
msg_prt_line(char_u *s, int list)
|
||||
{
|
||||
int c;
|
||||
int col = 0;
|
||||
@ -1732,10 +1691,7 @@ msg_prt_line(s, list)
|
||||
* Return the pointer "s" advanced to the next character.
|
||||
*/
|
||||
static char_u *
|
||||
screen_puts_mbyte(s, l, attr)
|
||||
char_u *s;
|
||||
int l;
|
||||
int attr;
|
||||
screen_puts_mbyte(char_u *s, int l, int attr)
|
||||
{
|
||||
int cw;
|
||||
|
||||
@ -1782,15 +1738,14 @@ screen_puts_mbyte(s, l, attr)
|
||||
* Update msg_row and msg_col for the next message.
|
||||
*/
|
||||
void
|
||||
msg_puts(s)
|
||||
char_u *s;
|
||||
msg_puts(char_u *s)
|
||||
{
|
||||
msg_puts_attr(s, 0);
|
||||
msg_puts_attr(s, 0);
|
||||
}
|
||||
|
||||
void
|
||||
msg_puts_title(s)
|
||||
char_u *s;
|
||||
msg_puts_title(
|
||||
char_u *s)
|
||||
{
|
||||
msg_puts_attr(s, hl_attr(HLF_T));
|
||||
}
|
||||
@ -1801,18 +1756,13 @@ msg_puts_title(s)
|
||||
* Does not handle multi-byte characters!
|
||||
*/
|
||||
void
|
||||
msg_puts_long_attr(longstr, attr)
|
||||
char_u *longstr;
|
||||
int attr;
|
||||
msg_puts_long_attr(char_u *longstr, int attr)
|
||||
{
|
||||
msg_puts_long_len_attr(longstr, (int)STRLEN(longstr), attr);
|
||||
}
|
||||
|
||||
void
|
||||
msg_puts_long_len_attr(longstr, len, attr)
|
||||
char_u *longstr;
|
||||
int len;
|
||||
int attr;
|
||||
msg_puts_long_len_attr(char_u *longstr, int len, int attr)
|
||||
{
|
||||
int slen = len;
|
||||
int room;
|
||||
@ -1831,9 +1781,7 @@ msg_puts_long_len_attr(longstr, len, attr)
|
||||
* Basic function for writing a message with highlight attributes.
|
||||
*/
|
||||
void
|
||||
msg_puts_attr(s, attr)
|
||||
char_u *s;
|
||||
int attr;
|
||||
msg_puts_attr(char_u *s, int attr)
|
||||
{
|
||||
msg_puts_attr_len(s, -1, attr);
|
||||
}
|
||||
@ -1844,10 +1792,7 @@ msg_puts_attr(s, attr)
|
||||
* When "maxlen" is >= 0 the message is not put in the history.
|
||||
*/
|
||||
static void
|
||||
msg_puts_attr_len(str, maxlen, attr)
|
||||
char_u *str;
|
||||
int maxlen;
|
||||
int attr;
|
||||
msg_puts_attr_len(char_u *str, int maxlen, int attr)
|
||||
{
|
||||
/*
|
||||
* If redirection is on, also write to the redirection file.
|
||||
@ -1895,11 +1840,11 @@ msg_puts_attr_len(str, maxlen, attr)
|
||||
* May be called recursively to display scroll-back text.
|
||||
*/
|
||||
static void
|
||||
msg_puts_display(str, maxlen, attr, recurse)
|
||||
char_u *str;
|
||||
int maxlen;
|
||||
int attr;
|
||||
int recurse;
|
||||
msg_puts_display(
|
||||
char_u *str,
|
||||
int maxlen,
|
||||
int attr,
|
||||
int recurse)
|
||||
{
|
||||
char_u *s = str;
|
||||
char_u *t_s = str; /* string from "t_s" to "s" is still todo */
|
||||
@ -2139,7 +2084,7 @@ msg_puts_display(str, maxlen, attr, recurse)
|
||||
* Scroll the screen up one line for displaying the next message line.
|
||||
*/
|
||||
static void
|
||||
msg_scroll_up()
|
||||
msg_scroll_up(void)
|
||||
{
|
||||
#ifdef FEAT_GUI
|
||||
/* Remove the cursor before scrolling, ScreenLines[] is going
|
||||
@ -2169,7 +2114,7 @@ msg_scroll_up()
|
||||
* Increment "msg_scrolled".
|
||||
*/
|
||||
static void
|
||||
inc_msg_scrolled()
|
||||
inc_msg_scrolled(void)
|
||||
{
|
||||
#ifdef FEAT_EVAL
|
||||
if (*get_vim_var_str(VV_SCROLLSTART) == NUL)
|
||||
@ -2226,12 +2171,12 @@ static int do_clear_sb_text = FALSE; /* clear text on next msg */
|
||||
* Store part of a printed message for displaying when scrolling back.
|
||||
*/
|
||||
static void
|
||||
store_sb_text(sb_str, s, attr, sb_col, finish)
|
||||
char_u **sb_str; /* start of string */
|
||||
char_u *s; /* just after string */
|
||||
int attr;
|
||||
int *sb_col;
|
||||
int finish; /* line ends */
|
||||
store_sb_text(
|
||||
char_u **sb_str, /* start of string */
|
||||
char_u *s, /* just after string */
|
||||
int attr,
|
||||
int *sb_col,
|
||||
int finish) /* line ends */
|
||||
{
|
||||
msgchunk_T *mp;
|
||||
|
||||
@ -2276,7 +2221,7 @@ store_sb_text(sb_str, s, attr, sb_col, finish)
|
||||
* Finished showing messages, clear the scroll-back text on the next message.
|
||||
*/
|
||||
void
|
||||
may_clear_sb_text()
|
||||
may_clear_sb_text(void)
|
||||
{
|
||||
do_clear_sb_text = TRUE;
|
||||
}
|
||||
@ -2286,7 +2231,7 @@ may_clear_sb_text()
|
||||
* Called when redrawing the screen.
|
||||
*/
|
||||
void
|
||||
clear_sb_text()
|
||||
clear_sb_text(void)
|
||||
{
|
||||
msgchunk_T *mp;
|
||||
|
||||
@ -2302,7 +2247,7 @@ clear_sb_text()
|
||||
* "g<" command.
|
||||
*/
|
||||
void
|
||||
show_sb_text()
|
||||
show_sb_text(void)
|
||||
{
|
||||
msgchunk_T *mp;
|
||||
|
||||
@ -2322,8 +2267,7 @@ show_sb_text()
|
||||
* Move to the start of screen line in already displayed text.
|
||||
*/
|
||||
static msgchunk_T *
|
||||
msg_sb_start(mps)
|
||||
msgchunk_T *mps;
|
||||
msg_sb_start(msgchunk_T *mps)
|
||||
{
|
||||
msgchunk_T *mp = mps;
|
||||
|
||||
@ -2336,7 +2280,7 @@ msg_sb_start(mps)
|
||||
* Mark the last message chunk as finishing the line.
|
||||
*/
|
||||
void
|
||||
msg_sb_eol()
|
||||
msg_sb_eol(void)
|
||||
{
|
||||
if (last_msgchunk != NULL)
|
||||
last_msgchunk->sb_eol = TRUE;
|
||||
@ -2347,9 +2291,7 @@ msg_sb_eol()
|
||||
* Returns a pointer to the text for the next line (can be NULL).
|
||||
*/
|
||||
static msgchunk_T *
|
||||
disp_sb_line(row, smp)
|
||||
int row;
|
||||
msgchunk_T *smp;
|
||||
disp_sb_line(int row, msgchunk_T *smp)
|
||||
{
|
||||
msgchunk_T *mp = smp;
|
||||
char_u *p;
|
||||
@ -2373,11 +2315,11 @@ disp_sb_line(row, smp)
|
||||
* Output any postponed text for msg_puts_attr_len().
|
||||
*/
|
||||
static void
|
||||
t_puts(t_col, t_s, s, attr)
|
||||
int *t_col;
|
||||
char_u *t_s;
|
||||
char_u *s;
|
||||
int attr;
|
||||
t_puts(
|
||||
int *t_col,
|
||||
char_u *t_s,
|
||||
char_u *s,
|
||||
int attr)
|
||||
{
|
||||
/* output postponed text */
|
||||
msg_didout = TRUE; /* remember that line is not empty */
|
||||
@ -2406,7 +2348,7 @@ t_puts(t_col, t_s, s, attr)
|
||||
* cursor is.
|
||||
*/
|
||||
int
|
||||
msg_use_printf()
|
||||
msg_use_printf(void)
|
||||
{
|
||||
return (!msg_check_screen()
|
||||
#if defined(WIN3264) && !defined(FEAT_GUI_MSWIN)
|
||||
@ -2420,9 +2362,7 @@ msg_use_printf()
|
||||
* Print a message when there is no valid screen.
|
||||
*/
|
||||
static void
|
||||
msg_puts_printf(str, maxlen)
|
||||
char_u *str;
|
||||
int maxlen;
|
||||
msg_puts_printf(char_u *str, int maxlen)
|
||||
{
|
||||
char_u *s = str;
|
||||
char_u buf[4];
|
||||
@ -2487,8 +2427,7 @@ msg_puts_printf(str, maxlen)
|
||||
* Returns TRUE when jumping ahead to "confirm_msg_tail".
|
||||
*/
|
||||
static int
|
||||
do_more_prompt(typed_char)
|
||||
int typed_char;
|
||||
do_more_prompt(int typed_char)
|
||||
{
|
||||
int used_typed_char = typed_char;
|
||||
int oldState = State;
|
||||
@ -2761,8 +2700,7 @@ do_more_prompt(typed_char)
|
||||
* started and they can be displayed in a message box.
|
||||
*/
|
||||
void
|
||||
mch_errmsg(str)
|
||||
char *str;
|
||||
mch_errmsg(char *str)
|
||||
{
|
||||
int len;
|
||||
|
||||
@ -2830,8 +2768,7 @@ mch_errmsg(str)
|
||||
* can be displayed in a message box.
|
||||
*/
|
||||
void
|
||||
mch_msg(str)
|
||||
char *str;
|
||||
mch_msg(char *str)
|
||||
{
|
||||
#if (defined(UNIX) || defined(FEAT_GUI)) && !defined(ALWAYS_USE_GUI)
|
||||
/* On Unix use stdout if we have a tty. This allows "vim -h | more" and
|
||||
@ -2867,9 +2804,7 @@ mch_msg(str)
|
||||
* to the next position. Only for printable ASCII!
|
||||
*/
|
||||
static void
|
||||
msg_screen_putchar(c, attr)
|
||||
int c;
|
||||
int attr;
|
||||
msg_screen_putchar(int c, int attr)
|
||||
{
|
||||
msg_didout = TRUE; /* remember that line is not empty */
|
||||
screen_putchar(c, msg_row, msg_col, attr);
|
||||
@ -2894,8 +2829,7 @@ msg_screen_putchar(c, attr)
|
||||
}
|
||||
|
||||
void
|
||||
msg_moremsg(full)
|
||||
int full;
|
||||
msg_moremsg(int full)
|
||||
{
|
||||
int attr;
|
||||
char_u *s = (char_u *)_("-- More --");
|
||||
@ -2913,7 +2847,7 @@ msg_moremsg(full)
|
||||
* exmode_active.
|
||||
*/
|
||||
void
|
||||
repeat_message()
|
||||
repeat_message(void)
|
||||
{
|
||||
if (State == ASKMORE)
|
||||
{
|
||||
@ -2954,7 +2888,7 @@ repeat_message()
|
||||
* output goes to the terminal. Don't use the terminal codes then.
|
||||
*/
|
||||
static int
|
||||
msg_check_screen()
|
||||
msg_check_screen(void)
|
||||
{
|
||||
if (!full_screen || !screen_valid(FALSE))
|
||||
return FALSE;
|
||||
@ -2971,7 +2905,7 @@ msg_check_screen()
|
||||
* Skip this when ":silent" was used, no need to clear for redirection.
|
||||
*/
|
||||
void
|
||||
msg_clr_eos()
|
||||
msg_clr_eos(void)
|
||||
{
|
||||
if (msg_silent == 0)
|
||||
msg_clr_eos_force();
|
||||
@ -2983,7 +2917,7 @@ msg_clr_eos()
|
||||
* for msg_check().
|
||||
*/
|
||||
void
|
||||
msg_clr_eos_force()
|
||||
msg_clr_eos_force(void)
|
||||
{
|
||||
if (msg_use_printf())
|
||||
{
|
||||
@ -3017,7 +2951,7 @@ msg_clr_eos_force()
|
||||
* Clear the command line.
|
||||
*/
|
||||
void
|
||||
msg_clr_cmdline()
|
||||
msg_clr_cmdline(void)
|
||||
{
|
||||
msg_row = cmdline_row;
|
||||
msg_col = 0;
|
||||
@ -3030,7 +2964,7 @@ msg_clr_cmdline()
|
||||
* return TRUE if wait_return not called.
|
||||
*/
|
||||
int
|
||||
msg_end()
|
||||
msg_end(void)
|
||||
{
|
||||
/*
|
||||
* If the string is larger than the window,
|
||||
@ -3052,7 +2986,7 @@ msg_end()
|
||||
* wait for hit-return and redraw the window later.
|
||||
*/
|
||||
void
|
||||
msg_check()
|
||||
msg_check(void)
|
||||
{
|
||||
if (msg_row == Rows - 1 && msg_col >= sc_col)
|
||||
{
|
||||
@ -3066,9 +3000,7 @@ msg_check()
|
||||
* When "maxlen" is -1 write the whole string, otherwise up to "maxlen" bytes.
|
||||
*/
|
||||
static void
|
||||
redir_write(str, maxlen)
|
||||
char_u *str;
|
||||
int maxlen;
|
||||
redir_write(char_u *str, int maxlen)
|
||||
{
|
||||
char_u *s = str;
|
||||
static int cur_col = 0;
|
||||
@ -3135,7 +3067,7 @@ redir_write(str, maxlen)
|
||||
}
|
||||
|
||||
int
|
||||
redirecting()
|
||||
redirecting(void)
|
||||
{
|
||||
return redir_fd != NULL || *p_vfile != NUL
|
||||
#ifdef FEAT_EVAL
|
||||
@ -3149,7 +3081,7 @@ redirecting()
|
||||
* Must always be called paired with verbose_leave()!
|
||||
*/
|
||||
void
|
||||
verbose_enter()
|
||||
verbose_enter(void)
|
||||
{
|
||||
if (*p_vfile != NUL)
|
||||
++msg_silent;
|
||||
@ -3160,7 +3092,7 @@ verbose_enter()
|
||||
* Must always be called paired with verbose_enter()!
|
||||
*/
|
||||
void
|
||||
verbose_leave()
|
||||
verbose_leave(void)
|
||||
{
|
||||
if (*p_vfile != NUL)
|
||||
if (--msg_silent < 0)
|
||||
@ -3171,7 +3103,7 @@ verbose_leave()
|
||||
* Like verbose_enter() and set msg_scroll when displaying the message.
|
||||
*/
|
||||
void
|
||||
verbose_enter_scroll()
|
||||
verbose_enter_scroll(void)
|
||||
{
|
||||
if (*p_vfile != NUL)
|
||||
++msg_silent;
|
||||
@ -3184,7 +3116,7 @@ verbose_enter_scroll()
|
||||
* Like verbose_leave() and set cmdline_row when displaying the message.
|
||||
*/
|
||||
void
|
||||
verbose_leave_scroll()
|
||||
verbose_leave_scroll(void)
|
||||
{
|
||||
if (*p_vfile != NUL)
|
||||
{
|
||||
@ -3199,7 +3131,7 @@ verbose_leave_scroll()
|
||||
* Called when 'verbosefile' is set: stop writing to the file.
|
||||
*/
|
||||
void
|
||||
verbose_stop()
|
||||
verbose_stop(void)
|
||||
{
|
||||
if (verbose_fd != NULL)
|
||||
{
|
||||
@ -3214,7 +3146,7 @@ verbose_stop()
|
||||
* Return FAIL or OK.
|
||||
*/
|
||||
int
|
||||
verbose_open()
|
||||
verbose_open(void)
|
||||
{
|
||||
if (verbose_fd == NULL && !verbose_did_open)
|
||||
{
|
||||
@ -3236,9 +3168,7 @@ verbose_open()
|
||||
* Use 'w' highlighting and may repeat the message after redrawing
|
||||
*/
|
||||
void
|
||||
give_warning(message, hl)
|
||||
char_u *message;
|
||||
int hl;
|
||||
give_warning(char_u *message, int hl)
|
||||
{
|
||||
/* Don't do this for ":silent". */
|
||||
if (msg_silent != 0)
|
||||
@ -3269,8 +3199,7 @@ give_warning(message, hl)
|
||||
* Advance msg cursor to column "col".
|
||||
*/
|
||||
void
|
||||
msg_advance(col)
|
||||
int col;
|
||||
msg_advance(int col)
|
||||
{
|
||||
if (msg_silent != 0) /* nothing to advance to */
|
||||
{
|
||||
@ -3309,15 +3238,15 @@ msg_advance(col)
|
||||
* different letter.
|
||||
*/
|
||||
int
|
||||
do_dialog(type, title, message, buttons, dfltbutton, textfield, ex_cmd)
|
||||
int type UNUSED;
|
||||
char_u *title UNUSED;
|
||||
char_u *message;
|
||||
char_u *buttons;
|
||||
int dfltbutton;
|
||||
char_u *textfield UNUSED; /* IObuff for inputdialog(), NULL
|
||||
do_dialog(
|
||||
int type UNUSED,
|
||||
char_u *title UNUSED,
|
||||
char_u *message,
|
||||
char_u *buttons,
|
||||
int dfltbutton,
|
||||
char_u *textfield UNUSED, /* IObuff for inputdialog(), NULL
|
||||
otherwise */
|
||||
int ex_cmd; /* when TRUE pressing : accepts default and starts
|
||||
int ex_cmd) /* when TRUE pressing : accepts default and starts
|
||||
Ex command */
|
||||
{
|
||||
int oldState;
|
||||
@ -3437,10 +3366,10 @@ static int copy_char(char_u *from, char_u *to, int lowercase);
|
||||
* characters. Return the length of the character in bytes.
|
||||
*/
|
||||
static int
|
||||
copy_char(from, to, lowercase)
|
||||
char_u *from;
|
||||
char_u *to;
|
||||
int lowercase; /* make character lower case */
|
||||
copy_char(
|
||||
char_u *from,
|
||||
char_u *to,
|
||||
int lowercase) /* make character lower case */
|
||||
{
|
||||
#ifdef FEAT_MBYTE
|
||||
int len;
|
||||
@ -3481,10 +3410,10 @@ copy_char(from, to, lowercase)
|
||||
* Returns an allocated string with hotkeys, or NULL for error.
|
||||
*/
|
||||
static char_u *
|
||||
msg_show_console_dialog(message, buttons, dfltbutton)
|
||||
char_u *message;
|
||||
char_u *buttons;
|
||||
int dfltbutton;
|
||||
msg_show_console_dialog(
|
||||
char_u *message,
|
||||
char_u *buttons,
|
||||
int dfltbutton)
|
||||
{
|
||||
int len = 0;
|
||||
#ifdef FEAT_MBYTE
|
||||
@ -3641,7 +3570,7 @@ msg_show_console_dialog(message, buttons, dfltbutton)
|
||||
* Display the ":confirm" message. Also called when screen resized.
|
||||
*/
|
||||
void
|
||||
display_confirm_msg()
|
||||
display_confirm_msg(void)
|
||||
{
|
||||
/* avoid that 'q' at the more prompt truncates the message here */
|
||||
++confirm_msg_used;
|
||||
@ -3655,11 +3584,11 @@ display_confirm_msg()
|
||||
#if defined(FEAT_CON_DIALOG) || defined(FEAT_GUI_DIALOG)
|
||||
|
||||
int
|
||||
vim_dialog_yesno(type, title, message, dflt)
|
||||
int type;
|
||||
char_u *title;
|
||||
char_u *message;
|
||||
int dflt;
|
||||
vim_dialog_yesno(
|
||||
int type,
|
||||
char_u *title,
|
||||
char_u *message,
|
||||
int dflt)
|
||||
{
|
||||
if (do_dialog(type,
|
||||
title == NULL ? (char_u *)_("Question") : title,
|
||||
@ -3670,11 +3599,11 @@ vim_dialog_yesno(type, title, message, dflt)
|
||||
}
|
||||
|
||||
int
|
||||
vim_dialog_yesnocancel(type, title, message, dflt)
|
||||
int type;
|
||||
char_u *title;
|
||||
char_u *message;
|
||||
int dflt;
|
||||
vim_dialog_yesnocancel(
|
||||
int type,
|
||||
char_u *title,
|
||||
char_u *message,
|
||||
int dflt)
|
||||
{
|
||||
switch (do_dialog(type,
|
||||
title == NULL ? (char_u *)_("Question") : title,
|
||||
@ -3688,11 +3617,11 @@ vim_dialog_yesnocancel(type, title, message, dflt)
|
||||
}
|
||||
|
||||
int
|
||||
vim_dialog_yesnoallcancel(type, title, message, dflt)
|
||||
int type;
|
||||
char_u *title;
|
||||
char_u *message;
|
||||
int dflt;
|
||||
vim_dialog_yesnoallcancel(
|
||||
int type,
|
||||
char_u *title,
|
||||
char_u *message,
|
||||
int dflt)
|
||||
{
|
||||
switch (do_dialog(type,
|
||||
title == NULL ? (char_u *)"Question" : title,
|
||||
@ -3716,15 +3645,15 @@ vim_dialog_yesnoallcancel(type, title, message, dflt)
|
||||
* Later this may pop-up a non-GUI file selector (external command?).
|
||||
*/
|
||||
char_u *
|
||||
do_browse(flags, title, dflt, ext, initdir, filter, buf)
|
||||
int flags; /* BROWSE_SAVE and BROWSE_DIR */
|
||||
char_u *title; /* title for the window */
|
||||
char_u *dflt; /* default file name (may include directory) */
|
||||
char_u *ext; /* extension added */
|
||||
char_u *initdir; /* initial directory, NULL for current dir or
|
||||
do_browse(
|
||||
int flags, /* BROWSE_SAVE and BROWSE_DIR */
|
||||
char_u *title, /* title for the window */
|
||||
char_u *dflt, /* default file name (may include directory) */
|
||||
char_u *ext, /* extension added */
|
||||
char_u *initdir, /* initial directory, NULL for current dir or
|
||||
when using path from "dflt" */
|
||||
char_u *filter; /* file name filter */
|
||||
buf_T *buf; /* buffer to read/write for */
|
||||
char_u *filter, /* file name filter */
|
||||
buf_T *buf) /* buffer to read/write for */
|
||||
{
|
||||
char_u *fname;
|
||||
static char_u *last_dir = NULL; /* last used directory */
|
||||
@ -3885,9 +3814,7 @@ static double tv_float(typval_T *tvs, int *idxp);
|
||||
* Get number argument from "idxp" entry in "tvs". First entry is 1.
|
||||
*/
|
||||
static long
|
||||
tv_nr(tvs, idxp)
|
||||
typval_T *tvs;
|
||||
int *idxp;
|
||||
tv_nr(typval_T *tvs, int *idxp)
|
||||
{
|
||||
int idx = *idxp - 1;
|
||||
long n = 0;
|
||||
@ -3910,9 +3837,7 @@ tv_nr(tvs, idxp)
|
||||
* Returns NULL for an error.
|
||||
*/
|
||||
static char *
|
||||
tv_str(tvs, idxp)
|
||||
typval_T *tvs;
|
||||
int *idxp;
|
||||
tv_str(typval_T *tvs, int *idxp)
|
||||
{
|
||||
int idx = *idxp - 1;
|
||||
char *s = NULL;
|
||||
@ -3932,9 +3857,7 @@ tv_str(tvs, idxp)
|
||||
* Get float argument from "idxp" entry in "tvs". First entry is 1.
|
||||
*/
|
||||
static double
|
||||
tv_float(tvs, idxp)
|
||||
typval_T *tvs;
|
||||
int *idxp;
|
||||
tv_float(typval_T *tvs, int *idxp)
|
||||
{
|
||||
int idx = *idxp - 1;
|
||||
double f = 0;
|
||||
@ -4034,12 +3957,12 @@ vim_snprintf(char *str, size_t str_m, char *fmt, ...)
|
||||
}
|
||||
|
||||
int
|
||||
vim_vsnprintf(str, str_m, fmt, ap, tvs)
|
||||
char *str;
|
||||
size_t str_m;
|
||||
char *fmt;
|
||||
va_list ap;
|
||||
typval_T *tvs;
|
||||
vim_vsnprintf(
|
||||
char *str,
|
||||
size_t str_m,
|
||||
char *fmt,
|
||||
va_list ap,
|
||||
typval_T *tvs)
|
||||
{
|
||||
size_t str_l = 0;
|
||||
char *p = fmt;
|
||||
|
@ -746,6 +746,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1210,
|
||||
/**/
|
||||
1209,
|
||||
/**/
|
||||
|
Loading…
x
Reference in New Issue
Block a user